[SCM] blender/upstream: Imported Upstream version 2.63

mfv-guest at users.alioth.debian.org mfv-guest at users.alioth.debian.org
Sat Apr 28 08:41:18 UTC 2012


The following commit has been merged in the upstream branch:
commit d89aff95134cd0ed8c7ada69c206bd698b92ab14
Author: Matteo F. Vescovi <mfv.debian at gmail.com>
Date:   Sat Apr 28 10:33:00 2012 +0200

    Imported Upstream version 2.63

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e0b14b7..7e9e50f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -124,7 +124,7 @@ mark_as_advanced(WITH_PYTHON)  # dont want people disabling this unless they rea
 mark_as_advanced(WITH_PYTHON_SECURITY)  # some distrobutions see this as a security issue, rather than have them patch it, make a build option.
 
 option(WITH_PYTHON_SAFETY "Enable internal API error checking to track invalid data to prevent crash on access (at the expense of some effeciency, only enable for development)." OFF)
-option(WITH_PYTHON_MODULE "Enable building as a python module (experemental, only enable for development)" OFF)
+option(WITH_PYTHON_MODULE "Enable building as a python module (experimental, only enable for development)" OFF)
 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_FFTW3         "Enable FFTW3 support (Used for smoke and audio effects)" OFF)
@@ -149,10 +149,13 @@ mark_as_advanced(WITH_AUDASPACE)
 
 # (unix defaults to OpenMP On)
 if(UNIX AND NOT APPLE)
-	option(WITH_OPENMP        "Enable OpenMP (has to be supported by the compiler)" ON)
+	set(PLATFORM_DEFAULT ON)
 else()
-	option(WITH_OPENMP        "Enable OpenMP (has to be supported by the compiler)" OFF)
+	set(PLATFORM_DEFAULT OFF)
 endif()
+option(WITH_OPENMP        "Enable OpenMP (has to be supported by the compiler)" ${PLATFORM_DEFAULT})
+unset(PLATFORM_DEFAULT)
+
 
 if(UNIX AND NOT APPLE)
 	option(WITH_X11_XINPUT "Enable X11 Xinput (tablet support and unicode input)"	ON)
@@ -160,6 +163,11 @@ if(UNIX AND NOT APPLE)
 	option(WITH_BUILTIN_GLEW "Use GLEW OpenGL wrapper library bundled with blender" ON)
 	option(WITH_XDG_USER_DIRS    "Build with XDG Base Directory Specification (only config and documents for now)" OFF)
 	mark_as_advanced(WITH_XDG_USER_DIRS)
+
+	# freebsd doesn't seems to support XDND
+	if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
+		option(WITH_GHOST_XDND   "Enable drag'n'drop support on Linux using XDND protocol" ON)
+	endif()
 else()
 	# not an option for other OS's
 	set(WITH_BUILTIN_GLEW ON)
@@ -171,7 +179,7 @@ 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 Experemental cloth solver" OFF)
+option(WITH_MOD_CLOTH_ELTOPO   	"Enable Experimental cloth solver" OFF)
 mark_as_advanced(WITH_MOD_CLOTH_ELTOPO)
 option(WITH_MOD_OCEANSIM        "Enable Ocean Modifier" OFF)
 
@@ -187,6 +195,8 @@ option(WITH_IMAGE_FRAMESERVER   "Enable image FrameServer Support for rendering"
 
 # Audio/Video format support
 option(WITH_CODEC_FFMPEG        "Enable FFMPeg Support (http://ffmpeg.org)" OFF)
+unset(PLATFORM_DEFAULT)
+
 option(WITH_CODEC_SNDFILE       "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF)
 if(APPLE OR (WIN32 AND NOT UNIX))
 	option(WITH_CODEC_QUICKTIME     "Enable Quicktime Support" OFF)
@@ -218,6 +228,8 @@ if(UNIX AND NOT APPLE)
 	option(WITH_INSTALL_PORTABLE "Install redistributeable runtime, otherwise install into CMAKE_INSTALL_PREFIX" ON)
 endif()
 option(WITH_PYTHON_INSTALL       "Copy system python into the blender install folder" ON)
+option(WITH_MINGW64                   "Use the 64-bit version of MinGW" OFF)
+mark_as_advanced(WITH_MINGW64)
 
 # Cycles
 option(WITH_CYCLES					"Enable cycles Render Engine" ON)
@@ -244,22 +256,50 @@ if(APPLE)
 		"Choose the architecture you want to build Blender for: i386, x86_64 or ppc"
 		FORCE)
 	endif()
+	
+	execute_process(COMMAND uname -r OUTPUT_VARIABLE MAC_SYS) # check for actual system-version
+	if (${MAC_SYS} MATCHES 11)
+		set(OSX_SYSTEM 10.7)
+	elseif(${MAC_SYS} MATCHES 10)
+		set(OSX_SYSTEM 10.6)
+	elseif(${MAC_SYS} MATCHES 9)
+		set(OSX_SYSTEM 10.5)
+	else()
+		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
-		"Choose the minimum OSX version required: 10.4 or 10.5"
-		FORCE)
+			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" AND (${XCODE_VERSION} VERSION_EQUAL 4 OR ${XCODE_VERSION} VERSION_GREATER 4))
-		# Xcode 4 defaults to the Apple LLVM Compiler.
-		# Override the default compiler selection because Blender only compiles with gcc
-		set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvmgcc42")
-		message(STATUS "Setting compiler to: " ${CMAKE_XCODE_ATTRIBUTE_GCC_VERSION})
+
+	if(${CMAKE_GENERATOR} MATCHES "Xcode")
+	
+		##### workaround for actual official cmake incompatibility with xcode 4.3 #####	
+		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")
+		endif()
+		### end workaround for actual official cmake incompatibility with xcode 4.3 ###	
+		
+		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.
+			# Override the default compiler selection because Blender only compiles with gcc up to xcode 4.2
+			set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvmgcc42")
+			message(STATUS "Setting compiler to: " ${CMAKE_XCODE_ATTRIBUTE_GCC_VERSION})
+		endif()
+	else() # unix makefile generator does not fill XCODE_VERSION var, so we get it with a command
+		execute_process(COMMAND xcodebuild -version OUTPUT_VARIABLE XCODE_VERS_BUILDNR )
+		STRING(SUBSTRING ${XCODE_VERS_BUILDNR} 6 3 XCODE_VERSION) # truncate away build-nr
 	endif()
+	
+	message(STATUS "Detected Xcode-version: " ${XCODE_VERSION})
+	
 	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)
 endif()
 
+
 #-----------------------------------------------------------------------------
 # Check for conflicting/unsupported configurations
 
@@ -271,8 +311,8 @@ 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))
-	message(FATAL_ERROR "WITH_OPENAL/WITH_SDL/WITH_JACK/WITH_CODEC_FFMPEG require WITH_AUDASPACE")
+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")
 endif()
 
 if(NOT WITH_SDL AND WITH_GHOST_SDL)
@@ -292,13 +332,6 @@ if(WITH_PYTHON_MODULE AND WITH_PYTHON_INSTALL)
 	message(FATAL_ERROR "WITH_PYTHON_MODULE requires WITH_PYTHON_INSTALL to be OFF")
 endif()
 
-if(MINGW)
-	if(WITH_CODEC_QUICKTIME)
-		message(FATAL_ERROR "MINGW requires WITH_CODEC_QUICKTIME to be OFF "
-							"because it is currently unsupported, remove this "
-							"line if youre a developer who wants to add support.")
-	endif()
-endif()
 
 if(NOT WITH_FFTW3 AND WITH_MOD_OCEANSIM)
 	message(FATAL_ERROR "WITH_MOD_OCEANSIM requires WITH_FFTW3 to be ON")
@@ -319,13 +352,51 @@ if(WITH_CYCLES OR WITH_CARVE)
 	set(WITH_BOOST ON)
 endif()
 
-TEST_SSE_SUPPORT(COMPILER_SSE_FLAG COMPILER_SSE2_FLAG)
-
 # don't store paths to libs for portable distrobution
 if(WITH_INSTALL_PORTABLE)
 	set(CMAKE_SKIP_BUILD_RPATH TRUE)
 endif()
 
+if(WITH_GHOST_SDL OR WITH_HEADLESS)
+	set(WITH_GHOST_XDND OFF)
+endif()
+
+if(MINGW)
+	if(WITH_CODEC_QUICKTIME)
+		message(FATAL_ERROR "MINGW requires WITH_CODEC_QUICKTIME to be OFF "
+		                    "because it is currently unsupported, remove this "
+		                    "line if youre a developer who wants to add support.")
+	endif()
+	
+	if((WITH_MINGW64) AND (WITH_OPENCOLLADA OR WITH_CODEC_FFMPEG))
+		message(FATAL_ERROR "MINGW64 still doesn't support: WITH_OPENCOLLADA/WITH_CODEC_FFMPEG")
+	endif()
+endif()
+
+TEST_SSE_SUPPORT(COMPILER_SSE_FLAG COMPILER_SSE2_FLAG)
+
+
+#-----------------------------------------------------------------------------
+# Check for valid directories
+# ... svn extern paths can be missing because of svn-git.
+
+if(WITH_INTERNATIONAL)
+	if(NOT EXISTS "${CMAKE_SOURCE_DIR}/release/datafiles/locale")
+		message(WARNING "Translation path '${CMAKE_SOURCE_DIR}/release/datafiles/locale' is missing, "
+						"This is an 'svn external', which are known not to work with bridges to other version "
+						"control systems, disabling 'WITH_INTERNATIONAL'.")
+		set(WITH_INTERNATIONAL OFF)
+	endif()
+endif()
+
+if(WITH_PYTHON)
+	if(NOT EXISTS "${CMAKE_SOURCE_DIR}/release/scripts/addons")
+		message(WARNING "Addons path '${CMAKE_SOURCE_DIR}/release/scripts/addons' is missing, "
+						"This is an 'svn external', which are known not to work with bridges to other version "
+						"control systems: * CONTINUING WITHOUT ADDONS *")
+	endif()
+endif()
+
 #-----------------------------------------------------------------------------
 # Initialize un-cached vars, avoid unused warning
 
@@ -665,14 +736,24 @@ elseif(WIN32)
 	# this file is included anyway when building under Windows with cl.exe
 	#  include(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
 
-	set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/windows)
+	if(CMAKE_COMPILER_IS_GNUCC)
+		set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw32)
 
-	# Setup 64bit and 64bit windows systems
-	if(CMAKE_CL_64)
-		message("64 bit compiler detected.")
-		set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/win64)
-	endif()
+		# Setup 64bit and 64bit windows systems		
+		if(WITH_MINGW64)
+			message("Set 64 bit compiler for MinGW.")
+			set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw64)
+		endif()
+	else()
+		set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/windows)
 
+		# Setup 64bit and 64bit windows systems
+		if(CMAKE_CL_64)
+			message("64 bit compiler detected.")
+			set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/win64)
+		endif()
+	endif()
+		
 	add_definitions(-DWIN32)
 
 	if(WITH_INTERNATIONAL)
@@ -691,7 +772,7 @@ elseif(WIN32)
 	if(WITH_OPENAL)
 		set(OPENAL ${LIBDIR}/openal)
 		set(OPENAL_INCLUDE_DIR ${OPENAL}/include)
-		set(OPENAL_LIBRARY OpenAL32)
+		set(OPENAL_LIBRARY wrap_oal)
 		set(OPENAL_LIBPATH ${OPENAL}/lib)
 	endif()
 
@@ -920,29 +1001,44 @@ elseif(WIN32)
 
 		set(PLATFORM_LINKFLAGS_DEBUG "/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib")
 
-	else()
-		# keep GCC specific stuff here
-		if(CMAKE_COMPILER_IS_GNUCC)
-			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")
+		# used in many places so include globally, like OpenGL
+		blender_include_dirs("${PTHREADS_INCLUDE_DIRS}")
+
+	elseif(CMAKE_COMPILER_IS_GNUCC)
+	# 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")
 
-			add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
+		if(WITH_MINGW64)
+			#Yes, the point for MinGW64 is moar optimization by default :)
+			set(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -mmmx -msse -msse2 -ftree-vectorize")
+			set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
+			set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} -lpthread")
+			
+			add_definitions(-DFREE_WINDOWS64 -DMS_WIN64)
 		endif()
 
+		add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
+
+
 		add_definitions(-DFREE_WINDOWS)
 
 		if(WITH_INTERNATIONAL)
-			set(GETTEXT ${LIBDIR}/gcc/gettext)
+			set(GETTEXT ${LIBDIR}/gettext)
 			set(GETTEXT_INCLUDE_DIRS ${GETTEXT}/include)
 			set(GETTEXT_LIBPATH ${GETTEXT}/lib)
 			set(GETTEXT_LIBRARIES intl)
 		endif()
 		
-		set(PNG "${LIBDIR}/gcc/png")
+		set(PNG "${LIBDIR}/png")
 		set(PNG_INCLUDE_DIR "${PNG}/include")
 		set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
 
-		set(JPEG_LIBRARIES libjpeg)
+		if(WITH_MINGW64)
+			set(JPEG_LIBRARIES jpeg)
+		else()
+			set(JPEG_LIBRARIES libjpeg)
+		endif()
 		set(PNG_LIBRARIES png)
 
 		set(ZLIB ${LIBDIR}/zlib)
@@ -950,31 +1046,34 @@ elseif(WIN32)
 		set(ZLIB_LIBPATH ${ZLIB}/lib)
 		set(ZLIB_LIBRARIES z)
 
-		set(PTHREADS ${LIBDIR}/pthreads)
-		set(PTHREADS_INCLUDE_DIRS ${PTHREADS}/include)
-		set(PTHREADS_LIBPATH ${PTHREADS}/lib)
-		set(PTHREADS_LIBRARIES pthreadGC2)
-
-		set(FREETYPE ${LIBDIR}/gcc/freetype)
+		#comes with own pthread library
+		if(NOT WITH_MINGW64)
+			set(PTHREADS ${LIBDIR}/pthreads)
+			set(PTHREADS_INCLUDE_DIRS ${PTHREADS}/include)
+			set(PTHREADS_LIBPATH ${PTHREADS}/lib)
+			set(PTHREADS_LIBRARIES pthreadGC2)
+		endif()
+		
+		set(FREETYPE ${LIBDIR}/freetype)
 		set(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
 		set(FREETYPE_LIBPATH ${FREETYPE}/lib)
 		set(FREETYPE_LIBRARY freetype)
 
 		if(WITH_FFTW3)
-			set(FFTW3 ${LIBDIR}/gcc/fftw3)
+			set(FFTW3 ${LIBDIR}/fftw3)
 			set(FFTW3_LIBRARIES fftw3)
 			set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
 			set(FFTW3_LIBPATH ${FFTW3}/lib)
 		endif()
 
 		if(WITH_OPENCOLLADA)
-			set(OPENCOLLADA ${LIBDIR}/gcc/opencollada)
+			set(OPENCOLLADA ${LIBDIR}/opencollada)
 			set(OPENCOLLADA_INCLUDE_DIRS
-				${LIBDIR}/gcc/opencollada/include/COLLADAStreamWriter/include
-				${LIBDIR}/gcc/opencollada/include/COLLADABaseUtils/include
-				${LIBDIR}/gcc/opencollada/include/COLLADAFramework/include
-				${LIBDIR}/gcc/opencollada/include/COLLADASaxFrameworkLoader/include
-				${LIBDIR}/gcc/opencollada/include/GeneratedSaxParser/include
+				${LIBDIR}/opencollada/include/COLLADAStreamWriter/include
+				${LIBDIR}/opencollada/include/COLLADABaseUtils/include
+				${LIBDIR}/opencollada/include/COLLADAFramework/include
+				${LIBDIR}/opencollada/include/COLLADASaxFrameworkLoader/include
+				${LIBDIR}/opencollada/include/GeneratedSaxParser/include
 			)
 			set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib ${OPENCOLLADA}/lib)
 			set(OPENCOLLADA_LIBRARIES OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver expat pcre buffer ftoa)
@@ -989,14 +1088,14 @@ elseif(WIN32)
 		endif()
 
 		if(WITH_IMAGE_OPENEXR)
-			set(OPENEXR ${LIBDIR}/gcc/openexr)
+			set(OPENEXR ${LIBDIR}/openexr)
 			set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
 			set(OPENEXR_LIBRARIES Half IlmImf Imath IlmThread Iex)
 			set(OPENEXR_LIBPATH ${OPENEXR}/lib)
 		endif()
 
 		if(WITH_IMAGE_TIFF)
-			set(TIFF ${LIBDIR}/gcc/tiff)
+			set(TIFF ${LIBDIR}/tiff)
 			set(TIFF_LIBRARY tiff)
 			set(TIFF_INCLUDE_DIR ${TIFF}/include)
 			set(TIFF_LIBPATH ${TIFF}/lib)
@@ -1026,19 +1125,24 @@ elseif(WIN32)
 		if(WITH_BOOST)
 			set(BOOST ${LIBDIR}/boost)
 			set(BOOST_INCLUDE_DIR ${BOOST}/include)
-			set(BOOST_POSTFIX "mgw45-mt-s-1_47")
-			set(BOOST_DEBUG_POSTFIX "mgw45-mt-sd-1_47")
+			if(WITH_MINGW64)
+				set(BOOST_POSTFIX "mgw47-mt-s-1_49")
+				set(BOOST_DEBUG_POSTFIX "mgw47-mt-sd-1_49")
+			else()
+				set(BOOST_POSTFIX "mgw46-mt-s-1_47")
+				set(BOOST_DEBUG_POSTFIX "mgw46-mt-sd-1_47")
+			endif()		
 			set(BOOST_LIBRARIES
 				optimized boost_date_time-${BOOST_POSTFIX} boost_filesystem-${BOOST_POSTFIX}
 				boost_regex-${BOOST_POSTFIX} boost_system-${BOOST_POSTFIX} boost_thread-${BOOST_POSTFIX}
 				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})
-			set(BOOST_LIBPATH ${BOOST}/lib/gcc)
+			set(BOOST_LIBPATH ${BOOST}/lib)
 			set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB -DBOOST_THREAD_USE_LIB ")
 		endif()
 			
 		if(WITH_OPENIMAGEIO)
-			set(OPENIMAGEIO ${LIBDIR}/gcc/openimageio)
+			set(OPENIMAGEIO ${LIBDIR}/openimageio)
 			set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
 			set(OPENIMAGEIO_LIBRARIES OpenImageIO)
 			set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
@@ -1053,15 +1157,22 @@ elseif(WIN32)
 
 	endif()
 
-	# used in many places so include globally, like OpenGL
-	blender_include_dirs("${PTHREADS_INCLUDE_DIRS}")
-
 elseif(APPLE)
 
-	if (${CMAKE_OSX_DEPLOYMENT_TARGET} STREQUAL "10.5")
-		set(WITH_LIBS10.5 ON CACHE BOOL "Use 10.5 libs" FORCE)
+	if(${CMAKE_OSX_DEPLOYMENT_TARGET} STREQUAL "10.5" OR ${CMAKE_OSX_DEPLOYMENT_TARGET} STRGREATER "10.5")
+		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()
@@ -1489,14 +1600,6 @@ if(MSVC10)
 	endif()
 endif()
 
-if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-	if(WITH_IK_ITASC)
-		message(WARNING "Using Clang as CXX compiler: disabling WITH_IK_ITASC and WITH_MOD_FLUID, these features will be missing.")
-		set(WITH_IK_ITASC OFF)
-	endif()
-endif()
-
-
 # ensure python header is found since detection can fail, this could happen
 # with _any_ library but since we used a fixed python version this tends to
 # be most problematic.
@@ -1599,6 +1702,7 @@ if(FIRST_RUN)
 	info_cfg_option(WITH_X11_XF86VMODE)
 	info_cfg_option(WITH_X11_XINPUT)
 	info_cfg_option(WITH_BUILTIN_GLEW)
+	info_cfg_option(WITH_MEM_JEMALLOC)
 
 	info_cfg_text("Image Formats:")
 	info_cfg_option(WITH_IMAGE_CINEON)
diff --git a/GNUmakefile b/GNUmakefile
index 367819e..b448f93 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -166,10 +166,11 @@ help:
 	@echo "  * test_deprecated - checks for deprecation tags in our code which may need to be removed"
 	@echo ""
 	@echo "Static Source Code Checking (not assosiated with building blender)"
-	@echo "  * check_cppcheck  - run blender source through cppcheck (C & C++)"
-	@echo "  * check_splint    - run blenders source through splint (C only)"
-	@echo "  * check_sparse    - run blenders source through sparse (C only)"
-	@echo "  * check_spelling  - check for spelling errors (Python only for now)"
+	@echo "  * check_cppcheck    - run blender source through cppcheck (C & C++)"
+	@echo "  * check_splint      - run blenders source through splint (C only)"
+	@echo "  * check_sparse      - run blenders source through sparse (C only)"
+	@echo "  * check_spelling_c  - check for spelling errors (C/C++ only)"
+	@echo "  * check_spelling_py - check for spelling errors (Python only)"
 	@echo ""
 	@echo "Documentation Targets (not assosiated with building blender)"
 	@echo "  * doc_py   - generate sphinx python api docs"
@@ -243,8 +244,11 @@ check_sparse:
 	$(CMAKE_CONFIG)
 	cd $(BUILD_DIR) ; python3 $(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py
 
-check_spelling:
-	cd $(BUILD_DIR) ; PYTHONIOENCODING=utf_8 python3 $(BLENDER_DIR)/source/tools/spell_check_source.py `find $(BLENDER_DIR)/release/scripts -name "*.py" | sort`
+check_spelling_py:
+	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 $(BLENDER_DIR)/source/tools/spell_check_source.py $(BLENDER_DIR)/source
 
 
 # -----------------------------------------------------------------------------
@@ -258,7 +262,7 @@ doc_py:
 	@echo "docs written into: '$(BLENDER_DIR)/doc/python_api/sphinx-out/contents.html'"
 
 doc_doxy:
-	cd doc/doxygen; doxygen 
+	cd doc/doxygen; doxygen Doxyfile
 	@echo "docs written into: '$(BLENDER_DIR)/doc/doxygen/html/index.html'"
 
 doc_dna:
diff --git a/SConstruct b/SConstruct
index 0dd59ad..b1603fd 100644
--- a/SConstruct
+++ b/SConstruct
@@ -170,7 +170,7 @@ if sys.platform=='win32':
     if env['CC'] in ['cl', 'cl.exe']:
         platform = 'win64-vc' if bitness == 64 else 'win32-vc'
     elif env['CC'] in ['gcc']:
-        platform = 'win32-mingw'
+        platform = 'win64-mingw' if bitness == 64 else 'win32-mingw'
 
 env.SConscriptChdir(0)
 
@@ -251,6 +251,7 @@ if 'blenderlite' in B.targets:
     target_env_defs['WITH_BF_REDCODE'] = False
     target_env_defs['WITH_BF_DDS'] = False
     target_env_defs['WITH_BF_CINEON'] = False
+    target_env_defs['WITH_BF_FRAMESERVER'] = False
     target_env_defs['WITH_BF_HDR'] = False
     target_env_defs['WITH_BF_ZLIB'] = False
     target_env_defs['WITH_BF_SDL'] = False
@@ -261,11 +262,13 @@ if 'blenderlite' in B.targets:
     target_env_defs['BF_BUILDINFO'] = False
     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
     target_env_defs['WITH_BF_3DMOUSE'] = False
+    target_env_defs['WITH_BF_LIBMV'] = False
     
     # Merge blenderlite, let command line to override
     for k,v in target_env_defs.iteritems():
@@ -274,7 +277,7 @@ if 'blenderlite' in B.targets:
 
 # Extended OSX_SDK and 3D_CONNEXION_CLIENT_LIBRARY and JAckOSX detection for OSX
 if env['OURPLATFORM']=='darwin':
-    print B.bc.OKGREEN + "Detected Xcode version: -- " + B.bc.ENDC + env['XCODE_CUR_VER'][:9] + " --"
+    print B.bc.OKGREEN + "Detected Xcode version: -- " + B.bc.ENDC + env['XCODE_CUR_VER'] + " --"
     print "Available " + env['MACOSX_SDK_CHECK']
     if not 'Mac OS X 10.5' in env['MACOSX_SDK_CHECK']:
         print  B.bc.OKGREEN + "MacOSX10.5.sdk not available:" + B.bc.ENDC + " using MacOSX10.6.sdk"
@@ -756,6 +759,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
 
     if env['WITH_BF_OPENAL']:
         dllsources.append('${LCGDIR}/openal/lib/OpenAL32.dll')
+        dllsources.append('${LCGDIR}/openal/lib/wrap_oal.dll')
 
     if env['WITH_BF_SNDFILE']:
         dllsources.append('${LCGDIR}/sndfile/lib/libsndfile-1.dll')
@@ -770,7 +774,7 @@ 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']:
+    if env['WITH_BF_OIIO'] and env['OURPLATFORM'] != 'win32-mingw':
         dllsources.append('${LCGDIR}/openimageio/bin/OpenImageIO.dll')
 
     dllsources.append('#source/icons/blender.exe.manifest')
@@ -778,6 +782,34 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
     windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
     allinstall += windlls
 
+if env['OURPLATFORM'] == 'win64-mingw':
+    dllsources = []
+    
+    if env['WITH_BF_PYTHON']:
+        if env['BF_DEBUG']:
+            dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}_d.dll')
+        else:
+            dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_DLL}.dll')
+
+    if env['WITH_BF_FFMPEG']:
+        dllsources += env['BF_FFMPEG_DLL'].split()
+
+    if env['WITH_BF_OPENAL']:
+        dllsources.append('${LCGDIR}/openal/lib/OpenAL32.dll')
+        dllsources.append('${LCGDIR}/openal/lib/wrap_oal.dll')
+
+    if env['WITH_BF_SNDFILE']:
+        dllsources.append('${LCGDIR}/sndfile/lib/libsndfile-1.dll')
+
+    if env['WITH_BF_SDL']:
+        dllsources.append('${LCGDIR}/sdl/lib/SDL.dll')
+	
+    dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb64.dll')
+    dllsources.append('#source/icons/blender.exe.manifest')
+
+    windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
+    allinstall += windlls
+
 installtarget = env.Alias('install', allinstall)
 bininstalltarget = env.Alias('install-bin', blenderinstall)
 
diff --git a/build_files/buildbot/slave_compile.py b/build_files/buildbot/slave_compile.py
index 6a695d3..2092532 100644
--- a/build_files/buildbot/slave_compile.py
+++ b/build_files/buildbot/slave_compile.py
@@ -55,7 +55,7 @@ else:
     # scons
     os.chdir(blender_dir)
     scons_cmd = ['python', 'scons/scons.py']
-    scons_options = []
+    scons_options = ['BF_FANCY=False']
 
     if builder.find('linux') != -1:
         import shutil
@@ -65,7 +65,7 @@ else:
         build_dir = os.path.join('..', 'build', builder)
         install_dir = os.path.join('..', 'install', builder)
 
-        common_options = ['BF_INSTALLDIR=' + install_dir]
+        common_options = ['BF_INSTALLDIR=' + install_dir] + scons_options
 
         # Clean install directory so we'll be sure there's no
         if os.path.isdir(install_dir):
diff --git a/build_files/buildbot/slave_pack.py b/build_files/buildbot/slave_pack.py
index 91444fe..cb02e61 100644
--- a/build_files/buildbot/slave_pack.py
+++ b/build_files/buildbot/slave_pack.py
@@ -41,7 +41,7 @@ if len(sys.argv) >= 3:
 # scons does own packaging
 if builder.find('scons') != -1:
     os.chdir('../blender')
-    scons_options = ['BF_QUICK=slnt', 'BUILDBOT_BRANCH=' + branch, 'buildslave']
+    scons_options = ['BF_QUICK=slnt', 'BUILDBOT_BRANCH=' + branch, 'buildslave', 'BF_FANCY=False']
 
     if builder.find('linux') != -1:
         buildbot_dir = os.path.dirname(os.path.realpath(__file__))
diff --git a/build_files/cmake/Modules/FindGLEW.cmake b/build_files/cmake/Modules/FindGLEW.cmake
index 7e1b00d..3f7cca3 100644
--- a/build_files/cmake/Modules/FindGLEW.cmake
+++ b/build_files/cmake/Modules/FindGLEW.cmake
@@ -18,7 +18,7 @@ IF (WIN32)
 			PATHS
 			$ENV{PROGRAMFILES}/GLEW/lib
 			${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin
-	    	${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib
+			${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib
 			DOC "The GLEW library (64-bit)"
 		)
 	ELSE(NV_SYSTEM_PROCESSOR STREQUAL "AMD64")
@@ -27,7 +27,7 @@ IF (WIN32)
 			PATHS
 			$ENV{PROGRAMFILES}/GLEW/lib
 			${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin
-	    	${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib
+			${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib
 			DOC "The GLEW library"
 		)
 	ENDIF(NV_SYSTEM_PROCESSOR STREQUAL "AMD64")
diff --git a/build_files/cmake/Modules/FindOpenEXR.cmake b/build_files/cmake/Modules/FindOpenEXR.cmake
index 546f690..9f1d657 100644
--- a/build_files/cmake/Modules/FindOpenEXR.cmake
+++ b/build_files/cmake/Modules/FindOpenEXR.cmake
@@ -8,7 +8,7 @@
 #                    This can also be an environment variable.
 #  OPENEXR_FOUND, If false, do not try to use OpenEXR.
 #
-# For indervidual library access these advanced settings are available
+# For individual library access these advanced settings are available
 #  OPENEXR_HALF_LIBRARY, Path to Half library
 #  OPENEXR_IEX_LIBRARY, Path to Half library
 #  OPENEXR_ILMIMF_LIBRARY, Path to Ilmimf library
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 406f253..eeefcf7 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -212,11 +212,9 @@ macro(setup_liblinks
 	target_link_libraries(${target}
 			${OPENGL_gl_LIBRARY}
 			${OPENGL_glu_LIBRARY}
-			${JPEG_LIBRARIES}
 			${PNG_LIBRARIES}
 			${ZLIB_LIBRARIES}
-			${FREETYPE_LIBRARY}
-			${PLATFORM_LINKLIBS})
+			${FREETYPE_LIBRARY})
 
 	# since we are using the local libs for python when compiling msvc projects, we need to add _d when compiling debug versions
 	if(WITH_PYTHON)  # AND NOT WITH_PYTHON_MODULE  # WIN32 needs
@@ -271,6 +269,7 @@ macro(setup_liblinks
 	if(WITH_BOOST)
 		target_link_libraries(${target} ${BOOST_LIBRARIES})
 	endif()
+	target_link_libraries(${target} ${JPEG_LIBRARIES})
 	if(WITH_IMAGE_OPENEXR)
 		if(WIN32 AND NOT UNIX AND NOT CMAKE_COMPILER_IS_GNUCC)
 			file_list_suffix(OPENEXR_LIBRARIES_DEBUG "${OPENEXR_LIBRARIES}" "_d")
@@ -328,6 +327,8 @@ macro(setup_liblinks
 	if(WIN32 AND NOT UNIX)
 		target_link_libraries(${target} ${PTHREADS_LIBRARIES})
 	endif()
+
+	target_link_libraries(${target} ${PLATFORM_LINKLIBS})
 endmacro()
 
 macro(TEST_SSE_SUPPORT
@@ -677,4 +678,4 @@ macro(set_lib_path
 	endif()
 
 
-endmacro()
\ No newline at end of file
+endmacro()
diff --git a/build_files/cmake/project_info.py b/build_files/cmake/project_info.py
index 77574f1..3f64ac5 100755
--- a/build_files/cmake/project_info.py
+++ b/build_files/cmake/project_info.py
@@ -231,8 +231,13 @@ def project_name_get(path, fallback="Blender", prefix="Blender_"):
         return fallback
 
     import subprocess
-    info = subprocess.Popen(["svn", "info", path],
-                            stdout=subprocess.PIPE).communicate()[0]
+    try:
+        info = subprocess.Popen(["svn", "info", path],
+                                stdout=subprocess.PIPE).communicate()[0]
+    except:
+        # possibly 'svn' isnt found/installed
+        return fallback
+
     # string version, we only want the URL
     info = info.decode(encoding="utf-8", errors="ignore")
 
diff --git a/build_files/scons/config/darwin-config.py b/build_files/scons/config/darwin-config.py
index 8082c1e..e5bce90 100644
--- a/build_files/scons/config/darwin-config.py
+++ b/build_files/scons/config/darwin-config.py
@@ -34,7 +34,7 @@ elif cmd_res[:2]=='11':
     MAC_CUR_VER='10.7'
 cmd = 'xcodebuild -version'
 cmd_xcode=commands.getoutput(cmd)
-XCODE_CUR_VER=cmd_xcode
+XCODE_CUR_VER=cmd_xcode[6:][:3] # truncate output to major.minor version
 cmd = 'xcodebuild -showsdks'
 cmd_sdk=commands.getoutput(cmd)
 MACOSX_SDK_CHECK=cmd_sdk
@@ -86,20 +86,23 @@ else :
 
 LIBDIR = '${LCGDIR}'
 
+if XCODE_CUR_VER >= '4.3':  ## since version 4.3, XCode and developer dir are bundled ##
+	MACOSX_SDK = '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform' + MACOSX_SDK
+
 #############################################################################
 ###################          Dependency settings           ##################
 #############################################################################
 
 #Defaults openMP to true if compiler handles it ( only gcc 4.6.1 and newer )
 # if your compiler does not have accurate suffix you may have to enable it by hand !
-if CC.endswith('4.6.1'):
+if CC[:-2].endswith('4.6'):
     WITH_BF_OPENMP = True  # multithreading for fluids, cloth, sculpt and smoke
 else:
     WITH_BF_OPENMP = False
 
 # enable ffmpeg  support
-WITH_BF_FFMPEG = True  # -DWITH_FFMPEG
-BF_FFMPEG = LIBDIR + '/ffmpeg_0.10'
+WITH_BF_FFMPEG = True
+BF_FFMPEG = LIBDIR + '/ffmpeg'
 BF_FFMPEG_INC = "${BF_FFMPEG}/include"
 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'
@@ -230,24 +233,6 @@ BF_FFTW3_INC = '${BF_FFTW3}/include'
 BF_FFTW3_LIB = 'libfftw3'
 BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
 
-#WITH_BF_NSPR = True
-#BF_NSPR = $(LIBDIR)/nspr
-#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
-#BF_NSPR_LIB =
-
-# Uncomment the following line to use Mozilla inplace of netscape
-#CPPFLAGS += -DMOZ_NOT_NET
-# Location of MOZILLA/Netscape header files...
-#BF_MOZILLA = $(LIBDIR)/mozilla
-#BF_MOZILLA_INC = -I$(BF_MOZILLA)/include/mozilla/nspr -I$(BF_MOZILLA)/include/mozilla -I$(BF_MOZILLA)/include/mozilla/xpcom -I$(BF_MOZILLA)/include/mozilla/idl
-#BF_MOZILLA_LIB =
-# Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB
-# if this is not set.
-#
-# Be paranoid regarding library creation (do not update archives)
-#BF_PARANOID = True
-
-# enable freetype2 support for text objects
 BF_FREETYPE = LIBDIR + '/freetype'
 BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
 BF_FREETYPE_LIB = 'freetype'
diff --git a/build_files/scons/config/freebsd7-config.py b/build_files/scons/config/freebsd7-config.py
index 7826ca2..412b08d 100644
--- a/build_files/scons/config/freebsd7-config.py
+++ b/build_files/scons/config/freebsd7-config.py
@@ -91,13 +91,12 @@ BF_BULLET = '#extern/bullet2/src'
 BF_BULLET_INC = '${BF_BULLET}'
 BF_BULLET_LIB = 'extern_bullet'
 
-# enable freetype2 support for text objects
 BF_FREETYPE = '/usr/local'
 BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
 BF_FREETYPE_LIB = 'freetype'
 
 ### XXX Find what this actually wants; it doesn't want libquicktime.
-WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME
+WITH_BF_QUICKTIME = False
 BF_QUICKTIME = '/usr/local'
 BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
 
@@ -110,7 +109,7 @@ BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
 WITH_BF_BINRELOC = True
 
 # enable ffmpeg  support
-WITH_BF_FFMPEG = True  # -DWITH_FFMPEG
+WITH_BF_FFMPEG = True
 BF_FFMPEG = '/usr/local'
 BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice'
 BF_FFMPEG_INC = '${BF_FFMPEG}/include'
@@ -164,6 +163,8 @@ BF_EXPAT = '/usr/local'
 BF_EXPAT_LIB = 'expat'
 BF_EXPAT_LIBPATH = '${BF_EXPAT}/lib'
 
+WITH_GHOST_XDND = False
+
 WITH_BF_OPENMP = True
 
 #Ray trace optimization
diff --git a/build_files/scons/config/freebsd8-config.py b/build_files/scons/config/freebsd8-config.py
index f2d5cf2..ece86f7 100644
--- a/build_files/scons/config/freebsd8-config.py
+++ b/build_files/scons/config/freebsd8-config.py
@@ -91,13 +91,12 @@ BF_BULLET = '#extern/bullet2/src'
 BF_BULLET_INC = '${BF_BULLET}'
 BF_BULLET_LIB = 'extern_bullet'
 
-# enable freetype2 support for text objects
 BF_FREETYPE = '/usr/local'
 BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
 BF_FREETYPE_LIB = 'freetype'
 
 ### XXX Find what this actually wants; it doesn't want libquicktime.
-WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME
+WITH_BF_QUICKTIME = False
 BF_QUICKTIME = '/usr/local'
 BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
 
@@ -110,7 +109,7 @@ BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
 WITH_BF_BINRELOC = True
 
 # enable ffmpeg  support
-WITH_BF_FFMPEG = True  # -DWITH_FFMPEG
+WITH_BF_FFMPEG = True
 BF_FFMPEG = '/usr/local'
 BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice'
 BF_FFMPEG_INC = '${BF_FFMPEG}/include'
@@ -166,6 +165,8 @@ BF_EXPAT_LIBPATH = '${BF_EXPAT}/lib'
 
 WITH_BF_OPENMP = True
 
+WITH_GHOST_XDND = False
+
 #Ray trace optimization
 WITH_BF_RAYOPTIMIZATION = True
 BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse','-pthread']
diff --git a/build_files/scons/config/freebsd9-config.py b/build_files/scons/config/freebsd9-config.py
index ea321b1..a31c6da 100644
--- a/build_files/scons/config/freebsd9-config.py
+++ b/build_files/scons/config/freebsd9-config.py
@@ -91,13 +91,12 @@ BF_BULLET = '#extern/bullet2/src'
 BF_BULLET_INC = '${BF_BULLET}'
 BF_BULLET_LIB = 'extern_bullet'
 
-# enable freetype2 support for text objects
 BF_FREETYPE = '/usr/local'
 BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
 BF_FREETYPE_LIB = 'freetype'
 
 ### XXX Find what this actually wants; it doesn't want libquicktime.
-WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME
+WITH_BF_QUICKTIME = False
 BF_QUICKTIME = '/usr/local'
 BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
 
@@ -110,7 +109,7 @@ BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
 WITH_BF_BINRELOC = True
 
 # enable ffmpeg  support
-WITH_BF_FFMPEG = True  # -DWITH_FFMPEG
+WITH_BF_FFMPEG = True
 BF_FFMPEG = '/usr/local'
 BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice'
 BF_FFMPEG_INC = '${BF_FFMPEG}/include'
@@ -166,6 +165,8 @@ BF_EXPAT_LIBPATH = '${BF_EXPAT}/lib'
 
 WITH_BF_OPENMP = True
 
+WITH_GHOST_XDND = False
+
 #Ray trace optimization
 WITH_BF_RAYOPTIMIZATION = True
 BF_RAYOPTIMIZATION_SSE_FLAGS = ['-msse','-pthread']
diff --git a/build_files/scons/config/linux-config.py b/build_files/scons/config/linux-config.py
index 63022bb..cd97ffe 100644
--- a/build_files/scons/config/linux-config.py
+++ b/build_files/scons/config/linux-config.py
@@ -105,13 +105,12 @@ BF_BULLET = '#extern/bullet2/src'
 BF_BULLET_INC = '${BF_BULLET}'
 BF_BULLET_LIB = 'extern_bullet'
 
-# enable freetype2 support for text objects
 BF_FREETYPE = '/usr'
 BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
 BF_FREETYPE_LIB = 'freetype'
 #BF_FREETYPE_LIB_STATIC = '${BF_FREETYPE}/lib/libfreetype.a'
 
-WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME
+WITH_BF_QUICKTIME = False
 BF_QUICKTIME = '/usr/local'
 BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
 
@@ -124,7 +123,7 @@ BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
 WITH_BF_BINRELOC = True
 
 # enable ffmpeg  support
-WITH_BF_FFMPEG = True  # -DWITH_FFMPEG
+WITH_BF_FFMPEG = True
 BF_FFMPEG = LIBDIR + '/ffmpeg'
 if os.path.exists(LCGDIR + '/ffmpeg'):
     WITH_BF_STATICFFMPEG = True
diff --git a/build_files/scons/config/linuxcross-config.py b/build_files/scons/config/linuxcross-config.py
index 7ec27af..6866241 100644
--- a/build_files/scons/config/linuxcross-config.py
+++ b/build_files/scons/config/linuxcross-config.py
@@ -13,7 +13,7 @@ WITH_BF_OPENAL = True
 WITH_BF_STATICOPENAL = False
 BF_OPENAL = LIBDIR + '/openal'
 BF_OPENAL_INC = '${BF_OPENAL}/include'
-BF_OPENAL_LIB = 'OpenAL32'
+BF_OPENAL_LIB = 'OpenAL32 wrap_oal'
 BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
 # Warning, this static lib configuration is untested! users of this OS please confirm.
 BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
@@ -100,14 +100,13 @@ BF_BULLET_LIB = 'extern_bullet'
 BF_WINTAB = LIBDIR + '/wintab'
 BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
 
-# enable freetype2 support for text objects
 BF_WITH_FREETYPE = True
 BF_FREETYPE = LIBDIR + '/gcc/freetype'
 BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
 BF_FREETYPE_LIB = 'freetype'
 BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
 
-WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME
+WITH_BF_QUICKTIME = False
 BF_QUICKTIME = '/usr/local'
 BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
 
@@ -120,7 +119,7 @@ BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
 WITH_BF_BINRELOC = False
 
 # enable ffmpeg  support
-WITH_BF_FFMPEG = True  # -DWITH_FFMPEG
+WITH_BF_FFMPEG = True
 BF_FFMPEG = LIBDIR + '/ffmpeg'
 BF_FFMPEG_LIB = 'avformat-53 avcodec-53 avdevice-53 avutil-51 swscale-2'
 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'
diff --git a/build_files/scons/config/win32-mingw-config.py b/build_files/scons/config/win32-mingw-config.py
index 9fac0a3..5764155 100644
--- a/build_files/scons/config/win32-mingw-config.py
+++ b/build_files/scons/config/win32-mingw-config.py
@@ -1,4 +1,4 @@
-LCGDIR = '#../lib/windows'
+LCGDIR = '#../lib/mingw32'
 LIBDIR = "${LCGDIR}"
 
 BF_PYTHON = LIBDIR + '/python'
@@ -14,7 +14,7 @@ BF_PYTHON_LIB_STATIC = '${BF_PYTHON}/lib/libpython${BF_PYTHON_VERSION[0]}${BF_PY
 WITH_BF_OPENAL = True
 BF_OPENAL = LIBDIR + '/openal'
 BF_OPENAL_INC = '${BF_OPENAL}/include'
-BF_OPENAL_LIB = 'OpenAL32'
+BF_OPENAL_LIB = 'wrap_oal'
 BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
 
 WITH_BF_FFMPEG = True
@@ -48,7 +48,7 @@ BF_PTHREADS_LIBPATH = '${BF_PTHREADS}/lib'
 
 WITH_BF_OPENEXR = True
 WITH_BF_STATICOPENEXR = False
-BF_OPENEXR = LIBDIR + '/gcc/openexr'
+BF_OPENEXR = LIBDIR + '/openexr'
 BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR'
 BF_OPENEXR_LIB = 'Half IlmImf Imath IlmThread Iex'
 BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
@@ -64,13 +64,13 @@ BF_JPEG_LIB = 'liblibjpeg'
 BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
 
 WITH_BF_PNG = True
-BF_PNG = LIBDIR + '/gcc/png'
+BF_PNG = LIBDIR + '/png'
 BF_PNG_INC = '${BF_PNG}/include'
 BF_PNG_LIB = 'png'
 BF_PNG_LIBPATH = '${BF_PNG}/lib'
 
 WITH_BF_TIFF = True
-BF_TIFF = LIBDIR + '/gcc/tiff'
+BF_TIFF = LIBDIR + '/tiff'
 BF_TIFF_INC = '${BF_TIFF}/include'
 BF_TIFF_LIB = 'tiff'
 BF_TIFF_LIBPATH = '${BF_TIFF}/lib'
@@ -83,7 +83,7 @@ BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
 
 WITH_BF_INTERNATIONAL = True
 
-BF_GETTEXT = LIBDIR + '/gcc/gettext'
+BF_GETTEXT = LIBDIR + '/gettext'
 BF_GETTEXT_INC = '${BF_GETTEXT}/include'
 BF_GETTEXT_LIB = 'intl'
 BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
@@ -95,7 +95,7 @@ BF_OPENJPEG_INC = '${BF_OPENJPEG}'
 BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
 
 WITH_BF_FFTW3 = True
-BF_FFTW3 = LIBDIR + '/gcc/fftw3'
+BF_FFTW3 = LIBDIR + '/fftw3'
 BF_FFTW3_INC = '${BF_FFTW3}/include'
 BF_FFTW3_LIB = 'fftw3'
 BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
@@ -112,13 +112,12 @@ BF_BULLET_LIB = 'extern_bullet'
 BF_WINTAB = LIBDIR + '/wintab'
 BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
 
-# enable freetype2 support for text objects
-BF_FREETYPE = LIBDIR + '/gcc/freetype'
+BF_FREETYPE = LIBDIR + '/freetype'
 BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
 BF_FREETYPE_LIB = 'freetype'
 BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
 
-WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME
+WITH_BF_QUICKTIME = False
 BF_QUICKTIME = '/usr/local'
 BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
 
@@ -146,7 +145,7 @@ BF_COLLADA = '#source/blender/collada'
 BF_COLLADA_INC = '${BF_COLLADA}'
 BF_COLLADA_LIB = 'bf_collada'
 
-BF_OPENCOLLADA = LIBDIR + '/gcc/opencollada'
+BF_OPENCOLLADA = LIBDIR + '/opencollada'
 BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
 BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver expat pcre buffer ftoa'
 BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib'
@@ -155,7 +154,7 @@ BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib'
 WITH_BF_CYCLES = True 
 
 WITH_BF_OIIO = True
-BF_OIIO = LIBDIR + '/gcc/openimageio'
+BF_OIIO = LIBDIR + '/openimageio'
 BF_OIIO_INC = BF_OIIO + '/include'
 BF_OIIO_LIB = 'OpenImageIO'
 BF_OIIO_LIBPATH = BF_OIIO + '/lib'
@@ -163,8 +162,8 @@ BF_OIIO_LIBPATH = BF_OIIO + '/lib'
 WITH_BF_BOOST = True
 BF_BOOST = LIBDIR + '/boost'
 BF_BOOST_INC = BF_BOOST + '/include'
-BF_BOOST_LIB = 'boost_date_time-mgw45-mt-s-1_47 boost_filesystem-mgw45-mt-s-1_47 boost_regex-mgw45-mt-s-1_47 boost_system-mgw45-mt-s-1_47 boost_thread-mgw45-mt-s-1_47'
-BF_BOOST_LIBPATH = BF_BOOST + '/lib/gcc'
+BF_BOOST_LIB = 'boost_date_time-mgw46-mt-s-1_47 boost_filesystem-mgw46-mt-s-1_47 boost_regex-mgw46-mt-s-1_47 boost_system-mgw46-mt-s-1_47 boost_thread-mgw46-mt-s-1_47'
+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 2142620..5ed845c 100644
--- a/build_files/scons/config/win32-vc-config.py
+++ b/build_files/scons/config/win32-vc-config.py
@@ -1,8 +1,7 @@
 LCGDIR = '#../lib/windows'
 LIBDIR = '${LCGDIR}'
 
-# enable ffmpeg  support
-WITH_BF_FFMPEG = True  # -DWITH_FFMPEG
+WITH_BF_FFMPEG = True
 BF_FFMPEG = LIBDIR +'/ffmpeg'
 BF_FFMPEG_INC = '${BF_FFMPEG}/include ${BF_FFMPEG}/include/msvc'
 BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
@@ -20,7 +19,7 @@ BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
 WITH_BF_OPENAL = True
 BF_OPENAL = LIBDIR + '/openal'
 BF_OPENAL_INC = '${BF_OPENAL}/include '
-BF_OPENAL_LIB = 'OpenAL32'
+BF_OPENAL_LIB = 'wrap_oal'
 BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
 
 WITH_BF_ICONV = True
@@ -58,7 +57,6 @@ BF_OPENEXR = LIBDIR + '/openexr'
 BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/IlmImf ${BF_OPENEXR}/include/Iex ${BF_OPENEXR}/include/Imath '
 BF_OPENEXR_LIB = ' Iex Half IlmImf Imath IlmThread '
 BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
-# Warning, this static lib configuration is untested! users of this OS please confirm.
 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'
 
 WITH_BF_DDS = True
@@ -108,14 +106,13 @@ BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
 
 WITH_BF_BINRELOC = False
 
-# enable freetype2 support for text objects
 BF_WITH_FREETYPE = True
 BF_FREETYPE = LIBDIR + '/freetype'
 BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
 BF_FREETYPE_LIB = 'freetype2ST'
 BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
 
-WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME
+WITH_BF_QUICKTIME = False
 BF_QUICKTIME = LIBDIR + '/QTDevWin'
 BF_QUICKTIME_INC = '${BF_QUICKTIME}/CIncludes'
 BF_QUICKTIME_LIB = 'qtmlClient'
@@ -166,7 +163,7 @@ BF_BOOST_LIB = 'libboost_date_time-vc90-mt-s-1_47 libboost_filesystem-vc90-mt-s-
 BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
 
 #CUDA
-WITH_BF_CYCLES_CUDA_BINARIES = False
+WITH_BF_CYCLES_CUDA_BINARIES = True
 #BF_CYCLES_CUDA_NVCC = "" # Path to the nvidia compiler
 BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21']
 
diff --git a/build_files/scons/config/win64-mingw-config.py b/build_files/scons/config/win64-mingw-config.py
new file mode 100644
index 0000000..055b0c7
--- /dev/null
+++ b/build_files/scons/config/win64-mingw-config.py
@@ -0,0 +1,207 @@
+LCGDIR = '#../lib/mingw64'
+LIBDIR = "${LCGDIR}"
+
+BF_PYTHON = LIBDIR + '/python'
+BF_PYTHON_VERSION = '3.2'
+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_LIBPATH = '${BF_PYTHON}/lib'
+
+WITH_BF_OPENAL = True
+BF_OPENAL = LIBDIR + '/openal'
+BF_OPENAL_INC = '${BF_OPENAL}/include'
+BF_OPENAL_LIB = 'wrap_oal'
+BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
+
+WITH_BF_FFMPEG = False # TODO: FFmpeg gives linking errors, need to compile with MinGW-w64?
+BF_FFMPEG_LIB = 'avformat-53 avcodec-53 avdevice-53 avutil-51 swscale-2'
+BF_FFMPEG_LIBPATH = LIBDIR + '/ffmpeg/lib'
+BF_FFMPEG_INC =  LIBDIR + '/ffmpeg/include'
+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'
+
+WITH_BF_JACK = False
+BF_JACK = LIBDIR + '/jack'
+BF_JACK_INC = '${BF_JACK}/include'
+BF_JACK_LIB = 'libjack'
+BF_JACK_LIBPATH = '${BF_JACK}/lib'
+
+WITH_BF_SNDFILE = False
+BF_SNDFILE = LIBDIR + '/sndfile'
+BF_SNDFILE_INC = '${BF_SNDFILE}/include'
+BF_SNDFILE_LIB = 'libsndfile-1'
+BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib'
+
+WITH_BF_SDL = True
+BF_SDL = LIBDIR + '/sdl'
+BF_SDL_INC = '${BF_SDL}/include'
+BF_SDL_LIB = 'SDL'
+BF_SDL_LIBPATH = '${BF_SDL}/lib'
+
+BF_PTHREADS = '' # Part of MinGW-w64
+BF_PTHREADS_INC = ''
+BF_PTHREADS_LIB = ''
+BF_PTHREADS_LIBPATH = ''
+
+WITH_BF_OPENEXR = True
+WITH_BF_STATICOPENEXR = False
+BF_OPENEXR = LIBDIR + '/openexr'
+BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR'
+BF_OPENEXR_LIB = 'Half IlmImf Imath IlmThread Iex'
+BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
+
+WITH_BF_DDS = True
+
+WITH_BF_JPEG = True
+BF_JPEG = LIBDIR + '/jpeg'
+BF_JPEG_INC = '${BF_JPEG}/include'
+BF_JPEG_LIB = 'jpeg'
+BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
+
+WITH_BF_PNG = True
+BF_PNG = LIBDIR + '/png'
+BF_PNG_INC = '${BF_PNG}/include'
+BF_PNG_LIB = 'png'
+BF_PNG_LIBPATH = '${BF_PNG}/lib'
+
+WITH_BF_TIFF = True
+BF_TIFF = LIBDIR + '/tiff'
+BF_TIFF_INC = '${BF_TIFF}/include'
+BF_TIFF_LIB = 'tiff'
+BF_TIFF_LIBPATH = '${BF_TIFF}/lib'
+
+WITH_BF_ZLIB = True
+BF_ZLIB = LIBDIR + '/zlib'
+BF_ZLIB_INC = '${BF_ZLIB}/include'
+BF_ZLIB_LIB = 'z'
+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 = ''
+BF_OPENJPEG_INC = '${BF_OPENJPEG}'
+BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
+
+WITH_BF_FFTW3 = True
+BF_FFTW3 = LIBDIR + '/fftw3'
+BF_FFTW3_INC = '${BF_FFTW3}/include'
+BF_FFTW3_LIB = 'fftw3'
+BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
+
+WITH_BF_GAMEENGINE = True
+WITH_BF_OCEANSIM = True
+WITH_BF_PLAYER = True
+WITH_BF_LIBMV = True
+
+WITH_BF_BULLET = True
+BF_BULLET = '#extern/bullet2/src'
+BF_BULLET_INC = '${BF_BULLET}'
+BF_BULLET_LIB = 'extern_bullet'
+
+BF_WINTAB = LIBDIR + '/wintab'
+BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
+
+# enable freetype2 support for text objects
+BF_FREETYPE = LIBDIR + '/freetype'
+BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2/'
+BF_FREETYPE_LIB = 'freetype'
+BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
+
+WITH_BF_QUICKTIME = False
+
+WITH_BF_ICONV = True
+BF_ICONV = LIBDIR + "/iconv"
+BF_ICONV_INC = '${BF_ICONV}/include'
+BF_ICONV_LIB = 'iconv'
+BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
+
+WITH_BF_REDCODE = False
+BF_REDCODE_INC = '#extern'
+
+# Mesa Libs should go here if your using them as well....
+WITH_BF_STATICOPENGL = False
+BF_OPENGL = 'C:\\MingW'
+BF_OPENGL_INC = '${BF_OPENGL}/include'
+BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'
+BF_OPENGL_LIB = 'opengl32 glu32'
+BF_OPENGL_LIB_STATIC = [ '${BF_OPENGL}/lib/libGL.a', '${BF_OPENGL}/lib/libGLU.a',
+             '${BF_OPENGL}/lib/libXmu.a', '${BF_OPENGL}/lib/libXext.a',
+             '${BF_OPENGL}/lib/libX11.a', '${BF_OPENGL}/lib/libXi.a' ]
+
+WITH_BF_COLLADA = False # TODO: Compile Collada with MinGW-w64
+BF_COLLADA = '#source/blender/collada'
+BF_COLLADA_INC = '${BF_COLLADA}'
+BF_COLLADA_LIB = 'bf_collada'
+
+BF_OPENCOLLADA = LIBDIR + '/opencollada'
+BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
+BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver expat pcre buffer ftoa'
+BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib'
+
+#Cycles
+WITH_BF_CYCLES = True
+WITH_BF_CYCLES_CUDA_BINARIES = False
+BF_CYCLES_CUDA_NVCC = "" # Path to the NVIDIA CUDA compiler
+BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21']
+
+WITH_BF_OIIO = True
+BF_OIIO = LIBDIR + '/openimageio'
+BF_OIIO_INC = '${BF_OIIO}/include'
+BF_OIIO_LIB = 'OpenImageIO'
+BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
+
+WITH_BF_BOOST = True
+BF_BOOST = LIBDIR + '/boost'
+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'
+
+#Ray trace optimization
+WITH_BF_RAYOPTIMIZATION = True
+BF_RAYOPTIMIZATION_SSE_FLAGS = ['-mmmx', '-msse', '-msse2', '-ftree-vectorize']
+
+WITH_BF_OPENMP = True
+
+##
+CC = 'gcc'
+CXX = 'g++'
+
+CCFLAGS = [ '-pipe', '-funsigned-char', '-fno-strict-aliasing' ]
+CXXFLAGS = [ '-fpermissive' ]
+
+CPPFLAGS = ['-DWIN32', '-DMS_WIN64', '-DFREE_WINDOWS', '-DFREE_WINDOWS64', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_LARGEFILE64_SOURCE', '-DBOOST_ALL_NO_LIB', '-DBOOST_THREAD_USE_LIB', '-DGLEW_STATIC', '-D_SSIZE_T_']
+REL_CFLAGS = []
+REL_CXXFLAGS = []
+REL_CCFLAGS = ['-DNDEBUG', '-O2', '-ftree-vectorize', '-mmmx', '-msse', '-msse2']
+
+C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement', '-Wstrict-prototypes']
+
+CC_WARN = [ '-Wall' ]
+
+LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++','-lole32','-luuid', '-lwsock32', '-lpsapi', '-lpthread']
+
+PLATFORM_LINKFLAGS = ['-Xlinker', '--stack=2097152']
+
+## DISABLED, causes linking errors!
+## for re-distrobution, so users dont need mingw installed
+# PLATFORM_LINKFLAGS += ["-static-libgcc", "-static-libstdc++"]
+
+BF_DEBUG = False
+BF_DEBUG_CCFLAGS= ['-g', '-D_DEBUG']
+
+BF_PROFILE_CCFLAGS = ['-pg', '-g']
+BF_PROFILE_LINKFLAGS = ['-pg']
+BF_PROFILE_FLAGS = BF_PROFILE_CCFLAGS
+BF_PROFILE = False
+
+BF_BUILDDIR = '..\\build\\win64-mingw'
+BF_INSTALLDIR='..\\install\\win64-mingw'
diff --git a/build_files/scons/config/win64-vc-config.py b/build_files/scons/config/win64-vc-config.py
index 794f29c..f8a67d7 100644
--- a/build_files/scons/config/win64-vc-config.py
+++ b/build_files/scons/config/win64-vc-config.py
@@ -1,8 +1,7 @@
 LCGDIR = '#../lib/win64'
 LIBDIR = '${LCGDIR}'
 
-# enable ffmpeg  support
-WITH_BF_FFMPEG = True # -DWITH_FFMPEG
+WITH_BF_FFMPEG = True
 BF_FFMPEG = LIBDIR +'/ffmpeg'
 BF_FFMPEG_INC = '${BF_FFMPEG}/include ${BF_FFMPEG}/include/msvc '
 BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
@@ -20,7 +19,7 @@ BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
 WITH_BF_OPENAL = True
 BF_OPENAL = LIBDIR + '/openal'
 BF_OPENAL_INC = '${BF_OPENAL}/include '
-BF_OPENAL_LIB = 'OpenAL32'
+BF_OPENAL_LIB = 'wrap_oal'
 BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
 
 WITH_BF_SNDFILE = True
@@ -29,11 +28,6 @@ BF_SNDFILE_INC = '${BF_SNDFILE}/include'
 BF_SNDFILE_LIB = 'libsndfile-1'
 BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib'
 
-# TODO - are these useful on win32?
-# BF_CXX = '/usr'
-# WITH_BF_STATICCXX = False
-# BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
-
 WITH_BF_ICONV = True
 BF_ICONV = LIBDIR + '/iconv'
 BF_ICONV_INC = '${BF_ICONV}/include'
@@ -53,16 +47,12 @@ BF_PTHREADS_INC = '${BF_PTHREADS}/include'
 BF_PTHREADS_LIB = 'pthreadVC2'
 BF_PTHREADS_LIBPATH = '${BF_PTHREADS}/lib'
 
-WITH_BF_FMOD = False
-BF_FMOD = LIBDIR + '/fmod'
-
 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_LIB = ' Iex Half IlmImf Imath IlmThread '
 BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
-# Warning, this static lib configuration is untested! users of this OS please confirm.
 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'
 
 WITH_BF_DDS = True
@@ -112,20 +102,19 @@ BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
 
 WITH_BF_BINRELOC = False
 
-# enable freetype2 support for text objects
 BF_WITH_FREETYPE = True
 BF_FREETYPE = LIBDIR + '/freetype'
 BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
 BF_FREETYPE_LIB = 'freetype2ST'
 BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
 
-WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME
+WITH_BF_QUICKTIME = False
 BF_QUICKTIME = LIBDIR + '/QTDevWin'
 BF_QUICKTIME_INC = '${BF_QUICKTIME}/CIncludes'
 BF_QUICKTIME_LIB = 'qtmlClient'
 BF_QUICKTIME_LIBPATH = '${BF_QUICKTIME}/Libraries'
 
-WITH_BF_OPENJPEG = False
+WITH_BF_OPENJPEG = True
 BF_OPENJPEG = '#extern/libopenjpeg'
 BF_OPENJPEG_LIB = ''
 BF_OPENJPEG_INC = '${BF_OPENJPEG}'
@@ -171,7 +160,7 @@ BF_BOOST_LIB = 'libboost_date_time-vc90-mt-s-1_47 libboost_filesystem-vc90-mt-s-
 BF_BOOST_LIBPATH = '${BF_BOOST}/lib'
 
 #CUDA
-WITH_BF_CYCLES_CUDA_BINARIES = False
+WITH_BF_CYCLES_CUDA_BINARIES = True
 #BF_CYCLES_CUDA_NVCC = "" # Path to the nvidia compiler
 BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21']
 
@@ -209,6 +198,6 @@ LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32',
 
 PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:X64','/STACK:2097152','/OPT:NOREF','/INCREMENTAL:NO', '/NODEFAULTLIB:msvcrt.lib', '/NODEFAULTLIB:msvcmrt.lib', '/NODEFAULTLIB:msvcurt.lib', '/NODEFAULTLIB:msvcrtd.lib']
 
-BF_BUILDDIR = '..\\build\\blender25-win64-vc'
-BF_INSTALLDIR='..\\install\\blender25-win64-vc'
+BF_BUILDDIR = '..\\build\\win64-vc'
+BF_INSTALLDIR='..\\install\\win64-vc'
 
diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py
index 5d6298a..5a06647 100644
--- a/build_files/scons/tools/Blender.py
+++ b/build_files/scons/tools/Blender.py
@@ -182,12 +182,12 @@ def setup_staticlibs(lenv):
     if lenv['WITH_BF_SNDFILE'] and lenv['WITH_BF_STATICSNDFILE']:
         statlibs += Split(lenv['BF_SNDFILE_LIB_STATIC'])
 
-    if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+    if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
         libincs += Split(lenv['BF_PTHREADS_LIBPATH'])
 
     if lenv['WITH_BF_COLLADA']:
         libincs += Split(lenv['BF_OPENCOLLADA_LIBPATH'])
-        if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+        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'])
 
@@ -206,7 +206,7 @@ def setup_staticlibs(lenv):
             statlibs += Split(lenv['BF_BOOST_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'):
+    if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross', 'win64-mingw'):
         libincs.append('/usr/lib')
 
     if lenv['WITH_BF_JEMALLOC']:
@@ -228,7 +228,7 @@ def setup_syslibs(lenv):
     if not lenv['WITH_BF_FREETYPE_STATIC']:
         syslibs += Split(lenv['BF_FREETYPE_LIB'])
     if lenv['WITH_BF_PYTHON'] and not lenv['WITH_BF_STATICPYTHON']:
-        if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'):
+        if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'win64-mingw'):
             syslibs.append(lenv['BF_PYTHON_LIB']+'_d')
         else:
             syslibs.append(lenv['BF_PYTHON_LIB'])
@@ -268,7 +268,7 @@ def setup_syslibs(lenv):
         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'):
+    if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw','linuxcross', 'win64-vc', 'win64-mingw'):
         syslibs += Split(lenv['BF_PTHREADS_LIB'])
     if lenv['WITH_BF_COLLADA']:
         syslibs.append(lenv['BF_PCRE_LIB'])
@@ -332,14 +332,18 @@ def creator(env):
         incs.append('#/extern/libmv')
         defs.append('WITH_LIBMV')
 
+    if env['WITH_BF_FFMPEG']:
+        defs.append('WITH_FFMPEG')
+
     if env['WITH_BF_PYTHON']:
         incs.append('#/source/blender/python')
         defs.append('WITH_PYTHON')
         if env['BF_DEBUG']:
             defs.append('_DEBUG')
 
-    if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+    if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
         incs.append(env['BF_PTHREADS_INC'])
+        incs.append('#/intern/utfconv')
 
     env.Append(CPPDEFINES=defs)
     env.Append(CPPPATH=incs)
@@ -508,13 +512,12 @@ def WinPyBundle(target=None, source=None, env=None):
             print str(func) + ' failed on ' + str(path)
     print "Trying to remove existing py bundle."
     shutil.rmtree(py_target, False, printexception)
-    exclude_re=[re.compile('.*/test/.*'),
-                re.compile('^config/.*'),
-                re.compile('^config-*/.*'),
-                re.compile('^distutils/.*'),
-                re.compile('^idlelib/.*'),
-                re.compile('^lib2to3/.*'),
-                re.compile('^tkinter/.*'),
+    exclude_re=[re.compile('.*/test'),
+                re.compile('^test'),
+                re.compile('^distutils'),
+                re.compile('^idlelib'),
+                re.compile('^lib2to3'),
+                re.compile('^tkinter'),
                 re.compile('^_tkinter_d.pyd'),
                 re.compile('^turtledemo'),
                 re.compile('^turtle.py'),
@@ -617,7 +620,7 @@ def AppIt(target=None, source=None, env=None):
     commands.getoutput(cmd)
     cmd = 'find %s/%s.app -name __MACOSX -exec rm -rf {} \;'%(installdir, binary)
     commands.getoutput(cmd)
-    if env['CC'].endswith('4.6.1'): # for correct errorhandling with gcc 4.6.1 we need the gcc.dylib to link, thus distribute in app-bundle
+    if env['CC'][:-2].endswith('4.6'): # for correct errorhandling with gcc 4.6.x we need the gcc.dylib to link, thus distribute in app-bundle
         cmd = 'mkdir %s/%s.app/Contents/MacOS/lib'%(installdir, binary)
         commands.getoutput(cmd)
         instname = env['BF_CXX']
@@ -728,7 +731,7 @@ class BlenderEnvironment(SConsEnvironment):
         if not self or not libname or not source:
             print bc.FAIL+'Cannot continue.  Missing argument for BlenderRes '+libname+bc.ENDC
             self.Exit()
-        if self['OURPLATFORM'] not in ('win32-vc','win32-mingw','linuxcross', 'win64-vc'):
+        if self['OURPLATFORM'] not in ('win32-vc','win32-mingw','linuxcross', 'win64-vc', 'win64-mingw'):
             print bc.FAIL+'BlenderRes is for windows only!'+bc.END
             self.Exit()
         
diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py
index fe481d7..efc80fc 100644
--- a/build_files/scons/tools/btools.py
+++ b/build_files/scons/tools/btools.py
@@ -107,6 +107,7 @@ def validate_arguments(args, bc):
             'WITH_BF_FFMPEG', 'BF_FFMPEG_LIB','BF_FFMPEG_EXTRA', 'BF_FFMPEG',  'BF_FFMPEG_INC', 'BF_FFMPEG_DLL',
             'WITH_BF_STATICFFMPEG', 'BF_FFMPEG_LIB_STATIC',
             'WITH_BF_OGG', 'BF_OGG', 'BF_OGG_LIB',
+            'WITH_BF_FRAMESERVER',
             'WITH_BF_JPEG', 'BF_JPEG', 'BF_JPEG_INC', 'BF_JPEG_LIB', 'BF_JPEG_LIBPATH',
             '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',
@@ -138,6 +139,7 @@ def validate_arguments(args, bc):
             'WITH_BF_OPENMP', 'BF_OPENMP', 'BF_OPENMP_LIBPATH',
             'WITH_GHOST_COCOA',
             'WITH_GHOST_SDL',
+            'WITH_GHOST_XDND',
             'BF_GHOST_DEBUG',
             'USE_QTKIT',
             'BF_FANCY', 'BF_QUIET', 'BF_LINE_OVERWRITE',
@@ -146,7 +148,6 @@ def validate_arguments(args, bc):
             'WITH_BF_DOCS',
             'BF_NUMJOBS',
             'BF_MSVS',
-            'BF_VERSION',
             'WITH_BF_RAYOPTIMIZATION',
             'BF_RAYOPTIMIZATION_SSE_FLAGS',
             'WITH_BF_FLUID',
@@ -154,6 +155,7 @@ def validate_arguments(args, bc):
             'WITH_BF_BOOLEAN',
             'WITH_BF_REMESH',
             'WITH_BF_OCEANSIM',
+            'WITH_BF_SMOKE',
             'WITH_BF_CXX_GUARDEDALLOC',
             'WITH_BF_JEMALLOC', 'WITH_BF_STATICJEMALLOC', 'BF_JEMALLOC', 'BF_JEMALLOC_INC', 'BF_JEMALLOC_LIBPATH', 'BF_JEMALLOC_LIB', 'BF_JEMALLOC_LIB_STATIC',
             'BUILDBOT_BRANCH',
@@ -242,8 +244,8 @@ def SetupSpawn( env ):
 def read_opts(env, cfg, args):
     localopts = Variables.Variables(cfg, args)
     localopts.AddVariables(
-        ('LCGDIR', 'location of cvs lib dir'),
-        ('LIBDIR', 'root dir of libs'),
+        ('LCGDIR', 'Location of SVN lib dir'),
+        ('LIBDIR', 'Root dir of libs'),
         (BoolVariable('WITH_BF_PYTHON', 'Compile with python', True)),
         (BoolVariable('WITH_BF_PYTHON_SAFETY', 'Internal API error checking to track invalid data to prevent crash on access (at the expense of some effeciency)', False)),
         ('BF_PYTHON', 'Base path for python', ''),
@@ -264,6 +266,7 @@ def read_opts(env, cfg, args):
         (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)),
+        (BoolVariable('WITH_BF_SMOKE', 'Build with smoke simulation', True)),
         ('BF_PROFILE_FLAGS', 'Profiling compiler flags', ''),
         (BoolVariable('WITH_BF_OPENAL', 'Use OpenAL if true', False)),
         ('BF_OPENAL', 'Base path for OpenAL', ''),
@@ -311,6 +314,8 @@ def read_opts(env, cfg, args):
         (BoolVariable('WITH_BF_CINEON', 'Support CINEON and DPX image formats if true', True)),
 
         (BoolVariable('WITH_BF_HDR', 'Support HDR image formats if true', True)),
+        
+        (BoolVariable('WITH_BF_FRAMESERVER', 'Support export to a frameserver', True)),
 
         (BoolVariable('WITH_BF_FFMPEG', 'Use FFMPEG if true', False)),
         ('BF_FFMPEG', 'FFMPEG base path', ''),
@@ -533,8 +538,6 @@ def read_opts(env, cfg, args):
         ('BF_NUMJOBS', 'Number of build processes to spawn', '1'),
         ('BF_MSVS', 'Generate MSVS project files and solution', False),
 
-        ('BF_VERSION', 'The root path for Unix (non-apple)', '2.5'),
-
         (BoolVariable('BF_UNIT_TEST', 'Build with unit test support.', False)),
         
         (BoolVariable('BF_GHOST_DEBUG', 'Make GHOST print events and info to stdout. (very verbose)', False)),
@@ -567,7 +570,9 @@ def read_opts(env, cfg, args):
         ('BF_BOOST_INC', 'Boost include path', ''),
         ('BF_BOOST_LIB', 'Boost library', ''),
         ('BF_BOOST_LIBPATH', 'Boost library path', ''),
-        ('BF_BOOST_LIB_STATIC', 'Boost static library', '')
+        ('BF_BOOST_LIB_STATIC', 'Boost static library', ''),
+
+        (BoolVariable('WITH_GHOST_XDND', 'Build with drag-n-drop support on Linux platforms using XDND protocol', True))
     ) # end of opts.AddOptions()
 
     return localopts
@@ -612,7 +617,7 @@ def buildslave(target=None, source=None, env=None):
     Builder for buildbot integration. Used by buildslaves of http://builder.blender.org only.
     """
 
-    if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'darwin'):
+    if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'darwin', 'win64-mingw'):
         extension = '.zip'
     else:
         extension = '.tar.bz2'
@@ -657,15 +662,13 @@ def NSIS_print(target, source, env):
 def NSIS_Installer(target=None, source=None, env=None):
     print "="*35
 
-    if env['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc'):
+    if env['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc', 'win64-mingw'):
         print "NSIS installer is only available on Windows."
         Exit()
-    if env['OURPLATFORM'] == 'win32-vc':
+    if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'):
         bitness = '32'
-    elif env['OURPLATFORM'] == 'win64-vc':
+    elif env['OURPLATFORM'] in ('win64-vc', 'win64-mingw'):
         bitness = '64'
-    else:
-        bitness = '-mingw'
 
     start_dir = os.getcwd()
     rel_dir = os.path.join(start_dir,'release','windows','installer')
@@ -757,7 +760,7 @@ def NSIS_Installer(target=None, source=None, env=None):
     cmdline = "makensis " + "\""+tmpnsi+"\""
 
     startupinfo = subprocess.STARTUPINFO()
-    startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
+    #startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
     proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
         stderr=subprocess.PIPE, startupinfo=startupinfo, shell = True)
     data, err = proc.communicate()
diff --git a/doc/doxygen/Doxyfile b/doc/doxygen/Doxyfile
index e8fb065..8444ea7 100644
--- a/doc/doxygen/Doxyfile
+++ b/doc/doxygen/Doxyfile
@@ -31,7 +31,7 @@ PROJECT_NAME           = Blender
 # This could be handy for archiving the generated documentation or 
 # if some version control system is used.
 
-PROJECT_NUMBER         = "V2.59"
+PROJECT_NUMBER         = "V2.6x"
 
 # Using the PROJECT_BRIEF tag one can provide an optional one line description
 # for a project that appears at the top of each page and should give viewer
@@ -648,7 +648,7 @@ RECURSIVE              = YES
 # excluded from the INPUT source files. This way you can easily exclude a 
 # subdirectory from a directory tree whose root is specified with the INPUT tag.
 
-EXCLUDE                = ../../source/gameengine/PyDoc
+EXCLUDE                = ../../build_files, ../../release
 
 # The EXCLUDE_SYMLINKS tag can be used select whether or not files or 
 # directories that are symbolic links (a Unix file system feature) are excluded 
@@ -662,7 +662,7 @@ EXCLUDE_SYMLINKS       = NO
 # against the file with absolute path, so to exclude all test directories 
 # for example use the pattern */test/*
 
-EXCLUDE_PATTERNS       = .svn
+EXCLUDE_PATTERNS       = .svn .git *.py
 
 # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names 
 # (namespaces, classes, functions, etc.) that should be excluded from the 
diff --git a/doc/doxygen/doxygen.source b/doc/doxygen/doxygen.source
index cc3a2b1..f27a5a8 100644
--- a/doc/doxygen/doxygen.source
+++ b/doc/doxygen/doxygen.source
@@ -8,14 +8,14 @@
 /** \defgroup render Rendering
  *  \ingroup blender
  */
-/** \defgroup meshedit Mesh Editing */
+/** \defgroup bmesh BMesh
+ *  \ingroup blender
+ */
 /** \defgroup texture Texturing */
 /** \defgroup compositor Compositing */
 
-/** \defgroup scripts Scripting */
-
 /** \defgroup python Python
- *  \ingroup blender scripts
+ *  \ingroup blender
  */
 
 /** \defgroup pygen Python Generic
@@ -332,7 +332,7 @@
  *  \ingroup imbuf
  */
 
-/** \defgorup imbdds DDS
+/** \defgroup imbdds DDS
  *  \ingroup imbuf
  */
 
diff --git a/doc/manpage/blender.1 b/doc/manpage/blender.1
index 169006f..6257a78 100644
--- a/doc/manpage/blender.1
+++ b/doc/manpage/blender.1
@@ -1,4 +1,13 @@
-.TH "BLENDER" "1" "December 10, 2011" "Blender Blender 2\&.60 (sub 7)"
+.TH "BLENDER" "1" "April 26, 2012" "Blender Blender 2\&.63 (sub 0)
+	build date: 2012-04-26
+	build time: 19:38:31
+	build revision: 45987
+	build platform: Linux
+	build type: Debug
+	build c flags:  -fopenmp  -msse2  -msse -pipe -fPIC -funsigned-char -fno-strict-aliasing  -Wall -Wcast-align -Werror=declaration-after-statement -Werror=implicit-function-declaration -Werror=return-type -Wstrict-prototypes -Wno-char-subscripts -Wno-unknown-pragmas -Wpointer-arith -Wunused-parameter -Wwrite-strings
+	build c++ flags:  -D__STDC_CONSTANT_MACROS -fopenmp  -msse2  -msse -pipe -fPIC -funsigned-char -fno-strict-aliasing  -Wall -Wno-invalid-offsetof -Wno-sign-compare
+	build link flags: -pthread
+	build system: CMake"
 
 .SH NAME
 blender \- a 3D modelling and rendering package
@@ -15,7 +24,7 @@ Use Blender to create TV commercials, to make technical visualizations, business
 http://www.blender.org
 .SH OPTIONS
 
-Blender 2.60 (sub 7)
+Blender 2.63 (sub 0)
 Usage: blender [args ...] [file] [args ...]
 .br
 .SS "Render Options:"
@@ -133,9 +142,17 @@ Use amount of <threads> for rendering in background
 .SS "Animation Playback Options:"
 
 .TP
-.B \-a or \-\-render\-anim
+.B \-a <options> <file(s)>
 .br
-Render frames from start to end (inclusive)
+Playback <file(s)>, only operates this way when not running in background.
+.br
+    \-p <sx> <sy> Open with lower left corner at <sx>, <sy>
+.br
+    \-m Read from disk (Don't buffer)
+.br
+    \-f <fps> <fps\-base> Specify FPS to start with
+.br
+    \-j <frame> Set frame step to <frame>
 .br
 
 .IP
@@ -206,6 +223,18 @@ Turn debugging on
 Enable floating point exceptions
 .br
 
+.TP
+.B \-\-debug\-ffmpeg
+.br
+Enable debug messages from FFmpeg library
+.br
+
+.TP
+.B \-\-debug\-libmv
+.br
+Enable debug messages from libmv library
+.br
+
 .IP
 
 .TP
@@ -331,17 +360,27 @@ Print this help text and exit (windows only)
 .br
 
 .TP
-.B \-a <options> <file(s)>
+.B \-\-debug\-python
 .br
-Playback <file(s)>, only operates this way when not running in background.
+Enable debug messages for python
 .br
-    \-p <sx> <sy> Open with lower left corner at <sx>, <sy>
+
+.TP
+.B \-\-debug\-events
 .br
-    \-m Read from disk (Don't buffer)
+Enable debug messages for the event system
 .br
-    \-f <fps> <fps\-base> Specify FPS to start with
+
+.TP
+.B \-\-debug\-wm
 .br
-    \-j <frame> Set frame step to <frame>
+Enable debug messages for the window manager
+.br
+
+.TP
+.B \-\-debug\-all
+.br
+Enable all debug messages (excludes libmv)
 .br
 
 .TP
@@ -378,10 +417,11 @@ Arguments are executed in the order they are given. eg
   \fIBLENDER_USER_CONFIG\fR Directory for user configuration files.
   \fIBLENDER_USER_SCRIPTS\fR Directory for user scripts.
   \fIBLENDER_SYSTEM_SCRIPTS\fR Directory for system wide scripts.
-  \fIBLENDER_USER_DAT`AFILES\fR Directory for user data files (icons, translations, ..).
+  \fIDirectory\fR for user data files (icons, translations, ..).
   \fIBLENDER_SYSTEM_DATAFILES\fR Directory for system wide data files.
   \fIBLENDER_SYSTEM_PYTHON\fR Directory for system python libraries.
   \fITMP\fR or \fITMPDIR\fR Store temporary files here.
+  \fISDL_AUDIODRIVER\fR LibSDL audio driver \- alsa, esd, dma.
   \fIPYTHONHOME\fR Path to the python directory, eg. /usr/lib/python.
 .br
 .br
diff --git a/doc/python_api/examples/bpy.types.Mesh.py b/doc/python_api/examples/bpy.types.Mesh.py
new file mode 100644
index 0000000..69edf2c
--- /dev/null
+++ b/doc/python_api/examples/bpy.types.Mesh.py
@@ -0,0 +1,41 @@
+"""
+Mesh Data
++++++++++
+
+The mesh data is accessed in object mode and intended for compact storage,
+for more flexible mesh editing from python see :mod:`bmesh`.
+
+Blender stores 4 main arrays to define mesh geometry.
+
+* :class:`Mesh.vertices` (3 points in space)
+* :class:`Mesh.edges` (reference 2 vertices)
+* :class:`Mesh.loops` (reference a single vertex and edge)
+* :class:`Mesh.polygons`: (reference a range of loops)
+
+
+Each polygon reference a slice in the loop array, this way, polygons do not store vertices or corner data such as UV's directly,
+only a reference to loops that the polygon uses.
+
+:class:`Mesh.loops`, :class:`Mesh.uv_layers` :class:`Mesh.vertex_colors` are all aligned so the same polygon loop
+indicies can be used to find the UV's and vertex colors as with as the vertices.
+
+To compare mesh API options see: :ref:`NGons and Tessellation Faces <info_gotcha_mesh_faces>`
+
+
+This example script prints the vertices and UV's for each polygon, assumes the active object is a mesh with UVs.
+"""
+
+import bpy
+
+me = bpy.context.object.data
+uv_layer = me.uv.layers.active.data
+
+for poly in me.polygons:
+    print("Polygon index: %d, length: %d" % (poly.index, poly.loop_total))
+
+    # range is used here to show how the polygons reference loops,
+    # for convenience 'poly.loop_indices' can be used instead.
+    for loop_index in range(poly.loop_start, poly.loop_start + poly.loop_total):
+        print("    Vertex: %d" % me.loops[loop_index].vertex_index)
+        print("    UV: %r" % uv_layer[loop_index].uv)
+    
diff --git a/doc/python_api/rst/bge.types.rst b/doc/python_api/rst/bge.types.rst
index 735ad03..bcef816 100644
--- a/doc/python_api/rst/bge.types.rst
+++ b/doc/python_api/rst/bge.types.rst
@@ -1806,9 +1806,9 @@ Game Types (bge.types)
       object = cont.owner
 
       for mesh in object.meshes:
-         for material in mesh.materials:
-            for v_index in range(mesh.getVertexArrayLength(mat)):
-               vertex = mesh.getVertex(mat, v_index)
+         for m_index in range(len(mesh.materials)):
+            for v_index in range(mesh.getVertexArrayLength(m_index)):
+               vertex = mesh.getVertex(m_index, v_index)
                # Do something with vertex here...
                # ... eg: colour the vertex red.
                vertex.colour = [1.0, 0.0, 0.0, 1.0]
@@ -4518,10 +4518,16 @@ Game Types (bge.types)
 
    .. data:: KX_ACT_ARMATURE_SETWEIGHT
 
-      Change weight of (only for IK constraint).
+      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.
@@ -4566,6 +4572,12 @@ Game Types (bge.types)
       
          A weight of 0 disables a constraint while still updating constraint runtime values (see :class:`BL_ArmatureConstraint`)
 
+   .. attribute:: influence
+
+      The influence this actuator will set on the constraint it controls.
+
+      :type: float.
+
 .. class:: KX_ArmatureSensor(SCA_ISensor)
 
    Armature sensor detect conditions on armatures.
diff --git a/doc/python_api/rst/include__bmesh.rst b/doc/python_api/rst/include__bmesh.rst
new file mode 100644
index 0000000..212ab4e
--- /dev/null
+++ b/doc/python_api/rst/include__bmesh.rst
@@ -0,0 +1,162 @@
+..
+   This document is appended to the auto generated bmesh api doc to avoid clogging up the C files with details.
+   to test this run:
+   ./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 ../../
+
+
+Intro
+-----
+
+This API gives access the blenders internal mesh editing api, featuring geometry connectivity data and
+access to editing operations such as split, separate, collapse and dissolve.
+
+The features exposed closely follow the C API,
+giving python access to the functions used by blenders own mesh editing tools.
+
+For an overview of BMesh data types and how they reference each other see:
+`BMesh Design Document <http://wiki.blender.org/index.php/Dev:2.6/Source/Modeling/BMesh/Design>`_ .
+
+
+.. note::
+
+   **Disk** and **Radial** data is not exposed by the python api since this is for internal use only.
+
+
+.. warning::
+
+   This API is still in development and experimental, while we don't expect to see large changes,
+   many areas are not well tested yet and so its possible changes will be made that break scripts.
+
+   *Campbell Barton, 13, March 2012*
+
+
+.. warning::
+
+   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
+--------------
+
+.. literalinclude:: ../../../release/scripts/templates/bmesh_simple.py
+
+
+Stand-Alone Module
+^^^^^^^^^^^^^^^^^^
+
+The bmesh module is written to be standalone except for :mod:`mathutils`
+which is used for vertex locations and normals.
+
+The only other exception to this are when converting mesh data to and from :class:`bpy.types.Mesh`.
+
+
+Mesh Access
+-----------
+
+There are 2 ways to access BMesh data, you can create a new BMesh by converting a mesh from
+:class:`bpy.types.BlendData.meshes` or by accessing the current edit mode mesh.
+see: :class:`bmesh.types.BMesh.from_mesh` and :mod:`bmesh.from_edit_mesh` respectively.
+
+When explicitly converting from mesh data python **owns** the data, that is to say - that the mesh only exists while
+python holds a reference to it, and the script is responsible for putting it back into a mesh data-block when the edits
+are done.
+
+Note that unlike :mod:`bpy`, a BMesh does not necessarily correspond to data in the currently open blend file,
+a BMesh can be created, edited and freed without the user ever seeing or having access to it.
+Unlike edit mode, the bmesh module can use multiple BMesh instances at once.
+
+Take care when dealing with multiple BMesh instances since the mesh data can use a lot of memory, while a mesh that
+python owns will be freed in when the script holds no references to it,
+its good practice to call :class:`bmesh.types.BMesh.free` which will remove all the mesh data immediately and disable
+further access.
+
+
+EditMode Tessellation
+^^^^^^^^^^^^^^^^^^^^^
+
+When writing scripts that operate on editmode data you will normally want to re-calculate the tessellation after
+running the  script, this needs to be called explicitly.
+
+The BMesh its self does not store the triangulated faces, they are stored in the :class:`bpy.types.Mesh`,
+to refresh tessellation faces call :class:`bpy.types.Mesh.calc_tessface`.
+
+
+CustomData Access
+-----------------
+
+BMesh has a unified way to access mesh attributes such as UV's vertex colors, shape keys, edge crease etc.
+
+This works by having a **layers** property on bmesh data sequences to access the custom data layers which can then be
+used to access the actual data on each vert/edge/face/loop.
+
+Here are some examples ...
+
+.. code-block:: python
+
+   uv_lay = bm.loops.layers.uv.active
+
+   for face in bm.faces:
+       for loop in f.loops:
+           uv = loop[uv_lay]
+           print("Loop UV: %f, %f" % (uv.x, uv.y))
+
+
+.. code-block:: python
+
+   shape_lay = bm.verts.layers.shape["Key.001"]
+
+   for vert in bm.verts:
+       shape = vert[shape_lay]
+       print("Vert Shape: %f, %f, %f" % (shape.x, shape.y, shape.z))
+
+
+.. code-block:: python
+
+   # in this example the active vertex group index is used,
+   # this is stored in the object, not the BMesh
+   group_index = obj.vertex_groups.active_index
+
+   # only ever one deform weight layer
+   dvert_lay = bm.verts.layers.deform.active
+
+   for vert in bm.verts:
+       dvert = vert[dvert_lay]
+
+       if group_index in dvert:
+           print("Weight %f" % dvert[group_index])
+       else:
+           print("Setting Weight")
+           dvert[group_index] = 0.5
+
+
+Keeping a Correct State
+-----------------------
+
+When modeling in blender there are certain assumptions made about the state of the mesh.
+
+* hidden geometry isn't selected.
+* when an edge is selected, its vertices are selected too.
+* when a face is selected, its edges and vertices are selected.
+* duplicate edges / faces don't exist.
+* faces have at least 3 vertices.
+
+To give developers flexibility these conventions are not enforced,
+however tools must leave the mesh in a valid state else other tools may behave incorrectly.
+
+Any errors that arise from not following these conventions is considered a bug in the script,
+not a bug in blender.
+
+
+Selection / Flushing
+^^^^^^^^^^^^^^^^^^^^
+
+As mentioned above, it is possible to create an invalid selection state
+(by selecting a state and then de-selecting one of its vertices's for example), mostly the best way to solve this is to
+flush the selection after performing a series of edits. this validates the selection state.
+
+
+Module Functions
+----------------
diff --git a/doc/python_api/rst/info_best_practice.rst b/doc/python_api/rst/info_best_practice.rst
index d191bb6..481555d 100644
--- a/doc/python_api/rst/info_best_practice.rst
+++ b/doc/python_api/rst/info_best_practice.rst
@@ -264,11 +264,11 @@ if your unsure whether the text is upper or lower case use lower or upper string
 Use try/except Sparingly
 ------------------------
 
-The **try** statement useful to save time writing error checking code.
+The **try** statement is useful to save time writing error checking code.
 
 However **try** is significantly slower then an **if** since an exception has to be set each time, so avoid using **try** in areas of your code that execute in a loop and runs many times.
 
-There are cases where using **try** is faster than checking weather the condition will raise an error, so it is worth experimenting.
+There are cases where using **try** is faster than checking whether the condition will raise an error, so it is worth experimenting.
 
 
 Value Comparison
diff --git a/doc/python_api/rst/info_gotcha.rst b/doc/python_api/rst/info_gotcha.rst
index 281f068..eb31279 100644
--- a/doc/python_api/rst/info_gotcha.rst
+++ b/doc/python_api/rst/info_gotcha.rst
@@ -118,14 +118,6 @@ 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)
 
 
-Matrix multiplication is wrong
-==============================
-
-Every so often users complain that Blenders matrix math is wrong, the confusion comes from mathutils matrices being column-major to match OpenGL and the rest of Blenders matrix operations and stored matrix data.
-
-This is different to **numpy** which is row-major which matches what you would expect when using conventional matrix math notation.
-
-
 I can't edit the mesh in edit-mode!
 ===================================
 
@@ -140,6 +132,93 @@ write useful tools in python which are also fast to execute while in edit-mode.
 For the time being this limitation just has to be worked around but we're aware its frustrating needs to be addressed.
 
 
+.. _info_gotcha_mesh_faces:
+
+NGons and Tessellation Faces
+============================
+
+Since 2.63 NGons are supported, this adds some complexity since in some cases you need to access triangles still (some exporters for example).
+
+There are now 3 ways to access faces:
+
+* :class:`bpy.types.MeshPolygon` - this is the data stricture which now stores faces in object mode (access as ``mesh.polygons`` rather then ``mesh.faces``).
+* :class:`bpy.types.MeshTessFace` - the result of triangulating (tessellated) polygons, the main method of face access in 2.62 or older (access as ``mesh.tessfaces``).
+* :class:`bmesh.types.BMFace` - the polygons as used in editmode.
+
+For the purpose of the following documentation, these will be referred to as polygons, tessfaces and bmesh-faces respectively.
+
+5+ sided faces will be referred to as ``ngons``.
+
+Support Overview
+----------------
+
++--------------+------------------------------+--------------------------------+--------------------------------+
+|Usage         |:class:`bpy.types.MeshPolygon`|:class:`bpy.types.MeshTessFace` |:class:`bmesh.types.BMFace`     |
++==============+==============================+================================+================================+
+|Import/Create |Bad (inflexible)              |Fine (supported as upgrade path)|Best                            |
++--------------+------------------------------+--------------------------------+--------------------------------+
+|Manipulate    |Bad (inflexible)              |Bad (loses ngons)               |Best                            |
++--------------+------------------------------+--------------------------------+--------------------------------+
+|Export/Output |Good (ngons)                  |Good (When ngons can't be used) |Good (ngons, memory overhead)   |
++--------------+------------------------------+--------------------------------+--------------------------------+
+
+
+.. note::
+
+   Using the :mod:`bmesh` api is completely separate api from :mod:`bpy`, typically you would would use one or the other based on the level of editing needed, not simply for a different way to access faces.
+
+
+Creating
+--------
+
+All 3 datatypes can be used for face creation.
+
+* polygons are the most efficient way to create faces but the data structure is _very_ rigid and inflexible, you must have all your vertes and faces ready and create them all at once. This is further complicated by the fact that each polygon does not store its own verts (as with tessfaces), rather they reference an index and size in :class:`bpy.types.Mesh.loops` which are a fixed array too.
+* tessfaces ideally should not be used for creating faces since they are really only tessellation cache of polygons, however for scripts upgrading from 2.62 this is by far the most straightforward option. This works by creating tessfaces and when finished - they can be converted into polygons by calling :class:`bpy.types.Mesh.update`. The obvious limitation is ngons can't be created this way.
+* bmesh-faces are most likely the easiest way for new scripts to create faces, since faces can be added one by one and the api has features intended for mesh manipulation. While :class:`bmesh.types.BMesh` uses more memory it can be managed by only operating on one mesh at a time.
+
+
+Editing
+-------
+
+Editing is where the 3 data types vary most.
+
+* polygons are very limited for editing, changing materials and options like smooth works but for anything else they are too inflexible and are only intended for storage.
+* tessfaces should not be used for editing geometry because doing so will cause existing ngons to be tessellated.
+* bmesh-faces are by far the best way to manipulate geometry.
+
+Exporting
+---------
+
+All 3 data types can be used for exporting, the choice mostly depends on whether the target format supports ngons or not.
+
+* polygons are the most direct & efficient way to export providing they convert into the output format easily enough.
+* tessfaces work well for exporting to formats which dont support ngons, in fact this is the only place where their use is encouraged.
+* bmesh-faces can work for exporting too but may not be necessary if polygons can be used since using bmesh gives some overhead because its not the native storage format in object mode.
+
+
+Upgrading Importers from 2.62
+-----------------------------
+
+Importers can be upgraded to work with only minor changes.
+
+The main change to be made is used the tessellation versions of each attribute.
+
+* mesh.faces --> :class:`bpy.types.Mesh.tessfaces`
+* mesh.uv_textures --> :class:`bpy.types.Mesh.tessface_uv_textures`
+* mesh.vertex_colors --> :class:`bpy.types.Mesh.tessface_vertex_colors`
+
+Once the data is created call :class:`bpy.types.Mesh.update` to convert the tessfaces into polygons.
+
+
+Upgrading Exporters from 2.62
+-----------------------------
+
+For exporters the most direct way to upgrade is to use tessfaces as with importing however its important to know that tessfaces may **not** exist for a mesh, the array will be empty as if there are no faces.
+
+So before accessing tessface data call: :class:`bpy.types.Mesh.update` ``(calc_tessface=True)``.
+
+
 EditBones, PoseBones, Bone... Bones
 ===================================
 
diff --git a/doc/python_api/rst/info_tips_and_tricks.rst b/doc/python_api/rst/info_tips_and_tricks.rst
index 0b94049..521031f 100644
--- a/doc/python_api/rst/info_tips_and_tricks.rst
+++ b/doc/python_api/rst/info_tips_and_tricks.rst
@@ -82,7 +82,7 @@ You might want to reference a script relative to the blend file.
    import bpy
    import os
 
-   filename = os.path.join(os.path.basename(bpy.data.filepath), "myscript.py")
+   filename = os.path.join(os.path.dirname(bpy.data.filepath), "myscript.py")
    exec(compile(open(filename).read(), filename, 'exec'))
 
 
diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index 9540039..bfef94b 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -14,125 +14,433 @@
  # 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
+ # Contributor(s): Campbell Barton, Luca Bonavita
  #
  # #**** END GPL LICENSE BLOCK #****
 
 # <pep8 compliant>
 
-script_help_msg = '''
-Usage:
+SCRIPT_HELP_MSG = """
 
-For HTML generation
--------------------
-- Run this script from blenders root path once you have compiled blender
+API dump in RST files
+---------------------
+  Run this script from blenders root path once you have compiled blender
 
     ./blender.bin --background -noaudio --python doc/python_api/sphinx_doc_gen.py
 
   This will generate python files in doc/python_api/sphinx-in/
   providing ./blender.bin is or links to the blender executable
 
-- Generate html docs by running...
+  To choose sphinx-in directory:
+    ./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
+
+
+Sphinx: HTML generation
+-----------------------
+  After you have built doc/python_api/sphinx-in (see above),
+  generate html docs by running:
 
     cd doc/python_api
     sphinx-build sphinx-in sphinx-out
 
   This requires sphinx 1.0.7 to be installed.
 
-For PDF generation
-------------------
-- After you have built doc/python_api/sphinx-in (see above), run:
+
+Sphinx: PDF generation
+----------------------
+  After you have built doc/python_api/sphinx-in (see above),
+  generate the pdf doc by running:
 
     sphinx-build -b latex doc/python_api/sphinx-in doc/python_api/sphinx-out
     cd doc/python_api/sphinx-out
     make
-'''
 
-# Check we're running in blender
-if __import__("sys").modules.get("bpy") is None:
-    print("\nError, this script must run from inside blender")
-    print(script_help_msg)
+"""
 
+try:
+    import bpy  # blender module
+except:
+    print("\nERROR: this script must run from inside Blender")
+    print(SCRIPT_HELP_MSG)
     import sys
     sys.exit()
 
+import rna_info     # blender module
+
+# import rpdb2; rpdb2.start_embedded_debugger('test')
+import os
+import sys
+import inspect
+import shutil
+import logging
+
+from platform import platform
+PLATFORM = platform().split('-')[0].lower()    # 'linux', 'darwin', 'windows'
+
+SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
+
 
-# Switch for quick testing
-if 1:
+def handle_args():
+    '''
+    Parse the args passed to Blender after "--", ignored by Blender
+    '''
+    import argparse
+
+    # When --help is given, print the usage text
+    parser = argparse.ArgumentParser(
+        formatter_class=argparse.RawTextHelpFormatter,
+        usage=SCRIPT_HELP_MSG
+    )
+
+    # optional arguments
+    parser.add_argument("-p", "--partial",
+                        dest="partial",
+                        type=str,
+                        default="",
+                        help="Use a wildcard to only build specific module(s)\n"
+                             "Example: --partial bmesh*\n",
+                        required=False)
+
+    parser.add_argument("-f", "--fullrebuild",
+                        dest="full_rebuild",
+                        default=False,
+                        action='store_true',
+                        help="Rewrite all rst files in sphinx-in/ "
+                             "(default=False)",
+                        required=False)
+
+    parser.add_argument("-b", "--bpy",
+                        dest="bpy",
+                        default=False,
+                        action='store_true',
+                        help="Write the rst file of the bpy module "
+                             "(default=False)",
+                        required=False)
+
+    parser.add_argument("-o", "--output",
+                        dest="output_dir",
+                        type=str,
+                        default=SCRIPT_DIR,
+                        help="Path of the API docs (default=<script dir>)",
+                        required=False)
+
+    parser.add_argument("-T", "--sphinx-theme",
+                        dest="sphinx_theme",
+                        type=str,
+                        default='default',
+                        help=
+                        # see SPHINX_THEMES below
+                        "Sphinx theme (default='default')\n"
+                        "Available themes\n"
+                        "----------------\n"
+                        "(Blender Foundation) blender-org\n"    # naiad
+                        "(Sphinx) agogo, basic, epub, haiku, nature, "
+                        "scrolls, sphinxdoc, traditional\n",
+#                        choices=['naiad', 'blender-org'] +      # bf
+#                                ['agogo', 'basic', 'epub',
+#                                 'haiku', 'nature', 'scrolls',
+#                                 'sphinxdoc', 'traditional'],   # sphinx
+                        required=False)
+
+    parser.add_argument("-N", "--sphinx-named-output",
+                        dest="sphinx_named_output",
+                        default=False,
+                        action='store_true',
+                        help="Add the theme name to the html dir name.\n"
+                             "Example: \"sphinx-out_haiku\" (default=False)",
+                        required=False)
+
+    parser.add_argument("-B", "--sphinx-build",
+                        dest="sphinx_build",
+                        default=False,
+                        action='store_true',
+                        help="Build the html docs by running:\n"
+                             "sphinx-build SPHINX_IN SPHINX_OUT\n"
+                             "(default=False; does not depend on -P)",
+                        required=False)
+
+    parser.add_argument("-P", "--sphinx-build-pdf",
+                        dest="sphinx_build_pdf",
+                        default=False,
+                        action='store_true',
+                        help="Build the pdf by running:\n"
+                             "sphinx-build -b latex SPHINX_IN SPHINX_OUT_PDF\n"
+                             "(default=False; does not depend on -B)",
+                        required=False)
+
+    parser.add_argument("-R", "--pack-reference",
+                        dest="pack_reference",
+                        default=False,
+                        action='store_true',
+                        help="Pack all necessary files in the deployed dir.\n"
+                             "(default=False; use with -B and -P)",
+                        required=False)
+
+    parser.add_argument("-l", "--log",
+                        dest="log",
+                        default=False,
+                        action='store_true',
+                        help=(
+                        "Log the output of the api dump and sphinx|latex "
+                        "warnings and errors (default=False).\n"
+                        "If given, save logs in:\n"
+                        "* OUTPUT_DIR/.bpy.log\n"
+                        "* OUTPUT_DIR/.sphinx-build.log\n"
+                        "* OUTPUT_DIR/.sphinx-build_pdf.log\n"
+                        "* OUTPUT_DIR/.latex_make.log",
+                        ),
+                        required=False)
+
+    # parse only the args passed after '--'
+    argv = []
+    if "--" in sys.argv:
+        argv = sys.argv[sys.argv.index("--") + 1:]  # get all args after "--"
+
+    return parser.parse_args(argv)
+
+
+ARGS = handle_args()
+
+# ----------------------------------BPY-----------------------------------------
+
+BPY_LOGGER = logging.getLogger('bpy')
+BPY_LOGGER.setLevel(logging.DEBUG)
+
+"""
+# for quick rebuilds
+rm -rf /b/doc/python_api/sphinx-* && \
+./blender.bin -b -noaudio --factory-startup -P doc/python_api/sphinx_doc_gen.py && \
+sphinx-build doc/python_api/sphinx-in doc/python_api/sphinx-out
+
+or
+
+./blender.bin -b -noaudio --factory-startup -P doc/python_api/sphinx_doc_gen.py -- -f -B
+"""
+
+# Switch for quick testing so doc-builds don't take so long
+if not ARGS.partial:
     # full build
+    FILTER_BPY_OPS = None
+    FILTER_BPY_TYPES = None
     EXCLUDE_INFO_DOCS = False
     EXCLUDE_MODULES = ()
-    FILTER_BPY_TYPES = None
-    FILTER_BPY_OPS = None
 
 else:
-    EXCLUDE_INFO_DOCS = False
-    # for testing so doc-builds dont take so long.
-    EXCLUDE_MODULES = (
+    # can manually edit this too:
+    #FILTER_BPY_OPS = ("import.scene", )  # allow
+    #FILTER_BPY_TYPES = ("bpy_struct", "Operator", "ID")  # allow
+    EXCLUDE_INFO_DOCS = True
+    EXCLUDE_MODULES = [
+        "aud",
+        "bge",
+        "bge.constraints",
+        "bge.events",
+        "bge.logic",
+        "bge.render",
+        "bge.texture",
+        "bge.types",
+        "bgl",
+        "blf",
+        "bmesh",
+        "bmesh.types",
+        "bmesh.utils",
+        "bpy.app",
+        "bpy.app.handlers",
         "bpy.context",
-        #"bpy.app",
-        #"bpy.app.handlers",
-        "bpy.path",
         "bpy.data",
+        "bpy.ops",  # supports filtering
+        "bpy.path",
         "bpy.props",
-        "bpy.utils",
-        "bpy.context",
         "bpy.types",  # supports filtering
-        "bpy.ops",  # supports filtering
+        "bpy.utils",
         "bpy_extras",
-        "bge",
-        "aud",
-        "bgl",
-        "blf",
         "gpu",
         "mathutils",
         "mathutils.geometry",
         "mathutils.noise",
-    )
+        ]
 
-    FILTER_BPY_TYPES = ("bpy_struct", "Operator", "ID")  # allow
-    FILTER_BPY_OPS = ("import.scene", )  # allow
+    # ------
+    # Filter
+    #
+    # TODO, support bpy.ops and bpy.types filtering
+    import fnmatch
+    m = None
+    EXCLUDE_MODULES = [m for m in EXCLUDE_MODULES if not fnmatch.fnmatchcase(m, ARGS.partial)]
 
-    # for quick rebuilds
-    """
-rm -rf /b/doc/python_api/sphinx-* && \
-./blender.bin --background -noaudio --factory-startup --python  doc/python_api/sphinx_doc_gen.py && \
-sphinx-build doc/python_api/sphinx-in doc/python_api/sphinx-out
+    # special support for bpy.types.XXX
+    FILTER_BPY_OPS = tuple([m[8:] for m in ARGS.partial.split(":") if m.startswith("bpy.ops.")])
+    if FILTER_BPY_OPS:
+        EXCLUDE_MODULES.remove("bpy.ops")
 
-    """
+    FILTER_BPY_TYPES = tuple([m[10:] for m in ARGS.partial.split(":") if m.startswith("bpy.types.")])
+    if FILTER_BPY_TYPES:
+        EXCLUDE_MODULES.remove("bpy.types")
+
+    print(FILTER_BPY_TYPES)
+
+    EXCLUDE_INFO_DOCS = (not fnmatch.fnmatchcase("info", ARGS.partial))
+
+    del m
+    del fnmatch
+
+    BPY_LOGGER.debug("Partial Doc Build, Skipping: %s\n" % "\n                             ".join(sorted(EXCLUDE_MODULES)))
+
+    #
+    # done filtering
+    # --------------
+
+try:
+    __import__("aud")
+except ImportError:
+    BPY_LOGGER.debug("Warning: Built without 'aud' module, docs incomplete...")
+    EXCLUDE_MODULES = EXCLUDE_MODULES + ("aud", )
+
+# examples
+EXAMPLES_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "examples"))
+EXAMPLE_SET = set()
+for f in os.listdir(EXAMPLES_DIR):
+    if f.endswith(".py"):
+        EXAMPLE_SET.add(os.path.splitext(f)[0])
+EXAMPLE_SET_USED = set()
+
+# rst files dir
+RST_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "rst"))
 
 # extra info, not api reference docs
-# stored in ./rst/info/
+# stored in ./rst/info_*
 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_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 writeing scripts for blender"),
+    ("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"),
     )
 
 # only support for properties atm.
 RNA_BLACKLIST = {
-    # messes up PDF!, really a bug but for now just workaround.
-    "UserPreferencesSystem": {"language", },
+    # XXX messes up PDF!, really a bug but for now just workaround.
+    "UserPreferencesSystem": {"language", }
     }
 
+MODULE_GROUPING = {
+    "bmesh.types": (
+                    ("Base Mesh Type", '-'),
+                    "BMesh",
+                    ("Mesh Elements", '-'),
+                    "BMVert",
+                    "BMEdge",
+                    "BMFace",
+                    "BMLoop",
+                    ("Sequence Accessors", '-'),
+                    "BMElemSeq",
+                    "BMVertSeq",
+                    "BMEdgeSeq",
+                    "BMFaceSeq",
+                    "BMLoopSeq",
+                    "BMIter",
+                    ("Selection History", '-'),
+                    "BMEditSelSeq",
+                    "BMEditSelIter",
+                    ("Custom-Data Layer Access", '-'),
+                    "BMLayerAccessVert",
+                    "BMLayerAccessEdge",
+                    "BMLayerAccessFace",
+                    "BMLayerAccessLoop",
+                    "BMLayerCollection",
+                    "BMLayerItem",
+                    ("Custom-Data Layer Types", '-'),
+                    "BMLoopUV",
+                    "BMDeformVert"
+                    )
+    }
 
-# -----------------------------------------------------------------------------
-# configure compile time options
+# --------------------configure compile time options----------------------------
 
-try:
-    __import__("aud")
-except ImportError:
-    print("Warning: Built without 'aud' module, docs incomplete...")
-    EXCLUDE_MODULES = EXCLUDE_MODULES + ("aud", )
+# -------------------------------BLENDER----------------------------------------
 
+blender_version_strings = [str(v) for v in bpy.app.version]
 
-# import rpdb2; rpdb2.start_embedded_debugger('test')
-import os
-import inspect
-import bpy
-import rna_info
+# converting bytes to strings, due to #30154
+BLENDER_REVISION = str(bpy.app.build_revision, 'utf_8')
+BLENDER_DATE = str(bpy.app.build_date, 'utf_8')
+
+BLENDER_VERSION_DOTS = ".".join(blender_version_strings)    # '2.62.1'
+if BLENDER_REVISION != "Unknown":
+    BLENDER_VERSION_DOTS += " r" + BLENDER_REVISION         # '2.62.1 r44584'
+
+BLENDER_VERSION_PATH = "_".join(blender_version_strings)    # '2_62_1'
+if bpy.app.version_cycle == "release":
+    BLENDER_VERSION_PATH = "%s%s_release" % ("_".join(blender_version_strings[:2]),
+                                             bpy.app.version_char)   # '2_62_release'
+
+# --------------------------DOWNLOADABLE FILES----------------------------------
+
+REFERENCE_NAME = "blender_python_reference_%s" % BLENDER_VERSION_PATH
+REFERENCE_PATH = os.path.join(ARGS.output_dir, REFERENCE_NAME)
+BLENDER_PDF_FILENAME = "%s.pdf" % REFERENCE_NAME
+BLENDER_ZIP_FILENAME = "%s.zip" % REFERENCE_NAME
+
+# -------------------------------SPHINX-----------------------------------------
+
+SPHINX_THEMES = {'bf': ['blender-org'],  # , 'naiad',
+                 'sphinx': ['agogo',
+                            'basic',
+                            'default',
+                            'epub',
+                            'haiku',
+                            'nature',
+                            'scrolls',
+                            'sphinxdoc',
+                            'traditional']}
+
+available_themes = SPHINX_THEMES['bf'] + SPHINX_THEMES['sphinx']
+if ARGS.sphinx_theme not in available_themes:
+    print ("Please choose a theme among: %s" % ', '.join(available_themes))
+    sys.exit()
+
+if ARGS.sphinx_theme in SPHINX_THEMES['bf']:
+    SPHINX_THEME_DIR = os.path.join(ARGS.output_dir, ARGS.sphinx_theme)
+    SPHINX_THEME_SVN_DIR = os.path.join(SCRIPT_DIR, ARGS.sphinx_theme)
+
+SPHINX_IN = os.path.join(ARGS.output_dir, "sphinx-in")
+SPHINX_IN_TMP = SPHINX_IN + "-tmp"
+SPHINX_OUT = os.path.join(ARGS.output_dir, "sphinx-out")
+if ARGS.sphinx_named_output:
+    SPHINX_OUT += "_%s" % ARGS.sphinx_theme
+
+# html build
+if ARGS.sphinx_build:
+    SPHINX_BUILD = ["sphinx-build", SPHINX_IN, SPHINX_OUT]
+
+    if ARGS.log:
+        SPHINX_BUILD_LOG = os.path.join(ARGS.output_dir, ".sphinx-build.log")
+        SPHINX_BUILD = ["sphinx-build",
+                        "-w", SPHINX_BUILD_LOG,
+                        SPHINX_IN, SPHINX_OUT]
+
+# pdf build
+if ARGS.sphinx_build_pdf:
+    SPHINX_OUT_PDF = os.path.join(ARGS.output_dir, "sphinx-out_pdf")
+    SPHINX_BUILD_PDF = ["sphinx-build",
+                        "-b", "latex",
+                        SPHINX_IN, SPHINX_OUT_PDF]
+    SPHINX_MAKE_PDF = ["make", "-C", SPHINX_OUT_PDF]
+    SPHINX_MAKE_PDF_STDOUT = None
+
+    if ARGS.log:
+        SPHINX_BUILD_PDF_LOG = os.path.join(ARGS.output_dir, ".sphinx-build_pdf.log")
+        SPHINX_BUILD_PDF = ["sphinx-build", "-b", "latex",
+                            "-w", SPHINX_BUILD_PDF_LOG,
+                            SPHINX_IN, SPHINX_OUT_PDF]
+
+        sphinx_make_pdf_log = os.path.join(ARGS.output_dir, ".latex_make.log")
+        SPHINX_MAKE_PDF_STDOUT = open(sphinx_make_pdf_log, "w", encoding="utf-8")
+
+# --------------------------------API DUMP--------------------------------------
 
 # lame, python wont give some access
 ClassMethodDescriptorType = type(dict.__dict__['fromkeys'])
@@ -140,12 +448,8 @@ MethodDescriptorType = type(dict.get)
 GetSetDescriptorType = type(int.real)
 from types import MemberDescriptorType
 
-EXAMPLE_SET = set()
-EXAMPLE_SET_USED = set()
-
 _BPY_STRUCT_FAKE = "bpy_struct"
 _BPY_PROP_COLLECTION_FAKE = "bpy_prop_collection"
-_BPY_FULL_REBUILD = False
 
 if _BPY_PROP_COLLECTION_FAKE:
     _BPY_PROP_COLLECTION_ID = ":class:`%s`" % _BPY_PROP_COLLECTION_FAKE
@@ -162,10 +466,13 @@ def undocumented_message(module_name, type_name, identifier):
         preloadtitle = '%s.%s' % (module_name, identifier)
     else:
         preloadtitle = '%s.%s.%s' % (module_name, type_name, identifier)
-    message = "Undocumented (`contribute "\
-        "<http://wiki.blender.org/index.php/Dev:2.5/Py/API/Documentation/Contribute"\
-        "?action=edit&section=new&preload=Dev:2.5/Py/API/Documentation/Contribute/Howto-message"\
-        "&preloadtitle=%s>`_)\n\n" % preloadtitle
+    message = ("Undocumented (`contribute "
+               "<http://wiki.blender.org/index.php/"
+               "Dev:2.5/Py/API/Generating_API_Reference/Contribute"
+               "?action=edit"
+               "&section=new"
+               "&preload=Dev:2.5/Py/API/Generating_API_Reference/Contribute/Howto-message"
+               "&preloadtitle=%s>`_)\n\n" % preloadtitle)
     return message
 
 
@@ -207,15 +514,20 @@ def example_extract_docstring(filepath):
     return "\n".join(text), line_no
 
 
-def write_title(fw, text, heading_char):
-    fw("%s\n%s\n\n" % (text, len(text) * heading_char))
+def title_string(text, heading_char, double=False):
+    filler = len(text) * heading_char
+
+    if double:
+        return "%s\n%s\n%s\n\n" % (filler, text, filler)
+    else:
+        return "%s\n%s\n\n" % (text, filler)
 
 
 def write_example_ref(ident, fw, example_id, ext="py"):
     if example_id in EXAMPLE_SET:
 
         # extract the comment
-        filepath = "../examples/%s.%s" % (example_id, ext)
+        filepath = os.path.join("..", "examples", "%s.%s" % (example_id, ext))
         filepath_full = os.path.join(os.path.dirname(fw.__self__.name), filepath)
 
         text, line_no = example_extract_docstring(filepath_full)
@@ -231,7 +543,7 @@ def write_example_ref(ident, fw, example_id, ext="py"):
         EXAMPLE_SET_USED.add(example_id)
     else:
         if bpy.app.debug:
-            print("\tskipping example:", example_id)
+            BPY_LOGGER.debug("\tskipping example: " + example_id)
 
     # Support for numbered files bpy.types.Operator -> bpy.types.Operator.1.py
     i = 1
@@ -260,6 +572,7 @@ def write_indented_lines(ident, fn, text, strip=True):
         del lines[-1]
 
     if strip:
+        # set indentation to <indent>
         ident_strip = 1000
         for l in lines:
             if l.strip():
@@ -267,6 +580,7 @@ def write_indented_lines(ident, fn, text, strip=True):
         for l in lines:
             fn(ident + l[ident_strip:] + "\n")
     else:
+        # add <indent> number of blanks to the current indentation
         for l in lines:
             fn(ident + l + "\n")
 
@@ -377,10 +691,10 @@ def pyprop2sphinx(ident, fw, identifier, py_prop):
         fw(ident + "   (readonly)\n\n")
 
 
-def pymodule2sphinx(BASEPATH, module_name, module, title):
+def pymodule2sphinx(basepath, module_name, module, title):
     import types
     attribute_set = set()
-    filepath = os.path.join(BASEPATH, module_name + ".rst")
+    filepath = os.path.join(basepath, module_name + ".rst")
 
     module_all = getattr(module, "__all__", None)
     module_dir = sorted(dir(module))
@@ -388,11 +702,34 @@ def pymodule2sphinx(BASEPATH, module_name, module, title):
     if module_all:
         module_dir = module_all
 
+    # TODO - currently only used for classes
+    # grouping support
+    module_grouping = MODULE_GROUPING.get(module_name)
+
+    def module_grouping_index(name):
+        if module_grouping is not None:
+            try:
+                return module_grouping.index(name)
+            except ValueError:
+                pass
+        return -1
+
+    def module_grouping_heading(name):
+        if module_grouping is not None:
+            i = module_grouping_index(name) - 1
+            if i >= 0 and type(module_grouping[i]) == tuple:
+                return module_grouping[i]
+        return None, None
+
+    def module_grouping_sort_key(name):
+        return module_grouping_index(name)
+    # done grouping support
+
     file = open(filepath, "w", encoding="utf-8")
 
     fw = file.write
 
-    write_title(fw, "%s (%s)" % (title, module_name), "=")
+    fw(title_string("%s (%s)" % (title, module_name), "="))
 
     fw(".. module:: %s\n\n" % module_name)
 
@@ -428,7 +765,7 @@ def pymodule2sphinx(BASEPATH, module_name, module, title):
                 submod_name_full = "%s.%s" % (module_name, submod_name)
                 fw("   %s.rst\n\n" % submod_name_full)
 
-                pymodule2sphinx(BASEPATH, submod_name_full, submod, "%s submodule" % module_name)
+                pymodule2sphinx(basepath, submod_name_full, submod, "%s submodule" % module_name)
         del submod_ls
     # done writing submodules!
 
@@ -516,7 +853,7 @@ def pymodule2sphinx(BASEPATH, module_name, module, title):
             write_indented_lines("   ", fw, "constant value %s" % repr(value), False)
             fw("\n")
         else:
-            print("\tnot documenting %s.%s of %r type" % (module_name, attribute, value_type.__name__))
+            BPY_LOGGER.debug("\tnot documenting %s.%s of %r type" % (module_name, attribute, value_type.__name__))
             continue
 
         attribute_set.add(attribute)
@@ -524,7 +861,7 @@ def pymodule2sphinx(BASEPATH, module_name, module, title):
     del module_dir_value_type
 
     # TODO, bpy_extras does this already, mathutils not.
-    """
+    '''
     if submodules:
         fw("\n"
            "**********\n"
@@ -535,10 +872,19 @@ def pymodule2sphinx(BASEPATH, module_name, module, title):
         for attribute, submod in submodules:
             fw("* :mod:`%s.%s`\n" % (module_name, attribute))
         fw("\n")
-    """
+    '''
+
+    if module_grouping is not None:
+        classes.sort(key=lambda pair: module_grouping_sort_key(pair[0]))
 
     # write collected classes now
     for (type_name, value) in classes:
+
+        if module_grouping is not None:
+            heading, heading_char = module_grouping_heading(type_name)
+            if heading:
+                fw(title_string(heading, heading_char))
+
         # May need to be its own function
         fw(".. class:: %s\n\n" % type_name)
         if value.__doc__:
@@ -565,14 +911,13 @@ def pymodule2sphinx(BASEPATH, module_name, module, title):
     file.close()
 
 
-def pycontext2sphinx(BASEPATH):
+def pycontext2sphinx(basepath):
     # Only use once. very irregular
 
-    filepath = os.path.join(BASEPATH, "bpy.context.rst")
+    filepath = os.path.join(basepath, "bpy.context.rst")
     file = open(filepath, "w", encoding="utf-8")
     fw = file.write
-    fw("Context Access (bpy.context)\n")
-    fw("============================\n\n")
+    fw(title_string("Context Access (bpy.context)", "="))
     fw(".. module:: bpy.context\n")
     fw("\n")
     fw("The context members available depend on the area of blender which is currently being accessed.\n")
@@ -707,7 +1052,7 @@ def pyrna_enum2sphinx(prop, use_empty_descriptions=False):
         return ""
 
 
-def pyrna2sphinx(BASEPATH):
+def pyrna2sphinx(basepath):
     """ bpy.types and bpy.ops
     """
     structs, funcs, ops, props = rna_info.BuildRNAInfo()
@@ -759,7 +1104,7 @@ def pyrna2sphinx(BASEPATH):
         #if not struct.identifier == "Object":
         #    return
 
-        filepath = os.path.join(BASEPATH, "bpy.types.%s.rst" % struct.identifier)
+        filepath = os.path.join(basepath, "bpy.types.%s.rst" % struct.identifier)
         file = open(filepath, "w", encoding="utf-8")
         fw = file.write
 
@@ -775,7 +1120,7 @@ def pyrna2sphinx(BASEPATH):
         else:
             title = struct_id
 
-        write_title(fw, title, "=")
+        fw(title_string(title, "="))
 
         fw(".. module:: bpy.types\n\n")
 
@@ -982,11 +1327,11 @@ def pyrna2sphinx(BASEPATH):
             write_struct(struct)
 
         def fake_bpy_type(class_value, class_name, descr_str, use_subclasses=True):
-            filepath = os.path.join(BASEPATH, "bpy.types.%s.rst" % class_name)
+            filepath = os.path.join(basepath, "bpy.types.%s.rst" % class_name)
             file = open(filepath, "w", encoding="utf-8")
             fw = file.write
 
-            write_title(fw, class_name, "=")
+            fw(title_string(class_name, "="))
 
             fw(".. module:: bpy.types\n")
             fw("\n")
@@ -1033,13 +1378,13 @@ def pyrna2sphinx(BASEPATH):
         del op
 
         for op_module_name, ops_mod in op_modules.items():
-            filepath = os.path.join(BASEPATH, "bpy.ops.%s.rst" % op_module_name)
+            filepath = os.path.join(basepath, "bpy.ops.%s.rst" % op_module_name)
             file = open(filepath, "w", encoding="utf-8")
             fw = file.write
 
             title = "%s Operators" % op_module_name.replace("_", " ").title()
 
-            write_title(fw, title, "=")
+            fw(title_string(title, "="))
 
             fw(".. module:: bpy.ops.%s\n\n" % op_module_name)
 
@@ -1071,7 +1416,10 @@ def pyrna2sphinx(BASEPATH):
                     else:
                         url_base = API_BASEURL
 
-                    fw("   :file: `%s <%s/%s>`_:%d\n\n" % (location[0], url_base, location[0], location[1]))
+                    fw("   :file: `%s <%s/%s>`_:%d\n\n" % (location[0],
+                                                           url_base,
+                                                           location[0],
+                                                           location[1]))
 
             file.close()
 
@@ -1079,139 +1427,109 @@ def pyrna2sphinx(BASEPATH):
         write_ops()
 
 
-def rna2sphinx(BASEPATH):
-
-    try:
-        os.mkdir(BASEPATH)
-    except:
-        pass
-
-    # conf.py - empty for now
-    filepath = os.path.join(BASEPATH, "conf.py")
+def write_sphinx_conf_py(basepath):
+    '''
+    Write sphinx's conf.py
+    '''
+    filepath = os.path.join(basepath, "conf.py")
     file = open(filepath, "w", encoding="utf-8")
     fw = file.write
 
-    version_string = ".".join(str(v) for v in bpy.app.version)
-    if bpy.app.build_revision != "Unknown":
-        version_string = version_string + " r" + bpy.app.build_revision
-
-    version_string_fp = "_".join(str(v) for v in bpy.app.version)
-
-    if bpy.app.version_cycle == "release":
-        version_string_pdf = "%s%s_release" % ("_".join(str(v) for v in bpy.app.version[:2]), bpy.app.version_char)
-    else:
-        version_string_pdf = version_string_fp
-
     fw("project = 'Blender'\n")
     # fw("master_doc = 'index'\n")
     fw("copyright = u'Blender Foundation'\n")
-    fw("version = '%s - API'\n" % version_string)
-    fw("release = '%s - API'\n" % version_string)
+    fw("version = '%s - API'\n" % BLENDER_VERSION_DOTS)
+    fw("release = '%s - API'\n" % BLENDER_VERSION_DOTS)
 
-    # until we get a theme for 'Naiad'
-    if 0:
-        fw("html_theme = 'blender-org'\n")
-        fw("html_theme_path = ['../']\n")
+    if ARGS.sphinx_theme != 'default':
+        fw("html_theme = '%s'\n" % ARGS.sphinx_theme)
 
+    if ARGS.sphinx_theme in SPHINX_THEMES['bf']:
+        fw("html_theme_path = ['../']\n")
         # copied with the theme, exclude else we get an error [#28873]
-        fw("html_favicon = 'favicon.ico'\n")
+        fw("html_favicon = 'favicon.ico'\n")    # in <theme>/static/
 
-    # not helpful since the source us generated, adds to upload size.
+    # not helpful since the source is generated, adds to upload size.
     fw("html_copy_source = False\n")
     fw("\n")
+
     # needed for latex, pdf gen
     fw("latex_documents = [ ('contents', 'contents.tex', 'Blender Index', 'Blender Foundation', 'manual'), ]\n")
     fw("latex_paper_size = 'a4paper'\n")
     file.close()
 
-    # main page needed for sphinx (index.html)
-    filepath = os.path.join(BASEPATH, "contents.rst")
+
+def write_rst_contents(basepath):
+    '''
+    Write the rst file of the main page, needed for sphinx (index.html)
+    '''
+    filepath = os.path.join(basepath, "contents.rst")
     file = open(filepath, "w", encoding="utf-8")
     fw = file.write
 
-    fw("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n")
-    fw(" Blender Documentation contents\n")
-    fw("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n")
+    fw(title_string("Blender Documentation Contents", "%", double=True))
     fw("\n")
-    fw("Welcome, this document is an API reference for Blender %s. built %s.\n" % (version_string, bpy.app.build_date))
+    fw("Welcome, this document is an API reference for Blender %s, built %s.\n" % (BLENDER_VERSION_DOTS, BLENDER_DATE))
     fw("\n")
 
-    # fw("`A PDF version of this document is also available <blender_python_reference_%s.pdf>`_\n" % version_string_pdf)
-    fw("`A compressed ZIP file of this site is available <blender_python_reference_%s.zip>`_\n" % version_string_pdf)
+    # fw("`A PDF version of this document is also available <%s>`_\n" % BLENDER_PDF_FILENAME)
+    fw("`A compressed ZIP file of this site is available <%s>`_\n" % BLENDER_ZIP_FILENAME)
 
     fw("\n")
 
     if not EXCLUDE_INFO_DOCS:
-        fw("============================\n")
-        fw("Blender/Python Documentation\n")
-        fw("============================\n")
-        fw("\n")
-        fw("\n")
+        fw(title_string("Blender/Python Documentation", "=", double=True))
+
         fw(".. toctree::\n")
         fw("   :maxdepth: 1\n\n")
         for info, info_desc in INFO_DOCS:
             fw("   %s <%s>\n\n" % (info_desc, info))
         fw("\n")
 
-    fw("===================\n")
-    fw("Application Modules\n")
-    fw("===================\n")
-    fw("\n")
+    fw(title_string("Application Modules", "=", double=True))
     fw(".. toctree::\n")
     fw("   :maxdepth: 1\n\n")
-    if "bpy.context" not in EXCLUDE_MODULES:
-        fw("   bpy.context.rst\n\n")  # note: not actually a module
-    if "bpy.data" not in EXCLUDE_MODULES:
-        fw("   bpy.data.rst\n\n")  # note: not actually a module
-    if "bpy.ops" not in EXCLUDE_MODULES:
-        fw("   bpy.ops.rst\n\n")
-    if "bpy.types" not in EXCLUDE_MODULES:
-        fw("   bpy.types.rst\n\n")
-
-    # py modules
-    if "bpy.utils" not in EXCLUDE_MODULES:
-        fw("   bpy.utils.rst\n\n")
-    if "bpy.path" not in EXCLUDE_MODULES:
-        fw("   bpy.path.rst\n\n")
-    if "bpy.app" not in EXCLUDE_MODULES:
-        fw("   bpy.app.rst\n\n")
-    if "bpy.app.handlers" not in EXCLUDE_MODULES:
-        fw("   bpy.app.handlers.rst\n\n")
-
-    # C modules
-    if "bpy.props" not in EXCLUDE_MODULES:
-        fw("   bpy.props.rst\n\n")
-
-    fw("==================\n")
-    fw("Standalone Modules\n")
-    fw("==================\n")
-    fw("\n")
+
+    app_modules = (
+        "bpy.context",  # note: not actually a module
+        "bpy.data",     # note: not actually a module
+        "bpy.ops",
+        "bpy.types",
+
+        # py modules
+        "bpy.utils",
+        "bpy.path",
+        "bpy.app",
+        "bpy.app.handlers",
+
+        # C modules
+        "bpy.props",
+        )
+
+    for mod in app_modules:
+        if mod not in EXCLUDE_MODULES:
+            fw("   %s\n\n" % mod)
+
+    fw(title_string("Standalone Modules", "=", double=True))
     fw(".. toctree::\n")
     fw("   :maxdepth: 1\n\n")
 
-    if "mathutils" not in EXCLUDE_MODULES:
-        fw("   mathutils.rst\n\n")
-    if "mathutils.geometry" not in EXCLUDE_MODULES:
-        fw("   mathutils.geometry.rst\n\n")
-    if "mathutils.noise" not in EXCLUDE_MODULES:
-        fw("   mathutils.noise.rst\n\n")
-    if "bgl" not in EXCLUDE_MODULES:
-        fw("   bgl.rst\n\n")
-    if "blf" not in EXCLUDE_MODULES:
-        fw("   blf.rst\n\n")
-    if "gpu" not in EXCLUDE_MODULES:
-        fw("   gpu.rst\n\n")
-    if "aud" not in EXCLUDE_MODULES:
-        fw("   aud.rst\n\n")
-    if "bpy_extras" not in EXCLUDE_MODULES:
-        fw("   bpy_extras.rst\n\n")
+    standalone_modules = (
+        # mathutils
+        "mathutils", "mathutils.geometry", "mathutils.noise",
+        # misc
+        "bgl", "blf", "gpu", "aud", "bpy_extras",
+        # bmesh
+        "bmesh", "bmesh.types", "bmesh.utils",
+        )
+
+    for mod in standalone_modules:
+        if mod not in EXCLUDE_MODULES:
+            fw("   %s\n\n" % mod)
 
     # game engine
     if "bge" not in EXCLUDE_MODULES:
-        fw("===================\n")
-        fw("Game Engine Modules\n")
-        fw("===================\n")
-        fw("\n")
+        fw(title_string("Game Engine Modules", "=", double=True))
         fw(".. toctree::\n")
         fw("   :maxdepth: 1\n\n")
         fw("   bge.types.rst\n\n")
@@ -1222,10 +1540,7 @@ def rna2sphinx(BASEPATH):
         fw("   bge.constraints.rst\n\n")
 
     # rna generated change log
-    fw("========\n")
-    fw("API Info\n")
-    fw("========\n")
-    fw("\n")
+    fw(title_string("API Info", "=", double=True))
     fw(".. toctree::\n")
     fw("   :maxdepth: 1\n\n")
     fw("   change_log.rst\n\n")
@@ -1247,38 +1562,68 @@ def rna2sphinx(BASEPATH):
 
     file.close()
 
-    # internal modules
-    if "bpy.ops" not in EXCLUDE_MODULES:
-        filepath = os.path.join(BASEPATH, "bpy.ops.rst")
+
+def write_rst_bpy(basepath):
+    '''
+    Write rst file of bpy module (disabled by default)
+    '''
+    if ARGS.bpy:
+        filepath = os.path.join(basepath, "bpy.rst")
         file = open(filepath, "w", encoding="utf-8")
         fw = file.write
-        fw("Operators (bpy.ops)\n")
-        fw("===================\n\n")
-        write_example_ref("", fw, "bpy.ops")
-        fw(".. toctree::\n")
-        fw("   :glob:\n\n")
-        fw("   bpy.ops.*\n\n")
+
+        fw("\n")
+
+        title = ":mod:`bpy` --- Blender Python Module"
+
+        fw(title_string(title, "="))
+
+        fw(".. module:: bpy.types\n\n")
         file.close()
 
+
+def write_rst_types_index(basepath):
+    '''
+    Write the rst file of bpy.types module (index)
+    '''
     if "bpy.types" not in EXCLUDE_MODULES:
-        filepath = os.path.join(BASEPATH, "bpy.types.rst")
+        filepath = os.path.join(basepath, "bpy.types.rst")
         file = open(filepath, "w", encoding="utf-8")
         fw = file.write
-        fw("Types (bpy.types)\n")
-        fw("=================\n\n")
+        fw(title_string("Types (bpy.types)", "="))
         fw(".. toctree::\n")
         fw("   :glob:\n\n")
         fw("   bpy.types.*\n\n")
         file.close()
 
+
+def write_rst_ops_index(basepath):
+    '''
+    Write the rst file of bpy.ops module (index)
+    '''
+    if "bpy.ops" not in EXCLUDE_MODULES:
+        filepath = os.path.join(basepath, "bpy.ops.rst")
+        file = open(filepath, "w", encoding="utf-8")
+        fw = file.write
+        fw(title_string("Operators (bpy.ops)", "="))
+        write_example_ref("", fw, "bpy.ops")
+        fw(".. toctree::\n")
+        fw("   :glob:\n\n")
+        fw("   bpy.ops.*\n\n")
+        file.close()
+
+
+def write_rst_data(basepath):
+    '''
+    Write the rst file of bpy.data module
+    '''
     if "bpy.data" not in EXCLUDE_MODULES:
         # not actually a module, only write this file so we
         # can reference in the TOC
-        filepath = os.path.join(BASEPATH, "bpy.data.rst")
+        filepath = os.path.join(basepath, "bpy.data.rst")
         file = open(filepath, "w", encoding="utf-8")
         fw = file.write
-        fw("Data Access (bpy.data)\n")
-        fw("======================\n\n")
+        fw(title_string("Data Access (bpy.data)", "="))
         fw(".. module:: bpy\n")
         fw("\n")
         fw("This module is used for all blender/python access.\n")
@@ -1292,177 +1637,266 @@ def rna2sphinx(BASEPATH):
         fw(".. literalinclude:: ../examples/bpy.data.py\n")
         file.close()
 
-    EXAMPLE_SET_USED.add("bpy.data")
+        EXAMPLE_SET_USED.add("bpy.data")
 
-    module = None
 
-    if "bpy.context" not in EXCLUDE_MODULES:
-        # one of a kind, context doc (uses ctypes to extract info!)
-        pycontext2sphinx(BASEPATH)
-
-    # python modules
-    if "bpy.utils" not in EXCLUDE_MODULES:
-        from bpy import utils as module
-        pymodule2sphinx(BASEPATH, "bpy.utils", module, "Utilities")
-
-    if "bpy.path" not in EXCLUDE_MODULES:
-        from bpy import path as module
-        pymodule2sphinx(BASEPATH, "bpy.path", module, "Path Utilities")
-
-    if "bpy_extras" not in EXCLUDE_MODULES:
-        import bpy_extras as module
-        pymodule2sphinx(BASEPATH, "bpy_extras", module, "Extra Utilities")
-
-    # C modules
-    if "bpy.app" not in EXCLUDE_MODULES:
-        from bpy import app as module
-        pymodule2sphinx(BASEPATH, "bpy.app", module, "Application Data")
-
-    if "bpy.app.handlers" not in EXCLUDE_MODULES:
-        from bpy.app import handlers as module
-        pymodule2sphinx(BASEPATH, "bpy.app.handlers", module, "Application Handlers")
-
-    if "bpy.props" not in EXCLUDE_MODULES:
-        from bpy import props as module
-        pymodule2sphinx(BASEPATH, "bpy.props", module, "Property Definitions")
-
-    if "mathutils" not in EXCLUDE_MODULES:
-        import mathutils as module
-        pymodule2sphinx(BASEPATH, "mathutils", module, "Math Types & Utilities")
-
-    if "mathutils.geometry" not in EXCLUDE_MODULES:
-        import mathutils.geometry as module
-        pymodule2sphinx(BASEPATH, "mathutils.geometry", module, "Geometry Utilities")
-
-    if "mathutils.noise" not in EXCLUDE_MODULES:
-        import mathutils.noise as module
-        pymodule2sphinx(BASEPATH, "mathutils.noise", module, "Noise Utilities")
-
-    if "blf" not in EXCLUDE_MODULES:
-        import blf as module
-        pymodule2sphinx(BASEPATH, "blf", module, "Font Drawing")
-
-    if "bgl" not in EXCLUDE_MODULES:
-        #import bgl as module
-        #pymodule2sphinx(BASEPATH, "bgl", module, "Blender OpenGl wrapper")
-        #del module
-        import shutil
-        shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bgl.rst"), BASEPATH)
-
-    if "gpu" not in EXCLUDE_MODULES:
-        #import gpu as module
-        #pymodule2sphinx(BASEPATH, "gpu", module, "GPU Shader Module")
-        #del module
-        import shutil
-        shutil.copy2(os.path.join(BASEPATH, "..", "rst", "gpu.rst"), BASEPATH)
-
-    if "aud" not in EXCLUDE_MODULES:
-        import aud as module
-        pymodule2sphinx(BASEPATH, "aud", module, "Audio System")
-    del module
-
-    ## game engine
-    import shutil
-    # copy2 keeps time/date stamps
-    if "bge" not in EXCLUDE_MODULES:
-        shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.types.rst"), BASEPATH)
-        shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.logic.rst"), BASEPATH)
-        shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.render.rst"), BASEPATH)
-        shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.texture.rst"), BASEPATH)
-        shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.events.rst"), BASEPATH)
-        shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.constraints.rst"), BASEPATH)
+def write_rst_importable_modules(basepath):
+    '''
+    Write the rst files of importable modules
+    '''
+    importable_modules = {
+        # python_modules
+        "bpy.path"          : "Path Utilities",
+        "bpy.utils"         : "Utilities",
+        "bpy_extras"        : "Extra Utilities",
+
+        # C_modules
+        "aud"               : "Audio System",
+        "blf"               : "Font Drawing",
+        "bmesh"             : "BMesh Module",
+        "bmesh.types"       : "BMesh Types",
+        "bmesh.utils"       : "BMesh Utilities",
+        "bpy.app"           : "Application Data",
+        "bpy.app.handlers"  : "Application Handlers",
+        "bpy.props"         : "Property Definitions",
+        "mathutils"         : "Math Types & Utilities",
+        "mathutils.geometry": "Geometry Utilities",
+        "mathutils.noise"   : "Noise Utilities",
+    }
+    for mod_name, mod_descr in importable_modules.items():
+        if mod_name not in EXCLUDE_MODULES:
+            module = __import__(mod_name,
+                                fromlist=[mod_name.rsplit(".", 1)[-1]])
+            pymodule2sphinx(basepath, mod_name, module, mod_descr)
+
 
-    shutil.copy2(os.path.join(BASEPATH, "..", "rst", "change_log.rst"), BASEPATH)
+def copy_handwritten_rsts(basepath):
 
+    # info docs
     if not EXCLUDE_INFO_DOCS:
         for info, info_desc in INFO_DOCS:
-            shutil.copy2(os.path.join(BASEPATH, "..", "rst", info), BASEPATH)
+            shutil.copy2(os.path.join(RST_DIR, info), basepath)
 
-    if 0:
-        filepath = os.path.join(BASEPATH, "bpy.rst")
-        file = open(filepath, "w", encoding="utf-8")
-        fw = file.write
+    # TODO put this docs in blender's code and use import as per modules above
+    handwritten_modules = [
+        "bge.types",
+        "bge.logic",
+        "bge.render",
+        "bge.texture",
+        "bge.events",
+        "bge.constraints",
+        "bgl",  # "Blender OpenGl wrapper"
+        "gpu",  # "GPU Shader Module"
 
-        fw("\n")
+        # includes...
+        "include__bmesh",
+    ]
+    for mod_name in handwritten_modules:
+        if mod_name not in EXCLUDE_MODULES:
+            # copy2 keeps time/date stamps
+            shutil.copy2(os.path.join(RST_DIR, "%s.rst" % mod_name), basepath)
 
-        title = ":mod:`bpy` --- Blender Python Module"
+    # changelog
+    shutil.copy2(os.path.join(RST_DIR, "change_log.rst"), basepath)
 
-        write_title(fw, title, "=")
 
-        fw(".. module:: bpy.types\n\n")
-        file.close()
+def rna2sphinx(basepath):
 
-    # bpy.types and bpy.ops
-    pyrna2sphinx(BASEPATH)
+    try:
+        os.mkdir(basepath)
+    except:
+        pass
 
-    file.close()
+    # sphinx setup
+    write_sphinx_conf_py(basepath)
 
+    # main page
+    write_rst_contents(basepath)
 
-def main():
-    import shutil
-
-    script_dir = os.path.dirname(__file__)
-    path_in = os.path.join(script_dir, "sphinx-in")
-    path_out = os.path.join(script_dir, "sphinx-out")
-    path_examples = os.path.join(script_dir, "examples")
-    # only for partial updates
-    path_in_tmp = path_in + "-tmp"
-
-    if not os.path.exists(path_in):
-        os.mkdir(path_in)
-
-    for f in os.listdir(path_examples):
-        if f.endswith(".py"):
-            EXAMPLE_SET.add(os.path.splitext(f)[0])
-
-    # only for full updates
-    if _BPY_FULL_REBUILD:
-        shutil.rmtree(path_in, True)
-        shutil.rmtree(path_out, True)
-    else:
-        # write here, then move
-        shutil.rmtree(path_in_tmp, True)
+    # context
+    if "bpy.context" not in EXCLUDE_MODULES:
+        # one of a kind, context doc (uses ctypes to extract info!)
+        # doesn't work on mac
+        if PLATFORM != "darwin":
+            pycontext2sphinx(basepath)
 
-    rna2sphinx(path_in_tmp)
+    # internal modules
+    write_rst_bpy(basepath)                 # bpy, disabled by default
+    write_rst_types_index(basepath)         # bpy.types
+    write_rst_ops_index(basepath)           # bpy.ops
+    pyrna2sphinx(basepath)                  # bpy.types.* and bpy.ops.*
+    write_rst_data(basepath)                # bpy.data
+    write_rst_importable_modules(basepath)
 
-    if not _BPY_FULL_REBUILD:
-        import filecmp
+    # copy the other rsts
+    copy_handwritten_rsts(basepath)
 
-        # now move changed files from 'path_in_tmp' --> 'path_in'
-        file_list_path_in = set(os.listdir(path_in))
-        file_list_path_in_tmp = set(os.listdir(path_in_tmp))
 
-        # remove deprecated files that have been removed.
-        for f in sorted(file_list_path_in):
-            if f not in file_list_path_in_tmp:
-                print("\tdeprecated: %s" % f)
-                os.remove(os.path.join(path_in, f))
+def align_sphinx_in_to_sphinx_in_tmp():
+    '''
+    Move changed files from SPHINX_IN_TMP to SPHINX_IN
+    '''
+    import filecmp
+
+    sphinx_in_files = set(os.listdir(SPHINX_IN))
+    sphinx_in_tmp_files = set(os.listdir(SPHINX_IN_TMP))
+
+    # remove deprecated files that have been removed
+    for f in sorted(sphinx_in_files):
+        if f not in sphinx_in_tmp_files:
+            BPY_LOGGER.debug("\tdeprecated: %s" % f)
+            os.remove(os.path.join(SPHINX_IN, f))
+
+    # freshen with new files.
+    for f in sorted(sphinx_in_tmp_files):
+        f_from = os.path.join(SPHINX_IN_TMP, f)
+        f_to = os.path.join(SPHINX_IN, f)
+
+        do_copy = True
+        if f in sphinx_in_files:
+            if filecmp.cmp(f_from, f_to):
+                do_copy = False
+
+        if do_copy:
+            BPY_LOGGER.debug("\tupdating: %s" % f)
+            shutil.copy(f_from, f_to)
+
+
+def refactor_sphinx_log(sphinx_logfile):
+    refactored_log = []
+    with open(sphinx_logfile, "r", encoding="utf-8") as original_logfile:
+        lines = set(original_logfile.readlines())
+        for line in lines:
+            if 'warning' in line.lower() or 'error' in line.lower():
+                line = line.strip().split(None, 2)
+                if len(line) == 3:
+                    location, kind, msg = line
+                    location = os.path.relpath(location, start=SPHINX_IN)
+                    refactored_log.append((kind, location, msg))
+    with open(sphinx_logfile, "w", encoding="utf-8") as refactored_logfile:
+        for log in sorted(refactored_log):
+            refactored_logfile.write("%-12s %s\n             %s\n" % log)
 
-        # freshen with new files.
-        for f in sorted(file_list_path_in_tmp):
-            f_from = os.path.join(path_in_tmp, f)
-            f_to = os.path.join(path_in, f)
 
-            do_copy = True
-            if f in file_list_path_in:
-                if filecmp.cmp(f_from, f_to):
-                    do_copy = False
+def main():
 
-            if do_copy:
-                print("\tupdating: %s" % f)
-                shutil.copy(f_from, f_to)
-            '''else:
-                print("\tkeeping: %s" % f) # eh, not that useful'''
+    # eventually, create the dirs
+    for dir_path in [ARGS.output_dir, SPHINX_IN]:
+        if not os.path.exists(dir_path):
+            os.mkdir(dir_path)
+
+    # eventually, log in files
+    if ARGS.log:
+        bpy_logfile = os.path.join(ARGS.output_dir, ".bpy.log")
+        bpy_logfilehandler = logging.FileHandler(bpy_logfile, mode="w")
+        bpy_logfilehandler.setLevel(logging.DEBUG)
+        BPY_LOGGER.addHandler(bpy_logfilehandler)
+
+        # using a FileHandler seems to disable the stdout, so we add a StreamHandler
+        bpy_log_stdout_handler = logging.StreamHandler(stream=sys.stdout)
+        bpy_log_stdout_handler.setLevel(logging.DEBUG)
+        BPY_LOGGER.addHandler(bpy_log_stdout_handler)
+
+    # in case of out-of-source build, copy the needed dirs
+    if ARGS.output_dir != SCRIPT_DIR:
+        # examples dir
+        examples_dir_copy = os.path.join(ARGS.output_dir, "examples")
+        if os.path.exists(examples_dir_copy):
+            shutil.rmtree(examples_dir_copy, True)
+        shutil.copytree(EXAMPLES_DIR,
+                        examples_dir_copy,
+                        ignore=shutil.ignore_patterns(*(".svn",)),
+                        copy_function=shutil.copy)
+
+        # eventually, copy the theme dir
+        if ARGS.sphinx_theme in SPHINX_THEMES['bf']:
+            if os.path.exists(SPHINX_THEME_DIR):
+                shutil.rmtree(SPHINX_THEME_DIR, True)
+            shutil.copytree(SPHINX_THEME_SVN_DIR,
+                            SPHINX_THEME_DIR,
+                            ignore=shutil.ignore_patterns(*(".svn",)),
+                            copy_function=shutil.copy)
+
+    # dump the api in rst files
+    if os.path.exists(SPHINX_IN_TMP):
+        shutil.rmtree(SPHINX_IN_TMP, True)
+
+    rna2sphinx(SPHINX_IN_TMP)
+
+    if ARGS.full_rebuild:
+        # only for full updates
+        shutil.rmtree(SPHINX_IN, True)
+        shutil.copytree(SPHINX_IN_TMP,
+                        SPHINX_IN,
+                        copy_function=shutil.copy)
+        if ARGS.sphinx_build and os.path.exists(SPHINX_OUT):
+            shutil.rmtree(SPHINX_OUT, True)
+        if ARGS.sphinx_build_pdf and os.path.exists(SPHINX_OUT_PDF):
+            shutil.rmtree(SPHINX_OUT_PDF, True)
+    else:
+        # move changed files in SPHINX_IN
+        align_sphinx_in_to_sphinx_in_tmp()
 
+    # report which example files weren't used
     EXAMPLE_SET_UNUSED = EXAMPLE_SET - EXAMPLE_SET_USED
     if EXAMPLE_SET_UNUSED:
-        print("\nUnused examples found in '%s'..." % path_examples)
-        for f in EXAMPLE_SET_UNUSED:
-            print("    %s.py" % f)
-        print("  %d total\n" % len(EXAMPLE_SET_UNUSED))
+        BPY_LOGGER.debug("\nUnused examples found in '%s'..." % EXAMPLES_DIR)
+        for f in sorted(EXAMPLE_SET_UNUSED):
+            BPY_LOGGER.debug("    %s.py" % f)
+        BPY_LOGGER.debug("  %d total\n" % len(EXAMPLE_SET_UNUSED))
+
+    # eventually, build the html docs
+    if ARGS.sphinx_build:
+        import subprocess
+        subprocess.call(SPHINX_BUILD)
+
+        # sphinx-build log cleanup+sort
+        if ARGS.log:
+            if os.stat(SPHINX_BUILD_LOG).st_size:
+                refactor_sphinx_log(SPHINX_BUILD_LOG)
+
+    # eventually, build the pdf docs
+    if ARGS.sphinx_build_pdf:
+        import subprocess
+        subprocess.call(SPHINX_BUILD_PDF)
+        subprocess.call(SPHINX_MAKE_PDF, stdout=SPHINX_MAKE_PDF_STDOUT)
+
+        # sphinx-build log cleanup+sort
+        if ARGS.log:
+            if os.stat(SPHINX_BUILD_PDF_LOG).st_size:
+                refactor_sphinx_log(SPHINX_BUILD_PDF_LOG)
+
+    # eventually, prepare the dir to be deployed online (REFERENCE_PATH)
+    if ARGS.pack_reference:
+
+        if ARGS.sphinx_build:
+            # delete REFERENCE_PATH
+            if os.path.exists(REFERENCE_PATH):
+                shutil.rmtree(REFERENCE_PATH, True)
+
+            # copy SPHINX_OUT to the REFERENCE_PATH
+            ignores = ('.doctrees', 'objects.inv', '.buildinfo')
+            shutil.copytree(SPHINX_OUT,
+                            REFERENCE_PATH,
+                            ignore=shutil.ignore_patterns(*ignores))
+            shutil.copy(os.path.join(REFERENCE_PATH, "contents.html"),
+                        os.path.join(REFERENCE_PATH, "index.html"))
+
+            # zip REFERENCE_PATH
+            basename = os.path.join(ARGS.output_dir, REFERENCE_NAME)
+            tmp_path = shutil.make_archive(basename, 'zip',
+                                           root_dir=ARGS.output_dir,
+                                           base_dir=REFERENCE_NAME)
+            final_path = os.path.join(REFERENCE_PATH, BLENDER_ZIP_FILENAME)
+            os.rename(tmp_path, final_path)
+
+        if ARGS.sphinx_build_pdf:
+            # copy the pdf to REFERENCE_PATH
+            shutil.copy(os.path.join(SPHINX_OUT_PDF, "contents.pdf"),
+                        os.path.join(REFERENCE_PATH, BLENDER_PDF_FILENAME))
 
-    import sys
     sys.exit()
 
+
 if __name__ == '__main__':
     main()
diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt
index 8442e5d..1d83410 100644
--- a/extern/CMakeLists.txt
+++ b/extern/CMakeLists.txt
@@ -71,3 +71,9 @@ endif()
 if(WITH_CARVE)
 	add_subdirectory(carve)
 endif()
+
+if(WITH_GHOST_XDND)
+	if(UNIX AND NOT APPLE)
+		add_subdirectory(xdnd)
+	endif()
+endif()
diff --git a/extern/SConscript b/extern/SConscript
index 738342b..67b74e9 100644
--- a/extern/SConscript
+++ b/extern/SConscript
@@ -34,3 +34,8 @@ if env['WITH_BF_LIBMV']:
 
 if env['WITH_BF_CARVE']:
     SConscript(['carve/SConscript'])
+
+if env['WITH_GHOST_XDND']:
+    # FreeBSD doesn't seems to support XDND protocol
+    if env['OURPLATFORM'] in ('linux', 'openbsd3', 'sunos5', 'aix4', 'aix5'):
+        SConscript(['xdnd/SConscript'])
diff --git a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h
index aa30d43..51b27af 100644
--- a/extern/bullet2/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h
+++ b/extern/bullet2/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h
@@ -78,8 +78,10 @@ ATTRIBUTE_ALIGNED16	(struct) btQuantizedBvhNode
 	int	getTriangleIndex() const
 	{
 		btAssert(isLeafNode());
+		unsigned int x=0;
+		unsigned int y = (~(x&0))<<(31-MAX_NUM_PARTS_IN_BITS);
 		// Get only the lower bits where the triangle index is stored
-		return (m_escapeIndexOrTriangleIndex&~((~0)<<(31-MAX_NUM_PARTS_IN_BITS)));
+		return (m_escapeIndexOrTriangleIndex&~(y));
 	}
 	int	getPartId() const
 	{
diff --git a/extern/bullet2/src/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.h b/extern/bullet2/src/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.h
index a6ea337..f311419 100644
--- a/extern/bullet2/src/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.h
+++ b/extern/bullet2/src/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.h
@@ -45,7 +45,9 @@ struct btTriIndex
 	int	getTriangleIndex() const
 	{
 		// Get only the lower bits where the triangle index is stored
-		return (m_PartIdTriangleIndex&~((~0)<<(31-MAX_NUM_PARTS_IN_BITS)));
+		unsigned int x = 0;
+		unsigned int y = (~(x&0))<<(31-MAX_NUM_PARTS_IN_BITS);
+		return (m_PartIdTriangleIndex&~(y));
 	}
 	int	getPartId() const
 	{
diff --git a/extern/bullet2/src/SConscript b/extern/bullet2/src/SConscript
index fa00ad7..f59bcba 100644
--- a/extern/bullet2/src/SConscript
+++ b/extern/bullet2/src/SConscript
@@ -11,7 +11,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
     defs += ' WIN32 NDEBUG _WINDOWS'
     #cflags += ['/MT', '/W3', '/GX', '/O2', '/Op']
     cflags += ['/MT', '/W3', '/GX', '/Og', '/Ot', '/Ob1', '/Op', '/G6', '/O3', '/EHcs']
-elif env['OURPLATFORM'] in ('win32-mingw', 'linuxcross'):
+elif env['OURPLATFORM'] in ('win32-mingw', 'linuxcross', 'win64-mingw'):
     defs += ' NDEBUG'
     cflags += ['-O2']
 elif env['OURPLATFORM'] in ('linux', 'freebsd4', 'freebsd5'):
diff --git a/extern/carve/CMakeLists.txt b/extern/carve/CMakeLists.txt
index cbf92ee..6605389 100644
--- a/extern/carve/CMakeLists.txt
+++ b/extern/carve/CMakeLists.txt
@@ -35,115 +35,115 @@ set(INC_SYS
 )
 
 set(SRC
-	lib/carve.cpp
-	lib/mesh.cpp
-	lib/intersect_group.cpp
-	lib/intersect_classify_edge.cpp
-	lib/intersect_classify_group.cpp
+	lib/intersection.cpp
+	lib/intersect.cpp
+	lib/triangulator.cpp
+	lib/convex_hull.cpp
 	lib/polyhedron.cpp
-	lib/geom3d.cpp
 	lib/polyline.cpp
-	lib/csg_collector.cpp
-	lib/triangulator.cpp
-	lib/intersect_face_division.cpp
-	lib/intersect_half_classify_group.cpp
-	lib/edge.cpp
-	lib/math.cpp
+	lib/pointset.cpp
 	lib/geom2d.cpp
+	lib/math.cpp
+	lib/intersect_half_classify_group.cpp
+	lib/intersect_face_division.cpp
 	lib/tag.cpp
-	lib/intersection.cpp
-	lib/convex_hull.cpp
+	lib/aabb.cpp
+	lib/intersect_classify_group.cpp
+	lib/mesh.cpp
+	lib/timing.cpp
+	lib/geom3d.cpp
+	lib/intersect_group.cpp
+	lib/carve.cpp
+	lib/intersect_classify_edge.cpp
 	lib/csg.cpp
-	lib/intersect.cpp
 	lib/face.cpp
-	lib/pointset.cpp
-	lib/timing.cpp
-	lib/octree.cpp
-	lib/aabb.cpp
+	lib/csg_collector.cpp
 	lib/intersect_debug.cpp
+	lib/edge.cpp
+	lib/octree.cpp
 
-	lib/intersect_classify_common.hpp
-	lib/csg_data.hpp
+	lib/intersect_debug.hpp
 	lib/csg_collector.hpp
+	lib/csg_data.hpp
+	lib/intersect_classify_common.hpp
 	lib/intersect_common.hpp
-	lib/intersect_classify_common_impl.hpp
 	lib/csg_detail.hpp
-	lib/intersect_debug.hpp
+	lib/intersect_classify_common_impl.hpp
 
-	include/carve/polyhedron_decl.hpp
-	include/carve/geom2d.hpp
-	include/carve/exact.hpp
-	include/carve/triangulator_impl.hpp
-	include/carve/collection.hpp
-	include/carve/pointset.hpp
-	include/carve/djset.hpp
-	include/carve/kd_node.hpp
-	include/carve/polyline.hpp
-	include/carve/polyline_iter.hpp
-	include/carve/geom3d.hpp
-	include/carve/edge_decl.hpp
-	include/carve/face_decl.hpp
+	include/carve/vertex_impl.hpp
 	include/carve/aabb_impl.hpp
-	include/carve/colour.hpp
+	include/carve/csg.hpp
 	include/carve/pointset_iter.hpp
-	include/carve/polyline_decl.hpp
-	include/carve/rescale.hpp
-	include/carve/mesh_impl.hpp
-	include/carve/classification.hpp
-	include/carve/util.hpp
-	include/carve/triangulator.hpp
-	include/carve/polyhedron_base.hpp
-	include/carve/rtree.hpp
-	include/carve/math.hpp
-	include/carve/math_constants.hpp
-	include/carve/octree_decl.hpp
-	include/carve/input.hpp
-	include/carve/mesh_ops.hpp
 	include/carve/debug_hooks.hpp
-	include/carve/mesh_simplify.hpp
-	include/carve/interpolator.hpp
-	include/carve/poly_decl.hpp
-	include/carve/csg.hpp
 	include/carve/mesh.hpp
-	include/carve/carve.hpp
-	include/carve/gnu_cxx.h
-	include/carve/polyhedron_impl.hpp
-	include/carve/poly_impl.hpp
-	include/carve/aabb.hpp
+	include/carve/triangulator_impl.hpp
+	include/carve/edge_decl.hpp
+	include/carve/collection/unordered.hpp
+	include/carve/collection/unordered/tr1_impl.hpp
+	include/carve/collection/unordered/fallback_impl.hpp
+	include/carve/collection/unordered/std_impl.hpp
+	include/carve/collection/unordered/vcpp_impl.hpp
+	include/carve/collection/unordered/libstdcpp_impl.hpp
+	include/carve/collection/unordered/boost_impl.hpp
 	include/carve/convex_hull.hpp
-	include/carve/vertex_decl.hpp
+	include/carve/geom.hpp
+	include/carve/collection_types.hpp
+	include/carve/cbrt.h
+	include/carve/util.hpp
+	include/carve/iobj.hpp
+	include/carve/polyline_decl.hpp
+	include/carve/polyline_impl.hpp
 	include/carve/win32.h
 	include/carve/edge_impl.hpp
-	include/carve/tag.hpp
-	include/carve/tree.hpp
-	include/carve/heap.hpp
+	include/carve/carve.hpp
+	include/carve/polyline.hpp
+	include/carve/face_decl.hpp
 	include/carve/matrix.hpp
-	include/carve/poly.hpp
-	include/carve/vector.hpp
-	include/carve/intersection.hpp
-	include/carve/faceloop.hpp
+	include/carve/classification.hpp
 	include/carve/geom_impl.hpp
-	include/carve/octree_impl.hpp
-	include/carve/spacetree.hpp
-	include/carve/collection/unordered/std_impl.hpp
-	include/carve/collection/unordered/tr1_impl.hpp
-	include/carve/collection/unordered/libstdcpp_impl.hpp
-	include/carve/collection/unordered/boost_impl.hpp
-	include/carve/collection/unordered/vcpp_impl.hpp
-	include/carve/collection/unordered/fallback_impl.hpp
-	include/carve/collection/unordered.hpp
+	include/carve/faceloop.hpp
+	include/carve/mesh_ops.hpp
+	include/carve/tree.hpp
+	include/carve/geom2d.hpp
 	include/carve/face_impl.hpp
+	include/carve/polyhedron_decl.hpp
+	include/carve/interpolator.hpp
+	include/carve/poly_decl.hpp
+	include/carve/mesh_impl.hpp
+	include/carve/gnu_cxx.h
+	include/carve/mesh_simplify.hpp
+	include/carve/triangulator.hpp
 	include/carve/pointset_impl.hpp
-	include/carve/cbrt.h
+	include/carve/rtree.hpp
+	include/carve/math_constants.hpp
+	include/carve/vector.hpp
+	include/carve/octree_impl.hpp
+	include/carve/pointset.hpp
+	include/carve/math.hpp
+	include/carve/intersection.hpp
+	include/carve/colour.hpp
+	include/carve/kd_node.hpp
+	include/carve/input.hpp
+	include/carve/geom3d.hpp
+	include/carve/exact.hpp
+	include/carve/rescale.hpp
+	include/carve/polyhedron_base.hpp
+	include/carve/heap.hpp
+	include/carve/spacetree.hpp
+	include/carve/polyhedron_impl.hpp
 	include/carve/vcpp_config.h
-	include/carve/geom.hpp
-	include/carve/vertex_impl.hpp
-	include/carve/polyline_impl.hpp
-	include/carve/pointset_decl.hpp
-	include/carve/timing.hpp
+	include/carve/aabb.hpp
+	include/carve/polyline_iter.hpp
+	include/carve/djset.hpp
+	include/carve/vertex_decl.hpp
 	include/carve/csg_triangulator.hpp
-	include/carve/iobj.hpp
-	include/carve/collection_types.hpp
+	include/carve/poly.hpp
+	include/carve/timing.hpp
+	include/carve/octree_decl.hpp
+	include/carve/pointset_decl.hpp
+	include/carve/tag.hpp
+	include/carve/collection.hpp
+	include/carve/poly_impl.hpp
 )
 
 if(WITH_BOOST)
diff --git a/extern/carve/SConscript b/extern/carve/SConscript
index e2f3c81..1ba67e5 100644
--- a/extern/carve/SConscript
+++ b/extern/carve/SConscript
@@ -14,7 +14,7 @@ incs = ['include']
 if env['WITH_BF_BOOST']:
     if env['OURPLATFORM'] not in ('win32-vc', 'win64-vc'):
         # Boost is setting as preferred collections library in the Carve code when using MSVC compiler
-        if env['OURPLATFORM'] != 'win32-mingw':
+        if env['OURPLATFORM'] not in ('win32-mingw', 'win64-mingw'):
             defs.append('HAVE_BOOST_UNORDERED_COLLECTIONS')
 
     defs.append('CARVE_SYSTEM_BOOST')
diff --git a/extern/carve/bundle.sh b/extern/carve/bundle.sh
index bc719ae..881367f 100755
--- a/extern/carve/bundle.sh
+++ b/extern/carve/bundle.sh
@@ -47,7 +47,7 @@ cat > CMakeLists.txt << EOF
 #
 # You should have received a copy of the GNU 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.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2006, Blender Foundation
 # All rights reserved.
@@ -114,7 +114,7 @@ incs = ['include']
 if env['WITH_BF_BOOST']:
     if env['OURPLATFORM'] not in ('win32-vc', 'win64-vc'):
         # Boost is setting as preferred collections library in the Carve code when using MSVC compiler
-        if env['OURPLATFORM'] != 'win32-mingw':
+        if env['OURPLATFORM'] not in ('win32-mingw', 'win64-mingw'):
             defs.append('HAVE_BOOST_UNORDERED_COLLECTIONS')
 
     defs.append('CARVE_SYSTEM_BOOST')
diff --git a/extern/carve/include/carve/exact.hpp b/extern/carve/include/carve/exact.hpp
index afb4912..0d674e6 100644
--- a/extern/carve/include/carve/exact.hpp
+++ b/extern/carve/include/carve/exact.hpp
@@ -639,9 +639,11 @@ namespace carve {
     }
 
 
-    // XXX: not implemented yet
-    //exact_t operator+(const exact_t &a, const exact_t &b) {
-    //}
+    exact_t operator+(const exact_t &a, const exact_t &b) {
+      exact_t r;
+      sum_zeroelim(a, b, r);
+      return r;
+    }
 
 
 
diff --git a/extern/carve/include/carve/kd_node.hpp b/extern/carve/include/carve/kd_node.hpp
index f62584d..45e0ac8 100644
--- a/extern/carve/include/carve/kd_node.hpp
+++ b/extern/carve/include/carve/kd_node.hpp
@@ -230,7 +230,7 @@ namespace carve {
       }
 
       // distance_t must provide:
-      // double operator()(kd_node::data_t, vector<ndim>);
+      // double operator()(data_t, vector<ndim>);
       // double operator()(axis_pos, vector<ndim>);
       template<typename distance_t>
       struct near_point_query {
@@ -238,7 +238,7 @@ namespace carve {
         // q_t - the priority queue value type.
         // q_t.first:  distance from object to query point.
         // q_t.second: pointer to object
-        typedef std::pair<double, const typename kd_node::data_t *> q_t;
+        typedef std::pair<double, const data_t *> q_t;
 
         // the queue priority should sort from smallest distance to largest, and on equal distance, by object pointer.
         struct pcmp {
@@ -266,7 +266,7 @@ namespace carve {
           }
         }
 
-        const typename kd_node::data_t *next() {
+        const data_t *next() {
           while (1) {
             if (pq.size()) {
               q_t t = pq.top();
diff --git a/extern/carve/include/carve/mesh_impl.hpp b/extern/carve/include/carve/mesh_impl.hpp
index 23b0a43..d55df8c 100644
--- a/extern/carve/include/carve/mesh_impl.hpp
+++ b/extern/carve/include/carve/mesh_impl.hpp
@@ -624,8 +624,7 @@ namespace carve {
           CARVE_ASSERT(e->rev != NULL);
           e = e->rev->next;
           CARVE_ASSERT(e->v1() == emin->v1());
-          CARVE_ASSERT(e->v1()->v < e->v2()->v);
-          CARVE_ASSERT(e->v1()->v.x <= e->v2()->v.x);
+          CARVE_ASSERT(e->v1()->v <= e->v2()->v);
         } while (e != emin);
 
         double max_abs_x = 0.0;
diff --git a/extern/carve/include/carve/polyhedron_impl.hpp b/extern/carve/include/carve/polyhedron_impl.hpp
index 06d841c..de61324 100644
--- a/extern/carve/include/carve/polyhedron_impl.hpp
+++ b/extern/carve/include/carve/polyhedron_impl.hpp
@@ -88,9 +88,9 @@ namespace carve {
       *(*result)++ = f;
 
       int r = 1;
-      for (size_t i = 0; i < f->edges.size(); ++i) {
-        const std::vector<const face_t *> &edge_faces = connectivity.edge_to_face[edgeToIndex_fast(f->edges[i])];
-        const face_t *f2 = connectedFace(f, f->edges[i]);
+      for (size_t i = 0; i < f->nEdges(); ++i) {
+        const std::vector<const face_t *> &edge_faces = connectivity.edge_to_face[edgeToIndex_fast(f->edge(i))];
+        const face_t *f2 = connectedFace(f, f->edge(i));
         if (f2) {
           r += _faceNeighbourhood(f2, depth - 1, (*result));
         }
@@ -116,7 +116,7 @@ namespace carve {
       int r = 0;
       const std::vector<const face_t *> &edge_faces = connectivity.edge_to_face[edgeToIndex_fast(e)];
       for (size_t i = 0; i < edge_faces.size(); ++i) {
-        face_t *f = edge_faces[i];
+        const face_t *f = edge_faces[i];
         if (f && f->manifold_id == m_id) { r += _faceNeighbourhood(f, depth, &result); }
       }
       return r;
@@ -131,7 +131,7 @@ namespace carve {
       int r = 0;
       const std::vector<const face_t *> &vertex_faces = connectivity.vertex_to_face[vertexToIndex_fast(v)];
       for (size_t i = 0; i < vertex_faces.size(); ++i) {
-        face_t *f = vertex_faces[i];
+        const face_t *f = vertex_faces[i];
         if (f && f->manifold_id == m_id) { r += _faceNeighbourhood(f, depth, &result); }
       }
       return r;
@@ -142,7 +142,7 @@ namespace carve {
     // accessing connectivity information.
     template<typename T>
     int Geometry<3>::vertexToEdges(const vertex_t *v, T result) const {
-      std::vector<const edge_t *> &e = connectivity.vertex_to_edge[vertexToIndex_fast(v)];
+      const std::vector<const edge_t *> &e = connectivity.vertex_to_edge[vertexToIndex_fast(v)];
       std::copy(e.begin(), e.end(), result);
       return e.size();
     }
diff --git a/extern/carve/patches/mingw_w64.patch b/extern/carve/patches/mingw_w64.patch
new file mode 100644
index 0000000..0e3881f
--- /dev/null
+++ b/extern/carve/patches/mingw_w64.patch
@@ -0,0 +1,13 @@
+Index: bundle.sh
+===================================================================
+--- bundle.sh	(revision 45912)
++++ bundle.sh	(working copy)
+@@ -114,7 +114,7 @@
+ if env['WITH_BF_BOOST']:
+     if env['OURPLATFORM'] not in ('win32-vc', 'win64-vc'):
+         # Boost is setting as preferred collections library in the Carve code when using MSVC compiler
+-        if env['OURPLATFORM'] != 'win32-mingw':
++        if env['OURPLATFORM'] not in ('win32-mingw', 'win64-mingw'):
+             defs.append('HAVE_BOOST_UNORDERED_COLLECTIONS')
+ 
+     defs.append('CARVE_SYSTEM_BOOST')
diff --git a/extern/carve/patches/strict_flags.patch b/extern/carve/patches/strict_flags.patch
index 5e4b867..5c7e896 100644
--- a/extern/carve/patches/strict_flags.patch
+++ b/extern/carve/patches/strict_flags.patch
@@ -9,30 +9,6 @@ diff -r 47dfdaff1dd5 include/carve/csg_triangulator.hpp
        }
  
        carve::mesh::MeshSet<3>::face_t *mergeQuad(edge_map_t::iterator i, edge_map_t &edge_map) {
-diff -r 47dfdaff1dd5 include/carve/exact.hpp
---- a/include/carve/exact.hpp	Thu Jan 12 15:49:04 2012 -0500
-+++ b/include/carve/exact.hpp	Fri Jan 13 03:13:32 2012 +0600
-@@ -379,7 +379,7 @@
-         prod_2_1(b, a, r);
-       }
- 
--      static inline double prod_4_1(const double *a, const double *b, double *r) {
-+      static inline void prod_4_1(const double *a, const double *b, double *r) {
-         double b_sp[2]; split(b[0], b_sp);
-         double t1[2]; prod_1_1s(a+0, b, b_sp, t1);
-         r[0] = t1[0];
-@@ -639,8 +639,9 @@
-     }
- 
- 
--    exact_t operator+(const exact_t &a, const exact_t &b) {
--    }
-+    // XXX: not implemented yet
-+    //exact_t operator+(const exact_t &a, const exact_t &b) {
-+    //}
- 
- 
- 
 diff -r 47dfdaff1dd5 src/selfintersect.cpp
 --- a/src/selfintersect.cpp	Thu Jan 12 15:49:04 2012 -0500
 +++ b/src/selfintersect.cpp	Fri Jan 13 03:13:32 2012 +0600
diff --git a/extern/eltopo/SConscript b/extern/eltopo/SConscript
index 2a7bfcf..88debbc 100644
--- a/extern/eltopo/SConscript
+++ b/extern/eltopo/SConscript
@@ -11,7 +11,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
     defs += ' WIN32 NDEBUG _WINDOWS'
     #cflags += ['/MT', '/W3', '/GX', '/O2', '/Op']
     cflags += ['/MT', '/W3', '/GX', '/Og', '/Ot', '/Ob1', '/Op', '/G6', '/O3', '/EHcs']
-elif env['OURPLATFORM'] in ('win32-mingw', 'linuxcross'):
+elif env['OURPLATFORM'] in ('win32-mingw', 'linuxcross', 'win64-mingw'):
     defs += ' NDEBUG'
     cflags += ['-O2']
 elif env['OURPLATFORM'] in ('linux', 'freebsd4', 'freebsd5'):
diff --git a/extern/eltopo/common/array1.h b/extern/eltopo/common/array1.h
index 1fc2b33..c0285be 100644
--- a/extern/eltopo/common/array1.h
+++ b/extern/eltopo/common/array1.h
@@ -5,11 +5,16 @@
 #include <cassert>
 #include <climits>
 #include <cstdlib>
+#include <cstring>
 #include <iostream>
 #include <stdexcept>
-#include <cstring>
 #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)
@@ -40,417 +45,417 @@ template<> struct Array1IsIntegral<unsigned 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);
+    // 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;
+        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 check)
-   { fill(first, last); }
-
-   template<typename InputIterator>
-   void assign_(InputIterator first, InputIterator last, Array1False check)
-   {
-      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;
-   }
+    }
+    
+    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
@@ -470,312 +475,312 @@ 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 check)
-   { fill(first, last); }
-
-   template<typename InputIterator>
-   void assign_(InputIterator first, InputIterator last, Array1False check)
-   {
-      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);
-   }
+    // 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
diff --git a/extern/eltopo/common/array2.h b/extern/eltopo/common/array2.h
index e38e086..046869b 100644
--- a/extern/eltopo/common/array2.h
+++ b/extern/eltopo/common/array2.h
@@ -1,254 +1,295 @@
 #ifndef ARRAY2_H
 #define ARRAY2_H
 
-#include "array1.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
-
-   int 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)
-   {
+    // 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;
+        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];
-   }
-
-   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 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(); }
+    }
+    
+    //   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
diff --git a/extern/eltopo/common/array2_utils.h b/extern/eltopo/common/array2_utils.h
new file mode 100644
index 0000000..27d3ab9
--- /dev/null
+++ b/extern/eltopo/common/array2_utils.h
@@ -0,0 +1,63 @@
+#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
index 66a3e99..facc75c 100644
--- a/extern/eltopo/common/array3.h
+++ b/extern/eltopo/common/array3.h
@@ -1,259 +1,271 @@
 #ifndef ARRAY3_H
 #define ARRAY3_H
 
-#include "array1.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
-
-   int ni, nj, nk;
-   ArrayT a;
-
-   // the interface
-
-   Array3(void)
-      : ni(0), nj(0), nk(0), a(0)
-   {}
-
-   Array3(int ni_, int nj_, int nk_)
-      : ni(ni_), nj(nj_), nk(nk_), a(ni_*nj_*nk_)
-   { assert(ni_>=0 && nj_>=0 && nk_>=0); }
-
-   Array3(int ni_, int nj_, int nk_, ArrayT& a_)
-      : ni(ni_), nj(nj_), nk(nk_), a(a_)
-   { assert(ni_>=0 && nj_>=0 && nk_>=0); }
-
-   Array3(int ni_, int nj_, int nk_, const T& value)
-      : ni(ni_), nj(nj_), nk(nk_), a(ni_*nj_*nk_, value)
-   { assert(ni_>=0 && nj_>=0 && nk_>=0); }
-
-   Array3(int ni_, int nj_, int 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(int ni_, int nj_, int nk_, T* data_)
-      : ni(ni_), nj(nj_), nk(nk_), a(ni_*nj_*nk_, data_)
-   { assert(ni_>=0 && nj_>=0 && nk_>=0); }
-
-   Array3(int ni_, int nj_, int 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)
-   {
+    // 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;
+        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)];
-   }
-
-   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(int ni_, int nj_, int nk_)
-   {
-      assert(ni_>=0 && nj_>=0 && nk_>=0);
-      a.resize(ni_*nj_*nk_);
-      ni=ni_;
-      nj=nj_;
-      nk=nk_;
-   }
-
-   void resize(int ni_, int nj_, int 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(); }
+    }
+    
+    //   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
diff --git a/extern/eltopo/common/array3_utils.h b/extern/eltopo/common/array3_utils.h
index 3c7d2f1..7ce2970 100644
--- a/extern/eltopo/common/array3_utils.h
+++ b/extern/eltopo/common/array3_utils.h
@@ -1,87 +1,87 @@
 #ifndef ARRAY3_UTILS_H
 #define ARRAY3_UTILS_H
 
-#include "vec.h"
-#include "array3.h"
-#include "util.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) 
 {
-   int 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 );
-   
+    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) {
-   int 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);
+    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) {
-   int 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);
+    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
index 1c77f4a..b162e04 100644
--- a/extern/eltopo/common/bfstream.cpp
+++ b/extern/eltopo/common/bfstream.cpp
@@ -1,8 +1,8 @@
-#include "bfstream.h"
+#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; }
 
diff --git a/extern/eltopo/common/bfstream.h b/extern/eltopo/common/bfstream.h
index e196c64..b97f35e 100644
--- a/extern/eltopo/common/bfstream.h
+++ b/extern/eltopo/common/bfstream.h
@@ -6,16 +6,6 @@
 #include <cstdlib>
 #include <fstream>
 
-// __BIG_ENDIAN__ or __LITTLE_ENDIAN__ should be defined before the compiler gets here
-// true in gcc 4.2 but may not be guarenteed between compilers/versions ??
-
-// list taken from source/blender/blenkernel/BKE_utildefines.h
-#if defined(__sgi) || defined (__sparc) || defined (__sparc__) || defined (__PPC__) || defined (__ppc__) || defined (__hppa__) || defined (__BIG_ENDIAN__)
-#define __BIG_ENDIAN__
-#else
-#define __LITTLE_ENDIAN__
-#endif
-
 #ifdef __BIG_ENDIAN__
 #ifdef __LITTLE_ENDIAN__
 #error Cannot be both big and little endian
@@ -29,168 +19,168 @@
 //=================================================================================
 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];
+    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(),
+    std::ifstream input;
+    bool big_endian;
+    
+    bifstream(void) :
+    input(),
 #ifdef __BIG_ENDIAN__
-   big_endian(true)
+    big_endian(true)
 #else
-   big_endian(false)
+    big_endian(false)
 #endif
-   {
-      assert_correct_endianity();
-   }
-
-   bifstream(const char *filename_format, ...) :
-      input(),
+    {
+        assert_correct_endianity();
+    }
+    
+    bifstream(const char *filename_format, ...) :
+    input(),
 #ifdef __BIG_ENDIAN__
-      big_endian(true)
+    big_endian(true)
 #else
-      big_endian(false)
+    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);
+        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);
+        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;
+    }
+    
+    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
+        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
+        assert(*(char*)&test == 1); // if this fails, you should have defined __BIG_ENDIAN__ instead
 #endif
-   }
-
-   void open(const char *filename_format, ...)
-   {
+    }
+    
+    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);
+        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);
+        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)
-   {
+    }
+    
+    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;
+        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);
+        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(); }
-
+    }
+    
+    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));
+    template<class T>
+    bifstream &templated_read(T &d)
+    {
+        input.read((char*)&d, sizeof(T));
 #ifdef __BIG_ENDIAN__
-      if(!big_endian)
+        if(!big_endian)
 #else
-      if(big_endian)
+            if(big_endian)
 #endif
-         swap_endianity(d);
-      return *this;
-   }
+                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 &);
+    
+    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 &);
 };
 
 
@@ -211,160 +201,160 @@ bifstream &operator>>(bifstream &input, double &d);
 //=================================================================================
 struct bofstream
 {
-   std::ofstream output;
-   bool big_endian;
-
-   bofstream(void) :
-      output(),
+    std::ofstream output;
+    bool big_endian;
+    
+    bofstream(void) :
+    output(),
 #ifdef __BIG_ENDIAN__
-   big_endian(true)
+    big_endian(true)
 #else
-   big_endian(false)
+    big_endian(false)
 #endif
-   {
-      assert_correct_endianity();
-   }
-
-   bofstream(const char *filename_format, ...) :
-      output(),
+    {
+        assert_correct_endianity();
+    }
+    
+    bofstream(const char *filename_format, ...) :
+    output(),
 #ifdef __BIG_ENDIAN__
-      big_endian(true)
+    big_endian(true)
 #else
-      big_endian(false)
+    big_endian(false)
 #endif
-   {
-      assert_correct_endianity();
+    {
+        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);
+        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);
+        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;
+    }
+    
+    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
+        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
+        assert(*(char*)&test == 1); // if this fails, you should have defined __BIG_ENDIAN__ instead
 #endif
-   }
-
-   void open(const char *filename_format, ...)
-   {
+    }
+    
+    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);
+        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);
+        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)
-   {
-
+    }
+    
+    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;
+        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);
+        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); }
-
+    }
+    
+    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)
-   {
+    template<class T>
+    bofstream &templated_write(const T &d)
+    {
 #ifdef __BIG_ENDIAN__
-      if(!big_endian)
+        if(!big_endian)
 #else
-      if(big_endian)
+            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;
-   }
+            {
+                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 &);
+    
+    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);
diff --git a/extern/eltopo/common/blas_wrapper.h b/extern/eltopo/common/blas_wrapper.h
index 39a31fa..58ba719 100644
--- a/extern/eltopo/common/blas_wrapper.h
+++ b/extern/eltopo/common/blas_wrapper.h
@@ -1,10 +1,10 @@
 #ifndef BLAS_WRAPPER_H
 #define BLAS_WRAPPER_H
 
+#include <cassert>
 #include <cmath>
 #include <cstring>
 #include <vector>
-#include <cassert>
 
 // Useful dense kernels from BLAS, with readable, overloaded, cross-platform names and some simplified calling
 //  dot    (dot-product of vectors)
@@ -31,562 +31,568 @@
 // 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)); }
-
+    
+    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*);
+    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 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 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
-
-};
+    
+    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"
+#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
-
+    
+    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"
+#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
 
-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
-
-}
 
 #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...
-
+    
+    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
new file mode 100644
index 0000000..994bc57
--- /dev/null
+++ b/extern/eltopo/common/ccd_defs.h
@@ -0,0 +1,17 @@
+// ---------------------------------------------------------
+//
+//  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
index ef84a5e..985dc33 100644
--- a/extern/eltopo/common/ccd_wrapper.cpp
+++ b/extern/eltopo/common/ccd_wrapper.cpp
@@ -1,5 +1,3 @@
-
-
 // ---------------------------------------------------------
 //
 //  ccd_wrapper.cpp
@@ -9,573 +7,802 @@
 //
 // ---------------------------------------------------------
 
+#include <bfstream.h>
+#include <ccd_defs.h>
 #include <ccd_wrapper.h>
-
-#ifdef USE_TUNICATE_CCD
-
 #include <collisionqueries.h>
 #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 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 );
-   
-   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 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] ) )
-   {
-      return 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] ) )
-   {
-      return 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] ) )
-   {
-      return true;
-   }
-   
-   return false;
-}
-
-
-// --------------------------------------------------------------------------------------------------------------
-static void out4d( double* x )
-{
-   std::cout << x[0] << " " << x[1] << " " << x[2] << " " << x[3] << std::endl;
-}
-
-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 );
-   
-   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 ( simplex_intersection4d( segment_tetrahedron_test,
-                                p0, pnew0, p1, p2, p3, pnew3,
-                                &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-   {
-      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 ( verbose )
-      {
-         std::cout << "segment_tetrahedron_test positive with these inputs: " << std::endl;
-         std::cout.precision(20);
-         out4d(p0);
-         out4d(pnew0);
-         out4d(p1);
-         out4d(p2);
-         out4d(p3);
-         out4d(pnew3);
-      }        
-      
-   }
-   
-   if ( simplex_intersection4d( segment_tetrahedron_test,
-                                p0, pnew0, p1, p2, pnew2, pnew3,
-                                &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-   {
-      if(!collision || bary[1]<t)
-      {
-         collision=true;
-         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-xnew2);
-         relative_normal_displacement=dot(normal, (xnew0-x0)-(xnew2-x2));
-         
-         if ( verbose )
-         {
-            std::cout << "segment_tetrahedron_test positive with these inputs: " << std::endl;
-            std::cout.precision(20);
-            out4d(p0);
-            out4d(pnew0);
-            out4d(p1);
-            out4d(p2);
-            out4d(pnew2);
-            out4d(pnew3);
-         }        
-         
-      }
-   }
-   
-   if ( simplex_intersection4d( segment_tetrahedron_test,
-                                p0, pnew0, p1, pnew1, pnew2, pnew3,
-                                &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-   {
-      if(!collision || bary[1]<t)
-      {
-         collision=true;
-         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));
-         
-         if ( verbose )
-         {
-            std::cout << "segment_tetrahedron_test positive with these inputs: " << std::endl;
-            std::cout.precision(20);
-            out4d(p0);
-            out4d(pnew0);
-            out4d(p1);
-            out4d(pnew1);
-            out4d(pnew2);
-            out4d(pnew3);
-         }        
-         
-      }
-   }
-   
-   if ( collision )
-   {
-      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 collision;
-}
+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
 
-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 );
-   
-   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 ( simplex_intersection4d( triangle_triangle_test,
-                                p0, p1, p1, p2, p3, pnew3,
-                                &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-   {
-      return true;
-   }
-
-   if ( simplex_intersection4d( triangle_triangle_test,
-                                p0, pnew0, pnew1, p2, p3, pnew3,
-                                &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-   {
-      return true;
-   }
-   
-   if ( simplex_intersection4d( triangle_triangle_test,
-                                p0, p1, pnew1, p2, pnew2, pnew3,
-                                &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-   {
-      return true;
-   }
-
-   if ( simplex_intersection4d( triangle_triangle_test,
-                                p0, pnew0, pnew1, p2, pnew2, pnew3,
-                                &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-   {
-      return true;
-   }
-
-   return false;
-}
 
+// --------------------------------------------------------------------------------------------------
+// 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
+// --------------------------------------------------------------------------------------------------
 
 // --------------------------------------------------------------------------------------------------------------
 
-static void output_4d( const double* v )
+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 )
 {
-   int old_precision = std::cout.precision();
-   std::cout.precision(20);
-   std::cout << v[0] << " " << v[1] << " " << v[2] << " " << v[3] << std::endl;
-   std::cout.precision(old_precision);
+    return tunicate_point_segment_collision( x0, xnew0, index0, 
+                                            x1, xnew1, index1, 
+                                            x2, xnew2, index2 );
 }
 
-
-bool g_verbose = false;
-
-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 )
+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 )
 {
-
-   assert( index0 < index1 && 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 };
-   
-   bool collision=false;
-   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] ) )
-   {
-      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 ( verbose )
-      {
-         std::cout << "triangle_triangle_test positive with these inputs: " << std::endl;
-         output_4d(p0);
-         output_4d(p1);
-         output_4d(pnew1);
-         output_4d(p2);
-         output_4d(p3);
-         output_4d(pnew3);
-         
-         std::cout << "barycentric coords: " << std::endl;
-         for ( unsigned int i = 0; i < 6; ++i ) { std::cout << bary[i] << " " << std::endl; }
-         
-         g_verbose = true;
-         simplex_intersection4d( triangle_triangle_test,
-                                 p0, p1, pnew1, p2, p3, pnew3,
-                                 &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] );
-         g_verbose = false;
-         
-         assert(0);
-      }        
-            
-   }
-   
-   if ( simplex_intersection4d( triangle_triangle_test,
-                                p0, pnew0, pnew1, p2, p3, pnew3,
-                                &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-   {
-      if(!collision || bary[5]<t)
-      {
-         collision=true;
-         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 ( verbose )
-         {
-            std::cout << "triangle_triangle_test positive with these inputs: " << std::endl;
-            output_4d(p0);
-            output_4d(pnew0);
-            output_4d(pnew1);
-            output_4d(p2);
-            output_4d(p3);
-            output_4d(pnew3);            
-         }        
-         
-      }
-   }
-   
-   if ( simplex_intersection4d( triangle_triangle_test,
-                                p0, p1, pnew1, p2, pnew2, pnew3,
-                                &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-   {
-      if(!collision || bary[2]<t){
-         collision=true;
-         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 ( verbose )
-         {
-            std::cout << "triangle_triangle_test positive with these inputs: " << std::endl;
-            output_4d(p0);
-            output_4d(p1);
-            output_4d(pnew1);
-            output_4d(p2);
-            output_4d(pnew2);
-            output_4d(pnew3);
-         }        
-         
-      }
-   }
-   
-   if ( simplex_intersection4d( triangle_triangle_test,
-                                p0, pnew0, pnew1, p2, pnew2, pnew3,
-                                &bary[0], &bary[1], &bary[2], &bary[3], &bary[4], &bary[5] ) )
-   {
-      if(!collision || 1-bary[0]<t){
-         collision=true;
-         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 ( verbose )
-         {
-            std::cout << "triangle_triangle_test positive with these inputs: " << std::endl;
-            output_4d(p0);
-            output_4d(pnew0);
-            output_4d(pnew1);
-            output_4d(p2);
-            output_4d(pnew2);
-            output_4d(pnew3);
-         }        
-                  
-      }
-   }
-
-   if ( collision )
-   {
-      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 collision;
-   
+    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;
+    
 }
 
 
-
 // --------------------------------------------------------------------------------------------------
-// 3D Static intersection detection
-// --------------------------------------------------------------------------------------------------
-
+// 2D Static intersection detection / distance queries
 // --------------------------------------------------------------------------------------------------
 
+// --------------------------------------------------------------------------------------------------------------
 
-// x0-x1 is the segment and and x2-x3-x4 is the triangle.
-bool segment_triangle_intersection(const Vec3d& x0, unsigned int index0,
-                                   const Vec3d& x1, unsigned int index1,
-                                   const Vec3d& x2, unsigned int index2,
-                                   const Vec3d& x3, unsigned int index3,
-                                   const Vec3d& x4, unsigned int index4,
-                                   bool degenerate_counts_as_intersection,
-                                   bool verbose )
+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[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] );
+    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] );
 }
 
+// --------------------------------------------------------------------------------------------------------------
 
-// --------------------------------------------------------------------------------------------------
-
-
-// x0 is the point and x1-x2-x3-x4 is the tetrahedron. Order is irrelevant.
-bool point_tetrahedron_intersection(const Vec3d& x0, unsigned int index0,
-                                    const Vec3d& x1, unsigned int index1,
-                                    const Vec3d& x2, unsigned int index2,
-                                    const Vec3d& x3, unsigned int index3,
-                                    const Vec3d& x4, unsigned int index4)
+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 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] );   
+    double s1, s3;    // not returned
+    return simplex_intersection2d( 2, x0.v, x1.v, x2.v, x3.v, &s0, &s1, &s2, &s3 );
 }
 
 
 // --------------------------------------------------------------------------------------------------
-// 3D Static distance
-// --------------------------------------------------------------------------------------------------
-
+// 3D Continuous collision detection
 // --------------------------------------------------------------------------------------------------
 
 
-void point_segment_distance( bool update, 
-                            const Vec3d &x0, unsigned int index0,
-                            const Vec3d &x1, unsigned int index1,
-                            const Vec3d &x2, unsigned int index2,
-                            double &distance)
+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 )
 {
-   check_point_edge_proximity( update, x0, x1, x2, distance);   
-}
+    bool tunicate_result = tunicate_point_triangle_collision( x0, xnew0, index0,
+                                                             x1, xnew1, index1,
+                                                             x2, xnew2, index2,
+                                                             x3, xnew3, index3 );                                            
+    
+    return tunicate_result;
+    
+} 
 
-// --------------------------------------------------------------------------------------------------
+// --------------------------------------------------------------------------------------------------------------
 
-void point_segment_distance( bool update, 
-                            const Vec3d &x0, unsigned int index0,
-                            const Vec3d &x1, unsigned int index1,
-                            const Vec3d &x2, unsigned int index2,
-                            double &distance, double &s, Vec3d &normal, double normal_multiplier )
+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 )
 {
-   check_point_edge_proximity( update, x0, x1, x2, distance, s, normal, normal_multiplier );
+    
+    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;
+    
 }
 
 
-// --------------------------------------------------------------------------------------------------
+// --------------------------------------------------------------------------------------------------------------
 
 
-void point_triangle_distance( const Vec3d& x0, unsigned int index0,
-                             const Vec3d& x1, unsigned int index1,
-                             const Vec3d& x2, unsigned int index2,
-                             const Vec3d& x3, unsigned int index3,
-                             double& distance )
+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)
 {
-   check_point_triangle_proximity( x0, x1, x2, x3, distance );
+    bool tunicate_result = tunicate_segment_segment_collision( x0, xnew0, index0,
+                                                              x1, xnew1, index1,
+                                                              x2, xnew2, index2,
+                                                              x3, xnew3, index3 );
+    
+    return tunicate_result;
 }
 
-// --------------------------------------------------------------------------------------------------
+// --------------------------------------------------------------------------------------------------------------
 
 
-void point_triangle_distance( const Vec3d& x0, unsigned int index0,
-                             const Vec3d& x1, unsigned int index1,
-                             const Vec3d& x2, unsigned int index2,
-                             const Vec3d& x3, unsigned int index3,
-                             double& distance, 
-                             double& bary1, double& bary2, double& bary3, 
-                             Vec3d& normal )
+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 )
 {
-   check_point_triangle_proximity( x0, x1, x2, x3, distance, bary1, bary2, bary3, normal );
+    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
+// --------------------------------------------------------------------------------------------------
+
 // --------------------------------------------------------------------------------------------------
 
-void segment_segment_distance( const Vec3d& x0, unsigned int index0,
-                              const Vec3d& x1, unsigned int index1,
-                              const Vec3d& x2, unsigned int index2,
-                              const Vec3d& x3, unsigned int index3,
-                              double& distance  )
+// 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*/ )
 {
-   check_edge_edge_proximity( x0, x1, x2, x3, distance );
+    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] );
 }
 
-// --------------------------------------------------------------------------------------------------
 
-void segment_segment_distance( const Vec3d& x0, unsigned int index0,
-                              const Vec3d& x1, unsigned int index1,
-                              const Vec3d& x2, unsigned int index2,
-                              const Vec3d& x3, unsigned int index3,
-                              double& distance, 
-                              double& bary0, double& bary2,
-                              Vec3d& normal )
+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*/ )
 {
-   check_edge_edge_proximity( x0, x1, x2, x3, distance, bary0, bary2, normal );
+    return simplex_intersection3d( 2, x0.v, x1.v, x2.v, x3.v, x4.v, &bary0, &bary1, &bary2, &bary3, &bary4 );
 }
 
+
 // --------------------------------------------------------------------------------------------------
 
-double tetrahedron_signed_volume(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3)
+
+// 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*/)
 {
-   return signed_volume( x0, x1, x2, x3 );
+    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] );   
 }
 
 
diff --git a/extern/eltopo/common/ccd_wrapper.h b/extern/eltopo/common/ccd_wrapper.h
index d70f574..bd8b6bc 100644
--- a/extern/eltopo/common/ccd_wrapper.h
+++ b/extern/eltopo/common/ccd_wrapper.h
@@ -1,4 +1,3 @@
-
 // ---------------------------------------------------------
 //
 //  ccd_wrapper.h
@@ -14,161 +13,107 @@
 
 #include <vec.h>
 
-#define USE_CUBIC_SOLVER_CCD
-//#define USE_TUNICATE_CCD
 
 // --------------------------------------------------------------------------------------------------
-// 2D
+// 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, unsigned int index0,
-                             const Vec2d& x1, const Vec2d& xnew1, unsigned int index1,
-                             const Vec2d& x2, const Vec2d& xnew2, unsigned int 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);
 
-bool point_segment_collision(const Vec2d& x0, const Vec2d& xnew0, unsigned int index0,
-                             const Vec2d& x1, const Vec2d& xnew1, unsigned int index1,
-                             const Vec2d& x2, const Vec2d& xnew2, unsigned int 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);
 
-bool segment_segment_intersection(const Vec2d& x0, unsigned int index0, 
-                                  const Vec2d& x1, unsigned int index1,
-                                  const Vec2d& x2, unsigned int index2,
-                                  const Vec2d& x3, unsigned int index3);
-
-bool segment_segment_intersection(const Vec2d& x0, unsigned int index0, 
-                                  const Vec2d& x1, unsigned int index1,
-                                  const Vec2d& x2, unsigned int index2,
-                                  const Vec2d& x3, unsigned int index3,
-                                  double &s0, double& s2 );
-
-void point_segment_distance( bool update, 
-                             const Vec2d &x0, unsigned int index0, 
-                             const Vec2d &x1, unsigned int index1, 
-                             const Vec2d &x2, unsigned int index2, 
-                             double &distance );
-
-void point_segment_distance( bool update, 
-                             const Vec2d &x0, unsigned int index0, 
-                             const Vec2d &x1, unsigned int index1, 
-                             const Vec2d &x2, unsigned int index2, 
-                             double &distance, double &s, Vec2d &normal, double normal_multiplier );
-
 // --------------------------------------------------------------------------------------------------
-// 3D
+// 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 );
+
 // --------------------------------------------------------------------------------------------------
-// Continuous collision detection
+// 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, 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);
+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, 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,
+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& t,
-                              double& relative_normal_displacement,
-                              bool verbose = false );
+                              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, 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);
+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, 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,
+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& t,
-                               double& relative_normal_displacement,
-                               bool verbose = false );
+                               double& relative_normal_displacement );
 
 
 // --------------------------------------------------------------------------------------------------
-// Static intersection detection
+// 3D static intersection detection
 // --------------------------------------------------------------------------------------------------
 
 // x0-x1 is the segment and and x2-x3-x4 is the triangle.
-bool segment_triangle_intersection(const Vec3d& x0, unsigned int index0,
-                                   const Vec3d& x1, unsigned int index1,
-                                   const Vec3d& x2, unsigned int index2,
-                                   const Vec3d& x3, unsigned int index3,
-                                   const Vec3d& x4, unsigned int index4,
+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 );
 
-// x0 is the point and x1-x2-x3-x4 is the tetrahedron. Order is irrelevant.
-bool point_tetrahedron_intersection(const Vec3d& x0, unsigned int index0,
-                                    const Vec3d& x1, unsigned int index1,
-                                    const Vec3d& x2, unsigned int index2,
-                                    const Vec3d& x3, unsigned int index3,
-                                    const Vec3d& x4, unsigned int index4);
+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 );
 
-// --------------------------------------------------------------------------------------------------
-// Static distance
-// --------------------------------------------------------------------------------------------------
 
-void point_segment_distance( bool update, 
-                             const Vec3d &x0, unsigned int index0,
-                             const Vec3d &x1, unsigned int index1,
-                             const Vec3d &x2, unsigned int index2,
-                             double &distance);
-
-void point_segment_distance( bool update, 
-                             const Vec3d &x0, unsigned int index0,
-                             const Vec3d &x1, unsigned int index1,
-                             const Vec3d &x2, unsigned int index2,
-                             double &distance, double &s, Vec3d &normal, double normal_multiplier );
-
-
-void point_triangle_distance( const Vec3d& x0, unsigned int index0,
-                             const Vec3d& x1, unsigned int index1,
-                             const Vec3d& x2, unsigned int index2,
-                             const Vec3d& x3, unsigned int index3,
-                             double& distance );
-
-void point_triangle_distance( const Vec3d& x0, unsigned int index0,
-                              const Vec3d& x1, unsigned int index1,
-                              const Vec3d& x2, unsigned int index2,
-                              const Vec3d& x3, unsigned int index3,
-                              double& distance, 
-                              double& bary1, double& bary2, double& bary3, 
-                              Vec3d& normal );
-
-void segment_segment_distance( const Vec3d& x0, unsigned int index0,
-                              const Vec3d& x1, unsigned int index1,
-                              const Vec3d& x2, unsigned int index2,
-                              const Vec3d& x3, unsigned int index3,
-                              double& distance );
-
-void segment_segment_distance( const Vec3d& x0, unsigned int index0,
-                               const Vec3d& x1, unsigned int index1,
-                               const Vec3d& x2, unsigned int index2,
-                               const Vec3d& x3, unsigned int index3,
-                               double& distance, 
-                               double& bary0, double& bary2,
-                               Vec3d& normal );
+// 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 tetrahedron_signed_volume(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3);
 
 #endif
 
diff --git a/extern/eltopo/common/collisionqueries.cpp b/extern/eltopo/common/collisionqueries.cpp
index b097ef0..fd23246 100644
--- a/extern/eltopo/common/collisionqueries.cpp
+++ b/extern/eltopo/common/collisionqueries.cpp
@@ -1,468 +1,154 @@
-#include "collisionqueries.h"
+#include <collisionqueries.h>
+#include <commonoptions.h>
 
-// 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
-static 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(unsigned int 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(unsigned int 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;
-}
-
-
-
-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]) );
-}
-
-// ---------------------------------------------------------
-///
-/// Compute all proximities between an edge and a triangle and report the minimum
-///
-// ---------------------------------------------------------
-
-double lowest_triangle_edge_proximity( const Vec3d &t0, const Vec3d &t1, const Vec3d &t2, 
-                                       const Vec3d &e0, const Vec3d &e1 )
-{
-   double min_dist = 1e30;
-
-   double curr_dist;
-   check_point_triangle_proximity( e0, t0, t1, t2, curr_dist );
-   min_dist = min( min_dist, curr_dist );
-   check_point_triangle_proximity( e1, t0, t1, t2, curr_dist );
-   min_dist = min( min_dist, curr_dist );
-
-   check_edge_edge_proximity( e0, e1, t0, t1, curr_dist );
-   min_dist = min( min_dist, curr_dist );
-   check_edge_edge_proximity( e0, e1, t1, t2, curr_dist );
-   min_dist = min( min_dist, curr_dist );
-   check_edge_edge_proximity( e0, e1, t2, t0, curr_dist );
-   min_dist = min( min_dist, curr_dist );
-
-   return min_dist;
-}
-
-
-// ---------------------------------------------------------
-///
-/// Return true if triangle (x1,x2,x3) intersects segment (x4,x5)
-///
-// ---------------------------------------------------------
-
-static bool triangle_intersects_segment(const Vec3d &x1, const Vec3d &x2, const Vec3d &x3, 
-                                        const Vec3d &x4, const Vec3d &x5,
-                                        double tolerance, bool verbose, bool& degenerate )
-{
-   static const double machine_epsilon = 1e-7;
-   
-   degenerate = false;
-   
-   double d=signed_volume(x1, x2, x3, x5);
-   double e=-signed_volume(x1, x2, x3, x4);
-   
-   if ( verbose )
-   {
-      std::cout << "d: " << d << std::endl;
-      std::cout << "e: " << e << std::endl;
-   }
-   
-   if ( ( fabs(d) < machine_epsilon ) || ( fabs(e) < machine_epsilon ) )
-   {
-      degenerate = true;
-   }
-   
-   if((d>0) ^ (e>0))
-   {
-      // if the segment is completely on one side of the triangle but closer than tolerance, report intersection
-//      if ( lowest_triangle_edge_proximity( x1, x2, x3, x4, x5 ) < tolerance )
-//      {
-//         if ( verbose ) { std::cout << "edge is totally on one side but closer than tolerance" << std::endl; }
-//         return true;
-//      }
-      return false;
-   }
-   
-   // note: using the triangle edges in the first two spots guarantees the same floating point result (up to sign)
-   // if we transpose the triangle vertices -- e.g. testing an adjacent triangle -- so this triangle-line test is
-   // watertight.
-   double a=signed_volume(x2, x3, x4, x5);
-   double b=signed_volume(x3, x1, x4, x5);
-   double c=signed_volume(x1, x2, x4, x5);
-   
-   if ( verbose )
-   {
-      std::cout << "a: " << a << std::endl;
-      std::cout << "b: " << b << std::endl;
-      std::cout << "c: " << c << std::endl;
-   }
-   
-   double sum_abc=a+b+c;
-   
-   if ( verbose ) std::cout << "sum_abc: " << sum_abc << std::endl;
-   
-   if( fabs(sum_abc) < machine_epsilon )
-   {
-      degenerate = true;
-      return false;            // degenerate situation
-   }
-   
-   double sum_de=d+e;
-   
-   if ( verbose ) std::cout << "sum_de: " << sum_de << std::endl;
-   
-   if( fabs(sum_de) < machine_epsilon )
-   {
-      degenerate = true;
-      return false; // degenerate situation
-   }
-
-   
-   if ( ( fabs(a) < machine_epsilon ) || ( fabs(b) < machine_epsilon ) || (fabs(c) < machine_epsilon) )
-   {
-      degenerate = true;
-   }
-
-   
-   if((a>0) ^ (b>0))
-   {
-      // if the segment is completely on one side of the triangle but closer than tolerance, report intersection
-//      if ( lowest_triangle_edge_proximity( x1, x2, x3, x4, x5 ) < tolerance )
-//      {
-//         if ( verbose ) 
-//         { 
-//            std::cout << "edge is totally on one side but closer than tolerance" << std::endl; 
-//            std::cout << "lowest_triangle_edge_proximity: " << lowest_triangle_edge_proximity( x1, x2, x3, x4, x5 ) << std::endl;
-//            std::cout << "degenerate: " << degenerate << std::endl;
-//         }
-//         return true;
-//      }
-
-      return false;
-   }
-   
-   if((a>0) ^ (c>0))
-   {
-      // if the segment is completely on one side of the triangle but closer than tolerance, report intersection
-//      if ( lowest_triangle_edge_proximity( x1, x2, x3, x4, x5 ) < tolerance )
-//      {
-//         return true;
-//      }
-      
-      return false;
-   }
-   
-   double over_abc=1/sum_abc;
-   a*=over_abc;
-   b*=over_abc;
-   c*=over_abc;
-         
-   double over_de=1/sum_de;
-   d*=over_de;
-   e*=over_de;
-   
-   if ( verbose ) 
-   {
-      std::cout << "normalized coords: " << a << " " << b << " " << c << " " << d << " " << e << std::endl;
-   }
-   
-   return true;
-}
-
-// ---------------------------------------------------------
-///
-/// Return true if triangle (xtri0,xtri1,xtri2) intersects segment (xedge0, xedge1), within the specified tolerance.
-/// If degenerate_counts_as_intersection is true, this function will return true in a degenerate situation.
-///
-// ---------------------------------------------------------
-
-bool check_edge_triangle_intersection(const Vec3d &xedge0, const Vec3d &xedge1,
-                                      const Vec3d &xtri0, const Vec3d &xtri1, const Vec3d &xtri2,
-                                      double tolerance, bool degenerate_counts_as_intersection, bool verbose )
-{
-   bool is_degenerate;
-   if ( triangle_intersects_segment( xtri0, xtri1, xtri2, xedge0, xedge1, tolerance, verbose, is_degenerate ) )
-   {
-      if ( is_degenerate )
-      {
-         if ( degenerate_counts_as_intersection )
-         {
-            return true;
-         }
-      }
-      else
-      {
-         return true;
-      }
-   }
-   
-   return false;
-}
 
 
 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);
-   }
+    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);
-   }
+    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)
+                                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);
-   }
+    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);
-   }
+    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);
-      }
-   }
+    // 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
@@ -470,99 +156,99 @@ void check_edge_edge_proximity(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2
 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=(s2*x2+(1-s2)*x3)-(s0*x0+(1-s0)*x1);
-         distance=mag(normal);
-         if(distance>0) normal/=distance;
-         else{
-            normal=cross(x1-x0, x3-x2);
-            normal/=mag(normal)+1e-300;
-         }
-      }
-   }
+    // 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);
-      }
-   }
+    // 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
@@ -570,384 +256,73 @@ void check_point_triangle_proximity(const Vec3d &x0, const Vec3d &x1, const Vec3
 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;
-         }
-      }
-   }
-}
-
-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)
-{
-   const double tol=1e-8;
-   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=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
-      // 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>=-tol && t<=1+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>=-tol && t0<=1+tol) possible_times.push_back(clamp(t0, 0., 1.));
-            if(t1>=-tol && t1<=1+tol) add_unique(possible_times, clamp(t1, 0., 1.));
-         }
-         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);
-         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);
-      }
-   }
-
-   // 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(unsigned int 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);
-   }
-   // first look for interval endpoints that are close enough to zero, without a sign change
-   for(unsigned int 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(unsigned int 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;
-         for(int iteration=0; iteration<75; ++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;
+    // 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;
             }
-            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;
-         }
-         possible_times.push_back(tmid);
-      }
-   }
-   sort(possible_times.begin(), possible_times.end());
-}
-
-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(unsigned int 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;
-}
-
-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(unsigned int 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*collision_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(collision_epsilon)){
-               normal/=m;
-            }else{
-               // if that didn't work, try cross-product of edges at the start
-               normal=cross(x1-x0, x3-x2);
-               m=mag(normal);
-               if(m>sqr(collision_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>collision_epsilon){
-                     normal/=m;
-                  }else{
-                     // if that didn't work, boy are we in trouble; just get any non-parallel vector
-                     Vec3d dx=xt1-xt0;
-                     if(dx[0]!=0 || dx[1]!=0){
-                        normal=Vec3d(dx[1], -dx[0], 0);
-                        normal/=mag(normal);
-                     }else{
-                        dx=xt3-xt2;
-                        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
-                        }
-                     }
-                  }
-               }
+        }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;
             }
-         }
-         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(unsigned int 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;
-}
-
-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(unsigned int 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*collision_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(collision_epsilon)){
-               normal/=m;
-            }else{
-               // if that didn't work, try triangle normal at start
-               normal=cross(x2-x1, x3-x1);
-               m=mag(normal);
-               if(m>sqr(collision_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>collision_epsilon){
-                     normal/=m;
-                  }else{
-                     // if that didn't work, boy are we in trouble; just get any non-parallel vector
-                     Vec3d dx=xt2-xt1;
-                     if(dx[0]!=0 || dx[1]!=0){
-                        normal=Vec3d(dx[1], -dx[0], 0);
-                        normal/=mag(normal);
-                     }else{
-                        dx=xt3-xt1;
-                        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
-                        }
-                     }
-                  }
-               }
+        }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;
             }
-         }
-         return true;
-      }
-   }
-   return false;
+        }
+    }
 }
 
-// ---------------------------------------------------------
-///
-/// Detect if point p lies within the tetrahedron defined by x1 x2 x3 x4.
-/// Assumes tet is given with x123 forming an oriented triangle.
-/// Returns true if vertex proximity to any of the tet's faces is less than epsilon.
-///
-// ---------------------------------------------------------
-
-bool vertex_is_in_tetrahedron( const Vec3d &p, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3, const Vec3d &x4, double epsilon )
+double signed_volume(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3)
 {
-   double distance;  
-   
-   // triangle 1 - x1 x2 x3
-   double a = signed_volume(p, x1, x2, x3);
-   
-   if (fabs(a) < epsilon)     // degenerate
-   {        
-      check_point_triangle_proximity(p, x1, x2, x3, distance);
-      if ( distance < epsilon )
-      {
-         return true;
-      }
-   }
-   
-   // triangle 2 - x2 x4 x3
-   double b = signed_volume(p, x2, x4, x3);
-   
-   if (fabs(b) < epsilon)         // degenerate
-   {
-      check_point_triangle_proximity(p, x2, x4, x3, distance);
-      if ( distance < epsilon )
-      {
-         return true;
-      }
-   }
-   
-   if ((a > epsilon) ^ (b > epsilon))
-   {
-      return false;
-   }
-   
-   // triangle 3 - x1 x4 x2
-   double c = signed_volume(p, x1, x4, x2);
-   if (fabs(c) < epsilon) 
-   {
-      check_point_triangle_proximity(p, x1, x4, x2, distance);
-      if ( distance < epsilon )
-      {
-         return true;
-      }
-   }
-   
-   if ((a > epsilon) ^ (c > epsilon))
-   {
-      return false;
-   }
-   
-   // triangle 4 - x1 x3 x4
-   double d = signed_volume(p, x1, x3, x4);
-   if (fabs(d) < epsilon) 
-   { 
-      check_point_triangle_proximity(p, x1, x3, x4, distance);
-      if ( distance < epsilon )
-      {
-         return true;
-      }
-   }
-   
-   if ((a > epsilon) ^ (d > epsilon))
-   {
-      return false;
-   }
-   
-   // if there was a degenerate case, but the point was not in any triangle, the point must be outside the tet
-   if ( (fabs(a) < epsilon) || (fabs(b) < epsilon) || (fabs(c) < epsilon) || (fabs(d) < epsilon) ) 
-   {
-      return false;
-   }
-   
-   return true;    // point is on the same side of all triangles
+    // 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
index 8c45e65..4f91fe6 100644
--- a/extern/eltopo/common/collisionqueries.h
+++ b/extern/eltopo/common/collisionqueries.h
@@ -1,19 +1,10 @@
 #ifndef COLLISIONQUERIES_H
 #define COLLISIONQUERIES_H
 
-#include "vec.h"
+#include <vec.h>
 
 // 2D ====================================================================================================
 
-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 );
 
 void check_point_edge_proximity(bool update, const Vec2d &x0, const Vec2d &x1, const Vec2d &x2,
                                 double &distance);
@@ -23,13 +14,6 @@ void check_point_edge_proximity(bool update, const Vec2d &x0, const Vec2d &x1, c
 
 // 3D ====================================================================================================
 
-double lowest_triangle_edge_proximity( const Vec3d &t0, const Vec3d &t1, const Vec3d &t2, 
-                                       const Vec3d &e0, const Vec3d &e1 );
-
-bool check_edge_triangle_intersection(const Vec3d &xedge0, const Vec3d &xedge1,
-                                      const Vec3d &xtri0, const Vec3d &xtri1, const Vec3d &xtri2,
-                                      double tolerance, bool degenerate_counts_as_intersection, bool verbose );
-
 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,
@@ -45,27 +29,8 @@ void check_point_triangle_proximity(const Vec3d &x0, const Vec3d &x1, const Vec3
 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);
 
-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);
 
 double signed_volume(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3);
 
-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);
-
-bool vertex_is_in_tetrahedron( const Vec3d &p, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3, const Vec3d &x4, double epsilon );
 
 #endif
diff --git a/extern/eltopo/common/commonoptions.h b/extern/eltopo/common/commonoptions.h
new file mode 100644
index 0000000..6f145f1
--- /dev/null
+++ b/extern/eltopo/common/commonoptions.h
@@ -0,0 +1,22 @@
+// ---------------------------------------------------------
+//
+//  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
index 3485154..e73ea14 100644
--- a/extern/eltopo/common/cubic_ccd_wrapper.cpp
+++ b/extern/eltopo/common/cubic_ccd_wrapper.cpp
@@ -1,4 +1,3 @@
-
 // ---------------------------------------------------------
 //
 //  cubic_ccd_wrapper.cpp
@@ -8,91 +7,612 @@
 //
 // ---------------------------------------------------------
 
+
+#include <ccd_defs.h>
 #include <ccd_wrapper.h>
 
+bool simplex_verbose = false;
+
+
 #ifdef USE_CUBIC_SOLVER_CCD
 
 #include <collisionqueries.h>
+#include <tunicate.h>
 
-static const double collision_epsilon = 1e-6;
+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, unsigned int index0,
-                             const Vec2d& x1, const Vec2d& xnew1, unsigned int index1,
-                             const Vec2d& x2, const Vec2d& xnew2, unsigned int index2,
+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, 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, unsigned int index0,
-                             const Vec2d& x1, const Vec2d& xnew1, unsigned int index1,
-                             const Vec2d& x2, const Vec2d& xnew2, unsigned int index2 )
-{
-   return check_point_edge_collision( x0, x1, x2, xnew0, xnew1, xnew2, collision_epsilon );
+    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;
+    
 }
 
 // --------------------------------------------------------------------------------------------------
-// 2D Static intersection detection
-// --------------------------------------------------------------------------------------------------
 
-bool segment_segment_intersection(const Vec2d& x0, unsigned int index0, 
-                                  const Vec2d& x1, unsigned int index1,
-                                  const Vec2d& x2, unsigned int index2,
-                                  const Vec2d& x3, unsigned int index3)
+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 s0, s2;
-   return check_edge_edge_intersection( x0, x1, x2, x3, s0, s2, collision_epsilon );
-}
-
-bool segment_segment_intersection(const Vec2d& x0, unsigned int index0, 
-                                  const Vec2d& x1, unsigned int index1,
-                                  const Vec2d& x2, unsigned int index2,
-                                  const Vec2d& x3, unsigned int index3,
-                                  double &s0, double& s2 )
-{
-   return check_edge_edge_intersection( x0, x1, x2, x3, s0, s2, collision_epsilon );
+    
+    bool result = check_point_edge_collision( x0, x1, x2, xnew0, xnew1, xnew2, g_collision_epsilon );
+    
+    return result;
+    
 }
 
 // --------------------------------------------------------------------------------------------------
-// 2D Static distance
+// 2D Static intersection detection
 // --------------------------------------------------------------------------------------------------
 
-void point_segment_distance( bool update, 
-                            const Vec2d &x0, unsigned int index0, 
-                            const Vec2d &x1, unsigned int index1, 
-                            const Vec2d &x2, unsigned int index2, 
-                            double &distance )
+bool segment_segment_intersection(const Vec2d& x0, size_t , 
+                                  const Vec2d& x1, size_t ,
+                                  const Vec2d& x2, size_t ,
+                                  const Vec2d& x3, size_t )
 {
-   check_point_edge_proximity( update, x0, x1, x2, distance );
+    double s0, s2;
+    return check_edge_edge_intersection( x0, x1, x2, x3, s0, s2, g_collision_epsilon );
 }
 
-void point_segment_distance( bool update, 
-                            const Vec2d &x0, unsigned int index0, 
-                            const Vec2d &x1, unsigned int index1, 
-                            const Vec2d &x2, unsigned int index2, 
-                            double &distance, double &s, Vec2d &normal, double normal_multiplier )
+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 )
 {
-   check_point_edge_proximity( update, x0, x1, x2, distance, s, normal, normal_multiplier );
+    return check_edge_edge_intersection( x0, x1, x2, x3, s0, s2, g_collision_epsilon );
 }
 
 
-
 // --------------------------------------------------------------------------------------------------
 // 3D Continuous collision detection
 // --------------------------------------------------------------------------------------------------
@@ -100,54 +620,57 @@ void point_segment_distance( bool update,
 // --------------------------------------------------------------------------------------------------
 
 
-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 )
+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  )
 {   
-   return check_point_triangle_collision( x0, x1, x2, x3, xnew0, xnew1, xnew2, xnew3, collision_epsilon );
+    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, 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,
+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& t,
-                              double& relative_normal_displacement,
-                              bool verbose )
+                              double& relative_normal_displacement )
 {
-   bool result = check_point_triangle_collision( x0, x1, x2, x3, 
-                                                xnew0, xnew1, xnew2, xnew3,
-                                                bary1, bary2, bary3,
-                                                normal, t, 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 result;   
+    
+    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, 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)
+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 )
 {
-   
-   return check_edge_edge_collision( x0, x1, x2, x3,
-                                    xnew0, xnew1, xnew2, xnew3,
-                                    collision_epsilon );
-   
+    
+    bool cubic_result = check_edge_edge_collision( x0, x1, x2, x3,
+                                                  xnew0, xnew1, xnew2, xnew3,
+                                                  g_collision_epsilon );
+    
+    return cubic_result;
+    
 }
 
 
@@ -155,31 +678,31 @@ bool segment_segment_collision(const Vec3d& x0, const Vec3d& xnew0, unsigned int
 
 
 
-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,
+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& t,
-                               double& relative_normal_displacement,
-                               bool verbose )
+                               double& relative_normal_displacement )
 {
-   bool result = check_edge_edge_collision( x0, x1, x2, x3,
-                                           xnew0, xnew1, xnew2, xnew3,
-                                           bary0, bary2,
-                                           normal, t, 
-                                           collision_epsilon );
-   
-   Vec3d dx0 = xnew0 - x0;
-   Vec3d dx1 = xnew1 - x1;
-   Vec3d dx2 = xnew2 - x2;
-   Vec3d dx3 = xnew3 - x3;   
-   
-   if (relative_normal_displacement)
-	   relative_normal_displacement = dot( normal, bary0*dx0 + (1.0-bary0)*dx1 - bary2*dx2 - (1.0-bary2)*dx3 );
-   
-   return result;   
+    
+    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;
+    
 }
 
 
@@ -189,117 +712,46 @@ bool segment_segment_collision(const Vec3d& x0, const Vec3d& xnew0, unsigned int
 
 // --------------------------------------------------------------------------------------------------
 
-
 // x0-x1 is the segment and and x2-x3-x4 is the triangle.
-bool segment_triangle_intersection(const Vec3d& x0, unsigned int index0,
-                                   const Vec3d& x1, unsigned int index1,
-                                   const Vec3d& x2, unsigned int index2,
-                                   const Vec3d& x3, unsigned int index3,
-                                   const Vec3d& x4, unsigned int index4,
-                                   bool degenerate_counts_as_intersection,
-                                   bool verbose )
-{
-   return check_edge_triangle_intersection( x0, x1, x2, x3, x4, collision_epsilon, degenerate_counts_as_intersection, verbose );   
-}
-
-
-// --------------------------------------------------------------------------------------------------
-
-
-// x0 is the point and x1-x2-x3-x4 is the tetrahedron. Order is irrelevant.
-bool point_tetrahedron_intersection(const Vec3d& x0, unsigned int index0,
-                                    const Vec3d& x1, unsigned int index1,
-                                    const Vec3d& x2, unsigned int index2,
-                                    const Vec3d& x3, unsigned int index3,
-                                    const Vec3d& x4, unsigned int index4)
-{
-   return vertex_is_in_tetrahedron( x0, x1, x2, x3, x4, collision_epsilon );
-}
-
-
-// --------------------------------------------------------------------------------------------------
-// 3D Static distance
-// --------------------------------------------------------------------------------------------------
-
-// --------------------------------------------------------------------------------------------------
-
-
-void point_segment_distance( bool update, 
-                            const Vec3d &x0, unsigned int index0,
-                            const Vec3d &x1, unsigned int index1,
-                            const Vec3d &x2, unsigned int index2,
-                            double &distance)
+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  )
 {
-   check_point_edge_proximity( update, x0, x1, x2, distance);   
-}
-
-// --------------------------------------------------------------------------------------------------
-
-void point_segment_distance( bool update, 
-                            const Vec3d &x0, unsigned int index0,
-                            const Vec3d &x1, unsigned int index1,
-                            const Vec3d &x2, unsigned int index2,
-                            double &distance, double &s, Vec3d &normal, double normal_multiplier )
-{
-   check_point_edge_proximity( update, x0, x1, x2, distance, s, normal, normal_multiplier );
+    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] );
 }
 
 
 // --------------------------------------------------------------------------------------------------
 
-
-void point_triangle_distance( const Vec3d& x0, unsigned int index0,
-                             const Vec3d& x1, unsigned int index1,
-                             const Vec3d& x2, unsigned int index2,
-                             const Vec3d& x3, unsigned int index3,
-                             double& distance )
+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  )
 {
-   check_point_triangle_proximity( x0, x1, x2, x3, distance );
+    return simplex_intersection3d( 2, x0.v, x1.v, x2.v, x3.v, x4.v, &bary0, &bary1, &bary2, &bary3, &bary4 );
 }
 
-// --------------------------------------------------------------------------------------------------
-
-
-void point_triangle_distance( const Vec3d& x0, unsigned int index0,
-                             const Vec3d& x1, unsigned int index1,
-                             const Vec3d& x2, unsigned int index2,
-                             const Vec3d& x3, unsigned int index3,
-                             double& distance, 
-                             double& bary1, double& bary2, double& bary3, 
-                             Vec3d& normal )
-{
-   check_point_triangle_proximity( x0, x1, x2, x3, distance, bary1, bary2, bary3, normal );
-}
-
-// --------------------------------------------------------------------------------------------------
-
-void segment_segment_distance( const Vec3d& x0, unsigned int index0,
-                              const Vec3d& x1, unsigned int index1,
-                              const Vec3d& x2, unsigned int index2,
-                              const Vec3d& x3, unsigned int index3,
-                              double& distance  )
-{
-   check_edge_edge_proximity( x0, x1, x2, x3, distance );
-}
 
 // --------------------------------------------------------------------------------------------------
 
-void segment_segment_distance( const Vec3d& x0, unsigned int index0,
-                              const Vec3d& x1, unsigned int index1,
-                              const Vec3d& x2, unsigned int index2,
-                              const Vec3d& x3, unsigned int index3,
-                              double& distance, 
-                              double& bary0, double& bary2,
-                              Vec3d& normal )
-{
-   check_edge_edge_proximity( x0, x1, x2, x3, distance, bary0, bary2, normal );
-}
-
-// --------------------------------------------------------------------------------------------------
-
-double tetrahedron_signed_volume(const Vec3d &x0, const Vec3d &x1, const Vec3d &x2, const Vec3d &x3)
+// 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 )
 {
-   return signed_volume( x0, x1, x2, x3 );
+    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/fileio.cpp b/extern/eltopo/common/fileio.cpp
index b901381..00c9f5e 100644
--- a/extern/eltopo/common/fileio.cpp
+++ b/extern/eltopo/common/fileio.cpp
@@ -1,11 +1,9 @@
-/*
- *  fileio.cpp
- *  eltopo3d_project
- *
- *  Created by Tyson Brochu on 19/09/09.
- *  Copyright 2009 __MyCompanyName__. All rights reserved.
- *
- */
+// ---------------------------------------------------------
+//
+//  fileio.cpp
+//  Tyson Brochu 2009
+//
+// ---------------------------------------------------------
 
 #include "fileio.h"
 
@@ -28,40 +26,40 @@ bool write_mesh_file( double curr_t,
                      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();
+    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();
 }
 
 
@@ -71,54 +69,54 @@ bool write_mesh_file( double curr_t,
 ///
 // ---------------------------------------------------------
 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, ...)
+                                     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();
+    
+    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();
 }
 
 
@@ -129,56 +127,56 @@ bool write_mesh_file_with_velocities( double curr_t,
 // ---------------------------------------------------------
 
 bool read_mesh_file( double* curr_t,
-                     unsigned int* nverts,
-                     double** verts,
-                     double** masses,
-                     unsigned int* ntris,
-                     unsigned int** tris,
-                     const char *filename_format, ...)
+                    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();
+    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();
 }
 
 
@@ -189,67 +187,67 @@ bool read_mesh_file( double* curr_t,
 // ---------------------------------------------------------
 
 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, ...)
+                                    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();
-   
+    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();
+    
 }
 
 
@@ -263,9 +261,9 @@ void free_mesh_data( double* verts,
                     double* masses,
                     unsigned int* tris )
 {
-   delete[] verts;
-   delete[] masses;
-   delete[] tris;
+    delete[] verts;
+    delete[] masses;
+    delete[] tris;
 }
 
 
@@ -280,10 +278,10 @@ void free_mesh_data_with_velocities( double* verts,
                                     double* masses,
                                     unsigned int* tris )
 {
-   delete[] verts;
-   delete[] velocities;
-   delete[] masses;
-   delete[] tris;
+    delete[] verts;
+    delete[] velocities;
+    delete[] masses;
+    delete[] tris;
 }
 
 // ---------------------------------------------------------
@@ -302,26 +300,26 @@ 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();
+    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();
 }
 
 
@@ -336,33 +334,33 @@ 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();
-   
+    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();
+    
 }
 
 // ---------------------------------------------------------
@@ -373,10 +371,10 @@ bool read_raytracer_file( bool **booleanParameters,
 
 
 void free_raytracer_data( bool *booleanParameters, 
-                          float *floatParameters )
+                         float *floatParameters )
 {
-   delete[] booleanParameters;
-   delete[] floatParameters;
+    delete[] booleanParameters;
+    delete[] floatParameters;
 }
 
 
@@ -390,24 +388,24 @@ 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 ( unsigned 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();
+    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();
 }
 
 
@@ -421,32 +419,32 @@ 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 ( unsigned 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();
+    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();
 }
 
 
@@ -459,7 +457,7 @@ bool read_marker_particle_file( int* nparticles,
 
 void free_marker_particle_data( float* x )
 {
-   delete[] x;
+    delete[] x;
 }
 
 
diff --git a/extern/eltopo/common/fileio.h b/extern/eltopo/common/fileio.h
index cab35a9..6b31b1e 100644
--- a/extern/eltopo/common/fileio.h
+++ b/extern/eltopo/common/fileio.h
@@ -5,125 +5,125 @@
 #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
-//
-// -----------------------------------------------------------------------
-   
+    
+    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
diff --git a/extern/eltopo/common/gluvi.cpp b/extern/eltopo/common/gluvi.cpp
index 77be1f7..6f2cca9 100644
--- a/extern/eltopo/common/gluvi.cpp
+++ b/extern/eltopo/common/gluvi.cpp
@@ -1,9 +1,20 @@
+
 #include <cmath>
 #include <cstdarg>
 #include <cstdlib>
 #include <fstream>
-#include "gluvi.h"
-#include "vec.h"
+#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
@@ -11,1119 +22,1286 @@
 
 using namespace std;
 
-#if 0
 namespace Gluvi{
-
-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::
-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);
-
-   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();
-   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 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;
+    
+    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();
-            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;
-            }
+            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();
-            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]);
-}
-
-//=================================================================================
-
-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);
-}
-*/
-   
-//=================================================================================
-
-static void gluviReshape(int w, int h)
-{
-   winwidth=w;
-   winheight=h;
-   glutPostRedisplay(); // triggers the camera to adjust itself to the new dimensions
-}
-
-//=================================================================================
-
-static 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();
-}
-
-//=================================================================================
-
-static enum {NOBODY, CAMERA, WIDGETS, USER} mouse_owner=NOBODY;
-
-static 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;
-   }
-}
-
-//=================================================================================
-
-static 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
-   }
-}
-
-//=================================================================================
-
-void ppm_screenshot(const char *filename_format, ...)
-{
-   va_list ap;
-   va_start(ap, filename_format);
+        }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);
+        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);
+        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;
-}
-
-static void write_big_endian_ushort(std::ostream &output, unsigned short v)
-{
-   output.put((v>>8)%256);
-   output.put(v%256);
-}
-
-static void write_big_endian_uint(std::ostream &output, unsigned int v)
-{
-   output.put((v>>24)%256);
-   output.put((v>>16)%256);
-   output.put((v>>8)%256);
-   output.put(v%256);
-}
-
-void sgi_screenshot(const char *filename_format, ...)
-{
-   va_list ap;
-   va_start(ap, filename_format);
+        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);
+        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);
+        char *filename;
+        vasprintf(&filename, filename_format, ap);
+        ofstream output(filename, ofstream::binary);
 #endif
-   if(!output) return;
-   // 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
-   write_big_endian_ushort(output, winwidth); // x size
-   write_big_endian_ushort(output, winheight); // 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
-   GLubyte *image_buffer=new GLubyte[winwidth*winheight];
-   glReadBuffer(GL_FRONT);
-   glReadPixels(0, 0, winwidth, winheight, GL_RED, GL_UNSIGNED_BYTE, image_buffer);
-   output.write((const char*)image_buffer, winwidth*winheight);
-   glReadPixels(0, 0, winwidth, winheight, GL_GREEN, GL_UNSIGNED_BYTE, image_buffer);
-   output.write((const char*)image_buffer, winwidth*winheight);
-   glReadPixels(0, 0, winwidth, winheight, GL_BLUE, GL_UNSIGNED_BYTE, image_buffer);
-   output.write((const char*)image_buffer, winwidth*winheight);
-   delete[] image_buffer;
+        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);
+        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));
+    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);
+        }
+    }
     
-    // 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);
+    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();
+        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();
+    }
     
-    //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!
-}
-
-//=================================================================================
-
-void init(const char *windowtitle, int *argc, char **argv)
-{
-   glutInit(argc, argv);
-   glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA|GLUT_ALPHA|GLUT_DEPTH);
-   glutInitWindowSize(winwidth, winheight);
-   glutCreateWindow(windowtitle);
-   glutReshapeFunc(gluviReshape);
-   glutDisplayFunc(gluviDisplay);
-   glutMouseFunc(gluviMouse);
-   glutMotionFunc(gluviDrag);
-   glEnable(GL_DEPTH_TEST);
-   glClearColor(0, 0, 0, 0);
-   glClearDepth(1);
-   glPixelStorei(GL_PACK_ALIGNMENT, 1);
-   glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-   
-   glBlendFunc (GL_SRC_ALPHA_SATURATE, GL_ONE);
-   glClearColor (0.0f, 0.0f, 0.0f, 0.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
 
-#endif
diff --git a/extern/eltopo/common/gluvi.h b/extern/eltopo/common/gluvi.h
index 8b6ffd1..e2de945 100644
--- a/extern/eltopo/common/gluvi.h
+++ b/extern/eltopo/common/gluvi.h
@@ -1,215 +1,234 @@
 #ifndef GLUVI_H
 #define GLUVI_H
 
-//#include <iostream>
-//#include <vector>
+#include <iostream>
+#include <vector>
 
-#ifdef USE_GUI
 #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
-#endif
-
-//#include "vec.h"
 
 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 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, float heading_=0, float pitch_=0, float height_factor_=1,
-                 float near_clip_factor_=0.01, float far_clip_factor_=100);
-   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 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);
-#ifdef USE_GUI
-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);
-#endif
-//@@@@@@@ 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;
-
-// then after setting the Gluvi state and doing any of your own set-up, call run()
-void run(void);
-
+    
+    // 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
index 0b17f84..37b16b0 100644
--- a/extern/eltopo/common/grid3.h
+++ b/extern/eltopo/common/grid3.h
@@ -1,13 +1,13 @@
 #ifndef GRID3_H
 #define GRID3_H
 
-#include "vec.h"
+#include <vec.h>
 
 template<class T>
 struct Grid3
 {
-   Vec<3,T> origin;
-   T dx, over_dx;
+    Vec<3,T> origin;
+    T dx, over_dx;
 };
 
 typedef Grid3<float> Grid3f;
diff --git a/extern/eltopo/common/hashtable.h b/extern/eltopo/common/hashtable.h
index bcbeb5c..bbb0ae9 100644
--- a/extern/eltopo/common/hashtable.h
+++ b/extern/eltopo/common/hashtable.h
@@ -8,11 +8,11 @@
 template<class Key, class Data>
 struct HashEntry
 {
-   HashEntry() : key(), data(), next(~0) {}
-   
-   Key key;
-   Data data;
-   int next;
+    HashEntry() : key(), data(), next(~0) {}
+    
+    Key key;
+    Data data;
+    int next;
 };
 
 // a useful core hash function
@@ -22,230 +22,230 @@ inline unsigned int hash(unsigned int k)
 // default hash function object
 struct DefaultHashFunction
 {
-   template<typename Key>
-   unsigned int operator() (const Key &k) const { return hash(k); }
+    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 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(~0), table_bits(~0), table(0), num_entries(~0), pool(), free_list(~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;
+    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;
-         }
-         ++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;
-   }
+        }
+        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
index d87265e..9d4dab0 100644
--- a/extern/eltopo/common/lapack_wrapper.h
+++ b/extern/eltopo/common/lapack_wrapper.h
@@ -5,232 +5,238 @@
 // as well as versions with stride==1 assumed.
 // For the moment, no complex number support, and most routines have been dropped.
 
-namespace LAPACK{
-
-// ---------------------------------------------------------
-//  Interface 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 << 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;
-   
-}
+#include <cmath>
+#include <iostream>
 
-inline void solve_least_squares(char trans, int m, int n, int nrhs, double*a, int lda, double*b, int ldb, int& info ) 
-{
-   simple_least_squares_svd( m, n, nrhs, a, lda, b, info );
-}
+using std::max;
+using std::min;
 
-// end of platform-independent code
-   
-// ---------------------------------------------------------
-//  Inline function definitions --- Apple
-// ---------------------------------------------------------
-   
+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 );
-}
-
+#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
-// ---------------------------------------------------------
-   
+    
+    
+    // ---------------------------------------------------------
+    //  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 );
+    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 );
-}   
-
-
+    
+    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/lexer.cpp b/extern/eltopo/common/lexer.cpp
new file mode 100644
index 0000000..1345f0c
--- /dev/null
+++ b/extern/eltopo/common/lexer.cpp
@@ -0,0 +1,361 @@
+#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
new file mode 100644
index 0000000..8eecd1d
--- /dev/null
+++ b/extern/eltopo/common/lexer.h
@@ -0,0 +1,41 @@
+#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/makelevelset3.cpp b/extern/eltopo/common/makelevelset3.cpp
index 605396d..ed2ff9a 100644
--- a/extern/eltopo/common/makelevelset3.cpp
+++ b/extern/eltopo/common/makelevelset3.cpp
@@ -1,186 +1,190 @@
-#include "makelevelset3.h"
+#include <makelevelset3.h>
 
-// find distance x0 is from segment x1-x2
-static 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
-static 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));
-   }
-}
-
-static void check_neighbour(const std::vector<Vec3ui> &tri, const std::vector<Vec3d> &x,
-                            Array3d &phi, Array3i &closest_tri,
-                            const Vec3d &gx, int i0, int j0, int k0, int i1, int j1, int k1)
-{
-   if(closest_tri(i1,j1,k1)>=0){
-      unsigned int 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);
-      }
-   }
-}
-
-static void sweep(const std::vector<Vec3ui> &tri, const std::vector<Vec3d> &x,
-                  Array3d &phi, Array3i &closest_tri, const Vec3d &origin, double dx,
-                  int di, int dj, int dk)
-{
-   int i0, i1;
-   if(di>0){ i0=1; i1=phi.ni; }
-   else{ i0=phi.ni-2; i1=-1; }
-   int j0, j1;
-   if(dj>0){ j0=1; j1=phi.nj; }
-   else{ j0=phi.nj-2; j1=-1; }
-   int k0, k1;
-   if(dk>0){ k0=1; k1=phi.nk; }
-   else{ k0=phi.nk-2; k1=-1; }
-   for(int k=k0; k!=k1; k+=dk) for(int j=j0; j!=j1; j+=dj) for(int 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)
-static 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
-}
+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
 
-// 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.
-static 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;
-}
-
-void make_level_set3(const std::vector<Vec3ui> &tri, const std::vector<Vec3d> &x,
+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){
-      unsigned int 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
-         }
-      }
-   }
+    
+    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
index 2fdccda..fc934aa 100644
--- a/extern/eltopo/common/makelevelset3.h
+++ b/extern/eltopo/common/makelevelset3.h
@@ -1,24 +1,28 @@
 #ifndef MAKELEVELSET3_H
 #define MAKELEVELSET3_H
 
-#include "array3.h"
-#include "vec.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<Vec3ui> &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=1 );
 
-inline void make_level_set3(const std::vector<Vec3ui> &tri, const std::vector<Vec3d> &x,
+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=1 )
+                     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 );
+    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
new file mode 100644
index 0000000..9f2466b
--- /dev/null
+++ b/extern/eltopo/common/marching_tiles_hires.cpp
@@ -0,0 +1,405 @@
+#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
new file mode 100644
index 0000000..98a2889
--- /dev/null
+++ b/extern/eltopo/common/marching_tiles_hires.h
@@ -0,0 +1,37 @@
+#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/mat.h b/extern/eltopo/common/mat.h
index 0c17d66..7fcfb87 100644
--- a/extern/eltopo/common/mat.h
+++ b/extern/eltopo/common/mat.h
@@ -1,183 +1,184 @@
 #ifndef MAT_H
 #define MAT_H
- 
-#include "vec.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){
+    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;
-            pb=b.a+N*k;
+            pv=v.v;
             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;
-   }
+            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;
@@ -200,83 +201,83 @@ typedef Mat<4,4,int>    Mat44i;
 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;
+    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;
+    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;
+    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));
+    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;
+    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;
+    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);
+    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;
-   }
+    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
@@ -284,34 +285,34 @@ void signed_polar_decomposition(const Mat<2,2,T>& F, Mat<2,2,T>& Q, Mat<2,2,T>&
 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; }
+    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));
+    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
@@ -319,9 +320,9 @@ inline T determinant(const Mat<3,3,T> &mat)
 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;
+    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
@@ -329,136 +330,149 @@ void symmetric_eigenproblem(const Mat<2,2,T>& A, Mat<2,2,T>& Q, Vec<2,T>& D)
 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);
+    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);
+    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;
-   }
+    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))
-                     );
+    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
index 0b54b54..53c2f6a 100644
--- a/extern/eltopo/common/matlapack.h
+++ b/extern/eltopo/common/matlapack.h
@@ -7,18 +7,18 @@
 template<unsigned int M, unsigned int N, class T>
 void invert(Mat<M,N,T>& matrix) {
 	assert(M==N);
-   static int ipiv[M];
+    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);
+    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/newparser.cpp b/extern/eltopo/common/newparser.cpp
new file mode 100644
index 0000000..9f70626
--- /dev/null
+++ b/extern/eltopo/common/newparser.cpp
@@ -0,0 +1,195 @@
+#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
new file mode 100644
index 0000000..7bb01fd
--- /dev/null
+++ b/extern/eltopo/common/newparser.h
@@ -0,0 +1,42 @@
+#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
index e027ada..2d09846 100644
--- a/extern/eltopo/common/newsparse/dense_matrix.cpp
+++ b/extern/eltopo/common/newsparse/dense_matrix.cpp
@@ -1,92 +1,92 @@
-#include <cstring>
+#include <dense_matrix.h>
 #include <blas_wrapper.h>
-#include "dense_matrix.h"
+#include <cstring>
 
 void DenseMatrix::
 clear(void)
 {
-   m=n=0;
-   value.clear();
+    m=n=0;
+    value.clear();
 }
 
 void DenseMatrix::
 set_zero(void)
 {
-   BLAS::set_zero(value);
+    BLAS::set_zero(value);
 }
 
 void DenseMatrix::
 resize(int m_, int n_)
 {
-   m=m_; n=n_;
-   value.resize(m*n, 0);
+    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);
+    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);
+    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);
+    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);
+    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);
+    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);
-   }
+    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]);
+    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);
+    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
index a7f7a16..5a147c4 100644
--- a/extern/eltopo/common/newsparse/dense_matrix.h
+++ b/extern/eltopo/common/newsparse/dense_matrix.h
@@ -1,47 +1,47 @@
 #ifndef DENSE_MATRIX_H
 #define DENSE_MATRIX_H
 
-#include "linear_operator.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;
+    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);
diff --git a/extern/eltopo/common/newsparse/krylov_solvers.cpp b/extern/eltopo/common/newsparse/krylov_solvers.cpp
index bc65501..61b5867 100644
--- a/extern/eltopo/common/newsparse/krylov_solvers.cpp
+++ b/extern/eltopo/common/newsparse/krylov_solvers.cpp
@@ -1,5 +1,5 @@
+#include <krylov_solvers.h>
 #include <blas_wrapper.h>
-#include "krylov_solvers.h"
 #include <cassert>
 
 //============================================================================
@@ -7,52 +7,52 @@ 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;
+    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;
 }
 
 //============================================================================
@@ -60,56 +60,56 @@ 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;
+    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;
 }
 
 //============================================================================
@@ -117,59 +117,59 @@ 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;
+    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
index 67406da..242a91b 100644
--- a/extern/eltopo/common/newsparse/krylov_solvers.h
+++ b/extern/eltopo/common/newsparse/krylov_solvers.h
@@ -1,12 +1,12 @@
 #ifndef KRYLOV_SOLVERS_H
 #define KRYLOV_SOLVERS_H
 
-#include "linear_operator.h"
+#include <linear_operator.h>
 
 enum KrylovSolverStatus{
-   KRYLOV_CONVERGED,
-   KRYLOV_EXCEEDED_MAX_ITERATIONS,
-   KRYLOV_BREAKDOWN
+    KRYLOV_CONVERGED,
+    KRYLOV_EXCEEDED_MAX_ITERATIONS,
+    KRYLOV_BREAKDOWN
 };
 
 //============================================================================
@@ -15,24 +15,24 @@ enum KrylovSolverStatus{
 // 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);
+    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);
 };
 
 //============================================================================
@@ -41,24 +41,24 @@ struct CG_Solver
 // 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);
+    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);
 };
 
 //============================================================================
@@ -68,25 +68,25 @@ struct MINRES_CR_Solver
 // 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);
+    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
index 7501251..4c094bb 100644
--- a/extern/eltopo/common/newsparse/linear_operator.h
+++ b/extern/eltopo/common/newsparse/linear_operator.h
@@ -1,92 +1,92 @@
 #ifndef LINEAR_OPERATOR_H
 #define LINEAR_OPERATOR_H
 
+#include <cassert>
 #include <iostream>
 #include <vector>
-#include <cassert>
 
 // 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;
-   }
+    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
+    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
index 50abd46..fb25a94 100644
--- a/extern/eltopo/common/newsparse/sparse_matrix.cpp
+++ b/extern/eltopo/common/newsparse/sparse_matrix.cpp
@@ -1,246 +1,246 @@
+#include <sparse_matrix.h>
+#include <util.h>
 
-#include "util.h"
-#include "sparse_matrix.h"
 
 //============================================================================
 void SparseMatrixDynamicCSR::
 clear(void)
 {
-   m=n=0;
-   row.clear();
+    m=n=0;
+    row.clear();
 }
 
 void SparseMatrixDynamicCSR::
 set_zero(void)
 {
-   for(int i=0; i<m; ++i) row[i].clear();
+    for(int i=0; i<m; ++i) row[i].clear();
 }
 
 void SparseMatrixDynamicCSR::
 resize(int m_, int n_)
 {
-   m=m_;
-   n=n_;
-   row.resize(m);
+    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;
+    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;
+    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));
+    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;
-   }
+    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;
-   }
+    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;
-   }
+    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;
-   }
+    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;
+    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)
-{
-   int nnz=0;
-   for(int i=0; i<m; ++i){
-      nnz+=matrix.row[i].size();
-      rowstart[i+1]=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;
-      }
-   }
+: 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();
+    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);
+    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());
-   }
+    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;
+    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;
-   }
+    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;
-   }
+    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;
+    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
index ee0fa21..782c373 100644
--- a/extern/eltopo/common/newsparse/sparse_matrix.h
+++ b/extern/eltopo/common/newsparse/sparse_matrix.h
@@ -4,20 +4,20 @@
 // Definitions for a variety of sparse matrix formats.
 // By default everything keeps entries in sorted order, with no duplicates.
 
-#include "linear_operator.h"
-#include <list>
 #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; }
+    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;
@@ -29,74 +29,74 @@ typedef std::list<SparseEntry> DynamicSparseVector;
 // 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;
+    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;
+    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;
-   }
+    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;
-   }
+    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;
+    }
 }
 
 
diff --git a/extern/eltopo/common/predicates.cpp b/extern/eltopo/common/predicates.cpp
index e2a5f5c..84e069e 100644
--- a/extern/eltopo/common/predicates.cpp
+++ b/extern/eltopo/common/predicates.cpp
@@ -1,5 +1,5 @@
 #include <cfloat>
-#include "predicates.h"
+#include <predicates.h>
 
 #if defined(_WIN32) && !defined(FREE_WINDOWS)
 #define random() rand() // not sure if this define is valid
@@ -8,34 +8,34 @@
 
 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);
+    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;   
+    print_hex( v[0] );
+    std::cout << " ";
+    print_hex( v[1] );
+    std::cout << " ";
+    print_hex( v[2] );
+    std::cout << std::endl;   
 }
 
 
@@ -54,47 +54,47 @@ static double orient(const Vec2d& x0, bool end0,
                      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;
+    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;
+    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,
@@ -103,132 +103,136 @@ static bool segment_triangle_intersection(const Vec2d& x0, const Vec2d& xnew0,
                                           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));
+    // 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));
+                                          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)
+                                const Vec2d& x1, const Vec2d& xnew1,
+                                const Vec2d& x2, const Vec2d& xnew2)
 {
-   if(segment_triangle_intersection(x0, xnew0, x1, false, x2, false, xnew1, true)) return true;
-   if(segment_triangle_intersection(x0, xnew0, x2, false, xnew2, true, xnew1, true)) return true;
-   return false;
+    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 collision = 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
-      collision = 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;
-      
-      if ( !collision || bary < t )
-      {
-         // collision happens in triangle with two "new" points
-         collision = true;
-         edge_bary = 0.5;
-         t = bary;
-         normal = perp( xnew2 - xnew1 );
-         normal /= mag(normal);
-         relative_normal_displacement=dot( normal, (xnew0-x0) - (xnew2-x2) );         
-      }
-   }
-   
-   return collision;
-   
+                                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]);
+    
 }
 
 
@@ -239,40 +243,59 @@ 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;
+    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]);
+    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;
+    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;
 }
 
 //=======================================================================================================
@@ -281,9 +304,9 @@ 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]);
+    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!
@@ -291,17 +314,17 @@ 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]);
+    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;
+    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
@@ -314,84 +337,84 @@ static void orient(const Vec3d& x0, bool end0,
                    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);
+    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);
 }
 
 //=======================================================================================================
@@ -399,32 +422,32 @@ static void orient(const Vec3d& x0, bool end0,
 // 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;
+    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;
 }
 
 //=======================================================================================================
@@ -436,28 +459,28 @@ static bool segment_triangle_intersection(const Vec3d& x0, const Vec3d& xnew0,
                                           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);
+    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);
 }
 
 //=======================================================================================================
@@ -466,25 +489,25 @@ 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 verbose)
-{
-   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);
+                                             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,
@@ -494,154 +517,155 @@ static bool segment_tetrahedron_intersection(const Vec3d& x0, const Vec3d& xnew0
                                              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]=end1/(double)(end1+end2+end3+end4);
-      bary[3]=end2/(double)(end1+end2+end3+end4);
-      bary[4]=end3/(double)(end1+end2+end3+end4);
-      bary[5]=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;
+    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)
+                                 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;
+    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& t,
-                              double& relative_normal_displacement,
-                              bool verbose )
-{
-
-   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;
+                                 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;
 }
 
 
@@ -654,28 +678,28 @@ static bool triangle_triangle_intersection(const Vec3d& x0, bool end0,
                                            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;
+    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,
@@ -686,140 +710,141 @@ static bool triangle_triangle_intersection(const Vec3d& x0, bool end0,
                                            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]=end0/(double)(end0+end1+end2);
-      bary[1]=end1/(double)(end0+end1+end2);
-      bary[2]=end2/(double)(end0+end1+end2);
-      bary[3]=end3/(double)(end3+end4+end5);
-      bary[4]=end4/(double)(end3+end4+end5);
-      bary[5]=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;
+    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)
+                                  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;
+    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& t,
-                               double& relative_normal_displacement,
-                               bool verbose )
-{
-   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((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( (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;
+                                  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;
 }
 
 
@@ -829,17 +854,17 @@ 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]),
+    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]),
+    && fe_segment_segment_intersection(Vec2d(x0[1],x0[2]),
                                        Vec2d(x1[1],x1[2]),
                                        Vec2d(x2[1],x2[2]),
                                        Vec2d(x3[1],x3[2]));
@@ -847,62 +872,76 @@ static bool segment_segment_intersection(const Vec3d& x0, const Vec3d& x1,
 
 
 bool fe_segment_triangle_intersection(const Vec3d& x0, const Vec3d& x1,
-                                   const Vec3d& x2, const Vec3d& x3, const Vec3d& x4, 
-                                   bool /*unused in this version*/,
-                                   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
-   double s=check_error(d1234, p1234, 9), t=-check_error(d0234, p0234, 9);
-   if((s<0 && t>0) || (s>0 && t<0)) return false;
-   double 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);
+                                      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);
+    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);
 }
 
 
@@ -910,60 +949,60 @@ 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]));
+    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);
+                                       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
index b08e4a1..4a21090 100644
--- a/extern/eltopo/common/predicates.h
+++ b/extern/eltopo/common/predicates.h
@@ -1,7 +1,7 @@
 #ifndef PREDICATES_H
 #define PREDICATES_H
 
-#include "vec.h"
+#include <vec.h>
 
 const int MAX_COORD_2D=619925131;
 const int MAX_COORD_3D=577053;
@@ -14,61 +14,75 @@ const int MAX_COORD_3D=577053;
 
 // 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);
+                                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);
+                                     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);
+                                 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& t,
-                              double& relative_normal_displacement,
-                              bool verbose = false );
+                                 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);
+                                  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& t,
-                               double& relative_normal_displacement,
-                               bool verbose = false );
+                                  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 );
+                                      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);
+                                       const Vec3d& x2, const Vec3d& x3, const Vec3d& x4);
 
 #endif
diff --git a/extern/eltopo/common/runstats.cpp b/extern/eltopo/common/runstats.cpp
new file mode 100644
index 0000000..a8bdf22
--- /dev/null
+++ b/extern/eltopo/common/runstats.cpp
@@ -0,0 +1,239 @@
+/*
+ *  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
new file mode 100644
index 0000000..9b6a408
--- /dev/null
+++ b/extern/eltopo/common/runstats.h
@@ -0,0 +1,90 @@
+/*
+ *  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 _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/tunicate/expansion.cpp b/extern/eltopo/common/tunicate/expansion.cpp
index 74cf2f9..2451d67 100644
--- a/extern/eltopo/common/tunicate/expansion.cpp
+++ b/extern/eltopo/common/tunicate/expansion.cpp
@@ -1,66 +1,110 @@
 // Released into the public-domain by Robert Bridson, 2009.
 
+#include <expansion.h>
+
+#include <bitset>
+#include <cassert>
 #include <cmath>
-#include "expansion.h"
+#if defined(_WIN32) && !defined(FREE_WINDOWS)
+#include <float.h>
+#else
+#include <fenv.h>
+#endif
+#include <iostream>
+#include <string.h>
 
-#define assert
+#if defined(_WIN32) && !defined(FREE_WINDOWS)
+#include "BaseTsd.h"
+typedef SSIZE_T ssize_t;
+#endif
 
-//==============================================================================
-static 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|
-static void
-fast_two_sum(double a,
-             double b,
-             double& x,
-             double& y)
-{
-   assert(std::fabs(a)>=std::fabs(b));
-   x=a+b;
-   y=(a-x)+b;
-}
+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
+
 
 //==============================================================================
-static void
-split(double a,
-      double& x,
-      double& y)
+bool
+is_zero( const expansion& a )
 {
-   double c=134217729*a;
-   x=c-(c-a);
-   y=a-x;
+    return ( a.v.size() == 0 );
 }
 
+
 //==============================================================================
-static void
-two_product(double a,
-            double b,
-            double& x,
-            double& y)
+int 
+sign( const expansion& a )
 {
-   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);
+    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[1], sum[0]);
+    sum.resize(2);
+    two_sum(a, b, sum.v[1], sum.v[0]);
 }
 
 //==============================================================================
@@ -68,14 +112,14 @@ add(double a, double b, expansion& sum)
 void
 add(const expansion& a, double b, expansion& sum)
 {
-   unsigned int m=a.size();
-   sum.reserve(m+1);
-   double s;
-   for(unsigned int i=0; i<m; ++i){
-      two_sum(b, a[i], b, s);
-      if(s) sum.push_back(s);
-   }
-   sum.push_back(b);
+    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);
 }
 
 //==============================================================================
@@ -83,152 +127,408 @@ add(const expansion& a, double b, expansion& sum)
 void
 add(const expansion& a, const expansion& b, expansion& sum)
 {
-   /* slow but obvious way of doing it
-   add(a, b[0], sum);
-   for(unsigned int i=1; i<b.size(); ++i)
-      add(sum, b[i], sum); // aliasing sum is safe
-   */
-   // Shewchuk's fast-expansion-sum
-   if(a.empty()){
-      sum=b;
-      return;
-   }else if(b.empty()){
-      sum=a;
-      return;
-   }
-   expansion merge(a.size()+b.size(), 0);
-   unsigned int i=0, j=0, k=0;
-   for(;;){
-      if(std::fabs(a[i])<std::fabs(b[j])){
-         merge[k++]=a[i++];
-         if(i==a.size()){
-            while(j<b.size()) merge[k++]=b[j++];
-            break;
-         }
-      }else{
-         merge[k++]=b[j++];
-         if(j==b.size()){
-            while(i<a.size()) merge[k++]=a[i++];
-            break;
-         }
-      }
-   }
-   sum.reserve(merge.size());
-   sum.resize(0);
-   double q, r;
-   fast_two_sum(merge[1], merge[0], q, r);
-   if(r) sum.push_back(r);
-   for(i=2; i<merge.size(); ++i){
-      two_sum(q, merge[i], q, r);
-      if(r) sum.push_back(r);
-   }
-   if(q) sum.push_back(q);
+    
+    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);
+    // could improve this a bit!
+    expansion c;
+    negative(b, c);
+    add(a, c, difference);
 }
 
 //==============================================================================
 void
 negative(const expansion& input, expansion& output)
 {
-   output.resize(input.size());
-   for(unsigned int i=0; i<input.size(); ++i)
-      output[i]=-input[i];
+    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[1], product[0]);
+    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);
+    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);
+    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.size());
-   if(a.empty()) return;
-   two_product(a[0], b, product[1], product[0]); // finalize product[0]
-   double x, y, z;
-   for(unsigned int i=1; i<a.size(); ++i){
-      two_product(a[i], b, x, y);
-      // finalize product[2*i-1]
-      two_sum(product[2*i-1], y, z, product[2*i-1]);
-      // finalize product[2*i], could be fast_two_sum instead
-      fast_two_sum(x, z, product[2*i+1], product[2*i]);
-   }
-   // multiplication is a prime candidate for producing spurious zeros, so
-   // remove them by default
-   remove_zeros(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.size(); ++i){
-      multiply(a, b[i], term);
-      add(product, term, 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; i<a.size() && a[i]; ++i)
-      ;
-   for(++i, j=0; i<a.size(); ++i)
-      if(a[i]){
-         a[j]=a[i];
-         ++j;
-      }
-   a.resize(j);
+    
+    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.size(); ++i)
-      x+=a[i];
-   return x;
+    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
index 4829a16..379cf4b 100644
--- a/extern/eltopo/common/tunicate/expansion.h
+++ b/extern/eltopo/common/tunicate/expansion.h
@@ -5,19 +5,22 @@
 // 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;
+//typedef std::vector<double> expansion;
 
-inline expansion
-make_expansion(double a)
-{ if(a) return expansion(1, a); else return expansion(); }
 
-inline void
-make_zero(expansion& e)
-{ e.resize(0); }
+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);
@@ -34,6 +37,9 @@ add(double a, const expansion& b, expansion& sum)
 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);
@@ -58,13 +64,161 @@ 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
index 46e17ae..68ec4b7 100644
--- a/extern/eltopo/common/tunicate/intersection.cpp
+++ b/extern/eltopo/common/tunicate/intersection.cpp
@@ -2,13 +2,14 @@
 
 #include <cassert>
 #include <cmath>
-#include "tunicate.h"
+#include <iostream>
+#include <tunicate.h>
 
 //==============================================================================
 static bool
 same_sign(double a, double b)
 {
-   return (a<=0 && b<=0) || (a>=0 && b>=0);
+    return (a<=0 && b<=0) || (a>=0 && b>=0);
 }
 
 //==============================================================================
@@ -21,32 +22,32 @@ simplex_intersection1d(int k,
                        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);
+    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);
 }
 
 //==============================================================================
@@ -60,27 +61,27 @@ simplex_intersection2d(int k,
                        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;
+    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;
 }
 
 //==============================================================================
@@ -95,78 +96,79 @@ simplex_intersection2d(int k,
                        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;
-         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,
+    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
-   }
+        default:
+            return -1; // should never get here
+    }
 }
 
 //==============================================================================
@@ -180,61 +182,61 @@ simplex_intersection3d(int k,
                        double* alpha0, 
                        double* alpha1, 
                        double* alpha2,
-                       double* alpha3)
+                       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;
+    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;
 }
 
 //==============================================================================
@@ -251,103 +253,108 @@ simplex_intersection3d(int k,
                        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;
-         *alpha4= orientation3d(x0, x1, x2, x3);
-         if(!same_sign(*alpha1, *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;
-         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
-   }
+    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
+    }
 }
 
 //==============================================================================
@@ -363,95 +370,95 @@ simplex_intersection_time3d(int k,
                             double* alpha1, 
                             double* alpha2,
                             double* alpha3,
-                            double* alpha4)
+                            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;
+    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;
 }
 
 //==============================================================================
@@ -470,180 +477,180 @@ simplex_intersection_time3d(int k,
                             double* alpha4,
                             double* alpha5)
 {
-   assert(1<=k && k<=5);
-//   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);
-//   assert(time5==0 || time5==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
-   }
+    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
+    }
 }
 
 //==============================================================================
@@ -659,87 +666,87 @@ simplex_intersection4d(int k,
                        double* alpha1, 
                        double* alpha2,
                        double* alpha3,
-                       double* alpha4)
+                       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;
+    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;
 }
 
 //==============================================================================
@@ -758,172 +765,187 @@ simplex_intersection4d(int k,
                        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;
-         *alpha4= orientation4d(x0, x1, x2, x3, x5);
-         if(!same_sign(*alpha1, *alpha4)) return 0;
-         *alpha5=-orientation4d(x0, x1, x2, x3, x4);
-         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_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;
-         *alpha5=-orientation4d(x0, x1, x2, x3, x4);
-         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_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;
-         *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;
-         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
-   }
+    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
index 3b0f4fe..78b5e5d 100644
--- a/extern/eltopo/common/tunicate/neg.cpp
+++ b/extern/eltopo/common/tunicate/neg.cpp
@@ -1,6 +1,6 @@
 // Released into the public domain by Robert Bridson, 2009.
 
-#include "neg.h"
+#include <neg.h>
 
 //==============================================================================
 // Try to force the compiler to add a negative instead of subtracting.
@@ -12,5 +12,5 @@
 double
 neg(double x)
 {
-   return -x;
+    return -x;
 }
diff --git a/extern/eltopo/common/tunicate/neg.h b/extern/eltopo/common/tunicate/neg.h
index 1e0d252..01dd540 100644
--- a/extern/eltopo/common/tunicate/neg.h
+++ b/extern/eltopo/common/tunicate/neg.h
@@ -6,10 +6,10 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-
-double
-neg(double x);
-
+    
+    double
+    neg(double x);
+    
 #ifdef __cplusplus
 } // end of extern "C" block
 #endif
diff --git a/extern/eltopo/common/tunicate/orientation.cpp b/extern/eltopo/common/tunicate/orientation.cpp
index 2d7862a..7d6064d 100644
--- a/extern/eltopo/common/tunicate/orientation.cpp
+++ b/extern/eltopo/common/tunicate/orientation.cpp
@@ -13,17 +13,31 @@
 #endif
 #include <cmath>
 #include <limits>
-#include "tunicate.h"
-#include "expansion.h"
-#include "neg.h"
+#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];
+    assert(x0 && x1);
+    return x0[0]-x1[0];
 }
 
 //==============================================================================
@@ -32,24 +46,24 @@ 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];
+    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];
 }
 
 //==============================================================================
-static void
+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);
+    fesetround(FE_DOWNWARD);
+    *lower=simple_orientation2d(x0, x1, x2);
+    fesetround(FE_UPWARD);
+    *upper=simple_orientation2d(x0, x1, x2);
+    assert(*lower<=*upper);
 }
 
 //==============================================================================
@@ -60,13 +74,13 @@ expansion_orientation2d(const double* x0,
                         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);
+    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);
 }
 
 //==============================================================================
@@ -77,9 +91,9 @@ accurate_orientation2d(const double* x0,
                        const double* x1,
                        const double* x2)
 {
-   expansion result;
-   expansion_orientation2d(x0, x1, x2, result);
-   return estimate(result);
+    expansion result;
+    expansion_orientation2d(x0, x1, x2, result);
+    return estimate(result);
 }
 
 //==============================================================================
@@ -88,16 +102,16 @@ 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);
+    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);
 }
 
 //==============================================================================
@@ -108,10 +122,10 @@ three_product(double a,
               double b,
               double c)
 {
-   if(a>0)
-      return a*(b*c);
-   else
-      return neg(a)*(-b*c);
+    if(a>0)
+        return a*(b*c);
+    else
+        return neg(a)*(-b*c);
 }
 
 //==============================================================================
@@ -121,37 +135,37 @@ simple_orientation3d(const double* x0,
                      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]);
+    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]);
 }
 
 //==============================================================================
-static void
+void
 interval_orientation3d(const double* x0,
                        const double* x1,
                        const double* x2,
@@ -159,11 +173,11 @@ interval_orientation3d(const double* x0,
                        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);
+    fesetround(FE_DOWNWARD);
+    *lower=simple_orientation3d(x0, x1, x2, x3);
+    fesetround(FE_UPWARD);
+    *upper=simple_orientation3d(x0, x1, x2, x3);
+    assert(*lower<=*upper);
 }
 
 //==============================================================================
@@ -175,15 +189,22 @@ expansion_orientation3d(const double* x0,
                         const double* x3,
                         expansion& result)
 {
-   expansion d, p;
-   expansion_orientation2d(x1+1, x2+1, x3+1, d);
-   multiply(x0[0], d, result);
-   expansion_orientation2d(x0+1, x2+1, x3+1, d);
-   multiply(-x1[0], d, p); add(result, p, result);
-   expansion_orientation2d(x0+1, x1+1, x3+1, d);
-   multiply(x2[0], d, p); add(result, p, result);
-   expansion_orientation2d(x0+1, x1+1, x2+1, d);
-   multiply(-x3[0], d, p); add(result, p, 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);
+    
 }
 
 //==============================================================================
@@ -195,9 +216,9 @@ accurate_orientation3d(const double* x0,
                        const double* x2,
                        const double* x3)
 {
-   expansion result;
-   expansion_orientation3d(x0, x1, x2, x3, result);
-   return estimate(result);
+    expansion result;
+    expansion_orientation3d(x0, x1, x2, x3, result);
+    return estimate(result);
 }
 
 //==============================================================================
@@ -207,16 +228,16 @@ orientation3d(const double* x0,
               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);
+    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);
 }
 
 //==============================================================================
@@ -229,21 +250,21 @@ interval_orientation_time3d(const double* x0, int time0,
                             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);
+    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);
 }
 
 //==============================================================================
@@ -253,31 +274,31 @@ 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 time4,
+                             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);
-   }
+    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);
+    }
 }
 
 //==============================================================================
@@ -290,10 +311,10 @@ accurate_orientation_time3d(const double* x0, int time0,
                             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);
+    expansion result;
+    expansion_orientation_time3d(x0, time0, x1, time1, x2, time2,
+                                 x3, time3, x4, time4, result);
+    return estimate(result);
 }
 
 //==============================================================================
@@ -304,22 +325,22 @@ orientation_time3d(const double* x0, int time0,
                    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);
+    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);
 }
 
 //==============================================================================
-static void
+void
 interval_orientation4d(const double* x0,
                        const double* x1,
                        const double* x2,
@@ -328,29 +349,29 @@ interval_orientation4d(const double* x0,
                        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);
+    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);
 }
 
 //==============================================================================
@@ -363,57 +384,57 @@ expansion_orientation4d(const double* x0,
                         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);
+    // 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);
 }
 
 //==============================================================================
@@ -426,9 +447,9 @@ accurate_orientation4d(const double* x0,
                        const double* x3,
                        const double* x4)
 {
-   expansion result;
-   expansion_orientation4d(x0, x1, x2, x3, x4, result);
-   return estimate(result);
+    expansion result;
+    expansion_orientation4d(x0, x1, x2, x3, x4, result);
+    return estimate(result);
 }
 
 //==============================================================================
@@ -439,14 +460,14 @@ orientation4d(const double* x0,
               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);
+    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
index 83e1993..42fd2d7 100644
--- a/extern/eltopo/common/tunicate/sos_intersection.cpp
+++ b/extern/eltopo/common/tunicate/sos_intersection.cpp
@@ -1,14 +1,17 @@
 // Released into the public domain by Robert Bridson, 2009.
 
 #include <cassert>
-#include "tunicate.h"
+#include <tunicate.h>
 
 //==============================================================================
 // Note: it is assumed all arguments are nonzero (have a sign).
-static bool
-same_sign(double a, double b)
-{
-   return (a<0 && b<0) || (a>0 && b>0);
+
+namespace {
+    bool
+    same_sign(double a, double b)
+    {
+        return (a<0 && b<0) || (a>0 && b>0);
+    }
 }
 
 //==============================================================================
@@ -21,29 +24,29 @@ sos_simplex_intersection1d(int k,
                            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,
+    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
-   }
+        default:
+            return -1; // should never get here
+    }
 }
 
 //==============================================================================
@@ -58,44 +61,44 @@ sos_simplex_intersection2d(int k,
                            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,
+    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
-   }
+        default:
+            return -1; // should never get here
+    }
 }
 
 //==============================================================================
@@ -112,52 +115,52 @@ sos_simplex_intersection3d(int k,
                            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
-   }
+    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
+    }
 }
 
 //==============================================================================
@@ -176,77 +179,77 @@ sos_simplex_intersection4d(int k,
                            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
-   }
+    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
index 17ea4d6..861bc1d 100644
--- a/extern/eltopo/common/tunicate/sos_orientation.cpp
+++ b/extern/eltopo/common/tunicate/sos_orientation.cpp
@@ -2,15 +2,15 @@
 
 #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 <cmath>
 #include <limits>
-#include "tunicate.h"
+#include <tunicate.h>
 
 // short hand
 static const double dbl_min=std::numeric_limits<double>::min();
@@ -20,26 +20,30 @@ 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;
+    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;
 }
 
 //==============================================================================
-static 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 {
+    
+    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
@@ -47,27 +51,27 @@ 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;
+    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;
 }
 
 //==============================================================================
@@ -77,57 +81,57 @@ sos_orientation3d(int priority0, const double* x0,
                   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;
+    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;
 }
 
 //==============================================================================
@@ -138,119 +142,119 @@ sos_orientation4d(int priority0, const double* x0,
                   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);
+    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
index 8342347..967cf2d 100644
--- a/extern/eltopo/common/tunicate/tunicate.h
+++ b/extern/eltopo/common/tunicate/tunicate.h
@@ -14,230 +14,245 @@
 #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);
-
-// 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);
-
-// 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,
+    
+    //==============================================================================
+    // 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
-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,
+    
+    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
-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,
+    
+    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
-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,
+    
+    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
diff --git a/extern/eltopo/common/util.h b/extern/eltopo/common/util.h
index 970f442..c9cad1c 100644
--- a/extern/eltopo/common/util.h
+++ b/extern/eltopo/common/util.h
@@ -2,11 +2,11 @@
 #define UTIL_H
 
 #include <algorithm>
-#include <vector>
+#include <array3.h>
+#include <climits>
 #include <cmath>
 #include <iostream>
-
-#include "array3.h"
+#include <vector>
 
 #ifndef M_PI
 const double M_PI = 3.1415926535897932384626433832795;
@@ -64,125 +64,125 @@ inline T max(T a1, T a2, T a3, T a4, T a5, T 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;
-   }
+    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;
-      }
-   }
+    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);
-      }
-   }
+    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);
+    //@@@ 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);
+    //@@@ 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;
+    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;
+    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;
+        }
     }
-      }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;
+    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));
+    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
@@ -198,37 +198,37 @@ inline T ramp(T r)
 #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);
+    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;
+    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;
+    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;
+    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 
@@ -237,23 +237,23 @@ inline unsigned int round_down_to_power_of_two(unsigned int n)
 
 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;
+    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;
+    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]
@@ -270,27 +270,27 @@ inline float randhashf(unsigned int seed, float a, float b)
 
 inline int intlog2(int x)
 {
-   int exp=-1;
-   while(x){
-      x>>=1;
-      ++exp;
-   }
-   return exp;
+    int exp=-1;
+    while(x){
+        x>>=1;
+        ++exp;
+    }
+    return exp;
 }
 
 template<class T>
-inline void get_barycentric(T x, int& i, T& f, int i_low, int i_high)
+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);
+    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>
@@ -302,9 +302,9 @@ 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);
+    return lerp(lerp(v00, v10, fx),
+                lerp(v01, v11, fx), 
+                fy);
 }
 
 template<class S, class T>
@@ -314,9 +314,9 @@ inline S trilerp(const S& v000, const S& v100,
                  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);
+    return lerp(bilerp(v000, v100, v010, v110, fx, fy),
+                bilerp(v001, v101, v011, v111, fx, fy),
+                fz);
 }
 
 template<class S, class T>
@@ -330,37 +330,37 @@ inline S quadlerp(const S& v0000, const S& v1000,
                   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);
+    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);
+    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);
+    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;
+    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>
@@ -370,7 +370,7 @@ inline S bicubic_interp(const S& v00, const S& v10, const S& v20, const S& v30,
                         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 ),
+    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 ),
@@ -378,21 +378,21 @@ inline S bicubic_interp(const S& v00, const S& v10, const S& v20, const S& v30,
 }
 
 template<class S, class T>
-inline S tricubic_interp( const Array3<S, Array1<S> >& v, int i, int j, int k, T fx, T fy, T fz )
+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), 
+    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 ),
+                                       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+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 ),                       
@@ -408,103 +408,103 @@ void zero(std::vector<T>& v)
 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;
+    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;
+    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);
+    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;
+    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();
+    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();
+    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();
+    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();
+    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;
-      }
+    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;
-      }
+    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);
+    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
index 9f7cb7a..1802358 100644
--- a/extern/eltopo/common/vec.h
+++ b/extern/eltopo/common/vec.h
@@ -3,8 +3,9 @@
 
 #include <cassert>
 #include <cmath>
+#include <hashtable.h>
 #include <iostream>
-#include "util.h"
+#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.
@@ -21,141 +22,141 @@
 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;
-   }
+    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;
@@ -166,6 +167,7 @@ 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;
@@ -175,6 +177,7 @@ 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;
@@ -184,6 +187,7 @@ 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;
@@ -198,9 +202,9 @@ 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;
+    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>
@@ -210,9 +214,9 @@ T mag(const Vec<N,T> &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;
+    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> 
@@ -230,137 +234,137 @@ inline Vec<N,T> normalized(const Vec<N,T> &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;
+    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;
+    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;
+    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;
+    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;
+    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;
+    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;
+    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;
+    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;
+    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;
+    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;
+    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;
+    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, float angle) 
+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
+    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, float angle, const Vec<3,T>& u )
+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,
+    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>
@@ -378,124 +382,124 @@ inline Vec<3,T> cross(const Vec<3,T> &a, const Vec<3,T> &b)
 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]); }
+    +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;
+    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];
+    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];
+    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];
+    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];
+    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; 
+    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; 
+    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; 
+    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; 
+    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]);
+    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]);
+    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]);
+    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]);
+    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]);
+    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]);
+    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
index 6fc3f97..1ced278 100644
--- a/extern/eltopo/common/vector_math.h
+++ b/extern/eltopo/common/vector_math.h
@@ -7,30 +7,30 @@
 
 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;
+    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());
+    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]);
+    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]);
+    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]);
+    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
index 2ddc942..149b95b 100644
--- a/extern/eltopo/common/wallclocktime.cpp
+++ b/extern/eltopo/common/wallclocktime.cpp
@@ -1,43 +1,44 @@
 #ifdef WIN32
 
-#include "Windows.h"
+#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);
+    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;
+    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;
+    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);
+    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/eltopo-capi.cpp b/extern/eltopo/eltopo-capi.cpp
index 2a56f35..0da39cf 100644
--- a/extern/eltopo/eltopo-capi.cpp
+++ b/extern/eltopo/eltopo-capi.cpp
@@ -33,185 +33,3 @@ extern "C" void eltopo_end_memarena(void)
 		arena = NULL;
 	}
 }
-
-static int non_penetration_filter_tri_v3(Vec3d v0, Vec3d vnew0, 
-	Vec3d v1, Vec3d vnew1, Vec3d v2, Vec3d vnew2, Vec3d v3, Vec3d vnew3)
-{
-	Vec3d n0, n1, nv, vec;
-	double dotA, dotB, dotC, dotD, dotE, dotF;
-	
-	/*non-penetration filter
-	  see "Fast Continuous Collision Detection using Deforming Non-Penetration Filters"
-	  by Min Zhejiang,Dinesh Manocha†, and Ruofeng Tong.
-	*/
-	n0 = cross(v1 - v2, v3 - v2);
-
-	vec = v0 - v1;
-	dotA = dot(vec, n0);
-	vec = vnew0 - vnew1;
-	dotF = dot(vec, n0);
-
-	n1 = cross(vnew1 - vnew2, vnew3 - vnew2);
-
-	vec = vnew0 - vnew1;
-	dotB = dot(vec, n1);
-	vec = v0 - v1;
-	dotE = dot(vec, n1);
-	
-	nv = 0.5*(n0 + n1 + cross((vnew2 - v2) - (vnew1 - v1), (vnew3 - v3) - (vnew1 - v1)));
-
-	vec = vnew0 - vnew1; 
-	dotD = dot(vec, nv);
-	vec = v0 - v1;
-	dotC = dot(vec, nv);
-
-	return ((dotA >= 0.0) == (dotB >= 0.0) && ((2.0*dotF + dotC)/3.0 >= 0.0) 
-		 == (dotA >= 0.0) && (2.0*dotD + dotE)/3.0 >= 0.0 == (dotA >= 0.0));
-}
-
-// x0 is the point, x1-x2-x3 is the triangle. Take care to specify x1,x2,x3 in sorted order of index!
-extern "C" int eltopo_point_tri_moving_v3_d(double x0[3], double xnew0[3], unsigned int index0,
-									  double x1[3] , double xnew1[3], unsigned int index1,
-									  double x2[3] , double xnew2[3], unsigned int index2,
-									  double x3[3] , double xnew3[3], unsigned int index3,
-									  double no[3], double bary[3], double *t, double *relnor)
-{
-	Vec3d n0, n1, nv, vec, v0(x0), vnew0(xnew0), v1(x1), vnew1(xnew1), v2(x2), vnew2(xnew2), v3(x3), vnew3(xnew3);
-	Vec3d vno;
-	double bx, by, bz, dotA, dotB, dotC, dotD, dotE, dotF;
-	int ret;
-	
-	if (non_penetration_filter_tri_v3(v0, vnew0, v1, vnew1, v2, vnew2, v3, vnew3)) {
-		return 0;
-	}
-	
-	ret = (int)point_triangle_collision(v0, vnew0, index0, v1, vnew1, index1, 
-										 v2, vnew2, index2, v3, vnew3, index3,
-										 bx, by, bz, vno, *t, *relnor, false);
-	
-	if (bary) {
-		bary[0] = bx; bary[1] = by; bary[2] = bz;
-	}
-	
-	if (no) {
-		no[0] = vno[0]; no[1] = vno[1]; no[2] = vno[2];
-	}
-	
-	return ret;
-}
-
-// x0 is the point, x1-x2-x3 is the triangle. Take care to specify x1,x2,x3 in sorted order of index!
-extern "C" int eltopo_line_line_moving_isect_v3_d(double x0[3], double xnew0[3], unsigned int index0,
-									  double x1[3], double xnew1[3], unsigned int index1,
-									  double x2[3], double xnew2[3], unsigned int index2,
-									  double x3[3], double xnew3[3], unsigned int index3, 
-									  double no[3], double bary[2], double *t, double *relnor)
-{
-	Vec3d v0(x0), vnew0(xnew0), v1(x1), vnew1(xnew1), v2(x2), vnew2(xnew2), v3(x3), vnew3(xnew3);
-	Vec3d vno;
-	int ret;
-	
-	if (non_penetration_filter_tri_v3(v0, vnew0, v1, vnew1, v2, vnew2, v3, vnew3)) {
-		return 0;
-	}
-
-	ret = (int)segment_segment_collision(v0, vnew0, index0, v1, vnew1, index1, v2, 
-										  vnew2, index2, v3, vnew3, index3, bary[0],
-										  bary[1], vno, *t, *relnor, 0);
-	
-	if (bary[0]<-DBL_EPSILON*10 || bary[0]>1.0+DBL_EPSILON*10)
-		ret = 0;
-	if (bary[1]<-DBL_EPSILON*10 || bary[1]>1.0+DBL_EPSILON*10)
-		ret = 0;
-	
-	if (no) {
-		no[0] = vno[0]; no[1] = vno[1]; no[2] = vno[2];
-	}
-	
-	return ret;
-}
-
-
-extern "C" int eltopo_point_tri_moving_v3v3_d(double v1[2][3], int i1, double v2[2][3], int i2,
-											  double v3[2][3],  int i3, double v4[2][3], int i4,
-											  double normal[3], double bary[3], double *t, double *relnor)
-{
-	return eltopo_point_tri_moving_v3_d(v1[0], v1[1], i1, v2[0], v2[1], i2, v3[0], 
-										v3[1], i3, v4[0], v4[1], i4, normal, bary, t, relnor);
-}
-
-extern "C" int eltopo_point_tri_moving_v3v3_f(float v1[2][3], int i1, float v2[2][3], int i2,
-											  float v3[2][3],  int i3, float v4[2][3], int i4,
-											  float normal[3], float bary[3], float *t, float *relnor)
-
-{
-	double d1[2][3], d2[2][3], d3[2][3], d4[2][3];
-	double dno[3], dbary[3], dt, drelnor;
-	int i, ret;
-	
-	for (i=0; i<3; i++) {
-		d1[0][i] = v1[0][i]; d1[1][i] = v1[1][i];
-		d2[0][i] = v2[0][i]; d2[1][i] = v2[1][i];
-		d3[0][i] = v3[0][i]; d3[1][i] = v3[1][i];
-		d4[0][i] = v4[0][i]; d4[1][i] = v4[1][i];
-	}
-	
-	ret = eltopo_point_tri_moving_v3v3_d(d1, i1, d2, i2, d3, i3, d4, i4, 
-										  dno, dbary, &dt, &drelnor);
-	
-	if (bary) {
-		bary[0] = dbary[0]; bary[1] = dbary[1]; bary[2] = dbary[2];
-	}
-	if (normal) {
-		normal[0] = dno[0]; normal[1] = dno[1]; normal[2] = dno[2];
-	}
-	if (t)
-		*t = dt;
-	if (relnor)
-		*relnor = drelnor;
-	
-	return ret;	
-}
-
-
-extern "C" int eltopo_line_line_moving_isect_v3v3_d(double v1[2][3], int i1, double v2[2][3], int i2,
-											  double v3[2][3],  int i3, double v4[2][3], int i4,
-											  double normal[3], double bary[2], double *t, double *relnor)
-{
-	return eltopo_line_line_moving_isect_v3_d(v1[0], v1[1], i1, v2[0], v2[1], i2, v3[0], 
-										v3[1], i3, v4[0], v4[1], i4, normal, bary, t, relnor);
-}
-
-extern "C" int eltopo_line_line_moving_isect_v3v3_f(float v1[2][3], int i1, float v2[2][3], int i2,
-											  float v3[2][3],  int i3, float v4[2][3], int i4,
-											  float normal[3], float bary[3], float *t, float *relnor)
-
-{
-	double d1[2][3], d2[2][3], d3[2][3], d4[2][3];
-	double dno[3], dbary[2], dt, drelnor;
-	int i, ret;
-	
-	for (i=0; i<3; i++) {
-		d1[0][i] = v1[0][i]; d1[1][i] = v1[1][i];
-		d2[0][i] = v2[0][i]; d2[1][i] = v2[1][i];
-		d3[0][i] = v3[0][i]; d3[1][i] = v3[1][i];
-		d4[0][i] = v4[0][i]; d4[1][i] = v4[1][i];
-	}
-	
-	ret = eltopo_line_line_moving_isect_v3v3_d(d1, i1, d2, i2, d3, i3, d4, i4, 
-										  dno, dbary, &dt, &drelnor);
-	
-	if (bary) {
-		bary[0] = dbary[0]; bary[1] = dbary[1];
-	}
-	if (normal) {
-		normal[0] = dno[0]; normal[1] = dno[1]; normal[2] = dno[2];
-	}
-	if (t)
-		*t = dt;
-	
-	if (relnor)
-		*relnor = drelnor;
-	
-	return ret;	
-}
diff --git a/extern/eltopo/eltopo-capi.h b/extern/eltopo/eltopo-capi.h
index 3ea8d0f..f127efd 100644
--- a/extern/eltopo/eltopo-capi.h
+++ b/extern/eltopo/eltopo-capi.h
@@ -2,63 +2,6 @@
 extern "C" {
 
 #endif
-	
-// 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)	
-int eltopo_point_tri_moving_v3_d(double x0[3], double xnew0[3], unsigned int index0,
-									  double x1[3] , double xnew1[3], unsigned int index1,
-									  double x2[3] , double xnew2[3], unsigned int index2,
-									  double x3[3] , double xnew3[3], unsigned int index3,
-									  double normal[3], double bary[3], double *t, 
-									  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!
-// 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)
-int eltopo_line_line_moving_isect_v3_d(double x0[3], double xnew0[3], unsigned int index0,
-									  double x1[3] , double xnew1[3], unsigned int index1,
-									  double x2[3] , double xnew2[3], unsigned int index2,
-									  double x3[3] , double xnew3[3], unsigned int index3,
-									  double normal[3], double bary[2], double *t,
-									  double *relative_normal_displacement);
-
-// 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)
-int eltopo_point_tri_moving_v3v3_f(float v1[2][3], int i1, float v2[2][3], int i2,
-                                   float v3[2][3],  int i3, float v4[2][3], int i4,
-                                   float normal[3], float bary[3], float *t, float *relative_normal_displacement);
-
-// 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)
-int eltopo_point_tri_moving_v3v3_d(double v1[2][3], int i1, double v2[2][3], int i2,
-                                   double v3[2][3],  int i3, double v4[2][3], int i4,
-                                   double normal[3], double bary[3], double *t, 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!
-// 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)
-int eltopo_line_line_moving_isect_v3v3_d(double v1[2][3], int i1, double v2[2][3], int i2,
-									  double v3[2][3],  int i3, double v4[2][3], int i4,
-									  double normal[3], double bary[2], double *t, double *relnor);
-
-// 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)
-int eltopo_line_line_moving_isect_v3v3_f(float v1[2][3], int i1, float v2[2][3], int i2,
-									  float v3[2][3],  int i3, float v4[2][3], int i4,
-									  float normal[3], float bary[3], float *t, float *relnor);
-
 
 void eltopo_start_memarena(void);
 void eltopo_end_memarena(void);
diff --git a/extern/eltopo/eltopo3d/Makefile b/extern/eltopo/eltopo3d/Makefile
index 7cd133a..da62a61 100644
--- a/extern/eltopo/eltopo3d/Makefile
+++ b/extern/eltopo/eltopo3d/Makefile
@@ -20,19 +20,9 @@ include Makefile.inc
 
 # how to compile each file
 .SUFFIXES:
-obj/%.o: %.cpp
+obj/%.o:
 	$(CC) -c $(RELEASE_FLAGS) $(INCLUDE_PATH) -o $@ $<
-obj_debug/%.o: %.cpp
-	$(CC) -c $(DEBUG_FLAGS) $(INCLUDE_PATH) -o $@ $<
-
-obj/%.o: ../common/%.cpp
-	$(CC) -c $(RELEASE_FLAGS) $(INCLUDE_PATH) -o $@ $<
-obj_debug/%.o: ../common/%.cpp
-	$(CC) -c $(DEBUG_FLAGS) $(INCLUDE_PATH) -o $@ $<
-
-obj/%.o: ../common/newsparse/%.cpp
-	$(CC) -c $(RELEASE_FLAGS) $(INCLUDE_PATH) -o $@ $<
-obj_debug/%.o: ../common/newsparse/%.cpp
+obj_debug/%.o:
 	$(CC) -c $(DEBUG_FLAGS) $(INCLUDE_PATH) -o $@ $<
 
 .PHONY: release
diff --git a/extern/eltopo/eltopo3d/Makefile.example_defs b/extern/eltopo/eltopo3d/Makefile.example_defs
index 382899c..839ad23 100644
--- a/extern/eltopo/eltopo3d/Makefile.example_defs
+++ b/extern/eltopo/eltopo3d/Makefile.example_defs
@@ -10,8 +10,8 @@ INCLUDE_PATH = -I. -I../common -I../common/newsparse -I../common/meshes -I../com
 
 # For example, on Linux on a PC this will likely work:
 
-DEPEND = g++ -D__LITTLE_ENDIAN__ -DUSE_FORTRAN_BLAS -DNO_GUI
-CC = g++ -Wall -D__LITTLE_ENDIAN__ -DUSE_FORTRAN_BLAS -DNO_GUI
+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++
@@ -22,7 +22,7 @@ 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
+#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++
diff --git a/extern/eltopo/eltopo3d/Makefile.inc b/extern/eltopo/eltopo3d/Makefile.inc
index 07e7b35..f686e67 100644
--- a/extern/eltopo/eltopo3d/Makefile.inc
+++ b/extern/eltopo/eltopo3d/Makefile.inc
@@ -1,14 +1,22 @@
 
 # Source files
-LIB_SRC = accelerationgrid.cpp broadphasegrid.cpp dynamicsurface.cpp \
-          nondestructivetrimesh.cpp subdivisionscheme.cpp surftrack.cpp \
-          eltopo.cpp
+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 \
-           ../common/cubic_ccd_wrapper.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)))
diff --git a/extern/eltopo/eltopo3d/accelerationgrid.cpp b/extern/eltopo/eltopo3d/accelerationgrid.cpp
index 062c331..ea18f04 100644
--- a/extern/eltopo/eltopo3d/accelerationgrid.cpp
+++ b/extern/eltopo/eltopo3d/accelerationgrid.cpp
@@ -13,12 +13,11 @@
 
 #include <accelerationgrid.h>
 
-#include <vector>
-#include <limits>
-
 #include <array3.h>
+#include <limits>
 #include <util.h>
 #include <vec.h>
+#include <vector>
 #include <wallclocktime.h>
 
 // ---------------------------------------------------------
@@ -44,62 +43,75 @@
 // --------------------------------------------------------
 
 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)
+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)
 {
-   Vec3ui dims(1,1,1);
-   Vec3d xmin(0,0,0), xmax(1,1,1);
-   set(dims, xmin, xmax);
+    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)
+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)
 {
-   *this = other;
+    
+    // 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 ( unsigned int i = 0; i < m_cells.a.size(); ++i )
-   {
-      if (other.m_cells.a[i])
-      {
-         m_cells.a[i] = new std::vector<unsigned int>();
-         *(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;
+    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;
 }
 
 // --------------------------------------------------------
@@ -110,7 +122,7 @@ AccelerationGrid& AccelerationGrid::operator=( const AccelerationGrid& other)
 
 AccelerationGrid::~AccelerationGrid()
 {
-   clear();
+    clear();
 }
 
 // --------------------------------------------------------
@@ -119,24 +131,24 @@ AccelerationGrid::~AccelerationGrid()
 ///
 // --------------------------------------------------------
 
-void AccelerationGrid::set( const Vec3ui& dims, const Vec3d& xmin, const Vec3d& xmax )
+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(unsigned int i = 0; i < m_cells.a.size(); i++)
-   {
-      m_cells.a[i] = 0;
-   }   
+    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;
+    }   
 }
 
 // --------------------------------------------------------
@@ -147,22 +159,35 @@ void AccelerationGrid::set( const Vec3ui& dims, const Vec3d& xmin, const Vec3d&
 
 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] >= m_cells.ni) xmaxi[0] = m_cells.ni-1;
-   if(xmaxi[1] >= m_cells.nj) xmaxi[1] = m_cells.nj-1;
-   if(xmaxi[2] >= m_cells.nk) xmaxi[2] = m_cells.nk-1;
+    
+    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;
+    
 }
 
 // --------------------------------------------------------
@@ -171,38 +196,38 @@ void AccelerationGrid::boundstoindices(const Vec3d& xmin, const Vec3d& xmax, Vec
 ///
 // --------------------------------------------------------
 
-void AccelerationGrid::add_element(unsigned int idx, const Vec3d& xmin, const Vec3d& xmax)
+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<unsigned int>*& cell = m_cells(i, j, k);
-            if(!cell)
-               cell = new std::vector<unsigned int>();
-            
-            cell->push_back(idx);
-            m_elementidxs[idx].push_back(Vec3ui(i, j, k));
-         }
-      }
-   }
+    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));
+            }
+        }
+    }
 }
 
 // --------------------------------------------------------
@@ -211,23 +236,26 @@ void AccelerationGrid::add_element(unsigned int idx, const Vec3d& xmin, const Ve
 ///
 // --------------------------------------------------------
 
-void AccelerationGrid::remove_element(unsigned int idx)
+void AccelerationGrid::remove_element(size_t idx)
 {
-   for(unsigned int c = 0; c < m_elementidxs[idx].size(); c++)
-   {
-      Vec3ui cellcoords = m_elementidxs[idx][c];
-      std::vector<unsigned int>* cell = m_cells(cellcoords[0], cellcoords[1], cellcoords[2]);
-      
-      std::vector<unsigned int>::iterator it = cell->begin();
-      while(*it != idx)
-      {
-         it++;
-      }
-      
-      cell->erase(it);
-   }
-   
-   m_elementidxs[idx].clear();
+    
+    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();
 }
 
 // --------------------------------------------------------
@@ -236,10 +264,10 @@ void AccelerationGrid::remove_element(unsigned int idx)
 ///
 // --------------------------------------------------------
 
-void AccelerationGrid::update_element(unsigned int idx, const Vec3d& xmin, const Vec3d& xmax)
+void AccelerationGrid::update_element(size_t idx, const Vec3d& xmin, const Vec3d& xmax)
 {
-   remove_element(idx);
-   add_element(idx, xmin, xmax);
+    remove_element(idx);
+    add_element(idx, xmin, xmax);
 }
 
 // --------------------------------------------------------
@@ -250,22 +278,22 @@ void AccelerationGrid::update_element(unsigned int idx, const Vec3d& xmin, const
 
 void AccelerationGrid::clear()
 {
-   for(unsigned int i = 0; i < m_cells.a.size(); i++)
-   {
-      std::vector<unsigned int>*& 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;
-   
+    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;
+    
 }
 
 // --------------------------------------------------------
@@ -274,118 +302,62 @@ void AccelerationGrid::clear()
 ///
 // --------------------------------------------------------
 
-void AccelerationGrid::find_overlapping_elements( const Vec3d& xmin, const Vec3d& xmax, std::vector<unsigned int>& results ) 
+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;
-   
-   results.clear();
-      
-   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<unsigned int>* cell = m_cells(i, j, k);
-            
-            if(cell)
+    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)
             {
-               for( std::vector<unsigned int>::const_iterator citer = cell->begin(); citer != cell->end(); ++citer)
-               {
-                  unsigned int 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);
-                     }
-                  
-                  }
-               }
+                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);
+                            }
+                            
+                        }
+                    }
+                }
+                
             }
-            
-         }
-      }
-   }
-}
-
-
-// --------------------------------------------------------
-///
-/// TEMP statistics-gathering functions
-///
-// --------------------------------------------------------
-
-float AccelerationGrid::num_elements_per_cell()
-{
-   unsigned int num_non_empty_cells = 0;
-   unsigned int counted_num_elements = 0;
-   
-   for ( unsigned int i = 0; i < m_cells.a.size(); ++i )
-   {
-      if ( m_cells.a[i] != NULL && m_cells.a[i]->size() != 0 )
-      {
-         ++num_non_empty_cells;
-         counted_num_elements += m_cells.a[i]->size();
-      }
-   }
-   
-   return (float) counted_num_elements / (float) num_non_empty_cells;
-}
-
-
-float AccelerationGrid::num_cells_per_element()
-{
-   unsigned int num_elements = m_elementidxs.size();
-   unsigned int num_cells_referenced = 0;
-   
-   for ( unsigned int i = 0; i < m_elementidxs.size(); ++i )
-   {
-      num_cells_referenced += m_elementidxs[i].size();
-   }
-   
-   return (float) num_cells_referenced / (float) num_elements;
-}
-
-
-unsigned int AccelerationGrid::max_elements_per_cell()
-{
-   unsigned int max_elements = 0;
-   
-   for ( unsigned int i = 0; i < m_cells.a.size(); ++i )
-   {
-      if ( m_cells.a[i] != NULL )
-      {
-         max_elements = max( max_elements, (unsigned int) m_cells.a[i]->size() );
-      }
-   }
-   
-   return max_elements;
+        }
+    }
 }
 
 
diff --git a/extern/eltopo/eltopo3d/accelerationgrid.h b/extern/eltopo/eltopo3d/accelerationgrid.h
index ed538b5..e9cada4 100644
--- a/extern/eltopo/eltopo3d/accelerationgrid.h
+++ b/extern/eltopo/eltopo3d/accelerationgrid.h
@@ -7,8 +7,8 @@
 //
 // ---------------------------------------------------------
 
-#ifndef ACCELERATIONGRID_H
-#define ACCELERATIONGRID_H
+#ifndef EL_TOPO_ACCELERATIONGRID_H
+#define EL_TOPO_ACCELERATIONGRID_H
 
 // ---------------------------------------------------------
 // Nested includes
@@ -18,11 +18,7 @@
 #include <vec.h>
 
 // ---------------------------------------------------------
-//  Forwards and typedefs
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-//  Interface declarations
+//  Class definitions
 // ---------------------------------------------------------
 
 // --------------------------------------------------------
@@ -33,85 +29,77 @@
 
 class AccelerationGrid
 {
-
+    
 public:
-      
-   AccelerationGrid();
-   ~AccelerationGrid();
-
-   // deep copy
-   AccelerationGrid(AccelerationGrid& other);
-   AccelerationGrid& operator=(const AccelerationGrid& other);
-   
-public:
-   
-   /// Define the grid given, the extents of the domain and the number of voxels along each dimension
-   ///
-   void set( const Vec3ui& 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(unsigned int idx, const Vec3d& xmin, const Vec3d& xmax);
-   
-   /// Remove an object with the specified index from the grid
-   ///
-   void remove_element(unsigned int idx);
-   
-   /// Reset the specified object's AABB
-   ///
-   void update_element(unsigned int 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<unsigned int>& results );
-   
-   // TEMP statistics-gathering functions
-   
-   float num_elements_per_cell();
-   float num_cells_per_element();
-   unsigned int max_elements_per_cell();
-   
-   
-   /// Each cell contains an array of indices specifying the elements whose AABBs overlap the cell
-   ///
-   Array3<std::vector<unsigned int>* > m_cells;
-   
-   /// For each element, a list of triples, each triple specifying a cell which overlaps the element. 
-   ///
-   std::vector<std::vector<Vec3ui> > 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;
-
+    
+    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;
+    
 };
 
 
diff --git a/extern/eltopo/eltopo3d/broadphase.h b/extern/eltopo/eltopo3d/broadphase.h
index bc11f00..8972fcb 100644
--- a/extern/eltopo/eltopo3d/broadphase.h
+++ b/extern/eltopo/eltopo3d/broadphase.h
@@ -3,14 +3,14 @@
 //  broadphase.h
 //  Tyson Brochu 2008
 //  
-//  Interface for abstract broad phase collision detector class.  
-//  Used to avoid performing collision detection between all 
-//  primitives. Abstract so we can try different strategies.
+//  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 BROADPHASE_H
-#define BROADPHASE_H
+#ifndef EL_TOPO_BROADPHASE_H
+#define EL_TOPO_BROADPHASE_H
 
 // ---------------------------------------------------------
 // Nested includes
@@ -25,7 +25,7 @@
 class DynamicSurface;
 
 // ---------------------------------------------------------
-//  Interface declarations
+//  Class definitions
 // ---------------------------------------------------------
 
 // --------------------------------------------------------
@@ -37,42 +37,105 @@ class DynamicSurface;
 class BroadPhase
 {   
 public:
-   
-   virtual ~BroadPhase() 
-   {}
-   
-   /// Rebuild the broad phase using current vertex positions
-   ///
-   virtual void update_broad_phase_static( const DynamicSurface& surface ) = 0;
+    
+    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;
 
-   /// Rebuild the broad phase using current and predicted vertex positions
-   ///
-   virtual void update_broad_phase_continuous( const DynamicSurface& surface ) = 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;
 
-   virtual void add_vertex( unsigned int index, const Vec3d& aabb_low, const Vec3d& aabb_high ) = 0; 
-   virtual void add_edge( unsigned int index, const Vec3d& aabb_low, const Vec3d& aabb_high ) = 0; 
-   virtual void add_triangle( unsigned int index, const Vec3d& aabb_low, const Vec3d& aabb_high ) = 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;
 
-   virtual void update_vertex( unsigned int index, const Vec3d& aabb_low, const Vec3d& aabb_high ) = 0; 
-   virtual void update_edge( unsigned int index, const Vec3d& aabb_low, const Vec3d& aabb_high ) = 0; 
-   virtual void update_triangle( unsigned int index, const Vec3d& aabb_low, const Vec3d& aabb_high ) = 0; 
-   
-   virtual void remove_vertex( unsigned int index ) = 0; 
-   virtual void remove_edge( unsigned int index ) = 0; 
-   virtual void remove_triangle( unsigned int index ) = 0; 
-   
-   /// Get the set of vertices whose bounding volumes overlap the specified bounding volume
-   ///
-   virtual void get_potential_vertex_collisions( const Vec3d& query_low, const Vec3d& query_high, std::vector<unsigned int>& overlapping_vertices ) = 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;
 
-   /// Get the set of edges whose bounding volumes overlap the specified bounding volume
-   ///
-   virtual void get_potential_edge_collisions( const Vec3d& query_low, const Vec3d& query_high, std::vector<unsigned int>& overlapping_triangles ) = 0;
-   
-   /// Get the set of triangles whose bounding volumes overlap the specified bounding volume
-   ///
-   virtual void get_potential_triangle_collisions( const Vec3d& query_low, const Vec3d& query_high, std::vector<unsigned int>& overlapping_triangles ) = 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;
+    
 };
 
 
diff --git a/extern/eltopo/eltopo3d/broadphasegrid.cpp b/extern/eltopo/eltopo3d/broadphasegrid.cpp
index d418483..8233f18 100644
--- a/extern/eltopo/eltopo3d/broadphasegrid.cpp
+++ b/extern/eltopo/eltopo3d/broadphasegrid.cpp
@@ -15,18 +15,6 @@
 #include <dynamicsurface.h>
 
 // ---------------------------------------------------------
-// Global externs
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// Local constants, typedefs, macros
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// Static function definitions
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
 // Member function definitions
 // ---------------------------------------------------------
 
@@ -37,56 +25,72 @@
 // --------------------------------------------------------
 
 void BroadPhaseGrid::build_acceleration_grid( AccelerationGrid& grid, 
-                                              std::vector<Vec3d>& xmins, 
-                                              std::vector<Vec3d>& xmaxs, 
-                                              double length_scale, 
-                                              double grid_padding )
+                                             std::vector<Vec3d>& xmins, 
+                                             std::vector<Vec3d>& xmaxs, 
+                                             std::vector<size_t>& indices,
+                                             double length_scale, 
+                                             double grid_padding )
 {
-
-   Vec3d xmax = xmaxs[0];
-   Vec3d xmin = xmins[0];
-   double maxdistance = 0;
-   
-   unsigned int n = xmins.size();
-   
-   for(unsigned int 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;
-   }
-   
-   Vec3ui dims(1,1,1);
-          
-   if(mag(xmax-xmin) > grid_padding)
-   {
-      for(unsigned int i = 0; i < 3; i++)
-      {
-         unsigned int d = (unsigned int)ceil((xmax[i] - xmin[i])/length_scale);
-         
-         if(d < 1) d = 1;
-         if(d > n) d = n;
-         dims[i] = d;
-      }
-   }
-      
-   grid.set(dims, xmin, xmax);
-   
-   for(unsigned int i = n; i > 0; i--)
-   {
-      unsigned int index = i - 1;
-      
-      // don't add inside-out AABBs
-      if ( xmins[index][0] > xmaxs[index][0] )  { continue; }
-      
-      grid.add_element(index, xmins[index], xmaxs[index]);
-   }
+    
+    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]);
+    }
 }
 
 
@@ -96,88 +100,178 @@ void BroadPhaseGrid::build_acceleration_grid( AccelerationGrid& grid,
 ///
 // --------------------------------------------------------
 
-void BroadPhaseGrid::update_broad_phase_static( const DynamicSurface& surface )
+void BroadPhaseGrid::update_broad_phase( const DynamicSurface& surface, bool continuous )
 {
-   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 );  
-   }
-   
+    
+    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 );
+        
+    }
+    
 }
 
 
 
-// --------------------------------------------------------
-///
-/// 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 );  
-   }
-   
-}
-
diff --git a/extern/eltopo/eltopo3d/broadphasegrid.h b/extern/eltopo/eltopo3d/broadphasegrid.h
index 0419c8d..776830c 100644
--- a/extern/eltopo/eltopo3d/broadphasegrid.h
+++ b/extern/eltopo/eltopo3d/broadphasegrid.h
@@ -7,8 +7,8 @@
 //
 // ---------------------------------------------------------
 
-#ifndef BROADPHASEGRID_H
-#define BROADPHASEGRID_H
+#ifndef EL_TOPO_BROADPHASEGRID_H
+#define EL_TOPO_BROADPHASEGRID_H
 
 // ---------------------------------------------------------
 // Nested includes
@@ -24,7 +24,7 @@
 class DynamicSurface;
 
 // ---------------------------------------------------------
-//  Interface declarations
+//  Class definitions
 // ---------------------------------------------------------
 
 // --------------------------------------------------------
@@ -36,68 +36,139 @@ class DynamicSurface;
 class BroadPhaseGrid : public BroadPhase
 {
 public:
-   
-   BroadPhaseGrid() :
-      m_vertex_grid(), 
-      m_edge_grid(), 
-      m_triangle_grid()
-   {}
-
-   ~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, 
+    
+    /// 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, 
-                                              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, 
+                                              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<Vec3d>& xmaxs,
+                                 std::vector<size_t>& indices,
                                  double length_scale, 
                                  double grid_padding );
-   
-   /// Regular grids
-   ///
-   AccelerationGrid m_vertex_grid;
-   AccelerationGrid m_edge_grid;
-   AccelerationGrid m_triangle_grid;  
-   
+    
+    /// 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;
+    
 };
 
 // ---------------------------------------------------------
@@ -110,9 +181,16 @@ public:
 ///
 // --------------------------------------------------------
 
-inline void BroadPhaseGrid::add_vertex( unsigned int index, const Vec3d& aabb_low, const Vec3d& aabb_high )
+inline void BroadPhaseGrid::add_vertex( size_t index, const Vec3d& aabb_low, const Vec3d& aabb_high, bool is_solid )
 {
-   m_vertex_grid.add_element( index, aabb_low, aabb_high );
+    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 );
+    }
 }
 
 // --------------------------------------------------------
@@ -121,9 +199,16 @@ inline void BroadPhaseGrid::add_vertex( unsigned int index, const Vec3d& aabb_lo
 ///
 // --------------------------------------------------------
 
-inline void BroadPhaseGrid::add_edge( unsigned int index, const Vec3d& aabb_low, const Vec3d& aabb_high )
+inline void BroadPhaseGrid::add_edge( size_t index, const Vec3d& aabb_low, const Vec3d& aabb_high, bool is_solid )
 {
-   m_edge_grid.add_element( index, aabb_low, aabb_high );
+    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 );
+    }
 }
 
 // --------------------------------------------------------
@@ -132,25 +217,71 @@ inline void BroadPhaseGrid::add_edge( unsigned int index, const Vec3d& aabb_low,
 ///
 // --------------------------------------------------------
 
-inline void BroadPhaseGrid::add_triangle( unsigned int index, const Vec3d& aabb_low, const Vec3d& aabb_high )
+inline void BroadPhaseGrid::add_triangle( size_t index, const Vec3d& aabb_low, const Vec3d& aabb_high, bool is_solid )
 {
-   m_triangle_grid.add_element( index, aabb_low, aabb_high );
+    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 );
+    }
 }
 
 
-inline void BroadPhaseGrid::update_vertex( unsigned int index, const Vec3d& aabb_low, const Vec3d& 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 )
 {
-   m_vertex_grid.update_element( index, aabb_low, aabb_high );
+    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 );
+    }
 }
 
-inline void BroadPhaseGrid::update_edge( unsigned int index, const Vec3d& aabb_low, const Vec3d& 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 )
 {
-   m_edge_grid.update_element( index, aabb_low, aabb_high );   
+    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 );
+    }
 }
 
-inline void BroadPhaseGrid::update_triangle( unsigned int index, const Vec3d& aabb_low, const Vec3d& 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 )
 {
-   m_triangle_grid.update_element( index, aabb_low, aabb_high );   
+    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 );
+    }
 }
 
 
@@ -160,9 +291,10 @@ inline void BroadPhaseGrid::update_triangle( unsigned int index, const Vec3d& aa
 ///
 // --------------------------------------------------------
 
-inline void BroadPhaseGrid::remove_vertex( unsigned int index )
+inline void BroadPhaseGrid::remove_vertex( size_t index )
 {
-   m_vertex_grid.remove_element( index );
+    m_solid_vertex_grid.remove_element( index );
+    m_dynamic_vertex_grid.remove_element( index );
 }
 
 // --------------------------------------------------------
@@ -171,9 +303,10 @@ inline void BroadPhaseGrid::remove_vertex( unsigned int index )
 ///
 // --------------------------------------------------------
 
-inline void BroadPhaseGrid::remove_edge( unsigned int index )
+inline void BroadPhaseGrid::remove_edge( size_t index )
 {
-   m_edge_grid.remove_element( index );
+    m_solid_edge_grid.remove_element( index );
+    m_dynamic_edge_grid.remove_element( index );
 }
 
 // --------------------------------------------------------
@@ -182,9 +315,10 @@ inline void BroadPhaseGrid::remove_edge( unsigned int index )
 ///
 // --------------------------------------------------------
 
-inline void BroadPhaseGrid::remove_triangle( unsigned int index )
+inline void BroadPhaseGrid::remove_triangle( size_t index )
 {
-   m_triangle_grid.remove_element( index );
+    m_solid_triangle_grid.remove_element( index );
+    m_dynamic_triangle_grid.remove_element( index );
 }
 
 // --------------------------------------------------------
@@ -193,9 +327,21 @@ inline void BroadPhaseGrid::remove_triangle( unsigned int index )
 ///
 // --------------------------------------------------------
 
-inline void BroadPhaseGrid::get_potential_vertex_collisions( const Vec3d& aabb_low, const Vec3d& aabb_high, std::vector<unsigned int>& overlapping_vertices )
+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 )
 {
-   m_vertex_grid.find_overlapping_elements( aabb_low, aabb_high, 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 );
+    }
 }
 
 // --------------------------------------------------------
@@ -204,9 +350,21 @@ inline void BroadPhaseGrid::get_potential_vertex_collisions( const Vec3d& aabb_l
 ///
 // --------------------------------------------------------
 
-inline void BroadPhaseGrid::get_potential_edge_collisions( const Vec3d& aabb_low, const Vec3d& aabb_high, std::vector<unsigned int>& overlapping_edges )
+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 )
 {
-   m_edge_grid.find_overlapping_elements( aabb_low, aabb_high, 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 );
+    }
 }
 
 // --------------------------------------------------------
@@ -215,11 +373,85 @@ inline void BroadPhaseGrid::get_potential_edge_collisions( const Vec3d& aabb_low
 ///
 // --------------------------------------------------------
 
-inline void BroadPhaseGrid::get_potential_triangle_collisions( const Vec3d& aabb_low, const Vec3d& aabb_high, std::vector<unsigned int>& overlapping_triangles )
+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 )
 {
-   m_triangle_grid.find_overlapping_elements( aabb_low, aabb_high, 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
new file mode 100644
index 0000000..87f35b7
--- /dev/null
+++ b/extern/eltopo/eltopo3d/collisionpipeline.cpp
@@ -0,0 +1,1559 @@
+// ---------------------------------------------------------
+//
+//  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;
+                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
new file mode 100644
index 0000000..646a3fa
--- /dev/null
+++ b/extern/eltopo/eltopo3d/collisionpipeline.h
@@ -0,0 +1,337 @@
+// ---------------------------------------------------------
+//
+//  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
new file mode 100644
index 0000000..1781ed3
--- /dev/null
+++ b/extern/eltopo/eltopo3d/cpp-file-template.txt
@@ -0,0 +1,27 @@
+// ---------------------------------------------------------
+//
+//  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
index b869a24..e9f9d17 100644
--- a/extern/eltopo/eltopo3d/dynamicsurface.cpp
+++ b/extern/eltopo/eltopo3d/dynamicsurface.cpp
@@ -3,8 +3,7 @@
 //  dynamicsurface.cpp
 //  Tyson Brochu 2008
 //  
-//  A triangle mesh with associated vertex locations and 
-//  velocities.  Collision detection and solving.
+//  A triangle mesh with associated vertex locations and  masses.  Query functions for getting geometry info.
 //
 // ---------------------------------------------------------
 
@@ -14,45 +13,22 @@
 
 #include <dynamicsurface.h>
 
-#include <vector>
-#include <deque>
-#include <queue>
-
-#ifdef USE_GUI
-#ifdef __APPLE__
-#include <OpenGL/gl.h>
-#else
-#ifdef WIN32
-#include <windows.h>
-#endif
-#include <GL/gl.h>
-#endif
-#endif
-
-#include <vec.h>
-#include <mat.h>
-#include <array3.h>
-#include <ccd_wrapper.h>
-#include <gluvi.h>
-#include <ctime>
-#include <nondestructivetrimesh.h>
 #include <broadphasegrid.h>
-#include <wallclocktime.h>
 #include <cassert>
-#include <sparse_matrix.h>
-#include <krylov_solvers.h>
-#include <fstream>
-#include <lapack_wrapper.h>
-#include <array2.h>
-
 #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>
 
-//#define USE_EXACT_ARITHMETIC_RAY_CASTING
-
-#ifdef USE_EXACT_ARITHMETIC_RAY_CASTING
-#include <tunicate.h>
-#endif
 
 // ---------------------------------------------------------
 // Local constants, typedefs, macros
@@ -62,56 +38,13 @@
 //  Extern globals
 // ---------------------------------------------------------
 
-const double G_EIGENVALUE_RANK_RATIO = 0.03;
+extern RunStats g_stats;
 
 // ---------------------------------------------------------
 // Static function definitions
 // ---------------------------------------------------------
 
 // ---------------------------------------------------------
-///
-/// Add a collision to the list as long as it doesn't have the same vertices as any other collisions in the list.
-///
-// ---------------------------------------------------------
-
-static void add_unique_collision( std::vector<Collision>& collisions, const Collision& new_collision )
-{
-   for ( std::vector<Collision>::iterator iter = collisions.begin(); iter != collisions.end(); ++iter )
-   {
-      if ( iter->same_vertices( new_collision ) )
-      {
-         return;
-      }
-   }
-   
-   collisions.push_back( new_collision );
-}
-
-// ---------------------------------------------------------
-///
-/// Helper function: multiply transpose(A) * D * B
-///
-// ---------------------------------------------------------
-
-static 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 );
-      }
-   }
-}
-
-// ---------------------------------------------------------
 // Member function definitions
 // ---------------------------------------------------------
 
@@ -122,3286 +55,1455 @@ static void AtDB(const SparseMatrixDynamicCSR &A, const double* diagD, const Spa
 // ---------------------------------------------------------
 
 DynamicSurface::DynamicSurface( const std::vector<Vec3d>& vertex_positions, 
-                                const std::vector<Vec3ui>& triangles,
-                                const std::vector<double>& masses,
-                                double in_proximity_epsilon,
-                                bool in_collision_safety,
-                                bool in_verbose ) :
-   m_proximity_epsilon( in_proximity_epsilon ),
-   m_verbose( in_verbose ),   
-   m_collision_safety( in_collision_safety ),
-   m_positions(0), m_newpositions(0), m_velocities(0), m_masses(0),
-   m_mesh(),
-   m_num_collisions_this_step(0), m_total_num_collisions(0)
+                               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)
 {
-   
-   m_broad_phase = new BroadPhaseGrid();
-   
-   std::cout << "constructing dynamic surface" << std::endl;
-  
-   for(unsigned int i = 0; i < vertex_positions.size(); i++)
-   {
-      m_positions.push_back( vertex_positions[i] );
-		m_newpositions.push_back( vertex_positions[i] );
-      m_velocities.push_back( Vec3d(0,0,0) );
-      m_masses.push_back( masses[i] );
-   }
-   
-   for(unsigned int i = 0; i < triangles.size(); i++)
-   {
-      m_mesh.m_tris.push_back( triangles[i] );
-   }
-   
-   std::cout << "constructed dynamic surface" << std::endl;
+    
+    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_broad_phase;
+    delete m_collision_pipeline;
 }
 
 
 // ---------------------------------------------------------
 ///
-/// Compute rank of the quadric metric tensor at a vertex
+/// Compute the unsigned distance to the surface.
 ///
 // ---------------------------------------------------------
 
-unsigned int DynamicSurface::classify_vertex( unsigned int v )
-{     
-   if ( m_mesh.m_vtxtri[v].empty() )     { return 0; }
-   
-   const std::vector<unsigned int>& incident_triangles = m_mesh.m_vtxtri[v];
-   
-   std::vector< Vec3d > N;
-   std::vector< double > W;
-   
-   for ( unsigned int i = 0; i < incident_triangles.size(); ++i )
-   {
-      unsigned int triangle_index = incident_triangles[i];
-      N.push_back( get_triangle_normal(triangle_index) );
-      W.push_back( get_triangle_area(triangle_index) );
-   }
-   
-   Mat33d A(0,0,0,0,0,0,0,0,0);
-   
-   for ( unsigned int 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 decomp failed.  Incident triangles: " << std::endl;
-      for ( unsigned int i = 0; i < W.size(); ++i )
-      {
-         std::cout << "normal: ( " << N[i] << " )    ";  
-         std::cout << "area: " << W[i] << 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;
-   
+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;
+    
 }
 
 
-
-// ---------------------------------------------------------
+// --------------------------------------------------------
 ///
-/// Add a triangle to the surface.  Update the underlying TriMesh and acceleration grid. 
+/// Break up the triangle mesh into connected components, determine surface IDs for all vertices.
 ///
-// ---------------------------------------------------------
+// --------------------------------------------------------
 
-unsigned int DynamicSurface::add_triangle( const Vec3ui& t )
+void DynamicSurface::partition_surfaces( std::vector<size_t>& surface_ids, std::vector< std::vector< size_t> >& surfaces ) const
 {
-   unsigned int new_triangle_index = m_mesh.m_tris.size();
-   m_mesh.nondestructive_add_triangle( t );
-
-   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 );
-      
-      // Add edges to grid as well
-      unsigned int new_edge_index = m_mesh.get_edge( 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 );
-      
-      new_edge_index = m_mesh.get_edge( 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 );
-      
-      new_edge_index = m_mesh.get_edge( 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 );
-   }
-   
-   return new_triangle_index;
+    
+    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] );         
+        } 
+        
+    }
+    
 }
 
-
-// ---------------------------------------------------------
+// --------------------------------------------------------
 ///
-/// Remove a triangle from the surface.  Update the underlying TriMesh and acceleration grid. 
+/// Compute all vertex normals (unweighted average).
 ///
-// ---------------------------------------------------------
+// --------------------------------------------------------
 
-void DynamicSurface::remove_triangle(unsigned int t)
+void DynamicSurface::get_all_vertex_normals( std::vector<Vec3d>& normals ) const
 {
-   m_mesh.nondestructive_remove_triangle( t );
-   if ( m_collision_safety )
-   {
-      m_broad_phase->remove_triangle( t );
-   }
+    normals.resize( get_num_vertices() );
+    for ( size_t i = 0; i < get_num_vertices(); ++i )
+    {
+        normals[i] = get_vertex_normal(i);
+    }
 }
 
 
 // ---------------------------------------------------------
 ///
-/// Add a vertex to the surface.  Update the acceleration grid. 
+/// Run intersection detection against all triangles
 ///
 // ---------------------------------------------------------
 
-unsigned int DynamicSurface::add_vertex( const Vec3d& new_vertex_position, 
-                                         const Vec3d& new_vertex_velocity, 
-                                         double new_vertex_mass )
+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
 {
-   m_positions.push_back( new_vertex_position );
-   m_newpositions.push_back( new_vertex_position );
-   m_velocities.push_back( new_vertex_velocity );
-   m_masses.push_back( new_vertex_mass );
-      
-   unsigned int new_vertex_index = m_mesh.nondestructive_add_vertex( );
-
-   assert( new_vertex_index == m_positions.size() - 1 );
-   
-   if ( m_collision_safety )
-   {
-      m_broad_phase->add_vertex( new_vertex_index, m_positions[new_vertex_index], m_positions[new_vertex_index] );       
-   }
-   
-   return new_vertex_index;
+    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] );
+        }         
+        
+    }
+    
 }
 
-
 // ---------------------------------------------------------
 ///
-/// Remove a vertex from the surface.  Update the acceleration grid. 
+/// Run intersection detection against all triangles and return the number of hits.
 ///
 // ---------------------------------------------------------
 
-void DynamicSurface::remove_vertex( unsigned int vertex_index )
+size_t DynamicSurface::get_number_of_triangle_intersections( const Vec3d& segment_point_a, 
+                                                            const Vec3d& segment_point_b ) const
 {
-   m_mesh.nondestructive_remove_vertex( vertex_index );
-   
-   if ( m_collision_safety )
-   {
-      m_broad_phase->remove_vertex( vertex_index );
-   }
-   
-   m_positions[ vertex_index ] = Vec3d( 0.0, 0.0, 0.0 );
-   m_newpositions[ vertex_index ] = Vec3d( 0.0, 0.0, 0.0 );
+    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;
+    
 }
 
 
-// --------------------------------------------------------
+// ---------------------------------------------------------
 ///
-/// Determine surface IDs for all vertices
+/// Compute rank of the quadric metric tensor at a vertex
 ///
-// --------------------------------------------------------
+// ---------------------------------------------------------
 
-void DynamicSurface::partition_surfaces( std::vector<unsigned int>& surface_ids, std::vector< std::vector< unsigned int> >& surfaces ) const
-{
-      
-   static const unsigned int UNASSIGNED = (unsigned int) ~0;
-   
-   surfaces.clear();
-   
-   surface_ids.clear();
-   surface_ids.resize( m_positions.size(), UNASSIGNED );
-   
-   unsigned int curr_surface = 0;
-   
-   while ( true )
-   { 
-      unsigned int next_unassigned_vertex;
-      for ( next_unassigned_vertex = 0; next_unassigned_vertex < surface_ids.size(); ++next_unassigned_vertex )
-      {
-         if ( m_mesh.m_vtxedge[next_unassigned_vertex].empty() ) { continue; }
-         
-         if ( surface_ids[next_unassigned_vertex] == UNASSIGNED )
-         {
-            break;
-         }
-      }
-      
-      if ( next_unassigned_vertex == surface_ids.size() )
-      {
-         break;
-      }
-      
-      std::queue<unsigned int> open;
-      open.push( next_unassigned_vertex );
-      
-      std::vector<unsigned int> surface_vertices;
-      
-      while ( false == open.empty() )
-      {
-         unsigned int vertex_index = open.front();
-         open.pop();
-         
-         if ( m_mesh.m_vtxedge[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<unsigned int>& incident_edges = m_mesh.m_vtxedge[vertex_index];
-         
-         for( unsigned int i = 0; i < incident_edges.size(); ++i )
-         {
-            unsigned int 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
+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 )
             {
-               assert( surface_ids[adjacent_vertex] == curr_surface );
+                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;
             }
-            
-         } 
-      }
-      
-      surfaces.push_back( surface_vertices );
-      
-      ++curr_surface;
-      
-   }
-   
-   std::cout << " %%%%%%%%%%%%%%%%%%%%%%% number of surfaces: " << surfaces.size() << std::endl;
-   
-   //
-   // assert all vertices are assigned and share volume IDs with their neighbours
-   //
-   
-   for ( unsigned int i = 0; i < surface_ids.size(); ++i )
-   {
-      if ( m_mesh.m_vtxedge[i].empty() ) { continue; }
-      
-      assert( surface_ids[i] != UNASSIGNED );
-      
-      const std::vector<unsigned int>& incident_edges = m_mesh.m_vtxedge[i];    
-      for( unsigned int j = 0; j < incident_edges.size(); ++j )
-      {
-         unsigned int 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] );         
-      } 
-      
-   }
-   
+        }
+        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;
+    
 }
 
 
 // ---------------------------------------------------------
 ///
-/// Compute the maximum timestep that will not invert any triangle normals, using a quadratic solve as in [Jiao 2007].
+/// Advance mesh by one time step 
 ///
 // ---------------------------------------------------------
 
-double DynamicSurface::compute_max_timestep_quadratic_solve( const std::vector<Vec3ui>& tris, 
-                                                       const std::vector<Vec3d>& positions, 
-                                                       const std::vector<Vec3d>& displacements, 
-                                                       bool verbose ) 
-{
-   double max_beta = 1.0;
-   
-   double min_area = 1e30;
-   
-   for ( unsigned int 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 ) 
-         {
-            printf( "super small triangle %d (%d %d %d)\n", i, tris[i][0], tris[i][1], tris[i][2] );
-         }
-      }
-      
-      if ( fabs(a) == 0 )
-      {
-         if ( verbose ) 
-         { 
-            //printf( "triangle %d: ", i ); 
-            //printf( "a == 0 (%g)\n", a ); 
-         }
-         
-         if ( ( fabs(b) > 1e-14 ) && ( -c / b >= 0.0 ) )
-         {
-            beta = -c / b;
-         }
-         else
-         {
-            if ( verbose )
-            {
-               if ( fabs(b) < 1e-14 )
-               {
-                  printf( "triangle %d: ", i ); 
-                  printf( "b == 0 too (%g).\n", b );
-               }
-            }
-         }
-      }
-      else
-      {
-         double descriminant = b*b - 4.0*a*c;
-         
-         if ( descriminant < 0.0  )
-         {
-            // Hmm, what does this mean?
-            if ( verbose )
+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 )
             {
-               printf( "triangle %d: descriminant == %g\n", i, descriminant );
+                //if ( m_verbose ) 
+                { std::cout << "IIZ" << std::endl; }
+                solver_ok = impactZoneSolver.inelastic_impact_zones( curr_dt );            
             }
             
-            beta = 1.0;
-         }
-         else
-         {
-            double q;
-            if ( b > 0.0 )
-            {
-               q = -0.5 * ( b + sqrt( descriminant ) );
-            }
-            else
+            if ( !solver_ok )
             {
-               q = -0.5 * ( b - sqrt( descriminant ) );
-            }
+                //if ( m_verbose ) 
+                { std::cout << "RIZ" << std::endl; }
+                // punt to rigid impact zones
+                solver_ok = impactZoneSolver.rigid_impact_zones( curr_dt );
+            }  
             
-            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 ( !solver_ok )
             {
-               if ( beta_2 < 0.0 )
-               {
-                  beta = beta_1;
-               }
-               else if ( beta_1 < beta_2 )
-               {
-                  beta = beta_1;
-               }
-               else
-               {
-                  beta = beta_2;
-               }
+                // 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;      
             }
             
-         }
-      }
-      
-      bool changed = false;
-      if ( beta < max_beta )
-      {
-         max_beta = 0.99 * beta;
-         changed = true;
-         
-         if ( verbose )
-         {
-            printf( "changing beta --- triangle: %d\n", i );
-            printf( "new max beta: %g\n", max_beta );
-            printf( "a = %g, b = %g, c = %g\n", a, b, c );
-         }
-         
-         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 )
-      {
-         printf( "triangle %d: (%d %d %d)\n", i, tris[i][0], tris[i][1], tris[i][2] );
-         printf( "old normal: %g %g %g\n", old_normal[0], old_normal[1], old_normal[2] );
-         printf( "new normal: %g %g %g\n", new_normal[0], new_normal[1], new_normal[2] );         
-         printf( "dot product: %g\n", dot( triangle_normal(x1, x2, x3), triangle_normal(new_x1, new_x2, new_x3) ) );
-         printf( "%s\n", (changed ? "changed" : "not changed") );
-         printf( "beta: %g\n", beta );
-         printf( "max beta: %g\n", max_beta );
-         //assert(0);
-      }
-   }
-   
-   return max_beta;
-}
-
-
-// ---------------------------------------------------------
-///
-/// Compute the unsigned distance to the surface.
-///
-// ---------------------------------------------------------
-
-double DynamicSurface::distance_to_surface( const Vec3d& p, unsigned int& closest_triangle )
-{
-   
-   double padding = m_proximity_epsilon;
-   double min_distance = 1e30;
-   
-   while ( min_distance == 1e30 )
-   {
-      
-      Vec3d xmin( p - Vec3d( padding ) );
-      Vec3d xmax( p + Vec3d( padding ) );
-      
-      std::vector<unsigned int> nearby_triangles;   
-      
-      m_broad_phase->get_potential_triangle_collisions( xmin, xmax, nearby_triangles );
             
-      for ( unsigned int j = 0; j < nearby_triangles.size(); ++j )
-      {
-         const Vec3ui& tri = m_mesh.m_tris[ nearby_triangles[j] ];
-
-         if ( tri[0] == tri[1] || tri[1] == tri[2] || tri[0] == tri[2] ) { continue; }
-
-         if ( m_masses[tri[0]] > 1.5 && m_masses[tri[1]] > 1.5 && m_masses[tri[2]] > 1.5 ) { continue; }
-         
-         double curr_distance;
-         check_point_triangle_proximity( p, m_positions[tri[0]], m_positions[tri[1]], m_positions[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;
-
-}
-
-
-// ---------------------------------------------------------
-///
-/// 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<unsigned int>& hit_triangles ) const
-{
-   Vec3d aabb_low, aabb_high;
-   minmax( segment_point_a, segment_point_b, aabb_low, aabb_high );
-   
-   std::vector<unsigned int> overlapping_triangles;
-   m_broad_phase->get_potential_triangle_collisions( aabb_low, aabb_high, overlapping_triangles );
-   
-   for ( unsigned int i = 0; i < overlapping_triangles.size(); ++i )
-   {
-      const Vec3ui& tri = m_mesh.m_tris[ overlapping_triangles[i] ];
-      
-      Vec3ui t = sort_triangle( tri );
-      assert( t[0] < t[1] && t[0] < t[2] && t[1] < t[2] );
-      
-      const Vec3d& v0 = m_positions[ t[0] ];
-      const Vec3d& v1 = m_positions[ t[1] ];
-      const Vec3d& v2 = m_positions[ t[2] ];      
-      
-      unsigned int dummy_index = m_positions.size();
-      
-      double bary1, bary2, bary3;
-      Vec3d normal;
-      double s;
-      double relative_normal_displacement;
-      
-      bool hit = point_triangle_collision( segment_point_a, segment_point_b, dummy_index,
-                                           v0, v0, t[0],
-                                           v1, v1, t[1],
-                                           v2, v2, t[2],
-                                           bary1, bary2, bary3,
-                                           normal,
-                                           s, relative_normal_displacement );
-                                
-      if ( hit )
-      {
-         hit_ss.push_back( s );
-         hit_triangles.push_back( overlapping_triangles[i] );
-      }         
-      
-   }
-   
+            // 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;
+    
 }
 
 // ---------------------------------------------------------
 ///
-/// Run intersection detection against all triangles and return the number of hits.
+/// Construct static acceleration structure
 ///
 // ---------------------------------------------------------
 
-unsigned int 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<unsigned int> overlapping_triangles;
-   m_broad_phase->get_potential_triangle_collisions( aabb_low, aabb_high, overlapping_triangles );
-
-   for ( unsigned int i = 0; i < overlapping_triangles.size(); ++i )
-   {
-      const Vec3ui& tri = m_mesh.m_tris[ overlapping_triangles[i] ];
-      
-      Vec3ui t = sort_triangle( tri );
-      assert( t[0] < t[1] && t[0] < t[2] && t[1] < t[2] );
-      
-      const Vec3d& v0 = m_positions[ t[0] ];
-      const Vec3d& v1 = m_positions[ t[1] ];
-      const Vec3d& v2 = m_positions[ t[2] ];      
-      
-      unsigned int dummy_index = m_positions.size();
-      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;
-
-}
-
-
-#ifdef USE_EXACT_ARITHMETIC_RAY_CASTING
-
-static Mat44d look_at(const Vec3d& from,
-                      const Vec3d& to)
-{
-   Mat44d T;
-   Vec3d c=-normalized(to-from);
-   Vec3d a=cross(Vec3d(0,1,0), c);
-   Vec3d b=cross(c, a);
-   
-   T(0,0)=a[0]; T(0,1)=a[1]; T(0,2)=a[2]; T(0,3) = -dot(a,from);
-   T(1,0)=b[0]; T(1,1)=b[1]; T(1,2)=b[2]; T(1,3) = -dot(b,from);
-   T(2,0)=c[0]; T(2,1)=c[1]; T(2,2)=c[2]; T(2,3) = -dot(c,from);
-   T(3,0)=0.0;  T(3,1)=0.0;  T(3,2)=0.0;  T(3,3) = 1.0;
-   
-   return T;
-}
-
-static Vec3d apply_to_point( const Mat44d& M, const Vec3d& x )
+void DynamicSurface::rebuild_static_broad_phase()
 {
-   double w = M(3,0)*x[0] + M(3,1)*x[1] + M(3,2)*x[2] + M(3,3);
-   
-   return Vec3d((M(0,0)*x[0] + M(0,1)*x[1] + M(0,2)*x[2] + M(0,3))/w,
-                (M(1,0)*x[0] + M(1,1)*x[1] + M(1,2)*x[2] + M(1,3))/w,
-                (M(2,0)*x[0] + M(2,1)*x[1] + M(2,2)*x[2] + M(2,3))/w );
+    assert( m_collision_safety );
+    m_broad_phase->update_broad_phase( *this, false );
 }
 
 // ---------------------------------------------------------
 ///
-/// Run intersection detection against all triangles and return the number of hits.  Use exact arithmetic.
+/// Construct continuous acceleration structure
 ///
 // ---------------------------------------------------------
 
-unsigned int DynamicSurface::get_number_of_triangle_intersections_exact( const Vec3d& segment_point_a, 
-                                                                         const Vec3d& segment_point_b ) const
+void DynamicSurface::rebuild_continuous_broad_phase()
 {
-   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<unsigned int> overlapping_triangles;
-   m_broad_phase->get_potential_triangle_collisions( aabb_low, aabb_high, overlapping_triangles );
-   
-   for ( unsigned int i = 0; i < overlapping_triangles.size(); ++i )
-   {
-      const Vec3ui& tri = m_mesh.m_tris[ overlapping_triangles[i] ];
-      
-      Vec3ui t = sort_triangle( tri );
-      assert( t[0] < t[1] && t[0] < t[2] && t[1] < t[2] );
-      
-      const Vec3d v0 = (m_positions[ t[0] ]);
-      const Vec3d v1 = (m_positions[ t[1] ]);
-      const Vec3d v2 = (m_positions[ t[2] ]);      
-            
-      Vec3d ortho = cross( v1-v0, v2-v0 );
-      
-      double ray_length = mag( segment_point_b - segment_point_a );
-      Vec3d ray_direction = ( segment_point_b - segment_point_a ) / ray_length;
-      Vec3d ray_origin( segment_point_a );
-      
-      // find plane intersection with ray
-      double dn=dot( ray_direction, ortho );
-
-      if ( dn==0 )
-      {
-         ++num_misses;
-         continue;
-      }
-   
-      double s0 = -dot( ray_origin - v0, ortho ) / dn;
-
-      if ( s0 < 0 || s0 > ray_length ) 
-      { 
-         // no hit
-         ++num_misses;
-         continue;
-      }
-      
-      Mat44d transform = look_at( ray_direction, Vec3d(0,0,0) );
-      
-      Vec3d a = apply_to_point( transform, v0 - ray_origin );
-      Vec3d b = apply_to_point( transform, v1 - ray_origin );
-      Vec3d c = apply_to_point( transform, v2 - ray_origin );
-      
-      Vec2d a2( a[0], a[1] );
-      Vec2d b2( b[0], b[1] );
-      Vec2d c2( c[0], c[1] );
-      Vec2d r2( 0, 0 );
-      
-      //std::cout << "2d triangle: " << a2 << ", " << b2 << ", " << c2 << std::endl;
-      
-      double bary[4];
-      int dummy_index = m_positions.size();
-      int result = sos_simplex_intersection2d( 3, 
-                                               t[0], a2.v, 
-                                               t[1], b2.v, 
-                                               t[2], c2.v, 
-                                               dummy_index, r2.v, 
-                                               &(bary[0]), &(bary[1]), &(bary[2]), &(bary[3]) );
-
-      if ( result != 0 )
-      {
-         ++num_hits;
-      }         
-      else
-      {
-         ++num_misses;
-      }
-   }
-   
-   return num_hits;
+    assert( m_collision_safety );
+    m_broad_phase->update_broad_phase( *this, true );
 }
 
-#endif
-
 
 // ---------------------------------------------------------
 ///
-/// Determine whether a point is inside the volume defined by the surface.  Uses raycast-voting.
+/// Update the broadphase elements incident to the given vertex
 ///
 // ---------------------------------------------------------
 
-bool DynamicSurface::point_is_inside( const Vec3d& p )
+void DynamicSurface::update_static_broad_phase( size_t vertex_index )
 {
-
-#ifdef USE_EXACT_ARITHMETIC_RAY_CASTING
-   
-   // Exact arithmetic ray casting:
-   Vec3d ray_end( p + Vec3d( 1e+3, 1, 0 ) );
-   int hits = get_number_of_triangle_intersections_exact( p, ray_end );
-   
-   if ( hits % 2 == 1 ) { return true; }   
-   return false;
-   
-#else
-   
-   //
-   // The point is inside if there are an odd number of hits on a ray cast from the point. 
-   // We'll cast six rays for numerical robustness.
-   //
-
-   
-   unsigned int inside_votes = 0;
-   
-   // shoot a ray in the positive-x direction
-   Vec3d ray_end( p + Vec3d( 1e+3, 1, 0 ) );
-   int hits = get_number_of_triangle_intersections( p, ray_end );
-   if ( hits % 2 == 1 ) { ++inside_votes; }
-   
-   // negative x
-   ray_end = p - Vec3d( 1e+3, 0, 1 );
-   hits = get_number_of_triangle_intersections( p, ray_end );
-   if ( hits % 2 == 1 ) { ++inside_votes; }
-
-   // positive y
-   ray_end = p + Vec3d( 1, 1e+3, 0 );
-   hits = get_number_of_triangle_intersections( p, ray_end );
-   if ( hits % 2 == 1 ) { ++inside_votes; }
-
-   // negative y
-   ray_end = p - Vec3d( 0, 1e+3, 1 );
-   hits = get_number_of_triangle_intersections( p, ray_end );
-   if ( hits % 2 == 1 ) { ++inside_votes; }
-
-   // positive z
-   ray_end = p + Vec3d( 0, 1, 1e+3 );
-   hits = get_number_of_triangle_intersections( p, ray_end );
-   if ( hits % 2 == 1 ) { ++inside_votes; }
-   
-   // negative z
-   ray_end = p - Vec3d( 1, 0, 1e+3 );
-   hits = get_number_of_triangle_intersections( p, ray_end );
-   if ( hits % 2 == 1 ) { ++inside_votes; }
-   
-   return ( inside_votes > 3 );
-   
-#endif
-   
+    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]) );
+    }
+    
 }
 
 
 // ---------------------------------------------------------
 ///
-/// Remove all vertices not incident on any triangles.
+/// Update the broadphase elements incident to the given vertex, using current and predicted vertex positions
 ///
 // ---------------------------------------------------------
 
-void DynamicSurface::clear_deleted_vertices( )
+void DynamicSurface::update_continuous_broad_phase( size_t vertex_index )
 {
-
-   unsigned int j = 0;
-   
-   for ( unsigned int i = 0; i < m_positions.size(); ++i )
-   {
-      std::vector<unsigned int>& inc_tris = m_mesh.m_vtxtri[i];
-
-      if ( inc_tris.size() != 0 )
-      {
-         m_positions[j] = m_positions[i];
-         m_newpositions[j] = m_newpositions[i];
-         m_velocities[j] = m_velocities[i];
-         m_masses[j] = m_masses[i];
-         
-         for ( unsigned int t = 0; t < inc_tris.size(); ++t )
-         {
-            Vec3ui& triangle = m_mesh.m_tris[ inc_tris[t] ];
-            
-            if ( triangle[0] == i ) { triangle[0] = j; }
-            if ( triangle[1] == i ) { triangle[1] = j; }
-            if ( triangle[2] == i ) { triangle[2] = j; }            
-         }
-         
-         ++j;
-      }
-
-   }
-      
-   m_positions.resize(j);
-   m_newpositions.resize(j);
-   m_velocities.resize(j);
-   m_masses.resize(j);
-
+    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]) );
+    }
 }
 
 
 // ---------------------------------------------------------
 ///
-/// Apply an impulse between two edges 
+/// Compute the (padded) AABB of a vertex
 ///
 // ---------------------------------------------------------
 
-void DynamicSurface::apply_edge_edge_impulse( const Vec2ui& edge0, 
-                                              const Vec2ui& edge1,
-                                              double s0, 
-                                              double s2, 
-                                              Vec3d& direction, 
-                                              double magnitude )
+void DynamicSurface::vertex_static_bounds(size_t v, Vec3d &xmin, Vec3d &xmax) const
 {
-   Vec3d& v0 = m_velocities[edge0[0]];
-   Vec3d& v1 = m_velocities[edge0[1]];
-   Vec3d& v2 = m_velocities[edge1[0]];
-   Vec3d& v3 = m_velocities[edge1[1]];
-   double inv_m0 = m_masses[edge0[0]] < 100 ? 1 / m_masses[edge0[0]] : 0.0;
-   double inv_m1 = m_masses[edge0[1]] < 100 ? 1 / m_masses[edge0[1]] : 0.0;
-   double inv_m2 = m_masses[edge1[0]] < 100 ? 1 / m_masses[edge1[0]] : 0.0;
-   double inv_m3 = m_masses[edge1[1]] < 100 ? 1 / m_masses[edge1[1]] : 0.0;
-    
-   double s1 = 1.0 - s0;
-   double s3 = 1.0 - s2;
-   double i = magnitude/(s0*s0*inv_m0 + s1*s1*inv_m1 + s2*s2*inv_m2 + s3*s3*inv_m3);
-   
-   v0 += i*s0*inv_m0 * direction;
-   v1 += i*s1*inv_m1 * direction;
-   v2 -= i*s2*inv_m2 * direction;
-   v3 -= i*s3*inv_m3 * direction;
+    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);
+    }
 }
 
 // ---------------------------------------------------------
 ///
-/// Apply an impulse between a point and a triangle
+/// Compute the AABB of an edge
 ///
 // ---------------------------------------------------------
 
-void DynamicSurface::apply_triangle_point_impulse( const Vec3ui& tri, 
-                                                   unsigned int v,
-                                                   double s1, 
-                                                   double s2, 
-                                                   double s3, 
-                                                   Vec3d& direction, 
-                                                   double magnitude )
+void DynamicSurface::edge_static_bounds(size_t e, Vec3d &xmin, Vec3d &xmax) const
 {
-
-   Vec3d& v0 = m_velocities[v];
-   Vec3d& v1 = m_velocities[tri[0]];
-   Vec3d& v2 = m_velocities[tri[1]];
-   Vec3d& v3 = m_velocities[tri[2]];
-   double inv_m0 = m_masses[v] < 100 ? 1 / m_masses[v] : 0.0;
-   double inv_m1 = m_masses[tri[0]] < 100 ? 1 / m_masses[tri[0]] : 0.0;
-   double inv_m2 = m_masses[tri[1]] < 100 ? 1 / m_masses[tri[1]] : 0.0;
-   double inv_m3 = m_masses[tri[2]] < 100 ? 1 / m_masses[tri[2]] : 0.0;
-
-   double i = magnitude / (inv_m0 + s1*s1*inv_m1 + s2*s2*inv_m2 + s3*s3*inv_m3);
-
-   v0 += (i*inv_m0) * direction;
-   v1 -= (i*s1*inv_m1) * direction;
-   v2 -= (i*s2*inv_m2) * direction;
-   v3 -= (i*s3*inv_m3) * direction;
+    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);
+    }
 }
- 
-
 
 // ---------------------------------------------------------
 ///
-/// Detect all triangle-point proximities and apply repulsion impulses
+/// Compute the AABB of a triangle
 ///
 // ---------------------------------------------------------
 
-void DynamicSurface::handle_triangle_point_proximities( double dt )
+void DynamicSurface::triangle_static_bounds(size_t t, Vec3d &xmin, Vec3d &xmax) const
 {
-
-   unsigned int broadphase_hits = 0;
-   unsigned int point_triangle_proximities = 0;
-   
-   for ( unsigned int i = 0; i < m_mesh.m_tris.size(); ++i )
-   {
-      const Vec3ui& tri = m_mesh.m_tris[i];
-      
-      if ( tri[0] == tri[1] )    { continue; }
-
-
-      Vec3d low, high;
-      triangle_static_bounds( i, low, high );
-      std::vector<unsigned int> potential_vertex_collisions;
-      m_broad_phase->get_potential_vertex_collisions( low, high, potential_vertex_collisions );
-      
-      for ( unsigned int j = 0; j < potential_vertex_collisions.size(); ++j )
-      {
-         unsigned int v = potential_vertex_collisions[j];
-   
-         if(tri[0] != v && tri[1] != v && tri[2] != v)
-         {
-            ++broadphase_hits;
-            double distance, s1, s2, s3;
-            Vec3d normal;
-            
-            point_triangle_distance( m_positions[v], v,
-                                     m_positions[tri[0]], tri[0],
-                                     m_positions[tri[1]], tri[1],
-                                     m_positions[tri[2]], tri[2],
-                                     distance, s1, s2, s3, normal );
-            
-            if(distance < m_proximity_epsilon)
-            {
-               
-               double relvel = dot(normal, m_velocities[v] - (s1*m_velocities[tri[0]] + s2*m_velocities[tri[1]] + s3*m_velocities[tri[2]]));
-               double desired_relative_velocity = ( m_proximity_epsilon - distance ) / dt;
-               double impulse = (desired_relative_velocity - relvel);
-               
-               apply_triangle_point_impulse( tri, v, s1, s2, s3, normal, impulse);
-               
-               ++point_triangle_proximities;
-               
-            }
-         }      
-      }
-   }
-
+    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);
+    }
 }
 
-
 // ---------------------------------------------------------
 ///
-/// Detect all edge-edge proximities and apply repulsion impulses
+/// Compute the AABB of a continuous vertex
 ///
 // ---------------------------------------------------------
 
-void DynamicSurface::handle_edge_edge_proximities( double dt )
+void DynamicSurface::vertex_continuous_bounds(size_t v, Vec3d &xmin, Vec3d &xmax) const
 {
-
-   unsigned int edge_edge_proximities = 0;
-   
-   for ( unsigned int i = 0; i < m_mesh.m_edges.size(); ++i )
-   {
-      const Vec2ui& e0 = m_mesh.m_edges[ i ];
-      
-      if ( e0[0] == e0[1] ) { continue; }
-      
-      Vec3d low, high;
-      edge_static_bounds( i, low, high );
-      std::vector<unsigned int> potential_collisions;
-      m_broad_phase->get_potential_edge_collisions( low, high, potential_collisions );
-      
-      for ( unsigned int j = 0; j < potential_collisions.size(); ++j )
-      {
-         if ( potential_collisions[j] <= i )    { continue; }
-         
-         const Vec2ui& e1 = m_mesh.m_edges[ potential_collisions[j] ];
-         
-         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;
-            
-            segment_segment_distance( m_positions[e0[0]], e0[0],
-                                      m_positions[e0[1]], e0[1],
-                                      m_positions[e1[0]], e1[0],
-                                      m_positions[e1[1]], e0[1],
-                                      distance, s0, s2, normal);
-            
-            if( distance < m_proximity_epsilon )
-            {
-               ++edge_edge_proximities;
-               
-               double relvel = dot(normal, s0*m_velocities[e0[0]] + (1.0-s0)*m_velocities[e0[1]] - (s2*m_velocities[e1[0]] + (1.0-s2)*m_velocities[e1[1]]));
-               double desired_relative_velocity = ( m_proximity_epsilon - distance ) / dt;               
-               double impulse = ( desired_relative_velocity - relvel );
-               
-               apply_edge_edge_impulse( e0, e1, s0, s2, normal, impulse);
-            }
-         }
-      }
-   }
-   
+    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);
+    }
 }
 
-
 // ---------------------------------------------------------
 ///
-/// Add point-triangle collision candidates for a specified triangle
+/// Compute the AABB of a continuous edge
 ///
 // ---------------------------------------------------------
 
-void DynamicSurface::add_triangle_candidates(unsigned int t, CollisionCandidateSet& collision_candidates)
+void DynamicSurface::edge_continuous_bounds(size_t e, Vec3d &xmin, Vec3d &xmax) const
 {
-   Vec3d tmin, tmax;
-   triangle_continuous_bounds(t, tmin, tmax);
-   tmin -= Vec3d( m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon );
-   tmax += Vec3d( m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon );
-   
-   std::vector<unsigned int> candidate_vertices;
-   m_broad_phase->get_potential_vertex_collisions( tmin, tmax, candidate_vertices );
-   
-   for(unsigned int j = 0; j < candidate_vertices.size(); j++)
-   {
-      add_to_collision_candidates( collision_candidates, Vec3ui(t, candidate_vertices[j], 0) );
-   }
-   
+    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);
+    }
 }
 
 // ---------------------------------------------------------
 ///
-/// Add edge-edge collision candidates for a specified edge
+/// Compute the AABB of a continuous triangle
 ///
 // ---------------------------------------------------------
 
-void DynamicSurface::add_edge_candidates(unsigned int e, CollisionCandidateSet& collision_candidates)
+void DynamicSurface::triangle_continuous_bounds(size_t t, Vec3d &xmin, Vec3d &xmax) const
 {
-   Vec3d emin, emax;
-   edge_continuous_bounds(e, emin, emax);
-   emin -= Vec3d( m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon );
-   emax += Vec3d( m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon );
-   
-   std::vector<unsigned int> candidate_edges;
-   m_broad_phase->get_potential_edge_collisions( emin, emax, candidate_edges);
-   
-   for(unsigned int j = 0; j < candidate_edges.size(); j++)
-   {
-      add_to_collision_candidates( collision_candidates, Vec3ui(e, candidate_edges[j], 1) );
-   }
+    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);
+    }
 }
 
-// ---------------------------------------------------------
-///
-/// Add point-triangle collision candidates for a specified vertex
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::add_point_candidates(unsigned int v, CollisionCandidateSet& collision_candidates)
-{
-   Vec3d vmin, vmax;
-   vertex_continuous_bounds(v, vmin, vmax);
-   vmin -= Vec3d( m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon );
-   vmax += Vec3d( m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon );
-   
-   std::vector<unsigned int> candidate_triangles;
-   m_broad_phase->get_potential_triangle_collisions( vmin, vmax, candidate_triangles);
-   
-   for(unsigned int j = 0; j < candidate_triangles.size(); j++)
-   {
-      add_to_collision_candidates( collision_candidates, Vec3ui(candidate_triangles[j], v, 0) );
-   }
-}
 
 // ---------------------------------------------------------
 ///
-/// Add collision candidates for a specified vertex and all elements incident on the vertex
+/// Check two axis-aligned bounding boxes for intersection
 ///
 // ---------------------------------------------------------
 
-void DynamicSurface::add_point_update_candidates(unsigned int v, CollisionCandidateSet& collision_candidates)
+static bool aabbs_intersect( const Vec3d& a_xmin, const Vec3d& a_xmax, const Vec3d& b_xmin, const Vec3d& b_xmax )
 {
-   add_point_candidates(v, collision_candidates);
-   
-   std::vector<unsigned int>& incident_triangles = m_mesh.m_vtxtri[v];
-   std::vector<unsigned int>& incident_edges = m_mesh.m_vtxedge[v];
-   
-   for(unsigned int i = 0; i < incident_triangles.size(); i++)
-      add_triangle_candidates(incident_triangles[i], collision_candidates);
-   
-   for(unsigned int i = 0; i < incident_edges.size(); i++)
-      add_edge_candidates(incident_edges[i], collision_candidates);
+    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;
 }
 
 
 // ---------------------------------------------------------
 ///
-/// Perform one sweep of impulse collision handling, only for "deformable" vertices against "solid" triangles
+/// Caution: slow!
+/// Check the consistency of the broad phase by comparing against the N^2 broadphase.
 ///
 // ---------------------------------------------------------
 
-void DynamicSurface::handle_point_vs_solid_triangle_collisions( double dt )
+void DynamicSurface::check_static_broad_phase_is_up_to_date() const
 {
-   
-   for(unsigned int i = 0; i < m_mesh.m_tris.size(); i++)
-   {
-      CollisionCandidateSet triangle_collision_candidates;
-      add_triangle_candidates(i, triangle_collision_candidates);
-      
-      while( false == triangle_collision_candidates.empty() )
-      {
-         CollisionCandidateSet::iterator iter = triangle_collision_candidates.begin();
-         Vec3ui candidate = *iter;
-         triangle_collision_candidates.erase(iter);
-      
-         unsigned int t = candidate[0];
-         Vec3ui tri = m_mesh.m_tris[t];
-         unsigned int v = candidate[1];
-         
-         if ( m_masses[v] < 100 && m_masses[tri[0]] > 100 && m_masses[tri[1]] > 100 && m_masses[tri[2]] > 100 )
-         {
-         
-            if(tri[0] != v && tri[1] != v && tri[2] != v)
+    
+    // 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] ) )
             {
-               double time, s1, s2, s3, rel_disp;
-               Vec3d normal;
-                            
-               Vec3ui sorted_tri = sort_triangle( tri );
-               
-               assert( sorted_tri[0] < sorted_tri[1] && sorted_tri[0] < sorted_tri[2] && sorted_tri[1] < sorted_tri[2] );
-               
-               if ( point_triangle_collision( m_positions[v], m_newpositions[v], v, 
-                                             m_positions[sorted_tri[0]], m_newpositions[sorted_tri[0]], sorted_tri[0],
-                                             m_positions[sorted_tri[1]], m_newpositions[sorted_tri[1]], sorted_tri[1],
-                                             m_positions[sorted_tri[2]], m_newpositions[sorted_tri[2]], sorted_tri[2],
-                                             s1, s2, s3,
-                                             normal,
-                                             time, rel_disp ) )                                 
-                  
-               {
-                  
-                  ++m_num_collisions_this_step;
-                  
-                  double relvel = rel_disp / dt;
-                  
-                  apply_triangle_point_impulse(sorted_tri, v, s1, s2, s3, normal, -relvel);
-                                  
-                  m_newpositions[v] = m_positions[v] + dt*m_velocities[v];
-                  m_newpositions[tri[0]] = m_positions[tri[0]] + dt*m_velocities[tri[0]];
-                  m_newpositions[tri[1]] = m_positions[tri[1]] + dt*m_velocities[tri[1]];
-                  m_newpositions[tri[2]] = m_positions[tri[2]] + dt*m_velocities[tri[2]];
-                  
-                  update_continuous_broad_phase( v );
-                  update_continuous_broad_phase( tri[0] );
-                  update_continuous_broad_phase( tri[1] );
-                  update_continuous_broad_phase( tri[2] );             
-               }
-                  
+                overlapping_triangles.erase( overlapping_triangles.begin() + k );
+                --k;
             }
-         }
-      }      
-   }
-   
-}
-
-
-// ---------------------------------------------------------
-///
-/// Detect all continuous collisions and apply impulses to prevent them.
-/// Return true if all collisions were resolved.
-///
-// ---------------------------------------------------------
-
-bool DynamicSurface::handle_collisions(double dt)
-{
-   
-   const unsigned int MAX_PASS = 3;
-   const unsigned int MAX_CANDIDATES = (unsigned int) 1e+6; 
-   
-   CollisionCandidateSet update_collision_candidates;
-   
-   if ( MAX_PASS == 0 )
-   {
-      return false;
-   }
-   
-   bool collision_found = true;
-   bool candidate_overflow = false;
-
-   for ( unsigned int pass = 0; ( collision_found && (pass < MAX_PASS) ); ++pass )
-   {
-      collision_found = false;
-      
-      for(unsigned int i = 0; i < m_mesh.m_tris.size(); i++)
-      {
-         CollisionCandidateSet triangle_collision_candidates;
-         add_triangle_candidates(i, triangle_collision_candidates);
-         
-         while( false == triangle_collision_candidates.empty() )
-         {
-            CollisionCandidateSet::iterator iter = triangle_collision_candidates.begin();
-            Vec3ui candidate = *iter;
-            triangle_collision_candidates.erase(iter);
-            
-            unsigned int t = candidate[0];
-            Vec3ui tri = m_mesh.m_tris[t];
-            unsigned int v = candidate[1];
-            
-            if(tri[0] != v && tri[1] != v && tri[2] != v)
+        }
+        
+        // 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 ) )
             {
-               double time, s1, s2, s3, rel_disp;
-               Vec3d normal;              
-
-               Vec3ui sorted_tri = sort_triangle( tri );
-
-               if ( point_triangle_collision( m_positions[v], m_newpositions[v], v,
-                                             m_positions[sorted_tri[0]], m_newpositions[sorted_tri[0]], sorted_tri[0],
-                                             m_positions[sorted_tri[1]], m_newpositions[sorted_tri[1]], sorted_tri[1],
-                                             m_positions[sorted_tri[2]], m_newpositions[sorted_tri[2]], sorted_tri[2],
-                                             s1, s2, s3,
-                                             normal,
-                                             time, rel_disp ) )               
-                  
-               {
-                                                             
-                  ++m_num_collisions_this_step;
-                  
-                  double relvel = rel_disp / dt;
-                 
-                  apply_triangle_point_impulse(sorted_tri, v, s1, s2, s3, normal, -relvel);
-                  
-                  if ( m_verbose ) std::cout << "(PT) time: " << time << ", relative velocity before: " << relvel;
-                  
-                  double relvel_after = dot(normal, m_velocities[v] - (s1*m_velocities[sorted_tri[0]] + s2*m_velocities[sorted_tri[1]] + s3*m_velocities[sorted_tri[2]]));
-                  
-                  if ( m_verbose ) std::cout << " and relative velocity after: " << relvel_after << std::endl;
-                  
-                  m_newpositions[v] = m_positions[v] + dt*m_velocities[v];
-                  m_newpositions[tri[0]] = m_positions[tri[0]] + dt*m_velocities[tri[0]];
-                  m_newpositions[tri[1]] = m_positions[tri[1]] + dt*m_velocities[tri[1]];
-                  m_newpositions[tri[2]] = m_positions[tri[2]] + dt*m_velocities[tri[2]];
-                  
-                  update_continuous_broad_phase( v  );
-                  update_continuous_broad_phase( tri[0] );
-                  update_continuous_broad_phase( tri[1] );
-                  update_continuous_broad_phase( tri[2] );
-                                    
-                  if ( pass == MAX_PASS - 1 )
-                  {
-                     if ( update_collision_candidates.size() < MAX_CANDIDATES )
-                     {
-                        add_point_update_candidates(v, update_collision_candidates);
-                        add_point_update_candidates(tri[0], update_collision_candidates);
-                        add_point_update_candidates(tri[1], update_collision_candidates);
-                        add_point_update_candidates(tri[2], update_collision_candidates);
-                     }
-                     else
-                     {
-                        candidate_overflow = true;
-                     }
-                  }
-                  
-                  collision_found = true;
-                  
-               }            
+                brute_force_overlapping_triangles.push_back( j );            
             }
-         }      
-      }
-         
-      m_verbose = false;
-      
-      for(unsigned int i = 0; i < m_mesh.m_edges.size(); i++)
-      {
-         CollisionCandidateSet edge_collision_candidates;
-         add_edge_candidates(i, edge_collision_candidates);
-                           
-         while ( false == edge_collision_candidates.empty() )
-         {
-            CollisionCandidateSet::iterator iter = edge_collision_candidates.begin();
-            Vec3ui candidate = *iter;
-            edge_collision_candidates.erase(iter);
-                     
-            Vec2ui e0 = m_mesh.m_edges[candidate[0]];
-            Vec2ui e1 = m_mesh.m_edges[candidate[1]];
-                                    
-            assert( candidate[0] == i );
-            
-            if ( candidate[1] <= i ) { continue; }
-            
-            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])
+        }
+        
+        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] ) )
             {
-               double time, s0, s2, rel_disp;
-               Vec3d normal;
-
-               if ( e0[1] < e0[0] ) { swap( e0[0], e0[1] ); }
-               if ( e1[1] < e1[0] ) { swap( e1[0], e1[1] ); }
-               
-               if ( ( e0[1] < e0[0] ) || ( e1[1] < e1[0] ) )
-               {
-                  std::cout << e0 << std::endl;
-                  std::cout << e1 << std::endl;
-                  assert(0);
-               }
-               
-               if ( segment_segment_collision( m_positions[e0[0]], m_newpositions[e0[0]], e0[0],
-                                              m_positions[e0[1]], m_newpositions[e0[1]], e0[1],
-                                              m_positions[e1[0]], m_newpositions[e1[0]], e1[0],
-                                              m_positions[e1[1]], m_newpositions[e1[1]], e1[1],
-                                              s0, s2,
-                                              normal,
-                                              time, rel_disp ) )
-                  
-               {
-                                    
-                  ++m_num_collisions_this_step;
-                  
-                  double relvel = rel_disp / dt;
-                  
-                  if ( m_verbose ) 
-                  {
-                     std::cout << "(EE) time: " << time << ", relative velocity before: " << relvel;
-                     std::cout << ", normal: " << normal;
-                  }
-                  
-                  apply_edge_edge_impulse(e0, e1, s0, s2, normal, -relvel);
-                  
-                  double relvel_after = dot(normal, s0*m_velocities[e0[0]] + (1.0-s0)*m_velocities[e0[1]] - (s2*m_velocities[e1[0]] + (1.0-s2)*m_velocities[e1[1]]));
-                  
-                  if ( m_verbose ) std::cout << " and relative velocity after: " << relvel_after << std::endl;
-
-                  m_newpositions[e0[0]] = m_positions[e0[0]] + dt*m_velocities[e0[0]];
-                  m_newpositions[e0[1]] = m_positions[e0[1]] + dt*m_velocities[e0[1]];
-                  m_newpositions[e1[0]] = m_positions[e1[0]] + dt*m_velocities[e1[0]];
-                  m_newpositions[e1[1]] = m_positions[e1[1]] + dt*m_velocities[e1[1]];
-                  
-                  update_continuous_broad_phase( e0[0] );
-                  update_continuous_broad_phase( e0[1] );
-                  update_continuous_broad_phase( e1[0] );
-                  update_continuous_broad_phase( e1[1] );
-                                    
-                  if ( pass == MAX_PASS - 1 )
-                  {
-                     if ( update_collision_candidates.size() < MAX_CANDIDATES )
-                     {
-                        add_point_update_candidates(e0[0], update_collision_candidates);
-                        add_point_update_candidates(e0[1], update_collision_candidates);
-                        add_point_update_candidates(e1[0], update_collision_candidates);
-                        add_point_update_candidates(e1[1], update_collision_candidates);
-                     }
-                     else
-                     {
-                        candidate_overflow = true;
-                     }
-                  }
-                  
-                  collision_found = true;
-                  
-                  m_verbose = false;
-                  
-               }               
+                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;
             }
-         }      
-      }
-         
-   }
-   
-   {
-      CollisionCandidateSet::iterator new_end = std::unique( update_collision_candidates.begin(), update_collision_candidates.end() );
-      update_collision_candidates.erase( new_end, update_collision_candidates.end() );
-   }
-   
-   unsigned int n = update_collision_candidates.size();
-   unsigned int c = 0;
-   
-   while( !update_collision_candidates.empty() && c++ < (5 * n) )
-   {
-
-      CollisionCandidateSet::iterator iter = update_collision_candidates.begin();
-      Vec3ui candidate = *iter;
-      update_collision_candidates.erase(iter);
-            
-      if(candidate[2]==0)
-      {
-         unsigned int t = candidate[0];
-         const Vec3ui& tri = m_mesh.m_tris[t];
-         unsigned int v = candidate[1];
-         
-         if(tri[0] != v && tri[1] != v && tri[2] != v)
-         {
-            double time, s1, s2, s3, rel_disp;
-            Vec3d normal;
-            
-            Vec3ui sorted_tri = sort_triangle( tri );            
             
-            if ( point_triangle_collision( m_positions[v], m_newpositions[v], v,
-                                          m_positions[sorted_tri[0]], m_newpositions[sorted_tri[0]], sorted_tri[0],
-                                          m_positions[sorted_tri[1]], m_newpositions[sorted_tri[1]], sorted_tri[1],
-                                          m_positions[sorted_tri[2]], m_newpositions[sorted_tri[2]], sorted_tri[2],
-                                          s1, s2, s3,
-                                          normal,
-                                          time, rel_disp ) )               
-               
+            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 )
             {
-
-               ++m_num_collisions_this_step;
-               
-               double relvel = rel_disp / dt;
-               
-               if ( m_verbose ) std::cout << "VT ( " << v << " " << tri << " ) relative velocity before: " << relvel; 
-               
-               apply_triangle_point_impulse( sorted_tri, v, s1, s2, s3, normal, -relvel);
-               
-               double relvel_after = dot(normal, m_velocities[v] - (s1*m_velocities[tri[0]] + s2*m_velocities[tri[1]] + s3*m_velocities[tri[2]]));
-               
-               if ( m_verbose ) std::cout << " and relative velocity after: " << relvel_after << std::endl;
-
-               m_newpositions[v] = m_positions[v] + dt*m_velocities[v];
-               m_newpositions[tri[0]] = m_positions[tri[0]] + dt*m_velocities[tri[0]];
-               m_newpositions[tri[1]] = m_positions[tri[1]] + dt*m_velocities[tri[1]];
-               m_newpositions[tri[2]] = m_positions[tri[2]] + dt*m_velocities[tri[2]];
-               
-               update_continuous_broad_phase( v  );
-               update_continuous_broad_phase( tri[0] );
-               update_continuous_broad_phase( tri[1] );
-               update_continuous_broad_phase( tri[2] );
-               
-               if ( update_collision_candidates.size() < MAX_CANDIDATES )
-               {
-                  add_point_update_candidates(v, update_collision_candidates);
-                  add_point_update_candidates(tri[0], update_collision_candidates);
-                  add_point_update_candidates(tri[1], update_collision_candidates);
-                  add_point_update_candidates(tri[2], update_collision_candidates);
-               }
-               else
-               {
-                  candidate_overflow = true;
-               }
+                std::cout << k << ": " << brute_force_overlapping_edges[k] << std::endl;
             }
-         }
-      }
-      else
-      {
-         Vec2ui e0 = m_mesh.m_edges[candidate[0]];
-         Vec2ui e1 = m_mesh.m_edges[candidate[1]];
-         if(e0[0] != e1[0] && e0[0] != e1[1] && e0[1] != e1[0] && e0[1] != e1[1])
-         {
-            if ( e0[1] < e0[0] ) { swap( e0[0], e0[1] ); }
-            if ( e1[1] < e1[0] ) { swap( e1[0], e1[1] ); }
             
-            double time, s0, s2, rel_disp;
-            Vec3d normal;
+        }
+        
+        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;
+            }
             
-            if ( segment_segment_collision( m_positions[e0[0]], m_newpositions[e0[0]], e0[0],
-                                           m_positions[e0[1]], m_newpositions[e0[1]], e0[1],
-                                           m_positions[e1[0]], m_newpositions[e1[0]], e1[0],
-                                           m_positions[e1[1]], m_newpositions[e1[1]], e1[1],
-                                           s0, s2,
-                                           normal,
-                                           time, rel_disp ) )
-               
+            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 )
             {
-
-               ++m_num_collisions_this_step;
-               
-               double relvel = rel_disp / dt;
-               
-               if ( m_verbose ) std::cout << "EE relative velocity before: " << relvel;
-               
-               apply_edge_edge_impulse(e0, e1, s0, s2, normal, -relvel);
-               
-               double relvel_after = dot(normal, s0*m_velocities[e0[0]] + (1.0-s0)*m_velocities[e0[1]] - (s2*m_velocities[e1[0]] + (1.0-s2)*m_velocities[e1[1]]));
-               
-               if ( m_verbose ) std::cout << " and relative velocity after: " << relvel_after << std::endl;            
-                              
-               m_newpositions[e0[0]] = m_positions[e0[0]] + dt*m_velocities[e0[0]];
-               m_newpositions[e0[1]] = m_positions[e0[1]] + dt*m_velocities[e0[1]];
-               m_newpositions[e1[0]] = m_positions[e1[0]] + dt*m_velocities[e1[0]];
-               m_newpositions[e1[1]] = m_positions[e1[1]] + dt*m_velocities[e1[1]];
-                              
-               
-               update_continuous_broad_phase( e0[0] );
-               update_continuous_broad_phase( e0[1] );
-               update_continuous_broad_phase( e1[0] );
-               update_continuous_broad_phase( e1[1] );
-               
-               if ( update_collision_candidates.size() < MAX_CANDIDATES )
-               {
-                  add_point_update_candidates(e0[0], update_collision_candidates);
-                  add_point_update_candidates(e0[1], update_collision_candidates);
-                  add_point_update_candidates(e1[0], update_collision_candidates);
-                  add_point_update_candidates(e1[1], update_collision_candidates);
-               }
-               else
-               {
-                  candidate_overflow = true;
-               }
-               
+                std::cout << k << ": " << brute_force_overlapping_vertices[k] << " --- ";
+                std::cout << "is deleted: " << m_mesh.vertex_is_deleted( brute_force_overlapping_vertices[k] ) << std::endl;
             }
-         }
-      }
-      
-   }
-
-   
-   return ( !candidate_overflow ) && ( update_collision_candidates.empty() );
-   
-}
-
+        }
+        
+        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] );
+        }
+        
+    }
+    
+    
+}
 
 
 // ---------------------------------------------------------
 ///
-/// Detect all continuous collisions
+/// Caution: slow!
+/// Check the consistency of the broad phase by comparing against the N^2 broadphase.  Checks using current and predicted vertex 
+/// positions.
 ///
 // ---------------------------------------------------------
 
-bool DynamicSurface::detect_collisions( std::vector<Collision>& collisions )
+void DynamicSurface::check_continuous_broad_phase_is_up_to_date() const
 {
-   
-   static const unsigned int MAX_COLLISIONS = 5000;
-   
-   rebuild_continuous_broad_phase();
-  
-   //
-   // point-triangle
-   //
-   
-   for ( unsigned int i = 0; i < m_mesh.m_tris.size(); ++i )
-   {     
-      const Vec3ui& tri = m_mesh.m_tris[i];
-      
-      if ( tri[0] == tri[1] || tri[1] == tri[2] || tri[2] == tri[0] )    { continue; }
-
-      Vec3d low, high;
-      triangle_continuous_bounds( i, low, high );
-      
-      std::vector<unsigned int> potential_collisions;
-      
-      m_broad_phase->get_potential_vertex_collisions( low, high, potential_collisions );
-      
-      for ( unsigned int j = 0; j < potential_collisions.size(); ++j )
-      {
-         unsigned int vertex_index = potential_collisions[j];
-         
-         assert ( m_mesh.m_vtxtri[vertex_index].size() != 0 );
-      
-         if( tri[0] != vertex_index && tri[1] != vertex_index && tri[2] != vertex_index )
-         {
-            double time, s1, s2, s3, rel_disp;
-            Vec3d normal;
-            
-            Vec3ui sorted_tri = sort_triangle( tri );            
-            
-            if ( point_triangle_collision( m_positions[vertex_index], m_newpositions[vertex_index], vertex_index,
-                                           m_positions[sorted_tri[0]], m_newpositions[sorted_tri[0]], sorted_tri[0],
-                                           m_positions[sorted_tri[1]], m_newpositions[sorted_tri[1]], sorted_tri[1],
-                                           m_positions[sorted_tri[2]], m_newpositions[sorted_tri[2]], sorted_tri[2],
-                                           s1, s2, s3,
-                                           normal,
-                                           time, rel_disp ) )               
-               
-            {
-               ++m_num_collisions_this_step;
-                              
-               Collision new_collision( false, Vec4ui( vertex_index, sorted_tri[0], sorted_tri[1], sorted_tri[2] ), normal, Vec4d( 1, -s1, -s2, -s3 ), rel_disp );
-                                             
-               collisions.push_back( new_collision );
-               
-               if ( collisions.size() > MAX_COLLISIONS ) 
-               {
-                  return false; 
-               }
-            }            
-         }
-      }
-   }
-   
-   //
-   // edge-edge
-   //
-
-   for ( unsigned int edge_index_a = 0; edge_index_a < m_mesh.m_edges.size(); ++edge_index_a )
-   {
-      if ( m_mesh.m_edges[edge_index_a][0] == m_mesh.m_edges[edge_index_a][1] )    { continue; }
-      
-      Vec3d low, high;
-      edge_continuous_bounds(edge_index_a, low, high);
-      std::vector<unsigned int> potential_collisions;
-      m_broad_phase->get_potential_edge_collisions( low, high, potential_collisions );
-      
-      for ( unsigned int j = 0; j < potential_collisions.size(); ++j )
-      {
-   
-         unsigned int edge_index_b = potential_collisions[j];
-         
-         if ( edge_index_b <= edge_index_a )    { continue; }
-         
-         assert ( m_mesh.m_edges[edge_index_b][0] != m_mesh.m_edges[edge_index_b][1] );
-                  
-         Vec2ui e0 = m_mesh.m_edges[edge_index_a];
-         Vec2ui e1 = m_mesh.m_edges[edge_index_b];
-         
-         if( e0[0] != e1[0] && e0[0] != e1[1] && e0[1] != e1[0] && e0[1] != e1[1] )
-         {            
-            
-            double time, s0, s2, rel_disp;
-            Vec3d normal;
-            
-            if ( e0[1] < e0[0] ) { swap( e0[0], e0[1] ); }
-            if ( e1[1] < e1[0] ) { swap( e1[0], e1[1] ); }
-            
-            if ( segment_segment_collision( m_positions[e0[0]], m_newpositions[e0[0]], e0[0],
-                                            m_positions[e0[1]], m_newpositions[e0[1]], e0[1],
-                                            m_positions[e1[0]], m_newpositions[e1[0]], e1[0],
-                                            m_positions[e1[1]], m_newpositions[e1[1]], e1[1],
-                                            s0, s2,
-                                            normal,
-                                            time, rel_disp ) )
-               
+    
+    // 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] ) )
             {
-                  
-               ++m_num_collisions_this_step;
-               
-               Collision new_collision( true, Vec4ui( e0[0], e0[1], e1[0], e1[1] ), normal, Vec4d( -s0, -(1-s0), s2, (1-s2) ), rel_disp );
-                              
-               collisions.push_back( new_collision );
-               
-               if ( collisions.size() > MAX_COLLISIONS ) 
-               {
-                  std::cout << "maxed out collisions at edge " << edge_index_a << std::endl;
-                  return false; 
-               }                 
+                overlapping_triangles.erase( overlapping_triangles.begin() + k );
+                --k;
             }
-            else if ( segment_segment_collision( m_positions[e1[0]], m_newpositions[e1[0]], e1[0],
-                                                 m_positions[e1[1]], m_newpositions[e1[1]], e1[1],
-                                                 m_positions[e0[0]], m_newpositions[e0[0]], e0[0],
-                                                 m_positions[e0[1]], m_newpositions[e0[1]], e0[1],
-                                                 s0, s2,
-                                                 normal,
-                                                 time, rel_disp ) )
-               
+        }
+        
+        // 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 ) )
             {
-               
-               ++m_num_collisions_this_step;
-               
-               Collision new_collision( true, Vec4ui( e0[0], e0[1], e1[0], e1[1] ), normal, Vec4d( -s0, -(1-s0), s2, (1-s2) ), rel_disp );
-               
-               collisions.push_back( new_collision );
-               
-               if ( collisions.size() > MAX_COLLISIONS ) 
-               {
-                  std::cout << "maxed out collisions at edge " << edge_index_a << std::endl;
-                  return false; 
-               }               
-               
+                brute_force_overlapping_triangles.push_back( j );            
             }
-            
-         }
-      }
-   }
-   
-   return true;
-   
-}
-
-
-
-
-// ---------------------------------------------------------
-///
-/// Detect continuous collisions among elements in the given ImpactZones, and adjacent to the given ImpactZones.
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::detect_new_collisions( const std::vector<ImpactZone> impact_zones, std::vector<Collision>& collisions )
-{
-
-   rebuild_continuous_broad_phase();
-   
-   std::vector<unsigned int> zone_vertices;
-   std::vector<unsigned int> zone_edges;
-   std::vector<unsigned int> zone_triangles;
-
-   // Get all vertices in the impact zone
-   
-   for ( unsigned int i = 0; i < impact_zones.size(); ++i )
-   {
-      for ( unsigned int j = 0; j < impact_zones[i].collisions.size(); ++j )
-      {
-         add_unique( zone_vertices, impact_zones[i].collisions[j].vertex_indices[0] );
-         add_unique( zone_vertices, impact_zones[i].collisions[j].vertex_indices[1] );
-         add_unique( zone_vertices, impact_zones[i].collisions[j].vertex_indices[2] );
-         add_unique( zone_vertices, impact_zones[i].collisions[j].vertex_indices[3] );         
-         
-         update_continuous_broad_phase( impact_zones[i].collisions[j].vertex_indices[0] );
-         update_continuous_broad_phase( impact_zones[i].collisions[j].vertex_indices[1] );
-         update_continuous_broad_phase( impact_zones[i].collisions[j].vertex_indices[2] );
-         update_continuous_broad_phase( impact_zones[i].collisions[j].vertex_indices[3] );         
-         
-      }
-   }
-   
-   // Get all triangles in the impact zone
-   
-   for ( unsigned int i = 0; i < zone_vertices.size(); ++i )
-   {
-      for ( unsigned int j = 0; j < m_mesh.m_vtxtri[zone_vertices[i]].size(); ++j )
-      {
-         add_unique( zone_triangles, m_mesh.m_vtxtri[zone_vertices[i]][j] );
-      }
-   }
-
-   // Get all edges in the impact zone
-   
-   for ( unsigned int i = 0; i < zone_vertices.size(); ++i )
-   {
-      for ( unsigned int j = 0; j < m_mesh.m_vtxedge[zone_vertices[i]].size(); ++j )
-      {
-         add_unique( zone_edges, m_mesh.m_vtxedge[zone_vertices[i]][j] );
-      }
-   }
-
-   // Check zone vertices vs all triangles
-   
-   for ( unsigned int i = 0; i < zone_vertices.size(); ++i )
-   {
-      unsigned int vertex_index = zone_vertices[i];
-
-      Vec3d query_low, query_high;
-      vertex_continuous_bounds( zone_vertices[i], query_low, query_high );
-      std::vector<unsigned int> overlapping_triangles;
-      m_broad_phase->get_potential_triangle_collisions( query_low, query_high, overlapping_triangles );
-      
-      for ( unsigned int j = 0; j < overlapping_triangles.size(); ++j )
-      {
-         const Vec3ui& tri = m_mesh.m_tris[overlapping_triangles[j]];
-         
-         assert( m_mesh.m_vtxtri[vertex_index].size() != 0 );
-         
-         if( tri[0] != vertex_index && tri[1] != vertex_index && tri[2] != vertex_index )
-         {
-            double time, s1, s2, s3, rel_disp;
-            Vec3d normal;
-            
-            Vec3ui sorted_tri = sort_triangle( tri );            
-            assert( sorted_tri[0] < sorted_tri[1] && sorted_tri[1] < sorted_tri[2] && sorted_tri[0] < sorted_tri[2] );
-            
-            if ( point_triangle_collision( m_positions[vertex_index], m_newpositions[vertex_index], vertex_index,
-                                                    m_positions[sorted_tri[0]], m_newpositions[sorted_tri[0]], sorted_tri[0],
-                                                    m_positions[sorted_tri[1]], m_newpositions[sorted_tri[1]], sorted_tri[1],
-                                                    m_positions[sorted_tri[2]], m_newpositions[sorted_tri[2]], sorted_tri[2],
-                                                    s1, s2, s3,
-                                                    normal,
-                                                    time, rel_disp ) )               
-               
-            {
-                             
-               assert( fabs(mag(normal) - 1.0) < 1e-10 );
-               
-               Collision new_collision( false, Vec4ui( vertex_index, sorted_tri[0], sorted_tri[1], sorted_tri[2] ), normal, Vec4d( 1, -s1, -s2, -s3 ), rel_disp );
-               
-               add_unique_collision( collisions, new_collision );
-               
-               bool exists = false;
-               for ( unsigned int z = 0; z < impact_zones.size(); ++z )
-               {
-                  for ( unsigned int c = 0; c < impact_zones[z].collisions.size(); ++c )
-                  {
-                     if ( new_collision.same_vertices( impact_zones[z].collisions[c] ) )
-                     {
-                        std::cout << "duplicate collision: " << new_collision.vertex_indices << std::endl;
-                        exists = true;
-                     }
-                  }
-               }
-               
-               if ( !exists )
-               {
-                  ++m_num_collisions_this_step;
-               }
-               
-            } 
-         }
-      }
-   }
-   
-   // Check zone triangles vs all vertices
-   
-   for ( unsigned int i = 0; i < zone_triangles.size(); ++i )
-   {
-      const Vec3ui& tri = m_mesh.m_tris[zone_triangles[i]];
-      
-      Vec3d query_low, query_high;
-      triangle_continuous_bounds( zone_triangles[i], query_low, query_high );
-      std::vector<unsigned int> overlapping_vertices;
-      m_broad_phase->get_potential_vertex_collisions( query_low, query_high, overlapping_vertices );
-      
-      for ( unsigned int j = 0; j < overlapping_vertices.size(); ++j )
-      {                      
-         unsigned int vertex_index = overlapping_vertices[j];
-         
-         assert( m_mesh.m_vtxtri[vertex_index].size() != 0 );
-         
-         if( tri[0] != vertex_index && tri[1] != vertex_index && tri[2] != vertex_index )
-         {
-            double time, s1, s2, s3, rel_disp;
-            Vec3d normal;
-            
-            Vec3ui sorted_tri = sort_triangle( tri ); 
-            assert( sorted_tri[0] < sorted_tri[1] && sorted_tri[1] < sorted_tri[2] && sorted_tri[0] < sorted_tri[2] );
-                        
-            if ( point_triangle_collision( m_positions[vertex_index], m_newpositions[vertex_index], vertex_index,
-                                                    m_positions[sorted_tri[0]], m_newpositions[sorted_tri[0]], sorted_tri[0],
-                                                    m_positions[sorted_tri[1]], m_newpositions[sorted_tri[1]], sorted_tri[1],
-                                                    m_positions[sorted_tri[2]], m_newpositions[sorted_tri[2]], sorted_tri[2],
-                                                    s1, s2, s3,
-                                                    normal,
-                                                    time, rel_disp ) )                
+        }
+        
+        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] ) )
             {
-               
-               assert( fabs(mag(normal) - 1.0) < 1e-10 );
-               
-               Collision new_collision( false, Vec4ui( vertex_index, sorted_tri[0], sorted_tri[1], sorted_tri[2] ), normal, Vec4d( 1, -s1, -s2, -s3 ), rel_disp );                              
-               
-               add_unique_collision( collisions, new_collision );
-               
-               bool exists = false;
-               for ( unsigned int z = 0; z < impact_zones.size(); ++z )
-               {
-                  for ( unsigned int c = 0; c < impact_zones[z].collisions.size(); ++c )
-                  {
-                     if ( new_collision.same_vertices( impact_zones[z].collisions[c] ) )
-                     {
-                        std::cout << "duplicate collision: " << new_collision.vertex_indices << std::endl;
-                        exists = true;
-                     }
-                  }
-               }
-               
-               if ( !exists )
-               {
-                  ++m_num_collisions_this_step;
-               }
-               
-               
-            } 
-         }
-      }
-   }
-   
-   // Check zone edges vs all edges
-   
-   for ( unsigned int i = 0; i < zone_edges.size(); ++i )
-   {
-      unsigned int edge_index_a = zone_edges[i];
-      
-      if ( m_mesh.m_edges[edge_index_a][0] == m_mesh.m_edges[edge_index_a][1] )    { continue; }
-      
-      Vec3d low, high;
-      edge_continuous_bounds(edge_index_a, low, high);
-      std::vector<unsigned int> potential_collisions;
-      m_broad_phase->get_potential_edge_collisions( low, high, potential_collisions );
-            
-      for ( unsigned int j = 0; j < potential_collisions.size(); ++j )
-      {   
-         unsigned int edge_index_b = potential_collisions[j];
-         
-         assert ( m_mesh.m_edges[edge_index_b][0] != m_mesh.m_edges[edge_index_b][1] );    
-         
-         Vec2ui e0 = m_mesh.m_edges[edge_index_a];
-         Vec2ui e1 = m_mesh.m_edges[edge_index_b];
-         
-         if( e0[0] != e1[0] && e0[0] != e1[1] && e0[1] != e1[0] && e0[1] != e1[1] )
-         {
-            if ( e0[1] < e0[0] ) { swap( e0[0], e0[1] ); }
-            if ( e1[1] < e1[0] ) { swap( e1[0], e1[1] ); }
-            
-            assert( e0[0] < e0[1] && e1[0] < e1[1] );
-            
-            double time, s0, s2, rel_disp;
-            Vec3d normal;
-            
-            if ( segment_segment_collision( m_positions[e0[0]], m_newpositions[e0[0]], e0[0],
-                                            m_positions[e0[1]], m_newpositions[e0[1]], e0[1],
-                                            m_positions[e1[0]], m_newpositions[e1[0]], e1[0],
-                                            m_positions[e1[1]], m_newpositions[e1[1]], e1[1],
-                                            s0, s2,
-                                            normal,
-                                            time, rel_disp ) )
-               
+                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 ) )
             {
-                              
-               normalize(normal);
-               
-               Collision new_collision( true, Vec4ui( e0[0], e0[1], e1[0], e1[1] ), normal, Vec4d( -s0, -(1-s0), s2, (1-s2) ), rel_disp );
-               
-               add_unique_collision( collisions, new_collision );
-               
-               
-               bool exists = false;
-               for ( unsigned int z = 0; z < impact_zones.size(); ++z )
-               {
-                  for ( unsigned int c = 0; c < impact_zones[z].collisions.size(); ++c )
-                  {
-                     if ( new_collision.same_vertices( impact_zones[z].collisions[c] ) )
-                     {
-                        std::cout << "duplicate collision: " << new_collision.vertex_indices << std::endl;
-                        exists = true;
-                     }
-                  }
-               }
-               
-               if ( !exists )
-               {
-                  ++m_num_collisions_this_step;
-               }
-               
-
+                brute_force_overlapping_edges.push_back( j );
             }
-            else if ( segment_segment_collision( m_positions[e1[0]], m_newpositions[e1[0]], e1[0],
-                                                 m_positions[e1[1]], m_newpositions[e1[1]], e1[1],
-                                                 m_positions[e0[0]], m_newpositions[e0[0]], e0[0],
-                                                 m_positions[e0[1]], m_newpositions[e0[1]], e0[1],
-                                                 s0, s2,
-                                                 normal,
-                                                 time, rel_disp ) )
+        }
+        
+        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 )
             {
-               normalize(normal);
-               
-               Collision new_collision( true, Vec4ui( e1[0], e1[1], e0[0], e0[1] ), normal, Vec4d( -s0, -(1-s0), s2, (1-s2) ), rel_disp );
-               
-               add_unique_collision( collisions, new_collision );
-               
-               bool exists = false;
-               for ( unsigned int z = 0; z < impact_zones.size(); ++z )
-               {
-                  for ( unsigned int c = 0; c < impact_zones[z].collisions.size(); ++c )
-                  {
-                     if ( new_collision.same_vertices( impact_zones[z].collisions[c] ) )
-                     {
-                        std::cout << "duplicate collision: " << new_collision.vertex_indices << std::endl;
-                        exists = true;
-                     }
-                  }
-               }
-               
-               if ( !exists )
-               {
-                  ++m_num_collisions_this_step;
-               } 
+                std::cout << k << ": " << overlapping_edges[k] << std::endl;
             }
-         }
-      }
-   }
-}
-
-
-
-
-// ---------------------------------------------------------
-///
-/// Combine impact zones which have overlapping vertex stencils
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::merge_impact_zones( std::vector<ImpactZone>& new_impact_zones, std::vector<ImpactZone>& master_impact_zones )
-{
-   
-   bool merge_ocurred = true;
-      
-   for ( unsigned int i = 0; i < master_impact_zones.size(); ++i )
-   {
-      master_impact_zones[i].all_solved = true;
-   }
-
-   for ( unsigned int i = 0; i < new_impact_zones.size(); ++i )
-   {
-      new_impact_zones[i].all_solved = false;
-   }
-
-   
-   while ( merge_ocurred )
-   {
-            
-      merge_ocurred = false;
-           
-      for ( unsigned int i = 0; i < new_impact_zones.size(); ++i )
-      {
-         bool i_is_disjoint = true;
-         
-         for ( unsigned int 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] ) )
+            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 )
             {
-               
-               bool found_new_collision = false;
-               
-               // steal all of j's collisions
-               for ( unsigned int c = 0; c < new_impact_zones[i].collisions.size(); ++c )
-               {
-
-                  bool same_collision_exists = false;
-                  
-                  for ( unsigned int m = 0; m < master_impact_zones[j].collisions.size(); ++m )
-                  {                 
-                     if ( master_impact_zones[j].collisions[m].same_vertices( new_impact_zones[i].collisions[c] ) )
-                     {
-
-                        same_collision_exists = true;
-                        break;
-                     }
-                     
-                  }
-                  
-                  if ( !same_collision_exists )
-                  {
-                     master_impact_zones[j].collisions.push_back( new_impact_zones[i].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].all_solved &= new_impact_zones[i].all_solved;
-               }
-               
-               merge_ocurred = true;
-               i_is_disjoint = false;
-               break;
+                std::cout << k << ": " << brute_force_overlapping_edges[k] << std::endl;
             }
             
-         }     // end for(j)
-         
-         if ( i_is_disjoint )
-         {
-            // copy the impact zone
-            
-            ImpactZone new_zone;
-            for ( unsigned int c = 0; c < new_impact_zones[i].collisions.size(); ++c )
+        }
+        
+        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] ) )
             {
-               new_zone.collisions.push_back( new_impact_zones[i].collisions[c] );
+                overlapping_vertices.erase( overlapping_vertices.begin() + k );
+                --k;
             }
-            
-            new_zone.all_solved = new_impact_zones[i].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;
-     
-}
-
-
-// ---------------------------------------------------------
-///
-/// Iteratively project out relative normal velocities for a set of collisions in an impact zone until all collisions are solved.
-///
-// ---------------------------------------------------------
-
-bool DynamicSurface::iterated_inelastic_projection( ImpactZone& iz, double dt )
-{
-   assert( m_masses.size() == m_positions.size() );
-   
-   static const unsigned int MAX_PROJECTION_ITERATIONS = 20;
-   
-   for ( unsigned int i = 0; i < MAX_PROJECTION_ITERATIONS; ++i )
-   {
-      m_verbose = true;
-      bool success = inelastic_projection( iz );
-      m_verbose = false;
-            
-      if ( !success )
-      {
-         std::cout << "failure in inelastic projection" << std::endl;
-         return false;
-      }
-      
-      bool collision_still_exists = false;
-      
-      for ( unsigned int c = 0; c < iz.collisions.size(); ++c )
-      {
-         // run collision detection on this pair again
-         
-         Collision& collision = iz.collisions[c];
-         const Vec4ui& vs = collision.vertex_indices;
-            
-         m_newpositions[vs[0]] = m_positions[vs[0]] + dt * m_velocities[vs[0]];
-         m_newpositions[vs[1]] = m_positions[vs[1]] + dt * m_velocities[vs[1]];
-         m_newpositions[vs[2]] = m_positions[vs[2]] + dt * m_velocities[vs[2]];
-         m_newpositions[vs[3]] = m_positions[vs[3]] + dt * m_velocities[vs[3]];
-            
-         if ( m_verbose ) { std::cout << "checking collision " << vs << std::endl; }
-         
-         if ( collision.is_edge_edge )
-         {
-            
-            double time, 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_positions[vs[0]], m_newpositions[vs[0]], vs[0],
-                                                     m_positions[vs[1]], m_newpositions[vs[1]], vs[1],
-                                                     m_positions[vs[2]], m_newpositions[vs[2]], vs[2],
-                                                     m_positions[vs[3]], m_newpositions[vs[3]], vs[3],
-                                                     s0, s2,
-                                                     normal,
-                                                     time, rel_disp, false ) )               
+        }
+        
+        // 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 ) )
             {
-               
-               std::cout << "collision remains.  delta alphas: " << Vec4d( -s0, -(1-s0), s2, (1-s2) ) - collision.alphas << std::endl;
-               std::cout << "alphas: " << Vec4d( -s0, -(1-s0), s2, (1-s2) ) << std::endl;
-               std::cout << "normal: " << normal << std::endl;
-               std::cout << "rel_disp: " << rel_disp << std::endl;
-               std::cout << "time: " << time << std::endl;               
-               collision.normal = normal;
-               collision.alphas = Vec4d( -s0, -(1-s0), s2, (1-s2) );
-               collision.relative_displacement = rel_disp;
-               collision_still_exists = true;
+                brute_force_overlapping_vertices.push_back( j );
             }
-            
-         }
-         else
-         {
-               
-            double time, 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_positions[vs[0]], m_newpositions[vs[0]], vs[0],
-                                                    m_positions[vs[1]], m_newpositions[vs[1]], vs[1],
-                                                    m_positions[vs[2]], m_newpositions[vs[2]], vs[2],
-                                                    m_positions[vs[3]], m_newpositions[vs[3]], vs[3],
-                                                    s1, s2, s3,
-                                                    normal,
-                                                    time, rel_disp, false ) )                                 
+        }
+        
+        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 << "collision remains.  delta alphas: " << Vec4d( 1, -s1, -s2, -s3 ) - collision.alphas << std::endl;
-               std::cout << "alphas: " << Vec4d( 1, -s1, -s2, -s3 ) << std::endl;            
-               std::cout << "normal: " << normal << std::endl;
-               std::cout << "rel_disp: " << rel_disp << std::endl;
-               std::cout << "time: " << time << std::endl;               
-               collision.normal = normal;
-               collision.alphas = Vec4d( 1, -s1, -s2, -s3 );
-               collision.relative_displacement = rel_disp;
-               collision_still_exists = true;
+                std::cout << k << ": " << overlapping_vertices[k] << " --- ";
+                std::cout << "is deleted: " << m_mesh.vertex_is_deleted( overlapping_vertices[k] ) << std::endl;
             }
             
-         }
-         
-      } // for collisions
-      
-      if ( false == collision_still_exists )  
-      {
-         return true; 
-      }
-      
-   } // for iterations
- 
-   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 DynamicSurface::inelastic_projection( const ImpactZone& iz )
-{
-   
-   if ( m_verbose )
-   {
-      std::cout << " ----- using sparse solver " << std::endl;
-   }
-   
-   static double IMPULSE_MULTIPLIER = 0.8;
-   
-   const unsigned int k = iz.collisions.size();    // notation from [Harmon et al 2008]: k == number of collisions
-   
-   std::vector<unsigned int> zone_vertices;
-   iz.get_all_vertices( zone_vertices );
-   
-   const unsigned int n = zone_vertices.size();       // n == number of distinct colliding vertices
-   
-   if ( m_verbose )
-   {
-      std::cout << "GCT: " << 3*n << "x" << k << std::endl;
-   }
-   
-   SparseMatrixDynamicCSR GCT( 3*n, k );
-   GCT.set_zero();
-   
-   // construct matrix grad C transpose
-   for ( unsigned int i = 0; i < k; ++i )
-   {
-      // set col i
-      const Collision& coll = iz.collisions[i];
-      
-      for ( unsigned int v = 0; v < 4; ++v )
-      {
-         // block row j ( == block column j of grad C )
-         unsigned int j = coll.vertex_indices[v];
-         
-         std::vector<unsigned int>::iterator zone_vertex_iter = find( zone_vertices.begin(), zone_vertices.end(), j );
-         
-         assert( zone_vertex_iter != zone_vertices.end() );
-         
-         unsigned int mat_j = (unsigned int) ( zone_vertex_iter - zone_vertices.begin() );
-         
-         GCT(mat_j*3, i) = coll.alphas[v] * coll.normal[0];
-         GCT(mat_j*3+1, i) = coll.alphas[v] * coll.normal[1];
-         GCT(mat_j*3+2, i) = coll.alphas[v] * coll.normal[2];
-         
-      }
-   }
-
-   Array1d inv_masses;
-   inv_masses.reserve(3*n);
-   Array1d column_velocities;
-   column_velocities.reserve(3*n);
-   
-   for ( unsigned int i = 0; i < n; ++i )
-   {
-      if ( m_masses[zone_vertices[i]] < 100.0 )
-      {
-         inv_masses.push_back( 1.0 / m_masses[zone_vertices[i]] );
-         inv_masses.push_back( 1.0 / m_masses[zone_vertices[i]] );
-         inv_masses.push_back( 1.0 / m_masses[zone_vertices[i]] );
-      }
-      else
-      {
-         // infinite mass (scripted objects)
-         
-         inv_masses.push_back( 0.0 );
-         inv_masses.push_back( 0.0 );
-         inv_masses.push_back( 0.0 );         
-      }
-
-      column_velocities.push_back( m_velocities[zone_vertices[i]][0] );
-      column_velocities.push_back( m_velocities[zone_vertices[i]][1] );
-      column_velocities.push_back( m_velocities[zone_vertices[i]][2] );
-   }
-
-   //
-   // minimize | M^(-1/2) * GC^T x - M^(1/2) * v |^2
-   //
-   
-   // solution vector
-   Array1d x(k);
-         
-   static const bool use_cgnr = false;
-   KrylovSolverStatus solver_result;
-   
-   if ( use_cgnr )
-   {
-      std::cout << "CGNR currently disabled: matrices are not scaled by masses." << std::endl;
-      assert( false );
-      
-      CGNR_Solver cg_solver;
-      SparseMatrixStaticCSR solver_matrix( GCT );
-      cg_solver.max_iterations = INT_MAX;
-      solver_result = cg_solver.solve( solver_matrix, column_velocities.data, x.data );      
-   }
-   else
-   {
-      // normal equations: GC * M^(-1) GCT * x = GC * v
-      //                   A * x = b
-
-      SparseMatrixDynamicCSR A( k, k );
-      A.set_zero();
-      AtDB( GCT, inv_masses.data, GCT, A ); 
-      
-      Array1d b(k);
-      GCT.apply_transpose( column_velocities.data, b.data );   
-
-      if ( 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 )
-   {
-      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;
-      }
-      
-      return false;          
-   } 
-   
-   // apply impulses 
-   Array1d applied_impulses(3*n);
-   GCT.apply( x.data, applied_impulses.data );
-     
-   for ( unsigned int i = 0; i < applied_impulses.size(); ++i )
-   {
-      column_velocities[i] -= IMPULSE_MULTIPLIER * inv_masses[i] * applied_impulses[i];      
-   }
-   
-   for ( unsigned int i = 0; i < n; ++i )
-   {
-      Vec3d new_velocity( column_velocities[3*i], column_velocities[3*i + 1], column_velocities[3*i + 2] );
-      
-      m_velocities[zone_vertices[i]][0] = column_velocities[3*i];
-      m_velocities[zone_vertices[i]][1] = column_velocities[3*i + 1];
-      m_velocities[zone_vertices[i]][2] = column_velocities[3*i + 2];      
-   }
-    
-   
-   return true;
-   
+            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] );
+        }
+        
+    }
+    
 }
 
 
-// ---------------------------------------------------------
+// --------------------------------------------------------
 ///
-/// Handle all collisions simultaneously by iteratively solving individual impact zones until no new collisions are detected.
+/// Check a triangle (by index) vs all other triangles for any kind of intersection
 ///
-// ---------------------------------------------------------
+// --------------------------------------------------------
 
-bool DynamicSurface::handle_collisions_simultaneous(double dt)
+bool DynamicSurface::check_triangle_vs_all_triangles_for_intersection( size_t tri_index  )
 {
-
-   // copy
-   std::vector<Vec3d> old_velocities = m_velocities;
-
-   std::vector<ImpactZone> impact_zones;
-
-   bool finished_detecting_collisions = false;
-   
-   std::vector<Collision> total_collisions;
-   finished_detecting_collisions = 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 ( unsigned int i = 0; i < total_collisions.size(); ++i )
-      {
-         ImpactZone new_zone;
-         new_zone.collisions.push_back( total_collisions[i] );
-         new_impact_zones.push_back( new_zone );
-      }
-      
-      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].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].all_solved );
-      }            
-            
-      bool solver_ok = true;
-      
-      // for each impact zone
-      for ( unsigned int i = 0; i < impact_zones.size(); ++i )
-      {
-         
-         std::vector<unsigned int> zone_vertices;
-         
-         // reset impact zone to pre-response m_velocities
-         for ( unsigned int j = 0; j < impact_zones[i].collisions.size(); ++j )
-         {
-            Vec4ui& vs = impact_zones[i].collisions[j].vertex_indices;
-            
-            m_velocities[vs[0]] = old_velocities[vs[0]];
-            m_velocities[vs[1]] = old_velocities[vs[1]];
-            m_velocities[vs[2]] = old_velocities[vs[2]];
-            m_velocities[vs[3]] = old_velocities[vs[3]]; 
-            
-            zone_vertices.push_back( vs[0] );
-            zone_vertices.push_back( vs[1] );
-            zone_vertices.push_back( vs[2] );
-            zone_vertices.push_back( vs[3] );            
-         }
-         
-         // apply inelastic projection
-         
-         solver_ok &= iterated_inelastic_projection( impact_zones[i], dt );
-                  
-         // reset predicted m_positions
-         for ( unsigned int j = 0; j < impact_zones[i].collisions.size(); ++j )
-         {
-            const Vec4ui& vs = impact_zones[i].collisions[j].vertex_indices;            
-
-            m_newpositions[vs[0]] = m_positions[vs[0]] + dt * m_velocities[vs[0]];
-            m_newpositions[vs[1]] = m_positions[vs[1]] + dt * m_velocities[vs[1]];
-            m_newpositions[vs[2]] = m_positions[vs[2]] + dt * m_velocities[vs[2]];
-            m_newpositions[vs[3]] = m_positions[vs[3]] + dt * m_velocities[vs[3]];
-         } 
-      
-      }  // for IZs
-      
-      if ( false == solver_ok )
-      {
-         std::cout << "solver problem" << std::endl;
-         return false;
-      }
-      
-      total_collisions.clear();
-      
-      if ( !finished_detecting_collisions )
-      {
-         std::cout << "attempting to finish global collision detection" << std::endl;
-         finished_detecting_collisions = detect_collisions( total_collisions );
-         impact_zones.clear();
-      }
-      else
-      {
-         detect_new_collisions( impact_zones, total_collisions );
-      }
-      
-   }
-   
-   return true;
+    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::collision_solved( const Collision& collision )
+bool DynamicSurface::check_triangle_vs_all_triangles_for_intersection( const Vec3st& tri )
 {
-   if ( collision.is_edge_edge )
-   {
-      Vec2ui e0( collision.vertex_indices[0], collision.vertex_indices[1] );
-      Vec2ui e1( collision.vertex_indices[2], collision.vertex_indices[3] );
-      
-      double time, s0, s2, rel_disp;
-      Vec3d normal;
-      
-      if ( e0[1] < e0[0] ) { swap( e0[0], e0[1] ); }
-      if ( e1[1] < e1[0] ) { swap( e1[0], e1[1] ); }
-      
-      if ( segment_segment_collision( m_positions[e0[0]], m_newpositions[e0[0]], e0[0],
-                                     m_positions[e0[1]], m_newpositions[e0[1]], e0[1],
-                                     m_positions[e1[0]], m_newpositions[e1[0]], e1[0],
-                                     m_positions[e1[1]], m_newpositions[e1[1]], e1[1],
-                                     s0, s2,
-                                     normal,
-                                     time, rel_disp ) )
-         
-      {
-         return false;
-      }
-      else if ( segment_segment_collision( m_positions[e1[0]], m_newpositions[e1[0]], e1[0],
-                                          m_positions[e1[1]], m_newpositions[e1[1]], e1[1],
-                                          m_positions[e0[0]], m_newpositions[e0[0]], e0[0],
-                                          m_positions[e0[1]], m_newpositions[e0[1]], e0[1],
-                                          s0, s2,
-                                          normal,
-                                          time, rel_disp ) )
-         
-      {
-         return false;
-      }
-      
-   }
-   else
-   {
-      unsigned int vertex_index = collision.vertex_indices[0];
-      Vec3ui tri( collision.vertex_indices[1], collision.vertex_indices[2], collision.vertex_indices[3] );
-      
-      Vec3ui sorted_tri = sort_triangle( tri );            
-      
-      double time, s1, s2, s3, rel_disp;
-      Vec3d normal;
-
-      if ( point_triangle_collision( m_positions[vertex_index], m_newpositions[vertex_index], vertex_index,
-                                     m_positions[sorted_tri[0]], m_newpositions[sorted_tri[0]], sorted_tri[0],
-                                     m_positions[sorted_tri[1]], m_newpositions[sorted_tri[1]], sorted_tri[1],
-                                     m_positions[sorted_tri[2]], m_newpositions[sorted_tri[2]], sorted_tri[2],
-                                     s1, s2, s3,
-                                     normal,
-                                     time, rel_disp ) )               
-         
-      {
-         return false; 
-      }                  
-   }
-   
-   return true;
-   
+    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.
 ///
 // ---------------------------------------------------------
 
-
-bool DynamicSurface::new_rigid_impact_zones(double dt)
+void DynamicSurface::get_intersections( bool degeneracy_counts_as_intersection, 
+                                       bool use_new_positions, 
+                                       std::vector<Intersection>& intersections )
 {
-   
-   // copy
-   std::vector<Vec3d> old_velocities = m_velocities;
-   
-   std::vector<ImpactZone> impact_zones;
-   
-   bool finished_detecting_collisions = false;
-   
-   std::vector<Collision> total_collisions;
-   finished_detecting_collisions = 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 ( unsigned int i = 0; i < total_collisions.size(); ++i )
-      {
-         ImpactZone new_zone;
-         new_zone.collisions.push_back( total_collisions[i] );
-         new_impact_zones.push_back( new_zone );
-      }
-      
-      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].all_solved ) 
-         {
-            impact_zones[i].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].all_solved );
-      }            
-      
-      // for each impact zone
-      for ( unsigned int i = 0; i < impact_zones.size(); ++i )
-      {
-         
-         std::vector<unsigned int> zone_vertices;
-         impact_zones[i].get_all_vertices( zone_vertices );
-         calculate_rigid_motion(dt, zone_vertices);
-         
-         bool all_solved = true;
-         for ( unsigned int c = 0; c < impact_zones[i].collisions.size(); ++c )
-         {
-            all_solved &= collision_solved( impact_zones[i].collisions[c] );
-         }
-         
-         if ( !all_solved )
-         {
-            std::cout << "RIZ failed.  Getting desperate!" << std::endl;
-            
-            Vec3d average_velocity(0,0,0);
-            for ( unsigned int v = 0; v < zone_vertices.size(); ++v )
+    
+    //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] )
             {
-               average_velocity += m_velocities[ zone_vertices[v] ];
+                continue;
             }
-            average_velocity /= (double) zone_vertices.size();
             
-            for ( unsigned int v = 0; v < zone_vertices.size(); ++v )
+            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 ) )
             {
-               m_velocities[ zone_vertices[v] ] = average_velocity;
-               m_newpositions[ zone_vertices[v] ] = m_positions[ zone_vertices[v] ] + dt * m_velocities[ zone_vertices[v] ];
+                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 ) );
             }
-         }
-         
-      }  
-      
-      total_collisions.clear();
-      
-      if ( !finished_detecting_collisions )
-      {
-         finished_detecting_collisions = detect_collisions( total_collisions );
-         impact_zones.clear();
-      }
-      else
-      {
-         detect_new_collisions( impact_zones, total_collisions );
-      }
-      
-   }
-   
-   return true;
-}
-
-
-// ---------------------------------------------------------
-///
-/// 
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::calculate_rigid_motion(double dt, std::vector<unsigned int>& vs)
-{
-   Vec3d xcm(0,0,0);
-   Vec3d vcm(0,0,0);
-   double mass = 0;
-   
-   for(unsigned int i = 0; i < vs.size(); i++)
-   {
-      unsigned int idx = vs[i];
-      double m = m_masses[idx];
-      
-      mass += m;
-      
-      m_velocities[idx] = ( m_newpositions[idx] - m_positions[idx] ) / dt;
-      
-      xcm += m * m_positions[idx];
-      vcm += m * m_velocities[idx];
-   }
-   
-   xcm /= mass;
-   vcm /= mass;
-   
-   Vec3d L(0,0,0);
-   
-   for(unsigned int i = 0; i < vs.size(); i++)
-   {
-      unsigned int idx = vs[i];
-      double m = m_masses[idx];
-      
-      Vec3d xdiff = m_positions[idx] - xcm;
-      Vec3d vdiff = m_velocities[idx] - vcm;
-      
-      L += m * cross(xdiff, vdiff);
-   }
-   
-   Mat33d I(0,0,0,0,0,0,0,0,0);
-   
-   for(unsigned int i = 0; i < vs.size(); i++)
-   {
-      unsigned int idx = vs[i];
-      double m = m_masses[idx];
-      
-      Vec3d xdiff = m_positions[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;
-   }
-   
-//   std::cout << "determinant " << determinant(I);
-//   std::cout << "I " << std::endl << I << std::endl;
-//   std::cout << "I^-1 " << std::endl << inverse(I) << std::endl;
-   
-   Vec3d w = inverse(I) * L;
-   double wmag = mag(w);
-   Vec3d wnorm = w/wmag;
-   
-   double cosdtw = cos(dt * wmag);
-   Vec3d sindtww = sin(dt * wmag) * wnorm;
-   
-   Vec3d xrigid = xcm + dt * vcm;
-   
-   for(unsigned int i = 0; i < vs.size(); i++)
-   {
-      unsigned int idx = vs[i];
-      
-      Vec3d xdiff = m_positions[idx] - xcm;
-      Vec3d xf = dot(xdiff, wnorm) * wnorm;
-      Vec3d xr = xdiff - xf;
-      
-      m_newpositions[idx] = xrigid + xf + cosdtw * xr + cross(sindtww, xr);
-      
-      m_velocities[idx] = ( m_newpositions[idx] - m_positions[idx] ) / dt;
-   }
-   
-//   std::cout << "\n\ninter-vertex distances after rigid motion: " << std::endl;
-//   for(unsigned int i = 0; i < vs.size(); i++)
-//   {
-//      for(unsigned int j = 0; j < vs.size(); j++)
-//      {
-//         std::cout << dist( m_newpositions[vs[i]], m_newpositions[vs[j]] ) << std::endl;
-//      }
-//   }
-   
-   // std::cout << "calculated rigid motion" << std::endl;
-   // for(unsigned int i = 0; i < vs.size(); i++)
-   // for(unsigned int j = 0; j < vs.size(); j++)
-   // std::cout << (dist(positions[vs[i]], positions[vs[j]]) - dist(newpositions[vs[i]], newpositions[vs[j]])) << std::endl;
-   
-}
-
-
-// ---------------------------------------------------------
-///
-/// 
-///
-// ---------------------------------------------------------
-
-std::vector<unsigned int> DynamicSurface::merge_impact_zones( std::vector<unsigned int>& zones, 
-                                                              unsigned int z0, 
-                                                              unsigned int z1, 
-                                                              unsigned int z2, 
-                                                              unsigned int z3 )
-{
-   
-   std::vector<unsigned int> vs;
-   for(unsigned int i = 0; i < m_positions.size(); i++)
-   {
-      unsigned int& z = zones[i];
-      if(z == z0)
-      {
-         vs.push_back(i);
-      }
-      else if(z == z1)
-      {
-         vs.push_back(i);
-         z = z0;
-      }
-      else if(z == z2)
-      {
-         vs.push_back(i);
-         z = z0;
-      }
-      else if(z == z3)
-      {
-         vs.push_back(i);
-         z = z0;
-      }
-   }
-      
-   return vs;
-}
-
-
-// ---------------------------------------------------------
-///
-/// Advance mesh by one time step 
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::integrate( double dt )
-{     
-      
-   std::cout << "---------------------- El Topo: integration and collision handling --------------------" << std::endl;
-   
-   assert( m_positions.size() == m_velocities.size() );
-  
-   double curr_dt = dt;
-   double t = 0;
-      
-   while ( t < dt )
-   {
-      
-      // Handle proximities
-
-//      for(unsigned int i = 0; i < m_positions.size(); i++)
-//      {
-//         m_velocities[i] = ( m_newpositions[i] - m_positions[i] ) / curr_dt;
-//      }
-      
-      m_num_collisions_this_step = 0;
-      
-      if ( m_collision_safety )
-      {
-         rebuild_static_broad_phase();
-         handle_edge_edge_proximities( curr_dt );
-         handle_triangle_point_proximities( curr_dt );
-      }
-
-      
-      for(unsigned int i = 0; i < m_positions.size(); i++)
-      {
-         m_newpositions[i] = m_positions[i] + curr_dt * m_velocities[i];  
-      }
-      
-      
-      if ( m_collision_safety )
-      {        
-         // Handle continuous collisions
-         rebuild_continuous_broad_phase();
-
-         bool all_collisions_handled = false;
-
-         handle_point_vs_solid_triangle_collisions( curr_dt );
-         all_collisions_handled = handle_collisions( curr_dt );
-         
-         // failsafe impact zones 
-         
-         bool solver_ok = true;
-         
-         if ( !all_collisions_handled )
-         {
-            //solver_ok = handle_collisions_simultaneous( curr_dt );            
-         }
-
-         if ( !solver_ok )
-         {
-            // punt to rigid impact zones
-           // new_rigid_impact_zones( curr_dt );
-         }  
-         
-         //assert_predicted_mesh_is_intersection_free();
-         
-      }
-
-      m_total_num_collisions += m_num_collisions_this_step;
-      
-      // Set m_positions
-      for(unsigned int i = 0; i < m_positions.size(); i++)
-      {
-         m_positions[i] = m_newpositions[i];
-      } 
-      
-      t += curr_dt;
-   }
-   
-
-}
-
-// ---------------------------------------------------------
-///
-/// Construct static acceleration structure
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::rebuild_static_broad_phase()
-{
-   m_broad_phase->update_broad_phase_static( *this );
-}
-
-// ---------------------------------------------------------
-///
-/// Construct continuous acceleration structure
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::rebuild_continuous_broad_phase()
-{
-   m_broad_phase->update_broad_phase_continuous( *this );
-}
-
-
-// ---------------------------------------------------------
-///
-/// Update the broadphase elements incident to the given vertex
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::update_static_broad_phase( unsigned int vertex_index )
-{
-   const std::vector<unsigned int>& incident_tris = m_mesh.m_vtxtri[ vertex_index ];
-   const std::vector<unsigned int>& incident_edges = m_mesh.m_vtxedge[ vertex_index ];
-   
-   Vec3d low, high;
-   vertex_static_bounds( vertex_index, low, high );
-   m_broad_phase->update_vertex( vertex_index, low, high );
-   
-   for ( unsigned int 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 );
-   }
-   
-   for ( unsigned int 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 );
-   }
-
-}
-
-
-// ---------------------------------------------------------
-///
-/// Update the broadphase elements incident to the given vertex, using current and predicted vertex positions
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::update_continuous_broad_phase( unsigned int vertex_index )
-{
-   const std::vector<unsigned int>& incident_tris = m_mesh.m_vtxtri[ vertex_index ];
-   const std::vector<unsigned int>& incident_edges = m_mesh.m_vtxedge[ vertex_index ];
-
-   Vec3d low, high;
-   vertex_continuous_bounds( vertex_index, low, high );
-   m_broad_phase->update_vertex( vertex_index, low, high );
-   
-   for ( unsigned int 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 );
-   }
-   
-   for ( unsigned int 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 );
-   }
-}
-
-
-// ---------------------------------------------------------
-///
-/// Compute the (padded) AABB of a vertex
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::vertex_static_bounds(unsigned int v, Vec3d &xmin, Vec3d &xmax) const
-{
-   if ( m_mesh.m_vtxtri[v].empty() )
-   {
-      xmin = Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-      xmax = -Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-   }
-   else
-   {
-      xmin = m_positions[v] - Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-      xmax = m_positions[v] + Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-   }
-}
-
-// ---------------------------------------------------------
-///
-/// Compute the AABB of an edge
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::edge_static_bounds(unsigned int e, Vec3d &xmin, Vec3d &xmax) const
-{
-   const Vec2ui& edge = m_mesh.m_edges[e];
-   if ( edge[0] == edge[1] )
-   {
-      xmin = Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-      xmax = -Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-   }
-   else
-   {            
-      minmax(m_positions[edge[0]], m_positions[edge[1]], xmin, xmax);
-      xmin -= Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-      xmax += Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-   }
-}
-
-// ---------------------------------------------------------
-///
-/// Compute the AABB of a triangle
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::triangle_static_bounds(unsigned int t, Vec3d &xmin, Vec3d &xmax) const
-{
-   const Vec3ui& tri = m_mesh.m_tris[t];  
-   if ( tri[0] == tri[1] )
-   {
-      xmin = Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-      xmax = -Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-   }
-   else
-   {      
-      minmax(m_positions[tri[0]], m_positions[tri[1]], m_positions[tri[2]], xmin, xmax);
-      xmin -= Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-      xmax += Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-   }
-}
-
-// ---------------------------------------------------------
-///
-/// Compute the AABB of a continuous vertex
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::vertex_continuous_bounds(unsigned int v, Vec3d &xmin, Vec3d &xmax) const
-{
-   if ( m_mesh.m_vtxtri[v].empty() )
-   {
-      xmin = Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-      xmax = -Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-   }
-   else
-   {
-      minmax(m_positions[v], m_newpositions[v], xmin, xmax);
-      xmin -= Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-      xmax += Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-   }
-}
-
-// ---------------------------------------------------------
-///
-/// Compute the AABB of a continuous edge
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::edge_continuous_bounds(unsigned int e, Vec3d &xmin, Vec3d &xmax) const
-{
-   const Vec2ui& edge = m_mesh.m_edges[e];   
-   if ( edge[0] == edge[1] )
-   {
-      xmin = Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-      xmax = -Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-   }
-   else
-   {      
-      minmax(m_positions[edge[0]], m_newpositions[edge[0]], m_positions[edge[1]], m_newpositions[edge[1]], xmin, xmax);
-      xmin -= Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-      xmax += Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);   
-   }
-}
-
-// ---------------------------------------------------------
-///
-/// Compute the AABB of a continuous triangle
-///
-// ---------------------------------------------------------
-
-void DynamicSurface::triangle_continuous_bounds(unsigned int t, Vec3d &xmin, Vec3d &xmax) const
-{
-   const Vec3ui& tri = m_mesh.m_tris[t];
-   if ( tri[0] == tri[1] )
-   {
-      xmin = Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-      xmax = -Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-   }
-   else
-   {
-      minmax(m_positions[tri[0]], m_newpositions[tri[0]], m_positions[tri[1]], m_newpositions[tri[1]], m_positions[tri[2]], m_newpositions[tri[2]], xmin, xmax);
-      xmin -= Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-      xmax += Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);   
-   }
-}
-
-
-// --------------------------------------------------------
-///
-/// Check a triangle (by index) vs all other triangles for any kind of intersection
-///
-// --------------------------------------------------------
-
-bool DynamicSurface::check_triangle_vs_all_triangles_for_intersection( unsigned int tri_index  )
-{
-   return check_triangle_vs_all_triangles_for_intersection( m_mesh.m_tris[tri_index] );
-}
-
-// --------------------------------------------------------
-///
-/// Check a triangle vs all other triangles for any kind of intersection
-///
-// --------------------------------------------------------
-
-bool DynamicSurface::check_triangle_vs_all_triangles_for_intersection( const Vec3ui& tri )
-{
-   bool any_intersection = false;
-   
-   std::vector<unsigned int> overlapping_triangles;
-   Vec3d low, high;
-   
-   minmax( m_positions[tri[0]], m_positions[tri[1]], low, high );
-   low -= Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-   high += Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-   
-   m_broad_phase->get_potential_triangle_collisions( low, high, overlapping_triangles );
-   
-   for ( unsigned int i = 0; i < overlapping_triangles.size(); ++i )
-   {
-      
-      bool result = check_edge_triangle_intersection_by_index( tri[0], tri[1],
-                                                              m_mesh.m_tris[overlapping_triangles[i]][0], 
-                                                              m_mesh.m_tris[overlapping_triangles[i]][1], 
-                                                              m_mesh.m_tris[overlapping_triangles[i]][2],
-                                                              m_positions,
-                                                              false );
-      
-      if ( result )
-      {
-         check_edge_triangle_intersection_by_index( tri[0], tri[1],
-                                                   m_mesh.m_tris[overlapping_triangles[i]][0], 
-                                                   m_mesh.m_tris[overlapping_triangles[i]][1], 
-                                                   m_mesh.m_tris[overlapping_triangles[i]][2],
-                                                   m_positions,
-                                                   true );
-         
-         any_intersection = true;
-      }
-   }
-   
-   minmax( m_positions[tri[1]], m_positions[tri[2]], low, high );
-   low -= Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-   high += Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-   
-   overlapping_triangles.clear();
-   m_broad_phase->get_potential_triangle_collisions( low, high, overlapping_triangles );
-   
-   for ( unsigned int i = 0; i < overlapping_triangles.size(); ++i )
-   {
-      
-      bool result = check_edge_triangle_intersection_by_index( tri[1], tri[2],
-                                                              m_mesh.m_tris[overlapping_triangles[i]][0], 
-                                                              m_mesh.m_tris[overlapping_triangles[i]][1], 
-                                                              m_mesh.m_tris[overlapping_triangles[i]][2],
-                                                              m_positions,
-                                                              false );
-      
-      if ( result )
-      {
-         check_edge_triangle_intersection_by_index( tri[1], tri[2],
-                                                   m_mesh.m_tris[overlapping_triangles[i]][0], 
-                                                   m_mesh.m_tris[overlapping_triangles[i]][1], 
-                                                   m_mesh.m_tris[overlapping_triangles[i]][2],
-                                                   m_positions,
-                                                   true );
-         
-         any_intersection = true;
-      }
-   }
-   
-   minmax( m_positions[tri[2]], m_positions[tri[0]], low, high );
-   low -= Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-   high += Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-   
-   overlapping_triangles.clear();
-   m_broad_phase->get_potential_triangle_collisions( low, high, overlapping_triangles );
-   
-   for ( unsigned int i = 0; i < overlapping_triangles.size(); ++i )
-   {
-      
-      bool result = check_edge_triangle_intersection_by_index( tri[2], tri[0],
-                                                              m_mesh.m_tris[overlapping_triangles[i]][0], 
-                                                              m_mesh.m_tris[overlapping_triangles[i]][1], 
-                                                              m_mesh.m_tris[overlapping_triangles[i]][2],
-                                                              m_positions,
-                                                              false );
-      
-      if ( result )
-      {
-         check_edge_triangle_intersection_by_index( tri[2], tri[0],
-                                                   m_mesh.m_tris[overlapping_triangles[i]][0], 
-                                                   m_mesh.m_tris[overlapping_triangles[i]][1], 
-                                                   m_mesh.m_tris[overlapping_triangles[i]][2],
-                                                   m_positions,
-                                                   true );
-         
-         any_intersection = true;         
-      }
-   }
-   
-   //
-   // edges
-   //
-   
-   minmax( m_positions[tri[0]], m_positions[tri[1]], m_positions[tri[2]], low, high );
-   low -= Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-   high += Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-   
-   std::vector<unsigned int> overlapping_edges;
-   m_broad_phase->get_potential_edge_collisions( low, high, overlapping_edges );
-   
-   for ( unsigned int 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],
-                                                              m_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],
-                                                   m_positions,
-                                                   true );
-         
-         any_intersection = true;         
-      }
-   }
-   
-   return any_intersection;
+            
+        }
+        
+    }
+    
 }
 
-
 // ---------------------------------------------------------
 ///
 /// Fire an assert if any edge is intersecting any triangles
@@ -3410,237 +1512,172 @@ bool DynamicSurface::check_triangle_vs_all_triangles_for_intersection( const Vec
 
 void DynamicSurface::assert_mesh_is_intersection_free( bool degeneracy_counts_as_intersection )
 {
-       
-   //g_intersecting_triangles.clear();
-   
-   m_broad_phase->update_broad_phase_static( *this );
-      
-   for ( unsigned int i = 0; i < m_mesh.m_tris.size(); ++i )
-   {
-      std::vector<unsigned int> edge_candidates;
-      
-      Vec3d low, high;
-      triangle_static_bounds( i, low, high );       
-      m_broad_phase->get_potential_edge_collisions( low, high, edge_candidates );
-         
-      const Vec3ui& triangle_a = m_mesh.m_tris[i];
-      
-      if ( triangle_a[0] == triangle_a[1] || triangle_a[1] == triangle_a[2] || triangle_a[2] == triangle_a[0] )    { continue; }
-      
-      assert( m_mesh.get_edge( triangle_a[0], triangle_a[1] ) != m_mesh.m_edges.size() );
-      assert( m_mesh.get_edge( triangle_a[1], triangle_a[2] ) != m_mesh.m_edges.size() );
-      assert( m_mesh.get_edge( triangle_a[2], triangle_a[0] ) != m_mesh.m_edges.size() );
-      
-      for ( unsigned int j = 0; j < edge_candidates.size(); ++j )
-      {
-         
-         const Vec2ui& edge_b = m_mesh.m_edges[ edge_candidates[j] ];
-         
-         if ( edge_b[0] == edge_b[1] )    { continue; }
-         
-         if (    edge_b[0] == triangle_a[0] || edge_b[0] == triangle_a[1] || edge_b[0] == triangle_a[2] 
-              || edge_b[1] == triangle_a[0] || edge_b[1] == triangle_a[1] || edge_b[1] == triangle_a[2] )
-         {
-            continue;
-         }
-         
-         if ( segment_triangle_intersection( m_positions[edge_b[0]], edge_b[0], m_positions[edge_b[1]], edge_b[1],
-                                             m_positions[triangle_a[0]], triangle_a[0], 
-                                             m_positions[triangle_a[1]], triangle_a[1],
-                                             m_positions[triangle_a[2]], triangle_a[2],
-                                             degeneracy_counts_as_intersection, m_verbose ) )
-         {   
-            
-            if ( m_collision_safety )
-            {
-               std::cout << "Intersection!  Triangle " << triangle_a << " vs edge " << edge_b << std::endl;
-               
-               segment_triangle_intersection( m_positions[edge_b[0]], edge_b[0], m_positions[edge_b[1]], edge_b[1],
-                                              m_positions[triangle_a[0]], triangle_a[0],
-                                              m_positions[triangle_a[1]], triangle_a[1], 
-                                              m_positions[triangle_a[2]], triangle_a[2],
-                                              true, true );
-               
-               assert(0);
-            }
-            
-         }
-      }
-   }
-
+    
+    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
+/// 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( )
+void DynamicSurface::assert_predicted_mesh_is_intersection_free( bool degeneracy_counts_as_intersection )
 {
-       
-   rebuild_continuous_broad_phase();
-   
-   for ( unsigned int i = 0; i < m_mesh.m_tris.size(); ++i )
-   {
-      std::vector<unsigned int> edge_candidates;
-      
-      Vec3d low, high;
-      triangle_continuous_bounds( i, low, high );       
-      m_broad_phase->get_potential_edge_collisions( low, high, edge_candidates );
-      
-      const Vec3ui& triangle_a = m_mesh.m_tris[i];
-      
-      if ( triangle_a[0] == triangle_a[1] || triangle_a[1] == triangle_a[2] || triangle_a[2] == triangle_a[0] )    { continue; }
-      
-      for ( unsigned int j = 0; j < edge_candidates.size(); ++j )
-      {
-         
-         const Vec2ui& edge_b = m_mesh.m_edges[ edge_candidates[j] ];
-         
-         if ( edge_b[0] == edge_b[1] )    { continue; }
-         
-         if ( check_edge_triangle_intersection_by_index( edge_b[0], edge_b[1], 
-                                                         triangle_a[0], triangle_a[1], triangle_a[2], 
-                                                         m_newpositions, m_verbose )  )
-         {
-            if ( m_collision_safety )
-            {
-               std::cout << "Intersection!  Triangle " << triangle_a << " vs edge " << edge_b << std::endl;
-            }
-                        
-            m_verbose = true;
-                        
-            std::vector<Collision> check_collisions;
-            detect_collisions( check_collisions );
-            std::cout << "number of collisions detected: " << check_collisions.size() << std::endl;
-            
-            std::cout << "-----\n edge-triangle check using m_positions:" << std::endl;
-            
-            bool result = check_edge_triangle_intersection_by_index( edge_b[0], edge_b[1], 
-                                                       triangle_a[0], triangle_a[1], triangle_a[2], 
-                                                       m_positions, m_verbose );
-            
-            std::cout << "result: " << result << std::endl;
-            
-            std::cout << "-----\n edge-triangle check using new m_positions" << std::endl;
-            
-            result = check_edge_triangle_intersection_by_index( edge_b[0], edge_b[1], 
-                                                       triangle_a[0], triangle_a[1], triangle_a[2], 
-                                                       m_newpositions, m_verbose );
-            
-            std::cout << "result: " << result << std::endl;
-            
-            Vec3ui sorted_triangle = sort_triangle( triangle_a );
-            
-            std::cout << "sorted_triangle: " << sorted_triangle << std::endl;
-            
-            const Vec3d& ea = m_positions[edge_b[0]];
-            const Vec3d& eb = m_positions[edge_b[1]];
-            const Vec3d& ta = m_positions[sorted_triangle[0]];
-            const Vec3d& tb = m_positions[sorted_triangle[1]];
-            const Vec3d& tc = m_positions[sorted_triangle[2]];
-            
-            const Vec3d& ea_new = m_newpositions[edge_b[0]];
-            const Vec3d& eb_new = m_newpositions[edge_b[1]];
-            const Vec3d& ta_new = m_newpositions[sorted_triangle[0]];
-            const Vec3d& tb_new = m_newpositions[sorted_triangle[1]];
-            const Vec3d& tc_new = m_newpositions[sorted_triangle[2]];
-            
-            std::cout.precision(20);
-            
-            std::cout << "old: (edge0 edge1 tri0 tri1 tri2 )" << std::endl;
-            
-            std::cout << ea << std::endl;
-            std::cout << eb << std::endl;
-            std::cout << ta << std::endl;
-            std::cout << tb << std::endl;
-            std::cout << tc << std::endl;
-            
-            std::cout << "new: " << std::endl;
-            
-            std::cout << ea_new << std::endl;
-            std::cout << eb_new << std::endl;
-            std::cout << ta_new << std::endl;
-            std::cout << tb_new << std::endl;
-            std::cout << tc_new << std::endl;
-            
-            std::vector<double> possible_times;
-
-            Vec3d normal;
-            
-            std::cout << "-----" << std::endl;
-            
-            if( segment_segment_collision( ea, ea_new, edge_b[0], eb, eb_new, edge_b[1], ta, ta_new, sorted_triangle[0], tb, tb_new, sorted_triangle[1] ) )
+    
+    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 )
             {
-               
-               bool check_flipped = segment_segment_collision( ta, ta_new, sorted_triangle[0], tb, tb_new, sorted_triangle[1], ea, ea_new, edge_b[0], eb, eb_new, edge_b[1] );
-               
-               assert( check_flipped );
-               
-               
-               double time, s0, s2, rel_disp;
-               Vec3d normal;
-               
-               assert ( segment_segment_collision( ea, ea_new, edge_b[0], 
-                                                   eb, eb_new, edge_b[1], 
-                                                   ta, ta_new, sorted_triangle[0], 
-                                                   tb, tb_new, sorted_triangle[1],
-                                                   s0, s2,
-                                                   normal,
-                                                   time, rel_disp ) );
-                  
-               
-               Vec3d xmin, xmax;
-               minmax( ea, ea_new, eb, eb_new, xmin, xmax);
-               xmin -= Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);
-               xmax += Vec3d(m_proximity_epsilon, m_proximity_epsilon, m_proximity_epsilon);   
-               std::vector<unsigned int> potential_collisions;
-               m_broad_phase->get_potential_edge_collisions( xmin, xmax, potential_collisions );
-             
-               for ( unsigned int c = 0; c < potential_collisions.size(); ++c )
-               {
-                  const Vec2ui& other_edge = m_mesh.m_edges[ potential_collisions[c] ];
-                  
-                  if ( ( other_edge[0] == sorted_triangle[0] && other_edge[1] == sorted_triangle[1] ) ||
-                       ( other_edge[1] == sorted_triangle[0] && other_edge[0] == sorted_triangle[1] ) )
-                  {
-                     std::cout << "Broadphase hit" << std::endl;
-                  }
-               }
-               
-               assert(0);
-               
+                std::cout << "edge-edge: ";
             }
-            
-            std::cout << "-----" << std::endl;
-            
-            assert( !segment_segment_collision( ea, ea_new, edge_b[0], eb, eb_new, edge_b[1], tb, tb_new, sorted_triangle[1], tc, tc_new, sorted_triangle[2] ) );
-                        
-            std::cout << "-----" << std::endl;
-
-            assert( !segment_segment_collision( ea, ea_new, edge_b[0], eb, eb_new, edge_b[1], tc, tc_new, sorted_triangle[2], ta, ta_new, sorted_triangle[0] ) );
-            
-            std::cout << "-----" << std::endl;
-            
-            assert( !point_triangle_collision( ea, ea_new, edge_b[0], ta, ta_new, sorted_triangle[0], tb, tb_new, sorted_triangle[1], tc, tc_new, sorted_triangle[2] ) );
-            
-            std::cout << "-----" << std::endl;
-
-            assert( !point_triangle_collision( eb, eb_new, edge_b[1], ta, ta_new, sorted_triangle[0], tb, tb_new, sorted_triangle[1], tc, tc_new, sorted_triangle[2] ) );
-                                   
-            m_verbose = false;
-            
-            if ( m_collision_safety )
+            else
             {
-               std::cout << "no collisions detected" << std::endl;
-               //assert(0);
+                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
index cc34174..ad2823b 100644
--- a/extern/eltopo/eltopo3d/dynamicsurface.h
+++ b/extern/eltopo/eltopo3d/dynamicsurface.h
@@ -1,125 +1,68 @@
-
 // ---------------------------------------------------------
 //
 //  dynamicsurface.h
 //  Tyson Brochu 2008
 //  
-//  A triangle mesh with associated vertex locations and 
-//  velocities.  Functions for collision detection and solving.
+//  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 DYNAMICSURFACE_H
-#define DYNAMICSURFACE_H
+#ifndef EL_TOPO_DYNAMICSURFACE_H
+#define EL_TOPO_DYNAMICSURFACE_H
 
 // ---------------------------------------------------------
 // Nested includes
 // ---------------------------------------------------------
 
-#include <deque>
-#include <map>
-
-#include <mat.h>
-#include <nondestructivetrimesh.h>
 #include <ccd_wrapper.h>
+#include <nondestructivetrimesh.h>
+#include <limits>
 
 // ---------------------------------------------------------
 //  Forwards and typedefs
 // ---------------------------------------------------------
 
-// Broad-phase collision detector.  Avoids performing collision detection between far-away primitives
+// Broad-phase collision detector.  Avoids performing collision detection between far-away primitives.
 class BroadPhase;
 
-// Computes the quadric metric tensor at a vertex
-// TODO: Move this into a utility class or something
-void compute_quadric_metric_tensor( const std::vector<Vec3d>& triangle_normals, 
-                                    const std::vector<double>& triangle_areas, 
-                                    const std::vector<unsigned int>& incident_triangles,
-                                    Mat33d& quadric_metric_tensor );
-
-
-// A potentially colliding pair of primitives.  Each pair is a triple of unsigned ints:
-//  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<Vec3ui> CollisionCandidateSet;
-
+// Class for encapsulating all collision detection and resolution functionality.
+class CollisionPipeline;
 
 // ---------------------------------------------------------
-//  Interface declarations
+//  Class definitions
 // ---------------------------------------------------------
 
 // --------------------------------------------------------
 ///
-/// A collision between a triangle and a vertex or between two edges
-///
-// --------------------------------------------------------
-
-struct Collision
-{
-   
-   Collision( bool in_is_edge_edge, const Vec4ui& in_vertex_indices, const Vec3d& in_normal, const Vec4d& in_alphas, double in_relative_displacement ) :
-      is_edge_edge( in_is_edge_edge ),
-      vertex_indices( in_vertex_indices ),
-      normal( in_normal ),
-      alphas( in_alphas ),
-      relative_displacement( in_relative_displacement )
-   {
-      if ( !is_edge_edge ) { assert( in_alphas[0] == 1.0 ); }
-   }
-
-   // One or more vertices is shared between this Collision and other
-   inline bool overlap_vertices( const Collision& other ) const;
-   
-   // ALL vertices are shared between this Collision and other
-   inline bool same_vertices( const Collision& other ) const;
-   
-   // Are the two elements both edges
-   bool is_edge_edge;
-   
-   // Which vertices are involved in the collision
-   Vec4ui vertex_indices;
-   
-   // Collision normal
-   Vec3d normal;
-   
-   // Barycentric coordinates of the point of intersection
-   Vec4d alphas;
-   
-   // Magnitude of relative motion over the timestep
-   double relative_displacement;
-   
-};
-
-// --------------------------------------------------------
-///
-/// Used in the simultaneous handling of collisions: a set of connected elements which are in collision
+/// Edge-triangle intersection info.
 ///
 // --------------------------------------------------------
 
-struct ImpactZone
+struct Intersection
 {
-   ImpactZone() :
-      collisions(),
-      all_solved( false )
-   {}
-   
-   // Get the set of all vertices in this impact zone
-   void get_all_vertices( std::vector<unsigned int>& 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> collisions;  
-   
-   // Whether all collisions in this zone have been solved (i.e. no longer colliding)
-   bool all_solved;
-   
+    
+    /// 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.
@@ -128,637 +71,899 @@ struct ImpactZone
 
 class DynamicSurface
 {
-
+    
 public:
- 
-   DynamicSurface( const std::vector<Vec3d>& vs, 
-                   const std::vector<Vec3ui>& ts, 
+    
+    /// 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 );
-
-   virtual ~DynamicSurface(); 
-   
+    
+    /// Destructor
+    /// 
+    virtual ~DynamicSurface(); 
+    
 private:
-   
-   // Disallowed, do not implement
-   DynamicSurface( const DynamicSurface& );
-   DynamicSurface& operator=( const DynamicSurface& );
-   
+    
+    /// Disallowed, do not implement
+    ///
+    DynamicSurface( const DynamicSurface& );
+    
+    /// Disallowed, do not implement
+    ///
+    DynamicSurface& operator=( const DynamicSurface& );
+    
 public:
-   
-   // ---------------------------------------------------------
-   // Simulation step
-
-   /// (Implemented in SurfTrack)
-   /// 
-   virtual void improve_mesh( ) {}
-
-   /// Advance from current state to collision-free state as close as possible to predicted state.
-   /// 
-   virtual void integrate(double dt);
-   
-   // ---------------------------------------------------------
-   // Mesh bookkeeping
-
-   unsigned int add_triangle(const Vec3ui& t);
-   void remove_triangle(unsigned int t);  
-
-   unsigned int add_vertex( const Vec3d& new_vertex_position, 
-                            const Vec3d& new_vertex_velocity, 
-                            double new_vertex_mass );
-   
-   void remove_vertex(unsigned int v);
-
-   void clear_deleted_vertices( );
-
-   // ---------------------------------------------------------
-   // Utility
-
-   inline double get_triangle_area(unsigned int tri) const;
-   inline double get_triangle_area(const Vec3ui& tri) const;
-   inline double get_triangle_area(unsigned int v0, unsigned int v1, unsigned int v2) const;
-
-   inline double get_min_triangle_area( unsigned int& triangle_index ) const;
-   inline double get_min_triangle_area( ) const;
-   
-   inline Vec3d get_triangle_normal(unsigned int tri) const;
-   inline Vec3d get_triangle_normal(const Vec3ui& tri) const;
-   inline Vec3d get_triangle_normal(unsigned int v0, unsigned int v1, unsigned int v2) const;
-   
-   // Return the rank of the eigenspace of the quadric metric tensor at vertex v
-   unsigned int classify_vertex( unsigned int v );
-
-   inline Vec3d get_vertex_normal( unsigned int vertex ) const;
-   inline Vec3d get_vertex_normal_max( unsigned int vertex_index ) const;
-   
-   inline double get_edge_length( unsigned int edge_index ) const;
-   inline double get_average_edge_length() const;
-   inline double get_average_non_solid_edge_length() const;
-
-   /// Determine volume IDs for all vertices
-   void partition_surfaces( std::vector<unsigned int>& surface_ids, std::vector< std::vector< unsigned int> >& surfaces ) const;
-   
-   static double compute_max_timestep_quadratic_solve( const std::vector<Vec3ui>& tris, 
-                                                       const std::vector<Vec3d>& positions, 
-                                                       const std::vector<Vec3d>& displacements, 
-                                                       bool verbose );
-   
-   inline double get_surface_area( ) const;
-   inline double get_predicted_surface_area() const;
-   
-   inline double get_volume() const;
-   inline double get_predicted_volume() const;
-   
-   void get_triangle_intersections( const Vec3d& segment_point_a, 
+    
+    /// 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<unsigned int>& hit_triangles ) const;
-   
-   unsigned int get_number_of_triangle_intersections( const Vec3d& segment_point_a, 
+                                    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;
-   
-   unsigned int get_number_of_triangle_intersections_exact( const Vec3d& segment_point_a, 
-                                                            const Vec3d& segment_point_b ) const;
-
-   double distance_to_surface( const Vec3d& p, unsigned int& closest_triangle );
-   bool point_is_inside( const Vec3d& p );
-   
-   
-   // ---------------------------------------------------------
-   // Proximity / collision detection and resolution
-
-   void apply_edge_edge_impulse( const Vec2ui& e0, const Vec2ui& e1, double s0, double s2, Vec3d& direction, double magnitude);
-   void apply_triangle_point_impulse(const Vec3ui& t, unsigned int v, double s1, double s2, double s3, Vec3d& direction, double magnitude);
-
-   void handle_triangle_point_proximities( double dt );
-   void handle_edge_edge_proximities( double dt );
-
-   void add_point_candidates(unsigned int v, CollisionCandidateSet& collision_candidates);  
-   void add_edge_candidates(unsigned int e, CollisionCandidateSet& collision_candidates);
-   void add_triangle_candidates(unsigned int t, CollisionCandidateSet& collision_candidates);
-   void add_point_update_candidates(unsigned int v, CollisionCandidateSet& collision_candidates);
-   
-   // Impulse-based collision resolution on individual collisions [Bridson 2002]
-   // return true if we think we've handled all collisions
-   bool handle_collisions(double dt);
-
-   // run one sweep of collision handling, considering only collisions between movable vertices and nonmovable triangles
-   void handle_point_vs_solid_triangle_collisions( double dt );
-      
-   // ---------------------------------------------------------
-   // Simulataneous collision detection [Harmon et al. 2008]
-   
-   // detect all collisions
-   bool detect_collisions( std::vector<Collision>& collisions );
-   
-   // detect collisions among vertices present in impact_zones
-   void detect_new_collisions( const std::vector<ImpactZone> impact_zones, std::vector<Collision>& collisions );
-
-   // merge impact zones with common vertices
-   void merge_impact_zones( std::vector<ImpactZone>& impact_zones, std::vector<ImpactZone>& new_impact_zones );
-   
-   // iteratively run collision detection and inelastic projection on an active set of collisions
-   bool iterated_inelastic_projection( ImpactZone& iz, double dt );
-
-   // attempt to set normal velocity to zero for all collisions in the impact zone
-   bool inelastic_projection( const ImpactZone& iz );
-  
-   // detect and solve all collisions
-   bool handle_collisions_simultaneous(double dt);
-   
-   // ---------------------------------------------------------
-   // Rigid Impact Zones [BFA 2002]
-
-   bool collision_solved( const Collision& collision );
-   
-   bool new_rigid_impact_zones(double dt);
-   
-   void calculate_rigid_motion( double dt, std::vector<unsigned int>& vs );
-   
-   std::vector<unsigned int> merge_impact_zones( std::vector<unsigned int>& zones, 
-                                                 unsigned int z0, 
-                                                 unsigned int z1, 
-                                                 unsigned int z2, 
-                                                 unsigned int z3 );
-   
-   // ---------------------------------------------------------
-   // Broadphase
-
-   void rebuild_static_broad_phase( );
-   void rebuild_continuous_broad_phase( );
-
-   void update_static_broad_phase( unsigned int vertex_index );
-   void update_continuous_broad_phase( unsigned int vertex_index );  
-   
-   void vertex_static_bounds(unsigned int v, Vec3d &xmin, Vec3d &xmax) const;
-   void edge_static_bounds(unsigned int e, Vec3d &xmin, Vec3d &xmax) const;
-   void triangle_static_bounds(unsigned int t, Vec3d &xmin, Vec3d &xmax) const; 
-   
-   void vertex_continuous_bounds(unsigned int v, Vec3d &xmin, Vec3d &xmax) const;
-   void edge_continuous_bounds(unsigned int e, Vec3d &xmin, Vec3d &xmax) const;
-   void triangle_continuous_bounds(unsigned int t, Vec3d &xmin, Vec3d &xmax) const;
-
-   // ---------------------------------------------------------
-   // Intersection detection 
-   
-   bool check_triangle_vs_all_triangles_for_intersection( unsigned int tri_index );
-   bool check_triangle_vs_all_triangles_for_intersection( const Vec3ui& tri );
-      
-   void assert_mesh_is_intersection_free( bool degeneracy_counts_as_intersection = false );             // uses m_positions
-   void assert_predicted_mesh_is_intersection_free();    // uses m_newpositions
-
-   // ---------------------------------------------------------
-   // Data members
-      
-   // Elements closer than this are proximal
-   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<Vec3d> m_positions, m_newpositions, m_velocities;
-   std::vector<double> m_masses;
-
-   // The mesh "graph"
-   NonDestructiveTriMesh m_mesh;
-
-   // collision acceleration structures
-   BroadPhase* m_broad_phase;
-      
-   // TEMP:
-   unsigned int m_num_collisions_this_step;
-   unsigned int m_total_num_collisions;
+    
+    /// 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
 // ---------------------------------------------------------
 
 // --------------------------------------------------------
 ///
-/// Determine if another collision has any vertices in common with this collision.
+/// Compute area of a triangle specified by three vertices
 ///
 // --------------------------------------------------------
 
-inline bool Collision::overlap_vertices( const Collision& other ) const
+inline double triangle_area( const Vec3d& v0, const Vec3d &v1, const Vec3d &v2 )
 {
-   for ( unsigned short i = 0; i < 4; ++i )
-   {
-      if ( vertex_indices[i] == other.vertex_indices[0] || 
-           vertex_indices[i] == other.vertex_indices[1] || 
-           vertex_indices[i] == other.vertex_indices[2] || 
-           vertex_indices[i] == other.vertex_indices[3] )
-      {
-         return true;
-      }
-   }
-   
-   return false;
+    return 0.5 * mag( cross( v1 - v0, v2 - v0 ) );
 }
 
 // --------------------------------------------------------
 ///
-/// Determine if another collision has all the same vertices as this collision.
+/// Compute area of a triangle specified by a triangle index
 ///
 // --------------------------------------------------------
 
-inline bool Collision::same_vertices( const Collision& other ) const
+inline double DynamicSurface::get_triangle_area(size_t tri) const
 {
-   bool found[4];
-   for ( unsigned short i = 0; i < 4; ++i )
-   {
-      if ( vertex_indices[i] == other.vertex_indices[0] || 
-          vertex_indices[i] == other.vertex_indices[1] || 
-          vertex_indices[i] == other.vertex_indices[2] || 
-          vertex_indices[i] == other.vertex_indices[3] )
-      {
-         found[i] = true;
-      }
-      else
-      {
-         found[i] = false;
-      }
-   }
-   
-   return ( found[0] && found[1] && found[2] && found[3] );
+    const Vec3st &t = m_mesh.get_triangle( tri ); 
+    return get_triangle_area(t[0], t[1], t[2]);
 }
 
 // --------------------------------------------------------
 ///
-/// Extract the set of all vertices in all collisions in an ImpactZone
+/// Compute area of a triangle specified by a triple of vertex indices
 ///
 // --------------------------------------------------------
 
-inline void ImpactZone::get_all_vertices( std::vector<unsigned int>& vertices ) const
+inline double DynamicSurface::get_triangle_area(const Vec3st& tri) const
 {
-   vertices.clear();
-   for ( unsigned int i = 0; i < collisions.size(); ++i )
-   {
-      add_unique( vertices, collisions[i].vertex_indices[0] );
-      add_unique( vertices, collisions[i].vertex_indices[1] );
-      add_unique( vertices, collisions[i].vertex_indices[2] );
-      add_unique( vertices, collisions[i].vertex_indices[3] );
-   }
+    return get_triangle_area(tri[0], tri[1], tri[2]);
 }
 
-
 // --------------------------------------------------------
 ///
-/// Determine whether another ImpactZone shares any vertices with this ImpactZone
+/// Compute area of a triangle specified by a three vertex indices
 ///
 // --------------------------------------------------------
 
-inline bool ImpactZone::share_vertices( const ImpactZone& other ) const
+inline double DynamicSurface::get_triangle_area(size_t v0, size_t v1, size_t v2) const
 {
-   for ( unsigned int i = 0; i < collisions.size(); ++i )
-   {
-      for ( unsigned int j = 0; j < other.collisions.size(); ++j )
-      {
-         if ( collisions[i].overlap_vertices( other.collisions[j] ) )
-         {
-            return true;
-         }
-      }
-   }
-   
-   return false;
+    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));
 }
 
-
 // --------------------------------------------------------
 ///
-/// Add a collision to the list
+/// Compute the normal of a triangle specified by three vertices
 ///
 // --------------------------------------------------------
 
-inline void add_to_collision_candidates( CollisionCandidateSet& collision_candidates, const Vec3ui& new_collision )
-{  
-   collision_candidates.push_back( new_collision );
-   return;   
+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 area of a triangle specified by three vertices
+/// Compute the normal of a triangle specified by a triangle index
 ///
 // --------------------------------------------------------
 
-inline double triangle_area( const Vec3d& v0, const Vec3d &v1, const Vec3d &v2 )
+inline Vec3d DynamicSurface::get_triangle_normal(size_t tri) const
 {
-   return 0.5 * mag( cross( v1 - v0, v2 - v0 ) );
+    const Vec3st &t = m_mesh.get_triangle( tri ); 
+    return get_triangle_normal(t[0], t[1], t[2]);
 }
 
 // --------------------------------------------------------
 ///
-/// Compute area of a triangle specified by a triangle index
+/// Compute the normal of a triangle specified by a triple of vertex indices
 ///
 // --------------------------------------------------------
 
-inline double DynamicSurface::get_triangle_area(unsigned int tri) const
+inline Vec3d DynamicSurface::get_triangle_normal(const Vec3st& tri) const
 {
-   const Vec3ui &t = m_mesh.m_tris[tri]; 
-   return get_triangle_area(t[0], t[1], t[2]);
+    return get_triangle_normal(tri[0], tri[1], tri[2]);
 }
 
 // --------------------------------------------------------
 ///
-/// Compute area of a triangle specified by a triple of vertex indices
+/// Compute the normal of a triangle specified by three vertex indices
 ///
 // --------------------------------------------------------
 
-inline double DynamicSurface::get_triangle_area(const Vec3ui& tri) const
+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
 {
-   return get_triangle_area(tri[0], tri[1], tri[2]);
+    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] ) );
 }
 
 // --------------------------------------------------------
 ///
-/// Compute area of a triangle specified by a three vertex indices
+/// Return the triangle with the the smallest area, and that area
 ///
 // --------------------------------------------------------
 
-inline double DynamicSurface::get_triangle_area(unsigned int v0, unsigned int v1, unsigned int v2) const
+inline double DynamicSurface::get_min_triangle_area( size_t& triangle_index ) const
 {
-   const Vec3d &p0 = m_positions[v0];
-   const Vec3d &p1 = m_positions[v1];
-   const Vec3d &p2 = m_positions[v2];
-   
-   return 0.5 * mag(cross(p1-p0, p2-p0));
+    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 the normal of a triangle specified by three vertices
+/// Compute surface normal at the specified vertex (unweighted average of incident triangle normals).
 ///
 // --------------------------------------------------------
 
-inline Vec3d triangle_normal( const Vec3d& v0, const Vec3d &v1, const Vec3d &v2 )
+inline Vec3d DynamicSurface::get_vertex_normal( size_t vertex ) const
 {
-   Vec3d u = v1 - v0;
-   Vec3d v = v2 - v0;
-   return normalized(cross(u, v));
+    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 the normal of a triangle specified by a triangle index
+/// Compute surface normal at the specified vertex (weighted according to [Max 1999]).
 ///
 // --------------------------------------------------------
 
-inline Vec3d DynamicSurface::get_triangle_normal(unsigned int tri) const
+inline Vec3d DynamicSurface::get_vertex_normal_max( size_t vertex_index ) const
 {
-   const Vec3ui &t = m_mesh.m_tris[tri]; 
-   return get_triangle_normal(t[0], t[1], t[2]);
+    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 the normal of a triangle specified by a triple of vertex indices
+/// Compute length of the specified edge
 ///
 // --------------------------------------------------------
 
-inline Vec3d DynamicSurface::get_triangle_normal(const Vec3ui& tri) const
+inline double DynamicSurface::get_edge_length( size_t edge_index ) const
 {
-   return get_triangle_normal(tri[0], tri[1], tri[2]);
+    return mag( get_position( m_mesh.m_edges[edge_index][1] ) - get_position( m_mesh.m_edges[edge_index][0] ) );
 }
 
 // --------------------------------------------------------
 ///
-/// Compute the normal of a triangle specified by three vertex indices
+/// Compute average length over all mesh edges
 ///
 // --------------------------------------------------------
 
-inline Vec3d DynamicSurface::get_triangle_normal(unsigned int v0, unsigned int v1, unsigned int v2) const
+inline double DynamicSurface::get_average_edge_length() const
 {
-   Vec3d u = m_positions[v1] - m_positions[v0];
-   Vec3d v = m_positions[v2] - m_positions[v0];
-   return normalized(cross(u, v));
+    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]) ); 
+    }
+    return sum_lengths / (double) m_mesh.m_edges.size();   
 }
 
 // --------------------------------------------------------
 ///
-/// Return the triangle with the the smallest area, and that area
+/// Compute average length over edges on non-solid meshes
 ///
 // --------------------------------------------------------
 
-inline double DynamicSurface::get_min_triangle_area( unsigned int& triangle_index ) const
+inline double DynamicSurface::get_average_non_solid_edge_length() const
 {
-   double min_area = 1e30;
-   for ( unsigned int i = 0; i < m_mesh.m_tris.size(); ++i )
-   {
-      if ( m_mesh.m_tris[i][0] == m_mesh.m_tris[i][1] )
-      {
-         continue;
-      }
-      
-      double area = get_triangle_area(i);
-      if ( area < min_area )
-      {
-         min_area = area;
-         triangle_index = i;
-      }
-   }
-   
-   return min_area;
+    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;   
 }
 
 // --------------------------------------------------------
 ///
-/// Return the smallest triangle area
+/// Compute the surface area
 ///
 // --------------------------------------------------------
 
-inline double DynamicSurface::get_min_triangle_area( ) const
+inline double DynamicSurface::get_surface_area( ) const
 {
-   unsigned int dummy;
-   return get_min_triangle_area( dummy );
+    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 surface normal at the specified vertex (unweighted average of incident triangle normals).
+/// Compute the surface area using predicted vertex locations
 ///
 // --------------------------------------------------------
 
-inline Vec3d DynamicSurface::get_vertex_normal( unsigned int vertex ) const
+inline double DynamicSurface::get_predicted_surface_area( ) const
 {
-   Vec3d normal(0,0,0);
-   for ( unsigned int i = 0; i < m_mesh.m_vtxtri[vertex].size(); ++i )
-   {
-      normal += get_triangle_normal( m_mesh.m_vtxtri[vertex][i] );
-   }
-   normal /= double(m_mesh.m_vtxtri[vertex].size());
-   normal /= mag(normal);
-   
-   return normal;
+    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 surface normal at the specified vertex (weighted according to [Max 1999]).
+/// Compute the volume enclosed by this surface
 ///
 // --------------------------------------------------------
 
-inline Vec3d DynamicSurface::get_vertex_normal_max( unsigned int vertex_index ) const
+inline double DynamicSurface::get_volume( ) const
 {
-   const std::vector<unsigned int>& inc_tris = m_mesh.m_vtxtri[vertex_index];
-   
-   Vec3d sum_cross_products(0,0,0);
-   
-   for ( unsigned int i = 0; i < inc_tris.size(); ++i )
-   {
-      const Vec3ui& curr_tri = m_mesh.m_tris[inc_tris[i]];
-      
-      if ( curr_tri[0] == curr_tri[1] ) { continue; }
-      
-      Vec2ui other_two;
-      
-      NonDestructiveTriMesh::index_in_triangle( curr_tri, vertex_index, other_two );
-      
-      unsigned int verti = curr_tri[other_two[0]];
-      unsigned int vertnext = curr_tri[other_two[1]];
-      
-      Vec3d vi = m_positions[verti] - m_positions[vertex_index];
-      Vec3d vnext = m_positions[vertnext] - m_positions[vertex_index];
-      
-      sum_cross_products += cross( vi, vnext ) / ( mag2(vi)*mag2(vnext) );
-   }
-   
-   sum_cross_products /= mag( sum_cross_products );
-   
-   return sum_cross_products;
+    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 length of the specified edge
+/// Compute the volume using predicted vertex locations
 ///
 // --------------------------------------------------------
 
-inline double DynamicSurface::get_edge_length( unsigned int edge_index ) const
+inline double DynamicSurface::get_predicted_volume( ) const
 {
-   return mag( m_positions[ m_mesh.m_edges[edge_index][1] ] - m_positions[ m_mesh.m_edges[edge_index][0] ] );
+    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;
 }
 
 // --------------------------------------------------------
 ///
-/// Compute average length over all mesh edges
+/// Return true if the specified vertex is solid (should be treated as having infinite mass).
 ///
 // --------------------------------------------------------
 
-inline double DynamicSurface::get_average_edge_length() const
+inline bool DynamicSurface::vertex_is_solid( size_t v ) const
 {
-   double sum_lengths = 0;
-   for ( unsigned int i = 0; i < m_mesh.m_edges.size(); ++i )
-   {
-      const Vec2ui& e = m_mesh.m_edges[i]; 
-      if ( e[0] == e[1] )  { continue; }
-      sum_lengths += mag( m_positions[e[1]] - m_positions[e[0]] ); 
-   }
-   return sum_lengths / (double) m_mesh.m_edges.size();   
+    assert( v < m_masses.size() );
+    return ( m_masses[v] == std::numeric_limits<double>::infinity() );
 }
 
 // --------------------------------------------------------
 ///
-/// Compute average length over edges on non-solid meshes
+/// Return true if either end vertex of the specified edge is solid (should be treated as having infinite mass).
 ///
 // --------------------------------------------------------
 
-inline double DynamicSurface::get_average_non_solid_edge_length() const
+inline bool DynamicSurface::edge_is_solid( size_t e ) const
 {
-   double sum_lengths = 0;
-   unsigned int counted_edges = 0;
-   for ( unsigned int i = 0; i < m_mesh.m_edges.size(); ++i )
-   {
-      const Vec2ui& e = m_mesh.m_edges[i]; 
-      if ( e[0] == e[1] )  { continue; }
-      if ( m_masses[e[0]] > 100.0 || m_masses[e[1]] > 100.0 ) { continue; }
-      sum_lengths += mag( m_positions[e[1]] - m_positions[e[0]] ); 
-      ++counted_edges;
-   }
-   return sum_lengths / (double) counted_edges;   
+    const Vec2st& edge = m_mesh.m_edges[e];
+    return ( vertex_is_solid(edge[0]) || vertex_is_solid(edge[1]) );
 }
 
 // --------------------------------------------------------
 ///
-/// Compute the surface area
+/// Return true if any corner vertex of the specified triangle is solid (should be treated as having infinite mass).
 ///
 // --------------------------------------------------------
 
-inline double DynamicSurface::get_surface_area( ) const
+inline bool DynamicSurface::triangle_is_solid( size_t t ) const
 {
-   double area=0;
-   for(unsigned int t=0; t < m_mesh.m_tris.size(); ++t )
-   {
-      if ( m_mesh.m_tris[t][0] ==  m_mesh.m_tris[t][1] ) { continue; }
-      area += get_triangle_area(t);
-   }
-   return area;
+    const Vec3st& tri = m_mesh.get_triangle(t);
+    return ( vertex_is_solid(tri[0]) || vertex_is_solid(tri[1]) || vertex_is_solid(tri[2]) );
 }
-// --------------------------------------------------------
+
+
+// ---------------------------------------------------------
 ///
-/// Compute the surface area using predicted vertex locations
+/// Returns the number of vertices in the mesh, including any vertices marked as deleted
 ///
-// --------------------------------------------------------
+// ---------------------------------------------------------
 
-inline double DynamicSurface::get_predicted_surface_area( ) const
+inline size_t DynamicSurface::get_num_vertices() const
 {
-   double area=0;
-   for(unsigned int t=0; t < m_mesh.m_tris.size(); ++t )
-   {
-      if ( m_mesh.m_tris[t][0] ==  m_mesh.m_tris[t][1] ) { continue; }
-      const Vec3d &p0 = m_newpositions[m_mesh.m_tris[t][0]];
-      const Vec3d &p1 = m_newpositions[m_mesh.m_tris[t][1]];
-      const Vec3d &p2 = m_newpositions[m_mesh.m_tris[t][2]];      
-      area += 0.5 * mag(cross(p1-p0, p2-p0));
-   }
-   return area;
+    return pm_positions.size();
 }
 
-// --------------------------------------------------------
+// ---------------------------------------------------------
 ///
-/// Compute the volume enclosed by this surface
+/// Returns the current positions of a vertex.
 ///
-// --------------------------------------------------------
+// ---------------------------------------------------------
 
-inline double DynamicSurface::get_volume( ) const
+inline const Vec3d& DynamicSurface::get_position( size_t index ) const
 {
-   static const double inv_six = 1.0/6.0;
-   double volume=0;
-   for(unsigned int t=0; t < m_mesh.m_tris.size(); ++t )
-   {
-      if ( m_mesh.m_tris[t][0] ==  m_mesh.m_tris[t][1] ) { continue; }
-      const Vec3ui& tri = m_mesh.m_tris[t];
-      volume += inv_six * triple(m_positions[tri[0]], m_positions[tri[1]], m_positions[tri[2]]);
-   }
-   return volume;
+    assert( index < pm_positions.size() );
+    return pm_positions[index];   
 }
 
-// --------------------------------------------------------
+// ---------------------------------------------------------
 ///
-/// Compute the volume using predicted vertex locations
+/// Returns the set of all current vertex positions.
 ///
-// --------------------------------------------------------
+// ---------------------------------------------------------
 
-inline double DynamicSurface::get_predicted_volume( ) const
+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 )
 {
-   static const double inv_six = 1.0/6.0;
-   double volume=0;
-   for(unsigned int t=0; t < m_mesh.m_tris.size(); ++t )
-   {
-      if ( m_mesh.m_tris[t][0] ==  m_mesh.m_tris[t][1] ) { continue; }
-      const Vec3ui& tri = m_mesh.m_tris[t];
-      volume += inv_six * triple(m_newpositions[tri[0]], m_newpositions[tri[1]], m_newpositions[tri[2]]);
-   }
-   return volume;
+    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;
 }
 
 
@@ -768,24 +973,28 @@ inline double DynamicSurface::get_predicted_volume( ) const
 ///
 // --------------------------------------------------------
 
-inline bool check_edge_triangle_intersection_by_index( unsigned int edge_a, 
-                                                       unsigned int edge_b, 
-                                                       unsigned int triangle_a, 
-                                                       unsigned int triangle_b, 
-                                                       unsigned int triangle_c, 
-                                                       std::vector<Vec3d>& m_positions, 
-                                                       bool verbose )
+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 
+    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;
-   }
-   
-   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,
-                                         true, verbose );
-   
+    {
+        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);
+    
 }
 
 
@@ -796,58 +1005,60 @@ inline bool check_edge_triangle_intersection_by_index( unsigned int edge_a,
 ///
 // --------------------------------------------------------
 
-inline bool check_triangle_triangle_intersection( Vec3ui triangle_a, 
-                                                  Vec3ui triangle_b, 
-                                                  std::vector<Vec3d>& m_positions )
+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], 
+    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], 
-                                                   m_positions, false ) )
-   {
-      return true;
-   }
-   
-   if ( check_edge_triangle_intersection_by_index( triangle_a[1], triangle_a[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], 
-                                                   m_positions, false ) )
-   {
-      return true;
-   }
-   
-   if ( check_edge_triangle_intersection_by_index( triangle_a[2], triangle_a[0], 
+                                                   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], 
-                                                   m_positions, false ) )
-   {
-      return true;
-   }
-   
-   if ( check_edge_triangle_intersection_by_index( triangle_b[0], triangle_b[1], 
+                                                   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], 
-                                                   m_positions, false ) )
-   {
-      return true;
-   }
-   
-   if ( check_edge_triangle_intersection_by_index( triangle_b[1], triangle_b[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], 
-                                                   m_positions, false ) )
-   {
-      return true;
-   }
-   
-   if ( check_edge_triangle_intersection_by_index( triangle_b[2], triangle_b[0], 
+                                                   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], 
-                                                   m_positions, false ) )
-   {
+                                                   positions, false ) )
+    {
 		return true;
-   }
-   
-   return false;
+    }
+    
+    return false;
 }
 
 #endif
+
+
diff --git a/extern/eltopo/eltopo3d/edgecollapser.cpp b/extern/eltopo/eltopo3d/edgecollapser.cpp
new file mode 100644
index 0000000..f389e13
--- /dev/null
+++ b/extern/eltopo/eltopo3d/edgecollapser.cpp
@@ -0,0 +1,871 @@
+// ---------------------------------------------------------
+//
+//  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
new file mode 100644
index 0000000..0d46e52
--- /dev/null
+++ b/extern/eltopo/eltopo3d/edgecollapser.h
@@ -0,0 +1,126 @@
+// ---------------------------------------------------------
+//
+//  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
new file mode 100644
index 0000000..e7a92e0
--- /dev/null
+++ b/extern/eltopo/eltopo3d/edgeflipper.cpp
@@ -0,0 +1,540 @@
+// ---------------------------------------------------------
+//
+//  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
new file mode 100644
index 0000000..d7739f7
--- /dev/null
+++ b/extern/eltopo/eltopo3d/edgeflipper.h
@@ -0,0 +1,82 @@
+// ---------------------------------------------------------
+//
+//  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
new file mode 100644
index 0000000..5fd6509
--- /dev/null
+++ b/extern/eltopo/eltopo3d/edgesplitter.cpp
@@ -0,0 +1,740 @@
+// ---------------------------------------------------------
+//
+//  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
new file mode 100644
index 0000000..851f8ab
--- /dev/null
+++ b/extern/eltopo/eltopo3d/edgesplitter.h
@@ -0,0 +1,114 @@
+// ---------------------------------------------------------
+//
+//  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
index d1a8bb8..10c5c15 100644
--- a/extern/eltopo/eltopo3d/eltopo.cpp
+++ b/extern/eltopo/eltopo3d/eltopo.cpp
@@ -1,4 +1,3 @@
-
 // ---------------------------------------------------------
 //
 //  eltopo.cpp
@@ -11,121 +10,181 @@
 #include <eltopo.h>
 #include <surftrack.h>
 
-
 // ---------------------------------------------------------
 ///
 /// Static operations: edge collapse, edge split, edge flip, null-space smoothing, and topological changes
 ///
 // ---------------------------------------------------------
 
-void el_topo_static_operations( const int in_num_vertices,                      // input
-                        const double* in_vertex_locations,           
-                        const int in_num_triangles,                   
-                        const int* in_triangles,
-                        const double* in_masses,
-                        const struct ElTopoGeneralOptions* general_options,     // options
-                        const struct ElTopoStaticOperationsOptions* options, 
-                        int* out_num_vertices,                                  // output
-                        double** out_vertex_locations,  
-                        int* out_num_triangles,
-                        int** out_triangles,
-                        double** out_masses ) 
+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> ms;
-   for ( int i = 0; i < in_num_vertices; ++i )
-   {
-      vs.push_back( Vec3d( in_vertex_locations[3*i], in_vertex_locations[3*i + 1], in_vertex_locations[3*i + 2] ) );
-      ms.push_back( in_masses[i] );
-   }
-
-   std::vector<Vec3ui> ts;
-   for ( int i = 0; i < in_num_triangles; ++i )
-   {
-      ts.push_back( Vec3ui( in_triangles[3*i], in_triangles[3*i + 1], in_triangles[3*i + 2] ) );
-   }
-   
-
-   // =================================================================================
-   
-   //
-   // do the actual operations
-   //
-   
-   // build a SurfTrack
-   SurfTrackInitializationParameters construction_parameters;
-            
-   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_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, ms, construction_parameters );
-   
-   surface_tracker.clear_deleted_vertices();
-   
-   // perform mesh improvement
-   surface_tracker.improve_mesh();
-   
-   // do merging
-   surface_tracker.topology_changes();
-      
-   // TEMP
-   for ( unsigned int i = 0; i < surface_tracker.m_positions.size(); ++i )
-   {
-      assert( surface_tracker.m_mesh.m_vtxtri[i].size() > 0 );
-   }
-   
-   // =================================================================================
-
-   //
-   // data wrangling
-   //
-   
-   *out_num_vertices = surface_tracker.m_positions.size();
-   *out_vertex_locations = (double*) malloc( 3 * (*out_num_vertices) * sizeof(double) );
-   *out_masses = (double*) malloc( (*out_num_vertices) * sizeof(double) );
-   for ( int i = 0; i < (*out_num_vertices); ++i )
-   {
-      (*out_vertex_locations)[3*i] = surface_tracker.m_positions[i][0];
-      (*out_vertex_locations)[3*i + 1] = surface_tracker.m_positions[i][1];      
-      (*out_vertex_locations)[3*i + 2] = surface_tracker.m_positions[i][2];            
-      (*out_masses)[i] = surface_tracker.m_masses[i];
-   }
-   
-   *out_num_triangles = surface_tracker.m_mesh.m_tris.size();
-   *out_triangles = (int*) malloc( 3 * (*out_num_triangles) * sizeof(int) );
-   for ( int i = 0; i < (*out_num_triangles); ++i )
-   {
-      (*out_triangles)[3*i] = surface_tracker.m_mesh.m_tris[i][0];
-      (*out_triangles)[3*i + 1] = surface_tracker.m_mesh.m_tris[i][1]; 
-      (*out_triangles)[3*i + 2] = surface_tracker.m_mesh.m_tris[i][2];       
-   }
-   
+    //
+    // 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.
+/// Free memory allocated by static operations and defrag.
 ///
 // ---------------------------------------------------------
 
-void el_topo_free_static_operations_results( double* out_vertex_locations, int* out_triangles, double* out_masses )
+void el_topo_free_static_operations_results( ElTopoMesh* outputs, struct ElTopoDefragInformation* defrag_info )
 {
-   free( out_vertex_locations );
-   free( out_triangles );
-   free( out_masses );
+    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 );
 }
-  
+
 
 // ---------------------------------------------------------
 ///
@@ -133,75 +192,70 @@ void el_topo_free_static_operations_results( double* out_vertex_locations, int*
 ///
 // ---------------------------------------------------------
 
-extern "C" void el_topo_integrate( const int num_vertices, 
-                        const double *in_vertex_locations, 
-                        const double *in_vertex_new_locations, 
-                        const int num_triangles, 
-                        const int *triangles,
-                        const double *in_masses,
-                        const struct ElTopoGeneralOptions* general_options,
-                        const struct ElTopoIntegrationOptions* options,
-                        double **out_vertex_locations )
+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 < num_vertices; ++i )
-   {
-      vs.push_back( Vec3d( in_vertex_locations[3*i], in_vertex_locations[3*i + 1], in_vertex_locations[3*i + 2] ) );
-      masses.push_back(in_masses[i]);
-   }
-   
-   std::vector<Vec3ui> ts;
-   for ( int i = 0; i < num_triangles; ++i )
-   {
-      ts.push_back( Vec3ui( triangles[3*i], triangles[3*i + 1], triangles[3*i + 2] ) );
-   }
-   
-   
-   // =================================================================================
-   
-   //
-   // do the integration
-   //
-   
-   // build a DynamicSurface
-   DynamicSurface dynamic_surface( vs, ts, masses, options->m_proximity_epsilon, general_options->m_collision_safety );
-
-   dynamic_surface.m_mesh.update_connectivity( num_vertices );
-   
-   // set velocities
-   dynamic_surface.m_velocities.resize( num_vertices );
-   for ( int i = 0; i < num_vertices; ++i )
-   {
-      dynamic_surface.m_newpositions[i] = Vec3d( in_vertex_new_locations[3*i], in_vertex_new_locations[3*i + 1], in_vertex_new_locations[3*i + 2] );
-      dynamic_surface.m_velocities[i] = ( dynamic_surface.m_newpositions[i] - dynamic_surface.m_positions[i] ) / options->m_dt;
-   }
-   
-   // advance by dt
-   dynamic_surface.integrate( options->m_dt );
-   
-   
-   // =================================================================================   
-   
-   //
-   // data wrangling
-   //
-   
-   *out_vertex_locations = (double*) malloc( 3 * num_vertices * sizeof(double) );
-   for ( int i = 0; i < num_vertices; ++i )
-   {
-      (*out_vertex_locations)[3*i]     = dynamic_surface.m_positions[i][0];
-      (*out_vertex_locations)[3*i + 1] = dynamic_surface.m_positions[i][1];
-      (*out_vertex_locations)[3*i + 2] = dynamic_surface.m_positions[i][2];
-   }
-      
+    //
+    // 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 );
+    
+    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.
@@ -210,8 +264,8 @@ extern "C" void el_topo_integrate( const int num_vertices,
 
 void el_topo_free_integrate_results( double* out_vertex_locations )
 {
-   free( out_vertex_locations );
+    free( out_vertex_locations );
 }
 
-   
+
 
diff --git a/extern/eltopo/eltopo3d/eltopo.h b/extern/eltopo/eltopo3d/eltopo.h
index b2807d5..b66658e 100644
--- a/extern/eltopo/eltopo3d/eltopo.h
+++ b/extern/eltopo/eltopo3d/eltopo.h
@@ -1,4 +1,3 @@
-
 // ---------------------------------------------------------
 //
 //  eltopo.h
@@ -14,187 +13,253 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-   
-// ---------------------------------------------------------
-//  Interface declarations
-// ---------------------------------------------------------
-   
+    
+    
+    // =========================================================
+    //  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
 
-// =========================================================
-//  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
-};
-
-// ---------------------------------------------------------
-///
-/// 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;              
-
-   // edges closer than this distance will merge
-   double m_merge_proximity_epsilon;    
-
-   // scheme to use to generate midpoints when collapsing/splitting edges.  
-   // Set this to 0 to use default.
-   void* m_subdivision_scheme;            
-};
-
-// ---------------------------------------------------------
-///
-/// Options for position integration
-///
-// ---------------------------------------------------------
-   
-struct ElTopoIntegrationOptions
-{
-   // mesh elements closer than this will trigger repulsion forces
-   double m_proximity_epsilon;      
-
-   // integration timestep size
-   double m_dt;                     
-};
-
-   
-
-// =========================================================
-//  API FUNCTIONS
-// =========================================================   
-
-   
-// ---------------------------------------------------------
-///
-/// Static operations: edge collapse, edge split, edge flip, null-space 
-/// smoothing, and topological changes
-///
-/// Parameters:
-///   in_num_vertices:           (Input) Number of input vertices.
-///   in_vertex_locations:       (Input) Flattened array of vertex coordinates.
-///                                      Elements 0, 1, and 2 are x, y, and z
-///                                      coordinates of the first vertex, etc.
-///   in_num_triangles           (Input) Number of input triangles.
-///   in_triangles               (Input) Triples of vertex indices.  Elements 
-///                                      0, 1, and 2 are indices of vertices
-///                                      comprising the first triangle, etc.
-///   in_masses                  (Input) Input vertex masses.
-///   general_otions             (Input) Structure specifying options common to
-///                                      static operations and integration.
-///   options                    (Input) Structure specifying options specific 
-///                                      to static operations.
-///   out_num_vertices           (Output) Number of vertices after static 
-///                                       operations.
-///   out_vertex_locations       (Output, allocated by El Topo) Vertex 
-///                                       locations after static operations.
-///   out_num_triangles          (Output) Number of triangles after static 
-///                                       operations.
-///   out_triangles              (Output, allocated by El Topo) Triangles after
-///                                       static operations.
-///   out_masses                 (Output, allocated by El Topo) Vertex masses 
-///                                       after static operations.
-///
-// ---------------------------------------------------------
-   
-void el_topo_static_operations( const int in_num_vertices,                   
-                          const double* in_vertex_locations,           
-                          const int in_num_triangles,                   
-                          const int* in_triangles, 
-                          const double* in_masses,
-                          const struct ElTopoGeneralOptions* general_options,
-                          const struct ElTopoStaticOperationsOptions* options, 
-                          int* out_num_vertices,                       
-                          double** out_vertex_locations,  
-                          int* out_num_triangles,
-                          int** out_triangles,
-                          double** out_masses );
-
-// ---------------------------------------------------------
-///
-/// Free memory allocated by static operations.
-///
-// ---------------------------------------------------------
-   
-void el_topo_free_static_operations_results( double* out_vertex_locations, 
-                                             int* out_triangles, 
-                                             double* out_masses );
-
-// ---------------------------------------------------------
-///
-/// Surface vertex position integration.
-///
-/// Parameters:
-///   num_vertices:              (Input) Number of input vertices (not changed 
-///                                      by integration).
-///   in_vertex_locations:       (Input) Flattened array of vertex coordinates.
-///                                      Elements 0, 1, and 2 are x, y, and z
-///                                      coordinates of the first vertex, etc.
-///   in_new_vertex_locations:   (Input) Predicted vertex coordinates.
-///   num_triangles              (Input) Number of input triangles (not changed
-///                                      by integration).
-///   triangles                  (Input) Triples of vertex indices (not changed
-///                                      by integration).  Elements 0, 1, and 
-///                                      2 are indices of vertices comprising 
-///                                      the first triangle, and so on.
-///   masses                     (Input) Input vertex masses (not changed by 
-///                                      integration).
-///   general_otions             (Input) Structure specifying options common to
-///                                      static operations and integration.
-///   options                    (Input) Structure specifying options specific 
-///                                      to integration.
-///   out_vertex_locations       (Output, allocated by El Topo) Vertex 
-///                                      locations after integration.
-///
-// ---------------------------------------------------------
-   
-void el_topo_integrate( const int num_vertices, 
-                        const double *in_vertex_locations, 
-                        const double *in_vertex_new_locations, 
-                        const int num_triangles, 
-                        const int *triangles, 
-                        const double *masses,
-                        const struct ElTopoGeneralOptions* general_options,
-                        const struct ElTopoIntegrationOptions* options,
-                        double **out_vertex_locations );
-   
-
-// ---------------------------------------------------------
-///
-/// Free memory allocated by integration.
-///
-// ---------------------------------------------------------
-   
-void el_topo_free_integrate_results( double* out_vertex_locations );
-   
-
+        /// 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
diff --git a/extern/eltopo/eltopo3d/h-file-template.txt b/extern/eltopo/eltopo3d/h-file-template.txt
new file mode 100644
index 0000000..545bc4f
--- /dev/null
+++ b/extern/eltopo/eltopo3d/h-file-template.txt
@@ -0,0 +1,23 @@
+// ---------------------------------------------------------
+//
+//  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
new file mode 100644
index 0000000..12f6f97
--- /dev/null
+++ b/extern/eltopo/eltopo3d/impactzonesolver.cpp
@@ -0,0 +1,768 @@
+// ---------------------------------------------------------
+//
+//  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
new file mode 100644
index 0000000..30bc104
--- /dev/null
+++ b/extern/eltopo/eltopo3d/impactzonesolver.h
@@ -0,0 +1,161 @@
+// ---------------------------------------------------------
+//
+//  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
new file mode 100644
index 0000000..0cb8423
--- /dev/null
+++ b/extern/eltopo/eltopo3d/meshmerger.cpp
@@ -0,0 +1,463 @@
+// ---------------------------------------------------------
+//
+//  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
new file mode 100644
index 0000000..d0066c2
--- /dev/null
+++ b/extern/eltopo/eltopo3d/meshmerger.h
@@ -0,0 +1,113 @@
+// ---------------------------------------------------------
+//
+//  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
new file mode 100644
index 0000000..b89c35c
--- /dev/null
+++ b/extern/eltopo/eltopo3d/meshpincher.cpp
@@ -0,0 +1,250 @@
+// ---------------------------------------------------------
+//
+//  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
new file mode 100644
index 0000000..f94e583
--- /dev/null
+++ b/extern/eltopo/eltopo3d/meshpincher.h
@@ -0,0 +1,76 @@
+// ---------------------------------------------------------
+//
+//  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
new file mode 100644
index 0000000..93dfaea
--- /dev/null
+++ b/extern/eltopo/eltopo3d/meshrenderer.cpp
@@ -0,0 +1,277 @@
+// ---------------------------------------------------------
+//
+//  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
new file mode 100644
index 0000000..66640f1
--- /dev/null
+++ b/extern/eltopo/eltopo3d/meshrenderer.h
@@ -0,0 +1,85 @@
+// ---------------------------------------------------------
+//
+//  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
new file mode 100644
index 0000000..01cb913
--- /dev/null
+++ b/extern/eltopo/eltopo3d/meshsmoother.cpp
@@ -0,0 +1,445 @@
+// ---------------------------------------------------------
+//
+//  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
new file mode 100644
index 0000000..0b2dee0
--- /dev/null
+++ b/extern/eltopo/eltopo3d/meshsmoother.h
@@ -0,0 +1,80 @@
+// ---------------------------------------------------------
+//
+//  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
index 2ac0c34..294927a 100644
--- a/extern/eltopo/eltopo3d/nondestructivetrimesh.cpp
+++ b/extern/eltopo/eltopo3d/nondestructivetrimesh.cpp
@@ -1,4 +1,3 @@
-
 // ---------------------------------------------------------
 //
 //  nondestructivetrimesh.cpp
@@ -15,39 +14,22 @@
 
 #include <nondestructivetrimesh.h>
 
+#include <cmath>
 #include <cstdarg>
 #include <cstdlib>
-#include <cmath>
 #include <fstream>
-
 #include <wallclocktime.h>
 
-
 // ---------------------------------------------------------
 // Local constants, typedefs, macros
 // ---------------------------------------------------------
 
+namespace {
+    
 /// Avoid modulo operator in (i+1)%3
-const static unsigned int i_plus_one_mod_three[3] = {1,2,0};
-
-// ---------------------------------------------------------
-// Extern globals
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// Static function definitions
-// ---------------------------------------------------------
-
-// --------------------------------------------------------
-///
-/// Determine whether two edges share the same vertices
-///
-// --------------------------------------------------------
-
-static bool compare_edges(Vec2ui &e0, Vec2ui &e1)
-{
-   return (e0[0] == e1[0] && e0[1] == e1[1]) || (e0[0] == e1[1] && e0[1] == e1[0]);
-}
+const unsigned int i_plus_one_mod_three[3] = {1,2,0};
+    
+}   // namespace
 
 
 // ---------------------------------------------------------
@@ -62,8 +44,8 @@ static bool compare_edges(Vec2ui &e0, Vec2ui &e1)
 
 void NonDestructiveTriMesh::clear()
 {
-   m_tris.clear();
-   clear_connectivity();
+    m_tris.clear();
+    clear_connectivity();
 }
 
 
@@ -73,56 +55,73 @@ void NonDestructiveTriMesh::clear()
 ///
 // --------------------------------------------------------
 
-void NonDestructiveTriMesh::nondestructive_remove_triangle(unsigned int tri)
+void NonDestructiveTriMesh::nondestructive_remove_triangle(size_t tri)
 {
-   // Update the vertex->triangle map, m_vtxtri
-   
-   Vec3ui& t = m_tris[tri];
-   for(unsigned int i = 0; i < 3; i++)
-   {
-      // Get the set of triangles incident on vertex t[i]
-      std::vector<unsigned int>& vt = m_vtxtri[t[i]];
-      
-      for(unsigned int j = 0; j < 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;
-         }
-      }
-   }
-
-   // Clear t, marking it as deleted
-   t = Vec3ui(0,0,0);
-   
-   // Update the triangle->edge map, m_triedge
-   
-   Vec3ui& te = m_triedge[tri];
-   
-   for(unsigned int i = 0; i < 3; i++)
-   {
-      std::vector<unsigned int>& et = m_edgetri[te[i]];
-      
-      for( int j = 0; j < (int) et.size(); j++)
-      {
-         if(et[j] == tri)
-         {
-            et.erase( et.begin() + j );
-            --j;
-         }
-      }
-      
-      if ( et.empty() )
-      {
-         // No triangles are incident on this edge.  Delete it.
-         nondestructive_remove_edge( te[i] );
-      }            
-   }
-   
-   new (&te) Vec3ui(0,0,0);
-   
+    // 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;
+    
+    
 }
 
 
@@ -132,48 +131,69 @@ void NonDestructiveTriMesh::nondestructive_remove_triangle(unsigned int tri)
 ///
 // --------------------------------------------------------
 
-void NonDestructiveTriMesh::nondestructive_add_triangle( const Vec3ui& tri )
+size_t NonDestructiveTriMesh::nondestructive_add_triangle( const Vec3st& tri )
 {
-   int idx = m_tris.size();
-   m_tris.push_back(tri);
-   m_triedge.resize(idx+1);
-   
-   for(unsigned int i = 0; i < 3; i++)
-   {
-      unsigned int vtx0 = tri[ i ];
-      unsigned int vtx1 = tri[ i_plus_one_mod_three[i] ];
-            
-      // Find the edge composed of these two vertices
-      unsigned int e = get_edge(vtx0, vtx1);
-      if(e == m_edges.size())
-      {
-         // if the edge doesn't exist, add it
-         e = add_edge(vtx0, vtx1);
-      }
-      
-      // Update connectivity
-      m_edgetri[e].push_back(idx);       // edge->triangle
-      m_triedge[idx][i] = e;             // triangle->edge
-      m_vtxtri[tri[i]].push_back(idx);   // vertex->triangle
-   }
-   
+    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.
 ///
 // --------------------------------------------------------
 
-unsigned int NonDestructiveTriMesh::nondestructive_add_vertex( )
+size_t NonDestructiveTriMesh::nondestructive_add_vertex( )
 {  
-   assert( m_vtxedge.size() == m_vtxtri.size() );
-   
-   m_vtxedge.resize( m_vtxedge.size() + 1 );
-   m_vtxtri.resize( m_vtxtri.size() + 1 );
-      
-   return m_vtxtri.size() - 1;
+    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;
 }
 
 
@@ -183,19 +203,76 @@ unsigned int NonDestructiveTriMesh::nondestructive_add_vertex( )
 ///
 // --------------------------------------------------------
 
-void NonDestructiveTriMesh::nondestructive_remove_vertex(unsigned int vtx)
+void NonDestructiveTriMesh::nondestructive_remove_vertex(size_t vtx)
 {
     
-    m_vtxtri[vtx].clear();    //triangles incident on vertices
+    m_vertex_to_triangle_map[vtx].clear();    //triangles incident on vertices
     
     // check any m_edges incident on this vertex are marked as deleted
-    for ( unsigned int i = 0; i < m_vtxedge[vtx].size(); ++i )
+    for ( size_t i = 0; i < m_vertex_to_edge_map[vtx].size(); ++i )
     {
-       assert( m_edges[ m_vtxedge[vtx][i] ][0] == m_edges[ m_vtxedge[vtx][i] ][1] );
+        assert( m_edges[ m_vertex_to_edge_map[vtx][i] ][0] == m_edges[ m_vertex_to_edge_map[vtx][i] ][1] );
     }
     
-    m_vtxedge[vtx].clear();   //edges incident on vertices
-   
+    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;
 }
 
 
@@ -205,126 +282,193 @@ void NonDestructiveTriMesh::nondestructive_remove_vertex(unsigned int vtx)
 ///
 // --------------------------------------------------------
 
-void NonDestructiveTriMesh::nondestructive_remove_edge( unsigned int edge_index )
+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( )
 {
-   // vertex 0
-   {
-      std::vector<unsigned int>& vertex_to_edge_map = m_vtxedge[ m_edges[edge_index][0] ];
-      for ( unsigned int i=0; i < 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 );
-         }
-      }
-   }
-
-   // vertex 1
-   {
-      std::vector<unsigned int>& vertex_to_edge_map = m_vtxedge[ m_edges[edge_index][1] ];
-      for ( unsigned int i=0; i < 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 );
-         }
-      }
-   }
-
-   m_edges[edge_index][0] = 0;
-   m_edges[edge_index][1] = 0;  
+    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.
 ///
 // --------------------------------------------------------
 
-unsigned int NonDestructiveTriMesh::get_edge(unsigned int vtx0, unsigned int vtx1) const
+size_t NonDestructiveTriMesh::get_edge_index(size_t vtx0, size_t vtx1) const
 {
-   assert( vtx0 < m_vtxedge.size() );
-   assert( vtx1 < m_vtxedge.size() );
-   
-   const std::vector<unsigned int>& edges0 = m_vtxedge[vtx0];
-   const std::vector<unsigned int>& edges1 = m_vtxedge[vtx1];
-   
-   for(unsigned int e0 = 0; e0 < edges0.size(); e0++)
-   {
-      unsigned int edge0 = edges0[e0];
-      
-      for(unsigned int 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();
+    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();
 }
 
+
 // --------------------------------------------------------
 ///
-/// Add an edge to the list.  Return the index of the new edge.
+/// Find triangle specified by three vertices.  Return triangles.size if the triangle is not found.
 ///
 // --------------------------------------------------------
 
-unsigned int NonDestructiveTriMesh::add_edge(unsigned int vtx0, unsigned int vtx1)
+size_t NonDestructiveTriMesh::get_triangle_index( size_t vtx0, size_t vtx1, size_t vtx2 ) const
 {
-   int edge_index = m_edges.size();
-   m_edges.push_back(Vec2ui(vtx0, vtx1));
-   
-   m_edgetri.push_back( std::vector<unsigned int>() );
-   
-   m_vtxedge[vtx0].push_back(edge_index);
-   m_vtxedge[vtx1].push_back(edge_index);
-   
-   return edge_index;
+    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()
+void NonDestructiveTriMesh::clear_deleted_triangles( std::vector<Vec2st>* defragged_triangle_map )
 {  
-
-//   if ( m_tris.size() < 250000 )
-//   {
-//      for( int i = 0; i < (int) m_tris.size(); i++ )
-//      {
-//         if( m_tris[i][0] == m_tris[i][1] )
-//         {
-//            m_tris.erase( m_tris.begin() + i );
-//            --i;
-//         }
-//      }
-//   }
-//   else
-   
-   {
-      std::vector<Vec3ui> new_tris;
-      new_tris.reserve( m_tris.size() );
-      std::vector<Vec3ui>::const_iterator iter = m_tris.begin();
-      for( ; iter != m_tris.end(); ++iter )
-      {
-         if( (*iter)[0] != (*iter)[1] )
-         {
-            new_tris.push_back( *iter );
-         }
-      }
-      m_tris = new_tris;
-   }
+    
+    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
@@ -333,11 +477,14 @@ void NonDestructiveTriMesh::clear_deleted_triangles()
 
 void NonDestructiveTriMesh::clear_connectivity()
 {
-   m_edges.clear();
-   m_vtxedge.clear();
-   m_vtxtri.clear();
-   m_edgetri.clear();
-   m_triedge.clear();
+    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();
+    
 }
 
 
@@ -347,49 +494,213 @@ void NonDestructiveTriMesh::clear_connectivity()
 ///
 // --------------------------------------------------------
 
-void NonDestructiveTriMesh::update_connectivity( unsigned int nv )
+void NonDestructiveTriMesh::update_connectivity( )
 {
-
-   clear_connectivity();
-   
-   clear_deleted_triangles();
-   
-   m_vtxtri.resize(nv);
-   m_vtxedge.resize(nv);
-   m_triedge.resize(m_tris.size());
-   
-   for(unsigned int i = 0; i < m_tris.size(); i++)
-   {
-      Vec3ui& t = m_tris[i];
-      
-      if(t[0] != t[1])
-      {
-         
-         for(unsigned int j = 0; j < 3; j++)
-            m_vtxtri[t[j]].push_back(i);
-         
-         Vec3ui& te = m_triedge[i];
-         
-         for(int j = 0; j < 3; j++)
-         {
-            unsigned int vtx0 = t[j];
-            unsigned int vtx1 = t[(j+1)%3];
+    
+    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);
             
-            unsigned int e = get_edge(vtx0, vtx1);
+            Vec3st& te = m_triangle_to_edge_map[i];
             
-            if(e == m_edges.size())
+            for(int j = 0; j < 3; j++)
             {
-               e = add_edge(vtx0, vtx1);
+                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);
             }
-            
-            te[j] = e;
-            m_edgetri[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
index 1347051..877f294 100644
--- a/extern/eltopo/eltopo3d/nondestructivetrimesh.h
+++ b/extern/eltopo/eltopo3d/nondestructivetrimesh.h
@@ -1,4 +1,3 @@
-
 // ---------------------------------------------------------
 //
 //  nondestructivetrimesh.h
@@ -10,8 +9,8 @@
 //
 // ---------------------------------------------------------
 
-#ifndef NONDESTRUCTIVETRIMESH_H
-#define NONDESTRUCTIVETRIMESH_H
+#ifndef EL_TOPO_NONDESTRUCTIVETRIMESH_H
+#define EL_TOPO_NONDESTRUCTIVETRIMESH_H
 
 // ---------------------------------------------------------
 // Nested includes
@@ -22,8 +21,22 @@
 #include <vector>
 #include <vec.h>
 
+
 // ---------------------------------------------------------
-//  Interface declarations
+//  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
 // ---------------------------------------------------------
 
 // --------------------------------------------------------
@@ -32,132 +45,305 @@
 ///
 // --------------------------------------------------------
 
-struct NonDestructiveTriMesh
+class NonDestructiveTriMesh
 {  
-   NonDestructiveTriMesh() :
-      m_tris(0), m_edges(0),
-      m_vtxedge(0), m_vtxtri(0), m_edgetri(0), m_triedge(0)
-   {}
-   
-   void clear();
-   
-   void clear_connectivity();
-   void update_connectivity( unsigned int nv );
-   
-   /// Find the index of an edge in the list of edges
-   ///
-   unsigned int get_edge(unsigned int vtx0, unsigned int vtx1) const;  
-   
-   /// Get all triangles adjacent to the specified triangle
-   ///
-   void get_adjacent_triangles( unsigned int triangle_index, std::vector<unsigned int>& adjacent_triangles ) const;
-   
-   unsigned int add_edge(unsigned int vtx0, unsigned int vtx1);
-   
-   void nondestructive_add_triangle(const Vec3ui& tri);
-   void nondestructive_remove_triangle(unsigned int tri);
-   
-   unsigned int nondestructive_add_vertex( );
-   void nondestructive_remove_vertex(unsigned int vtx);
-   
-   void nondestructive_add_edge( Vec2ui new_edge );
-   void nondestructive_remove_edge( unsigned int edge_index );
-   
-   /// Given two vertices on a triangle, return the third vertex
-   ///
-   inline unsigned int get_third_vertex( unsigned int vertex0, unsigned int vertex1, const Vec3ui& triangle ) const;
-   
-   /// Given two vertices on a triangle, return whether or not the triangle has the same orientation
-   ///
-   inline static bool oriented( unsigned int vertex0, unsigned int vertex1, const Vec3ui& triangle );
-   
-   inline static bool triangle_has_these_verts( const Vec3ui& tri, const Vec3ui& verts );
-   
-   /// Return which vertex in tri matches v.  Also returns the other two vertices in tri.
-   ///
-   inline static unsigned int index_in_triangle( const Vec3ui& tri, unsigned int v, Vec2ui& other_two );
-   
-   /// Remove triangles which have been deleted
-   ///
-   void clear_deleted_triangles();
-      
-   // ---------------------------------------------------------
-   // Data members
-   
-   /// List of triangles: the fundamental data
-   ///
-   std::vector<Vec3ui> m_tris;
-   
-   /// Edges as vertex pairs
-   ///
-   std::vector<Vec2ui> m_edges;    
-   
-   /// Edges incident on vertices (given a vertex, which edges is it incident on)
-   ///
-   std::vector<std::vector<unsigned int> > m_vtxedge; 
-   
-   /// Ttriangles incident on vertices (given a vertex, which triangles is it incident on)
-   ///
-   std::vector<std::vector<unsigned int> > m_vtxtri;    
-   
-   /// Triangles incident on edges (given an edge, which triangles is it incident on)
-   ///
-   std::vector<std::vector<unsigned int> > m_edgetri;    
-   
-   /// Edges around triangles (given a triangle, which 3 edges does it contain)
-   ///
-   std::vector<Vec3ui> m_triedge;    
+    
+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 Vec3ui sort_triangle( const Vec3ui& t )
+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 Vec3ui( t[0], t[2], t[1] );
-         }
-      }
-      else
-      {
-         return Vec3ui( t[2], t[0], t[1] );
-      }
-   }
-   else
-   {
-      if ( t[1] < t[2] )
-      {
-         if ( t[0] < t[2] )
-         {
-            return Vec3ui( t[1], t[0], t[2] );
-         }
-         else
-         {
-            return Vec3ui( t[1], t[2], t[0] );
-         }
-      }
-      else
-      {
-         return Vec3ui( t[2], t[1], t[0] );
-      }
-   }
+    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] );
+        }
+    }
 }
 
 
@@ -167,51 +353,87 @@ inline Vec3ui sort_triangle( const Vec3ui& t )
 ///
 // --------------------------------------------------------
 
-inline unsigned int NonDestructiveTriMesh::get_third_vertex( unsigned int vertex0, unsigned int vertex1, const Vec3ui& triangle ) const
+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
 {
-   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];
-      }
-   }
-   
+    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
@@ -219,19 +441,19 @@ inline unsigned int NonDestructiveTriMesh::get_third_vertex( unsigned int vertex
 ///
 // --------------------------------------------------------
 
-inline bool NonDestructiveTriMesh::oriented( unsigned int vertex0, unsigned int vertex1, const Vec3ui& triangle )
+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) ) || 
+    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;
+    }
+    
+    return false;
 }
 
 // --------------------------------------------------------
@@ -240,16 +462,16 @@ inline bool NonDestructiveTriMesh::oriented( unsigned int vertex0, unsigned int
 ///
 // --------------------------------------------------------
 
-inline bool NonDestructiveTriMesh::triangle_has_these_verts( const Vec3ui& tri, const Vec3ui& verts )
+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] ) &&
+    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;
+    }
+    
+    return false;
 }
 
 // --------------------------------------------------------
@@ -258,34 +480,34 @@ inline bool NonDestructiveTriMesh::triangle_has_these_verts( const Vec3ui& tri,
 ///
 // --------------------------------------------------------
 
-inline unsigned int NonDestructiveTriMesh::index_in_triangle( const Vec3ui& tri, unsigned int v, Vec2ui& other_two )
+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] = ~0;
-   other_two[1] = ~0;
-   return ~0;
+    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);
 }
 
 
@@ -295,24 +517,162 @@ inline unsigned int NonDestructiveTriMesh::index_in_triangle( const Vec3ui& tri,
 ///
 // --------------------------------------------------------
 
-inline void NonDestructiveTriMesh::get_adjacent_triangles( unsigned int triangle_index, std::vector<unsigned int>& adjacent_triangles ) const
+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 )
 {
-   adjacent_triangles.clear();
-   
-   for ( unsigned int i = 0; i < 3; ++i )
-   {
-      unsigned int edge_index = m_triedge[triangle_index][i];
-
-      for ( unsigned int t = 0; t < m_edgetri[edge_index].size(); ++t )
-      {
-         if ( m_edgetri[edge_index][t] != triangle_index )
-         {  
-            adjacent_triangles.push_back( m_edgetri[edge_index][t] );
-         }
-      }
-   }
-   
+    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
index 5614a99..a6967fd 100644
--- a/extern/eltopo/eltopo3d/options.h
+++ b/extern/eltopo/eltopo3d/options.h
@@ -7,31 +7,17 @@
 //
 // ---------------------------------------------------------
 
-#ifndef OPTIONS_H
-#define OPTIONS_H
+#ifndef EL_TOPO_OPTIONS_H
+#define EL_TOPO_OPTIONS_H
 
-// ---------------------------------------------------------
-// Preproccessor defines
-// ---------------------------------------------------------
-
-// Whether to use an OpenGL GUI, or run command-line style
-// (Define NO_GUI in your build to suppress the GUI.)
-
-#ifndef NO_GUI
-#define USE_GUI
-#endif
-
-#ifndef NO_RAY_TRACER
-#define RAY_TRACER
-#endif
+#include <commonoptions.h>
 
 // ---------------------------------------------------------
 // Global constants
 // ---------------------------------------------------------
 
-const double UNINITIALIZED_DOUBLE = 0x0F;
+extern const double G_EIGENVALUE_RANK_RATIO;    // in surftrack.cpp
 
-extern const double G_EIGENVALUE_RANK_RATIO;    // in dynamicsurface.cpp
 
 #endif
 
diff --git a/extern/eltopo/eltopo3d/subdivisionscheme.cpp b/extern/eltopo/eltopo3d/subdivisionscheme.cpp
index 378cd96..d4b6f4f 100644
--- a/extern/eltopo/eltopo3d/subdivisionscheme.cpp
+++ b/extern/eltopo/eltopo3d/subdivisionscheme.cpp
@@ -12,7 +12,9 @@
 // ---------------------------------------------------------
 
 #include <subdivisionscheme.h>
-#include <dynamicsurface.h>
+
+#include <mat.h>
+#include <surftrack.h>
 
 // ---------------------------------------------------------
 // Global externs
@@ -36,14 +38,14 @@
 ///
 // --------------------------------------------------------
 
-void MidpointScheme::generate_new_midpoint( unsigned int edge_index, const DynamicSurface& surface, Vec3d& new_point )
+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.m_positions;
-   unsigned int p1_index = mesh.m_edges[edge_index][0];
-	unsigned int p2_index = mesh.m_edges[edge_index][1];   
-   
-   new_point = 0.5 * ( positions[ p1_index ] + positions[ p2_index ] );
+    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 ] );
 }
 
 
@@ -53,159 +55,160 @@ void MidpointScheme::generate_new_midpoint( unsigned int edge_index, const Dynam
 ///
 // --------------------------------------------------------
 
-void ButterflyScheme::generate_new_midpoint( unsigned int edge_index, const DynamicSurface& surface, Vec3d& new_point )
+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.m_positions;
-   
-   unsigned int p1_index = mesh.m_edges[edge_index][0];
-	unsigned int p2_index = mesh.m_edges[edge_index][1];
+    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];
 	
-   unsigned int tri0 = mesh.m_edgetri[edge_index][0];
-   unsigned int tri1 = mesh.m_edgetri[edge_index][1];
-   
-	unsigned int p3_index = mesh.get_third_vertex( mesh.m_edges[edge_index][0], mesh.m_edges[edge_index][1], mesh.m_tris[tri0] );
-	unsigned int p4_index = mesh.get_third_vertex( mesh.m_edges[edge_index][0], mesh.m_edges[edge_index][1], mesh.m_tris[tri1] );
+    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) );
 	
-	unsigned int adj_edges[4] = { mesh.get_edge( p1_index, p3_index ),
-      mesh.get_edge( p2_index, p3_index ),
-      mesh.get_edge( p1_index, p4_index ),
-      mesh.get_edge( p2_index, p4_index ) };
-   
-	unsigned int q_indices[4];
+	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 ( unsigned int i = 0; i < 4; ++i )
+	for ( size_t i = 0; i < 4; ++i )
 	{
-		const std::vector<unsigned int>& adj_tris = mesh.m_edgetri[ adj_edges[i] ];
+		const std::vector<size_t>& adj_tris = mesh.m_edge_to_triangle_map[ adj_edges[i] ];
 		if ( adj_tris.size() != 2 )
 		{
-         // abort
+            // abort
 			new_point = 0.5 * ( positions[ p1_index ] + positions[ p2_index ] );
-         return;
+            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.m_tris[ adj_tris[1] ] );
+			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.m_tris[ adj_tris[0] ] );
+			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] ];
-   
+    - 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( unsigned int edge_index, const DynamicSurface& surface, Vec3d& new_point )
+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.m_positions;
-
-   unsigned int v0 = mesh.m_edges[edge_index][0];
-   unsigned int v1 = mesh.m_edges[edge_index][1];
-   
-   Mat33d Q;
-   zero(Q);
-   Vec3d b;
-   zero(b);
-   
-   std::vector<unsigned int> triangles_counted;
-   
-   Mat<1,1,double> constant_dist;
-   constant_dist.a[0] = 0;
-   
-   for ( unsigned int i = 0; i < mesh.m_vtxtri[v0].size(); ++i )
-   {
-      unsigned int t = mesh.m_vtxtri[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 ( unsigned int i = 0; i < mesh.m_vtxtri[v1].size(); ++i )
-   {
-      unsigned int t = mesh.m_vtxtri[v1][i];
-      
-      bool already_counted = false;
-      for ( unsigned int 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] );
-      
+    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
index 7b834bc..dee15fa 100644
--- a/extern/eltopo/eltopo3d/subdivisionscheme.h
+++ b/extern/eltopo/eltopo3d/subdivisionscheme.h
@@ -7,8 +7,8 @@
 //
 // ---------------------------------------------------------
 
-#ifndef SUBDIVISIONSCHEME_H
-#define SUBDIVISIONSCHEME_H
+#ifndef EL_TOPO_SUBDIVISIONSCHEME_H
+#define EL_TOPO_SUBDIVISIONSCHEME_H
 
 // ---------------------------------------------------------
 // Nested includes
@@ -20,10 +20,11 @@
 //  Forwards and typedefs
 // ---------------------------------------------------------
 
-class DynamicSurface;
+class SurfTrack;
+class NonDestructiveTriMesh;
 
 // ---------------------------------------------------------
-//  Interface declarations
+//  Class definitions
 // ---------------------------------------------------------
 
 // --------------------------------------------------------
@@ -35,8 +36,13 @@ class DynamicSurface;
 class SubdivisionScheme
 {
 public:
-   virtual ~SubdivisionScheme() {}
-   virtual void generate_new_midpoint( unsigned int edge_index, const DynamicSurface& surface, Vec3d& new_point ) = 0;
+    
+    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;
+    
 };
 
 // --------------------------------------------------------
@@ -48,7 +54,11 @@ public:
 class MidpointScheme : public SubdivisionScheme
 {
 public:
-   void generate_new_midpoint( unsigned int edge_index, const DynamicSurface& surface, Vec3d& new_point );   
+    
+    /// Given an edge, compute the offset midpoint
+    ///
+    void generate_new_midpoint( size_t edge_index, const SurfTrack& surface, Vec3d& new_point );   
+    
 };
 
 // --------------------------------------------------------
@@ -59,10 +69,15 @@ public:
 
 class ButterflyScheme : public SubdivisionScheme
 {
-public:   
-   void generate_new_midpoint( unsigned int edge_index, const DynamicSurface& surface, Vec3d& new_point );
+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.
@@ -72,7 +87,11 @@ public:
 class QuadraticErrorMinScheme : public SubdivisionScheme
 {
 public:
-   void generate_new_midpoint( unsigned int edge_index, const DynamicSurface& surface, Vec3d& new_point );
+    
+    /// Given an edge, compute the offset midpoint
+    ///
+    void generate_new_midpoint( size_t edge_index, const SurfTrack& surface, Vec3d& new_point );
+    
 };
 
 
diff --git a/extern/eltopo/eltopo3d/surftrack.cpp b/extern/eltopo/eltopo3d/surftrack.cpp
index b1e53e0..ce82711 100644
--- a/extern/eltopo/eltopo3d/surftrack.cpp
+++ b/extern/eltopo/eltopo3d/surftrack.cpp
@@ -1,4 +1,3 @@
-
 // ---------------------------------------------------------
 //
 //  surftrack.cpp
@@ -16,90 +15,33 @@
 
 #include <surftrack.h>
 
-#include <vector>
-#include <queue>
-
-#ifdef USE_GUI
-#ifdef __APPLE__
-#include <OpenGL/gl.h>
-#include <GLUT/glut.h>
-#include <vecLib/clapack.h>
-#else
-#ifdef WIN32
-#include <windows.h>
-#endif
-#include <GL/gl.h>
-#include <GL/glut.h>
-#endif
-#endif
-
-#include <ccd_wrapper.h>
-#include <cassert>
-#include <vec.h>
 #include <array3.h>
-#include <nondestructivetrimesh.h>
-#include <lapack_wrapper.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 <gluvi.h>
+#include <stdio.h>
+#include <trianglequality.h>
+#include <vec.h>
+#include <vector>
 #include <wallclocktime.h>
 
-#include <cstdio>
-#include <cstdlib>
 
 // ---------------------------------------------------------
 //  Global externs
 // ---------------------------------------------------------
 
-// ---------------------------------------------------------
-// Local constants, typedefs, macros
-// ---------------------------------------------------------
-
-// ---------------------------------------------------------
-// Static function definitions
-// ---------------------------------------------------------
+const double G_EIGENVALUE_RANK_RATIO = 0.03;
 
-// ---------------------------------------------------------
-///
-/// Convert hue/sat/val to RGB.  Used to visualize data on the vertices.
-///
-// ---------------------------------------------------------
-/*
-static Vec3d hueToRGB(double hue, double sat, double val) 
-{
-   //compute hue (adapted from Wikipedia)
-   int Hi = (int)(floor(hue / 60.0f)) % 6;
-   double f = hue / 60 - Hi;
-   double p = val * (1 - sat);
-   double q = val * (1- f * sat);
-   double t = val * (1 - (1 - f) * sat);
-   Vec3d result; // r,g,b each in (0,1)
-   switch(Hi) {
-      case 0:
-         result = Vec3d(val, t, p);
-         break;
-      case 1:
-         result = Vec3d(q, val, p);
-         break;
-      case 2:
-         result = Vec3d(p, val, t);
-         break;
-      case 3:
-         result = Vec3d(p, q, val);
-         break;
-      case 4:
-         result = Vec3d(t, p, val);
-         break;
-      case 5:
-         result = Vec3d(val, p, q);
-         break;
-   }
-   
-   return result;
-}
-*/
+extern RunStats g_stats;
 
 // ---------------------------------------------------------
 //  Member function definitions
@@ -112,19 +54,28 @@ static Vec3d hueToRGB(double hue, double sat, double val)
 // ---------------------------------------------------------
 
 SurfTrackInitializationParameters::SurfTrackInitializationParameters() :
-   m_proximity_epsilon( 1e-4 ),
-   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_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_perform_improvement(true)
+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)
 {}
 
 
@@ -135,2052 +86,334 @@ SurfTrackInitializationParameters::SurfTrackInitializationParameters() :
 // ---------------------------------------------------------
 
 SurfTrack::SurfTrack( const std::vector<Vec3d>& vs, 
-                      const std::vector<Vec3ui>& ts, 
-                      const std::vector<double>& masses,
-                      const SurfTrackInitializationParameters& initial_parameters ) :
-
-   DynamicSurface( vs, 
-                   ts,
-                   masses,
-                   initial_parameters.m_proximity_epsilon, 
-                   initial_parameters.m_collision_safety ),
-
-   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_subdivision_scheme( initial_parameters.m_subdivision_scheme ),
-   m_dirty_triangles(0),   
-   m_allow_topology_changes( initial_parameters.m_allow_topology_changes ),
-   m_perform_improvement( initial_parameters.m_perform_improvement )
+                     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()
 {
-      
-   std::cout << "m_allow_topology_changes: " << m_allow_topology_changes << std::endl;
-   std::cout << "m_perform_improvement: " << m_perform_improvement << std::endl;
-   
-   m_mesh.update_connectivity( m_positions.size() );
-   m_verbose = true;
-   trim_non_manifold( );
-   m_verbose = false;
-   m_mesh.update_connectivity( m_positions.size() );
-   
-   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 );
-   
-   
-   double avg_length = DynamicSurface::get_average_non_solid_edge_length();   
-   std::cout << " %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% average edge length: " << avg_length << std::endl;
-   
-   if ( initial_parameters.m_use_fraction )
-   {      
-      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_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_subdivision_scheme == NULL )
-   {
-      m_subdivision_scheme = new MidpointScheme();
-      should_delete_subdivision_scheme_object = true;
-   }
-   else
-   {
-      should_delete_subdivision_scheme_object = false;
-   }
-      
-   rebuild_static_broad_phase();
-   
-}
-
-
-SurfTrack::~SurfTrack()
-{
-   if ( should_delete_subdivision_scheme_object )
-   {
-      delete m_subdivision_scheme;
-   }
+    
+    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;
+    }
+    
 }
 
 // ---------------------------------------------------------
 ///
-/// Display the surface in OpenGL using the specified options
+/// Destructor.  Deallocates the subdivision scheme object if we created one.
 ///
 // ---------------------------------------------------------
 
-#ifdef USE_GUI
-
-void SurfTrack::render( unsigned int options )
+SurfTrack::~SurfTrack()
 {
-   //
-   // edges
-   //
-   
-   glDisable(GL_LIGHTING);
-   glDepthFunc(GL_LEQUAL);
-   
-   if ( options & RENDER_EDGES )
-   {
-      glLineWidth(2);
-      glBegin(GL_LINES);
-      
-      for(unsigned int e = 0; e < m_mesh.m_edges.size(); e++)
-      {
-         if ( m_mesh.m_edgetri[e].size() < 2 )
-         {
-            glColor3d(1,0,0);
-         }
-         else
-         {
-            glColor3d(0,0,0);
-         }
-         
-         Vec2ui& edge = m_mesh.m_edges[e];
-         Vec3d& vtx0 = m_positions[edge[0]];
-         Vec3d& vtx1 = m_positions[edge[1]];
-         glVertex3d(vtx0[0], vtx0[1], vtx0[2]);
-         glVertex3d(vtx1[0], vtx1[1], vtx1[2]);
-      }
-      
-      glEnd(); 
-   }
-   
-   //
-   // vertices
-   //
-
-   if (options & RENDER_VERTEX_DATA)
-   {
-      glPointSize(5);
-      glBegin(GL_POINTS);
-      
-      for ( unsigned int v = 0; v < m_positions.size(); ++v )
-      {
-         if ( m_mesh.m_vtxtri[v].empty() )
-         {
-            continue;
-         }
-         
-         if ( m_masses[v] > 100.0 )
-         {
-            glColor3f( 1.0f, 0.0f, 0.0f );
-         }
-         else
-         {
-            glColor3f( 0.0f, 1.0f, 0.0f );
-         }
-                  
-         glVertex3dv( m_positions[v].v );      
-         
-      }
-      glEnd();
-   }   
-   
-   //
-   // triangles
-   //
-   
-   if ( options & RENDER_TRIANGLES )
-   {
-      if ( options & 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 ( options & NO_SHADING )
-      {
-         glDisable(GL_LIGHTING);
-         glColor3d(1,1,1);
-      }
-           
-      if ( options & 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(unsigned int i = 0; i < m_mesh.m_tris.size(); i++)
-      {
-         const Vec3ui& tri = m_mesh.m_tris[i];
-         
-         const Vec3d& v0 = m_positions[tri[0]];
-         const Vec3d& v1 = m_positions[tri[1]];
-         const Vec3d& v2 = m_positions[tri[2]];
-         
-         glNormal3dv( get_vertex_normal(tri[0]).v );
-         glVertex3d(v0[0], v0[1], v0[2]);
-
-         glNormal3dv( get_vertex_normal(tri[1]).v );
-         glVertex3d(v1[0], v1[1], v1[2]);
-         
-         glNormal3dv( get_vertex_normal(tri[2]).v );
-         glVertex3d(v2[0], v2[1], v2[2]);
-         
-      }
-      
-      glEnd();
-
-      
-      if ( options & RENDER_EDGES )
-      {
-         glDisable(GL_POLYGON_OFFSET_FILL);
-      }
-      
-      glDisable(GL_LIGHTING);
-      
-   }
-
+    if ( should_delete_subdivision_scheme_object )
+    {
+        delete m_subdivision_scheme;
+    }
 }
 
-#endif
 
 // ---------------------------------------------------------
 ///
-/// Ray cast into the scene, return index of the closest primitive of the type specified
+/// Add a triangle to the surface.  Update the underlying TriMesh and acceleration grid. 
 ///
 // ---------------------------------------------------------
 
-unsigned int SurfTrack::ray_cast( const Vec3f& ray_origin, 
-                                  const Vec3f& ray_direction, 
-                                  unsigned int primitive_type, 
-                                  unsigned int& hit_index )
-{
-
-   const double RAY_CAST_HIT_DISTANCE = 2e-2;
-
-   Vec3d rorigin( ray_origin[0], ray_origin[1], ray_origin[2] );
-   Vec3d rhead = rorigin + 100.0 * Vec3d( ray_direction[0], ray_direction[1], ray_direction[2] );
-   
-   unsigned int ray_origin_dummy_index = m_positions.size();
-   unsigned int ray_head_dummy_index = m_positions.size() + 1;
-   
-   Vec3d aabb_low, aabb_high;
-   minmax( rorigin, rhead, aabb_low, aabb_high );
-
-   if ( primitive_type == 0)
-   {
-      // -----------------------------------------------------------------
-      // Vertices
-      // -----------------------------------------------------------------
-
-      std::cout << "looking for vertices..." << std::endl;
-      
-      double vertex_min_parameter = 1e30;
-      unsigned int vertex_min_index = ~0;
-      
-      std::vector<unsigned int> overlapping_vertices;
-      m_broad_phase->get_potential_vertex_collisions( aabb_low, aabb_high, overlapping_vertices );
-      
-      std::cout << "potential vertices: " << overlapping_vertices.size() << std::endl;
-      
-      for ( unsigned int i = 0; i < overlapping_vertices.size(); ++i )
-      {
-         const Vec3d& v = m_positions[ overlapping_vertices[i] ];
-         
-         // initialized to silence compiler warnings
-         double distance = UNINITIALIZED_DOUBLE;       
-         double ray_parameter = UNINITIALIZED_DOUBLE;
-         Vec3d normal(UNINITIALIZED_DOUBLE, UNINITIALIZED_DOUBLE, UNINITIALIZED_DOUBLE);
-         double normal_multiplier = UNINITIALIZED_DOUBLE;
-         
-         point_segment_distance( false, 
-                                 v, overlapping_vertices[i], 
-                                 rhead, ray_head_dummy_index, 
-                                 rorigin, ray_origin_dummy_index, 
-                                 distance, ray_parameter, normal, normal_multiplier ); 
-         
-         if ( distance < RAY_CAST_HIT_DISTANCE )
-         {
-            if ( ray_parameter < vertex_min_parameter )
-            {
-               vertex_min_parameter = ray_parameter - RAY_CAST_HIT_DISTANCE;
-               vertex_min_index = overlapping_vertices[i];
-            }
-         }
-      }
-
-      if ( vertex_min_parameter < 1e30 )
-      {
-         hit_index = vertex_min_index;
-         return SurfTrack::RAY_HIT_VERTEX;
-      }
-      else
-      {
-         return SurfTrack::RAY_HIT_NOTHING;
-      }
-         
-   }
-   else if ( primitive_type == 1)
-   {
-         
-      // -----------------------------------------------------------------
-      // Edges
-      // -----------------------------------------------------------------
-      
-      double edge_min_distance = 1e30;
-      unsigned int edge_min_index = ~0;
-      
-      std::vector<unsigned int> overlapping_edges;
-      m_broad_phase->get_potential_edge_collisions( aabb_low, aabb_high, overlapping_edges );
-
-      for ( unsigned int i = 0; i < overlapping_edges.size(); ++i )
-      {
-         const Vec2ui& e = m_mesh.m_edges[ overlapping_edges[i] ];
-         const Vec3d& v0 = m_positions[ e[0] ];
-         const Vec3d& v1 = m_positions[ e[1] ];
-         
-         double distance;
-         double ray_parameter, edge_parameter;
-         Vec3d normal;
-         
-         segment_segment_distance( rhead, ray_head_dummy_index, 
-                                   rorigin, ray_origin_dummy_index,
-                                   v0, e[0], 
-                                   v1, e[1],
-                                   distance, ray_parameter, edge_parameter, normal );
-         
-         if ( distance < RAY_CAST_HIT_DISTANCE && edge_parameter > 0.0 && edge_parameter < 1.0 )
-         {
-            if ( distance < edge_min_distance )
-            {
-               edge_min_distance = distance; // - RAY_CAST_HIT_DISTANCE;
-               edge_min_index = overlapping_edges[i];
-            }
-         }         
-         
-      }
-      
-      if ( edge_min_distance < 1e30 )
-      {
-         hit_index = edge_min_index;
-         return SurfTrack::RAY_HIT_EDGE;
-      }
-      else
-      {
-         return SurfTrack::RAY_HIT_NOTHING;
-      }
-      
-      
-   }
-   else
-   {
-      // -----------------------------------------------------------------
-      // Triangles
-      // -----------------------------------------------------------------
-       
-      double triangle_min_parameter = 1e30;
-      unsigned int triangle_min_index = ~0;
-
-      std::vector<unsigned int> overlapping_triangles;
-      m_broad_phase->get_potential_triangle_collisions( aabb_low, aabb_high, overlapping_triangles );
-
-      for ( unsigned int i = 0; i < overlapping_triangles.size(); ++i )
-      {
-         const Vec3ui& tri = m_mesh.m_tris[ overlapping_triangles[i] ];
-      
-         Vec3ui t = sort_triangle( tri );
-         assert( t[0] < t[1] && t[0] < t[2] && t[1] < t[2] );
-         
-         const Vec3d& v0 = m_positions[ t[0] ];
-         const Vec3d& v1 = m_positions[ t[1] ];
-         const Vec3d& v2 = m_positions[ t[2] ];      
-         
-         double ray_parameter, s0, s1, s2, rel_disp;
-         Vec3d normal;
-         unsigned int dummy_index = m_positions.size();
-         
-         bool ray_hit = point_triangle_collision( rorigin, rhead, dummy_index, 
-                                                  v0, v0, t[0],
-                                                  v1, v1, t[1],
-                                                  v2, v2, t[2],   
-                                                  s0, s1, s2,
-                                                  normal, ray_parameter, rel_disp );
-
-         if ( ray_hit )
-         {
-            if ( ray_parameter < triangle_min_parameter )
-            {
-               triangle_min_parameter = ray_parameter;
-               triangle_min_index = overlapping_triangles[i];
-            }
-         }         
-      }
-      
-      if ( triangle_min_parameter < 1e30 )
-      {
-         hit_index = triangle_min_index;
-         return SurfTrack::RAY_HIT_TRIANGLE;
-      }
-      else
-      {
-         return SurfTrack::RAY_HIT_NOTHING;
-      }
-      
-   }
-   
-}
-
-
-// --------------------------------------------------------
-///
-/// Continuous collision detection between two triangles.  Duplicates collision detection, so 
-/// should be used rarely, and only when inconvenient to run edge-edge and point-tri tests individually.
-///
-// --------------------------------------------------------
-
-bool SurfTrack::check_triangle_vs_triangle_collision( const Vec3ui& triangle_a, const Vec3ui& triangle_b )
-{
-   // --------------------------------------------------------
-   // Point-triangle
-   // --------------------------------------------------------
-   
-   // one point from triangle_a vs triangle_b
-   
-   for ( unsigned int i = 0; i < 3; ++i )
-   {
-      unsigned int vertex_0 = triangle_a[i];
-      
-      Vec3ui tb = sort_triangle(triangle_b);
-      assert( tb[0] < tb[1] && tb[0] < tb[2] && tb[1] < tb[2] );
-
-      unsigned int vertex_1 = tb[0];
-      unsigned int vertex_2 = tb[1];
-      unsigned int vertex_3 = tb[2];
-      
-      if ( vertex_0 == vertex_1 || vertex_0 == vertex_2 || vertex_0 == vertex_3 )
-      {
-         continue;
-      }
-   
-      if ( point_triangle_collision(  m_positions[ vertex_0 ], m_newpositions[ vertex_0 ], vertex_0,
-                                      m_positions[ vertex_1 ], m_newpositions[ vertex_1 ], vertex_1, 
-                                      m_positions[ vertex_2 ], m_newpositions[ vertex_2 ], vertex_2,
-                                      m_positions[ vertex_3 ], m_newpositions[ vertex_3 ], vertex_3 ) )
-         
-      {
-         return true;
-      }
-   }
-   
-   // one point from triangle_b vs triangle_a
-   
-   for ( unsigned int i = 0; i < 3; ++i )
-   {
-      unsigned int vertex_0 = triangle_b[i];
-      
-      Vec3ui ta = sort_triangle(triangle_a);
-      assert( ta[0] < ta[1] && ta[0] < ta[2] && ta[1] < ta[2] );
-      
-      unsigned int vertex_1 = ta[0];
-      unsigned int vertex_2 = ta[1];
-      unsigned int vertex_3 = ta[2];
-            
-      if ( vertex_0 == vertex_1 || vertex_0 == vertex_2 || vertex_0 == vertex_3 )
-      {
-         continue;
-      }
-      
-      if ( point_triangle_collision(  m_positions[ vertex_0 ], m_newpositions[ vertex_0 ], vertex_0,
-                                      m_positions[ vertex_1 ], m_newpositions[ vertex_1 ], vertex_1,
-                                      m_positions[ vertex_2 ], m_newpositions[ vertex_2 ], vertex_2,
-                                      m_positions[ vertex_3 ], m_newpositions[ vertex_3 ], vertex_3 ) )
-      {
-         return true;
-      }
-   }
-   
-   
-   // --------------------------------------------------------
-   // edge-edge
-   // --------------------------------------------------------
-   
-   static const unsigned int i_plus_one[3] = { 1, 2, 0 };      // avoid (i+1) % 3
-   
-   for ( unsigned i = 0; i < 3; ++i )
-   {
-      // one edge
-      unsigned int vertex_0 = triangle_a[i];
-      unsigned int vertex_1 = triangle_a[ i_plus_one[i] ];
-      
-      for ( unsigned j = 0; j < 3; ++j )
-      {
-         // another edge
-         unsigned int vertex_2 = triangle_b[j];
-         unsigned int vertex_3 = triangle_b[ i_plus_one[j] ];
-         
-         if ( vertex_0 == vertex_2 || vertex_0 == vertex_3 || vertex_1 == vertex_2 || vertex_1 == vertex_3 )
-         {
-            continue;
-         }
-
-         if ( vertex_1 < vertex_0 ) { swap( vertex_0, vertex_1 ); }
-         if ( vertex_3 < vertex_2 ) { swap( vertex_2, vertex_3 ); }
-         
-         if ( segment_segment_collision(  m_positions[ vertex_0 ], m_newpositions[ vertex_0 ], vertex_0, 
-                                          m_positions[ vertex_1 ], m_newpositions[ vertex_1 ], vertex_1,
-                                          m_positions[ vertex_2 ], m_newpositions[ vertex_2 ], vertex_2,
-                                          m_positions[ vertex_3 ], m_newpositions[ vertex_3 ], vertex_3 ) )               
-         {
-            return true;
-         }
-      }
-   }
-   
-   return false;
-}
-
-
-// ========================================================
-// Edge splitting functions
-// ========================================================
-
-// --------------------------------------------------------
-///
-/// Check if the "pseudo motion" of moving new_vertex_position to new_vertex_smooth_position introduces any intersections
-///
-// --------------------------------------------------------
-
-bool SurfTrack::split_edge_pseudo_motion_introduces_collision( const Vec3d& new_vertex_position, 
-                                                               const Vec3d& new_vertex_smooth_position, 
-                                                               unsigned int edge,
-                                                               unsigned int tri0, 
-                                                               unsigned int tri1, 
-                                                               unsigned int vertex_a,
-                                                               unsigned int vertex_b,
-                                                               unsigned int vertex_c,
-                                                               unsigned int vertex_d )
+size_t SurfTrack::add_triangle( const Vec3st& t )
 {
-
-   if ( !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_proximity_epsilon * Vec3d(1,1,1);
-      aabb_high += m_proximity_epsilon * Vec3d(1,1,1);
-         
-      std::vector<unsigned int> overlapping_triangles;
-      m_broad_phase->get_potential_triangle_collisions( aabb_low, aabb_high, overlapping_triangles );
-      
-      for ( unsigned int i = 0; i < overlapping_triangles.size(); ++i )
-      {
-         
-         if ( overlapping_triangles[i] == tri0 || overlapping_triangles[i] == tri1 )
-         {
-            continue;
-         }
-         
-         unsigned int triangle_vertex_0 = m_mesh.m_tris[ overlapping_triangles[i] ][0];
-         unsigned int triangle_vertex_1 = m_mesh.m_tris[ overlapping_triangles[i] ][1];
-         unsigned int triangle_vertex_2 = m_mesh.m_tris[ overlapping_triangles[i] ][2];
-         
-         double t_zero_distance;
-         unsigned int dummy_index = m_positions.size();
-         point_triangle_distance( new_vertex_position, dummy_index, 
-                                  m_positions[ triangle_vertex_0 ], triangle_vertex_0,
-                                  m_positions[ triangle_vertex_1 ], triangle_vertex_1,
-                                  m_positions[ triangle_vertex_2 ], triangle_vertex_2,
-                                  t_zero_distance );
-         
-         if ( t_zero_distance < m_improve_collision_epsilon )
-         {
-            return true;
-         }
-
-         Vec3ui sorted_triangle = sort_triangle( Vec3ui( triangle_vertex_0, triangle_vertex_1, triangle_vertex_2 ) );
-         
-         
-         if ( point_triangle_collision(  new_vertex_position, new_vertex_smooth_position, dummy_index,
-                                         m_positions[ sorted_triangle[0] ], m_positions[ sorted_triangle[0] ], sorted_triangle[0],
-                                         m_positions[ sorted_triangle[1] ], m_positions[ sorted_triangle[1] ], sorted_triangle[1],
-                                         m_positions[ sorted_triangle[2] ], m_positions[ 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_positions[ vertex_a ], m_positions[ vertex_b ], m_positions[ vertex_c ], m_positions[ vertex_d ],
-              edge_aabb_low, edge_aabb_high );
-      
-      edge_aabb_low -= m_proximity_epsilon * Vec3d(1,1,1);
-      edge_aabb_high += m_proximity_epsilon * Vec3d(1,1,1);
-
-      std::vector<unsigned int> overlapping_edges;
-      m_broad_phase->get_potential_edge_collisions( edge_aabb_low, edge_aabb_high, overlapping_edges );
-      
-      for ( unsigned int 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; }
-         
-         unsigned int edge_vertex_0 = m_mesh.m_edges[ overlapping_edges[i] ][0];
-         unsigned int edge_vertex_1 = m_mesh.m_edges[ overlapping_edges[i] ][1];
-         unsigned int dummy_index = m_positions.size();
-         
-         if ( vertex_a != edge_vertex_0 && vertex_a != edge_vertex_1 ) 
-         {
-            double t_zero_distance;   
-            segment_segment_distance( new_vertex_position, dummy_index,
-                                      m_positions[ vertex_a ], vertex_a, 
-                                      m_positions[ edge_vertex_0 ], edge_vertex_0,
-                                      m_positions[ edge_vertex_1 ], edge_vertex_1,
-                                      t_zero_distance );
-            
-            if ( t_zero_distance < m_improve_collision_epsilon )
-            {
-               return true;
-            }
-
-            if ( edge_vertex_1 < edge_vertex_0 ) { swap( edge_vertex_0, edge_vertex_1 ); }
-
-            if ( segment_segment_collision( m_positions[ vertex_a ], m_positions[ vertex_a ], vertex_a,
-                                            new_vertex_position, new_vertex_smooth_position, dummy_index,
-                                            m_positions[ edge_vertex_0 ], m_positions[ edge_vertex_0 ], edge_vertex_0,
-                                            m_positions[ edge_vertex_1 ], m_positions[ edge_vertex_1 ], edge_vertex_1 ) )
-                  
-            {      
-               return true;
-            }
-         }
-         
-         if ( vertex_b != edge_vertex_0 && vertex_b != edge_vertex_1 ) 
-         {
-            double t_zero_distance;
-            segment_segment_distance( new_vertex_position, dummy_index,
-                                      m_positions[ vertex_b ], vertex_b,
-                                      m_positions[ edge_vertex_0 ], edge_vertex_0,
-                                      m_positions[ edge_vertex_1 ], edge_vertex_1,
-                                      t_zero_distance );
-            
-            if ( t_zero_distance < m_improve_collision_epsilon )
-            {
-               return true;
-            }
-
-            if ( edge_vertex_1 < edge_vertex_0 ) { swap( edge_vertex_0, edge_vertex_1 ); }
-                        
-            if ( segment_segment_collision( m_positions[ vertex_b ], m_positions[ vertex_b ], vertex_b, 
-                                            new_vertex_position, new_vertex_smooth_position, dummy_index,
-                                            m_positions[ edge_vertex_0 ], m_positions[ edge_vertex_0 ], edge_vertex_0,
-                                            m_positions[ edge_vertex_1 ], m_positions[ edge_vertex_1 ], edge_vertex_1 ) )
-                  
-            {          
-               return true;
-            }
-         }
-         
-         if ( vertex_c != edge_vertex_0 && vertex_c != edge_vertex_1 ) 
-         {
-            double t_zero_distance;
-            segment_segment_distance( new_vertex_position, dummy_index,
-                                      m_positions[ vertex_c ], vertex_c,
-                                      m_positions[ edge_vertex_0 ], edge_vertex_0,
-                                      m_positions[ edge_vertex_1 ], edge_vertex_1,
-                                      t_zero_distance );
-            
-            if ( t_zero_distance < m_improve_collision_epsilon )
-            {
-               return true;
-            }
-            
-            if ( edge_vertex_1 < edge_vertex_0 ) { swap( edge_vertex_0, edge_vertex_1 ); }
-            
-            if ( segment_segment_collision( m_positions[ vertex_c ], m_positions[ vertex_c ], vertex_c,
-                                            new_vertex_position, new_vertex_smooth_position, dummy_index, 
-                                            m_positions[ edge_vertex_0 ], m_positions[ edge_vertex_0 ], edge_vertex_0,
-                                            m_positions[ edge_vertex_1 ], m_positions[ edge_vertex_1 ], edge_vertex_1 ) )
-            {         
-               return true;
-            }
-         }
-         
-         if ( vertex_d != edge_vertex_0 && vertex_d != edge_vertex_1 ) 
-         {
-            double t_zero_distance;
-            segment_segment_distance( new_vertex_position, dummy_index,
-                                      m_positions[ vertex_d ], vertex_d,
-                                      m_positions[ edge_vertex_0 ], edge_vertex_0,
-                                      m_positions[ edge_vertex_1 ], edge_vertex_1,
-                                      t_zero_distance );
-            
-            if ( t_zero_distance < m_improve_collision_epsilon )
-            {
-               return true;
-            }
-            
-            if ( edge_vertex_1 < edge_vertex_0 ) { swap( edge_vertex_0, edge_vertex_1 ); }
-            
-            if ( segment_segment_collision( m_positions[ vertex_d ], m_positions[ vertex_d ], vertex_d,
-                                            new_vertex_position, new_vertex_smooth_position, dummy_index,
-                                            m_positions[ edge_vertex_0 ], m_positions[ edge_vertex_0 ], edge_vertex_0,
-                                            m_positions[ edge_vertex_1 ], m_positions[ edge_vertex_1 ], edge_vertex_1 ) )
-            {         
-               return true;
-            }
-         }	
-      }
-      
-   }
-  
-   // new triangle 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_positions[ vertex_a ], m_positions[ vertex_b ], m_positions[ vertex_c ], m_positions[ vertex_d ],
-              triangle_aabb_low, triangle_aabb_high );
-      
-      triangle_aabb_low -= m_proximity_epsilon * Vec3d(1,1,1);
-      triangle_aabb_high += m_proximity_epsilon * Vec3d(1,1,1);
-      
-      std::vector<unsigned int> overlapping_vertices;
-      m_broad_phase->get_potential_vertex_collisions( triangle_aabb_low, triangle_aabb_high, overlapping_vertices );
-            
-      const Vec3d& position_a = m_positions[vertex_a];
-      const Vec3d& position_b = m_positions[vertex_b];
-      const Vec3d& position_c = m_positions[vertex_c];
-      const Vec3d& position_d = m_positions[vertex_d];
-      const Vec3d& position_e = new_vertex_position;
-      const Vec3d& newposition_e = new_vertex_smooth_position;
-      unsigned int dummy_e = m_positions.size();
-      
-      for ( unsigned int i = 0; i < overlapping_vertices.size(); ++i )
-      {
-         
-         if ( m_mesh.m_vtxtri[overlapping_vertices[i]].empty() ) { continue; }
-
-         unsigned int overlapping_vert_index = overlapping_vertices[i];
-         const Vec3d& vert = m_positions[overlapping_vert_index];
-         
-         // triangle aec
-         if ( overlapping_vertices[i] != vertex_a && overlapping_vertices[i] != vertex_c )
-         {
-            double t_zero_distance;
-            point_triangle_distance( vert, overlapping_vert_index, position_a, vertex_a, position_e, dummy_e, position_c, vertex_c, t_zero_distance );
-            if ( t_zero_distance < m_improve_collision_epsilon )
-            {
-               return true;
-            }
-            
-            if ( vertex_a < vertex_c )
-            {
-               if ( point_triangle_collision( vert, vert, overlapping_vert_index,
-                                              position_a, position_a, vertex_a,
-                                              position_c, position_c, vertex_c,
-                                              position_e, newposition_e, dummy_e ) )
-               {         
-                  return true;
-               }
-            }
-            else
-            {
-               if ( point_triangle_collision( vert, vert, overlapping_vert_index,
-                                              position_c, position_c, vertex_c,
-                                              position_a, position_a, vertex_a,
-                                              position_e, newposition_e, dummy_e ) )
-               {         
-                  return true;
-               }
-            }               
-         }
-
-         // triangle ceb
-         if ( overlapping_vertices[i] != vertex_c && overlapping_vertices[i] != vertex_b )
-         {
-            double t_zero_distance;
-            point_triangle_distance( vert, overlapping_vert_index, 
-                                     position_c, vertex_c,
-                                     position_e, dummy_e,
-                                     position_b, vertex_b, 
-                                     t_zero_distance );
-            
-            if ( t_zero_distance < m_improve_collision_epsilon )
-            {
-               return true;
-            }
-            
-            if ( vertex_b < vertex_c )
-            {
-               if ( point_triangle_collision( vert, vert, overlapping_vert_index,
-                                              position_b, position_b, vertex_b,
-                                              position_c, position_c, vertex_c,
-                                              position_e, newposition_e, dummy_e ) )
-               {        
-                  return true;
-               }
-            }
-            else
-            {
-               if ( point_triangle_collision( vert, vert, overlapping_vert_index,
-                                              position_c, position_c, vertex_c,
-                                              position_b, position_b, vertex_b,
-                                              position_e, newposition_e, dummy_e ) )
-               {        
-                  return true;
-               }               
-            }
-         }
-
-         // triangle dbe
-         if ( overlapping_vertices[i] != vertex_d && overlapping_vertices[i] != vertex_b )
-         {
-            double t_zero_distance;
-            point_triangle_distance( vert, overlapping_vert_index, 
-                                     position_d, vertex_d,
-                                     position_b, vertex_b, 
-                                     position_e, dummy_e,
-                                     t_zero_distance );
-            
-            if ( t_zero_distance < m_improve_collision_epsilon )
-            {
-               return true;
-            }
-   
-            if ( vertex_b < vertex_d )
-            {
-               if ( point_triangle_collision( vert, vert, overlapping_vert_index,
-                                             position_b, position_b, vertex_b,
-                                             position_d, position_d, vertex_d,
-                                             position_e, newposition_e, dummy_e ) )
-               {        
-                  return true;
-               }
-            }
-            else
-            {
-               if ( point_triangle_collision( vert, vert, overlapping_vert_index,
-                                             position_d, position_d, vertex_d,
-                                             position_b, position_b, vertex_b,
-                                             position_e, newposition_e, dummy_e ) )
-               {        
-                  return true;
-               }               
-            }
-         }
-
-         // triangle dea
-         if ( overlapping_vertices[i] != vertex_d && overlapping_vertices[i] != vertex_a )
-         {
-            double t_zero_distance;
-            point_triangle_distance( vert, overlapping_vert_index,
-                                     position_d, vertex_d,
-                                     position_e, dummy_e,
-                                     position_a, vertex_a,
-                                     t_zero_distance );
-            
-            if ( t_zero_distance < m_improve_collision_epsilon )
-            {
-               return true;
-            }
-            
-            if ( vertex_a < vertex_d )
-            {
-               if ( point_triangle_collision( vert, vert, overlapping_vert_index,
-                                             position_a, position_a, vertex_a,
-                                             position_d, position_d, vertex_d,
-                                             position_e, newposition_e, dummy_e ) )
-               {        
-                  return true;
-               }
-            }
-            else
-            {
-               if ( point_triangle_collision( vert, vert, overlapping_vert_index,
-                                             position_d, position_d, vertex_d,
-                                             position_a, position_a, vertex_a,
-                                             position_e, newposition_e, dummy_e ) )
-               {        
-                  return true;
-               }               
-            }
-         }
-         
-      }
-   }
-   
-   return false;
-   
-}
-
-                                                
-// --------------------------------------------------------
-///
-/// Split an edge, using subdivision_scheme to determine the new vertex location, if safe to do so.
-///
-// --------------------------------------------------------
-
-bool SurfTrack::split_edge( unsigned int edge )
-{
-   Vec2ui original_edge = m_mesh.m_edges[edge];
-      
-   // --------------
-   
-   // Only split edges inicident on 2 triangles
-   if ( m_mesh.m_edgetri[edge].size() != 2 )
-   {
-      return false;
-   }
-
-   // --------------
-   
-   unsigned int tri0 = m_mesh.m_edgetri[edge][0];
-   unsigned int tri1 = m_mesh.m_edgetri[edge][1];
-   double area0 = get_triangle_area( tri0 );
-   double area1 = get_triangle_area( tri1 );
-   
-   // Splitting degenerate triangles causes problems
-   if ( area0 < m_min_triangle_area || area1 < m_min_triangle_area )
-   {
-      return false;
-   }
-
-   // --------------
-
-   // convert triangles abc and dba into triangles aec, ceb, dbe and dea
-   
-   unsigned int vertex_a = m_mesh.m_edges[edge][0];
-   unsigned int vertex_b = m_mesh.m_edges[edge][1];
-   unsigned int vertex_c, vertex_d;
-   
-   if ( m_mesh.oriented( vertex_a, vertex_b, m_mesh.m_tris[tri0] ) )
-   {
-      // tri0 = abc
-		assert( m_mesh.oriented( vertex_b, vertex_a, m_mesh.m_tris[tri1] ) );
-      vertex_c = m_mesh.get_third_vertex( vertex_a, vertex_b, m_mesh.m_tris[tri0] );      
-      vertex_d = m_mesh.get_third_vertex( vertex_b, vertex_a, m_mesh.m_tris[tri1] );
-   }
-   else
-   {
-      // tri1 = abc
-      assert( m_mesh.oriented( vertex_a, vertex_b, m_mesh.m_tris[tri1] ) );
-      assert( m_mesh.oriented( vertex_b, vertex_a, m_mesh.m_tris[tri0] ) );
-      vertex_c = m_mesh.get_third_vertex( vertex_a, vertex_b, m_mesh.m_tris[tri1] );
-      vertex_d = m_mesh.get_third_vertex( vertex_b, vertex_a, m_mesh.m_tris[tri0] );
-   }
-   
-   Vec3d new_vertex_position = 0.5 * ( m_positions[ vertex_a ] + m_positions[ vertex_b ] );
-   Vec3d new_vertex_smooth_position;
-   
-   // generate the new midpoint according to the subdivision scheme
-   m_subdivision_scheme->generate_new_midpoint( edge, *this, new_vertex_smooth_position );
-
-   // --------------
-
-   // check if the generated point introduces an intersection
-   
-   bool use_smooth_point = ! ( split_edge_pseudo_motion_introduces_collision( new_vertex_position, 
-                                                                              new_vertex_smooth_position, 
-                                                                              edge, 
-                                                                              tri0, 
-                                                                              tri1, 
-                                                                              vertex_a, 
-                                                                              vertex_b, 
-                                                                              vertex_c, 
-                                                                              vertex_d ) );
-      
-   // --------------
-   
-   // check normal inversion
-   if ( use_smooth_point )
-   {
-      Vec3d tri0_normal = get_triangle_normal( tri0 );
-      Vec3d tri1_normal = get_triangle_normal( tri1 );
-      if ( dot( tri0_normal, tri1_normal ) >= 0.0 )
-      {
-         Vec3d new_normal = triangle_normal( m_positions[vertex_a], new_vertex_smooth_position, m_positions[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_positions[vertex_c], new_vertex_smooth_position, m_positions[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_positions[vertex_d], m_positions[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_positions[vertex_d], new_vertex_smooth_position, m_positions[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_verbose ) { printf( "not using smooth subdivision\n" ); }
-      new_vertex_smooth_position = new_vertex_position;
-      
-      if ( split_edge_pseudo_motion_introduces_collision( new_vertex_position, 
-                                                          new_vertex_smooth_position, 
-                                                          edge, 
-                                                          tri0, 
-                                                          tri1, 
-                                                          vertex_a, 
-                                                          vertex_b, 
-                                                          vertex_c, 
-                                                          vertex_d ) )
-      {
-         if ( m_verbose )  { std::cout << "Even mid-point subdivision introduces collision.  Backing out." << std::endl; }
-         return false;
-      }
-   }
- 	else
-   {
-      if ( m_verbose ) { printf( "using smooth subdivision\n" ); }
-   }
-   
-   // --------------
-   
-   // Do the actual splitting
-   
-   Vec3d new_vertex_velocity = 0.5 * ( m_velocities[ vertex_a ] + m_velocities[ vertex_b ] );
-         
-   double new_vertex_mass = min( m_masses[ vertex_a ], m_masses[ vertex_b ] );
-   unsigned int vertex_e = add_vertex( new_vertex_smooth_position, new_vertex_velocity, new_vertex_mass );
-   
-   if ( m_verbose ) std::cout << "new vertex: " << vertex_e << std::endl;
-   
-   remove_triangle( tri0 );
-   remove_triangle( tri1 );
-
-   unsigned int new_triangle_index = add_triangle( Vec3ui( vertex_a, vertex_e, vertex_c ) );
-   new_triangle_index = add_triangle( Vec3ui( vertex_c, vertex_e, vertex_b ) );
-   new_triangle_index = add_triangle( Vec3ui( vertex_d, vertex_b, vertex_e ) );
-   new_triangle_index = add_triangle( Vec3ui( vertex_d, vertex_e, vertex_a ) );      
-   
-   return true;
-   
-}
-
-
-// ========================================================
-// Edge collapse functions
-// ========================================================
-
-// --------------------------------------------------------
-///
-/// Check the "pseudo motion" introduced by a collapsing edge for collision
-///
-// --------------------------------------------------------
-
-bool SurfTrack::collapse_edge_pseudo_motion_introduces_collision( unsigned int source_vertex, 
-                                                                  unsigned int destination_vertex, 
-                                                                  unsigned int edge_index, 
-                                                                  const Vec3d& vertex_new_position )
-{
-   if ( !m_collision_safety )
-   {
-      return false;
-   }
-   
-   assert( m_newpositions.size() > 0 );
-     
-   // Change source vertex predicted position to superimpose onto dest vertex
-   m_newpositions[source_vertex] = vertex_new_position;
-   m_newpositions[destination_vertex] = vertex_new_position;
-   
-   update_continuous_broad_phase( source_vertex );
-   update_continuous_broad_phase( destination_vertex );
-   
-   // Get the set of triangles which are going to be deleted
-   std::vector< unsigned int >& triangles_incident_to_edge = m_mesh.m_edgetri[edge_index];   
-
-   // Get the set of triangles which move because of this motion
-   std::vector<unsigned int> moving_triangles;
-   for ( unsigned int i = 0; i < m_mesh.m_vtxtri[source_vertex].size(); ++i )
-   {
-      moving_triangles.push_back( m_mesh.m_vtxtri[source_vertex][i] );
-   }
-   for ( unsigned int i = 0; i < m_mesh.m_vtxtri[destination_vertex].size(); ++i )
-   {
-      moving_triangles.push_back( m_mesh.m_vtxtri[destination_vertex][i] );
-   }
-   
-   // Check this set of triangles for collisions, holding everything else static
-		
-   for ( unsigned int 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 ( unsigned int 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 Vec3ui& current_triangle = m_mesh.m_tris[ moving_triangles[i] ];
-      
-      if ( m_collision_safety )
-      {
-         // Test the triangle vs all other triangles
-         Vec3d aabb_low, aabb_high;
-         minmax( m_positions[ current_triangle[0] ], m_positions[ current_triangle[1] ], m_positions[ current_triangle[2] ], 
-                 m_newpositions[ current_triangle[0] ], m_newpositions[ current_triangle[1] ], m_newpositions[ current_triangle[2] ], 
-                 aabb_low, aabb_high );
-
-         std::vector<unsigned int> overlapping_triangles;
-         m_broad_phase->get_potential_triangle_collisions( aabb_low, aabb_high, overlapping_triangles );
-         
-         for ( unsigned j=0; j < overlapping_triangles.size(); ++j )
-         {
-            // Don't check against triangles which are incident to the dest vertex
-            bool triangle_incident_to_dest = false;
-            for ( unsigned int k = 0; k < moving_triangles.size(); ++k )
-            {
-               if ( moving_triangles[k] == overlapping_triangles[j] )
-               {
-                  triangle_incident_to_dest = true;
-                  break;
-               }
-            }
-            if ( triangle_incident_to_dest )    { continue; }
-            
-            if ( check_triangle_vs_triangle_collision( current_triangle, m_mesh.m_tris[ overlapping_triangles[j] ] ) )
-            {
-               if ( m_verbose ) { printf( "collapse edge not collision-safe\n" ); }
-               return true;
-            }
-         }
-      }
-      
-   }
-
-   return false;
-   
-}
-
-
-// --------------------------------------------------------
-///
-/// 
-///
-// --------------------------------------------------------
-
-bool SurfTrack::collapse_edge_introduces_normal_inversion( unsigned int source_vertex, 
-                                                           unsigned int destination_vertex, 
-                                                           unsigned int edge_index, 
-                                                           const Vec3d& vertex_new_position )
-{
-   
-   assert( m_newpositions.size() > 0 );
-   
-   // Change source vertex predicted position to superimpose onto dest vertex
-   m_newpositions[source_vertex] = vertex_new_position;
-   m_newpositions[destination_vertex] = vertex_new_position;
-   
-   // Get the set of triangles which are going to be deleted
-   std::vector< unsigned int >& triangles_incident_to_edge = m_mesh.m_edgetri[edge_index];   
-   
-   // Get the set of triangles which move because of this motion
-   std::vector<unsigned int> moving_triangles;
-   for ( unsigned int i = 0; i < m_mesh.m_vtxtri[source_vertex].size(); ++i )
-   {
-      moving_triangles.push_back( m_mesh.m_vtxtri[source_vertex][i] );
-   }
-   for ( unsigned int i = 0; i < m_mesh.m_vtxtri[destination_vertex].size(); ++i )
-   {
-      moving_triangles.push_back( m_mesh.m_vtxtri[destination_vertex][i] );
-   }
-
-   //
-   // check for normal inversion
-   //
-   
-   for ( unsigned int 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 ( unsigned int 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 Vec3ui& current_triangle = m_mesh.m_tris[ moving_triangles[i] ];
-      Vec3d old_normal = 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_positions[current_triangle[1]], m_positions[current_triangle[2]] ); 
-         new_area = triangle_area( vertex_new_position, m_positions[current_triangle[1]], m_positions[current_triangle[2]] ); 
-      }
-      else if ( current_triangle[1] == source_vertex || current_triangle[1] == destination_vertex ) 
-      { 
-         new_normal = triangle_normal( m_positions[current_triangle[0]], vertex_new_position, m_positions[current_triangle[2]] ); 
-         new_area = triangle_area( m_positions[current_triangle[0]], vertex_new_position, m_positions[current_triangle[2]] ); 
-      }
-      else 
-      { 
-         assert( current_triangle[2] == source_vertex || current_triangle[2] == destination_vertex ); 
-         new_normal = triangle_normal( m_positions[current_triangle[0]], m_positions[current_triangle[1]], vertex_new_position );
-         new_area = triangle_area( m_positions[current_triangle[0]], m_positions[current_triangle[1]], vertex_new_position );
-      }      
-     
-      if ( dot( new_normal, old_normal ) < 0.0 )
-      {
-         if ( m_verbose ) { printf( "collapse edge introduces normal inversion\n" ); }
-         return true;
-      } 
-      
-      if ( new_area < m_min_triangle_area * m_min_triangle_area )
-      {
-         if ( m_verbose ) { printf( "collapse edge introduces tiny triangle area\n" ); }
-         return true;
-      }         
-   }
-
-   return false;
-   
+    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;
 }
 
 
-// --------------------------------------------------------
+// ---------------------------------------------------------
 ///
-/// Determine wether collapsing an edge will introduce an unacceptable change in volume.
+/// Remove a triangle from the surface.  Update the underlying TriMesh and acceleration grid. 
 ///
-// --------------------------------------------------------
+// ---------------------------------------------------------
 
-bool SurfTrack::collapse_edge_introduces_volume_change( unsigned int source_vertex, 
-                                                        unsigned int edge_index, 
-                                                        const Vec3d& vertex_new_position )
+void SurfTrack::remove_triangle(size_t t)
 {
-   //
-   // If any incident triangle has a tiny area, collapse the edge without regard to volume change
-   //
-
-   const std::vector<unsigned int>& inc_tris = m_mesh.m_edgetri[edge_index];
-   
-   for ( unsigned int i = 0; i < inc_tris.size(); ++i )
-   {
-      if ( get_triangle_area( inc_tris[i] ) < m_min_triangle_area )
-      {
-         return false;
-      }
-   }
-
-   //
-   // Check volume change
-   //
-
-   const std::vector< unsigned int >& triangles_incident_to_vertex = m_mesh.m_vtxtri[source_vertex];
-   double volume_change = 0;
-
-   for ( unsigned int i = 0; i < triangles_incident_to_vertex.size(); ++i )
-   {
-      Vec3ui& inc_tri = m_mesh.m_tris[ triangles_incident_to_vertex[i] ];
-      volume_change += tetrahedron_signed_volume( vertex_new_position, m_positions[inc_tri[0]], m_positions[inc_tri[1]], m_positions[inc_tri[2]] );
-   }
-
-   if ( fabs(volume_change) > m_max_volume_change )
-   {
-      if ( m_verbose ) { printf( "collapse edge introduces volume change\n" ); }
-      return true;
-   }
-   
-   return false;
-
+    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) ) );
+    
 }
 
-
-// --------------------------------------------------------
+// ---------------------------------------------------------
 ///
-/// Delete an edge by moving its source vertex to its destination vertex
+/// Add a vertex to the surface.  Update the acceleration grid. 
 ///
-// --------------------------------------------------------
+// ---------------------------------------------------------
 
-bool SurfTrack::collapse_edge( unsigned int edge )
+size_t SurfTrack::add_vertex( const Vec3d& new_vertex_position, double new_vertex_mass )
 {
-
-   unsigned int vertex_to_keep = m_mesh.m_edges[edge][0];
-   unsigned int vertex_to_delete = m_mesh.m_edges[edge][1];
-     
-   Vec3d vertex_new_position;
-   
-   
-   // --------------
-   
-   // rank 1, 2, 3 = smooth, ridge, peak
-   // if the vertex ranks don't match, keep the higher rank vertex
-   
-   if ( classify_vertex( vertex_to_keep ) > classify_vertex( vertex_to_delete ) )
-   {
-      vertex_new_position = m_positions[vertex_to_keep];
-   }
-   else if ( classify_vertex( vertex_to_delete ) > classify_vertex( vertex_to_keep ) )
-   {
-      unsigned int tmp = vertex_to_delete;
-      vertex_to_delete = vertex_to_keep;
-      vertex_to_keep = tmp;
-      
-      vertex_new_position = m_positions[vertex_to_keep];
-   }
-   else
-   {
-      // ranks are equal
-      m_subdivision_scheme->generate_new_midpoint( edge, *this, vertex_new_position );
-   }
-
-   if ( m_verbose ) { printf( "Collapsing edge.  Doomed vertex: %d --- Vertex to keep: %d \n", vertex_to_delete, vertex_to_keep ); }
-   
-   // --------------
-   
-   // If we're disallowing topology changes, don't let an edge collapse form a degenerate tet
-   if ( false == m_allow_topology_changes )
-   {
-
-      // for each triangle that *would* be created, make sure that there isn't already a triangle with those 3 vertices
-      
-      for ( unsigned int i = 0; i < m_mesh.m_vtxtri[vertex_to_delete].size(); ++i )
-      {
-         Vec3ui new_triangle = m_mesh.m_tris[ m_mesh.m_vtxtri[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 ( unsigned int j = 0; j < m_mesh.m_vtxtri[vertex_to_keep].size(); ++j )
-         {
-            if ( NonDestructiveTriMesh::triangle_has_these_verts( m_mesh.m_tris[ m_mesh.m_vtxtri[vertex_to_keep][j] ], new_triangle ) )
-            {
-               return false;
-            }            
-         }
-      }
-   }
-   
-	// Copy this vector, don't take a reference, as deleting will change the original
-   std::vector< unsigned int > triangles_incident_to_edge = m_mesh.m_edgetri[edge];
+    size_t new_vertex_index = m_mesh.nondestructive_add_vertex( );
     
-   // --------------
-   
-   // Do not collapse edge on a degenerate tet or degenerate triangle
-   for ( unsigned int i=0; i < triangles_incident_to_edge.size(); ++i )
-   {
-      const Vec3ui& triangle_i = m_mesh.m_tris[ triangles_incident_to_edge[i] ];
-         
-      if ( triangle_i[0] == triangle_i[1] || triangle_i[1] == triangle_i[2] || triangle_i[2] == triangle_i[0] )
-      {
-         return false;
-      }
-      
-      for ( unsigned int j=i+1; j < triangles_incident_to_edge.size(); ++j )
-      {
-         const Vec3ui& triangle_j = m_mesh.m_tris[ triangles_incident_to_edge[j] ];
-         
-         if ( ( triangle_i[0] == triangle_j[0] || triangle_i[0] == triangle_j[1] || triangle_i[0] == triangle_j[2] ) &&
-              ( triangle_i[1] == triangle_j[0] || triangle_i[1] == triangle_j[1] || triangle_i[1] == triangle_j[2] ) &&
-              ( triangle_i[2] == triangle_j[0] || triangle_i[2] == triangle_j[1] || triangle_i[2] == triangle_j[2] ) )
-         {
-            return false;
-         }
-      }
-   }
-         
-   // --------------
-   
-   // Check vertex pseudo motion for collisions and volume change
-   
-   if ( mag ( m_positions[m_mesh.m_edges[edge][1]] - m_positions[m_mesh.m_edges[edge][0]] ) > 0 )
-   {
-      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_newpositions[vertex_to_keep] = m_positions[vertex_to_keep];
-         m_newpositions[vertex_to_delete] = m_positions[vertex_to_delete];         
-         return false;
-      }
-      
-      bool collision = collapse_edge_pseudo_motion_introduces_collision( vertex_to_delete, vertex_to_keep, edge, vertex_new_position );
-      
-      collision |= collapse_edge_introduces_normal_inversion(  vertex_to_delete, vertex_to_keep, edge, vertex_new_position );
-      
-      // Restore saved positions which were changed by the function we just called.
-      m_newpositions[vertex_to_keep] = m_positions[vertex_to_keep];
-      m_newpositions[vertex_to_delete] = m_positions[vertex_to_delete];
-      
-      if ( collision )
-      {
-         //std::cout << "edge collapse would introduce collision or change volume too much or invert triangle normals" << std::endl;
-         return false;
-      }
-   }
-
-   // --------------
-   
-   // move the vertex we decided to keep
-   
-   m_newpositions[vertex_to_keep] = m_positions[vertex_to_keep] = vertex_new_position;
-
-   if ( m_collision_safety )
-   {
-      update_static_broad_phase( vertex_to_keep );
-   }
-   
-   // Delete triangles incident on the edge
-   
-   for ( unsigned int i=0; i < triangles_incident_to_edge.size(); ++i )
-   {
-      if ( m_verbose )
-      {
-         printf( "removing edge-incident triangle: %d %d %d\n", 
-                 m_mesh.m_tris[ triangles_incident_to_edge[i] ][0],
-                 m_mesh.m_tris[ triangles_incident_to_edge[i] ][1],
-                 m_mesh.m_tris[ triangles_incident_to_edge[i] ][2] );
-      }
-      
-      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< unsigned int > triangles_incident_to_vertex = m_mesh.m_vtxtri[vertex_to_delete];    
-   
-   for ( unsigned int 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] );
-      
-      Vec3ui new_triangle = m_mesh.m_tris[ 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_verbose ) { printf( "adding updated triangle: %d %d %d\n", new_triangle[0], new_triangle[1], new_triangle[2] ); }
-      
-      unsigned int new_triangle_index = add_triangle( new_triangle );
-      
-      m_dirty_triangles.push_back( new_triangle_index );
-   }
-   
-   for ( unsigned int i=0; i < triangles_incident_to_vertex.size(); ++i )
-   {  
-      if ( m_verbose )
-      {
-         printf( "removing vertex-incident triangle: %d %d %d\n", 
-                         m_mesh.m_tris[ triangles_incident_to_vertex[i] ][0],
-                         m_mesh.m_tris[ triangles_incident_to_vertex[i] ][1],
-                         m_mesh.m_tris[ triangles_incident_to_vertex[i] ][2] );
-      }
-      
-      remove_triangle( triangles_incident_to_vertex[i] );
-   }
-   
-   // Delete vertex
-   assert( m_mesh.m_vtxtri[vertex_to_delete].empty() );
-   remove_vertex( vertex_to_delete );
-   
-   return true;
-}
-
-
-// ========================================================
-// Edge flip functions
-// ========================================================
-
-// --------------------------------------------------------
-///
-/// Check whether the new triangles created by flipping an edge introduce any intersection
-///
-// --------------------------------------------------------
-
-bool SurfTrack::flip_introduces_collision( unsigned int edge_index, 
-                                           const Vec2ui& new_edge, 
-                                           const Vec3ui& new_triangle_a, 
-                                           const Vec3ui& new_triangle_b )
-{  
-   if ( !m_collision_safety )
-   {
-      return false;
-   }
-   
-   const Vec2ui& old_edge = m_mesh.m_edges[edge_index];
-   
-   unsigned int tet_vertex_indices[4] = { old_edge[0], old_edge[1], new_edge[0], new_edge[1] };
-   
-   const Vec3d tet_vertex_positions[4] = { m_positions[ tet_vertex_indices[0] ], 
-                                           m_positions[ tet_vertex_indices[1] ], 
-                                           m_positions[ tet_vertex_indices[2] ], 
-                                           m_positions[ 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<unsigned int> overlapping_vertices;
-   m_broad_phase->get_potential_vertex_collisions( low, high, overlapping_vertices );
-   
-   // do point-in-tet tests
-   for ( unsigned int 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( m_positions[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( m_positions[new_triangle_a[0]], m_positions[new_triangle_a[1]], m_positions[new_triangle_a[2]], low, high );
-   std::vector<unsigned int> overlapping_edges;
-   m_broad_phase->get_potential_edge_collisions( low, high, overlapping_edges );
-   
-   for ( unsigned int i = 0; i < overlapping_edges.size(); ++i )
-   {
-      unsigned int overlapping_edge_index = overlapping_edges[i];
-      const Vec2ui& 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], 
-                                                      m_positions, m_verbose ) )
-      {
-         return true;
-      }      
-   }
-
-   //
-   // Check new triangle B vs existing edges
-   //
-   
-   minmax( m_positions[new_triangle_b[0]], m_positions[new_triangle_b[1]], m_positions[new_triangle_b[2]], low, high );
-   
-   overlapping_edges.clear();
-   m_broad_phase->get_potential_edge_collisions( low, high, overlapping_edges );
-   
-   for ( unsigned int i = 0; i < overlapping_edges.size(); ++i )
-   {
-      unsigned int overlapping_edge_index = overlapping_edges[i];
-      const Vec2ui& 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], 
-                                                      m_positions, m_verbose ) )
-      {
-         return true;
-      }      
-   }
-   
-   //
-   // Check new edge vs existing triangles
-   //   
-   
-   minmax( m_positions[new_edge[0]], m_positions[new_edge[1]], low, high );
-   std::vector<unsigned int> overlapping_triangles;
-   m_broad_phase->get_potential_triangle_collisions( low, high, overlapping_triangles );
-   
-   for ( unsigned int i = 0; i <  overlapping_triangles.size(); ++i )
-   {
-      const Vec3ui& tri = m_mesh.m_tris[overlapping_triangles[i]];
-            
-      if ( check_edge_triangle_intersection_by_index( new_edge[0], new_edge[1],
-                                                      tri[0], tri[1], tri[2],
-                                                      m_positions, 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 SurfTrack::flip_edge( unsigned int edge, 
-                           unsigned int tri0, 
-                           unsigned int tri1, 
-                           unsigned int third_vertex_0, 
-                           unsigned int third_vertex_1 )
-{  
-   
-   Vec2ui& edge_vertices = m_mesh.m_edges[edge];
-   
-   // Find the vertices which will form the new edge
-   Vec2ui new_edge( third_vertex_0, third_vertex_1);
-   
-   // --------------
-   
-   // Control volume change
-   double vol = fabs( tetrahedron_signed_volume( m_positions[edge_vertices[0]], 
-                                                 m_positions[edge_vertices[1]], 
-                                                 m_positions[new_edge[0]], 
-                                                 m_positions[new_edge[1]] ) ); 
-   
-   if ( vol > m_max_volume_change )
-   {
-      return false;
-   }
-   
-   // --------------
-   
-   // Prevent non-manifold surfaces if we're not allowing topology changes
-   if ( false == m_allow_topology_changes )
-   {
-      for ( unsigned int i = 0; i < m_mesh.m_vtxedge[ third_vertex_0 ].size(); ++i )
-      {
-         if ( ( m_mesh.m_edges[ m_mesh.m_vtxedge[third_vertex_0][i] ][0] == third_vertex_1 ) ||
-              ( m_mesh.m_edges[ m_mesh.m_vtxedge[third_vertex_0][i] ][1] == third_vertex_1 ) )
-         {
-            // edge already exists
-            return false;
-         }
-      }
-   }
-   
-   // --------------
-   
-   // Don't flip edge on a degenerate tet
-   if ( third_vertex_0 == third_vertex_1 )
-   {
-      return false;
-   }
-   
-   // --------------
-   
-   // Create the new triangles
-   // new edge winding order == winding order of old triangle0 == winding order of new triangle0
-   
-   unsigned int 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.m_tris[tri0] ) ) 
-   {
-		assert( m_mesh.oriented( m_mesh.m_edges[edge][1], m_mesh.m_edges[edge][0], m_mesh.m_tris[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.m_tris[tri1] ) );
-		assert( m_mesh.oriented( m_mesh.m_edges[edge][1], m_mesh.m_edges[edge][0], m_mesh.m_tris[tri0] ) );
-      new_triangle_third_vertex_0 = m_mesh.m_edges[edge][0];
-      new_triangle_third_vertex_1 = m_mesh.m_edges[edge][1];
-   }
-   
-   Vec3ui new_triangle0( new_edge[0], new_edge[1], new_triangle_third_vertex_0 );
-   Vec3ui new_triangle1( new_edge[1], new_edge[0], new_triangle_third_vertex_1 );
-   
-   if ( 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( get_triangle_normal(tri0), get_triangle_normal(tri1) ) > 0.0 ) 
-   {
-      if ( dot( get_triangle_normal(new_triangle0), get_triangle_normal(new_triangle1) ) < 0.0 )
-      {
-         return false;
-      }
-      
-      if ( dot( get_triangle_normal(new_triangle0), get_triangle_normal(tri0) ) < 0.0 )
-      {
-         return false;
-      }
-
-      if ( dot( get_triangle_normal(new_triangle1), get_triangle_normal(tri1) ) < 0.0 )
-      {
-         return false;
-      }
-
-      if ( dot( get_triangle_normal(new_triangle0), get_triangle_normal(tri1) ) < 0.0 )
-      {
-         return false;
-      }
-      
-      if ( dot( get_triangle_normal(new_triangle1), get_triangle_normal(tri0) ) < 0.0 )
-      {
-         return false;
-      }
-   }
-   
-   // --------------
-   
-   // Prevent intersection
-   if ( m_collision_safety && flip_introduces_collision( edge, new_edge, new_triangle0, new_triangle1 ) )
-   {
-      return false;
-   }
-   
-   // --------------
-   
-   // Prevent degenerate triangles
-   if ( triangle_area( m_positions[new_triangle0[0]], m_positions[new_triangle0[1]], m_positions[new_triangle0[2]] ) < m_min_triangle_area )
-   {
-      return false;
-   }
-   
-   if ( triangle_area( m_positions[new_triangle1[0]], m_positions[new_triangle1[1]], m_positions[new_triangle1[2]] ) < m_min_triangle_area )
-   {
-      return false;
-   }
+    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 );
+    }
     
-
-   // --------------
-   
-   // Control change in area
-   
-   float old_area = get_triangle_area( tri0 ) + get_triangle_area( tri1 );
-   float new_area = triangle_area( m_positions[new_triangle0[0]], m_positions[new_triangle0[1]], m_positions[new_triangle0[2]] ) 
-                  + triangle_area( m_positions[new_triangle1[0]], m_positions[new_triangle1[1]], m_positions[new_triangle1[2]] );
-   
-   if ( fabs( old_area - new_area ) > 0.1 * old_area )
-   {
-      return false;
-   }
-         
-   // --------------
-   
-   // Don't flip unless both vertices are on a smooth patch
-   if ( ( classify_vertex( edge_vertices[0] ) > 1 ) || ( classify_vertex( edge_vertices[1] ) > 1 ) )
-   {
-      return false;
-   }        
-   
-   // --------------
-   
-   // Okay, now do the actual operation
-   
-   Vec3ui old_tri0 = m_mesh.m_tris[tri0];
-   Vec3ui old_tri1 = m_mesh.m_tris[tri1];
-   
-   remove_triangle( tri0 );
-   remove_triangle( tri1 );
-   
-   unsigned int new_triangle_index_0 = add_triangle( new_triangle0 );
-   unsigned int new_triangle_index_1 = add_triangle( new_triangle1 );
-   
-   if ( m_collision_safety )
-   {
-      if ( 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;
-      }
-      
-      if ( 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;      
-      }
-   }
-   
-   m_dirty_triangles.push_back( new_triangle_index_0 );
-   m_dirty_triangles.push_back( new_triangle_index_1 );   
-   
-   if ( m_verbose ) { printf( "edge flip: ok\n" ); }
-   
-   return true;
-   
+    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;
 }
 
-// ========================================================
-// Non-manifold cleanup functions
-// ========================================================
 
-// --------------------------------------------------------
+// ---------------------------------------------------------
 ///
-/// Return the edge incident on two triangles.  Returns ~0 if triangles are not adjacent.
+/// Remove a vertex from the surface.  Update the acceleration grid. 
 ///
-// --------------------------------------------------------
+// ---------------------------------------------------------
 
-unsigned int SurfTrack::get_common_edge( unsigned int triangle_a, unsigned int triangle_b )
+void SurfTrack::remove_vertex( size_t vertex_index )
 {
-   const Vec3ui& triangle_a_edges = m_mesh.m_triedge[triangle_a];
-   const Vec3ui& triangle_b_edges = m_mesh.m_triedge[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 ~0;
+    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) ) );
+    
 }
 
 
-// --------------------------------------------------------
-///
-/// Partition the triangles incident to a vertex into connected components
-///
-// --------------------------------------------------------
-
-void SurfTrack::partition_vertex_neighbourhood( unsigned int vertex_index, std::vector< TriangleSet >& connected_components )
-{
-   // triangles incident to vertex
-	TriangleSet triangles_incident_to_vertex = m_mesh.m_vtxtri[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
-         unsigned int 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 ( unsigned int i = 0; i < triangles_incident_to_vertex.size(); ++i )
-         {
-            unsigned int incident_triangle_index =  triangles_incident_to_vertex[i];
-            
-            if ( curr_tri == incident_triangle_index )
-            {
-               continue;
-            }
-            
-            if ( 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
+/// Remove deleted vertices and triangles from the mesh data structures
 ///
-// --------------------------------------------------------
+// ---------------------------------------------------------
 
-bool SurfTrack::pull_apart_vertex( unsigned int vertex_index, const std::vector< TriangleSet >& connected_components )
+void SurfTrack::defrag_mesh( )
 {
-   double dx = 10.0 * m_proximity_epsilon;
-   
-   TriangleSet triangles_to_delete;
-   std::vector< Vec3ui > triangles_to_add;
-   std::vector< unsigned int > vertices_added;
-   
-   // for each connected component except the last one, create a duplicate vertex
-   for (unsigned short i = 0; i < connected_components.size() - 1; ++i)
-   {
-      // duplicate the vertex 
-      unsigned int duplicate_vertex_index = add_vertex( m_positions[vertex_index], 
-                                                        m_velocities[vertex_index],
-                                                        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 ( unsigned int 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
-         Vec3ui new_triangle = m_mesh.m_tris[ 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_positions[ 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
-      m_positions[duplicate_vertex_index] = (1.0 - dx) * m_positions[duplicate_vertex_index] + dx * centroid;
-      
-   }
-   
-   if ( m_collision_safety )
-   {
-      // check new triangles for collision safety
-      for ( unsigned int i = 0; i < triangles_to_add.size(); ++i ) 
-      {
-         const Vec3ui& current_triangle = triangles_to_add[i];
-         Vec3d low, high;
-         
-         minmax(m_positions[current_triangle[0]], m_positions[current_triangle[1]], m_positions[current_triangle[2]], low, high );
-         
-         std::vector<unsigned int> overlapping_triangles;
-         m_broad_phase->get_potential_triangle_collisions( low, high, overlapping_triangles );
-         
-         for ( unsigned int j=0; j < overlapping_triangles.size(); ++j )
-         {        
-            const Vec3ui& tri_j = m_mesh.m_tris[overlapping_triangles[j]];
-            
-            assert( tri_j[0] != tri_j[1] );
-            
-            if ( check_triangle_triangle_intersection( current_triangle, tri_j, m_positions ) )
+    
+    //
+    // 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) )
             {
-               // collision occurs - abort separation
-               return false;
+                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;
             }
-         }
-      }
-      
-      // check new triangles vs each other as well
-      for ( unsigned int i = 0; i < triangles_to_add.size(); ++i ) 
-      {
-         for ( unsigned int j = i+1; j < triangles_to_add.size(); ++j ) 
-         {
-            if ( check_triangle_triangle_intersection( triangles_to_add[i], triangles_to_add[j], m_positions ) )
-            {
-               // collision occurs - abort separation
-               return false;
-            }         
-         }
-      }
-   }
-   
-   for ( unsigned int i = 0; i < triangles_to_add.size(); ++i )
-   {
-      add_triangle( triangles_to_add[i] );
-   }
-   
-   for ( unsigned int i = 0; i < triangles_to_delete.size(); ++i )
-   {
-      remove_triangle( triangles_to_delete[i] );
-   }
-   
-   if ( m_verbose ) { printf( "pulled apart a vertex\n" ); }
-   
-   return true;
-}
-
-
-// --------------------------------------------------------
-///
-/// Find vertices with disconnected neighbourhoods, and pull them apart
-///
-// --------------------------------------------------------
-
-void SurfTrack::separate_singular_vertices()
-{
-   for ( unsigned int i = 0; i < m_positions.size(); ++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 ) 
-      {
-         pull_apart_vertex( i, connected_components );
-      }
-   }
+        }
+        
+        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();
+    }
+    
 }
 
 
@@ -2192,74 +425,75 @@ void SurfTrack::separate_singular_vertices()
 
 void SurfTrack::assert_no_degenerate_triangles( )
 {
-
-   // for each triangle on the surface
-   for ( unsigned int i = 0; i < m_mesh.m_tris.size(); ++i )
-   {
-
-      const Vec3ui& current_triangle = m_mesh.m_tris[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 Vec3ui& tri_edges = m_mesh.m_triedge[i];
-      
-      bool flap_found = false;
-      
-      for ( unsigned int e = 0; e < 3 && flap_found == false; ++e )
-      {
-         const std::vector<unsigned int>& edge_tris = m_mesh.m_edgetri[ tri_edges[e] ];
-         
-         for ( unsigned int t = 0; t < edge_tris.size(); ++t )
-         {
-            if ( edge_tris[t] == i )
-            {
-               continue;
-            }
-            
-            unsigned int other_triangle_index = edge_tris[t];
-            const Vec3ui other_triangle = m_mesh.m_tris[ other_triangle_index ];
-            
-            if ( (other_triangle[0] == other_triangle[1]) || 
-                 (other_triangle[1] == other_triangle[2]) || 
-                 (other_triangle[2] == other_triangle[0]) ) 
-            {
-               continue;
-            }
+    // 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] ];
             
-            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])) ) 
+            for ( size_t t = 0; t < edge_tris.size(); ++t )
             {
-               
-               unsigned int 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;
-               }
-               
-               assert( false );
-            }
-         }         
-      }
-      
-   }
-      
+                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 );
+                }
+            }         
+        }
+        
+    }
+    
 }
 
 
@@ -2269,1107 +503,132 @@ void SurfTrack::assert_no_degenerate_triangles( )
 ///
 // --------------------------------------------------------
 
-void SurfTrack::trim_non_manifold( const std::vector<unsigned int>& triangle_indices )
+void SurfTrack::trim_non_manifold( std::vector<size_t>& triangle_indices )
 {   
-   
-   bool changed = false;
+    
+    // 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 ( unsigned int j = 0; j < triangle_indices.size(); ++j )      
-   {
-      unsigned int i = triangle_indices[j];
-      
-      const Vec3ui& current_triangle = m_mesh.m_tris[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 ) { printf( "deleting degenerate triangle %d: %d %d %d\n", i, current_triangle[0], current_triangle[1], current_triangle[2] ); }
-         
-         // delete it
-         remove_triangle( i );
-         
-         changed = true;         
-         continue;
-      }
-            
-      
-      //
-      // look for flaps
-      //
-      const Vec3ui& tri_edges = m_mesh.m_triedge[i];
-      
-      bool flap_found = false;
-      
-      for ( unsigned int e = 0; e < 3 && flap_found == false; ++e )
-      {
-         const std::vector<unsigned int>& edge_tris = m_mesh.m_edgetri[ tri_edges[e] ];
-         
-         for ( unsigned int t = 0; t < edge_tris.size(); ++t )
-         {
-            if ( edge_tris[t] == i )
-            {
-               continue;
-            }
-            
-            unsigned int other_triangle_index = edge_tris[t];
-            const Vec3ui other_triangle = m_mesh.m_tris[ 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 << current_triangle << std::endl;
-                  std::cout << other_triangle << std::endl;
-                  assert(0);
-               }
-               
-               unsigned int 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 )
-               {
-                  printf( "flap: triangles %d [%d %d %d] and %d [%d %d %d]\n",
-                          i, current_triangle[0], current_triangle[1], current_triangle[2],
-                          edge_tris[t], other_triangle[0], other_triangle[1], other_triangle[2] );
-               }
-               
-               remove_triangle( i );
-               
-               // delete its opposite
-               
-               remove_triangle( other_triangle_index );
-                              
-               changed = true;
-               flap_found = true;
-               break;
-            }
-            
-         }
-         
-      }
-         
-   }
-      
-   if ( m_allow_topology_changes )
-   {
-      separate_singular_vertices();
-   }
-   
-}
-
-
-// ========================================================
-//  NULL-space smoothing functions
-// ========================================================
-
-// --------------------------------------------------------
-///
-/// Find a new vertex location using NULL-space smoothing
-///
-// --------------------------------------------------------
-
-void SurfTrack::null_space_smooth_vertex( unsigned int v, 
-                                  const std::vector<double>& triangle_areas, 
-                                  const std::vector<Vec3d>& triangle_normals, 
-                                  const std::vector<Vec3d>& triangle_centroids, 
-                                  Vec3d& displacement ) const
-{
-   
-   if ( m_mesh.m_vtxtri[v].empty() )     
-   { 
-      displacement = Vec3d(0,0,0);
-      return; 
-   }
-   
-   const std::vector<unsigned int>& edges = m_mesh.m_vtxedge[v];
-   for ( unsigned int j = 0; j < edges.size(); ++j )
-   {
-      if ( m_mesh.m_edgetri[ edges[j] ].size() == 1 )
-      {
-         displacement = Vec3d(0,0,0);
-         return;
-      }
-   }
-   
-   const std::vector<unsigned int>& incident_triangles = m_mesh.m_vtxtri[v];
-   
-   std::vector< Vec3d > N;
-   std::vector< double > W;
-   
-   for ( unsigned int i = 0; i < incident_triangles.size(); ++i )
-   {
-      unsigned int 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 ( unsigned int 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 )
-   {
-      printf( "incident_triangles: %d\n", (int)incident_triangles.size() );
-      for ( unsigned int i = 0; i < incident_triangles.size(); ++i )
-      {
-         unsigned int triangle_index = incident_triangles[i];
-         std::cout << "triangle: " << m_mesh.m_tris[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(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 ( unsigned int 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 ( unsigned int 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_positions[v];
-      t += area * c;
-   }
-   
-   t = null_space_projection * t;
-   t /= sum_areas;
-   
-   displacement = t;
-}
-
-
-// ========================================================
-//  Zippering functions
-// ========================================================
-
-// --------------------------------------------------------
-///
-/// Move vertices around so v[0] and v[4] are closest together
-///
-// --------------------------------------------------------
-
-void SurfTrack::twist_vertices( unsigned int *zipper_vertices )
-{
-   double min_dist = 1e+30, dist;
-   Vec2ui min_pair(~0, ~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_positions[zipper_vertices[i]] - m_positions[zipper_vertices[j]] );
-         if (dist < min_dist) 
-         {
-            min_dist = dist;
-            min_pair[0] = i;
-            min_pair[1] = j;
-         }
-      }
-   }
-   
-   unsigned int 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(unsigned int) );
-   
-}
-
-// --------------------------------------------------------
-///
-/// Create a set of triangles to add to perform the zippering operation
-///
-// --------------------------------------------------------
-
-bool SurfTrack::get_zipper_triangles( unsigned int edge_index_a, unsigned int edge_index_b, std::vector<Vec3ui>& output_triangles )
-{
-   assert( output_triangles.size() == 8 );
-   
-   const Vec2ui& edge_a = m_mesh.m_edges[edge_index_a];
-   const Vec2ui& edge_b = m_mesh.m_edges[edge_index_b];
-   
-   unsigned int 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<unsigned int>& incident_triangles_a = m_mesh.m_edgetri[edge_index_a];
-   
-   assert( incident_triangles_a.size() == 2 );       // should be checked before calling this function
-   
-   unsigned int third_vertices[2];
-   third_vertices[0] = m_mesh.get_third_vertex( zipper_vertices[0], zipper_vertices[2], m_mesh.m_tris[incident_triangles_a[0]] );
-   third_vertices[1] = m_mesh.get_third_vertex( zipper_vertices[0], zipper_vertices[2], m_mesh.m_tris[incident_triangles_a[1]] );
-   
-   if ( m_mesh.oriented(zipper_vertices[0], zipper_vertices[2], m_mesh.m_tris[incident_triangles_a[0]] ) ) 
-   {
-      zipper_vertices[1] = third_vertices[0];
-      zipper_vertices[3] = third_vertices[1];
-   } 
-   else if ( m_mesh.oriented(zipper_vertices[0], zipper_vertices[2], m_mesh.m_tris[incident_triangles_a[1]]) ) 
-   {
-      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<unsigned int>& incident_triangles_b = m_mesh.m_edgetri[edge_index_b];
-   
-   assert( incident_triangles_b.size() == 2 );       // should be checked before calling this function
-   
-   assert( edge_index_b < m_mesh.m_edges.size() );
-          
-   const Vec2ui& ce = m_mesh.m_edges[edge_index_b];
-   const std::vector<unsigned int>& et = m_mesh.m_edgetri[edge_index_b];
-   third_vertices[0] = m_mesh.get_third_vertex( ce[0], ce[1], m_mesh.m_tris[et[0]] );
-   
-   third_vertices[0] = m_mesh.get_third_vertex( zipper_vertices[4], zipper_vertices[6], m_mesh.m_tris[incident_triangles_b[0]] );
-   third_vertices[1] = m_mesh.get_third_vertex( zipper_vertices[4], zipper_vertices[6], m_mesh.m_tris[incident_triangles_b[1]] );   
-   
-   if ( m_mesh.oriented(zipper_vertices[4], zipper_vertices[6], m_mesh.m_tris[incident_triangles_b[0]]) ) 
-   {
-      zipper_vertices[5] = third_vertices[0];
-      zipper_vertices[7] = third_vertices[1];
-   } 
-   else if ( m_mesh.oriented(zipper_vertices[4], zipper_vertices[6], m_mesh.m_tris[incident_triangles_b[1]]) ) 
-   {
-      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 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]) )
+        {
             
-            for ( unsigned int ii = 0; ii < m_mesh.m_vtxedge[ zipper_vertices[i] ].size(); ++ii )
-            {
-               for ( unsigned int jj = 0; jj < m_mesh.m_vtxedge[ zipper_vertices[j] ].size(); ++jj )
-               {
-                  if ( m_mesh.m_vtxedge[ zipper_vertices[i] ][ii] == m_mesh.m_vtxedge[ 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] = Vec3ui( zipper_vertices[0], zipper_vertices[4], zipper_vertices[1] );  // a e b
-   output_triangles[1] = Vec3ui( zipper_vertices[1], zipper_vertices[4], zipper_vertices[7] );  // b e h
-   output_triangles[2] = Vec3ui( zipper_vertices[1], zipper_vertices[7], zipper_vertices[2] );  // b h c
-   output_triangles[3] = Vec3ui( zipper_vertices[2], zipper_vertices[7], zipper_vertices[6] );  // c h g
-   output_triangles[4] = Vec3ui( zipper_vertices[2], zipper_vertices[6], zipper_vertices[3] );  // c g d
-   output_triangles[5] = Vec3ui( zipper_vertices[3], zipper_vertices[6], zipper_vertices[5] );  // d g f
-   output_triangles[6] = Vec3ui( zipper_vertices[3], zipper_vertices[5], zipper_vertices[0] );  // d f a
-   output_triangles[7] = Vec3ui( 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 SurfTrack::zippering_introduces_collision( const std::vector<Vec3ui>& new_triangles, 
-                                                const std::vector<unsigned int>& deleted_triangles )
-{
-   for ( unsigned int i = 0; i < new_triangles.size(); ++i )
-   {
-      // Check all existing edges vs new triangles
-      Vec3d low, high;
-      minmax(m_positions[new_triangles[i][0]], m_positions[new_triangles[i][1]], m_positions[new_triangles[i][2]], low, high);
-      
-      std::vector<unsigned int> overlapping_triangles;
-      m_broad_phase->get_potential_triangle_collisions( low, high, overlapping_triangles );
-      
-      const Vec3ui& current_triangle = new_triangles[i];
-      
-      // Check to make sure there doesn't already exist triangles with the same vertices
-      for ( unsigned int t = 0; t < overlapping_triangles.size(); ++t )      
-      {
-         const Vec3ui& other_triangle = m_mesh.m_tris[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 ( unsigned int t = 0; t < overlapping_triangles.size(); ++t )      
-      {
-         bool go_to_next_triangle = false;
-         for ( unsigned int 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_mesh.m_tris[overlapping_triangles[t]], 
-                                                    m_positions ) )
-         {
-            return true;
-         }     
-      }
-      
-      // Check new triangles vs each other
-      for ( unsigned int j = 0; j < new_triangles.size(); ++j )
-      {
-         if ( i == j )  { continue; }
-         
-         if ( check_triangle_triangle_intersection( new_triangles[i], 
-                                                    new_triangles[j], 
-                                                    m_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;
-}
-
-
-
-unsigned int g_zipper_non_manifold_edges;
-unsigned int g_zipper_mass_match;
-unsigned int g_zipper_no_set_triangles;
-unsigned int g_zipper_collision;
-
-// --------------------------------------------------------
-///
-/// Attempt to merge between two edges
-///
-// --------------------------------------------------------
-
-bool SurfTrack::zipper_edges( unsigned int edge_index_a, unsigned int edge_index_b )
-{
-   // For now we'll only zipper edges which are incident on 2 triangles
-   if ( m_mesh.m_edgetri[edge_index_a].size() != 2 || m_mesh.m_edgetri[edge_index_b].size() != 2 )
-   {
-      if ( m_verbose ) { std::cout << "ZIPPER: edge non-manifold" << std::endl; }
-      ++g_zipper_non_manifold_edges;
-      return false;
-   }
-   
-   if (    ( m_masses[m_mesh.m_edges[edge_index_a][0]] != m_masses[m_mesh.m_edges[edge_index_a][1]] )
-        || ( m_masses[m_mesh.m_edges[edge_index_b][0]] != m_masses[m_mesh.m_edges[edge_index_b][1]] ) )
-   {
-      ++g_zipper_mass_match;
-      return false;
-   }
-   
-   if ( m_masses[ m_mesh.m_edges[edge_index_a][0] ] != m_masses[ m_mesh.m_edges[edge_index_b][0] ] )
-   { 
-      if ( m_verbose ) { std::cout << "ZIPPER: edge m_masses don't match" << std::endl;  }
-      ++g_zipper_mass_match;
-      return false;
-   }
-   
-   //
-   // Get the set of 8 new triangles which will join the two holes in the mesh
-   //
-   
-   std::vector<Vec3ui> new_triangles;
-   new_triangles.resize(8);
-   if ( false == get_zipper_triangles( edge_index_a, edge_index_b, new_triangles ) )
-   {
-      if ( m_verbose ) { std::cout << "ZIPPER: couldn't get a set of triangles" << std::endl;   }
-      ++g_zipper_no_set_triangles;
-      return false;
-   }
-   
-   // Keep a list of triangles to delete
-   std::vector<unsigned int> deleted_triangles;
-   deleted_triangles.push_back( m_mesh.m_edgetri[edge_index_a][0] );
-   deleted_triangles.push_back( m_mesh.m_edgetri[edge_index_a][1] );
-   deleted_triangles.push_back( m_mesh.m_edgetri[edge_index_b][0] );
-   deleted_triangles.push_back( m_mesh.m_edgetri[edge_index_b][1] );   
-   
-   //
-   // Check the new triangles for collision safety, ignoring the triangles which will be deleted
-   //
-   
-   bool saved_verbose = m_verbose;
-   m_verbose = false;
-
-   if ( m_collision_safety && zippering_introduces_collision( new_triangles, deleted_triangles ) )
-   {
-      m_verbose = saved_verbose;
-      if ( m_verbose ) { std::cout << "ZIPPER: collision check failed" << std::endl; }
-      ++g_zipper_collision;
-      return false;
-   }
-  
-   m_verbose = saved_verbose;
-   
-   //
-   // Add the new triangles
-   //
-   
-   unsigned int new_index = add_triangle( new_triangles[0] );
-   m_dirty_triangles.push_back( new_index );
-   new_index = add_triangle( new_triangles[1] );
-   m_dirty_triangles.push_back( new_index );
-   new_index = add_triangle( new_triangles[2] );
-   m_dirty_triangles.push_back( new_index );
-   new_index = add_triangle( new_triangles[3] );
-   m_dirty_triangles.push_back( new_index );
-   new_index = add_triangle( new_triangles[4] );
-   m_dirty_triangles.push_back( new_index );
-   new_index = add_triangle( new_triangles[5] );
-   m_dirty_triangles.push_back( new_index );
-   new_index = add_triangle( new_triangles[6] );
-   m_dirty_triangles.push_back( new_index );
-   new_index = add_triangle( new_triangles[7] );
-   m_dirty_triangles.push_back( new_index );
-   
-   //
-   // Remove the old triangles
-   //
-   
-   remove_triangle( m_mesh.m_edgetri[edge_index_a][0] );
-   remove_triangle( m_mesh.m_edgetri[edge_index_a][0] );
-   remove_triangle( m_mesh.m_edgetri[edge_index_b][0] );
-   remove_triangle( m_mesh.m_edgetri[edge_index_b][0] );
-   
-   return true;
-   
-}
-
-
-
-// ========================================================
-//  Improvement passes
-// ========================================================
-
-// --------------------------------------------------------
-///
-/// Split all long edges
-///
-// --------------------------------------------------------
-
-bool SurfTrack::split_pass( )
-{
-	std::cout << "---------------------- El Topo: splitting ----------------------" << std::endl;
-      
-   // whether a split operation was successful in this pass
-   bool split_occurred = false;
-   
-   std::vector<SortableEdge> sortable_edges_to_try;
-   
-   for( unsigned int i = 0; i < m_mesh.m_edges.size(); i++ )
-   {    
-      if ( m_mesh.m_edges[i][0] == m_mesh.m_edges[i][1] )   { continue; }     // skip deleted edges
-      if ( m_mesh.m_edgetri[i].size() < 2 ) { continue; }                     // skip boundary edges
-      if ( m_masses[ m_mesh.m_edges[i][0] ] > 100.0 && m_masses[ m_mesh.m_edges[i][1] ] > 100.0 )     { continue; }    // skip solids
-      
-      unsigned int vertex_a = m_mesh.m_edges[i][0];
-      unsigned int vertex_b = m_mesh.m_edges[i][1];
-      
-      assert( vertex_a < m_positions.size() );
-      assert( vertex_b < m_positions.size() );
-      
-      double current_length = dist(  m_positions[ vertex_a ], m_positions[ vertex_b ] );
-      
-      if ( current_length > m_max_edge_length )
-      {
-         sortable_edges_to_try.push_back( SortableEdge( i, current_length ) );
-      }
-   }
-   
-   
-   //
-   // sort in ascending order, then iterate backwards
-   //
-   
-   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 )
-   {
-      
-      unsigned int longest_edge = iter->edge_index;
-      
-      // recompute edge length -- a prior split may have fixed this edge already
-      double longest_edge_length = get_edge_length( longest_edge );  
-      
-      if ( longest_edge_length > m_max_edge_length )
-      {
-         
-         if ( m_verbose ) 
-         {
-            printf( "splitting edge %d / %d, length = %f\n", longest_edge, (int)m_mesh.m_edges.size(), longest_edge_length );
-            printf( "edge %d %d... ", m_mesh.m_edges[longest_edge][0], m_mesh.m_edges[longest_edge][1] );
-         }
-         
-         // skip non-manifold and deleted edges
-         if ( ( m_mesh.m_edgetri[longest_edge].size() != 2 ) || ( m_mesh.m_edges[longest_edge][0] == m_mesh.m_edges[longest_edge][1] ) )
-         { 
-            continue;      
-         }    
-         
-         bool result = split_edge( longest_edge );
-         
-         if ( m_verbose ) { printf( " result: %s\n", (result ? "ok" : "failed")); }
-         
-         split_occurred |= result;
-         
-      }
-   }
-
-   return split_occurred;
-     
-}
-
-// --------------------------------------------------------
-///
-/// Collapse all short edges
-///
-// --------------------------------------------------------
-
-bool SurfTrack::collapse_pass()
-{
-   std::cout << "---------------------- El Topo: collapsing ----------------------" << std::endl;
-   
-   bool collapse_occurred = false;
-      
-   // set of triangles to test for degeneracy
-   m_dirty_triangles.clear();       
-   
-   std::vector<SortableEdge> sortable_edges_to_try;
-   
-   //
-   // get set of edges to collapse
-   //
-   
-   for( unsigned int i = 0; i < m_mesh.m_edges.size(); i++ )
-   {    
-      if ( m_mesh.m_edges[i][0] == m_mesh.m_edges[i][1] )   { continue; }    // skip deleted edges
-      if ( m_masses[ m_mesh.m_edges[i][0] ] > 100.0 || m_masses[ m_mesh.m_edges[i][1] ] > 100.0 )     { continue; }    // skip solids
+            if ( m_verbose ) { std::cout << "deleting degenerate triangle " << i << ": " << current_triangle << std::endl; }
             
-      double current_length = 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_verbose )
-   {
-      std::cout << sortable_edges_to_try.size() << " candidate edges sorted" << std::endl;
-      std::cout << "total edges: " << m_mesh.m_edges.size() << std::endl;
-   }
-
-   //
-   // attempt to collapse each edge in the sorted list
-   //
-   
-   for ( unsigned int i = 0; i < sortable_edges_to_try.size(); ++i )
-   {
-      unsigned int e = sortable_edges_to_try[i].edge_index;
-      double edge_length = get_edge_length( e );
-      
-      if ( edge_length < m_min_edge_length )
-      {        
-         if ( m_verbose )
-         {
-            printf( "collapsing edge %d / %d, length = %f\n", e, (int)m_mesh.m_edges.size(), edge_length );
-            //printf( "edge %d %d... ", m_mesh.m_edges[e][0], m_mesh.m_edges[e][1] );
-         }
-         
-         if ( m_mesh.m_edges[e][0] == m_mesh.m_edges[e][1] )   { continue; }     // skip deleted edges         
-         if ( m_mesh.m_edgetri[e].size() < 2 )  { continue; }  // skip boundary edges
-         
-         bool result = collapse_edge( e );
-                  
-         if ( m_verbose )
-         {
-            printf( " result: %s\n", (result ? "ok" : "failed"));
-         }
-         
-         collapse_occurred |= result;
-         
-      }
-   }
-
-   trim_non_manifold( m_dirty_triangles );
-
-   m_dirty_triangles.clear();
-   
-   return collapse_occurred;
-   
-}
-
-
-// --------------------------------------------------------
-///
-/// Flip all non-delaunay edges
-///
-// --------------------------------------------------------
-
-bool SurfTrack::flip_pass( )
-{
-   std::cout << "---------------------- El Topo: flipping ----------------------" << std::endl;
-	
-   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;
-   
-   //
-   // 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 )
-   {
-      std::cout << "---------------------- El Topo: flipping ";
-      std::cout << "pass " << num_flip_passes << "/" << MAX_NUM_FLIP_PASSES;
-      std::cout << "----------------------" << std::endl;
-      
-      flip_occurred = false;
-      
-      unsigned int number_of_edges = m_mesh.m_edges.size();      // don't work on newly created edges
-       
-      for( unsigned int 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_edgetri[i].size() > 4 || m_mesh.m_edgetri[i].size() < 2 )   { continue; }
-         
-         unsigned int triangle_a = ~0, triangle_b = ~0;
-                  
-         if ( m_mesh.m_edgetri[i].size() == 2 )
-         {    
-            triangle_a = m_mesh.m_edgetri[i][0];
-            triangle_b = m_mesh.m_edgetri[i][1];         
-            assert (    m_mesh.oriented( m_mesh.m_edges[i][0], m_mesh.m_edges[i][1], m_mesh.m_tris[triangle_a] ) 
-                     != m_mesh.oriented( m_mesh.m_edges[i][0], m_mesh.m_edges[i][1], m_mesh.m_tris[triangle_b] ) );
-         }
-         else if ( m_mesh.m_edgetri[i].size() == 4 )
-         {           
-            triangle_a = m_mesh.m_edgetri[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_edgetri[i][j];
-               if (    m_mesh.oriented( m_mesh.m_edges[i][0], m_mesh.m_edges[i][1], m_mesh.m_tris[triangle_a] ) 
-                    != m_mesh.oriented( m_mesh.m_edges[i][0], m_mesh.m_edges[i][1], m_mesh.m_tris[triangle_b] ) )
-               {
-                  break;
-               }
-            }
-            assert ( j < 4 );
-         }
-         else
-         {
-            printf( "%d triangles incident to an edge\n", (int)m_mesh.m_edgetri[i].size() );
-            assert(0);
-         }
-         
-         // Don't flip edge on a degenerate triangle
-         if (   m_mesh.m_tris[triangle_a][0] == m_mesh.m_tris[triangle_a][1] 
-             || m_mesh.m_tris[triangle_a][1] == m_mesh.m_tris[triangle_a][2] 
-             || m_mesh.m_tris[triangle_a][2] == m_mesh.m_tris[triangle_a][0] 
-             || m_mesh.m_tris[triangle_b][0] == m_mesh.m_tris[triangle_b][1] 
-             || m_mesh.m_tris[triangle_b][1] == m_mesh.m_tris[triangle_b][2] 
-             || m_mesh.m_tris[triangle_b][2] == m_mesh.m_tris[triangle_b][0] )
-         {
-            continue;
-         }
-         
-         unsigned int third_vertex_0 = m_mesh.get_third_vertex( m_mesh.m_edges[i][0], m_mesh.m_edges[i][1], m_mesh.m_tris[triangle_a] );
-         unsigned int third_vertex_1 = m_mesh.get_third_vertex( m_mesh.m_edges[i][0], m_mesh.m_edges[i][1], m_mesh.m_tris[triangle_b] );
-         
-         if ( third_vertex_0 == third_vertex_1 )
-         {
-            continue;
-         }
-         
-         bool flipped = false;
-         
-         double current_length = mag( m_positions[m_mesh.m_edges[i][1]] - m_positions[m_mesh.m_edges[i][0]] );        
-         double potential_length = mag( m_positions[third_vertex_1] - m_positions[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 );            
-         }
+            // delete it
+            remove_triangle( i );
             
-         flip_occurred |= flipped;
-      }
-      
-      flip_occurred_ever |= flip_occurred;
-   }
-   
-   
-   if ( flip_occurred_ever )
-   {
-      trim_non_manifold( m_dirty_triangles );
-      m_dirty_triangles.clear();
-   }
-   
-   return flip_occurred_ever;
-   
-}
-
-
-// --------------------------------------------------------
-///
-/// NULL-space smoothing
-///
-// --------------------------------------------------------
-
-bool SurfTrack::null_space_smoothing_pass( double dt )
-{
-   std::cout << "---------------------- El Topo: vertex redistribution ----------------------" << std::endl;
-      
-   std::vector<Vec3d> saved_velocities;
-   for ( unsigned int i = 0; i < m_velocities.size(); ++i )
-   {
-      saved_velocities.push_back( m_velocities[i] );
-   }
-   
-   std::vector<double> triangle_areas;
-   triangle_areas.reserve(m_mesh.m_tris.size());
-   std::vector<Vec3d> triangle_normals;
-   triangle_normals.reserve(m_mesh.m_tris.size());
-   std::vector<Vec3d> triangle_centroids;
-   triangle_centroids.reserve(m_mesh.m_tris.size());
-   
-   for ( unsigned int i = 0; i < m_mesh.m_tris.size(); ++i )
-   {
-      if ( m_mesh.m_tris[i][0] == m_mesh.m_tris[i][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( get_triangle_area( i ) );
-         triangle_normals.push_back( get_triangle_normal( i ) );
-         triangle_centroids.push_back( (m_positions[m_mesh.m_tris[i][0]] + m_positions[m_mesh.m_tris[i][1]] + m_positions[m_mesh.m_tris[i][2]]) / 3 );
-      }
-   }
-   
-   std::vector<Vec3d> displacements;
-   displacements.resize( m_positions.size(), Vec3d(0) );
-   
-   for ( unsigned int i = 0; i < m_positions.size(); ++i )
-   {
-      if ( m_masses[i] < 200 )
-      {
-         null_space_smooth_vertex( i, triangle_areas, triangle_normals, triangle_centroids, displacements[i] );
-      }
-   }
-   
-   // compute maximum dt
-   double max_beta = 1.0; //compute_max_timestep_quadratic_solve( m_mesh.m_tris, m_positions, displacements, this->m_verbose );
-   
-   if ( m_verbose ) { printf( "max beta: %g\n", max_beta ); }
-   
-   for ( unsigned int i = 0; i < m_positions.size(); ++i )
-   {
-      m_newpositions[i] = m_positions[i] + (max_beta) * displacements[i];
-      m_velocities[i] = (m_newpositions[i] - m_positions[i]) / dt;
-   }
-      
-   // repositioned locations stored in m_newpositions, but needs to be collision safe
-   if ( m_collision_safety )
-   {
-      rebuild_continuous_broad_phase();
-      bool all_collisions_handled = handle_collisions(dt);
-      if ( !all_collisions_handled )
-      {
-         bool result = handle_collisions_simultaneous(dt);
-         if ( !result )
-         {
-            new_rigid_impact_zones(dt);
-         }
-      }
-      
-   }
-   
-   // used to test convergence
-   double max_position_change = 0.0;
-   
-   // Set positions
-   for(unsigned int i = 0; i < m_positions.size(); i++)
-   {
-      max_position_change = max( max_position_change, mag( m_newpositions[i] - m_positions[i] ) );
-      m_positions[i] = m_newpositions[i];
-   } 
-
-   if ( 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 * get_average_edge_length() )
-   {
-      converged = true;
-   }
-   
-   for ( unsigned int i = 0; i < m_velocities.size(); ++i )
-   {
-      m_velocities[i] = saved_velocities[i];
-   }
-   
-   rebuild_static_broad_phase();
-   
-   return !converged;
-}
-
-
-// --------------------------------------------------------
-///
-/// Zipper nearby edges together
-///
-// --------------------------------------------------------
-
-bool SurfTrack::merge_pass()
-{
-   std::cout << "---------------------- El Topo: merging / topology change --------------------" << std::endl;
-   
-   m_broad_phase->update_broad_phase_static( *this );
-   
-   std::queue<Vec2ui> 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(unsigned int i = 0; i < m_mesh.m_edges.size(); i++)
-   {
-      Vec2ui e0 = m_mesh.m_edges[i];
-      
-      if ( e0[0] == e0[1] ) { continue; }
-      if ( m_masses[e0[0]] > 100 ) { continue; }
-         
-      Vec3d emin, emax;
-      edge_static_bounds(i, emin, emax);
-      emin -= m_merge_proximity_epsilon * Vec3d(1,1,1);
-      emax += m_merge_proximity_epsilon * Vec3d(1,1,1);
-      
-      std::vector<unsigned int> edge_candidates;
-      m_broad_phase->get_potential_edge_collisions( emin, emax, edge_candidates );
-      
-      for(unsigned int j = 0; j < edge_candidates.size(); j++)
-      {
-         unsigned int proximal_edge_index = edge_candidates[j];
-         Vec2ui e1 = m_mesh.m_edges[proximal_edge_index];
-         
-         if ( proximal_edge_index <= i )
-         {
             continue;
-         }
-         
-         if ( m_masses[e0[0]] != m_masses[e1[0]] )
-         {
-            continue;
-         }
-         
-         if(e0[0] != e1[0] && e0[0] != e1[1] && e0[1] != e1[0] && e0[1] != e1[1])
-         {
-            double distance, s0, s2;
-            Vec3d normal;
-            
-            segment_segment_distance( m_positions[e0[0]], e0[0],
-                                      m_positions[e0[1]], e0[1],
-                                      m_positions[e1[0]], e1[0],
-                                      m_positions[e1[1]], e1[1],
-                                      distance, s0, s2, normal );
+        }
+        
+        
+        //
+        // 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] ];
             
-            if (distance < m_merge_proximity_epsilon)
+            for ( size_t t = 0; t < edge_tris.size(); ++t )
             {
-               proximities.push_back( SortableEdgeEdgeProximity(i, proximal_edge_index, distance) );
+                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();
     
-   sort( proximities.begin(), proximities.end() );
-                
-   if ( m_verbose ) { std::cout << "num merge proximities: " << proximities.size() << std::endl; }
-   
-   g_zipper_non_manifold_edges = 0;
-   g_zipper_mass_match = 0;
-   g_zipper_no_set_triangles = 0;
-   g_zipper_collision = 0;
-   
-   for ( unsigned int i = 0; i < proximities.size(); ++i )
-   {
-      unsigned int edge_index_a = proximities[i].edge_a;
-      unsigned int edge_index_b = proximities[i].edge_b;
-      
-      if ( ( m_mesh.m_edges[edge_index_a][0] == m_mesh.m_edges[edge_index_a][1] ) || ( m_mesh.m_edges[edge_index_b][0] == m_mesh.m_edges[edge_index_b][1] ) )
-      {
-         continue;
-      }
-      
-      if ( m_verbose ) { std::cout << "proximity: " << proximities[i].distance << std::endl; }
-      
-      if ( zipper_edges( proximities[i].edge_a, proximities[i].edge_b ) )
-      {
-         
-         trim_non_manifold( m_dirty_triangles );
-         m_dirty_triangles.clear();
-         
-         if ( m_verbose ) { std::cout << "zippered" << std::endl; }
-         merge_occured = true;
-      }
-   }
-   
-   if ( merge_occured )
-   {
-      assert_no_degenerate_triangles();
-   }
-   
-   return merge_occured;
-
 }
 
-
 // --------------------------------------------------------
 ///
 /// One pass: split long edges, flip non-delaunay edges, collapse short edges, null-space smoothing
@@ -3378,29 +637,31 @@ bool SurfTrack::merge_pass()
 
 void SurfTrack::improve_mesh( )
 {     
-
-   if ( m_perform_improvement )
-   {
-      rebuild_static_broad_phase();
-            
-      while ( split_pass() ) {}
-
-      flip_pass();		
-
-      while ( collapse_pass() ) {}
-   
-      null_space_smoothing_pass( 1.0 );
-      
-      clear_deleted_vertices();
-      m_mesh.update_connectivity( m_positions.size() );
-
-      if ( m_collision_safety )
-      {
-         assert_mesh_is_intersection_free();
-      }
-      
-   }
-         
+    
+    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 );
+        }      
+    }
+    
 }
 
 // --------------------------------------------------------
@@ -3411,33 +672,26 @@ void SurfTrack::improve_mesh( )
 
 void SurfTrack::topology_changes( )
 {
-   
-   if ( m_allow_topology_changes )
-   {
-      bool merge_occurred = true;
-      while ( merge_occurred )
-      {
-         rebuild_static_broad_phase();
-         
-         //m_verbose = true;
-         merge_occurred = merge_pass();
-         //m_verbose = false;
-         
-         if ( !merge_occurred )
-         {
-            break;
-         }
-         
-         clear_deleted_vertices();
-         m_mesh.update_connectivity( m_positions.size() );
-         
-         if ( m_collision_safety )
-         {
-            assert_mesh_is_intersection_free();
-         }
-      }
-   }
-   
+    
+    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
index c2a8caa..70ecdbc 100644
--- a/extern/eltopo/eltopo3d/surftrack.h
+++ b/extern/eltopo/eltopo3d/surftrack.h
@@ -1,4 +1,3 @@
-
 // ---------------------------------------------------------
 //
 //  surftrack.h
@@ -8,20 +7,26 @@
 //
 // ---------------------------------------------------------
 
-#ifndef SURFTRACK_H
-#define SURFTRACK_H
+#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
 // ---------------------------------------------------------
 
-typedef std::vector<unsigned int> TriangleSet;
 class SubdivisionScheme;
+typedef std::vector<size_t> TriangleSet;
 
 // ---------------------------------------------------------
-//  Interface declarations
+//  Class definitions
 // ---------------------------------------------------------
 
 // ---------------------------------------------------------
@@ -32,47 +37,104 @@ class SubdivisionScheme;
 
 struct SurfTrackInitializationParameters
 {
-
-   /// Set 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;
-   
-   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, these are taken to be fractions of the average edge length of the new surface.
-   /// If use_fraction is false, these are absolute.
-   double m_min_edge_length;
-   double m_max_edge_length; 
-   double m_max_volume_change;
-   
-   /// 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 mesh improvement
-   bool m_perform_improvement;
-
+    
+    ///  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;
+    
 };
 
 // ---------------------------------------------------------
@@ -80,41 +142,113 @@ struct SurfTrackInitializationParameters
 /// 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
 {
-   unsigned int edge_index;
-   double edge_length;
-   
-   SortableEdge( unsigned int ei, double el ) : edge_index(ei), edge_length(el) {}
-   
-   bool operator<( const SortableEdge& other ) const
-   {
-      return (this->edge_length < other.edge_length);
-   }
+    /// 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;
+    
 };
 
+
 // ---------------------------------------------------------
 ///
-/// 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.
+/// Keeps track of a triangle removal or addition. If addition, contains the three vertices that form the new triangle.
 ///
 // ---------------------------------------------------------
-struct SortableEdgeEdgeProximity
+
+struct TriangleUpdateEvent
 {
-   SortableEdgeEdgeProximity( unsigned int a, unsigned int b, double d ) :
-   edge_a( a ),
-   edge_b( b ),
-   distance( d )
-   {}
-   
-   unsigned int edge_a;
-   unsigned int edge_b;
-   double distance;
-   
-   bool operator<( const SortableEdgeEdgeProximity& other ) const
-   {
-      return distance < other.distance;
-   }
+    /// 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;
+    
 };
 
 
@@ -126,225 +260,195 @@ struct SortableEdgeEdgeProximity
 
 class SurfTrack : public DynamicSurface
 {
-   
+    
 public:
-       
-   /// Rendering options
-   ///
-   static const unsigned int RENDER_EDGES = 1;
-   static const unsigned int RENDER_TRIANGLES = 2;
-   static const unsigned int RENDER_VERTEX_DATA = 4;
-   static const unsigned int RENDER_COLLIDING_TRIANGLES = 8;
-   static const unsigned int NO_SHADING = 16;
-   static const unsigned int TWO_SIDED = 32;
-
-
-   /// Create a SurfTrack object from a set of vertices and triangles using the specified paramaters
-   ///
-   SurfTrack( const std::vector<Vec3d>& vs, 
-              const std::vector<Vec3ui>& ts, 
+    
+    /// 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 );
-
-   
-   ~SurfTrack();
-   
+    
+    /// Destructor
+    ///
+    ~SurfTrack();
+    
 private:
-   
-   // Disallow copying and assignment by declaring private
-   //
-   SurfTrack( const SurfTrack& );
-   SurfTrack& operator=( const SurfTrack& );
-   
-   
+    
+    /// Disallow copying and assignment by declaring private
+    ///
+    SurfTrack( const SurfTrack& );
+    
+    /// Disallow copying and assignment by declaring private
+    ///
+    SurfTrack& operator=( const SurfTrack& );
+    
+    
 public:
-   
-   /// Display the surface in OpenGL using the specified options
-   ///
-   void render( unsigned int options = RENDER_EDGES | RENDER_TRIANGLES );
-
-   /// Ray cast into the scene, return index of the closest primitive of the type specified
-   ///
-   enum { RAY_HIT_VERTEX, RAY_HIT_EDGE, RAY_HIT_TRIANGLE, RAY_HIT_NOTHING };
-   unsigned int ray_cast( const Vec3f& ray_origin, const Vec3f& ray_direction, unsigned int primitive_type, unsigned int& hit_index );      
-
-   /// advance one time step (just calls the version in DynamicSurface)
-   ///
-   inline void integrate(double dt);
-   
-   /// run mesh maintenance operations
-   ///
-   void improve_mesh( );
-
-   /// run edge-edge merging
-   ///
-   void topology_changes( );
-   
-   // ---------------------------------------------------------
-   // mesh maintenance operations
-   // ---------------------------------------------------------
-      
-   /// Split an edge, using subdivision_scheme to determine the new vertex location, if safe to do so.
-   ///
-   bool split_edge( unsigned int edge );
-   
-   /// Split all long edges
-   ///
-   bool split_pass();
-   
-   /// Delete an edge by moving its source vertex to its destination vertex
-   ///
-   bool collapse_edge(unsigned int edge );
-   
-   /// Collapse all short edges
-   ///
-   bool collapse_pass();
-   
-   /// Flip an edge: remove the edge and its incident triangles, then add a new edge and two new triangles
-   ///
-   bool flip_edge(unsigned int edge, unsigned int tri0, unsigned int tri1, unsigned int third_vertex_0, unsigned int third_vertex_1 );
-   
-   /// Flip all non-delaunay edges
-   ///
-   bool flip_pass();
-   
-   /// Find a new vertex location using NULL-space smoothing
-   ///
-   void null_space_smooth_vertex( unsigned int v, 
-                                  const std::vector<double>& triangle_areas, 
-                                  const std::vector<Vec3d>& triangle_normals, 
-                                  const std::vector<Vec3d>& triangle_centroids, 
-                                  Vec3d& displacement ) const;      
-         
-   /// NULL-space smoothing of all vertices
-   ///
-   bool null_space_smoothing_pass( double dt );
-
-
-   // ---------------------------------------------------------
-   // topological merging
-   // ---------------------------------------------------------
-   
-   /// Attempt to merge between two edges
-   ///
-   bool zipper_edges(unsigned int edge0, unsigned int edge1);   
-      
-   /// Zipper nearby edges together
-   ///
-   bool merge_pass();
-         
-   // ---------------------------------------------------------
-   // mesh cleanup
-   // ---------------------------------------------------------
-   
-   /// Check for and delete flaps and zero-area triangles among the given triangle indices, then separate singular vertices.
-   ///
-   void trim_non_manifold( const std::vector<unsigned int>& triangle_indices );
-   
-   /// Check for and delete flaps and zero-area triangles among *all* triangles, then separate singular vertices.
-   ///
-   inline void trim_non_manifold();
-   
-   /// Find vertices with disconnected neighbourhoods, and pull them apart
-   ///
-   void separate_singular_vertices();
-
-   // ---------------------------------------------------------
-   // collision queries
-   // ---------------------------------------------------------
-      
-   void assert_no_degenerate_triangles();
-   
-   // ---------------------------------------------------------
-   // mesh maintenance helpers
-   // ---------------------------------------------------------
-      
-   // split
-   bool split_edge_pseudo_motion_introduces_collision( const Vec3d& new_vertex_position, 
-                                                       const Vec3d& new_vertex_smooth_position, 
-                                                       unsigned int edge,
-                                                       unsigned int tri0, 
-                                                       unsigned int tri1,
-                                                       unsigned int vertex_a,
-                                                       unsigned int vertex_b,
-                                                       unsigned int vertex_c,
-                                                       unsigned int vertex_d );
-   	
-   // collapse
-   bool check_triangle_vs_triangle_collision( const Vec3ui& triangle_a, const Vec3ui& triangle_b );
-   bool collapse_edge_pseudo_motion_introduces_collision( unsigned int source_vertex, 
-                                                          unsigned int destination_vertex, 
-                                                          unsigned int edge_index, const 
-                                                          Vec3d& vertex_new_position );
-   
-   bool collapse_edge_introduces_normal_inversion( unsigned int source_vertex, 
-                                                   unsigned int destination_vertex, 
-                                                   unsigned int edge_index, 
-                                                   const Vec3d& vertex_new_position );
-   
-   bool collapse_edge_introduces_volume_change( unsigned int source_vertex, 
-                                                unsigned int edge_index, 
-                                                const Vec3d& vertex_new_position );   
-   
-   // flip
-   bool flip_introduces_collision( unsigned int edge_index, 
-                                   const Vec2ui& new_edge, 
-                                   const Vec3ui& new_triangle_a, 
-                                   const Vec3ui& new_triangle_b );
-      
-   // zipper
-   void twist_vertices( unsigned int *zipper_vertices );
-   bool get_zipper_triangles( unsigned int edge_index_0, unsigned int edge_index_1, std::vector<Vec3ui>& output_triangles );
-   bool zippering_introduces_collision( const std::vector<Vec3ui>& new_triangles, const std::vector<unsigned int>& deleted_triangles );
-   bool get_vertex_triangle_zipper_triangles( unsigned int v, unsigned int t, std::vector<Vec3ui>& new_triangles );   
-   bool stitch_triangle_triangle( unsigned int ta, unsigned int tb, std::vector<Vec3ui>& new_tris );
-
-   
-   /// Delete flaps and zero-area triangles
-   unsigned int get_common_edge( unsigned int triangle_a, unsigned int triangle_b );
-   bool triangles_are_adjacent( unsigned int triangle_a, unsigned int triangle_b );
-   void partition_vertex_neighbourhood( unsigned int vertex_index, std::vector< TriangleSet >& connected_components );
-   bool pull_apart_vertex( unsigned int vertex_index, const std::vector< TriangleSet >& connected_components );
-
-   
-   // ---------------------------------------------------------
-   // Member variables
-   // ---------------------------------------------------------
-   
-   /// 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;
-
-   /// Interpolation scheme, determines edge midpoint location
-   SubdivisionScheme *m_subdivision_scheme;
-   bool should_delete_subdivision_scheme_object;
-   
-   /// Triangles which are involved in connectivity changes which may introduce degeneracies
-   std::vector<unsigned int> m_dirty_triangles;
-   
-   /// Whether to allow merging and separation
-   bool m_allow_topology_changes;
-   
-   /// Whether to perform adaptivity operations
-   bool m_perform_improvement;
-      
+    
+    //
+    // 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;
+    
 };
 
 // ---------------------------------------------------------
@@ -353,29 +457,6 @@ public:
 
 // ---------------------------------------------------------
 ///
-/// Advance mesh by one time step (just calls through to DynamicSurface).
-///
-// ---------------------------------------------------------
-
-inline void SurfTrack::integrate(double dt)
-{       
-   DynamicSurface::integrate(dt);
-}
-
-// --------------------------------------------------------
-///
-/// Determine if two triangles are adjacent (if they share an edge)
-///
-// --------------------------------------------------------
-
-inline bool SurfTrack::triangles_are_adjacent( unsigned int triangle_a, unsigned int triangle_b )
-{
-   return ( get_common_edge( triangle_a, triangle_b ) != (unsigned int) ~0 );
-}
-
-
-// ---------------------------------------------------------
-///
 /// Search the entire mesh for non-manifold elements and remove them
 /// NOTE: SHOULD USE THE VERSION THAT ACCEPTS A SET OF TRIANGLE INDICES INSTEAD.
 ///
@@ -383,15 +464,16 @@ inline bool SurfTrack::triangles_are_adjacent( unsigned int triangle_a, unsigned
 
 inline void SurfTrack::trim_non_manifold()
 {
-  
-   std::vector<unsigned int> triangle_indices;
-   triangle_indices.resize( m_mesh.m_tris.size() );
-   for ( unsigned int i = 0; i < triangle_indices.size(); ++i )
-   {
-      triangle_indices[i] = i;
-   }
-   
-   trim_non_manifold( triangle_indices );
+    
+    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
new file mode 100644
index 0000000..768b102
--- /dev/null
+++ b/extern/eltopo/eltopo3d/trianglequality.cpp
@@ -0,0 +1,494 @@
+// ---------------------------------------------------------
+//
+//  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
new file mode 100644
index 0000000..b4c21e1
--- /dev/null
+++ b/extern/eltopo/eltopo3d/trianglequality.h
@@ -0,0 +1,231 @@
+// ---------------------------------------------------------
+//
+//  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/libmv/CMakeLists.txt b/extern/libmv/CMakeLists.txt
index 075ff15..02723b6 100644
--- a/extern/libmv/CMakeLists.txt
+++ b/extern/libmv/CMakeLists.txt
@@ -39,109 +39,125 @@ set(INC_SYS
 	${ZLIB_INCLUDE_DIRS}
 )
 
+
+# XXX - FIXME
+# this is a momentary hack to find unwind.h in 10.6.sdk
+if(APPLE)
+	if(${CMAKE_OSX_DEPLOYMENT_TARGET} STREQUAL "10.6")
+		list(APPEND INC_SYS
+			${CMAKE_OSX_SYSROOT}/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin10/4.2.1/include
+		)
+	endif()
+endif()
+# XXX - END
+
+
 set(SRC
 	libmv-capi.cpp
+	libmv/image/array_nd.cc
+	libmv/image/convolve.cc
+	libmv/multiview/conditioning.cc
+	libmv/multiview/euclidean_resection.cc
+	libmv/multiview/fundamental.cc
+	libmv/multiview/projection.cc
+	libmv/multiview/triangulation.cc
 	libmv/numeric/numeric.cc
 	libmv/numeric/poly.cc
+	libmv/simple_pipeline/bundle.cc
 	libmv/simple_pipeline/callbacks.cc
-	libmv/simple_pipeline/reconstruction.cc
-	libmv/simple_pipeline/resect.cc
-	libmv/simple_pipeline/intersect.cc
-	libmv/simple_pipeline/initialize_reconstruction.cc
 	libmv/simple_pipeline/camera_intrinsics.cc
-	libmv/simple_pipeline/pipeline.cc
 	libmv/simple_pipeline/detect.cc
+	libmv/simple_pipeline/initialize_reconstruction.cc
+	libmv/simple_pipeline/intersect.cc
+	libmv/simple_pipeline/pipeline.cc
+	libmv/simple_pipeline/reconstruction.cc
+	libmv/simple_pipeline/resect.cc
+	libmv/simple_pipeline/rigid_registration.cc
 	libmv/simple_pipeline/tracks.cc
-	libmv/simple_pipeline/bundle.cc
-	libmv/image/convolve.cc
-	libmv/image/array_nd.cc
-	libmv/tracking/pyramid_region_tracker.cc
-	libmv/tracking/sad.cc
 	libmv/tracking/brute_region_tracker.cc
-	libmv/tracking/hybrid_region_tracker.cc
 	libmv/tracking/esm_region_tracker.cc
-	libmv/tracking/trklt_region_tracker.cc
+	libmv/tracking/hybrid_region_tracker.cc
 	libmv/tracking/klt_region_tracker.cc
 	libmv/tracking/lmicklt_region_tracker.cc
+	libmv/tracking/pyramid_region_tracker.cc
 	libmv/tracking/retrack_region_tracker.cc
-	libmv/multiview/projection.cc
-	libmv/multiview/conditioning.cc
-	libmv/multiview/fundamental.cc
-	libmv/multiview/euclidean_resection.cc
-	libmv/multiview/triangulation.cc
+	libmv/tracking/trklt_region_tracker.cc
 
-	third_party/ssba/Geometry/v3d_metricbundle.cpp
-	third_party/ssba/Math/v3d_optimization.cpp
-	third_party/gflags/gflags.cc
-	third_party/gflags/gflags_reporting.cc
-	third_party/gflags/gflags_completions.cc
-	third_party/fast/fast_9.c
 	third_party/fast/fast_10.c
 	third_party/fast/fast_11.c
 	third_party/fast/fast_12.c
+	third_party/fast/fast_9.c
 	third_party/fast/fast.c
 	third_party/fast/nonmax.c
+	third_party/gflags/gflags.cc
+	third_party/gflags/gflags_completions.cc
+	third_party/gflags/gflags_reporting.cc
 	third_party/ldl/Source/ldl.c
+	third_party/ssba/Geometry/v3d_metricbundle.cpp
+	third_party/ssba/Math/v3d_optimization.cpp
 
 	libmv-capi.h
+	libmv/base/id_generator.h
+	libmv/base/scoped_ptr.h
+	libmv/base/vector.h
+	libmv/base/vector_utils.h
+	libmv/image/array_nd.h
+	libmv/image/convolve.h
+	libmv/image/correlation.h
+	libmv/image/image.h
+	libmv/image/sample.h
+	libmv/image/tuple.h
 	libmv/logging/logging.h
+	libmv/multiview/conditioning.h
+	libmv/multiview/euclidean_resection.h
+	libmv/multiview/fundamental.h
+	libmv/multiview/nviewtriangulation.h
+	libmv/multiview/projection.h
+	libmv/multiview/resection.h
+	libmv/multiview/triangulation.h
 	libmv/numeric/dogleg.h
-	libmv/numeric/levenberg_marquardt.h
-	libmv/numeric/poly.h
 	libmv/numeric/function_derivative.h
+	libmv/numeric/levenberg_marquardt.h
 	libmv/numeric/numeric.h
+	libmv/numeric/poly.h
+	libmv/simple_pipeline/bundle.h
 	libmv/simple_pipeline/callbacks.h
-	libmv/simple_pipeline/resect.h
-	libmv/simple_pipeline/reconstruction.h
 	libmv/simple_pipeline/camera_intrinsics.h
-	libmv/simple_pipeline/tracks.h
 	libmv/simple_pipeline/detect.h
-	libmv/simple_pipeline/pipeline.h
-	libmv/simple_pipeline/intersect.h
-	libmv/simple_pipeline/bundle.h
 	libmv/simple_pipeline/initialize_reconstruction.h
-	libmv/image/convolve.h
-	libmv/image/tuple.h
-	libmv/image/array_nd.h
-	libmv/image/sample.h
-	libmv/image/image.h
-	libmv/tracking/region_tracker.h
+	libmv/simple_pipeline/intersect.h
+	libmv/simple_pipeline/pipeline.h
+	libmv/simple_pipeline/reconstruction.h
+	libmv/simple_pipeline/resect.h
+	libmv/simple_pipeline/rigid_registration.h
+	libmv/simple_pipeline/tracks.h
 	libmv/tracking/brute_region_tracker.h
-	libmv/tracking/hybrid_region_tracker.h
-	libmv/tracking/retrack_region_tracker.h
-	libmv/tracking/sad.h
-	libmv/tracking/pyramid_region_tracker.h
 	libmv/tracking/esm_region_tracker.h
-	libmv/tracking/trklt_region_tracker.h
+	libmv/tracking/hybrid_region_tracker.h
 	libmv/tracking/klt_region_tracker.h
 	libmv/tracking/lmicklt_region_tracker.h
-	libmv/base/id_generator.h
-	libmv/base/vector.h
-	libmv/base/scoped_ptr.h
-	libmv/base/vector_utils.h
-	libmv/multiview/nviewtriangulation.h
-	libmv/multiview/resection.h
-	libmv/multiview/euclidean_resection.h
-	libmv/multiview/triangulation.h
-	libmv/multiview/projection.h
-	libmv/multiview/fundamental.h
-	libmv/multiview/conditioning.h
+	libmv/tracking/pyramid_region_tracker.h
+	libmv/tracking/region_tracker.h
+	libmv/tracking/retrack_region_tracker.h
+	libmv/tracking/trklt_region_tracker.h
 
-	third_party/ssba/Geometry/v3d_metricbundle.h
+	third_party/fast/fast.h
+	third_party/gflags/config.h
+	third_party/gflags/gflags/gflags_completions.h
+	third_party/gflags/gflags/gflags_declare.h
+	third_party/gflags/gflags/gflags.h
+	third_party/gflags/mutex.h
+	third_party/gflags/util.h
+	third_party/ldl/Include/ldl.h
+	third_party/msinttypes/inttypes.h
+	third_party/msinttypes/stdint.h
 	third_party/ssba/Geometry/v3d_cameramatrix.h
 	third_party/ssba/Geometry/v3d_distortion.h
+	third_party/ssba/Geometry/v3d_metricbundle.h
+	third_party/ssba/Math/v3d_linear.h
 	third_party/ssba/Math/v3d_linear_utils.h
-	third_party/ssba/Math/v3d_optimization.h
 	third_party/ssba/Math/v3d_mathutilities.h
-	third_party/ssba/Math/v3d_linear.h
-	third_party/gflags/gflags_completions.h
-	third_party/gflags/mutex.h
-	third_party/gflags/config.h
-	third_party/gflags/gflags.h
-	third_party/fast/fast.h
-	third_party/ldl/Include/ldl.h
-	third_party/msinttypes/stdint.h
-	third_party/msinttypes/inttypes.h
+	third_party/ssba/Math/v3d_optimization.h
 )
 
 if(WIN32)
@@ -152,23 +168,23 @@ if(WIN32)
 		third_party/glog/src/vlog_is_on.cc
 		third_party/glog/src/windows/port.cc
 
-		third_party/glog/src/config.h
-		third_party/glog/src/stacktrace.h
+		third_party/glog/src/utilities.h
 		third_party/glog/src/stacktrace_generic-inl.h
-		third_party/glog/src/stacktrace_libunwind-inl.h
-		third_party/glog/src/stacktrace_powerpc-inl.h
-		third_party/glog/src/stacktrace_x86-inl.h
+		third_party/glog/src/stacktrace.h
 		third_party/glog/src/stacktrace_x86_64-inl.h
-		third_party/glog/src/utilities.h
-		third_party/glog/src/base/commandlineflags.h
 		third_party/glog/src/base/googleinit.h
 		third_party/glog/src/base/mutex.h
-		third_party/glog/src/windows/config.h
-		third_party/glog/src/windows/port.h
-		third_party/glog/src/windows/glog/log_severity.h
-		third_party/glog/src/windows/glog/logging.h
+		third_party/glog/src/base/commandlineflags.h
+		third_party/glog/src/stacktrace_powerpc-inl.h
+		third_party/glog/src/stacktrace_x86-inl.h
+		third_party/glog/src/config.h
+		third_party/glog/src/stacktrace_libunwind-inl.h
 		third_party/glog/src/windows/glog/raw_logging.h
 		third_party/glog/src/windows/glog/vlog_is_on.h
+		third_party/glog/src/windows/glog/logging.h
+		third_party/glog/src/windows/glog/log_severity.h
+		third_party/glog/src/windows/port.h
+		third_party/glog/src/windows/config.h
 	)
 
 	list(APPEND INC
@@ -190,34 +206,35 @@ if(WIN32)
 	endif()
 else()
 	list(APPEND SRC
-		third_party/glog/src/utilities.cc
-		third_party/glog/src/symbolize.cc
-		third_party/glog/src/vlog_is_on.cc
-		third_party/glog/src/signalhandler.cc
-		third_party/glog/src/logging.cc
 		third_party/glog/src/demangle.cc
+		third_party/glog/src/logging.cc
 		third_party/glog/src/raw_logging.cc
+		third_party/glog/src/signalhandler.cc
+		third_party/glog/src/symbolize.cc
+		third_party/glog/src/utilities.cc
+		third_party/glog/src/vlog_is_on.cc
 
-		third_party/glog/src/config.h
+		third_party/glog/src/base/commandlineflags.h
+		third_party/glog/src/base/googleinit.h
+		third_party/glog/src/base/mutex.h
 		third_party/glog/src/config_freebsd.h
+		third_party/glog/src/config.h
+		third_party/glog/src/config_hurd.h
 		third_party/glog/src/config_linux.h
 		third_party/glog/src/config_mac.h
 		third_party/glog/src/demangle.h
-		third_party/glog/src/stacktrace.h
+		third_party/glog/src/glog/logging.h
+		third_party/glog/src/glog/log_severity.h
+		third_party/glog/src/glog/raw_logging.h
+		third_party/glog/src/glog/vlog_is_on.h
 		third_party/glog/src/stacktrace_generic-inl.h
+		third_party/glog/src/stacktrace.h
 		third_party/glog/src/stacktrace_libunwind-inl.h
 		third_party/glog/src/stacktrace_powerpc-inl.h
-		third_party/glog/src/stacktrace_x86-inl.h
 		third_party/glog/src/stacktrace_x86_64-inl.h
+		third_party/glog/src/stacktrace_x86-inl.h
 		third_party/glog/src/symbolize.h
 		third_party/glog/src/utilities.h
-		third_party/glog/src/base/commandlineflags.h
-		third_party/glog/src/base/googleinit.h
-		third_party/glog/src/base/mutex.h
-		third_party/glog/src/glog/log_severity.h
-		third_party/glog/src/glog/logging.h
-		third_party/glog/src/glog/raw_logging.h
-		third_party/glog/src/glog/vlog_is_on.h
 	)
 
 	list(APPEND INC
diff --git a/extern/libmv/ChangeLog b/extern/libmv/ChangeLog
index 7e10abf..33068bd 100644
--- a/extern/libmv/ChangeLog
+++ b/extern/libmv/ChangeLog
@@ -1,3 +1,484 @@
+commit fa3842e472e3b9c789e47bf6d8f592aa40a84f16
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Thu Apr 12 12:32:48 2012 +0600
+
+    implementation of some basic algorithms for point cloud orientation:
+    
+    - Implementation of rigid registration algorithm which searches transformation
+      form one point cloud to another assuming that points in this clouds are
+      already paired (points with the same index in different clouds belongs to
+      the same pair) which minimizes average distance between points in pairs.
+    
+      Algorithm uses Levenberg-Marquardt solver to find such transformation.
+    
+      Supports registration of rotation-scale-transform (which is probably most
+      common usage) and rotation only (which might be useful for basic modal
+      tripod solver).
+    
+    - Implementation of Iterative-Point-Clouds algorithm which searches
+      transformation from one arbitrary point cloud to another  making
+      points as closest to each other as possible.
+    
+      This algorithm doesn't require points be initially paired, but for
+      good result clouds should have rough initial orientation. If they're
+      arbitrary oriented from the very beginning, algorithm might fail
+      producing good resold.
+    
+      Iteration is based on building pairs of closest to each other points
+      and registering rigid transformation between them which incrementally
+      constructs final result.
+    
+    TODO: building pairs might be speedup a lot using data structures like
+          AABB trees, K-D trees or so.
+
+commit 9618d9a1d48bb3c28da605d9027f57a74f462785
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Wed Apr 11 14:17:14 2012 +0600
+
+    Added configuration file for glog to compile smooth on Hurd platform.
+    
+    Patch by Pino Toscano <pino at debian.org>, thanks!
+
+commit 63b2bd20237c8599fa73ce42556e4fb99b9f7cca
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Thu Mar 22 17:03:34 2012 +0600
+
+    Trackers refactoring:
+    - Deduplicate pattern sampling used in esm and lmicklt trackers
+      and move SamplePattern to image/sample.h
+    - Move computation of Pearson product-moment correlation into
+      own function in new file image/correlation.h so all trackers
+      can use it to check final correlation.
+    - Remove SAD tracker. It's almost the same as brute tracker,
+      with only two differences:
+      1. It does brute search of affine transformation which in some cases
+         helps to track rotating features
+      2. It didn't use common tracker api which probably gave some speed
+         advantage, but lead to a real headache to use it together with
+         other trackers leading to duplicated code in 3d-party software.
+
+commit 9fe49c32e990f28c83f2bbb1d18057aed8879af7
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Mon Mar 12 09:36:15 2012 +0600
+
+    Code cleanup: convert line endings to Unix style (native on my platform) so it
+    wouldn't confuse other versioning systems used for project where libmv is bundled to,
+    
+    Also change mode to +x for glog's windows-related script.
+
+commit fe74ae2b53769389b0ed9d7e604c8e60be81077d
+Author: Sergey I. Sharybin <g.ulairi at gmail.com>
+Date:   Sun Mar 11 20:34:15 2012 +0600
+
+    Replace "third_party/glog/src/glog/logging.h" with <glog/logging.h>
+    
+    It was needed because of how build systems is setup in Blender but think
+    this will be helpful change for other applications too because it makes
+    it's easier to move libraries around and even use libraries installed
+    on the operation system.
+
+commit 37fc726701479f2d321d6af878fa93f3176278d5
+Author: Sergey I. Sharybin <g.ulairi at gmail.com>
+Date:   Sun Mar 11 19:27:41 2012 +0600
+
+    Upgrade gflags and glog libraries - stage 2 (final)
+    
+    Changes to upstream code which are needed to make libmv compile smooth on all platforms
+    
+    * Replace <gflags/gflags.h> with "third_party/gflags/gflags/gflags.h" which is easier
+      to setup things in libmv and also helps with setting up building libmv into
+      external applications.
+    * Replace "glog/logging.h" and  "glog/logging.h" with <glog/logging.h> and  <glog/logging.h>
+      which is needed on Windows platform because otherwise files like logging.cc will be using
+      relative path which points to headers used by linux instead of headers need to be used
+      on Windows.
+    * Replace _asm int 3 with __debugbreak(). Such assembler code is obsolete and doesn't work
+      with 64bit versions of MSVC compilers.
+    * Do not use stacktrace for MinGW and FreeBSD because it leads into issues accessing
+      some specific data on this platforms.
+    * Define HAVE_LIB_GFLAGS for Windows builds.
+    * Do not define __declspec(dllimport) for MinGW platforms.
+    * Setup proper includes and datatypes for int32, uint32, int64 and uint64 for MinGW
+    * Do not define va_copy for MinGW platforms (it's already defined there).
+    * Patch localtime_r to be working fine with MinGW, disable strerror_r for MinGW because
+      of lack of needed functions.
+
+commit 8ed07abfa49d1e0511752021c972e0715e5a1383
+Author: Sergey I. Sharybin <g.ulairi at gmail.com>
+Date:   Sun Mar 11 19:06:33 2012 +0600
+
+    Upgrade gflags and glog libraries - stage 1
+    
+    This commit copies sources from latest original release of gflags and glog
+    over currently bundled versions of this libraries without any modifications.
+    
+    This revision can't b compiled, all needed changes to make new libraries working
+    fine will be done with next commit to make it clear which changes were necessary
+    for easier bundling further newer version and extract patches and put them to
+    gflags/glog upstream repo.
+    
+    Such upgrade of libraries is needed to make it able to compile libmv
+    with clang compilers. Currently used versions:
+    
+    - gflags is version 2.0
+    - glog is version 0.3.2
+
+commit 75b9af405964ff2c7d3f0a44500e27e63b37c91b
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Fri Feb 17 23:29:11 2012 +0600
+
+    _USE_MATH_DEFINES is needed to define constants like M_E when building with msvc
+    Occasionally was removed, but now added comment about this so hopefully it
+    wouldn't removed again.
+
+commit f85b1232a9b929f69443b5eed6e7a39908cd6551
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Fri Feb 17 21:34:40 2012 +0600
+
+    Picky edit: corrected mode for ssba readme file.
+
+commit f8c2b223f01551fd81a85f6d5221646165147035
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Fri Feb 17 21:32:05 2012 +0600
+
+    Picky edits: corrected EOL
+
+commit 3f2a4205ec5adadcdfa306b161c705c868a7be93
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Fri Feb 17 21:30:07 2012 +0600
+
+    Fixed incorrect access to ucontext on linux. Caused by incorrect merge conflict resolve.
+
+commit d360a21a5aa125cf9e83dd26b302508688ff7007
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Fri Feb 17 20:54:13 2012 +0600
+
+    More Windows -> Unix EOL conversions
+
+commit 18aeda58bec9556140ba617724e31ada6f5b67c0
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Fri Feb 17 20:15:42 2012 +0600
+
+    Looks like this debug output was removed accidentally.
+
+commit 189dc0cacdee3c1eab68c43263ecb038ed244c09
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Fri Feb 17 20:11:56 2012 +0600
+
+    Made V3D verbose again by default
+
+commit 8b3422d3eec5e450d76243886bf07fb0a3e83a81
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Fri Feb 17 20:08:01 2012 +0600
+
+    SAD tracker now can deal with pattern size any size,
+    Very quick implementation came from Blender before Hybrid tracker was added.
+    Better to be replaced with brute tracker.
+
+commit d547c9cfe37d5d3397d33c8b0e58471e1e1c1634
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Fri Feb 17 20:03:52 2012 +0600
+
+    Just convert end of lines to unix style.
+
+commit eb73ddbaec5b9e1ad30331bbf858a6ebc266c4aa
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Fri Feb 17 20:02:20 2012 +0600
+
+    Made some function static. Resolves possible linking issues when building with MinGW.
+
+commit 2930681fafd86e4f4a958054b1db8bfff29623d1
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Fri Feb 17 19:59:45 2012 +0600
+
+    Missed this in commit with improvements in camera intrinsics.
+
+commit 8d31bc767019b05c5bf8c9f309f9545b3428afa1
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Fri Feb 17 19:57:51 2012 +0600
+
+    Another step of syncing codebase with Blender.
+    Mainly fixes for freebsd/osx compilation and aligned memory allocation.
+
+commit 3214a2df5bfd98021f25d0f1a626a86318bb245f
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Fri Feb 17 19:48:02 2012 +0600
+
+    Support compilation on FreeBSD platform
+
+commit 0e5abe96f543687ccfb3a923ec639cb8f45d54f8
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Fri Feb 17 19:44:18 2012 +0600
+
+    Implementation of basic system for progress reporting into callee stuff
+    
+    Implemented by using simple callbacks classes which are getting invoked from
+    places where lots of calculation happens, so applications which are using
+    libmv may display nice progress bar.
+
+commit c5e18fe35464618055e0e9761be8d22fae56db49
+Author: Keir Mierle <mierle at gmail.com>
+Date:   Fri Feb 17 19:25:45 2012 +0600
+
+    Add support for detecting tracking failure in the ESM tracker component of
+    libmv. Since both KLT and Hybrid rely on ESM underneath, KLT and Hybrid now
+    have a minimum correlation setting to match. With this fix, track failures
+    should get detected quicker, with the issue that sometimes the tracker will
+    give up too easily. That is fixable by reducing the required correlation (in
+    the track properties).
+
+commit ea0fed736ecdcc8c020227aeef8ef4cd3be5e63d
+Author: Keir Mierle <mierle at gmail.com>
+Date:   Fri Feb 17 19:23:50 2012 +0600
+
+    Add a new hybrid region tracker for motion tracking to libmv, and
+    add it as an option (under "Hybrid") in the tracking settings. The
+    region tracker is a combination of brute force tracking for coarse
+    alignment, then refinement with the ESM/KLT algorithm already in
+    libmv that gives excellent subpixel precision (typically 1/50'th
+    of a pixel)
+    
+    This also adds a new "brute force" region tracker which does a
+    brute force search through every pixel position in the destination
+    for the pattern in the first frame. It leverages SSE if available,
+    similar to the SAD tracker, to do this quickly. Currently it does
+    some unnecessary conversions to/from floating point that will get
+    fixed later.
+    
+    The hybrid tracker glues the two trackers (brute & ESM) together
+    to get an overall better tracker. The algorithm is simple:
+    
+    1. Track from frame 1 to frame 2 with the brute force tracker.
+        This tries every possible pixel position for the pattern from
+        frame 1 in frame 2. The position with the smallest
+        sum-of-absolute-differences is chosen. By definition, this
+        position is only accurate up to 1 pixel or so.
+    2. Using the result from 1, initialize a track with ESM. This does
+        a least-squares fit with subpixel precision.
+    3. If the ESM shift was more than 2 pixels, report failure.
+    4. If the ESM track shifted less than 2 pixels, then the track is
+        good and we're done. The rationale here is that if the
+        refinement stage shifts more than 1 pixel, then the brute force
+        result likely found some random position that's not a good fit.
+
+commit a07fff8431621c01d81ae52595d8dd91a295a776
+Author: Keir Mierle <mierle at gmail.com>
+Date:   Fri Feb 17 19:19:58 2012 +0600
+
+    Assorted camera tracker improvements
+    
+    - Add support for refining the camera's intrinsic parameters
+      during a solve. Currently, refining supports only the following
+      combinations of intrinsic parameters:
+    
+        f
+        f, cx, cy
+        f, cx, cy, k1, k2
+        f, k1
+        f, k1, k2
+    
+      This is not the same as autocalibration, since the user must
+      still make a reasonable initial guess about the focal length and
+      other parameters, whereas true autocalibration would eliminate
+      the need for the user specify intrinsic parameters at all.
+    
+      However, the solver works well with only rough guesses for the
+      focal length, so perhaps full autocalibation is not that
+      important.
+    
+      Adding support for the last two combinations, (f, k1) and (f,
+      k1, k2) required changes to the library libmv depends on for
+      bundle adjustment, SSBA. These changes should get ported
+      upstream not just to libmv but to SSBA as well.
+    
+    - Improved the region of convergence for bundle adjustment by
+      increasing the number of Levenberg-Marquardt iterations from 50
+      to 500. This way, the solver is able to crawl out of the bad
+      local minima it gets stuck in when changing from, for example,
+      bundling k1 and k2 to just k1 and resetting k2 to 0.
+    
+    - Add several new region tracker implementations. A region tracker
+      is a libmv concept, which refers to tracking a template image
+      pattern through frames. The impact to end users is that tracking
+      should "just work better". I am reserving a more detailed
+      writeup, and maybe a paper, for later.
+    
+    - Other libmv tweaks, such as detecting that a tracker is headed
+      outside of the image bounds.
+    
+    This includes several changes made directly to the libmv extern
+    code rather expecting to get those changes through normal libmv
+    channels, because I, the libmv BDFL, decided it was faster to work
+    on libmv directly in Blender, then later reverse-port the libmv
+    changes from Blender back into libmv trunk. The interesting part
+    is that I added a full Levenberg-Marquardt loop to the region
+    tracking code, which should lead to a more stable solutions. I
+    also added a hacky implementation of "Efficient Second-Order
+    Minimization" for tracking, which works nicely. A more detailed
+    quantitative evaluation will follow.
+
+commit 0bf66c009d5022eacfc473d247884a73ffeefa8f
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Fri Feb 17 19:13:49 2012 +0600
+
+    Rest of compilation fix with FAST library.
+
+commit 71b578ca2ba34c528363c514cd1fcc85791d01f3
+Author: Keir Mierle <mierle at gmail.com>
+Date:   Fri Feb 17 19:00:28 2012 +0600
+
+    Improve the KLT tracking behaviour and UI
+    
+    - Remove the overly-conservative use of libmv's re-track tracker. The re-track
+      tracker would take a normal tracker such as TRKLT or KLT or pyramid KLT, and
+      track from frame 1 to 2, then back from the position found in 2 back to 1.
+      Then, when the reverse-track doesn't match the original track with high
+      precision, the track is considered "failed". This is a good approach for
+      fully automatic reconstruction, but is too conservative for supervised
+      tracking.
+    
+      The retrack-tracker will return when fully automatic tracking is added.
+    
+    - Always solve for (dx, dy) in the TRKLT loop even if the linear system is
+      ill-conditioned. The client (Blender in this case) can still use the solved
+      position, even though it is less reliable.
+
+commit 7d8a8762f2bc2e36f95b0b6f4fb4ca996f9f0db7
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Fri Feb 17 18:46:24 2012 +0600
+
+    Changes in camera intrinsics distortion/undistortion:
+    
+    - Distortion/undistortion of scaled images wasn't happening right,
+      because camera intrinsics are calibrated on an original frame which
+      has got some particular resolution and trying to apply this model on
+      an image with another resolution gives totally wrong result.
+      This is needed to be able to do post-prccessing of render, running
+      distortion on a scene which might be rendered with higher resolution
+      than footage itself and then be scaled down.
+    - Fixed incorrect calculation/applying of precomputed grid when
+      distortion is high high enough and produces pixel offset higher
+      than 127 pixels. This might be still not very distorted image,
+      but if it's a 4K footage "normal" camera will easily give such
+      a distortion.
+    - Added support of overscan distortion/undistortion.
+
+commit ed080785d63bb8e3a13dde51a2dc94fe59b059bb
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Fri Feb 17 18:38:51 2012 +0600
+
+    Fast headers now can be included from C++ sources.
+    Was needed to make it working fine when bundling in Blender but might also
+    be needed to bundle into another applications.
+
+commit 5f5a7aa46a2d87b96c8098dfc8682f4d01b5cd40
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Fri Feb 17 18:36:16 2012 +0600
+
+    Bring back FAST detector which seems to be working much nicer than Morravec.
+    Both of them are available in API.
+
+commit 2cab13c18216fb684b270cec077f7300262584af
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Fri Feb 17 18:27:36 2012 +0600
+
+    Revert "Make CameraIntrinsics (and thus Qt tracker) compilable without linking libmv."
+    
+    This reverts commit 81613ee0cc94b315f333c9632b18b95d426aad05.
+    
+    That commit made inverting intrinsics totally unworkable, so reverted this and
+    made needed tweaks to qt-tracker project file to make it compilable (was needed
+    to make it linking together with glog).
+    
+    Conflicts:
+    
+    	src/ui/tracker/tracker.cc
+    	src/ui/tracker/tracker.pro
+
+commit ec46cae041401b17afb4fe4d9c9343d10797090f
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Fri Feb 17 17:59:55 2012 +0600
+
+    Fix compilation error using official MinGW
+
+commit 6fbc370e922c47cfa35381662b6c439f4891ed74
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Fri Feb 17 17:38:20 2012 +0600
+
+    Fix compilation error with MSVC 2010 which is more picky for "missed" STL headers
+
+commit be9e6b63691d83b551a085f0766878bd84220767
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Fri Feb 17 17:36:18 2012 +0600
+
+    Fix compilation with MSVC where snprintf function is declared as unsafe and _snprintf should be used instead.
+    
+    Better to switch to own implementation will ensure string is correctly NULL-terminated.
+
+commit 1847d9e414ed763cd80668775d7d9f79575fc8ca
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Fri Feb 17 17:34:45 2012 +0600
+
+    Fix compilation error on OSX caused by incorrect access to ucontext
+
+commit 90579b6ffad07672172a1c240499615b30b25549
+Merge: b9aac30 531c79b
+Author: Sergey Sharybin <sergey.vfx at gmail.com>
+Date:   Fri Feb 17 18:32:52 2012 +0600
+
+    Merge remote-tracking branch 'Matthias-Fauconneau/master' into devel
+    
+    Conflicts:
+    	src/libmv/tracking/CMakeLists.txt
+
+commit b9aac30a9ca6bc8362c09a0e191040964f7c6de2
+Merge: 198894e 6969e1a
+Author: Keir Mierle <mierle at gmail.com>
+Date:   Sat Nov 5 17:38:30 2011 -0700
+
+    Merge pull request #3 from nathanwiegand/master
+    
+    Just a few tiny cleanups
+
+commit 6969e1a9534291a982749baa5a3672c97bfa506d
+Author: Nathan Wiegand <nathanwiegand at gmail.com>
+Date:   Sat Nov 5 14:26:54 2011 -0700
+
+    I've added cleaned up a few style issues here an there. Also, I've updated the CMakeLists.txt file so that it can build the image_io library. Note, it's only been tested on OSX 10.6
+
+commit 4763f851299050140757bfaa069107a0cf639e56
+Author: Nathan Wiegand <nathanwiegand at gmail.com>
+Date:   Fri Nov 4 23:59:08 2011 -0700
+
+    Removed a superfulous comment
+
+commit a44577c0162e273681e4a9a3cc5f5b37d4315b67
+Author: Nathan Wiegand <nathanwiegand at gmail.com>
+Date:   Fri Nov 4 23:55:52 2011 -0700
+
+    Removed a duplicate entry for an author.
+
+commit 198894e4c4f51c2c1784ad7c02eb45d2d1ada9bc
+Merge: c4c67db 6e797d6
+Author: Keir Mierle <mierle at gmail.com>
+Date:   Fri Nov 4 21:47:05 2011 -0700
+
+    Merge pull request #2 from nathanwiegand/master
+    
+    CMake changes for OSX
+
+commit 6e797d678c4c19f6a9e21657d66183f412cc995b
+Author: Nathan Wiegand <nathanwiegand at gmail.com>
+Date:   Fri Nov 4 21:43:28 2011 -0700
+
+    Uncomment the GUI part of the CMake file
+
+commit 33ef88a33860345d8906f3c9dd22d8dbce3df53e
+Author: Nathan Wiegand <nathanwiegand at gmail.com>
+Date:   Fri Nov 4 21:31:22 2011 -0700
+
+    Fixed build error on OSX by adding 'glog' to the dependencies in the tracker CMake
+
 commit 531c79bf95fddaaa70707d1abcd4fdafda16bbf0
 Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
 Date:   Sat Aug 20 00:00:42 2011 +0200
@@ -45,268 +526,3 @@ Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
 Date:   Fri Aug 19 14:59:24 2011 +0200
 
     Expose regularization parameters (areaPenalty and conditionPenalty) in API.
-
-commit 3e84ae5fbac10451d4935418f6281a90cedace11
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Fri Aug 19 14:19:27 2011 +0200
-
-    Add LaplaceFilter.
-    Add regularization in affine SAD Tracker (keep constant area and good condition number).
-    UI: Better track display (+enable line antialiasing).
-
-commit 6d26d9a8ccc4ce009fbf253898fea8864dd5001a
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Fri Aug 19 10:25:26 2011 +0200
-
-    Add optimization for integer pixel search.
-    Allows more agressive settings for affine coordinate descent.
-
-commit 70ceae81c0ab561b07e640ecb9933f0a902b57cd
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Fri Aug 19 00:02:12 2011 +0200
-
-    Document coordinate descent method in affine SAD matcher.
-    Add heuristic to prevent high distortions.
-
-commit 75520f4bc4ccbb272a1b4149d3b8d05a90f7f896
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Thu Aug 18 23:14:17 2011 +0200
-
-    Fix affine iteration.
-
-commit 4e8e0aa6018e3eb2fbebdad7f1cbd6c909d26e79
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Thu Aug 18 23:03:26 2011 +0200
-
-    Handle rotations.
-
-commit 3ce41cf3c1b5c136a61d8f4c63ccae3cafbdb8da
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Thu Aug 18 22:24:47 2011 +0200
-
-    Slow brute-force affine diamond search implementation.
-
-commit 1c4acd03e030c1c50dc6fc36c419c72ea69a0713
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Thu Aug 18 20:51:43 2011 +0200
-
-    Fix detect.cc.
-
-commit ec18cc5ea9ae2e641075a847e82d0aacb8415ad8
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Thu Aug 18 17:45:37 2011 +0200
-
-    Compute and return Pearson product-moment correlation coefficient between reference and matched pattern.
-
-commit 21d4245c63a01bfc736192d55baf10983e7c9ec7
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Thu Aug 18 16:18:44 2011 +0200
-
-    UI and API support for affine tracking.
-
-commit a4876d8c40dcde615b44009c38c49e9a1b1d4698
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Wed Aug 17 20:26:01 2011 +0200
-
-    Hack to make sad.cc compile with MSVC on system without support for the SSE instruction set.
-
-commit 0de723dfce5bbe44dbd19be8cd6dd6e9b03b7924
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Wed Aug 17 20:10:46 2011 +0200
-
-    Fix slow path (for computers without SSE2).
-    Heap allocate scores in detect.cc
-
-commit 65a9d496f81e8b37eae39a4063957b8be9a4e6f0
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Wed Aug 17 19:25:17 2011 +0200
-
-    Fix compilation on OSX.
-
-commit d22720e618456329388d2c107422c3b371657cba
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Wed Aug 17 14:14:45 2011 +0200
-
-    Improve Detect and SAD Tracker API and documentation.
-
-commit 5d6cd4ad365b061901bad40695b51d568487a0cf
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Wed Aug 17 11:57:29 2011 +0200
-
-    MSVC support fixes.
-
-commit 50f0323173c6deebd6aaf9c126f0b51b2a79c3c1
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Tue Aug 16 23:21:37 2011 +0200
-
-    Detector can detect features similar to a given pattern.
-
-commit 5734cc27bbf84c2b6edcfcc1ea736798e12d5820
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Tue Aug 16 22:53:54 2011 +0200
-
-    Ensure SAD Tracker is C compatible.
-    Update Detect API documentation.
-
-commit 701c42842574064fea992f8822e3899cb9066108
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Tue Aug 16 21:56:42 2011 +0200
-
-    Remove FAST detector.
-    Add Moravec detector.
-    This detector is more suited to tracking since it try to choose patterns which are unlikely to drift by computing SAD with neighbouring patches.
-    It could be improved to better avoid edges.
-
-commit 9bdf93e13fc880c78b6f34397da673388c16040e
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Tue Aug 16 21:55:08 2011 +0200
-
-    Fix Qt Tracker GL to work with AMD drivers.
-
-commit 81613ee0cc94b315f333c9632b18b95d426aad05
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Tue Aug 16 21:54:12 2011 +0200
-
-    Make CameraIntrinsics (and thus Qt tracker) compilable without linking libmv.
-
-commit a1d9a8fa8b01ef7cf2a79b3b891633fc333fc9cf
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Tue Aug 16 21:24:51 2011 +0200
-
-    Fix SAD tracker. Pattern was transposed by affine pattern sampler.
-
-commit c3b794da2e7fd23f2fbdf90dbd71de0e6b3bc811
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Tue Aug 16 21:19:02 2011 +0200
-
-    Fix SAD tracker. Pattern was transposed by affine pattern sampler.
-
-commit a9b61bf3356f27174cdd983f562f99c3a6a2cc35
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Sun Aug 14 09:56:51 2011 +0200
-
-    Clarify CameraIntrinsics documentation.
-    Edit CameraInstrinsics test to fail.
-
-commit 10bdad9ad2cea2603896263cde5a5339169a9af0
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Fri Aug 12 21:05:32 2011 +0200
-
-    Fix out of bound access in warp bilinear sampling.
-
-commit dd9a418db021a28af2c1198d5e5b9e68fe048a03
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Fri Aug 12 19:14:36 2011 +0200
-
-    Fix compilation with -funsigned-char.
-
-commit bd1a268ede39b67f2ba4b360f6fc693419e7cd7f
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Fri Aug 12 18:39:27 2011 +0200
-
-    CameraIntrinsics fixes.
-
-commit ae513b39fb779632f96ceff7c1e014fb8e68702a
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Tue Aug 9 19:38:58 2011 +0200
-
-    Remove stray QDebug include.
-
-commit 1e58f55078ce6009a885be30ae0316aec6ed8239
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Tue Aug 9 14:16:31 2011 +0200
-
-    Make API future-proof (for an eventual affine or planar tracker).
-
-commit c2af303e7bf0dddcb02937323ac5846b1801e6cc
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Tue Aug 9 11:13:29 2011 +0200
-
-    Remove reconstruction breaking debug code.
-
-commit 8792a633e5c5f1c1f12e164b9e8897ca0790ac59
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Tue Aug 9 10:49:18 2011 +0200
-
-    Remove getchar()s.
-
-commit 63a9bdee0cbd1197e0315d01c27bfc2361bd5656
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Tue Aug 9 10:35:07 2011 +0200
-
-    Adapt patch to new PipelineRoutines code generation strategy.
-
-commit 096ff1a4070f7212c50fb0a4b2feec7ca9d97158
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Tue Aug 9 09:54:12 2011 +0200
-
-    Merge max_image and max_track fix from tomato.
-
-commit d8450cd3c37278a397482cd36b1e2419f154cfb9
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Tue Aug 9 09:38:49 2011 +0200
-
-    Synchronize tree with Tomato: Merge patch for better resection, keep deprecated KLT tracker.
-
-commit e9b2dca920cf9575c15150a4988634b00e343a41
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Mon Aug 8 17:07:08 2011 +0200
-
-    Fixes, Documentation.
-
-commit 4fc1c57a2d92442808ac4a3676e6d9a25a51e310
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Sun Aug 7 14:35:08 2011 +0200
-
-    Improve tracker resilience by penalizing large motion vectors.
-
-commit cc8e7e8e08cd91f75c080a0091461ca9fe969664
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Sun Aug 7 09:28:09 2011 +0200
-
-    Leverage SSE2 SAD instruction for 16x speed improvement in integer pixel search resulting in ~1ms per marker for 16x16 pattern on 128x128 region.
-
-commit f362ab4999a768370fca57552464b459eb9fbddc
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Sun Aug 7 09:06:04 2011 +0200
-
-    Improve SAD Tracker subpixel precision (avoid drift even when adapting at each frame).
-
-commit fce7a214c561b5f5f0e17115c31fb48814bde2db
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Sat Aug 6 21:57:06 2011 +0200
-
-    Track using simple Sum of Absolute Differences matching.
-    This method is simpler, more robust, faster and accurate.
-
-commit 620a7a35d9a2818bf6e9dbf5d11debda4be6bc26
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Fri Jul 29 12:35:57 2011 +0200
-
-    Add Intersect unit test.
-
-commit a2bf58fa57be11215eb17ff7f7de58f97d480ec3
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Thu Jul 28 11:08:06 2011 +0200
-
-    Remove tests depending on dead code.
-    Fix CameraIntrinsics test.
-    Add Intersect and Resect tests.
-
-commit 19bddee10b4879c8cd2238ccdf5b8f7620cf8384
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Wed Jul 27 12:07:21 2011 +0200
-
-    Image Distortion: Fixes and more testing.
-
-commit 0454d97da328fb0eda8c6c50511ac31864a6d3d6
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Wed Jul 27 10:32:37 2011 +0200
-
-    Test float image distortion.
-
-commit 8db01595a8721f766d85931a8d92b780461d8741
-Author: Matthias Fauconneau <matthias.fauconneau at gmail.com>
-Date:   Wed Jul 27 10:27:07 2011 +0200
-
-    Image Distortion: Bilinear sampling, Optimization, Instantiate all variants (Distort/Undistort, float/ubyte, 1-4 channels).
diff --git a/extern/libmv/SConscript b/extern/libmv/SConscript
index fbcd925..fbb6ee3 100644
--- a/extern/libmv/SConscript
+++ b/extern/libmv/SConscript
@@ -34,7 +34,7 @@ incs = '. ../Eigen3'
 incs += ' ' + env['BF_PNG_INC']
 incs += ' ' + env['BF_ZLIB_INC']
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
     if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
         incs += ' ./third_party/msinttypes'
diff --git a/extern/libmv/bundle.sh b/extern/libmv/bundle.sh
index f5cfcc0..30d08cd 100755
--- a/extern/libmv/bundle.sh
+++ b/extern/libmv/bundle.sh
@@ -1,7 +1,8 @@
 #!/bin/sh
 
 #BRANCH="keir"
-BRANCH="Matthias-Fauconneau"
+#BRANCH="Matthias-Fauconneau"
+BRANCH="Nazg-Gul"
 
 if [ -d ./.svn ]; then
   echo "This script is supposed to work only when using git-svn"
@@ -24,7 +25,7 @@ done
 rm -rf libmv
 rm -rf third_party
 
-cat "files.txt" | while f=`line`; do
+cat "files.txt" | while read f; do
   mkdir -p `dirname $f`
   cp $tmp/libmv/src/$f $f
 done
@@ -36,14 +37,14 @@ chmod 664 ./third_party/glog/src/windows/*.cc ./third_party/glog/src/windows/*.h
 sources=`find ./libmv -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | sed -r 's/^\.\//\t/' | sort -d`
 headers=`find ./libmv -type f -iname '*.h' | sed -r 's/^\.\//\t/' | sort -d`
 
-third_sources=`find ./third_party -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | grep -v glog | sed -r 's/^\.\//\t/' | sort`
-third_headers=`find ./third_party -type f -iname '*.h' | grep -v glog | sed -r 's/^\.\//\t/' | sort`
+third_sources=`find ./third_party -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | grep -v glog | sed -r 's/^\.\//\t/' | sort -d`
+third_headers=`find ./third_party -type f -iname '*.h' | grep -v glog | sed -r 's/^\.\//\t/' | sort -d`
 
-third_glog_sources=`find ./third_party -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | grep glog | grep -v windows | sed -r 's/^\.\//\t\t/' | sort`
-third_glog_headers=`find ./third_party -type f -iname '*.h' | grep glog | grep -v windows | sed -r 's/^\.\//\t\t/' | sort`
+third_glog_sources=`find ./third_party -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | grep glog | grep -v windows | sed -r 's/^\.\//\t\t/' | sort -d`
+third_glog_headers=`find ./third_party -type f -iname '*.h' | grep glog | grep -v windows | sed -r 's/^\.\//\t\t/' | sort -d`
 
-src_dir=`find ./libmv -type f -iname '*.cc' -exec dirname {} \; -or -iname '*.cpp' -exec dirname {} \; -or -iname '*.c' -exec dirname {} \; | sed -r 's/^\.\//\t/' | sort | uniq`
-src_third_dir=`find ./third_party -type f -iname '*.cc' -exec dirname {} \; -or -iname '*.cpp' -exec dirname {} \; -or -iname '*.c' -exec dirname {} \; | sed -r 's/^\.\//\t/'  | sort | uniq`
+src_dir=`find ./libmv -type f -iname '*.cc' -exec dirname {} \; -or -iname '*.cpp' -exec dirname {} \; -or -iname '*.c' -exec dirname {} \; | sed -r 's/^\.\//\t/' | sort -d | uniq`
+src_third_dir=`find ./third_party -type f -iname '*.cc' -exec dirname {} \; -or -iname '*.cpp' -exec dirname {} \; -or -iname '*.c' -exec dirname {} \; | sed -r 's/^\.\//\t/'  | sort -d | uniq`
 src=""
 win_src=""
 for x in $src_dir $src_third_dir; do
@@ -103,7 +104,7 @@ cat > CMakeLists.txt << EOF
 #
 # You should have received a copy of the GNU 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.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2011, Blender Foundation
 # All rights reserved.
@@ -130,6 +131,19 @@ set(INC_SYS
 	\${ZLIB_INCLUDE_DIRS}
 )
 
+
+# XXX - FIXME
+# this is a momentary hack to find unwind.h in 10.6.sdk
+if(APPLE)
+	if(\${CMAKE_OSX_DEPLOYMENT_TARGET} STREQUAL "10.6")
+		list(APPEND INC_SYS
+			\${CMAKE_OSX_SYSROOT}/Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin10/4.2.1/include
+		)
+	endif()
+endif()
+# XXX - END
+
+
 set(SRC
 	libmv-capi.cpp
 ${sources}
@@ -234,7 +248,7 @@ incs = '. ../Eigen3'
 incs += ' ' + env['BF_PNG_INC']
 incs += ' ' + env['BF_ZLIB_INC']
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
     if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
         incs += ' ./third_party/msinttypes'
diff --git a/extern/libmv/files.txt b/extern/libmv/files.txt
index 96dfd89..1e564d3 100644
--- a/extern/libmv/files.txt
+++ b/extern/libmv/files.txt
@@ -6,6 +6,7 @@ libmv/image/array_nd.cc
 libmv/image/array_nd.h
 libmv/image/convolve.cc
 libmv/image/convolve.h
+libmv/image/correlation.h
 libmv/image/image.h
 libmv/image/sample.h
 libmv/image/tuple.h
@@ -47,6 +48,8 @@ libmv/simple_pipeline/reconstruction.cc
 libmv/simple_pipeline/reconstruction.h
 libmv/simple_pipeline/resect.cc
 libmv/simple_pipeline/resect.h
+libmv/simple_pipeline/rigid_registration.cc
+libmv/simple_pipeline/rigid_registration.h
 libmv/simple_pipeline/tracks.cc
 libmv/simple_pipeline/tracks.h
 libmv/tracking/brute_region_tracker.cc
@@ -64,8 +67,6 @@ libmv/tracking/pyramid_region_tracker.h
 libmv/tracking/region_tracker.h
 libmv/tracking/retrack_region_tracker.cc
 libmv/tracking/retrack_region_tracker.h
-libmv/tracking/sad.cc
-libmv/tracking/sad.h
 libmv/tracking/trklt_region_tracker.cc
 libmv/tracking/trklt_region_tracker.h
 third_party/fast/fast_10.c
@@ -78,14 +79,20 @@ third_party/fast/LICENSE
 third_party/fast/nonmax.c
 third_party/fast/README
 third_party/fast/README.libmv
+third_party/gflags/AUTHORS
+third_party/gflags/ChangeLog
 third_party/gflags/config.h
+third_party/gflags/COPYING
 third_party/gflags/gflags.cc
 third_party/gflags/gflags_completions.cc
-third_party/gflags/gflags_completions.h
-third_party/gflags/gflags.h
+third_party/gflags/gflags/gflags_completions.h
+third_party/gflags/gflags/gflags_declare.h
+third_party/gflags/gflags/gflags.h
 third_party/gflags/gflags_reporting.cc
 third_party/gflags/mutex.h
+third_party/gflags/NEWS
 third_party/gflags/README.libmv
+third_party/gflags/util.h
 third_party/glog/AUTHORS
 third_party/glog/ChangeLog
 third_party/glog/COPYING
@@ -97,6 +104,7 @@ third_party/glog/src/base/googleinit.h
 third_party/glog/src/base/mutex.h
 third_party/glog/src/config_freebsd.h
 third_party/glog/src/config.h
+third_party/glog/src/config_hurd.h
 third_party/glog/src/config_linux.h
 third_party/glog/src/config_mac.h
 third_party/glog/src/demangle.cc
diff --git a/extern/libmv/libmv-capi.cpp b/extern/libmv/libmv-capi.cpp
index 1835c53..e4708e5 100644
--- a/extern/libmv/libmv-capi.cpp
+++ b/extern/libmv/libmv-capi.cpp
@@ -30,11 +30,14 @@
 
 #include "libmv-capi.h"
 
+#include "third_party/gflags/gflags/gflags.h"
 #include "glog/logging.h"
 #include "libmv/logging/logging.h"
 
 #include "Math/v3d_optimization.h"
 
+#include "libmv/numeric/numeric.h"
+
 #include "libmv/tracking/esm_region_tracker.h"
 #include "libmv/tracking/brute_region_tracker.h"
 #include "libmv/tracking/hybrid_region_tracker.h"
@@ -43,8 +46,6 @@
 #include "libmv/tracking/lmicklt_region_tracker.h"
 #include "libmv/tracking/pyramid_region_tracker.h"
 
-#include "libmv/tracking/sad.h"
-
 #include "libmv/simple_pipeline/callbacks.h"
 #include "libmv/simple_pipeline/tracks.h"
 #include "libmv/simple_pipeline/initialize_reconstruction.h"
@@ -52,6 +53,7 @@
 #include "libmv/simple_pipeline/detect.h"
 #include "libmv/simple_pipeline/pipeline.h"
 #include "libmv/simple_pipeline/camera_intrinsics.h"
+#include "libmv/simple_pipeline/rigid_registration.h"
 
 #include <stdlib.h>
 #include <assert.h>
@@ -136,12 +138,25 @@ libmv_RegionTracker *libmv_hybridRegionTrackerNew(int max_iterations, int half_w
 	libmv::BruteRegionTracker *brute_region_tracker = new libmv::BruteRegionTracker;
 	brute_region_tracker->half_window_size = half_window_size;
 
+	/* do not use correlation check for brute checker itself,
+	 * this check will happen in esm tracker */
+	brute_region_tracker->minimum_correlation = 0.0;
+
 	libmv::HybridRegionTracker *hybrid_region_tracker =
 		new libmv::HybridRegionTracker(brute_region_tracker, esm_region_tracker);
 
 	return (libmv_RegionTracker *)hybrid_region_tracker;
 }
 
+libmv_RegionTracker *libmv_bruteRegionTrackerNew(int half_window_size, double minimum_correlation)
+{
+	libmv::BruteRegionTracker *brute_region_tracker = new libmv::BruteRegionTracker;
+	brute_region_tracker->half_window_size = half_window_size;
+	brute_region_tracker->minimum_correlation = minimum_correlation;
+
+	return (libmv_RegionTracker *)brute_region_tracker;
+}
+
 static void floatBufToImage(const float *buf, int width, int height, libmv::FloatImage *image)
 {
 	int x, y, a = 0;
@@ -315,33 +330,6 @@ void libmv_regionTrackerDestroy(libmv_RegionTracker *libmv_tracker)
 
 /* ************ Tracks ************ */
 
-void libmv_SADSamplePattern(unsigned char *image, int stride,
-			float warp[3][2], unsigned char *pattern, int pattern_size)
-{
-	libmv::mat32 mat32;
-
-	memcpy(mat32.data, warp, sizeof(float)*3*2);
-
-	libmv::SamplePattern(image, stride, mat32, pattern, pattern_size);
-}
-
-float libmv_SADTrackerTrack(unsigned char *pattern, unsigned char *warped, int pattern_size, unsigned char *image, int stride,
-			int width, int height, float warp[3][2])
-{
-	float result;
-	libmv::mat32 mat32;
-
-	memcpy(mat32.data, warp, sizeof(float)*3*2);
-
-	result = libmv::Track(pattern, warped, pattern_size, image, stride, width, height, &mat32, 16, 16);
-
-	memcpy(warp, mat32.data, sizeof(float)*3*2);
-
-	return result;
-}
-
-/* ************ Tracks ************ */
-
 libmv_Tracks *libmv_tracksNew(void)
 {
 	libmv::Tracks *libmv_tracks = new libmv::Tracks();
@@ -853,3 +841,56 @@ void libmv_InvertIntrinsics(double focal_length, double principal_x, double prin
 		intrinsics.InvertIntrinsics(x, y, x1, y1);
 	}
 }
+
+/* ************ point clouds ************ */
+
+void libmvTransformToMat4(libmv::Mat3 &R, libmv::Vec3 &S, libmv::Vec3 &t, double M[4][4])
+{
+	for (int j = 0; j < 3; ++j)
+		for (int k = 0; k < 3; ++k)
+			M[j][k] = R(k, j) * S(j);
+
+	for (int i = 0; i < 3; ++i) {
+		M[3][0] = t(0);
+		M[3][1] = t(1);
+		M[3][2] = t(2);
+
+		M[0][3] = M[1][3] = M[2][3] = 0;
+	}
+
+	M[3][3] = 1.0;
+}
+
+void libmv_rigidRegistration(float (*reference_points)[3], float (*points)[3], int total_points,
+                             int use_scale, int use_translation, double M[4][4])
+{
+	libmv::Mat3 R;
+	libmv::Vec3 S;
+	libmv::Vec3 t;
+	libmv::vector<libmv::Vec3> reference_points_vector, points_vector;
+
+	for (int i = 0; i < total_points; i++) {
+		reference_points_vector.push_back(libmv::Vec3(reference_points[i][0],
+		                                              reference_points[i][1],
+		                                              reference_points[i][2]));
+
+		points_vector.push_back(libmv::Vec3(points[i][0],
+		                                    points[i][1],
+		                                    points[i][2]));
+	}
+
+	if (use_scale && use_translation) {
+		libmv::RigidRegistration(reference_points_vector, points_vector, R, S, t);
+	}
+	else if (use_translation) {
+		S = libmv::Vec3(1.0, 1.0, 1.0);
+		libmv::RigidRegistration(reference_points_vector, points_vector, R, t);
+	}
+	else {
+		S = libmv::Vec3(1.0, 1.0, 1.0);
+		t = libmv::Vec3::Zero();
+		libmv::RigidRegistration(reference_points_vector, points_vector, R);
+	}
+
+	libmvTransformToMat4(R, S, t, M);
+}
diff --git a/extern/libmv/libmv-capi.h b/extern/libmv/libmv-capi.h
index e10d4ef..0101983 100644
--- a/extern/libmv/libmv-capi.h
+++ b/extern/libmv/libmv-capi.h
@@ -45,16 +45,11 @@ void libmv_setLoggingVerbosity(int verbosity);
 /* RegionTracker */
 struct libmv_RegionTracker *libmv_pyramidRegionTrackerNew(int max_iterations, int pyramid_level, int half_window_size, double minimum_correlation);
 struct libmv_RegionTracker *libmv_hybridRegionTrackerNew(int max_iterations, int half_window_size, double minimum_correlation);
+struct libmv_RegionTracker *libmv_bruteRegionTrackerNew(int half_window_size, double minimum_correlation);
 int libmv_regionTrackerTrack(struct libmv_RegionTracker *libmv_tracker, const float *ima1, const float *ima2,
 			int width, int height, double  x1, double  y1, double *x2, double *y2);
 void libmv_regionTrackerDestroy(struct libmv_RegionTracker *libmv_tracker);
 
-/* SAD Tracker */
-void libmv_SADSamplePattern(unsigned char *image, int stride,
-			float warp[3][2], unsigned char *pattern, int pattern_size);
-float libmv_SADTrackerTrack(unsigned char *pattern, unsigned char *warped, int pattern_size, unsigned char *image,
-			int stride, int width, int height, float warp[3][2]);
-
 /* Tracks */
 struct libmv_Tracks *libmv_tracksNew(void);
 void libmv_tracksInsert(struct libmv_Tracks *libmv_tracks, int image, int track, double x, double y);
@@ -134,6 +129,10 @@ void libmv_applyCameraIntrinsics(double focal_length, double principal_x, double
 void libmv_InvertIntrinsics(double focal_length, double principal_x, double principal_y, double k1, double k2, double k3,
 			double x, double y, double *x1, double *y1);
 
+/* point clouds */
+void libmv_rigidRegistration(float (*reference_points)[3], float (*points)[3], int total_points,
+                             int use_scale, int use_translation, double M[4][4]);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/extern/libmv/libmv/base/vector.h b/extern/libmv/libmv/base/vector.h
index 9dc4867..c2a3298 100644
--- a/extern/libmv/libmv/base/vector.h
+++ b/extern/libmv/libmv/base/vector.h
@@ -84,6 +84,8 @@ class vector {
         T& front()                 { return data_[0];         }
   const T& operator[](int n) const { return data_[n];         }
         T& operator[](int n)       { return data_[n];         }
+  const T& at(int n)         const { return data_[n];         }
+        T& at(int n)               { return data_[n];         }
   const T * begin()          const { return data_;            }
   const T * end()            const { return data_+size_;      }
         T * begin()                { return data_;            }
diff --git a/extern/libmv/libmv/image/correlation.h b/extern/libmv/libmv/image/correlation.h
new file mode 100644
index 0000000..9d6acee
--- /dev/null
+++ b/extern/libmv/libmv/image/correlation.h
@@ -0,0 +1,51 @@
+// Copyright (c) 2012 libmv authors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+
+#ifndef LIBMV_IMAGE_CORRELATION_H
+#define LIBMV_IMAGE_CORRELATION_H
+
+#include "libmv/image/image.h"
+
+namespace libmv {
+
+inline double PearsonProductMomentCorrelation(Array3Df image_and_gradient1_sampled,
+                                              Array3Df image_and_gradient2_sampled,
+                                              int width) {
+  double sX=0,sY=0,sXX=0,sYY=0,sXY=0;
+  for (int r = 0; r < width; ++r) {
+    for (int c = 0; c < width; ++c) {
+      double x = image_and_gradient1_sampled(r, c, 0);
+      double y = image_and_gradient2_sampled(r, c, 0);
+      sX += x;
+      sY += y;
+      sXX += x*x;
+      sYY += y*y;
+      sXY += x*y;
+    }
+  }
+  double N = width*width;
+  sX /= N, sY /= N, sXX /= N, sYY /= N, sXY /= N;
+  double correlation = (sXY-sX*sY)/sqrt(double((sXX-sX*sX)*(sYY-sY*sY)));
+  return correlation;
+}
+
+}  // namespace libmv
+
+#endif  // LIBMV_IMAGE_IMAGE_CORRELATION_H
diff --git a/extern/libmv/libmv/image/sample.h b/extern/libmv/libmv/image/sample.h
index cd36123..ea86edf 100644
--- a/extern/libmv/libmv/image/sample.h
+++ b/extern/libmv/libmv/image/sample.h
@@ -98,6 +98,24 @@ inline void DownsampleChannelsBy2(const Array3Df &in, Array3Df *out) {
 
 }
 
+// Sample a region centered at x,y in image with size extending by half_width
+// from x,y. Channels specifies the number of channels to sample from.
+inline void SamplePattern(const FloatImage &image,
+                   double x, double y,
+                   int half_width,
+                   int channels,
+                   FloatImage *sampled) {
+  sampled->Resize(2 * half_width + 1, 2 * half_width + 1, channels);
+  for (int r = -half_width; r <= half_width; ++r) {
+    for (int c = -half_width; c <= half_width; ++c) {
+      for (int i = 0; i < channels; ++i) {
+        (*sampled)(r + half_width, c + half_width, i) =
+            SampleLinear(image, y + r, x + c, i);
+      }
+    }
+  }
+}
+
 }  // namespace libmv
 
 #endif  // LIBMV_IMAGE_SAMPLE_H_
diff --git a/extern/libmv/libmv/logging/logging.h b/extern/libmv/libmv/logging/logging.h
index af86c4b..776d9d5 100644
--- a/extern/libmv/libmv/logging/logging.h
+++ b/extern/libmv/libmv/logging/logging.h
@@ -21,7 +21,7 @@
 #ifndef LIBMV_LOGGING_LOGGING_H
 #define LIBMV_LOGGING_LOGGING_H
 
-#include "glog/logging.h"
+#include <glog/logging.h>
 
 #define LG LOG(INFO)
 #define V0 LOG(INFO)
diff --git a/extern/libmv/libmv/numeric/numeric.h b/extern/libmv/libmv/numeric/numeric.h
index bb7f9b3..d2cadf4 100644
--- a/extern/libmv/libmv/numeric/numeric.h
+++ b/extern/libmv/libmv/numeric/numeric.h
@@ -33,7 +33,7 @@
 #include <Eigen/QR>
 #include <Eigen/SVD>
 
-#if _WIN32 || __APPLE__ || __FreeBSD__
+#if (defined(_WIN32) || defined(__APPLE__) || defined(__FreeBSD__)) && !defined(__MINGW64__)
   void static sincos (double x, double *sinx, double *cosx) {
     *sinx = sin(x);
     *cosx = cos(x);
@@ -474,6 +474,17 @@ inline Mat23 SkewMatMinimal(const Vec2 &x) {
           1, 0, -x(0);
   return skew;
 }
+
+/// Returns the rotaiton matrix built from given vector of euler angles
+inline Mat3 RotationFromEulerVector(Vec3 euler_vector) {
+  double theta = euler_vector.norm();
+  if (theta == 0.0) {
+    return Mat3::Identity();
+  }
+  Vec3 w = euler_vector / theta;
+  Mat3 w_hat = CrossProductMatrix(w);
+  return Mat3::Identity() + w_hat*sin(theta) + w_hat*w_hat*(1 - cos(theta));
+}
 } // namespace libmv
 
 #endif  // LIBMV_NUMERIC_NUMERIC_H
diff --git a/extern/libmv/libmv/simple_pipeline/pipeline.cc b/extern/libmv/libmv/simple_pipeline/pipeline.cc
index 382365e..2459d05 100644
--- a/extern/libmv/libmv/simple_pipeline/pipeline.cc
+++ b/extern/libmv/libmv/simple_pipeline/pipeline.cc
@@ -279,7 +279,7 @@ double InternalReprojectionError(const Tracks &image_tracks,
         PipelineRoutines::ProjectMarker(*point, *camera, intrinsics);
     double ex = reprojected_marker.x - markers[i].x;
     double ey = reprojected_marker.y - markers[i].y;
-#if 0
+
     const int N = 100;
     char line[N];
     snprintf(line, N,
@@ -297,7 +297,8 @@ double InternalReprojectionError(const Tracks &image_tracks,
            ex,
            ey,
            sqrt(ex*ex + ey*ey));
-#endif
+    LG << line;
+
     total_error += sqrt(ex*ex + ey*ey);
   }
   LG << "Skipped " << num_skipped << " markers.";
diff --git a/extern/libmv/libmv/simple_pipeline/resect.cc b/extern/libmv/libmv/simple_pipeline/resect.cc
index 6e71c3c..b30d959 100644
--- a/extern/libmv/libmv/simple_pipeline/resect.cc
+++ b/extern/libmv/libmv/simple_pipeline/resect.cc
@@ -42,16 +42,6 @@ Mat2X PointMatrixFromMarkers(const vector<Marker> &markers) {
   return points;
 }
 
-Mat3 RotationFromEulerVector(Vec3 euler_vector) {
-  double theta = euler_vector.norm();
-  if (theta == 0.0) {
-    return Mat3::Identity();
-  }
-  Vec3 w = euler_vector / theta;
-  Mat3 w_hat = CrossProductMatrix(w);
-  return Mat3::Identity() + w_hat*sin(theta) + w_hat*w_hat*(1 - cos(theta));
-}
-
 // Uses an incremental rotation:
 //
 //   x = R' * R * X + t;
diff --git a/extern/libmv/libmv/simple_pipeline/rigid_registration.cc b/extern/libmv/libmv/simple_pipeline/rigid_registration.cc
new file mode 100644
index 0000000..f7cb1e6
--- /dev/null
+++ b/extern/libmv/libmv/simple_pipeline/rigid_registration.cc
@@ -0,0 +1,182 @@
+// Copyright (c) 2012 libmv authors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+
+#include "libmv/simple_pipeline/rigid_registration.h"
+#include "libmv/numeric/levenberg_marquardt.h"
+
+namespace libmv {
+
+template<class RigidTransformation>
+struct RigidRegistrationCostFunction {
+ public:
+  typedef Vec FMatrixType;
+  typedef RigidTransformation XMatrixType;
+
+  RigidRegistrationCostFunction(const vector<Vec3> &reference_points,
+                                const vector<Vec3> &points):
+    reference_points_(reference_points),
+    points_(points) {}
+
+  Vec CalculateResiduals(const Mat3 &R,
+                         const Vec3 &S,
+                         const Vec3 &t) const {
+    Vec residuals(points_.size());
+    residuals.setZero();
+
+    // Convert scale vector to matrix
+    Mat3 SMat = Mat3::Identity();
+    SMat(0, 0) *= S(0);
+    SMat(1, 1) *= S(1);
+    SMat(2, 2) *= S(2);
+
+    for (int i = 0; i < points_.size(); i++) {
+      Vec3 transformed_point = R * SMat * points_[i] + t;
+
+      double norm = (transformed_point - reference_points_[i]).norm();
+
+      residuals(i) = norm * norm;
+    }
+
+    return residuals;
+  }
+
+  Vec operator()(const Vec9 &RSt) const {
+    Mat3 R = RotationFromEulerVector(RSt.head<3>());
+    Vec3 S = RSt.segment<3>(3);
+    Vec3 t = RSt.tail<3>();
+
+    return CalculateResiduals(R, S, t);
+  }
+
+  Vec operator()(const Vec3 &euler) const {
+    Mat3 R = RotationFromEulerVector(euler);
+
+    return CalculateResiduals(R, Vec3(1.0, 1.0, 1.0), Vec3::Zero());
+  }
+
+  Vec operator()(const Vec6 &Rt) const {
+    Mat3 R = RotationFromEulerVector(Rt.head<3>());
+    Vec3 t = Rt.tail<3>();
+
+    return CalculateResiduals(R, Vec3(1.0, 1.0, 1.0), t);
+  }
+
+ private:
+  vector<Vec3> reference_points_;
+  vector<Vec3> points_;
+};
+
+static double RigidRegistrationError(const vector<Vec3> &reference_points,
+                                     const vector<Vec3> &points,
+                                     const Mat3 &R,
+                                     const Vec3 &S,
+                                     const Vec3 &t) {
+  double error = 0.0;
+
+  Mat3 SMat = Mat3::Identity();
+  SMat(0, 0) *= S(0);
+  SMat(1, 1) *= S(1);
+  SMat(2, 2) *= S(2);
+
+  for (int i = 0; i < points.size(); i++) {
+    Vec3 new_point = R * SMat * points[i] + t;
+
+    double norm = (new_point - reference_points[i]).norm();
+    error += norm * norm;
+  }
+  error /= points.size();
+
+  return error;
+}
+
+double RigidRegistration(const vector<Vec3> &reference_points,
+                         const vector<Vec3> &points,
+                         Mat3 &R,
+                         Vec3 &S,
+                         Vec3 &t) {
+  typedef LevenbergMarquardt<RigidRegistrationCostFunction <Vec9> > Solver;
+
+  RigidRegistrationCostFunction<Vec9> rigidregistration_cost(reference_points, points);
+  Solver solver(rigidregistration_cost);
+
+  Vec9 RSt = Vec9::Zero();
+
+  RSt(3) = RSt(4) = RSt(5) = 1.0;
+
+  Solver::SolverParameters params;
+  /*Solver::Results results = */ solver.minimize(params, &RSt);
+  /* TODO(sergey): better error handling here */
+
+  LG << "Rigid registration completed, rotation is:" << RSt.head<3>().transpose()
+    << ", scale is " << RSt.segment<3>(3).transpose()
+    << ", translation is " << RSt.tail<3>().transpose();
+
+  // Decompose individual rotation and translation
+  R = RotationFromEulerVector(RSt.head<3>());
+  S = RSt.segment<3>(3);
+  t = RSt.tail<3>();
+
+  return RigidRegistrationError(reference_points, points, R, S, t);
+}
+
+double RigidRegistration(const vector<Vec3> &reference_points,
+                         const vector<Vec3> &points,
+                         Mat3 &R,
+                         Vec3 &t) {
+  typedef LevenbergMarquardt<RigidRegistrationCostFunction <Vec6> > Solver;
+
+  RigidRegistrationCostFunction<Vec6> rigidregistration_cost(reference_points, points);
+  Solver solver(rigidregistration_cost);
+
+  Vec6 Rt = Vec6::Zero();
+  Solver::SolverParameters params;
+  /*Solver::Results results = */solver.minimize(params, &Rt);
+  /* TODO(sergey): better error handling here */
+
+  LG << "Rigid registration completed, rotation is:" << Rt.head<3>().transpose()
+    << ", translation is " << Rt.tail<3>().transpose();
+
+  R = RotationFromEulerVector(Rt.head<3>());
+  t = Rt.tail<3>();
+
+  return RigidRegistrationError(reference_points, points, R, Vec3(1.0, 1.0, 1.0), t);
+}
+
+double RigidRegistration(const vector<Vec3> &reference_points,
+                         const vector<Vec3> &points,
+                         Mat3 &R) {
+  typedef LevenbergMarquardt<RigidRegistrationCostFunction <Vec3> > Solver;
+
+  RigidRegistrationCostFunction<Vec3> rigidregistration_cost(reference_points, points);
+  Solver solver(rigidregistration_cost);
+
+  Vec3 euler = Vec3::Zero();
+  Solver::SolverParameters params;
+  /*Solver::Results results = */solver.minimize(params, &euler);
+  /* TODO(sergey): better error handling here */
+
+  LG << "Rigid registration completed, rotation is:" << euler.transpose();
+
+  R = RotationFromEulerVector(euler);
+
+  return RigidRegistrationError(reference_points, points, R, Vec3(1.0, 1.0, 1.0), Vec3::Zero());
+}
+
+}  // namespace libmv
diff --git a/extern/libmv/libmv/simple_pipeline/rigid_registration.h b/extern/libmv/libmv/simple_pipeline/rigid_registration.h
new file mode 100644
index 0000000..21ea57a
--- /dev/null
+++ b/extern/libmv/libmv/simple_pipeline/rigid_registration.h
@@ -0,0 +1,68 @@
+// Copyright (c) 2012 libmv authors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+
+#ifndef LIBMV_SIMPLE_PIPELINE_RIGID_REGISTRATION_H_
+#define LIBMV_SIMPLE_PIPELINE_RIGID_REGISTRATION_H_
+
+#include "libmv/base/vector.h"
+#include "libmv/numeric/numeric.h"
+
+namespace libmv {
+
+/*!
+    Searched for an affine transformation of rigid 3D object defined by it's
+    vertices positions from it's current state called points to it's desired
+    state called reference points.
+
+    Returns rotation matrix, per-component scale vector and translation which
+    transforms points to the mot close state to reference_points.
+
+    Return value is an average squared distance between reference state
+    and transformed one.
+
+    Minimzation of distance between point pairs is used to register such a
+    rigid transformation and algorithm assumes that pairs of points are
+    defined by point's index in a vector, so points with the same index
+    belongs to the same pair.
+ */
+double RigidRegistration(const vector<Vec3> &reference_points,
+                         const vector<Vec3> &points,
+                         Mat3 &R,
+                         Vec3 &S,
+                         Vec3 &t);
+
+/*!
+ * Same as RigidRegistration but provides registration of rotation and translation only
+ */
+double RigidRegistration(const vector<Vec3> &reference_points,
+                         const vector<Vec3> &points,
+                         Mat3 &R,
+                         Vec3 &t);
+
+/*!
+ * Same as RigidRegistration but provides registration of rotation only
+ */
+double RigidRegistration(const vector<Vec3> &reference_points,
+                         const vector<Vec3> &points,
+                         Mat3 &R);
+
+}  // namespace libmv
+
+#endif  // LIBMV_SIMPLE_PIPELINE_RIGID_REGISTRATION_H_
diff --git a/extern/libmv/libmv/simple_pipeline/tracks.h b/extern/libmv/libmv/simple_pipeline/tracks.h
index 739c3c4..aa0fbaa 100644
--- a/extern/libmv/libmv/simple_pipeline/tracks.h
+++ b/extern/libmv/libmv/simple_pipeline/tracks.h
@@ -27,13 +27,13 @@ namespace libmv {
 
 /*!
     A Marker is the 2D location of a tracked point in an image.
-  
+
     \a x, \a y is the position of the marker in pixels from the top left corner
     in the image identified by \a image. All markers for to the same target
     form a track identified by a common \a track number.
-  
+
     \note Markers are typically aggregated with the help of the \l Tracks class.
-  
+
     \sa Tracks
 */
 struct Marker {
@@ -44,18 +44,18 @@ struct Marker {
 
 /*!
     The Tracks class stores \link Marker reconstruction markers \endlink.
-    
+
     The Tracks container is intended as the store of correspondences between
     images, which must get created before any 3D reconstruction can take place.
-    
+
     The container has several fast lookups for queries typically needed for
     structure from motion algorithms, such as \l MarkersForTracksInBothImages().
-    
+
     \sa Marker
 */
 class Tracks {
  public:
-  Tracks() {}
+  Tracks() { }
 
   // Copy constructor for a tracks object.
   Tracks(const Tracks &other);
@@ -67,10 +67,10 @@ class Tracks {
       Inserts a marker into the set. If there is already a marker for the given
       \a image and \a track, the existing marker is replaced. If there is no
       marker for the given \a image and \a track, a new one is added.
-    
+
       \a image and \a track are the keys used to retrieve the markers with the
       other methods in this class.
-    
+
       \note To get an identifier for a new track, use \l MaxTrack() + 1.
   */
   void Insert(int image, int track, double x, double y);
@@ -86,7 +86,7 @@ class Tracks {
 
   /*!
       Returns the markers in \a image1 and \a image2 which have a common track.
-      
+
       This is not the same as the union of the markers in \a image1 and \a
       image2; each marker is for a track that appears in both images.
   */
diff --git a/extern/libmv/libmv/tracking/brute_region_tracker.cc b/extern/libmv/libmv/tracking/brute_region_tracker.cc
index a416710..af7f673 100644
--- a/extern/libmv/libmv/tracking/brute_region_tracker.cc
+++ b/extern/libmv/libmv/tracking/brute_region_tracker.cc
@@ -44,6 +44,7 @@
 
 #include "libmv/image/image.h"
 #include "libmv/image/convolve.h"
+#include "libmv/image/correlation.h"
 #include "libmv/image/sample.h"
 #include "libmv/logging/logging.h"
 
@@ -332,6 +333,29 @@ bool BruteRegionTracker::Track(const FloatImage &image1,
   if (best_sad != INT_MAX) {
     *x2 = best_j + half_window_size;
     *y2 = best_i + half_window_size;
+
+    if (minimum_correlation > 0) {
+      Array3Df image_and_gradient1_sampled, image_and_gradient2_sampled;
+
+      SamplePattern(image_and_gradient1, x1, y1, half_window_size, 3,
+                    &image_and_gradient1_sampled);
+      SamplePattern(image_and_gradient2, *x2, *y2, half_window_size, 3,
+                    &image_and_gradient2_sampled);
+
+      // Compute the Pearson product-moment correlation coefficient to check
+      // for sanity.
+      double correlation = PearsonProductMomentCorrelation(image_and_gradient1_sampled,
+                                                           image_and_gradient2_sampled,
+                                                           pattern_width);
+      LG << "Final correlation: " << correlation;
+
+      if (correlation < minimum_correlation) {
+        LG << "Correlation " << correlation << " greater than "
+           << minimum_correlation << "; bailing.";
+        return false;
+      }
+    }
+
     return true;
   }
   return false;
diff --git a/extern/libmv/libmv/tracking/brute_region_tracker.h b/extern/libmv/libmv/tracking/brute_region_tracker.h
index 7a9b06d..8ff0c1b 100644
--- a/extern/libmv/libmv/tracking/brute_region_tracker.h
+++ b/extern/libmv/libmv/tracking/brute_region_tracker.h
@@ -27,7 +27,9 @@
 namespace libmv {
 
 struct BruteRegionTracker : public RegionTracker {
-  BruteRegionTracker() : half_window_size(4) {}
+  BruteRegionTracker()
+      : half_window_size(4),
+      minimum_correlation(0.78) {}
   
   virtual ~BruteRegionTracker() {}
 
@@ -39,6 +41,7 @@ struct BruteRegionTracker : public RegionTracker {
 
   // No point in creating getters or setters.
   int half_window_size;
+  double minimum_correlation;
 };
 
 }  // namespace libmv
diff --git a/extern/libmv/libmv/tracking/esm_region_tracker.cc b/extern/libmv/libmv/tracking/esm_region_tracker.cc
index 9784b61..e0b85f1 100644
--- a/extern/libmv/libmv/tracking/esm_region_tracker.cc
+++ b/extern/libmv/libmv/tracking/esm_region_tracker.cc
@@ -18,6 +18,7 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 // IN THE SOFTWARE.
 
+/* needed for M_E when building with msvc */
 #define _USE_MATH_DEFINES
 
 #include "libmv/tracking/esm_region_tracker.h"
@@ -25,6 +26,7 @@
 #include "libmv/logging/logging.h"
 #include "libmv/image/image.h"
 #include "libmv/image/convolve.h"
+#include "libmv/image/correlation.h"
 #include "libmv/image/sample.h"
 #include "libmv/numeric/numeric.h"
 
@@ -54,24 +56,6 @@ static bool RegionIsInBounds(const FloatImage &image1,
   return true;
 }
 
-// Sample a region centered at x,y in image with size extending by half_width
-// from x,y. Channels specifies the number of channels to sample from.
-static void SamplePattern(const FloatImage &image,
-                   double x, double y,
-                   int half_width,
-                   int channels,
-                   FloatImage *sampled) {
-  sampled->Resize(2 * half_width + 1, 2 * half_width + 1, channels);
-  for (int r = -half_width; r <= half_width; ++r) {
-    for (int c = -half_width; c <= half_width; ++c) {
-      for (int i = 0; i < channels; ++i) {
-        (*sampled)(r + half_width, c + half_width, i) =
-            SampleLinear(image, y + r, x + c, i);
-      }
-    }
-  }
-}
-
 // Estimate "reasonable" error by computing autocorrelation for a small shift.
 // TODO(keir): Add a facility for 
 static double EstimateReasonableError(const FloatImage &image,
@@ -275,22 +259,9 @@ bool EsmRegionTracker::Track(const FloatImage &image1,
     if (d.squaredNorm() < min_update_squared_distance) {
       // Compute the Pearson product-moment correlation coefficient to check
       // for sanity.
-      // TODO(keir): Put this somewhere smarter.
-      double sX=0,sY=0,sXX=0,sYY=0,sXY=0;
-      for (int r = 0; r < width; ++r) {
-        for (int c = 0; c < width; ++c) {
-          double x = image_and_gradient1_sampled(r, c, 0);
-          double y = image_and_gradient2_sampled[new_image](r, c, 0);
-          sX += x;
-          sY += y;
-          sXX += x*x;
-          sYY += y*y;
-          sXY += x*y;
-        }
-      }
-      double N = width*width;
-      sX /= N, sY /= N, sXX /= N, sYY /= N, sXY /= N;
-      double correlation = (sXY-sX*sY)/sqrt(double((sXX-sX*sX)*(sYY-sY*sY)));
+      double correlation = PearsonProductMomentCorrelation(image_and_gradient1_sampled,
+                                                           image_and_gradient2_sampled[new_image],
+                                                           width);
       LG << "Final correlation: " << correlation;
 
       if (correlation < minimum_correlation) {
diff --git a/extern/libmv/libmv/tracking/lmicklt_region_tracker.cc b/extern/libmv/libmv/tracking/lmicklt_region_tracker.cc
index c06a1d3..581e984 100644
--- a/extern/libmv/libmv/tracking/lmicklt_region_tracker.cc
+++ b/extern/libmv/libmv/tracking/lmicklt_region_tracker.cc
@@ -52,24 +52,6 @@ static bool RegionIsInBounds(const FloatImage &image1,
   return true;
 }
 
-// Sample a region centered at x,y in image with size extending by half_width
-// from x,y. Channels specifies the number of channels to sample from.
-static void SamplePattern(const FloatImage &image,
-                   double x, double y,
-                   int half_width,
-                   int channels,
-                   FloatImage *sampled) {
-  sampled->Resize(2 * half_width + 1, 2 * half_width + 1, channels);
-  for (int r = -half_width; r <= half_width; ++r) {
-    for (int c = -half_width; c <= half_width; ++c) {
-      for (int i = 0; i < channels; ++i) {
-        (*sampled)(r + half_width, c + half_width, i) =
-            SampleLinear(image, y + r, x + c, i);
-      }
-    }
-  }
-}
-
 // Estimate "reasonable" error by computing autocorrelation for a small shift.
 static double EstimateReasonableError(const FloatImage &image,
                                double x, double y,
diff --git a/extern/libmv/libmv/tracking/sad.cc b/extern/libmv/libmv/tracking/sad.cc
deleted file mode 100644
index 0876ef2..0000000
--- a/extern/libmv/libmv/tracking/sad.cc
+++ /dev/null
@@ -1,191 +0,0 @@
-/****************************************************************************
-**
-** Copyright (c) 2011 libmv authors.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a copy
-** of this software and associated documentation files (the "Software"), to
-** deal in the Software without restriction, including without limitation the
-** rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-** sell copies of the Software, and to permit persons to whom the Software is
-** furnished to do so, subject to the following conditions:
-**
-** The above copyright notice and this permission notice shall be included in
-** all copies or substantial portions of the Software.
-**
-** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-** FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-** IN THE SOFTWARE.
-**
-****************************************************************************/
-
-#include "libmv/tracking/sad.h"
-#include <stdlib.h>
-#include <math.h>
-#include <stdio.h>
-
-namespace libmv {
-
-void LaplaceFilter(ubyte* src, ubyte* dst, int width, int height, int strength) {
-  for(int y=1; y<height-1; y++) for(int x=1; x<width-1; x++) {
-    const ubyte* s = &src[y*width+x];
-    int l = 128 +
-        s[-width-1] + s[-width] + s[-width+1] +
-        s[1]        - 8*s[0]    + s[1]        +
-        s[ width-1] + s[ width] + s[ width+1] ;
-    int d = ((256-strength)*s[0] + strength*l) / 256;
-    if(d < 0) d=0;
-    if(d > 255) d=255;
-    dst[y*width+x] = d;
-  }
-}
-
-struct vec2 {
-  float x,y;
-  inline vec2(float x, float y):x(x),y(y){}
-};
-inline vec2 operator*(mat32 m, vec2 v) {
-  return vec2(v.x*m(0,0)+v.y*m(0,1)+m(0,2),v.x*m(1,0)+v.y*m(1,1)+m(1,2));
-}
-
-//! fixed point bilinear sample with precision k
-template <int k> inline int sample(const ubyte* image,int stride, int x, int y, int u, int v) {
-  const ubyte* s = &image[y*stride+x];
-  return ((s[     0] * (k-u) + s[       1] * u) * (k-v)
-        + (s[stride] * (k-u) + s[stride+1] * u) * (  v) ) / (k*k);
-}
-
-#ifdef __SSE__
-#include <xmmintrin.h>
-int lround(float x) { return _mm_cvtss_si32(_mm_set_ss(x)); }
-#elif defined(_MSC_VER)
-int lround(float x) { return x+0.5; }
-#endif
-
-//TODO(MatthiasF): SSE optimization
-void SamplePattern(ubyte* image, int stride, mat32 warp, ubyte* pattern, int size) {
-  const int k = 256;
-  for (int i = 0; i < size; i++) for (int j = 0; j < size; j++) {
-    vec2 p = warp*vec2(j-size/2,i-size/2);
-    int fx = lround(p.x*k), fy = lround(p.y*k);
-    int ix = fx/k, iy = fy/k;
-    int u = fx%k, v = fy%k;
-    pattern[i*size+j] = sample<k>(image,stride,ix,iy,u,v);
-  }
-}
-
-#ifdef __SSE2__
-#include <emmintrin.h>
-  static uint SAD(/*const*/ ubyte* pattern, /*const*/ ubyte* image, int stride, int size) {
-  uint sad = 0;
-  __m128i a = _mm_setzero_si128();
-
-  for(int i = 0; i < size; i++) {
-    int j = 0;
-
-    for(j = 0; j < size/16; j++) {
-      if((i*size/16+j) % 32 == 0) {
-        sad += _mm_extract_epi16(a,0) + _mm_extract_epi16(a,4);
-        a = _mm_setzero_si128();
-      }
-
-      a = _mm_adds_epu16(a, _mm_sad_epu8( _mm_loadu_si128((__m128i*)(pattern+i*size+j*16)),
-                                          _mm_loadu_si128((__m128i*)(image+i*stride+j*16))));
-    }
-
-    for(j = j*16; j < size; j++) {
-      sad += abs((int)pattern[i*size+j] - image[i*stride+j]);
-    }
-  }
-
-  sad += _mm_extract_epi16(a,0) + _mm_extract_epi16(a,4);
-
-  return sad;
-}
-#else
-static uint SAD(const ubyte* pattern, const ubyte* image, int stride, int size) {
-  uint sad=0;
-  for(int i = 0; i < size; i++) {
-    for(int j = 0; j < size; j++) {
-      sad += abs((int)pattern[i*size+j] - image[i*stride+j]);
-    }
-  }
-  return sad;
-}
-#endif
-
-float sq(float x) { return x*x; }
-float Track(ubyte* reference, ubyte* warped, int size, ubyte* image, int stride, int w, int h, mat32* warp, float areaPenalty, float conditionPenalty) {
-  mat32 m=*warp;
-  uint min=-1;
-
-  // exhaustive search integer pixel translation
-  int ix = m(0,2), iy = m(1,2);
-  for(int y = size/2; y < h-size/2; y++) {
-    for(int x = size/2; x < w-size/2; x++) {
-      m(0,2) = x, m(1,2) = y;
-      uint sad = SAD(warped,&image[(y-size/2)*stride+(x-size/2)],stride,size);
-      // TODO: using chroma could help disambiguate some cases
-      if(sad < min) {
-        min = sad;
-        ix = x, iy = y;
-      }
-    }
-  }
-  m(0,2) = ix, m(1,2) = iy;
-  min=-1; //reset score since direct warped search match too well (but the wrong pattern).
-
-  // 6D coordinate descent to find affine transform
-  ubyte* match = new ubyte[size*size];
-  float step = 0.5;
-  for(int p = 0; p < 8; p++) { //foreach precision level
-    for(int i = 0; i < 2; i++) { // iterate twice per precision level
-      //TODO: other sweep pattern might converge better
-      for(int d=0; d < 6; d++) { // iterate dimension sequentially (cyclic descent)
-        for(float e = -step; e <= step; e+=step) { //solve subproblem (evaluate only along one coordinate)
-          mat32 t = m;
-          t.data[d] += e;
-          //TODO: better performance would also allow a more exhaustive search
-          SamplePattern(image,stride,t,match,size);
-          uint sad = SAD(reference,match,size,size);
-          // regularization: keep constant area and good condition
-          float area = t(0,0)*t(1,1)-t(0,1)*t(1,0);
-          float x = sq(t(0,0))+sq(t(0,1)), y = sq(t(1,0))+sq(t(1,1));
-          float condition = x>y ? x/y : y/x;
-          sad += size*size*( areaPenalty*sq(area-1) + conditionPenalty*sq(condition-1) );
-          if(sad < min) {
-            min = sad;
-            m = t;
-          }
-        }
-      }
-    }
-    step /= 2;
-  }
-  *warp = m;
-
-  // Compute Pearson product-moment correlation coefficient
-  uint sX=0,sY=0,sXX=0,sYY=0,sXY=0;
-  SamplePattern(image,stride,m,match,size);
-  SAD(reference,match,size,size);
-  for(int i = 0; i < size; i++) {
-    for(int j = 0; j < size; j++) {
-      int x = reference[i*size+j];
-      int y = match[i*size+j];
-      sX += x;
-      sY += y;
-      sXX += x*x;
-      sYY += y*y;
-      sXY += x*y;
-    }
-  }
-  delete[] match;
-  const int N = size*size;
-  sX /= N, sY /= N, sXX /= N, sYY /= N, sXY /= N;
-  return (sXY-sX*sY)/sqrt(double((sXX-sX*sX)*(sYY-sY*sY)));
-}
-
-}  // namespace libmv
diff --git a/extern/libmv/libmv/tracking/sad.h b/extern/libmv/libmv/tracking/sad.h
deleted file mode 100644
index 9fe323b..0000000
--- a/extern/libmv/libmv/tracking/sad.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/****************************************************************************
-**
-** Copyright (c) 2011 libmv authors.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a copy
-** of this software and associated documentation files (the "Software"), to
-** deal in the Software without restriction, including without limitation the
-** rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-** sell copies of the Software, and to permit persons to whom the Software is
-** furnished to do so, subject to the following conditions:
-**
-** The above copyright notice and this permission notice shall be included in
-** all copies or substantial portions of the Software.
-**
-** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-** FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-** IN THE SOFTWARE.
-**
-****************************************************************************/
-
-#ifndef LIBMV_TRACKING_SAD_H_
-#define LIBMV_TRACKING_SAD_H_
-
-#ifdef __cplusplus
-namespace libmv {
-#endif
-
-typedef unsigned char ubyte;
-typedef unsigned int uint;
-
-/*!
-    Convolve \a src into \a dst with the discrete laplacian operator.
-
-    \a src and \a dst should be \a width x \a height images.
-    \a strength is an interpolation coefficient (0-256) between original image and the laplacian.
-
-    \note Make sure the search region is filtered with the same strength as the pattern.
-*/
-void LaplaceFilter(ubyte* src, ubyte* dst, int width, int height, int strength);
-
-/// Affine transformation matrix in column major order.
-struct mat32 {
-  float data[3*2];
-#ifdef __cplusplus
-  inline mat32(int d=1) { for(int i=0;i<3*2;i++) data[i]=0; if(d!=0) for(int i=0;i<2;i++) m(i,i)=d; }
-  inline float m(int i, int j) const { return data[j*2+i]; }
-  inline float& m(int i, int j) { return data[j*2+i]; }
-  inline float operator()(int i, int j) const { return m(i,j); }
-  inline float& operator()(int i, int j) { return m(i,j); }
-  inline operator bool() const { for (int i=0; i<3*2; i++) if(data[i]!=0) return true; return false; }
-#endif
-};
-
-/*!
-    Sample \a pattern from \a image.
-
-    \a warp is the transformation to apply to \a image when sampling the \a pattern.
-*/
-void SamplePattern(ubyte* image, int stride, mat32 warp, ubyte* pattern, int size);
-
-/*!
-    Track \a pattern in \a image.
-
-    This template matcher computes the
-    \link http://en.wikipedia.org/wiki/Sum_of_absolute_differences Sum of Absolute Differences (SAD) \endlink
-    for each integer pixel position in the search region and then iteratively
-    refine subpixel position using a square search.
-    A similar method is used for motion estimation in video encoders.
-
-    \a reference is the pattern to track.
-    \a warped is a warped version of reference for fast unsampled integer search.
-       Best is to directly extract an already warped pattern from previous frame.
-    The \a size of the patterns should be aligned to 16.
-    \a image is a reference to the region to search.
-    \a stride is size of \a image lines.
-
-    On input, \a warp is the predicted affine transformation (e.g from previous frame)
-    On return, \a warp is the affine transformation which best match the reference \a pattern
-
-    \a areaPenalty and conditionPenalty control the regularization and need to be tweaked depending on the motion.
-       Setting them to 0 will allow any transformation (including unrealistic distortions and scaling).
-       Good values are between 0-32. 16 can be used as a realistic default.
-       areaPenalty control scaling (decrease to allow pull/zoom, increase to allow only 2D rotation).
-       a large conditionPenalty avoid a large ratio between the largest and smallest axices.
-       It need to be decreased for non-2D rotation (when pattern appears to scale along an axis).
-
-    \return Pearson product-moment correlation coefficient between reference and matched pattern.
-            This measure of the linear dependence between the patterns
-            ranges from −1 (negative correlation) to 1 (positive correlation).
-            A value of 0 implies that there is no linear correlation between the variables.
-
-    \note To track affine features:
-     - Sample reference pattern using estimated (e.g previous frame) warp.
-     -
-    \note \a stride allow you to reference your search region instead of copying.
-    \note For a 16x speedup, compile this tracker with SSE2 support.
-*/
-float Track(ubyte* reference, ubyte* warped, int size, ubyte* image, int stride, int width, int height, mat32* warp,
-            float areaPenalty, float conditionPenalty);
-
-#ifdef __cplusplus
-}  // namespace libmv
-#endif
-
-#endif  // LIBMV_TRACKING_SAD_H_
diff --git a/extern/libmv/libmv/tracking/trklt_region_tracker.h b/extern/libmv/libmv/tracking/trklt_region_tracker.h
index 5046e0f..26d0621 100644
--- a/extern/libmv/libmv/tracking/trklt_region_tracker.h
+++ b/extern/libmv/libmv/tracking/trklt_region_tracker.h
@@ -42,7 +42,7 @@ struct TrkltRegionTracker : public RegionTracker {
         min_update_squared_distance(1e-6),
         sigma(0.9),
         lambda(0.05) {}
-  
+
   virtual ~TrkltRegionTracker() {}
 
   // Tracker interface.
diff --git a/extern/libmv/patches/bundle_tweaks.patch b/extern/libmv/patches/bundle_tweaks.patch
deleted file mode 100644
index f7b06b0..0000000
--- a/extern/libmv/patches/bundle_tweaks.patch
+++ /dev/null
@@ -1,122 +0,0 @@
-diff --git a/src/libmv/logging/logging.h b/src/libmv/logging/logging.h
-index 067da52..af86c4b 100644
---- a/src/libmv/logging/logging.h
-+++ b/src/libmv/logging/logging.h
-@@ -21,7 +21,7 @@
- #ifndef LIBMV_LOGGING_LOGGING_H
- #define LIBMV_LOGGING_LOGGING_H
- 
--#include "third_party/glog/src/glog/logging.h"
-+#include "glog/logging.h"
- 
- #define LG LOG(INFO)
- #define V0 LOG(INFO)
-diff --git a/src/third_party/glog/src/glog/logging.h b/src/third_party/glog/src/glog/logging.h
-index 57615ef..a58d478 100644
---- a/src/third_party/glog/src/glog/logging.h
-+++ b/src/third_party/glog/src/glog/logging.h
-@@ -33,6 +33,7 @@
- // Pretty much everybody needs to #include this file so that they can
- // log various happenings.
- //
-+
- #ifndef _LOGGING_H_
- #define _LOGGING_H_
- 
-diff --git a/src/third_party/glog/src/logging.cc b/src/third_party/glog/src/logging.cc
-index 868898f..1bb3867 100644
---- a/src/third_party/glog/src/logging.cc
-+++ b/src/third_party/glog/src/logging.cc
-@@ -58,8 +58,8 @@
- #include <errno.h>                   // for errno
- #include <sstream>
- #include "base/commandlineflags.h"        // to get the program name
--#include "glog/logging.h"
--#include "glog/raw_logging.h"
-+#include <glog/logging.h>
-+#include <glog/raw_logging.h>
- #include "base/googleinit.h"
- 
- #ifdef HAVE_STACKTRACE
-@@ -1232,7 +1232,9 @@ void LogMessage::RecordCrashReason(
- }
- 
- static void logging_fail() {
--#if defined(_DEBUG) && defined(_MSC_VER)
-+// #if defined(_DEBUG) && defined(_MSC_VER)
-+// doesn't work for my laptop (sergey)
-+#if 0
-   // When debugging on windows, avoid the obnoxious dialog and make
-   // it possible to continue past a LOG(FATAL) in the debugger
-   _asm int 3
-diff --git a/src/third_party/glog/src/raw_logging.cc b/src/third_party/glog/src/raw_logging.cc
-index 50c6a71..b179a1e 100644
---- a/src/third_party/glog/src/raw_logging.cc
-+++ b/src/third_party/glog/src/raw_logging.cc
-@@ -42,8 +42,8 @@
- #include <fcntl.h>                 // for open()
- #include <time.h>
- #include "config.h"
--#include "glog/logging.h"          // To pick up flag settings etc.
--#include "glog/raw_logging.h"
-+#include <glog/logging.h>          // To pick up flag settings etc.
-+#include <glog/raw_logging.h>
- #include "base/commandlineflags.h"
- 
- #ifdef HAVE_STACKTRACE
-diff --git a/src/third_party/glog/src/utilities.h b/src/third_party/glog/src/utilities.h
-index ee54f94..2d4e99e 100644
---- a/src/third_party/glog/src/utilities.h
-+++ b/src/third_party/glog/src/utilities.h
-@@ -79,7 +79,7 @@
- #endif
- 
- #include "config.h"
--#include "glog/logging.h"
-+#include <glog/logging.h>
- 
- // There are three different ways we can try to get the stack trace:
- //
-diff --git a/src/third_party/glog/src/vlog_is_on.cc b/src/third_party/glog/src/vlog_is_on.cc
-index ee0e412..ed88514 100644
---- a/src/third_party/glog/src/vlog_is_on.cc
-+++ b/src/third_party/glog/src/vlog_is_on.cc
-@@ -40,8 +40,8 @@
- #include <cstdio>
- #include <string>
- #include "base/commandlineflags.h"
--#include "glog/logging.h"
--#include "glog/raw_logging.h"
-+#include <glog/logging.h>
-+#include <glog/raw_logging.h>
- #include "base/googleinit.h"
- 
- // glog doesn't have annotation
-diff --git a/src/third_party/glog/src/windows/config.h b/src/third_party/glog/src/windows/config.h
-index 114762e..682a1b9 100755
---- a/src/third_party/glog/src/windows/config.h
-+++ b/src/third_party/glog/src/windows/config.h
-@@ -19,7 +19,7 @@
- #undef HAVE_LIBUNWIND_H
- 
- /* define if you have google gflags library */
--#undef HAVE_LIB_GFLAGS
-+#define HAVE_LIB_GFLAGS 1
- 
- /* define if you have libunwind */
- #undef HAVE_LIB_UNWIND
-diff --git a/src/third_party/glog/src/windows/glog/logging.h b/src/third_party/glog/src/windows/glog/logging.h
-index 7a6df74..de51586 100755
---- a/src/third_party/glog/src/windows/glog/logging.h
-+++ b/src/third_party/glog/src/windows/glog/logging.h
-@@ -82,8 +82,8 @@
- #include <inttypes.h>           // a third place for uint16_t or u_int16_t
- #endif
- 
--#if 0
--#include <gflags/gflags.h>
-+#if 1
-+#include "third_party/gflags/gflags.h"
- #endif
- 
- namespace google {
diff --git a/extern/libmv/patches/config_mac.patch b/extern/libmv/patches/config_mac.patch
deleted file mode 100644
index 5a88015..0000000
--- a/extern/libmv/patches/config_mac.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/src/third_party/glog/src/config_mac.h b/src/third_party/glog/src/config_mac.h
-index a45575b..5f953d1 100644
---- a/src/third_party/glog/src/config_mac.h
-+++ b/src/third_party/glog/src/config_mac.h
-@@ -131,7 +131,7 @@
- #define PACKAGE_VERSION "0.3.1"
- 
- /* How to access the PC from a struct ucontext */
--#define PC_FROM_UCONTEXT uc_mcontext->__ss.__rip
-+#undef PC_FROM_UCONTEXT
- 
- /* Define to necessary symbol if this constant uses a non-standard name on
-    your system. */
diff --git a/extern/libmv/patches/detect.patch b/extern/libmv/patches/detect.patch
deleted file mode 100644
index 36fea84..0000000
--- a/extern/libmv/patches/detect.patch
+++ /dev/null
@@ -1,181 +0,0 @@
-diff --git a/src/libmv/simple_pipeline/detect.cc b/src/libmv/simple_pipeline/detect.cc
-index 6fc0cdd..8ac42ab 100644
---- a/src/libmv/simple_pipeline/detect.cc
-+++ b/src/libmv/simple_pipeline/detect.cc
-@@ -23,15 +23,89 @@
- ****************************************************************************/
- 
- #include "libmv/simple_pipeline/detect.h"
-+#include <third_party/fast/fast.h>
- #include <stdlib.h>
--#include <string.h>
-+#include <memory.h>
-+
-+#ifdef __SSE2__
-+#include <emmintrin.h>
-+#endif
- 
- namespace libmv {
- 
- typedef unsigned int uint;
- 
-+int featurecmp(const void *a_v, const void *b_v)
-+{
-+  Feature *a = (Feature*)a_v;
-+  Feature *b = (Feature*)b_v;
-+
-+  return b->score - a->score;
-+}
-+
-+std::vector<Feature> DetectFAST(const unsigned char* data, int width, int height, int stride,
-+                           int min_trackness, int min_distance) {
-+  std::vector<Feature> features;
-+  // TODO(MatthiasF): Support targetting a feature count (binary search trackness)
-+  int num_features;
-+  xy* all = fast9_detect(data, width, height,
-+                         stride, min_trackness, &num_features);
-+  if(num_features == 0) {
-+    free(all);
-+    return features;
-+  }
-+  int* scores = fast9_score(data, stride, all, num_features, min_trackness);
-+  // TODO: merge with close feature suppression
-+  xy* nonmax = nonmax_suppression(all, scores, num_features, &num_features);
-+  free(all);
-+  // Remove too close features
-+  // TODO(MatthiasF): A resolution independent parameter would be better than distance
-+  // e.g. a coefficient going from 0 (no minimal distance) to 1 (optimal circle packing)
-+  // FIXME(MatthiasF): this method will not necessarily give all maximum markers
-+  if(num_features) {
-+    Feature *all_features = new Feature[num_features];
-+
-+    for(int i = 0; i < num_features; ++i) {
-+      Feature a = { nonmax[i].x, nonmax[i].y, scores[i], 0 };
-+      all_features[i] = a;
-+    }
-+
-+    qsort((void *)all_features, num_features, sizeof(Feature), featurecmp);
-+
-+    features.reserve(num_features);
-+
-+    int prev_score = all_features[0].score;
-+    for(int i = 0; i < num_features; ++i) {
-+      bool ok = true;
-+      Feature a = all_features[i];
-+      if(a.score>prev_score)
-+        abort();
-+      prev_score = a.score;
-+
-+      // compare each feature against filtered set
-+      for(int j = 0; j < features.size(); j++) {
-+        Feature& b = features[j];
-+        if ( (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y) < min_distance*min_distance ) {
-+          // already a nearby feature
-+          ok = false;
-+          break;
-+        }
-+      }
-+
-+      if(ok) {
-+        // add the new feature
-+        features.push_back(a);
-+      }
-+    }
-+
-+    delete [] all_features;
-+  }
-+  free(scores);
-+  free(nonmax);
-+  return features;
-+}
-+
- #ifdef __SSE2__
--#include <emmintrin.h>
- static uint SAD(const ubyte* imageA, const ubyte* imageB, int strideA, int strideB) {
-   __m128i a = _mm_setzero_si128();
-   for(int i = 0; i < 16; i++) {
-@@ -52,7 +126,7 @@ static uint SAD(const ubyte* imageA, const ubyte* imageB, int strideA, int strid
- }
- #endif
- 
--void Detect(ubyte* image, int stride, int width, int height, Feature* detected, int* count, int distance, ubyte* pattern) {
-+void DetectMORAVEC(ubyte* image, int stride, int width, int height, Feature* detected, int* count, int distance, ubyte* pattern) {
-   unsigned short histogram[256];
-   memset(histogram,0,sizeof(histogram));
-   ubyte* scores = new ubyte[width*height];
-diff --git a/src/libmv/simple_pipeline/detect.h b/src/libmv/simple_pipeline/detect.h
-index 23b239b..bbe7aed 100644
---- a/src/libmv/simple_pipeline/detect.h
-+++ b/src/libmv/simple_pipeline/detect.h
-@@ -25,27 +25,52 @@
- #ifndef LIBMV_SIMPLE_PIPELINE_DETECT_H_
- #define LIBMV_SIMPLE_PIPELINE_DETECT_H_
- 
--#ifdef __cplusplus
-+#include <vector>
-+
- namespace libmv {
--#endif
- 
- typedef unsigned char ubyte;
- 
- /*!
--    \a Feature is the 2D location of a detected feature in an image.
-+    A Feature is the 2D location of a detected feature in an image.
- 
--    \a x, \a y is the position of the center in pixels (from image top-left).
--    \a score is an estimate of how well the pattern will be tracked.
--    \a size can be used as an initial size to track the pattern.
-+    \a x, \a y is the position of the feature in pixels from the top left corner.
-+    \a score is an estimate of how well the feature will be tracked.
-+    \a size can be used as an initial pattern size to track the feature.
- 
-     \sa Detect
- */
- struct Feature {
-+  /// Position in pixels (from top-left corner)
-+  /// \note libmv might eventually support subpixel precision.
-   float x, y;
-+  /// Trackness of the feature
-   float score;
-+  /// Size of the feature in pixels
-   float size;
- };
-- //radius for non maximal suppression
-+
-+/*!
-+    Detect features in an image.
-+
-+    You need to input a single channel 8-bit image using pointer to image \a data,
-+    \a width, \a height and \a stride (i.e bytes per line).
-+
-+    You can tweak the count of detected features using \a min_trackness, which is
-+    the minimum score to add a feature, and \a min_distance which is the minimal
-+    distance accepted between two featuress.
-+
-+    \note You can binary search over \a min_trackness to get a given feature count.
-+
-+    \note a way to get an uniform distribution of a given feature count is:
-+          \a min_distance = \a width * \a height / desired_feature_count ^ 2
-+
-+    \return All detected feartures matching given parameters
-+*/
-+std::vector<Feature> DetectFAST(const unsigned char* data, int width, int height,
-+                           int stride, int min_trackness = 128,
-+                           int min_distance = 120);
-+
- /*!
-     Detect features in an image.
- 
-@@ -63,10 +88,8 @@ struct Feature {
-     \note \a You can crop the image (to avoid detecting markers near the borders) without copying:
-              image += marginY*stride+marginX, width -= 2*marginX, height -= 2*marginY;
- */
--void Detect(ubyte* image, int stride, int width, int height, Feature* detected, int* count, int distance /*=32*/, ubyte* pattern /*=0*/);
-+void DetectMORAVEC(ubyte* image, int stride, int width, int height, Feature* detected, int* count, int distance /*=32*/, ubyte* pattern /*=0*/);
- 
--#ifdef __cplusplus
- }
--#endif
- 
- #endif
diff --git a/extern/libmv/patches/fast.patch b/extern/libmv/patches/fast.patch
deleted file mode 100644
index 8e0aeb7..0000000
--- a/extern/libmv/patches/fast.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-diff --git a/src/third_party/fast/fast.h b/src/third_party/fast/fast.h
-index 2b3825a..06fa90e 100644
---- a/src/third_party/fast/fast.h
-+++ b/src/third_party/fast/fast.h
-@@ -1,6 +1,10 @@
- #ifndef FAST_H
- #define FAST_H
- 
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- typedef struct { int x, y; } xy; 
- typedef unsigned char byte;
- 
-@@ -28,4 +32,8 @@ xy* fast12_detect_nonmax(const byte* im, int xsize, int ysize, int stride, int b
- xy* nonmax_suppression(const xy* corners, const int* scores, int num_corners, int* ret_num_nonmax);
- 
- 
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif
diff --git a/extern/libmv/patches/function_derivative.patch b/extern/libmv/patches/function_derivative.patch
deleted file mode 100644
index be7ccfc..0000000
--- a/extern/libmv/patches/function_derivative.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-diff --git a/src/libmv/numeric/function_derivative.h b/src/libmv/numeric/function_derivative.h
-index 0075d23..d7bc437 100644
---- a/src/libmv/numeric/function_derivative.h
-+++ b/src/libmv/numeric/function_derivative.h
-@@ -24,6 +24,7 @@
- #include <cmath>
- 
- #include "libmv/numeric/numeric.h"
-+#include "libmv/logging/logging.h"
- 
- namespace libmv {
- 
-@@ -97,7 +98,7 @@ bool CheckJacobian(const Function &f, const typename Function::XMatrixType &x) {
- 
-   typename NumericJacobian<Function>::JMatrixType J_numeric = j_numeric(x);
-   typename NumericJacobian<Function>::JMatrixType J_analytic = j_analytic(x);
--  //LG << J_numeric - J_analytic;
-+  LG << J_numeric - J_analytic;
-   return true;
- }
- 
diff --git a/extern/libmv/patches/high_distortion_crash_fix.patch b/extern/libmv/patches/high_distortion_crash_fix.patch
deleted file mode 100644
index 54ab66f..0000000
--- a/extern/libmv/patches/high_distortion_crash_fix.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-diff --git a/src/libmv/simple_pipeline/camera_intrinsics.cc b/src/libmv/simple_pipeline/camera_intrinsics.cc
-index 4e88e1f..f9888ff 100644
---- a/src/libmv/simple_pipeline/camera_intrinsics.cc
-+++ b/src/libmv/simple_pipeline/camera_intrinsics.cc
-@@ -160,9 +160,13 @@ void CameraIntrinsics::ComputeLookupGrid(Offset* grid, int width, int height) {
-       if( iy < 0 ) { iy = 0, fy = 0; }
-       if( ix >= width-2 ) ix = width-2;
-       if( iy >= height-2 ) iy = height-2;
--      //assert( ix-x > -128 && ix-x < 128 && iy-y > -128 && iy-y < 128 );
--      Offset offset = { ix-x, iy-y, fx, fy };
--      grid[y*width+x] = offset;
-+      if ( ix-x > -128 && ix-x < 128 && iy-y > -128 && iy-y < 128 ) {
-+        Offset offset = { ix-x, iy-y, fx, fy };
-+        grid[y*width+x] = offset;
-+      } else {
-+        Offset offset = { 0, 0, 0, 0 };
-+        grid[y*width+x] = offset;
-+      }
-     }
-   }
- }
diff --git a/extern/libmv/patches/levenberg_marquardt.patch b/extern/libmv/patches/levenberg_marquardt.patch
deleted file mode 100644
index 49ef82d..0000000
--- a/extern/libmv/patches/levenberg_marquardt.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-diff --git a/src/libmv/numeric/levenberg_marquardt.h b/src/libmv/numeric/levenberg_marquardt.h
-index 6a54f66..4473b72 100644
---- a/src/libmv/numeric/levenberg_marquardt.h
-+++ b/src/libmv/numeric/levenberg_marquardt.h
-@@ -33,6 +33,7 @@
- 
- #include "libmv/numeric/numeric.h"
- #include "libmv/numeric/function_derivative.h"
-+#include "libmv/logging/logging.h"
- 
- namespace libmv {
- 
-@@ -123,26 +124,40 @@ class LevenbergMarquardt {
-     Parameters dx, x_new;
-     int i;
-     for (i = 0; results.status == RUNNING && i < params.max_iterations; ++i) {
--      if (dx.norm() <= params.relative_step_threshold * x.norm()) {
-+      VLOG(1) << "iteration: " << i;
-+      VLOG(1) << "||f(x)||: " << f_(x).norm();
-+      VLOG(1) << "max(g): " << g.array().abs().maxCoeff();
-+      VLOG(1) << "u: " << u;
-+      VLOG(1) << "v: " << v;
-+
-+      AMatrixType A_augmented = A + u*AMatrixType::Identity(J.cols(), J.cols());
-+      Solver solver(A_augmented);
-+      dx = solver.solve(g);
-+      bool solved = (A_augmented * dx).isApprox(g);
-+      if (!solved) {
-+        LOG(ERROR) << "Failed to solve";
-+      }
-+      if (solved && dx.norm() <= params.relative_step_threshold * x.norm()) {
-         results.status = RELATIVE_STEP_SIZE_TOO_SMALL;
-         break;
--      }
--      x_new = x + dx;
--      // Rho is the ratio of the actual reduction in error to the reduction
--      // in error that would be obtained if the problem was linear.
--      // See [1] for details.
--      Scalar rho((error.squaredNorm() - f_(x_new).squaredNorm())
--                 / dx.dot(u*dx + g));
--      if (rho > 0) {
--        // Accept the Gauss-Newton step because the linear model fits well.
--        x = x_new;
--        results.status = Update(x, params, &J, &A, &error, &g);
--        Scalar tmp = Scalar(2*rho-1);
--        u = u*std::max(1/3., 1 - (tmp*tmp*tmp));
--        v = 2;
--        continue;
--      }
--
-+      } 
-+      if (solved) {
-+        x_new = x + dx;
-+        // Rho is the ratio of the actual reduction in error to the reduction
-+        // in error that would be obtained if the problem was linear.
-+        // See [1] for details.
-+        Scalar rho((error.squaredNorm() - f_(x_new).squaredNorm())
-+                   / dx.dot(u*dx + g));
-+        if (rho > 0) {
-+          // Accept the Gauss-Newton step because the linear model fits well.
-+          x = x_new;
-+          results.status = Update(x, params, &J, &A, &error, &g);
-+          Scalar tmp = Scalar(2*rho-1);
-+          u = u*std::max(1/3., 1 - (tmp*tmp*tmp));
-+          v = 2;
-+          continue;
-+        } 
-+      } 
-       // Reject the update because either the normal equations failed to solve
-       // or the local linear model was not good (rho < 0). Instead, increase u
-       // to move closer to gradient descent.
diff --git a/extern/libmv/patches/mingw.patch b/extern/libmv/patches/mingw.patch
deleted file mode 100644
index 029e7d7..0000000
--- a/extern/libmv/patches/mingw.patch
+++ /dev/null
@@ -1,171 +0,0 @@
-diff --git a/src/libmv/multiview/euclidean_resection.cc b/src/libmv/multiview/euclidean_resection.cc
-index 6d918a1..9286251 100644
---- a/src/libmv/multiview/euclidean_resection.cc
-+++ b/src/libmv/multiview/euclidean_resection.cc
-@@ -32,6 +32,8 @@
- namespace libmv {
- namespace euclidean_resection {
- 
-+typedef unsigned int uint;
-+
- bool EuclideanResection(const Mat2X &x_camera, 
-                         const Mat3X &X_world,
-                         Mat3 *R, Vec3 *t,
-diff --git a/src/libmv/numeric/numeric.h b/src/libmv/numeric/numeric.h
-index f39d126..21e0f06 100644
---- a/src/libmv/numeric/numeric.h
-+++ b/src/libmv/numeric/numeric.h
-@@ -40,7 +40,7 @@
-   }
- #endif //_WIN32 || __APPLE__
- 
--#if _WIN32
-+#if (defined(WIN32) || defined(WIN64)) && !defined(__MINGW32__)
-   inline long lround(double d) {
-     return (long)(d>0 ? d+0.5 : ceil(d-0.5));
-   }
-diff --git a/src/third_party/glog/src/config.h b/src/third_party/glog/src/config.h
-index ed8d56e..06ed686 100644
---- a/src/third_party/glog/src/config.h
-+++ b/src/third_party/glog/src/config.h
-@@ -4,6 +4,8 @@
- /* Namespace for Google classes */
- #ifdef __APPLE__
-  #include "config_mac.h"
-+#elif __MINGW32__
-+ #include "windows/config.h"
- #elif __GNUC__
-  #include "config_linux.h"
- #elif _MSC_VER
-diff --git a/src/third_party/glog/src/utilities.h b/src/third_party/glog/src/utilities.h
-index ee54f94..c4ae256 100644
---- a/src/third_party/glog/src/utilities.h
-+++ b/src/third_party/glog/src/utilities.h
-@@ -101,7 +101,9 @@
- // correctly when GetStackTrace() is called with max_depth == 0.
- // Some code may do that.
- 
--#if defined(HAVE_LIB_UNWIND)
-+#if __MINGW32__
-+# undef STACKTRACE_H
-+#elif defined(HAVE_LIB_UNWIND)
- # define STACKTRACE_H "stacktrace_libunwind-inl.h"
- #elif !defined(NO_FRAME_POINTER)
- # if defined(__i386__) && __GNUC__ >= 2
-diff --git a/src/third_party/glog/src/windows/glog/logging.h b/src/third_party/glog/src/windows/glog/logging.h
-index 7a6df74..4257375 100755
---- a/src/third_party/glog/src/windows/glog/logging.h
-+++ b/src/third_party/glog/src/windows/glog/logging.h
-@@ -59,7 +59,7 @@
- 
- // Annoying stuff for windows -- makes sure clients can import these functions
- #ifndef GOOGLE_GLOG_DLL_DECL
--# if defined(_WIN32) && !defined(__CYGWIN__)
-+# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)
- #   define GOOGLE_GLOG_DLL_DECL  __declspec(dllimport)
- # else
- #   define GOOGLE_GLOG_DLL_DECL
-@@ -86,6 +86,15 @@
- #include <gflags/gflags.h>
- #endif
- 
-+#ifdef __MINGW32__
-+#  include <stdlib.h>
-+#  include <unistd.h>
-+#  include <stdint.h>             // the normal place uint16_t is defined
-+#  include <sys/types.h>          // the normal place u_int16_t is defined
-+#  include <inttypes.h>           // a third place for uint16_t or u_int16_t
-+#  define _exit(x) exit(x)
-+#endif
-+
- namespace google {
- 
- #if 0      // the C99 format
-@@ -98,11 +107,16 @@ typedef int32_t int32;
- typedef u_int32_t uint32;
- typedef int64_t int64;
- typedef u_int64_t uint64;
--#elif 1    // the windows (vc7) format
-+#elif defined(_MSC_VER)
- typedef __int32 int32;
- typedef unsigned __int32 uint32;
- typedef __int64 int64;
- typedef unsigned __int64 uint64;
-+#elif defined(__MINGW32__)
-+typedef int32_t int32;
-+typedef uint32_t uint32;
-+typedef int64_t int64;
-+typedef uint64_t uint64;
- #else
- #error Do not know how to define a 32-bit integer quantity on your system
- #endif
-diff --git a/src/third_party/glog/src/windows/port.h b/src/third_party/glog/src/windows/port.h
-index d093bf5..d507812 100755
---- a/src/third_party/glog/src/windows/port.h
-+++ b/src/third_party/glog/src/windows/port.h
-@@ -59,14 +59,16 @@
-  * used by both C and C++ code, so we put all the C++ together.
-  */
- 
--/* 4244: otherwise we get problems when substracting two size_t's to an int
-- * 4251: it's complaining about a private struct I've chosen not to dllexport
-- * 4355: we use this in a constructor, but we do it safely
-- * 4715: for some reason VC++ stopped realizing you can't return after abort()
-- * 4800: we know we're casting ints/char*'s to bools, and we're ok with that
-- * 4996: Yes, we're ok using "unsafe" functions like fopen() and strerror()
-- */
--#pragma warning(disable:4244 4251 4355 4715 4800 4996)
-+#if _MSC_VER
-+ /* 4244: otherwise we get problems when substracting two size_t's to an int
-+  * 4251: it's complaining about a private struct I've chosen not to dllexport
-+  * 4355: we use this in a constructor, but we do it safely
-+  * 4715: for some reason VC++ stopped realizing you can't return after abort()
-+  * 4800: we know we're casting ints/char*'s to bools, and we're ok with that
-+  * 4996: Yes, we're ok using "unsafe" functions like fopen() and strerror()
-+  */
-+# pragma warning(disable:4244 4251 4355 4715 4800 4996)
-+#endif
- 
- /* file I/O */
- #define PATH_MAX 1024
-@@ -108,7 +110,9 @@ extern int snprintf(char *str, size_t size,
- extern int safe_vsnprintf(char *str, size_t size,
-                           const char *format, va_list ap);
- #define vsnprintf(str, size, format, ap)  safe_vsnprintf(str, size, format, ap)
-+#if !defined(__MINGW32__)
- #define va_copy(dst, src)  (dst) = (src)
-+#endif
- 
- /* Windows doesn't support specifying the number of buckets as a
-  * hash_map constructor arg, so we leave this blank.
-@@ -130,13 +134,30 @@ enum { PTHREAD_ONCE_INIT = 0 };   // important that this be 0! for SpinLock
- #define pthread_equal(pthread_t_1, pthread_t_2)  ((pthread_t_1)==(pthread_t_2))
- 
- inline struct tm* localtime_r(const time_t* timep, struct tm* result) {
-+#if __MINGW32__
-+   struct tm *local_result;
-+   local_result = localtime (timep);
-+
-+   if (local_result == NULL || result == NULL)
-+     return NULL;
-+
-+   memcpy (result, local_result, sizeof (result));
-+
-+   return result;
-+#else
-   localtime_s(result, timep);
-   return result;
-+#endif
- }
- 
- inline char* strerror_r(int errnum, char* buf, size_t buflen) {
-+#if __MINGW32__
-+  strncpy(buf, "Not implemented yet", buflen);
-+  return buf;
-+#else
-   strerror_s(buf, buflen, errnum);
-   return buf;
-+#endif
- }
- 
- #ifndef __cplusplus
diff --git a/extern/libmv/patches/mingw_w64_support.patch b/extern/libmv/patches/mingw_w64_support.patch
new file mode 100644
index 0000000..8b2122a
--- /dev/null
+++ b/extern/libmv/patches/mingw_w64_support.patch
@@ -0,0 +1,58 @@
+Index: bundle.sh
+===================================================================
+--- bundle.sh	(revision 45912)
++++ bundle.sh	(working copy)
+@@ -248,7 +248,7 @@
+ incs += ' ' + env['BF_PNG_INC']
+ incs += ' ' + env['BF_ZLIB_INC']
+ 
+-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
++if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
+     incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
+     if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
+         incs += ' ./third_party/msinttypes'
+Index: libmv/numeric/numeric.h
+===================================================================
+--- libmv/numeric/numeric.h	(revision 45912)
++++ libmv/numeric/numeric.h	(working copy)
+@@ -33,7 +33,7 @@
+ #include <Eigen/QR>
+ #include <Eigen/SVD>
+ 
+-#if _WIN32 || __APPLE__ || __FreeBSD__
++#if (defined(_WIN32) || defined(__APPLE__) || defined(__FreeBSD__)) && !defined(__MINGW64__)
+   void static sincos (double x, double *sinx, double *cosx) {
+     *sinx = sin(x);
+     *cosx = cos(x);
+Index: third_party/glog/src/windows/port.cc
+===================================================================
+--- third_party/glog/src/windows/port.cc	(revision 45912)
++++ third_party/glog/src/windows/port.cc	(working copy)
+@@ -55,6 +55,8 @@
+   return _vsnprintf(str, size-1, format, ap);
+ }
+ 
++// MinGW64 defines
++#ifndef __MINGW64__
+ int snprintf(char *str, size_t size, const char *format, ...) {
+   va_list ap;
+   va_start(ap, format);
+@@ -62,3 +64,4 @@
+   va_end(ap);
+   return r;
+ }
++#endif
+Index: third_party/glog/src/windows/port.h
+===================================================================
+--- third_party/glog/src/windows/port.h	(revision 45912)
++++ third_party/glog/src/windows/port.h	(working copy)
+@@ -120,7 +120,9 @@
+ #define DEFAULT_TEMPLATE_ROOTDIR  ".."
+ 
+ // ----------------------------------- SYSTEM/PROCESS
++#ifndef __MINGW64__
+ typedef int pid_t;
++#endif
+ #define getpid  _getpid
+ 
+ // ----------------------------------- THREADS
diff --git a/extern/libmv/patches/msvc2010.patch b/extern/libmv/patches/msvc2010.patch
deleted file mode 100644
index c090b07..0000000
--- a/extern/libmv/patches/msvc2010.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff --git a/src/libmv/simple_pipeline/tracks.cc b/src/libmv/simple_pipeline/tracks.cc
-index 0e2a1b6..3fb8ddb 100644
---- a/src/libmv/simple_pipeline/tracks.cc
-+++ b/src/libmv/simple_pipeline/tracks.cc
-@@ -20,6 +20,7 @@
- 
- #include <algorithm>
- #include <vector>
-+#include <iterator>
- 
- #include "libmv/numeric/numeric.h"
- #include "libmv/simple_pipeline/tracks.h"
diff --git a/extern/libmv/patches/overscan.patch b/extern/libmv/patches/overscan.patch
deleted file mode 100644
index c68f368..0000000
--- a/extern/libmv/patches/overscan.patch
+++ /dev/null
@@ -1,182 +0,0 @@
-diff --git a/src/libmv/simple_pipeline/camera_intrinsics.cc b/src/libmv/simple_pipeline/camera_intrinsics.cc
-index 110a16d..366129d 100644
---- a/src/libmv/simple_pipeline/camera_intrinsics.cc
-+++ b/src/libmv/simple_pipeline/camera_intrinsics.cc
-@@ -31,6 +31,7 @@ struct Offset {
- struct Grid {
-   struct Offset *offset;
-   int width, height;
-+  double overscan;
- };
- 
- static struct Grid *copyGrid(struct Grid *from)
-@@ -42,6 +43,7 @@ static struct Grid *copyGrid(struct Grid *from)
- 
-     to->width = from->width;
-     to->height = from->height;
-+    to->overscan = from->overscan;
- 
-     to->offset = new Offset[to->width*to->height];
-     memcpy(to->offset, from->offset, sizeof(struct Offset)*to->width*to->height);
-@@ -184,17 +186,19 @@ void CameraIntrinsics::InvertIntrinsics(double image_x,
- 
- // TODO(MatthiasF): downsample lookup
- template<typename WarpFunction>
--void CameraIntrinsics::ComputeLookupGrid(Grid* grid, int width, int height) {
--  double aspx = (double)width / image_width_;
--  double aspy = (double)height / image_height_;
-+void CameraIntrinsics::ComputeLookupGrid(Grid* grid, int width, int height, double overscan) {
-+  double w = (double)width / (1 + overscan);
-+  double h = (double)height / (1 + overscan);
-+  double aspx = (double)w / image_width_;
-+  double aspy = (double)h / image_height_;
- 
-   for (int y = 0; y < height; y++) {
-     for (int x = 0; x < width; x++) {
--      double src_x = x / aspx, src_y = y / aspy;
-+      double src_x = (x - 0.5 * overscan * w) / aspx, src_y = (y - 0.5 * overscan * h) / aspy;
-       double warp_x, warp_y;
-       WarpFunction(this,src_x,src_y,&warp_x,&warp_y);
--      warp_x = warp_x*aspx;
--      warp_y = warp_y*aspy;
-+      warp_x = warp_x*aspx + 0.5 * overscan * w;
-+      warp_y = warp_y*aspy + 0.5 * overscan * h;
-       int ix = int(warp_x), iy = int(warp_y);
-       int fx = round((warp_x-ix)*256), fy = round((warp_y-iy)*256);
-       if(fx == 256) { fx=0; ix++; }
-@@ -264,10 +268,10 @@ struct InvertIntrinsicsFunction {
-   }
- };
- 
--void CameraIntrinsics::CheckDistortLookupGrid(int width, int height)
-+void CameraIntrinsics::CheckDistortLookupGrid(int width, int height, double overscan)
- {
-   if(distort_) {
--    if(distort_->width != width || distort_->height != height) {
-+    if(distort_->width != width || distort_->height != height || distort_->overscan != overscan) {
-       delete [] distort_->offset;
-       distort_->offset = NULL;
-     }
-@@ -278,17 +282,18 @@ void CameraIntrinsics::CheckDistortLookupGrid(int width, int height)
- 
-   if(!distort_->offset) {
-       distort_->offset = new Offset[width*height];
--      ComputeLookupGrid<InvertIntrinsicsFunction>(distort_,width,height);
-+      ComputeLookupGrid<InvertIntrinsicsFunction>(distort_,width,height,overscan);
-   }
- 
-   distort_->width = width;
-   distort_->height = height;
-+  distort_->overscan = overscan;
- }
- 
--void CameraIntrinsics::CheckUndistortLookupGrid(int width, int height)
-+void CameraIntrinsics::CheckUndistortLookupGrid(int width, int height, double overscan)
- {
-   if(undistort_) {
--    if(undistort_->width != width || undistort_->height != height) {
-+    if(undistort_->width != width || undistort_->height != height || undistort_->overscan != overscan) {
-       delete [] undistort_->offset;
-       undistort_->offset = NULL;
-     }
-@@ -299,15 +304,16 @@ void CameraIntrinsics::CheckUndistortLookupGrid(int width, int height)
- 
-   if(!undistort_->offset) {
-       undistort_->offset = new Offset[width*height];
--      ComputeLookupGrid<ApplyIntrinsicsFunction>(undistort_,width,height);
-+      ComputeLookupGrid<ApplyIntrinsicsFunction>(undistort_,width,height,overscan);
-   }
- 
-   undistort_->width = width;
-   undistort_->height = height;
-+  undistort_->overscan = overscan;
- }
- 
--void CameraIntrinsics::Distort(const float* src, float* dst, int width, int height, int channels) {
--  CheckDistortLookupGrid(width, height);
-+void CameraIntrinsics::Distort(const float* src, float* dst, int width, int height, double overscan, int channels) {
-+  CheckDistortLookupGrid(width, height, overscan);
-        if(channels==1) Warp<float,1>(distort_,src,dst,width,height);
-   else if(channels==2) Warp<float,2>(distort_,src,dst,width,height);
-   else if(channels==3) Warp<float,3>(distort_,src,dst,width,height);
-@@ -315,8 +321,8 @@ void CameraIntrinsics::Distort(const float* src, float* dst, int width, int heig
-   //else assert("channels must be between 1 and 4");
- }
- 
--void CameraIntrinsics::Distort(const unsigned char* src, unsigned char* dst, int width, int height, int channels) {
--  CheckDistortLookupGrid(width, height);
-+void CameraIntrinsics::Distort(const unsigned char* src, unsigned char* dst, int width, int height, double overscan, int channels) {
-+  CheckDistortLookupGrid(width, height, overscan);
-        if(channels==1) Warp<unsigned char,1>(distort_,src,dst,width,height);
-   else if(channels==2) Warp<unsigned char,2>(distort_,src,dst,width,height);
-   else if(channels==3) Warp<unsigned char,3>(distort_,src,dst,width,height);
-@@ -324,8 +330,8 @@ void CameraIntrinsics::Distort(const unsigned char* src, unsigned char* dst, int
-   //else assert("channels must be between 1 and 4");
- }
- 
--void CameraIntrinsics::Undistort(const float* src, float* dst, int width, int height, int channels) {
--  CheckUndistortLookupGrid(width, height);
-+void CameraIntrinsics::Undistort(const float* src, float* dst, int width, int height, double overscan, int channels) {
-+  CheckUndistortLookupGrid(width, height, overscan);
-        if(channels==1) Warp<float,1>(undistort_,src,dst,width,height);
-   else if(channels==2) Warp<float,2>(undistort_,src,dst,width,height);
-   else if(channels==3) Warp<float,3>(undistort_,src,dst,width,height);
-@@ -333,8 +339,8 @@ void CameraIntrinsics::Undistort(const float* src, float* dst, int width, int he
-   //else assert("channels must be between 1 and 4");
- }
- 
--void CameraIntrinsics::Undistort(const unsigned char* src, unsigned char* dst, int width, int height, int channels) {
--  CheckUndistortLookupGrid(width, height);
-+void CameraIntrinsics::Undistort(const unsigned char* src, unsigned char* dst, int width, int height, double overscan, int channels) {
-+  CheckUndistortLookupGrid(width, height, overscan);
-        if(channels==1) Warp<unsigned char,1>(undistort_,src,dst,width,height);
-   else if(channels==2) Warp<unsigned char,2>(undistort_,src,dst,width,height);
-   else if(channels==3) Warp<unsigned char,3>(undistort_,src,dst,width,height);
-diff --git a/src/libmv/simple_pipeline/camera_intrinsics.h b/src/libmv/simple_pipeline/camera_intrinsics.h
-index f525571..f4bf903 100644
---- a/src/libmv/simple_pipeline/camera_intrinsics.h
-+++ b/src/libmv/simple_pipeline/camera_intrinsics.h
-@@ -91,7 +91,7 @@ class CameraIntrinsics {
-       \note This is the reference implementation using floating point images.
-   */
-   void Distort(const float* src, float* dst,
--               int width, int height, int channels);
-+               int width, int height, double overscan, int channels);
-   /*!
-       Distort an image using the current camera instrinsics
- 
-@@ -101,7 +101,7 @@ class CameraIntrinsics {
-       \note This version is much faster.
-   */
-   void Distort(const unsigned char* src, unsigned char* dst,
--               int width, int height, int channels);
-+               int width, int height, double overscan, int channels);
-   /*!
-       Undistort an image using the current camera instrinsics
- 
-@@ -111,7 +111,7 @@ class CameraIntrinsics {
-       \note This is the reference implementation using floating point images.
-   */
-   void Undistort(const float* src, float* dst,
--                 int width, int height, int channels);
-+                 int width, int height, double overscan, int channels);
-   /*!
-       Undistort an image using the current camera instrinsics
- 
-@@ -121,12 +121,12 @@ class CameraIntrinsics {
-       \note This version is much faster.
-   */
-   void Undistort(const unsigned char* src, unsigned char* dst,
--                 int width, int height, int channels);
-+                 int width, int height, double overscan, int channels);
- 
-  private:
--  template<typename WarpFunction> void ComputeLookupGrid(struct Grid* grid, int width, int height);
--  void CheckUndistortLookupGrid(int width, int height);
--  void CheckDistortLookupGrid(int width, int height);
-+  template<typename WarpFunction> void ComputeLookupGrid(struct Grid* grid, int width, int height, double overscan);
-+  void CheckUndistortLookupGrid(int width, int height, double overscan);
-+  void CheckDistortLookupGrid(int width, int height, double overscan);
-   void FreeLookupGrid();
- 
-   // The traditional intrinsics matrix from x = K[R|t]X.
diff --git a/extern/libmv/patches/scaled_distortion.patch b/extern/libmv/patches/scaled_distortion.patch
deleted file mode 100644
index 2da8329..0000000
--- a/extern/libmv/patches/scaled_distortion.patch
+++ /dev/null
@@ -1,261 +0,0 @@
-diff --git a/src/libmv/simple_pipeline/camera_intrinsics.cc b/src/libmv/simple_pipeline/camera_intrinsics.cc
-index f9888ff..110a16d 100644
---- a/src/libmv/simple_pipeline/camera_intrinsics.cc
-+++ b/src/libmv/simple_pipeline/camera_intrinsics.cc
-@@ -23,7 +23,32 @@
- 
- namespace libmv {
- 
--struct Offset { signed char ix,iy; unsigned char fx,fy; };
-+struct Offset {
-+  signed char ix, iy;
-+  unsigned char fx,fy;
-+};
-+
-+struct Grid {
-+  struct Offset *offset;
-+  int width, height;
-+};
-+
-+static struct Grid *copyGrid(struct Grid *from)
-+{
-+  struct Grid *to = NULL;
-+
-+  if (from) {
-+    to = new Grid;
-+
-+    to->width = from->width;
-+    to->height = from->height;
-+
-+    to->offset = new Offset[to->width*to->height];
-+    memcpy(to->offset, from->offset, sizeof(struct Offset)*to->width*to->height);
-+  }
-+
-+  return to;
-+}
- 
- CameraIntrinsics::CameraIntrinsics()
-     : K_(Mat3::Identity()),
-@@ -37,9 +62,22 @@ CameraIntrinsics::CameraIntrinsics()
-       distort_(0),
-       undistort_(0) {}
- 
-+CameraIntrinsics::CameraIntrinsics(const CameraIntrinsics &from)
-+    : K_(from.K_),
-+      image_width_(from.image_width_),
-+      image_height_(from.image_height_),
-+      k1_(from.k1_),
-+      k2_(from.k2_),
-+      k3_(from.k3_),
-+      p1_(from.p1_),
-+      p2_(from.p2_)
-+{
-+  distort_ = copyGrid(from.distort_);
-+  undistort_ = copyGrid(from.undistort_);
-+}
-+
- CameraIntrinsics::~CameraIntrinsics() {
--  if(distort_) delete[] distort_;
--  if(undistort_) delete[] undistort_;
-+  FreeLookupGrid();
- }
- 
- /// Set the entire calibration matrix at once.
-@@ -146,11 +184,17 @@ void CameraIntrinsics::InvertIntrinsics(double image_x,
- 
- // TODO(MatthiasF): downsample lookup
- template<typename WarpFunction>
--void CameraIntrinsics::ComputeLookupGrid(Offset* grid, int width, int height) {
-+void CameraIntrinsics::ComputeLookupGrid(Grid* grid, int width, int height) {
-+  double aspx = (double)width / image_width_;
-+  double aspy = (double)height / image_height_;
-+
-   for (int y = 0; y < height; y++) {
-     for (int x = 0; x < width; x++) {
-+      double src_x = x / aspx, src_y = y / aspy;
-       double warp_x, warp_y;
--      WarpFunction(this,x,y,&warp_x,&warp_y);
-+      WarpFunction(this,src_x,src_y,&warp_x,&warp_y);
-+      warp_x = warp_x*aspx;
-+      warp_y = warp_y*aspy;
-       int ix = int(warp_x), iy = int(warp_y);
-       int fx = round((warp_x-ix)*256), fy = round((warp_y-iy)*256);
-       if(fx == 256) { fx=0; ix++; }
-@@ -162,10 +206,10 @@ void CameraIntrinsics::ComputeLookupGrid(Offset* grid, int width, int height) {
-       if( iy >= height-2 ) iy = height-2;
-       if ( ix-x > -128 && ix-x < 128 && iy-y > -128 && iy-y < 128 ) {
-         Offset offset = { ix-x, iy-y, fx, fy };
--        grid[y*width+x] = offset;
-+        grid->offset[y*width+x] = offset;
-       } else {
-         Offset offset = { 0, 0, 0, 0 };
--        grid[y*width+x] = offset;
-+        grid->offset[y*width+x] = offset;
-       }
-     }
-   }
-@@ -173,11 +217,11 @@ void CameraIntrinsics::ComputeLookupGrid(Offset* grid, int width, int height) {
- 
- // TODO(MatthiasF): cubic B-Spline image sampling, bilinear lookup
- template<typename T,int N>
--static void Warp(const Offset* grid, const T* src, T* dst,
-+static void Warp(const Grid* grid, const T* src, T* dst,
-                  int width, int height) {
-   for (int y = 0; y < height; y++) {
-     for (int x = 0; x < width; x++) {
--      Offset offset = grid[y*width+x];
-+      Offset offset = grid->offset[y*width+x];
-       const T* s = &src[((y+offset.iy)*width+(x+offset.ix))*N];
-       for (int i = 0; i < N; i++) {
-         dst[(y*width+x)*N+i] = ((s[        i] * (256-offset.fx) + s[        N+i] * offset.fx) * (256-offset.fy)
-@@ -188,8 +232,17 @@ static void Warp(const Offset* grid, const T* src, T* dst,
- }
- 
- void CameraIntrinsics::FreeLookupGrid() {
--  if(distort_) delete distort_, distort_=0;
--  if(undistort_) delete undistort_, undistort_=0;
-+  if(distort_) {
-+    delete distort_->offset;
-+    delete distort_;
-+    distort_ = NULL;
-+  }
-+
-+  if(undistort_) {
-+    delete undistort_->offset;
-+    delete undistort_;
-+    undistort_ = NULL;
-+  }
- }
- 
- // FIXME: C++ templates limitations makes thing complicated, but maybe there is a simpler method.
-@@ -211,11 +264,50 @@ struct InvertIntrinsicsFunction {
-   }
- };
- 
--void CameraIntrinsics::Distort(const float* src, float* dst, int width, int height, int channels) {
--  if(!distort_) {
--    distort_ = new Offset[width*height];
--    ComputeLookupGrid<InvertIntrinsicsFunction>(distort_,width,height);
-+void CameraIntrinsics::CheckDistortLookupGrid(int width, int height)
-+{
-+  if(distort_) {
-+    if(distort_->width != width || distort_->height != height) {
-+      delete [] distort_->offset;
-+      distort_->offset = NULL;
-+    }
-+  } else {
-+    distort_ = new Grid;
-+    distort_->offset = NULL;
-+  }
-+
-+  if(!distort_->offset) {
-+      distort_->offset = new Offset[width*height];
-+      ComputeLookupGrid<InvertIntrinsicsFunction>(distort_,width,height);
-   }
-+
-+  distort_->width = width;
-+  distort_->height = height;
-+}
-+
-+void CameraIntrinsics::CheckUndistortLookupGrid(int width, int height)
-+{
-+  if(undistort_) {
-+    if(undistort_->width != width || undistort_->height != height) {
-+      delete [] undistort_->offset;
-+      undistort_->offset = NULL;
-+    }
-+  } else {
-+    undistort_ = new Grid;
-+    undistort_->offset = NULL;
-+  }
-+
-+  if(!undistort_->offset) {
-+      undistort_->offset = new Offset[width*height];
-+      ComputeLookupGrid<ApplyIntrinsicsFunction>(undistort_,width,height);
-+  }
-+
-+  undistort_->width = width;
-+  undistort_->height = height;
-+}
-+
-+void CameraIntrinsics::Distort(const float* src, float* dst, int width, int height, int channels) {
-+  CheckDistortLookupGrid(width, height);
-        if(channels==1) Warp<float,1>(distort_,src,dst,width,height);
-   else if(channels==2) Warp<float,2>(distort_,src,dst,width,height);
-   else if(channels==3) Warp<float,3>(distort_,src,dst,width,height);
-@@ -224,10 +316,7 @@ void CameraIntrinsics::Distort(const float* src, float* dst, int width, int heig
- }
- 
- void CameraIntrinsics::Distort(const unsigned char* src, unsigned char* dst, int width, int height, int channels) {
--  if(!distort_) {
--    distort_ = new Offset[width*height];
--    ComputeLookupGrid<InvertIntrinsicsFunction>(distort_,width,height);
--  }
-+  CheckDistortLookupGrid(width, height);
-        if(channels==1) Warp<unsigned char,1>(distort_,src,dst,width,height);
-   else if(channels==2) Warp<unsigned char,2>(distort_,src,dst,width,height);
-   else if(channels==3) Warp<unsigned char,3>(distort_,src,dst,width,height);
-@@ -236,10 +325,7 @@ void CameraIntrinsics::Distort(const unsigned char* src, unsigned char* dst, int
- }
- 
- void CameraIntrinsics::Undistort(const float* src, float* dst, int width, int height, int channels) {
--  if(!undistort_) {
--    undistort_ = new Offset[width*height];
--    ComputeLookupGrid<ApplyIntrinsicsFunction>(undistort_,width,height);
--  }
-+  CheckUndistortLookupGrid(width, height);
-        if(channels==1) Warp<float,1>(undistort_,src,dst,width,height);
-   else if(channels==2) Warp<float,2>(undistort_,src,dst,width,height);
-   else if(channels==3) Warp<float,3>(undistort_,src,dst,width,height);
-@@ -248,10 +334,7 @@ void CameraIntrinsics::Undistort(const float* src, float* dst, int width, int he
- }
- 
- void CameraIntrinsics::Undistort(const unsigned char* src, unsigned char* dst, int width, int height, int channels) {
--  if(!undistort_) {
--    undistort_ = new Offset[width*height];
--    ComputeLookupGrid<ApplyIntrinsicsFunction>(undistort_,width,height);
--  }
-+  CheckUndistortLookupGrid(width, height);
-        if(channels==1) Warp<unsigned char,1>(undistort_,src,dst,width,height);
-   else if(channels==2) Warp<unsigned char,2>(undistort_,src,dst,width,height);
-   else if(channels==3) Warp<unsigned char,3>(undistort_,src,dst,width,height);
-diff --git a/src/libmv/simple_pipeline/camera_intrinsics.h b/src/libmv/simple_pipeline/camera_intrinsics.h
-index 29bc8a1..f525571 100644
---- a/src/libmv/simple_pipeline/camera_intrinsics.h
-+++ b/src/libmv/simple_pipeline/camera_intrinsics.h
-@@ -26,11 +26,12 @@ typedef Eigen::Matrix<double, 3, 3> Mat3;
- 
- namespace libmv {
- 
--struct Offset;
-+struct Grid;
- 
- class CameraIntrinsics {
-  public:
-   CameraIntrinsics();
-+  CameraIntrinsics(const CameraIntrinsics &from);
-   ~CameraIntrinsics();
- 
-   const Mat3 &K()                 const { return K_;            }
-@@ -123,7 +124,9 @@ class CameraIntrinsics {
-                  int width, int height, int channels);
- 
-  private:
--  template<typename WarpFunction> void ComputeLookupGrid(Offset* grid, int width, int height);
-+  template<typename WarpFunction> void ComputeLookupGrid(struct Grid* grid, int width, int height);
-+  void CheckUndistortLookupGrid(int width, int height);
-+  void CheckDistortLookupGrid(int width, int height);
-   void FreeLookupGrid();
- 
-   // The traditional intrinsics matrix from x = K[R|t]X.
-@@ -140,8 +143,8 @@ class CameraIntrinsics {
-   // independent of image size.
-   double k1_, k2_, k3_, p1_, p2_;
- 
--  Offset* distort_;
--  Offset* undistort_;
-+  struct Grid *distort_;
-+  struct Grid *undistort_;
- };
- 
- }  // namespace libmv
diff --git a/extern/libmv/patches/series b/extern/libmv/patches/series
index 00a52c1..1db7983 100644
--- a/extern/libmv/patches/series
+++ b/extern/libmv/patches/series
@@ -1,13 +1 @@
 v3d_verbosity.patch
-snrptinf_fix.patch
-bundle_tweaks.patch
-fast.patch
-config_mac.patch
-levenberg_marquardt.patch
-function_derivative.patch
-high_distortion_crash_fix.patch
-mingw.patch
-msvc2010.patch
-scaled_distortion.patch
-overscan.patch
-detect.patch
diff --git a/extern/libmv/patches/snrptinf_fix.patch b/extern/libmv/patches/snrptinf_fix.patch
deleted file mode 100644
index e886a67..0000000
--- a/extern/libmv/patches/snrptinf_fix.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git a/src/libmv/simple_pipeline/pipeline.cc b/src/libmv/simple_pipeline/pipeline.cc
-index 652d70c..25cd2c2 100644
---- a/src/libmv/simple_pipeline/pipeline.cc
-+++ b/src/libmv/simple_pipeline/pipeline.cc
-@@ -28,6 +28,10 @@
- #include "libmv/simple_pipeline/tracks.h"
- #include "libmv/simple_pipeline/camera_intrinsics.h"
- 
-+#ifdef _MSC_VER
-+#  define snprintf _snprintf
-+#endif
-+
- namespace libmv {
- 
- void CompleteReconstruction(const Tracks &tracks,
diff --git a/extern/libmv/patches/v3d_verbosity.patch b/extern/libmv/patches/v3d_verbosity.patch
index a54f3dc..f5c6afb 100644
--- a/extern/libmv/patches/v3d_verbosity.patch
+++ b/extern/libmv/patches/v3d_verbosity.patch
@@ -1,12 +1,12 @@
 diff --git a/src/libmv/simple_pipeline/bundle.cc b/src/libmv/simple_pipeline/bundle.cc
-index 310660d..f819603 100644
+index fa0b6cc..d382cd5 100644
 --- a/src/libmv/simple_pipeline/bundle.cc
 +++ b/src/libmv/simple_pipeline/bundle.cc
-@@ -141,7 +141,6 @@ void Bundle(const Tracks &tracks, Reconstruction *reconstruction) {
-   v3d_distortion.p2 = 0;
+@@ -194,7 +194,6 @@ void EuclideanBundleCommonIntrinsics(const Tracks &tracks,
+   double v3d_inlier_threshold = 500000.0;
  
    // Finally, run the bundle adjustment.
 -  V3D::optimizerVerbosenessLevel = 1;
-   double const inlierThreshold = 500000.0;
-   V3D::CommonInternalsMetricBundleOptimizer opt(V3D::FULL_BUNDLE_METRIC,
-                                                 inlierThreshold,
+   V3D::CommonInternalsMetricBundleOptimizer opt(v3d_bundle_intrinsics,
+                                                 v3d_inlier_threshold,
+                                                 v3d_K,
diff --git a/extern/libmv/third_party/gflags/AUTHORS b/extern/libmv/third_party/gflags/AUTHORS
new file mode 100644
index 0000000..887918b
--- /dev/null
+++ b/extern/libmv/third_party/gflags/AUTHORS
@@ -0,0 +1,2 @@
+google-gflags at googlegroups.com
+
diff --git a/extern/libmv/third_party/gflags/COPYING b/extern/libmv/third_party/gflags/COPYING
new file mode 100644
index 0000000..d15b0c2
--- /dev/null
+++ b/extern/libmv/third_party/gflags/COPYING
@@ -0,0 +1,28 @@
+Copyright (c) 2006, 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.
diff --git a/extern/libmv/third_party/gflags/ChangeLog b/extern/libmv/third_party/gflags/ChangeLog
new file mode 100644
index 0000000..f9ef935
--- /dev/null
+++ b/extern/libmv/third_party/gflags/ChangeLog
@@ -0,0 +1,195 @@
+Wed Jan 25 15:09:14 2012  Google Inc. <google-gflags at googlegroups.com>
+
+	* gflags: version 2.0
+	* Changed the 'official' gflags email in setup.py/etc
+	* Renamed google-gflags.sln to gflags.sln
+	* Changed copyright text to reflect Google's relinquished ownership
+
+Tue Dec 20 19:48:57 2011  Google Inc. <opensource at google.com>
+
+	* google-gflags: version 1.7
+	* Add CommandLineFlagInfo::flag_ptr pointing to current storage (musji)
+	* PORTING: flush after writing to stderr, needed on cygwin
+	* PORTING: Clean up the GFLAGS_DLL_DECL stuff better
+	* Fix a bug in StringPrintf() that affected large strings (csilvers)
+	* Die at configure-time when g++ isn't installed
+
+Fri Jul 29 19:05:21 2011  Google Inc. <opensource at google.com>
+
+	* google-gflags: version 1.6
+	* BUGFIX: Fix a bug where we were leaving out a required $(top_srcdir)
+	* Fix definition of clstring (jyrki)
+	* Split up flag declares into its own file (jyrki)
+	* Add --version support (csilvers)
+	* Update the README for gflags with static libs
+	* Update acx_pthread.m4 for nostdlib
+	* Change ReparseCommandLineFlags to return void (csilvers)
+	* Some doc typofixes and example augmentation (various)
+
+Mon Jan 24 16:11:35 2011  Google Inc. <opensource at google.com>
+
+	* google-gflags: version 1.5
+	* Better reporting of current vs default value (handler)
+	* Add API for cleaning up of memory at program-exit (jmarantz)
+	* Fix macros to work inside namespaces (csilvers)
+	* Use our own string typedef in case string is redefined (csilvers)
+	* Updated to autoconf 2.65
+
+Wed Oct 13 17:40:12 2010  Google Inc. <opensource at google.com>
+
+	* google-gflags: version 1.4
+	* Add a check to prevent passing 0 to DEFINE_string (jorg)
+	* Reduce compile (.o) size (jyrki)
+	* Some small changes to quiet debug compiles (alexk)
+	* PORTING: better support static linking on windows (csilvers)
+	* DOCUMENTATION: change default values, use validators, etc.
+	* Update the NEWS file to be non-empty
+	* Add pkg-config (.pc) files for libgflags and libgflags_nothreads
+
+Mon Jan  4 18:09:30 2010  Google Inc. <opensource at google.com>
+
+	* google-gflags: version 1.3
+	* PORTABILITY: can now build and run tests under MSVC (csilvers)
+	* Remove the python gflags code, which is now its own package (tansell)
+	* Clarify that "last flag wins" in the docs (csilvers)
+	* Comment danger of using GetAllFlags in validators (wojtekm)
+	* PORTABILITY: Some fixes necessary for c++0x (mboerger)
+	* Makefile fix: $(srcdir) -> $(top_srcdir) in one place (csilvres)
+	* INSTALL: autotools to autoconf v2.64 + automake v1.11 (csilvers)
+
+Thu Sep 10 12:53:04 2009  Google Inc. <opensource at google.com>
+
+	* google-gflags: version 1.2
+	* PORTABILITY: can now build and run tests under mingw (csilvers)
+	* Using a string arg for a bool flag is a compile-time error (rbayardo)
+	* Add --helpxml to gflags.py (salcianu)
+	* Protect against a hypothetical global d'tor mutex problem (csilvers)
+	* BUGFIX: can now define a flag after 'using namespace google' (hamaji)
+
+Tue Apr 14 12:35:25 2009  Google Inc. <opensource at google.com>
+
+	* google-gflags: version 1.1
+	* Add both foo and nofoo for boolean flags, with --undefok (andychu)
+	* Better document how validators work (wojtekm)
+	* Improve binary-detection for bash-completion (mtamsky)
+	* Python: Add a concept of "key flags", used with --help (salcianu)
+	* Python: Robustify flag_values (salcianu)
+	* Python: Add a new DEFINE_bool alias (keir, andrewliu)
+	* Python: Do module introspection based on module name (dsturtevant)
+	* Fix autoconf a bit better, especially on windows and solaris (ajenjo)
+	* BUG FIX: gflags_nothreads was linking against the wrong lib (ajenjo)
+	* BUG FIX: threads-detection failed on FreeBSD; replace it (ajenjo)
+	* PORTABILITY: Quiet an internal compiler error with SUSE 10 (csilvers)
+	* PORTABILITY: Update deb.sh for more recenty debuilds (csilvers)
+	* PORTABILITY: #include more headers to satify new gcc's (csilvers)
+	* INSTALL: Updated to autoconf 2.61 and libtool 1.5.26 (csilvers)
+
+Fri Oct  3 15:16:46 2008  Google Inc. <opensource at google.com>
+
+	* google-gflags: version 1.0
+	* Add a missing newline to an error string (bcmills)
+	* (otherwise exactly the same as gflags 1.0rc2)
+
+Thu Sep 18 12:58:05 2008  Google Inc. <opensource at google.com>
+
+	* google-gflags: version 1.0rc2
+	* Report current flag values in --helpxml (hdn)
+	* Fix compilation troubles with gcc 4.3.3 (simonb)
+	* BUG FIX: I was missing a std:: in DECLARE_string (csilvers)
+	* BUG FIX: Clarify in docs how to specify --bool flags (csilvers)
+	* BUG FIX: Fix --helpshort for source files not in a subdir (csilvers)
+	* BUG FIX: Fix python unittest for 64-bit builds (bcmills)
+	
+Tue Aug 19 16:15:48 2008
+
+	* google-gflags: version 1.0rc1
+	* Move #include files from google/ to gflags/ (csilvers)
+	* Small optimizations to reduce binary (library) size (jyrki)
+	* BUGFIX: forgot a std:: in one of the .h files (csilvers)
+	* Speed up locking by making sure calls are inlined (ajenjo)
+	* 64-BIT COMPATIBILITY: Use %PRId64 instead of %lld (csilvers)
+	* PORTABILITY: fix Makefile to work with Cygwin (ajenjo)
+	* PORTABILITY: fix code to compile under Visual Studio (ajenjo)
+	* PORTABILITY: fix code to compile under Solaris 10 with CC (csilvers)
+
+Mon Jul 21 23:01:38 2008  Google Inc. <opensource at google.com>
+
+	* google-gflags: version 0.9
+	* Add the ability to validate a command-line flag (csilvers)
+	* Add completion support for commandline flags in bash (daven)
+	* Add -W compile flags to Makefile, when using gcc (csilvers)
+	* Allow helpstring to be NULL (cristianoc)
+	* Improved documentation of classes in the .cc file (csilvers)
+	* Fix python bug with AppendFlagValues + shortnames (jjtswan)
+	* Use bool instead of int for boolean flags in gflags.py (bcmills)
+	* Simplify the way we declare flags, now more foolproof (csilvers)
+	* Better error messages when bool flags collide (colohan)
+	* Only evaluate DEFINE_foo macro args once (csilvers)
+
+Wed Mar 26 15:20:18 2008  Google Inc. <opensource at google.com>
+
+	* google-gflags: version 0.8
+	* Export DescribeOneFlag() in the API
+	* Add support for automatic line wrapping at 80 cols for gflags.py
+	* Bugfix: do not treat an isolated "-" the same as an isolated "--"
+	* Update rpm spec to point to Google Code rather than sourceforge (!)
+	* Improve documentation (including documenting thread-safety)
+	* Improve #include hygiene
+	* Improve testing
+	
+Thu Oct 18 11:33:20 2007  Google Inc. <opensource at google.com>
+
+	* google-gflags: version 0.7
+	* Deal even more correctly with libpthread not linked in (csilvers)
+	* Add STRIP_LOG, an improved DO_NOT_SHOW_COMMANDLINE_HELP (sioffe)
+	* Be more accurate printing default flag values in --help (dsturtevant)
+	* Reduce .o file size a bit by using shorter namespace names (jeff)
+	* Use relative install path, so 'setup.py --home' works (csilvers)
+	* Notice when a boolean flag has a non-boolean default (bnmouli)
+	* Broaden --helpshort to match foo-main.cc and foo_main.cc (hendrie)
+	* Fix "no modules match" message for --helpshort, etc (hendrie)
+
+Wed Aug 15 07:35:51 2007  Google Inc. <opensource at google.com>
+
+	* google-gflags: version 0.6
+	* Deal correctly with case that libpthread is not linked in (csilvers)
+	* Update Makefile/tests so we pass "make distcheck" (csilvers)
+	* Document and test that last assignment to a flag wins (wan)
+
+Tue Jun 12 15:23:42 2007  Google Inc. <opensource at google.com>
+
+	* google-gflags: version 0.5
+	* Include all m4 macros in the distribution (csilvers)
+	* Python: Fix broken data_files field in setup.py (sidlon)
+	* Python: better string serliaizing and unparsing (abo, csimmons)
+	* Fix checks for NaN and inf to work with Mac OS X (csilvers)
+	
+Thu Apr 19 15:15:07 2007  Google Inc. <opensource at google.com>
+
+	* google-gflags: version 0.4
+	* Remove is_default from GetCommandLineFlagInfo (csilvers)
+	* Portability fixes: includes, strtoll, gcc4.3 errors (csilvers)
+	* A few doc typo cleanups (csilvers)
+
+Wed Mar 28 12:15:56 2007  Google Inc. <opensource at google.com>
+
+	* google-gflags: version 0.3
+	* python portability fix: use popen instead of subprocess (csilvers)
+	* Add is_default to CommandLineFlagInfo (pchien)
+	* Make docs a bit prettier (csilvers)
+	* Actually include the python files in the distribution! :-/ (csilvers)
+
+Mon Jan 22 15:33:06 2007  Google Inc. <opensource at google.com>
+
+	* google-gflags: version 0.2
+	* added support for python commandlineflags, as well as c++
+	* gflags2man, a script to turn flags into a man page (dchristian)
+
+Wed Dec 13 12:37:19 2006  Google Inc. <opensource at google.com>
+
+	* google-gflags: initial release:
+	The gflags package contains a library that implements commandline
+	flags processing.  As such it's a replacement for getopt().  It
+	has increased flexibility, including built-in support for C++
+	types like string, and the ability to define flags in the source
+	file in which they're used.
diff --git a/extern/libmv/third_party/gflags/NEWS b/extern/libmv/third_party/gflags/NEWS
new file mode 100644
index 0000000..ffc0127
--- /dev/null
+++ b/extern/libmv/third_party/gflags/NEWS
@@ -0,0 +1,158 @@
+== 25 January 2012 ==
+
+I've just released gflags 2.0.
+
+The `google-gflags` project has been renamed to `gflags`.  I
+(csilvers) am stepping down as maintainer, to be replaced by Andreas
+Schuh.  Welcome to the team, Andreas!  I've seen the energy you have
+around gflags and the ideas you have for the project going forward,
+and look forward to having you on the team.
+
+I bumped the major version number up to 2 to reflect the new community
+ownership of the project.  All the
+[http://gflags.googlecode.com/svn/tags/gflags-2.0/ChangeLog changes]
+are related to the renaming.  There are no functional changes from
+gflags 1.7.  In particular, I've kept the code in the namespace
+`google`, though in a future version it should be renamed to `gflags`.
+I've also kept the `/usr/local/include/google/` subdirectory as
+synonym of `/usr/local/include/gflags/`, though the former name has
+been obsolete for some time now.
+
+
+=== 18 January 2011 ===
+
+The `google-gflags` Google Code page has been renamed to
+`gflags`, in preparation for the project being renamed to
+`gflags`.  In the coming weeks, I'll be stepping down as
+maintainer for the gflags project, and as part of that Google is
+relinquishing ownership of the project; it will now be entirely
+community run.  The name change reflects that shift.
+
+
+=== 20 December 2011 ===
+
+I've just released gflags 1.7.  This is a minor release; the major
+change is that `CommandLineFlagInfo` now exports the address in memory
+where the flag is located.  There has also been a bugfix involving
+very long --help strings, and some other minor
+[http://code.google.com/p/google-gflags/source/browse/tags/gflags-1.7/ChangeLog changes].
+
+=== 29 July 2011 ===
+
+I've just released gflags 1.6.  The major new feature in this release
+is support for setting version info, so that --version does something
+useful.
+
+One minor change has required bumping the library number:
+`ReparseCommandlineFlags` now returns `void` instead of `int` (the int
+return value was always meaningless).  Though I doubt anyone ever used
+this (meaningless) return value, technically it's a change to the ABI
+that requires a version bump.  A bit sad.
+
+There's also a procedural change with this release: I've changed the
+internal tools used to integrate Google-supplied patches for gflags
+into the opensource release.  These new tools should result in more
+frequent updates with better change descriptions.  They will also
+result in future `ChangeLog` entries being much more verbose (for better
+or for worse).
+
+See the
+[http://code.google.com/p/google-gflags/source/browse/tags/gflags-1.6/ChangeLog ChangeLog]
+for a full list of changes for this release.
+
+=== 24 January 2011 ===
+
+I've just released gflags 1.5.  This release has only minor changes
+from 1.4, including some slightly better reporting in --help, and
+an new memory-cleanup function that can help when running gflags-using
+libraries under valgrind.  The major change is to fix up the macros
+(`DEFINE_bool` and the like) to work more reliably inside namespaces.
+
+If you have not had a problem with these macros, and don't need any of
+the other changes described, there is no need to upgrade.  See the
+[http://code.google.com/p/google-gflags/source/browse/tags/gflags-1.5/ChangeLog ChangeLog]
+for a full list of changes for this release.
+
+=== 11 October 2010 ===
+
+I've just released gflags 1.4.  This release has only minor changes
+from 1.3, including some documentation tweaks and some work to make
+the library smaller.  If 1.3 is working well for you, there's no
+particular reason to upgrade.
+
+=== 4 January 2010 ===
+
+I've just released gflags 1.3.  gflags now compiles under MSVC, and
+all tests pass.  I *really* never thought non-unix-y Windows folks
+would want gflags, but at least some of them do.
+
+The major news, though, is that I've separated out the python package
+into its own library, [http://code.google.com/p/python-gflags python-gflags].
+If you're interested in the Python version of gflags, that's the place to
+get it now.
+
+=== 10 September 2009 ==
+
+I've just released gflags 1.2.  The major change from gflags 1.1 is it
+now compiles under MinGW (as well as cygwin), and all tests pass.  I
+never thought Windows folks would want unix-style command-line flags,
+since they're so different from the Windows style, but I guess I was
+wrong!
+
+The other changes are minor, such as support for --htmlxml in the
+python version of gflags.
+
+=== 15 April 2009 ===
+
+I've just released gflags 1.1.  It has only minor changes fdrom gflags
+1.0 (see the
+[http://code.google.com/p/google-gflags/source/browse/tags/gflags-1.1/ChangeLog ChangeLog]
+for details).  The major change is that I moved to a new
+system for creating .deb and .rpm files.  This allows me to create
+x86_64 deb and rpm files.
+
+In the process of moving to this new system, I noticed an
+inconsistency: the tar.gz and .rpm files created libraries named
+libgflags.so, but the deb file created libgoogle-gflags.so.  I have
+fixed the deb file to create libraries like the others.  I'm no expert
+in debian packaging, but I believe this has caused the package name to
+change as well.  Please let me know (at
+[mailto:google-gflags at googlegroups.com
+google-gflags at googlegroups.com]) if this causes problems for you --
+especially if you know of a fix!  I would be happy to change the deb
+packages to add symlinks from the old library name to the new
+(libgoogle-gflags.so -> libgflags.so), but that is beyond my knowledge
+of how to make .debs.
+
+If you've tried to install a .rpm or .deb and it doesn't work for you,
+let me know.  I'm excited to finally have 64-bit package files, but
+there may still be some wrinkles in the new system to iron out.
+
+===1 October 2008===
+
+gflags 1.0rc2 was out for a few weeks without any issues, so gflags
+1.0 is now released.  This is much like gflags 0.9.  The major change
+is that the .h files have been moved from `/usr/include/google` to
+`/usr/include/gflags`.  While I have backwards-compatibility
+forwarding headeds in place, please rewrite existing code to say
+{{{
+   #include <gflags/gflags.h>
+}}}
+instead of
+{{{
+   #include <google/gflags.h>
+}}}
+
+I've kept the default namespace to google.  You can still change with
+with the appropriate flag to the configure script (`./configure
+--help` to see the flags).  If you have feedback as to whether the
+default namespace should change to gflags, which would be a
+non-backwards-compatible change, send mail to
+`google-gflags at googlegroups.com`!
+
+Version 1.0 also has some neat new features, like support for bash
+commandline-completion of help flags.  See the
+[http://code.google.com/p/google-gflags/source/browse/tags/gflags-1.0rc2/ChangeLog
+ChangeLog] for more details.
+
+If I don't hear any bad news for a few weeks, I'll release 1.0-final.
diff --git a/extern/libmv/third_party/gflags/README.libmv b/extern/libmv/third_party/gflags/README.libmv
index f2bdef6..673099c 100644
--- a/extern/libmv/third_party/gflags/README.libmv
+++ b/extern/libmv/third_party/gflags/README.libmv
@@ -1,7 +1,7 @@
 Project: Google Flags
 URL: http://code.google.com/p/google-gflags/
 License: New BSD
-Upstream version: 1.5
+Upstream version: 2.0
 Local modifications:
 
 - Flattened the tree and only included files needed for libmv. This involved
diff --git a/extern/libmv/third_party/gflags/config.h b/extern/libmv/third_party/gflags/config.h
index ca2c127..03ed03c 100644
--- a/extern/libmv/third_party/gflags/config.h
+++ b/extern/libmv/third_party/gflags/config.h
@@ -15,7 +15,7 @@
 #define HAVE_DLFCN_H 1
 
 /* Define to 1 if you have the <fnmatch.h> header file. */
-#undef HAVE_FNMATCH_H
+/* #ubdef HAVE_FNMATCH_H 1 */
 
 /* Define to 1 if you have the <inttypes.h> header file. */
 #define HAVE_INTTYPES_H 1
@@ -29,12 +29,6 @@
 /* Define if you have POSIX threads libraries and header files. */
 #define HAVE_PTHREAD 1
 
-/* Define to 1 if you have the `putenv' function. */
-#define HAVE_PUTENV 1
-
-/* Define to 1 if you have the `setenv' function. */
-#define HAVE_SETENV 1
-
 /* Define to 1 if you have the <stdint.h> header file. */
 #define HAVE_STDINT_H 1
 
@@ -73,22 +67,19 @@
 #define PACKAGE "gflags"
 
 /* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT "opensource at google.com"
+#define PACKAGE_BUGREPORT "google-gflags at googlegroups.com"
 
 /* Define to the full name of this package. */
 #define PACKAGE_NAME "gflags"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "gflags 1.5"
+#define PACKAGE_STRING "gflags 2.0"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "gflags"
 
-/* Define to the home page for this package. */
-#define PACKAGE_URL ""
-
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "1.5"
+#define PACKAGE_VERSION "2.0"
 
 /* Define to necessary symbol if this constant uses a non-standard name on
    your system. */
@@ -101,7 +92,7 @@
 #define STL_NAMESPACE std
 
 /* Version number of package */
-#define VERSION "1.5"
+#define VERSION "2.0"
 
 /* Stops putting the code inside the Google namespace */
 #define _END_GOOGLE_NAMESPACE_ }
diff --git a/extern/libmv/third_party/gflags/gflags.cc b/extern/libmv/third_party/gflags/gflags.cc
index 34fe95d..4ba2b6f 100644
--- a/extern/libmv/third_party/gflags/gflags.cc
+++ b/extern/libmv/third_party/gflags/gflags.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006, Google Inc.
+// Copyright (c) 1999, Google Inc.
 // All rights reserved.
 //
 // Redistribution and use in source and binary forms, with or without
@@ -28,7 +28,6 @@
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 // ---
-// Author: Ray Sidney
 // Revamped and reorganized by Craig Silverstein
 //
 // This file contains the implementation of all our command line flags
@@ -88,76 +87,35 @@
 // other hand, hooks into CommandLineFlagParser.  Other API functions
 // are, similarly, mostly hooks into the functionality described above.
 
-#include "config.h"
 // This comes first to ensure we define __STDC_FORMAT_MACROS in time.
-#ifdef HAVE_INTTYPES_H
-#ifndef __STDC_FORMAT_MACROS
+#include "config.h"
+#if defined(HAVE_INTTYPES_H) && !defined(__STDC_FORMAT_MACROS)
 # define __STDC_FORMAT_MACROS 1   // gcc requires this to get PRId64, etc.
 #endif
-#include <inttypes.h>
-#endif  // HAVE_INTTYPES_H
-#include <stdio.h>     // for snprintf
+
+#include "gflags/gflags.h"
+#include <assert.h>
 #include <ctype.h>
 #include <errno.h>
-#include <stdio.h>
+#ifdef HAVE_FNMATCH_H
+# include <fnmatch.h>
+#endif
 #include <stdarg.h> // For va_list and related operations
+#include <stdio.h>
 #include <string.h>
-#include <assert.h>
-#ifdef HAVE_FNMATCH_H
-#include <fnmatch.h>
-#endif  // HAVE_FNMATCH_H
-#include <string>
+
+#include <algorithm>
 #include <map>
-#include <vector>
+#include <string>
 #include <utility>     // for pair<>
-#include <algorithm>
-#include "gflags.h"
+#include <vector>
 #include "mutex.h"
+#include "util.h"
 
 #ifndef PATH_SEPARATOR
 #define PATH_SEPARATOR  '/'
 #endif
 
-// Work properly if either strtoll or strtoq is on this system
-#ifdef HAVE_STRTOLL
-# define strtoint64  strtoll
-# define strtouint64  strtoull
-#elif HAVE_STRTOQ
-# define strtoint64  strtoq
-# define strtouint64  strtouq
-#else
-// Neither strtoll nor strtoq are defined.  I hope strtol works!
-# define strtoint64 strtol
-# define strtouint64 strtoul
-#endif
-
-// If we have inttypes.h, it will have defined PRId32/etc for us.  If
-// not, take our best guess.
-#ifndef PRId32
-# define PRId32 "d"
-#endif
-#ifndef PRId64
-# define PRId64 "lld"
-#endif
-#ifndef PRIu64
-# define PRIu64 "llu"
-#endif
-
-// Windows is missing random bits like strcasecmp, strtoll, strtoull, and
-// snprintf in the usual locations. Put them somewhere sensible.
-//
-// TODO(keir): Get the upstream Windows port and use that instead.
-#ifdef _MSC_VER
-# define snprintf _snprintf
-# undef strtoint64
-# define strtoint64 _strtoi64
-# undef strtouint64
-# define strtouint64 _strtoui64
-# define strcasecmp _stricmp
-#endif
-
-typedef signed char int8;
-typedef unsigned char uint8;
 
 // Special flags, type 1: the 'recursive' flags.  They set another flag's val.
 DEFINE_string(flagfile, "",
@@ -183,20 +141,21 @@ using std::sort;
 using std::string;
 using std::vector;
 
+// This is used by the unittest to test error-exit code
+void GFLAGS_DLL_DECL (*gflags_exitfunc)(int) = &exit;  // from stdlib.h
+
+
 // The help message indicating that the commandline flag has been
 // 'stripped'. It will not show up when doing "-help" and its
 // variants. The flag is stripped if STRIP_FLAG_HELP is set to 1
-// before including gflags/gflags.h.
+// before including base/gflags.h
 
-// This is used by this file, and also in commandlineflags_reporting.cc
+// This is used by this file, and also in gflags_reporting.cc
 const char kStrippedFlagHelp[] = "\001\002\003\004 (unknown) \004\003\002\001";
 
-// This is used by the unittest to test error-exit code
-void GFLAGS_DLL_DECL (*commandlineflags_exitfunc)(int) = &exit;   // from stdlib.h
-
 namespace {
 
-// There are also 'reporting' flags, in commandlineflags_reporting.cc.
+// There are also 'reporting' flags, in gflags_reporting.cc.
 
 static const char kError[] = "ERROR: ";
 
@@ -218,12 +177,14 @@ enum DieWhenReporting { DIE, DO_NOT_DIE };
 
 // Report Error and exit if requested.
 static void ReportError(DieWhenReporting should_die, const char* format, ...) {
+  char error_message[255];
   va_list ap;
   va_start(ap, format);
-  vfprintf(stderr, format, ap);
+  vsnprintf(error_message, sizeof(error_message), format, ap);
   va_end(ap);
-  if (should_die == DIE)
-    commandlineflags_exitfunc(1);   // almost certainly exit()
+  fprintf(stderr, "%s", error_message);
+  fflush(stderr);   // should be unnecessary, but cygwin's rxvt buffers stderr
+  if (should_die == DIE) gflags_exitfunc(1);
 }
 
 
@@ -317,6 +278,7 @@ bool FlagValue::ParseFrom(const char* value) {
   if (type_ == FV_BOOL) {
     const char* kTrue[] = { "1", "t", "true", "y", "yes" };
     const char* kFalse[] = { "0", "f", "false", "n", "no" };
+    COMPILE_ASSERT(sizeof(kTrue) == sizeof(kFalse), true_false_equal);
     for (size_t i = 0; i < sizeof(kTrue)/sizeof(*kTrue); ++i) {
       if (strcasecmp(value, kTrue[i]) == 0) {
         SET_VALUE_AS(bool, true);
@@ -346,7 +308,7 @@ bool FlagValue::ParseFrom(const char* value) {
 
   switch (type_) {
     case FV_INT32: {
-      const int64 r = strtoint64(value, &end, base);
+      const int64 r = strto64(value, &end, base);
       if (errno || end != value + strlen(value))  return false;  // bad parse
       if (static_cast<int32>(r) != r)  // worked, but number out of range
         return false;
@@ -354,7 +316,7 @@ bool FlagValue::ParseFrom(const char* value) {
       return true;
     }
     case FV_INT64: {
-      const int64 r = strtoint64(value, &end, base);
+      const int64 r = strto64(value, &end, base);
       if (errno || end != value + strlen(value))  return false;  // bad parse
       SET_VALUE_AS(int64, r);
       return true;
@@ -362,7 +324,7 @@ bool FlagValue::ParseFrom(const char* value) {
     case FV_UINT64: {
       while (*value == ' ') value++;
       if (*value == '-') return false;  // negative number
-      const uint64 r = strtouint64(value, &end, base);
+      const uint64 r = strtou64(value, &end, base);
       if (errno || end != value + strlen(value))  return false;  // bad parse
       SET_VALUE_AS(uint64, r);
       return true;
@@ -531,6 +493,7 @@ class CommandLineFlag {
   string default_value() const { return defvalue_->ToString(); }
   const char* type_name() const { return defvalue_->TypeName(); }
   ValidateFnProto validate_function() const { return validate_fn_proto_; }
+  const void* flag_ptr() const { return current_->value_buffer_; }
 
   void FillCommandLineFlagInfo(struct CommandLineFlagInfo* result);
 
@@ -583,7 +546,6 @@ const char* CommandLineFlag::CleanFileName() const {
   // search full path backwards.
   // Stop going backwards at kRootDir; and skip by the first slash.
   static const char kRootDir[] = "";    // can set this to root directory,
-                                        // e.g. "myproject"
 
   if (sizeof(kRootDir)-1 == 0)          // no prefix to strip
     return filename();
@@ -592,8 +554,7 @@ const char* CommandLineFlag::CleanFileName() const {
   while ( clean_name > filename() ) {
     if (*clean_name == PATH_SEPARATOR) {
       if (strncmp(clean_name, kRootDir, sizeof(kRootDir)-1) == 0) {
-        // ".../myproject/base/logging.cc" ==> "base/logging.cc"
-        clean_name += sizeof(kRootDir)-1;    // past "/myproject/"
+        clean_name += sizeof(kRootDir)-1;    // past root-dir
         break;
       }
     }
@@ -614,6 +575,7 @@ void CommandLineFlag::FillCommandLineFlagInfo(
   UpdateModifiedBit();
   result->is_default = !modified_;
   result->has_validator_fn = validate_function() != NULL;
+  result->flag_ptr = flag_ptr();
 }
 
 void CommandLineFlag::UpdateModifiedBit() {
@@ -634,6 +596,7 @@ void CommandLineFlag::CopyFrom(const CommandLineFlag& src) {
 }
 
 bool CommandLineFlag::Validate(const FlagValue& value) const {
+
   if (validate_function() == NULL)
     return true;
   else
@@ -657,10 +620,14 @@ struct StringCmp {  // Used by the FlagRegistry map class to compare char*'s
   }
 };
 
+
 class FlagRegistry {
  public:
-  FlagRegistry() { }
+  FlagRegistry() {
+  }
   ~FlagRegistry() {
+    // Not using STLDeleteElements as that resides in util and this
+    // class is base.
     for (FlagMap::iterator p = flags_.begin(), e = flags_.end(); p != e; ++p) {
       CommandLineFlag* flag = p->second;
       delete flag;
@@ -672,12 +639,12 @@ class FlagRegistry {
     global_registry_ = NULL;
   }
 
-  void Lock() { lock_.Lock(); }
-  void Unlock() { lock_.Unlock(); }
-
   // Store a flag in this registry.  Takes ownership of the given pointer.
   void RegisterFlag(CommandLineFlag* flag);
 
+  void Lock() { lock_.Lock(); }
+  void Unlock() { lock_.Unlock(); }
+
   // Returns the flag object for the specified name, or NULL if not found.
   CommandLineFlag* FindFlagLocked(const char* name);
 
@@ -718,26 +685,26 @@ class FlagRegistry {
   typedef map<const void*, CommandLineFlag*> FlagPtrMap;
   FlagPtrMap flags_by_ptr_;
 
+  static FlagRegistry* global_registry_;   // a singleton registry
+
   Mutex lock_;
+  static Mutex global_registry_lock_;
 
-  static FlagRegistry* global_registry_;   // a singleton registry
-  static Mutex global_registry_lock_;  // guards creation of global_registry_
+  static void InitGlobalRegistry();
 
   // Disallow
   FlagRegistry(const FlagRegistry&);
   FlagRegistry& operator=(const FlagRegistry&);
 };
 
-FlagRegistry* FlagRegistry::global_registry_ = NULL;
-Mutex FlagRegistry::global_registry_lock_(Mutex::LINKER_INITIALIZED);
+class FlagRegistryLock {
+ public:
+  explicit FlagRegistryLock(FlagRegistry* fr) : fr_(fr) { fr_->Lock(); }
+  ~FlagRegistryLock() { fr_->Unlock(); }
+ private:
+  FlagRegistry *const fr_;
+};
 
-FlagRegistry* FlagRegistry::GlobalRegistry() {
-  MutexLock acquire_lock(&global_registry_lock_);
-  if (!global_registry_) {
-    global_registry_ = new FlagRegistry;
-  }
-  return global_registry_;
-}
 
 void FlagRegistry::RegisterFlag(CommandLineFlag* flag) {
   Lock();
@@ -807,22 +774,22 @@ CommandLineFlag* FlagRegistry::SplitArgumentLocked(const char* arg,
     // In that case, we want to return flag 'x'.
     if (!(flag_name[0] == 'n' && flag_name[1] == 'o')) {
       // flag-name is not 'nox', so we're not in the exception case.
-      *error_message = (string(kError) +
-                        "unknown command line flag '" + *key + "'\n");
+      *error_message = StringPrintf("%sunknown command line flag '%s'\n",
+                                    kError, key->c_str());
       return NULL;
     }
     flag = FindFlagLocked(flag_name+2);
     if (flag == NULL) {
       // No flag named 'x' exists, so we're not in the exception case.
-      *error_message = (string(kError) +
-                        "unknown command line flag '" + *key + "'\n");
+      *error_message = StringPrintf("%sunknown command line flag '%s'\n",
+                                    kError, key->c_str());
       return NULL;
     }
     if (strcmp(flag->type_name(), "bool") != 0) {
       // 'x' exists but is not boolean, so we're not in the exception case.
-      *error_message = (string(kError) +
-                        "boolean value (" + *key + ") specified for " +
-                        flag->type_name() + " command line flag\n");
+      *error_message = StringPrintf(
+          "%sboolean value (%s) specified for %s command line flag\n",
+          kError, key->c_str(), flag->type_name());
       return NULL;
     }
     // We're in the exception case!
@@ -845,25 +812,27 @@ bool TryParseLocked(const CommandLineFlag* flag, FlagValue* flag_value,
   FlagValue* tentative_value = flag_value->New();
   if (!tentative_value->ParseFrom(value)) {
     if (msg) {
-      *msg += (string(kError) + "illegal value '" + value +
-               + "' specified for " + flag->type_name() + " flag '"
-               + flag->name() + "'\n");
+      StringAppendF(msg,
+                    "%sillegal value '%s' specified for %s flag '%s'\n",
+                    kError, value,
+                    flag->type_name(), flag->name());
     }
     delete tentative_value;
     return false;
   } else if (!flag->Validate(*tentative_value)) {
     if (msg) {
-      *msg += (string(kError) + "failed validation of new value "
-               + "'" + tentative_value->ToString() + "' for flag '" +
-               + flag->name() + "'\n");
+      StringAppendF(msg,
+          "%sfailed validation of new value '%s' for flag '%s'\n",
+          kError, tentative_value->ToString().c_str(),
+          flag->name());
     }
     delete tentative_value;
     return false;
   } else {
     flag_value->CopyFrom(*tentative_value);
     if (msg) {
-      *msg += (string(flag->name()) + " set to " + flag_value->ToString()
-               + "\n");
+      StringAppendF(msg, "%s set to %s\n",
+                    flag->name(), flag_value->ToString().c_str());
     }
     delete tentative_value;
     return true;
@@ -890,7 +859,8 @@ bool FlagRegistry::SetFlagLocked(CommandLineFlag* flag,
           return false;
         flag->modified_ = true;
       } else {
-        *msg = string(flag->name()) + " set to " + flag->current_value();
+        *msg = StringPrintf("%s set to %s",
+                            flag->name(), flag->current_value().c_str());
       }
       break;
     }
@@ -914,13 +884,17 @@ bool FlagRegistry::SetFlagLocked(CommandLineFlag* flag,
   return true;
 }
 
-class FlagRegistryLock {
- public:
-  explicit FlagRegistryLock(FlagRegistry* fr) : fr_(fr) { fr_->Lock(); }
-  ~FlagRegistryLock() { fr_->Unlock(); }
- private:
-  FlagRegistry *const fr_;
-};
+// Get the singleton FlagRegistry object
+FlagRegistry* FlagRegistry::global_registry_ = NULL;
+Mutex FlagRegistry::global_registry_lock_(Mutex::LINKER_INITIALIZED);
+
+FlagRegistry* FlagRegistry::GlobalRegistry() {
+  MutexLock acquire_lock(&global_registry_lock_);
+  if (!global_registry_) {
+    global_registry_ = new FlagRegistry;
+  }
+  return global_registry_;
+}
 
 // --------------------------------------------------------------------
 // CommandLineFlagParser
@@ -1002,12 +976,12 @@ class CommandLineFlagParser {
 static void ParseFlagList(const char* value, vector<string>* flags) {
   for (const char *p = value; p && *p; value = p) {
     p = strchr(value, ',');
-    int len;
+    size_t len;
     if (p) {
-      len = static_cast<int>(p - value);
+      len = p - value;
       p++;
     } else {
-      len = static_cast<int>(strlen(value));
+      len = strlen(value);
     }
 
     if (len == 0)
@@ -1023,7 +997,7 @@ static void ParseFlagList(const char* value, vector<string>* flags) {
 // can do all the I/O in one place and not worry about it everywhere.
 // Plus, it's convenient to have the whole file contents at hand.
 // Adds a newline at the end of the file.
-#define PFATAL(s)  do { perror(s); commandlineflags_exitfunc(1); } while (0)
+#define PFATAL(s)  do { perror(s); gflags_exitfunc(1); } while (0)
 
 static string ReadFileIntoString(const char* filename) {
   const int kBufSize = 8092;
@@ -1112,9 +1086,9 @@ uint32 CommandLineFlagParser::ParseNewCommandLineFlags(int* argc, char*** argv,
             && strcmp(flag->type_name(), "string") == 0
             && (strstr(flag->help(), "true")
                 || strstr(flag->help(), "false"))) {
-          fprintf(stderr, "Did you really mean to set flag '%s'"
-                  " to the value '%s'?\n",
-                  flag->name(), value);
+          LOG(WARNING) << "Did you really mean to set flag '"
+                       << flag->name() << "' to the value '"
+                       << value << "'?";
         }
       }
     }
@@ -1165,9 +1139,10 @@ string CommandLineFlagParser::ProcessFromenvLocked(const string& flagval,
     const char* flagname = flaglist[i].c_str();
     CommandLineFlag* flag = registry_->FindFlagLocked(flagname);
     if (flag == NULL) {
-      error_flags_[flagname] = (string(kError) + "unknown command line flag"
-                                + " '" + flagname + "'"
-                                + " (via --fromenv or --tryfromenv)\n");
+      error_flags_[flagname] =
+          StringPrintf("%sunknown command line flag '%s' "
+                       "(via --fromenv or --tryfromenv)\n",
+                       kError, flagname);
       undefined_names_[flagname] = "";
       continue;
     }
@@ -1185,8 +1160,9 @@ string CommandLineFlagParser::ProcessFromenvLocked(const string& flagval,
     // Avoid infinite recursion.
     if ((strcmp(envval, "fromenv") == 0) ||
         (strcmp(envval, "tryfromenv") == 0)) {
-      error_flags_[flagname] = (string(kError) + "infinite recursion on " +
-                                "environment flag '" + envval + "'\n");
+      error_flags_[flagname] =
+          StringPrintf("%sinfinite recursion on environment flag '%s'\n",
+                       kError, envval);
       continue;
     }
 
@@ -1289,7 +1265,7 @@ string CommandLineFlagParser::ProcessOptionsFromStringLocked(
     while (*flagfile_contents && isspace(*flagfile_contents))
       ++flagfile_contents;
     line_end = strchr(flagfile_contents, '\n');
-    size_t len = line_end ? static_cast<size_t>(line_end - flagfile_contents)
+    size_t len = line_end ? line_end - flagfile_contents
                           : strlen(flagfile_contents);
     string line(flagfile_contents, len);
 
@@ -1340,17 +1316,17 @@ string CommandLineFlagParser::ProcessOptionsFromStringLocked(
           space = word + strlen(word);
         const string glob(word, space - word);
         // We try matching both against the full argv0 and basename(argv0)
+        if (glob == ProgramInvocationName()       // small optimization
+            || glob == ProgramInvocationShortName()
 #ifdef HAVE_FNMATCH_H
-        if (fnmatch(glob.c_str(),
-                    ProgramInvocationName(),
-                    FNM_PATHNAME) == 0 ||
-            fnmatch(glob.c_str(),
-                    ProgramInvocationShortName(),
-                    FNM_PATHNAME) == 0) {
-#else  // !HAVE_FNMATCH_H
-        if ((glob == ProgramInvocationName()) ||
-            (glob == ProgramInvocationShortName())) {
-#endif  // HAVE_FNMATCH_H
+            || fnmatch(glob.c_str(),
+                       ProgramInvocationName(),
+                       FNM_PATHNAME) == 0
+            || fnmatch(glob.c_str(),
+                       ProgramInvocationShortName(),
+                       FNM_PATHNAME) == 0
+#endif
+            ) {
           flags_are_relevant = true;
         }
       }
@@ -1391,14 +1367,14 @@ bool AddFlagValidator(const void* flag_ptr, ValidateFnProto validate_fn_proto) {
   // This is the CommandLineFlag whose current_->value_buffer_ == flag
   CommandLineFlag* flag = registry->FindFlagViaPtrLocked(flag_ptr);
   if (!flag) {
-    // WARNING << "Ignoring RegisterValidateFunction() for flag pointer "
-    //         << flag_ptr << ": no flag found at that address";
+    LOG(WARNING) << "Ignoring RegisterValidateFunction() for flag pointer "
+                 << flag_ptr << ": no flag found at that address";
     return false;
   } else if (validate_fn_proto == flag->validate_function()) {
     return true;    // ok to register the same function over and over again
   } else if (validate_fn_proto != NULL && flag->validate_function() != NULL) {
-    // WARNING << "Ignoring RegisterValidateFunction() for flag '"
-    //         << flag->name() << "': validate-fn already registered";
+    LOG(WARNING) << "Ignoring RegisterValidateFunction() for flag '"
+                 << flag->name() << "': validate-fn already registered";
     return false;
   } else {
     flag->validate_fn_proto_ = validate_fn_proto;
@@ -1549,6 +1525,24 @@ const char* ProgramUsage() {
 }
 
 // --------------------------------------------------------------------
+// SetVersionString()
+// VersionString()
+// --------------------------------------------------------------------
+
+static const char* version_string = NULL;
+
+void SetVersionString(const string& version) {
+  if (version_string != NULL)
+    ReportError(DIE, "ERROR: SetVersionString() called twice\n");
+  version_string = strdup(version.c_str());   // small memory leak
+}
+
+const char* VersionString() {
+  return version_string ? version_string : "";
+}
+
+
+// --------------------------------------------------------------------
 // GetCommandLineOption()
 // GetCommandLineFlagInfo()
 // GetCommandLineFlagInfoOrDie()
@@ -1601,7 +1595,7 @@ CommandLineFlagInfo GetCommandLineFlagInfoOrDie(const char* name) {
   CommandLineFlagInfo info;
   if (!GetCommandLineFlagInfo(name, &info)) {
     fprintf(stderr, "FATAL ERROR: flag name '%s' doesn't exist\n", name);
-    commandlineflags_exitfunc(1);    // almost certainly exit()
+    gflags_exitfunc(1);    // almost certainly gflags_exitfunc()
   }
   return info;
 }
@@ -1616,10 +1610,7 @@ string SetCommandLineOptionWithMode(const char* name, const char* value,
     CommandLineFlagParser parser(registry);
     result = parser.ProcessSingleOptionLocked(flag, value, set_mode);
     if (!result.empty()) {   // in the error case, we've already logged
-      // You could consider logging this change, if you wanted to know it:
-      //fprintf(stderr, "%sFLAGS_%s\n",
-      //        (set_mode == SET_FLAGS_DEFAULT ? "default value of " : ""),
-      //        result);
+      // Could consider logging this change
     }
   }
   // The API of this function is that we return empty string on error
@@ -1765,7 +1756,7 @@ bool ReadFlagsFromString(const string& flagfilecontents,
   if (parser.ReportErrors()) {
     // Error.  Restore all global flags to their previous values.
     if (errors_are_fatal)
-      commandlineflags_exitfunc(1);    // almost certainly exit()
+      gflags_exitfunc(1);
     saved_states.RestoreToRegistry();
     return false;
   }
@@ -1917,7 +1908,7 @@ static uint32 ParseCommandLineFlagsInternal(int* argc, char*** argv,
   parser.ValidateAllFlags();
 
   if (parser.ReportErrors())        // may cause us to exit on illegal flags
-    commandlineflags_exitfunc(1);   // almost certainly exit()
+    gflags_exitfunc(1);
   return r;
 }
 
@@ -1947,7 +1938,7 @@ void AllowCommandLineReparsing() {
   allow_command_line_reparsing = true;
 }
 
-uint32 ReparseCommandLineNonHelpFlags() {
+void ReparseCommandLineNonHelpFlags() {
   // We make a copy of argc and argv to pass in
   const vector<string>& argvs = GetArgvs();
   int tmp_argc = static_cast<int>(argvs.size());
@@ -1955,13 +1946,11 @@ uint32 ReparseCommandLineNonHelpFlags() {
   for (int i = 0; i < tmp_argc; ++i)
     tmp_argv[i] = strdup(argvs[i].c_str());   // TODO(csilvers): don't dup
 
-  const int retval = ParseCommandLineNonHelpFlags(&tmp_argc, &tmp_argv, false);
+  ParseCommandLineNonHelpFlags(&tmp_argc, &tmp_argv, false);
 
   for (int i = 0; i < tmp_argc; ++i)
     free(tmp_argv[i]);
   delete[] tmp_argv;
-
-  return retval;
 }
 
 void ShutDownCommandLineFlags() {
diff --git a/extern/libmv/third_party/gflags/gflags.h b/extern/libmv/third_party/gflags/gflags.h
deleted file mode 100644
index cefbd62..0000000
--- a/extern/libmv/third_party/gflags/gflags.h
+++ /dev/null
@@ -1,589 +0,0 @@
-// Copyright (c) 2006, 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.
-
-// ---
-// Author: Ray Sidney
-// Revamped and reorganized by Craig Silverstein
-//
-// This is the file that should be included by any file which declares
-// or defines a command line flag or wants to parse command line flags
-// or print a program usage message (which will include information about
-// flags).  Executive summary, in the form of an example foo.cc file:
-//
-//    #include "foo.h"         // foo.h has a line "DECLARE_int32(start);"
-//    #include "validators.h"  // hypothetical file defining ValidateIsFile()
-//
-//    DEFINE_int32(end, 1000, "The last record to read");
-//
-//    DEFINE_string(filename, "my_file.txt", "The file to read");
-//    // Crash if the specified file does not exist.
-//    static bool dummy = RegisterFlagValidator(&FLAGS_filename,
-//                                              &ValidateIsFile);
-//
-//    DECLARE_bool(verbose); // some other file has a DEFINE_bool(verbose, ...)
-//
-//    void MyFunc() {
-//      if (FLAGS_verbose) printf("Records %d-%d\n", FLAGS_start, FLAGS_end);
-//    }
-//
-// Then, at the command-line:
-//    ./foo --noverbose --start=5 --end=100
-//
-// For more details, see
-//    doc/gflags.html
-//
-// --- A note about thread-safety:
-//
-// We describe many functions in this routine as being thread-hostile,
-// thread-compatible, or thread-safe.  Here are the meanings we use:
-//
-// thread-safe: it is safe for multiple threads to call this routine
-//   (or, when referring to a class, methods of this class)
-//   concurrently.
-// thread-hostile: it is not safe for multiple threads to call this
-//   routine (or methods of this class) concurrently.  In gflags,
-//   most thread-hostile routines are intended to be called early in,
-//   or even before, main() -- that is, before threads are spawned.
-// thread-compatible: it is safe for multiple threads to read from
-//   this variable (when applied to variables), or to call const
-//   methods of this class (when applied to classes), as long as no
-//   other thread is writing to the variable or calling non-const
-//   methods of this class.
-
-#ifndef GOOGLE_GFLAGS_H_
-#define GOOGLE_GFLAGS_H_
-
-#include <string>
-#include <vector>
-
-// We care a lot about number of bits things take up.  Unfortunately,
-// systems define their bit-specific ints in a lot of different ways.
-// We use our own way, and have a typedef to get there.
-// Note: these commands below may look like "#if 1" or "#if 0", but
-// that's because they were constructed that way at ./configure time.
-// Look at gflags.h.in to see how they're calculated (based on your config).
-#if 1
-#include <stdint.h>             // the normal place uint16_t is defined
-#endif
-#if 1
-#include <sys/types.h>          // the normal place u_int16_t is defined
-#endif
-#if 1
-#include <inttypes.h>           // a third place for uint16_t or u_int16_t
-#endif
-
-namespace google {
-
-#if 1      // the C99 format
-typedef int32_t int32;
-typedef uint32_t uint32;
-typedef int64_t int64;
-typedef uint64_t uint64;
-#elif 1   // the BSD format
-typedef int32_t int32;
-typedef u_int32_t uint32;
-typedef int64_t int64;
-typedef u_int64_t uint64;
-#elif 0     // the windows (vc7) format
-typedef __int32 int32;
-typedef unsigned __int32 uint32;
-typedef __int64 int64;
-typedef unsigned __int64 uint64;
-#else
-#error Do not know how to define a 32-bit integer quantity on your system
-#endif
-
-// --------------------------------------------------------------------
-// To actually define a flag in a file, use DEFINE_bool,
-// DEFINE_string, etc. at the bottom of this file.  You may also find
-// it useful to register a validator with the flag.  This ensures that
-// when the flag is parsed from the commandline, or is later set via
-// SetCommandLineOption, we call the validation function. It is _not_
-// called when you assign the value to the flag directly using the = operator.
-//
-// The validation function should return true if the flag value is valid, and
-// false otherwise. If the function returns false for the new setting of the
-// flag, the flag will retain its current value. If it returns false for the
-// default value, ParseCommandLineFlags() will die.
-//
-// This function is safe to call at global construct time (as in the
-// example below).
-//
-// Example use:
-//    static bool ValidatePort(const char* flagname, int32 value) {
-//       if (value > 0 && value < 32768)   // value is ok
-//         return true;
-//       printf("Invalid value for --%s: %d\n", flagname, (int)value);
-//       return false;
-//    }
-//    DEFINE_int32(port, 0, "What port to listen on");
-//    static bool dummy = RegisterFlagValidator(&FLAGS_port, &ValidatePort);
-
-// Returns true if successfully registered, false if not (because the
-// first argument doesn't point to a command-line flag, or because a
-// validator is already registered for this flag).
-bool RegisterFlagValidator(const bool* flag,
-                           bool (*validate_fn)(const char*, bool));
-bool RegisterFlagValidator(const int32* flag,
-                           bool (*validate_fn)(const char*, int32));
-bool RegisterFlagValidator(const int64* flag,
-                           bool (*validate_fn)(const char*, int64));
-bool RegisterFlagValidator(const uint64* flag,
-                           bool (*validate_fn)(const char*, uint64));
-bool RegisterFlagValidator(const double* flag,
-                           bool (*validate_fn)(const char*, double));
-bool RegisterFlagValidator(const std::string* flag,
-                           bool (*validate_fn)(const char*, const std::string&));
-
-
-// --------------------------------------------------------------------
-// These methods are the best way to get access to info about the
-// list of commandline flags.  Note that these routines are pretty slow.
-//   GetAllFlags: mostly-complete info about the list, sorted by file.
-//   ShowUsageWithFlags: pretty-prints the list to stdout (what --help does)
-//   ShowUsageWithFlagsRestrict: limit to filenames with restrict as a substr
-//
-// In addition to accessing flags, you can also access argv[0] (the program
-// name) and argv (the entire commandline), which we sock away a copy of.
-// These variables are static, so you should only set them once.
-
-struct CommandLineFlagInfo {
-  std::string name;           // the name of the flag
-  std::string type;           // the type of the flag: int32, etc
-  std::string description;    // the "help text" associated with the flag
-  std::string current_value;  // the current value, as a string
-  std::string default_value;  // the default value, as a string
-  std::string filename;       // 'cleaned' version of filename holding the flag
-  bool has_validator_fn;      // true if RegisterFlagValidator called on flag
-  bool is_default;            // true if the flag has the default value and
-                              // has not been set explicitly from the cmdline
-                              // or via SetCommandLineOption
-};
-
-// Using this inside of a validator is a recipe for a deadlock.
-// TODO(wojtekm) Fix locking when validators are running, to make it safe to
-// call validators during ParseAllFlags.
-// Also make sure then to uncomment the corresponding unit test in
-// commandlineflags_unittest.sh
-extern void GetAllFlags(std::vector<CommandLineFlagInfo>* OUTPUT);
-// These two are actually defined in commandlineflags_reporting.cc.
-extern void ShowUsageWithFlags(const char *argv0);  // what --help does
-extern void ShowUsageWithFlagsRestrict(const char *argv0, const char *restrict);
-
-// Create a descriptive string for a flag.
-// Goes to some trouble to make pretty line breaks.
-extern std::string DescribeOneFlag(const CommandLineFlagInfo& flag);
-
-// Thread-hostile; meant to be called before any threads are spawned.
-extern void SetArgv(int argc, const char** argv);
-// The following functions are thread-safe as long as SetArgv() is
-// only called before any threads start.
-extern const std::vector<std::string>& GetArgvs();  // all of argv as a vector
-extern const char* GetArgv();                // all of argv as a string
-extern const char* GetArgv0();               // only argv0
-extern uint32 GetArgvSum();                  // simple checksum of argv
-extern const char* ProgramInvocationName();  // argv0, or "UNKNOWN" if not set
-extern const char* ProgramInvocationShortName();   // basename(argv0)
-// ProgramUsage() is thread-safe as long as SetUsageMessage() is only
-// called before any threads start.
-extern const char* ProgramUsage();           // string set by SetUsageMessage()
-
-
-// --------------------------------------------------------------------
-// Normally you access commandline flags by just saying "if (FLAGS_foo)"
-// or whatever, and set them by calling "FLAGS_foo = bar" (or, more
-// commonly, via the DEFINE_foo macro).  But if you need a bit more
-// control, we have programmatic ways to get/set the flags as well.
-// These programmatic ways to access flags are thread-safe, but direct
-// access is only thread-compatible.
-
-// Return true iff the flagname was found.
-// OUTPUT is set to the flag's value, or unchanged if we return false.
-extern bool GetCommandLineOption(const char* name, std::string* OUTPUT);
-
-// Return true iff the flagname was found. OUTPUT is set to the flag's
-// CommandLineFlagInfo or unchanged if we return false.
-extern bool GetCommandLineFlagInfo(const char* name,
-                                   CommandLineFlagInfo* OUTPUT);
-
-// Return the CommandLineFlagInfo of the flagname.  exit() if name not found.
-// Example usage, to check if a flag's value is currently the default value:
-//   if (GetCommandLineFlagInfoOrDie("foo").is_default) ...
-extern CommandLineFlagInfo GetCommandLineFlagInfoOrDie(const char* name);
-
-enum FlagSettingMode {
-  // update the flag's value (can call this multiple times).
-  SET_FLAGS_VALUE,
-  // update the flag's value, but *only if* it has not yet been updated
-  // with SET_FLAGS_VALUE, SET_FLAG_IF_DEFAULT, or "FLAGS_xxx = nondef".
-  SET_FLAG_IF_DEFAULT,
-  // set the flag's default value to this.  If the flag has not yet updated
-  // yet (via SET_FLAGS_VALUE, SET_FLAG_IF_DEFAULT, or "FLAGS_xxx = nondef")
-  // change the flag's current value to the new default value as well.
-  SET_FLAGS_DEFAULT
-};
-
-// Set a particular flag ("command line option").  Returns a string
-// describing the new value that the option has been set to.  The
-// return value API is not well-specified, so basically just depend on
-// it to be empty if the setting failed for some reason -- the name is
-// not a valid flag name, or the value is not a valid value -- and
-// non-empty else.
-
-// SetCommandLineOption uses set_mode == SET_FLAGS_VALUE (the common case)
-extern std::string SetCommandLineOption(const char* name, const char* value);
-extern std::string SetCommandLineOptionWithMode(const char* name, const char* value,
-                                                FlagSettingMode set_mode);
-
-
-// --------------------------------------------------------------------
-// Saves the states (value, default value, whether the user has set
-// the flag, registered validators, etc) of all flags, and restores
-// them when the FlagSaver is destroyed.  This is very useful in
-// tests, say, when you want to let your tests change the flags, but
-// make sure that they get reverted to the original states when your
-// test is complete.
-//
-// Example usage:
-//   void TestFoo() {
-//     FlagSaver s1;
-//     FLAG_foo = false;
-//     FLAG_bar = "some value";
-//
-//     // test happens here.  You can return at any time
-//     // without worrying about restoring the FLAG values.
-//   }
-//
-// Note: This class is marked with __attribute__((unused)) because all the
-// work is done in the constructor and destructor, so in the standard
-// usage example above, the compiler would complain that it's an
-// unused variable.
-//
-// This class is thread-safe.
-
-class FlagSaver {
- public:
-  FlagSaver();
-  ~FlagSaver();
-
- private:
-  class FlagSaverImpl* impl_;   // we use pimpl here to keep API steady
-
-  FlagSaver(const FlagSaver&);  // no copying!
-  void operator=(const FlagSaver&);
-}
-#ifndef _MSC_VER
-__attribute__ ((unused))
-#endif
-;
-
-// --------------------------------------------------------------------
-// Some deprecated or hopefully-soon-to-be-deprecated functions.
-
-// This is often used for logging.  TODO(csilvers): figure out a better way
-extern std::string CommandlineFlagsIntoString();
-// Usually where this is used, a FlagSaver should be used instead.
-extern bool ReadFlagsFromString(const std::string& flagfilecontents,
-                                const char* prog_name,
-                                bool errors_are_fatal); // uses SET_FLAGS_VALUE
-
-// These let you manually implement --flagfile functionality.
-// DEPRECATED.
-extern bool AppendFlagsIntoFile(const std::string& filename, const char* prog_name);
-extern bool SaveCommandFlags();  // actually defined in google.cc !
-extern bool ReadFromFlagsFile(const std::string& filename, const char* prog_name,
-                              bool errors_are_fatal);   // uses SET_FLAGS_VALUE
-
-
-// --------------------------------------------------------------------
-// Useful routines for initializing flags from the environment.
-// In each case, if 'varname' does not exist in the environment
-// return defval.  If 'varname' does exist but is not valid
-// (e.g., not a number for an int32 flag), abort with an error.
-// Otherwise, return the value.  NOTE: for booleans, for true use
-// 't' or 'T' or 'true' or '1', for false 'f' or 'F' or 'false' or '0'.
-
-extern bool BoolFromEnv(const char *varname, bool defval);
-extern int32 Int32FromEnv(const char *varname, int32 defval);
-extern int64 Int64FromEnv(const char *varname, int64 defval);
-extern uint64 Uint64FromEnv(const char *varname, uint64 defval);
-extern double DoubleFromEnv(const char *varname, double defval);
-extern const char *StringFromEnv(const char *varname, const char *defval);
-
-
-// --------------------------------------------------------------------
-// The next two functions parse commandlineflags from main():
-
-// Set the "usage" message for this program.  For example:
-//   string usage("This program does nothing.  Sample usage:\n");
-//   usage += argv[0] + " <uselessarg1> <uselessarg2>";
-//   SetUsageMessage(usage);
-// Do not include commandline flags in the usage: we do that for you!
-// Thread-hostile; meant to be called before any threads are spawned.
-extern void SetUsageMessage(const std::string& usage);
-
-// Looks for flags in argv and parses them.  Rearranges argv to put
-// flags first, or removes them entirely if remove_flags is true.
-// If a flag is defined more than once in the command line or flag
-// file, the last definition is used.  Returns the index (into argv)
-// of the first non-flag argument.
-// See top-of-file for more details on this function.
-#ifndef SWIG   // In swig, use ParseCommandLineFlagsScript() instead.
-extern uint32 ParseCommandLineFlags(int *argc, char*** argv,
-                                    bool remove_flags);
-#endif
-
-
-// Calls to ParseCommandLineNonHelpFlags and then to
-// HandleCommandLineHelpFlags can be used instead of a call to
-// ParseCommandLineFlags during initialization, in order to allow for
-// changing default values for some FLAGS (via
-// e.g. SetCommandLineOptionWithMode calls) between the time of
-// command line parsing and the time of dumping help information for
-// the flags as a result of command line parsing.  If a flag is
-// defined more than once in the command line or flag file, the last
-// definition is used.  Returns the index (into argv) of the first
-// non-flag argument.  (If remove_flags is true, will always return 1.)
-extern uint32 ParseCommandLineNonHelpFlags(int *argc, char*** argv,
-                                           bool remove_flags);
-// This is actually defined in commandlineflags_reporting.cc.
-// This function is misnamed (it also handles --version, etc.), but
-// it's too late to change that now. :-(
-extern void HandleCommandLineHelpFlags();   // in commandlineflags_reporting.cc
-
-// Allow command line reparsing.  Disables the error normally
-// generated when an unknown flag is found, since it may be found in a
-// later parse.  Thread-hostile; meant to be called before any threads
-// are spawned.
-extern void AllowCommandLineReparsing();
-
-// Reparse the flags that have not yet been recognized.  Only flags
-// registered since the last parse will be recognized.  Any flag value
-// must be provided as part of the argument using "=", not as a
-// separate command line argument that follows the flag argument.
-// Intended for handling flags from dynamically loaded libraries,
-// since their flags are not registered until they are loaded.
-// Returns the index (into the original argv) of the first non-flag
-// argument.  (If remove_flags is true, will always return 1.)
-extern uint32 ReparseCommandLineNonHelpFlags();
-
-// Clean up memory allocated by flags.  This is only needed to reduce
-// the quantity of "potentially leaked" reports emitted by memory
-// debugging tools such as valgrind.  It is not required for normal
-// operation, or for the perftools heap-checker.  It must only be called
-// when the process is about to exit, and all threads that might
-// access flags are quiescent.  Referencing flags after this is called
-// will have unexpected consequences.  This is not safe to run when
-// multiple threads might be running: the function is thread-hostile.
-extern void ShutDownCommandLineFlags();
-
-
-// --------------------------------------------------------------------
-// Now come the command line flag declaration/definition macros that
-// will actually be used.  They're kind of hairy.  A major reason
-// for this is initialization: we want people to be able to access
-// variables in global constructors and have that not crash, even if
-// their global constructor runs before the global constructor here.
-// (Obviously, we can't guarantee the flags will have the correct
-// default value in that case, but at least accessing them is safe.)
-// The only way to do that is have flags point to a static buffer.
-// So we make one, using a union to ensure proper alignment, and
-// then use placement-new to actually set up the flag with the
-// correct default value.  In the same vein, we have to worry about
-// flag access in global destructors, so FlagRegisterer has to be
-// careful never to destroy the flag-values it constructs.
-//
-// Note that when we define a flag variable FLAGS_<name>, we also
-// preemptively define a junk variable, FLAGS_no<name>.  This is to
-// cause a link-time error if someone tries to define 2 flags with
-// names like "logging" and "nologging".  We do this because a bool
-// flag FLAG can be set from the command line to true with a "-FLAG"
-// argument, and to false with a "-noFLAG" argument, and so this can
-// potentially avert confusion.
-//
-// We also put flags into their own namespace.  It is purposefully
-// named in an opaque way that people should have trouble typing
-// directly.  The idea is that DEFINE puts the flag in the weird
-// namespace, and DECLARE imports the flag from there into the current
-// namespace.  The net result is to force people to use DECLARE to get
-// access to a flag, rather than saying "extern bool FLAGS_whatever;"
-// or some such instead.  We want this so we can put extra
-// functionality (like sanity-checking) in DECLARE if we want, and
-// make sure it is picked up everywhere.
-//
-// We also put the type of the variable in the namespace, so that
-// people can't DECLARE_int32 something that they DEFINE_bool'd
-// elsewhere.
-
-class FlagRegisterer {
- public:
-  FlagRegisterer(const char* name, const char* type,
-                 const char* help, const char* filename,
-                 void* current_storage, void* defvalue_storage);
-};
-
-extern bool FlagsTypeWarn(const char *name);
-
-// If your application #defines STRIP_FLAG_HELP to a non-zero value
-// before #including this file, we remove the help message from the
-// binary file. This can reduce the size of the resulting binary
-// somewhat, and may also be useful for security reasons.
-
-extern const char kStrippedFlagHelp[];
-
-}
-
-#ifndef SWIG  // In swig, ignore the main flag declarations
-
-#if defined(STRIP_FLAG_HELP) && STRIP_FLAG_HELP > 0
-// Need this construct to avoid the 'defined but not used' warning.
-#define MAYBE_STRIPPED_HELP(txt) (false ? (txt) : ::google::kStrippedFlagHelp)
-#else
-#define MAYBE_STRIPPED_HELP(txt) txt
-#endif
-
-// Each command-line flag has two variables associated with it: one
-// with the current value, and one with the default value.  However,
-// we have a third variable, which is where value is assigned; it's a
-// constant.  This guarantees that FLAG_##value is initialized at
-// static initialization time (e.g. before program-start) rather than
-// than global construction time (which is after program-start but
-// before main), at least when 'value' is a compile-time constant.  We
-// use a small trick for the "default value" variable, and call it
-// FLAGS_no<name>.  This serves the second purpose of assuring a
-// compile error if someone tries to define a flag named no<name>
-// which is illegal (--foo and --nofoo both affect the "foo" flag).
-#define DEFINE_VARIABLE(type, shorttype, name, value, help) \
-  namespace fL##shorttype {                                     \
-    static const type FLAGS_nono##name = value;                 \
-    type FLAGS_##name = FLAGS_nono##name;                       \
-    type FLAGS_no##name = FLAGS_nono##name;                     \
-    static ::google::FlagRegisterer o_##name(      \
-      #name, #type, MAYBE_STRIPPED_HELP(help), __FILE__,        \
-      &FLAGS_##name, &FLAGS_no##name);                          \
-  }                                                             \
-  using fL##shorttype::FLAGS_##name
-
-#define DECLARE_VARIABLE(type, shorttype, name) \
-  namespace fL##shorttype {                     \
-    extern type FLAGS_##name;                   \
-  }                                             \
-  using fL##shorttype::FLAGS_##name
-
-// For DEFINE_bool, we want to do the extra check that the passed-in
-// value is actually a bool, and not a string or something that can be
-// coerced to a bool.  These declarations (no definition needed!) will
-// help us do that, and never evaluate From, which is important.
-// We'll use 'sizeof(IsBool(val))' to distinguish. This code requires
-// that the compiler have different sizes for bool & double. Since
-// this is not guaranteed by the standard, we check it with a
-// compile-time assert (msg[-1] will give a compile-time error).
-namespace fLB {
-struct CompileAssert {};
-typedef CompileAssert expected_sizeof_double_neq_sizeof_bool[
-                      (sizeof(double) != sizeof(bool)) ? 1 : -1];
-template<typename From> double IsBoolFlag(const From& from);
-bool IsBoolFlag(bool from);
-}  // namespace fLB
-
-#define DECLARE_bool(name)          DECLARE_VARIABLE(bool, B, name)
-#define DEFINE_bool(name, val, txt)                                       \
-  namespace fLB {                                                         \
-    typedef ::fLB::CompileAssert FLAG_##name##_value_is_not_a_bool[       \
-            (sizeof(::fLB::IsBoolFlag(val)) != sizeof(double)) ? 1 : -1]; \
-  }                                                                       \
-  DEFINE_VARIABLE(bool, B, name, val, txt)
-
-#define DECLARE_int32(name)         DECLARE_VARIABLE(::google::int32, I, name)
-#define DEFINE_int32(name,val,txt)  DEFINE_VARIABLE(::google::int32, I, name, val, txt)
-
-#define DECLARE_int64(name)         DECLARE_VARIABLE(::google::int64, I64, name)
-#define DEFINE_int64(name,val,txt)  DEFINE_VARIABLE(::google::int64, I64, name, val, txt)
-
-#define DECLARE_uint64(name)        DECLARE_VARIABLE(::google::uint64, U64, name)
-#define DEFINE_uint64(name,val,txt) DEFINE_VARIABLE(::google::uint64, U64, name, val, txt)
-
-#define DECLARE_double(name)          DECLARE_VARIABLE(double, D, name)
-#define DEFINE_double(name, val, txt) DEFINE_VARIABLE(double, D, name, val, txt)
-
-// Strings are trickier, because they're not a POD, so we can't
-// construct them at static-initialization time (instead they get
-// constructed at global-constructor time, which is much later).  To
-// try to avoid crashes in that case, we use a char buffer to store
-// the string, which we can static-initialize, and then placement-new
-// into it later.  It's not perfect, but the best we can do.
-
-namespace fLS {
-// The meaning of "string" might be different between now and when the
-// macros below get invoked (e.g., if someone is experimenting with
-// other string implementations that get defined after this file is
-// included).  Save the current meaning now and use it in the macros.
-typedef std::string clstring;
-
-inline clstring* dont_pass0toDEFINE_string(char *stringspot,
-                                           const char *value) {
-  return new(stringspot) clstring(value);
-}
-inline clstring* dont_pass0toDEFINE_string(char *stringspot,
-                                           const clstring &value) {
-  return new(stringspot) clstring(value);
-}
-inline clstring* dont_pass0toDEFINE_string(char *stringspot,
-                                           int value);
-}  // namespace fLS
-
-#define DECLARE_string(name)  namespace fLS { extern ::fLS::clstring& FLAGS_##name; } \
-                              using fLS::FLAGS_##name
-
-// We need to define a var named FLAGS_no##name so people don't define
-// --string and --nostring.  And we need a temporary place to put val
-// so we don't have to evaluate it twice.  Two great needs that go
-// great together!
-// The weird 'using' + 'extern' inside the fLS namespace is to work around
-// an unknown compiler bug/issue with the gcc 4.2.1 on SUSE 10.  See
-//    http://code.google.com/p/google-gflags/issues/detail?id=20
-#define DEFINE_string(name, val, txt)                                       \
-  namespace fLS {                                                           \
-    using ::fLS::clstring;                                                  \
-    static union { void* align; char s[sizeof(clstring)]; } s_##name[2];    \
-    clstring* const FLAGS_no##name = ::fLS::                                \
-                                   dont_pass0toDEFINE_string(s_##name[0].s, \
-                                                             val);          \
-    static ::google::FlagRegisterer o_##name(                  \
-        #name, "string", MAYBE_STRIPPED_HELP(txt), __FILE__,                \
-        s_##name[0].s, new (s_##name[1].s) clstring(*FLAGS_no##name));      \
-    extern clstring& FLAGS_##name;                                          \
-    using fLS::FLAGS_##name;                                                \
-    clstring& FLAGS_##name = *FLAGS_no##name;                               \
-  }                                                                         \
-  using fLS::FLAGS_##name
-
-#endif  // SWIG
-
-#endif  // GOOGLE_GFLAGS_H_
diff --git a/extern/libmv/third_party/gflags/gflags/gflags.h b/extern/libmv/third_party/gflags/gflags/gflags.h
new file mode 100644
index 0000000..e69812c
--- /dev/null
+++ b/extern/libmv/third_party/gflags/gflags/gflags.h
@@ -0,0 +1,568 @@
+// Copyright (c) 2006, 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.
+
+// ---
+// Revamped and reorganized by Craig Silverstein
+//
+// This is the file that should be included by any file which declares
+// or defines a command line flag or wants to parse command line flags
+// or print a program usage message (which will include information about
+// flags).  Executive summary, in the form of an example foo.cc file:
+//
+//    #include "foo.h"         // foo.h has a line "DECLARE_int32(start);"
+//    #include "validators.h"  // hypothetical file defining ValidateIsFile()
+//
+//    DEFINE_int32(end, 1000, "The last record to read");
+//
+//    DEFINE_string(filename, "my_file.txt", "The file to read");
+//    // Crash if the specified file does not exist.
+//    static bool dummy = RegisterFlagValidator(&FLAGS_filename,
+//                                              &ValidateIsFile);
+//
+//    DECLARE_bool(verbose); // some other file has a DEFINE_bool(verbose, ...)
+//
+//    void MyFunc() {
+//      if (FLAGS_verbose) printf("Records %d-%d\n", FLAGS_start, FLAGS_end);
+//    }
+//
+//    Then, at the command-line:
+//       ./foo --noverbose --start=5 --end=100
+//
+// For more details, see
+//    doc/gflags.html
+//
+// --- A note about thread-safety:
+//
+// We describe many functions in this routine as being thread-hostile,
+// thread-compatible, or thread-safe.  Here are the meanings we use:
+//
+// thread-safe: it is safe for multiple threads to call this routine
+//   (or, when referring to a class, methods of this class)
+//   concurrently.
+// thread-hostile: it is not safe for multiple threads to call this
+//   routine (or methods of this class) concurrently.  In gflags,
+//   most thread-hostile routines are intended to be called early in,
+//   or even before, main() -- that is, before threads are spawned.
+// thread-compatible: it is safe for multiple threads to read from
+//   this variable (when applied to variables), or to call const
+//   methods of this class (when applied to classes), as long as no
+//   other thread is writing to the variable or calling non-const
+//   methods of this class.
+
+#ifndef BASE_COMMANDLINEFLAGS_H_
+#define BASE_COMMANDLINEFLAGS_H_
+
+#include <string>
+#include <vector>
+#include "gflags_declare.h"    // IWYU pragma: export
+namespace google {
+
+//
+// NOTE: all functions below MUST have an explicit 'extern' before
+// them.  Our automated opensourcing tools use this as a signal to do
+// appropriate munging for windows, which needs to add GFLAGS_DLL_DECL.
+//
+#define GFLAGS_DLL_DECL  /* rewritten to be non-empty in windows dir */
+#define GFLAGS_DLL_DEFINE_FLAG  /* rewritten to be non-empty in windows dir */
+
+
+// --------------------------------------------------------------------
+// To actually define a flag in a file, use DEFINE_bool,
+// DEFINE_string, etc. at the bottom of this file.  You may also find
+// it useful to register a validator with the flag.  This ensures that
+// when the flag is parsed from the commandline, or is later set via
+// SetCommandLineOption, we call the validation function. It is _not_
+// called when you assign the value to the flag directly using the = operator.
+//
+// The validation function should return true if the flag value is valid, and
+// false otherwise. If the function returns false for the new setting of the
+// flag, the flag will retain its current value. If it returns false for the
+// default value, ParseCommandLineFlags() will die.
+//
+// This function is safe to call at global construct time (as in the
+// example below).
+//
+// Example use:
+//    static bool ValidatePort(const char* flagname, int32 value) {
+//       if (value > 0 && value < 32768)   // value is ok
+//         return true;
+//       printf("Invalid value for --%s: %d\n", flagname, (int)value);
+//       return false;
+//    }
+//    DEFINE_int32(port, 0, "What port to listen on");
+//    static bool dummy = RegisterFlagValidator(&FLAGS_port, &ValidatePort);
+
+// Returns true if successfully registered, false if not (because the
+// first argument doesn't point to a command-line flag, or because a
+// validator is already registered for this flag).
+extern bool RegisterFlagValidator(const bool* flag,
+                                  bool (*validate_fn)(const char*, bool));
+extern bool RegisterFlagValidator(const int32* flag,
+                                  bool (*validate_fn)(const char*, int32));
+extern bool RegisterFlagValidator(const int64* flag,
+                                  bool (*validate_fn)(const char*, int64));
+extern bool RegisterFlagValidator(const uint64* flag,
+                                  bool (*validate_fn)(const char*, uint64));
+extern bool RegisterFlagValidator(const double* flag,
+                                  bool (*validate_fn)(const char*, double));
+extern bool RegisterFlagValidator(const std::string* flag,
+                                  bool (*validate_fn)(const char*,
+                                                      const std::string&));
+
+
+// --------------------------------------------------------------------
+// These methods are the best way to get access to info about the
+// list of commandline flags.  Note that these routines are pretty slow.
+//   GetAllFlags: mostly-complete info about the list, sorted by file.
+//   ShowUsageWithFlags: pretty-prints the list to stdout (what --help does)
+//   ShowUsageWithFlagsRestrict: limit to filenames with restrict as a substr
+//
+// In addition to accessing flags, you can also access argv[0] (the program
+// name) and argv (the entire commandline), which we sock away a copy of.
+// These variables are static, so you should only set them once.
+
+struct GFLAGS_DLL_DECL CommandLineFlagInfo {
+  std::string name;            // the name of the flag
+  std::string type;            // the type of the flag: int32, etc
+  std::string description;     // the "help text" associated with the flag
+  std::string current_value;   // the current value, as a string
+  std::string default_value;   // the default value, as a string
+  std::string filename;        // 'cleaned' version of filename holding the flag
+  bool has_validator_fn;  // true if RegisterFlagValidator called on this flag
+  bool is_default;        // true if the flag has the default value and
+                          // has not been set explicitly from the cmdline
+                          // or via SetCommandLineOption
+  const void* flag_ptr;   // pointer to the flag's current value (i.e. FLAGS_foo)
+};
+
+// Using this inside of a validator is a recipe for a deadlock.
+// TODO(user) Fix locking when validators are running, to make it safe to
+// call validators during ParseAllFlags.
+// Also make sure then to uncomment the corresponding unit test in
+// gflags_unittest.sh
+extern void GetAllFlags(std::vector<CommandLineFlagInfo>* OUTPUT);
+// These two are actually defined in gflags_reporting.cc.
+extern void ShowUsageWithFlags(const char *argv0);  // what --help does
+extern void ShowUsageWithFlagsRestrict(const char *argv0, const char *restrict);
+
+// Create a descriptive string for a flag.
+// Goes to some trouble to make pretty line breaks.
+extern std::string DescribeOneFlag(const CommandLineFlagInfo& flag);
+
+// Thread-hostile; meant to be called before any threads are spawned.
+extern void SetArgv(int argc, const char** argv);
+
+// The following functions are thread-safe as long as SetArgv() is
+// only called before any threads start.
+extern const std::vector<std::string>& GetArgvs();
+extern const char* GetArgv();                 // all of argv as a string
+extern const char* GetArgv0();                // only argv0
+extern uint32 GetArgvSum();                   // simple checksum of argv
+extern const char* ProgramInvocationName();   // argv0, or "UNKNOWN" if not set
+extern const char* ProgramInvocationShortName();   // basename(argv0)
+
+// ProgramUsage() is thread-safe as long as SetUsageMessage() is only
+// called before any threads start.
+extern const char* ProgramUsage();            // string set by SetUsageMessage()
+
+// VersionString() is thread-safe as long as SetVersionString() is only
+// called before any threads start.
+extern const char* VersionString();          // string set by SetVersionString()
+
+
+
+// --------------------------------------------------------------------
+// Normally you access commandline flags by just saying "if (FLAGS_foo)"
+// or whatever, and set them by calling "FLAGS_foo = bar" (or, more
+// commonly, via the DEFINE_foo macro).  But if you need a bit more
+// control, we have programmatic ways to get/set the flags as well.
+// These programmatic ways to access flags are thread-safe, but direct
+// access is only thread-compatible.
+
+// Return true iff the flagname was found.
+// OUTPUT is set to the flag's value, or unchanged if we return false.
+extern bool GetCommandLineOption(const char* name, std::string* OUTPUT);
+
+// Return true iff the flagname was found. OUTPUT is set to the flag's
+// CommandLineFlagInfo or unchanged if we return false.
+extern bool GetCommandLineFlagInfo(const char* name,
+                                   CommandLineFlagInfo* OUTPUT);
+
+// Return the CommandLineFlagInfo of the flagname.  exit() if name not found.
+// Example usage, to check if a flag's value is currently the default value:
+//   if (GetCommandLineFlagInfoOrDie("foo").is_default) ...
+extern CommandLineFlagInfo GetCommandLineFlagInfoOrDie(const char* name);
+
+enum GFLAGS_DLL_DECL FlagSettingMode {
+  // update the flag's value (can call this multiple times).
+  SET_FLAGS_VALUE,
+  // update the flag's value, but *only if* it has not yet been updated
+  // with SET_FLAGS_VALUE, SET_FLAG_IF_DEFAULT, or "FLAGS_xxx = nondef".
+  SET_FLAG_IF_DEFAULT,
+  // set the flag's default value to this.  If the flag has not yet updated
+  // yet (via SET_FLAGS_VALUE, SET_FLAG_IF_DEFAULT, or "FLAGS_xxx = nondef")
+  // change the flag's current value to the new default value as well.
+  SET_FLAGS_DEFAULT
+};
+
+// Set a particular flag ("command line option").  Returns a string
+// describing the new value that the option has been set to.  The
+// return value API is not well-specified, so basically just depend on
+// it to be empty if the setting failed for some reason -- the name is
+// not a valid flag name, or the value is not a valid value -- and
+// non-empty else.
+
+// SetCommandLineOption uses set_mode == SET_FLAGS_VALUE (the common case)
+extern std::string SetCommandLineOption(const char* name, const char* value);
+extern std::string SetCommandLineOptionWithMode(const char* name, const char* value,
+                                           FlagSettingMode set_mode);
+
+
+// --------------------------------------------------------------------
+// Saves the states (value, default value, whether the user has set
+// the flag, registered validators, etc) of all flags, and restores
+// them when the FlagSaver is destroyed.  This is very useful in
+// tests, say, when you want to let your tests change the flags, but
+// make sure that they get reverted to the original states when your
+// test is complete.
+//
+// Example usage:
+//   void TestFoo() {
+//     FlagSaver s1;
+//     FLAG_foo = false;
+//     FLAG_bar = "some value";
+//
+//     // test happens here.  You can return at any time
+//     // without worrying about restoring the FLAG values.
+//   }
+//
+// Note: This class is marked with ATTRIBUTE_UNUSED because all the
+// work is done in the constructor and destructor, so in the standard
+// usage example above, the compiler would complain that it's an
+// unused variable.
+//
+// This class is thread-safe.  However, its destructor writes to
+// exactly the set of flags that have changed value during its
+// lifetime, so concurrent _direct_ access to those flags
+// (i.e. FLAGS_foo instead of {Get,Set}CommandLineOption()) is unsafe.
+
+class GFLAGS_DLL_DECL FlagSaver {
+ public:
+  FlagSaver();
+  ~FlagSaver();
+
+ private:
+  class FlagSaverImpl* impl_;   // we use pimpl here to keep API steady
+
+  FlagSaver(const FlagSaver&);  // no copying!
+  void operator=(const FlagSaver&);
+}
+#ifndef _MSC_VER
+__attribute__ ((unused))
+#endif
+;
+
+// --------------------------------------------------------------------
+// Some deprecated or hopefully-soon-to-be-deprecated functions.
+
+// This is often used for logging.  TODO(csilvers): figure out a better way
+extern std::string CommandlineFlagsIntoString();
+// Usually where this is used, a FlagSaver should be used instead.
+extern bool ReadFlagsFromString(const std::string& flagfilecontents,
+                                const char* prog_name,
+                                bool errors_are_fatal);  // uses SET_FLAGS_VALUE
+
+// These let you manually implement --flagfile functionality.
+// DEPRECATED.
+extern bool AppendFlagsIntoFile(const std::string& filename, const char* prog_name);
+extern bool ReadFromFlagsFile(const std::string& filename, const char* prog_name,
+                              bool errors_are_fatal);   // uses SET_FLAGS_VALUE
+
+
+// --------------------------------------------------------------------
+// Useful routines for initializing flags from the environment.
+// In each case, if 'varname' does not exist in the environment
+// return defval.  If 'varname' does exist but is not valid
+// (e.g., not a number for an int32 flag), abort with an error.
+// Otherwise, return the value.  NOTE: for booleans, for true use
+// 't' or 'T' or 'true' or '1', for false 'f' or 'F' or 'false' or '0'.
+
+extern bool BoolFromEnv(const char *varname, bool defval);
+extern int32 Int32FromEnv(const char *varname, int32 defval);
+extern int64 Int64FromEnv(const char *varname, int64 defval);
+extern uint64 Uint64FromEnv(const char *varname, uint64 defval);
+extern double DoubleFromEnv(const char *varname, double defval);
+extern const char *StringFromEnv(const char *varname, const char *defval);
+
+
+// --------------------------------------------------------------------
+// The next two functions parse gflags from main():
+
+// Set the "usage" message for this program.  For example:
+//   string usage("This program does nothing.  Sample usage:\n");
+//   usage += argv[0] + " <uselessarg1> <uselessarg2>";
+//   SetUsageMessage(usage);
+// Do not include commandline flags in the usage: we do that for you!
+// Thread-hostile; meant to be called before any threads are spawned.
+extern void SetUsageMessage(const std::string& usage);
+
+// Sets the version string, which is emitted with --version.
+// For instance: SetVersionString("1.3");
+// Thread-hostile; meant to be called before any threads are spawned.
+extern void SetVersionString(const std::string& version);
+
+
+// Looks for flags in argv and parses them.  Rearranges argv to put
+// flags first, or removes them entirely if remove_flags is true.
+// If a flag is defined more than once in the command line or flag
+// file, the last definition is used.  Returns the index (into argv)
+// of the first non-flag argument.
+// See top-of-file for more details on this function.
+#ifndef SWIG   // In swig, use ParseCommandLineFlagsScript() instead.
+extern uint32 ParseCommandLineFlags(int *argc, char*** argv, bool remove_flags);
+#endif
+
+
+// Calls to ParseCommandLineNonHelpFlags and then to
+// HandleCommandLineHelpFlags can be used instead of a call to
+// ParseCommandLineFlags during initialization, in order to allow for
+// changing default values for some FLAGS (via
+// e.g. SetCommandLineOptionWithMode calls) between the time of
+// command line parsing and the time of dumping help information for
+// the flags as a result of command line parsing.  If a flag is
+// defined more than once in the command line or flag file, the last
+// definition is used.  Returns the index (into argv) of the first
+// non-flag argument.  (If remove_flags is true, will always return 1.)
+extern uint32 ParseCommandLineNonHelpFlags(int *argc, char*** argv,
+                                           bool remove_flags);
+// This is actually defined in gflags_reporting.cc.
+// This function is misnamed (it also handles --version, etc.), but
+// it's too late to change that now. :-(
+extern void HandleCommandLineHelpFlags();   // in gflags_reporting.cc
+
+// Allow command line reparsing.  Disables the error normally
+// generated when an unknown flag is found, since it may be found in a
+// later parse.  Thread-hostile; meant to be called before any threads
+// are spawned.
+extern void AllowCommandLineReparsing();
+
+// Reparse the flags that have not yet been recognized.  Only flags
+// registered since the last parse will be recognized.  Any flag value
+// must be provided as part of the argument using "=", not as a
+// separate command line argument that follows the flag argument.
+// Intended for handling flags from dynamically loaded libraries,
+// since their flags are not registered until they are loaded.
+extern void ReparseCommandLineNonHelpFlags();
+
+// Clean up memory allocated by flags.  This is only needed to reduce
+// the quantity of "potentially leaked" reports emitted by memory
+// debugging tools such as valgrind.  It is not required for normal
+// operation, or for the google perftools heap-checker.  It must only
+// be called when the process is about to exit, and all threads that
+// might access flags are quiescent.  Referencing flags after this is
+// called will have unexpected consequences.  This is not safe to run
+// when multiple threads might be running: the function is
+// thread-hostile.
+extern void ShutDownCommandLineFlags();
+
+
+// --------------------------------------------------------------------
+// Now come the command line flag declaration/definition macros that
+// will actually be used.  They're kind of hairy.  A major reason
+// for this is initialization: we want people to be able to access
+// variables in global constructors and have that not crash, even if
+// their global constructor runs before the global constructor here.
+// (Obviously, we can't guarantee the flags will have the correct
+// default value in that case, but at least accessing them is safe.)
+// The only way to do that is have flags point to a static buffer.
+// So we make one, using a union to ensure proper alignment, and
+// then use placement-new to actually set up the flag with the
+// correct default value.  In the same vein, we have to worry about
+// flag access in global destructors, so FlagRegisterer has to be
+// careful never to destroy the flag-values it constructs.
+//
+// Note that when we define a flag variable FLAGS_<name>, we also
+// preemptively define a junk variable, FLAGS_no<name>.  This is to
+// cause a link-time error if someone tries to define 2 flags with
+// names like "logging" and "nologging".  We do this because a bool
+// flag FLAG can be set from the command line to true with a "-FLAG"
+// argument, and to false with a "-noFLAG" argument, and so this can
+// potentially avert confusion.
+//
+// We also put flags into their own namespace.  It is purposefully
+// named in an opaque way that people should have trouble typing
+// directly.  The idea is that DEFINE puts the flag in the weird
+// namespace, and DECLARE imports the flag from there into the current
+// namespace.  The net result is to force people to use DECLARE to get
+// access to a flag, rather than saying "extern bool FLAGS_whatever;"
+// or some such instead.  We want this so we can put extra
+// functionality (like sanity-checking) in DECLARE if we want, and
+// make sure it is picked up everywhere.
+//
+// We also put the type of the variable in the namespace, so that
+// people can't DECLARE_int32 something that they DEFINE_bool'd
+// elsewhere.
+
+class GFLAGS_DLL_DECL FlagRegisterer {
+ public:
+  FlagRegisterer(const char* name, const char* type,
+                 const char* help, const char* filename,
+                 void* current_storage, void* defvalue_storage);
+};
+
+// If your application #defines STRIP_FLAG_HELP to a non-zero value
+// before #including this file, we remove the help message from the
+// binary file. This can reduce the size of the resulting binary
+// somewhat, and may also be useful for security reasons.
+
+extern const char kStrippedFlagHelp[];
+
+}
+
+#ifndef SWIG  // In swig, ignore the main flag declarations
+
+#if defined(STRIP_FLAG_HELP) && STRIP_FLAG_HELP > 0
+// Need this construct to avoid the 'defined but not used' warning.
+#define MAYBE_STRIPPED_HELP(txt) \
+   (false ? (txt) : ::google::kStrippedFlagHelp)
+#else
+#define MAYBE_STRIPPED_HELP(txt) txt
+#endif
+
+// Each command-line flag has two variables associated with it: one
+// with the current value, and one with the default value.  However,
+// we have a third variable, which is where value is assigned; it's a
+// constant.  This guarantees that FLAG_##value is initialized at
+// static initialization time (e.g. before program-start) rather than
+// than global construction time (which is after program-start but
+// before main), at least when 'value' is a compile-time constant.  We
+// use a small trick for the "default value" variable, and call it
+// FLAGS_no<name>.  This serves the second purpose of assuring a
+// compile error if someone tries to define a flag named no<name>
+// which is illegal (--foo and --nofoo both affect the "foo" flag).
+#define DEFINE_VARIABLE(type, shorttype, name, value, help)             \
+  namespace fL##shorttype {                                             \
+    static const type FLAGS_nono##name = value;                         \
+    /* We always want to export defined variables, dll or no */         \
+    GFLAGS_DLL_DEFINE_FLAG type FLAGS_##name = FLAGS_nono##name;        \
+    type FLAGS_no##name = FLAGS_nono##name;                             \
+    static ::google::FlagRegisterer o_##name( \
+      #name, #type, MAYBE_STRIPPED_HELP(help), __FILE__,                \
+      &FLAGS_##name, &FLAGS_no##name);                                  \
+  }                                                                     \
+  using fL##shorttype::FLAGS_##name
+
+// For DEFINE_bool, we want to do the extra check that the passed-in
+// value is actually a bool, and not a string or something that can be
+// coerced to a bool.  These declarations (no definition needed!) will
+// help us do that, and never evaluate From, which is important.
+// We'll use 'sizeof(IsBool(val))' to distinguish. This code requires
+// that the compiler have different sizes for bool & double. Since
+// this is not guaranteed by the standard, we check it with a
+// COMPILE_ASSERT.
+namespace fLB {
+struct CompileAssert {};
+typedef CompileAssert expected_sizeof_double_neq_sizeof_bool[
+                      (sizeof(double) != sizeof(bool)) ? 1 : -1];
+template<typename From> double GFLAGS_DLL_DECL IsBoolFlag(const From& from);
+GFLAGS_DLL_DECL bool IsBoolFlag(bool from);
+}  // namespace fLB
+
+// Here are the actual DEFINE_*-macros. The respective DECLARE_*-macros
+// are in a separate include, gflags_declare.h, for reducing
+// the physical transitive size for DECLARE use.
+#define DEFINE_bool(name, val, txt)                                     \
+  namespace fLB {                                                       \
+    typedef ::fLB::CompileAssert FLAG_##name##_value_is_not_a_bool[     \
+            (sizeof(::fLB::IsBoolFlag(val)) != sizeof(double)) ? 1 : -1]; \
+  }                                                                     \
+  DEFINE_VARIABLE(bool, B, name, val, txt)
+
+#define DEFINE_int32(name, val, txt) \
+   DEFINE_VARIABLE(::google::int32, I, \
+                   name, val, txt)
+
+#define DEFINE_int64(name, val, txt) \
+   DEFINE_VARIABLE(::google::int64, I64, \
+                   name, val, txt)
+
+#define DEFINE_uint64(name,val, txt) \
+   DEFINE_VARIABLE(::google::uint64, U64, \
+                   name, val, txt)
+
+#define DEFINE_double(name, val, txt) \
+   DEFINE_VARIABLE(double, D, name, val, txt)
+
+// Strings are trickier, because they're not a POD, so we can't
+// construct them at static-initialization time (instead they get
+// constructed at global-constructor time, which is much later).  To
+// try to avoid crashes in that case, we use a char buffer to store
+// the string, which we can static-initialize, and then placement-new
+// into it later.  It's not perfect, but the best we can do.
+
+namespace fLS {
+
+inline clstring* dont_pass0toDEFINE_string(char *stringspot,
+                                           const char *value) {
+  return new(stringspot) clstring(value);
+}
+inline clstring* dont_pass0toDEFINE_string(char *stringspot,
+                                           const clstring &value) {
+  return new(stringspot) clstring(value);
+}
+inline clstring* dont_pass0toDEFINE_string(char *stringspot,
+                                           int value);
+}  // namespace fLS
+
+// We need to define a var named FLAGS_no##name so people don't define
+// --string and --nostring.  And we need a temporary place to put val
+// so we don't have to evaluate it twice.  Two great needs that go
+// great together!
+// The weird 'using' + 'extern' inside the fLS namespace is to work around
+// an unknown compiler bug/issue with the gcc 4.2.1 on SUSE 10.  See
+//    http://code.google.com/p/google-gflags/issues/detail?id=20
+#define DEFINE_string(name, val, txt)                                       \
+  namespace fLS {                                                           \
+    using ::fLS::clstring;                                                  \
+    static union { void* align; char s[sizeof(clstring)]; } s_##name[2];    \
+    clstring* const FLAGS_no##name = ::fLS::                                \
+                                   dont_pass0toDEFINE_string(s_##name[0].s, \
+                                                             val);          \
+    static ::google::FlagRegisterer o_##name(  \
+        #name, "string", MAYBE_STRIPPED_HELP(txt), __FILE__,                \
+        s_##name[0].s, new (s_##name[1].s) clstring(*FLAGS_no##name));      \
+    extern GFLAGS_DLL_DEFINE_FLAG clstring& FLAGS_##name;                   \
+    using fLS::FLAGS_##name;                                                \
+    clstring& FLAGS_##name = *FLAGS_no##name;                               \
+  }                                                                         \
+  using fLS::FLAGS_##name
+
+#endif  // SWIG
+
+#endif  // BASE_COMMANDLINEFLAGS_H_
diff --git a/extern/libmv/third_party/gflags/gflags/gflags_completions.h b/extern/libmv/third_party/gflags/gflags/gflags_completions.h
new file mode 100644
index 0000000..37f5b0e
--- /dev/null
+++ b/extern/libmv/third_party/gflags/gflags/gflags_completions.h
@@ -0,0 +1,130 @@
+// Copyright (c) 2008, 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.
+//
+// ---
+
+//
+// Implement helpful bash-style command line flag completions
+//
+// ** Functional API:
+// HandleCommandLineCompletions() should be called early during
+// program startup, but after command line flag code has been
+// initialized, such as the beginning of HandleCommandLineHelpFlags().
+// It checks the value of the flag --tab_completion_word.  If this
+// flag is empty, nothing happens here.  If it contains a string,
+// however, then HandleCommandLineCompletions() will hijack the
+// process, attempting to identify the intention behind this
+// completion.  Regardless of the outcome of this deduction, the
+// process will be terminated, similar to --helpshort flag
+// handling.
+//
+// ** Overview of Bash completions:
+// Bash can be told to programatically determine completions for the
+// current 'cursor word'.  It does this by (in this case) invoking a
+// command with some additional arguments identifying the command
+// being executed, the word being completed, and the previous word
+// (if any).  Bash then expects a sequence of output lines to be
+// printed to stdout.  If these lines all contain a common prefix
+// longer than the cursor word, bash will replace the cursor word
+// with that common prefix, and display nothing.  If there isn't such
+// a common prefix, bash will display the lines in pages using 'more'.
+//
+// ** Strategy taken for command line completions:
+// If we can deduce either the exact flag intended, or a common flag
+// prefix, we'll output exactly that.  Otherwise, if information
+// must be displayed to the user, we'll take the opportunity to add
+// some helpful information beyond just the flag name (specifically,
+// we'll include the default flag value and as much of the flag's
+// description as can fit on a single terminal line width, as specified
+// by the flag --tab_completion_columns).  Furthermore, we'll try to
+// make bash order the output such that the most useful or relevent
+// flags are the most likely to be shown at the top.
+//
+// ** Additional features:
+// To assist in finding that one really useful flag, substring matching
+// was implemented.  Before pressing a <TAB> to get completion for the
+// current word, you can append one or more '?' to the flag to do
+// substring matching.  Here's the semantics:
+//   --foo<TAB>     Show me all flags with names prefixed by 'foo'
+//   --foo?<TAB>    Show me all flags with 'foo' somewhere in the name
+//   --foo??<TAB>   Same as prior case, but also search in module
+//                  definition path for 'foo'
+//   --foo???<TAB>  Same as prior case, but also search in flag
+//                  descriptions for 'foo'
+// Finally, we'll trim the output to a relatively small number of
+// flags to keep bash quiet about the verbosity of output.  If one
+// really wanted to see all possible matches, appending a '+' to the
+// search word will force the exhaustive list of matches to be printed.
+//
+// ** How to have bash accept completions from a binary:
+// Bash requires that it be informed about each command that programmatic
+// completion should be enabled for.  Example addition to a .bashrc
+// file would be (your path to gflags_completions.sh file may differ):
+
+/*
+$ complete -o bashdefault -o default -o nospace -C                            \
+ '/home/build/eng/bash/bash_completions.sh --tab_completion_columns $COLUMNS' \
+  time  env  binary_name  another_binary  [...]
+*/
+
+// This would allow the following to work:
+//   $ /path/to/binary_name --vmodule<TAB>
+// Or:
+//   $ ./bin/path/another_binary --gfs_u<TAB>
+// (etc)
+//
+// Sadly, it appears that bash gives no easy way to force this behavior for
+// all commands.  That's where the "time" in the above example comes in.
+// If you haven't specifically added a command to the list of completion
+// supported commands, you can still get completions by prefixing the
+// entire command with "env".
+//   $ env /some/brand/new/binary --vmod<TAB>
+// Assuming that "binary" is a newly compiled binary, this should still
+// produce the expected completion output.
+
+
+#ifndef BASE_COMMANDLINEFLAGS_COMPLETIONS_H_
+#define BASE_COMMANDLINEFLAGS_COMPLETIONS_H_
+
+// Annoying stuff for windows -- makes sure clients can import these functions
+//
+// NOTE: all functions below MUST have an explicit 'extern' before
+// them.  Our automated opensourcing tools use this as a signal to do
+// appropriate munging for windows, which needs to add GFLAGS_DLL_DECL.
+//
+#define GFLAGS_DLL_DECL  /* rewritten to be non-empty in windows dir */
+
+
+namespace google {
+
+extern void HandleCommandLineCompletions(void);
+
+}
+
+#endif  // BASE_COMMANDLINEFLAGS_COMPLETIONS_H_
diff --git a/extern/libmv/third_party/gflags/gflags/gflags_declare.h b/extern/libmv/third_party/gflags/gflags/gflags_declare.h
new file mode 100644
index 0000000..e301382
--- /dev/null
+++ b/extern/libmv/third_party/gflags/gflags/gflags_declare.h
@@ -0,0 +1,112 @@
+// Copyright (c) 1999, 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.
+
+// ---
+//
+// Revamped and reorganized by Craig Silverstein
+//
+// This is the file that should be included by any file which declares
+// command line flag.
+
+#ifndef BASE_COMMANDLINEFLAGS_DECLARE_H_
+#define BASE_COMMANDLINEFLAGS_DECLARE_H_
+
+#include <string>
+#if 1
+#include <stdint.h>         // the normal place uint16_t is defined
+#endif
+#if 1
+#include <sys/types.h>      // the normal place u_int16_t is defined
+#endif
+#if 1
+#include <inttypes.h>       // a third place for uint16_t or u_int16_t
+#endif
+
+namespace google {
+#if 1      // the C99 format
+typedef int32_t int32;
+typedef uint32_t uint32;
+typedef int64_t int64;
+typedef uint64_t uint64;
+#elif 1   // the BSD format
+typedef int32_t int32;
+typedef u_int32_t uint32;
+typedef int64_t int64;
+typedef u_int64_t uint64;
+#elif 0     // the windows (vc7) format
+typedef __int32 int32;
+typedef unsigned __int32 uint32;
+typedef __int64 int64;
+typedef unsigned __int64 uint64;
+#else
+#error Do not know how to define a 32-bit integer quantity on your system
+#endif
+}
+
+
+#define GFLAGS_DLL_DECLARE_FLAG  /* rewritten to be non-empty in windows dir */
+
+namespace fLS {
+
+// The meaning of "string" might be different between now and when the
+// macros below get invoked (e.g., if someone is experimenting with
+// other string implementations that get defined after this file is
+// included).  Save the current meaning now and use it in the macros.
+typedef std::string clstring;
+
+}
+
+#define DECLARE_VARIABLE(type, shorttype, name) \
+  /* We always want to import declared variables, dll or no */ \
+  namespace fL##shorttype { extern GFLAGS_DLL_DECLARE_FLAG type FLAGS_##name; } \
+  using fL##shorttype::FLAGS_##name
+
+#define DECLARE_bool(name) \
+  DECLARE_VARIABLE(bool, B, name)
+
+#define DECLARE_int32(name) \
+  DECLARE_VARIABLE(::google::int32, I, name)
+
+#define DECLARE_int64(name) \
+  DECLARE_VARIABLE(::google::int64, I64, name)
+
+#define DECLARE_uint64(name) \
+  DECLARE_VARIABLE(::google::uint64, U64, name)
+
+#define DECLARE_double(name) \
+  DECLARE_VARIABLE(double, D, name)
+
+#define DECLARE_string(name) \
+  namespace fLS {                       \
+  using ::fLS::clstring;                \
+  extern GFLAGS_DLL_DECLARE_FLAG ::fLS::clstring& FLAGS_##name; \
+  }                                     \
+  using fLS::FLAGS_##name
+
+#endif  // BASE_COMMANDLINEFLAGS_DECLARE_H_
diff --git a/extern/libmv/third_party/gflags/gflags_completions.cc b/extern/libmv/third_party/gflags/gflags_completions.cc
index a129611..75e9236 100644
--- a/extern/libmv/third_party/gflags/gflags_completions.cc
+++ b/extern/libmv/third_party/gflags/gflags_completions.cc
@@ -28,8 +28,7 @@
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 //
 // ---
-// Author: Dave Nicponski
-//
+
 // Bash-style command line flag completion for C++ binaries
 //
 // This module implements bash-style completions.  It achieves this
@@ -58,7 +57,12 @@
 #include <utility>
 #include <vector>
 
-#include "gflags.h"
+#include "gflags/gflags.h"
+#include "util.h"
+
+using std::set;
+using std::string;
+using std::vector;
 
 #ifndef PATH_SEPARATOR
 #define PATH_SEPARATOR  '/'
@@ -74,11 +78,6 @@ DEFINE_int32(tab_completion_columns, 80,
 _START_GOOGLE_NAMESPACE_
 
 namespace {
-
-using std::set;
-using std::string;
-using std::vector;
-
 // Function prototypes and Type forward declarations.  Code may be
 // more easily understood if it is roughly ordered according to
 // control flow, rather than by C's "declare before use" ordering
@@ -210,12 +209,12 @@ static void PrintFlagCompletionInfo(void) {
       &canonical_token,
       &options);
 
-  //VLOG(1) << "Identified canonical_token: '" << canonical_token << "'";
+  DVLOG(1) << "Identified canonical_token: '" << canonical_token << "'";
 
   vector<CommandLineFlagInfo> all_flags;
   set<const CommandLineFlagInfo *> matching_flags;
   GetAllFlags(&all_flags);
-  //VLOG(2) << "Found " << all_flags.size() << " flags overall";
+  DVLOG(2) << "Found " << all_flags.size() << " flags overall";
 
   string longest_common_prefix;
   FindMatchingFlags(
@@ -224,28 +223,28 @@ static void PrintFlagCompletionInfo(void) {
       canonical_token,
       &matching_flags,
       &longest_common_prefix);
-  //VLOG(1) << "Identified " << matching_flags.size() << " matching flags";
-  //VLOG(1) << "Identified " << longest_common_prefix
-  //        << " as longest common prefix.";
+  DVLOG(1) << "Identified " << matching_flags.size() << " matching flags";
+  DVLOG(1) << "Identified " << longest_common_prefix
+          << " as longest common prefix.";
   if (longest_common_prefix.size() > canonical_token.size()) {
     // There's actually a shared common prefix to all matching flags,
     // so may as well output that and quit quickly.
-    //VLOG(1) << "The common prefix '" << longest_common_prefix
-    //        << "' was longer than the token '" << canonical_token
-    //        << "'.  Returning just this prefix for completion.";
+    DVLOG(1) << "The common prefix '" << longest_common_prefix
+            << "' was longer than the token '" << canonical_token
+            << "'.  Returning just this prefix for completion.";
     fprintf(stdout, "--%s", longest_common_prefix.c_str());
     return;
   }
   if (matching_flags.empty()) {
-    //VLOG(1) << "There were no matching flags, returning nothing.";
+    VLOG(1) << "There were no matching flags, returning nothing.";
     return;
   }
 
   string module;
   string package_dir;
   TryFindModuleAndPackageDir(all_flags, &module, &package_dir);
-  //VLOG(1) << "Identified module: '" << module << "'";
-  //VLOG(1) << "Identified package_dir: '" << package_dir << "'";
+  DVLOG(1) << "Identified module: '" << module << "'";
+  DVLOG(1) << "Identified package_dir: '" << package_dir << "'";
 
   NotableFlags notable_flags;
   CategorizeAllMatchingFlags(
@@ -254,12 +253,12 @@ static void PrintFlagCompletionInfo(void) {
       module,
       package_dir,
       &notable_flags);
-  //VLOG(2) << "Categorized matching flags:";
-  //VLOG(2) << " perfect_match: " << notable_flags.perfect_match_flag.size();
-  //VLOG(2) << " module: " << notable_flags.module_flags.size();
-  //VLOG(2) << " package: " << notable_flags.package_flags.size();
-  //VLOG(2) << " most common: " << notable_flags.most_common_flags.size();
-  //VLOG(2) << " subpackage: " << notable_flags.subpackage_flags.size();
+  DVLOG(2) << "Categorized matching flags:";
+  DVLOG(2) << " perfect_match: " << notable_flags.perfect_match_flag.size();
+  DVLOG(2) << " module: " << notable_flags.module_flags.size();
+  DVLOG(2) << " package: " << notable_flags.package_flags.size();
+  DVLOG(2) << " most common: " << notable_flags.most_common_flags.size();
+  DVLOG(2) << " subpackage: " << notable_flags.subpackage_flags.size();
 
   vector<string> completions;
   FinalizeCompletionOutput(
@@ -271,13 +270,13 @@ static void PrintFlagCompletionInfo(void) {
   if (options.force_no_update)
     completions.push_back("~");
 
-  //VLOG(1) << "Finalized with " << completions.size()
-  //        << " chosen completions";
+  DVLOG(1) << "Finalized with " << completions.size()
+          << " chosen completions";
 
   for (vector<string>::const_iterator it = completions.begin();
       it != completions.end();
       ++it) {
-    //VLOG(9) << "  Completion entry: '" << *it << "'";
+    DVLOG(9) << "  Completion entry: '" << *it << "'";
     fprintf(stdout, "%s\n", it->c_str());
   }
 }
@@ -397,7 +396,7 @@ static bool DoesSingleFlagMatch(
       flag.filename.find(match_token) != string::npos)
     return true;
 
-  // TODO(daven): All searches should probably be case-insensitive
+  // TODO(user): All searches should probably be case-insensitive
   // (especially this one...)
   if (options.flag_description_substring_search &&
       flag.description.find(match_token) != string::npos)
@@ -426,8 +425,8 @@ static void CategorizeAllMatchingFlags(
         all_matches.begin();
       it != all_matches.end();
       ++it) {
-    //VLOG(2) << "Examining match '" << (*it)->name << "'";
-    //VLOG(7) << "  filename: '" << (*it)->filename << "'";
+    DVLOG(2) << "Examining match '" << (*it)->name << "'";
+    DVLOG(7) << "  filename: '" << (*it)->filename << "'";
     string::size_type pos = string::npos;
     if (!package_dir.empty())
       pos = (*it)->filename.find(package_dir);
@@ -440,36 +439,34 @@ static void CategorizeAllMatchingFlags(
     if ((*it)->name == search_token) {
       // Exact match on some flag's name
       notable_flags->perfect_match_flag.insert(*it);
-      //VLOG(3) << "Result: perfect match";
+      DVLOG(3) << "Result: perfect match";
     } else if (!module.empty() && (*it)->filename == module) {
       // Exact match on module filename
       notable_flags->module_flags.insert(*it);
-      //VLOG(3) << "Result: module match";
+      DVLOG(3) << "Result: module match";
     } else if (!package_dir.empty() &&
         pos != string::npos && slash == string::npos) {
       // In the package, since there was no slash after the package portion
       notable_flags->package_flags.insert(*it);
-      //VLOG(3) << "Result: package match";
+      DVLOG(3) << "Result: package match";
     } else if (false) {
       // In the list of the XXX most commonly supplied flags overall
-      // TODO(daven): Compile this list.
-      //VLOG(3) << "Result: most-common match";
+      // TODO(user): Compile this list.
+      DVLOG(3) << "Result: most-common match";
     } else if (!package_dir.empty() &&
         pos != string::npos && slash != string::npos) {
       // In a subdirectory of the package
       notable_flags->subpackage_flags.insert(*it);
-      //VLOG(3) << "Result: subpackage match";
+      DVLOG(3) << "Result: subpackage match";
     }
 
-    //VLOG(3) << "Result: not special match";
+    DVLOG(3) << "Result: not special match";
   }
 }
 
 static void PushNameWithSuffix(vector<string>* suffixes, const char* suffix) {
-  string s("/");
-  s += ProgramInvocationShortName();
-  s += suffix;
-  suffixes->push_back(s);
+  suffixes->push_back(
+      StringPrintf("/%s%s", ProgramInvocationShortName(), suffix));
 }
 
 static void TryFindModuleAndPackageDir(
@@ -480,7 +477,7 @@ static void TryFindModuleAndPackageDir(
   package_dir->clear();
 
   vector<string> suffixes;
-  // TODO(daven): There's some inherant ambiguity here - multiple directories
+  // TODO(user): There's some inherant ambiguity here - multiple directories
   // could share the same trailing folder and file structure (and even worse,
   // same file names), causing us to be unsure as to which of the two is the
   // actual package for this binary.  In this case, we'll arbitrarily choose.
@@ -499,7 +496,7 @@ static void TryFindModuleAndPackageDir(
     for (vector<string>::const_iterator suffix = suffixes.begin();
         suffix != suffixes.end();
         ++suffix) {
-      // TODO(daven): Make sure the match is near the end of the string
+      // TODO(user): Make sure the match is near the end of the string
       if (it->filename.find(*suffix) != string::npos) {
         *module = it->filename;
         string::size_type sep = it->filename.rfind(PATH_SEPARATOR);
@@ -696,12 +693,14 @@ static void OutputSingleGroupWithLimit(
 static string GetShortFlagLine(
     const string &line_indentation,
     const CommandLineFlagInfo &info) {
-  string prefix =
-    line_indentation + "--" + info.name + " [" +
-    (info.type == "string" ?
-       ("'" + info.default_value + "'") :
-       info.default_value)
-    + "] ";
+  string prefix;
+  bool is_string = (info.type == "string");
+  SStringPrintf(&prefix, "%s--%s [%s%s%s] ",
+                line_indentation.c_str(),
+                info.name.c_str(),
+                (is_string ? "'" : ""),
+                info.default_value.c_str(),
+                (is_string ? "'" : ""));
   int remainder =
       FLAGS_tab_completion_columns - static_cast<int>(prefix.size());
   string suffix;
@@ -731,8 +730,12 @@ static string GetLongFlagLine(
   static const char kNewlineWithIndent[] = "\n    ";
   output.replace(output.find(" type:"), 1, string(kNewlineWithIndent));
   output.replace(output.find(" default:"), 1, string(kNewlineWithIndent));
-  output = line_indentation + " Details for '--" + info.name + "':\n" +
-     output + "    defined: " + info.filename;
+  output = StringPrintf("%s Details for '--%s':\n"
+                        "%s    defined: %s",
+                        line_indentation.c_str(),
+                        info.name.c_str(),
+                        output.c_str(),
+                        info.filename.c_str());
 
   // Eliminate any doubled newlines that crept in.  Specifically, if
   // DescribeOneFlag() decided to break the line just before "type"
@@ -759,7 +762,7 @@ static string GetLongFlagLine(
 void HandleCommandLineCompletions(void) {
   if (FLAGS_tab_completion_word.empty()) return;
   PrintFlagCompletionInfo();
-  exit(0);
+  gflags_exitfunc(0);
 }
 
 _END_GOOGLE_NAMESPACE_
diff --git a/extern/libmv/third_party/gflags/gflags_completions.h b/extern/libmv/third_party/gflags/gflags_completions.h
deleted file mode 100644
index 9d9ce7a..0000000
--- a/extern/libmv/third_party/gflags/gflags_completions.h
+++ /dev/null
@@ -1,121 +0,0 @@
-// Copyright (c) 2008, 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.
-//
-// ---
-// Author: Dave Nicponski
-//
-// Implement helpful bash-style command line flag completions
-//
-// ** Functional API:
-// HandleCommandLineCompletions() should be called early during
-// program startup, but after command line flag code has been
-// initialized, such as the beginning of HandleCommandLineHelpFlags().
-// It checks the value of the flag --tab_completion_word.  If this
-// flag is empty, nothing happens here.  If it contains a string,
-// however, then HandleCommandLineCompletions() will hijack the
-// process, attempting to identify the intention behind this
-// completion.  Regardless of the outcome of this deduction, the
-// process will be terminated, similar to --helpshort flag
-// handling.
-//
-// ** Overview of Bash completions:
-// Bash can be told to programatically determine completions for the
-// current 'cursor word'.  It does this by (in this case) invoking a
-// command with some additional arguments identifying the command
-// being executed, the word being completed, and the previous word
-// (if any).  Bash then expects a sequence of output lines to be
-// printed to stdout.  If these lines all contain a common prefix
-// longer than the cursor word, bash will replace the cursor word
-// with that common prefix, and display nothing.  If there isn't such
-// a common prefix, bash will display the lines in pages using 'more'.
-//
-// ** Strategy taken for command line completions:
-// If we can deduce either the exact flag intended, or a common flag
-// prefix, we'll output exactly that.  Otherwise, if information
-// must be displayed to the user, we'll take the opportunity to add
-// some helpful information beyond just the flag name (specifically,
-// we'll include the default flag value and as much of the flag's
-// description as can fit on a single terminal line width, as specified
-// by the flag --tab_completion_columns).  Furthermore, we'll try to
-// make bash order the output such that the most useful or relevent
-// flags are the most likely to be shown at the top.
-//
-// ** Additional features:
-// To assist in finding that one really useful flag, substring matching
-// was implemented.  Before pressing a <TAB> to get completion for the
-// current word, you can append one or more '?' to the flag to do
-// substring matching.  Here's the semantics:
-//   --foo<TAB>     Show me all flags with names prefixed by 'foo'
-//   --foo?<TAB>    Show me all flags with 'foo' somewhere in the name
-//   --foo??<TAB>   Same as prior case, but also search in module
-//                  definition path for 'foo'
-//   --foo???<TAB>  Same as prior case, but also search in flag
-//                  descriptions for 'foo'
-// Finally, we'll trim the output to a relatively small number of
-// flags to keep bash quiet about the verbosity of output.  If one
-// really wanted to see all possible matches, appending a '+' to the
-// search word will force the exhaustive list of matches to be printed.
-//
-// ** How to have bash accept completions from a binary:
-// Bash requires that it be informed about each command that programmatic
-// completion should be enabled for.  Example addition to a .bashrc
-// file would be (your path to gflags_completions.sh file may differ):
-
-/*
-$ complete -o bashdefault -o default -o nospace -C                        \
- '/usr/local/bin/gflags_completions.sh --tab_completion_columns $COLUMNS' \
-  time  env  binary_name  another_binary  [...]
-*/
-
-// This would allow the following to work:
-//   $ /path/to/binary_name --vmodule<TAB>
-// Or:
-//   $ ./bin/path/another_binary --gfs_u<TAB>
-// (etc)
-//
-// Sadly, it appears that bash gives no easy way to force this behavior for
-// all commands.  That's where the "time" in the above example comes in.
-// If you haven't specifically added a command to the list of completion
-// supported commands, you can still get completions by prefixing the
-// entire command with "env".
-//   $ env /some/brand/new/binary --vmod<TAB>
-// Assuming that "binary" is a newly compiled binary, this should still
-// produce the expected completion output.
-
-
-#ifndef GOOGLE_GFLAGS_COMPLETIONS_H_
-#define GOOGLE_GFLAGS_COMPLETIONS_H_
-
-namespace google {
-
-void HandleCommandLineCompletions(void);
-
-}
-
-#endif  // GOOGLE_GFLAGS_COMPLETIONS_H_
diff --git a/extern/libmv/third_party/gflags/gflags_reporting.cc b/extern/libmv/third_party/gflags/gflags_reporting.cc
index fa3024d..c74bcc8 100644
--- a/extern/libmv/third_party/gflags/gflags_reporting.cc
+++ b/extern/libmv/third_party/gflags/gflags_reporting.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006, Google Inc.
+// Copyright (c) 1999, Google Inc.
 // All rights reserved.
 //
 // Redistribution and use in source and binary forms, with or without
@@ -28,7 +28,7 @@
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 // ---
-// Author: Ray Sidney
+//
 // Revamped and reorganized by Craig Silverstein
 //
 // This file contains code for handling the 'reporting' flags.  These
@@ -40,7 +40,7 @@
 // HandleCommandLineHelpFlags().  (Well, actually, ShowUsageWithFlags(),
 // ShowUsageWithFlagsRestrict(), and DescribeOneFlag() can be called
 // externally too, but there's little need for it.)  These are all
-// declared in the main commandlineflags.h header file.
+// declared in the main gflags.h header file.
 //
 // HandleCommandLineHelpFlags() will check what 'reporting' flags have
 // been defined, if any -- the "help" part of the function name is a
@@ -55,14 +55,15 @@
 #include <assert.h>
 #include <string>
 #include <vector>
-#include "gflags.h"
-#include "gflags_completions.h"
+#include "gflags/gflags.h"
+#include "gflags/gflags_completions.h"
+#include "util.h"
 
 #ifndef PATH_SEPARATOR
 #define PATH_SEPARATOR  '/'
 #endif
 
-// The 'reporting' flags.  They all call exit().
+// The 'reporting' flags.  They all call gflags_exitfunc().
 DEFINE_bool(help, false,
             "show help on all flags [tip: all flags can have two dashes]");
 DEFINE_bool(helpfull, false,
@@ -85,11 +86,12 @@ _START_GOOGLE_NAMESPACE_
 using std::string;
 using std::vector;
 
+
 // --------------------------------------------------------------------
 // DescribeOneFlag()
 // DescribeOneFlagInXML()
 //    Routines that pretty-print info about a flag.  These use
-//    a CommandLineFlagInfo, which is the way the commandlineflags
+//    a CommandLineFlagInfo, which is the way the gflags
 //    API exposes static info about a flag.
 // --------------------------------------------------------------------
 
@@ -114,17 +116,19 @@ static string PrintStringFlagsWithQuotes(const CommandLineFlagInfo& flag,
   const char* c_string = (current ? flag.current_value.c_str() :
                           flag.default_value.c_str());
   if (strcmp(flag.type.c_str(), "string") == 0) {  // add quotes for strings
-    return text + ": \"" + c_string + "\"";
+    return StringPrintf("%s: \"%s\"", text.c_str(), c_string);
   } else {
-    return text + ": " + c_string;
+    return StringPrintf("%s: %s", text.c_str(), c_string);
   }
 }
 
 // Create a descriptive string for a flag.
 // Goes to some trouble to make pretty line breaks.
 string DescribeOneFlag(const CommandLineFlagInfo& flag) {
-  string main_part = (string("    -") + flag.name +
-                      " (" + flag.description + ')');
+  string main_part;
+  SStringPrintf(&main_part, "    -%s (%s)",
+                flag.name.c_str(),
+                flag.description.c_str());
   const char* c_string = main_part.c_str();
   int chars_left = static_cast<int>(main_part.length());
   string final_string = "";
@@ -164,7 +168,7 @@ string DescribeOneFlag(const CommandLineFlagInfo& flag) {
     }
     if (*c_string == '\0')
       break;
-    final_string += "\n      ";
+    StringAppendF(&final_string, "\n      ");
     chars_in_line = 6;
   }
 
@@ -173,7 +177,7 @@ string DescribeOneFlag(const CommandLineFlagInfo& flag) {
   // The listed default value will be the actual default from the flag
   // definition in the originating source file, unless the value has
   // subsequently been modified using SetCommandLineOptionWithMode() with mode
-  // SET_FLAGS_DEFAULT, or by setting FLAGS_foo = bar before initializing.
+  // SET_FLAGS_DEFAULT, or by setting FLAGS_foo = bar before ParseCommandLineFlags().
   AddString(PrintStringFlagsWithQuotes(flag, "default", false), &final_string,
             &chars_in_line);
   if (!flag.is_default) {
@@ -181,7 +185,7 @@ string DescribeOneFlag(const CommandLineFlagInfo& flag) {
               &final_string, &chars_in_line);
   }
 
-  final_string += '\n';
+  StringAppendF(&final_string, "\n");
   return final_string;
 }
 
@@ -196,15 +200,10 @@ static string XMLText(const string& txt) {
 }
 
 static void AddXMLTag(string* r, const char* tag, const string& txt) {
-  *r += ('<');
-  *r += (tag);
-  *r += ('>');
-  *r += (XMLText(txt));
-  *r += ("</");
-  *r += (tag);
-  *r += ('>');
+  StringAppendF(r, "<%s>%s</%s>", tag, XMLText(txt).c_str(), tag);
 }
 
+
 static string DescribeOneFlagInXML(const CommandLineFlagInfo& flag) {
   // The file and flagname could have been attributes, but default
   // and meaning need to avoid attribute normalization.  This way it
@@ -265,9 +264,9 @@ static bool FileMatchesSubstring(const string& filename,
 
 // Show help for every filename which matches any of the target substrings.
 // If substrings is empty, shows help for every file. If a flag's help message
-// has been stripped (e.g. by adding '#define STRIP_FLAG_HELP 1' before
-// including gflags/gflags.h), then this flag will not be displayed by
-// '--help' and its variants.
+// has been stripped (e.g. by adding '#define STRIP_FLAG_HELP 1'
+// before including gflags/gflags.h), then this flag will not be displayed
+// by '--help' and its variants.
 static void ShowUsageWithFlagsMatching(const char *argv0,
                                        const vector<string> &substrings) {
   fprintf(stdout, "%s: %s\n", Basename(argv0), ProgramUsage());
@@ -347,10 +346,13 @@ static void ShowXMLOfFlags(const char *prog_name) {
 // --------------------------------------------------------------------
 
 static void ShowVersion() {
-  fprintf(stdout, "%s\n", ProgramInvocationShortName());
-  // TODO: add other stuff, like a timestamp, who built it, what
-  //       target they built, etc.
-
+  const char* version_string = VersionString();
+  if (version_string && *version_string) {
+    fprintf(stdout, "%s version %s\n",
+            ProgramInvocationShortName(), version_string);
+  } else {
+    fprintf(stdout, "%s\n", ProgramInvocationShortName());
+  }
 # if !defined(NDEBUG)
   fprintf(stdout, "Debug build (NDEBUG not #defined)\n");
 # endif
@@ -375,7 +377,6 @@ static void AppendPrognameStrings(vector<string>* substrings,
 
 void HandleCommandLineHelpFlags() {
   const char* progname = ProgramInvocationShortName();
-  extern void (*commandlineflags_exitfunc)(int);   // in gflags.cc
 
   HandleCommandLineCompletions();
 
@@ -386,21 +387,21 @@ void HandleCommandLineHelpFlags() {
     // show only flags related to this binary:
     // E.g. for fileutil.cc, want flags containing   ... "/fileutil." cc
     ShowUsageWithFlagsMatching(progname, substrings);
-    commandlineflags_exitfunc(1);   // almost certainly exit()
+    gflags_exitfunc(1);
 
   } else if (FLAGS_help || FLAGS_helpfull) {
     // show all options
     ShowUsageWithFlagsRestrict(progname, "");   // empty restrict
-    commandlineflags_exitfunc(1);
+    gflags_exitfunc(1);
 
   } else if (!FLAGS_helpon.empty()) {
     string restrict = "/" + FLAGS_helpon + ".";
     ShowUsageWithFlagsRestrict(progname, restrict.c_str());
-    commandlineflags_exitfunc(1);
+    gflags_exitfunc(1);
 
   } else if (!FLAGS_helpmatch.empty()) {
     ShowUsageWithFlagsRestrict(progname, FLAGS_helpmatch.c_str());
-    commandlineflags_exitfunc(1);
+    gflags_exitfunc(1);
 
   } else if (FLAGS_helppackage) {
     // Shows help for all files in the same directory as main().  We
@@ -419,27 +420,27 @@ void HandleCommandLineHelpFlags() {
       const string package = Dirname(flag->filename) + "/";
       if (package != last_package) {
         ShowUsageWithFlagsRestrict(progname, package.c_str());
+        VLOG(7) << "Found package: " << package;
         if (!last_package.empty()) {      // means this isn't our first pkg
-          fprintf(stderr, "WARNING: Multiple packages contain a file=%s\n",
-                  progname);
+          LOG(WARNING) << "Multiple packages contain a file=" << progname;
         }
         last_package = package;
       }
     }
     if (last_package.empty()) {   // never found a package to print
-      fprintf(stderr, "WARNING: Unable to find a package for file=%s\n",
-              progname);
+      LOG(WARNING) << "Unable to find a package for file=" << progname;
     }
-    commandlineflags_exitfunc(1);
+    gflags_exitfunc(1);
 
   } else if (FLAGS_helpxml) {
     ShowXMLOfFlags(progname);
-    commandlineflags_exitfunc(1);
+    gflags_exitfunc(1);
 
   } else if (FLAGS_version) {
     ShowVersion();
     // Unlike help, we may be asking for version in a script, so return 0
-    commandlineflags_exitfunc(0);
+    gflags_exitfunc(0);
+
   }
 }
 
diff --git a/extern/libmv/third_party/gflags/mutex.h b/extern/libmv/third_party/gflags/mutex.h
index 6e1e897..7c3c060 100644
--- a/extern/libmv/third_party/gflags/mutex.h
+++ b/extern/libmv/third_party/gflags/mutex.h
@@ -28,7 +28,6 @@
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 // 
 // ---
-// Author: Craig Silverstein.
 //
 // A simple mutex wrapper, supporting locks and read-write locks.
 // You should assume the locks are *not* re-entrant.
@@ -117,7 +116,12 @@
 #if defined(NO_THREADS)
   typedef int MutexType;      // to keep a lock-count
 #elif defined(_WIN32) || defined(__CYGWIN32__) || defined(__CYGWIN64__)
-# define WIN32_LEAN_AND_MEAN  // We only need minimal includes
+# ifndef WIN32_LEAN_AND_MEAN
+#   define WIN32_LEAN_AND_MEAN  // We only need minimal includes
+# endif
+# ifndef NOMINMAX
+#   define NOMINMAX             // Don't want windows to override min()/max()
+# endif
 # ifdef GMUTEX_TRYLOCK
   // We need Windows NT or later for TryEnterCriticalSection().  If you
   // don't need that functionality, you can remove these _WIN32_WINNT
@@ -134,7 +138,10 @@
   // *does* cause problems for FreeBSD, or MacOSX, but isn't needed
   // for locking there.)
 # ifdef __linux__
-#   define _XOPEN_SOURCE 500  // may be needed to get the rwlock calls
+#   if _XOPEN_SOURCE < 500      // including not being defined at all
+#     undef _XOPEN_SOURCE
+#     define _XOPEN_SOURCE 500  // may be needed to get the rwlock calls
+#   endif
 # endif
 # include <pthread.h>
   typedef pthread_rwlock_t MutexType;
diff --git a/extern/libmv/third_party/gflags/util.h b/extern/libmv/third_party/gflags/util.h
new file mode 100644
index 0000000..8e2b1b8
--- /dev/null
+++ b/extern/libmv/third_party/gflags/util.h
@@ -0,0 +1,339 @@
+// Copyright (c) 2011, 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.
+// ---
+//
+// Some generically useful utility routines that in google-land would
+// be their own projects.  We make a shortened version here.
+
+#ifndef GFLAGS_UTIL_H_
+#define GFLAGS_UTIL_H_
+
+#include <assert.h>
+#include "config.h"
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#include <stdarg.h>     // for va_*
+#include <stdlib.h>
+#include <stdio.h>
+#include <iostream>
+#include <string>
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif   // for mkdir()
+
+_START_GOOGLE_NAMESPACE_
+
+// This is used for unittests for death-testing.  It is defined in gflags.cc.
+extern GFLAGS_DLL_DECL void (*gflags_exitfunc)(int);
+
+// Work properly if either strtoll or strtoq is on this system
+#ifdef HAVE_STRTOLL
+# define strto64  strtoll
+# define strtou64  strtoull
+#elif HAVE_STRTOQ
+# define strto64  strtoq
+# define strtou64  strtouq
+#else
+// Neither strtoll nor strtoq are defined.  I hope strtol works!
+# define strto64 strtol
+# define strtou64 strtoul
+#endif
+
+// If we have inttypes.h, it will have defined PRId32/etc for us.  If
+// not, take our best guess.
+#ifndef PRId32
+# define PRId32 "d"
+#endif
+#ifndef PRId64
+# define PRId64 "lld"
+#endif
+#ifndef PRIu64
+# define PRIu64 "llu"
+#endif
+
+typedef signed char int8;
+typedef unsigned char uint8;
+
+// -- utility macros ---------------------------------------------------------
+
+template <bool> struct CompileAssert {};
+#define COMPILE_ASSERT(expr, msg) \
+  typedef CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
+
+// Returns the number of elements in an array.
+#define arraysize(arr) (sizeof(arr)/sizeof(*(arr)))
+
+
+// -- logging and testing ---------------------------------------------------
+
+// For now, we ignore the level for logging, and don't show *VLOG's at
+// all, except by hand-editing the lines below
+#define LOG(level)    std::cerr
+#define VLOG(level)   if (true) {} else std::cerr
+#define DVLOG(level)  if (true) {} else std::cerr
+
+// CHECK dies with a fatal error if condition is not true.  It is *not*
+// controlled by NDEBUG, so the check will be executed regardless of
+// compilation mode.  Therefore, it is safe to do things like:
+//    CHECK(fp->Write(x) == 4)
+// We allow stream-like objects after this for debugging, but they're ignored.
+#define EXPECT_TRUE(condition)                                  \
+  if (true) {                                                   \
+    if (!(condition)) {                                         \
+      fprintf(stderr, "Check failed: %s\n", #condition);        \
+      exit(1);                                                  \
+    }                                                           \
+  } else std::cerr << ""
+
+#define EXPECT_OP(op, val1, val2)                                       \
+  if (true) {                                                           \
+    if (!((val1) op (val2))) {                                          \
+      fprintf(stderr, "Check failed: %s %s %s\n", #val1, #op, #val2);   \
+      exit(1);                                                          \
+    }                                                                   \
+  } else std::cerr << ""
+
+#define EXPECT_EQ(val1, val2) EXPECT_OP(==, val1, val2)
+#define EXPECT_NE(val1, val2) EXPECT_OP(!=, val1, val2)
+#define EXPECT_LE(val1, val2) EXPECT_OP(<=, val1, val2)
+#define EXPECT_LT(val1, val2) EXPECT_OP(< , val1, val2)
+#define EXPECT_GE(val1, val2) EXPECT_OP(>=, val1, val2)
+#define EXPECT_GT(val1, val2) EXPECT_OP(> , val1, val2)
+#define EXPECT_FALSE(cond)    EXPECT_TRUE(!(cond))
+
+// C99 declares isnan and isinf should be macros, so the #ifdef test
+// should be reliable everywhere.  Of course, it's not, but these
+// are testing pertty marginal functionality anyway, so it's ok to
+// not-run them even in situations they might, with effort, be made to work.
+#ifdef isnan  // Some compilers, like sun's for Solaris 10, don't define this
+#define EXPECT_NAN(arg)                                         \
+  do {                                                          \
+    if (!isnan(arg)) {                                          \
+      fprintf(stderr, "Check failed: isnan(%s)\n", #arg);       \
+      exit(1);                                                  \
+    }                                                           \
+  } while (0)
+#else
+#define EXPECT_NAN(arg)
+#endif
+
+#ifdef isinf  // Some compilers, like sun's for Solaris 10, don't define this
+#define EXPECT_INF(arg)                                         \
+  do {                                                          \
+    if (!isinf(arg)) {                                          \
+      fprintf(stderr, "Check failed: isinf(%s)\n", #arg);       \
+      exit(1);                                                  \
+    }                                                           \
+  } while (0)
+#else
+#define EXPECT_INF(arg)
+#endif
+
+#define EXPECT_DOUBLE_EQ(val1, val2)                                    \
+  do {                                                                  \
+    if (((val1) < (val2) - 0.001 || (val1) > (val2) + 0.001)) {         \
+      fprintf(stderr, "Check failed: %s == %s\n", #val1, #val2);        \
+      exit(1);                                                          \
+    }                                                                   \
+  } while (0)
+
+#define EXPECT_STREQ(val1, val2)                                        \
+  do {                                                                  \
+    if (strcmp((val1), (val2)) != 0) {                                  \
+      fprintf(stderr, "Check failed: streq(%s, %s)\n", #val1, #val2);   \
+      exit(1);                                                          \
+    }                                                                   \
+  } while (0)
+
+// Call this in a .cc file where you will later call RUN_ALL_TESTS in main().
+#define TEST_INIT                                                       \
+  static std::vector<void (*)()> g_testlist;  /* the tests to run */    \
+  static int RUN_ALL_TESTS() {                                          \
+    std::vector<void (*)()>::const_iterator it;                         \
+    for (it = g_testlist.begin(); it != g_testlist.end(); ++it) {       \
+      (*it)();   /* The test will error-exit if there's a problem. */   \
+    }                                                                   \
+    fprintf(stderr, "\nPassed %d tests\n\nPASS\n",                      \
+            static_cast<int>(g_testlist.size()));                       \
+    return 0;                                                           \
+  }
+
+// Note that this macro uses a FlagSaver to keep tests isolated.
+#define TEST(a, b)                                      \
+  struct Test_##a##_##b {                               \
+    Test_##a##_##b() { g_testlist.push_back(&Run); }    \
+    static void Run() {                                 \
+      FlagSaver fs;                                     \
+      fprintf(stderr, "Running test %s/%s\n", #a, #b);  \
+      RunTest();                                        \
+    }                                                   \
+    static void RunTest();                              \
+  };                                                    \
+  static Test_##a##_##b g_test_##a##_##b;               \
+  void Test_##a##_##b::RunTest()
+
+// This is a dummy class that eases the google->opensource transition.
+namespace testing {
+class Test {};
+}
+
+// Call this in a .cc file where you will later call EXPECT_DEATH
+#define EXPECT_DEATH_INIT                               \
+  static bool g_called_exit;                            \
+  static void CalledExit(int) { g_called_exit = true; }
+
+#define EXPECT_DEATH(fn, msg)                                           \
+  do {                                                                  \
+    g_called_exit = false;                                              \
+    gflags_exitfunc = &CalledExit;                            \
+    fn;                                                                 \
+    gflags_exitfunc = &exit;    /* set back to its default */ \
+    if (!g_called_exit) {                                               \
+      fprintf(stderr, "Function didn't die (%s): %s\n", msg, #fn);      \
+      exit(1);                                                          \
+    }                                                                   \
+  } while (0)
+
+#define GTEST_HAS_DEATH_TEST 1
+
+// -- path routines ----------------------------------------------------------
+
+// Tries to create the directory path as a temp-dir.  If it fails,
+// changes path to some directory it *can* create.
+#if defined(__MINGW32__)
+#include <io.h>
+inline void MakeTmpdir(std::string* path) {
+  // I had trouble creating a directory in /tmp from mingw
+  *path = "./gflags_unittest_testdir";
+  mkdir(path->c_str());   // mingw has a weird one-arg mkdir
+}
+#elif defined(_MSC_VER)
+#include <direct.h>
+#include <windows.h>
+inline void MakeTmpdir(std::string* path) {
+  char tmppath_buffer[1024];
+  int tmppath_len = GetTempPathA(sizeof(tmppath_buffer), tmppath_buffer);
+  assert(tmppath_len > 0 && tmppath_len < sizeof(tmppath_buffer));
+  assert(tmppath_buffer[tmppath_len - 1] == '\\');   // API guarantees it
+  *path = std::string(tmppath_buffer) + "gflags_unittest_testdir";
+  _mkdir(path->c_str());
+}
+// Windows is missing random bits like strcasecmp, strtoll, strtoull, and
+// snprintf in the usual locations. Put them somewhere sensible.
+//
+// TODO(keir): Get the upstream Windows port and use that instead.
+#define snprintf _snprintf
+#undef strtoint64
+#define strtoint64 _strtoi64
+#undef strtouint64
+#define strtouint64 _strtoui64
+#define strcasecmp _stricmp
+#define va_copy(dst, src) ((dst) = (src))
+#define strto64 _strtoi64
+#define strtou64 _strtoui64
+#else
+inline void MakeTmpdir(std::string* path) {
+  mkdir(path->c_str(), 0755);
+}
+#endif
+
+// -- string routines --------------------------------------------------------
+
+inline void InternalStringPrintf(std::string* output, const char* format,
+                                 va_list ap) {
+  char space[128];    // try a small buffer and hope it fits
+
+  // It's possible for methods that use a va_list to invalidate
+  // the data in it upon use.  The fix is to make a copy
+  // of the structure before using it and use that copy instead.
+  va_list backup_ap;
+  va_copy(backup_ap, ap);
+  int bytes_written = vsnprintf(space, sizeof(space), format, backup_ap);
+  va_end(backup_ap);
+
+  if ((bytes_written >= 0) && (bytes_written < sizeof(space))) {
+    output->append(space, bytes_written);
+    return;
+  }
+
+  // Repeatedly increase buffer size until it fits.
+  int length = sizeof(space);
+  while (true) {
+    if (bytes_written < 0) {
+      // Older snprintf() behavior. :-(  Just try doubling the buffer size
+      length *= 2;
+    } else {
+      // We need exactly "bytes_written+1" characters
+      length = bytes_written+1;
+    }
+    char* buf = new char[length];
+
+    // Restore the va_list before we use it again
+    va_copy(backup_ap, ap);
+    bytes_written = vsnprintf(buf, length, format, backup_ap);
+    va_end(backup_ap);
+
+    if ((bytes_written >= 0) && (bytes_written < length)) {
+      output->append(buf, bytes_written);
+      delete[] buf;
+      return;
+    }
+    delete[] buf;
+  }
+}
+
+// Clears output before writing to it.
+inline void SStringPrintf(std::string* output, const char* format, ...) {
+  va_list ap;
+  va_start(ap, format);
+  output->clear();
+  InternalStringPrintf(output, format, ap);
+  va_end(ap);
+}
+
+inline void StringAppendF(std::string* output, const char* format, ...) {
+  va_list ap;
+  va_start(ap, format);
+  InternalStringPrintf(output, format, ap);
+  va_end(ap);
+}
+
+inline std::string StringPrintf(const char* format, ...) {
+  va_list ap;
+  va_start(ap, format);
+  std::string output;
+  InternalStringPrintf(&output, format, ap);
+  va_end(ap);
+  return output;
+}
+
+_END_GOOGLE_NAMESPACE_
+
+#endif  // GFLAGS_UTIL_H_
diff --git a/extern/libmv/third_party/glog/ChangeLog b/extern/libmv/third_party/glog/ChangeLog
index 350fee9..6ac0b0f 100644
--- a/extern/libmv/third_party/glog/ChangeLog
+++ b/extern/libmv/third_party/glog/ChangeLog
@@ -1,3 +1,13 @@
+2012-01-12  Google Inc. <opensource at google.com>
+
+	* google-glog: version 0.3.2
+	* Clang support.
+	* Demangler and stacktrace improvement for newer GCCs.
+	* Now fork(2) doesn't mess up log files.
+	* Make valgrind happier.
+	* Reduce warnings for more -W options.
+	* Provide a workaround for ERROR defined by windows.h.
+
 2010-06-15  Google Inc. <opensource at google.com>
 
 	* google-glog: version 0.3.1
diff --git a/extern/libmv/third_party/glog/README.libmv b/extern/libmv/third_party/glog/README.libmv
index 8f1243b..025a70b 100644
--- a/extern/libmv/third_party/glog/README.libmv
+++ b/extern/libmv/third_party/glog/README.libmv
@@ -1,38 +1,24 @@
 Project: Google Logging
 URL: http://code.google.com/p/google-glog/
 License: New BSD
-Upstream version: 0.3.1
+Upstream version: 0.3.2
 Local modifications:
 
 Upgrading Notes
-* Had to change #include <gflags/gflags.h> to #include "gflags/gflags.h"
-* Make sure to copy over a config_YOUR_PLATFORM.h and put it in config.h
-
-Old changes which got obsoleted (maybe?) by 0.3.1 merge:
-* The config_linux.h is generated by configure on Keir's Ubuntu 9.04 desktop.
-* Commented out some struct ::tm weirdness causing compile failures on
-  ubuntu 8.10 and 9.04.
-* Switched several initializers to memset instead of = {}.
-* Changed some includes pointing to gflags. Not sure why the regular inclusion
-  didn't work.
-* Added some compile flags to silence various warnings, allowing us to keep the
-  differences between upstream small.
-* Don't redefine _XOPEN_SOURCE.
-* Added "google::" to GetReferenceableValue in CHECK_OP_LOG.
-* Add virtual destructor to Thread in googletest.h.
-* Update windows/glog/log_severity to build with QT library that include WinGDI
-  (It cause a double definition of ERROR variable).
-
-Old changes which got obsoleted (maybe?) by 0.2.1 merge:
-* Added #ifndef / def REG_EIP; not sure what that is.
-* Added (void) arg stuff to prevent unused variable warnings.
-* Added google:: namespace prefix to GetReferencableValue
-* Added assignments for several functions marked with no_ignore_return, where
-  the return value was ignored.
-* Commented out the unused function DumpPCAndSymbol() in utilities.cc to silent
-  gcc on the mac
-
-TODO(keir): Remove any obsoleted changes above if they are not necessary after
-testing on more platforms.
-
-WARNING: Mac port not updated for 0.2.1
+* Replace <gflags/gflags.h> with "third_party/gflags/gflags/gflags.h" which is easier
+  to setup things in libmv and also helps with setting up building libmv into
+  external applications.
+* Replace "glog/logging.h" and  "glog/logging.h" with <glog/logging.h> and  <glog/logging.h>
+  which is needed on Windows platform because otherwise files like logging.cc will be using
+  relative path which points to headers used by linux instead of headers need to be used
+  on Windows.
+* Replace _asm int 3 with __debugbreak(). Such assembler code is obsolete and doesn't work
+  with 64bit versions of MSVC compilers.
+* Do not use stacktrace for MinGW and FreeBSD because it leads into issues accessing
+  some specific data on this platforms.
+* Define HAVE_LIB_GFLAGS for Windows builds.
+* Do not define __declspec(dllimport) for MinGW platforms.
+* Setup proper includes and datatypes for int32, uint32, int64 and uint64 for MinGW
+* Do not define va_copy for MinGW platforms (it's already defined there).
+* Patch localtime_r to be working fine with MinGW, disable strerror_r for MinGW because
+  of lack of needed functions.
diff --git a/extern/libmv/third_party/glog/src/base/commandlineflags.h b/extern/libmv/third_party/glog/src/base/commandlineflags.h
index 6c529cc..483a96e 100644
--- a/extern/libmv/third_party/glog/src/base/commandlineflags.h
+++ b/extern/libmv/third_party/glog/src/base/commandlineflags.h
@@ -55,11 +55,11 @@
 
 #ifdef HAVE_LIB_GFLAGS
 
-#include "third_party/gflags/gflags.h"
+#include "third_party/gflags/gflags/gflags.h"
 
 #else
 
-#include "glog/logging.h"
+#include <glog/logging.h>
 
 #define DECLARE_VARIABLE(type, name, tn)                                      \
   namespace FLAG__namespace_do_not_use_directly_use_DECLARE_##tn##_instead {  \
diff --git a/extern/libmv/third_party/glog/src/base/googleinit.h b/extern/libmv/third_party/glog/src/base/googleinit.h
index c907308..5a8b515 100644
--- a/extern/libmv/third_party/glog/src/base/googleinit.h
+++ b/extern/libmv/third_party/glog/src/base/googleinit.h
@@ -36,7 +36,7 @@
 class GoogleInitializer {
  public:
   typedef void (*void_function)(void);
-  GoogleInitializer(const char* name, void_function f) {
+  GoogleInitializer(const char*, void_function f) {
     f();
   }
 };
diff --git a/extern/libmv/third_party/glog/src/config.h b/extern/libmv/third_party/glog/src/config.h
index 102bf9e..f5c9c0b 100644
--- a/extern/libmv/third_party/glog/src/config.h
+++ b/extern/libmv/third_party/glog/src/config.h
@@ -12,4 +12,6 @@
  #include "config_linux.h"
 #elif defined(_MSC_VER)
  #include "windows/config.h"
+#elif defined(__GNU__)
+ #include "config_hurd.h"
 #endif
diff --git a/extern/libmv/third_party/glog/src/config_freebsd.h b/extern/libmv/third_party/glog/src/config_freebsd.h
index caaef9d..a671a00 100644
--- a/extern/libmv/third_party/glog/src/config_freebsd.h
+++ b/extern/libmv/third_party/glog/src/config_freebsd.h
@@ -11,7 +11,7 @@
 #define HAVE_DLFCN_H 1
 
 /* Define to 1 if you have the <execinfo.h> header file. */
-#define HAVE_EXECINFO_H 1
+#undef HAVE_EXECINFO_H
 
 /* Define if you have the `fcntl' function */
 #define HAVE_FCNTL 1
@@ -122,13 +122,13 @@
 #define PACKAGE_NAME "glog"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "glog 0.3.1"
+#define PACKAGE_STRING "glog 0.3.2"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "glog"
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "0.3.1"
+#define PACKAGE_VERSION "0.3.2"
 
 /* How to access the PC from a struct ucontext */
 /* #define PC_FROM_UCONTEXT uc_mcontext.gregs[REG_RIP] */
@@ -151,7 +151,7 @@
 #define TEST_SRC_DIR "."
 
 /* Version number of package */
-#define VERSION "0.3.1"
+#define VERSION "0.3.2"
 
 /* Stops putting the code inside the Google namespace */
 #define _END_GOOGLE_NAMESPACE_ }
@@ -159,3 +159,8 @@
 /* Puts following code inside the Google namespace */
 #define _START_GOOGLE_NAMESPACE_ namespace google {
 
+/* isn't getting defined by configure script when clang compilers are used
+   and cuases compilation errors in stactrace/unwind modules */
+#ifdef __clang__
+#  define NO_FRAME_POINTER
+#endif
diff --git a/extern/libmv/third_party/glog/src/config_hurd.h b/extern/libmv/third_party/glog/src/config_hurd.h
new file mode 100644
index 0000000..47aefa4
--- /dev/null
+++ b/extern/libmv/third_party/glog/src/config_hurd.h
@@ -0,0 +1,166 @@
+/* src/config.h.  Generated from config.h.in by configure.  */
+/* src/config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Namespace for Google classes */
+#define GOOGLE_NAMESPACE google
+
+/* Define if you have the `dladdr' function */
+/* #undef HAVE_DLADDR */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the <execinfo.h> header file. */
+#define HAVE_EXECINFO_H 1
+
+/* Define if you have the `fcntl' function */
+#define HAVE_FCNTL 1
+
+/* Define to 1 if you have the <glob.h> header file. */
+#define HAVE_GLOB_H 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `pthread' library (-lpthread). */
+#define HAVE_LIBPTHREAD 1
+
+/* Define to 1 if you have the <libunwind.h> header file. */
+/* #undef HAVE_LIBUNWIND_H */
+
+/* define if you have google gflags library */
+#define HAVE_LIB_GFLAGS 1
+
+/* define if you have google gmock library */
+/* #undef HAVE_LIB_GMOCK */
+
+/* define if you have google gtest library */
+/* #undef HAVE_LIB_GTEST */
+
+/* define if you have libunwind */
+/* #undef HAVE_LIB_UNWIND */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* define if the compiler implements namespaces */
+#define HAVE_NAMESPACES 1
+
+/* Define if you have POSIX threads libraries and header files. */
+#define HAVE_PTHREAD 1
+
+/* Define to 1 if you have the <pwd.h> header file. */
+#define HAVE_PWD_H 1
+
+/* define if the compiler implements pthread_rwlock_* */
+#define HAVE_RWLOCK 1
+
+/* Define if you have the `sigaltstack' function */
+#define HAVE_SIGALTSTACK 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <syscall.h> header file. */
+/* #undef HAVE_SYSCALL_H */
+
+/* Define to 1 if you have the <syslog.h> header file. */
+#define HAVE_SYSLOG_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/syscall.h> header file. */
+/* #undef HAVE_SYS_SYSCALL_H */
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/ucontext.h> header file. */
+#define HAVE_SYS_UCONTEXT_H 1
+
+/* Define to 1 if you have the <sys/utsname.h> header file. */
+#define HAVE_SYS_UTSNAME_H 1
+
+/* Define to 1 if you have the <ucontext.h> header file. */
+#define HAVE_UCONTEXT_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* define if the compiler supports using expression for operator */
+#define HAVE_USING_OPERATOR 1
+
+/* define if your compiler has __attribute__ */
+#define HAVE___ATTRIBUTE__ 1
+
+/* define if your compiler has __builtin_expect */
+#define HAVE___BUILTIN_EXPECT 1
+
+/* define if your compiler has __sync_val_compare_and_swap */
+/* #undef HAVE___SYNC_VAL_COMPARE_AND_SWAP */
+
+/* Name of package */
+#define PACKAGE "glog"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "opensource at google.com"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "glog"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "glog 0.3.1"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "glog"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "0.3.1"
+
+/* How to access the PC from a struct ucontext */
+#if defined(_M_X64) || defined(__amd64__) || defined(__x86_64__)
+  #define PC_FROM_UCONTEXT uc_mcontext.gregs[REG_RIP]
+#elif defined(_M_IX86) || defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__)
+  #define PC_FROM_UCONTEXT uc_mcontext.gregs[REG_EIP]
+#else
+  #undef PC_FROM_UCONTEXT
+#endif
+
+/* Define to necessary symbol if this constant uses a non-standard name on
+   your system. */
+/* #undef PTHREAD_CREATE_JOINABLE */
+
+/* The size of `void *', as computed by sizeof. */
+#define SIZEOF_VOID_P 4
+
+/* Define to 1 if you have the ANSI C header files. */
+/* #undef STDC_HEADERS */
+
+#define STDC_HEADERS 1
+/* the namespace where STL code like vector<> is defined */
+#define STL_NAMESPACE std
+
+/* location of source code */
+#define TEST_SRC_DIR "."
+
+/* Version number of package */
+#define VERSION "0.3.1"
+
+/* Stops putting the code inside the Google namespace */
+#define _END_GOOGLE_NAMESPACE_ }
+
+/* Puts following code inside the Google namespace */
+#define _START_GOOGLE_NAMESPACE_ namespace google {
diff --git a/extern/libmv/third_party/glog/src/config_linux.h b/extern/libmv/third_party/glog/src/config_linux.h
index faf0329..5877029 100644
--- a/extern/libmv/third_party/glog/src/config_linux.h
+++ b/extern/libmv/third_party/glog/src/config_linux.h
@@ -112,6 +112,10 @@
 /* define if your compiler has __sync_val_compare_and_swap */
 /* #undef HAVE___SYNC_VAL_COMPARE_AND_SWAP */
 
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#define LT_OBJDIR ".libs/"
+
 /* Name of package */
 #define PACKAGE "glog"
 
@@ -122,13 +126,16 @@
 #define PACKAGE_NAME "glog"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "glog 0.3.1"
+#define PACKAGE_STRING "glog 0.3.2"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "glog"
 
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "0.3.1"
+#define PACKAGE_VERSION "0.3.2"
 
 /* How to access the PC from a struct ucontext */
 #if defined(_M_X64) || defined(__amd64__) || defined(__x86_64__)
@@ -157,10 +164,16 @@
 #define TEST_SRC_DIR "."
 
 /* Version number of package */
-#define VERSION "0.3.1"
+#define VERSION "0.3.2"
 
 /* Stops putting the code inside the Google namespace */
 #define _END_GOOGLE_NAMESPACE_ }
 
 /* Puts following code inside the Google namespace */
 #define _START_GOOGLE_NAMESPACE_ namespace google {
+
+/* isn't getting defined by configure script when clang compilers are used
+   and cuases compilation errors in stactrace/unwind modules */
+#ifdef __clang__
+#  define NO_FRAME_POINTER
+#endif
diff --git a/extern/libmv/third_party/glog/src/config_mac.h b/extern/libmv/third_party/glog/src/config_mac.h
index 5f953d1..9756fde 100644
--- a/extern/libmv/third_party/glog/src/config_mac.h
+++ b/extern/libmv/third_party/glog/src/config_mac.h
@@ -122,13 +122,13 @@
 #define PACKAGE_NAME "glog"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "glog 0.3.1"
+#define PACKAGE_STRING "glog 0.3.2"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "glog"
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "0.3.1"
+#define PACKAGE_VERSION "0.3.2"
 
 /* How to access the PC from a struct ucontext */
 #undef PC_FROM_UCONTEXT
@@ -150,10 +150,16 @@
 #define TEST_SRC_DIR "."
 
 /* Version number of package */
-#define VERSION "0.3.1"
+#define VERSION "0.3.2"
 
 /* Stops putting the code inside the Google namespace */
 #define _END_GOOGLE_NAMESPACE_ }
 
 /* Puts following code inside the Google namespace */
 #define _START_GOOGLE_NAMESPACE_ namespace google {
+
+/* isn't getting defined by configure script when clang compilers are used
+   and cuases compilation errors in stactrace/unwind modules */
+#ifdef __clang__
+#  define NO_FRAME_POINTER
+#endif
diff --git a/extern/libmv/third_party/glog/src/demangle.cc b/extern/libmv/third_party/glog/src/demangle.cc
index 46556bf..0daf308 100644
--- a/extern/libmv/third_party/glog/src/demangle.cc
+++ b/extern/libmv/third_party/glog/src/demangle.cc
@@ -28,6 +28,11 @@
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 //
 // Author: Satoru Takabayashi
+//
+// For reference check out:
+// http://www.codesourcery.com/public/cxx-abi/abi.html#mangling
+//
+// Note that we only have partial C++0x support yet.
 
 #include <stdio.h>  // for NULL
 #include "demangle.h"
@@ -138,14 +143,12 @@ static const AbbrevPair kSubstitutionList[] = {
 // State needed for demangling.
 typedef struct {
   const char *mangled_cur;  // Cursor of mangled name.
-  const char *mangled_end;  // End of mangled name.
   char *out_cur;            // Cursor of output string.
   const char *out_begin;    // Beginning of output string.
   const char *out_end;      // End of output string.
   const char *prev_name;    // For constructors/destructors.
   int prev_name_length;     // For constructors/destructors.
-  int nest_level;           // For nested names.
-  int number;               // Remember the previous number.
+  short nest_level;         // For nested names.
   bool append;              // Append flag.
   bool overflowed;          // True if output gets overflowed.
 } State;
@@ -161,6 +164,16 @@ static size_t StrLen(const char *str) {
   return len;
 }
 
+// Returns true if "str" has at least "n" characters remaining.
+static bool AtLeastNumCharsRemaining(const char *str, int n) {
+  for (int i = 0; i < n; ++i) {
+    if (str == '\0') {
+      return false;
+    }
+  }
+  return true;
+}
+
 // Returns true if "str" has "prefix" as a prefix.
 static bool StrPrefix(const char *str, const char *prefix) {
   size_t i = 0;
@@ -174,39 +187,33 @@ static bool StrPrefix(const char *str, const char *prefix) {
 static void InitState(State *state, const char *mangled,
                       char *out, int out_size) {
   state->mangled_cur = mangled;
-  state->mangled_end = mangled + StrLen(mangled);
   state->out_cur = out;
   state->out_begin = out;
   state->out_end = out + out_size;
   state->prev_name  = NULL;
   state->prev_name_length = -1;
   state->nest_level = -1;
-  state->number = -1;
   state->append = true;
   state->overflowed = false;
 }
 
-// Calculates the remaining length of the mangled name.
-static int RemainingLength(State *state) {
-  return state->mangled_end - state->mangled_cur;
-}
-
-// Returns true and advances "mangled_cur" if we find "c" at
-// "mangled_cur" position.
-static bool ParseChar(State *state, const char c) {
-  if (RemainingLength(state) >= 1 && *state->mangled_cur == c) {
+// Returns true and advances "mangled_cur" if we find "one_char_token"
+// at "mangled_cur" position.  It is assumed that "one_char_token" does
+// not contain '\0'.
+static bool ParseOneCharToken(State *state, const char one_char_token) {
+  if (state->mangled_cur[0] == one_char_token) {
     ++state->mangled_cur;
     return true;
   }
   return false;
 }
 
-// Returns true and advances "mangled_cur" if we find "two_chars" at
-// "mangled_cur" position.
-static bool ParseTwoChar(State *state, const char *two_chars) {
-  if (RemainingLength(state) >= 2 &&
-      state->mangled_cur[0] == two_chars[0] &&
-      state->mangled_cur[1] == two_chars[1]) {
+// Returns true and advances "mangled_cur" if we find "two_char_token"
+// at "mangled_cur" position.  It is assumed that "two_char_token" does
+// not contain '\0'.
+static bool ParseTwoCharToken(State *state, const char *two_char_token) {
+  if (state->mangled_cur[0] == two_char_token[0] &&
+      state->mangled_cur[1] == two_char_token[1]) {
     state->mangled_cur += 2;
     return true;
   }
@@ -216,13 +223,13 @@ static bool ParseTwoChar(State *state, const char *two_chars) {
 // Returns true and advances "mangled_cur" if we find any character in
 // "char_class" at "mangled_cur" position.
 static bool ParseCharClass(State *state, const char *char_class) {
-  if (state->mangled_cur == state->mangled_end) {
+  if (state->mangled_cur == '\0') {
     return false;
   }
   const char *p = char_class;
   for (; *p != '\0'; ++p) {
-    if (*state->mangled_cur == *p) {
-      state->mangled_cur += 1;
+    if (state->mangled_cur[0] == *p) {
+      ++state->mangled_cur;
       return true;
     }
   }
@@ -230,7 +237,7 @@ static bool ParseCharClass(State *state, const char *char_class) {
 }
 
 // This function is used for handling an optional non-terminal.
-static bool Optional(bool status) {
+static bool Optional(bool) {
   return true;
 }
 
@@ -245,6 +252,16 @@ static bool OneOrMore(ParseFunc parse_func, State *state) {
   return false;
 }
 
+// This function is used for handling <non-terminal>* syntax. The function
+// always returns true and must be followed by a termination token or a
+// terminating sequence not handled by parse_func (e.g.
+// ParseOneCharToken(state, 'E')).
+static bool ZeroOrMore(ParseFunc parse_func, State *state) {
+  while (parse_func(state)) {
+  }
+  return true;
+}
+
 // Append "str" at "out_cur".  If there is an overflow, "overflowed"
 // is set to true for later use.  The output string is ensured to
 // always terminate with '\0' as long as there is no overflow.
@@ -270,7 +287,37 @@ static bool IsLower(char c) {
 }
 
 static bool IsAlpha(char c) {
-  return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
+  return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
+}
+
+static bool IsDigit(char c) {
+  return c >= '0' && c <= '9';
+}
+
+// Returns true if "str" is a function clone suffix.  These suffixes are used
+// by GCC 4.5.x and later versions to indicate functions which have been
+// cloned during optimization.  We treat any sequence (.<alpha>+.<digit>+)+ as
+// a function clone suffix.
+static bool IsFunctionCloneSuffix(const char *str) {
+  size_t i = 0;
+  while (str[i] != '\0') {
+    // Consume a single .<alpha>+.<digit>+ sequence.
+    if (str[i] != '.' || !IsAlpha(str[i + 1])) {
+      return false;
+    }
+    i += 2;
+    while (IsAlpha(str[i])) {
+      ++i;
+    }
+    if (str[i] != '.' || !IsDigit(str[i + 1])) {
+      return false;
+    }
+    i += 2;
+    while (IsDigit(str[i])) {
+      ++i;
+    }
+  }
+  return true;  // Consumed everything in "str".
 }
 
 // Append "str" with some tweaks, iff "append" state is true.
@@ -309,7 +356,7 @@ static bool EnterNestedName(State *state) {
 }
 
 // This function is used for handling nested names.
-static bool LeaveNestedName(State *state, int prev_value) {
+static bool LeaveNestedName(State *state, short prev_value) {
   state->nest_level = prev_value;
   return true;
 }
@@ -349,11 +396,11 @@ static void MaybeCancelLastSeparator(State *state) {
   }
 }
 
-// Returns true if identifier pointed by "mangled_cur" is anonymous
-// namespace.
-static bool IdentifierIsAnonymousNamespace(State *state) {
-  const char anon_prefix[] = "_GLOBAL__N_";
-  return (state->number > sizeof(anon_prefix) - 1 &&  // Should be longer.
+// Returns true if the identifier of the given length pointed to by
+// "mangled_cur" is anonymous namespace.
+static bool IdentifierIsAnonymousNamespace(State *state, int length) {
+  static const char anon_prefix[] = "_GLOBAL__N_";
+  return (length > (int)sizeof(anon_prefix) - 1 &&  // Should be longer.
           StrPrefix(state->mangled_cur, anon_prefix));
 }
 
@@ -368,10 +415,10 @@ static bool ParsePrefix(State *state);
 static bool ParseUnqualifiedName(State *state);
 static bool ParseSourceName(State *state);
 static bool ParseLocalSourceName(State *state);
-static bool ParseNumber(State *state);
+static bool ParseNumber(State *state, int *number_out);
 static bool ParseFloatNumber(State *state);
 static bool ParseSeqId(State *state);
-static bool ParseIdentifier(State *state);
+static bool ParseIdentifier(State *state, int length);
 static bool ParseOperatorName(State *state);
 static bool ParseSpecialName(State *state);
 static bool ParseCallOffset(State *state);
@@ -428,17 +475,7 @@ static bool ParseSubstitution(State *state);
 
 // <mangled-name> ::= _Z <encoding>
 static bool ParseMangledName(State *state) {
-  if (ParseTwoChar(state, "_Z") && ParseEncoding(state)) {
-    // Append trailing version suffix if any.
-    // ex. _Z3foo@@GLIBCXX_3.4
-    if (state->mangled_cur < state->mangled_end &&
-        state->mangled_cur[0] == '@') {
-      MaybeAppend(state, state->mangled_cur);
-      state->mangled_cur = state->mangled_end;
-    }
-    return true;
-  }
-  return false;
+  return ParseTwoCharToken(state, "_Z") && ParseEncoding(state);
 }
 
 // <encoding> ::= <(function) name> <bare-function-type>
@@ -488,7 +525,7 @@ static bool ParseUnscopedName(State *state) {
   }
 
   State copy = *state;
-  if (ParseTwoChar(state, "St") &&
+  if (ParseTwoCharToken(state, "St") &&
       MaybeAppend(state, "std::") &&
       ParseUnqualifiedName(state)) {
     return true;
@@ -507,12 +544,12 @@ static bool ParseUnscopedTemplateName(State *state) {
 //               ::= N [<CV-qualifiers>] <template-prefix> <template-args> E
 static bool ParseNestedName(State *state) {
   State copy = *state;
-  if (ParseChar(state, 'N') &&
+  if (ParseOneCharToken(state, 'N') &&
       EnterNestedName(state) &&
       Optional(ParseCVQualifiers(state)) &&
       ParsePrefix(state) &&
       LeaveNestedName(state, copy.nest_level) &&
-      ParseChar(state, 'E')) {
+      ParseOneCharToken(state, 'E')) {
     return true;
   }
   *state = copy;
@@ -565,7 +602,8 @@ static bool ParseUnqualifiedName(State *state) {
 // <source-name> ::= <positive length number> <identifier>
 static bool ParseSourceName(State *state) {
   State copy = *state;
-  if (ParseNumber(state) && ParseIdentifier(state)) {
+  int length = -1;
+  if (ParseNumber(state, &length) && ParseIdentifier(state, length)) {
     return true;
   }
   *state = copy;
@@ -579,7 +617,7 @@ static bool ParseSourceName(State *state) {
 //   http://gcc.gnu.org/viewcvs?view=rev&revision=124467
 static bool ParseLocalSourceName(State *state) {
   State copy = *state;
-  if (ParseChar(state, 'L') && ParseSourceName(state) &&
+  if (ParseOneCharToken(state, 'L') && ParseSourceName(state) &&
       Optional(ParseDiscriminator(state))) {
     return true;
   }
@@ -588,15 +626,17 @@ static bool ParseLocalSourceName(State *state) {
 }
 
 // <number> ::= [n] <non-negative decimal integer>
-static bool ParseNumber(State *state) {
+// If "number_out" is non-null, then *number_out is set to the value of the
+// parsed number on success.
+static bool ParseNumber(State *state, int *number_out) {
   int sign = 1;
-  if (ParseChar(state, 'n')) {
+  if (ParseOneCharToken(state, 'n')) {
     sign = -1;
   }
   const char *p = state->mangled_cur;
   int number = 0;
-  for (;p < state->mangled_end; ++p) {
-    if ((*p >= '0' && *p <= '9')) {
+  for (;*p != '\0'; ++p) {
+    if (IsDigit(*p)) {
       number = number * 10 + (*p - '0');
     } else {
       break;
@@ -604,7 +644,9 @@ static bool ParseNumber(State *state) {
   }
   if (p != state->mangled_cur) {  // Conversion succeeded.
     state->mangled_cur = p;
-    state->number = number * sign;
+    if (number_out != NULL) {
+      *number_out = number * sign;
+    }
     return true;
   }
   return false;
@@ -614,19 +656,13 @@ static bool ParseNumber(State *state) {
 // hexadecimal string.
 static bool ParseFloatNumber(State *state) {
   const char *p = state->mangled_cur;
-  int number = 0;
-  for (;p < state->mangled_end; ++p) {
-    if ((*p >= '0' && *p <= '9')) {
-      number = number * 16 + (*p - '0');
-    } else if (*p >= 'a' && *p <= 'f') {
-      number = number * 16 + (*p - 'a' + 10);
-    } else {
+  for (;*p != '\0'; ++p) {
+    if (!IsDigit(*p) && !(*p >= 'a' && *p <= 'f')) {
       break;
     }
   }
   if (p != state->mangled_cur) {  // Conversion succeeded.
     state->mangled_cur = p;
-    state->number = number;
     return true;
   }
   return false;
@@ -636,37 +672,30 @@ static bool ParseFloatNumber(State *state) {
 // using digits and upper case letters
 static bool ParseSeqId(State *state) {
   const char *p = state->mangled_cur;
-  int number = 0;
-  for (;p < state->mangled_end; ++p) {
-    if ((*p >= '0' && *p <= '9')) {
-      number = number * 36 + (*p - '0');
-    } else if (*p >= 'A' && *p <= 'Z') {
-      number = number * 36 + (*p - 'A' + 10);
-    } else {
+  for (;*p != '\0'; ++p) {
+    if (!IsDigit(*p) && !(*p >= 'A' && *p <= 'Z')) {
       break;
     }
   }
   if (p != state->mangled_cur) {  // Conversion succeeded.
     state->mangled_cur = p;
-    state->number = number;
     return true;
   }
   return false;
 }
 
-// <identifier> ::= <unqualified source code identifier>
-static bool ParseIdentifier(State *state) {
-  if (state->number == -1 ||
-      RemainingLength(state) < state->number) {
+// <identifier> ::= <unqualified source code identifier> (of given length)
+static bool ParseIdentifier(State *state, int length) {
+  if (length == -1 ||
+      !AtLeastNumCharsRemaining(state->mangled_cur, length)) {
     return false;
   }
-  if (IdentifierIsAnonymousNamespace(state)) {
+  if (IdentifierIsAnonymousNamespace(state, length)) {
     MaybeAppend(state, "(anonymous namespace)");
   } else {
-    MaybeAppendWithLength(state, state->mangled_cur, state->number);
+    MaybeAppendWithLength(state, state->mangled_cur, length);
   }
-  state->mangled_cur += state->number;
-  state->number = -1;  // Reset the number.
+  state->mangled_cur += length;
   return true;
 }
 
@@ -674,12 +703,12 @@ static bool ParseIdentifier(State *state) {
 //                 ::= cv <type>  # (cast)
 //                 ::= v  <digit> <source-name> # vendor extended operator
 static bool ParseOperatorName(State *state) {
-  if (RemainingLength(state) < 2) {
+  if (!AtLeastNumCharsRemaining(state->mangled_cur, 2)) {
     return false;
   }
   // First check with "cv" (cast) case.
   State copy = *state;
-  if (ParseTwoChar(state, "cv") &&
+  if (ParseTwoCharToken(state, "cv") &&
       MaybeAppend(state, "operator ") &&
       EnterNestedName(state) &&
       ParseType(state) &&
@@ -689,7 +718,7 @@ static bool ParseOperatorName(State *state) {
   *state = copy;
 
   // Then vendor extended operators.
-  if (ParseChar(state, 'v') && ParseCharClass(state, "0123456789") &&
+  if (ParseOneCharToken(state, 'v') && ParseCharClass(state, "0123456789") &&
       ParseSourceName(state)) {
     return true;
   }
@@ -738,34 +767,34 @@ static bool ParseOperatorName(State *state) {
 // stack traces.  The are special data.
 static bool ParseSpecialName(State *state) {
   State copy = *state;
-  if (ParseChar(state, 'T') &&
+  if (ParseOneCharToken(state, 'T') &&
       ParseCharClass(state, "VTIS") &&
       ParseType(state)) {
     return true;
   }
   *state = copy;
 
-  if (ParseTwoChar(state, "Tc") && ParseCallOffset(state) &&
+  if (ParseTwoCharToken(state, "Tc") && ParseCallOffset(state) &&
       ParseCallOffset(state) && ParseEncoding(state)) {
     return true;
   }
   *state = copy;
 
-  if (ParseTwoChar(state, "GV") &&
+  if (ParseTwoCharToken(state, "GV") &&
       ParseName(state)) {
     return true;
   }
   *state = copy;
 
-  if (ParseChar(state, 'T') && ParseCallOffset(state) &&
+  if (ParseOneCharToken(state, 'T') && ParseCallOffset(state) &&
       ParseEncoding(state)) {
     return true;
   }
   *state = copy;
 
   // G++ extensions
-  if (ParseTwoChar(state, "TC") && ParseType(state) &&
-      ParseNumber(state) && ParseChar(state, '_') &&
+  if (ParseTwoCharToken(state, "TC") && ParseType(state) &&
+      ParseNumber(state, NULL) && ParseOneCharToken(state, '_') &&
       DisableAppend(state) &&
       ParseType(state)) {
     RestoreAppend(state, copy.append);
@@ -773,23 +802,23 @@ static bool ParseSpecialName(State *state) {
   }
   *state = copy;
 
-  if (ParseChar(state, 'T') && ParseCharClass(state, "FJ") &&
+  if (ParseOneCharToken(state, 'T') && ParseCharClass(state, "FJ") &&
       ParseType(state)) {
     return true;
   }
   *state = copy;
 
-  if (ParseTwoChar(state, "GR") && ParseName(state)) {
+  if (ParseTwoCharToken(state, "GR") && ParseName(state)) {
     return true;
   }
   *state = copy;
 
-  if (ParseTwoChar(state, "GA") && ParseEncoding(state)) {
+  if (ParseTwoCharToken(state, "GA") && ParseEncoding(state)) {
     return true;
   }
   *state = copy;
 
-  if (ParseChar(state, 'T') && ParseCharClass(state, "hv") &&
+  if (ParseOneCharToken(state, 'T') && ParseCharClass(state, "hv") &&
       ParseCallOffset(state) && ParseEncoding(state)) {
     return true;
   }
@@ -801,14 +830,14 @@ static bool ParseSpecialName(State *state) {
 //               ::= v <v-offset> _
 static bool ParseCallOffset(State *state) {
   State copy = *state;
-  if (ParseChar(state, 'h') &&
-      ParseNVOffset(state) && ParseChar(state, '_')) {
+  if (ParseOneCharToken(state, 'h') &&
+      ParseNVOffset(state) && ParseOneCharToken(state, '_')) {
     return true;
   }
   *state = copy;
 
-  if (ParseChar(state, 'v') &&
-      ParseVOffset(state) && ParseChar(state, '_')) {
+  if (ParseOneCharToken(state, 'v') &&
+      ParseVOffset(state) && ParseOneCharToken(state, '_')) {
     return true;
   }
   *state = copy;
@@ -818,14 +847,14 @@ static bool ParseCallOffset(State *state) {
 
 // <nv-offset> ::= <(offset) number>
 static bool ParseNVOffset(State *state) {
-  return ParseNumber(state);
+  return ParseNumber(state, NULL);
 }
 
 // <v-offset>  ::= <(offset) number> _ <(virtual offset) number>
 static bool ParseVOffset(State *state) {
   State copy = *state;
-  if (ParseNumber(state) && ParseChar(state, '_') &&
-      ParseNumber(state)) {
+  if (ParseNumber(state, NULL) && ParseOneCharToken(state, '_') &&
+      ParseNumber(state, NULL)) {
     return true;
   }
   *state = copy;
@@ -836,7 +865,7 @@ static bool ParseVOffset(State *state) {
 //                  ::= D0 | D1 | D2
 static bool ParseCtorDtorName(State *state) {
   State copy = *state;
-  if (ParseChar(state, 'C') &&
+  if (ParseOneCharToken(state, 'C') &&
       ParseCharClass(state, "123")) {
     const char * const prev_name = state->prev_name;
     const int prev_name_length = state->prev_name_length;
@@ -845,7 +874,7 @@ static bool ParseCtorDtorName(State *state) {
   }
   *state = copy;
 
-  if (ParseChar(state, 'D') &&
+  if (ParseOneCharToken(state, 'D') &&
       ParseCharClass(state, "012")) {
     const char * const prev_name = state->prev_name;
     const int prev_name_length = state->prev_name_length;
@@ -858,11 +887,12 @@ static bool ParseCtorDtorName(State *state) {
 }
 
 // <type> ::= <CV-qualifiers> <type>
-//        ::= P <type>
-//        ::= R <type>
-//        ::= C <type>
-//        ::= G <type>
-//        ::= U <source-name> <type>
+//        ::= P <type>   # pointer-to
+//        ::= R <type>   # reference-to
+//        ::= O <type>   # rvalue reference-to (C++0x)
+//        ::= C <type>   # complex pair (C 2000)
+//        ::= G <type>   # imaginary (C 2000)
+//        ::= U <source-name> <type>  # vendor extended type qualifier
 //        ::= <builtin-type>
 //        ::= <function-type>
 //        ::= <class-enum-type>
@@ -871,6 +901,11 @@ static bool ParseCtorDtorName(State *state) {
 //        ::= <template-template-param> <template-args>
 //        ::= <template-param>
 //        ::= <substitution>
+//        ::= Dp <type>          # pack expansion of (C++0x)
+//        ::= Dt <expression> E  # decltype of an id-expression or class
+//                               # member access (C++0x)
+//        ::= DT <expression> E  # decltype of an expression (C++0x)
+//
 static bool ParseType(State *state) {
   // We should check CV-qualifers, and PRGC things first.
   State copy = *state;
@@ -879,12 +914,23 @@ static bool ParseType(State *state) {
   }
   *state = copy;
 
-  if (ParseCharClass(state, "PRCG") && ParseType(state)) {
+  if (ParseCharClass(state, "OPRCG") && ParseType(state)) {
+    return true;
+  }
+  *state = copy;
+
+  if (ParseTwoCharToken(state, "Dp") && ParseType(state)) {
     return true;
   }
   *state = copy;
 
-  if (ParseChar(state, 'U') && ParseSourceName(state) &&
+  if (ParseOneCharToken(state, 'D') && ParseCharClass(state, "tT") &&
+      ParseExpression(state) && ParseOneCharToken(state, 'E')) {
+    return true;
+  }
+  *state = copy;
+
+  if (ParseOneCharToken(state, 'U') && ParseSourceName(state) &&
       ParseType(state)) {
     return true;
   }
@@ -918,9 +964,9 @@ static bool ParseType(State *state) {
 // ParseType().
 static bool ParseCVQualifiers(State *state) {
   int num_cv_qualifiers = 0;
-  num_cv_qualifiers += ParseChar(state, 'r');
-  num_cv_qualifiers += ParseChar(state, 'V');
-  num_cv_qualifiers += ParseChar(state, 'K');
+  num_cv_qualifiers += ParseOneCharToken(state, 'r');
+  num_cv_qualifiers += ParseOneCharToken(state, 'V');
+  num_cv_qualifiers += ParseOneCharToken(state, 'K');
   return num_cv_qualifiers > 0;
 }
 
@@ -937,7 +983,7 @@ static bool ParseBuiltinType(State *state) {
   }
 
   State copy = *state;
-  if (ParseChar(state, 'u') && ParseSourceName(state)) {
+  if (ParseOneCharToken(state, 'u') && ParseSourceName(state)) {
     return true;
   }
   *state = copy;
@@ -947,8 +993,9 @@ static bool ParseBuiltinType(State *state) {
 // <function-type> ::= F [Y] <bare-function-type> E
 static bool ParseFunctionType(State *state) {
   State copy = *state;
-  if (ParseChar(state, 'F') && Optional(ParseChar(state, 'Y')) &&
-      ParseBareFunctionType(state) && ParseChar(state, 'E')) {
+  if (ParseOneCharToken(state, 'F') &&
+      Optional(ParseOneCharToken(state, 'Y')) &&
+      ParseBareFunctionType(state) && ParseOneCharToken(state, 'E')) {
     return true;
   }
   *state = copy;
@@ -977,14 +1024,14 @@ static bool ParseClassEnumType(State *state) {
 //              ::= A [<(dimension) expression>] _ <(element) type>
 static bool ParseArrayType(State *state) {
   State copy = *state;
-  if (ParseChar(state, 'A') && ParseNumber(state) &&
-      ParseChar(state, '_') && ParseType(state)) {
+  if (ParseOneCharToken(state, 'A') && ParseNumber(state, NULL) &&
+      ParseOneCharToken(state, '_') && ParseType(state)) {
     return true;
   }
   *state = copy;
 
-  if (ParseChar(state, 'A') && Optional(ParseExpression(state)) &&
-      ParseChar(state, '_') && ParseType(state)) {
+  if (ParseOneCharToken(state, 'A') && Optional(ParseExpression(state)) &&
+      ParseOneCharToken(state, '_') && ParseType(state)) {
     return true;
   }
   *state = copy;
@@ -994,7 +1041,7 @@ static bool ParseArrayType(State *state) {
 // <pointer-to-member-type> ::= M <(class) type> <(member) type>
 static bool ParsePointerToMemberType(State *state) {
   State copy = *state;
-  if (ParseChar(state, 'M') && ParseType(state) &&
+  if (ParseOneCharToken(state, 'M') && ParseType(state) &&
       ParseType(state)) {
     return true;
   }
@@ -1005,14 +1052,14 @@ static bool ParsePointerToMemberType(State *state) {
 // <template-param> ::= T_
 //                  ::= T <parameter-2 non-negative number> _
 static bool ParseTemplateParam(State *state) {
-  if (ParseTwoChar(state, "T_")) {
+  if (ParseTwoCharToken(state, "T_")) {
     MaybeAppend(state, "?");  // We don't support template substitutions.
     return true;
   }
 
   State copy = *state;
-  if (ParseChar(state, 'T') && ParseNumber(state) &&
-      ParseChar(state, '_')) {
+  if (ParseOneCharToken(state, 'T') && ParseNumber(state, NULL) &&
+      ParseOneCharToken(state, '_')) {
     MaybeAppend(state, "?");  // We don't support template substitutions.
     return true;
   }
@@ -1032,9 +1079,9 @@ static bool ParseTemplateTemplateParam(State *state) {
 static bool ParseTemplateArgs(State *state) {
   State copy = *state;
   DisableAppend(state);
-  if (ParseChar(state, 'I') &&
+  if (ParseOneCharToken(state, 'I') &&
       OneOrMore(ParseTemplateArg, state) &&
-      ParseChar(state, 'E')) {
+      ParseOneCharToken(state, 'E')) {
     RestoreAppend(state, copy.append);
     MaybeAppend(state, "<>");
     return true;
@@ -1045,16 +1092,25 @@ static bool ParseTemplateArgs(State *state) {
 
 // <template-arg>  ::= <type>
 //                 ::= <expr-primary>
+//                 ::= I <template-arg>* E        # argument pack
 //                 ::= X <expression> E
 static bool ParseTemplateArg(State *state) {
+  State copy = *state;
+  if (ParseOneCharToken(state, 'I') &&
+      ZeroOrMore(ParseTemplateArg, state) &&
+      ParseOneCharToken(state, 'E')) {
+    return true;
+  }
+  *state = copy;
+
   if (ParseType(state) ||
       ParseExprPrimary(state)) {
     return true;
   }
+  *state = copy;
 
-  State copy = *state;
-  if (ParseChar(state, 'X') && ParseExpression(state) &&
-      ParseChar(state, 'E')) {
+  if (ParseOneCharToken(state, 'X') && ParseExpression(state) &&
+      ParseOneCharToken(state, 'E')) {
     return true;
   }
   *state = copy;
@@ -1097,19 +1153,19 @@ static bool ParseExpression(State *state) {
   }
   *state = copy;
 
-  if (ParseTwoChar(state, "st") && ParseType(state)) {
+  if (ParseTwoCharToken(state, "st") && ParseType(state)) {
     return true;
   }
   *state = copy;
 
-  if (ParseTwoChar(state, "sr") && ParseType(state) &&
+  if (ParseTwoCharToken(state, "sr") && ParseType(state) &&
       ParseUnqualifiedName(state) &&
       ParseTemplateArgs(state)) {
     return true;
   }
   *state = copy;
 
-  if (ParseTwoChar(state, "sr") && ParseType(state) &&
+  if (ParseTwoCharToken(state, "sr") && ParseType(state) &&
       ParseUnqualifiedName(state)) {
     return true;
   }
@@ -1124,28 +1180,28 @@ static bool ParseExpression(State *state) {
 //                ::= LZ <encoding> E
 static bool ParseExprPrimary(State *state) {
   State copy = *state;
-  if (ParseChar(state, 'L') && ParseType(state) &&
-      ParseNumber(state) &&
-      ParseChar(state, 'E')) {
+  if (ParseOneCharToken(state, 'L') && ParseType(state) &&
+      ParseNumber(state, NULL) &&
+      ParseOneCharToken(state, 'E')) {
     return true;
   }
   *state = copy;
 
-  if (ParseChar(state, 'L') && ParseType(state) &&
+  if (ParseOneCharToken(state, 'L') && ParseType(state) &&
       ParseFloatNumber(state) &&
-      ParseChar(state, 'E')) {
+      ParseOneCharToken(state, 'E')) {
     return true;
   }
   *state = copy;
 
-  if (ParseChar(state, 'L') && ParseMangledName(state) &&
-      ParseChar(state, 'E')) {
+  if (ParseOneCharToken(state, 'L') && ParseMangledName(state) &&
+      ParseOneCharToken(state, 'E')) {
     return true;
   }
   *state = copy;
 
-  if (ParseTwoChar(state, "LZ") && ParseEncoding(state) &&
-      ParseChar(state, 'E')) {
+  if (ParseTwoCharToken(state, "LZ") && ParseEncoding(state) &&
+      ParseOneCharToken(state, 'E')) {
     return true;
   }
   *state = copy;
@@ -1158,15 +1214,15 @@ static bool ParseExprPrimary(State *state) {
 //              := Z <(function) encoding> E s [<discriminator>]
 static bool ParseLocalName(State *state) {
   State copy = *state;
-  if (ParseChar(state, 'Z') && ParseEncoding(state) &&
-      ParseChar(state, 'E') && MaybeAppend(state, "::") &&
+  if (ParseOneCharToken(state, 'Z') && ParseEncoding(state) &&
+      ParseOneCharToken(state, 'E') && MaybeAppend(state, "::") &&
       ParseName(state) && Optional(ParseDiscriminator(state))) {
     return true;
   }
   *state = copy;
 
-  if (ParseChar(state, 'Z') && ParseEncoding(state) &&
-      ParseTwoChar(state, "Es") && Optional(ParseDiscriminator(state))) {
+  if (ParseOneCharToken(state, 'Z') && ParseEncoding(state) &&
+      ParseTwoCharToken(state, "Es") && Optional(ParseDiscriminator(state))) {
     return true;
   }
   *state = copy;
@@ -1176,7 +1232,7 @@ static bool ParseLocalName(State *state) {
 // <discriminator> := _ <(non-negative) number>
 static bool ParseDiscriminator(State *state) {
   State copy = *state;
-  if (ParseChar(state, '_') && ParseNumber(state)) {
+  if (ParseOneCharToken(state, '_') && ParseNumber(state, NULL)) {
     return true;
   }
   *state = copy;
@@ -1187,21 +1243,21 @@ static bool ParseDiscriminator(State *state) {
 //                ::= S <seq-id> _
 //                ::= St, etc.
 static bool ParseSubstitution(State *state) {
-  if (ParseTwoChar(state, "S_")) {
+  if (ParseTwoCharToken(state, "S_")) {
     MaybeAppend(state, "?");  // We don't support substitutions.
     return true;
   }
 
   State copy = *state;
-  if (ParseChar(state, 'S') && ParseSeqId(state) &&
-      ParseChar(state, '_')) {
+  if (ParseOneCharToken(state, 'S') && ParseSeqId(state) &&
+      ParseOneCharToken(state, '_')) {
     MaybeAppend(state, "?");  // We don't support substitutions.
     return true;
   }
   *state = copy;
 
   // Expand abbreviations like "St" => "std".
-  if (ParseChar(state, 'S')) {
+  if (ParseOneCharToken(state, 'S')) {
     const AbbrevPair *p;
     for (p = kSubstitutionList; p->abbrev != NULL; ++p) {
       if (state->mangled_cur[0] == p->abbrev[1]) {
@@ -1210,7 +1266,7 @@ static bool ParseSubstitution(State *state) {
           MaybeAppend(state, "::");
           MaybeAppend(state, p->real_name);
         }
-        state->mangled_cur += 1;
+        ++state->mangled_cur;
         return true;
       }
     }
@@ -1219,13 +1275,33 @@ static bool ParseSubstitution(State *state) {
   return false;
 }
 
+// Parse <mangled-name>, optionally followed by either a function-clone suffix
+// or version suffix.  Returns true only if all of "mangled_cur" was consumed.
+static bool ParseTopLevelMangledName(State *state) {
+  if (ParseMangledName(state)) {
+    if (state->mangled_cur[0] != '\0') {
+      // Drop trailing function clone suffix, if any.
+      if (IsFunctionCloneSuffix(state->mangled_cur)) {
+        return true;
+      }
+      // Append trailing version suffix if any.
+      // ex. _Z3foo@@GLIBCXX_3.4
+      if (state->mangled_cur[0] == '@') {
+        MaybeAppend(state, state->mangled_cur);
+        return true;
+      }
+      return false;  // Unconsumed suffix.
+    }
+    return true;
+  }
+  return false;
+}
+
 // The demangler entry point.
 bool Demangle(const char *mangled, char *out, int out_size) {
   State state;
   InitState(&state, mangled, out, out_size);
-  return (ParseMangledName(&state) &&
-          state.overflowed == false &&
-          RemainingLength(&state) == 0);
+  return ParseTopLevelMangledName(&state) && !state.overflowed;
 }
 
 _END_GOOGLE_NAMESPACE_
diff --git a/extern/libmv/third_party/glog/src/glog/log_severity.h b/extern/libmv/third_party/glog/src/glog/log_severity.h
index 17805fb..99945a4 100644
--- a/extern/libmv/third_party/glog/src/glog/log_severity.h
+++ b/extern/libmv/third_party/glog/src/glog/log_severity.h
@@ -44,7 +44,15 @@
 // you ever need to change their values or add a new severity.
 typedef int LogSeverity;
 
-const int INFO = 0, WARNING = 1, ERROR = 2, FATAL = 3, NUM_SEVERITIES = 4;
+const int GLOG_INFO = 0, GLOG_WARNING = 1, GLOG_ERROR = 2, GLOG_FATAL = 3,
+  NUM_SEVERITIES = 4;
+#ifndef GLOG_NO_ABBREVIATED_SEVERITIES
+# ifdef ERROR
+#  error ERROR macro is defined. Define GLOG_NO_ABBREVIATED_SEVERITIES before including logging.h. See the document for detail.
+# endif
+const int INFO = GLOG_INFO, WARNING = GLOG_WARNING,
+  ERROR = GLOG_ERROR, FATAL = GLOG_FATAL;
+#endif
 
 // DFATAL is FATAL in debug mode, ERROR in normal mode
 #ifdef NDEBUG
diff --git a/extern/libmv/third_party/glog/src/glog/logging.h b/extern/libmv/third_party/glog/src/glog/logging.h
index a58d478..005649c 100644
--- a/extern/libmv/third_party/glog/src/glog/logging.h
+++ b/extern/libmv/third_party/glog/src/glog/logging.h
@@ -33,7 +33,6 @@
 // Pretty much everybody needs to #include this file so that they can
 // log various happenings.
 //
-
 #ifndef _LOGGING_H_
 #define _LOGGING_H_
 
@@ -80,7 +79,7 @@
 #endif
 
 #if 1
-#include "third_party/gflags/gflags.h"
+#include "third_party/gflags/gflags/gflags.h"
 #endif
 
 namespace google {
@@ -153,21 +152,21 @@ typedef unsigned __int64 uint64;
 // You can also do occasional logging (log every n'th occurrence of an
 // event):
 //
-//   LOG_EVERY_N(INFO, 10) << "Got the " << COUNTER << "th cookie";
+//   LOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie";
 //
 // The above will cause log messages to be output on the 1st, 11th, 21st, ...
-// times it is executed.  Note that the special COUNTER value is used to
-// identify which repetition is happening.
+// times it is executed.  Note that the special google::COUNTER value is used
+// to identify which repetition is happening.
 //
 // You can also do occasional conditional logging (log every n'th
 // occurrence of an event, when condition is satisfied):
 //
-//   LOG_IF_EVERY_N(INFO, (size > 1024), 10) << "Got the " << COUNTER
+//   LOG_IF_EVERY_N(INFO, (size > 1024), 10) << "Got the " << google::COUNTER
 //                                           << "th big cookie";
 //
 // You can log messages the first N times your code executes a line. E.g.
 //
-//   LOG_FIRST_N(INFO, 20) << "Got the " << COUNTER << "th cookie";
+//   LOG_FIRST_N(INFO, 20) << "Got the " << google::COUNTER << "th cookie";
 //
 // Outputs log messages for the first 20 times it is executed.
 //
@@ -184,7 +183,7 @@ typedef unsigned __int64 uint64;
 //
 //   DLOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
 //
-//   DLOG_EVERY_N(INFO, 10) << "Got the " << COUNTER << "th cookie";
+//   DLOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie";
 //
 // All "debug mode" logging is compiled away to nothing for non-debug mode
 // compiles.
@@ -228,11 +227,11 @@ typedef unsigned __int64 uint64;
 //         "program with --v=1 or more";
 //   VLOG_EVERY_N(1, 10)
 //      << "I'm printed every 10th occurrence, and when you run the program "
-//         "with --v=1 or more. Present occurence is " << COUNTER;
+//         "with --v=1 or more. Present occurence is " << google::COUNTER;
 //   VLOG_IF_EVERY_N(1, (size > 1024), 10)
 //      << "I'm printed on every 10th occurence of case when size is more "
 //         " than 1024, when you run the program with --v=1 or more. ";
-//         "Present occurence is " << COUNTER;
+//         "Present occurence is " << google::COUNTER;
 //
 // The supported severity levels for macros that allow you to specify one
 // are (in increasing order of severity) INFO, WARNING, ERROR, and FATAL.
@@ -369,7 +368,7 @@ DECLARE_bool(stop_logging_if_full_disk);
 #define COMPACT_GOOGLE_LOG_INFO google::LogMessage( \
       __FILE__, __LINE__)
 #define LOG_TO_STRING_INFO(message) google::LogMessage( \
-      __FILE__, __LINE__, google::INFO, message)
+      __FILE__, __LINE__, google::GLOG_INFO, message)
 #else
 #define COMPACT_GOOGLE_LOG_INFO google::NullStream()
 #define LOG_TO_STRING_INFO(message) google::NullStream()
@@ -377,9 +376,9 @@ DECLARE_bool(stop_logging_if_full_disk);
 
 #if GOOGLE_STRIP_LOG <= 1
 #define COMPACT_GOOGLE_LOG_WARNING google::LogMessage( \
-      __FILE__, __LINE__, google::WARNING)
+      __FILE__, __LINE__, google::GLOG_WARNING)
 #define LOG_TO_STRING_WARNING(message) google::LogMessage( \
-      __FILE__, __LINE__, google::WARNING, message)
+      __FILE__, __LINE__, google::GLOG_WARNING, message)
 #else
 #define COMPACT_GOOGLE_LOG_WARNING google::NullStream()
 #define LOG_TO_STRING_WARNING(message) google::NullStream()
@@ -387,9 +386,9 @@ DECLARE_bool(stop_logging_if_full_disk);
 
 #if GOOGLE_STRIP_LOG <= 2
 #define COMPACT_GOOGLE_LOG_ERROR google::LogMessage( \
-      __FILE__, __LINE__, google::ERROR)
+      __FILE__, __LINE__, google::GLOG_ERROR)
 #define LOG_TO_STRING_ERROR(message) google::LogMessage( \
-      __FILE__, __LINE__, google::ERROR, message)
+      __FILE__, __LINE__, google::GLOG_ERROR, message)
 #else
 #define COMPACT_GOOGLE_LOG_ERROR google::NullStream()
 #define LOG_TO_STRING_ERROR(message) google::NullStream()
@@ -399,7 +398,7 @@ DECLARE_bool(stop_logging_if_full_disk);
 #define COMPACT_GOOGLE_LOG_FATAL google::LogMessageFatal( \
       __FILE__, __LINE__)
 #define LOG_TO_STRING_FATAL(message) google::LogMessage( \
-      __FILE__, __LINE__, google::FATAL, message)
+      __FILE__, __LINE__, google::GLOG_FATAL, message)
 #else
 #define COMPACT_GOOGLE_LOG_FATAL google::NullStreamFatal()
 #define LOG_TO_STRING_FATAL(message) google::NullStreamFatal()
@@ -411,32 +410,32 @@ DECLARE_bool(stop_logging_if_full_disk);
 #define COMPACT_GOOGLE_LOG_DFATAL COMPACT_GOOGLE_LOG_ERROR
 #elif GOOGLE_STRIP_LOG <= 3
 #define COMPACT_GOOGLE_LOG_DFATAL google::LogMessage( \
-      __FILE__, __LINE__, google::FATAL)
+      __FILE__, __LINE__, google::GLOG_FATAL)
 #else
 #define COMPACT_GOOGLE_LOG_DFATAL google::NullStreamFatal()
 #endif
 
-#define GOOGLE_LOG_INFO(counter) google::LogMessage(__FILE__, __LINE__, google::INFO, counter, &google::LogMessage::SendToLog)
+#define GOOGLE_LOG_INFO(counter) google::LogMessage(__FILE__, __LINE__, google::GLOG_INFO, counter, &google::LogMessage::SendToLog)
 #define SYSLOG_INFO(counter) \
-  google::LogMessage(__FILE__, __LINE__, google::INFO, counter, \
+  google::LogMessage(__FILE__, __LINE__, google::GLOG_INFO, counter, \
   &google::LogMessage::SendToSyslogAndLog)
 #define GOOGLE_LOG_WARNING(counter)  \
-  google::LogMessage(__FILE__, __LINE__, google::WARNING, counter, \
+  google::LogMessage(__FILE__, __LINE__, google::GLOG_WARNING, counter, \
   &google::LogMessage::SendToLog)
 #define SYSLOG_WARNING(counter)  \
-  google::LogMessage(__FILE__, __LINE__, google::WARNING, counter, \
+  google::LogMessage(__FILE__, __LINE__, google::GLOG_WARNING, counter, \
   &google::LogMessage::SendToSyslogAndLog)
 #define GOOGLE_LOG_ERROR(counter)  \
-  google::LogMessage(__FILE__, __LINE__, google::ERROR, counter, \
+  google::LogMessage(__FILE__, __LINE__, google::GLOG_ERROR, counter, \
   &google::LogMessage::SendToLog)
 #define SYSLOG_ERROR(counter)  \
-  google::LogMessage(__FILE__, __LINE__, google::ERROR, counter, \
+  google::LogMessage(__FILE__, __LINE__, google::GLOG_ERROR, counter, \
   &google::LogMessage::SendToSyslogAndLog)
 #define GOOGLE_LOG_FATAL(counter) \
-  google::LogMessage(__FILE__, __LINE__, google::FATAL, counter, \
+  google::LogMessage(__FILE__, __LINE__, google::GLOG_FATAL, counter, \
   &google::LogMessage::SendToLog)
 #define SYSLOG_FATAL(counter) \
-  google::LogMessage(__FILE__, __LINE__, google::FATAL, counter, \
+  google::LogMessage(__FILE__, __LINE__, google::GLOG_FATAL, counter, \
   &google::LogMessage::SendToSyslogAndLog)
 #define GOOGLE_LOG_DFATAL(counter) \
   google::LogMessage(__FILE__, __LINE__, google::DFATAL_LEVEL, counter, \
@@ -455,7 +454,7 @@ DECLARE_bool(stop_logging_if_full_disk);
                          FORMAT_MESSAGE_FROM_SYSTEM, \
                          0, result, 0, msg, 100, NULL); \
     if (message_length > 0) { \
-      google::LogMessage(__FILE__, __LINE__, ERROR, 0, \
+      google::LogMessage(__FILE__, __LINE__, google::GLOG_ERROR, 0, \
           &google::LogMessage::SendToLog).stream() << message; \
       LocalFree(message); \
     } \
@@ -502,12 +501,12 @@ class LogSink;  // defined below
 #define LOG_TO_SINK(sink, severity) \
   google::LogMessage(                                    \
       __FILE__, __LINE__,                                               \
-      google::severity,                                  \
+      google::GLOG_ ## severity,                         \
       static_cast<google::LogSink*>(sink), true).stream()
 #define LOG_TO_SINK_BUT_NOT_TO_LOGFILE(sink, severity)                  \
   google::LogMessage(                                    \
       __FILE__, __LINE__,                                               \
-      google::severity,                                  \
+      google::GLOG_ ## severity,                         \
       static_cast<google::LogSink*>(sink), false).stream()
 
 // If a non-NULL string pointer is given, we write this message to that string.
@@ -772,7 +771,7 @@ DECLARE_CHECK_STROP_IMPL(strcasecmp, false)
 
 #define GOOGLE_PLOG(severity, counter)  \
   google::ErrnoLogMessage( \
-      __FILE__, __LINE__, google::severity, counter, \
+      __FILE__, __LINE__, google::GLOG_ ## severity, counter, \
       &google::LogMessage::SendToLog)
 
 #define PLOG_IF(severity, condition) \
@@ -811,7 +810,7 @@ PLOG_IF(FATAL, GOOGLE_PREDICT_BRANCH_NOT_TAKEN((invocation) == -1))    \
   if (++LOG_OCCURRENCES_MOD_N > n) LOG_OCCURRENCES_MOD_N -= n; \
   if (LOG_OCCURRENCES_MOD_N == 1) \
     google::LogMessage( \
-        __FILE__, __LINE__, google::severity, LOG_OCCURRENCES, \
+        __FILE__, __LINE__, google::GLOG_ ## severity, LOG_OCCURRENCES, \
         &what_to_do).stream()
 
 #define SOME_KIND_OF_LOG_IF_EVERY_N(severity, condition, n, what_to_do) \
@@ -820,7 +819,7 @@ PLOG_IF(FATAL, GOOGLE_PREDICT_BRANCH_NOT_TAKEN((invocation) == -1))    \
   if (condition && \
       ((LOG_OCCURRENCES_MOD_N=(LOG_OCCURRENCES_MOD_N + 1) % n) == (1 % n))) \
     google::LogMessage( \
-        __FILE__, __LINE__, google::severity, LOG_OCCURRENCES, \
+        __FILE__, __LINE__, google::GLOG_ ## severity, LOG_OCCURRENCES, \
                  &what_to_do).stream()
 
 #define SOME_KIND_OF_PLOG_EVERY_N(severity, n, what_to_do) \
@@ -829,7 +828,7 @@ PLOG_IF(FATAL, GOOGLE_PREDICT_BRANCH_NOT_TAKEN((invocation) == -1))    \
   if (++LOG_OCCURRENCES_MOD_N > n) LOG_OCCURRENCES_MOD_N -= n; \
   if (LOG_OCCURRENCES_MOD_N == 1) \
     google::ErrnoLogMessage( \
-        __FILE__, __LINE__, google::severity, LOG_OCCURRENCES, \
+        __FILE__, __LINE__, google::GLOG_ ## severity, LOG_OCCURRENCES, \
         &what_to_do).stream()
 
 #define SOME_KIND_OF_LOG_FIRST_N(severity, n, what_to_do) \
@@ -838,7 +837,7 @@ PLOG_IF(FATAL, GOOGLE_PREDICT_BRANCH_NOT_TAKEN((invocation) == -1))    \
     ++LOG_OCCURRENCES; \
   if (LOG_OCCURRENCES <= n) \
     google::LogMessage( \
-        __FILE__, __LINE__, google::severity, LOG_OCCURRENCES, \
+        __FILE__, __LINE__, google::GLOG_ ## severity, LOG_OCCURRENCES, \
         &what_to_do).stream()
 
 namespace glog_internal_namespace_ {
@@ -852,7 +851,7 @@ struct CrashReason;
   typedef google::glog_internal_namespace_::CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
 
 #define LOG_EVERY_N(severity, n)                                        \
-  GOOGLE_GLOG_COMPILE_ASSERT(google::severity <          \
+  GOOGLE_GLOG_COMPILE_ASSERT(google::GLOG_ ## severity < \
                              google::NUM_SEVERITIES,     \
                              INVALID_REQUESTED_LOG_SEVERITY);           \
   SOME_KIND_OF_LOG_EVERY_N(severity, (n), google::LogMessage::SendToLog)
@@ -872,6 +871,27 @@ struct CrashReason;
 // We want the special COUNTER value available for LOG_EVERY_X()'ed messages
 enum PRIVATE_Counter {COUNTER};
 
+#ifdef GLOG_NO_ABBREVIATED_SEVERITIES
+// wingdi.h defines ERROR to be 0. When we call LOG(ERROR), it gets
+// substituted with 0, and it expands to COMPACT_GOOGLE_LOG_0. To allow us
+// to keep using this syntax, we define this macro to do the same thing
+// as COMPACT_GOOGLE_LOG_ERROR.
+#define COMPACT_GOOGLE_LOG_0 COMPACT_GOOGLE_LOG_ERROR
+#define SYSLOG_0 SYSLOG_ERROR
+#define LOG_TO_STRING_0 LOG_TO_STRING_ERROR
+// Needed for LOG_IS_ON(ERROR).
+const LogSeverity GLOG_0 = GLOG_ERROR;
+#else
+// Users may include windows.h after logging.h without
+// GLOG_NO_ABBREVIATED_SEVERITIES nor WIN32_LEAN_AND_MEAN.
+// For this case, we cannot detect if ERROR is defined before users
+// actually use ERROR. Let's make an undefined symbol to warn users.
+# define GLOG_ERROR_MSG ERROR_macro_is_defined_Define_GLOG_NO_ABBREVIATED_SEVERITIES_before_including_logging_h_See_the_document_for_detail
+# define COMPACT_GOOGLE_LOG_0 GLOG_ERROR_MSG
+# define SYSLOG_0 GLOG_ERROR_MSG
+# define LOG_TO_STRING_0 GLOG_ERROR_MSG
+# define GLOG_0 GLOG_ERROR_MSG
+#endif
 
 // Plus some debug-logging macros that get compiled to nothing for production
 
@@ -1016,14 +1036,14 @@ public:
 # pragma warning(default: 4275)
 #endif
   public:
-    LogStream(char *buf, int len, int ctr)
+    LogStream(char *buf, int len, int ctr_in)
       : ostrstream(buf, len),
-        ctr_(ctr) {
+        ctr_(ctr_in) {
       self_ = this;
     }
 
     int ctr() const { return ctr_; }
-    void set_ctr(int ctr) { ctr_ = ctr; }
+    void set_ctr(int ctr_in) { ctr_ = ctr_in; }
     LogStream* self() const { return self_; }
 
   private:
@@ -1465,7 +1485,7 @@ class GOOGLE_GLOG_DLL_DECL NullStream : public LogMessage::LogStream {
 // converted to LogStream and the message will be computed and then
 // quietly discarded.
 template<class T>
-inline NullStream& operator<<(NullStream &str, const T &value) { return str; }
+inline NullStream& operator<<(NullStream &str, const T &) { return str; }
 
 // Similar to NullStream, but aborts the program (without stack
 // trace), like LogMessageFatal.
diff --git a/extern/libmv/third_party/glog/src/glog/raw_logging.h b/extern/libmv/third_party/glog/src/glog/raw_logging.h
index 9e9b377..65278f6 100644
--- a/extern/libmv/third_party/glog/src/glog/raw_logging.h
+++ b/extern/libmv/third_party/glog/src/glog/raw_logging.h
@@ -68,7 +68,7 @@ namespace google {
 //   I0821 211317 file.cc:142] RAW: status is 20
 #define RAW_LOG(severity, ...) \
   do { \
-    switch (google::severity) {  \
+    switch (google::GLOG_ ## severity) {  \
       case 0: \
         RAW_LOG_INFO(__VA_ARGS__); \
         break; \
@@ -100,28 +100,28 @@ namespace google {
 #endif // STRIP_LOG == 0
 
 #if STRIP_LOG == 0
-#define RAW_LOG_INFO(...) google::RawLog__(google::INFO, \
+#define RAW_LOG_INFO(...) google::RawLog__(google::GLOG_INFO, \
                                    __FILE__, __LINE__, __VA_ARGS__)
 #else
 #define RAW_LOG_INFO(...) google::RawLogStub__(0, __VA_ARGS__)
 #endif // STRIP_LOG == 0
 
 #if STRIP_LOG <= 1
-#define RAW_LOG_WARNING(...) google::RawLog__(google::WARNING,   \
+#define RAW_LOG_WARNING(...) google::RawLog__(google::GLOG_WARNING,   \
                                       __FILE__, __LINE__, __VA_ARGS__)
 #else
 #define RAW_LOG_WARNING(...) google::RawLogStub__(0, __VA_ARGS__)
 #endif // STRIP_LOG <= 1
 
 #if STRIP_LOG <= 2
-#define RAW_LOG_ERROR(...) google::RawLog__(google::ERROR,       \
+#define RAW_LOG_ERROR(...) google::RawLog__(google::GLOG_ERROR,       \
                                     __FILE__, __LINE__, __VA_ARGS__)
 #else
 #define RAW_LOG_ERROR(...) google::RawLogStub__(0, __VA_ARGS__)
 #endif // STRIP_LOG <= 2
 
 #if STRIP_LOG <= 3
-#define RAW_LOG_FATAL(...) google::RawLog__(google::FATAL,       \
+#define RAW_LOG_FATAL(...) google::RawLog__(google::GLOG_FATAL,       \
                                     __FILE__, __LINE__, __VA_ARGS__)
 #else
 #define RAW_LOG_FATAL(...) \
@@ -162,7 +162,7 @@ namespace google {
 
 // Stub log function used to work around for unused variable warnings when
 // building with STRIP_LOG > 0.
-static inline void RawLogStub__(int ignored, ...) {
+static inline void RawLogStub__(int /* ignored */, ...) {
 }
 
 // Helper function to implement RAW_LOG and RAW_VLOG
diff --git a/extern/libmv/third_party/glog/src/logging.cc b/extern/libmv/third_party/glog/src/logging.cc
index 1bb3867..bf4d85b 100644
--- a/extern/libmv/third_party/glog/src/logging.cc
+++ b/extern/libmv/third_party/glog/src/logging.cc
@@ -111,7 +111,7 @@ _END_GOOGLE_NAMESPACE_
 // The default is ERROR instead of FATAL so that users can see problems
 // when they run a program without having to look in another file.
 DEFINE_int32(stderrthreshold,
-             GOOGLE_NAMESPACE::ERROR,
+             GOOGLE_NAMESPACE::GLOG_ERROR,
              "log messages at or above this level are copied to stderr in "
              "addition to logfiles.  This flag obsoletes --alsologtostderr.");
 
@@ -311,8 +311,10 @@ class LogDestination {
   static const int kNetworkBytes = 1400;
 
   static const string& hostname();
- private:
 
+  static void DeleteLogDestinations();
+
+ private:
   LogDestination(LogSeverity severity, const char* base_filename);
   ~LogDestination() { }
 
@@ -503,7 +505,7 @@ inline void LogDestination::SetEmailLogging(LogSeverity min_severity,
 static void WriteToStderr(const char* message, size_t len) {
   // Avoid using cerr from this module since we may get called during
   // exit code, and cerr may be partially or fully destroyed by then.
-  write(STDERR_FILENO, message, len);
+  fwrite(message, len, 1, stderr);
 }
 
 inline void LogDestination::MaybeLogToStderr(LogSeverity severity,
@@ -607,6 +609,13 @@ inline LogDestination* LogDestination::log_destination(LogSeverity severity) {
   return log_destinations_[severity];
 }
 
+void LogDestination::DeleteLogDestinations() {
+  for (int severity = 0; severity < NUM_SEVERITIES; ++severity) {
+    delete log_destinations_[severity];
+    log_destinations_[severity] = NULL;
+  }
+}
+
 namespace {
 
 LogFileObject::LogFileObject(LogSeverity severity,
@@ -719,14 +728,18 @@ bool LogFileObject::CreateLogfile(const char* time_pid_string) {
     // Make the symlink be relative (in the same dir) so that if the
     // entire log directory gets relocated the link is still valid.
     const char *linkdest = slash ? (slash + 1) : filename;
-    symlink(linkdest, linkpath.c_str());         // silently ignore failures
+    if (symlink(linkdest, linkpath.c_str()) != 0) {
+      // silently ignore failures
+    }
 
     // Make an additional link to the log file in a place specified by
     // FLAGS_log_link, if indicated
     if (!FLAGS_log_link.empty()) {
       linkpath = FLAGS_log_link + "/" + linkname;
       unlink(linkpath.c_str());                  // delete old one if it exists
-      symlink(filename, linkpath.c_str());       // silently ignore failures
+      if (symlink(filename, linkpath.c_str()) != 0) {
+        // silently ignore failures
+      }
     }
 #endif
   }
@@ -745,7 +758,8 @@ void LogFileObject::Write(bool force_flush,
     return;
   }
 
-  if (static_cast<int>(file_length_ >> 20) >= MaxLogSize()) {
+  if (static_cast<int>(file_length_ >> 20) >= MaxLogSize() ||
+      PidHasChanged()) {
     if (file_ != NULL) fclose(file_);
     file_ = NULL;
     file_length_ = bytes_since_flush_ = 0;
@@ -936,12 +950,12 @@ LogMessage::LogMessage(const char* file, int line, LogSeverity severity,
 
 LogMessage::LogMessage(const char* file, int line,
                        const CheckOpString& result) {
-  Init(file, line, FATAL, &LogMessage::SendToLog);
+  Init(file, line, GLOG_FATAL, &LogMessage::SendToLog);
   stream() << "Check failed: " << (*result.str_) << " ";
 }
 
 LogMessage::LogMessage(const char* file, int line) {
-  Init(file, line, INFO, &LogMessage::SendToLog);
+  Init(file, line, GLOG_INFO, &LogMessage::SendToLog);
 }
 
 LogMessage::LogMessage(const char* file, int line, LogSeverity severity) {
@@ -972,7 +986,7 @@ void LogMessage::Init(const char* file,
                       LogSeverity severity,
                       void (LogMessage::*send_method)()) {
   allocated_ = NULL;
-  if (severity != FATAL || !exit_on_dfatal) {
+  if (severity != GLOG_FATAL || !exit_on_dfatal) {
     allocated_ = new LogMessageData();
     data_ = allocated_;
     data_->buf_ = new char[kMaxLogMessageLen+1];
@@ -1123,7 +1137,7 @@ void ReprintFatalMessage() {
       // Also write to stderr
       WriteToStderr(fatal_message, n);
     }
-    LogDestination::LogToAllLogfiles(ERROR, fatal_time, fatal_message, n);
+    LogDestination::LogToAllLogfiles(GLOG_ERROR, fatal_time, fatal_message, n);
   }
 }
 
@@ -1181,7 +1195,7 @@ void LogMessage::SendToLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) {
   // If we log a FATAL message, flush all the log destinations, then toss
   // a signal for others to catch. We leave the logs in a state that
   // someone else can use them (as long as they flush afterwards)
-  if (data_->severity_ == FATAL && exit_on_dfatal) {
+  if (data_->severity_ == GLOG_FATAL && exit_on_dfatal) {
     if (data_->first_fatal_) {
       // Store crash information so that it is accessible from within signal
       // handlers that may be invoked later.
@@ -1212,7 +1226,9 @@ void LogMessage::SendToLog() EXCLUSIVE_LOCKS_REQUIRED(log_mutex) {
     LogDestination::WaitForSinks(data_);
 
     const char* message = "*** Check failure stack trace: ***\n";
-    write(STDERR_FILENO, message, strlen(message));
+    if (write(STDERR_FILENO, message, strlen(message)) < 0) {
+      // Ignore errors.
+    }
     Fail();
   }
 }
@@ -1231,27 +1247,31 @@ void LogMessage::RecordCrashReason(
 #endif
 }
 
+#ifdef HAVE___ATTRIBUTE__
+# define ATTRIBUTE_NORETURN __attribute__((noreturn))
+#else
+# define ATTRIBUTE_NORETURN
+#endif
+
+static void logging_fail() ATTRIBUTE_NORETURN;
+
 static void logging_fail() {
-// #if defined(_DEBUG) && defined(_MSC_VER)
-// doesn't work for my laptop (sergey)
-#if 0
+#if defined(_DEBUG) && defined(_MSC_VER)
   // When debugging on windows, avoid the obnoxious dialog and make
   // it possible to continue past a LOG(FATAL) in the debugger
-  _asm int 3
+  __debugbreak();
 #else
   abort();
 #endif
 }
 
-#ifdef HAVE___ATTRIBUTE__
+typedef void (*logging_fail_func_t)() ATTRIBUTE_NORETURN;
+
 GOOGLE_GLOG_DLL_DECL
-void (*g_logging_fail_func)() __attribute__((noreturn)) = &logging_fail;
-#else
-GOOGLE_GLOG_DLL_DECL void (*g_logging_fail_func)() = &logging_fail;
-#endif
+logging_fail_func_t g_logging_fail_func = &logging_fail;
 
 void InstallFailureFunction(void (*fail_func)()) {
-  g_logging_fail_func = fail_func;
+  g_logging_fail_func = (logging_fail_func_t)fail_func;
 }
 
 void LogMessage::Fail() {
@@ -1544,7 +1564,7 @@ static void GetTempDirectories(vector<string>* list) {
     "/tmp",
   };
 
-  for (int i = 0; i < ARRAYSIZE(candidates); i++) {
+  for (size_t i = 0; i < ARRAYSIZE(candidates); i++) {
     const char *d = candidates[i];
     if (!d) continue;  // Empty env var
 
@@ -1631,9 +1651,9 @@ void TruncateLogFile(const char *path, int64 limit, int64 keep) {
       // rather scary.
       // Instead just truncate the file to something we can manage
       if (truncate(path, 0) == -1) {
-	PLOG(ERROR) << "Unable to truncate " << path;
+        PLOG(ERROR) << "Unable to truncate " << path;
       } else {
-	LOG(ERROR) << "Truncated " << path << " due to EFBIG error";
+        LOG(ERROR) << "Truncated " << path << " due to EFBIG error";
       }
     } else {
       PLOG(ERROR) << "Unable to open " << path;
@@ -1769,7 +1789,7 @@ int posix_strerror_r(int err, char *buf, size_t len) {
 }
 
 LogMessageFatal::LogMessageFatal(const char* file, int line) :
-    LogMessage(file, line, FATAL) {}
+    LogMessage(file, line, GLOG_FATAL) {}
 
 LogMessageFatal::LogMessageFatal(const char* file, int line,
                                  const CheckOpString& result) :
@@ -1780,4 +1800,15 @@ LogMessageFatal::~LogMessageFatal() {
     LogMessage::Fail();
 }
 
+void InitGoogleLogging(const char* argv0) {
+  glog_internal_namespace_::InitGoogleLoggingUtilities(argv0);
+}
+
+void ShutdownGoogleLogging() {
+  glog_internal_namespace_::ShutdownGoogleLoggingUtilities();
+  LogDestination::DeleteLogDestinations();
+  delete logging_directories_list;
+  logging_directories_list = NULL;
+}
+
 _END_GOOGLE_NAMESPACE_
diff --git a/extern/libmv/third_party/glog/src/raw_logging.cc b/extern/libmv/third_party/glog/src/raw_logging.cc
index b179a1e..42676cb 100644
--- a/extern/libmv/third_party/glog/src/raw_logging.cc
+++ b/extern/libmv/third_party/glog/src/raw_logging.cc
@@ -151,7 +151,7 @@ void RawLog__(LogSeverity severity, const char* file, int line,
   // libc (to side-step any libc interception).
   // We write just once to avoid races with other invocations of RawLog__.
   safe_write(STDERR_FILENO, buffer, strlen(buffer));
-  if (severity == FATAL)  {
+  if (severity == GLOG_FATAL)  {
     if (!sync_val_compare_and_swap(&crashed, false, true)) {
       crash_reason.filename = file;
       crash_reason.line_number = line;
diff --git a/extern/libmv/third_party/glog/src/signalhandler.cc b/extern/libmv/third_party/glog/src/signalhandler.cc
index 9fc91b3..e95e9e9 100644
--- a/extern/libmv/third_party/glog/src/signalhandler.cc
+++ b/extern/libmv/third_party/glog/src/signalhandler.cc
@@ -34,7 +34,7 @@
 #include "utilities.h"
 #include "stacktrace.h"
 #include "symbolize.h"
-#include "glog/logging.h"
+#include <glog/logging.h>
 
 #include <signal.h>
 #include <time.h>
@@ -142,7 +142,9 @@ class MinimalFormatter {
 
 // Writes the given data with the size to the standard error.
 void WriteToStderr(const char* data, int size) {
-  write(STDERR_FILENO, data, size);
+  if (write(STDERR_FILENO, data, size) < 0) {
+    // Ignore errors.
+  }
 }
 
 // The writer function can be changed by InstallFailureWriter().
@@ -167,7 +169,7 @@ void DumpTimeInfo() {
 void DumpSignalInfo(int signal_number, siginfo_t *siginfo) {
   // Get the signal name.
   const char* signal_name = NULL;
-  for (int i = 0; i < ARRAYSIZE(kFailureSignals); ++i) {
+  for (size_t i = 0; i < ARRAYSIZE(kFailureSignals); ++i) {
     if (signal_number == kFailureSignals[i].number) {
       signal_name = kFailureSignals[i].name;
     }
@@ -336,7 +338,7 @@ void InstallFailureSignalHandler() {
   sig_action.sa_flags |= SA_SIGINFO;
   sig_action.sa_sigaction = &FailureSignalHandler;
 
-  for (int i = 0; i < ARRAYSIZE(kFailureSignals); ++i) {
+  for (size_t i = 0; i < ARRAYSIZE(kFailureSignals); ++i) {
     CHECK_ERR(sigaction(kFailureSignals[i].number, &sig_action, NULL));
   }
 }
diff --git a/extern/libmv/third_party/glog/src/stacktrace_libunwind-inl.h b/extern/libmv/third_party/glog/src/stacktrace_libunwind-inl.h
index 0dc14c6..46002c1 100644
--- a/extern/libmv/third_party/glog/src/stacktrace_libunwind-inl.h
+++ b/extern/libmv/third_party/glog/src/stacktrace_libunwind-inl.h
@@ -37,7 +37,7 @@ extern "C" {
 #define UNW_LOCAL_ONLY
 #include <libunwind.h>
 }
-#include "glog/raw_logging.h"
+#include <glog/raw_logging.h>
 #include "stacktrace.h"
 
 _START_GOOGLE_NAMESPACE_
diff --git a/extern/libmv/third_party/glog/src/stacktrace_x86_64-inl.h b/extern/libmv/third_party/glog/src/stacktrace_x86_64-inl.h
index e3729e1..f7d1dca 100644
--- a/extern/libmv/third_party/glog/src/stacktrace_x86_64-inl.h
+++ b/extern/libmv/third_party/glog/src/stacktrace_x86_64-inl.h
@@ -33,10 +33,6 @@
 
 extern "C" {
 #include <stdlib.h> // for NULL
-#if defined(__FreeBSD__)
-/* devel/libunwind only includes _Unwind_Backtrace if this is set */
-#define _GNU_SOURCE 1
-#endif
 #include <unwind.h> // ABI defined unwinder
 }
 #include "stacktrace.h"
diff --git a/extern/libmv/third_party/glog/src/symbolize.cc b/extern/libmv/third_party/glog/src/symbolize.cc
index 3465de6..d1831e4 100644
--- a/extern/libmv/third_party/glog/src/symbolize.cc
+++ b/extern/libmv/third_party/glog/src/symbolize.cc
@@ -82,8 +82,8 @@ static ATTRIBUTE_NOINLINE void DemangleInplace(char *out, int out_size) {
   char demangled[256];  // Big enough for sane demangled symbols.
   if (Demangle(out, demangled, sizeof(demangled))) {
     // Demangling succeeded. Copy to out if the space allows.
-    int len = strlen(demangled);
-    if (len + 1 <= out_size) {  // +1 for '\0'.
+    size_t len = strlen(demangled);
+    if (len + 1 <= (size_t)out_size) {  // +1 for '\0'.
       SAFE_ASSERT(len < sizeof(demangled));
       memmove(out, demangled, len + 1);
     }
@@ -111,7 +111,7 @@ _END_GOOGLE_NAMESPACE_
 
 #include "symbolize.h"
 #include "config.h"
-#include "glog/raw_logging.h"
+#include <glog/raw_logging.h>
 
 // Re-runs fn until it doesn't cause EINTR.
 #define NO_INTR(fn)   do {} while ((fn) < 0 && errno == EINTR)
@@ -637,7 +637,7 @@ static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void *pc, char *out,
                                                     int out_size) {
   Dl_info info;
   if (dladdr(pc, &info)) {
-    if (strlen(info.dli_sname) < out_size) {
+    if ((int)strlen(info.dli_sname) < out_size) {
       strcpy(out, info.dli_sname);
       // Symbolization succeeded.  Now we try to demangle the symbol.
       DemangleInplace(out, out_size);
diff --git a/extern/libmv/third_party/glog/src/symbolize.h b/extern/libmv/third_party/glog/src/symbolize.h
index 1ebe4dd..04e482b 100644
--- a/extern/libmv/third_party/glog/src/symbolize.h
+++ b/extern/libmv/third_party/glog/src/symbolize.h
@@ -56,7 +56,7 @@
 
 #include "utilities.h"
 #include "config.h"
-#include "glog/logging.h"
+#include <glog/logging.h>
 
 #ifdef HAVE_SYMBOLIZE
 
diff --git a/extern/libmv/third_party/glog/src/utilities.cc b/extern/libmv/third_party/glog/src/utilities.cc
index 6d64b92..c9db2b7 100644
--- a/extern/libmv/third_party/glog/src/utilities.cc
+++ b/extern/libmv/third_party/glog/src/utilities.cc
@@ -77,9 +77,11 @@ typedef void DebugWriter(const char*, void*);
 // For some environments, add two extra bytes for the leading "0x".
 static const int kPrintfPointerFieldWidth = 2 + 2 * sizeof(void*);
 
-static void DebugWriteToStderr(const char* data, void *unused) {
+static void DebugWriteToStderr(const char* data, void *) {
   // This one is signal-safe.
-  write(STDERR_FILENO, data, strlen(data));
+  if (write(STDERR_FILENO, data, strlen(data)) < 0) {
+    // Ignore errors.
+  }
 }
 
 void DebugWriteToString(const char* data, void *arg) {
@@ -221,8 +223,17 @@ int32 GetMainThreadPid() {
   return g_main_thread_pid;
 }
 
+bool PidHasChanged() {
+  int32 pid = getpid();
+  if (g_main_thread_pid == pid) {
+    return false;
+  }
+  g_main_thread_pid = pid;
+  return true;
+}
+
 pid_t GetTID() {
-  // On Linux and FreeBSD, we try to use gettid().
+  // On Linux and MACOSX , we try to use gettid().
 #if defined OS_LINUX || defined OS_MACOSX
 #ifndef __NR_gettid
 #ifdef OS_MACOSX
@@ -245,7 +256,7 @@ pid_t GetTID() {
     // the value change to "true".
     lacks_gettid = true;
   }
-#endif  // OS_LINUX || OS_FREEBSD
+#endif  // OS_LINUX || OS_MACOSX
 
   // If gettid() could not be used, we use one of the following.
 #if defined OS_LINUX
@@ -302,9 +313,7 @@ void SetCrashReason(const CrashReason* r) {
                             r);
 }
 
-}  // namespace glog_internal_namespace_
-
-void InitGoogleLogging(const char* argv0) {
+void InitGoogleLoggingUtilities(const char* argv0) {
   CHECK(!IsGoogleLoggingInitialized())
       << "You called InitGoogleLogging() twice!";
   const char* slash = strrchr(argv0, '/');
@@ -319,14 +328,16 @@ void InitGoogleLogging(const char* argv0) {
 #endif
 }
 
-void ShutdownGoogleLogging() {
+void ShutdownGoogleLoggingUtilities() {
   CHECK(IsGoogleLoggingInitialized())
-      << "You called ShutdownGoogleLogging() without InitGoogleLogging() first!";
+      << "You called ShutdownGoogleLogging() without calling InitGoogleLogging() first!";
 #ifdef HAVE_SYSLOG_H
   closelog();
 #endif
 }
 
+}  // namespace glog_internal_namespace_
+
 _END_GOOGLE_NAMESPACE_
 
 // Make an implementation of stacktrace compiled.
diff --git a/extern/libmv/third_party/glog/src/utilities.h b/extern/libmv/third_party/glog/src/utilities.h
index 5c841a0..c8215b7 100644
--- a/extern/libmv/third_party/glog/src/utilities.h
+++ b/extern/libmv/third_party/glog/src/utilities.h
@@ -101,7 +101,7 @@
 // correctly when GetStackTrace() is called with max_depth == 0.
 // Some code may do that.
 
-#if __MINGW32__
+#if defined(__MINGW32__) || defined(__FreeBSD__)
 # undef STACKTRACE_H
 #elif defined(HAVE_LIB_UNWIND)
 # define STACKTRACE_H "stacktrace_libunwind-inl.h"
@@ -161,6 +161,7 @@ typedef double WallTime;
 WallTime WallTime_Now();
 
 int32 GetMainThreadPid();
+bool PidHasChanged();
 
 pid_t GetTID();
 
@@ -215,6 +216,9 @@ struct CrashReason {
 
 void SetCrashReason(const CrashReason* r);
 
+void InitGoogleLoggingUtilities(const char* argv0);
+void ShutdownGoogleLoggingUtilities();
+
 }  // namespace glog_internal_namespace_
 
 _END_GOOGLE_NAMESPACE_
diff --git a/extern/libmv/third_party/glog/src/vlog_is_on.cc b/extern/libmv/third_party/glog/src/vlog_is_on.cc
index ed88514..5eefc96 100644
--- a/extern/libmv/third_party/glog/src/vlog_is_on.cc
+++ b/extern/libmv/third_party/glog/src/vlog_is_on.cc
@@ -70,8 +70,8 @@ GOOGLE_GLOG_DLL_DECL bool SafeFNMatch_(const char* pattern,
                                        size_t patt_len,
                                        const char* str,
                                        size_t str_len) {
-  int p = 0;
-  int s = 0;
+  size_t p = 0;
+  size_t s = 0;
   while (1) {
     if (p == patt_len  &&  s == str_len) return true;
     if (p == patt_len) return false;
@@ -211,7 +211,7 @@ bool InitVLOG3__(int32** site_flag, int32* site_default,
   const char* base = strrchr(fname, '/');
   base = base ? (base+1) : fname;
   const char* base_end = strchr(base, '.');
-  size_t base_length = base_end ? (base_end - base) : strlen(base);
+  size_t base_length = base_end ? size_t(base_end - base) : strlen(base);
 
   // Trim out trailing "-inl" if any
   if (base_length >= 4 && (memcmp(base+base_length-4, "-inl", 4) == 0)) {
diff --git a/extern/libmv/third_party/glog/src/windows/glog/log_severity.h b/extern/libmv/third_party/glog/src/windows/glog/log_severity.h
index 5e7d09e..22a4191 100644
--- a/extern/libmv/third_party/glog/src/windows/glog/log_severity.h
+++ b/extern/libmv/third_party/glog/src/windows/glog/log_severity.h
@@ -48,7 +48,15 @@
 // you ever need to change their values or add a new severity.
 typedef int LogSeverity;
 
-const int INFO = 0, WARNING = 1, ERROR = 2, FATAL = 3, NUM_SEVERITIES = 4;
+const int GLOG_INFO = 0, GLOG_WARNING = 1, GLOG_ERROR = 2, GLOG_FATAL = 3,
+  NUM_SEVERITIES = 4;
+#ifndef GLOG_NO_ABBREVIATED_SEVERITIES
+# ifdef ERROR
+#  error ERROR macro is defined. Define GLOG_NO_ABBREVIATED_SEVERITIES before including logging.h. See the document for detail.
+# endif
+const int INFO = GLOG_INFO, WARNING = GLOG_WARNING,
+  ERROR = GLOG_ERROR, FATAL = GLOG_FATAL;
+#endif
 
 // DFATAL is FATAL in debug mode, ERROR in normal mode
 #ifdef NDEBUG
diff --git a/extern/libmv/third_party/glog/src/windows/glog/logging.h b/extern/libmv/third_party/glog/src/windows/glog/logging.h
index 2f41681..f623cd9 100644
--- a/extern/libmv/third_party/glog/src/windows/glog/logging.h
+++ b/extern/libmv/third_party/glog/src/windows/glog/logging.h
@@ -83,7 +83,7 @@
 #endif
 
 #if 1
-#include "third_party/gflags/gflags.h"
+#include "third_party/gflags/gflags/gflags.h"
 #endif
 
 #ifdef __MINGW32__
@@ -170,21 +170,21 @@ typedef uint64_t uint64;
 // You can also do occasional logging (log every n'th occurrence of an
 // event):
 //
-//   LOG_EVERY_N(INFO, 10) << "Got the " << COUNTER << "th cookie";
+//   LOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie";
 //
 // The above will cause log messages to be output on the 1st, 11th, 21st, ...
-// times it is executed.  Note that the special COUNTER value is used to
-// identify which repetition is happening.
+// times it is executed.  Note that the special google::COUNTER value is used
+// to identify which repetition is happening.
 //
 // You can also do occasional conditional logging (log every n'th
 // occurrence of an event, when condition is satisfied):
 //
-//   LOG_IF_EVERY_N(INFO, (size > 1024), 10) << "Got the " << COUNTER
+//   LOG_IF_EVERY_N(INFO, (size > 1024), 10) << "Got the " << google::COUNTER
 //                                           << "th big cookie";
 //
 // You can log messages the first N times your code executes a line. E.g.
 //
-//   LOG_FIRST_N(INFO, 20) << "Got the " << COUNTER << "th cookie";
+//   LOG_FIRST_N(INFO, 20) << "Got the " << google::COUNTER << "th cookie";
 //
 // Outputs log messages for the first 20 times it is executed.
 //
@@ -201,7 +201,7 @@ typedef uint64_t uint64;
 //
 //   DLOG_IF(INFO, num_cookies > 10) << "Got lots of cookies";
 //
-//   DLOG_EVERY_N(INFO, 10) << "Got the " << COUNTER << "th cookie";
+//   DLOG_EVERY_N(INFO, 10) << "Got the " << google::COUNTER << "th cookie";
 //
 // All "debug mode" logging is compiled away to nothing for non-debug mode
 // compiles.
@@ -245,11 +245,11 @@ typedef uint64_t uint64;
 //         "program with --v=1 or more";
 //   VLOG_EVERY_N(1, 10)
 //      << "I'm printed every 10th occurrence, and when you run the program "
-//         "with --v=1 or more. Present occurence is " << COUNTER;
+//         "with --v=1 or more. Present occurence is " << google::COUNTER;
 //   VLOG_IF_EVERY_N(1, (size > 1024), 10)
 //      << "I'm printed on every 10th occurence of case when size is more "
 //         " than 1024, when you run the program with --v=1 or more. ";
-//         "Present occurence is " << COUNTER;
+//         "Present occurence is " << google::COUNTER;
 //
 // The supported severity levels for macros that allow you to specify one
 // are (in increasing order of severity) INFO, WARNING, ERROR, and FATAL.
@@ -386,7 +386,7 @@ DECLARE_bool(stop_logging_if_full_disk);
 #define COMPACT_GOOGLE_LOG_INFO google::LogMessage( \
       __FILE__, __LINE__)
 #define LOG_TO_STRING_INFO(message) google::LogMessage( \
-      __FILE__, __LINE__, google::INFO, message)
+      __FILE__, __LINE__, google::GLOG_INFO, message)
 #else
 #define COMPACT_GOOGLE_LOG_INFO google::NullStream()
 #define LOG_TO_STRING_INFO(message) google::NullStream()
@@ -394,9 +394,9 @@ DECLARE_bool(stop_logging_if_full_disk);
 
 #if GOOGLE_STRIP_LOG <= 1
 #define COMPACT_GOOGLE_LOG_WARNING google::LogMessage( \
-      __FILE__, __LINE__, google::WARNING)
+      __FILE__, __LINE__, google::GLOG_WARNING)
 #define LOG_TO_STRING_WARNING(message) google::LogMessage( \
-      __FILE__, __LINE__, google::WARNING, message)
+      __FILE__, __LINE__, google::GLOG_WARNING, message)
 #else
 #define COMPACT_GOOGLE_LOG_WARNING google::NullStream()
 #define LOG_TO_STRING_WARNING(message) google::NullStream()
@@ -404,9 +404,9 @@ DECLARE_bool(stop_logging_if_full_disk);
 
 #if GOOGLE_STRIP_LOG <= 2
 #define COMPACT_GOOGLE_LOG_ERROR google::LogMessage( \
-      __FILE__, __LINE__, google::ERROR)
+      __FILE__, __LINE__, google::GLOG_ERROR)
 #define LOG_TO_STRING_ERROR(message) google::LogMessage( \
-      __FILE__, __LINE__, google::ERROR, message)
+      __FILE__, __LINE__, google::GLOG_ERROR, message)
 #else
 #define COMPACT_GOOGLE_LOG_ERROR google::NullStream()
 #define LOG_TO_STRING_ERROR(message) google::NullStream()
@@ -416,7 +416,7 @@ DECLARE_bool(stop_logging_if_full_disk);
 #define COMPACT_GOOGLE_LOG_FATAL google::LogMessageFatal( \
       __FILE__, __LINE__)
 #define LOG_TO_STRING_FATAL(message) google::LogMessage( \
-      __FILE__, __LINE__, google::FATAL, message)
+      __FILE__, __LINE__, google::GLOG_FATAL, message)
 #else
 #define COMPACT_GOOGLE_LOG_FATAL google::NullStreamFatal()
 #define LOG_TO_STRING_FATAL(message) google::NullStreamFatal()
@@ -428,32 +428,32 @@ DECLARE_bool(stop_logging_if_full_disk);
 #define COMPACT_GOOGLE_LOG_DFATAL COMPACT_GOOGLE_LOG_ERROR
 #elif GOOGLE_STRIP_LOG <= 3
 #define COMPACT_GOOGLE_LOG_DFATAL google::LogMessage( \
-      __FILE__, __LINE__, google::FATAL)
+      __FILE__, __LINE__, google::GLOG_FATAL)
 #else
 #define COMPACT_GOOGLE_LOG_DFATAL google::NullStreamFatal()
 #endif
 
-#define GOOGLE_LOG_INFO(counter) google::LogMessage(__FILE__, __LINE__, google::INFO, counter, &google::LogMessage::SendToLog)
+#define GOOGLE_LOG_INFO(counter) google::LogMessage(__FILE__, __LINE__, google::GLOG_INFO, counter, &google::LogMessage::SendToLog)
 #define SYSLOG_INFO(counter) \
-  google::LogMessage(__FILE__, __LINE__, google::INFO, counter, \
+  google::LogMessage(__FILE__, __LINE__, google::GLOG_INFO, counter, \
   &google::LogMessage::SendToSyslogAndLog)
 #define GOOGLE_LOG_WARNING(counter)  \
-  google::LogMessage(__FILE__, __LINE__, google::WARNING, counter, \
+  google::LogMessage(__FILE__, __LINE__, google::GLOG_WARNING, counter, \
   &google::LogMessage::SendToLog)
 #define SYSLOG_WARNING(counter)  \
-  google::LogMessage(__FILE__, __LINE__, google::WARNING, counter, \
+  google::LogMessage(__FILE__, __LINE__, google::GLOG_WARNING, counter, \
   &google::LogMessage::SendToSyslogAndLog)
 #define GOOGLE_LOG_ERROR(counter)  \
-  google::LogMessage(__FILE__, __LINE__, google::ERROR, counter, \
+  google::LogMessage(__FILE__, __LINE__, google::GLOG_ERROR, counter, \
   &google::LogMessage::SendToLog)
 #define SYSLOG_ERROR(counter)  \
-  google::LogMessage(__FILE__, __LINE__, google::ERROR, counter, \
+  google::LogMessage(__FILE__, __LINE__, google::GLOG_ERROR, counter, \
   &google::LogMessage::SendToSyslogAndLog)
 #define GOOGLE_LOG_FATAL(counter) \
-  google::LogMessage(__FILE__, __LINE__, google::FATAL, counter, \
+  google::LogMessage(__FILE__, __LINE__, google::GLOG_FATAL, counter, \
   &google::LogMessage::SendToLog)
 #define SYSLOG_FATAL(counter) \
-  google::LogMessage(__FILE__, __LINE__, google::FATAL, counter, \
+  google::LogMessage(__FILE__, __LINE__, google::GLOG_FATAL, counter, \
   &google::LogMessage::SendToSyslogAndLog)
 #define GOOGLE_LOG_DFATAL(counter) \
   google::LogMessage(__FILE__, __LINE__, google::DFATAL_LEVEL, counter, \
@@ -472,7 +472,7 @@ DECLARE_bool(stop_logging_if_full_disk);
                          FORMAT_MESSAGE_FROM_SYSTEM, \
                          0, result, 0, msg, 100, NULL); \
     if (message_length > 0) { \
-      google::LogMessage(__FILE__, __LINE__, ERROR, 0, \
+      google::LogMessage(__FILE__, __LINE__, google::GLOG_ERROR, 0, \
           &google::LogMessage::SendToLog).stream() << message; \
       LocalFree(message); \
     } \
@@ -519,12 +519,12 @@ class LogSink;  // defined below
 #define LOG_TO_SINK(sink, severity) \
   google::LogMessage(                                    \
       __FILE__, __LINE__,                                               \
-      google::severity,                                  \
+      google::GLOG_ ## severity,                         \
       static_cast<google::LogSink*>(sink), true).stream()
 #define LOG_TO_SINK_BUT_NOT_TO_LOGFILE(sink, severity)                  \
   google::LogMessage(                                    \
       __FILE__, __LINE__,                                               \
-      google::severity,                                  \
+      google::GLOG_ ## severity,                         \
       static_cast<google::LogSink*>(sink), false).stream()
 
 // If a non-NULL string pointer is given, we write this message to that string.
@@ -789,7 +789,7 @@ DECLARE_CHECK_STROP_IMPL(strcasecmp, false)
 
 #define GOOGLE_PLOG(severity, counter)  \
   google::ErrnoLogMessage( \
-      __FILE__, __LINE__, google::severity, counter, \
+      __FILE__, __LINE__, google::GLOG_ ## severity, counter, \
       &google::LogMessage::SendToLog)
 
 #define PLOG_IF(severity, condition) \
@@ -828,7 +828,7 @@ PLOG_IF(FATAL, GOOGLE_PREDICT_BRANCH_NOT_TAKEN((invocation) == -1))    \
   if (++LOG_OCCURRENCES_MOD_N > n) LOG_OCCURRENCES_MOD_N -= n; \
   if (LOG_OCCURRENCES_MOD_N == 1) \
     google::LogMessage( \
-        __FILE__, __LINE__, google::severity, LOG_OCCURRENCES, \
+        __FILE__, __LINE__, google::GLOG_ ## severity, LOG_OCCURRENCES, \
         &what_to_do).stream()
 
 #define SOME_KIND_OF_LOG_IF_EVERY_N(severity, condition, n, what_to_do) \
@@ -837,7 +837,7 @@ PLOG_IF(FATAL, GOOGLE_PREDICT_BRANCH_NOT_TAKEN((invocation) == -1))    \
   if (condition && \
       ((LOG_OCCURRENCES_MOD_N=(LOG_OCCURRENCES_MOD_N + 1) % n) == (1 % n))) \
     google::LogMessage( \
-        __FILE__, __LINE__, google::severity, LOG_OCCURRENCES, \
+        __FILE__, __LINE__, google::GLOG_ ## severity, LOG_OCCURRENCES, \
                  &what_to_do).stream()
 
 #define SOME_KIND_OF_PLOG_EVERY_N(severity, n, what_to_do) \
@@ -846,7 +846,7 @@ PLOG_IF(FATAL, GOOGLE_PREDICT_BRANCH_NOT_TAKEN((invocation) == -1))    \
   if (++LOG_OCCURRENCES_MOD_N > n) LOG_OCCURRENCES_MOD_N -= n; \
   if (LOG_OCCURRENCES_MOD_N == 1) \
     google::ErrnoLogMessage( \
-        __FILE__, __LINE__, google::severity, LOG_OCCURRENCES, \
+        __FILE__, __LINE__, google::GLOG_ ## severity, LOG_OCCURRENCES, \
         &what_to_do).stream()
 
 #define SOME_KIND_OF_LOG_FIRST_N(severity, n, what_to_do) \
@@ -855,7 +855,7 @@ PLOG_IF(FATAL, GOOGLE_PREDICT_BRANCH_NOT_TAKEN((invocation) == -1))    \
     ++LOG_OCCURRENCES; \
   if (LOG_OCCURRENCES <= n) \
     google::LogMessage( \
-        __FILE__, __LINE__, google::severity, LOG_OCCURRENCES, \
+        __FILE__, __LINE__, google::GLOG_ ## severity, LOG_OCCURRENCES, \
         &what_to_do).stream()
 
 namespace glog_internal_namespace_ {
@@ -869,7 +869,7 @@ struct CrashReason;
   typedef google::glog_internal_namespace_::CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
 
 #define LOG_EVERY_N(severity, n)                                        \
-  GOOGLE_GLOG_COMPILE_ASSERT(google::severity <          \
+  GOOGLE_GLOG_COMPILE_ASSERT(google::GLOG_ ## severity < \
                              google::NUM_SEVERITIES,     \
                              INVALID_REQUESTED_LOG_SEVERITY);           \
   SOME_KIND_OF_LOG_EVERY_N(severity, (n), google::LogMessage::SendToLog)
@@ -889,6 +889,27 @@ struct CrashReason;
 // We want the special COUNTER value available for LOG_EVERY_X()'ed messages
 enum PRIVATE_Counter {COUNTER};
 
+#ifdef GLOG_NO_ABBREVIATED_SEVERITIES
+// wingdi.h defines ERROR to be 0. When we call LOG(ERROR), it gets
+// substituted with 0, and it expands to COMPACT_GOOGLE_LOG_0. To allow us
+// to keep using this syntax, we define this macro to do the same thing
+// as COMPACT_GOOGLE_LOG_ERROR.
+#define COMPACT_GOOGLE_LOG_0 COMPACT_GOOGLE_LOG_ERROR
+#define SYSLOG_0 SYSLOG_ERROR
+#define LOG_TO_STRING_0 LOG_TO_STRING_ERROR
+// Needed for LOG_IS_ON(ERROR).
+const LogSeverity GLOG_0 = GLOG_ERROR;
+#else
+// Users may include windows.h after logging.h without
+// GLOG_NO_ABBREVIATED_SEVERITIES nor WIN32_LEAN_AND_MEAN.
+// For this case, we cannot detect if ERROR is defined before users
+// actually use ERROR. Let's make an undefined symbol to warn users.
+# define GLOG_ERROR_MSG ERROR_macro_is_defined_Define_GLOG_NO_ABBREVIATED_SEVERITIES_before_including_logging_h_See_the_document_for_detail
+# define COMPACT_GOOGLE_LOG_0 GLOG_ERROR_MSG
+# define SYSLOG_0 GLOG_ERROR_MSG
+# define LOG_TO_STRING_0 GLOG_ERROR_MSG
+# define GLOG_0 GLOG_ERROR_MSG
+#endif
 
 // Plus some debug-logging macros that get compiled to nothing for production
 
@@ -1033,14 +1054,14 @@ public:
 # pragma warning(default: 4275)
 #endif
   public:
-    LogStream(char *buf, int len, int ctr)
+    LogStream(char *buf, int len, int ctr_in)
       : ostrstream(buf, len),
-        ctr_(ctr) {
+        ctr_(ctr_in) {
       self_ = this;
     }
 
     int ctr() const { return ctr_; }
-    void set_ctr(int ctr) { ctr_ = ctr; }
+    void set_ctr(int ctr_in) { ctr_ = ctr_in; }
     LogStream* self() const { return self_; }
 
   private:
@@ -1482,7 +1503,7 @@ class GOOGLE_GLOG_DLL_DECL NullStream : public LogMessage::LogStream {
 // converted to LogStream and the message will be computed and then
 // quietly discarded.
 template<class T>
-inline NullStream& operator<<(NullStream &str, const T &value) { return str; }
+inline NullStream& operator<<(NullStream &str, const T &) { return str; }
 
 // Similar to NullStream, but aborts the program (without stack
 // trace), like LogMessageFatal.
diff --git a/extern/libmv/third_party/glog/src/windows/glog/raw_logging.h b/extern/libmv/third_party/glog/src/windows/glog/raw_logging.h
index c81e67b..4757a71 100644
--- a/extern/libmv/third_party/glog/src/windows/glog/raw_logging.h
+++ b/extern/libmv/third_party/glog/src/windows/glog/raw_logging.h
@@ -72,7 +72,7 @@ namespace google {
 //   I0821 211317 file.cc:142] RAW: status is 20
 #define RAW_LOG(severity, ...) \
   do { \
-    switch (google::severity) {  \
+    switch (google::GLOG_ ## severity) {  \
       case 0: \
         RAW_LOG_INFO(__VA_ARGS__); \
         break; \
@@ -104,28 +104,28 @@ namespace google {
 #endif // STRIP_LOG == 0
 
 #if STRIP_LOG == 0
-#define RAW_LOG_INFO(...) google::RawLog__(google::INFO, \
+#define RAW_LOG_INFO(...) google::RawLog__(google::GLOG_INFO, \
                                    __FILE__, __LINE__, __VA_ARGS__)
 #else
 #define RAW_LOG_INFO(...) google::RawLogStub__(0, __VA_ARGS__)
 #endif // STRIP_LOG == 0
 
 #if STRIP_LOG <= 1
-#define RAW_LOG_WARNING(...) google::RawLog__(google::WARNING,   \
+#define RAW_LOG_WARNING(...) google::RawLog__(google::GLOG_WARNING,   \
                                       __FILE__, __LINE__, __VA_ARGS__)
 #else
 #define RAW_LOG_WARNING(...) google::RawLogStub__(0, __VA_ARGS__)
 #endif // STRIP_LOG <= 1
 
 #if STRIP_LOG <= 2
-#define RAW_LOG_ERROR(...) google::RawLog__(google::ERROR,       \
+#define RAW_LOG_ERROR(...) google::RawLog__(google::GLOG_ERROR,       \
                                     __FILE__, __LINE__, __VA_ARGS__)
 #else
 #define RAW_LOG_ERROR(...) google::RawLogStub__(0, __VA_ARGS__)
 #endif // STRIP_LOG <= 2
 
 #if STRIP_LOG <= 3
-#define RAW_LOG_FATAL(...) google::RawLog__(google::FATAL,       \
+#define RAW_LOG_FATAL(...) google::RawLog__(google::GLOG_FATAL,       \
                                     __FILE__, __LINE__, __VA_ARGS__)
 #else
 #define RAW_LOG_FATAL(...) \
@@ -166,7 +166,7 @@ namespace google {
 
 // Stub log function used to work around for unused variable warnings when
 // building with STRIP_LOG > 0.
-static inline void RawLogStub__(int ignored, ...) {
+static inline void RawLogStub__(int /* ignored */, ...) {
 }
 
 // Helper function to implement RAW_LOG and RAW_VLOG
diff --git a/extern/libmv/third_party/glog/src/windows/port.cc b/extern/libmv/third_party/glog/src/windows/port.cc
index bfa6e70..58e28b0 100644
--- a/extern/libmv/third_party/glog/src/windows/port.cc
+++ b/extern/libmv/third_party/glog/src/windows/port.cc
@@ -55,6 +55,8 @@ int safe_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
   return _vsnprintf(str, size-1, format, ap);
 }
 
+// MinGW64 defines
+#ifndef __MINGW64__
 int snprintf(char *str, size_t size, const char *format, ...) {
   va_list ap;
   va_start(ap, format);
@@ -62,3 +64,4 @@ int snprintf(char *str, size_t size, const char *format, ...) {
   va_end(ap);
   return r;
 }
+#endif
diff --git a/extern/libmv/third_party/glog/src/windows/port.h b/extern/libmv/third_party/glog/src/windows/port.h
index d507812..72e3906 100644
--- a/extern/libmv/third_party/glog/src/windows/port.h
+++ b/extern/libmv/third_party/glog/src/windows/port.h
@@ -59,16 +59,14 @@
  * used by both C and C++ code, so we put all the C++ together.
  */
 
-#if _MSC_VER
- /* 4244: otherwise we get problems when substracting two size_t's to an int
-  * 4251: it's complaining about a private struct I've chosen not to dllexport
-  * 4355: we use this in a constructor, but we do it safely
-  * 4715: for some reason VC++ stopped realizing you can't return after abort()
-  * 4800: we know we're casting ints/char*'s to bools, and we're ok with that
-  * 4996: Yes, we're ok using "unsafe" functions like fopen() and strerror()
-  */
-# pragma warning(disable:4244 4251 4355 4715 4800 4996)
-#endif
+/* 4244: otherwise we get problems when substracting two size_t's to an int
+ * 4251: it's complaining about a private struct I've chosen not to dllexport
+ * 4355: we use this in a constructor, but we do it safely
+ * 4715: for some reason VC++ stopped realizing you can't return after abort()
+ * 4800: we know we're casting ints/char*'s to bools, and we're ok with that
+ * 4996: Yes, we're ok using "unsafe" functions like fopen() and strerror()
+ */
+#pragma warning(disable:4244 4251 4355 4715 4800 4996)
 
 /* file I/O */
 #define PATH_MAX 1024
@@ -122,7 +120,9 @@ extern int safe_vsnprintf(char *str, size_t size,
 #define DEFAULT_TEMPLATE_ROOTDIR  ".."
 
 // ----------------------------------- SYSTEM/PROCESS
+#ifndef __MINGW64__
 typedef int pid_t;
+#endif
 #define getpid  _getpid
 
 // ----------------------------------- THREADS
diff --git a/extern/libredcode/codec.h b/extern/libredcode/codec.h
index 928cab5..dd23918 100644
--- a/extern/libredcode/codec.h
+++ b/extern/libredcode/codec.h
@@ -1,5 +1,5 @@
-#ifndef __redcode_codec_h_included__
-#define __redcode_codec_h_included__
+#ifndef __CODEC_H__
+#define __CODEC_H__
 
 struct redcode_frame;
 
diff --git a/extern/libredcode/debayer.h b/extern/libredcode/debayer.h
index b58c767..4356424 100644
--- a/extern/libredcode/debayer.h
+++ b/extern/libredcode/debayer.h
@@ -1,5 +1,5 @@
-#ifndef __redcode_debayer_h_included__
-#define __redcode_debayer_h_included__ 1
+#ifndef __DEBAYER_H__
+#define __DEBAYER_H__
 
 void redcode_ycbcr2rgb_fullscale(
 	int ** planes, int width, int height, float * out);
diff --git a/extern/libredcode/format.h b/extern/libredcode/format.h
index b2c6b2d..3cee804 100644
--- a/extern/libredcode/format.h
+++ b/extern/libredcode/format.h
@@ -1,5 +1,5 @@
-#ifndef __redcode_format_h_included__
-#define __redcode_format_h_included__
+#ifndef __FORMAT_H__
+#define __FORMAT_H__
 
 struct redcode_handle;
 struct redcode_frame {
diff --git a/extern/recastnavigation/Detour/Source/DetourStatNavMesh.cpp b/extern/recastnavigation/Detour/Source/DetourStatNavMesh.cpp
index bf59cd8..a022118 100644
--- a/extern/recastnavigation/Detour/Source/DetourStatNavMesh.cpp
+++ b/extern/recastnavigation/Detour/Source/DetourStatNavMesh.cpp
@@ -465,7 +465,7 @@ int dtStatNavMesh::raycast(dtStatPolyRef centerRef, const float* startPos, const
 	if (!m_header) return 0;
 	if (!centerRef) return 0;
 	
-	dtStatPolyRef prevRef = centerRef;
+	/* dtStatPolyRef prevRef = centerRef; */ /* UNUSED */
 	dtStatPolyRef curRef = centerRef;
 	t = 0;
 
@@ -506,7 +506,7 @@ int dtStatNavMesh::raycast(dtStatPolyRef centerRef, const float* startPos, const
 		}
 		
 		// No hit, advance to neighbour polygon.
-		prevRef = curRef;
+		/* prevRef = curRef; */ /* UNUSED */
 		curRef = nextRef;
 	}
 	
@@ -566,7 +566,7 @@ float dtStatNavMesh::findDistanceToWall(dtStatPolyRef centerRef, const float* ce
 			hitPos[2] = vj[2] + (vi[2] - vj[2])*tseg;
 		}
 
-		// Check to see if teh circle expands to one of the neighbours and expand.
+		// Check to see if the circle expands to one of the neighbours and expand.
 		for (int i = 0, j = (int)poly->nv-1; i < (int)poly->nv; j = i++)
 		{
 			// Skip solid edges.
diff --git a/extern/recastnavigation/Recast/Source/RecastLayers.cpp b/extern/recastnavigation/Recast/Source/RecastLayers.cpp
index 617cf45..2d9658b 100644
--- a/extern/recastnavigation/Recast/Source/RecastLayers.cpp
+++ b/extern/recastnavigation/Recast/Source/RecastLayers.cpp
@@ -368,7 +368,7 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf,
 				rcLayerRegion& rj = regs[j];
 				if (!rj.base) continue;
 				
-				// Skip if teh regions are not close to each other.
+				// Skip if the regions are not close to each other.
 				if (!overlapRange(ri.ymin,ri.ymax+mergeHeight, rj.ymin,rj.ymax+mergeHeight))
 					continue;
 				// Skip if the height range would become too large.
diff --git a/extern/recastnavigation/Recast/Source/RecastMeshDetail.cpp b/extern/recastnavigation/Recast/Source/RecastMeshDetail.cpp
index 126529e..3922c86 100644
--- a/extern/recastnavigation/Recast/Source/RecastMeshDetail.cpp
+++ b/extern/recastnavigation/Recast/Source/RecastMeshDetail.cpp
@@ -70,7 +70,7 @@ static bool circumCircle(const float* p1, const float* p2, const float* p3,
 	
 	const float cp = vcross2(p1, p2, p3);
 	if (fabsf(cp) > EPS)
-  	{
+	{
 		const float p1Sq = vdot2(p1,p1);
 		const float p2Sq = vdot2(p2,p2);
 		const float p3Sq = vdot2(p3,p3);
@@ -78,7 +78,7 @@ static bool circumCircle(const float* p1, const float* p2, const float* p3,
 		c[2] = (p1Sq*(p3[0]-p2[0]) + p2Sq*(p1[0]-p3[0]) + p3Sq*(p2[0]-p1[0])) / (2*cp);
 		r = vdist2(c, p1);
 		return true;
-  	}
+	}
 
 	c[0] = p1[0];
 	c[2] = p1[2];
diff --git a/extern/xdnd/CMakeLists.txt b/extern/xdnd/CMakeLists.txt
new file mode 100644
index 0000000..f7eded7
--- /dev/null
+++ b/extern/xdnd/CMakeLists.txt
@@ -0,0 +1,43 @@
+# ***** 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): Sergey Sharybin.
+#
+# ***** END GPL LICENSE BLOCK *****
+
+set(INC
+	.
+)
+
+set(INC_SYS
+
+)
+
+set(SRC
+	xdnd.c
+	xdnd.h
+)
+
+add_definitions(
+	-DHAVE_SYS_TIME_H
+)
+
+blender_add_lib(extern_xdnd "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/extern/xdnd/SConscript b/extern/xdnd/SConscript
new file mode 100644
index 0000000..6f1fe72
--- /dev/null
+++ b/extern/xdnd/SConscript
@@ -0,0 +1,10 @@
+#!/usr/bin/python
+
+Import('env')
+
+defs = ['HAVE_SYS_TIME_H']
+sources = env.Glob('*.c')
+
+incs = '.'
+
+env.BlenderLib ( 'extern_xdnd', sources, Split(incs), defs, libtype=['extern','player'], priority=[10, 185])
diff --git a/extern/xdnd/xdnd.c b/extern/xdnd/xdnd.c
new file mode 100644
index 0000000..9bdee89
--- /dev/null
+++ b/extern/xdnd/xdnd.c
@@ -0,0 +1,1599 @@
+/* xdnd.c, xdnd.h - C program library for handling the Xdnd protocol
+   Copyright (C) 1996-2000 Paul Sheer
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU 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.
+ */
+
+
+/* 
+   Released 1998-08-07
+   Changes:
+
+   2000-08-08: INCR protocol implemented.
+
+*/
+
+/*
+    DONE:
+     - INCR protocol now implemented
+
+    TODO:
+     - action_choose_dialog not yet supported (never called)
+     - widget_delete_selection not yet supported and DELETE requests are ignored
+     - not yet tested with applications that only supported XDND 0 or 1
+*/
+
+#include <X11/Xlib.h>
+#include <X11/X.h>
+#include <X11/Xatom.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+#  include <sys/time.h>
+# else
+#  include <time.h>
+# endif
+#endif
+#include <sys/types.h>
+#ifdef HAVE_UNISTD_H
+#   include <unistd.h>
+#endif
+
+#ifdef HAVE_SYS_SELECT_H
+#  include <sys/select.h>
+#endif
+
+#include "xdnd.h"
+
+static void xdnd_send_enter (DndClass * dnd, Window window, Window from, Atom * typelist);
+static void xdnd_send_position (DndClass * dnd, Window window, Window from, Atom action, int x, int y,
+                                unsigned long etime);
+static void xdnd_send_status (DndClass * dnd, Window window, Window from, int will_accept, int want_position,
+                              int x, int y, int w, int h, Atom action);
+static void xdnd_send_leave (DndClass * dnd, Window window, Window from);
+static void xdnd_send_drop (DndClass * dnd, Window window, Window from, unsigned long etime);
+static void xdnd_send_finished (DndClass * dnd, Window window, Window from, int error);
+static int xdnd_convert_selection (DndClass * dnd, Window window, Window requester, Atom type);
+static void xdnd_selection_send (DndClass * dnd, XSelectionRequestEvent * request, unsigned char *data,
+                                 int length);
+static int xdnd_get_selection (DndClass * dnd, Window from, Atom property, Window insert);
+
+
+/* just to remind us : */
+
+#if 0
+typedef struct {
+    int type;
+    unsigned long serial;
+    Bool send_event;
+    Display *display;
+    Window window;
+    Atom message_type;
+    int format;
+    union {
+        char b[20];
+        short s[10];
+        long l[5];
+    } data;
+} XClientMessageEvent;
+XClientMessageEvent xclient;
+#endif
+
+/* #define DND_DEBUG */
+
+#define xdnd_xfree(x) {if (x) { free (x); x = 0; }}
+
+#ifdef DND_DEBUG
+
+#include <sys/time.h>
+#include <unistd.h>
+
+char *xdnd_debug_milliseconds (void)
+{
+    struct timeval tv;
+    static char r[22];
+    gettimeofday (&tv, 0);
+    sprintf (r, "%.2ld.%.3ld", tv.tv_sec % 100L, tv.tv_usec / 1000L);
+    return r;
+}
+
+#define dnd_debug1(a)       printf("%s: %d: %s: " a "\n", __FILE__, __LINE__, xdnd_debug_milliseconds ())
+#define dnd_debug2(a,b)     printf("%s: %d: %s: " a "\n", __FILE__, __LINE__, xdnd_debug_milliseconds (), b)
+#define dnd_debug3(a,b,c)   printf("%s: %d: %s: " a "\n", __FILE__, __LINE__, xdnd_debug_milliseconds (), b, c)
+#define dnd_debug4(a,b,c,d) printf("%s: %d: %s: " a "\n", __FILE__, __LINE__, xdnd_debug_milliseconds (), b, c, d)
+#else
+#define dnd_debug1(a)       
+#define dnd_debug2(a,b)     
+#define dnd_debug3(a,b,c)   
+#define dnd_debug4(a,b,c,d) 
+#endif
+
+#define dnd_warning(a) fprintf (stderr, a)
+
+#define dnd_version_at_least(a,b) ((a) >= (b))
+
+static unsigned char dnd_copy_cursor_bits[] =
+{
+  0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x0f, 0x00, 0x02, 0x00, 0x08, 0x01,
+  0x02, 0x00, 0x08, 0x01, 0x02, 0x00, 0x08, 0x01, 0x02, 0x00, 0xe8, 0x0f,
+  0x02, 0x00, 0x08, 0x01, 0x02, 0x00, 0x08, 0x01, 0x02, 0x00, 0x08, 0x01,
+  0x02, 0x00, 0x08, 0x00, 0x02, 0x04, 0x08, 0x00, 0x02, 0x0c, 0x08, 0x00,
+  0x02, 0x1c, 0x08, 0x00, 0x02, 0x3c, 0x08, 0x00, 0x02, 0x7c, 0x08, 0x00,
+  0x02, 0xfc, 0x08, 0x00, 0x02, 0xfc, 0x09, 0x00, 0x02, 0xfc, 0x0b, 0x00,
+  0x02, 0x7c, 0x08, 0x00, 0xfe, 0x6d, 0x0f, 0x00, 0x00, 0xc4, 0x00, 0x00,
+  0x00, 0xc0, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
+  0x00, 0x00, 0x00, 0x00};
+
+static unsigned char dnd_copy_mask_bits[] =
+{
+  0xff, 0xff, 0x1f, 0x00, 0xff, 0xff, 0xff, 0x1f, 0xff, 0xff, 0xff, 0x1f,
+  0x07, 0x00, 0xfc, 0x1f, 0x07, 0x00, 0xfc, 0x1f, 0x07, 0x00, 0xfc, 0x1f,
+  0x07, 0x00, 0xfc, 0x1f, 0x07, 0x00, 0xfc, 0x1f, 0x07, 0x00, 0xfc, 0x1f,
+  0x07, 0x06, 0xfc, 0x1f, 0x07, 0x0e, 0xfc, 0x1f, 0x07, 0x1e, 0x1c, 0x00,
+  0x07, 0x3e, 0x1c, 0x00, 0x07, 0x7e, 0x1c, 0x00, 0x07, 0xfe, 0x1c, 0x00,
+  0x07, 0xfe, 0x1d, 0x00, 0x07, 0xfe, 0x1f, 0x00, 0x07, 0xfe, 0x1f, 0x00,
+  0xff, 0xff, 0x1f, 0x00, 0xff, 0xff, 0x1e, 0x00, 0xff, 0xef, 0x1f, 0x00,
+  0x00, 0xe6, 0x01, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0xc0, 0x03, 0x00,
+  0x00, 0x80, 0x01, 0x00};
+
+static unsigned char dnd_move_cursor_bits[] =
+{
+  0x00, 0x00, 0x00, 0xfe, 0xff, 0x0f, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08,
+  0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x00, 0x08,
+  0x02, 0x00, 0x08, 0x02, 0x00, 0x08, 0x02, 0x04, 0x08, 0x02, 0x0c, 0x08,
+  0x02, 0x1c, 0x08, 0x02, 0x3c, 0x08, 0x02, 0x7c, 0x08, 0x02, 0xfc, 0x08,
+  0x02, 0xfc, 0x09, 0x02, 0xfc, 0x0b, 0x02, 0x7c, 0x08, 0xfe, 0x6d, 0x0f,
+  0x00, 0xc4, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x80, 0x01, 0x00, 0x80, 0x01,
+  0x00, 0x00, 0x00};
+
+static unsigned char dnd_move_mask_bits[] =
+{
+  0xff, 0xff, 0x1f, 0xff, 0xff, 0x1f, 0xff, 0xff, 0x1f, 0x07, 0x00, 0x1c,
+  0x07, 0x00, 0x1c, 0x07, 0x00, 0x1c, 0x07, 0x00, 0x1c, 0x07, 0x00, 0x1c,
+  0x07, 0x00, 0x1c, 0x07, 0x06, 0x1c, 0x07, 0x0e, 0x1c, 0x07, 0x1e, 0x1c,
+  0x07, 0x3e, 0x1c, 0x07, 0x7e, 0x1c, 0x07, 0xfe, 0x1c, 0x07, 0xfe, 0x1d,
+  0x07, 0xfe, 0x1f, 0x07, 0xfe, 0x1f, 0xff, 0xff, 0x1f, 0xff, 0xff, 0x1e,
+  0xff, 0xef, 0x1f, 0x00, 0xe6, 0x01, 0x00, 0xc0, 0x03, 0x00, 0xc0, 0x03,
+  0x00, 0x80, 0x01};
+
+static unsigned char dnd_link_cursor_bits[] =
+{
+  0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x0f, 0x00, 0x02, 0x00, 0x08, 0x01,
+  0x02, 0x00, 0x88, 0x00, 0x02, 0x00, 0x48, 0x00, 0x02, 0x00, 0xe8, 0x0f,
+  0x02, 0x00, 0x48, 0x00, 0x02, 0x00, 0x88, 0x00, 0x02, 0x00, 0x08, 0x01,
+  0x02, 0x00, 0x08, 0x00, 0x02, 0x04, 0x08, 0x00, 0x02, 0x0c, 0x08, 0x00,
+  0x02, 0x1c, 0x08, 0x00, 0x02, 0x3c, 0x08, 0x00, 0x02, 0x7c, 0x08, 0x00,
+  0x02, 0xfc, 0x08, 0x00, 0x02, 0xfc, 0x09, 0x00, 0x02, 0xfc, 0x0b, 0x00,
+  0x02, 0x7c, 0x08, 0x00, 0xfe, 0x6d, 0x0f, 0x00, 0x00, 0xc4, 0x00, 0x00,
+  0x00, 0xc0, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
+  0x00, 0x00, 0x00, 0x00};
+
+static unsigned char dnd_link_mask_bits[] =
+{
+  0xff, 0xff, 0x1f, 0x00, 0xff, 0xff, 0xff, 0x1f, 0xff, 0xff, 0xff, 0x1f,
+  0x07, 0x00, 0xfc, 0x1f, 0x07, 0x00, 0xfc, 0x1f, 0x07, 0x00, 0xfc, 0x1f,
+  0x07, 0x00, 0xfc, 0x1f, 0x07, 0x00, 0xfc, 0x1f, 0x07, 0x00, 0xfc, 0x1f,
+  0x07, 0x06, 0xfc, 0x1f, 0x07, 0x0e, 0xfc, 0x1f, 0x07, 0x1e, 0x1c, 0x00,
+  0x07, 0x3e, 0x1c, 0x00, 0x07, 0x7e, 0x1c, 0x00, 0x07, 0xfe, 0x1c, 0x00,
+  0x07, 0xfe, 0x1d, 0x00, 0x07, 0xfe, 0x1f, 0x00, 0x07, 0xfe, 0x1f, 0x00,
+  0xff, 0xff, 0x1f, 0x00, 0xff, 0xff, 0x1e, 0x00, 0xff, 0xef, 0x1f, 0x00,
+  0x00, 0xe6, 0x01, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0xc0, 0x03, 0x00,
+  0x00, 0x80, 0x01, 0x00};
+
+static unsigned char dnd_ask_cursor_bits[] =
+{
+  0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x0f, 0x00, 0x02, 0x00, 0x88, 0x03,
+  0x02, 0x00, 0x48, 0x04, 0x02, 0x00, 0x08, 0x04, 0x02, 0x00, 0x08, 0x02,
+  0x02, 0x00, 0x08, 0x01, 0x02, 0x00, 0x08, 0x01, 0x02, 0x00, 0x08, 0x00,
+  0x02, 0x00, 0x08, 0x01, 0x02, 0x04, 0x08, 0x00, 0x02, 0x0c, 0x08, 0x00,
+  0x02, 0x1c, 0x08, 0x00, 0x02, 0x3c, 0x08, 0x00, 0x02, 0x7c, 0x08, 0x00,
+  0x02, 0xfc, 0x08, 0x00, 0x02, 0xfc, 0x09, 0x00, 0x02, 0xfc, 0x0b, 0x00,
+  0x02, 0x7c, 0x08, 0x00, 0xfe, 0x6d, 0x0f, 0x00, 0x00, 0xc4, 0x00, 0x00,
+  0x00, 0xc0, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00,
+  0x00, 0x00, 0x00, 0x00};
+
+static unsigned char dnd_ask_mask_bits[] =
+{
+  0xff, 0xff, 0x1f, 0x00, 0xff, 0xff, 0xff, 0x1f, 0xff, 0xff, 0xff, 0x1f,
+  0x07, 0x00, 0xfc, 0x1f, 0x07, 0x00, 0xfc, 0x1f, 0x07, 0x00, 0xfc, 0x1f,
+  0x07, 0x00, 0xfc, 0x1f, 0x07, 0x00, 0xfc, 0x1f, 0x07, 0x00, 0xfc, 0x1f,
+  0x07, 0x06, 0xfc, 0x1f, 0x07, 0x0e, 0xfc, 0x1f, 0x07, 0x1e, 0x1c, 0x00,
+  0x07, 0x3e, 0x1c, 0x00, 0x07, 0x7e, 0x1c, 0x00, 0x07, 0xfe, 0x1c, 0x00,
+  0x07, 0xfe, 0x1d, 0x00, 0x07, 0xfe, 0x1f, 0x00, 0x07, 0xfe, 0x1f, 0x00,
+  0xff, 0xff, 0x1f, 0x00, 0xff, 0xff, 0x1e, 0x00, 0xff, 0xef, 0x1f, 0x00,
+  0x00, 0xe6, 0x01, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0xc0, 0x03, 0x00,
+  0x00, 0x80, 0x01, 0x00};
+
+static DndCursor dnd_cursors[] =
+{
+    {29, 25, 10, 10, dnd_copy_cursor_bits, dnd_copy_mask_bits, "XdndActionCopy", 0, 0, 0, 0},
+    {21, 25, 10, 10, dnd_move_cursor_bits, dnd_move_mask_bits, "XdndActionMove", 0, 0, 0, 0},
+    {29, 25, 10, 10, dnd_link_cursor_bits, dnd_link_mask_bits, "XdndActionLink", 0, 0, 0, 0},
+    {29, 25, 10, 10, dnd_ask_cursor_bits, dnd_ask_mask_bits, "XdndActionAsk", 0, 0, 0, 0},
+    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+};
+
+void xdnd_reset (DndClass * dnd)
+{
+    dnd->stage = XDND_DROP_STAGE_IDLE;
+    dnd->dragging_version = 0;
+    dnd->internal_drag = 0;
+    dnd->want_position = 0;
+    dnd->ready_to_drop = 0;
+    dnd->will_accept = 0;
+    dnd->rectangle.x = dnd->rectangle.y = 0;
+    dnd->rectangle.width = dnd->rectangle.height = 0;
+    dnd->dropper_window = 0;
+    dnd->dropper_toplevel = 0;
+    dnd->dragger_window = 0;
+    dnd->dragger_typelist = 0;
+    dnd->desired_type = 0;
+    dnd->time = 0;
+}
+
+void xdnd_init (DndClass * dnd, Display * display)
+{
+    DndCursor *cursor;
+    XColor black, white;
+    memset (dnd, 0, sizeof (*dnd));
+
+    dnd->display = display;
+    dnd->root_window = DefaultRootWindow (display);
+    dnd->version = XDND_VERSION;
+
+    dnd->XdndAware = XInternAtom (dnd->display, "XdndAware", False);
+    dnd->XdndSelection = XInternAtom (dnd->display, "XdndSelection", False);
+    dnd->XdndEnter = XInternAtom (dnd->display, "XdndEnter", False);
+    dnd->XdndLeave = XInternAtom (dnd->display, "XdndLeave", False);
+    dnd->XdndPosition = XInternAtom (dnd->display, "XdndPosition", False);
+    dnd->XdndDrop = XInternAtom (dnd->display, "XdndDrop", False);
+    dnd->XdndFinished = XInternAtom (dnd->display, "XdndFinished", False);
+    dnd->XdndStatus = XInternAtom (dnd->display, "XdndStatus", False);
+    dnd->XdndActionCopy = XInternAtom (dnd->display, "XdndActionCopy", False);
+    dnd->XdndActionMove = XInternAtom (dnd->display, "XdndActionMove", False);
+    dnd->XdndActionLink = XInternAtom (dnd->display, "XdndActionLink", False);
+    dnd->XdndActionAsk = XInternAtom (dnd->display, "XdndActionAsk", False);
+    dnd->XdndActionPrivate = XInternAtom (dnd->display, "XdndActionPrivate", False);
+    dnd->XdndTypeList = XInternAtom (dnd->display, "XdndTypeList", False);
+    dnd->XdndActionList = XInternAtom (dnd->display, "XdndActionList", False);
+    dnd->XdndActionDescription = XInternAtom (dnd->display, "XdndActionDescription", False);
+
+    dnd->Xdnd_NON_PROTOCOL_ATOM = XInternAtom (dnd->display, "JXSelectionWindowProperty", False);
+
+    xdnd_reset (dnd);
+
+    dnd->cursors = dnd_cursors;
+
+    black.pixel = BlackPixel (dnd->display, DefaultScreen (dnd->display));
+    white.pixel = WhitePixel (dnd->display, DefaultScreen (dnd->display));
+
+    XQueryColor (dnd->display, DefaultColormap (dnd->display, DefaultScreen (dnd->display)), &black);
+    XQueryColor (dnd->display, DefaultColormap (dnd->display, DefaultScreen (dnd->display)), &white);
+
+    for (cursor = &dnd->cursors[0]; cursor->width; cursor++) {
+        cursor->image_pixmap = XCreateBitmapFromData \
+            (dnd->display, dnd->root_window, (char *) cursor->image_data, cursor->width, cursor->height);
+        cursor->mask_pixmap = XCreateBitmapFromData \
+            (dnd->display, dnd->root_window, (char *) cursor->mask_data, cursor->width, cursor->height);
+        cursor->cursor = XCreatePixmapCursor (dnd->display, cursor->image_pixmap,
+              cursor->mask_pixmap, &black, &white, cursor->x, cursor->y);
+        XFreePixmap (dnd->display, cursor->image_pixmap);
+        XFreePixmap (dnd->display, cursor->mask_pixmap);
+        cursor->action = XInternAtom (dnd->display, cursor->_action, False);
+    }
+}
+
+void xdnd_shut (DndClass * dnd)
+{
+    DndCursor *cursor;
+    for (cursor = &dnd->cursors[0]; cursor->width; cursor++)
+        XFreeCursor (dnd->display, cursor->cursor);
+    memset (dnd, 0, sizeof (*dnd));
+    return;
+}
+
+
+/* typelist is a null terminated array */
+static int array_length (Atom * a)
+{
+    int n;
+    for (n = 0; a[n]; n++);
+    return n;
+}
+
+void xdnd_set_dnd_aware (DndClass * dnd, Window window, Atom * typelist)
+{
+    Window root_return, parent;
+    unsigned int nchildren_return;
+    Window *children_return = 0;
+    int r, s;
+    if(!window) return;
+    if (dnd->widget_exists)
+        if (!(*dnd->widget_exists) (dnd, window))
+            return;
+    s = XChangeProperty (dnd->display, window, dnd->XdndAware, XA_ATOM, 32, PropModeReplace,
+                         (unsigned char *) &dnd->version, 1);
+#if 1
+    dnd_debug4 ("XChangeProperty() = %d, window = %ld, widget = %s", s, window, "<WIDGET>");
+#endif
+    if (s && typelist) {
+        int n;
+        n = array_length (typelist);
+        if (n)
+            s = XChangeProperty (dnd->display, window, dnd->XdndAware, XA_ATOM, 32, PropModeAppend,
+                                 (unsigned char *) typelist, n);
+    }
+    r =
+        XQueryTree (dnd->display, window, &root_return, &parent, &children_return,
+                    &nchildren_return);
+    if (children_return)
+        XFree (children_return);
+    if (r)
+        xdnd_set_dnd_aware (dnd, parent, typelist);
+}
+
+int xdnd_is_dnd_aware (DndClass * dnd, Window window, int *version, Atom * typelist)
+{
+    Atom actual;
+    int format;
+    unsigned long count, remaining;
+    unsigned char *data = 0;
+    Atom *types, *t;
+    int result = 1;
+
+    *version = 0;
+    XGetWindowProperty (dnd->display, window, dnd->XdndAware,
+                        0, 0x8000000L, False, XA_ATOM,
+                        &actual, &format,
+                        &count, &remaining, &data);
+
+    if (actual != XA_ATOM || format != 32 || count == 0 || !data) {
+        dnd_debug2 ("XGetWindowProperty failed in xdnd_is_dnd_aware - XdndAware = %ld", dnd->XdndAware);
+        if (data)
+            XFree (data);
+        return 0;
+    }
+    types = (Atom *) data;
+#if XDND_VERSION >= 3
+    if (types[0] < 3) {
+        if (data)
+            XFree (data);
+        return 0;
+    }
+#endif
+    *version = dnd->version < types[0] ? dnd->version : types[0];        /* minimum */
+    dnd_debug2 ("Using XDND version %d", *version);
+    if (count > 1) {
+        result = 0;
+        for (t = typelist; *t; t++) {
+            int j;
+            for (j = 1; j < count; j++) {
+                if (types[j] == *t) {
+                    result = 1;
+                    break;
+                }
+            }
+            if (result)
+                break;
+        }
+    }
+    XFree (data);
+    return result;
+}
+
+void xdnd_set_type_list (DndClass * dnd, Window window, Atom * typelist)
+{
+    int n;
+    n = array_length (typelist);
+    XChangeProperty (dnd->display, window, dnd->XdndTypeList, XA_ATOM, 32,
+                     PropModeReplace, (unsigned char *) typelist, n);
+}
+
+/* result must be free'd */
+void xdnd_get_type_list (DndClass * dnd, Window window, Atom ** typelist)
+{
+    Atom type, *a;
+    int format, i;
+    unsigned long count, remaining;
+    unsigned char *data = NULL;
+
+    *typelist = 0;
+
+    XGetWindowProperty (dnd->display, window, dnd->XdndTypeList,
+                        0, 0x8000000L, False, XA_ATOM,
+                        &type, &format, &count, &remaining, &data);
+
+    if (type != XA_ATOM || format != 32 || count == 0 || !data) {
+        if (data)
+            XFree (data);
+        dnd_debug2 ("XGetWindowProperty failed in xdnd_get_type_list - dnd->XdndTypeList = %ld", dnd->XdndTypeList);
+        return;
+    }
+    *typelist = malloc ((count + 1) * sizeof (Atom));
+    a = (Atom *) data;
+    for (i = 0; i < count; i++)
+        (*typelist)[i] = a[i];
+    (*typelist)[count] = 0;
+
+    XFree (data);
+}
+
+void xdnd_get_three_types (DndClass * dnd, XEvent * xevent, Atom ** typelist)
+{
+    int i;
+    *typelist = malloc ((XDND_THREE + 1) * sizeof (Atom));
+    for (i = 0; i < XDND_THREE; i++)
+        (*typelist)[i] = XDND_ENTER_TYPE (xevent, i);
+    (*typelist)[XDND_THREE] = 0;        /* although (*typelist)[1] or (*typelist)[2] may also be set to nill */
+}
+
+/* result must be free'd */
+static char *concat_string_list (char **t, int *bytes)
+{
+    int l, n;
+    char *s;
+    for (l = n = 0;; n++) {
+        if (!t[n])
+            break;
+        if (!t[n][0])
+            break;
+        l += strlen (t[n]) + 1;
+    }
+    s = malloc (l + 1);
+    for (l = n = 0;; n++) {
+        if (!t[n])
+            break;
+        if (!(t[n][0]))
+            break;
+        strcpy (s + l, t[n]);
+        l += strlen (t[n]) + 1;
+    }
+    *bytes = l;
+    s[l] = '\0';
+    return s;
+}
+
+void xdnd_set_actions (DndClass * dnd, Window window, Atom * actions, char **descriptions)
+{
+    int n, l;
+    char *s;
+    n = array_length (actions);
+
+    XChangeProperty (dnd->display, window, dnd->XdndActionList, XA_ATOM, 32,
+                     PropModeReplace, (unsigned char *) actions, n);
+
+    s = concat_string_list (descriptions, &l);
+    XChangeProperty (dnd->display, window, dnd->XdndActionList, XA_STRING, 8,
+                     PropModeReplace, (unsigned char *) s, l);
+    xdnd_xfree (s);
+}
+
+/* returns 1 on error or no actions, otherwise result must be free'd 
+   xdnd_get_actions (window, &actions, &descriptions);
+   free (actions); free (descriptions); */
+int xdnd_get_actions (DndClass * dnd, Window window, Atom ** actions, char ***descriptions)
+{
+    Atom type, *a;
+    int format, i;
+    unsigned long count, dcount, remaining;
+    unsigned char *data = 0, *r;
+
+    *actions = 0;
+    *descriptions = 0;
+    XGetWindowProperty (dnd->display, window, dnd->XdndActionList,
+                        0, 0x8000000L, False, XA_ATOM,
+                        &type, &format, &count, &remaining, &data);
+
+    if (type != XA_ATOM || format != 32 || count == 0 || !data) {
+        if (data)
+            XFree (data);
+        return 1;
+    }
+    *actions = malloc ((count + 1) * sizeof (Atom));
+    a = (Atom *) data;
+    for (i = 0; i < count; i++)
+        (*actions)[i] = a[i];
+    (*actions)[count] = 0;
+
+    XFree (data);
+
+    data = 0;
+    XGetWindowProperty (dnd->display, window, dnd->XdndActionDescription,
+                        0, 0x8000000L, False, XA_STRING, &type, &format,
+                        &dcount, &remaining, &data);
+
+    if (type != XA_STRING || format != 8 || dcount == 0) {
+        if (data)
+            XFree (data);
+        *descriptions = malloc ((count + 1) * sizeof (char *));
+        dnd_warning ("XGetWindowProperty no property or wrong format for action descriptions");
+        for (i = 0; i < count; i++)
+            (*descriptions)[i] = "";
+        (*descriptions)[count] = 0;
+    } else {
+        int l;
+        l = (count + 1) * sizeof (char *);
+        *descriptions = malloc (l + dcount);
+        memcpy (*descriptions + l, data, dcount);
+        XFree (data);
+        data = (unsigned char *) *descriptions;
+        data += l;
+        l = 0;
+        for (i = 0, r = data;; r += l + 1, i++) {
+            l = strlen ((char *) r);
+            if (!l || i >= count)
+                break;
+            (*descriptions)[i] = (char *) r;
+        }
+        for (; i < count; i++) {
+            (*descriptions)[i] = "";
+        }
+        (*descriptions)[count] = 0;
+    }
+    return 0;
+}
+
+/* returns non-zero on cancel */
+int xdnd_choose_action_dialog (DndClass * dnd, Atom * actions, char **descriptions, Atom * result)
+{
+    if (!actions[0])
+        return 1;
+    if (!dnd->action_choose_dialog) {        /* default to return the first action if no dialog set */
+        *result = actions[0];
+        return 0;
+    }
+    return (*dnd->action_choose_dialog) (dnd, descriptions, actions, result);
+}
+
+static void xdnd_send_event (DndClass * dnd, Window window, XEvent * xevent)
+{
+    dnd_debug4 ("xdnd_send_event(), window = %ld, l[0] = %ld, l[4] = %ld",
+    window, xevent->xclient.data.l[0], xevent->xclient.data.l[4]);
+    dnd_debug2 ("xdnd_send_event(), from widget widget %s", (char *) "<WIDGET>");
+    XSendEvent (dnd->display, window, 0, 0, xevent);
+}
+
+static void xdnd_send_enter (DndClass * dnd, Window window, Window from, Atom * typelist)
+{
+    XEvent xevent;
+    int n, i;
+    n = array_length (typelist);
+
+    memset (&xevent, 0, sizeof (xevent));
+
+    xevent.xany.type = ClientMessage;
+    xevent.xany.display = dnd->display;
+    xevent.xclient.window = window;
+    xevent.xclient.message_type = dnd->XdndEnter;
+    xevent.xclient.format = 32;
+
+    XDND_ENTER_SOURCE_WIN (&xevent) = from;
+    XDND_ENTER_THREE_TYPES_SET (&xevent, n > XDND_THREE);
+    XDND_ENTER_VERSION_SET (&xevent, dnd->version);
+    for (i = 0; i < n && i < XDND_THREE; i++)
+        XDND_ENTER_TYPE (&xevent, i) = typelist[i];
+    xdnd_send_event (dnd, window, &xevent);
+}
+
+static void xdnd_send_position (DndClass * dnd, Window window, Window from, Atom action, int x, int y, unsigned long time)
+{
+    XEvent xevent;
+
+    memset (&xevent, 0, sizeof (xevent));
+
+    xevent.xany.type = ClientMessage;
+    xevent.xany.display = dnd->display;
+    xevent.xclient.window = window;
+    xevent.xclient.message_type = dnd->XdndPosition;
+    xevent.xclient.format = 32;
+
+    XDND_POSITION_SOURCE_WIN (&xevent) = from;
+    XDND_POSITION_ROOT_SET (&xevent, x, y);
+    if (dnd_version_at_least (dnd->dragging_version, 1))
+        XDND_POSITION_TIME (&xevent) = time;
+    if (dnd_version_at_least (dnd->dragging_version, 2))
+        XDND_POSITION_ACTION (&xevent) = action;
+
+    xdnd_send_event (dnd, window, &xevent);
+}
+
+static void xdnd_send_status (DndClass * dnd, Window window, Window from, int will_accept, \
+              int want_position, int x, int y, int w, int h, Atom action)
+{
+    XEvent xevent;
+
+    memset (&xevent, 0, sizeof (xevent));
+
+    xevent.xany.type = ClientMessage;
+    xevent.xany.display = dnd->display;
+    xevent.xclient.window = window;
+    xevent.xclient.message_type = dnd->XdndStatus;
+    xevent.xclient.format = 32;
+
+    XDND_STATUS_TARGET_WIN (&xevent) = from;
+    XDND_STATUS_WILL_ACCEPT_SET (&xevent, will_accept);
+    if (will_accept)
+        XDND_STATUS_WANT_POSITION_SET (&xevent, want_position);
+    if (want_position)
+        XDND_STATUS_RECT_SET (&xevent, x, y, w, h);
+    if (dnd_version_at_least (dnd->dragging_version, 2))
+        if (will_accept)
+            XDND_STATUS_ACTION (&xevent) = action;
+
+    xdnd_send_event (dnd, window, &xevent);
+}
+
+static void xdnd_send_leave (DndClass * dnd, Window window, Window from)
+{
+    XEvent xevent;
+
+    memset (&xevent, 0, sizeof (xevent));
+
+    xevent.xany.type = ClientMessage;
+    xevent.xany.display = dnd->display;
+    xevent.xclient.window = window;
+    xevent.xclient.message_type = dnd->XdndLeave;
+    xevent.xclient.format = 32;
+
+    XDND_LEAVE_SOURCE_WIN (&xevent) = from;
+
+    xdnd_send_event (dnd, window, &xevent);
+}
+
+static void xdnd_send_drop (DndClass * dnd, Window window, Window from, unsigned long time)
+{
+    XEvent xevent;
+
+    memset (&xevent, 0, sizeof (xevent));
+
+    xevent.xany.type = ClientMessage;
+    xevent.xany.display = dnd->display;
+    xevent.xclient.window = window;
+    xevent.xclient.message_type = dnd->XdndDrop;
+    xevent.xclient.format = 32;
+
+    XDND_DROP_SOURCE_WIN (&xevent) = from;
+    if (dnd_version_at_least (dnd->dragging_version, 1))
+        XDND_DROP_TIME (&xevent) = time;
+
+    xdnd_send_event (dnd, window, &xevent);
+}
+
+/* error is not actually used, i think future versions of the protocol should return an error status
+   to the calling window with the XdndFinished client message */
+static void xdnd_send_finished (DndClass * dnd, Window window, Window from, int error)
+{
+    XEvent xevent;
+
+    memset (&xevent, 0, sizeof (xevent));
+
+    xevent.xany.type = ClientMessage;
+    xevent.xany.display = dnd->display;
+    xevent.xclient.window = window;
+    xevent.xclient.message_type = dnd->XdndFinished;
+    xevent.xclient.format = 32;
+
+    XDND_FINISHED_TARGET_WIN (&xevent) = from;
+
+    xdnd_send_event (dnd, window, &xevent);
+}
+
+/* returns non-zero on error - i.e. no selection owner set. Type is of course the mime type */
+static int xdnd_convert_selection (DndClass * dnd, Window window, Window requester, Atom type)
+{
+    if (!(window = XGetSelectionOwner (dnd->display, dnd->XdndSelection))) {
+        dnd_debug1 ("xdnd_convert_selection(): XGetSelectionOwner failed");
+        return 1;
+    }
+    XConvertSelection (dnd->display, dnd->XdndSelection, type,
+                    dnd->Xdnd_NON_PROTOCOL_ATOM, requester, CurrentTime);
+    return 0;
+}
+
+/* returns non-zero on error */
+static int xdnd_set_selection_owner (DndClass * dnd, Window window, Atom type, Time time)
+{
+    if (!XSetSelectionOwner (dnd->display, dnd->XdndSelection, window, time)) {
+        dnd_debug1 ("xdnd_set_selection_owner(): XSetSelectionOwner failed");
+        return 1;
+    }
+    return 0;
+}
+
+static void xdnd_selection_send (DndClass * dnd, XSelectionRequestEvent * request, unsigned char *data, int length)
+{
+    XEvent xevent;
+    dnd_debug2 ("      requestor = %ld", request->requestor);
+    dnd_debug2 ("      property = %ld", request->property);
+    dnd_debug2 ("      length = %d", length);
+    XChangeProperty (dnd->display, request->requestor, request->property,
+                     request->target, 8, PropModeReplace, data, length);
+    xevent.xselection.type = SelectionNotify;
+    xevent.xselection.property = request->property;
+    xevent.xselection.display = request->display;
+    xevent.xselection.requestor = request->requestor;
+    xevent.xselection.selection = request->selection;
+    xevent.xselection.target = request->target;
+    xevent.xselection.time = request->time;
+    xdnd_send_event (dnd, request->requestor, &xevent);
+}
+
+#if 0
+/* respond to a notification that a primary selection has been sent */
+int xdnd_get_selection (DndClass * dnd, Window from, Atom property, Window insert)
+{
+    long read;
+    int error = 0;
+    unsigned long remaining;
+    if (!property)
+        return 1;
+    read = 0;
+    do {
+        unsigned char *s;
+        Atom actual;
+        int format;
+        unsigned long count;
+        if (XGetWindowProperty (dnd->display, insert, property, read / 4, 65536, 1,
+                                AnyPropertyType, &actual, &format,
+                                &count, &remaining,
+                                &s) != Success) {
+            XFree (s);
+            return 1;
+        }
+        read += count;
+        if (dnd->widget_insert_drop && !error)
+            error = (*dnd->widget_insert_drop) (dnd, s, count, remaining, insert, from, actual);
+        XFree (s);
+    } while (remaining);
+    return error;
+}
+#endif
+
+static int paste_prop_internal (DndClass * dnd, Window from, Window insert, unsigned long prop, int delete_prop)
+{
+    long nread = 0;
+    unsigned long nitems;
+    unsigned long bytes_after;
+    int error = 0;
+    do {
+        Atom actual_type;
+        int actual_fmt;
+        unsigned char *s = 0;
+        if (XGetWindowProperty (dnd->display, insert, prop,
+                                nread / 4, 65536, delete_prop,
+                                AnyPropertyType, &actual_type, &actual_fmt,
+                                &nitems, &bytes_after, &s) != Success) {
+            XFree (s);
+            return 1;
+        }
+        nread += nitems;
+        if (dnd->widget_insert_drop && !error)
+            error = (*dnd->widget_insert_drop) (dnd, s, nitems, bytes_after, insert, from, actual_fmt);
+        XFree (s);
+    } while (bytes_after);
+    if (!nread)
+        return 1;
+    return 0;
+}
+
+/*
+ * Respond to a notification that a primary selection has been sent (supports INCR)
+ */
+static int xdnd_get_selection (DndClass * dnd, Window from, Atom prop, Window insert)
+{
+    struct timeval tv, tv_start;
+    unsigned long bytes_after;
+    Atom actual_type;
+    int actual_fmt;
+    unsigned long nitems;
+    unsigned char *s = 0;
+    if (prop == None)
+        return 1;
+    if (XGetWindowProperty
+        (dnd->display, insert, prop, 0, 8, False, AnyPropertyType, &actual_type, &actual_fmt,
+         &nitems, &bytes_after, &s) != Success) {
+        XFree (s);
+        return 1;
+    }
+    XFree (s);
+    if (actual_type != XInternAtom (dnd->display, "INCR", False))
+        return paste_prop_internal (dnd, from, insert, prop, True);
+    XDeleteProperty (dnd->display, insert, prop);
+    gettimeofday (&tv_start, 0);
+    for (;;) {
+        long t;
+        fd_set r;
+        XEvent xe;
+        if (XCheckMaskEvent (dnd->display, PropertyChangeMask, &xe)) {
+            if (xe.type == PropertyNotify && xe.xproperty.state == PropertyNewValue) {
+/* time between arrivals of data */
+                gettimeofday (&tv_start, 0);
+                if (paste_prop_internal (dnd, from, insert, prop, True))
+                    break;
+            }
+        } else {
+            tv.tv_sec = 0;
+            tv.tv_usec = 10000;
+            FD_ZERO (&r);
+            FD_SET (ConnectionNumber (dnd->display), &r);
+            select (ConnectionNumber (dnd->display) + 1, &r, 0, 0, &tv);
+            if (FD_ISSET (ConnectionNumber (dnd->display), &r))
+                continue;
+        }
+        gettimeofday (&tv, 0);
+        t = (tv.tv_sec - tv_start.tv_sec) * 1000000L + (tv.tv_usec - tv_start.tv_usec);
+/* no data for five seconds, so quit */
+        if (t > 5000000L)
+            return 1;
+    }
+    return 0;
+}
+
+
+int outside_rectangle (int x, int y, XRectangle * r)
+{
+    return (x < r->x || y < r->y || x >= r->x + r->width || y >= r->y + r->height);
+}
+
+/* avoids linking with the maths library */
+static float xdnd_sqrt (float x)
+{
+    float last_ans, ans = 2, a;
+    if (x <= 0.0)
+        return 0.0;
+    do {
+        last_ans = ans;
+        ans = (ans + x / ans) / 2;
+        a = (ans - last_ans) / ans;
+        if (a < 0.0)
+            a = (-a);
+    } while (a > 0.001);
+    return ans;
+}
+
+#define print_marks print_win_marks(from,__FILE__,__LINE__);
+
+/* returns action on success, 0 otherwise */
+Atom xdnd_drag (DndClass * dnd, Window from, Atom action, Atom * typelist)
+{
+    XEvent xevent, xevent_temp;
+    Window over_window = 0, last_window = 0;
+#if XDND_VERSION >= 3
+    Window last_dropper_toplevel = 0;
+    int internal_dropable = 1;
+#endif
+    int n;
+    DndCursor *cursor;
+    float x_mouse, y_mouse;
+    int result = 0, dnd_aware;
+
+    if (!typelist)
+        dnd_warning ("xdnd_drag() called with typelist = 0");
+
+/* first wait until the mouse moves more than five pixels */
+    do {
+        XNextEvent (dnd->display, &xevent);
+        if (xevent.type == ButtonRelease) {
+            dnd_debug1 ("button release - no motion");
+            XSendEvent (dnd->display, xevent.xany.window, 0, ButtonReleaseMask, &xevent);
+            return 0;
+        }
+    } while (xevent.type != MotionNotify);
+
+    x_mouse = (float) xevent.xmotion.x_root;
+    y_mouse = (float) xevent.xmotion.y_root;
+
+    if (!dnd->drag_threshold)
+        dnd->drag_threshold = 4.0;
+    for (;;) {
+        XNextEvent (dnd->display, &xevent);
+        if (xevent.type == MotionNotify)
+            if (xdnd_sqrt ((x_mouse - xevent.xmotion.x_root) * (x_mouse - xevent.xmotion.x_root) +
+                           (y_mouse - xevent.xmotion.y_root) * (y_mouse - xevent.xmotion.y_root)) > dnd->drag_threshold)
+                break;
+        if (xevent.type == ButtonRelease) {
+            XSendEvent (dnd->display, xevent.xany.window, 0, ButtonReleaseMask, &xevent);
+            return 0;
+        }
+    }
+
+    dnd_debug1 ("moved 5 pixels - going to drag");
+
+    n = array_length (typelist);
+    if (n > XDND_THREE)
+        xdnd_set_type_list (dnd, from, typelist);
+
+    xdnd_reset (dnd);
+
+    dnd->stage = XDND_DRAG_STAGE_DRAGGING;
+
+    for (cursor = &dnd->cursors[0]; cursor->width; cursor++)
+        if (cursor->action == action)
+            break;
+    if (!cursor->width)
+        cursor = &dnd->cursors[0];
+
+/* the mouse has been dragged a little, so this is a drag proper */
+    if (XGrabPointer (dnd->display, dnd->root_window, False,
+                      ButtonMotionMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask,
+                      GrabModeAsync, GrabModeAsync, None,
+                      cursor->cursor, CurrentTime) != GrabSuccess)
+        dnd_debug1 ("Unable to grab pointer");
+
+
+    while (xevent.xany.type != ButtonRelease) {
+        XAllowEvents (dnd->display, SyncPointer, CurrentTime);
+        XNextEvent (dnd->display, &xevent);
+        switch (xevent.type) {
+        case Expose:
+            if (dnd->handle_expose_events)
+                (*dnd->handle_expose_events) (dnd, &xevent);
+            break;
+        case EnterNotify:
+/* this event is not actually reported, so we find out by ourselves from motion events */
+            break;
+        case LeaveNotify:
+/* this event is not actually reported, so we find out by ourselves from motion events */
+            break;
+        case ButtonRelease:
+/* done, but must send a leave event */
+            dnd_debug1 ("ButtonRelease - exiting event loop");
+            break;
+        case MotionNotify:
+            dnd_aware = 0;
+            dnd->dropper_toplevel = 0;
+            memcpy (&xevent_temp, &xevent, sizeof (xevent));
+            xevent.xmotion.subwindow = xevent.xmotion.window;
+            {
+                Window root_return, child_return;
+                int x_temp, y_temp;
+                unsigned int mask_return;
+                while (XQueryPointer (dnd->display, xevent.xmotion.subwindow, &root_return, &child_return,
+                                      &x_temp, &y_temp, &xevent.xmotion.x,
+                                      &xevent.xmotion.y, &mask_return)) {
+#if XDND_VERSION >= 3
+                    if (!dnd_aware) {
+                        if ((dnd_aware = xdnd_is_dnd_aware (dnd, xevent.xmotion.subwindow, &dnd->dragging_version, typelist))) {
+                            dnd->dropper_toplevel = xevent.xmotion.subwindow;
+                            xevent.xmotion.x_root = x_temp;
+                            xevent.xmotion.y_root = y_temp;
+                        }
+                    }
+#else
+                    xevent.xmotion.x_root = x_temp;
+                    xevent.xmotion.y_root = y_temp;
+#endif
+                    if (!child_return)
+                        goto found_descendent;
+                    xevent.xmotion.subwindow = child_return;
+                }
+                break;
+            }
+          found_descendent:
+
+/* last_window is just for debug purposes */
+            if (last_window != xevent.xmotion.subwindow) {
+                dnd_debug2 ("window crossing to %ld", xevent.xmotion.subwindow);
+                dnd_debug2 ("  current window is %ld", over_window);
+                dnd_debug3 ("     last_window = %ld, xmotion.subwindow = %ld", last_window, xevent.xmotion.subwindow);
+#if XDND_VERSION >= 3
+                dnd_debug3 ("     dropper_toplevel = %ld, last_dropper_toplevel.subwindow = %ld", dnd->dropper_toplevel, last_dropper_toplevel);
+#endif
+                dnd_debug3 ("     dnd_aware = %d, dnd->options & XDND_OPTION_NO_HYSTERESIS = %ld", dnd_aware, (long) dnd->options & XDND_OPTION_NO_HYSTERESIS);
+            }
+
+#if XDND_VERSION < 3
+/* is the new window dnd aware? if not stay in the old window */
+            if (over_window != xevent.xmotion.subwindow &&
+                last_window != xevent.xmotion.subwindow &&
+                (
+                    (dnd_aware = xdnd_is_dnd_aware (dnd, xevent.xmotion.subwindow, &dnd->dragging_version, typelist))
+                    ||
+                    (dnd->options & XDND_OPTION_NO_HYSTERESIS)
+                ))
+#else
+            internal_dropable = 1;
+            if (dnd->widget_exists && (*dnd->widget_exists) (dnd, xevent.xmotion.subwindow))
+                if (!xdnd_is_dnd_aware (dnd, xevent.xmotion.subwindow, &dnd->dragging_version, typelist))
+                    internal_dropable = 0;
+            dnd_debug3 ("dnd->dropper_toplevel = %ld, last_dropper_toplevel = %ld\n", dnd->dropper_toplevel, last_dropper_toplevel);
+            if ((dnd->dropper_toplevel != last_dropper_toplevel ||
+                last_window != xevent.xmotion.subwindow) && internal_dropable &&
+                (
+                    (dnd_aware)
+                    ||
+                    (dnd->options & XDND_OPTION_NO_HYSTERESIS)
+                ))
+#endif
+            {
+/* leaving window we were over */
+                if (over_window) {
+                    if (dnd->stage == XDND_DRAG_STAGE_ENTERED) {
+                        dnd_debug1 ("got leave at right stage");
+                        dnd->stage = XDND_DRAG_STAGE_DRAGGING;
+                        if (dnd->internal_drag) {
+                            dnd_debug1 ("  our own widget");
+                            if (dnd->widget_apply_leave)
+                                (*dnd->widget_apply_leave) (dnd, over_window);
+                        } else {
+                            dnd_debug1 ("  not our widget - sending XdndLeave");
+#if XDND_VERSION < 3
+                            xdnd_send_leave (dnd, over_window, from);
+#else
+                            if (dnd->dropper_toplevel != last_dropper_toplevel) {
+                                xdnd_send_leave (dnd, last_dropper_toplevel, from);
+                            } else {
+                                dnd_debug1 ("    not sending leave --> dnd->dropper_toplevel == last_dropper_toplevel");
+                            }
+#endif
+                        }
+                        dnd->internal_drag = 0;
+                        dnd->dropper_window = 0;
+                        dnd->ready_to_drop = 0;
+                    } else {
+                        dnd_debug1 ("got leave at wrong stage - ignoring");
+                    }
+                }
+/* entering window we are currently over */
+                over_window = xevent.xmotion.subwindow;
+                if (dnd_aware) {
+                    dnd_debug1 ("  is dnd aware");
+                    dnd->stage = XDND_DRAG_STAGE_ENTERED;
+                    if (dnd->widget_exists && (*dnd->widget_exists) (dnd, over_window))
+                        dnd->internal_drag = 1;
+                    if (dnd->internal_drag) {
+                        dnd_debug1 ("    our own widget");
+                    } else {
+                        dnd_debug2 ("    not our widget - sending XdndEnter to %ld", over_window);
+#if XDND_VERSION < 3
+                        xdnd_send_enter (dnd, over_window, from, typelist);
+#else
+                        if (dnd->dropper_toplevel != last_dropper_toplevel)
+                            xdnd_send_enter (dnd, dnd->dropper_toplevel, from, typelist);
+#endif
+                    }
+                    dnd->want_position = 1;
+                    dnd->ready_to_drop = 0;
+                    dnd->rectangle.width = dnd->rectangle.height = 0;
+                    dnd->dropper_window = over_window;
+/* we want an additional motion event in case the pointer enters and then stops */
+                    XSendEvent (dnd->display, from, 0, ButtonMotionMask, &xevent_temp);
+                    XSync (dnd->display, 0);
+                }
+#if XDND_VERSION >= 3
+                last_dropper_toplevel = dnd->dropper_toplevel;
+#endif
+/* we are now officially in a new window */
+            } else {
+/* got here, so we are just moving `inside' the same window */
+                if (dnd->stage == XDND_DRAG_STAGE_ENTERED) {
+                    dnd->supported_action = dnd->XdndActionCopy;
+                    dnd_debug1 ("got motion at right stage");
+                    dnd->x = xevent.xmotion.x_root;
+                    dnd->y = xevent.xmotion.y_root;
+                    if (dnd->want_position || outside_rectangle (dnd->x, dnd->y, &dnd->rectangle)) {
+                        dnd_debug1 ("  want position and outside rectangle");
+                        if (dnd->internal_drag) {
+                            dnd_debug1 ("    our own widget");
+                            dnd->ready_to_drop = (*dnd->widget_apply_position) (dnd, over_window, from,
+                                                                                action, dnd->x, dnd->y, xevent.xmotion.time, typelist,
+                                                                                &dnd->want_position, &dnd->supported_action, &dnd->desired_type, &dnd->rectangle);
+                            /* if not ready, keep sending positions, this check is repeated below for XdndStatus from external widgets */
+                            if (!dnd->ready_to_drop) {
+                                dnd->want_position = 1;
+                                dnd->rectangle.width = dnd->rectangle.height = 0;
+                            }
+                            dnd_debug2 ("      return action=%ld", dnd->supported_action);
+                        } else {
+#if XDND_VERSION < 3
+                            dnd_debug3 ("    not our own widget - sending XdndPosition to %ld, action %ld", over_window, action);
+                            xdnd_send_position (dnd, over_window, from, action, dnd->x, dnd->y, xevent.xmotion.time);
+#else
+                            dnd_debug3 ("    not our own widget - sending XdndPosition to %ld, action %ld", dnd->dropper_toplevel, action);
+                            xdnd_send_position (dnd, dnd->dropper_toplevel, from, action, dnd->x, dnd->y, xevent.xmotion.time);
+#endif
+                        }
+                    } else if (dnd->want_position) {
+                        dnd_debug1 ("  inside rectangle");
+                    } else {
+                        dnd_debug1 ("  doesn't want position");
+                    }
+                }
+            }
+            last_window = xevent.xmotion.subwindow;
+            break;
+        case ClientMessage:
+            dnd_debug1 ("ClientMessage recieved");
+            if (xevent.xclient.message_type == dnd->XdndStatus && !dnd->internal_drag) {
+                dnd_debug1 ("  XdndStatus recieved");
+                if (dnd->stage == XDND_DRAG_STAGE_ENTERED 
+#if XDND_VERSION < 3
+                        && XDND_STATUS_TARGET_WIN (&xevent) == dnd->dropper_window
+#endif
+                ) {
+                    dnd_debug1 ("    XdndStatus stage correct, dropper window correct");
+                    dnd->want_position = XDND_STATUS_WANT_POSITION (&xevent);
+                    dnd->ready_to_drop = XDND_STATUS_WILL_ACCEPT (&xevent);
+                    dnd->rectangle.x = XDND_STATUS_RECT_X (&xevent);
+                    dnd->rectangle.y = XDND_STATUS_RECT_Y (&xevent);
+                    dnd->rectangle.width = XDND_STATUS_RECT_WIDTH (&xevent);
+                    dnd->rectangle.height = XDND_STATUS_RECT_HEIGHT (&xevent);
+                    dnd->supported_action = dnd->XdndActionCopy;
+                    if (dnd_version_at_least (dnd->dragging_version, 2))
+                        dnd->supported_action = XDND_STATUS_ACTION (&xevent);
+                    dnd_debug3 ("      return action=%ld, ready=%d", dnd->supported_action, dnd->ready_to_drop);
+                    /* if not ready, keep sending positions, this check is repeated above for internal widgets */
+                    if (!dnd->ready_to_drop) {
+                        dnd->want_position = 1;
+                        dnd->rectangle.width = dnd->rectangle.height = 0;
+                    }
+                    dnd_debug3 ("      rectangle = (x=%d, y=%d, ", dnd->rectangle.x, dnd->rectangle.y);
+                    dnd_debug4                               ("w=%d, h=%d), want_position=%d\n", dnd->rectangle.width, dnd->rectangle.height, dnd->want_position);
+                }
+#if XDND_VERSION < 3
+                else if (XDND_STATUS_TARGET_WIN (&xevent) != dnd->dropper_window) {
+                    dnd_debug3 ("    XdndStatus XDND_STATUS_TARGET_WIN (&xevent) = %ld, dnd->dropper_window = %ld", XDND_STATUS_TARGET_WIN (&xevent), dnd->dropper_window);
+                }
+#endif
+                else {
+                    dnd_debug2 ("    XdndStatus stage incorrect dnd->stage = %d", dnd->stage);
+                }
+            }
+            break;
+        case SelectionRequest:{
+/* the target widget MAY request data, so wait for SelectionRequest */
+                int length = 0;
+                unsigned char *data = 0;
+                dnd_debug1 ("SelectionRequest - getting widget data");
+
+                (*dnd->widget_get_data) (dnd, from, &data, &length, xevent.xselectionrequest.target);
+                if (data) {
+                    dnd_debug1 ("  sending selection");
+                    xdnd_selection_send (dnd, &xevent.xselectionrequest, data, length);
+                    xdnd_xfree (data);
+                }
+            }
+            break;
+        }
+    }
+
+    if (dnd->ready_to_drop) {
+        Time time;
+        dnd_debug1 ("ready_to_drop - sending XdndDrop");
+        time = xevent.xbutton.time;
+        if (dnd->internal_drag) {
+/* we are dealing with our own widget, no need to send drop events, just put the data straight */
+            int length = 0;
+            unsigned char *data = 0;
+            if (dnd->widget_insert_drop) {
+                (*dnd->widget_get_data) (dnd, from, &data, &length, dnd->desired_type);
+                if (data) {
+                    if (!(*dnd->widget_insert_drop) (dnd, data, length, 0, dnd->dropper_window, from, dnd->desired_type)) {
+                        result = dnd->supported_action;                /* success - so return action to caller */
+                        dnd_debug1 ("  inserted data into widget - success");
+                    } else {
+                        dnd_debug1 ("  inserted data into widget - failed");
+                    }
+                    xdnd_xfree (data);
+                } else {
+                    dnd_debug1 ("  got data from widget, but data is null");
+                }
+            }
+        } else {
+            xdnd_set_selection_owner (dnd, from, dnd->desired_type, time);
+#if XDND_VERSION < 3
+            xdnd_send_drop (dnd, dnd->dropper_window, from, time);
+#else
+            xdnd_send_drop (dnd, dnd->dropper_toplevel, from, time);
+#endif
+        }
+        if (!dnd->internal_drag)
+            for (;;) {
+                XAllowEvents (dnd->display, SyncPointer, CurrentTime);
+                XNextEvent (dnd->display, &xevent);
+                if (xevent.type == ClientMessage && xevent.xclient.message_type == dnd->XdndFinished) {
+                    dnd_debug1 ("XdndFinished");
+#if XDND_VERSION < 3
+                    if (XDND_FINISHED_TARGET_WIN (&xevent) == dnd->dropper_window) {
+#endif
+                        dnd_debug2 ("  source correct - exiting event loop, action=%ld", dnd->supported_action);
+                        result = dnd->supported_action;                /* success - so return action to caller */
+                        break;
+#if XDND_VERSION < 3
+                    }
+#endif
+                } else if (xevent.type == Expose) {
+                    if (dnd->handle_expose_events)
+                        (*dnd->handle_expose_events) (dnd, &xevent);
+                } else if (xevent.type == MotionNotify) {
+                    if (xevent.xmotion.time > time + (dnd->time_out ? dnd->time_out * 1000 : 10000)) {        /* allow a ten second timeout as default */
+                        dnd_debug1 ("timeout - exiting event loop");
+                        break;
+                    }
+                } else if (xevent.type == SelectionRequest && xevent.xselectionrequest.selection == dnd->XdndSelection) {
+/* the target widget is going to request data, so check for SelectionRequest events */
+                    int length = 0;
+                    unsigned char *data = 0;
+
+                    dnd_debug1 ("SelectionRequest - getting widget data");
+                    (*dnd->widget_get_data) (dnd, from, &data, &length, xevent.xselectionrequest.target);
+                    if (data) {
+                        dnd_debug1 ("  sending selection");
+                        xdnd_selection_send (dnd, &xevent.xselectionrequest, data, length);
+                        xdnd_xfree (data);
+                    }
+/* don't wait for a XdndFinished event */
+                    if (!dnd_version_at_least (dnd->dragging_version, 2))
+                        break;
+                }
+            }
+    } else {
+        dnd_debug1 ("not ready_to_drop - ungrabbing pointer");
+    }
+    XUngrabPointer (dnd->display, CurrentTime);
+    xdnd_reset (dnd);
+    return result;
+}
+
+/* returns non-zero if event is handled */
+int xdnd_handle_drop_events (DndClass * dnd, XEvent * xevent)
+{
+    int result = 0;
+    if (xevent->type == SelectionNotify) {
+        dnd_debug1 ("got SelectionNotify");
+        if (xevent->xselection.property == dnd->Xdnd_NON_PROTOCOL_ATOM && dnd->stage == XDND_DROP_STAGE_CONVERTING) {
+            int error;
+            dnd_debug1 ("  property is Xdnd_NON_PROTOCOL_ATOM - getting selection");
+            error = xdnd_get_selection (dnd, dnd->dragger_window, xevent->xselection.property, xevent->xany.window);
+/* error is not actually used, i think future versions of the protocol maybe should return 
+   an error status to the calling window with the XdndFinished client message */
+            if (dnd_version_at_least (dnd->dragging_version, 2)) {
+#if XDND_VERSION >= 3
+                xdnd_send_finished (dnd, dnd->dragger_window, dnd->dropper_toplevel, error);
+#else
+                xdnd_send_finished (dnd, dnd->dragger_window, dnd->dropper_window, error);
+#endif
+                dnd_debug1 ("    sending finished");
+            }
+            xdnd_xfree (dnd->dragger_typelist);
+            xdnd_reset (dnd);
+            dnd->stage = XDND_DROP_STAGE_IDLE;
+            result = 1;
+        } else {
+            dnd_debug1 ("  property is not Xdnd_NON_PROTOCOL_ATOM - ignoring");
+        }
+    } else if (xevent->type == ClientMessage) {
+        dnd_debug2 ("got ClientMessage to xevent->xany.window = %ld", xevent->xany.window);
+        if (xevent->xclient.message_type == dnd->XdndEnter) {
+            dnd_debug2 ("  message_type is XdndEnter, version = %ld", XDND_ENTER_VERSION (xevent));
+#if XDND_VERSION >= 3
+            if (XDND_ENTER_VERSION (xevent) < 3)
+                return 0;
+#endif
+            xdnd_reset (dnd);
+            dnd->dragger_window = XDND_ENTER_SOURCE_WIN (xevent);
+#if XDND_VERSION >= 3
+            dnd->dropper_toplevel = xevent->xany.window;
+            dnd->dropper_window = 0;     /* enter goes to the top level window only,
+                                            so we don't really know what the
+                                            sub window is yet */
+#else
+            dnd->dropper_window = xevent->xany.window;
+#endif
+            xdnd_xfree (dnd->dragger_typelist);
+            if (XDND_ENTER_THREE_TYPES (xevent)) {
+                dnd_debug1 ("    three types only");
+                xdnd_get_three_types (dnd, xevent, &dnd->dragger_typelist);
+            } else {
+                dnd_debug1 ("    more than three types - getting list");
+                xdnd_get_type_list (dnd, dnd->dragger_window, &dnd->dragger_typelist);
+            }
+            if (dnd->dragger_typelist)
+                dnd->stage = XDND_DROP_STAGE_ENTERED;
+            else
+                dnd_debug1 ("      typelist returned as zero!");
+            dnd->dragging_version = XDND_ENTER_VERSION (xevent);
+            result = 1;
+        } else if (xevent->xclient.message_type == dnd->XdndLeave) {
+#if XDND_VERSION >= 3
+            if (xevent->xany.window == dnd->dropper_toplevel && dnd->dropper_window)
+                xevent->xany.window = dnd->dropper_window;
+#endif
+            dnd_debug1 ("  message_type is XdndLeave");
+            if (dnd->dragger_window == XDND_LEAVE_SOURCE_WIN (xevent) && dnd->stage == XDND_DROP_STAGE_ENTERED) {
+                dnd_debug1 ("    leaving");
+                if (dnd->widget_apply_leave)
+                    (*dnd->widget_apply_leave) (dnd, xevent->xany.window);
+                dnd->stage = XDND_DROP_STAGE_IDLE;
+                xdnd_xfree (dnd->dragger_typelist);
+                result = 1;
+                dnd->dropper_toplevel = dnd->dropper_window = 0;
+            } else {
+                dnd_debug1 ("    wrong stage or from wrong window");
+            }
+        } else if (xevent->xclient.message_type == dnd->XdndPosition) {
+            dnd_debug2 ("  message_type is XdndPosition to %ld", xevent->xany.window);
+            if (dnd->dragger_window == XDND_POSITION_SOURCE_WIN (xevent) && dnd->stage == XDND_DROP_STAGE_ENTERED) {
+                int want_position;
+                Atom action;
+                XRectangle rectangle;
+                Window last_window;
+                last_window = dnd->dropper_window;
+#if XDND_VERSION >= 3
+/* version 3 gives us the top-level window only. WE have to find the child that the pointer is over: */
+                if (1 || xevent->xany.window != dnd->dropper_toplevel || !dnd->dropper_window) {
+                    Window parent, child, new_child = 0;
+                    dnd->dropper_toplevel = xevent->xany.window;
+                    parent = dnd->root_window;
+                    child = dnd->dropper_toplevel;
+                    for (;;) {
+                        int xd, yd;
+                        new_child = 0;
+                        if (!XTranslateCoordinates (dnd->display, parent, child, 
+                                    XDND_POSITION_ROOT_X (xevent), XDND_POSITION_ROOT_Y (xevent),
+                                    &xd, &yd, &new_child))
+                            break;
+                        if (!new_child)
+                            break;
+                        child = new_child;
+                    }
+                    dnd->dropper_window = xevent->xany.window = child;
+                    dnd_debug2 ("   child window translates to %ld", dnd->dropper_window);
+                } else if (xevent->xany.window == dnd->dropper_toplevel && dnd->dropper_window) {
+                    xevent->xany.window = dnd->dropper_window;
+                    dnd_debug2 ("   child window previously found: %ld", dnd->dropper_window);
+                }
+#endif
+                action = dnd->XdndActionCopy;
+                dnd->supported_action = dnd->XdndActionCopy;
+                dnd->x = XDND_POSITION_ROOT_X (xevent);
+                dnd->y = XDND_POSITION_ROOT_Y (xevent);
+                dnd->time = CurrentTime;
+                if (dnd_version_at_least (dnd->dragging_version, 1))
+                    dnd->time = XDND_POSITION_TIME (xevent);
+                if (dnd_version_at_least (dnd->dragging_version, 1))
+                    action = XDND_POSITION_ACTION (xevent);
+#if XDND_VERSION >= 3
+                if (last_window && last_window != xevent->xany.window)
+                    if (dnd->widget_apply_leave)
+                        (*dnd->widget_apply_leave) (dnd, last_window);
+#endif
+                dnd->will_accept = (*dnd->widget_apply_position) (dnd, xevent->xany.window, dnd->dragger_window,
+                action, dnd->x, dnd->y, dnd->time, dnd->dragger_typelist,
+                                                                  &want_position, &dnd->supported_action, &dnd->desired_type, &rectangle);
+                dnd_debug2 ("    will accept = %d", dnd->will_accept);
+#if XDND_VERSION >= 3
+                dnd_debug2 ("    sending status of %ld", dnd->dropper_toplevel);
+                xdnd_send_status (dnd, dnd->dragger_window, dnd->dropper_toplevel, dnd->will_accept,
+                                  want_position, rectangle.x, rectangle.y, rectangle.width, rectangle.height, dnd->supported_action);
+#else
+                dnd_debug2 ("    sending status of %ld", xevent->xany.window);
+                xdnd_send_status (dnd, dnd->dragger_window, xevent->xany.window, dnd->will_accept,
+                                  want_position, rectangle.x, rectangle.y, rectangle.width, rectangle.height, dnd->supported_action);
+#endif
+                result = 1;
+            } else {
+                dnd_debug1 ("    wrong stage or from wrong window");
+            }
+        } else if (xevent->xclient.message_type == dnd->XdndDrop) {
+#if XDND_VERSION >= 3
+            if (xevent->xany.window == dnd->dropper_toplevel && dnd->dropper_window)
+                xevent->xany.window = dnd->dropper_window;
+#endif
+            dnd_debug1 ("  message_type is XdndDrop");
+            if (dnd->dragger_window == XDND_DROP_SOURCE_WIN (xevent) && dnd->stage == XDND_DROP_STAGE_ENTERED) {
+                dnd->time = CurrentTime;
+                if (dnd_version_at_least (dnd->dragging_version, 1))
+                    dnd->time = XDND_DROP_TIME (xevent);
+                if (dnd->will_accept) {
+                    dnd_debug1 ("    will_accept is true - converting selectiong");
+                    dnd_debug2 ("      my window is %ld", dnd->dropper_window);
+                    dnd_debug2 ("        source window is %ld", dnd->dragger_window);
+                    xdnd_convert_selection (dnd, dnd->dragger_window, dnd->dropper_window, dnd->desired_type);
+                    dnd->stage = XDND_DROP_STAGE_CONVERTING;
+                } else {
+                    dnd_debug1 ("    will_accept is false - sending finished");
+                    if (dnd_version_at_least (dnd->dragging_version, 2)) {
+#if XDND_VERSION >= 3
+                        xdnd_send_finished (dnd, dnd->dragger_window, dnd->dropper_toplevel, 1);
+#else
+                        xdnd_send_finished (dnd, dnd->dragger_window, xevent->xany.window, 1);
+#endif
+                    }
+                    xdnd_xfree (dnd->dragger_typelist);
+                    xdnd_reset (dnd);
+                    dnd->stage = XDND_DROP_STAGE_IDLE;
+                }
+                result = 1;
+            } else {
+                dnd_debug1 ("    wrong stage or from wrong window");
+            }
+        }
+    }
+    return result;
+}
+
+/*
+   Following here is a sample implementation: Suppose we want a window
+   to recieve drops, but do not want to be concerned with setting up all
+   the DndClass methods. All we then do is call xdnd_get_drop() whenever a
+   ClientMessage is recieved. If the message has nothing to do with XDND,
+   xdnd_get_drop quickly returns 0. If it is a XdndEnter message, then
+   xdnd_get_drop enters its own XNextEvent loop and handles all XDND
+   protocol messages internally, returning the action requested.
+
+   You should pass a desired typelist and actionlist to xdnd_get_type.
+   These must be null terminated arrays of atoms, or a null pointer
+   if you would like any action or type to be accepted. If typelist
+   is null then the first type of the dragging widgets typelist will
+   be the one used. If actionlist is null, then only XdndActionCopy will
+   be accepted.
+
+   The result is stored in *data, length, type, x and y.
+   *data must be free'd.
+ */
+
+struct xdnd_get_drop_info {
+    unsigned char *drop_data;
+    int drop_data_length;
+    int x, y;
+    Atom return_type;
+    Atom return_action;
+    Atom *typelist;
+    Atom *actionlist;
+};
+
+static int widget_insert_drop (DndClass * dnd, unsigned char *data, int length, int remaining, Window into, Window from, Atom type)
+{
+    struct xdnd_get_drop_info *i;
+    i = (struct xdnd_get_drop_info *) dnd->user_hook1;
+    if (!i->drop_data) {
+        i->drop_data = malloc (length);
+        if (!i->drop_data)
+            return 1;
+        memcpy (i->drop_data, data, length);
+        i->drop_data_length = length;
+    } else {
+        unsigned char *t;
+        t = malloc (i->drop_data_length + length);
+        if (!t) {
+            free (i->drop_data);
+            i->drop_data = 0;
+            return 1;
+        }
+        memcpy (t, i->drop_data, i->drop_data_length);
+        memcpy (t + i->drop_data_length, data, length);
+        free (i->drop_data);
+        i->drop_data = t;
+        i->drop_data_length += length;
+    }
+    return 0;
+}
+
+static int widget_apply_position (DndClass * dnd, Window widgets_window, Window from,
+                      Atom action, int x, int y, Time t, Atom * typelist,
+ int *want_position, Atom * supported_action_return, Atom * desired_type,
+                                  XRectangle * rectangle)
+{
+    int i, j;
+    struct xdnd_get_drop_info *info;
+    Atom *dropper_typelist, supported_type = 0;
+    Atom *supported_actions, supported_action = 0;
+
+    info = (struct xdnd_get_drop_info *) dnd->user_hook1;
+    dropper_typelist = info->typelist;
+    supported_actions = info->actionlist;
+
+    if (dropper_typelist) {
+/* find a correlation: */
+        for (j = 0; dropper_typelist[j]; j++) {
+            for (i = 0; typelist[i]; i++) {
+                if (typelist[i] == dropper_typelist[j]) {
+                    supported_type = typelist[i];
+                    break;
+                }
+            }
+            if (supported_type)
+                break;
+        }
+    } else {
+/* user did not specify, so return first type */
+        supported_type = typelist[0];
+    }
+/* not supported, so return false */
+    if (!supported_type)
+        return 0;
+
+    if (supported_actions) {
+        for (j = 0; supported_actions[j]; j++) {
+            if (action == supported_actions[j]) {
+                supported_action = action;
+                break;
+            }
+        }
+    } else {
+/* user did not specify */
+        if (action == dnd->XdndActionCopy)
+            supported_action = action;
+    }
+    if (!supported_action)
+        return 0;
+
+    *want_position = 1;
+    rectangle->x = rectangle->y = 0;
+    rectangle->width = rectangle->height = 0;
+
+    info->return_action = *supported_action_return = supported_action;
+    info->return_type = *desired_type = supported_type;
+    info->x = x;
+    info->y = y;
+
+    return 1;
+}
+
+Atom xdnd_get_drop (Display * display, XEvent * xevent, Atom * typelist, Atom * actionlist,
+          unsigned char **data, int *length, Atom * type, int *x, int *y)
+{
+    Atom action = 0;
+    static int initialised = 0;
+    static DndClass dnd;
+    if (!initialised) {
+        xdnd_init (&dnd, display);
+        initialised = 1;
+    }
+    if (xevent->type != ClientMessage || xevent->xclient.message_type != dnd.XdndEnter) {
+        return 0;
+    } else {
+        struct xdnd_get_drop_info i;
+
+/* setup user structure */
+        memset (&i, 0, sizeof (i));
+        i.actionlist = actionlist;
+        i.typelist = typelist;
+        dnd.user_hook1 = &i;
+
+/* setup methods */
+        dnd.widget_insert_drop = widget_insert_drop;
+        dnd.widget_apply_position = widget_apply_position;
+
+/* main loop */
+        for (;;) {
+            xdnd_handle_drop_events (&dnd, xevent);
+            if (dnd.stage == XDND_DROP_STAGE_IDLE)
+                break;
+            XNextEvent (dnd.display, xevent);
+        }
+
+/* return results */
+        if (i.drop_data) {
+            *length = i.drop_data_length;
+            *data = i.drop_data;
+            action = i.return_action;
+            *type = i.return_type;
+            *x = i.x;
+            *y = i.y;
+        }
+    }
+    return action;
+}
+
+
diff --git a/extern/xdnd/xdnd.h b/extern/xdnd/xdnd.h
new file mode 100644
index 0000000..c903b51
--- /dev/null
+++ b/extern/xdnd/xdnd.h
@@ -0,0 +1,221 @@
+/* xdnd.c, xdnd.h - C program library for handling the Xdnd protocol
+   Copyright (C) 1996-2000 Paul Sheer
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU 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.
+ */
+
+#ifndef _X_DND_H
+#define _X_DND_H
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/* you can set this to either 2 (which support 0 and 1 as well) or 3 */
+/* #define XDND_VERSION 2 */
+#define XDND_VERSION 3
+
+
+/* XdndEnter */
+#define XDND_THREE 3
+#define XDND_ENTER_SOURCE_WIN(e)	((e)->xclient.data.l[0])
+#define XDND_ENTER_THREE_TYPES(e)	(((e)->xclient.data.l[1] & 0x1UL) == 0)
+#define XDND_ENTER_THREE_TYPES_SET(e,b)	(e)->xclient.data.l[1] = ((e)->xclient.data.l[1] & ~0x1UL) | (((b) == 0) ? 0 : 0x1UL)
+#define XDND_ENTER_VERSION(e)		((e)->xclient.data.l[1] >> 24)
+#define XDND_ENTER_VERSION_SET(e,v)	(e)->xclient.data.l[1] = ((e)->xclient.data.l[1] & ~(0xFF << 24)) | ((v) << 24)
+#define XDND_ENTER_TYPE(e,i)		((e)->xclient.data.l[2 + i])	/* i => (0, 1, 2) */
+
+/* XdndPosition */
+#define XDND_POSITION_SOURCE_WIN(e)	((e)->xclient.data.l[0])
+#define XDND_POSITION_ROOT_X(e)		((e)->xclient.data.l[2] >> 16)
+#define XDND_POSITION_ROOT_Y(e)		((e)->xclient.data.l[2] & 0xFFFFUL)
+#define XDND_POSITION_ROOT_SET(e,x,y)	(e)->xclient.data.l[2]  = ((x) << 16) | ((y) & 0xFFFFUL)
+#define XDND_POSITION_TIME(e)		((e)->xclient.data.l[3])
+#define XDND_POSITION_ACTION(e)		((e)->xclient.data.l[4])
+
+/* XdndStatus */
+#define XDND_STATUS_TARGET_WIN(e)	((e)->xclient.data.l[0])
+#define XDND_STATUS_WILL_ACCEPT(e)	((e)->xclient.data.l[1] & 0x1L)
+#define XDND_STATUS_WILL_ACCEPT_SET(e,b) (e)->xclient.data.l[1] = ((e)->xclient.data.l[1] & ~0x1UL) | (((b) == 0) ? 0 : 0x1UL)
+#define XDND_STATUS_WANT_POSITION(e)	((e)->xclient.data.l[1] & 0x2UL)
+#define XDND_STATUS_WANT_POSITION_SET(e,b) (e)->xclient.data.l[1] = ((e)->xclient.data.l[1] & ~0x2UL) | (((b) == 0) ? 0 : 0x2UL)
+#define XDND_STATUS_RECT_X(e)		((e)->xclient.data.l[2] >> 16)
+#define XDND_STATUS_RECT_Y(e)		((e)->xclient.data.l[2] & 0xFFFFL)
+#define XDND_STATUS_RECT_WIDTH(e)	((e)->xclient.data.l[3] >> 16)
+#define XDND_STATUS_RECT_HEIGHT(e)	((e)->xclient.data.l[3] & 0xFFFFL)
+#define XDND_STATUS_RECT_SET(e,x,y,w,h)	{(e)->xclient.data.l[2] = ((x) << 16) | ((y) & 0xFFFFUL); (e)->xclient.data.l[3] = ((w) << 16) | ((h) & 0xFFFFUL); }
+#define XDND_STATUS_ACTION(e)		((e)->xclient.data.l[4])
+
+/* XdndLeave */
+#define XDND_LEAVE_SOURCE_WIN(e)	((e)->xclient.data.l[0])
+
+/* XdndDrop */
+#define XDND_DROP_SOURCE_WIN(e)		((e)->xclient.data.l[0])
+#define XDND_DROP_TIME(e)		((e)->xclient.data.l[2])
+
+/* XdndFinished */
+#define XDND_FINISHED_TARGET_WIN(e)	((e)->xclient.data.l[0])
+
+struct _DndCursor {
+    int width, height;
+    int x, y;
+    unsigned char *image_data, *mask_data;
+    char *_action;
+    Pixmap image_pixmap, mask_pixmap;
+    Cursor cursor;
+    Atom action;
+};
+
+typedef struct _DndCursor DndCursor;
+typedef struct _DndClass DndClass;
+
+struct _DndClass {
+/* insert chars sequentionally into the target widget, type will be the same as `desired_type'
+   returned from widget_apply_position. This may be called several times in succession 
+   with sequention blocks of data. Must return non-zero on failure */
+    int (*widget_insert_drop) (DndClass * dnd, unsigned char *data, int length, int remaining, Window into, Window from, Atom type);
+
+/* In response to DELETE requests : FIXME - not yet used */
+    int (*widget_delete_selection) (DndClass * dnd, Window window, Window from);
+
+/* returns 1 if widget exists, zero otherwise. If this method is not 
+   set then the code assumes that no widgets have support for recieving drops.
+   In this case none of the widget methods need be set. */
+    int (*widget_exists) (DndClass * dnd, Window window);
+
+/* must update the widgets border to its default appearance */
+    void (*widget_apply_leave) (DndClass * dnd, Window widgets_window);
+
+/* must update the widgets border to give the appearance of being able to recieve a drop,
+   plus return all data to pointers. As per the protocol, if the widget cannot
+   perform the action specified by `action' then it should return either XdndActionPrivate
+   or XdndActionCopy into supported_action (leaving 0 supported_action unchanged is equivalent
+   to XdndActionCopy). Returns 1 if ready to ok drop */
+    int (*widget_apply_position) (DndClass * dnd, Window widgets_window, Window from,
+                                  Atom action, int x, int y, Time t, Atom * typelist,
+                                  int *want_position, Atom * supported_action, Atom * desired_type,
+                                  XRectangle * rectangle);
+
+/* returns drag data of the specified type. This will be one of `typelist' given to xdnd_drag */
+    void (*widget_get_data) (DndClass * dnd, Window window, unsigned char **data, int *length, Atom type);
+
+/* this is called from with the main event loop if an expose event is recieved and is optional */
+    void (*handle_expose_events) (DndClass * dnd, XEvent * xevent);
+
+/* creates a chooser dialog if the action is XdndActionAsk. Returns non-zero on cancel */
+    int (*action_choose_dialog) (DndClass * dnd, char **descriptions, Atom * actions, Atom * result);
+
+#if 0 /* implemented internally */
+/* returns a widget that is dnd aware within a parent widget that lies under the point x, y */
+    Window (*widget_get_child_widget) (DndClass * dnd, Window parent, int x, int y);
+#endif
+
+    void *pad1[8];
+
+    DndCursor *cursors;
+
+    Display *display;
+
+    Atom XdndAware;
+    Atom XdndSelection;
+    Atom XdndEnter;
+    Atom XdndLeave;
+    Atom XdndPosition;
+    Atom XdndDrop;
+    Atom XdndFinished;
+    Atom XdndStatus;
+    Atom XdndActionCopy;
+    Atom XdndActionMove;
+    Atom XdndActionLink;
+    Atom XdndActionAsk;
+    Atom XdndActionPrivate;
+    Atom XdndTypeList;
+    Atom XdndActionList;
+    Atom XdndActionDescription;
+
+    Atom Xdnd_NON_PROTOCOL_ATOM;
+    Atom version;
+
+    Atom pad2[16];
+
+    Window root_window;
+
+#define XDND_DROP_STAGE_IDLE		0
+#define XDND_DRAG_STAGE_DRAGGING	1
+#define XDND_DRAG_STAGE_ENTERED		2
+#define XDND_DROP_STAGE_CONVERTING	3
+#define XDND_DROP_STAGE_ENTERED		4
+    int stage;
+    int dragging_version;
+    int internal_drag;
+    int want_position;
+    int ready_to_drop;
+    int will_accept;
+    XRectangle rectangle;
+    Window dropper_window, dragger_window;
+    Atom *dragger_typelist;
+    Atom desired_type;
+    Atom supported_action;
+    Time time;
+/* drop position from last XdndPosition */
+    int x, y;
+    int pad3[16];
+
+/* move euclidian pixels before considering this to be an actual drag */
+    float drag_threshold;
+
+/* block for only this many seconds on not receiving a XdndFinished from target, default : 10 */
+    int time_out;
+
+#define XDND_OPTION_NO_HYSTERESIS (1<<0)
+    int options;
+
+/* user hooks */
+    void *user_hook1;
+    void *user_hook2;
+    void *user_hook3;
+    Window dropper_toplevel;
+    void *pad4[15];
+};
+
+
+void xdnd_init (DndClass * dnd, Display * display);
+void xdnd_shut (DndClass * dnd);
+/* for nested widgets where parent and child receive drops of different
+types; then always pass typelist as null */
+void xdnd_set_dnd_aware (DndClass * dnd, Window window, Atom * typelist);
+int xdnd_is_dnd_aware (DndClass * dnd, Window window, int *version, Atom * typelist);
+void xdnd_set_type_list (DndClass * dnd, Window window, Atom * typelist);
+void xdnd_set_actions (DndClass * dnd, Window window, Atom * actions, char **descriptions);
+int xdnd_get_actions (DndClass * dnd, Window window, Atom ** actions, char ***descriptions);
+int xdnd_choose_action_dialog (DndClass * dnd, Atom * actions, char **descriptions, Atom * result);
+Atom xdnd_drag (DndClass * dnd, Window from, Atom action, Atom * typelist);
+
+/* Returns 1 if event is handled, This must be placed in the widget
+libraries main event loop and be called if the event type is
+ClientMessage or SelectionNotify */
+int xdnd_handle_drop_events (DndClass * dnd, XEvent * xevent);
+Atom xdnd_get_drop (Display * display, XEvent * xevent, Atom * typelist, Atom * actionlist,
+                    unsigned char **data, int *length, Atom * type, int *x, int *y);
+
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif 	/* !_X_DND_H */
+
+
diff --git a/intern/CMakeLists.txt b/intern/CMakeLists.txt
index 9f5217e..c85f0fd 100644
--- a/intern/CMakeLists.txt
+++ b/intern/CMakeLists.txt
@@ -66,3 +66,7 @@ if(WITH_CYCLES)
 	add_subdirectory(cycles)
 endif()
 
+# only windows needs utf16 converter
+if(WIN32)
+	add_subdirectory(utfconv)
+endif()
diff --git a/intern/SConscript b/intern/SConscript
index bb19426..b6305f7 100644
--- a/intern/SConscript
+++ b/intern/SConscript
@@ -20,10 +20,10 @@ SConscript(['audaspace/SConscript',
 # getting it to compile is difficult
 # intern/bsp has been used anyway, so
 # perhaps get rid of intern/csg?
-NEW_CSG='false'
+NEW_CSG = 'false'
 
 if env ['WITH_BF_REMESH']:
-	SConscript(['dualcon/SConscript'])
+    SConscript(['dualcon/SConscript'])
 
 if env['WITH_BF_FLUID']:
     SConscript(['elbeem/SConscript'])
@@ -31,7 +31,10 @@ if env['WITH_BF_FLUID']:
 if env['WITH_BF_CYCLES']:
     SConscript(['cycles/SConscript'])
 
-if NEW_CSG=='false':
+if NEW_CSG == 'false':
     SConscript(['bsp/SConscript'])
 else:
     SConscript(['csg/SConscript'])
+
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-mingw', 'linuxcross', 'win64-vc'):
+    SConscript(['utfconv/SConscript'])
diff --git a/intern/audaspace/FX/AUD_AccumulatorFactory.h b/intern/audaspace/FX/AUD_AccumulatorFactory.h
index d49d8f7..ac73c5a 100644
--- a/intern/audaspace/FX/AUD_AccumulatorFactory.h
+++ b/intern/audaspace/FX/AUD_AccumulatorFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_ACCUMULATORFACTORY
-#define AUD_ACCUMULATORFACTORY
+#ifndef __AUD_ACCUMULATORFACTORY_H__
+#define __AUD_ACCUMULATORFACTORY_H__
 
 #include "AUD_EffectFactory.h"
 class AUD_CallbackIIRFilterReader;
@@ -66,4 +66,4 @@ public:
 	static sample_t accumulatorFilter(AUD_CallbackIIRFilterReader* reader, void* useless);
 };
 
-#endif //AUD_ACCUMULATORFACTORY
+#endif //__AUD_ACCUMULATORFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_BaseIIRFilterReader.h b/intern/audaspace/FX/AUD_BaseIIRFilterReader.h
index 5b37f83..43970c9 100644
--- a/intern/audaspace/FX/AUD_BaseIIRFilterReader.h
+++ b/intern/audaspace/FX/AUD_BaseIIRFilterReader.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_BASEIIRFILTERREADER
-#define AUD_BASEIIRFILTERREADER
+#ifndef __AUD_BASEIIRFILTERREADER_H__
+#define __AUD_BASEIIRFILTERREADER_H__
 
 #include "AUD_EffectReader.h"
 #include "AUD_Buffer.h"
@@ -132,4 +132,4 @@ public:
 	virtual void sampleRateChanged(AUD_SampleRate rate);
 };
 
-#endif //AUD_BASEIIRFILTERREADER
+#endif //__AUD_BASEIIRFILTERREADER_H__
diff --git a/intern/audaspace/FX/AUD_ButterworthFactory.h b/intern/audaspace/FX/AUD_ButterworthFactory.h
index aa302e7..d360627 100644
--- a/intern/audaspace/FX/AUD_ButterworthFactory.h
+++ b/intern/audaspace/FX/AUD_ButterworthFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_BUTTERWORTHFACTORY
-#define AUD_BUTTERWORTHFACTORY
+#ifndef __AUD_BUTTERWORTHFACTORY_H__
+#define __AUD_BUTTERWORTHFACTORY_H__
 
 #include "AUD_DynamicIIRFilterFactory.h"
 
@@ -60,4 +60,4 @@ public:
 										 std::vector<float>& a);
 };
 
-#endif //AUD_BUTTERWORTHFACTORY
+#endif //__AUD_BUTTERWORTHFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_CallbackIIRFilterReader.h b/intern/audaspace/FX/AUD_CallbackIIRFilterReader.h
index 787fd49..7ced738 100644
--- a/intern/audaspace/FX/AUD_CallbackIIRFilterReader.h
+++ b/intern/audaspace/FX/AUD_CallbackIIRFilterReader.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_CALLBACKIIRFILTERREADER
-#define AUD_CALLBACKIIRFILTERREADER
+#ifndef __AUD_CALLBACKIIRFILTERREADER_H__
+#define __AUD_CALLBACKIIRFILTERREADER_H__
 
 #include "AUD_BaseIIRFilterReader.h"
 #include "AUD_Buffer.h"
@@ -84,4 +84,4 @@ public:
 	virtual sample_t filter();
 };
 
-#endif //AUD_CALLBACKIIRFILTERREADER
+#endif //__AUD_CALLBACKIIRFILTERREADER_H__
diff --git a/intern/audaspace/FX/AUD_DelayFactory.h b/intern/audaspace/FX/AUD_DelayFactory.h
index c1b1146..26855a0 100644
--- a/intern/audaspace/FX/AUD_DelayFactory.h
+++ b/intern/audaspace/FX/AUD_DelayFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_DELAYFACTORY
-#define AUD_DELAYFACTORY
+#ifndef __AUD_DELAYFACTORY_H__
+#define __AUD_DELAYFACTORY_H__
 
 #include "AUD_EffectFactory.h"
 
@@ -63,4 +63,4 @@ public:
 	virtual AUD_Reference<AUD_IReader> createReader();
 };
 
-#endif //AUD_DELAYFACTORY
+#endif //__AUD_DELAYFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_DelayReader.h b/intern/audaspace/FX/AUD_DelayReader.h
index b23bb14..9d9b661 100644
--- a/intern/audaspace/FX/AUD_DelayReader.h
+++ b/intern/audaspace/FX/AUD_DelayReader.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_DELAYREADER
-#define AUD_DELAYREADER
+#ifndef __AUD_DELAYREADER_H__
+#define __AUD_DELAYREADER_H__
 
 #include "AUD_EffectReader.h"
 #include "AUD_Buffer.h"
@@ -67,4 +67,4 @@ public:
 	virtual void read(int& length, bool& eos, sample_t* buffer);
 };
 
-#endif //AUD_DELAYREADER
+#endif //__AUD_DELAYREADER_H__
diff --git a/intern/audaspace/FX/AUD_DoubleFactory.h b/intern/audaspace/FX/AUD_DoubleFactory.h
index 990c605..e4d8fbf 100644
--- a/intern/audaspace/FX/AUD_DoubleFactory.h
+++ b/intern/audaspace/FX/AUD_DoubleFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_DOUBLEFACTORY
-#define AUD_DOUBLEFACTORY
+#ifndef __AUD_DOUBLEFACTORY_H__
+#define __AUD_DOUBLEFACTORY_H__
 
 #include "AUD_IFactory.h"
 
@@ -63,4 +63,4 @@ public:
 	virtual AUD_Reference<AUD_IReader> createReader();
 };
 
-#endif //AUD_DOUBLEFACTORY
+#endif //__AUD_DOUBLEFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_DoubleReader.h b/intern/audaspace/FX/AUD_DoubleReader.h
index 4c82d4f..1489f4e 100644
--- a/intern/audaspace/FX/AUD_DoubleReader.h
+++ b/intern/audaspace/FX/AUD_DoubleReader.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_DOUBLEREADER
-#define AUD_DOUBLEREADER
+#ifndef __AUD_DOUBLEREADER_H__
+#define __AUD_DOUBLEREADER_H__
 
 #include "AUD_IReader.h"
 #include "AUD_Buffer.h"
@@ -80,4 +80,4 @@ public:
 	virtual void read(int& length, bool& eos, sample_t* buffer);
 };
 
-#endif //AUD_DOUBLEREADER
+#endif //__AUD_DOUBLEREADER_H__
diff --git a/intern/audaspace/FX/AUD_DynamicIIRFilterFactory.h b/intern/audaspace/FX/AUD_DynamicIIRFilterFactory.h
index 2b63e27..fef379f 100644
--- a/intern/audaspace/FX/AUD_DynamicIIRFilterFactory.h
+++ b/intern/audaspace/FX/AUD_DynamicIIRFilterFactory.h
@@ -26,8 +26,8 @@
  *  \ingroup audfx
  */
 
-#ifndef AUD_DYNAMICIIRFILTERFACTORY
-#define AUD_DYNAMICIIRFILTERFACTORY
+#ifndef __AUD_DYNAMICIIRFILTERFACTORY_H__
+#define __AUD_DYNAMICIIRFILTERFACTORY_H__
 
 #include "AUD_EffectFactory.h"
 #include <vector>
@@ -60,4 +60,4 @@ public:
 										 std::vector<float>& a)=0;
 };
 
-#endif // AUD_DYNAMICIIRFILTERFACTORY
+#endif // __AUD_DYNAMICIIRFILTERFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_DynamicIIRFilterReader.h b/intern/audaspace/FX/AUD_DynamicIIRFilterReader.h
index 843cf12..8a53c15 100644
--- a/intern/audaspace/FX/AUD_DynamicIIRFilterReader.h
+++ b/intern/audaspace/FX/AUD_DynamicIIRFilterReader.h
@@ -26,8 +26,8 @@
  *  \ingroup audfx
  */
 
-#ifndef AUD_DYNAMICIIRFILTERREADER
-#define AUD_DYNAMICIIRFILTERREADER
+#ifndef __AUD_DYNAMICIIRFILTERREADER_H__
+#define __AUD_DYNAMICIIRFILTERREADER_H__
 
 #include "AUD_IIRFilterReader.h"
 #include "AUD_DynamicIIRFilterFactory.h"
@@ -51,4 +51,4 @@ public:
 	virtual void sampleRateChanged(AUD_SampleRate rate);
 };
 
-#endif // AUD_DYNAMICIIRFILTERREADER
+#endif // __AUD_DYNAMICIIRFILTERREADER_H__
diff --git a/intern/audaspace/FX/AUD_EffectFactory.h b/intern/audaspace/FX/AUD_EffectFactory.h
index 26d6663..c8d26a1 100644
--- a/intern/audaspace/FX/AUD_EffectFactory.h
+++ b/intern/audaspace/FX/AUD_EffectFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_EFFECTFACTORY
-#define AUD_EFFECTFACTORY
+#ifndef __AUD_EFFECTFACTORY_H__
+#define __AUD_EFFECTFACTORY_H__
 
 #include "AUD_IFactory.h"
 
@@ -79,4 +79,4 @@ public:
 	AUD_Reference<AUD_IFactory> getFactory() const;
 };
 
-#endif //AUD_EFFECTFACTORY
+#endif //__AUD_EFFECTFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_EffectReader.h b/intern/audaspace/FX/AUD_EffectReader.h
index 707031c..b089ec9 100644
--- a/intern/audaspace/FX/AUD_EffectReader.h
+++ b/intern/audaspace/FX/AUD_EffectReader.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_EFFECTREADER
-#define AUD_EFFECTREADER
+#ifndef __AUD_EFFECTREADER_H__
+#define __AUD_EFFECTREADER_H__
 
 #include "AUD_IReader.h"
 #include "AUD_Reference.h"
@@ -70,4 +70,4 @@ public:
 	virtual void read(int& length, bool& eos, sample_t* buffer);
 };
 
-#endif //AUD_EFFECTREADER
+#endif //__AUD_EFFECTREADER_H__
diff --git a/intern/audaspace/FX/AUD_EnvelopeFactory.h b/intern/audaspace/FX/AUD_EnvelopeFactory.h
index 81038f1..c8f3dc3 100644
--- a/intern/audaspace/FX/AUD_EnvelopeFactory.h
+++ b/intern/audaspace/FX/AUD_EnvelopeFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_ENVELOPEFACTORY
-#define AUD_ENVELOPEFACTORY
+#ifndef __AUD_ENVELOPEFACTORY_H__
+#define __AUD_ENVELOPEFACTORY_H__
 
 #include "AUD_EffectFactory.h"
 class AUD_CallbackIIRFilterReader;
@@ -82,4 +82,4 @@ public:
 	static void endEnvelopeFilter(EnvelopeParameters* param);
 };
 
-#endif //AUD_ENVELOPEFACTORY
+#endif //__AUD_ENVELOPEFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_FaderFactory.h b/intern/audaspace/FX/AUD_FaderFactory.h
index 7a8954d..8fcd4ba 100644
--- a/intern/audaspace/FX/AUD_FaderFactory.h
+++ b/intern/audaspace/FX/AUD_FaderFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_FADERFACTORY
-#define AUD_FADERFACTORY
+#ifndef __AUD_FADERFACTORY_H__
+#define __AUD_FADERFACTORY_H__
 
 #include "AUD_EffectFactory.h"
 
@@ -89,4 +89,4 @@ public:
 	virtual AUD_Reference<AUD_IReader> createReader();
 };
 
-#endif //AUD_FADERFACTORY
+#endif //__AUD_FADERFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_FaderReader.h b/intern/audaspace/FX/AUD_FaderReader.h
index 9cad726..788e853 100644
--- a/intern/audaspace/FX/AUD_FaderReader.h
+++ b/intern/audaspace/FX/AUD_FaderReader.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_FADERREADER
-#define AUD_FADERREADER
+#ifndef __AUD_FADERREADER_H__
+#define __AUD_FADERREADER_H__
 
 #include "AUD_EffectReader.h"
 #include "AUD_Buffer.h"
@@ -73,4 +73,4 @@ public:
 	virtual void read(int& length, bool& eos, sample_t* buffer);
 };
 
-#endif //AUD_FADERREADER
+#endif //__AUD_FADERREADER_H__
diff --git a/intern/audaspace/FX/AUD_HighpassFactory.h b/intern/audaspace/FX/AUD_HighpassFactory.h
index c9d8a0b..66aa809 100644
--- a/intern/audaspace/FX/AUD_HighpassFactory.h
+++ b/intern/audaspace/FX/AUD_HighpassFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_HIGHPASSFACTORY
-#define AUD_HIGHPASSFACTORY
+#ifndef __AUD_HIGHPASSFACTORY_H__
+#define __AUD_HIGHPASSFACTORY_H__
 
 #include "AUD_DynamicIIRFilterFactory.h"
 
@@ -64,4 +64,4 @@ public:
 	virtual void recalculateCoefficients(AUD_SampleRate rate, std::vector<float> &b, std::vector<float> &a);
 };
 
-#endif //AUD_HIGHPASSFACTORY
+#endif //__AUD_HIGHPASSFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_IIRFilterFactory.h b/intern/audaspace/FX/AUD_IIRFilterFactory.h
index 0b98f34..43256a1 100644
--- a/intern/audaspace/FX/AUD_IIRFilterFactory.h
+++ b/intern/audaspace/FX/AUD_IIRFilterFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_IIRFILTERFACTORY
-#define AUD_IIRFILTERFACTORY
+#ifndef __AUD_IIRFILTERFACTORY_H__
+#define __AUD_IIRFILTERFACTORY_H__
 
 #include "AUD_EffectFactory.h"
 
@@ -67,4 +67,4 @@ public:
 	virtual AUD_Reference<AUD_IReader> createReader();
 };
 
-#endif //AUD_IIRFILTERFACTORY
+#endif //__AUD_IIRFILTERFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_IIRFilterReader.h b/intern/audaspace/FX/AUD_IIRFilterReader.h
index 01a4138..d9be52f 100644
--- a/intern/audaspace/FX/AUD_IIRFilterReader.h
+++ b/intern/audaspace/FX/AUD_IIRFilterReader.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_IIRFILTERREADER
-#define AUD_IIRFILTERREADER
+#ifndef __AUD_IIRFILTERREADER_H__
+#define __AUD_IIRFILTERREADER_H__
 
 #include "AUD_BaseIIRFilterReader.h"
 
@@ -70,4 +70,4 @@ public:
 						 const std::vector<float>& a);
 };
 
-#endif //AUD_IIRFILTERREADER
+#endif //__AUD_IIRFILTERREADER_H__
diff --git a/intern/audaspace/FX/AUD_LimiterFactory.h b/intern/audaspace/FX/AUD_LimiterFactory.h
index 7128c6d..ddc8183 100644
--- a/intern/audaspace/FX/AUD_LimiterFactory.h
+++ b/intern/audaspace/FX/AUD_LimiterFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_LIMITERFACTORY
-#define AUD_LIMITERFACTORY
+#ifndef __AUD_LIMITERFACTORY_H__
+#define __AUD_LIMITERFACTORY_H__
 
 #include "AUD_EffectFactory.h"
 
@@ -76,4 +76,4 @@ public:
 	virtual AUD_Reference<AUD_IReader> createReader();
 };
 
-#endif //AUD_LIMITERFACTORY
+#endif //__AUD_LIMITERFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_LimiterReader.h b/intern/audaspace/FX/AUD_LimiterReader.h
index 7a2c88e..34c4ea7 100644
--- a/intern/audaspace/FX/AUD_LimiterReader.h
+++ b/intern/audaspace/FX/AUD_LimiterReader.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_LIMITERREADER
-#define AUD_LIMITERREADER
+#ifndef __AUD_LIMITERREADER_H__
+#define __AUD_LIMITERREADER_H__
 
 #include "AUD_EffectReader.h"
 
@@ -68,4 +68,4 @@ public:
 	virtual void read(int& length, bool& eos, sample_t* buffer);
 };
 
-#endif //AUD_LIMITERREADER
+#endif //__AUD_LIMITERREADER_H__
diff --git a/intern/audaspace/FX/AUD_LoopFactory.h b/intern/audaspace/FX/AUD_LoopFactory.h
index 7d794f3..754b780 100644
--- a/intern/audaspace/FX/AUD_LoopFactory.h
+++ b/intern/audaspace/FX/AUD_LoopFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_LOOPFACTORY
-#define AUD_LOOPFACTORY
+#ifndef __AUD_LOOPFACTORY_H__
+#define __AUD_LOOPFACTORY_H__
 
 #include "AUD_EffectFactory.h"
 
@@ -65,4 +65,4 @@ public:
 	virtual AUD_Reference<AUD_IReader> createReader();
 };
 
-#endif //AUD_LOOPFACTORY
+#endif //__AUD_LOOPFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_LoopReader.h b/intern/audaspace/FX/AUD_LoopReader.h
index b062a17..fd2dd71 100644
--- a/intern/audaspace/FX/AUD_LoopReader.h
+++ b/intern/audaspace/FX/AUD_LoopReader.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_LOOPREADER
-#define AUD_LOOPREADER
+#ifndef __AUD_LOOPREADER_H__
+#define __AUD_LOOPREADER_H__
 
 #include "AUD_EffectReader.h"
 #include "AUD_Buffer.h"
@@ -69,4 +69,4 @@ public:
 	virtual void read(int& length, bool& eos, sample_t* buffer);
 };
 
-#endif //AUD_LOOPREADER
+#endif //__AUD_LOOPREADER_H__
diff --git a/intern/audaspace/FX/AUD_LowpassFactory.h b/intern/audaspace/FX/AUD_LowpassFactory.h
index 90d6ac5..7e98720 100644
--- a/intern/audaspace/FX/AUD_LowpassFactory.h
+++ b/intern/audaspace/FX/AUD_LowpassFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_LOWPASSFACTORY
-#define AUD_LOWPASSFACTORY
+#ifndef __AUD_LOWPASSFACTORY_H__
+#define __AUD_LOWPASSFACTORY_H__
 
 #include "AUD_DynamicIIRFilterFactory.h"
 
@@ -64,4 +64,4 @@ public:
 	virtual void recalculateCoefficients(AUD_SampleRate rate, std::vector<float> &b, std::vector<float> &a);
 };
 
-#endif //AUD_LOWPASSFACTORY
+#endif //__AUD_LOWPASSFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_PingPongFactory.h b/intern/audaspace/FX/AUD_PingPongFactory.h
index 4a5f3fc..f25624a 100644
--- a/intern/audaspace/FX/AUD_PingPongFactory.h
+++ b/intern/audaspace/FX/AUD_PingPongFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_PINGPONGFACTORY
-#define AUD_PINGPONGFACTORY
+#ifndef __AUD_PINGPONGFACTORY_H__
+#define __AUD_PINGPONGFACTORY_H__
 
 #include "AUD_EffectFactory.h"
 
@@ -53,4 +53,4 @@ public:
 	virtual AUD_Reference<AUD_IReader> createReader();
 };
 
-#endif //AUD_PINGPONGFACTORY
+#endif //__AUD_PINGPONGFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_PitchFactory.h b/intern/audaspace/FX/AUD_PitchFactory.h
index c311a9e..5ad37ad 100644
--- a/intern/audaspace/FX/AUD_PitchFactory.h
+++ b/intern/audaspace/FX/AUD_PitchFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_PITCHFACTORY
-#define AUD_PITCHFACTORY
+#ifndef __AUD_PITCHFACTORY_H__
+#define __AUD_PITCHFACTORY_H__
 
 #include "AUD_EffectFactory.h"
 
@@ -58,4 +58,4 @@ public:
 	virtual AUD_Reference<AUD_IReader> createReader();
 };
 
-#endif //AUD_PITCHFACTORY
+#endif //__AUD_PITCHFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_PitchReader.h b/intern/audaspace/FX/AUD_PitchReader.h
index dcd23b7..3185bfd 100644
--- a/intern/audaspace/FX/AUD_PitchReader.h
+++ b/intern/audaspace/FX/AUD_PitchReader.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_PITCHREADER
-#define AUD_PITCHREADER
+#ifndef __AUD_PITCHREADER_H__
+#define __AUD_PITCHREADER_H__
 
 #include "AUD_EffectReader.h"
 
@@ -70,4 +70,4 @@ public:
 	void setPitch(float pitch);
 };
 
-#endif //AUD_PITCHREADER
+#endif //__AUD_PITCHREADER_H__
diff --git a/intern/audaspace/FX/AUD_RectifyFactory.h b/intern/audaspace/FX/AUD_RectifyFactory.h
index 2e3dbd1..5ad41d4 100644
--- a/intern/audaspace/FX/AUD_RectifyFactory.h
+++ b/intern/audaspace/FX/AUD_RectifyFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_RECTIFYFACTORY
-#define AUD_RECTIFYFACTORY
+#ifndef __AUD_RECTIFYFACTORY_H__
+#define __AUD_RECTIFYFACTORY_H__
 
 #include "AUD_EffectFactory.h"
 class AUD_CallbackIIRFilterReader;
@@ -55,4 +55,4 @@ public:
 	static sample_t rectifyFilter(AUD_CallbackIIRFilterReader* reader, void* useless);
 };
 
-#endif //AUD_RECTIFYFACTORY
+#endif //__AUD_RECTIFYFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_ReverseFactory.h b/intern/audaspace/FX/AUD_ReverseFactory.h
index 6305fb5..e2d75dc 100644
--- a/intern/audaspace/FX/AUD_ReverseFactory.h
+++ b/intern/audaspace/FX/AUD_ReverseFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_REVERSEFACTORY
-#define AUD_REVERSEFACTORY
+#ifndef __AUD_REVERSEFACTORY_H__
+#define __AUD_REVERSEFACTORY_H__
 
 #include "AUD_EffectFactory.h"
 
@@ -53,4 +53,4 @@ public:
 	virtual AUD_Reference<AUD_IReader> createReader();
 };
 
-#endif //AUD_REVERSEFACTORY
+#endif //__AUD_REVERSEFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_ReverseReader.h b/intern/audaspace/FX/AUD_ReverseReader.h
index 1b3dfd7..d1e5179 100644
--- a/intern/audaspace/FX/AUD_ReverseReader.h
+++ b/intern/audaspace/FX/AUD_ReverseReader.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_REVERSEREADER
-#define AUD_REVERSEREADER
+#ifndef __AUD_REVERSEREADER_H__
+#define __AUD_REVERSEREADER_H__
 
 #include "AUD_EffectReader.h"
 #include "AUD_Buffer.h"
@@ -69,4 +69,4 @@ public:
 	virtual void read(int& length, bool& eos, sample_t* buffer);
 };
 
-#endif //AUD_REVERSEREADER
+#endif //__AUD_REVERSEREADER_H__
diff --git a/intern/audaspace/FX/AUD_SquareFactory.h b/intern/audaspace/FX/AUD_SquareFactory.h
index aff24b0..9c0dea2 100644
--- a/intern/audaspace/FX/AUD_SquareFactory.h
+++ b/intern/audaspace/FX/AUD_SquareFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_SQUAREFACTORY
-#define AUD_SQUAREFACTORY
+#ifndef __AUD_SQUAREFACTORY_H__
+#define __AUD_SQUAREFACTORY_H__
 
 #include "AUD_EffectFactory.h"
 class AUD_CallbackIIRFilterReader;
@@ -67,4 +67,4 @@ public:
 	static void endSquareFilter(float* threshold);
 };
 
-#endif //AUD_SQUAREFACTORY
+#endif //__AUD_SQUAREFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_SumFactory.h b/intern/audaspace/FX/AUD_SumFactory.h
index c971730..ec17faf 100644
--- a/intern/audaspace/FX/AUD_SumFactory.h
+++ b/intern/audaspace/FX/AUD_SumFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_SUMFACTORY
-#define AUD_SUMFACTORY
+#ifndef __AUD_SUMFACTORY_H__
+#define __AUD_SUMFACTORY_H__
 
 #include "AUD_EffectFactory.h"
 
@@ -52,4 +52,4 @@ public:
 	virtual AUD_Reference<AUD_IReader> createReader();
 };
 
-#endif //AUD_SUMFACTORY
+#endif //__AUD_SUMFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_SuperposeFactory.h b/intern/audaspace/FX/AUD_SuperposeFactory.h
index adfb1c2..2da8e34 100644
--- a/intern/audaspace/FX/AUD_SuperposeFactory.h
+++ b/intern/audaspace/FX/AUD_SuperposeFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_SUPERPOSEFACTORY
-#define AUD_SUPERPOSEFACTORY
+#ifndef __AUD_SUPERPOSEFACTORY_H__
+#define __AUD_SUPERPOSEFACTORY_H__
 
 #include "AUD_IFactory.h"
 
@@ -65,4 +65,4 @@ public:
 	virtual AUD_Reference<AUD_IReader> createReader();
 };
 
-#endif //AUD_SUPERPOSEFACTORY
+#endif //__AUD_SUPERPOSEFACTORY_H__
diff --git a/intern/audaspace/FX/AUD_SuperposeReader.h b/intern/audaspace/FX/AUD_SuperposeReader.h
index 8a1b269..d0fde13 100644
--- a/intern/audaspace/FX/AUD_SuperposeReader.h
+++ b/intern/audaspace/FX/AUD_SuperposeReader.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_SUPERPOSEREADER
-#define AUD_SUPERPOSEREADER
+#ifndef __AUD_SUPERPOSEREADER_H__
+#define __AUD_SUPERPOSEREADER_H__
 
 #include "AUD_IReader.h"
 #include "AUD_Buffer.h"
@@ -81,4 +81,4 @@ public:
 	virtual void read(int& length, bool& eos, sample_t* buffer);
 };
 
-#endif //AUD_SUPERPOSEREADER
+#endif //__AUD_SUPERPOSEREADER_H__
diff --git a/intern/audaspace/FX/AUD_VolumeFactory.h b/intern/audaspace/FX/AUD_VolumeFactory.h
index ecfab6f..b128383 100644
--- a/intern/audaspace/FX/AUD_VolumeFactory.h
+++ b/intern/audaspace/FX/AUD_VolumeFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_VOLUMEFACTORY
-#define AUD_VOLUMEFACTORY
+#ifndef __AUD_VOLUMEFACTORY_H__
+#define __AUD_VOLUMEFACTORY_H__
 
 #include "AUD_EffectFactory.h"
 
@@ -66,4 +66,4 @@ public:
 	virtual AUD_Reference<AUD_IReader> createReader();
 };
 
-#endif //AUD_VOLUMEFACTORY
+#endif //__AUD_VOLUMEFACTORY_H__
diff --git a/intern/audaspace/OpenAL/AUD_OpenALDevice.h b/intern/audaspace/OpenAL/AUD_OpenALDevice.h
index ff1361c..0a409b4 100644
--- a/intern/audaspace/OpenAL/AUD_OpenALDevice.h
+++ b/intern/audaspace/OpenAL/AUD_OpenALDevice.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_OPENALDEVICE
-#define AUD_OPENALDEVICE
+#ifndef __AUD_OPENALDEVICE_H__
+#define __AUD_OPENALDEVICE_H__
 
 #include "AUD_IDevice.h"
 #include "AUD_IHandle.h"
@@ -277,4 +277,4 @@ public:
 	virtual void setDistanceModel(AUD_DistanceModel model);
 };
 
-#endif //AUD_OPENALDEVICE
+#endif //__AUD_OPENALDEVICE_H__
diff --git a/intern/audaspace/Python/AUD_PyAPI.h b/intern/audaspace/Python/AUD_PyAPI.h
index bcd9e42..7a7e87e 100644
--- a/intern/audaspace/Python/AUD_PyAPI.h
+++ b/intern/audaspace/Python/AUD_PyAPI.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_PYAPI
-#define AUD_PYAPI
+#ifndef __AUD_PYAPI_H__
+#define __AUD_PYAPI_H__
 
 #include "Python.h"
 
@@ -71,4 +71,4 @@ extern Factory* checkFactory(PyObject* factory);
 }
 #endif
 
-#endif //AUD_PYAPI
+#endif //__AUD_PYAPI_H__
diff --git a/intern/audaspace/SConscript b/intern/audaspace/SConscript
index b8d5a56..50c81db 100644
--- a/intern/audaspace/SConscript
+++ b/intern/audaspace/SConscript
@@ -41,7 +41,7 @@ if env['WITH_BF_PYTHON']:
     incs += ' Python ' + env['BF_PYTHON_INC']
     defs.append('WITH_PYTHON')
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
 
 env.BlenderLib ('bf_intern_audaspace', sources, Split(incs), defs, libtype=['intern','player'], priority = [25,215] )
diff --git a/intern/audaspace/SDL/AUD_SDLDevice.h b/intern/audaspace/SDL/AUD_SDLDevice.h
index d77d583..266edd0 100644
--- a/intern/audaspace/SDL/AUD_SDLDevice.h
+++ b/intern/audaspace/SDL/AUD_SDLDevice.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_SDLDEVICE
-#define AUD_SDLDEVICE
+#ifndef __AUD_SDLDEVICE_H__
+#define __AUD_SDLDEVICE_H__
 
 #include "AUD_SoftwareDevice.h"
 
@@ -72,4 +72,4 @@ public:
 	virtual ~AUD_SDLDevice();
 };
 
-#endif //AUD_SDLDEVICE
+#endif //__AUD_SDLDEVICE_H__
diff --git a/intern/audaspace/SRC/AUD_SRCResampleFactory.h b/intern/audaspace/SRC/AUD_SRCResampleFactory.h
index d061cf9..858bb0c 100644
--- a/intern/audaspace/SRC/AUD_SRCResampleFactory.h
+++ b/intern/audaspace/SRC/AUD_SRCResampleFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_SRCRESAMPLEFACTORY
-#define AUD_SRCRESAMPLEFACTORY
+#ifndef __AUD_SRCRESAMPLEFACTORY_H__
+#define __AUD_SRCRESAMPLEFACTORY_H__
 
 #include "AUD_MixerFactory.h"
 
@@ -54,4 +54,4 @@ public:
 	virtual AUD_Reference<AUD_IReader> createReader();
 };
 
-#endif //AUD_SRCRESAMPLEFACTORY
+#endif //__AUD_SRCRESAMPLEFACTORY_H__
diff --git a/intern/audaspace/SRC/AUD_SRCResampleReader.h b/intern/audaspace/SRC/AUD_SRCResampleReader.h
index 26f02be..891b28b 100644
--- a/intern/audaspace/SRC/AUD_SRCResampleReader.h
+++ b/intern/audaspace/SRC/AUD_SRCResampleReader.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_SRCRESAMPLEREADER
-#define AUD_SRCRESAMPLEREADER
+#ifndef __AUD_SRCRESAMPLEREADER_H__
+#define __AUD_SRCRESAMPLEREADER_H__
 
 #include "AUD_ResampleReader.h"
 #include "AUD_Buffer.h"
@@ -100,4 +100,4 @@ public:
 	virtual void read(int& length, bool& eos, sample_t* buffer);
 };
 
-#endif //AUD_SRCRESAMPLEREADER
+#endif //__AUD_SRCRESAMPLEREADER_H__
diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.h b/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.h
index 9d79a5f..349f55d 100644
--- a/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.h
+++ b/intern/audaspace/ffmpeg/AUD_FFMPEGFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_FFMPEGFACTORY
-#define AUD_FFMPEGFACTORY
+#ifndef __AUD_FFMPEGFACTORY_H__
+#define __AUD_FFMPEGFACTORY_H__
 
 #include "AUD_IFactory.h"
 #include "AUD_Reference.h"
@@ -75,4 +75,4 @@ public:
 	virtual AUD_Reference<AUD_IReader> createReader();
 };
 
-#endif //AUD_FFMPEGFACTORY
+#endif //__AUD_FFMPEGFACTORY_H__
diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.h b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.h
index 9a19131..2b354b0 100644
--- a/intern/audaspace/ffmpeg/AUD_FFMPEGReader.h
+++ b/intern/audaspace/ffmpeg/AUD_FFMPEGReader.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_FFMPEGREADER
-#define AUD_FFMPEGREADER
+#ifndef __AUD_FFMPEGREADER_H__
+#define __AUD_FFMPEGREADER_H__
 
 #include "AUD_ConverterFunctions.h"
 #include "AUD_IReader.h"
@@ -161,4 +161,4 @@ public:
 	virtual void read(int& length, bool& eos, sample_t* buffer);
 };
 
-#endif //AUD_FFMPEGREADER
+#endif //__AUD_FFMPEGREADER_H__
diff --git a/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.h b/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.h
index 60200ce..1783030 100644
--- a/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.h
+++ b/intern/audaspace/ffmpeg/AUD_FFMPEGWriter.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_FFMPEGWRITER
-#define AUD_FFMPEGWRITER
+#ifndef __AUD_FFMPEGWRITER_H__
+#define __AUD_FFMPEGWRITER_H__
 
 #include "AUD_ConverterFunctions.h"
 #include "AUD_Buffer.h"
@@ -135,4 +135,4 @@ public:
 	virtual void write(unsigned int length, sample_t* buffer);
 };
 
-#endif //AUD_FFMPEGWRITER
+#endif //__AUD_FFMPEGWRITER_H__
diff --git a/intern/audaspace/fftw/AUD_BandPassFactory.h b/intern/audaspace/fftw/AUD_BandPassFactory.h
index 4891947..75de071 100644
--- a/intern/audaspace/fftw/AUD_BandPassFactory.h
+++ b/intern/audaspace/fftw/AUD_BandPassFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_BANDPASSFACTORY
-#define AUD_BANDPASSFACTORY
+#ifndef __AUD_BANDPASSFACTORY_H__
+#define __AUD_BANDPASSFACTORY_H__
 
 #include "AUD_EffectFactory.h"
 
@@ -89,4 +89,4 @@ public:
 	virtual AUD_IReader* createReader();
 };
 
-#endif //AUD_BANDPASSFACTORY
+#endif //__AUD_BANDPASSFACTORY_H__
diff --git a/intern/audaspace/fftw/AUD_BandPassReader.h b/intern/audaspace/fftw/AUD_BandPassReader.h
index 155b8d7..55a9508 100644
--- a/intern/audaspace/fftw/AUD_BandPassReader.h
+++ b/intern/audaspace/fftw/AUD_BandPassReader.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_BANDPASSREADER
-#define AUD_BANDPASSREADER
+#ifndef __AUD_BANDPASSREADER_H__
+#define __AUD_BANDPASSREADER_H__
 
 #include <fftw3.h>
 
@@ -99,4 +99,4 @@ public:
 	virtual void read(int & length, sample_t* & buffer);
 };
 
-#endif //AUD_BANDPASSREADER
+#endif //__AUD_BANDPASSREADER_H__
diff --git a/intern/audaspace/intern/AUD_3DMath.h b/intern/audaspace/intern/AUD_3DMath.h
index 1859484..f395669 100644
--- a/intern/audaspace/intern/AUD_3DMath.h
+++ b/intern/audaspace/intern/AUD_3DMath.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_3DMATH
-#define AUD_3DMATH
+#ifndef __AUD_3DMATH_H__
+#define __AUD_3DMATH_H__
 
 #include <cmath>
 #include <cstring>
@@ -325,4 +325,4 @@ public:
 	}
 };
 
-#endif //AUD_3DMATH
+#endif //__AUD_3DMATH_H__
diff --git a/intern/audaspace/intern/AUD_AnimateableProperty.h b/intern/audaspace/intern/AUD_AnimateableProperty.h
index 5b51638..2f25e33 100644
--- a/intern/audaspace/intern/AUD_AnimateableProperty.h
+++ b/intern/audaspace/intern/AUD_AnimateableProperty.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_ANIMATEABLEPROPERTY
-#define AUD_ANIMATEABLEPROPERTY
+#ifndef __AUD_ANIMATEABLEPROPERTY_H__
+#define __AUD_ANIMATEABLEPROPERTY_H__
 
 #include "AUD_Buffer.h"
 
@@ -103,4 +103,4 @@ public:
 	bool isAnimated() const;
 };
 
-#endif //AUD_ANIMATEABLEPROPERTY
+#endif //__AUD_ANIMATEABLEPROPERTY_H__
diff --git a/intern/audaspace/intern/AUD_Buffer.h b/intern/audaspace/intern/AUD_Buffer.h
index 7a30d3b..d3207f0 100644
--- a/intern/audaspace/intern/AUD_Buffer.h
+++ b/intern/audaspace/intern/AUD_Buffer.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_BUFFER
-#define AUD_BUFFER
+#ifndef __AUD_BUFFER_H__
+#define __AUD_BUFFER_H__
 
 #include "AUD_Space.h"
 
@@ -90,4 +90,4 @@ public:
 	void assureSize(int size, bool keep = false);
 };
 
-#endif //AUD_BUFFER
+#endif //__AUD_BUFFER_H__
diff --git a/intern/audaspace/intern/AUD_BufferReader.h b/intern/audaspace/intern/AUD_BufferReader.h
index f648bae..0e8c5de 100644
--- a/intern/audaspace/intern/AUD_BufferReader.h
+++ b/intern/audaspace/intern/AUD_BufferReader.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_BUFFERREADER
-#define AUD_BUFFERREADER
+#ifndef __AUD_BUFFERREADER_H__
+#define __AUD_BUFFERREADER_H__
 
 #include "AUD_IReader.h"
 #include "AUD_Reference.h"
@@ -77,4 +77,4 @@ public:
 	virtual void read(int& length, bool& eos, sample_t* buffer);
 };
 
-#endif //AUD_BUFFERREADER
+#endif //__AUD_BUFFERREADER_H__
diff --git a/intern/audaspace/intern/AUD_C-API.h b/intern/audaspace/intern/AUD_C-API.h
index 2b7c94b..8388af2 100644
--- a/intern/audaspace/intern/AUD_C-API.h
+++ b/intern/audaspace/intern/AUD_C-API.h
@@ -26,8 +26,8 @@
  *  \ingroup audaspace
  */
  
-#ifndef AUD_CAPI
-#define AUD_CAPI
+#ifndef __AUD_C_API_H__
+#define __AUD_C_API_H__
 
 #ifdef WITH_PYTHON
 #include "Python.h"
@@ -755,4 +755,4 @@ AUD_Reference<AUD_IDevice> AUD_getDevice();
 AUD_I3DDevice* AUD_get3DDevice();
 #endif
 
-#endif //AUD_CAPI
+#endif //__AUD_C_API_H__
diff --git a/intern/audaspace/intern/AUD_ChannelMapperFactory.h b/intern/audaspace/intern/AUD_ChannelMapperFactory.h
index 4c88cb8..b60a32d 100644
--- a/intern/audaspace/intern/AUD_ChannelMapperFactory.h
+++ b/intern/audaspace/intern/AUD_ChannelMapperFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_CHANNELMAPPERFACTORY
-#define AUD_CHANNELMAPPERFACTORY
+#ifndef __AUD_CHANNELMAPPERFACTORY_H__
+#define __AUD_CHANNELMAPPERFACTORY_H__
 
 #include "AUD_MixerFactory.h"
 
@@ -54,4 +54,4 @@ public:
 	virtual AUD_Reference<AUD_IReader> createReader();
 };
 
-#endif //AUD_CHANNELMAPPERFACTORY
+#endif //__AUD_CHANNELMAPPERFACTORY_H__
diff --git a/intern/audaspace/intern/AUD_ChannelMapperReader.h b/intern/audaspace/intern/AUD_ChannelMapperReader.h
index 8e3ff0d..32adb05 100644
--- a/intern/audaspace/intern/AUD_ChannelMapperReader.h
+++ b/intern/audaspace/intern/AUD_ChannelMapperReader.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_CHANNELMAPPERREADER
-#define AUD_CHANNELMAPPERREADER
+#ifndef __AUD_CHANNELMAPPERREADER_H__
+#define __AUD_CHANNELMAPPERREADER_H__
 
 #include "AUD_EffectReader.h"
 #include "AUD_Buffer.h"
@@ -133,4 +133,4 @@ public:
 	virtual void read(int& length, bool& eos, sample_t* buffer);
 };
 
-#endif //AUD_CHANNELMAPPERREADER
+#endif //__AUD_CHANNELMAPPERREADER_H__
diff --git a/intern/audaspace/intern/AUD_ConverterFactory.h b/intern/audaspace/intern/AUD_ConverterFactory.h
index 04dfe9e..3211b60 100644
--- a/intern/audaspace/intern/AUD_ConverterFactory.h
+++ b/intern/audaspace/intern/AUD_ConverterFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_CONVERTERFACTORY
-#define AUD_CONVERTERFACTORY
+#ifndef __AUD_CONVERTERFACTORY_H__
+#define __AUD_CONVERTERFACTORY_H__
 
 #include "AUD_MixerFactory.h"
 
@@ -54,4 +54,4 @@ public:
 	virtual AUD_Reference<AUD_IReader> createReader();
 };
 
-#endif //AUD_CONVERTERFACTORY
+#endif //__AUD_CONVERTERFACTORY_H__
diff --git a/intern/audaspace/intern/AUD_ConverterFunctions.cpp b/intern/audaspace/intern/AUD_ConverterFunctions.cpp
index 53a644e..c20f19a 100644
--- a/intern/audaspace/intern/AUD_ConverterFunctions.cpp
+++ b/intern/audaspace/intern/AUD_ConverterFunctions.cpp
@@ -31,11 +31,11 @@
 #include "AUD_Buffer.h"
 
 #define AUD_U8_0		0x80
-#define AUD_S16_MAX		0x7FFF
-#define AUD_S16_MIN		0x8000
+#define AUD_S16_MAX		((int16_t)0x7FFF)
+#define AUD_S16_MIN		((int16_t)0x8000)
 #define AUD_S16_FLT		32767.0f
-#define AUD_S32_MAX		0x7FFFFFFF
-#define AUD_S32_MIN		0x80000000
+#define AUD_S32_MAX		((int32_t)0x7FFFFFFF)
+#define AUD_S32_MIN		((int32_t)0x80000000)
 #define AUD_S32_FLT		2147483647.0f
 #define AUD_FLT_MAX		1.0f
 #define AUD_FLT_MIN		-1.0f
diff --git a/intern/audaspace/intern/AUD_ConverterFunctions.h b/intern/audaspace/intern/AUD_ConverterFunctions.h
index 35a8012..1ffcf6c 100644
--- a/intern/audaspace/intern/AUD_ConverterFunctions.h
+++ b/intern/audaspace/intern/AUD_ConverterFunctions.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_CONVERTERFUNCTIONS
-#define AUD_CONVERTERFUNCTIONS
+#ifndef __AUD_CONVERTERFUNCTIONS_H__
+#define __AUD_CONVERTERFUNCTIONS_H__
 
 #include "AUD_Space.h"
 
@@ -135,4 +135,4 @@ void AUD_convert_double_s32(data_t* target, data_t* source, int length);
 
 void AUD_convert_double_float(data_t* target, data_t* source, int length);
 
-#endif //AUD_CONVERTERFUNCTIONS
+#endif //__AUD_CONVERTERFUNCTIONS_H__
diff --git a/intern/audaspace/intern/AUD_ConverterReader.h b/intern/audaspace/intern/AUD_ConverterReader.h
index 9846664..2dedbd8 100644
--- a/intern/audaspace/intern/AUD_ConverterReader.h
+++ b/intern/audaspace/intern/AUD_ConverterReader.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_CONVERTERREADER
-#define AUD_CONVERTERREADER
+#ifndef __AUD_CONVERTERREADER_H__
+#define __AUD_CONVERTERREADER_H__
 
 #include "AUD_EffectReader.h"
 #include "AUD_ConverterFunctions.h"
@@ -70,4 +70,4 @@ public:
 	virtual void read(int& length, bool& eos, sample_t* buffer);
 };
 
-#endif //AUD_CONVERTERREADER
+#endif //__AUD_CONVERTERREADER_H__
diff --git a/intern/audaspace/intern/AUD_FileFactory.h b/intern/audaspace/intern/AUD_FileFactory.h
index b39db27..4ea4a93 100644
--- a/intern/audaspace/intern/AUD_FileFactory.h
+++ b/intern/audaspace/intern/AUD_FileFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_FILEFACTORY
-#define AUD_FILEFACTORY
+#ifndef __AUD_FILEFACTORY_H__
+#define __AUD_FILEFACTORY_H__
 
 #include "AUD_IFactory.h"
 #include "AUD_Reference.h"
@@ -73,4 +73,4 @@ public:
 	virtual AUD_Reference<AUD_IReader> createReader();
 };
 
-#endif //AUD_FILEFACTORY
+#endif //__AUD_FILEFACTORY_H__
diff --git a/intern/audaspace/intern/AUD_FileWriter.h b/intern/audaspace/intern/AUD_FileWriter.h
index 9ff083e..c9ee2b1 100644
--- a/intern/audaspace/intern/AUD_FileWriter.h
+++ b/intern/audaspace/intern/AUD_FileWriter.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_FILEWRITER
-#define AUD_FILEWRITER
+#ifndef __AUD_FILEWRITER_H__
+#define __AUD_FILEWRITER_H__
 
 #include <string>
 
@@ -70,4 +70,4 @@ public:
 	static void writeReader(AUD_Reference<AUD_IReader> reader, AUD_Reference<AUD_IWriter> writer, unsigned int length, unsigned int buffersize);
 };
 
-#endif //AUD_FILEWRITER
+#endif //__AUD_FILEWRITER_H__
diff --git a/intern/audaspace/intern/AUD_I3DDevice.h b/intern/audaspace/intern/AUD_I3DDevice.h
index 6805262..1df710b 100644
--- a/intern/audaspace/intern/AUD_I3DDevice.h
+++ b/intern/audaspace/intern/AUD_I3DDevice.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_I3DDEVICE
-#define AUD_I3DDEVICE
+#ifndef __AUD_I3DDEVICE_H__
+#define __AUD_I3DDEVICE_H__
 
 #include "AUD_Space.h"
 #include "AUD_3DMath.h"
@@ -119,4 +119,4 @@ public:
 	virtual void setDistanceModel(AUD_DistanceModel model)=0;
 };
 
-#endif //AUD_I3DDEVICE
+#endif //__AUD_I3DDEVICE_H__
diff --git a/intern/audaspace/intern/AUD_I3DHandle.h b/intern/audaspace/intern/AUD_I3DHandle.h
index 78be55d..69ca985 100644
--- a/intern/audaspace/intern/AUD_I3DHandle.h
+++ b/intern/audaspace/intern/AUD_I3DHandle.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_I3DHANDLE
-#define AUD_I3DHANDLE
+#ifndef __AUD_I3DHANDLE_H__
+#define __AUD_I3DHANDLE_H__
 
 #include "AUD_Space.h"
 #include "AUD_3DMath.h"
@@ -213,4 +213,4 @@ public:
 	virtual bool setConeVolumeOuter(float volume)=0;
 };
 
-#endif //AUD_I3DHANDLE
+#endif //__AUD_I3DHANDLE_H__
diff --git a/intern/audaspace/intern/AUD_IDevice.h b/intern/audaspace/intern/AUD_IDevice.h
index 28765e9..1d6f8ca 100644
--- a/intern/audaspace/intern/AUD_IDevice.h
+++ b/intern/audaspace/intern/AUD_IDevice.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_IDEVICE
-#define AUD_IDEVICE
+#ifndef __AUD_IDEVICE_H__
+#define __AUD_IDEVICE_H__
 
 #include "AUD_Space.h"
 #include "AUD_Reference.h"
diff --git a/intern/audaspace/intern/AUD_IFactory.h b/intern/audaspace/intern/AUD_IFactory.h
index a19a577..a7c214b 100644
--- a/intern/audaspace/intern/AUD_IFactory.h
+++ b/intern/audaspace/intern/AUD_IFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_IFACTORY
-#define AUD_IFACTORY
+#ifndef __AUD_IFACTORY_H__
+#define __AUD_IFACTORY_H__
 
 #include "AUD_Space.h"
 #include "AUD_Reference.h"
@@ -57,4 +57,4 @@ public:
 	virtual AUD_Reference<AUD_IReader> createReader()=0;
 };
 
-#endif //AUD_IFACTORY
+#endif //__AUD_IFACTORY_H__
diff --git a/intern/audaspace/intern/AUD_IHandle.h b/intern/audaspace/intern/AUD_IHandle.h
index 33c64f5..9dcb743 100644
--- a/intern/audaspace/intern/AUD_IHandle.h
+++ b/intern/audaspace/intern/AUD_IHandle.h
@@ -26,8 +26,8 @@
  *  \ingroup audaspaceintern
  */
 
-#ifndef AUD_IHANDLE
-#define AUD_IHANDLE
+#ifndef __AUD_IHANDLE_H__
+#define __AUD_IHANDLE_H__
 
 //#include "AUD_Space.h"
 //#include "AUD_Reference.h"
diff --git a/intern/audaspace/intern/AUD_IReader.h b/intern/audaspace/intern/AUD_IReader.h
index 2c92e75..8e0e03d 100644
--- a/intern/audaspace/intern/AUD_IReader.h
+++ b/intern/audaspace/intern/AUD_IReader.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_IREADER
-#define AUD_IREADER
+#ifndef __AUD_IREADER_H__
+#define __AUD_IREADER_H__
 
 #include "AUD_Space.h"
 
@@ -94,4 +94,4 @@ public:
 	virtual void read(int& length, bool& eos, sample_t* buffer)=0;
 };
 
-#endif //AUD_IREADER
+#endif //__AUD_IREADER_H__
diff --git a/intern/audaspace/intern/AUD_IWriter.h b/intern/audaspace/intern/AUD_IWriter.h
index 401faea..3c92661 100644
--- a/intern/audaspace/intern/AUD_IWriter.h
+++ b/intern/audaspace/intern/AUD_IWriter.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_IWRITER
-#define AUD_IWRITER
+#ifndef __AUD_IWRITER_H__
+#define __AUD_IWRITER_H__
 
 #include "AUD_Space.h"
 
@@ -64,4 +64,4 @@ public:
 	virtual void write(unsigned int length, sample_t* buffer)=0;
 };
 
-#endif //AUD_IWRITER
+#endif //__AUD_IWRITER_H__
diff --git a/intern/audaspace/intern/AUD_JOSResampleFactory.h b/intern/audaspace/intern/AUD_JOSResampleFactory.h
index a4a303f..6d18150 100644
--- a/intern/audaspace/intern/AUD_JOSResampleFactory.h
+++ b/intern/audaspace/intern/AUD_JOSResampleFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_JOSRESAMPLEFACTORY
-#define AUD_JOSRESAMPLEFACTORY
+#ifndef __AUD_JOSRESAMPLEFACTORY_H__
+#define __AUD_JOSRESAMPLEFACTORY_H__
 
 #include "AUD_MixerFactory.h"
 
@@ -53,4 +53,4 @@ public:
 	virtual AUD_Reference<AUD_IReader> createReader();
 };
 
-#endif //AUD_JOSRESAMPLEFACTORY
+#endif //__AUD_JOSRESAMPLEFACTORY_H__
diff --git a/intern/audaspace/intern/AUD_JOSResampleReader.cpp b/intern/audaspace/intern/AUD_JOSResampleReader.cpp
index 2fb8b86..0f7a038 100644
--- a/intern/audaspace/intern/AUD_JOSResampleReader.cpp
+++ b/intern/audaspace/intern/AUD_JOSResampleReader.cpp
@@ -200,7 +200,7 @@ void AUD_JOSResampleReader::updateBuffer(int size, double factor, int samplesize
 				left\
 			}\
 \
-			P = -P;\
+			P = 0 - P;\
 \
 			end = (int_to_fp(m_len) - P) / P_increment - 1;\
 			if(m_cache_valid - m_n - 2 < end)\
diff --git a/intern/audaspace/intern/AUD_JOSResampleReader.h b/intern/audaspace/intern/AUD_JOSResampleReader.h
index c05a160..94524c1 100644
--- a/intern/audaspace/intern/AUD_JOSResampleReader.h
+++ b/intern/audaspace/intern/AUD_JOSResampleReader.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_JOSRESAMPLEREADER
-#define AUD_JOSRESAMPLEREADER
+#ifndef __AUD_JOSRESAMPLEREADER_H__
+#define __AUD_JOSRESAMPLEREADER_H__
 
 #include "AUD_ResampleReader.h"
 #include "AUD_Buffer.h"
@@ -132,4 +132,4 @@ public:
 	virtual void read(int& length, bool& eos, sample_t* buffer);
 };
 
-#endif //AUD_JOSRESAMPLEREADER
+#endif //__AUD_JOSRESAMPLEREADER_H__
diff --git a/intern/audaspace/intern/AUD_LinearResampleFactory.h b/intern/audaspace/intern/AUD_LinearResampleFactory.h
index e1e9cc7..7d9efa0 100644
--- a/intern/audaspace/intern/AUD_LinearResampleFactory.h
+++ b/intern/audaspace/intern/AUD_LinearResampleFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_LINEARRESAMPLEFACTORY
-#define AUD_LINEARRESAMPLEFACTORY
+#ifndef __AUD_LINEARRESAMPLEFACTORY_H__
+#define __AUD_LINEARRESAMPLEFACTORY_H__
 
 #include "AUD_MixerFactory.h"
 
@@ -53,4 +53,4 @@ public:
 	virtual AUD_Reference<AUD_IReader> createReader();
 };
 
-#endif //AUD_LINEARRESAMPLEFACTORY
+#endif //__AUD_LINEARRESAMPLEFACTORY_H__
diff --git a/intern/audaspace/intern/AUD_LinearResampleReader.h b/intern/audaspace/intern/AUD_LinearResampleReader.h
index 1370825..4f6d422 100644
--- a/intern/audaspace/intern/AUD_LinearResampleReader.h
+++ b/intern/audaspace/intern/AUD_LinearResampleReader.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_LINEARRESAMPLEREADER
-#define AUD_LINEARRESAMPLEREADER
+#ifndef __AUD_LINEARRESAMPLEREADER_H__
+#define __AUD_LINEARRESAMPLEREADER_H__
 
 #include "AUD_ResampleReader.h"
 #include "AUD_Buffer.h"
@@ -83,4 +83,4 @@ public:
 	virtual void read(int& length, bool& eos, sample_t* buffer);
 };
 
-#endif //AUD_LINEARRESAMPLEREADER
+#endif //__AUD_LINEARRESAMPLEREADER_H__
diff --git a/intern/audaspace/intern/AUD_Mixer.h b/intern/audaspace/intern/AUD_Mixer.h
index e1b67ac..0de9b7f 100644
--- a/intern/audaspace/intern/AUD_Mixer.h
+++ b/intern/audaspace/intern/AUD_Mixer.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_MIXER
-#define AUD_MIXER
+#ifndef __AUD_MIXER_H__
+#define __AUD_MIXER_H__
 
 #include "AUD_ConverterFunctions.h"
 #include "AUD_Buffer.h"
@@ -108,4 +108,4 @@ public:
 	void clear(int length);
 };
 
-#endif //AUD_MIXER
+#endif //__AUD_MIXER_H__
diff --git a/intern/audaspace/intern/AUD_MixerFactory.h b/intern/audaspace/intern/AUD_MixerFactory.h
index e3627de..d65eb8e 100644
--- a/intern/audaspace/intern/AUD_MixerFactory.h
+++ b/intern/audaspace/intern/AUD_MixerFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_MIXERFACTORY
-#define AUD_MIXERFACTORY
+#ifndef __AUD_MIXERFACTORY_H__
+#define __AUD_MIXERFACTORY_H__
 
 #include "AUD_IFactory.h"
 
@@ -76,4 +76,4 @@ public:
 	AUD_Reference<AUD_IFactory> getFactory() const;
 };
 
-#endif //AUD_MIXERFACTORY
+#endif //__AUD_MIXERFACTORY_H__
diff --git a/intern/audaspace/intern/AUD_NULLDevice.h b/intern/audaspace/intern/AUD_NULLDevice.h
index 6ac8efd..ee97b15 100644
--- a/intern/audaspace/intern/AUD_NULLDevice.h
+++ b/intern/audaspace/intern/AUD_NULLDevice.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_NULLDEVICE
-#define AUD_NULLDEVICE
+#ifndef __AUD_NULLDEVICE_H__
+#define __AUD_NULLDEVICE_H__
 
 #include "AUD_IReader.h"
 #include "AUD_IDevice.h"
@@ -81,4 +81,4 @@ public:
 	virtual void setVolume(float volume);
 };
 
-#endif //AUD_NULLDEVICE
+#endif //__AUD_NULLDEVICE_H__
diff --git a/intern/audaspace/intern/AUD_PyInit.h b/intern/audaspace/intern/AUD_PyInit.h
index dc24571..8c045e6 100644
--- a/intern/audaspace/intern/AUD_PyInit.h
+++ b/intern/audaspace/intern/AUD_PyInit.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_PYINIT
-#define AUD_PYINIT
+#ifndef __AUD_PYINIT_H__
+#define __AUD_PYINIT_H__
 
 #ifdef WITH_PYTHON
 #include "Python.h"
@@ -48,4 +48,4 @@ extern PyObject* AUD_initPython(void);
 
 #endif
 
-#endif //AUD_PYINIT
+#endif //__AUD_PYINIT_H__
diff --git a/intern/audaspace/intern/AUD_ReadDevice.h b/intern/audaspace/intern/AUD_ReadDevice.h
index 9e362b4..0f077fe 100644
--- a/intern/audaspace/intern/AUD_ReadDevice.h
+++ b/intern/audaspace/intern/AUD_ReadDevice.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_READDEVICE
-#define AUD_READDEVICE
+#ifndef __AUD_READDEVICE_H__
+#define __AUD_READDEVICE_H__
 
 #include "AUD_SoftwareDevice.h"
 
@@ -85,4 +85,4 @@ public:
 	void changeSpecs(AUD_Specs specs);
 };
 
-#endif //AUD_READDEVICE
+#endif //__AUD_READDEVICE_H__
diff --git a/intern/audaspace/intern/AUD_Reference.h b/intern/audaspace/intern/AUD_Reference.h
index 0d1c754..2e07417 100644
--- a/intern/audaspace/intern/AUD_Reference.h
+++ b/intern/audaspace/intern/AUD_Reference.h
@@ -26,8 +26,8 @@
  *  \ingroup audaspaceintern
  */
 
-#ifndef AUD_REFERENCE
-#define AUD_REFERENCE
+#ifndef __AUD_REFERENCE_H__
+#define __AUD_REFERENCE_H__
 
 #include <map>
 #include <cstddef>
@@ -244,4 +244,4 @@ inline bool operator!=(const AUD_Reference<T>& a, const AUD_Reference<U>& b)
 	return a.getOriginal() != b.getOriginal();
 }
 
-#endif // AUD_REFERENCE
+#endif // __AUD_REFERENCE_H__
diff --git a/intern/audaspace/intern/AUD_ResampleFactory.h b/intern/audaspace/intern/AUD_ResampleFactory.h
index 34549c1..11f8dc1 100644
--- a/intern/audaspace/intern/AUD_ResampleFactory.h
+++ b/intern/audaspace/intern/AUD_ResampleFactory.h
@@ -27,11 +27,11 @@
  */
 
 
-#ifndef AUD_RESAMPLEFACTORY
-#define AUD_RESAMPLEFACTORY
+#ifndef __AUD_RESAMPLEFACTORY_H__
+#define __AUD_RESAMPLEFACTORY_H__
 
 #include "AUD_MixerFactory.h"
 
 typedef AUD_MixerFactory AUD_ResampleFactory;
 
-#endif //AUD_RESAMPLEFACTORY
+#endif //__AUD_RESAMPLEFACTORY_H__
diff --git a/intern/audaspace/intern/AUD_ResampleReader.h b/intern/audaspace/intern/AUD_ResampleReader.h
index 9c3e671..c423326 100644
--- a/intern/audaspace/intern/AUD_ResampleReader.h
+++ b/intern/audaspace/intern/AUD_ResampleReader.h
@@ -26,8 +26,8 @@
  *  \ingroup audaspaceintern
  */
 
-#ifndef AUD_RESAMPLEREADER
-#define AUD_RESAMPLEREADER
+#ifndef __AUD_RESAMPLEREADER_H__
+#define __AUD_RESAMPLEREADER_H__
 
 #include "AUD_EffectReader.h"
 
@@ -63,4 +63,4 @@ public:
 	virtual AUD_SampleRate getRate();
 };
 
-#endif // AUD_RESAMPLEREADER
+#endif // __AUD_RESAMPLEREADER_H__
diff --git a/intern/audaspace/intern/AUD_SequencerEntry.h b/intern/audaspace/intern/AUD_SequencerEntry.h
index 3a5a51a..7ff6fff 100644
--- a/intern/audaspace/intern/AUD_SequencerEntry.h
+++ b/intern/audaspace/intern/AUD_SequencerEntry.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_SEQUENCERENTRY
-#define AUD_SEQUENCERENTRY
+#ifndef __AUD_SEQUENCERENTRY_H__
+#define __AUD_SEQUENCERENTRY_H__
 
 #include "AUD_Reference.h"
 #include "AUD_AnimateableProperty.h"
@@ -315,4 +315,4 @@ public:
 	void setConeVolumeOuter(float volume);
 };
 
-#endif //AUD_SEQUENCERENTRY
+#endif //__AUD_SEQUENCERENTRY_H__
diff --git a/intern/audaspace/intern/AUD_SequencerFactory.h b/intern/audaspace/intern/AUD_SequencerFactory.h
index 08d18fc..3824111 100644
--- a/intern/audaspace/intern/AUD_SequencerFactory.h
+++ b/intern/audaspace/intern/AUD_SequencerFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_SEQUENCERFACTORY
-#define AUD_SEQUENCERFACTORY
+#ifndef __AUD_SEQUENCERFACTORY_H__
+#define __AUD_SEQUENCERFACTORY_H__
 
 #include "AUD_IFactory.h"
 #include "AUD_AnimateableProperty.h"
@@ -210,4 +210,4 @@ public:
 	virtual AUD_Reference<AUD_IReader> createReader();
 };
 
-#endif //AUD_SEQUENCERFACTORY
+#endif //__AUD_SEQUENCERFACTORY_H__
diff --git a/intern/audaspace/intern/AUD_SequencerHandle.h b/intern/audaspace/intern/AUD_SequencerHandle.h
index c7fd3f0..72d3240 100644
--- a/intern/audaspace/intern/AUD_SequencerHandle.h
+++ b/intern/audaspace/intern/AUD_SequencerHandle.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_SEQUENCERHANDLE
-#define AUD_SEQUENCERHANDLE
+#ifndef __AUD_SEQUENCERHANDLE_H__
+#define __AUD_SEQUENCERHANDLE_H__
 
 #include "AUD_SequencerEntry.h"
 #include "AUD_IHandle.h"
@@ -103,4 +103,4 @@ public:
 	void seek(float position);
 };
 
-#endif //AUD_SEQUENCERHANDLE
+#endif //__AUD_SEQUENCERHANDLE_H__
diff --git a/intern/audaspace/intern/AUD_SequencerReader.cpp b/intern/audaspace/intern/AUD_SequencerReader.cpp
index 7c8fe9e..2e41a99 100644
--- a/intern/audaspace/intern/AUD_SequencerReader.cpp
+++ b/intern/audaspace/intern/AUD_SequencerReader.cpp
@@ -49,6 +49,9 @@ bool AUD_SequencerReader::isSeekable() const
 
 void AUD_SequencerReader::seek(int position)
 {
+	if(position < 0)
+		return;
+
 	m_position = position;
 
 	for(AUD_HandleIterator it = m_handles.begin(); it != m_handles.end(); it++)
diff --git a/intern/audaspace/intern/AUD_SequencerReader.h b/intern/audaspace/intern/AUD_SequencerReader.h
index a412083..b3c3a3e 100644
--- a/intern/audaspace/intern/AUD_SequencerReader.h
+++ b/intern/audaspace/intern/AUD_SequencerReader.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_SEQUENCERREADER
-#define AUD_SEQUENCERREADER
+#ifndef __AUD_SEQUENCERREADER_H__
+#define __AUD_SEQUENCERREADER_H__
 
 #include "AUD_IReader.h"
 #include "AUD_ReadDevice.h"
@@ -96,4 +96,4 @@ public:
 	virtual void read(int& length, bool& eos, sample_t* buffer);
 };
 
-#endif //AUD_SEQUENCERREADER
+#endif //__AUD_SEQUENCERREADER_H__
diff --git a/intern/audaspace/intern/AUD_SilenceFactory.h b/intern/audaspace/intern/AUD_SilenceFactory.h
index d1b0f9d..3bc7fc0 100644
--- a/intern/audaspace/intern/AUD_SilenceFactory.h
+++ b/intern/audaspace/intern/AUD_SilenceFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_SILENCEFACTORY
-#define AUD_SILENCEFACTORY
+#ifndef __AUD_SILENCEFACTORY_H__
+#define __AUD_SILENCEFACTORY_H__
 
 #include "AUD_IFactory.h"
 
@@ -51,4 +51,4 @@ public:
 	virtual AUD_Reference<AUD_IReader> createReader();
 };
 
-#endif //AUD_SILENCEFACTORY
+#endif //__AUD_SILENCEFACTORY_H__
diff --git a/intern/audaspace/intern/AUD_SilenceReader.h b/intern/audaspace/intern/AUD_SilenceReader.h
index de4f9df..cac56a0 100644
--- a/intern/audaspace/intern/AUD_SilenceReader.h
+++ b/intern/audaspace/intern/AUD_SilenceReader.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_SILENCEREADER
-#define AUD_SILENCEREADER
+#ifndef __AUD_SILENCEREADER_H__
+#define __AUD_SILENCEREADER_H__
 
 #include "AUD_IReader.h"
 #include "AUD_Buffer.h"
@@ -63,4 +63,4 @@ public:
 	virtual void read(int& length, bool& eos, sample_t* buffer);
 };
 
-#endif //AUD_SILENCEREADER
+#endif //__AUD_SILENCEREADER_H__
diff --git a/intern/audaspace/intern/AUD_SinusFactory.h b/intern/audaspace/intern/AUD_SinusFactory.h
index f73cdd2..d83323c 100644
--- a/intern/audaspace/intern/AUD_SinusFactory.h
+++ b/intern/audaspace/intern/AUD_SinusFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_SINUSFACTORY
-#define AUD_SINUSFACTORY
+#ifndef __AUD_SINUSFACTORY_H__
+#define __AUD_SINUSFACTORY_H__
 
 #include "AUD_IFactory.h"
 
@@ -69,4 +69,4 @@ public:
 	virtual AUD_Reference<AUD_IReader> createReader();
 };
 
-#endif //AUD_SINUSFACTORY
+#endif //__AUD_SINUSFACTORY_H__
diff --git a/intern/audaspace/intern/AUD_SinusReader.h b/intern/audaspace/intern/AUD_SinusReader.h
index ce79470..50487ea 100644
--- a/intern/audaspace/intern/AUD_SinusReader.h
+++ b/intern/audaspace/intern/AUD_SinusReader.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_SINUSREADER
-#define AUD_SINUSREADER
+#ifndef __AUD_SINUSREADER_H__
+#define __AUD_SINUSREADER_H__
 
 #include "AUD_IReader.h"
 #include "AUD_Buffer.h"
@@ -75,4 +75,4 @@ public:
 	virtual void read(int& length, bool& eos, sample_t* buffer);
 };
 
-#endif //AUD_SINUSREADER
+#endif //__AUD_SINUSREADER_H__
diff --git a/intern/audaspace/intern/AUD_SoftwareDevice.h b/intern/audaspace/intern/AUD_SoftwareDevice.h
index 010f579..c429508 100644
--- a/intern/audaspace/intern/AUD_SoftwareDevice.h
+++ b/intern/audaspace/intern/AUD_SoftwareDevice.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_SOFTWAREDEVICE
-#define AUD_SOFTWAREDEVICE
+#ifndef __AUD_SOFTWAREDEVICE_H__
+#define __AUD_SOFTWAREDEVICE_H__
 
 #include "AUD_IDevice.h"
 #include "AUD_IHandle.h"
@@ -342,4 +342,4 @@ public:
 	virtual void setDistanceModel(AUD_DistanceModel model);
 };
 
-#endif //AUD_SOFTWAREDEVICE
+#endif //__AUD_SOFTWAREDEVICE_H__
diff --git a/intern/audaspace/intern/AUD_Space.h b/intern/audaspace/intern/AUD_Space.h
index c018d6e..f42cb1a 100644
--- a/intern/audaspace/intern/AUD_Space.h
+++ b/intern/audaspace/intern/AUD_Space.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_SPACE
-#define AUD_SPACE
+#ifndef __AUD_SPACE_H__
+#define __AUD_SPACE_H__
 
 /// The size of a format in bytes.
 #define AUD_FORMAT_SIZE(format) (format & 0x0F)
@@ -253,4 +253,4 @@ typedef struct
 	// void* userData; - for the case it is needed someday
 } AUD_Exception;
 
-#endif //AUD_SPACE
+#endif //__AUD_SPACE_H__
diff --git a/intern/audaspace/intern/AUD_StreamBufferFactory.h b/intern/audaspace/intern/AUD_StreamBufferFactory.h
index f1f1c0f..99795d9 100644
--- a/intern/audaspace/intern/AUD_StreamBufferFactory.h
+++ b/intern/audaspace/intern/AUD_StreamBufferFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_STREAMBUFFERFACTORY
-#define AUD_STREAMBUFFERFACTORY
+#ifndef __AUD_STREAMBUFFERFACTORY_H__
+#define __AUD_STREAMBUFFERFACTORY_H__
 
 #include "AUD_IFactory.h"
 #include "AUD_Reference.h"
@@ -67,4 +67,4 @@ public:
 	virtual AUD_Reference<AUD_IReader> createReader();
 };
 
-#endif //AUD_STREAMBUFFERFACTORY
+#endif //__AUD_STREAMBUFFERFACTORY_H__
diff --git a/intern/audaspace/jack/AUD_JackDevice.h b/intern/audaspace/jack/AUD_JackDevice.h
index 6373d4f..dc90c52 100644
--- a/intern/audaspace/jack/AUD_JackDevice.h
+++ b/intern/audaspace/jack/AUD_JackDevice.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_JACKDEVICE
-#define AUD_JACKDEVICE
+#ifndef __AUD_JACKDEVICE_H__
+#define __AUD_JACKDEVICE_H__
 
 
 #include "AUD_SoftwareDevice.h"
@@ -205,4 +205,4 @@ public:
 	bool doesPlayback();
 };
 
-#endif //AUD_JACKDEVICE
+#endif //__AUD_JACKDEVICE_H__
diff --git a/intern/audaspace/sndfile/AUD_SndFileFactory.h b/intern/audaspace/sndfile/AUD_SndFileFactory.h
index bd02a59..7039c7a 100644
--- a/intern/audaspace/sndfile/AUD_SndFileFactory.h
+++ b/intern/audaspace/sndfile/AUD_SndFileFactory.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_SNDFILEFACTORY
-#define AUD_SNDFILEFACTORY
+#ifndef __AUD_SNDFILEFACTORY_H__
+#define __AUD_SNDFILEFACTORY_H__
 
 #include "AUD_IFactory.h"
 #include "AUD_Reference.h"
@@ -73,4 +73,4 @@ public:
 	virtual AUD_Reference<AUD_IReader> createReader();
 };
 
-#endif //AUD_SNDFILEFACTORY
+#endif //__AUD_SNDFILEFACTORY_H__
diff --git a/intern/audaspace/sndfile/AUD_SndFileReader.h b/intern/audaspace/sndfile/AUD_SndFileReader.h
index b4552a7..81d8b45 100644
--- a/intern/audaspace/sndfile/AUD_SndFileReader.h
+++ b/intern/audaspace/sndfile/AUD_SndFileReader.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_SNDFILEREADER
-#define AUD_SNDFILEREADER
+#ifndef __AUD_SNDFILEREADER_H__
+#define __AUD_SNDFILEREADER_H__
 
 #include "AUD_IReader.h"
 #include "AUD_Reference.h"
@@ -125,4 +125,4 @@ public:
 	virtual void read(int& length, bool& eos, sample_t* buffer);
 };
 
-#endif //AUD_SNDFILEREADER
+#endif //__AUD_SNDFILEREADER_H__
diff --git a/intern/audaspace/sndfile/AUD_SndFileWriter.h b/intern/audaspace/sndfile/AUD_SndFileWriter.h
index 9e29fd1..0cadbd1 100644
--- a/intern/audaspace/sndfile/AUD_SndFileWriter.h
+++ b/intern/audaspace/sndfile/AUD_SndFileWriter.h
@@ -27,8 +27,8 @@
  */
 
 
-#ifndef AUD_SNDFILEWRITER
-#define AUD_SNDFILEWRITER
+#ifndef __AUD_SNDFILEWRITER_H__
+#define __AUD_SNDFILEWRITER_H__
 
 #include "AUD_IWriter.h"
 
@@ -83,4 +83,4 @@ public:
 	virtual void write(unsigned int length, sample_t* buffer);
 };
 
-#endif //AUD_SNDFILEWRITER
+#endif //__AUD_SNDFILEWRITER_H__
diff --git a/intern/boolop/SConscript b/intern/boolop/SConscript
index 1c8c912..f630d1d 100644
--- a/intern/boolop/SConscript
+++ b/intern/boolop/SConscript
@@ -18,13 +18,13 @@ else:
     if env['WITH_BF_BOOST']:
         if env['OURPLATFORM'] not in ('win32-vc', 'win64-vc'):
             # Boost is setting as preferred collections library in the Carve code when using MSVC compiler
-            if env['OURPLATFORM'] != 'win32-mingw':
+            if env['OURPLATFORM'] not in ('win32-mingw', 'win64-mingw'):
                 defs.append('HAVE_BOOST_UNORDERED_COLLECTIONS')
 
         defs.append('CARVE_SYSTEM_BOOST')
         incs +=  ' ' + env['BF_BOOST_INC']
 
-if (env['OURPLATFORM'] == 'win32-mingw'):
+if (env['OURPLATFORM'] in ('win32-mingw', 'win64-mingw')):
     env.BlenderLib ('bf_intern_bop', sources, Split(incs) , [], libtype='intern', priority = 5 )
 else:
     env.BlenderLib ('bf_intern_bop', sources, Split(incs) , defs, libtype='intern', priority = 5 )
diff --git a/intern/boolop/extern/BOP_Interface.h b/intern/boolop/extern/BOP_Interface.h
index eee0a24..fbada7d 100644
--- a/intern/boolop/extern/BOP_Interface.h
+++ b/intern/boolop/extern/BOP_Interface.h
@@ -29,8 +29,8 @@
  *  \ingroup boolop
  */
 
-#ifndef BOP_INTERFACE_H
-#define BOP_INTERFACE_H
+#ifndef __BOP_INTERFACE_H__
+#define __BOP_INTERFACE_H__
 
 #include "../../bsp/intern/BSP_CSGMesh.h"
 
diff --git a/intern/boolop/intern/BOP_BBox.h b/intern/boolop/intern/BOP_BBox.h
index 266ffd9..c58bb70 100644
--- a/intern/boolop/intern/BOP_BBox.h
+++ b/intern/boolop/intern/BOP_BBox.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef BOP_BBOX_H
-#define BOP_BBOX_H
+#ifndef __BOP_BBOX_H__
+#define __BOP_BBOX_H__
 
 #include "MT_Point3.h"
 #include "BOP_MathUtils.h"
diff --git a/intern/boolop/intern/BOP_BSPNode.cpp b/intern/boolop/intern/BOP_BSPNode.cpp
index 7d9071b..3588e80 100644
--- a/intern/boolop/intern/BOP_BSPNode.cpp
+++ b/intern/boolop/intern/BOP_BSPNode.cpp
@@ -89,10 +89,10 @@ unsigned int BOP_BSPNode::addFace(const BOP_BSPPoints& pts,
 		else {
 			m_outChild = new BOP_BSPNode(plane);
 			newDeep = 2;
-		}      
+		}
 	} else { // face lies in both half-spaces: split it
 		BOP_BSPPoints inside, outside;
-  		MT_Point3 lpoint= pts[pts.size()-1];
+		MT_Point3 lpoint= pts[pts.size()-1];
 		BOP_TAG ltag = testPoint(lpoint);
 		BOP_TAG tstate = ltag;
 
diff --git a/intern/boolop/intern/BOP_BSPNode.h b/intern/boolop/intern/BOP_BSPNode.h
index 9f92440..e8646cd 100644
--- a/intern/boolop/intern/BOP_BSPNode.h
+++ b/intern/boolop/intern/BOP_BSPNode.h
@@ -30,8 +30,8 @@
  */
 
  
-#ifndef BOP_BSPNODE_H
-#define BOP_BSPNODE_H
+#ifndef __BOP_BSPNODE_H__
+#define __BOP_BSPNODE_H__
 
 #include "MT_Plane3.h"
 #include "BOP_Tag.h"
diff --git a/intern/boolop/intern/BOP_BSPTree.h b/intern/boolop/intern/BOP_BSPTree.h
index 41570de..b3abd55 100644
--- a/intern/boolop/intern/BOP_BSPTree.h
+++ b/intern/boolop/intern/BOP_BSPTree.h
@@ -30,8 +30,8 @@
  */
 
  
-#ifndef BOP_BSPTREE_H
-#define BOP_BSPTREE_H
+#ifndef __BOP_BSPTREE_H__
+#define __BOP_BSPTREE_H__
 
 #include "BOP_BSPNode.h"
 #include "BOP_Mesh.h"
diff --git a/intern/boolop/intern/BOP_CarveInterface.cpp b/intern/boolop/intern/BOP_CarveInterface.cpp
index 6fc08e5..ff7244e 100644
--- a/intern/boolop/intern/BOP_CarveInterface.cpp
+++ b/intern/boolop/intern/BOP_CarveInterface.cpp
@@ -430,6 +430,14 @@ static MeshSet<3> *Carve_addMesh(CSG_FaceIteratorDescriptor &face_it,
 	return poly;
 }
 
+static double triangleArea(carve::geom3d::Vector &v1, carve::geom3d::Vector &v2, carve::geom3d::Vector &v3)
+{
+	carve::geom3d::Vector a = v2 - v1;
+	carve::geom3d::Vector b = v3 - v1;
+
+	return carve::geom::cross(a, b).length();
+}
+
 static bool checkValidQuad(std::vector<MeshSet<3>::vertex_t> &vertex_storage, uint quad[4])
 {
 	carve::geom3d::Vector &v1 = vertex_storage[quad[0]].v;
@@ -465,12 +473,12 @@ static bool checkValidQuad(std::vector<MeshSet<3>::vertex_t> &vertex_storage, ui
 
 		carve::geom3d::Vector current_normal = carve::geom::cross(edges[i], edges[n]);
 
-		if (current_normal.length() > 1e-6) {
+		if (current_normal.length() > DBL_EPSILON) {
 			if (!normal_set) {
 				normal = current_normal;
 				normal_set = true;
 			}
-			else if (carve::geom::dot(normal, current_normal) < -1e-6) {
+			else if (carve::geom::dot(normal, current_normal) < 0) {
 				return false;
 			}
 		}
@@ -481,6 +489,10 @@ static bool checkValidQuad(std::vector<MeshSet<3>::vertex_t> &vertex_storage, ui
 		return false;
 	}
 
+	double area = triangleArea(v1, v2, v3) + triangleArea(v1, v3, v4);
+	if (area <= DBL_EPSILON)
+		return false;
+
 	return true;
 }
 
@@ -535,6 +547,20 @@ static uint quadMerge(std::map<MeshSet<3>::vertex_t*, uint> *vertexToIndex_map,
 	return 0;
 }
 
+static bool Carve_checkDegeneratedFace(MeshSet<3>::face_t *face)
+{
+	/* only tris and quads for now */
+	if (face->n_edges == 3) {
+		return triangleArea(face->edge->prev->vert->v, face->edge->vert->v, face->edge->next->vert->v) < DBL_EPSILON;
+	}
+	else if (face->n_edges == 4) {
+		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;
+}
+
 static BSP_CSGMesh *Carve_exportMesh(MeshSet<3>* &poly, carve::interpolate::FaceAttr<uint> &oface_num,
                                      uint num_origfaces)
 {
@@ -591,13 +617,6 @@ static BSP_CSGMesh *Carve_exportMesh(MeshSet<3>* &poly, carve::interpolate::Face
 
 			MeshSet<3>::face_t *f = *(poly->faceBegin() + findex);
 
-			// add all information except vertices to the output mesh
-			outputMesh->FaceSet().push_back(BSP_MFace());
-			BSP_MFace& outFace = outputMesh->FaceSet().back();
-			outFace.m_verts.clear();
-			outFace.m_plane.setValue(f->plane.N.v);
-			outFace.m_orig_face = orig;
-
 			// for each vertex of this face, check other faces containing
 			// that vertex to see if there is a neighbor also belonging to
 			// the original face
@@ -640,20 +659,36 @@ static BSP_CSGMesh *Carve_exportMesh(MeshSet<3>* &poly, carve::interpolate::Face
 				}
 			}
 
-			// if we merged faces, use the list of common vertices; otherwise
-			// use the faces's vertices
-			if (result) {
-				// make quat using verts stored in result
-				outFace.m_verts.push_back(quadverts[0]);
-				outFace.m_verts.push_back(quadverts[1]);
-				outFace.m_verts.push_back(quadverts[2]);
-				outFace.m_verts.push_back(quadverts[3]);
-			} else {
-				MeshSet<3>::face_t::edge_iter_t edge_iter = f->begin();
-				for (; edge_iter != f->end(); ++edge_iter) {
-					//int index = ofacevert_num.getAttribute(f, edge_iter.idx());
-					int index = vertexToIndex_map[edge_iter->vert];
-					outFace.m_verts.push_back( index );
+			bool degenerativeFace = false;
+
+			if (!result) {
+				/* merged triangles are already checked for degenerative quad */
+				degenerativeFace = Carve_checkDegeneratedFace(f);
+			}
+
+			if (!degenerativeFace) {
+				// add all information except vertices to the output mesh
+				outputMesh->FaceSet().push_back(BSP_MFace());
+				BSP_MFace& outFace = outputMesh->FaceSet().back();
+				outFace.m_verts.clear();
+				outFace.m_plane.setValue(f->plane.N.v);
+				outFace.m_orig_face = orig;
+
+				// if we merged faces, use the list of common vertices; otherwise
+				// use the faces's vertices
+				if (result) {
+					// make quat using verts stored in result
+					outFace.m_verts.push_back(quadverts[0]);
+					outFace.m_verts.push_back(quadverts[1]);
+					outFace.m_verts.push_back(quadverts[2]);
+					outFace.m_verts.push_back(quadverts[3]);
+				} else {
+					MeshSet<3>::face_t::edge_iter_t edge_iter = f->begin();
+					for (; edge_iter != f->end(); ++edge_iter) {
+						//int index = ofacevert_num.getAttribute(f, edge_iter.idx());
+						int index = vertexToIndex_map[edge_iter->vert];
+						outFace.m_verts.push_back( index );
+					}
 				}
 			}
 		}
@@ -736,7 +771,7 @@ BoolOpState BOP_performBooleanOperation(BoolOpType                    opType,
 
 	// prepare operands for actual boolean operation. it's needed because operands might consist of
 	// several intersecting meshes and in case if another operands intersect an edge loop of intersecting that
-	// meshes tesselation of operation result can't be done properly. the only way to make such situations
+	// meshes tessellation of operation result can't be done properly. the only way to make such situations
 	// working is to union intersecting meshes of the same operand
 	Carve_unionIntersections(&left, &right, oface_num);
 
diff --git a/intern/boolop/intern/BOP_Chrono.h b/intern/boolop/intern/BOP_Chrono.h
index 1adbfa3..8f09eea 100644
--- a/intern/boolop/intern/BOP_Chrono.h
+++ b/intern/boolop/intern/BOP_Chrono.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef BOP_CHRONO_H
-#define BOP_CHRONO_H
+#ifndef __BOP_CHRONO_H__
+#define __BOP_CHRONO_H__
 
 #include <time.h>
 
diff --git a/intern/boolop/intern/BOP_Edge.h b/intern/boolop/intern/BOP_Edge.h
index 867ad5d..fd2f53b 100644
--- a/intern/boolop/intern/BOP_Edge.h
+++ b/intern/boolop/intern/BOP_Edge.h
@@ -30,8 +30,8 @@
  */
 
  
-#ifndef BOP_EDGE_H
-#define BOP_EDGE_H
+#ifndef __BOP_EDGE_H__
+#define __BOP_EDGE_H__
 
 #include "BOP_Indexs.h"
 #include "BOP_Misc.h"
diff --git a/intern/boolop/intern/BOP_Face.h b/intern/boolop/intern/BOP_Face.h
index 6f79b8b..4f09618 100644
--- a/intern/boolop/intern/BOP_Face.h
+++ b/intern/boolop/intern/BOP_Face.h
@@ -30,8 +30,8 @@
  */
 
  
-#ifndef BOP_FACE_H
-#define BOP_FACE_H
+#ifndef __BOP_FACE_H__
+#define __BOP_FACE_H__
 
 #include "BOP_Tag.h"
 #include "MT_Plane3.h"
diff --git a/intern/boolop/intern/BOP_Face2Face.cpp b/intern/boolop/intern/BOP_Face2Face.cpp
index de9fa7b..f88a271 100644
--- a/intern/boolop/intern/BOP_Face2Face.cpp
+++ b/intern/boolop/intern/BOP_Face2Face.cpp
@@ -538,10 +538,10 @@ void BOP_mergeSort(MT_Point3 *points, unsigned int *face, unsigned int &size, bo
 			for(i=0;i<size;i++) {
 				if (position[i] == 1) {
 					invertA = true;
-          				break;
-        			}
-        			else if (position[i] == 0) break;
-      			}
+					break;
+				}
+				else if (position[i] == 0) break;
+			}
 
 			// invertBø?
 			if (size == 4) {
@@ -597,7 +597,7 @@ void BOP_mergeSort(MT_Point3 *points, unsigned int *face, unsigned int &size, bo
 						sortedFaces[i] = sortedFaces[i+1];
 					}
 					size--;
-				}        
+				}
 			}
 			else {
 				// merge 0 and 1
@@ -616,7 +616,7 @@ void BOP_mergeSort(MT_Point3 *points, unsigned int *face, unsigned int &size, bo
 						size--;
 					}
 				}
-			}     
+			}
 		}
 		else {
 			if (BOP_fuzzyZero(d2) && sortedFaces[1] != sortedFaces[2])  {
@@ -637,14 +637,14 @@ void BOP_mergeSort(MT_Point3 *points, unsigned int *face, unsigned int &size, bo
 				}
 			}
 		}
-    
+
 		// Merge initial points ...
 		for(i=0;i<size;i++) {
 			points[i] = sortedPoints[i];
 			face[i] = sortedFaces[i];
 		}
 
-  	}
+	}
 }
 
 
@@ -1058,17 +1058,17 @@ void triangulate(BOP_Mesh *mesh, BOP_Faces *faces, BOP_Face *face, BOP_Segment s
 		else {
 			//  EDGE(v1) + EDGE(v2)
 			if (BOP_Segment::getEdge(s.m_cfg1) == BOP_Segment::getEdge(s.m_cfg2)) {
-				 // EDGE(v1) == EDGE(v2)
+				// EDGE(v1) == EDGE(v2)
 				BOP_Edge *edge = mesh->getEdge(face,BOP_Segment::getEdge(s.m_cfg1));
-				BOP_triangulateD(mesh, faces, face, s.m_v1, s.m_v2, 
-								 BOP_Segment::getEdge(s.m_cfg1)); 
+				BOP_triangulateD(mesh, faces, face, s.m_v1, s.m_v2,
+				                 BOP_Segment::getEdge(s.m_cfg1));
 				BOP_Face *opposite = BOP_getOppositeFace(mesh,faces,face,edge);
 				if (opposite != NULL) {
-				  unsigned int e;
-				  opposite->getEdgeIndex(edge->getVertex1(), edge->getVertex2(),e);
-				  BOP_triangulateD(mesh, faces, opposite, s.m_v1, s.m_v2, e);
+					unsigned int e;
+					opposite->getEdgeIndex(edge->getVertex1(), edge->getVertex2(),e);
+					BOP_triangulateD(mesh, faces, opposite, s.m_v1, s.m_v2, e);
 				}
-    		}
+			}
 			else { // EDGE(v1) != EDGE(v2)
 				BOP_Edge *edge1 = mesh->getEdge(face,BOP_Segment::getEdge(s.m_cfg1));
 				BOP_Edge *edge2 = mesh->getEdge(face,BOP_Segment::getEdge(s.m_cfg2));
diff --git a/intern/boolop/intern/BOP_Face2Face.h b/intern/boolop/intern/BOP_Face2Face.h
index c440429..9809084 100644
--- a/intern/boolop/intern/BOP_Face2Face.h
+++ b/intern/boolop/intern/BOP_Face2Face.h
@@ -30,8 +30,8 @@
  */
 
  
-#ifndef BOP_FACE2FACE_H
-#define BOP_FACE2FACE_H
+#ifndef __BOP_FACE2FACE_H__
+#define __BOP_FACE2FACE_H__
 
 #include "BOP_Mesh.h"
 #include "BOP_Segment.h"
diff --git a/intern/boolop/intern/BOP_Indexs.h b/intern/boolop/intern/BOP_Indexs.h
index 4e71c66..e001f41 100644
--- a/intern/boolop/intern/BOP_Indexs.h
+++ b/intern/boolop/intern/BOP_Indexs.h
@@ -30,8 +30,8 @@
  */
 
  
-#ifndef BOP_Indexs_H
-#define BOP_Indexs_H
+#ifndef __BOP_INDEXS_H__
+#define __BOP_INDEXS_H__
 
 #include <vector>
 
diff --git a/intern/boolop/intern/BOP_MathUtils.cpp b/intern/boolop/intern/BOP_MathUtils.cpp
index bcc0cca..020de21 100644
--- a/intern/boolop/intern/BOP_MathUtils.cpp
+++ b/intern/boolop/intern/BOP_MathUtils.cpp
@@ -233,17 +233,17 @@ bool BOP_intersect(const MT_Vector3& vL1, const MT_Point3& pL1, const MT_Vector3
 	MT_Scalar den = (vL1.y()*vL2.x() - vL1.x() * vL2.y());
 	
 	if (!BOP_fuzzyZero(den)) {
-		t =  (pL2.y()*vL1.x() - vL1.y()*pL2.x() + pL1.x()*vL1.y() - pL1.y()*vL1.x()) / den ;
+		t =  (pL2.y()*vL1.x() - vL1.y()*pL2.x() + pL1.x()*vL1.y() - pL1.y()*vL1.x()) / den;
 	}
 	else {
 		den = (vL1.y()*vL2.z() - vL1.z() * vL2.y());
 		if (!BOP_fuzzyZero(den)) {
-			t =  (pL2.y()*vL1.z() - vL1.y()*pL2.z() + pL1.z()*vL1.y() - pL1.y()*vL1.z()) / den ;
+			t =  (pL2.y()*vL1.z() - vL1.y()*pL2.z() + pL1.z()*vL1.y() - pL1.y()*vL1.z()) / den;
 		}
 		else {
 			den = (vL1.x()*vL2.z() - vL1.z() * vL2.x());
 			if (!BOP_fuzzyZero(den)) {
-				t =  (pL2.x()*vL1.z() - vL1.x()*pL2.z() + pL1.z()*vL1.x() - pL1.x()*vL1.z()) / den ;
+				t =  (pL2.x()*vL1.z() - vL1.x()*pL2.z() + pL1.z()*vL1.x() - pL1.x()*vL1.z()) / den;
 			}
 			else {
 				return false;
diff --git a/intern/boolop/intern/BOP_MathUtils.h b/intern/boolop/intern/BOP_MathUtils.h
index 27e5e10..38acd98 100644
--- a/intern/boolop/intern/BOP_MathUtils.h
+++ b/intern/boolop/intern/BOP_MathUtils.h
@@ -32,8 +32,8 @@
  */
 
  
-#ifndef BOP_MATHUTILS_H
-#define BOP_MATHUTILS_H
+#ifndef __BOP_MATHUTILS_H__
+#define __BOP_MATHUTILS_H__
 
 #include <math.h>
 #include <float.h>
diff --git a/intern/boolop/intern/BOP_Merge.h b/intern/boolop/intern/BOP_Merge.h
index 5a24579..9d6d703 100644
--- a/intern/boolop/intern/BOP_Merge.h
+++ b/intern/boolop/intern/BOP_Merge.h
@@ -30,8 +30,8 @@
  */
 
  
-#ifndef BOP_MERGE_H
-#define BOP_MERGE_H
+#ifndef __BOP_MERGE_H__
+#define __BOP_MERGE_H__
 
 #include "BOP_Misc.h"
 
diff --git a/intern/boolop/intern/BOP_Merge2.cpp b/intern/boolop/intern/BOP_Merge2.cpp
index 9028743..6bec9ba 100644
--- a/intern/boolop/intern/BOP_Merge2.cpp
+++ b/intern/boolop/intern/BOP_Merge2.cpp
@@ -289,7 +289,7 @@ void BOP_Merge2::cleanup( void )
 		BOP_Indexs faces = (*edge)->getFaces();
 		for (BOP_IT_Indexs face = faces.begin(); face != faces.end(); ++face) {
 			BOP_Face *f = m_mesh->getFace(*face);
-			if(f->getTAG()== UNCLASSIFIED) ;
+			if (f->getTAG()== UNCLASSIFIED);
 			else (*edge)->removeFace(*face);
 		}
 		if( (*edge)->getFaces().size() == 0) (*edge)->setUsed(false);
diff --git a/intern/boolop/intern/BOP_Merge2.h b/intern/boolop/intern/BOP_Merge2.h
index 78a4caf..71ec070 100644
--- a/intern/boolop/intern/BOP_Merge2.h
+++ b/intern/boolop/intern/BOP_Merge2.h
@@ -30,8 +30,8 @@
  */
 
  
-#ifndef BOP_MERGE2_H
-#define BOP_MERGE2_H
+#ifndef __BOP_MERGE2_H__
+#define __BOP_MERGE2_H__
 
 #include "BOP_Misc.h"
 
@@ -78,7 +78,7 @@ class BOP_Merge2 {
 				BOP_Index X, BOP_Index I, BOP_Index P, BOP_Index N );
 		BOP_Face *find4Neighbor(BOP_Face *faceI, BOP_Face *faceJ,
 				BOP_Index X, BOP_Index I, BOP_Index P, BOP_Index N,
-    			BOP_Face **faceL, BOP_Index &O);
+				BOP_Face **faceL, BOP_Index &O);
 		BOP_Face3 *collapse(BOP_Face4 *faceC, BOP_Index X);
 		void mergeFaces(BOP_Face *A, BOP_Face *B, BOP_Index X,
 			BOP_Index I, BOP_Index N, BOP_Index P, BOP_Faces &newFaces );
diff --git a/intern/boolop/intern/BOP_Mesh.cpp b/intern/boolop/intern/BOP_Mesh.cpp
index e35b543..673caa3 100644
--- a/intern/boolop/intern/BOP_Mesh.cpp
+++ b/intern/boolop/intern/BOP_Mesh.cpp
@@ -252,8 +252,8 @@ BOP_Index BOP_Mesh::addFace(BOP_Face3 *face)
 	BOP_Index index2 = face->getVertex(1);
 	BOP_Index index3 = face->getVertex(2);
 
-	m_faces.push_back((BOP_Face *)face);  
-		
+	m_faces.push_back((BOP_Face *)face);
+
 	BOP_Index edge;
 
 	if (!getIndexEdge(index1,index2,edge)) {
@@ -261,7 +261,7 @@ BOP_Index BOP_Mesh::addFace(BOP_Face3 *face)
 		getVertex(index1)->addEdge(edge);
 		getVertex(index2)->addEdge(edge);
 	}
-    		
+
 	getEdge(edge)->addFace(indexface);
 	
 	if (!getIndexEdge(index2,index3,edge)) {
@@ -269,7 +269,7 @@ BOP_Index BOP_Mesh::addFace(BOP_Face3 *face)
 		getVertex(index2)->addEdge(edge);
 		getVertex(index3)->addEdge(edge);
 	}
-    
+
 	getEdge(edge)->addFace(indexface);
 
 	if (!getIndexEdge(index3,index1,edge)) {
@@ -277,13 +277,13 @@ BOP_Index BOP_Mesh::addFace(BOP_Face3 *face)
 		getVertex(index3)->addEdge(edge);
 		getVertex(index1)->addEdge(edge);
 	}
-    
+
 	getEdge(edge)->addFace(indexface);
 	
 	if ((index1 == index2) || (index1 == index3) || (index2 == index3))
 		face->setTAG(BROKEN);
 
-	return indexface;  
+	return indexface;
 }
 
 /**
@@ -452,7 +452,7 @@ bool BOP_Mesh::getIndexEdge(BOP_Index v1, BOP_Index v2, BOP_Index &e)
 #ifdef HASH_PRINTF_DEBUG
 			printf ("found edge (%d %d)\n",v1,v2);
 #endif
-		  	e = edge->index;
+			e = edge->index;
 #ifdef BOP_NEW_MERGE
 			if( m_edges[e]->getUsed() == false ) {
 				m_edges[e]->setUsed(true);
diff --git a/intern/boolop/intern/BOP_Mesh.h b/intern/boolop/intern/BOP_Mesh.h
index 271e97f..9c1b4ad 100644
--- a/intern/boolop/intern/BOP_Mesh.h
+++ b/intern/boolop/intern/BOP_Mesh.h
@@ -32,8 +32,8 @@
  */
 
  
-#ifndef BOP_MESH_H
-#define BOP_MESH_H
+#ifndef __BOP_MESH_H__
+#define __BOP_MESH_H__
 
 #include "BOP_Vertex.h"
 #include "BOP_Edge.h"
@@ -100,7 +100,7 @@ public:
 	BOP_Index replaceVertexIndex(BOP_Index oldIndex, BOP_Index newIndex);
 #ifdef HASH
 	void rehashVertex(BOP_Index oldIndex, BOP_Index newIndex,
-		   	BOP_Index otherIndex);
+			BOP_Index otherIndex);
 #endif
 	bool isClosedMesh();
 
diff --git a/intern/boolop/intern/BOP_Segment.h b/intern/boolop/intern/BOP_Segment.h
index 4a2b450..5a49ae8 100644
--- a/intern/boolop/intern/BOP_Segment.h
+++ b/intern/boolop/intern/BOP_Segment.h
@@ -30,8 +30,8 @@
  */
 
  
-#ifndef BOP_SEGMENT_H
-#define BOP_SEGMENT_H
+#ifndef __BOP_SEGMENT_H__
+#define __BOP_SEGMENT_H__
 
 #include "BOP_Indexs.h"
 #include <iostream>
diff --git a/intern/boolop/intern/BOP_Splitter.h b/intern/boolop/intern/BOP_Splitter.h
index a14f465..8d79b89 100644
--- a/intern/boolop/intern/BOP_Splitter.h
+++ b/intern/boolop/intern/BOP_Splitter.h
@@ -30,8 +30,8 @@
  */
 
  
-#ifndef BOP_SPLITTER_H
-#define BOP_SPLITTER_H
+#ifndef __BOP_SPLITTER_H__
+#define __BOP_SPLITTER_H__
 
 #include "BOP_MathUtils.h"
 #include "BOP_Segment.h"
diff --git a/intern/boolop/intern/BOP_Tag.h b/intern/boolop/intern/BOP_Tag.h
index 79d1370..b743827 100644
--- a/intern/boolop/intern/BOP_Tag.h
+++ b/intern/boolop/intern/BOP_Tag.h
@@ -33,8 +33,8 @@
 #include <string.h>
 #include <stdio.h>
 
-#ifndef BOP_TAG_H
-#define BOP_TAG_H
+#ifndef __BOP_TAG_H__
+#define __BOP_TAG_H__
 
 #define IN_TAG           0x02  // Below the plane
 #define ON_TAG           0x00  // On the plane
diff --git a/intern/boolop/intern/BOP_Triangulator.cpp b/intern/boolop/intern/BOP_Triangulator.cpp
index ca1e3ad..65f7dae 100644
--- a/intern/boolop/intern/BOP_Triangulator.cpp
+++ b/intern/boolop/intern/BOP_Triangulator.cpp
@@ -173,7 +173,7 @@ void BOP_triangulateC(BOP_Mesh* mesh, BOP_Faces* faces, BOP_Face* face, BOP_Inde
 
 /**
  * Triangulates the face (v1,v2,v3) in five new faces by two inner points (v4,v5), where
- * v1 v4 v5 defines the nice triangle and v4 v5 v2 v3 defines the quad to be tesselated.
+ * v1 v4 v5 defines the nice triangle and v4 v5 v2 v3 defines the quad to be tessellated.
  * @param mesh mesh that contains the faces, edges and vertices
  * @param faces set of faces that contains face and will contains new faces
  * @param face input face to be triangulate
diff --git a/intern/boolop/intern/BOP_Triangulator.h b/intern/boolop/intern/BOP_Triangulator.h
index 9fb314f..55dd51d 100644
--- a/intern/boolop/intern/BOP_Triangulator.h
+++ b/intern/boolop/intern/BOP_Triangulator.h
@@ -30,8 +30,8 @@
  */
 
  
-#ifndef BOP_TRIANGULATOR_H
-#define BOP_TRIANGULATOR_H
+#ifndef __BOP_TRIANGULATOR_H__
+#define __BOP_TRIANGULATOR_H__
 
 #include "BOP_MathUtils.h"
 #include "BOP_Mesh.h"
diff --git a/intern/boolop/intern/BOP_Vertex.h b/intern/boolop/intern/BOP_Vertex.h
index 3f1780c..1aae220 100644
--- a/intern/boolop/intern/BOP_Vertex.h
+++ b/intern/boolop/intern/BOP_Vertex.h
@@ -30,8 +30,8 @@
  */
 
  
-#ifndef BOP_VERTEX_H
-#define BOP_VERTEX_H
+#ifndef __BOP_VERTEX_H__
+#define __BOP_VERTEX_H__
 
 #include "BOP_Tag.h"
 #include "BOP_Indexs.h"
diff --git a/intern/bsp/extern/CSG_BooleanOps.h b/intern/bsp/extern/CSG_BooleanOps.h
index eea0dbc..94a74c3 100644
--- a/intern/bsp/extern/CSG_BooleanOps.h
+++ b/intern/bsp/extern/CSG_BooleanOps.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef CSG_BOOLEANOPS_H
-#define CSG_BOOLEANOPS_H
+#ifndef __CSG_BOOLEANOPS_H__
+#define __CSG_BOOLEANOPS_H__
 
 
 /**
diff --git a/intern/bsp/intern/BSP_CSGException.h b/intern/bsp/intern/BSP_CSGException.h
index fc1160d..744359c 100644
--- a/intern/bsp/intern/BSP_CSGException.h
+++ b/intern/bsp/intern/BSP_CSGException.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NAN_INCLUDED_CSGException_h
-#define NAN_INCLUDED_CSGException_h
+#ifndef __BSP_CSGEXCEPTION_H__
+#define __BSP_CSGEXCEPTION_H__
 
 // stick in more error types as you think of them
 
diff --git a/intern/bsp/intern/BSP_CSGMesh.h b/intern/bsp/intern/BSP_CSGMesh.h
index 13a38f2..4754f3b 100644
--- a/intern/bsp/intern/BSP_CSGMesh.h
+++ b/intern/bsp/intern/BSP_CSGMesh.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NAN_INCLUDED_BSP_CSGMesh_h
-#define NAN_INCLUDED_BSP_CSGMesh_h
+#ifndef __BSP_CSGMESH_H__
+#define __BSP_CSGMESH_H__
 
 #include "BSP_MeshPrimitives.h"
 #include "MEM_SmartPtr.h"
@@ -108,11 +108,10 @@ public :
 
 		std::vector<BSP_MVertex> &
 	VertexSet(
-	) const ;		
-
+	) const;
 		std::vector<BSP_MFace> &
 	FaceSet(
-	) const ;
+	) const;
 
 		std::vector<BSP_MEdge> &
 	EdgeSet(
diff --git a/intern/bsp/intern/BSP_CSGMesh_CFIterator.h b/intern/bsp/intern/BSP_CSGMesh_CFIterator.h
index 3a1a9db..cadd3df 100644
--- a/intern/bsp/intern/BSP_CSGMesh_CFIterator.h
+++ b/intern/bsp/intern/BSP_CSGMesh_CFIterator.h
@@ -30,9 +30,9 @@
  */
 
 
-#ifndef BSP_CSGMesh_CFIterator_h
+#ifndef __BSP_CSGMESH_CFITERATOR_H__
 
-#define BSP_CSGMesh_CFIterator_h
+#define __BSP_CSGMESH_CFITERATOR_H__
 
 #include "BSP_CSGMesh.h"
 #include "../extern/CSG_BooleanOps.h"
diff --git a/intern/bsp/intern/BSP_MeshPrimitives.h b/intern/bsp/intern/BSP_MeshPrimitives.h
index 4b795f4..f4d04d8 100644
--- a/intern/bsp/intern/BSP_MeshPrimitives.h
+++ b/intern/bsp/intern/BSP_MeshPrimitives.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NAN_INCLUDED_BSP_MeshPrimitives
-#define NAN_INCLUDED_BSP_MeshPrimitives
+#ifndef __BSP_MESHPRIMITIVES_H__
+#define __BSP_MESHPRIMITIVES_H__
 
 #include "CTR_TaggedIndex.h"
 #include "MT_Vector3.h"
@@ -189,7 +189,7 @@ public :
 		BSP_FaceInd new_f
 	);
 
-    	BSP_VertexInd
+		BSP_VertexInd
 	OpVertex(
 		BSP_VertexInd vi
 	) const;
diff --git a/intern/bsp/test/BSP_GhostTest/BSP_GhostTest3D.h b/intern/bsp/test/BSP_GhostTest/BSP_GhostTest3D.h
index 26db15f..8bfa6d0 100644
--- a/intern/bsp/test/BSP_GhostTest/BSP_GhostTest3D.h
+++ b/intern/bsp/test/BSP_GhostTest/BSP_GhostTest3D.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BSP_GhostTest_h
-#define BSP_GhostTest_h
+#ifndef __BSP_GHOSTTEST3D_H__
+#define __BSP_GHOSTTEST3D_H__
 
 #include "GHOST_IEventConsumer.h"
 #include "MT_Vector3.h"
diff --git a/intern/bsp/test/BSP_GhostTest/BSP_MeshDrawer.h b/intern/bsp/test/BSP_GhostTest/BSP_MeshDrawer.h
index 443c41a..17aeccc 100644
--- a/intern/bsp/test/BSP_GhostTest/BSP_MeshDrawer.h
+++ b/intern/bsp/test/BSP_GhostTest/BSP_MeshDrawer.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BSP_MeshDrawer_h
-#define BSP_MeshDrawer_h
+#ifndef __BSP_MESHDRAWER_H__
+#define __BSP_MESHDRAWER_H__
 
 class BSP_TMesh;
 class MT_Vector3;
diff --git a/intern/bsp/test/BSP_GhostTest/BSP_PlyLoader.h b/intern/bsp/test/BSP_GhostTest/BSP_PlyLoader.h
index 73803eb..8fcac29 100644
--- a/intern/bsp/test/BSP_GhostTest/BSP_PlyLoader.h
+++ b/intern/bsp/test/BSP_GhostTest/BSP_PlyLoader.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BSP_PlyLoader_h
-#define BSP_PlyLoader_h
+#ifndef __BSP_PLYLOADER_H__
+#define __BSP_PLYLOADER_H__
 
 #include "MEM_SmartPtr.h"
 #include "BSP_TMesh.h"
diff --git a/intern/bsp/test/BSP_GhostTest/BSP_TMesh.h b/intern/bsp/test/BSP_GhostTest/BSP_TMesh.h
index 3de5fd5..793fb47 100644
--- a/intern/bsp/test/BSP_GhostTest/BSP_TMesh.h
+++ b/intern/bsp/test/BSP_GhostTest/BSP_TMesh.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BSP_TMesh_h
-#define BSP_TMesh_h
+#ifndef __BSP_TMESH_H__
+#define __BSP_TMESH_H__
 
 #include "MT_Point3.h"
 #include "MT_Vector3.h"
@@ -84,9 +84,9 @@ public :
 			f.m_verts[1] = verts[i-1];
 			f.m_verts[2] = verts[i];
 
- 			m_faces.push_back(f);
+			m_faces.push_back(f);
 
-			BuildNormal(m_faces.back());		
+			BuildNormal(m_faces.back());
 		}
 	}
 
diff --git a/intern/container/CTR_List.h b/intern/container/CTR_List.h
index 7eb8dce..404a08f 100644
--- a/intern/container/CTR_List.h
+++ b/intern/container/CTR_List.h
@@ -37,42 +37,42 @@
 class CTR_Link {
 public:
 	CTR_Link(
-	) ;
+	);
 
 	CTR_Link(
 		CTR_Link *next,
 		CTR_Link *prev
-	) ;
+	);
 
 		CTR_Link *
 	getNext(
-	) const ;
+	) const;
 
 		CTR_Link *
 	getPrev(
-	) const ;
+	) const;
 
 		bool 
 	isHead(
-	) const ;
+	) const;
 
 		bool 
 	isTail(
-	) const ;
+	) const;
 
 		void 
 	insertBefore(
 		CTR_Link *link
-	) ;
+	);
 
 		void 
 	insertAfter(
 		CTR_Link *link
-	) ;
+	);
 
 		void 
 	remove(
-	) ;
+	);
 
 private:  
 	CTR_Link  *m_next;
@@ -83,25 +83,25 @@ class CTR_List {
 public:
 
 	CTR_List(
-	) ;
+	);
 
 		CTR_Link *
 	getHead(
-	) const ;
+	) const;
  
 		CTR_Link *
 	getTail(
-	) const ;
+	) const;
 
 		void 
 	addHead(
 		CTR_Link *link
-	) ;
+	);
 
 		void 
 	addTail(
 		CTR_Link *link
-	) ;
+	);
 
 private:
 	CTR_Link m_head;
diff --git a/intern/container/CTR_TaggedIndex.h b/intern/container/CTR_TaggedIndex.h
index 00a24d0..8420414 100644
--- a/intern/container/CTR_TaggedIndex.h
+++ b/intern/container/CTR_TaggedIndex.h
@@ -36,8 +36,8 @@
  * Simple tagged index class.
  */
 
-#ifndef NAN_INCLUDED_CTR_TaggedIndex_h
-#define NAN_INCLUDED_CTR_TaggedIndex_h
+#ifndef __CTR_TAGGEDINDEX_H__
+#define __CTR_TAGGEDINDEX_H__
 
 /**
  * This class is supposed to be a simple tagged index class. If these
diff --git a/intern/container/CTR_TaggedSetOps.h b/intern/container/CTR_TaggedSetOps.h
index 9dc4e4f..d30081d 100644
--- a/intern/container/CTR_TaggedSetOps.h
+++ b/intern/container/CTR_TaggedSetOps.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NAN_INCLUDED_LOD_TaggedSetOps_h
-#define NAN_INCLUDED_LOD_TaggedSetOps_h
+#ifndef __CTR_TAGGEDSETOPS_H__
+#define __CTR_TAGGEDSETOPS_H__
 
 #include "MEM_NonCopyable.h"
 #include <vector>
diff --git a/intern/container/CTR_UHeap.h b/intern/container/CTR_UHeap.h
index 11813c4..ad3d7d2 100644
--- a/intern/container/CTR_UHeap.h
+++ b/intern/container/CTR_UHeap.h
@@ -44,8 +44,8 @@
  *
  */
 
-#ifndef NAN_INCLUDED_CTR_UHeap_h
-#define NAN_INCLUDED_CTR_UHeap_h
+#ifndef __CTR_UHEAP_H__
+#define __CTR_UHEAP_H__
 
 #include <vector>
 
diff --git a/intern/cycles/SConscript b/intern/cycles/SConscript
index 2ea224f..34c6e8d 100644
--- a/intern/cycles/SConscript
+++ b/intern/cycles/SConscript
@@ -39,7 +39,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
 else:
     cxxflags.append('-ffast-math'.split())
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs.append(env['BF_PTHREADS_INC'])
 
 # optimized kernel
diff --git a/intern/cycles/app/cycles_xml.cpp b/intern/cycles/app/cycles_xml.cpp
index 5e4b3da..b954ff4 100644
--- a/intern/cycles/app/cycles_xml.cpp
+++ b/intern/cycles/app/cycles_xml.cpp
@@ -288,9 +288,11 @@ static void xml_read_camera(const XMLReadState& state, pugi::xml_node node)
 	xml_read_float(&cam->shutterclose, node, "shutterclose");
 
 	if(xml_equal_string(node, "type", "orthographic"))
-		cam->ortho = true;
+		cam->type = CAMERA_ORTHOGRAPHIC;
 	else if(xml_equal_string(node, "type", "perspective"))
-		cam->ortho = false;
+		cam->type = CAMERA_PERSPECTIVE;
+	else if(xml_equal_string(node, "type", "environment"))
+		cam->type = CAMERA_ENVIRONMENT;
 
 	cam->matrix = state.tfm;
 
@@ -676,7 +678,7 @@ static void xml_read_mesh(const XMLReadState& state, pugi::xml_node node)
 		//dsplit.dicing_rate = 5.0f;
 		dsplit.dicing_rate = state.dicing_rate;
 		xml_read_float(&dsplit.dicing_rate, node, "dicing_rate");
-		sdmesh.tesselate(&dsplit, false, mesh, shader, smooth);
+		sdmesh.tessellate(&dsplit, false, mesh, shader, smooth);
 	}
 	else {
 		/* create vertices */
@@ -722,7 +724,7 @@ static void xml_read_patch(const XMLReadState& state, pugi::xml_node node)
 			LinearQuadPatch *bpatch = new LinearQuadPatch();
 
 			for(int i = 0; i < 4; i++)
-				P[i] = transform(&state.tfm, P[i]);
+				P[i] = transform_point(&state.tfm, P[i]);
 			memcpy(bpatch->hull, &P[0], sizeof(bpatch->hull));
 
 			patch = bpatch;
@@ -736,7 +738,7 @@ static void xml_read_patch(const XMLReadState& state, pugi::xml_node node)
 			BicubicPatch *bpatch = new BicubicPatch();
 
 			for(int i = 0; i < 16; i++)
-				P[i] = transform(&state.tfm, P[i]);
+				P[i] = transform_point(&state.tfm, P[i]);
 			memcpy(bpatch->hull, &P[0], sizeof(bpatch->hull));
 
 			patch = bpatch;
@@ -775,7 +777,7 @@ static void xml_read_light(const XMLReadState& state, pugi::xml_node node)
 	Light *light = new Light();
 	light->shader = state.shader;
 	xml_read_float3(&light->co, node, "P");
-	light->co = transform(&state.tfm, light->co);
+	light->co = transform_point(&state.tfm, light->co);
 
 	state.scene->lights.push_back(light);
 }
diff --git a/intern/cycles/blender/addon/__init__.py b/intern/cycles/blender/addon/__init__.py
index 6a5ccbb..4159108 100644
--- a/intern/cycles/blender/addon/__init__.py
+++ b/intern/cycles/blender/addon/__init__.py
@@ -22,7 +22,7 @@ bl_info = {
     "name": "Cycles Render Engine",
     "author": "",
     "version": (0, 0),
-    "blender": (2, 6, 0),
+    "blender": (2, 6, 2),
     "location": "Info header, render engine menu",
     "description": "Cycles Render Engine integration.",
     "warning": "",
diff --git a/intern/cycles/blender/addon/enums.py b/intern/cycles/blender/addon/enums.py
index e1b138d..b4b1646 100644
--- a/intern/cycles/blender/addon/enums.py
+++ b/intern/cycles/blender/addon/enums.py
@@ -21,31 +21,36 @@
 from . import engine
 
 devices = (
-    ("CPU", "CPU", "Use CPU for rendering"),
-    ("GPU", "GPU Compute", "Use GPU compute device for rendering, configured in user preferences"))
+    ('CPU', "CPU", "Use CPU for rendering"),
+    ('GPU', "GPU Compute", "Use GPU compute device for rendering, configured in user preferences"))
 
 feature_set = (
-    ("SUPPORTED", "Supported", "Only use finished and supported features"),
-    ("EXPERIMENTAL", "Experimental", "Use experimental and incomplete features that might be broken or change in the future"),
+    ('SUPPORTED', "Supported", "Only use finished and supported features"),
+    ('EXPERIMENTAL', "Experimental", "Use experimental and incomplete features that might be broken or change in the future"),
     )
 
 shading_systems = (
-    ("GPU_COMPATIBLE", "GPU Compatible", "Restricted shading system compatible with GPU rendering"),
-    ("OSL", "Open Shading Language", "Open Shading Language shading system that only runs on the CPU"),
+    ('GPU_COMPATIBLE', "GPU Compatible", "Restricted shading system compatible with GPU rendering"),
+    ('OSL', "Open Shading Language", "Open Shading Language shading system that only runs on the CPU"),
     )
 
 displacement_methods = (
-    ("BUMP", "Bump", "Bump mapping to simulate the appearance of displacement"),
-    ("TRUE", "True", "Use true displacement only, requires fine subdivision"),
-    ("BOTH", "Both", "Combination of displacement and bump mapping"),
+    ('BUMP', "Bump", "Bump mapping to simulate the appearance of displacement"),
+    ('TRUE', "True", "Use true displacement only, requires fine subdivision"),
+    ('BOTH', "Both", "Combination of displacement and bump mapping"),
     )
 
 bvh_types = (
-    ("DYNAMIC_BVH", "Dynamic BVH", "Objects can be individually updated, at the cost of slower render time"),
-    ("STATIC_BVH", "Static BVH", "Any object modification requires a complete BVH rebuild, but renders faster"),
+    ('DYNAMIC_BVH', "Dynamic BVH", "Objects can be individually updated, at the cost of slower render time"),
+    ('STATIC_BVH', "Static BVH", "Any object modification requires a complete BVH rebuild, but renders faster"),
     )
 
 filter_types = (
-    ("BOX", "Box", "Box filter"),
-    ("GAUSSIAN", "Gaussian", "Gaussian filter"),
+    ('BOX', "Box", "Box filter"),
+    ('GAUSSIAN', "Gaussian", "Gaussian filter"),
+    )
+
+aperture_types = (
+    ('RADIUS', "Radius", "Directly change the size of the aperture"),
+    ('FSTOP', "F/stop", "Change the size of the aperture by f/stops"),
     )
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index 7e7e83b..cb99ea3 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -74,6 +74,11 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
                 description="Pause all viewport preview renders",
                 default=False,
                 )
+        cls.preview_active_layer = BoolProperty(
+                name="Preview Active Layer",
+                description="Preview active render layer in viewport",
+                default=False,
+                )
 
         cls.no_caustics = BoolProperty(
                 name="No Caustics",
@@ -169,6 +174,13 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
                 default=0,
                 )
 
+        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",
+                min=0.0, max=1e8,
+                default=0.0,
+                )
+
         cls.debug_tile_size = IntProperty(
                 name="Tile Size",
                 description="",
@@ -231,11 +243,27 @@ class CyclesCameraSettings(bpy.types.PropertyGroup):
                 type=cls,
                 )
 
+        cls.aperture_type = EnumProperty(
+                name="Aperture Type",
+                description="Use F/stop number or aperture radius",
+                items=enums.aperture_types,
+                default='RADIUS',
+                )
+        cls.aperture_fstop = FloatProperty(
+                name="Aperture F/stop",
+                description="F/stop ratio (lower numbers give more defocus, higher numbers give a sharper image)",
+                min=0.0, soft_min=0.1, soft_max=64.0,
+                default=5.6,
+                step=10,
+                precision=1,
+                )
         cls.aperture_size = FloatProperty(
                 name="Aperture Size",
-                description="Radius of the aperture for depth of field",
-                min=0.0, max=10.0,
+                description="Radius of the aperture for depth of field (higher values give more defocus)",
+                min=0.0, soft_max=10.0,
                 default=0.0,
+                step=1,
+                precision=4,
                 )
         cls.aperture_blades = IntProperty(
                 name="Aperture Blades",
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index c966792..624d00b 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -67,6 +67,7 @@ class CyclesRender_PT_integrator(CyclesButtonsPanel, Panel):
         sub.prop(cscene, "samples", text="Render")
         sub.prop(cscene, "preview_samples", text="Preview")
         sub.prop(cscene, "seed")
+        sub.prop(cscene, "sample_clamp")
 
         sub = col.column(align=True)
         sub.label("Transparency:")
@@ -177,11 +178,15 @@ class CyclesRender_PT_layers(CyclesButtonsPanel, Panel):
 
         col = split.column()
         col.prop(scene, "layers", text="Scene")
+        col.label(text="Material:")
+        col.prop(rl, "material_override", text="")
+
+        col.prop(rl, "use_sky", "Use Environment")
 
         col = split.column()
         col.prop(rl, "layers", text="Layer")
-
-        layout.separator()
+        col.label(text="Mask Layers:")
+        col.prop(rl, "layers_zmask", text="")
 
         split = layout.split()
 
@@ -194,6 +199,8 @@ class CyclesRender_PT_layers(CyclesButtonsPanel, Panel):
         col.prop(rl, "use_pass_material_index")
         col.prop(rl, "use_pass_emit")
         col.prop(rl, "use_pass_environment")
+        col.prop(rl, "use_pass_ambient_occlusion")
+        col.prop(rl, "use_pass_shadow")
 
         col = split.column()
         col.label()
@@ -213,11 +220,6 @@ class CyclesRender_PT_layers(CyclesButtonsPanel, Panel):
         row.prop(rl, "use_pass_transmission_indirect", text="Indirect", toggle=True)
         row.prop(rl, "use_pass_transmission_color", text="Color", toggle=True)
 
-        layout.separator()
-
-        rl = rd.layers[0]
-        layout.prop(rl, "material_override", text="Material")
-
 
 class Cycles_PT_post_processing(CyclesButtonsPanel, Panel):
     bl_label = "Post Processing"
@@ -265,7 +267,12 @@ class CyclesCamera_PT_dof(CyclesButtonsPanel, Panel):
         col = split.column()
 
         col.label("Aperture:")
-        col.prop(ccam, "aperture_size", text="Size")
+        sub = col.column(align=True)
+        sub.prop(ccam, "aperture_type", text="")
+        if ccam.aperture_type == 'RADIUS':
+            sub.prop(ccam, "aperture_size", text="Size")
+        elif ccam.aperture_type == 'FSTOP':
+            sub.prop(ccam, "aperture_fstop", text="Number")
 
         sub = col.column(align=True)
         sub.prop(ccam, "aperture_blades", text="Blades")
@@ -398,7 +405,7 @@ def find_node_input(node, name):
 
 
 def panel_node_draw(layout, id_data, output_type, input_name):
-    if not id_data.node_tree:
+    if not id_data.use_nodes:
         layout.prop(id_data, "use_nodes", icon='NODETREE')
         return False
 
@@ -487,46 +494,69 @@ class CyclesWorld_PT_surface(CyclesButtonsPanel, Panel):
             layout.prop(world, "horizon_color", text="Color")
 
 
-class CyclesWorld_PT_settings(CyclesButtonsPanel, Panel):
-    bl_label = "Settings"
+class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel):
+    bl_label = "Volume"
     bl_context = "world"
     bl_options = {'DEFAULT_CLOSED'}
 
     @classmethod
     def poll(cls, context):
-        return context.world and CyclesButtonsPanel.poll(context)
+        # world = context.world
+        # world and world.node_tree and CyclesButtonsPanel.poll(context)
+        return False
 
     def draw(self, context):
         layout = self.layout
+        layout.active = False
 
         world = context.world
-        cworld = world.cycles
+        panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Volume')
 
-        col = layout.column()
 
-        col.prop(cworld, "sample_as_light")
-        row = col.row()
-        row.active = cworld.sample_as_light
-        row.prop(cworld, "sample_map_resolution")
+class CyclesWorld_PT_ambient_occlusion(CyclesButtonsPanel, Panel):
+    bl_label = "Ambient Occlusion"
+    bl_context = "world"
+
+    @classmethod
+    def poll(cls, context):
+        return context.world and CyclesButtonsPanel.poll(context)
 
+    def draw_header(self, context):
+        light = context.world.light_settings
+        self.layout.prop(light, "use_ambient_occlusion", text="")
 
-class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel):
-    bl_label = "Volume"
+    def draw(self, context):
+        layout = self.layout
+        light = context.world.light_settings
+
+        layout.active = light.use_ambient_occlusion
+
+        row = layout.row()
+        row.prop(light, "ao_factor", text="Factor")
+        row.prop(light, "distance", text="Distance")
+
+
+class CyclesWorld_PT_settings(CyclesButtonsPanel, Panel):
+    bl_label = "Settings"
     bl_context = "world"
     bl_options = {'DEFAULT_CLOSED'}
 
     @classmethod
     def poll(cls, context):
-        # world = context.world
-        # world and world.node_tree and CyclesButtonsPanel.poll(context)
-        return False
+        return context.world and CyclesButtonsPanel.poll(context)
 
     def draw(self, context):
         layout = self.layout
-        layout.active = False
 
         world = context.world
-        panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Volume')
+        cworld = world.cycles
+
+        col = layout.column()
+
+        col.prop(cworld, "sample_as_light")
+        row = col.row()
+        row.active = cworld.sample_as_light
+        row.prop(cworld, "sample_map_resolution")
 
 
 class CyclesMaterial_PT_surface(CyclesButtonsPanel, Panel):
@@ -623,7 +653,6 @@ class CyclesTexture_PT_context(CyclesButtonsPanel, Panel):
         pin_id = space.pin_id
         use_pin_id = space.use_pin_id
         user = context.texture_user
-        # node = context.texture_node
 
         if not use_pin_id or not isinstance(pin_id, bpy.types.Texture):
             pin_id = None
@@ -701,7 +730,7 @@ class CyclesTexture_PT_mapping(CyclesButtonsPanel, Panel):
 
         row = layout.row()
 
-        row.column().prop(mapping, "location")
+        row.column().prop(mapping, "translation")
         row.column().prop(mapping, "rotation")
         row.column().prop(mapping, "scale")
 
@@ -754,6 +783,31 @@ class CyclesTexture_PT_colors(CyclesButtonsPanel, Panel):
             layout.template_color_ramp(mapping, "color_ramp", expand=True)
 
 
+class CyclesScene_PT_simplify(CyclesButtonsPanel, Panel):
+    bl_label = "Simplify"
+    bl_context = "scene"
+    COMPAT_ENGINES = {'CYCLES'}
+
+    def draw_header(self, context):
+        rd = context.scene.render
+        self.layout.prop(rd, "use_simplify", text="")
+
+    def draw(self, context):
+        layout = self.layout
+
+        rd = context.scene.render
+
+        layout.active = rd.use_simplify
+
+        split = layout.split()
+
+        col = split.column()
+        col.prop(rd, "simplify_subdivision", text="Subdivision")
+
+        col = split.column()
+        col.prop(rd, "simplify_child_particles", text="Child Particles")
+
+
 def draw_device(self, context):
     scene = context.scene
     layout = self.layout
@@ -779,7 +833,9 @@ def draw_pause(self, context):
 
         if view.viewport_shade == 'RENDERED':
             cscene = scene.cycles
+            layername = scene.render.layers.active.name
             layout.prop(cscene, "preview_pause", icon="PAUSE", text="")
+            layout.prop(cscene, "preview_active_layer", icon="RENDERLAYERS", text=layername)
 
 
 def get_panels():
diff --git a/intern/cycles/blender/blender_camera.cpp b/intern/cycles/blender/blender_camera.cpp
index cbc430d..a21b22b 100644
--- a/intern/cycles/blender/blender_camera.cpp
+++ b/intern/cycles/blender/blender_camera.cpp
@@ -31,7 +31,7 @@ struct BlenderCamera {
 	float nearclip;
 	float farclip;
 
-	bool ortho;
+	CameraType type;
 	float ortho_scale;
 
 	float lens;
@@ -58,6 +58,7 @@ static void blender_camera_init(BlenderCamera *bcam)
 {
 	memset(bcam, 0, sizeof(BlenderCamera));
 
+	bcam->type = CAMERA_PERSPECTIVE;
 	bcam->zoom = 1.0f;
 	bcam->pixelaspect = make_float2(1.0f, 1.0f);
 	bcam->sensor_width = 32.0f;
@@ -91,11 +92,24 @@ static void blender_camera_from_object(BlenderCamera *bcam, BL::Object b_ob)
 		bcam->nearclip = b_camera.clip_start();
 		bcam->farclip = b_camera.clip_end();
 
-		bcam->ortho = (b_camera.type() == BL::Camera::type_ORTHO);
+		bcam->type = (b_camera.type() == BL::Camera::type_ORTHO)? CAMERA_ORTHOGRAPHIC: CAMERA_PERSPECTIVE;
+		if(bcam->type == CAMERA_PERSPECTIVE && b_camera.use_panorama())
+			bcam->type = CAMERA_ENVIRONMENT;
 		bcam->ortho_scale = b_camera.ortho_scale();
 
 		bcam->lens = b_camera.lens();
-		bcam->aperturesize = RNA_float_get(&ccamera, "aperture_size");
+
+		/* allow f/stop number to change aperture_size but still
+		   give manual control over aperture radius */
+		int aperture_type = RNA_enum_get(&ccamera, "aperture_type");
+
+		if(aperture_type == 1) {
+			float fstop = RNA_float_get(&ccamera, "aperture_fstop");
+			bcam->aperturesize = (bcam->lens*1e-3f)/(2.0f*max(fstop, 1e-5f));
+		}
+		else
+			bcam->aperturesize = RNA_float_get(&ccamera, "aperture_size");
+
 		bcam->apertureblades = RNA_int_get(&ccamera, "aperture_blades");
 		bcam->aperturerotation = RNA_float_get(&ccamera, "aperture_rotation");
 		bcam->focaldistance = blender_camera_focal_distance(b_ob, b_camera);
@@ -159,39 +173,48 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int
 	}
 
 	/* modify aspect for orthographic scale */
-	if(bcam->ortho) {
+	if(bcam->type == CAMERA_ORTHOGRAPHIC) {
 		xaspect = xaspect*bcam->ortho_scale/(aspectratio*2.0f);
 		yaspect = yaspect*bcam->ortho_scale/(aspectratio*2.0f);
 		aspectratio = bcam->ortho_scale/2.0f;
 	}
 
-	/* set viewplane */
-	cam->left = -xaspect;
-	cam->right = xaspect;
-	cam->bottom = -yaspect;
-	cam->top = yaspect;
-
-	/* zoom for 3d camera view */
-	cam->left *= bcam->zoom;
-	cam->right *= bcam->zoom;
-	cam->bottom *= bcam->zoom;
-	cam->top *= 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);
-
-	cam->left += dx;
-	cam->right += dx;
-	cam->bottom += dy;
-	cam->top += dy;
+	if(bcam->type == CAMERA_ENVIRONMENT) {
+		/* set viewplane */
+		cam->left = 0.0f;
+		cam->right = 1.0f;
+		cam->bottom = 0.0f;
+		cam->top = 1.0f;
+	}
+	else {
+		/* set viewplane */
+		cam->left = -xaspect;
+		cam->right = xaspect;
+		cam->bottom = -yaspect;
+		cam->top = yaspect;
+
+		/* zoom for 3d camera view */
+		cam->left *= bcam->zoom;
+		cam->right *= bcam->zoom;
+		cam->bottom *= bcam->zoom;
+		cam->top *= 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);
+
+		cam->left += dx;
+		cam->right += dx;
+		cam->bottom += dy;
+		cam->top += dy;
+	}
 
 	/* clipping distances */
 	cam->nearclip = bcam->nearclip;
 	cam->farclip = bcam->farclip;
 
-	/* orthographic */
-	cam->ortho = bcam->ortho;
+	/* type */
+	cam->type = bcam->type;
 
 	/* perspective */
 	cam->fov = 2.0f*atan((0.5f*sensor_size)/bcam->lens/aspectratio);
@@ -200,8 +223,24 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int
 	cam->blades = bcam->apertureblades;
 	cam->bladesrotation = bcam->aperturerotation;
 
-	/* transform, note the blender camera points along the negative z-axis */
-	cam->matrix = bcam->matrix * transform_scale(1.0f, 1.0f, -1.0f);
+	/* transform */
+	cam->matrix = bcam->matrix;
+
+	if(bcam->type == CAMERA_ENVIRONMENT) {
+		/* make it so environment camera needs to be pointed in the direction
+		   of the positive x-axis to match an environment texture, this way
+		   it is looking at the center of the texture */
+		cam->matrix = cam->matrix *
+			make_transform( 0.0f, -1.0f, 0.0f, 0.0f,
+			                0.0f,  0.0f, 1.0f, 0.0f,
+			               -1.0f,  0.0f, 0.0f, 0.0f,
+			                0.0f,  0.0f, 0.0f, 1.0f);
+	}
+	else {
+		/* note the blender camera points along the negative z-axis */
+		cam->matrix = cam->matrix * transform_scale(1.0f, 1.0f, -1.0f);
+	}
+
 	cam->matrix = transform_clear_scale(cam->matrix);
 
 	/* set update flag */
@@ -211,7 +250,7 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int
 
 /* Sync Render Camera */
 
-void BlenderSync::sync_camera(int width, int height)
+void BlenderSync::sync_camera(BL::Object b_override, int width, int height)
 {
 	BlenderCamera bcam;
 	blender_camera_init(&bcam);
@@ -225,6 +264,9 @@ void BlenderSync::sync_camera(int width, int height)
 	/* camera object */
 	BL::Object b_ob = b_scene.camera();
 
+	if(b_override)
+		b_ob = b_override;
+
 	if(b_ob) {
 		blender_camera_from_object(&bcam, b_ob);
 		bcam.matrix = get_transform(b_ob.matrix_world());
@@ -249,7 +291,7 @@ void BlenderSync::sync_view(BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int
 
 	if(b_rv3d.view_perspective() == BL::RegionView3D::view_perspective_CAMERA) {
 		/* camera view */
-		BL::Object b_ob = b_scene.camera();
+		BL::Object b_ob = (b_v3d.lock_camera_and_layers())? b_scene.camera(): b_v3d.camera();
 
 		if(b_ob) {
 			blender_camera_from_object(&bcam, b_ob);
@@ -269,7 +311,7 @@ void BlenderSync::sync_view(BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int
 		bcam.farclip *= 0.5;
 		bcam.nearclip = -bcam.farclip;
 
-		bcam.ortho = true;
+		bcam.type = CAMERA_ORTHOGRAPHIC;
 		bcam.ortho_scale = b_rv3d.view_distance();
 	}
 
diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp
index bc43809..7caa6b3 100644
--- a/intern/cycles/blender/blender_mesh.cpp
+++ b/intern/cycles/blender/blender_mesh.cpp
@@ -73,10 +73,10 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector<
 		*N= get_float3(v->normal());
 
 	/* create faces */
-	BL::Mesh::faces_iterator f;
+	BL::Mesh::tessfaces_iterator f;
 	vector<int> nverts;
 
-	for(b_mesh.faces.begin(f); f != b_mesh.faces.end(); ++f) {
+	for(b_mesh.tessfaces.begin(f); f != b_mesh.tessfaces.end(); ++f) {
 		int4 vi = get_int4(f->vertices_raw());
 		int n = (vi[3] == 0)? 3: 4;
 		int mi = clamp(f->material_index(), 0, used_shaders.size()-1);
@@ -115,9 +115,9 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector<
 
 	/* create vertex color attributes */
 	{
-		BL::Mesh::vertex_colors_iterator l;
+		BL::Mesh::tessface_vertex_colors_iterator l;
 
-		for(b_mesh.vertex_colors.begin(l); l != b_mesh.vertex_colors.end(); ++l) {
+		for(b_mesh.tessface_vertex_colors.begin(l); l != b_mesh.tessface_vertex_colors.end(); ++l) {
 			if(!mesh_need_attribute(scene, mesh, ustring(l->name().c_str())))
 				continue;
 
@@ -147,9 +147,9 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector<
 
 	/* create uv map attributes */
 	{
-		BL::Mesh::uv_textures_iterator l;
+		BL::Mesh::tessface_uv_textures_iterator l;
 
-		for(b_mesh.uv_textures.begin(l); l != b_mesh.uv_textures.end(); ++l) {
+		for(b_mesh.tessface_uv_textures.begin(l); l != b_mesh.tessface_uv_textures.end(); ++l) {
 			Attribute::Standard std = (l->active_render())? Attribute::STD_UV: Attribute::STD_NONE;
 			ustring name = ustring(l->name().c_str());
 
@@ -196,9 +196,9 @@ static void create_subd_mesh(Mesh *mesh, BL::Mesh b_mesh, PointerRNA *cmesh, con
 		sdmesh.add_vert(get_float3(v->co()));
 
 	/* create faces */
-	BL::Mesh::faces_iterator f;
+	BL::Mesh::tessfaces_iterator f;
 
-	for(b_mesh.faces.begin(f); f != b_mesh.faces.end(); ++f) {
+	for(b_mesh.tessfaces.begin(f); f != b_mesh.tessfaces.end(); ++f) {
 		int4 vi = get_int4(f->vertices_raw());
 		int n= (vi[3] == 0)? 3: 4;
 		//int shader = used_shaders[f->material_index()];
@@ -217,32 +217,41 @@ static void create_subd_mesh(Mesh *mesh, BL::Mesh b_mesh, PointerRNA *cmesh, con
 	dsplit.camera = NULL;
 	dsplit.dicing_rate = RNA_float_get(cmesh, "dicing_rate");
 
-	sdmesh.tesselate(&dsplit, false, mesh, used_shaders[0], true);
+	sdmesh.tessellate(&dsplit, false, mesh, used_shaders[0], true);
 }
 
 /* Sync */
 
-Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated)
+Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool holdout, bool object_updated)
 {
 	/* test if we can instance or if the object is modified */
 	BL::ID b_ob_data = b_ob.data();
-	BL::ID key = (object_is_modified(b_ob))? b_ob: b_ob_data;
+	BL::ID key = (object_is_modified(b_ob) || holdout)? b_ob: b_ob_data;
+	BL::Material material_override = render_layer.material_override;
 
 	/* find shader indices */
 	vector<uint> used_shaders;
 
 	BL::Object::material_slots_iterator slot;
 	for(b_ob.material_slots.begin(slot); slot != b_ob.material_slots.end(); ++slot) {
-		BL::Material material_override = render_layers.front().material_override;
+		BL::Material material_override = render_layer.material_override;
 
-		if(material_override)
+		if(holdout)
+			find_shader(PointerRNA_NULL, used_shaders, scene->default_holdout);
+		else if(material_override)
 			find_shader(material_override, used_shaders, scene->default_surface);
 		else
 			find_shader(slot->material(), used_shaders, scene->default_surface);
 	}
 
-	if(used_shaders.size() == 0)
-		used_shaders.push_back(scene->default_surface);
+	if(used_shaders.size() == 0) {
+		if(holdout)
+			used_shaders.push_back(scene->default_holdout);
+		else if(material_override)
+			find_shader(material_override, used_shaders, scene->default_surface);
+		else
+			used_shaders.push_back(scene->default_surface);
+	}
 	
 	/* test if we need to sync */
 	Mesh *mesh;
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp
index afcfcd9..96faee1 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -208,8 +208,11 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob,
 	if(object_map.sync(&object, b_ob, b_parent, key))
 		object_updated = true;
 	
+	/* holdout? */
+	bool holdout = (layer_flag & render_layer.holdout_layer) != 0;
+
 	/* mesh sync */
-	object->mesh = sync_mesh(b_ob, object_updated);
+	object->mesh = sync_mesh(b_ob, holdout, object_updated);
 
 	/* object sync */
 	if(object_updated || (object->mesh && object->mesh->need_update)) {
@@ -238,7 +241,7 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob,
 void BlenderSync::sync_objects(BL::SpaceView3D b_v3d)
 {
 	/* layer data */
-	uint scene_layer = render_layers.front().scene_layer;
+	uint scene_layer = render_layer.scene_layer;
 	
 	/* prepare for sync */
 	light_map.pre_sync();
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp
index cc6ba07..dc6c69e 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -96,7 +96,7 @@ void BlenderSession::create_session()
 	if(b_rv3d)
 		sync->sync_view(b_v3d, b_rv3d, width, height);
 	else
-		sync->sync_camera(width, height);
+		sync->sync_camera(b_engine.camera_override(), width, height);
 
 	/* create session */
 	session = new Session(session_params);
@@ -158,10 +158,12 @@ static PassType get_pass_type(BL::RenderPass b_pass)
 			return PASS_EMISSION;
 		case BL::RenderPass::type_ENVIRONMENT:
 			return PASS_BACKGROUND;
+		case BL::RenderPass::type_AO:
+			return PASS_AO;
+		case BL::RenderPass::type_SHADOW:
+			return PASS_SHADOW;
 
 		case BL::RenderPass::type_DIFFUSE:
-		case BL::RenderPass::type_SHADOW:
-		case BL::RenderPass::type_AO:
 		case BL::RenderPass::type_COLOR:
 		case BL::RenderPass::type_REFRACTION:
 		case BL::RenderPass::type_SPECULAR:
@@ -312,7 +314,7 @@ void BlenderSession::synchronize()
 	if(b_rv3d)
 		sync->sync_view(b_v3d, b_rv3d, width, height);
 	else
-		sync->sync_camera(width, height);
+		sync->sync_camera(b_engine.camera_override(), width, height);
 
 	/* unlock */
 	session->scene->mutex.unlock();
diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp
index 5310e35..52d9775 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -80,7 +80,7 @@ static void get_tex_mapping(TextureMapping *mapping, BL::TexMapping b_mapping)
 	if(!b_mapping)
 		return;
 
-	mapping->translation = get_float3(b_mapping.location());
+	mapping->translation = get_float3(b_mapping.translation());
 	mapping->rotation = get_float3(b_mapping.rotation());
 	mapping->scale = get_float3(b_mapping.scale());
 
@@ -94,7 +94,7 @@ static void get_tex_mapping(TextureMapping *mapping, BL::ShaderNodeMapping b_map
 	if(!b_mapping)
 		return;
 
-	mapping->translation = get_float3(b_mapping.location());
+	mapping->translation = get_float3(b_mapping.translation());
 	mapping->rotation = get_float3(b_mapping.rotation());
 	mapping->scale = get_float3(b_mapping.scale());
 }
@@ -105,7 +105,6 @@ static ShaderNode *add_node(BL::BlendData b_data, ShaderGraph *graph, BL::Shader
 
 	switch(b_node.type()) {
 		/* not supported */
-		case BL::ShaderNode::type_CURVE_RGB: break;
 		case BL::ShaderNode::type_CURVE_VEC: break;
 		case BL::ShaderNode::type_GEOMETRY: break;
 		case BL::ShaderNode::type_MATERIAL: break;
@@ -114,10 +113,21 @@ static ShaderNode *add_node(BL::BlendData b_data, ShaderGraph *graph, BL::Shader
 		case BL::ShaderNode::type_SCRIPT: break;
 		case BL::ShaderNode::type_SQUEEZE: break;
 		case BL::ShaderNode::type_TEXTURE: break;
-		case BL::ShaderNode::type_VALTORGB: break;
 		/* handled outside this function */
 		case BL::ShaderNode::type_GROUP: break;
 		/* existing blender nodes */
+		case BL::ShaderNode::type_CURVE_RGB: {
+			RGBCurvesNode *ramp = new RGBCurvesNode();
+			node = ramp;
+			break;
+		}
+		case BL::ShaderNode::type_VALTORGB: {
+			RGBRampNode *ramp = new RGBRampNode();
+			BL::ShaderNodeValToRGB b_ramp_node(b_node);
+			colorramp_to_array(b_ramp_node.color_ramp(), ramp->ramp, RAMP_TABLE_SIZE);
+			node = ramp;
+			break;
+		}
 		case BL::ShaderNode::type_RGB: {
 			ColorNode *color = new ColorNode();
 			color->value = get_node_output_rgba(b_node, "Color");
@@ -332,6 +342,7 @@ static ShaderNode *add_node(BL::BlendData b_data, ShaderGraph *graph, BL::Shader
 			if(b_image)
 				env->filename = blender_absolute_path(b_data, b_image, b_image.filepath());
 			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());
 			node = env;
 			break;
@@ -517,6 +528,9 @@ static void add_nodes(BL::BlendData b_data, ShaderGraph *graph, BL::ShaderNodeTr
 			/* add proxy converter nodes for inputs and outputs */
 			BL::NodeGroup b_gnode(*b_node);
 			BL::ShaderNodeTree b_group_ntree(b_gnode.node_tree());
+			if (!b_group_ntree)
+				continue;
+
 			BL::Node::inputs_iterator b_input;
 			BL::Node::outputs_iterator b_output;
 			
@@ -696,12 +710,25 @@ void BlenderSync::sync_world()
 			graph->connect(closure->output("Background"), out->input("Surface"));
 		}
 
+		/* AO */
+		if(b_world) {
+			BL::WorldLighting b_light = b_world.light_settings();
+
+			if(b_light.use_ambient_occlusion())
+				background->ao_factor = b_light.ao_factor();
+			else
+				background->ao_factor = 0.0f;
+
+			background->ao_distance = b_light.distance();
+		}
+
 		shader->set_graph(graph);
 		shader->tag_update(scene);
 	}
 
 	PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
 	background->transparent = get_boolean(cscene, "film_transparent");
+	background->use = render_layer.use_background;
 
 	if(background->modified(prevbackground))
 		background->tag_update(scene);
diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp
index 91996d5..5a28629 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -48,8 +48,7 @@ BlenderSync::BlenderSync(BL::BlendData b_data_, BL::Scene b_scene_, Scene *scene
   light_map(&scene_->lights),
   world_map(NULL),
   world_recalc(false),
-  experimental(false),
-  active_layer(0)
+  experimental(false)
 {
 	scene = scene_;
 	preview = preview_;
@@ -124,8 +123,8 @@ bool BlenderSync::sync_recalc()
 
 void BlenderSync::sync_data(BL::SpaceView3D b_v3d, const char *layer)
 {
-	sync_render_layers(b_v3d);
-	sync_integrator(layer);
+	sync_render_layers(b_v3d, layer);
+	sync_integrator();
 	sync_film();
 	sync_shaders();
 	sync_objects(b_v3d);
@@ -133,7 +132,7 @@ void BlenderSync::sync_data(BL::SpaceView3D b_v3d, const char *layer)
 
 /* Integrator */
 
-void BlenderSync::sync_integrator(const char *layer)
+void BlenderSync::sync_integrator()
 {
 	PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
 
@@ -156,19 +155,9 @@ void BlenderSync::sync_integrator(const char *layer)
 	integrator->no_caustics = get_boolean(cscene, "no_caustics");
 	integrator->seed = get_int(cscene, "seed");
 
-	/* render layer */
-	int active_layer = 0;
+	integrator->layer_flag = render_layer.layer;
 
-	if(layer) {
-		for(int i = 0; i < render_layers.size(); i++) {
-			if(render_layers[i].name == layer) {
-				active_layer = i;
-				break;
-			}
-		}
-	}
-
-	integrator->layer_flag = render_layers[active_layer].layer;
+	integrator->sample_clamp = get_float(cscene, "sample_clamp");
 
 	if(integrator->modified(previntegrator))
 		integrator->tag_update(scene);
@@ -200,34 +189,46 @@ void BlenderSync::sync_film()
 
 /* Render Layer */
 
-void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d)
+void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer)
 {
-	render_layers.clear();
+	string layername;
 
+	/* 3d view */
 	if(b_v3d) {
-		RenderLayerInfo rlay;
-
-		rlay.scene_layer = get_layer(b_v3d.layers());
-		rlay.layer = rlay.scene_layer;
-		rlay.material_override = PointerRNA_NULL;
+		PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
 
-		render_layers.push_back(rlay);
+		if(RNA_boolean_get(&cscene, "preview_active_layer")) {
+			BL::RenderLayers layers(b_scene.render().ptr);
+			layername = layers.active().name();
+			layer = layername.c_str();
+		}
+		else {
+			render_layer.scene_layer = get_layer(b_v3d.layers());
+			render_layer.layer = render_layer.scene_layer;
+			render_layer.holdout_layer = 0;
+			render_layer.material_override = PointerRNA_NULL;
+			render_layer.use_background = true;
+			return;
+		}
 	}
-	else {
-		BL::RenderSettings r = b_scene.render();
-		BL::RenderSettings::layers_iterator b_rlay;
-
-		for(r.layers.begin(b_rlay); b_rlay != r.layers.end(); ++b_rlay) {
-			/* single layer for now */
-			RenderLayerInfo rlay;
 
-			rlay.name = b_rlay->name();
-			rlay.scene_layer = get_layer(b_scene.layers());
-			rlay.layer = get_layer(b_rlay->layers());
-			rlay.material_override = b_rlay->material_override();
-
-			render_layers.push_back(rlay);
+	/* render layer */
+	BL::RenderSettings r = b_scene.render();
+	BL::RenderSettings::layers_iterator b_rlay;
+	bool first_layer = true;
+
+	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());
+			render_layer.layer = get_layer(b_rlay->layers());
+			render_layer.holdout_layer = get_layer(b_rlay->layers_zmask());
+			render_layer.layer |= render_layer.holdout_layer;
+			render_layer.material_override = b_rlay->material_override();
+			render_layer.use_background = b_rlay->use_sky();
 		}
+
+		first_layer = false;
 	}
 }
 
diff --git a/intern/cycles/blender/blender_sync.h b/intern/cycles/blender/blender_sync.h
index b0bd300..d2550a1 100644
--- a/intern/cycles/blender/blender_sync.h
+++ b/intern/cycles/blender/blender_sync.h
@@ -55,7 +55,7 @@ public:
 	/* sync */
 	bool sync_recalc();
 	void sync_data(BL::SpaceView3D b_v3d, const char *layer = 0);
-	void sync_camera(int width, int height);
+	void sync_camera(BL::Object b_override, int width, int height);
 	void sync_view(BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int width, int height);
 
 	/* get parameters */
@@ -70,14 +70,14 @@ private:
 	void sync_materials();
 	void sync_objects(BL::SpaceView3D b_v3d);
 	void sync_film();
-	void sync_integrator(const char *layer);
+	void sync_integrator();
 	void sync_view();
 	void sync_world();
-	void sync_render_layers(BL::SpaceView3D b_v3d);
+	void sync_render_layers(BL::SpaceView3D b_v3d, const char *layer);
 	void sync_shaders();
 
 	void sync_nodes(Shader *shader, BL::ShaderNodeTree b_ntree);
-	Mesh *sync_mesh(BL::Object b_ob, bool object_updated);
+	Mesh *sync_mesh(BL::Object b_ob, bool holdout, bool object_updated);
 	void sync_object(BL::Object b_parent, int b_index, BL::Object b_object, Transform& tfm, uint layer_flag);
 	void sync_light(BL::Object b_parent, int b_index, BL::Object b_ob, Transform& tfm);
 	void sync_background_light();
@@ -106,18 +106,18 @@ private:
 
 	struct RenderLayerInfo {
 		RenderLayerInfo()
-		: scene_layer(0), layer(0),
-		  material_override(PointerRNA_NULL)
+		: scene_layer(0), layer(0), holdout_layer(0),
+		  material_override(PointerRNA_NULL),
+		  use_background(true)
 		{}
 
 		string name;
 		uint scene_layer;
 		uint layer;
+		uint holdout_layer;
 		BL::Material material_override;
-	};
-
-	vector<RenderLayerInfo> render_layers;
-	int active_layer;
+		bool use_background;
+	} render_layer;
 };
 
 CCL_NAMESPACE_END
diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h
index ff6d55c..67f3a3a 100644
--- a/intern/cycles/blender/blender_util.h
+++ b/intern/cycles/blender/blender_util.h
@@ -50,6 +50,7 @@ void engine_tag_redraw(void *engine);
 void engine_tag_update(void *engine);
 int rna_Object_is_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]);
 
 }
 
@@ -63,6 +64,16 @@ static inline BL::Mesh object_to_mesh(BL::Object self, BL::Scene scene, bool app
 	return BL::Mesh(ptr);
 }
 
+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);
+		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);
diff --git a/intern/cycles/device/device_multi.cpp b/intern/cycles/device/device_multi.cpp
index 3757191..1f69f2c 100644
--- a/intern/cycles/device/device_multi.cpp
+++ b/intern/cycles/device/device_multi.cpp
@@ -293,7 +293,7 @@ Device *device_multi_create(DeviceInfo& info, bool background)
 	return new MultiDevice(info, background);
 }
 
-static void device_multi_add(vector<DeviceInfo>& devices, DeviceType type, bool with_display, const char *id_fmt, int num)
+static bool device_multi_add(vector<DeviceInfo>& devices, DeviceType type, bool with_display, bool with_advanced_shading, const char *id_fmt, int num)
 {
 	DeviceInfo info;
 
@@ -302,10 +302,12 @@ static void device_multi_add(vector<DeviceInfo>& devices, DeviceType type, bool
 	map<string, int>::iterator dt;
 	int num_added = 0, num_display = 0;
 
-	info.advanced_shading = true;
+	info.advanced_shading = with_advanced_shading;
 
 	foreach(DeviceInfo& subinfo, devices) {
 		if(subinfo.type == type) {
+			if(subinfo.advanced_shading != info.advanced_shading)
+				continue;
 			if(subinfo.display_device) {
 				if(with_display)
 					num_display++;
@@ -323,14 +325,12 @@ static void device_multi_add(vector<DeviceInfo>& devices, DeviceType type, bool
 			info.multi_devices.push_back(subinfo);
 			if(subinfo.display_device)
 				info.display_device = true;
-			if(!subinfo.advanced_shading)
-				info.advanced_shading = false;
 			num_added++;
 		}
 	}
 
 	if(num_added <= 1 || (with_display && num_display == 0))
-		return;
+		return false;
 
 	/* generate string */
 	stringstream desc;
@@ -384,17 +384,24 @@ static void device_multi_add(vector<DeviceInfo>& devices, DeviceType type, bool
 		devices.push_back(info);
 	else
 		devices.insert(devices.begin(), info);
+	
+	return true;
 }
 
 void device_multi_info(vector<DeviceInfo>& devices)
 {
 	int num = 0;
-	device_multi_add(devices, DEVICE_CUDA, false, "CUDA_MULTI_%d", num++);
-	device_multi_add(devices, DEVICE_CUDA, true, "CUDA_MULTI_%d", num++);
+
+	if(!device_multi_add(devices, DEVICE_CUDA, false, true, "CUDA_MULTI_%d", num++))
+		device_multi_add(devices, DEVICE_CUDA, false, false, "CUDA_MULTI_%d", num++);
+	if(!device_multi_add(devices, DEVICE_CUDA, true, true, "CUDA_MULTI_%d", num++))
+		device_multi_add(devices, DEVICE_CUDA, true, false, "CUDA_MULTI_%d", num++);
 
 	num = 0;
-	device_multi_add(devices, DEVICE_OPENCL, false, "OPENCL_MULTI_%d", num++);
-	device_multi_add(devices, DEVICE_OPENCL, true, "OPENCL_MULTI_%d", num++);
+	if(!device_multi_add(devices, DEVICE_OPENCL, false, true, "OPENCL_MULTI_%d", num++))
+		device_multi_add(devices, DEVICE_OPENCL, false, false, "OPENCL_MULTI_%d", num++);
+	if(!device_multi_add(devices, DEVICE_OPENCL, true, true, "OPENCL_MULTI_%d", num++))
+		device_multi_add(devices, DEVICE_OPENCL, true, false, "OPENCL_MULTI_%d", num++);
 }
 
 CCL_NAMESPACE_END
diff --git a/intern/cycles/device/device_network.h b/intern/cycles/device/device_network.h
index 3cdb70b..591216a 100644
--- a/intern/cycles/device/device_network.h
+++ b/intern/cycles/device/device_network.h
@@ -109,7 +109,7 @@ typedef struct RPCReceive {
 	: socket(socket_), archive_stream(NULL), archive(NULL)
 	{
 		/* read head with fixed size */
-  		vector<char> header(8);
+		vector<char> header(8);
 		size_t len = boost::asio::read(socket, boost::asio::buffer(header));
 
 		/* verify if we got something */
@@ -170,7 +170,7 @@ public:
 	: listen_socket(io_service), collect_servers(false)
 	{
 		/* setup listen socket */
-	  	listen_endpoint.address(boost::asio::ip::address_v4::any());
+		listen_endpoint.address(boost::asio::ip::address_v4::any());
 		listen_endpoint.port(DISCOVER_PORT);
 
 		listen_socket.open(listen_endpoint.protocol());
@@ -178,7 +178,7 @@ public:
 		boost::asio::socket_base::reuse_address option(true);
 		listen_socket.set_option(option);
 
-	  	listen_socket.bind(listen_endpoint);
+		listen_socket.bind(listen_endpoint);
 
 		/* setup receive callback */
 		async_receive();
diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp
index 9a55f95..322b7ad 100644
--- a/intern/cycles/device/device_opencl.cpp
+++ b/intern/cycles/device/device_opencl.cpp
@@ -165,7 +165,7 @@ public:
 			return;
 		}
 
-		ciErr = clGetPlatformIDs(num_platforms, &cpPlatform, NULL);
+		ciErr = clGetPlatformIDs(1, &cpPlatform, NULL);
 		if(opencl_error(ciErr))
 			return;
 
@@ -298,11 +298,17 @@ public:
 	{
 		string build_options = " -cl-fast-relaxed-math ";
 		
-		/* full shading only on NVIDIA cards at the moment */
+		/* Multi Closure for nVidia cards */
 		if(platform_name == "NVIDIA CUDA")
 			build_options += "-D__KERNEL_SHADING__ -D__MULTI_CLOSURE__ -cl-nv-maxrregcount=24 -cl-nv-verbose ";
-		if(platform_name == "Apple")
-			build_options += " -D__CL_NO_FLOAT3__ ";
+			
+		/* No Float3 for Apple */
+		else if(platform_name == "Apple")
+			build_options += "-D__CL_NO_FLOAT3__ ";
+			
+		/* Basic shading for AMD cards (non Apple) */
+		else if(platform_name == "AMD Accelerated Parallel Processing")
+			build_options += "-D__KERNEL_SHADING__ -D__CL_NO_FLOAT3__ ";
 
 		return build_options;
 	}
@@ -709,7 +715,7 @@ void device_opencl_info(vector<DeviceInfo>& devices)
 	if(clGetPlatformIDs(0, NULL, &num_platforms) != CL_SUCCESS || num_platforms == 0)
 		return;
 
-	if(clGetPlatformIDs(num_platforms, &platform_id, NULL) != CL_SUCCESS)
+	if(clGetPlatformIDs(1, &platform_id, NULL) != CL_SUCCESS)
 		return;
 
 	if(clGetDeviceIDs(platform_id, CL_DEVICE_TYPE_GPU|CL_DEVICE_TYPE_ACCELERATOR, 0, NULL, &num_devices) != CL_SUCCESS)
diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt
index 59fe970..e982001 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -78,6 +78,7 @@ set(SRC_SVM_HEADERS
 	svm/svm_noise.h
 	svm/svm_noisetex.h
 	svm/svm_normal.h
+	svm/svm_ramp.h
 	svm/svm_sepcomb_rgb.h
 	svm/svm_sky.h
 	svm/svm_tex_coord.h
@@ -104,7 +105,7 @@ if(WITH_CYCLES_CUDA_BINARIES)
 		set(CUDA_BITS 32)
 	endif()
 
-	set(cuda_sources kernel.cu ${headers} ${svm_headers})
+	set(cuda_sources kernel.cu ${SRC_HEADERS} ${SRC_SVM_HEADERS} ${SRC_UTIL_HEADERS})
 	set(cuda_cubins)
 
 	foreach(arch ${CYCLES_CUDA_BINARIES_ARCH})
diff --git a/intern/cycles/kernel/kernel.cpp b/intern/cycles/kernel/kernel.cpp
index a93f617..667db1e 100644
--- a/intern/cycles/kernel/kernel.cpp
+++ b/intern/cycles/kernel/kernel.cpp
@@ -84,6 +84,25 @@ void kernel_tex_copy(KernelGlobals *kg, const char *name, device_ptr mem, size_t
 #define KERNEL_IMAGE_TEX(type, ttype, tname)
 #include "kernel_textures.h"
 
+	else if(strstr(name, "__tex_image_float")) {
+		texture_image_float4 *tex = NULL;
+		int id = atoi(name + strlen("__tex_image_float_"));
+
+		switch(id) {
+			case 95: tex = &kg->__tex_image_float_095; break;
+			case 96: tex = &kg->__tex_image_float_096; break;
+			case 97: tex = &kg->__tex_image_float_097; break;
+			case 98: tex = &kg->__tex_image_float_098; break;
+			case 99: tex = &kg->__tex_image_float_099; break;
+			default: break;
+		}
+
+		if(tex) {
+			tex->data = (float4*)mem;
+			tex->width = width;
+			tex->height = height;
+		}
+	}
 	else if(strstr(name, "__tex_image")) {
 		texture_image_uchar4 *tex = NULL;
 		int id = atoi(name + strlen("__tex_image_"));
@@ -184,11 +203,6 @@ void kernel_tex_copy(KernelGlobals *kg, const char *name, device_ptr mem, size_t
 			case 92: tex = &kg->__tex_image_092; break;
 			case 93: tex = &kg->__tex_image_093; break;
 			case 94: tex = &kg->__tex_image_094; break;
-			case 95: tex = &kg->__tex_image_095; break;
-			case 96: tex = &kg->__tex_image_096; break;
-			case 97: tex = &kg->__tex_image_097; break;
-			case 98: tex = &kg->__tex_image_098; break;
-			case 99: tex = &kg->__tex_image_099; break;
 			default: break;
 		}
 
diff --git a/intern/cycles/kernel/kernel_accumulate.h b/intern/cycles/kernel/kernel_accumulate.h
index e71fad5..9a52531 100644
--- a/intern/cycles/kernel/kernel_accumulate.h
+++ b/intern/cycles/kernel/kernel_accumulate.h
@@ -135,6 +135,8 @@ __device_inline void path_radiance_init(PathRadiance *L, int use_light_pass)
 
 		L->emission = make_float3(0.0f, 0.0f, 0.0f);
 		L->background = make_float3(0.0f, 0.0f, 0.0f);
+		L->ao = make_float3(0.0f, 0.0f, 0.0f);
+		L->shadow = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
 	}
 	else
 		L->emission = make_float3(0.0f, 0.0f, 0.0f);
@@ -150,26 +152,20 @@ __device_inline void path_radiance_bsdf_bounce(PathRadiance *L, float3 *throughp
 
 #ifdef __PASSES__
 	if(L->use_light_pass) {
-		if(bounce == 0) {
-			if(bsdf_label & LABEL_TRANSPARENT) {
-				/* transparent bounce before first hit */
-				*throughput *= bsdf_eval->transparent*inverse_pdf;
-			}
-			else {
-				/* first on directly visible surface */
-				float3 value = *throughput*inverse_pdf;
+		if(bounce == 0 && !(bsdf_label & LABEL_TRANSPARENT)) {
+			/* first on directly visible surface */
+			float3 value = *throughput*inverse_pdf;
 
-				L->indirect_diffuse = bsdf_eval->diffuse*value;
-				L->indirect_glossy = bsdf_eval->glossy*value;
-				L->indirect_transmission = bsdf_eval->transmission*value;
+			L->indirect_diffuse = bsdf_eval->diffuse*value;
+			L->indirect_glossy = bsdf_eval->glossy*value;
+			L->indirect_transmission = bsdf_eval->transmission*value;
 
-				*throughput = L->indirect_diffuse + L->indirect_glossy + L->indirect_transmission;
-				
-				L->direct_throughput = *throughput;
-			}
+			*throughput = L->indirect_diffuse + L->indirect_glossy + L->indirect_transmission;
+			
+			L->direct_throughput = *throughput;
 		}
 		else {
-			/* indirectly visible through BSDF */
+			/* transparent bounce before first hit, or indirectly visible through BSDF */
 			float3 sum = (bsdf_eval->diffuse + bsdf_eval->glossy + bsdf_eval->transmission + bsdf_eval->transparent)*inverse_pdf;
 			*throughput *= sum;
 		}
@@ -199,26 +195,56 @@ __device_inline void path_radiance_accum_emission(PathRadiance *L, float3 throug
 #endif
 }
 
-__device_inline void path_radiance_accum_light(PathRadiance *L, float3 throughput, BsdfEval *bsdf_eval, int bounce)
+__device_inline void path_radiance_accum_ao(PathRadiance *L, float3 throughput, float3 bsdf, float3 ao, int bounce)
 {
 #ifdef __PASSES__
 	if(L->use_light_pass) {
 		if(bounce == 0) {
 			/* directly visible lighting */
-			L->direct_diffuse += throughput*bsdf_eval->diffuse;
-			L->direct_glossy += throughput*bsdf_eval->glossy;
-			L->direct_transmission += throughput*bsdf_eval->transmission;
+			L->direct_diffuse += throughput*bsdf*ao;
+			L->ao += throughput*ao;
+		}
+		else {
+			/* indirectly visible lighting after BSDF bounce */
+			L->indirect += throughput*bsdf*ao;
+		}
+	}
+	else
+		L->emission += throughput*bsdf*ao;
+#else
+	*L += throughput*bsdf*ao;
+#endif
+}
+
+__device_inline void path_radiance_accum_light(PathRadiance *L, float3 throughput, BsdfEval *bsdf_eval, float3 shadow, int bounce, bool is_lamp)
+{
+#ifdef __PASSES__
+	if(L->use_light_pass) {
+		if(bounce == 0) {
+			/* directly visible lighting */
+			L->direct_diffuse += throughput*bsdf_eval->diffuse*shadow;
+			L->direct_glossy += throughput*bsdf_eval->glossy*shadow;
+			L->direct_transmission += throughput*bsdf_eval->transmission*shadow;
+
+			if(is_lamp) {
+				float3 sum = throughput*(bsdf_eval->diffuse + bsdf_eval->glossy + bsdf_eval->transmission);
+
+				L->shadow.x += shadow.x;
+				L->shadow.y += shadow.y;
+				L->shadow.z += shadow.z;
+				L->shadow.w += average(sum);
+			}
 		}
 		else {
 			/* indirectly visible lighting after BSDF bounce */
 			float3 sum = bsdf_eval->diffuse + bsdf_eval->glossy + bsdf_eval->transmission;
-			L->indirect += throughput*sum;
+			L->indirect += throughput*sum*shadow;
 		}
 	}
 	else
-		L->emission += throughput*bsdf_eval->diffuse;
+		L->emission += throughput*bsdf_eval->diffuse*shadow;
 #else
-	*L += throughput*(*bsdf_eval);
+	*L += throughput*(*bsdf_eval)*shadow;
 #endif
 }
 
@@ -240,17 +266,6 @@ __device_inline void path_radiance_accum_background(PathRadiance *L, float3 thro
 #endif
 }
 
-__device_inline float3 safe_divide_color(float3 a, float3 b)
-{
-	float x, y, z;
-
-	x = (b.x != 0.0f)? a.x/b.x: 0.0f;
-	y = (b.y != 0.0f)? a.y/b.y: 0.0f;
-	z = (b.z != 0.0f)? a.z/b.z: 0.0f;
-
-	return make_float3(x, y, z);
-}
-
 __device_inline float3 path_radiance_sum(PathRadiance *L)
 {
 #ifdef __PASSES__
@@ -279,5 +294,49 @@ __device_inline float3 path_radiance_sum(PathRadiance *L)
 #endif
 }
 
+__device_inline void path_radiance_clamp(PathRadiance *L, float3 *L_sum, float clamp)
+{
+	float sum = fabsf((*L_sum).x) + fabsf((*L_sum).y) + fabsf((*L_sum).z);
+
+	if(!isfinite(sum)) {
+		/* invalid value, reject */
+		*L_sum = make_float3(0.0f, 0.0f, 0.0f);
+
+#ifdef __PASSES__
+		if(L->use_light_pass) {
+			L->direct_diffuse = make_float3(0.0f, 0.0f, 0.0f);
+			L->direct_glossy = make_float3(0.0f, 0.0f, 0.0f);
+			L->direct_transmission = make_float3(0.0f, 0.0f, 0.0f);
+
+			L->indirect_diffuse = make_float3(0.0f, 0.0f, 0.0f);
+			L->indirect_glossy = make_float3(0.0f, 0.0f, 0.0f);
+			L->indirect_transmission = make_float3(0.0f, 0.0f, 0.0f);
+
+			L->emission = make_float3(0.0f, 0.0f, 0.0f);
+		}
+#endif
+	}
+	else if(sum > clamp) {
+		/* value to high, scale down */
+		float scale = clamp/sum;
+
+		*L_sum *= scale;
+
+#ifdef __PASSES__
+		if(L->use_light_pass) {
+			L->direct_diffuse *= scale;
+			L->direct_glossy *= scale;
+			L->direct_transmission *= scale;
+
+			L->indirect_diffuse *= scale;
+			L->indirect_glossy *= scale;
+			L->indirect_transmission *= scale;
+
+			L->emission *= scale;
+		}
+#endif
+	}
+}
+
 CCL_NAMESPACE_END
 
diff --git a/intern/cycles/kernel/kernel_bvh.h b/intern/cycles/kernel/kernel_bvh.h
index 35215fd..523ae8a 100644
--- a/intern/cycles/kernel/kernel_bvh.h
+++ b/intern/cycles/kernel/kernel_bvh.h
@@ -59,7 +59,7 @@ __device_inline void bvh_instance_push(KernelGlobals *kg, int object, const Ray
 {
 	Transform tfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM);
 
-	*P = transform(&tfm, ray->P);
+	*P = transform_point(&tfm, ray->P);
 
 	float3 dir = transform_direction(&tfm, ray->D);
 
@@ -351,7 +351,7 @@ __device_inline float3 bvh_triangle_refine(KernelGlobals *kg, const Intersection
 	if(isect->object != ~0) {
 		Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_INVERSE_TRANSFORM);
 
-		P = transform(&tfm, P);
+		P = transform_point(&tfm, P);
 		D = transform_direction(&tfm, D*t);
 		D = normalize_len(D, &t);
 	}
@@ -367,7 +367,7 @@ __device_inline float3 bvh_triangle_refine(KernelGlobals *kg, const Intersection
 
 	if(isect->object != ~0) {
 		Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_TRANSFORM);
-		P = transform(&tfm, P);
+		P = transform_point(&tfm, P);
 	}
 
 	return P;
diff --git a/intern/cycles/kernel/kernel_camera.h b/intern/cycles/kernel/kernel_camera.h
index 2dbdd07..58c4822 100644
--- a/intern/cycles/kernel/kernel_camera.h
+++ b/intern/cycles/kernel/kernel_camera.h
@@ -39,7 +39,7 @@ __device void camera_sample_perspective(KernelGlobals *kg, float raster_x, float
 {
 	/* create ray form raster position */
 	Transform rastertocamera = kernel_data.cam.rastertocamera;
-	float3 Pcamera = transform(&rastertocamera, make_float3(raster_x, raster_y, 0.0f));
+	float3 Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f));
 
 	ray->P = make_float3(0.0f, 0.0f, 0.0f);
 	ray->D = Pcamera;
@@ -63,7 +63,7 @@ __device void camera_sample_perspective(KernelGlobals *kg, float raster_x, float
 	/* transform ray from camera to world */
 	Transform cameratoworld = kernel_data.cam.cameratoworld;
 
-	ray->P = transform(&cameratoworld, ray->P);
+	ray->P = transform_point(&cameratoworld, ray->P);
 	ray->D = transform_direction(&cameratoworld, ray->D);
 	ray->D = normalize(ray->D);
 
@@ -93,7 +93,7 @@ __device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, floa
 {
 	/* create ray form raster position */
 	Transform rastertocamera = kernel_data.cam.rastertocamera;
-	float3 Pcamera = transform(&rastertocamera, make_float3(raster_x, raster_y, 0.0f));
+	float3 Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f));
 
 	ray->P = Pcamera;
 	ray->D = make_float3(0.0f, 0.0f, 1.0f);
@@ -101,7 +101,7 @@ __device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, floa
 	/* transform ray from camera to world */
 	Transform cameratoworld = kernel_data.cam.cameratoworld;
 
-	ray->P = transform(&cameratoworld, ray->P);
+	ray->P = transform_point(&cameratoworld, ray->P);
 	ray->D = transform_direction(&cameratoworld, ray->D);
 	ray->D = normalize(ray->D);
 
@@ -122,6 +122,44 @@ __device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, floa
 #endif
 }
 
+/* Environment Camera */
+
+__device void camera_sample_environment(KernelGlobals *kg, float raster_x, float raster_y, Ray *ray)
+{
+	Transform rastertocamera = kernel_data.cam.rastertocamera;
+	float3 Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f));
+
+	/* create ray form raster position */
+	ray->P = make_float3(0.0, 0.0f, 0.0f);
+	ray->D = equirectangular_to_direction(Pcamera.x, Pcamera.y);
+
+	/* transform ray from camera to world */
+	Transform cameratoworld = kernel_data.cam.cameratoworld;
+
+	ray->P = transform_point(&cameratoworld, ray->P);
+	ray->D = transform_direction(&cameratoworld, ray->D);
+	ray->D = normalize(ray->D);
+
+#ifdef __RAY_DIFFERENTIALS__
+	/* ray differential */
+	ray->dP.dx = make_float3(0.0f, 0.0f, 0.0f);
+	ray->dP.dy = make_float3(0.0f, 0.0f, 0.0f);
+
+	Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x + 1.0f, raster_y, 0.0f));
+	ray->dD.dx = normalize(transform_direction(&cameratoworld, equirectangular_to_direction(Pcamera.x, Pcamera.y))) - ray->D;
+
+	Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y + 1.0f, 0.0f));
+	ray->dD.dy = normalize(transform_direction(&cameratoworld, equirectangular_to_direction(Pcamera.x, Pcamera.y))) - ray->D;
+#endif
+
+#ifdef __CAMERA_CLIPPING__
+	/* clipping */
+	ray->t = kernel_data.cam.cliplength;
+#else
+	ray->t = FLT_MAX;
+#endif
+}
+
 /* Common */
 
 __device void camera_sample(KernelGlobals *kg, int x, int y, float filter_u, float filter_v, float lens_u, float lens_v, Ray *ray)
@@ -134,10 +172,12 @@ __device void camera_sample(KernelGlobals *kg, int x, int y, float filter_u, flo
 	//ray->time = lerp(time_t, kernel_data.cam.shutter_open, kernel_data.cam.shutter_close);
 
 	/* sample */
-	if(kernel_data.cam.ortho)
+	if(kernel_data.cam.type == CAMERA_PERSPECTIVE)
+		camera_sample_perspective(kg, raster_x, raster_y, lens_u, lens_v, ray);
+	else if(kernel_data.cam.type == CAMERA_ORTHOGRAPHIC)
 		camera_sample_orthographic(kg, raster_x, raster_y, ray);
 	else
-		camera_sample_perspective(kg, raster_x, raster_y, lens_u, lens_v, ray);
+		camera_sample_environment(kg, raster_x, raster_y, ray);
 }
 
 CCL_NAMESPACE_END
diff --git a/intern/cycles/kernel/kernel_displace.h b/intern/cycles/kernel/kernel_displace.h
index 7366689..f4b3360 100644
--- a/intern/cycles/kernel/kernel_displace.h
+++ b/intern/cycles/kernel/kernel_displace.h
@@ -41,9 +41,11 @@ __device void kernel_shader_evaluate(KernelGlobals *kg, uint4 *input, float4 *ou
 	else { // SHADER_EVAL_BACKGROUND
 		/* setup ray */
 		Ray ray;
+		float u = __int_as_float(in.x);
+		float v = __int_as_float(in.y);
 
 		ray.P = make_float3(0.0f, 0.0f, 0.0f);
-		ray.D = make_float3(__int_as_float(in.x), __int_as_float(in.y), __int_as_float(in.z));
+		ray.D = equirectangular_to_direction(u, v);
 		ray.t = 0.0f;
 
 #ifdef __RAY_DIFFERENTIALS__
diff --git a/intern/cycles/kernel/kernel_emission.h b/intern/cycles/kernel/kernel_emission.h
index 2243858..764ac59 100644
--- a/intern/cycles/kernel/kernel_emission.h
+++ b/intern/cycles/kernel/kernel_emission.h
@@ -60,7 +60,8 @@ __device float3 direct_emissive_eval(KernelGlobals *kg, float rando,
 }
 
 __device bool direct_emission(KernelGlobals *kg, ShaderData *sd, int lindex,
-	float randt, float rando, float randu, float randv, Ray *ray, BsdfEval *eval)
+	float randt, float rando, float randu, float randv, Ray *ray, BsdfEval *eval,
+	bool *is_lamp)
 {
 	LightSample ls;
 
@@ -135,6 +136,8 @@ __device bool direct_emission(KernelGlobals *kg, ShaderData *sd, int lindex,
 		ray->t = 0.0f;
 	}
 
+	*is_lamp = (ls.prim == ~0);
+
 	return true;
 }
 
diff --git a/intern/cycles/kernel/kernel_light.h b/intern/cycles/kernel/kernel_light.h
index aa12518..4226057 100644
--- a/intern/cycles/kernel/kernel_light.h
+++ b/intern/cycles/kernel/kernel_light.h
@@ -120,13 +120,9 @@ __device float3 background_light_sample(KernelGlobals *kg, float randu, float ra
 	float du = (randu - cdf_u.y) / (cdf_next_u.y - cdf_u.y);
 	float u = (index_u + du) / res;
 
-	/* spherical coordinates */
-	float theta = v * M_PI_F;
-	float phi = u * M_PI_F * 2.0f;
-
 	/* compute pdf */
 	float denom = cdf_last_u.x * cdf_last_v.x;
-	float sin_theta = sinf(theta);
+	float sin_theta = sinf(M_PI_F * v);
 
 	if(sin_theta == 0.0f || denom == 0.0f)
 		*pdf = 0.0f;
@@ -136,7 +132,7 @@ __device float3 background_light_sample(KernelGlobals *kg, float randu, float ra
 	*pdf *= kernel_data.integrator.pdf_lights;
 
 	/* compute direction */
-	return spherical_to_direction(theta, phi);
+	return -equirectangular_to_direction(u, v);
 }
 
 __device float background_light_pdf(KernelGlobals *kg, float3 direction)
diff --git a/intern/cycles/kernel/kernel_mbvh.h b/intern/cycles/kernel/kernel_mbvh.h
index 3995e78..ccbd3d0 100644
--- a/intern/cycles/kernel/kernel_mbvh.h
+++ b/intern/cycles/kernel/kernel_mbvh.h
@@ -61,7 +61,7 @@ __device void mbvh_instance_push(KernelGlobals *kg, int object, MBVHRay *ray)
 {
 	Transform tfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM);
 
-	ray->P = transform(&tfm, ray->origP);
+	ray->P = transform_point(&tfm, ray->origP);
 
 	float3 dir = ray->origD;
 
diff --git a/intern/cycles/kernel/kernel_montecarlo.h b/intern/cycles/kernel/kernel_montecarlo.h
index 9776baf..68f007c 100644
--- a/intern/cycles/kernel/kernel_montecarlo.h
+++ b/intern/cycles/kernel/kernel_montecarlo.h
@@ -185,7 +185,7 @@ __device float2 regular_polygon_sample(float corners, float rotation, float u, f
 	return make_float2(cr*p.x - sr*p.y, sr*p.x + cr*p.y);
 }
 
-/* Spherical coordinates <-> Cartesion direction  */
+/* Spherical coordinates <-> Cartesian direction  */
 
 __device float2 direction_to_spherical(float3 dir)
 {
@@ -203,11 +203,11 @@ __device float3 spherical_to_direction(float theta, float phi)
 		cosf(theta));
 }
 
-/* Equirectangular */
+/* Equirectangular coordinates <-> Cartesian direction */
 
 __device float2 direction_to_equirectangular(float3 dir)
 {
-	float u = (atan2f(dir.y, dir.x) + M_PI_F)/(2.0f*M_PI_F);
+	float u = -atan2f(dir.y, dir.x)/(2.0f*M_PI_F) + 0.5f;
 	float v = atan2f(dir.z, hypotf(dir.x, dir.y))/M_PI_F + 0.5f;
 
 	return make_float2(u, v);
@@ -215,9 +215,8 @@ __device float2 direction_to_equirectangular(float3 dir)
 
 __device float3 equirectangular_to_direction(float u, float v)
 {
-	/* XXX check correctness? */
-	float theta = M_PI_F*v;
-	float phi = 2.0f*M_PI_F*u;
+	float phi = M_PI_F*(1.0f - 2.0f*u);
+	float theta = M_PI_F*(1.0f - v);
 
 	return make_float3(
 		sin(theta)*cos(phi),
@@ -225,6 +224,38 @@ __device float3 equirectangular_to_direction(float u, float v)
 		cos(theta));
 }
 
+/* Mirror Ball <-> Cartesion direction */
+
+__device float3 mirrorball_to_direction(float u, float v)
+{
+	/* point on sphere */
+	float3 dir;
+
+	dir.x = 2.0f*u - 1.0f;
+	dir.z = 2.0f*v - 1.0f;
+	dir.y = -sqrt(max(1.0f - dir.x*dir.x - dir.z*dir.z, 0.0f));
+
+	/* reflection */
+	float3 I = make_float3(0.0f, -1.0f, 0.0f);
+
+	return 2.0f*dot(dir, I)*dir - I;
+}
+
+__device float2 direction_to_mirrorball(float3 dir)
+{
+	/* inverse of mirrorball_to_direction */
+	dir.y -= 1.0f;
+
+	float div = 2.0f*sqrt(max(-0.5f*dir.y, 0.0f));
+	if(div > 0.0f)
+		dir /= div;
+
+	float u = 0.5f*(dir.x + 1.0f);
+	float v = 0.5f*(dir.z + 1.0f);
+
+	return make_float2(u, v);
+}
+
 CCL_NAMESPACE_END
 
 #endif /* __KERNEL_MONTECARLO_CL__ */
diff --git a/intern/cycles/kernel/kernel_object.h b/intern/cycles/kernel/kernel_object.h
index 318a6fe..b676f58 100644
--- a/intern/cycles/kernel/kernel_object.h
+++ b/intern/cycles/kernel/kernel_object.h
@@ -42,7 +42,7 @@ __device_inline Transform object_fetch_transform(KernelGlobals *kg, int object,
 __device_inline void object_position_transform(KernelGlobals *kg, int object, float3 *P)
 {
 	Transform tfm = object_fetch_transform(kg, object, OBJECT_TRANSFORM);
-	*P = transform(&tfm, *P);
+	*P = transform_point(&tfm, *P);
 }
 
 __device_inline void object_normal_transform(KernelGlobals *kg, int object, float3 *N)
diff --git a/intern/cycles/kernel/kernel_passes.h b/intern/cycles/kernel/kernel_passes.h
index a1b3b0e..fd4ee17 100644
--- a/intern/cycles/kernel/kernel_passes.h
+++ b/intern/cycles/kernel/kernel_passes.h
@@ -53,7 +53,7 @@ __device_inline void kernel_write_data_passes(KernelGlobals *kg, __global float
 		if(sample == 0) {
 			if(flag & PASS_DEPTH) {
 				Transform tfm = kernel_data.cam.worldtocamera;
-				float depth = len(transform(&tfm, sd->P));
+				float depth = len(transform_point(&tfm, sd->P));
 
 				kernel_write_pass_float(buffer + kernel_data.film.pass_depth, sample, depth);
 			}
@@ -94,35 +94,25 @@ __device_inline void kernel_write_light_passes(KernelGlobals *kg, __global float
 	if(!kernel_data.film.use_light_pass)
 		return;
 	
-	if(flag & PASS_DIFFUSE_INDIRECT) {
-		float3 color = safe_divide_color(L->indirect_diffuse, L->color_diffuse);
-		kernel_write_pass_float3(buffer + kernel_data.film.pass_diffuse_indirect, sample, color);
-	}
-	if(flag & PASS_GLOSSY_INDIRECT) {
-		float3 color = safe_divide_color(L->indirect_glossy, L->color_glossy);
-		kernel_write_pass_float3(buffer + kernel_data.film.pass_glossy_indirect, sample, color);
-	}
-	if(flag & PASS_TRANSMISSION_INDIRECT) {
-		float3 color = safe_divide_color(L->indirect_transmission, L->color_transmission);
-		kernel_write_pass_float3(buffer + kernel_data.film.pass_transmission_indirect, sample, color);
-	}
-	if(flag & PASS_DIFFUSE_DIRECT) {
-		float3 color = safe_divide_color(L->direct_diffuse, L->color_diffuse);
-		kernel_write_pass_float3(buffer + kernel_data.film.pass_diffuse_direct, sample, color);
-	}
-	if(flag & PASS_GLOSSY_DIRECT) {
-		float3 color = safe_divide_color(L->direct_glossy, L->color_glossy);
-		kernel_write_pass_float3(buffer + kernel_data.film.pass_glossy_direct, sample, color);
-	}
-	if(flag & PASS_TRANSMISSION_DIRECT) {
-		float3 color = safe_divide_color(L->direct_transmission, L->color_transmission);
-		kernel_write_pass_float3(buffer + kernel_data.film.pass_transmission_direct, sample, color);
-	}
+	if(flag & PASS_DIFFUSE_INDIRECT)
+		kernel_write_pass_float3(buffer + kernel_data.film.pass_diffuse_indirect, sample, L->indirect_diffuse);
+	if(flag & PASS_GLOSSY_INDIRECT)
+		kernel_write_pass_float3(buffer + kernel_data.film.pass_glossy_indirect, sample, L->indirect_glossy);
+	if(flag & PASS_TRANSMISSION_INDIRECT)
+		kernel_write_pass_float3(buffer + kernel_data.film.pass_transmission_indirect, sample, L->indirect_transmission);
+	if(flag & PASS_DIFFUSE_DIRECT)
+		kernel_write_pass_float3(buffer + kernel_data.film.pass_diffuse_direct, sample, L->direct_diffuse);
+	if(flag & PASS_GLOSSY_DIRECT)
+		kernel_write_pass_float3(buffer + kernel_data.film.pass_glossy_direct, sample, L->direct_glossy);
+	if(flag & PASS_TRANSMISSION_DIRECT)
+		kernel_write_pass_float3(buffer + kernel_data.film.pass_transmission_direct, sample, L->direct_transmission);
 
 	if(flag & PASS_EMISSION)
 		kernel_write_pass_float3(buffer + kernel_data.film.pass_emission, sample, L->emission);
 	if(flag & PASS_BACKGROUND)
 		kernel_write_pass_float3(buffer + kernel_data.film.pass_background, sample, L->background);
+	if(flag & PASS_AO)
+		kernel_write_pass_float3(buffer + kernel_data.film.pass_ao, sample, L->ao);
 
 	if(flag & PASS_DIFFUSE_COLOR)
 		kernel_write_pass_float3(buffer + kernel_data.film.pass_diffuse_color, sample, L->color_diffuse);
@@ -130,6 +120,8 @@ __device_inline void kernel_write_light_passes(KernelGlobals *kg, __global float
 		kernel_write_pass_float3(buffer + kernel_data.film.pass_glossy_color, sample, L->color_glossy);
 	if(flag & PASS_TRANSMISSION_COLOR)
 		kernel_write_pass_float3(buffer + kernel_data.film.pass_transmission_color, sample, L->color_transmission);
+	if(flag & PASS_SHADOW)
+		kernel_write_pass_float4(buffer + kernel_data.film.pass_shadow, sample, L->shadow);
 #endif
 }
 
diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h
index 05ee321..ff12e85 100644
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@ -145,12 +145,15 @@ __device_inline float path_state_terminate_probability(KernelGlobals *kg, PathSt
 	return average(throughput);
 }
 
-__device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray *ray, Intersection *isect, BsdfEval *L_light)
+__device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray *ray, float3 *shadow)
 {
+	*shadow = make_float3(1.0f, 1.0f, 1.0f);
+
 	if(ray->t == 0.0f)
 		return false;
 	
-	bool result = scene_intersect(kg, ray, PATH_RAY_SHADOW_OPAQUE, isect);
+	Intersection isect;
+	bool result = scene_intersect(kg, ray, PATH_RAY_SHADOW_OPAQUE, &isect);
 
 #ifdef __TRANSPARENT_SHADOWS__
 	if(result && kernel_data.integrator.transparent_shadows) {
@@ -162,7 +165,7 @@ __device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray *ra
 		   
 		   also note that for this to work correct, multi close sampling must
 		   be used, since we don't pass a random number to shader_eval_surface */
-		if(shader_transparent_shadow(kg, isect)) {
+		if(shader_transparent_shadow(kg, &isect)) {
 			float3 throughput = make_float3(1.0f, 1.0f, 1.0f);
 			float3 Pend = ray->P + ray->D*ray->t;
 			int bounce = state->transparent_bounce;
@@ -184,16 +187,16 @@ __device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray *ra
 #endif
 				}
 
-				if(!scene_intersect(kg, ray, PATH_RAY_SHADOW_TRANSPARENT, isect)) {
-					bsdf_eval_mul(L_light, throughput);
+				if(!scene_intersect(kg, ray, PATH_RAY_SHADOW_TRANSPARENT, &isect)) {
+					*shadow *= throughput;
 					return false;
 				}
 
-				if(!shader_transparent_shadow(kg, isect))
+				if(!shader_transparent_shadow(kg, &isect))
 					return true;
 
 				ShaderData sd;
-				shader_setup_from_ray(kg, &sd, isect, ray);
+				shader_setup_from_ray(kg, &sd, &isect, ray);
 				shader_eval_surface(kg, &sd, 0.0f, PATH_RAY_SHADOW);
 
 				throughput *= shader_bsdf_transparency(kg, &sd);
@@ -285,6 +288,34 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, R
 
 		throughput /= probability;
 
+#ifdef __AO__
+		/* ambient occlusion */
+		if(kernel_data.integrator.use_ambient_occlusion) {
+			/* 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);
+
+			float3 ao_D;
+			float ao_pdf;
+
+			sample_cos_hemisphere(sd.N, bsdf_u, bsdf_v, &ao_D, &ao_pdf);
+
+			if(dot(sd.Ng, ao_D) > 0.0f && ao_pdf != 0.0f) {
+				Ray light_ray;
+				float3 ao_shadow;
+
+				light_ray.P = ray_offset(sd.P, sd.Ng);
+				light_ray.D = ao_D;
+				light_ray.t = kernel_data.background.ao_distance;
+
+				if(!shadow_blocked(kg, &state, &light_ray, &ao_shadow)) {
+					float3 ao_bsdf = shader_bsdf_diffuse(kg, &sd)*kernel_data.background.ao_factor;
+					path_radiance_accum_ao(&L, throughput, ao_bsdf, ao_shadow, state.bounce);
+				}
+			}
+		}
+#endif
+
 #ifdef __EMISSION__
 		if(kernel_data.integrator.use_direct_light) {
 			/* sample illumination from lights to find path contribution */
@@ -296,6 +327,7 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, R
 
 				Ray light_ray;
 				BsdfEval L_light;
+				bool is_lamp;
 
 #ifdef __MULTI_LIGHT__
 				/* index -1 means randomly sample from distribution */
@@ -305,10 +337,14 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, R
 #else
 				const int i = -1;
 #endif
-					if(direct_emission(kg, &sd, i, light_t, light_o, light_u, light_v, &light_ray, &L_light)) {
+					if(direct_emission(kg, &sd, i, light_t, light_o, light_u, light_v, &light_ray, &L_light, &is_lamp)) {
 						/* trace shadow ray */
-						if(!shadow_blocked(kg, &state, &light_ray, &isect, &L_light))
-							path_radiance_accum_light(&L, throughput, &L_light, state.bounce);
+						float3 shadow;
+
+						if(!shadow_blocked(kg, &state, &light_ray, &shadow)) {
+							/* accumulate */
+							path_radiance_accum_light(&L, throughput, &L_light, shadow, state.bounce, is_lamp);
+						}
 					}
 #ifdef __MULTI_LIGHT__
 				}
@@ -360,6 +396,10 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, R
 
 	float3 L_sum = path_radiance_sum(&L);
 
+#ifdef __CLAMP_SAMPLE__
+	path_radiance_clamp(&L, &L_sum, kernel_data.integrator.sample_clamp);
+#endif
+
 	kernel_write_light_passes(kg, buffer, &L, sample);
 
 	return make_float4(L_sum.x, L_sum.y, L_sum.z, 1.0f - L_transparent);
diff --git a/intern/cycles/kernel/kernel_qbvh.h b/intern/cycles/kernel/kernel_qbvh.h
index 96e68d7..525b616 100644
--- a/intern/cycles/kernel/kernel_qbvh.h
+++ b/intern/cycles/kernel/kernel_qbvh.h
@@ -50,7 +50,7 @@ __device_inline void qbvh_instance_push(KernelGlobals *kg, int object, const Ray
 {
 	Transform tfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM);
 
-	*P = transform(&tfm, ray->P);
+	*P = transform_point(&tfm, ray->P);
 
 	float3 dir = transform_direction(&tfm, ray->D);
 
@@ -384,7 +384,7 @@ __device_inline float3 bvh_triangle_refine(KernelGlobals *kg, const Intersection
 	if(isect->object != ~0) {
 		Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_INVERSE_TRANSFORM);
 
-		P = transform(&tfm, P);
+		P = transform_point(&tfm, P);
 		D = transform_direction(&tfm, D*t);
 		D = normalize_len(D, &t);
 	}
@@ -400,7 +400,7 @@ __device_inline float3 bvh_triangle_refine(KernelGlobals *kg, const Intersection
 
 	if(isect->object != ~0) {
 		Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_TRANSFORM);
-		P = transform(&tfm, P);
+		P = transform_point(&tfm, P);
 	}
 
 	return P;
diff --git a/intern/cycles/kernel/kernel_textures.h b/intern/cycles/kernel/kernel_textures.h
index ca7ae43..8bab735 100644
--- a/intern/cycles/kernel/kernel_textures.h
+++ b/intern/cycles/kernel/kernel_textures.h
@@ -142,11 +142,13 @@ KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_091)
 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_092)
 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_093)
 KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_094)
-KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_095)
-KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_096)
-KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_097)
-KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_098)
-KERNEL_IMAGE_TEX(uchar4, texture_image_uchar4, __tex_image_099)
+
+/* full-float image */
+KERNEL_IMAGE_TEX(float4, texture_image_float4, __tex_image_float_095)
+KERNEL_IMAGE_TEX(float4, texture_image_float4, __tex_image_float_096)
+KERNEL_IMAGE_TEX(float4, texture_image_float4, __tex_image_float_097)
+KERNEL_IMAGE_TEX(float4, texture_image_float4, __tex_image_float_098)
+KERNEL_IMAGE_TEX(float4, texture_image_float4, __tex_image_float_099)
 
 #undef KERNEL_TEX
 #undef KERNEL_IMAGE_TEX
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index 0063528..391dcd1 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -29,6 +29,7 @@ CCL_NAMESPACE_BEGIN
 #define OBJECT_SIZE 		16
 #define LIGHT_SIZE			4
 #define FILTER_TABLE_SIZE	256
+#define RAMP_TABLE_SIZE		256
 
 /* device capabilities */
 #ifdef __KERNEL_CPU__
@@ -59,6 +60,7 @@ CCL_NAMESPACE_BEGIN
 #define __RAY_DIFFERENTIALS__
 #define __CAMERA_CLIPPING__
 #define __INTERSECTION_REFINE__
+#define __CLAMP_SAMPLE__
 
 #ifdef __KERNEL_SHADING__
 #define __SVM__
@@ -72,6 +74,7 @@ CCL_NAMESPACE_BEGIN
 #define __TRANSPARENT_SHADOWS__
 #define __PASSES__
 #define __BACKGROUND_MIS__
+#define __AO__
 #endif
 
 //#define __MULTI_LIGHT__
@@ -172,7 +175,9 @@ typedef enum PassType {
 	PASS_GLOSSY_DIRECT = 16384,
 	PASS_TRANSMISSION_DIRECT = 32768,
 	PASS_EMISSION = 65536,
-	PASS_BACKGROUND = 131072
+	PASS_BACKGROUND = 131072,
+	PASS_AO = 262144,
+	PASS_SHADOW = 524288
 } PassType;
 
 #define PASS_ALL (~0)
@@ -181,11 +186,12 @@ typedef enum PassType {
 
 typedef float3 PathThroughput;
 
-struct PathRadiance {
+typedef struct PathRadiance {
 	int use_light_pass;
 
 	float3 emission;
 	float3 background;
+	float3 ao;
 
 	float3 indirect;
 	float3 direct_throughput;
@@ -202,16 +208,18 @@ struct PathRadiance {
 	float3 indirect_diffuse;
 	float3 indirect_glossy;
 	float3 indirect_transmission;
-};
 
-struct BsdfEval {
+	float4 shadow;
+} PathRadiance;
+
+typedef struct BsdfEval {
 	int use_light_pass;
 
 	float3 diffuse;
 	float3 glossy;
 	float3 transmission;
 	float3 transparent;
-};
+} BsdfEval;
 
 #else
 
@@ -237,9 +245,18 @@ typedef enum LightType {
 	LIGHT_POINT,
 	LIGHT_DISTANT,
 	LIGHT_BACKGROUND,
-	LIGHT_AREA
+	LIGHT_AREA,
+	LIGHT_AO
 } LightType;
 
+/* Camera Type */
+
+enum CameraType {
+	CAMERA_PERSPECTIVE,
+	CAMERA_ORTHOGRAPHIC,
+	CAMERA_ENVIRONMENT
+};
+
 /* Differential */
 
 typedef struct differential3 {
@@ -387,7 +404,7 @@ typedef struct ShaderData {
 
 typedef struct KernelCamera {
 	/* type */
-	int ortho;
+	int type;
 	int pad1, pad2, pad3;
 
 	/* matrices */
@@ -450,15 +467,18 @@ typedef struct KernelFilm {
 
 	int pass_emission;
 	int pass_background;
-	int pass_pad1;
-	int pass_pad2;
+	int pass_ao;
+	int pass_shadow;
 } KernelFilm;
 
 typedef struct KernelBackground {
 	/* only shader index */
 	int shader;
 	int transparent;
-	int pad1, pad2;
+
+	/* ambient occlusion */
+	float ao_factor;
+	float ao_distance;
 } KernelBackground;
 
 typedef struct KernelSunSky {
@@ -474,6 +494,7 @@ typedef struct KernelSunSky {
 typedef struct KernelIntegrator {
 	/* emission */
 	int use_direct_light;
+	int use_ambient_occlusion;
 	int num_distribution;
 	int num_all_lights;
 	float pdf_triangles;
@@ -501,7 +522,12 @@ typedef struct KernelIntegrator {
 
 	/* render layer */
 	int layer_flag;
-	int pad1, pad2, pad3;
+
+	/* clamp */
+	float sample_clamp;
+
+	/* padding */
+	int pad;
 } KernelIntegrator;
 
 typedef struct KernelBVH {
diff --git a/intern/cycles/kernel/osl/nodes/node_texture.h b/intern/cycles/kernel/osl/nodes/node_texture.h
index 8adb0e8..e0ec803 100644
--- a/intern/cycles/kernel/osl/nodes/node_texture.h
+++ b/intern/cycles/kernel/osl/nodes/node_texture.h
@@ -190,7 +190,7 @@ float noise_wave(string wave, float a)
 	float result = 0.0;
 
 	if(wave == "Sine") {
-    	result = 0.5 + 0.5*sin(a);
+		result = 0.5 + 0.5*sin(a);
 	}
 	else if(wave == "Saw") {
 		float b = 2*M_PI;
diff --git a/intern/cycles/kernel/osl/osl_services.h b/intern/cycles/kernel/osl/osl_services.h
index e500307..85a01e5 100644
--- a/intern/cycles/kernel/osl/osl_services.h
+++ b/intern/cycles/kernel/osl/osl_services.h
@@ -66,7 +66,7 @@ public:
 		void *renderstate, void *val);
 	bool has_userdata(ustring name, TypeDesc type, void *renderstate);
 
- 	void *get_pointcloud_attr_query(ustring *attr_names,
+	void *get_pointcloud_attr_query(ustring *attr_names,
 		TypeDesc *attr_types, int nattrs);
 	int pointcloud(ustring filename, const OSL::Vec3 &center, float radius,
 		int max_points, void *attr_query, void **attr_outdata);
diff --git a/intern/cycles/kernel/svm/bsdf_microfacet.h b/intern/cycles/kernel/svm/bsdf_microfacet.h
index 077b642..8771578 100644
--- a/intern/cycles/kernel/svm/bsdf_microfacet.h
+++ b/intern/cycles/kernel/svm/bsdf_microfacet.h
@@ -43,6 +43,11 @@ typedef struct BsdfMicrofacetGGXClosure {
 	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);
@@ -88,8 +93,8 @@ __device float3 bsdf_microfacet_ggx_eval_reflect(const ShaderData *sd, const Sha
 		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 + sqrtf(1 + alpha2 * (1 - cosNO * cosNO) / (cosNO * cosNO)));
-		float G1i = 2 / (1 + sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI))); 
+		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
@@ -129,8 +134,8 @@ __device float3 bsdf_microfacet_ggx_eval_transmit(const ShaderData *sd, const Sh
 	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 + sqrtf(1 + alpha2 * (1 - cosNO * cosNO) / (cosNO * cosNO)));
-	float G1i = 2 / (1 + sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI))); 
+	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);
@@ -161,8 +166,8 @@ __device int bsdf_microfacet_ggx_sample(const ShaderData *sd, const ShaderClosur
 		//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 / sqrtf(1 + tanThetaM2);
-		float sinThetaM  = cosThetaM * sqrtf(tanThetaM2);
+		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 +
@@ -187,8 +192,8 @@ __device int bsdf_microfacet_ggx_sample(const ShaderData *sd, const ShaderClosur
 					// 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 + sqrtf(1 + alpha2 * (1 - cosNO * cosNO) / (cosNO * cosNO)));
-					float G1i = 2 / (1 + sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI))); 
+					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;
@@ -234,8 +239,8 @@ __device int bsdf_microfacet_ggx_sample(const ShaderData *sd, const ShaderClosur
 				// 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 + sqrtf(1 + alpha2 * (1 - cosNO * cosNO) / (cosNO * cosNO)));
-				float G1i = 2 / (1 + sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI))); 
+				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);
@@ -313,8 +318,8 @@ __device float3 bsdf_microfacet_beckmann_eval_reflect(const ShaderData *sd, cons
 	   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 * sqrtf((1 - cosNO * cosNO) / (cosNO * cosNO)));
-	   float ai = 1 / (m_ab * sqrtf((1 - cosNI * cosNI) / (cosNI * cosNI)));
+	   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;
@@ -356,8 +361,8 @@ __device float3 bsdf_microfacet_beckmann_eval_transmit(const ShaderData *sd, con
 	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 * sqrtf((1 - cosNO * cosNO) / (cosNO * cosNO)));
-	float ai = 1 / (m_ab * sqrtf((1 - cosNI * cosNI) / (cosNI * cosNI)));
+	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;
@@ -389,8 +394,8 @@ __device int bsdf_microfacet_beckmann_sample(const ShaderData *sd, const ShaderC
 		// 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 = sqrtf(-alpha2 * logf(1 - randu));
-		float cosThetaM = 1 / sqrtf(1 + tanThetaM * tanThetaM);
+		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 +
@@ -418,8 +423,8 @@ __device int bsdf_microfacet_beckmann_sample(const ShaderData *sd, const ShaderC
 					// 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 * sqrtf((1 - cosNO * cosNO) / (cosNO * cosNO)));
-					float ai = 1 / (m_ab * sqrtf((1 - cosNI * cosNI) / (cosNI * cosNI)));
+					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;
@@ -469,8 +474,8 @@ __device int bsdf_microfacet_beckmann_sample(const ShaderData *sd, const ShaderC
 				// 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 * sqrtf((1 - cosNO * cosNO) / (cosNO * cosNO)));
-				float ai = 1 / (m_ab * sqrtf((1 - cosNI * cosNI) / (cosNI * cosNI)));
+				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;
diff --git a/intern/cycles/kernel/svm/bsdf_oren_nayar.h b/intern/cycles/kernel/svm/bsdf_oren_nayar.h
index 0ad7cad..a7edccd 100644
--- a/intern/cycles/kernel/svm/bsdf_oren_nayar.h
+++ b/intern/cycles/kernel/svm/bsdf_oren_nayar.h
@@ -16,31 +16,6 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-/*
- *	An implementation of Oren-Nayar reflectance model, public domain
- *		http://www1.cs.columbia.edu/CAVE/publications/pdfs/Oren_SIGGRAPH94.pdf
- *
- *	NOTE:
- *		BSDF = A + B * cos() * sin() * tan()
- *
- *		The parameter sigma means different from original.
- *		A and B are calculated by the following formula:
- *			0 <= sigma <= 1
- *			A =     1 / ((1 + sigma / 2) * pi);
- *			B = sigma / ((1 + sigma / 2) * pi);
- *
- *		This formula is derived as following:
- *
- *		0. Normalize A-term and B-term of BSDF *individually*.
- *		   B-term is normalized at maximum point: dot(L, N) = 0.
- *			A = (1/pi) * A'
- *			B = (2/pi) * B'
- *
- *		1. Solve the following equation:
- *			A' + B' = 1
- *			B / A = sigma
- */
-
 #ifndef __BSDF_OREN_NAYAR_H__
 #define __BSDF_OREN_NAYAR_H__
 
@@ -55,25 +30,11 @@ __device float3 bsdf_oren_nayar_get_intensity(const ShaderClosure *sc, float3 n,
 {
 	float nl = max(dot(n, l), 0.0f);
 	float nv = max(dot(n, v), 0.0f);
+	float t = dot(l, v) - nl * nv;
 
-	float3 al = normalize(l - nl * n);
-	float3 av = normalize(v - nv * n);
-	float t = max(dot(al, av), 0.0f);
-
-	float cos_a, cos_b;
-	if(nl < nv) {
-		cos_a = nl;
-		cos_b = nv;
-	}
-	else {
-		cos_a = nv;
-		cos_b = nl;
-	}
-
-	float sin_a = sqrtf(max(1.0f - cos_a * cos_a, 0.0f));
-	float tan_b = sqrtf(max(1.0f - cos_b * cos_b, 0.0f)) / max(cos_b, 1e-8f);
-
-	float is = nl * (sc->data0 + sc->data1 * t * sin_a * tan_b);
+	if (t > 0.0f)
+		t /= max(nl, nv) + FLT_MIN;
+	float is = nl * (sc->data0 + sc->data1 * t);
 	return make_float3(is, is, is);
 }
 
@@ -84,9 +45,9 @@ __device void bsdf_oren_nayar_setup(ShaderData *sd, ShaderClosure *sc, float sig
 
 	sigma = clamp(sigma, 0.0f, 1.0f);
 
-	float div = 1.0f / ((1.0f + 0.5f * sigma) * M_PI_F);
+	float div = 1.0f / (M_PI_F + ((3.0f * M_PI_F - 4.0f) / 6.0f) * sigma);
 
-	sc->data0 =  1.0f * div;
+	sc->data0 = 1.0f * div;
 	sc->data1 = sigma * div;
 }
 
diff --git a/intern/cycles/kernel/svm/svm.h b/intern/cycles/kernel/svm/svm.h
index f1bae9c..50181c0 100644
--- a/intern/cycles/kernel/svm/svm.h
+++ b/intern/cycles/kernel/svm/svm.h
@@ -104,6 +104,12 @@ __device_inline float4 read_node_float(KernelGlobals *kg, int *offset)
 	return f;
 }
 
+__device_inline float4 fetch_node_float(KernelGlobals *kg, int offset)
+{
+	uint4 node = kernel_tex_fetch(__svm_nodes, offset);
+	return make_float4(__int_as_float(node.x), __int_as_float(node.y), __int_as_float(node.z), __int_as_float(node.w));
+}
+
 __device_inline void decode_node_uchar4(uint i, uint *x, uint *y, uint *z, uint *w)
 {
 	if(x) *x = (i & 0xFF);
@@ -140,6 +146,7 @@ CCL_NAMESPACE_END
 #include "svm_wave.h"
 #include "svm_math.h"
 #include "svm_mix.h"
+#include "svm_ramp.h"
 #include "svm_sepcomb_rgb.h"
 #include "svm_musgrave.h"
 #include "svm_sky.h"
@@ -331,6 +338,12 @@ __device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, ShaderT
 			case NODE_EMISSION_SET_WEIGHT_TOTAL:
 				svm_node_emission_set_weight_total(kg, sd, node.y, node.z, node.w);
 				break;
+			case NODE_RGB_RAMP:
+				svm_node_rgb_ramp(kg, sd, stack, node, &offset);
+				break;
+			case NODE_RGB_CURVES:
+				svm_node_rgb_curves(kg, sd, stack, node, &offset);
+				break;
 			case NODE_END:
 			default:
 #ifndef __MULTI_CLOSURE__
diff --git a/intern/cycles/kernel/svm/svm_camera.h b/intern/cycles/kernel/svm/svm_camera.h
index cf161dd..f13cefb 100644
--- a/intern/cycles/kernel/svm/svm_camera.h
+++ b/intern/cycles/kernel/svm/svm_camera.h
@@ -25,7 +25,7 @@ __device void svm_node_camera(KernelGlobals *kg, ShaderData *sd, float *stack, u
 	float3 vector;
 
 	Transform tfm = kernel_data.cam.worldtocamera;
-	vector = transform(&tfm, sd->P);
+	vector = transform_point(&tfm, sd->P);
 	zdepth = vector.z;
 	distance = len(vector);
 
diff --git a/intern/cycles/kernel/svm/svm_image.h b/intern/cycles/kernel/svm/svm_image.h
index 073021b..eddd0f7 100644
--- a/intern/cycles/kernel/svm/svm_image.h
+++ b/intern/cycles/kernel/svm/svm_image.h
@@ -130,11 +130,11 @@ __device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float y)
 		case 92: r = kernel_tex_image_interp(__tex_image_092, x, y); break;
 		case 93: r = kernel_tex_image_interp(__tex_image_093, x, y); break;
 		case 94: r = kernel_tex_image_interp(__tex_image_094, x, y); break;
-		case 95: r = kernel_tex_image_interp(__tex_image_095, x, y); break;
-		case 96: r = kernel_tex_image_interp(__tex_image_096, x, y); break;
-		case 97: r = kernel_tex_image_interp(__tex_image_097, x, y); break;
-		case 98: r = kernel_tex_image_interp(__tex_image_098, x, y); break;
-		case 99: r = kernel_tex_image_interp(__tex_image_099, x, y); break;
+		case 95: r = kernel_tex_image_interp(__tex_image_float_095, x, y); break;
+		case 96: r = kernel_tex_image_interp(__tex_image_float_096, x, y); break;
+		case 97: r = kernel_tex_image_interp(__tex_image_float_097, x, y); break;
+		case 98: r = kernel_tex_image_interp(__tex_image_float_098, x, y); break;
+		case 99: r = kernel_tex_image_interp(__tex_image_float_099, x, y); break;
 		default: 
 			kernel_assert(0);
 			return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
@@ -171,11 +171,20 @@ __device void svm_node_tex_environment(KernelGlobals *kg, ShaderData *sd, float
 {
 	uint id = node.y;
 	uint co_offset, out_offset, alpha_offset, srgb;
+	uint projection = node.w;
 
 	decode_node_uchar4(node.z, &co_offset, &out_offset, &alpha_offset, &srgb);
 
 	float3 co = stack_load_float3(stack, co_offset);
-	float2 uv = direction_to_equirectangular(co);
+	float2 uv;
+
+	co = normalize(co);
+	
+	if(projection == 0)
+		uv = direction_to_equirectangular(co);
+	else
+		uv = direction_to_mirrorball(co);
+
 	float4 f = svm_image_texture(kg, id, uv.x, uv.y);
 	float3 r = make_float3(f.x, f.y, f.z);
 
diff --git a/intern/cycles/kernel/svm/svm_mapping.h b/intern/cycles/kernel/svm/svm_mapping.h
index 7633c3e..6dc74ae 100644
--- a/intern/cycles/kernel/svm/svm_mapping.h
+++ b/intern/cycles/kernel/svm/svm_mapping.h
@@ -30,7 +30,7 @@ __device void svm_node_mapping(KernelGlobals *kg, ShaderData *sd, float *stack,
 	tfm.z = read_node_float(kg, offset);
 	tfm.w = read_node_float(kg, offset);
 
-	float3 r = transform(&tfm, v);
+	float3 r = transform_point(&tfm, v);
 	stack_store_float3(stack, out_offset, r);
 }
 
diff --git a/intern/cycles/kernel/svm/svm_ramp.h b/intern/cycles/kernel/svm/svm_ramp.h
new file mode 100644
index 0000000..55c2b3f
--- /dev/null
+++ b/intern/cycles/kernel/svm/svm_ramp.h
@@ -0,0 +1,78 @@
+/*
+ * 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 __SVM_RAMP_H__
+#define __SVM_RAMP_H__
+
+CCL_NAMESPACE_BEGIN
+
+__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;
+	float t = f - (float)i;
+
+	float4 a = fetch_node_float(kg, offset+i);
+
+	if(t > 0.0f)
+		a = (1.0f - t)*a + t*fetch_node_float(kg, offset+i+1);
+
+	return a;
+}
+
+__device void svm_node_rgb_ramp(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node, int *offset)
+{
+	uint fac_offset = node.y;
+	uint color_offset = node.z;
+	uint alpha_offset = node.w;
+
+	float fac = stack_load_float(stack, fac_offset);
+	float4 color = rgb_ramp_lookup(kg, *offset, fac);
+
+	if(stack_valid(color_offset))
+		stack_store_float3(stack, color_offset, float4_to_float3(color));
+	if(stack_valid(alpha_offset))
+		stack_store_float(stack, alpha_offset, color.w);
+
+	*offset += RAMP_TABLE_SIZE;
+}
+
+__device void svm_node_rgb_curves(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node, int *offset)
+{
+	uint fac_offset = node.y;
+	uint color_offset = node.z;
+	uint out_offset = node.w;
+
+	float fac = stack_load_float(stack, fac_offset);
+	float3 color = stack_load_float3(stack, color_offset);
+
+	float r = rgb_ramp_lookup(kg, *offset, rgb_ramp_lookup(kg, *offset, color.x).w).x;
+	float g = rgb_ramp_lookup(kg, *offset, rgb_ramp_lookup(kg, *offset, color.y).w).y;
+	float b = rgb_ramp_lookup(kg, *offset, rgb_ramp_lookup(kg, *offset, color.z).w).z;
+
+	color = (1.0f - fac)*color + fac*make_float3(r, g, b);
+	stack_store_float3(stack, out_offset, color);
+
+	*offset += RAMP_TABLE_SIZE;
+}
+
+CCL_NAMESPACE_END
+
+#endif /* __SVM_RAMP_H__ */
+
diff --git a/intern/cycles/kernel/svm/svm_tex_coord.h b/intern/cycles/kernel/svm/svm_tex_coord.h
index bcf3716..f494b6d 100644
--- a/intern/cycles/kernel/svm/svm_tex_coord.h
+++ b/intern/cycles/kernel/svm/svm_tex_coord.h
@@ -34,7 +34,7 @@ __device void svm_node_tex_coord(KernelGlobals *kg, ShaderData *sd, float *stack
 		case NODE_TEXCO_OBJECT: {
 			if(sd->object != ~0) {
 				Transform tfm = object_fetch_transform(kg, sd->object, OBJECT_INVERSE_TRANSFORM);
-				data = transform(&tfm, sd->P);
+				data = transform_point(&tfm, sd->P);
 			}
 			else
 				data = sd->P;
@@ -44,18 +44,18 @@ __device void svm_node_tex_coord(KernelGlobals *kg, ShaderData *sd, float *stack
 			Transform tfm = kernel_data.cam.worldtocamera;
 
 			if(sd->object != ~0)
-				data = transform(&tfm, sd->P);
+				data = transform_point(&tfm, sd->P);
 			else
-				data = transform(&tfm, sd->P + svm_background_offset(kg));
+				data = transform_point(&tfm, sd->P + svm_background_offset(kg));
 			break;
 		}
 		case NODE_TEXCO_WINDOW: {
 			Transform tfm = kernel_data.cam.worldtondc;
 
 			if(sd->object != ~0)
-				data = transform(&tfm, sd->P);
+				data = transform_perspective(&tfm, sd->P);
 			else
-				data = transform(&tfm, sd->P + svm_background_offset(kg));
+				data = transform_perspective(&tfm, sd->P + svm_background_offset(kg));
 			break;
 		}
 		case NODE_TEXCO_REFLECTION: {
@@ -79,7 +79,7 @@ __device void svm_node_tex_coord_bump_dx(KernelGlobals *kg, ShaderData *sd, floa
 		case NODE_TEXCO_OBJECT: {
 			if(sd->object != ~0) {
 				Transform tfm = object_fetch_transform(kg, sd->object, OBJECT_INVERSE_TRANSFORM);
-				data = transform(&tfm, sd->P + sd->dP.dx);
+				data = transform_point(&tfm, sd->P + sd->dP.dx);
 			}
 			else
 				data = sd->P + sd->dP.dx;
@@ -89,18 +89,18 @@ __device void svm_node_tex_coord_bump_dx(KernelGlobals *kg, ShaderData *sd, floa
 			Transform tfm = kernel_data.cam.worldtocamera;
 
 			if(sd->object != ~0)
-				data = transform(&tfm, sd->P + sd->dP.dx);
+				data = transform_point(&tfm, sd->P + sd->dP.dx);
 			else
-				data = transform(&tfm, sd->P + sd->dP.dx + svm_background_offset(kg));
+				data = transform_point(&tfm, sd->P + sd->dP.dx + svm_background_offset(kg));
 			break;
 		}
 		case NODE_TEXCO_WINDOW: {
 			Transform tfm = kernel_data.cam.worldtondc;
 
 			if(sd->object != ~0)
-				data = transform(&tfm, sd->P + sd->dP.dx);
+				data = transform_perspective(&tfm, sd->P + sd->dP.dx);
 			else
-				data = transform(&tfm, sd->P + sd->dP.dx + svm_background_offset(kg));
+				data = transform_perspective(&tfm, sd->P + sd->dP.dx + svm_background_offset(kg));
 			break;
 		}
 		case NODE_TEXCO_REFLECTION: {
@@ -127,7 +127,7 @@ __device void svm_node_tex_coord_bump_dy(KernelGlobals *kg, ShaderData *sd, floa
 		case NODE_TEXCO_OBJECT: {
 			if(sd->object != ~0) {
 				Transform tfm = object_fetch_transform(kg, sd->object, OBJECT_INVERSE_TRANSFORM);
-				data = transform(&tfm, sd->P + sd->dP.dy);
+				data = transform_point(&tfm, sd->P + sd->dP.dy);
 			}
 			else
 				data = sd->P + sd->dP.dy;
@@ -137,18 +137,18 @@ __device void svm_node_tex_coord_bump_dy(KernelGlobals *kg, ShaderData *sd, floa
 			Transform tfm = kernel_data.cam.worldtocamera;
 
 			if(sd->object != ~0)
-				data = transform(&tfm, sd->P + sd->dP.dy);
+				data = transform_point(&tfm, sd->P + sd->dP.dy);
 			else
-				data = transform(&tfm, sd->P + sd->dP.dy + svm_background_offset(kg));
+				data = transform_point(&tfm, sd->P + sd->dP.dy + svm_background_offset(kg));
 			break;
 		}
 		case NODE_TEXCO_WINDOW: {
 			Transform tfm = kernel_data.cam.worldtondc;
 
 			if(sd->object != ~0)
-				data = transform(&tfm, sd->P + sd->dP.dy);
+				data = transform_perspective(&tfm, sd->P + sd->dP.dy);
 			else
-				data = transform(&tfm, sd->P + sd->dP.dy + svm_background_offset(kg));
+				data = transform_perspective(&tfm, sd->P + sd->dP.dy + svm_background_offset(kg));
 			break;
 		}
 		case NODE_TEXCO_REFLECTION: {
diff --git a/intern/cycles/kernel/svm/svm_texture.h b/intern/cycles/kernel/svm/svm_texture.h
index 8279701..448132b 100644
--- a/intern/cycles/kernel/svm/svm_texture.h
+++ b/intern/cycles/kernel/svm/svm_texture.h
@@ -191,7 +191,7 @@ __device float noise_basis_hard(float3 p, NodeNoiseBasis basis, int hard)
 __device float noise_wave(NodeWaveType wave, float a)
 {
 	if(wave == NODE_WAVE_SINE) {
-    	return 0.5f + 0.5f*sin(a);
+		return 0.5f + 0.5f*sin(a);
 	}
 	else if(wave == NODE_WAVE_SAW) {
 		float b = 2.0f*M_PI_F;
diff --git a/intern/cycles/kernel/svm/svm_types.h b/intern/cycles/kernel/svm/svm_types.h
index 533a294..68eb39b 100644
--- a/intern/cycles/kernel/svm/svm_types.h
+++ b/intern/cycles/kernel/svm/svm_types.h
@@ -24,7 +24,7 @@ CCL_NAMESPACE_BEGIN
 /* Stack */
 
 /* SVM stack has a fixed size */
-#define SVM_STACK_SIZE 64
+#define SVM_STACK_SIZE 255
 /* SVM stack offsets with this value indicate that it's not on the stack */
 #define SVM_STACK_INVALID 255 
 
@@ -88,7 +88,9 @@ typedef enum NodeType {
 	NODE_NORMAL = 5500,
 	NODE_GAMMA = 5600,
 	NODE_TEX_CHECKER = 5700,
-	NODE_BRIGHTCONTRAST = 5800
+	NODE_BRIGHTCONTRAST = 5800,
+	NODE_RGB_RAMP = 5900,
+	NODE_RGB_CURVES = 6000
 } NodeType;
 
 typedef enum NodeAttributeType {
diff --git a/intern/cycles/render/CMakeLists.txt b/intern/cycles/render/CMakeLists.txt
index 8555250..db92cf4 100644
--- a/intern/cycles/render/CMakeLists.txt
+++ b/intern/cycles/render/CMakeLists.txt
@@ -16,7 +16,7 @@ set(SRC
 	buffers.cpp
 	camera.cpp
 	film.cpp
-	# film_response.cpp  # XXX, why isnt this in?
+	# film_response.cpp  # XXX, why isn't this in?
 	filter.cpp
 	graph.cpp
 	image.cpp
@@ -41,7 +41,7 @@ set(SRC_HEADERS
 	buffers.h
 	camera.h
 	film.h
-	# film_response.h  # XXX, why isnt this in?
+	# film_response.h  # XXX, why isn't this in?
 	filter.h
 	graph.h
 	image.h
diff --git a/intern/cycles/render/attribute.cpp b/intern/cycles/render/attribute.cpp
index aa18ca7..9e90bf1 100644
--- a/intern/cycles/render/attribute.cpp
+++ b/intern/cycles/render/attribute.cpp
@@ -101,9 +101,9 @@ ustring Attribute::standard_name(Attribute::Standard std)
 
 /* Attribute Set */
 
-AttributeSet::AttributeSet(Mesh *mesh_)
+AttributeSet::AttributeSet()
 {
-	mesh = mesh_;
+	mesh = NULL;
 }
 
 AttributeSet::~AttributeSet()
@@ -133,7 +133,8 @@ Attribute *AttributeSet::add(ustring name, TypeDesc type, Attribute::Element ele
 	else if(element == Attribute::CORNER)
 		attr->set(name, type, element);
 	
-	attr->reserve(mesh->verts.size(), mesh->triangles.size());
+	if(mesh)
+		attr->reserve(mesh->verts.size(), mesh->triangles.size());
 	
 	return attr;
 }
diff --git a/intern/cycles/render/attribute.h b/intern/cycles/render/attribute.h
index aef215d..7af4657 100644
--- a/intern/cycles/render/attribute.h
+++ b/intern/cycles/render/attribute.h
@@ -94,7 +94,7 @@ public:
 	Mesh *mesh;
 	list<Attribute> attributes;
 
-	AttributeSet(Mesh *mesh);
+	AttributeSet();
 	~AttributeSet();
 
 	Attribute *add(ustring name, TypeDesc type, Attribute::Element element);
diff --git a/intern/cycles/render/background.cpp b/intern/cycles/render/background.cpp
index bf4131b..76d26dd 100644
--- a/intern/cycles/render/background.cpp
+++ b/intern/cycles/render/background.cpp
@@ -18,6 +18,7 @@
 
 #include "background.h"
 #include "device.h"
+#include "integrator.h"
 #include "graph.h"
 #include "nodes.h"
 #include "scene.h"
@@ -31,6 +32,11 @@ CCL_NAMESPACE_BEGIN
 
 Background::Background()
 {
+	ao_factor = 0.0f;
+	ao_distance = FLT_MAX;
+
+	use = true;
+
 	transparent = false;
 	need_update = true;
 }
@@ -48,8 +54,15 @@ void Background::device_update(Device *device, DeviceScene *dscene, Scene *scene
 
 	/* set shader index and transparent option */
 	KernelBackground *kbackground = &dscene->data.background;
+
+	kbackground->ao_factor = ao_factor;
+	kbackground->ao_distance = ao_distance;
+
 	kbackground->transparent = transparent;
-	kbackground->shader = scene->shader_manager->get_shader_id(scene->default_background);
+	if(use)
+		kbackground->shader = scene->shader_manager->get_shader_id(scene->default_background);
+	else
+		kbackground->shader = scene->shader_manager->get_shader_id(scene->default_empty);
 
 	need_update = false;
 }
@@ -60,11 +73,15 @@ void Background::device_free(Device *device, DeviceScene *dscene)
 
 bool Background::modified(const Background& background)
 {
-	return !(transparent == background.transparent);
+	return !(transparent == background.transparent &&
+		use == background.use &&
+		ao_factor == background.ao_factor &&
+		ao_distance == background.ao_distance);
 }
 
 void Background::tag_update(Scene *scene)
 {
+	scene->integrator->tag_update(scene);
 	need_update = true;
 }
 
diff --git a/intern/cycles/render/background.h b/intern/cycles/render/background.h
index 16d2ccb..3c1cd39 100644
--- a/intern/cycles/render/background.h
+++ b/intern/cycles/render/background.h
@@ -29,6 +29,11 @@ class Scene;
 
 class Background {
 public:
+	float ao_factor;
+	float ao_distance;
+
+	bool use;
+
 	bool transparent;
 	bool need_update;
 
diff --git a/intern/cycles/render/buffers.cpp b/intern/cycles/render/buffers.cpp
index dd0ebf7..bda20a8 100644
--- a/intern/cycles/render/buffers.cpp
+++ b/intern/cycles/render/buffers.cpp
@@ -119,7 +119,7 @@ void RenderBuffers::reset(Device *device, BufferParams& params_)
 	
 	for(x=0; x<width; x++)
 		for(y=0; y<height; y++)
-			init_state[x + y*width] = hash_int_2d(x, y);
+			init_state[x + y*width] = hash_int_2d(params.full_x+x, params.full_y+y);
 
 	device->mem_alloc(rng_state, MEM_READ_WRITE);
 	device->mem_copy_to(rng_state);
@@ -173,28 +173,65 @@ bool RenderBuffers::get_pass(PassType type, float exposure, int sample, int comp
 		else if(components == 3) {
 			assert(pass.components == 4);
 
-			/* RGB/vector */
-			for(int i = 0; i < size; i++, in += pass_stride, pixels += 3) {
-				float3 f = make_float3(in[0], in[1], in[2]);
+			if(pass.divide_type != PASS_NONE) {
+				/* RGB lighting passes that need to divide out color */
+				pass_offset = 0;
+				foreach(Pass& color_pass, params.passes) {
+					if(color_pass.type == pass.divide_type)
+						break;
+					pass_offset += color_pass.components;
+				}
+
+				float *in_divide = (float*)buffer.data_pointer + pass_offset;
+
+				for(int i = 0; i < size; i++, in += pass_stride, in_divide += pass_stride, pixels += 3) {
+					float3 f = make_float3(in[0], in[1], in[2]);
+					float3 f_divide = make_float3(in_divide[0], in_divide[1], in_divide[2]);
 
-				pixels[0] = f.x*scale_exposure;
-				pixels[1] = f.y*scale_exposure;
-				pixels[2] = f.z*scale_exposure;
+					f = safe_divide_color(f*exposure, f_divide);
+
+					pixels[0] = f.x;
+					pixels[1] = f.y;
+					pixels[2] = f.z;
+				}
+			}
+			else {
+				/* RGB/vector */
+				for(int i = 0; i < size; i++, in += pass_stride, pixels += 3) {
+					float3 f = make_float3(in[0], in[1], in[2]);
+
+					pixels[0] = f.x*scale_exposure;
+					pixels[1] = f.y*scale_exposure;
+					pixels[2] = f.z*scale_exposure;
+				}
 			}
 		}
 		else if(components == 4) {
 			assert(pass.components == components);
 
 			/* RGBA */
-			for(int i = 0; i < size; i++, in += pass_stride, pixels += 4) {
-				float4 f = make_float4(in[0], in[1], in[2], in[3]);
+			if(type == PASS_SHADOW) {
+				for(int i = 0; i < size; i++, in += pass_stride, pixels += 4) {
+					float4 f = make_float4(in[0], in[1], in[2], in[3]);
+					float invw = (f.w > 0.0f)? 1.0f/f.w: 1.0f;
+
+					pixels[0] = f.x*invw;
+					pixels[1] = f.y*invw;
+					pixels[2] = f.z*invw;
+					pixels[3] = 1.0f;
+				}
+			}
+			else {
+				for(int i = 0; i < size; i++, in += pass_stride, pixels += 4) {
+					float4 f = make_float4(in[0], in[1], in[2], in[3]);
 
-				pixels[0] = f.x*scale_exposure;
-				pixels[1] = f.y*scale_exposure;
-				pixels[2] = f.z*scale_exposure;
+					pixels[0] = f.x*scale_exposure;
+					pixels[1] = f.y*scale_exposure;
+					pixels[2] = f.z*scale_exposure;
 
-				/* clamp since alpha might be > 1.0 due to russian roulette */
-				pixels[3] = clamp(f.w*scale, 0.0f, 1.0f);
+					/* clamp since alpha might be > 1.0 due to russian roulette */
+					pixels[3] = clamp(f.w*scale, 0.0f, 1.0f);
+				}
 			}
 		}
 
@@ -250,36 +287,10 @@ void DisplayBuffer::draw_set(int width, int height)
 	draw_height = height;
 }
 
-void DisplayBuffer::draw_transparency_grid()
-{
-	GLubyte checker_stipple_sml[32*32/8] = {
-		255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \
-		255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \
-		0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \
-		0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \
-		255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \
-		255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0, \
-		0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \
-		0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255, \
-	};
-
-	glColor4ub(50, 50, 50, 255);
-	glRectf(0, 0, params.width, params.height);
-	glEnable(GL_POLYGON_STIPPLE);
-	glColor4ub(55, 55, 55, 255);
-	glPolygonStipple(checker_stipple_sml);
-	glRectf(0, 0, params.width, params.height);
-	glDisable(GL_POLYGON_STIPPLE);
-}
-
 void DisplayBuffer::draw(Device *device)
 {
-	if(draw_width != 0 && draw_height != 0) {
-		if(transparent)
-			draw_transparency_grid();
-
+	if(draw_width != 0 && draw_height != 0)
 		device->draw_pixels(rgba, 0, draw_width, draw_height, 0, params.width, params.height, transparent);
-	}
 }
 
 bool DisplayBuffer::draw_ready()
diff --git a/intern/cycles/render/buffers.h b/intern/cycles/render/buffers.h
index 3062e5a..77ad4a5 100644
--- a/intern/cycles/render/buffers.h
+++ b/intern/cycles/render/buffers.h
@@ -119,7 +119,6 @@ public:
 	bool draw_ready();
 
 protected:
-	void draw_transparency_grid();
 	void device_free();
 
 	Device *device;
diff --git a/intern/cycles/render/camera.cpp b/intern/cycles/render/camera.cpp
index a83ae81..f9290df 100644
--- a/intern/cycles/render/camera.cpp
+++ b/intern/cycles/render/camera.cpp
@@ -35,7 +35,7 @@ Camera::Camera()
 
 	matrix = transform_identity();
 
-	ortho = false;
+	type = CAMERA_PERSPECTIVE;
 	fov = M_PI_F/4.0f;
 
 	nearclip = 1e-5f;
@@ -77,17 +77,21 @@ void Camera::update()
 	Transform ndctoraster = transform_scale(width, height, 1.0f);
 
 	/* raster to screen */
-	Transform screentoraster = ndctoraster *
+	Transform screentoraster = ndctoraster;
+	
+	screentoraster = ndctoraster *
 		transform_scale(1.0f/(right - left), 1.0f/(top - bottom), 1.0f) *
 		transform_translate(-left, -bottom, 0.0f);
 
 	Transform rastertoscreen = transform_inverse(screentoraster);
 
 	/* screen to camera */
-	if(ortho)
+	if(type == CAMERA_PERSPECTIVE)
+		screentocamera = transform_inverse(transform_perspective(fov, nearclip, farclip));
+	else if(type == CAMERA_ORTHOGRAPHIC)
 		screentocamera = transform_inverse(transform_orthographic(nearclip, farclip));
 	else
-		screentocamera = transform_inverse(transform_perspective(fov, nearclip, farclip));
+		screentocamera = transform_identity();
 
 	rastertocamera = screentocamera * rastertoscreen;
 
@@ -98,15 +102,19 @@ void Camera::update()
 	worldtoraster = transform_inverse(rastertoworld);
 
 	/* differentials */
-	if(ortho) {
+	if(type == CAMERA_ORTHOGRAPHIC) {
 		dx = transform_direction(&rastertocamera, make_float3(1, 0, 0));
 		dy = transform_direction(&rastertocamera, make_float3(0, 1, 0));
 	}
+	else if(type == CAMERA_PERSPECTIVE) {
+		dx = transform_perspective(&rastertocamera, make_float3(1, 0, 0)) -
+		     transform_perspective(&rastertocamera, make_float3(0, 0, 0));
+		dy = transform_perspective(&rastertocamera, make_float3(0, 1, 0)) -
+		     transform_perspective(&rastertocamera, make_float3(0, 0, 0));
+	}
 	else {
-		dx = transform(&rastertocamera, make_float3(1, 0, 0)) -
-		     transform(&rastertocamera, make_float3(0, 0, 0));
-		dy = transform(&rastertocamera, make_float3(0, 1, 0)) -
-		     transform(&rastertocamera, make_float3(0, 0, 0));
+		dx = make_float3(0, 0, 0);
+		dy = make_float3(0, 0, 0);
 	}
 
 	dx = transform_direction(&cameratoworld, dx);
@@ -147,7 +155,7 @@ void Camera::device_update(Device *device, DeviceScene *dscene)
 	kcam->shutterclose = shutterclose;
 
 	/* type */
-	kcam->ortho = ortho;
+	kcam->type = type;
 
 	/* store differentials */
 	kcam->dx = float3_to_float4(dx);
@@ -173,7 +181,7 @@ bool Camera::modified(const Camera& cam)
 		(blades == cam.blades) &&
 		(bladesrotation == cam.bladesrotation) &&
 		(focaldistance == cam.focaldistance) &&
-		(ortho == cam.ortho) &&
+		(type == cam.type) &&
 		(fov == cam.fov) &&
 		(nearclip == cam.nearclip) &&
 		(farclip == cam.farclip) &&
diff --git a/intern/cycles/render/camera.h b/intern/cycles/render/camera.h
index 43537ce..cfcc540 100644
--- a/intern/cycles/render/camera.h
+++ b/intern/cycles/render/camera.h
@@ -19,6 +19,8 @@
 #ifndef __CAMERA_H__
 #define __CAMERA_H__
 
+#include "kernel_types.h"
+
 #include "util_transform.h"
 #include "util_types.h"
 
@@ -44,8 +46,8 @@ public:
 	uint blades;
 	float bladesrotation;
 
-	/* orthographic/perspective */
-	bool ortho;
+	/* type */
+	CameraType type;
 	float fov;
 
 	/* clipping */
diff --git a/intern/cycles/render/film.cpp b/intern/cycles/render/film.cpp
index 376e9d6..cc17f86 100644
--- a/intern/cycles/render/film.cpp
+++ b/intern/cycles/render/film.cpp
@@ -19,6 +19,7 @@
 #include "camera.h"
 #include "device.h"
 #include "film.h"
+#include "integrator.h"
 #include "scene.h"
 
 #include "util_algorithm.h"
@@ -37,11 +38,16 @@ static bool compare_pass_order(const Pass& a, const Pass& b)
 
 void Pass::add(PassType type, vector<Pass>& passes)
 {
+	foreach(Pass& existing_pass, passes)
+		if(existing_pass.type == type)
+			return;
+
 	Pass pass;
 
 	pass.type = type;
 	pass.filter = true;
 	pass.exposure = false;
+	pass.divide_type = PASS_NONE;
 
 	switch(type) {
 		case PASS_NONE:
@@ -81,26 +87,32 @@ void Pass::add(PassType type, vector<Pass>& passes)
 		case PASS_DIFFUSE_INDIRECT:
 			pass.components = 4;
 			pass.exposure = true;
+			pass.divide_type = PASS_DIFFUSE_COLOR;
 			break;
 		case PASS_GLOSSY_INDIRECT:
 			pass.components = 4;
 			pass.exposure = true;
+			pass.divide_type = PASS_GLOSSY_COLOR;
 			break;
 		case PASS_TRANSMISSION_INDIRECT:
 			pass.components = 4;
 			pass.exposure = true;
+			pass.divide_type = PASS_TRANSMISSION_COLOR;
 			break;
 		case PASS_DIFFUSE_DIRECT:
 			pass.components = 4;
 			pass.exposure = true;
+			pass.divide_type = PASS_DIFFUSE_COLOR;
 			break;
 		case PASS_GLOSSY_DIRECT:
 			pass.components = 4;
 			pass.exposure = true;
+			pass.divide_type = PASS_GLOSSY_COLOR;
 			break;
 		case PASS_TRANSMISSION_DIRECT:
 			pass.components = 4;
 			pass.exposure = true;
+			pass.divide_type = PASS_TRANSMISSION_COLOR;
 			break;
 
 		case PASS_EMISSION:
@@ -111,6 +123,13 @@ void Pass::add(PassType type, vector<Pass>& passes)
 			pass.components = 4;
 			pass.exposure = true;
 			break;
+		case PASS_AO:
+			pass.components = 4;
+			break;
+		case PASS_SHADOW:
+			pass.components = 4;
+			pass.exposure = false;
+			break;
 	}
 
 	passes.push_back(pass);
@@ -118,6 +137,9 @@ void Pass::add(PassType type, vector<Pass>& passes)
 	/* order from by components, to ensure alignment so passes with size 4
 	   come first and then passes with size 1 */
 	sort(passes.begin(), passes.end(), compare_pass_order);
+
+	if(pass.divide_type != PASS_NONE)
+		Pass::add(pass.divide_type, passes);
 }
 
 bool Pass::equals(const vector<Pass>& A, const vector<Pass>& B)
@@ -224,6 +246,12 @@ void Film::device_update(Device *device, DeviceScene *dscene)
 			case PASS_BACKGROUND:
 				kfilm->pass_background = kfilm->pass_stride;
 				kfilm->use_light_pass = 1;
+			case PASS_AO:
+				kfilm->pass_ao = kfilm->pass_stride;
+				kfilm->use_light_pass = 1;
+			case PASS_SHADOW:
+				kfilm->pass_shadow = kfilm->pass_stride;
+				kfilm->use_light_pass = 1;
 			case PASS_NONE:
 				break;
 		}
@@ -248,6 +276,7 @@ bool Film::modified(const Film& film)
 
 void Film::tag_update(Scene *scene)
 {
+	scene->integrator->tag_update(scene);
 	need_update = true;
 }
 
diff --git a/intern/cycles/render/film.h b/intern/cycles/render/film.h
index 511ad31..8a3dbbf 100644
--- a/intern/cycles/render/film.h
+++ b/intern/cycles/render/film.h
@@ -36,6 +36,7 @@ public:
 	int components;
 	bool filter;
 	bool exposure;
+	PassType divide_type;
 
 	static void add(PassType type, vector<Pass>& passes);
 	static bool equals(const vector<Pass>& A, const vector<Pass>& B);
diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp
index de3ab8e..78b8f06 100644
--- a/intern/cycles/render/image.cpp
+++ b/intern/cycles/render/image.cpp
@@ -39,9 +39,10 @@ ImageManager::ImageManager()
 
 ImageManager::~ImageManager()
 {
-	for(size_t slot = 0; slot < images.size(); slot++) {
+	for(size_t slot = 0; slot < images.size(); slot++)
 		assert(!images[slot]);
-	}
+	for(size_t slot = 0; slot < float_images.size(); slot++)
+		assert(!float_images[slot]);
 }
 
 void ImageManager::set_osl_texture_system(void *texture_system)
@@ -49,39 +50,111 @@ void ImageManager::set_osl_texture_system(void *texture_system)
 	osl_texture_system = texture_system;
 }
 
-int ImageManager::add_image(const string& filename)
+static bool is_float_image(const string& filename)
+{
+	ImageInput *in = ImageInput::create(filename);
+	bool is_float = false;
+
+	if(in) {
+		ImageSpec spec;
+
+		if(in->open(filename, spec)) {
+			/* check the main format, and channel formats;
+			   if any are non-integer, we'll need a float texture slot */
+			if(spec.format == TypeDesc::HALF ||
+			   spec.format == TypeDesc::FLOAT ||
+			   spec.format == TypeDesc::DOUBLE) {
+				is_float = true;
+			}
+
+			for(size_t channel = 0; channel < spec.channelformats.size(); channel++) {
+				if(spec.channelformats[channel] == TypeDesc::HALF ||
+				   spec.channelformats[channel] == TypeDesc::FLOAT ||
+				   spec.channelformats[channel] == TypeDesc::DOUBLE) {
+					is_float = true;
+				}
+			}
+
+			in->close();
+		}
+
+		delete in;
+	}
+
+	return is_float;
+}
+
+int ImageManager::add_image(const string& filename, bool& is_float)
 {
 	Image *img;
 	size_t slot;
 
-	/* find existing image */
-	for(slot = 0; slot < images.size(); slot++) {
-		if(images[slot] && images[slot]->filename == filename) {
-			images[slot]->users++;
-			return slot;
+	/* load image info and find out if we need a float texture */
+	is_float = is_float_image(filename);
+
+	if(is_float) {
+		/* find existing image */
+		for(slot = 0; slot < float_images.size(); slot++) {
+			if(float_images[slot] && float_images[slot]->filename == filename) {
+				float_images[slot]->users++;
+				return slot+TEX_IMAGE_FLOAT_START;
+			}
 		}
+
+		/* find free slot */
+		for(slot = 0; slot < float_images.size(); slot++) {
+			if(!float_images[slot])
+				break;
+		}
+
+		if(slot == float_images.size()) {
+			/* max images limit reached */
+			if(float_images.size() == TEX_NUM_FLOAT_IMAGES)
+				return -1;
+
+			float_images.resize(float_images.size() + 1);
+		}
+
+		/* add new image */
+		img = new Image();
+		img->filename = filename;
+		img->need_load = true;
+		img->users = 1;
+
+		float_images[slot] = img;
+		/* report slot out of total set of textures */
+		slot += TEX_IMAGE_FLOAT_START;
 	}
+	else {
+		for(slot = 0; slot < images.size(); slot++) {
+			if(images[slot] && images[slot]->filename == filename) {
+				images[slot]->users++;
+				return slot;
+			}
+		}
 
-	/* find free slot */
-	for(slot = 0; slot < images.size(); slot++)
-		if(!images[slot])
-			break;
-	
-	if(slot == images.size()) {
-		/* max images limit reached */
-		if(images.size() == TEX_IMAGE_MAX)
-			return -1;
+		/* find free slot */
+		for(slot = 0; slot < images.size(); slot++) {
+			if(!images[slot])
+				break;
+		}
+
+		if(slot == images.size()) {
+			/* max images limit reached */
+			if(images.size() == TEX_NUM_IMAGES)
+				return -1;
+
+			images.resize(images.size() + 1);
+		}
 
-		images.resize(images.size() + 1);
+		/* add new image */
+		img = new Image();
+		img->filename = filename;
+		img->need_load = true;
+		img->users = 1;
+
+		images[slot] = img;
 	}
-	
-	/* add new image */
-	img = new Image();
-	img->filename = filename;
-	img->need_load = true;
-	img->users = 1;
-
-	images[slot] = img;
 	need_update = true;
 
 	return slot;
@@ -91,24 +164,40 @@ void ImageManager::remove_image(const string& filename)
 {
 	size_t slot;
 
-	for(slot = 0; slot < images.size(); slot++)
-		if(images[slot] && images[slot]->filename == filename)
+	for(slot = 0; slot < images.size(); slot++) {
+		if(images[slot] && images[slot]->filename == filename) {
+			/* decrement user count */
+			images[slot]->users--;
+			assert(images[slot]->users >= 0);
+
+			/* don't remove immediately, rather do it all together later on. one of
+			   the reasons for this is that on shader changes we add and remove nodes
+			   that use them, but we do not want to reload the image all the time. */
+			if(images[slot]->users == 0)
+				need_update = true;
+
 			break;
-	
-	if(slot == images.size())
-		return;
+		}
+	}
 
-	assert(images[slot]);
-
-	/* decrement user count */
-	images[slot]->users--;
-	assert(images[slot]->users >= 0);
-	
-	/* don't remove immediately, rather do it all together later on. one of
-	   the reasons for this is that on shader changes we add and remove nodes
-	   that use them, but we do not want to reload the image all the time. */
-	if(images[slot]->users == 0)
-		need_update = true;
+	if(slot == images.size()) {
+		/* see if it's in a float texture slot */
+		for(slot = 0; slot < float_images.size(); slot++) {
+			if(float_images[slot] && float_images[slot]->filename == filename) {
+				/* decrement user count */
+				float_images[slot]->users--;
+				assert(float_images[slot]->users >= 0);
+
+				/* don't remove immediately, rather do it all together later on. one of
+				   the reasons for this is that on shader changes we add and remove nodes
+				   that use them, but we do not want to reload the image all the time. */
+				if(float_images[slot]->users == 0)
+					need_update = true;
+
+				break;
+			}
+		}
+	}
 }
 
 bool ImageManager::file_load_image(Image *img, device_vector<uchar4>& tex_img)
@@ -173,51 +262,168 @@ bool ImageManager::file_load_image(Image *img, device_vector<uchar4>& tex_img)
 	return true;
 }
 
+bool ImageManager::file_load_float_image(Image *img, device_vector<float4>& tex_img)
+{
+	if(img->filename == "")
+		return false;
+
+	/* load image from file through OIIO */
+	ImageInput *in = ImageInput::create(img->filename);
+
+	if(!in)
+		return false;
+
+	ImageSpec spec;
+
+	if(!in->open(img->filename, spec)) {
+		delete in;
+		return false;
+	}
+
+	/* we only handle certain number of components */
+	int width = spec.width;
+	int height = spec.height;
+	int components = spec.nchannels;
+
+	if(!(components == 1 || components == 3 || components == 4)) {
+		in->close();
+		delete in;
+		return false;
+	}
+
+	/* read RGBA pixels */
+	float *pixels = (float*)tex_img.resize(width, height);
+	int scanlinesize = width*components*sizeof(float);
+
+	in->read_image(TypeDesc::FLOAT,
+		(uchar*)pixels + (height-1)*scanlinesize,
+		AutoStride,
+		-scanlinesize,
+		AutoStride);
+
+	in->close();
+	delete in;
+
+	if(components == 3) {
+		for(int i = width*height-1; i >= 0; i--) {
+			pixels[i*4+3] = 1.0f;
+			pixels[i*4+2] = pixels[i*3+2];
+			pixels[i*4+1] = pixels[i*3+1];
+			pixels[i*4+0] = pixels[i*3+0];
+		}
+	}
+	else if(components == 1) {
+		for(int i = width*height-1; i >= 0; i--) {
+			pixels[i*4+3] = 1.0f;
+			pixels[i*4+2] = pixels[i];
+			pixels[i*4+1] = pixels[i];
+			pixels[i*4+0] = pixels[i];
+		}
+	}
+
+	return true;
+}
+
 void ImageManager::device_load_image(Device *device, DeviceScene *dscene, int slot)
 {
 	if(osl_texture_system)
 		return;
 
-	Image *img = images[slot];
-	device_vector<uchar4>& tex_img = dscene->tex_image[slot];
+	Image *img;
+	bool is_float;
 
-	if(tex_img.device_pointer)
-		device->tex_free(tex_img);
+	if(slot < TEX_IMAGE_FLOAT_START) {
+		img = images[slot];
+		is_float = false;
+	}
+	else {
+		img = float_images[slot - TEX_IMAGE_FLOAT_START];
+		is_float = true;
+	}
 
-	if(!file_load_image(img, tex_img)) {
-		/* on failure to load, we set a 1x1 pixels black image */
-		uchar *pixels = (uchar*)tex_img.resize(1, 1);
+	if(is_float) {
+		device_vector<float4>& tex_img = dscene->tex_float_image[slot - TEX_IMAGE_FLOAT_START];
+
+		if(tex_img.device_pointer)
+			device->tex_free(tex_img);
+
+		if(!file_load_float_image(img, tex_img)) {
+			/* on failure to load, we set a 1x1 pixels black image */
+			float *pixels = (float*)tex_img.resize(1, 1);
+
+			pixels[0] = 0.0f;
+			pixels[1] = 0.0f;
+			pixels[2] = 0.0f;
+			pixels[3] = 0.0f;
+		}
 
-		pixels[0] = 0;
-		pixels[1] = 0;
-		pixels[2] = 0;
-		pixels[3] = 0;
+		string name;
+
+		if(slot >= 10) name = string_printf("__tex_image_float_0%d", slot);
+		else name = string_printf("__tex_image_float_00%d", slot);
+
+		device->tex_alloc(name.c_str(), tex_img, true, true);
 	}
+	else {
+		device_vector<uchar4>& tex_img = dscene->tex_image[slot];
+
+		if(tex_img.device_pointer)
+			device->tex_free(tex_img);
+
+		if(!file_load_image(img, tex_img)) {
+			/* on failure to load, we set a 1x1 pixels black image */
+			uchar *pixels = (uchar*)tex_img.resize(1, 1);
 
-	string name;
+			pixels[0] = 0;
+			pixels[1] = 0;
+			pixels[2] = 0;
+			pixels[3] = 0;
+		}
+
+		string name;
 
-	if(slot >= 10) name = string_printf("__tex_image_0%d", slot);
-	else name = string_printf("__tex_image_00%d", slot);
+		if(slot >= 10) name = string_printf("__tex_image_0%d", slot);
+		else name = string_printf("__tex_image_00%d", slot);
 
-	device->tex_alloc(name.c_str(), tex_img, true, true);
+		device->tex_alloc(name.c_str(), tex_img, true, true);
+	}
 }
 
 void ImageManager::device_free_image(Device *device, DeviceScene *dscene, int slot)
 {
-	if(images[slot]) {
+	Image *img;
+	bool is_float;
+
+	if(slot < TEX_IMAGE_FLOAT_START) {
+		img = images[slot];
+		is_float = false;
+	}
+	else {
+		img = float_images[slot - TEX_IMAGE_FLOAT_START];
+		is_float = true;
+	}
+
+	if(img) {
 		if(osl_texture_system) {
 #ifdef WITH_OSL
 			ustring filename(images[slot]->filename);
 			((OSL::TextureSystem*)osl_texture_system)->invalidate(filename);
 #endif
 		}
+		else if(is_float) {
+			device->tex_free(dscene->tex_float_image[slot - TEX_IMAGE_FLOAT_START]);
+			dscene->tex_float_image[slot - TEX_IMAGE_FLOAT_START].clear();
+
+			delete float_images[slot - TEX_IMAGE_FLOAT_START];
+			float_images[slot - TEX_IMAGE_FLOAT_START] = NULL;
+		}
 		else {
 			device->tex_free(dscene->tex_image[slot]);
 			dscene->tex_image[slot].clear();
-		}
 
-		delete images[slot];
-		images[slot] = NULL;
+			delete images[slot];
+			images[slot] = NULL;
+		}
 	}
 }
 
@@ -242,6 +448,22 @@ void ImageManager::device_update(Device *device, DeviceScene *dscene, Progress&
 		}
 	}
 
+	for(size_t slot = 0; slot < float_images.size(); slot++) {
+		if(float_images[slot]) {
+			if(float_images[slot]->users == 0) {
+				device_free_image(device, dscene, slot + TEX_IMAGE_FLOAT_START);
+			}
+			else if(float_images[slot]->need_load) {
+				string name = path_filename(float_images[slot]->filename);
+				progress.set_status("Updating Images", "Loading " + name);
+				device_load_image(device, dscene, slot + TEX_IMAGE_FLOAT_START);
+				float_images[slot]->need_load = false;
+			}
+
+			if(progress.get_cancel()) return;
+		}
+	}
+
 	need_update = false;
 }
 
@@ -249,8 +471,11 @@ void ImageManager::device_free(Device *device, DeviceScene *dscene)
 {
 	for(size_t slot = 0; slot < images.size(); slot++)
 		device_free_image(device, dscene, slot);
+	for(size_t slot = 0; slot < float_images.size(); slot++)
+		device_free_image(device, dscene, slot + TEX_IMAGE_FLOAT_START);
 
 	images.clear();
+	float_images.clear();
 }
 
 CCL_NAMESPACE_END
diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h
index 0d49a1e..d789e68 100644
--- a/intern/cycles/render/image.h
+++ b/intern/cycles/render/image.h
@@ -26,7 +26,10 @@
 
 CCL_NAMESPACE_BEGIN
 
-#define TEX_IMAGE_MAX 100
+#define TEX_NUM_FLOAT_IMAGES	5
+#define TEX_NUM_IMAGES			95
+#define TEX_IMAGE_MAX			(TEX_NUM_IMAGES + TEX_NUM_FLOAT_IMAGES)
+#define TEX_IMAGE_FLOAT_START	TEX_NUM_IMAGES
 
 class Device;
 class DeviceScene;
@@ -37,7 +40,7 @@ public:
 	ImageManager();
 	~ImageManager();
 
-	int add_image(const string& filename);
+	int add_image(const string& filename, bool& is_float);
 	void remove_image(const string& filename);
 
 	void device_update(Device *device, DeviceScene *dscene, Progress& progress);
@@ -56,9 +59,11 @@ private:
 	};
 
 	vector<Image*> images;
+	vector<Image*> float_images;
 	void *osl_texture_system;
 
 	bool file_load_image(Image *img, device_vector<uchar4>& tex_img);
+	bool file_load_float_image(Image *img, device_vector<float4>& tex_img);
 
 	void device_load_image(Device *device, DeviceScene *dscene, int slot);
 	void device_free_image(Device *device, DeviceScene *dscene, int slot);
diff --git a/intern/cycles/render/integrator.cpp b/intern/cycles/render/integrator.cpp
index 47059a0..6e6d30f 100644
--- a/intern/cycles/render/integrator.cpp
+++ b/intern/cycles/render/integrator.cpp
@@ -43,6 +43,7 @@ Integrator::Integrator()
 	no_caustics = false;
 	seed = 0;
 	layer_flag = ~0;
+	sample_clamp = 0.0f;
 
 	need_update = true;
 }
@@ -83,6 +84,11 @@ void Integrator::device_update(Device *device, DeviceScene *dscene)
 	kintegrator->seed = hash_int(seed);
 	kintegrator->layer_flag = layer_flag << PATH_RAY_LAYER_SHIFT;
 
+	kintegrator->use_ambient_occlusion =
+		((dscene->data.film.pass_flag & PASS_AO) || dscene->data.background.ao_factor != 0.0f);
+	
+	kintegrator->sample_clamp = (sample_clamp == 0.0f)? FLT_MAX: sample_clamp*3.0f;
+
 	/* sobol directions table */
 	int dimensions = PRNG_BASE_NUM + (max_bounce + transparent_max_bounce + 2)*PRNG_BOUNCE_NUM;
 	uint *directions = dscene->sobol_directions.resize(SOBOL_BITS*dimensions);
@@ -114,7 +120,8 @@ bool Integrator::modified(const Integrator& integrator)
 		transparent_shadows == integrator.transparent_shadows &&
 		no_caustics == integrator.no_caustics &&
 		layer_flag == integrator.layer_flag &&
-		seed == integrator.seed);
+		seed == integrator.seed &&
+		sample_clamp == integrator.sample_clamp);
 }
 
 void Integrator::tag_update(Scene *scene)
diff --git a/intern/cycles/render/integrator.h b/intern/cycles/render/integrator.h
index e610d67..abbbaca 100644
--- a/intern/cycles/render/integrator.h
+++ b/intern/cycles/render/integrator.h
@@ -45,6 +45,8 @@ public:
 	int seed;
 	int layer_flag;
 
+	float sample_clamp;
+
 	bool need_update;
 
 	Integrator();
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp
index 405aa80..316e5ce 100644
--- a/intern/cycles/render/light.cpp
+++ b/intern/cycles/render/light.cpp
@@ -45,9 +45,8 @@ static void dump_background_pixels(Device *device, DeviceScene *dscene, int res,
 		for(int x = 0; x < width; x++) {
 			float u = x/(float)width;
 			float v = y/(float)height;
-			float3 D = -equirectangular_to_direction(u, v);
 
-			uint4 in = make_uint4(__float_as_int(D.x), __float_as_int(D.y), __float_as_int(D.z), 0);
+			uint4 in = make_uint4(__float_as_int(u), __float_as_int(v), 0, 0);
 			d_input_data[x + y*width] = in;
 		}
 	}
@@ -214,9 +213,9 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
 					offset++;
 
 					Mesh::Triangle t = mesh->triangles[i];
-					float3 p1 = transform(&tfm, mesh->verts[t.v[0]]);
-					float3 p2 = transform(&tfm, mesh->verts[t.v[1]]);
-					float3 p3 = transform(&tfm, mesh->verts[t.v[2]]);
+					float3 p1 = transform_point(&tfm, mesh->verts[t.v[0]]);
+					float3 p2 = transform_point(&tfm, mesh->verts[t.v[1]]);
+					float3 p3 = transform_point(&tfm, mesh->verts[t.v[2]]);
 
 					totarea += triangle_area(p1, p2, p3);
 				}
diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp
index cd533f2..a7eb365 100644
--- a/intern/cycles/render/mesh.cpp
+++ b/intern/cycles/render/mesh.cpp
@@ -38,7 +38,6 @@ CCL_NAMESPACE_BEGIN
 /* Mesh */
 
 Mesh::Mesh()
-: attributes(this)
 {
 	need_update = true;
 	transform_applied = false;
@@ -49,6 +48,8 @@ Mesh::Mesh()
 
 	tri_offset = 0;
 	vert_offset = 0;
+
+	attributes.mesh = this;
 }
 
 Mesh::~Mesh()
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index 982521b..db69699 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -93,8 +93,8 @@ static ShaderEnum color_space_init()
 {
 	ShaderEnum enm;
 
-	enm.insert("Linear", 0);
-	enm.insert("sRGB", 1);
+	enm.insert("None", 0);
+	enm.insert("Color", 1);
 
 	return enm;
 }
@@ -106,8 +106,9 @@ ImageTextureNode::ImageTextureNode()
 {
 	image_manager = NULL;
 	slot = -1;
+	is_float = false;
 	filename = "";
-	color_space = ustring("sRGB");
+	color_space = ustring("Color");
 
 	add_input("Vector", SHADER_SOCKET_POINT, ShaderInput::TEXTURE_UV);
 	add_output("Color", SHADER_SOCKET_COLOR);
@@ -125,6 +126,7 @@ ShaderNode *ImageTextureNode::clone() const
 	ImageTextureNode *node = new ImageTextureNode(*this);
 	node->image_manager = NULL;
 	node->slot = -1;
+	node->is_float = false;
 	return node;
 }
 
@@ -136,7 +138,7 @@ void ImageTextureNode::compile(SVMCompiler& compiler)
 
 	image_manager = compiler.image_manager;
 	if(slot == -1)
-		slot = image_manager->add_image(filename);
+		slot = image_manager->add_image(filename, is_float);
 
 	if(!color_out->links.empty())
 		compiler.stack_assign(color_out);
@@ -146,16 +148,24 @@ void ImageTextureNode::compile(SVMCompiler& compiler)
 	if(slot != -1) {
 		compiler.stack_assign(vector_in);
 
-		if(!tex_mapping.skip())
-			tex_mapping.compile(compiler, vector_in->stack_offset, vector_in->stack_offset);
+		int srgb = (is_float || color_space != "Color")? 0: 1;
+		int vector_offset = vector_in->stack_offset;
+
+		if(!tex_mapping.skip()) {
+			vector_offset = compiler.stack_find_offset(SHADER_SOCKET_VECTOR);
+			tex_mapping.compile(compiler, vector_in->stack_offset, vector_offset);
+		}
 
 		compiler.add_node(NODE_TEX_IMAGE,
 			slot,
 			compiler.encode_uchar4(
-				vector_in->stack_offset,
+				vector_offset,
 				color_out->stack_offset,
 				alpha_out->stack_offset,
-				color_space_enum[color_space]));
+				srgb));
+	
+		if(vector_offset != vector_in->stack_offset)
+			compiler.stack_clear_offset(vector_in->type, vector_offset);
 	}
 	else {
 		/* image not found */
@@ -171,21 +181,37 @@ void ImageTextureNode::compile(SVMCompiler& compiler)
 void ImageTextureNode::compile(OSLCompiler& compiler)
 {
 	compiler.parameter("filename", filename.c_str());
-	compiler.parameter("color_space", color_space.c_str());
+	if(is_float || color_space != "Color")
+		compiler.parameter("color_space", "Linear");
+	else
+		compiler.parameter("color_space", "sRGB");
 	compiler.add(this, "node_image_texture");
 }
 
 /* Environment Texture */
 
+static ShaderEnum projection_init()
+{
+	ShaderEnum enm;
+
+	enm.insert("Equirectangular", 0);
+	enm.insert("Mirror Ball", 1);
+
+	return enm;
+}
+
 ShaderEnum EnvironmentTextureNode::color_space_enum = color_space_init();
+ShaderEnum EnvironmentTextureNode::projection_enum = projection_init();
 
 EnvironmentTextureNode::EnvironmentTextureNode()
 : TextureNode("environment_texture")
 {
 	image_manager = NULL;
 	slot = -1;
+	is_float = false;
 	filename = "";
-	color_space = ustring("sRGB");
+	color_space = ustring("Color");
+	projection = ustring("Equirectangular");
 
 	add_input("Vector", SHADER_SOCKET_VECTOR, ShaderInput::POSITION);
 	add_output("Color", SHADER_SOCKET_COLOR);
@@ -203,6 +229,7 @@ ShaderNode *EnvironmentTextureNode::clone() const
 	EnvironmentTextureNode *node = new EnvironmentTextureNode(*this);
 	node->image_manager = NULL;
 	node->slot = -1;
+	node->is_float = false;
 	return node;
 }
 
@@ -214,26 +241,35 @@ void EnvironmentTextureNode::compile(SVMCompiler& compiler)
 
 	image_manager = compiler.image_manager;
 	if(slot == -1)
-		slot = image_manager->add_image(filename);
+		slot = image_manager->add_image(filename, is_float);
 
 	if(!color_out->links.empty())
 		compiler.stack_assign(color_out);
 	if(!alpha_out->links.empty())
 		compiler.stack_assign(alpha_out);
-
+	
 	if(slot != -1) {
 		compiler.stack_assign(vector_in);
 
-		if(!tex_mapping.skip())
-			tex_mapping.compile(compiler, vector_in->stack_offset, vector_in->stack_offset);
+		int srgb = (is_float || color_space != "Color")? 0: 1;
+		int vector_offset = vector_in->stack_offset;
+
+		if(!tex_mapping.skip()) {
+			vector_offset = compiler.stack_find_offset(SHADER_SOCKET_VECTOR);
+			tex_mapping.compile(compiler, vector_in->stack_offset, vector_offset);
+		}
 
 		compiler.add_node(NODE_TEX_ENVIRONMENT,
 			slot,
 			compiler.encode_uchar4(
-				vector_in->stack_offset,
+				vector_offset,
 				color_out->stack_offset,
 				alpha_out->stack_offset,
-				color_space_enum[color_space]));
+				srgb),
+			projection_enum[projection]);
+	
+		if(vector_offset != vector_in->stack_offset)
+			compiler.stack_clear_offset(vector_in->type, vector_offset);
 	}
 	else {
 		/* image not found */
@@ -249,7 +285,10 @@ void EnvironmentTextureNode::compile(SVMCompiler& compiler)
 void EnvironmentTextureNode::compile(OSLCompiler& compiler)
 {
 	compiler.parameter("filename", filename.c_str());
-	compiler.parameter("color_space", color_space.c_str());
+	if(is_float || color_space != "Color")
+		compiler.parameter("color_space", "Linear");
+	else
+		compiler.parameter("color_space", "sRGB");
 	compiler.add(this, "node_environment_texture");
 }
 
@@ -338,11 +377,19 @@ void SkyTextureNode::compile(SVMCompiler& compiler)
 
 	if(vector_in->link)
 		compiler.stack_assign(vector_in);
-	if(!tex_mapping.skip())
-		tex_mapping.compile(compiler, vector_in->stack_offset, vector_in->stack_offset);
+
+	int vector_offset = vector_in->stack_offset;
+
+	if(!tex_mapping.skip()) {
+		vector_offset = compiler.stack_find_offset(SHADER_SOCKET_VECTOR);
+		tex_mapping.compile(compiler, vector_in->stack_offset, vector_offset);
+	}
 
 	compiler.stack_assign(color_out);
-	compiler.add_node(NODE_TEX_SKY, vector_in->stack_offset, color_out->stack_offset);
+	compiler.add_node(NODE_TEX_SKY, vector_offset, color_out->stack_offset);
+
+	if(vector_offset != vector_in->stack_offset)
+		compiler.stack_clear_offset(vector_in->type, vector_offset);
 }
 
 void SkyTextureNode::compile(OSLCompiler& compiler)
@@ -389,8 +436,12 @@ void GradientTextureNode::compile(SVMCompiler& compiler)
 
 	if(vector_in->link) compiler.stack_assign(vector_in);
 
-	if(!tex_mapping.skip())
-		tex_mapping.compile(compiler, vector_in->stack_offset, vector_in->stack_offset);
+	int vector_offset = vector_in->stack_offset;
+
+	if(!tex_mapping.skip()) {
+		vector_offset = compiler.stack_find_offset(SHADER_SOCKET_VECTOR);
+		tex_mapping.compile(compiler, vector_in->stack_offset, vector_offset);
+	}
 
 	if(!fac_out->links.empty())
 		compiler.stack_assign(fac_out);
@@ -398,7 +449,10 @@ void GradientTextureNode::compile(SVMCompiler& compiler)
 		compiler.stack_assign(color_out);
 
 	compiler.add_node(NODE_TEX_GRADIENT,
-		compiler.encode_uchar4(type_enum[type], vector_in->stack_offset, fac_out->stack_offset, color_out->stack_offset));
+		compiler.encode_uchar4(type_enum[type], vector_offset, fac_out->stack_offset, color_out->stack_offset));
+
+	if(vector_offset != vector_in->stack_offset)
+		compiler.stack_clear_offset(vector_in->type, vector_offset);
 }
 
 void GradientTextureNode::compile(OSLCompiler& compiler)
@@ -435,8 +489,12 @@ void NoiseTextureNode::compile(SVMCompiler& compiler)
 	if(detail_in->link) compiler.stack_assign(detail_in);
 	if(distortion_in->link) compiler.stack_assign(distortion_in);
 
-	if(!tex_mapping.skip())
-		tex_mapping.compile(compiler, vector_in->stack_offset, vector_in->stack_offset);
+	int vector_offset = vector_in->stack_offset;
+
+	if(!tex_mapping.skip()) {
+		vector_offset = compiler.stack_find_offset(SHADER_SOCKET_VECTOR);
+		tex_mapping.compile(compiler, vector_in->stack_offset, vector_offset);
+	}
 
 	if(!fac_out->links.empty())
 		compiler.stack_assign(fac_out);
@@ -444,12 +502,15 @@ void NoiseTextureNode::compile(SVMCompiler& compiler)
 		compiler.stack_assign(color_out);
 
 	compiler.add_node(NODE_TEX_NOISE,
-		compiler.encode_uchar4(vector_in->stack_offset, scale_in->stack_offset, detail_in->stack_offset, distortion_in->stack_offset),
+		compiler.encode_uchar4(vector_offset, scale_in->stack_offset, detail_in->stack_offset, distortion_in->stack_offset),
 		compiler.encode_uchar4(color_out->stack_offset, fac_out->stack_offset));
 	compiler.add_node(
 		__float_as_int(scale_in->value.x),
 		__float_as_int(detail_in->value.x),
 		__float_as_int(distortion_in->value.x));
+
+	if(vector_offset != vector_in->stack_offset)
+		compiler.stack_clear_offset(vector_in->type, vector_offset);
 }
 
 void NoiseTextureNode::compile(OSLCompiler& compiler)
@@ -493,16 +554,23 @@ void VoronoiTextureNode::compile(SVMCompiler& compiler)
 	if(vector_in->link) compiler.stack_assign(vector_in);
 	if(scale_in->link) compiler.stack_assign(scale_in);
 
-	if(!tex_mapping.skip())
-		tex_mapping.compile(compiler, vector_in->stack_offset, vector_in->stack_offset);
+	int vector_offset = vector_in->stack_offset;
+
+	if(!tex_mapping.skip()) {
+		vector_offset = compiler.stack_find_offset(SHADER_SOCKET_VECTOR);
+		tex_mapping.compile(compiler, vector_in->stack_offset, vector_offset);
+	}
 
 	compiler.stack_assign(color_out);
 	compiler.stack_assign(fac_out);
 
 	compiler.add_node(NODE_TEX_VORONOI,
 		coloring_enum[coloring],
-		compiler.encode_uchar4(scale_in->stack_offset, vector_in->stack_offset, fac_out->stack_offset, color_out->stack_offset),
+		compiler.encode_uchar4(scale_in->stack_offset, vector_offset, fac_out->stack_offset, color_out->stack_offset),
 		__float_as_int(scale_in->value.x));
+
+	if(vector_offset != vector_in->stack_offset)
+		compiler.stack_clear_offset(vector_in->type, vector_offset);
 }
 
 void VoronoiTextureNode::compile(OSLCompiler& compiler)
@@ -565,8 +633,12 @@ void MusgraveTextureNode::compile(SVMCompiler& compiler)
 	if(gain_in->link) compiler.stack_assign(gain_in);
 	if(scale_in->link) compiler.stack_assign(scale_in);
 
-	if(!tex_mapping.skip())
-		tex_mapping.compile(compiler, vector_in->stack_offset, vector_in->stack_offset);
+	int vector_offset = vector_in->stack_offset;
+
+	if(!tex_mapping.skip()) {
+		vector_offset = compiler.stack_find_offset(SHADER_SOCKET_VECTOR);
+		tex_mapping.compile(compiler, vector_in->stack_offset, vector_offset);
+	}
 
 	if(!fac_out->links.empty())
 		compiler.stack_assign(fac_out);
@@ -574,7 +646,7 @@ void MusgraveTextureNode::compile(SVMCompiler& compiler)
 		compiler.stack_assign(color_out);
 
 	compiler.add_node(NODE_TEX_MUSGRAVE,
-		compiler.encode_uchar4(type_enum[type], vector_in->stack_offset, color_out->stack_offset, fac_out->stack_offset),
+		compiler.encode_uchar4(type_enum[type], vector_offset, color_out->stack_offset, fac_out->stack_offset),
 		compiler.encode_uchar4(dimension_in->stack_offset, lacunarity_in->stack_offset, detail_in->stack_offset, offset_in->stack_offset),
 		compiler.encode_uchar4(gain_in->stack_offset, scale_in->stack_offset));
 	compiler.add_node(__float_as_int(dimension_in->value.x),
@@ -583,6 +655,9 @@ void MusgraveTextureNode::compile(SVMCompiler& compiler)
 		__float_as_int(offset_in->value.x));
 	compiler.add_node(__float_as_int(gain_in->value.x),
 		__float_as_int(scale_in->value.x));
+
+	if(vector_offset != vector_in->stack_offset)
+		compiler.stack_clear_offset(vector_in->type, vector_offset);
 }
 
 void MusgraveTextureNode::compile(OSLCompiler& compiler)
@@ -637,8 +712,12 @@ void WaveTextureNode::compile(SVMCompiler& compiler)
 	if(dscale_in->link) compiler.stack_assign(dscale_in);
 	if(vector_in->link) compiler.stack_assign(vector_in);
 
-	if(!tex_mapping.skip())
-		tex_mapping.compile(compiler, vector_in->stack_offset, vector_in->stack_offset);
+	int vector_offset = vector_in->stack_offset;
+
+	if(!tex_mapping.skip()) {
+		vector_offset = compiler.stack_find_offset(SHADER_SOCKET_VECTOR);
+		tex_mapping.compile(compiler, vector_in->stack_offset, vector_offset);
+	}
 
 	if(!fac_out->links.empty())
 		compiler.stack_assign(fac_out);
@@ -647,13 +726,16 @@ void WaveTextureNode::compile(SVMCompiler& compiler)
 
 	compiler.add_node(NODE_TEX_WAVE,
 		compiler.encode_uchar4(type_enum[type], color_out->stack_offset, fac_out->stack_offset, dscale_in->stack_offset),
-		compiler.encode_uchar4(vector_in->stack_offset, scale_in->stack_offset, detail_in->stack_offset, distortion_in->stack_offset));
+		compiler.encode_uchar4(vector_offset, scale_in->stack_offset, detail_in->stack_offset, distortion_in->stack_offset));
 
 	compiler.add_node(
 		__float_as_int(scale_in->value.x),
 		__float_as_int(detail_in->value.x),
 		__float_as_int(distortion_in->value.x),
 		__float_as_int(dscale_in->value.x));
+
+	if(vector_offset != vector_in->stack_offset)
+		compiler.stack_clear_offset(vector_in->type, vector_offset);
 }
 
 void WaveTextureNode::compile(OSLCompiler& compiler)
@@ -690,8 +772,12 @@ void MagicTextureNode::compile(SVMCompiler& compiler)
 	if(distortion_in->link) compiler.stack_assign(distortion_in);
 	if(scale_in->link) compiler.stack_assign(scale_in);
 
-	if(!tex_mapping.skip())
-		tex_mapping.compile(compiler, vector_in->stack_offset, vector_in->stack_offset);
+	int vector_offset = vector_in->stack_offset;
+
+	if(!tex_mapping.skip()) {
+		vector_offset = compiler.stack_find_offset(SHADER_SOCKET_VECTOR);
+		tex_mapping.compile(compiler, vector_in->stack_offset, vector_offset);
+	}
 
 	if(!fac_out->links.empty())
 		compiler.stack_assign(fac_out);
@@ -700,10 +786,13 @@ void MagicTextureNode::compile(SVMCompiler& compiler)
 
 	compiler.add_node(NODE_TEX_MAGIC,
 		compiler.encode_uchar4(depth, color_out->stack_offset, fac_out->stack_offset),
-		compiler.encode_uchar4(vector_in->stack_offset, scale_in->stack_offset, distortion_in->stack_offset));
+		compiler.encode_uchar4(vector_offset, scale_in->stack_offset, distortion_in->stack_offset));
 	compiler.add_node(
 		__float_as_int(scale_in->value.x),
 		__float_as_int(distortion_in->value.x));
+
+	if(vector_offset != vector_in->stack_offset)
+		compiler.stack_clear_offset(vector_in->type, vector_offset);
 }
 
 void MagicTextureNode::compile(OSLCompiler& compiler)
@@ -741,8 +830,12 @@ void CheckerTextureNode::compile(SVMCompiler& compiler)
 	compiler.stack_assign(color2_in);
 	if(scale_in->link) compiler.stack_assign(scale_in);
 
-	if(!tex_mapping.skip())
-		tex_mapping.compile(compiler, vector_in->stack_offset, vector_in->stack_offset);
+	int vector_offset = vector_in->stack_offset;
+
+	if(!tex_mapping.skip()) {
+		vector_offset = compiler.stack_find_offset(SHADER_SOCKET_VECTOR);
+		tex_mapping.compile(compiler, vector_in->stack_offset, vector_offset);
+	}
 
 	if(!color_out->links.empty())
 		compiler.stack_assign(color_out);
@@ -750,9 +843,12 @@ void CheckerTextureNode::compile(SVMCompiler& compiler)
 		compiler.stack_assign(fac_out);
 
 	compiler.add_node(NODE_TEX_CHECKER,
-		compiler.encode_uchar4(vector_in->stack_offset, color1_in->stack_offset, color2_in->stack_offset, scale_in->stack_offset),
+		compiler.encode_uchar4(vector_offset, color1_in->stack_offset, color2_in->stack_offset, scale_in->stack_offset),
 		compiler.encode_uchar4(color_out->stack_offset, fac_out->stack_offset),
 		__float_as_int(scale_in->value.x));
+
+	if(vector_offset != vector_in->stack_offset)
+		compiler.stack_clear_offset(vector_in->type, vector_offset);
 }
 
 void CheckerTextureNode::compile(OSLCompiler& compiler)
@@ -2256,5 +2352,65 @@ void BumpNode::compile(OSLCompiler& compiler)
 	compiler.add(this, "node_bump");
 }
 
+/* RGBCurvesNode */
+
+RGBCurvesNode::RGBCurvesNode()
+: ShaderNode("rgb_curves")
+{
+	add_input("Fac", SHADER_SOCKET_FLOAT);
+	add_input("Color", SHADER_SOCKET_COLOR);
+	add_output("Color", SHADER_SOCKET_COLOR);
+}
+
+void RGBCurvesNode::compile(SVMCompiler& compiler)
+{
+	ShaderInput *fac_in = input("Fac");
+	ShaderInput *color_in = input("Color");
+	ShaderOutput *color_out = output("Color");
+
+	compiler.stack_assign(fac_in);
+	compiler.stack_assign(color_in);
+	compiler.stack_assign(color_out);
+
+	compiler.add_node(NODE_RGB_CURVES, fac_in->stack_offset, color_in->stack_offset, color_out->stack_offset);
+	compiler.add_array(curves, RAMP_TABLE_SIZE);
+}
+
+void RGBCurvesNode::compile(OSLCompiler& compiler)
+{
+	compiler.add(this, "node_rgb_curves");
+}
+
+/* RGBRampNode */
+
+RGBRampNode::RGBRampNode()
+: ShaderNode("rgb_ramp")
+{
+	add_input("Fac", SHADER_SOCKET_FLOAT);
+	add_output("Color", SHADER_SOCKET_COLOR);
+	add_output("Alpha", SHADER_SOCKET_FLOAT);
+}
+
+void RGBRampNode::compile(SVMCompiler& compiler)
+{
+	ShaderInput *fac_in = input("Fac");
+	ShaderOutput *color_out = output("Color");
+	ShaderOutput *alpha_out = output("Alpha");
+
+	compiler.stack_assign(fac_in);
+	if(!color_out->links.empty())
+		compiler.stack_assign(color_out);
+	if(!alpha_out->links.empty())
+		compiler.stack_assign(alpha_out);
+
+	compiler.add_node(NODE_RGB_RAMP, fac_in->stack_offset, color_out->stack_offset, alpha_out->stack_offset);
+	compiler.add_array(ramp, RAMP_TABLE_SIZE);
+}
+
+void RGBRampNode::compile(OSLCompiler& compiler)
+{
+	compiler.add(this, "node_rgb_ramp");
+}
+
 CCL_NAMESPACE_END
 
diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h
index 338af4e..364209f 100644
--- a/intern/cycles/render/nodes.h
+++ b/intern/cycles/render/nodes.h
@@ -64,6 +64,7 @@ public:
 
 	ImageManager *image_manager;
 	int slot;
+	bool is_float;
 	string filename;
 	ustring color_space;
 
@@ -78,10 +79,13 @@ public:
 
 	ImageManager *image_manager;
 	int slot;
+	bool is_float;
 	string filename;
 	ustring color_space;
+	ustring projection;
 
 	static ShaderEnum color_space_enum;
+	static ShaderEnum projection_enum;
 };
 
 class SkyTextureNode : public TextureNode {
@@ -386,6 +390,18 @@ public:
 	SHADER_NODE_CLASS(BumpNode)
 };
 
+class RGBCurvesNode : public ShaderNode {
+public:
+	SHADER_NODE_CLASS(RGBCurvesNode)
+	float4 curves[RAMP_TABLE_SIZE];
+};
+
+class RGBRampNode : public ShaderNode {
+public:
+	SHADER_NODE_CLASS(RGBRampNode)
+	float4 ramp[RAMP_TABLE_SIZE];
+};
+
 CCL_NAMESPACE_END
 
 #endif /* __NODES_H__ */
diff --git a/intern/cycles/render/object.cpp b/intern/cycles/render/object.cpp
index f83c85c..5f7a581 100644
--- a/intern/cycles/render/object.cpp
+++ b/intern/cycles/render/object.cpp
@@ -54,7 +54,7 @@ void Object::apply_transform()
 		return;
 	
 	for(size_t i = 0; i < mesh->verts.size(); i++)
-		mesh->verts[i] = transform(&tfm, mesh->verts[i]);
+		mesh->verts[i] = transform_point(&tfm, mesh->verts[i]);
 
 	Attribute *attr_fN = mesh->attributes.find(Attribute::STD_FACE_NORMAL);
 	Attribute *attr_vN = mesh->attributes.find(Attribute::STD_VERTEX_NORMAL);
@@ -159,9 +159,9 @@ void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene
 		}
 		else {
 			foreach(Mesh::Triangle& t, mesh->triangles) {
-				float3 p1 = transform(&tfm, mesh->verts[t.v[0]]);
-				float3 p2 = transform(&tfm, mesh->verts[t.v[1]]);
-				float3 p3 = transform(&tfm, mesh->verts[t.v[2]]);
+				float3 p1 = transform_point(&tfm, mesh->verts[t.v[0]]);
+				float3 p2 = transform_point(&tfm, mesh->verts[t.v[1]]);
+				float3 p3 = transform_point(&tfm, mesh->verts[t.v[2]]);
 
 				surface_area += triangle_area(p1, p2, p3);
 			}
diff --git a/intern/cycles/render/scene.cpp b/intern/cycles/render/scene.cpp
index 0b2e2b8..079f274 100644
--- a/intern/cycles/render/scene.cpp
+++ b/intern/cycles/render/scene.cpp
@@ -152,13 +152,13 @@ void Scene::device_update(Device *device_, Progress& progress)
 
 	if(progress.get_cancel()) return;
 
-	progress.set_status("Updating Integrator");
-	integrator->device_update(device, &dscene);
+	progress.set_status("Updating Film");
+	film->device_update(device, &dscene);
 
 	if(progress.get_cancel()) return;
 
-	progress.set_status("Updating Film");
-	film->device_update(device, &dscene);
+	progress.set_status("Updating Integrator");
+	integrator->device_update(device, &dscene);
 
 	if(progress.get_cancel()) return;
 
diff --git a/intern/cycles/render/scene.h b/intern/cycles/render/scene.h
index 4a5224f..af4301b 100644
--- a/intern/cycles/render/scene.h
+++ b/intern/cycles/render/scene.h
@@ -92,7 +92,8 @@ public:
 	device_vector<uint> sobol_directions;
 
 	/* images */
-	device_vector<uchar4> tex_image[TEX_IMAGE_MAX];
+	device_vector<uchar4> tex_image[TEX_NUM_IMAGES];
+	device_vector<float4> tex_float_image[TEX_NUM_FLOAT_IMAGES];
 
 	KernelData data;
 };
@@ -156,6 +157,8 @@ public:
 	int default_surface;
 	int default_light;
 	int default_background;
+	int default_holdout;
+	int default_empty;
 
 	/* device */
 	Device *device;
diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp
index 0abc76f..676f42b 100644
--- a/intern/cycles/render/session.cpp
+++ b/intern/cycles/render/session.cpp
@@ -57,6 +57,7 @@ Session::Session(const SessionParams& params_)
 	gpu_draw_ready = false;
 	gpu_need_tonemap = false;
 	pause = false;
+	kernels_loaded = false;
 }
 
 Session::~Session()
@@ -163,7 +164,7 @@ void Session::run_gpu()
 	paused_time = 0.0;
 
 	if(!params.background)
-		progress.set_start_time(start_time - paused_time);
+		progress.set_start_time(start_time + paused_time);
 
 	while(!progress.get_cancel()) {
 		/* advance to next tile */
@@ -190,7 +191,7 @@ void Session::run_gpu()
 					paused_time += time_dt() - pause_start;
 
 					if(!params.background)
-						progress.set_start_time(start_time - paused_time);
+						progress.set_start_time(start_time + paused_time);
 
 					update_status_time(pause, no_tiles);
 					progress.set_update();
@@ -339,7 +340,7 @@ void Session::run_cpu()
 					paused_time += time_dt() - pause_start;
 
 					if(!params.background)
-						progress.set_start_time(start_time - paused_time);
+						progress.set_start_time(start_time + paused_time);
 
 					update_status_time(pause, no_tiles);
 					progress.set_update();
@@ -414,16 +415,20 @@ void Session::run_cpu()
 void Session::run()
 {
 	/* load kernels */
-	progress.set_status("Loading render kernels (may take a few minutes the first time)");
+	if(!kernels_loaded) {
+		progress.set_status("Loading render kernels (may take a few minutes the first time)");
 
-	if(!device->load_kernels(params.experimental)) {
-		string message = device->error_message();
-		if(message == "")
-			message = "Failed loading render kernel, see console for errors";
+		if(!device->load_kernels(params.experimental)) {
+			string message = device->error_message();
+			if(message == "")
+				message = "Failed loading render kernel, see console for errors";
 
-		progress.set_status("Error", message);
-		progress.set_update();
-		return;
+			progress.set_status("Error", message);
+			progress.set_update();
+			return;
+		}
+
+		kernels_loaded = true;
 	}
 
 	/* session thread loop */
@@ -468,7 +473,7 @@ void Session::reset_(BufferParams& buffer_params, int samples)
 	sample = 0;
 
 	if(!params.background)
-		progress.set_start_time(start_time - paused_time);
+		progress.set_start_time(start_time + paused_time);
 }
 
 void Session::reset(BufferParams& buffer_params, int samples)
diff --git a/intern/cycles/render/session.h b/intern/cycles/render/session.h
index a662948..90616f0 100644
--- a/intern/cycles/render/session.h
+++ b/intern/cycles/render/session.h
@@ -156,6 +156,8 @@ protected:
 	thread_condition_variable pause_cond;
 	thread_mutex pause_mutex;
 
+	bool kernels_loaded;
+
 	double start_time;
 	double reset_time;
 	double preview_time;
diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp
index 12968a7..c1f7b35 100644
--- a/intern/cycles/render/shader.cpp
+++ b/intern/cycles/render/shader.cpp
@@ -256,6 +256,33 @@ void ShaderManager::add_default(Scene *scene)
 		scene->shaders.push_back(shader);
 		scene->default_background = scene->shaders.size() - 1;
 	}
+
+	/* default holdout */
+	{
+		graph = new ShaderGraph();
+
+		closure = graph->add(new HoldoutNode());
+		out = graph->output();
+
+		graph->connect(closure->output("Holdout"), out->input("Surface"));
+
+		shader = new Shader();
+		shader->name = "default_holdout";
+		shader->graph = graph;
+		scene->shaders.push_back(shader);
+		scene->default_holdout = scene->shaders.size() - 1;
+	}
+
+	/* default empty */
+	{
+		graph = new ShaderGraph();
+
+		shader = new Shader();
+		shader->name = "default_empty";
+		shader->graph = graph;
+		scene->shaders.push_back(shader);
+		scene->default_empty = scene->shaders.size() - 1;
+	}
 }
 
 CCL_NAMESPACE_END
diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp
index ae666dd..a52e30c 100644
--- a/intern/cycles/render/svm.cpp
+++ b/intern/cycles/render/svm.cpp
@@ -161,6 +161,14 @@ int SVMCompiler::stack_find_offset(ShaderSocketType type)
 	return offset;
 }
 
+void SVMCompiler::stack_clear_offset(ShaderSocketType type, int offset)
+{
+	int size = stack_size(type);
+
+	for(int i = 0; i < size; i++)
+		active_stack.users[offset + i]--;
+}
+
 void SVMCompiler::stack_backup(StackBackup& backup, set<ShaderNode*>& done)
 {
 	backup.done = done;
@@ -261,11 +269,7 @@ void SVMCompiler::stack_clear_users(ShaderNode *node, set<ShaderNode*>& done)
 					all_done = false;
 
 			if(all_done) {
-				int size = stack_size(output->type);
-
-				for(int i = 0; i < size; i++)
-					active_stack.users[output->stack_offset + i]--;
-
+				stack_clear_offset(output->type, output->stack_offset);
 				output->stack_offset = SVM_STACK_INVALID;
 
 				foreach(ShaderInput *in, output->links)
@@ -279,11 +283,7 @@ void SVMCompiler::stack_clear_temporary(ShaderNode *node)
 {
 	foreach(ShaderInput *input, node->inputs) {
 		if(!input->link && input->stack_offset != SVM_STACK_INVALID) {
-			int size = stack_size(input->type);
-
-			for(int i = 0; i < size; i++)
-				active_stack.users[input->stack_offset + i]--;
-
+			stack_clear_offset(input->type, input->stack_offset);
 			input->stack_offset = SVM_STACK_INVALID;
 		}
 	}
@@ -326,6 +326,12 @@ void SVMCompiler::add_node(const float4& f)
 		__float_as_int(f.w)));
 }
 
+void SVMCompiler::add_array(float4 *f, int num)
+{
+	for(int i = 0; i < num; i++)
+		add_node(f[i]);
+}
+
 uint SVMCompiler::attribute(ustring name)
 {
 	return shader_manager->get_attribute_id(name);
@@ -514,14 +520,14 @@ void SVMCompiler::generate_multi_closure(ShaderNode *node, set<ShaderNode*>& don
 			generate_multi_closure(cl1in->link->parent, done, out1_offset);
 
 			if(fin)
-				active_stack.users[out1_offset]--;
+				stack_clear_offset(SHADER_SOCKET_FLOAT, out1_offset);
 		}
 
 		if(cl2in->link) {
 			generate_multi_closure(cl2in->link->parent, done, out2_offset);
 
 			if(fin)
-				active_stack.users[out2_offset]--;
+				stack_clear_offset(SHADER_SOCKET_FLOAT, out2_offset);
 		}
 	}
 	else {
diff --git a/intern/cycles/render/svm.h b/intern/cycles/render/svm.h
index d66d381..56c930f 100644
--- a/intern/cycles/render/svm.h
+++ b/intern/cycles/render/svm.h
@@ -59,11 +59,15 @@ public:
 
 	void stack_assign(ShaderOutput *output);
 	void stack_assign(ShaderInput *input);
+	int stack_find_offset(ShaderSocketType type);
+	void stack_clear_offset(ShaderSocketType type, int offset);
 	void stack_link(ShaderInput *input, ShaderOutput *output);
+
 	void add_node(NodeType type, int a = 0, int b = 0, int c = 0);
 	void add_node(int a = 0, int b = 0, int c = 0, int d = 0);
 	void add_node(NodeType type, const float3& f);
 	void add_node(const float4& f);
+	void add_array(float4 *f, int num);
 	uint attribute(ustring name);
 	uint attribute(Attribute::Standard std);
 	uint encode_uchar4(uint x, uint y = 0, uint z = 0, uint w = 0);
@@ -115,7 +119,6 @@ protected:
 
 	void stack_clear_temporary(ShaderNode *node);
 	int stack_size(ShaderSocketType type);
-	int stack_find_offset(ShaderSocketType type);
 	void stack_clear_users(ShaderNode *node, set<ShaderNode*>& done);
 
 	bool node_skip_input(ShaderNode *node, ShaderInput *input);
diff --git a/intern/cycles/subd/subd_dice.cpp b/intern/cycles/subd/subd_dice.cpp
index 086b7b2..6b29d1c 100644
--- a/intern/cycles/subd/subd_dice.cpp
+++ b/intern/cycles/subd/subd_dice.cpp
@@ -141,7 +141,7 @@ float3 QuadDice::eval_projected(SubPatch& sub, float u, float v)
 
 	sub.patch->eval(&P, NULL, NULL, uv.x, uv.y);
 	if(camera)
-		P = transform(&camera->worldtoraster, P);
+		P = transform_perspective(&camera->worldtoraster, P);
 
 	return P;
 }
diff --git a/intern/cycles/subd/subd_dice.h b/intern/cycles/subd/subd_dice.h
index 71879f1..41b4902 100644
--- a/intern/cycles/subd/subd_dice.h
+++ b/intern/cycles/subd/subd_dice.h
@@ -19,8 +19,8 @@
 #ifndef __SUBD_DICE_H__
 #define __SUBD_DICE_H__
 
-/* DX11 like EdgeDice implementation, with different tesselation factors for
- * each edge for watertight tesselation, with subpatch remapping to work with
+/* DX11 like EdgeDice implementation, with different tessellation factors for
+ * each edge for watertight tessellation, with subpatch remapping to work with
  * DiagSplit. For more algorithm details, see the DiagSplit paper or the
  * ARB_tessellation_shader OpenGL extension, Section 2.X.2. */
 
@@ -59,7 +59,7 @@ public:
 
 /* Quad EdgeDice
  *
- * Edge tesselation factors and subpatch coordinates are as follows:
+ * Edge tessellation factors and subpatch coordinates are as follows:
  *
  *            tu1
  *     P01 --------- P11 
@@ -115,7 +115,7 @@ public:
 
 /* Triangle EdgeDice
  *
- * Edge tesselation factors and subpatch coordinates are as follows:
+ * Edge tessellation factors and subpatch coordinates are as follows:
  *
  *        Pw
  *        /\
diff --git a/intern/cycles/subd/subd_mesh.cpp b/intern/cycles/subd/subd_mesh.cpp
index 3e6e0de..becd5b9 100644
--- a/intern/cycles/subd/subd_mesh.cpp
+++ b/intern/cycles/subd/subd_mesh.cpp
@@ -285,7 +285,7 @@ void SubdMesh::link_boundary_edge(SubdEdge *edge)
 		edge->vert->edge = edge;
 }
 
-void SubdMesh::tesselate(DiagSplit *split, bool linear, Mesh *mesh, int shader, bool smooth)
+void SubdMesh::tessellate(DiagSplit *split, bool linear, Mesh *mesh, int shader, bool smooth)
 {
 	SubdBuilder *builder = SubdBuilder::create(linear);
 	int num_faces = faces.size();
diff --git a/intern/cycles/subd/subd_mesh.h b/intern/cycles/subd/subd_mesh.h
index 999d92d..e4bd5f1 100644
--- a/intern/cycles/subd/subd_mesh.h
+++ b/intern/cycles/subd/subd_mesh.h
@@ -61,7 +61,7 @@ public:
 	SubdFace *add_face(int *index, int num);
 
 	bool link_boundary();
-	void tesselate(DiagSplit *split, bool linear,
+	void tessellate(DiagSplit *split, bool linear,
 		Mesh *mesh, int shader, bool smooth);
 
 protected:
diff --git a/intern/cycles/subd/subd_split.cpp b/intern/cycles/subd/subd_split.cpp
index d61a42e..f0b8720 100644
--- a/intern/cycles/subd/subd_split.cpp
+++ b/intern/cycles/subd/subd_split.cpp
@@ -57,7 +57,7 @@ float3 DiagSplit::project(Patch *patch, float2 uv)
 
 	patch->eval(&P, NULL, NULL, uv.x, uv.y);
 	if(camera)
-		P = transform(&camera->worldtoraster, P);
+		P = transform_perspective(&camera->worldtoraster, P);
 
 	return P;
 }
diff --git a/intern/cycles/subd/subd_split.h b/intern/cycles/subd/subd_split.h
index 8ec5d24..b035851 100644
--- a/intern/cycles/subd/subd_split.h
+++ b/intern/cycles/subd/subd_split.h
@@ -20,7 +20,7 @@
 #define __SUBD_SPLIT_H__
 
 /* DiagSplit: Parallel, Crack-free, Adaptive Tessellation for Micropolygon Rendering
- * Splits up patches and determines edge tesselation factors for dicing. Patch
+ * Splits up patches and determines edge tessellation factors for dicing. Patch
  * evaluation at arbitrary points is required for this to work. See the paper
  * for more details. */
 
diff --git a/intern/cycles/util/util_boundbox.h b/intern/cycles/util/util_boundbox.h
index 0114a9a..bb1df0b 100644
--- a/intern/cycles/util/util_boundbox.h
+++ b/intern/cycles/util/util_boundbox.h
@@ -76,8 +76,8 @@ public:
 	bool valid(void) const
 	{
 		return (min.x <= max.x) && (min.y <= max.y) && (min.z <= max.z) &&
-		       !(isnan(min.x) || isnan(min.y) || isnan(min.z)) &&
-		       !(isnan(max.x) || isnan(max.y) || isnan(max.z));
+		       (isfinite(min.x) && isfinite(min.y) && isfinite(min.z)) &&
+		       (isfinite(max.x) && isfinite(max.y) && isfinite(max.z));
 	}
 
 	BoundBox transformed(const Transform *tfm)
@@ -91,7 +91,7 @@ public:
 			p.y = (i & 2)? min.y: max.y;
 			p.z = (i & 4)? min.z: max.z;
 
-			result.grow(transform(tfm, p));
+			result.grow(transform_point(tfm, p));
 		}
 
 		return result;
diff --git a/intern/cycles/util/util_cuda.h b/intern/cycles/util/util_cuda.h
index 3674c65..ffc71b8 100644
--- a/intern/cycles/util/util_cuda.h
+++ b/intern/cycles/util/util_cuda.h
@@ -204,7 +204,8 @@ typedef enum CUjit_target_enum
     CU_TARGET_COMPUTE_12,
     CU_TARGET_COMPUTE_13,
     CU_TARGET_COMPUTE_20,
-    CU_TARGET_COMPUTE_21
+    CU_TARGET_COMPUTE_21,
+    CU_TARGET_COMPUTE_30
 } CUjit_target;
 
 typedef enum CUjit_fallback_enum
diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h
index 0a1d8ff..019dede 100644
--- a/intern/cycles/util/util_math.h
+++ b/intern/cycles/util/util_math.h
@@ -38,6 +38,8 @@
 
 CCL_NAMESPACE_BEGIN
 
+/* Float Pi variations */
+
 #ifndef M_PI_F
 #define M_PI_F		((float)3.14159265358979323846264338327950288)
 #endif
@@ -64,10 +66,13 @@ CCL_NAMESPACE_BEGIN
 #define copysignf(x, y) ((float)_copysign(x, y))
 #define hypotf(x, y) _hypotf(x, y)
 #define isnan(x) _isnan(x)
+#define isfinite(x) _finite(x)
 #endif
 
 #endif
 
+#ifndef __KERNEL_OPENCL__
+
 __device_inline float fmaxf(float a, float b)
 {
 	return (a > b)? a: b;
@@ -80,6 +85,8 @@ __device_inline float fminf(float a, float b)
 
 #endif
 
+#endif
+
 #ifndef __KERNEL_GPU__
 
 __device_inline int max(int a, int b)
@@ -799,6 +806,19 @@ __device_inline void make_orthonormals(const float3 N, float3 *a, float3 *b)
 	*b = cross(N, *a);
 }
 
+/* Color division */
+
+__device_inline float3 safe_divide_color(float3 a, float3 b)
+{
+	float x, y, z;
+
+	x = (b.x != 0.0f)? a.x/b.x: 0.0f;
+	y = (b.y != 0.0f)? a.y/b.y: 0.0f;
+	z = (b.z != 0.0f)? a.z/b.z: 0.0f;
+
+	return make_float3(x, y, z);
+}
+
 CCL_NAMESPACE_END
 
 #endif /* __UTIL_MATH_H__ */
diff --git a/intern/cycles/util/util_opencl.cpp b/intern/cycles/util/util_opencl.cpp
index 1d05b0b..4087c2c 100644
--- a/intern/cycles/util/util_opencl.cpp
+++ b/intern/cycles/util/util_opencl.cpp
@@ -235,6 +235,9 @@ int clLibraryInit()
     __clewEnqueueBarrier                = (PFNCLENQUEUEBARRIER              )CLCC_DYNLIB_IMPORT(module, "clEnqueueBarrier");
     __clewGetExtensionFunctionAddress   = (PFNCLGETEXTENSIONFUNCTIONADDRESS )CLCC_DYNLIB_IMPORT(module, "clGetExtensionFunctionAddress");
 
+	if(__clewGetPlatformIDs == NULL)
+		return 0;
+
     return 1;
 }
 
diff --git a/intern/cycles/util/util_transform.cpp b/intern/cycles/util/util_transform.cpp
index 8c5eac2..61bc36a 100644
--- a/intern/cycles/util/util_transform.cpp
+++ b/intern/cycles/util/util_transform.cpp
@@ -134,8 +134,16 @@ Transform transform_inverse(const Transform& tfm)
 	R.T = transform_identity();
 	M.T = tfm;
 
-	if(!transform_matrix4_gj_inverse(R.M, M.M))
-		return transform_identity();
+	if(!transform_matrix4_gj_inverse(R.M, M.M)) {
+		/* matrix is degenerate (e.g. 0 scale on some axis), ideally we should
+		   never be in this situation, but try to invert it anyway with tweak */
+		M.M[0][0] += 1e-8f;
+		M.M[1][1] += 1e-8f;
+		M.M[2][2] += 1e-8f;
+
+		if(!transform_matrix4_gj_inverse(R.M, M.M))
+			return transform_identity();
+	}
 
 	return R.T;
 }
diff --git a/intern/cycles/util/util_transform.h b/intern/cycles/util/util_transform.h
index 07db52f..aeaef7b 100644
--- a/intern/cycles/util/util_transform.h
+++ b/intern/cycles/util/util_transform.h
@@ -37,7 +37,7 @@ typedef struct Transform {
 #endif
 } Transform;
 
-__device_inline float3 transform(const Transform *t, const float3 a)
+__device_inline float3 transform_perspective(const Transform *t, const float3 a)
 {
 	float4 b = make_float4(a.x, a.y, a.z, 1.0f);
 	float3 c = make_float3(dot(t->x, b), dot(t->y, b), dot(t->z, b));
@@ -46,6 +46,14 @@ __device_inline float3 transform(const Transform *t, const float3 a)
 	return (w != 0.0f)? c/w: make_float3(0.0f, 0.0f, 0.0f);
 }
 
+__device_inline float3 transform_point(const Transform *t, const float3 a)
+{
+	float4 b = make_float4(a.x, a.y, a.z, 1.0f);
+	float3 c = make_float3(dot(t->x, b), dot(t->y, b), dot(t->z, b));
+
+	return c;
+}
+
 __device_inline float3 transform_direction(const Transform *t, const float3 a)
 {
 	float4 b = make_float4(a.x, a.y, a.z, 0.0f);
diff --git a/intern/decimation/extern/LOD_decimation.h b/intern/decimation/extern/LOD_decimation.h
index 1c31e98..4c52cb1 100644
--- a/intern/decimation/extern/LOD_decimation.h
+++ b/intern/decimation/extern/LOD_decimation.h
@@ -38,8 +38,8 @@
  * This is the external interface for the decimation module.
  */
 
-#ifndef NAN_INCLUDED_LOD_decimation_h
-#define NAN_INCLUDED_LOD_decimation_h
+#ifndef __LOD_DECIMATION_H__
+#define __LOD_DECIMATION_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -113,5 +113,5 @@ extern int LOD_FreeDecimationData(LOD_Decimation_InfoPtr);
 }
 #endif
 
-#endif // NAN_INCLUDED_LOD_decimation_h
+#endif // __LOD_DECIMATION_H__
 
diff --git a/intern/decimation/intern/LOD_DecimationClass.h b/intern/decimation/intern/LOD_DecimationClass.h
index a91db1a..ecf2e4e 100644
--- a/intern/decimation/intern/LOD_DecimationClass.h
+++ b/intern/decimation/intern/LOD_DecimationClass.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NAN_INCLUDED_LOD_DecimationClass_h
-#define NAN_INCLUDED_LOD_DecimationClass_h
+#ifndef __LOD_DECIMATIONCLASS_H__
+#define __LOD_DECIMATIONCLASS_H__
 
 #include "MEM_SmartPtr.h"
 #include "MEM_NonCopyable.h"
diff --git a/intern/decimation/intern/LOD_EdgeCollapser.cpp b/intern/decimation/intern/LOD_EdgeCollapser.cpp
index 5d188ee..1405d6f 100644
--- a/intern/decimation/intern/LOD_EdgeCollapser.cpp
+++ b/intern/decimation/intern/LOD_EdgeCollapser.cpp
@@ -57,7 +57,7 @@ TJunctionTest(
 	LOD_EdgeInd collapse_edge
 ){
 
-	// we need to copy the egdes in e_v0v1 from the mesh
+	// 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();
diff --git a/intern/decimation/intern/LOD_EdgeCollapser.h b/intern/decimation/intern/LOD_EdgeCollapser.h
index ae4e907..75a8b70 100644
--- a/intern/decimation/intern/LOD_EdgeCollapser.h
+++ b/intern/decimation/intern/LOD_EdgeCollapser.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NAN_INCLDUED_EgdeCollapser_h
-#define NAN_INCLDUED_EgdeCollapser_h
+#ifndef __LOD_EDGECOLLAPSER_H__
+#define __LOD_EDGECOLLAPSER_H__
 
 // This is a helper class that collapses edges of a 2 - manifold mesh.
 
diff --git a/intern/decimation/intern/LOD_ExternBufferEditor.h b/intern/decimation/intern/LOD_ExternBufferEditor.h
index 3d76657..c903b25 100644
--- a/intern/decimation/intern/LOD_ExternBufferEditor.h
+++ b/intern/decimation/intern/LOD_ExternBufferEditor.h
@@ -35,8 +35,8 @@
  * Copyright (C) 2001 NaN Technologies B.V.
  */
 
-#ifndef NAN_INCLUDED_LOD_ExternBufferEditor_h
-#define NAN_INCLUDED_LOD_ExternBufferEditor_h
+#ifndef __LOD_EXTERNBUFFEREDITOR_H__
+#define __LOD_EXTERNBUFFEREDITOR_H__
 
 #include "LOD_MeshPrimitives.h"
 #include <vector>
diff --git a/intern/decimation/intern/LOD_ExternNormalEditor.h b/intern/decimation/intern/LOD_ExternNormalEditor.h
index 491ccca..5213519 100644
--- a/intern/decimation/intern/LOD_ExternNormalEditor.h
+++ b/intern/decimation/intern/LOD_ExternNormalEditor.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NAN_INCLUDED_ExternNormalEditor_h
-#define NAN_INCLUDED_ExternNormalEditor_h
+#ifndef __LOD_EXTERNNORMALEDITOR_H__
+#define __LOD_EXTERNNORMALEDITOR_H__
 
 #include "MEM_NonCopyable.h"
 #include "LOD_ManMesh2.h"
@@ -122,7 +122,7 @@ private :
 		MT_Vector3 
 	ComputeNormal(
 		const LOD_TriFace &face
-	) const ;
+	) const;
 
 	const 
 		MT_Vector3
diff --git a/intern/decimation/intern/LOD_FaceNormalEditor.h b/intern/decimation/intern/LOD_FaceNormalEditor.h
index 6fd65e3..a221ab0 100644
--- a/intern/decimation/intern/LOD_FaceNormalEditor.h
+++ b/intern/decimation/intern/LOD_FaceNormalEditor.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NAN_INCLUDED_FaceNormalEditor_h
-#define NAN_INCLUDED_FaceNormalEditor_h
+#ifndef __LOD_FACENORMALEDITOR_H__
+#define __LOD_FACENORMALEDITOR_H__
 
 #include "MEM_NonCopyable.h"
 #include "LOD_ManMesh2.h"
@@ -128,7 +128,7 @@ private :
 		MT_Vector3 
 	ComputeNormal(
 		const LOD_TriFace &face
-	) const ;
+	) const;
 
 	const 
 		MT_Vector3
diff --git a/intern/decimation/intern/LOD_ManMesh2.h b/intern/decimation/intern/LOD_ManMesh2.h
index 1377a40..5d4e1af 100644
--- a/intern/decimation/intern/LOD_ManMesh2.h
+++ b/intern/decimation/intern/LOD_ManMesh2.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NAN_INCLUDED_ManMesh2_h
-#define NAN_INCLUDED_ManMesh2_h
+#ifndef __LOD_MANMESH2_H__
+#define __LOD_MANMESH2_H__
 
 #include "LOD_MeshPrimitives.h"
 #include "MEM_SmartPtr.h"
@@ -76,11 +76,11 @@ public:
 
 		std::vector<LOD_Vertex> &
 	VertexSet(
-	) const ;		
+	) const;
 
 		std::vector<LOD_TriFace> &
 	FaceSet(
-	) const ;
+	) const;
 
 		std::vector<LOD_Edge> &
 	EdgeSet(
diff --git a/intern/decimation/intern/LOD_MeshBounds.h b/intern/decimation/intern/LOD_MeshBounds.h
index 116c32e..c95e6c7 100644
--- a/intern/decimation/intern/LOD_MeshBounds.h
+++ b/intern/decimation/intern/LOD_MeshBounds.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NAN_INCLUDED_MeshBounds_h
-#define NAN_INCLUDED_MeshBounds_h
+#ifndef __LOD_MESHBOUNDS_H__
+#define __LOD_MESHBOUNDS_H__
 
 #include "MEM_SmartPtr.h"
 #include "LOD_MeshPrimitives.h"
diff --git a/intern/decimation/intern/LOD_MeshException.h b/intern/decimation/intern/LOD_MeshException.h
index 15a8877..67bd818 100644
--- a/intern/decimation/intern/LOD_MeshException.h
+++ b/intern/decimation/intern/LOD_MeshException.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NAN_INCLUDED_MeshExceptions_h
-#define NAN_INCLUDED_MeshExceptions_h
+#ifndef __LOD_MESHEXCEPTION_H__
+#define __LOD_MESHEXCEPTION_H__
 
 class LOD_MeshException {
 
diff --git a/intern/decimation/intern/LOD_MeshPrimitives.h b/intern/decimation/intern/LOD_MeshPrimitives.h
index e863f27..ea2d157 100644
--- a/intern/decimation/intern/LOD_MeshPrimitives.h
+++ b/intern/decimation/intern/LOD_MeshPrimitives.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NAN_INCLUDED_MeshPrimitives_h
-#define NAN_INCLUDED_MeshPrimitives_h
+#ifndef __LOD_MESHPRIMITIVES_H__
+#define __LOD_MESHPRIMITIVES_H__
 
 #include "MT_Vector3.h"
 #include "CTR_TaggedIndex.h"
@@ -50,7 +50,7 @@ public :
 	bool m_select_tag;
 
 	LOD_Vertex(
-	) ;
+	);
 
 		bool
 	RemoveEdge(
@@ -109,13 +109,13 @@ public :
 		LOD_FaceInd
 	OpFace(
 		LOD_FaceInd f
-	) const ;
+	) const;
 
 		void
 	SwapFace(
 		LOD_FaceInd old_f,
 		LOD_FaceInd new_f
-	) ;
+	);
 
 
 	// return the half edge face - the half edge is defined
@@ -139,11 +139,11 @@ public :
 	SwapVertex(
 		LOD_VertexInd v_old,
 		LOD_VertexInd v_new
-	) ;			
+	);
 
 		bool
 	SelectTag(
-	) const ;
+	) const;
 
 		void
 	SetSelectTag(
@@ -157,7 +157,7 @@ public :
 		void
 	SetOpenTag(
 		int tag
-	) ;
+	);
 
 		bool
 	Degenerate(
diff --git a/intern/decimation/intern/LOD_QSDecimator.cpp b/intern/decimation/intern/LOD_QSDecimator.cpp
index 381571a..bdcf795 100644
--- a/intern/decimation/intern/LOD_QSDecimator.cpp
+++ b/intern/decimation/intern/LOD_QSDecimator.cpp
@@ -265,8 +265,10 @@ BuildHeap(
 	// load in edge pointers to the heap
 
 	std::vector<LOD_Edge> & edge_set= m_mesh.EdgeSet();
-	std::vector<LOD_Edge>::const_iterator edge_end = edge_set.end();
-	std::vector<LOD_Edge>::iterator edge_start = edge_set.begin();
+
+	// 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();
 
diff --git a/intern/decimation/intern/LOD_QSDecimator.h b/intern/decimation/intern/LOD_QSDecimator.h
index d471186..2ac2239 100644
--- a/intern/decimation/intern/LOD_QSDecimator.h
+++ b/intern/decimation/intern/LOD_QSDecimator.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NAN_INCLUDED_LOD_QSDecimator_H
-#define NAN_INCLUDED_LOD_QSDecimator_H
+#ifndef __LOD_QSDECIMATOR_H__
+#define __LOD_QSDECIMATOR_H__
 
 #include "MEM_NonCopyable.h"
 #include "LOD_ManMesh2.h"
diff --git a/intern/decimation/intern/LOD_Quadric.h b/intern/decimation/intern/LOD_Quadric.h
index cb7846d..9dde050 100644
--- a/intern/decimation/intern/LOD_Quadric.h
+++ b/intern/decimation/intern/LOD_Quadric.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NAN_INCLUDED_LOD_Quadric_h
-#define NAN_INCLUDED_LOD_Quadric_h
+#ifndef __LOD_QUADRIC_H__
+#define __LOD_QUADRIC_H__
 
 #include "MT_Vector3.h"
 #include "MT_Matrix3x3.h"
diff --git a/intern/decimation/intern/LOD_QuadricEditor.h b/intern/decimation/intern/LOD_QuadricEditor.h
index 0b0c7ee..0a66d29 100644
--- a/intern/decimation/intern/LOD_QuadricEditor.h
+++ b/intern/decimation/intern/LOD_QuadricEditor.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NAN_INCLUDED_LOD_QuadricEditor_h
-#define NAN_INCLUDED_LOD_QuadricEditor_h
+#ifndef __LOD_QUADRICEDITOR_H__
+#define __LOD_QUADRICEDITOR_H__
 
 #include "MEM_NonCopyable.h"
 #include "LOD_ManMesh2.h"
diff --git a/intern/decimation/intern/future/LOD_ExternVColorEditor.h b/intern/decimation/intern/future/LOD_ExternVColorEditor.h
index d0b9f72..e409e0d 100644
--- a/intern/decimation/intern/future/LOD_ExternVColorEditor.h
+++ b/intern/decimation/intern/future/LOD_ExternVColorEditor.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NAN_INCLUDED_ExternVColorEditor_h
-#define NAN_INCLUDED_ExternVColorEditor_h
+#ifndef __LOD_EXTERNVCOLOREDITOR_H__
+#define __LOD_EXTERNVCOLOREDITOR_H__
 
 #include "common/NonCopyable.h"
 #include "LOD_ManMesh2.h"
@@ -65,7 +65,7 @@ public :
 		MT_Vector3
 	IndexColor(
 		const LOD_VertexInd &v
-	) const ;
+	) const;
 
 	// Set the color for vertex v
 
diff --git a/intern/decimation/intern/future/LOD_NdQSDecimator.h b/intern/decimation/intern/future/LOD_NdQSDecimator.h
index 6c20adc..e7defac 100644
--- a/intern/decimation/intern/future/LOD_NdQSDecimator.h
+++ b/intern/decimation/intern/future/LOD_NdQSDecimator.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NAN_INCLUDED_LOD_NdQSDecimator_H
-#define NAN_INCLUDED_LOD_NdQSDecimator_H
+#ifndef __LOD_NDQSDECIMATOR_H__
+#define __LOD_NDQSDECIMATOR_H__
 
 #include "common/NonCopyable.h"
 #include "LOD_ManMesh2.h"
diff --git a/intern/decimation/intern/future/LOD_NdQuadric.h b/intern/decimation/intern/future/LOD_NdQuadric.h
index efe24fd..f9f03bb 100644
--- a/intern/decimation/intern/future/LOD_NdQuadric.h
+++ b/intern/decimation/intern/future/LOD_NdQuadric.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NAN_INCLUDED_LOD_NdQuardic_h
-#define NAN_INCLUDED_LOD_NdQuardic_h
+#ifndef __LOD_NDQUADRIC_H__
+#define __LOD_NDQUADRIC_H__
 
 // An N dimensional quadric form.
 ///////////////////////////////////
@@ -148,7 +148,7 @@ public :
 		bool 
 	Optimize(
 		TNT::Vector<MT_Scalar> & vec
-	) const ;
+	) const;
 
 	
 };
diff --git a/intern/decimation/intern/future/LOD_NdQuadricEditor.cpp b/intern/decimation/intern/future/LOD_NdQuadricEditor.cpp
index 212b71c..2566804 100644
--- a/intern/decimation/intern/future/LOD_NdQuadricEditor.cpp
+++ b/intern/decimation/intern/future/LOD_NdQuadricEditor.cpp
@@ -273,7 +273,7 @@ TargetVertex(
 		result[4] = c0[1];
 		result[5] = c0[2];
 
-		return ;
+		return;
 	}
 };
 
diff --git a/intern/decimation/intern/future/LOD_NdQuadricEditor.h b/intern/decimation/intern/future/LOD_NdQuadricEditor.h
index 25d483b..7e05fd5 100644
--- a/intern/decimation/intern/future/LOD_NdQuadricEditor.h
+++ b/intern/decimation/intern/future/LOD_NdQuadricEditor.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NAN_INCLUDED_LOD_NdQuadricEditor_h
-#define NAN_INCLUDED_LOD_NdQuadricEditor_h
+#ifndef __LOD_NDQUADRICEDITOR_H__
+#define __LOD_NDQUADRICEDITOR_H__
 
 #include "common/NonCopyable.h"
 #include "LOD_ManMesh2.h"
@@ -97,7 +97,7 @@ public :
 		const LOD_Edge & e,
 		TNT::Vector<MT_Scalar> &result,
 		const LOD_ExternVColorEditor & color_editor
-	) const ;
+	) const;
 
 	~LOD_NdQuadricEditor(
 	 ){
diff --git a/intern/decimation/test/decimate_glut_test/intern/GlutMeshDrawer.h b/intern/decimation/test/decimate_glut_test/intern/GlutMeshDrawer.h
index d4f94e4..0a01c49 100644
--- a/intern/decimation/test/decimate_glut_test/intern/GlutMeshDrawer.h
+++ b/intern/decimation/test/decimate_glut_test/intern/GlutMeshDrawer.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef NAN_INCLUDED_GlutMeshDrawer_h
-#define NAN_INCLUDED_GlutMeshDrawer_h
+#ifndef __GLUTMESHDRAWER_H__
+#define __GLUTMESHDRAWER_H__
 
 #include "common/GlutDrawer.h"
 #include "LOD_decimation.h"
diff --git a/intern/decimation/test/decimate_glut_test/intern/LOD_GhostTestApp.h b/intern/decimation/test/decimate_glut_test/intern/LOD_GhostTestApp.h
index b39c398..e58bfec 100644
--- a/intern/decimation/test/decimate_glut_test/intern/LOD_GhostTestApp.h
+++ b/intern/decimation/test/decimate_glut_test/intern/LOD_GhostTestApp.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef LOD_GhostTestApp_h
-#define LOD_GhostTestApp_h
+#ifndef __LOD_GHOSTTESTAPP_H__
+#define __LOD_GHOSTTESTAPP_H__
 
 #include "GHOST_IEventConsumer.h"
 #include "MT_Vector3.h"
diff --git a/intern/decimation/test/decimate_glut_test/intern/MyGlutKeyHandler.h b/intern/decimation/test/decimate_glut_test/intern/MyGlutKeyHandler.h
index bf6f146..950a173 100644
--- a/intern/decimation/test/decimate_glut_test/intern/MyGlutKeyHandler.h
+++ b/intern/decimation/test/decimate_glut_test/intern/MyGlutKeyHandler.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef NAN_INCLUDED_MyGlutKeyHandler_h
-#define NAN_INCLUDED_MyGlutKeyHandler_h
+#ifndef __MYGLUTKEYHANDLER_H__
+#define __MYGLUTKEYHANDLER_H__
 
 #include "common/GlutKeyboardManager.h"
 #include "LOD_decimation.h"
diff --git a/intern/decimation/test/decimate_glut_test/intern/MyGlutMouseHandler.h b/intern/decimation/test/decimate_glut_test/intern/MyGlutMouseHandler.h
index 7dd72b0..df7da2e 100644
--- a/intern/decimation/test/decimate_glut_test/intern/MyGlutMouseHandler.h
+++ b/intern/decimation/test/decimate_glut_test/intern/MyGlutMouseHandler.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef NAN_INCLUDED_MyGlutMouseHandler_h
-#define NAN_INCLUDED_MyGlutMouseHandler_h
+#ifndef __MYGLUTMOUSEHANDLER_H__
+#define __MYGLUTMOUSEHANDLER_H__
 
 #include "common/GlutMouseManager.h"
 #include "GHOST_IWindow.h"
diff --git a/intern/decimation/test/decimate_glut_test/intern/common/GlutDrawer.h b/intern/decimation/test/decimate_glut_test/intern/common/GlutDrawer.h
index c95d96e..c7fc187 100644
--- a/intern/decimation/test/decimate_glut_test/intern/common/GlutDrawer.h
+++ b/intern/decimation/test/decimate_glut_test/intern/common/GlutDrawer.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef NAN_INCLUDED_GlutDrawer
-#define NAN_INCLUDED_GlutDrawer
+#ifndef __GLUTDRAWER_H__
+#define __GLUTDRAWER_H__
 
 #include "MEM_NonCopyable.h"
 #include "MEM_SmartPtr.h"
diff --git a/intern/decimation/test/decimate_glut_test/intern/common/GlutKeyboardManager.h b/intern/decimation/test/decimate_glut_test/intern/common/GlutKeyboardManager.h
index 1c37022..0c400dd 100644
--- a/intern/decimation/test/decimate_glut_test/intern/common/GlutKeyboardManager.h
+++ b/intern/decimation/test/decimate_glut_test/intern/common/GlutKeyboardManager.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef NAN_INCLUDED_GlutKeyboardManager
-#define NAN_INCLUDED_GlutKeyboardManager
+#ifndef __GLUTKEYBOARDMANAGER_H__
+#define __GLUTKEYBOARDMANAGER_H__
 
 #include "MEM_NonCopyable.h"
 #include "MEM_SmartPtr.h"
diff --git a/intern/decimation/test/decimate_glut_test/intern/common/GlutMouseManager.h b/intern/decimation/test/decimate_glut_test/intern/common/GlutMouseManager.h
index 8c93c64..ce91708 100644
--- a/intern/decimation/test/decimate_glut_test/intern/common/GlutMouseManager.h
+++ b/intern/decimation/test/decimate_glut_test/intern/common/GlutMouseManager.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef NAN_INCLUDED_GlutMouseManager_h
-#define NAN_INCLUDED_GlutMouseManager_h
+#ifndef __GLUTMOUSEMANAGER_H__
+#define __GLUTMOUSEMANAGER_H__
 
 #include "MEM_NonCopyable.h"
 #include "MEM_SmartPtr.h"
diff --git a/intern/dualcon/dualcon.h b/intern/dualcon/dualcon.h
index 9346adc..53135a7 100644
--- a/intern/dualcon/dualcon.h
+++ b/intern/dualcon/dualcon.h
@@ -20,8 +20,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef DUALCON_H
-#define DUALCON_H
+#ifndef __DUALCON_H__
+#define __DUALCON_H__
 
 #ifdef __cplusplus
 extern "C" { 
@@ -92,4 +92,4 @@ void *dualcon(const DualConInput *input_mesh,
 } 
 #endif
 
-#endif
+#endif /* __DUALCON_H__ */
diff --git a/intern/dualcon/intern/MemoryAllocator.h b/intern/dualcon/intern/MemoryAllocator.h
index de9dca1..a1be097 100644
--- a/intern/dualcon/intern/MemoryAllocator.h
+++ b/intern/dualcon/intern/MemoryAllocator.h
@@ -43,8 +43,8 @@
 class VirtualMemoryAllocator
 {
 public:
-	virtual UCHAR * allocate( ) = 0 ;
-	virtual void deallocate( UCHAR * obj ) = 0 ;
+	virtual void * allocate( ) = 0 ;
+	virtual void deallocate( void * obj ) = 0 ;
 	virtual void destroy( ) = 0 ;
 	virtual void printInfo( ) = 0 ;
 
@@ -161,7 +161,7 @@ public:
 	/**
 	 * Allocation method
 	 */
-	UCHAR * allocate ( )
+	void * allocate ( )
 	{
 		if ( available == 0 )
 		{
@@ -170,13 +170,13 @@ public:
 
 		// printf("Allocating %d\n", header[ allocated ]) ;
 		available -- ;
-		return stack[ available >> HEAP_BASE ][ available & HEAP_MASK ] ;
+		return (void*)stack[ available >> HEAP_BASE ][ available & HEAP_MASK ] ;
 	}
 
 	/**
 	 * De-allocation method
 	 */
-	void deallocate ( UCHAR * obj )
+	void deallocate ( void * obj )
 	{
 		if ( available == stacksize )
 		{
@@ -184,7 +184,7 @@ public:
 		}
 
 		// printf("De-allocating %d\n", ( obj - data ) / N ) ;
-		stack[ available >> HEAP_BASE ][ available & HEAP_MASK ] = obj ;
+		stack[ available >> HEAP_BASE ][ available & HEAP_MASK ] = (UCHAR*)obj ;
 		available ++ ;
 		// printf("%d %d\n", allocated, header[ allocated ]) ;
 	}
diff --git a/intern/dualcon/intern/Projections.h b/intern/dualcon/intern/Projections.h
index a01b4df..18533b2 100644
--- a/intern/dualcon/intern/Projections.h
+++ b/intern/dualcon/intern/Projections.h
@@ -30,6 +30,7 @@
 #define GRID_DIMENSION 20
 
 #if defined(_WIN32) && !defined(__MINGW32__)
+#define isnan(n) _isnan(n)
 #define LONG __int64
 #else
 #include <stdint.h>
diff --git a/intern/dualcon/intern/dualcon_c_api.cpp b/intern/dualcon/intern/dualcon_c_api.cpp
index d710ada..af5ada7 100644
--- a/intern/dualcon/intern/dualcon_c_api.cpp
+++ b/intern/dualcon/intern/dualcon_c_api.cpp
@@ -26,6 +26,11 @@
 #include "octree.h"
 
 #include <cstdio>
+#include <float.h>
+
+#if defined(_WIN32) && !defined(__MINGW32__)
+#define isnan(n) _isnan(n)
+#endif
 
 void veccopy(float dst[3], const float src[3])
 {
@@ -113,6 +118,15 @@ public:
 			curface++;
 		}
 
+		/* remove triangle if it contains invalid coords */
+		for(int i = 0; i < 3; i++) {
+			const float *co = t->vt[i];
+			if(isnan(co[0]) || isnan(co[1]) || isnan(co[2])) {
+				delete t;
+				return getNextTriangle();
+			}
+		}
+
 		return t;
 	}
 
diff --git a/intern/dualcon/intern/octree.cpp b/intern/dualcon/intern/octree.cpp
index 90dbf53..38b130f 100644
--- a/intern/dualcon/intern/octree.cpp
+++ b/intern/dualcon/intern/octree.cpp
@@ -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): Tao Ju
+ * Contributor(s): Tao Ju, Nicholas Bishop
  *
  * ***** END GPL LICENSE BLOCK *****
  */
@@ -42,12 +42,12 @@
 #define dc_printf(...) do {} while(0)
 #endif
 
-Octree::Octree( ModelReader* mr,
+Octree::Octree(ModelReader* mr,
 				DualConAllocOutput alloc_output_func,
 				DualConAddVert add_vert_func,
 				DualConAddQuad add_quad_func,
 				DualConFlags flags, DualConMode dualcon_mode, int depth,
-				float threshold, float sharpness )
+				float threshold, float sharpness)
 	: use_flood_fill(flags & DUALCON_FLOOD_FILL),
 	  /* note on `use_manifold':
 		 
@@ -72,956 +72,574 @@ Octree::Octree( ModelReader* mr,
 	  add_vert(add_vert_func),
 	  add_quad(add_quad_func)
 {
-	this->thresh = threshold ;
-	this->reader = mr ;
-	this->dimen = 1 << GRID_DIMENSION ;
-	this->range = reader->getBoundingBox( this->origin ) ;
-	this->nodeCount = this->nodeSpace = 0;
-	this->maxDepth = depth ;
-	this->mindimen = ( dimen >> maxDepth ) ;
-	this->minshift = ( GRID_DIMENSION - maxDepth ) ;
-	this->buildTable( ) ;
-
-	flood_bytes = use_flood_fill ? FLOOD_FILL_BYTES : 0;
-	leaf_extra_bytes = flood_bytes + CINDY_BYTES;
-
-#ifdef USE_HERMIT
-	leaf_node_bytes = 7 + leaf_extra_bytes;
-#else
-	leaf_node_bytes = 3 + leaf_extra_bytes;
-#endif
-
-#ifdef QIANYI
-	dc_printf("Origin: (%f %f %f), Dimension: %f\n", origin[0], origin[1], origin[2], range) ;
-#endif
+	thresh = threshold;
+	reader = mr;
+	dimen = 1 << GRID_DIMENSION;
+	range = reader->getBoundingBox(origin);
+	nodeCount = nodeSpace = 0;
+	maxDepth = depth;
+	mindimen =(dimen >> maxDepth);
+	minshift =(GRID_DIMENSION - maxDepth);
+	buildTable();
 
-	this->maxTrianglePerCell = 0 ;
+	maxTrianglePerCell = 0;
 
 	// Initialize memory
 #ifdef IN_VERBOSE_MODE
-	dc_printf("Range: %f origin: %f, %f,%f \n", range, origin[0], origin[1], origin[2] ) ;
-	dc_printf("Initialize memory...\n") ;
+	dc_printf("Range: %f origin: %f, %f,%f \n", range, origin[0], origin[1], origin[2]);
+	dc_printf("Initialize memory...\n");
 #endif
-	initMemory( ) ;
-	this->root = createInternal( 0 ) ;
+	initMemory();
+	root = (Node*)createInternal(0);
 
 	// Read MC table
 #ifdef IN_VERBOSE_MODE
-	dc_printf("Reading contour table...\n") ;
+	dc_printf("Reading contour table...\n");
 #endif
-	this->cubes = new Cubes();
+	cubes = new Cubes();
 
 }
 
-Octree::~Octree( )
+Octree::~Octree()
 {
-	freeMemory( ) ;
+	freeMemory();
 }
 
 void Octree::scanConvert()
 {
 	// Scan triangles
 #if DC_DEBUG
-	clock_t start, finish ;
-	start = clock( ) ;
+	clock_t start, finish;
+	start = clock();
 #endif
 	
-	this->addTrian( ) ;
-	this->resetMinimalEdges( ) ;
-	this->preparePrimalEdgesMask( this->root ) ;
+	addTrian();
+	resetMinimalEdges();
+	preparePrimalEdgesMask(&root->internal);
 
 #if DC_DEBUG
-	finish = clock( ) ;
+	finish = clock();
 	dc_printf("Time taken: %f seconds                   \n", 
-		(double)(finish - start) / CLOCKS_PER_SEC ) ;
+		(double)(finish - start) / CLOCKS_PER_SEC);
 #endif
 
 	// Generate signs
 	// Find holes
 #if DC_DEBUG
-	dc_printf("Patching...\n") ;
-	start = clock( ) ;
+	dc_printf("Patching...\n");
+	start = clock();
 #endif
-	this->trace( ) ;
+	trace();
 #if DC_DEBUG
-	finish = clock( ) ;
-	dc_printf("Time taken: %f seconds \n",	(double)(finish - start) / CLOCKS_PER_SEC ) ;
+	finish = clock();
+	dc_printf("Time taken: %f seconds \n",	(double)(finish - start) / CLOCKS_PER_SEC);
 #ifdef IN_VERBOSE_MODE
-	dc_printf("Holes: %d Average Length: %f Max Length: %d \n", numRings, (float)totRingLengths / (float) numRings, maxRingLength ) ;
+	dc_printf("Holes: %d Average Length: %f Max Length: %d \n", numRings,(float)totRingLengths /(float) numRings, maxRingLength);
 #endif
 #endif
 	
 	// Check again
-	int tnumRings = numRings ;
-	this->trace( ) ;
+	int tnumRings = numRings;
+	trace();
 #ifdef IN_VERBOSE_MODE
-	dc_printf("Holes after patching: %d \n", numRings) ;
+	dc_printf("Holes after patching: %d \n", numRings);
 #endif	
-	numRings = tnumRings ;
+	numRings = tnumRings;
 
 #if DC_DEBUG
-	dc_printf("Building signs...\n") ;
-	start = clock( ) ;
+	dc_printf("Building signs...\n");
+	start = clock();
 #endif
-	this->buildSigns( ) ;
+	buildSigns();
 #if DC_DEBUG
-	finish = clock( ) ;
-	dc_printf("Time taken: %f seconds \n",	(double)(finish - start) / CLOCKS_PER_SEC ) ;
+	finish = clock();
+	dc_printf("Time taken: %f seconds \n",	(double)(finish - start) / CLOCKS_PER_SEC);
 #endif
 
 	if(use_flood_fill) {
 		/*
-		  start = clock( ) ;
-		  this->floodFill( ) ;
+		  start = clock();
+		  floodFill();
 		  // Check again
-		  tnumRings = numRings ;
-		  this->trace( ) ;
-		  dc_printf("Holes after filling: %d \n", numRings) ;
-		  numRings = tnumRings ;
-		  this->buildSigns( ) ;
-		  finish = clock( ) ;
-		  dc_printf("Time taken: %f seconds \n",	(double)(finish - start) / CLOCKS_PER_SEC ) ;
+		  tnumRings = numRings;
+		  trace();
+		  dc_printf("Holes after filling: %d \n", numRings);
+		  numRings = tnumRings;
+		  buildSigns();
+		  finish = clock();
+		  dc_printf("Time taken: %f seconds \n",	(double)(finish - start) / CLOCKS_PER_SEC);
 		*/
 #if DC_DEBUG
-		start = clock( ) ;
+		start = clock();
 		dc_printf("Removing components...\n");
 #endif
-		this->floodFill( ) ;
-		this->buildSigns( ) ;
+		floodFill();
+		buildSigns();
 		//	dc_printf("Checking...\n");
-		//	this->floodFill( ) ;
+		//	floodFill();
 #if DC_DEBUG
-		finish = clock( ) ;
-		dc_printf("Time taken: %f seconds \n", (double)(finish - start) / CLOCKS_PER_SEC ) ;
+		finish = clock();
+		dc_printf("Time taken: %f seconds \n",(double)(finish - start) / CLOCKS_PER_SEC);
 #endif
 	}
 
 	// Output
-#ifdef OUTPUT_REPAIRED
 #if DC_DEBUG
-	start = clock( ) ;
+	start = clock();
 #endif
 	writeOut();
 #if DC_DEBUG
-	finish = clock( ) ;
-#endif
-	// dc_printf("Time taken: %f seconds \n",	(double)(finish - start) / CLOCKS_PER_SEC ) ;
-#ifdef CINDY
-	this->writeTags( "tags.txt" ) ;
-	dc_printf("Tags output to tags.txt\n") ;
-#endif
-
+	finish = clock();
 #endif
+	// dc_printf("Time taken: %f seconds \n",	(double)(finish - start) / CLOCKS_PER_SEC);
 
 	// Print info
 #ifdef IN_VERBOSE_MODE
-	printMemUsage( ) ;
-#endif
-}
-
-#if 0
-void Octree::writeOut( char* fname )
-{
-	dc_printf( "\n" ) ;
-	if ( strstr( fname, ".ply" ) != NULL )
-	{
-		dc_printf("Writing PLY file format.\n") ;
-		this->outType = 1 ;
-		writePLY( fname ) ;
-	} 
-	else if ( strstr( fname, ".off" ) != NULL )
-	{
-		dc_printf("Writing OFF file format.\n") ;
-		this->outType = 0 ;
-		writeOFF( fname ) ;
-	}
-	else if ( strstr( fname, ".sof" ) != NULL )
-	{
-		dc_printf("Writing Signed Octree File format.\n") ;
-		this->outType = 2 ;
-		writeOctree( fname ) ;
-	}
-	else if ( strstr( fname, ".dcf" ) != NULL )
-	{
-#ifdef USE_HERMIT
-		dc_printf("Writing Dual Contouring File format.\n") ;
-		this->outType = 3 ;
-		writeDCF( fname ) ;
-#else
-		dc_printf("Can not write Dual Contouring File format in non-DC mode.\n") ;
-#endif
-	}
-#ifdef USE_HERMIT
-	else if ( strstr( fname, ".sog" ) != NULL )
-	{
-		dc_printf("Writing signed octree with geometry.\n") ;
-		this->outType = 4 ;
-		writeOctreeGeom( fname ) ;
-	}
+	printMemUsage();
 #endif
-	/*
-	else if ( strstr( fname, ".sof" ) != NULL )
-	{
-		dc_printf("Writing SOF file format.\n") ;
-		this->outType = 2 ;
-		writeOctree( fname ) ;
-	}
-	*/
-	else
-	{
-		dc_printf("Unknown output format.\n") ;
-	}
-
 }
-#endif
 
-void Octree::initMemory( )
+void Octree::initMemory()
 {
-#ifdef USE_HERMIT
-	const int leaf_node_bytes = 7;
-#else
-	const int leaf_node_bytes = 3;
-#endif
-
-	if(use_flood_fill) {
-		const int bytes = leaf_node_bytes + CINDY_BYTES + FLOOD_FILL_BYTES;
-		this->leafalloc[ 0 ] = new MemoryAllocator< bytes > ( ) ;
-		this->leafalloc[ 1 ] = new MemoryAllocator< bytes + EDGE_BYTES > ( ) ;
-		this->leafalloc[ 2 ] = new MemoryAllocator< bytes + EDGE_BYTES * 2 > ( ) ;
-		this->leafalloc[ 3 ] = new MemoryAllocator< bytes + EDGE_BYTES * 3 > ( ) ;
-	}
-	else {
-		const int bytes = leaf_node_bytes + CINDY_BYTES;
-		this->leafalloc[ 0 ] = new MemoryAllocator< bytes > ( ) ;
-		this->leafalloc[ 1 ] = new MemoryAllocator< bytes + EDGE_BYTES > ( ) ;
-		this->leafalloc[ 2 ] = new MemoryAllocator< bytes + EDGE_BYTES * 2 > ( ) ;
-		this->leafalloc[ 3 ] = new MemoryAllocator< bytes + EDGE_BYTES * 3 > ( ) ;
-	}
+	leafalloc[0] = new MemoryAllocator<sizeof(LeafNode)>();
+	leafalloc[1] = new MemoryAllocator<sizeof(LeafNode) + sizeof(float) * EDGE_FLOATS>();
+	leafalloc[2] = new MemoryAllocator<sizeof(LeafNode) + sizeof(float) * EDGE_FLOATS * 2>();
+	leafalloc[3] = new MemoryAllocator<sizeof(LeafNode) + sizeof(float) * EDGE_FLOATS * 3>();
 
-	this->alloc[ 0 ] = new MemoryAllocator< INTERNAL_NODE_BYTES > ( ) ;
-	this->alloc[ 1 ] = new MemoryAllocator< INTERNAL_NODE_BYTES + POINTER_BYTES > ( ) ;
-	this->alloc[ 2 ] = new MemoryAllocator< INTERNAL_NODE_BYTES + POINTER_BYTES*2 > ( ) ;
-	this->alloc[ 3 ] = new MemoryAllocator< INTERNAL_NODE_BYTES + POINTER_BYTES*3 > ( ) ;
-	this->alloc[ 4 ] = new MemoryAllocator< INTERNAL_NODE_BYTES + POINTER_BYTES*4 > ( ) ;
-	this->alloc[ 5 ] = new MemoryAllocator< INTERNAL_NODE_BYTES + POINTER_BYTES*5 > ( ) ;
-	this->alloc[ 6 ] = new MemoryAllocator< INTERNAL_NODE_BYTES + POINTER_BYTES*6 > ( ) ;
-	this->alloc[ 7 ] = new MemoryAllocator< INTERNAL_NODE_BYTES + POINTER_BYTES*7 > ( ) ;
-	this->alloc[ 8 ] = new MemoryAllocator< INTERNAL_NODE_BYTES + POINTER_BYTES*8 > ( ) ;
+	alloc[0] = new MemoryAllocator<sizeof(InternalNode)>();
+	alloc[1] = new MemoryAllocator<sizeof(InternalNode) + sizeof(Node*)>();
+	alloc[2] = new MemoryAllocator<sizeof(InternalNode) + sizeof(Node*) * 2>();
+	alloc[3] = new MemoryAllocator<sizeof(InternalNode) + sizeof(Node*) * 3>();
+	alloc[4] = new MemoryAllocator<sizeof(InternalNode) + sizeof(Node*) * 4>();
+	alloc[5] = new MemoryAllocator<sizeof(InternalNode) + sizeof(Node*) * 5>();
+	alloc[6] = new MemoryAllocator<sizeof(InternalNode) + sizeof(Node*) * 6>();
+	alloc[7] = new MemoryAllocator<sizeof(InternalNode) + sizeof(Node*) * 7>();
+	alloc[8] = new MemoryAllocator<sizeof(InternalNode) + sizeof(Node*) * 8>();
 }
 
-void Octree::freeMemory( )
+void Octree::freeMemory()
 {
-	for ( int i = 0 ; i < 9 ; i ++ )
+	for(int i = 0; i < 9; i ++)
 	{
-		alloc[i]->destroy() ;
-		delete alloc[i] ;
+		alloc[i]->destroy();
+		delete alloc[i];
 	}
 
-	for ( int i = 0 ; i < 4 ; i ++ )
+	for(int i = 0; i < 4; i ++)
 	{
-		leafalloc[i]->destroy() ;
-		delete leafalloc[i] ;
+		leafalloc[i]->destroy();
+		delete leafalloc[i];
 	}
 }
 
-void Octree::printMemUsage( )
+void Octree::printMemUsage()
 {
-	int totalbytes = 0 ;
-	dc_printf("********* Internal nodes: \n") ;
-	for ( int i = 0 ; i < 9 ; i ++ )
+	int totalbytes = 0;
+	dc_printf("********* Internal nodes: \n");
+	for(int i = 0; i < 9; i ++)
 	{
-		this->alloc[ i ]->printInfo() ;
+		alloc[i]->printInfo();
 
-		totalbytes += alloc[i]->getAll( ) * alloc[i]->getBytes() ;
+		totalbytes += alloc[i]->getAll() * alloc[i]->getBytes();
 	}
-	dc_printf("********* Leaf nodes: \n") ;
-	int totalLeafs = 0 ;
-	for ( int i = 0 ; i < 4 ; i ++ )
+	dc_printf("********* Leaf nodes: \n");
+	int totalLeafs = 0;
+	for(int i = 0; i < 4; i ++)
 	{
-		this->leafalloc[ i ]->printInfo() ;
+		leafalloc[i]->printInfo();
 
-		totalbytes += leafalloc[i]->getAll( ) * leafalloc[i]->getBytes() ;
-		totalLeafs += leafalloc[i]->getAllocated() ;
+		totalbytes += leafalloc[i]->getAll() * leafalloc[i]->getBytes();
+		totalLeafs += leafalloc[i]->getAllocated();
 	}
 	
-	dc_printf("Total allocated bytes on disk: %d \n", totalbytes) ;
-	dc_printf("Total leaf nodes: %d\n", totalLeafs ) ;
-}
-
-void Octree::resetMinimalEdges( )
-{
-	this->cellProcParity( this->root, 0, maxDepth ) ;
-}
-
-void Octree::writeModel( char* fname )
-{
-	reader->reset() ;
-
-	int nFace = reader->getNumTriangles() ;
-	Triangle* trian ;
-	// int unitcount = 10000;
-	int count = 0 ;
-	int nVert = nFace * 3 ;
-	FILE* modelfout = fopen( "model.off", "w" ) ;
-	fprintf( modelfout, "OFF\n" ) ;
-	fprintf( modelfout, "%d %d 0\n", nVert, nFace ) ;
-
-	//int total = this->reader->getNumTriangles() ;
-	dc_printf( "Start writing model to OFF...\n" ) ;
-	srand(0) ;
-	while ( ( trian = reader->getNextTriangle() ) != NULL )
-	{
-		// Drop polygons
-		{
-			int i, j ;
-
-			// Blow up the triangle
-			float mid[3] = {0, 0, 0} ;
-			for ( i = 0 ; i < 3 ; i ++ )
-				for ( j = 0 ; j < 3 ; j ++ )
-				{
-					trian->vt[i][j] = dimen * ( trian->vt[i][j] - origin[j] ) / range ;
-
-					mid[j] += trian->vt[i][j] / 3 ;
-				}
-				
-				// Generate projections
-				// LONG cube[2][3] = { { 0, 0, 0 }, { dimen, dimen, dimen } } ;
-				int trig[3][3] ;
-
-				// Blowing up the triangle to the grid
-				for ( i = 0 ; i < 3 ; i ++ )
-					for (  j = 0 ; j < 3 ; j ++ )
-					{
-						trig[i][j] = (int) (trian->vt[i][j]) ;
-						// Perturb end points, if set so
-					}
-
-					
-					for ( i = 0 ; i < 3 ; i ++ )
-					{
-						fprintf( modelfout, "%f %f %f\n", 
-							(float)(((double) trig[i][0] / dimen) * range  + origin[0]) ,
-							(float)(((double) trig[i][1] / dimen) * range  + origin[1]) ,
-							(float)(((double) trig[i][2] / dimen) * range  + origin[2]) ) ;
-					}
-		}
-		delete trian ;
-
-		count ++ ;
-		
-	}
-
-	for ( int i = 0 ; i < nFace ; i ++ )
-	{
-		fprintf( modelfout, "3 %d %d %d\n", 3 * i + 2, 3 * i + 1, 3 * i  ) ;
-	}
-
-	fclose( modelfout ) ;
-
-}
-
-#ifdef CINDY
-void Octree::writeTags( char* fname )
-{
-	FILE* fout = fopen( fname, "w" ) ;
-
-	clearCindyBits( root, maxDepth ) ;
-	readVertices() ;
-	outputTags( root, maxDepth, fout ) ;
-
-	fclose ( fout ) ;
-}
-
-void Octree::readVertices( )
-{
-	int total = this->reader->getNumVertices() ;
-	reader->reset() ;
-	float v[3] ;
-	int st[3] = {0,0,0};
-	int unitcount = 1000 ;
-	dc_printf( "\nRead in original %d vertices...\n", total ) ;
-
-	for ( int i = 0 ; i < total ; i ++ )
-	{
-		reader->getNextVertex( v ) ;
-		// Blowing up the triangle to the grid
-		float mid[3] = {0, 0, 0} ;
-		for ( int j = 0 ; j < 3 ; j ++ )
-		{
-			v[j] = dimen * ( v[j] - origin[j] ) / range ;
-		}
-
-//		dc_printf("vertex: %f %f %f, dimen: %d\n", v[0], v[1], v[2], dimen ) ;
-		readVertex ( root, st, dimen, maxDepth, v, i ) ;
-
-		
-		if ( i % unitcount == 0 )
-		{
-			putchar ( 13 ) ;
-
-			switch ( ( i / unitcount ) % 4 )
-			{
-			case 0 : dc_printf("-");
-				break ;
-			case 1 : dc_printf("/") ;
-				break ;
-			case 2 : dc_printf("|");
-				break ;
-			case 3 : dc_printf("\\") ;
-				break ;
-			}
-
-			float percent = (float) i / total ;
-			/*
-			int totbars = 50 ;
-			int bars = (int)( percent * totbars ) ;
-			for ( int i = 0 ; i < bars ; i ++ )
-			{
-				putchar( 219 ) ;
-			}
-			for ( i = bars ; i < totbars ; i ++ )
-			{
-				putchar( 176 ) ;
-			}
-			*/
-
-			dc_printf(" %d vertices: ", i ) ;
-			dc_printf( " %f%% complete.", 100 * percent ) ;
-		}
-		
-	}
-	putchar ( 13 ) ;
-	dc_printf("                                             \n");
-}
-
-void Octree::readVertex(  UCHAR* node, int st[3], int len, int height, float v[3], int index )
-{
-	int nst[3] ;
-	nst[0] = ( (int) v[0] / mindimen ) * mindimen ;
-	nst[1] = ( (int) v[1] / mindimen ) * mindimen ;
-	nst[2] = ( (int) v[2] / mindimen ) * mindimen ;
-
-	UCHAR* cell = this->locateLeafCheck( nst ) ;
-	if ( cell == NULL )
-	{
-		dc_printf("Cell %d %d %d is not found!\n", nst[0]/ mindimen, nst[1]/ mindimen, nst[2]/ mindimen) ;
-		return ;
-	}
-
-	setOriginalIndex( cell, index ) ;
-
-
-	/*
-	int i ;
-	if ( height == 0 )
-	{
-		// Leaf cell, assign index
-		dc_printf("Setting: %d\n", index ) ;
-		setOriginalIndex( node, index ) ;
-	}
-	else
-	{
-		len >>= 1 ;
-		// Internal cell, check and recur
-		int x = ( v[0] > st[0] + len ) ? 1 : 0 ;
-		int y = ( v[1] > st[1] + len ) ? 1 : 0 ;
-		int z = ( v[2] > st[2] + len ) ? 1 : 0 ;
-		int child = x * 4 + y * 2 + z ;
-
-		int count = 0 ;
-		for ( i = 0 ; i < 8 ; i ++ )
-		{
-			if ( i == child && hasChild( node, i ) )
-			{
-				int nst[3] ;
-				nst[0] = st[0] + vertmap[i][0] * len ;
-				nst[1] = st[1] + vertmap[i][1] * len ;
-				nst[2] = st[2] + vertmap[i][2] * len ;
-
-				dc_printf("Depth: %d -- child %d vertex: %f %f %f in %f %f %f\n", height - 1, child, v[0]/mindimen, v[1]/mindimen, v[2]/mindimen, 
-					nst[0]/mindimen, nst[1]/mindimen, nst[2]/mindimen, len/mindimen ) ;
-				
-				readVertex( getChild( node, count ), nst, len, height - 1, v, index ) ;
-				count ++ ;
-			}
-		}
-	}
-	*/
-}
-
-void Octree::outputTags( UCHAR* node, int height, FILE* fout )
-{
-	int i ;
-
-	if ( height == 0 )
-	{
-		// Leaf cell, generate
-		int smask = getSignMask( node ) ;
-
-		if(use_manifold) {
-			int comps = manifold_table[ smask ].comps ;
-			if ( comps != 1 )
-			{
-				return ;
-			}
-		}
-		else
-		{
-			if ( smask == 0 || smask == 255 )
-			{
-				return ;
-			}
-		}
-
-		int rindex = getMinimizerIndex( node ) ;
-		int oindex = getOriginalIndex( node ) ;
-
-		if ( oindex >= 0 )
-		{
-			fprintf( fout, "%d: %d\n", rindex, oindex ) ;
-		}
-
-	}
-	else
-	{
-		// Internal cell, recur
-		int count = 0 ;
-		for ( i = 0 ; i < 8 ; i ++ )
-		{
-			if ( hasChild( node, i ) )
-			{
-				outputTags( getChild( node, count ), height - 1, fout ) ;
-				count ++ ;
-			}
-		}
-	}
+	dc_printf("Total allocated bytes on disk: %d \n", totalbytes);
+	dc_printf("Total leaf nodes: %d\n", totalLeafs);
 }
 
-void Octree::clearCindyBits( UCHAR* node, int height )
+void Octree::resetMinimalEdges()
 {
-	int i;
-
-	if ( height == 0 )
-	{
-		// Leaf cell, 
-		{
-			setOriginalIndex( node, - 1 ) ;
-		}
-	}
-	else
-	{
-		// Internal cell, recur
-		int count = 0 ;
-		for ( i = 0 ; i < 8 ; i ++ )
-		{
-			if ( hasChild( node, i ) )
-			{
-				clearCindyBits( getChild( node, count ), height - 1 ) ;
-				count ++ ;
-			}
-		}
-	}	
+	cellProcParity(root, 0, maxDepth);
 }
-#endif
 
-void Octree::addTrian( )
+void Octree::addTrian()
 {
-	Triangle* trian ;
-	int count = 0 ;
+	Triangle* trian;
+	int count = 0;
 	
 #if DC_DEBUG
-	int total = this->reader->getNumTriangles() ;
-	int unitcount = 1000 ;
-	dc_printf( "\nScan converting to depth %d...\n", maxDepth ) ;
+	int total = reader->getNumTriangles();
+	int unitcount = 1000;
+	dc_printf("\nScan converting to depth %d...\n", maxDepth);
 #endif
 
-	srand(0) ;
+	srand(0);
 
-	while ( ( trian = reader->getNextTriangle() ) != NULL )
+	while((trian = reader->getNextTriangle()) != NULL)
 	{
 		// Drop triangles
 		{
-			addTrian ( trian, count ) ;
+			addTrian(trian, count);
 		}
-		delete trian ;
+		delete trian;
 
-		count ++ ;
+		count ++;
 
 #if DC_DEBUG
-		if ( count % unitcount == 0 )
+		if(count % unitcount == 0)
 		{
-			putchar ( 13 ) ;
+			putchar(13);
 
-			switch ( ( count / unitcount ) % 4 )
+			switch((count / unitcount) % 4)
 			{
 			case 0 : dc_printf("-");
-				break ;
-			case 1 : dc_printf("/") ;
-				break ;
+				break;
+			case 1 : dc_printf("/");
+				break;
 			case 2 : dc_printf("|");
-				break ;
-			case 3 : dc_printf("\\") ;
-				break ;
+				break;
+			case 3 : dc_printf("\\");
+				break;
 			}
 
-			float percent = (float) count / total ;
+			float percent =(float) count / total;
 			
 			/*
-			int totbars = 50 ;
-			int bars = (int)( percent * totbars ) ;
-			for ( int i = 0 ; i < bars ; i ++ )
+			int totbars = 50;
+			int bars =(int)(percent * totbars);
+			for(int i = 0; i < bars; i ++)
 			{
-				putchar( 219 ) ;
+				putchar(219);
 			}
-			for ( i = bars ; i < totbars ; i ++ )
+			for(i = bars; i < totbars; i ++)
 			{
-				putchar( 176 ) ;
+				putchar(176);
 			}
 			*/
 
-			dc_printf(" %d triangles: ", count ) ;
-			dc_printf( " %f%% complete.", 100 * percent ) ;
+			dc_printf(" %d triangles: ", count);
+			dc_printf(" %f%% complete.", 100 * percent);
 		}
 #endif
 		
 	}
-	putchar ( 13 ) ;
+	putchar(13);
 }
 
-void Octree::addTrian( Triangle* trian, int triind )
+void Octree::addTrian(Triangle* trian, int triind)
 {
-	int i, j ;
+	int i, j;
 
 	// Blowing up the triangle to the grid
-	float mid[3] = {0, 0, 0} ;
-	for ( i = 0 ; i < 3 ; i ++ )
-		for ( j = 0 ; j < 3 ; j ++ )
+	float mid[3] = {0, 0, 0};
+	for(i = 0; i < 3; i ++)
+		for(j = 0; j < 3; j ++)
 		{
-			trian->vt[i][j] = dimen * ( trian->vt[i][j] - origin[j] ) / range ;
-			mid[j] += trian->vt[i][j] / 3 ;
+			trian->vt[i][j] = dimen *(trian->vt[i][j] - origin[j]) / range;
+			mid[j] += trian->vt[i][j] / 3;
 		}
 
 	// Generate projections
-	LONG cube[2][3] = { { 0, 0, 0 }, { dimen, dimen, dimen } } ;
-	LONG trig[3][3] ;
+	LONG cube[2][3] = {{0, 0, 0}, {dimen, dimen, dimen}};
+	LONG trig[3][3];
 	
-	for ( i = 0 ; i < 3 ; i ++ )
-		for (  j = 0 ; j < 3 ; j ++ )
+	for(i = 0; i < 3; i ++)
+		for( j = 0; j < 3; j ++)
 		{
-			trig[i][j] = (LONG) (trian->vt[i][j]) ;
+			trig[i][j] =(LONG)(trian->vt[i][j]);
 	// Perturb end points, if set so
 		}
 		
 	// Add to the octree
-	// int start[3] = { 0, 0, 0 } ;
-	LONG errorvec = (LONG) ( 0 ) ;
-	Projections* proj = new Projections( cube, trig, errorvec, triind ) ;
-	root = addTrian( root, proj, maxDepth ) ;
+	// int start[3] = {0, 0, 0};
+	LONG errorvec =(LONG)(0);
+	Projections* proj = new Projections(cube, trig, errorvec, triind);
+	root = (Node*)addTrian(&root->internal, proj, maxDepth);
 	
-	delete proj->inherit ;
-	delete proj ;
+	delete proj->inherit;
+	delete proj;
 }
 
 
-UCHAR* Octree::addTrian( UCHAR* node, Projections* p, int height )
+InternalNode* Octree::addTrian(InternalNode* node, Projections* p, int height)
 {
-	int i ;
-	int vertdiff[8][3] = {{0,0,0},{0,0,1},{0,1,-1},{0,0,1},{1,-1,-1},{0,0,1},{0,1,-1},{0,0,1}} ;
-	UCHAR boxmask = p->getBoxMask( ) ;
-	Projections* subp = new Projections( p ) ;
+	int i;
+	int vertdiff[8][3] = {{0,0,0},{0,0,1},{0,1,-1},{0,0,1},{1,-1,-1},{0,0,1},{0,1,-1},{0,0,1}};
+	UCHAR boxmask = p->getBoxMask();
+	Projections* subp = new Projections(p);
 	
-	int count = 0 ;
-	int tempdiff[3] = {0,0,0} ;
-	for ( i = 0 ; i < 8 ; i ++ )
+	int count = 0;
+	int tempdiff[3] = {0,0,0};
+	for(i = 0; i < 8; i ++)
 	{
-		tempdiff[0] += vertdiff[i][0] ;
-		tempdiff[1] += vertdiff[i][1] ;
-		tempdiff[2] += vertdiff[i][2] ;
+		tempdiff[0] += vertdiff[i][0];
+		tempdiff[1] += vertdiff[i][1];
+		tempdiff[2] += vertdiff[i][2];
 
 		/* Quick pruning using bounding box */
-		if ( boxmask & ( 1 << i ) ) 
+		if(boxmask &(1 << i)) 
 		{
-			subp->shift( tempdiff ) ;
-			tempdiff[0] = tempdiff[1] = tempdiff[2] = 0 ;
+			subp->shift(tempdiff);
+			tempdiff[0] = tempdiff[1] = tempdiff[2] = 0;
 
 			/* Pruning using intersection test */
-			if ( subp->isIntersecting() )
-			// if ( subp->getIntersectionMasks( cedgemask, edgemask ) )
+			if(subp->isIntersecting())
+			// if(subp->getIntersectionMasks(cedgemask, edgemask))
 			{
-				if ( ! hasChild( node, i ) )
+				if(! hasChild(node, i))
 				{
-					if ( height == 1 )
+					if(height == 1)
 					{
-						node = addLeafChild( node, i, count, createLeaf(0) ) ;
+						node = addLeafChild(node, i, count, createLeaf(0));
 					}
 					else
 					{
-						node = addInternalChild( node, i, count, createInternal(0) ) ;
+						node = addInternalChild(node, i, count, createInternal(0));
 					}
 				}
-				UCHAR* chd = getChild( node, count ) ;
+				Node* chd = getChild(node, count);
 						
-				if ( ! isLeaf( node, i ) )
+				if(! isLeaf(node, i))
 				{
-					// setChild( node, count, addTrian ( chd, subp, height - 1, vertmask[i], edgemask ) ) ;
-					setChild( node, count, addTrian ( chd, subp, height - 1 ) ) ;
+					// setChild(node, count, addTrian(chd, subp, height - 1, vertmask[i], edgemask));
+					setChild(node, count, (Node*)addTrian(&chd->internal, subp, height - 1));
 				}
 				else
 				{
-					setChild( node, count, updateCell( chd, subp ) ) ;
+					setChild(node, count, (Node*)updateCell(&chd->leaf, subp));
 				}
 			}
 		}
 
-		if ( hasChild( node, i ) )
+		if(hasChild(node, i))
 		{
-			count ++ ;
+			count ++;
 		}
 	}
 
-	delete subp ;
-	return node ;
+	delete subp;
+	
+	return node;
 }
 
-UCHAR* Octree::updateCell( UCHAR* node, Projections* p )
+LeafNode* Octree::updateCell(LeafNode* node, Projections* p)
 {
-	int i ;
+	int i;
 
 	// Edge connectivity
-	int mask[3] = { 0, 4, 8	} ;
-	int oldc = 0, newc = 0 ;
-	float offs[3] ;
-#ifdef USE_HERMIT
-	float a[3], b[3], c[3] ;
-#endif
+	int mask[3] = {0, 4, 8	};
+	int oldc = 0, newc = 0;
+	float offs[3];
+	float a[3], b[3], c[3];
 
-	for ( i = 0 ; i < 3 ; i ++ )
+	for(i = 0; i < 3; i ++)
 	{
-		if ( ! getEdgeParity( node, mask[i] ) )
+		if(! getEdgeParity(node, mask[i]))
 		{
-			if ( p->isIntersectingPrimary( i ) )
+			if(p->isIntersectingPrimary(i))
 			{
-				// this->actualQuads ++ ;
-				setEdge( node, mask[i] ) ;
-				offs[ newc ] = p->getIntersectionPrimary( i ) ;
-#ifdef USE_HERMIT
-				a[ newc ] = (float) p->inherit->norm[0] ;
-				b[ newc ] = (float) p->inherit->norm[1] ;
-				c[ newc ] = (float) p->inherit->norm[2] ;
-#endif
-				newc ++ ;
+				// actualQuads ++;
+				setEdge(node, mask[i]);
+				offs[newc] = p->getIntersectionPrimary(i);
+				a[newc] =(float) p->inherit->norm[0];
+				b[newc] =(float) p->inherit->norm[1];
+				c[newc] =(float) p->inherit->norm[2];
+				newc ++;
 			}
 		}
 		else
 		{
-#ifndef USE_HERMIT
-			offs[ newc ] = getEdgeOffset( node, oldc ) ;
-#else
-			offs[ newc ] = getEdgeOffsetNormal( node, oldc, a[ newc ], b[ newc ], c[ newc ] ) ;
-#endif
+			offs[newc] = getEdgeOffsetNormal(node, oldc, a[newc], b[newc], c[newc]);
 
-//			if ( p->isIntersectingPrimary( i ) )
+//			if(p->isIntersectingPrimary(i))
 			{
-				// dc_printf("Multiple intersections!\n") ;
+				// dc_printf("Multiple intersections!\n");
 				
-//				setPatchEdge( node, i ) ;
+//				setPatchEdge(node, i);
 			}
 			
-			oldc ++ ;
-			newc ++ ;
+			oldc ++;
+			newc ++;
 		}
 	}
 
-	if ( newc > oldc )
+	if(newc > oldc)
 	{
 		// New offsets added, update this node
-#ifndef USE_HERMIT
-		node = updateEdgeOffsets( node, oldc, newc, offs ) ;
-#else
-		node = updateEdgeOffsetsNormals( node, oldc, newc, offs, a, b, c ) ;
-#endif
+		node = updateEdgeOffsetsNormals(node, oldc, newc, offs, a, b, c);
 	}
 
-
-
-	return node ;
+	return node;
 }
 
-void Octree::preparePrimalEdgesMask( UCHAR* node )
+void Octree::preparePrimalEdgesMask(InternalNode* node)
 {
-	int count = 0 ;
-	for ( int i = 0 ; i < 8 ; i ++ )
+	int count = 0;
+	for(int i = 0; i < 8; i ++)
 	{
-		if ( hasChild( node, i ) )
+		if(hasChild(node, i))
 		{
-			if ( isLeaf( node, i ) )
-			{
-				createPrimalEdgesMask( getChild( node, count ) ) ;
-			}
+			if(isLeaf(node, i))
+				createPrimalEdgesMask(&getChild(node, count)->leaf);
 			else
-			{
-				preparePrimalEdgesMask( getChild( node, count ) ) ;
-			}
+				preparePrimalEdgesMask(&getChild(node, count)->internal);
 
-			count ++ ;
+			count ++;
 		}
 	}
 }
 
-void Octree::trace( )
+void Octree::trace()
 {
-	int st[3] = { 0, 0, 0, } ;
-	this->numRings = 0 ;
-	this->totRingLengths = 0 ;
-	this->maxRingLength = 0 ;
+	int st[3] = {0, 0, 0,};
+	numRings = 0;
+	totRingLengths = 0;
+	maxRingLength = 0;
 
-	PathList* chdpath = NULL ;
-	this->root = trace( this->root, st, dimen, maxDepth, chdpath ) ;
+	PathList* chdpath = NULL;
+	root = trace(root, st, dimen, maxDepth, chdpath);
 
-	if ( chdpath != NULL )
+	if(chdpath != NULL)
 	{
-		dc_printf("there are incomplete rings.\n") ;	
-		printPaths( chdpath ) ;
+		dc_printf("there are incomplete rings.\n");	
+		printPaths(chdpath);
 	};
 }
 
-UCHAR* Octree::trace( UCHAR* node, int* st, int len, int depth, PathList*& paths)
+Node* Octree::trace(Node* newnode, int* st, int len, int depth, PathList*& paths)
 {
-	UCHAR* newnode = node ;
-	len >>= 1 ;
-	PathList* chdpaths[ 8 ] ;
-	UCHAR* chd[ 8 ] ;
-	int nst[ 8 ][ 3 ] ;
-	int i, j ;
+	len >>= 1;
+	PathList* chdpaths[8];
+	Node* chd[8];
+	int nst[8][3];
+	int i, j;
 
 	// Get children paths
-	int chdleaf[ 8 ] ;
-	fillChildren( newnode, chd, chdleaf ) ;
+	int chdleaf[8];
+	fillChildren(&newnode->internal, chd, chdleaf);
 
-	// int count = 0 ;
-	for ( i = 0 ; i < 8 ; i ++ )
+	// int count = 0;
+	for(i = 0; i < 8; i ++)
 	{
-		for ( j = 0 ; j < 3 ; j ++ )
+		for(j = 0; j < 3; j ++)
 		{
-			nst[ i ][ j ] = st[ j ] + len * vertmap[ i ][ j ] ;
+			nst[i][j] = st[j] + len * vertmap[i][j];
 		}
 
-		if ( chd[ i ] == NULL || isLeaf( node, i ) )
+		if(chd[i] == NULL || isLeaf(&newnode->internal, i))
 		{
-			chdpaths[ i ] = NULL ;
+			chdpaths[i] = NULL;
 		}
 		else
 		{
-			trace( chd[ i ], nst[i], len, depth - 1, chdpaths[ i ] ) ;
+			trace(chd[i], nst[i], len, depth - 1, chdpaths[i]);
 		}
 	}
 
 	// Get connectors on the faces
-	PathList* conn[ 12 ] ;
-	UCHAR* nf[2] ;
-	int lf[2] ;
-	int df[2] = { depth - 1, depth - 1 } ;
-	int* nstf[ 2 ];
+	PathList* conn[12];
+	Node* nf[2];
+	int lf[2];
+	int df[2] = {depth - 1, depth - 1};
+	int* nstf[2];
 
-	fillChildren( newnode, chd, chdleaf ) ;
+	fillChildren(&newnode->internal, chd, chdleaf);
 
-	for ( i = 0 ; i < 12 ; i ++ )
+	for(i = 0; i < 12; i ++)
 	{
-		int c[ 2 ] = { cellProcFaceMask[ i ][ 0 ], cellProcFaceMask[ i ][ 1 ] };
+		int c[2] = {cellProcFaceMask[i][0], cellProcFaceMask[i][1]};
 		
-		for ( int j = 0 ; j < 2 ; j ++ )
+		for(int j = 0; j < 2; j ++)
 		{
-			lf[j] = chdleaf[ c[j] ] ;
-			nf[j] = chd[ c[j] ] ;
-			nstf[j] = nst[ c[j] ] ;
+			lf[j] = chdleaf[c[j]];
+			nf[j] = chd[c[j]];
+			nstf[j] = nst[c[j]];
 		}
 
-		conn[ i ] = NULL ;
+		conn[i] = NULL;
 		
-		findPaths( nf, lf, df, nstf, depth - 1, cellProcFaceMask[ i ][ 2 ], conn[ i ] ) ;
+		findPaths((Node**)nf, lf, df, nstf, depth - 1, cellProcFaceMask[i][2], conn[i]);
 
-		//if ( conn[i] )
+		//if(conn[i])
 		//{
-		//		printPath( conn[i] ) ;
+		//		printPath(conn[i]);
 		//}
 	}
 	
 	// Connect paths
-	PathList* rings = NULL ;
-	combinePaths( chdpaths[0], chdpaths[1], conn[8], rings ) ;
-	combinePaths( chdpaths[2], chdpaths[3], conn[9], rings ) ;
-	combinePaths( chdpaths[4], chdpaths[5], conn[10], rings ) ;
-	combinePaths( chdpaths[6], chdpaths[7], conn[11], rings ) ;
-
-	combinePaths( chdpaths[0], chdpaths[2], conn[4], rings ) ;
-	combinePaths( chdpaths[4], chdpaths[6], conn[5], rings ) ;
-	combinePaths( chdpaths[0], NULL, conn[6], rings ) ;
-	combinePaths( chdpaths[4], NULL, conn[7], rings ) ;
-
-	combinePaths( chdpaths[0], chdpaths[4], conn[0], rings ) ;
-	combinePaths( chdpaths[0], NULL, conn[1], rings ) ;
-	combinePaths( chdpaths[0], NULL, conn[2], rings ) ;
-	combinePaths( chdpaths[0], NULL, conn[3], rings ) ;
+	PathList* rings = NULL;
+	combinePaths(chdpaths[0], chdpaths[1], conn[8], rings);
+	combinePaths(chdpaths[2], chdpaths[3], conn[9], rings);
+	combinePaths(chdpaths[4], chdpaths[5], conn[10], rings);
+	combinePaths(chdpaths[6], chdpaths[7], conn[11], rings);
+
+	combinePaths(chdpaths[0], chdpaths[2], conn[4], rings);
+	combinePaths(chdpaths[4], chdpaths[6], conn[5], rings);
+	combinePaths(chdpaths[0], NULL, conn[6], rings);
+	combinePaths(chdpaths[4], NULL, conn[7], rings);
+
+	combinePaths(chdpaths[0], chdpaths[4], conn[0], rings);
+	combinePaths(chdpaths[0], NULL, conn[1], rings);
+	combinePaths(chdpaths[0], NULL, conn[2], rings);
+	combinePaths(chdpaths[0], NULL, conn[3], rings);
 
 	// By now, only chdpaths[0] and rings have contents
 
 	// Process rings
-	if ( rings )
+	if(rings)
 	{
-		// printPath( rings ) ;
+		// printPath(rings);
 
 		/* Let's count first */
-		PathList* trings = rings ;
-		while ( trings )
+		PathList* trings = rings;
+		while(trings)
 		{
-			this->numRings ++ ;
-			this->totRingLengths += trings->length ;
-			if ( trings->length > this->maxRingLength )
+			numRings ++;
+			totRingLengths += trings->length;
+			if(trings->length > maxRingLength)
 			{
-				this->maxRingLength = trings->length ;
+				maxRingLength = trings->length;
 			}
-			trings = trings->next ;
+			trings = trings->next;
 		}
 
-		// printPath( rings ) ;
-		newnode = patch( newnode, st, ( len << 1 ), rings ) ;
+		// printPath(rings);
+		newnode = patch(newnode, st,(len << 1), rings);
 	}
 
 	// Return incomplete paths
-	paths = chdpaths[0] ;
-	return newnode ;
+	paths = chdpaths[0];
+	return newnode;
 }
 
-void Octree::findPaths( UCHAR* node[2], int leaf[2], int depth[2], int* st[2], int maxdep, int dir, PathList*& paths )
+void Octree::findPaths(Node* node[2], int leaf[2], int depth[2], int* st[2], int maxdep, int dir, PathList*& paths)
 {
-	if ( ! ( node[0] && node[1] ) )
+	if(!(node[0] && node[1]))
 	{
-		return ;
+		return;
 	}
 
-	if ( ! ( leaf[0] && leaf[1] ) )
+	if(!(leaf[0] && leaf[1]))
 	{
 		// Not at the bottom, recur
 
 		// Fill children nodes
-		int i, j ;
-		UCHAR* chd[ 2 ][ 8 ] ;
-		int chdleaf[ 2 ][ 8 ] ;
-		int nst[ 2 ][ 8 ][ 3 ] ;
+		int i, j;
+		Node* chd[2][8];
+		int chdleaf[2][8];
+		int nst[2][8][3];
 
-		for ( j = 0 ; j < 2 ; j ++ )
+		for(j = 0; j < 2; j ++)
 		{
-			if ( ! leaf[j] )
+			if(! leaf[j])
 			{
-				fillChildren( node[j], chd[j], chdleaf[j] ) ;
+				fillChildren(&node[j]->internal, chd[j], chdleaf[j]);
 
-				int len = ( dimen >> ( maxDepth - depth[j] + 1 ) ) ;
-				for ( i = 0 ; i < 8 ; i ++ )
+				int len =(dimen >>(maxDepth - depth[j] + 1));
+				for(i = 0; i < 8; i ++)
 				{
-					for ( int k = 0 ; k < 3 ; k ++ )
+					for(int k = 0; k < 3; k ++)
 					{
-						nst[ j ][ i ][ k ] = st[ j ][ k ] + len * vertmap[ i ][ k ] ;
+						nst[j][i][k] = st[j][k] + len * vertmap[i][k];
 					}
 				}
 
@@ -1029,2428 +647,1626 @@ void Octree::findPaths( UCHAR* node[2], int leaf[2], int depth[2], int* st[2], i
 		}
 
 		// 4 face calls
-		UCHAR* nf[2] ;
-		int df[2] ;
-		int lf[2] ;
-		int* nstf[2] ;
-		for ( i = 0 ; i < 4 ; i ++ )
+		Node* nf[2];
+		int df[2];
+		int lf[2];
+		int* nstf[2];
+		for(i = 0; i < 4; i ++)
 		{
-			int c[2] = { faceProcFaceMask[ dir ][ i ][ 0 ], faceProcFaceMask[ dir ][ i ][ 1 ] };
-			for ( int j = 0 ; j < 2 ; j ++ )
+			int c[2] = {faceProcFaceMask[dir][i][0], faceProcFaceMask[dir][i][1]};
+			for(int j = 0; j < 2; j ++)
 			{
-				if ( leaf[j] )
+				if(leaf[j])
 				{
-					lf[j] = leaf[j] ;
-					nf[j] = node[j] ;
-					df[j] = depth[j] ;
-					nstf[j] = st[j] ;
+					lf[j] = leaf[j];
+					nf[j] = node[j];
+					df[j] = depth[j];
+					nstf[j] = st[j];
 				}
 				else
 				{
-					lf[j] = chdleaf[ j ][ c[j] ] ;
-					nf[j] = chd[ j ][ c[j] ] ;
-					df[j] = depth[j] - 1 ;
-					nstf[j] = nst[ j ][ c[j] ] ;
+					lf[j] = chdleaf[j][c[j]];
+					nf[j] = chd[j][c[j]];
+					df[j] = depth[j] - 1;
+					nstf[j] = nst[j][c[j]];
 				}
 			}
-			findPaths( nf, lf, df, nstf, maxdep - 1, faceProcFaceMask[ dir ][ i ][ 2 ], paths ) ;
+			findPaths(nf, lf, df, nstf, maxdep - 1, faceProcFaceMask[dir][i][2], paths);
 		}
 
 	}
 	else
 	{
 		// At the bottom, check this face
-		int ind = ( depth[0] == maxdep ? 0 : 1 ) ;
-		int fcind = 2 * dir + ( 1 - ind ) ;
-		if ( getFaceParity( node[ ind ], fcind ) )
+		int ind =(depth[0] == maxdep ? 0 : 1);
+		int fcind = 2 * dir +(1 - ind);
+		if(getFaceParity((LeafNode*)node[ind], fcind))
 		{
 			// Add into path
-			PathElement* ele1 = new PathElement ;
-			PathElement* ele2 = new PathElement ;
+			PathElement* ele1 = new PathElement;
+			PathElement* ele2 = new PathElement;
 
-			ele1->pos[0] = st[0][0] ;
-			ele1->pos[1] = st[0][1] ;
-			ele1->pos[2] = st[0][2] ;
+			ele1->pos[0] = st[0][0];
+			ele1->pos[1] = st[0][1];
+			ele1->pos[2] = st[0][2];
 
-			ele2->pos[0] = st[1][0] ;
-			ele2->pos[1] = st[1][1] ;
-			ele2->pos[2] = st[1][2] ;
+			ele2->pos[0] = st[1][0];
+			ele2->pos[1] = st[1][1];
+			ele2->pos[2] = st[1][2];
 
-			ele1->next = ele2 ;
-			ele2->next = NULL ;
+			ele1->next = ele2;
+			ele2->next = NULL;
 
-			PathList* lst = new PathList ;
-			lst->head = ele1 ;
-			lst->tail = ele2 ;
-			lst->length = 2 ;
-			lst->next = paths ;
-			paths = lst ;
+			PathList* lst = new PathList;
+			lst->head = ele1;
+			lst->tail = ele2;
+			lst->length = 2;
+			lst->next = paths;
+			paths = lst;
 
-			// int l = ( dimen >> maxDepth ) ;
+			// int l =(dimen >> maxDepth);
 		}
 	}
 
 }
 
-void Octree::combinePaths( PathList*& list1, PathList* list2, PathList* paths, PathList*& rings )
+void Octree::combinePaths(PathList*& list1, PathList* list2, PathList* paths, PathList*& rings)
 {
 	// Make new list of paths
-	PathList* nlist = NULL ;
+	PathList* nlist = NULL;
 
 	// Search for each connectors in paths
-	PathList* tpaths = paths ;
-	PathList* tlist, * pre ;
-	while ( tpaths )
+	PathList* tpaths = paths;
+	PathList* tlist, * pre;
+	while(tpaths)
 	{
-		PathList* singlist = tpaths ;
-		PathList* templist ;
-		tpaths = tpaths->next ;
-		singlist->next = NULL ;
+		PathList* singlist = tpaths;
+		PathList* templist;
+		tpaths = tpaths->next;
+		singlist->next = NULL;
 
 		// Look for hookup in list1
-		tlist = list1 ;
-		pre = NULL ;
-		while ( tlist )
+		tlist = list1;
+		pre = NULL;
+		while(tlist)
 		{
-			if (  (templist = combineSinglePath( list1, pre, tlist, singlist, NULL, singlist )) != NULL )
+			if((templist = combineSinglePath(list1, pre, tlist, singlist, NULL, singlist)) != NULL)
 			{
-				singlist = templist ;
-				continue ;
+				singlist = templist;
+				continue;
 			}
-			pre = tlist ;
-			tlist = tlist->next ;
+			pre = tlist;
+			tlist = tlist->next;
 		}
 
 		// Look for hookup in list2
-		tlist = list2 ;
-		pre = NULL ;
-		while ( tlist )
+		tlist = list2;
+		pre = NULL;
+		while(tlist)
 		{
-			if (  (templist = combineSinglePath( list2, pre, tlist, singlist, NULL, singlist )) != NULL )
+			if((templist = combineSinglePath(list2, pre, tlist, singlist, NULL, singlist)) != NULL)
 			{
-				singlist = templist ;
-				continue ;
+				singlist = templist;
+				continue;
 			}
-			pre = tlist ;
-			tlist = tlist->next ;
+			pre = tlist;
+			tlist = tlist->next;
 		}
 
 		// Look for hookup in nlist
-		tlist = nlist ;
-		pre = NULL ;
-		while ( tlist )
+		tlist = nlist;
+		pre = NULL;
+		while(tlist)
 		{
-			if (  (templist = combineSinglePath( nlist, pre, tlist, singlist, NULL, singlist )) != NULL )
+			if((templist = combineSinglePath(nlist, pre, tlist, singlist, NULL, singlist)) != NULL)
 			{
-				singlist = templist ;
-				continue ;
+				singlist = templist;
+				continue;
 			}
-			pre = tlist ;
-			tlist = tlist->next ;
+			pre = tlist;
+			tlist = tlist->next;
 		}
 
 		// Add to nlist or rings
-		if ( isEqual( singlist->head, singlist->tail ) )
+		if(isEqual(singlist->head, singlist->tail))
 		{
-			PathElement* temp = singlist->head ;
-			singlist->head = temp->next ;
-			delete temp ;
-			singlist->length -- ;
-			singlist->tail->next = singlist->head ;
-
-			singlist->next = rings ;
-			rings = singlist ;
+			PathElement* temp = singlist->head;
+			singlist->head = temp->next;
+			delete temp;
+			singlist->length --;
+			singlist->tail->next = singlist->head;
+
+			singlist->next = rings;
+			rings = singlist;
 		}
 		else
 		{
-			singlist->next = nlist ;
-			nlist = singlist ;
+			singlist->next = nlist;
+			nlist = singlist;
 		}
 
 	}
 
 	// Append list2 and nlist to the end of list1 
-	tlist = list1 ;
-	if ( tlist != NULL )
+	tlist = list1;
+	if(tlist != NULL)
 	{
-		while ( tlist->next != NULL )
+		while(tlist->next != NULL)
 		{
-			tlist = tlist->next ;
+			tlist = tlist->next;
 		}
-		tlist->next = list2 ;
+		tlist->next = list2;
 	}
 	else
 	{
-		tlist = list2 ;
-		list1 = list2 ;
+		tlist = list2;
+		list1 = list2;
 	}
 
-	if ( tlist != NULL )
+	if(tlist != NULL)
 	{
-		while ( tlist->next != NULL )
+		while(tlist->next != NULL)
 		{
-			tlist = tlist->next ;
+			tlist = tlist->next;
 		}
-		tlist->next = nlist ;
+		tlist->next = nlist;
 	}
 	else
 	{
-		tlist = nlist ;
-		list1 = nlist ;
+		tlist = nlist;
+		list1 = nlist;
 	}
 
 }
 
-PathList* Octree::combineSinglePath( PathList*& head1, PathList* pre1, PathList*& list1, PathList*& head2, PathList* pre2, PathList*& list2 )
+PathList* Octree::combineSinglePath(PathList*& head1, PathList* pre1, PathList*& list1, PathList*& head2, PathList* pre2, PathList*& list2)
 {
-	if ( isEqual( list1->head, list2->head ) || isEqual( list1->tail, list2->tail ) )
+	if(isEqual(list1->head, list2->head) || isEqual(list1->tail, list2->tail))
 	{
 		// Reverse the list
-		if ( list1->length < list2->length )
+		if(list1->length < list2->length)
 		{
 			// Reverse list1
-			PathElement* prev = list1->head ;
-			PathElement* next = prev->next ;
-			prev->next = NULL ;
-			while ( next != NULL )
+			PathElement* prev = list1->head;
+			PathElement* next = prev->next;
+			prev->next = NULL;
+			while(next != NULL)
 			{
-				PathElement* tnext = next->next ;
-				next->next = prev ;
+				PathElement* tnext = next->next;
+				next->next = prev;
 
-				prev = next ;
-				next = tnext ;
+				prev = next;
+				next = tnext;
 			}
 
-			list1->tail = list1->head ;
-			list1->head = prev ;
+			list1->tail = list1->head;
+			list1->head = prev;
 		}
 		else
 		{
 			// Reverse list2
-			PathElement* prev = list2->head ;
-			PathElement* next = prev->next ;
-			prev->next = NULL ;
-			while ( next != NULL )
+			PathElement* prev = list2->head;
+			PathElement* next = prev->next;
+			prev->next = NULL;
+			while(next != NULL)
 			{
-				PathElement* tnext = next->next ;
-				next->next = prev ;
+				PathElement* tnext = next->next;
+				next->next = prev;
 
-				prev = next ;
-				next = tnext ;
+				prev = next;
+				next = tnext;
 			}
 
-			list2->tail = list2->head ;
-			list2->head = prev ;
+			list2->tail = list2->head;
+			list2->head = prev;
 		}
 	}	
 	
-	if ( isEqual( list1->head, list2->tail ) )
+	if(isEqual(list1->head, list2->tail))
 	{
 
 		// Easy case
-		PathElement* temp = list1->head->next ;
-		delete list1->head ;
-		list2->tail->next = temp ;
+		PathElement* temp = list1->head->next;
+		delete list1->head;
+		list2->tail->next = temp;
 
-		PathList* nlist = new PathList ;
-		nlist->length = list1->length + list2->length - 1 ;
-		nlist->head = list2->head ;
-		nlist->tail = list1->tail ;
-		nlist->next = NULL ;
+		PathList* nlist = new PathList;
+		nlist->length = list1->length + list2->length - 1;
+		nlist->head = list2->head;
+		nlist->tail = list1->tail;
+		nlist->next = NULL;
 
-		deletePath( head1, pre1, list1 ) ;
-		deletePath( head2, pre2, list2 ) ;
+		deletePath(head1, pre1, list1);
+		deletePath(head2, pre2, list2);
 
-		return nlist ;
+		return nlist;
 	} 
-	else if ( isEqual( list1->tail, list2->head ) )
+	else if(isEqual(list1->tail, list2->head))
 	{
 		// Easy case
-		PathElement* temp = list2->head->next ;
-		delete list2->head ;
-		list1->tail->next = temp ;
+		PathElement* temp = list2->head->next;
+		delete list2->head;
+		list1->tail->next = temp;
 
-		PathList* nlist = new PathList ;
-		nlist->length = list1->length + list2->length - 1 ;
-		nlist->head = list1->head ;
-		nlist->tail = list2->tail ;
-		nlist->next = NULL ;
+		PathList* nlist = new PathList;
+		nlist->length = list1->length + list2->length - 1;
+		nlist->head = list1->head;
+		nlist->tail = list2->tail;
+		nlist->next = NULL;
 
-		deletePath( head1, pre1, list1 ) ;
-		deletePath( head2, pre2, list2 ) ;
+		deletePath(head1, pre1, list1);
+		deletePath(head2, pre2, list2);
 
-		return nlist ;
+		return nlist;
 	}
 
-	return NULL ;
+	return NULL;
 }
 
-void Octree::deletePath( PathList*& head, PathList* pre, PathList*& curr )
+void Octree::deletePath(PathList*& head, PathList* pre, PathList*& curr)
 {
-	PathList* temp = curr ;
-	curr = temp->next ;
-	delete temp ;
+	PathList* temp = curr;
+	curr = temp->next;
+	delete temp;
 
-	if ( pre == NULL )
+	if(pre == NULL)
 	{
-		head = curr ;
+		head = curr;
 	}
 	else
 	{
-		pre->next = curr ;
+		pre->next = curr;
 	}
 }
 
-void Octree::printElement( PathElement* ele )
+void Octree::printElement(PathElement* ele)
 {
-	if ( ele != NULL )
+	if(ele != NULL)
 	{
-		dc_printf( " (%d %d %d)", ele->pos[0], ele->pos[1], ele->pos[2] ) ;
+		dc_printf("(%d %d %d)", ele->pos[0], ele->pos[1], ele->pos[2]);
 	}
 }
 
-void Octree::printPath( PathList* path )
+void Octree::printPath(PathList* path)
 {
 	PathElement* n = path->head;
-	int same = 0 ;
+	int same = 0;
 
 #if DC_DEBUG
-	int len = ( dimen >> maxDepth ) ;
+	int len =(dimen >> maxDepth);
 #endif
-	while ( n && ( same == 0 || n != path->head ) )
+	while(n &&(same == 0 || n != path->head))
 	{
-		same ++ ;
-		dc_printf( " (%d %d %d)", n->pos[0] / len, n->pos[1] / len, n->pos[2] / len ) ;
-		n = n->next ;
+		same ++;
+		dc_printf("(%d %d %d)", n->pos[0] / len, n->pos[1] / len, n->pos[2] / len);
+		n = n->next;
 	}
 
-	if ( n == path->head )
+	if(n == path->head)
 	{
-		dc_printf(" Ring!\n") ;
+		dc_printf(" Ring!\n");
 	}
 	else
 	{
-		dc_printf(" %p end!\n", n) ;
+		dc_printf(" %p end!\n", n);
 	}
 }
 
-void Octree::printPath( PathElement* path )
+void Octree::printPath(PathElement* path)
 {
 	PathElement *n = path;
-	int same = 0 ;
+	int same = 0;
 #if DC_DEBUG
-	int len = ( dimen >> maxDepth ) ; 
+	int len =(dimen >> maxDepth); 
 #endif
-	while ( n && ( same == 0 || n != path ) )
+	while(n &&(same == 0 || n != path))
 	{
-		same ++ ;
-		dc_printf( " (%d %d %d)", n->pos[0] / len, n->pos[1] / len, n->pos[2] / len ) ;
-		n = n->next ;
+		same ++;
+		dc_printf("(%d %d %d)", n->pos[0] / len, n->pos[1] / len, n->pos[2] / len);
+		n = n->next;
 	}
 
-	if ( n == path )
+	if(n == path)
 	{
-		dc_printf(" Ring!\n") ;
+		dc_printf(" Ring!\n");
 	}
 	else
 	{
-		dc_printf(" %p end!\n", n) ;
+		dc_printf(" %p end!\n", n);
 	}
 
 }
 
 
-void Octree::printPaths( PathList* path )
+void Octree::printPaths(PathList* path)
 {
-	PathList* iter = path ;
-	int i = 0 ;
-	while ( iter != NULL )
+	PathList* iter = path;
+	int i = 0;
+	while(iter != NULL)
 	{
-		dc_printf("Path %d:\n", i) ;
-		printPath( iter ) ;
-		iter = iter->next ;
-		i ++ ;
+		dc_printf("Path %d:\n", i);
+		printPath(iter);
+		iter = iter->next;
+		i ++;
 	}
 }
 
-UCHAR* Octree::patch( UCHAR* node, int st[3], int len, PathList* rings )
+Node* Octree::patch(Node* newnode, int st[3], int len, PathList* rings)
 {
 #ifdef IN_DEBUG_MODE
 	dc_printf("Call to PATCH with rings: \n");
-	printPaths( rings ) ;
+	printPaths(rings);
 #endif
 
 	/* Do nothing but couting 
-	PathList* tlist = rings ;
-	PathList* ttlist ;
-	PathElement* telem, * ttelem ;
-	while ( tlist!= NULL )
+	PathList* tlist = rings;
+	PathList* ttlist;
+	PathElement* telem, * ttelem;
+	while(tlist!= NULL)
 	{
-		// printPath( tlist ) ;
-		this->numRings ++ ;
-		this->totRingLengths += tlist->length ;
-		if ( tlist->length > this->maxRingLength )
+		// printPath(tlist);
+		numRings ++;
+		totRingLengths += tlist->length;
+		if(tlist->length > maxRingLength)
 		{
-			this->maxRingLength = tlist->length ;
+			maxRingLength = tlist->length;
 		}
-		ttlist = tlist ;
-		tlist = tlist->next ;
+		ttlist = tlist;
+		tlist = tlist->next;
 	}
-	return node ;
+	return node;
 	*/
 	
 
 	/* Pass onto separate calls in each direction */
-	UCHAR* newnode = node ;
-	if ( len == mindimen )
+	if(len == mindimen)
 	{
-		dc_printf("Error! should have no list by now.\n") ;
-		exit(0) ;
+		dc_printf("Error! should have no list by now.\n");
+		exit(0);
 	}
 	
 	// YZ plane
-	PathList* xlists[2] ;
-	newnode = patchSplit( newnode, st, len, rings, 0, xlists[0], xlists[1] ) ;
+	PathList* xlists[2];
+	newnode = patchSplit(newnode, st, len, rings, 0, xlists[0], xlists[1]);
 	
 	// XZ plane
-	PathList* ylists[4] ;
-	newnode = patchSplit( newnode, st, len, xlists[0], 1, ylists[0], ylists[1] ) ;
-	newnode = patchSplit( newnode, st, len, xlists[1], 1, ylists[2], ylists[3] ) ;
+	PathList* ylists[4];
+	newnode = patchSplit(newnode, st, len, xlists[0], 1, ylists[0], ylists[1]);
+	newnode = patchSplit(newnode, st, len, xlists[1], 1, ylists[2], ylists[3]);
 	
 	// XY plane
-	PathList* zlists[8] ;
-	newnode = patchSplit( newnode, st, len, ylists[0], 2, zlists[0], zlists[1] ) ;
-	newnode = patchSplit( newnode, st, len, ylists[1], 2, zlists[2], zlists[3] ) ;
-	newnode = patchSplit( newnode, st, len, ylists[2], 2, zlists[4], zlists[5] ) ;
-	newnode = patchSplit( newnode, st, len, ylists[3], 2, zlists[6], zlists[7] ) ;
+	PathList* zlists[8];
+	newnode = patchSplit(newnode, st, len, ylists[0], 2, zlists[0], zlists[1]);
+	newnode = patchSplit(newnode, st, len, ylists[1], 2, zlists[2], zlists[3]);
+	newnode = patchSplit(newnode, st, len, ylists[2], 2, zlists[4], zlists[5]);
+	newnode = patchSplit(newnode, st, len, ylists[3], 2, zlists[6], zlists[7]);
 	
 	// Recur
-	len >>= 1 ;
-	int count = 0 ;
-	for ( int i = 0 ; i < 8 ; i ++ )
+	len >>= 1;
+	int count = 0;
+	for(int i = 0; i < 8; i ++)
 	{
-		if ( zlists[i] != NULL )
+		if(zlists[i] != NULL)
 		{
-			int nori[3] = { 
+			int nori[3] = {
 				st[0] + len * vertmap[i][0] , 
 				st[1] + len * vertmap[i][1] , 
-				st[2] + len * vertmap[i][2] } ;
-			patch( getChild( newnode , count ), nori, len, zlists[i] ) ;
+				st[2] + len * vertmap[i][2]};
+			patch(getChild(&newnode->internal , count), nori, len, zlists[i]);
 		}
 
-		if ( hasChild( newnode, i ) )
+		if(hasChild(&newnode->internal, i))
 		{
-			count ++ ;
+			count ++;
 		}
 	}
 #ifdef IN_DEBUG_MODE
-	dc_printf("Return from PATCH\n") ;
+	dc_printf("Return from PATCH\n");
 #endif
-	return newnode ;
+	return newnode;
 	
 }
 
 
-UCHAR* Octree::patchSplit( UCHAR* node, int st[3], int len, PathList* rings, int dir, PathList*& nrings1, PathList*& nrings2 )
+Node* Octree::patchSplit(Node* newnode, int st[3], int len, PathList* rings,
+						 int dir, PathList*& nrings1, PathList*& nrings2)
 {
 #ifdef IN_DEBUG_MODE
 	dc_printf("Call to PATCHSPLIT with direction %d and rings: \n", dir);
-	printPaths( rings ) ;
+	printPaths(rings);
 #endif
 
-	UCHAR* newnode = node ;
-	nrings1 = NULL ;
-	nrings2 = NULL ;
-	PathList* tmp ;
-	while ( rings != NULL )
+	nrings1 = NULL;
+	nrings2 = NULL;
+	PathList* tmp;
+	while(rings != NULL)
 	{
 		// Process this ring
-		newnode = patchSplitSingle( newnode, st, len, rings->head, dir, nrings1, nrings2 ) ;
+		newnode = patchSplitSingle(newnode, st, len, rings->head, dir, nrings1, nrings2);
 		
 		// Delete this ring from the group
-		tmp = rings ;
-		rings = rings->next ;
-		delete tmp ;
+		tmp = rings;
+		rings = rings->next;
+		delete tmp;
 	}
 
 #ifdef IN_DEBUG_MODE
 	dc_printf("Return from PATCHSPLIT with \n");
-	dc_printf("Rings gourp 1:\n") ;
-	printPaths( nrings1 ) ;
-	dc_printf("Rings group 2:\n") ;
-	printPaths( nrings2 ) ;
+	dc_printf("Rings gourp 1:\n");
+	printPaths(nrings1);
+	dc_printf("Rings group 2:\n");
+	printPaths(nrings2);
 #endif
 
-	return newnode ;
+	return newnode;
 }
 
-UCHAR* Octree::patchSplitSingle( UCHAR* node, int st[3], int len, PathElement* head, int dir, PathList*& nrings1, PathList*& nrings2 )
+Node* Octree::patchSplitSingle(Node* newnode, int st[3], int len, PathElement* head, int dir, PathList*& nrings1, PathList*& nrings2)
 {
 #ifdef IN_DEBUG_MODE
-	dc_printf("Call to PATCHSPLITSINGLE with direction %d and path: \n", dir );
-	printPath( head ) ;
+	dc_printf("Call to PATCHSPLITSINGLE with direction %d and path: \n", dir);
+	printPath(head);
 #endif
 
-	UCHAR* newnode = node ;
-
-	if ( head == NULL )
+	if(head == NULL)
 	{
 #ifdef IN_DEBUG_MODE
-		dc_printf("Return from PATCHSPLITSINGLE with head==NULL.\n") ;
+		dc_printf("Return from PATCHSPLITSINGLE with head==NULL.\n");
 #endif
 		return newnode;
 	}
 	else
 	{
-		// printPath( head ) ;
+		// printPath(head);
 	}
 	
 	// Walk along the ring to find pair of intersections
-	PathElement* pre1 = NULL ;
-	PathElement* pre2 = NULL ;
-	int side = findPair ( head, st[ dir ] + len / 2 , dir, pre1, pre2 ) ;
+	PathElement* pre1 = NULL;
+	PathElement* pre2 = NULL;
+	int side = findPair(head, st[dir] + len / 2 , dir, pre1, pre2);
 	
 	/*
-	if ( pre1 == pre2 )
+	if(pre1 == pre2)
 	{
-		int edgelen = ( dimen >> maxDepth ) ;
-		dc_printf("Location: %d %d %d Direction: %d Reso: %d\n", st[0]/edgelen, st[1]/edgelen, st[2]/edgelen, dir, len/edgelen) ;
-		printPath( head ) ;
-		exit( 0 ) ;
+		int edgelen =(dimen >> maxDepth);
+		dc_printf("Location: %d %d %d Direction: %d Reso: %d\n", st[0]/edgelen, st[1]/edgelen, st[2]/edgelen, dir, len/edgelen);
+		printPath(head);
+		exit(0);
 	}
 	*/
 	
-	if ( side )
+	if(side)
 	{
 		// Entirely on one side
-		PathList* nring = new PathList( ) ;
-		nring->head = head ;
+		PathList* nring = new PathList();
+		nring->head = head;
 		
-		if ( side == -1 )
+		if(side == -1)
 		{
-			nring->next = nrings1 ;
-			nrings1 = nring ;
+			nring->next = nrings1;
+			nrings1 = nring;
 		}
 		else
 		{
-			nring->next = nrings2 ;
-			nrings2 = nring ;
+			nring->next = nrings2;
+			nrings2 = nring;
 		}
 	}
 	else
 	{
 		// Break into two parts
-		PathElement* nxt1 = pre1->next ;
-		PathElement* nxt2 = pre2->next ;
-		pre1->next = nxt2 ;
-		pre2->next = nxt1 ;
+		PathElement* nxt1 = pre1->next;
+		PathElement* nxt2 = pre2->next;
+		pre1->next = nxt2;
+		pre2->next = nxt1;
 
-		newnode = connectFace( newnode, st, len, dir, pre1, pre2 ) ;
+		newnode = connectFace(newnode, st, len, dir, pre1, pre2);
 	
-		if ( isEqual( pre1, pre1->next ) )
+		if(isEqual(pre1, pre1->next))
 		{
-			if ( pre1 == pre1->next )
+			if(pre1 == pre1->next)
 			{
-				delete pre1 ;
-				pre1 = NULL ;
+				delete pre1;
+				pre1 = NULL;
 			}
 			else
 			{
-				PathElement* temp = pre1->next ;
-				pre1->next = temp->next ;
-				delete temp ;
+				PathElement* temp = pre1->next;
+				pre1->next = temp->next;
+				delete temp;
 			}
 		}
-		if ( isEqual( pre2, pre2->next ) )
+		if(isEqual(pre2, pre2->next))
 		{
-			if ( pre2 == pre2->next )
+			if(pre2 == pre2->next)
 			{
-				delete pre2 ;
-				pre2 = NULL ;
+				delete pre2;
+				pre2 = NULL;
 			}
 			else
 			{
-				PathElement* temp = pre2->next ;
-				pre2->next = temp->next ;
-				delete temp ;
+				PathElement* temp = pre2->next;
+				pre2->next = temp->next;
+				delete temp;
 			}
 		}
 
-		compressRing ( pre1 ) ;
-		compressRing ( pre2 ) ;
+		compressRing(pre1);
+		compressRing(pre2);
 		
 		// Recur
-		newnode = patchSplitSingle( newnode, st, len, pre1, dir, nrings1, nrings2 ) ;
-		newnode = patchSplitSingle( newnode, st, len, pre2, dir, nrings1, nrings2 ) ;
+		newnode = patchSplitSingle(newnode, st, len, pre1, dir, nrings1, nrings2);
+		newnode = patchSplitSingle(newnode, st, len, pre2, dir, nrings1, nrings2);
 		
 	}
 
 #ifdef IN_DEBUG_MODE
 	dc_printf("Return from PATCHSPLITSINGLE with \n");
-	dc_printf("Rings gourp 1:\n") ;
-	printPaths( nrings1 ) ;
-	dc_printf("Rings group 2:\n") ;
-	printPaths( nrings2 ) ;
+	dc_printf("Rings gourp 1:\n");
+	printPaths(nrings1);
+	dc_printf("Rings group 2:\n");
+	printPaths(nrings2);
 #endif
 
-	return newnode ;
+	return newnode;
 }
 
-UCHAR* Octree::connectFace( UCHAR* node, int st[3], int len, int dir, PathElement* f1, PathElement* f2 )
+Node* Octree::connectFace(Node* newnode, int st[3], int len, int dir,
+						   PathElement* f1, PathElement* f2)
 {
 #ifdef IN_DEBUG_MODE
-	dc_printf("Call to CONNECTFACE with direction %d and length %d path: \n", dir, len );
-	dc_printf("Path (low side): \n" ) ;
-	printPath( f1 ) ;
-//	checkPath( f1 ) ;
-	dc_printf("Path (high side): \n" ) ;
-	printPath( f2 ) ;
-//	checkPath( f2 ) ;
+	dc_printf("Call to CONNECTFACE with direction %d and length %d path: \n", dir, len);
+	dc_printf("Path(low side): \n");
+	printPath(f1);
+//	checkPath(f1);
+	dc_printf("Path(high side): \n");
+	printPath(f2);
+//	checkPath(f2);
 #endif
 
-	UCHAR* newnode = node ;
-
 	// Setup 2D 
-	int pos = st[ dir ] + len / 2 ;
-	int xdir = ( dir + 1 ) % 3 ;
-	int ydir = ( dir + 2 ) % 3 ;
+	int pos = st[dir] + len / 2;
+	int xdir =(dir + 1) % 3;
+	int ydir =(dir + 2) % 3;
 	
 	// Use existing intersections on f1 and f2
-	int x1, y1, x2, y2 ;
-	float p1, q1, p2, q2 ;
+	int x1, y1, x2, y2;
+	float p1, q1, p2, q2;
 
-	getFacePoint( f2->next, dir, x1, y1, p1, q1 ) ;
-	getFacePoint( f2, dir, x2, y2, p2, q2 ) ;
+	getFacePoint(f2->next, dir, x1, y1, p1, q1);
+	getFacePoint(f2, dir, x2, y2, p2, q2);
  
-	float dx = x2 + p2 - x1 - p1 ;
-	float dy = y2 + q2 - y1 - q1 ;
+	float dx = x2 + p2 - x1 - p1;
+	float dy = y2 + q2 - y1 - q1;
 	
 	// Do adapted Bresenham line drawing
-	float rx = p1, ry = q1 ;
-	int incx = 1, incy = 1 ; 
-	int lx = x1, ly = y1 ;
-	int hx = x2, hy = y2 ;
-	int choice ;
-	if ( x2 < x1 )
+	float rx = p1, ry = q1;
+	int incx = 1, incy = 1; 
+	int lx = x1, ly = y1;
+	int hx = x2, hy = y2;
+	int choice;
+	if(x2 < x1)
 	{
-		incx = -1 ;
-		rx = 1 - rx ;
-		lx = x2 ;
-		hx = x1 ;
+		incx = -1;
+		rx = 1 - rx;
+		lx = x2;
+		hx = x1;
 	}
-	if ( y2 < y1 )
+	if(y2 < y1)
 	{
-		incy = -1 ;
-		ry = 1 - ry ;
-		ly = y2 ;
-		hy = y1 ;
+		incy = -1;
+		ry = 1 - ry;
+		ly = y2;
+		hy = y1;
 	}
 	
-	float sx = dx * incx ;
-	float sy = dy * incy ;
+	float sx = dx * incx;
+	float sy = dy * incy;
 	
-	int ori[3] ;
-	ori[ dir ] = pos / mindimen ;
-	ori[ xdir ] = x1 ;
-	ori[ ydir ] = y1 ;
-	int walkdir ;
-	int inc ;
-	float alpha ;
-
-	PathElement* curEleN = f1 ;
-	PathElement* curEleP = f2->next ;
-	UCHAR *nodeN = NULL, *nodeP = NULL ;
-	UCHAR *curN = locateLeaf( newnode, len, f1->pos ) ;
-	UCHAR *curP = locateLeaf( newnode, len, f2->next->pos ) ;
-	if ( curN == NULL || curP == NULL )
-	{
-		exit(0) ;
-	}
-	int stN[3], stP[3] ;
-	int lenN, lenP ;
+	int ori[3];
+	ori[dir] = pos / mindimen;
+	ori[xdir] = x1;
+	ori[ydir] = y1;
+	int walkdir;
+	int inc;
+	float alpha;
+
+	PathElement* curEleN = f1;
+	PathElement* curEleP = f2->next;
+	Node *nodeN = NULL, *nodeP = NULL;
+	LeafNode *curN = locateLeaf(&newnode->internal, len, f1->pos);
+	LeafNode *curP = locateLeaf(&newnode->internal, len, f2->next->pos);
+	if(curN == NULL || curP == NULL)
+	{
+		exit(0);
+	}
+	int stN[3], stP[3];
+	int lenN, lenP;
 	
 	/* Unused code, leaving for posterity
 
-	float stpt[3], edpt[3] ;
-	stpt[ dir ] = edpt[ dir ] = (float) pos ;
-	stpt[ xdir ] = ( x1 + p1 ) * mindimen ;
-	stpt[ ydir ] = ( y1 + q1 ) * mindimen ;
-	edpt[ xdir ] = ( x2 + p2 ) * mindimen ;
-	edpt[ ydir ] = ( y2 + q2 ) * mindimen ;
+	float stpt[3], edpt[3];
+	stpt[dir] = edpt[dir] =(float) pos;
+	stpt[xdir] =(x1 + p1) * mindimen;
+	stpt[ydir] =(y1 + q1) * mindimen;
+	edpt[xdir] =(x2 + p2) * mindimen;
+	edpt[ydir] =(y2 + q2) * mindimen;
 	*/
-	while( ori[ xdir ] != x2 || ori[ ydir ] != y2 )
+	while(ori[xdir] != x2 || ori[ydir] != y2)
 	{
-		int next ;
-		if ( sy * (1 - rx) > sx * (1 - ry) )
+		int next;
+		if(sy *(1 - rx) > sx *(1 - ry))
 		{
-			choice = 1 ; 
-			next = ori[ ydir ] + incy ;
-			if ( next < ly || next > hy ) 
+			choice = 1; 
+			next = ori[ydir] + incy;
+			if(next < ly || next > hy) 
 			{
-				choice = 4 ;
-				next = ori[ xdir ] + incx ;
+				choice = 4;
+				next = ori[xdir] + incx;
 			}
 		}
 		else
 		{
-			choice = 2 ;
-			next = ori[ xdir ] + incx ;
-			if ( next < lx || next > hx ) 
+			choice = 2;
+			next = ori[xdir] + incx;
+			if(next < lx || next > hx) 
 			{
-				choice = 3 ;
-				next = ori[ ydir ] + incy ;
+				choice = 3;
+				next = ori[ydir] + incy;
 			}
 		}
 		
-		if ( choice & 1 )
+		if(choice & 1)
 		{
-			ori[ ydir ] = next ;
-			if ( choice == 1 )
+			ori[ydir] = next;
+			if(choice == 1)
 			{
-				rx += ( sy == 0 ? 0 : (1 - ry) * sx / sy  ) ; 
-				ry = 0 ;
+				rx +=(sy == 0 ? 0 :(1 - ry) * sx / sy ); 
+				ry = 0;
 			}
 			
-			walkdir = 2 ;
-			inc = incy ;
-			alpha = x2 < x1 ? 1 - rx : rx ;
+			walkdir = 2;
+			inc = incy;
+			alpha = x2 < x1 ? 1 - rx : rx;
 		}
 		else
 		{
-			ori[ xdir ] = next ;
-			if ( choice == 2 )
+			ori[xdir] = next;
+			if(choice == 2)
 			{
-				ry += ( sx == 0 ? 0 : (1 - rx) * sy / sx ) ;
-				rx = 0 ;	
+				ry +=(sx == 0 ? 0 :(1 - rx) * sy / sx);
+				rx = 0;	
 			}
 			
-			walkdir = 1 ;
-			inc = incx ;
-			alpha = y2 < y1 ? 1 - ry : ry ;
+			walkdir = 1;
+			inc = incx;
+			alpha = y2 < y1 ? 1 - ry : ry;
 		}
 		
 
 
 		// Get the exact location of the marcher
-		int nori[3] = { ori[0] * mindimen, ori[1] * mindimen, ori[2] * mindimen } ;
-		float spt[3] = { (float) nori[0], (float) nori[1], (float) nori[2] } ;
-		spt[ ( dir + ( 3 - walkdir ) ) % 3 ] += alpha * mindimen ;
-		if ( inc < 0 )
+		int nori[3] = {ori[0] * mindimen, ori[1] * mindimen, ori[2] * mindimen};
+		float spt[3] = {(float) nori[0],(float) nori[1],(float) nori[2]};
+		spt[(dir +(3 - walkdir)) % 3] += alpha * mindimen;
+		if(inc < 0)
 		{
-			spt[ ( dir + walkdir ) % 3 ] += mindimen ;
+			spt[(dir + walkdir) % 3] += mindimen;
 		}
 		
-		// dc_printf("new x,y: %d %d\n", ori[ xdir ] / edgelen, ori[ ydir ] / edgelen ) ;
-		// dc_printf("nori: %d %d %d alpha: %f walkdir: %d\n", nori[0], nori[1], nori[2], alpha, walkdir ) ;
-		// dc_printf("%f %f %f\n", spt[0], spt[1], spt[2] ) ;
+		// dc_printf("new x,y: %d %d\n", ori[xdir] / edgelen, ori[ydir] / edgelen);
+		// dc_printf("nori: %d %d %d alpha: %f walkdir: %d\n", nori[0], nori[1], nori[2], alpha, walkdir);
+		// dc_printf("%f %f %f\n", spt[0], spt[1], spt[2]);
 
 		// Locate the current cells on both sides
-		newnode = locateCell( newnode, st, len, nori, dir, 1, nodeN, stN, lenN ) ;
-		newnode = locateCell( newnode, st, len, nori, dir, 0, nodeP, stP, lenP ) ;
+		newnode = locateCell(&newnode->internal, st, len, nori, dir, 1, nodeN, stN, lenN);
+		newnode = locateCell(&newnode->internal, st, len, nori, dir, 0, nodeP, stP, lenP);
 
-		updateParent( newnode, len, st ) ;
+		updateParent(&newnode->internal, len, st);
 
-		int flag = 0 ;
+		int flag = 0;
 		// Add the cells to the rings and fill in the patch
-		PathElement* newEleN ;
-		if ( curEleN->pos[0] != stN[0] || curEleN->pos[1] != stN[1] || curEleN->pos[2] != stN[2] )
+		PathElement* newEleN;
+		if(curEleN->pos[0] != stN[0] || curEleN->pos[1] != stN[1] || curEleN->pos[2] != stN[2])
 		{
-			if ( curEleN->next->pos[0] != stN[0] || curEleN->next->pos[1] != stN[1] || curEleN->next->pos[2] != stN[2] )
+			if(curEleN->next->pos[0] != stN[0] || curEleN->next->pos[1] != stN[1] || curEleN->next->pos[2] != stN[2])
 			{
-				newEleN = new PathElement ;
-				newEleN->next = curEleN->next ;
-				newEleN->pos[0] = stN[0] ;
-				newEleN->pos[1] = stN[1] ;
-				newEleN->pos[2] = stN[2] ;
+				newEleN = new PathElement;
+				newEleN->next = curEleN->next;
+				newEleN->pos[0] = stN[0];
+				newEleN->pos[1] = stN[1];
+				newEleN->pos[2] = stN[2];
 
-				curEleN->next = newEleN ;
+				curEleN->next = newEleN;
 			}
 			else
 			{
-				newEleN = curEleN->next ;
+				newEleN = curEleN->next;
 			}
-			curN = patchAdjacent( newnode, len, curEleN->pos, curN, newEleN->pos, nodeN, walkdir, inc, dir, 1, alpha ) ;
+			curN = patchAdjacent(&newnode->internal, len, curEleN->pos, curN,
+								 newEleN->pos, (LeafNode*)nodeN, walkdir,
+								 inc, dir, 1, alpha);
 
-			curEleN = newEleN ;
-			flag ++ ;
+			curEleN = newEleN;
+			flag ++;
 		}
 
-		PathElement* newEleP ;
-		if ( curEleP->pos[0] != stP[0] || curEleP->pos[1] != stP[1] || curEleP->pos[2] != stP[2] )
+		PathElement* newEleP;
+		if(curEleP->pos[0] != stP[0] || curEleP->pos[1] != stP[1] || curEleP->pos[2] != stP[2])
 		{
-			if ( f2->pos[0] != stP[0] || f2->pos[1] != stP[1] || f2->pos[2] != stP[2] )
+			if(f2->pos[0] != stP[0] || f2->pos[1] != stP[1] || f2->pos[2] != stP[2])
 			{
-				newEleP = new PathElement ;
-				newEleP->next = curEleP ;
-				newEleP->pos[0] = stP[0] ;
-				newEleP->pos[1] = stP[1] ;
-				newEleP->pos[2] = stP[2] ;
+				newEleP = new PathElement;
+				newEleP->next = curEleP;
+				newEleP->pos[0] = stP[0];
+				newEleP->pos[1] = stP[1];
+				newEleP->pos[2] = stP[2];
 
-				f2->next = newEleP ;
+				f2->next = newEleP;
 			}
 			else
 			{
-				newEleP = f2 ;
+				newEleP = f2;
 			}
-			curP = patchAdjacent( newnode, len, curEleP->pos, curP, newEleP->pos, nodeP, walkdir, inc, dir, 0, alpha ) ;
+			curP = patchAdjacent(&newnode->internal, len, curEleP->pos, curP,
+								 newEleP->pos, (LeafNode*)nodeP, walkdir,
+								 inc, dir, 0, alpha);
 
 
 
-			curEleP = newEleP ;
-			flag ++ ;
+			curEleP = newEleP;
+			flag ++;
 		}
 
 			
 		/*
-		if ( flag == 0 )
+		if(flag == 0)
 		{
-			dc_printf("error: non-synchronized patching! at \n") ;
+			dc_printf("error: non-synchronized patching! at \n");
 		}
 		*/
 	}
 
 #ifdef IN_DEBUG_MODE
 	dc_printf("Return from CONNECTFACE with \n");
-	dc_printf("Path (low side):\n") ;
-	printPath( f1 ) ;
-	checkPath( f1 ) ;
-	dc_printf("Path (high side):\n") ;
-	printPath( f2 ) ;
-	checkPath( f2 ) ;
+	dc_printf("Path(low side):\n");
+	printPath(f1);
+	checkPath(f1);
+	dc_printf("Path(high side):\n");
+	printPath(f2);
+	checkPath(f2);
 #endif
 
 
-	return newnode ;
+	return newnode;
 }
 
-UCHAR* Octree::patchAdjacent( UCHAR* node, int len, int st1[3], UCHAR* leaf1, int st2[3], UCHAR* leaf2, int walkdir, int inc, int dir, int side, float alpha )
+LeafNode* Octree::patchAdjacent(InternalNode* node, int len, int st1[3],
+								LeafNode* leaf1, int st2[3], LeafNode* leaf2,
+								int walkdir, int inc, int dir, int side,
+								float alpha)
 {
 #ifdef IN_DEBUG_MODE
-	dc_printf("Before patching.\n") ;
-	printInfo( st1 ) ;
-	printInfo( st2 ) ;
-	dc_printf("-----------------%d %d %d ; %d %d %d\n", st1[0], st2[1], st1[2], st2[0], st2[1], st2[2] ) ;
+	dc_printf("Before patching.\n");
+	printInfo(st1);
+	printInfo(st2);
+	dc_printf("-----------------%d %d %d; %d %d %d\n", st1[0], st2[1], st1[2], st2[0], st2[1], st2[2]);
 #endif
 
 	// Get edge index on each leaf
-	int edgedir = ( dir + ( 3 - walkdir ) ) % 3 ;
-	int incdir = ( dir + walkdir ) % 3 ;
-	int ind1 = ( edgedir == 1 ? ( dir + 3 - edgedir ) % 3 - 1 : 2 - ( dir + 3 - edgedir ) % 3 ) ;
-	int ind2 = ( edgedir == 1 ? ( incdir + 3 - edgedir ) % 3 - 1 : 2 - ( incdir + 3 - edgedir ) % 3 ) ;
+	int edgedir =(dir +(3 - walkdir)) % 3;
+	int incdir =(dir + walkdir) % 3;
+	int ind1 =(edgedir == 1 ?(dir + 3 - edgedir) % 3 - 1 : 2 -(dir + 3 - edgedir) % 3);
+	int ind2 =(edgedir == 1 ?(incdir + 3 - edgedir) % 3 - 1 : 2 -(incdir + 3 - edgedir) % 3);
 
-	int eind1 = ( ( edgedir << 2 ) | ( side << ind1 ) | ( ( inc > 0 ? 1 : 0 ) << ind2 ) ) ;
-	int eind2 = ( ( edgedir << 2 ) | ( side << ind1 ) | ( ( inc > 0 ? 0 : 1 ) << ind2 ) ) ;
+	int eind1 =((edgedir << 2) |(side << ind1) |((inc > 0 ? 1 : 0) << ind2));
+	int eind2 =((edgedir << 2) |(side << ind1) |((inc > 0 ? 0 : 1) << ind2));
 
 #ifdef IN_DEBUG_MODE
-	dc_printf("Index 1: %d Alpha 1: %f Index 2: %d Alpha 2: %f\n", eind1, alpha, eind2, alpha ) ;
+	dc_printf("Index 1: %d Alpha 1: %f Index 2: %d Alpha 2: %f\n", eind1, alpha, eind2, alpha);
 	/*
-	if ( alpha < 0 || alpha > 1 )
+	if(alpha < 0 || alpha > 1)
 	{
-		dc_printf("Index 1: %d Alpha 1: %f Index 2: %d Alpha 2: %f\n", eind1, alpha, eind2, alpha ) ;
-		printInfo( st1 ) ;
-		printInfo( st2 ) ;
+		dc_printf("Index 1: %d Alpha 1: %f Index 2: %d Alpha 2: %f\n", eind1, alpha, eind2, alpha);
+		printInfo(st1);
+		printInfo(st2);
 	}
 	*/
 #endif
 
 	// Flip edge parity
-	UCHAR* nleaf1 = flipEdge( leaf1, eind1, alpha ) ;
-	UCHAR* nleaf2 = flipEdge( leaf2, eind2, alpha ) ;
+	LeafNode* nleaf1 = flipEdge(leaf1, eind1, alpha);
+	LeafNode* nleaf2 = flipEdge(leaf2, eind2, alpha);
 
 	// Update parent link
-	updateParent( node, len, st1, nleaf1 ) ;
-	updateParent( node, len, st2, nleaf2 ) ;
-	// updateParent( nleaf1, mindimen, st1 ) ;
-	// updateParent( nleaf2, mindimen, st2 ) ;
+	updateParent(node, len, st1, nleaf1);
+	updateParent(node, len, st2, nleaf2);
+	// updateParent(nleaf1, mindimen, st1);
+	// updateParent(nleaf2, mindimen, st2);
 
 	/*
-	float m[3] ;
-	dc_printf("Adding new point: %f %f %f\n", spt[0], spt[1], spt[2] ) ;
-	getMinimizer( leaf1, m ) ;
-	dc_printf("Cell %d now has minimizer %f %f %f\n", leaf1, m[0], m[1], m[2] ) ;
-	getMinimizer( leaf2, m ) ;
-	dc_printf("Cell %d now has minimizer %f %f %f\n", leaf2, m[0], m[1], m[2] ) ;
+	float m[3];
+	dc_printf("Adding new point: %f %f %f\n", spt[0], spt[1], spt[2]);
+	getMinimizer(leaf1, m);
+	dc_printf("Cell %d now has minimizer %f %f %f\n", leaf1, m[0], m[1], m[2]);
+	getMinimizer(leaf2, m);
+	dc_printf("Cell %d now has minimizer %f %f %f\n", leaf2, m[0], m[1], m[2]);
 	*/		
 
 #ifdef IN_DEBUG_MODE
-	dc_printf("After patching.\n") ;
-	printInfo( st1 ) ;
-	printInfo( st2 ) ;
+	dc_printf("After patching.\n");
+	printInfo(st1);
+	printInfo(st2);
 #endif
-	return nleaf2 ;
+	return nleaf2;
 }
 
-UCHAR* Octree::locateCell( UCHAR* node, int st[3], int len, int ori[3], int dir, int side, UCHAR*& rleaf, int rst[3], int& rlen )
+Node* Octree::locateCell(InternalNode* node, int st[3], int len, int ori[3], int dir, int side, Node*& rleaf, int rst[3], int& rlen)
 {
 #ifdef IN_DEBUG_MODE
-	// dc_printf("Call to LOCATECELL with node ") ;
-	// printNode( node ) ;
+	// dc_printf("Call to LOCATECELL with node ");
+	// printNode(node);
 #endif
-	UCHAR* newnode = node ;
-	int i ;
-	len >>= 1 ;
-	int ind = 0 ;
-	for ( i = 0 ; i < 3 ; i ++ )
+
+	int i;
+	len >>= 1;
+	int ind = 0;
+	for(i = 0; i < 3; i ++)
 	{
-		ind <<= 1 ;
-		if ( i == dir && side == 1 )
+		ind <<= 1;
+		if(i == dir && side == 1)
 		{
-			ind |= ( ori[ i ] <= ( st[ i ] + len ) ? 0 : 1 ) ;
+			ind |=(ori[i] <=(st[i] + len) ? 0 : 1);
 		}
 		else
 		{
-			ind |= ( ori[ i ] < ( st[ i ] + len ) ? 0 : 1 ) ;
+			ind |=(ori[i] <(st[i] + len) ? 0 : 1);
 		}
 	}
 
 #ifdef IN_DEBUG_MODE
-	// dc_printf("In LOCATECELL index of ori (%d %d %d) with dir %d side %d in st (%d %d %d, %d) is: %d\n",
-	//	ori[0], ori[1], ori[2], dir, side, st[0], st[1], st[2], len, ind ) ;
+	// dc_printf("In LOCATECELL index of ori(%d %d %d) with dir %d side %d in st(%d %d %d, %d) is: %d\n",
+	//	ori[0], ori[1], ori[2], dir, side, st[0], st[1], st[2], len, ind);
 #endif
 
-	rst[0] = st[0] + vertmap[ ind ][ 0 ] * len ;
-	rst[1] = st[1] + vertmap[ ind ][ 1 ] * len ;
-	rst[2] = st[2] + vertmap[ ind ][ 2 ] * len ;
+	rst[0] = st[0] + vertmap[ind][0] * len;
+	rst[1] = st[1] + vertmap[ind][1] * len;
+	rst[2] = st[2] + vertmap[ind][2] * len;
 	
-	if ( hasChild( newnode, ind ) )
+	if(hasChild(node, ind))
 	{
-		int count = getChildCount( newnode, ind ) ;
-		UCHAR* chd = getChild( newnode, count ) ;
-		if ( isLeaf( newnode, ind ) )
+		int count = getChildCount(node, ind);
+		Node* chd = getChild(node, count);
+		if(isLeaf(node, ind))
 		{
-			rleaf = chd ;
-			rlen = len ;
+			rleaf = chd;
+			rlen = len;
 		}
 		else
 		{
 			// Recur
-			setChild( newnode, count, locateCell( chd, rst, len, ori, dir, side, rleaf, rst, rlen ) ) ;
+			setChild(node, count, locateCell(&chd->internal, rst, len, ori, dir, side, rleaf, rst, rlen));
 		}
 	}
 	else
 	{
 		// Create a new child here
-		if ( len == this->mindimen )
+		if(len == mindimen)
 		{
-			UCHAR* chd = createLeaf( 0 ) ;
-			newnode = addChild( newnode, ind, chd, 1 ) ;
-			rleaf = chd ;
-			rlen = len ;
+			LeafNode* chd = createLeaf(0);
+			node = addChild(node, ind, (Node*)chd, 1);
+			rleaf = (Node*)chd;
+			rlen = len;
 		}
 		else
 		{
 			// Subdivide the empty cube
-			UCHAR* chd = createInternal( 0 ) ;
-			newnode = addChild( newnode, ind, locateCell( chd, rst, len, ori, dir, side, rleaf, rst, rlen ), 0 ) ;
+			InternalNode* chd = createInternal(0);
+			node = addChild(node, ind,
+							locateCell(chd, rst, len, ori, dir, side, rleaf, rst, rlen), 0);
 		}
 	}
 	
 #ifdef IN_DEBUG_MODE
-	// dc_printf("Return from LOCATECELL with node ") ;
-	// printNode( newnode ) ;
+	// dc_printf("Return from LOCATECELL with node ");
+	// printNode(newnode);
 #endif
-	return newnode ;
+	return (Node*)node;
 }
 
-void Octree::checkElement( PathElement* ele )
+void Octree::checkElement(PathElement* ele)
 {
 	/*
-	if ( ele != NULL && locateLeafCheck( ele->pos ) != ele->node )
+	if(ele != NULL && locateLeafCheck(ele->pos) != ele->node)
 	{
 		dc_printf("Screwed! at pos: %d %d %d\n", ele->pos[0]>>minshift, ele->pos[1]>>minshift, ele->pos[2]>>minshift);
-		exit( 0 ) ;
+		exit(0);
 	}
 	*/
 }
 
-void Octree::checkPath( PathElement* path )
+void Octree::checkPath(PathElement* path)
 {
-	PathElement *n = path ;
-	int same = 0 ;
-	while ( n && ( same == 0 || n != path ) )
+	PathElement *n = path;
+	int same = 0;
+	while(n &&(same == 0 || n != path))
 	{
-		same ++ ;
-		checkElement( n ) ;
-		n = n->next ;
+		same ++;
+		checkElement(n);
+		n = n->next;
 	}
 
 }
 
-void Octree::testFacePoint( PathElement* e1, PathElement* e2 )
+void Octree::testFacePoint(PathElement* e1, PathElement* e2)
 {
-	int i ;
-	PathElement * e = NULL ;
-	for ( i = 0 ; i < 3 ; i ++ )
+	int i;
+	PathElement * e = NULL;
+	for(i = 0; i < 3; i ++)
 	{
-		if ( e1->pos[i] != e2->pos[i] )
+		if(e1->pos[i] != e2->pos[i])
 		{
-			if ( e1->pos[i] < e2->pos[i] )
+			if(e1->pos[i] < e2->pos[i])
 			{
-				e = e2 ;
+				e = e2;
 			}
 			else
 			{
-				e = e1 ;
+				e = e1;
 			}
-			break ;
+			break;
 		}
 	}
 
-	int x, y ;
-	float p, q ;
-	dc_printf("Test.") ;
-	getFacePoint( e, i, x, y, p, q ) ;
+	int x, y;
+	float p, q;
+	dc_printf("Test.");
+	getFacePoint(e, i, x, y, p, q);
 }
 
-void Octree::getFacePoint( PathElement* leaf, int dir, int& x, int& y, float& p, float& q )
+void Octree::getFacePoint(PathElement* leaf, int dir, int& x, int& y, float& p, float& q)
 {
 	// Find average intersections
-	float avg[3] = {0, 0, 0} ;
-	float off[3] ;
-	int num = 0, num2 = 0 ;
+	float avg[3] = {0, 0, 0};
+	float off[3];
+	int num = 0, num2 = 0;
 
-	UCHAR* leafnode = locateLeaf( leaf->pos ) ;
-	for ( int i = 0 ; i < 4 ; i ++ )
+	LeafNode* leafnode = locateLeaf(leaf->pos);
+	for(int i = 0; i < 4; i ++)
 	{
-		int edgeind = faceMap[ dir * 2 ][ i ] ;
-		int nst[3] ;
-		for ( int j = 0 ; j < 3 ; j ++ )
+		int edgeind = faceMap[dir * 2][i];
+		int nst[3];
+		for(int j = 0; j < 3; j ++)
 		{
-			nst[j] = leaf->pos[j] + mindimen * vertmap[ edgemap[ edgeind][ 0 ] ][ j ] ;
+			nst[j] = leaf->pos[j] + mindimen * vertmap[edgemap[edgeind][0]][j];
 		}
 
-		if ( getEdgeIntersectionByIndex( nst, edgeind / 4, off, 1 ) )
+		if(getEdgeIntersectionByIndex(nst, edgeind / 4, off, 1))
 		{
-			avg[0] += off[0] ;
-			avg[1] += off[1] ;
-			avg[2] += off[2] ;
-			num ++ ;
+			avg[0] += off[0];
+			avg[1] += off[1];
+			avg[2] += off[2];
+			num ++;
 		}
-		if ( getEdgeParity( leafnode, edgeind ) )
+		if(getEdgeParity(leafnode, edgeind))
 		{
-			num2 ++ ;
+			num2 ++;
 		}
 	}
-	if ( num == 0 )
+	if(num == 0)
 	{
  		dc_printf("Wrong! dir: %d pos: %d %d %d num: %d\n", dir, leaf->pos[0]>>minshift, leaf->pos[1]>>minshift, leaf->pos[2]>>minshift, num2);
-		avg[0] = (float) leaf->pos[0] ;
-		avg[1] = (float) leaf->pos[1] ;
-		avg[2] = (float) leaf->pos[2] ;
+		avg[0] =(float) leaf->pos[0];
+		avg[1] =(float) leaf->pos[1];
+		avg[2] =(float) leaf->pos[2];
 	}
 	else
 	{
 		
-		avg[0] /= num ;
-		avg[1] /= num ;
-		avg[2] /= num ;
+		avg[0] /= num;
+		avg[1] /= num;
+		avg[2] /= num;
 		
-		//avg[0] = (float) leaf->pos[0];
-		//avg[1] = (float) leaf->pos[1];
-		//avg[2] = (float) leaf->pos[2];
+		//avg[0] =(float) leaf->pos[0];
+		//avg[1] =(float) leaf->pos[1];
+		//avg[2] =(float) leaf->pos[2];
 	}
 	
-	int xdir = ( dir + 1 ) % 3 ;
-	int ydir = ( dir + 2 ) % 3 ;
+	int xdir =(dir + 1) % 3;
+	int ydir =(dir + 2) % 3;
 
-	float xf = avg[ xdir ] ;
-	float yf = avg[ ydir ] ;
+	float xf = avg[xdir];
+	float yf = avg[ydir];
 
 #ifdef IN_DEBUG_MODE
 	// Is it outside?
-	// PathElement* leaf = leaf1->len < leaf2->len ? leaf1 : leaf2 ;
+	// PathElement* leaf = leaf1->len < leaf2->len ? leaf1 : leaf2;
 	/*
-	float* m = ( leaf == leaf1 ? m1 : m2 ) ;
-	if ( xf < leaf->pos[ xdir ] || 
-		 yf < leaf->pos[ ydir ] ||
-		 xf > leaf->pos[ xdir ] + leaf->len ||
-		 yf > leaf->pos[ ydir ] + leaf->len)
+	float* m =(leaf == leaf1 ? m1 : m2);
+	if(xf < leaf->pos[xdir] || 
+		 yf < leaf->pos[ydir] ||
+		 xf > leaf->pos[xdir] + leaf->len ||
+		 yf > leaf->pos[ydir] + leaf->len)
 	{
-		dc_printf("Outside cube (%d %d %d), %d : %d %d %f %f\n", leaf->pos[ 0 ], leaf->pos[1], leaf->pos[2], leaf->len, 
-						pos, dir, xf, yf) ;
+		dc_printf("Outside cube(%d %d %d), %d : %d %d %f %f\n", leaf->pos[0], leaf->pos[1], leaf->pos[2], leaf->len, 
+						pos, dir, xf, yf);
 
 		// For now, snap to cell
-		xf = m[ xdir ] ;
-		yf = m[ ydir ] ;
+		xf = m[xdir];
+		yf = m[ydir];
 	}
 	*/
 
 	/*
-	if ( alpha < 0 || alpha > 1 ||
+	if(alpha < 0 || alpha > 1 ||
 		 xf < leaf->pos[xdir] || xf > leaf->pos[xdir] + leaf->len || 
-		 yf < leaf->pos[ydir] || yf > leaf->pos[ydir] + leaf->len )
+		 yf < leaf->pos[ydir] || yf > leaf->pos[ydir] + leaf->len)
 	{
-		dc_printf("Alpha: %f Address: %d and %d\n", alpha, leaf1->node, leaf2->node ) ;
-		dc_printf("GETFACEPOINT result: (%d %d %d) %d min: (%f %f %f) ;(%d %d %d) %d min: (%f %f %f).\n",
+		dc_printf("Alpha: %f Address: %d and %d\n", alpha, leaf1->node, leaf2->node);
+		dc_printf("GETFACEPOINT result:(%d %d %d) %d min:(%f %f %f);(%d %d %d) %d min:(%f %f %f).\n",
 			leaf1->pos[0], leaf1->pos[1], leaf1->pos[2], leaf1->len, m1[0], m1[1], m1[2], 
 			leaf2->pos[0], leaf2->pos[1], leaf2->pos[2], leaf2->len, m2[0], m2[1], m2[2]);
-		dc_printf("Face point at dir %d pos %d: %f %f\n", dir, pos, xf, yf ) ;
+		dc_printf("Face point at dir %d pos %d: %f %f\n", dir, pos, xf, yf);
 	}
 	*/
 #endif
 	
 
 	// Get the integer and float part
-	x = ( ( leaf->pos[ xdir ] ) >> minshift ) ;
-	y = ( ( leaf->pos[ ydir ] ) >> minshift ) ;
+	x =((leaf->pos[xdir]) >> minshift);
+	y =((leaf->pos[ydir]) >> minshift);
 
-	p = ( xf - leaf->pos[ xdir ] ) / mindimen ;
-	q = ( yf - leaf->pos[ ydir ] ) / mindimen ;
+	p =(xf - leaf->pos[xdir]) / mindimen;
+	q =(yf - leaf->pos[ydir]) / mindimen;
 
 
 #ifdef IN_DEBUG_MODE
-	dc_printf("Face point at dir %d : %f %f\n", dir, xf, yf ) ;
+	dc_printf("Face point at dir %d : %f %f\n", dir, xf, yf);
 #endif
 }
 
-int Octree::findPair( PathElement* head, int pos, int dir, PathElement*& pre1, PathElement*& pre2 )
+int Octree::findPair(PathElement* head, int pos, int dir, PathElement*& pre1, PathElement*& pre2)
 {
-	int side = getSide ( head, pos, dir ) ;
-	PathElement* cur = head ;
-	PathElement* anchor ;
-	PathElement* ppre1, *ppre2 ;
+	int side = getSide(head, pos, dir);
+	PathElement* cur = head;
+	PathElement* anchor;
+	PathElement* ppre1, *ppre2;
 	
 	// Start from this face, find a pair
-	anchor = cur ;
-	ppre1 = cur ;
-	cur = cur->next ;
-	while ( cur != anchor && ( getSide( cur, pos, dir ) == side ) )
+	anchor = cur;
+	ppre1 = cur;
+	cur = cur->next;
+	while(cur != anchor &&(getSide(cur, pos, dir) == side))
 	{
-		ppre1 = cur ;
-		cur = cur->next ;
+		ppre1 = cur;
+		cur = cur->next;
 	}
-	if ( cur == anchor )
+	if(cur == anchor)
 	{
 		// No pair found
-		return side ;
+		return side;
 	}
 	
-	side = getSide( cur, pos, dir ) ;
-	ppre2 = cur ;
-	cur = cur->next ;
-	while ( getSide( cur, pos, dir ) == side )
+	side = getSide(cur, pos, dir);
+	ppre2 = cur;
+	cur = cur->next;
+	while(getSide(cur, pos, dir) == side)
 	{
-		ppre2 = cur ;
-		cur = cur->next ;
+		ppre2 = cur;
+		cur = cur->next;
 	}
 	
 	
 	// Switch pre1 and pre2 if we start from the higher side
-	if ( side == -1 )
+	if(side == -1)
 	{
-		cur = ppre1 ;
-		ppre1 = ppre2 ;
-		ppre2 = cur ;
+		cur = ppre1;
+		ppre1 = ppre2;
+		ppre2 = cur;
 	}
 
-	pre1 = ppre1 ;
-	pre2 = ppre2 ;
+	pre1 = ppre1;
+	pre2 = ppre2;
 	
-	return 0 ;
+	return 0;
 }
 
-int Octree::getSide( PathElement* e, int pos, int dir )
+int Octree::getSide(PathElement* e, int pos, int dir)
 {
-	return ( e->pos[ dir ] < pos ? -1 : 1 ) ;
+	return (e->pos[dir] < pos ? -1 : 1);
 }
 
-int Octree::isEqual( PathElement* e1, PathElement* e2 )
+int Octree::isEqual(PathElement* e1, PathElement* e2)
 {
-	return ( e1->pos[0] == e2->pos[0] && e1->pos[1] == e2->pos[1] && e1->pos[2] == e2->pos[2] ) ;
+	return (e1->pos[0] == e2->pos[0] && e1->pos[1] == e2->pos[1] && e1->pos[2] == e2->pos[2]);
 }
 
-void Octree::compressRing( PathElement*& ring )
+void Octree::compressRing(PathElement*& ring)
 {
-	if ( ring == NULL )
+	if(ring == NULL)
 	{
-		return ;
+		return;
 	}
 #ifdef IN_DEBUG_MODE
-	dc_printf("Call to COMPRESSRING with path: \n" );
-	printPath( ring ) ;
+	dc_printf("Call to COMPRESSRING with path: \n");
+	printPath(ring);
 #endif
 
-	PathElement* cur = ring->next->next ;
-	PathElement* pre = ring->next ;
-	PathElement* prepre = ring ;
-	PathElement* anchor = prepre ;
+	PathElement* cur = ring->next->next;
+	PathElement* pre = ring->next;
+	PathElement* prepre = ring;
+	PathElement* anchor = prepre;
 	
 	do
 	{
-		while ( isEqual( cur, prepre ) )
+		while(isEqual(cur, prepre))
 		{
 			// Delete
-			if ( cur == prepre )
+			if(cur == prepre)
 			{
 				// The ring has shrinked to a point
-				delete pre ;
-				delete cur ;
-				anchor = NULL ;
-				break ;
+				delete pre;
+				delete cur;
+				anchor = NULL;
+				break;
 			}
 			else
 			{
-				prepre->next = cur->next ;
-				delete pre ;
-				delete cur ;
-				pre = prepre->next ;
-				cur = pre->next ;
-				anchor = prepre ;
+				prepre->next = cur->next;
+				delete pre;
+				delete cur;
+				pre = prepre->next;
+				cur = pre->next;
+				anchor = prepre;
 			}
 		}
 		
-		if ( anchor == NULL )
+		if(anchor == NULL)
 		{
-			break ;
+			break;
 		}
 		
-		prepre = pre ;
-		pre = cur ;
-		cur = cur->next ;
-	} while ( prepre != anchor ) ;
+		prepre = pre;
+		pre = cur;
+		cur = cur->next;
+	} while(prepre != anchor);
 	
-	ring = anchor ;
+	ring = anchor;
 
 #ifdef IN_DEBUG_MODE
-	dc_printf("Return from COMPRESSRING with path: \n" );
-	printPath( ring ) ;
+	dc_printf("Return from COMPRESSRING with path: \n");
+	printPath(ring);
 #endif
 }
 
-void Octree::buildSigns( )
+void Octree::buildSigns()
 {
 	// First build a lookup table
-	// dc_printf("Building up look up table...\n") ;
-	int size = 1 << 12 ;
-	unsigned char table[ 1 << 12 ] ;
-	for ( int i = 0 ; i < size ; i ++ )
+	// dc_printf("Building up look up table...\n");
+	int size = 1 << 12;
+	unsigned char table[1 << 12];
+	for(int i = 0; i < size; i ++)
 	{
-		table[i] = 0 ;
+		table[i] = 0;
 	}
-	for ( int i = 0 ; i < 256 ; i ++ )
+	for(int i = 0; i < 256; i ++)
 	{
-		int ind = 0 ;
-		for ( int j = 11 ; j >= 0 ; j -- )
+		int ind = 0;
+		for(int j = 11; j >= 0; j --)
 		{
-			ind <<= 1 ;
-			if ( ( ( i >> edgemap[j][0] ) & 1 ) ^ ( ( i >> edgemap[j][1] ) & 1 ) )
+			ind <<= 1;
+			if(((i >> edgemap[j][0]) & 1) ^((i >> edgemap[j][1]) & 1))
 			{
-				ind |= 1 ;
+				ind |= 1;
 			}
 		}
 
-		table[ ind ] = i ;
+		table[ind] = i;
 	}
 
 	// Next, traverse the grid
-	int sg = 1 ;
-	int cube[8] ;
-	buildSigns( table, this->root, 0, sg, cube ) ;
+	int sg = 1;
+	int cube[8];
+	buildSigns(table, root, 0, sg, cube);
 }
 
-void Octree::buildSigns( unsigned char table[], UCHAR* node, int isLeaf, int sg, int rvalue[8] )
+void Octree::buildSigns(unsigned char table[], Node* node, int isLeaf, int sg, int rvalue[8])
 {
-	if ( node == NULL )
+	if(node == NULL)
 	{
-		for ( int i = 0 ; i < 8 ; i ++ )
+		for(int i = 0; i < 8; i ++)
 		{
-			rvalue[i] = sg ;
+			rvalue[i] = sg;
 		}
-		return ;
+		return;
 	}
 
-	if ( isLeaf == 0 )
+	if(isLeaf == 0)
 	{
 		// Internal node
-		UCHAR* chd[8] ;
-		int leaf[8] ;
-		fillChildren( node, chd, leaf ) ;
+		Node* chd[8];
+		int leaf[8];
+		fillChildren(&node->internal, chd, leaf);
 
 		// Get the signs at the corners of the first cube
-		rvalue[0] = sg ;
-		int oris[8] ;
-		buildSigns( table, chd[0], leaf[0], sg, oris ) ;
+		rvalue[0] = sg;
+		int oris[8];
+		buildSigns(table, chd[0], leaf[0], sg, oris);
 
 		// Get the rest
-		int cube[8] ;
-		for ( int i = 1 ; i < 8 ; i ++ )
+		int cube[8];
+		for(int i = 1; i < 8; i ++)
 		{
-			buildSigns( table, chd[i], leaf[i], oris[i], cube ) ;
-			rvalue[i] = cube[i] ;
+			buildSigns(table, chd[i], leaf[i], oris[i], cube);
+			rvalue[i] = cube[i];
 		}
 
 	}
 	else
 	{
 		// Leaf node
-		generateSigns( node, table, sg ) ;
+		generateSigns(&node->leaf, table, sg);
 
-		for ( int i = 0 ; i < 8 ; i ++ )
+		for(int i = 0; i < 8; i ++)
 		{
-			rvalue[i] = getSign( node, i ) ;
+			rvalue[i] = getSign(&node->leaf, i);
 		}
 	}
 }
 
-void Octree::floodFill( )
+void Octree::floodFill()
 {
-	// int threshold = (int) ((dimen/mindimen) * (dimen/mindimen) * 0.5f) ;
-	int st[3] = { 0, 0, 0 } ;
+	// int threshold =(int)((dimen/mindimen) *(dimen/mindimen) * 0.5f);
+	int st[3] = {0, 0, 0};
 
 	// First, check for largest component
 	// size stored in -threshold
-	this->clearProcessBits( root, maxDepth ) ;
-	int threshold = this->floodFill( root, st, dimen, maxDepth, 0 ) ;
+	clearProcessBits(root, maxDepth);
+	int threshold = floodFill(root, st, dimen, maxDepth, 0);
 
 	// Next remove
 	dc_printf("Largest component: %d\n", threshold);
-	threshold *= thresh ;
-	dc_printf("Removing all components smaller than %d\n", threshold) ;
+	threshold *= thresh;
+	dc_printf("Removing all components smaller than %d\n", threshold);
 
-	int st2[3] = { 0, 0, 0 } ;
-	this->clearProcessBits( root, maxDepth ) ;
-	this->floodFill( root, st2, dimen, maxDepth, threshold ) ;
+	int st2[3] = {0, 0, 0};
+	clearProcessBits(root, maxDepth);
+	floodFill(root, st2, dimen, maxDepth, threshold);
 
 }
 
-void Octree::clearProcessBits( UCHAR* node, int height )
+void Octree::clearProcessBits(Node* node, int height)
 {
 	int i;
 
-	if ( height == 0 )
+	if(height == 0)
 	{
 		// Leaf cell, 
-		for ( i = 0 ; i < 12 ; i ++ )
+		for(i = 0; i < 12; i ++)
 		{
-			setOutProcess( node, i ) ;
+			setOutProcess(&node->leaf, i);
 		}
 	}
 	else
 	{
 		// Internal cell, recur
-		int count = 0 ;
-		for ( i = 0 ; i < 8 ; i ++ )
+		int count = 0;
+		for(i = 0; i < 8; i ++)
 		{
-			if ( hasChild( node, i ) )
+			if(hasChild(&node->internal, i))
 			{
-				clearProcessBits( getChild( node, count ), height - 1 ) ;
-				count ++ ;
+				clearProcessBits(getChild(&node->internal, count), height - 1);
+				count ++;
 			}
 		}
 	}	
 }
 
-/*
-void Octree::floodFill( UCHAR* node, int st[3], int len, int height, int threshold )
+int Octree::floodFill(LeafNode* leaf, int st[3], int len, int height, int threshold)
 {
 	int i, j;
+	int maxtotal = 0;
+
+	// Leaf cell, 
+	int par, inp;
+
+	// Test if the leaf has intersection edges
+	for(i = 0; i < 12; i ++) {
+		par = getEdgeParity(leaf, i);
+		inp = isInProcess(leaf, i);
+
+		if(par == 1 && inp == 0) {
+			// Intersection edge, hasn't been processed
+			// Let's start filling
+			GridQueue* queue = new GridQueue();
+			int total = 1;
+
+			// Set to in process
+			int mst[3];
+			mst[0] = st[0] + vertmap[edgemap[i][0]][0] * len;
+			mst[1] = st[1] + vertmap[edgemap[i][0]][1] * len;
+			mst[2] = st[2] + vertmap[edgemap[i][0]][2] * len;
+			int mdir = i / 4;
+			setInProcessAll(mst, mdir);
+
+			// Put this edge into queue
+			queue->pushQueue(mst, mdir);
+
+			// Queue processing
+			int nst[3], dir;
+			while(queue->popQueue(nst, dir) == 1) {
+				// dc_printf("nst: %d %d %d, dir: %d\n", nst[0]/mindimen, nst[1]/mindimen, nst[2]/mindimen, dir);
+				// locations
+				int stMask[3][3] = {
+					{0, 0 - len, 0 - len},
+					{0 - len, 0, 0 - len},
+					{0 - len, 0 - len, 0}
+				};
+				int cst[2][3];
+				for(j = 0; j < 3; j ++) {
+					cst[0][j] = nst[j];
+					cst[1][j] = nst[j] + stMask[dir][j];
+				}
 
-	if ( height == 0 )
-	{
-		// Leaf cell, 
-		int par, inp ;
-
-		// Test if the leaf has intersection edges
-		for ( i = 0 ; i < 12 ; i ++ )
-		{
-			par = getEdgeParity( node, i ) ;
-			inp = isInProcess( node, i ) ;
-
-			if ( par == 1 && inp == 0 )
-			{
-				// Intersection edge, hasn't been processed
-				// Let's start filling
-				GridQueue* queue = new GridQueue() ;
-				int total = 1 ;
-
-				// Set to in process
-				int mst[3] ;
-				mst[0] = st[0] + vertmap[edgemap[i][0]][0] * len ;
-				mst[1] = st[1] + vertmap[edgemap[i][0]][1] * len ;
-				mst[2] = st[2] + vertmap[edgemap[i][0]][2] * len;
-				int mdir = i / 4 ;
-				setInProcessAll( mst, mdir ) ;
-
-				// Put this edge into queue
-				queue->pushQueue( mst, mdir ) ;
-
-				// Queue processing
-				int nst[3], dir ;
-				while ( queue->popQueue( nst, dir ) == 1 )
-				{
-					// dc_printf("nst: %d %d %d, dir: %d\n", nst[0]/mindimen, nst[1]/mindimen, nst[2]/mindimen, dir) ;
-					// locations
-					int stMask[3][3] = {
-						{ 0, 0 - len, 0 - len },
-						{ 0 - len, 0, 0 - len },
-						{ 0 - len, 0 - len, 0 }
-					};
-					int cst[2][3] ;
-					for ( j = 0 ; j < 3 ; j ++ )
-					{
-						cst[0][j] = nst[j] ;
-						cst[1][j] = nst[j] + stMask[ dir ][ j ] ;
-					}
-
-					// cells 
-					UCHAR* cs[2] ;
-					for ( j = 0 ; j < 2 ; j ++ )
-					{
-						cs[ j ] = locateLeaf( cst[j] ) ;
-					}
-
-					// Middle sign
-					int s = getSign( cs[0], 0 ) ;
-
-					// Masks
-					int fcCells[4] = {1,0,1,0};
-					int fcEdges[3][4][3] = {
-						{{9,2,11},{8,1,10},{5,1,7},{4,2,6}},
-						{{10,6,11},{8,5,9},{1,5,3},{0,6,2}},
-						{{6,10,7},{4,9,5},{2,9,3},{0,10,1}}
-					};
+				// cells 
+				LeafNode* cs[2];
+				for(j = 0; j < 2; j ++) {
+					cs[j] = locateLeaf(cst[j]);
+				}
 
-					// Search for neighboring connected intersection edges
-					for ( int find = 0 ; find < 4 ; find ++ )
-					{
-						int cind = fcCells[find] ;
-						int eind, edge ;
-						if ( s == 0 )
-						{
-							// Original order
-							for ( eind = 0 ; eind < 3 ; eind ++ )
-							{
-								edge = fcEdges[dir][find][eind] ;
-								if ( getEdgeParity( cs[cind], edge ) == 1 )
-								{
-									break ;
-								}
+				// Middle sign
+				int s = getSign(cs[0], 0);
+
+				// Masks
+				int fcCells[4] = {1,0,1,0};
+				int fcEdges[3][4][3] = {
+					{{9,2,11},{8,1,10},{5,1,7},{4,2,6}},
+					{{10,6,11},{8,5,9},{1,5,3},{0,6,2}},
+					{{6,10,7},{4,9,5},{2,9,3},{0,10,1}}
+				};
+
+				// Search for neighboring connected intersection edges
+				for(int find = 0; find < 4; find ++) {
+					int cind = fcCells[find];
+					int eind, edge;
+					if(s == 0) {
+						// Original order
+						for(eind = 0; eind < 3; eind ++) {
+							edge = fcEdges[dir][find][eind];
+							if(getEdgeParity(cs[cind], edge) == 1) {
+								break;
 							}
 						}
-						else
-						{
-							// Inverse order
-							for ( eind = 2 ; eind >= 0 ; eind -- )
-							{
-								edge = fcEdges[dir][find][eind] ;
-								if ( getEdgeParity( cs[cind], edge ) == 1 )
-								{
-									break ;
-								}
+					}
+					else {
+						// Inverse order
+						for(eind = 2; eind >= 0; eind --) {
+							edge = fcEdges[dir][find][eind];
+							if(getEdgeParity(cs[cind], edge) == 1) {
+								break;
 							}
 						}
+					}
 						
-						if ( eind == 3 || eind == -1 )
-						{
-							dc_printf("Wrong! this is not a consistent sign. %d\n", eind );
-						}
-						else 
-						{
-							int est[3] ;
-							est[0] = cst[cind][0] + vertmap[edgemap[edge][0]][0] * len ;
-							est[1] = cst[cind][1] + vertmap[edgemap[edge][0]][1] * len ;
-							est[2] = cst[cind][2] + vertmap[edgemap[edge][0]][2] * len ;
-							int edir = edge / 4 ;
+					if(eind == 3 || eind == -1) {
+						dc_printf("Wrong! this is not a consistent sign. %d\n", eind);
+					}
+					else {
+						int est[3];
+						est[0] = cst[cind][0] + vertmap[edgemap[edge][0]][0] * len;
+						est[1] = cst[cind][1] + vertmap[edgemap[edge][0]][1] * len;
+						est[2] = cst[cind][2] + vertmap[edgemap[edge][0]][2] * len;
+						int edir = edge / 4;
 							
-							if ( isInProcess( cs[cind], edge ) == 0 )
-							{
-								setInProcessAll( est, edir ) ;
-								queue->pushQueue( est, edir ) ;
-								// dc_printf("Pushed: est: %d %d %d, edir: %d\n", est[0]/len, est[1]/len, est[2]/len, edir) ;
-								total ++ ;
-							}
-							else
-							{
-								// dc_printf("Processed, not pushed: est: %d %d %d, edir: %d\n", est[0]/len, est[1]/len, est[2]/len, edir) ;
-							}
+						if(isInProcess(cs[cind], edge) == 0) {
+							setInProcessAll(est, edir);
+							queue->pushQueue(est, edir);
+							// dc_printf("Pushed: est: %d %d %d, edir: %d\n", est[0]/len, est[1]/len, est[2]/len, edir);
+							total ++;
 						}
-						
 					}
-
 				}
+			}
 
-				dc_printf("Size of component: %d ", total) ;
+			dc_printf("Size of component: %d ", total);
 
-				if ( total > threshold )
-				{
-					dc_printf("Maintained.\n") ;
-					continue ;
+			if(threshold == 0) {
+				// Measuring stage
+				if(total > maxtotal) {
+					maxtotal = total;
+				}
+				dc_printf(".\n");
+				continue;
+			}
+				
+			if(total >= threshold) {
+				dc_printf("Maintained.\n");
+				continue;
+			}
+			dc_printf("Less then %d, removing...\n", threshold);
+
+			// We have to remove this noise
+
+			// Flip parity
+			// setOutProcessAll(mst, mdir);
+			flipParityAll(mst, mdir);
+
+			// Put this edge into queue
+			queue->pushQueue(mst, mdir);
+
+			// Queue processing
+			while(queue->popQueue(nst, dir) == 1) {
+				// dc_printf("nst: %d %d %d, dir: %d\n", nst[0]/mindimen, nst[1]/mindimen, nst[2]/mindimen, dir);
+				// locations
+				int stMask[3][3] = {
+					{0, 0 - len, 0 - len},
+					{0 - len, 0, 0 - len},
+					{0 - len, 0 - len, 0}
+				};
+				int cst[2][3];
+				for(j = 0; j < 3; j ++) {
+					cst[0][j] = nst[j];
+					cst[1][j] = nst[j] + stMask[dir][j];
 				}
-				dc_printf("Less then %d, removing...\n", threshold) ;
-
-				// We have to remove this noise
-
-				// Flip parity
-				// setOutProcessAll( mst, mdir ) ;
-				flipParityAll( mst, mdir ) ;
-
-				// Put this edge into queue
-				queue->pushQueue( mst, mdir ) ;
-
-				// Queue processing
-				while ( queue->popQueue( nst, dir ) == 1 )
-				{
-					// dc_printf("nst: %d %d %d, dir: %d\n", nst[0]/mindimen, nst[1]/mindimen, nst[2]/mindimen, dir) ;
-					// locations
-					int stMask[3][3] = {
-						{ 0, 0 - len, 0 - len },
-						{ 0 - len, 0, 0 - len },
-						{ 0 - len, 0 - len, 0 }
-					};
-					int cst[2][3] ;
-					for ( j = 0 ; j < 3 ; j ++ )
-					{
-						cst[0][j] = nst[j] ;
-						cst[1][j] = nst[j] + stMask[ dir ][ j ] ;
-					}
-
-					// cells 
-					UCHAR* cs[2] ;
-					for ( j = 0 ; j < 2 ; j ++ )
-					{
-						cs[ j ] = locateLeaf( cst[j] ) ;
-					}
-
-					// Middle sign
-					int s = getSign( cs[0], 0 ) ;
-
-					// Masks
-					int fcCells[4] = {1,0,1,0};
-					int fcEdges[3][4][3] = {
-						{{9,2,11},{8,1,10},{5,1,7},{4,2,6}},
-						{{10,6,11},{8,5,9},{1,5,3},{0,6,2}},
-						{{6,10,7},{4,9,5},{2,9,3},{0,10,1}}
-					};
 
-					// Search for neighboring connected intersection edges
-					for ( int find = 0 ; find < 4 ; find ++ )
-					{
-						int cind = fcCells[find] ;
-						int eind, edge ;
-						if ( s == 0 )
-						{
-							// Original order
-							for ( eind = 0 ; eind < 3 ; eind ++ )
-							{
-								edge = fcEdges[dir][find][eind] ;
-								if ( isInProcess( cs[cind], edge ) == 1 )
-								{
-									break ;
-								}
+				// cells 
+				LeafNode* cs[2];
+				for(j = 0; j < 2; j ++)
+					cs[j] = locateLeaf(cst[j]);
+
+				// Middle sign
+				int s = getSign(cs[0], 0);
+
+				// Masks
+				int fcCells[4] = {1,0,1,0};
+				int fcEdges[3][4][3] = {
+					{{9,2,11},{8,1,10},{5,1,7},{4,2,6}},
+					{{10,6,11},{8,5,9},{1,5,3},{0,6,2}},
+					{{6,10,7},{4,9,5},{2,9,3},{0,10,1}}
+				};
+
+				// Search for neighboring connected intersection edges
+				for(int find = 0; find < 4; find ++) {
+					int cind = fcCells[find];
+					int eind, edge;
+					if(s == 0) {
+						// Original order
+						for(eind = 0; eind < 3; eind ++) {
+							edge = fcEdges[dir][find][eind];
+							if(isInProcess(cs[cind], edge) == 1) {
+								break;
 							}
 						}
-						else
-						{
-							// Inverse order
-							for ( eind = 2 ; eind >= 0 ; eind -- )
-							{
-								edge = fcEdges[dir][find][eind] ;
-								if ( isInProcess( cs[cind], edge ) == 1 )
-								{
-									break ;
-								}
+					}
+					else {
+						// Inverse order
+						for(eind = 2; eind >= 0; eind --) {
+							edge = fcEdges[dir][find][eind];
+							if(isInProcess(cs[cind], edge) == 1) {
+								break;
 							}
 						}
+					}
 						
-						if ( eind == 3 || eind == -1 )
-						{
-							dc_printf("Wrong! this is not a consistent sign. %d\n", eind );
+					if(eind == 3 || eind == -1) {
+						dc_printf("Wrong! this is not a consistent sign. %d\n", eind);
+					}
+					else {
+						int est[3];
+						est[0] = cst[cind][0] + vertmap[edgemap[edge][0]][0] * len;
+						est[1] = cst[cind][1] + vertmap[edgemap[edge][0]][1] * len;
+						est[2] = cst[cind][2] + vertmap[edgemap[edge][0]][2] * len;
+						int edir = edge / 4;
+							
+						if(getEdgeParity(cs[cind], edge) == 1) {
+							flipParityAll(est, edir);
+							queue->pushQueue(est, edir);
+							// dc_printf("Pushed: est: %d %d %d, edir: %d\n", est[0]/len, est[1]/len, est[2]/len, edir);
+							total ++;
 						}
-						else 
-						{
-							int est[3] ;
-							est[0] = cst[cind][0] + vertmap[edgemap[edge][0]][0] * len ;
-							est[1] = cst[cind][1] + vertmap[edgemap[edge][0]][1] * len ;
-							est[2] = cst[cind][2] + vertmap[edgemap[edge][0]][2] * len ;
-							int edir = edge / 4 ;
-							
-							if ( getEdgeParity( cs[cind], edge ) == 1 )
-							{
-								flipParityAll( est, edir ) ;
-								queue->pushQueue( est, edir ) ;
-								// dc_printf("Pushed: est: %d %d %d, edir: %d\n", est[0]/len, est[1]/len, est[2]/len, edir) ;
-								total ++ ;
-							}
-							else
-							{
-								// dc_printf("Processed, not pushed: est: %d %d %d, edir: %d\n", est[0]/len, est[1]/len, est[2]/len, edir) ;
-							}
-						}
-						
 					}
-
 				}
-
-			}
-		}
-	}
-	else
-	{
-		// Internal cell, recur
-		int count = 0 ;
-		len >>= 1 ;
-		for ( i = 0 ; i < 8 ; i ++ )
-		{
-			if ( hasChild( node, i ) )
-			{
-				int nst[3] ;
-				nst[0] = st[0] + vertmap[i][0] * len ;
-				nst[1] = st[1] + vertmap[i][1] * len ;
-				nst[2] = st[2] + vertmap[i][2] * len ;
-				
-				floodFill( getChild( node, count ), nst, len, height - 1, threshold ) ;
-				count ++ ;
 			}
 		}
 	}
+
+	return maxtotal;
 }
-*/
 
-int Octree::floodFill( UCHAR* node, int st[3], int len, int height, int threshold )
+int Octree::floodFill(Node* node, int st[3], int len, int height, int threshold)
 {
-	int i, j;
-	int maxtotal = 0 ;
+	int i;
+	int maxtotal = 0;
 
-	if ( height == 0 )
+	if(height == 0)
 	{
-		// Leaf cell, 
-		int par, inp ;
-
-		// Test if the leaf has intersection edges
-		for ( i = 0 ; i < 12 ; i ++ )
-		{
-			par = getEdgeParity( node, i ) ;
-			inp = isInProcess( node, i ) ;
-
-			if ( par == 1 && inp == 0 )
-			{
-				// Intersection edge, hasn't been processed
-				// Let's start filling
-				GridQueue* queue = new GridQueue() ;
-				int total = 1 ;
-
-				// Set to in process
-				int mst[3] ;
-				mst[0] = st[0] + vertmap[edgemap[i][0]][0] * len ;
-				mst[1] = st[1] + vertmap[edgemap[i][0]][1] * len ;
-				mst[2] = st[2] + vertmap[edgemap[i][0]][2] * len;
-				int mdir = i / 4 ;
-				setInProcessAll( mst, mdir ) ;
-
-				// Put this edge into queue
-				queue->pushQueue( mst, mdir ) ;
-
-				// Queue processing
-				int nst[3], dir ;
-				while ( queue->popQueue( nst, dir ) == 1 )
-				{
-					// dc_printf("nst: %d %d %d, dir: %d\n", nst[0]/mindimen, nst[1]/mindimen, nst[2]/mindimen, dir) ;
-					// locations
-					int stMask[3][3] = {
-						{ 0, 0 - len, 0 - len },
-						{ 0 - len, 0, 0 - len },
-						{ 0 - len, 0 - len, 0 }
-					};
-					int cst[2][3] ;
-					for ( j = 0 ; j < 3 ; j ++ )
-					{
-						cst[0][j] = nst[j] ;
-						cst[1][j] = nst[j] + stMask[ dir ][ j ] ;
-					}
-
-					// cells 
-					UCHAR* cs[2] ;
-					for ( j = 0 ; j < 2 ; j ++ )
-					{
-						cs[ j ] = locateLeaf( cst[j] ) ;
-					}
-
-					// Middle sign
-					int s = getSign( cs[0], 0 ) ;
-
-					// Masks
-					int fcCells[4] = {1,0,1,0};
-					int fcEdges[3][4][3] = {
-						{{9,2,11},{8,1,10},{5,1,7},{4,2,6}},
-						{{10,6,11},{8,5,9},{1,5,3},{0,6,2}},
-						{{6,10,7},{4,9,5},{2,9,3},{0,10,1}}
-					};
-
-					// Search for neighboring connected intersection edges
-					for ( int find = 0 ; find < 4 ; find ++ )
-					{
-						int cind = fcCells[find] ;
-						int eind, edge ;
-						if ( s == 0 )
-						{
-							// Original order
-							for ( eind = 0 ; eind < 3 ; eind ++ )
-							{
-								edge = fcEdges[dir][find][eind] ;
-								if ( getEdgeParity( cs[cind], edge ) == 1 )
-								{
-									break ;
-								}
-							}
-						}
-						else
-						{
-							// Inverse order
-							for ( eind = 2 ; eind >= 0 ; eind -- )
-							{
-								edge = fcEdges[dir][find][eind] ;
-								if ( getEdgeParity( cs[cind], edge ) == 1 )
-								{
-									break ;
-								}
-							}
-						}
-						
-						if ( eind == 3 || eind == -1 )
-						{
-							dc_printf("Wrong! this is not a consistent sign. %d\n", eind );
-						}
-						else 
-						{
-							int est[3] ;
-							est[0] = cst[cind][0] + vertmap[edgemap[edge][0]][0] * len ;
-							est[1] = cst[cind][1] + vertmap[edgemap[edge][0]][1] * len ;
-							est[2] = cst[cind][2] + vertmap[edgemap[edge][0]][2] * len ;
-							int edir = edge / 4 ;
-							
-							if ( isInProcess( cs[cind], edge ) == 0 )
-							{
-								setInProcessAll( est, edir ) ;
-								queue->pushQueue( est, edir ) ;
-								// dc_printf("Pushed: est: %d %d %d, edir: %d\n", est[0]/len, est[1]/len, est[2]/len, edir) ;
-								total ++ ;
-							}
-							else
-							{
-								// dc_printf("Processed, not pushed: est: %d %d %d, edir: %d\n", est[0]/len, est[1]/len, est[2]/len, edir) ;
-							}
-						}
-						
-					}
-
-				}
-
-				dc_printf("Size of component: %d ", total) ;
-
-				if ( threshold == 0 )
-				{
-					// Measuring stage
-					if ( total > maxtotal )
-					{
-						maxtotal = total ;
-					}
-					dc_printf(".\n") ;
-					continue ;
-				}
-				
-				if ( total >= threshold )
-				{
-					dc_printf("Maintained.\n") ;
-					continue ;
-				}
-				dc_printf("Less then %d, removing...\n", threshold) ;
-
-				// We have to remove this noise
-
-				// Flip parity
-				// setOutProcessAll( mst, mdir ) ;
-				flipParityAll( mst, mdir ) ;
-
-				// Put this edge into queue
-				queue->pushQueue( mst, mdir ) ;
-
-				// Queue processing
-				while ( queue->popQueue( nst, dir ) == 1 )
-				{
-					// dc_printf("nst: %d %d %d, dir: %d\n", nst[0]/mindimen, nst[1]/mindimen, nst[2]/mindimen, dir) ;
-					// locations
-					int stMask[3][3] = {
-						{ 0, 0 - len, 0 - len },
-						{ 0 - len, 0, 0 - len },
-						{ 0 - len, 0 - len, 0 }
-					};
-					int cst[2][3] ;
-					for ( j = 0 ; j < 3 ; j ++ )
-					{
-						cst[0][j] = nst[j] ;
-						cst[1][j] = nst[j] + stMask[ dir ][ j ] ;
-					}
-
-					// cells 
-					UCHAR* cs[2] ;
-					for ( j = 0 ; j < 2 ; j ++ )
-					{
-						cs[ j ] = locateLeaf( cst[j] ) ;
-					}
-
-					// Middle sign
-					int s = getSign( cs[0], 0 ) ;
-
-					// Masks
-					int fcCells[4] = {1,0,1,0};
-					int fcEdges[3][4][3] = {
-						{{9,2,11},{8,1,10},{5,1,7},{4,2,6}},
-						{{10,6,11},{8,5,9},{1,5,3},{0,6,2}},
-						{{6,10,7},{4,9,5},{2,9,3},{0,10,1}}
-					};
-
-					// Search for neighboring connected intersection edges
-					for ( int find = 0 ; find < 4 ; find ++ )
-					{
-						int cind = fcCells[find] ;
-						int eind, edge ;
-						if ( s == 0 )
-						{
-							// Original order
-							for ( eind = 0 ; eind < 3 ; eind ++ )
-							{
-								edge = fcEdges[dir][find][eind] ;
-								if ( isInProcess( cs[cind], edge ) == 1 )
-								{
-									break ;
-								}
-							}
-						}
-						else
-						{
-							// Inverse order
-							for ( eind = 2 ; eind >= 0 ; eind -- )
-							{
-								edge = fcEdges[dir][find][eind] ;
-								if ( isInProcess( cs[cind], edge ) == 1 )
-								{
-									break ;
-								}
-							}
-						}
-						
-						if ( eind == 3 || eind == -1 )
-						{
-							dc_printf("Wrong! this is not a consistent sign. %d\n", eind );
-						}
-						else 
-						{
-							int est[3] ;
-							est[0] = cst[cind][0] + vertmap[edgemap[edge][0]][0] * len ;
-							est[1] = cst[cind][1] + vertmap[edgemap[edge][0]][1] * len ;
-							est[2] = cst[cind][2] + vertmap[edgemap[edge][0]][2] * len ;
-							int edir = edge / 4 ;
-							
-							if ( getEdgeParity( cs[cind], edge ) == 1 )
-							{
-								flipParityAll( est, edir ) ;
-								queue->pushQueue( est, edir ) ;
-								// dc_printf("Pushed: est: %d %d %d, edir: %d\n", est[0]/len, est[1]/len, est[2]/len, edir) ;
-								total ++ ;
-							}
-							else
-							{
-								// dc_printf("Processed, not pushed: est: %d %d %d, edir: %d\n", est[0]/len, est[1]/len, est[2]/len, edir) ;
-							}
-						}
-						
-					}
-
-				}
-
-			}
-		}
-
+		maxtotal = floodFill(&node->leaf, st, len, height, threshold);
 	}
 	else
 	{
 		// Internal cell, recur
-		int count = 0 ;
-		len >>= 1 ;
-		for ( i = 0 ; i < 8 ; i ++ )
+		int count = 0;
+		len >>= 1;
+		for(i = 0; i < 8; i ++)
 		{
-			if ( hasChild( node, i ) )
+			if(hasChild((InternalNode*)node, i))
 			{
-				int nst[3] ;
-				nst[0] = st[0] + vertmap[i][0] * len ;
-				nst[1] = st[1] + vertmap[i][1] * len ;
-				nst[2] = st[2] + vertmap[i][2] * len ;
+				int nst[3];
+				nst[0] = st[0] + vertmap[i][0] * len;
+				nst[1] = st[1] + vertmap[i][1] * len;
+				nst[2] = st[2] + vertmap[i][2] * len;
 				
-				int d = floodFill( getChild( node, count ), nst, len, height - 1, threshold ) ;
-				if ( d > maxtotal)
+				int d = floodFill(getChild((InternalNode*)node, count), nst, len, height - 1, threshold);
+				if(d > maxtotal)
 				{
-					maxtotal = d ;
+					maxtotal = d;
 				}
-				count ++ ;
+				count ++;
 			}
 		}
 	}
 
 
-	return maxtotal ;
+	return maxtotal;
 
 }
 
 void Octree::writeOut()
 {
-	int numQuads = 0 ;
-	int numVertices = 0 ;
-	int numEdges = 0 ;
-#ifdef USE_HERMIT
-	countIntersection( root, maxDepth, numQuads, numVertices, numEdges ) ;
-#else
-	countIntersection( root, maxDepth, numQuads, numVertices ) ;
-	numEdges = numQuads * 3 / 2 ;
-#endif
-	dc_printf("Vertices counted: %d Polys counted: %d \n", numVertices, numQuads ) ;
-	output_mesh = alloc_output(numVertices, numQuads);	
-	int offset = 0 ;
-	int st[3] = { 0, 0, 0 } ;
-
-	// First, output vertices
-	offset = 0 ;
-	actualVerts = 0 ;
-	actualQuads = 0 ;
-#ifdef USE_HERMIT
-	generateMinimizer( root, st, dimen, maxDepth, offset ) ;
-	cellProcContour( this->root, 0, maxDepth ) ;
-	dc_printf("Vertices written: %d Quads written: %d \n", offset, actualQuads ) ;
-#else
-	writeVertex( root, st, dimen, maxDepth, offset, out ) ;
-	writeQuad( root, st, dimen, maxDepth, out ) ;
-	dc_printf("Vertices written: %d Triangles written: %d \n", offset, actualQuads ) ;
-#endif
-}
+	int numQuads = 0;
+	int numVertices = 0;
+	int numEdges = 0;
 
-#if 0
-void Octree::writePLY( char* fname )
-{
-	int numQuads = 0 ;
-	int numVertices = 0 ;
-	int numEdges = 0 ;
-#ifdef USE_HERMIT
-	countIntersection( root, maxDepth, numQuads, numVertices, numEdges ) ;
-#else
-	countIntersection( root, maxDepth, numQuads, numVertices ) ;
-	numEdges = numQuads * 3 / 2 ;
-#endif
-	// int euler = numVertices + numQuads - numEdges ;
-	// int genus =  ( 2 - euler ) / 2 ;
-	// dc_printf("%d vertices %d quads %d edges\n", numVertices, numQuads, numEdges ) ;
-	// dc_printf("Genus: %d Euler: %d\n", genus, euler ) ;
+	countIntersection(root, maxDepth, numQuads, numVertices, numEdges);
 
-	FILE* fout = fopen ( fname, "wb" ) ;
-	dc_printf("Vertices counted: %d Polys counted: %d \n", numVertices, numQuads ) ;
-	PLYWriter::writeHeader( fout, numVertices, numQuads ) ;
-	int offset = 0 ;
-	int st[3] = { 0, 0, 0 } ;
+	dc_printf("Vertices counted: %d Polys counted: %d \n", numVertices, numQuads);
+	output_mesh = alloc_output(numVertices, numQuads);	
+	int offset = 0;
+	int st[3] = {0, 0, 0};
 
 	// First, output vertices
-	offset = 0 ;
-	actualVerts = 0 ;
-	actualQuads = 0 ;
-#ifdef USE_HERMIT
-	generateMinimizer( root, st, dimen, maxDepth, offset, fout ) ;
-#ifdef TESTMANIFOLD
-	testfout = fopen("test.txt", "w");
-	fprintf(testfout, "{");
-#endif
-	cellProcContour( this->root, 0, maxDepth, fout ) ;
-#ifdef TESTMANIFOLD
-	fprintf(testfout, "}");
-	fclose( testfout ) ;
-#endif
-	dc_printf("Vertices written: %d Quads written: %d \n", offset, actualQuads ) ;
-#else
-	writeVertex( root, st, dimen, maxDepth, offset, fout ) ;
-	writeQuad( root, st, dimen, maxDepth, fout ) ;
-	dc_printf("Vertices written: %d Triangles written: %d \n", offset, actualQuads ) ;
-#endif
+	offset = 0;
+	actualVerts = 0;
+	actualQuads = 0;
 
-
-	fclose( fout ) ;
+	generateMinimizer(root, st, dimen, maxDepth, offset);
+	cellProcContour(root, 0, maxDepth);
+	dc_printf("Vertices written: %d Quads written: %d \n", offset, actualQuads);
 }
-#endif
 
-void Octree::writeOctree( char* fname ) 
+void Octree::countIntersection(Node* node, int height, int& nedge, int& ncell, int& nface)
 {
-	FILE* fout = fopen ( fname, "wb" ) ;
-
-	int sized = ( 1 << maxDepth ) ;
-	fwrite( &sized, sizeof( int ), 1, fout ) ;
-	writeOctree( fout, root, maxDepth ) ;
-	dc_printf("Grid dimension: %d\n", sized ) ;
-
-
-	fclose( fout ) ;
-}
-void Octree::writeOctree( FILE* fout, UCHAR* node, int depth )
-{
-	char type ;
-	if ( depth > 0 )
+	if(height > 0)
 	{
-		type = 0 ;
-		fwrite( &type, sizeof( char ), 1, fout ) ;
-
-		// Get sign at the center
-		char sg = (char) getSign( getChild( node, 0 ), depth - 1, 7 - getChildIndex( node, 0 ) ) ;
-
-		int t = 0 ;
-		for ( int i = 0 ; i < 8 ; i ++ )
+		int total = getNumChildren(&node->internal);
+		for(int i = 0; i < total; i ++)
 		{
-			if ( hasChild( node, i ) )
-			{
-				writeOctree( fout, getChild( node, t ), depth - 1 ) ;
-				t ++ ;
-			}
-			else
-			{
-				type = 1 ;
-				fwrite( &type, sizeof( char ), 1, fout ) ;
-				fwrite( &sg, sizeof( char ), 1, fout ) ;
-			}
+			countIntersection(getChild(&node->internal, i), height - 1, nedge, ncell, nface);
 		}
 	}
 	else
 	{
-		type = 2 ;
-		fwrite( &type, sizeof( char ), 1, fout ) ;
-		fwrite( &(node[2]), sizeof ( UCHAR ), 1, fout );
-	}
-}
-
-#ifdef USE_HERMIT
-#if 0
-void Octree::writeOctreeGeom( char* fname ) 
-{
-	FILE* fout = fopen ( fname, "wb" ) ;
-
-	// Write header
-	char header[]="SOG.Format 1.0";
-	int nlen = 128 - 4 * 4 - strlen(header) - 1 ;
-	char* header2 = new char[ nlen ];
-	for ( int i = 0 ; i < nlen ; i ++ )
-	{
-		header2[i] = '\0';
-	}
-	fwrite( header, sizeof( char ), strlen(header) + 1, fout ) ;
-	fwrite( origin, sizeof( float ), 3, fout ) ;
-	fwrite( &range, sizeof( float ), 1, fout ) ;
-	fwrite( header2, sizeof( char ), nlen, fout ) ;
+		nedge += getNumEdges2(&node->leaf);
 
-	
-	int sized = ( 1 << maxDepth ) ;
-	int st[3] = {0,0,0};
-	fwrite( &sized, sizeof( int ), 1, fout ) ;
-
-	writeOctreeGeom( fout, root, st, dimen, maxDepth ) ;
-	dc_printf("Grid dimension: %d\n", sized ) ;
-
-
-	fclose( fout ) ;
-}
-#endif
-void Octree::writeOctreeGeom( FILE* fout, UCHAR* node, int st[3], int len, int depth ) 
-{
-	char type ;
-	if ( depth > 0 )
-	{
-		type = 0 ;
-		fwrite( &type, sizeof( char ), 1, fout ) ;
-
-		// Get sign at the center
-		char sg = (char) getSign( getChild( node, 0 ), depth - 1, 7 - getChildIndex( node, 0 ) ) ;
-
-		int t = 0 ;
-		len >>= 1 ;
-		for ( int i = 0 ; i < 8 ; i ++ )
-		{
-			if ( hasChild( node, i ) )
-			{
-				int nst[3] ;
-				nst[0] = st[0] + vertmap[i][0] * len ;
-				nst[1] = st[1] + vertmap[i][1] * len ;
-				nst[2] = st[2] + vertmap[i][2] * len ;
-				writeOctreeGeom( fout, getChild( node, t ), nst, len, depth - 1 ) ;
-				t ++ ;
-			}
-			else
-			{
-				type = 1 ;
-				fwrite( &type, sizeof( char ), 1, fout ) ;
-				fwrite( &sg, sizeof( char ), 1, fout ) ;
-			}
-		}
-	}
-	else
-	{
-		type = 2 ;
-		fwrite( &type, sizeof( char ), 1, fout ) ;
-		fwrite( &(node[2]), sizeof ( UCHAR ), 1, fout );
-
-		// Compute minimizer
-		// First, find minimizer
-		float rvalue[3] ;
-		rvalue[0] = (float) st[0] + len / 2 ;
-		rvalue[1] = (float) st[1] + len / 2 ;
-		rvalue[2] = (float) st[2] + len / 2 ;
-		computeMinimizer( node, st, len, rvalue ) ;
-
-		// Update
-		// float flen = len * range / dimen ; 
-		for ( int j = 0 ; j < 3 ; j ++ )
-		{
-			rvalue[ j ] = rvalue[ j ] * range / dimen + origin[ j ] ;
-		}
-
-		fwrite( rvalue, sizeof ( float ), 3, fout );
-	}
-}
-#endif
-
-#ifdef USE_HERMIT
-void Octree::writeDCF( char* fname )
-{
-	FILE* fout = fopen ( fname, "wb" ) ;
-
-	// Writing out version
-	char version[10] = "multisign";
-	fwrite ( &version, sizeof ( char ), 10, fout );
-
-	// Writing out size
-	int sized = ( 1 << maxDepth ) ;
-	fwrite( &sized, sizeof( int ), 1, fout ) ;
-	fwrite( &sized, sizeof( int ), 1, fout ) ;
-	fwrite( &sized, sizeof( int ), 1, fout ) ;
-
-	int st[3] = {0, 0, 0} ;
-	writeDCF( fout, root, maxDepth, st, dimen ) ;
-	
-	dc_printf("Grid dimension: %d\n", sized ) ;
-	fclose( fout ) ;
-}
-
-void Octree::writeDCF( FILE* fout, UCHAR* node, int height, int st[3], int len )
-{
-	nodetype type ;
-	if ( height > 0 )
-	{
-		type = 0 ;
-		len >>= 1 ;
-		fwrite( &type, sizeof( nodetype ), 1, fout ) ;
-
-		// Get sign at the center
-		signtype sg = 1 - (signtype) getSign( getChild( node, 0 ), height - 1, 7 - getChildIndex( node, 0 ) ) ;
-
-		int t = 0 ;
-		for ( int i = 0 ; i < 8 ; i ++ )
-		{
-			if ( hasChild( node, i ) )
-			{
-				int nst[3] ;
-				nst[0] = st[0] + vertmap[i][0] * len ;
-				nst[1] = st[1] + vertmap[i][1] * len ;
-				nst[2] = st[2] + vertmap[i][2] * len ;
-
-
-				writeDCF( fout, getChild( node, t ), height - 1, nst, len ) ;
-				t ++ ;
-			}
-			else
-			{
-				type = 1 ;
-				fwrite( &type, sizeof( nodetype ), 1, fout ) ;
-				fwrite ( &(sg), sizeof ( signtype ), 1, fout );
-			}
-		}
-	}
-	else
-	{
-		type = 2 ;
-		fwrite( &type, sizeof( nodetype ), 1, fout ) ;
-
-		// Write signs
-		signtype sgn[8] ;
-		for ( int i = 0 ; i < 8 ; i ++ )
-		{
-			sgn[ i ] = 1 - (signtype) getSign( node, i ) ;
-		}
-		fwrite (sgn, sizeof (signtype), 8, fout );
-
-		// Write edge data
-		float pts[12], norms[12][3] ;
-		int parity[12] ;
-		fillEdgeOffsetsNormals( node, st, len, pts, norms, parity ) ;
-
-		numtype zero = 0, one = 1 ;
-		for ( int i = 0 ; i < 12 ; i ++ )
-		{
-			int par = getEdgeParity( node, i ) ;
-			// Let's check first
-			if ( par )
-			{
-				if ( sgn[ edgemap[i][0] ] == sgn[ edgemap[i][1] ] )
-				{
-					dc_printf("Wrong! Parity: %d Sign: %d %d\n", parity[i], sgn[ edgemap[i][0] ], sgn[ edgemap[i][1] ]);
-					exit(0) ;
-				}
-				if ( parity[ i ] == 0 )
-				{
-					dc_printf("Wrong! No intersection found.\n");
-					exit(0) ;
-				}
-				fwrite( &one, sizeof ( numtype ) , 1, fout ) ;
-				fwrite( &(pts[i]), sizeof( float ), 1, fout ) ;
-				fwrite( norms[i], sizeof( float ), 3, fout ) ;
-
-			}
-			else
-			{
-				if ( sgn[ edgemap[i][0] ] != sgn[ edgemap[i][1] ] )
-				{
-					dc_printf("Wrong! Parity: %d Sign: %d %d\n", parity[i], sgn[ edgemap[i][0] ], sgn[ edgemap[i][1] ]);
-					exit(0) ;
-				}
-				fwrite ( &zero, sizeof ( numtype ) , 1, fout );
-			}
-		}
-	}
-}
-#endif
-
-
-void Octree::writeOpenEdges( FILE* fout )
-{
-	// Total number of rings
-	fprintf( fout, "%d\n", numRings ) ;
-	dc_printf("Number of rings to write: %d\n", numRings) ;
-
-	// Write each ring
-	PathList* tlist = ringList ;
-	for ( int i = 0 ; i < numRings ; i ++ )
-	{
-		fprintf(fout, "%d\n", tlist->length) ;
-		// dc_printf("Ring length: %d\n", tlist->length ) ;
-		PathElement* cur = tlist->head ;
-		for ( int j = 0 ; j < tlist->length ; j ++ )
-		{
-			float cent[3] ;
-			float flen = mindimen * range / dimen ; 
-			for ( int k = 0 ; k < 3 ; k ++ )
-			{
-				cent[ k ] = cur->pos[ k ] * range / dimen + origin[ k ] + flen / 2 ;
-			}
-			fprintf(fout, "%f %f %f\n", cent[0], cent[1], cent[2]) ;
-			cur = cur->next ;
-		}
-
-		tlist = tlist->next ;
-	}
-}
-
-#ifndef USE_HERMIT
-void Octree::countIntersection( UCHAR* node, int height, int& nquad, int& nvert )
-{
-	if ( height > 0 )
-	{
-		int total = getNumChildren( node ) ;
-		for ( int i = 0 ; i < total ; i ++ )
-		{
-			countIntersection( getChild( node, i ), height - 1, nquad, nvert ) ;
-		}
-	}
-	else
-	{
-		int mask = getSignMask( node ) ;
-		nvert += getNumEdges2( node ) ;
-		nquad += cubes->getNumTriangle( mask ) ;
-
-	}
-}
-
-void Octree::writeVertex( UCHAR* node, int st[3], int len, int height, int& offset, FILE* fout )
-{
-	int i ;
-
-	if ( height == 0 )
-	{
-		// Leaf cell, generate
-		int emap[] = { 0, 4, 8 } ;
-		for ( int i = 0 ; i < 3 ; i ++ )
-		{
-			if ( getEdgeParity( node, emap[i] ) )
-			{
-				// Get intersection location
-				int count = getEdgeCount( node, i ) ;
-				float off = getEdgeOffset( node, count ) ;
-
-				float rvalue[3] ;
-				rvalue[0] = (float) st[0] ;
-				rvalue[1] = (float) st[1] ;
-				rvalue[2] = (float) st[2] ;
-				rvalue[i] += off * mindimen ;
-
-				// Update
-				float fnst[3] ;
-				float flen = len * range / dimen ; 
-				for ( int j = 0 ; j < 3 ; j ++ )
-				{
-					rvalue[ j ] = rvalue[ j ] * range / dimen + origin[ j ] ;
-					fnst[ j ] = st[ j ] * range / dimen + origin[ j ] ;
-				}
-
-				if ( this->outType == 0 )
-				{
-					fprintf( fout, "%f %f %f\n", rvalue[0], rvalue[1], rvalue[2] ) ;
-				}
-				else if ( this->outType == 1 )
-				{
-					PLYWriter::writeVertex( fout, rvalue ) ;
-				}
-				
-				// Store the index
-				setEdgeIntersectionIndex( node, count, offset ) ;
-				offset ++ ;
-			}
-		}
-
-	}
-	else
-	{
-		// Internal cell, recur
-		int count = 0 ;
-		len >>= 1 ;
-		for ( i = 0 ; i < 8 ; i ++ )
-		{
-			if ( hasChild( node, i ) )
-			{
-				int nst[3] ;
-				nst[0] = st[0] + vertmap[i][0] * len ;
-				nst[1] = st[1] + vertmap[i][1] * len ;
-				nst[2] = st[2] + vertmap[i][2] * len ;
-				
-				writeVertex( getChild( node, count ), nst, len, height - 1, offset, fout ) ;
-				count ++ ;
-			}
-		}
-	}
-}
-
-void Octree::writeQuad( UCHAR* node, int st[3], int len, int height, FILE* fout )
-{
-	int i ;
-	if ( height == 0 )
-	{
-		int mask = getSignMask( node ) ;
-		int num = cubes->getNumTriangle( mask ) ;
-		int indices[12] ;
-		fillEdgeIntersectionIndices( node, st, len, indices ) ;
-		int einds[3], ind[3] ;
-
-		//int flag1 = 0 ;
-		//int flag2 = 0 ;
-		for ( i = 0 ; i < num ; i ++ )
-		{
-			int color = 0 ;
-			cubes->getTriangle( mask, i, einds ) ;
-			// dc_printf("(%d %d %d) ", einds[0], einds[1], einds[2] ) ;
-			
-			for ( int j = 0 ; j < 3 ; j ++ )
-			{
-				ind[j] = indices[ einds[j] ] ;
-				/*
-				if ( ind[j] == 78381 )
-				{
-					flag1 = 1 ;
-				}
-				if ( ind[j] == 78384 )
-				{
-					flag2 = 1 ;
-				}
-				*/
-			}
-
-			if ( this->outType == 0 )
-			{
-				// OFF
-				int numpoly = ( color ? -3 : 3 ) ;
-				fprintf(fout, "%d %d %d %d\n", numpoly, ind[0], ind[1], ind[2] ) ;
-				actualQuads ++ ;
-			}
-			else if ( this->outType == 1 )
-			{
-				// PLY
-				PLYWriter::writeFace( fout, 3, ind ) ;
-				actualQuads ++ ;
-			}
-		}
-
-		/*
-		if (flag1 && flag2)
-		{
-			dc_printf("%d\n", mask);
-			cubes->printTriangles( mask ) ;
-		}
-		*/
-	}
-	else
-	{
-		// Internal cell, recur
-		int count = 0 ;
-		len >>= 1 ;
-		for ( i = 0 ; i < 8 ; i ++ )
-		{
-			if ( hasChild( node, i ) )
-			{
-				int nst[3] ;
-				nst[0] = st[0] + vertmap[i][0] * len ;
-				nst[1] = st[1] + vertmap[i][1] * len ;
-				nst[2] = st[2] + vertmap[i][2] * len ;
-				
-				writeQuad( getChild( node, count ), nst, len, height - 1, fout ) ;
-				count ++ ;
-			}
-		}
-	}
-}
-
-#endif
-
-
-#ifdef USE_HERMIT
-void Octree::countIntersection( UCHAR* node, int height, int& nedge, int& ncell, int& nface )
-{
-	if ( height > 0 )
-	{
-		int total = getNumChildren( node ) ;
-		for ( int i = 0 ; i < total ; i ++ )
-		{
-			countIntersection( getChild( node, i ), height - 1, nedge, ncell, nface ) ;
-		}
-	}
-	else
-	{
-		nedge += getNumEdges2( node ) ;
-
-		int smask = getSignMask( node ) ;
+		int smask = getSignMask(&node->leaf);
 		
 		if(use_manifold)
 		{
-			int comps = manifold_table[ smask ].comps ;
-			ncell += comps ;
+			int comps = manifold_table[smask].comps;
+			ncell += comps;
 		}
 		else {
-			if ( smask > 0 && smask < 255 )
+			if(smask > 0 && smask < 255)
 			{
-				ncell ++ ;
+				ncell ++;
 			}
 		}
 		
-		for ( int i = 0 ; i < 3 ; i ++ )
+		for(int i = 0; i < 3; i ++)
 		{
-			if ( getFaceEdgeNum( node, i * 2 ) )
+			if(getFaceEdgeNum(&node->leaf, i * 2))
 			{
-				nface ++ ;
+				nface ++;
 			}
 		}
 	}
@@ -3497,213 +2313,203 @@ void solve_least_squares(const float halfA[], const float b[],
 void minimize(float rvalue[3], float mp[3], const float pts[12][3],
 			  const float norms[12][3], const int parity[12])
 {
-	float ata[6] = { 0, 0, 0, 0, 0, 0 };
-	float atb[3] = { 0, 0, 0 } ;
-	int ec = 0 ;
+	float ata[6] = {0, 0, 0, 0, 0, 0};
+	float atb[3] = {0, 0, 0};
+	int ec = 0;
 	
-	for ( int i = 0 ; i < 12 ; i ++ )
+	for(int i = 0; i < 12; i ++)
 	{
-		// if ( getEdgeParity( leaf, i) )
-		if ( parity[ i ] )
+		// if(getEdgeParity(leaf, i))
+		if(parity[i])
 		{
-			const float* norm = norms[i] ;
-			const float* p = pts[i] ;
+			const float* norm = norms[i];
+			const float* p = pts[i];
 
 			// QEF
-			ata[ 0 ] += (float) ( norm[ 0 ] * norm[ 0 ] );
-			ata[ 1 ] += (float) ( norm[ 0 ] * norm[ 1 ] );
-			ata[ 2 ] += (float) ( norm[ 0 ] * norm[ 2 ] );
-			ata[ 3 ] += (float) ( norm[ 1 ] * norm[ 1 ] );
-			ata[ 4 ] += (float) ( norm[ 1 ] * norm[ 2 ] );
-			ata[ 5 ] += (float) ( norm[ 2 ] * norm[ 2 ] );
+			ata[0] +=(float)(norm[0] * norm[0]);
+			ata[1] +=(float)(norm[0] * norm[1]);
+			ata[2] +=(float)(norm[0] * norm[2]);
+			ata[3] +=(float)(norm[1] * norm[1]);
+			ata[4] +=(float)(norm[1] * norm[2]);
+			ata[5] +=(float)(norm[2] * norm[2]);
 			
-			double pn = p[0] * norm[0] + p[1] * norm[1] + p[2] * norm[2] ;
+			double pn = p[0] * norm[0] + p[1] * norm[1] + p[2] * norm[2];
 			
-			atb[ 0 ] += (float) ( norm[ 0 ] * pn ) ;
-			atb[ 1 ] += (float) ( norm[ 1 ] * pn ) ;
-			atb[ 2 ] += (float) ( norm[ 2 ] * pn ) ;
+			atb[0] +=(float)(norm[0] * pn);
+			atb[1] +=(float)(norm[1] * pn);
+			atb[2] +=(float)(norm[2] * pn);
 
 			// Minimizer
-			mp[0] += p[0] ;
-			mp[1] += p[1] ;
-			mp[2] += p[2] ;
+			mp[0] += p[0];
+			mp[1] += p[1];
+			mp[2] += p[2];
 			
-			ec ++ ;
+			ec ++;
 		}
 	}
 
-	if ( ec == 0 )
+	if(ec == 0)
 	{
-		return ;
+		return;
 	}
-	mp[0] /= ec ;
-	mp[1] /= ec ;
-	mp[2] /= ec ;
+	mp[0] /= ec;
+	mp[1] /= ec;
+	mp[2] /= ec;
 	
 	// Solve least squares
 	solve_least_squares(ata, atb, mp, rvalue);
 }
 
-void Octree::computeMinimizer( UCHAR* leaf, int st[3], int len, float rvalue[3] )
+void Octree::computeMinimizer(LeafNode* leaf, int st[3], int len, float rvalue[3])
 {
 	// First, gather all edge intersections
-	float pts[12][3], norms[12][3] ;
-	// fillEdgeIntersections( leaf, st, len, pts, norms ) ;
-	int parity[12] ;
-	fillEdgeIntersections( leaf, st, len, pts, norms, parity ) ;
+	float pts[12][3], norms[12][3];
+	int parity[12];
+	fillEdgeIntersections(leaf, st, len, pts, norms, parity);
 
 	// Next, construct QEF and minimizer
 	float mp[3] = {0, 0, 0};
 	minimize(rvalue, mp, pts, norms, parity);
 	
 	/* Restraining the location of the minimizer */
-	float nh1 = hermite_num * len ;
-	float nh2 = ( 1 + hermite_num ) * len ;
+	float nh1 = hermite_num * len;
+	float nh2 =(1 + hermite_num) * len;
 	if((mode == DUALCON_MASS_POINT || mode == DUALCON_CENTROID) ||
-		( rvalue[0] < st[0] - nh1 || rvalue[1] < st[1] - nh1 || rvalue[2] < st[2] - nh1 ||
-		  rvalue[0] > st[0] + nh2 || rvalue[1] > st[1] + nh2 || rvalue[2] > st[2] + nh2 ))
+		(rvalue[0] < st[0] - nh1 || rvalue[1] < st[1] - nh1 || rvalue[2] < st[2] - nh1 ||
+		  rvalue[0] > st[0] + nh2 || rvalue[1] > st[1] + nh2 || rvalue[2] > st[2] + nh2))
 	{
 		if(mode == DUALCON_CENTROID) {
 			// Use centroids
-			rvalue[0] = (float) st[0] + len / 2 ;
-			rvalue[1] = (float) st[1] + len / 2 ;
-			rvalue[2] = (float) st[2] + len / 2 ;
+			rvalue[0] =(float) st[0] + len / 2;
+			rvalue[1] =(float) st[1] + len / 2;
+			rvalue[2] =(float) st[2] + len / 2;
 		}
 		else {
 			// Use mass point instead
-			rvalue[0] = mp[0] ;
-			rvalue[1] = mp[1] ;
-			rvalue[2] = mp[2] ;
+			rvalue[0] = mp[0];
+			rvalue[1] = mp[1];
+			rvalue[2] = mp[2];
 		}
 	}
 }
 
-void Octree::generateMinimizer( UCHAR* node, int st[3], int len, int height, int& offset )
+void Octree::generateMinimizer(Node* node, int st[3], int len, int height, int& offset)
 {
-	int i, j ;
+	int i, j;
 
-	if ( height == 0 )
+	if(height == 0)
 	{
 		// Leaf cell, generate
 
 		// First, find minimizer
-		float rvalue[3] ;
-		rvalue[0] = (float) st[0] + len / 2 ;
-		rvalue[1] = (float) st[1] + len / 2 ;
-		rvalue[2] = (float) st[2] + len / 2 ;
-		computeMinimizer( node, st, len, rvalue ) ;
+		float rvalue[3];
+		rvalue[0] =(float) st[0] + len / 2;
+		rvalue[1] =(float) st[1] + len / 2;
+		rvalue[2] =(float) st[2] + len / 2;
+		computeMinimizer(&node->leaf, st, len, rvalue);
 
 		// Update
-		//float fnst[3] ;
-		for ( j = 0 ; j < 3 ; j ++ )
+		//float fnst[3];
+		for(j = 0; j < 3; j ++)
 		{
-			rvalue[ j ] = rvalue[ j ] * range / dimen + origin[ j ] ;
-			//fnst[ j ] = st[ j ] * range / dimen + origin[ j ] ;
+			rvalue[j] = rvalue[j] * range / dimen + origin[j];
+			//fnst[j] = st[j] * range / dimen + origin[j];
 		}
 
-		int mult = 0, smask = getSignMask( node ) ;
+		int mult = 0, smask = getSignMask(&node->leaf);
 		
 		if(use_manifold)
 		{
-			mult = manifold_table[ smask ].comps ;
+			mult = manifold_table[smask].comps;
 		}
 		else
 		{
-			if ( smask > 0 && smask < 255 )
+			if(smask > 0 && smask < 255)
 			{
-				mult = 1 ;
+				mult = 1;
 			}
 		}
 
-		for ( j = 0 ; j < mult ; j ++ )
+		for(j = 0; j < mult; j ++)
 		{
 			add_vert(output_mesh, rvalue);
 		}
 		
 		// Store the index
-		setMinimizerIndex( node, offset ) ;
+		setMinimizerIndex(&node->leaf, offset);
 
-		offset += mult ;
+		offset += mult;
 	}
 	else
 	{
 		// Internal cell, recur
-		int count = 0 ;
-		len >>= 1 ;
-		for ( i = 0 ; i < 8 ; i ++ )
+		int count = 0;
+		len >>= 1;
+		for(i = 0; i < 8; i ++)
 		{
-			if ( hasChild( node, i ) )
+			if(hasChild(&node->internal, i))
 			{
-				int nst[3] ;
-				nst[0] = st[0] + vertmap[i][0] * len ;
-				nst[1] = st[1] + vertmap[i][1] * len ;
-				nst[2] = st[2] + vertmap[i][2] * len ;
+				int nst[3];
+				nst[0] = st[0] + vertmap[i][0] * len;
+				nst[1] = st[1] + vertmap[i][1] * len;
+				nst[2] = st[2] + vertmap[i][2] * len;
 				
-				generateMinimizer( getChild( node, count ), nst, len, height - 1, offset ) ;
-				count ++ ;
+				generateMinimizer(getChild(&node->internal, count),
+								  nst, len, height - 1, offset);
+				count ++;
 			}
 		}
 	}
 }
 
-void Octree::processEdgeWrite( UCHAR* node[4], int depth[4], int maxdep, int dir )
+void Octree::processEdgeWrite(Node* node[4], int depth[4], int maxdep, int dir)
 {
-	//int color = 0 ;
+	//int color = 0;
 
-	int i = 3 ;
+	int i = 3;
 	{
-		if ( getEdgeParity( node[i], processEdgeMask[dir][i] ) )
+		if(getEdgeParity((LeafNode*)(node[i]), processEdgeMask[dir][i]))
 		{
-			int flip = 0 ;
-			int edgeind = processEdgeMask[dir][i] ;
-			if ( getSign( node[i], edgemap[ edgeind ][ 1 ] ) > 0 )
+			int flip = 0;
+			int edgeind = processEdgeMask[dir][i];
+			if(getSign((LeafNode*)node[i], edgemap[edgeind][1]) > 0)
 			{
-				flip = 1 ;
+				flip = 1;
 			}
 			
-			int num = 0 ;
+			int num = 0;
 			{
 				int ind[8];
 				if(use_manifold)
 				{
 					/* Deprecated
 					   int ind[4] = {
-					   getMinimizerIndex( node[0], processEdgeMask[dir][0] ),
-					   getMinimizerIndex( node[1], processEdgeMask[dir][1] ),
-					   getMinimizerIndex( node[3], processEdgeMask[dir][3] ),
-					   getMinimizerIndex( node[2], processEdgeMask[dir][2] )
-					   } ;
-					   num = 4 ;
+					   getMinimizerIndex(node[0], processEdgeMask[dir][0]),
+					   getMinimizerIndex(node[1], processEdgeMask[dir][1]),
+					   getMinimizerIndex(node[3], processEdgeMask[dir][3]),
+					   getMinimizerIndex(node[2], processEdgeMask[dir][2])
+					  };
+					   num = 4;
 					*/
-					int vind[2] ;
+					int vind[2];
 					int seq[4] = {0,1,3,2};
-					for ( int k = 0 ; k < 4 ; k ++ )
+					for(int k = 0; k < 4; k ++)
 					{
-						getMinimizerIndices( node[seq[k]], processEdgeMask[dir][seq[k]], vind ) ;
-						ind[num] = vind[0] ; 
-						num ++ ;
+						getMinimizerIndices((LeafNode*)(node[seq[k]]), processEdgeMask[dir][seq[k]], vind);
+						ind[num] = vind[0]; 
+						num ++;
 					
-						if ( vind[1] != -1 )
+						if(vind[1] != -1)
 						{
-							ind[num] = vind[1] ; 
-							num ++ ;
-							if ( flip == 0 )
+							ind[num] = vind[1]; 
+							num ++;
+							if(flip == 0)
 							{
-								ind[num-1] = vind[0] ;
-								ind[num-2] = vind[1] ;
+								ind[num-1] = vind[0];
+								ind[num-2] = vind[1];
 							}
 						}
 					}
-#ifdef TESTMANIFOLD						
-					if ( num != 4 )
-					{
-						dc_printf("Polygon: %d\n", num);
-					}
-					for ( k = 0 ; k < num ; k ++ )
-					{
-						fprintf(testfout, "{%d,%d},", ind[k], ind[(k+1)%num] );
-					}
-#endif
 
 					/* we don't use the manifold option, but if it is
 					   ever enabled again note that it can output
@@ -3711,498 +2517,505 @@ void Octree::processEdgeWrite( UCHAR* node[4], int depth[4], int maxdep, int dir
 				}
 				else {
 					if(flip) {
-						ind[0] = getMinimizerIndex( node[2] );
-						ind[1] = getMinimizerIndex( node[3] );
-						ind[2] = getMinimizerIndex( node[1] );
-						ind[3] = getMinimizerIndex( node[0] );
+						ind[0] = getMinimizerIndex((LeafNode*)(node[2]));
+						ind[1] = getMinimizerIndex((LeafNode*)(node[3]));
+						ind[2] = getMinimizerIndex((LeafNode*)(node[1]));
+						ind[3] = getMinimizerIndex((LeafNode*)(node[0]));
 					}
 					else {
-						ind[0] = getMinimizerIndex( node[0] );
-						ind[1] = getMinimizerIndex( node[1] );
-						ind[2] = getMinimizerIndex( node[3] );
-						ind[3] = getMinimizerIndex( node[2] );
+						ind[0] = getMinimizerIndex((LeafNode*)(node[0]));
+						ind[1] = getMinimizerIndex((LeafNode*)(node[1]));
+						ind[2] = getMinimizerIndex((LeafNode*)(node[3]));
+						ind[3] = getMinimizerIndex((LeafNode*)(node[2]));
 					}
 					
 					add_quad(output_mesh, ind);
 				}
 				/*
-				if ( this->outType == 0 )
+				if(outType == 0)
 				{
 					// OFF
 
-					num = ( color ? -num : num ) ;
+					num =(color ? -num : num);
 
 					fprintf(fout, "%d ", num);
 
-					if ( flip )
+					if(flip)
 					{
-						for ( int k = num - 1 ; k >= 0 ; k -- )
+						for(int k = num - 1; k >= 0; k --)
 						{
-							fprintf(fout, "%d ", ind[k] ) ;
+							fprintf(fout, "%d ", ind[k]);
 						}
 					}
 					else
 					{
-						for ( int k = 0 ; k < num ; k ++ )
+						for(int k = 0; k < num; k ++)
 						{
-							fprintf(fout, "%d ", ind[k] ) ;
+							fprintf(fout, "%d ", ind[k]);
 						}
 					}
 
-					fprintf( fout, "\n") ;
+					fprintf(fout, "\n");
 
-					actualQuads ++ ;
+					actualQuads ++;
 				}
-				else if ( this->outType == 1 )
+				else if(outType == 1)
 				{
 					// PLY
 
-					if ( flip )
+					if(flip)
 					{
 						int tind[8];
-						for ( int k = num - 1 ; k >= 0 ; k -- )
+						for(int k = num - 1; k >= 0; k --)
 						{
-							tind[k] = ind[num-1-k] ;
+							tind[k] = ind[num-1-k];
 						}
-						// PLYWriter::writeFace( fout, num, tind ) ;
+						// PLYWriter::writeFace(fout, num, tind);
 					}
 					else
 					{
-							// PLYWriter::writeFace( fout, num, ind ) ;
+							// PLYWriter::writeFace(fout, num, ind);
 					}
 
-					actualQuads ++ ;
+					actualQuads ++;
 					}*/
 			}
-			return ;
+			return;
 		}
 		else
 		{
-			return ;
+			return;
 		}
 	}
 }
 
 
-void Octree::edgeProcContour( UCHAR* node[4], int leaf[4], int depth[4], int maxdep, int dir )
+void Octree::edgeProcContour(Node* node[4], int leaf[4], int depth[4], int maxdep, int dir)
 {
-	if ( ! ( node[0] && node[1] && node[2] && node[3] ) )
+	if(!(node[0] && node[1] && node[2] && node[3]))
 	{
-		return ;
+		return;
 	}
-	if ( leaf[0] && leaf[1] && leaf[2] && leaf[3] )
+	if(leaf[0] && leaf[1] && leaf[2] && leaf[3])
 	{
-		processEdgeWrite( node, depth, maxdep, dir ) ;
+		processEdgeWrite(node, depth, maxdep, dir);
 	}
 	else
 	{
-		int i, j ;
-		UCHAR* chd[ 4 ][ 8 ] ;
-		for ( j = 0 ; j < 4 ; j ++ )
+		int i, j;
+		Node* chd[4][8];
+		for(j = 0; j < 4; j ++)
 		{
-			for ( i = 0 ; i < 8 ; i ++ )
+			for(i = 0; i < 8; i ++)
 			{
-				chd[ j ][ i ] = ((!leaf[j]) && hasChild( node[j], i ) )? getChild( node[j], getChildCount( node[j], i ) ) : NULL ;
+				chd[j][i] = ((!leaf[j]) && hasChild(&node[j]->internal, i)) ?
+					getChild(&node[j]->internal,
+							 getChildCount(&node[j]->internal, i)) : NULL;
 			}
 		}
 
 		// 2 edge calls
-		UCHAR* ne[4] ;
-		int le[4] ;
-		int de[4] ;
-		for ( i = 0 ; i < 2 ; i ++ )
+		Node* ne[4];
+		int le[4];
+		int de[4];
+		for(i = 0; i < 2; i ++)
 		{
-			int c[ 4 ] = { edgeProcEdgeMask[ dir ][ i ][ 0 ], 
-						   edgeProcEdgeMask[ dir ][ i ][ 1 ], 
-						   edgeProcEdgeMask[ dir ][ i ][ 2 ], 
-						   edgeProcEdgeMask[ dir ][ i ][ 3 ] } ;
+			int c[4] = {edgeProcEdgeMask[dir][i][0], 
+						   edgeProcEdgeMask[dir][i][1], 
+						   edgeProcEdgeMask[dir][i][2], 
+						   edgeProcEdgeMask[dir][i][3]};
 
-			for ( int j = 0 ; j < 4 ; j ++ )
+			for(int j = 0; j < 4; j ++)
 			{
-				if ( leaf[j] )
+				if(leaf[j])
 				{
-					le[j] = leaf[j] ;
-					ne[j] = node[j] ;
-					de[j] = depth[j] ;
+					le[j] = leaf[j];
+					ne[j] = node[j];
+					de[j] = depth[j];
 				}
 				else
 				{
-					le[j] = isLeaf( node[j], c[j] ) ;
-					ne[j] = chd[ j ][ c[j] ] ;
-					de[j] = depth[j] - 1 ;
+					le[j] = isLeaf(&node[j]->internal, c[j]);
+					ne[j] = chd[j][c[j]];
+					de[j] = depth[j] - 1;
 				}
 			}
 
-			edgeProcContour( ne, le, de, maxdep - 1, edgeProcEdgeMask[ dir ][ i ][ 4 ] ) ;
+			edgeProcContour(ne, le, de, maxdep - 1, edgeProcEdgeMask[dir][i][4]);
 		}
 
 	}
 }
 
-void Octree::faceProcContour( UCHAR* node[2], int leaf[2], int depth[2], int maxdep, int dir )
+void Octree::faceProcContour(Node* node[2], int leaf[2], int depth[2], int maxdep, int dir)
 {
-	if ( ! ( node[0] && node[1] ) )
+	if(!(node[0] && node[1]))
 	{
-		return ;
+		return;
 	}
 
-	if ( ! ( leaf[0] && leaf[1] ) )
+	if(!(leaf[0] && leaf[1]))
 	{
-		int i, j ;
+		int i, j;
 		// Fill children nodes
-		UCHAR* chd[ 2 ][ 8 ] ;
-		for ( j = 0 ; j < 2 ; j ++ )
+		Node* chd[2][8];
+		for(j = 0; j < 2; j ++)
 		{
-			for ( i = 0 ; i < 8 ; i ++ )
+			for(i = 0; i < 8; i ++)
 			{
-				chd[ j ][ i ] = ((!leaf[j]) && hasChild( node[j], i )) ? getChild( node[j], getChildCount( node[j], i ) ) : NULL ;
+				chd[j][i] =((!leaf[j]) && hasChild(&node[j]->internal, i)) ?
+					getChild(&node[j]->internal,
+							 getChildCount(&node[j]->internal, i)) : NULL;
 			}
 		}
 
 		// 4 face calls
-		UCHAR* nf[2] ;
-		int df[2] ;
-		int lf[2] ;
-		for ( i = 0 ; i < 4 ; i ++ )
+		Node* nf[2];
+		int df[2];
+		int lf[2];
+		for(i = 0; i < 4; i ++)
 		{
-			int c[2] = { faceProcFaceMask[ dir ][ i ][ 0 ], faceProcFaceMask[ dir ][ i ][ 1 ] };
-			for ( int j = 0 ; j < 2 ; j ++ )
+			int c[2] = {faceProcFaceMask[dir][i][0], faceProcFaceMask[dir][i][1]};
+			for(int j = 0; j < 2; j ++)
 			{
-				if ( leaf[j] )
+				if(leaf[j])
 				{
-					lf[j] = leaf[j] ;
-					nf[j] = node[j] ;
-					df[j] = depth[j] ;
+					lf[j] = leaf[j];
+					nf[j] = node[j];
+					df[j] = depth[j];
 				}
 				else
 				{
-					lf[j] = isLeaf( node[j], c[j] ) ;
-					nf[j] = chd[ j ][ c[j] ] ;
-					df[j] = depth[j] - 1 ;
+					lf[j] = isLeaf(&node[j]->internal, c[j]);
+					nf[j] = chd[j][c[j]];
+					df[j] = depth[j] - 1;
 				}
 			}
-			faceProcContour( nf, lf, df, maxdep - 1, faceProcFaceMask[ dir ][ i ][ 2 ] ) ;
+			faceProcContour(nf, lf, df, maxdep - 1, faceProcFaceMask[dir][i][2]);
 		}
 
 		// 4 edge calls
-		int orders[2][4] = {{ 0, 0, 1, 1 }, { 0, 1, 0, 1 }} ;
-		UCHAR* ne[4] ;
-		int le[4] ;
-		int de[4] ;
+		int orders[2][4] = {{0, 0, 1, 1}, {0, 1, 0, 1}};
+		Node* ne[4];
+		int le[4];
+		int de[4];
 			
-		for ( i = 0 ; i < 4 ; i ++ )
+		for(i = 0; i < 4; i ++)
 		{
-			int c[4] = { faceProcEdgeMask[ dir ][ i ][ 1 ], faceProcEdgeMask[ dir ][ i ][ 2 ],
-						 faceProcEdgeMask[ dir ][ i ][ 3 ], faceProcEdgeMask[ dir ][ i ][ 4 ] };
-			int* order = orders[ faceProcEdgeMask[ dir ][ i ][ 0 ] ] ;
+			int c[4] = {faceProcEdgeMask[dir][i][1], faceProcEdgeMask[dir][i][2],
+						 faceProcEdgeMask[dir][i][3], faceProcEdgeMask[dir][i][4]};
+			int* order = orders[faceProcEdgeMask[dir][i][0]];
 
-			for ( int j = 0 ; j < 4 ; j ++ )
+			for(int j = 0; j < 4; j ++)
 			{
-				if ( leaf[order[j]] )
+				if(leaf[order[j]])
 				{
-					le[j] = leaf[order[j]] ;
-					ne[j] = node[order[j]] ;
-					de[j] = depth[order[j]] ;
+					le[j] = leaf[order[j]];
+					ne[j] = node[order[j]];
+					de[j] = depth[order[j]];
 				}
 				else
 				{
-					le[j] = isLeaf( node[order[j]], c[j] ) ;
-					ne[j] = chd[ order[ j ] ][ c[j] ] ;
-					de[j] = depth[order[j]] - 1 ;
+					le[j] = isLeaf(&node[order[j]]->internal, c[j]);
+					ne[j] = chd[order[j]][c[j]];
+					de[j] = depth[order[j]] - 1;
 				}
 			}
 
-			edgeProcContour( ne, le, de, maxdep - 1, faceProcEdgeMask[ dir ][ i ][ 5 ] ) ;
+			edgeProcContour(ne, le, de, maxdep - 1, faceProcEdgeMask[dir][i][5]);
 		}
 	}
 }
 
 
-void Octree::cellProcContour( UCHAR* node, int leaf, int depth )
+void Octree::cellProcContour(Node* node, int leaf, int depth)
 {
-	if ( node == NULL )
+	if(node == NULL)
 	{
-		return ;
+		return;
 	}
 
-	if ( ! leaf )
+	if(! leaf)
 	{
-		int i ;
+		int i;
 
 		// Fill children nodes
-		UCHAR* chd[ 8 ] ;
-		for ( i = 0 ; i < 8 ; i ++ )
+		Node* chd[8];
+		for(i = 0; i < 8; i ++)
 		{
-			chd[ i ] = ((!leaf) && hasChild( node, i )) ? getChild( node, getChildCount( node, i ) ) : NULL ;
+			chd[i] =((!leaf) && hasChild(&node->internal, i)) ?
+				getChild(&node->internal,
+						 getChildCount(&node->internal, i)) : NULL;
 		}
 
 		// 8 Cell calls
-		for ( i = 0 ; i < 8 ; i ++ )
+		for(i = 0; i < 8; i ++)
 		{
-			cellProcContour( chd[ i ], isLeaf( node, i ), depth - 1 ) ;
+			cellProcContour(chd[i], isLeaf(&node->internal, i), depth - 1);
 		}
 
 		// 12 face calls
-		UCHAR* nf[2] ;
-		int lf[2] ;
-		int df[2] = { depth - 1, depth - 1 } ;
-		for ( i = 0 ; i < 12 ; i ++ )
+		Node* nf[2];
+		int lf[2];
+		int df[2] = {depth - 1, depth - 1};
+		for(i = 0; i < 12; i ++)
 		{
-			int c[ 2 ] = { cellProcFaceMask[ i ][ 0 ], cellProcFaceMask[ i ][ 1 ] };
+			int c[2] = {cellProcFaceMask[i][0], cellProcFaceMask[i][1]};
 
-			lf[0] = isLeaf( node, c[0] ) ;
-			lf[1] = isLeaf( node, c[1] ) ;
+			lf[0] = isLeaf(&node->internal, c[0]);
+			lf[1] = isLeaf(&node->internal, c[1]);
 
-			nf[0] = chd[ c[0] ] ;
-			nf[1] = chd[ c[1] ] ;
+			nf[0] = chd[c[0]];
+			nf[1] = chd[c[1]];
 
-			faceProcContour( nf, lf, df, depth - 1, cellProcFaceMask[ i ][ 2 ] ) ;
+			faceProcContour(nf, lf, df, depth - 1, cellProcFaceMask[i][2]);
 		}
 
 		// 6 edge calls
-		UCHAR* ne[4] ;
-		int le[4] ;
-		int de[4] = { depth - 1, depth - 1, depth - 1, depth - 1 } ;
-		for ( i = 0 ; i < 6 ; i ++ )
+		Node* ne[4];
+		int le[4];
+		int de[4] = {depth - 1, depth - 1, depth - 1, depth - 1};
+		for(i = 0; i < 6; i ++)
 		{
-			int c[ 4 ] = { cellProcEdgeMask[ i ][ 0 ], cellProcEdgeMask[ i ][ 1 ], cellProcEdgeMask[ i ][ 2 ], cellProcEdgeMask[ i ][ 3 ] };
+			int c[4] = {cellProcEdgeMask[i][0], cellProcEdgeMask[i][1], cellProcEdgeMask[i][2], cellProcEdgeMask[i][3]};
 
-			for ( int j = 0 ; j < 4 ; j ++ )
+			for(int j = 0; j < 4; j ++)
 			{
-				le[j] = isLeaf( node, c[j] ) ;
-				ne[j] = chd[ c[j] ] ;
+				le[j] = isLeaf(&node->internal, c[j]);
+				ne[j] = chd[c[j]];
 			}
 
-			edgeProcContour( ne, le, de, depth - 1, cellProcEdgeMask[ i ][ 4 ] ) ;
+			edgeProcContour(ne, le, de, depth - 1, cellProcEdgeMask[i][4]);
 		}
 	}
 	
 }
 
-#endif
-
-
-
-void Octree::processEdgeParity( UCHAR* node[4], int depth[4], int maxdep, int dir )
+void Octree::processEdgeParity(LeafNode* node[4], int depth[4], int maxdep, int dir)
 {
-	int con = 0 ;
-	for ( int i = 0 ; i < 4 ; i ++ )
+	int con = 0;
+	for(int i = 0; i < 4; i ++)
 	{
 		// Minimal cell
-		// if ( op == 0 )
+		// if(op == 0)
 		{
-			if ( getEdgeParity( node[i], processEdgeMask[dir][i] ) )
+			if(getEdgeParity(node[i], processEdgeMask[dir][i]))
 			{
-				con = 1 ;
-				break ;
+				con = 1;
+				break;
 			}
 		}
 	}
 
-	if ( con == 1 )
+	if(con == 1)
 	{
-		for ( int i = 0 ; i < 4 ; i ++ )
+		for(int i = 0; i < 4; i ++)
 		{
-			setEdge( node[ i ], processEdgeMask[dir][i] ) ;
+			setEdge(node[i], processEdgeMask[dir][i]);
 		}
 	}
 	
 }
 
-void Octree::edgeProcParity( UCHAR* node[4], int leaf[4], int depth[4], int maxdep, int dir )
+void Octree::edgeProcParity(Node* node[4], int leaf[4], int depth[4], int maxdep, int dir)
 {
-	if ( ! ( node[0] && node[1] && node[2] && node[3] ) )
+	if(!(node[0] && node[1] && node[2] && node[3]))
 	{
-		return ;
+		return;
 	}
-	if ( leaf[0] && leaf[1] && leaf[2] && leaf[3] )
+	if(leaf[0] && leaf[1] && leaf[2] && leaf[3])
 	{
-		processEdgeParity( node, depth, maxdep, dir ) ;
+		processEdgeParity((LeafNode**)node, depth, maxdep, dir);
 	}
 	else
 	{
-		int i, j ;
-		UCHAR* chd[ 4 ][ 8 ] ;
-		for ( j = 0 ; j < 4 ; j ++ )
+		int i, j;
+		Node* chd[4][8];
+		for(j = 0; j < 4; j ++)
 		{
-			for ( i = 0 ; i < 8 ; i ++ )
+			for(i = 0; i < 8; i ++)
 			{
-				chd[ j ][ i ] = ((!leaf[j]) && hasChild( node[j], i ) )? getChild( node[j], getChildCount( node[j], i ) ) : NULL ;
+				chd[j][i] =((!leaf[j]) && hasChild(&node[j]->internal, i)) ?
+					getChild(&node[j]->internal, getChildCount(&node[j]->internal, i)) : NULL;
 			}
 		}
 
 		// 2 edge calls
-		UCHAR* ne[4] ;
-		int le[4] ;
-		int de[4] ;
-		for ( i = 0 ; i < 2 ; i ++ )
+		Node* ne[4];
+		int le[4];
+		int de[4];
+		for(i = 0; i < 2; i ++)
 		{
-			int c[ 4 ] = { edgeProcEdgeMask[ dir ][ i ][ 0 ], 
-						   edgeProcEdgeMask[ dir ][ i ][ 1 ], 
-						   edgeProcEdgeMask[ dir ][ i ][ 2 ], 
-						   edgeProcEdgeMask[ dir ][ i ][ 3 ] } ;
+			int c[4] = {edgeProcEdgeMask[dir][i][0], 
+						   edgeProcEdgeMask[dir][i][1], 
+						   edgeProcEdgeMask[dir][i][2], 
+						   edgeProcEdgeMask[dir][i][3]};
 
-			// int allleaf = 1 ;
-			for ( int j = 0 ; j < 4 ; j ++ )
+			// int allleaf = 1;
+			for(int j = 0; j < 4; j ++)
 			{
 
-				if ( leaf[j] )
+				if(leaf[j])
 				{
-					le[j] = leaf[j] ;
-					ne[j] = node[j] ;
-					de[j] = depth[j] ;
+					le[j] = leaf[j];
+					ne[j] = node[j];
+					de[j] = depth[j];
 				}
 				else
 				{
-					le[j] = isLeaf( node[j], c[j] ) ;
-					ne[j] = chd[ j ][ c[j] ] ;
-					de[j] = depth[j] - 1 ;
+					le[j] = isLeaf(&node[j]->internal, c[j]);
+					ne[j] = chd[j][c[j]];
+					de[j] = depth[j] - 1;
 
 				}
 
 			}
 
-			edgeProcParity( ne, le, de, maxdep - 1, edgeProcEdgeMask[ dir ][ i ][ 4 ] ) ;
+			edgeProcParity(ne, le, de, maxdep - 1, edgeProcEdgeMask[dir][i][4]);
 		}
 
 	}
 }
 
-void Octree::faceProcParity( UCHAR* node[2], int leaf[2], int depth[2], int maxdep, int dir )
+void Octree::faceProcParity(Node* node[2], int leaf[2], int depth[2], int maxdep, int dir)
 {
-	if ( ! ( node[0] && node[1] ) )
+	if(!(node[0] && node[1]))
 	{
-		return ;
+		return;
 	}
 
-	if ( ! ( leaf[0] && leaf[1] ) )
+	if(!(leaf[0] && leaf[1]))
 	{
-		int i, j ;
+		int i, j;
 		// Fill children nodes
-		UCHAR* chd[ 2 ][ 8 ] ;
-		for ( j = 0 ; j < 2 ; j ++ )
+		Node* chd[2][8];
+		for(j = 0; j < 2; j ++)
 		{
-			for ( i = 0 ; i < 8 ; i ++ )
+			for(i = 0; i < 8; i ++)
 			{
-				chd[ j ][ i ] = ((!leaf[j]) && hasChild( node[j], i )) ? getChild( node[j], getChildCount( node[j], i ) ) : NULL ;
+				chd[j][i] =((!leaf[j]) && hasChild(&node[j]->internal, i)) ?
+					getChild(&node[j]->internal,
+							 getChildCount(&node[j]->internal, i)) : NULL;
 			}
 		}
 
 		// 4 face calls
-		UCHAR* nf[2] ;
-		int df[2] ;
-		int lf[2] ;
-		for ( i = 0 ; i < 4 ; i ++ )
+		Node* nf[2];
+		int df[2];
+		int lf[2];
+		for(i = 0; i < 4; i ++)
 		{
-			int c[2] = { faceProcFaceMask[ dir ][ i ][ 0 ], faceProcFaceMask[ dir ][ i ][ 1 ] };
-			for ( int j = 0 ; j < 2 ; j ++ )
+			int c[2] = {faceProcFaceMask[dir][i][0], faceProcFaceMask[dir][i][1]};
+			for(int j = 0; j < 2; j ++)
 			{
-				if ( leaf[j] )
+				if(leaf[j])
 				{
-					lf[j] = leaf[j] ;
-					nf[j] = node[j] ;
-					df[j] = depth[j] ;
+					lf[j] = leaf[j];
+					nf[j] = node[j];
+					df[j] = depth[j];
 				}
 				else
 				{
-					lf[j] = isLeaf( node[j], c[j] ) ;
-					nf[j] = chd[ j ][ c[j] ] ;
-					df[j] = depth[j] - 1 ;
+					lf[j] = isLeaf(&node[j]->internal, c[j]);
+					nf[j] = chd[j][c[j]];
+					df[j] = depth[j] - 1;
 				}
 			}
-			faceProcParity( nf, lf, df, maxdep - 1, faceProcFaceMask[ dir ][ i ][ 2 ] ) ;
+			faceProcParity(nf, lf, df, maxdep - 1, faceProcFaceMask[dir][i][2]);
 		}
 
 		// 4 edge calls
-		int orders[2][4] = {{ 0, 0, 1, 1 }, { 0, 1, 0, 1 }} ;
-		UCHAR* ne[4] ;
-		int le[4] ;
-		int de[4] ;
+		int orders[2][4] = {{0, 0, 1, 1}, {0, 1, 0, 1}};
+		Node* ne[4];
+		int le[4];
+		int de[4];
 			
-		for ( i = 0 ; i < 4 ; i ++ )
+		for(i = 0; i < 4; i ++)
 		{
-			int c[4] = { faceProcEdgeMask[ dir ][ i ][ 1 ], faceProcEdgeMask[ dir ][ i ][ 2 ],
-						 faceProcEdgeMask[ dir ][ i ][ 3 ], faceProcEdgeMask[ dir ][ i ][ 4 ] };
-			int* order = orders[ faceProcEdgeMask[ dir ][ i ][ 0 ] ] ;
+			int c[4] = {faceProcEdgeMask[dir][i][1], faceProcEdgeMask[dir][i][2],
+						 faceProcEdgeMask[dir][i][3], faceProcEdgeMask[dir][i][4]};
+			int* order = orders[faceProcEdgeMask[dir][i][0]];
 
-			for ( int j = 0 ; j < 4 ; j ++ )
+			for(int j = 0; j < 4; j ++)
 			{
-				if ( leaf[order[j]] )
+				if(leaf[order[j]])
 				{
-					le[j] = leaf[order[j]] ;
-					ne[j] = node[order[j]] ;
-					de[j] = depth[order[j]] ;
+					le[j] = leaf[order[j]];
+					ne[j] = node[order[j]];
+					de[j] = depth[order[j]];
 				}
 				else
 				{
-					le[j] = isLeaf( node[order[j]], c[j] ) ;
-					ne[j] = chd[ order[ j ] ][ c[j] ] ;
-					de[j] = depth[order[j]] - 1 ;
+					le[j] = isLeaf((InternalNode*)(node[order[j]]), c[j]);
+					ne[j] = chd[order[j]][c[j]];
+					de[j] = depth[order[j]] - 1;
 				}
 			}
 
-			edgeProcParity( ne, le, de, maxdep - 1, faceProcEdgeMask[ dir ][ i ][ 5 ] ) ;
+			edgeProcParity(ne, le, de, maxdep - 1, faceProcEdgeMask[dir][i][5]);
 		}
 	}
 }
 
 
-void Octree::cellProcParity( UCHAR* node, int leaf, int depth )
+void Octree::cellProcParity(Node* node, int leaf, int depth)
 {
-	if ( node == NULL )
+	if(node == NULL)
 	{
-		return ;
+		return;
 	}
 
-	if ( ! leaf )
+	if(! leaf)
 	{
-		int i ;
+		int i;
 
 		// Fill children nodes
-		UCHAR* chd[ 8 ] ;
-		for ( i = 0 ; i < 8 ; i ++ )
+		Node* chd[8];
+		for(i = 0; i < 8; i ++)
 		{
-			chd[ i ] = ((!leaf) && hasChild( node, i )) ? getChild( node, getChildCount( node, i ) ) : NULL ;
+			chd[i] =((!leaf) && hasChild((InternalNode*)node, i)) ?
+				getChild((InternalNode*)node,
+						 getChildCount((InternalNode*)node, i)) : NULL;
 		}
 
 		// 8 Cell calls
-		for ( i = 0 ; i < 8 ; i ++ )
+		for(i = 0; i < 8; i ++)
 		{
-			cellProcParity( chd[ i ], isLeaf( node, i ), depth - 1 ) ;
+			cellProcParity(chd[i], isLeaf((InternalNode*)node, i), depth - 1);
 		}
 
 		// 12 face calls
-		UCHAR* nf[2] ;
-		int lf[2] ;
-		int df[2] = { depth - 1, depth - 1 } ;
-		for ( i = 0 ; i < 12 ; i ++ )
+		Node* nf[2];
+		int lf[2];
+		int df[2] = {depth - 1, depth - 1};
+		for(i = 0; i < 12; i ++)
 		{
-			int c[ 2 ] = { cellProcFaceMask[ i ][ 0 ], cellProcFaceMask[ i ][ 1 ] };
+			int c[2] = {cellProcFaceMask[i][0], cellProcFaceMask[i][1]};
 
-			lf[0] = isLeaf( node, c[0] ) ;
-			lf[1] = isLeaf( node, c[1] ) ;
+			lf[0] = isLeaf((InternalNode*)node, c[0]);
+			lf[1] = isLeaf((InternalNode*)node, c[1]);
 
-			nf[0] = chd[ c[0] ] ;
-			nf[1] = chd[ c[1] ] ;
+			nf[0] = chd[c[0]];
+			nf[1] = chd[c[1]];
 
-			faceProcParity( nf, lf, df, depth - 1, cellProcFaceMask[ i ][ 2 ] ) ;
+			faceProcParity(nf, lf, df, depth - 1, cellProcFaceMask[i][2]);
 		}
 
 		// 6 edge calls
-		UCHAR* ne[4] ;
-		int le[4] ;
-		int de[4] = { depth - 1, depth - 1, depth - 1, depth - 1 } ;
-		for ( i = 0 ; i < 6 ; i ++ )
+		Node* ne[4];
+		int le[4];
+		int de[4] = {depth - 1, depth - 1, depth - 1, depth - 1};
+		for(i = 0; i < 6; i ++)
 		{
-			int c[ 4 ] = { cellProcEdgeMask[ i ][ 0 ], cellProcEdgeMask[ i ][ 1 ], cellProcEdgeMask[ i ][ 2 ], cellProcEdgeMask[ i ][ 3 ] };
+			int c[4] = {cellProcEdgeMask[i][0], cellProcEdgeMask[i][1], cellProcEdgeMask[i][2], cellProcEdgeMask[i][3]};
 
-			for ( int j = 0 ; j < 4 ; j ++ )
+			for(int j = 0; j < 4; j ++)
 			{
-				le[j] = isLeaf( node, c[j] ) ;
-				ne[j] = chd[ c[j] ] ;
+				le[j] = isLeaf((InternalNode*)node, c[j]);
+				ne[j] = chd[c[j]];
 			}
 
-			edgeProcParity( ne, le, de, depth - 1, cellProcEdgeMask[ i ][ 4 ] ) ;
+			edgeProcParity(ne, le, de, depth - 1, cellProcEdgeMask[i][4]);
 		}
 	}
 	
diff --git a/intern/dualcon/intern/octree.h b/intern/dualcon/intern/octree.h
index 7b5a626..aac0954 100644
--- a/intern/dualcon/intern/octree.h
+++ b/intern/dualcon/intern/octree.h
@@ -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): Tao Ju
+ * Contributor(s): Tao Ju, Nicholas Bishop
  *
  * ***** END GPL LICENSE BLOCK *****
  */
@@ -23,6 +23,8 @@
 #ifndef OCTREE_H
 #define OCTREE_H
 
+#include <cassert>
+#include <cstring>
 #include <stdio.h>
 #include <math.h>
 #include "GeoCommon.h"
@@ -50,52 +52,56 @@
 // #define IN_VERBOSE_MODE
 
 /* Set scan convert params */
-// Uncomment to use Dual Contouring on Hermit representation
-// for better sharp feature reproduction, but more mem is required
-// The number indicates how far do we allow the minimizer to shoot
-// outside the cell
-#define USE_HERMIT 1.0f
-
-#ifdef USE_HERMIT
-//#define CINDY
-#endif
 
-///#define QIANYI
+#define EDGE_FLOATS 4
 
-//#define TESTMANIFOLD
+union Node;
 
+struct InternalNode {
+	/* Treat as bitfield, bit N indicates whether child N exists or not */
+	unsigned char has_child;
+	/* Treat as bitfield, bit N indicates whether child N is a leaf or not */
+	unsigned char child_is_leaf;
 
-/* Set output options */
-// Comment out to prevent writing output files
-#define OUTPUT_REPAIRED
+	/* Can have up to eight children */
+	Node *children[0];
+};
 
 
-/* Set node bytes */
-#ifdef USE_HERMIT
-#define EDGE_BYTES 16
-#define EDGE_FLOATS 4
-#else
-#define EDGE_BYTES 4
-#define EDGE_FLOATS 1
-#endif
+/**
+ * Bits order
+ *
+ * Leaf node:
+ * Byte 0,1(0-11): edge parity
+ * Byte 1(4,5,6): mask of primary edges intersections stored
+ * Byte 1(7): in flood fill mode, whether the cell is in process
+ * Byte 2(0-8): signs
+ * Byte 3,4: in coloring mode, the mask for edges
+ * Byte 5: edge intersections(4 bytes per inter, or 12 bytes if USE_HERMIT)
+ */
+struct LeafNode /* TODO: remove this attribute once everything is fixed */ {
+	unsigned short edge_parity : 12;
+	unsigned short primary_edge_intersections : 3;
 
-#define CINDY_BYTES 0
+	/* XXX: maybe actually unused? */
+	unsigned short in_process : 1;
 
-/*#define LEAF_EXTRA_BYTES FLOOD_BYTES + CINDY_BYTES
+	/* bitfield */
+	char signs;
 
-#ifdef USE_HERMIT
-#define LEAF_NODE_BYTES 7 + LEAF_EXTRA_BYTES
-#else
-#define LEAF_NODE_BYTES 3 + LEAF_EXTRA_BYTES
-#endif*/
+	int minimizer_index;
+	
+	unsigned short flood_fill;
 
-#define INTERNAL_NODE_BYTES 2
-#define POINTER_BYTES 8
-#define FLOOD_FILL_BYTES 2
+	float edge_intersections[0];
+};
 
-#define signtype short
-#define nodetype int
-#define numtype int
+/* Doesn't get directly allocated anywhere, just used for passing
+   pointers to nodes that could be internal or leaf. */
+union Node {
+	InternalNode internal;
+	LeafNode leaf;
+};
 
 /* Global variables */
 extern const int edgemask[3];
@@ -116,23 +122,23 @@ extern const int dirEdge[3][4];
 struct PathElement
 {
 	// Origin
-	int pos[3] ;
+	int pos[3];
 
 	// link
-	PathElement* next ;
+	PathElement* next;
 };
 
 struct PathList
 {
 	// Head
-	PathElement* head ;
-	PathElement* tail ;
+	PathElement* head;
+	PathElement* tail;
 
 	// Length of the list
-	int length ;
+	int length;
 
 	// Next list
-	PathList* next ;
+	PathList* next;
 };
 
 
@@ -145,78 +151,71 @@ public:
 	/* Public members */
 
 	/// Memory allocators
-	VirtualMemoryAllocator * alloc[ 9 ] ;
-	VirtualMemoryAllocator * leafalloc[ 4 ] ;
+	VirtualMemoryAllocator * alloc[9];
+	VirtualMemoryAllocator * leafalloc[4];
 
 	/// Root node
-	UCHAR* root ;
+	Node* root;
 
 	/// Model reader
-	ModelReader* reader ;
+	ModelReader* reader;
 
 	/// Marching cubes table
-	Cubes* cubes ;
+	Cubes* cubes;
 
 	/// Length of grid
-	int dimen ;
-	int mindimen, minshift ;
+	int dimen;
+	int mindimen, minshift;
 
 	/// Maximum depth
-	int maxDepth ;
+	int maxDepth;
 	
 	/// The lower corner of the bounding box and the size
 	float origin[3];
 	float range;
 
 	/// Counting information
-	int nodeCount ;
-	int nodeSpace ;
-	int nodeCounts[ 9 ] ;
+	int nodeCount;
+	int nodeSpace;
+	int nodeCounts[9];
 
-	int actualQuads, actualVerts ;
+	int actualQuads, actualVerts;
 
-	PathList* ringList ;
+	PathList* ringList;
 
-	int maxTrianglePerCell ;
-	int outType ; // 0 for OFF, 1 for PLY, 2 for VOL
+	int maxTrianglePerCell;
+	int outType; // 0 for OFF, 1 for PLY, 2 for VOL
 
 	// For flood filling
 	int use_flood_fill;
-	float thresh ;
+	float thresh;
 
 	int use_manifold;
 
-	// testing
-	FILE* testfout ;
-
 	float hermite_num;
 
 	DualConMode mode;
 
-	int leaf_node_bytes;
-	int leaf_extra_bytes;
-	int flood_bytes;
-
 public:
 	/**
 	 * Construtor
 	 */
-	Octree ( ModelReader* mr,
+	Octree(ModelReader* mr,
 			 DualConAllocOutput alloc_output_func,
 			 DualConAddVert add_vert_func,
 			 DualConAddQuad add_quad_func,
 			 DualConFlags flags, DualConMode mode, int depth,
-			 float threshold, float hermite_num ) ;
+			 float threshold, float hermite_num);
 
 	/**
 	 * Destructor
 	 */
-	~Octree ( ) ;
+	~Octree();
 
 	/**
 	 * Scan convert
 	 */
-	void scanConvert() ;
+	void scanConvert();
 
 	void *getOutputMesh() { return output_mesh; }
 
@@ -226,164 +225,129 @@ private:
 	/**
 	 * Initialize memory allocators
 	 */
-	void initMemory ( ) ;
+	void initMemory();
 
 	/**
 	 * Release memory
 	 */
-	void freeMemory ( ) ;
+	void freeMemory();
 
 	/**
 	 * Print memory usage
 	 */
-	void printMemUsage( ) ;
+	void printMemUsage();
 
 
 	/**
 	 * Methods to set / restore minimum edges
 	 */
-	void resetMinimalEdges( ) ;
+	void resetMinimalEdges();
 
-	void cellProcParity ( UCHAR* node, int leaf, int depth ) ;
-	void faceProcParity ( UCHAR* node[2], int leaf[2], int depth[2], int maxdep, int dir ) ;
-	void edgeProcParity ( UCHAR* node[4], int leaf[4], int depth[4], int maxdep, int dir ) ;
+	void cellProcParity(Node* node, int leaf, int depth);
+	void faceProcParity(Node* node[2], int leaf[2], int depth[2], int maxdep, int dir);
+	void edgeProcParity(Node* node[4], int leaf[4], int depth[4], int maxdep, int dir);
 
-	void processEdgeParity ( UCHAR* node[4], int depths[4], int maxdep, int dir ) ;
+	void processEdgeParity(LeafNode* node[4], int depths[4], int maxdep, int dir);
 
 	/**
 	 * Add triangles to the tree
 	 */
-	void addTrian ( );
-	void addTrian ( Triangle* trian, int triind );
-	UCHAR* addTrian ( UCHAR* node, Projections* p, int height );
+	void addTrian();
+	void addTrian(Triangle* trian, int triind);
+	InternalNode* addTrian(InternalNode* node, Projections* p, int height);
 
 	/**
 	 * Method to update minimizer in a cell: update edge intersections instead
 	 */
-	UCHAR* updateCell( UCHAR* node, Projections* p ) ;
+	LeafNode* updateCell(LeafNode* node, Projections* p);
 
 	/* Routines to detect and patch holes */
-	int numRings ;
-	int totRingLengths ;
-	int maxRingLength ;
+	int numRings;
+	int totRingLengths;
+	int maxRingLength;
 
 	/**
 	 * Entry routine.
 	 */
-	void trace ( ) ;
+	void trace();
 	/**
 	 * Trace the given node, find patches and fill them in
 	 */
-	UCHAR* trace ( UCHAR* node, int* st, int len, int depth, PathList*& paths ) ;
+	Node* trace(Node* node, int* st, int len, int depth, PathList*& paths);
 	/**
 	 * Look for path on the face and add to paths
 	 */
-	void findPaths ( UCHAR* node[2], int leaf[2], int depth[2], int* st[2], int maxdep, int dir, PathList*& paths ) ;
+	void findPaths(Node* node[2], int leaf[2], int depth[2], int* st[2], int maxdep, int dir, PathList*& paths);
 	/**
 	 * Combine two list1 and list2 into list1 using connecting paths list3, 
 	 * while closed paths are appended to rings
 	 */
-	void combinePaths ( PathList*& list1, PathList* list2, PathList* paths, PathList*& rings ) ;
+	void combinePaths(PathList*& list1, PathList* list2, PathList* paths, PathList*& rings);
 	/**
 	 * Helper function: combine current paths in list1 and list2 to a single path and append to list3
 	 */
-	PathList* combineSinglePath ( PathList*& head1, PathList* pre1, PathList*& list1, PathList*& head2, PathList* pre2, PathList*& list2 ) ;
+	PathList* combineSinglePath(PathList*& head1, PathList* pre1, PathList*& list1, PathList*& head2, PathList* pre2, PathList*& list2);
 	
 	/**
 	 * Functions to patch rings in a node
 	 */
-	UCHAR* patch ( UCHAR* node, int st[3], int len, PathList* rings ) ;
-	UCHAR* patchSplit ( UCHAR* node, int st[3], int len, PathList* rings, int dir, PathList*& nrings1, PathList*& nrings2 ) ;
-	UCHAR* patchSplitSingle ( UCHAR* node, int st[3], int len, PathElement* head, int dir, PathList*& nrings1, PathList*& nrings2 ) ;
-	UCHAR* connectFace ( UCHAR* node, int st[3], int len, int dir, PathElement* f1, PathElement* f2 ) ;
-	UCHAR* locateCell( UCHAR* node, int st[3], int len, int ori[3], int dir, int side, UCHAR*& rleaf, int rst[3], int& rlen ) ;
-	void compressRing ( PathElement*& ring ) ;
-	void getFacePoint( PathElement* leaf, int dir, int& x, int& y, float& p, float& q ) ;
-	UCHAR* patchAdjacent( UCHAR* node, int len, int st1[3], UCHAR* leaf1, int st2[3], UCHAR* leaf2, int walkdir, int inc, int dir, int side, float alpha ) ;
-	int findPair ( PathElement* head, int pos, int dir, PathElement*& pre1, PathElement*& pre2 ) ;
-	int getSide( PathElement* e, int pos, int dir ) ;
-	int isEqual( PathElement* e1, PathElement* e2 )	;
-	void preparePrimalEdgesMask( UCHAR* node ) ;
-	void testFacePoint( PathElement* e1, PathElement* e2 ) ;
+	Node* patch(Node* node, int st[3], int len, PathList* rings);
+	Node* patchSplit(Node* node, int st[3], int len, PathList* rings, int dir, PathList*& nrings1, PathList*& nrings2);
+	Node* patchSplitSingle(Node* node, int st[3], int len, PathElement* head, int dir, PathList*& nrings1, PathList*& nrings2);
+	Node* connectFace(Node* node, int st[3], int len, int dir, PathElement* f1, PathElement* f2);
+	Node* locateCell(InternalNode* node, int st[3], int len, int ori[3], int dir, int side, Node*& rleaf, int rst[3], int& rlen);
+	void compressRing(PathElement*& ring);
+	void getFacePoint(PathElement* leaf, int dir, int& x, int& y, float& p, float& q);
+	LeafNode* patchAdjacent(InternalNode* node, int len, int st1[3], LeafNode* leaf1, int st2[3], LeafNode* leaf2, int walkdir, int inc, int dir, int side, float alpha);
+	int findPair(PathElement* head, int pos, int dir, PathElement*& pre1, PathElement*& pre2);
+	int getSide(PathElement* e, int pos, int dir);
+	int isEqual(PathElement* e1, PathElement* e2)	;
+	void preparePrimalEdgesMask(InternalNode* node);
+	void testFacePoint(PathElement* e1, PathElement* e2);
 	
 	/**
 	 * Path-related functions
 	 */
-	void deletePath ( PathList*& head, PathList* pre, PathList*& curr ) ;
-	void printPath( PathList* path ) ;
-	void printPath( PathElement* path ) ;
-	void printElement( PathElement* ele ) ;
-	void printPaths( PathList* path ) ;
-	void checkElement ( PathElement* ele ) ;
-	void checkPath( PathElement* path ) ;
+	void deletePath(PathList*& head, PathList* pre, PathList*& curr);
+	void printPath(PathList* path);
+	void printPath(PathElement* path);
+	void printElement(PathElement* ele);
+	void printPaths(PathList* path);
+	void checkElement(PathElement* ele);
+	void checkPath(PathElement* path);
 
 
 	/**
 	 * Routines to build signs to create a partitioned volume
-	 * (after patching rings)
+	 *(after patching rings)
 	 */
-	void buildSigns( ) ;
-	void buildSigns( unsigned char table[], UCHAR* node, int isLeaf, int sg, int rvalue[8] ) ;
+	void buildSigns();
+	void buildSigns(unsigned char table[], Node* node, int isLeaf, int sg, int rvalue[8]);
 
 	/************************************************************************/
 	/* To remove disconnected components */
 	/************************************************************************/
-	void floodFill( ) ;
-	void clearProcessBits( UCHAR* node, int height ) ;
-	int floodFill( UCHAR* node, int st[3], int len, int height, int threshold ) ;
+	void floodFill();
+	void clearProcessBits(Node* node, int height);
+	int floodFill(LeafNode* leaf, int st[3], int len, int height, int threshold);
+	int floodFill(Node* node, int st[3], int len, int height, int threshold);
 
 	/**
 	 * Write out polygon file
 	 */
 	void writeOut();
-	void writeOFF ( char* fname ) ;
-	void writePLY ( char* fname ) ;
-	void writeOpenEdges( FILE* fout ) ;
-	void writeAllEdges( FILE* fout, int mode ) ;
-	void writeAllEdges( FILE* fout, UCHAR* node, int height, int st[3], int len, int mode ) ;
 	
-	void writeOctree( char* fname ) ;
-	void writeOctree( FILE* fout, UCHAR* node, int depth ) ;
-#ifdef USE_HERMIT
-	void writeOctreeGeom( char* fname ) ;
-	void writeOctreeGeom( FILE* fout, UCHAR* node, int st[3], int len, int depth ) ;
-#endif
-#ifdef USE_HERMIT
-	void writeDCF ( char* fname ) ;
-	void writeDCF ( FILE* fout, UCHAR* node, int height, int st[3], int len ) ;
-	void countEdges ( UCHAR* node, int height, int& nedge, int mode ) ;
-	void countIntersection( UCHAR* node, int height, int& nedge, int& ncell, int& nface ) ;
-	void generateMinimizer( UCHAR* node, int st[3], int len, int height, int& offset ) ;
-	void computeMinimizer( UCHAR* leaf, int st[3], int len, float rvalue[3] ) ;
+	void countIntersection(Node* node, int height, int& nedge, int& ncell, int& nface);
+	void generateMinimizer(Node* node, int st[3], int len, int height, int& offset);
+	void computeMinimizer(LeafNode* leaf, int st[3], int len, float rvalue[3]);
 	/**
 	 * Traversal functions to generate polygon model
 	 * op: 0 for counting, 1 for writing OBJ, 2 for writing OFF, 3 for writing PLY
 	 */
-	void cellProcContour ( UCHAR* node, int leaf, int depth ) ;
-	void faceProcContour ( UCHAR* node[2], int leaf[2], int depth[2], int maxdep, int dir ) ;
-	void edgeProcContour ( UCHAR* node[4], int leaf[4], int depth[4], int maxdep, int dir ) ;
-	void processEdgeWrite ( UCHAR* node[4], int depths[4], int maxdep, int dir ) ;
-#else
-	void countIntersection( UCHAR* node, int height, int& nquad, int& nvert ) ;
-	void writeVertex( UCHAR* node, int st[3], int len, int height, int& offset, FILE* fout ) ;
-	void writeQuad( UCHAR* node, int st[3], int len, int height, FILE* fout ) ;
-#endif
-
-	/**
-	 * Write out original model
-	 */
-	void writeModel( char* fname ) ;
-
-	/************************************************************************/
-	/* Write out original vertex tags */
-	/************************************************************************/
-#ifdef CINDY
-	void writeTags( char* fname ) ;
-	void readVertices( ) ;
-	void readVertex(  UCHAR* node, int st[3], int len, int height, float v[3], int index ) ;
-    void outputTags( UCHAR* node, int height, FILE* fout ) ;
-	void clearCindyBits( UCHAR* node, int height ) ;
-#endif
+	void cellProcContour(Node* node, int leaf, int depth);
+	void faceProcContour(Node* node[2], int leaf[2], int depth[2], int maxdep, int dir);
+	void edgeProcContour(Node* node[4], int leaf[4], int depth[4], int maxdep, int dir);
+	void processEdgeWrite(Node* node[4], int depths[4], int maxdep, int dir);
 
 	/* output callbacks/data */
 	DualConAllocOutput alloc_output;
@@ -394,858 +358,753 @@ private:
 private:
 	/************ Operators for all nodes ************/
 
-	/**
-	 * Bits order
-	 *
-	 * Leaf node:
-	 * Byte 0,1 (0-11): edge parity
-	 * Byte 1 (4,5,6): mask of primary edges intersections stored
-	 * Byte 1 (7): in flood fill mode, whether the cell is in process
-	 * Byte 2 (0-8): signs
-	 * Byte 3 (or 5) -- : edge intersections ( 4 bytes per inter, or 12 bytes if USE_HERMIT )
-	 * Byte 3,4: in coloring mode, the mask for edges
-	 *
-	 * Internal node:
-	 * Byte 0: child mask
-	 * Byte 1: leaf child mask
-	 */
-
 	/// Lookup table
-	int numChildrenTable[ 256 ] ;
-	int childrenCountTable[ 256 ][ 8 ] ;
-	int childrenIndexTable[ 256 ][ 8 ] ;
-	int numEdgeTable[ 8 ] ;
-	int edgeCountTable[ 8 ][ 3 ] ;
+	int numChildrenTable[256];
+	int childrenCountTable[256][8];
+	int childrenIndexTable[256][8];
+	int numEdgeTable[8];
+	int edgeCountTable[8][3];
 
 	/// Build up lookup table
-	void buildTable ( )
+	void buildTable()
 	{
-		for ( int i = 0 ; i < 256 ; i ++ )
+		for(int i = 0; i < 256; i ++)
 		{
-			numChildrenTable[ i ] = 0 ;
-			int count = 0 ;
-			for ( int j = 0 ; j < 8 ; j ++ )
+			numChildrenTable[i] = 0;
+			int count = 0;
+			for(int j = 0; j < 8; j ++)
 			{
-				numChildrenTable[ i ] += ( ( i >> j ) & 1 ) ;
-				childrenCountTable[ i ][ j ] = count ;
-				childrenIndexTable[ i ][ count ] = j ;
-				count += ( ( i >> j ) & 1 ) ;
+				numChildrenTable[i] +=((i >> j) & 1);
+				childrenCountTable[i][j] = count;
+				childrenIndexTable[i][count] = j;
+				count +=((i >> j) & 1);
 			}
 		}
 
-		for ( int i = 0 ; i < 8 ; i ++ )
+		for(int i = 0; i < 8; i ++)
 		{
-			numEdgeTable[ i ] = 0 ;
-			int count = 0 ;
-			for ( int j = 0 ; j < 3 ; j ++ )
+			numEdgeTable[i] = 0;
+			int count = 0;
+			for(int j = 0; j < 3; j ++)
 			{
-				numEdgeTable[ i ] += ( ( i >> j ) & 1 ) ;
-				edgeCountTable[ i ][ j ] = count ;
-				count += ( ( i >> j ) & 1 ) ;
+				numEdgeTable[i] +=((i >> j) & 1);
+				edgeCountTable[i][j] = count;
+				count +=((i >> j) & 1);
 			}
 		}
-	};
+	}
 
-	int getSign( UCHAR* node, int height, int index )
+	int getSign(Node* node, int height, int index)
 	{
-		if ( height == 0 )
+		if(height == 0)
 		{
-			return getSign( node, index ) ;
+			return getSign(&node->leaf, index);
 		}
 		else
 		{
-			if ( hasChild( node, index ) )
+			if(hasChild(&node->internal, index))
 			{
-				return getSign( getChild( node, getChildCount( node, index ) ), height - 1, index ) ;
+				return getSign(getChild(&node->internal, getChildCount(&node->internal, index)),
+							   height - 1,
+							   index);
 			}
 			else
 			{
-				return getSign( getChild( node, 0 ), height - 1, 7 - getChildIndex( node, 0 ) ) ;
+				return getSign(getChild(&node->internal, 0),
+							   height - 1,
+							   7 - getChildIndex(&node->internal, 0));
 			}
 		}
 	}
 
 	/************ Operators for leaf nodes ************/
 
-	void printInfo( int st[3] )
+	void printInfo(int st[3])
 	{
-		printf("INFO AT: %d %d %d\n", st[0] >> minshift, st[1] >>minshift, st[2] >> minshift ) ;
-		UCHAR* leaf = locateLeafCheck( st ) ;
-		if ( leaf == NULL )
-		{
-			printf("Leaf not exists!\n") ;
-		}
+		printf("INFO AT: %d %d %d\n", st[0] >> minshift, st[1] >>minshift, st[2] >> minshift);
+		LeafNode* leaf = (LeafNode*)locateLeafCheck(st);
+		if(leaf)
+			printInfo(leaf);
 		else
-		{
-			printInfo( leaf ) ;
-		}
+			printf("Leaf not exists!\n");
 	}
 
-	void printInfo( UCHAR* leaf )
+	void printInfo(const LeafNode* leaf)
 	{
 		/*
-		printf("Edge mask: ") ;
-		for ( int i = 0 ; i < 12 ; i ++ )
+		printf("Edge mask: ");
+		for(int i = 0; i < 12; i ++)
 		{
-			printf("%d ", getEdgeParity( leaf, i ) ) ;
+			printf("%d ", getEdgeParity(leaf, i));
 		}
-		printf("\n") ;
-		printf("Stored edge mask: ") ;
-		for ( i = 0 ; i < 3 ; i ++ )
+		printf("\n");
+		printf("Stored edge mask: ");
+		for(i = 0; i < 3; i ++)
 		{
-			printf("%d ", getStoredEdgesParity( leaf, i ) ) ;
+			printf("%d ", getStoredEdgesParity(leaf, i));
 		}
-		printf("\n") ;
+		printf("\n");
 		*/
-		printf("Sign mask: ") ;
-		for ( int i = 0 ; i < 8 ; i ++ )
+		printf("Sign mask: ");
+		for(int i = 0; i < 8; i ++)
 		{
-			printf("%d ", getSign( leaf, i ) ) ;
+			printf("%d ", getSign(leaf, i));
 		}
-		printf("\n") ;
+		printf("\n");
 
 	}
 
 	/// Retrieve signs
-	int getSign ( UCHAR* leaf, int index )
+	int getSign(const LeafNode* leaf, int index)
 	{
-		return (( leaf[2] >> index ) & 1 );		
-	};
+		return ((leaf->signs >> index) & 1);		
+	}
 
 	/// Set sign
-	void setSign ( UCHAR* leaf, int index ) 
+	void setSign(LeafNode* leaf, int index) 
 	{
-		leaf[2] |= ( 1 << index ) ;
-	};
+		leaf->signs |= (1 << index);
+	}
 
-	void setSign ( UCHAR* leaf, int index, int sign ) 
+	void setSign(LeafNode* leaf, int index, int sign) 
 	{
-		leaf[2] &= ( ~ ( 1 << index ) ) ;
-		leaf[2] |= ( ( sign & 1 ) << index ) ;
-	};
+		leaf->signs &= (~(1 << index));
+		leaf->signs |= ((sign & 1) << index);
+	}
 
-	int getSignMask( UCHAR* leaf )
+	int getSignMask(const LeafNode* leaf)
 	{
-		return leaf[2] ;
+		return leaf->signs;
 	}
 
-	void setInProcessAll( int st[3], int dir )
+	void setInProcessAll(int st[3], int dir)
 	{
-		int nst[3], eind ;
-		for ( int i = 0 ; i < 4 ; i ++ )
+		int nst[3], eind;
+		for(int i = 0; i < 4; i ++)
 		{
-			nst[0] = st[0] + dirCell[dir][i][0] * mindimen ;
-			nst[1] = st[1] + dirCell[dir][i][1] * mindimen ;
-			nst[2] = st[2] + dirCell[dir][i][2] * mindimen ;
-			eind = dirEdge[dir][i] ;
+			nst[0] = st[0] + dirCell[dir][i][0] * mindimen;
+			nst[1] = st[1] + dirCell[dir][i][1] * mindimen;
+			nst[2] = st[2] + dirCell[dir][i][2] * mindimen;
+			eind = dirEdge[dir][i];
 
-			UCHAR* cell = locateLeafCheck( nst ) ;
-			if ( cell == NULL )
-			{
-				printf("Wrong!\n") ;
-			}
-			setInProcess( cell, eind ) ;
+			LeafNode* cell = locateLeafCheck(nst);
+			assert(cell);
+
+			setInProcess(cell, eind);
 		}
 	}
 
-	void flipParityAll( int st[3], int dir )
+	void flipParityAll(int st[3], int dir)
 	{
-		int nst[3], eind ;
-		for ( int i = 0 ; i < 4 ; i ++ )
+		int nst[3], eind;
+		for(int i = 0; i < 4; i ++)
 		{
-			nst[0] = st[0] + dirCell[dir][i][0] * mindimen ;
-			nst[1] = st[1] + dirCell[dir][i][1] * mindimen ;
-			nst[2] = st[2] + dirCell[dir][i][2] * mindimen ;
-			eind = dirEdge[dir][i] ;
+			nst[0] = st[0] + dirCell[dir][i][0] * mindimen;
+			nst[1] = st[1] + dirCell[dir][i][1] * mindimen;
+			nst[2] = st[2] + dirCell[dir][i][2] * mindimen;
+			eind = dirEdge[dir][i];
 
-			UCHAR* cell = locateLeaf( nst ) ;
-			flipEdge( cell, eind ) ;
+			LeafNode* cell = locateLeaf(nst);
+			flipEdge(cell, eind);
 		}
 	}
 
-	void setInProcess( UCHAR* leaf, int eind )
-	{
-		// leaf[1] |= ( 1 << 7 ) ;
-		( (USHORT*) (leaf + leaf_node_bytes - (flood_bytes + CINDY_BYTES)))[0] |= ( 1 << eind ) ;
-	}
-	void setOutProcess( UCHAR* leaf, int eind )
-	{
-		// leaf[1] &= ( ~ ( 1 << 7 ) ) ;
-		( (USHORT*) (leaf + leaf_node_bytes - (flood_bytes + CINDY_BYTES)))[0] &= ( ~ ( 1 << eind ) ) ;
-	}
-
-	int isInProcess( UCHAR* leaf, int eind )
+	void setInProcess(LeafNode* leaf, int eind)
 	{
-		//int a = ( ( leaf[1] >> 7 ) & 1 ) ;
-		int a = ( ( ( (USHORT*) (leaf + leaf_node_bytes - (flood_bytes + CINDY_BYTES)))[0] >> eind ) & 1 ) ;
-		return a ;
-	}
+		assert(eind >= 0 && eind <= 11);
 
-#ifndef USE_HERMIT
-	/// Set minimizer index
-	void setEdgeIntersectionIndex( UCHAR* leaf, int count, int index )
-	{
-		((int *)( leaf + leaf_node_bytes ))[ count ] = index ;
+		leaf->flood_fill |= (1 << eind);
 	}
-
-	/// Get minimizer index
-	int getEdgeIntersectionIndex( UCHAR* leaf, int count )
+	
+	void setOutProcess(LeafNode* leaf, int eind)
 	{
-		return 	((int *)( leaf + leaf_node_bytes ))[ count ] ;
+		assert(eind >= 0 && eind <= 11);
+		
+		leaf->flood_fill &= ~(1 << eind);
 	}
 
-	/// Get all intersection indices associated with a cell
-	void fillEdgeIntersectionIndices( UCHAR* leaf, int st[3], int len, int inds[12] )
+	int isInProcess(LeafNode* leaf, int eind)
 	{
-		int i ;
-
-		// The three primal edges are easy
-		int pmask[3] = { 0, 4, 8 } ;
-		for ( i = 0 ; i < 3 ; i ++ )
-		{
-			if ( getEdgeParity( leaf, pmask[i] ) )
-			{
-				inds[pmask[i]] = getEdgeIntersectionIndex( leaf, getEdgeCount( leaf, i ) ) ;
-			}
-		}
+		assert(eind >= 0 && eind <= 11);
 		
-		// 3 face adjacent cubes
-		int fmask[3][2] = {{6,10},{2,9},{1,5}} ;
-		int femask[3][2] = {{1,2},{0,2},{0,1}} ;
-		for ( i = 0 ; i < 3 ; i ++ )
-		{
-			int e1 = getEdgeParity( leaf, fmask[i][0] ) ;
-			int e2 = getEdgeParity( leaf, fmask[i][1] ) ;
-			if ( e1 || e2 )
-			{
-				int nst[3] = {st[0], st[1], st[2]} ;
-				nst[ i ] += len ;
-				// int nstt[3] = {0, 0, 0} ;
-				// nstt[ i ] += 1 ;
-				UCHAR* node = locateLeaf( nst ) ;
-				
-				if ( e1 )
-				{
-					inds[ fmask[i][0] ] = getEdgeIntersectionIndex( node, getEdgeCount( node, femask[i][0] ) ) ;
-				}
-				if ( e2 )
-				{
-					inds[ fmask[i][1] ] = getEdgeIntersectionIndex( node, getEdgeCount( node, femask[i][1] ) ) ;
-				}
-			}
-		}
-		
-		// 3 edge adjacent cubes
-		int emask[3] = {3, 7, 11} ;
-		int eemask[3] = {0, 1, 2} ;
-		for ( i = 0 ; i < 3 ; i ++ )
-		{
-			if ( getEdgeParity( leaf, emask[i] ) )
-			{
-				int nst[3] = {st[0] + len, st[1] + len, st[2] + len} ;
-				nst[ i ] -= len ;
-				// int nstt[3] = {1, 1, 1} ;
-				// nstt[ i ] -= 1 ;
-				UCHAR* node = locateLeaf( nst ) ;
-				
-				inds[ emask[i] ] = getEdgeIntersectionIndex( node, getEdgeCount( node, eemask[i] ) ) ;
-			}
-		}
+		return (leaf->flood_fill >> eind) & 1;
 	}
 
-
-#endif
-	
 	/// Generate signs at the corners from the edge parity
-	void generateSigns ( UCHAR* leaf, UCHAR table[], int start )
+	void generateSigns(LeafNode* leaf, unsigned char table[], int start)
 	{
-		leaf[2] = table[ ( ((USHORT *) leaf)[ 0 ] ) & ( ( 1 << 12 ) - 1 ) ] ; 
+		leaf->signs = table[leaf->edge_parity]; 
 
-		if ( ( start ^ leaf[2] ) & 1 ) 
+		if((start ^ leaf->signs) & 1)
 		{
-			leaf[2] = ~ ( leaf[2] ) ;
+			leaf->signs = ~(leaf->signs);
 		}
 	}
 
 	/// Get edge parity
-	int getEdgeParity( UCHAR* leaf, int index ) 
+	int getEdgeParity(LeafNode* leaf, int index) 
 	{
-		int a = ( ( ((USHORT *) leaf)[ 0 ] >> index ) & 1 ) ;
-		return 	a ;
-	};
+		assert(index >= 0 && index <= 11);
+		
+		return (leaf->edge_parity >> index) & 1;
+	}
 
 	/// Get edge parity on a face
-	int getFaceParity ( UCHAR* leaf, int index )
+	int getFaceParity(LeafNode* leaf, int index)
 	{
-		int a = getEdgeParity( leaf, faceMap[ index ][ 0 ] ) + 
-				getEdgeParity( leaf, faceMap[ index ][ 1 ] ) + 
-				getEdgeParity( leaf, faceMap[ index ][ 2 ] ) + 
-				getEdgeParity( leaf, faceMap[ index ][ 3 ] ) ;
-		return ( a & 1 ) ;
+		int a = getEdgeParity(leaf, faceMap[index][0]) + 
+				getEdgeParity(leaf, faceMap[index][1]) + 
+				getEdgeParity(leaf, faceMap[index][2]) + 
+				getEdgeParity(leaf, faceMap[index][3]);
+		return (a & 1);
 	}
-	int getFaceEdgeNum ( UCHAR* leaf, int index )
+	int getFaceEdgeNum(LeafNode* leaf, int index)
 	{
-		int a = getEdgeParity( leaf, faceMap[ index ][ 0 ] ) + 
-				getEdgeParity( leaf, faceMap[ index ][ 1 ] ) + 
-				getEdgeParity( leaf, faceMap[ index ][ 2 ] ) + 
-				getEdgeParity( leaf, faceMap[ index ][ 3 ] ) ;
-		return a ;
+		int a = getEdgeParity(leaf, faceMap[index][0]) + 
+				getEdgeParity(leaf, faceMap[index][1]) + 
+				getEdgeParity(leaf, faceMap[index][2]) + 
+				getEdgeParity(leaf, faceMap[index][3]);
+		return a;
 	}
 
 	/// Set edge parity
-	void flipEdge( UCHAR* leaf, int index ) 
+	void flipEdge(LeafNode* leaf, int index) 
 	{
-		((USHORT *) leaf)[ 0 ] ^= ( 1 << index ) ;	
-	};
+		assert(index >= 0 && index <= 11);
+
+		leaf->edge_parity ^= (1 << index);
+	}
+	
 	/// Set 1
-	void setEdge( UCHAR* leaf, int index ) 
+	void setEdge(LeafNode* leaf, int index) 
 	{
-		((USHORT *) leaf)[ 0 ] |= ( 1 << index ) ;	
-	};
+		assert(index >= 0 && index <= 11);
+
+		leaf->edge_parity |= (1 << index);
+	}
+	
 	/// Set 0
-	void resetEdge( UCHAR* leaf, int index ) 
+	void resetEdge(LeafNode* leaf, int index) 
 	{
-		((USHORT *) leaf)[ 0 ] &= ( ~ ( 1 << index ) ) ;	
-	};
+		assert(index >= 0 && index <= 11);
+
+		leaf->edge_parity &= ~(1 << index);
+	}
 
 	/// Flipping with a new intersection offset
-	void createPrimalEdgesMask( UCHAR* leaf )
+	void createPrimalEdgesMask(LeafNode* leaf)
 	{
-		int mask = (( leaf[0] & 1 ) | ( (leaf[0] >> 3) & 2 ) | ( (leaf[1] & 1) << 2 ) ) ;
-		leaf[1] |= ( mask << 4 ) ;
-
+		leaf->primary_edge_intersections = getPrimalEdgesMask2(leaf);
 	}
 
-	void setStoredEdgesParity( UCHAR* leaf, int pindex )
+	void setStoredEdgesParity(LeafNode* leaf, int pindex)
 	{
-		leaf[1] |= ( 1 << ( 4 + pindex ) ) ;
+		assert(pindex <= 2 && pindex >= 0);
+		
+		leaf->primary_edge_intersections |= (1 << pindex);
 	}
-	int getStoredEdgesParity( UCHAR* leaf, int pindex )
+	int getStoredEdgesParity(LeafNode* leaf, int pindex)
 	{
-		return ( ( leaf[1] >> ( 4 + pindex ) ) & 1 ) ;
+		assert(pindex <= 2 && pindex >= 0);
+		
+		return (leaf->primary_edge_intersections >> pindex) & 1;
 	}
 
-	UCHAR* flipEdge( UCHAR* leaf, int index, float alpha ) 
+	LeafNode* flipEdge(LeafNode* leaf, int index, float alpha)
 	{
-		flipEdge( leaf, index ) ;
+		flipEdge(leaf, index);
 
-		if ( ( index & 3 ) == 0 )
+		if((index & 3) == 0)
 		{
-			int ind = index / 4 ;
-			if ( getEdgeParity( leaf, index ) && ! getStoredEdgesParity( leaf, ind ) )
+			int ind = index / 4;
+			if(getEdgeParity(leaf, index) && ! getStoredEdgesParity(leaf, ind))
 			{
 				// Create a new node
-				int num = getNumEdges( leaf ) + 1 ;
-				setStoredEdgesParity( leaf, ind ) ;
-				int count = getEdgeCount( leaf, ind ) ;
-				UCHAR* nleaf = createLeaf( num ) ;
-				for ( int i = 0 ; i < leaf_node_bytes ; i ++ )
-				{
-					nleaf[i] = leaf[i] ;
-				}
+				int num = getNumEdges(leaf) + 1;
+				setStoredEdgesParity(leaf, ind);
+				int count = getEdgeCount(leaf, ind);
+				LeafNode* nleaf = createLeaf(num);
+				*nleaf = *leaf;
 
-				setEdgeOffset( nleaf, alpha, count ) ;
+				setEdgeOffset(nleaf, alpha, count);
 
-				if ( num > 1 )
+				if(num > 1)
 				{
-					float * pts = ( float * ) ( leaf + leaf_node_bytes ) ;
-					float * npts = ( float * ) ( nleaf + leaf_node_bytes ) ;
-					for ( int i = 0 ; i < count ; i ++ )
+					float *pts = leaf->edge_intersections;
+					float *npts = nleaf->edge_intersections;
+					for(int i = 0; i < count; i ++)
 					{
-						for ( int j = 0 ; j < EDGE_FLOATS ; j ++ )
+						for(int j = 0; j < EDGE_FLOATS; j ++)
 						{
-							npts[i * EDGE_FLOATS + j] = pts[i * EDGE_FLOATS + j] ;
+							npts[i * EDGE_FLOATS + j] = pts[i * EDGE_FLOATS + j];
 						}
 					}
-					for ( int i = count + 1 ; i < num ; i ++ )
+					for(int i = count + 1; i < num; i ++)
 					{
-						for ( int j = 0 ; j < EDGE_FLOATS ; j ++ )
+						for(int j = 0; j < EDGE_FLOATS; j ++)
 						{
-							npts[i * EDGE_FLOATS + j] = pts[ (i - 1) * EDGE_FLOATS + j] ;
+							npts[i * EDGE_FLOATS + j] = pts[(i - 1) * EDGE_FLOATS + j];
 						}
 					}
 				}
 
 				
-				removeLeaf( num-1, leaf ) ;
-				leaf = nleaf ;
+				removeLeaf(num-1, (LeafNode*)leaf);
+				leaf = nleaf;
 			}
 		}
 
-		return leaf ;
-	};
+		return leaf;
+	}
 
 	/// Update parent link
-	void updateParent( UCHAR* node, int len, int st[3], UCHAR* leaf ) 
+	void updateParent(InternalNode* node, int len, int st[3], LeafNode* leaf)
 	{
 		// First, locate the parent
-		int count ;
-		UCHAR* parent = locateParent( node, len, st, count ) ;
+		int count;
+		InternalNode* parent = locateParent(node, len, st, count);
 
-		// UPdate
-		setChild( parent, count, leaf ) ;
+		// Update
+		setChild(parent, count, (Node*)leaf);
 	}
 
-	void updateParent( UCHAR* node, int len, int st[3] ) 
+	void updateParent(InternalNode* node, int len, int st[3]) 
 	{
-		if ( len == dimen )
+		if(len == dimen)
 		{
-			root = node ;
-			return ;
+			root = (Node*)node;
+			return;
 		}
 
 		// First, locate the parent
-		int count ;
-		UCHAR* parent = locateParent( len, st, count ) ;
+		int count;
+		InternalNode* parent = locateParent(len, st, count);
 
 		// UPdate
-		setChild( parent, count, node ) ;
+		setChild(parent, count, (Node*)node);
 	}
 
 	/// Find edge intersection on a given edge
-	int getEdgeIntersectionByIndex( int st[3], int index, float pt[3], int check )
+	int getEdgeIntersectionByIndex(int st[3], int index, float pt[3], int check)
 	{
 		// First, locat the leaf
-		UCHAR* leaf ;
-		if ( check )
+		LeafNode* leaf;
+		if(check)
 		{
-			leaf = locateLeafCheck( st ) ;
+			leaf = locateLeafCheck(st);
 		}
 		else
 		{
-			leaf = locateLeaf( st ) ;
+			leaf = locateLeaf(st);
 		}
 
-		if ( leaf && getStoredEdgesParity( leaf, index ) )
+		if(leaf && getStoredEdgesParity(leaf, index))
 		{
-			float off = getEdgeOffset( leaf, getEdgeCount( leaf, index ) ) ;
-			pt[0] = (float) st[0] ;
-			pt[1] = (float) st[1] ;
-			pt[2] = (float) st[2] ;
-			pt[index] += off * mindimen ;
+			float off = getEdgeOffset(leaf, getEdgeCount(leaf, index));
+			pt[0] =(float) st[0];
+			pt[1] =(float) st[1];
+			pt[2] =(float) st[2];
+			pt[index] += off * mindimen;
 
-			return 1 ;
+			return 1;
 		}
 		else
 		{
-			return 0 ;
+			return 0;
 		}
 	}
 
 	/// Retrieve number of edges intersected
-	int getPrimalEdgesMask( UCHAR* leaf )
+	int getPrimalEdgesMask(LeafNode* leaf)
 	{
-		// return (( leaf[0] & 1 ) | ( (leaf[0] >> 3) & 2 ) | ( (leaf[1] & 1) << 2 ) ) ;
-		return ( ( leaf[1] >> 4 ) & 7 ) ;
+		return leaf->primary_edge_intersections;
 	}
 
-	int getPrimalEdgesMask2( UCHAR* leaf )
+	int getPrimalEdgesMask2(LeafNode* leaf)
 	{
-		return (( leaf[0] & 1 ) | ( (leaf[0] >> 3) & 2 ) | ( (leaf[1] & 1) << 2 ) ) ;
+		return (((leaf->edge_parity &   0x1) >> 0) |
+				((leaf->edge_parity &  0x10) >> 3) |
+				((leaf->edge_parity & 0x100) >> 6));
 	}
 
 	/// Get the count for a primary edge
-	int getEdgeCount( UCHAR* leaf, int index )
+	int getEdgeCount(LeafNode* leaf, int index)
 	{
-		return edgeCountTable[ getPrimalEdgesMask( leaf ) ][ index ] ;
+		return edgeCountTable[getPrimalEdgesMask(leaf)][index];
 	}
-	int getNumEdges( UCHAR* leaf )
+	int getNumEdges(LeafNode* leaf)
 	{
-		return numEdgeTable[ getPrimalEdgesMask( leaf ) ] ;
+		return numEdgeTable[getPrimalEdgesMask(leaf)];
 	}
 
-	int getNumEdges2( UCHAR* leaf )
+	int getNumEdges2(LeafNode* leaf)
 	{
-		return numEdgeTable[ getPrimalEdgesMask2( leaf ) ] ;
+		return numEdgeTable[getPrimalEdgesMask2(leaf)];
 	}
 
 	/// Set edge intersection
-	void setEdgeOffset( UCHAR* leaf, float pt, int count )
-	{
-		float * pts = ( float * ) ( leaf + leaf_node_bytes ) ;
-#ifdef USE_HERMIT
-		pts[ EDGE_FLOATS * count ] = pt ;
-		pts[ EDGE_FLOATS * count + 1 ] = 0 ;
-		pts[ EDGE_FLOATS * count + 2 ] = 0 ;
-		pts[ EDGE_FLOATS * count + 3 ] = 0 ;
-#else
-		pts[ count ] = pt ;
-#endif
+	void setEdgeOffset(LeafNode* leaf, float pt, int count)
+	{
+		float *pts = leaf->edge_intersections;
+		pts[EDGE_FLOATS * count] = pt;
+		pts[EDGE_FLOATS * count + 1] = 0;
+		pts[EDGE_FLOATS * count + 2] = 0;
+		pts[EDGE_FLOATS * count + 3] = 0;
 	}
 
 	/// Set multiple edge intersections
-	void setEdgeOffsets( UCHAR* leaf, float pt[3], int len )
+	void setEdgeOffsets(LeafNode* leaf, float pt[3], int len)
 	{
-		float * pts = ( float * ) ( leaf + leaf_node_bytes ) ;
-		for ( int i = 0 ; i < len ; i ++ )
+		float * pts = leaf->edge_intersections;
+		for(int i = 0; i < len; i ++)
 		{
-			pts[i] = pt[i] ;
+			pts[i] = pt[i];
 		}
 	}
 
 	/// Retrieve edge intersection
-	float getEdgeOffset( UCHAR* leaf, int count )
+	float getEdgeOffset(LeafNode* leaf, int count)
 	{
-#ifdef USE_HERMIT
-		return (( float * ) ( leaf + leaf_node_bytes ))[ 4 * count ] ;
-#else
-		return (( float * ) ( leaf + leaf_node_bytes ))[ count ] ;
-#endif
+		return leaf->edge_intersections[4 * count];
 	}
 
 	/// Update method
-	UCHAR* updateEdgeOffsets( UCHAR* leaf, int oldlen, int newlen, float offs[3] )
+	LeafNode* updateEdgeOffsets(LeafNode* leaf, int oldlen, int newlen, float offs[3])
 	{
 		// First, create a new leaf node
-		UCHAR* nleaf = createLeaf( newlen ) ;
-		for ( int i = 0 ; i < leaf_node_bytes ; i ++ )
-		{
-			nleaf[i] = leaf[i] ;
-		}
+		LeafNode* nleaf = createLeaf(newlen);
+		*nleaf = *leaf;
 
 		// Next, fill in the offsets
-		setEdgeOffsets( nleaf, offs, newlen ) ;
+		setEdgeOffsets(nleaf, offs, newlen);
 
 		// Finally, delete the old leaf
-		removeLeaf( oldlen, leaf ) ;
+		removeLeaf(oldlen, leaf);
 
-		return nleaf ;
+		return nleaf;
 	}
 
-	/// Set original vertex index
-	void setOriginalIndex( UCHAR* leaf, int index )
-	{
-		((int *)( leaf + leaf_node_bytes ))[ 0 ] = index ;
-	}
-	int getOriginalIndex( UCHAR* leaf )
-	{
-		return 	((int *)( leaf + leaf_node_bytes ))[ 0 ] ;
-	}
-#ifdef USE_HERMIT
 	/// Set minimizer index
-	void setMinimizerIndex( UCHAR* leaf, int index )
+	void setMinimizerIndex(LeafNode* leaf, int index)
 	{
-		((int *)( leaf + leaf_node_bytes - leaf_extra_bytes - 4 ))[ 0 ] = index ;
+		leaf->minimizer_index = index;
 	}
 
 	/// Get minimizer index
-	int getMinimizerIndex( UCHAR* leaf )
+	int getMinimizerIndex(LeafNode* leaf)
 	{
-		return ((int *)( leaf + leaf_node_bytes - leaf_extra_bytes - 4 ))[ 0 ] ;
+		return leaf->minimizer_index;
 	}
 	
-	int getMinimizerIndex( UCHAR* leaf, int eind )
+	int getMinimizerIndex(LeafNode* leaf, int eind)
 	{
-		int add = manifold_table[ getSignMask( leaf ) ].pairs[ eind ][ 0 ] - 1 ;
-		if ( add < 0 )
-		{
-			printf("Manifold components wrong!\n") ;
-		}
-		return ((int *)( leaf + leaf_node_bytes - leaf_extra_bytes - 4 ))[ 0 ] + add ;
+		int add = manifold_table[getSignMask(leaf)].pairs[eind][0] - 1;
+		assert(add >= 0);
+		return leaf->minimizer_index + add;
 	}
 
-	void getMinimizerIndices( UCHAR* leaf, int eind, int inds[2] )
+	void getMinimizerIndices(LeafNode* leaf, int eind, int inds[2])
 	{
-		const int* add = manifold_table[ getSignMask( leaf ) ].pairs[ eind ] ;
-		inds[0] = ((int *)( leaf + leaf_node_bytes - leaf_extra_bytes - 4 ))[ 0 ] + add[0] - 1 ;
-		if ( add[0] == add[1] )
+		const int* add = manifold_table[getSignMask(leaf)].pairs[eind];
+		inds[0] = leaf->minimizer_index + add[0] - 1;
+		if(add[0] == add[1])
 		{
-			inds[1] = -1 ;
+			inds[1] = -1;
 		}
 		else
 		{
-			inds[1] = ((int *)( leaf + leaf_node_bytes - leaf_extra_bytes - 4 ))[ 0 ] + add[1] - 1 ;
+			inds[1] = leaf->minimizer_index + add[1] - 1;
 		}
 	}
 
 
 	/// Set edge intersection
-	void setEdgeOffsetNormal( UCHAR* leaf, float pt, float a, float b, float c, int count )
+	void setEdgeOffsetNormal(LeafNode* leaf, float pt, float a, float b, float c, int count)
 	{
-		float * pts = ( float * ) ( leaf + leaf_node_bytes ) ;
-		pts[ 4 * count ] = pt ;
-		pts[ 4 * count + 1 ] = a ;
-		pts[ 4 * count + 2 ] = b ;
-		pts[ 4 * count + 3 ] = c ;
+		float * pts = leaf->edge_intersections;
+		pts[4 * count] = pt;
+		pts[4 * count + 1] = a;
+		pts[4 * count + 2] = b;
+		pts[4 * count + 3] = c;
 	}
 
-	float getEdgeOffsetNormal( UCHAR* leaf, int count, float& a, float& b, float& c )
+	float getEdgeOffsetNormal(LeafNode* leaf, int count, float& a, float& b, float& c)
 	{
-		float * pts = ( float * ) ( leaf + leaf_node_bytes ) ;
-		a = pts[ 4 * count + 1 ] ;
-		b = pts[ 4 * count + 2 ] ;
-		c = pts[ 4 * count + 3 ] ;
-		return pts[ 4 * count ] ;
+		float * pts = leaf->edge_intersections;
+		a = pts[4 * count + 1];
+		b = pts[4 * count + 2];
+		c = pts[4 * count + 3];
+		return pts[4 * count];
 	}
 
 	/// Set multiple edge intersections
-	void setEdgeOffsetsNormals( UCHAR* leaf, float pt[], float a[], float b[], float c[], int len )
+	void setEdgeOffsetsNormals(LeafNode* leaf, float pt[], float a[], float b[], float c[], int len)
 	{
-		float * pts = ( float * ) ( leaf + leaf_node_bytes ) ;
-		for ( int i = 0 ; i < len ; i ++ )
+		float *pts = leaf->edge_intersections;
+		for(int i = 0; i < len; i ++)
 		{
-			if ( pt[i] > 1 || pt[i] < 0 )
+			if(pt[i] > 1 || pt[i] < 0)
 			{
-				printf("\noffset: %f\n", pt[i]) ;
+				printf("\noffset: %f\n", pt[i]);
 			}
-			pts[ i * 4 ] = pt[i] ;
-			pts[ i * 4 + 1 ] = a[i] ;
-			pts[ i * 4 + 2 ] = b[i] ;
-			pts[ i * 4 + 3 ] = c[i] ;
+			pts[i * 4] = pt[i];
+			pts[i * 4 + 1] = a[i];
+			pts[i * 4 + 2] = b[i];
+			pts[i * 4 + 3] = c[i];
 		}
 	}
 
 	/// Retrieve complete edge intersection
-	void getEdgeIntersectionByIndex( UCHAR* leaf, int index, int st[3], int len, float pt[3], float nm[3] )
+	void getEdgeIntersectionByIndex(LeafNode* leaf, int index, int st[3], int len, float pt[3], float nm[3])
 	{
-		int count = getEdgeCount( leaf, index ) ;
-		float * pts = ( float * ) ( leaf + leaf_node_bytes ) ;
+		int count = getEdgeCount(leaf, index);
+		float *pts = leaf->edge_intersections;
 		
-		float off = pts[ 4 * count ] ;
+		float off = pts[4 * count];
 		
-		pt[0] =  (float) st[0] ;
-		pt[1] =  (float) st[1] ;
-		pt[2] =  (float) st[2] ;
-		pt[ index ] += ( off * len ) ;
-
-		nm[0] = pts[ 4 * count + 1 ] ;
-		nm[1] = pts[ 4 * count + 2 ] ;
-		nm[2] = pts[ 4 * count + 3 ] ;
+		pt[0] = (float) st[0];
+		pt[1] = (float) st[1];
+		pt[2] = (float) st[2];
+		pt[index] +=(off * len);
+
+		nm[0] = pts[4 * count + 1];
+		nm[1] = pts[4 * count + 2];
+		nm[2] = pts[4 * count + 3];
 	}
 
-	float getEdgeOffsetNormalByIndex( UCHAR* leaf, int index, float nm[3] )
+	float getEdgeOffsetNormalByIndex(LeafNode* leaf, int index, float nm[3])
 	{
-		int count = getEdgeCount( leaf, index ) ;
-		float * pts = ( float * ) ( leaf + leaf_node_bytes ) ;
+		int count = getEdgeCount(leaf, index);
+		float *pts = leaf->edge_intersections;
 		
-		float off = pts[ 4 * count ] ;
+		float off = pts[4 * count];
 		
-		nm[0] = pts[ 4 * count + 1 ] ;
-		nm[1] = pts[ 4 * count + 2 ] ;
-		nm[2] = pts[ 4 * count + 3 ] ;
+		nm[0] = pts[4 * count + 1];
+		nm[1] = pts[4 * count + 2];
+		nm[2] = pts[4 * count + 3];
 
-		return off ;
+		return off;
 	}
 
-	void fillEdgeIntersections( UCHAR* leaf, int st[3], int len, float pts[12][3], float norms[12][3] )
+	void fillEdgeIntersections(LeafNode* leaf, int st[3], int len, float pts[12][3], float norms[12][3])
 	{
-		int i ;
-		// int stt[3] = { 0, 0, 0 } ;
+		int i;
+		// int stt[3] = {0, 0, 0};
 
 		// The three primal edges are easy
-		int pmask[3] = { 0, 4, 8 } ;
-		for ( i = 0 ; i < 3 ; i ++ )
+		int pmask[3] = {0, 4, 8};
+		for(i = 0; i < 3; i ++)
 		{
-			if ( getEdgeParity( leaf, pmask[i] ) )
+			if(getEdgeParity(leaf, pmask[i]))
 			{
-				// getEdgeIntersectionByIndex( leaf, i, stt, 1, pts[ pmask[i] ], norms[ pmask[i] ] ) ;
-				getEdgeIntersectionByIndex( leaf, i, st, len, pts[ pmask[i] ], norms[ pmask[i] ] ) ;
+				// getEdgeIntersectionByIndex(leaf, i, stt, 1, pts[pmask[i]], norms[pmask[i]]);
+				getEdgeIntersectionByIndex(leaf, i, st, len, pts[pmask[i]], norms[pmask[i]]);
 			}
 		}
 		
 		// 3 face adjacent cubes
-		int fmask[3][2] = {{6,10},{2,9},{1,5}} ;
-		int femask[3][2] = {{1,2},{0,2},{0,1}} ;
-		for ( i = 0 ; i < 3 ; i ++ )
+		int fmask[3][2] = {{6,10},{2,9},{1,5}};
+		int femask[3][2] = {{1,2},{0,2},{0,1}};
+		for(i = 0; i < 3; i ++)
 		{
-			int e1 = getEdgeParity( leaf, fmask[i][0] ) ;
-			int e2 = getEdgeParity( leaf, fmask[i][1] ) ;
-			if ( e1 || e2 )
+			int e1 = getEdgeParity(leaf, fmask[i][0]);
+			int e2 = getEdgeParity(leaf, fmask[i][1]);
+			if(e1 || e2)
 			{
-				int nst[3] = {st[0], st[1], st[2]} ;
-				nst[ i ] += len ;
-				// int nstt[3] = {0, 0, 0} ;
-				// nstt[ i ] += 1 ;
-				UCHAR* node = locateLeaf( nst ) ;
+				int nst[3] = {st[0], st[1], st[2]};
+				nst[i] += len;
+				// int nstt[3] = {0, 0, 0};
+				// nstt[i] += 1;
+				LeafNode* node = locateLeaf(nst);
 				
-				if ( e1 )
+				if(e1)
 				{
-					// getEdgeIntersectionByIndex( node, femask[i][0], nstt, 1, pts[ fmask[i][0] ], norms[ fmask[i][0] ] ) ;
-					getEdgeIntersectionByIndex( node, femask[i][0], nst, len, pts[ fmask[i][0] ], norms[ fmask[i][0] ] ) ;
+					// getEdgeIntersectionByIndex(node, femask[i][0], nstt, 1, pts[fmask[i][0]], norms[fmask[i][0]]);
+					getEdgeIntersectionByIndex(node, femask[i][0], nst, len, pts[fmask[i][0]], norms[fmask[i][0]]);
 				}
-				if ( e2 )
+				if(e2)
 				{
-					// getEdgeIntersectionByIndex( node, femask[i][1], nstt, 1, pts[ fmask[i][1] ], norms[ fmask[i][1] ] ) ;
-					getEdgeIntersectionByIndex( node, femask[i][1], nst, len, pts[ fmask[i][1] ], norms[ fmask[i][1] ] ) ;
+					// getEdgeIntersectionByIndex(node, femask[i][1], nstt, 1, pts[fmask[i][1]], norms[fmask[i][1]]);
+					getEdgeIntersectionByIndex(node, femask[i][1], nst, len, pts[fmask[i][1]], norms[fmask[i][1]]);
 				}
 			}
 		}
 		
 		// 3 edge adjacent cubes
-		int emask[3] = {3, 7, 11} ;
-		int eemask[3] = {0, 1, 2} ;
-		for ( i = 0 ; i < 3 ; i ++ )
+		int emask[3] = {3, 7, 11};
+		int eemask[3] = {0, 1, 2};
+		for(i = 0; i < 3; i ++)
 		{
-			if ( getEdgeParity( leaf, emask[i] ) )
+			if(getEdgeParity(leaf, emask[i]))
 			{
-				int nst[3] = {st[0] + len, st[1] + len, st[2] + len} ;
-				nst[ i ] -= len ;
-				// int nstt[3] = {1, 1, 1} ;
-				// nstt[ i ] -= 1 ;
-				UCHAR* node = locateLeaf( nst ) ;
+				int nst[3] = {st[0] + len, st[1] + len, st[2] + len};
+				nst[i] -= len;
+				// int nstt[3] = {1, 1, 1};
+				// nstt[i] -= 1;
+				LeafNode* node = locateLeaf(nst);
 				
-				// getEdgeIntersectionByIndex( node, eemask[i], nstt, 1, pts[ emask[i] ], norms[ emask[i] ] ) ;
-				getEdgeIntersectionByIndex( node, eemask[i], nst, len, pts[ emask[i] ], norms[ emask[i] ] ) ;
+				// getEdgeIntersectionByIndex(node, eemask[i], nstt, 1, pts[emask[i]], norms[emask[i]]);
+				getEdgeIntersectionByIndex(node, eemask[i], nst, len, pts[emask[i]], norms[emask[i]]);
 			}
 		}
 	}
 
 
-	void fillEdgeIntersections( UCHAR* leaf, int st[3], int len, float pts[12][3], float norms[12][3], int parity[12] )
+	void fillEdgeIntersections(LeafNode* leaf, int st[3], int len, float pts[12][3], float norms[12][3], int parity[12])
 	{
-		int i ;
-		for ( i = 0 ; i < 12 ; i ++ )
+		int i;
+		for(i = 0; i < 12; i ++)
 		{
-			parity[ i ] = 0 ;
+			parity[i] = 0;
 		}
-		// int stt[3] = { 0, 0, 0 } ;
+		// int stt[3] = {0, 0, 0};
 
 		// The three primal edges are easy
-		int pmask[3] = { 0, 4, 8 } ;
-		for ( i = 0 ; i < 3 ; i ++ )
+		int pmask[3] = {0, 4, 8};
+		for(i = 0; i < 3; i ++)
 		{
-			if ( getStoredEdgesParity( leaf, i ) )
+			if(getStoredEdgesParity(leaf, i))
 			{
-				// getEdgeIntersectionByIndex( leaf, i, stt, 1, pts[ pmask[i] ], norms[ pmask[i] ] ) ;
-				getEdgeIntersectionByIndex( leaf, i, st, len, pts[ pmask[i] ], norms[ pmask[i] ] ) ;
-				parity[ pmask[i] ] = 1 ;
+				// getEdgeIntersectionByIndex(leaf, i, stt, 1, pts[pmask[i]], norms[pmask[i]]);
+				getEdgeIntersectionByIndex(leaf, i, st, len, pts[pmask[i]], norms[pmask[i]]);
+				parity[pmask[i]] = 1;
 			}
 		}
 		
 		// 3 face adjacent cubes
-		int fmask[3][2] = {{6,10},{2,9},{1,5}} ;
-		int femask[3][2] = {{1,2},{0,2},{0,1}} ;
-		for ( i = 0 ; i < 3 ; i ++ )
+		int fmask[3][2] = {{6,10},{2,9},{1,5}};
+		int femask[3][2] = {{1,2},{0,2},{0,1}};
+		for(i = 0; i < 3; i ++)
 		{
 			{
-				int nst[3] = {st[0], st[1], st[2]} ;
-				nst[ i ] += len ;
-				// int nstt[3] = {0, 0, 0} ;
-				// nstt[ i ] += 1 ;
-				UCHAR* node = locateLeafCheck( nst ) ;
-				if ( node == NULL )
+				int nst[3] = {st[0], st[1], st[2]};
+				nst[i] += len;
+				// int nstt[3] = {0, 0, 0};
+				// nstt[i] += 1;
+				LeafNode* node = locateLeafCheck(nst);
+				if(node == NULL)
 				{
-					continue ;
+					continue;
 				}
 		
-				int e1 = getStoredEdgesParity( node, femask[i][0] ) ;
-				int e2 = getStoredEdgesParity( node, femask[i][1] ) ;
+				int e1 = getStoredEdgesParity(node, femask[i][0]);
+				int e2 = getStoredEdgesParity(node, femask[i][1]);
 				
-				if ( e1 )
+				if(e1)
 				{
-					// getEdgeIntersectionByIndex( node, femask[i][0], nstt, 1, pts[ fmask[i][0] ], norms[ fmask[i][0] ] ) ;
-					getEdgeIntersectionByIndex( node, femask[i][0], nst, len, pts[ fmask[i][0] ], norms[ fmask[i][0] ] ) ;
-					parity[ fmask[i][0] ] = 1 ;
+					// getEdgeIntersectionByIndex(node, femask[i][0], nstt, 1, pts[fmask[i][0]], norms[fmask[i][0]]);
+					getEdgeIntersectionByIndex(node, femask[i][0], nst, len, pts[fmask[i][0]], norms[fmask[i][0]]);
+					parity[fmask[i][0]] = 1;
 				}
-				if ( e2 )
+				if(e2)
 				{
-					// getEdgeIntersectionByIndex( node, femask[i][1], nstt, 1, pts[ fmask[i][1] ], norms[ fmask[i][1] ] ) ;
-					getEdgeIntersectionByIndex( node, femask[i][1], nst, len, pts[ fmask[i][1] ], norms[ fmask[i][1] ] ) ;
-					parity[ fmask[i][1] ] = 1 ;
+					// getEdgeIntersectionByIndex(node, femask[i][1], nstt, 1, pts[fmask[i][1]], norms[fmask[i][1]]);
+					getEdgeIntersectionByIndex(node, femask[i][1], nst, len, pts[fmask[i][1]], norms[fmask[i][1]]);
+					parity[fmask[i][1]] = 1;
 				}
 			}
 		}
 		
 		// 3 edge adjacent cubes
-		int emask[3] = {3, 7, 11} ;
-		int eemask[3] = {0, 1, 2} ;
-		for ( i = 0 ; i < 3 ; i ++ )
+		int emask[3] = {3, 7, 11};
+		int eemask[3] = {0, 1, 2};
+		for(i = 0; i < 3; i ++)
 		{
-//			if ( getEdgeParity( leaf, emask[i] ) )
+//			if(getEdgeParity(leaf, emask[i]))
 			{
-				int nst[3] = {st[0] + len, st[1] + len, st[2] + len} ;
-				nst[ i ] -= len ;
-				// int nstt[3] = {1, 1, 1} ;
-				// nstt[ i ] -= 1 ;
-				UCHAR* node = locateLeafCheck( nst ) ;
-				if ( node == NULL )
+				int nst[3] = {st[0] + len, st[1] + len, st[2] + len};
+				nst[i] -= len;
+				// int nstt[3] = {1, 1, 1};
+				// nstt[i] -= 1;
+				LeafNode* node = locateLeafCheck(nst);
+				if(node == NULL)
 				{
-					continue ;
+					continue;
 				}
 				
-				if ( getStoredEdgesParity( node, eemask[i] ) )
+				if(getStoredEdgesParity(node, eemask[i]))
 				{
-					// getEdgeIntersectionByIndex( node, eemask[i], nstt, 1, pts[ emask[i] ], norms[ emask[i] ] ) ;
-					getEdgeIntersectionByIndex( node, eemask[i], nst, len, pts[ emask[i] ], norms[ emask[i] ] ) ;
-					parity[ emask[ i ] ] = 1 ;
+					// getEdgeIntersectionByIndex(node, eemask[i], nstt, 1, pts[emask[i]], norms[emask[i]]);
+					getEdgeIntersectionByIndex(node, eemask[i], nst, len, pts[emask[i]], norms[emask[i]]);
+					parity[emask[i]] = 1;
 				}
 			}
 		}
 	}
 
-	void fillEdgeOffsetsNormals( UCHAR* leaf, int st[3], int len, float pts[12], float norms[12][3], int parity[12] )
+	void fillEdgeOffsetsNormals(LeafNode* leaf, int st[3], int len, float pts[12], float norms[12][3], int parity[12])
 	{
-		int i ;
-		for ( i = 0 ; i < 12 ; i ++ )
+		int i;
+		for(i = 0; i < 12; i ++)
 		{
-			parity[ i ] = 0 ;
+			parity[i] = 0;
 		}
-		// int stt[3] = { 0, 0, 0 } ;
+		// int stt[3] = {0, 0, 0};
 
 		// The three primal edges are easy
-		int pmask[3] = { 0, 4, 8 } ;
-		for ( i = 0 ; i < 3 ; i ++ )
+		int pmask[3] = {0, 4, 8};
+		for(i = 0; i < 3; i ++)
 		{
-			if ( getStoredEdgesParity( leaf, i ) )
+			if(getStoredEdgesParity(leaf, i))
 			{
-				pts[ pmask[i] ] = getEdgeOffsetNormalByIndex( leaf, i, norms[ pmask[i] ] ) ;
-				parity[ pmask[i] ] = 1 ;
+				pts[pmask[i]] = getEdgeOffsetNormalByIndex(leaf, i, norms[pmask[i]]);
+				parity[pmask[i]] = 1;
 			}
 		}
 		
 		// 3 face adjacent cubes
-		int fmask[3][2] = {{6,10},{2,9},{1,5}} ;
-		int femask[3][2] = {{1,2},{0,2},{0,1}} ;
-		for ( i = 0 ; i < 3 ; i ++ )
+		int fmask[3][2] = {{6,10},{2,9},{1,5}};
+		int femask[3][2] = {{1,2},{0,2},{0,1}};
+		for(i = 0; i < 3; i ++)
 		{
 			{
-				int nst[3] = {st[0], st[1], st[2]} ;
-				nst[ i ] += len ;
-				// int nstt[3] = {0, 0, 0} ;
-				// nstt[ i ] += 1 ;
-				UCHAR* node = locateLeafCheck( nst ) ;
-				if ( node == NULL )
+				int nst[3] = {st[0], st[1], st[2]};
+				nst[i] += len;
+				// int nstt[3] = {0, 0, 0};
+				// nstt[i] += 1;
+				LeafNode* node = locateLeafCheck(nst);
+				if(node == NULL)
 				{
-					continue ;
+					continue;
 				}
 		
-				int e1 = getStoredEdgesParity( node, femask[i][0] ) ;
-				int e2 = getStoredEdgesParity( node, femask[i][1] ) ;
+				int e1 = getStoredEdgesParity(node, femask[i][0]);
+				int e2 = getStoredEdgesParity(node, femask[i][1]);
 				
-				if ( e1 )
+				if(e1)
 				{
-					pts[ fmask[i][0] ] = getEdgeOffsetNormalByIndex( node, femask[i][0], norms[ fmask[i][0] ] ) ;
-					parity[ fmask[i][0] ] = 1 ;
+					pts[fmask[i][0]] = getEdgeOffsetNormalByIndex(node, femask[i][0], norms[fmask[i][0]]);
+					parity[fmask[i][0]] = 1;
 				}
-				if ( e2 )
+				if(e2)
 				{
-					pts[ fmask[i][1] ] = getEdgeOffsetNormalByIndex( node, femask[i][1], norms[ fmask[i][1] ] ) ;
-					parity[ fmask[i][1] ] = 1 ;
+					pts[fmask[i][1]] = getEdgeOffsetNormalByIndex(node, femask[i][1], norms[fmask[i][1]]);
+					parity[fmask[i][1]] = 1;
 				}
 			}
 		}
 		
 		// 3 edge adjacent cubes
-		int emask[3] = {3, 7, 11} ;
-		int eemask[3] = {0, 1, 2} ;
-		for ( i = 0 ; i < 3 ; i ++ )
+		int emask[3] = {3, 7, 11};
+		int eemask[3] = {0, 1, 2};
+		for(i = 0; i < 3; i ++)
 		{
-//			if ( getEdgeParity( leaf, emask[i] ) )
+//			if(getEdgeParity(leaf, emask[i]))
 			{
-				int nst[3] = {st[0] + len, st[1] + len, st[2] + len} ;
-				nst[ i ] -= len ;
-				// int nstt[3] = {1, 1, 1} ;
-				// nstt[ i ] -= 1 ;
-				UCHAR* node = locateLeafCheck( nst ) ;
-				if ( node == NULL )
+				int nst[3] = {st[0] + len, st[1] + len, st[2] + len};
+				nst[i] -= len;
+				// int nstt[3] = {1, 1, 1};
+				// nstt[i] -= 1;
+				LeafNode* node = locateLeafCheck(nst);
+				if(node == NULL)
 				{
-					continue ;
+					continue;
 				}
 				
-				if ( getStoredEdgesParity( node, eemask[i] ) )
+				if(getStoredEdgesParity(node, eemask[i]))
 				{
-					pts[ emask[i] ] = getEdgeOffsetNormalByIndex( node, eemask[i], norms[ emask[i] ] ) ;
-					parity[ emask[ i ] ] = 1 ;
+					pts[emask[i]] = getEdgeOffsetNormalByIndex(node, eemask[i], norms[emask[i]]);
+					parity[emask[i]] = 1;
 				}
 			}
 		}
@@ -1253,344 +1112,320 @@ private:
 
 
 	/// Update method
-	UCHAR* updateEdgeOffsetsNormals( UCHAR* leaf, int oldlen, int newlen, float offs[3], float a[3], float b[3], float c[3] )
+	LeafNode* updateEdgeOffsetsNormals(LeafNode* leaf, int oldlen, int newlen, float offs[3], float a[3], float b[3], float c[3])
 	{
 		// First, create a new leaf node
-		UCHAR* nleaf = createLeaf( newlen ) ;
-		for ( int i = 0 ; i < leaf_node_bytes ; i ++ )
-		{
-			nleaf[i] = leaf[i] ;
-		}
+		LeafNode* nleaf = createLeaf(newlen);
+		*nleaf = *leaf;
 
 		// Next, fill in the offsets
-		setEdgeOffsetsNormals( nleaf, offs, a, b, c, newlen ) ;
+		setEdgeOffsetsNormals(nleaf, offs, a, b, c, newlen);
 
 		// Finally, delete the old leaf
-		removeLeaf( oldlen, leaf ) ;
+		removeLeaf(oldlen, leaf);
 
-		return nleaf ;
+		return nleaf;
 	}
-#endif
 
 	/// Locate a leaf
 	/// WARNING: assuming this leaf already exists!
 	
-	UCHAR* locateLeaf( int st[3] )
+	LeafNode* locateLeaf(int st[3])
 	{
-		UCHAR* node = root ;
-		for ( int i = GRID_DIMENSION - 1 ; i > GRID_DIMENSION - maxDepth - 1 ; i -- )
+		Node* node = (Node*)root;
+		for(int i = GRID_DIMENSION - 1; i > GRID_DIMENSION - maxDepth - 1; i --)
 		{
-			int index = ( ( ( st[0] >> i ) & 1 ) << 2 ) | 
-						( ( ( st[1] >> i ) & 1 ) << 1 ) | 
-						( ( ( st[2] >> i ) & 1 ) ) ;
-			node = getChild( node, getChildCount( node, index ) ) ;
+			int index =(((st[0] >> i) & 1) << 2) | 
+						(((st[1] >> i) & 1) << 1) | 
+						(((st[2] >> i) & 1));
+			node = getChild(&node->internal, getChildCount(&node->internal, index));
 		}
 
-		return node ;
+		return &node->leaf;
 	}
 	
-	UCHAR* locateLeaf( UCHAR* node, int len, int st[3] )
+	LeafNode* locateLeaf(InternalNode* parent, int len, int st[3])
 	{
-		int index ;
-		for ( int i = len / 2 ; i >= mindimen ; i >>= 1 )
+		Node *node = (Node*)parent;
+		int index;
+		for(int i = len / 2; i >= mindimen; i >>= 1)
 		{
-			index = ( ( ( st[0] & i ) ? 4 : 0 ) | 
-					( ( st[1] & i ) ? 2 : 0 ) | 
-					( ( st[2] & i ) ? 1 : 0 ) ) ;
-			node = getChild( node, getChildCount( node, index ) ) ;
+			index =(((st[0] & i) ? 4 : 0) | 
+					((st[1] & i) ? 2 : 0) | 
+					((st[2] & i) ? 1 : 0));
+			node = getChild(&node->internal,
+							getChildCount(&node->internal, index));
 		}
 
-		return node ;
+		return &node->leaf;
 	}
-	UCHAR* locateLeafCheck( int st[3] )
+
+	LeafNode* locateLeafCheck(int st[3])
 	{
-		UCHAR* node = root ;
-		for ( int i = GRID_DIMENSION - 1 ; i > GRID_DIMENSION - maxDepth - 1 ; i -- )
+		Node* node = (Node*)root;
+		for(int i = GRID_DIMENSION - 1; i > GRID_DIMENSION - maxDepth - 1; i --)
 		{
-			int index = ( ( ( st[0] >> i ) & 1 ) << 2 ) | 
-						( ( ( st[1] >> i ) & 1 ) << 1 ) | 
-						( ( ( st[2] >> i ) & 1 ) ) ;
-			if ( ! hasChild( node, index ) )
+			int index =(((st[0] >> i) & 1) << 2) | 
+						(((st[1] >> i) & 1) << 1) | 
+						(((st[2] >> i) & 1));
+			if(!hasChild(&node->internal, index))
 			{
-				return NULL ;
+				return NULL;
 			}
-			node = getChild( node, getChildCount( node, index ) ) ;
+			node = getChild(&node->internal, getChildCount(&node->internal, index));
 		}
 
-		return node ;
+		return &node->leaf;
 	}
-	UCHAR* locateParent( int len, int st[3], int& count )
+
+	InternalNode* locateParent(int len, int st[3], int& count)
 	{
-		UCHAR* node = root ;
-		UCHAR* pre = NULL ;
-		int index = 0 ;
-		for ( int i = dimen / 2 ; i >= len ; i >>= 1 )
+		InternalNode* node = (InternalNode*)root;
+		InternalNode* pre = NULL;
+		int index = 0;
+		for(int i = dimen / 2; i >= len; i >>= 1)
 		{
-			index = ( ( ( st[0] & i ) ? 4 : 0 ) | 
-					( ( st[1] & i ) ? 2 : 0 ) | 
-					( ( st[2] & i ) ? 1 : 0 ) ) ;
-			pre = node ;
-			node = getChild( node, getChildCount( node, index ) ) ;
+			index =(((st[0] & i) ? 4 : 0) | 
+					((st[1] & i) ? 2 : 0) | 
+					((st[2] & i) ? 1 : 0));
+			pre = node;
+			node = &getChild(node, getChildCount(node, index))->internal;
 		}
 
-		count = getChildCount( pre, index ) ;
-		return pre ;
+		count = getChildCount(pre, index);
+		return pre;
 	}
-	UCHAR* locateParent( UCHAR* papa, int len, int st[3], int& count )
+	
+	InternalNode* locateParent(InternalNode* parent, int len, int st[3], int& count)
 	{
-		UCHAR* node = papa ;
-		UCHAR* pre = NULL ;
+		InternalNode* node = parent;
+		InternalNode* pre = NULL;
 		int index = 0;
-		for ( int i = len / 2 ; i >= mindimen ; i >>= 1 )
+		for(int i = len / 2; i >= mindimen; i >>= 1)
 		{
-			index = ( ( ( st[0] & i ) ? 4 : 0 ) | 
-					( ( st[1] & i ) ? 2 : 0 ) | 
-					( ( st[2] & i ) ? 1 : 0 ) ) ;
-			pre = node ;
-			node = getChild( node, getChildCount( node, index ) ) ;
+			index =(((st[0] & i) ? 4 : 0) | 
+					((st[1] & i) ? 2 : 0) | 
+					((st[2] & i) ? 1 : 0));
+			pre = node;
+			node = (InternalNode*)getChild(node, getChildCount(node, index));
 		}
 
-		count = getChildCount( pre, index ) ;
-		return pre ;
+		count = getChildCount(pre, index);
+		return pre;
 	}
+	
 	/************ Operators for internal nodes ************/
 
-	/// Print the node information
-	void printNode( UCHAR* node )
-	{
-		printf("Address: %p ", node ) ;
-		printf("Leaf Mask: ") ;
-		for ( int i = 0 ; i < 8 ; i ++ )
-		{
-			printf( "%d ", isLeaf( node, i ) ) ;
-		}
-		printf("Child Mask: ") ;
-		for ( int i = 0 ; i < 8 ; i ++ )
-		{
-			printf( "%d ", hasChild( node, i ) ) ;
-		}
-		printf("\n") ;
-	}
-
-	/// Get size of an internal node
-	int getSize ( int length )
-	{
-		return INTERNAL_NODE_BYTES + length * 4 ;	
-	};
-
 	/// If child index exists
-	int hasChild( UCHAR* node, int index )
+	int hasChild(InternalNode* node, int index)
 	{
-		return ( node[0] >> index ) & 1 ;
-	};
+		return (node->has_child >> index) & 1;
+	}
 
 	/// Test if child is leaf
-	int isLeaf ( UCHAR* node, int index )
+	int isLeaf(InternalNode* node, int index)
 	{
-		return ( node[1] >> index ) & 1 ;
-	};
+		return (node->child_is_leaf >> index) & 1;
+	}
 
 	/// Get the pointer to child index
-	UCHAR* getChild ( UCHAR* node, int count )
+	Node* getChild(InternalNode* node, int count)
 	{
-		return (( UCHAR ** ) ( node + INTERNAL_NODE_BYTES )) [ count ] ;	
+		return node->children[count];
 	};
 
 	/// Get total number of children
-	int getNumChildren( UCHAR* node )
+	int getNumChildren(InternalNode* node)
 	{
-		return numChildrenTable[ node[0] ] ;
-	};
+		return numChildrenTable[node->has_child];
+	}
 
 	/// Get the count of children
-	int getChildCount( UCHAR* node, int index )
+	int getChildCount(InternalNode* node, int index)
 	{
-		return childrenCountTable[ node[0] ][ index ] ;
+		return childrenCountTable[node->has_child][index];
 	}
-	int getChildIndex( UCHAR* node, int count )
+	int getChildIndex(InternalNode* node, int count)
 	{
-		return childrenIndexTable[ node[0] ][ count ] ;
+		return childrenIndexTable[node->has_child][count];
 	}
-	int* getChildCounts( UCHAR* node )
+	int* getChildCounts(InternalNode* node)
 	{
-		return childrenCountTable[ node[0] ] ;
+		return childrenCountTable[node->has_child];
 	}
 
 	/// Get all children
-	void fillChildren( UCHAR* node, UCHAR* chd[ 8 ], int leaf[ 8 ] )
+	void fillChildren(InternalNode* node, Node* children[8], int leaf[8])
 	{
-		int count = 0 ;
-		for ( int i = 0 ; i < 8 ; i ++ )
+		int count = 0;
+		for(int i = 0; i < 8; i ++)
 		{	
-			leaf[ i ] = isLeaf( node, i ) ;
-			if ( hasChild( node, i ) )
+			leaf[i] = isLeaf(node, i);
+			if(hasChild(node, i))
 			{
-				chd[ i ] = getChild( node, count ) ;
-				count ++ ;
+				children[i] = getChild(node, count);
+				count ++;
 			}
 			else
 			{
-			 	chd[ i ] = NULL ;
-				leaf[ i ] = 0 ;
+			 	children[i] = NULL;
+				leaf[i] = 0;
 			}
 		}
 	}
 
 	/// Sets the child pointer
-	void setChild ( UCHAR* node, int count, UCHAR* chd )
+	void setChild(InternalNode* node, int count, Node* chd)
 	{
-		(( UCHAR ** ) ( node + INTERNAL_NODE_BYTES )) [ count ] = chd ;
+		node->children[count] = chd;
 	}
-	void setInternalChild ( UCHAR* node, int index, int count, UCHAR* chd )
+	void setInternalChild(InternalNode* node, int index, int count, InternalNode* chd)
 	{
-		setChild( node, count, chd ) ;
-		node[0] |= ( 1 << index ) ;
-	};
-	void setLeafChild ( UCHAR* node, int index, int count, UCHAR* chd )
+		setChild(node, count, (Node*)chd);
+		node->has_child |= (1 << index);
+	}
+	void setLeafChild(InternalNode* node, int index, int count, LeafNode* chd)
 	{
-		setChild( node, count, chd ) ;
-		node[0] |= ( 1 << index ) ;
-		node[1] |= ( 1 << index ) ;
-	};
+		setChild(node, count, (Node*)chd);
+		node->has_child |=(1 << index);
+		node->child_is_leaf |= (1 << index);
+	}
 
 	/// Add a kid to an existing internal node
 	/// Fix me: can we do this without wasting memory ?
 	/// Fixed: using variable memory
-	UCHAR* addChild( UCHAR* node, int index, UCHAR* chd, int aLeaf )
+	InternalNode* addChild(InternalNode* node, int index, Node* child, int aLeaf)
 	{
 		// Create new internal node
-		int num = getNumChildren( node ) ;
-		UCHAR* rnode = createInternal( num + 1 ) ;
+		int num = getNumChildren(node);
+		InternalNode* rnode = createInternal(num + 1);
 
 		// Establish children
-		int i ;
-		int count1 = 0, count2 = 0 ;
-		for ( i = 0 ; i < 8 ; i ++ )
+		int i;
+		int count1 = 0, count2 = 0;
+		for(i = 0; i < 8; i ++)
 		{
-			if ( i == index )
+			if(i == index)
 			{
-				if ( aLeaf )
+				if(aLeaf)
 				{
-					setLeafChild( rnode, i, count2, chd ) ;
+					setLeafChild(rnode, i, count2, &child->leaf);
 				}
 				else
 				{
-					setInternalChild( rnode, i, count2, chd ) ;
+					setInternalChild(rnode, i, count2, &child->internal);
 				}
-				count2 ++ ;
+				count2 ++;
 			}
-			else if ( hasChild( node, i ) )
+			else if(hasChild(node, i))
 			{
-				if ( isLeaf( node, i ) )
+				if(isLeaf(node, i))
 				{
-					setLeafChild( rnode, i, count2, getChild( node, count1 ) ) ;
+					setLeafChild(rnode, i, count2, &getChild(node, count1)->leaf);
 				}
 				else
 				{
-					setInternalChild( rnode, i, count2, getChild( node, count1 ) ) ;
+					setInternalChild(rnode, i, count2, &getChild(node, count1)->internal);
 				}
-				count1 ++ ;
-				count2 ++ ;
+				count1 ++;
+				count2 ++;
 			}
 		}
 
-		removeInternal( num, node ) ;
-		return rnode ;
+		removeInternal(num, node);
+		return rnode;
 	}
 
 	/// Allocate a node
-	UCHAR* createInternal( int length )
+	InternalNode* createInternal(int length)
 	{
-		UCHAR* inode = alloc[ length ]->allocate( ) ;
-		inode[0] = inode[1] = 0 ;
-		return inode ;
-	};
-	UCHAR* createLeaf( int length )
+		InternalNode* inode = (InternalNode*)alloc[length]->allocate();
+		inode->has_child = 0;
+		inode->child_is_leaf = 0;
+		return inode;
+	}
+	
+	LeafNode* createLeaf(int length)
 	{
-		if ( length > 3 )
-		{
-			printf("wierd");
-		}
-		UCHAR* lnode = leafalloc[ length ]->allocate( ) ;
-		lnode[0] = lnode[1] = lnode[2] = 0 ;
+		assert(length <= 3);
 
-		return lnode ;
-	};
+		LeafNode* lnode = (LeafNode*)leafalloc[length]->allocate();
+		lnode->edge_parity = 0;
+		lnode->primary_edge_intersections = 0;
+		lnode->signs = 0;
 
-	void removeInternal ( int num, UCHAR* node )
+		return lnode;
+	}
+
+	void removeInternal(int num, InternalNode* node)
 	{
-		alloc[ num ]->deallocate( node ) ;
+		alloc[num]->deallocate(node);
 	}
 
-	void removeLeaf ( int num, UCHAR* leaf )
+	void removeLeaf(int num, LeafNode* leaf)
 	{
-		if ( num > 3 || num < 0 )
-		{
-			printf("wierd");
-		}
-		leafalloc[ num ]->deallocate( leaf ) ;
+		assert(num >= 0 && num <= 3);
+		leafalloc[num]->deallocate(leaf);
 	}
 
 	/// Add a leaf (by creating a new par node with the leaf added)
-	UCHAR* addLeafChild ( UCHAR* par, int index, int count, UCHAR* leaf )
+	InternalNode* addLeafChild(InternalNode* par, int index, int count,
+							   LeafNode* leaf)
 	{
-		int num = getNumChildren( par ) + 1 ;
-		UCHAR* npar = createInternal( num ) ;
-		npar[0] = par[0] ;
-		npar[1] = par[1] ;
+		int num = getNumChildren(par) + 1;
+		InternalNode* npar = createInternal(num);
+		*npar = *par;
 		
-		if ( num == 1 )
+		if(num == 1)
 		{
-			setLeafChild( npar, index, 0, leaf ) ;
+			setLeafChild(npar, index, 0, leaf);
 		}
 		else
 		{
-			int i ;
-			for ( i = 0 ; i < count ; i ++ )
+			int i;
+			for(i = 0; i < count; i ++)
 			{
-				setChild( npar, i, getChild( par, i ) ) ;
+				setChild(npar, i, getChild(par, i));
 			}
-			setLeafChild( npar, index, count, leaf ) ;
-			for ( i = count + 1 ; i < num ; i ++ )
+			setLeafChild(npar, index, count, leaf);
+			for(i = count + 1; i < num; i ++)
 			{
-				setChild( npar, i, getChild( par, i - 1 ) ) ;
+				setChild(npar, i, getChild(par, i - 1));
 			}
 		}
 		
-		removeInternal( num-1, par ) ;
-		return npar ;
-	};
+		removeInternal(num-1, par);
+		return npar;
+	}
 
-	UCHAR* addInternalChild ( UCHAR* par, int index, int count, UCHAR* node )
+	InternalNode* addInternalChild(InternalNode* par, int index, int count,
+								   InternalNode* node)
 	{
-		int num = getNumChildren( par ) + 1 ;
-		UCHAR* npar = createInternal( num ) ;
-		npar[0] = par[0] ;
-		npar[1] = par[1] ;
+		int num = getNumChildren(par) + 1;
+		InternalNode* npar = createInternal(num);
+		*npar = *par;
 		
-		if ( num == 1 )
+		if(num == 1)
 		{
-			setInternalChild( npar, index, 0, node ) ;
+			setInternalChild(npar, index, 0, node);
 		}
 		else
 		{
-			int i ;
-			for ( i = 0 ; i < count ; i ++ )
+			int i;
+			for(i = 0; i < count; i ++)
 			{
-				setChild( npar, i, getChild( par, i ) ) ;
+				setChild(npar, i, getChild(par, i));
 			}
-			setInternalChild( npar, index, count, node ) ;
-			for ( i = count + 1 ; i < num ; i ++ )
+			setInternalChild(npar, index, count, node);
+			for(i = count + 1; i < num; i ++)
 			{
-				setChild( npar, i, getChild( par, i - 1 ) ) ;
+				setChild(npar, i, getChild(par, i - 1));
 			}
 		}
 		
-		removeInternal( num-1, par ) ;
-		return npar ;
-	};
+		removeInternal(num-1, par);
+		return npar;
+	}
 };
 
-
-
 #endif
diff --git a/intern/elbeem/intern/ntl_geometrymodel.cpp b/intern/elbeem/intern/ntl_geometrymodel.cpp
index c20bc34..1322073 100644
--- a/intern/elbeem/intern/ntl_geometrymodel.cpp
+++ b/intern/elbeem/intern/ntl_geometrymodel.cpp
@@ -174,7 +174,7 @@ int ntlGeometryObjModel::initModel(int numVertices, float *vertices, int numTria
 		anitimes.clear();
 		for(int frame=0; frame<channelSize; frame++) {
 			ntlSetVec3f averts; averts.mVerts.clear();
-			ntlSetVec3f anorms; averts.mVerts.clear();
+			ntlSetVec3f anorms; anorms.mVerts.clear();
 			int setsize = (3*numVertices+1);
 
 			ntlVec3Gfx p(0.),n(1.);
diff --git a/intern/elbeem/intern/ntl_world.cpp b/intern/elbeem/intern/ntl_world.cpp
index 42ee94b..3b649c9 100644
--- a/intern/elbeem/intern/ntl_world.cpp
+++ b/intern/elbeem/intern/ntl_world.cpp
@@ -400,8 +400,8 @@ int ntlWorld::advanceSims(int framenum)
 	bool done = false;
 	bool allPanic = true;
 
-	// stop/quit, dont display/render
-	if(getElbeemState()==SIMWORLD_STOP) { 
+	// stop/quit (abort), dont display/render
+	if(!isSimworldOk()) { 
 		return 1;
 	}
 
@@ -411,6 +411,9 @@ int ntlWorld::advanceSims(int framenum)
 	// time stopped? nothing else to do...
 	if( (*mpSims)[mFirstSim]->getFrameTime(framenum) <= 0.0 ){ 
 		done=true; allPanic=false; 
+
+		/* DG: Need to check for user cancel here (fix for [#30298]) */
+		(*mpSims)[mFirstSim]->checkCallerStatus(FLUIDSIM_CBSTATUS_STEP, 0);
 	}
 
 	int gstate = 0;
diff --git a/intern/elbeem/intern/solver_relax.h b/intern/elbeem/intern/solver_relax.h
index f0910a6..370d8ea 100644
--- a/intern/elbeem/intern/solver_relax.h
+++ b/intern/elbeem/intern/solver_relax.h
@@ -390,7 +390,7 @@
 #define  DEFAULT_STREAM  \
 	m[dC] = RAC(ccel,dC); \
 	 \
-	if((!nbored & CFBnd)) { \
+	if(((!nbored) & CFBnd)) { \
 	 \
 	m[dN ] = CSRC_N ; m[dS ] = CSRC_S ; \
 	m[dE ] = CSRC_E ; m[dW ] = CSRC_W ; \
diff --git a/intern/ffmpeg/ffmpeg_compat.h b/intern/ffmpeg/ffmpeg_compat.h
index 582086d..9dbbb46 100644
--- a/intern/ffmpeg/ffmpeg_compat.h
+++ b/intern/ffmpeg/ffmpeg_compat.h
@@ -1,8 +1,4 @@
-#ifndef __ffmpeg_compat_h_included__
-#define __ffmpeg_compat_h_included__ 1
-
 /*
- *
  * compatibility macros to make every ffmpeg installation appear
  * like the most current installation (wrapping some functionality sometimes)
  * it also includes all ffmpeg header files at once, no need to do it 
@@ -22,10 +18,11 @@
  *
  */
 
+#ifndef __FFMPEG_COMPAT_H__
+#define __FFMPEG_COMPAT_H__
 
 #include <libavformat/avformat.h>
 
-
 /* check our ffmpeg is new enough, avoids user complaints */
 #if (LIBAVFORMAT_VERSION_MAJOR < 52) || ((LIBAVFORMAT_VERSION_MAJOR == 52) && (LIBAVFORMAT_VERSION_MINOR <= 64))
 #  error "FFmpeg 0.7 or newer is needed, Upgrade your FFmpeg or disable it"
@@ -75,6 +72,10 @@
 #define FFMPEG_SWSCALE_COLOR_SPACE_SUPPORT
 #endif
 
+#if ((LIBAVUTIL_VERSION_MAJOR > 51) || (LIBAVUTIL_VERSION_MAJOR == 51) && (LIBAVUTIL_VERSION_MINOR >= 32))
+#define FFMPEG_FFV1_ALPHA_SUPPORTED
+#endif
+
 #ifndef FFMPEG_HAVE_AVIO
 #define AVIO_FLAG_WRITE URL_WRONLY
 #define avio_open url_fopen
diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index 35b617e..5c653ac 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -227,6 +227,20 @@ elseif(UNIX)
 		intern/GHOST_WindowX11.h
 	)
 
+	if(WITH_GHOST_XDND)
+		add_definitions(-DWITH_XDND)
+
+		list(APPEND INC
+			../../extern/xdnd
+		)
+
+		list(APPEND SRC
+			intern/GHOST_DropTargetX11.cpp
+
+			intern/GHOST_DropTargetX11.h
+		)
+	endif()
+
 	if(X11_XF86keysym_INCLUDE_PATH)
 		add_definitions(-DWITH_XF86KEYSYM)
 		list(APPEND INC_SYS
@@ -267,6 +281,10 @@ elseif(WIN32)
 		${WINTAB_INC}
 	)
 
+	list(APPEND INC
+		../utfconv
+	)
+
 	list(APPEND SRC
 		intern/GHOST_DisplayManagerWin32.cpp
 		intern/GHOST_SystemWin32.cpp
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index db66a68..3add5cc 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -30,8 +30,8 @@
  * \brief GHOST C-API function and type declarations.
  */
 
-#ifndef	GHOST_C_API_H
-#define GHOST_C_API_H
+#ifndef	__GHOST_C_API_H__
+#define __GHOST_C_API_H__
 
 #include "GHOST_Types.h"
 
@@ -494,7 +494,7 @@ extern void GHOST_SetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle,
  * @param windowhandle The handle to the window
  * @return The validity of the window.
  */
-extern int GHOST_GetValid(GHOST_WindowHandle windowhandle) ;
+extern int GHOST_GetValid(GHOST_WindowHandle windowhandle);
 
 /**
  * Returns the type of drawing context used in this window.
@@ -592,7 +592,7 @@ extern void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle,
 								 GHOST_TInt32 inX,
 								 GHOST_TInt32 inY,
 								 GHOST_TInt32* outX,
-								 GHOST_TInt32* outY) ;
+								 GHOST_TInt32* outY);
 
 /**
  * Converts a point in screen coordinates to client rectangle coordinates
@@ -842,6 +842,14 @@ extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection);
  */
 extern int GHOST_toggleConsole(int action);
 
+
+/**
+ * Confirms quitting he program when there is just one window left open
+ * in the application
+ */
+extern int GHOST_confirmQuit(GHOST_WindowHandle windowhandle);
+
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/intern/ghost/GHOST_IEvent.h b/intern/ghost/GHOST_IEvent.h
index 4e181b9..05bd355 100644
--- a/intern/ghost/GHOST_IEvent.h
+++ b/intern/ghost/GHOST_IEvent.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_IEvent interface class.
  */
 
-#ifndef _GHOST_IEVENT_H_
-#define _GHOST_IEVENT_H_
+#ifndef __GHOST_IEVENT_H__
+#define __GHOST_IEVENT_H__
 
 #include <stddef.h>
 #include "GHOST_Types.h"
@@ -92,5 +92,5 @@ public:
 #endif
 };
 
-#endif // _GHOST_IEVENT_H_
+#endif // __GHOST_IEVENT_H__
 
diff --git a/intern/ghost/GHOST_IEventConsumer.h b/intern/ghost/GHOST_IEventConsumer.h
index 9229595..043cb27 100644
--- a/intern/ghost/GHOST_IEventConsumer.h
+++ b/intern/ghost/GHOST_IEventConsumer.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_IEventConsumer interface class.
  */
 
-#ifndef _GHOST_IEVENT_CONSUMER_H_
-#define _GHOST_IEVENT_CONSUMER_H_
+#ifndef __GHOST_IEVENTCONSUMER_H__
+#define __GHOST_IEVENTCONSUMER_H__
 
 #include "GHOST_IEvent.h"
 
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index ee67694..890917f 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -32,8 +32,8 @@
  * Contains the doxygen documentation main page.
  */
 
-#ifndef _GHOST_ISYSTEM_H_
-#define _GHOST_ISYSTEM_H_
+#ifndef __GHOST_ISYSTEM_H__
+#define __GHOST_ISYSTEM_H__
 
 #include "GHOST_Types.h"
 #include "GHOST_ITimerTask.h"
@@ -82,7 +82,7 @@ class GHOST_IEventConsumer;
  * <li> OSX Carbon.</li>
  * <li> Windows.</li>
  * <li> X11.</li>
- * <li> SDL1.3 (experemental).</li>
+ * <li> SDL1.3 (experimental).</li>
  * <li> NULL (headless mode).</li>
  * </ul>
  *
@@ -392,7 +392,11 @@ public:
 	 */
 	virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
 
-	
+	/**
+	 * Confirms quitting he program when there is just one window left open
+	 * in the application
+	 */
+	virtual int confirmQuit(GHOST_IWindow * window) const = 0;
 protected:
 	/**
 	 * Initialize the system.
@@ -416,5 +420,5 @@ public:
 #endif
 };
 
-#endif // _GHOST_ISYSTEM_H_
+#endif // __GHOST_ISYSTEM_H__
 
diff --git a/intern/ghost/GHOST_ISystemPaths.h b/intern/ghost/GHOST_ISystemPaths.h
index 804cba7..dea5436 100644
--- a/intern/ghost/GHOST_ISystemPaths.h
+++ b/intern/ghost/GHOST_ISystemPaths.h
@@ -28,8 +28,8 @@
  *  \ingroup GHOST
  */
 
-#ifndef _GHOST_ISYSTEMPATHS_H_
-#define _GHOST_ISYSTEMPATHS_H_
+#ifndef __GHOST_ISYSTEMPATHS_H__
+#define __GHOST_ISYSTEMPATHS_H__
 
 #include "GHOST_Types.h"
 
diff --git a/intern/ghost/GHOST_ITimerTask.h b/intern/ghost/GHOST_ITimerTask.h
index 95d7566..bae41cf 100644
--- a/intern/ghost/GHOST_ITimerTask.h
+++ b/intern/ghost/GHOST_ITimerTask.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_ITimerTask interface class.
  */
 
-#ifndef _GHOST_ITIMER_TASK_H_
-#define _GHOST_ITIMER_TASK_H_
+#ifndef __GHOST_ITIMERTASK_H__
+#define __GHOST_ITIMERTASK_H__
 
 #include "GHOST_Types.h"
 
@@ -91,5 +91,5 @@ public:
 #endif
 };
 
-#endif // _GHOST_ITIMER_TASK_H_
+#endif // __GHOST_ITIMERTASK_H__
 
diff --git a/intern/ghost/GHOST_IWindow.h b/intern/ghost/GHOST_IWindow.h
index 6438059..4ce8800 100644
--- a/intern/ghost/GHOST_IWindow.h
+++ b/intern/ghost/GHOST_IWindow.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_IWindow interface class.
  */
 
-#ifndef _GHOST_IWINDOW_H_
-#define _GHOST_IWINDOW_H_
+#ifndef __GHOST_IWINDOW_H__
+#define __GHOST_IWINDOW_H__
 
 #include "STR_String.h"
 #include "GHOST_Rect.h"
@@ -312,5 +312,5 @@ public:
 #endif
 };
 
-#endif // _GHOST_IWINDOW_H_
+#endif // __GHOST_IWINDOW_H__
 
diff --git a/intern/ghost/GHOST_Path-api.h b/intern/ghost/GHOST_Path-api.h
index abe837b..f1b79a9 100644
--- a/intern/ghost/GHOST_Path-api.h
+++ b/intern/ghost/GHOST_Path-api.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef	GHOST_PATH_API_H
-#define GHOST_PATH_API_H
+#ifndef	__GHOST_PATH_API_H__
+#define __GHOST_PATH_API_H__
 
 #include "GHOST_Types.h"
 
diff --git a/intern/ghost/GHOST_Rect.h b/intern/ghost/GHOST_Rect.h
index c3b9460..bcbcade 100644
--- a/intern/ghost/GHOST_Rect.h
+++ b/intern/ghost/GHOST_Rect.h
@@ -30,8 +30,8 @@
  * Macro's used in GHOST debug target.
  */
 
-#ifndef _H_GHOST_Rect
-#define _H_GHOST_Rect
+#ifndef __GHOST_RECT_H__
+#define __GHOST_RECT_H__
 
 #include "GHOST_Types.h"
 
@@ -254,5 +254,5 @@ inline bool GHOST_Rect::isInside(GHOST_TInt32 x, GHOST_TInt32 y) const
 	return (x >= m_l) && (x <= m_r) && (y >= m_t) && (y <= m_b);
 }
 
-#endif // _H_GHOST_Rect
+#endif // __GHOST_RECT_H__
 
diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h
index 41496bc..583bfdf 100644
--- a/intern/ghost/GHOST_Types.h
+++ b/intern/ghost/GHOST_Types.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef _GHOST_TYPES_H_
-#define _GHOST_TYPES_H_
+#ifndef __GHOST_TYPES_H__
+#define __GHOST_TYPES_H__
 
 #ifdef WITH_CXX_GUARDEDALLOC
 #include "MEM_guardedalloc.h"
@@ -515,5 +515,5 @@ struct GHOST_TimerTaskHandle__;
 typedef void (*GHOST_TimerProcPtr)(struct GHOST_TimerTaskHandle__* task, GHOST_TUns64 time);
 #endif
 
-#endif // _GHOST_TYPES_H_
+#endif // __GHOST_TYPES_H__
 
diff --git a/intern/ghost/SConscript b/intern/ghost/SConscript
index 68a0cbf..44882a6 100644
--- a/intern/ghost/SConscript
+++ b/intern/ghost/SConscript
@@ -42,7 +42,14 @@ elif window_system in ('linux', 'openbsd3', 'sunos5', 'freebsd7', 'freebsd8', 'f
     # defs += ['PREFIX=\\"/usr/local/\\"']  # XXX, make an option
     defs += ['WITH_X11_XINPUT']  # XXX, make an option
 
-elif window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc'):
+    # freebsd doesn't seem to support XDND protocol
+    if env['WITH_GHOST_XDND'] and window_system not in ('freebsd7', 'freebsd8', 'freebsd9'):
+        incs += ' #/extern/xdnd'
+        defs += ['WITH_XDND']
+    else:
+        sources.remove('intern' + os.sep + 'GHOST_DropTargetX11.cpp')
+
+elif window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc', 'win64-mingw'):
     for f in pf:
         try:
             sources.remove('intern' + os.sep + f + 'X11.cpp')
@@ -91,7 +98,7 @@ if env['WITH_BF_3DMOUSE']:
 else:
     sources.remove('intern' + os.sep + 'GHOST_NDOFManager.cpp')
     try:
-        if window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc'):
+        if window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc', 'win64-mingw'):
             sources.remove('intern' + os.sep + 'GHOST_NDOFManagerWin32.cpp')
         elif window_system=='darwin':
             sources.remove('intern' + os.sep + 'GHOST_NDOFManagerCocoa.mm')
@@ -101,8 +108,9 @@ else:
         pass
 
 
-if window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc'):
+if window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs = env['BF_WINTAB_INC'] + ' ' + incs
+    incs += ' ../utfconv'
 
 if window_system in ('win32-vc', 'win64-vc'):
     env.BlenderLib ('bf_intern_ghost', sources, Split(incs), defines=defs, libtype=['intern','player'], priority = [40,15]) #, cc_compileflags=env['CCFLAGS'].append('/WX') )
diff --git a/intern/ghost/intern/GHOST_Buttons.h b/intern/ghost/intern/GHOST_Buttons.h
index 0209dc3..ea1cce5 100644
--- a/intern/ghost/intern/GHOST_Buttons.h
+++ b/intern/ghost/intern/GHOST_Buttons.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_Buttons struct.
  */
 
-#ifndef _GHOST_BUTTONS_H_
-#define _GHOST_BUTTONS_H_
+#ifndef __GHOST_BUTTONS_H__
+#define __GHOST_BUTTONS_H__
 
 #include "GHOST_Types.h"
 
@@ -74,5 +74,5 @@ struct GHOST_Buttons {
 	GHOST_TUns8 m_ButtonRight		: 1;
 };
 
-#endif // _GHOST_BUTTONS_H_
+#endif // __GHOST_BUTTONS_H__
 
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index 6edfc42..8442f82 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -865,3 +865,9 @@ int GHOST_toggleConsole(int action)
 	GHOST_ISystem* system = GHOST_ISystem::getSystem();
 	return system->toggleConsole(action);
 }
+
+
+int GHOST_confirmQuit(GHOST_WindowHandle windowhandle){
+	GHOST_ISystem* system = GHOST_ISystem::getSystem();
+	return system->confirmQuit((GHOST_IWindow*) windowhandle);
+}
diff --git a/intern/ghost/intern/GHOST_CallbackEventConsumer.h b/intern/ghost/intern/GHOST_CallbackEventConsumer.h
index 8c16f53..e7a1aed 100644
--- a/intern/ghost/intern/GHOST_CallbackEventConsumer.h
+++ b/intern/ghost/intern/GHOST_CallbackEventConsumer.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_CallbackEventConsumer class.
  */
 
-#ifndef _GHOST_CALLBACK_EVENT_CONSUMER_H_
-#define _GHOST_CALLBACK_EVENT_CONSUMER_H_
+#ifndef __GHOST_CALLBACKEVENTCONSUMER_H__
+#define __GHOST_CALLBACKEVENTCONSUMER_H__
 
 #include "GHOST_IEventConsumer.h"
 #include "GHOST_C-api.h"
@@ -75,5 +75,5 @@ protected:
 	GHOST_TUserDataPtr			m_userData;
 };
 
-#endif // _GHOST_CALLBACK_EVENT_CONSUMER_H_
+#endif // __GHOST_CALLBACKEVENTCONSUMER_H__
 
diff --git a/intern/ghost/intern/GHOST_Debug.h b/intern/ghost/intern/GHOST_Debug.h
index 38512f6..a6392fc 100644
--- a/intern/ghost/intern/GHOST_Debug.h
+++ b/intern/ghost/intern/GHOST_Debug.h
@@ -30,8 +30,8 @@
  * Macro's used in GHOST debug target.
  */
 
-#ifndef _GHOST_DEBUG_H_
-#define _GHOST_DEBUG_H_
+#ifndef __GHOST_DEBUG_H__
+#define __GHOST_DEBUG_H__
 
 #if defined(WIN32) && !defined(FREE_WINDOWS)
 #  ifdef DEBUG
@@ -72,5 +72,5 @@
 #  define GHOST_ASSERT(x, info)
 #endif // GHOST_DEBUG
 
-#endif // _GHOST_DEBUG_H_
+#endif // __GHOST_DEBUG_H__
 
diff --git a/intern/ghost/intern/GHOST_DisplayManager.cpp b/intern/ghost/intern/GHOST_DisplayManager.cpp
index 8a86424..ca0d53b 100644
--- a/intern/ghost/intern/GHOST_DisplayManager.cpp
+++ b/intern/ghost/intern/GHOST_DisplayManager.cpp
@@ -149,7 +149,12 @@ GHOST_DisplayManager::findMatch(
 	GHOST_TSuccess success = GHOST_kSuccess;
 	GHOST_ASSERT(m_settingsInitialized, "GHOST_DisplayManager::findMatch(): m_settingsInitialized=false");
 
-	int criteria[4] = { setting.xPixels, setting.yPixels, setting.bpp, setting.frequency };
+	int criteria[4] = {
+	    (int)setting.xPixels,
+	    (int)setting.yPixels,
+	    (int)setting.bpp,
+	    (int)setting.frequency
+	};
 	int capabilities[4];
 	double field, score;
 	double best = 1e12; // A big number
diff --git a/intern/ghost/intern/GHOST_DisplayManager.h b/intern/ghost/intern/GHOST_DisplayManager.h
index b89f303..3e86705 100644
--- a/intern/ghost/intern/GHOST_DisplayManager.h
+++ b/intern/ghost/intern/GHOST_DisplayManager.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_DisplayManager class.
  */
 
-#ifndef _GHOST_DISPLAY_MANAGER_H_
-#define _GHOST_DISPLAY_MANAGER_H_
+#ifndef __GHOST_DISPLAYMANAGER_H__
+#define __GHOST_DISPLAYMANAGER_H__
 
 #include "GHOST_Types.h"
 
@@ -136,5 +136,5 @@ protected:
 };
 
 
-#endif // _GHOST_DISPLAY_MANAGER_H_
+#endif // __GHOST_DISPLAYMANAGER_H__
 
diff --git a/intern/ghost/intern/GHOST_DisplayManagerCarbon.h b/intern/ghost/intern/GHOST_DisplayManagerCarbon.h
index 1a3c0d9..93467b8 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerCarbon.h
+++ b/intern/ghost/intern/GHOST_DisplayManagerCarbon.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_DisplayManagerCarbon class.
  */
 
-#ifndef _GHOST_DISPLAY_MANAGER_CARBON_H_
-#define _GHOST_DISPLAY_MANAGER_CARBON_H_
+#ifndef __GHOST_DISPLAYMANAGERCARBON_H__
+#define __GHOST_DISPLAYMANAGERCARBON_H__
 
 #ifndef __APPLE__
 #error Apple only!
@@ -112,5 +112,5 @@ protected:
 };
 
 
-#endif // _GHOST_DISPLAY_MANAGER_CARBON_H_
+#endif // __GHOST_DISPLAYMANAGERCARBON_H__
 
diff --git a/intern/ghost/intern/GHOST_DisplayManagerCocoa.h b/intern/ghost/intern/GHOST_DisplayManagerCocoa.h
index 7e12ca1..bf194ad 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerCocoa.h
+++ b/intern/ghost/intern/GHOST_DisplayManagerCocoa.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_DisplayManagerCocoa class.
  */
 
-#ifndef _GHOST_DISPLAY_MANAGER_COCOA_H_
-#define _GHOST_DISPLAY_MANAGER_COCOA_H_
+#ifndef __GHOST_DISPLAYMANAGERCOCOA_H__
+#define __GHOST_DISPLAYMANAGERCOCOA_H__
 
 #ifndef __APPLE__
 #error Apple only!
@@ -102,5 +102,5 @@ protected:
 };
 
 
-#endif // _GHOST_DISPLAY_MANAGER_COCOA_H_
+#endif // __GHOST_DISPLAYMANAGERCOCOA_H__
 
diff --git a/intern/ghost/intern/GHOST_DisplayManagerNULL.h b/intern/ghost/intern/GHOST_DisplayManagerNULL.h
index 5d3f016..31fb9fa 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerNULL.h
+++ b/intern/ghost/intern/GHOST_DisplayManagerNULL.h
@@ -25,8 +25,8 @@
  * Declaration of GHOST_DisplayManagerNULL class.
  */
 
-#ifndef _GHOST_DISPLAY_MANAGER_NULL_H_
-#define _GHOST_DISPLAY_MANAGER_NULL_H_
+#ifndef __GHOST_DISPLAYMANAGERNULL_H__
+#define __GHOST_DISPLAYMANAGERNULL_H__
 
 #include "GHOST_DisplayManager.h"
 #include "GHOST_SystemNULL.h"
@@ -47,4 +47,4 @@ private :
 	GHOST_SystemNULL * m_system;
 };
 
-#endif /* _GHOST_DISPLAY_MANAGER_NULL_H_ */
+#endif /* __GHOST_DISPLAYMANAGERNULL_H__ */
diff --git a/intern/ghost/intern/GHOST_DisplayManagerSDL.cpp b/intern/ghost/intern/GHOST_DisplayManagerSDL.cpp
index 1b875e6..8d2348d 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerSDL.cpp
+++ b/intern/ghost/intern/GHOST_DisplayManagerSDL.cpp
@@ -32,12 +32,14 @@
 #include "GHOST_SystemSDL.h"
 #include "GHOST_DisplayManagerSDL.h"
 
+#include "GHOST_WindowManager.h"
+
 GHOST_DisplayManagerSDL::GHOST_DisplayManagerSDL(GHOST_SystemSDL *system)
     :
       GHOST_DisplayManager(),
       m_system(system)
 {
-	/* do nothing */
+	memset(&m_mode, 0, sizeof m_mode);
 }
 
 GHOST_TSuccess
@@ -52,22 +54,29 @@ GHOST_TSuccess GHOST_DisplayManagerSDL::getNumDisplaySettings(GHOST_TUns8 displa
                                                               GHOST_TInt32& numSettings) const
 {
 	GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
-	int i;
-	SDL_Rect **vidmodes;
-
-	vidmodes = SDL_ListModes(NULL, SDL_HWSURFACE | SDL_OPENGL |
-			SDL_FULLSCREEN | SDL_HWPALETTE);
-	if (!vidmodes) {
-		fprintf(stderr, "Could not get available video modes: %s.\n",
-				SDL_GetError());
-		return GHOST_kFailure;
-	}
-	for (i = 0; vidmodes[i]; i++);
-	numSettings = GHOST_TInt32(i);
+
+	numSettings = SDL_GetNumDisplayModes(display - 1);
 
 	return GHOST_kSuccess;
 }
 
+static void ghost_mode_from_sdl(GHOST_DisplaySetting& setting, SDL_DisplayMode *mode)
+{
+	setting.xPixels = mode->w;
+	setting.yPixels = mode->h;
+	setting.bpp = SDL_BYTESPERPIXEL(mode->format) * 8;
+	/* Just guess the frequency :( */
+	setting.frequency = mode->refresh_rate ? mode->refresh_rate : 60;
+}
+
+static void ghost_mode_to_sdl(const GHOST_DisplaySetting& setting, SDL_DisplayMode *mode)
+{
+	mode->w = setting.xPixels;
+	mode->h = setting.yPixels;
+	// setting.bpp = SDL_BYTESPERPIXEL(mode->format) * 8; ???
+	mode->refresh_rate = setting.frequency;
+}
+
 GHOST_TSuccess
 GHOST_DisplayManagerSDL::getDisplaySetting(GHOST_TUns8 display,
                                            GHOST_TInt32 index,
@@ -75,36 +84,10 @@ GHOST_DisplayManagerSDL::getDisplaySetting(GHOST_TUns8 display,
 {
 	GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
 
-	int i;
-	SDL_Rect **vidmodes;
-	/* NULL is passed in here to get the modes for the current bit depth.
-	 * Other bit depths may be possible; in that case, an SDL_PixelFormat struct
-	 * should be passed in. To get a complete profile, all possible bit depths
-	 * would need to be iterated over. - z0r */
-	vidmodes = SDL_ListModes(NULL, SDL_HWSURFACE | SDL_OPENGL |
-			SDL_FULLSCREEN | SDL_HWPALETTE);
-	if (!vidmodes) {
-		fprintf(stderr, "Could not get available video modes: %s.\n",
-				SDL_GetError());
-		return GHOST_kFailure;
-	}
-	for (i = 0; vidmodes[i]; i++);
-	GHOST_ASSERT(index < i, "Requested setting outside of valid range.\n");
-
-	setting.xPixels = vidmodes[index]->w;
-	setting.yPixels = vidmodes[index]->h;
-
-	SDL_Surface *surf;
-	surf = SDL_GetVideoSurface();
-	if (surf == NULL) {
-		fprintf(stderr, "Getting display setting: %s\n", SDL_GetError());
-		/* Just guess the bit depth */
-		setting.bpp = 32;
-	} else {
-		setting.bpp = surf->format->BitsPerPixel;
-	}
-	/* Just guess the frequency :( */
-	setting.frequency = 60;
+	SDL_DisplayMode mode;
+	SDL_GetDisplayMode(display, index, &mode);
+
+	ghost_mode_from_sdl(setting, &mode);
 
 	return GHOST_kSuccess;
 }
@@ -113,39 +96,25 @@ GHOST_TSuccess
 GHOST_DisplayManagerSDL::getCurrentDisplaySetting(GHOST_TUns8 display,
                                                   GHOST_DisplaySetting& setting) const
 {
-	SDL_Surface *surf;
-	const SDL_VideoInfo *info;
-
-	/* Note: not using SDL_GetDesktopDisplayMode because that does not return
-	 * the current mode. Try to use GetVideoSurface first, as it seems more
-	 * accurate. If that fails, try other methods. - z0r */
-	surf = SDL_GetVideoSurface();
-
-	if (surf != NULL) {
-		setting.xPixels = surf->w;
-		setting.yPixels = surf->h;
-		setting.bpp = surf->format->BitsPerPixel;
-		/* Just guess the frequency :( */
-		setting.frequency = 60;
-	} else {
-		/* This may happen if the surface hasn't been created yet, e.g. on
-		 * application startup. */
-		info = SDL_GetVideoInfo();
-		setting.xPixels = info->current_w;
-		setting.yPixels = info->current_h;
-		setting.bpp = info->vfmt->BitsPerPixel;
-		/* Just guess the frequency :( */
-		setting.frequency = 60;
-	}
+	SDL_DisplayMode mode;
+	SDL_GetCurrentDisplayMode(display, &mode);
+
+	ghost_mode_from_sdl(setting, &mode);
 
 	return GHOST_kSuccess;
 }
 
 GHOST_TSuccess
+GHOST_DisplayManagerSDL::getCurrentDisplayModeSDL(SDL_DisplayMode &mode) const
+{
+	mode = m_mode;
+	return GHOST_kSuccess;
+}
+
+GHOST_TSuccess
 GHOST_DisplayManagerSDL:: setCurrentDisplaySetting(GHOST_TUns8 display,
                                                    const GHOST_DisplaySetting& setting)
 {
-
 	/*
 	 * Mode switching code ported from Quake 2 version 3.21 and bzflag version
 	 * 2.4.0:
@@ -154,31 +123,28 @@ GHOST_DisplayManagerSDL:: setCurrentDisplaySetting(GHOST_TUns8 display,
 	 * http://wiki.bzflag.org/BZFlag_Source
 	 * See src/platform/SDLDisplay.cxx:SDLDisplay and createWindow
 	 */
-	SDL_Surface *surf;
+	SDL_DisplayMode mode;
+	const int num_modes = SDL_GetNumDisplayModes(display);
 	int best_fit, best_dist, dist, x, y;
 
-	SDL_Rect **vidmodes = SDL_ListModes(NULL, SDL_HWSURFACE | SDL_OPENGL |
-			SDL_FULLSCREEN | SDL_HWPALETTE);
-	if (!vidmodes) {
-		fprintf(stderr, "Could not get available video modes: %s.\n",
-				SDL_GetError());
-	}
-
 	best_dist = 9999999;
 	best_fit = -1;
 
-	if (vidmodes == (SDL_Rect **) -1) {
+	if (num_modes == 0) {
 		/* Any mode is OK. */
-		x = setting.xPixels;
-		y = setting.yPixels;
-	} else {
-		for (int i = 0; vidmodes[i]; i++) {
-			if (setting.xPixels > vidmodes[i]->w ||
-				setting.yPixels > vidmodes[i]->h)
+		ghost_mode_to_sdl(setting, &mode);
+	}
+	else {
+		for (int i = 0; i < num_modes; i++) {
+
+			SDL_GetDisplayMode(display, i, &mode);
+
+			if (setting.xPixels > mode.w ||
+				setting.yPixels > mode.h)
 				continue;
 
-			x = setting.xPixels - vidmodes[i]->w;
-			y = setting.yPixels - vidmodes[i]->h;
+			x = setting.xPixels - mode.w;
+			y = setting.yPixels - mode.h;
 			dist = (x * x) + (y * y);
 			if (dist < best_dist) {
 				best_dist = dist;
@@ -189,24 +155,30 @@ GHOST_DisplayManagerSDL:: setCurrentDisplaySetting(GHOST_TUns8 display,
 		if (best_fit == -1)
 			return GHOST_kFailure;
 
-		x = vidmodes[best_fit]->w;
-		y = vidmodes[best_fit]->h;
+		SDL_GetDisplayMode(display, best_fit, &mode);
 	}
 
-#  ifdef _DEBUG
-	printf("Switching to video mode %dx%d\n", x, y);
-#  endif
+	m_mode = mode;
+
+	/* evil, SDL2 needs a window to adjust display modes */
+	GHOST_WindowSDL *win = (GHOST_WindowSDL *)m_system->getWindowManager()->getActiveWindow();
 
-	// limit us to the main display
-	static char singleDisplayEnv[] = "SDL_SINGLEDISPLAY=1";
-	putenv(singleDisplayEnv);
+	if (win) {
+		SDL_Window *sdl_win = win->getSDLWindow();
 
-	// change to the mode
-	surf = SDL_SetVideoMode(x, y, setting.bpp, SDL_OPENGL | SDL_FULLSCREEN);
-	if (surf == NULL) {
-		fprintf(stderr, "Could not set video mode: %s.\n", SDL_GetError());
-		return GHOST_kFailure;
+
+		SDL_SetWindowDisplayMode(sdl_win, &mode);
+		SDL_ShowWindow(sdl_win);
+		SDL_SetWindowFullscreen(sdl_win, SDL_TRUE);
+
+		return GHOST_kSuccess;
 	}
+	else {
+		/* this is a problem for the BGE player :S, perhaps SDL2 will resolve at some point.
+		 * we really need SDL_SetDisplayModeForDisplay() to become an API func! - campbell */
+		printf("no windows available, cant fullscreen");
 
-	return GHOST_kSuccess;
+		/* do not fail, we will try again later when the window is created - wander */
+		return GHOST_kSuccess;
+	}
 }
diff --git a/intern/ghost/intern/GHOST_DisplayManagerSDL.h b/intern/ghost/intern/GHOST_DisplayManagerSDL.h
index 297a61f..bfd8d1a 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerSDL.h
+++ b/intern/ghost/intern/GHOST_DisplayManagerSDL.h
@@ -25,8 +25,8 @@
  * Declaration of GHOST_DisplayManagerSDL class.
  */
 
-#ifndef _GHOST_DISPLAY_MANAGER_SDL_H_
-#define _GHOST_DISPLAY_MANAGER_SDL_H_
+#ifndef __GHOST_DISPLAYMANAGERSDL_H__
+#define __GHOST_DISPLAYMANAGERSDL_H__
 
 #include "GHOST_DisplayManager.h"
 
@@ -34,8 +34,8 @@ extern "C" {
 	#include "SDL.h"
 }
 
-#if !SDL_VERSION_ATLEAST(1, 3, 0)
-#  error "SDL 1.3 or newer is needed to build with Ghost"
+#if !SDL_VERSION_ATLEAST(2, 0, 0)
+#  error "SDL 2.0 or newer is needed to build with Ghost"
 #endif
 
 class GHOST_SystemSDL;
@@ -62,11 +62,15 @@ public:
 	                         GHOST_DisplaySetting& setting) const;
 
 	GHOST_TSuccess
+	getCurrentDisplayModeSDL(SDL_DisplayMode &mode) const;
+
+	GHOST_TSuccess
 	setCurrentDisplaySetting(GHOST_TUns8 display,
 	                         const GHOST_DisplaySetting& setting);
 
 private :
 	GHOST_SystemSDL * m_system;
+	SDL_DisplayMode m_mode;
 };
 
-#endif /* _GHOST_DISPLAY_MANAGER_SDL_H_ */
+#endif /* __GHOST_DISPLAYMANAGERSDL_H__ */
diff --git a/intern/ghost/intern/GHOST_DisplayManagerWin32.h b/intern/ghost/intern/GHOST_DisplayManagerWin32.h
index 84749d4..534274e 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerWin32.h
+++ b/intern/ghost/intern/GHOST_DisplayManagerWin32.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_DisplayManagerWin32 class.
  */
 
-#ifndef _GHOST_DISPLAY_MANAGER_WIN32_H_
-#define _GHOST_DISPLAY_MANAGER_WIN32_H_
+#ifndef __GHOST_DISPLAYMANAGERWIN32_H__
+#define __GHOST_DISPLAYMANAGERWIN32_H__
 
 #ifndef WIN32
 #error WIN32 only!
@@ -97,5 +97,5 @@ protected:
 };
 
 
-#endif // _GHOST_DISPLAY_MANAGER_WIN32_H_
+#endif // __GHOST_DISPLAYMANAGERWIN32_H__
 
diff --git a/intern/ghost/intern/GHOST_DisplayManagerX11.h b/intern/ghost/intern/GHOST_DisplayManagerX11.h
index 62374b9..c4d2b6d 100644
--- a/intern/ghost/intern/GHOST_DisplayManagerX11.h
+++ b/intern/ghost/intern/GHOST_DisplayManagerX11.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_DisplayManagerX11 class.
  */
 
-#ifndef _GHOST_DISPLAY_MANAGER_X11_H_
-#define _GHOST_DISPLAY_MANAGER_X11_H_
+#ifndef __GHOST_DISPLAYMANAGERX11_H__
+#define __GHOST_DISPLAYMANAGERX11_H__
 
 #include "GHOST_DisplayManager.h"
 
diff --git a/intern/ghost/intern/GHOST_DropTargetWin32.cpp b/intern/ghost/intern/GHOST_DropTargetWin32.cpp
index 4c9072d..c13c242 100644
--- a/intern/ghost/intern/GHOST_DropTargetWin32.cpp
+++ b/intern/ghost/intern/GHOST_DropTargetWin32.cpp
@@ -34,6 +34,9 @@
 #include "GHOST_DropTargetWin32.h"
 #include <ShellApi.h>
 
+#include "utf_winfunc.h"
+#include "utfconv.h"
+
 #ifdef GHOST_DEBUG
 // utility
 void printLastError(void);
@@ -267,20 +270,12 @@ void * GHOST_DropTargetWin32::getDropDataAsFilenames(IDataObject * pDataObject)
 			{
 				if ( ::DragQueryFileW ( hdrop, nfile, fpath, MAX_PATH ) > 0 )
 				{
-					if ( !WideCharToANSI(fpath, temp_path) )
+					if ( !(temp_path = alloc_utf_8_from_16(fpath, 0)) )
 					{
 						continue;
 					} 
 					// Just ignore paths that could not be converted verbatim.
-					if (strpbrk(temp_path, "?"))
-					{
-#ifdef GHOST_DEBUG
-						::printf("\ndiscarding path that contains illegal characters: %s", temp_path);
-#endif // GHOST_DEBUG
-						::free(temp_path);
-						temp_path = NULL;
-						continue;
-					}
+
 					strArray->strings[nvalid] = (GHOST_TUns8*) temp_path;
 					strArray->count = nvalid+1;
 					nvalid++;
@@ -309,7 +304,7 @@ void * GHOST_DropTargetWin32::getDropDataAsString(IDataObject * pDataObject)
 		if(pDataObject->GetData(&fmtetc, &stgmed) == S_OK)
 		{
 			LPCWSTR wstr = (LPCWSTR)::GlobalLock(stgmed.hGlobal);
-			if ( !WideCharToANSI(wstr, tmp_string) )
+			if ( !(tmp_string = alloc_utf_8_from_16((wchar_t*)wstr, 0)) )
 			{
 				::GlobalUnlock(stgmed.hGlobal);
 				return NULL;
diff --git a/intern/ghost/intern/GHOST_DropTargetWin32.h b/intern/ghost/intern/GHOST_DropTargetWin32.h
index 0e8b2d1..9f80b82 100644
--- a/intern/ghost/intern/GHOST_DropTargetWin32.h
+++ b/intern/ghost/intern/GHOST_DropTargetWin32.h
@@ -29,8 +29,8 @@
  *  \ingroup GHOST
  */
 
-#ifndef _GHOST_DROP_TARGET_WIN32_H_
-#define _GHOST_DROP_TARGET_WIN32_H_
+#ifndef __GHOST_DROPTARGETWIN32_H__
+#define __GHOST_DROPTARGETWIN32_H__
 
 #include <string.h>
 #include <GHOST_Types.h>
@@ -155,4 +155,4 @@ private:
 
 };
 
-#endif  // _GHOST_DROP_TARGET_WIN32_H_
+#endif  // __GHOST_DROPTARGETWIN32_H__
diff --git a/intern/ghost/intern/GHOST_DropTargetX11.cpp b/intern/ghost/intern/GHOST_DropTargetX11.cpp
new file mode 100644
index 0000000..2239ac6
--- /dev/null
+++ b/intern/ghost/intern/GHOST_DropTargetX11.cpp
@@ -0,0 +1,310 @@
+/*
+ * ***** 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 the Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Sergey Sharybin.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file ghost/intern/GHOST_DropTargetX11.cpp
+ *  \ingroup GHOST
+ */
+
+#include "GHOST_DropTargetX11.h"
+#include "GHOST_Debug.h"
+
+#include <ctype.h>
+#include <assert.h>
+
+bool GHOST_DropTargetX11::m_xdndInitialized = false;
+DndClass GHOST_DropTargetX11::m_dndClass;
+Atom * GHOST_DropTargetX11::m_dndTypes = NULL;
+Atom * GHOST_DropTargetX11::m_dndActions = NULL;
+const char *GHOST_DropTargetX11::m_dndMimeTypes[] = {"url/url", "text/uri-list", "text/plain", "application/octet-stream"};
+int GHOST_DropTargetX11::m_refCounter = 0;
+
+#define dndTypeURLID           0
+#define dndTypeURIListID       1
+#define dndTypePlainTextID     2
+#define dndTypeOctetStreamID   3
+
+#define dndTypeURL          m_dndTypes[dndTypeURLID]
+#define dndTypeURIList      m_dndTypes[dndTypeURIListID]
+#define dndTypePlainText    m_dndTypes[dndTypePlainTextID]
+#define dndTypeOctetStream  m_dndTypes[dndTypeOctetStreamID]
+
+void GHOST_DropTargetX11::Initialize(void)
+{
+	Display *display = m_system->getXDisplay();
+	int dndTypesCount = sizeof(m_dndMimeTypes) / sizeof(char*);
+	int counter;
+
+	xdnd_init(&m_dndClass, display);
+
+	m_dndTypes = new Atom[dndTypesCount + 1];
+	XInternAtoms(display, (char**)m_dndMimeTypes, dndTypesCount, 0, m_dndTypes);
+	m_dndTypes[dndTypesCount] = 0;
+
+	m_dndActions = new Atom[8];
+	counter = 0;
+
+	m_dndActions[counter++] = m_dndClass.XdndActionCopy;
+	m_dndActions[counter++] = m_dndClass.XdndActionMove;
+
+#if 0 /* Not supported yet */
+	dndActions[counter++] = dnd->XdndActionLink;
+	dndActions[counter++] = dnd->XdndActionAsk;
+	dndActions[counter++] = dnd->XdndActionPrivate;
+	dndActions[counter++] = dnd->XdndActionList;
+	dndActions[counter++] = dnd->XdndActionDescription;
+#endif
+
+	m_dndActions[counter++] = 0;
+}
+
+void GHOST_DropTargetX11::Uninitialize(void)
+{
+	xdnd_shut(&m_dndClass);
+}
+
+GHOST_DropTargetX11::GHOST_DropTargetX11(GHOST_WindowX11 * window, GHOST_SystemX11 * system)
+:
+m_window(window),
+m_system(system)
+{
+	if (!m_xdndInitialized) {
+		Initialize();
+		m_xdndInitialized = true;
+		GHOST_PRINT("XDND initialized\n");
+	}
+
+	Window wnd = window->getXWindow();
+
+	xdnd_set_dnd_aware(&m_dndClass, wnd, 0);
+	xdnd_set_type_list(&m_dndClass, wnd, m_dndTypes);
+
+	m_draggedObjectType = GHOST_kDragnDropTypeUnknown;
+	m_refCounter++;
+}
+
+GHOST_DropTargetX11::~GHOST_DropTargetX11()
+{
+	m_refCounter--;
+	if (m_refCounter == 0) {
+		Uninitialize();
+		m_xdndInitialized = false;
+		GHOST_PRINT("XDND uninitialized\n");
+	}
+}
+
+/* based on a code from Saul Rennison
+ * http://stackoverflow.com/questions/2673207/c-c-url-decode-library */
+
+typedef enum DecodeState_e {
+	STATE_SEARCH = 0, ///< searching for an ampersand to convert
+	STATE_CONVERTING  ///< convert the two proceeding characters from hex
+} DecodeState_e;
+
+void GHOST_DropTargetX11::UrlDecode(char *decodedOut, int bufferSize, const char *encodedIn)
+{
+	unsigned int i;
+	unsigned int len = strlen(encodedIn);
+	DecodeState_e state = STATE_SEARCH;
+	int j, asciiCharacter;
+	char tempNumBuf[3] = {0};
+	bool bothDigits = true;
+
+	memset(decodedOut, 0, bufferSize);
+
+	for (i = 0; i < len; ++i) {
+		switch (state) {
+			case STATE_SEARCH:
+				if (encodedIn[i] != '%') {
+					strncat(decodedOut, &encodedIn[i], 1);
+					assert(strlen(decodedOut) < bufferSize);
+					break;
+				}
+
+				// We are now converting
+				state = STATE_CONVERTING;
+				break;
+
+			case STATE_CONVERTING:
+				bothDigits = true;
+
+				// Create a buffer to hold the hex. For example, if %20, this
+				// buffer would hold 20 (in ASCII)
+				memset(tempNumBuf, 0, sizeof(tempNumBuf));
+
+				// Conversion complete (i.e. don't convert again next iter)
+				state = STATE_SEARCH;
+
+				strncpy(tempNumBuf, &encodedIn[i], 2);
+
+				// Ensure both characters are hexadecimal
+
+				for (j = 0; j < 2; ++j) {
+					if (!isxdigit(tempNumBuf[j]))
+						bothDigits = false;
+				}
+
+				if (!bothDigits)
+					break;
+
+				// Convert two hexadecimal characters into one character
+				sscanf(tempNumBuf, "%x", &asciiCharacter);
+
+				// Ensure we aren't going to overflow
+				assert(strlen(decodedOut) < bufferSize);
+
+				// Concatenate this character onto the output
+				strncat(decodedOut, (char*)&asciiCharacter, 1);
+
+				// Skip the next character
+				i++;
+				break;
+		}
+	}
+}
+
+char *GHOST_DropTargetX11::FileUrlDecode(char *fileUrl)
+{
+	if(!strncpy(fileUrl, "file://", 7) == 0) {
+		/* assume one character of encoded URL can be expanded to 4 chars max */
+		int decodedSize = 4 * strlen(fileUrl) + 1;
+		char *decodedPath = (char *)malloc(decodedSize);
+
+		UrlDecode(decodedPath, decodedSize, fileUrl + 7);
+
+		return decodedPath;
+	}
+
+	return NULL;
+}
+
+void *GHOST_DropTargetX11::getURIListGhostData(unsigned char *dropBuffer, int dropBufferSize)
+{
+	GHOST_TStringArray *strArray = NULL;
+	int totPaths = 0, curLength = 0;
+
+	/* count total number of file pathes in buffer */
+	for (int i = 0; i <= dropBufferSize; i++) {
+		if (dropBuffer[i] == 0 || dropBuffer[i] == '\n' || dropBuffer[i] == '\r') {
+			if (curLength) {
+				totPaths++;
+				curLength = 0;
+			}
+		}
+		else curLength++;
+	}
+
+	strArray = (GHOST_TStringArray*)malloc(sizeof(GHOST_TStringArray));
+	strArray->count = 0;
+	strArray->strings = (GHOST_TUns8**)malloc(totPaths*sizeof(GHOST_TUns8*));
+
+	curLength = 0;
+	for (int i = 0; i <= dropBufferSize; i++) {
+		if (dropBuffer[i] == 0 || dropBuffer[i] == '\n' || dropBuffer[i] == '\r') {
+			if (curLength) {
+				char *curPath = (char *)malloc(curLength + 1);
+				char *decodedPath;
+
+				strncpy(curPath, (char*)dropBuffer + i - curLength, curLength);
+				curPath[curLength] = 0;
+
+				decodedPath = FileUrlDecode(curPath);
+				if(decodedPath) {
+					strArray->strings[strArray->count] = (GHOST_TUns8*)decodedPath;
+					strArray->count++;
+				}
+
+				free(curPath);
+				curLength = 0;
+			}
+		}
+		else curLength++;
+	}
+
+	return strArray;
+}
+
+void *GHOST_DropTargetX11::getGhostData(Atom dropType, unsigned char *dropBuffer, int dropBufferSize)
+{
+	void *data = NULL;
+	unsigned char *tmpBuffer = (unsigned char *)malloc(dropBufferSize + 1);
+	bool needsFree = true;
+
+	/* ensure NULL-terminator */
+	memcpy(tmpBuffer, dropBuffer, dropBufferSize);
+	tmpBuffer[dropBufferSize] = 0;
+
+	if (dropType == dndTypeURIList) {
+		m_draggedObjectType = GHOST_kDragnDropTypeFilenames;
+		data = getURIListGhostData(tmpBuffer, dropBufferSize);
+	}
+	else if (dropType == dndTypeURL) {
+		/* need to be tested */
+		char *decodedPath = FileUrlDecode((char *)tmpBuffer);
+
+		if (decodedPath) {
+			m_draggedObjectType = GHOST_kDragnDropTypeString;
+			data = decodedPath;
+		}
+	}
+	else if (dropType == dndTypePlainText || dropType == dndTypeOctetStream) {
+		m_draggedObjectType = GHOST_kDragnDropTypeString;
+		data = tmpBuffer;
+		needsFree = false;
+	}
+	else {
+		m_draggedObjectType = GHOST_kDragnDropTypeUnknown;
+	}
+
+	if (needsFree)
+		free(tmpBuffer);
+
+	return data;
+}
+
+bool GHOST_DropTargetX11::GHOST_HandleClientMessage(XEvent *event)
+{
+	Atom dropType;
+	unsigned char *dropBuffer;
+	int dropBufferSize, dropX, dropY;
+
+	if (xdnd_get_drop(m_system->getXDisplay(), event, m_dndTypes, m_dndActions,
+	                  &dropBuffer, &dropBufferSize, &dropType, &dropX, &dropY))
+	{
+		void *data = getGhostData(dropType, dropBuffer, dropBufferSize);
+
+		if (data)
+			m_system->pushDragDropEvent(GHOST_kEventDraggingDropDone, m_draggedObjectType, m_window, dropX, dropY, data);
+
+		free(dropBuffer);
+
+		m_draggedObjectType = GHOST_kDragnDropTypeUnknown;
+
+		return true;
+	}
+
+	return false;
+}
diff --git a/intern/ghost/intern/GHOST_DropTargetX11.h b/intern/ghost/intern/GHOST_DropTargetX11.h
new file mode 100644
index 0000000..b9e17dc
--- /dev/null
+++ b/intern/ghost/intern/GHOST_DropTargetX11.h
@@ -0,0 +1,135 @@
+/*
+ * ***** 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 the Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Sergey Sharybin.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file ghost/intern/GHOST_DropTargetWin32.h
+ *  \ingroup GHOST
+ */
+
+#ifndef __GHOST_DROPTARGETX11_H__
+#define __GHOST_DROPTARGETX11_H__
+
+#include <GHOST_Types.h>
+#include "GHOST_WindowX11.h"
+#include "GHOST_SystemX11.h"
+
+#include "xdnd.h"
+
+class GHOST_DropTargetX11
+{
+public:
+	/**
+	 * Constructor
+	 *
+	 * @param window	The window to register as drop target.
+	 * @param system	The associated system.
+	 */
+	GHOST_DropTargetX11(GHOST_WindowX11 * window, GHOST_SystemX11 * system);
+
+	/**
+	 * Destructor
+	 */
+	~GHOST_DropTargetX11();
+
+	/**
+	  * Handler of ClientMessage X11 event
+	  */
+	bool GHOST_HandleClientMessage(XEvent *event);
+
+	/**
+	 * Get data to pass in event.
+	 * It checks the type and calls specific functions for each type.
+	 * @param dropType - type of dropped entity.
+	 * @param dropBuffer - buffer returned from source application
+	 * @param dropBufferSize - size of returned buffer
+	 * @return Pointer to data.
+	 */
+	void *getGhostData(Atom dropType, unsigned char *dropBuffer, int dropBufferSize);
+
+private:
+	/* Internal helper functions */
+
+	/**
+	  * Initiailize XDND and all related X atoms
+	  */
+	void Initialize(void);
+
+	/**
+	  * Uninitiailize XDND and all related X atoms
+	  */
+	void Uninitialize(void);
+
+	/**
+	  * Get data to be passed to event from text/uri-list mime type
+	  * @param dropBuffer - buffer returned from source application
+	  * @param dropBufferSize - size of dropped buffer
+	  * @return pointer to newly created GHOST data
+	  */
+	void * getURIListGhostData(unsigned char *dropBuffer, int dropBufferSize);
+
+	/**
+	  * Decode URL (i.e. converts "file:///a%20b/test" to "file:///a b/test")
+	  * @param decodedOut - buffer for decoded URL
+	  * @param bufferSize - size of output buffer
+	  * @param encodedIn - input encoded buffer to be decoded
+	  */
+	void UrlDecode(char *decodedOut, int bufferSize, const char *encodedIn);
+
+	/**
+	  * Fully decode file URL (i.e. converts "file:///a%20b/test" to "/a b/test")
+	  * @param fileUrl - file path URL to be fully decoded
+	  * @return decoded file path (resutl shold be free-d)
+	  */
+	char *FileUrlDecode(char *fileUrl);
+
+	/* The associated GHOST_WindowWin32. */
+	GHOST_WindowX11 * m_window;
+	/* The System. */
+	GHOST_SystemX11 * m_system;
+
+	/* Data type of the dragged object */
+	GHOST_TDragnDropTypes m_draggedObjectType;
+
+	/* is dnd stuff initialzied */
+	static bool m_xdndInitialized;
+
+	/* class holding internal stiff of xdnd library */
+	static DndClass m_dndClass;
+
+	/* list of supported types to eb draggeg into */
+	static Atom * m_dndTypes;
+
+	/* list of supported dran'n'drop actions */
+	static Atom * m_dndActions;
+
+	/* List of supported MIME types to be dragged into */
+	static const char *m_dndMimeTypes[];
+
+	/* counter of references to global XDND structures */
+	static int m_refCounter;
+};
+
+#endif  // __GHOST_DROPTARGETX11_H__
diff --git a/intern/ghost/intern/GHOST_Event.h b/intern/ghost/intern/GHOST_Event.h
index aa626f8..c7f86f2 100644
--- a/intern/ghost/intern/GHOST_Event.h
+++ b/intern/ghost/intern/GHOST_Event.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_Event class.
  */
 
-#ifndef _GHOST_EVENT_H_
-#define _GHOST_EVENT_H_
+#ifndef __GHOST_EVENT_H__
+#define __GHOST_EVENT_H__
 
 #include "GHOST_IEvent.h"
 
@@ -103,5 +103,5 @@ protected:
 	GHOST_TEventDataPtr m_data;
 };
 
-#endif // _GHOST_EVENT_H_
+#endif // __GHOST_EVENT_H__
 
diff --git a/intern/ghost/intern/GHOST_EventButton.h b/intern/ghost/intern/GHOST_EventButton.h
index 3911e2a..7c86919 100644
--- a/intern/ghost/intern/GHOST_EventButton.h
+++ b/intern/ghost/intern/GHOST_EventButton.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_EventButton class.
  */
 
-#ifndef _GHOST_EVENT_BUTTON_H_
-#define _GHOST_EVENT_BUTTON_H_
+#ifndef __GHOST_EVENTBUTTON_H__
+#define __GHOST_EVENTBUTTON_H__
 
 #include "GHOST_Event.h"
 
@@ -63,5 +63,5 @@ protected:
 	GHOST_TEventButtonData m_buttonEventData;
 };
 
-#endif // _GHOST_EVENT_BUTTON_H_
+#endif // __GHOST_EVENTBUTTON_H__
 
diff --git a/intern/ghost/intern/GHOST_EventCursor.h b/intern/ghost/intern/GHOST_EventCursor.h
index 863538b..749bd8a 100644
--- a/intern/ghost/intern/GHOST_EventCursor.h
+++ b/intern/ghost/intern/GHOST_EventCursor.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_EventCursor class.
  */
 
-#ifndef _GHOST_EVENT_CURSOR_H_
-#define _GHOST_EVENT_CURSOR_H_
+#ifndef __GHOST_EVENTCURSOR_H__
+#define __GHOST_EVENTCURSOR_H__
 
 #include "GHOST_Event.h"
 
@@ -64,5 +64,5 @@ protected:
 };
 
 
-#endif // _GHOST_EVENT_CURSOR_H_
+#endif // __GHOST_EVENTCURSOR_H__
 
diff --git a/intern/ghost/intern/GHOST_EventDragnDrop.h b/intern/ghost/intern/GHOST_EventDragnDrop.h
index 330635d..4e256a3 100644
--- a/intern/ghost/intern/GHOST_EventDragnDrop.h
+++ b/intern/ghost/intern/GHOST_EventDragnDrop.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef _GHOST_EVENT_DRAGNDROP_H_
-#define _GHOST_EVENT_DRAGNDROP_H_
+#ifndef __GHOST_EVENTDRAGNDROP_H__
+#define __GHOST_EVENTDRAGNDROP_H__
 
 #include "GHOST_Event.h"
 extern "C" {
@@ -131,5 +131,5 @@ protected:
 	GHOST_TEventDragnDropData m_dragnDropEventData;
 };
 
-#endif // _GHOST_EVENT_DRAGNDROP_H_
+#endif // __GHOST_EVENTDRAGNDROP_H__
 
diff --git a/intern/ghost/intern/GHOST_EventKey.h b/intern/ghost/intern/GHOST_EventKey.h
index a602bd6..ae3ef37 100644
--- a/intern/ghost/intern/GHOST_EventKey.h
+++ b/intern/ghost/intern/GHOST_EventKey.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_EventKey class.
  */
 
-#ifndef _GHOST_EVENT_KEY_H_
-#define _GHOST_EVENT_KEY_H_
+#ifndef __GHOST_EVENTKEY_H__
+#define __GHOST_EVENTKEY_H__
 
 #include "GHOST_Event.h"
 
@@ -88,5 +88,5 @@ protected:
 	GHOST_TEventKeyData m_keyEventData;
 };
 
-#endif // _GHOST_EVENT_KEY_H_
+#endif // __GHOST_EVENTKEY_H__
 
diff --git a/intern/ghost/intern/GHOST_EventManager.h b/intern/ghost/intern/GHOST_EventManager.h
index ad2622a..bc43a5c 100644
--- a/intern/ghost/intern/GHOST_EventManager.h
+++ b/intern/ghost/intern/GHOST_EventManager.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_EventManager class.
  */
 
-#ifndef _GHOST_EVENT_MANAGER_H_
-#define _GHOST_EVENT_MANAGER_H_
+#ifndef __GHOST_EVENTMANAGER_H__
+#define __GHOST_EVENTMANAGER_H__
 
 #include <deque>
 #include <vector>
@@ -170,5 +170,5 @@ protected:
 	TConsumerVector m_consumers;
 };
 
-#endif // _GHOST_EVENT_MANAGER_H_
+#endif // __GHOST_EVENTMANAGER_H__
 
diff --git a/intern/ghost/intern/GHOST_EventNDOF.h b/intern/ghost/intern/GHOST_EventNDOF.h
index fceacce..f256f34 100644
--- a/intern/ghost/intern/GHOST_EventNDOF.h
+++ b/intern/ghost/intern/GHOST_EventNDOF.h
@@ -25,8 +25,8 @@
  * Declaration of GHOST_EventManager class.
  */
 
-#ifndef _GHOST_EVENT_NDOF_H_
-#define _GHOST_EVENT_NDOF_H_
+#ifndef __GHOST_EVENTNDOF_H__
+#define __GHOST_EVENTNDOF_H__
 
 #include "GHOST_Event.h"
 
@@ -59,4 +59,4 @@ class GHOST_EventNDOFButton : public GHOST_Event
 	};
 
 
-#endif // _GHOST_EVENT_NDOF_H_
+#endif // __GHOST_EVENTNDOF_H__
diff --git a/intern/ghost/intern/GHOST_EventPrinter.h b/intern/ghost/intern/GHOST_EventPrinter.h
index 523bd4e..7c2378d 100644
--- a/intern/ghost/intern/GHOST_EventPrinter.h
+++ b/intern/ghost/intern/GHOST_EventPrinter.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_EventPrinter class.
  */
 
-#ifndef _GHOST_EVENT_PRINTER_H_
-#define _GHOST_EVENT_PRINTER_H_
+#ifndef __GHOST_EVENTPRINTER_H__
+#define __GHOST_EVENTPRINTER_H__
 
 #include "GHOST_IEventConsumer.h"
 
@@ -60,5 +60,5 @@ protected:
 	void	getKeyString(GHOST_TKey key, char str[32]) const;
 };
 
-#endif // _GHOST_EVENT_PRINTER_H_
+#endif // __GHOST_EVENTPRINTER_H__
 
diff --git a/intern/ghost/intern/GHOST_EventString.h b/intern/ghost/intern/GHOST_EventString.h
index e8735fd..90e914e 100644
--- a/intern/ghost/intern/GHOST_EventString.h
+++ b/intern/ghost/intern/GHOST_EventString.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_EventString class.
  */
 
-#ifndef _GHOST_EVENTSTRING_H_
-#define _GHOST_EVENTSTRING_H_
+#ifndef __GHOST_EVENTSTRING_H__
+#define __GHOST_EVENTSTRING_H__
 
 #include "GHOST_Event.h"
 
@@ -62,5 +62,5 @@ public:
 	}
 };
 
-#endif // _GHOST_EVENTSTRING_H_
+#endif // __GHOST_EVENTSTRING_H__
 
diff --git a/intern/ghost/intern/GHOST_EventTrackpad.h b/intern/ghost/intern/GHOST_EventTrackpad.h
index 55517f0..9a3456b 100644
--- a/intern/ghost/intern/GHOST_EventTrackpad.h
+++ b/intern/ghost/intern/GHOST_EventTrackpad.h
@@ -31,8 +31,8 @@
  * Declaration of GHOST_EventTrackpad class.
  */
 
-#ifndef _GHOST_EVENT_TRACKPAD_H_
-#define _GHOST_EVENT_TRACKPAD_H_
+#ifndef __GHOST_EVENTTRACKPAD_H__
+#define __GHOST_EVENTTRACKPAD_H__
 
 #include "GHOST_Event.h"
 
diff --git a/intern/ghost/intern/GHOST_EventWheel.h b/intern/ghost/intern/GHOST_EventWheel.h
index 2a82ab8..1b7468d 100644
--- a/intern/ghost/intern/GHOST_EventWheel.h
+++ b/intern/ghost/intern/GHOST_EventWheel.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_EventWheel class.
  */
 
-#ifndef _GHOST_EVENT_WHEEL_H_
-#define _GHOST_EVENT_WHEEL_H_
+#ifndef __GHOST_EVENTWHEEL_H__
+#define __GHOST_EVENTWHEEL_H__
 
 #include "GHOST_Event.h"
 
@@ -64,5 +64,5 @@ protected:
 };
 
 
-#endif // _GHOST_EVENT_WHEEL_H_
+#endif // __GHOST_EVENTWHEEL_H__
 
diff --git a/intern/ghost/intern/GHOST_ModifierKeys.h b/intern/ghost/intern/GHOST_ModifierKeys.h
index 1cb1272..0b69032 100644
--- a/intern/ghost/intern/GHOST_ModifierKeys.h
+++ b/intern/ghost/intern/GHOST_ModifierKeys.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_ModifierKeys struct.
  */
 
-#ifndef _GHOST_MODIFIER_KEYS_H_
-#define _GHOST_MODIFIER_KEYS_H_
+#ifndef __GHOST_MODIFIERKEYS_H__
+#define __GHOST_MODIFIERKEYS_H__
 
 #include "GHOST_Types.h"
 
@@ -100,5 +100,5 @@ struct GHOST_ModifierKeys
 	GHOST_TUns8 m_OS : 1;
 };
 
-#endif // _GHOST_MODIFIER_KEYS_H_
+#endif // __GHOST_MODIFIERKEYS_H__
 
diff --git a/intern/ghost/intern/GHOST_NDOFManager.cpp b/intern/ghost/intern/GHOST_NDOFManager.cpp
index 0f5149d..694394a 100644
--- a/intern/ghost/intern/GHOST_NDOFManager.cpp
+++ b/intern/ghost/intern/GHOST_NDOFManager.cpp
@@ -66,6 +66,11 @@ static const char* ndof_button_names[] = {
 	"NDOF_BUTTON_DOMINANT",
 	"NDOF_BUTTON_PLUS",
 	"NDOF_BUTTON_MINUS",
+	// keyboard emulation
+	"NDOF_BUTTON_ESC",
+	"NDOF_BUTTON_ALT",
+	"NDOF_BUTTON_SHIFT",
+	"NDOF_BUTTON_CTRL",
 	// general-purpose buttons
 	"NDOF_BUTTON_1",
 	"NDOF_BUTTON_2",
@@ -86,30 +91,10 @@ static const char* ndof_button_names[] = {
 };
 #endif
 
-static const NDOF_ButtonT SpaceNavigator_HID_map[] = {
-	NDOF_BUTTON_MENU,
-	NDOF_BUTTON_FIT
-};
-
-static const NDOF_ButtonT SpaceExplorer_HID_map[] = {
-	NDOF_BUTTON_1,
-	NDOF_BUTTON_2,
-	NDOF_BUTTON_TOP,
-	NDOF_BUTTON_LEFT,
-	NDOF_BUTTON_RIGHT,
-	NDOF_BUTTON_FRONT,
-	NDOF_BUTTON_NONE, // esc key
-	NDOF_BUTTON_NONE, // alt key
-	NDOF_BUTTON_NONE, // shift key
-	NDOF_BUTTON_NONE, // ctrl key
-	NDOF_BUTTON_FIT,
-	NDOF_BUTTON_MENU,
-	NDOF_BUTTON_PLUS,
-	NDOF_BUTTON_MINUS,
-	NDOF_BUTTON_ROTATE
-};
-
-static const NDOF_ButtonT SpacePilotPro_HID_map[] = {
+// shared by the latest 3Dconnexion hardware
+// SpacePilotPro uses all of these
+// smaller devices use only some, based on button mask
+static const NDOF_ButtonT Modern3Dx_HID_map[] = {
 	NDOF_BUTTON_MENU,
 	NDOF_BUTTON_FIT,
 	NDOF_BUTTON_TOP,
@@ -132,10 +117,10 @@ static const NDOF_ButtonT SpacePilotPro_HID_map[] = {
 	NDOF_BUTTON_8,
 	NDOF_BUTTON_9,
 	NDOF_BUTTON_10,
-	NDOF_BUTTON_NONE, // esc key
-	NDOF_BUTTON_NONE, // alt key
-	NDOF_BUTTON_NONE, // shift key
-	NDOF_BUTTON_NONE, // ctrl key
+	NDOF_BUTTON_ESC,
+	NDOF_BUTTON_ALT,
+	NDOF_BUTTON_SHIFT,
+	NDOF_BUTTON_CTRL,
 	NDOF_BUTTON_ROTATE,
 	NDOF_BUTTON_PANZOOM,
 	NDOF_BUTTON_DOMINANT,
@@ -143,35 +128,22 @@ static const NDOF_ButtonT SpacePilotPro_HID_map[] = {
 	NDOF_BUTTON_MINUS
 };
 
-// latest HW: button-compatible with SpacePilotPro, just fewer of them
-static const NDOF_ButtonT SpaceMousePro_HID_map[] = {
-	NDOF_BUTTON_MENU,
-	NDOF_BUTTON_FIT,
+static const NDOF_ButtonT SpaceExplorer_HID_map[] = {
+	NDOF_BUTTON_1,
+	NDOF_BUTTON_2,
 	NDOF_BUTTON_TOP,
-	NDOF_BUTTON_NONE, // left
+	NDOF_BUTTON_LEFT,
 	NDOF_BUTTON_RIGHT,
 	NDOF_BUTTON_FRONT,
-	NDOF_BUTTON_NONE, // bottom
-	NDOF_BUTTON_NONE, // back
-	NDOF_BUTTON_ROLL_CW,
-	NDOF_BUTTON_NONE, // roll ccw
-	NDOF_BUTTON_NONE, // iso 1
-	NDOF_BUTTON_NONE, // iso 2
-	NDOF_BUTTON_1,
-	NDOF_BUTTON_2,
-	NDOF_BUTTON_3,
-	NDOF_BUTTON_4,
-	NDOF_BUTTON_NONE, // 5
-	NDOF_BUTTON_NONE, // 6
-	NDOF_BUTTON_NONE, // 7
-	NDOF_BUTTON_NONE, // 8
-	NDOF_BUTTON_NONE, // 9
-	NDOF_BUTTON_NONE, // 10
-	NDOF_BUTTON_NONE, // esc key
-	NDOF_BUTTON_NONE, // alt key
-	NDOF_BUTTON_NONE, // shift key
-	NDOF_BUTTON_NONE, // ctrl key
-	NDOF_BUTTON_ROTATE,
+	NDOF_BUTTON_ESC,
+	NDOF_BUTTON_ALT,
+	NDOF_BUTTON_SHIFT,
+	NDOF_BUTTON_CTRL,
+	NDOF_BUTTON_FIT,
+	NDOF_BUTTON_MENU,
+	NDOF_BUTTON_PLUS,
+	NDOF_BUTTON_MINUS,
+	NDOF_BUTTON_ROTATE
 };
 
 /* this is the older SpacePilot (sans Pro)
@@ -187,10 +159,10 @@ static const NDOF_ButtonT SpacePilot_HID_map[] = {
 	NDOF_BUTTON_LEFT,
 	NDOF_BUTTON_RIGHT,
 	NDOF_BUTTON_FRONT,
-	NDOF_BUTTON_NONE, // esc key
-	NDOF_BUTTON_NONE, // alt key
-	NDOF_BUTTON_NONE, // shift key
-	NDOF_BUTTON_NONE, // ctrl key
+	NDOF_BUTTON_ESC,
+	NDOF_BUTTON_ALT,
+	NDOF_BUTTON_SHIFT,
+	NDOF_BUTTON_CTRL,
 	NDOF_BUTTON_FIT,
 	NDOF_BUTTON_MENU,
 	NDOF_BUTTON_PLUS,
@@ -200,9 +172,7 @@ static const NDOF_ButtonT SpacePilot_HID_map[] = {
 	NDOF_BUTTON_NONE // the CONFIG button -- what does it do?
 };
 
-/* this is the older Spaceball 5000 USB
- * thanks to Tehrasha Darkon for info about this device */
-static const NDOF_ButtonT Spaceball5000_HID_map[] = {
+static const NDOF_ButtonT Generic_HID_map[] = {
 	NDOF_BUTTON_1,
 	NDOF_BUTTON_2,
 	NDOF_BUTTON_3,
@@ -217,11 +187,14 @@ static const NDOF_ButtonT Spaceball5000_HID_map[] = {
 	NDOF_BUTTON_C
 };
 
+static const int genericButtonCount = sizeof(Generic_HID_map) / sizeof(NDOF_ButtonT);
+
 GHOST_NDOFManager::GHOST_NDOFManager(GHOST_System& sys)
 	: m_system(sys)
 	, m_deviceType(NDOF_UnknownDevice) // each platform has its own device detection code
-	, m_buttonCount(0)
+	, m_buttonCount(genericButtonCount)
 	, m_buttonMask(0)
+	, m_hidMap(Generic_HID_map)
 	, m_buttons(0)
 	, m_motionTime(0)
 	, m_prevMotionTime(0)
@@ -237,38 +210,53 @@ GHOST_NDOFManager::GHOST_NDOFManager(GHOST_System& sys)
 
 bool GHOST_NDOFManager::setDevice(unsigned short vendor_id, unsigned short product_id)
 {
-	// default to NDOF_UnknownDevice so rogue button events will get discarded
+	// call this function until it returns true
+	// it's a good idea to stop calling it after that, as it will "forget"
+	// whichever device it already found
+
+	// default to safe generic behavior for "unknown" devices
+	// unidentified devices will emit motion events like normal
+	// rogue buttons do nothing by default, but can be customized by the user
+
+	m_deviceType = NDOF_UnknownDevice;
+	m_hidMap = Generic_HID_map;
+	m_buttonCount = genericButtonCount;
+	m_buttonMask = 0;
+
 	// "mystery device" owners can help build a HID_map for their hardware
+	// A few users have already contributed information about several older devices
+	// that I don't have access to. Thanks!
 
 	switch (vendor_id) {
 		case 0x046D: // Logitech (3Dconnexion)
 			switch (product_id) {
 				// -- current devices --
-				case 0xC626:
+				case 0xC626: // full-size SpaceNavigator
+				case 0xC628: // the "for Notebooks" one
 					puts("ndof: using SpaceNavigator");
 					m_deviceType = NDOF_SpaceNavigator;
 					m_buttonCount = 2;
-					break;
-				case 0xC628:
-					puts("ndof: using SpaceNavigator for Notebooks");
-					m_deviceType = NDOF_SpaceNavigator; // for Notebooks
-					m_buttonCount = 2;
+					m_hidMap = Modern3Dx_HID_map;
 					break;
 				case 0xC627:
 					puts("ndof: using SpaceExplorer");
 					m_deviceType = NDOF_SpaceExplorer;
 					m_buttonCount = 15;
+					m_hidMap = SpaceExplorer_HID_map;
 					break;
 				case 0xC629:
 					puts("ndof: using SpacePilot Pro");
 					m_deviceType = NDOF_SpacePilotPro;
 					m_buttonCount = 31;
+					m_hidMap = Modern3Dx_HID_map;
 					break;
 				case 0xC62B:
 					puts("ndof: using SpaceMouse Pro");
 					m_deviceType = NDOF_SpaceMousePro;
 					m_buttonCount = 27;
 					// ^^ actually has 15 buttons, but their HID codes range from 0 to 26
+					m_buttonMask = 0x07C0F137;
+					m_hidMap = Modern3Dx_HID_map;
 					break;
 
 				// -- older devices --
@@ -276,16 +264,16 @@ bool GHOST_NDOFManager::setDevice(unsigned short vendor_id, unsigned short produ
 					puts("ndof: using SpacePilot");
 					m_deviceType = NDOF_SpacePilot;
 					m_buttonCount = 21;
+					m_hidMap = SpacePilot_HID_map;
 					break;
-
 				case 0xC621:
 					puts("ndof: using Spaceball 5000");
 					m_deviceType = NDOF_Spaceball5000;
 					m_buttonCount = 12;
 					break;
-
 				case 0xC623:
-					puts("ndof: SpaceTraveler not supported, please file a bug report");
+					puts("ndof: using SpaceTraveler");
+					m_deviceType = NDOF_SpaceTraveler;
 					m_buttonCount = 8;
 					break;
 
@@ -297,20 +285,14 @@ bool GHOST_NDOFManager::setDevice(unsigned short vendor_id, unsigned short produ
 			printf("ndof: unknown device %04hx:%04hx\n", vendor_id, product_id);
 	}
 
-	if (m_deviceType == NDOF_UnknownDevice) {
-		return false;
-	}
-	else {
+	if (m_buttonMask == 0)
 		m_buttonMask = ~(-1 << m_buttonCount);
 
-		// special case for SpaceMousePro? maybe...
-
 #ifdef DEBUG_NDOF_BUTTONS
-		printf("ndof: %d buttons -> hex:%X\n", m_buttonCount, m_buttonMask);
+	printf("ndof: %d buttons -> hex:%X\n", m_buttonCount, m_buttonMask);
 #endif
 
-		return true;
-	}
+	return m_deviceType != NDOF_UnknownDevice;
 }
 
 void GHOST_NDOFManager::updateTranslation(short t[3], GHOST_TUns64 time)
@@ -329,15 +311,8 @@ void GHOST_NDOFManager::updateRotation(short r[3], GHOST_TUns64 time)
 
 void GHOST_NDOFManager::sendButtonEvent(NDOF_ButtonT button, bool press, GHOST_TUns64 time, GHOST_IWindow* window)
 {
-	if (button == NDOF_BUTTON_NONE) {
-		// just being exceptionally cautious...
-		// air-tight button masking and proper function key emulation
-		// should guarantee we never get to this point
-#ifdef DEBUG_NDOF_BUTTONS
-		printf("discarding NDOF_BUTTON_NONE (should not escape the NDOF manager)\n");
-#endif
-		return;
-	}
+	GHOST_ASSERT(button > NDOF_BUTTON_NONE && button < NDOF_BUTTON_LAST,
+		"rogue button trying to escape NDOF manager");
 
 	GHOST_EventNDOFButton* event = new GHOST_EventNDOFButton(time, window);
 	GHOST_TEventNDOFButtonData* data = (GHOST_TEventNDOFButtonData*) event->getData();
@@ -369,66 +344,23 @@ void GHOST_NDOFManager::updateButton(int button_number, bool press, GHOST_TUns64
 	GHOST_IWindow* window = m_system.getWindowManager()->getActiveWindow();
 
 #ifdef DEBUG_NDOF_BUTTONS
-	if (m_deviceType != NDOF_UnknownDevice)
-		printf("ndof: button %d -> ", button_number);
+	printf("ndof: button %d -> ", button_number);
 #endif
 
-	switch (m_deviceType) {
-		case NDOF_SpaceNavigator:
-			sendButtonEvent(SpaceNavigator_HID_map[button_number], press, time, window);
-			break;
-		case NDOF_SpaceExplorer:
-			switch (button_number) {
-				case 6: sendKeyEvent(GHOST_kKeyEsc, press, time, window); break;
-				case 7: sendKeyEvent(GHOST_kKeyLeftAlt, press, time, window); break;
-				case 8: sendKeyEvent(GHOST_kKeyLeftShift, press, time, window); break;
-				case 9: sendKeyEvent(GHOST_kKeyLeftControl, press, time, window); break;
-				default: sendButtonEvent(SpaceExplorer_HID_map[button_number], press, time, window);
-			}
-			break;
-		case NDOF_SpacePilotPro:
-			switch (button_number) {
-				case 22: sendKeyEvent(GHOST_kKeyEsc, press, time, window); break;
-				case 23: sendKeyEvent(GHOST_kKeyLeftAlt, press, time, window); break;
-				case 24: sendKeyEvent(GHOST_kKeyLeftShift, press, time, window); break;
-				case 25: sendKeyEvent(GHOST_kKeyLeftControl, press, time, window); break;
-				default: sendButtonEvent(SpacePilotPro_HID_map[button_number], press, time, window);
-			}
-			break;
-		case NDOF_SpaceMousePro:
-			switch (button_number) {
-				case 22: sendKeyEvent(GHOST_kKeyEsc, press, time, window); break;
-				case 23: sendKeyEvent(GHOST_kKeyLeftAlt, press, time, window); break;
-				case 24: sendKeyEvent(GHOST_kKeyLeftShift, press, time, window); break;
-				case 25: sendKeyEvent(GHOST_kKeyLeftControl, press, time, window); break;
-				default: sendButtonEvent(SpaceMousePro_HID_map[button_number], press, time, window);
-			}
-			break;
-		case NDOF_SpacePilot:
-			switch (button_number) {
-				case 10: sendKeyEvent(GHOST_kKeyEsc, press, time, window); break;
-				case 11: sendKeyEvent(GHOST_kKeyLeftAlt, press, time, window); break;
-				case 12: sendKeyEvent(GHOST_kKeyLeftShift, press, time, window); break;
-				case 13: sendKeyEvent(GHOST_kKeyLeftControl, press, time, window); break;
-				case 20: puts("ndof: ignoring CONFIG button"); break;
-				default: sendButtonEvent(SpacePilot_HID_map[button_number], press, time, window);
-			}
-			break;
-		case NDOF_Spaceball5000:
-			// has no special 'keyboard' buttons
-			sendButtonEvent(Spaceball5000_HID_map[button_number], press, time, window);
+	NDOF_ButtonT button = (button_number < m_buttonCount) ? m_hidMap[button_number] : NDOF_BUTTON_NONE;
+
+	switch (button)
+	{
+		case NDOF_BUTTON_NONE:
+#ifdef DEBUG_NDOF_BUTTONS
+			printf("discarded\n");
+#endif
 			break;
-		case NDOF_UnknownDevice:
-			printf("ndof: button %d on unknown device (", button_number);
-			// map to the 'general purpose' buttons
-			// this is mainly for old serial devices
-			if (button_number < NDOF_BUTTON_LAST - NDOF_BUTTON_1) {
-				printf("sending)\n");
-				sendButtonEvent((NDOF_ButtonT)(NDOF_BUTTON_1 + button_number), press, time, window);
-			}
-			else {
-				printf("discarding)\n");
-			}
+		case NDOF_BUTTON_ESC: sendKeyEvent(GHOST_kKeyEsc, press, time, window); break;
+		case NDOF_BUTTON_ALT: sendKeyEvent(GHOST_kKeyLeftAlt, press, time, window); break;
+		case NDOF_BUTTON_SHIFT: sendKeyEvent(GHOST_kKeyLeftShift, press, time, window); break;
+		case NDOF_BUTTON_CTRL: sendKeyEvent(GHOST_kKeyLeftControl, press, time, window); break;
+		default: sendButtonEvent(button, press, time, window);
 	}
 
 	int mask = 1 << button_number;
@@ -558,6 +490,9 @@ bool GHOST_NDOFManager::sendMotionEvent()
 	printf("ndof motion sent -- %s\n", progress_string[data->progress]);
 
 	// show details about this motion event
+	printf("    T=(%d,%d,%d) R=(%d,%d,%d) raw\n",
+	       m_translation[0], m_translation[1], m_translation[2],
+	       m_rotation[0], m_rotation[1], m_rotation[2]);
 	printf("    T=(%.2f,%.2f,%.2f) R=(%.2f,%.2f,%.2f) dt=%.3f\n",
 	       data->tx, data->ty, data->tz,
 	       data->rx, data->ry, data->rz,
diff --git a/intern/ghost/intern/GHOST_NDOFManager.h b/intern/ghost/intern/GHOST_NDOFManager.h
index c4e980b..5e16c3f 100644
--- a/intern/ghost/intern/GHOST_NDOFManager.h
+++ b/intern/ghost/intern/GHOST_NDOFManager.h
@@ -21,8 +21,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
  
-#ifndef _GHOST_NDOFMANAGER_H_
-#define _GHOST_NDOFMANAGER_H_
+#ifndef __GHOST_NDOFMANAGER_H__
+#define __GHOST_NDOFMANAGER_H__
 
 #include "GHOST_System.h"
 
@@ -31,7 +31,7 @@
 // #define DEBUG_NDOF_BUTTONS
 
 typedef enum {
-	NDOF_UnknownDevice, // <-- motion will work fine, buttons are ignored
+	NDOF_UnknownDevice,
 
 	// current devices
 	NDOF_SpaceNavigator,
@@ -41,7 +41,8 @@ typedef enum {
 
 	// older devices
 	NDOF_SpacePilot,
-	NDOF_Spaceball5000
+	NDOF_Spaceball5000,
+	NDOF_SpaceTraveler
 
 	} NDOF_DeviceT;
 
@@ -76,6 +77,11 @@ typedef enum {
 	NDOF_BUTTON_DOMINANT,
 	NDOF_BUTTON_PLUS,
 	NDOF_BUTTON_MINUS,
+	// keyboard emulation
+	NDOF_BUTTON_ESC,
+	NDOF_BUTTON_ALT,
+	NDOF_BUTTON_SHIFT,
+	NDOF_BUTTON_CTRL,
 	// general-purpose buttons
 	// users can assign functions via keymap editor
 	NDOF_BUTTON_1,
@@ -149,6 +155,7 @@ private:
 	NDOF_DeviceT m_deviceType;
 	int m_buttonCount;
 	int m_buttonMask;
+	const NDOF_ButtonT* m_hidMap;
 
 	short m_translation[3];
 	short m_rotation[3];
diff --git a/intern/ghost/intern/GHOST_NDOFManagerCocoa.h b/intern/ghost/intern/GHOST_NDOFManagerCocoa.h
index 7a33d84..8d8081e 100644
--- a/intern/ghost/intern/GHOST_NDOFManagerCocoa.h
+++ b/intern/ghost/intern/GHOST_NDOFManagerCocoa.h
@@ -21,8 +21,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef _GHOST_NDOFMANAGERCOCOA_H_
-#define _GHOST_NDOFMANAGERCOCOA_H_
+#ifndef __GHOST_NDOFMANAGERCOCOA_H__
+#define __GHOST_NDOFMANAGERCOCOA_H__
 
 #ifdef WITH_INPUT_NDOF
 
diff --git a/intern/ghost/intern/GHOST_NDOFManagerWin32.h b/intern/ghost/intern/GHOST_NDOFManagerWin32.h
index 6711476..9b51928 100644
--- a/intern/ghost/intern/GHOST_NDOFManagerWin32.h
+++ b/intern/ghost/intern/GHOST_NDOFManagerWin32.h
@@ -22,8 +22,8 @@
  */
 
 
-#ifndef _GHOST_NDOFMANAGERWIN32_H_
-#define _GHOST_NDOFMANAGERWIN32_H_
+#ifndef __GHOST_NDOFMANAGERWIN32_H__
+#define __GHOST_NDOFMANAGERWIN32_H__
 
 #ifdef WITH_INPUT_NDOF
 
diff --git a/intern/ghost/intern/GHOST_NDOFManagerX11.cpp b/intern/ghost/intern/GHOST_NDOFManagerX11.cpp
index 1e025cd..1e78caf 100644
--- a/intern/ghost/intern/GHOST_NDOFManagerX11.cpp
+++ b/intern/ghost/intern/GHOST_NDOFManagerX11.cpp
@@ -75,28 +75,32 @@ bool GHOST_NDOFManagerX11::available()
 
 bool GHOST_NDOFManagerX11::processEvents()
 {
-	GHOST_TUns64 now = m_system.getMilliSeconds();
-
 	bool anyProcessed = false;
-	spnav_event e;
-	while (spnav_poll_event(&e)) {
-		switch (e.type) {
-			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};
 
-				updateTranslation(t, now);
-				updateRotation(r, now);
-				break;
+	if (m_available) {
+		GHOST_TUns64 now = m_system.getMilliSeconds();
+
+		spnav_event e;
+		while (spnav_poll_event(&e)) {
+			switch (e.type) {
+				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};
+
+					updateTranslation(t, now);
+					updateRotation(r, now);
+					break;
+				}
+				case SPNAV_EVENT_BUTTON:
+					updateButton(e.button.bnum, e.button.press, now);
+					break;
 			}
-			case SPNAV_EVENT_BUTTON:
-				updateButton(e.button.bnum, e.button.press, now);
-				break;
+			anyProcessed = true;
 		}
-		anyProcessed = true;
 	}
+
 	return anyProcessed;
 }
 
diff --git a/intern/ghost/intern/GHOST_NDOFManagerX11.h b/intern/ghost/intern/GHOST_NDOFManagerX11.h
index 6873318..4629bae 100644
--- a/intern/ghost/intern/GHOST_NDOFManagerX11.h
+++ b/intern/ghost/intern/GHOST_NDOFManagerX11.h
@@ -21,8 +21,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
  
-#ifndef _GHOST_NDOFMANAGERX11_H_
-#define _GHOST_NDOFMANAGERX11_H_
+#ifndef __GHOST_NDOFMANAGERX11_H__
+#define __GHOST_NDOFMANAGERX11_H__
 
 #ifdef WITH_INPUT_NDOF
 
diff --git a/intern/ghost/intern/GHOST_System.cpp b/intern/ghost/intern/GHOST_System.cpp
index 944ade3..974f66c 100644
--- a/intern/ghost/intern/GHOST_System.cpp
+++ b/intern/ghost/intern/GHOST_System.cpp
@@ -366,3 +366,9 @@ GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window** window, const
 	}
 	return success;
 }
+
+
+int GHOST_System::confirmQuit(GHOST_IWindow * window) const
+{
+	return 1;
+}
diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h
index 0bb0387..15a7cf1 100644
--- a/intern/ghost/intern/GHOST_System.h
+++ b/intern/ghost/intern/GHOST_System.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_System class.
  */
 
-#ifndef _GHOST_SYSTEM_H_
-#define _GHOST_SYSTEM_H_
+#ifndef __GHOST_SYSTEM_H__
+#define __GHOST_SYSTEM_H__
 
 #include "GHOST_ISystem.h"
 
@@ -297,6 +297,13 @@ public:
 	   */
 	  virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
 
+	 /**
+	 * Confirms quitting he program when there is just one window left open
+	 * in the application
+	 */
+	virtual int confirmQuit(GHOST_IWindow * window) const;
+
+
 	
 protected:
 	/**
@@ -367,5 +374,5 @@ inline GHOST_NDOFManager* GHOST_System::getNDOFManager() const
 }
 #endif
 
-#endif // _GHOST_SYSTEM_H_
+#endif // __GHOST_SYSTEM_H__
 
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.h b/intern/ghost/intern/GHOST_SystemCarbon.h
index 1f51b07..cda0948 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.h
+++ b/intern/ghost/intern/GHOST_SystemCarbon.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_SystemCarbon class.
  */
 
-#ifndef _GHOST_SYSTEM_CARBON_H_
-#define _GHOST_SYSTEM_CARBON_H_
+#ifndef __GHOST_SYSTEMCARBON_H__
+#define __GHOST_SYSTEMCARBON_H__
 
 #ifndef __APPLE__
 #error Apple OSX only!
@@ -285,5 +285,5 @@ protected:
 	bool m_ignoreWindowSizedMessages;
 };
 
-#endif // _GHOST_SYSTEM_CARBON_H_
+#endif // __GHOST_SYSTEMCARBON_H__
 
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h
index 581535e..2220955 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.h
+++ b/intern/ghost/intern/GHOST_SystemCocoa.h
@@ -31,8 +31,8 @@
  * Declaration of GHOST_SystemCocoa class.
  */
 
-#ifndef _GHOST_SYSTEM_COCOA_H_
-#define _GHOST_SYSTEM_COCOA_H_
+#ifndef __GHOST_SYSTEMCOCOA_H__
+#define __GHOST_SYSTEMCOCOA_H__
 
 #ifndef __APPLE__
 #error Apple OSX only!
@@ -300,5 +300,5 @@ protected:
 	bool m_isGestureInProgress;
 };
 
-#endif // _GHOST_SYSTEM_COCOA_H_
+#endif // __GHOST_SYSTEMCOCOA_H__
 
diff --git a/intern/ghost/intern/GHOST_SystemNULL.h b/intern/ghost/intern/GHOST_SystemNULL.h
index f89eb77..be16a82 100644
--- a/intern/ghost/intern/GHOST_SystemNULL.h
+++ b/intern/ghost/intern/GHOST_SystemNULL.h
@@ -25,8 +25,8 @@
  * Declaration of GHOST_SystemNULL class.
  */
 
-#ifndef _GHOST_SYSTEM_NULL_H_
-#define _GHOST_SYSTEM_NULL_H_
+#ifndef __GHOST_SYSTEMNULL_H__
+#define __GHOST_SYSTEMNULL_H__
 
 #include "GHOST_System.h"
 #include "../GHOST_Types.h"
diff --git a/intern/ghost/intern/GHOST_SystemPaths.h b/intern/ghost/intern/GHOST_SystemPaths.h
index 739fd4e..472d636 100644
--- a/intern/ghost/intern/GHOST_SystemPaths.h
+++ b/intern/ghost/intern/GHOST_SystemPaths.h
@@ -28,8 +28,8 @@
  *  \ingroup GHOST
  */
 
-#ifndef _GHOST_SYSTEMPATHS_H_
-#define _GHOST_SYSTEMPATHS_H_
+#ifndef __GHOST_SYSTEMPATHS_H__
+#define __GHOST_SYSTEMPATHS_H__
 
 #include "GHOST_ISystemPaths.h"
 
diff --git a/intern/ghost/intern/GHOST_SystemPathsCarbon.h b/intern/ghost/intern/GHOST_SystemPathsCarbon.h
index f660148..4a1f68e 100644
--- a/intern/ghost/intern/GHOST_SystemPathsCarbon.h
+++ b/intern/ghost/intern/GHOST_SystemPathsCarbon.h
@@ -29,8 +29,8 @@
  */
 
 
-#ifndef _GHOST_SYSTEM_PATHS_CARBON_H_
-#define _GHOST_SYSTEM_PATHS_CARBON_H_
+#ifndef __GHOST_SYSTEMPATHSCARBON_H__
+#define __GHOST_SYSTEMPATHSCARBON_H__
 
 #ifndef __APPLE__
 #error Apple OSX only!
@@ -84,7 +84,4 @@ public:
 	void addToSystemRecentFiles(const char* filename) const;
 };
 
-#endif // _GHOST_SYSTEM_CARBON_H_
-
-
-
+#endif // __GHOST_SYSTEMPATHSCARBON_H__
diff --git a/intern/ghost/intern/GHOST_SystemPathsCocoa.h b/intern/ghost/intern/GHOST_SystemPathsCocoa.h
index 2b86659..1936d70 100644
--- a/intern/ghost/intern/GHOST_SystemPathsCocoa.h
+++ b/intern/ghost/intern/GHOST_SystemPathsCocoa.h
@@ -29,8 +29,8 @@
  */
 
 
-#ifndef _GHOST_SYSTEM_PATHS_COCOA_H_
-#define _GHOST_SYSTEM_PATHS_COCOA_H_
+#ifndef __GHOST_SYSTEMPATHSCOCOA_H__
+#define __GHOST_SYSTEMPATHSCOCOA_H__
 
 #ifndef __APPLE__
 #error Apple OSX only!
@@ -78,5 +78,4 @@ public:
 	void addToSystemRecentFiles(const char* filename) const;
 };
 
-#endif // _GHOST_SYSTEM_COCOA_H_
-
+#endif // __GHOST_SYSTEMPATHSCOCOA_H__
diff --git a/intern/ghost/intern/GHOST_SystemPathsWin32.cpp b/intern/ghost/intern/GHOST_SystemPathsWin32.cpp
index 379e196..0023ceb 100644
--- a/intern/ghost/intern/GHOST_SystemPathsWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemPathsWin32.cpp
@@ -35,6 +35,7 @@
 #define _WIN32_IE 0x0501
 #endif
 #include <shlobj.h>
+#include "utfconv.h"
 
 #if defined(__MINGW32__) || defined(__CYGWIN__)
 
@@ -46,7 +47,7 @@
 #define SHARD_PATHA     0x00000002L
 #endif
 
-#if !defined(SHARD_PATHA)
+#if !defined(SHARD_PATHW)
 #define SHARD_PATHW     0x00000003L
 #endif
 
@@ -70,11 +71,14 @@ GHOST_SystemPathsWin32::~GHOST_SystemPathsWin32()
 
 const GHOST_TUns8* GHOST_SystemPathsWin32::getSystemDir() const
 {
-	static char knownpath[MAX_PATH];
-	HRESULT hResult = SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT, knownpath);
+	static char knownpath[MAX_PATH*3] = {0}; /* 1 utf-16 might translante into 3 utf-8. 2 utf-16 translates into 4 utf-8*/
+	wchar_t knownpath_16[MAX_PATH];
+
+	HRESULT hResult = SHGetFolderPathW(NULL, CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT, knownpath_16);
 
 	if (hResult == S_OK)
 	{
+		conv_utf_16_to_8(knownpath_16,knownpath,MAX_PATH*3);
 		return (GHOST_TUns8*)knownpath;
 	}
 
@@ -83,11 +87,14 @@ const GHOST_TUns8* GHOST_SystemPathsWin32::getSystemDir() const
 
 const GHOST_TUns8* GHOST_SystemPathsWin32::getUserDir() const
 {
-	static char knownpath[MAX_PATH];
-	HRESULT hResult = SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, knownpath);
+	static char knownpath[MAX_PATH*3] = {0};
+	wchar_t  knownpath_16[MAX_PATH];
+
+	HRESULT hResult = SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, knownpath_16);
 
 	if (hResult == S_OK)
 	{
+		conv_utf_16_to_8(knownpath_16,knownpath,MAX_PATH*3);
 		return (GHOST_TUns8*)knownpath;
 	}
 
@@ -96,16 +103,21 @@ const GHOST_TUns8* GHOST_SystemPathsWin32::getUserDir() const
 
 const GHOST_TUns8* GHOST_SystemPathsWin32::getBinaryDir() const
 {
-	static char fullname[MAX_PATH];
-	if(GetModuleFileName(0, fullname, MAX_PATH)) {
+	static char fullname[MAX_PATH*3] = {0};
+	wchar_t  fullname_16[MAX_PATH*3];
+
+	if(GetModuleFileNameW(0, fullname_16, MAX_PATH)) {
+		conv_utf_16_to_8(fullname_16,fullname,MAX_PATH*3);
 		return (GHOST_TUns8*)fullname;
 	}
 
 	return NULL;
 }
 
-void GHOST_SystemPathsWin32::addToSystemRecentFiles(const char* filename) const
+void GHOST_SystemPathsWin32::addToSystemRecentFiles(const char *filename) const
 {
 	/* SHARD_PATH resolves to SHARD_PATHA for non-UNICODE build */
-	SHAddToRecentDocs(SHARD_PATH,filename);
+	UTF16_ENCODE(filename);
+	SHAddToRecentDocs(SHARD_PATHW, filename_16);
+	UTF16_UN_ENCODE(filename);
 }
diff --git a/intern/ghost/intern/GHOST_SystemPathsWin32.h b/intern/ghost/intern/GHOST_SystemPathsWin32.h
index dd875d4..f53b33d 100644
--- a/intern/ghost/intern/GHOST_SystemPathsWin32.h
+++ b/intern/ghost/intern/GHOST_SystemPathsWin32.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef _GHOST_SYSTEM_PATHS_WIN32_H_
-#define _GHOST_SYSTEM_PATHS_WIN32_H_
+#ifndef __GHOST_SYSTEMPATHSWIN32_H__
+#define __GHOST_SYSTEMPATHSWIN32_H__
 
 #ifndef WIN32
 #error WIN32 only!
@@ -85,8 +85,8 @@ public:
 	/**
 	 * Add the file to the operating system most recently used files
 	 */
-	void addToSystemRecentFiles(const char* filename) const;
+	void addToSystemRecentFiles(const char *filename) const;
 };
 
-#endif // _GHOST_SYSTEM_PATHS_WIN32_H_
+#endif // __GHOST_SYSTEMPATHSWIN32_H__
 
diff --git a/intern/ghost/intern/GHOST_SystemPathsX11.cpp b/intern/ghost/intern/GHOST_SystemPathsX11.cpp
index 7261491..6dad366 100644
--- a/intern/ghost/intern/GHOST_SystemPathsX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemPathsX11.cpp
@@ -47,7 +47,7 @@
 #endif
 
 #ifdef PREFIX
-static const char *static_path= PREFIX "/share" ;
+static const char *static_path= PREFIX "/share";
 #else
 static const char *static_path= NULL;
 #endif
diff --git a/intern/ghost/intern/GHOST_SystemPathsX11.h b/intern/ghost/intern/GHOST_SystemPathsX11.h
index a0a1d28..d05cab5 100644
--- a/intern/ghost/intern/GHOST_SystemPathsX11.h
+++ b/intern/ghost/intern/GHOST_SystemPathsX11.h
@@ -29,8 +29,8 @@
  */
 
 
-#ifndef _GHOST_SYSTEM_PATHS_X11_H_
-#define _GHOST_SYSTEM_PATHS_X11_H_
+#ifndef __GHOST_SYSTEMPATHSX11_H__
+#define __GHOST_SYSTEMPATHSX11_H__
 
 #include "GHOST_SystemPaths.h"
 #include "../GHOST_Types.h"
diff --git a/intern/ghost/intern/GHOST_SystemSDL.cpp b/intern/ghost/intern/GHOST_SystemSDL.cpp
index dd5124a..a2b457c 100644
--- a/intern/ghost/intern/GHOST_SystemSDL.cpp
+++ b/intern/ghost/intern/GHOST_SystemSDL.cpp
@@ -76,6 +76,17 @@ GHOST_SystemSDL::createWindow(const STR_String& title,
 	window= new GHOST_WindowSDL (this, title, left, top, width, height, state, parentWindow, type, stereoVisual, 1);
 
 	if (window) {
+		if (GHOST_kWindowStateFullScreen == state) {
+			SDL_Window *sdl_win = window->getSDLWindow();
+			SDL_DisplayMode mode;
+
+			static_cast<GHOST_DisplayManagerSDL *> (m_displayManager)->getCurrentDisplayModeSDL(mode);
+
+			SDL_SetWindowDisplayMode(sdl_win, &mode);
+			SDL_ShowWindow(sdl_win);
+			SDL_SetWindowFullscreen(sdl_win, SDL_TRUE);
+		}
+
 		if (window->getValid()) {
 			m_windowManager->addWindow(window);
 			pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window));
@@ -481,8 +492,8 @@ GHOST_SystemSDL::setCursorPosition(GHOST_TInt32 x,
 bool
 GHOST_SystemSDL::generateWindowExposeEvents()
 {
-	vector<GHOST_WindowSDL *>::iterator w_start= m_dirty_windows.begin();
-	vector<GHOST_WindowSDL *>::const_iterator w_end= m_dirty_windows.end();
+	std::vector<GHOST_WindowSDL *>::iterator w_start= m_dirty_windows.begin();
+	std::vector<GHOST_WindowSDL *>::const_iterator w_end= m_dirty_windows.end();
 	bool anyProcessed= false;
 
 	for (;w_start != w_end; ++w_start) {
@@ -563,10 +574,10 @@ GHOST_SystemSDL::findGhostWindow(SDL_Window *sdl_win)
 	// We should always check the window manager's list of windows
 	// and only process events on these windows.
 
-	vector<GHOST_IWindow *> & win_vec= m_windowManager->getWindows();
+	std::vector<GHOST_IWindow *> & win_vec= m_windowManager->getWindows();
 
-	vector<GHOST_IWindow *>::iterator win_it= win_vec.begin();
-	vector<GHOST_IWindow *>::const_iterator win_end= win_vec.end();
+	std::vector<GHOST_IWindow *>::iterator win_it= win_vec.begin();
+	std::vector<GHOST_IWindow *>::const_iterator win_end= win_vec.end();
 
 	for (; win_it != win_end; ++win_it) {
 		GHOST_WindowSDL * window= static_cast<GHOST_WindowSDL *>(*win_it);
diff --git a/intern/ghost/intern/GHOST_SystemSDL.h b/intern/ghost/intern/GHOST_SystemSDL.h
index 51bca33..7610c59 100644
--- a/intern/ghost/intern/GHOST_SystemSDL.h
+++ b/intern/ghost/intern/GHOST_SystemSDL.h
@@ -25,8 +25,8 @@
  * Declaration of GHOST_SystemSDL class.
  */
 
-#ifndef _GHOST_SYSTEM_SDL_H_
-#define _GHOST_SYSTEM_SDL_H_
+#ifndef __GHOST_SYSTEMSDL_H__
+#define __GHOST_SYSTEMSDL_H__
 
 #include "GHOST_System.h"
 #include "../GHOST_Types.h"
@@ -39,8 +39,8 @@ extern "C" {
 	#include "SDL.h"
 }
 
-#if !SDL_VERSION_ATLEAST(1, 3, 0)
-#  error "SDL 1.3 or newer is needed to build with Ghost"
+#if !SDL_VERSION_ATLEAST(2, 0, 0)
+#  error "SDL 2.0 or newer is needed to build with Ghost"
 #endif
 
 
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index 98c4785..2d8cf13 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -60,6 +60,8 @@
 #endif
 #endif
 
+#include "utfconv.h"
+
 #include "GHOST_DisplayManagerWin32.h"
 #include "GHOST_EventButton.h"
 #include "GHOST_EventCursor.h"
@@ -292,8 +294,8 @@ bool GHOST_SystemWin32::processEvents(bool waitForEvent)
 		}
 
 		// Process all the events waiting for us
-		while (::PeekMessage(&msg, 0, 0, 0, PM_REMOVE) != 0) {
-			::DispatchMessage(&msg);
+		while (::PeekMessageW(&msg, 0, 0, 0, PM_REMOVE) != 0) {
+			::DispatchMessageW(&msg);
 			anyProcessed = true;
 		}
 	} while (waitForEvent && !anyProcessed);
@@ -394,7 +396,7 @@ GHOST_TSuccess GHOST_SystemWin32::init()
 	}
 
 	if (success) {
-		WNDCLASS wc;
+		WNDCLASSW wc;
 		wc.style= CS_HREDRAW | CS_VREDRAW;
 		wc.lpfnWndProc= s_wndProc;
 		wc.cbClsExtra= 0;
@@ -408,10 +410,10 @@ GHOST_TSuccess GHOST_SystemWin32::init()
 		wc.hCursor = ::LoadCursor(0, IDC_ARROW);
 		wc.hbrBackground= (HBRUSH)::GetStockObject(BLACK_BRUSH);
 		wc.lpszMenuName = 0;
-		wc.lpszClassName= GHOST_WindowWin32::getWindowClassName();
+		wc.lpszClassName= L"GHOST_WindowClass";
 
 		// Use RegisterClassEx for setting small icon
-		if (::RegisterClass(&wc) == 0) {
+		if (::RegisterClassW(&wc) == 0) {
 			success = GHOST_kFailure;
 		}
 	}
@@ -716,23 +718,31 @@ GHOST_EventKey* GHOST_SystemWin32::processKeyEvent(GHOST_IWindow *window, RAWINP
 	GHOST_EventKey* event;
 
 	if (key != GHOST_kKeyUnknown) {
-		char utf8_char[6] = {0} ;
+		char utf8_char[6] = {0};
 		char ascii = 0;
 
-		wchar_t utf16[2]={0};
+		wchar_t utf16[3]={0};
 		BYTE state[256] ={0};
-		GetKeyboardState(state);  
-
-		if(ToUnicodeEx(vk, 0, state, utf16, 2, 0, system->m_keylayout))
-			WideCharToMultiByte(CP_UTF8, 0, 
-									(wchar_t*)utf16, 1,
-									(LPSTR) utf8_char, 5,
-									NULL,NULL); else *utf8_char = 0;
+		int r;
+		GetKeyboardState((PBYTE)state);
 
-		
+		if(r = ToUnicodeEx(vk, 0, state, utf16, 2, 0, system->m_keylayout)) {
+			if((r>0 && r<3)){
+				utf16[r]=0;
+				conv_utf_16_to_8(utf16,utf8_char,6);
+			}
+			else if (r==-1) {
+				utf8_char[0] = '\0';
+			}
+		}
 
-		if(!keyDown) {utf8_char[0] = '\0'; ascii='\0';}
-			else ascii = utf8_char[0]& 0x80?'?':utf8_char[0];
+		if(!keyDown) {
+			utf8_char[0] = '\0';
+			ascii='\0';
+		}
+		else {
+			ascii = utf8_char[0]& 0x80?'?' : utf8_char[0];
+		}
 
 		if(0x80&state[VK_MENU]) utf8_char[0]='\0';
 
@@ -805,9 +815,10 @@ bool GHOST_SystemWin32::processNDOF(RAWINPUT const& raw)
 	// send motion. Mark as 'sent' so motion will always get dispatched.
 	eventSent = true;
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(FREE_WINDOWS64)
 	// using Microsoft compiler & header files
-	// they invented the RawInput API, so this version is (probably) correct
+	// they invented the RawInput API, so this version is (probably) correct.
+	// MinGW64 also works fine with this
 	BYTE const* data = raw.data.hid.bRawData;
 	// struct RAWHID {
 	// DWORD dwSizeHid;
@@ -1189,8 +1200,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
 					 * DefWindowProc returns. 
 					 */
 					break;
-					
-				////////////////////////////////////////////////////////////////////////
+									////////////////////////////////////////////////////////////////////////
 				// Other events
 				////////////////////////////////////////////////////////////////////////
 				case WM_GETTEXT:
@@ -1239,18 +1249,17 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
 	}
 
 	if (!eventHandled)
-		lResult = ::DefWindowProc(hwnd, msg, wParam, lParam);
+		lResult = ::DefWindowProcW(hwnd, msg, wParam, lParam);
 
 	return lResult;
 }
 
 GHOST_TUns8* GHOST_SystemWin32::getClipboard(bool selection) const 
 {
-	wchar_t *buffer;
 	char *temp_buff;
 	
 	if ( IsClipboardFormatAvailable(CF_UNICODETEXT) && OpenClipboard(NULL) ) {
-		size_t len = 0;
+		wchar_t *buffer;
 		HANDLE hData = GetClipboardData( CF_UNICODETEXT );
 		if (hData == NULL) {
 			CloseClipboard();
@@ -1262,9 +1271,32 @@ GHOST_TUns8* GHOST_SystemWin32::getClipboard(bool selection) const
 			return NULL;
 		}
 		
-		len = WideCharToMultiByte(CP_UTF8, 0, buffer, -1, NULL, 0, NULL, NULL);
-		temp_buff = (char*) malloc(len);
-		WideCharToMultiByte(CP_UTF8, 0, buffer, -1, temp_buff, len, NULL, NULL);
+		temp_buff = alloc_utf_8_from_16(buffer,0);
+		
+		/* Buffer mustn't be accessed after CloseClipboard
+		   it would like accessing free-d memory */
+		GlobalUnlock( hData );
+		CloseClipboard();
+		
+		return (GHOST_TUns8*)temp_buff;
+	} else if ( IsClipboardFormatAvailable(CF_TEXT) && OpenClipboard(NULL) ) {
+		char *buffer;
+		size_t len = 0;
+		HANDLE hData = GetClipboardData( CF_TEXT );
+		if (hData == NULL) {
+			CloseClipboard();
+			return NULL;
+		}
+		buffer = (char*)GlobalLock( hData );
+		if (!buffer) {
+			CloseClipboard();
+			return NULL;
+		}
+		
+		len = strlen(buffer);
+		temp_buff = (char*) malloc(len+1);
+		strncpy(temp_buff, buffer, len);
+		temp_buff[len] = '\0';
 		
 		/* Buffer mustn't be accessed after CloseClipboard
 		   it would like accessing free-d memory */
@@ -1281,20 +1313,19 @@ void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, bool selection) const
 {
 	if(selection) {return;} // for copying the selection, used on X11
 
-	if (OpenClipboard(NULL)) {
+	if(OpenClipboard(NULL)) {
 		HLOCAL clipbuffer;
 		wchar_t *data;
 		
 		if (buffer) {
+			size_t len = count_utf_16_from_8(buffer);
 			EmptyClipboard();
 			
-			int wlen = MultiByteToWideChar(CP_UTF8, 0, buffer, -1, NULL, 0);
-			
-			clipbuffer = LocalAlloc(LMEM_FIXED, wlen * sizeof(wchar_t));
+			clipbuffer = LocalAlloc(LMEM_FIXED,sizeof(wchar_t) * len);
 			data = (wchar_t*)GlobalLock(clipbuffer);
-			
-			MultiByteToWideChar(CP_UTF8, 0, buffer, -1, data, wlen);
-			
+
+			conv_utf_8_to_16(buffer, data, len);
+
 			LocalUnlock(clipbuffer);
 			SetClipboardData(CF_UNICODETEXT,clipbuffer);
 		}
@@ -1356,3 +1387,9 @@ int GHOST_SystemWin32::toggleConsole(int action)
 
 	return m_consoleStatus;
 }
+
+int GHOST_SystemWin32::confirmQuit(GHOST_IWindow * window) const
+{
+	return (MessageBox(window ? ((GHOST_WindowWin32*)window)->getHWND() : 0, "Some changes have not been saved.\nDo you really want to quit ?",
+			"Exit Blender", MB_OKCANCEL | MB_ICONWARNING | MB_TOPMOST) == IDOK);
+}
diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h
index 1f40cdd..bc2044e 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.h
+++ b/intern/ghost/intern/GHOST_SystemWin32.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_SystemWin32 class.
  */
 
-#ifndef _GHOST_SYSTEM_WIN32_H_
-#define _GHOST_SYSTEM_WIN32_H_
+#ifndef __GHOST_SYSTEMWIN32_H__
+#define __GHOST_SYSTEMWIN32_H__
 
 #ifndef WIN32
 #error WIN32 only!
@@ -200,7 +200,13 @@ public:
 	 * @return Indication whether the event was handled. 
 	 */
 	static GHOST_TSuccess pushDragDropEvent(GHOST_TEventType eventType, GHOST_TDragnDropTypes draggedObjectType,GHOST_IWindow* window, int mouseX, int mouseY, void* data);
-	 
+	
+/**
+ * Confirms quitting he program when there is just one window left open
+ * in the application
+ */
+	virtual int confirmQuit(GHOST_IWindow * window) const;
+
 protected:
 	/**
 	 * Initializes the system.
@@ -395,4 +401,4 @@ inline void GHOST_SystemWin32::handleKeyboardChange(void)
 		}
 	}
 }
-#endif // _GHOST_SYSTEM_WIN32_H_
+#endif // __GHOST_SYSTEMWIN32_H__
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 22c1600..857d9e7 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -42,10 +42,15 @@
 #include "GHOST_EventButton.h"
 #include "GHOST_EventWheel.h"
 #include "GHOST_DisplayManagerX11.h"
+#include "GHOST_EventDragnDrop.h"
 #ifdef WITH_INPUT_NDOF
 #include "GHOST_NDOFManagerX11.h"
 #endif
 
+#ifdef WITH_XDND
+#include "GHOST_DropTargetX11.h"
+#endif
+
 #include "GHOST_Debug.h"
 
 #include <X11/Xatom.h>
@@ -709,8 +714,16 @@ GHOST_SystemX11::processEvent(XEvent *xe)
 					}
 				}
 			} else {
+#ifdef WITH_XDND
+				/* try to handle drag event (if there's no such events, GHOST_HandleClientMessage will return zero) */
+				if (window->getDropTarget()->GHOST_HandleClientMessage(xe) == false) {
+					/* Unknown client message, ignore */
+				}
+#else
 				/* Unknown client message, ignore */
+#endif
 			}
+
 			break;
 		}
 		
@@ -1478,3 +1491,19 @@ void GHOST_SystemX11::putClipboard(GHOST_TInt8 *buffer, bool selection) const
 			fprintf(stderr, "failed to own primary\n");
 	}
 }
+
+#ifdef WITH_XDND
+GHOST_TSuccess GHOST_SystemX11::pushDragDropEvent(GHOST_TEventType eventType, 
+													GHOST_TDragnDropTypes draggedObjectType,
+													GHOST_IWindow* window,
+													int mouseX, int mouseY,
+													void* data)
+{
+	GHOST_SystemX11* system = ((GHOST_SystemX11*)getSystem());
+	return system->pushEvent(new GHOST_EventDragnDrop(system->getMilliSeconds(),
+													  eventType,
+													  draggedObjectType,
+													  window,mouseX,mouseY,data)
+			);
+}
+#endif
diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h
index 73d9c95..d236c73 100644
--- a/intern/ghost/intern/GHOST_SystemX11.h
+++ b/intern/ghost/intern/GHOST_SystemX11.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_SystemX11 class.
  */
 
-#ifndef _GHOST_SYSTEM_X11_H_
-#define _GHOST_SYSTEM_X11_H_
+#ifndef __GHOST_SYSTEMX11_H__
+#define __GHOST_SYSTEMX11_H__
 
 #include <X11/Xlib.h>
 #include <GL/glx.h>
@@ -174,7 +174,7 @@ public:
 		GHOST_TSuccess 
 	getModifierKeys(
 		GHOST_ModifierKeys& keys
-	) const ;
+	) const;
 
 	/**
 	 * Returns the state of the mouse buttons (ouside the message queue).
@@ -235,6 +235,20 @@ public:
 	 */
 	void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
 
+#if WITH_XDND
+	/**
+	 * Creates a drag'n'drop event and pushes it immediately onto the event queue. 
+	 * Called by GHOST_DropTargetX11 class.
+	 * @param eventType The type of drag'n'drop event
+	 * @param draggedObjectType The type object concerned (currently array of file names, string, ?bitmap)
+	 * @param mouseX x mouse coordinate (in window coordinates)
+	 * @param mouseY y mouse coordinate
+	 * @param window The window on which the event occurred
+	 * @return Indication whether the event was handled. 
+	 */
+	static GHOST_TSuccess pushDragDropEvent(GHOST_TEventType eventType, GHOST_TDragnDropTypes draggedObjectType,GHOST_IWindow* window, int mouseX, int mouseY, void* data);
+#endif
+
 	/**
 	 * @see GHOST_ISystem
 	 */
@@ -296,7 +310,7 @@ private :
 		GHOST_WindowX11 * 
 	findGhostWindow(
 		Window xwind
-	) const ;
+	) const;
 
 		void
 	processEvent(
diff --git a/intern/ghost/intern/GHOST_TaskbarWin32.h b/intern/ghost/intern/GHOST_TaskbarWin32.h
index 8f301ed..a5d6fdc 100644
--- a/intern/ghost/intern/GHOST_TaskbarWin32.h
+++ b/intern/ghost/intern/GHOST_TaskbarWin32.h
@@ -1,8 +1,8 @@
 /** \file ghost/intern/GHOST_TaskbarWin32.h
  *  \ingroup GHOST
  */
-#ifndef GHOST_TASKBARWIN32_H_
-#define GHOST_TASKBARWIN32_H_
+#ifndef __GHOST_TASKBARWIN32_H__
+#define __GHOST_TASKBARWIN32_H__
 
 #ifndef WIN32
 #error WIN32 only!
@@ -69,4 +69,4 @@ typedef enum TBPFLAG  {TBPF_NOPROGRESS = 0, TBPF_INDETERMINATE = 0x1, TBPF_NORMA
 	};
 #endif 	/* ITaskbarList3 */
 
-#endif /*GHOST_TASKBARWIN32_H_*/
+#endif /*__GHOST_TASKBARWIN32_H__*/
diff --git a/intern/ghost/intern/GHOST_TimerManager.h b/intern/ghost/intern/GHOST_TimerManager.h
index f7d1726..ce4983c 100644
--- a/intern/ghost/intern/GHOST_TimerManager.h
+++ b/intern/ghost/intern/GHOST_TimerManager.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_TimerManager class.
  */
 
-#ifndef _GHOST_TIMER_MANAGER_H_
-#define _GHOST_TIMER_MANAGER_H_
+#ifndef __GHOST_TIMERMANAGER_H__
+#define __GHOST_TIMERMANAGER_H__
 
 #include <vector>
 
@@ -121,5 +121,5 @@ protected:
 	TTimerVector m_timers;
 };
 
-#endif // _GHOST_TIMER_MANAGER_H_
+#endif // __GHOST_TIMERMANAGER_H__
 
diff --git a/intern/ghost/intern/GHOST_TimerTask.h b/intern/ghost/intern/GHOST_TimerTask.h
index ac86d6c..e15082a 100644
--- a/intern/ghost/intern/GHOST_TimerTask.h
+++ b/intern/ghost/intern/GHOST_TimerTask.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_TimerTask class.
  */
 
-#ifndef _GHOST_TIMER_TASK_H_
-#define _GHOST_TIMER_TASK_H_
+#ifndef __GHOST_TIMERTASK_H__
+#define __GHOST_TIMERTASK_H__
 
 #include "GHOST_ITimerTask.h"
 
@@ -192,5 +192,5 @@ protected:
 	GHOST_TUns32 m_auxData;
 };
 
-#endif // _GHOST_TIMER_TASK_H_
+#endif // __GHOST_TIMERTASK_H__
 
diff --git a/intern/ghost/intern/GHOST_Window.h b/intern/ghost/intern/GHOST_Window.h
index 646097d..323e0fa 100644
--- a/intern/ghost/intern/GHOST_Window.h
+++ b/intern/ghost/intern/GHOST_Window.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_Window class.
  */
 
-#ifndef _GHOST_WINDOW_H_
-#define _GHOST_WINDOW_H_
+#ifndef __GHOST_WINDOW_H__
+#define __GHOST_WINDOW_H__
 
 #include "GHOST_IWindow.h"
 
diff --git a/intern/ghost/intern/GHOST_WindowCarbon.h b/intern/ghost/intern/GHOST_WindowCarbon.h
index 331e228..2c1c827 100644
--- a/intern/ghost/intern/GHOST_WindowCarbon.h
+++ b/intern/ghost/intern/GHOST_WindowCarbon.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_WindowCarbon class.
  */
 
-#ifndef _GHOST_WINDOW_CARBON_H_
-#define _GHOST_WINDOW_CARBON_H_
+#ifndef __GHOST_WINDOWCARBON_H__
+#define __GHOST_WINDOWCARBON_H__
 
 #ifndef __APPLE__
 #error Apple OSX only!
@@ -308,5 +308,5 @@ protected:
 #endif // GHOST_DRAW_CARBON_GUTTER
 };
 
-#endif // _GHOST_WINDOW_CARBON_H_
+#endif // __GHOST_WINDOWCARBON_H__
 
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.h b/intern/ghost/intern/GHOST_WindowCocoa.h
index 46bded6..fec97c2 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.h
+++ b/intern/ghost/intern/GHOST_WindowCocoa.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_WindowCocoa class.
  */
 
-#ifndef _GHOST_WINDOW_COCOA_H_
-#define _GHOST_WINDOW_COCOA_H_
+#ifndef __GHOST_WINDOWCOCOA_H__
+#define __GHOST_WINDOWCOCOA_H__
 
 #ifndef __APPLE__
 #error Apple OSX only!
@@ -325,5 +325,5 @@ protected:
 	GHOST_TabletData m_tablet;
 };
 
-#endif // _GHOST_WINDOW_COCOA_H_
+#endif // __GHOST_WINDOWCOCOA_H__
 
diff --git a/intern/ghost/intern/GHOST_WindowManager.cpp b/intern/ghost/intern/GHOST_WindowManager.cpp
index a4b65c7..cf23628 100644
--- a/intern/ghost/intern/GHOST_WindowManager.cpp
+++ b/intern/ghost/intern/GHOST_WindowManager.cpp
@@ -79,7 +79,7 @@ GHOST_TSuccess GHOST_WindowManager::removeWindow(const GHOST_IWindow* window)
 			endFullScreen();
 		}
 		else {
-			vector<GHOST_IWindow*>::iterator result = find(m_windows.begin(), m_windows.end(), window);
+			std::vector<GHOST_IWindow*>::iterator result = find(m_windows.begin(), m_windows.end(), window);
 			if (result != m_windows.end()) {
 				setWindowInactive(window);
 				m_windows.erase(result);
@@ -99,7 +99,7 @@ bool GHOST_WindowManager::getWindowFound(const GHOST_IWindow* window) const
             found = true;
         }
         else {
-            vector<GHOST_IWindow*>::const_iterator result = find(m_windows.begin(), m_windows.end(), window);
+            std::vector<GHOST_IWindow*>::const_iterator result = find(m_windows.begin(), m_windows.end(), window);
             if (result != m_windows.end()) {
                 found = true;
             }
diff --git a/intern/ghost/intern/GHOST_WindowManager.h b/intern/ghost/intern/GHOST_WindowManager.h
index 12999ba..cf27a3b 100644
--- a/intern/ghost/intern/GHOST_WindowManager.h
+++ b/intern/ghost/intern/GHOST_WindowManager.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_WindowManager class.
  */
 
-#ifndef _GHOST_WINDOW_MANAGER_H_
-#define _GHOST_WINDOW_MANAGER_H_
+#ifndef __GHOST_WINDOWMANAGER_H__
+#define __GHOST_WINDOWMANAGER_H__
 
 #include <vector>
 
@@ -169,5 +169,5 @@ public:
 	
 };
 
-#endif // _GHOST_WINDOW_MANAGER_H_
+#endif // __GHOST_WINDOWMANAGER_H__
 
diff --git a/intern/ghost/intern/GHOST_WindowNULL.h b/intern/ghost/intern/GHOST_WindowNULL.h
index f65b719..49f6d14 100644
--- a/intern/ghost/intern/GHOST_WindowNULL.h
+++ b/intern/ghost/intern/GHOST_WindowNULL.h
@@ -25,8 +25,8 @@
  * Declaration of GHOST_WindowNULL class.
  */
 
-#ifndef _GHOST_WINDOWNULL_H_
-#define _GHOST_WINDOWNULL_H_
+#ifndef __GHOST_WINDOWNULL_H__
+#define __GHOST_WINDOWNULL_H__
 
 #include "GHOST_Window.h"
 
@@ -92,4 +92,4 @@ private :
 };
 
 
-#endif // _GHOST_WINDOWNULL_H_
+#endif // __GHOST_WINDOWNULL_H__
diff --git a/intern/ghost/intern/GHOST_WindowSDL.cpp b/intern/ghost/intern/GHOST_WindowSDL.cpp
index dce8449..b8cbf9b 100644
--- a/intern/ghost/intern/GHOST_WindowSDL.cpp
+++ b/intern/ghost/intern/GHOST_WindowSDL.cpp
@@ -67,7 +67,7 @@ GHOST_WindowSDL::GHOST_WindowSDL(GHOST_SystemSDL *system,
 	m_sdl_glcontext= SDL_GL_CreateContext(m_sdl_win);
 
 	//fprintf(stderr, "Ignoring Xlib error: error code %d request code %d\n",
-	//	theEvent->error_code, theEvent->request_code) ;
+	//	theEvent->error_code, theEvent->request_code);
 
 	setTitle(title);
 }
diff --git a/intern/ghost/intern/GHOST_WindowSDL.h b/intern/ghost/intern/GHOST_WindowSDL.h
index a8a130f..e984aaf 100644
--- a/intern/ghost/intern/GHOST_WindowSDL.h
+++ b/intern/ghost/intern/GHOST_WindowSDL.h
@@ -25,8 +25,8 @@
  * Declaration of GHOST_WindowSDL class.
  */
 
-#ifndef _GHOST_WINDOWSDL_H_
-#define _GHOST_WINDOWSDL_H_
+#ifndef __GHOST_WINDOWSDL_H__
+#define __GHOST_WINDOWSDL_H__
 
 #include "GHOST_Window.h"
 #include "GHOST_SystemSDL.h"
@@ -36,8 +36,8 @@ extern "C" {
 	#include "SDL.h"
 }
 
-#if !SDL_VERSION_ATLEAST(1, 3, 0)
-#  error "SDL 1.3 or newer is needed to build with Ghost"
+#if !SDL_VERSION_ATLEAST(2, 0, 0)
+#  error "SDL 2.0 or newer is needed to build with Ghost"
 #endif
 
 class STR_String;
@@ -163,4 +163,4 @@ protected:
 };
 
 
-#endif // _GHOST_WINDOWSDL_H_
+#endif // __GHOST_WINDOWSDL_H__
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index 8e37d18..9d10574 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -41,6 +41,8 @@
 #include "GHOST_WindowWin32.h"
 #include "GHOST_SystemWin32.h"
 #include "GHOST_DropTargetWin32.h"
+#include "utfconv.h"
+#include "utf_winfunc.h"
 
 // Need glew for some defines
 #include <GL/glew.h>
@@ -64,7 +66,7 @@
 #endif
 #endif
 
-LPCSTR GHOST_WindowWin32::s_windowClassName = "GHOST_WindowClass";
+wchar_t* GHOST_WindowWin32::s_windowClassName = L"GHOST_WindowClass";
 const int GHOST_WindowWin32::s_maxTitleLength = 128;
 HGLRC GHOST_WindowWin32::s_firsthGLRc = NULL;
 HDC GHOST_WindowWin32::s_firstHDC = NULL;
@@ -234,9 +236,10 @@ GHOST_WindowWin32::GHOST_WindowWin32(
 			height = rect.bottom - rect.top;
 		}
 		
-		m_hWnd = ::CreateWindow(
+		wchar_t * title_16 = alloc_utf16_from_8((char*)(const char*)title,0);
+		m_hWnd = ::CreateWindowW(
 			s_windowClassName,			// pointer to registered class name
-			title,						// pointer to window name
+			title_16,						// pointer to window name
 			wintype,					// window style
 			left,					// horizontal position of window
 			top,					// vertical position of window
@@ -246,11 +249,13 @@ GHOST_WindowWin32::GHOST_WindowWin32(
 			0,							// handle to menu or child-window identifier
 			::GetModuleHandle(0),		// handle to application instance
 			0);							// pointer to window-creation data
+		free(title_16);
 	}
 	else {
-		m_hWnd = ::CreateWindow(
+		wchar_t * title_16 = alloc_utf16_from_8((char*)(const char*)title,0);
+		m_hWnd = ::CreateWindowW(
 			s_windowClassName,			// pointer to registered class name
-			title,						// pointer to window name
+			title_16,						// pointer to window name
 			WS_POPUP | WS_MAXIMIZE,		// window style
 			left,						// horizontal position of window
 			top,						// vertical position of window
@@ -260,6 +265,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(
 			0,							// handle to menu or child-window identifier
 			::GetModuleHandle(0),		// handle to application instance
 			0);							// pointer to window-creation data
+		free(title_16);
 	}
 	if (m_hWnd) {
 		// Register this window as a droptarget. Requires m_hWnd to be valid.
@@ -433,13 +439,15 @@ HWND GHOST_WindowWin32::getHWND() const
 
 void GHOST_WindowWin32::setTitle(const STR_String& title)
 {
-	::SetWindowText(m_hWnd, title);
+	wchar_t * title_16 = alloc_utf16_from_8((char*)(const char*)title, 0);
+	::SetWindowTextW(m_hWnd, (wchar_t*)title_16);
+	free(title_16);
 }
 
 
 void GHOST_WindowWin32::getTitle(STR_String& title) const
 {
-	char buf[s_maxTitleLength];
+	char buf[s_maxTitleLength];/*CHANGE + never used yet*/
 	::GetWindowText(m_hWnd, buf, s_maxTitleLength);
 	STR_String temp (buf);
 	title = buf;
diff --git a/intern/ghost/intern/GHOST_WindowWin32.h b/intern/ghost/intern/GHOST_WindowWin32.h
index 190966e..c8e88c8 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.h
+++ b/intern/ghost/intern/GHOST_WindowWin32.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_WindowWin32 class.
  */
 
-#ifndef _GHOST_WINDOW_WIN32_H_
-#define _GHOST_WINDOW_WIN32_H_
+#ifndef __GHOST_WINDOWWIN32_H__
+#define __GHOST_WINDOWWIN32_H__
 
 #ifndef WIN32
 #error WIN32 only!
@@ -236,7 +236,7 @@ public:
 	 * Returns the name of the window class.
 	 * @return The name of the window class.
 	 */
-	static LPCSTR getWindowClassName() { return s_windowClassName; }
+	static wchar_t* getWindowClassName() { return s_windowClassName; }
 
 	/**
 	 * Register a mouse click event (should be called 
@@ -351,7 +351,7 @@ protected:
 	/** ITaskbarList3 structure for progress bar*/
 	ITaskbarList3 * m_Bar;
 
-	static LPCSTR s_windowClassName;
+	static wchar_t* s_windowClassName;
 	static const int s_maxTitleLength;
 
 	/** WinTab dll handle */
@@ -390,4 +390,4 @@ protected:
 	GHOST_TEmbedderWindowID m_parentWindowHwnd;
 };
 
-#endif // _GHOST_WINDOW_WIN32_H_
+#endif // __GHOST_WINDOWWIN32_H__
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp
index 71e3f7b..85a9163 100644
--- a/intern/ghost/intern/GHOST_WindowX11.cpp
+++ b/intern/ghost/intern/GHOST_WindowX11.cpp
@@ -35,6 +35,10 @@
 #include "STR_String.h"
 #include "GHOST_Debug.h"
 
+#ifdef WITH_XDND
+#include "GHOST_DropTargetX11.h"
+#endif
+
 // For standard X11 cursors
 #include <X11/cursorfont.h>
 #include <X11/Xatom.h>
@@ -325,7 +329,13 @@ GHOST_WindowX11(
 		XSelectInput(m_display , parentWindow, SubstructureNotifyMask);
 		
 	}	
-	
+
+#ifdef WITH_XDND
+	/* initialize drop target for newly created window */
+	m_dropTarget = new GHOST_DropTargetX11(this, m_system);
+	GHOST_PRINT("Set drop target\n");
+#endif
+
 	/*
 	 * One of the problem with WM-spec is that can't set a property
 	 * to a window that isn't mapped. That is why we can't "just
@@ -363,7 +373,7 @@ GHOST_WindowX11(
 	XFree(xsizehints);
 
 	XClassHint * xclasshint = XAllocClassHint();
-	int len = title.Length() +1 ;
+	const int len = title.Length() + 1;
 	char *wmclass = (char *)malloc(sizeof(char) * len);
 	strncpy(wmclass, (const char*)title, sizeof(char) * len);
 	xclasshint->res_name = wmclass;
@@ -475,10 +485,10 @@ GHOST_WindowX11(
 static int ApplicationErrorHandler(Display *display, XErrorEvent *theEvent)
 {
 	fprintf(stderr, "Ignoring Xlib error: error code %d request code %d\n",
-		theEvent->error_code, theEvent->request_code) ;
+		theEvent->error_code, theEvent->request_code);
 
 	/* No exit! - but keep lint happy */
-	return 0 ;
+	return 0;
 }
 
 /* These C functions are copied from Wine 1.1.13's wintab.c */
@@ -578,7 +588,7 @@ static BOOL is_eraser(const char *name, const char *type)
 
 void GHOST_WindowX11::initXInputDevices()
 {
-	static XErrorHandler old_handler = (XErrorHandler) 0 ;
+	static XErrorHandler old_handler = (XErrorHandler) 0;
 	XExtensionVersion *version = XGetExtensionVersion(m_display, INAME);
 
 	if(version && (version != (XExtensionVersion*)NoSuchExtension)) {
@@ -590,7 +600,7 @@ void GHOST_WindowX11::initXInputDevices()
 			m_xtablet.CommonData.Active= GHOST_kTabletModeNone;
 
 			/* Install our error handler to override Xlib's termination behavior */
-			old_handler = XSetErrorHandler(ApplicationErrorHandler) ;
+			old_handler = XSetErrorHandler(ApplicationErrorHandler);
 
 			for(int i=0; i<device_count; ++i) {
 				char *device_type = device_info[i].type ? XGetAtomName(m_display, device_info[i].type) : NULL;
@@ -638,7 +648,7 @@ void GHOST_WindowX11::initXInputDevices()
 			}
 
 			/* Restore handler */
-			(void) XSetErrorHandler(old_handler) ;
+			(void) XSetErrorHandler(old_handler);
 
 			XFreeDeviceList(device_info);
 
@@ -1318,6 +1328,9 @@ GHOST_WindowX11::
 	}
 #endif
 
+#ifdef WITH_XDND
+	delete m_dropTarget;
+#endif
 
 	XDestroyWindow(m_display, m_window);
 	XFree(m_visual);
diff --git a/intern/ghost/intern/GHOST_WindowX11.h b/intern/ghost/intern/GHOST_WindowX11.h
index f1146db..cb3c141 100644
--- a/intern/ghost/intern/GHOST_WindowX11.h
+++ b/intern/ghost/intern/GHOST_WindowX11.h
@@ -30,8 +30,8 @@
  * Declaration of GHOST_WindowX11 class.
  */
 
-#ifndef _GHOST_WINDOWX11_H_
-#define _GHOST_WINDOWX11_H_
+#ifndef __GHOST_WINDOWX11_H__
+#define __GHOST_WINDOWX11_H__
 
 #include "GHOST_Window.h"
 #include <X11/Xlib.h>
@@ -46,6 +46,10 @@
 class STR_String;
 class GHOST_SystemX11;
 
+#ifdef WITH_XDND
+class GHOST_DropTargetX11;
+#endif
+
 /**
  * X11 implementation of GHOST_IWindow.
  * Dimensions are given in screen coordinates that are relative to the upper-left corner of the screen. 
@@ -142,7 +146,7 @@ public:
 	
 		GHOST_TWindowState 
 	getState(
-	) const ;
+	) const;
 
 		GHOST_TSuccess 
 	setState(
@@ -224,6 +228,11 @@ public:
 	XIC getX11_XIC() { return m_xic; }
 #endif
 
+#ifdef WITH_XDND
+	GHOST_DropTargetX11* getDropTarget()
+	{ return m_dropTarget; }
+#endif
+
 	/*
 	 * Need this in case that we want start the window
 	 * in FullScree or Maximized state.
@@ -361,6 +370,10 @@ private :
 	/** Cache of XC_* ID's to XCursor structures */
 	std::map<unsigned int, Cursor> m_standard_cursors;
 
+#ifdef WITH_XDND
+	GHOST_DropTargetX11 * m_dropTarget;
+#endif
+
 #ifdef WITH_X11_XINPUT
 	/* Tablet devices */
 	XTablet m_xtablet;
@@ -384,4 +397,4 @@ private :
 };
 
 
-#endif // _GHOST_WINDOWX11_H_
+#endif // __GHOST_WINDOWX11_H__
diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h
index 7285843..83d6549 100644
--- a/intern/guardedalloc/MEM_guardedalloc.h
+++ b/intern/guardedalloc/MEM_guardedalloc.h
@@ -57,8 +57,8 @@
  * See \ref MEM_guardedalloc.h
  */
 
-#ifndef MEM_MALLOCN_H
-#define MEM_MALLOCN_H
+#ifndef __MEM_GUARDEDALLOC_H__
+#define __MEM_GUARDEDALLOC_H__
 
 #include <stdio.h> /* needed for FILE* */
 #include "MEM_sys_types.h" /* needed for uintptr_t */
diff --git a/intern/guardedalloc/MEM_sys_types.h b/intern/guardedalloc/MEM_sys_types.h
index 764d7c6..3d43733 100644
--- a/intern/guardedalloc/MEM_sys_types.h
+++ b/intern/guardedalloc/MEM_sys_types.h
@@ -47,8 +47,8 @@
 // doxygen would get a conflict
 */
 
-#ifndef MEM_SYS_TYPES_H
-#define MEM_SYS_TYPES_H
+#ifndef __MEM_SYS_TYPES_H__
+#define __MEM_SYS_TYPES_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -108,8 +108,10 @@ typedef uint64_t  u_int64_t;
 #include <inttypes.h>
 
 #elif defined(FREE_WINDOWS)
+#ifndef FREE_WINDOWS64
 /* define htoln here, there must be a syntax error in winsock2.h in MinGW */
 unsigned long __attribute__((__stdcall__)) htonl(unsigned long);
+#endif
 #include <stdint.h>
 
 #else
@@ -141,5 +143,5 @@ unsigned long __attribute__((__stdcall__)) htonl(unsigned long);
 }
 #endif
 
-#endif /* MEM_SYS_TYPES_H */
+#endif /* __MEM_SYS_TYPES_H__ */
 
diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c
index f8825ba..2a6a0df 100644
--- a/intern/guardedalloc/intern/mallocn.c
+++ b/intern/guardedalloc/intern/mallocn.c
@@ -65,7 +65,7 @@
 // #define DEBUG_MEMCOUNTER
 
 #ifdef DEBUG_MEMCOUNTER
-#define DEBUG_MEMCOUNTER_ERROR_VAL 0 /* set this to the value that isnt being freed */
+#define DEBUG_MEMCOUNTER_ERROR_VAL 0 /* set this to the value that isn't being freed */
 static int _mallocn_count = 0;
 
 /* breakpoint here */
@@ -319,7 +319,7 @@ void *MEM_mallocN(size_t len, const char *str)
 
 #ifdef DEBUG_MEMCOUNTER
 		if(_mallocn_count==DEBUG_MEMCOUNTER_ERROR_VAL)
-			memcount_raise("MEM_mallocN");
+			memcount_raise(__func__);
 		memh->_count= _mallocn_count++;
 #endif
 		return (++memh);
@@ -344,7 +344,7 @@ void *MEM_callocN(size_t len, const char *str)
 		mem_unlock_thread();
 #ifdef DEBUG_MEMCOUNTER
 		if(_mallocn_count==DEBUG_MEMCOUNTER_ERROR_VAL)
-			memcount_raise("MEM_callocN");
+			memcount_raise(__func__);
 		memh->_count= _mallocn_count++;
 #endif
 		return (++memh);
@@ -374,7 +374,7 @@ void *MEM_mapallocN(size_t len, const char *str)
 		mem_unlock_thread();
 #ifdef DEBUG_MEMCOUNTER
 		if(_mallocn_count==DEBUG_MEMCOUNTER_ERROR_VAL)
-			memcount_raise("MEM_mapallocN");
+			memcount_raise(__func__);
 		memh->_count= _mallocn_count++;
 #endif
 		return (++memh);
diff --git a/intern/guardedalloc/mmap_win.h b/intern/guardedalloc/mmap_win.h
index fa8d3b2..fdbb249 100644
--- a/intern/guardedalloc/mmap_win.h
+++ b/intern/guardedalloc/mmap_win.h
@@ -30,8 +30,8 @@
  *  \author Andrea Weikert
  */
  
-#ifndef MMAP_WIN_H
-#define MMAP_WIN_H
+#ifndef __MMAP_WIN_H__
+#define __MMAP_WIN_H__
 
 #define PROT_NONE 0
 #define PROT_READ 1
diff --git a/intern/guardedalloc/test/simpletest/memtest.c b/intern/guardedalloc/test/simpletest/memtest.c
index d484e6f..fdc9173 100644
--- a/intern/guardedalloc/test/simpletest/memtest.c
+++ b/intern/guardedalloc/test/simpletest/memtest.c
@@ -118,7 +118,7 @@ int main (int argc, char *argv[])
 	}
 
 	/* now corrupt a few blocks...*/
-	ip = (int*) p[5] - 50 ;
+	ip = (int*) p[5] - 50;
 	for (i = 0; i< 1000; i++,ip++) *ip = i+1;
 	ip = (int*) p[6];
 	*(ip+10005) = 0;
diff --git a/intern/iksolver/extern/IK_solver.h b/intern/iksolver/extern/IK_solver.h
index 179bd4a..7f780a0 100644
--- a/intern/iksolver/extern/IK_solver.h
+++ b/intern/iksolver/extern/IK_solver.h
@@ -65,8 +65,8 @@
  * This module only depends on Moto.
  */
 
-#ifndef NAN_INCLUDED_IK_solver_h
-#define NAN_INCLUDED_IK_solver_h
+#ifndef __IK_SOLVER_H__
+#define __IK_SOLVER_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -168,5 +168,5 @@ int IK_Solve(IK_Solver *solver, float tolerance, int max_iterations);
 }
 #endif
 
-#endif // NAN_INCLUDED_IK_solver_h
+#endif // __IK_SOLVER_H__
 
diff --git a/intern/iksolver/intern/IK_QJacobian.h b/intern/iksolver/intern/IK_QJacobian.h
index c975989..b4b5a04 100644
--- a/intern/iksolver/intern/IK_QJacobian.h
+++ b/intern/iksolver/intern/IK_QJacobian.h
@@ -32,9 +32,9 @@
  */
 
 
-#ifndef NAN_INCLUDED_IK_QJacobian_h
+#ifndef __IK_QJACOBIAN_H__
 
-#define NAN_INCLUDED_IK_QJacobian_h
+#define __IK_QJACOBIAN_H__
 
 #include "TNT/cmat.h"
 #include <vector>
diff --git a/intern/iksolver/intern/IK_QJacobianSolver.h b/intern/iksolver/intern/IK_QJacobianSolver.h
index 56d3814..cfcd284 100644
--- a/intern/iksolver/intern/IK_QJacobianSolver.h
+++ b/intern/iksolver/intern/IK_QJacobianSolver.h
@@ -31,9 +31,9 @@
  */
 
 
-#ifndef NAN_INCLUDED_IK_QJacobianSolver_h
+#ifndef __IK_QJACOBIANSOLVER_H__
 
-#define NAN_INCLUDED_IK_QJacobianSolver_h
+#define __IK_QJACOBIANSOLVER_H__
 
 /**
  * @author Laurence Bourn
diff --git a/intern/iksolver/intern/IK_QSegment.h b/intern/iksolver/intern/IK_QSegment.h
index 9037f87..68d4082 100644
--- a/intern/iksolver/intern/IK_QSegment.h
+++ b/intern/iksolver/intern/IK_QSegment.h
@@ -31,8 +31,8 @@
  */
 
 
-#ifndef NAN_INCLUDED_IK_QSegment_h
-#define NAN_INCLUDED_IK_QSegment_h
+#ifndef __IK_QSEGMENT_H__
+#define __IK_QSEGMENT_H__
 
 #include "MT_Vector3.h"
 #include "MT_Transform.h"
diff --git a/intern/iksolver/intern/IK_QTask.h b/intern/iksolver/intern/IK_QTask.h
index 379866d..3d968cd 100644
--- a/intern/iksolver/intern/IK_QTask.h
+++ b/intern/iksolver/intern/IK_QTask.h
@@ -31,8 +31,8 @@
  */
 
 
-#ifndef NAN_INCLUDED_IK_QTask_h
-#define NAN_INCLUDED_IK_QTask_h
+#ifndef __IK_QTASK_H__
+#define __IK_QTASK_H__
 
 #include "MT_Vector3.h"
 #include "MT_Transform.h"
diff --git a/intern/iksolver/test/ik_glut_test/common/GlutDrawer.h b/intern/iksolver/test/ik_glut_test/common/GlutDrawer.h
index 4dfcfa1..05d2424 100644
--- a/intern/iksolver/test/ik_glut_test/common/GlutDrawer.h
+++ b/intern/iksolver/test/ik_glut_test/common/GlutDrawer.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef NAN_INCLUDED_GlutDrawer
-#define NAN_INCLUDED_GlutDrawer
+#ifndef __GLUTDRAWER_H__
+#define __GLUTDRAWER_H__
 
 #include "MEM_NonCopyable.h"
 #include "MEM_SmartPtr.h"
diff --git a/intern/iksolver/test/ik_glut_test/common/GlutKeyboardManager.h b/intern/iksolver/test/ik_glut_test/common/GlutKeyboardManager.h
index 61cd7a2..ea39b68 100644
--- a/intern/iksolver/test/ik_glut_test/common/GlutKeyboardManager.h
+++ b/intern/iksolver/test/ik_glut_test/common/GlutKeyboardManager.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef NAN_INCLUDED_GlutKeyboardManager
-#define NAN_INCLUDED_GlutKeyboardManager
+#ifndef __GLUTKEYBOARDMANAGER_H__
+#define __GLUTKEYBOARDMANAGER_H__
 
 #include "MEM_NonCopyable.h"
 #include "MEM_SmartPtr.h"
diff --git a/intern/iksolver/test/ik_glut_test/common/GlutMouseManager.h b/intern/iksolver/test/ik_glut_test/common/GlutMouseManager.h
index 50fb37c..4a2344b 100644
--- a/intern/iksolver/test/ik_glut_test/common/GlutMouseManager.h
+++ b/intern/iksolver/test/ik_glut_test/common/GlutMouseManager.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef NAN_INCLUDED_GlutMouseManager_h
-#define NAN_INCLUDED_GlutMouseManager_h
+#ifndef __GLUTMOUSEMANAGER_H__
+#define __GLUTMOUSEMANAGER_H__
 
 #include "MEM_NonCopyable.h"
 #include "MEM_SmartPtr.h"
diff --git a/intern/iksolver/test/ik_glut_test/intern/ChainDrawer.h b/intern/iksolver/test/ik_glut_test/intern/ChainDrawer.h
index 5975eaa..f286380 100644
--- a/intern/iksolver/test/ik_glut_test/intern/ChainDrawer.h
+++ b/intern/iksolver/test/ik_glut_test/intern/ChainDrawer.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef NAN_INCLUDED_ChainDrawer_h
-#define NAN_INCLUDED_ChainDrawer_h
+#ifndef __CHAINDRAWER_H__
+#define __CHAINDRAWER_H__
 
 #include "../common/GlutDrawer.h"
 #include "MyGlutMouseHandler.h"
diff --git a/intern/iksolver/test/ik_glut_test/intern/MyGlutKeyHandler.h b/intern/iksolver/test/ik_glut_test/intern/MyGlutKeyHandler.h
index 2ac9b25..621e0d3 100644
--- a/intern/iksolver/test/ik_glut_test/intern/MyGlutKeyHandler.h
+++ b/intern/iksolver/test/ik_glut_test/intern/MyGlutKeyHandler.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef NAN_INCLUDED_MyGlutKeyHandler_h
-#define NAN_INCLUDED_MyGlutKeyHandler_h
+#ifndef __MYGLUTKEYHANDLER_H__
+#define __MYGLUTKEYHANDLER_H__
 
 #include "../common/GlutKeyboardManager.h"
 
diff --git a/intern/iksolver/test/ik_glut_test/intern/MyGlutMouseHandler.h b/intern/iksolver/test/ik_glut_test/intern/MyGlutMouseHandler.h
index 5d94db4..205ce38 100644
--- a/intern/iksolver/test/ik_glut_test/intern/MyGlutMouseHandler.h
+++ b/intern/iksolver/test/ik_glut_test/intern/MyGlutMouseHandler.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef NAN_INCLUDED_MyGlutMouseHandler_h
-#define NAN_INCLUDED_MyGlutMouseHandler_h
+#ifndef __MYGLUTMOUSEHANDLER_H__
+#define __MYGLUTMOUSEHANDLER_H__
 
 #include "../common/GlutMouseManager.h"
 #include <GL/glut.h>
diff --git a/intern/memutil/MEM_Allocator.h b/intern/memutil/MEM_Allocator.h
index 99d0b51..9541604 100644
--- a/intern/memutil/MEM_Allocator.h
+++ b/intern/memutil/MEM_Allocator.h
@@ -25,8 +25,8 @@
  */
 
 
-#ifndef MEM_ALLOCATOR_H
-#define MEM_ALLOCATOR_H
+#ifndef __MEM_ALLOCATOR_H__
+#define __MEM_ALLOCATOR_H__
 
 #include <stddef.h>
 #include "guardedalloc/MEM_guardedalloc.h"
@@ -89,4 +89,4 @@ struct MEM_Allocator
 	}
 };
 
-#endif // MEM_ALLOCATOR_H
+#endif // __MEM_ALLOCATOR_H__
diff --git a/intern/memutil/MEM_CacheLimiter.h b/intern/memutil/MEM_CacheLimiter.h
index 94aca28..9a36b67 100644
--- a/intern/memutil/MEM_CacheLimiter.h
+++ b/intern/memutil/MEM_CacheLimiter.h
@@ -25,8 +25,8 @@
  */
 
 
-#ifndef MEM_CACHELIMITER_H
-#define MEM_CACHELIMITER_H
+#ifndef __MEM_CACHELIMITER_H__
+#define __MEM_CACHELIMITER_H__
 
 /**
  * @section MEM_CacheLimiter
@@ -63,7 +63,7 @@
 template<class T>
 class MEM_CacheLimiter;
 
-#ifndef __MEM_cache_limiter_c_api_h_included__
+#ifndef __MEM_CACHELIMITERC_API_H__
 extern "C" {
 	extern void MEM_CacheLimiter_set_maximum(size_t m);
 	extern size_t MEM_CacheLimiter_get_maximum();
@@ -201,4 +201,4 @@ private:
 	MEM_CacheLimiter_DataSize_Func getDataSize;
 };
 
-#endif // MEM_CACHELIMITER_H
+#endif // __MEM_CACHELIMITER_H__
diff --git a/intern/memutil/MEM_CacheLimiterC-Api.h b/intern/memutil/MEM_CacheLimiterC-Api.h
index c8672fa..4ed692f 100644
--- a/intern/memutil/MEM_CacheLimiterC-Api.h
+++ b/intern/memutil/MEM_CacheLimiterC-Api.h
@@ -25,8 +25,8 @@
  */
 
 
-#ifndef MEM_CACHELIMITERC_API_H
-#define MEM_CACHELIMITERC_API_H
+#ifndef __MEM_CACHELIMITERC_API_H__
+#define __MEM_CACHELIMITERC_API_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -44,10 +44,10 @@ typedef void(*MEM_CacheLimiter_Destruct_Func)(void*);
 /* function used to measure stored data element size */
 typedef size_t(*MEM_CacheLimiter_DataSize_Func) (void*);
 
-#ifndef MEM_CACHELIMITER_H
+#ifndef __MEM_CACHELIMITER_H__
 extern void MEM_CacheLimiter_set_maximum(size_t m);
 extern int MEM_CacheLimiter_get_maximum(void);
-#endif // MEM_CACHELIMITER_H
+#endif /* __MEM_CACHELIMITER_H__ */
 /** 
  * Create new MEM_CacheLimiter object 
  * managed objects are destructed with the data_destructor
@@ -145,4 +145,4 @@ extern void * MEM_CacheLimiter_get(MEM_CacheLimiterHandleC * handle);
 #endif
 
 
-#endif // MEM_CACHELIMITERC_API_H
+#endif // __MEM_CACHELIMITERC_API_H__
diff --git a/intern/memutil/MEM_NonCopyable.h b/intern/memutil/MEM_NonCopyable.h
index 7ddd35d..9378ea7 100644
--- a/intern/memutil/MEM_NonCopyable.h
+++ b/intern/memutil/MEM_NonCopyable.h
@@ -34,8 +34,8 @@
  * Declaration of MEM_NonCopyable class.
  */
 
-#ifndef NAN_INCLUDED_NonCopyable_h
-#define NAN_INCLUDED_NonCopyable_h
+#ifndef __MEM_NONCOPYABLE_H__
+#define __MEM_NONCOPYABLE_H__
 
 /**
  * Simple class that makes sure sub classes cannot
diff --git a/intern/memutil/MEM_RefCountPtr.h b/intern/memutil/MEM_RefCountPtr.h
index 43dbc80..4f47534 100644
--- a/intern/memutil/MEM_RefCountPtr.h
+++ b/intern/memutil/MEM_RefCountPtr.h
@@ -35,8 +35,8 @@
  * @author Laurence
  */
 
-#ifndef NAN_INCLUDED_MEM_RefCountPtr_h
-#define NAN_INCLUDED_MEM_RefCountPtr_h
+#ifndef __MEM_REFCOUNTPTR_H__
+#define __MEM_REFCOUNTPTR_H__
 
 #include <stdlib.h> // for NULL !
 
diff --git a/intern/memutil/MEM_RefCounted.h b/intern/memutil/MEM_RefCounted.h
index 0c3a541..9da0103 100644
--- a/intern/memutil/MEM_RefCounted.h
+++ b/intern/memutil/MEM_RefCounted.h
@@ -34,8 +34,8 @@
  * Declaration of MEM_RefCounted class.
  */
 
-#ifndef MEM_REFCOUNTED_H
-#define MEM_REFCOUNTED_H
+#ifndef __MEM_REFCOUNTED_H__
+#define __MEM_REFCOUNTED_H__
 
 /**
  * An object with reference counting.
@@ -112,5 +112,5 @@ inline int MEM_RefCounted::decRef()
 	return m_refCount;
 }
 
-#endif // MEM_REFCOUNTED_H
+#endif // __MEM_REFCOUNTED_H__
 
diff --git a/intern/memutil/MEM_RefCountedC-Api.h b/intern/memutil/MEM_RefCountedC-Api.h
index 4b2679c..a611482 100644
--- a/intern/memutil/MEM_RefCountedC-Api.h
+++ b/intern/memutil/MEM_RefCountedC-Api.h
@@ -34,8 +34,8 @@
  * Interface for C access to functionality relating to shared objects in the foundation library.
  */
 
-#ifndef MEM_REFCOUNTEDC_API_H
-#define MEM_REFCOUNTEDC_API_H
+#ifndef __MEM_REFCOUNTEDC_API_H__
+#define __MEM_REFCOUNTEDC_API_H__
 
 /** A pointer to a private object. */
 typedef struct MEM_TOpaqueObject* MEM_TObjectPtr;
@@ -75,4 +75,4 @@ extern int	MEM_RefCountedDecRef(MEM_TRefCountedObjectPtr shared);
 }
 #endif
 
-#endif // MEM_REFCOUNTEDC_API_H
+#endif // __MEM_REFCOUNTEDC_API_H__
diff --git a/intern/memutil/MEM_SmartPtr.h b/intern/memutil/MEM_SmartPtr.h
index a2ab273..6a0dc17 100644
--- a/intern/memutil/MEM_SmartPtr.h
+++ b/intern/memutil/MEM_SmartPtr.h
@@ -35,8 +35,8 @@
  * @author Laurence
  */
 
-#ifndef NAN_INCLUDED_MEM_SmartPtr_h
-#define NAN_INCLUDED_MEM_SmartPtr_h
+#ifndef __MEM_SMARTPTR_H__
+#define __MEM_SMARTPTR_H__
 
 
 #include <stdlib.h> // for NULL !
diff --git a/intern/opennl/CMakeLists.txt b/intern/opennl/CMakeLists.txt
index 231802b..3224283 100644
--- a/intern/opennl/CMakeLists.txt
+++ b/intern/opennl/CMakeLists.txt
@@ -28,7 +28,7 @@ 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.
-remove_cc_flag("-DDEBUG")
+add_definitions(-UDEBUG)
 
 
 # quiet compiler warnings about undefined defines
diff --git a/intern/opennl/SConscript b/intern/opennl/SConscript
index 502df18..711955c 100644
--- a/intern/opennl/SConscript
+++ b/intern/opennl/SConscript
@@ -5,7 +5,7 @@ sources = env.Glob('intern/*.c') + env.Glob('superlu/*.c')
 
 incs = 'extern superlu ../../extern/colamd/Include'
 
-if (env['OURPLATFORM'] == 'win32-mingw'):
+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] )
diff --git a/intern/smoke/intern/FLUID_3D.cpp b/intern/smoke/intern/FLUID_3D.cpp
index d688dbf..9f036cc 100644
--- a/intern/smoke/intern/FLUID_3D.cpp
+++ b/intern/smoke/intern/FLUID_3D.cpp
@@ -1106,7 +1106,7 @@ void FLUID_3D::addVorticity(int zBegin, int zEnd)
 				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 || right == index) ? 1.0f / _dx : gridSize;
+				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;
@@ -1152,7 +1152,7 @@ void FLUID_3D::addVorticity(int zBegin, int zEnd)
 					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;
-					float dx  = (right == vIndex || right == vIndex) ? 1.0f / _dx : gridSize;
+					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;
diff --git a/intern/string/STR_HashedString.h b/intern/string/STR_HashedString.h
index cd3b0e2..f56e365 100644
--- a/intern/string/STR_HashedString.h
+++ b/intern/string/STR_HashedString.h
@@ -37,8 +37,8 @@
  * @date	November, 14, 2001
  */
 
-#ifndef __STR_HASHSTRING
-#define __STR_HASHSTRING
+#ifndef __STR_HASHEDSTRING_H__
+#define __STR_HASHEDSTRING_H__
 
 #include "STR_String.h"
 
@@ -150,5 +150,5 @@ private:
 	mutable dword m_CachedHash;
 };
 
-#endif //__STR_HASHSTRING
+#endif //__STR_HASHEDSTRING_H__
 
diff --git a/intern/string/STR_String.h b/intern/string/STR_String.h
index fa08dc3..2f17b05 100644
--- a/intern/string/STR_String.h
+++ b/intern/string/STR_String.h
@@ -37,8 +37,8 @@
  * @date	April, 25, 2001
  */
 
-#ifndef _STR_String_H_
-#define _STR_String_H_
+#ifndef __STR_STRING_H__
+#define __STR_STRING_H__
 
 #ifndef STR_NO_ASSERTD
 #undef  assertd
@@ -51,8 +51,6 @@
 #include <cstring>
 #include <cstdlib>
 
-using namespace std;
-
 #ifdef WITH_CXX_GUARDEDALLOC
 #include "MEM_guardedalloc.h"
 #endif
@@ -95,8 +93,10 @@ public:
 	inline void			Clear()										{ Len = pData[0] = 0; }
 	inline const STR_String	& Reverse()
 	{
-		for (int i1=0, i2=Len-1; i1<i2; i1++, i2--)
-			swap(pData[i1], pData[i2]); return *this;
+		for (int i1 = 0, i2 = Len - 1; i1 < i2; i1++, i2--) {
+			std::swap(pData[i1], pData[i2]);
+		}
+		return *this;
 	}
 
 	// Properties
@@ -133,7 +133,7 @@ public:
 	int				FindOneOf(const char *set, int pos = 0) const;
 	int				RFindOneOf(const char *set, int pos = 0) const;
 
-	vector<STR_String>	Explode(char c) const;
+	std::vector<STR_String> Explode(char c) const;
 
 	// Formatting
 	STR_String&			Upper();
@@ -217,5 +217,5 @@ inline  STR_String operator+(rcSTR_String    lhs, const char *rhs)	{ return STR_
 inline  STR_String operator+(const char  *lhs, rcSTR_String   rhs)	{ return STR_String(lhs, strlen(lhs), rhs.ReadPtr(), rhs.Length()); }
 
 
-#endif //_STR_String_H_
+#endif //__STR_STRING_H__
 
diff --git a/intern/string/intern/STR_String.cpp b/intern/string/intern/STR_String.cpp
index e711c4e..5ad41c6 100644
--- a/intern/string/intern/STR_String.cpp
+++ b/intern/string/intern/STR_String.cpp
@@ -699,23 +699,19 @@ rcSTR_String STR_String::Concat(const char *data, int len)
 }
 
 
-
-
-
-vector<STR_String>	STR_String::Explode(char c) const
+std::vector<STR_String>	STR_String::Explode(char c) const
 {
-	STR_String				lcv	= *this;
-	vector<STR_String>		uc;
+	STR_String              lcv = *this;
+	std::vector<STR_String> uc;
 
 	while (lcv.Length())
 	{
 		int pos = lcv.Find(c);
-		if (pos < 0)
-		{
+		if (pos < 0) {
 			uc.push_back(lcv);
 			lcv.Clear();
-		} else
-		{
+		}
+		else {
 			uc.push_back(lcv.Left(pos));
 			lcv = lcv.Mid(pos+1);
 		}
diff --git a/intern/tools/credits_svn_gen.py b/intern/tools/credits_svn_gen.py
index 71974af..f3aa2bf 100644
--- a/intern/tools/credits_svn_gen.py
+++ b/intern/tools/credits_svn_gen.py
@@ -163,6 +163,7 @@ author_name_mapping = {
     "dfelinto": "Dalai Felinto",
     "dingto": "Thomas Dinges",
     "djcapelis": "D.J. Capelis",
+    "domino": "Domino Marama",
     "dougal2": "Doug Hammond",
     "eeshlo": "Alfredo de Greef",
     "elubie": "Andrea Weikert",
@@ -232,10 +233,11 @@ author_name_mapping = {
     "schlaile": "Peter Schlaile",
     "scourage": "Robert Holcomb",
     "sgefant": "Stefan Gartner",
-    "sirdude": "sirdude",
+    "sirdude": "Kent Mein",
     "smerch": "Alex Sytnik",
     "snailrose": "Charlie Carley",
     "stiv": "Stephen Swaney",
+    "trumanblending": "Andrew Hale",
     "theeth": "Martin Poirier",
     "themyers": "Ricki Myers",
     "ton": "Ton Roosendaal",
@@ -248,7 +250,12 @@ author_name_mapping = {
     "zuster": "Daniel Dunbar",
     "jason_hays22": "Jason Hays",
     "miikah": "Miika Hamalainen",
-
+    "howardt": "Howard Trickey",
+    "kanttori": "Juha Mäki-Kanto",
+    "xglasyliax": "Peter Larabell",
+    "lockal": "Sv. Lockal",
+    "kupoman": "Daniel Stokes",
+    "xercesblue": "Francisco De La Cruz",
     # TODO, find remaining names
     "nlin": "",
     }
@@ -275,7 +282,10 @@ def build_patch_name_map(filepath):
     """
     patches = {}
     import csv
-    tracker = csv.reader(open(filepath, 'r', encoding='utf-8'), delimiter=';', quotechar='|')
+    tracker = csv.reader(open(filepath, 'r', encoding='utf-8'),
+                         delimiter=';',
+                         quotechar='|')
+
     for i, row in enumerate(tracker):
         if i == 0:
             id_index = row.index("artifact_id")
@@ -396,7 +406,14 @@ def main():
 
             if patch_author is None:
                 # will error out if we miss adding new devs
-                credit = credits[commit.author]
+                credit = credits.get(commit.author)
+                if credit is None:
+                    print("warning: '%s' is not in 'author_name_mapping' !" %
+                          commit.author)
+
+                    # will be discarded
+                    credit = Credit()
+
             else:
                 # so we dont use again
                 del patch_map[patch_id]
@@ -432,7 +449,12 @@ def main():
         if not credit.commits:
             continue
 
-        author_real = author_name_mapping[author]
+        author_real = author_name_mapping.get(author)
+
+        if author_real is None:
+            print("warning: '%s' is not in 'author_name_mapping' dict!")
+            author_real = author
+
         if author_real == author:
             name_string = "<b>%s</b>" % author
         else:
@@ -477,6 +499,7 @@ def main():
                (fn, now.year, now.month, now.day))
 
     file.close()
+    print("written: credits.html")
 
 if __name__ == "__main__":
     main()
diff --git a/intern/utfconv/CMakeLists.txt b/intern/utfconv/CMakeLists.txt
new file mode 100644
index 0000000..118d171
--- /dev/null
+++ b/intern/utfconv/CMakeLists.txt
@@ -0,0 +1,43 @@
+# ***** 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 *****
+
+set(INC
+	.
+)
+
+set(INC_SYS
+
+)
+
+set(SRC
+	utfconv.c
+
+	utfconv.h
+)
+
+# This is odd but leave it for now...
+# Why have win32 check here? - this is only used for windows.
+# ... because one day we might want to use it on other platforms.
+if(WIN32)
+	list(APPEND SRC
+		utf_winfunc.c
+		utf_winfunc.h
+	)
+endif()
+
+blender_add_lib(bf_intern_utfconv "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/intern/utfconv/SConscript b/intern/utfconv/SConscript
new file mode 100644
index 0000000..19a698b
--- /dev/null
+++ b/intern/utfconv/SConscript
@@ -0,0 +1,15 @@
+#!/usr/bin/python
+Import ('env')
+
+sources = ['utfconv.c']
+
+incs = '.'
+defs = ''
+
+# This is odd but leave it for now...
+# Why have win32 check here? - this is only used for windows.
+# ... because one day we might want to use it on other platforms.
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-mingw', 'linuxcross', 'win64-vc'):
+	sources += ['utf_winfunc.c']
+
+env.BlenderLib('bf_utfconv', sources, Split(incs), Split(defs), libtype=['intern','player'], priority=[0,0])
diff --git a/intern/utfconv/utf_winfunc.c b/intern/utfconv/utf_winfunc.c
new file mode 100644
index 0000000..2e200ea
--- /dev/null
+++ b/intern/utfconv/utf_winfunc.c
@@ -0,0 +1,153 @@
+/*
+ * ***** 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): Alexandr Kuznetsov, Andrea Weikert
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef _WIN32_IE
+#define _WIN32_IE 0x0501
+#endif
+
+#include "utf_winfunc.h"
+#include <io.h>
+#include <Windows.h>
+#include <wchar.h>
+
+
+FILE * ufopen(const char * filename, const char * mode)
+{
+	FILE *f = NULL;
+	UTF16_ENCODE(filename);
+	UTF16_ENCODE (mode);
+
+	if(filename_16 && mode_16) {
+		f = _wfopen(filename_16, mode_16);
+	}
+	
+	UTF16_UN_ENCODE(mode);
+	UTF16_UN_ENCODE(filename);
+
+	if (!f) {
+		if ((f = fopen(filename, mode))) {
+			printf("WARNING: %s is not utf path. Please update it.\n",filename);
+		}
+	}
+
+	return f;
+}
+
+int uopen(const char *filename, int oflag, int pmode)
+{
+	int f = -1;
+	UTF16_ENCODE(filename);
+	
+	if (filename_16) {
+		f = _wopen(filename_16, oflag, pmode);
+	}
+
+	UTF16_UN_ENCODE(filename);
+
+	if (f == -1) {
+		if ((f=open(filename,oflag, pmode)) != -1) {
+			printf("WARNING: %s is not utf path. Please update it.\n",filename);
+		}
+	}
+
+	return f;
+}
+
+int urename(const char *oldname, const char *newname )
+{
+	int r = -1;
+	UTF16_ENCODE(oldname);
+	UTF16_ENCODE (newname);
+
+	if(oldname_16 && newname_16) r = _wrename(oldname_16, newname_16);
+	
+	UTF16_UN_ENCODE(newname);
+	UTF16_UN_ENCODE(oldname);
+	return r;
+}
+
+int umkdir(const char *pathname)
+{
+
+	BOOL r = 0;
+	UTF16_ENCODE(pathname);
+	
+	if(pathname_16) r = CreateDirectoryW(pathname_16, NULL);
+
+	UTF16_UN_ENCODE(pathname);
+
+	return r ? 0 : -1;
+}
+
+char * u_alloc_getenv(const char *varname)
+{
+	char * r = 0;
+	wchar_t * str;
+	UTF16_ENCODE(varname);
+	if (varname_16) {
+		str = _wgetenv(varname_16);
+		r = alloc_utf_8_from_16(str, 0);
+	}
+	UTF16_UN_ENCODE(varname);
+
+	return r;
+}
+void  u_free_getenv(char *val)
+{
+	free(val);
+}
+
+int uput_getenv(const char *varname, char * value, size_t buffsize)
+{
+	int r = 0;
+	wchar_t * str;
+	if(!buffsize) return r;
+
+	UTF16_ENCODE(varname);
+	if(varname_16) {
+		str = _wgetenv(varname_16);
+		conv_utf_16_to_8(str, value, buffsize);
+		r = 1;
+	}
+	UTF16_UN_ENCODE(varname);
+
+	if (!r) value[0] = 0;
+
+	return r;
+}
+
+int uputenv(const char *name, const char *value)
+{
+	int r = -1;
+	UTF16_ENCODE(name);
+	UTF16_ENCODE(value);
+	if(name_16 && value_16) {
+		r = (SetEnvironmentVariableW(name_16,value_16)!= 0) ? 0 : -1;
+	}
+	UTF16_UN_ENCODE(value);
+	UTF16_UN_ENCODE(name);
+
+	return r;
+}
diff --git a/intern/utfconv/utf_winfunc.h b/intern/utfconv/utf_winfunc.h
new file mode 100644
index 0000000..e92e795
--- /dev/null
+++ b/intern/utfconv/utf_winfunc.h
@@ -0,0 +1,43 @@
+/*
+ * ***** 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): Alexandr Kuznetsov, Andrea Weikert
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef WIN32
+#  error "This file can only compile on windows"
+#endif
+
+#include "utfconv.h"
+#include <stdio.h>
+
+FILE * ufopen(const char * filename, const char * mode);
+int uopen(const char *filename, int oflag, int pmode);
+int urename(const char *oldname, const char *newname );
+
+char * u_alloc_getenv(const char *varname);
+void  u_free_getenv(char *val);
+
+int uput_getenv(const char *varname, char * value, size_t buffsize);
+int uputenv(const char *name, const char *value);
+
+int umkdir(const char *pathname);
diff --git a/intern/utfconv/utfconv.c b/intern/utfconv/utfconv.c
new file mode 100644
index 0000000..b9946a6
--- /dev/null
+++ b/intern/utfconv/utfconv.c
@@ -0,0 +1,259 @@
+/*
+ * ***** 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): Alexandr Kuznetsov, Andrea Weikert
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "utfconv.h"
+
+size_t count_utf_8_from_16(const wchar_t *string16)
+{
+	int i;
+	size_t count = 0;
+	wchar_t u = 0;
+	if (!string16) {
+		return 0;
+	}
+
+    for (i = 0; (u = string16[i]); i++) {
+		if (u < 0x0080) {
+			count += 1;
+		}
+		else {
+			if (u < 0x0800) {
+				count += 2;
+			}
+			else {
+				if (u < 0xD800) {
+					count += 3;
+				}
+				else {
+					if (u < 0xDC00) {
+						i++;
+						if ((u = string16[i]) == 0) {
+							break;
+						}
+						if (u >= 0xDC00 && u < 0xE000) {
+							count += 4;
+						}
+					}
+					else {
+						if (u < 0xE000) {
+							/*illigal*/;
+						}
+						else {
+							count += 3;
+						}
+					}
+				}
+			}
+		}
+	}
+
+	return ++count;
+}
+
+
+size_t count_utf_16_from_8(const char *string8)
+{
+	size_t count = 0;
+	char u;
+	char type = 0;
+	unsigned int u32 = 0;
+
+	if (!string8) return 0;
+
+	for (; (u = *string8); string8++) {
+		if (type == 0) {
+			if ((u & 0x01 << 7) == 0)     { count++; u32 = 0; continue; }       //1 utf-8 char
+			if ((u & 0x07 << 5) == 0xC0)  { type = 1; u32 = u & 0x1F; continue; } //2 utf-8 char
+			if ((u & 0x0F << 4) == 0xE0)  { type = 2; u32 = u & 0x0F; continue; } //3 utf-8 char
+			if ((u & 0x1F << 3) == 0xF0)  { type = 3; u32 = u & 0x07; continue; } //4 utf-8 char
+			continue;
+		}
+		else {
+			if ((u & 0xC0) == 0x80) {
+				u32 = (u32 << 6) | (u & 0x3F);
+				type--;
+			}
+			else {
+				u32 = 0;
+				type = 0;
+			}
+		}
+
+		if (type == 0) {
+			if ((0 < u32 && u32 < 0xD800) || (0xE000 <= u32 && u32 < 0x10000)) count++;
+			else if (0x10000 <= u32 && u32 < 0x110000) count += 2;
+			u32 = 0;
+		}
+	}
+
+	return ++count;
+}
+
+
+int conv_utf_16_to_8(const wchar_t *in16, char *out8, size_t size8)
+{
+	char *out8end = out8 + size8;
+	wchar_t u = 0;
+	int err = 0;
+	if (!size8 || !in16 || !out8) return UTF_ERROR_NULL_IN;
+	out8end--;
+
+	for (; out8 < out8end && (u = *in16); in16++, out8++) {
+		if (u < 0x0080) {
+			*out8 = u;
+		}
+		else if (u < 0x0800) {
+			if (out8 + 1 >= out8end) break;
+			*out8++ = (0x3 << 6) | (0x1F & (u >> 6));
+			*out8  = (0x1 << 7) | (0x3F & (u));
+		}
+		else if (u < 0xD800 || u >= 0xE000) {
+			if (out8 + 2 >= out8end) break;
+			*out8++ = (0x7 << 5) | (0xF & (u >> 12));
+			*out8++ = (0x1 << 7) | (0x3F & (u >> 6));;
+			*out8  = (0x1 << 7) | (0x3F & (u));
+		}
+		else if (u < 0xDC00) {
+			wchar_t u2 = *++in16;
+
+			if (!u2) break;
+			if (u2 >= 0xDC00 && u2 < 0xE000) {
+				if (out8 + 3 >= out8end) break; else {
+					unsigned int uc = 0x10000 + (u2 - 0xDC00) + ((u - 0xD800) << 10);
+
+					*out8++ = (0xF << 4) | (0x7 & (uc >> 18));
+					*out8++ = (0x1 << 7) | (0x3F & (uc >> 12));
+					*out8++ = (0x1 << 7) | (0x3F & (uc >> 6));
+					*out8  = (0x1 << 7) | (0x3F & (uc));
+				}
+			}
+			else {
+				out8--; err |= UTF_ERROR_ILLCHAR;
+			}
+		}
+		else if (u < 0xE000) {
+			out8--; err |= UTF_ERROR_ILLCHAR;
+		}
+	}
+
+	*out8 = *out8end = 0;
+
+	if (*in16) err |= UTF_ERROR_SMALL;
+
+	return err;
+}
+
+
+int conv_utf_8_to_16(const char *in8, wchar_t *out16, size_t size16)
+{
+	char u;
+	char type = 0;
+	wchar_t u32 = 0;
+	wchar_t *out16end = out16 + size16;
+	int err = 0;
+	if (!size16 || !in8 || !out16) return UTF_ERROR_NULL_IN;
+	out16end--;
+
+	for (; out16 < out16end && (u = *in8); in8++) {
+		if (type == 0) {
+			if ((u & 0x01 << 7) == 0)     { *out16 = u; out16++; u32 = 0; continue; } //1 utf-8 char
+			if ((u & 0x07 << 5) == 0xC0)  { type = 1; u32 = u & 0x1F; continue; }     //2 utf-8 char
+			if ((u & 0x0F << 4) == 0xE0)  { type = 2; u32 = u & 0x0F; continue; }     //3 utf-8 char
+			if ((u & 0x1F << 3) == 0xF0)  { type = 3; u32 = u & 0x07; continue; }     //4 utf-8 char
+			err |= UTF_ERROR_ILLCHAR;
+			continue;
+		}
+		else {
+			if ((u & 0xC0) == 0x80) {
+				u32 = (u32 << 6) | (u & 0x3F);
+				type--;
+			}
+			else {
+				u32 = 0; type = 0; err |= UTF_ERROR_ILLSEQ;
+			}
+		}
+		if (type == 0) {
+			if ((0 < u32 && u32 < 0xD800) || (0xE000 <= u32 && u32 < 0x10000)) {
+				*out16 = u32;
+				out16++;
+			}
+			else if (0x10000 <= u32 && u32 < 0x110000) {
+				if (out16 + 1 >= out16end) break;
+				u32 -= 0x10000;
+				*out16 = 0xD800 + (u32 >> 10);
+				out16++;
+				*out16 = 0xDC00 + (u32 & 0x3FF);
+				out16++;
+			}
+			u32 = 0;
+		}
+
+	}
+
+	*out16 = *out16end = 0;
+
+	if (*in8) err |= UTF_ERROR_SMALL;
+
+	return err;
+}
+
+int is_ascii(const char *in8)
+{
+	for (; *in8; in8++)
+		if (0x80 & *in8) return 0;
+
+	return 1;
+}
+
+void utf_8_cut_end(char *inout8, size_t maxcutpoint)
+{
+	char *cur = inout8 + maxcutpoint;
+	char cc;
+	if (!inout8) return;
+
+	cc = *cur;
+}
+
+
+
+char *alloc_utf_8_from_16(const wchar_t *in16, size_t add)
+{
+	size_t bsize = count_utf_8_from_16(in16);
+	char *out8 = NULL;
+	if (!bsize) return NULL;
+	out8 = (char *)malloc(sizeof(char) * (bsize + add));
+	conv_utf_16_to_8(in16, out8, bsize);
+	return out8;
+}
+
+wchar_t *alloc_utf16_from_8(const char *in8, size_t add)
+{
+	size_t bsize = count_utf_16_from_8(in8);
+	wchar_t *out16 = NULL;
+	if (!bsize) return NULL;
+	out16 = (wchar_t *) malloc(sizeof(wchar_t) * (bsize + add));
+	conv_utf_8_to_16(in8, out16, bsize);
+	return out16;
+}
diff --git a/intern/utfconv/utfconv.h b/intern/utfconv/utfconv.h
new file mode 100644
index 0000000..3bfd277
--- /dev/null
+++ b/intern/utfconv/utfconv.h
@@ -0,0 +1,102 @@
+/*
+ * ***** 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): Alexandr Kuznetsov, Andrea Weikert
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <wchar.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+
+#ifdef __cplusplus 
+extern  "C" {
+#endif
+
+/**
+ * Counts how many bytes is requered for for future utf-8 string using utf-16
+ * @param string-16 pointer to working utf-16 string
+ * @return How many bytes must be allocated includeng NULL.
+ */
+size_t count_utf_8_from_16(const wchar_t *string16);
+
+/**
+ * Counts how many wchar_t (two byte) is requered for for future utf-16 string using utf-8
+ * @param string-8 pointer to working utf-8 string
+ * @return How many bytes must be allocated includeng NULL.
+ */
+size_t count_utf_16_from_8(const char *string8);
+
+/**
+ * conv_utf_*** errors
+ */
+#define UTF_ERROR_NULL_IN 1 << 0 /* Error occures when requered parameter is missing*/
+#define UTF_ERROR_ILLCHAR 1 << 1 /* Error if character is in illigal UTF rage*/
+#define UTF_ERROR_SMALL   1 << 2 /* Passed size is to small. It gives legal string with character missing at the end*/
+#define UTF_ERROR_ILLSEQ  1 << 3 /* Error if sequence is broken and doesn't finish*/
+
+/**
+ * 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
+ * @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
+ * @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);
+
+
+/**
+ * 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
+ * @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)
+ * @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);
+
+/* Easy allocation and conversion of new utf-16 string. New string has _16 suffix. Must be deallocated with UTF16_UN_ENCODE in right order*/
+#define UTF16_ENCODE(in8str) if (1) { \
+		wchar_t *in8str ## _16 = alloc_utf16_from_8((char *)in8str, 0)
+
+#define UTF16_UN_ENCODE(in8str) \
+    free(in8str ## _16); } (void)0
+
+#ifdef __cplusplus 
+}
+#endif
diff --git a/release/datafiles/blender_icons.png b/release/datafiles/blender_icons.png
index 805b283..3598823 100644
Binary files a/release/datafiles/blender_icons.png and b/release/datafiles/blender_icons.png differ
diff --git a/release/datafiles/brushicons/claystrips.png b/release/datafiles/brushicons/claystrips.png
new file mode 100644
index 0000000..f8efc33
Binary files /dev/null and b/release/datafiles/brushicons/claystrips.png differ
diff --git a/release/datafiles/ctodata.py b/release/datafiles/ctodata.py
old mode 100644
new mode 100755
index 2d2daab..a81a101
--- a/release/datafiles/ctodata.py
+++ b/release/datafiles/ctodata.py
@@ -44,14 +44,22 @@ except:
 data = fpin.read().rsplit("{")[-1].split("}")[0]
 data = data.replace(",", " ")
 data = data.split()
-data = bytes([int(v) for v in data])
+data = [int(v) for v in data]
+# for some reason all data gets trailing byte
+last = data.pop()
+assert(last == 0)
+data = bytes(data)
 
 dname = filename + ".ctodata"
 
+sys.stdout.write("Making DATA file <%s>\n" % dname)
+
 try:
     fpout = open(dname, "wb")
 except:
     sys.stdout.write("Unable to open output %s\n" % dname)
     sys.exit(1)
 
-fpout.write(data)
+size = fpout.write(data)
+
+sys.stdout.write("%d\n" % size)
diff --git a/release/datafiles/datatoc.py b/release/datafiles/datatoc.py
index 564070d..f1fce08 100755
--- a/release/datafiles/datatoc.py
+++ b/release/datafiles/datatoc.py
@@ -53,8 +53,8 @@ sys.stdout.write("Making C file <%s>\n" % cname)
 
 filename = filename.split("/")[-1].split("\\")[-1]
 filename = filename.replace(".", "_")
-sys.stdout.write(str(size))
-sys.stdout.write("\n")
+sys.stdout.write("%d\n" % size)
+
 try:
     fpout = open(cname, "w")
 except:
@@ -62,9 +62,9 @@ except:
     sys.exit(1)
 
 fpout.write("/* DataToC output of file <%s> */\n\n" % filename)
-fpout.write("int datatoc_%s_size= %d;\n" % (filename, size))
+fpout.write("int datatoc_%s_size = %d;\n" % (filename, size))
 
-fpout.write("char datatoc_%s[]= {\n" % filename)
+fpout.write("char datatoc_%s[] = {\n" % filename)
 
 while size > 0:
     size -= 1
diff --git a/release/datafiles/fonts/droidsans.ttf.gz b/release/datafiles/fonts/droidsans.ttf.gz
index fdf92f6..b2eb31a 100644
Binary files a/release/datafiles/fonts/droidsans.ttf.gz and b/release/datafiles/fonts/droidsans.ttf.gz differ
diff --git a/release/datafiles/locale/ar/LC_MESSAGES/blender.mo b/release/datafiles/locale/ar/LC_MESSAGES/blender.mo
index 6afccc5..883e7ea 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
index 4a1b9d3..eec8c76 100644
Binary files a/release/datafiles/locale/bg/LC_MESSAGES/blender.mo and b/release/datafiles/locale/bg/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/ca/LC_MESSAGES/blender.mo b/release/datafiles/locale/ca/LC_MESSAGES/blender.mo
index 5241d17..b1fb6f1 100644
Binary files a/release/datafiles/locale/ca/LC_MESSAGES/blender.mo and b/release/datafiles/locale/ca/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/cs/LC_MESSAGES/blender.mo b/release/datafiles/locale/cs/LC_MESSAGES/blender.mo
index 87f2d6b..b78cf9c 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 d52f22a..a410616 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
index 8c068cd..8e1ad66 100644
Binary files a/release/datafiles/locale/el/LC_MESSAGES/blender.mo and b/release/datafiles/locale/el/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 7284271..2445e53 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 cdbfcf9..227a3d4 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/es_MX/LC_MESSAGES/blender.mo b/release/datafiles/locale/es_MX/LC_MESSAGES/blender.mo
deleted file mode 100644
index a3b1a47..0000000
Binary files a/release/datafiles/locale/es_MX/LC_MESSAGES/blender.mo and /dev/null differ
diff --git a/release/datafiles/locale/fa/LC_MESSAGES/blender.mo b/release/datafiles/locale/fa/LC_MESSAGES/blender.mo
index ab9d864..5b6b142 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
index ea2c5d9..224105b 100644
Binary files a/release/datafiles/locale/fi/LC_MESSAGES/blender.mo and b/release/datafiles/locale/fi/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/fr/LC_MESSAGES/blender.mo b/release/datafiles/locale/fr/LC_MESSAGES/blender.mo
index f73c5e5..61ef8aa 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/hr/LC_MESSAGES/blender.mo b/release/datafiles/locale/hr/LC_MESSAGES/blender.mo
new file mode 100644
index 0000000..e9df252
Binary files /dev/null and b/release/datafiles/locale/hr/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 c445a82..2d8004e 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 9827c2e..dc0ba41 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 27a93bd..58c7888 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 989c871..fd4aea4 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/ne/LC_MESSAGES/blender.mo b/release/datafiles/locale/ne/LC_MESSAGES/blender.mo
index 9a8afe9..f84856d 100644
Binary files a/release/datafiles/locale/ne/LC_MESSAGES/blender.mo and b/release/datafiles/locale/ne/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
index f8d9be6..bec7129 100644
Binary files a/release/datafiles/locale/pl/LC_MESSAGES/blender.mo and b/release/datafiles/locale/pl/LC_MESSAGES/blender.mo differ
diff --git a/release/datafiles/locale/pt/LC_MESSAGES/blender.mo b/release/datafiles/locale/pt/LC_MESSAGES/blender.mo
new file mode 100644
index 0000000..35010d7
Binary files /dev/null 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
deleted file mode 100644
index 9841f1b..0000000
Binary files a/release/datafiles/locale/pt_BR/LC_MESSAGES/blender.mo and /dev/null differ
diff --git a/release/datafiles/locale/ru/LC_MESSAGES/blender.mo b/release/datafiles/locale/ru/LC_MESSAGES/blender.mo
index 41f8da4..22d206c 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 d98466d..6af6434 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 d3deb6e..a41cc6e 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 14e2591..7bad234 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
new file mode 100644
index 0000000..d7de5d3
Binary files /dev/null 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
new file mode 100644
index 0000000..ccac7d3
Binary files /dev/null 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 f63c219..ac878a5 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 df3b328..63b06bb 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/splash.png b/release/datafiles/splash.png
index 47aca04..2dab925 100644
Binary files a/release/datafiles/splash.png and b/release/datafiles/splash.png differ
diff --git a/release/freedesktop/blender.desktop b/release/freedesktop/blender.desktop
index 34b2b9b..1620815 100644
--- a/release/freedesktop/blender.desktop
+++ b/release/freedesktop/blender.desktop
@@ -2,11 +2,12 @@
 Name=Blender
 GenericName=3D modeller
 GenericName[es]=modelador 3D
-GenericName[de]=3D Modellierer
+GenericName[de]=3D-Modellierer
 GenericName[fr]=modeleur 3D
 GenericName[ru]=Редактор 3D-моделей
 Comment=3D modeling, animation, rendering and post-production
 Comment[es]=modelado 3D, animación, renderizado y post-producción
+Comment[de]=3D-Modellierung, Animation, Rendering und Nachbearbeitung
 Exec=blender
 Icon=blender
 Terminal=false
diff --git a/release/plugins/sequence/color-correction-hsv.c b/release/plugins/sequence/color-correction-hsv.c
index 1dcf009..b9ffd88 100644
--- a/release/plugins/sequence/color-correction-hsv.c
+++ b/release/plugins/sequence/color-correction-hsv.c
@@ -15,7 +15,7 @@
  *
  */
 
-#include "math.h"
+#include <math.h>
 #include "plugin.h"
 #include <stdio.h>
 
diff --git a/release/plugins/sequence/color-correction-yuv.c b/release/plugins/sequence/color-correction-yuv.c
index cc6c619..c0c5d04 100644
--- a/release/plugins/sequence/color-correction-yuv.c
+++ b/release/plugins/sequence/color-correction-yuv.c
@@ -15,7 +15,7 @@
  *
  */
 
-#include "math.h"
+#include <math.h>
 #include "plugin.h"
 #include <stdio.h>
 
diff --git a/release/plugins/sequence/dnr.c b/release/plugins/sequence/dnr.c
index ab47361..9c42098 100644
--- a/release/plugins/sequence/dnr.c
+++ b/release/plugins/sequence/dnr.c
@@ -15,7 +15,7 @@
  *
  */
 
-#include "math.h"
+#include <math.h>
 #include "plugin.h"
 #include <stdio.h>
 
diff --git a/release/plugins/sequence/gamma.c b/release/plugins/sequence/gamma.c
index 596c986..d6181eb 100644
--- a/release/plugins/sequence/gamma.c
+++ b/release/plugins/sequence/gamma.c
@@ -15,7 +15,7 @@
  *
  */
 
-#include "math.h"
+#include <math.h>
 #include "plugin.h"
 #include "util.h"
 #include <stdio.h>
diff --git a/release/plugins/texture/clouds2.c b/release/plugins/texture/clouds2.c
index 454e8e2..fc20f57 100644
--- a/release/plugins/texture/clouds2.c
+++ b/release/plugins/texture/clouds2.c
@@ -26,7 +26,7 @@
  * ***** END GPL LICENSE BLOCK *****
  */
  
-#include "math.h"
+#include <math.h>
 #include "plugin.h"
 
 /* ******************** GLOBAL VARIABLES ***************** */
diff --git a/release/plugins/texture/tiles.c b/release/plugins/texture/tiles.c
index c7af6e5..151f64b 100644
--- a/release/plugins/texture/tiles.c
+++ b/release/plugins/texture/tiles.c
@@ -26,7 +26,7 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#include "math.h"
+#include <math.h>
 #include "plugin.h"
 
 /* ******************** GLOBAL VARIABLES ***************** */
diff --git a/release/scripts/addons/add_curve_sapling/utils.py b/release/scripts/addons/add_curve_sapling/utils.py
index f74fcef..9d7b17c 100644
--- a/release/scripts/addons/add_curve_sapling/utils.py
+++ b/release/scripts/addons/add_curve_sapling/utils.py
@@ -760,12 +760,14 @@ def addTree(props):
             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))
-
+            '''
 # This can be used if we need particle leaves
 #            if (storeN == levels-1) and leaves:
 #                normalList = []
diff --git a/release/scripts/addons/add_curve_torus_knots.py b/release/scripts/addons/add_curve_torus_knots.py
index bba2afd..d4ea391 100644
--- a/release/scripts/addons/add_curve_torus_knots.py
+++ b/release/scripts/addons/add_curve_torus_knots.py
@@ -37,7 +37,7 @@ bl_info = {
 import bpy
 from bpy.props import *
 from math import sin, cos, pi
-from add_utils import *
+from bpy_extras.object_utils import AddObjectHelper, object_data_add
 
     
 ########################################################################
@@ -93,7 +93,7 @@ def create_torus_knot(self, context):
         #curve_data.offset = self.geo_width # removed, somehow screws things up all of a sudden
         curve_data.resolution_u = self.geo_res
     
-    new_obj = add_object_data(context, curve_data, operator=self)
+    new_obj = object_data_add(context, curve_data, operator=self)
 
 
 class torus_knot_plus(bpy.types.Operator, AddObjectHelper):
diff --git a/release/scripts/addons/add_mesh_ant_landscape.py b/release/scripts/addons/add_mesh_ant_landscape.py
index b7fe7d0..2e6441f 100644
--- a/release/scripts/addons/add_mesh_ant_landscape.py
+++ b/release/scripts/addons/add_mesh_ant_landscape.py
@@ -775,11 +775,13 @@ class landscape_add(bpy.types.Operator):
 
             # create mesh object
             obj = create_mesh_object(context, verts, [], faces, "Landscape")
-
+            bpy.ops.object.mode_set(mode='EDIT')
+            bpy.ops.mesh.normals_make_consistent(inside=False)
+            bpy.ops.object.mode_set(mode='OBJECT')
             # sphere, remove doubles
             if self.SphereMesh !=0:
                 bpy.ops.object.mode_set(mode='EDIT')
-                bpy.ops.mesh.remove_doubles(limit=0.0001)
+                bpy.ops.mesh.remove_doubles(mergedist=0.0001)
                 bpy.ops.object.mode_set(mode='OBJECT')
 
             # Shade smooth
diff --git a/release/scripts/addons/add_mesh_extra_objects/add_mesh_polysphere.py b/release/scripts/addons/add_mesh_extra_objects/add_mesh_polysphere.py
index 9035a90..7b4ac56 100644
--- a/release/scripts/addons/add_mesh_extra_objects/add_mesh_polysphere.py
+++ b/release/scripts/addons/add_mesh_extra_objects/add_mesh_polysphere.py
@@ -18,9 +18,9 @@
 '''
 bl_info = {
     "name": "Add PolySphere",
-    "author": "Andy Davies (metalliandy)",
-    "version": (0,1,5),
-    "blender": (2, 5, 8),
+    "author": "Andy Davies (metalliandy)",			
+    "version": (0,1,6),
+    "blender": (2, 6, 2),
     "location": "View3D > Add > Mesh > PolySphere",
     "description": "Adds a PolySphere (all quads) for sculpting",
     "warning": "",
@@ -62,7 +62,7 @@ def Add_PolySphere():
     bpy.ops.object.editmode_toggle()
 
     #Selects cube in Editmode
-    bpy.ops.mesh.select_all(action='TOGGLE')
+    #bpy.ops.mesh.select_all(action='TOGGLE')
 
     #Adds transform "To Sphere"
     bpy.ops.transform.tosphere(value=1)
diff --git a/release/scripts/addons/add_mesh_extra_objects/add_mesh_pyramid.py b/release/scripts/addons/add_mesh_extra_objects/add_mesh_pyramid.py
index 69a530f..0b961b1 100644
--- a/release/scripts/addons/add_mesh_extra_objects/add_mesh_pyramid.py
+++ b/release/scripts/addons/add_mesh_extra_objects/add_mesh_pyramid.py
@@ -22,8 +22,8 @@
 bl_info = {
     'name': 'Mesh Pyramid',
     'author': 'Phil Cote, cotejrp1, (http://www.blenderaddons.com)',
-    'version': (0, 3),
-    "blender": (2, 5, 8),
+    'version': (0, 4),
+    "blender": (2, 6, 3),
     'location': 'View3D > Add > Mesh',
     'description': 'Create an egyption-style step pyramid',
     'warning': '',  # used for warning icon and text in addons panel
@@ -31,9 +31,10 @@ bl_info = {
 '''
 
 import bpy
-from bpy.props import IntProperty, FloatProperty
+import bmesh
 
-from add_utils import AddObjectHelper, add_object_data
+from bpy.props import IntProperty, FloatProperty
+from bpy_extras.object_utils import AddObjectHelper, object_data_add
 
 
 def makePyramid(initial_size, step_height, step_width, number_steps):
@@ -101,11 +102,18 @@ def makePyramid(initial_size, step_height, step_width, number_steps):
 def add_pyramid_object(self, context):
     verts, faces = makePyramid(self.initial_size, self.step_height,
                             self.step_width, self.number_steps)
-
-    mesh_data = bpy.data.meshes.new(name="Pyramid")
-    mesh_data.from_pydata(verts, [], faces)
-    mesh_data.update()
-    res = add_object_data(context, mesh_data, operator=self)
+    bm = bmesh.new()
+    mesh = bpy.data.meshes.new(name="Pyramid")
+    
+    for vert in verts:
+        bm.verts.new(vert)
+    
+    for face in faces:
+        bm.faces.new([bm.verts[i] for i in face])
+    
+    bm.to_mesh(mesh)
+    mesh.update()
+    res = object_data_add(context, mesh, operator=self)
 
 
 class AddPyramid(bpy.types.Operator, AddObjectHelper):
@@ -151,4 +159,4 @@ def unregister():
 
 if __name__ == "__main__":
     register()
-'''
+'''
\ No newline at end of file
diff --git a/release/scripts/addons/add_mesh_solid.py b/release/scripts/addons/add_mesh_solid.py
index d0b1417..f43eea7 100644
--- a/release/scripts/addons/add_mesh_solid.py
+++ b/release/scripts/addons/add_mesh_solid.py
@@ -43,7 +43,7 @@ from bpy_extras.object_utils import object_data_add
 # assumes each polygon is convex.
 #  poly: list of faces, or a single face, like those
 #        needed for mesh.from_pydata.
-#  returns the tesselated faces.
+#  returns the tessellated faces.
 def createPolys(poly):
     # check for faces
     if len(poly) == 0:
diff --git a/release/scripts/addons/io_anim_acclaim/__init__.py b/release/scripts/addons/io_anim_acclaim/__init__.py
index c43c01f..65481ed 100644
--- a/release/scripts/addons/io_anim_acclaim/__init__.py
+++ b/release/scripts/addons/io_anim_acclaim/__init__.py
@@ -25,9 +25,9 @@
 bl_info = {
     'name': "Acclaim Motion Capture Files (.asf, .amc)",
     'author': "Daniel Monteiro Basso <daniel at basso.inf.br>",
-    'version': (2011, 11, 2, 1),
-    'blender': (2, 6, 0),
-    'location': "File > Import",
+    'version': (2012, 2, 29, 1),
+    'blender': (2, 6, 2),
+    'location': "File > Import-Export",
     'description': "Imports Acclaim Skeleton and Motion Capture Files",
     'wiki_url': "http://wiki.blender.org/index.php/Extensions:2.5/Py/"
                 "Scripts/Import-Export/Acclaim_Importer",
@@ -39,7 +39,7 @@ bl_info = {
 import re
 import bpy
 from mathutils import Vector, Matrix
-from math import radians
+from math import radians, degrees
 from bpy.props import (StringProperty,
                        BoolProperty,
                        FloatProperty,
@@ -140,6 +140,11 @@ class DataStructure:
                     loc = Vector(vs[:3]) * self.scale
                     vs = vs[3:]
                 rot = Matrix()
+                if 'dof' not in self.bones[b[0]]:
+                    # If 'dof' isn't defined it probably means the AMC comes
+                    # from a different origin than the ASF, such as the
+                    # AMC exporter in this package. Assume XYZ order.
+                    self.bones[b[0]]['dof'] = ['X', 'Y', 'Z']
                 for dof, ang in zip(self.bones[b[0]]['dof'], vs):
                     rot = Matrix.Rotation(radians(ang), 4, dof) * rot
                 self.pose_def[b[0]] = rot
@@ -156,7 +161,7 @@ class DataStructure:
         if bone in self.pose_def:
             tail = bd['axis'] * self.pose_def[bone] * bd['axis_inv'] * tail
         world = parent * tail
-        local = parent.inverted() * world
+        local = tail
         yield(bone, world, local)
         if bone in self.hierarchy:
             for child in self.hierarchy[bone]:
@@ -281,7 +286,7 @@ class StructureBuilder(DataStructure):
                                  b.matrix.to_3x3(),
                                  b.matrix.to_3x3().inverted(),
                                  )
-        self.fno = 0
+        self.fno = 1  # default Blender scene start frame
         self.use_frame_no = use_frame_no
         self.motion = iter(self.scan_motion_capture(filename, frame_skip))
 
@@ -304,9 +309,9 @@ class StructureBuilder(DataStructure):
 
 
 class AsfImporter(bpy.types.Operator):
-    """
-        Load an Acclaim Skeleton File
-    """
+    #
+    "Load an Acclaim Skeleton File"
+    #
     bl_idname = "import_anim.asf"
     bl_label = "Import ASF"
 
@@ -398,9 +403,9 @@ class AmcAnimator(bpy.types.Operator):
 
 
 class AmcImporter(bpy.types.Operator):
-    """
-        Load an Acclaim Motion Capture
-    """
+    #
+    "Load an Acclaim Motion Capture"
+    #
     bl_idname = "import_anim.amc"
     bl_label = "Import AMC"
 
@@ -453,26 +458,87 @@ class AmcImporter(bpy.types.Operator):
         return {'RUNNING_MODAL'}
 
 
+class AmcExporter(bpy.types.Operator):
+    #
+    "Save an animation in Acclaim format"
+    #
+    bl_idname = "export_anim.amc"
+    bl_label = "Export AMC"
+
+    filepath = StringProperty(
+            subtype='FILE_PATH'
+            )
+    use_scale = BoolProperty(
+            name="Use original armature scale",
+            default=True,
+            description="Scale movement to original scale if available",
+            )
+
+    filter_glob = StringProperty(default="*.amc", options={'HIDDEN'})
+
+    @classmethod
+    def poll(cls, context):
+        ob = context.active_object
+        return (ob and ob.type == 'ARMATURE' and 'source_file_path' in ob)
+
+    def execute(self, context):
+        ob = context.active_object
+        scn = context.scene
+        out = open(self.filepath, "w")
+        out.write(":FULLY-SPECIFIED\n:DEGREES\n")
+        ds = DataStructure(ob['source_file_path'], ob['source_scale'])
+        scale = ds.scale if self.use_scale else 1
+        for frame in range(scn.frame_start, scn.frame_end + 1):
+            out.write("{}\n".format(frame))
+            scn.frame_set(frame)
+            for bone in ob.pose.bones:
+                out.write("{} ".format(bone.name))
+                if bone.name == "root":
+                    loc = bone.location / scale
+                    out.write(" ".join(str(v) for v in loc) + " ")
+                    rot = bone.matrix.to_euler()
+                else:
+                    A = ds.bones[bone.name]['axis'].to_3x3()
+                    R = ob.data.bones[bone.name].matrix_local.to_3x3()
+                    AiR = A.transposed() * R
+                    AiR_i = AiR.inverted()
+                    rot = (AiR * bone.matrix_basis.to_3x3() * AiR_i).to_euler()
+                out.write(" ".join(str(degrees(v)) for v in rot) + "\n")
+        return {'FINISHED'}
+
+    def invoke(self, context, event):
+        wm = context.window_manager
+        wm.fileselect_add(self)
+        return {'RUNNING_MODAL'}
+
+
 def menu_func_s(self, context):
     self.layout.operator(AsfImporter.bl_idname,
                          text="Acclaim Skeleton File (.asf)")
 
 
-def menu_func_m(self, context):
+def menu_func_mi(self, context):
     self.layout.operator(AmcImporter.bl_idname,
                          text="Acclaim Motion Capture (.amc)")
 
 
+def menu_func_me(self, context):
+    self.layout.operator(AmcExporter.bl_idname,
+                         text="Acclaim Motion Capture (.amc)")
+
+
 def register():
     bpy.utils.register_module(__name__)
     bpy.types.INFO_MT_file_import.append(menu_func_s)
-    bpy.types.INFO_MT_file_import.append(menu_func_m)
+    bpy.types.INFO_MT_file_import.append(menu_func_mi)
+    bpy.types.INFO_MT_file_export.append(menu_func_me)
 
 
 def unregister():
     bpy.utils.unregister_module(__name__)
     bpy.types.INFO_MT_file_import.remove(menu_func_s)
-    bpy.types.INFO_MT_file_import.remove(menu_func_m)
+    bpy.types.INFO_MT_file_import.remove(menu_func_mi)
+    bpy.types.INFO_MT_file_export.remove(menu_func_me)
 
 
 if __name__ == "__main__":
diff --git a/release/scripts/addons/io_anim_bvh/export_bvh.py b/release/scripts/addons/io_anim_bvh/export_bvh.py
index 977c36f..fcddb63 100644
--- a/release/scripts/addons/io_anim_bvh/export_bvh.py
+++ b/release/scripts/addons/io_anim_bvh/export_bvh.py
@@ -54,13 +54,11 @@ def write_armature(context,
     for bone in arm.bones:
         children[bone.name] = []
 
+    # keep bone order from armature, no sorting, not esspential but means
+    # we can maintain order from import -> export which secondlife incorrectly expects.
     for bone in arm.bones:
         children[getattr(bone.parent, "name", None)].append(bone.name)
 
-    # sort the children
-    for children_list in children.values():
-        children_list.sort()
-
     # bone name list in the order that the bones are written
     serialized_names = []
 
@@ -157,7 +155,8 @@ def write_armature(context,
             "skip_position",  # is the bone disconnected to the parent bone?
             "rot_order",
             "rot_order_str",
-        )
+            "rot_order_str_reverse",  # needed for the euler order when converting from a matrix
+            )
 
         _eul_order_lookup = {
             'XYZ': (0, 1, 2),
@@ -177,6 +176,7 @@ def write_armature(context,
                 self.rot_order_str = ensure_rot_order(self.pose_bone.rotation_mode)
             else:
                 self.rot_order_str = rotate_mode
+            self.rot_order_str_reverse = self.rot_order_str[::-1]
 
             self.rot_order = DecoratedBone._eul_order_lookup[self.rot_order_str]
 
@@ -192,7 +192,7 @@ def write_armature(context,
             self.rest_local_imat = self.rest_local_mat.inverted()
 
             self.parent = None
-            self.prev_euler = Euler((0.0, 0.0, 0.0), self.rot_order_str)
+            self.prev_euler = Euler((0.0, 0.0, 0.0), self.rot_order_str_reverse)
             self.skip_position = ((self.rest_bone.use_connect or root_transform_only) and self.rest_bone.parent)
 
         def update_posedata(self):
@@ -246,12 +246,12 @@ def write_armature(context,
                 loc = mat_final.to_translation() + dbone.rest_bone.head
 
             # keep eulers compatible, no jumping on interpolation.
-            rot = mat_final.to_3x3().inverted().to_euler(dbone.rot_order_str, dbone.prev_euler)
+            rot = mat_final.to_euler(dbone.rot_order_str_reverse, dbone.prev_euler)
 
             if not dbone.skip_position:
                 file.write("%.6f %.6f %.6f " % (loc * global_scale)[:])
 
-            file.write("%.6f %.6f %.6f " % (-degrees(rot[dbone.rot_order[0]]), -degrees(rot[dbone.rot_order[1]]), -degrees(rot[dbone.rot_order[2]])))
+            file.write("%.6f %.6f %.6f " % (degrees(rot[dbone.rot_order[0]]), degrees(rot[dbone.rot_order[1]]), degrees(rot[dbone.rot_order[2]])))
 
             dbone.prev_euler = rot
 
diff --git a/release/scripts/addons/io_anim_bvh/import_bvh.py b/release/scripts/addons/io_anim_bvh/import_bvh.py
index 0022cc8..a19b39d 100644
--- a/release/scripts/addons/io_anim_bvh/import_bvh.py
+++ b/release/scripts/addons/io_anim_bvh/import_bvh.py
@@ -28,20 +28,22 @@ from mathutils import Vector, Euler, Matrix
 
 class BVH_Node(object):
     __slots__ = (
-    'name',  # bvh joint name
-    'parent',  # BVH_Node type or None for no parent
-    'children',  # a list of children of this type.
-    'rest_head_world',  # worldspace rest location for the head of this node
-    'rest_head_local',  # localspace rest location for the head of this node
-    'rest_tail_world',  # worldspace rest location for the tail of this node
-    'rest_tail_local',  # worldspace rest location for the tail of this node
-    'channels',  # list of 6 ints, -1 for an unused channel, otherwise an index for the BVH motion data lines, lock triple then rot triple
-    'rot_order',  # a triple of indices as to the order rotation is applied. [0,1,2] is x/y/z - [None, None, None] if no rotation.
-    'rot_order_str',  # same as above but a string 'XYZ' format.
-    'anim_data',  # a list one tuple's one for each frame. (locx, locy, locz, rotx, roty, rotz), euler rotation ALWAYS stored xyz order, even when native used.
-    'has_loc',  # Conveinience function, bool, same as (channels[0]!=-1 or channels[1]!=-1 channels[2]!=-1)
-    'has_rot',  # Conveinience function, bool, same as (channels[3]!=-1 or channels[4]!=-1 channels[5]!=-1)
-    'temp')  # use this for whatever you want
+        'name',  # bvh joint name
+        'parent',  # BVH_Node type or None for no parent
+        'children',  # a list of children of this type.
+        'rest_head_world',  # worldspace rest location for the head of this node
+        'rest_head_local',  # localspace rest location for the head of this node
+        'rest_tail_world',  # worldspace rest location for the tail of this node
+        'rest_tail_local',  # worldspace rest location for the tail of this node
+        'channels',  # list of 6 ints, -1 for an unused channel, otherwise an index for the BVH motion data lines, lock triple then rot triple
+        'rot_order',  # a triple of indices as to the order rotation is applied. [0,1,2] is x/y/z - [None, None, None] if no rotation.
+        'rot_order_str',  # same as above but a string 'XYZ' format.
+        'anim_data',  # a list one tuple's one for each frame. (locx, locy, locz, rotx, roty, rotz), euler rotation ALWAYS stored xyz order, even when native used.
+        'has_loc',  # Convenience function, bool, same as (channels[0]!=-1 or channels[1]!=-1 or channels[2]!=-1)
+        'has_rot',  # Convenience function, bool, same as (channels[3]!=-1 or channels[4]!=-1 or channels[5]!=-1)
+        'index',  # index from the file, not strictly needed but nice to maintain order
+        'temp',  # use this for whatever you want
+        )
 
     _eul_order_lookup = {(0, 1, 2): 'XYZ',
                          (0, 2, 1): 'XZY',
@@ -51,7 +53,7 @@ class BVH_Node(object):
                          (2, 1, 0): 'ZYX',
                          }
 
-    def __init__(self, name, rest_head_world, rest_head_local, parent, channels, rot_order):
+    def __init__(self, name, rest_head_world, rest_head_local, parent, channels, rot_order, index):
         self.name = name
         self.rest_head_world = rest_head_world
         self.rest_head_local = rest_head_local
@@ -61,6 +63,7 @@ class BVH_Node(object):
         self.channels = channels
         self.rot_order = tuple(rot_order)
         self.rot_order_str = BVH_Node._eul_order_lookup[self.rot_order]
+        self.index = index
 
         # convenience functions
         self.has_loc = channels[0] != -1 or channels[1] != -1 or channels[2] != -1
@@ -69,7 +72,7 @@ class BVH_Node(object):
         self.children = []
 
         # list of 6 length tuples: (lx,ly,lz, rx,ry,rz)
-        # even if the channels arnt used they will just be zero
+        # even if the channels aren't used they will just be zero
         #
         self.anim_data = [(0, 0, 0, 0, 0, 0)]
 
@@ -80,6 +83,12 @@ class BVH_Node(object):
         self.rest_head_world.x, self.rest_head_world.y, self.rest_head_world.z)
 
 
+def sorted_nodes(bvh_nodes):
+    bvh_nodes_list = list(bvh_nodes.values())
+    bvh_nodes_list.sort(key=lambda bvh_node: bvh_node.index)
+    return bvh_nodes_list
+
+
 def read_bvh(context, file_path, rotate_mode='XYZ', global_scale=1.0):
     # File loading stuff
     # Open the file for importing
@@ -116,9 +125,9 @@ def read_bvh(context, file_path, rotate_mode='XYZ', global_scale=1.0):
                 file_lines[lineIdx][1] = '_'.join(file_lines[lineIdx][1:])
                 file_lines[lineIdx] = file_lines[lineIdx][:2]
 
-            # MAY NEED TO SUPPORT MULTIPLE ROOT's HERE!!!, Still unsure weather multiple roots are possible.??
+            # MAY NEED TO SUPPORT MULTIPLE ROOTS HERE! Still unsure weather multiple roots are possible?
 
-            # Make sure the names are unique- Object names will match joint names exactly and both will be unique.
+            # Make sure the names are unique - Object names will match joint names exactly and both will be unique.
             name = file_lines[lineIdx][1]
 
             #print '%snode: %s, parent: %s' % (len(bvh_nodes_serial) * '  ', name,  bvh_nodes_serial[-1])
@@ -128,9 +137,9 @@ def read_bvh(context, file_path, rotate_mode='XYZ', global_scale=1.0):
             lineIdx += 1  # Increment to the next line (Channels)
 
             # newChannel[Xposition, Yposition, Zposition, Xrotation, Yrotation, Zrotation]
-            # newChannel references indecies to the motiondata,
+            # newChannel references indices to the motiondata,
             # if not assigned then -1 refers to the last value that will be added on loading at a value of zero, this is appended
-            # We'll add a zero value onto the end of the MotionDATA so this is always refers to a value.
+            # We'll add a zero value onto the end of the MotionDATA so this always refers to a value.
             my_channel = [-1, -1, -1, -1, -1, -1]
             my_rot_order = [None, None, None]
             rot_count = 0
@@ -167,7 +176,7 @@ def read_bvh(context, file_path, rotate_mode='XYZ', global_scale=1.0):
             else:
                 rest_head_world = my_parent.rest_head_world + rest_head_local
 
-            bvh_node = bvh_nodes[name] = BVH_Node(name, rest_head_world, rest_head_local, my_parent, my_channel, my_rot_order)
+            bvh_node = bvh_nodes[name] = BVH_Node(name, rest_head_world, rest_head_local, my_parent, my_channel, my_rot_order, len(bvh_nodes) - 1)
 
             # If we have another child then we can call ourselves a parent, else
             bvh_nodes_serial.append(bvh_node)
@@ -180,7 +189,7 @@ def read_bvh(context, file_path, rotate_mode='XYZ', global_scale=1.0):
             bvh_nodes_serial[-1].rest_tail_world = bvh_nodes_serial[-1].rest_head_world + rest_tail
             bvh_nodes_serial[-1].rest_tail_local = bvh_nodes_serial[-1].rest_head_local + rest_tail
 
-            # Just so we can remove the Parents in a uniform way- End has kids
+            # Just so we can remove the Parents in a uniform way - End has kids
             # so this is a placeholder
             bvh_nodes_serial.append(None)
 
@@ -199,7 +208,9 @@ def read_bvh(context, file_path, rotate_mode='XYZ', global_scale=1.0):
     # Dont use anymore
     del bvh_nodes_serial
 
-    bvh_nodes_list = bvh_nodes.values()
+    # importing world with any order but nicer to maintain order
+    # second life expects it, which isn't to spec.
+    bvh_nodes_list = sorted_nodes(bvh_nodes)
 
     while lineIdx < len(file_lines):
         line = file_lines[lineIdx]
@@ -228,13 +239,13 @@ def read_bvh(context, file_path, rotate_mode='XYZ', global_scale=1.0):
         lineIdx += 1
 
     # Assign children
-    for bvh_node in bvh_nodes.values():
+    for bvh_node in bvh_nodes_list:
         bvh_node_parent = bvh_node.parent
         if bvh_node_parent:
             bvh_node_parent.children.append(bvh_node)
 
     # Now set the tip of each bvh_node
-    for bvh_node in bvh_nodes.values():
+    for bvh_node in bvh_nodes_list:
 
         if not bvh_node.rest_tail_world:
             if len(bvh_node.children) == 0:
@@ -259,7 +270,7 @@ def read_bvh(context, file_path, rotate_mode='XYZ', global_scale=1.0):
                 bvh_node.rest_tail_world = rest_tail_world * (1.0 / len(bvh_node.children))
                 bvh_node.rest_tail_local = rest_tail_local * (1.0 / len(bvh_node.children))
 
-        # Make sure tail isnt the same location as the head.
+        # Make sure tail isn't the same location as the head.
         if (bvh_node.rest_tail_local - bvh_node.rest_head_local).length <= 0.001 * global_scale:
             print("\tzero length node found:", bvh_node.name)
             bvh_node.rest_tail_local.y = bvh_node.rest_tail_local.y + global_scale / 10
@@ -359,16 +370,18 @@ def bvh_node_dict2armature(context,
     bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
     bpy.ops.object.mode_set(mode='EDIT', toggle=False)
 
+    bvh_nodes_list = sorted_nodes(bvh_nodes)
+
     # Get the average bone length for zero length bones, we may not use this.
     average_bone_length = 0.0
     nonzero_count = 0
-    for bvh_node in bvh_nodes.values():
+    for bvh_node in bvh_nodes_list:
         l = (bvh_node.rest_head_local - bvh_node.rest_tail_local).length
         if l:
             average_bone_length += l
             nonzero_count += 1
 
-    # Very rare cases all bones couldbe zero length???
+    # Very rare cases all bones could be zero length???
     if not average_bone_length:
         average_bone_length = 0.1
     else:
@@ -380,9 +393,10 @@ def bvh_node_dict2armature(context,
         arm_ob.edit_bones.remove(arm_data.edit_bones[-1])
 
     ZERO_AREA_BONES = []
-    for name, bvh_node in bvh_nodes.items():
+    for bvh_node in bvh_nodes_list:
+
         # New editbone
-        bone = bvh_node.temp = arm_data.edit_bones.new(name)
+        bone = bvh_node.temp = arm_data.edit_bones.new(bvh_node.name)
 
         bone.head = bvh_node.rest_head_world
         bone.tail = bvh_node.rest_tail_world
@@ -401,7 +415,7 @@ def bvh_node_dict2armature(context,
 
             ZERO_AREA_BONES.append(bone.name)
 
-    for bvh_node in bvh_nodes.values():
+    for bvh_node in bvh_nodes_list:
         if bvh_node.parent:
             # bvh_node.temp is the Editbone
 
@@ -417,7 +431,7 @@ def bvh_node_dict2armature(context,
 
     # Replace the editbone with the editbone name,
     # to avoid memory errors accessing the editbone outside editmode
-    for bvh_node in bvh_nodes.values():
+    for bvh_node in bvh_nodes_list:
         bvh_node.temp = bvh_node.temp.name
 
     # Now Apply the animation to the armature
@@ -429,7 +443,7 @@ def bvh_node_dict2armature(context,
     pose_bones = pose.bones
 
     if rotate_mode == 'NATIVE':
-        for bvh_node in bvh_nodes.values():
+        for bvh_node in bvh_nodes_list:
             bone_name = bvh_node.temp  # may not be the same name as the bvh_node, could have been shortened.
             pose_bone = pose_bones[bone_name]
             pose_bone.rotation_mode = bvh_node.rot_order_str
@@ -449,7 +463,7 @@ def bvh_node_dict2armature(context,
 
     # Replace the bvh_node.temp (currently an editbone)
     # With a tuple  (pose_bone, armature_bone, bone_rest_matrix, bone_rest_matrix_inv)
-    for bvh_node in bvh_nodes.values():
+    for bvh_node in bvh_nodes_list:
         bone_name = bvh_node.temp  # may not be the same name as the bvh_node, could have been shortened.
         pose_bone = pose_bones[bone_name]
         rest_bone = arm_data.bones[bone_name]
@@ -479,7 +493,7 @@ def bvh_node_dict2armature(context,
         scene.frame_set(frame_start + frame_current)
 
         # Dont neet to set the current frame
-        for i, bvh_node in enumerate(bvh_nodes.values()):
+        for i, bvh_node in enumerate(bvh_nodes_list):
             pose_bone, bone, bone_rest_matrix, bone_rest_matrix_inv = bvh_node.temp
             lx, ly, lz, rx, ry, rz = bvh_node.anim_data[frame_current + 1]
 
diff --git a/release/scripts/addons/io_convert_image_to_mesh_img/__init__.py b/release/scripts/addons/io_convert_image_to_mesh_img/__init__.py
index 00ba50a..713d32e 100644
--- a/release/scripts/addons/io_convert_image_to_mesh_img/__init__.py
+++ b/release/scripts/addons/io_convert_image_to_mesh_img/__init__.py
@@ -19,8 +19,8 @@
 bl_info = {
     "name": "HiRISE DTM from PDS IMG",
     "author": "Tim Spriggs (tims at uahirise.org)",
-    "version": (0, 1, 2),
-    "blender": (2, 5, 7),
+    "version": (0, 1, 3),
+    "blender": (2, 6, 2),
     "location": "File > Import > HiRISE DTM from PDS IMG (.IMG)",
     "description": "Import a HiRISE DTM formatted as a PDS IMG file",
     "warning": "May consume a lot of memory",
@@ -38,6 +38,9 @@ bl_info = {
 #         trunk/py/scripts/addons/io_convert_image_to_mesh_img
 #         may be moved out to contrib once the blender downloader works well
 #         (TJS - 2010-12-14)
+# 0.1.3 - upstream blender updates
+#         performance enhancements by Chris Van Horne
+#         (TJS - 2012-03-14)
 
 
 if "bpy" in locals():
@@ -82,11 +85,6 @@ class ImportHiRISEIMGDTM(bpy.types.Operator, ImportHelper):
                             default='BIN12-FAST'
                             )
 
-    #red_material = BoolProperty(name="Mars Red Mesh",
-    #                            description="Set the mesh as a 'Mars' red value",
-    #                            default=True
-    #			        )
-
     ## TODO: add support for cropping on import when the checkbox is checked
     # do_crop = BoolProperty(name="Crop Image", description="Crop the image during import", ... )
     ## we only want these visible when the above is "true"
@@ -109,8 +107,6 @@ class ImportHiRISEIMGDTM(bpy.types.Operator, ImportHelper):
                              scale=self.scale,
                              bin_mode=self.bin_mode,
                              cropVars=False,
-                             # marsRed=self.red_material
-                             marsRed=False
                              )
 
 ## How to register the script inside of Blender
diff --git a/release/scripts/addons/io_convert_image_to_mesh_img/import_img.py b/release/scripts/addons/io_convert_image_to_mesh_img/import_img.py
index 34d0123..4eb88a7 100644
--- a/release/scripts/addons/io_convert_image_to_mesh_img/import_img.py
+++ b/release/scripts/addons/io_convert_image_to_mesh_img/import_img.py
@@ -27,8 +27,8 @@ from struct import pack, unpack
 import os
 import queue, threading
 
-class image_props:
-    ''' keeps track of image attributes throughout the hirise_dtm_helper class '''
+class image_properties:
+    ''' keeps track of image attributes throughout the hirise_dtm_importer class '''
     def __init__(self, name, dimensions, pixel_scale):
       self.name( name )
       self.dims( dimensions )
@@ -55,7 +55,7 @@ class image_props:
         self.__pixel_scale = pixel_scale
       return self.__pixel_scale
 
-class hirise_dtm_helper(object):
+class hirise_dtm_importer(object):
     ''' methods to understand/import a HiRISE DTM formatted as a PDS .IMG '''
 
     def __init__(self, context, filepath):
@@ -65,7 +65,6 @@ class hirise_dtm_helper(object):
       self.__bin_mode = 'BIN6'
       self.scale( 1.0 )
       self.__cropXY = False
-      self.marsRed(False)
 
     def bin_mode(self, bin_mode=None):
       if bin_mode != None:
@@ -81,14 +80,6 @@ class hirise_dtm_helper(object):
       self.__cropXY = [ widthX, widthY, offX, offY ]
       return self.__cropXY
 
-    def marsRed(self, marsRed=None):
-      if marsRed is not None:
-        self.__marsRed = marsRed
-      return self.__marsRed
-
-    def dbg(self, mesg):
-      print(mesg)
-
     ############################################################################
     ## PDS Label Operations
     ############################################################################
@@ -153,8 +144,6 @@ class hirise_dtm_helper(object):
       ''' uses the parsed PDS Label to get the LINES and LINE_SAMPLES parameters
           from the first object named "IMAGE" -- is hackish
       '''
-      lines = None
-      line_samples = None
       for obj in label:
         if obj[0] == "IMAGE":
           return self.getLinesAndSamples(obj[1])
@@ -202,27 +191,6 @@ class hirise_dtm_helper(object):
     ## Image operations
     ############################################################################
 
-    # decorator to run a generator in a thread
-    def threaded_generator(func):
-      def start(*args,**kwargs):
-        # Setup a queue of returned items
-        yield_q = queue.Queue()
-        # Thread to run generator inside of
-        def worker():
-          for obj in func(*args,**kwargs): yield_q.put(obj)
-          yield_q.put(StopIteration)
-        t = threading.Thread(target=worker)
-        t.start()
-        # yield from the queue as fast as we can
-        obj = yield_q.get()
-        while obj is not StopIteration:
-          yield obj
-          obj = yield_q.get()
-
-      # return the thread-wrapped generator
-      return start
-
-    @threaded_generator
     def bin2(self, image_iter, bin2_method_type="SLOW"):
       ''' this is an iterator that: Given an image iterator will yield binned lines '''
 
@@ -252,10 +220,8 @@ class hirise_dtm_helper(object):
             del tmp_list[0:2]
           yield ret_list
           ret_list = []
-        # last_line = line  # UNUSED
         line_count += 1
 
-    @threaded_generator
     def bin6(self, image_iter, bin6_method_type="SLOW"):
       ''' this is an iterator that: Given an image iterator will yield binned lines '''
 
@@ -292,22 +258,23 @@ class hirise_dtm_helper(object):
       binned_data = []
 
       # Filter out those unwanted hugely negative values...
-      filter_fun = lambda a: self.__ignore_value.__ne__(a)
+      IGNORE_VALUE = self.__ignore_value
 
       base = 0
       for i in range(0, len(raw_data[0])//6):
 
-        ints = list(filter( filter_fun, raw_data[0][base:base+6] +
+        ints = (raw_data[0][base:base+6] +
           raw_data[1][base:base+6] +
           raw_data[2][base:base+6] +
           raw_data[3][base:base+6] +
           raw_data[4][base:base+6] +
-          raw_data[5][base:base+6] ))
-        len_ints = len( ints )
+          raw_data[5][base:base+6] )
+
+        ints = [num for num in ints if num != IGNORE_VALUE]
 
         # If we have all pesky values, return a pesky value
-        if len_ints == 0:
-          binned_data.append( self.__ignore_value )
+        if not ints:
+          binned_data.append( IGNORE_VALUE )
         else:
           binned_data.append( sum(ints) / len(ints) )
 
@@ -327,7 +294,6 @@ class hirise_dtm_helper(object):
 
       return binned_data
 
-    @threaded_generator
     def bin12(self, image_iter, bin12_method_type="SLOW"):
       ''' this is an iterator that: Given an image iterator will yield binned lines '''
 
@@ -395,7 +361,6 @@ class hirise_dtm_helper(object):
       ''' takes a single value from each 12x12 sample of raw_data and returns a single line of data '''
       return raw_data[0][11::12]
 
-    @threaded_generator
     def cropXY(self, image_iter, XSize=None, YSize=None, XOffset=0, YOffset=0):
       ''' return a cropped portion of the image '''
 
@@ -409,11 +374,9 @@ class hirise_dtm_helper(object):
         YSize = processed_dims[1]
 
       if XSize + XOffset > processed_dims[0]:
-        self.dbg("WARNING: Upstream dims are larger than cropped XSize dim")
         XSize = processed_dims[0]
         XOffset = 0
       if YSize + YOffset > processed_dims[1]:
-        self.dbg("WARNING: Upstream dims are larger than cropped YSize dim")
         YSize = processed_dims[1]
         YOffset = 0
 
@@ -429,11 +392,9 @@ class hirise_dtm_helper(object):
           return
         currentY += 1
 
-    @threaded_generator
     def getImage(self, img, img_props):
       ''' Assumes 32-bit pixels -- bins image '''
       dims = img_props.dims()
-      self.dbg("getting image (x,y): %d,%d" % ( dims[0], dims[1] ))
 
       # setup to unpack more efficiently.
       x_len = dims[0]
@@ -462,7 +423,6 @@ class hirise_dtm_helper(object):
           if len(new_pixels) == 0:
             x_bytes = -1
             pixels = []
-            self.dbg("Uh oh: unexpected EOF!")
         if len(pixels) == x_bytes:
           if 0 == 1:
             repacked_pixels = b''
@@ -472,7 +432,6 @@ class hirise_dtm_helper(object):
           else:
             yield unpack( unpack_str, pixels )
 
-    @threaded_generator
     def shiftToOrigin(self, image_iter, image_min_max):
       ''' takes a generator and shifts the points by the valid minimum
           also removes points with value self.__ignore_value and replaces them with None
@@ -484,7 +443,6 @@ class hirise_dtm_helper(object):
       # pass on dimensions/pixel_scale since we don't modify them here
       yield next(image_iter)
 
-      self.dbg("shiftToOrigin filter enabled...");
 
       # closures rock!
       def normalize_fun(point):
@@ -494,9 +452,7 @@ class hirise_dtm_helper(object):
 
       for line in image_iter:
         yield list(map(normalize_fun, line))
-      self.dbg("shifted all points")
 
-    @threaded_generator
     def scaleZ(self, image_iter, scale_factor):
       ''' scales the mesh values by a factor '''
       # pass on dimensions since we don't modify them here
@@ -563,16 +519,12 @@ class hirise_dtm_helper(object):
       # the space between vertices so that blender is more efficient at managing the final
       # structure.
 
-      self.dbg('generate mesh coords/faces from processed image data...')
-
       # read each new line and generate coordinates+faces
       for dtm_line in image_iter:
 
         # Keep track of where we are in the image
         line_count += 1
         y_val = line_count*-scale_y
-        if line_count % 31 == 0:
-          self.dbg("reading image... %d of %d" % ( line_count, max_y ))
 
         # Just add all points blindly
         # TODO: turn this into a map
@@ -626,22 +578,14 @@ class hirise_dtm_helper(object):
         # remember what we just saw (and forget anything before that)
         last_line = dtm_line
 
-      self.dbg('generate mesh from coords/faces...')
       me = bpy.data.meshes.new(img_props.name()) # create a new mesh
 
-      self.dbg('coord: %d' % coord)
-      self.dbg('len(coords): %d' % len(coords))
-      self.dbg('len(faces): %d' % len(faces))
-
-      self.dbg('setting coords...')
       me.vertices.add(len(coords)/3)
       me.vertices.foreach_set("co", coords)
 
-      self.dbg('setting faces...')
       me.faces.add(len(faces)/4)
       me.faces.foreach_set("vertices_raw", faces)
 
-      self.dbg('running update...')
       me.update()
 
       bin_desc = self.bin_mode()
@@ -652,40 +596,19 @@ class hirise_dtm_helper(object):
 
       return ob
 
-    def marsRedMaterial(self):
-      ''' produce some approximation of a mars surface '''
-      mat = None
-      for material in bpy.data.materials:
-        if material.getName() == "redMars":
-          mat = material
-      if mat is None:
-        mat = bpy.data.materials.new("redMars")
-        mat.diffuse_shader = 'MINNAERT'
-        mat.setRGBCol(  (0.426, 0.213, 0.136) )
-        mat.setDiffuseDarkness(0.8)
-        mat.specular_shader = 'WARDISO'
-        mat.setSpecCol( (1.000, 0.242, 0.010) )
-        mat.setSpec( 0.010 )
-        mat.setRms( 0.100 )
-      return mat
-
     ################################################################################
-    #  Yay, done with helper functions ... let's see the abstraction in action!    #
+    #  Yay, done with importer functions ... let's see the abstraction in action!    #
     ################################################################################
     def execute(self):
 
-      self.dbg('opening/importing file: %s' % self.__filepath)
       img = open(self.__filepath, 'rb')
 
-      self.dbg('read PDS Label...')
       (label, parsedLabel) = self.getPDSLabel(img)
 
-      self.dbg('parse PDS Label...')
       image_dims = self.getLinesAndSamples(parsedLabel)
       img_min_max_vals = self.getValidMinMax(parsedLabel)
       self.__ignore_value = self.getMissingConstant(parsedLabel)
 
-      self.dbg('import/bin image data...')
 
       # MAGIC VALUE? -- need to formalize this to rid ourselves of bad points
       img.seek(28)
@@ -699,7 +622,7 @@ class hirise_dtm_helper(object):
       image_name = os.path.basename( self.__filepath )
 
       # Set the properties of the image in a manageable object
-      img_props = image_props( image_name, image_dims, pixel_scale )
+      img_props = image_properties( image_name, image_dims, pixel_scale )
 
       # Get an iterator to iterate over lines
       image_iter = self.getImage(img, img_props)
@@ -737,19 +660,13 @@ class hirise_dtm_helper(object):
         image_iter = self.scaleZ(image_iter, img_min_max_vals)
 
       # Create a new mesh object and set data from the image iterator
-      self.dbg('generating mesh object...')
       ob_new = self.genMesh(image_iter)
 
-      if self.marsRed():
-        mars_red = self.marsRedMaterial()
-        ob_new.materials += [mars_red]
-
       if img:
         img.close()
 
       # Add mesh object to the current scene
       scene = self.__context.scene
-      self.dbg('linking object to scene...')
       scene.objects.link(ob_new)
       scene.update()
 
@@ -760,21 +677,17 @@ class hirise_dtm_helper(object):
       # Select the new mesh
       ob_new.select = True
 
-      self.dbg('done with ops ... now wait for blender ...')
-
       return ('FINISHED',)
 
-def load(operator, context, filepath, scale, bin_mode, cropVars, marsRed):
+def load(operator, context, filepath, scale, bin_mode, cropVars):
     print("Bin Mode: %s" % bin_mode)
     print("Scale: %f" % scale)
-    helper = hirise_dtm_helper(context,filepath)
-    helper.bin_mode( bin_mode )
-    helper.scale( scale )
+    importer = hirise_dtm_importer(context,filepath)
+    importer.bin_mode( bin_mode )
+    importer.scale( scale )
     if cropVars:
-        helper.crop( cropVars[0], cropVars[1], cropVars[2], cropVars[3] )
-    helper.execute()
-    if marsRed:
-        helper.marsRed(marsRed)
+        importer.crop( cropVars[0], cropVars[1], cropVars[2], cropVars[3] )
+    importer.execute()
 
     print("Loading %s" % filepath)
     return {'FINISHED'}
diff --git a/release/scripts/addons/io_curve_svg/import_svg.py b/release/scripts/addons/io_curve_svg/import_svg.py
index 8d49f61..1c04eb5 100644
--- a/release/scripts/addons/io_curve_svg/import_svg.py
+++ b/release/scripts/addons/io_curve_svg/import_svg.py
@@ -428,6 +428,9 @@ def SVGParseStyles(node, context):
                 styles['useFill'] = True
                 styles['fill'] = SVGGetMaterial(fill, context)
 
+    if styles['useFill'] is None and context['style']:
+        styles = context['style'].copy()
+
     if styles['useFill'] is None:
         styles['useFill'] = True
         styles['fill'] = SVGGetMaterial('#000', context)
@@ -887,7 +890,6 @@ class SVGPathParser:
         Elliptical arc CurveTo path command
         """
 
-        # c = code.lower()  # UNUSED
         cur = self._data.cur()
 
         while cur is not None and not cur.isalpha():
@@ -981,7 +983,7 @@ class SVGGeometry:
         Pop display rectangle
         """
 
-        self._context['rects'].pop
+        self._context['rects'].pop()
         self._context['rect'] = self._context['rects'][-1]
 
     def _pushMatrix(self, matrix):
@@ -1000,6 +1002,22 @@ class SVGGeometry:
         matrix = self._context['transform'].pop()
         self._context['matrix'] = self._context['matrix'] * matrix.inverted()
 
+    def _pushStyle(self, style):
+        """
+        Push style
+        """
+
+        self._context['styles'].append(style)
+        self._context['style'] = style
+
+    def _popStyle(self):
+        """
+        Pop style
+        """
+
+        self._context['styles'].pop()
+        self._context['style'] = self._context['styles'][-1]
+
     def _transformCoord(self, point):
         """
         Transform SVG-file coords
@@ -1069,7 +1087,8 @@ class SVGGeometryContainer(SVGGeometry):
     Container of SVG geometries
     """
 
-    __slots__ = ('_geometries')  # List of chold geometries
+    __slots__ = ('_geometries',  # List of chold geometries
+                 '_styles')  # Styles, used for displaying
 
     def __init__(self, node, context):
         """
@@ -1079,12 +1098,18 @@ class SVGGeometryContainer(SVGGeometry):
         super().__init__(node, context)
 
         self._geometries = []
+        self._styles = SVGEmptyStyles
 
     def parse(self):
         """
         Parse XML node to memory
         """
 
+        if type(self._node) is xml.dom.minidom.Element:
+            self._styles = SVGParseStyles(self._node, self._context)
+
+        self._pushStyle(self._styles)
+
         for node in self._node.childNodes:
             if type(node) is not xml.dom.minidom.Element:
                 continue
@@ -1093,6 +1118,8 @@ class SVGGeometryContainer(SVGGeometry):
             if ob is not None:
                 self._geometries.append(ob)
 
+        self._popStyle()
+
     def _doCreateGeom(self, instancing):
         """
         Create real geometries
@@ -1244,7 +1271,6 @@ class SVGGeometryUSE(SVGGeometry):
         Create real geometries
         """
 
-        # geometries = []  # UNUSED
         ref = self._node.getAttribute('xlink:href')
         geom = self._context['defines'].get(ref)
 
@@ -1765,7 +1791,9 @@ class SVGLoader(SVGGeometryContainer):
                          'rects': [rect],
                          'rect': rect,
                          'matrix': m,
-                         'materials': {}}
+                         'materials': {},
+                         'styles': [None],
+                         'style': None}
 
         super().__init__(node, self._context)
 
diff --git a/release/scripts/addons/io_export_after_effects.py b/release/scripts/addons/io_export_after_effects.py
index 370f9e4..e72deb5 100644
--- a/release/scripts/addons/io_export_after_effects.py
+++ b/release/scripts/addons/io_export_after_effects.py
@@ -22,8 +22,8 @@ bl_info = {
     'name': 'Export: Adobe After Effects (.jsx)',
     'description': 'Export cameras, selected objects & camera solution 3D Markers to Adobe After Effects CS3 and above',
     'author': 'Bartek Skorupa',
-    'version': (0, 6, 0),
-    'blender': (2, 6, 1),
+    'version': (0, 6, 3),
+    'blender': (2, 6, 2),
     'location': 'File > Export > Adobe After Effects (.jsx)',
     "warning": "",
     "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
@@ -36,7 +36,7 @@ bl_info = {
 
 import bpy
 import datetime
-from math import pi
+from math import degrees
 from mathutils import Matrix
 
 
@@ -112,8 +112,7 @@ def get_selected(context):
             solids.append([ob, convert_name(ob.name)])
 
         elif ob.type == 'LAMP':
-            # not ready yet. Lamps will be exported as nulls. This is temporary
-            nulls.append([ob, convert_name(ob.name)])
+            lights.append([ob, ob.data.type + convert_name(ob.name)])  # Type of lamp added to name
 
         else:
             nulls.append([ob, convert_name(ob.name)])
@@ -137,10 +136,13 @@ def is_plane(object):
 # convert names of objects to avoid errors in AE.
 def convert_name(name):
     name = "_" + name
-
+    '''
+    # Digits are not allowed at beginning of AE vars names.
+    # This section is commented, as "_" is added at beginning of names anyway.
+    # Placeholder for this name modification is left so that it's not ignored if needed
     if name[0].isdigit():
         name = "_" + name
-
+    '''
     name = bpy.path.clean_name(name)
     name = name.replace("-", "_")
 
@@ -151,31 +153,26 @@ def convert_name(name):
 # this function will be called for every object for every frame
 def convert_transform_matrix(matrix, width, height, aspect, x_rot_correction=False):
 
-    # get blender location for ob
-    b_loc_x, b_loc_y, b_loc_z = matrix.to_translation()
-    b_rot_x, b_rot_y, b_rot_z = matrix.to_euler()
-    b_scale_x, b_scale_y, b_scale_z = matrix.to_scale()
-
-    # get blender rotation for ob
-    if x_rot_correction:
-        b_rot_x = b_rot_x / pi * 180.0 - 90.0
-    else:
-        b_rot_x = b_rot_x / pi * 180.0
-    b_rot_y = b_rot_y / pi * 180.0
-    b_rot_z = b_rot_z / pi * 180.0
+    # get blender transform data for ob
+    b_loc = matrix.to_translation()
+    b_rot = matrix.to_euler('ZYX')  # ZYX euler matches AE's orientation and allows to use x_rot_correction
+    b_scale = matrix.to_scale()
 
     # convert to AE Position Rotation and Scale
     # Axes in AE are different. AE's X is blender's X, AE's Y is negative Blender's Z, AE's Z is Blender's Y
-    x = (b_loc_x * 100.0) / aspect + width / 2.0  # calculate AE's X position
-    y = (-b_loc_z * 100.0) + (height / 2.0)  # calculate AE's Y position
-    z = b_loc_y * 100.0  # calculate AE's Z position
-    # Using AE's rotation combined with AE's orientation allows to compensate for different euler rotation order.
-    rx = b_rot_x  # calculate AE's X rotation. Will become AE's RotationX property
-    ry = -b_rot_z  # calculate AE's Y rotation. Will become AE's OrientationY property
-    rz = b_rot_y  # calculate AE's Z rotation. Will become AE's OrentationZ property
-    sx = b_scale_x * 100.0  # scale of 1.0 is 100% in AE
-    sy = b_scale_z * 100.0  # scale of 1.0 is 100% in AE
-    sz = b_scale_y * 100.0  # scale of 1.0 is 100% in AE
+    x = (b_loc.x * 100.0) / aspect + width / 2.0  # calculate AE's X position
+    y = (-b_loc.z * 100.0) + (height / 2.0)  # calculate AE's Y position
+    z = b_loc.y * 100.0  # calculate AE's Z position
+    # Convert rotations to match AE's orientation.
+    rx = degrees(b_rot.x)  # if not x_rot_correction - AE's X orientation = blender's X rotation if 'ZYX' euler.
+    ry = -degrees(b_rot.y)  # AE's Y orientation is negative blender's Y rotation if 'ZYX' euler
+    rz = -degrees(b_rot.z)  # AE's Z orientation is negative blender's Z rotation if 'ZYX' euler
+    if x_rot_correction:
+        rx -= 90.0  # In blender - ob of zero rotation lay on floor. In AE layer of zero orientation "stands"
+    # Convert scale to AE scale
+    sx = b_scale.x * 100.0  # scale of 1.0 is 100% in AE
+    sy = b_scale.z * 100.0  # scale of 1.0 is 100% in AE
+    sz = b_scale.y * 100.0  # scale of 1.0 is 100% in AE
 
     return x, y, z, rx, ry, rz, sx, sy, sz
 
@@ -244,16 +241,16 @@ def convert_lens(camera, width, height, aspect):
 
 
 # jsx script for AE creation
-def write_jsx_file(file, data, selection, include_active_cam, include_selected_cams, include_selected_objects, include_cam_bundles, include_rotation, include_scale):
+def write_jsx_file(file, data, selection, include_animation, include_active_cam, include_selected_cams, include_selected_objects, include_cam_bundles):
 
     print("\n---------------------------\n- Export to After Effects -\n---------------------------")
-    #store the current frame to restore it at the enf of export
+    # store the current frame to restore it at the end of export
     curframe = data['curframe']
-    #create array which will contain all keyframes values
+    # create array which will contain all keyframes values
     js_data = {
         'times': '',
         'cameras': {},
-        'solids': {},
+        'solids': {},  # not ready yet
         'lights': {},
         'nulls': {},
         'bundles_cam': {},
@@ -271,10 +268,14 @@ def write_jsx_file(file, data, selection, include_active_cam, include_selected_c
         active_cam_name = name_ae  # store name to be used when creating keyframes for active cam.
         js_data['cameras'][name_ae] = {
             'position': '',
-            'pointOfInterest': '',
+            'position_static': '',
+            'position_anim': False,
             'orientation': '',
-            'rotationX': '',
+            'orientation_static': '',
+            'orientation_anim': False,
             'zoom': '',
+            'zoom_static': '',
+            'zoom_anim': False,
             }
 
     # create camera structure for selected cameras
@@ -284,10 +285,14 @@ def write_jsx_file(file, data, selection, include_active_cam, include_selected_c
                 name_ae = selection['cameras'][i][1]
                 js_data['cameras'][name_ae] = {
                     'position': '',
-                    'pointOfInterest': '',
+                    'position_static': '',
+                    'position_anim': False,
                     'orientation': '',
-                    'rotationX': '',
+                    'orientation_static': '',
+                    'orientation_anim': False,
                     'zoom': '',
+                    'zoom_static': '',
+                    'zoom_anim': False,
                     }
     '''
     # create structure for solids. Not ready yet. Temporarily not active
@@ -299,17 +304,32 @@ def write_jsx_file(file, data, selection, include_active_cam, include_selected_c
             'rotationX': '',
             'scale': '',
             }
-
-   # create structure for lights. Not ready yet. Temporarily not active
-    for i, obj in enumerate(selection['lights']):
-        name_ae = selection['lights'][i][1]
-        js_data['nulls'][name_ae] = {
-            'position': '',
-            'orientation': '',
-            'rotationX': '',
-            'scale': '',
-            }
     '''
+    # create structure for lights
+    for i, obj in enumerate(selection['lights']):
+        if include_selected_objects:
+            name_ae = selection['lights'][i][1]
+            js_data['lights'][name_ae] = {
+                'type': selection['lights'][i][0].data.type,
+                'energy': '',
+                'energy_static': '',
+                'energy_anim': False,
+                'cone_angle': '',
+                'cone_angle_static': '',
+                'cone_angle_anim': False,
+                'cone_feather': '',
+                'cone_feather_static': '',
+                'cone_feather_anim': False,
+                'color': '',
+                'color_static': '',
+                'color_anim': False,
+                'position': '',
+                'position_static': '',
+                'position_anim': False,
+                'orientation': '',
+                'orientation_static': '',
+                'orientation_anim': False,
+                }
 
     # create structure for nulls
     for i, obj in enumerate(selection['nulls']):  # nulls representing blender's obs except cameras, lamps and solids
@@ -317,14 +337,19 @@ def write_jsx_file(file, data, selection, include_active_cam, include_selected_c
             name_ae = selection['nulls'][i][1]
             js_data['nulls'][name_ae] = {
                 'position': '',
+                'position_static': '',
+                'position_anim': False,
                 'orientation': '',
-                'rotationX': '',
+                'orientation_static': '',
+                'orientation_anim': False,
                 'scale': '',
+                'scale_static': '',
+                'scale_anim': False,
                 }
 
     # create structure for cam bundles including positions (cam bundles don't move)
     if include_cam_bundles:
-        # go through each selected Camera and active cameras
+        # go through each selected camera and active cameras
         selected_cams = []
         active_cams = []
         if include_active_cam:
@@ -340,7 +365,7 @@ def write_jsx_file(file, data, selection, include_active_cam, include_selected_c
             for constraint in cam.constraints:
                 # does the camera have a Camera Solver constraint
                 if constraint.type == 'CAMERA_SOLVER':
-                    # Which movie clip does it use ?
+                    # Which movie clip does it use
                     if constraint.use_active_clip:
                         clip = data['scn'].active_clip
                     else:
@@ -362,7 +387,11 @@ def write_jsx_file(file, data, selection, include_active_cam, include_selected_c
                             js_data['bundles_cam'][name_ae]['position'] += '[%f,%f,%f],' % (ae_transform[0], ae_transform[1], ae_transform[2])
 
     # get all keyframes for each object and store in dico
-    for frame in range(data['start'], data['end'] + 1):
+    if include_animation:
+        end = data['end'] + 1
+    else:
+        end = data['start'] + 1
+    for frame in range(data['start'], end):
         print("working on frame: " + str(frame))
         data['scn'].frame_set(frame)
 
@@ -383,11 +412,24 @@ def write_jsx_file(file, data, selection, include_active_cam, include_selected_c
             # convert Blender's lens to AE's zoom in pixels
             zoom = convert_lens(active_cam, data['width'], data['height'], data['aspect'])
             # store all values in dico
-            js_data['cameras'][name_ae]['position'] += '[%f,%f,%f],' % (ae_transform[0], ae_transform[1], ae_transform[2])
-            js_data['cameras'][name_ae]['pointOfInterest'] += '[%f,%f,%f],' % (ae_transform[0], ae_transform[1], ae_transform[2])
-            js_data['cameras'][name_ae]['orientation'] += '[%f,%f,%f],' % (0, ae_transform[4], ae_transform[5])
-            js_data['cameras'][name_ae]['rotationX'] += '%f ,' % (ae_transform[3])
-            js_data['cameras'][name_ae]['zoom'] += '[%f],' % (zoom)
+            position = '[%f,%f,%f],' % (ae_transform[0], ae_transform[1], ae_transform[2])
+            orientation = '[%f,%f,%f],' % (ae_transform[3], ae_transform[4], ae_transform[5])
+            zoom = '%f,' % (zoom)
+            js_data['cameras'][name_ae]['position'] += position
+            js_data['cameras'][name_ae]['orientation'] += orientation
+            js_data['cameras'][name_ae]['zoom'] += zoom
+            # Check if properties change values compared to previous frame
+            # If property don't change through out the whole animation - keyframes won't be added
+            if frame != data['start']:
+                if position != js_data['cameras'][name_ae]['position_static']:
+                    js_data['cameras'][name_ae]['position_anim'] = True
+                if orientation != js_data['cameras'][name_ae]['orientation_static']:
+                    js_data['cameras'][name_ae]['orientation_anim'] = True
+                if zoom != js_data['cameras'][name_ae]['zoom_static']:
+                    js_data['cameras'][name_ae]['zoom_anim'] = True
+            js_data['cameras'][name_ae]['position_static'] = position
+            js_data['cameras'][name_ae]['orientation_static'] = orientation
+            js_data['cameras'][name_ae]['zoom_static'] = zoom
 
         # keyframes for selected cameras
         if include_selected_cams:
@@ -400,11 +442,24 @@ def write_jsx_file(file, data, selection, include_active_cam, include_selected_c
                     # convert Blender's lens to AE's zoom in pixels
                     zoom = convert_lens(cam[0], data['width'], data['height'], data['aspect'])
                     # store all values in dico
-                    js_data['cameras'][name_ae]['position'] += '[%f,%f,%f],' % (ae_transform[0], ae_transform[1], ae_transform[2])
-                    js_data['cameras'][name_ae]['pointOfInterest'] += '[%f,%f,%f],' % (ae_transform[0], ae_transform[1], ae_transform[2])
-                    js_data['cameras'][name_ae]['orientation'] += '[%f,%f,%f],' % (0, ae_transform[4], ae_transform[5])
-                    js_data['cameras'][name_ae]['rotationX'] += '%f ,' % (ae_transform[3])
-                    js_data['cameras'][name_ae]['zoom'] += '[%f],' % (zoom)
+                    position = '[%f,%f,%f],' % (ae_transform[0], ae_transform[1], ae_transform[2])
+                    orientation = '[%f,%f,%f],' % (ae_transform[3], ae_transform[4], ae_transform[5])
+                    zoom = '%f,' % (zoom)
+                    js_data['cameras'][name_ae]['position'] += position
+                    js_data['cameras'][name_ae]['orientation'] += orientation
+                    js_data['cameras'][name_ae]['zoom'] += zoom
+                    # Check if properties change values compared to previous frame
+                    # If property don't change through out the whole animation - keyframes won't be added
+                    if frame != data['start']:
+                        if position != js_data['cameras'][name_ae]['position_static']:
+                            js_data['cameras'][name_ae]['position_anim'] = True
+                        if orientation != js_data['cameras'][name_ae]['orientation_static']:
+                            js_data['cameras'][name_ae]['orientation_anim'] = True
+                        if zoom != js_data['cameras'][name_ae]['zoom_static']:
+                            js_data['cameras'][name_ae]['zoom_anim'] = True
+                    js_data['cameras'][name_ae]['position_static'] = position
+                    js_data['cameras'][name_ae]['orientation_static'] = orientation
+                    js_data['cameras'][name_ae]['zoom_static'] = zoom
 
         '''
         # keyframes for all solids. Not ready yet. Temporarily not active
@@ -412,29 +467,82 @@ def write_jsx_file(file, data, selection, include_active_cam, include_selected_c
             #get object name
             name_ae = selection['solids'][i][1]
             #convert ob position to AE space
-
-
-       # keyframes for all lights. Not ready yet. Temporarily not active
-        for i, ob in enumerate(selection['lights']):
-            #get object name
-            name_ae = selection['lights'][i][1]
-            #convert ob position to AE space
         '''
 
+        # keyframes for all lights.
+        if include_selected_objects:
+            for i, ob in enumerate(selection['lights']):
+                #get object name
+                name_ae = selection['lights'][i][1]
+                type = selection['lights'][i][0].data.type
+                # convert ob transform properties to AE space
+                ae_transform = convert_transform_matrix(ob[0].matrix_world.copy(), data['width'], data['height'], data['aspect'], x_rot_correction=True)
+                color = ob[0].data.color
+                # store all values in dico
+                position = '[%f,%f,%f],' % (ae_transform[0], ae_transform[1], ae_transform[2])
+                orientation = '[%f,%f,%f],' % (ae_transform[3], ae_transform[4], ae_transform[5])
+                energy = '[%f],' % (ob[0].data.energy * 100.0)
+                color = '[%f,%f,%f],' % (color[0], color[1], color[2])
+                js_data['lights'][name_ae]['position'] += position
+                js_data['lights'][name_ae]['orientation'] += orientation
+                js_data['lights'][name_ae]['energy'] += energy
+                js_data['lights'][name_ae]['color'] += color
+                # Check if properties change values compared to previous frame
+                # If property don't change through out the whole animation - keyframes won't be added
+                if frame != data['start']:
+                    if position != js_data['lights'][name_ae]['position_static']:
+                        js_data['lights'][name_ae]['position_anim'] = True
+                    if orientation != js_data['lights'][name_ae]['orientation_static']:
+                        js_data['lights'][name_ae]['orientation_anim'] = True
+                    if energy != js_data['lights'][name_ae]['energy_static']:
+                        js_data['lights'][name_ae]['energy_anim'] = True
+                    if color != js_data['lights'][name_ae]['color_static']:
+                        js_data['lights'][name_ae]['color_anim'] = True
+                js_data['lights'][name_ae]['position_static'] = position
+                js_data['lights'][name_ae]['orientation_static'] = orientation
+                js_data['lights'][name_ae]['energy_static'] = energy
+                js_data['lights'][name_ae]['color_static'] = color
+                if type == 'SPOT':
+                    cone_angle = '[%f],' % (degrees(ob[0].data.spot_size))
+                    cone_feather = '[%f],' % (ob[0].data.spot_blend * 100.0)
+                    js_data['lights'][name_ae]['cone_angle'] += cone_angle
+                    js_data['lights'][name_ae]['cone_feather'] += cone_feather
+                    # Check if properties change values compared to previous frame
+                    # If property don't change through out the whole animation - keyframes won't be added
+                    if frame != data['start']:
+                        if cone_angle != js_data['lights'][name_ae]['cone_angle_static']:
+                            js_data['lights'][name_ae]['cone_angle_anim'] = True
+                        if orientation != js_data['lights'][name_ae]['cone_feather_static']:
+                            js_data['lights'][name_ae]['cone_feather_anim'] = True
+                    js_data['lights'][name_ae]['cone_angle_static'] = cone_angle
+                    js_data['lights'][name_ae]['cone_feather_static'] = cone_feather
+
         # keyframes for all nulls
         if include_selected_objects:
             for i, ob in enumerate(selection['nulls']):
                 # get object name
                 name_ae = selection['nulls'][i][1]
                 # convert ob transform properties to AE space
-                ae_transform = convert_transform_matrix(ob[0].matrix_world.copy(), data['width'], data['height'], data['aspect'], x_rot_correction=False)
+                ae_transform = convert_transform_matrix(ob[0].matrix_world.copy(), data['width'], data['height'], data['aspect'], x_rot_correction=True)
                 # store all values in dico
-                js_data['nulls'][name_ae]['position'] += '[%f,%f,%f],' % (ae_transform[0], ae_transform[1], ae_transform[2])
-                if include_rotation:
-                    js_data['nulls'][name_ae]['orientation'] += '[%f,%f,%f],' % (0, ae_transform[4], ae_transform[5])
-                    js_data['nulls'][name_ae]['rotationX'] += '%f ,' % (ae_transform[3])
-                if include_scale:
-                    js_data['nulls'][name_ae]['scale'] += '[%f,%f,%f],' % (ae_transform[6], ae_transform[7], ae_transform[8])
+                position = '[%f,%f,%f],' % (ae_transform[0], ae_transform[1], ae_transform[2])
+                orientation = '[%f,%f,%f],' % (ae_transform[3], ae_transform[4], ae_transform[5])
+                scale = '[%f,%f,%f],' % (ae_transform[6], ae_transform[7], ae_transform[8])
+                js_data['nulls'][name_ae]['position'] += position
+                js_data['nulls'][name_ae]['orientation'] += orientation
+                js_data['nulls'][name_ae]['scale'] += scale
+                # Check if properties change values compared to previous frame
+                # If property don't change through out the whole animation - keyframes won't be added
+                if frame != data['start']:
+                    if position != js_data['nulls'][name_ae]['position_static']:
+                        js_data['nulls'][name_ae]['position_anim'] = True
+                    if orientation != js_data['nulls'][name_ae]['orientation_static']:
+                        js_data['nulls'][name_ae]['orientation_anim'] = True
+                    if scale != js_data['nulls'][name_ae]['scale_static']:
+                        js_data['nulls'][name_ae]['scale_anim'] = True
+                js_data['nulls'][name_ae]['position_static'] = position
+                js_data['nulls'][name_ae]['orientation_static'] = orientation
+                js_data['nulls'][name_ae]['scale_static'] = scale
 
         # keyframes for all object bundles. Not ready yet.
         #
@@ -446,6 +554,7 @@ def write_jsx_file(file, data, selection, include_active_cam, include_selected_c
 
     # make the jsx executable in After Effects (enable double click on jsx)
     jsx_file.write('#target AfterEffects\n\n')
+    # Script's header
     jsx_file.write('/**************************************\n')
     jsx_file.write('Scene : %s\n' % data['scn'].name)
     jsx_file.write('Resolution : %i x %i\n' % (data['width'], data['height']))
@@ -459,7 +568,7 @@ def write_jsx_file(file, data, selection, include_active_cam, include_selected_c
     jsx_file.write("function compFromBlender(){\n")
     # create new comp
     jsx_file.write('\nvar compName = prompt("Blender Comp\'s Name \\nEnter Name of newly created Composition","BlendComp","Composition\'s Name");\n')
-    jsx_file.write('if (compName){')
+    jsx_file.write('if (compName){')  # Continue only if comp name is given. If not - terminate
     jsx_file.write('\nvar newComp = app.project.items.addComp(compName, %i, %i, %f, %f, %i);' %
                    (data['width'], data['height'], data['aspect'], data['duration'], data['fps']))
     jsx_file.write('\nnewComp.displayStartTime = %f;\n\n\n' % ((data['start'] + 1.0) / data['fps']))
@@ -482,36 +591,82 @@ def write_jsx_file(file, data, selection, include_active_cam, include_selected_c
         jsx_file.write('var %s = newComp.layers.addNull();\n' % (name_ae))
         jsx_file.write('%s.threeDLayer = true;\n' % name_ae)
         jsx_file.write('%s.source.name = "%s";\n' % (name_ae, name_ae))
-        jsx_file.write('%s.property("position").setValuesAtTimes([%s],[%s]);\n' % (name_ae, js_data['times'], js_data['nulls'][obj]['position']))
-        if include_rotation:
+        # Set values of properties, add kyeframes only where needed
+        if include_animation and js_data['nulls'][name_ae]['position_anim']:
+            jsx_file.write('%s.property("position").setValuesAtTimes([%s],[%s]);\n' % (name_ae, js_data['times'], js_data['nulls'][obj]['position']))
+        else:
+            jsx_file.write('%s.property("position").setValue(%s);\n' % (name_ae, js_data['nulls'][obj]['position_static']))
+        if include_animation and js_data['nulls'][name_ae]['orientation_anim']:
             jsx_file.write('%s.property("orientation").setValuesAtTimes([%s],[%s]);\n' % (name_ae, js_data['times'], js_data['nulls'][obj]['orientation']))
-            jsx_file.write('%s.property("rotationX").setValuesAtTimes([%s],[%s]);\n' % (name_ae, js_data['times'], js_data['nulls'][obj]['rotationX']))
-            jsx_file.write('%s.property("rotationY").setValue(0);\n' % name_ae)
-            jsx_file.write('%s.property("rotationZ").setValue(0);\n\n\n' % name_ae)
-        if include_scale:
+        else:
+            jsx_file.write('%s.property("orientation").setValue(%s);\n' % (name_ae, js_data['nulls'][obj]['orientation_static']))
+        if include_animation and js_data['nulls'][name_ae]['scale_anim']:
             jsx_file.write('%s.property("scale").setValuesAtTimes([%s],[%s]);\n\n\n' % (name_ae, js_data['times'], js_data['nulls'][obj]['scale']))
-
+        else:
+            jsx_file.write('%s.property("scale").setValue(%s);\n\n\n' % (name_ae, js_data['nulls'][obj]['scale_static']))
     # create solids (not ready yet)
 
-    # create lights (not ready yet)
+    # create lights
+    jsx_file.write('// **************  LIGHTS  **************\n\n\n')
+    for i, obj in enumerate(js_data['lights']):
+        name_ae = obj
+        jsx_file.write('var %s = newComp.layers.addLight("%s", [0.0, 0.0]);\n' % (name_ae, name_ae))
+        jsx_file.write('%s.autoOrient = AutoOrientType.NO_AUTO_ORIENT;\n' % name_ae)
+        # Set values of properties, add kyeframes only where needed
+        if include_animation and js_data['lights'][name_ae]['position_anim']:
+            jsx_file.write('%s.property("position").setValuesAtTimes([%s],[%s]);\n' % (name_ae, js_data['times'], js_data['lights'][obj]['position']))
+        else:
+            jsx_file.write('%s.property("position").setValue(%s);\n' % (name_ae, js_data['lights'][obj]['position_static']))
+        if include_animation and js_data['lights'][name_ae]['orientation_anim']:
+            jsx_file.write('%s.property("orientation").setValuesAtTimes([%s],[%s]);\n' % (name_ae, js_data['times'], js_data['lights'][obj]['orientation']))
+        else:
+            jsx_file.write('%s.property("orientation").setValue(%s);\n' % (name_ae, js_data['lights'][obj]['orientation_static']))
+        if include_animation and js_data['lights'][name_ae]['energy_anim']:
+            jsx_file.write('%s.property("intensity").setValuesAtTimes([%s],[%s]);\n' % (name_ae, js_data['times'], js_data['lights'][obj]['energy']))
+        else:
+            jsx_file.write('%s.property("intensity").setValue(%s);\n' % (name_ae, js_data['lights'][obj]['energy_static']))
+        if include_animation and js_data['lights'][name_ae]['color_anim']:
+            jsx_file.write('%s.property("Color").setValuesAtTimes([%s],[%s]);\n' % (name_ae, js_data['times'], js_data['lights'][obj]['color']))
+        else:
+            jsx_file.write('%s.property("Color").setValue(%s);\n' % (name_ae, js_data['lights'][obj]['color_static']))
+            if js_data['lights'][obj]['type'] == 'SPOT':
+                if include_animation and js_data['lights'][name_ae]['cone_angle_anim']:
+                    jsx_file.write('%s.property("Cone Angle").setValuesAtTimes([%s],[%s]);\n' % (name_ae, js_data['times'], js_data['lights'][obj]['cone_angle']))
+                else:
+                    jsx_file.write('%s.property("Cone Angle").setValue(%s);\n' % (name_ae, js_data['lights'][obj]['cone_angle_static']))
+                if include_animation and js_data['lights'][name_ae]['cone_feather_anim']:
+                    jsx_file.write('%s.property("Cone Feather").setValuesAtTimes([%s],[%s]);\n' % (name_ae, js_data['times'], js_data['lights'][obj]['cone_feather']))
+                else:
+                    jsx_file.write('%s.property("Cone Feather").setValue(%s);\n' % (name_ae, js_data['lights'][obj]['cone_feather_static']))
+        jsx_file.write('\n\n')
 
     # create cameras
     jsx_file.write('// **************  CAMERAS  **************\n\n\n')
     for i, cam in enumerate(js_data['cameras']):  # more than one camera can be selected
         name_ae = cam
         jsx_file.write('var %s = newComp.layers.addCamera("%s",[0,0]);\n' % (name_ae, name_ae))
-        jsx_file.write('%s.property("position").setValuesAtTimes([%s],[%s]);\n' % (name_ae, js_data['times'], js_data['cameras'][cam]['position']))
-        jsx_file.write('%s.property("pointOfInterest").setValuesAtTimes([%s],[%s]);\n' % (name_ae, js_data['times'], js_data['cameras'][cam]['pointOfInterest']))
-        jsx_file.write('%s.property("orientation").setValuesAtTimes([%s],[%s]);\n' % (name_ae, js_data['times'], js_data['cameras'][cam]['orientation']))
-        jsx_file.write('%s.property("rotationX").setValuesAtTimes([%s],[%s]);\n' % (name_ae, js_data['times'], js_data['cameras'][cam]['rotationX']))
-        jsx_file.write('%s.property("rotationY").setValue(0);\n' % name_ae)
-        jsx_file.write('%s.property("rotationZ").setValue(0);\n' % name_ae)
-        jsx_file.write('%s.property("zoom").setValuesAtTimes([%s],[%s]);\n\n\n' % (name_ae, js_data['times'], js_data['cameras'][cam]['zoom']))
+        jsx_file.write('%s.autoOrient = AutoOrientType.NO_AUTO_ORIENT;\n' % name_ae)
+        # Set values of properties, add kyeframes only where needed
+        if include_animation and js_data['cameras'][name_ae]['position_anim']:
+            jsx_file.write('%s.property("position").setValuesAtTimes([%s],[%s]);\n' % (name_ae, js_data['times'], js_data['cameras'][cam]['position']))
+        else:
+            jsx_file.write('%s.property("position").setValue(%s);\n' % (name_ae, js_data['cameras'][cam]['position_static']))
+        if include_animation and js_data['cameras'][name_ae]['orientation_anim']:
+            jsx_file.write('%s.property("orientation").setValuesAtTimes([%s],[%s]);\n' % (name_ae, js_data['times'], js_data['cameras'][cam]['orientation']))
+        else:
+            jsx_file.write('%s.property("orientation").setValue(%s);\n' % (name_ae, js_data['cameras'][cam]['orientation_static']))
+        if include_animation and js_data['cameras'][name_ae]['zoom_anim']:
+            jsx_file.write('%s.property("zoom").setValuesAtTimes([%s],[%s]);\n\n\n' % (name_ae, js_data['times'], js_data['cameras'][cam]['zoom']))
+        else:
+            jsx_file.write('%s.property("zoom").setValue(%s);\n\n\n' % (name_ae, js_data['cameras'][cam]['zoom_static']))
 
+    # Exit import if no comp name given
     jsx_file.write('\n}else{alert ("Exit Import Blender animation data \\nNo Comp\'s name has been chosen","EXIT")};')
+    # Close function
     jsx_file.write("}\n\n\n")
+    # Execute function. Wrap in "undo group" for easy undoing import process
     jsx_file.write('app.beginUndoGroup("Import Blender animation data");\n')
-    jsx_file.write('compFromBlender();\n')
+    jsx_file.write('compFromBlender();\n')  # execute function
     jsx_file.write('app.endUndoGroup();\n\n\n')
     jsx_file.close()
 
@@ -522,10 +677,10 @@ def write_jsx_file(file, data, selection, include_active_cam, include_selected_c
 ##########################################
 
 
-def main(file, context, include_active_cam, include_selected_cams, include_selected_objects, include_cam_bundles, include_rotation, include_scale):
+def main(file, context, include_animation, include_active_cam, include_selected_cams, include_selected_objects, include_cam_bundles):
     data = get_comp_data(context)
     selection = get_selected(context)
-    write_jsx_file(file, data, selection, include_active_cam, include_selected_cams, include_selected_objects, include_cam_bundles, include_rotation, include_scale)
+    write_jsx_file(file, data, selection, include_animation, include_active_cam, include_selected_cams, include_selected_objects, include_cam_bundles)
     print ("\nExport to After Effects Completed")
     return {'FINISHED'}
 
@@ -544,29 +699,24 @@ class ExportJsx(bpy.types.Operator, ExportHelper):
     filename_ext = ".jsx"
     filter_glob = StringProperty(default="*.jsx", options={'HIDDEN'})
 
+    include_animation = BoolProperty(
+            name="Animation",
+            description="Animate Exported Cameras and Objects",
+            default=True,
+            )
     include_active_cam = BoolProperty(
             name="Active Camera",
-            description="Include Active Camera Data",
+            description="Include Active Camera",
             default=True,
             )
     include_selected_cams = BoolProperty(
             name="Selected Cameras",
-            description="Add Selected Cameras Data",
+            description="Add Selected Cameras",
             default=True,
             )
     include_selected_objects = BoolProperty(
             name="Selected Objects",
-            description="Add Selected Objects Data",
-            default=True,
-            )
-    include_rotation = BoolProperty(
-            name="Rotation",
-            description="Include rotation of selected objects",
-            default=True,
-            )
-    include_scale = BoolProperty(
-            name="Scale",
-            description="Include scale of selected object",
+            description="Export Selected Objects",
             default=True,
             )
     include_cam_bundles = BoolProperty(
@@ -584,13 +734,12 @@ class ExportJsx(bpy.types.Operator, ExportHelper):
         layout = self.layout
 
         box = layout.box()
+        box.label('Animation:')
+        box.prop(self, 'include_animation')
         box.label('Include Cameras and Objects:')
         box.prop(self, 'include_active_cam')
         box.prop(self, 'include_selected_cams')
         box.prop(self, 'include_selected_objects')
-        box.label("Include Objects' Properties:")
-        box.prop(self, 'include_rotation')
-        box.prop(self, 'include_scale')
         box.label("Include Tracking Data:")
         box.prop(self, 'include_cam_bundles')
 #        box.prop(self, 'include_ob_bundles')
@@ -604,7 +753,7 @@ class ExportJsx(bpy.types.Operator, ExportHelper):
         return ok
 
     def execute(self, context):
-        return main(self.filepath, context, self.include_active_cam, self.include_selected_cams, self.include_selected_objects, self.include_cam_bundles, self.include_rotation, self.include_scale)
+        return main(self.filepath, context, self.include_animation, self.include_active_cam, self.include_selected_cams, self.include_selected_objects, self.include_cam_bundles)
 
 
 def menu_func(self, context):
diff --git a/release/scripts/addons/io_export_directx_x.py b/release/scripts/addons/io_export_directx_x.py
index b2ec502..20949e6 100644
--- a/release/scripts/addons/io_export_directx_x.py
+++ b/release/scripts/addons/io_export_directx_x.py
@@ -18,8 +18,8 @@
 bl_info = {
     "name": "DirectX Model Format (.x)",
     "author": "Chris Foster (Kira Vakaan)",
-    "version": (2, 1, 2),
-    "blender": (2, 5, 8),
+    "version": (2, 1, 3),
+    "blender": (2, 6, 3),
     "location": "File > Export > DirectX (.x)",
     "description": "Export DirectX Model Format (.x)",
     "warning": "",
@@ -188,12 +188,12 @@ def GetObjectChildren(Parent):
 #Returns the vertex count of Mesh, counting each vertex for every face.
 def GetMeshVertexCount(Mesh):
     VertexCount = 0
-    for Face in Mesh.faces:
-        VertexCount += len(Face.vertices)
+    for Polygon in Mesh.polygons:
+        VertexCount += len(Polygon.vertices)
     return VertexCount
 
 #Returns the file path of first image texture from Material.
-def GetMaterialTexture(Material):
+def GetMaterialTextureFileName(Material):
     if Material:
         #Create a list of Textures that have type "IMAGE"
         ImageTextures = [Material.texture_slots[TextureSlot].texture for TextureSlot in Material.texture_slots.keys() if Material.texture_slots[TextureSlot].texture.type == "IMAGE"]
@@ -391,11 +391,12 @@ def WriteMeshVertices(Config, Mesh):
     VertexCount = GetMeshVertexCount(Mesh)
     Config.File.write("{}{};\n".format("  " * Config.Whitespace, VertexCount))
 
-    for Face in Mesh.faces:
-        Vertices = list(Face.vertices)
+    for Polygon in Mesh.polygons:
+        Vertices = list(Polygon.vertices)
 
         if Config.CoordinateSystem == 1:
             Vertices = Vertices[::-1]
+
         for Vertex in [Mesh.vertices[Vertex] for Vertex in Vertices]:
             Position = Vertex.co
             Config.File.write("{}{:9f};{:9f};{:9f};".format("  " * Config.Whitespace, Position[0], Position[1], Position[2]))
@@ -406,11 +407,11 @@ def WriteMeshVertices(Config, Mesh):
                 Config.File.write(",\n")
 
     Index = 0
-    Config.File.write("{}{};\n".format("  " * Config.Whitespace, len(Mesh.faces)))
+    Config.File.write("{}{};\n".format("  " * Config.Whitespace, len(Mesh.polygons)))
 
-    for Face in Mesh.faces:
-        Config.File.write("{}{};".format("  " * Config.Whitespace, len(Face.vertices)))
-        for Vertex in Face.vertices:
+    for Polygon in Mesh.polygons:
+        Config.File.write("{}{};".format("  " * Config.Whitespace, len(Polygon.vertices)))
+        for Vertex in Polygon.vertices:
             Config.File.write("{};".format(Index))
             Index += 1
         if Index == VertexCount:
@@ -427,16 +428,16 @@ def WriteMeshNormals(Config, Mesh):
     VertexCount = GetMeshVertexCount(Mesh)
     Config.File.write("{}{};\n".format("  " * Config.Whitespace, VertexCount))
 
-    for Face in Mesh.faces:
-        Vertices = list(Face.vertices)
+    for Polygon in Mesh.polygons:
+        Vertices = list(Polygon.vertices)
 
         if Config.CoordinateSystem == 1:
             Vertices = Vertices[::-1]
         for Vertex in [Mesh.vertices[Vertex] for Vertex in Vertices]:
-            if Face.use_smooth:
+            if Polygon.use_smooth:
                 Normal = Vertex.normal
             else:
-                Normal = Face.normal
+                Normal = Polygon.normal
             if Config.FlipNormals:
                 Normal = -Normal
             Config.File.write("{}{:9f};{:9f};{:9f};".format("  " * Config.Whitespace, Normal[0], Normal[1], Normal[2]))
@@ -447,11 +448,11 @@ def WriteMeshNormals(Config, Mesh):
                 Config.File.write(",\n")
 
     Index = 0
-    Config.File.write("{}{};\n".format("  " * Config.Whitespace, len(Mesh.faces)))
+    Config.File.write("{}{};\n".format("  " * Config.Whitespace, len(Mesh.polygons)))
 
-    for Face in Mesh.faces:
-        Config.File.write("{}{};".format("  " * Config.Whitespace, len(Face.vertices)))
-        for Vertex in Face.vertices:
+    for Polygon in Mesh.polygons:
+        Config.File.write("{}{};".format("  " * Config.Whitespace, len(Polygon.vertices)))
+        for Vertex in Polygon.vertices:
             Config.File.write("{};".format(Index))
             Index += 1
         if Index == VertexCount:
@@ -469,17 +470,17 @@ def WriteMeshMaterials(Config, Mesh):
     Materials = Mesh.materials
     if Materials.keys():
         MaterialIndexes = {}
-        for Face in Mesh.faces:
-            if Materials[Face.material_index] not in MaterialIndexes:
-                MaterialIndexes[Materials[Face.material_index]] = len(MaterialIndexes)
+        for Polygon in Mesh.polygons:
+            if Materials[Polygon.material_index] not in MaterialIndexes:
+                MaterialIndexes[Materials[Polygon.material_index]] = len(MaterialIndexes)
 
-        FaceCount = len(Mesh.faces)
+        PolygonCount = len(Mesh.polygons)
         Index = 0
-        Config.File.write("{}{};\n{}{};\n".format("  " * Config.Whitespace, len(MaterialIndexes), "  " * Config.Whitespace, FaceCount))
-        for Face in Mesh.faces:
-            Config.File.write("{}{}".format("  " * Config.Whitespace, MaterialIndexes[Materials[Face.material_index]]))
+        Config.File.write("{}{};\n{}{};\n".format("  " * Config.Whitespace, len(MaterialIndexes), "  " * Config.Whitespace, PolygonCount))
+        for Polygon in Mesh.polygons:
+            Config.File.write("{}{}".format("  " * Config.Whitespace, MaterialIndexes[Materials[Polygon.material_index]]))
             Index += 1
-            if Index == FaceCount:
+            if Index == PolygonCount:
                 Config.File.write(";;\n")
             else:
                 Config.File.write(",\n")
@@ -517,9 +518,9 @@ def WriteMaterial(Config, Material=None):
         Config.File.write("{} 0.500000; 0.500000; 0.500000;;\n".format("  " * Config.Whitespace))
     Config.File.write("{} 0.000000; 0.000000; 0.000000;;\n".format("  " * Config.Whitespace))
     if Config.ExportTextures:
-        Texture = GetMaterialTexture(Material)
-        if Texture:
-            Config.File.write("{}TextureFilename {{\"{}\";}}\n".format("  " * Config.Whitespace, Texture))
+        TextureFileName = GetMaterialTextureFileName(Material)
+        if TextureFileName:
+            Config.File.write("{}TextureFilename {{\"{}\";}}\n".format("  " * Config.Whitespace, TextureFileName))
     Config.Whitespace -= 1
     Config.File.write("{}}}\n".format("  " * Config.Whitespace))
 
@@ -528,20 +529,16 @@ def WriteMeshUVCoordinates(Config, Mesh):
     Config.File.write("{}MeshTextureCoords {{ //{} UV Coordinates\n".format("  " * Config.Whitespace, LegalName(Mesh.name)))
     Config.Whitespace += 1
 
-    UVCoordinates = None
-    for UV in Mesh.uv_textures:
-        if UV.active_render:
-            UVCoordinates = UV.data
-            break
+    UVCoordinates = Mesh.uv_layers.active.data
 
     Index = 0
     VertexCount = GetMeshVertexCount(Mesh)
     Config.File.write("{}{};\n".format("  " * Config.Whitespace, VertexCount))
 
-    for Face in UVCoordinates:
+    for Polygon in Mesh.polygons:
         Vertices = []
-        for Vertex in Face.uv:
-            Vertices.append(tuple(Vertex))
+        for Vertex in [UVCoordinates[Vertex] for Vertex in Polygon.loop_indices]:
+            Vertices.append(tuple(Vertex.uv))
         if Config.CoordinateSystem == 1:
             Vertices = Vertices[::-1]
         for Vertex in Vertices:
@@ -551,6 +548,7 @@ def WriteMeshUVCoordinates(Config, Mesh):
                 Config.File.write(";\n")
             else:
                 Config.File.write(",\n")
+    
     Config.Whitespace -= 1
     Config.File.write("{}}} //End of {} UV Coordinates\n".format("  " * Config.Whitespace, LegalName(Mesh.name)))
 
@@ -594,8 +592,8 @@ def WriteMeshSkinWeights(Config, Object, Mesh):
         for Bone in UsedBones:
             VertexCount = 0
             VertexIndexes = [Vertex.index for Vertex in VertexGroups[Bone]]
-            for Face in Mesh.faces:
-                for Vertex in Face.vertices:
+            for Polygon in Mesh.polygons:
+                for Vertex in Polygon.vertices:
                     if Vertex in VertexIndexes:
                         VertexCount += 1
 
@@ -606,11 +604,11 @@ def WriteMeshSkinWeights(Config, Object, Mesh):
             VertexWeights = []
             Index = 0
             WrittenIndexes = 0
-            for Face in Mesh.faces:
-                FaceVertices = list(Face.vertices)
+            for Polygon in Mesh.polygons:
+                PolygonVertices = list(Polygon.vertices)
                 if Config.CoordinateSystem == 1:
-                    FaceVertices = FaceVertices[::-1]
-                for Vertex in FaceVertices:
+                    PolygonVertices = PolygonVertices[::-1]
+                for Vertex in PolygonVertices:
                     if Vertex in VertexIndexes:
                         Config.File.write("{}{}".format("  " * Config.Whitespace, Index))
 
@@ -1298,4 +1296,4 @@ def unregister():
 
 
 if __name__ == "__main__":
-    register()
+    register()
\ No newline at end of file
diff --git a/release/scripts/addons/io_export_unreal_psk_psa.py b/release/scripts/addons/io_export_unreal_psk_psa.py
index 5153eed..efefd9c 100644
--- a/release/scripts/addons/io_export_unreal_psk_psa.py
+++ b/release/scripts/addons/io_export_unreal_psk_psa.py
@@ -1,4 +1,4 @@
-#  ***** GPL LICENSE BLOCK *****
+#====================== 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
@@ -13,13 +13,15 @@
 #  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 *****
+#
+#======================= END GPL LICENSE BLOCK =============================
 
 bl_info = {
     "name": "Export Unreal Engine Format(.psk/.psa)",
     "author": "Darknet/Optimus_P-Fat/Active_Trash/Sinsoft/VendorX",
     "version": (2, 4),
-    "blender": (2, 6, 0),
+    "blender": (2, 6, 2),
+    "api": 36079,
     "location": "File > Export > Skeletal Mesh/Animation Data (.psk/.psa)",
     "description": "Export Skeleletal Mesh/Animation Data",
     "warning": "",
@@ -77,15 +79,79 @@ Credit to:
 - http://sinsoft.com
 """
 
+
+#===========================================================================
+"""
+NOTES for Jan 2012 refactor (Spoof)
+
+	* THIS IS A WORK IN PROGRESS. These modifications were originally
+	intended for internal use and are incomplete. Use at your own risk! *
+
+TODO
+
+- (Blender 2.62) changes to Matrix math
+- (Blender 2.62) check for long names
+- option to manually set the root bone for export
+
+CHANGES
+
+- new bone parsing to allow advanced rigging
+- identification of armature and mesh
+- removed the need to apply an action to the armature
+- fixed anim rate to work correctly in UDK (no more FPS fudging)
+- progress reporting while processing smooth groups
+- more informative logging
+- code refactor for clarity and modularity
+	- naming conventions unified to use lowercase_with_underscore
+	- C++ datatypes and PSK/PSA classes remain CamelCaseStyle for clarity
+	- names such as 'ut' and 'unreal' unified to 'udk'
+	- simplification of code structure
+	- removed legacy code paths
+
+USAGE
+
+This version of the exporter is more selective over which bones are considered
+part of the UDK skeletal mesh, and allows greater flexibility for adding
+control bones to aid in animation.
+
+Taking advantage of this script requires the following methodology:
+
+	* Place all exportable bones into a bone hierarchy extending from a single
+	root. This root bone must have use_deform enabled. All other root bones
+	in the armature must disable use_deform. *
+
+The script searches for a root bone with use_deform set true and considers all
+bones parented to it as part of the UDK skeletal mesh. Thus only these bones
+are exported and all other bones are ignored.
+
+This removes many restrictions on the rigger/animator, who can add control
+bone hierarchies to the rig, and keyframe any element into actions. With this
+approach you can build complex animation rigs in a similar vein to the Rigify
+add-on, by Nathan Vegdahl. However...
+
+	* Rigify is incompatible with this script *
+
+Rigify interlaces deformer bones within a single hierarchy making it difficult
+to deconstruct for export. It also splits some meta-rig bones into multiple
+deformer bones (bad for optimising a game character). I had partial success
+writing a parser for the structure, but it was taking too much time and,
+considering the other issues with Rigify, it was abandoned.
+"""
+#===========================================================================
+
+
 import os
 import time
 import bpy
 import mathutils
+import math
 import random
 import operator
+import sys
 
 from struct import pack
 
+
 # REFERENCE MATERIAL JUST IN CASE:
 # 
 # U = x / sqrt(x^2 + y^2 + z^2)
@@ -93,2306 +159,1796 @@ from struct import pack
 #
 # Triangles specifed counter clockwise for front face
 #
-#defines for sizeofs
-SIZE_FQUAT = 16
-SIZE_FVECTOR = 12
-SIZE_VJOINTPOS = 44
-SIZE_ANIMINFOBINARY = 168
-SIZE_VCHUNKHEADER = 32
-SIZE_VMATERIAL = 88
-SIZE_VBONE = 120
-SIZE_FNAMEDBONEBINARY = 120
-SIZE_VRAWBONEINFLUENCE = 12
-SIZE_VQUATANIMKEY = 32
-SIZE_VVERTEX = 16
-SIZE_VPOINT = 12
-SIZE_VTRIANGLE = 12
-MaterialName = []
-
-# ======================================================================
-# TODO: remove this 1am hack
-nbone = 0
-bDeleteMergeMesh = False
-exportmessage = "Export Finish" 
-
-########################################################################
+# defines for sizeofs
+SIZE_FQUAT				= 16
+SIZE_FVECTOR			= 12
+SIZE_VJOINTPOS			= 44
+SIZE_ANIMINFOBINARY		= 168
+SIZE_VCHUNKHEADER		= 32
+SIZE_VMATERIAL			= 88
+SIZE_VBONE				= 120
+SIZE_FNAMEDBONEBINARY	= 120
+SIZE_VRAWBONEINFLUENCE	= 12
+SIZE_VQUATANIMKEY		= 32
+SIZE_VVERTEX			= 16
+SIZE_VPOINT				= 12
+SIZE_VTRIANGLE			= 12
+
+MaterialName			= []
+
+
+#===========================================================================
+# Custom exception class
+#===========================================================================
+class Error( Exception ):
+
+	def __init__(self, message):
+		self.message = message
+
+
+#===========================================================================
+# Verbose logging with loop truncation
+#===========================================================================
+def verbose( msg, iteration=-1, max_iterations=4, msg_truncated="..." ):
+
+	if bpy.context.scene.udk_option_verbose == True:
+		# limit the number of times a loop can output messages
+		if iteration > max_iterations:
+			return
+		elif iteration == max_iterations:
+			print(msg_truncated)
+			return
+
+		print(msg)
+	
+
+#===========================================================================
+# Log header/separator
+#===========================================================================
+def header( msg, justify='LEFT', spacer='_', cols=78 ):
+	
+	if justify == 'LEFT':
+		s = '{:{spacer}<{cols}}'.format(msg+" ", spacer=spacer, cols=cols)
+	
+	elif justify == 'RIGHT':
+		s = '{:{spacer}>{cols}}'.format(" "+msg, spacer=spacer, cols=cols)
+	
+	else:
+		s = '{:{spacer}^{cols}}'.format(" "+msg+" ", spacer=spacer, cols=cols)
+	
+	return "\n" + s + "\n"
+
+
+#===========================================================================
 # Generic Object->Integer mapping
 # the object must be usable as a dictionary key
+#===========================================================================
 class ObjMap:
-    def __init__(self):
-        self.dict = {}
-        self.next = 0
-    def get(self, obj):
-        if obj in self.dict:
-            return self.dict[obj]
-        else:
-            id = self.next
-            self.next = self.next + 1
-            self.dict[obj] = id
-            return id
-        
-    def items(self):
-        getval = operator.itemgetter(0)
-        getkey = operator.itemgetter(1)
-        return map(getval, sorted(self.dict.items(), key=getkey))
+	
+	def __init__(self):
+		self.dict = {}
+		self.next = 0
+	
+	def get(self, obj):
+		if obj in self.dict:
+			return self.dict[obj]
+		else:
+			id = self.next
+			self.next = self.next + 1
+			self.dict[obj] = id
+			return id
+	
+	def items(self):
+		getval = operator.itemgetter(0)
+		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
 # updated UDK (Unreal Engine 3): http://udn.epicgames.com/Three/BinaryFormatSpecifications.html
+#===========================================================================
 class FQuat:
-    def __init__(self): 
-        self.X = 0.0
-        self.Y = 0.0
-        self.Z = 0.0
-        self.W = 1.0
-        
-    def dump(self):
-        data = pack('ffff', self.X, self.Y, self.Z, self.W)
-        return data
-        
-    def __cmp__(self, other):
-        return cmp(self.X, other.X) \
-            or cmp(self.Y, other.Y) \
-            or cmp(self.Z, other.Z) \
-            or cmp(self.W, other.W)
-        
-    def __hash__(self):
-        return hash(self.X) ^ hash(self.Y) ^ hash(self.Z) ^ hash(self.W)
-        
-    def __str__(self):
-        return "[%f,%f,%f,%f](FQuat)" % (self.X, self.Y, self.Z, self.W)
-        
+
+	def __init__(self): 
+		self.X = 0.0
+		self.Y = 0.0
+		self.Z = 0.0
+		self.W = 1.0
+		
+	def dump(self):
+		return pack('ffff', self.X, self.Y, self.Z, self.W)
+		
+	def __cmp__(self, other):
+		return cmp(self.X, other.X) \
+			or cmp(self.Y, other.Y) \
+			or cmp(self.Z, other.Z) \
+			or cmp(self.W, other.W)
+		
+	def __hash__(self):
+		return hash(self.X) ^ hash(self.Y) ^ hash(self.Z) ^ hash(self.W)
+		
+	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):
-        self.X = X
-        self.Y = Y
-        self.Z = Z
-        
-    def dump(self):
-        data = pack('fff', self.X, self.Y, self.Z)
-        return data
-        
-    def __cmp__(self, other):
-        return cmp(self.X, other.X) \
-            or cmp(self.Y, other.Y) \
-            or cmp(self.Z, other.Z)
-        
-    def _key(self):
-        return (type(self).__name__, self.X, self.Y, self.Z)
-        
-    def __hash__(self):
-        return hash(self._key())
-        
-    def __eq__(self, other):
-        if not hasattr(other, '_key'):
-            return False
-        return self._key() == other._key() 
-        
-    def dot(self, other):
-        return self.X * other.X + self.Y * other.Y + self.Z * other.Z
-    
-    def cross(self, other):
-        return FVector(self.Y * other.Z - self.Z * other.Y,
-                self.Z * other.X - self.X * other.Z,
-                self.X * other.Y - self.Y * other.X)
-                
-    def sub(self, other):
-        return FVector(self.X - other.X,
-            self.Y - other.Y,
-            self.Z - other.Z)
+
+	def __init__(self, X=0.0, Y=0.0, Z=0.0):
+		self.X = X
+		self.Y = Y
+		self.Z = Z
+		
+	def dump(self):
+		return pack('fff', self.X, self.Y, self.Z)
+		
+	def __cmp__(self, other):
+		return cmp(self.X, other.X) \
+			or cmp(self.Y, other.Y) \
+			or cmp(self.Z, other.Z)
+		
+	def _key(self):
+		return (type(self).__name__, self.X, self.Y, self.Z)
+		
+	def __hash__(self):
+		return hash(self._key())
+		
+	def __eq__(self, other):
+		if not hasattr(other, '_key'):
+			return False
+		return self._key() == other._key() 
+		
+	def dot(self, other):
+		return self.X * other.X + self.Y * other.Y + self.Z * other.Z
+	
+	def cross(self, other):
+		return FVector(self.Y * other.Z - self.Z * other.Y,
+				self.Z * other.X - self.X * other.Z,
+				self.X * other.Y - self.Y * other.X)
+				
+	def sub(self, other):
+		return FVector(self.X - other.X,
+			self.Y - other.Y,
+			self.Z - other.Z)
+
 
 class VJointPos:
-    def __init__(self):
-        self.Orientation = FQuat()
-        self.Position = FVector()
-        self.Length = 0.0
-        self.XSize = 0.0
-        self.YSize = 0.0
-        self.ZSize = 0.0
-        
-    def dump(self):
-        data = self.Orientation.dump() + self.Position.dump() + pack('4f', self.Length, self.XSize, self.YSize, self.ZSize)
-        return data
-            
+
+	def __init__(self):
+		self.Orientation	= FQuat()
+		self.Position		= FVector()
+		self.Length			= 0.0
+		self.XSize			= 0.0
+		self.YSize			= 0.0
+		self.ZSize			= 0.0
+		
+	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):
-        self.Name = "" # length=64
-        self.Group = ""    # length=64
-        self.TotalBones = 0
-        self.RootInclude = 0
-        self.KeyCompressionStyle = 0
-        self.KeyQuotum = 0
-        self.KeyPrediction = 0.0
-        self.TrackTime = 0.0
-        self.AnimRate = 0.0
-        self.StartBone = 0
-        self.FirstRawFrame = 0
-        self.NumRawFrames = 0
-        
-    def dump(self):
-        data = 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)
-        return data
+
+	def __init__(self):
+		self.Name			= ""	# length=64
+		self.Group			= ""	# length=64
+		self.TotalBones		= 0
+		self.RootInclude	= 0
+		self.KeyCompressionStyle = 0
+		self.KeyQuotum		= 0
+		self.KeyPrediction	= 0.0
+		self.TrackTime		= 0.0
+		self.AnimRate		= 0.0
+		self.StartBone		= 0
+		self.FirstRawFrame	= 0
+		self.NumRawFrames	= 0
+		
+	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):
-        self.ChunkID = str.encode(name) # length=20
-        self.TypeFlag = 1999801 # special value
-        self.DataSize = type_size
-        self.DataCount = 0
-        
-    def dump(self):
-        data = pack('20siii', self.ChunkID, self.TypeFlag, self.DataSize, self.DataCount)
-        return data
-        
+
+	def __init__(self, name, type_size):
+		self.ChunkID		= str.encode(name)	# length=20
+		self.TypeFlag		= 1999801			# special value
+		self.DataSize		= type_size
+		self.DataCount		= 0
+		
+	def dump(self):
+		return pack('20siii', self.ChunkID, self.TypeFlag, self.DataSize, self.DataCount)
+
+
 class VMaterial:
-    def __init__(self):
-        self.MaterialName = "" # length=64
-        self.TextureIndex = 0
-        self.PolyFlags = 0 # DWORD
-        self.AuxMaterial = 0
-        self.AuxFlags = 0 # DWORD
-        self.LodBias = 0
-        self.LodStyle = 0
-        
-    def dump(self):
-        print("DATA MATERIAL:",self.MaterialName)
-        data = pack('64siLiLii', str.encode(self.MaterialName), self.TextureIndex, self.PolyFlags, self.AuxMaterial, self.AuxFlags, self.LodBias, self.LodStyle)
-        return data
+
+	def __init__(self):
+		self.MaterialName	= ""	# length=64
+		self.TextureIndex	= 0
+		self.PolyFlags		= 0		# DWORD
+		self.AuxMaterial	= 0
+		self.AuxFlags		= 0		# DWORD
+		self.LodBias		= 0
+		self.LodStyle		= 0
+		
+	def dump(self):
+		#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):
-        self.Name = "" # length = 64
-        self.Flags = 0 # DWORD
-        self.NumChildren = 0
-        self.ParentIndex = 0
-        self.BonePos = VJointPos()
-        
-    def dump(self):
-        data = pack('64sLii', str.encode(self.Name), self.Flags, self.NumChildren, self.ParentIndex) + self.BonePos.dump()
-        return data
 
-#same as above - whatever - this is how Epic does it...        
+	def __init__(self):
+		self.Name			= ""	# length = 64
+		self.Flags			= 0		# DWORD
+		self.NumChildren	= 0
+		self.ParentIndex	= 0
+		self.BonePos		= VJointPos()
+		
+	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:
-    def __init__(self):
-        self.Name = "" # length = 64
-        self.Flags = 0 # DWORD
-        self.NumChildren = 0
-        self.ParentIndex = 0
-        self.BonePos = VJointPos()
-        
-        self.IsRealBone = 0  # this is set to 1 when the bone is actually a bone in the mesh and not a dummy
-        
-    def dump(self):
-        data = pack('64sLii', str.encode(self.Name), self.Flags, self.NumChildren, self.ParentIndex) + self.BonePos.dump()
-        return data
-    
+
+	def __init__(self):
+		self.Name			= ""	# length = 64
+		self.Flags			= 0		# DWORD
+		self.NumChildren	= 0
+		self.ParentIndex	= 0
+		self.BonePos		= VJointPos()
+		self.IsRealBone		= 0		# this is set to 1 when the bone is actually a bone in the mesh and not a dummy
+		
+	def dump(self):
+		return pack('64sLii', str.encode(self.Name), self.Flags, self.NumChildren, self.ParentIndex) + self.BonePos.dump()
+
+
 class VRawBoneInfluence:
-    def __init__(self):
-        self.Weight = 0.0
-        self.PointIndex = 0
-        self.BoneIndex = 0
-        
-    def dump(self):
-        data = pack('fii', self.Weight, self.PointIndex, self.BoneIndex)
-        return data
-        
+
+	def __init__(self):
+		self.Weight			= 0.0
+		self.PointIndex		= 0
+		self.BoneIndex		= 0
+		
+	def dump(self):
+		return pack('fii', self.Weight, self.PointIndex, self.BoneIndex)
+
+
 class VQuatAnimKey:
-    def __init__(self):
-        self.Position = FVector()
-        self.Orientation = FQuat()
-        self.Time = 0.0
-        
-    def dump(self):
-        data = self.Position.dump() + self.Orientation.dump() + pack('f', self.Time)
-        return data
-        
-class VVertex(object):
-    def __init__(self):
-        self.PointIndex = 0 # WORD
-        self.U = 0.0
-        self.V = 0.0
-        self.MatIndex = 0 #BYTE
-        self.Reserved = 0 #BYTE
-        
-    def dump(self):
-        data = pack('HHffBBH', self.PointIndex, 0, self.U, self.V, self.MatIndex, self.Reserved, 0)
-        return data
-        
-    def __cmp__(self, other):
-        return cmp(self.PointIndex, other.PointIndex) \
-            or cmp(self.U, other.U) \
-            or cmp(self.V, other.V) \
-            or cmp(self.MatIndex, other.MatIndex) \
-            or cmp(self.Reserved, other.Reserved)
-    
-    def _key(self):
-        return (type(self).__name__,self.PointIndex, self.U, self.V,self.MatIndex,self.Reserved)
-        
-    def __hash__(self):
-        return hash(self._key())
-        
-    def __eq__(self, other):
-        if not hasattr(other, '_key'):
-            return False
-        return self._key() == other._key()
-        
-class VPoint(object):
-    def __init__(self):
-        self.Point = FVector()
-        
-    def dump(self):
-        return self.Point.dump()
-        
-    def __cmp__(self, other):
-        return cmp(self.Point, other.Point)
-    
-    def _key(self):
-        return (type(self).__name__, self.Point)
-    
-    def __hash__(self):
-        return hash(self._key())
-        
-    def __eq__(self, other):
-        if not hasattr(other, '_key'):
-            return False
-        return self._key() == other._key() 
-        
-class VTriangle:
-    def __init__(self):
-        self.WedgeIndex0 = 0 # WORD
-        self.WedgeIndex1 = 0 # WORD
-        self.WedgeIndex2 = 0 # WORD
-        self.MatIndex = 0 # BYTE
-        self.AuxMatIndex = 0 # BYTE
-        self.SmoothingGroups = 0 # DWORD
-        
-    def dump(self):
-        data = pack('HHHBBL', self.WedgeIndex0, self.WedgeIndex1, self.WedgeIndex2, self.MatIndex, self.AuxMatIndex, self.SmoothingGroups)
-        return data
 
-# END UNREAL DATA STRUCTS
-########################################################################
+	def __init__(self):
+		self.Position		= FVector()
+		self.Orientation	= FQuat()
+		self.Time			= 0.0
+		
+	def dump(self):
+		return self.Position.dump() + self.Orientation.dump() + pack('f', self.Time)
 
-########################################################################
-#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
-class FileSection:
-    def __init__(self, name, type_size):
-        self.Header = VChunkHeader(name, type_size)
-        self.Data = [] # list of datatypes
-        
-    def dump(self):
-        data = self.Header.dump()
-        for i in range(len(self.Data)):
-            data = data + self.Data[i].dump()
-        return data
-        
-    def UpdateHeader(self):
-        self.Header.DataCount = len(self.Data)
-        
-class PSKFile:
-    def __init__(self):
-        self.GeneralHeader = VChunkHeader("ACTRHEAD", 0)
-        self.Points = FileSection("PNTS0000", SIZE_VPOINT)        #VPoint
-        self.Wedges = FileSection("VTXW0000", SIZE_VVERTEX)        #VVertex
-        self.Faces = FileSection("FACE0000", SIZE_VTRIANGLE)        #VTriangle
-        self.Materials = FileSection("MATT0000", SIZE_VMATERIAL)    #VMaterial
-        self.Bones = FileSection("REFSKELT", SIZE_VBONE)        #VBone
-        self.Influences = FileSection("RAWWEIGHTS", SIZE_VRAWBONEINFLUENCE)    #VRawBoneInfluence
-        
-        #RG - this mapping is not dumped, but is used internally to store the new point indices 
-        # for vertex groups calculated during the mesh dump, so they can be used again
-        # to dump bone influences during the armature dump
-        #
-        # the key in this dictionary is the VertexGroup/Bone Name, and the value
-        # is a list of tuples containing the new point index and the weight, in that order
-        #
-        # Layout:
-        # { groupname : [ (index, weight), ... ], ... }
-        #
-        # example: 
-        # { 'MyVertexGroup' : [ (0, 1.0), (5, 1.0), (3, 0.5) ] , 'OtherGroup' : [(2, 1.0)] }
-        
-        self.VertexGroups = {} 
-        
-    def AddPoint(self, p):
-        #print ('AddPoint')
-        self.Points.Data.append(p)
-        
-    def AddWedge(self, w):
-        #print ('AddWedge')
-        self.Wedges.Data.append(w)
-    
-    def AddFace(self, f):
-        #print ('AddFace')
-        self.Faces.Data.append(f)
-        
-    def AddMaterial(self, m):
-        #print ('AddMaterial')
-        self.Materials.Data.append(m)
-        
-    def AddBone(self, b):
-        #print ('AddBone [%s]: Position: (x=%f, y=%f, z=%f) Rotation=(%f,%f,%f,%f)'  % (b.Name, b.BonePos.Position.X, b.BonePos.Position.Y, b.BonePos.Position.Z, b.BonePos.Orientation.X,b.BonePos.Orientation.Y,b.BonePos.Orientation.Z,b.BonePos.Orientation.W))
-        self.Bones.Data.append(b)
-        
-    def AddInfluence(self, i):
-        #print ('AddInfluence')
-        self.Influences.Data.append(i)
-        
-    def UpdateHeaders(self):
-        self.Points.UpdateHeader()
-        self.Wedges.UpdateHeader()
-        self.Faces.UpdateHeader()
-        self.Materials.UpdateHeader()
-        self.Bones.UpdateHeader()
-        self.Influences.UpdateHeader()
-        
-    def dump(self):
-        self.UpdateHeaders()
-        data = self.GeneralHeader.dump() + self.Points.dump() + self.Wedges.dump() + self.Faces.dump() + self.Materials.dump() + self.Bones.dump() + self.Influences.dump()
-        return data
-        
-    def GetMatByIndex(self, mat_index):
-        if mat_index >= 0 and len(self.Materials.Data) > mat_index:
-            return self.Materials.Data[mat_index]
-        else:
-            m = VMaterial()
-            # modified by VendorX
-            m.MaterialName = MaterialName[mat_index]
-            self.AddMaterial(m)
-            return m
-        
-    def PrintOut(self):
-        print ("--- PSK FILE EXPORTED ---")
-        print ('point count: %i' % len(self.Points.Data))
-        print ('wedge count: %i' % len(self.Wedges.Data))
-        print ('face count: %i' % len(self.Faces.Data))
-        print ('material count: %i' % len(self.Materials.Data))
-        print ('bone count: %i' % len(self.Bones.Data))
-        print ('inlfuence count: %i' % len(self.Influences.Data))
-        print ('-------------------------')
-
-# PSA FILE NOTES FROM UDN:
-#
-#    The raw key array holds all the keys for all the bones in all the specified sequences, 
-#    organized as follows:
-#    For each AnimInfoBinary's sequence there are [Number of bones] times [Number of frames keys] 
-#    in the VQuatAnimKeys, laid out as tracks of [numframes] keys for each bone in the order of 
-#    the bones as defined in the array of FnamedBoneBinary in the PSA. 
-#
-#    Once the data from the PSK (now digested into native skeletal mesh) and PSA (digested into 
-#    a native animation object containing one or more sequences) are associated together at runtime, 
-#    bones are linked up by name. Any bone in a skeleton (from the PSK) that finds no partner in 
-#    the animation sequence (from the PSA) will assume its reference pose stance ( as defined in 
-#    the offsets & rotations that are in the VBones making up the reference skeleton from the PSK)
 
-class PSAFile:
-    def __init__(self):
-        self.GeneralHeader = VChunkHeader("ANIMHEAD", 0)
-        self.Bones = FileSection("BONENAMES", SIZE_FNAMEDBONEBINARY)    #FNamedBoneBinary
-        self.Animations = FileSection("ANIMINFO", SIZE_ANIMINFOBINARY)    #AnimInfoBinary
-        self.RawKeys = FileSection("ANIMKEYS", SIZE_VQUATANIMKEY)    #VQuatAnimKey
-        
-        # this will take the format of key=Bone Name, value = (BoneIndex, Bone Object)
-        # THIS IS NOT DUMPED
-        self.BoneLookup = {} 
-
-    def AddBone(self, b):
-        #LOUD
-        #print "AddBone: " + b.Name
-        self.Bones.Data.append(b)
-        
-    def AddAnimation(self, a):
-        #LOUD
-        #print "AddAnimation: %s, TotalBones: %i, AnimRate: %f, NumRawFrames: %i, TrackTime: %f" % (a.Name, a.TotalBones, a.AnimRate, a.NumRawFrames, a.TrackTime)
-        self.Animations.Data.append(a)
-        
-    def AddRawKey(self, k):
-        #LOUD
-        #print "AddRawKey [%i]: Time: %f, Quat: x=%f, y=%f, z=%f, w=%f, Position: x=%f, y=%f, z=%f" % (len(self.RawKeys.Data), k.Time, k.Orientation.X, k.Orientation.Y, k.Orientation.Z, k.Orientation.W, k.Position.X, k.Position.Y, k.Position.Z)
-        self.RawKeys.Data.append(k)
-        
-    def UpdateHeaders(self):
-        self.Bones.UpdateHeader()
-        self.Animations.UpdateHeader()
-        self.RawKeys.UpdateHeader()
-        
-    def GetBoneByIndex(self, bone_index):
-        if bone_index >= 0 and len(self.Bones.Data) > bone_index:
-            return self.Bones.Data[bone_index]
-    
-    def IsEmpty(self):
-        return (len(self.Bones.Data) == 0 or len(self.Animations.Data) == 0)
-    
-    def StoreBone(self, b):
-        self.BoneLookup[b.Name] = [-1, b]
-                    
-    def UseBone(self, bone_name):
-        if bone_name in self.BoneLookup:
-            bone_data = self.BoneLookup[bone_name]
-            
-            if bone_data[0] == -1:
-                bone_data[0] = len(self.Bones.Data)
-                self.AddBone(bone_data[1])
-                #self.Bones.Data.append(bone_data[1])
-            
-            return bone_data[0]
-            
-    def GetBoneByName(self, bone_name):
-        if bone_name in self.BoneLookup:
-            bone_data = self.BoneLookup[bone_name]
-            return bone_data[1]
-        
-    def GetBoneIndex(self, bone_name):
-        if bone_name in self.BoneLookup:
-            bone_data = self.BoneLookup[bone_name]
-            return bone_data[0]
-        
-    def dump(self):
-        self.UpdateHeaders()
-        data = self.GeneralHeader.dump() + self.Bones.dump() + self.Animations.dump() + self.RawKeys.dump()
-        return data
-        
-    def PrintOut(self):
-        print ('--- PSA FILE EXPORTED ---')
-        print ('bone count: %i' % len(self.Bones.Data))
-        print ('animation count: %i' % len(self.Animations.Data))
-        print ('rawkey count: %i' % len(self.RawKeys.Data))
-        print ('-------------------------')
-        
-####################################    
-# helpers to create bone structs
-def make_vbone(name, parent_index, child_count, orientation_quat, position_vect):
-    bone = VBone()
-    bone.Name = name
-    bone.ParentIndex = parent_index
-    bone.NumChildren = child_count
-    bone.BonePos.Orientation = orientation_quat
-    bone.BonePos.Position.X = position_vect.x
-    bone.BonePos.Position.Y = position_vect.y
-    bone.BonePos.Position.Z = position_vect.z
-    
-    #these values seem to be ignored?
-    #bone.BonePos.Length = tail.length
-    #bone.BonePos.XSize = tail.x
-    #bone.BonePos.YSize = tail.y
-    #bone.BonePos.ZSize = tail.z
-
-    return bone
-
-def make_namedbonebinary(name, parent_index, child_count, orientation_quat, position_vect, is_real):
-    bone = FNamedBoneBinary()
-    bone.Name = name
-    bone.ParentIndex = parent_index
-    bone.NumChildren = child_count
-    bone.BonePos.Orientation = orientation_quat
-    bone.BonePos.Position.X = position_vect.x
-    bone.BonePos.Position.Y = position_vect.y
-    bone.BonePos.Position.Z = position_vect.z
-    bone.IsRealBone = is_real
-    return bone    
-    
-##################################################
-#RG - check to make sure face isnt a line
-#The face has to be triangle not a line
-def is_1d_face(blender_face,mesh):
-    #ID Vertex of id point
-    v0 = blender_face.vertices[0]
-    v1 = blender_face.vertices[1]
-    v2 = blender_face.vertices[2]
-    
-    return (mesh.vertices[v0].co == mesh.vertices[v1].co or \
-    mesh.vertices[v1].co == mesh.vertices[v2].co or \
-    mesh.vertices[v2].co == mesh.vertices[v0].co)
-    return False
+class VVertex(object):
 
-##################################################
-# 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
-def triangulateNMesh(object):
-    global bDeleteMergeMesh
-    bneedtri = False
-    scene = bpy.context.scene
-    bpy.ops.object.mode_set(mode='OBJECT')
-    for i in scene.objects: i.select = False #deselect all objects
-    object.select = True
-    scene.objects.active = object #set the mesh object to current
-    bpy.ops.object.mode_set(mode='OBJECT')
-    print("Checking mesh if needs to convert quad to Tri...")
-    for face in object.data.faces:
-        if (len(face.vertices) > 3):
-            bneedtri = True
-            break
-    
-    bpy.ops.object.mode_set(mode='OBJECT')
-    if bneedtri == True:
-        print("Converting quad to tri mesh...")
-        me_da = object.data.copy() #copy data
-        me_ob = object.copy() #copy object
-        #note two copy two types else it will use the current data or mesh
-        me_ob.data = me_da
-        bpy.context.scene.objects.link(me_ob)#link the object to the scene #current object location
-        for i in scene.objects: i.select = False #deselect all objects
-        me_ob.select = True
-        scene.objects.active = me_ob #set the mesh object to current
-        bpy.ops.object.mode_set(mode='EDIT') #Operators
-        bpy.ops.mesh.select_all(action='SELECT')#select all the face/vertex/edge
-        bpy.ops.mesh.quads_convert_to_tris() #Operators
-        bpy.context.scene.update()
-        bpy.ops.object.mode_set(mode='OBJECT') # set it in object
-        bpy.context.scene.unrealtriangulatebool = True
-        print("Triangulate Mesh Done!")
-        if bDeleteMergeMesh == True:
-            print("Remove Merge tmp Mesh [ " ,object.name, " ] from scene!" )
-            bpy.ops.object.mode_set(mode='OBJECT') # set it in object
-            bpy.context.scene.objects.unlink(object)
-    else:
-        bpy.context.scene.unrealtriangulatebool = False
-        print("No need to convert tri mesh.")
-        me_ob = object
-    return me_ob
-
-# Actual object parsing functions
-def parse_meshes(blender_meshes, psk_file):
-    #this is use to call the bone name and the index array for group index matches
-    global bDeleteMergeMesh
-    print ("----- parsing meshes -----")
-    print("Number of Object Meshes:",len(blender_meshes))
-    for current_obj in blender_meshes: #number of mesh that should be one mesh here
-        #bpy.ops.object.mode_set(mode='EDIT')
-        current_obj = triangulateNMesh(current_obj)
-        #print(dir(current_obj))
-        print("Mesh Name:",current_obj.name)
-        current_mesh = current_obj.data
-        
-        #collect a list of the material names
-        print("== MATERIAL EXPORT LIST & INDEX")
-        if len(current_obj.material_slots) > 0:
-            counter = 0
-            
-            while counter < len(current_obj.material_slots):
-                print("[MATERIAL IDX:",counter,"=]")
-                MaterialName.append(current_obj.material_slots[counter].name)
-                #print("Material Name:",current_obj.material_slots[counter].name)
-                #print("Material Name:",dir(current_obj.material_slots[counter].material))                
-                #print("TEXTURE:",dir(current_obj.material_slots[counter].material.texture_slots[0].texture.image.filepath))
-                #print("Imagepath:",(current_obj.material_slots[counter].material.texture_slots[0].texture.image.filepath))
-                #print("TEXTURES:",len(current_obj.material_slots[counter].material.texture_slots))
-                #while slot in current_obj.material_slots[counter].material.texture_slots:
-                    #print(dir(slot))
-                    #if slot.texture.image.filepath != None:
-                        #print("file path:",slot.texture.image.filepath)
-                if current_obj.material_slots[counter].material.texture_slots[0] != None:
-                    if current_obj.material_slots[counter].material.texture_slots[0].texture.image.filepath != None:
-                        print("TEXTURE PATH:",current_obj.material_slots[counter].material.texture_slots[0].texture.image.filepath)
-                #print("Imagepath:",(current_obj.material_slots[counter].material.texture_slots[0].texture.image.filepath_raw))
-                #print("Imagepath2:",dir(current_obj.material_slots[counter].material.texture_slots[0].texture.image))				
-                #create the current material
-                matdata = psk_file.GetMatByIndex(counter)
-                matdata.MaterialName = current_obj.material_slots[counter].name
-                matdata.TextureIndex = counter
-                matdata.AuxMaterial = counter
-                #print("materials: ",MaterialName[counter])
-                counter += 1
-                print("PSK INDEX:",matdata.TextureIndex)
-                print("=====")
-                print("")
-        #    object_mat = current_obj.materials[0]
-        object_material_index = current_obj.active_material_index
-    
-        points = ObjMap()
-        wedges = ObjMap()
-        
-        discarded_face_count = 0
-        print (" -- Dumping Mesh Faces -- LEN:", len(current_mesh.faces))
-        for current_face in current_mesh.faces:
-            #print ' -- Dumping UVs -- '
-            #print current_face.uv_textures
-            # modified by VendorX
-            object_material_index = current_face.material_index
-            
-            if len(current_face.vertices) != 3:
-                raise RuntimeError("Non-triangular face (%i)" % len(current_face.vertices))
-            
-            #No Triangulate Yet
-            #            if len(current_face.vertices) != 3:
-            #                raise RuntimeError("Non-triangular face (%i)" % len(current_face.vertices))
-            #                #TODO: add two fake faces made of triangles?
-            
-            #RG - apparently blender sometimes has problems when you do quad to triangle 
-            #    conversion, and ends up creating faces that have only TWO points -
-            #     one of the points is simply in the vertex list for the face twice. 
-            #    This is bad, since we can't get a real face normal for a LINE, we need 
-            #    a plane for this. So, before we add the face to the list of real faces, 
-            #    ensure that the face is actually a plane, and not a line. If it is not 
-            #    planar, just discard it and notify the user in the console after we're
-            #    done dumping the rest of the faces
-            
-            if not is_1d_face(current_face,current_mesh):
-                #print("faces")
-                wedge_list = []
-                vect_list = []
-                
-                #get or create the current material
-                psk_file.GetMatByIndex(object_material_index)
-
-                face_index = current_face.index
-                has_UV = False
-                faceUV = None
-                
-                if len(current_mesh.uv_textures) > 0:
-                    has_UV = True    
-                    #print("face index: ",face_index)
-                    #faceUV = current_mesh.uv_textures.active.data[face_index]#UVs for current face
-                    #faceUV = current_mesh.uv_textures.active.data[0]#UVs for current face
-                    #print(face_index,"<[FACE NUMBER")
-                    uv_layer = current_mesh.uv_textures.active
-                    faceUV = uv_layer.data[face_index]
-                    #print("============================")
-                    #size(data) is number of texture faces. Each face has UVs
-                    #print("DATA face uv: ",len(faceUV.uv), " >> ",(faceUV.uv[0][0]))
-                
-                for i in range(3):
-                    vert_index = current_face.vertices[i]
-                    vert = current_mesh.vertices[vert_index]
-                    uv = []
-                    #assumes 3 UVs Per face (for now).
-                    if (has_UV):
-                        if len(faceUV.uv) != 3:
-                            print ("WARNING: Current face is missing UV coordinates - writing 0,0...")
-                            print ("WARNING: Face has more than 3 UVs - writing 0,0...")
-                            uv = [0.0, 0.0]
-                        else:
-                            #uv.append(faceUV.uv[i][0])
-                            #uv.append(faceUV.uv[i][1])
-                            uv = [faceUV.uv[i][0],faceUV.uv[i][1]] #OR bottom works better # 24 for cube
-                            #uv = list(faceUV.uv[i]) #30 just cube    
-                    else:
-                        #print ("No UVs?")
-                        uv = [0.0, 0.0]
-                    #print("UV >",uv)
-                    #uv = [0.0, 0.0] #over ride uv that is not fixed
-                    #print(uv)
-                    #flip V coordinate because UEd requires it and DOESN'T flip it on its own like it
-                    #does with the mesh Y coordinates.
-                    #this is otherwise known as MAGIC-2
-                    uv[1] = 1.0 - uv[1]
-                    
-                    #deal with the min and max value
-                    #check if limit boolean
-                    #if value is over the set limit it will null the uv texture
-                    if bpy.context.scene.limituv:
-                        if (uv[0] > 1):
-                            uv[0] = 1
-                        if (uv[0] < 0):
-                            uv[0] = 0
-                        if (uv[1] > 1):
-                            uv[1] = 1
-                        if (uv[1] < 0):
-                            uv[1] = 0
-                        #print("limited on")
-                    #else:
-                        #print("limited off")
-                    
-                    # RE - Append untransformed vector (for normal calc below)
-                    # TODO: convert to Blender.Mathutils
-                    vect_list.append(FVector(vert.co.x, vert.co.y, vert.co.z))
-                    
-                    # Transform position for export
-                    #vpos = vert.co * object_material_index
-                    vpos = current_obj.matrix_local * vert.co
-                    # Create the point
-                    p = VPoint()
-                    p.Point.X = vpos.x
-                    p.Point.Y = vpos.y
-                    p.Point.Z = vpos.z
-                    
-                    # Create the wedge
-                    w = VVertex()
-                    w.MatIndex = object_material_index
-                    w.PointIndex = points.get(p) # get index from map
-                    #Set UV TEXTURE
-                    w.U = uv[0]
-                    w.V = uv[1]
-                    index_wedge = wedges.get(w)
-                    wedge_list.append(index_wedge)
-                    
-                    #print results
-                    #print 'result PointIndex=%i, U=%f, V=%f, wedge_index=%i' % (
-                    #    w.PointIndex,
-                    #    w.U,
-                    #    w.V,
-                    #    wedge_index)
-                
-                # Determine face vertex order
-                # get normal from blender
-                no = current_face.normal
-                
-                # TODO: convert to Blender.Mathutils
-                # convert to FVector
-                norm = FVector(no[0], no[1], no[2])
-                
-                # Calculate the normal of the face in blender order
-                tnorm = vect_list[1].sub(vect_list[0]).cross(vect_list[2].sub(vect_list[1]))
-                
-                # RE - dot the normal from blender order against the blender normal
-                # this gives the product of the two vectors' lengths along the blender normal axis
-                # all that matters is the sign
-                dot = norm.dot(tnorm)
-
-                # print results
-                #print 'face norm: (%f,%f,%f), tnorm=(%f,%f,%f), dot=%f' % (
-                #    norm.X, norm.Y, norm.Z,
-                #    tnorm.X, tnorm.Y, tnorm.Z,
-                #    dot)
-
-                tri = VTriangle()
-                # RE - magic: if the dot product above > 0, order the vertices 2, 1, 0
-                #        if the dot product above < 0, order the vertices 0, 1, 2
-                #        if the dot product is 0, then blender's normal is coplanar with the face
-                #        and we cannot deduce which side of the face is the outside of the mesh
-                if (dot > 0):
-                    (tri.WedgeIndex2, tri.WedgeIndex1, tri.WedgeIndex0) = wedge_list
-                elif (dot < 0):
-                    (tri.WedgeIndex0, tri.WedgeIndex1, tri.WedgeIndex2) = wedge_list
-                else:
-                    dindex0 = current_face.vertices[0];
-                    dindex1 = current_face.vertices[1];
-                    dindex2 = current_face.vertices[2];
-
-                    current_mesh.vertices[dindex0].select = True
-                    current_mesh.vertices[dindex1].select = True
-                    current_mesh.vertices[dindex2].select = True
-                    
-                    raise RuntimeError("normal vector coplanar with face! points:", current_mesh.vertices[dindex0].co, current_mesh.vertices[dindex1].co, current_mesh.vertices[dindex2].co)
-                #print(dir(current_face))
-                current_face.select = True
-                #print("smooth:",(current_face.use_smooth))
-                #not sure if this right
-                #tri.SmoothingGroups
-                if current_face.use_smooth == True:
-                    tri.SmoothingGroups = 1
-                else:
-                    tri.SmoothingGroups = 0
-                #tri.SmoothingGroups = 1
-                tri.MatIndex = object_material_index
-                #print(tri)
-                psk_file.AddFace(tri)                
-            else:
-                discarded_face_count = discarded_face_count + 1
-                
-        print (" -- Dumping Mesh Points -- LEN:",len(points.dict))
-        for point in points.items():
-            psk_file.AddPoint(point)
-        if len(points.dict) > 32767:
-            raise RuntimeError("Vertex point reach max limited 32767 in pack data. Your",len(points.dict))
-        print (" -- Dumping Mesh Wedge -- LEN:",len(wedges.dict))
-        
-        for wedge in wedges.items():
-            psk_file.AddWedge(wedge)
-            
-        #RG - if we happend upon any non-planar faces above that we've discarded, 
-        #    just let the user know we discarded them here in case they want 
-        #    to investigate
-    
-        if discarded_face_count > 0: 
-            print ("INFO: Discarded %i non-planar faces." % (discarded_face_count))
-        
-        #RG - walk through the vertex groups and find the indexes into the PSK points array 
-        #for them, then store that index and the weight as a tuple in a new list of 
-        #verts for the group that we can look up later by bone name, since Blender matches
-        #verts to bones for influences by having the VertexGroup named the same thing as
-        #the bone
-
-        #vertex group
-        for obvgroup in current_obj.vertex_groups:
-            #print("bone gourp build:",obvgroup.name)#print bone name
-            #print(dir(obvgroup))
-            vert_list = []
-            for current_vert in current_mesh.vertices:
-                #print("INDEX V:",current_vert.index)
-                vert_index = current_vert.index
-                for vgroup in current_vert.groups:#vertex groupd id
-                    vert_weight = vgroup.weight
-                    if(obvgroup.index == vgroup.group):
-                        p = VPoint()
-                        vpos = current_obj.matrix_local * current_vert.co
-                        p.Point.X = vpos.x
-                        p.Point.Y = vpos.y 
-                        p.Point.Z = vpos.z
-                        #print(current_vert.co)
-                        point_index = points.get(p) #point index
-                        v_item = (point_index, vert_weight)
-                        vert_list.append(v_item)
-            #bone name, [point id and wieght]
-            #print("Add Vertex Group:",obvgroup.name, " No. Points:",len(vert_list))
-            psk_file.VertexGroups[obvgroup.name] = vert_list
-        
-        #unrealtriangulatebool #this will remove the mesh from the scene
-        '''
-        if (bpy.context.scene.unrealtriangulatebool == True) and (bDeleteMergeMesh == True):
-            #if bDeleteMergeMesh == True:
-            #    print("Removing merge mesh.")
-            print("Remove tmp Mesh [ " ,current_obj.name, " ] from scene >"  ,(bpy.context.scene.unrealtriangulatebool ))
-            bpy.ops.object.mode_set(mode='OBJECT') # set it in object
-            bpy.context.scene.objects.unlink(current_obj)
-        el
-        '''
-        if bDeleteMergeMesh == True:
-            print("Remove Merge tmp Mesh [ " ,current_obj.name, " ] from scene >"  ,(bpy.context.scene.unrealtriangulatebool ))
-            bpy.ops.object.mode_set(mode='OBJECT') # set it in object
-            bpy.context.scene.objects.unlink(current_obj)
-        elif bpy.context.scene.unrealtriangulatebool == True:
-            print("Remove tri tmp Mesh [ " ,current_obj.name, " ] from scene >"  ,(bpy.context.scene.unrealtriangulatebool ))
-            bpy.ops.object.mode_set(mode='OBJECT') # set it in object
-            bpy.context.scene.objects.unlink(current_obj)
-        #if bDeleteMergeMesh == True:
-            #print("Remove merge Mesh [ " ,current_obj.name, " ] from scene")
-            #bpy.ops.object.mode_set(mode='OBJECT') # set it in object
-            #bpy.context.scene.objects.unlink(current_obj)
-        
-def make_fquat(bquat):
-    quat = FQuat()
-    #flip handedness for UT = set x,y,z to negative (rotate in other direction)
-    quat.X = -bquat.x
-    quat.Y = -bquat.y
-    quat.Z = -bquat.z
-
-    quat.W = bquat.w
-    return quat
-    
-def make_fquat_default(bquat):
-    quat = FQuat()
-    #print(dir(bquat))
-    quat.X = bquat.x
-    quat.Y = bquat.y
-    quat.Z = bquat.z
-    
-    quat.W = bquat.w
-    return quat
+	def __init__(self):
+		self.PointIndex		= 0		# WORD
+		self.U				= 0.0
+		self.V				= 0.0
+		self.MatIndex		= 0		# BYTE
+		self.Reserved		= 0		# BYTE
+		self.SmoothGroup	= 0 
+		
+	def dump(self):
+		return pack('HHffBBH', self.PointIndex, 0, self.U, self.V, self.MatIndex, self.Reserved, 0)
+		
+	def __cmp__(self, other):
+		return cmp(self.PointIndex, other.PointIndex) \
+			or cmp(self.U, other.U) \
+			or cmp(self.V, other.V) \
+			or cmp(self.MatIndex, other.MatIndex) \
+			or cmp(self.Reserved, other.Reserved) \
+			or cmp(self.SmoothGroup, other.SmoothGroup ) 
+	
+	def _key(self):
+		return (type(self).__name__, self.PointIndex, self.U, self.V, self.MatIndex, self.Reserved)
+		
+	def __hash__(self):
+		return hash(self._key())
+		
+	def __eq__(self, other):
+		if not hasattr(other, '_key'):
+			return False
+		return self._key() == other._key()
 
-def parse_bone(blender_bone, psk_file, psa_file, parent_id, is_root_bone, parent_matrix, parent_root):
-    global nbone     # look it's evil!
-    #print '-------------------- Dumping Bone ---------------------- '
 
-    #If bone does not have parent that mean it the root bone
-    if blender_bone.parent is None:
-        parent_root = blender_bone
-    
-    child_count = len(blender_bone.children)
-    #child of parent
-    child_parent = blender_bone.parent
-    
-    if child_parent != None:
-        print ("--Bone Name:",blender_bone.name ," parent:" , blender_bone.parent.name, "ID:", nbone)
-    else:
-        print ("--Bone Name:",blender_bone.name ," parent: None" , "ID:", nbone)
-    
-    if child_parent != None:
-        quat_root = blender_bone.matrix
-        quat = make_fquat(quat_root.to_quaternion())
-        #print("DIR:",dir(child_parent.matrix.to_quaternion()))
-        quat_parent = child_parent.matrix.to_quaternion().inverted()
-        parent_head = quat_parent * child_parent.head
-        parent_tail = quat_parent * child_parent.tail
-        
-        set_position = (parent_tail - parent_head) + blender_bone.head
-    else:
-        # ROOT BONE
-        #This for root 
-        set_position = parent_matrix * blender_bone.head #ARMATURE OBJECT Locction
-        rot_mat = blender_bone.matrix * parent_matrix.to_3x3() #ARMATURE OBJECT Rotation
-        #print(dir(rot_mat))
-        
-        quat = make_fquat_default(rot_mat.to_quaternion())
-        
-    #print ("[[======= FINAL POSITION:", set_position)
-    final_parent_id = parent_id
-    
-    #RG/RE -
-    #if we are not separated by a small distance, create a dummy bone for the displacement
-    #this is only needed for root bones, since UT assumes a connected skeleton, and from here
-    #down the chain we just use "tail" as an endpoint
-    #if(head.length > 0.001 and is_root_bone == 1):
-    if(0):    
-        pb = make_vbone("dummy_" + blender_bone.name, parent_id, 1, FQuat(), tail)
-        psk_file.AddBone(pb)
-        pbb = make_namedbonebinary("dummy_" + blender_bone.name, parent_id, 1, FQuat(), tail, 0)
-        psa_file.StoreBone(pbb)
-        final_parent_id = nbone
-        nbone = nbone + 1
-        #tail = tail-head
-        
-    my_id = nbone
-    
-    pb = make_vbone(blender_bone.name, final_parent_id, child_count, quat, set_position)
-    psk_file.AddBone(pb)
-    pbb = make_namedbonebinary(blender_bone.name, final_parent_id, child_count, quat, set_position, 1)
-    psa_file.StoreBone(pbb)
+class VPointSimple:
 
-    nbone = nbone + 1
-    
-    #RG - dump influences for this bone - use the data we collected in the mesh dump phase
-    # to map our bones to vertex groups
-    #print("///////////////////////")
-    #print("set influence")
-    if blender_bone.name in psk_file.VertexGroups:
-        vertex_list = psk_file.VertexGroups[blender_bone.name]
-        #print("vertex list:", len(vertex_list), " of >" ,blender_bone.name )
-        for vertex_data in vertex_list:
-            #print("set influence vettex")
-            point_index = vertex_data[0]
-            vertex_weight = vertex_data[1]
-            influence = VRawBoneInfluence()
-            influence.Weight = vertex_weight
-            influence.BoneIndex = my_id
-            influence.PointIndex = point_index
-            #print ('Adding Bone Influence for [%s] = Point Index=%i, Weight=%f' % (blender_bone.name, point_index, vertex_weight))
-            #print("adding influence")
-            psk_file.AddInfluence(influence)
-    
-    #blender_bone.matrix_local
-    #recursively dump child bones
-    mainparent = parent_matrix
-    #if len(blender_bone.children) > 0:
-    for current_child_bone in blender_bone.children:
-        parse_bone(current_child_bone, psk_file, psa_file, my_id, 0, mainparent, parent_root)
-
-def parse_armature(blender_armature, psk_file, psa_file):
-    print ("----- parsing armature -----")
-    print ('blender_armature length: %i' % (len(blender_armature)))
-    
-    #magic 0 sized root bone for UT - this is where all armature dummy bones will attach
-    #dont increment nbone here because we initialize it to 1 (hackity hackity hack)
-
-    #count top level bones first. NOT EFFICIENT.
-    child_count = 0
-    for current_obj in blender_armature: 
-        current_armature = current_obj.data
-        bones = [x for x in current_armature.bones if not x.parent is None]
-        child_count += len(bones)
-
-    for current_obj in blender_armature:
-        print ("Current Armature Name: " + current_obj.name)
-        current_armature = current_obj.data
-        #armature_id = make_armature_bone(current_obj, psk_file, psa_file)
-        
-        #we dont want children here - only the top level bones of the armature itself
-        #we will recursively dump the child bones as we dump these bones
-        """
-        bones = [x for x in current_armature.bones if not x.parent is None]
-        #will ingore this part of the ocde
-        """
-        if len(current_armature.bones) == 0:
-            raise RuntimeError("Warning add two bones else it will crash the unreal editor.")
-        if len(current_armature.bones) == 1:
-            raise RuntimeError("Warning add one more bone else it will crash the unreal editor.")
-
-        mainbonecount = 0;
-        for current_bone in current_armature.bones: #list the bone. #note this will list all the bones.
-            if(current_bone.parent is None):
-                mainbonecount += 1
-        print("Main Bone",mainbonecount)
-        if mainbonecount > 1:
-            #print("Warning there no main bone.")
-            raise RuntimeError("There too many Main bones. Number main bones:",mainbonecount)
-        for current_bone in current_armature.bones: #list the bone. #note this will list all the bones.
-            if(current_bone.parent is None):
-                parse_bone(current_bone, psk_file, psa_file, 0, 0, current_obj.matrix_local, None)
-                break
-
-# get blender objects by type        
-def get_blender_objects(objects, intype):
-    return [x for x in objects if x.type == intype]
-            
-#strips current extension (if any) from filename and replaces it with extension passed in
-def make_filename_ext(filename, extension):
-    new_filename = ''
-    extension_index = filename.find('.')
-    
-    if extension_index == -1:
-        new_filename = filename + extension
-    else:
-        new_filename = filename[0:extension_index] + extension
-        
-    return new_filename
-
-# returns the quaternion Grassman product a*b
-# this is the same as the rotation a(b(x)) 
-# (ie. the same as B*A if A and B are matrices representing 
-# the rotations described by quaternions a and b)
-def grassman(a, b):    
-    return mathutils.Quaternion(
-        a.w*b.w - a.x*b.x - a.y*b.y - a.z*b.z,
-        a.w*b.x + a.x*b.w + a.y*b.z - a.z*b.y,
-        a.w*b.y - a.x*b.z + a.y*b.w + a.z*b.x,
-        a.w*b.z + a.x*b.y - a.y*b.x + a.z*b.w)
-        
-def parse_animation(blender_scene, blender_armatures, psa_file):
-    #to do list:
-    #need to list the action sets
-    #need to check if there animation
-    #need to check if animation is has one frame then exit it
-    print ('\n----- parsing animation -----')
-    render_data = blender_scene.render
-    bHaveAction = True
-    
-    anim_rate = render_data.fps
-    
-    print("==== Blender Settings ====")
+	def __init__(self):
+		self.Point = FVector()
 
-    print ('Scene: %s Start Frame: %i, End Frame: %i' % (blender_scene.name, blender_scene.frame_start, blender_scene.frame_end))
-    print ('Frames Per Sec: %i' % anim_rate)
-    print ("Default FPS: 24" )
-    
-    cur_frame_index = 0
-    if (bpy.context.scene.UEActionSetSettings == '1') or (bpy.context.scene.UEActionSetSettings == '2'):
-        print("Action Set(s) Settings Idx:",bpy.context.scene.UEActionSetSettings)
-        print("[==== Action list ====]")
-        
-        print("Number of Action set(s):",len(bpy.data.actions))
-        
-        for action in bpy.data.actions:#current number action sets
-            print("+Action Name:",action.name)
-            print("Group Count:",len(action.groups))
-            #print("Groups:")
-            #for bone in action.groups:
-                #print("> Name: ",bone.name)
-                #print(dir(bone))
-
-        amatureobject = None #this is the armature set to none
-        bonenames = [] #bone name of the armature bones list
-        
-        for arm in blender_armatures:
-            amatureobject = arm
-        #print(dir(amatureobject))
-        collection = amatureobject.myCollectionUEA #collection of the object
-        print("\n[==== Armature Object ====]")
-        if amatureobject != None:
-            print("+Name:",amatureobject.name)
-            print("+Number of bones:", len(amatureobject.pose.bones),"\n")
-            for bone in amatureobject.pose.bones:
-                bonenames.append(bone.name)
-        
-        for ActionNLA in bpy.data.actions:
-            FoundAction = True
-            if bpy.context.scene.UEActionSetSettings == '2':                
-                for c in collection:
-                    if c.name == ActionNLA.name:
-                        if c.mybool == True:
-                            FoundAction = True
-                        else:
-                            FoundAction = False
-                        break
-                if FoundAction == False:
-                    print("========================================")
-                    print("Skipping Action Set!",ActionNLA.name)
-                    print("Action Group Count:", len(ActionNLA.groups))
-                    print("Bone Group Count:", len(amatureobject.pose.bones))
-                    print("========================================")
-                    #break
-            
-            nobone = 0
-            nomatchbone = 0
-			
-            baction = True
-            #print("\nChecking actions matching groups with bone names...")
-            #Check if the bone names matches the action groups names
-            print("=================================")
-            print("=================================")
-            for abone in bonenames:         
-                #print("bone name:",abone)
-                bfound = False
-                for group in ActionNLA.groups:
-                    #print("name:>>",abone)
-                    if abone == group.name:
-                        nobone += 1
-                        bfound = True
-                        break
-                if bfound == False:
-                    #print("Not Found!:",abone)
-                    nomatchbone += 1
-                #else:
-                    #print("Found!:",abone)
-            
-            print("Armature Bones Count:",nobone , " Action Groups Counts:",len(ActionNLA.groups)," Left Out Count:",nomatchbone)
-            #if the bones are less some missing bones that were added to the action group names than export this
-            if (nobone <= len(ActionNLA.groups)) and (bpy.context.scene.unrealignoreactionmatchcount == True) :
-                #print("Action Set match: Pass")
-                print("Ingore Action groups Count from Armature bones.")
-                baction = True
-            #if action groups matches the bones length and names matching the gourps do something
-            elif ((len(ActionNLA.groups) == len(bonenames)) and (nobone == len(ActionNLA.groups))):
-                #print("Action Set match: Pass")
-                baction = True
-            else:
-                print("Action Set match: Fail")
-                #print("Action Name:",ActionNLA.name)
-                baction = False
-            
-            if (baction == True) and (FoundAction == True):
-                arm = amatureobject #set armature object
-                if not arm.animation_data:
-                    print("======================================")
-                    print("Check Animation Data: None")
-                    print("Armature has no animation, skipping...")
-                    print("======================================")
-                    break
-                    
-                if not arm.animation_data.action:
-                    print("======================================")
-                    print("Check Action: None")
-                    print("Armature has no animation, skipping...")
-                    print("======================================")
-                    break
-                #print("Last Action Name:",arm.animation_data.action.name)
-                arm.animation_data.action = ActionNLA
-                #print("Set Action Name:",arm.animation_data.action.name)
-                bpy.context.scene.update()
-                act = arm.animation_data.action
-                action_name = act.name
-                
-                if not len(act.fcurves):
-                    print("//===========================================================")
-                    print("// None bone pose set keys for this action set... skipping...")
-                    print("//===========================================================")
-                    bHaveAction = False
-                    
-                #this deal with action export control
-                if bHaveAction == True:
-                    #print("------------------------------------")
-                    print("[==== Action Set ====]")
-                    print("Action Name:",action_name)
-
-                    #look for min and max frame that current set keys
-                    framemin, framemax = act.frame_range
-                    #print("max frame:",framemax)
-                    start_frame = int(framemin)
-                    end_frame = int(framemax)
-                    scene_frames = range(start_frame, end_frame+1)
-                    frame_count = len(scene_frames)
-                    #===================================================
-                    anim = AnimInfoBinary()
-                    anim.Name = action_name
-                    anim.Group = "" #what is group?
-                    anim.NumRawFrames = frame_count
-                    anim.AnimRate = anim_rate
-                    anim.FirstRawFrame = cur_frame_index
-                    #===================================================
-                    # count_previous_keys = len(psa_file.RawKeys.Data)  # UNUSED
-                    print("Frame Key Set Count:",frame_count, "Total Frame:",frame_count)
-                    #print("init action bones...")
-                    unique_bone_indexes = {}
-                    # bone lookup table
-                    bones_lookup =  {}
-                
-                    #build bone node for animation keys needed to be set
-                    for bone in arm.data.bones:
-                        bones_lookup[bone.name] = bone
-                    #print("bone name:",bone.name)
-                    frame_count = len(scene_frames)
-                    #print ('Frame Count: %i' % frame_count)
-                    pose_data = arm.pose
-                
-                    #these must be ordered in the order the bones will show up in the PSA file!
-                    ordered_bones = {}
-                    ordered_bones = sorted([(psa_file.UseBone(x.name), x) for x in pose_data.bones], key=operator.itemgetter(0))
-                    
-                    #############################
-                    # ORDERED FRAME, BONE
-                    #for frame in scene_frames:
-                    
-                    for i in range(frame_count):
-                        frame = scene_frames[i]
-                        #LOUD
-                        #print ("==== outputting frame %i ===" % frame)
-                        
-                        if frame_count > i+1:
-                            next_frame = scene_frames[i+1]
-                            #print "This Frame: %i, Next Frame: %i" % (frame, next_frame)
-                        else:
-                            next_frame = -1
-                            #print "This Frame: %i, Next Frame: NONE" % frame
-                        
-                        #frame start from 1 as number one from blender
-                        blender_scene.frame_set(frame)
-                        
-                        cur_frame_index = cur_frame_index + 1
-                        for bone_data in ordered_bones:
-                            bone_index = bone_data[0]
-                            pose_bone = bone_data[1]
-                            #print("[=====POSE NAME:",pose_bone.name)
-                            
-                            #print("LENG >>.",len(bones_lookup))
-                            # blender_bone = bones_lookup[pose_bone.name]  # UNUSED
-                            
-                            #just need the total unique bones used, later for this AnimInfoBinary
-                            unique_bone_indexes[bone_index] = bone_index
-                            #LOUD
-                            #print ("-------------------", pose_bone.name)
-                            head = pose_bone.head
-                            
-                            posebonemat = mathutils.Matrix(pose_bone.matrix)
-                            #print(dir(posebonemat))
-
-                            #print("quat",posebonemat)
-                            #
-                            # Error looop action get None in matrix
-                            # looping on each armature give invert and normalize for None
-                            #
-                            parent_pose = pose_bone.parent
-                            
-                            if parent_pose != None:
-                                parentposemat = mathutils.Matrix(parent_pose.matrix)
-                                posebonemat = parentposemat.inverted() * posebonemat
-                                    
-                            head = posebonemat.to_translation()
-                            quat = posebonemat.to_quaternion().normalized()
-
-                            vkey = VQuatAnimKey()
-                            vkey.Position.X = head.x
-                            vkey.Position.Y = head.y
-                            vkey.Position.Z = head.z
-                            
-                            if parent_pose != None:
-                                quat = make_fquat(quat)
-                            else:
-                                quat = make_fquat_default(quat)
-                            
-                            vkey.Orientation = quat
-                            #print("Head:",head)
-                            #print("Orientation",quat)
-                            
-                            #time from now till next frame = diff / framesPerSec
-                            if next_frame >= 0:
-                                diff = next_frame - frame
-                            else:
-                                diff = 1.0
-                            
-                            #print ("Diff = ", diff)
-                            vkey.Time = float(diff)/float(anim_rate)
-                            psa_file.AddRawKey(vkey)
-                            
-                    #done looping frames
-                    #done looping armatures
-                    #continue adding animInfoBinary counts here
-                
-                anim.TotalBones = len(unique_bone_indexes)
-                print("Bones Count:",anim.TotalBones)
-                anim.TrackTime = float(frame_count) / anim.AnimRate
-                print("Time Track Frame:",anim.TrackTime)
-                psa_file.AddAnimation(anim)
-                print("------------------------------------\n")
-            else:
-                print("[==== Action Set ====]")
-                print("Action Name:",ActionNLA.name)
-                print("Action Group Count:", len(ActionNLA.groups))
-                print("Bone Group Count:", len(amatureobject.pose.bones))
-                print("Action set Skip!")
-                print("------------------------------------\n")
-        print("==== Finish Action Build(s) ====")
-    else:
-        print("[==== Action Set Single Export====]")
-        #list of armature objects
-        for arm in blender_armatures:
-            #check if there animation data from armature or something
-            
-            if not arm.animation_data:
-                print("======================================")
-                print("Check Animation Data: None")
-                print("Armature has no animation, skipping...")
-                print("======================================")
-                break
-                
-            if not arm.animation_data.action:
-                print("======================================")
-                print("Check Action: None")
-                print("Armature has no animation, skipping...")
-                print("======================================")
-                break
-            act = arm.animation_data.action
-            #print(dir(act))
-            action_name = act.name
-            
-            if not len(act.fcurves):
-                print("//===========================================================")
-                print("// None bone pose set keys for this action set... skipping...")
-                print("//===========================================================")
-                bHaveAction = False
-                
-            #this deal with action export control
-            if bHaveAction == True:
-                print("---- Action Start ----")
-                print("Action Name:",action_name)
-                #look for min and max frame that current set keys
-                framemin, framemax = act.frame_range
-                #print("max frame:",framemax)
-                start_frame = int(framemin)
-                end_frame = int(framemax)
-                scene_frames = range(start_frame, end_frame+1)
-                frame_count = len(scene_frames)
-                #===================================================
-                anim = AnimInfoBinary()
-                anim.Name = action_name
-                anim.Group = "" #what is group?
-                anim.NumRawFrames = frame_count
-                anim.AnimRate = anim_rate
-                anim.FirstRawFrame = cur_frame_index
-                #===================================================
-                # count_previous_keys = len(psa_file.RawKeys.Data)  # UNUSED
-                print("Frame Key Set Count:",frame_count, "Total Frame:",frame_count)
-                #print("init action bones...")
-                unique_bone_indexes = {}
-                # bone lookup table
-                bones_lookup =  {}
-            
-                #build bone node for animation keys needed to be set
-                for bone in arm.data.bones:
-                    bones_lookup[bone.name] = bone
-                #print("bone name:",bone.name)
-                frame_count = len(scene_frames)
-                #print ('Frame Count: %i' % frame_count)
-                pose_data = arm.pose
-            
-                #these must be ordered in the order the bones will show up in the PSA file!
-                ordered_bones = {}
-                ordered_bones = sorted([(psa_file.UseBone(x.name), x) for x in pose_data.bones], key=operator.itemgetter(0))
-                
-                #############################
-                # ORDERED FRAME, BONE
-                #for frame in scene_frames:
-                
-                for i in range(frame_count):
-                    frame = scene_frames[i]
-                    #LOUD
-                    #print ("==== outputting frame %i ===" % frame)
-                    
-                    if frame_count > i+1:
-                        next_frame = scene_frames[i+1]
-                        #print "This Frame: %i, Next Frame: %i" % (frame, next_frame)
-                    else:
-                        next_frame = -1
-                        #print "This Frame: %i, Next Frame: NONE" % frame
-                    
-                    #frame start from 1 as number one from blender
-                    blender_scene.frame_set(frame)
-                    
-                    cur_frame_index = cur_frame_index + 1
-                    for bone_data in ordered_bones:
-                        bone_index = bone_data[0]
-                        pose_bone = bone_data[1]
-                        #print("[=====POSE NAME:",pose_bone.name)
-                        
-                        #print("LENG >>.",len(bones_lookup))
-                        # blender_bone = bones_lookup[pose_bone.name]  # UNUSED
-                        
-                        #just need the total unique bones used, later for this AnimInfoBinary
-                        unique_bone_indexes[bone_index] = bone_index
-                        #LOUD
-                        #print ("-------------------", pose_bone.name)
-                        head = pose_bone.head
-                        
-                        posebonemat = mathutils.Matrix(pose_bone.matrix)
-                        parent_pose = pose_bone.parent
-                        if parent_pose != None:
-                            parentposemat = mathutils.Matrix(parent_pose.matrix)
-                            #blender 2.4X it been flip around with new 2.50 (mat1 * mat2) should now be (mat2 * mat1)
-                            posebonemat = parentposemat.inverted() * posebonemat
-                        head = posebonemat.to_translation()
-                        quat = posebonemat.to_quaternion().normalized()
-                        vkey = VQuatAnimKey()
-                        vkey.Position.X = head.x
-                        vkey.Position.Y = head.y
-                        vkey.Position.Z = head.z
-                        #print("quat:",quat)
-                        if parent_pose != None:
-                            quat = make_fquat(quat)
-                        else:
-                            quat = make_fquat_default(quat)
-                        
-                        vkey.Orientation = quat
-                        #print("Head:",head)
-                        #print("Orientation",quat)
-                        
-                        #time from now till next frame = diff / framesPerSec
-                        if next_frame >= 0:
-                            diff = next_frame - frame
-                        else:
-                            diff = 1.0
-                        
-                        #print ("Diff = ", diff)
-                        vkey.Time = float(diff)/float(anim_rate)
-                        psa_file.AddRawKey(vkey)
-                        
-                #done looping frames
-                #done looping armatures
-                #continue adding animInfoBinary counts here
-            
-                anim.TotalBones = len(unique_bone_indexes)
-                print("Bones Count:",anim.TotalBones)
-                anim.TrackTime = float(frame_count) / anim.AnimRate
-                print("Time Track Frame:",anim.TrackTime)
-                psa_file.AddAnimation(anim)
-                print("---- Action End ----")
-                print("==== Finish Action Build ====")
-    
-def meshmerge(selectedobjects):
-    bpy.ops.object.mode_set(mode='OBJECT')
-    cloneobjects = []
-    if len(selectedobjects) > 1:
-        print("selectedobjects:",len(selectedobjects))
-        count = 0 #reset count
-        for count in range(len( selectedobjects)):
-            #print("Index:",count)
-            if selectedobjects[count] != None:
-                me_da = selectedobjects[count].data.copy() #copy data
-                me_ob = selectedobjects[count].copy() #copy object
-                #note two copy two types else it will use the current data or mesh
-                me_ob.data = me_da
-                bpy.context.scene.objects.link(me_ob)#link the object to the scene #current object location
-                print("Index:",count,"clone object",me_ob.name)
-                cloneobjects.append(me_ob)
-        #bpy.ops.object.mode_set(mode='OBJECT')
-        for i in bpy.data.objects: i.select = False #deselect all objects
-        count = 0 #reset count
-        #bpy.ops.object.mode_set(mode='OBJECT')
-        for count in range(len( cloneobjects)):
-            if count == 0:
-                bpy.context.scene.objects.active = cloneobjects[count]
-                print("Set Active Object:",cloneobjects[count].name)
-            cloneobjects[count].select = True
-        bpy.ops.object.join()
-        return cloneobjects[0]
-        
-def fs_callback(filename, context):
-    #this deal with repeat export and the reset settings
-    global nbone, exportmessage, bDeleteMergeMesh
-    nbone = 0
-    
-    start_time = time.clock()
-    
-    print ("========EXPORTING TO UNREAL SKELETAL MESH FORMATS========\r\n")
-    print("Blender Version:", bpy.app.version[1],"-")
-    
-    psk = PSKFile()
-    psa = PSAFile()
-    
-    #sanity check - this should already have the extension, but just in case, we'll give it one if it doesn't
-    psk_filename = make_filename_ext(filename, '.psk')
-    
-    #make the psa filename
-    psa_filename = make_filename_ext(filename, '.psa')
-    
-    print ('PSK File: ' +  psk_filename)
-    print ('PSA File: ' +  psa_filename)
-    
-    barmature = True
-    bmesh = True
-    blender_meshes = []
-    blender_armature = []
-    selectmesh = []
-    selectarmature = []
-    
-    current_scene = context.scene
-    cur_frame = current_scene.frame_current #store current frame before we start walking them during animation parse
-    objects = current_scene.objects
-    
-    print("Checking object count...")
-    for next_obj in objects:
-        if next_obj.type == 'MESH':
-            blender_meshes.append(next_obj)
-            if (next_obj.select):
-                #print("mesh object select")
-                selectmesh.append(next_obj)
-        if next_obj.type == 'ARMATURE':
-            blender_armature.append(next_obj)
-            if (next_obj.select):
-                #print("armature object select")
-                selectarmature.append(next_obj)
-    
-    print("Mesh Count:",len(blender_meshes)," Armature Count:",len(blender_armature))
-    print("====================================")
-    print("Checking Mesh Condtion(s):")
-    #if there 1 mesh in scene add to the array
-    if len(blender_meshes) == 1:
-        print(" - One Mesh Scene")
-    #if there more than one mesh and one mesh select add to array
-    elif (len(blender_meshes) > 1) and (len(selectmesh) == 1):
-        blender_meshes = []
-        blender_meshes.append(selectmesh[0])
-        print(" - One Mesh [Select]")
-    elif (len(blender_meshes) > 1) and (len(selectmesh) >= 1):
-        #code build check for merge mesh before ops
-        print("More than one mesh is selected!")
-        centermesh = []
-        notcentermesh = []
-        countm = 0
-        for countm in range(len(selectmesh)):
-            #selectmesh[]
-            if selectmesh[countm].location.x == 0 and selectmesh[countm].location.y == 0 and selectmesh[countm].location.z == 0:
-                centermesh.append(selectmesh[countm])
-            else:
-                notcentermesh.append(selectmesh[countm])
-        if len(centermesh) > 0:
-            print("Center Object Found!")
-            blender_meshes = []
-            selectmesh = []
-            countm = 0
-            for countm in range(len(centermesh)):
-                selectmesh.append(centermesh[countm])
-            for countm in range(len(notcentermesh)):
-                selectmesh.append(notcentermesh[countm])
-            blender_meshes.append(meshmerge(selectmesh))
-            bDeleteMergeMesh = True
-        else:
-            bDeleteMergeMesh = False
-            bmesh = False
-            print("Center Object Not Found")
-    else:
-        print(" - Too Many Meshes!")
-        print(" - Select One Mesh Object!")
-        bmesh = False
-        bDeleteMergeMesh = False
-		
-    print("====================================")
-    print("Checking Armature Condtion(s):")
-    if len(blender_armature) == 1:
-        print(" - One Armature Scene")
-    elif (len(blender_armature) > 1) and (len(selectarmature) == 1):
-        print(" - One Armature [Select]")
-    else:
-        print(" - Too Armature Meshes!")
-        print(" - Select One Armature Object Only!")
-        barmature = False
-    bMeshScale = True
-    bMeshCenter = True
-    if len(blender_meshes) > 0:
-        if blender_meshes[0].scale.x == 1 and blender_meshes[0].scale.y == 1 and blender_meshes[0].scale.z == 1:
-            #print("Okay")
-            bMeshScale = True
-        else:
-            print("Error, Mesh Object not scale right should be (1,1,1).")
-            bMeshScale = False
-        if blender_meshes[0].location.x == 0 and blender_meshes[0].location.y == 0 and blender_meshes[0].location.z == 0:
-            #print("Okay")
-            bMeshCenter = True
-        else:
-            print("Error, Mesh Object not center.",blender_meshes[0].location)
-            bMeshCenter = False
-    else:
-        bmesh = False
-    bArmatureScale = True
-    bArmatureCenter = True
-    if blender_armature and blender_armature[0] is not None:
-        if blender_armature[0].scale.x == 1 and blender_armature[0].scale.y == 1 and blender_armature[0].scale.z == 1:
-            #print("Okay")
-            bArmatureScale = True
-        else:
-            print("Error, Armature Object not scale right should be (1,1,1).")
-            bArmatureScale = False
-        if blender_armature[0].location.x == 0 and blender_armature[0].location.y == 0 and blender_armature[0].location.z == 0:
-            #print("Okay")
-            bArmatureCenter = True
-        else:
-            print("Error, Armature Object not center.",blender_armature[0].location)
-            bArmatureCenter = False
-			
+	def __cmp__(self, other):
+		return cmp(self.Point, other.Point)
 		
-			
-    #print("location:",blender_armature[0].location.x)
-    
-    if (bmesh == False) or (barmature == False) or (bArmatureCenter == False) or (bArmatureScale == False)or (bMeshScale == False) or (bMeshCenter == False):
-        exportmessage = "Export Fail! Check Log."
-        print("=================================")
-        print("= Export Fail!                  =")
-        print("=================================")
-    else:
-        exportmessage = "Export Finish!"
-        #print("blender_armature:",dir(blender_armature[0]))
-        #print(blender_armature[0].scale)
+	def __hash__(self):
+		return hash(self._key())
 
-        try:
-            #######################
-            # STEP 1: MESH DUMP
-            # we build the vertexes, wedges, and faces in here, as well as a vertexgroup lookup table
-            # for the armature parse
-            print("//===============================")
-            print("// STEP 1")
-            print("//===============================")
-            parse_meshes(blender_meshes, psk)
-        except:
-            context.scene.frame_set(cur_frame) #set frame back to original frame
-            print ("Exception during Mesh Parse")
-            raise
-        
-        try:
-            #######################
-            # STEP 2: ARMATURE DUMP
-            # IMPORTANT: do this AFTER parsing meshes - we need to use the vertex group data from 
-            # the mesh parse in here to generate bone influences
-            print("//===============================")
-            print("// STEP 2")
-            print("//===============================")
-            parse_armature(blender_armature, psk, psa) 
-            
-        except:
-            context.scene.frame_set(cur_frame) #set frame back to original frame
-            print ("Exception during Armature Parse")
-            raise
+	def _key(self):
+		return (type(self).__name__, self.Point)
 
-        try:
-            #######################
-            # STEP 3: ANIMATION DUMP
-            # IMPORTANT: do AFTER parsing bones - we need to do bone lookups in here during animation frames
-            print("//===============================")
-            print("// STEP 3")
-            print("//===============================")
-            parse_animation(current_scene, blender_armature, psa) 
-            
-        except:
-            context.scene.frame_set(cur_frame) #set frame back to original frame
-            print ("Exception during Animation Parse")
-            raise
-
-        # reset current frame
-        
-        context.scene.frame_set(cur_frame) #set frame back to original frame
-        
-        ##########################
-        # FILE WRITE
-        print("//===========================================")
-        print("// bExportPsk:",bpy.context.scene.unrealexportpsk," bExportPsa:",bpy.context.scene.unrealexportpsa)
-        print("//===========================================")
-        if bpy.context.scene.unrealexportpsk == True:
-            print("Writing Skeleton Mesh Data...")
-            #RG - dump psk file
-            psk.PrintOut()
-            file = open(psk_filename, "wb") 
-            file.write(psk.dump())
-            file.close() 
-            print ("Successfully Exported File: " + psk_filename)
-        if bpy.context.scene.unrealexportpsa == True:
-            print("Writing Animaiton Data...")
-            #RG - dump psa file
-            if not psa.IsEmpty():
-                psa.PrintOut()
-                file = open(psa_filename, "wb") 
-                file.write(psa.dump())
-                file.close() 
-                print ("Successfully Exported File: " + psa_filename)
-            else:
-                print ("No Animations (.psa file) to Export")
-
-        print ('PSK/PSA Export Script finished in %.2f seconds' % (time.clock() - start_time))
-        print( "Current Script version: ",bl_info['version'])
-        #MSG BOX EXPORT COMPLETE
-        #...
-
-        #DONE
-        print ("PSK/PSA Export Complete")
-
-def write_data(path, context):
-    print("//============================")
-    print("// running psk/psa export...")
-    print("//============================")
-    fs_callback(path, context)
-    pass
+	def __eq__(self, other):
+		if not hasattr(other, '_key'):
+			return False
+		return self._key() == other._key()
 
-from bpy.props import *
 
-bpy.types.Scene.unrealfpsrate = IntProperty(
-    name="fps rate",
-    description="Set the frame per second (fps) for unreal",
-    default=24,min=1,max=100)
-    
-bpy.types.Scene.unrealexport_settings = EnumProperty(
-    name="Export:",
-    description="Select a export settings (psk/psa/all)",
-    items = [("0","PSK","Export PSK"),
-             ("1","PSA","Export PSA"),
-             ("2","ALL","Export ALL")],
-    default = '0')
-
-bpy.types.Scene.UEActionSetSettings = EnumProperty(
-    name="Action Set(s) Export Type",
-    description="For Exporting Single, All, and Select Action Set(s)",
-    items = [("0","Single","Single Action Set Export"),
-             ("1","All","All Action Sets Export"),
-             ("2","Select","Select Action Set(s) Export")],
-    default = '0')        
-
-bpy.types.Scene.unrealtriangulatebool = BoolProperty(
-    name="Triangulate Mesh",
-    description="Convert Quad to Tri Mesh Boolean",
-    default=False)
-
-bpy.types.Scene.unrealignoreactionmatchcount = BoolProperty(
-    name="Acion Group Ignore Count",
-    description="It will ingore Action group count as long is matches the " \
-                "Armature bone count to match and over ride the armature " \
-                "animation data",
-    default=False)
-    
-bpy.types.Scene.unrealdisplayactionsets = BoolProperty(
-    name="Show Action Set(s)",
-    description="Display Action Sets Information",
-    default=False)    
-    
-bpy.types.Scene.unrealexportpsk = BoolProperty(
-    name="bool export psa",
-    description="bool for exporting this psk format",
-    default=True)
-    
-bpy.types.Scene.unrealexportpsa = BoolProperty(
-    name="bool export psa",
-    description="bool for exporting this psa format",
-    default=True)
-
-bpy.types.Scene.limituv = BoolProperty(
-    name="bool limit UV",
-    description="limit UV co-ordinates to [0-1]",
-    default=False)
-	
-class UEAPropertyGroup(bpy.types.PropertyGroup):
-    ## create Properties for the collection entries:
-    mystring = bpy.props.StringProperty()
-    mybool = bpy.props.BoolProperty(
-        name="Export",
-        description="Check if you want to export the action set",
-        default = False)
-
-bpy.utils.register_class(UEAPropertyGroup)
-
-## create CollectionProperty and link it to the property class
-bpy.types.Object.myCollectionUEA = bpy.props.CollectionProperty(type = UEAPropertyGroup)
-bpy.types.Object.myCollectionUEA_index = bpy.props.IntProperty(min = -1, default = -1)
-
-## create operator to add or remove entries to/from  the Collection
-class OBJECT_OT_add_remove_Collection_Items_UE(bpy.types.Operator):
-    bl_label = "Add or Remove"
-    bl_idname = "collection.add_remove_ueactions"
-    __doc__ = """Button for Add, Remove, Refresh Action Set(s) list"""
-    set = bpy.props.StringProperty()
- 
-    def invoke(self, context, event):
-        obj = context.object
-        collection = obj.myCollectionUEA
-        if self.set == "remove":
-            print("remove")
-            index = obj.myCollectionUEA_index
-            collection.remove(index)       # This remove on item in the collection list function of index value
-        if self.set == "add":
-            print("add")
-            added = collection.add()        # This add at the end of the collection list
-            added.name = "Action"+ str(random.randrange(0, 101, 2))
-        if self.set == "refresh":
-            print("refresh")
-            # ArmatureSelect = None  # UNUSED
-            ActionNames = []
-            BoneNames = []
-            for obj in bpy.data.objects:
-                if obj.type == 'ARMATURE' and obj.select == True:
-                    print("Armature Name:",obj.name)
-                    # ArmatureSelect = obj  # UNUSED
-                    for bone in obj.pose.bones:
-                        BoneNames.append(bone.name)
-                    break
-            actionsetmatchcount = 0	
-            for ActionNLA in bpy.data.actions:
-                nobone = 0
-                for group in ActionNLA.groups:	
-                    for abone in BoneNames:
-                        if abone == group.name:
-                            nobone += 1
-                            break
-                    if (len(ActionNLA.groups) == len(BoneNames)) and (nobone == len(ActionNLA.groups)):
-                        actionsetmatchcount += 1
-                        ActionNames.append(ActionNLA.name)
-            #print(dir(collection))
-            #print("collection:",len(collection))
-            print("action list check")
-            for action in ActionNames:
-                BfoundAction = False
-                #print("action:",action)
-                for c in collection:
-                    #print(c.name)
-                    if c.name == action:
-                        BfoundAction = True
-                        break
-                if BfoundAction == False:
-                    added = collection.add()        # This add at the end of the collection list
-                    added.name = action
-        #print("finish...")
-        return {'FINISHED'} 
+class VPoint(object):
 
-class ExportUDKAnimData(bpy.types.Operator):
-    global exportmessage
-    '''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
-    bl_label = "Export PSK/PSA"
-    __doc__ = """One mesh and one armature else select one mesh or armature to be exported"""
+	def __init__(self):
+		self.Point = FVector()
+		self.SmoothGroup = 0 
+		
+	def dump(self):
+		return self.Point.dump()
+		
+	def __cmp__(self, other):
+		return cmp(self.Point, other.Point) \
+			or cmp(self.SmoothGroup, other.SmoothGroup) 
+	
+	def _key(self):
+		return (type(self).__name__, self.Point, self.SmoothGroup)
+	
+	def __hash__(self):
+		return hash(self._key()) \
+			^ hash(self.SmoothGroup) 
+		
+	def __eq__(self, other):
+		if not hasattr(other, '_key'):
+			return False
+		return self._key() == other._key() 
 
-    # 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;*.psa",
-            options={'HIDDEN'},
-            )
-    pskexportbool = BoolProperty(
-            name="Export PSK",
-            description="Export Skeletal Mesh",
-            default= True,
-            )
-    psaexportbool = BoolProperty(
-            name="Export PSA",
-            description="Export Action Set (Animation Data)",
-            default= True,
-            )
-    actionexportall = BoolProperty(
-            name="All Actions",
-            description="This will export all the actions that matches the " \
-                        "current armature",
-            default=False,
-            )
-    ignoreactioncountexportbool = BoolProperty(
-            name="Ignore Action Group Count",
-            description="It will ignore action group count but as long it " \
-                        "matches the armature bone count to over ride the " \
-                        "animation data",
-            default= False,
-            )
-    limituvbool = BoolProperty(
-            name="Limit UV Co-ordinates",
-            description="Limit UV co-ordinates to [0-1]",
-            default= False,
-            ) 
+class VTriangle:
 
-    @classmethod
-    def poll(cls, context):
-        return context.active_object != None
+	def __init__(self):
+		self.WedgeIndex0	= 0		# WORD
+		self.WedgeIndex1	= 0		# WORD
+		self.WedgeIndex2	= 0		# WORD
+		self.MatIndex		= 0		# BYTE
+		self.AuxMatIndex	= 0		# BYTE
+		self.SmoothingGroups = 0	# DWORD
+		
+	def dump(self):
+		return pack('HHHBBL', self.WedgeIndex0, self.WedgeIndex1, self.WedgeIndex2, self.MatIndex, self.AuxMatIndex, self.SmoothingGroups)
+
+# 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
+#===========================================================================
+class FileSection:
+	
+	def __init__(self, name, type_size):
+		self.Header	= VChunkHeader(name, type_size)
+		self.Data	= []	# list of datatypes
+	
+	def dump(self):
+		data = self.Header.dump()
+		for i in range(len(self.Data)):
+			data = data + self.Data[i].dump()
+		return data
+	
+	def UpdateHeader(self):
+		self.Header.DataCount = len(self.Data)
+
+
+#===========================================================================
+# PSK
+#===========================================================================
+class PSKFile:
+	
+	def __init__(self):
+		self.GeneralHeader	= VChunkHeader("ACTRHEAD", 0)
+		self.Points			= FileSection("PNTS0000", SIZE_VPOINT)				# VPoint
+		self.Wedges			= FileSection("VTXW0000", SIZE_VVERTEX)				# VVertex
+		self.Faces			= FileSection("FACE0000", SIZE_VTRIANGLE)			# VTriangle
+		self.Materials		= FileSection("MATT0000", SIZE_VMATERIAL)			# VMaterial
+		self.Bones			= FileSection("REFSKELT", SIZE_VBONE)				# VBone
+		self.Influences		= FileSection("RAWWEIGHTS", SIZE_VRAWBONEINFLUENCE)	# VRawBoneInfluence
+		
+		#RG - this mapping is not dumped, but is used internally to store the new point indices 
+		# for vertex groups calculated during the mesh dump, so they can be used again
+		# to dump bone influences during the armature dump
+		#
+		# the key in this dictionary is the VertexGroup/Bone Name, and the value
+		# is a list of tuples containing the new point index and the weight, in that order
+		#
+		# Layout:
+		# { groupname : [ (index, weight), ... ], ... }
+		#
+		# example: 
+		# { 'MyVertexGroup' : [ (0, 1.0), (5, 1.0), (3, 0.5) ] , 'OtherGroup' : [(2, 1.0)] }
+		
+		self.VertexGroups = {} 
+		
+	def AddPoint(self, p):
+		self.Points.Data.append(p)
+		
+	def AddWedge(self, w):
+		self.Wedges.Data.append(w)
+	
+	def AddFace(self, f):
+		self.Faces.Data.append(f)
+		
+	def AddMaterial(self, m):
+		self.Materials.Data.append(m)
+		
+	def AddBone(self, b):
+		self.Bones.Data.append(b)
+		
+	def AddInfluence(self, i):
+		self.Influences.Data.append(i)
+		
+	def UpdateHeaders(self):
+		self.Points.UpdateHeader()
+		self.Wedges.UpdateHeader()
+		self.Faces.UpdateHeader()
+		self.Materials.UpdateHeader()
+		self.Bones.UpdateHeader()
+		self.Influences.UpdateHeader()
+		
+	def dump(self):
+		self.UpdateHeaders()
+		data = self.GeneralHeader.dump() + self.Points.dump() + self.Wedges.dump() + self.Faces.dump() + self.Materials.dump() + self.Bones.dump() + self.Influences.dump()
+		return data
+		
+	def GetMatByIndex(self, mat_index):
+		if mat_index >= 0 and len(self.Materials.Data) > mat_index:
+			return self.Materials.Data[mat_index]
+		else:
+			m = VMaterial()
+			# modified by VendorX
+			m.MaterialName = MaterialName[mat_index]
+			self.AddMaterial(m)
+			return m
+		
+	def PrintOut(self):
+		print( "{:>16} {:}".format( "Points", len(self.Points.Data) ) )
+		print( "{:>16} {:}".format( "Wedges", len(self.Wedges.Data) ) )
+		print( "{:>16} {:}".format( "Faces", len(self.Faces.Data) ) )
+		print( "{:>16} {:}".format( "Materials", len(self.Materials.Data) ) )
+		print( "{:>16} {:}".format( "Bones", len(self.Bones.Data) ) )
+		print( "{:>16} {:}".format( "Influences", len(self.Influences.Data) ) )
+
+
+#===========================================================================
+# PSA
+#
+# Notes from UDN:
+#   The raw key array holds all the keys for all the bones in all the specified sequences, 
+#   organized as follows:
+#   For each AnimInfoBinary's sequence there are [Number of bones] times [Number of frames keys] 
+#   in the VQuatAnimKeys, laid out as tracks of [numframes] keys for each bone in the order of 
+#   the bones as defined in the array of FnamedBoneBinary in the PSA. 
+#
+#   Once the data from the PSK (now digested into native skeletal mesh) and PSA (digested into 
+#   a native animation object containing one or more sequences) are associated together at runtime, 
+#   bones are linked up by name. Any bone in a skeleton (from the PSK) that finds no partner in 
+#   the animation sequence (from the PSA) will assume its reference pose stance ( as defined in 
+#   the offsets & rotations that are in the VBones making up the reference skeleton from the PSK)
+#===========================================================================
+class PSAFile:
+
+	def __init__(self):
+		self.GeneralHeader	= VChunkHeader("ANIMHEAD", 0)
+		self.Bones			= FileSection("BONENAMES", SIZE_FNAMEDBONEBINARY)	#FNamedBoneBinary
+		self.Animations		= FileSection("ANIMINFO", SIZE_ANIMINFOBINARY)		#AnimInfoBinary
+		self.RawKeys		= FileSection("ANIMKEYS", SIZE_VQUATANIMKEY)		#VQuatAnimKey
+		# this will take the format of key=Bone Name, value = (BoneIndex, Bone Object)
+		# THIS IS NOT DUMPED
+		self.BoneLookup = {} 
+
+	def AddBone(self, b):
+		self.Bones.Data.append(b)
+		
+	def AddAnimation(self, a):
+		self.Animations.Data.append(a)
+		
+	def AddRawKey(self, k):
+		self.RawKeys.Data.append(k)
+		
+	def UpdateHeaders(self):
+		self.Bones.UpdateHeader()
+		self.Animations.UpdateHeader()
+		self.RawKeys.UpdateHeader()
+		
+	def GetBoneByIndex(self, bone_index):
+		if bone_index >= 0 and len(self.Bones.Data) > bone_index:
+			return self.Bones.Data[bone_index]
+	
+	def IsEmpty(self):
+		return (len(self.Bones.Data) == 0 or len(self.Animations.Data) == 0)
+	
+	def StoreBone(self, b):
+		self.BoneLookup[b.Name] = [-1, b]
+					
+	def UseBone(self, bone_name):
+		if bone_name in self.BoneLookup:
+			bone_data = self.BoneLookup[bone_name]
+			
+			if bone_data[0] == -1:
+				bone_data[0] = len(self.Bones.Data)
+				self.AddBone(bone_data[1])
+				#self.Bones.Data.append(bone_data[1])
+			
+			return bone_data[0]
+			
+	def GetBoneByName(self, bone_name):
+		if bone_name in self.BoneLookup:
+			bone_data = self.BoneLookup[bone_name]
+			return bone_data[1]
+		
+	def GetBoneIndex(self, bone_name):
+		if bone_name in self.BoneLookup:
+			bone_data = self.BoneLookup[bone_name]
+			return bone_data[0]
+		
+	def dump(self):
+		self.UpdateHeaders()
+		return self.GeneralHeader.dump() + self.Bones.dump() + self.Animations.dump() + self.RawKeys.dump()
+		
+	def PrintOut(self):
+		print( "{:>16} {:}".format( "Bones", len(self.Bones.Data) ) )
+		print( "{:>16} {:}".format( "Animations", len(self.Animations.Data) ) )
+		print( "{:>16} {:}".format( "Raw keys", len(self.RawKeys.Data) ) )
+
+
+#===========================================================================
+# Helpers to create bone structs
+#===========================================================================
+def make_vbone( name, parent_index, child_count, orientation_quat, position_vect ):
+	bone						= VBone()
+	bone.Name					= name
+	bone.ParentIndex			= parent_index
+	bone.NumChildren			= child_count
+	bone.BonePos.Orientation	= orientation_quat
+	bone.BonePos.Position.X		= position_vect.x
+	bone.BonePos.Position.Y		= position_vect.y
+	bone.BonePos.Position.Z		= position_vect.z
+	#these values seem to be ignored?
+	#bone.BonePos.Length = tail.length
+	#bone.BonePos.XSize = tail.x
+	#bone.BonePos.YSize = tail.y
+	#bone.BonePos.ZSize = tail.z
+	return bone
+
+def make_namedbonebinary( name, parent_index, child_count, orientation_quat, position_vect, is_real ):
+	bone						= FNamedBoneBinary()
+	bone.Name					= name
+	bone.ParentIndex			= parent_index
+	bone.NumChildren			= child_count
+	bone.BonePos.Orientation	= orientation_quat
+	bone.BonePos.Position.X		= position_vect.x
+	bone.BonePos.Position.Y		= position_vect.y
+	bone.BonePos.Position.Z		= position_vect.z
+	bone.IsRealBone				= is_real
+	return bone 
+
+def make_fquat( bquat ):
+	quat	= FQuat()
+	#flip handedness for UT = set x,y,z to negative (rotate in other direction)
+	quat.X  = -bquat.x
+	quat.Y  = -bquat.y
+	quat.Z  = -bquat.z
+	quat.W  = bquat.w
+	return quat
+	
+def make_fquat_default( bquat ):
+	quat	= FQuat()
+	#print(dir(bquat))
+	quat.X  = bquat.x
+	quat.Y  = bquat.y
+	quat.Z  = bquat.z
+	quat.W  = bquat.w
+	return quat
+
+
+#===========================================================================
+#RG - check to make sure face isnt a line
+#===========================================================================
+def is_1d_face( face, mesh ):
+	#ID Vertex of id point
+	v0 = face.vertices[0]
+	v1 = face.vertices[1]
+	v2 = face.vertices[2]
+	
+	return (mesh.vertices[v0].co == mesh.vertices[v1].co \
+		or mesh.vertices[v1].co == mesh.vertices[v2].co \
+		or mesh.vertices[v2].co == mesh.vertices[v0].co)
+	return False
+
+
+#===========================================================================
+# Smoothing group
+# (renamed to seperate it from VVertex.SmoothGroup)
+#===========================================================================
+class SmoothingGroup:
+	
+	static_id = 1
+	
+	def __init__(self):
+		self.faces				= []
+		self.neighboring_faces	= []
+		self.neighboring_groups	= []
+		self.id					= -1
+		self.local_id			= SmoothingGroup.static_id
+		SmoothingGroup.static_id += 1
+	
+	def __cmp__(self, other):
+		if isinstance(other, SmoothingGroup):
+			return cmp( self.local_id, other.local_id )
+		return -1
+	
+	def __hash__(self):
+		return hash(self.local_id)
+
+	# searches neighboring faces to determine which smoothing group ID can be used
+	def get_valid_smoothgroup_id(self):
+		temp_id = 1
+		for group in self.neighboring_groups:
+			if group != None and group.id == temp_id:
+				if temp_id < 0x80000000:
+					temp_id = temp_id << 1
+				else:
+					raise Error("Smoothing Group ID Overflowed, Smoothing Group evidently has more than 31 neighboring groups")
+		
+		self.id = temp_id
+		return self.id
+		
+	def make_neighbor(self, new_neighbor):
+		if new_neighbor not in self.neighboring_groups:
+			self.neighboring_groups.append( new_neighbor )
+
+	def contains_face(self, face):
+		return (face in self.faces)
+		
+	def add_neighbor_face(self, face):
+		if not face in self.neighboring_faces:
+			self.neighboring_faces.append( face )
+			
+	def add_face(self, face):
+		if not face in self.faces:
+			self.faces.append( face )
+
+
+def determine_edge_sharing( mesh ):
+	
+	edge_sharing_list = dict()
+	
+	for edge in mesh.edges:
+		edge_sharing_list[edge.key] = []
+	
+	for face in mesh.tessfaces:
+		for key in face.edge_keys:
+			if not face in edge_sharing_list[key]:
+				edge_sharing_list[key].append(face) # mark this face as sharing this edge
+	
+	return edge_sharing_list
+
+
+def find_edges( mesh, key ):
+	"""	Temp replacement for mesh.findEdges().
+		This is painfully slow.
+	"""
+	for edge in mesh.edges:
+		v = edge.vertices
+		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:
+		return
+
+	smoothgroup.add_face(face)
+	
+	for key in face.edge_keys:
+		
+		edge_id = find_edges(mesh, key)
+		
+		if edge_id != None:
+			
+			# not sharp
+			if not( mesh.edges[edge_id].use_edge_sharp):
+				
+				for shared_face in edge_sharing_list[key]:
+					if shared_face != face:
+						# recursive
+						add_face_to_smoothgroup( mesh, shared_face, edge_sharing_list, smoothgroup )
+			# sharp
+			else:
+				for shared_face in edge_sharing_list[key]:
+					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:
+		if (face in group.faces):
+			return
+	
+	smoothgroup = SmoothingGroup();
+	add_face_to_smoothgroup( mesh, face, edge_sharing_list, smoothgroup )
+	
+	if not smoothgroup in smoothgroup_list:
+		smoothgroup_list.append( smoothgroup )
+
+
+def build_neighbors_tree( smoothgroup_list ):
+
+	for group in smoothgroup_list:
+		for face in group.neighboring_faces:
+			for neighbor_group in smoothgroup_list:
+				if neighbor_group.contains_face( face ) and neighbor_group not in group.neighboring_groups:
+					group.make_neighbor( neighbor_group )
+					neighbor_group.make_neighbor( group )
+
+
+#===========================================================================
+# parse_smooth_groups
+#===========================================================================
+def parse_smooth_groups( mesh ):
+	
+	print("Parsing smooth groups...")
+	
+	t					= time.clock()
+	smoothgroup_list	= []
+	edge_sharing_list	= determine_edge_sharing(mesh)
+	#print("faces:",len(mesh.tessfaces))
+	interval =  math.floor(len(mesh.tessfaces) / 100)
+	if interval == 0: #if the faces are few do this
+	    interval =  math.floor(len(mesh.tessfaces) / 10)	
+	#print("FACES:",len(mesh.tessfaces),"//100 =" "interval:",interval)
+	for face in mesh.tessfaces:
+		#print(dir(face))
+		determine_smoothgroup_for_face(mesh, face, edge_sharing_list, smoothgroup_list)
+		# progress indicator, writes to console without scrolling
+		if face.index > 0 and (face.index % interval) == 0:
+			print("Processing... {}%\r".format( int(face.index / len(mesh.tessfaces) * 100) ), end='')
+			sys.stdout.flush()
+	print("Completed" , ' '*20)
+	
+	verbose("len(smoothgroup_list)={}".format(len(smoothgroup_list)))
+	
+	build_neighbors_tree(smoothgroup_list)
+	
+	for group in smoothgroup_list:
+		group.get_valid_smoothgroup_id()
+	
+	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
+#===========================================================================
+def triangulate_mesh( object ):
+	
+	verbose(header("triangulateNMesh"))
+	#print(type(object))
+	scene = bpy.context.scene
+	
+	me_ob		= object.copy()
+	me_ob.data = object.to_mesh(bpy.context.scene, True, 'PREVIEW') #write data object
+	bpy.context.scene.objects.link(me_ob)
+	bpy.context.scene.update()
+	bpy.ops.object.mode_set(mode='OBJECT')
+	for i in scene.objects:
+		i.select = False # deselect all objects
+	
+	me_ob.select			= True
+	scene.objects.active	= me_ob
+	
+	print("Copy and Convert mesh just incase any way...")
+	
+	bpy.ops.object.mode_set(mode='EDIT')
+	bpy.ops.mesh.select_all(action='SELECT')# select all the face/vertex/edge
+	bpy.ops.object.mode_set(mode='EDIT')
+	bpy.ops.mesh.quads_convert_to_tris()
+	bpy.context.scene.update()
+	
+	bpy.ops.object.mode_set(mode='OBJECT')
+		
+	bpy.context.scene.udk_option_triangulate = True
+		
+	verbose("Triangulated mesh")
+		
+	me_ob.data = me_ob.to_mesh(bpy.context.scene, True, 'PREVIEW') #write data object
+	bpy.context.scene.update()
+	return me_ob
+
+
+#===========================================================================
+# parse_mesh
+#===========================================================================
+def parse_mesh( mesh, psk ):
+	#bpy.ops.object.mode_set(mode='OBJECT')
+	#error ? on commands for select object?
+	print(header("MESH", 'RIGHT'))
+	print("Mesh object:", mesh.name)
+	scene = bpy.context.scene
+	for i in scene.objects: i.select = False # deselect all objects
+	scene.objects.active	= mesh
+	mesh = triangulate_mesh(mesh)
+	#print("FACES----:",len(mesh.data.tessfaces))
+	verbose("Working mesh object: {}".format(mesh.name))
+	
+	#collect a list of the material names
+	print("Materials...")
+	
+	mat_slot_index = 0
+
+	for slot in mesh.material_slots:
+
+		print("  Material {} '{}'".format(mat_slot_index, slot.name))
+		MaterialName.append(slot.name)
+		#if slot.material.texture_slots[0] != None:
+			#if slot.material.texture_slots[0].texture.image.filepath != None:
+				#print("    Texture path {}".format(slot.material.texture_slots[0].texture.image.filepath)) 
+		#create the current material
+		v_material				= psk.GetMatByIndex(mat_slot_index)
+		v_material.MaterialName	= slot.name
+		v_material.TextureIndex	= mat_slot_index
+		v_material.AuxMaterial	= mat_slot_index
+		mat_slot_index += 1
+		verbose("    PSK index {}".format(v_material.TextureIndex))
+
+	#END slot in mesh.material_slots
+	
+	# object_mat = mesh.materials[0]
+	#object_material_index = mesh.active_material_index
+	#FIXME ^ this is redundant due to "= face.material_index" in face loop
+
+	wedges			= ObjMap()
+	points			= ObjMap()
+	points_linked	= {}
+	
+	discarded_face_count = 0
+
+	smoothgroup_list = parse_smooth_groups(mesh.data)
+	
+	print("{} faces".format(len(mesh.data.tessfaces)))
+	
+	print("Smooth groups active:", bpy.context.scene.udk_option_smoothing_groups)
+	
+	for face in mesh.data.tessfaces:
+		
+		smoothgroup_id = 0x80000000
+		
+		for smooth_group in smoothgroup_list:
+			if smooth_group.contains_face(face):
+				smoothgroup_id = smooth_group.id
+				break
+
+		#print ' -- Dumping UVs -- '
+		#print current_face.uv_textures
+		# modified by VendorX
+		object_material_index = face.material_index
+		
+		if len(face.vertices) != 3:
+			raise Error("Non-triangular face (%i)" % len(face.vertices))
+		
+		#RG - apparently blender sometimes has problems when you do quad to triangle 
+		#   conversion, and ends up creating faces that have only TWO points -
+		#	one of the points is simply in the vertex list for the face twice. 
+		#   This is bad, since we can't get a real face normal for a LINE, we need 
+		#   a plane for this. So, before we add the face to the list of real faces, 
+		#   ensure that the face is actually a plane, and not a line. If it is not 
+		#   planar, just discard it and notify the user in the console after we're
+		#   done dumping the rest of the faces
+		
+		if not is_1d_face(face, mesh.data):
+			
+			wedge_list	= []
+			vect_list	= []
+			
+			#get or create the current material
+			psk.GetMatByIndex(object_material_index)
+
+			face_index	= face.index
+			has_uv		= False
+			face_uv		= None
+			
+			if len(mesh.data.uv_textures) > 0:
+				has_uv		= True   
+				uv_layer	= mesh.data.tessface_uv_textures.active
+				face_uv		= uv_layer.data[face_index]
+				#size(data) is number of texture faces. Each face has UVs
+				#print("DATA face uv: ",len(faceUV.uv), " >> ",(faceUV.uv[0][0]))
+			
+			for i in range(3):
+				vert_index	= face.vertices[i]
+				vert		= mesh.data.vertices[vert_index]
+				uv			= []
+				#assumes 3 UVs Per face (for now)
+				if (has_uv):
+					if len(face_uv.uv) != 3:
+						print("WARNING: face has more or less than 3 UV coordinates - writing 0,0...")
+						uv = [0.0, 0.0]
+					else:
+						uv = [face_uv.uv[i][0],face_uv.uv[i][1]] #OR bottom works better # 24 for cube
+				else:
+					#print ("No UVs?")
+					uv = [0.0, 0.0]
+				
+				#flip V coordinate because UEd requires it and DOESN'T flip it on its own like it
+				#does with the mesh Y coordinates. this is otherwise known as MAGIC-2
+				uv[1] = 1.0 - uv[1]
+				
+				# clamp UV coords if udk_option_clamp_uv is True
+				if bpy.context.scene.udk_option_clamp_uv:
+					if (uv[0] > 1):
+						uv[0] = 1
+					if (uv[0] < 0):
+						uv[0] = 0
+					if (uv[1] > 1):
+						uv[1] = 1
+					if (uv[1] < 0):
+						uv[1] = 0
+				
+				# RE - Append untransformed vector (for normal calc below)
+				# TODO: convert to Blender.Mathutils
+				vect_list.append( FVector(vert.co.x, vert.co.y, vert.co.z) )
+				
+				# Transform position for export
+				#vpos = vert.co * object_material_index
+				vpos = mesh.matrix_local * vert.co
+
+				# Create the point
+				p				= VPoint()
+				p.Point.X		= vpos.x
+				p.Point.Y		= vpos.y
+				p.Point.Z		= vpos.z
+				if bpy.context.scene.udk_option_smoothing_groups:#is this necessary?
+					p.SmoothGroup = smoothgroup_id
+
+				lPoint			= VPointSimple()
+				lPoint.Point.X	= vpos.x
+				lPoint.Point.Y	= vpos.y
+				lPoint.Point.Z	= vpos.z
+				
+				if lPoint in points_linked:
+					if not(p in points_linked[lPoint]):
+						points_linked[lPoint].append(p)
+				else:
+					points_linked[lPoint] = [p]
+				
+				# Create the wedge
+				w				= VVertex()
+				w.MatIndex		= object_material_index
+				w.PointIndex	= points.get(p) # store keys
+				w.U				= uv[0]
+				w.V				= uv[1]
+				if bpy.context.scene.udk_option_smoothing_groups:#is this necessary?
+					w.SmoothGroup = smoothgroup_id
+				index_wedge = wedges.get(w)
+				wedge_list.append(index_wedge)
+				
+				#print results
+				#print("result PointIndex={}, U={:.6f}, V={:.6f}, wedge_index={}".format(
+				#   w.PointIndex,
+				#   w.U,
+				#   w.V,
+				#   index_wedge))
+			
+			#END for i in range(3)
+
+			# Determine face vertex order
+			
+			# TODO: convert to Blender.Mathutils
+			# get normal from blender
+			no = face.normal
+			# convert to FVector
+			norm = FVector(no[0], no[1], no[2])
+			# Calculate the normal of the face in blender order
+			tnorm = vect_list[1].sub(vect_list[0]).cross(vect_list[2].sub(vect_list[1]))
+			# RE - dot the normal from blender order against the blender normal
+			# this gives the product of the two vectors' lengths along the blender normal axis
+			# all that matters is the sign
+			dot = norm.dot(tnorm)
+
+			tri = VTriangle()
+			# RE - magic: if the dot product above > 0, order the vertices 2, 1, 0
+			#	   if the dot product above < 0, order the vertices 0, 1, 2
+			#	   if the dot product is 0, then blender's normal is coplanar with the face
+			#	   and we cannot deduce which side of the face is the outside of the mesh
+			if dot > 0:
+				(tri.WedgeIndex2, tri.WedgeIndex1, tri.WedgeIndex0) = wedge_list
+			elif dot < 0:
+				(tri.WedgeIndex0, tri.WedgeIndex1, tri.WedgeIndex2) = wedge_list
+			else:
+				dindex0 = face.vertices[0];
+				dindex1 = face.vertices[1];
+				dindex2 = face.vertices[2];
+
+				mesh.data.vertices[dindex0].select = True
+				mesh.data.vertices[dindex1].select = True
+				mesh.data.vertices[dindex2].select = True
+				
+				raise Error("Normal coplanar with face! points:", mesh.data.vertices[dindex0].co, mesh.data.vertices[dindex1].co, mesh.data.vertices[dindex2].co)
+			
+			face.select = True
+			#print("smooth:",(current_face.use_smooth))
+			#not sure if this right
+			#tri.SmoothingGroups
+			if face.use_smooth == True:
+				tri.SmoothingGroups = 1
+			else:
+				tri.SmoothingGroups = 0
+			
+			#tri.SmoothingGroups = 1
+			tri.MatIndex = object_material_index
+
+			if bpy.context.scene.udk_option_smoothing_groups:
+				tri.SmoothingGroups = smoothgroup_id
+			
+			psk.AddFace(tri)
+
+		#END if not is_1d_face(current_face, mesh.data)	
+
+		else:
+			discarded_face_count += 1
+			
+	#END face in mesh.data.faces
+		
+	print("{} points".format(len(points.dict)))
+	
+	for point in points.items():
+		psk.AddPoint(point)
+		
+	if len(points.dict) > 32767:
+	   raise Error("Mesh vertex limit exceeded! {} > 32767".format(len(points.dict)))
+	
+	print("{} wedges".format(len(wedges.dict)))
+	
+	for wedge in wedges.items():
+		psk.AddWedge(wedge)
+	
+	# alert the user to degenerate face issues
+	if discarded_face_count > 0:
+		print("WARNING: Mesh contained degenerate faces (non-planar)")
+		print("		 Discarded {} faces".format(discarded_face_count))
+	
+	#RG - walk through the vertex groups and find the indexes into the PSK points array 
+	#for them, then store that index and the weight as a tuple in a new list of 
+	#verts for the group that we can look up later by bone name, since Blender matches
+	#verts to bones for influences by having the VertexGroup named the same thing as
+	#the bone
+	
+	#[print(x, len(points_linked[x])) for x in points_linked] 
+	#print("pointsindex length ",len(points_linked))
+	#vertex group
+	
+	# all vertex groups of the mesh (obj)...
+	for obj_vertex_group in mesh.vertex_groups:
+		
+		#print("  bone group build:",obj_vertex_group.name)#print bone name
+		#print(dir(obj_vertex_group))
+		verbose("obj_vertex_group.name={}".format(obj_vertex_group.name))
+		
+		vertex_list = []
+		
+		# all vertices in the mesh...
+		for vertex in mesh.data.vertices:
+			#print(dir(vertex))
+			# all groups this vertex is a member of...
+			for vgroup in vertex.groups:
+				
+				if vgroup.group == obj_vertex_group.index:
+					
+					vertex_weight	= vgroup.weight
+					p				= VPointSimple()
+					vpos			= mesh.matrix_local * vertex.co
+					p.Point.X		= vpos.x
+					p.Point.Y		= vpos.y 
+					p.Point.Z		= vpos.z
+						
+					for point in points_linked[p]:
+						point_index	= points.get(point) #point index
+						v_item		= (point_index, vertex_weight)
+						vertex_list.append(v_item)
+					
+		#bone name, [point id and wieght]
+		#print("Add Vertex Group:",obj_vertex_group.name, " No. Points:",len(vertex_list))
+		psk.VertexGroups[obj_vertex_group.name] = vertex_list
+	
+	# remove the temporary triangulated mesh
+	if bpy.context.scene.udk_option_triangulate == True:
+		verbose("Removing temporary triangle mesh: {}".format(mesh.name))
+		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
+#===========================================================================
+def parse_armature( armature, psk, psa ):
+	
+	print(header("ARMATURE", 'RIGHT'))
+	verbose("Armature object: {} Armature data: {}".format(armature.name, armature.data.name))
+	
+	# generate a list of root bone candidates
+	root_candidates = [b for b in armature.data.bones if b.parent == None and b.use_deform == True]
+	
+	# should be a single, unambiguous result
+	if len(root_candidates) == 0:
+		raise Error("Cannot find root for UDK bones. The root bone must use deform.")
+	
+	if len(root_candidates) > 1:
+		raise Error("Ambiguous root for UDK. More than one root bone is using deform.")
+	
+	# prep for bone collection
+	udk_root_bone	= root_candidates[0]
+	udk_bones		= []
+	BoneUtil.static_bone_id = 0	# replaces global
+	
+	# traverse bone chain
+	print("{: <3} {: <48} {: <20}".format("ID", "Bone", "Status"))
+	print()
+	recurse_bone(udk_root_bone, udk_bones, psk, psa, 0, armature.matrix_local)
+	
+	# final validation
+	if len(udk_bones) < 3:
+		raise Error("Less than three bones may crash UDK (legacy issue?)")
+	
+	# return a list of bones making up the entire udk skel
+	# this is passed to parse_animation instead of working from keyed bones in the action
+	return udk_bones
+
+
+#===========================================================================
+# bone				current bone
+# bones				bone list
+# psk				the PSK file object
+# psa				the PSA file object
+# parent_id
+# parent_matrix
+# indent			text indent for recursive log
+#===========================================================================
+def recurse_bone( bone, bones, psk, psa, parent_id, parent_matrix, indent="" ):
+	
+	status = "Ok"
+	
+	bones.append(bone);
+
+	if not bone.use_deform:
+		status = "No effect"
+	
+	# calc parented bone transform
+	if bone.parent != None:
+		quat		= make_fquat(bone.matrix.to_quaternion())
+		quat_parent	= bone.parent.matrix.to_quaternion().inverted()
+		parent_head	= quat_parent * bone.parent.head
+		parent_tail	= quat_parent * bone.parent.tail
+		translation	= (parent_tail - parent_head) + bone.head
+
+	# calc root bone transform
+	else:
+		translation	= parent_matrix * bone.head				# ARMATURE OBJECT Location
+		rot_matrix	= bone.matrix * parent_matrix.to_3x3()	# ARMATURE OBJECT Rotation
+		quat		= make_fquat_default(rot_matrix.to_quaternion())
+	
+	bone_id		= BoneUtil.static_bone_id	# ALT VERS
+	BoneUtil.static_bone_id += 1			# ALT VERS
+	
+	child_count = len(bone.children)
+	
+	psk.AddBone( make_vbone(bone.name, parent_id, child_count, quat, translation) )
+	psa.StoreBone( make_namedbonebinary(bone.name, parent_id, child_count, quat, translation, 1) )
+	
+	#RG - dump influences for this bone - use the data we collected in the mesh dump phase to map our bones to vertex groups
+	if bone.name in psk.VertexGroups:
+		
+		vertex_list = psk.VertexGroups[bone.name]
+		#print("vertex list:", len(vertex_list), " of >" ,bone.name )
+		for vertex_data in vertex_list:
+			
+			point_index				= vertex_data[0]
+			vertex_weight			= vertex_data[1]
+			influence				= VRawBoneInfluence()
+			influence.Weight		= vertex_weight
+			influence.BoneIndex		= bone_id
+			influence.PointIndex	= point_index
+			#print ("   AddInfluence to vertex {}, weight={},".format(point_index, vertex_weight))
+			psk.AddInfluence(influence)
+
+	else:
+		status = "No vertex group"
+		#FIXME overwriting previous status error?
+	
+	print("{:<3} {:<48} {:<20}".format(bone_id, indent+bone.name, status))
+	
+	#bone.matrix_local
+	#recursively dump child bones
+	
+	for child_bone in bone.children:
+		recurse_bone(child_bone, bones, psk, psa, bone_id, parent_matrix, " "+indent)
 
-    def execute(self, context):
-        #check if  skeleton mesh is needed to be exported
-        if (self.pskexportbool):
-            bpy.context.scene.unrealexportpsk = True
-        else:
-            bpy.context.scene.unrealexportpsk = False
-        #check if  animation data is needed to be exported
-        if (self.psaexportbool):
-            bpy.context.scene.unrealexportpsa = True
-        else:
-            bpy.context.scene.unrealexportpsa = False
-            
-        if (self.actionexportall):
-            bpy.context.scene.UEActionSetSettings = '1'#export one action set
-        else:
-            bpy.context.scene.UEActionSetSettings = '0'#export all action sets
-        
-        if(self.ignoreactioncountexportbool):
-            bpy.context.scene.unrealignoreactionmatchcount = True
-        else:
-            bpy.context.scene.unrealignoreactionmatchcount = False
-
-        if(self.limituvbool):
-            bpy.types.Scene.limituv = True
-        else:
-            bpy.types.Scene.limituv = False
-        write_data(self.filepath, context)
-        
-        self.report({'WARNING', 'INFO'}, exportmessage)
-        return {'FINISHED'}
-        
-    def invoke(self, context, event):
-        wm = context.window_manager
-        wm.fileselect_add(self)
-        return {'RUNNING_MODAL'}
 
-class VIEW3D_PT_unrealtools_objectmode(bpy.types.Panel):
-    bl_space_type = "VIEW_3D"
-    bl_region_type = "TOOLS"
-    bl_label = "Unreal Tools"
+# 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
+# actions_to_export	list of actions to process for export
+# psa				the PSA file object
+#===========================================================================
+def parse_animation( armature, udk_bones, actions_to_export, psa ):
+	
+	print(header("ANIMATION", 'RIGHT'))
+	
+	context		= bpy.context
+	anim_rate	= context.scene.render.fps
+	
+	verbose("Armature object: {}".format(armature.name))
+	print("Scene: {} FPS: {} Frames: {} to {}".format(context.scene.name, anim_rate, context.scene.frame_start, context.scene.frame_end))
+	print("Processing {} action(s)".format(len(actions_to_export)))
+	print()
+	if armature.animation_data == None:
+	    print("None Actions Set! skipping...")
+	    return
+	restoreAction	= armature.animation_data.action	# Q: is animation_data always valid?
+	
+	restoreFrame	= context.scene.frame_current		# we already do this in export_proxy, but we'll do it here too for now
+	raw_frame_index = 0	 # used to set FirstRawFrame, seperating actions in the raw keyframe array
+	
+	# action loop...
+	for action in actions_to_export:
+		
+		# removed: check for armature with no animation; all it did was force you to add one
+
+		if not len(action.fcurves):
+			print("{} has no keys, skipping".format(action.name))
+			continue
+		
+		# apply action to armature and update scene
+		armature.animation_data.action = action
+		context.scene.update()
+		
+		# min/max frames define range
+		framemin, framemax	= action.frame_range
+		start_frame			= int(framemin)
+		end_frame			= int(framemax)
+		scene_range			= range(start_frame, end_frame + 1)
+		frame_count			= len(scene_range)
+		
+		# create the AnimInfoBinary
+		anim				= AnimInfoBinary()
+		anim.Name			= action.name
+		anim.Group			= "" # unused?
+		anim.NumRawFrames	= frame_count
+		anim.AnimRate		= anim_rate
+		anim.FirstRawFrame	= raw_frame_index
+		
+		print("{}, frames {} to {} ({} frames)".format(action.name, start_frame, end_frame, frame_count))
+		
+		# removed: bone lookup table
+		
+		# build a list of pose bones relevant to the collated udk_bones
+		# fixme: could be done once, prior to loop?
+		udk_pose_bones = []
+		for b in udk_bones:
+			for pb in armature.pose.bones:
+				if b.name == pb.name:
+					udk_pose_bones.append(pb)
+					break;
+
+		# sort in the order the bones appear in the PSA file
+		ordered_bones = {}
+		ordered_bones = sorted([(psa.UseBone(b.name), b) for b in udk_pose_bones], key=operator.itemgetter(0))
+		
+		# NOTE: posebone.bone references the obj/edit bone
+		# REMOVED: unique_bone_indexes is redundant?
+		
+		# frame loop...
+		for i in range(frame_count):
+			
+			frame = scene_range[i]
+			
+			#verbose("FRAME {}".format(i), i) # test loop sampling
+			
+			# advance to frame (automatically updates the pose)
+			context.scene.frame_set(frame)
+			
+			# compute the key for each bone
+			for bone_data in ordered_bones:
+				
+				bone_index			= bone_data[0]
+				pose_bone			= bone_data[1]
+				pose_bone_matrix	= mathutils.Matrix(pose_bone.matrix)
+				
+				if pose_bone.parent != None:
+					pose_bone_parent_matrix	= mathutils.Matrix(pose_bone.parent.matrix)
+					pose_bone_matrix		= pose_bone_parent_matrix.inverted() * pose_bone_matrix
+				
+				head				= pose_bone_matrix.to_translation()
+				quat				= pose_bone_matrix.to_quaternion().normalized()
+				
+				if pose_bone.parent != None:
+					quat = make_fquat(quat)
+				else:
+					quat = make_fquat_default(quat)
+				
+				vkey				= VQuatAnimKey()
+				vkey.Position.X		= head.x
+				vkey.Position.Y		= head.y
+				vkey.Position.Z		= head.z
+				vkey.Orientation	= quat
+				
+				# frame delta = 1.0 / fps
+				vkey.Time			= 1.0 / float(anim_rate)	# according to C++ header this is "disregarded"
+				
+				psa.AddRawKey(vkey)
+				
+			# END for bone_data in ordered_bones
+
+			raw_frame_index += 1
+		
+		# END for i in range(frame_count)
+		
+		anim.TotalBones	= len(ordered_bones)	# REMOVED len(unique_bone_indexes)
+		anim.TrackTime	= float(frame_count)	# frame_count/anim.AnimRate makes more sense, but this is what actually works in UDK
+
+		verbose("anim.TotalBones={}, anim.TrackTime={}".format(anim.TotalBones, anim.TrackTime))
+		
+		psa.AddAnimation(anim)
+		
+	# END for action in actions
+
+	# restore
+	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.
+# RETURNS list of actions
+#===========================================================================
+def collate_actions():
+	verbose(header("collate_actions"))
+	actions_to_export = []
+	
+	for action in bpy.data.actions:
+		
+		verbose(" + {}".format(action.name))
+		actions_to_export.append(action)
+	
+	return actions_to_export
+
+
+#===========================================================================
+# Locate the target armature and mesh for export
+# RETURNS armature, mesh
+#===========================================================================
+def find_armature_and_mesh():
+	verbose(header("find_armature_and_mesh", 'LEFT', '<', 60))
+	
+	context			= bpy.context
+	active_object	= context.active_object
+	armature		= None
+	mesh			= None
+	
+	# TODO:
+	# this could be more intuitive
+
+	# try the active object
+	if active_object and active_object.type == 'ARMATURE':
+		armature = active_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")
+		
+		else:
+			raise Error("No armatures in scene")
+	
+	verbose("Found armature: {}".format(armature.name))
+	
+	
+	# try the active object
+	if active_object and active_object.type == 'MESH':
+		
+		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:
+		parented_meshes = [obj for obj in armature.children if obj.type == 'MESH']
+		print("Number of meshes:",len(parented_meshes))
+		if len(parented_meshes) == 1:
+			mesh = parented_meshes[0]
+			
+		elif len(parented_meshes) > 1:
+			raise Error("More than one mesh parented to armature")
+			
+		else:
+			raise Error("No mesh parented to armature")
+		
+	verbose("Found mesh: {}".format(mesh.name))	
+	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.
+# UNUSED
+#===========================================================================
+def collate_vertex_groups( mesh ):
+	verbose("collate_vertex_groups")
+	groups = []
+	
+	for group in mesh.vertex_groups:
+		
+		groups.append(group)
+		verbose("  " + group.name)
+	
+	return groups
+
+
+#===========================================================================
+# Main
+#===========================================================================
+def export(filepath):
+	print(header("Export", 'RIGHT'))
+	
+	t		= time.clock()
+	context	= bpy.context
+	
+	print("Blender Version {}.{}.{}".format(bpy.app.version[0], bpy.app.version[1], bpy.app.version[2]))
+	print("Filepath: {}".format(filepath))
+	
+	verbose("PSK={}, PSA={}".format(context.scene.udk_option_export_psk, context.scene.udk_option_export_psa))
+	
+	# find armature and mesh
+	# [change this to implement alternative methods; raise Error() if not found]
+	udk_armature, udk_mesh = find_armature_and_mesh()
+	
+	# check misc conditions
+	if not (udk_armature.scale.x == udk_armature.scale.y == udk_armature.scale.z == 1):
+		raise Error("bad armature scale: armature object should have uniform scale of 1 (ALT-S)")
+	
+	if not (udk_mesh.scale.x == udk_mesh.scale.y == udk_mesh.scale.z == 1):
+		raise Error("bad mesh scale: mesh object should have uniform scale of 1 (ALT-S)")
+	
+	if not (udk_armature.location.x == udk_armature.location.y == udk_armature.location.z == 0):
+		raise Error("bad armature location: armature should be located at origin (ALT-G)")
+	
+	if not (udk_mesh.location.x == udk_mesh.location.y == udk_mesh.location.z == 0):
+		raise Error("bad mesh location: mesh should be located at origin (ALT-G)")
+	
+	# prep
+	psk = PSKFile()
+	psa = PSAFile()
+	
+	# step 1
+	parse_mesh(udk_mesh, psk)
+	
+	# step 2
+	udk_bones = parse_armature(udk_armature, psk, psa)
+	
+	# step 3
+	if context.scene.udk_option_export_psa == True:
+		actions = collate_actions()
+		parse_animation(udk_armature, udk_bones, actions, psa)
+	
+	# write files
+	print(header("Exporting", 'CENTER'))
+	
+	psk_filename = filepath + '.psk'
+	psa_filename = filepath + '.psa'
+	
+	if context.scene.udk_option_export_psk == True:
+		
+		print("Skeletal mesh data...")
+		psk.PrintOut()
+		file = open(psk_filename, "wb") 
+		file.write(psk.dump())
+		file.close() 
+		print("Exported: " + psk_filename)
+		print()
+	
+	if context.scene.udk_option_export_psa == True:
+		
+		print("Animation data...")
+		if not psa.IsEmpty():
+			psa.PrintOut()
+			file = open(psa_filename, "wb") 
+			file.write(psa.dump())
+			file.close() 
+			print("Exported: " + psa_filename)
+		
+		else:
+			print("No Animation (.psa file) to export")
+
+		print()
+
+	print("Export completed in {:.2f} seconds".format((time.clock() - t)))
+
+from bpy.props import *
+
+#===========================================================================
+# Operator
+#===========================================================================
+class Operator_UDKExport( bpy.types.Operator ):
+
+	bl_idname	= "object.udk_export"
+	bl_label	= "Export now"
+	__doc__		= "Export to UDK"
+	
+	def execute(self, context):
+		print( "\n"*8 )
+		
+		scene = bpy.context.scene
+		
+		scene.udk_option_export_psk	= (scene.udk_option_export == '0' or scene.udk_option_export == '2')
+		scene.udk_option_export_psa	= (scene.udk_option_export == '1' or scene.udk_option_export == '2')
+		
+		filepath = get_dst_path()
+		
+		# cache settings
+		restore_frame = scene.frame_current
+		
+		message = "Finish Export!"
+		try:
+			export(filepath)
+
+		except Error as err:
+			print(err.message)
+			message = err.message
+		
+		# restore settings
+		scene.frame_set(restore_frame)
+        
+		self.report({'ERROR'}, message)
+		
+		# restore settings
+		scene.frame_set(restore_frame)
+		
+		return {'FINISHED'}
+
+#===========================================================================
+# Operator
+#===========================================================================
+class Operator_ToggleConsole( bpy.types.Operator ):
+
+	bl_idname	= "object.toggle_console"
+	bl_label	= "Toggle console"
+	__doc__		= "Show or hide the console"
+	
+	#def invoke(self, context, event):
+	#   bpy.ops.wm.console_toggle()
+	#   return{'FINISHED'}
+	def execute(self, context):
+		bpy.ops.wm.console_toggle()
+		return {'FINISHED'}
+
+
+#===========================================================================
+# Get filepath for export
+#===========================================================================
+def get_dst_path():
+	if bpy.context.scene.udk_option_filename_src == '0':
+		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";
+	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",
+		description = "Sets the name for the files",
+		items		= [ ('0', "From object",	"Name will be taken from object name"),
+						('1', "From Blend",		"Name will be taken from .blend file name") ],
+		default		= '0')
+	
+bpy.types.Scene.udk_option_export_psk = BoolProperty(
+		name		= "bool export psa",
+		description	= "bool for exporting this psk format",
+		default		= True)
+
+bpy.types.Scene.udk_option_export_psa = BoolProperty(
+		name		= "bool export psa",
+		description	= "bool for exporting this psa format",
+		default		= True)
+
+bpy.types.Scene.udk_option_clamp_uv = BoolProperty(
+		name		= "Clamp UV",
+		description	= "Clamp UV co-ordinates to [0-1]",
+		default		= False)
+
+bpy.types.Scene.udk_option_export = EnumProperty(
+		name		= "Export",
+		description	= "What to export",
+		items		= [ ('0', "Mesh only",			"Exports the PSK file for the skeletal mesh"),
+						('1', "Animation only",		"Export the PSA file for animations"),
+						('2', "Mesh & Animation",	"Export both PSK and PSA files") ],
+		default		= '2')
+
+bpy.types.Scene.udk_option_verbose = BoolProperty(
+		name		= "Verbose",
+		description	= "Verbose console output",
+		default		= False)
+
+bpy.types.Scene.udk_option_smoothing_groups = BoolProperty(
+		name		= "Smooth Groups",
+		description	= "Activate hard edges as smooth groups",
+		default		= True)
+
+bpy.types.Scene.udk_option_triangulate = BoolProperty(
+		name		= "Triangulate Mesh",
+		description	= "Convert Quads to Triangles",
+		default		= False)
+		
+
+#===========================================================================
+# User interface
+#===========================================================================
+class Panel_UDKExport( bpy.types.Panel ):
+
+	bl_label		= "UDK Export"
+	bl_idname		= "OBJECT_PT_udk_tools"
+	#bl_space_type	= "PROPERTIES"
+	#bl_region_type	= "WINDOW"
+	#bl_context		= "object"
+	bl_space_type	= "VIEW_3D"
+	bl_region_type	= "TOOLS"
+	
+	#def draw_header(self, context):
+	#	layout = self.layout
+		#obj = context.object
+		#layout.prop(obj, "select", text="")
+	
+	#@classmethod
+	#def poll(cls, context):
+	#	return context.active_object
+
+	def draw(self, context):
+		layout = self.layout
+		path = get_dst_path()
+
+		object_name = ""
+		#if context.object:
+		#	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")
+
+		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()
+		
+		layout.operator("object.toggle_console")
+
+		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
+    bl_label = "Export PSK/PSA"
+    __doc__ = """One mesh and one armature else select one mesh or armature to be exported"""
+
+    # 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;*.psa",
+            options={'HIDDEN'},
+            )
+    udk_option_smoothing_groups = bpy.types.Scene.udk_option_smoothing_groups
+    udk_option_clamp_uv = bpy.types.Scene.udk_option_clamp_uv
+    udk_option_verbose = bpy.types.Scene.udk_option_verbose
+    udk_option_filename_src = bpy.types.Scene.udk_option_filename_src
+    udk_option_export = bpy.types.Scene.udk_option_export
     
     @classmethod
     def poll(cls, context):
-        return context.active_object
-
-    def draw(self, context):
-        layout = self.layout
-        rd = context.scene
-        layout.prop(rd, "unrealexport_settings",expand=True)
-        layout.prop(rd, "UEActionSetSettings")
-        layout.prop(rd, "unrealignoreactionmatchcount")
-        
-        #FPS #it use the real data from your scene
-        layout.prop(rd.render, "fps")
-        layout.prop(rd, "limituv")
-        layout.operator(OBJECT_OT_UnrealExport.bl_idname)
-        
-        layout.prop(rd, "unrealdisplayactionsets")
+        return context.active_object != None
+
+    def execute(self, context):
+        scene = bpy.context.scene
+        scene.udk_option_export_psk	= (scene.udk_option_export == '0' or scene.udk_option_export == '2')
+        scene.udk_option_export_psa	= (scene.udk_option_export == '1' or scene.udk_option_export == '2')
+		
+        filepath = get_dst_path()
+		
+		# cache settings
+        restore_frame = scene.frame_current
+		
+        message = "Finish Export!"
+        try:
+            export(filepath)
+
+        except Error as err:
+            print(err.message)
+            message = err.message
+		
+		# restore settings
+        scene.frame_set(restore_frame)
         
-        ArmatureSelect = None
-        for obj in bpy.data.objects:
-            if obj.type == 'ARMATURE' and obj.select == True:
-                #print("Armature Name:",obj.name)
-                ArmatureSelect = obj
-                break
-        #display armature actions list
-        if ArmatureSelect != None and rd.unrealdisplayactionsets == True:
-            layout.label(("Selected: "+ArmatureSelect.name))
-            row = layout.row()
-            row.template_list(obj, "myCollectionUEA", obj, "myCollectionUEA_index")                        # This show list for the collection
-            col = row.column(align=True)
-            col.operator("collection.add_remove_ueactions", icon="ZOOMIN", text="").set = "add"            # This show a plus sign button
-            col.operator("collection.add_remove_ueactions", icon="ZOOMOUT", text="").set = "remove"        # This show a minus sign button        
-            col.operator("collection.add_remove_ueactions", icon="FILE_REFRESH", text="").set = "refresh"  # This show a refresh sign button
-            
-            ##change name of Entry:
-            if obj.myCollectionUEA:
-                entry = obj.myCollectionUEA[obj.myCollectionUEA_index]
-                layout.prop(entry, "name")
-                layout.prop(entry, "mybool")
-        layout.operator(OBJECT_OT_UTSelectedFaceSmooth.bl_idname)        
-        layout.operator(OBJECT_OT_UTRebuildArmature.bl_idname)
-        layout.operator(OBJECT_OT_UTRebuildMesh.bl_idname)
-        layout.operator(OBJECT_OT_ToggleConsle.bl_idname)
-        layout.operator(OBJECT_OT_DeleteActionSet.bl_idname)
-        layout.operator(OBJECT_OT_MeshClearWeights.bl_idname)
+        self.report({'WARNING', 'INFO'}, message)
+        return {'FINISHED'}
         
-class OBJECT_OT_UnrealExport(bpy.types.Operator):
-    global exportmessage
-    bl_idname = "export_mesh.udk"  # XXX, name???
-    bl_label = "Unreal Export"
-    __doc__ = """Select export setting for .psk/.psa or both"""
-    
-    def invoke(self, context, event):
-        print("Init Export Script:")
-        if(int(bpy.context.scene.unrealexport_settings) == 0):
-            bpy.context.scene.unrealexportpsk = True
-            bpy.context.scene.unrealexportpsa = False
-            print("Exporting PSK...")
-        if(int(bpy.context.scene.unrealexport_settings) == 1):
-            bpy.context.scene.unrealexportpsk = False
-            bpy.context.scene.unrealexportpsa = True
-            print("Exporting PSA...")
-        if(int(bpy.context.scene.unrealexport_settings) == 2):
-            bpy.context.scene.unrealexportpsk = True
-            bpy.context.scene.unrealexportpsa = True
-            print("Exporting ALL...")
-
-        default_path = os.path.splitext(bpy.data.filepath)[0] + ".psk"
-        fs_callback(default_path, bpy.context)        
-        #self.report({'WARNING', 'INFO'}, exportmessage)
-        self.report({'INFO'}, exportmessage)
-        return{'FINISHED'}   
-
-class OBJECT_OT_ToggleConsle(bpy.types.Operator):
-    global exportmessage
-    bl_idname = "object.toggleconsle"  # XXX, name???
-    bl_label = "Toggle Console"
-    __doc__ = "Show or Hide Console"
-    
     def invoke(self, context, event):
-        bpy.ops.wm.console_toggle()
-        return{'FINISHED'} 
-
-class OBJECT_OT_UTSelectedFaceSmooth(bpy.types.Operator):
-    bl_idname = "object.utselectfacesmooth"  # XXX, name???
-    bl_label = "Select Smooth faces"
-    __doc__ = """It will only select smooth faces that is select mesh"""
-    
-    def invoke(self, context, event):
-        print("----------------------------------------")
-        print("Init Select Face(s):")
-        bselected = False
-        for obj in bpy.data.objects:
-            if obj.type == 'MESH' and obj.select == True:
-                smoothcount = 0
-                flatcount = 0
-                bpy.ops.object.mode_set(mode='OBJECT')#it need to go into object mode to able to select the faces
-                for i in bpy.context.scene.objects: i.select = False #deselect all objects
-                obj.select = True #set current object select
-                bpy.context.scene.objects.active = obj #set active object
-                for face in obj.data.faces:
-                    if face.use_smooth == True:
-                        face.select = True
-                        smoothcount += 1
-                    else:
-                        flatcount += 1
-                        face.select = False
-                    #print("selected:",face.select)
-                    #print(("smooth:",face.use_smooth))
-                bpy.context.scene.update()
-                bpy.ops.object.mode_set(mode='EDIT')
-                print("Select Smooth Count(s):",smoothcount," Flat Count(s):",flatcount)
-                bselected = True
-                break
-        if bselected:
-            print("Selected Face(s) Exectue!")
-            self.report({'INFO'}, "Selected Face(s) Exectue!")
-        else:
-            print("Didn't select Mesh Object!")
-            self.report({'INFO'}, "Didn't Select Mesh Object!")
-        print("----------------------------------------")        
-        return{'FINISHED'}
-		
-class OBJECT_OT_DeleteActionSet(bpy.types.Operator):
-    bl_idname = "object.deleteactionset"  # XXX, name???
-    bl_label = "Delete Action Set"
-    __doc__ = """It will remove the first top of the index of the action list. Reload file to remove it. It used for unable to delete action set. """
-    
-    def invoke(self, context, event):
-        if len(bpy.data.actions) > 0:
-            for action in bpy.data.actions:
-                print("Action:",action.name)
-                action.user_clear()
-                break
-            #bpy.data.actions.remove(act)
-        print("finish")
-        return{'FINISHED'}
-			
-class OBJECT_OT_MeshClearWeights(bpy.types.Operator):
-    bl_idname = "object.meshclearweights"  # XXX, name???
-    bl_label = "Mesh Clear Weights"
-    __doc__ = """Clear selected mesh vertex group weights for the bones. Be sure you unparent the armature"""
-    
-    def invoke(self, context, event):
-        for obj in bpy.data.objects:
-            if obj.type == 'MESH' and obj.select == True:
-                for vg in obj.vertex_groups:
-                    obj.vertex_groups.remove(vg)
-                break			
-        return{'FINISHED'}
-		
-class OBJECT_OT_UTRebuildArmature(bpy.types.Operator):
-    bl_idname = "object.utrebuildarmature"  # XXX, name???
-    bl_label = "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):
-        print("----------------------------------------")
-        print("Init Rebuild Armature...")
-        bselected = False
-        for obj in bpy.data.objects:
-            if obj.type == 'ARMATURE' and obj.select == True:
-                currentbone = [] #select armature for roll copy
-                print("Armature Name:",obj.name)
-                objectname = "ArmatureDataPSK"
-                meshname ="ArmatureObjectPSK"
-                armdata = bpy.data.armatures.new(objectname)
-                ob_new = bpy.data.objects.new(meshname, 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
-                bpy.context.scene.objects.active = obj
-                
-                bpy.ops.object.mode_set(mode='EDIT')
-                for bone in obj.data.edit_bones:
-                    if bone.parent != None:
-                        currentbone.append([bone.name,bone.roll])
-                    else:
-                        currentbone.append([bone.name,bone.roll])
-                bpy.ops.object.mode_set(mode='OBJECT')
-                for i in bpy.context.scene.objects: i.select = False #deselect all objects
-                bpy.context.scene.objects.active = ob_new
-                bpy.ops.object.mode_set(mode='EDIT')
-                
-                for bone in obj.data.bones:
-                    bpy.ops.object.mode_set(mode='EDIT')
-                    newbone = ob_new.data.edit_bones.new(bone.name)
-                    newbone.head = bone.head_local
-                    newbone.tail = bone.tail_local
-                    for bonelist in currentbone:
-                        if bone.name == bonelist[0]:
-                            newbone.roll = bonelist[1]
-                            break
-                    if bone.parent != None:
-                        parentbone = ob_new.data.edit_bones[bone.parent.name]
-                        newbone.parent = parentbone
-                print("Bone Count:",len(obj.data.bones))
-                print("Hold Bone Count",len(currentbone))
-                print("New Bone Count",len(ob_new.data.edit_bones))
-                print("Rebuild Armture Finish:",ob_new.name)
-                bpy.context.scene.update()
-                bselected = True
-                break
-        if bselected:
-            self.report({'INFO'}, "Rebuild Armature Finish!")
-        else:
-            self.report({'INFO'}, "Didn't Select Armature Object!")
-        print("End of Rebuild Armature.")
-        print("----------------------------------------")
-        return{'FINISHED'}
-		
-# rounded the vert locations to save a bit of blurb.. change the round value or remove for accuracy i suppose
-def rounded_tuple(tup):
-    return tuple(round(value,4) for value in tup)
-	
-def unpack_list(list_of_tuples):
-    l = []
-    for t in list_of_tuples:
-        l.extend(t)
-    return l
-	
-class OBJECT_OT_UTRebuildMesh(bpy.types.Operator):
-    bl_idname = "object.utrebuildmesh"  # XXX, name???
-    bl_label = "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):
-        print("----------------------------------------")
-        print("Init Mesh Bebuild...")
-        bselected = False
-        for obj in bpy.data.objects:
-            if obj.type == 'MESH' and obj.select == True:
-                for i in bpy.context.scene.objects: i.select = False #deselect all objects
-                obj.select = True
-                bpy.context.scene.objects.active = obj
-                bpy.ops.object.mode_set(mode='OBJECT')
-                me_ob = bpy.data.meshes.new(("Re_"+obj.name))
-                mesh = obj.data
-                faces = []
-                verts = []
-                smoothings = []
-                uvfaces = []
-                #print(dir(mesh))
-                print("creating array build mesh...")
-                uv_layer = mesh.uv_textures.active
-                for face in mesh.faces:
-                    smoothings.append(face.use_smooth)#smooth or flat in boolean
-                    if uv_layer != None:#check if there texture data exist
-                        faceUV = uv_layer.data[face.index]
-                        #print(len(faceUV.uv))
-                        uvs = []
-                        for uv in faceUV.uv:
-                            #vert = mesh.vertices[videx]
-                            #print("UV:",uv[0],":",uv[1])
-                            uvs.append((uv[0],uv[1]))
-                        #print(uvs)
-                        uvfaces.append(uvs)
-                    faces.append(face.vertices[:])           
-                #vertex positions
-                for vertex in mesh.vertices:
-                    verts.append(vertex.co.to_tuple())				
-                #vertices weight groups into array
-                vertGroups = {} #array in strings
-                for vgroup in obj.vertex_groups:
-                    #print(dir(vgroup))
-                    #print("name:",(vgroup.name),"index:",vgroup.index)
-                    #vertex in index and weight
-                    vlist = []
-                    for v in mesh.vertices:
-                        for vg in v.groups:
-                            if vg.group == vgroup.index:
-                                vlist.append((v.index,vg.weight))
-                                #print((v.index,vg.weight))
-                    vertGroups[vgroup.name] = vlist					
-                '''
-				#Fail for this method
-				#can't covert the tri face plogyon
-                for face in mesh.faces:
-                    x = [f for f in face.vertices]
-                    faces.extend(x)
-                    smoothings.append(face.use_smooth)
-                for vertex in mesh.vertices:
-                    verts.append(vertex.co.to_tuple())
-                me_ob.vertices.add(len(verts))
-                me_ob.faces.add(len(faces)//4)
-                me_ob.vertices.foreach_set("co", unpack_list(verts))
-                me_ob.faces.foreach_set("vertices_raw", faces)
-                me_ob.faces.foreach_set("use_smooth", smoothings)
-                '''
-                #test dummy mesh
-                #verts = [(-1,1,0),(1,1,0),(1,-1,0),(-1,-1,0),(0,1,1),(0,-1,1)]
-                #faces = [(0,1,2,3),(1,2,5,4),(0,3,5,4),(0,1,4),(2,3,5)]
-                #for f in faces:
-                    #print("face",f)
-                #for v in verts:
-                    #print("vertex",v)
-                #me_ob = bpy.data.objects.new("ReBuildMesh",me_ob)
-                print("creating mesh object...")
-                me_ob.from_pydata(verts, [], faces)
-                me_ob.faces.foreach_set("use_smooth", smoothings)#smooth array from face
-                me_ob.update()
-                #check if there is uv faces
-                if len(uvfaces) > 0:
-                    uvtex = me_ob.uv_textures.new(name="retex")
-                    for i, face in enumerate(me_ob.faces):
-                        blender_tface = uvtex.data[i] #face
-                        mfaceuv = uvfaces[i]
-                        if len(mfaceuv) == 3:
-                            blender_tface.uv1 = mfaceuv[0];
-                            blender_tface.uv2 = mfaceuv[1];
-                            blender_tface.uv3 = mfaceuv[2];
-                        if len(mfaceuv) == 4:
-                            blender_tface.uv1 = mfaceuv[0];
-                            blender_tface.uv2 = mfaceuv[1];
-                            blender_tface.uv3 = mfaceuv[2];
-                            blender_tface.uv4 = mfaceuv[3];
-                
-                obmesh = bpy.data.objects.new(("Re_"+obj.name),me_ob)
-                bpy.context.scene.update()
-                #Build tmp materials
-                materialname = "ReMaterial"
-                for matcount in mesh.materials:
-                    matdata = bpy.data.materials.new(materialname)
-                    me_ob.materials.append(matdata)
-                #assign face to material id
-                for face in mesh.faces:
-                    #print(dir(face))
-                    me_ob.faces[face.index].material_index = face.material_index
-                #vertices weight groups
-                for vgroup in vertGroups:
-                    #print("vgroup",vgroup)#name of group
-                    #print(dir(vgroup))
-                    #print(vertGroups[vgroup])
-                    group = obmesh.vertex_groups.new(vgroup)
-                    #print("group index",group.index)
-                    for v in vertGroups[vgroup]:
-                        group.add([v[0]], v[1], 'ADD')# group.add(array[vertex id],weight,add)
-                        #print("[vertex id, weight]",v) #array (0,0)
-                        #print("[vertex id, weight]",v[0],":",v[1]) #array (0,0)
-                bpy.context.scene.objects.link(obmesh)
-                print("Mesh Material Count:",len(me_ob.materials))
-                matcount = 0
-                print("MATERIAL ID OREDER:")
-                for mat in me_ob.materials:
-                    print("-Material:",mat.name,"INDEX:",matcount)
-                    matcount += 1
-                print("")
-                print("Object Name:",obmesh.name)
-                bpy.context.scene.update()
-                #bpy.ops.wm.console_toggle()
-                bselected = True
-                break
-        if bselected:
-            self.report({'INFO'}, "Rebuild Mesh Finish!")
-            print("Finish Mesh Build...")
-        else:
-            self.report({'INFO'}, "Didn't Select Mesh Object!")
-            print("Didn't Select Mesh Object!")
-        print("----------------------------------------")
-        
-        return{'FINISHED'}
-
+        wm = context.window_manager
+        wm.fileselect_add(self)
+        return {'RUNNING_MODAL'}		
 def menu_func(self, context):
-    #bpy.context.scene.unrealexportpsk = True
-    #bpy.context.scene.unrealexportpsa = True
     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
-
+#===========================================================================
+# Entry
+#===========================================================================
 def register():
-    bpy.utils.register_module(__name__)
-    bpy.types.INFO_MT_file_export.append(menu_func)
+	#print("REGISTER")
+	bpy.utils.register_module(__name__)
+	bpy.types.INFO_MT_file_export.append(menu_func)
 
 def unregister():
-    bpy.utils.unregister_module(__name__)
-    bpy.types.INFO_MT_file_export.remove(menu_func)
-
+	#print("UNREGISTER")
+	bpy.utils.unregister_module(__name__)
+	bpy.types.INFO_MT_file_export.remove(menu_func)
+	
 if __name__ == "__main__":
-    register()
+	#print("\n"*4)
+	print(header("UDK Export PSK/PSA Alpha 0.1", 'CENTER'))
+	register()
+	
+#loader
+#filename = "D:/Projects/BlenderScripts/io_export_udk_psa_psk_alpha.py"
+#exec(compile(open(filename).read(), filename, 'exec'))
\ No newline at end of file
diff --git a/release/scripts/addons/io_import_images_as_planes.py b/release/scripts/addons/io_import_images_as_planes.py
index 10549a0..6a4797b 100644
--- a/release/scripts/addons/io_import_images_as_planes.py
+++ b/release/scripts/addons/io_import_images_as_planes.py
@@ -19,8 +19,8 @@
 bl_info = {
     "name": "Import Images as Planes",
     "author": "Florian Meyer (tstscr)",
-    "version": (1, 0),
-    "blender": (2, 6, 1),
+    "version": (1, 1),
+    "blender": (2, 6, 3),
     "location": "File > Import > Images as Planes",
     "description": "Imports images and creates planes with the appropriate "
                    "aspect ratio. The images are mapped to the planes.",
@@ -42,7 +42,7 @@ from bpy.props import (BoolProperty,
                        FloatProperty,
                        )
 
-from add_utils import AddObjectHelper, add_object_data
+from bpy_extras.object_utils import AddObjectHelper, object_data_add
 from bpy_extras.io_utils import ImportHelper
 from bpy_extras.image_utils import load_image
 
@@ -126,6 +126,7 @@ def create_material_for_texture(self, texture):
             material.use_transparency = self.use_transparency
             material.transparency_method = self.transparency_method
             material.use_shadeless = self.use_shadeless
+            material.use_transparent_shadows = self.use_transparent_shadows
             return material
 
     # if no material found: create one
@@ -145,6 +146,7 @@ def create_material_for_texture(self, texture):
     material.use_transparency = self.use_transparency
     material.transparency_method = self.transparency_method
     material.use_shadeless = self.use_shadeless
+    material.use_transparent_shadows = self.use_transparent_shadows
 
     return material
 
@@ -174,7 +176,7 @@ def create_image_plane(self, context, material):
     mesh_data = bpy.data.meshes.new(img.name)
     mesh_data.from_pydata(verts, [], faces)
     mesh_data.update()
-    add_object_data(context, mesh_data, operator=self)
+    object_data_add(context, mesh_data, operator=self)
     plane = context.scene.objects.active
     plane.data.uv_textures.new()
     plane.data.materials.append(material)
@@ -347,6 +349,11 @@ class IMPORT_OT_image_to_plane(Operator, ImportHelper, AddObjectHelper):
             'Raytrace',
             'Use raytracing for transparent refraction rendering.')),
             )
+    use_transparent_shadows = BoolProperty(
+            name="Receive Transparent",
+            description="Set material to receive transparent shadows",
+            default=False,
+            )
 
     # -------------
     # Image Options
@@ -380,6 +387,7 @@ class IMPORT_OT_image_to_plane(Operator, ImportHelper, AddObjectHelper):
         box.prop(self, "use_transparency")
         box.prop(self, "use_premultiply")
         box.prop(self, "transparency_method", expand=True)
+        box.prop(self, "use_transparent_shadows")
 
         box = layout.box()
         box.label("Plane dimensions:", icon='ARROW_LEFTRIGHT')
diff --git a/release/scripts/addons/io_import_scene_dxf.py b/release/scripts/addons/io_import_scene_dxf.py
index e1bec29..406063b 100644
--- a/release/scripts/addons/io_import_scene_dxf.py
+++ b/release/scripts/addons/io_import_scene_dxf.py
@@ -20,12 +20,11 @@ bl_info = {
     'name': 'Import Autocad DXF Format (.dxf)',
     'author': 'Thomas Larsson, Remigiusz Fiedler',
     'version': (0, 1, 6),
-    "blender": (2, 6, 1),
+    'blender': (2, 6, 3),
     'location': 'File > Import > Autocad (.dxf)',
     'description': 'Import files in the Autocad DXF format (.dxf)',
-    'warning': 'Only a subset of DXF specification is supported now.'\
-        ' Please support further development!',
-    'wiki_url': 'http://wiki.blender.org/index.php/Extensions:2.5/Py/'\
+    'warning': 'Under construction! Visit Wiki for details.',
+    'wiki_url': 'http://wiki.blender.org/index.php/Extensions:2.6/Py/'\
         'Scripts/Import-Export/DXF_Importer',
     'tracker_url': 'https://projects.blender.org/tracker/index.php?'\
         'func=detail&aid=23480',
@@ -107,7 +106,7 @@ T_ThicON = 0x40
 
 toggle = T_Merge | T_NewScene | T_DrawOne | T_ThicON
 theCircleRes = 32
-theMergeLimit = 1e-5
+theMergeLimit = 1e-4
 
 #
 #    class CSection:
@@ -2352,7 +2351,7 @@ def removeDoubles(ob):
         scn = bpy.context.scene
         scn.objects.active = ob
         bpy.ops.object.mode_set(mode='EDIT')
-        bpy.ops.mesh.remove_doubles(limit=theMergeLimit)
+        bpy.ops.mesh.remove_doubles(mergedist=theMergeLimit)
         bpy.ops.object.mode_set(mode='OBJECT')
 
 
@@ -2458,21 +2457,21 @@ class IMPORT_OT_autocad_dxf(bpy.types.Operator):
             )
     mergeLimit = FloatProperty(
             name="Limit",
-            description="Merge limit",
+            description="Merge limit * 0.0001",
             default=theMergeLimit * 1e4,
             min=1.0,
             soft_min=1.0,
-            max=100.0,
-            soft_max=100.0,
+            max=1000.0,
+            soft_max=1000.0,
             )
     draw_one = BoolProperty(
             name="Merge all",
-            description="Draw all into one mesh-object",
+            description="Draw all into one mesh object",
             default=toggle & T_DrawOne,
             )
     circleResolution = IntProperty(
             name="Circle resolution",
-            description="Circle/Arc are aproximated with this factor",
+            description="Circle/Arc are approximated with this factor",
             default=theCircleRes,
             min=4,
             soft_min=4,
diff --git a/release/scripts/addons/io_import_scene_lwo.py b/release/scripts/addons/io_import_scene_lwo.py
index be786e1..1fa44c2 100644
--- a/release/scripts/addons/io_import_scene_lwo.py
+++ b/release/scripts/addons/io_import_scene_lwo.py
@@ -68,7 +68,7 @@ import chunk
 
 import bpy
 import mathutils
-from mathutils.geometry import tesselate_polygon
+from mathutils.geometry import tessellate_polygon
 
 
 class _obj_layer(object):
@@ -1019,7 +1019,7 @@ def build_objects(object_layers, object_surfs, object_tags, object_name, add_sub
     for layer_data in object_layers:
         me= bpy.data.meshes.new(layer_data.name)
         me.vertices.add(len(layer_data.pnts))
-        me.faces.add(len(layer_data.pols))
+        me.tessfaces.add(len(layer_data.pols))
         # for vi in range(len(layer_data.pnts)):
         #     me.vertices[vi].co= layer_data.pnts[vi]
 
@@ -1038,7 +1038,7 @@ def build_objects(object_layers, object_surfs, object_tags, object_name, add_sub
             vlen= len(fpol)
             if vlen == 3 or vlen == 4:
                 for i in range(vlen):
-                    me.faces[fi].vertices_raw[i]= fpol[i]
+                    me.tessfaces[fi].vertices_raw[i]= fpol[i]
             elif vlen == 2:
                 edges.append(fi)
             elif vlen != 1:
@@ -1058,8 +1058,8 @@ def build_objects(object_layers, object_surfs, object_tags, object_name, add_sub
                 me.materials.append(object_surfs[object_tags[surf_key]].bl_mat)
 
                 for fi in layer_data.surf_tags[surf_key]:
-                    me.faces[fi].material_index= mat_slot
-                    me.faces[fi].use_smooth= object_surfs[object_tags[surf_key]].smooth
+                    me.tessfaces[fi].material_index= mat_slot
+                    me.tessfaces[fi].use_smooth= object_surfs[object_tags[surf_key]].smooth
 
                 mat_slot+=1
 
@@ -1109,7 +1109,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(uvmap_key)
+                uvm= me.uv_textures.new(name=uvmap_key)
+                uvloop = me.uv_layers[-1]
+                uvm = uvloop.data
                 if not uvm:
                     break
                 for fi in map_pack:
@@ -1128,15 +1130,15 @@ def build_objects(object_layers, object_surfs, object_tags, object_name, add_sub
         # Now add the NGons.
         if len(ngons) > 0:
             for ng_key in ngons:
-                face_offset= len(me.faces)
+                face_offset= len(me.tessfaces)
                 ng= ngons[ng_key]
                 v_locs= []
                 for vi in range(len(ng)):
                     v_locs.append(mathutils.Vector(layer_data.pnts[ngons[ng_key][vi]]))
-                tris= tesselate_polygon([v_locs])
-                me.faces.add(len(tris))
+                tris= tessellate_polygon([v_locs])
+                me.tessfaces.add(len(tris))
                 for tri in tris:
-                    face= me.faces[face_offset]
+                    face= me.tessfaces[face_offset]
                     face.vertices_raw[0]= ng[tri[0]]
                     face.vertices_raw[1]= ng[tri[1]]
                     face.vertices_raw[2]= ng[tri[2]]
diff --git a/release/scripts/addons/io_import_scene_mhx.py b/release/scripts/addons/io_import_scene_mhx.py
index 6426318..5c9b84d 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.10.2
+Version 1.12.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, 10, 2),
-    "blender": (2, 5, 9),
+    'version': (1, 12, 0),
+    "blender": (2, 6, 3),
     'location': "File > Import > MakeHuman (.mhx)",
     'description': 'Import files in the MakeHuman eXchange format (.mhx)',
     'warning': '',
@@ -50,9 +50,8 @@ bl_info = {
     'category': 'Import-Export'}
 
 MAJOR_VERSION = 1
-MINOR_VERSION = 10
-SUB_VERSION = 2
-BLENDER_VERSION = (2, 59, 2)
+MINOR_VERSION = 12
+SUB_VERSION = 0
 
 #
 #
@@ -61,7 +60,9 @@ BLENDER_VERSION = (2, 59, 2)
 import bpy
 import os
 import time
+import math
 import mathutils
+from mathutils import Vector, Matrix
 from bpy.props import *
 
 MHX249 = False
@@ -96,7 +97,8 @@ todo = []
 
 T_EnforceVersion = 0x01
 T_Clothes = 0x02
-T_Stretch = 0x04
+T_HardParents = 0x0
+T_CrashSafe = 0x0
 
 T_Diamond = 0x10
 T_Replace = 0x20
@@ -188,38 +190,19 @@ Plural = {
 }
 
 #
-#    checkBlenderVersion()
-#
-
-def checkBlenderVersion():
-    print("Found Blender", bpy.app.version)
-    (A, B, C) = bpy.app.version
-    (a, b, c) = BLENDER_VERSION
-    if a <= A: return
-    if b <= B: return
-    if c <= C: return
-    msg = (
-"This version of the MHX importer only works with \n" +
-"Blender (%d, %d, %d) or later.\n" % (a, b, c) +
-"Download a more recent Blender from \n" +
-"www.blender.org or www.graphicall.org.\n"
-    )
-    MyError(msg)
-    return
-
-#
 #    readMhxFile(filePath):
 #
 
 def readMhxFile(filePath):
-    global todo, nErrors, theScale, defaultScale, One, toggle, warnedVersion
+    global todo, nErrors, theScale, defaultScale, One, toggle, warnedVersion, BMeshAware, theMessage
 
-    #checkBlenderVersion()    
-    
+    print("Blender r%s" % bpy.app.build_revision)
+    BMeshAware = (int(bpy.app.build_revision) > 44136)    
     defaultScale = theScale
     One = 1.0/theScale
     warnedVersion = False
     initLoadedData()
+    theMessage = ""
 
     fileName = os.path.expanduser(filePath)
     (shortName, ext) = os.path.splitext(fileName)
@@ -1051,16 +1034,11 @@ def parseObject(args, tokens):
             parseDefault(ob.field, sub, {}, [])
         else:
             defaultKey(key, val, sub, "ob", ['type', 'data'], globals(), locals())
-
-    # Needed for updating layers
+            
     if bpy.context.object == ob:
-        pass
-        '''
-        if ob.data in ['MESH', 'ARMATURE']:
-            print(ob, ob.data)
-            bpy.ops.object.mode_set(mode='EDIT')
-            bpy.ops.object.mode_set(mode='OBJECT')
-        '''
+        if ob.type == 'MESH':
+            print("Smooth shade", ob)
+            bpy.ops.object.shade_smooth()
     else:
         print("Context", ob, bpy.context.object, bpy.context.scene.objects.active)
     return
@@ -1244,12 +1222,16 @@ def parseMesh (args, tokens):
     linkObject(ob, me)
         
     mats = []
+    nuvlayers = 0
     for (key, val, sub) in tokens:
         if key == 'Verts' or key == 'Edges' or key == 'Faces':
             pass
         elif key == 'MeshTextureFaceLayer':
-            parseUvTexture(val, sub, me)
-        elif key == 'MeshColorLayer':
+            if BMeshAware:
+                parseUvTextureBMesh(val, sub, me)
+            else:
+                parseUvTextureNoBMesh(val, sub, me)
+        elif key == 'MeshColorLayer':            
             parseVertColorLayer(val, sub, me)
         elif key == 'VertexGroup':
             parseVertexGroup(ob, me, val, sub)
@@ -1267,7 +1249,10 @@ def parseMesh (args, tokens):
 
     for (key, val, sub) in tokens:
         if key == 'Faces':
-            parseFaces2(sub, me)
+            if BMeshAware:
+                parseFaces2BMesh(sub, me)
+            else:
+                parseFaces2NoBMesh(sub, me)
     print(me)
     return me
 
@@ -1303,7 +1288,37 @@ def parseFaces(tokens):
             faces.append(face)
     return faces
 
-def parseFaces2(tokens, me):    
+def parseFaces2BMesh(tokens, me):    
+    n = 0
+    for (key, val, sub) in tokens:
+        if key == 'ft':
+            f = me.polygons[n]
+            f.material_index = int(val[0])
+            f.use_smooth = int(val[1])
+            n += 1
+        elif key == 'ftn':
+            mn = int(val[1])
+            us = int(val[2])
+            npts = int(val[0])
+            for i in range(npts):
+                f = me.polygons[n]
+                f.material_index = mn
+                f.use_smooth = us
+                n += 1
+        elif key == 'mn':
+            fn = int(val[0])
+            mn = int(val[1])
+            f = me.polygons[fn]
+            f.material_index = mn
+        elif key == 'ftall':
+            mat = int(val[0])
+            smooth = int(val[1])
+            for f in me.polygons:
+                f.material_index = mat
+                f.use_smooth = smooth
+    return
+
+def parseFaces2NoBMesh(tokens, me):    
     n = 0
     for (key, val, sub) in tokens:
         if key == 'ft':
@@ -1335,23 +1350,51 @@ def parseFaces2(tokens, me):
 
 
 #
-#    parseUvTexture(args, tokens, me):
+#    parseUvTexture(args, tokens, me,):
 #    parseUvTexData(args, tokens, uvdata):
 #
 
-def parseUvTexture(args, tokens, me):
+def parseUvTextureBMesh(args, tokens, me):
     name = args[0]
-    me.uv_textures.new(name = name)
+    bpy.ops.mesh.uv_texture_add()
     uvtex = me.uv_textures[-1]
+    uvtex.name = name
+    uvloop = me.uv_layers[-1]
+    loadedData['MeshTextureFaceLayer'][name] = uvloop    
+    for (key, val, sub) in tokens:
+        if key == 'Data':
+            parseUvTexDataBMesh(val, sub, uvloop.data)
+        else:
+            defaultKey(key, val,  sub, "uvtex", [], globals(), locals())
+    return
+
+def parseUvTexDataBMesh(args, tokens, data):
+    n = 0
+    for (key, val, sub) in tokens:
+        if key == 'vt':
+            data[n].uv = (float(val[0]), float(val[1]))
+            n += 1
+            data[n].uv = (float(val[2]), float(val[3]))
+            n += 1
+            data[n].uv = (float(val[4]), float(val[5]))
+            n += 1
+            if len(val) > 6:
+                data[n].uv = (float(val[6]), float(val[7]))
+                n += 1
+    return
+
+def parseUvTextureNoBMesh(args, tokens, me):
+    name = args[0]
+    uvtex = me.uv_textures.new(name = name)
     loadedData['MeshTextureFaceLayer'][name] = uvtex
     for (key, val, sub) in tokens:
         if key == 'Data':
-            parseUvTexData(val, sub, uvtex.data)
+            parseUvTexDataNoBMesh(val, sub, uvtex.data)
         else:
             defaultKey(key, val,  sub, "uvtex", [], globals(), locals())
     return
 
-def parseUvTexData(args, tokens, data):
+def parseUvTexDataNoBMesh(args, tokens, data):
     n = 0
     for (key, val, sub) in tokens:
         if key == 'vt':
@@ -1361,10 +1404,6 @@ def parseUvTexData(args, tokens, data):
             if len(val) > 6:
                 data[n].uv4 = (float(val[6]), float(val[7]))
             n += 1    
-        else:
-            pass
-            #for i in range(n):
-            #    defaultKey(key, val,  sub, "data[i]", [], globals(), locals())
     return
 
 #
@@ -2007,7 +2046,7 @@ def postProcess(args):
     except:
         ob = None
     if toggle & T_Diamond == 0 and ob:
-        deleteDiamonds(ob)
+        deleteDiamonds(ob)        
     return            
 
 #
@@ -2032,14 +2071,26 @@ def deleteDiamonds(ob):
             break
     if invisioNum < 0:
         print("WARNING: Nu Invisio material found. Cannot delete helper geometry")
+    elif BMeshAware:        
+        for f in me.polygons:    
+            if f.material_index >= invisioNum:
+                for vn in f.vertices:
+                    me.vertices[vn].select = True
     else:        
         for f in me.faces:    
             if f.material_index >= invisioNum:
                 for vn in f.vertices:
                     me.vertices[vn].select = True
-    bpy.ops.object.mode_set(mode='EDIT')
-    bpy.ops.mesh.delete(type='VERT')
-    bpy.ops.object.mode_set(mode='OBJECT')
+    if BMeshAware and toggle&T_CrashSafe:     
+        theMessage = "\n  *** WARNING ***\nHelper deletion turned off due to Blender crash.\nHelpers can be deleted by deleting all selected vertices in Edit mode\n     **********\n"
+        print(theMessage)
+    else:
+        bpy.ops.object.mode_set(mode='EDIT')
+        print("Do delete")
+        bpy.ops.mesh.delete(type='VERT')
+        print("Verts deleted")
+        bpy.ops.object.mode_set(mode='OBJECT')
+        print("Back to object mode")
     return
   
 #
@@ -2331,7 +2382,8 @@ def hideLayers(args):
         sceneLayers = int(args[2], 16)
         sceneHideLayers = int(args[3], 16)
         boneLayers = int(args[4], 16)
-        boneHideLayers = int(args[5], 16)
+        # boneHideLayers = int(args[5], 16)
+        boneHideLayers = 0
     else:
         sceneLayers = 0x00ff
         sceneHideLayers = 0
@@ -2784,7 +2836,13 @@ def MyError(message):
     theErrorLines = message.split('\n')
     theErrorStatus = True
     bpy.ops.mhx.error('INVOKE_DEFAULT')
-    raise NameError(theMessage)
+    raise MhxError(theMessage)
+
+class MhxError(Exception):
+    def __init__(self, value):
+        self.value = value
+    def __str__(self):
+        return repr(self.value)
 
 class SuccessOperator(bpy.types.Operator):
     bl_idname = "mhx.success"
@@ -2799,7 +2857,7 @@ class SuccessOperator(bpy.types.Operator):
         return wm.invoke_props_dialog(self)
 
     def draw(self, context):
-        self.layout.label(self.message)
+        self.layout.label(self.message + theMessage)
 
 ###################################################################################
 #
@@ -2809,16 +2867,15 @@ class SuccessOperator(bpy.types.Operator):
 
 from bpy_extras.io_utils import ImportHelper
 
-
 MhxBoolProps = [
     ("enforce", "Enforce version", "Only accept MHX files of correct version", T_EnforceVersion),
+    #("crash_safe", "Crash-safe", "Disable features that have caused Blender crashes", T_CrashSafe),
     ("mesh", "Mesh", "Use main mesh", T_Mesh),
     ("proxy", "Proxies", "Use proxies", T_Proxy),
     ("armature", "Armature", "Use armature", T_Armature),
     #("replace", "Replace scene", "Replace scene", T_Replace),
     ("cage", "Cage", "Load mesh deform cage", T_Cage),
     ("clothes", "Clothes", "Include clothes", T_Clothes),
-    #("stretch", "Stretchy limbs", "Stretchy limbs", T_Stretch),
     ("face", "Face shapes", "Include facial shapekeys", T_Face),
     ("shape", "Body shapes", "Include body shapekeys", T_Shape),
     #("symm", "Symmetric shapes", "Keep shapekeys symmetric", T_Symm),
@@ -2856,7 +2913,7 @@ class ImportMhx(bpy.types.Operator, ImportHelper):
         try:
             readMhxFile(self.filepath)
             bpy.ops.mhx.success('INVOKE_DEFAULT', message = self.filepath)
-        except NameError:
+        except MhxError:
             print("Error when loading MHX file:\n" + theMessage)
 
         writeDefaults()
@@ -3225,7 +3282,7 @@ def getVisemeSet(context, rig):
     elif visset == 'BodyLanguage':
         return bodyLanguageVisemes
     else:
-        raise NameError("Unknown viseme set %s" % visset)
+        raise MhxError("Unknown viseme set %s" % visset)
 
 def setViseme(context, vis, setKey, frame):
     rig = getMhxRig(context.object)
@@ -3248,7 +3305,7 @@ def setViseme(context, vis, setKey, frame):
         else:
             setBoneLocation(context, pbones[b+'_L'], scale, loc, False, setKey, frame)
             setBoneLocation(context, pbones[b+'_R'], scale, loc, True, setKey, frame)
-    updatePose(rig)
+    updatePose(context)
     return
 
 def setBoneLocation(context, pb, scale, loc, mirror, setKey, frame):
@@ -3297,7 +3354,7 @@ def readMoho(context, filepath, offs):
             setViseme(context, vis, True, int(words[0])+offs)
     fp.close()
     setInterpolation(rig)
-    updatePose(rig)
+    updatePose(context)
     print("Moho file %s loaded" % filepath)
     return
 
@@ -3315,7 +3372,7 @@ def readMagpie(context, filepath, offs):
             setViseme(context, vis, True, int(words[0])+offs)
     fp.close()
     setInterpolation(rig)
-    updatePose(rig)
+    updatePose(context)
     print("Magpie file %s loaded" % filepath)
     return
 
@@ -3397,13 +3454,15 @@ class MhxLipsyncPanel(bpy.types.Panel):
         return
         
 #
-#   updatePose(rig):
+#   updatePose(context):
 #   class VIEW3D_OT_MhxUpdateButton(bpy.types.Operator):
 #
 
-def updatePose(rig):
-    pb = rig.pose.bones["PFaceDisp"]
-    pb.location = pb.location
+def updatePose(context):
+    scn = context.scene
+    scn.frame_current = scn.frame_current
+    bpy.ops.object.posemode_toggle()
+    bpy.ops.object.posemode_toggle()
     return
 
 class VIEW3D_OT_MhxUpdateButton(bpy.types.Operator):
@@ -3411,8 +3470,7 @@ class VIEW3D_OT_MhxUpdateButton(bpy.types.Operator):
     bl_label = "Update"
 
     def execute(self, context):
-        rig = getMhxRig(context.object)
-        updatePose(rig)
+        updatePose(context)
         return{'FINISHED'}    
         
 
@@ -3434,7 +3492,7 @@ class VIEW3D_OT_MhxResetExpressionsButton(bpy.types.Operator):
         props = getShapeProps(rig)
         for (prop, name) in props:
             rig[prop] = 0.0
-        updatePose(rig)
+        updatePose(context)
         return{'FINISHED'}    
 
 #
@@ -3451,7 +3509,7 @@ class VIEW3D_OT_MhxKeyExpressionsButton(bpy.types.Operator):
         frame = context.scene.frame_current
         for (prop, name) in props:
             rig.keyframe_insert('["%s"]' % prop, frame=frame)
-        updatePose(rig)
+        updatePose(context)
         return{'FINISHED'}    
 #
 #    class VIEW3D_OT_MhxPinExpressionButton(bpy.types.Operator):
@@ -3481,7 +3539,7 @@ class VIEW3D_OT_MhxPinExpressionButton(bpy.types.Operator):
                     rig[prop] = 1.0
                 else:
                     rig[prop] = 0.0
-        updatePose(rig)
+        updatePose(context)
         return{'FINISHED'}    
 
 #
@@ -3530,6 +3588,429 @@ class MhxExpressionsPanel(bpy.types.Panel):
             row.operator("mhx.pose_pin_expression", text="", icon='UNPINNED').expression = prop
         return
 
+#########################################
+#
+#   FK-IK snapping. 
+#
+#########################################
+
+def getPoseMatrix(mat, pb):
+    restInv = pb.bone.matrix_local.inverted()
+    if pb.parent:
+        parInv = pb.parent.matrix.inverted()
+        parRest = pb.parent.bone.matrix_local
+        return restInv * (parRest * (parInv * mat))
+    else:
+        return restInv * mat
+
+        
+def getGlobalMatrix(mat, pb):
+    gmat = pb.bone.matrix_local * mat
+    if pb.parent:
+        parMat = pb.parent.matrix
+        parRest = pb.parent.bone.matrix_local
+        return parMat * (parRest.inverted() * gmat)
+    else:
+        return gmat
+
+
+def matchPoseTranslation(pb, fkPb, auto):
+    mat = getPoseMatrix(fkPb.matrix, pb)
+    insertLocation(pb, mat, auto)
+    
+
+def insertLocation(pb, mat, auto):    
+    pb.location = mat.to_translation()
+    if auto:
+        pb.keyframe_insert("location", group=pb.name)
+    bpy.ops.object.mode_set(mode='OBJECT')
+    bpy.ops.object.mode_set(mode='POSE')
+
+
+def matchPoseRotation(pb, fkPb, auto):
+    mat = getPoseMatrix(fkPb.matrix, pb)
+    insertRotation(pb, mat, auto)
+    
+
+def insertRotation(pb, mat, auto):    
+    q = mat.to_quaternion()
+    if pb.rotation_mode == 'QUATERNION':
+        pb.rotation_quaternion = q
+        if auto:
+            pb.keyframe_insert("rotation_quaternion", group=pb.name)
+    else:
+        pb.rotation_euler = q.to_euler(pb.rotation_mode)
+        if auto:
+            pb.keyframe_insert("rotation_euler", group=pb.name)
+    bpy.ops.object.mode_set(mode='OBJECT')
+    bpy.ops.object.mode_set(mode='POSE')
+
+
+def matchPoseReverse(pb, fkPb, auto):
+    bpy.ops.object.mode_set(mode='OBJECT')
+    bpy.ops.object.mode_set(mode='POSE')
+    gmat = fkPb.matrix * Matrix.Rotation(math.pi, 4, 'Z')
+    offs = pb.bone.length * fkPb.matrix.col[1]    
+    gmat[0][3] += offs[0]
+    gmat[1][3] += offs[1]
+    gmat[2][3] += offs[2]    
+    mat = getPoseMatrix(gmat, pb)
+    pb.matrix_basis = mat
+    insertLocation(pb, mat, auto)
+    insertRotation(pb, mat, auto)
+    
+
+
+def matchPoseScale(pb, fkPb, auto):
+    mat = getPoseMatrix(fkPb.matrix, pb)
+    pb.scale = mat.to_scale()
+    if auto:
+        pb.keyframe_insert("scale", group=pb.name)
+    bpy.ops.object.mode_set(mode='OBJECT')
+    bpy.ops.object.mode_set(mode='POSE')
+
+
+def fk2ikArm(context, suffix):
+    rig = context.object
+    auto = context.scene.tool_settings.use_keyframe_insert_auto
+    print("Snap FK Arm%s" % suffix)
+    (uparmIk, loarmIk, elbow, elbowPt, wrist) = getSnapBones(rig, "ArmIK", suffix)
+    (uparmFk, loarmFk, elbowPtFk, handFk) = getSnapBones(rig, "ArmFK", suffix)
+
+    matchPoseRotation(uparmFk, uparmIk, auto)
+    matchPoseScale(uparmFk, uparmIk, auto)
+
+    matchPoseRotation(loarmFk, loarmIk, auto)
+    matchPoseScale(loarmFk, loarmIk, auto)
+
+    if rig["&HandFollowsWrist" + suffix]:
+        matchPoseRotation(handFk, wrist, auto)
+        matchPoseScale(handFk, wrist, auto)
+    return
+
+
+def ik2fkArm(context, suffix):
+    rig = context.object
+    scn = context.scene
+    auto = scn.tool_settings.use_keyframe_insert_auto
+    print("Snap IK Arm%s" % 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
+    
+    matchPoseTranslation(wrist, handFk, auto)
+    matchPoseRotation(wrist, handFk, auto)  
+    matchPoseTranslation(elbow, elbowPtFk, auto)
+    matchPoseTranslation(elbowPt, elbowPtFk, auto)
+    setInverse(rig, elbowPt)
+    return
+
+
+def fk2ikLeg(context, suffix):
+    rig = context.object
+    auto = context.scene.tool_settings.use_keyframe_insert_auto
+    print("Snap FK Leg%s" % suffix)
+    (uplegIk, lolegIk, kneePt, ankleIk, legIk, legFk, footIk, toeIk) = getSnapBones(rig, "LegIK", suffix)
+    (uplegFk, lolegFk, kneePtFk, footFk, toeFk) = getSnapBones(rig, "LegFK", suffix)
+
+    matchPoseRotation(uplegFk, uplegIk, auto)
+    matchPoseScale(uplegFk, uplegIk, auto)
+
+    matchPoseRotation(lolegFk, lolegIk, auto)
+    matchPoseScale(lolegFk, lolegIk, auto)
+    return
+
+
+def ik2fkLeg(context, suffix):
+    rig = context.object
+    scn = context.scene
+    auto = scn.tool_settings.use_keyframe_insert_auto
+    print("Snap IK Leg%s" % 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
+    
+    legIkToAnkle = rig["&LegIkToAnkle" + suffix]
+    if legIkToAnkle:
+        matchPoseTranslation(ankleIk, footFk, auto)
+    matchPoseTranslation(legIk, legFk, auto)
+    matchPoseRotation(legIk, legFk, auto)  
+    matchPoseReverse(toeIk, toeFk, auto)
+    matchPoseReverse(footIk, footFk, auto)
+    setInverse(rig, ankleIk)
+    matchPoseTranslation(kneePt, kneePtFk, auto)
+    setInverse(rig, kneePt)
+    if not legIkToAnkle:
+        matchPoseTranslation(ankleIk, footFk, auto)
+    return
+   
+           
+#
+#   setInverse(rig, pb):
+#
+
+def setInverse(rig, pb):
+    rig.data.bones.active = pb.bone
+    pb.bone.select = True
+    bpy.ops.object.mode_set(mode='OBJECT')
+    bpy.ops.object.mode_set(mode='POSE')
+    for cns in pb.constraints:
+        if cns.type == 'CHILD_OF':
+            bpy.ops.constraint.childof_set_inverse(constraint=cns.name, owner='BONE')
+    bpy.ops.object.mode_set(mode='OBJECT')
+    bpy.ops.object.mode_set(mode='POSE')
+    return
+
+
+def clearInverse(rig, pb):
+    rig.data.bones.active = pb.bone
+    pb.bone.select = True
+    bpy.ops.object.mode_set(mode='OBJECT')
+    bpy.ops.object.mode_set(mode='POSE')
+    for cns in pb.constraints:
+        if cns.type == 'CHILD_OF':
+            bpy.ops.constraint.childof_clear_inverse(constraint=cns.name, owner='BONE')
+    bpy.ops.object.mode_set(mode='OBJECT')
+    bpy.ops.object.mode_set(mode='POSE')
+    return
+
+
+def fixAnkle(rig, suffix, scn):
+    layers = list(rig.data.layers)
+    try:
+        rig.data.layers = 32*[True]
+        setInverse(rig, rig.pose.bones["Ankle" + suffix])
+        scn.frame_current = scn.frame_current
+    finally:
+        rig.data.layers = layers
+    return
+
+
+def clearAnkle(rig, suffix, scn):
+    layers = list(rig.data.layers)
+    try:
+        rig.data.layers = 32*[True]
+        clearInverse(rig, rig.pose.bones["Ankle" + suffix])
+        scn.frame_current = scn.frame_current
+    finally:
+        rig.data.layers = layers
+    return
+
+
+class VIEW3D_OT_FixAnkleButton(bpy.types.Operator):
+    bl_idname = "mhx.fix_ankle"
+    bl_label = "Fix ankle"
+    bl_description = "Set inverse for ankle Child-of constraints"
+    suffix = StringProperty()
+
+    def execute(self, context):
+        fixAnkle(context.object, self.suffix, context.scene)
+        return{'FINISHED'}    
+
+
+class VIEW3D_OT_ClearAnkleButton(bpy.types.Operator):
+    bl_idname = "mhx.clear_ankle"
+    bl_label = "Clear ankle"
+    bl_description = "Clear inverse for ankle Child-of constraints"
+    suffix = StringProperty()
+
+    def execute(self, context):
+        clearAnkle(context.object, self.suffix, context.scene)
+        return{'FINISHED'}    
+#
+#
+#
+
+SnapBones = {
+    "ArmFK" : ["UpArm", "LoArm", "ElbowPTFK", "Hand"],
+    "ArmIK" : ["UpArmIK", "LoArmIK", "Elbow", "ElbowPT", "Wrist"],
+    "LegFK" : ["UpLeg", "LoLeg", "KneePTFK", "Foot", "Toe"],
+    "LegIK" : ["UpLegIK", "LoLegIK", "KneePT", "Ankle", "LegIK", "LegFK", "FootRev", "ToeRev"],
+}
+
+
+def getSnapBones(rig, key, suffix):
+    names = SnapBones[key]
+    pbones = []
+    for name in names:
+        pb = rig.pose.bones[name+suffix]
+        pbones.append(pb)
+    return tuple(pbones)
+
+
+class VIEW3D_OT_MhxSnapFk2IkButton(bpy.types.Operator):
+    bl_idname = "mhx.snap_fk_ik"
+    bl_label = "Snap FK"
+    data = StringProperty()    
+
+    def execute(self, context):
+        bpy.ops.object.mode_set(mode='POSE')
+        rig = context.object
+        (prop, old) = setSnapProp(rig, self.data, 1.0, context, False)
+        if prop[:4] == "&Arm":
+            fk2ikArm(context, prop[-2:])
+        elif prop[:4] == "&Leg":
+            fk2ikLeg(context, prop[-2:])
+        restoreSnapProp(rig, prop, old, context)
+        return{'FINISHED'}    
+
+
+class VIEW3D_OT_MhxSnapIk2FkButton(bpy.types.Operator):
+    bl_idname = "mhx.snap_ik_fk"
+    bl_label = "Snap IK"
+    data = StringProperty()    
+
+    def execute(self, context):
+        bpy.ops.object.mode_set(mode='POSE')
+        rig = context.object
+        (prop, old) = setSnapProp(rig, self.data, 0.0, context, True)
+        if prop[:4] == "&Arm":
+            ik2fkArm(context, prop[-2:])
+        elif prop[:4] == "&Leg":
+            ik2fkLeg(context, prop[-2:])
+        restoreSnapProp(rig, prop, old, context)
+        return{'FINISHED'}    
+
+
+def setSnapProp(rig, data, value, context, isIk):
+    words = data.split()
+    prop = words[0]
+    oldValue = rig[prop]
+    rig[prop] = value
+    ik = int(words[1])
+    fk = int(words[2])
+    extra = int(words[3])
+    oldIk = rig.data.layers[ik]
+    oldFk = rig.data.layers[fk]
+    oldExtra = rig.data.layers[extra]
+    rig.data.layers[ik] = True
+    rig.data.layers[fk] = True
+    rig.data.layers[extra] = True
+    updatePose(context)
+    if isIk:
+        oldValue = 1.0
+        oldIk = True
+        oldFk = False
+    else:
+        oldValue = 0.0
+        oldIk = False
+        oldFk = True
+        oldExtra = False
+    return (prop, (oldValue, ik, fk, extra, oldIk, oldFk, oldExtra))
+
+    
+def restoreSnapProp(rig, prop, old, context):
+    updatePose(context)
+    (oldValue, ik, fk, extra, oldIk, oldFk, oldExtra) = old
+    rig[prop] = oldValue
+    rig.data.layers[ik] = oldIk
+    rig.data.layers[fk] = oldFk
+    rig.data.layers[extra] = oldExtra
+    return
+
+
+class VIEW3D_OT_MhxToggleFkIkButton(bpy.types.Operator):
+    bl_idname = "mhx.toggle_fk_ik"
+    bl_label = "FK - IK"
+    toggle = StringProperty()    
+
+    def execute(self, context):
+        words = self.toggle.split()
+        rig = context.object
+        prop = words[0]
+        value = float(words[1]) 
+        onLayer = int(words[2])
+        offLayer = int(words[3])
+        rig.data.layers[onLayer] = True
+        rig.data.layers[offLayer] = False
+        rig[prop] = value
+        # Don't do autokey - confusing.
+        #if context.tool_settings.use_keyframe_insert_auto:
+        #    rig.keyframe_insert('["%s"]' % prop, frame=scn.frame_current)        
+        updatePose(context)
+        return{'FINISHED'}    
+
+
+#
+#   MHX FK/IK Switch panel
+#
+
+class MhxFKIKPanel(bpy.types.Panel):
+    bl_label = "MHX FK/IK Switch"
+    bl_space_type = "VIEW_3D"
+    bl_region_type = "UI"
+    #bl_options = {'DEFAULT_CLOSED'}
+    
+    @classmethod
+    def poll(cls, context):
+        return pollMhxRig(context.object)
+
+    def draw(self, context):
+        rig = context.object
+        layout = self.layout        
+
+        row = layout.row()
+        row.label("")
+        row.label("Left")
+        row.label("Right")
+
+        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")
+        row = layout.row()
+        row.label("Leg")
+        self.toggleButton(row, rig, "&LegIk_L", " 5", " 4")
+        self.toggleButton(row, rig, "&LegIk_R", " 21", " 20")
+        
+        try:
+            ok = (rig["MhxVersion"] >= 12)
+        except:
+            ok = False
+        if not ok:
+            layout.label("Snapping only works with MHX version 1.12 and later.")
+            return
+        
+        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 = 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"
+
+        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 = 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 = layout.row()
+        row.label("Ankle")
+        row.operator("mhx.fix_ankle", text="Fix L Ankle").suffix = "_L"
+        row.operator("mhx.fix_ankle", text="Fix R Ankle").suffix = "_R"
+        row = layout.row()
+        row.label("")
+        row.operator("mhx.clear_ankle", text="Clear L Ankle").suffix = "_L"
+        row.operator("mhx.clear_ankle", text="Clear R Ankle").suffix = "_R"
+
+    def toggleButton(self, row, rig, prop, fk, ik):
+        if rig[prop] > 0.5:
+            row.operator("mhx.toggle_fk_ik", text="IK").toggle = prop + " 0" + fk + ik
+        else:
+            row.operator("mhx.toggle_fk_ik", text="FK").toggle = prop + " 1" + ik + fk
+            
+
 ###################################################################################    
 #
 #    Posing panel
@@ -3599,13 +4080,78 @@ class MhxVisibilityPanel(bpy.types.Panel):
 
     def draw(self, context):
         ob = context.object
+        layout = self.layout
         props = list(ob.keys())
         props.sort()
         for prop in props:
             if prop[0:4] == "Hide": 
-                self.layout.prop(ob, '["%s"]' % prop)
+                layout.prop(ob, '["%s"]' % prop)
+        layout.separator()
+        layout.operator("mhx.update_textures")
+        layout.separator()
+        layout.operator("mhx.add_hiders")
+        layout.operator("mhx.remove_hiders")
         return
 
+class VIEW3D_OT_MhxUpdateTexturesButton(bpy.types.Operator):
+    bl_idname = "mhx.update_textures"
+    bl_label = "Update"
+
+    def execute(self, context):
+        scn = context.scene
+        for mat in bpy.data.materials:
+            if mat.animation_data:
+                try:
+                    mat["MhxDriven"]
+                except:
+                    continue
+                for driver in mat.animation_data.drivers:
+                    prop = mat.path_resolve(driver.data_path)
+                    value = driver.evaluate(scn.frame_current)
+                    #print("Update %s[%d] = %s" % (driver.data_path, driver.array_index, value))
+                    prop[driver.array_index] = value
+        return{'FINISHED'}    
+        
+class VIEW3D_OT_MhxAddHidersButton(bpy.types.Operator):
+    bl_idname = "mhx.add_hiders"
+    bl_label = "Add Hide Property"
+
+    def execute(self, context):
+        rig = context.object
+        for ob in context.scene.objects:
+            if ob.select and ob != rig:
+                prop = "Hide%s" % ob.name        
+                rig[prop] = False        
+                addHider(ob, "hide", rig, prop)
+                addHider(ob, "hide_render", rig, prop)
+        return{'FINISHED'}    
+                
+def addHider(ob, attr, rig, prop):
+    fcu = ob.driver_add(attr)
+    drv = fcu.driver
+    drv.type = 'SCRIPTED'
+    drv.expression = "x"
+    drv.show_debug_info = True
+    var = drv.variables.new()
+    var.name = "x"
+    targ = var.targets[0]
+    targ.id = rig
+    targ.data_path = '["%s"]' % prop
+    return
+
+class VIEW3D_OT_MhxRemoveHidersButton(bpy.types.Operator):
+    bl_idname = "mhx.remove_hiders"
+    bl_label = "Remove Hide Property"
+
+    def execute(self, context):
+        rig = context.object
+        for ob in context.scene.objects:
+            if ob.select and ob != rig:
+                ob.driver_remove("hide")
+                ob.driver_remove("hide_render")
+                del rig["Hide%s" % ob.name]
+        return{'FINISHED'}    
+        
 ###################################################################################    
 #
 #    Layers panel
@@ -3648,7 +4194,7 @@ class MhxLayersPanel(bpy.types.Panel):
     bl_label = "MHX Layers"
     bl_space_type = "VIEW_3D"
     bl_region_type = "UI"
-    bl_options = {'DEFAULT_CLOSED'}
+    #bl_options = {'DEFAULT_CLOSED'}
     
     @classmethod
     def poll(cls, context):
@@ -3747,7 +4293,6 @@ def setInterpolation(rig):
         fcu.extrapolation = 'CONSTANT'
     return
     
-
 ###################################################################################    
 #
 #    initialize and register
@@ -3762,14 +4307,17 @@ def register():
     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__":
     try:
-        unregister()
+        bpy.utils.unregister_module(__name__)
     except:
         pass
+    try:
+        bpy.types.INFO_MT_file_import.remove(menu_func)
+    except:
+        pass
+
+if __name__ == "__main__":
+    unregister()
     register()
 
 
diff --git a/release/scripts/addons/io_import_scene_unreal_psk.py b/release/scripts/addons/io_import_scene_unreal_psk.py
index 58506a4..9d58343 100644
--- a/release/scripts/addons/io_import_scene_unreal_psk.py
+++ b/release/scripts/addons/io_import_scene_unreal_psk.py
@@ -19,8 +19,8 @@
 bl_info = {
     "name": "Import Unreal Skeleton Mesh (.psk)",
     "author": "Darknet",
-    "version": (2, 0),
-    "blender": (2, 5, 9),
+    "version": (2, 1),
+    "blender": (2, 6, 3),
     "location": "File > Import > Skeleton Mesh (.psk)",
     "description": "Import Skeleleton Mesh",
     "warning": "",
@@ -34,23 +34,31 @@ bl_info = {
 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
+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
--Export Text Log From Current Location File (Bool )
 """
 
 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",
@@ -62,74 +70,234 @@ DEBUGLOG = False
 
 scale = 1.0
 bonesize = 1.0
-md5_bones=[]
+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()
 
-def unpack_list(list_of_tuples):
-    l = []
-    for t in list_of_tuples:
-        l.extend(t)
-    return l
-"""
-class md5_bone:
-    bone_index=0
-    name=""
-    bindpos=[]
-    bindmat = mathutils.Quaternion()
-    parent=""
-    parent_index=0
-    blenderbone=None
-    roll=0
-
-    def __init__(self):
-        self.bone_index=0
-        self.name=""
-        self.bindpos=[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.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)
-"""
-class md5_bone:
-    bone_index=0
-    name=""
-    bindpos=[]
-    bindmat=[]
-    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.bindmat=[None]*3  #is this how you initilize a 2d-array
-        for i in range(3): self.bindmat[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)
+#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
@@ -142,272 +310,8 @@ def fixRoll(b):
     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])) 
-        
-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)
-    
-    md5_bones=[]
-    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 = []
-    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])])
-        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([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 = []
-    #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[0]][0]
-        PNTSB = UVCoords[indata[1]][0]
-        PNTSC = UVCoords[indata[2]][0]
-        #print(PNTSA,PNTSB,PNTSC) #face id vertex
-        #faces.extend([0,1,2,0])
-        faces.extend([PNTSA,PNTSB,PNTSC,0])
-        uv = []
-        u0 = UVCoords[indata[0]][1]
-        v0 = UVCoords[indata[0]][2]
-        uv.append([u0,v0])
-        u1 = UVCoords[indata[1]][1]
-        v1 = UVCoords[indata[1]][2]
-        uv.append([u1,v1])
-        u2 = UVCoords[indata[2]][1]
-        v2 = UVCoords[indata[2]][2]
-        uv.append([u2,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
-        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)		
-    ##
-    
-    #================================================================================================== 
-    # 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 = []
-    #================================================================================================== 
-    # Bone Data 
-    #==================================================================================================
-    counter = 0
-    print ("---PRASE--BONES---")
-    printlog("Name|Flgs|NumChld|PrntIdx|Qw|Qx|Qy|Qz|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")
-        print ("temp_name:", temp_name, "||")
-        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]
-        
-        #w,x,y,z
-        if (counter == 0):#main parent
-            print("no parent bone")
-            createbone.bindmat = mathutils.Quaternion((indata[7],indata[4],indata[5],indata[6]))#default
-            #createbone.bindmat = mathutils.Quaternion((indata[7],-indata[4],-indata[5],-indata[6]))
-        else:#parent
-            print("parent bone")
-            createbone.bindmat = mathutils.Quaternion((indata[7],-indata[4],-indata[5],-indata[6]))#default
-            #createbone.bindmat = mathutils.Quaternion((indata[7],indata[4],indata[5],indata[6]))
-            
-        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].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
-            bpy.ops.object.mode_set(mode='EDIT')
-
-            #newbone = ob_new.data.edit_bones.new('test')
-            #newbone.tail.y = 1
-            print("creating bone(s)")
-            for bone in md5_bones:
-                #print(dir(bone))
-                bpy.ops.object.mode_set(mode='EDIT')
-                newbone = ob_new.data.edit_bones.new(bone.name)
-            '''		
-
-
-            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
-            bpy.ops.object.mode_set(mode='EDIT')
-
-            #newbone = ob_new.data.edit_bones.new('test')
-            #newbone.tail.y = 1
-            print("creating bone(s)")
+""" #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')
@@ -461,272 +365,215 @@ def pskimport(infile,importmesh,importbone,bDebugLogPSK,importmultiuvtextures):
                     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")
-            
-    bpy.context.scene.update()
+                    #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)
     
-    #==================================================================================================
-    #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)
+    plik = open(filename,'rb')
+    word(20),i(3)
     
-    #================================================================================================== 
-    # 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()
+    #------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([])
     
-    #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))
-    me_ob.vertices.add(len(verts))
-    me_ob.faces.add(len(faces)//4)
-
-    me_ob.vertices.foreach_set("co", unpack_list(verts))
+    #------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)
     
-    me_ob.faces.foreach_set("vertices_raw", faces)
-    me_ob.faces.foreach_set("use_smooth", [False] * len(me_ob.faces))
-    me_ob.update_tag()
     
-    """
-    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
+    #------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
     
-    """
-    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)
-    if importmultiuvtextures == True:
-        me_ob.uv_textures.new(name="pskuvtexture")
-        #print(dir(bpy.data))
-        if (len(faceuv) > 0):
-            for countm in range(len(me_ob.uv_textures)):
-                me_ob.update()
-                uvtex = me_ob.uv_textures[countm] #add one uv texture
-                me_ob.update()
-                #print("UV TEXTURE NAME:",uvtex.name)
-                for i, face in enumerate(me_ob.faces):
-                    blender_tface = uvtex.data[i] #face
-                    mfaceuv = faceuv[i]
-                    #print("---------------------------------------")
-                    #print(faceuv[i][1])
-                    #print(dir(face))
-                    face.material_index = faceuv[i][1]
-                    blender_tface.uv1 = mfaceuv[0][0] #uv = (0,0)
-                    blender_tface.uv2 = mfaceuv[0][1] #uv = (0,0)
-                    blender_tface.uv3 = mfaceuv[0][2] #uv = (0,0)
-                texture.append(uvtex)
-    else:
-        for countm in range(materialcount):
-            psktexname="psk" + str(countm)
-            me_ob.uv_textures.new(name=psktexname)
-            #psktexname="psk" + str(countm)
-        #me_ob.uv_textures.new(name=psktexname)
-        for countm in range(len(me_ob.uv_textures)):
-            me_ob.update()
-            #print(dir(me_ob.uv_textures))
-            #psktexname="psk" + str(countm)
-            uvtex = me_ob.uv_textures[countm] #add one uv texture
-            me_ob.update()
-            #print("UV TEXTURE NAME:",uvtex.name)
-            if (len(faceuv) > 0):
-                # counttex = 0  # UNUSED
-                countm = 0
-                for countm in range(len(me_ob.uv_textures)):
-                    me_ob.update()
-                    #print(dir(me_ob.uv_textures))
-                    psktexname="psk" + str(countm)
-                    uvtex = me_ob.uv_textures[countm] #add one uv texture
-                    me_ob.update()
-                    #print("UV TEXTURE NAME:",uvtex.name)
-                    for i, face in enumerate(me_ob.faces):
-                        blender_tface = uvtex.data[i] #face
-                        mfaceuv = faceuv[i]
-                        #print("---------------------------------------")
-                        #print(faceuv[i][1])
-                        #print(dir(face))
-                        face.material_index = faceuv[i][1]
-                        if countm == faceuv[i][1]:
-                            face.material_index = faceuv[i][1]
-                            blender_tface.uv1 = mfaceuv[0][0] #uv = (0,0)
-                            blender_tface.uv2 = mfaceuv[0][1] #uv = (0,0)
-                            blender_tface.uv3 = mfaceuv[0][2] #uv = (0,0)
-                        else:
-                            #set uv to zero (0,0)
-                            #print("--------------------")
-                            #print(blender_tface.uv1)
-                            #print(blender_tface.uv2)
-                            #print(blender_tface.uv2)
-                            blender_tface.uv1 = [0,0]
-                            #print(blender_tface.uv1)
-                            blender_tface.uv2 = [0,0]
-                            blender_tface.uv3 = [0,0]
-                
-            texture.append(uvtex)
-    print("UV TEXTURE LEN:",len(texture))
-        #for tex in me_ob.uv_textures:
-            #print("mesh tex:",dir(tex))
-            #print((tex.name))
+    #------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)
     
-    #for face in me_ob.faces:
-        #print(dir(face))
-
-
-    '''
-    matdata = bpy.data.materials.new(materialname)
-    #color is 0 - 1 not in 0 - 255
-    #matdata.mirror_color=(float(0.04),float(0.08),float(0.44))
-    matdata.diffuse_color=(float(0.04),float(0.08),float(0.44))#blue color
-    #print(dir(me_ob.uv_textures[0].data))
-    texdata = None
-    texdata = bpy.data.textures[len(bpy.data.textures)-1]
-    if (texdata != None):
-        #print(texdata.name)
-        #print(dir(texdata))
-        texdata.name = "texturelist1"
-        matdata.active_texture = texdata
-    materials.append(matdata)
-    #matdata = bpy.data.materials.new(materialname)
-    #materials.append(matdata)
-    #= make sure the list isnt too big
-    for material in materials:
-        #add material to the mesh list of materials
-        me_ob.materials.append(material)
-    '''
-    #===================================================================================================
-    #
-    #===================================================================================================
-    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] == vgroup.index:
-                #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.context.scene.objects.link(obmesh)    
-    bpy.context.scene.update()
+    #-------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()
+
     
-    print ("PSK2Blender completed")
+     #-------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)
@@ -736,7 +583,7 @@ def getInputFilename(self,filename,importmesh,importbone,bDebugLogPSK,importmult
         #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"
@@ -792,7 +639,151 @@ class IMPORT_OT_psk(bpy.types.Operator):
         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)")
 
@@ -810,3 +801,4 @@ if __name__ == "__main__":
 #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 e079ff3..883e998 100644
--- a/release/scripts/addons/io_mesh_pdb/__init__.py
+++ b/release/scripts/addons/io_mesh_pdb/__init__.py
@@ -20,30 +20,33 @@ bl_info = {
     "name": "PDB Atomic Blender",
     "description": "Loading and manipulating atoms from PDB files",
     "author": "Clemens Barth",
-    "version": (1,2),
+    "version": (1,3),
     "blender": (2,6),
     "location": "File -> Import -> PDB (.pdb), Panel: View 3D - Tools",
     "warning": "",
-    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Import-Export/PDB",
+    "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=29226",
     "category": "Import-Export"
 }
 
+import os
+import io
 import bpy
 from bpy.types import Operator, Panel
-from bpy_extras.io_utils import ImportHelper
+from bpy_extras.io_utils import ImportHelper, ExportHelper
 from bpy.props import (StringProperty,
                        BoolProperty,
                        EnumProperty,
                        IntProperty,
                        FloatProperty)
 
-
-# TODO, allow reload
 from . import import_pdb
+from . import export_pdb
 
 ATOM_PDB_ERROR = ""
+ATOM_PDB_PANEL = ""
 
 # -----------------------------------------------------------------------------
 #                                                                           GUI
@@ -52,110 +55,114 @@ ATOM_PDB_ERROR = ""
 # chosen via the menu 'File -> Import'
 class CLASS_atom_pdb_panel(Panel):
     bl_label       = "PDB - Atomic Blender"
-    #bl_space_type  = "PROPERTIES"
-    #bl_region_type = "WINDOW"
-    #bl_context     = "physics"
-    # This could be also an option ... :
     bl_space_type  = "VIEW_3D"
-    #bl_region_type = "TOOLS"
     bl_region_type = "TOOL_PROPS"
 
     @classmethod
     def poll(self, context):
-        if import_pdb.ATOM_PDB_FILEPATH == "":
+        global ATOM_PDB_PANEL
+        
+        if ATOM_PDB_PANEL == "0" and import_pdb.ATOM_PDB_FILEPATH == "":
             return False
-        else:
+        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
-        scn    = bpy.context.scene
+
+        # 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, "atom_pdb_datafile")
+        col.prop(scn, "datafile")
         col.operator("atom_pdb.datafile_apply")
         row = box.row()
         col = row.column(align=True)
-        col.prop(scn, "atom_pdb_PDB_file")
-
+        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_atom_pdb_mesh")
+        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_atom_pdb_mesh   
-        col.prop(scn, "atom_pdb_mesh_azimuth")
-        col.prop(scn, "atom_pdb_mesh_zenith")
+        col.active = scn.use_mesh   
+        col.prop(scn, "mesh_azimuth")
+        col.prop(scn, "mesh_zenith")
         col = row.column(align=True)
-        col.prop(scn, "atom_pdb_scale_ballradius")
-        col.prop(scn, "atom_pdb_scale_distances")
+        col.prop(scn, "scale_ballradius")
+        col.prop(scn, "scale_distances")
         row = box.row()
         col = row.column()  
-        col.prop(scn, "use_atom_pdb_sticks")
+        col.prop(scn, "use_sticks")
         row = box.row()        
-        row.active = scn.use_atom_pdb_sticks
+        row.active = scn.use_sticks
         col = row.column(align=True)
-        col.prop(scn, "atom_pdb_sticks_sectors")
-        col.prop(scn, "atom_pdb_sticks_radius")
+        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_atom_pdb_sticks_color")        
-        col.prop(scn, "use_atom_pdb_sticks_smooth")
-        col.prop(scn, "use_atom_pdb_sticks_bonds")
+        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_atom_pdb_sticks
+        row.active = scn.use_sticks
         col = row.column(align=True)
         col = row.column(align=True)
-        col.active = scn.use_atom_pdb_sticks and scn.use_atom_pdb_sticks_bonds 
-        col.prop(scn, "atom_pdb_sticks_dist")        
+        col.active = scn.use_sticks and scn.use_sticks_bonds 
+        col.prop(scn, "sticks_dist")        
         row = box.row()
-        row.prop(scn, "use_atom_pdb_center")
+        row.prop(scn, "use_center")
         row = box.row()
         col = row.column()
-        col.prop(scn, "use_atom_pdb_cam")
-        col.prop(scn, "use_atom_pdb_lamp")
+        col.prop(scn, "use_camera")
+        col.prop(scn, "use_lamp")
         col = row.column()
         col.operator("atom_pdb.button_reload")
-        col.prop(scn, "atom_pdb_number_atoms")
+        col.prop(scn, "number_atoms")
         row = box.row()
         row.operator("atom_pdb.button_distance")
-        row.prop(scn, "atom_pdb_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, "atom_pdb_radius_how")
+        row.prop(scn, "radius_how")
         row = box.row()
         row.label(text="1. Change type of radii")
         row = box.row()
-        row.prop(scn, "atom_pdb_radius_type")
+        row.prop(scn, "radius_type")
         row = box.row()
         row.label(text="2. Change atom radii in pm")
         row = box.row()
-        row.prop(scn, "atom_pdb_radius_pm_name")
+        row.prop(scn, "radius_pm_name")
         row = box.row()
-        row.prop(scn, "atom_pdb_radius_pm")
+        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, "atom_pdb_radius_all")
+        col.prop(scn, "radius_all")
         col = row.column(align=True)
         col.operator( "atom_pdb.radius_all_bigger" )
         col.operator( "atom_pdb.radius_all_smaller" )
@@ -166,7 +173,6 @@ class CLASS_atom_pdb_panel(Panel):
         col.operator( "atom_pdb.radius_sticks" )
 
         if bpy.context.mode == 'EDIT_MESH':
-
             row = layout.row()
             row.label(text="Separate atom")
             box = layout.box()
@@ -174,113 +180,114 @@ class CLASS_atom_pdb_panel(Panel):
             row.operator( "atom_pdb.separate_atom" )
 
 
-class CLASS_atom_pdb_IO(bpy.types.PropertyGroup):
+# 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):
-        scnn = bpy.context.scene
+        scn = bpy.context.scene.atom_pdb[0]
         import_pdb.DEF_atom_pdb_radius_type(
-                scnn.atom_pdb_radius_type,
-                scnn.atom_pdb_radius_how,
-                )
+                scn.radius_type,
+                scn.radius_how,)
 
     def Callback_radius_pm(self, context):
-        scnn = bpy.context.scene
+        scn = bpy.context.scene.atom_pdb[0]
         import_pdb.DEF_atom_pdb_radius_pm(
-                scnn.atom_pdb_radius_pm_name,
-                scnn.atom_pdb_radius_pm,
-                scnn.atom_pdb_radius_how,
-                )
-
-    # In the file dialog window
-    scn = bpy.types.Scene
-    scn.use_atom_pdb_cam = BoolProperty(
+                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?")
-    scn.use_atom_pdb_lamp = BoolProperty(
+    use_lamp = BoolProperty(
         name="Lamp", default=False,
         description = "Do you need a lamp?")
-    scn.use_atom_pdb_mesh = BoolProperty(
+    use_mesh = BoolProperty(
         name = "Mesh balls", default=False,
         description = "Use mesh balls instead of NURBS")
-    scn.atom_pdb_mesh_azimuth = IntProperty(
-        name = "Azimuth", default=32, min=0,
+    mesh_azimuth = IntProperty(
+        name = "Azimuth", default=32, min=1,
         description = "Number of sectors (azimuth)")
-    scn.atom_pdb_mesh_zenith = IntProperty(
-        name = "Zenith", default=32, min=0,
+    mesh_zenith = IntProperty(
+        name = "Zenith", default=32, min=1,
         description = "Number of sectors (zenith)")
-    scn.atom_pdb_scale_ballradius = FloatProperty(
-        name = "Balls", default=1.0, min=0.0,
+    scale_ballradius = FloatProperty(
+        name = "Balls", default=1.0, min=0.0001,
         description = "Scale factor for all atom radii")
-    scn.atom_pdb_scale_distances = FloatProperty (
-        name = "Distances", default=1.0, min=0.0,
+    scale_distances = FloatProperty (
+        name = "Distances", default=1.0, min=0.0001,
         description = "Scale factor for all distances")
-    scn.use_atom_pdb_center = BoolProperty(
+    use_center = BoolProperty(
         name = "Object to origin", default=True,
         description = "Put the object into the global origin")
-    scn.use_atom_pdb_sticks = BoolProperty(
+    use_sticks = BoolProperty(
         name="Use sticks", default=True,
         description="Do you want to display the sticks?")
-    scn.atom_pdb_sticks_sectors = IntProperty(
-        name = "Sector", default=20, min=0,
+    sticks_sectors = IntProperty(
+        name = "Sector", default=20, min=1,
         description="Number of sectors of a stick")
-    scn.atom_pdb_sticks_radius = FloatProperty(
-        name = "Radius", default=0.1, min=0.0,
+    sticks_radius = FloatProperty(
+        name = "Radius", default=0.1, min=0.0001,
         description ="Radius of a stick")
-    scn.use_atom_pdb_sticks_color = BoolProperty(
+    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")
-    scn.use_atom_pdb_sticks_smooth = BoolProperty(
+    use_sticks_smooth = BoolProperty(
         name="Smooth", default=False,
         description="The sticks are round (sectors are not visible)")     
-    scn.use_atom_pdb_sticks_bonds = BoolProperty(
+    use_sticks_bonds = BoolProperty(
         name="Bonds", default=False,
-        description="Show double and tripple bonds")
-    scn.atom_pdb_sticks_dist = FloatProperty(
+        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")        
-    scn.atom_pdb_atomradius = EnumProperty(
+    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',)
-
+               default='0',)  
     # In the panel
-    scn.atom_pdb_datafile = StringProperty(
+    datafile = StringProperty(
         name = "", description="Path to your custom data file",
         maxlen = 256, default = "", subtype='FILE_PATH')
-    scn.atom_pdb_PDB_file = StringProperty(
+    PDB_file = StringProperty(
         name = "PDB file", default="",
         description = "Path of the PDB file")
-    scn.atom_pdb_number_atoms = StringProperty(name="",
+    number_atoms = StringProperty(name="",
         default="Number", description = "This output shows "
         "the number of atoms which have been loaded")
-    scn.atom_pdb_distance = StringProperty(
+    distance = StringProperty(
         name="", default="Distance (A)",
         description="Distance of 2 objects in Angstrom")
-    scn.atom_pdb_radius_how = EnumProperty(
+    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',)
-    scn.atom_pdb_radius_type = EnumProperty(
+    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)
-    scn.atom_pdb_radius_pm_name = StringProperty(
+    radius_pm_name = StringProperty(
         name="", default="Atom name",
         description="Put in the name of the atom (e.g. Hydrogen)")
-    scn.atom_pdb_radius_pm = FloatProperty(
-        name="", default=100.0, min=0.0,
+    radius_pm = FloatProperty(
+        name="", default=100.0, min=0.01,
         description="Put in the radius of the atom (in pm)",
         update=Callback_radius_pm)
-    scn.atom_pdb_radius_all = FloatProperty(
-        name="Scale", default = 1.05, min=1.0,
+    radius_all = FloatProperty(
+        name="Scale", default = 1.05, min=1.0, max=5.0,
         description="Put in the scale factor")
 
 
@@ -291,28 +298,12 @@ class CLASS_atom_pdb_datafile_apply(Operator):
     bl_description = "Use color and radii values stored in the custom file"
 
     def execute(self, context):
-        scn    = bpy.context.scene
+        scn    = bpy.context.scene.atom_pdb[0]
 
-        if scn.atom_pdb_datafile == "":
+        if scn.datafile == "":
             return {'FINISHED'}
 
-        import_pdb.DEF_atom_pdb_custom_datafile(scn.atom_pdb_datafile)
-
-        # TODO, move this into 'import_pdb' 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_pdb.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 import_pdb.ATOM_PDB_ELEMENTS:
-                        if element.name in obj.name:
-                            obj.scale = (element.radii[0],) * 3
-                            obj.active_material.diffuse_color = element.color
+        import_pdb.DEF_atom_pdb_custom_datafile(scn.datafile)
 
         return {'FINISHED'}
 
@@ -324,7 +315,7 @@ class CLASS_atom_pdb_separate_atom(Operator):
     bl_description = "Separate the atom you have chosen"
 
     def execute(self, context):
-        scn    = bpy.context.scene
+        scn = bpy.context.scene.atom_pdb[0]
 
         # Get first all important properties from the atom which the user
         # has chosen: location, color, scale
@@ -345,13 +336,13 @@ class CLASS_atom_pdb_separate_atom(Operator):
         # ... delete the new mesh including the separated vertex
         bpy.ops.object.select_all(action='DESELECT')
         new_object.select = True
-        bpy.ops.object.delete()  # TODO, use scene.objects.unlink()
+        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_atom_pdb_mesh == False:
+            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,
@@ -359,8 +350,8 @@ class CLASS_atom_pdb_separate_atom(Operator):
                                     layers=current_layers)
             else:
                 bpy.ops.mesh.primitive_uv_sphere_add(
-                                segments=scn.atom_pdb_mesh_azimuth,
-                                ring_count=scn.atom_pdb_mesh_zenith,
+                                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),
@@ -377,7 +368,6 @@ class CLASS_atom_pdb_separate_atom(Operator):
         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
@@ -396,7 +386,7 @@ class CLASS_atom_pdb_distance_button(Operator):
     bl_description = "Measure the distance between two objects (only in Object Mode)"
 
     def execute(self, context):
-        scn    = bpy.context.scene
+        scn    = bpy.context.scene.atom_pdb[0]
         dist   = import_pdb.DEF_atom_pdb_distance()
 
         if dist != "N.A.":
@@ -408,7 +398,7 @@ class CLASS_atom_pdb_distance_button(Operator):
            dist   = dist + " A"
 
         # Put the distance into the string of the output field.
-        scn.atom_pdb_distance = dist
+        scn.distance = dist
         return {'FINISHED'}
 
 
@@ -419,11 +409,10 @@ class CLASS_atom_pdb_radius_all_bigger_button(Operator):
     bl_description = "Increase the radii of the atoms"
 
     def execute(self, context):
-        scn = bpy.context.scene
+        scn = bpy.context.scene.atom_pdb[0]
         import_pdb.DEF_atom_pdb_radius_all(
-                scn.atom_pdb_radius_all,
-                scn.atom_pdb_radius_how,
-                )
+                scn.radius_all,
+                scn.radius_how,)
         return {'FINISHED'}
 
 
@@ -434,11 +423,10 @@ class CLASS_atom_pdb_radius_all_smaller_button(Operator):
     bl_description = "Decrease the radii of the atoms"
 
     def execute(self, context):
-        scn = bpy.context.scene
+        scn = bpy.context.scene.atom_pdb[0]
         import_pdb.DEF_atom_pdb_radius_all(
-                1.0/scn.atom_pdb_radius_all,
-                scn.atom_pdb_radius_how,
-                )
+                1.0/scn.radius_all,
+                scn.radius_how,)
         return {'FINISHED'}
 
 
@@ -451,14 +439,11 @@ class CLASS_atom_pdb_radius_sticks_button(Operator):
 
     def execute(self, context):
         global ATOM_PDB_ERROR
-        
-        scn = bpy.context.scene
+        scn = bpy.context.scene.atom_pdb[0]
                 
         result = import_pdb.DEF_atom_pdb_radius_sticks(
-                     scn.atom_pdb_sticks_radius * 0.9,
-                     scn.atom_pdb_radius_how,
-                     )
-                     
+                     0.01,
+                     scn.radius_how,)  
         if result == False:
             ATOM_PDB_ERROR = "No sticks => no changes"
             bpy.ops.atom_pdb.error_dialog('INVOKE_DEFAULT')
@@ -473,156 +458,310 @@ class CLASS_atom_pdb_load_button(Operator):
     bl_description = "Load the structure again"
 
     def execute(self, context):
-        scn = bpy.context.scene
-
-        azimuth    = scn.atom_pdb_mesh_azimuth
-        zenith     = scn.atom_pdb_mesh_zenith
-        bradius    = scn.atom_pdb_scale_ballradius
-        bdistance  = scn.atom_pdb_scale_distances
-        radiustype = scn.atom_pdb_atomradius
-        center     = scn.use_atom_pdb_center
-        sticks     = scn.use_atom_pdb_sticks
-        sticks_col = scn.use_atom_pdb_sticks_color
-        sticks_sm  = scn.use_atom_pdb_sticks_smooth
-        ssector    = scn.atom_pdb_sticks_sectors
-        sradius    = scn.atom_pdb_sticks_radius
-        stick_bond = scn.use_atom_pdb_sticks_bonds
-        stick_dist = scn.atom_pdb_sticks_dist
-        
-        cam        = scn.use_atom_pdb_cam
-        lamp       = scn.use_atom_pdb_lamp
-        mesh       = scn.use_atom_pdb_mesh
-        datafile   = scn.atom_pdb_datafile
+        scn = context.scene.atom_pdb[0]
         
-        # Execute main routine an other time ... from the panel
         atom_number = import_pdb.DEF_atom_pdb_main(
-                mesh, azimuth, zenith, bradius, radiustype, bdistance, 
-                sticks, sticks_col, sticks_sm, stick_bond,
-                stick_dist, ssector, sradius, center, cam, lamp, datafile)
-        scn.atom_pdb_number_atoms = str(atom_number) + " atoms"
+                      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.
-class ImportPDB(Operator, ImportHelper):
+# This is the class for the file dialog of the importer.
+class CLASS_ImportPDB(Operator, ImportHelper):
     bl_idname = "import_mesh.pdb"
     bl_label  = "Import Protein Data Bank(*.pdb)"
+    bl_options = {'PRESET', 'UNDO'}
 
     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")
+    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")
+    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',)        
+    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")        
+    use_center = BoolProperty(
+        name = "Object to origin", default=True,
+        description = "Put the object into the global origin")           
+    datafile = StringProperty(
+        name = "", description="Path to your custom data file",
+        maxlen = 256, default = "", subtype='FILE_PATH')
+
     def draw(self, context):
         layout = self.layout
-        scn = bpy.context.scene
-
         row = layout.row()
-        row.prop(scn, "use_atom_pdb_cam")
-        row.prop(scn, "use_atom_pdb_lamp")
+        row.prop(self, "use_camera")
+        row.prop(self, "use_lamp")
         row = layout.row()
         col = row.column()
-        col.prop(scn, "use_atom_pdb_mesh")
+        col.prop(self, "use_mesh")
         col = row.column(align=True)
-        col.active = scn.use_atom_pdb_mesh
-        col.prop(scn, "atom_pdb_mesh_azimuth")
-        col.prop(scn, "atom_pdb_mesh_zenith")
-
+        col.active = self.use_mesh
+        col.prop(self, "mesh_azimuth")
+        col.prop(self, "mesh_zenith")
         row = layout.row()
         col = row.column()
         col.label(text="Scaling factors")
         col = row.column(align=True)
-        col.prop(scn, "atom_pdb_scale_ballradius")
-        col.prop(scn, "atom_pdb_scale_distances")
+        col.prop(self, "scale_ballradius")
+        col.prop(self, "scale_distances")
+        row = layout.row()
+        row.prop(self, "atomradius")
         row = layout.row()
         col = row.column()
-        col.prop(scn, "use_atom_pdb_sticks")
+        col.prop(self, "use_sticks")
         row = layout.row()        
-        row.active = scn.use_atom_pdb_sticks
-        col = row.column(align=True)
-        col.prop(scn, "atom_pdb_sticks_sectors")
-        col.prop(scn, "atom_pdb_sticks_radius")
+        row.active = self.use_sticks
+        col = row.column()
+        col.prop(self, "sticks_sectors")
+        col.prop(self, "sticks_radius")
+        col.prop(self, "sticks_unit_length")
         col = row.column(align=True)        
-        col.prop(scn, "use_atom_pdb_sticks_color")        
-        col.prop(scn, "use_atom_pdb_sticks_smooth")
-        col.prop(scn, "use_atom_pdb_sticks_bonds")
+        col.prop(self, "use_sticks_color")        
+        col.prop(self, "use_sticks_smooth")
+        col.prop(self, "use_sticks_bonds")
         row = layout.row()        
-        row.active = scn.use_atom_pdb_sticks
+        row.active = self.use_sticks
         col = row.column(align=True)
         col = row.column(align=True)
-        col.active = scn.use_atom_pdb_sticks and scn.use_atom_pdb_sticks_bonds 
-        col.prop(scn, "atom_pdb_sticks_dist")
-
+        col.active = self.use_sticks and self.use_sticks_bonds 
+        col.prop(self, "sticks_dist")
         row = layout.row()
-        row.prop(scn, "use_atom_pdb_center")
-
+        row.prop(self, "use_center")
         row = layout.row()
-        row.prop(scn, "atom_pdb_atomradius")
+        row.prop(bpy.context.scene, "use_panel")
 
     def execute(self, context):
-        scn = bpy.context.scene
-
         # This is in order to solve this strange 'relative path' thing.
         import_pdb.ATOM_PDB_FILEPATH = bpy.path.abspath(self.filepath)
 
-        scn.atom_pdb_PDB_file = import_pdb.ATOM_PDB_FILEPATH
-
-        azimuth    = scn.atom_pdb_mesh_azimuth
-        zenith     = scn.atom_pdb_mesh_zenith
-        bradius    = scn.atom_pdb_scale_ballradius
-        bdistance  = scn.atom_pdb_scale_distances
-        radiustype = scn.atom_pdb_atomradius
-        center     = scn.use_atom_pdb_center
-        sticks     = scn.use_atom_pdb_sticks
-        sticks_col = scn.use_atom_pdb_sticks_color
-        sticks_sm  = scn.use_atom_pdb_sticks_smooth
-        ssector    = scn.atom_pdb_sticks_sectors
-        sradius    = scn.atom_pdb_sticks_radius
-        stick_bond = scn.use_atom_pdb_sticks_bonds
-        stick_dist = scn.atom_pdb_sticks_dist
-                
-        cam        = scn.use_atom_pdb_cam
-        lamp       = scn.use_atom_pdb_lamp
-        mesh       = scn.use_atom_pdb_mesh
-        datafile   = scn.atom_pdb_datafile
-        
-        # Execute main routine
+        # Execute main routine                
         atom_number = import_pdb.DEF_atom_pdb_main(
-                mesh, azimuth, zenith, bradius, radiustype, bdistance, 
-                sticks, sticks_col, sticks_sm, stick_bond,
-                stick_dist, ssector, sradius, center, cam, lamp, datafile)
-
-        scn.atom_pdb_number_atoms = str(atom_number) + " atoms"
+                      self.use_mesh,
+                      self.mesh_azimuth,
+                      self.mesh_zenith,
+                      self.scale_ballradius,
+                      self.atomradius,
+                      self.scale_distances,
+                      self.use_sticks,
+                      self.use_sticks_color,
+                      self.use_sticks_smooth,
+                      self.use_sticks_bonds,
+                      self.sticks_unit_length,
+                      self.sticks_dist,
+                      self.sticks_sectors,
+                      self.sticks_radius,
+                      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)
 
         return {'FINISHED'}
 
 
-class CLASS_atom_pdb_error_dialog(bpy.types.Operator):
-    bl_idname = "atom_pdb.error_dialog"
-    bl_label = "Attention !"
-    
+
+# This is the class for the file dialog of the exporter.
+class CLASS_ExportPDB(Operator, ExportHelper):
+    bl_idname = "export_mesh.pdb"
+    bl_label  = "Export Protein Data Bank(*.pdb)"
+    filename_ext = ".pdb"
+
+    filter_glob  = StringProperty(
+        default="*.pdb", options={'HIDDEN'},)
+
+    atom_pdb_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.label(text="                          "+ATOM_PDB_ERROR) 
+        row.prop(self, "atom_pdb_export_type")
+
     def execute(self, context):
-        print("Atomic Blender - Error: "+ATOM_PDB_ERROR+"\n")
+        # 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)
+
         return {'FINISHED'}
-    def invoke(self, context, event):
-        return context.window_manager.invoke_props_dialog(self)
 
 
 # The entry into the menu 'file -> import'
-def menu_func(self, context):
-    self.layout.operator(ImportPDB.bl_idname, text="Protein Data Bank (.pdb)")
+def DEF_menu_func_import(self, context):
+    self.layout.operator(CLASS_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 register():
+    DEF_panel_yes_no()
     bpy.utils.register_module(__name__)
-    bpy.types.INFO_MT_file_import.append(menu_func)
-
+    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()
+    
 def unregister():
     bpy.utils.unregister_module(__name__)
-    bpy.types.INFO_MT_file_import.remove(menu_func)
+    bpy.types.INFO_MT_file_import.remove(DEF_menu_func_import)
+    bpy.types.INFO_MT_file_export.remove(DEF_menu_func_export)
 
 if __name__ == "__main__":
 
diff --git a/release/scripts/addons/io_mesh_pdb/atom_info.dat b/release/scripts/addons/io_mesh_pdb/atom_info.dat
index efd72f6..5e00a5f 100644
--- a/release/scripts/addons/io_mesh_pdb/atom_info.dat
+++ b/release/scripts/addons/io_mesh_pdb/atom_info.dat
@@ -3,7 +3,7 @@ Atom
 Number           : 1
 Name             : Hydrogen
 Short name       : H
-Color            : 0.0,0.0,1.0
+Color            : 0.99,0.99,0.99
 Radius used      : 0.320000
 Radius, covalent : 0.320000
 Radius, atomic   : 0.790000
@@ -16,7 +16,7 @@ Atom
 Number           : 2
 Name             : Helium
 Short name       : He
-Color            : 0.207843137255,0.56862745098,0.207843137255
+Color            : 0.84,0.99,0.99
 Radius used      : 0.930000
 Radius, covalent : 0.930000
 Radius, atomic   : 0.490000
@@ -27,7 +27,7 @@ Atom
 Number           : 3
 Name             : Lithium
 Short name       : Li
-Color            : 0.729411764706,0.278431372549,0.254901960784
+Color            : 0.79,0.5,0.99
 Radius used      : 1.230000
 Radius, covalent : 1.230000
 Radius, atomic   : 2.050000
@@ -40,7 +40,7 @@ Atom
 Number           : 4
 Name             : Beryllium
 Short name       : Be
-Color            : 0.447058823529,0.725490196078,0.309803921569
+Color            : 0.75,0.99,0.0
 Radius used      : 0.900000
 Radius, covalent : 0.900000
 Radius, atomic   : 1.400000
@@ -55,7 +55,7 @@ Atom
 Number           : 5
 Name             : Boron
 Short name       : B
-Color            : 1.0,1.0,1.0
+Color            : 0.99,0.70,0.70
 Radius used      : 0.820000
 Radius, covalent : 0.820000
 Radius, atomic   : 1.170000
@@ -70,8 +70,8 @@ Atom
 Number           : 6
 Name             : Carbon
 Short name       : C
-Color            : 0.0,0.0,0.0
-Radius used      : 0.770000
+Color            : 0.3,0.3,0.3
+Radius used      : 0.910000
 Radius, covalent : 0.770000
 Radius, atomic   : 0.910000
 Charge state     : -4
@@ -85,7 +85,7 @@ Atom
 Number           : 7
 Name             : Nitrogen
 Short name       : N
-Color            : 0.0,0.0,1.0
+Color            : 0.18,0.31,0.96
 Radius used      : 0.750000
 Radius, covalent : 0.750000
 Radius, atomic   : 0.750000
@@ -104,7 +104,7 @@ Atom
 Number           : 8
 Name             : Oxygen
 Short name       : O
-Color            : 1.0,0.0,0.0
+Color            : 0.99,0.05,0.05
 Radius used      : 0.730000
 Radius, covalent : 0.730000
 Radius, atomic   : 0.650000
@@ -124,7 +124,7 @@ Number           : 9
 Name             : Fluorine
 Short name       : F
 Color            : 0.0,1.0,0.0
-Radius used      : 0.720000
+Radius used      : 1.330000
 Radius, covalent : 0.720000
 Radius, atomic   : 0.570000
 Charge state     : -1
@@ -138,7 +138,7 @@ Atom
 Number           : 10
 Name             : Neon
 Short name       : Ne
-Color            : 0.537254901961,0.607843137255,0.525490196078
+Color            : 0.69,0.88,0.95
 Radius used      : 0.710000
 Radius, covalent : 0.710000
 Radius, atomic   : 0.510000
@@ -151,8 +151,8 @@ Atom
 Number           : 11
 Name             : Sodium
 Short name       : Na
-Color            : 0.0,0.0,1.0
-Radius used      : 1.540000
+Color            : 0.5,0.5,0.5
+Radius used      : 0.970000
 Radius, covalent : 1.540000
 Radius, atomic   : 2.230000
 Charge state     : 1
@@ -164,8 +164,8 @@ Atom
 Number           : 12
 Name             : Magnesium
 Short name       : Mg
-Color            : 1.0,1.0,1.0
-Radius used      : 1.360000
+Color            : 0.38,0.066,1.0
+Radius used      : 0.660000
 Radius, covalent : 1.360000
 Radius, atomic   : 1.720000
 Charge state     : 1
@@ -179,7 +179,7 @@ Atom
 Number           : 13
 Name             : Aluminium
 Short name       : Al
-Color            : 0.701960784314,0.2,0.623529411765
+Color            : 0.74,0.64,0.64
 Radius used      : 1.180000
 Radius, covalent : 1.180000
 Radius, atomic   : 1.820000
@@ -192,7 +192,7 @@ Atom
 Number           : 14
 Name             : Silicon
 Short name       : Si
-Color            : 0.654901960784,0.647058823529,0.278431372549
+Color            : 0.93,0.78,0.62
 Radius used      : 1.110000
 Radius, covalent : 1.110000
 Radius, atomic   : 1.460000
@@ -211,7 +211,7 @@ Atom
 Number           : 15
 Name             : Phosphorus
 Short name       : P
-Color            : 1.0,1.0,0.0
+Color            : 0.99,0.5,0.0
 Radius used      : 1.060000
 Radius, covalent : 1.060000
 Radius, atomic   : 1.230000
@@ -228,7 +228,7 @@ Atom
 Number           : 16
 Name             : Sulfur
 Short name       : S
-Color            : 1.0,1.0,0.501960784314
+Color            : 0.99,0.99,0.18
 Radius used      : 1.020000
 Radius, covalent : 1.020000
 Radius, atomic   : 1.090000
@@ -247,8 +247,8 @@ Atom
 Number           : 17
 Name             : Chlorine
 Short name       : Cl
-Color            : 0.0,1.0,0.0
-Radius used      : 0.990000
+Color            : 0.095,0.411,1.0
+Radius used      : 1.810000
 Radius, covalent : 0.990000
 Radius, atomic   : 0.970000
 Charge state     : -1
@@ -264,7 +264,7 @@ Atom
 Number           : 18
 Name             : Argon
 Short name       : Ar
-Color            : 0.317647058824,0.329411764706,0.749019607843
+Color            : 0.5,0.81,0.88
 Radius used      : 0.980000
 Radius, covalent : 0.980000
 Radius, atomic   : 0.880000
@@ -277,7 +277,7 @@ Atom
 Number           : 19
 Name             : Potassium
 Short name       : K
-Color            : 0.811764705882,0.239215686275,0.423529411765
+Color            : 0.55,0.25,0.82
 Radius used      : 2.030000
 Radius, covalent : 2.030000
 Radius, atomic   : 2.770000
@@ -290,7 +290,7 @@ Atom
 Number           : 20
 Name             : Calcium
 Short name       : Ca
-Color            : 1.0,1.0,1.0
+Color            : 0.23,0.99,0.0
 Radius used      : 1.740000
 Radius, covalent : 1.740000
 Radius, atomic   : 2.230000
@@ -305,7 +305,7 @@ Atom
 Number           : 21
 Name             : Scandium
 Short name       : Sc
-Color            : 0.662745098039,0.447058823529,0.313725490196
+Color            : 0.89,0.89,0.89
 Radius used      : 1.440000
 Radius, covalent : 1.440000
 Radius, atomic   : 2.090000
@@ -318,7 +318,7 @@ Atom
 Number           : 22
 Name             : Titanium
 Short name       : Ti
-Color            : 0.270588235294,0.533333333333,0.686274509804
+Color            : 0.74,0.75,0.77
 Radius used      : 1.320000
 Radius, covalent : 1.320000
 Radius, atomic   : 2.000000
@@ -337,7 +337,7 @@ Atom
 Number           : 23
 Name             : Vanadium
 Short name       : V
-Color            : 0.270588235294,0.243137254902,0.635294117647
+Color            : 0.64,0.64,0.66
 Radius used      : 1.220000
 Radius, covalent : 1.220000
 Radius, atomic   : 1.920000
@@ -356,7 +356,7 @@ Atom
 Number           : 24
 Name             : Chromium
 Short name       : Cr
-Color            : 0.807843137255,0.286274509804,0.819607843137
+Color            : 0.53,0.59,0.77
 Radius used      : 1.180000
 Radius, covalent : 1.180000
 Radius, atomic   : 1.850000
@@ -375,7 +375,7 @@ Atom
 Number           : 25
 Name             : Manganese
 Short name       : Mn
-Color            : 0.752941176471,0.352941176471,0.552941176471
+Color            : 0.60,0.47,0.77
 Radius used      : 1.170000
 Radius, covalent : 1.170000
 Radius, atomic   : 1.790000
@@ -394,7 +394,7 @@ Atom
 Number           : 26
 Name             : Iron
 Short name       : Fe
-Color            : 1.0,0.0,0.0
+Color            : 0.87,0.39,0.19
 Radius used      : 1.170000
 Radius, covalent : 1.170000
 Radius, atomic   : 1.720000
@@ -409,7 +409,7 @@ Atom
 Number           : 27
 Name             : Cobalt
 Short name       : Co
-Color            : 0.274509803922,0.219607843137,0.752941176471
+Color            : 0.93,0.56,0.62
 Radius used      : 1.160000
 Radius, covalent : 1.160000
 Radius, atomic   : 1.670000
@@ -424,7 +424,7 @@ Atom
 Number           : 28
 Name             : Nickel
 Short name       : Ni
-Color            : 0.439215686275,0.360784313725,0.862745098039
+Color            : 0.31,0.81,0.31
 Radius used      : 1.150000
 Radius, covalent : 1.150000
 Radius, atomic   : 1.620000
@@ -437,7 +437,7 @@ Atom
 Number           : 29
 Name             : Copper
 Short name       : Cu
-Color            : 0.607843137255,0.0,0.0
+Color            : 0.78,0.5,0.19
 Radius used      : 1.170000
 Radius, covalent : 1.170000
 Radius, atomic   : 1.570000
@@ -452,7 +452,7 @@ Atom
 Number           : 30
 Name             : Zinc
 Short name       : Zn
-Color            : 0.423529411765,0.36862745098,0.450980392157
+Color            : 0.48,0.5,0.68
 Radius used      : 1.250000
 Radius, covalent : 1.250000
 Radius, atomic   : 1.530000
@@ -467,7 +467,7 @@ Atom
 Number           : 31
 Name             : Gallium
 Short name       : Ga
-Color            : 0.635294117647,0.729411764706,0.337254901961
+Color            : 0.75,0.55,0.55
 Radius used      : 1.260000
 Radius, covalent : 1.260000
 Radius, atomic   : 1.810000
@@ -482,7 +482,7 @@ Atom
 Number           : 32
 Name             : Germanium
 Short name       : Ge
-Color            : 0.423529411765,0.756862745098,0.301960784314
+Color            : 0.39,0.55,0.55
 Radius used      : 1.220000
 Radius, covalent : 1.220000
 Radius, atomic   : 1.520000
@@ -499,7 +499,7 @@ Atom
 Number           : 33
 Name             : Arsenic
 Short name       : As
-Color            : 0.396078431373,0.776470588235,0.250980392157
+Color            : 0.73,0.5,0.88
 Radius used      : 1.200000
 Radius, covalent : 1.200000
 Radius, atomic   : 1.330000
@@ -516,7 +516,7 @@ Atom
 Number           : 34
 Name             : Selenium
 Short name       : Se
-Color            : 0.952941176471,0.270588235294,0.905882352941
+Color            : 0.99,0.62,0.0
 Radius used      : 1.160000
 Radius, covalent : 1.160000
 Radius, atomic   : 1.220000
@@ -537,7 +537,7 @@ Atom
 Number           : 35
 Name             : Bromine
 Short name       : Br
-Color            : 0.0,0.498039215686,0.0
+Color            : 0.64,0.16,0.16
 Radius used      : 1.140000
 Radius, covalent : 1.140000
 Radius, atomic   : 1.120000
@@ -554,7 +554,7 @@ Atom
 Number           : 36
 Name             : Krypton
 Short name       : Kr
-Color            : 0.227450980392,0.435294117647,0.192156862745
+Color            : 0.35,0.71,0.81
 Radius used      : 1.310000
 Radius, covalent : 1.310000
 Radius, atomic   : 1.240000
@@ -565,7 +565,7 @@ Atom
 Number           : 37
 Name             : Rubidium
 Short name       : Rb
-Color            : 1.0,1.0,1.0
+Color            : 0.43,0.17,0.68
 Radius used      : 2.160000
 Radius, covalent : 2.160000
 Radius, atomic   : 2.980000
@@ -578,7 +578,7 @@ Atom
 Number           : 38
 Name             : Strontium
 Short name       : Sr
-Color            : 1.0,1.0,1.0
+Color            : 0.0,0.99,0.0
 Radius used      : 1.910000
 Radius, covalent : 1.910000
 Radius, atomic   : 2.450000
@@ -591,7 +591,7 @@ Atom
 Number           : 39
 Name             : Yttrium
 Short name       : Y
-Color            : 1.0,1.0,1.0
+Color            : 0.57,0.99,0.99
 Radius used      : 1.620000
 Radius, covalent : 1.620000
 Radius, atomic   : 2.270000
@@ -604,7 +604,7 @@ Atom
 Number           : 40
 Name             : Zirconium
 Short name       : Zr
-Color            : 1.0,1.0,1.0
+Color            : 0.57,0.87,0.87
 Radius used      : 1.450000
 Radius, covalent : 1.450000
 Radius, atomic   : 2.160000
@@ -619,7 +619,7 @@ Atom
 Number           : 41
 Name             : Niobium
 Short name       : Nb
-Color            : 1.0,1.0,1.0
+Color            : 0.44,0.75,0.78
 Radius used      : 1.340000
 Radius, covalent : 1.340000
 Radius, atomic   : 2.080000
@@ -636,7 +636,7 @@ Atom
 Number           : 42
 Name             : Molybdenum
 Short name       : Mo
-Color            : 1.0,1.0,1.0
+Color            : 0.32,0.70,0.70
 Radius used      : 1.300000
 Radius, covalent : 1.300000
 Radius, atomic   : 2.010000
@@ -653,7 +653,7 @@ Atom
 Number           : 43
 Name             : Technetium
 Short name       : Tc
-Color            : 1.0,1.0,1.0
+Color            : 0.23,0.61,0.61
 Radius used      : 1.270000
 Radius, covalent : 1.270000
 Radius, atomic   : 1.950000
@@ -666,7 +666,7 @@ Atom
 Number           : 44
 Name             : Ruthenium
 Short name       : Ru
-Color            : 1.0,1.0,1.0
+Color            : 0.14,0.55,0.55
 Radius used      : 1.250000
 Radius, covalent : 1.250000
 Radius, atomic   : 1.890000
@@ -679,7 +679,7 @@ Atom
 Number           : 45
 Name             : Rhodium
 Short name       : Rh
-Color            : 1.0,1.0,1.0
+Color            : 0.03,0.48,0.54
 Radius used      : 1.250000
 Radius, covalent : 1.250000
 Radius, atomic   : 1.830000
@@ -692,7 +692,7 @@ Atom
 Number           : 46
 Name             : Palladium
 Short name       : Pd
-Color            : 1.0,1.0,1.0
+Color            : 0.0,0.41,0.51
 Radius used      : 1.280000
 Radius, covalent : 1.280000
 Radius, atomic   : 1.790000
@@ -707,7 +707,7 @@ Atom
 Number           : 47
 Name             : Silver
 Short name       : Ag
-Color            : 1.0,1.0,1.0
+Color            : 0.75,0.75,0.75
 Radius used      : 1.340000
 Radius, covalent : 1.340000
 Radius, atomic   : 1.750000
@@ -722,7 +722,7 @@ Atom
 Number           : 48
 Name             : Cadmium
 Short name       : Cd
-Color            : 1.0,1.0,1.0
+Color            : 0.99,0.84,0.55
 Radius used      : 1.480000
 Radius, covalent : 1.480000
 Radius, atomic   : 1.710000
@@ -737,7 +737,7 @@ Atom
 Number           : 49
 Name             : Indium
 Short name       : In
-Color            : 1.0,1.0,1.0
+Color            : 0.64,0.45,0.44
 Radius used      : 1.440000
 Radius, covalent : 1.440000
 Radius, atomic   : 2.000000
@@ -750,7 +750,7 @@ Atom
 Number           : 50
 Name             : Tin
 Short name       : Sn
-Color            : 1.0,1.0,1.0
+Color            : 0.39,0.5,0.5
 Radius used      : 1.410000
 Radius, covalent : 1.410000
 Radius, atomic   : 1.720000
@@ -769,7 +769,7 @@ Atom
 Number           : 51
 Name             : Antimony
 Short name       : Sb
-Color            : 1.0,1.0,1.0
+Color            : 0.61,0.38,0.70
 Radius used      : 1.400000
 Radius, covalent : 1.400000
 Radius, atomic   : 1.530000
@@ -786,7 +786,7 @@ Atom
 Number           : 52
 Name             : Tellurium
 Short name       : Te
-Color            : 1.0,1.0,1.0
+Color            : 0.82,0.47,0.0
 Radius used      : 1.360000
 Radius, covalent : 1.360000
 Radius, atomic   : 1.420000
@@ -807,7 +807,7 @@ Atom
 Number           : 53
 Name             : Iodine
 Short name       : I
-Color            : 0.0,0.498039215686,0.498039215686
+Color            : 0.57,0.0,0.57
 Radius used      : 1.330000
 Radius, covalent : 1.330000
 Radius, atomic   : 1.320000
@@ -824,7 +824,7 @@ Atom
 Number           : 54
 Name             : Xenon
 Short name       : Xe
-Color            : 1.0,1.0,1.0
+Color            : 0.25,0.61,0.68
 Radius used      : 1.310000
 Radius, covalent : 1.310000
 Radius, atomic   : 1.240000
@@ -835,7 +835,7 @@ Atom
 Number           : 55
 Name             : Caesium
 Short name       : Cs
-Color            : 1.0,1.0,1.0
+Color            : 0.33,0.08,0.55
 Radius used      : 2.350000
 Radius, covalent : 2.350000
 Radius, atomic   : 3.350000
@@ -848,7 +848,7 @@ Atom
 Number           : 56
 Name             : Barium
 Short name       : Ba
-Color            : 1.0,1.0,1.0
+Color            : 0.0,0.78,0.0
 Radius used      : 1.980000
 Radius, covalent : 1.980000
 Radius, atomic   : 2.780000
@@ -863,7 +863,7 @@ Atom
 Number           : 57
 Name             : Lanthanum
 Short name       : La
-Color            : 1.0,1.0,1.0
+Color            : 0.43,0.82,0.99
 Radius used      : 1.690000
 Radius, covalent : 1.690000
 Radius, atomic   : 2.740000
@@ -878,7 +878,7 @@ Atom
 Number           : 58
 Name             : Cerium
 Short name       : Ce
-Color            : 1.0,1.0,1.0
+Color            : 0.99,0.99,0.77
 Radius used      : 1.650000
 Radius, covalent : 1.650000
 Radius, atomic   : 2.700000
@@ -895,7 +895,7 @@ Atom
 Number           : 59
 Name             : Praseodymium
 Short name       : Pr
-Color            : 1.0,1.0,1.0
+Color            : 0.84,0.99,0.77
 Radius used      : 1.650000
 Radius, covalent : 1.650000
 Radius, atomic   : 2.670000
@@ -910,7 +910,7 @@ Atom
 Number           : 60
 Name             : Neodymium
 Short name       : Nd
-Color            : 1.0,1.0,1.0
+Color            : 0.77,0.99,0.77
 Radius used      : 1.640000
 Radius, covalent : 1.640000
 Radius, atomic   : 2.640000
@@ -923,7 +923,7 @@ Atom
 Number           : 61
 Name             : Promethium
 Short name       : Pm
-Color            : 1.0,1.0,1.0
+Color            : 0.63,0.99,0.77
 Radius used      : 1.630000
 Radius, covalent : 1.630000
 Radius, atomic   : 2.620000
@@ -936,7 +936,7 @@ Atom
 Number           : 62
 Name             : Samarium
 Short name       : Sm
-Color            : 1.0,1.0,1.0
+Color            : 0.55,0.99,0.77
 Radius used      : 1.620000
 Radius, covalent : 1.620000
 Radius, atomic   : 2.590000
@@ -949,7 +949,7 @@ Atom
 Number           : 63
 Name             : Europium
 Short name       : Eu
-Color            : 1.0,1.0,1.0
+Color            : 0.37,0.99,0.77
 Radius used      : 1.850000
 Radius, covalent : 1.850000
 Radius, atomic   : 2.560000
@@ -964,7 +964,7 @@ Atom
 Number           : 64
 Name             : Gadolinium
 Short name       : Gd
-Color            : 1.0,1.0,1.0
+Color            : 0.26,0.99,0.77
 Radius used      : 1.610000
 Radius, covalent : 1.610000
 Radius, atomic   : 2.540000
@@ -977,7 +977,7 @@ Atom
 Number           : 65
 Name             : Terbium
 Short name       : Tb
-Color            : 1.0,1.0,1.0
+Color            : 0.18,0.99,0.77
 Radius used      : 1.590000
 Radius, covalent : 1.590000
 Radius, atomic   : 2.510000
@@ -992,7 +992,7 @@ Atom
 Number           : 66
 Name             : Dysprosium
 Short name       : Dy
-Color            : 1.0,1.0,1.0
+Color            : 0.12,0.99,0.77
 Radius used      : 1.590000
 Radius, covalent : 1.590000
 Radius, atomic   : 2.490000
@@ -1005,7 +1005,7 @@ Atom
 Number           : 67
 Name             : Holmium
 Short name       : Ho
-Color            : 1.0,1.0,1.0
+Color            : 0.0,0.99,0.60
 Radius used      : 1.580000
 Radius, covalent : 1.580000
 Radius, atomic   : 2.470000
@@ -1018,7 +1018,7 @@ Atom
 Number           : 68
 Name             : Erbium
 Short name       : Er
-Color            : 0.482352941176,0.482352941176,0.482352941176
+Color            : 0.0,0.89,0.45
 Radius used      : 1.570000
 Radius, covalent : 1.570000
 Radius, atomic   : 2.450000
@@ -1031,7 +1031,7 @@ Atom
 Number           : 69
 Name             : Thulium
 Short name       : Tm
-Color            : 1.0,1.0,1.0
+Color            : 0.0,0.82,0.32
 Radius used      : 1.560000
 Radius, covalent : 1.560000
 Radius, atomic   : 2.420000
@@ -1044,7 +1044,7 @@ Atom
 Number           : 70
 Name             : Ytterbium
 Short name       : Yb
-Color            : 1.0,1.0,1.0
+Color            : 0.0,0.74,0.21
 Radius used      : 1.740000
 Radius, covalent : 1.740000
 Radius, atomic   : 2.400000
@@ -1059,7 +1059,7 @@ Atom
 Number           : 71
 Name             : Lutetium
 Short name       : Lu
-Color            : 1.0,1.0,1.0
+Color            : 0.0,0.66,0.14
 Radius used      : 1.560000
 Radius, covalent : 1.560000
 Radius, atomic   : 2.250000
@@ -1072,7 +1072,7 @@ Atom
 Number           : 72
 Name             : Hafnium
 Short name       : Hf
-Color            : 1.0,1.0,1.0
+Color            : 0.30,0.75,0.99
 Radius used      : 1.440000
 Radius, covalent : 1.440000
 Radius, atomic   : 2.160000
@@ -1085,7 +1085,7 @@ Atom
 Number           : 73
 Name             : Tantalum
 Short name       : Ta
-Color            : 1.0,1.0,1.0
+Color            : 0.30,0.64,0.99
 Radius used      : 1.340000
 Radius, covalent : 1.340000
 Radius, atomic   : 2.090000
@@ -1098,7 +1098,7 @@ Atom
 Number           : 74
 Name             : Tungsten
 Short name       : W
-Color            : 1.0,1.0,1.0
+Color            : 0.12,0.57,0.83
 Radius used      : 1.300000
 Radius, covalent : 1.300000
 Radius, atomic   : 2.020000
@@ -1113,7 +1113,7 @@ Atom
 Number           : 75
 Name             : Rhenium
 Short name       : Re
-Color            : 1.0,1.0,1.0
+Color            : 0.14,0.48,0.66
 Radius used      : 1.280000
 Radius, covalent : 1.280000
 Radius, atomic   : 1.970000
@@ -1128,7 +1128,7 @@ Atom
 Number           : 76
 Name             : Osmium
 Short name       : Os
-Color            : 1.0,1.0,1.0
+Color            : 0.14,0.39,0.58
 Radius used      : 1.260000
 Radius, covalent : 1.260000
 Radius, atomic   : 1.920000
@@ -1143,7 +1143,7 @@ Atom
 Number           : 77
 Name             : Iridium
 Short name       : Ir
-Color            : 1.0,1.0,1.0
+Color            : 0.08,0.32,0.52
 Radius used      : 1.270000
 Radius, covalent : 1.270000
 Radius, atomic   : 1.870000
@@ -1156,7 +1156,7 @@ Atom
 Number           : 78
 Name             : Platinium
 Short name       : Pt
-Color            : 1.0,1.0,1.0
+Color            : 0.81,0.81,0.87
 Radius used      : 1.300000
 Radius, covalent : 1.300000
 Radius, atomic   : 1.830000
@@ -1171,7 +1171,7 @@ Atom
 Number           : 79
 Name             : Gold
 Short name       : Au
-Color            : 1.0,1.0,1.0
+Color            : 0.99,0.81,0.13
 Radius used      : 1.340000
 Radius, covalent : 1.340000
 Radius, atomic   : 1.790000
@@ -1186,7 +1186,7 @@ Atom
 Number           : 80
 Name             : Mercury
 Short name       : Hg
-Color            : 1.0,1.0,1.0
+Color            : 0.71,0.71,0.81
 Radius used      : 1.490000
 Radius, covalent : 1.490000
 Radius, atomic   : 1.760000
@@ -1201,7 +1201,7 @@ Atom
 Number           : 81
 Name             : Thallium
 Short name       : Tl
-Color            : 1.0,1.0,1.0
+Color            : 0.64,0.32,0.30
 Radius used      : 1.480000
 Radius, covalent : 1.480000
 Radius, atomic   : 2.080000
@@ -1216,7 +1216,7 @@ Atom
 Number           : 82
 Name             : Lead
 Short name       : Pb
-Color            : 0.498039215686,0.498039215686,0.498039215686
+Color            : 0.33,0.34,0.37
 Radius used      : 1.470000
 Radius, covalent : 1.470000
 Radius, atomic   : 1.810000
@@ -1231,7 +1231,7 @@ Atom
 Number           : 83
 Name             : Bismuth
 Short name       : Bi
-Color            : 1.0,1.0,1.0
+Color            : 0.61,0.30,0.70
 Radius used      : 1.460000
 Radius, covalent : 1.460000
 Radius, atomic   : 1.630000
@@ -1248,7 +1248,7 @@ Atom
 Number           : 84
 Name             : Polonium
 Short name       : Po
-Color            : 1.0,1.0,1.0
+Color            : 0.66,0.35,0.0
 Radius used      : 1.460000
 Radius, covalent : 1.460000
 Radius, atomic   : 1.530000
@@ -1261,7 +1261,7 @@ Atom
 Number           : 85
 Name             : Astatine
 Short name       : At
-Color            : 1.0,1.0,1.0
+Color            : 0.45,0.30,0.26
 Radius used      : 1.450000
 Radius, covalent : 1.450000
 Radius, atomic   : 1.430000
@@ -1278,7 +1278,7 @@ Atom
 Number           : 86
 Name             : Radon
 Short name       : Rn
-Color            : 1.0,1.0,1.0
+Color            : 0.25,0.50,0.58
 Radius used      : 1.000000
 Radius, covalent : 1.000000
 Radius, atomic   : 1.340000
@@ -1289,7 +1289,7 @@ Atom
 Number           : 87
 Name             : Francium
 Short name       : Fr
-Color            : 1.0,1.0,1.0
+Color            : 0.25,0.0,0.39
 Radius used      : 1.000000
 Radius, covalent : 1.000000
 Radius, atomic   : 1.000000
@@ -1302,7 +1302,7 @@ Atom
 Number           : 88
 Name             : Radium
 Short name       : Ra
-Color            : 1.0,1.0,1.0
+Color            : 0.0,0.48,0.0
 Radius used      : 1.000000
 Radius, covalent : 1.000000
 Radius, atomic   : 1.000000
@@ -1315,7 +1315,7 @@ Atom
 Number           : 89
 Name             : Actinium
 Short name       : Ac
-Color            : 1.0,1.0,1.0
+Color            : 0.43,0.66,0.97
 Radius used      : 1.000000
 Radius, covalent : 1.000000
 Radius, atomic   : 1.000000
@@ -1328,7 +1328,7 @@ Atom
 Number           : 90
 Name             : Thorium
 Short name       : Th
-Color            : 1.0,1.0,1.0
+Color            : 0.0,0.72,0.99
 Radius used      : 1.650000
 Radius, covalent : 1.650000
 Radius, atomic   : 1.000000
@@ -1341,7 +1341,7 @@ Atom
 Number           : 91
 Name             : Protactinium
 Short name       : Pa
-Color            : 1.0,1.0,1.0
+Color            : 0.0,0.62,0.99
 Radius used      : 1.000000
 Radius, covalent : 1.000000
 Radius, atomic   : 1.000000
@@ -1358,7 +1358,7 @@ Atom
 Number           : 92
 Name             : Uranium
 Short name       : U
-Color            : 1.0,1.0,1.0
+Color            : 0.0,0.55,0.99
 Radius used      : 1.420000
 Radius, covalent : 1.420000
 Radius, atomic   : 1.000000
@@ -1373,7 +1373,7 @@ Atom
 Number           : 93
 Name             : Neptunium
 Short name       : Np
-Color            : 1.0,1.0,1.0
+Color            : 0.0,0.5,0.99
 Radius used      : 1.000000
 Radius, covalent : 1.000000
 Radius, atomic   : 1.000000
@@ -1390,7 +1390,7 @@ Atom
 Number           : 94
 Name             : Plutonium
 Short name       : Pu
-Color            : 1.0,1.0,1.0
+Color            : 0.0,0.41,0.99
 Radius used      : 1.000000
 Radius, covalent : 1.000000
 Radius, atomic   : 1.000000
@@ -1405,7 +1405,7 @@ Atom
 Number           : 95
 Name             : Americium
 Short name       : Am
-Color            : 1.0,1.0,1.0
+Color            : 0.32,0.35,0.94
 Radius used      : 1.000000
 Radius, covalent : 1.000000
 Radius, atomic   : 1.000000
@@ -1420,7 +1420,7 @@ Atom
 Number           : 96
 Name             : Curium
 Short name       : Cm
-Color            : 1.0,1.0,1.0
+Color            : 0.46,0.35,0.88
 Radius used      : 1.000000
 Radius, covalent : 1.000000
 Radius, atomic   : 1.000000
@@ -1431,7 +1431,7 @@ Atom
 Number           : 97
 Name             : Berkelium
 Short name       : Bk
-Color            : 1.0,1.0,1.0
+Color            : 0.53,0.30,0.88
 Radius used      : 1.000000
 Radius, covalent : 1.000000
 Radius, atomic   : 1.000000
@@ -1442,7 +1442,7 @@ Atom
 Number           : 98
 Name             : Californium
 Short name       : Cf
-Color            : 1.0,1.0,1.0
+Color            : 0.62,0.21,0.82
 Radius used      : 1.000000
 Radius, covalent : 1.000000
 Radius, atomic   : 1.000000
@@ -1453,7 +1453,7 @@ Atom
 Number           : 99
 Name             : Einsteinium
 Short name       : Es
-Color            : 1.0,1.0,1.0
+Color            : 0.69,0.12,0.82
 Radius used      : 1.000000
 Radius, covalent : 1.000000
 Radius, atomic   : 1.000000
@@ -1464,7 +1464,7 @@ Atom
 Number           : 100
 Name             : Fermium
 Short name       : Fm
-Color            : 1.0,1.0,1.0
+Color            : 0.69,0.12,0.72
 Radius used      : 1.000000
 Radius, covalent : 1.000000
 Radius, atomic   : 1.000000
@@ -1475,7 +1475,7 @@ Atom
 Number           : 101
 Name             : Mendelevium
 Short name       : Md
-Color            : 1.0,1.0,1.0
+Color            : 0.69,0.05,0.64
 Radius used      : 1.000000
 Radius, covalent : 1.000000
 Radius, atomic   : 1.000000
@@ -1486,7 +1486,7 @@ Atom
 Number           : 102
 Name             : Nobelium
 Short name       : No
-Color            : 1.0,1.0,1.0
+Color            : 0.73,0.05,0.52
 Radius used      : 1.000000
 Radius, covalent : 1.000000
 Radius, atomic   : 1.000000
@@ -1497,7 +1497,7 @@ Atom
 Number           : 103
 Name             : Lawrencium
 Short name       : Lr
-Color            : 1.0,1.0,1.0
+Color            : 0.77,0.0,0.39
 Radius used      : 1.000000
 Radius, covalent : 1.000000
 Radius, atomic   : 1.000000
@@ -1509,7 +1509,7 @@ Number           : 104
 Name             : Vacancy
 Short name       : Vac
 Color            : 0.5,0.5,0.5
-Radius used      : 1.0
+Radius used      : 1.2
 Radius, covalent : 1.0
 Radius, atomic   : 1.0
 
@@ -1519,7 +1519,7 @@ Atom
 Number           : 105
 Name             : Default
 Short name       : Default
-Color            : 1.0,1.0,1.0
+Color            : 0.5,0.5,0.5
 Radius used      : 1.0
 Radius, covalent : 1.0
 Radius, atomic   : 1.0
diff --git a/release/scripts/addons/io_mesh_pdb/export_pdb.py b/release/scripts/addons/io_mesh_pdb/export_pdb.py
new file mode 100644
index 0000000..ea4a761
--- /dev/null
+++ b/release/scripts/addons/io_mesh_pdb/export_pdb.py
@@ -0,0 +1,116 @@
+# ##### 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
+#  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-04-18
+#
+#  Acknowledgements: Thanks to ideasman, meta_androcto, truman, kilon,
+#  dairin0d, PKHG, Valter, etc
+#
+
+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):  
+    __slots__ = ('element', 'location')
+    def __init__(self, element, location):
+        self.element  = element
+        self.location = location
+
+
+def DEF_atom_pdb_export(obj_type):
+
+    list_atoms = []
+    for obj in bpy.context.selected_objects:
+    
+        if "Stick" in obj.name:
+            continue
+            
+        if obj.type != "SURFACE" and obj.type != "MESH":
+            continue 
+       
+        name = ""
+        for element in import_pdb.ATOM_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":
+                name = "?"
+            else:
+                continue
+
+        if len(obj.children) != 0:
+            for vertex in obj.data.vertices:
+                list_atoms.append(CLASS_atom_pdb_atoms_export(
+                                                       name,
+                                                       obj.location+vertex.co))
+        else:
+            if not obj.parent:
+                list_atoms.append(CLASS_atom_pdb_atoms_export(
+                                                       name,
+                                                       obj.location))
+
+    pdb_file_p = open(ATOM_PDB_FILEPATH, "w")
+    pdb_file_p.write(ATOM_PDB_PDBTEXT)
+
+    for i, atom in enumerate(list_atoms):
+        string = "ATOM %6d%3s%24.3f%8.3f%8.3f%6.2f%6.2f%12s\n" % (
+                                      i, atom.element,
+                                      atom.location[0],
+                                      atom.location[1],
+                                      atom.location[2],
+                                      1.00, 1.00, atom.element)
+        pdb_file_p.write(string)
+
+    pdb_file_p.close()
+
+    return True
+
diff --git a/release/scripts/addons/io_mesh_pdb/import_pdb.py b/release/scripts/addons/io_mesh_pdb/import_pdb.py
index bc9c060..e9decb0 100644
--- a/release/scripts/addons/io_mesh_pdb/import_pdb.py
+++ b/release/scripts/addons/io_mesh_pdb/import_pdb.py
@@ -25,7 +25,7 @@
 #
 #  Start of project              : 2011-08-31 by Clemens Barth
 #  First publication in Blender  : 2011-11-11
-#  Last modified                 : 2012-02-07
+#  Last modified                 : 2012-04-18
 #
 #  Acknowledgements: Thanks to ideasman, meta_androcto, truman, kilon,
 #  dairin0d, PKHG, Valter, etc
@@ -216,22 +216,18 @@ class CLASS_atom_pdb_stick(object):
         self.number = number
         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):
 
-    vertices = []
-    faces    = []
-
     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 )
@@ -243,7 +239,16 @@ def DEF_atom_pdb_build_stick(radius, length, sectors):
         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]
@@ -254,28 +259,27 @@ def DEF_atom_pdb_build_stick(radius, length, sectors):
             for j in range(2):
                 face_top.append(i+j+1)
                 face_bottom.append(i+j+1+sectors)
-        faces.append(face_top)
-        faces.append(face_bottom)
-
-    # Side facets
-    for i in range(sectors-1):
-        if i == sectors-2:
-            faces.append(  [i+1, 1, 1+sectors, i+1+sectors] )
-        else:
-            faces.append(  [i+1, i+2, i+2+sectors, i+1+sectors] )
+        faces2.append(face_top)
+        faces2.append(face_bottom)
 
-    # Build the mesh
+    # Build the mesh, Cylinder
     cylinder = bpy.data.meshes.new("Sticks_Cylinder")
-    cylinder.from_pydata(vertices, [], faces)
+    cylinder.from_pydata(vertices, [], faces1)
     cylinder.update()
     new_cylinder = bpy.data.objects.new("Sticks_Cylinder", cylinder)
     bpy.context.scene.objects.link(new_cylinder)
 
-    return 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 objects (atoms),
-# which are active.
+
+# This function measures the distance between two active objects (atoms).
 def DEF_atom_pdb_distance():
 
     if len(bpy.context.selected_bases) > 1:
@@ -495,7 +499,6 @@ def DEF_atom_pdb_radius_sticks(radius, how):
 
     return True
 
-
 # -----------------------------------------------------------------------------
 #                                                         The custom data file
 
@@ -556,18 +559,31 @@ def DEF_atom_pdb_custom_datafile(path_datafile):
             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_dist,
+               use_sticks_bonds, Stick_unit, Stick_dist,
                Stick_sectors,Stick_diameter,put_to_center,
                use_camera,use_lamp,path_datafile):
 
@@ -602,11 +618,9 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
                                      radii,radii_ionic)
         ATOM_PDB_ELEMENTS.append(li)
 
-
     # ------------------------------------------------------------------------
     # READING DATA OF ATOMS
 
-
     if DEF_atom_pdb_custom_datafile(path_datafile):
         print("Custom data file is loaded.")
 
@@ -738,11 +752,9 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
     # 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).
@@ -795,11 +807,9 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
                 # The atom gets its properties.
                 atom.material = material
 
-
     # ------------------------------------------------------------------------
     # READING DATA OF 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")
@@ -829,8 +839,8 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
         # The strings of the atom numbers do have a clear position in the file
         # (From 7 to 12, from 13 to 18 and so on.) and one needs to consider
         # this. One could also use the split function but then one gets into
-        # trouble if there are many atoms: For instance, it may happen that one
-        # has
+        # trouble if there are lots of atoms: For instance, it may happen that
+        # one has
         #                   CONECT 11111  22244444
         #
         # In Fact it means that atom No. 11111 has a connection with atom
@@ -876,7 +886,10 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
                         dist_n = dist_n.cross(plane_n)
                         dist_n = dist_n / dist_n.length  
                     else:
-                        dist_n = Vector((0,0,0))                               
+                        dist_n = (all_atoms[atom1-1].location 
+                                - all_atoms[atom2-1].location)
+                        dist_n = Vector((dist_n[1],-dist_n[0],0))    
+                        dist_n = dist_n / dist_n.length                             
                 elif number > 3:
                     number = 1
                     dist_n = None
@@ -911,11 +924,9 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
     ATOM_PDB_FILEPATH_p.close()
     # So far, all atoms and sticks have been registered.
 
-
     # ------------------------------------------------------------------------
     # TRANSLATION OF THE STRUCTURE TO THE ORIGIN
 
-
     # It may happen that the structure in a PDB file already has an offset
     # If chosen, the structure is first put into the center of the scene
     # (the offset is substracted).
@@ -934,20 +945,16 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
         for atom in all_atoms:
             atom.location -= sum_vec
 
-
     # ------------------------------------------------------------------------
     # SCALING
 
-
     # Take all atoms and adjust their radii and scale the distances.
     for atom in all_atoms:
         atom.location *= Ball_distance_factor
 
-
     # ------------------------------------------------------------------------
     # DETERMINATION OF SOME GEOMETRIC PROPERTIES
 
-
     # In the following, some geometric properties of the whole object are
     # determined: center, size, etc.
     sum_vec = Vector((0.0,0.0,0.0))
@@ -965,7 +972,6 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
     object_size = 0.0
     object_size = max(object_size_vec).length
 
-
     # ------------------------------------------------------------------------
     # CAMERA AND LAMP
 
@@ -1021,14 +1027,6 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
                                  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:
 
@@ -1060,27 +1058,23 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
         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        : ", object_center_vec)
-    print("Size of object          : ", object_size)
+    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:
     # draw_all_atoms = [ data_hydrogen,data_carbon,data_nitrogen ]
     # data_hydrogen = [["Hydrogen", Material_Hydrogen, Vector((x,y,z)), 109], ...]
@@ -1113,11 +1107,9 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
         # Now append the atom list to the list of all types of atoms
         draw_all_atoms.append(draw_all_atoms_type)
 
-
     # ------------------------------------------------------------------------
     # DRAWING THE ATOMS
 
-
     # This is the number of all atoms which are put into the scene.
     bpy.ops.object.select_all(action='DESELECT')
 
@@ -1170,7 +1162,7 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
         if atom[0] == "Vacancy":
             ball.name = "Cube_"+atom[0]
         else:
-            ball.name = "Ball (NURBS)_"+atom[0]
+            ball.name = "Ball_"+atom[0]
         ball.active_material = atom[1]
         ball.parent = new_atom_mesh
         new_atom_mesh.dupli_type = 'VERTS'
@@ -1180,13 +1172,12 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
 
     print()
 
-
     # ------------------------------------------------------------------------
     # DRAWING THE STICKS
 
     if use_sticks == True and all_sticks != []:
             
-        dl = 0.05
+        dl = Stick_unit
          
         if use_sticks_color == False:   
             bpy.ops.object.material_slot_add()
@@ -1277,7 +1268,6 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
 
             sticks_all_lists.append(sticks_list)
 
-
         # ... the sticks in the list can be drawn:
         for stick_list in sticks_all_lists:
             vertices = []
@@ -1321,19 +1311,23 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
             bpy.context.scene.objects.link(new_mesh)
 
             current_layers = bpy.context.scene.layers
-            stick_cylinder = DEF_atom_pdb_build_stick(Stick_diameter, dl, Stick_sectors)
+            object_stick = DEF_atom_pdb_build_stick(Stick_diameter, dl, Stick_sectors)
+            stick_cylinder = object_stick[0]
             stick_cylinder.active_material = stick[3]
-            
+            stick_cups = object_stick[1]
+            stick_cups.active_material = stick[3]            
+                   
             if use_sticks_smooth == True: 
-                for face in stick_cylinder.data.faces:
-                    face.use_smooth = True
+                bpy.ops.object.select_all(action='DESELECT')
+                stick_cylinder.select = True
+                stick_cups.select = True
+                bpy.ops.object.shade_smooth()
 
             stick_cylinder.parent = new_mesh
+            stick_cups.parent = new_mesh
             new_mesh.dupli_type = 'FACES'
             atom_object_list.append(new_mesh)
 
-
-
     # ------------------------------------------------------------------------
     # SELECT ALL LOADED OBJECTS
     bpy.ops.object.select_all(action='DESELECT')
@@ -1348,5 +1342,4 @@ def DEF_atom_pdb_main(use_mesh,Ball_azimuth,Ball_zenith,
     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_ply/__init__.py b/release/scripts/addons/io_mesh_ply/__init__.py
index 851a6b7..2e97dcf 100644
--- a/release/scripts/addons/io_mesh_ply/__init__.py
+++ b/release/scripts/addons/io_mesh_ply/__init__.py
@@ -96,7 +96,10 @@ class ExportPLY(bpy.types.Operator, ExportHelper):
             )
     use_normals = BoolProperty(
             name="Normals",
-            description="Export Normals for smooth and hard shaded faces",
+            description="Export Normals for smooth and "
+                        "hard shaded faces "
+                        "(hard shaded faces will be exported "
+                        "as individual faces)",
             default=True,
             )
     use_uv_coords = BoolProperty(
@@ -106,7 +109,7 @@ class ExportPLY(bpy.types.Operator, ExportHelper):
             )
     use_colors = BoolProperty(
             name="Vertex Colors",
-            description="Exort the active vertex color layer",
+            description="Export the active vertex color layer",
             default=True)
 
     @classmethod
diff --git a/release/scripts/addons/io_mesh_ply/export_ply.py b/release/scripts/addons/io_mesh_ply/export_ply.py
index 89eade7..cb981a1 100644
--- a/release/scripts/addons/io_mesh_ply/export_ply.py
+++ b/release/scripts/addons/io_mesh_ply/export_ply.py
@@ -65,9 +65,9 @@ def save(operator,
 
     # mesh.transform(obj.matrix_world) # XXX
 
-    has_uv = (len(mesh.uv_textures) > 0)
+    has_uv = (len(mesh.tessface_uv_textures) > 0)
     has_uv_vertex = (len(mesh.sticky) > 0)
-    has_vcol = len(mesh.vertex_colors) > 0
+    has_vcol = len(mesh.tessface_vertex_colors) > 0
 
     if (not has_uv) and (not has_uv_vertex):
         use_uv_coords = False
@@ -80,7 +80,7 @@ def save(operator,
         has_vcol = False
 
     if has_uv:
-        active_uv_layer = mesh.uv_textures.active
+        active_uv_layer = mesh.tessface_uv_textures.active
         if not active_uv_layer:
             use_uv_coords = False
             has_uv = False
@@ -88,7 +88,7 @@ def save(operator,
             active_uv_layer = active_uv_layer.data
 
     if has_vcol:
-        active_col_layer = mesh.vertex_colors.active
+        active_col_layer = mesh.tessface_vertex_colors.active
         if not active_col_layer:
             use_colors = False
             has_vcol = False
@@ -102,18 +102,18 @@ def save(operator,
     ply_verts = []  # list of dictionaries
     # vdict = {} # (index, normal, uv) -> new index
     vdict = [{} for i in range(len(mesh_verts))]
-    ply_faces = [[] for f in range(len(mesh.faces))]
+    ply_faces = [[] for f in range(len(mesh.tessfaces))]
     vert_count = 0
-    for i, f in enumerate(mesh.faces):
+    for i, f in enumerate(mesh.tessfaces):
 
-        smooth = f.use_smooth
+        smooth = not use_normals or f.use_smooth
         if not smooth:
             normal = tuple(f.normal)
             normal_key = rvec3d(normal)
 
         if has_uv:
             uv = active_uv_layer[i]
-            uv = uv.uv1, uv.uv2, uv.uv3, uv.uv4  # XXX - crufty :/
+            uv = uv.uv1, uv.uv2, uv.uv3, uv.uv4
         if has_vcol:
             col = active_col_layer[i]
             col = col.color1[:], col.color2[:], col.color3[:], col.color4[:]
@@ -129,10 +129,10 @@ def save(operator,
                 normal_key = rvec3d(normal)
 
             if has_uv:
-                uvcoord = uv[j][0], 1.0 - uv[j][1]
+                uvcoord = uv[j][0], uv[j][1]
                 uvcoord_key = rvec2d(uvcoord)
             elif has_uv_vertex:
-                uvcoord = v.uvco[0], 1.0 - v.uvco[1]
+                uvcoord = v.uvco[0], v.uvco[1]
                 uvcoord_key = rvec2d(uvcoord)
 
             if has_vcol:
@@ -177,7 +177,7 @@ def save(operator,
            "property uchar green\n"
            "property uchar blue\n")
 
-    fw("element face %d\n" % len(mesh.faces))
+    fw("element face %d\n" % len(mesh.tessfaces))
     fw("property list uchar uint vertex_indices\n")
     fw("end_header\n")
 
diff --git a/release/scripts/addons/io_mesh_ply/import_ply.py b/release/scripts/addons/io_mesh_ply/import_ply.py
index e2e730b..ee64552 100644
--- a/release/scripts/addons/io_mesh_ply/import_ply.py
+++ b/release/scripts/addons/io_mesh_ply/import_ply.py
@@ -126,6 +126,7 @@ class object_spec(object):
 
 def read(filepath):
     format = b''
+    texture = b''
     version = b'1.0'
     format_specs = {b'binary_little_endian': '<',
                     b'binary_big_endian': '>',
@@ -162,13 +163,22 @@ def read(filepath):
             continue
         if tokens[0] == b'end_header':
             break
-        elif tokens[0] == b'comment' or tokens[0] == b'obj_info':
+        elif tokens[0] == b'comment':
+            if len(tokens) < 2:
+                continue
+            elif tokens[1] == b'TextureFile':
+                if len(tokens) < 4:
+                    print('Invalid texture line')
+                else:
+                    texture = tokens[2]
+            continue
+        elif tokens[0] == b'obj_info':
             continue
         elif tokens[0] == b'format':
             if len(tokens) < 3:
                 print('Invalid format line')
                 return None
-            if tokens[1] not in format_specs:  # .keys(): # keys is implicit
+            if tokens[1] not in format_specs:
                 print('Unknown format', tokens[1])
                 return None
             if tokens[2] != version:
@@ -201,7 +211,7 @@ def read(filepath):
 
     file.close()
 
-    return obj_spec, obj
+    return obj_spec, obj, texture
 
 
 import bpy
@@ -213,7 +223,7 @@ def load_ply(filepath):
     # from bpy_extras.image_utils import load_image  # UNUSED
 
     t = time.time()
-    obj_spec, obj = read(filepath)
+    obj_spec, obj, texture = read(filepath)
     if obj is None:
         print('Invalid file')
         return
@@ -247,7 +257,7 @@ def load_ply(filepath):
     def add_face(vertices, indices, uvindices, colindices):
         mesh_faces.append(indices)
         if uvindices:
-            mesh_uvs.append([(vertices[index][uvindices[0]], 1.0 - vertices[index][uvindices[1]]) for index in indices])
+            mesh_uvs.append([(vertices[index][uvindices[0]], vertices[index][uvindices[1]]) for index in indices])
         if colindices:
             mesh_colors.append([(vertices[index][colindices[0]] * colmultiply[0],
                                  vertices[index][colindices[1]] * colmultiply[1],
@@ -291,14 +301,14 @@ def load_ply(filepath):
     mesh.vertices.foreach_set("co", [a for v in obj[b'vertex'] for a in (v[vindices_x], v[vindices_y], v[vindices_z])])
 
     if mesh_faces:
-        mesh.faces.add(len(mesh_faces))
-        mesh.faces.foreach_set("vertices_raw", unpack_face_list(mesh_faces))
+        mesh.tessfaces.add(len(mesh_faces))
+        mesh.tessfaces.foreach_set("vertices_raw", unpack_face_list(mesh_faces))
 
         if uvindices or colindices:
             if uvindices:
-                uvlay = mesh.uv_textures.new()
+                uvlay = mesh.tessface_uv_textures.new()
             if colindices:
-                vcol_lay = mesh.vertex_colors.new()
+                vcol_lay = mesh.tessface_vertex_colors.new()
 
             if uvindices:
                 for i, f in enumerate(uvlay.data):
@@ -321,8 +331,34 @@ def load_ply(filepath):
     mesh.validate()
     mesh.update()
 
+    if texture and uvindices:
+
+        import os
+        import sys
+        from bpy_extras.image_utils import load_image
+
+        encoding = sys.getfilesystemencoding()
+        encoded_texture = texture.decode(encoding=encoding)
+        name = bpy.path.display_name_from_filepath(texture)
+        image = load_image(encoded_texture, os.path.dirname(filepath), recursive=True, place_holder=True)
+
+        if image:
+            texture = bpy.data.textures.new(name=name, type='IMAGE')
+            texture.image = image
+
+            material = bpy.data.materials.new(name=name)
+            material.use_shadeless = True
+
+            mtex = material.texture_slots.add()
+            mtex.texture = texture
+            mtex.texture_coords = 'UV'
+            mtex.use_map_color_diffuse = True
+
+            mesh.materials.append(material)
+            for face in mesh.uv_textures[0].data:
+                face.image = image
+
     scn = bpy.context.scene
-    #scn.objects.selected = [] # XXX25
 
     obj = bpy.data.objects.new(ply_name, mesh)
     scn.objects.link(obj)
diff --git a/release/scripts/addons/io_mesh_raw/export_raw.py b/release/scripts/addons/io_mesh_raw/export_raw.py
index d33cfba..a180151 100644
--- a/release/scripts/addons/io_mesh_raw/export_raw.py
+++ b/release/scripts/addons/io_mesh_raw/export_raw.py
@@ -79,7 +79,7 @@ def write(filepath,
 
         if me is not None:
             matrix = obj.matrix_world.copy()
-            for face in me.faces:
+            for face in me.tessfaces:
                 fv = faceValues(face, me, matrix)
                 if triangulate:
                     faces.extend(faceToTriangles(fv))
diff --git a/release/scripts/addons/io_mesh_stl/__init__.py b/release/scripts/addons/io_mesh_stl/__init__.py
index 7005e50..f2fe7c1 100644
--- a/release/scripts/addons/io_mesh_stl/__init__.py
+++ b/release/scripts/addons/io_mesh_stl/__init__.py
@@ -60,9 +60,10 @@ import os
 import bpy
 from bpy.props import StringProperty, BoolProperty, CollectionProperty
 from bpy_extras.io_utils import ExportHelper, ImportHelper
+from bpy.types import Operator, OperatorFileListElement
 
 
-class ImportSTL(bpy.types.Operator, ImportHelper):
+class ImportSTL(Operator, ImportHelper):
     '''Load STL triangle mesh data'''
     bl_idname = "import_mesh.stl"
     bl_label = "Import STL"
@@ -76,7 +77,7 @@ class ImportSTL(bpy.types.Operator, ImportHelper):
             )
     files = CollectionProperty(
             name="File Path",
-            type=bpy.types.OperatorFileListElement,
+            type=OperatorFileListElement,
             )
     directory = StringProperty(
             subtype='DIR_PATH',
@@ -106,12 +107,13 @@ class ImportSTL(bpy.types.Operator, ImportHelper):
         return {'FINISHED'}
 
 
-class ExportSTL(bpy.types.Operator, ExportHelper):
+class ExportSTL(Operator, ExportHelper):
     '''Save STL triangle mesh data from the active object'''
     bl_idname = "export_mesh.stl"
     bl_label = "Export STL"
 
     filename_ext = ".stl"
+    filter_glob = StringProperty(default="*.stl", options={'HIDDEN'})
 
     ascii = BoolProperty(name="Ascii",
                          description="Save the file in ASCII file format",
@@ -136,14 +138,12 @@ class ExportSTL(bpy.types.Operator, ExportHelper):
 
 
 def menu_import(self, context):
-    self.layout.operator(ImportSTL.bl_idname,
-                         text="Stl (.stl)").filepath = "*.stl"
+    self.layout.operator(ImportSTL.bl_idname, text="Stl (.stl)")
 
 
 def menu_export(self, context):
     default_path = os.path.splitext(bpy.data.filepath)[0] + ".stl"
-    self.layout.operator(ExportSTL.bl_idname,
-                         text="Stl (.stl)").filepath = default_path
+    self.layout.operator(ExportSTL.bl_idname, text="Stl (.stl)")
 
 
 def register():
diff --git a/release/scripts/addons/io_mesh_stl/blender_utils.py b/release/scripts/addons/io_mesh_stl/blender_utils.py
index 2e8c8d6..76c864c 100644
--- a/release/scripts/addons/io_mesh_stl/blender_utils.py
+++ b/release/scripts/addons/io_mesh_stl/blender_utils.py
@@ -66,7 +66,7 @@ def faces_from_mesh(ob, apply_modifier=False, triangulate=True):
     if triangulate:
         # From a list of faces, return the face triangulated if needed.
         def iter_face_index():
-            for face in mesh.faces:
+            for face in mesh.tessfaces:
                 vertices = face.vertices[:]
                 if len(vertices) == 4:
                     yield vertices[0], vertices[1], vertices[2]
@@ -75,7 +75,7 @@ def faces_from_mesh(ob, apply_modifier=False, triangulate=True):
                     yield vertices
     else:
         def iter_face_index():
-            for face in mesh.faces:
+            for face in mesh.tessfaces:
                 yield face.vertices[:]
 
     vertices = mesh.vertices
diff --git a/release/scripts/addons/io_mesh_stl/stl_utils.py b/release/scripts/addons/io_mesh_stl/stl_utils.py
index 7aae064..be4dc0a 100644
--- a/release/scripts/addons/io_mesh_stl/stl_utils.py
+++ b/release/scripts/addons/io_mesh_stl/stl_utils.py
@@ -23,7 +23,7 @@ Import and export STL files
 
 Used as a blender script, it load all the stl files in the scene:
 
-blender -P stl_utils.py -- file1.stl file2.stl file3.stl ...
+blender --python stl_utils.py -- file1.stl file2.stl file3.stl ...
 '''
 
 import struct
@@ -86,6 +86,11 @@ BINARY_HEADER = 80
 BINARY_STRIDE = 12 * 4 + 2
 
 
+def _header_version():
+    import bpy
+    return "Exported from Blender-" + bpy.app.version_string
+
+
 def _is_ascii_file(data):
     '''
     This function returns True if the data represents an ASCII file.
@@ -176,12 +181,13 @@ def _binary_write(filename, faces):
 
         # header, with correct value now
         data.seek(0)
-        data.write(struct.pack('<80sI', b"Exported from blender", nb))
+        data.write(struct.pack('<80sI', _header_version().encode('ascii'), nb))
 
 
 def _ascii_write(filename, faces):
     with open(filename, 'w') as data:
-        data.write('solid Exported from blender\n')
+        header = _header_version()
+        data.write('solid %s\n' % header)
 
         for face in faces:
             data.write('''facet normal 0 0 0\nouter loop\n''')
@@ -189,7 +195,7 @@ def _ascii_write(filename, faces):
                 data.write('vertex %f %f %f\n' % vert[:])
             data.write('endloop\nendfacet\n')
 
-        data.write('endsolid Exported from blender\n')
+        data.write('endsolid %s\n' % header)
 
 
 def write_stl(filename, faces, ascii=False):
diff --git a/release/scripts/addons/io_mesh_uv_layout/__init__.py b/release/scripts/addons/io_mesh_uv_layout/__init__.py
index 3682e56..0113aff 100644
--- a/release/scripts/addons/io_mesh_uv_layout/__init__.py
+++ b/release/scripts/addons/io_mesh_uv_layout/__init__.py
@@ -21,8 +21,8 @@
 bl_info = {
     "name": "UV Layout",
     "author": "Campbell Barton, Matt Ebb",
-    "version": (1, 0),
-    "blender": (2, 5, 8),
+    "version": (1, 1),
+    "blender": (2, 6, 2),
     "location": "Image-Window > UVs > Export UV Layout",
     "description": "Export the UV layout as a 2D graphic",
     "warning": "",
@@ -103,6 +103,12 @@ class ExportUVLayout(bpy.types.Operator):
             min=0.0, max=1.0,
             default=0.25,
             )
+    tessellated = BoolProperty(
+            name="Tessellated UVs",
+            description="Export tessellated UVs instead of polygons ones",
+            default=False,
+            options={'HIDDEN'},  # As not working currently :/
+            )
 
     @classmethod
     def poll(cls, context):
@@ -131,12 +137,12 @@ class ExportUVLayout(bpy.types.Operator):
 
         return image_width, image_height
 
-    def _face_uv_iter(self, context, mesh):
-        uv_layer = mesh.uv_textures.active.data
-        uv_layer_len = len(uv_layer)
+    def _face_uv_iter(self, context, mesh, tessellated):
+        uv_layer = mesh.uv_layers.active.data
+        polys = mesh.polygons
 
         if not self.export_all:
-
+            uv_tex = mesh.uv_textures.active.data
             local_image = Ellipsis
 
             if context.tool_settings.show_uv_local_view:
@@ -144,23 +150,24 @@ class ExportUVLayout(bpy.types.Operator):
                 if space_data:
                     local_image = space_data.image
 
-            faces = mesh.faces
-
-            for i in range(uv_layer_len):
-                uv_elem = uv_layer[i]
+            for i, p in enumerate(polys):
                 # context checks
-                if faces[i].select and (local_image is Ellipsis or
-                                        local_image == uv_elem.image):
-                    #~ uv = uv_elem.uv
-                    #~ if False not in uv_elem.select_uv[:len(uv)]:
-                    #~     yield (i, uv)
+                if polys[i].select and local_image in {Ellipsis,
+                                                       uv_tex[i].image}:
+                    start = p.loop_start
+                    end = start + p.loop_total
+                    uvs = tuple((uv.uv[0], uv.uv[1])
+                                for uv in uv_layer[start:end])
 
                     # just write what we see.
-                    yield (i, uv_layer[i].uv)
+                    yield (i, uvs)
         else:
             # all, simple
-            for i in range(uv_layer_len):
-                yield (i, uv_layer[i].uv)
+            for i, p in enumerate(polys):
+                start = p.loop_start
+                end = start + p.loop_total
+                uvs = tuple((uv.uv[0], uv.uv[1]) for uv in uv_layer[start:end])
+                yield (i, uvs)
 
     def execute(self, context):
 
@@ -182,7 +189,7 @@ class ExportUVLayout(bpy.types.Operator):
         elif mode == 'PNG':
             from . import export_uv_png
             func = export_uv_png.write
-        if mode == 'SVG':
+        elif mode == 'SVG':
             from . import export_uv_svg
             func = export_uv_svg.write
 
@@ -192,7 +199,7 @@ class ExportUVLayout(bpy.types.Operator):
             mesh = obj.data
 
         func(fw, mesh, self.size[0], self.size[1], self.opacity,
-             lambda: self._face_uv_iter(context, mesh))
+             lambda: self._face_uv_iter(context, mesh, self.tessellated))
 
         if self.modified:
             bpy.data.meshes.remove(mesh)
diff --git a/release/scripts/addons/io_mesh_uv_layout/export_uv_eps.py b/release/scripts/addons/io_mesh_uv_layout/export_uv_eps.py
index bf136c9..a15dc26 100644
--- a/release/scripts/addons/io_mesh_uv_layout/export_uv_eps.py
+++ b/release/scripts/addons/io_mesh_uv_layout/export_uv_eps.py
@@ -39,7 +39,7 @@ def write(fw, mesh, image_width, image_height, opacity, face_iter_func):
     fw("1 setlinejoin\n")
     fw("1 setlinecap\n")
 
-    faces = mesh.faces
+    polys = mesh.polygons
 
     if opacity > 0.0:
         for i, mat in enumerate(mesh.materials if mesh.materials else [None]):
@@ -67,7 +67,7 @@ def write(fw, mesh, image_width, image_height, opacity, face_iter_func):
                     fw("%.5f %.5f lineto\n" % uv_scale)
 
             fw("closepath\n")
-            fw("DRAW_%d\n" % faces[i].material_index)
+            fw("DRAW_%d\n" % polys[i].material_index)
 
     # stroke only
     for i, uvs in face_iter_func():
diff --git a/release/scripts/addons/io_mesh_uv_layout/export_uv_png.py b/release/scripts/addons/io_mesh_uv_layout/export_uv_png.py
index fa67042..423ad33 100644
--- a/release/scripts/addons/io_mesh_uv_layout/export_uv_png.py
+++ b/release/scripts/addons/io_mesh_uv_layout/export_uv_png.py
@@ -35,60 +35,44 @@ def write(fw, mesh_source, image_width, image_height, opacity, face_iter_func):
     for mat_solid in material_solids:
         mesh.materials.append(mat_solid)
 
-    tot_verts = 0
-    for f in mesh_source.faces:
-        tot_verts += len(f.vertices)
-
-    faces_source = mesh_source.faces
+    polys_source = mesh_source.polygons
 
     # get unique UV's in case there are many overlapping
     # which slow down filling.
-    face_hash_3 = set()
-    face_hash_4 = set()
-    for i, uv in face_iter_func():
-        material_index = faces_source[i].material_index
-        if len(uv) == 3:
-            face_hash_3.add((uv[0][0], uv[0][1],
-                             uv[1][0], uv[1][1],
-                             uv[2][0], uv[2][1], material_index))
-        else:
-            face_hash_4.add((uv[0][0], uv[0][1],
-                             uv[1][0], uv[1][1],
-                             uv[2][0], uv[2][1],
-                             uv[3][0], uv[3][1], material_index))
+    face_hash = {(uvs, polys_source[i].material_index)
+                 for i, uvs in face_iter_func()}
 
     # now set the faces coords and locations
     # build mesh data
     mesh_new_vertices = []
     mesh_new_materials = []
-    mesh_new_face_vertices = []
+    mesh_new_polys_startloop = []
+    mesh_new_polys_totloop = []
+    mesh_new_loops_vertices = []
 
     current_vert = 0
 
-    for face_data in face_hash_3:
-        mesh_new_vertices.extend([face_data[0], face_data[1], 0.0,
-                                  face_data[2], face_data[3], 0.0,
-                                  face_data[4], face_data[5], 0.0])
-        mesh_new_face_vertices.extend([current_vert, current_vert + 1,
-                                       current_vert + 2, 0])
-        mesh_new_materials.append(face_data[6])
-        current_vert += 3
-    for face_data in face_hash_4:
-        mesh_new_vertices.extend([face_data[0], face_data[1], 0.0,
-                                  face_data[2], face_data[3], 0.0,
-                                  face_data[4], face_data[5], 0.0,
-                                  face_data[6], face_data[7], 0.0])
-        mesh_new_face_vertices.extend([current_vert, current_vert + 1,
-                                       current_vert + 2, current_vert + 3])
-        mesh_new_materials.append(face_data[8])
-        current_vert += 4
-
-    mesh.vertices.add(len(mesh_new_vertices) // 3)
-    mesh.faces.add(len(mesh_new_face_vertices) // 4)
+    for uvs, mat_idx in face_hash:
+        num_verts = len(uvs)
+        dummy = (0.0,) * num_verts
+        for uv in uvs:
+            mesh_new_vertices += (uv[0], uv[1], 0.0)
+        mesh_new_polys_startloop.append(current_vert)
+        mesh_new_polys_totloop.append(num_verts)
+        mesh_new_loops_vertices += range(current_vert,
+                                         current_vert + num_verts)
+        mesh_new_materials.append(mat_idx)
+        current_vert += num_verts
+
+    mesh.vertices.add(current_vert)
+    mesh.loops.add(current_vert)
+    mesh.polygons.add(len(mesh_new_polys_startloop))
 
     mesh.vertices.foreach_set("co", mesh_new_vertices)
-    mesh.faces.foreach_set("vertices_raw", mesh_new_face_vertices)
-    mesh.faces.foreach_set("material_index", mesh_new_materials)
+    mesh.loops.foreach_set("vertex_index", mesh_new_loops_vertices)
+    mesh.polygons.foreach_set("loop_start", mesh_new_polys_startloop)
+    mesh.polygons.foreach_set("loop_total", mesh_new_polys_totloop)
+    mesh.polygons.foreach_set("material_index", mesh_new_materials)
 
     mesh.update(calc_edges=True)
 
diff --git a/release/scripts/addons/io_mesh_uv_layout/export_uv_svg.py b/release/scripts/addons/io_mesh_uv_layout/export_uv_svg.py
index 806ee60..764f0d3 100644
--- a/release/scripts/addons/io_mesh_uv_layout/export_uv_svg.py
+++ b/release/scripts/addons/io_mesh_uv_layout/export_uv_svg.py
@@ -29,7 +29,7 @@ def write(fw, mesh, image_width, image_height, opacity, face_iter_func):
     fw('<?xml version="1.0" standalone="no"?>\n')
     fw('<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" \n')
     fw('  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n')
-    fw('<svg width="%dpx" height="%dpx" viewBox="0px 0px %dpx %dpx"\n' %
+    fw('<svg width="%d" height="%d" viewBox="0 0 %d %d"\n' %
        (image_width, image_height, image_width, image_height))
     fw('     xmlns="http://www.w3.org/2000/svg" version="1.1">\n')
     desc = ("%r, %s, (Blender %s)" %
@@ -47,14 +47,14 @@ def write(fw, mesh, image_width, image_height, opacity, face_iter_func):
         else:
             fill_settings.append(fill_default)
 
-    faces = mesh.faces
+    polys = mesh.polygons
     for i, uvs in face_iter_func():
         try:  # rare cases material index is invalid.
-            fill = fill_settings[faces[i].material_index]
+            fill = fill_settings[polys[i].material_index]
         except IndexError:
             fill = fill_default
 
-        fw('<polygon stroke="black" stroke-width="1px"')
+        fw('<polygon stroke="black" stroke-width="1"')
         if opacity > 0.0:
             fw(' %s fill-opacity="%.2g"' % (fill, opacity))
 
diff --git a/release/scripts/addons/io_scene_3ds/__init__.py b/release/scripts/addons/io_scene_3ds/__init__.py
index 8c9ee3b..e0470d3 100644
--- a/release/scripts/addons/io_scene_3ds/__init__.py
+++ b/release/scripts/addons/io_scene_3ds/__init__.py
@@ -60,8 +60,8 @@ class Import3DS(bpy.types.Operator, ImportHelper):
 
     constrain_size = FloatProperty(
             name="Size Constraint",
-            description="Scale the model by 10 until it reacehs the " \
-                        "size constraint. Zero Disables",
+            description="Scale the model by 10 until it reaches the " \
+                        "size constraint (0 to disable)",
             min=0.0, max=1000.0,
             soft_min=0.0, soft_max=1000.0,
             default=10.0,
diff --git a/release/scripts/addons/io_scene_3ds/export_3ds.py b/release/scripts/addons/io_scene_3ds/export_3ds.py
index 385ffe4..40fdeda 100644
--- a/release/scripts/addons/io_scene_3ds/export_3ds.py
+++ b/release/scripts/addons/io_scene_3ds/export_3ds.py
@@ -49,8 +49,21 @@ MATAMBIENT = 0xA010  # Ambient color of the object/material
 MATDIFFUSE = 0xA020  # This holds the color of the object/material
 MATSPECULAR = 0xA030  # SPecular color of the object/material
 MATSHINESS = 0xA040  # ??
-MATMAP = 0xA200  # This is a header for a new material
-MATMAPFILE = 0xA300  # This holds the file name of the texture
+
+MAT_DIFFUSEMAP = 0xA200  # This is a header for a new diffuse texture
+MAT_OPACMAP = 0xA210  # head for opacity map
+MAT_BUMPMAP = 0xA230  # read for normal map
+MAT_SPECMAP = 0xA204  # read for specularity map
+
+#>------ sub defines of MAT_???MAP
+MATMAPFILE = 0xA300  # This holds the file name of a texture
+
+MAT_MAP_TILING = 0xa351   # 2nd bit (from LSB) is mirror UV flag
+MAT_MAP_USCALE = 0xA354   # U axis scaling
+MAT_MAP_VSCALE = 0xA356   # V axis scaling
+MAT_MAP_UOFFSET = 0xA358  # U axis offset
+MAT_MAP_VOFFSET = 0xA35A  # V axis offset
+MAT_MAP_ANG = 0xA35C      # UV rotation around the z-axis in rad
 
 RGB1 = 0x0011
 RGB2 = 0x0012
@@ -423,10 +436,10 @@ class _3ds_chunk(object):
 # EXPORT
 ######################################################
 
-def get_material_images(material):
+def get_material_image_texslots(material):
     # blender utility func.
     if material:
-        return [s.texture.image for s in material.texture_slots if s and s.texture.type == 'IMAGE' and s.texture.image]
+        return [s for s in material.texture_slots if s and s.texture.type == 'IMAGE' and s.texture.image]
 
     return []
 # 	images = []
@@ -454,22 +467,76 @@ def make_material_subchunk(chunk_id, color):
     return mat_sub
 
 
-def make_material_texture_chunk(chunk_id, images):
-    """Make Material Map texture chunk
+def make_material_texture_chunk(chunk_id, texslots, tess_uv_image=None):
+    """Make Material Map texture chunk given a seq. of `MaterialTextureSlot`'s
+
+        `tess_uv_image` is optionally used as image source if the slots are
+        empty. No additional filtering for mapping modes is done, all
+        slots are written "as is".
     """
+
     mat_sub = _3ds_chunk(chunk_id)
+    has_entry = False
+
+    import bpy
+
+    def add_texslot(texslot):
+        texture = texslot.texture
+        image = texture.image
 
-    def add_image(image):
-        import bpy
         filename = bpy.path.basename(image.filepath)
         mat_sub_file = _3ds_chunk(MATMAPFILE)
         mat_sub_file.add_variable("mapfile", _3ds_string(sane_name(filename)))
         mat_sub.add_subchunk(mat_sub_file)
 
-    for image in images:
-        add_image(image)
+        maptile = 0
+
+        # no perfect mapping for mirror modes - 3DS only has uniform mirror w. repeat=2
+        if texture.extension == 'REPEAT' and (texture.use_mirror_x and texture.repeat_x > 1) \
+           or (texture.use_mirror_y and texture.repeat_y > 1):
+            maptile |= 0x2
+        # CLIP maps to 3DS' decal flag
+        elif texture.extension == 'CLIP':
+            maptile |= 0x10
+
+        mat_sub_tile = _3ds_chunk(MAT_MAP_TILING)
+        mat_sub_tile.add_variable("maptiling", _3ds_ushort(maptile))
+        mat_sub.add_subchunk(mat_sub_tile)
+
+        mat_sub_uscale = _3ds_chunk(MAT_MAP_USCALE)
+        mat_sub_uscale.add_variable("mapuscale", _3ds_float(texslot.scale[0]))
+        mat_sub.add_subchunk(mat_sub_uscale)
+
+        mat_sub_vscale = _3ds_chunk(MAT_MAP_VSCALE)
+        mat_sub_vscale.add_variable("mapuscale", _3ds_float(texslot.scale[1]))
+        mat_sub.add_subchunk(mat_sub_vscale)
+
+        mat_sub_uoffset = _3ds_chunk(MAT_MAP_UOFFSET)
+        mat_sub_uoffset.add_variable("mapuoffset", _3ds_float(texslot.offset[0]))
+        mat_sub.add_subchunk(mat_sub_uoffset)
+
+        mat_sub_voffset = _3ds_chunk(MAT_MAP_VOFFSET)
+        mat_sub_voffset.add_variable("mapvoffset", _3ds_float(texslot.offset[1]))
+        mat_sub.add_subchunk(mat_sub_voffset)
+
+    # store all textures for this mapto in order. This at least is what
+    # the 3DS exporter did so far, afaik most readers will just skip
+    # over 2nd textures.
+    for slot in texslots:
+        add_texslot(slot)
+        has_entry = True
+
+    # image from tess. UV face - basically the code above should handle
+    # this already. No idea why its here so keep it :-)
+    if tess_uv_image and not has_entry:
+        has_entry = True
+
+        filename = bpy.path.basename(tess_uv_image.filepath)
+        mat_sub_file = _3ds_chunk(MATMAPFILE)
+        mat_sub_file.add_variable("mapfile", _3ds_string(sane_name(filename)))
+        mat_sub.add_subchunk(mat_sub_file)
 
-    return mat_sub
+    return mat_sub if has_entry else None
 
 
 def make_material_chunk(material, image):
@@ -495,12 +562,40 @@ def make_material_chunk(material, image):
         material_chunk.add_subchunk(make_material_subchunk(MATDIFFUSE, material.diffuse_color[:]))
         material_chunk.add_subchunk(make_material_subchunk(MATSPECULAR, material.specular_color[:]))
 
-        images = get_material_images(material)  # can be None
-        if image:
-            images.append(image)
-
-        if images:
-            material_chunk.add_subchunk(make_material_texture_chunk(MATMAP, images))
+        slots = get_material_image_texslots(material)  # can be None
+
+        if slots:
+
+            spec = [s for s in slots if s.use_map_specular or s.use_map_color_spec]
+            matmap = make_material_texture_chunk(MAT_SPECMAP, spec)
+            if matmap:
+                material_chunk.add_subchunk(matmap)
+
+            alpha = [s for s in slots if s.use_map_alpha]
+            matmap = make_material_texture_chunk(MAT_OPACMAP, alpha)
+            if matmap:
+                material_chunk.add_subchunk(matmap)
+
+            normal = [s for s in slots if s.use_map_normal]
+            matmap = make_material_texture_chunk(MAT_BUMPMAP, normal)
+            if matmap:
+                material_chunk.add_subchunk(matmap)
+
+            # make sure no textures are lost. Everything that doesn't fit
+            # into a channel is exported as diffuse texture with a
+            # warning.
+            diffuse = []
+            for s in slots:
+                if s.use_map_color_diffuse:
+                    diffuse.append(s)
+                elif not (s in normal or s in alpha or s in spec):
+                    print('\nwarning: failed to map texture to 3DS map channel, assuming diffuse')
+                    diffuse.append(s)
+
+            if diffuse:
+                matmap = make_material_texture_chunk(MAT_DIFFUSEMAP, diffuse, image)
+                if matmap:
+                    material_chunk.add_subchunk(matmap)
 
     return material_chunk
 
@@ -525,13 +620,13 @@ def extract_triangles(mesh):
 
     If the mesh contains quads, they will be split into triangles.'''
     tri_list = []
-    do_uv = len(mesh.uv_textures)
+    do_uv = bool(mesh.tessface_uv_textures)
 
     img = None
-    for i, face in enumerate(mesh.faces):
+    for i, face in enumerate(mesh.tessfaces):
         f_v = face.vertices
 
-        uf = mesh.uv_textures.active.data[i] if do_uv else None
+        uf = mesh.tessface_uv_textures.active.data[i] if do_uv else None
 
         if do_uv:
             f_uv = uf.uv
@@ -638,7 +733,7 @@ def make_faces_chunk(tri_list, mesh, materialDict):
     face_chunk = _3ds_chunk(OBJECT_FACES)
     face_list = _3ds_array()
 
-    if mesh.uv_textures:
+    if mesh.tessface_uv_textures:
         # Gather materials used in this mesh - mat/image pairs
         unique_mats = {}
         for i, tri in enumerate(tri_list):
@@ -725,7 +820,7 @@ def make_mesh_chunk(mesh, matrix, materialDict):
     # Extract the triangles from the mesh:
     tri_list = extract_triangles(mesh)
 
-    if mesh.uv_textures:
+    if mesh.tessface_uv_textures:
         # Remove the face UVs and convert it to vertex UV:
         vert_array, uv_array, tri_list = remove_face_uv(mesh.vertices, tri_list)
     else:
@@ -963,11 +1058,11 @@ def save(operator,
                 mat_ls_len = len(mat_ls)
 
                 # get material/image tuples.
-                if data.uv_textures:
+                if data.tessface_uv_textures:
                     if not mat_ls:
                         mat = mat_name = None
 
-                    for f, uf in zip(data.faces, data.uv_textures.active.data):
+                    for f, uf in zip(data.tessfaces, data.tessface_uv_textures.active.data):
                         if mat_ls:
                             mat_index = f.material_index
                             if mat_index >= mat_ls_len:
@@ -987,7 +1082,7 @@ def save(operator,
                             materialDict.setdefault((mat.name, None), (mat, None))
 
                     # Why 0 Why!
-                    for f in data.faces:
+                    for f in data.tessfaces:
                         if f.material_index >= mat_ls_len:
                             f.material_index = 0
 
diff --git a/release/scripts/addons/io_scene_3ds/import_3ds.py b/release/scripts/addons/io_scene_3ds/import_3ds.py
index fda09b5..77fdcf7 100644
--- a/release/scripts/addons/io_scene_3ds/import_3ds.py
+++ b/release/scripts/addons/io_scene_3ds/import_3ds.py
@@ -66,6 +66,13 @@ MAT_REFLECTION_MAP = 0xA220  # This is a header for a new reflection map
 MAT_BUMP_MAP = 0xA230  # This is a header for a new bump map
 MAT_MAP_FILEPATH = 0xA300  # This holds the file name of the texture
 
+MAT_MAP_TILING = 0xa351   # 2nd bit (from LSB) is mirror UV flag
+MAT_MAP_USCALE = 0xA354   # U axis scaling
+MAT_MAP_VSCALE = 0xA356   # V axis scaling
+MAT_MAP_UOFFSET = 0xA358  # U axis offset
+MAT_MAP_VOFFSET = 0xA35A  # V axis offset
+MAT_MAP_ANG = 0xA35C      # UV rotation around the z-axis in rad
+
 MAT_FLOAT_COLOR = 0x0010  # color defined as 3 floats
 MAT_24BIT_COLOR = 0x0011  # color defined as 3 bytes
 
@@ -211,7 +218,7 @@ def skip_to_end(file, skip_chunk):
     skip_chunk.bytes_read += buffer_size
 
 
-def add_texture_to_material(image, texture, material, mapto):
+def add_texture_to_material(image, texture, scale, offset, extension, material, mapto):
     #print('assigning %s to %s' % (texture, material))
 
     if mapto not in {'COLOR', 'SPECULARITY', 'ALPHA', 'NORMAL'}:
@@ -226,6 +233,18 @@ def add_texture_to_material(image, texture, material, mapto):
     mtex.texture_coords = 'UV'
     mtex.use_map_color_diffuse = False
 
+    mtex.scale = (scale[0], scale[1], 1.0)
+    mtex.offset = (offset[0], offset[1], 0.0)
+
+    texture.extension = 'REPEAT'
+    if extension == 'mirror':
+        # 3DS mirror flag can be emulated by these settings (at least so it seems)
+        texture.repeat_x = texture.repeat_y = 2
+        texture.use_mirror_x = texture.use_mirror_y = True
+    elif extension == 'decal':
+        # 3DS' decal mode maps best to Blenders CLIP
+        texture.extension = 'CLIP'
+
     if mapto == 'COLOR':
         mtex.use_map_color_diffuse = True
     elif mapto == 'SPECULARITY':
@@ -255,6 +274,7 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
 # 	TEXMODE = Mesh.FaceModes['TEX']
 
     # Localspace variable names, faster.
+    STRUCT_SIZE_FLOAT = struct.calcsize('f')
     STRUCT_SIZE_2FLOAT = struct.calcsize('2f')
     STRUCT_SIZE_3FLOAT = struct.calcsize('3f')
     STRUCT_SIZE_4FLOAT = struct.calcsize('4f')
@@ -277,15 +297,19 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
         if myContextMesh_vertls:
 
             bmesh.vertices.add(len(myContextMesh_vertls) // 3)
-            bmesh.faces.add(len(myContextMesh_facels))
             bmesh.vertices.foreach_set("co", myContextMesh_vertls)
 
+            nbr_faces = len(myContextMesh_facels)
+            bmesh.polygons.add(nbr_faces)
+            bmesh.loops.add(nbr_faces * 3)
             eekadoodle_faces = []
             for v1, v2, v3 in myContextMesh_facels:
-                eekadoodle_faces.extend([v3, v1, v2, 0] if v3 == 0 else [v1, v2, v3, 0])
-            bmesh.faces.foreach_set("vertices_raw", eekadoodle_faces)
+                eekadoodle_faces.extend((v3, v1, v2) if v3 == 0 else (v1, v2, v3))
+            bmesh.polygons.foreach_set("loop_start", range(0, nbr_faces * 3, 3))
+            bmesh.polygons.foreach_set("loop_total", (3,) * nbr_faces)
+            bmesh.loops.foreach_set("vertex_index", eekadoodle_faces)
 
-            if bmesh.faces and contextMeshUV:
+            if bmesh.polygons and contextMeshUV:
                 bmesh.uv_textures.new()
                 uv_faces = bmesh.uv_textures.active.data[:]
             else:
@@ -308,15 +332,15 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
 
                 if uv_faces  and img:
                     for fidx in faces:
-                        bmesh.faces[fidx].material_index = mat_idx
-                        uf = uv_faces[fidx]
-                        uf.image = img
+                        bmesh.polygons[fidx].material_index = mat_idx
+                        uv_faces[fidx].image = img
                 else:
                     for fidx in faces:
-                        bmesh.faces[fidx].material_index = mat_idx
+                        bmesh.polygons[fidx].material_index = mat_idx
 
             if uv_faces:
-                for fidx, uf in enumerate(uv_faces):
+                uvl = bmesh.uv_layers.active.data[:]
+                for fidx, pl in enumerate(bmesh.polygons):
                     face = myContextMesh_facels[fidx]
                     v1, v2, v3 = face
 
@@ -324,9 +348,9 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
                     if v3 == 0:
                         v1, v2, v3 = v3, v1, v2
 
-                    uf.uv1 = contextMeshUV[v1 * 2:(v1 * 2) + 2]
-                    uf.uv2 = contextMeshUV[v2 * 2:(v2 * 2) + 2]
-                    uf.uv3 = contextMeshUV[v3 * 2:(v3 * 2) + 2]
+                    uvl[pl.loop_start].uv = contextMeshUV[v1 * 2: (v1 * 2) + 2]
+                    uvl[pl.loop_start + 1].uv = contextMeshUV[v2 * 2: (v2 * 2) + 2]
+                    uvl[pl.loop_start + 2].uv = contextMeshUV[v3 * 2: (v3 * 2) + 2]
                     # always a tri
 
         bmesh.validate()
@@ -348,10 +372,20 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
     CreateBlenderObject = False
 
     def read_float_color(temp_chunk):
-        temp_data = file.read(struct.calcsize('3f'))
-        temp_chunk.bytes_read += 12
+        temp_data = file.read(STRUCT_SIZE_3FLOAT)
+        temp_chunk.bytes_read += STRUCT_SIZE_3FLOAT
         return [float(col) for col in struct.unpack('<3f', temp_data)]
 
+    def read_float(temp_chunk):
+        temp_data = file.read(STRUCT_SIZE_FLOAT)
+        temp_chunk.bytes_read += STRUCT_SIZE_FLOAT
+        return struct.unpack('<f', temp_data)[0]
+
+    def read_short(temp_chunk):
+        temp_data = file.read(STRUCT_SIZE_UNSIGNED_SHORT)
+        temp_chunk.bytes_read += STRUCT_SIZE_UNSIGNED_SHORT
+        return struct.unpack('<H', temp_data)[0]
+
     def read_byte_color(temp_chunk):
         temp_data = file.read(struct.calcsize('3B'))
         temp_chunk.bytes_read += 3
@@ -360,24 +394,46 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
     def read_texture(new_chunk, temp_chunk, name, mapto):
         new_texture = bpy.data.textures.new(name, type='IMAGE')
 
-        img = None
+        u_scale, v_scale, u_offset, v_offset = 1.0, 1.0, 0.0, 0.0
+        mirror = False
+        extension = 'wrap'
         while (new_chunk.bytes_read < new_chunk.length):
             #print 'MAT_TEXTURE_MAP..while', new_chunk.bytes_read, new_chunk.length
             read_chunk(file, temp_chunk)
 
             if temp_chunk.ID == MAT_MAP_FILEPATH:
                 texture_name, read_str_len = read_string(file)
+
                 img = TEXTURE_DICT[contextMaterial.name] = load_image(texture_name, dirname)
-                new_chunk.bytes_read += read_str_len  # plus one for the null character that gets removed
+                temp_chunk.bytes_read += read_str_len  # plus one for the null character that gets removed
 
-            else:
-                skip_to_end(file, temp_chunk)
+            elif temp_chunk.ID == MAT_MAP_USCALE:
+                u_scale = read_float(temp_chunk)
+            elif temp_chunk.ID == MAT_MAP_VSCALE:
+                v_scale = read_float(temp_chunk)
+
+            elif temp_chunk.ID == MAT_MAP_UOFFSET:
+                u_offset = read_float(temp_chunk)
+            elif temp_chunk.ID == MAT_MAP_VOFFSET:
+                v_offset = read_float(temp_chunk)
+
+            elif temp_chunk.ID == MAT_MAP_TILING:
+                tiling = read_short(temp_chunk)
+                if tiling & 0x2:
+                    extension = 'mirror'
+                elif tiling & 0x10:
+                    extension = 'decal'
+
+            elif temp_chunk.ID == MAT_MAP_ANG:
+                print("\nwarning: ignoring UV rotation")
 
+            skip_to_end(file, temp_chunk)
             new_chunk.bytes_read += temp_chunk.bytes_read
 
         # add the map to the material in the right channel
         if img:
-            add_texture_to_material(img, new_texture, contextMaterial, mapto)
+            add_texture_to_material(img, new_texture, (u_scale, v_scale),
+                                    (u_offset, v_offset), extension, contextMaterial, mapto)
 
     dirname = os.path.dirname(file.name)
 
diff --git a/release/scripts/addons/io_scene_fbx/__init__.py b/release/scripts/addons/io_scene_fbx/__init__.py
index f2ee6cb..f3862f7 100644
--- a/release/scripts/addons/io_scene_fbx/__init__.py
+++ b/release/scripts/addons/io_scene_fbx/__init__.py
@@ -132,6 +132,11 @@ class ExportFBX(bpy.types.Operator, ExportHelper):
                          "pipeline errors with XNA"),
             default=False,
             )
+    use_armature_deform_only = BoolProperty(
+            name="Only Deform Bones",
+            description="Only write deforming bones",
+            default=False,
+            )
     use_anim = BoolProperty(
             name="Include Animation",
             description="Export keyframe animation",
diff --git a/release/scripts/addons/io_scene_fbx/export_fbx.py b/release/scripts/addons/io_scene_fbx/export_fbx.py
index 8790e60..8090c44 100644
--- a/release/scripts/addons/io_scene_fbx/export_fbx.py
+++ b/release/scripts/addons/io_scene_fbx/export_fbx.py
@@ -216,6 +216,7 @@ def save_single(operator, scene, filepath="",
         object_types={'EMPTY', 'CAMERA', 'LAMP', 'ARMATURE', 'MESH'},
         use_mesh_modifiers=True,
         mesh_smooth_type='FACE',
+        use_armature_deform_only=False,
         use_anim=True,
         use_anim_optimize=True,
         anim_optimize_precision=6,
@@ -1352,7 +1353,7 @@ def save_single(operator, scene, filepath="",
         # if there are non NULL materials on this mesh
         do_materials = bool(my_mesh.blenMaterials)
         do_textures = bool(my_mesh.blenTextures)
-        do_uvs = bool(me.uv_textures)
+        do_uvs = bool(me.tessface_uv_textures)
         do_shapekeys = (my_mesh.blenObject.type == 'MESH' and
                         my_mesh.blenObject.data.shape_keys and
                         len(my_mesh.blenObject.data.vertices) == len(me.vertices))
@@ -1363,7 +1364,7 @@ def save_single(operator, scene, filepath="",
         # convert into lists once.
         me_vertices = me.vertices[:]
         me_edges = me.edges[:] if use_mesh_edges else ()
-        me_faces = me.faces[:]
+        me_faces = me.tessfaces[:]
 
         poseMatrix = write_object_props(my_mesh.blenObject, None, my_mesh.parRelMatrix())[3]
         pose_items.append((my_mesh.fbxName, poseMatrix))
@@ -1524,8 +1525,8 @@ def save_single(operator, scene, filepath="",
         # Write VertexColor Layers
         # note, no programs seem to use this info :/
         collayers = []
-        if len(me.vertex_colors):
-            collayers = me.vertex_colors
+        if len(me.tessface_vertex_colors):
+            collayers = me.tessface_vertex_colors
             for colindex, collayer in enumerate(collayers):
                 fw('\n\t\tLayerElementColor: %i {' % colindex)
                 fw('\n\t\t\tVersion: 101')
@@ -1538,7 +1539,7 @@ def save_single(operator, scene, filepath="",
 
                 i = -1
                 ii = 0  # Count how many Colors we write
-
+                print(len(me_faces), len(collayer.data))
                 for fi, cf in enumerate(collayer.data):
                     if len(me_faces[fi].vertices) == 4:
                         colors = cf.color1[:], cf.color2[:], cf.color3[:], cf.color4[:]
@@ -1575,8 +1576,8 @@ def save_single(operator, scene, filepath="",
         # Write UV and texture layers.
         uvlayers = []
         if do_uvs:
-            uvlayers = me.uv_textures
-            for uvindex, uvlayer in enumerate(me.uv_textures):
+            uvlayers = me.tessface_uv_textures
+            for uvindex, uvlayer in enumerate(me.tessface_uv_textures):
                 fw('\n\t\tLayerElementUV: %i {' % uvindex)
                 fw('\n\t\t\tVersion: 101')
                 fw('\n\t\t\tName: "%s"' % uvlayer.name)
@@ -1696,8 +1697,8 @@ def save_single(operator, scene, filepath="",
 
                 mats = my_mesh.blenMaterialList
 
-                if me.uv_textures.active:
-                    uv_faces = me.uv_textures.active.data
+                if me.tessface_uv_textures.active:
+                    uv_faces = me.tessface_uv_textures.active.data
                 else:
                     uv_faces = [None] * len(me_faces)
 
@@ -1757,7 +1758,7 @@ def save_single(operator, scene, filepath="",
 				TypedIndex: 0
 			}''')
 
-        if me.vertex_colors:
+        if me.tessface_vertex_colors:
             fw('''
 			LayerElement:  {
 				Type: "LayerElementColor"
@@ -1864,17 +1865,6 @@ def save_single(operator, scene, filepath="",
                     i += 1
                 fw('\n\t\t}')
 
-        for v in me_vertices:
-            if i == -1:
-                fw('%.6f,%.6f,%.6f' % v.co[:])
-                i = 0
-            else:
-                if i == 7:
-                    fw('\n\t\t')
-                    i = 0
-                fw(',%.6f,%.6f,%.6f' % v.co[:])
-            i += 1
-
         fw('\n\t}')
 
     def write_group(name):
@@ -2002,9 +1992,9 @@ def save_single(operator, scene, filepath="",
 
                     texture_mapping_local = {}
                     material_mapping_local = {}
-                    if me.uv_textures:
-                        for uvlayer in me.uv_textures:
-                            for f, uf in zip(me.faces, uvlayer.data):
+                    if me.tessface_uv_textures:
+                        for uvlayer in me.tessface_uv_textures:
+                            for f, uf in zip(me.tessfaces, uvlayer.data):
                                 tex = uf.image
                                 textures[tex] = texture_mapping_local[tex] = None
 
@@ -2098,11 +2088,30 @@ def save_single(operator, scene, filepath="",
         # fbxName, blenderObject, my_bones, blenderActions
         #ob_arms[i] = fbxArmObName, ob, arm_my_bones, (ob.action, [])
 
+        if use_armature_deform_only:
+            # tag non deforming bones that have no deforming children
+            deform_map = dict.fromkeys(my_arm.blenData.bones, False)
+            for bone in my_arm.blenData.bones:
+                if bone.use_deform:
+                    deform_map[bone] = True
+                    # tag all parents, even ones that are not deform since their child _is_
+                    for parent in bone.parent_recursive:
+                        deform_map[parent] = True
+
         for bone in my_arm.blenData.bones:
+
+            if use_armature_deform_only:
+                # if this bone doesnt deform, and none of its children deform, skip it!
+                if not deform_map[bone]:
+                    continue
+
             my_bone = my_bone_class(bone, my_arm)
             my_arm.fbxBones.append(my_bone)
             ob_bones.append(my_bone)
 
+        if use_armature_deform_only:
+            del deform_map
+
     # add the meshes to the bones and replace the meshes armature with own armature class
     #for obname, ob, mtx, me, mats, arm, armname in ob_meshes:
     for my_mesh in ob_meshes:
@@ -2877,7 +2886,7 @@ Takes:  {''')
     fw('\n\t\tAmbientLightColor: %.1f,%.1f,%.1f,0' % tuple(world_amb))
     fw('\n\t}')
     fw('\n\tFogOptions:  {')
-    fw('\n\t\tFlogEnable: %i' % has_mist)
+    fw('\n\t\tFogEnable: %i' % has_mist)
     fw('\n\t\tFogMode: 0')
     fw('\n\t\tFogDensity: %.3f' % mist_intense)
     fw('\n\t\tFogStart: %.3f' % mist_start)
@@ -2932,6 +2941,7 @@ def defaults_unity3d():
                 use_selection=False,
                 object_types={'ARMATURE', 'EMPTY', 'MESH'},
                 use_mesh_modifiers=True,
+                use_armature_deform_only=True,
                 use_anim=True,
                 use_anim_optimize=False,
                 use_anim_action_all=True,
diff --git a/release/scripts/addons/io_scene_map/export_map.py b/release/scripts/addons/io_scene_map/export_map.py
index a10926b..77108b8 100644
--- a/release/scripts/addons/io_scene_map/export_map.py
+++ b/release/scripts/addons/io_scene_map/export_map.py
@@ -354,8 +354,11 @@ def export_map(context, filepath):
         # High quality normals
         #XXX25: BPyMesh.meshCalcNormals(dummy_mesh)
 
+        # We need tessfaces
+        dummy_mesh.update(calc_tessface)
+
         # Split mesh into connected regions
-        for face_group in mesh_utils.mesh_linked_faces(dummy_mesh):
+        for face_group in mesh_utils.mesh_linked_tessfaces(dummy_mesh):
             if is_cube_facegroup(face_group):
                 write_cube2brush(file, face_group)
                 TOTBRUSH += 1
diff --git a/release/scripts/addons/io_scene_obj/__init__.py b/release/scripts/addons/io_scene_obj/__init__.py
index 12bec2d..1218485 100644
--- a/release/scripts/addons/io_scene_obj/__init__.py
+++ b/release/scripts/addons/io_scene_obj/__init__.py
@@ -67,7 +67,7 @@ class ImportOBJ(bpy.types.Operator, ImportHelper):
 
     use_ngons = BoolProperty(
             name="NGons",
-            description="Import faces with more then 4 verts as fgons",
+            description="Import faces with more than 4 verts as fgons",
             default=True,
             )
     use_edges = BoolProperty(
@@ -255,7 +255,7 @@ class ExportOBJ(bpy.types.Operator, ExportHelper):
             )
     use_nurbs = BoolProperty(
             name="Write Nurbs",
-            description="Write nurbs curves as OBJ nurbs rather then "
+            description="Write nurbs curves as OBJ nurbs rather than "
                         "converting to geometry",
             default=False,
             )
diff --git a/release/scripts/addons/io_scene_obj/export_obj.py b/release/scripts/addons/io_scene_obj/export_obj.py
index 3317438..99bd2f5 100644
--- a/release/scripts/addons/io_scene_obj/export_obj.py
+++ b/release/scripts/addons/io_scene_obj/export_obj.py
@@ -42,13 +42,13 @@ def write_mtl(scene, filepath, path_mode, copy_set, mtl_dict):
     else:
         world_amb = Color((0.0, 0.0, 0.0))
 
-    source_dir = bpy.data.filepath
+    source_dir = os.path.dirname(bpy.data.filepath)
     dest_dir = os.path.dirname(filepath)
 
     file = open(filepath, "w", encoding="utf8", newline="\n")
     fw = file.write
 
-    fw('# Blender MTL File: %r\n' % os.path.basename(bpy.data.filepath))
+    fw('# Blender MTL File: %r\n' % (os.path.basename(bpy.data.filepath) or "None"))
     fw('# Material Count: %i\n' % len(mtl_dict))
 
     mtl_dict_values = list(mtl_dict.values())
@@ -338,15 +338,15 @@ def write_file(filepath, objects, scene,
             if EXPORT_UV:
                 faceuv = len(me.uv_textures) > 0
                 if faceuv:
-                    uv_layer = me.uv_textures.active.data[:]
+                    uv_layer = me.tessface_uv_textures.active.data[:]
             else:
                 faceuv = False
 
             me_verts = me.vertices[:]
 
             # Make our own list so it can be sorted to reduce context switching
-            face_index_pairs = [(face, index) for index, face in enumerate(me.faces)]
-            # faces = [ f for f in me.faces ]
+            face_index_pairs = [(face, index) for index, face in enumerate(me.tessfaces)]
+            # faces = [ f for f in me.tessfaces ]
 
             if EXPORT_EDGES:
                 edges = me.edges
@@ -412,7 +412,7 @@ def write_file(filepath, objects, scene,
                 uv_face_mapping = [[0, 0, 0, 0] for i in range(len(face_index_pairs))]  # a bit of a waste for tri's :/
 
                 uv_dict = {}  # could use a set() here
-                uv_layer = me.uv_textures.active.data
+                uv_layer = me.tessface_uv_textures.active.data
                 for f, f_index in face_index_pairs:
                     for uv_index, uv in enumerate(uv_layer[f_index].uv):
                         uvkey = veckey2d(uv)
diff --git a/release/scripts/addons/io_scene_obj/import_obj.py b/release/scripts/addons/io_scene_obj/import_obj.py
index 32ec2b8..17d559a 100644
--- a/release/scripts/addons/io_scene_obj/import_obj.py
+++ b/release/scripts/addons/io_scene_obj/import_obj.py
@@ -383,7 +383,7 @@ def split_mesh(verts_loc, faces, unique_materials, filepath, SPLIT_OB_OR_GROUP):
                 faces_split = []
                 verts_split = []
                 unique_materials_split = {}
-                vert_remap = [-1] * len(verts_loc)
+                vert_remap = {}
 
                 face_split_dict[key] = (verts_split, faces_split, unique_materials_split, vert_remap)
 
@@ -393,13 +393,13 @@ def split_mesh(verts_loc, faces, unique_materials, filepath, SPLIT_OB_OR_GROUP):
 
         # Remap verts to new vert list and add where needed
         for enum, i in enumerate(face_vert_loc_indices):
-            if vert_remap[i] == -1:
-                new_index = len(verts_split)
-                vert_remap[i] = new_index  # set the new remapped index so we only add once and can reference next time.
-                face_vert_loc_indices[enum] = new_index  # remap to the local index
+            map_index = vert_remap.get(i)
+            if map_index is None:
+                map_index = len(verts_split)
+                vert_remap[i] = map_index  # set the new remapped index so we only add once and can reference next time.
                 verts_split.append(verts_loc[i])  # add the vert to the local verts
-            else:
-                face_vert_loc_indices[enum] = vert_remap[i]  # remap to the local index
+
+            face_vert_loc_indices[enum] = map_index  # remap to the local index
 
             matname = face[2]
             if matname and matname not in unique_materials_split:
@@ -428,7 +428,7 @@ def create_mesh(new_objects,
     Takes all the data gathered and generates a mesh, adding the new object to new_objects
     deals with fgons, sharp edges and assigning materials
     '''
-    from bpy_extras.mesh_utils import ngon_tesselate
+    from bpy_extras.mesh_utils import ngon_tessellate
 
     if not has_ngons:
         use_ngons = False
@@ -490,7 +490,7 @@ def create_mesh(new_objects,
             # FGons into triangles
             if has_ngons and len_face_vert_loc_indices > 4:
 
-                ngon_face_indices = ngon_tesselate(verts_loc, face_vert_loc_indices)
+                ngon_face_indices = ngon_tessellate(verts_loc, face_vert_loc_indices)
                 faces.extend([([face_vert_loc_indices[ngon[0]],
                                 face_vert_loc_indices[ngon[1]],
                                 face_vert_loc_indices[ngon[2]],
@@ -550,7 +550,7 @@ def create_mesh(new_objects,
         me.materials.append(material)
 
     me.vertices.add(len(verts_loc))
-    me.faces.add(len(faces))
+    me.tessfaces.add(len(faces))
 
     # verts_loc is a list of (x, y, z) tuples
     me.vertices.foreach_set("co", unpack_list(verts_loc))
@@ -558,14 +558,14 @@ def create_mesh(new_objects,
     # faces is a list of (vert_indices, texco_indices, ...) tuples
     # XXX faces should contain either 3 or 4 verts
     # XXX no check for valid face indices
-    me.faces.foreach_set("vertices_raw", unpack_face_list([f[0] for f in faces]))
+    me.tessfaces.foreach_set("vertices_raw", unpack_face_list([f[0] for f in faces]))
 
-    if verts_tex and me.faces:
-        me.uv_textures.new()
+    if verts_tex and me.tessfaces:
+        me.tessface_uv_textures.new()
 
     context_material_old = -1  # avoid a dict lookup
     mat = 0  # rare case it may be un-initialized.
-    me_faces = me.faces
+    me_faces = me.tessfaces
 
     for i, face in enumerate(faces):
         if len(face[0]) < 2:
@@ -575,7 +575,7 @@ def create_mesh(new_objects,
                 edges.append(face[0])
         else:
 
-            blender_face = me.faces[i]
+            blender_face = me.tessfaces[i]
 
             (face_vert_loc_indices,
              face_vert_tex_indices,
@@ -597,7 +597,7 @@ def create_mesh(new_objects,
 
             if verts_tex:
 
-                blender_tface = me.uv_textures[0].data[i]
+                blender_tface = me.tessface_uv_textures[0].data[i]
 
                 if context_material:
                     image, has_data = unique_material_images[context_material]
diff --git a/release/scripts/addons/io_scene_x3d/__init__.py b/release/scripts/addons/io_scene_x3d/__init__.py
index 5a7429f..cccbb58 100644
--- a/release/scripts/addons/io_scene_x3d/__init__.py
+++ b/release/scripts/addons/io_scene_x3d/__init__.py
@@ -19,11 +19,11 @@
 # <pep8-80 compliant>
 
 bl_info = {
-    "name": "Web3D X3D/VRML format",
+    "name": "Web3D X3D/VRML2 format",
     "author": "Campbell Barton, Bart",
     "blender": (2, 5, 7),
     "location": "File > Import-Export",
-    "description": "Import-Export X3D, Import VRML",
+    "description": "Import-Export X3D, Import VRML2",
     "warning": "",
     "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"
                 "Scripts/Import-Export/Web3D",
@@ -48,9 +48,9 @@ from bpy_extras.io_utils import (ImportHelper,
 
 
 class ImportX3D(bpy.types.Operator, ImportHelper):
-    '''Import and X3D or VRML file'''
+    '''Import an X3D or VRML2 file'''
     bl_idname = "import_scene.x3d"
-    bl_label = "Import X3D/VRML"
+    bl_label = "Import X3D/VRML2"
     bl_options = {'PRESET', 'UNDO'}
 
     filename_ext = ".x3d"
diff --git a/release/scripts/addons/io_scene_x3d/export_x3d.py b/release/scripts/addons/io_scene_x3d/export_x3d.py
index e0710e6..ddc0713 100644
--- a/release/scripts/addons/io_scene_x3d/export_x3d.py
+++ b/release/scripts/addons/io_scene_x3d/export_x3d.py
@@ -525,7 +525,11 @@ def export(file,
         mesh_id_coords = prefix_quoted_str(mesh_id, 'coords_')
         mesh_id_normals = prefix_quoted_str(mesh_id, 'normals_')
 
-        if not mesh.faces:
+        # tessellation faces may not exist
+        if not mesh.tessfaces and mesh.polygons:
+            mesh.update(calc_tessface=True)
+
+        if not mesh.tessfaces:
             return
 
         use_collnode = bool([mod for mod in obj.modifiers
@@ -548,7 +552,7 @@ def export(file,
             fw('%s<Group DEF=%s>\n' % (ident, mesh_id_group))
             ident += '\t'
 
-            is_uv = bool(mesh.uv_textures.active)
+            is_uv = bool(mesh.tessface_uv_textures.active)
             # is_col, defined for each material
 
             is_coords_written = False
@@ -578,12 +582,16 @@ def export(file,
 
             # fast access!
             mesh_vertices = mesh.vertices[:]
-            mesh_faces = mesh.faces[:]
+            mesh_faces = mesh.tessfaces[:]
             mesh_faces_materials = [f.material_index for f in mesh_faces]
             mesh_faces_vertices = [f.vertices[:] for f in mesh_faces]
 
             if is_uv and True in mesh_materials_use_face_texture:
-                mesh_faces_image = [(fuv.image if (mesh_materials_use_face_texture[mesh_faces_materials[i]]) else mesh_material_images[mesh_faces_materials[i]]) for i, fuv in enumerate(mesh.uv_textures.active.data)]
+                mesh_faces_image = [(fuv.image
+                                     if mesh_materials_use_face_texture[mesh_faces_materials[i]]
+                                     else mesh_material_images[mesh_faces_materials[i]])
+                                     for i, fuv in enumerate(mesh.tessface_uv_textures.active.data)]
+
                 mesh_faces_image_unique = set(mesh_faces_image)
             elif len(set(mesh_material_images) | {None}) > 1:  # make sure there is at least one image
                 mesh_faces_image = [mesh_material_images[material_index] for material_index in mesh_faces_materials]
@@ -614,7 +622,7 @@ def export(file,
                     ident += '\t'
 
                     is_smooth = False
-                    is_col = (mesh.vertex_colors.active and (material is None or material.use_vertex_color_paint))
+                    is_col = (mesh.tessface_vertex_colors.active and (material is None or material.use_vertex_color_paint))
 
                     # kludge but as good as it gets!
                     for i in face_group:
@@ -691,8 +699,8 @@ def export(file,
                     ident = ident[:-1]
                     fw('%s</Appearance>\n' % ident)
 
-                    mesh_faces_col = mesh.vertex_colors.active.data if is_col else None
-                    mesh_faces_uv = mesh.uv_textures.active.data if is_uv else None
+                    mesh_faces_col = mesh.tessface_vertex_colors.active.data if is_col else None
+                    mesh_faces_uv = mesh.tessface_uv_textures.active.data if is_uv else None
 
                     #-- IndexedFaceSet or IndexedLineSet
                     if use_triangulate:
@@ -700,7 +708,7 @@ def export(file,
                         fw('%s<IndexedTriangleSet ' % ident)))
 
                         # --- Write IndexedTriangleSet Attributes (same as IndexedFaceSet)
-                        fw('solid="%s"\n' % ('true' if mesh.show_double_sided else 'false'))
+                        fw('solid="%s"\n' % ('true' if material and material.game_settings.use_backface_culling else 'false'))
 
                         if use_normals or is_force_normals:
                             fw(ident_step + 'normalPerVertex="true"\n')
@@ -742,7 +750,7 @@ def export(file,
                         # build a mesh mapping dict
                         vertex_hash = [{} for i in range(len(mesh.vertices))]
                         # worst case every face is a quad
-                        face_tri_list = [[None, None, None] for i in range(len(mesh.faces) * 2)]
+                        face_tri_list = [[None, None, None] for i in range(len(mesh.tessfaces) * 2)]
                         vert_tri_list = []
                         totvert = 0
                         totface = 0
@@ -843,7 +851,7 @@ def export(file,
                         fw('%s<IndexedFaceSet ' % ident)))
 
                         # --- Write IndexedFaceSet Attributes (same as IndexedTriangleSet)
-                        fw('solid="%s"\n' % ('true' if mesh.show_double_sided else 'false'))
+                        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)
 
diff --git a/release/scripts/addons/io_scene_x3d/import_x3d.py b/release/scripts/addons/io_scene_x3d/import_x3d.py
index 9c6986d..4ba7104 100644
--- a/release/scripts/addons/io_scene_x3d/import_x3d.py
+++ b/release/scripts/addons/io_scene_x3d/import_x3d.py
@@ -1386,6 +1386,8 @@ def x3d_parse(path):
     except:
         return None, 'Not a valid x3d document, cannot import'
 
+    bpy.ops.object.select_all(action='DESELECT')
+
     root = x3dNode(None, NODE_NORMAL, x3dnode)
     root.setRoot(path)  # so images and Inline's we load have a relative path
     root.parse()
@@ -1667,17 +1669,17 @@ def importMesh_IndexedFaceSet(geom, bpyima, ancestry):
     # print(len(ifs_points), faces, edges, ngons)
 
     try:
-        bpymesh.faces.add(len(faces))
-        bpymesh.faces.foreach_set("vertices_raw", [a for f in faces for a in (f + [0] if len(f) == 3 else f)])  # XXX25 speed
+        bpymesh.tessfaces.add(len(faces))
+        bpymesh.tessfaces.foreach_set("vertices_raw", [a for f in faces for a in (f + [0] if len(f) == 3 else f)])  # XXX25 speed
     except KeyError:
         print("one or more vert indices out of range. corrupt file?")
         #for f in faces:
-        #   bpymesh.faces.extend(faces, smooth=True)
+        #   bpymesh.tessfaces.extend(faces, smooth=True)
 
     bpymesh.validate()
-    bpymesh.update()
+    # bpymesh.update()  # cant call now, because it would convert tessface
 
-    if len(bpymesh.faces) != len(faces):
+    if len(bpymesh.tessfaces) != len(faces):
         print('\tWarning: adding faces did not work! file is invalid, not adding UVs or vcolors')
         return bpymesh, ccw
 
@@ -1687,7 +1689,7 @@ def importMesh_IndexedFaceSet(geom, bpyima, ancestry):
     if coords_tex:
         #print(ifs_texpoints)
         # print(geom)
-        uvlay = bpymesh.uv_textures.new()
+        uvlay = bpymesh.tessface_uv_textures.new()
 
         for i, f in enumerate(uvlay.data):
             f.image = bpyima
@@ -1700,7 +1702,7 @@ def importMesh_IndexedFaceSet(geom, bpyima, ancestry):
                     print('\tWarning: UV Index out of range')
                     f.uv[j] = ifs_texpoints[0]  # XXX25, speedup
 
-    elif bpyima and len(bpymesh.faces):
+    elif bpyima and len(bpymesh.tessfaces):
         # Oh Bugger! - we cant really use blenders ORCO for for texture space since texspace dosnt rotate.
         # we have to create VRML's coords as UVs instead.
 
@@ -1762,13 +1764,13 @@ def importMesh_IndexedFaceSet(geom, bpyima, ancestry):
             # This should be safe because when 2 axies have the same length, the lower index will be used.
             axis_v += 1
 
-        uvlay = bpymesh.uv_textures.new()
+        uvlay = bpymesh.tessface_uv_textures.new()
 
         # HACK !!! - seems to be compatible with Cosmo though.
         depth_v = depth_u = max(depth_v, depth_u)
 
         bpymesh_vertices = bpymesh.vertices[:]
-        bpymesh_faces = bpymesh.faces[:]
+        bpymesh_faces = bpymesh.tessfaces[:]
 
         for j, f in enumerate(uvlay.data):
             f.image = bpyima
@@ -1782,10 +1784,10 @@ def importMesh_IndexedFaceSet(geom, bpyima, ancestry):
     # Add vcote
     if vcolor:
         # print(ifs_vcol)
-        collay = bpymesh.vertex_colors.new()
+        collay = bpymesh.tessface_vertex_colors.new()
 
         for f_idx, f in enumerate(collay.data):
-            fv = bpymesh.faces[f_idx].vertices[:]
+            fv = bpymesh.tessfaces[f_idx].vertices[:]
             if len(fv) == 3:  # XXX speed
                 fcol = f.color1, f.color2, f.color3
             else:
@@ -1829,6 +1831,9 @@ def importMesh_IndexedFaceSet(geom, bpyima, ancestry):
     # XXX25
     # bpymesh.vertices.delete([0, ])  # EEKADOODLE
 
+    bpymesh.update()
+    bpymesh.validate()
+
     return bpymesh, ccw
 
 
@@ -1961,7 +1966,7 @@ def importMesh_Cylinder(geom, ancestry):
     if not side:
         # remove all quads
         # XXX25
-        # bpymesh.faces.delete(1, [f for f in bpymesh.faces if len(f) == 4])
+        # bpymesh.tessfaces.delete(1, [f for f in bpymesh.tessfaces if len(f) == 4])
         pass
 
     return bpymesh
@@ -2155,7 +2160,7 @@ def importShape(node, ancestry, global_matrix):
             bpydata.name = vrmlname
 
             bpyob = node.blendObject = bpy.data.objects.new(vrmlname, bpydata)
-            bpy.context.scene.objects.link(bpyob)
+            bpy.context.scene.objects.link(bpyob).select = True
 
             if type(bpydata) == bpy.types.Mesh:
                 is_solid = geom.getFieldAsBool('solid', True, ancestry)
@@ -2169,17 +2174,17 @@ def importShape(node, ancestry, global_matrix):
                 if bpymat:
                     bpydata.materials.append(bpymat)
 
-                if bpydata.uv_textures:
+                if bpydata.tessface_uv_textures:
 
                     if depth == 32:  # set the faces alpha flag?
                         transp = Mesh.FaceTranspModes.ALPHA
-                        for f in bpydata.uv_textures.active.data:
+                        for f in bpydata.tessface_uv_textures.active.data:
                             f.blend_type = 'ALPHA'
 
                     if texmtx:
                         # Apply texture transform?
                         uv_copy = Vector()
-                        for f in bpydata.uv_textures.active.data:
+                        for f in bpydata.tessface_uv_textures.active.data:
                             fuv = f.uv
                             for i, uv in enumerate(fuv):
                                 uv_copy.x = uv[0]
@@ -2296,7 +2301,7 @@ def importLamp(node, spec, ancestry, global_matrix):
         raise ValueError
 
     bpyob = node.blendObject = bpy.data.objects.new("TODO", bpylamp)
-    bpy.context.scene.objects.link(bpyob)
+    bpy.context.scene.objects.link(bpyob).select = True
 
     bpyob.matrix_world = getFinalMatrix(node, mtx, ancestry, global_matrix)
 
@@ -2319,7 +2324,7 @@ def importViewpoint(node, ancestry, global_matrix):
     mtx = Matrix.Translation(Vector(position)) * translateRotation(orientation)
 
     bpyob = node.blendObject = bpy.data.objects.new(name, bpycam)
-    bpy.context.scene.objects.link(bpyob)
+    bpy.context.scene.objects.link(bpyob).select = True
     bpyob.matrix_world = getFinalMatrix(node, mtx, ancestry, global_matrix)
 
 
@@ -2329,7 +2334,7 @@ def importTransform(node, ancestry, global_matrix):
         name = 'Transform'
 
     bpyob = node.blendObject = bpy.data.objects.new(name, None)
-    bpy.context.scene.objects.link(bpyob)
+    bpy.context.scene.objects.link(bpyob).select = True
 
     bpyob.matrix_world = getFinalMatrix(node, None, ancestry, global_matrix)
 
@@ -2588,7 +2593,7 @@ def load_web3d(path,
                 node = defDict[key]
                 if node.blendObject is None:  # Add an object if we need one for animation
                     node.blendObject = bpy.data.objects.new('AnimOb', None)  # , name)
-                    bpy.context.scene.objects.link(node.blendObject)
+                    bpy.context.scene.objects.link(node.blendObject).select = True
 
                 if node.blendObject.animation_data is None:
                     node.blendObject.animation_data_create()
diff --git a/release/scripts/addons/mesh_bsurfaces.py b/release/scripts/addons/mesh_bsurfaces.py
index b51d80f..4fae264 100644
--- a/release/scripts/addons/mesh_bsurfaces.py
+++ b/release/scripts/addons/mesh_bsurfaces.py
@@ -278,9 +278,12 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator):
             
         
         ob_gp_strokes.name = "SURFSK_temp_strokes"
-        
         bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
-        bpy.ops.object.select_name('INVOKE_REGION_WIN', name = ob_gp_strokes.name)
+
+        myobject = bpy.data.objects[ob_gp_strokes.name]
+        bpy.context.scene.objects.active = myobject
+        myobject.select = True
+#        bpy.ops.object.select_name('INVOKE_REGION_WIN', name = ob_gp_strokes.name)
         bpy.context.scene.objects.active = bpy.context.scene.objects[ob_gp_strokes.name]
         
         
@@ -298,7 +301,9 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator):
             bpy.ops.object.editmode_toggle('INVOKE_REGION_WIN')
             
             bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
-            bpy.ops.object.select_name('INVOKE_REGION_WIN', name = ob_gp_strokes.name)
+            myobject = bpy.data.objects[ob_gp_strokes.name]
+            bpy.context.scene.objects.active = myobject
+            myobject.select = True
             bpy.context.scene.objects.active = bpy.context.scene.objects[ob_gp_strokes.name]
         
         
@@ -594,7 +599,10 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator):
                 vert_num_in_spline += 1
         
         bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
-        bpy.ops.object.select_name('INVOKE_REGION_WIN', name = ob_ctrl_pts.name)
+        myobject = bpy.data.objects[ob_ctrl_pts.name]
+        bpy.context.scene.objects.active = myobject
+        myobject.select = True
+#        bpy.ops.object.select_name('INVOKE_REGION_WIN', name = ob_ctrl_pts.name)
         bpy.context.scene.objects.active = bpy.data.objects[ob_ctrl_pts.name]
         
         
@@ -678,12 +686,18 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator):
         
         #### Delete object with control points and object from grease pencil convertion.
         bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
-        bpy.ops.object.select_name('INVOKE_REGION_WIN', name = ob_ctrl_pts.name)
+        myobject = bpy.data.objects[ob_ctrl_pts.name]
+        bpy.context.scene.objects.active = myobject
+        myobject.select = True
+#        bpy.ops.object.select_name('INVOKE_REGION_WIN', name = ob_ctrl_pts.name)
         bpy.context.scene.objects.active = bpy.data.objects[ob_ctrl_pts.name]
         bpy.ops.object.delete()
         
         bpy.ops.object.select_all('INVOKE_REGION_WIN', action='DESELECT')
-        bpy.ops.object.select_name('INVOKE_REGION_WIN', name = ob_gp_strokes.name)
+        myobject = bpy.data.objects[ob_gp_strokes.name]
+        bpy.context.scene.objects.active = myobject
+        myobject.select = True
+#        bpy.ops.object.select_name('INVOKE_REGION_WIN', name = ob_gp_strokes.name)
         bpy.context.scene.objects.active = bpy.data.objects[ob_gp_strokes.name]
         bpy.ops.object.delete()
             
@@ -724,7 +738,7 @@ class GPENCIL_OT_SURFSK_add_surface(bpy.types.Operator):
         bpy.context.scene.objects.active = bpy.data.objects[self.main_object.name]
         bpy.ops.object.join('INVOKE_REGION_WIN')
         bpy.ops.object.editmode_toggle('INVOKE_REGION_WIN')
-        bpy.ops.mesh.remove_doubles('INVOKE_REGION_WIN', limit=0.0001)
+        bpy.ops.mesh.remove_doubles('INVOKE_REGION_WIN', mergedist=0.0001)
         bpy.ops.mesh.normals_make_consistent('INVOKE_REGION_WIN', inside=False)
         bpy.ops.mesh.select_all('INVOKE_REGION_WIN', action='DESELECT')
         
diff --git a/release/scripts/addons/mesh_inset/__init__.py b/release/scripts/addons/mesh_inset/__init__.py
index b9575b6..d494fd1 100644
--- a/release/scripts/addons/mesh_inset/__init__.py
+++ b/release/scripts/addons/mesh_inset/__init__.py
@@ -21,15 +21,15 @@
 bl_info = {
     "name": "Inset Polygon",
     "author": "Howard Trickey",
-    "version": (0, 3),
-    "blender": (2, 5, 7),
+    "version": (0, 4),
+    "blender": (2, 6, 3),
     "location": "View3D > Tools",
     "description": "Make an inset polygon inside selection.",
     "warning": "",
     "wiki_url": \
-      "http://wiki.blender.org/index.php/Extensions:2.5/Py/Scripts/Modeling/Inset-Polygon",
+      "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Modeling/Inset-Polygon",
     "tracker_url": \
-      "http://projects.blender.org/tracker/index.php?func=detail&aid=27290&group_id=153&atid=468",
+      "http://projects.blender.org/tracker/index.php?func=detail&aid=27290&group_id=153&atid=469",
     "category": "Mesh"}
 
 if "bpy" in locals():
@@ -42,6 +42,7 @@ else:
 
 import math
 import bpy
+import bmesh
 import mathutils
 from bpy.props import (BoolProperty,
                        EnumProperty,
@@ -50,8 +51,8 @@ from bpy.props import (BoolProperty,
 
 
 class Inset(bpy.types.Operator):
-    bl_idname = "mesh.inset"
-    bl_label = "Inset"
+    bl_idname = "mesh.insetpoly"
+    bl_label = "Inset Polygon"
     bl_description = "Make an inset polygon inside selection"
     bl_options = {'REGISTER', 'UNDO'}
 
@@ -109,13 +110,13 @@ class Inset(bpy.types.Operator):
     def action(self, context):
         save_global_undo = bpy.context.user_preferences.edit.use_global_undo
         bpy.context.user_preferences.edit.use_global_undo = False
-        bpy.ops.object.mode_set(mode='OBJECT')
         obj = bpy.context.active_object
         mesh = obj.data
         do_inset(mesh, self.inset_amount, self.inset_height, self.region,
             self.scale == 'PERCENT')
-        bpy.ops.object.mode_set(mode='EDIT')
         bpy.context.user_preferences.edit.use_global_undo = save_global_undo
+        bpy.ops.object.editmode_toggle()
+        bpy.ops.object.editmode_toggle()
 
 
 def do_inset(mesh, amount, height, region, as_percent):
@@ -124,17 +125,18 @@ def do_inset(mesh, amount, height, region, as_percent):
     pitch = math.atan(height / amount)
     selfaces = []
     selface_indices = []
-    for face in mesh.faces:
-        if face.select and not face.hide:
+    bm = bmesh.from_edit_mesh(mesh)
+    for face in bm.faces:
+        if face.select:
             selfaces.append(face)
             selface_indices.append(face.index)
     m = geom.Model()
     # if add all mesh.vertices, coord indices will line up
     # Note: not using Points.AddPoint which does dup elim
     # because then would have to map vertices in and out
-    m.points.pos = [v.co.to_tuple() for v in mesh.vertices]
+    m.points.pos = [v.co.to_tuple() for v in bm.verts]
     for f in selfaces:
-        m.faces.append(list(f.vertices))
+        m.faces.append([loop.vert.index for loop in f.loops])
         m.face_data.append(f.index)
     orig_numv = len(m.points.pos)
     orig_numf = len(m.faces)
@@ -142,53 +144,37 @@ def do_inset(mesh, amount, height, region, as_percent):
     if len(m.faces) == orig_numf:
         # something went wrong with Bevel - just treat as no-op
         return
-    # blender_faces: newfaces but all 4-tuples and no 0
-    # in 4th position if a 4-sided poly
-    blender_faces = []
-    blender_old_face_index = []
-    for i in range(orig_numf, len(m.faces)):
-        f = m.faces[i]
-        if len(f) == 3:
-            blender_faces.append(list(f) + [0])
-            blender_old_face_index.append(m.face_data[i])
-        elif len(f) == 4:
-            if f[3] == 0:
-                blender_faces.append([f[3], f[0], f[1], f[2]])
-            else:
-                blender_faces.append(f)
-            blender_old_face_index.append(m.face_data[i])
-    num_new_vertices = len(m.points.pos) - orig_numv
-    mesh.vertices.add(num_new_vertices)
+    blender_faces = m.faces[orig_numf:len(m.faces)]
+    blender_old_face_index = m.face_data[orig_numf:len(m.faces)]
     for i in range(orig_numv, len(m.points.pos)):
-        mesh.vertices[i].co = mathutils.Vector(m.points.pos[i])
-    start_faces = len(mesh.faces)
-    mesh.faces.add(len(blender_faces))
+        bvertnew = bm.verts.new(m.points.pos[i])
+    bm.verts.index_update()
+    new_faces = []
+    start_faces = len(bm.faces)
     for i, newf in enumerate(blender_faces):
-        mesh.faces[start_faces + i].vertices_raw = newf
+        vs = [bm.verts[j] for j in newf]
         # copy face attributes from old face that it was derived from
         bfi = blender_old_face_index[i]
         if bfi and 0 <= bfi < start_faces:
-            bfacenew = mesh.faces[start_faces + i]
-            bface = mesh.faces[bfi]
-            bfacenew.material_index = bface.material_index
-            bfacenew.use_smooth = bface.use_smooth
-    mesh.update(calc_edges=True)
+            oldface = bm.faces[bfi]
+            bfacenew = bm.faces.new(vs, oldface)
+            # bfacenew.copy_from_face_interp(oldface)
+        else:
+            bfacenew = bm.faces.new(vs)
     # remove original faces
-    bpy.ops.object.mode_set(mode='EDIT')
-    save_select_mode = bpy.context.tool_settings.mesh_select_mode
-    bpy.context.tool_settings.mesh_select_mode = [False, False, True]
-    bpy.ops.mesh.select_all(action='DESELECT')
-    bpy.ops.object.mode_set(mode='OBJECT')
-    for fi in selface_indices:
-        mesh.faces[fi].select = True
-    bpy.ops.object.mode_set(mode='EDIT')
-    bpy.ops.mesh.delete(type='FACE')
-    bpy.context.tool_settings.mesh_select_mode = save_select_mode
+    for face in selfaces:
+        face.select_set(False)
+        bm.faces.remove(face)
+    bm.faces.index_update()
+    # mesh.update(calc_edges=True)
+    # select all new faces
+    for face in new_faces:
+        face.select_set(True)
 
 
 def panel_func(self, context):
-    self.layout.label(text="Inset:")
-    self.layout.operator("mesh.inset", text="Inset")
+    self.layout.label(text="Inset Polygon:")
+    self.layout.operator("mesh.insetpoly", text="Inset Polygon")
 
 
 def register():
diff --git a/release/scripts/addons/mesh_looptools.py b/release/scripts/addons/mesh_looptools.py
deleted file mode 100644
index 06e3618..0000000
--- a/release/scripts/addons/mesh_looptools.py
+++ /dev/null
@@ -1,3728 +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': "LoopTools",
-    'author': "Bart Crouch",
-    'version': (3, 2, 3),
-    'blender': (2, 6, 1),
-    'location': "View3D > Toolbar and View3D > Specials (W-key)",
-    'warning': "",
-    'description': "Mesh modelling toolkit. Several tools to aid modelling",
-    'wiki_url': "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
-        "Scripts/Modeling/LoopTools",
-    'tracker_url': "http://projects.blender.org/tracker/index.php?"\
-        "func=detail&aid=26189",
-    'category': 'Mesh'}
-
-
-import bpy
-import mathutils
-import math
-
-
-##########################################
-####### General functions ################
-##########################################
-
-
-# used by all tools to improve speed on reruns
-looptools_cache = {}
-
-
-# force a full recalculation next time
-def cache_delete(tool):
-    if tool in looptools_cache:
-        del looptools_cache[tool]
-
-
-# check cache for stored information
-def cache_read(tool, object, mesh, input_method, boundaries):
-    # current tool not cached yet
-    if tool not in looptools_cache:
-        return(False, False, False, False, False)
-    # check if selected object didn't change
-    if object.name != looptools_cache[tool]["object"]:
-        return(False, False, False, False, False)
-    # check if input didn't change
-    if input_method != looptools_cache[tool]["input_method"]:
-        return(False, False, False, False, False)
-    if boundaries != looptools_cache[tool]["boundaries"]:
-        return(False, False, False, False, False)
-    modifiers = [mod.name for mod in object.modifiers if mod.show_viewport \
-        and mod.type == 'MIRROR']
-    if modifiers != looptools_cache[tool]["modifiers"]:
-        return(False, False, False, False, False)
-    input = [v.index for v in mesh.vertices if v.select and not v.hide]
-    if input != looptools_cache[tool]["input"]:
-        return(False, False, False, False, False)
-    # reading values
-    single_loops = looptools_cache[tool]["single_loops"]
-    loops = looptools_cache[tool]["loops"]
-    derived = looptools_cache[tool]["derived"]
-    mapping = looptools_cache[tool]["mapping"]
-    
-    return(True, single_loops, loops, derived, mapping)
-
-
-# store information in the cache
-def cache_write(tool, object, mesh, input_method, boundaries, single_loops,
-loops, derived, mapping):
-    # clear cache of current tool
-    if tool in looptools_cache:
-        del looptools_cache[tool]
-    # prepare values to be saved to cache
-    input = [v.index for v in mesh.vertices if v.select and not v.hide]
-    modifiers = [mod.name for mod in object.modifiers if mod.show_viewport \
-        and mod.type == 'MIRROR']
-    # update cache
-    looptools_cache[tool] = {"input": input, "object": object.name,
-        "input_method": input_method, "boundaries": boundaries,
-        "single_loops": single_loops, "loops": loops,
-        "derived": derived, "mapping": mapping, "modifiers": modifiers}
-
-
-# calculates natural cubic splines through all given knots
-def calculate_cubic_splines(mesh_mod, tknots, knots):
-    # hack for circular loops
-    if knots[0] == knots[-1] and len(knots) > 1:
-        circular = True
-        k_new1 = []
-        for k in range(-1, -5, -1):
-            if k - 1 < -len(knots):
-                k += len(knots)
-            k_new1.append(knots[k-1])
-        k_new2 = []
-        for k in range(4):
-            if k + 1 > len(knots) - 1:
-                k -= len(knots)
-            k_new2.append(knots[k+1])
-        for k in k_new1:
-            knots.insert(0, k)
-        for k in k_new2:
-            knots.append(k)
-        t_new1 = []
-        total1 = 0
-        for t in range(-1, -5, -1):
-            if t - 1 < -len(tknots):
-                t += len(tknots)
-            total1 += tknots[t] - tknots[t-1]
-            t_new1.append(tknots[0] - total1)
-        t_new2 = []
-        total2 = 0
-        for t in range(4):
-            if t + 1 > len(tknots) - 1:
-                t -= len(tknots)
-            total2 += tknots[t+1] - tknots[t]
-            t_new2.append(tknots[-1] + total2)
-        for t in t_new1:
-            tknots.insert(0, t)
-        for t in t_new2:
-            tknots.append(t)
-    else:
-        circular = False
-    # end of hack
-    
-    n = len(knots)
-    if n < 2:
-        return False
-    x = tknots[:]
-    locs = [mesh_mod.vertices[k].co[:] for k in knots]
-    result = []
-    for j in range(3):
-        a = []
-        for i in locs:
-            a.append(i[j])
-        h = []
-        for i in range(n-1):
-            if x[i+1] - x[i] == 0:
-                h.append(1e-8)
-            else:
-                h.append(x[i+1] - x[i])
-        q = [False]
-        for i in range(1, n-1):
-            q.append(3/h[i]*(a[i+1]-a[i]) - 3/h[i-1]*(a[i]-a[i-1]))
-        l = [1.0]
-        u = [0.0]
-        z = [0.0]
-        for i in range(1, n-1):
-            l.append(2*(x[i+1]-x[i-1]) - h[i-1]*u[i-1])
-            if l[i] == 0:
-                l[i] = 1e-8
-            u.append(h[i] / l[i])
-            z.append((q[i] - h[i-1] * z[i-1]) / l[i])
-        l.append(1.0)
-        z.append(0.0)
-        b = [False for i in range(n-1)]
-        c = [False for i in range(n)]
-        d = [False for i in range(n-1)]
-        c[n-1] = 0.0
-        for i in range(n-2, -1, -1):
-            c[i] = z[i] - u[i]*c[i+1]
-            b[i] = (a[i+1]-a[i])/h[i] - h[i]*(c[i+1]+2*c[i])/3
-            d[i] = (c[i+1]-c[i]) / (3*h[i])
-        for i in range(n-1):
-            result.append([a[i], b[i], c[i], d[i], x[i]])
-    splines = []
-    for i in range(len(knots)-1):
-        splines.append([result[i], result[i+n-1], result[i+(n-1)*2]])
-    if circular: # cleaning up after hack
-        knots = knots[4:-4]
-        tknots = tknots[4:-4]
-    
-    return(splines)
-
-
-# calculates linear splines through all given knots
-def calculate_linear_splines(mesh_mod, tknots, knots):
-    splines = []
-    for i in range(len(knots)-1):
-        a = mesh_mod.vertices[knots[i]].co
-        b = mesh_mod.vertices[knots[i+1]].co
-        d = b-a
-        t = tknots[i]
-        u = tknots[i+1]-t
-        splines.append([a, d, t, u]) # [locStart, locDif, tStart, tDif]
-    
-    return(splines)
-
-
-# calculate a best-fit plane to the given vertices
-def calculate_plane(mesh_mod, loop, method="best_fit", object=False):
-    # getting the vertex locations
-    locs = [mesh_mod.vertices[v].co.copy() for v in loop[0]]
-    
-    # calculating the center of masss
-    com = mathutils.Vector()
-    for loc in locs:
-        com += loc
-    com /= len(locs)
-    x, y, z = com
-    
-    if method == 'best_fit':
-        # creating the covariance matrix
-        mat = mathutils.Matrix(((0.0, 0.0, 0.0),
-                                (0.0, 0.0, 0.0),
-                                (0.0, 0.0, 0.0),
-                                ))
-        for loc in locs:
-            mat[0][0] += (loc[0]-x)**2
-            mat[1][0] += (loc[0]-x)*(loc[1]-y)
-            mat[2][0] += (loc[0]-x)*(loc[2]-z)
-            mat[0][1] += (loc[1]-y)*(loc[0]-x)
-            mat[1][1] += (loc[1]-y)**2
-            mat[2][1] += (loc[1]-y)*(loc[2]-z)
-            mat[0][2] += (loc[2]-z)*(loc[0]-x)
-            mat[1][2] += (loc[2]-z)*(loc[1]-y)
-            mat[2][2] += (loc[2]-z)**2
-        
-        # calculating the normal to the plane
-        normal = False
-        try:
-            mat.invert()
-        except:
-            if sum(mat[0]) == 0.0:
-                normal = mathutils.Vector((1.0, 0.0, 0.0))
-            elif sum(mat[1]) == 0.0:
-                normal = mathutils.Vector((0.0, 1.0, 0.0))
-            elif sum(mat[2]) == 0.0:
-                normal = mathutils.Vector((0.0, 0.0, 1.0))
-        if not normal:
-            # warning! this is different from .normalize()
-            itermax = 500
-            iter = 0
-            vec = mathutils.Vector((1.0, 1.0, 1.0))
-            vec2 = (mat * vec)/(mat * vec).length
-            while vec != vec2 and iter<itermax:
-                iter+=1
-                vec = vec2
-                vec2 = mat * vec
-                if vec2.length != 0:
-                    vec2 /= vec2.length
-            if vec2.length == 0:
-                vec2 = mathutils.Vector((1.0, 1.0, 1.0))
-            normal = vec2
-    
-    elif method == 'normal':
-        # averaging the vertex normals
-        v_normals = [mesh_mod.vertices[v].normal for v in loop[0]]
-        normal = mathutils.Vector()
-        for v_normal in v_normals:
-            normal += v_normal
-        normal /= len(v_normals)
-        normal.normalize()
-        
-    elif method == 'view':
-        # calculate view normal
-        rotation = bpy.context.space_data.region_3d.view_matrix.to_3x3().\
-            inverted()
-        normal = rotation * mathutils.Vector((0.0, 0.0, 1.0))
-        if object:
-            normal = object.matrix_world.inverted().to_euler().to_matrix() * \
-                     normal
-    
-    return(com, normal)
-
-
-# calculate splines based on given interpolation method (controller function)
-def calculate_splines(interpolation, mesh_mod, tknots, knots):
-    if interpolation == 'cubic':
-        splines = calculate_cubic_splines(mesh_mod, tknots, knots[:])
-    else: # interpolations == 'linear'
-        splines = calculate_linear_splines(mesh_mod, tknots, knots[:])
-    
-    return(splines)
-
-
-# check loops and only return valid ones
-def check_loops(loops, mapping, mesh_mod):
-    valid_loops = []
-    for loop, circular in loops:
-        # loop needs to have at least 3 vertices
-        if len(loop) < 3:
-            continue
-        # loop needs at least 1 vertex in the original, non-mirrored mesh
-        if mapping:
-            all_virtual = True
-            for vert in loop:
-                if mapping[vert] > -1:
-                    all_virtual = False
-                    break
-            if all_virtual:
-                continue
-        # vertices can not all be at the same location
-        stacked = True
-        for i in range(len(loop) - 1):
-            if (mesh_mod.vertices[loop[i]].co - \
-            mesh_mod.vertices[loop[i+1]].co).length > 1e-6:
-                stacked = False
-                break
-        if stacked:
-            continue    
-        # passed all tests, loop is valid
-        valid_loops.append([loop, circular])
-    
-    return(valid_loops)
-
-
-# input: mesh, output: dict with the edge-key as key and face-index as value
-def dict_edge_faces(mesh):
-    edge_faces = dict([[edge.key, []] for edge in mesh.edges if not edge.hide])
-    for face in mesh.faces:
-        if face.hide:
-            continue
-        for key in face.edge_keys:
-            edge_faces[key].append(face.index)
-    
-    return(edge_faces)
-
-# input: mesh (edge-faces optional), output: dict with face-face connections
-def dict_face_faces(mesh, edge_faces=False):
-    if not edge_faces:
-        edge_faces = dict_edge_faces(mesh)
-    
-    connected_faces = dict([[face.index, []] for face in mesh.faces if \
-        not face.hide])
-    for face in mesh.faces:
-        if face.hide:
-            continue
-        for edge_key in face.edge_keys:
-            for connected_face in edge_faces[edge_key]:
-                if connected_face == face.index:
-                    continue
-                connected_faces[face.index].append(connected_face)
-    
-    return(connected_faces)
-
-
-# input: mesh, output: dict with the vert index as key and edge-keys as value
-def dict_vert_edges(mesh):
-    vert_edges = dict([[v.index, []] for v in mesh.vertices if not v.hide])
-    for edge in mesh.edges:
-        if edge.hide:
-            continue
-        for vert in edge.key:
-            vert_edges[vert].append(edge.key)
-    
-    return(vert_edges)
-
-
-# input: mesh, output: dict with the vert index as key and face index as value
-def dict_vert_faces(mesh):
-    vert_faces = dict([[v.index, []] for v in mesh.vertices if not v.hide])
-    for face in mesh.faces:
-        if not face.hide:
-            for vert in face.vertices:
-                vert_faces[vert].append(face.index)
-                
-    return(vert_faces)
-
-
-# input: list of edge-keys, output: dictionary with vertex-vertex connections
-def dict_vert_verts(edge_keys):
-    # create connection data
-    vert_verts = {}
-    for ek in edge_keys:
-        for i in range(2):
-            if ek[i] in vert_verts:
-                vert_verts[ek[i]].append(ek[1-i])
-            else:
-                vert_verts[ek[i]] = [ek[1-i]]
-    
-    return(vert_verts)
-
-
-# calculate input loops
-def get_connected_input(object, mesh, scene, input):
-    # get mesh with modifiers applied
-    derived, mesh_mod = get_derived_mesh(object, mesh, scene)
-    
-    # calculate selected loops
-    edge_keys = [edge.key for edge in mesh_mod.edges if \
-        edge.select and not edge.hide]
-    loops = get_connected_selections(edge_keys)
-    
-    # if only selected loops are needed, we're done
-    if input == 'selected':
-        return(derived, mesh_mod, loops)
-    # elif input == 'all':    
-    loops = get_parallel_loops(mesh_mod, loops)
-    
-    return(derived, mesh_mod, loops)
-
-
-# sorts all edge-keys into a list of loops
-def get_connected_selections(edge_keys):
-    # create connection data
-    vert_verts = dict_vert_verts(edge_keys)
-    
-    # find loops consisting of connected selected edges
-    loops = []
-    while len(vert_verts) > 0:
-        loop = [iter(vert_verts.keys()).__next__()]
-        growing = True
-        flipped = False
-        
-        # extend loop
-        while growing:
-            # no more connection data for current vertex
-            if loop[-1] not in vert_verts:
-                if not flipped:
-                    loop.reverse()
-                    flipped = True
-                else:
-                    growing = False
-            else:
-                extended = False
-                for i, next_vert in enumerate(vert_verts[loop[-1]]):
-                    if next_vert not in loop:
-                        vert_verts[loop[-1]].pop(i)
-                        if len(vert_verts[loop[-1]]) == 0:
-                            del vert_verts[loop[-1]]
-                        # remove connection both ways
-                        if next_vert in vert_verts:
-                            if len(vert_verts[next_vert]) == 1:
-                                del vert_verts[next_vert]
-                            else:
-                                vert_verts[next_vert].remove(loop[-1])
-                        loop.append(next_vert)
-                        extended = True
-                        break
-                if not extended:
-                    # found one end of the loop, continue with next
-                    if not flipped:
-                        loop.reverse()
-                        flipped = True
-                    # found both ends of the loop, stop growing
-                    else:
-                        growing = False
-        
-        # check if loop is circular
-        if loop[0] in vert_verts:
-            if loop[-1] in vert_verts[loop[0]]:
-                # is circular
-                if len(vert_verts[loop[0]]) == 1:
-                    del vert_verts[loop[0]]
-                else:
-                    vert_verts[loop[0]].remove(loop[-1])
-                if len(vert_verts[loop[-1]]) == 1:
-                    del vert_verts[loop[-1]]
-                else:
-                    vert_verts[loop[-1]].remove(loop[0])
-                loop = [loop, True]
-            else:
-                # not circular
-                loop = [loop, False]
-        else:
-            # not circular
-            loop = [loop, False]
-        
-        loops.append(loop)
-    
-    return(loops)
-
-
-# get the derived mesh data, if there is a mirror modifier
-def get_derived_mesh(object, mesh, scene):
-    # check for mirror modifiers
-    if 'MIRROR' in [mod.type for mod in object.modifiers if mod.show_viewport]:
-        derived = True
-        # disable other modifiers
-        show_viewport = [mod.name for mod in object.modifiers if \
-            mod.show_viewport]
-        for mod in object.modifiers:
-            if mod.type != 'MIRROR':
-                mod.show_viewport = False
-        # get derived mesh
-        mesh_mod = object.to_mesh(scene, True, 'PREVIEW')
-        # re-enable other modifiers
-        for mod_name in show_viewport:
-            object.modifiers[mod_name].show_viewport = True
-    # no mirror modifiers, so no derived mesh necessary
-    else:
-        derived = False
-        mesh_mod = mesh
-    
-    return(derived, mesh_mod)
-
-
-# return a mapping of derived indices to indices
-def get_mapping(derived, mesh, mesh_mod, single_vertices, full_search, loops):
-    if not derived:
-        return(False)
-    
-    if full_search:
-        verts = [v for v in mesh.vertices if not v.hide]
-    else:
-        verts = [v for v in mesh.vertices if v.select and not v.hide]
-    
-    # non-selected vertices around single vertices also need to be mapped
-    if single_vertices:
-        mapping = dict([[vert, -1] for vert in single_vertices])
-        verts_mod = [mesh_mod.vertices[vert] for vert in single_vertices]
-        for v in verts:
-            for v_mod in verts_mod:
-                if (v.co - v_mod.co).length < 1e-6:
-                    mapping[v_mod.index] = v.index
-                    break
-        real_singles = [v_real for v_real in mapping.values() if v_real>-1]
-        
-        verts_indices = [vert.index for vert in verts]
-        for face in [face for face in mesh.faces if not face.select \
-        and not face.hide]:
-            for vert in face.vertices:
-                if vert in real_singles:
-                    for v in face.vertices:
-                        if not v in verts_indices:
-                            if mesh.vertices[v] not in verts:
-                                verts.append(mesh.vertices[v])
-                    break
-    
-    # create mapping of derived indices to indices
-    mapping = dict([[vert, -1] for loop in loops for vert in loop[0]])
-    if single_vertices:
-        for single in single_vertices:
-            mapping[single] = -1
-    verts_mod = [mesh_mod.vertices[i] for i in mapping.keys()]
-    for v in verts:
-        for v_mod in verts_mod:
-            if (v.co - v_mod.co).length < 1e-6:
-                mapping[v_mod.index] = v.index
-                verts_mod.remove(v_mod)
-                break
-    
-    return(mapping)
-
-
-# returns a list of all loops parallel to the input, input included
-def get_parallel_loops(mesh_mod, loops):
-    # get required dictionaries
-    edge_faces = dict_edge_faces(mesh_mod)
-    connected_faces = dict_face_faces(mesh_mod, edge_faces)
-    # turn vertex loops into edge loops
-    edgeloops = []
-    for loop in loops:
-        edgeloop = [[sorted([loop[0][i], loop[0][i+1]]) for i in \
-            range(len(loop[0])-1)], loop[1]]
-        if loop[1]: # circular
-            edgeloop[0].append(sorted([loop[0][-1], loop[0][0]]))
-        edgeloops.append(edgeloop[:])
-    # variables to keep track while iterating
-    all_edgeloops = []
-    has_branches = False
-    
-    for loop in edgeloops:
-        # initialise with original loop
-        all_edgeloops.append(loop[0])
-        newloops = [loop[0]]
-        verts_used = []
-        for edge in loop[0]:
-            if edge[0] not in verts_used:
-                verts_used.append(edge[0])
-            if edge[1] not in verts_used:
-                verts_used.append(edge[1])
-        
-        # find parallel loops
-        while len(newloops) > 0:
-            side_a = []
-            side_b = []
-            for i in newloops[-1]:
-                i = tuple(i)
-                forbidden_side = False
-                if not i in edge_faces:
-                    # weird input with branches
-                    has_branches = True
-                    break
-                for face in edge_faces[i]:
-                    if len(side_a) == 0 and forbidden_side != "a":
-                        side_a.append(face)
-                        if forbidden_side:
-                            break
-                        forbidden_side = "a"
-                        continue
-                    elif side_a[-1] in connected_faces[face] and \
-                    forbidden_side != "a":
-                        side_a.append(face)
-                        if forbidden_side:
-                            break
-                        forbidden_side = "a"
-                        continue
-                    if len(side_b) == 0 and forbidden_side != "b":
-                        side_b.append(face)
-                        if forbidden_side:
-                            break
-                        forbidden_side = "b"
-                        continue
-                    elif side_b[-1] in connected_faces[face] and \
-                    forbidden_side != "b":
-                        side_b.append(face)
-                        if forbidden_side:
-                            break
-                        forbidden_side = "b"
-                        continue
-            
-            if has_branches:
-                # weird input with branches
-                break
-            
-            newloops.pop(-1)
-            sides = []
-            if side_a:
-                sides.append(side_a)
-            if side_b:
-                sides.append(side_b)
-            
-            for side in sides:
-                extraloop = []
-                for fi in side:
-                    for key in mesh_mod.faces[fi].edge_keys:
-                        if key[0] not in verts_used and key[1] not in \
-                        verts_used:
-                            extraloop.append(key)
-                            break
-                if extraloop:
-                    for key in extraloop:
-                        for new_vert in key:
-                            if new_vert not in verts_used:
-                                verts_used.append(new_vert)
-                    newloops.append(extraloop)
-                    all_edgeloops.append(extraloop)
-    
-    # input contains branches, only return selected loop
-    if has_branches:
-        return(loops)
-    
-    # change edgeloops into normal loops
-    loops = []
-    for edgeloop in all_edgeloops:
-        loop = []
-        # grow loop by comparing vertices between consecutive edge-keys
-        for i in range(len(edgeloop)-1):
-            for vert in range(2):
-                if edgeloop[i][vert] in edgeloop[i+1]:
-                    loop.append(edgeloop[i][vert])
-                    break
-        if loop:
-            # add starting vertex
-            for vert in range(2):
-                if edgeloop[0][vert] != loop[0]:
-                    loop = [edgeloop[0][vert]] + loop
-                    break
-            # add ending vertex
-            for vert in range(2):
-                if edgeloop[-1][vert] != loop[-1]:
-                    loop.append(edgeloop[-1][vert])
-                    break
-            # check if loop is circular
-            if loop[0] == loop[-1]:
-                circular = True
-                loop = loop[:-1]
-            else:
-                circular = False
-        loops.append([loop, circular])
-    
-    return(loops)
-
-
-# gather initial data
-def initialise():
-    global_undo = bpy.context.user_preferences.edit.use_global_undo
-    bpy.context.user_preferences.edit.use_global_undo = False
-    bpy.ops.object.mode_set(mode='OBJECT')
-    object = bpy.context.active_object
-    mesh = bpy.context.active_object.data
-    
-    return(global_undo, object, mesh)
-
-
-# move the vertices to their new locations
-def move_verts(mesh, mapping, move, influence):
-    for loop in move:
-        for index, loc in loop:
-            if mapping:
-                if mapping[index] == -1:
-                    continue
-                else:
-                    index = mapping[index]
-            if influence >= 0:
-                mesh.vertices[index].co = loc*(influence/100) + \
-                    mesh.vertices[index].co*((100-influence)/100)
-            else:
-                mesh.vertices[index].co = loc
-
-
-# load custom tool settings 
-def settings_load(self):
-    lt = bpy.context.window_manager.looptools
-    tool = self.name.split()[0].lower()
-    keys = self.as_keywords().keys()
-    for key in keys:
-        setattr(self, key, getattr(lt, tool + "_" + key))
-
-
-# store custom tool settings
-def settings_write(self):
-    lt = bpy.context.window_manager.looptools
-    tool = self.name.split()[0].lower()
-    keys = self.as_keywords().keys()
-    for key in keys:
-        setattr(lt, tool + "_" + key, getattr(self, key))
-
-
-# clean up and set settings back to original state
-def terminate(global_undo):
-    bpy.ops.object.mode_set(mode='EDIT')
-    bpy.context.user_preferences.edit.use_global_undo = global_undo
-
-
-##########################################
-####### Bridge functions #################
-##########################################
-
-# calculate a cubic spline through the middle section of 4 given coordinates
-def bridge_calculate_cubic_spline(mesh, coordinates):
-    result = []
-    x = [0, 1, 2, 3]
-    
-    for j in range(3):
-        a = []
-        for i in coordinates:
-            a.append(float(i[j]))
-        h = []
-        for i in range(3):
-            h.append(x[i+1]-x[i])
-        q = [False]
-        for i in range(1,3):
-            q.append(3.0/h[i]*(a[i+1]-a[i])-3.0/h[i-1]*(a[i]-a[i-1]))
-        l = [1.0]
-        u = [0.0]
-        z = [0.0]
-        for i in range(1,3):
-            l.append(2.0*(x[i+1]-x[i-1])-h[i-1]*u[i-1])
-            u.append(h[i]/l[i])
-            z.append((q[i]-h[i-1]*z[i-1])/l[i])
-        l.append(1.0)
-        z.append(0.0)
-        b = [False for i in range(3)]
-        c = [False for i in range(4)]
-        d = [False for i in range(3)]
-        c[3] = 0.0
-        for i in range(2,-1,-1):
-            c[i] = z[i]-u[i]*c[i+1]
-            b[i] = (a[i+1]-a[i])/h[i]-h[i]*(c[i+1]+2.0*c[i])/3.0
-            d[i] = (c[i+1]-c[i])/(3.0*h[i])
-        for i in range(3):
-            result.append([a[i], b[i], c[i], d[i], x[i]])
-    spline = [result[1], result[4], result[7]]
-
-    return(spline)
-
-
-# return a list with new vertex location vectors, a list with face vertex 
-# integers, and the highest vertex integer in the virtual mesh
-def bridge_calculate_geometry(mesh, lines, vertex_normals, segments,
-interpolation, cubic_strength, min_width, max_vert_index):
-    new_verts = []
-    faces = []
-    
-    # calculate location based on interpolation method
-    def get_location(line, segment, splines):
-        v1 = mesh.vertices[lines[line][0]].co
-        v2 = mesh.vertices[lines[line][1]].co
-        if interpolation == 'linear':
-            return v1 + (segment/segments) * (v2-v1)
-        else: # interpolation == 'cubic'
-            m = (segment/segments)
-            ax,bx,cx,dx,tx = splines[line][0]
-            x = ax+bx*m+cx*m**2+dx*m**3
-            ay,by,cy,dy,ty = splines[line][1]
-            y = ay+by*m+cy*m**2+dy*m**3
-            az,bz,cz,dz,tz = splines[line][2]
-            z = az+bz*m+cz*m**2+dz*m**3
-            return mathutils.Vector((x, y, z))
-        
-    # no interpolation needed
-    if segments == 1:
-        for i, line in enumerate(lines):
-            if i < len(lines)-1:
-                faces.append([line[0], lines[i+1][0], lines[i+1][1], line[1]])
-    # more than 1 segment, interpolate
-    else:
-        # calculate splines (if necessary) once, so no recalculations needed
-        if interpolation == 'cubic':
-            splines = []
-            for line in lines:
-                v1 = mesh.vertices[line[0]].co
-                v2 = mesh.vertices[line[1]].co
-                size = (v2-v1).length * cubic_strength
-                splines.append(bridge_calculate_cubic_spline(mesh,
-                    [v1+size*vertex_normals[line[0]], v1, v2,
-                    v2+size*vertex_normals[line[1]]]))
-        else:
-            splines = False
-        
-        # create starting situation
-        virtual_width = [(mesh.vertices[lines[i][0]].co -
-                          mesh.vertices[lines[i+1][0]].co).length for i
-                          in range(len(lines)-1)]
-        new_verts = [get_location(0, seg, splines) for seg in range(1,
-            segments)]
-        first_line_indices = [i for i in range(max_vert_index+1,
-            max_vert_index+segments)]
-        
-        prev_verts = new_verts[:] # vertex locations of verts on previous line
-        prev_vert_indices = first_line_indices[:]
-        max_vert_index += segments - 1 # highest vertex index in virtual mesh
-        next_verts = [] # vertex locations of verts on current line
-        next_vert_indices = []
-        
-        for i, line in enumerate(lines):
-            if i < len(lines)-1:
-                v1 = line[0]
-                v2 = lines[i+1][0]
-                end_face = True
-                for seg in range(1, segments):
-                    loc1 = prev_verts[seg-1]
-                    loc2 = get_location(i+1, seg, splines)
-                    if (loc1-loc2).length < (min_width/100)*virtual_width[i] \
-                    and line[1]==lines[i+1][1]:
-                        # triangle, no new vertex
-                        faces.append([v1, v2, prev_vert_indices[seg-1],
-                            prev_vert_indices[seg-1]])
-                        next_verts += prev_verts[seg-1:]
-                        next_vert_indices += prev_vert_indices[seg-1:]
-                        end_face = False
-                        break
-                    else:
-                        if i == len(lines)-2 and lines[0] == lines[-1]:
-                            # quad with first line, no new vertex
-                            faces.append([v1, v2, first_line_indices[seg-1],
-                                prev_vert_indices[seg-1]])
-                            v2 = first_line_indices[seg-1]
-                            v1 = prev_vert_indices[seg-1]
-                        else:
-                            # quad, add new vertex
-                            max_vert_index += 1
-                            faces.append([v1, v2, max_vert_index,
-                                prev_vert_indices[seg-1]])
-                            v2 = max_vert_index
-                            v1 = prev_vert_indices[seg-1]
-                            new_verts.append(loc2)
-                            next_verts.append(loc2)
-                            next_vert_indices.append(max_vert_index)
-                if end_face:
-                    faces.append([v1, v2, lines[i+1][1], line[1]])
-                
-                prev_verts = next_verts[:]
-                prev_vert_indices = next_vert_indices[:]
-                next_verts = []
-                next_vert_indices = []
-    
-    return(new_verts, faces, max_vert_index)
-
-
-# calculate lines (list of lists, vertex indices) that are used for bridging
-def bridge_calculate_lines(mesh, loops, mode, twist, reverse):
-    lines = []
-    loop1, loop2 = [i[0] for i in loops]
-    loop1_circular, loop2_circular = [i[1] for i in loops]
-    circular = loop1_circular or loop2_circular
-    circle_full = False
-    
-    # calculate loop centers
-    centers = []
-    for loop in [loop1, loop2]:
-        center = mathutils.Vector()
-        for vertex in loop:
-            center += mesh.vertices[vertex].co
-        center /= len(loop)
-        centers.append(center)
-    for i, loop in enumerate([loop1, loop2]):
-        for vertex in loop:
-            if mesh.vertices[vertex].co == centers[i]:
-                # prevent zero-length vectors in angle comparisons
-                centers[i] += mathutils.Vector((0.01, 0, 0))
-                break
-    center1, center2 = centers
-    
-    # calculate the normals of the virtual planes that the loops are on
-    normals = []
-    normal_plurity = False
-    for i, loop in enumerate([loop1, loop2]):
-        # covariance matrix
-        mat = mathutils.Matrix(((0.0, 0.0, 0.0),
-                                (0.0, 0.0, 0.0),
-                                (0.0, 0.0, 0.0)))
-        x, y, z = centers[i]
-        for loc in [mesh.vertices[vertex].co for vertex in loop]:
-            mat[0][0] += (loc[0]-x)**2
-            mat[1][0] += (loc[0]-x)*(loc[1]-y)
-            mat[2][0] += (loc[0]-x)*(loc[2]-z)
-            mat[0][1] += (loc[1]-y)*(loc[0]-x)
-            mat[1][1] += (loc[1]-y)**2
-            mat[2][1] += (loc[1]-y)*(loc[2]-z)
-            mat[0][2] += (loc[2]-z)*(loc[0]-x)
-            mat[1][2] += (loc[2]-z)*(loc[1]-y)
-            mat[2][2] += (loc[2]-z)**2
-        # plane normal
-        normal = False
-        if sum(mat[0]) < 1e-6 or sum(mat[1]) < 1e-6 or sum(mat[2]) < 1e-6:
-            normal_plurity = True
-        try:
-            mat.invert()
-        except:
-            if sum(mat[0]) == 0:
-                normal = mathutils.Vector((1.0, 0.0, 0.0))
-            elif sum(mat[1]) == 0:
-                normal = mathutils.Vector((0.0, 1.0, 0.0))
-            elif sum(mat[2]) == 0:
-                normal = mathutils.Vector((0.0, 0.0, 1.0))
-        if not normal:
-            # warning! this is different from .normalize()
-            itermax = 500
-            iter = 0
-            vec = mathutils.Vector((1.0, 1.0, 1.0))
-            vec2 = (mat * vec)/(mat * vec).length
-            while vec != vec2 and iter<itermax:
-                iter+=1
-                vec = vec2
-                vec2 = mat * vec
-                if vec2.length != 0:
-                    vec2 /= vec2.length
-            if vec2.length == 0:
-                vec2 = mathutils.Vector((1.0, 1.0, 1.0))
-            normal = vec2
-        normals.append(normal)
-    # have plane normals face in the same direction (maximum angle: 90 degrees)
-    if ((center1 + normals[0]) - center2).length < \
-    ((center1 - normals[0]) - center2).length:
-        normals[0].negate()
-    if ((center2 + normals[1]) - center1).length > \
-    ((center2 - normals[1]) - center1).length:
-        normals[1].negate()
-    
-    # rotation matrix, representing the difference between the plane normals
-    axis = normals[0].cross(normals[1])
-    axis = mathutils.Vector([loc if abs(loc) > 1e-8 else 0 for loc in axis])
-    if axis.angle(mathutils.Vector((0, 0, 1)), 0) > 1.5707964:
-        axis.negate()
-    angle = normals[0].dot(normals[1])
-    rotation_matrix = mathutils.Matrix.Rotation(angle, 4, axis)
-    
-    # if circular, rotate loops so they are aligned
-    if circular:
-        # make sure loop1 is the circular one (or both are circular)
-        if loop2_circular and not loop1_circular:
-            loop1_circular, loop2_circular = True, False
-            loop1, loop2 = loop2, loop1
-        
-        # match start vertex of loop1 with loop2
-        target_vector = mesh.vertices[loop2[0]].co - center2
-        dif_angles = [[(rotation_matrix * (mesh.vertices[vertex].co - center1)
-                       ).angle(target_vector, 0), False, i] for
-                       i, vertex in enumerate(loop1)]
-        dif_angles.sort()
-        if len(loop1) != len(loop2):
-            angle_limit = dif_angles[0][0] * 1.2 # 20% margin
-            dif_angles = [[(mesh.vertices[loop2[0]].co - \
-                mesh.vertices[loop1[index]].co).length, angle, index] for \
-                angle, distance, index in dif_angles if angle <= angle_limit]
-            dif_angles.sort()
-        loop1 = loop1[dif_angles[0][2]:] + loop1[:dif_angles[0][2]]
-    
-    # have both loops face the same way
-    if normal_plurity and not circular:
-        second_to_first, second_to_second, second_to_last = \
-            [(mesh.vertices[loop1[1]].co - center1).\
-            angle(mesh.vertices[loop2[i]].co - center2) for i in [0, 1, -1]]
-        last_to_first, last_to_second = [(mesh.vertices[loop1[-1]].co - \
-            center1).angle(mesh.vertices[loop2[i]].co - center2) for \
-            i in [0, 1]]
-        if (min(last_to_first, last_to_second)*1.1 < min(second_to_first, \
-        second_to_second)) or (loop2_circular and second_to_last*1.1 < \
-        min(second_to_first, second_to_second)):
-            loop1.reverse()
-            if circular:
-                loop1 = [loop1[-1]] + loop1[:-1]
-    else:
-        angle = (mesh.vertices[loop1[0]].co - center1).\
-            cross(mesh.vertices[loop1[1]].co - center1).angle(normals[0], 0)
-        target_angle = (mesh.vertices[loop2[0]].co - center2).\
-            cross(mesh.vertices[loop2[1]].co - center2).angle(normals[1], 0)
-        limit = 1.5707964 # 0.5*pi, 90 degrees
-        if not ((angle > limit and target_angle > limit) or \
-        (angle < limit and target_angle < limit)):
-            loop1.reverse()
-            if circular:
-                loop1 = [loop1[-1]] + loop1[:-1]
-        elif normals[0].angle(normals[1]) > limit:
-            loop1.reverse()
-            if circular:
-                loop1 = [loop1[-1]] + loop1[:-1]
-    
-    # both loops have the same length
-    if len(loop1) == len(loop2):
-        # manual override
-        if twist:
-            if abs(twist) < len(loop1):
-                loop1 = loop1[twist:]+loop1[:twist]
-        if reverse:
-            loop1.reverse()
-        
-        lines.append([loop1[0], loop2[0]])
-        for i in range(1, len(loop1)):
-            lines.append([loop1[i], loop2[i]])
-    
-    # loops of different lengths
-    else:
-        # make loop1 longest loop
-        if len(loop2) > len(loop1):
-            loop1, loop2 = loop2, loop1
-            loop1_circular, loop2_circular = loop2_circular, loop1_circular
-        
-        # manual override
-        if twist:
-            if abs(twist) < len(loop1):
-                loop1 = loop1[twist:]+loop1[:twist]
-        if reverse:
-            loop1.reverse()
-            
-        # shortest angle difference doesn't always give correct start vertex
-        if loop1_circular and not loop2_circular:
-            shifting = 1
-            while shifting:
-                if len(loop1) - shifting < len(loop2):
-                    shifting = False
-                    break
-                to_last, to_first = [(rotation_matrix *
-                    (mesh.vertices[loop1[-1]].co - center1)).angle((mesh.\
-                    vertices[loop2[i]].co - center2), 0) for i in [-1, 0]]
-                if to_first < to_last:
-                    loop1 = [loop1[-1]] + loop1[:-1]
-                    shifting += 1
-                else:
-                    shifting = False
-                    break
-        
-        # basic shortest side first
-        if mode == 'basic':
-            lines.append([loop1[0], loop2[0]])
-            for i in range(1, len(loop1)):
-                if i >= len(loop2) - 1:
-                    # triangles
-                    lines.append([loop1[i], loop2[-1]])
-                else:
-                    # quads
-                    lines.append([loop1[i], loop2[i]])
-        
-        # shortest edge algorithm
-        else: # mode == 'shortest'
-            lines.append([loop1[0], loop2[0]])
-            prev_vert2 = 0
-            for i in range(len(loop1) -1):
-                if prev_vert2 == len(loop2) - 1 and not loop2_circular:
-                    # force triangles, reached end of loop2
-                    tri, quad = 0, 1
-                elif prev_vert2 == len(loop2) - 1 and loop2_circular:
-                    # at end of loop2, but circular, so check with first vert
-                    tri, quad = [(mesh.vertices[loop1[i+1]].co -
-                                  mesh.vertices[loop2[j]].co).length
-                                 for j in [prev_vert2, 0]]
-
-                    circle_full = 2
-                elif len(loop1) - 1 - i == len(loop2) - 1 - prev_vert2 and \
-                not circle_full:
-                    # force quads, otherwise won't make it to end of loop2
-                    tri, quad = 1, 0
-                else:
-                    # calculate if tri or quad gives shortest edge
-                    tri, quad = [(mesh.vertices[loop1[i+1]].co -
-                                  mesh.vertices[loop2[j]].co).length
-                                 for j in range(prev_vert2, prev_vert2+2)]
-                
-                # triangle
-                if tri < quad:
-                    lines.append([loop1[i+1], loop2[prev_vert2]])
-                    if circle_full == 2:
-                        circle_full = False
-                # quad
-                elif not circle_full:
-                    lines.append([loop1[i+1], loop2[prev_vert2+1]])
-                    prev_vert2 += 1
-                # quad to first vertex of loop2
-                else:
-                    lines.append([loop1[i+1], loop2[0]])
-                    prev_vert2 = 0
-                    circle_full = True
-    
-    # final face for circular loops
-    if loop1_circular and loop2_circular:
-        lines.append([loop1[0], loop2[0]])
-    
-    return(lines)
-
-
-# calculate number of segments needed
-def bridge_calculate_segments(mesh, lines, loops, segments):
-    # return if amount of segments is set by user
-    if segments != 0:
-        return segments
-    
-    # edge lengths
-    average_edge_length = [(mesh.vertices[vertex].co - \
-        mesh.vertices[loop[0][i+1]].co).length for loop in loops for \
-        i, vertex in enumerate(loop[0][:-1])]
-    # closing edges of circular loops
-    average_edge_length += [(mesh.vertices[loop[0][-1]].co - \
-        mesh.vertices[loop[0][0]].co).length for loop in loops if loop[1]] 
-    
-    # average lengths
-    average_edge_length = sum(average_edge_length) / len(average_edge_length)
-    average_bridge_length = sum([(mesh.vertices[v1].co - \
-        mesh.vertices[v2].co).length for v1, v2 in lines]) / len(lines)
-    
-    segments = max(1, round(average_bridge_length / average_edge_length))
-        
-    return(segments)
-
-
-# return dictionary with vertex index as key, and the normal vector as value
-def bridge_calculate_virtual_vertex_normals(mesh, lines, loops, edge_faces,
-edgekey_to_edge):
-    if not edge_faces: # interpolation isn't set to cubic
-        return False
-    
-    # pity reduce() isn't one of the basic functions in python anymore
-    def average_vector_dictionary(dic):
-        for key, vectors in dic.items():
-            #if type(vectors) == type([]) and len(vectors) > 1:
-            if len(vectors) > 1:
-                average = mathutils.Vector()
-                for vector in vectors:
-                    average += vector
-                average /= len(vectors)
-                dic[key] = [average]
-        return dic
-    
-    # get all edges of the loop
-    edges = [[edgekey_to_edge[tuple(sorted([loops[j][0][i],
-        loops[j][0][i+1]]))] for i in range(len(loops[j][0])-1)] for \
-        j in [0,1]]
-    edges = edges[0] + edges[1]
-    for j in [0, 1]:
-        if loops[j][1]: # circular
-            edges.append(edgekey_to_edge[tuple(sorted([loops[j][0][0],
-                loops[j][0][-1]]))])
-    
-    """
-    calculation based on face topology (assign edge-normals to vertices)
-    
-    edge_normal = face_normal x edge_vector
-    vertex_normal = average(edge_normals)
-    """
-    vertex_normals = dict([(vertex, []) for vertex in loops[0][0]+loops[1][0]])
-    for edge in edges:
-        faces = edge_faces[edge.key] # valid faces connected to edge
-        
-        if faces:
-            # get edge coordinates
-            v1, v2 = [mesh.vertices[edge.key[i]].co for i in [0,1]]
-            edge_vector = v1 - v2
-            if edge_vector.length < 1e-4:
-                # zero-length edge, vertices at same location
-                continue
-            edge_center = (v1 + v2) / 2
-            
-            # average face coordinates, if connected to more than 1 valid face
-            if len(faces) > 1:
-                face_normal = mathutils.Vector()
-                face_center = mathutils.Vector()
-                for face in faces:
-                    face_normal += face.normal
-                    face_center += face.center
-                face_normal /= len(faces)
-                face_center /= len(faces)
-            else:
-                face_normal = faces[0].normal
-                face_center = faces[0].center
-            if face_normal.length < 1e-4:
-                # faces with a surface of 0 have no face normal
-                continue
-            
-            # calculate virtual edge normal
-            edge_normal = edge_vector.cross(face_normal)
-            edge_normal.length = 0.01
-            if (face_center - (edge_center + edge_normal)).length > \
-            (face_center - (edge_center - edge_normal)).length:
-                # make normal face the correct way
-                edge_normal.negate()
-            edge_normal.normalize()
-            # add virtual edge normal as entry for both vertices it connects
-            for vertex in edge.key:
-                vertex_normals[vertex].append(edge_normal)
-    
-    """ 
-    calculation based on connection with other loop (vertex focused method) 
-    - used for vertices that aren't connected to any valid faces
-    
-    plane_normal = edge_vector x connection_vector
-    vertex_normal = plane_normal x edge_vector
-    """
-    vertices = [vertex for vertex, normal in vertex_normals.items() if not \
-        normal]
-    
-    if vertices:
-        # edge vectors connected to vertices
-        edge_vectors = dict([[vertex, []] for vertex in vertices])
-        for edge in edges:
-            for v in edge.key:
-                if v in edge_vectors:
-                    edge_vector = mesh.vertices[edge.key[0]].co - \
-                        mesh.vertices[edge.key[1]].co
-                    if edge_vector.length < 1e-4:
-                        # zero-length edge, vertices at same location
-                        continue
-                    edge_vectors[v].append(edge_vector)
-    
-        # connection vectors between vertices of both loops
-        connection_vectors = dict([[vertex, []] for vertex in vertices])
-        connections = dict([[vertex, []] for vertex in vertices])
-        for v1, v2 in lines:
-            if v1 in connection_vectors or v2 in connection_vectors:
-                new_vector = mesh.vertices[v1].co - mesh.vertices[v2].co
-                if new_vector.length < 1e-4:
-                    # zero-length connection vector,
-                    # vertices in different loops at same location
-                    continue
-                if v1 in connection_vectors:
-                    connection_vectors[v1].append(new_vector)
-                    connections[v1].append(v2)
-                if v2 in connection_vectors:
-                    connection_vectors[v2].append(new_vector)
-                    connections[v2].append(v1)
-        connection_vectors = average_vector_dictionary(connection_vectors)
-        connection_vectors = dict([[vertex, vector[0]] if vector else \
-            [vertex, []] for vertex, vector in connection_vectors.items()])
-        
-        for vertex, values in edge_vectors.items():
-            # vertex normal doesn't matter, just assign a random vector to it
-            if not connection_vectors[vertex]:
-                vertex_normals[vertex] = [mathutils.Vector((1, 0, 0))]
-                continue
-            
-            # calculate to what location the vertex is connected, 
-            # used to determine what way to flip the normal
-            connected_center = mathutils.Vector()
-            for v in connections[vertex]:
-                connected_center += mesh.vertices[v].co
-            if len(connections[vertex]) > 1:
-                connected_center /= len(connections[vertex])
-            if len(connections[vertex]) == 0:
-                # shouldn't be possible, but better safe than sorry
-                vertex_normals[vertex] = [mathutils.Vector((1, 0, 0))]
-                continue
-            
-            # can't do proper calculations, because of zero-length vector
-            if not values:
-                if (connected_center - (mesh.vertices[vertex].co + \
-                connection_vectors[vertex])).length < (connected_center - \
-                (mesh.vertices[vertex].co - connection_vectors[vertex])).\
-                length:
-                    connection_vectors[vertex].negate()
-                vertex_normals[vertex] = [connection_vectors[vertex].\
-                    normalized()]
-                continue
-            
-            # calculate vertex normals using edge-vectors,
-            # connection-vectors and the derived plane normal
-            for edge_vector in values:
-                plane_normal = edge_vector.cross(connection_vectors[vertex])
-                vertex_normal = edge_vector.cross(plane_normal)
-                vertex_normal.length = 0.1
-                if (connected_center - (mesh.vertices[vertex].co + \
-                vertex_normal)).length < (connected_center - \
-                (mesh.vertices[vertex].co - vertex_normal)).length:
-                # make normal face the correct way
-                    vertex_normal.negate()
-                vertex_normal.normalize()
-                vertex_normals[vertex].append(vertex_normal)
-    
-    # average virtual vertex normals, based on all edges it's connected to
-    vertex_normals = average_vector_dictionary(vertex_normals)
-    vertex_normals = dict([[vertex, vector[0]] for vertex, vector in \
-        vertex_normals.items()])
-    
-    return(vertex_normals)
-
-
-# add vertices to mesh
-def bridge_create_vertices(mesh, vertices):
-    start_index = len(mesh.vertices)
-    mesh.vertices.add(len(vertices))
-    for i in range(len(vertices)):
-        mesh.vertices[start_index + i].co = vertices[i]
-
-
-# add faces to mesh
-def bridge_create_faces(mesh, faces, twist):
-    # have the normal point the correct way
-    if twist < 0:
-        [face.reverse() for face in faces]
-        faces = [face[2:]+face[:2] if face[0]==face[1] else face for \
-            face in faces]
-    
-    # eekadoodle prevention
-    for i in range(len(faces)):
-        if not faces[i][-1]:
-            if faces[i][0] == faces[i][-1]:
-                faces[i] = [faces[i][1], faces[i][2], faces[i][3], faces[i][1]]
-            else:
-                faces[i] = [faces[i][-1]] + faces[i][:-1]
-    
-    start_faces = len(mesh.faces)
-    mesh.faces.add(len(faces))
-    for i in range(len(faces)):
-        mesh.faces[start_faces + i].vertices_raw = faces[i]
-    mesh.update(calc_edges = True) # calc_edges prevents memory-corruption
-
-
-# calculate input loops
-def bridge_get_input(mesh):
-    # create list of internal edges, which should be skipped
-    eks_of_selected_faces = [item for sublist in [face.edge_keys for face \
-        in mesh.faces if face.select and not face.hide] for item in sublist]
-    edge_count = {}
-    for ek in eks_of_selected_faces:
-        if ek in edge_count:
-            edge_count[ek] += 1
-        else:
-            edge_count[ek] = 1
-    internal_edges = [ek for ek in edge_count if edge_count[ek] > 1]
-    
-    # sort correct edges into loops
-    selected_edges = [edge.key for edge in mesh.edges if edge.select \
-        and not edge.hide and edge.key not in internal_edges]
-    loops = get_connected_selections(selected_edges)
-    
-    return(loops)
-
-
-# return values needed by the bridge operator
-def bridge_initialise(mesh, interpolation):
-    if interpolation == 'cubic':
-        # dict with edge-key as key and list of connected valid faces as value
-        face_blacklist = [face.index for face in mesh.faces if face.select or \
-            face.hide]
-        edge_faces = dict([[edge.key, []] for edge in mesh.edges if not \
-            edge.hide])
-        for face in mesh.faces:
-            if face.index in face_blacklist:
-                continue
-            for key in face.edge_keys:
-                edge_faces[key].append(face)
-        # dictionary with the edge-key as key and edge as value
-        edgekey_to_edge = dict([[edge.key, edge] for edge in mesh.edges if \
-            edge.select and not edge.hide])
-    else:
-        edge_faces = False
-        edgekey_to_edge = False
-    
-    # selected faces input
-    old_selected_faces = [face.index for face in mesh.faces if face.select \
-        and not face.hide]
-    
-    # find out if faces created by bridging should be smoothed
-    smooth = False
-    if mesh.faces:
-        if sum([face.use_smooth for face in mesh.faces])/len(mesh.faces) \
-        >= 0.5:
-            smooth = True
-    
-    return(edge_faces, edgekey_to_edge, old_selected_faces, smooth)
-
-
-# return a string with the input method
-def bridge_input_method(loft, loft_loop):
-    method = ""
-    if loft:
-        if loft_loop:
-            method = "Loft loop"
-        else:
-            method = "Loft no-loop"
-    else:
-        method = "Bridge"
-    
-    return(method)
-
-
-# match up loops in pairs, used for multi-input bridging
-def bridge_match_loops(mesh, loops):
-    # calculate average loop normals and centers
-    normals = []
-    centers = []
-    for vertices, circular in loops:
-        normal = mathutils.Vector()
-        center = mathutils.Vector()
-        for vertex in vertices:
-            normal += mesh.vertices[vertex].normal
-            center += mesh.vertices[vertex].co
-        normals.append(normal / len(vertices) / 10)
-        centers.append(center / len(vertices))
-    
-    # possible matches if loop normals are faced towards the center
-    # of the other loop
-    matches = dict([[i, []] for i in range(len(loops))])
-    matches_amount = 0
-    for i in range(len(loops) + 1):
-        for j in range(i+1, len(loops)):
-            if (centers[i] - centers[j]).length > (centers[i] - (centers[j] \
-            + normals[j])).length and (centers[j] - centers[i]).length > \
-            (centers[j] - (centers[i] + normals[i])).length:
-                matches_amount += 1
-                matches[i].append([(centers[i] - centers[j]).length, i, j])
-                matches[j].append([(centers[i] - centers[j]).length, j, i])
-    # if no loops face each other, just make matches between all the loops
-    if matches_amount == 0:
-        for i in range(len(loops) + 1):
-            for j in range(i+1, len(loops)):
-                matches[i].append([(centers[i] - centers[j]).length, i, j])
-                matches[j].append([(centers[i] - centers[j]).length, j, i])
-    for key, value in matches.items():
-        value.sort()
-    
-    # matches based on distance between centers and number of vertices in loops
-    new_order = []
-    for loop_index in range(len(loops)):
-        if loop_index in new_order:
-            continue
-        loop_matches = matches[loop_index]
-        if not loop_matches:
-            continue
-        shortest_distance = loop_matches[0][0]
-        shortest_distance *= 1.1
-        loop_matches = [[abs(len(loops[loop_index][0]) - \
-            len(loops[loop[2]][0])), loop[0], loop[1], loop[2]] for loop in \
-            loop_matches if loop[0] < shortest_distance]
-        loop_matches.sort()
-        for match in loop_matches:
-            if match[3] not in new_order:
-                new_order += [loop_index, match[3]]
-                break
-    
-    # reorder loops based on matches
-    if len(new_order) >= 2:
-        loops = [loops[i] for i in new_order]
-    
-    return(loops)
-
-
-# have normals of selection face outside
-def bridge_recalculate_normals():
-    bpy.ops.object.mode_set(mode = 'EDIT')
-    bpy.ops.mesh.normals_make_consistent()
-
-
-# remove old_selected_faces
-def bridge_remove_internal_faces(mesh, old_selected_faces):
-    select_mode = [i for i in bpy.context.tool_settings.mesh_select_mode]
-    bpy.context.tool_settings.mesh_select_mode = [False, False, True]
-    
-    # hack to keep track of the current selection
-    for edge in mesh.edges:
-        if edge.select and not edge.hide:
-            edge.bevel_weight = (edge.bevel_weight/3) + 0.2
-        else:
-            edge.bevel_weight = (edge.bevel_weight/3) + 0.6
-    
-    # remove faces
-    bpy.ops.object.mode_set(mode = 'EDIT')
-    bpy.ops.mesh.select_all(action = 'DESELECT')
-    bpy.ops.object.mode_set(mode = 'OBJECT')
-    for face in old_selected_faces:
-        mesh.faces[face].select = True
-    bpy.ops.object.mode_set(mode = 'EDIT')
-    bpy.ops.mesh.delete(type = 'FACE')
-    
-    # restore old selection, using hack
-    bpy.ops.object.mode_set(mode = 'OBJECT')
-    bpy.context.tool_settings.mesh_select_mode = [False, True, False]
-    for edge in mesh.edges:
-        if edge.bevel_weight < 0.6:
-            edge.bevel_weight = (edge.bevel_weight-0.2) * 3
-            edge.select = True
-        else:
-            edge.bevel_weight = (edge.bevel_weight-0.6) * 3
-    bpy.ops.object.mode_set(mode = 'EDIT')
-    bpy.ops.object.mode_set(mode = 'OBJECT')
-    bpy.context.tool_settings.mesh_select_mode = select_mode
-
-
-# update list of internal faces that are flagged for removal
-def bridge_save_unused_faces(mesh, old_selected_faces, loops):
-    # key: vertex index, value: lists of selected faces using it
-    vertex_to_face = dict([[i, []] for i in range(len(mesh.vertices))])
-    [[vertex_to_face[vertex_index].append(face) for vertex_index in \
-        mesh.faces[face].vertices] for face in old_selected_faces]
-    
-    # group selected faces that are connected
-    groups = []
-    grouped_faces = []
-    for face in old_selected_faces:
-        if face in grouped_faces:
-            continue
-        grouped_faces.append(face)
-        group = [face]
-        new_faces = [face]
-        while new_faces:
-            grow_face = new_faces[0]
-            for vertex in mesh.faces[grow_face].vertices:
-                vertex_face_group = [face for face in vertex_to_face[vertex] \
-                    if face not in grouped_faces]
-                new_faces += vertex_face_group
-                grouped_faces += vertex_face_group
-                group += vertex_face_group
-            new_faces.pop(0)
-        groups.append(group)
-    
-    # key: vertex index, value: True/False (is it in a loop that is used)
-    used_vertices = dict([[i, 0] for i in range(len(mesh.vertices))])
-    for loop in loops:
-        for vertex in loop[0]:
-            used_vertices[vertex] = True
-    
-    # check if group is bridged, if not remove faces from internal faces list
-    for group in groups:
-        used = False
-        for face in group:
-            if used:
-                break
-            for vertex in mesh.faces[face].vertices:
-                if used_vertices[vertex]:
-                    used = True
-                    break
-        if not used:
-            for face in group:
-                old_selected_faces.remove(face)
-
-
-# add the newly created faces to the selection
-def bridge_select_new_faces(mesh, amount, smooth):
-    select_mode = [i for i in bpy.context.tool_settings.mesh_select_mode]
-    bpy.context.tool_settings.mesh_select_mode = [False, False, True]
-    for i in range(amount):
-        mesh.faces[-(i+1)].select = True
-        mesh.faces[-(i+1)].use_smooth = smooth
-    bpy.ops.object.mode_set(mode = 'EDIT')
-    bpy.ops.object.mode_set(mode = 'OBJECT')
-    bpy.context.tool_settings.mesh_select_mode = select_mode
-
-
-# sort loops, so they are connected in the correct order when lofting
-def bridge_sort_loops(mesh, loops, loft_loop):
-    # simplify loops to single points, and prepare for pathfinding
-    x, y, z = [[sum([mesh.vertices[i].co[j] for i in loop[0]]) / \
-        len(loop[0]) for loop in loops] for j in range(3)]
-    nodes = [mathutils.Vector((x[i], y[i], z[i])) for i in range(len(loops))]
-    
-    active_node = 0
-    open = [i for i in range(1, len(loops))]
-    path = [[0,0]]
-    # connect node to path, that is shortest to active_node
-    while len(open) > 0:
-        distances = [(nodes[active_node] - nodes[i]).length for i in open]
-        active_node = open[distances.index(min(distances))]
-        open.remove(active_node)
-        path.append([active_node, min(distances)])
-    # check if we didn't start in the middle of the path
-    for i in range(2, len(path)):
-        if (nodes[path[i][0]]-nodes[0]).length < path[i][1]:
-            temp = path[:i]
-            path.reverse()
-            path = path[:-i] + temp
-            break
-    
-    # reorder loops
-    loops = [loops[i[0]] for i in path]
-    # if requested, duplicate first loop at last position, so loft can loop
-    if loft_loop:
-        loops = loops + [loops[0]]
-    
-    return(loops)
-
-
-##########################################
-####### Circle functions #################
-##########################################
-
-# convert 3d coordinates to 2d coordinates on plane
-def circle_3d_to_2d(mesh_mod, loop, com, normal):
-    # project vertices onto the plane
-    verts = [mesh_mod.vertices[v] for v in loop[0]]
-    verts_projected = [[v.co - (v.co - com).dot(normal) * normal, v.index]
-                       for v in verts]
-
-    # calculate two vectors (p and q) along the plane
-    m = mathutils.Vector((normal[0] + 1.0, normal[1], normal[2]))
-    p = m - (m.dot(normal) * normal)
-    if p.dot(p) == 0.0:
-        m = mathutils.Vector((normal[0], normal[1] + 1.0, normal[2]))
-        p = m - (m.dot(normal) * normal)
-    q = p.cross(normal)
-    
-    # change to 2d coordinates using perpendicular projection
-    locs_2d = []
-    for loc, vert in verts_projected:
-        vloc = loc - com
-        x = p.dot(vloc) / p.dot(p)
-        y = q.dot(vloc) / q.dot(q)
-        locs_2d.append([x, y, vert])
-    
-    return(locs_2d, p, q)
-
-
-# calculate a best-fit circle to the 2d locations on the plane
-def circle_calculate_best_fit(locs_2d):
-    # initial guess
-    x0 = 0.0
-    y0 = 0.0
-    r = 1.0
-    
-    # calculate center and radius (non-linear least squares solution)
-    for iter in range(500):
-        jmat = []
-        k = []
-        for v in locs_2d:
-            d = (v[0]**2-2.0*x0*v[0]+v[1]**2-2.0*y0*v[1]+x0**2+y0**2)**0.5
-            jmat.append([(x0-v[0])/d, (y0-v[1])/d, -1.0])
-            k.append(-(((v[0]-x0)**2+(v[1]-y0)**2)**0.5-r))
-        jmat2 = mathutils.Matrix(((0.0, 0.0, 0.0),
-                                  (0.0, 0.0, 0.0),
-                                  (0.0, 0.0, 0.0),
-                                  ))
-        k2 = mathutils.Vector((0.0, 0.0, 0.0))
-        for i in range(len(jmat)):
-            k2 += mathutils.Vector(jmat[i])*k[i]
-            jmat2[0][0] += jmat[i][0]**2
-            jmat2[1][0] += jmat[i][0]*jmat[i][1]
-            jmat2[2][0] += jmat[i][0]*jmat[i][2]
-            jmat2[1][1] += jmat[i][1]**2
-            jmat2[2][1] += jmat[i][1]*jmat[i][2]
-            jmat2[2][2] += jmat[i][2]**2
-        jmat2[0][1] = jmat2[1][0]
-        jmat2[0][2] = jmat2[2][0]
-        jmat2[1][2] = jmat2[2][1]
-        try:
-            jmat2.invert()
-        except:
-            pass
-        dx0, dy0, dr = jmat2 * k2
-        x0 += dx0
-        y0 += dy0
-        r += dr
-        # stop iterating if we're close enough to optimal solution
-        if abs(dx0)<1e-6 and abs(dy0)<1e-6 and abs(dr)<1e-6:
-            break
-    
-    # return center of circle and radius
-    return(x0, y0, r)
-
-
-# calculate circle so no vertices have to be moved away from the center
-def circle_calculate_min_fit(locs_2d):
-    # center of circle
-    x0 = (min([i[0] for i in locs_2d])+max([i[0] for i in locs_2d]))/2.0
-    y0 = (min([i[1] for i in locs_2d])+max([i[1] for i in locs_2d]))/2.0
-    center = mathutils.Vector([x0, y0])
-    # radius of circle
-    r = min([(mathutils.Vector([i[0], i[1]])-center).length for i in locs_2d])
-    
-    # return center of circle and radius
-    return(x0, y0, r)
-
-
-# calculate the new locations of the vertices that need to be moved
-def circle_calculate_verts(flatten, mesh_mod, locs_2d, com, p, q, normal):
-    # changing 2d coordinates back to 3d coordinates
-    locs_3d = []
-    for loc in locs_2d:
-        locs_3d.append([loc[2], loc[0]*p + loc[1]*q + com])
-    
-    if flatten: # flat circle
-        return(locs_3d)
-    
-    else: # project the locations on the existing mesh
-        vert_edges = dict_vert_edges(mesh_mod)
-        vert_faces = dict_vert_faces(mesh_mod)
-        faces = [f for f in mesh_mod.faces if not f.hide]
-        rays = [normal, -normal]
-        new_locs = []
-        for loc in locs_3d:
-            projection = False
-            if mesh_mod.vertices[loc[0]].co == loc[1]: # vertex hasn't moved
-                projection = loc[1]
-            else:
-                dif = normal.angle(loc[1]-mesh_mod.vertices[loc[0]].co)
-                if -1e-6 < dif < 1e-6 or math.pi-1e-6 < dif < math.pi+1e-6:
-                    # original location is already along projection normal
-                    projection = mesh_mod.vertices[loc[0]].co
-                else:
-                    # quick search through adjacent faces
-                    for face in vert_faces[loc[0]]:
-                        verts = [mesh_mod.vertices[v].co for v in \
-                            mesh_mod.faces[face].vertices]
-                        if len(verts) == 3: # triangle
-                            v1, v2, v3 = verts
-                            v4 = False
-                        else: # quad
-                            v1, v2, v3, v4 = verts
-                        for ray in rays:
-                            intersect = mathutils.geometry.\
-                            intersect_ray_tri(v1, v2, v3, ray, loc[1])
-                            if intersect:
-                                projection = intersect
-                                break
-                            elif v4:
-                                intersect = mathutils.geometry.\
-                                intersect_ray_tri(v1, v3, v4, ray, loc[1])
-                                if intersect:
-                                    projection = intersect
-                                    break
-                        if projection:
-                            break
-            if not projection:
-                # check if projection is on adjacent edges
-                for edgekey in vert_edges[loc[0]]:
-                    line1 = mesh_mod.vertices[edgekey[0]].co
-                    line2 = mesh_mod.vertices[edgekey[1]].co
-                    intersect, dist = mathutils.geometry.intersect_point_line(\
-                        loc[1], line1, line2)
-                    if 1e-6 < dist < 1 - 1e-6:
-                        projection = intersect
-                        break
-            if not projection:
-                # full search through the entire mesh
-                hits = []
-                for face in faces:
-                    verts = [mesh_mod.vertices[v].co for v in face.vertices]
-                    if len(verts) == 3: # triangle
-                        v1, v2, v3 = verts
-                        v4 = False
-                    else: # quad
-                        v1, v2, v3, v4 = verts
-                    for ray in rays:
-                        intersect = mathutils.geometry.intersect_ray_tri(\
-                            v1, v2, v3, ray, loc[1])
-                        if intersect:
-                            hits.append([(loc[1] - intersect).length,
-                                intersect])
-                            break
-                        elif v4:
-                            intersect = mathutils.geometry.intersect_ray_tri(\
-                                v1, v3, v4, ray, loc[1])
-                            if intersect:
-                                hits.append([(loc[1] - intersect).length,
-                                    intersect])
-                                break
-                if len(hits) >= 1:
-                    # if more than 1 hit with mesh, closest hit is new loc
-                    hits.sort()
-                    projection = hits[0][1]
-            if not projection:
-                # nothing to project on, remain at flat location
-                projection = loc[1]
-            new_locs.append([loc[0], projection])
-        
-        # return new positions of projected circle
-        return(new_locs)
-
-
-# check loops and only return valid ones
-def circle_check_loops(single_loops, loops, mapping, mesh_mod):
-    valid_single_loops = {}
-    valid_loops = []
-    for i, [loop, circular] in enumerate(loops):
-        # loop needs to have at least 3 vertices
-        if len(loop) < 3:
-            continue
-        # loop needs at least 1 vertex in the original, non-mirrored mesh
-        if mapping:
-            all_virtual = True
-            for vert in loop:
-                if mapping[vert] > -1:
-                    all_virtual = False
-                    break
-            if all_virtual:
-                continue
-        # loop has to be non-collinear
-        collinear = True
-        loc0 = mathutils.Vector(mesh_mod.vertices[loop[0]].co[:])
-        loc1 = mathutils.Vector(mesh_mod.vertices[loop[1]].co[:])
-        for v in loop[2:]:
-            locn = mathutils.Vector(mesh_mod.vertices[v].co[:])
-            if loc0 == loc1 or loc1 == locn:
-                loc0 = loc1
-                loc1 = locn
-                continue
-            d1 = loc1-loc0
-            d2 = locn-loc1
-            if -1e-6 < d1.angle(d2, 0) < 1e-6:
-                loc0 = loc1
-                loc1 = locn
-                continue
-            collinear = False
-            break
-        if collinear:
-            continue
-        # passed all tests, loop is valid
-        valid_loops.append([loop, circular])
-        valid_single_loops[len(valid_loops)-1] = single_loops[i]
-    
-    return(valid_single_loops, valid_loops)
-
-
-# calculate the location of single input vertices that need to be flattened
-def circle_flatten_singles(mesh_mod, com, p, q, normal, single_loop):
-    new_locs = []
-    for vert in single_loop:
-        loc = mathutils.Vector(mesh_mod.vertices[vert].co[:])
-        new_locs.append([vert,  loc - (loc-com).dot(normal)*normal])
-    
-    return(new_locs)
-
-
-# calculate input loops
-def circle_get_input(object, mesh, scene):
-    # get mesh with modifiers applied
-    derived, mesh_mod = get_derived_mesh(object, mesh, scene)
-    
-    # create list of edge-keys based on selection state
-    faces = False
-    for face in mesh.faces:
-        if face.select and not face.hide:
-            faces = True
-            break
-    if faces:
-        # get selected, non-hidden , non-internal edge-keys
-        eks_selected = [key for keys in [face.edge_keys for face in \
-            mesh_mod.faces if face.select and not face.hide] for key in keys]
-        edge_count = {}
-        for ek in eks_selected:
-            if ek in edge_count:
-                edge_count[ek] += 1
-            else:
-                edge_count[ek] = 1
-        edge_keys = [edge.key for edge in mesh_mod.edges if edge.select \
-            and not edge.hide and edge_count.get(edge.key, 1)==1]
-    else:
-        # no faces, so no internal edges either
-        edge_keys = [edge.key for edge in mesh_mod.edges if edge.select \
-            and not edge.hide]
-    
-    # add edge-keys around single vertices
-    verts_connected = dict([[vert, 1] for edge in [edge for edge in \
-        mesh_mod.edges if edge.select and not edge.hide] for vert in edge.key])
-    single_vertices = [vert.index for vert in mesh_mod.vertices if \
-        vert.select and not vert.hide and not \
-        verts_connected.get(vert.index, False)]
-    
-    if single_vertices and len(mesh.faces)>0:
-        vert_to_single = dict([[v.index, []] for v in mesh_mod.vertices \
-            if not v.hide])
-        for face in [face for face in mesh_mod.faces if not face.select \
-        and not face.hide]:
-            for vert in face.vertices:
-                if vert in single_vertices:
-                    for ek in face.edge_keys:
-                        if not vert in ek:
-                            edge_keys.append(ek)
-                            if vert not in vert_to_single[ek[0]]:
-                                vert_to_single[ek[0]].append(vert)
-                            if vert not in vert_to_single[ek[1]]:
-                                vert_to_single[ek[1]].append(vert)
-                    break
-    
-    # sort edge-keys into loops
-    loops = get_connected_selections(edge_keys)
-    
-    # find out to which loops the single vertices belong
-    single_loops = dict([[i, []] for i in range(len(loops))])
-    if single_vertices and len(mesh.faces)>0:
-        for i, [loop, circular] in enumerate(loops):
-            for vert in loop:
-                if vert_to_single[vert]:
-                    for single in vert_to_single[vert]:
-                        if single not in single_loops[i]:
-                            single_loops[i].append(single)
-    
-    return(derived, mesh_mod, single_vertices, single_loops, loops)
-
-
-# recalculate positions based on the influence of the circle shape
-def circle_influence_locs(locs_2d, new_locs_2d, influence):
-    for i in range(len(locs_2d)):
-        oldx, oldy, j = locs_2d[i]
-        newx, newy, k = new_locs_2d[i]
-        altx = newx*(influence/100)+ oldx*((100-influence)/100)
-        alty = newy*(influence/100)+ oldy*((100-influence)/100)
-        locs_2d[i] = [altx, alty, j]
-    
-    return(locs_2d)
-
-
-# project 2d locations on circle, respecting distance relations between verts
-def circle_project_non_regular(locs_2d, x0, y0, r):
-    for i in range(len(locs_2d)):
-        x, y, j = locs_2d[i]
-        loc = mathutils.Vector([x-x0, y-y0])
-        loc.length = r
-        locs_2d[i] = [loc[0], loc[1], j]
-    
-    return(locs_2d)
-
-
-# project 2d locations on circle, with equal distance between all vertices
-def circle_project_regular(locs_2d, x0, y0, r):
-    # find offset angle and circling direction
-    x, y, i = locs_2d[0]
-    loc = mathutils.Vector([x-x0, y-y0])
-    loc.length = r
-    offset_angle = loc.angle(mathutils.Vector([1.0, 0.0]), 0.0)
-    loca = mathutils.Vector([x-x0, y-y0, 0.0])
-    if loc[1] < -1e-6:
-        offset_angle *= -1
-    x, y, j = locs_2d[1]
-    locb = mathutils.Vector([x-x0, y-y0, 0.0])
-    if loca.cross(locb)[2] >= 0:
-        ccw = 1
-    else:
-        ccw = -1
-    # distribute vertices along the circle
-    for i in range(len(locs_2d)):
-        t = offset_angle + ccw * (i / len(locs_2d) * 2 * math.pi)
-        x = math.cos(t) * r
-        y = math.sin(t) * r
-        locs_2d[i] = [x, y, locs_2d[i][2]]
-    
-    return(locs_2d)
-
-
-# shift loop, so the first vertex is closest to the center
-def circle_shift_loop(mesh_mod, loop, com):
-    verts, circular = loop
-    distances = [[(mesh_mod.vertices[vert].co - com).length, i] \
-        for i, vert in enumerate(verts)]
-    distances.sort()
-    shift = distances[0][1]
-    loop = [verts[shift:] + verts[:shift], circular]
-    
-    return(loop)
-
-
-##########################################
-####### Curve functions ##################
-##########################################
-
-# create lists with knots and points, all correctly sorted
-def curve_calculate_knots(loop, verts_selected):
-    knots = [v for v in loop[0] if v in verts_selected]
-    points = loop[0][:]
-    # circular loop, potential for weird splines
-    if loop[1]:
-        offset = int(len(loop[0]) / 4)
-        kpos = []
-        for k in knots:
-            kpos.append(loop[0].index(k))
-        kdif = []
-        for i in range(len(kpos) - 1):
-            kdif.append(kpos[i+1] - kpos[i])
-        kdif.append(len(loop[0]) - kpos[-1] + kpos[0])
-        kadd = []
-        for k in kdif:
-            if k > 2 * offset:
-                kadd.append([kdif.index(k), True])
-            # next 2 lines are optional, they insert
-            # an extra control point in small gaps
-            #elif k > offset:
-            #   kadd.append([kdif.index(k), False])
-        kins = []
-        krot = False
-        for k in kadd: # extra knots to be added
-            if k[1]: # big gap (break circular spline)
-                kpos = loop[0].index(knots[k[0]]) + offset
-                if kpos > len(loop[0]) - 1:
-                    kpos -= len(loop[0])
-                kins.append([knots[k[0]], loop[0][kpos]])
-                kpos2 = k[0] + 1
-                if kpos2 > len(knots)-1:
-                    kpos2 -= len(knots)
-                kpos2 = loop[0].index(knots[kpos2]) - offset
-                if kpos2 < 0:
-                    kpos2 += len(loop[0])
-                kins.append([loop[0][kpos], loop[0][kpos2]])
-                krot = loop[0][kpos2]
-            else: # small gap (keep circular spline)
-                k1 = loop[0].index(knots[k[0]])
-                k2 = k[0] + 1
-                if k2 > len(knots)-1:
-                    k2 -= len(knots)
-                k2 = loop[0].index(knots[k2])
-                if k2 < k1:
-                    dif = len(loop[0]) - 1 - k1 + k2
-                else:
-                    dif = k2 - k1
-                kn = k1 + int(dif/2)
-                if kn > len(loop[0]) - 1:
-                    kn -= len(loop[0])
-                kins.append([loop[0][k1], loop[0][kn]])
-        for j in kins: # insert new knots
-            knots.insert(knots.index(j[0]) + 1, j[1])
-        if not krot: # circular loop
-            knots.append(knots[0])
-            points = loop[0][loop[0].index(knots[0]):]
-            points += loop[0][0:loop[0].index(knots[0]) + 1]
-        else: # non-circular loop (broken by script)
-            krot = knots.index(krot)
-            knots = knots[krot:] + knots[0:krot]
-            if loop[0].index(knots[0]) > loop[0].index(knots[-1]):
-                points = loop[0][loop[0].index(knots[0]):]
-                points += loop[0][0:loop[0].index(knots[-1])+1]
-            else:
-                points = loop[0][loop[0].index(knots[0]):\
-                    loop[0].index(knots[-1]) + 1]
-    # non-circular loop, add first and last point as knots
-    else:
-        if loop[0][0] not in knots:
-            knots.insert(0, loop[0][0])
-        if loop[0][-1] not in knots:
-            knots.append(loop[0][-1])
-    
-    return(knots, points)
-
-
-# calculate relative positions compared to first knot
-def curve_calculate_t(mesh_mod, knots, points, pknots, regular, circular):
-    tpoints = []
-    loc_prev = False
-    len_total = 0
-    
-    for p in points:
-        if p in knots:
-            loc = pknots[knots.index(p)] # use projected knot location
-        else:
-            loc = mathutils.Vector(mesh_mod.vertices[p].co[:])
-        if not loc_prev:
-            loc_prev = loc
-        len_total += (loc-loc_prev).length
-        tpoints.append(len_total)
-        loc_prev = loc
-    tknots = []
-    for p in points:
-        if p in knots:
-            tknots.append(tpoints[points.index(p)])
-    if circular:
-        tknots[-1] = tpoints[-1]
-    
-    # regular option
-    if regular:
-        tpoints_average = tpoints[-1] / (len(tpoints) - 1)
-        for i in range(1, len(tpoints) - 1):
-            tpoints[i] = i * tpoints_average
-        for i in range(len(knots)):
-            tknots[i] = tpoints[points.index(knots[i])]
-        if circular:
-            tknots[-1] = tpoints[-1]
-    
-    
-    return(tknots, tpoints)
-
-
-# change the location of non-selected points to their place on the spline
-def curve_calculate_vertices(mesh_mod, knots, tknots, points, tpoints, splines,
-interpolation, restriction):
-    newlocs = {}
-    move = []
-    
-    for p in points:
-        if p in knots:
-            continue
-        m = tpoints[points.index(p)]
-        if m in tknots:
-            n = tknots.index(m)
-        else:
-            t = tknots[:]
-            t.append(m)
-            t.sort()
-            n = t.index(m) - 1
-        if n > len(splines) - 1:
-            n = len(splines) - 1
-        elif n < 0:
-            n = 0
-        
-        if interpolation == 'cubic':
-            ax, bx, cx, dx, tx = splines[n][0]
-            x = ax + bx*(m-tx) + cx*(m-tx)**2 + dx*(m-tx)**3
-            ay, by, cy, dy, ty = splines[n][1]
-            y = ay + by*(m-ty) + cy*(m-ty)**2 + dy*(m-ty)**3
-            az, bz, cz, dz, tz = splines[n][2]
-            z = az + bz*(m-tz) + cz*(m-tz)**2 + dz*(m-tz)**3
-            newloc = mathutils.Vector([x,y,z])
-        else: # interpolation == 'linear'
-            a, d, t, u = splines[n]
-            newloc = ((m-t)/u)*d + a
-
-        if restriction != 'none': # vertex movement is restricted
-            newlocs[p] = newloc
-        else: # set the vertex to its new location
-            move.append([p, newloc])
-        
-    if restriction != 'none': # vertex movement is restricted
-        for p in points:
-            if p in newlocs:
-                newloc = newlocs[p]
-            else:
-                move.append([p, mesh_mod.vertices[p].co])
-                continue
-            oldloc = mesh_mod.vertices[p].co
-            normal = mesh_mod.vertices[p].normal
-            dloc = newloc - oldloc
-            if dloc.length < 1e-6:
-                move.append([p, newloc])
-            elif restriction == 'extrude': # only extrusions
-                if dloc.angle(normal, 0) < 0.5 * math.pi + 1e-6:
-                    move.append([p, newloc])
-            else: # restriction == 'indent' only indentations
-                if dloc.angle(normal) > 0.5 * math.pi - 1e-6:
-                    move.append([p, newloc])
-
-    return(move)
-
-
-# trim loops to part between first and last selected vertices (including)
-def curve_cut_boundaries(mesh_mod, loops):
-    cut_loops = []
-    for loop, circular in loops:
-        if circular:
-            # don't cut
-            cut_loops.append([loop, circular])
-            continue
-        selected = [mesh_mod.vertices[v].select for v in loop]
-        first = selected.index(True)
-        selected.reverse()
-        last = -selected.index(True)
-        if last == 0:
-            cut_loops.append([loop[first:], circular])
-        else:
-            cut_loops.append([loop[first:last], circular])
-    
-    return(cut_loops)
-
-
-# calculate input loops
-def curve_get_input(object, mesh, boundaries, scene):
-    # get mesh with modifiers applied
-    derived, mesh_mod = get_derived_mesh(object, mesh, scene)
-    
-    # vertices that still need a loop to run through it
-    verts_unsorted = [v.index for v in mesh_mod.vertices if \
-        v.select and not v.hide]
-    # necessary dictionaries
-    vert_edges = dict_vert_edges(mesh_mod)
-    edge_faces = dict_edge_faces(mesh_mod)
-    correct_loops = []
-    
-    # find loops through each selected vertex
-    while len(verts_unsorted) > 0:
-        loops = curve_vertex_loops(mesh_mod, verts_unsorted[0], vert_edges,
-            edge_faces)
-        verts_unsorted.pop(0)
-        
-        # check if loop is fully selected
-        search_perpendicular = False
-        i = -1
-        for loop, circular in loops:
-            i += 1
-            selected = [v for v in loop if mesh_mod.vertices[v].select]
-            if len(selected) < 2:
-                # only one selected vertex on loop, don't use
-                loops.pop(i)
-                continue
-            elif len(selected) == len(loop):
-                search_perpendicular = loop
-                break
-        # entire loop is selected, find perpendicular loops
-        if search_perpendicular:
-            for vert in loop:
-                if vert in verts_unsorted:
-                    verts_unsorted.remove(vert)
-            perp_loops = curve_perpendicular_loops(mesh_mod, loop,
-                vert_edges, edge_faces)
-            for perp_loop in perp_loops:
-                correct_loops.append(perp_loop)
-        # normal input
-        else:
-            for loop, circular in loops:
-                correct_loops.append([loop, circular])
-    
-    # boundaries option
-    if boundaries:
-        correct_loops = curve_cut_boundaries(mesh_mod, correct_loops)
-    
-    return(derived, mesh_mod, correct_loops)
-
-
-# return all loops that are perpendicular to the given one
-def curve_perpendicular_loops(mesh_mod, start_loop, vert_edges, edge_faces):
-    # find perpendicular loops
-    perp_loops = []
-    for start_vert in start_loop:
-        loops = curve_vertex_loops(mesh_mod, start_vert, vert_edges,
-            edge_faces)
-        for loop, circular in loops:
-            selected = [v for v in loop if mesh_mod.vertices[v].select]
-            if len(selected) == len(loop):
-                continue
-            else:
-                perp_loops.append([loop, circular, loop.index(start_vert)])
-    
-    # trim loops to same lengths
-    shortest = [[len(loop[0]), i] for i, loop in enumerate(perp_loops)\
-        if not loop[1]]
-    if not shortest:
-        # all loops are circular, not trimming
-        return([[loop[0], loop[1]] for loop in perp_loops])
-    else:
-        shortest = min(shortest)
-    shortest_start = perp_loops[shortest[1]][2]
-    before_start = shortest_start
-    after_start = shortest[0] - shortest_start - 1
-    bigger_before = before_start > after_start
-    trimmed_loops = []
-    for loop in perp_loops:
-        # have the loop face the same direction as the shortest one
-        if bigger_before:
-            if loop[2] < len(loop[0]) / 2:
-                loop[0].reverse()
-                loop[2] = len(loop[0]) - loop[2] - 1
-        else:
-            if loop[2] > len(loop[0]) / 2:
-                loop[0].reverse()
-                loop[2] = len(loop[0]) - loop[2] - 1
-        # circular loops can shift, to prevent wrong trimming
-        if loop[1]:
-            shift = shortest_start - loop[2]
-            if loop[2] + shift > 0 and loop[2] + shift < len(loop[0]):
-                loop[0] = loop[0][-shift:] + loop[0][:-shift]
-            loop[2] += shift
-            if loop[2] < 0:
-                loop[2] += len(loop[0])
-            elif loop[2] > len(loop[0]) -1:
-                loop[2] -= len(loop[0])
-        # trim
-        start = max(0, loop[2] - before_start)
-        end = min(len(loop[0]), loop[2] + after_start + 1)
-        trimmed_loops.append([loop[0][start:end], False])
-    
-    return(trimmed_loops)
-
-
-# project knots on non-selected geometry
-def curve_project_knots(mesh_mod, verts_selected, knots, points, circular):
-    # function to project vertex on edge
-    def project(v1, v2, v3):
-        # v1 and v2 are part of a line
-        # v3 is projected onto it
-        v2 -= v1
-        v3 -= v1
-        p = v3.project(v2)
-        return(p + v1)
-    
-    if circular: # project all knots
-        start = 0
-        end = len(knots)
-        pknots = []
-    else: # first and last knot shouldn't be projected
-        start = 1
-        end = -1
-        pknots = [mathutils.Vector(mesh_mod.vertices[knots[0]].co[:])]
-    for knot in knots[start:end]:
-        if knot in verts_selected:
-            knot_left = knot_right = False
-            for i in range(points.index(knot)-1, -1*len(points), -1):
-                if points[i] not in knots:
-                    knot_left = points[i]
-                    break
-            for i in range(points.index(knot)+1, 2*len(points)):
-                if i > len(points) - 1:
-                    i -= len(points)
-                if points[i] not in knots:
-                    knot_right = points[i]
-                    break
-            if knot_left and knot_right and knot_left != knot_right:
-                knot_left = mathutils.Vector(\
-                    mesh_mod.vertices[knot_left].co[:])
-                knot_right = mathutils.Vector(\
-                    mesh_mod.vertices[knot_right].co[:])
-                knot = mathutils.Vector(mesh_mod.vertices[knot].co[:])
-                pknots.append(project(knot_left, knot_right, knot))
-            else:
-                pknots.append(mathutils.Vector(mesh_mod.vertices[knot].co[:]))
-        else: # knot isn't selected, so shouldn't be changed
-            pknots.append(mathutils.Vector(mesh_mod.vertices[knot].co[:]))
-    if not circular:
-        pknots.append(mathutils.Vector(mesh_mod.vertices[knots[-1]].co[:]))
-    
-    return(pknots)
-
-
-# find all loops through a given vertex
-def curve_vertex_loops(mesh_mod, start_vert, vert_edges, edge_faces):
-    edges_used = []
-    loops = []
-        
-    for edge in vert_edges[start_vert]:
-        if edge in edges_used:
-            continue
-        loop = []
-        circular = False
-        for vert in edge:
-            active_faces = edge_faces[edge]
-            new_vert = vert
-            growing = True
-            while growing:
-                growing = False
-                new_edges = vert_edges[new_vert]
-                loop.append(new_vert)
-                if len(loop) > 1:
-                    edges_used.append(tuple(sorted([loop[-1], loop[-2]])))
-                if len(new_edges) < 3 or len(new_edges) > 4:
-                    # pole
-                    break
-                else:
-                    # find next edge
-                    for new_edge in new_edges:
-                        if new_edge in edges_used:
-                            continue
-                        eliminate = False
-                        for new_face in edge_faces[new_edge]:
-                            if new_face in active_faces:
-                                eliminate = True
-                                break
-                        if eliminate:
-                            continue
-                        # found correct new edge
-                        active_faces = edge_faces[new_edge]
-                        v1, v2 = new_edge
-                        if v1 != new_vert:
-                            new_vert = v1
-                        else:
-                            new_vert = v2
-                        if new_vert == loop[0]:
-                            circular = True
-                        else:
-                            growing = True
-                        break
-            if circular:
-                break
-            loop.reverse()
-        loops.append([loop, circular])
-    
-    return(loops)
-
-
-##########################################
-####### Flatten functions ################
-##########################################
-
-# sort input into loops
-def flatten_get_input(mesh):
-    vert_verts = dict_vert_verts([edge.key for edge in mesh.edges \
-        if edge.select and not edge.hide])
-    verts = [v.index for v in mesh.vertices if v.select and not v.hide]
-    
-    # no connected verts, consider all selected verts as a single input
-    if not vert_verts:
-        return([[verts, False]])
-    
-    loops = []
-    while len(verts) > 0:
-        # start of loop
-        loop = [verts[0]]
-        verts.pop(0)
-        if loop[-1] in vert_verts:
-            to_grow = vert_verts[loop[-1]]
-        else:
-            to_grow = []
-        # grow loop
-        while len(to_grow) > 0:
-            new_vert = to_grow[0]
-            to_grow.pop(0)
-            if new_vert in loop:
-                continue
-            loop.append(new_vert)
-            verts.remove(new_vert)
-            to_grow += vert_verts[new_vert]
-        # add loop to loops
-        loops.append([loop, False])
-    
-    return(loops)
-
-
-# calculate position of vertex projections on plane
-def flatten_project(mesh, loop, com, normal):
-    verts = [mesh.vertices[v] for v in loop[0]]
-    verts_projected = [[v.index, mathutils.Vector(v.co[:]) - \
-        (mathutils.Vector(v.co[:])-com).dot(normal)*normal] for v in verts]
-    
-    return(verts_projected)
-
-
-##########################################
-####### Relax functions ##################
-##########################################
-
-# create lists with knots and points, all correctly sorted
-def relax_calculate_knots(loops):
-    all_knots = []
-    all_points = []
-    for loop, circular in loops:
-        knots = [[], []]
-        points = [[], []]
-        if circular:
-            if len(loop)%2 == 1: # odd
-                extend = [False, True, 0, 1, 0, 1]
-            else: # even
-                extend = [True, False, 0, 1, 1, 2]
-        else:
-            if len(loop)%2 == 1: # odd
-                extend = [False, False, 0, 1, 1, 2]
-            else: # even
-                extend = [False, False, 0, 1, 1, 2]
-        for j in range(2):
-            if extend[j]:
-                loop = [loop[-1]] + loop + [loop[0]]
-            for i in range(extend[2+2*j], len(loop), 2):
-                knots[j].append(loop[i])
-            for i in range(extend[3+2*j], len(loop), 2):
-                if loop[i] == loop[-1] and not circular:
-                    continue
-                if len(points[j]) == 0:
-                    points[j].append(loop[i])
-                elif loop[i] != points[j][0]:
-                    points[j].append(loop[i])
-            if circular:
-                if knots[j][0] != knots[j][-1]:
-                    knots[j].append(knots[j][0])
-        if len(points[1]) == 0:
-            knots.pop(1)
-            points.pop(1)
-        for k in knots:
-            all_knots.append(k)
-        for p in points:
-            all_points.append(p)
-    
-    return(all_knots, all_points)
-
-
-# calculate relative positions compared to first knot
-def relax_calculate_t(mesh_mod, knots, points, regular):
-    all_tknots = []
-    all_tpoints = []
-    for i in range(len(knots)):
-        amount = len(knots[i]) + len(points[i])
-        mix  = []
-        for j in range(amount):
-            if j%2 == 0:
-                mix.append([True, knots[i][round(j/2)]])
-            elif j == amount-1:
-                mix.append([True, knots[i][-1]])
-            else:
-                mix.append([False, points[i][int(j/2)]])
-        len_total = 0
-        loc_prev = False
-        tknots = []
-        tpoints = []
-        for m in mix:
-            loc = mathutils.Vector(mesh_mod.vertices[m[1]].co[:])
-            if not loc_prev:
-                loc_prev = loc
-            len_total += (loc - loc_prev).length
-            if m[0]:
-                tknots.append(len_total)
-            else:
-                tpoints.append(len_total)
-            loc_prev = loc
-        if regular:
-            tpoints = []
-            for p in range(len(points[i])):
-                tpoints.append((tknots[p] + tknots[p+1]) / 2)
-        all_tknots.append(tknots)
-        all_tpoints.append(tpoints)
-    
-    return(all_tknots, all_tpoints)
-
-
-# change the location of the points to their place on the spline
-def relax_calculate_verts(mesh_mod, interpolation, tknots, knots, tpoints,
-points, splines):
-    change = []
-    move = []
-    for i in range(len(knots)):
-        for p in points[i]:
-            m = tpoints[i][points[i].index(p)]
-            if m in tknots[i]:
-                n = tknots[i].index(m)
-            else:
-                t = tknots[i][:]
-                t.append(m)
-                t.sort()
-                n = t.index(m)-1
-            if n > len(splines[i]) - 1:
-                n = len(splines[i]) - 1
-            elif n < 0:
-                n = 0
-            
-            if interpolation == 'cubic':
-                ax, bx, cx, dx, tx = splines[i][n][0]
-                x = ax + bx*(m-tx) + cx*(m-tx)**2 + dx*(m-tx)**3
-                ay, by, cy, dy, ty = splines[i][n][1]
-                y = ay + by*(m-ty) + cy*(m-ty)**2 + dy*(m-ty)**3
-                az, bz, cz, dz, tz = splines[i][n][2]
-                z = az + bz*(m-tz) + cz*(m-tz)**2 + dz*(m-tz)**3
-                change.append([p, mathutils.Vector([x,y,z])])
-            else: # interpolation == 'linear'
-                a, d, t, u = splines[i][n]
-                if u == 0:
-                    u = 1e-8
-                change.append([p, ((m-t)/u)*d + a])
-    for c in change:
-        move.append([c[0], (mesh_mod.vertices[c[0]].co + c[1]) / 2])
-    
-    return(move)
-
-
-##########################################
-####### Space functions ##################
-##########################################
-
-# calculate relative positions compared to first knot
-def space_calculate_t(mesh_mod, knots):
-    tknots = []
-    loc_prev = False
-    len_total = 0
-    for k in knots:
-        loc = mathutils.Vector(mesh_mod.vertices[k].co[:])
-        if not loc_prev:
-            loc_prev = loc
-        len_total += (loc - loc_prev).length
-        tknots.append(len_total)
-        loc_prev = loc
-    amount = len(knots)
-    t_per_segment = len_total / (amount - 1)
-    tpoints = [i * t_per_segment for i in range(amount)]
-    
-    return(tknots, tpoints)
-
-
-# change the location of the points to their place on the spline
-def space_calculate_verts(mesh_mod, interpolation, tknots, tpoints, points,
-splines):
-    move = []
-    for p in points:
-        m = tpoints[points.index(p)]
-        if m in tknots:
-            n = tknots.index(m)
-        else:
-            t = tknots[:]
-            t.append(m)
-            t.sort()
-            n = t.index(m) - 1
-        if n > len(splines) - 1:
-            n = len(splines) - 1
-        elif n < 0:
-            n = 0
-        
-        if interpolation == 'cubic':
-            ax, bx, cx, dx, tx = splines[n][0]
-            x = ax + bx*(m-tx) + cx*(m-tx)**2 + dx*(m-tx)**3
-            ay, by, cy, dy, ty = splines[n][1]
-            y = ay + by*(m-ty) + cy*(m-ty)**2 + dy*(m-ty)**3
-            az, bz, cz, dz, tz = splines[n][2]
-            z = az + bz*(m-tz) + cz*(m-tz)**2 + dz*(m-tz)**3
-            move.append([p, mathutils.Vector([x,y,z])])
-        else: # interpolation == 'linear'
-            a, d, t, u = splines[n]
-            move.append([p, ((m-t)/u)*d + a])
-    
-    return(move)
-
-
-##########################################
-####### Operators ########################
-##########################################
-
-# bridge operator
-class Bridge(bpy.types.Operator):
-    bl_idname = 'mesh.looptools_bridge'
-    bl_label = "Bridge / Loft"
-    bl_description = "Bridge two, or loft several, loops of vertices"
-    bl_options = {'REGISTER', 'UNDO'}
-    
-    cubic_strength = bpy.props.FloatProperty(name = "Strength",
-        description = "Higher strength results in more fluid curves",
-        default = 1.0,
-        soft_min = -3.0,
-        soft_max = 3.0)
-    interpolation = bpy.props.EnumProperty(name = "Interpolation mode",
-        items = (('cubic', "Cubic", "Gives curved results"),
-            ('linear', "Linear", "Basic, fast, straight interpolation")),
-        description = "Interpolation mode: algorithm used when creating "\
-            "segments",
-        default = 'cubic')
-    loft = bpy.props.BoolProperty(name = "Loft",
-        description = "Loft multiple loops, instead of considering them as "\
-            "a multi-input for bridging",
-        default = False)
-    loft_loop = bpy.props.BoolProperty(name = "Loop",
-        description = "Connect the first and the last loop with each other",
-        default = False)
-    min_width = bpy.props.IntProperty(name = "Minimum width",
-        description = "Segments with an edge smaller than this are merged "\
-            "(compared to base edge)",
-        default = 0,
-        min = 0,
-        max = 100,
-        subtype = 'PERCENTAGE')
-    mode = bpy.props.EnumProperty(name = "Mode",
-        items = (('basic', "Basic", "Fast algorithm"), ('shortest',
-            "Shortest edge", "Slower algorithm with better vertex matching")),
-        description = "Algorithm used for bridging",
-        default = 'shortest')
-    remove_faces = bpy.props.BoolProperty(name = "Remove faces",
-        description = "Remove faces that are internal after bridging",
-        default = True)
-    reverse = bpy.props.BoolProperty(name = "Reverse",
-        description = "Manually override the direction in which the loops "\
-                      "are bridged. Only use if the tool gives the wrong " \
-                      "result",
-        default = False)
-    segments = bpy.props.IntProperty(name = "Segments",
-        description = "Number of segments used to bridge the gap "\
-            "(0 = automatic)",
-        default = 1,
-        min = 0,
-        soft_max = 20)
-    twist = bpy.props.IntProperty(name = "Twist",
-        description = "Twist what vertices are connected to each other",
-        default = 0)
-    
-    @classmethod
-    def poll(cls, context):
-        ob = context.active_object
-        return (ob and ob.type == 'MESH' and context.mode == 'EDIT_MESH')
-    
-    def draw(self, context):
-        layout = self.layout
-        #layout.prop(self, "mode") # no cases yet where 'basic' mode is needed
-        
-        # top row
-        col_top = layout.column(align=True)
-        row = col_top.row(align=True)
-        col_left = row.column(align=True)
-        col_right = row.column(align=True)
-        col_right.active = self.segments != 1
-        col_left.prop(self, "segments")
-        col_right.prop(self, "min_width", text="")
-        # bottom row
-        bottom_left = col_left.row()
-        bottom_left.active = self.segments != 1
-        bottom_left.prop(self, "interpolation", text="")
-        bottom_right = col_right.row()
-        bottom_right.active = self.interpolation == 'cubic'
-        bottom_right.prop(self, "cubic_strength")
-        # boolean properties
-        col_top.prop(self, "remove_faces")
-        if self.loft:
-            col_top.prop(self, "loft_loop")
-        
-        # override properties
-        col_top.separator()
-        row = layout.row(align = True)
-        row.prop(self, "twist")
-        row.prop(self, "reverse")
-    
-    def invoke(self, context, event):
-        # load custom settings
-        context.window_manager.looptools.bridge_loft = self.loft
-        settings_load(self)
-        return self.execute(context)
-    
-    def execute(self, context):
-        # initialise
-        global_undo, object, mesh = initialise()
-        edge_faces, edgekey_to_edge, old_selected_faces, smooth = \
-            bridge_initialise(mesh, self.interpolation)
-        settings_write(self)
-        
-        # check cache to see if we can save time
-        input_method = bridge_input_method(self.loft, self.loft_loop)
-        cached, single_loops, loops, derived, mapping = cache_read("Bridge",
-            object, mesh, input_method, False)
-        if not cached:
-            # get loops
-            loops = bridge_get_input(mesh)
-            if loops:
-                # reorder loops if there are more than 2
-                if len(loops) > 2:
-                    if self.loft:
-                        loops = bridge_sort_loops(mesh, loops, self.loft_loop)
-                    else:
-                        loops = bridge_match_loops(mesh, loops)
-        
-        # saving cache for faster execution next time
-        if not cached:
-            cache_write("Bridge", object, mesh, input_method, False, False,
-                loops, False, False)
-        
-        if loops:
-            # calculate new geometry
-            vertices = []
-            faces = []
-            max_vert_index = len(mesh.vertices)-1
-            for i in range(1, len(loops)):
-                if not self.loft and i%2 == 0:
-                    continue
-                lines = bridge_calculate_lines(mesh, loops[i-1:i+1],
-                    self.mode, self.twist, self.reverse)
-                vertex_normals = bridge_calculate_virtual_vertex_normals(mesh,
-                    lines, loops[i-1:i+1], edge_faces, edgekey_to_edge)
-                segments = bridge_calculate_segments(mesh, lines,
-                    loops[i-1:i+1], self.segments)
-                new_verts, new_faces, max_vert_index = \
-                    bridge_calculate_geometry(mesh, lines, vertex_normals,
-                    segments, self.interpolation, self.cubic_strength,
-                    self.min_width, max_vert_index)
-                if new_verts:
-                    vertices += new_verts
-                if new_faces:
-                    faces += new_faces
-            # make sure faces in loops that aren't used, aren't removed
-            if self.remove_faces and old_selected_faces:
-                bridge_save_unused_faces(mesh, old_selected_faces, loops)
-            # create vertices
-            if vertices:
-                bridge_create_vertices(mesh, vertices)
-            # create faces
-            if faces:
-                bridge_create_faces(mesh, faces, self.twist)
-                bridge_select_new_faces(mesh, len(faces), smooth)
-            # edge-data could have changed, can't use cache next run
-            if faces and not vertices:
-                cache_delete("Bridge")
-            # delete internal faces
-            if self.remove_faces and old_selected_faces:
-                bridge_remove_internal_faces(mesh, old_selected_faces)
-            # make sure normals are facing outside
-            bridge_recalculate_normals()
-        
-        terminate(global_undo)
-        return{'FINISHED'}
-
-
-# circle operator
-class Circle(bpy.types.Operator):
-    bl_idname = "mesh.looptools_circle"
-    bl_label = "Circle"
-    bl_description = "Move selected vertices into a circle shape"
-    bl_options = {'REGISTER', 'UNDO'}
-    
-    custom_radius = bpy.props.BoolProperty(name = "Radius",
-        description = "Force a custom radius",
-        default = False)
-    fit = bpy.props.EnumProperty(name = "Method",
-        items = (("best", "Best fit", "Non-linear least squares"),
-            ("inside", "Fit inside","Only move vertices towards the center")),
-        description = "Method used for fitting a circle to the vertices",
-        default = 'best')
-    flatten = bpy.props.BoolProperty(name = "Flatten",
-        description = "Flatten the circle, instead of projecting it on the " \
-            "mesh",
-        default = True)
-    influence = bpy.props.FloatProperty(name = "Influence",
-        description = "Force of the tool",
-        default = 100.0,
-        min = 0.0,
-        max = 100.0,
-        precision = 1,
-        subtype = 'PERCENTAGE')
-    radius = bpy.props.FloatProperty(name = "Radius",
-        description = "Custom radius for circle",
-        default = 1.0,
-        min = 0.0,
-        soft_max = 1000.0)
-    regular = bpy.props.BoolProperty(name = "Regular",
-        description = "Distribute vertices at constant distances along the " \
-            "circle",
-        default = True)
-    
-    @classmethod
-    def poll(cls, context):
-        ob = context.active_object
-        return(ob and ob.type == 'MESH' and context.mode == 'EDIT_MESH')
-    
-    def draw(self, context):
-        layout = self.layout
-        col = layout.column()
-        
-        col.prop(self, "fit")
-        col.separator()
-        
-        col.prop(self, "flatten")
-        row = col.row(align=True)
-        row.prop(self, "custom_radius")
-        row_right = row.row(align=True)
-        row_right.active = self.custom_radius
-        row_right.prop(self, "radius", text="")
-        col.prop(self, "regular")
-        col.separator()
-                
-        col.prop(self, "influence")
-    
-    def invoke(self, context, event):
-        # load custom settings
-        settings_load(self)
-        return self.execute(context)
-    
-    def execute(self, context):
-        # initialise
-        global_undo, object, mesh = initialise()
-        settings_write(self)
-        # check cache to see if we can save time
-        cached, single_loops, loops, derived, mapping = cache_read("Circle",
-            object, mesh, False, False)
-        if cached:
-            derived, mesh_mod = get_derived_mesh(object, mesh, context.scene)
-        else:
-            # find loops
-            derived, mesh_mod, single_vertices, single_loops, loops = \
-                circle_get_input(object, mesh, context.scene)
-            mapping = get_mapping(derived, mesh, mesh_mod, single_vertices,
-                False, loops)
-            single_loops, loops = circle_check_loops(single_loops, loops,
-                mapping, mesh_mod)
-        
-        # saving cache for faster execution next time
-        if not cached:
-            cache_write("Circle", object, mesh, False, False, single_loops,
-                loops, derived, mapping)
-        
-        move = []
-        for i, loop in enumerate(loops):
-            # best fitting flat plane
-            com, normal = calculate_plane(mesh_mod, loop)
-            # if circular, shift loop so we get a good starting vertex
-            if loop[1]:
-                loop = circle_shift_loop(mesh_mod, loop, com)
-            # flatten vertices on plane
-            locs_2d, p, q = circle_3d_to_2d(mesh_mod, loop, com, normal)
-            # calculate circle
-            if self.fit == 'best':
-                x0, y0, r = circle_calculate_best_fit(locs_2d)
-            else: # self.fit == 'inside'
-                x0, y0, r = circle_calculate_min_fit(locs_2d)
-            # radius override
-            if self.custom_radius:
-                r = self.radius / p.length
-            # calculate positions on circle
-            if self.regular:
-                new_locs_2d = circle_project_regular(locs_2d[:], x0, y0, r)
-            else:
-                new_locs_2d = circle_project_non_regular(locs_2d[:], x0, y0, r)
-            # take influence into account
-            locs_2d = circle_influence_locs(locs_2d, new_locs_2d,
-                self.influence)
-            # calculate 3d positions of the created 2d input
-            move.append(circle_calculate_verts(self.flatten, mesh_mod,
-                locs_2d, com, p, q, normal))
-            # flatten single input vertices on plane defined by loop
-            if self.flatten and single_loops:
-                move.append(circle_flatten_singles(mesh_mod, com, p, q,
-                    normal, single_loops[i]))
-        
-        # move vertices to new locations
-        move_verts(mesh, mapping, move, -1)
-        
-        # cleaning up 
-        if derived:
-            bpy.context.blend_data.meshes.remove(mesh_mod)
-        terminate(global_undo)
-        
-        return{'FINISHED'}
-
-
-# curve operator
-class Curve(bpy.types.Operator):
-    bl_idname = "mesh.looptools_curve"
-    bl_label = "Curve"
-    bl_description = "Turn a loop into a smooth curve"
-    bl_options = {'REGISTER', 'UNDO'}
-    
-    boundaries = bpy.props.BoolProperty(name = "Boundaries",
-        description = "Limit the tool to work within the boundaries of the "\
-            "selected vertices",
-        default = False)
-    influence = bpy.props.FloatProperty(name = "Influence",
-        description = "Force of the tool",
-        default = 100.0,
-        min = 0.0,
-        max = 100.0,
-        precision = 1,
-        subtype = 'PERCENTAGE')
-    interpolation = bpy.props.EnumProperty(name = "Interpolation",
-        items = (("cubic", "Cubic", "Natural cubic spline, smooth results"),
-            ("linear", "Linear", "Simple and fast linear algorithm")),
-        description = "Algorithm used for interpolation",
-        default = 'cubic')
-    regular = bpy.props.BoolProperty(name = "Regular",
-        description = "Distribute vertices at constant distances along the" \
-            "curve",
-        default = True)
-    restriction = bpy.props.EnumProperty(name = "Restriction",
-        items = (("none", "None", "No restrictions on vertex movement"),
-            ("extrude", "Extrude only","Only allow extrusions (no "\
-                "indentations)"),
-            ("indent", "Indent only", "Only allow indentation (no "\
-                "extrusions)")),
-        description = "Restrictions on how the vertices can be moved",
-        default = 'none')
-    
-    @classmethod
-    def poll(cls, context):
-        ob = context.active_object
-        return(ob and ob.type == 'MESH' and context.mode == 'EDIT_MESH')
-    
-    def draw(self, context):
-        layout = self.layout
-        col = layout.column()
-        
-        col.prop(self, "interpolation")
-        col.prop(self, "restriction")
-        col.prop(self, "boundaries")
-        col.prop(self, "regular")
-        col.separator()
-        
-        col.prop(self, "influence")
-    
-    def invoke(self, context, event):
-        # load custom settings
-        settings_load(self)
-        return self.execute(context)
-    
-    def execute(self, context):
-        # initialise
-        global_undo, object, mesh = initialise()
-        settings_write(self)
-        # check cache to see if we can save time
-        cached, single_loops, loops, derived, mapping = cache_read("Curve",
-            object, mesh, False, self.boundaries)
-        if cached:
-            derived, mesh_mod = get_derived_mesh(object, mesh, context.scene)
-        else:
-            # find loops
-            derived, mesh_mod, loops = curve_get_input(object, mesh,
-                self.boundaries, context.scene)
-            mapping = get_mapping(derived, mesh, mesh_mod, False, True, loops)
-            loops = check_loops(loops, mapping, mesh_mod)
-        verts_selected = [v.index for v in mesh_mod.vertices if v.select \
-            and not v.hide]
-        
-        # saving cache for faster execution next time
-        if not cached:
-            cache_write("Curve", object, mesh, False, self.boundaries, False,
-                loops, derived, mapping)
-        
-        move = []
-        for loop in loops:
-            knots, points = curve_calculate_knots(loop, verts_selected)
-            pknots = curve_project_knots(mesh_mod, verts_selected, knots,
-                points, loop[1])
-            tknots, tpoints = curve_calculate_t(mesh_mod, knots, points,
-                pknots, self.regular, loop[1])
-            splines = calculate_splines(self.interpolation, mesh_mod,
-                tknots, knots)
-            move.append(curve_calculate_vertices(mesh_mod, knots, tknots,
-                points, tpoints, splines, self.interpolation,
-                self.restriction))
-        
-        # move vertices to new locations
-        move_verts(mesh, mapping, move, self.influence)
-        
-        # cleaning up 
-        if derived:
-            bpy.context.blend_data.meshes.remove(mesh_mod)
-        
-        terminate(global_undo)
-        return{'FINISHED'}
-
-
-# flatten operator
-class Flatten(bpy.types.Operator):
-    bl_idname = "mesh.looptools_flatten"
-    bl_label = "Flatten"
-    bl_description = "Flatten vertices on a best-fitting plane"
-    bl_options = {'REGISTER', 'UNDO'}
-    
-    influence = bpy.props.FloatProperty(name = "Influence",
-        description = "Force of the tool",
-        default = 100.0,
-        min = 0.0,
-        max = 100.0,
-        precision = 1,
-        subtype = 'PERCENTAGE')
-    plane = bpy.props.EnumProperty(name = "Plane",
-        items = (("best_fit", "Best fit", "Calculate a best fitting plane"),
-            ("normal", "Normal", "Derive plane from averaging vertex "\
-            "normals"),
-            ("view", "View", "Flatten on a plane perpendicular to the "\
-            "viewing angle")),
-        description = "Plane on which vertices are flattened",
-        default = 'best_fit')
-    restriction = bpy.props.EnumProperty(name = "Restriction",
-        items = (("none", "None", "No restrictions on vertex movement"),
-            ("bounding_box", "Bounding box", "Vertices are restricted to "\
-            "movement inside the bounding box of the selection")),
-        description = "Restrictions on how the vertices can be moved",
-        default = 'none')
-    
-    @classmethod
-    def poll(cls, context):
-        ob = context.active_object
-        return(ob and ob.type == 'MESH' and context.mode == 'EDIT_MESH')
-    
-    def draw(self, context):
-        layout = self.layout
-        col = layout.column()
-        
-        col.prop(self, "plane")
-        #col.prop(self, "restriction")
-        col.separator()
-        
-        col.prop(self, "influence")
-    
-    def invoke(self, context, event):
-        # load custom settings
-        settings_load(self)
-        return self.execute(context)
-    
-    def execute(self, context):
-        # initialise
-        global_undo, object, mesh = initialise()
-        settings_write(self)
-        # check cache to see if we can save time
-        cached, single_loops, loops, derived, mapping = cache_read("Flatten",
-            object, mesh, False, False)
-        if not cached:
-            # order input into virtual loops
-            loops = flatten_get_input(mesh)
-            loops = check_loops(loops, mapping, mesh)
-        
-        # saving cache for faster execution next time
-        if not cached:
-            cache_write("Flatten", object, mesh, False, False, False, loops,
-                False, False)
-        
-        move = []
-        for loop in loops:
-            # calculate plane and position of vertices on them
-            com, normal = calculate_plane(mesh, loop, method=self.plane,
-                object=object)
-            to_move = flatten_project(mesh, loop, com, normal)
-            if self.restriction == 'none':
-                move.append(to_move)
-            else:
-                move.append(to_move)
-        move_verts(mesh, False, move, self.influence)
-        
-        terminate(global_undo)
-        return{'FINISHED'}
-
-
-# relax operator
-class Relax(bpy.types.Operator):
-    bl_idname = "mesh.looptools_relax"
-    bl_label = "Relax"
-    bl_description = "Relax the loop, so it is smoother"
-    bl_options = {'REGISTER', 'UNDO'}
-    
-    input = bpy.props.EnumProperty(name = "Input",
-        items = (("all", "Parallel (all)", "Also use non-selected "\
-                "parallel loops as input"),
-            ("selected", "Selection","Only use selected vertices as input")),
-        description = "Loops that are relaxed",
-        default = 'selected')
-    interpolation = bpy.props.EnumProperty(name = "Interpolation",
-        items = (("cubic", "Cubic", "Natural cubic spline, smooth results"),
-            ("linear", "Linear", "Simple and fast linear algorithm")),
-        description = "Algorithm used for interpolation",
-        default = 'cubic')
-    iterations = bpy.props.EnumProperty(name = "Iterations",
-        items = (("1", "1", "One"),
-            ("3", "3", "Three"),
-            ("5", "5", "Five"),
-            ("10", "10", "Ten"),
-            ("25", "25", "Twenty-five")),
-        description = "Number of times the loop is relaxed",
-        default = "1")
-    regular = bpy.props.BoolProperty(name = "Regular",
-        description = "Distribute vertices at constant distances along the" \
-            "loop",
-        default = True)
-    
-    @classmethod
-    def poll(cls, context):
-        ob = context.active_object
-        return(ob and ob.type == 'MESH' and context.mode == 'EDIT_MESH')
-    
-    def draw(self, context):
-        layout = self.layout
-        col = layout.column()
-        
-        col.prop(self, "interpolation")
-        col.prop(self, "input")
-        col.prop(self, "iterations")
-        col.prop(self, "regular")
-    
-    def invoke(self, context, event):
-        # load custom settings
-        settings_load(self)
-        return self.execute(context)
-    
-    def execute(self, context):
-        # initialise
-        global_undo, object, mesh = initialise()
-        settings_write(self)
-        # check cache to see if we can save time
-        cached, single_loops, loops, derived, mapping = cache_read("Relax",
-            object, mesh, self.input, False)
-        if cached:
-            derived, mesh_mod = get_derived_mesh(object, mesh, context.scene)
-        else:
-            # find loops
-            derived, mesh_mod, loops = get_connected_input(object, mesh,
-                context.scene, self.input)
-            mapping = get_mapping(derived, mesh, mesh_mod, False, False, loops)
-            loops = check_loops(loops, mapping, mesh_mod)
-        knots, points = relax_calculate_knots(loops)
-        
-        # saving cache for faster execution next time
-        if not cached:
-            cache_write("Relax", object, mesh, self.input, False, False, loops,
-                derived, mapping)
-        
-        for iteration in range(int(self.iterations)):
-            # calculate splines and new positions
-            tknots, tpoints = relax_calculate_t(mesh_mod, knots, points,
-                self.regular)
-            splines = []
-            for i in range(len(knots)):
-                splines.append(calculate_splines(self.interpolation, mesh_mod,
-                    tknots[i], knots[i]))
-            move = [relax_calculate_verts(mesh_mod, self.interpolation,
-                tknots, knots, tpoints, points, splines)]
-            move_verts(mesh, mapping, move, -1)
-        
-        # cleaning up 
-        if derived:
-            bpy.context.blend_data.meshes.remove(mesh_mod)
-        terminate(global_undo)
-        
-        return{'FINISHED'}
-
-
-# space operator
-class Space(bpy.types.Operator):
-    bl_idname = "mesh.looptools_space"
-    bl_label = "Space"
-    bl_description = "Space the vertices in a regular distrubtion on the loop"
-    bl_options = {'REGISTER', 'UNDO'}
-    
-    influence = bpy.props.FloatProperty(name = "Influence",
-        description = "Force of the tool",
-        default = 100.0,
-        min = 0.0,
-        max = 100.0,
-        precision = 1,
-        subtype = 'PERCENTAGE')
-    input = bpy.props.EnumProperty(name = "Input",
-        items = (("all", "Parallel (all)", "Also use non-selected "\
-                "parallel loops as input"),
-            ("selected", "Selection","Only use selected vertices as input")),
-        description = "Loops that are spaced",
-        default = 'selected')
-    interpolation = bpy.props.EnumProperty(name = "Interpolation",
-        items = (("cubic", "Cubic", "Natural cubic spline, smooth results"),
-            ("linear", "Linear", "Vertices are projected on existing edges")),
-        description = "Algorithm used for interpolation",
-        default = 'cubic')
-    
-    @classmethod
-    def poll(cls, context):
-        ob = context.active_object
-        return(ob and ob.type == 'MESH' and context.mode == 'EDIT_MESH')
-    
-    def draw(self, context):
-        layout = self.layout
-        col = layout.column()
-        
-        col.prop(self, "interpolation")
-        col.prop(self, "input")
-        col.separator()
-        
-        col.prop(self, "influence")
-    
-    def invoke(self, context, event):
-        # load custom settings
-        settings_load(self)
-        return self.execute(context)
-    
-    def execute(self, context):
-        # initialise
-        global_undo, object, mesh = initialise()
-        settings_write(self)
-        # check cache to see if we can save time
-        cached, single_loops, loops, derived, mapping = cache_read("Space",
-            object, mesh, self.input, False)
-        if cached:
-            derived, mesh_mod = get_derived_mesh(object, mesh, context.scene)
-        else:
-            # find loops
-            derived, mesh_mod, loops = get_connected_input(object, mesh,
-                context.scene, self.input)
-            mapping = get_mapping(derived, mesh, mesh_mod, False, False, loops)
-            loops = check_loops(loops, mapping, mesh_mod)
-        
-        # saving cache for faster execution next time
-        if not cached:
-            cache_write("Space", object, mesh, self.input, False, False, loops,
-                derived, mapping)
-        
-        move = []
-        for loop in loops:
-            # calculate splines and new positions
-            if loop[1]: # circular
-                loop[0].append(loop[0][0])
-            tknots, tpoints = space_calculate_t(mesh_mod, loop[0][:])
-            splines = calculate_splines(self.interpolation, mesh_mod,
-                tknots, loop[0][:])
-            move.append(space_calculate_verts(mesh_mod, self.interpolation,
-                tknots, tpoints, loop[0][:-1], splines))
-        
-        # move vertices to new locations
-        move_verts(mesh, mapping, move, self.influence)
-        
-        # cleaning up 
-        if derived:
-            bpy.context.blend_data.meshes.remove(mesh_mod)
-        terminate(global_undo)
-        
-        return{'FINISHED'}
-
-
-##########################################
-####### GUI and registration #############
-##########################################
-
-# menu containing all tools
-class VIEW3D_MT_edit_mesh_looptools(bpy.types.Menu):
-    bl_label = "LoopTools"
-    
-    def draw(self, context):
-        layout = self.layout
-        
-        layout.operator("mesh.looptools_bridge", text="Bridge").loft = False
-        layout.operator("mesh.looptools_circle")
-        layout.operator("mesh.looptools_curve")
-        layout.operator("mesh.looptools_flatten")
-        layout.operator("mesh.looptools_bridge", text="Loft").loft = True
-        layout.operator("mesh.looptools_relax")
-        layout.operator("mesh.looptools_space")
-
-
-# panel containing all tools
-class VIEW3D_PT_tools_looptools(bpy.types.Panel):
-    bl_space_type = 'VIEW_3D'
-    bl_region_type = 'TOOLS'
-    bl_context = "mesh_edit"
-    bl_label = "LoopTools"
-
-    def draw(self, context):
-        layout = self.layout
-        col = layout.column(align=True)
-        lt = context.window_manager.looptools
-        
-        # bridge - first line
-        split = col.split(percentage=0.15)
-        if lt.display_bridge:
-            split.prop(lt, "display_bridge", text="", icon='DOWNARROW_HLT')
-        else:
-            split.prop(lt, "display_bridge", text="", icon='RIGHTARROW')
-        split.operator("mesh.looptools_bridge", text="Bridge").loft = False
-        # bridge - settings
-        if lt.display_bridge:
-            box = col.column(align=True).box().column()
-            #box.prop(self, "mode")
-            
-            # top row
-            col_top = box.column(align=True)
-            row = col_top.row(align=True)
-            col_left = row.column(align=True)
-            col_right = row.column(align=True)
-            col_right.active = lt.bridge_segments != 1
-            col_left.prop(lt, "bridge_segments")
-            col_right.prop(lt, "bridge_min_width", text="")
-            # bottom row
-            bottom_left = col_left.row()
-            bottom_left.active = lt.bridge_segments != 1
-            bottom_left.prop(lt, "bridge_interpolation", text="")
-            bottom_right = col_right.row()
-            bottom_right.active = lt.bridge_interpolation == 'cubic'
-            bottom_right.prop(lt, "bridge_cubic_strength")
-            # boolean properties
-            col_top.prop(lt, "bridge_remove_faces")
-            
-            # override properties
-            col_top.separator()
-            row = box.row(align = True)
-            row.prop(lt, "bridge_twist")
-            row.prop(lt, "bridge_reverse")
-        
-        # circle - first line
-        split = col.split(percentage=0.15)
-        if lt.display_circle:
-            split.prop(lt, "display_circle", text="", icon='DOWNARROW_HLT')
-        else:
-            split.prop(lt, "display_circle", text="", icon='RIGHTARROW')
-        split.operator("mesh.looptools_circle")
-        # circle - settings
-        if lt.display_circle:
-            box = col.column(align=True).box().column()
-            box.prop(lt, "circle_fit")
-            box.separator()
-            
-            box.prop(lt, "circle_flatten")
-            row = box.row(align=True)
-            row.prop(lt, "circle_custom_radius")
-            row_right = row.row(align=True)
-            row_right.active = lt.circle_custom_radius
-            row_right.prop(lt, "circle_radius", text="")
-            box.prop(lt, "circle_regular")
-            box.separator()
-            
-            box.prop(lt, "circle_influence")
-        
-        # curve - first line
-        split = col.split(percentage=0.15)
-        if lt.display_curve:
-            split.prop(lt, "display_curve", text="", icon='DOWNARROW_HLT')
-        else:
-            split.prop(lt, "display_curve", text="", icon='RIGHTARROW')
-        split.operator("mesh.looptools_curve")
-        # curve - settings
-        if lt.display_curve:
-            box = col.column(align=True).box().column()
-            box.prop(lt, "curve_interpolation")
-            box.prop(lt, "curve_restriction")
-            box.prop(lt, "curve_boundaries")
-            box.prop(lt, "curve_regular")
-            box.separator()
-            
-            box.prop(lt, "curve_influence")
-        
-        # flatten - first line
-        split = col.split(percentage=0.15)
-        if lt.display_flatten:
-            split.prop(lt, "display_flatten", text="", icon='DOWNARROW_HLT')
-        else:
-            split.prop(lt, "display_flatten", text="", icon='RIGHTARROW')
-        split.operator("mesh.looptools_flatten")
-        # flatten - settings
-        if lt.display_flatten:
-            box = col.column(align=True).box().column()
-            box.prop(lt, "flatten_plane")
-            #box.prop(lt, "flatten_restriction")
-            box.separator()
-            
-            box.prop(lt, "flatten_influence")
-        
-        # loft - first line
-        split = col.split(percentage=0.15)
-        if lt.display_loft:
-            split.prop(lt, "display_loft", text="", icon='DOWNARROW_HLT')
-        else:
-            split.prop(lt, "display_loft", text="", icon='RIGHTARROW')
-        split.operator("mesh.looptools_bridge", text="Loft").loft = True
-        # loft - settings
-        if lt.display_loft:
-            box = col.column(align=True).box().column()
-            #box.prop(self, "mode")
-            
-            # top row
-            col_top = box.column(align=True)
-            row = col_top.row(align=True)
-            col_left = row.column(align=True)
-            col_right = row.column(align=True)
-            col_right.active = lt.bridge_segments != 1
-            col_left.prop(lt, "bridge_segments")
-            col_right.prop(lt, "bridge_min_width", text="")
-            # bottom row
-            bottom_left = col_left.row()
-            bottom_left.active = lt.bridge_segments != 1
-            bottom_left.prop(lt, "bridge_interpolation", text="")
-            bottom_right = col_right.row()
-            bottom_right.active = lt.bridge_interpolation == 'cubic'
-            bottom_right.prop(lt, "bridge_cubic_strength")
-            # boolean properties
-            col_top.prop(lt, "bridge_remove_faces")
-            col_top.prop(lt, "bridge_loft_loop")
-            
-            # override properties
-            col_top.separator()
-            row = box.row(align = True)
-            row.prop(lt, "bridge_twist")
-            row.prop(lt, "bridge_reverse")
-        
-        # relax - first line
-        split = col.split(percentage=0.15)
-        if lt.display_relax:
-            split.prop(lt, "display_relax", text="", icon='DOWNARROW_HLT')
-        else:
-            split.prop(lt, "display_relax", text="", icon='RIGHTARROW')
-        split.operator("mesh.looptools_relax")
-        # relax - settings
-        if lt.display_relax:
-            box = col.column(align=True).box().column()
-            box.prop(lt, "relax_interpolation")
-            box.prop(lt, "relax_input")
-            box.prop(lt, "relax_iterations")
-            box.prop(lt, "relax_regular")
-        
-        # space - first line
-        split = col.split(percentage=0.15)
-        if lt.display_space:
-            split.prop(lt, "display_space", text="", icon='DOWNARROW_HLT')
-        else:
-            split.prop(lt, "display_space", text="", icon='RIGHTARROW')
-        split.operator("mesh.looptools_space")
-        # space - settings
-        if lt.display_space:
-            box = col.column(align=True).box().column()
-            box.prop(lt, "space_interpolation")
-            box.prop(lt, "space_input")
-            box.separator()
-            
-            box.prop(lt, "space_influence")
-
-
-# property group containing all properties for the gui in the panel
-class LoopToolsProps(bpy.types.PropertyGroup):
-    """
-    Fake module like class
-    bpy.context.window_manager.looptools
-    """
-    
-    # general display properties
-    display_bridge = bpy.props.BoolProperty(name = "Bridge settings",
-        description = "Display settings of the Bridge tool",
-        default = False)
-    display_circle = bpy.props.BoolProperty(name = "Circle settings",
-        description = "Display settings of the Circle tool",
-        default = False)
-    display_curve = bpy.props.BoolProperty(name = "Curve settings",
-        description = "Display settings of the Curve tool",
-        default = False)
-    display_flatten = bpy.props.BoolProperty(name = "Flatten settings",
-        description = "Display settings of the Flatten tool",
-        default = False)
-    display_loft = bpy.props.BoolProperty(name = "Loft settings",
-        description = "Display settings of the Loft tool",
-        default = False)
-    display_relax = bpy.props.BoolProperty(name = "Relax settings",
-        description = "Display settings of the Relax tool",
-        default = False)
-    display_space = bpy.props.BoolProperty(name = "Space settings",
-        description = "Display settings of the Space tool",
-        default = False)
-    
-    # bridge properties
-    bridge_cubic_strength = bpy.props.FloatProperty(name = "Strength",
-        description = "Higher strength results in more fluid curves",
-        default = 1.0,
-        soft_min = -3.0,
-        soft_max = 3.0)
-    bridge_interpolation = bpy.props.EnumProperty(name = "Interpolation mode",
-        items = (('cubic', "Cubic", "Gives curved results"),
-            ('linear', "Linear", "Basic, fast, straight interpolation")),
-        description = "Interpolation mode: algorithm used when creating "\
-            "segments",
-        default = 'cubic')
-    bridge_loft = bpy.props.BoolProperty(name = "Loft",
-        description = "Loft multiple loops, instead of considering them as "\
-            "a multi-input for bridging",
-        default = False)
-    bridge_loft_loop = bpy.props.BoolProperty(name = "Loop",
-        description = "Connect the first and the last loop with each other",
-        default = False)
-    bridge_min_width = bpy.props.IntProperty(name = "Minimum width",
-        description = "Segments with an edge smaller than this are merged "\
-            "(compared to base edge)",
-        default = 0,
-        min = 0,
-        max = 100,
-        subtype = 'PERCENTAGE')
-    bridge_mode = bpy.props.EnumProperty(name = "Mode",
-        items = (('basic', "Basic", "Fast algorithm"),
-                 ('shortest', "Shortest edge", "Slower algorithm with " \
-                                               "better vertex matching")),
-        description = "Algorithm used for bridging",
-        default = 'shortest')
-    bridge_remove_faces = bpy.props.BoolProperty(name = "Remove faces",
-        description = "Remove faces that are internal after bridging",
-        default = True)
-    bridge_reverse = bpy.props.BoolProperty(name = "Reverse",
-        description = "Manually override the direction in which the loops "\
-                      "are bridged. Only use if the tool gives the wrong " \
-                      "result",
-        default = False)
-    bridge_segments = bpy.props.IntProperty(name = "Segments",
-        description = "Number of segments used to bridge the gap "\
-            "(0 = automatic)",
-        default = 1,
-        min = 0,
-        soft_max = 20)
-    bridge_twist = bpy.props.IntProperty(name = "Twist",
-        description = "Twist what vertices are connected to each other",
-        default = 0)
-    
-    # circle properties
-    circle_custom_radius = bpy.props.BoolProperty(name = "Radius",
-        description = "Force a custom radius",
-        default = False)
-    circle_fit = bpy.props.EnumProperty(name = "Method",
-        items = (("best", "Best fit", "Non-linear least squares"),
-            ("inside", "Fit inside","Only move vertices towards the center")),
-        description = "Method used for fitting a circle to the vertices",
-        default = 'best')
-    circle_flatten = bpy.props.BoolProperty(name = "Flatten",
-        description = "Flatten the circle, instead of projecting it on the " \
-            "mesh",
-        default = True)
-    circle_influence = bpy.props.FloatProperty(name = "Influence",
-        description = "Force of the tool",
-        default = 100.0,
-        min = 0.0,
-        max = 100.0,
-        precision = 1,
-        subtype = 'PERCENTAGE')
-    circle_radius = bpy.props.FloatProperty(name = "Radius",
-        description = "Custom radius for circle",
-        default = 1.0,
-        min = 0.0,
-        soft_max = 1000.0)
-    circle_regular = bpy.props.BoolProperty(name = "Regular",
-        description = "Distribute vertices at constant distances along the " \
-            "circle",
-        default = True)
-    
-    # curve properties
-    curve_boundaries = bpy.props.BoolProperty(name = "Boundaries",
-        description = "Limit the tool to work within the boundaries of the "\
-            "selected vertices",
-        default = False)
-    curve_influence = bpy.props.FloatProperty(name = "Influence",
-        description = "Force of the tool",
-        default = 100.0,
-        min = 0.0,
-        max = 100.0,
-        precision = 1,
-        subtype = 'PERCENTAGE')
-    curve_interpolation = bpy.props.EnumProperty(name = "Interpolation",
-        items = (("cubic", "Cubic", "Natural cubic spline, smooth results"),
-            ("linear", "Linear", "Simple and fast linear algorithm")),
-        description = "Algorithm used for interpolation",
-        default = 'cubic')
-    curve_regular = bpy.props.BoolProperty(name = "Regular",
-        description = "Distribute vertices at constant distances along the" \
-            "curve",
-        default = True)
-    curve_restriction = bpy.props.EnumProperty(name = "Restriction",
-        items = (("none", "None", "No restrictions on vertex movement"),
-            ("extrude", "Extrude only","Only allow extrusions (no "\
-                "indentations)"),
-            ("indent", "Indent only", "Only allow indentation (no "\
-                "extrusions)")),
-        description = "Restrictions on how the vertices can be moved",
-        default = 'none')
-    
-    # flatten properties
-    flatten_influence = bpy.props.FloatProperty(name = "Influence",
-        description = "Force of the tool",
-        default = 100.0,
-        min = 0.0,
-        max = 100.0,
-        precision = 1,
-        subtype = 'PERCENTAGE')
-    flatten_plane = bpy.props.EnumProperty(name = "Plane",
-        items = (("best_fit", "Best fit", "Calculate a best fitting plane"),
-            ("normal", "Normal", "Derive plane from averaging vertex "\
-            "normals"),
-            ("view", "View", "Flatten on a plane perpendicular to the "\
-            "viewing angle")),
-        description = "Plane on which vertices are flattened",
-        default = 'best_fit')
-    flatten_restriction = bpy.props.EnumProperty(name = "Restriction",
-        items = (("none", "None", "No restrictions on vertex movement"),
-            ("bounding_box", "Bounding box", "Vertices are restricted to "\
-            "movement inside the bounding box of the selection")),
-        description = "Restrictions on how the vertices can be moved",
-        default = 'none')
-    
-    # relax properties
-    relax_input = bpy.props.EnumProperty(name = "Input",
-        items = (("all", "Parallel (all)", "Also use non-selected "\
-                "parallel loops as input"),
-            ("selected", "Selection","Only use selected vertices as input")),
-        description = "Loops that are relaxed",
-        default = 'selected')
-    relax_interpolation = bpy.props.EnumProperty(name = "Interpolation",
-        items = (("cubic", "Cubic", "Natural cubic spline, smooth results"),
-            ("linear", "Linear", "Simple and fast linear algorithm")),
-        description = "Algorithm used for interpolation",
-        default = 'cubic')
-    relax_iterations = bpy.props.EnumProperty(name = "Iterations",
-        items = (("1", "1", "One"),
-            ("3", "3", "Three"),
-            ("5", "5", "Five"),
-            ("10", "10", "Ten"),
-            ("25", "25", "Twenty-five")),
-        description = "Number of times the loop is relaxed",
-        default = "1")
-    relax_regular = bpy.props.BoolProperty(name = "Regular",
-        description = "Distribute vertices at constant distances along the" \
-            "loop",
-        default = True)
-    
-    # space properties
-    space_influence = bpy.props.FloatProperty(name = "Influence",
-        description = "Force of the tool",
-        default = 100.0,
-        min = 0.0,
-        max = 100.0,
-        precision = 1,
-        subtype = 'PERCENTAGE')
-    space_input = bpy.props.EnumProperty(name = "Input",
-        items = (("all", "Parallel (all)", "Also use non-selected "\
-                "parallel loops as input"),
-            ("selected", "Selection","Only use selected vertices as input")),
-        description = "Loops that are spaced",
-        default = 'selected')
-    space_interpolation = bpy.props.EnumProperty(name = "Interpolation",
-        items = (("cubic", "Cubic", "Natural cubic spline, smooth results"),
-            ("linear", "Linear", "Vertices are projected on existing edges")),
-        description = "Algorithm used for interpolation",
-        default = 'cubic')
-
-
-# draw function for integration in menus
-def menu_func(self, context):
-    self.layout.menu("VIEW3D_MT_edit_mesh_looptools")
-    self.layout.separator()
-
-
-# define classes for registration
-classes = [VIEW3D_MT_edit_mesh_looptools,
-    VIEW3D_PT_tools_looptools,
-    LoopToolsProps,
-    Bridge,
-    Circle,
-    Curve,
-    Flatten,
-    Relax,
-    Space]
-
-
-# registering and menu integration
-def register():
-    for c in classes:
-        bpy.utils.register_class(c)
-    bpy.types.VIEW3D_MT_edit_mesh_specials.prepend(menu_func)
-    bpy.types.WindowManager.looptools = bpy.props.PointerProperty(\
-        type = LoopToolsProps)
-
-
-# unregistering and removing menus
-def unregister():
-    for c in classes:
-        bpy.utils.unregister_class(c)
-    bpy.types.VIEW3D_MT_edit_mesh_specials.remove(menu_func)
-    try:
-        del bpy.types.WindowManager.looptools
-    except:
-        pass
-
-
-if __name__ == "__main__":
-    register()
diff --git a/release/scripts/addons/mocap/__init__.py b/release/scripts/addons/mocap/__init__.py
index 6c69f0d..dd82019 100644
--- a/release/scripts/addons/mocap/__init__.py
+++ b/release/scripts/addons/mocap/__init__.py
@@ -21,11 +21,11 @@
 bl_info = {
     "name": "Motion Capture Tools",
     "author": "Benjy Cook",
-    "blender": (2, 5, 9),
+    "blender": (2, 6, 2),
     "location": "Object UI -> Mocap tools",
     "description": "Various tools for working with motion capture animation",
     "warning": "",
-    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/Scripts/Animation/Motion_Capture_Tools",
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Animation/Motion_Capture_Tools",
     "tracker_url": "http://projects.blender.org/tracker/index.php?func=detail&aid=28321",
     "support": 'OFFICIAL',
     "category": "Animation"}
@@ -145,7 +145,7 @@ class AnimationStitchSettings(bpy.types.PropertyGroup):
     blend_frame = IntProperty(name="Stitch frame",
             description="Frame to locate stitch on")
     blend_amount = IntProperty(name="Blend amount",
-            description="Size of blending transitiion, on both sides of the stitch",
+            description="Size of blending transition, on both sides of the stitch",
             default=10)
     second_offset = IntProperty(name="Second offset",
             description="Frame offset for 2nd animation, where it should start",
@@ -312,7 +312,7 @@ class MocapPanel(bpy.types.Panel):
                     for bone in perf.bones:
                         footCol.prop(data=bone, property='foot', text='', icon='POSE_DATA')
                         nameCol.label(bone.name)
-                        mapCol.prop_search(bone, "map", enduser_arm, "bones")
+                        mapCol.prop_search(bone, "map", enduser_arm, "bones", text='')
                         selectCol.operator("mocap.selectmap", text='', icon='CURSOR').perf_bone = bone.name
                         label_mod = "FK"
                         if bone.map:
@@ -370,7 +370,7 @@ class MocapConstraintsPanel(bpy.types.Panel):
                         headerRow.operator("mocap.removeconstraint", text="", icon='X', emboss=False).constraint = i
                         if m_constraint.show_expanded:
                             box.separator()
-                            box.prop_search(m_constraint, 'constrained_bone', enduser_obj.pose, "bones", icon='BONE_DATA')
+                            box.prop_search(m_constraint, 'constrained_bone', enduser_obj.pose, "bones", icon='BONE_DATA',text='')
                             if m_constraint.type == "distance" or m_constraint.type == "point":
                                 box.prop_search(m_constraint, 'constrained_boneB', enduser_obj.pose, "bones", icon='CONSTRAINT_BONE')
                             frameRow = box.row()
@@ -564,7 +564,7 @@ class OBJECT_OT_LooperButton(bpy.types.Operator):
     #Operator to trim fcurves which contain a few loops to a single one on the selected object
     '''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 animation / sampled mocap data"
 
     def execute(self, context):
         mocap_tools.autoloop_anim()
@@ -648,7 +648,7 @@ class OBJECT_OT_RotateFixArmature(bpy.types.Operator):
 
 class OBJECT_OT_ScaleFixArmature(bpy.types.Operator):
     #Operator to scale down the selected armature to match the active one
-    '''Rescale selected armature to match the active animation, for convienence'''
+    '''Rescale selected armature to match the active animation, for convenience'''
     bl_idname = "mocap.scale_fix"
     bl_label = "Scale performer armature to match target armature"
 
diff --git a/release/scripts/addons/mocap/retarget.py b/release/scripts/addons/mocap/retarget.py
index d8dae35..66c6228 100644
--- a/release/scripts/addons/mocap/retarget.py
+++ b/release/scripts/addons/mocap/retarget.py
@@ -307,7 +307,6 @@ def copyTranslation(performer_obj, enduser_obj, perfFeet, root, s_frame, e_frame
 
 
 def IKRetarget(performer_obj, enduser_obj, s_frame, e_frame, scene, step):
-    bpy.ops.object.select_name(name=enduser_obj.name, extend=False)
     end_bones = enduser_obj.pose.bones
     for pose_bone in end_bones:
         ik_constraint = hasIKConstraint(pose_bone)
@@ -529,16 +528,20 @@ def totalRetarget(performer_obj, enduser_obj, scene, s_frame, e_frame):
     print("Second pass: retargeting root translation and clean up")
     stride_bone = copyTranslation(performer_obj, enduser_obj, feetBones, root, s_frame, e_frame, scene, enduser_obj_mat)
     if not advanced:
+        print("hry")
+        bpy.ops.object.select_all(action='DESELECT')
+        bpy.context.scene.objects.active = enduser_obj
+        bpy.ops.object.select_pattern(pattern=enduser_obj.name, extend=False)
         IKRetarget(performer_obj, enduser_obj, s_frame, e_frame, scene, step)
-        bpy.ops.object.select_name(name=stride_bone.name, extend=False)
+        bpy.ops.object.select_pattern(pattern=stride_bone.name, extend=False)
     restoreObjMat(performer_obj, enduser_obj, perf_obj_mat, enduser_obj_mat, stride_bone, scene, s_frame)
     bpy.ops.object.mode_set(mode='OBJECT')
     if not advanced:
-        bpy.ops.object.select_name(name=inter_obj.name, extend=False)
+        bpy.ops.object.select_pattern(pattern=inter_obj.name, extend=False)
         bpy.ops.object.delete()
     else:
         cleanTempConstraints(enduser_obj)
-    bpy.ops.object.select_name(name=enduser_obj.name, extend=False)
+    bpy.ops.object.select_pattern(pattern=enduser_obj.name, extend=False)
 
     if not name in [tracks.name for tracks in end_arm.mocapNLATracks]:
         NLATracks = end_arm.mocapNLATracks.add()
diff --git a/release/scripts/addons/modules/add_utils.py b/release/scripts/addons/modules/add_utils.py
deleted file mode 100644
index 39aed56..0000000
--- a/release/scripts/addons/modules/add_utils.py
+++ /dev/null
@@ -1,137 +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 #####
-########################################################
-#
-# Before changing this file please discuss with admins.
-#
-########################################################
-# <pep8 compliant>
-
-import bpy
-import mathutils
-from bpy.props import FloatVectorProperty
-
-
-class AddObjectHelper:
-    '''Helper Class for Add Object Operators'''
-    location = FloatVectorProperty(name='Location', description='Location of new Object')
-    rotation = FloatVectorProperty(name='Rotation', description='Rotation of new Object')
-
-
-#Initialize loc, rot of operator
-def add_object_align_init(context, operator):
-    '''Initialize loc, rot of operator
-    context: Blender Context
-    operator: the active Operator (self)
-    Initializes the Operators location and rotation variables
-    according to user preferences (align to view)
-    See AddObjectHelper class
-    Returns Matrix
-    '''
-    if (operator
-        and operator.properties.is_property_set("location")
-        and operator.properties.is_property_set("rotation")):
-        location = mathutils.Matrix.Translation(mathutils.Vector(operator.properties.location))
-        rotation = mathutils.Euler(operator.properties.rotation).to_matrix().to_4x4()
-    else:
-        # TODO, local view cursor!
-        location = mathutils.Matrix.Translation(context.scene.cursor_location)
-
-        if context.user_preferences.edit.object_align == 'VIEW' and context.space_data.type == 'VIEW_3D':
-            rotation = context.space_data.region_3d.view_matrix.to_3x3().inverted().to_4x4()
-        else:
-            rotation = mathutils.Matrix()
-
-        # set the operator properties
-        if operator:
-            operator.properties.location = location.to_translation()
-            operator.properties.rotation = rotation.to_euler()
-
-    return location * rotation
-
-
-def add_object_data(context, obdata, operator=None):
-    '''Create Object from data
-
-    context: Blender Context
-    obdata: Object data (mesh, curve, camera,...)
-    operator: the active operator (self)
-
-    Returns the Object
-    '''
-
-    scene = context.scene
-
-    # ugh, could be made nicer
-    for ob in scene.objects:
-        ob.select = False
-
-    obj_new = bpy.data.objects.new(obdata.name, obdata)
-    obj_new.update_tag()
-
-    base = scene.objects.link(obj_new)
-    base.select = True
-
-    if context.space_data and context.space_data.type == 'VIEW_3D':
-        base.layers_from_view(context.space_data)
-
-    obj_new.matrix_world = add_object_align_init(context, operator)
-
-    obj_act = scene.objects.active
-
-    if obj_act and obj_act.mode == 'EDIT' and obj_act.type == obj_new.type:
-        bpy.ops.object.mode_set(mode='OBJECT')
-
-        obj_act.select = True
-        scene.update()  # apply location
-        #scene.objects.active = obj_new
-
-        bpy.ops.object.join()  # join into the active.
-
-        bpy.ops.object.mode_set(mode='EDIT')
-    else:
-        scene.objects.active = obj_new
-        if context.user_preferences.edit.use_enter_edit_mode:
-            bpy.ops.object.mode_set(mode='EDIT')
-
-    return base
-
-
-def flatten_vector_list(ls):
-    '''flatten a list of vetcors to use in foreach_set and the like'''
-    if not ls:
-        return None
-
-    return [i for v in ls for i in v]
-
-
-def list_to_vector_list(list, dimension=3):
-    '''make Vector objects out of a list'''
-    #test if list contains right number of elements
-
-    result = []
-    for i in range(0, len(list), dimension):
-        try:
-            vec = mathutils.Vector([list[i + ind] for ind in range(dimension)])
-        except:
-            print('Number of elemnts doesnt match into the vectors.')
-            return None
-
-        result.append(vec)
-
-    return result
diff --git a/release/scripts/addons/netrender/balancing.py b/release/scripts/addons/netrender/balancing.py
index cd2f12d..ee34745 100644
--- a/release/scripts/addons/netrender/balancing.py
+++ b/release/scripts/addons/netrender/balancing.py
@@ -167,7 +167,7 @@ class NewJobPriority(PriorityRule):
         return "Priority to new jobs"
 
     def test(self, job):
-        return job.countFrames(status = FRAME_DONE) < self.limit
+        return job.countFrames(status = netrender.model.FRAME_DONE) < self.limit
     def serialize(self):
         return { "type": "priority",
                  "enabled": self.enabled,
@@ -193,7 +193,7 @@ class MinimumTimeBetweenDispatchPriority(PriorityRule):
         return "Priority to jobs that haven't been dispatched recently"
 
     def test(self, job):
-        return job.countFrames(status = FRAME_DISPATCHED) == 0 and (time.time() - job.last_dispatched) / 60 > self.limit
+        return job.countFrames(status = netrender.model.FRAME_DISPATCHED) == 0 and (time.time() - job.last_dispatched) / 60 > self.limit
 
     def serialize(self):
         return { "type": "priority",
@@ -214,7 +214,7 @@ class ExcludeQueuedEmptyJob(ExclusionRule):
         return "Exclude non queued or empty jobs"
 
     def test(self, job):
-        return job.status != JOB_QUEUED or job.countFrames(status = FRAME_QUEUED) == 0
+        return job.status != netrender.model.JOB_QUEUED or job.countFrames(status = netrender.model.FRAME_QUEUED) == 0
     
     def serialize(self):
         return { "type": "exception",
diff --git a/release/scripts/addons/netrender/client.py b/release/scripts/addons/netrender/client.py
index 069d5bd..3cb0b43 100644
--- a/release/scripts/addons/netrender/client.py
+++ b/release/scripts/addons/netrender/client.py
@@ -104,6 +104,9 @@ def fillCommonJobSettings(job, job_name, netsettings):
         job.render = netsettings.job_render_engine_other
     else:
         job.render = netsettings.job_render_engine
+        
+    if netsettings.job_tags:
+        job.tags.update(netsettings.job_tags.split(";"))
      
     if netsettings.job_type == "JOB_BLENDER":
         job.type = netrender.model.JOB_BLENDER
@@ -443,9 +446,7 @@ class NetworkRenderEngine(bpy.types.RenderEngine):
             result_path = os.path.join(bpy.path.abspath(netsettings.path), "output.exr")
             
             folder = os.path.split(result_path)[0]
-            
-            if not os.path.exists(folder):
-                os.mkdir(folder)
+            verifyCreateDir(folder)
 
             f = open(result_path, "wb")
 
diff --git a/release/scripts/addons/netrender/js/netrender.js b/release/scripts/addons/netrender/js/netrender.js
index 5dc61ef..edb6d20 100644
--- a/release/scripts/addons/netrender/js/netrender.js
+++ b/release/scripts/addons/netrender/js/netrender.js
@@ -225,7 +225,7 @@ function setupConfigPanel() {
 		return "";
 	}
 
-	createPanelwidget("body", "configure", "Confgiguration", "");
+	createPanelwidget("body", "configure", "Configuration", "");
 	createTabswidget("#configure_Panelcontent", "conf", [{
 		name : "Rules",
 		f_content : confTab
diff --git a/release/scripts/addons/netrender/master.py b/release/scripts/addons/netrender/master.py
index d5989f8..593ee72 100644
--- a/release/scripts/addons/netrender/master.py
+++ b/release/scripts/addons/netrender/master.py
@@ -91,7 +91,7 @@ class MRenderJob(netrender.model.RenderJob):
             self.chunks = 1
 
         # Force WAITING status on creation
-        self.status = JOB_WAITING
+        self.status = netrender.model.JOB_WAITING
 
         # special server properties
         self.last_update = 0
@@ -135,25 +135,25 @@ class MRenderJob(netrender.model.RenderJob):
 
     def testFinished(self):
         for f in self.frames:
-            if f.status == FRAME_QUEUED or f.status == FRAME_DISPATCHED:
+            if f.status == netrender.model.FRAME_QUEUED or f.status == netrender.model.FRAME_DISPATCHED:
                 break
         else:
-            self.status = JOB_FINISHED
+            self.status = netrender.model.JOB_FINISHED
             self.finish_time=time.time()
 
     def pause(self, status = None):
-        if self.status not in {JOB_PAUSED, JOB_QUEUED}:
+        if self.status not in {netrender.model.JOB_PAUSED, netrender.model.JOB_QUEUED}:
             return
 
         if status is None:
-            self.status = JOB_PAUSED if self.status == JOB_QUEUED else JOB_QUEUED
+            self.status = netrender.model.JOB_PAUSED if self.status == netrender.model.JOB_QUEUED else netrender.model.JOB_QUEUED
         elif status:
-            self.status = JOB_QUEUED
+            self.status = netrender.model.JOB_QUEUED
         else:
-            self.status = JOB_PAUSED
+            self.status = netrender.model.JOB_PAUSED
 
     def start(self):
-        self.status = JOB_QUEUED
+        self.status = netrender.model.JOB_QUEUED
         
 
     def addLog(self, frames):
@@ -176,12 +176,12 @@ class MRenderJob(netrender.model.RenderJob):
             f.reset(all)
             
         if all:
-            self.status = JOB_QUEUED
+            self.status = netrender.model.JOB_QUEUED
 
     def getFrames(self):
         frames = []
         for f in self.frames:
-            if f.status == FRAME_QUEUED:
+            if f.status == netrender.model.FRAME_QUEUED:
                 self.last_dispatched = time.time()
                 frames.append(f)
                 if len(frames) >= self.chunks:
@@ -198,7 +198,7 @@ class MRenderFrame(netrender.model.RenderFrame):
         self.number = frame
         self.slave = None
         self.time = 0
-        self.status = FRAME_QUEUED
+        self.status = netrender.model.FRAME_QUEUED
         self.command = command
 
         self.log_path = None
@@ -210,11 +210,11 @@ class MRenderFrame(netrender.model.RenderFrame):
         return "%06d.exr" % self.number
 
     def reset(self, all):
-        if all or self.status == FRAME_ERROR:
+        if all or self.status == netrender.model.FRAME_ERROR:
             self.log_path = None
             self.slave = None
             self.time = 0
-            self.status = FRAME_QUEUED
+            self.status = netrender.model.FRAME_QUEUED
 
 
 # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@@ -311,9 +311,9 @@ class RenderHandler(http.server.BaseHTTPRequestHandler):
                     frame = job[frame_number]
 
                     if frame:
-                        if frame.status in (FRAME_QUEUED, FRAME_DISPATCHED):
+                        if frame.status in (netrender.model.FRAME_QUEUED, netrender.model.FRAME_DISPATCHED):
                             self.send_head(http.client.ACCEPTED)
-                        elif frame.status == FRAME_DONE:
+                        elif frame.status == netrender.model.FRAME_DONE:
                             self.server.stats("", "Sending result to client")
 
                             filename = job.getResultPath(frame.getRenderFilename())
@@ -322,7 +322,7 @@ class RenderHandler(http.server.BaseHTTPRequestHandler):
                             self.send_head(content = "image/x-exr")
                             shutil.copyfileobj(f, self.wfile)
                             f.close()
-                        elif frame.status == FRAME_ERROR:
+                        elif frame.status == netrender.model.FRAME_ERROR:
                             self.send_head(http.client.PARTIAL_CONTENT)
                     else:
                         # no such frame
@@ -348,7 +348,7 @@ class RenderHandler(http.server.BaseHTTPRequestHandler):
                     zip_filepath = job.getResultPath("results.zip")
                     with zipfile.ZipFile(zip_filepath, "w") as zfile:
                         for frame in job.frames:
-                            if frame.status == FRAME_DONE:
+                            if frame.status == netrender.model.FRAME_DONE:
                                 for filename in frame.results:
                                     filepath = job.getResultPath(filename)
                                     
@@ -379,9 +379,9 @@ class RenderHandler(http.server.BaseHTTPRequestHandler):
                     frame = job[frame_number]
 
                     if frame:
-                        if frame.status in (FRAME_QUEUED, FRAME_DISPATCHED):
+                        if frame.status in (netrender.model.FRAME_QUEUED, netrender.model.FRAME_DISPATCHED):
                             self.send_head(http.client.ACCEPTED)
-                        elif frame.status == FRAME_DONE:
+                        elif frame.status == netrender.model.FRAME_DONE:
                             filename = job.getResultPath(frame.getRenderFilename())
 
                             thumbname = thumbnail.generate(filename)
@@ -394,7 +394,7 @@ class RenderHandler(http.server.BaseHTTPRequestHandler):
                             else: # thumbnail couldn't be generated
                                 self.send_head(http.client.PARTIAL_CONTENT)
                                 return
-                        elif frame.status == FRAME_ERROR:
+                        elif frame.status == netrender.model.FRAME_ERROR:
                             self.send_head(http.client.PARTIAL_CONTENT)
                     else:
                         # no such frame
@@ -419,7 +419,7 @@ class RenderHandler(http.server.BaseHTTPRequestHandler):
                     frame = job[frame_number]
 
                     if frame:
-                        if not frame.log_path or frame.status in (FRAME_QUEUED, FRAME_DISPATCHED):
+                        if not frame.log_path or frame.status in (netrender.model.FRAME_QUEUED, netrender.model.FRAME_DISPATCHED):
                             self.send_head(http.client.PROCESSING)
                         else:
                             self.server.stats("", "Sending log to client")
@@ -488,7 +488,7 @@ class RenderHandler(http.server.BaseHTTPRequestHandler):
                 if job and frames:
                     for f in frames:
                         print("dispatch", f.number)
-                        f.status = FRAME_DISPATCHED
+                        f.status = netrender.model.FRAME_DISPATCHED
                         f.slave = slave
 
                     slave.job = job
@@ -838,11 +838,11 @@ class RenderHandler(http.server.BaseHTTPRequestHandler):
                         self.send_head(content = None)
 
                         if job.hasRenderResult():
-                            if job_result == FRAME_DONE:
+                            if job_result == netrender.model.FRAME_DONE:
                                 frame.addDefaultRenderResult()
                                 self.write_file(job.getResultPath(frame.getRenderFilename()))
 
-                            elif job_result == FRAME_ERROR:
+                            elif job_result == netrender.model.FRAME_ERROR:
                                 # blacklist slave on this job on error
                                 # slaves might already be in blacklist if errors on the whole chunk
                                 if not slave.id in job.blacklist:
@@ -885,7 +885,7 @@ class RenderHandler(http.server.BaseHTTPRequestHandler):
                         
                         self.send_head(content = None)
 
-                        if job_result == FRAME_DONE:
+                        if job_result == netrender.model.FRAME_DONE:
                             result_filename = self.headers['result-filename']
                             
                             frame.results.append(result_filename)
@@ -979,8 +979,7 @@ class RenderMasterServer(socketserver.ThreadingMixIn, http.server.HTTPServer):
         else:
             self.path = path
 
-        if not os.path.exists(self.path):
-            os.mkdir(self.path)
+        verifyCreateDir(self.path)
 
         self.slave_timeout = 5 # 5 mins: need a parameter for that
 
@@ -1046,7 +1045,7 @@ class RenderMasterServer(socketserver.ThreadingMixIn, http.server.HTTPServer):
 
                 if slave.job:
                     for f in slave.job_frames:
-                        slave.job[f].status = FRAME_ERROR
+                        slave.job[f].status = netrender.model.FRAME_ERROR
 
         for slave in removed:
             self.removeSlave(slave)
@@ -1076,7 +1075,7 @@ class RenderMasterServer(socketserver.ThreadingMixIn, http.server.HTTPServer):
     def getJobs(self):
         return self.jobs
 
-    def countJobs(self, status = JOB_QUEUED):
+    def countJobs(self, status = netrender.model.JOB_QUEUED):
         total = 0
         for j in self.jobs:
             if j.status == status:
@@ -1105,8 +1104,7 @@ class RenderMasterServer(socketserver.ThreadingMixIn, http.server.HTTPServer):
 
         # create job directory
         job.save_path = os.path.join(self.path, "job_" + job.id)
-        if not os.path.exists(job.save_path):
-            os.mkdir(job.save_path)
+        verifyCreateDir(job.save_path)
 
         job.save()
 
diff --git a/release/scripts/addons/netrender/master_html.py b/release/scripts/addons/netrender/master_html.py
index 39c7f81..8ee0fe4 100644
--- a/release/scripts/addons/netrender/master_html.py
+++ b/release/scripts/addons/netrender/master_html.py
@@ -134,16 +134,16 @@ def get(handler):
              serializedJob = job.serialize(withFiles=includeFiles, withFrames=includeFrames)
              serializedJob["p_rule"] = handler.server.balancer.applyPriorities(job)
              serializedJob["e_rule"] = handler.server.balancer.applyExceptions(job)
-             serializedJob["wait"] = int(time.time() - job.last_dispatched) if job.status != JOB_FINISHED else "N/A"
+             serializedJob["wait"] = int(time.time() - job.last_dispatched) if job.status != netrender.model.JOB_FINISHED else "N/A"
              serializedJob["length"] = len(job);
-             serializedJob["done"] = results[FRAME_DONE]
-             serializedJob["dispatched"] = results[FRAME_DISPATCHED]
-             serializedJob["error"] = results[FRAME_ERROR]
+             serializedJob["done"] = results[netrender.model.FRAME_DONE]
+             serializedJob["dispatched"] = results[netrender.model.FRAME_DISPATCHED]
+             serializedJob["error"] = results[netrender.model.FRAME_ERROR]
              tot_cache, tot_fluid, tot_other = countFiles(job)
              serializedJob["totcache"] = tot_cache
              serializedJob["totfluid"] = tot_fluid
              serializedJob["totother"] = tot_other  
-             serializedJob["wktime"] = (time.time()-job.start_time ) if job.status != JOB_FINISHED else (job.finish_time-job.start_time)             
+             serializedJob["wktime"] = (time.time()-job.start_time ) if job.status != netrender.model.JOB_FINISHED else (job.finish_time-job.start_time)             
         else:
              serializedJob={"name":"invalid job"}
            
@@ -327,13 +327,19 @@ def get(handler):
                         "dispatched",
                         "error",
                         "priority",
-                        "exception"
+                        "exception",
+                        "started",
+                        "finished"
                     )
 
         handler.server.balance()
 
         for job in handler.server.jobs:
             results = job.framesStatus()
+            
+            time_finished = job.time_finished
+            time_started = job.time_started
+            
             rowTable(
                         """<button title="cancel job" onclick="cancel_job('%s');">X</button>""" % job.id +
                         """<button title="pause job" onclick="request('/pause_%s', null);">P</button>""" % job.id +
@@ -350,15 +356,17 @@ def get(handler):
                         """<button title="increase priority" onclick="request('/edit_%s', "{'priority': %i}");">+</button>""" % (job.id, job.priority + 1) +
                         """<button title="decrease priority" onclick="request('/edit_%s', "{'priority': %i}");" %s>-</button>""" % (job.id, job.priority - 1, "disabled=True" if job.priority == 1 else ""),
                         "%0.1f%%" % (job.usage * 100),
-                        "%is" % int(time.time() - job.last_dispatched) if job.status != JOB_FINISHED else "N/A",
+                        "%is" % int(time.time() - job.last_dispatched) if job.status != netrender.model.JOB_FINISHED else "N/A",
                         job.statusText(),
                         len(job),
-                        results[FRAME_DONE],
-                        results[FRAME_DISPATCHED],
-                        str(results[FRAME_ERROR]) +
-                        """<button title="reset error frames" onclick="request('/reset_%s_0', null);" %s>R</button>""" % (job.id, "disabled=True" if not results[FRAME_ERROR] else ""),
+                        results[netrender.model.FRAME_DONE],
+                        results[netrender.model.FRAME_DISPATCHED],
+                        str(results[netrender.model.FRAME_ERROR]) +
+                        """<button title="reset error frames" onclick="request('/reset_%s_0', null);" %s>R</button>""" % (job.id, "disabled=True" if not results[netrender.model.FRAME_ERROR] else ""),
                         "yes" if handler.server.balancer.applyPriorities(job) else "no",
-                        "yes" if handler.server.balancer.applyExceptions(job) else "no"
+                        "yes" if handler.server.balancer.applyExceptions(job) else "no",
+                        time.ctime(time_started) if time_started else "Not Started",
+                        time.ctime(time_finished) if time_finished else "Not Finished"
                     )
 
         endTable()
@@ -503,6 +511,16 @@ def get(handler):
 
                 endTable()
 
+            output("<h2>Transitions</h2>")
+
+            startTable()
+            headerTable("Event", "Time")
+
+            for transition, time_value in job.transitions:
+                rowTable(transition, time.ctime(time_value))
+
+            endTable()
+
             output("<h2>Frames</h2>")
 
             startTable()
@@ -518,7 +536,7 @@ def get(handler):
                              frame.slave.name if frame.slave else " ",
                              link("view log", logURL(job_id, frame.number)) if frame.log_path else " ",
                              link("view result", renderURL(job_id, frame.number))  + " [" +
-                             tag("span", "show", attr="class='thumb' onclick='showThumb(%s, %i)'" % (job.id, frame.number)) + "]" if frame.status == FRAME_DONE else " ",
+                             tag("span", "show", attr="class='thumb' onclick='showThumb(%s, %i)'" % (job.id, frame.number)) + "]" if frame.status == netrender.model.FRAME_DONE else " ",
                              "<img name='thumb%i' title='hide thumbnails' src='' class='thumb' onclick='showThumb(%s, %i)'>" % (frame.number, job.id, frame.number)
                              )
             else:
diff --git a/release/scripts/addons/netrender/model.py b/release/scripts/addons/netrender/model.py
index d4d00bb..4153f93 100644
--- a/release/scripts/addons/netrender/model.py
+++ b/release/scripts/addons/netrender/model.py
@@ -19,6 +19,70 @@
 import netrender.versioning as versioning
 from netrender.utils import *
 
+import time
+
+# Jobs status
+JOB_WAITING = 0 # before all data has been entered
+JOB_PAUSED = 1 # paused by user
+JOB_FINISHED = 2 # finished rendering
+JOB_QUEUED = 3 # ready to be dispatched
+
+JOB_STATUS_TEXT = {
+        JOB_WAITING: "Waiting",
+        JOB_PAUSED: "Paused",
+        JOB_FINISHED: "Finished",
+        JOB_QUEUED: "Queued"
+        }
+
+JOB_TRANSITION_STARTED = "Started"
+JOB_TRANSITION_PAUSED = "Paused"
+JOB_TRANSITION_RESUMED = "Resumed"
+JOB_TRANSITION_FINISHED = "Finished"
+JOB_TRANSITION_RESTARTED = "Restarted"
+
+JOB_TRANSITIONS = {
+       (JOB_WAITING, JOB_QUEUED) : JOB_TRANSITION_STARTED,
+       (JOB_QUEUED, JOB_PAUSED) : JOB_TRANSITION_PAUSED,
+       (JOB_PAUSED, JOB_QUEUED) : JOB_TRANSITION_RESUMED,
+       (JOB_QUEUED, JOB_FINISHED) : JOB_TRANSITION_FINISHED,
+       (JOB_FINISHED, JOB_QUEUED) : JOB_TRANSITION_RESTARTED
+       }
+
+# Job types (depends on the dependency type)
+JOB_BLENDER = 1
+JOB_PROCESS = 2
+JOB_VCS     = 3
+
+JOB_TYPES = {
+                JOB_BLENDER: "Blender",
+                JOB_PROCESS: "Process",
+                JOB_VCS:     "Versioned",
+            }
+
+JOB_SUB_RENDER = 1
+JOB_SUB_BAKING = 2
+
+# Job subtypes
+JOB_SUBTYPES = {
+                JOB_SUB_RENDER: "Render",
+                JOB_SUB_BAKING: "Baking",
+            }
+
+
+# Frames status
+FRAME_QUEUED = 0
+FRAME_DISPATCHED = 1
+FRAME_DONE = 2
+FRAME_ERROR = 3
+
+FRAME_STATUS_TEXT = {
+        FRAME_QUEUED: "Queued",
+        FRAME_DISPATCHED: "Dispatched",
+        FRAME_DONE: "Done",
+        FRAME_ERROR: "Error"
+        }
+
+# Tags
 TAG_BAKING = "baking"
 TAG_RENDER = "render"
 
@@ -106,24 +170,6 @@ class RenderSlave:
 
         return slave
 
-JOB_BLENDER = 1
-JOB_PROCESS = 2
-JOB_VCS     = 3
-
-JOB_TYPES = {
-                JOB_BLENDER: "Blender",
-                JOB_PROCESS: "Process",
-                JOB_VCS:     "Versioned",
-            }
-
-JOB_SUB_RENDER = 1
-JOB_SUB_BAKING = 2
-
-JOB_SUBTYPES = {
-                JOB_SUB_RENDER: "Render",
-                JOB_SUB_BAKING: "Baking",
-            }
-
 class VersioningInfo:
     def __init__(self, info = None):
         self._system = None
@@ -219,7 +265,10 @@ class RenderJob:
         self.usage = 0.0
         self.last_dispatched = 0.0
         self.frames = []
-
+        self.transitions = []
+        
+        self._status = None
+        
         if info:
             self.type = info.type
             self.subtype = info.subtype
@@ -247,6 +296,39 @@ class RenderJob:
             self.version_info = None
             self.render = "BLENDER_RENDER"
 
+    @property
+    def status(self):
+        """Status of the job (waiting, paused, finished or queued)"""
+        return self._status
+    
+    @status.setter
+    def status(self, value):
+        transition = JOB_TRANSITIONS.get((self.status, value), None)
+        if transition:
+            self.transitions.append((transition, time.time()))
+            
+        self._status = value
+
+    @property
+    def time_started(self):
+        started_time = None
+        for transition, time_value in self.transitions:
+            if transition == JOB_TRANSITION_STARTED:
+                started_time = time_value
+                break
+            
+        return started_time
+
+    @property
+    def time_finished(self):
+        finished_time = None
+        if self.status == JOB_FINISHED:
+            for transition, time_value in self.transitions:
+                if transition == JOB_TRANSITION_FINISHED:
+                    finished_time = time_value
+            
+        return finished_time
+
     def hasRenderResult(self):
         return self.subtype == JOB_SUB_RENDER
 
@@ -332,6 +414,7 @@ class RenderJob:
                             "category": self.category,
                             "tags": tuple(self.tags),
                             "status": self.status,
+                            "transitions": self.transitions,
                             "chunks": self.chunks,
                             "priority": self.priority,
                             "usage": self.usage,
@@ -361,6 +444,7 @@ class RenderJob:
         job.category = data["category"]
         job.tags = set(data["tags"])
         job.status = data["status"]
+        job.transitions = data["transitions"]
         job.files = [RenderFile.materialize(f) for f in data["files"]]
         job.frames = [RenderFrame.materialize(f) for f in data["frames"]]
         job.chunks = data["chunks"]
diff --git a/release/scripts/addons/netrender/operators.py b/release/scripts/addons/netrender/operators.py
index c6ff091..74b2a28 100644
--- a/release/scripts/addons/netrender/operators.py
+++ b/release/scripts/addons/netrender/operators.py
@@ -410,15 +410,16 @@ class netclientdownload(bpy.types.Operator):
             nb_missing = 0
                 
             for frame in job.frames:
-                if frame.status == FRAME_DONE:
+                if frame.status == netrender.model.FRAME_DONE:
                     finished_frames.append(frame.number)
-                elif frame.status == FRAME_ERROR:
+                elif frame.status == netrender.model.FRAME_ERROR:
                     nb_error += 1
                 else:
                     nb_missing += 1
             
             if not finished_frames:
-                return
+                self.report({'ERROR'}, "Job doesn't have any finished frames")
+                return {'ERROR'}
             
             frame_ranges = []
     
diff --git a/release/scripts/addons/netrender/slave.py b/release/scripts/addons/netrender/slave.py
index fe3979a..bf3819b 100644
--- a/release/scripts/addons/netrender/slave.py
+++ b/release/scripts/addons/netrender/slave.py
@@ -46,6 +46,13 @@ def slave_Info(netsettings):
     slave.stats = sysname + " " + release + " " + machine + " " + processor
     if netsettings.slave_tags:
         slave.tags = set(netsettings.slave_tags.split(";"))
+    
+    if netsettings.slave_bake:
+        slave.tags.add(netrender.model.TAG_BAKING)
+    
+    if netsettings.slave_render:
+        slave.tags.add(netrender.model.TAG_RENDER)
+        
     return slave
 
 def testCancel(conn, job_id, frame_number):
@@ -58,8 +65,8 @@ def testCancel(conn, job_id, frame_number):
         else:
             return False
 
-def testFile(conn, job_id, slave_id, rfile, JOB_PREFIX, main_path=None):
-    job_full_path = createLocalPath(rfile, JOB_PREFIX, main_path, rfile.force)
+def testFile(conn, job_id, slave_id, rfile, job_prefix, main_path=None):
+    job_full_path = createLocalPath(rfile, job_prefix, main_path, rfile.force)
     
     found = os.path.exists(job_full_path)
     
@@ -73,9 +80,9 @@ def testFile(conn, job_id, slave_id, rfile, JOB_PREFIX, main_path=None):
 
     if not found:
         # Force prefix path if not found
-        job_full_path = createLocalPath(rfile, JOB_PREFIX, main_path, True)
+        job_full_path = createLocalPath(rfile, job_prefix, main_path, True)
         print("Downloading", job_full_path)
-        temp_path = os.path.join(JOB_PREFIX, "slave.temp")
+        temp_path = os.path.join(job_prefix, "slave.temp")
         with ConnectionContext():
             conn.request("GET", fileURL(job_id, rfile.index), headers={"slave-id":slave_id})
         response = conn.getresponse()
@@ -144,8 +151,7 @@ def render_slave(engine, netsettings, threads):
         slave_id = response.getheader("slave-id")
 
         NODE_PREFIX = os.path.join(slave_path, "slave_" + slave_id)
-        if not os.path.exists(NODE_PREFIX):
-            os.mkdir(NODE_PREFIX)
+        verifyCreateDir(NODE_PREFIX)
 
         engine.update_stats("", "Network render connected to master, waiting for jobs")
 
@@ -160,25 +166,24 @@ def render_slave(engine, netsettings, threads):
                 job = netrender.model.RenderJob.materialize(json.loads(str(response.read(), encoding='utf8')))
                 engine.update_stats("", "Network render processing job from master")
 
-                JOB_PREFIX = os.path.join(NODE_PREFIX, "job_" + job.id)
-                if not os.path.exists(JOB_PREFIX):
-                    os.mkdir(JOB_PREFIX)
+                job_prefix = os.path.join(NODE_PREFIX, "job_" + job.id)
+                verifyCreateDir(job_prefix)
 
                 # set tempdir for fsaa temp files
                 # have to set environ var because render is done in a subprocess and that's the easiest way to propagate the setting
-                os.environ["TMP"] = JOB_PREFIX
+                os.environ["TMP"] = job_prefix
 
 
                 if job.type == netrender.model.JOB_BLENDER:
                     job_path = job.files[0].original_path # original path of the first file
                     main_path, main_file = os.path.split(job_path)
 
-                    job_full_path = testFile(conn, job.id, slave_id, job.files[0], JOB_PREFIX)
+                    job_full_path = testFile(conn, job.id, slave_id, job.files[0], job_prefix)
                     print("Fullpath", job_full_path)
                     print("File:", main_file, "and %i other files" % (len(job.files) - 1,))
 
                     for rfile in job.files[1:]:
-                        testFile(conn, job.id, slave_id, rfile, JOB_PREFIX, main_path)
+                        testFile(conn, job.id, slave_id, rfile, job_prefix, main_path)
                         print("\t", rfile.filepath)
                         
                     netrender.repath.update(job)
@@ -220,7 +225,7 @@ def render_slave(engine, netsettings, threads):
                         frame_args += ["-f", str(frame.number)]
 
                     with NoErrorDialogContext():
-                        process = subprocess.Popen([BLENDER_PATH, "-b", "-noaudio", job_full_path, "-t", str(threads), "-o", os.path.join(JOB_PREFIX, "######"), "-E", job.render, "-F", "MULTILAYER"] + frame_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+                        process = subprocess.Popen([BLENDER_PATH, "-b", "-noaudio", job_full_path, "-t", str(threads), "-o", os.path.join(job_prefix, "######"), "-E", job.render, "-F", "MULTILAYER"] + frame_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
                         
                 elif job.subtype == netrender.model.JOB_SUB_BAKING:
                     tasks = []
@@ -349,13 +354,13 @@ def render_slave(engine, netsettings, threads):
 
 
                 if status == 0: # non zero status is error
-                    headers["job-result"] = str(FRAME_DONE)
+                    headers["job-result"] = str(netrender.model.FRAME_DONE)
                     for frame in job.frames:
                         headers["job-frame"] = str(frame.number)
                         if job.hasRenderResult():
                             # send image back to server
 
-                            filename = os.path.join(JOB_PREFIX, "%06d.exr" % frame.number)
+                            filename = os.path.join(job_prefix, "%06d.exr" % frame.number)
 
                             # thumbnail first
                             if netsettings.use_slave_thumb:
@@ -398,7 +403,7 @@ def render_slave(engine, netsettings, threads):
                             if responseStatus(conn) == http.client.NO_CONTENT:
                                 continue
                 else:
-                    headers["job-result"] = str(FRAME_ERROR)
+                    headers["job-result"] = str(netrender.model.FRAME_ERROR)
                     for frame in job.frames:
                         headers["job-frame"] = str(frame.number)
                         # send error result back to server
diff --git a/release/scripts/addons/netrender/ui.py b/release/scripts/addons/netrender/ui.py
index f1d6283..4aa085c 100644
--- a/release/scripts/addons/netrender/ui.py
+++ b/release/scripts/addons/netrender/ui.py
@@ -26,7 +26,7 @@ from netrender.utils import *
 
 from bpy.props import PointerProperty, StringProperty, BoolProperty, EnumProperty, IntProperty, CollectionProperty
 
-VERSION = b"0.3"
+VERSION = b"0.5"
 
 PATH_PREFIX = "/tmp/"
 
@@ -164,6 +164,8 @@ class RENDER_PT_network_slave_settings(NetRenderButtonsPanel, bpy.types.Panel):
         netsettings = context.scene.network_render
 
         layout.prop(netsettings, "slave_tags", text="Tags")
+        layout.prop(netsettings, "slave_render")
+        layout.prop(netsettings, "slave_bake")
         layout.prop(netsettings, "use_slave_clear")
         layout.prop(netsettings, "use_slave_thumb")
         layout.prop(netsettings, "use_slave_output_log")
@@ -350,8 +352,8 @@ class RENDER_PT_network_jobs(NeedValidAddress, NetRenderButtonsPanel, bpy.types.
 
             layout.label(text="Name: %s" % job.name)
             layout.label(text="Length: %04i" % len(job))
-            layout.label(text="Done: %04i" % job.results[FRAME_DONE])
-            layout.label(text="Error: %04i" % job.results[FRAME_ERROR])
+            layout.label(text="Done: %04i" % job.results[netrender.model.FRAME_DONE])
+            layout.label(text="Error: %04i" % job.results[netrender.model.FRAME_ERROR])
 
 import bl_ui.properties_render as properties_render
 class RENDER_PT_network_output(NeedValidAddress, NetRenderButtonsPanel, bpy.types.Panel):
@@ -450,6 +452,16 @@ class NetRenderSettings(bpy.types.PropertyGroup):
                         description="Output render text log to console as well as sending it to the master",
                         default = True)
         
+        NetRenderSettings.slave_render = BoolProperty(
+                        name="Render on slave",
+                        description="Use slave for render jobs",
+                        default = True)
+
+        NetRenderSettings.slave_bake = BoolProperty(
+                        name="Bake on slave",
+                        description="Use slave for baking jobs",
+                        default = True)
+
         NetRenderSettings.use_master_clear = BoolProperty(
                         name="Clear on exit",
                         description="Delete saved files on exit",
diff --git a/release/scripts/addons/netrender/utils.py b/release/scripts/addons/netrender/utils.py
index c173e02..ac21921 100644
--- a/release/scripts/addons/netrender/utils.py
+++ b/release/scripts/addons/netrender/utils.py
@@ -30,33 +30,6 @@ except:
 
 VERSION = bytes(".".join((str(n) for n in netrender.bl_info["version"])), encoding='utf8')
 
-# Jobs status
-JOB_WAITING = 0 # before all data has been entered
-JOB_PAUSED = 1 # paused by user
-JOB_FINISHED = 2 # finished rendering
-JOB_QUEUED = 3 # ready to be dispatched
-
-JOB_STATUS_TEXT = {
-        JOB_WAITING: "Waiting",
-        JOB_PAUSED: "Paused",
-        JOB_FINISHED: "Finished",
-        JOB_QUEUED: "Queued"
-        }
-
-
-# Frames status
-FRAME_QUEUED = 0
-FRAME_DISPATCHED = 1
-FRAME_DONE = 2
-FRAME_ERROR = 3
-
-FRAME_STATUS_TEXT = {
-        FRAME_QUEUED: "Queued",
-        FRAME_DISPATCHED: "Dispatched",
-        FRAME_DONE: "Done",
-        FRAME_ERROR: "Error"
-        }
-
 try:
     system = platform.system()
 except UnicodeDecodeError:
@@ -269,6 +242,23 @@ def hashData(data):
     m.update(data)
     return m.hexdigest()
 
+def verifyCreateDir(directory_path):
+    original_path = directory_path
+    directory_path = os.path.expanduser(directory_path)
+    directory_path = os.path.expandvars(directory_path)
+    if not os.path.exists(directory_path):
+        try:
+            os.makedirs(directory_path)
+            print("Created directory:", directory_path)
+            if original_path != directory_path:
+                print("Expanded from the following path:", original_path)
+        except:
+            print("Couldn't create directory:", directory_path)
+            if original_path != directory_path:
+                print("Expanded from the following path:", original_path)
+            raise
+    
+
 def cacheName(ob, point_cache):
     name = point_cache.name
     if name == "":
@@ -332,9 +322,7 @@ def createLocalPath(rfile, prefixdirectory, prefixpath, forcelocal):
                     suffix = os.path.join(last, suffix)
 
                 directory = os.path.join(prefixdirectory, suffix)
-                
-                if not os.path.exists(directory):
-                    os.mkdir(directory)
+                verifyCreateDir(directory)
 
                 finalpath = os.path.join(directory, name)
             else:
@@ -350,8 +338,7 @@ def createLocalPath(rfile, prefixdirectory, prefixpath, forcelocal):
         directory = directory.replace("../")
         directory = os.path.join(prefixdirectory, directory)
 
-        if not os.path.exists(directory):
-            os.mkdir(directory)
+        verifyCreateDir(directory)
 
         finalpath = os.path.join(directory, name)
 
diff --git a/release/scripts/addons/object_cloud_gen.py b/release/scripts/addons/object_cloud_gen.py
index dc23172..607eaf0 100644
--- a/release/scripts/addons/object_cloud_gen.py
+++ b/release/scripts/addons/object_cloud_gen.py
@@ -16,23 +16,24 @@
 #
 # ##### END GPL LICENSE BLOCK #####
 
+# <pep8 compliant>
+
 bl_info = {
     "name": "Cloud Generator",
     "author": "Nick Keeline(nrk)",
-    "version": (1,0),
+    "version": (1, 0),
     "blender": (2, 5, 9),
     "location": "View3D > Tool Shelf > Cloud Generator Panel",
     "description": "Creates Volumetric Clouds",
-    "warning": "",
-    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
-        "Scripts/Object/Cloud_Gen",
-    "tracker_url": "https://projects.blender.org/tracker/index.php?"\
-        "func=detail&aid=22015",
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"
+                "Scripts/Object/Cloud_Gen",
+    "tracker_url": "https://projects.blender.org/tracker/index.php?"
+                   "func=detail&aid=22015",
     "category": "Object"}
 
 import bpy
-from math import *
-from bpy.props import *
+from bpy.props import BoolProperty, EnumProperty
+from bpy.types import Operator, Panel
 
 
 # This routine takes an object and deletes all of the geometry in it
@@ -40,24 +41,25 @@ from bpy.props import *
 # It will add or subtract the bound box size by the variable sizeDifference.
 
 def getMeshandPutinEditMode(scene, object):
-    
-     # Go into Object Mode
-    bpy.ops.object.mode_set(mode='OBJECT')   
-    
+
+    # Go into Object Mode
+    bpy.ops.object.mode_set(mode='OBJECT')
+
     # Deselect All
     bpy.ops.object.select_all(action='DESELECT')
 
     # Select the object
     object.select = True
     scene.objects.active = object
-    
+
     # Go into Edit Mode
     bpy.ops.object.mode_set(mode='EDIT')
 
     return object.data
-   
+
+
 def maxAndMinVerts(scene, object):
-    
+
     mesh = getMeshandPutinEditMode(scene, object)
     verts = mesh.vertices
 
@@ -82,12 +84,14 @@ def maxAndMinVerts(scene, object):
             minVert[1] = vert.co[1]
         if vert.co[2] < minVert[2]:
             minVert[2] = vert.co[2]
-            
+
     return [maxVert, minVert]
-    
+
+
 def makeObjectIntoBoundBox(scene, object, sizeDifference, takeFromObject):
-    
-    #Let's find the max and min of the reference object, it can be the same as the destination object
+
+    # Let's find the max and min of the reference object,
+    # it can be the same as the destination object
     [maxVert, minVert] = maxAndMinVerts(scene, takeFromObject)
 
     #get objects mesh
@@ -133,7 +137,7 @@ def makeObjectIntoBoundBox(scene, object, sizeDifference, takeFromObject):
 
     # Delete all geometry from the object.
     bpy.ops.mesh.select_all(action='SELECT')
-    bpy.ops.mesh.delete(type='ALL')
+    bpy.ops.mesh.delete(type='VERT')
 
     # Must be in object mode for from_pydata to work
     bpy.ops.object.mode_set(mode='OBJECT')
@@ -144,6 +148,7 @@ def makeObjectIntoBoundBox(scene, object, sizeDifference, takeFromObject):
     # Update the mesh
     mesh.update()
 
+
 def applyScaleRotLoc(scene, obj):
     # Deselect All
     bpy.ops.object.select_all(action='DESELECT')
@@ -153,7 +158,8 @@ def applyScaleRotLoc(scene, obj):
     scene.objects.active = obj
 
     bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
-   
+
+
 def totallyDeleteObject(scene, obj):
     scene.objects.unlink(obj)
     bpy.data.objects.remove(obj)
@@ -184,17 +190,19 @@ def addNewObject(scene, name, copyobj):
 
     return ob_new
 
+
 def getpdensitytexture(object):
-    
+
     for mslot in object.material_slots:
         mat = mslot.material
         for tslot in mat.texture_slots:
-            if tslot!= 'NoneType':
+            if tslot != 'NoneType':
                 tex = tslot.texture
                 if tex.type == 'POINT_DENSITY':
                     if tex.point_density.point_source == 'PARTICLE_SYSTEM':
                         return tex
-    
+
+
 def removeParticleSystemFromObj(scene, object):
 
     # Deselect All
@@ -208,20 +216,21 @@ def removeParticleSystemFromObj(scene, object):
 
     # Deselect All
     bpy.ops.object.select_all(action='DESELECT')
-    
+
+
 def convertParticlesToMesh(scene, particlesobj, destobj, replacemesh):
-    
+
     # Select the Destination object.
     destobj.select = True
     scene.objects.active = destobj
-    
+
     #Go to Edit Mode
-    bpy.ops.object.mode_set(mode='EDIT',toggle=False)
-    
+    bpy.ops.object.mode_set(mode='EDIT', toggle=False)
+
     #Delete everything in mesh if replace true
     if replacemesh:
         bpy.ops.mesh.select_all(action='SELECT')
-        bpy.ops.mesh.delete(type='ALL')
+        bpy.ops.mesh.delete(type='VERT')
 
     meshPnts = destobj.data
 
@@ -240,6 +249,7 @@ def convertParticlesToMesh(scene, particlesobj, destobj, replacemesh):
     # Update the mesh.
     meshPnts.update()
 
+
 def combineObjects(scene, combined, listobjs):
     # scene is the current scene
     # combined is the object we want to combine everything into
@@ -266,9 +276,10 @@ def combineObjects(scene, combined, listobjs):
             # Apply modifier
             bpy.ops.object.modifier_apply(apply_as='DATA', modifier=union[0].name)
 
+
 # Returns the action we want to take
 def getActionToDo(obj):
-    
+
     if not obj or obj.type != 'MESH':
         return 'NOT_OBJ_DO_NOTHING'
     elif obj is None:
@@ -276,7 +287,7 @@ def getActionToDo(obj):
     elif "CloudMember" in obj:
         if obj["CloudMember"] != None:
             if obj["CloudMember"] == "MainObj":
-                return 'DEGENERATE'            
+                return 'DEGENERATE'
             elif obj["CloudMember"] == "CreatedObj" and len(obj.particle_systems) > 0:
                 return 'CLOUD_CONVERT_TO_MESH'
             else:
@@ -286,7 +297,8 @@ def getActionToDo(obj):
     else:
         return 'DO_NOTHING'
 
-class VIEW3D_PT_tools_cloud(bpy.types.Panel):
+
+class VIEW3D_PT_tools_cloud(Panel):
     bl_space_type = 'VIEW_3D'
     bl_region_type = 'TOOLS'
 
@@ -314,7 +326,7 @@ class VIEW3D_PT_tools_cloud(bpy.types.Panel):
         elif WhatToDo == 'CLOUD_DO_NOTHING':
             col.label(text="Must select")
             col.label(text="bound box")
-           
+
         elif WhatToDo == 'GENERATE':
             col.operator("cloud.generate_cloud", text="Generate Cloud")
 
@@ -327,10 +339,10 @@ class VIEW3D_PT_tools_cloud(bpy.types.Panel):
             col.label(text="a cloud")
 
 
-class GenerateCloud(bpy.types.Operator):
+class GenerateCloud(Operator):
+    """Create a Cloud,Undo Cloud, or convert to Mesh Cloud depending on selection"""
     bl_idname = "cloud.generate_cloud"
     bl_label = "Generate Cloud"
-    bl_description = "Create a Cloud,Undo Cloud, or convert to Mesh Cloud depending on selection"
     bl_register = True
     bl_undo = True
 
@@ -339,7 +351,7 @@ class GenerateCloud(bpy.types.Operator):
         if not context.active_object:
             return False
         else:
-            return (context.active_object.type=='MESH')
+            return (context.active_object.type == 'MESH')
 
     def execute(self, context):
         # Make variable that is the current .blend file main data blocks
@@ -367,29 +379,29 @@ class GenerateCloud(bpy.types.Operator):
         if WhatToDo == 'DEGENERATE':
             # Degenerate Cloud
             mainObj = active_object
- 
+
             cloudMembers = active_object.children
- 
+
             createdObjects = []
-            definitionObjects  = []
+            definitionObjects = []
             for member in cloudMembers:
                 applyScaleRotLoc(scene, member)
                 if member["CloudMember"] == "CreatedObj":
                     createdObjects.append(member)
                 else:
                     definitionObjects.append(member)
- 
+
             for defObj in definitionObjects:
                 # Delete cloudmember data from objects
                 if "CloudMember" in defObj:
                     del(defObj["CloudMember"])
- 
+
             for createdObj in createdObjects:
                 totallyDeleteObject(scene, createdObj)
- 
+
             # Delete the blend_data object
             totallyDeleteObject(scene, mainObj)
- 
+
             # Select all of the left over boxes so people can immediately
             # press generate again if they want.
             for eachMember in definitionObjects:
@@ -400,17 +412,17 @@ class GenerateCloud(bpy.types.Operator):
         elif WhatToDo == 'CLOUD_CONVERT_TO_MESH':
 
             cloudParticles = active_object.particle_systems.active
-            
+
             bounds = active_object.parent
-            
+
             ###############Create CloudPnts for putting points in#########
             # Create a new object cloudPnts
             cloudPnts = addNewObject(scene, "CloudPoints", bounds)
             cloudPnts["CloudMember"] = "CreatedObj"
             cloudPnts.draw_type = 'WIRE'
             cloudPnts.hide_render = True
- 
-            makeParent(bounds, cloudPnts, scene) 
+
+            makeParent(bounds, cloudPnts, scene)
 
             convertParticlesToMesh(scene, cloudParticles, cloudPnts, True)
 
@@ -421,7 +433,7 @@ class GenerateCloud(bpy.types.Operator):
             pDensity.point_density.object = cloudPnts
 
             #Let's resize the bound box to be more accurate.
-            how_much_bigger =  pDensity.point_density.radius 
+            how_much_bigger = pDensity.point_density.radius
             makeObjectIntoBoundBox(scene, bounds, how_much_bigger, cloudPnts)
 
         else:
@@ -484,9 +496,9 @@ class GenerateCloud(bpy.types.Operator):
 
             bpy.ops.object.editmode_toggle()
             bpy.ops.mesh.select_all(action='SELECT')
-            
+
             #Don't subdivide object or smooth if smoothing box not checked.
-            if scene.cloudsmoothing:            
+            if scene.cloudsmoothing:
                 bpy.ops.mesh.subdivide(number_cuts=2, fractal=0, smoothness=1)
  #               bpy.ops.object.transform_apply(location=True)
                 bpy.ops.mesh.vertices_smooth(repeat=20)
@@ -518,7 +530,7 @@ class GenerateCloud(bpy.types.Operator):
             #Gravity does not effect the particle system
             eWeights = cloudParticles.settings.effector_weights
             eWeights.gravity = 0
-                
+
             ####################Create Volume Material####################
             # Deselect All
             bpy.ops.object.select_all(action='DESELECT')
@@ -528,7 +540,7 @@ class GenerateCloud(bpy.types.Operator):
             scene.objects.active = bounds
 
             # Turn bounds object into a box.  Use itself as a reference.
-            makeObjectIntoBoundBox(scene, bounds,  1.0, bounds)
+            makeObjectIntoBoundBox(scene, bounds, 1.0, bounds)
 
             # Delete all material slots in bounds object.
             for i in range(len(bounds.material_slots)):
@@ -547,7 +559,7 @@ class GenerateCloud(bpy.types.Operator):
             mVolume.scattering = scattering
             mVolume.density = 0
             mVolume.density_scale = densityScale
-            mVolume.transmission_color = [3, 3, 3]
+            mVolume.transmission_color = 3.0, 3.0, 3.0
             mVolume.step_size = 0.1
             mVolume.use_light_cache = True
             mVolume.cache_resolution = 45
@@ -567,7 +579,7 @@ class GenerateCloud(bpy.types.Operator):
 
             # Add a Point Density texture
             pDensity = blend_data.textures.new("CloudPointDensity", 'POINT_DENSITY')
-            
+
             mtex = cloudMaterial.texture_slots.add()
             mtex.texture = pDensity
             mtex.texture_coords = 'GLOBAL'
@@ -585,19 +597,18 @@ class GenerateCloud(bpy.types.Operator):
             #pRamp.use_interpolation = 'LINEAR'
             pRampElements = pRamp.elements
             #pRampElements[1].position = .9
-            #pRampElements[1].color = [.18,.18,.18,.8]
+            #pRampElements[1].color = 0.18, 0.18, 0.18, 0.8
             bpy.ops.texture.slot_move(type='UP')
 
-
             # Estimate the number of particles for the size of bounds.
-            volumeBoundBox = (bounds.dimensions[0] * bounds.dimensions[1]* bounds.dimensions[2])
+            volumeBoundBox = (bounds.dimensions[0] * bounds.dimensions[1] * bounds.dimensions[2])
             numParticles = int((2.4462 * volumeBoundBox + 430.4) * numOfPoints)
             if numParticles > maxNumOfPoints:
                 numParticles = maxNumOfPoints
             if numParticles < 10000:
                 numParticles = int(numParticles + 15 * volumeBoundBox)
             print(numParticles)
- 
+
             # Set the number of particles according to the volume
             # of bounds.
             cloudParticles.settings.count = numParticles
@@ -606,7 +617,7 @@ class GenerateCloud(bpy.types.Operator):
 
             if pDensity.point_density.radius > maxPointDensityRadius:
                 pDensity.point_density.radius = maxPointDensityRadius
-                
+
             # Set time to 1.
             scene.frame_current = 1
 
@@ -641,49 +652,49 @@ class GenerateCloud(bpy.types.Operator):
                 removeParticleSystemFromObj(scene, cloud)
 
             else:
-    
+
                 pDensity.point_density.point_source = 'PARTICLE_SYSTEM'
                 pDensity.point_density.object = cloud
                 pDensity.point_density.particle_system = cloudParticles
 
-            if scene.cloud_type == '1':    #  Cumulous 
+            if scene.cloud_type == '1':  # Cumulous
                 print("Cumulous")
                 mVolume.density_scale = 2.22
                 pDensity.point_density.turbulence_depth = 10
                 pDensity.point_density.turbulence_strength = 6.3
                 pDensity.point_density.turbulence_scale = 2.9
                 pRampElements[1].position = .606
-                pDensity.point_density.radius = pDensity.point_density.radius + .1
+                pDensity.point_density.radius = pDensity.point_density.radius + 0.1
 
-            elif scene.cloud_type == '2':    #  Cirrus 
+            elif scene.cloud_type == '2':  # Cirrus
                 print("Cirrus")
                 pDensity.point_density.turbulence_strength = 22
-                mVolume.transmission_color = [3.5, 3.5, 3.5]
-                mVolume.scattering = .13
+                mVolume.transmission_color = 3.5, 3.5, 3.5
+                mVolume.scattering = 0.13
 
-            elif scene.cloud_type == '3':    #  Explosion
+            elif scene.cloud_type == '3':  # Explosion
                 mVolume.emission = 1.42
                 mtex.use_rgb_to_intensity = False
-                pRampElements[0].position = .825
-                pRampElements[0].color = [.119,.119,.119,1]
+                pRampElements[0].position = 0.825
+                pRampElements[0].color = 0.119, 0.119, 0.119, 1
                 pRampElements[1].position = .049
-                pRampElements[1].color = [1.0,1.0,1.0,0]
+                pRampElements[1].color = 1.0, 1.0, 1.0, 0
                 pDensity.point_density.turbulence_strength = 1.5
                 pRampElement1 = pRampElements.new(.452)
-                pRampElement1.color = [.814,.112,0,1]
+                pRampElement1.color = 0.814, 0.112, 0, 1
                 pRampElement2 = pRampElements.new(.234)
-                pRampElement2.color = [.814,.310,.002,1]
-                pRampElement3 = pRampElements.new(.669)
-                pRampElement3.color = [0,.0,.040,1]
-                
+                pRampElement2.color = 0.814, 0.310, 0.002, 1
+                pRampElement3 = pRampElements.new(0.669)
+                pRampElement3.color = 0.0, 0.0, 0.040, 1
+
             # Select the object.
             bounds.select = True
             scene.objects.active = bounds
- 
+
             #Let's resize the bound box to be more accurate.
-            how_much_bigger =  pDensity.point_density.radius + .1
-            
-            #If it's a particle cloud use cloud mesh if otherwise use point mesh         
+            how_much_bigger = pDensity.point_density.radius + 0.1
+
+            #If it's a particle cloud use cloud mesh if otherwise use point mesh
             if not scene.cloudparticles:
                 makeObjectIntoBoundBox(scene, bounds, how_much_bigger, cloudPnts)
             else:
@@ -708,10 +719,10 @@ def register():
     bpy.types.Scene.cloud_type = EnumProperty(
         name="Type",
         description="Select the type of cloud to create with material settings",
-        items=[("0","Stratus","Generate Stratus_foggy Cloud"),
-               ("1","Cumulous","Generate Cumulous_puffy Cloud"),
-               ("2","Cirrus","Generate Cirrus_wispy Cloud"),
-               ("3","Explosion","Generate Explosion"),
+        items=[("0", "Stratus", "Generate Stratus_foggy Cloud"),
+               ("1", "Cumulous", "Generate Cumulous_puffy Cloud"),
+               ("2", "Cirrus", "Generate Cirrus_wispy Cloud"),
+               ("3", "Explosion", "Generate Explosion"),
               ],
         default='0')
 
diff --git a/release/scripts/addons/object_fracture/fracture_ops.py b/release/scripts/addons/object_fracture/fracture_ops.py
index 61ccc18..7a7ec38 100644
--- a/release/scripts/addons/object_fracture/fracture_ops.py
+++ b/release/scripts/addons/object_fracture/fracture_ops.py
@@ -107,9 +107,7 @@ def getIslands(shard):
     vgroups = []
     fgroups = []
 
-    vgi = []
-    for v in sm.vertices:
-        vgi.append(-1)
+    vgi = [-1] * len(sm.vertices)
 
     gindex = 0
     for i in range(len(vgi)):
@@ -119,18 +117,19 @@ def getIslands(shard):
             fgroups.append([])
 
             while len(gproc) > 0:
+                # XXX - is popping the first needed? - pop() without args is fastest - campbell
                 i = gproc.pop(0)
-                for f in sm.faces:
+                for p in sm.polygons:
                     #if i in f.vertices:
-                    for v in f.vertices:
+                    for v in p.vertices:
                         if v == i:
-                            for v1 in f.vertices:
+                            for v1 in p.vertices:
                                 if vgi[v1] == -1:
                                     vgi[v1] = gindex
                                     vgroups[gindex].append(v1)
                                     gproc.append(v1)
 
-                            fgroups[gindex].append(f.index)
+                            fgroups[gindex].append(p.index)
 
             gindex += 1
 
diff --git a/release/scripts/addons/object_grease_scatter.py b/release/scripts/addons/object_grease_scatter.py
index 9a271de..225c60d 100644
--- a/release/scripts/addons/object_grease_scatter.py
+++ b/release/scripts/addons/object_grease_scatter.py
@@ -72,33 +72,6 @@ def _main(self,
         self.report({'WARNING'}, "Group '%s' not found" % obj.name)
         return
 
-    def faces_from_hits(hit_list):
-        def from_pydata(self, verts, edges, faces):
-            """
-            Make a mesh from a list of verts/edges/faces
-            Until we have a nicer way to make geometry, use this.
-            """
-            self.add_geometry(len(verts), len(edges), len(faces))
-
-            verts_flat = [f for v in verts for f in v]
-            self.verts.foreach_set("co", verts_flat)
-            del verts_flat
-
-            edges_flat = [i for e in edges for i in e]
-            self.edges.foreach_set("verts", edges_flat)
-            del edges_flat
-
-            def treat_face(f):
-                if len(f) == 3:
-                    return f[0], f[1], f[2], 0
-                elif f[3] == 0:
-                    return f[3], f[0], f[1], f[2]
-                return f
-
-            faces_flat = [v for f in faces for v in treat_face(f)]
-            self.faces.foreach_set("verts_raw", faces_flat)
-            del faces_flat
-
     def debug_edge(v1, v2):
         mesh = bpy.data.meshes.new("Retopo")
         mesh.from_pydata([v1, v2], [(0.0, 1.0)], [])
diff --git a/release/scripts/addons/render_povray/__init__.py b/release/scripts/addons/render_povray/__init__.py
index 6ca12db..b484391 100644
--- a/release/scripts/addons/render_povray/__init__.py
+++ b/release/scripts/addons/render_povray/__init__.py
@@ -26,8 +26,8 @@ bl_info = {
     "location": "Render > Engine > POV-Ray 3.7",
     "description": "Basic POV-Ray 3.7 integration for blender",
     "warning": "both POV-Ray 3.7 and this script are beta",
-    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
-        "Scripts/Render/PovRay",
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"\
+        "Scripts/Render/POV-Ray",
     "tracker_url": "https://projects.blender.org/tracker/index.php?"\
         "func=detail&aid=23145",
     "category": "Render"}
diff --git a/release/scripts/addons/render_povray/render.py b/release/scripts/addons/render_povray/render.py
index 03a693a..f4576f6 100644
--- a/release/scripts/addons/render_povray/render.py
+++ b/release/scripts/addons/render_povray/render.py
@@ -1,20 +1,20 @@
-#  ##### 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 #####
+ # ***** 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>
 
@@ -464,13 +464,11 @@ def write_pov(filename, scene=None, info_callback=None):
 
                 if material.subsurface_scattering.use:
                     subsurface_scattering = material.subsurface_scattering
-                    tabWrite("subsurface { <%.3g, %.3g, %.3g>, <%.3g, %.3g, %.3g> }\n" % (
-                             sqrt(subsurface_scattering.radius[0]) * 1.5,
-                             sqrt(subsurface_scattering.radius[1]) * 1.5,
-                             sqrt(subsurface_scattering.radius[2]) * 1.5,
-                             1.0 - subsurface_scattering.color[0],
-                             1.0 - subsurface_scattering.color[1],
-                             1.0 - subsurface_scattering.color[2])
+                    tabWrite("subsurface { translucency <%.3g, %.3g, %.3g> }\n" % (
+                             (subsurface_scattering.radius[0]),
+                             (subsurface_scattering.radius[1]),
+                             (subsurface_scattering.radius[2]),
+                             )
                             )
 
                 if material.pov.irid_enable:
@@ -722,7 +720,7 @@ def write_pov(filename, scene=None, info_callback=None):
                 writeObjectMaterial(material, ob)
 
                 writeMatrix(global_matrix * ob.matrix_world)
-                #Importance for radiosity sampling added here:
+                # Importance for radiosity sampling added here
                 tabWrite("radiosity { \n")
                 tabWrite("importance %3g \n" % importance)
                 tabWrite("}\n")
@@ -999,19 +997,32 @@ def write_pov(filename, scene=None, info_callback=None):
 
                     else:
                         if material:
-                            diffuse_color = material.diffuse_color[:]
-                            key = diffuse_color[0], diffuse_color[1], diffuse_color[2], \
-                                  material_index
-                            vertCols[key] = [-1]
+                            # Multiply diffuse with SSS Color
+                            if material.subsurface_scattering.use:
+                                diffuse_color = [i * j for i, j in zip(material.subsurface_scattering.color[:], material.diffuse_color[:])]
+                                key = diffuse_color[0], diffuse_color[1], diffuse_color[2], \
+                                      material_index
+                                vertCols[key] = [-1]
+                            else:
+                                diffuse_color = material.diffuse_color[:]
+                                key = diffuse_color[0], diffuse_color[1], diffuse_color[2], \
+                                      material_index
+                                vertCols[key] = [-1]
 
             else:
                 # No vertex colours, so write material colours as vertex colours
                 for i, material in enumerate(me_materials):
 
                     if material:
-                        diffuse_color = material.diffuse_color[:]
-                        key = diffuse_color[0], diffuse_color[1], diffuse_color[2], i  # i == f.mat
-                        vertCols[key] = [-1]
+                        # Multiply diffuse with SSS Color
+                        if material.subsurface_scattering.use:
+                            diffuse_color = [i * j for i, j in zip(material.subsurface_scattering.color[:], material.diffuse_color[:])]
+                            key = diffuse_color[0], diffuse_color[1], diffuse_color[2], i  # i == f.mat
+                            vertCols[key] = [-1]
+                        else:
+                            diffuse_color = material.diffuse_color[:]
+                            key = diffuse_color[0], diffuse_color[1], diffuse_color[2], i  # i == f.mat
+                            vertCols[key] = [-1]
 
             # Vert Colours
             tabWrite("texture_list {\n")
@@ -1424,7 +1435,10 @@ def write_pov(filename, scene=None, info_callback=None):
                             ci3 = vertCols[col3[0], col3[1], col3[2], material_index][0]
                         else:
                             # Colour per material - flat material colour
-                            diffuse_color = material.diffuse_color
+                            if material.subsurface_scattering.use:
+                                diffuse_color = [i * j for i, j in zip(material.subsurface_scattering.color[:], material.diffuse_color[:])]
+                            else:
+                                diffuse_color = material.diffuse_color[:]
                             ci1 = ci2 = ci3 = vertCols[diffuse_color[0], diffuse_color[1], \
                                               diffuse_color[2], f.material_index][0]
 
@@ -1705,6 +1719,8 @@ def write_pov(filename, scene=None, info_callback=None):
                 tabWrite("mm_per_unit %.6f\n" % \
                          (material.subsurface_scattering.scale * (-100.0) + 15.0))
                 # In POV-Ray, the scale factor for all subsurface shaders needs to be the same
+                sslt_samples = (11 - material.subsurface_scattering.error_threshold) * 100
+                tabWrite("subsurface { samples %d, %d }\n" % (sslt_samples, sslt_samples / 10))
                 onceSss = 0
 
             if world and onceAmbient:
diff --git a/release/scripts/addons/render_renderfarmfi.py b/release/scripts/addons/render_renderfarmfi.py
index b35581c..704daad 100644
--- a/release/scripts/addons/render_renderfarmfi.py
+++ b/release/scripts/addons/render_renderfarmfi.py
@@ -21,8 +21,8 @@ DEV = False
 bl_info = {
     "name": "Renderfarm.fi",
     "author": "Nathan Letwory <nathan at letworyinteractive.com>, Jesse Kaukonen <jesse.kaukonen at gmail.com>",
-    "version": (15,),
-    "blender": (2, 6, 1),
+    "version": (20,),
+    "blender": (2, 6, 2),
     "location": "Render > Engine > Renderfarm.fi",
     "description": "Send .blend as session to http://www.renderfarm.fi to render",
     "warning": "",
@@ -43,6 +43,7 @@ import http.client
 import xmlrpc.client
 import math
 from os.path import isabs, isfile
+import os
 import time
 
 from bpy.props import PointerProperty, StringProperty, BoolProperty, EnumProperty, IntProperty, CollectionProperty
@@ -81,16 +82,17 @@ bpy.cancelError = False
 bpy.texturePackError = False
 bpy.linkedFileError = False
 bpy.uploadInProgress = False
-bpy.originalFileName = bpy.path.display_name_from_filepath(bpy.data.filepath)
+bpy.originalFileName = bpy.data.filepath
 bpy.particleBakeWarning = False
 bpy.childParticleWarning = False
 bpy.simulationWarning = False
+bpy.file_format_warning = False
 bpy.ready = False
 
 if DEV:
-    rffi_xmlrpc_secure = r'http://192.168.0.109/burp/xmlrpc'
-    rffi_xmlrpc = r'http://192.168.0.109/burp/xmlrpc'
-    rffi_xmlrpc_upload = '192.168.0.109'
+    rffi_xmlrpc_secure = r'http://renderfarm.local/burp/xmlrpc'
+    rffi_xmlrpc = r'http://renderfarm.local/burp/xmlrpc'
+    rffi_xmlrpc_upload = 'renderfarm.local'
 else:
     rffi_xmlrpc_secure = r'https://xmlrpc.renderfarm.fi/burp/xmlrpc'
     rffi_xmlrpc = r'http://xmlrpc.renderfarm.fi/burp/xmlrpc'
@@ -123,6 +125,10 @@ class ORESettings(bpy.types.PropertyGroup):
     longdesc = StringProperty(name='Description', description='Description of the scene (2k)', maxlen=2048, default='')
     title = StringProperty(name='Title', description='Title for this session (128 characters)', maxlen=128, default='')
     url = StringProperty(name='Project URL', description='Project URL. Leave empty if not applicable', maxlen=256, default='')
+    engine = StringProperty(name='Engine', description='The rendering engine that is used for rendering', maxlen=64, default='blender')
+    samples = IntProperty(name='Samples', description='Number of samples that is used (Cycles only)', min=1, max=1000000, soft_min=1, soft_max=100000, default=100)
+    subsamples = IntProperty(name='Subsample Frames', description='Number of subsample frames that is used (Cycles only)', min=1, max=1000000, soft_min=1, soft_max=1000, default=10)
+    file_format = StringProperty(name='File format', description='File format used for the rendering', maxlen=30, default='PNG_FORMAT')
     
     parts = IntProperty(name='Parts/Frame', description='', min=1, max=1000, soft_min=1, soft_max=64, default=1)
     resox = IntProperty(name='Resolution X', description='X of render', min=1, max=10000, soft_min=1, soft_max=10000, default=1920)
@@ -130,7 +136,7 @@ class ORESettings(bpy.types.PropertyGroup):
     memusage = IntProperty(name='Memory Usage', description='Estimated maximum memory usage during rendering in MB', min=1, max=6*1024, soft_min=1, soft_max=3*1024, default=256)
     start = IntProperty(name='Start Frame', description='Start Frame', default=1)
     end = IntProperty(name='End Frame', description='End Frame', default=250)
-    fps = IntProperty(name='FPS', description='FPS', min=1, max=256, default=25)
+    fps = IntProperty(name='FPS', description='FPS', min=1, max=120, default=25)
     
     prepared = BoolProperty(name='Prepared', description='Set to True if preparation has been run', default=False)
     loginInserted = BoolProperty(name='LoginInserted', description='Set to True if user has logged in', default=False)
@@ -139,8 +145,8 @@ class ORESettings(bpy.types.PropertyGroup):
     selected_session = IntProperty(name='Selected Session', description='The selected session', default=0)
     hasUnsupportedSimulation = BoolProperty(name='HasSimulation', description='Set to True if therea re unsupported simulations', default=False)
     
-    inlicense = EnumProperty(items=licenses, name='source license', description='license speficied for the source files', default='1')
-    outlicense = EnumProperty(items=licenses, name='output license', description='license speficied for the output files', default='1')
+    inlicense = EnumProperty(items=licenses, name='Scene license', description='License speficied for the source files', default='1')
+    outlicense = EnumProperty(items=licenses, name='Product license', description='License speficied for the output files', default='1')
     sessions = CollectionProperty(type=ORESession, name='Sessions', description='Sessions on Renderfarm.fi')
     completed_sessions = CollectionProperty(type=ORESession, name='Completed sessions', description='Sessions that have been already rendered')
     rejected_sessions = CollectionProperty(type=ORESession, name='Rejected sessions', description='Sessions that have been rejected')
@@ -236,14 +242,45 @@ def changeSettings():
     sce = bpy.context.scene
     rd = sce.render
     ore = sce.ore_render
-    
+
     # Necessary settings for BURP
-    ore.resox = rd.resolution_x
-    ore.resoy = rd.resolution_y
-    ore.start = sce.frame_start
-    ore.end = sce.frame_end
-    ore.fps = rd.fps
+    rd.resolution_x = ore.resox
+    rd.resolution_y = ore.resoy
+    sce.frame_start = ore.start
+    sce.frame_end = ore.end
+    rd.fps = ore.fps
+    
+    bpy.file_format_warning = False
+    bpy.simulationWarning = False
+    bpy.texturePackError = False
+    bpy.particleBakeWarning = False
+    bpy.childParticleWarning = False
     
+    if (rd.image_settings.file_format == 'HDR'):
+        rd.image_settings.file_format = 'PNG'
+        bpy.file_format_warning = True
+    
+    # Convert between Blender's image format and BURP's formats
+    if (rd.image_settings.file_format == 'PNG'):
+        ore.file_format = 'PNG_FORMAT'
+    elif (rd.image_settings.file_format == 'OPEN_EXR'):
+        ore.file_format = 'EXR_FORMAT'
+    elif (rd.image_settings.file_format == 'OPEN_EXR_MULTILAYER'):
+        ore.file_format = 'EXR_MULTILAYER_FORMAT'
+    elif (rd.image_settings.file_format == 'HDR'):
+        ore.file_format = 'PNG_FORMAT'
+    else:
+        ore.file_format = 'PNG_FORMAT'
+        
+    if (ore.engine == 'cycles'):
+        bpy.context.scene.cycles.samples = ore.samples
+        
+    if (ore.subsamples <= 0):
+        ore.subsamples = 1
+    
+    if (ore.samples / ore.subsamples < 100.0):
+        ore.subsamples = float(ore.samples) / 100.0
+        
     # Multipart support doesn' work if SSS is used
     if ((rd.use_sss == True and hasSSSMaterial()) and ore.parts > 1):
         ore.parts = 1;
@@ -265,9 +302,8 @@ def prepareScene():
     ore = sce.ore_render
     
     changeSettings()
-    
+
     print("Packing external textures...")
-    # Pack all external textures
     try:
         bpy.ops.file.pack_all()
         bpy.texturePackError = False
@@ -289,14 +325,29 @@ def prepareScene():
     
     # Save with a different name
     print("Saving into a new file...")
+    bpy.originalFileName = bpy.data.filepath
+    print("Original path is " + bpy.originalFileName)
     try:
-        # If the filename is empty, we'll make one from the path of the Blender installation
+        # If the filename is empty, we'll make one from the path of the user's resource folder
         if (len(bpy.originalFileName) == 0):
-            bpy.originalFileName = bpy.utils.resource_path(type='LOCAL') + "renderfarm.blend"
-            bpy.ops.wm.save_mainfile(filepath=bpy.originalFileName)
+            print("No existing file path found, saving to autosave directory")
+            savePath = bpy.utils.user_resource("AUTOSAVE")
+            try:
+                os.mkdir(savePath)
+            except Exception as ex:
+                print(ex)
+            try:
+                savePath = savePath + "_renderfarm"
+            except Exception as ex:
+                print(ex)
+            try:
+                bpy.ops.wm.save_mainfile(filepath=savePath)
+            except Exception as ex:
+                print(ex)
         else:
+            print("Saving to current .blend directory")
             savePath = bpy.originalFileName
-            savePath = savePath + "_renderfarm"
+            savePath = savePath + "_renderfarm.blend"
             bpy.ops.wm.save_mainfile(filepath=savePath)
     except Exception as e:
         print(e)
@@ -314,21 +365,44 @@ class OpSwitchRenderfarm(bpy.types.Operator):
     bl_idname = "ore.switch_to_renderfarm_render"
     
     def execute(self, context):
-        changeSettings()
+        ore = bpy.context.scene.ore_render
+        rd = bpy.context.scene.render
+        
+        ore.resox = rd.resolution_x
+        ore.resoy = rd.resolution_y
+        ore.fps = rd.fps
+        ore.start = bpy.context.scene.frame_start
+        ore.end = bpy.context.scene.frame_end
+        if (rd.engine == 'CYCLES'):
+            ore.samples = bpy.context.scene.cycles.samples
+            ore.engine = 'cycles'
+        else:
+            ore.engine = 'blender'
         bpy.context.scene.render.engine = 'RENDERFARMFI_RENDER'
         return {'FINISHED'}
 
 class OpSwitchBlenderRender(bpy.types.Operator):
-    bl_label = "Switch to Blender Render"
-    bl_idname = "ore.switch_to_blender_render"
+    bl_label = "Switch to local render"
+    bl_idname = "ore.switch_to_local_render"
     
     def execute(self, context):
-        bpy.context.scene.render.engine = 'BLENDER_RENDER'
-        return {'FINISHED'}  
+        rd = bpy.context.scene.render
+        ore = bpy.context.scene.ore_render
+        rd.resolution_x = ore.resox
+        rd.resolution_y = ore.resoy
+        rd.fps = ore.fps
+        bpy.context.scene.frame_start = ore.start
+        bpy.context.scene.frame_end = ore.end
+        if (bpy.context.scene.ore_render.engine == 'cycles'):
+            rd.engine = 'CYCLES'
+            bpy.context.scene.cycles.samples = ore.samples
+        else:
+            bpy.context.scene.render.engine = 'BLENDER_RENDER'
+        return {'FINISHED'}
 
 # Copies start & end frame + others from render settings to ore settings
 class OpCopySettings(bpy.types.Operator):
-    bl_label = "Copy from Blender Render settings"
+    bl_label = "Copy settings from current scene"
     bl_idname = "ore.copy_settings"
     
     def execute(self, context):
@@ -342,31 +416,6 @@ class OpCopySettings(bpy.types.Operator):
         ore.fps = rd.fps
         return {'FINISHED'}
 
-# We re-write the default render panel (not enabled, breaks Cycles)
-'''class RENDER_PT_render(RenderButtonsPanel, bpy.types.Panel):
-    bl_label = "Render"
-    COMPAT_ENGINES = {'BLENDER_RENDER'}
-    
-    def draw(self, context):
-        layout = self.layout
-        rd = context.scene.render
-        row = layout.row()
-        row.operator("ore.switch_to_renderfarm_render", text="Renderfarm.fi", icon='WORLD')
-        row.operator("ore.switch_to_blender_render", text="Blender Render", icon='BLENDER')
-        row = layout.row()
-        if (bpy.context.scene.render.engine == 'BLENDER_RENDER'):
-            row.operator("render.render", text="Image", icon='RENDER_STILL')
-            row.operator("render.render", text="Animation", icon='RENDER_ANIMATION').animation = True
-            layout.prop(rd, "display_mode", text="Display")
-        else:
-            if bpy.found_newer_version == True:
-                layout.operator('ore.open_download_location')
-            else:
-                if bpy.up_to_date == True:
-                    layout.label(text='You have the latest version')
-                layout.operator('ore.check_update')
-'''
-
 class EngineSelectPanel(bpy.types.Panel):
     bl_idname = "OBJECT_PT_engineSelectPanel"
     bl_label = "Choose rendering mode"
@@ -379,7 +428,7 @@ class EngineSelectPanel(bpy.types.Panel):
         rd = context.scene.render
         row = layout.row()
         row.operator("ore.switch_to_renderfarm_render", text="Renderfarm.fi", icon='WORLD')
-        row.operator("ore.switch_to_blender_render", text="Blender Render", icon='BLENDER')
+        row.operator("ore.switch_to_local_render", text="Local computer", icon='BLENDER')
         row = layout.row()
         if (bpy.context.scene.render.engine == 'RENDERFARMFI_RENDER'):
             if bpy.found_newer_version == True:
@@ -489,6 +538,51 @@ class RENDER_PT_RenderfarmFi(RenderButtonsPanel, bpy.types.Panel):
             layout.label(text="Example: blue skies hero castle flowers grass particles")
             layout.prop(ore, 'url')
             layout.label(text="Example: www.sintel.org")
+            
+            layout.label(text="Please verify your settings", icon='MODIFIER')
+            row = layout.row()
+            #row.operator('ore.copy_settings')
+            #row = layout.row()
+            
+            layout.label(text="Rendering engine")
+            row = layout.row()
+            if (ore.engine == 'blender'):
+                row.operator('ore.use_blender_render', icon='FILE_TICK')
+                row.operator('ore.use_cycles_render')
+            elif (ore.engine == 'cycles' ):
+                row.operator('ore.use_blender_render')
+                row.operator('ore.use_cycles_render', icon='FILE_TICK')
+            else:
+                row.operator('ore.use_blender_render', icon='FILE_TICK')
+                row.operator('ore.use_cycles_render')
+            
+            row = layout.row()
+            
+            layout.separator()
+            row = layout.row()
+            row.prop(ore, 'resox')
+            row.prop(ore, 'resoy')
+            row = layout.row()
+            row.prop(ore, 'start')
+            row.prop(ore, 'end')
+            row = layout.row()
+            row.prop(ore, 'fps')
+            row = layout.row()
+            if (ore.engine == 'cycles'):
+                row.prop(ore, 'samples')
+                row.prop(ore, 'subsamples')
+            row = layout.row()
+            row.prop(ore, 'memusage')
+            #row.prop(ore, 'parts')
+            layout.separator()
+            row = layout.row()
+            
+            layout.label(text="Licenses", icon='FILE_REFRESH')
+            row = layout.row()
+            row.prop(ore, 'inlicense')
+            row = layout.row()
+            row.prop(ore, 'outlicense')
+            
             checkStatus(ore)
             if (len(bpy.errors) > 0):
                 bpy.ready = False
@@ -496,7 +590,7 @@ class RENDER_PT_RenderfarmFi(RenderButtonsPanel, bpy.types.Panel):
                 bpy.ready = True
 
 class UPLOAD_PT_RenderfarmFi(RenderButtonsPanel, bpy.types.Panel):
-    bl_label = "Upload"
+    bl_label = "Upload to www.renderfarm.fi"
     COMPAT_ENGINES = set(['RENDERFARMFI_RENDER'])
     
     @classmethod
@@ -525,48 +619,24 @@ class UPLOAD_PT_RenderfarmFi(RenderButtonsPanel, bpy.types.Panel):
                 
                 layout.separator()
                 
-                layout.label(text="Please verify your settings", icon='MODIFIER')
-                row = layout.row()
-                row.operator('ore.copy_settings')
-                row = layout.row()
-                row.label(text="Resolution: " + str(ore.resox) + "x" + str(ore.resoy))
-                row = layout.row()
-                row.label(text="Frames: " + str(ore.start) + " - " + str(ore.end))
-                row = layout.row()
-                if (ore.start == ore.end):
-                    row.label(text="You have selected only 1 frame to be rendered", icon='ERROR')
-                    row = layout.row()
-                    row.label(text="Renderfarm.fi does not render stills - only animations")
-                row = layout.row()
-                row.label(text="Frame rate: " + str(ore.fps))
-                row = layout.row()
-                
-                layout.separator()
-                
-                layout.label(text="Optional advanced settings", icon='MODIFIER')
-                row = layout.row()
-                row.prop(ore, 'memusage')
-                #row.prop(ore, 'parts')
-                layout.separator()
-                row = layout.row()
-                
-                layout.label(text="Licenses", icon='FILE_REFRESH')
-                row = layout.row()
-                row.prop(ore, 'inlicense')  
-                row.prop(ore, 'outlicense')
-                
                 row = layout.row()
                 if (bpy.uploadInProgress == True):
-                    layout.label(text="Attempting upload...")
+                    layout.label(text="------------------------")
+                    layout.label(text="- Attempting upload... -")
+                    layout.label(text="------------------------")
+                if (bpy.file_format_warning == True):
+                    layout.label(text="Your output format is HDR", icon='ERROR')
+                    layout.label(text="Right now we don't support this file format")
+                    layout.label(text="File format will be changed to PNG")
                 if (bpy.texturePackError):
                     layout.label(text="There was an error in packing external textures", icon='ERROR')
                     layout.label(text="Make sure that all your textures exist on your computer")
                     layout.label(text="The render will still work, but won't have the missing textures")
-                    layout.label(text="You may want to cancel your render above")
+                    layout.label(text="You may want to cancel your render above in \"My sessions\"")
                 if (bpy.linkedFileError):
                     layout.label(text="There was an error in appending linked .blend files", icon='ERROR')
                     layout.label(text="Your render might not have all the external content")
-                    layout.label(text="You may want to cancel your render above")
+                    layout.label(text="You may want to cancel your render above in \"My sessions\"")
                 if (bpy.particleBakeWarning):
                     layout.label(text="You have a particle simulation", icon='ERROR')
                     layout.label(text="All Emitter type particles must be baked")
@@ -585,7 +655,8 @@ class UPLOAD_PT_RenderfarmFi(RenderButtonsPanel, bpy.types.Panel):
                     if (errorTime > 4):
                         bpy.infoError = False
                         bpy.errorStartTime = -1
-                layout.label(text="Blender may seem frozen during the upload!", icon='LAMP')
+                layout.label(text="Warning:", icon='LAMP')
+                layout.label(text="Blender may seem frozen during the upload!")
                 row.operator('ore.reset', icon='FILE_REFRESH')
             else:
                 layout.label(text="Fill the scene information first")
@@ -608,10 +679,16 @@ def encode_multipart_data(data, files):
     
     def encode_file(field_name):
         filename = files [field_name]
+        fcontent = None
+        print('encoding', field_name)
+        try:
+            fcontent = str(open(filename, 'rb').read(), encoding='iso-8859-1')
+        except Exception:
+            print('Trouble in paradise')
         return ('--' + boundary,
                 'Content-Disposition: form-data; name="%s"; filename="%s"' % (field_name, filename),
                 'Content-Type: %s' % get_content_type(filename),
-                '', str(open(filename, 'rb').read(), encoding='iso-8859-1'))
+                '', fcontent)
     
     lines = []
     for name in data:
@@ -619,17 +696,24 @@ def encode_multipart_data(data, files):
     for name in files:
         lines.extend(encode_file(name))
     lines.extend(('--%s--' % boundary, ''))
+    print("joining lines into body")
     body = '\r\n'.join(lines)
     
     headers = {'content-type': 'multipart/form-data; boundary=' + boundary,
                'content-length': str(len(body))}
+
+    print("headers and body ready")
     
     return body, headers
 
 def send_post(data, files):
+    print("Forming connection for post")
     connection = http.client.HTTPConnection(rffi_xmlrpc_upload)
+    print("Requesting")
     connection.request('POST', '/burp/storage', *encode_multipart_data(data, files)) # was /file
+    print("Getting response")
     response = connection.getresponse()
+    print("Reading response")
     res = response.read()
     return res
 
@@ -645,7 +729,9 @@ def md5_for_file(filepath):
     return md5hash.hexdigest()
 
 def upload_file(key, userid, sessionid, path):
+    print("Asserting absolute path")
     assert isabs(path)
+    print("Asserting path is a file")
     assert isfile(path)
     data = {
         'userId': str(userid),
@@ -680,16 +766,16 @@ def ore_upload(op, context):
         return {'CANCELLED'}
     try:
         print("Creating auth proxy")
-        authproxy = xmlrpc.client.ServerProxy(rffi_xmlrpc_secure)
+        authproxy = xmlrpc.client.ServerProxy(rffi_xmlrpc_secure, verbose=DEV)
         print("Getting session key")
         res = authproxy.auth.getSessionKey(ore.username, ore.hash)
         key = res['key']
         userid = res['userId']
         print("Creating server proxy")
-        proxy = xmlrpc.client.ServerProxy(rffi_xmlrpc) #r'http://xmlrpc.renderfarm.fi/session')
+        proxy = xmlrpc.client.ServerProxy(rffi_xmlrpc, verbose=DEV) #r'http://xmlrpc.renderfarm.fi/session')
         proxy._ServerProxy__transport.user_agent = 'Renderfarm.fi Uploader/%s' % (bpy.CURRENT_VERSION)
         print("Creating a new session")
-        res = proxy.session.createSession(userid, key)
+        res = proxy.session.createSession(userid, key)  # This may use an existing, non-rendered session. Prevents spamming in case the upload fails for some reason
         sessionid = res['sessionId']
         key = res['key']
         print("Session id is " + str(sessionid))
@@ -709,6 +795,16 @@ def ore_upload(op, context):
         res = proxy.session.setXSize(userid, res['key'], sessionid, ore.resox)
         res = proxy.session.setYSize(userid, res['key'], sessionid, ore.resoy)
         res = proxy.session.setFrameRate(userid, res['key'], sessionid, ore.fps)
+        res = proxy.session.setFrameFormat(userid, res['key'], sessionid, ore.file_format)
+        res = proxy.session.setRenderer(userid, res['key'], sessionid, ore.engine)
+        res = proxy.session.setSamples(userid, res['key'], sessionid, ore.samples)
+        res = proxy.session.setSubSamples(userid, res['key'], sessionid, ore.subsamples)
+        if (ore.engine == 'cycles'):
+            res = proxy.session.setReplication(userid, res['key'], sessionid, 1)
+            if ore.subsamples > 1:
+                res = proxy.session.setStitcher(userid, res['key'], sessionid, 'AVERAGE')
+        else:
+            res = proxy.session.setReplication(userid, res['key'], sessionid, 3)
         res = proxy.session.setOutputLicense(userid, res['key'], sessionid, int(ore.outlicense))
         res = proxy.session.setInputLicense(userid, res['key'], sessionid, int(ore.inlicense))
         print("Setting primary input file")
@@ -798,10 +894,10 @@ def doRefresh(op, rethrow=False):
     ore = sce.ore_render
     try:
     
-        proxy = xmlrpc.client.ServerProxy(rffi_xmlrpc_secure)
+        proxy = xmlrpc.client.ServerProxy(rffi_xmlrpc_secure, verbose=DEV)
         res = proxy.auth.getSessionKey(ore.username, ore.hash)
         userid = res['userID']
-        proxy = xmlrpc.client.ServerProxy(rffi_xmlrpc)
+        proxy = xmlrpc.client.ServerProxy(rffi_xmlrpc, verbose=DEV)
 
         bpy.ore_sessions = []
 
@@ -894,7 +990,7 @@ class ORE_CancelSession(bpy.types.Operator):
     def execute(self, context):
         sce = context.scene
         ore = sce.ore_render
-        proxy = xmlrpc.client.ServerProxy(rffi_xmlrpc_secure)
+        proxy = xmlrpc.client.ServerProxy(rffi_xmlrpc_secure, verbose=DEV)
         if len(bpy.ore_complete_session_queue)>0:
             s = bpy.ore_complete_session_queue[ore.selected_session]
             try:
@@ -969,7 +1065,7 @@ class ORE_CheckUpdate(bpy.types.Operator):
     bl_label = 'Check for a new version'
     
     def execute(self, context):
-        blenderproxy = xmlrpc.client.ServerProxy(r'http://xmlrpc.renderfarm.fi/renderfarmfi/blender')
+        blenderproxy = xmlrpc.client.ServerProxy(r'http://xmlrpc.renderfarm.fi/renderfarmfi/blender', verbose=DEV)
         try:
             self.report(set(['INFO']), 'Checking for newer version on Renderfarm.fi')
             dl_url = blenderproxy.blender.getCurrentVersion(bpy.CURRENT_VERSION)
@@ -996,6 +1092,9 @@ class ORE_LoginOp(bpy.types.Operator):
     def execute(self, context):
         sce = context.scene
         ore = sce.ore_render
+
+        ore.password = ore.password.strip()
+        ore.username = ore.username.strip().lower()
         
         if ore.hash=='':
             if ore.password != '' and ore.username != '':
@@ -1086,6 +1185,22 @@ class ORE_UseBlenderReso(bpy.types.Operator):
         ore.fps = rd.fps
         
         return {'FINISHED'}
+        
+class ORE_UseCyclesRender(bpy.types.Operator):
+    bl_idname = "ore.use_cycles_render"
+    bl_label = "Cycles"
+    
+    def execute(self, context):
+        context.scene.ore_render.engine = 'cycles'
+        return {'FINISHED'}
+
+class ORE_UseBlenderRender(bpy.types.Operator):
+    bl_idname = "ore.use_blender_render"
+    bl_label = "Blender Internal"
+    
+    def execute(self, context):
+        context.scene.ore_render.engine = 'blender'
+        return {'FINISHED'}
 
 class ORE_ChangeUser(bpy.types.Operator):
     bl_idname = "ore.change_user"
diff --git a/release/scripts/addons/rigify/rigs/biped/leg/deform.py b/release/scripts/addons/rigify/rigs/biped/leg/deform.py
index e7cd319..79977fa 100644
--- a/release/scripts/addons/rigify/rigs/biped/leg/deform.py
+++ b/release/scripts/addons/rigify/rigs/biped/leg/deform.py
@@ -89,7 +89,7 @@ class Rig:
         leg_bones = [bone] + connected_children_names(self.obj, bone)[:2]
 
         if len(leg_bones) != 2:
-            raise MetarigError("RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type" % (strip_org(bone)))
+            raise MetarigError("RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type -- leg bones != 2" % (strip_org(bone)))
 
         # Get the foot and heel
         foot = None
@@ -101,9 +101,10 @@ class Rig:
                 else:
                     heel = b.name
 
-        if foot is None or heel is None:
-            raise MetarigError("RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type" % (strip_org(bone)))
-
+        if foot is None:
+            raise MetarigError("RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type -- could not find foot bone (that is, a bone with >1 children connected) attached to bone '%s'" % (strip_org(bone), strip_org(shin)))
+        if heel is None:
+            raise MetarigError("RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type -- could not find heel bone (that is, a bone with no childrenconnected) attached to bone '%s'" % (strip_org(bone), strip_org(shin)))
         # Get the toe
         toe = None
         for b in self.obj.data.bones[foot].children:
@@ -111,7 +112,7 @@ class Rig:
                 toe = b.name
 
         if toe is None:
-            raise MetarigError("RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type" % (strip_org(bone)))
+            raise MetarigError("RIGIFY ERROR: Bone '%s': incorrect bone configuration for rig type -- toe is None" % (strip_org(bone)))
 
         self.org_bones = leg_bones + [foot, toe, heel]
 
diff --git a/release/scripts/addons/rigify/ui.py b/release/scripts/addons/rigify/ui.py
index 8d11fbf..33e3c5d 100644
--- a/release/scripts/addons/rigify/ui.py
+++ b/release/scripts/addons/rigify/ui.py
@@ -18,6 +18,8 @@
 
 # <pep8 compliant>
 
+# test comment
+
 import bpy
 from bpy.props import StringProperty
 import rigify
diff --git a/release/scripts/addons/space_view3d_copy_attributes.py b/release/scripts/addons/space_view3d_copy_attributes.py
index d0ca2e0..63da0c5 100644
--- a/release/scripts/addons/space_view3d_copy_attributes.py
+++ b/release/scripts/addons/space_view3d_copy_attributes.py
@@ -25,6 +25,7 @@ bl_info = {
     "blender": (2, 6, 1),
     'location': 'View3D > Ctrl-C',
     'description': 'Copy Attributes Menu from Blender 2.4',
+    "warning": "some mesh functions broken",
     'wiki_url': 'http://wiki.blender.org/index.php/Extensions:2.5/Py/'
                 'Scripts/3D_interaction/Copy_Attributes_Menu',
     'tracker_url': 'https://projects.blender.org/tracker/index.php?'
@@ -691,7 +692,7 @@ class MESH_OT_CopyFaceSettings(bpy.types.Operator):
         bpy.ops.object.editmode_toggle()
 
         if mode == 'MAT':
-            from_data = mesh.faces
+            from_data = mesh.polygons
             to_data = from_data
         else:
             if mode == 'VCOL':
@@ -704,9 +705,9 @@ class MESH_OT_CopyFaceSettings(bpy.types.Operator):
                 return _end({'CANCELLED'})
             from_data = layers[layername or act_layer.name].data
             to_data = act_layer.data
-        from_face = from_data[mesh.faces.active]
+        from_face = from_data[mesh.polygons.active]
 
-        for f in mesh.faces:
+        for f in mesh.polygons:
             if f.select:
                 if to_data != from_data:
                     from_face = from_data[f.index]
diff --git a/release/scripts/addons/space_view3d_materials_utils.py b/release/scripts/addons/space_view3d_materials_utils.py
index 192c331..3f49b30 100644
--- a/release/scripts/addons/space_view3d_materials_utils.py
+++ b/release/scripts/addons/space_view3d_materials_utils.py
@@ -25,11 +25,11 @@
 bl_info = {
     "name": "Material Utils",
     "author": "michaelw",
-    "version": (1, 3),
-    "blender": (2, 5, 6),
+    "version": (1, 4),
+    "blender": (2, 6, 2),
     "location": "View3D > Q key",
     "description": "Menu of material tools (assign, select..)  in the 3D View",
-    "warning": "",
+    "warning": "Buggy, Broken in Cycles mode",
     "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"
                 "Scripts/3D interaction/Materials Utils",
     "tracker_url": "https://projects.blender.org/tracker/index.php?"
@@ -43,7 +43,7 @@ This script has several functions and operators... grouped for convenience
     additional "new" entry the chosen material will be assigned to all the
     selected objects in object mode.
 
-    in edit mode the selected faces get the selected material applied.
+    in edit mode the selected polygons get the selected material applied.
 
     if the user chose "new" the new material can be renamed using the
     "last operator" section of the toolbox.
@@ -58,12 +58,12 @@ This script has several functions and operators... grouped for convenience
     objects without the material will be removed from selection.
 
     in edit mode:  the menu offers only the materials attached to the current
-    object. It will select the faces that use the material and deselect those
+    object. It will select the polygons that use the material and deselect those
     that do not.
 
 * clean material slots
     for all selected objects any empty material slots or material slots with
-    materials that are not used by the mesh faces will be removed.
+    materials that are not used by the mesh polygons will be removed.
 
 * Any un-used materials and slots will be removed
 """
@@ -109,7 +109,7 @@ def replace_material(m1, m2, all_objects=False):
 
 def select_material_by_name(find_mat_name):
     #in object mode selects all objects with material find_mat_name
-    #in edit mode selects all faces with material find_mat_name
+    #in edit mode selects all polygons with material find_mat_name
 
     find_mat = bpy.data.materials.get(find_mat_name)
 
@@ -121,7 +121,7 @@ def select_material_by_name(find_mat_name):
 
     scn = bpy.context.scene
 
-    #set selection mode to faces
+    #set selection mode to polygons
     scn.tool_settings.mesh_select_mode = False, False, True
 
     actob = bpy.context.active_object
@@ -149,7 +149,7 @@ def select_material_by_name(find_mat_name):
                 ob.select = False
 
     else:
-        #it's editmode, so select the faces
+        #it's editmode, so select the polygons
         ob = actob
         ms = ob.material_slots.values()
 
@@ -163,7 +163,7 @@ def select_material_by_name(find_mat_name):
                 # found = True  # UNUSED
             i += 1
         me = ob.data
-        for f in me.faces:
+        for f in me.polygons:
             if f.material_index in slot_indeces:
                 f.select = True
             else:
@@ -174,7 +174,7 @@ def select_material_by_name(find_mat_name):
 
 
 def mat_to_texface():
-    # assigns the first image in each material to the faces in the active
+    # assigns the first image in each material to the polygons in the active
     # uvlayer for all selected objects
 
     #check for editmode
@@ -225,7 +225,7 @@ def mat_to_texface():
             for t in  me.uv_textures:
                 if t.active:
                     uvtex = t.data.values()
-                    for f in me.faces:
+                    for f in me.polygons:
                         #check that material had an image!
                         if images[f.material_index] != None:
                             uvtex[f.index].image = images[f.material_index]
@@ -276,11 +276,11 @@ def cleanmatslots():
         if ob.type == 'MESH':
             mats = ob.material_slots.keys()
 
-            #check the faces on the mesh to build a list of used materials
+            #check the polygons on the mesh to build a list of used materials
             usedMatIndex = []  # we'll store used materials indices here
             faceMats = []
             me = ob.data
-            for f in me.faces:
+            for f in me.polygons:
                 #get the material index for this face...
                 faceindex = f.material_index
 
@@ -311,7 +311,7 @@ def cleanmatslots():
 
             # restore face indices:
             i = 0
-            for f in me.faces:
+            for f in me.polygons:
                 matindex = mnames.index(faceMats[i])
                 f.material_index = matindex
                 i += 1
@@ -334,12 +334,12 @@ def assign_mat(matname="Default"):
     if not found:
         target = bpy.data.materials.new(matname)
 
-    # if objectmode then set all faces
+    # if objectmode then set all polygons
     editmode = False
-    allfaces = True
+    allpolygons = True
     if actob.mode == 'EDIT':
         editmode = True
-        allfaces = False
+        allpolygons = False
         bpy.ops.object.mode_set()
 
     objs = bpy.context.selected_editable_objects
@@ -384,11 +384,11 @@ def assign_mat(matname="Default"):
 
             #now assign the material:
             me = ob.data
-            if allfaces:
-                for f in me.faces:
+            if allpolygons:
+                for f in me.polygons:
                     f.material_index = index
-            elif allfaces == False:
-                for f in me.faces:
+            elif allpolygons == False:
+                for f in me.polygons:
                     if f.select:
                         f.material_index = index
             me.update()
@@ -476,7 +476,7 @@ def texface_to_mat():
         i = 0
         for f in faceindex:
             if f != None:
-                me.faces[i].material_index = f
+                me.polygons[i].material_index = f
             i += 1
     if editmode:
         bpy.ops.object.mode_set(mode='EDIT')
@@ -486,7 +486,7 @@ def texface_to_mat():
 # operator classes:
 
 class VIEW3D_OT_texface_to_material(bpy.types.Operator):
-    ''''''
+    '''Create texture materials for images assigned in UV editor'''
     bl_idname = "view3d.texface_to_material"
     bl_label = "MW Texface Images to Material/Texture"
     bl_options = {'REGISTER', 'UNDO'}
@@ -506,7 +506,7 @@ class VIEW3D_OT_texface_to_material(bpy.types.Operator):
 
 
 class VIEW3D_OT_assign_material(bpy.types.Operator):
-    '''assign a material to the selection'''
+    '''Assign a material to the selection'''
     bl_idname = "view3d.assign_material"
     bl_label = "MW Assign Material"
     bl_options = {'REGISTER', 'UNDO'}
@@ -515,7 +515,7 @@ class VIEW3D_OT_assign_material(bpy.types.Operator):
             name='Material Name',
             description='Name of Material to Assign',
             default="",
-            maxlen=21,
+            maxlen=63,
             )
 
     @classmethod
@@ -532,8 +532,8 @@ class VIEW3D_OT_assign_material(bpy.types.Operator):
 
 
 class VIEW3D_OT_clean_material_slots(bpy.types.Operator):
-    '''removes any material slots from the
-    selected objects that are not used by the mesh'''
+    '''Removes any material slots from selected objects '''\
+    '''that are not used by the mesh'''
     bl_idname = "view3d.clean_material_slots"
     bl_label = "MW Clean Material Slots"
     bl_options = {'REGISTER', 'UNDO'}
@@ -548,7 +548,7 @@ class VIEW3D_OT_clean_material_slots(bpy.types.Operator):
 
 
 class VIEW3D_OT_material_to_texface(bpy.types.Operator):
-    ''''''
+    '''Transfer material assignments to UV editor'''
     bl_idname = "view3d.material_to_texface"
     bl_label = "MW Material Images to Texface"
     bl_options = {'REGISTER', 'UNDO'}
@@ -563,14 +563,14 @@ class VIEW3D_OT_material_to_texface(bpy.types.Operator):
 
 
 class VIEW3D_OT_select_material_by_name(bpy.types.Operator):
-    ''''''
+    '''Select geometry with this material assigned to it'''
     bl_idname = "view3d.select_material_by_name"
     bl_label = "MW Select Material By Name"
     bl_options = {'REGISTER', 'UNDO'}
     matname = StringProperty(
             name='Material Name',
             description='Name of Material to Select',
-            maxlen=21,
+            maxlen=63,
             )
 
     @classmethod
@@ -584,7 +584,7 @@ class VIEW3D_OT_select_material_by_name(bpy.types.Operator):
 
 
 class VIEW3D_OT_replace_material(bpy.types.Operator):
-    '''assign a material to the selection'''
+    '''Replace a material by name'''
     bl_idname = "view3d.replace_material"
     bl_label = "MW Replace Material"
     bl_options = {'REGISTER', 'UNDO'}
@@ -592,15 +592,15 @@ class VIEW3D_OT_replace_material(bpy.types.Operator):
     matorg = StringProperty(
             name='Material to Replace',
             description="Name of Material to Assign",
-            maxlen=21,
+            maxlen=63,
             )
     matrep = StringProperty(name="Replacement material",
             description='Name of Material to Assign',
-            maxlen=21,
+            maxlen=63,
             )
     all_objects = BoolProperty(
-            name="all_objects",
-            description="replace for all objects in this blend file",
+            name="All objects",
+            description="Replace for all objects in this blend file",
             default=True,
             )
 
@@ -620,7 +620,7 @@ class VIEW3D_OT_replace_material(bpy.types.Operator):
 # menu classes
 
 class VIEW3D_MT_master_material(bpy.types.Menu):
-    bl_label = "Master Material Menu"
+    bl_label = "Material Utils Menu"
 
     def draw(self, context):
         layout = self.layout
@@ -634,10 +634,10 @@ class VIEW3D_MT_master_material(bpy.types.Menu):
                         icon='CANCEL')
         layout.operator("view3d.material_to_texface",
                         text='Material to Texface',
-                        icon='FACESEL_HLT')
+                        icon='polygonsEL_HLT')
         layout.operator("view3d.texface_to_material",
                         text="Texface to Material",
-                        icon='FACESEL_HLT')
+                        icon='polygonsEL_HLT')
 
         layout.separator()
         layout.operator("view3d.replace_material",
diff --git a/release/scripts/addons/space_view3d_panel_measure.py b/release/scripts/addons/space_view3d_panel_measure.py
index 2f0ec95..a1fe5e1 100644
--- a/release/scripts/addons/space_view3d_panel_measure.py
+++ b/release/scripts/addons/space_view3d_panel_measure.py
@@ -25,8 +25,9 @@
 bl_info = {
     "name": "Measure Panel",
     "author": "Buerbaum Martin (Pontiac), TNae (Normal patch)," \
-        " Benjamin Lauritzen (Loonsbury; Volume code)",
-    "version": (0, 8, 2),
+        " Benjamin Lauritzen (Loonsbury; Volume code)," \
+        " Alessandro Sala (patch: Units in 3D View)",
+    "version": (0, 8, 9),
     "blender": (2, 6, 0),
     "location": "View3D > Properties > Measure Panel",
     "description": "Measure distances between objects",
@@ -72,10 +73,12 @@ http://blenderartists.org/forum/showthread.php?t=177800
 
 import bpy
 from bpy.props import *
+from bpy.app.handlers import persistent
 from mathutils import Vector, Matrix
 import bgl
 import blf
 from bpy_extras.view3d_utils import location_3d_to_region_2d
+from bpy_extras.mesh_utils import ngon_tessellate
 
 
 # Precicion for display of float values.
@@ -85,13 +88,77 @@ PRECISION = 4
 COLOR_LOCAL = (1.0, 0.5, 0.0, 0.8)
 COLOR_GLOBAL = (0.5, 0.0, 1.0, 0.8)
 
+# 3D View - text offset
+OFFSET_LINE = 10   # Offset the text a bit to the right.
+OFFSET_Y = 15      # Offset of the lines.
+OFFSET_VALUE = 30  # Offset of value(s) from the text.
+
+# 3D View - line width
+LINE_WIDTH_XYZ = 1
+LINE_WIDTH_DIST = 2
+
+
+# Returns a tuple describing the current measuring system
+# and formatting options.
+# Returned data is meant to be passed to formatDistance().
+# Original by Alessandro Sala (Feb, 12th 2012)
+def getUnitsInfo():
+        scale = bpy.context.scene.unit_settings.scale_length
+        unit_system = bpy.context.scene.unit_settings.system
+        separate_units = bpy.context.scene.unit_settings.use_separate
+        if unit_system == 'METRIC':
+                scale_steps = ((1000, 'km'), (1, 'm'), (1 / 100, 'cm'),
+                    (1 / 1000, 'mm'), (1 / 1000000, '\u00b5m'))
+        elif unit_system == 'IMPERIAL':
+                scale_steps = ((1760, 'mi'), (1, 'yd'), (1 / 3, '\''),
+                    (1 / 36, '"'), (1 / 36000, 'thou'))
+                scale *= 1.0936133
+        else:
+                scale_steps = ((1, ' BU'),)
+                separate_units = False
+
+        return (scale, scale_steps, separate_units)
+
+
+# Converts a distance from BU into the measuring system
+# described by units_info.
+# Original by Alessandro Sala (Feb, 12th 2012)
+def convertDistance(val, units_info):
+        scale, scale_steps, separate_units = units_info
+        sval = val * scale
+        rsval = round(sval, PRECISION)
+        idx = 0
+        while idx < len(scale_steps) - 1:
+                if rsval >= scale_steps[idx][0]:
+                        break
+                idx += 1
+        factor, suffix = scale_steps[idx]
+        sval /= factor
+        if not separate_units or idx == len(scale_steps) - 1:
+                dval = str(round(sval, PRECISION)) + suffix
+        else:
+                ival = int(sval)
+                dval = str(ival) + suffix
+                fval = sval - ival
+                idx += 1
+                while idx < len(scale_steps):
+                        fval *= scale_steps[idx - 1][0] / scale_steps[idx][0]
+                        if fval >= 1:
+                                dval += ' ' \
+                                    + str(round(fval, 1)) \
+                                    + scale_steps[idx][1]
+                                break
+                        idx += 1
+
+        return dval
+
 
 # Returns a single selected object.
 # Returns None if more than one (or nothing) is selected.
 # Note: Ignores the active object.
-def getSingleObject(context):
-    if len(context.selected_objects) == 1:
-        return context.selected_objects[0]
+def getSingleObject():
+    if len(bpy.context.selected_objects) == 1:
+        return bpy.context.selected_objects[0]
 
     return None
 
@@ -100,11 +167,12 @@ def getSingleObject(context):
 # depending on the current view mode and the selection.
 def getMeasurePoints(context):
     sce = context.scene
+    mode = context.mode
 
     # Get a single selected object (or nothing).
-    obj = getSingleObject(context)
+    obj = getSingleObject()
 
-    if context.mode == 'EDIT_MESH':
+    if mode == 'EDIT_MESH':
         obj = context.active_object
 
         if obj and obj.type == 'MESH' and obj.data:
@@ -174,7 +242,7 @@ def getMeasurePoints(context):
             else:
                 return None
 
-    elif context.mode == 'OBJECT':
+    elif mode == 'OBJECT':
         # We are working in object mode.
 
         if len(context.selected_objects) > 2:
@@ -253,52 +321,54 @@ def objectEdgeLength(obj, selectedOnly, globalSpace):
 # Return the area of a face (in global space).
 # @note Copies the functionality of the following functions,
 # but also respects the scaling (via the "obj.matrix_world" parameter):
-# @sa: rna_mesh.c:rna_MeshFace_area_get
+# @sa: rna_mesh.c:rna_MeshTessFace_area_get
 # @sa: math_geom.c:area_quad_v3
 # @sa: math_geom.c:area_tri_v3
-def faceAreaGlobal(face, obj):
-    area = 0.0
-
+# @sa: math_geom.c:area_poly_v3
+# @todo Fix calculation of "n" for n-gons?
+def polyAreaGlobal(poly, obj):
     mesh = obj.data
     mat = obj.matrix_world.copy()
+    norm = poly.normal
 
-    if len(face.vertices) == 4:
-        # Quad
-
-        # Get vertex indices
-        v1, v2, v3, v4 = face.vertices
+    area = 0.0
 
-        # Get vertex data
-        v1 = mesh.vertices[v1]
-        v2 = mesh.vertices[v2]
-        v3 = mesh.vertices[v3]
-        v4 = mesh.vertices[v4]
+    if len(poly.vertices) > 3:
+        # Tesselate the polygon into multiple tris
+        tris = ngon_tessellate(mesh, poly.vertices)
 
-        # Apply transform matrix to vertex coordinates.
-        v1 = mat * v1.co
-        v2 = mat * v2.co
-        v3 = mat * v3.co
-        v4 = mat * v4.co
+        for tri in tris:
+            # Get vertex data
+            v1, v2, v3 = tri
 
-        vec1 = v2 - v1
-        vec2 = v4 - v1
+            # Get indices from original poly
+            v1 = poly.vertices[v1]
+            v2 = poly.vertices[v2]
+            v3 = poly.vertices[v3]
 
-        n = vec1.cross(vec2)
+            # Get vertex information from indices
+            v1 = mesh.vertices[v1]
+            v2 = mesh.vertices[v2]
+            v3 = mesh.vertices[v3]
 
-        area = n.length / 2.0
+            # Apply transform matrix to vertex coordinates.
+            v1 = mat * v1.co
+            v2 = mat * v2.co
+            v3 = mat * v3.co
 
-        vec1 = v4 - v3
-        vec2 = v2 - v3
+            # Calculate area for the new tri
+            vec1 = v3 - v2
+            vec2 = v1 - v2
 
-        n = vec1.cross(vec2)
+            n = vec1.cross(vec2)
 
-        area += n.length / 2.0
+            area += n.length / 2.0
 
-    elif len(face.vertices) == 3:
+    elif len(poly.vertices) == 3:
         # Triangle
 
         # Get vertex indices
-        v1, v2, v3 = face.vertices
+        v1, v2, v3 = poly.vertices
 
         # Get vertex data
         v1 = mesh.vertices[v1]
@@ -317,7 +387,16 @@ def faceAreaGlobal(face, obj):
 
         area = n.length / 2.0
 
-    return area, n
+    # Apply rotation and scale to the normal as well.
+    rot_mat = obj.matrix_world.to_quaternion()
+    scale = obj.matrix_world.to_scale()
+    norm = rot_mat * norm
+    norm = Vector((
+        norm.x * scale.x,
+        norm.y * scale.y,
+        norm.z * scale.z)).normalized()
+
+    return area, norm
 
 
 # Calculate the surface area of a mesh object.
@@ -335,15 +414,15 @@ def objectSurfaceArea(obj, selectedOnly, globalSpace):
         mesh = obj.data
 
         # Count the area of all the faces.
-        for face in mesh.faces:
-            if not selectedOnly or face.select:
+        for poly in mesh.polygons:
+            if not selectedOnly or poly.select:
                 if globalSpace:
-                    a, n = faceAreaGlobal(face, obj)
+                    a, n = polyAreaGlobal(poly, obj)
                     areaTotal += a
                     normTotal += n
                 else:
-                    areaTotal += face.area
-                    normTotal += face.normal
+                    areaTotal += poly.area
+                    normTotal += poly.normal
 
         return areaTotal, normTotal
 
@@ -360,17 +439,21 @@ def objectVolume(obj, globalSpace):
         if not checkManifold(obj):
             return -1
 
+        # Check if mesh has n-gons
+        if checkNgon(obj):
+            return -2
+
         mesh = obj.data
 
         volTot = 0
 
-        for face in mesh.faces:
-            fzn = face.normal.z
+        for poly in mesh.polygons:
+            fzn = poly.normal.z
 
-            if len(face.vertices) == 4:
-                v1, v2, v3, v4 = face.vertices
+            if len(poly.vertices) == 4:
+                v1, v2, v3, v4 = poly.vertices
             else:
-                v1, v2, v3 = face.vertices
+                v1, v2, v3 = poly.vertices
 
             v1 = mesh.vertices[v1]
             v2 = mesh.vertices[v2]
@@ -403,7 +486,7 @@ def objectVolume(obj, globalSpace):
             volume = ((z1 + z2 + z3) / 3.0) * pa
 
             # Allowing for quads
-            if len(face.vertices) == 4:
+            if len(poly.vertices) == 4:
                 # Get vertex data
                 v4 = mesh.vertices[v4]
 
@@ -438,7 +521,7 @@ def objectVolume(obj, globalSpace):
 #    else:
 #        print obj.name, ': Object must be a mesh!'        # TODO
 
-    return -2
+    return -3
 
 
 # Manifold Checks
@@ -449,8 +532,8 @@ def checkManifold(obj):
 
         mc = dict([(ed.key, 0) for ed in mesh.edges])     # TODO
 
-        for f in mesh.faces:
-            for ek in f.edge_keys:
+        for p in mesh.polygons:
+            for ek in p.edge_keys:
                 mc[ek] += 1
                 if mc[ek] > 2:
                     return 0
@@ -470,6 +553,21 @@ def checkManifold(obj):
         return -1
 
 
+# Check if a mesh has n-gons (polygon with more than 4 edges).
+def checkNgon(obj):
+    if obj and obj.type == 'MESH' and obj.data:
+        mesh = obj.data
+
+        for p in mesh.polygons:
+            if len(p.vertices) > 4:
+                return 1
+
+        return 0
+
+    else:
+        return -1
+
+
 # User friendly access to the "space" setting.
 def measureGlobal(sce):
     return (sce.measure_panel_transform == "measure_global")
@@ -480,300 +578,329 @@ def measureLocal(sce):
     return (sce.measure_panel_transform == "measure_local")
 
 
-def draw_measurements_callback(self, context):
-    sce = context.scene
-
-    draw = 0
-    if hasattr(sce, "measure_panel_draw"):
-        draw = sce.measure_panel_draw
-
-    # 2D drawing code example
-    #bgl.glBegin(bgl.GL_LINE_STRIP)
-    #bgl.glVertex2i(0, 0)
-    #bgl.glVertex2i(80, 100)
-    #bgl.glEnd()
-
-    # Get measured 3D points and colors.
-    line = getMeasurePoints(context)
-    if line and draw:
-        p1, p2, color = line
-
-        # Get and convert the Perspective Matrix of the current view/region.
-        view3d = bpy.context
-        region = view3d.region_data
-        perspMatrix = region.perspective_matrix
-        tempMat = [perspMatrix[j][i] for i in range(4) for j in range(4)]
-        perspBuff = bgl.Buffer(bgl.GL_FLOAT, 16, tempMat)
-
-        # ---
-        # Store previous OpenGL settings.
-        # Store MatrixMode
-        MatrixMode_prev = bgl.Buffer(bgl.GL_INT, [1])
-        bgl.glGetIntegerv(bgl.GL_MATRIX_MODE, MatrixMode_prev)
-        MatrixMode_prev = MatrixMode_prev[0]
-
-        # Store projection matrix
-        ProjMatrix_prev = bgl.Buffer(bgl.GL_DOUBLE, [16])
-        bgl.glGetFloatv(bgl.GL_PROJECTION_MATRIX, ProjMatrix_prev)
-
-        # Store Line width
-        lineWidth_prev = bgl.Buffer(bgl.GL_FLOAT, [1])
-        bgl.glGetFloatv(bgl.GL_LINE_WIDTH, lineWidth_prev)
-        lineWidth_prev = lineWidth_prev[0]
-
-        # Store GL_BLEND
-        blend_prev = bgl.Buffer(bgl.GL_BYTE, [1])
-        bgl.glGetFloatv(bgl.GL_BLEND, blend_prev)
-        blend_prev = blend_prev[0]
-
-        line_stipple_prev = bgl.Buffer(bgl.GL_BYTE, [1])
-        bgl.glGetFloatv(bgl.GL_LINE_STIPPLE, line_stipple_prev)
-        line_stipple_prev = line_stipple_prev[0]
-
-        # Store glColor4f
-        color_prev = bgl.Buffer(bgl.GL_FLOAT, [4])
-        bgl.glGetFloatv(bgl.GL_COLOR, color_prev)
-
-        # ---
-        # Prepare for 3D drawing
-        bgl.glLoadIdentity()
-        bgl.glMatrixMode(bgl.GL_PROJECTION)
-        bgl.glLoadMatrixf(perspBuff)
-
-        bgl.glEnable(bgl.GL_BLEND)
-        bgl.glEnable(bgl.GL_LINE_STIPPLE)
-
-        # ---
-        # Draw 3D stuff.
-        width = 1
-        bgl.glLineWidth(width)
-        # X
-        bgl.glColor4f(1, 0, 0, 0.8)
-        bgl.glBegin(bgl.GL_LINE_STRIP)
-        bgl.glVertex3f(p1[0], p1[1], p1[2])
-        bgl.glVertex3f(p2[0], p1[1], p1[2])
-        bgl.glEnd()
-        # Y
-        bgl.glColor4f(0, 1, 0, 0.8)
-        bgl.glBegin(bgl.GL_LINE_STRIP)
-        bgl.glVertex3f(p1[0], p1[1], p1[2])
-        bgl.glVertex3f(p1[0], p2[1], p1[2])
-        bgl.glEnd()
-        # Z
-        bgl.glColor4f(0, 0, 1, 0.8)
-        bgl.glBegin(bgl.GL_LINE_STRIP)
-        bgl.glVertex3f(p1[0], p1[1], p1[2])
-        bgl.glVertex3f(p1[0], p1[1], p2[2])
-        bgl.glEnd()
-
-        # Dist
-        width = 2
-        bgl.glLineWidth(width)
-        bgl.glColor4f(color[0], color[1], color[2], color[3])
-        bgl.glBegin(bgl.GL_LINE_STRIP)
-        bgl.glVertex3f(p1[0], p1[1], p1[2])
-        bgl.glVertex3f(p2[0], p2[1], p2[2])
-        bgl.glEnd()
-
-        # ---
-        # Restore previous OpenGL settings
-        bgl.glLoadIdentity()
-        bgl.glMatrixMode(MatrixMode_prev)
-        bgl.glLoadMatrixf(ProjMatrix_prev)
-        bgl.glLineWidth(lineWidth_prev)
-        if not blend_prev:
-            bgl.glDisable(bgl.GL_BLEND)
-        if not line_stipple_prev:
-            bgl.glDisable(bgl.GL_LINE_STIPPLE)
-        bgl.glColor4f(color_prev[0],
-            color_prev[1],
-            color_prev[2],
-            color_prev[3])
-
-        # ---
-        # Draw (2D) text
-        # We do this after drawing the lines so
-        # we can draw it OVER the line.
-        coord_2d = location_3d_to_region_2d(context.region,
-                                            context.space_data.region_3d,
-                                            p1.lerp(p2, 0.5),
-                                            )
-        OFFSET_LINE = 10   # Offset the text a bit to the right.
-        OFFSET_Y = 15      # Offset of the lines.
-        OFFSET_VALUE = 30  # Offset of value(s) from the text.
-        dist = (p1 - p2).length
-
-        # Write distance value into the scene property,
-        # so we can display it in the panel & refresh the panel.
-        if hasattr(sce, "measure_panel_dist"):
-            sce.measure_panel_dist = dist
-            context.area.tag_redraw()
-
-        texts = [("Dist:", round(dist, PRECISION)),
-            ("X:", round(abs(p1[0] - p2[0]), PRECISION)),
-            ("Y:", round(abs(p1[1] - p2[1]), PRECISION)),
-            ("Z:", round(abs(p1[2] - p2[2]), PRECISION))]
-
-        # Draw all texts
-        # @todo Get user pref for text color in 3D View
-        bgl.glColor4f(1.0, 1.0, 1.0, 1.0)
-        blf.size(0, 12, 72)  # Prevent font size to randomly change.
-
-        loc_x = coord_2d[0] + OFFSET_LINE
-        loc_y = coord_2d[1]
-        for t in texts:
-            text = t[0]
-            value = str(t[1]) + " BU"
-
-            blf.position(0, loc_x, loc_y, 0)
-            blf.draw(0, text)
-            blf.position(0, loc_x + OFFSET_VALUE, loc_y, 0)
-            blf.draw(0, value)
-
-            loc_y -= OFFSET_Y
-
-    if sce.measure_panel_calc_edge_length:
-        if context.mode == 'EDIT_MESH':
-            obj = context.active_object
+# Calculate values if geometry, selection or cursor changed.
+ at persistent
+def scene_update(context):
+    sce = context
+    mode = bpy.context.mode
 
-            length_total = objectEdgeLength(obj, True, measureGlobal(sce))
+    if (mode == 'EDIT_MESH' and not sce.measure_panel_update):
+        return
 
-            sce.measure_panel_edge_length = length_total
+    if (bpy.data.objects.is_updated
+        or bpy.context.scene.is_updated
+        or sce.measure_panel_update):
+        # TODO: Better way to check selection changes and cursor changes?
 
-        elif context.mode == 'OBJECT':
-            length_total = -1
+        sel_objs = bpy.context.selected_objects
 
-            for o in context.selected_objects:
-                if o.type == 'MESH':
-                    length = objectEdgeLength(o, False, measureGlobal(sce))
+        # EDGE LENGTH
+        if sce.measure_panel_calc_edge_length:
+            if (mode == 'EDIT_MESH'
+                and sce.measure_panel_update):
+                sce.measure_panel_update = 0
+                obj = context.active_object
 
-                    if length >= 0:
-                        if length_total < 0:
-                            length_total = 0
-
-                        length_total += length
-
-            sce.measure_panel_edge_length = length_total
-
-    # Handle mesh surface area calulations
-    if sce.measure_panel_calc_area:
-        # Get a single selected object (or nothing).
-        obj = getSingleObject(context)
+                #if obj.is_updated:
+                length_total = objectEdgeLength(obj, True,
+                    measureGlobal(sce))
+                sce.measure_panel_edge_length = length_total
+
+            elif mode == 'OBJECT':
+                length_total = -1
+
+                for o in sel_objs:
+                    if o.type == 'MESH':
+                        length = objectEdgeLength(o, False, measureGlobal(sce))
+
+                        if length >= 0:
+                            if length_total < 0:
+                                length_total = 0
+
+                            length_total += length
+
+                sce.measure_panel_edge_length = length_total
+
+        # AREA
+        # Handle mesh surface area calulations
+        if sce.measure_panel_calc_area:
+            if (mode == 'EDIT_MESH'
+                and sce.measure_panel_update):
+                sce.measure_panel_update = 0
+                obj = bpy.context.active_object
+
+                if obj and obj.type == 'MESH' and obj.data:
+                    # "Note: a Mesh will return the selection state of the mesh
+                    # when EditMode was last exited. A Python script operating
+                    # in EditMode must exit EditMode before getting the current
+                    # selection state of the mesh."
+                    # http://www.blender.org/documentation/249PythonDoc/
+                    # /Mesh.MVert-class.html#sel
+                    # We can only provide this by existing &
+                    # re-entering EditMode.
+                    # @todo: Better way to do this?
+
+                    # Get mesh data from Object.
+                    me = obj.data
+
+                    # Get transformation matrix from object.
+                    ob_mat = obj.matrix_world
+                    # Also make an inversed copy! of the matrix.
+                    ob_mat_inv = ob_mat.copy()
+                    Matrix.invert(ob_mat_inv)
+
+                    # Get the selected vertices.
+                    # @todo: Better (more efficient) way to do this?
+                    verts_selected = [v for v in me.vertices if v.select == 1]
 
-        if context.mode == 'EDIT_MESH':
-            obj = context.active_object
+                    if len(verts_selected) >= 3:
+                        # Get selected faces
+                        # @todo: Better (more efficient) way to do this?
+                        polys_selected = [p for p in me.polygons
+                            if p.select == 1]
 
-            if obj and obj.type == 'MESH' and obj.data:
-                # "Note: a Mesh will return the selection state of the mesh
-                # when EditMode was last exited. A Python script operating
-                # in EditMode must exit EditMode before getting the current
-                # selection state of the mesh."
-                # http://www.blender.org/documentation/249PythonDoc/
-                # /Mesh.MVert-class.html#sel
-                # We can only provide this by existing & re-entering EditMode.
-                # @todo: Better way to do this?
+                        if len(polys_selected) > 0:
+                            area, normal = objectSurfaceArea(obj, True,
+                                measureGlobal(sce))
+                            if area >= 0.0:
+                                sce.measure_panel_area1 = area
+                                sce.measure_panel_normal1 = normal
 
-                # Get mesh data from Object.
-                mesh = obj.data
+            elif mode == 'OBJECT':
+                # We are working in object mode.
 
-                # Get transformation matrix from object.
-                ob_mat = obj.matrix_world
-                # Also make an inversed copy! of the matrix.
-                ob_mat_inv = ob_mat.copy()
-                Matrix.invert(ob_mat_inv)
+                # Get a single selected object (or nothing).
+                obj = getSingleObject()
 
-                # Get the selected vertices.
-                # @todo: Better (more efficient) way to do this?
-                verts_selected = [v for v in mesh.vertices if v.select == 1]
+                if len(sel_objs) > 2:
+                    return
+# @todo Make this work again.
+#                    # We have more that 2 objects selected...
+#
+#                    mesh_objects = [o for o in context.selected_objects
+#                       if o.type == 'MESH']
 
-                if len(verts_selected) >= 3:
-                    # Get selected faces
-                    # @todo: Better (more efficient) way to do this?
-                    faces_selected = [f for f in mesh.faces
-                        if f.select == 1]
+#                    if len(mesh_objects) > 0:
+#                        # ... and at least one of them is a mesh.
+#
+#                        for o in mesh_objects:
+#                            area = objectSurfaceArea(o, False,
+#                                measureGlobal(sce))
+#                           if area >= 0:
+#                               #row.label(text=o.name, icon='OBJECT_DATA')
+#                               #row.label(text=str(round(area, PRECISION))
+#                               #    + " BU^2")
 
-                    if len(faces_selected) > 0:
-                        area, normal = objectSurfaceArea(obj, True,
-                            measureGlobal(sce))
-                        if area >= 0.0:
-                            sce.measure_panel_area1 = area
-                            sce.measure_panel_normal1 = normal
+                elif len(sel_objs) == 2:
+                    # 2 objects selected.
 
-        elif context.mode == 'OBJECT':
-            # We are working in object mode.
+                    obj1, obj2 = sel_objs
 
-            if len(context.selected_objects) > 2:
-                return
-# @todo Make this work again.
-#                # We have more that 2 objects selected...
-#
-#                mesh_objects = [o for o in context.selected_objects
-#                    if o.type == 'MESH']
+                    # Calculate surface area of the objects.
+                    area1, normal1 = objectSurfaceArea(obj1, False,
+                        measureGlobal(sce))
+                    area2, normal2 = objectSurfaceArea(obj2, False,
+                        measureGlobal(sce))
+                    sce.measure_panel_area1 = area1
+                    sce.measure_panel_area2 = area2
+                    sce.measure_panel_normal1 = normal1
+                    sce.measure_panel_normal2 = normal2
 
-#                if len(mesh_objects) > 0:
-#                    # ... and at least one of them is a mesh.
-#
-#                    for o in mesh_objects:
-#                        area = objectSurfaceArea(o, False,
-#                            measureGlobal(sce))
-#                        if area >= 0:
-#                            #row.label(text=o.name, icon='OBJECT_DATA')
-#                            #row.label(text=str(round(area, PRECISION))
-#                            #    + " BU^2")
+                elif obj:
+                    # One object selected.
 
-            elif len(context.selected_objects) == 2:
-                # 2 objects selected.
+                    # Calculate surface area of the object.
+                    area, normal = objectSurfaceArea(obj, False,
+                        measureGlobal(sce))
 
-                obj1, obj2 = context.selected_objects
+                    sce.measure_panel_area1 = area
+                    sce.measure_panel_normal1 = normal
 
-                # Calculate surface area of the objects.
-                area1, normal1 = objectSurfaceArea(obj1, False,
-                    measureGlobal(sce))
-                area2, normal2 = objectSurfaceArea(obj2, False,
-                    measureGlobal(sce))
-                sce.measure_panel_area1 = area1
-                sce.measure_panel_area2 = area2
-                sce.measure_panel_normal1 = normal1
-                sce.measure_panel_normal2 = normal2
+        # VOLUME
+        # Handle mesh volume calulations.
+        if sce.measure_panel_calc_volume:
+            obj = getSingleObject()
 
-            elif obj:
-                # One object selected.
+            if mode == 'OBJECT':
+                # We are working in object mode.
 
-                # Calculate surface area of the object.
-                area, normal = objectSurfaceArea(obj, False,
-                    measureGlobal(sce))
+                #if len(sel_objs) > 2:       # TODO
+                #el
+                if len(sel_objs) == 2:
+                    # 2 objects selected.
 
-                sce.measure_panel_area1 = area
-                sce.measure_panel_normal1 = normal
+                    obj1, obj2 = sel_objs
 
-    if sce.measure_panel_calc_volume:
-        obj = getSingleObject(context)
+                    # Calculate surface area of the objects.
+                    volume1 = objectVolume(obj1, measureGlobal(sce))
+                    volume2 = objectVolume(obj2, measureGlobal(sce))
 
-        if context.mode == 'OBJECT':
-            # We are working in object mode.
+                    sce.measure_panel_volume1 = volume1
+                    sce.measure_panel_volume2 = volume2
 
-            #if len(context.selected_objects) > 2:       # TODO
+                elif obj:
+                    # One object selected.
 
-            #el
-            if len(context.selected_objects) == 2:
-                # 2 objects selected.
+                    # Calculate surface area of the object.
+                    volume1 = objectVolume(obj, measureGlobal(sce))
 
-                obj1, obj2 = context.selected_objects
+                    sce.measure_panel_volume1 = volume1
 
-                # Calculate surface area of the objects.
-                volume1 = objectVolume(obj1, measureGlobal(sce))
-                volume2 = objectVolume(obj2, measureGlobal(sce))
 
-                sce.measure_panel_volume1 = volume1
-                sce.measure_panel_volume2 = volume2
+def draw_measurements_callback(self, context):
+    sce = context.scene
 
-            elif obj:
-                # One object selected.
+    draw = 0
+    if hasattr(sce, "measure_panel_draw"):
+        draw = sce.measure_panel_draw
 
-                # Calculate surface area of the object.
-                volume1 = objectVolume(obj, measureGlobal(sce))
+    # 2D drawing code example
+    #bgl.glBegin(bgl.GL_LINE_STRIP)
+    #bgl.glVertex2i(0, 0)
+    #bgl.glVertex2i(80, 100)
+    #bgl.glEnd()
 
-                sce.measure_panel_volume1 = volume1
+    if draw:
+        # Get measured 3D points and colors.
+        line = getMeasurePoints(context)
+
+        if line:
+            p1, p2, color = line
+
+            # Get & convert the Perspective Matrix of the current view/region.
+            view3d = bpy.context
+            region = view3d.region_data
+            perspMatrix = region.perspective_matrix
+            tempMat = [perspMatrix[j][i] for i in range(4) for j in range(4)]
+            perspBuff = bgl.Buffer(bgl.GL_FLOAT, 16, tempMat)
+
+            # ---
+            # Store previous OpenGL settings.
+            # Store MatrixMode
+            MatrixMode_prev = bgl.Buffer(bgl.GL_INT, [1])
+            bgl.glGetIntegerv(bgl.GL_MATRIX_MODE, MatrixMode_prev)
+            MatrixMode_prev = MatrixMode_prev[0]
+
+            # Store projection matrix
+            ProjMatrix_prev = bgl.Buffer(bgl.GL_DOUBLE, [16])
+            bgl.glGetFloatv(bgl.GL_PROJECTION_MATRIX, ProjMatrix_prev)
+
+            # Store Line width
+            lineWidth_prev = bgl.Buffer(bgl.GL_FLOAT, [1])
+            bgl.glGetFloatv(bgl.GL_LINE_WIDTH, lineWidth_prev)
+            lineWidth_prev = lineWidth_prev[0]
+
+            # Store GL_BLEND
+            blend_prev = bgl.Buffer(bgl.GL_BYTE, [1])
+            bgl.glGetFloatv(bgl.GL_BLEND, blend_prev)
+            blend_prev = blend_prev[0]
+
+            line_stipple_prev = bgl.Buffer(bgl.GL_BYTE, [1])
+            bgl.glGetFloatv(bgl.GL_LINE_STIPPLE, line_stipple_prev)
+            line_stipple_prev = line_stipple_prev[0]
+
+            # Store glColor4f
+            color_prev = bgl.Buffer(bgl.GL_FLOAT, [4])
+            bgl.glGetFloatv(bgl.GL_COLOR, color_prev)
+
+            # ---
+            # Prepare for 3D drawing
+            bgl.glLoadIdentity()
+            bgl.glMatrixMode(bgl.GL_PROJECTION)
+            bgl.glLoadMatrixf(perspBuff)
+
+            bgl.glEnable(bgl.GL_BLEND)
+            bgl.glEnable(bgl.GL_LINE_STIPPLE)
+
+            # ---
+            # Draw 3D stuff.
+            bgl.glLineWidth(LINE_WIDTH_XYZ)
+            # X
+            bgl.glColor4f(1, 0, 0, 0.8)
+            bgl.glBegin(bgl.GL_LINE_STRIP)
+            bgl.glVertex3f(p1[0], p1[1], p1[2])
+            bgl.glVertex3f(p2[0], p1[1], p1[2])
+            bgl.glEnd()
+            # Y
+            bgl.glColor4f(0, 1, 0, 0.8)
+            bgl.glBegin(bgl.GL_LINE_STRIP)
+            bgl.glVertex3f(p1[0], p1[1], p1[2])
+            bgl.glVertex3f(p1[0], p2[1], p1[2])
+            bgl.glEnd()
+            # Z
+            bgl.glColor4f(0, 0, 1, 0.8)
+            bgl.glBegin(bgl.GL_LINE_STRIP)
+            bgl.glVertex3f(p1[0], p1[1], p1[2])
+            bgl.glVertex3f(p1[0], p1[1], p2[2])
+            bgl.glEnd()
+
+            # Dist
+            bgl.glLineWidth(LINE_WIDTH_DIST)
+            bgl.glColor4f(color[0], color[1], color[2], color[3])
+            bgl.glBegin(bgl.GL_LINE_STRIP)
+            bgl.glVertex3f(p1[0], p1[1], p1[2])
+            bgl.glVertex3f(p2[0], p2[1], p2[2])
+            bgl.glEnd()
+
+            # ---
+            # Restore previous OpenGL settings
+            bgl.glLoadIdentity()
+            bgl.glMatrixMode(MatrixMode_prev)
+            bgl.glLoadMatrixf(ProjMatrix_prev)
+            bgl.glLineWidth(lineWidth_prev)
+            if not blend_prev:
+                bgl.glDisable(bgl.GL_BLEND)
+            if not line_stipple_prev:
+                bgl.glDisable(bgl.GL_LINE_STIPPLE)
+            bgl.glColor4f(
+                color_prev[0],
+                color_prev[1],
+                color_prev[2],
+                color_prev[3])
+
+            # ---
+            # Draw (2D) text
+            # We do this after drawing the lines so
+            # we can draw it OVER the line.
+            coord_2d = location_3d_to_region_2d(
+                context.region,
+                context.space_data.region_3d,
+                p1.lerp(p2, 0.5))
+            dist = (p1 - p2).length
+
+            # Write distance value into the scene property,
+            # so we can display it in the panel & refresh the panel.
+            if hasattr(sce, "measure_panel_dist"):
+                sce.measure_panel_dist = dist
+                context.area.tag_redraw()
+
+            texts = [
+                ("Dist:", dist),
+                ("X:", abs(p1[0] - p2[0])),
+                ("Y:", abs(p1[1] - p2[1])),
+                ("Z:", abs(p1[2] - p2[2]))]
+
+            # Draw all texts
+            # @todo Get user pref for text color in 3D View
+            bgl.glColor4f(1.0, 1.0, 1.0, 1.0)
+            blf.size(0, 12, 72)  # Prevent font size to randomly change.
+
+            uinfo = getUnitsInfo()
+
+            loc_x = coord_2d[0] + OFFSET_LINE
+            loc_y = coord_2d[1]
+
+            for t in texts:
+                text = t[0]
+
+                value = convertDistance(t[1], uinfo)
+
+                blf.position(0, loc_x, loc_y, 0)
+                blf.draw(0, text)
+                blf.position(0, loc_x + OFFSET_VALUE, loc_y, 0)
+                blf.draw(0, value)
+
+                loc_y -= OFFSET_Y
 
 
 class VIEW3D_OT_display_measurements(bpy.types.Operator):
@@ -837,11 +964,13 @@ class VIEW3D_OT_reenter_editmode(bpy.types.Operator):
 
         # Get the active object.
         obj = context.active_object
+        sce = context.scene
 
         if obj and obj.type == 'MESH' and context.mode == 'EDIT_MESH':
             # Exit and re-enter mesh EditMode.
             bpy.ops.object.mode_set(mode='OBJECT')
             bpy.ops.object.mode_set(mode='EDIT')
+            sce.measure_panel_update = 1
             return {'FINISHED'}
 
         return {'CANCELLED'}
@@ -856,9 +985,9 @@ class VIEW3D_PT_measure(bpy.types.Panel):
     @classmethod
     def poll(cls, context):
         # Only display this panel in the object and edit mode 3D view.
+        mode = context.mode
         if (context.area.type == 'VIEW_3D' and
-            (context.mode == 'EDIT_MESH'
-            or context.mode == 'OBJECT')):
+            (mode == 'EDIT_MESH' or mode == 'OBJECT')):
             return 1
 
         return 0
@@ -867,30 +996,23 @@ class VIEW3D_PT_measure(bpy.types.Panel):
         layout = self.layout
         sce = context.scene
 
-        # Force a redraw.
-        # This prevents the lines still be drawn after
-        # disabling the "measure_panel_draw" checkbox.
-        # @todo Better solution?
-        context.area.tag_redraw()
-
         mgr_ops = context.window_manager.operators.values()
         if (not "VIEW3D_OT_display_measurements"
             in [op.bl_idname for op in mgr_ops]):
             layout.operator("view3d.activate_measure_panel",
                         text="Activate")
 
-        context.area.tag_redraw()
-
     def draw(self, context):
         layout = self.layout
         sce = context.scene
+        mode = context.mode
 
         # Get a single selected object (or nothing).
-        obj = getSingleObject(context)
+        obj = getSingleObject()
 
         drawTansformButtons = 1
 
-        if context.mode == 'EDIT_MESH':
+        if mode == 'EDIT_MESH':
             obj = context.active_object
 
             row = layout.row()
@@ -1007,15 +1129,15 @@ class VIEW3D_PT_measure(bpy.types.Panel):
                     if sce.measure_panel_calc_area:
                         # Get selected faces
                         # @todo: Better (more efficient) way to do this?
-                        faces_selected = [f for f in mesh.faces
-                            if f.select == 1]
+                        polys_selected = [p for p in mesh.polygons
+                            if p.select == 1]
 
-                        if len(faces_selected) > 0:
+                        if len(polys_selected) > 0:
                             if sce.measure_panel_area1 >= 0:
                                 box = layout.box()
                                 row = box.row()
                                 row.label(
-                                    text=str(len(faces_selected)),
+                                    text=str(len(polys_selected)),
                                     icon='FACESEL')
 
                                 row = box.row()
@@ -1038,7 +1160,7 @@ class VIEW3D_PT_measure(bpy.types.Panel):
                         "measure_panel_transform",
                         expand=True)
 
-        elif context.mode == 'OBJECT':
+        elif mode == 'OBJECT':
             # We are working in object mode.
 
             mesh_objects = [o for o in context.selected_objects
@@ -1170,7 +1292,7 @@ class VIEW3D_PT_measure(bpy.types.Panel):
 
                 if sce.measure_panel_calc_volume:
                     # Display volume of the objects.
-                    if sce.measure_panel_volume1 >= -1:
+                    if sce.measure_panel_volume1 >= -2:
                         box = layout.box()
                         row = box.row()
                         row.label(text=obj1.name, icon='OBJECT_DATA')
@@ -1179,12 +1301,17 @@ class VIEW3D_PT_measure(bpy.types.Panel):
                             row = box.row()
                             row.label(text="Volume")
                             row.prop(sce, "measure_panel_volume1")
-                        else:  # -1
+                        elif sce.measure_panel_volume1 >= -1:
                             row = box.row()
                             row.label(text="Mesh is non-manifold!",
                                 icon='INFO')
+                        else:  # -2
+                            row = box.row()
+                            row.label(text="Mesh has n-gons (faces with " \
+                                "more than 4 edges)!",
+                                icon='INFO')
 
-                    if sce.measure_panel_volume2 >= -1:
+                    if sce.measure_panel_volume2 >= -2:
                         box = layout.box()
                         row = box.row()
                         row.label(text=obj2.name, icon='OBJECT_DATA')
@@ -1193,10 +1320,15 @@ class VIEW3D_PT_measure(bpy.types.Panel):
                             row = box.row()
                             row.label(text="Volume")
                             row.prop(sce, "measure_panel_volume2")
-                        else:  # -1
+                        elif sce.measure_panel_volume2 >= -1:
                             row = box.row()
                             row.label(text="Mesh is non-manifold!",
                                 icon='INFO')
+                        else:  # -2
+                            row = box.row()
+                            row.label(text="Mesh has n-gons (faces with " \
+                                "more than 4 edges)!",
+                                icon='INFO')
 
             elif obj:
                 # One object selected.
@@ -1260,7 +1392,7 @@ class VIEW3D_PT_measure(bpy.types.Panel):
 
                 if sce.measure_panel_calc_volume:
                     # Display volume of the objects.
-                    if sce.measure_panel_volume1 >= -1:
+                    if sce.measure_panel_volume1 >= -2:
                         box = layout.box()
                         row = box.row()
                         row.label(text=obj.name, icon='OBJECT_DATA')
@@ -1269,10 +1401,15 @@ class VIEW3D_PT_measure(bpy.types.Panel):
                             row = box.row()
                             row.label(text="Volume")
                             row.prop(sce, "measure_panel_volume1")
-                        else:  # -1
+                        elif sce.measure_panel_volume1 >= -1:
                             row = box.row()
                             row.label(text="Mesh is non-manifold!",
                                 icon='INFO')
+                        else:  # -2
+                            row = box.row()
+                            row.label(text="Mesh has n-gons (faces with " \
+                                "more than 4 edges)!",
+                                icon='INFO')
 
             elif not context.selected_objects:
                 # Nothing selected.
@@ -1305,30 +1442,39 @@ class VIEW3D_PT_measure(bpy.types.Panel):
 def register():
     bpy.utils.register_module(__name__)
 
+    bpy.app.handlers.scene_update_post.append(scene_update)
+
     # Define a temporary attribute for the distance value
     bpy.types.Scene.measure_panel_dist = bpy.props.FloatProperty(
         name="Distance",
         precision=PRECISION,
         unit="LENGTH")
     bpy.types.Scene.measure_panel_edge_length = bpy.props.FloatProperty(
+        name="",
         precision=PRECISION,
         unit="LENGTH")
     bpy.types.Scene.measure_panel_area1 = bpy.props.FloatProperty(
+        name="",
         precision=PRECISION,
         unit="AREA")
     bpy.types.Scene.measure_panel_area2 = bpy.props.FloatProperty(
+        name="",
         precision=PRECISION,
         unit="AREA")
     bpy.types.Scene.measure_panel_normal1 = bpy.props.FloatVectorProperty(
+        name="",
         precision=PRECISION,
         subtype="XYZ")
     bpy.types.Scene.measure_panel_normal2 = bpy.props.FloatVectorProperty(
+        name="",
         precision=PRECISION,
         subtype="XYZ")
     bpy.types.Scene.measure_panel_volume1 = bpy.props.FloatProperty(
+        name="",
         precision=PRECISION,
         unit="VOLUME")
     bpy.types.Scene.measure_panel_volume2 = bpy.props.FloatProperty(
+        name="",
         precision=PRECISION,
         unit="VOLUME")
 
@@ -1368,12 +1514,35 @@ def register():
                     "usage on bigger meshes)",
         default=0)
 
+     # Define dropdown for the global/local setting
+    bpy.types.Scene.measure_panel_update = bpy.props.BoolProperty(
+        description="Update CPU heavy calculations",
+        default=0)
+
     pass
 
 
 def unregister():
     bpy.utils.unregister_module(__name__)
 
+    bpy.app.handlers.scene_update_post.remove(scene_update)
+
+    # Remove properties.
+    del bpy.types.Scene.measure_panel_dist
+    del bpy.types.Scene.measure_panel_edge_length
+    del bpy.types.Scene.measure_panel_area1
+    del bpy.types.Scene.measure_panel_area2
+    del bpy.types.Scene.measure_panel_normal1
+    del bpy.types.Scene.measure_panel_normal2
+    del bpy.types.Scene.measure_panel_volume1
+    del bpy.types.Scene.measure_panel_volume2
+    del bpy.types.Scene.measure_panel_transform
+    del bpy.types.Scene.measure_panel_draw
+    del bpy.types.Scene.measure_panel_calc_edge_length
+    del bpy.types.Scene.measure_panel_calc_area
+    del bpy.types.Scene.measure_panel_calc_volume
+    del bpy.types.Scene.measure_panel_update
+
     pass
 
 if __name__ == "__main__":
diff --git a/release/scripts/addons/space_view3d_spacebar_menu.py b/release/scripts/addons/space_view3d_spacebar_menu.py
index edfc336..359c180 100644
--- a/release/scripts/addons/space_view3d_spacebar_menu.py
+++ b/release/scripts/addons/space_view3d_spacebar_menu.py
@@ -23,7 +23,6 @@ bl_info = {
     "author": "JayDez, sim88, meta-androcto, sam",
     "version": (1, 7, 3),
     "blender": (2, 6, 0),
-    "api": 41287,
     "location": "View3D > Spacebar Key",
     "description": "Context Sensitive Spacebar Menu",
     "warning": "",
@@ -805,7 +804,7 @@ class VIEW3D_MT_SelectMenu(bpy.types.Menu):
         layout.operator("view3d.select_circle")
         layout.separator()
 
-        layout.operator("object.select_all", text="Select/Deselect All").action = 'TOGGLE'
+        layout.operator("object.select_all").action = 'TOGGLE'
         layout.operator("object.select_all", text="Inverse").action = 'INVERT'
         layout.operator("object.select_random", text="Random")
         layout.operator("object.select_mirror", text="Mirror")
@@ -831,7 +830,7 @@ class VIEW3D_MT_SelectEditMenu(bpy.types.Menu):
         layout.operator("view3d.select_circle")
         layout.separator()
 
-        layout.operator("mesh.select_all", text="Select/Deselect All").action = 'TOGGLE'
+        layout.operator("mesh.select_all").action = 'TOGGLE'
         layout.operator("mesh.select_all", text="Inverse").action = 'INVERT'
         layout.separator()
 
@@ -840,7 +839,7 @@ class VIEW3D_MT_SelectEditMenu(bpy.types.Menu):
         layout.operator("mesh.edges_select_sharp", text="Sharp Edges")
         layout.operator("mesh.faces_select_linked_flat",
                         text="Linked Flat Faces")
-        layout.operator("mesh.faces_select_interior", text="Interior Faces")
+        layout.operator("mesh.select_interior_faces", text="Interior Faces")
         layout.operator("mesh.select_axis", text="Side of Active")
         layout.separator()
 
@@ -881,7 +880,7 @@ class VIEW3D_MT_SelectCurveMenu(bpy.types.Menu):
         layout.operator("view3d.select_circle")
         layout.separator()
 
-        layout.operator("curve.select_all", text="Select/Deselect All").action = 'TOGGLE'
+        layout.operator("curve.select_all").action = 'TOGGLE'
         layout.operator("curve.select_all").action = 'INVERT'
         layout.operator("curve.select_random")
         layout.operator("curve.select_nth")
@@ -905,7 +904,7 @@ class VIEW3D_MT_SelectArmatureMenu(bpy.types.Menu):
         layout.operator("view3d.select_border")
         layout.separator()
 
-        layout.operator("armature.select_all", text="Select/Deselect All")
+        layout.operator("armature.select_all")
         layout.operator("armature.select_inverse", text="Inverse")
         layout.separator()
 
@@ -937,7 +936,7 @@ class VIEW3D_MT_SelectPoseMenu(bpy.types.Menu):
         layout.operator("view3d.select_border")
         layout.separator()
 
-        layout.operator("pose.select_all", text="Select/Deselect All").action = 'TOGGLE'
+        layout.operator("pose.select_all").action = 'TOGGLE'
         layout.operator("pose.select_all", text="Inverse").action = 'INVERT'
         layout.operator("pose.select_constraint_target",
                         text="Constraint Target")
@@ -1003,7 +1002,7 @@ class VIEW3D_MT_SelectSurface(bpy.types.Menu):
 
         layout.separator()
 
-        layout.operator("curve.select_all", text="Select/Deselect All").action = 'TOGGLE'
+        layout.operator("curve.select_all").action = 'TOGGLE'
         layout.operator("curve.select_all").action = 'INVERT'
         layout.operator("curve.select_random")
         layout.operator("curve.select_nth")
diff --git a/release/scripts/addons/system_blend_info.py b/release/scripts/addons/system_blend_info.py
index 75bcc7a..d89f12d 100644
--- a/release/scripts/addons/system_blend_info.py
+++ b/release/scripts/addons/system_blend_info.py
@@ -126,6 +126,12 @@ class OBJECT_PT_blendinfo(bpy.types.Panel):
         row.label(text=quantity_string(num, "Empty", "Empties"),
             icon='EMPTY_DATA')
 
+        row = ob_cols[1].row()
+        empties = [o for o in objects.values() if o.type == 'SPEAKER']
+        num = len(empties)
+        row.label(text=quantity_string(num, "Speaker", "Speakers"),
+            icon='OUTLINER_OB_SPEAKER')
+
         layout.separator()
         
         # DATABLOCKS
diff --git a/release/scripts/addons/system_demo_mode/demo_mode.py b/release/scripts/addons/system_demo_mode/demo_mode.py
index 54dfa2b..efccd94 100644
--- a/release/scripts/addons/system_demo_mode/demo_mode.py
+++ b/release/scripts/addons/system_demo_mode/demo_mode.py
@@ -69,7 +69,7 @@ global_state = {
     "reset_anim": False,
     "anim_cycles": 0,  # count how many times we played the anim
     "last_frame": -1,
-    "render_out": "",
+    "is_render": False,
     "render_time": "",  # time render was finished.
     "timer": None,
     "basedir": "",  # demo.py is stored here
@@ -77,6 +77,26 @@ global_state = {
 }
 
 
+# -----------------------------------------------------------------------------
+# render handler - maintain "is_render"
+
+def handle_render_clear():
+    for ls in (bpy.app.handlers.render_complete, bpy.app.handlers.render_cancel):
+        while handle_render_done_cb in ls:
+            ls.remove(handle_render_done_cb)
+
+
+def handle_render_done_cb(self):
+    global_state["is_render"] = True
+
+
+def handle_render_init():
+    handle_render_clear()
+    bpy.app.handlers.render_complete.append(handle_render_done_cb)
+    bpy.app.handlers.render_cancel.append(handle_render_done_cb)
+    global_state["is_render"] = False
+
+
 def demo_mode_auto_select():
 
     play_area = 0
@@ -162,18 +182,9 @@ def demo_mode_init():
     elif global_config["mode"] == 'RENDER':
         print("  render")
 
-        # setup tempfile
-        handle, global_state["render_out"] = tempfile.mkstemp()
-        os.close(handle)
-        del handle
-
-        if os.path.exists(global_state["render_out"]):
-            print("  render!!!")
-            os.remove(global_state["render_out"])
-
         # setup scene.
         scene = bpy.context.scene
-        scene.render.filepath = global_state["render_out"]
+        scene.render.filepath = "TEMP_RENDER"
         scene.render.image_settings.file_format = 'AVI_JPEG' if global_config["anim_render"] else 'PNG'
         scene.render.use_file_extension = False
         scene.render.use_placeholder = False
@@ -181,13 +192,14 @@ def demo_mode_init():
             if global_config["anim_render"]:
                 bpy.ops.render.render('INVOKE_DEFAULT', animation=True)
             else:
-                bpy.ops.render.render('INVOKE_DEFAULT', write_still=True)
+                bpy.ops.render.render('INVOKE_DEFAULT')  # write_still=True, no need to write now.
+
+                handle_render_init()
+
         except RuntimeError:  # no camera for eg:
             import traceback
             traceback.print_exc()
 
-            open(global_state["render_out"], 'w').close()  # touch so we move on.
-
     else:
         raise Exception("Unsupported mode %r" % global_config["mode"])
 
@@ -254,14 +266,14 @@ def demo_mode_update():
     # --------------------------------------------------------------------------
     # RENDER MODE
     elif global_config["mode"] == 'RENDER':
-        if os.path.exists(global_state["render_out"]):
+        if global_state["is_render"]:
             # wait until the time has passed
             # XXX, todo, if rendering an anim we need some way to check its done.
             if global_state["render_time"] == -1.0:
                 global_state["render_time"] = time.time()
             else:
                 if time.time() - global_state["render_time"] > global_config["display_render"]:
-                    os.remove(global_state["render_out"])
+                    handle_render_clear()
                     demo_mode_next_file()
                     return
     else:
diff --git a/release/scripts/addons/texture_paint_layer_manager.py b/release/scripts/addons/texture_paint_layer_manager.py
index 8552601..757f8a9 100644
--- a/release/scripts/addons/texture_paint_layer_manager.py
+++ b/release/scripts/addons/texture_paint_layer_manager.py
@@ -346,16 +346,17 @@ def main(context,tn):
     m_id = ob.active_material_index 
 
     if img:
-        for f in me.faces:  
+        for f in me.polygons:  
             if f.material_index == m_id:
-                uvtex[f.index].select_uv
                 uvtex[f.index].image = img
+
             
 
     else:
-        for f in me.faces:  
+        for f in me.polygons:  
             if f.material_index == m_id:
                 uvtex[f.index].image = None
+ 
     me.update()
 
 
@@ -383,7 +384,7 @@ class set_active_paint_layer(bpy.types.Operator):
 
 
 def add_image_kludge(iname = 'grey', iwidth = 256, iheight = 256, 
-        icolor = (0.5,0.5,0.5,1.0)):
+        icolor = (0.5,0.5,0.5,1.0), nfloat = False):
     #evil kludge to get index of new image created using bpy.ops
     #store current images
     tl =[]
@@ -394,7 +395,7 @@ def add_image_kludge(iname = 'grey', iwidth = 256, iheight = 256,
     #create a new image
 
     bpy.ops.image.new(name =iname,width =iwidth,height =iheight, 
-            color = icolor)
+            color = icolor, float = nfloat)
         
     #find its creation index
     it = 0
@@ -410,10 +411,12 @@ def add_paint(context, size =2048, typ = 'NORMAL'):
     ob = bpy.context.object
     mat = ob.active_material
     ts = mat.texture_slots.add()
+    ifloat = False
 
     if typ =='NORMAL':
         color =(0.5,0.5,0.5,1.0)
         iname = 'Bump'
+        ifloat = True
     elif typ =='COLOR':
         iname ='Color'
         color = (1.0,1.0,1.0,0.0)
@@ -434,7 +437,7 @@ def add_paint(context, size =2048, typ = 'NORMAL'):
     tex = bpy.data.textures.new(name = iname, type = 'IMAGE')
     ts.texture = tex
     img = add_image_kludge(iname = typ, 
-        iwidth = size,iheight = size, icolor= color )
+        iwidth = size,iheight = size, icolor= color, nfloat = ifloat)
     tex.image = img
     
     if typ == 'COLOR':
@@ -445,7 +448,7 @@ def add_paint(context, size =2048, typ = 'NORMAL'):
         ts.use_map_normal = True
         ts.use_map_color_diffuse =False
         ts.normal_factor = -1
-        ts.bump_method='BUMP_DEFAULT'
+        ts.bump_method='BUMP_MEDIUM_QUALITY'
         ts.bump_objectspace='BUMP_OBJECTSPACE'
         
     elif typ == 'SPECULAR':
@@ -630,4 +633,4 @@ 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/add_curve_objects/__init__.py b/release/scripts/addons_contrib/add_curve_objects/__init__.py
new file mode 100644
index 0000000..53f212e
--- /dev/null
+++ b/release/scripts/addons_contrib/add_curve_objects/__init__.py
@@ -0,0 +1,92 @@
+# ##### 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 #####
+# Contributed to by
+# meta-androcto #
+
+bl_info = {
+    "name": "Curve Objects",
+    "author": "Multiple Authors",
+    "version": (0, 1),
+    "blender": (2, 6, 3),
+    "location": "View3D > Add > Curve > Curve Objects",
+    "description": "Add extra curve object types",
+    "warning": "",
+    "wiki_url": "",
+    "tracker_url": "",
+    "category": "Add Curve"}
+
+
+if "bpy" in locals():
+    import imp
+    imp.reload(add_curve_rectangle_259)
+    imp.reload(add_curve_spirals)
+    imp.reload(cotejrp1_particle_tracer)
+    imp.reload(cotejrp1_string_it)
+    imp.reload(curve_simplify)
+	
+else:
+    from . import add_curve_rectangle_259
+    from . import add_curve_spirals
+    from . import cotejrp1_particle_tracer
+    from . import cotejrp1_string_it
+    from . import curve_simplify
+
+import bpy
+
+
+class INFO_MT_curve_extras_add(bpy.types.Menu):
+    # Define the "Extras" menu
+    bl_idname = "INFO_MT_curve_extra_objects_add"
+    bl_label = "Curve Objects"
+
+    def draw(self, context):
+        layout = self.layout
+        layout.operator_context = 'INVOKE_REGION_WIN'
+        layout.operator("curve.rectangle",
+            text="Rectangle")
+        layout.operator("curve.spirals",
+            text="Spirals")
+        layout.operator("curve.particle_tracer",
+            text="Particle Tracer")
+        layout.operator("curve.string_it_operator",
+            text="String It")
+        layout.operator("curve.simplify",
+            text="Curve Simplify")
+
+# Register all operators and panels
+
+# Define "Extras" menu
+def menu_func(self, context):
+    self.layout.menu("INFO_MT_curve_extra_objects_add", icon="PLUGIN")
+
+
+def register():
+    bpy.utils.register_module(__name__)
+
+    # Add "Extras" menu to the "Add Mesh" menu
+    bpy.types.INFO_MT_curve_add.append(menu_func)
+
+
+def unregister():
+    bpy.utils.unregister_module(__name__)
+
+    # Remove "Extras" menu from the "Add Mesh" menu.
+    bpy.types.INFO_MT_curve_add.remove(menu_func)
+
+if __name__ == "__main__":
+    register()
diff --git a/release/scripts/addons_contrib/add_curve_objects/add_curve_rectangle_259.py b/release/scripts/addons_contrib/add_curve_objects/add_curve_rectangle_259.py
new file mode 100644
index 0000000..89fe704
--- /dev/null
+++ b/release/scripts/addons_contrib/add_curve_objects/add_curve_rectangle_259.py
@@ -0,0 +1,244 @@
+'''# ##### 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": "Rectangle",
+    "author": "Carbonic Wolf",
+    "version": (1,1),
+    "blender": (2, 5, 9),
+    "api": 39933,
+    "location": "View3D > Add > Curve",
+    "description": "Add rectangle",
+    "warning": "",
+    "wiki_url": "",
+    "tracker_url": "",
+    "category": "Add Curve"}
+    
+ '''   
+##------------------------------------------------------------
+#### import modules
+import bpy
+from bpy.props import *
+from mathutils import *
+from math import *
+
+##------------------------------------------------------------
+# calculates the matrix for the new object
+# depending on user pref
+def align_matrix(context):
+    loc = Matrix.Translation(context.scene.cursor_location)
+    obj_align = context.user_preferences.edit.object_align
+    if (context.space_data.type == 'VIEW_3D'
+        and obj_align == 'VIEW'):
+        rot = context.space_data.region_3d.view_matrix.rotation_part().invert().resize4x4()
+    else:
+        rot = Matrix()
+    align_matrix = loc * rot
+    return align_matrix
+
+##------------------------------------------------------------
+#### Curve creation functions
+# sets bezierhandles to auto
+def setBezierHandles(obj, mode = 'AUTOMATIC'):
+    scene = bpy.context.scene
+    if obj.type != 'CURVE':
+        return
+    scene.objects.active = obj
+    bpy.ops.object.mode_set(mode='EDIT', toggle=True)
+    bpy.ops.curve.select_all(action='SELECT')
+    bpy.ops.curve.handle_type_set(type=mode)
+    bpy.ops.object.mode_set(mode='OBJECT', toggle=True)
+
+##------------------------------------------------------------
+#### Curve creation functions
+
+# get array of vertcoordinates acording to splinetype
+def vertsToPoints(Verts):
+    vertArray = []
+
+    for v in Verts:
+        vertArray += v
+
+    return vertArray
+
+# create new CurveObject from vertarray and splineType
+def createCurve(vertArray, props, align_matrix):
+    # options to vars
+    splineType = 'BEZIER'
+    name = 'rectangle'
+
+    # create curve
+    scene = bpy.context.scene
+    newCurve = bpy.data.curves.new(name, type = 'CURVE') # curvedatablock
+    newSpline = newCurve.splines.new(type = splineType)  # spline
+
+    # create spline from vertarray
+    newSpline.bezier_points.add(int(len(vertArray)*0.33))
+    newSpline.bezier_points.foreach_set('co', vertArray)
+
+    # Curve settings
+    newCurve.dimensions = '2D'
+    newSpline.use_cyclic_u = True
+    newSpline.use_endpoint_u = True
+    newSpline.order_u = 4
+
+    # create object with newCurve
+    new_obj = bpy.data.objects.new(name, newCurve)  # object
+    scene.objects.link(new_obj)                     # place in active scene
+    new_obj.select = True                           # set as selected
+    scene.objects.active = new_obj                  # set as active
+    new_obj.matrix_world = align_matrix             # apply matrix
+
+    setBezierHandles(new_obj, 'VECTOR')
+
+    return
+
+########################################################################
+#######################  Definitions ###################################
+########################################################################
+
+#### rectangle
+def rectangle_Curve(rectangle_w=2, rectangle_l=2, rectangle_r=1):
+    newPoints = []
+    x=rectangle_w/2
+    y=rectangle_l/2
+    r=rectangle_r/2
+    
+    if r>0:
+       newPoints.append([-x+r,y,0])
+       newPoints.append([x-r,y,0])
+       newPoints.append([x,y-r,0])
+       newPoints.append([x,-y+r,0])
+       newPoints.append([x-r,-y,0])
+       newPoints.append([-x+r,-y,0])
+       newPoints.append([-x,-y+r,0])
+       newPoints.append([-x,y-r,0])
+    else:
+       newPoints.append([-x,y,0])
+       newPoints.append([x,y,0])
+       newPoints.append([x,-y,0])
+       newPoints.append([-x,-y,0])
+
+    return newPoints
+
+##------------------------------------------------------------
+# Main Function
+def main(context, props, align_matrix):
+    # deselect all objects
+    bpy.ops.object.select_all(action='DESELECT')
+
+    # get verts
+    verts = rectangle_Curve(props.rectangle_w,
+                            props.rectangle_l,
+                            props.rectangle_r)
+
+    # turn verts into array
+    vertArray = vertsToPoints(verts)
+
+    # create object
+    createCurve(vertArray, props, align_matrix)
+
+    return
+
+class rectangle(bpy.types.Operator):
+    ''''''
+    bl_idname = "curve.rectangle"
+    bl_label = "Rectangle"
+    bl_options = {'REGISTER', 'UNDO'}
+    bl_description = "adds rectangle"
+
+    # align_matrix for the invoke
+    align_matrix = Matrix()
+
+    #### Parameters
+    rectangle_w = FloatProperty(name="Width",
+                default=2,
+                min=0, soft_min=0,
+                description="Width")
+    rectangle_l = FloatProperty(name="Length",
+                default=2,
+                min=0, soft_min=0,
+                description="Length")
+    rectangle_r = FloatProperty(name="Rounded",
+                default=1,
+                min=0, soft_min=0,
+                description="Rounded")
+
+    ##### DRAW #####
+    def draw(self, context):
+        props = self.properties
+        layout = self.layout
+
+        # general options        
+        col = layout.column()
+        #col.prop(props, 'rectangle')
+        col.label(text="Rectangle Parameters")
+
+        # Parameters 
+        box = layout.box()
+        box.prop(props, 'rectangle_w')
+        box.prop(props, 'rectangle_l')
+        box.prop(props, 'rectangle_r')
+
+    ##### POLL #####
+    @classmethod
+    def poll(cls, context):
+        return context.scene != None
+
+    ##### EXECUTE #####
+    def execute(self, context):
+        # turn off undo
+        undo = bpy.context.user_preferences.edit.use_global_undo
+        bpy.context.user_preferences.edit.use_global_undo = False
+
+        props = self.properties
+        
+        # main function
+        main(context, props, self.align_matrix)
+        
+        # restore pre operator undo state
+        bpy.context.user_preferences.edit.use_global_undo = undo
+
+        return {'FINISHED'}
+
+    ##### INVOKE #####
+    def invoke(self, context, event):
+        # store creation_matrix
+        self.align_matrix = align_matrix(context)
+        self.execute(context)
+
+        return {'FINISHED'}
+
+################################################################################
+##### REGISTER #####
+
+def rectangle_button(self, context):
+    self.layout.operator(rectangle.bl_idname, text="Rectangle", icon="PLUGIN")
+
+
+def register():
+    bpy.utils.register_module(__name__)
+    bpy.types.INFO_MT_curve_add.append(rectangle_button)
+
+def unregister():
+    bpy.utils.unregister_module(__name__)
+    bpy.types.INFO_MT_curve_add.remove(rectangle_button)
+
+if __name__ == "__main__":
+    register()
diff --git a/release/scripts/addons_contrib/add_curve_objects/add_curve_spirals.py b/release/scripts/addons_contrib/add_curve_objects/add_curve_spirals.py
new file mode 100644
index 0000000..18f3d00
--- /dev/null
+++ b/release/scripts/addons_contrib/add_curve_objects/add_curve_spirals.py
@@ -0,0 +1,261 @@
+'''bl_info = {
+    "name": "Spirals",
+    "description": "Make spirals",
+    "author": "Alejandro Omar Chocano Vasquez",
+    "version": (1, 2),
+    "blender": (2, 62, 0),
+    "location": "View3D > Add > Curve",
+    "warning": "", # used for warning icon and text in addons panel
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.4/Py/Scripts/Object/Spirals",
+    "tracker_url": "http://alexvaqp.googlepages.com?"
+                   "func=detail&aid=<number>",
+    "category": "Add Curve"}
+'''
+import bpy, time
+from bpy.props import *
+from math import sin, cos, pi, exp
+from bpy_extras.object_utils import AddObjectHelper, object_data_add
+
+#make normal spiral
+#-----------------------------------------------------------------------------
+def make_spiral(props, context):                  #archemedian and logarithmic can be plottet in zylindrical coordinates
+    #if props.spiral_type != 1 and props.spiral_type != 2:
+    #    return None
+
+    #INPUT: turns->degree->max_phi, steps, direction
+    #Initialise Polar Coordinate Enviroment
+    #-------------------------------
+    props.degree = 360*props.turns                #If you want to make the slider for degree
+    steps = props.steps * props.turns             #props.steps[per turn] -> steps[for the whole spiral]
+    props.z_scale = props.dif_z * props.turns
+    
+    max_phi  = pi*props.degree/180                #max angle in radian
+    step_phi = max_phi/steps                      #angle in radians between two vertices
+    if props.spiral_direction == 1:
+        step_phi *= -1                            #flip direction
+        max_phi *= -1
+    step_z   = props.z_scale/(steps-1)            #z increase in one step
+    
+    verts = []
+    verts.extend([props.radius,0,0,1])
+    
+    cur_phi = 0
+    cur_z   = 0
+    #-------------------------------
+
+    #Archemedean: dif_radius, radius
+    cur_rad = props.radius
+    step_rad = props.dif_radius/(steps * 360/props.degree)        #radius increase per angle for archemedean spiral| (steps * 360/props.degree)...Steps needed for 360 deg
+    #Logarithmic: radius, B_force, ang_div, dif_z
+    
+    #print("max_phi:",max_phi,"step_phi:",step_phi,"step_rad:",step_rad,"step_z:",step_z)
+    while abs(cur_phi) <= abs(max_phi):
+        cur_phi += step_phi
+        cur_z   += step_z
+        
+        #-------------------------------
+        if props.spiral_type == 1:
+            cur_rad += step_rad
+        if props.spiral_type == 2:
+            #r = a*e^{|theta| * b}
+            cur_rad = props.radius * pow(props.B_force, abs(cur_phi)) 
+        #-------------------------------
+    
+        px = cur_rad * cos(cur_phi)
+        py = cur_rad * sin(cur_phi)
+        verts.extend( [px,py,cur_z,1] )
+
+    return verts
+
+
+#make Spheric spiral
+#-----------------------------------------------------------------------------
+def make_spiral_spheric(props, context):
+    #INPUT: turns, steps[per turn], radius
+    #use spherical Coordinates
+    step_phi = (2*pi) / props.steps               #Step of angle in radians for one turn
+    steps = props.steps * props.turns             #props.steps[per turn] -> steps[for the whole spiral]
+    
+    max_phi  = 2*pi*props.turns                   #max angle in radian
+    step_phi = max_phi/steps                      #angle in radians between two vertices
+    if props.spiral_direction == 1:               #flip direction
+        step_phi *= -1
+        max_phi *= -1
+    step_theta = pi / (steps-1)                   #theta increase in one step (pi == 180 deg)
+
+    verts = []
+    verts.extend([0,0,-props.radius,1])           #First vertex at south pole
+
+    #cur_rad = props.radius = CONST
+
+    cur_phi = 0
+    cur_theta = -pi/2                             #Beginning at south pole
+
+    while abs(cur_phi) <= abs(max_phi):
+        #Coordinate Transformation sphere->rect
+        px = props.radius * cos(cur_theta) * cos(cur_phi)
+        py = props.radius * cos(cur_theta) * sin(cur_phi)
+        pz = props.radius * sin(cur_theta)
+
+        verts.extend([px,py,pz,1])
+        cur_theta += step_theta
+        cur_phi += step_phi
+
+    return verts
+
+#make torus spiral
+#-----------------------------------------------------------------------------
+
+def make_spiral_torus(props, context):
+    #INPUT: turns, steps, inner_radius, curves_number, mul_height, dif_inner_radius, cycles
+    max_phi  = 2*pi*props.turns * props.cycles    #max angle in radian
+    step_phi = 2*pi/props.steps                   #Step of angle in radians between two vertices
+    if props.spiral_direction == 1:               #flip direction
+        step_phi *= -1
+        max_phi *= -1
+    step_theta = (2*pi / props.turns) / props.steps
+    step_rad = props.dif_radius / (props.steps * props.turns)
+    step_inner_rad = props.dif_inner_radius / props.steps
+    step_z = props.dif_z / (props.steps * props.turns)
+
+    verts = []
+    
+    cur_phi = 0                                   #Inner Ring Radius Angle
+    cur_theta = 0                                 #Ring Radius Angle
+    cur_rad = props.radius
+    cur_inner_rad = props.inner_radius
+    cur_z = 0
+    n_cycle = 0
+    
+    while abs(cur_phi) <= abs(max_phi):
+        #Torus Coordinates -> Rect
+        px = ( cur_rad + cur_inner_rad * cos(cur_phi) ) * cos(props.curves_number * cur_theta)
+        py = ( cur_rad + cur_inner_rad * cos(cur_phi) ) * sin(props.curves_number * cur_theta)
+        pz = cur_inner_rad * sin(cur_phi) + cur_z
+
+        verts.extend([px,py,pz,1])
+
+        if props.touch == True and cur_phi >= n_cycle * 2*pi:
+            step_z = ( (n_cycle+1) * props.dif_inner_radius + props.inner_radius ) * 2 / (props.steps * props.turns)
+            n_cycle += 1
+
+        cur_theta += step_theta
+        cur_phi += step_phi
+        cur_rad += step_rad
+        cur_inner_rad += step_inner_rad
+        cur_z += step_z
+
+    return verts
+#-----------------------------------------------------------------------------
+
+def draw_curve(props, context):
+    if props.spiral_type == 1:
+        verts = make_spiral(props, context)
+    if props.spiral_type == 2:
+        verts = make_spiral(props, context)
+    if props.spiral_type == 3:
+        verts = make_spiral_spheric(props, context)
+    if props.spiral_type == 4:
+        verts = make_spiral_torus(props, context)
+    
+    curve_data = bpy.data.curves.new(name='Spiral', type='CURVE')
+    curve_data.dimensions = '3D'
+    
+    if props.curve_type == 0:
+        spline = curve_data.splines.new(type='POLY')
+    elif props.curve_type == 1:
+        spline = curve_data.splines.new(type='NURBS')
+    
+    spline.points.add( len(verts)*0.25-1 )                          #Add only one quarter of points as elements in verts, because verts looks like: "x,y,z,?,x,y,z,?,x,..."
+    spline.points.foreach_set('co', verts)
+#    new_obj = object_data_add(bpy.context, curve_data)
+    new_obj = object_data_add(context, curve_data)   
+
+class spirals(bpy.types.Operator):
+    bl_idname = "curve.spirals"
+    bl_label = "Spirals"
+    bl_options = {'REGISTER','UNDO'}            #UNDO needed for operator redo and therefore also to let the addobjecthelp appear!!!
+    bl_description = "adds different types of spirals"
+
+    spiral_type = IntProperty(default=1, min=1, max=4, description="1:archemedian, 2:logarithmic, 3:spheric, 4:torus")
+    curve_type = IntProperty(default=0, min=0, max=1, description="0:Poly, 1:Nurb")
+    spiral_direction = IntProperty(default=0, min=0, max=1, description="0:counter-clockwise, 1:clockwise")
+    
+    turns = IntProperty(default=1, min=1, max=1000, description="Length of Spiral in 360 deg")
+    steps = IntProperty(default=24, min=2, max=1000, description="Number of Vertices per turn")
+
+    
+    radius = FloatProperty(default=1.00, min=0.00, max=100.00, description="radius for first turn")
+    dif_z = FloatProperty(default=0, min=-10.00, max=100.00, description="increase in z axis per turn")            #needed for 1 and 2 spiral_type
+    #ARCHMEDEAN variables
+    dif_radius = FloatProperty(default=0.00, min=-50.00, max=50.00, description="radius increment in each turn")        #step between turns(one turn equals 360 deg)
+    #LOG variables 
+    B_force = FloatProperty(default=1.00, min=0.00, max=30.00, description="factor of exponent")
+    #TORUS variables
+    inner_radius = FloatProperty(default=0.20, min=0.00, max=100, description="Inner Radius of Torus")
+    dif_inner_radius = FloatProperty(default=0, min=-10, max=100, description="Increase of inner Radius per Cycle")
+    dif_radius = FloatProperty(default=0, min=-10, max=100, description="Increase of Torus Radius per Cycle")
+    cycles = FloatProperty(default=1, min=0.00, max=1000, description="Number of Cycles")
+    curves_number = IntProperty(default=1, min=1, max=400, description="Number of curves of spiral")
+    touch = BoolProperty(default=False, description="No empty spaces between cycles")
+
+    def draw(self, context):                #Function used by Blender to draw the menu
+        layout = self.layout
+        layout.prop(self, 'spiral_type', text="Spiral Type")
+        layout.prop(self, 'curve_type', text="Curve Type")
+        layout.prop(self, 'spiral_direction', text="Spiral Direction")
+        
+        layout.label(text="Spiral Parameters:")
+        layout.prop(self, 'turns', text = "Turns")
+        layout.prop(self, 'steps', text = "Steps")
+
+        box = layout.box()
+        if self.spiral_type == 1:
+            box.prop(self, 'dif_radius', text = "Radius Growth")
+            box.prop(self, 'radius', text = "Radius")
+            box.prop(self, 'dif_z', text = "Height")
+        if self.spiral_type == 2:
+            box.prop(self, 'radius', text = "Radius")
+            box.prop(self, 'B_force', text = "Expansion Force")
+            box.prop(self, 'dif_z', text = "Height")
+        if self.spiral_type == 3:
+            box.prop(self, 'radius', text = "Radius")
+        if self.spiral_type == 4:
+            box.prop(self, 'cycles', text = "Number of Cycles")
+            if self.dif_inner_radius == 0 and self.dif_z == 0:
+                self.cycles = 1
+            box.prop(self, 'radius', text = "Radius")
+            if self.dif_z == 0:
+                box.prop(self, 'dif_z', text = "Height per Cycle")
+            else:
+                box2 = box.box()
+                box2.prop(self, 'dif_z', text = "Height per Cycle")
+                box2.prop(self, 'touch', text = "Make Snail")
+            box.prop(self, 'inner_radius', text = "Inner Radius")
+            box.prop(self, 'curves_number', text = "Curves Number")
+            box.prop(self, 'dif_radius', text = "Increase of Torus Radius")
+            box.prop(self, 'dif_inner_radius', text = "Increase of Inner Radius")
+
+    @classmethod
+    def poll(cls, context):                            #method called by blender to check if the operator can be run
+        return context.scene != None
+    def execute(self, context):
+        time_start = time.time()
+        draw_curve(self, context)
+        print("Drawing Spiral Finished: %.4f sec", time.time() - time_start)
+        return {'FINISHED'}
+#------------------------------------------------------------------------------------
+
+def spirals_button(self, context):
+    self.layout.operator(spirals.bl_idname, text="Spirals")
+
+def register():
+    bpy.utils.register_module(__name__)
+    bpy.types.INFO_MT_curve_add.append(spirals_button)
+
+def unregister():
+    bpy.utils.unregister_module(__name__)
+    bpy.types.INFO_MT_curve_add.remove(spirals_button)
+
+if __name__=="__main__ ":
+   register()
diff --git a/release/scripts/addons_contrib/add_curve_objects/cotejrp1_particle_tracer.py b/release/scripts/addons_contrib/add_curve_objects/cotejrp1_particle_tracer.py
new file mode 100644
index 0000000..0be3768
--- /dev/null
+++ b/release/scripts/addons_contrib/add_curve_objects/cotejrp1_particle_tracer.py
@@ -0,0 +1,154 @@
+'''# tickertape.py (c) 2011 Phil Cote (cotejrp1)
+#
+# ***** 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 *****
+
+"""
+How to use:
+1.  Set up a scene object with an emitter particle system.
+2.  Adjust for the unborn, alive, and dead particle lifecycle.
+3.  Advance the timeline til the particles are in the desired position.
+4.  MAKE SURE you select the emitter object AFTER you'vbe advanced the timeline.
+5.  In the tools menu in the 3D view, click "Make Curve" under the Particle Tracer Panel
+6.  Adjust for what kind of what life state of particles to include as well as the curve thickness bevel.
+"""
+
+# BUG? : You do have to make sure you select the emitter object AFTER you've
+# advanced the timeline.  If you don't, the current frame changes on you 
+# when you change the particle tracer options.
+'''
+bl_info = {
+    'name': 'Particle Tracer',
+    'author': 'Phil Cote, cotejrp1, (http://www.blenderaddons.com)',
+    'version': (0,1),
+    "blender": (2, 5, 8),
+    "api": 37702,
+    'location': '',
+    'description': 'Creates curves based on location of particles at a specific point in time.',
+    'warning': '', # used for warning icon and text in addons panel
+    'category': 'Add Curve'}
+
+import bpy
+
+def getParticleSys( ob ):
+    """
+    Grab the first particle system available or None if there aren't any.
+    """
+    if ob == None:
+        return None
+    
+    pSysList = [ mod for mod in ob.modifiers if mod.type == 'PARTICLE_SYSTEM']
+    if len( pSysList ) == 0:
+        return None
+    
+    pSys = pSysList[0].particle_system
+    return pSys
+
+
+def buildLocationList( psys, includeAlive, includeDead, includeUnborn ):
+    """
+    Build a flattened list of locations for each of the particles which the curve creation
+    code will act on.
+    Which particles get included it dictated by the user choice of any combo of unborn, alive, or dead.
+    """
+    locList = []
+    aliveList = []
+    deadList = []
+    unbornList = []
+    
+    def listByAliveState( psys, aliveArg ):
+    
+        newList = []
+        for p in psys.particles:
+            if p.alive_state == aliveArg:
+                newList.extend( list( p.location ) )
+                
+        return newList
+     
+    aliveList = listByAliveState( psys, "ALIVE" )
+    deadList = listByAliveState( psys, "DEAD" )
+    unbornList = listByAliveState( psys, "UNBORN" )
+        
+        
+    if includeAlive:
+        locList = locList + aliveList
+    if includeDead:
+        locList = locList + deadList
+    if includeUnborn:
+        locList = locList + unbornList
+           
+    return locList    
+    
+    
+class PTracerOp(bpy.types.Operator):
+    '''Tooltip'''
+    bl_idname = "curve.particle_tracer"
+    bl_label = "Particle Tracer Options"
+    bl_region_type = "VIEW_3D"
+    bl_context = "tools"
+    bl_options = { "REGISTER", "UNDO" }
+    
+    curveName = bpy.props.StringProperty( name = "Curve Name", default="ptracecurve" )
+    includeAlive = bpy.props.BoolProperty( name="Alive Particles", default=True )
+    includeDead = bpy.props.BoolProperty( name = "Dead Particles", default = True )
+    includeUnborn = bpy.props.BoolProperty( name="Unborn Particles", default = True )
+    thickness = bpy.props.FloatProperty( name = "Thickness", min=0, max=1 )
+
+    @classmethod
+    def poll(cls, context):
+        ob = context.active_object
+        if getParticleSys( ob ) == None:
+            return False
+        return True
+    
+
+    def execute(self, context):
+        
+        ob = context.active_object
+        psys = getParticleSys( ob )
+        locList = buildLocationList( psys, self.includeAlive, self.includeDead, self.includeUnborn )
+        
+        crv = bpy.data.curves.new( self.curveName, type="CURVE" )
+        spline = crv.splines.new( type="BEZIER" )
+        crv.bevel_depth = self.thickness
+        
+        pointCount = len( locList ) / 3
+        if pointCount > 0:
+            spline.bezier_points.add( pointCount - 1 )
+            
+        spline.bezier_points.foreach_set( "co", locList )
+        
+        for point in spline.bezier_points:
+            point.handle_left_type = "AUTO"
+            point.handle_right_type = "AUTO"
+       
+        scn = context.scene
+        crvob = bpy.data.objects.new( self.curveName, crv )
+        scn.objects.link( crvob )
+        
+        return {'FINISHED'}
+    
+def register():
+    bpy.utils.register_class(PTracerOp)
+
+def unregister():
+    bpy.utils.unregister_class(PTracerOp)
+
+if __name__ == "__main__":
+    register()
diff --git a/release/scripts/addons_contrib/add_curve_objects/cotejrp1_string_it.py b/release/scripts/addons_contrib/add_curve_objects/cotejrp1_string_it.py
new file mode 100644
index 0000000..694a344
--- /dev/null
+++ b/release/scripts/addons_contrib/add_curve_objects/cotejrp1_string_it.py
@@ -0,0 +1,104 @@
+'''
+# string_it.py (c) 2011 Phil Cote (cotejrp1)
+#
+# ***** 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': 'String It',
+    'author': 'Phil Cote, cotejrp1, (http://www.blenderpythontutorials.com)',
+    'version': (0,1),
+    "blender": (2, 5, 8),
+    "api": 37702,
+    'location': '',
+    'description': 'Run a curve through each selected object in a scene.',
+    'warning': '', # used for warning icon and text in addons panel
+    'category': 'Add Curve'}
+'''
+import bpy
+
+def makeBezier( spline, vertList ):
+    numPoints = ( len( vertList ) / 3 ) - 1
+    spline.bezier_points.add( numPoints )
+    spline.bezier_points.foreach_set( "co", vertList )
+    for point in spline.bezier_points:
+        point.handle_left_type = "AUTO"
+        point.handle_right_type = "AUTO"
+    
+def makePoly( spline, vertList ):
+    numPoints = ( len( vertList ) / 4 ) - 1
+    spline.points.add( numPoints )
+    spline.points.foreach_set( "co", vertList )
+    
+
+class StringItOperator(bpy.types.Operator):
+    '''Creates a curve that runs through the centers of each selected object.'''
+    bl_idname = "curve.string_it_operator"
+    bl_label = "String It Options"
+    bl_options = { "REGISTER", "UNDO" }
+    
+    splineOptionList = [  ( 'poly', 'poly', 'poly' ), ( 'bezier', 'bezier', 'bezier' ), ]
+    splineChoice = bpy.props.EnumProperty( name="Spline Type", items=splineOptionList )
+    closeSpline = bpy.props.BoolProperty( name="Close Spline?", default=False )
+        
+    @classmethod   
+    def poll( self, context ):
+        totalSelected = len( [ob for ob in context.selectable_objects if ob.select] )
+        return totalSelected > 1
+    
+    def execute(self, context):
+        
+        splineType = self.splineChoice.upper()
+        scn = context.scene
+        obList = [ ob for ob in scn.objects if ob.select ]
+
+        # build the vert data set to use to make the curve
+        vertList = []
+        for sceneOb in obList:
+            vertList.append( sceneOb.location.x )
+            vertList.append( sceneOb.location.y )
+            vertList.append( sceneOb.location.z )
+            if splineType == 'POLY':
+                vertList.append( 0 )
+
+        # build the curve itself.
+        crv = bpy.data.curves.new( "curve", type = "CURVE" )
+        crv.splines.new( type = splineType )
+        spline = crv.splines[0]
+        if splineType == 'BEZIER':
+            makeBezier( spline, vertList )
+                
+        else: #polyline case.
+            makePoly( spline, vertList )
+        
+        spline.use_cyclic_u = self.closeSpline
+        
+        # add the curve to the scene.
+        crvOb = bpy.data.objects.new( "curveOb", crv )
+        scn.objects.link( crvOb )            
+        return {'FINISHED'}
+
+def register():
+    bpy.utils.register_class(StringItOperator)
+
+def unregister():
+    bpy.utils.unregister_class(StringItOperator)
+
+if __name__ == "__main__":
+    register()
diff --git a/release/scripts/addons/curve_simplify.py b/release/scripts/addons_contrib/add_curve_objects/curve_simplify.py
similarity index 100%
copy from release/scripts/addons/curve_simplify.py
copy to release/scripts/addons_contrib/add_curve_objects/curve_simplify.py
diff --git a/release/scripts/addons_contrib/add_mesh_chain_rope/__init__.py b/release/scripts/addons_contrib/add_mesh_chain_rope/__init__.py
new file mode 100644
index 0000000..c4b5a29
--- /dev/null
+++ b/release/scripts/addons_contrib/add_mesh_chain_rope/__init__.py
@@ -0,0 +1,37 @@
+bl_info = {
+    "name": "Oscurart Chain and Rope Maker",
+    "author": "Oscurart",
+    "version": (1,1),
+    "blender": (2, 6, 2),
+    "api": 3800,
+    "location": "Add > Mesh",
+    "description": "Create chains and ropes",
+    "warning": "",
+    "wiki_url": "oscurart.blogspot.com",
+    "tracker_url": "",
+    "category": "Object"}
+
+
+import bpy
+from .oscurart_rope_maker import * 
+from .oscurart_chain_maker import *
+
+def register():
+    bpy.utils.register_class(OBJECT_OT_add_object)
+    bpy.types.INFO_MT_curve_add.append(oscRopeButton)
+    bpy.utils.register_module(__name__)
+    bpy.types.INFO_MT_mesh_add.append(menu_oscChain)
+
+def unregister():
+    bpy.utils.unregister_class(OBJECT_OT_add_object)
+    bpy.types.INFO_MT_curve_add.remove(oscRopeButton)
+    bpy.utils.unregister_module(__name__)
+    bpy.types.INFO_MT_mesh_add.remove(menu_oscChain)    
+
+if __name__ == "__main__":
+    register()
+
+
+
+
+
diff --git a/release/scripts/addons_contrib/add_mesh_chain_rope/oscurart_chain_maker.py b/release/scripts/addons_contrib/add_mesh_chain_rope/oscurart_chain_maker.py
new file mode 100644
index 0000000..893a565
--- /dev/null
+++ b/release/scripts/addons_contrib/add_mesh_chain_rope/oscurart_chain_maker.py
@@ -0,0 +1,221 @@
+# ##### 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": "Oscurart Chain Maker",
+    "author": "Oscurart",
+    "version": (1,1),
+    "blender": (2, 5, 6),
+    "api": 3800,
+    "location": "Add > Mesh > Oscurart Chain",
+    "description": "Create chain links from armatures.",
+    "warning": "",
+    "wiki_url": "oscurart.blogspot.com",
+    "tracker_url": "",
+    "category": "Object"}
+
+
+
+
+
+import bpy
+
+
+def makeChain (context, mult, curverig): 
+    
+        # SI EL CONTEXTO ES OBJECT CORRE LA FUNCION
+        if bpy.context.mode == 'OBJECT':        
+            VAR_SWITCH=abs(1)
+            ARMATURE=bpy.context.active_object
+            
+            def creahuesocero(hueso):
+                ## CREO DATA PARA ESLABON
+                mesh=bpy.data.meshes.new("objectData"+str(hueso.name))
+                object=bpy.data.objects.new("EslabonCero"+str(hueso.name),mesh)
+                mesh.from_pydata(
+                [(-0.04986128956079483,-0.6918092370033264,-0.17846597731113434),(-0.04986128956079483,-0.6918091773986816,0.17846640944480896),(-0.049861326813697815,-0.154555082321167,0.17846627533435822),(-0.049861326813697815,-0.15455523133277893,-0.17846614122390747),(-0.04986133798956871,-0.03475356101989746,0.25805795192718506),(-0.04986133798956871,-0.03475397825241089,-0.25805795192718506),(-0.049861278384923935,-0.8116106986999512,-0.2580576539039612),(-0.049861278384923935,-0.8116104602813721,0.25805822014808655),(-0.04986128211021423,-0.7692053318023682,2.6668965347198537e-07),(-0.04986127093434334,-0.923523485660553,2.7834033744511544e-07),(-0.04986133426427841,-0.0771591067314148,3.5627678585115063e-08),(-0.04986134544014931,0.0771591067314148,-3.5627678585115063e-08),(0.04986133798956871,-0.03475397825241089,-0.25805795192718506),(0.04986133053898811,0.0771591067314148,-3.5627678585115063e-08),(0.04986133798956871,-0.03475356101989746,0.25805795192718506),(0.04986134544014931,-0.15455523133277893,-0.17846614122390747),(0.04986134544014931,-0.0771591067314148,3.5627678585115063e-08),(0.04986134544014931,-0.154555082321167,0.17846627533435822),(0.049861397594213486,-0.8116106986999512,-0.2580576539039612),(0.04986140504479408,-0.923523485660553,2.7834033744511544e-07),(0.049861397594213486,-0.8116104602813721,0.25805822014808655),(0.04986139014363289,-0.6918091773986816,0.17846640944480896),(0.04986139014363289,-0.7692053318023682,2.6668965347198537e-07),(0.04986139014363289,-0.6918092370033264,-0.17846597731113434)],
+            [(1,2),(0,3),(3,5),(2,4),(0,6),(5,6),(1,7),(4,7),(0,8),(1,8),(7,9),(6,9),(8,9),(2,10),(3,10),(4,11),(5,11),(10,11),(5,12),(12,13),(11,13),(13,14),(4,14),(10,16),(15,16),(3,15),(2,17),(16,17),(9,19),(18,19),(6,18),(7,20),(19,20),(8,22),(21,22),(1,21),(0,23),(22,23),(14,20),(12,18),(15,23),(17,21),(12,15),(13,16),(14,17),(20,21),(19,22),(18,23)],
+            [(6,0,3,5),(1,7,4,2),(0,6,9,8),(8,9,7,1),(2,4,11,10),(10,11,5,3),(11,13,12,5),(4,14,13,11),(3,15,16,10),(10,16,17,2),(6,18,19,9),(9,19,20,7),(1,21,22,8),(23,0,8,22),(7,20,14,4),(5,12,18,6),(0,23,15,3),(2,17,21,1),(16,15,12,13),(17,16,13,14),(22,21,20,19),(23,22,19,18),(21,17,14,20),(15,23,18,12)]
+                )
+                bpy.context.scene.objects.link(object)
+                ## ESCALO EL HUESO
+                bpy.data.objects['EslabonCero'+str(hueso.name)].scale= (hueso.length*mult,hueso.length*mult,hueso.length*mult)
+                
+                ## EMPARENTO
+                bpy.data.objects['EslabonCero'+str(hueso.name)].parent=ARMATURE
+                bpy.data.objects['EslabonCero'+str(hueso.name)].parent_type = 'BONE'
+                bpy.data.objects['EslabonCero'+str(hueso.name)].parent_bone=hueso.name   
+            
+            
+            def creahuesonoventa(hueso):
+                ## CREO DATA PARA ESLABON
+                mesh=bpy.data.meshes.new("objectData"+str(hueso.name))
+                object=bpy.data.objects.new("EslabonNov"+str(hueso.name),mesh)
+                mesh.from_pydata(
+                [(0.1784660965204239,-0.6918091773986816,-0.049861203879117966),(-0.1784662902355194,-0.6918091773986816,-0.04986126348376274),(-0.17846627533435822,-0.1545550525188446,-0.04986134544014931),(0.17846617102622986,-0.15455520153045654,-0.04986128583550453),(-0.25805795192718506,-0.03475359082221985,-0.049861375242471695),(0.25805795192718506,-0.034753888845443726,-0.04986129328608513),(0.2580578327178955,-0.8116105794906616,-0.04986117407679558),(-0.2580580413341522,-0.8116105198860168,-0.049861256033182144),(-9.672299938756623e-08,-0.7692052721977234,-0.04986122250556946),(-8.99775329799013e-08,-0.923523485660553,-0.04986120015382767),(-7.764004550381287e-09,-0.07715904712677002,-0.049861326813697815),(4.509517737005808e-08,0.0771591067314148,-0.049861349165439606),(0.25805795192718506,-0.034753888845443726,0.049861375242471695),(-2.2038317837314025e-08,0.0771591067314148,0.049861326813697815),(-0.25805795192718506,-0.03475359082221985,0.04986129328608513),(0.17846617102622986,-0.15455520153045654,0.04986138269305229),(-1.529285498236277e-08,-0.07715907692909241,0.049861352890729904),(-0.17846627533435822,-0.1545550525188446,0.049861323088407516),(0.2580578029155731,-0.8116105794906616,0.049861494451761246),(-1.5711103173998708e-07,-0.923523485660553,0.04986147582530975),(-0.2580580711364746,-0.8116105198860168,0.04986141249537468),(-0.1784663051366806,-0.6918091773986816,0.049861419945955276),(-1.340541757599567e-07,-0.7692052721977234,0.049861449748277664),(0.1784660816192627,-0.6918091773986816,0.04986146464943886)],
+                [(1,2),(0,3),(3,5),(2,4),(0,6),(5,6),(1,7),(4,7),(0,8),(1,8),(7,9),(6,9),(8,9),(2,10),(3,10),(4,11),(5,11),(10,11),(5,12),(12,13),(11,13),(13,14),(4,14),(10,16),(15,16),(3,15),(2,17),(16,17),(9,19),(18,19),(6,18),(7,20),(19,20),(8,22),(21,22),(1,21),(0,23),(22,23),(14,20),(12,18),(15,23),(17,21),(12,15),(13,16),(14,17),(20,21),(19,22),(18,23)],
+                [(6,0,3,5),(1,7,4,2),(0,6,9,8),(8,9,7,1),(2,4,11,10),(10,11,5,3),(11,13,12,5),(4,14,13,11),(3,15,16,10),(10,16,17,2),(6,18,19,9),(9,19,20,7),(1,21,22,8),(23,0,8,22),(7,20,14,4),(5,12,18,6),(0,23,15,3),(2,17,21,1),(16,15,12,13),(17,16,13,14),(22,21,20,19),(23,22,19,18),(21,17,14,20),(15,23,18,12)]
+                )
+                bpy.context.scene.objects.link(object)
+                
+                ## ESCALO EL HUESO
+                bpy.data.objects['EslabonNov'+str(hueso.name)].scale= (hueso.length*mult,hueso.length*mult,hueso.length*mult)
+            
+                ## EMPARENTO
+                bpy.data.objects['EslabonNov'+str(hueso.name)].parent=ARMATURE
+                bpy.data.objects['EslabonNov'+str(hueso.name)].parent_type = 'BONE'
+                bpy.data.objects['EslabonNov'+str(hueso.name)].parent_bone=hueso.name   
+            
+            
+            
+            for hueso in bpy.context.active_object.pose.bones:
+                if VAR_SWITCH == 1:
+                    creahuesocero(hueso)
+                else:
+                    creahuesonoventa(hueso)    
+                if VAR_SWITCH == 1:
+                    VAR_SWITCH = 0
+                    print(VAR_SWITCH)
+                else :
+                    VAR_SWITCH = 1
+                    print(VAR_SWITCH)
+                    
+                    
+        # SI NO TILDAMOS CURVERIG
+        if curverig == True:   
+                        
+                        
+            # VARIABLES
+            LISTA_POINTC=[]
+            ACTARM=bpy.context.active_object
+            
+            # CREO DATA , OBJETO Y LO CONECTO A LA ESCENA
+            crv= bpy.data.curves.new("CurvaCable", "CURVE")
+            obCable=bpy.data.objects.new("Cable",crv)
+            bpy.context.scene.objects.link(obCable)
+            
+            # SETEO ATRIBUTOS
+            crv.dimensions = "3D"
+            crv.resolution_u = 10
+            crv.resolution_v = 10
+            crv.twist_mode = "MINIMUM"
+            
+            
+            # CREO LISTA DE COORDENADAS DE TAIL Y HEAD
+            
+            LISTA_POINTC.append((
+                ACTARM.data.bones[0].head_local[0],
+                ACTARM.data.bones[0].head_local[1],
+                ACTARM.data.bones[0].head_local[2],
+                1
+            ))
+            
+            print("huesos: "+ str(len(ACTARM.data.bones)))
+            for hueso in ACTARM.data.bones:
+                LISTA_POINTC.append((hueso.tail_local[0],hueso.tail_local[1],hueso.tail_local[2],1))
+                
+            print(LISTA_POINTC)
+            
+            
+            # CREO EL SPLINE
+            spline=crv.splines.new("NURBS")
+            lencoord= len(LISTA_POINTC)
+            print("lencoord--> :"+str(lencoord))
+            rango=range(lencoord)
+            spline.points.add(lencoord-1)
+            for punto in rango:
+                spline.points[punto].co = LISTA_POINTC[punto]
+                print(LISTA_POINTC[punto])
+            
+            # SETEO ENDPOINT
+            bpy.data.objects['Cable'].data.splines[0].use_endpoint_u= True
+            
+            # SELECCIONO LA CURVA
+            bpy.ops.object.select_all(action='DESELECT')
+            bpy.data.objects['Cable'].select=1
+            bpy.context.scene.objects.active=bpy.data.objects['Cable']
+            
+            # PASO A EDIT
+            bpy.ops.object.mode_set(mode='EDIT')
+            
+            
+            # CREO HOOKS
+            POINTSTEP=0
+            for POINT in bpy.data.objects['Cable'].data.splines[0].points:
+                bpy.ops.curve.select_all(action="DESELECT")
+                bpy.data.objects['Cable'].data.splines[0].points[POINTSTEP].select=1
+                bpy.ops.object.hook_add_newob()
+                POINTSTEP+=1
+            
+            
+                print(POINT)
+            
+            # PASO A SELECCIONAR LOS OBJETOS
+            bpy.ops.object.mode_set(mode='OBJECT')
+            bpy.ops.object.select_all(action='DESELECT')
+            ACTARM.select=1
+            bpy.context.scene.objects.active=bpy.data.objects['Armature']
+            bpy.ops.object.mode_set(mode='POSE')
+            bpy.ops.pose.select_all(action='DESELECT')
+            ACTARM.data.bones[-1].select=1
+            ACTARM.data.bones.active=ACTARM.data.bones[-1]
+            # SETEO IK SPLINE
+            bpy.ops.pose.constraint_add_with_targets(type='SPLINE_IK')
+            ACTARM.pose.bones[-1].constraints['Spline IK'].target = bpy.data.objects['Cable']
+            ACTARM.pose.bones[-1].constraints['Spline IK'].chain_count=100
+            bpy.context.active_object.pose.bones[-1].constraints['Spline IK'].use_y_stretch= False     
+            # VUELVO A OBJECT MODE
+            bpy.ops.object.mode_set(mode='OBJECT')		
+                         
+            
+#---------------        
+from bpy.props import *
+
+class MESH_OT_chain_maker(bpy.types.Operator):
+    bl_idname="mesh.primitive_oscurart_chain_add"
+    bl_label="Oscurart Chain"
+    bl_options={'REGISTER','UNDO'}
+    
+    curverig= BoolProperty(name="Curve Rig", default=False)
+    multiplier= FloatProperty (name="Scale", default=1 , min=0.01, max=100.0)
+
+    @classmethod
+    def poll(cls, context):
+        return(bpy.context.active_object.type == "ARMATURE" and bpy.context.active_object.mode == "OBJECT") 
+    
+    def execute(self, context):
+        makeChain(context, 
+            self.multiplier,self.curverig)
+        return {'FINISHED'}
+    
+def menu_oscChain(self, context):
+    self.layout.operator("mesh.primitive_oscurart_chain_add", 
+        text="Oscurart Chain", 
+        icon='LINKED')
+
+def register():
+   bpy.utils.register_module(__name__)
+   bpy.types.INFO_MT_mesh_add.append(menu_oscChain)
+ 
+def unregister():
+    bpy.utils.unregister_module(__name__)
+    bpy.types.INFO_MT_mesh_add.remove(menu_oscChain)
+    
+ 
+if __name__ == "__main__":
+    register()    
diff --git a/release/scripts/addons_contrib/add_mesh_chain_rope/oscurart_rope_maker.py b/release/scripts/addons_contrib/add_mesh_chain_rope/oscurart_rope_maker.py
new file mode 100644
index 0000000..5faad59
--- /dev/null
+++ b/release/scripts/addons_contrib/add_mesh_chain_rope/oscurart_rope_maker.py
@@ -0,0 +1,198 @@
+# ##### 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": "Oscurart Rope Maker",
+    "author": "Oscurart",
+    "version": (1,1),
+    "blender": (2, 5, 6),
+    "api": 3800,
+    "location": "Add > Curve > Oscurart Rope",
+    "description": "Create ropes",
+    "warning": "",
+    "wiki_url": "oscurart.blogspot.com",
+    "tracker_url": "",
+    "category": "Object"}
+
+
+
+import bpy, math
+
+
+
+
+
+def makeRope (context, DISTPOS, curvaResU, radius, FE, CUERDAS, stResU,DIAMETRO):    
+    
+    # CREO DATA , OBJETO Y LO CONECTO A LA ESCENA
+    crv= bpy.data.curves.new("CurvaCable", "CURVE")
+    obCable=bpy.data.objects.new("Cable",crv)
+    bpy.context.scene.objects.link(obCable)
+    
+    # SETEO ATRIBUTOS
+    crv.dimensions = "3D"
+    crv.resolution_u = 10
+    crv.resolution_v = 10
+    crv.twist_mode = "MINIMUM"
+    
+    # LISTA DE COMPONENTES
+    coordenadas= [
+        (0,radius,0,radius),
+        (radius,0,0,radius),
+        (0,-radius,0,radius),
+        (-radius,0,0,radius)
+    ]
+    
+    
+    
+    # CREO EL SPLINE
+    spline=crv.splines.new("NURBS")
+    lencoord= len(coordenadas)
+    #print("lencoord--> :"+str(lencoord))
+    rango=range(lencoord)
+    spline.points.add(lencoord-1)
+    for punto in rango:
+        spline.points[punto].co = coordenadas[punto]
+        #print(punto)
+        
+        
+    # MODIFICACIONES DE DATA
+    spline.use_cyclic_u = True
+    spline.resolution_u = curvaResU
+    spline.order_u = 3    
+    spline.use_endpoint_u = True
+    
+    
+    ## ==CREO CADENAS==
+    
+    ## DIVIDO EL RADIO POR LA CANTIDAD DE LINEAS Y SETEO UNA LISTA
+    
+    GRADOS=[]
+    VALORPORPARTE=[]
+    DIVISION=360/CUERDAS
+    TAJADA=0
+    
+    for parte in range(0,CUERDAS):
+        GRADOS.append(TAJADA)
+        TAJADA+=DIVISION
+        
+
+    
+    for GRAD in GRADOS:
+
+
+        # VARIABLES
+        FC=0
+        VARLISTVER=[]
+       
+        VARANGLEY=0
+        VARANGLEZ=90
+        VARPOSX=0
+        EDGEINDEX=0
+        # DEFINO EL PESO PARA LAS COORDENADAS
+        WEIGHT = 1
+        
+        while FC < FE:           
+            ## CREA 3 CADENAS EN 0 90 Y 180 GRADOS 
+            VARLISTVER.append((VARPOSX, math.sin(math.radians(GRAD))/(1/DIAMETRO) , math.sin(math.radians(GRAD+90))/(1/DIAMETRO),WEIGHT))
+    
+            GRAD += 30
+            FC += 1
+            VARPOSX += DISTPOS
+     
+        
+        
+        # CREO DATA , OBJETO Y LO CONECTO A LA ESCENA
+        crv= bpy.data.curves.new("curvaData", "CURVE")
+        ob=bpy.data.objects.new("Curva",crv)
+        bpy.context.scene.objects.link(ob)
+        
+        # SETEO ATRIBUTOS
+        crv.dimensions = "3D"
+        crv.resolution_u = 10
+        crv.resolution_v = 10
+        crv.twist_mode = "MINIMUM"
+        
+        # LISTA DE COMPONENTES
+        coordenadas= VARLISTVER
+        
+        
+        
+        # CREO EL SPLINE
+        spline=crv.splines.new("NURBS")
+        lencoord= len(coordenadas)
+        #print("lencoord--> :"+str(lencoord))
+        rango=range(lencoord)
+        spline.points.add(lencoord-1)
+        for punto in rango:
+            spline.points[punto].co = coordenadas[punto]
+            #print(punto)
+            
+            
+        # MODIFICACIONES DE DATA
+        spline.use_cyclic_u = False
+        spline.resolution_u = stResU
+        spline.order_u = 3    
+        spline.use_endpoint_u = True
+        
+        ob.data.bevel_object= bpy.data.objects["Cable"]
+        
+        #print(VARLISTVER)
+        
+#---------------        
+from bpy.props import *
+
+class OBJECT_OT_add_object(bpy.types.Operator):
+    bl_idname="curve.primitive_osc_rope_add"
+    bl_label="Oscurart Rope"
+    bl_options={'REGISTER','UNDO'}
+    
+    strands = IntProperty (name="Strands", default=5 , min=1, max=1000, step=1)
+    diameter = FloatProperty (name="Diameter", default=1 , min=0, max=1000)
+    distPos= FloatProperty (name="Stretch", default=1 , min=0.01, max=100.0)
+    vertices= IntProperty (name="Lenght", default=10 , min=0, max=1000, step=1)
+    distResU= IntProperty (name="Resolution V", default=5 , min=1, max=1000, step=1)
+    stResU= IntProperty (name="Resolution U", default=5 , min=1, max=1000, step=1)
+    radio= FloatProperty (name="Radius", default=1 , min=0, max=1000)
+
+    def execute(self, context):
+        makeRope(context, 
+            self.distPos,self.distResU,self.radio,self.vertices,self.strands, self.stResU,self.diameter)
+        return {'FINISHED'}
+    
+# Registration
+
+def oscRopeButton(self, context):
+    self.layout.operator(
+        OBJECT_OT_add_object.bl_idname,
+        text="Oscurart Rope",
+        icon="PLUGIN")
+
+
+def register():
+    bpy.utils.register_class(OBJECT_OT_add_object)
+    bpy.types.INFO_MT_curve_add.append(oscRopeButton)
+
+
+def unregister():
+    bpy.utils.unregister_class(OBJECT_OT_add_object)
+    bpy.types.INFO_MT_curve_add.remove(oscRopeButton)
+
+
+if __name__ == '__main__':
+    register()
diff --git a/release/scripts/addons_contrib/add_mesh_column.py b/release/scripts/addons_contrib/add_mesh_column.py
index e9b2e0e..c6dd00c 100644
--- a/release/scripts/addons_contrib/add_mesh_column.py
+++ b/release/scripts/addons_contrib/add_mesh_column.py
@@ -1058,7 +1058,7 @@ Add a column mesh.
             bpy.ops.object.join()
             bpy.ops.object.editmode_toggle()
             bpy.ops.mesh.select_all(action='SELECT')
-            bpy.ops.mesh.remove_doubles(limit=0.0001)
+            bpy.ops.mesh.remove_doubles(mergedist=0.0001)
             bpy.ops.object.editmode_toggle()
 
         ob_new.location = tuple(context.scene.cursor_location)
diff --git a/release/scripts/addons_contrib/add_mesh_rocks/add_mesh_rocks.xml b/release/scripts/addons_contrib/add_mesh_rocks/add_mesh_rocks.xml
index 0d2abd9..0202486 100644
--- a/release/scripts/addons_contrib/add_mesh_rocks/add_mesh_rocks.xml
+++ b/release/scripts/addons_contrib/add_mesh_rocks/add_mesh_rocks.xml
@@ -33,6 +33,7 @@
 <!ELEMENT mat_IOR (#PCDATA)>
 <!ELEMENT mat_mossy (#PCDATA)>
 <!ELEMENT random (use_random_seed,user_seed)>
+<!ELEMENT use_generate (#PCDATA)>
 <!ELEMENT use_random_seed (#PCDATA)>
 <!ELEMENT user_seed (#PCDATA)>
 
@@ -94,6 +95,7 @@
 			<mat_mossy>0.0</mat_mossy>
 		</material>
 		<random>
+			<use_generate>True</use_generate>
 			<use_random_seed>True</use_random_seed>
 			<user_seed>1</user_seed>
 		</random>
@@ -153,6 +155,7 @@
 			<mat_mossy>0.0</mat_mossy>
 		</material>
 		<random>
+			<use_generate>True</use_generate>
 			<use_random_seed>True</use_random_seed>
 			<user_seed>1</user_seed>
 		</random>
@@ -212,6 +215,7 @@
 			<mat_mossy>0.0</mat_mossy>
 		</material>
 		<random>
+			<use_generate>True</use_generate>
 			<use_random_seed>True</use_random_seed>
 			<user_seed>1</user_seed>
 		</random>
@@ -271,6 +275,7 @@
 			<mat_mossy>0.0</mat_mossy>
 		</material>
 		<random>
+			<use_generate>True</use_generate>
 			<use_random_seed>True</use_random_seed>
 			<user_seed>1</user_seed>
 		</random>
@@ -330,6 +335,7 @@
 			<mat_mossy>0.0</mat_mossy>
 		</material>
 		<random>
+			<use_generate>True</use_generate>
 			<use_random_seed>True</use_random_seed>
 			<user_seed>1</user_seed>
 		</random>
@@ -389,6 +395,7 @@
 			<mat_mossy>0.0</mat_mossy>
 		</material>
 		<random>
+			<use_generate>True</use_generate>
 			<use_random_seed>True</use_random_seed>
 			<user_seed>1</user_seed>
 		</random>
diff --git a/release/scripts/addons_contrib/add_mesh_rocks/factory.xml b/release/scripts/addons_contrib/add_mesh_rocks/factory.xml
index 0d2abd9..0202486 100644
--- a/release/scripts/addons_contrib/add_mesh_rocks/factory.xml
+++ b/release/scripts/addons_contrib/add_mesh_rocks/factory.xml
@@ -33,6 +33,7 @@
 <!ELEMENT mat_IOR (#PCDATA)>
 <!ELEMENT mat_mossy (#PCDATA)>
 <!ELEMENT random (use_random_seed,user_seed)>
+<!ELEMENT use_generate (#PCDATA)>
 <!ELEMENT use_random_seed (#PCDATA)>
 <!ELEMENT user_seed (#PCDATA)>
 
@@ -94,6 +95,7 @@
 			<mat_mossy>0.0</mat_mossy>
 		</material>
 		<random>
+			<use_generate>True</use_generate>
 			<use_random_seed>True</use_random_seed>
 			<user_seed>1</user_seed>
 		</random>
@@ -153,6 +155,7 @@
 			<mat_mossy>0.0</mat_mossy>
 		</material>
 		<random>
+			<use_generate>True</use_generate>
 			<use_random_seed>True</use_random_seed>
 			<user_seed>1</user_seed>
 		</random>
@@ -212,6 +215,7 @@
 			<mat_mossy>0.0</mat_mossy>
 		</material>
 		<random>
+			<use_generate>True</use_generate>
 			<use_random_seed>True</use_random_seed>
 			<user_seed>1</user_seed>
 		</random>
@@ -271,6 +275,7 @@
 			<mat_mossy>0.0</mat_mossy>
 		</material>
 		<random>
+			<use_generate>True</use_generate>
 			<use_random_seed>True</use_random_seed>
 			<user_seed>1</user_seed>
 		</random>
@@ -330,6 +335,7 @@
 			<mat_mossy>0.0</mat_mossy>
 		</material>
 		<random>
+			<use_generate>True</use_generate>
 			<use_random_seed>True</use_random_seed>
 			<user_seed>1</user_seed>
 		</random>
@@ -389,6 +395,7 @@
 			<mat_mossy>0.0</mat_mossy>
 		</material>
 		<random>
+			<use_generate>True</use_generate>
 			<use_random_seed>True</use_random_seed>
 			<user_seed>1</user_seed>
 		</random>
diff --git a/release/scripts/addons_contrib/add_mesh_rocks/rockgen.py b/release/scripts/addons_contrib/add_mesh_rocks/rockgen.py
index 8a86fd9..b1efa62 100644
--- a/release/scripts/addons_contrib/add_mesh_rocks/rockgen.py
+++ b/release/scripts/addons_contrib/add_mesh_rocks/rockgen.py
@@ -1475,12 +1475,15 @@ class rocks(bpy.types.Operator):
                               description = "Amount of mossiness on the rocks",
                               min = 0.0, max = 1.0, default = defaults[25])
 
+    use_generate = BoolProperty(name = "Generate Rocks",
+                                description = "Enable actual generation.",
+                                default = defaults[26])
     use_random_seed = BoolProperty(name = "Use a random seed",
                                   description = "Create a seed based on time. Causes user seed to be ignored.",
-                                  default = defaults[26])
+                                  default = defaults[27])
     user_seed = IntProperty(name = "User seed",
                             description = "Use a specific seed for the generator.",
-                            min = 0, max = 1048576, default = defaults[27])
+                            min = 0, max = 1048576, default = defaults[28])
 
 
     def draw(self, context):
@@ -1521,6 +1524,7 @@ class rocks(bpy.types.Operator):
                 box.prop(self, 'mat_IOR')
             box.prop(self, 'mat_mossy')
         box = layout.box()
+        box.prop(self, 'use_generate')
         box.prop(self, 'use_random_seed')
         if not self.use_random_seed:
             box.prop(self, 'user_seed')
@@ -1555,42 +1559,44 @@ class rocks(bpy.types.Operator):
             self.mat_cloudy = float(self.presetsList[int(self.preset_values)][23])
             self.mat_IOR = float(self.presetsList[int(self.preset_values)][24])
             self.mat_mossy = float(self.presetsList[int(self.preset_values)][25])
-            self.use_random_seed = bool(self.presetsList[int(self.preset_values)][26])
-            self.user_seed = int(self.presetsList[int(self.preset_values)][27])
+            self.use_generate = bool(self.presetsList[int(self.preset_values)][26])
+            self.use_random_seed = bool(self.presetsList[int(self.preset_values)][27])
+            self.user_seed = int(self.presetsList[int(self.preset_values)][28])
             self.lastPreset = int(self.preset_values)
 
         # todo Add deform, deform_Var, rough, and rough_Var:
         #   *** todo completed 4/23/2011 ***
         #   *** Eliminated "deform_Var" and "rough_Var" so the script is not
         #       as complex to use.  May add in again as advanced features. ***
-        generateRocks(context,
-                      self.scale_X,
-                      self.skew_X,
-                      self.scale_Y,
-                      self.skew_Y,
-                      self.scale_Z,
-                      self.skew_Z,
-                      self.scale_fac,
-                      self.detail,
-                      self.display_detail,
-                      self.deform,
-                      self.rough,
-                      self.smooth_fac,
-                      self.smooth_it,
-                      self.mat_enable,
-                      self.mat_color,
-                      self.mat_bright,
-                      self.mat_rough,
-                      self.mat_spec,
-                      self.mat_hard,
-                      self.mat_use_trans,
-                      self.mat_alpha,
-                      self.mat_cloudy,
-                      self.mat_IOR,
-                      self.mat_mossy,
-                      self.num_of_rocks,
-                      self.user_seed,
-                      self.use_scale_dis,
-                      self.use_random_seed)
+        if self.use_generate:
+            generateRocks(context,
+                          self.scale_X,
+                          self.skew_X,
+                          self.scale_Y,
+                          self.skew_Y,
+                          self.scale_Z,
+                          self.skew_Z,
+                          self.scale_fac,
+                          self.detail,
+                          self.display_detail,
+                          self.deform,
+                          self.rough,
+                          self.smooth_fac,
+                          self.smooth_it,
+                          self.mat_enable,
+                          self.mat_color,
+                          self.mat_bright,
+                          self.mat_rough,
+                          self.mat_spec,
+                          self.mat_hard,
+                          self.mat_use_trans,
+                          self.mat_alpha,
+                          self.mat_cloudy,
+                          self.mat_IOR,
+                          self.mat_mossy,
+                          self.num_of_rocks,
+                          self.user_seed,
+                          self.use_scale_dis,
+                          self.use_random_seed)
 
         return {'FINISHED'}
diff --git a/release/scripts/addons_contrib/add_mesh_rocks/settings.py b/release/scripts/addons_contrib/add_mesh_rocks/settings.py
index 3c99c6b..647a62d 100644
--- a/release/scripts/addons_contrib/add_mesh_rocks/settings.py
+++ b/release/scripts/addons_contrib/add_mesh_rocks/settings.py
@@ -147,25 +147,29 @@ def parseNode(setting, title=True):
     loc += 2
 
     # Preset random values (xmlPreset.childNodes[9]):
-    if setting.childNodes[loc].childNodes[1].childNodes[0].data == 'False':
+    if setting.childNodes[loc].childNodes[1].childNodes[0].data == 'True':
+        use_generate = True
+    else:
+        use_generate = False
+    if setting.childNodes[loc].childNodes[3].childNodes[0].data == 'False':
         use_random_seed = False
     else:
         use_random_seed = True
-    user_seed = int(setting.childNodes[loc].childNodes[3].childNodes[0].data)
+    user_seed = int(setting.childNodes[loc].childNodes[5].childNodes[0].data)
 
     if title:
         parsed = [title, scaleX, scaleY, scaleZ, skewX, skewY, skewZ,
                   use_scale_dis, scale_fac, deform, rough, detail,
                   display_detail, smooth_fac, smooth_it, mat_enable, mat_color,
                   mat_bright, mat_rough, mat_spec, mat_hard, mat_use_trans,
-                  mat_alpha, mat_cloudy, mat_IOR, mat_mossy, use_random_seed,
-                  user_seed]
+                  mat_alpha, mat_cloudy, mat_IOR, mat_mossy, use_generate,
+                  use_random_seed, user_seed]
     else:
         parsed = [scaleX, scaleY, scaleZ, skewX, skewY, skewZ, use_scale_dis,
                   scale_fac, deform, rough, detail, display_detail, smooth_fac,
                   smooth_it, mat_enable, mat_color, mat_bright, mat_rough,
                   mat_spec, mat_hard, mat_use_trans, mat_alpha, mat_cloudy,
-                  mat_IOR, mat_mossy, use_random_seed, user_seed]
+                  mat_IOR, mat_mossy, use_generate, use_random_seed, user_seed]
 
     return parsed
 
diff --git a/release/scripts/addons_contrib/add_mesh_rocks/utils.py b/release/scripts/addons_contrib/add_mesh_rocks/utils.py
index a135b0e..94acaf7 100644
--- a/release/scripts/addons_contrib/add_mesh_rocks/utils.py
+++ b/release/scripts/addons_contrib/add_mesh_rocks/utils.py
@@ -60,6 +60,10 @@ def toInts(inList):
 # Sets all faces smooth.  Done this way since I can't
 # find a simple way without using bpy.ops:
 def smooth(mesh):
-    for i in mesh.faces:
-        i.use_smooth = True
+    import bmesh
+    bm = bmesh.new()
+    bm.from_mesh(mesh)
+    for f in bm.faces:
+        f.smooth = True
+    bm.to_mesh(mesh)
     return mesh
diff --git a/release/scripts/addons_contrib/btrace/__init__.py b/release/scripts/addons_contrib/btrace/__init__.py
index f0dd012..e2dac1d 100644
--- a/release/scripts/addons_contrib/btrace/__init__.py
+++ b/release/scripts/addons_contrib/btrace/__init__.py
@@ -17,23 +17,27 @@
 #END GPL LICENCE BLOCK
 
 bl_info = {
-    'name': "bTrace",
+    'name': "Btrace",
     'author': "liero, crazycourier, Atom, Meta-Androcto, MacKracken",
     'version': (1, 1, ),
-    'blender': (2, 61, 1),
+    'blender': (2, 62),
     'location': "View3D > Tools",
     'description': "Tools for converting/animating objects/particles into curves",
     'warning': "Still under development, bug reports appreciated",
     'wiki_url': "",
     'tracker_url': "http://projects.blender.org/tracker/?func=detail&atid=468&aid=29563&group_id=153",
-    'category': "Mesh"
+    'category': "Add Curve"
     }
+
 import bpy
 from .bTrace import *
-from bpy.props import *
+import selection_utils
+from bpy.props import FloatProperty, EnumProperty, IntProperty, BoolProperty, FloatVectorProperty
 
 ### Define Classes to register
-classes = [TracerProperties,
+classes = [
+    TracerProperties,
+    TracerPropertiesMenu,
     addTracerObjectPanel,
     OBJECT_OT_convertcurve,
     OBJECT_OT_objecttrace,
@@ -43,12 +47,18 @@ classes = [TracerProperties,
     OBJECT_OT_traceallparticles,
     OBJECT_OT_curvegrow,
     OBJECT_OT_reset,
-    OBJECT_OT_fcnoise]
+    OBJECT_OT_fcnoise,
+    OBJECT_OT_meshfollow,
+    OBJECT_OT_materialChango,
+    OBJECT_OT_clearColorblender
+    ]
 
 def register():
     for c in classes:
         bpy.utils.register_class(c)
     bpy.types.WindowManager.curve_tracer = bpy.props.PointerProperty(type=TracerProperties)
+    bpy.types.WindowManager.btrace_menu = bpy.props.PointerProperty(type=TracerPropertiesMenu, update=deselect_others)
+
 def unregister():
     for c in classes:
         bpy.utils.unregister_class(c)
diff --git a/release/scripts/addons_contrib/btrace/bTrace.py b/release/scripts/addons_contrib/btrace/bTrace.py
index c9b01a3..c4769e8 100644
--- a/release/scripts/addons_contrib/btrace/bTrace.py
+++ b/release/scripts/addons_contrib/btrace/bTrace.py
@@ -17,32 +17,60 @@
 #END GPL LICENCE BLOCK
 
 bl_info = {
-    'name': "bTrace",
+    'name': "Btrace",
     'author': "liero, crazycourier, Atom, Meta-Androcto, MacKracken",
     'version': (1, 1, ),
-    'blender': (2, 61, 1),
+    'blender': (2, 62),
     'location': "View3D > Tools",
     'description': "Tools for converting/animating objects/particles into curves",
     'warning': "Still under development, bug reports appreciated",
     'wiki_url': "",
     'tracker_url': "http://projects.blender.org/tracker/?func=detail&atid=468&aid=29563&group_id=153",
-    'category': "Mesh"
+    'category': "Add Curve"
     }
 
 #### TO DO LIST ####
 ### [   ]  Add more options to curve radius/modulation plus cyclic/connect curve option
 
-import bpy, selection_utils
-from bpy.props import FloatProperty, EnumProperty, IntProperty, BoolProperty
+import bpy
+import selection_utils
+from bpy.props import FloatProperty, EnumProperty, IntProperty, BoolProperty, FloatVectorProperty
+
+
+def deselect_others(ob, context):
+    '''For tool menu select, deselects others if one selected'''
+    selected = addTracerObjectPanel.selected
+    ob[selected] = False
+    keys = [key for key in ob.keys() if ob[key]]  # all the True keys
+    if len(keys) <= 0:
+        ob[selected] = True  # reselect
+        return None
+    for key in keys:
+        addTracerObjectPanel.selected = key
+        ob[key] = True
+
+
+# Class for properties panel
+class TracerPropertiesMenu(bpy.types.PropertyGroup):
+    '''Toolbar show/hide booleans for tool options'''
+    tool_objectTrace = BoolProperty(name="Object Trace", default=False, description="Trace selected mesh object with a curve", update=deselect_others)
+    tool_objectsConnect = BoolProperty(name="Objects Connect", default=False, description="Connect objects with a curve controlled by hooks", update=deselect_others)
+    tool_particleTrace = BoolProperty(name="Particle Trace", default=False, description="Trace particle path with a  curve", update=deselect_others)
+    tool_meshFollow = BoolProperty(name="Mesh Follow", default=False, description="Follow selection items on animated mesh object", update=deselect_others)
+    tool_particleConnect = BoolProperty(name="Particle Connect", default=False, description="Connect particles with a curves and animated over particle lifetime", update=deselect_others)
+    tool_growCurve = BoolProperty(name="Grow Curve", default=False, description="Animate curve bevel over time by keyframing points radius", update=deselect_others)
+    tool_handwrite = BoolProperty(name="Handwriting", default=False, description="Create and Animate curve using the grease pencil", update=deselect_others)
+    tool_fcurve = BoolProperty(name="F-Curve Noise", default=False, description="Add F-Curve noise to selected objects", update=deselect_others)
+    tool_colorblender = BoolProperty(name="Color Blender", default=False, description="Add F-Curve noise to selected objects", update=deselect_others)
+
 
 # Class to define properties
 class TracerProperties(bpy.types.PropertyGroup):
-    enabled = IntProperty(default=0)
-    # Object Curve Settings
+    '''Options for tools'''
     curve_spline = EnumProperty(name="Spline", items=(("POLY", "Poly", "Use Poly spline type"),  ("NURBS", "Nurbs", "Use Nurbs spline type"), ("BEZIER", "Bezier", "Use Bezier spline type")), description="Choose which type of spline to use when curve is created", default="BEZIER")
     curve_handle = EnumProperty(name="Handle", items=(("ALIGNED", "Aligned", "Use Aligned Handle Type"), ("AUTOMATIC", "Automatic", "Use Auto Handle Type"), ("FREE_ALIGN", "Free Align", "Use Free Handle Type"), ("VECTOR", "Vector", "Use Vector Handle Type")), description="Choose which type of handle to use when curve is created",  default="VECTOR")
-    curve_resolution = IntProperty(name="Bevel Resolution" , min=1, max=32, default=4, description="Adjust the Bevel resolution")
-    curve_depth = FloatProperty(name="Bevel Depth", min=0.0, max=100.0, default=0.125, description="Adjust the Bevel depth")
+    curve_resolution = IntProperty(name="Bevel Resolution", min=1, max=32, default=4, description="Adjust the Bevel resolution")
+    curve_depth = FloatProperty(name="Bevel Depth", min=0.0, max=100.0, default=0.1, description="Adjust the Bevel depth")
     curve_u = IntProperty(name="Resolution U", min=0, max=64, default=12, description="Adjust the Surface resolution")
     curve_join = BoolProperty(name="Join Curves", default=False, description="Join all the curves after they have been created")
     curve_smooth = BoolProperty(name="Smooth", default=True, description="Render curve smooth")
@@ -51,11 +79,11 @@ class TracerProperties(bpy.types.PropertyGroup):
     # Distort Mesh options
     distort_modscale = IntProperty(name="Modulation Scale", min=0, max=50, default=2, description="Add a scale to modulate the curve at random points, set to 0 to disable")
     distort_noise = FloatProperty(name="Mesh Noise", min=0.0, max=50.0, default=0.00, description="Adjust noise added to mesh before adding curve")
-    # Particle Options    
+    # Particle Options
     particle_step = IntProperty(name="Step Size", min=1, max=50, default=5, description="Sample one every this number of frames")
     particle_auto = BoolProperty(name='Auto Frame Range', default=True, description='Calculate Frame Range from particles life')
-    particle_f_start = IntProperty( name='Start Frame', min=1, max=5000, default=1, description='Start frame')
-    particle_f_end = IntProperty( name='End Frame', min=1, max=5000, default=250, description='End frame')
+    particle_f_start = IntProperty(name='Start Frame', min=1, max=5000, default=1, description='Start frame')
+    particle_f_end = IntProperty(name='End Frame', min=1, max=5000, default=250, description='End frame')
     # F-Curve Modifier Properties
     fcnoise_rot = BoolProperty(name="Rotation", default=False, description="Affect Rotation")
     fcnoise_loc = BoolProperty(name="Location", default=True, description="Affect Location")
@@ -63,253 +91,395 @@ class TracerProperties(bpy.types.PropertyGroup):
     fcnoise_amp = IntProperty(name="Amp", min=1, max=500, default=5, description="Adjust the amplitude")
     fcnoise_timescale = FloatProperty(name="Time Scale", min=1, max=500, default=50, description="Adjust the time scale")
     fcnoise_key = BoolProperty(name="Add Keyframe", default=True, description="Keyframe is needed for tool, this adds a LocRotScale keyframe")
-    # Toolbar Settings/Options Booleans
-    curve_settings = BoolProperty(name="Curve Settings", default=False, description="Change the settings for the created curve")
+    show_curve_settings = BoolProperty(name="Curve Settings", default=False, description="Change the curve settings for the created curve")
+    material_settings = BoolProperty(name="Material Settings", default=False, description="Change the material settings for the created curve")
     particle_settings = BoolProperty(name="Particle Settings", default=False, description="Show the settings for the created curve")
     animation_settings = BoolProperty(name="Animation Settings", default=False, description="Show the settings for the Animations")
     distort_curve = BoolProperty(name="Add Distortion", default=False, description="Set options to distort the final curve")
     connect_noise = BoolProperty(name="F-Curve Noise", default=False, description="Adds F-Curve Noise Modifier to selected objects")
     settings_objectTrace = BoolProperty(name="Object Trace Settings", default=False, description="Trace selected mesh object with a curve")
     settings_objectsConnect = BoolProperty(name="Objects Connect Settings", default=False, description="Connect objects with a curve controlled by hooks")
+    settings_objectTrace = BoolProperty(name="Object Trace Settings", default=False, description="Trace selected mesh object with a curve")
     respect_order = BoolProperty(name="Order", default=False, description="Remember order objects were selected")
     settings_particleTrace = BoolProperty(name="Particle Trace Settings", default=False, description="Trace particle path with a  curve")
     settings_particleConnect = BoolProperty(name="Particle Connect Settings", default=False, description="Connect particles with a curves and animated over particle lifetime")
     settings_growCurve = BoolProperty(name="Grow Curve Settings", default=False, description="Animate curve bevel over time by keyframing points radius")
     settings_fcurve = BoolProperty(name="F-Curve Settings", default=False, description="F-Curve Settings")
-    # Toolbar Tool show/hide booleans
-    tool_objectTrace = BoolProperty(name="Object Trace", default=False, description="Trace selected mesh object with a curve")
-    tool_objectsConnect = BoolProperty(name="Objects Connect", default=False, description="Connect objects with a curve controlled by hooks")
-    tool_particleTrace = BoolProperty(name="Particle Trace", default=False, description="Trace particle path with a  curve")
-    tool_particleConnect = BoolProperty(name="Particle Connect", default=False, description="Connect particles with a curves and animated over particle lifetime")
-    tool_growCurve = BoolProperty(name="Grow Curve", default=False, description="Animate curve bevel over time by keyframing points radius")
-    tool_handwrite = BoolProperty(name="Handwriting", default=False, description="Create and Animate curve using the grease pencil")
-    tool_fcurve = BoolProperty(name="F-Curve Noise", default=False, description="Add F-Curve noise to selected objects")
+    settings_toggle = BoolProperty(name="Settings", default=False, description="Toggle Settings")
     # Animation Options
     anim_auto = BoolProperty(name='Auto Frame Range', default=True, description='Automatically calculate Frame Range')
     anim_f_start = IntProperty(name='Start', min=1, max=2500, default=1, description='Start frame / Hidden object')
     anim_length = IntProperty(name='Duration', min=1, soft_max=1000, max=2500, default=100, description='Animation Length')
     anim_f_fade = IntProperty(name='Fade After', min=0, soft_max=250, max=2500, default=10, description='Fade after this frames / Zero means no fade')
     anim_delay = IntProperty(name='Grow', min=0, max=50, default=5, description='Frames it takes a point to grow')
-    anim_tails = BoolProperty(name='Tails', default=True, description='Set radius to zero for open splines endpoints')
-    anim_keepr = BoolProperty(name='Radius', default=True, description='Try to keep radius data from original curve')
+    anim_tails = BoolProperty(name='Tails on endpoints', default=True, description='Set radius to zero for open splines endpoints')
+    anim_keepr = BoolProperty(name='Keep Radius', default=True, description='Try to keep radius data from original curve')
     animate = BoolProperty(name="Animate Result", default=False, description='Animate the final curve objects')
     # Convert to Curve options
     convert_conti = BoolProperty(name='Continuous', default=True, description='Create a continuous curve using verts from mesh')
     convert_everyedge = BoolProperty(name='Every Edge', default=False, description='Create a curve from all verts in a mesh')
-    convert_edgetype = EnumProperty(name="Edge Type for Curves", 
-        items=(("CONTI", "Continuous", "Create a continuous curve using verts from mesh"),  ("EDGEALL", "All Edges", "Create a curve from every edge in a mesh")), 
+    convert_edgetype = EnumProperty(name="Edge Type for Curves",
+        items=(("CONTI", "Continuous", "Create a continuous curve using verts from mesh"),  ("EDGEALL", "All Edges", "Create a curve from every edge in a mesh")),
         description="Choose which type of spline to use when curve is created", default="CONTI")
     convert_joinbefore = BoolProperty(name="Join objects before convert", default=False, description='Join all selected mesh to one object before converting to mesh')
+    # Mesh Follow Options
+    fol_edge_select = BoolProperty(name='Edge', default=False, description='Grow from edges')
+    fol_vert_select = BoolProperty(name='Vertex', default=False, description='Grow from verts')
+    fol_face_select = BoolProperty(name='Face', default=True, description='Grow from faces')
+    fol_mesh_type = EnumProperty(name='Mesh type', default='VERTS', description='Mesh feature to draw cruves from', items=(
+        ("VERTS", "Verts", "Draw from Verts"), ("EDGES", "Edges", "Draw from Edges"), ("FACES", "Faces", "Draw from Faces"), ("OBJECT", "Object", "Draw from Object origin")))
+    fol_start_frame = IntProperty(name="Start Frame", min=1, max=2500, default=1, description="Start frame for range to trace")
+    fol_end_frame = IntProperty(name="End Frame", min=1, max=2500, default=250, description="End frame for range to trace")
+    fol_perc_verts = FloatProperty(name="Reduce selection by", min=0.001, max=1.000, default=0.5, description="percentage of total verts to trace")
+    fol_sel_option = EnumProperty(name="Selection type", description="Choose which objects to follow", default="RANDOM", items=(
+        ("RANDOM", "Random", "Follow Random items"),  ("CUSTOM", "Custom Select", "Follow selected items"), ("ALL", "All", "Follow all items")))
+    trace_mat_color = FloatVectorProperty(name="Material Color", description="Choose material color", min=0, max=1, default=(0.0,0.3,0.6), subtype="COLOR")
+    trace_mat_random = BoolProperty(name="Random Color", default=False, description='Make the material colors random')
+
+    # Material custom Properties properties
+    mat_simple_adv_toggle = EnumProperty(name="Material Options", items=(("SIMPLE", "Simple", "Show Simple Material Options"), ("ADVANCED", "Advanced", "Show Advanced Material Options")), description="Choose which Material Options to show", default="SIMPLE")
+    mat_run_color_blender = BoolProperty(name="Run Color Blender", default=False, description="Generate colors from a color scheme")
+    mmColors = bpy.props.EnumProperty(
+        items=(("RANDOM", "Random", "Use random colors"),
+                ("CUSTOM", "Custom", "Use custom colors"),
+                ("BW", "Black/White", "Use Black and White"),
+                ("BRIGHT", "Bright Colors", "Use Bright colors"),
+                ("EARTH", "Earth", "Use Earth colors"),
+                ("GREENBLUE", "Green to Blue", "Use Green to Blue colors")),
+        description="Choose which type of colors the materials uses",
+        default="BRIGHT",
+        name="Define a color palette")
+    # Custom property for how many keyframes to skip
+    mmSkip = bpy.props.IntProperty(name="frames", min=1, max=500, default=20, description="Number of frames between each keyframes")
+    # Custom property to enable/disable random order for the 
+    mmBoolRandom = bpy.props.BoolProperty(name="Random Order", default=False, description="Randomize the order of the colors")
+    # Custom Color properties
+    mmColor1 = bpy.props.FloatVectorProperty(min=0, max=1, default=(0.8, 0.8, 0.8), description="Custom Color 1", subtype="COLOR")
+    mmColor2 = bpy.props.FloatVectorProperty(min=0, max=1, default=(0.8, 0.8, 0.3), description="Custom Color 2", subtype="COLOR")
+    mmColor3 = bpy.props.FloatVectorProperty(min=0, max=1, default=(0.8, 0.5, 0.6), description="Custom Color 3", subtype="COLOR")
+    mmColor4 = bpy.props.FloatVectorProperty(min=0, max=1, default=(0.2, 0.8, 0.289), description="Custom Color 4", subtype="COLOR")
+    mmColor5 = bpy.props.FloatVectorProperty(min=0, max=1, default=(1.0, 0.348, 0.8), description="Custom Color 5", subtype="COLOR")
+    mmColor6 = bpy.props.FloatVectorProperty(min=0, max=1, default=(0.4, 0.67, 0.8), description="Custom Color 6", subtype="COLOR")
+    mmColor7 = bpy.props.FloatVectorProperty(min=0, max=1, default=(0.66, 0.88, 0.8), description="Custom Color 7", subtype="COLOR")
+    mmColor8 = bpy.props.FloatVectorProperty(min=0, max=1, default=(0.8, 0.38, 0.22), description="Custom Color 8", subtype="COLOR")
+    # BW Color properties
+    bwColor1 = bpy.props.FloatVectorProperty(min=0, max=1, default=(0.0,0.0,0.0), description="Black/White Color 1", subtype="COLOR")
+    bwColor2 = bpy.props.FloatVectorProperty(min=0, max=1, default=(1.0,1.0,1.0), description="Black/White Color 2", subtype="COLOR")
+    # Bright Color properties
+    brightColor1 = bpy.props.FloatVectorProperty(min=0, max=1, default=(1.0, 0.0, 0.75), description="Bright Color 1", subtype="COLOR")
+    brightColor2 = bpy.props.FloatVectorProperty(min=0, max=1, default=(0.0,1.0,1.0), description="Bright Color 2", subtype="COLOR")
+    brightColor3 = bpy.props.FloatVectorProperty(min=0, max=1, default=(0.0,1.0,0.0), description="Bright Color 3", subtype="COLOR")
+    brightColor4 = bpy.props.FloatVectorProperty(min=0, max=1, default=(1.0,1.0,0.0), description="Bright Color 4", subtype="COLOR")
+    # Earth Color Properties
+    earthColor1 = bpy.props.FloatVectorProperty(min=0, max=1, default=(0.068, 0.019, 0.014), description="Earth Color 1", subtype="COLOR")
+    earthColor2 = bpy.props.FloatVectorProperty(min=0, max=1, default=(0.089, 0.060, 0.047), description="Earth Color 2", subtype="COLOR")
+    earthColor3 = bpy.props.FloatVectorProperty(min=0, max=1, default=(0.188, 0.168, 0.066), description="Earth Color 3", subtype="COLOR")
+    earthColor4 = bpy.props.FloatVectorProperty(min=0, max=1, default=(0.445, 0.296, 0.065), description="Earth Color 4", subtype="COLOR")
+    earthColor5 = bpy.props.FloatVectorProperty(min=0, max=1, default=(0.745, 0.332, 0.065), description="Earth Color 5", subtype="COLOR")
+    # Green to Blue Color properties
+    greenblueColor1 = bpy.props.FloatVectorProperty(min=0, max=1, default=(0.296, 0.445, 0.074), description="Green/Blue Color 1", subtype="COLOR")
+    greenblueColor2 = bpy.props.FloatVectorProperty(min=0, max=1, default=(0.651, 1.0, 0.223), description="Green/Blue Color 2", subtype="COLOR")
+    greenblueColor3 = bpy.props.FloatVectorProperty(min=0, max=1, default=(0.037, 0.047, 0.084), description="Green/Blue Color 3", subtype="COLOR")
 
 
-############################    
+############################
 ## Draw Brush panel in Toolbar
 ############################
 class addTracerObjectPanel(bpy.types.Panel):
-    bl_label = "bTrace: Panel"
+    bl_label = "Btrace: Panel"
     bl_space_type = 'VIEW_3D'
     bl_region_type = 'TOOLS'
     bl_context = 'objectmode'
+    selected = "tool_objectTrace"
 
     def draw(self, context):
         layout = self.layout
-        bTrace=bpy.context.window_manager.curve_tracer
+        Btrace = bpy.context.window_manager.curve_tracer
+        btracemenu = props = bpy.context.window_manager.btrace_menu
         obj = bpy.context.object
-        
+
+
         ############################
-        ## Curve options
+        ## Color Blender Panel options
         ############################
-        curve_settings = bTrace.curve_settings
-        row = self.layout.row()
-        row.label(text="Universal Curve Settings")
-        box = self.layout.box()
-        row = box.row()
-        CurveSettingText="Show: Curve Settings"
-        if curve_settings:
-            CurveSettingText="Hide: Curve Settings"
-        else:
-            CurveSettingText="Show: Curve Settings"
-        row.prop(bTrace, 'curve_settings', icon='CURVE_BEZCURVE', text=CurveSettingText)
-        if curve_settings:
-            box.label(text="Curve Settings", icon="CURVE_BEZCURVE")
-            if len(bpy.context.selected_objects) > 0:
-                if obj.type == 'CURVE':
-                    col = box.column(align=True)
-                    col.label(text="Edit Curves for")
-                    col.label(text="Selected Curve")
-                    col.prop(obj.data, 'bevel_depth')
-                    col.prop(obj.data, 'bevel_resolution')
-                    col.prop(obj.data, 'resolution_u')
+        def color_blender():
+            '''Buttons for Color Blender'''
+            row = box.row()
+            row.label("Color palette")
+            row.prop(Btrace, 'mmColors', text="")
+            # Show Custom Colors if selected
+            if Btrace.mmColors == 'CUSTOM':
+                row = box.row(align=True)
+                row.prop(Btrace, 'mmColor1', text="")
+                row.prop(Btrace, 'mmColor2', text="")
+                row.prop(Btrace, 'mmColor3', text="")
+                row.prop(Btrace, 'mmColor4', text="")
+                row.prop(Btrace, 'mmColor5', text="")
+                row.prop(Btrace, 'mmColor6', text="")
+                row.prop(Btrace, 'mmColor7', text="")
+                row.prop(Btrace, 'mmColor8', text="")
+            # Show Earth Colors
+            elif Btrace.mmColors == 'BW':
+                row = box.row(align=True)
+                row.prop(Btrace, 'bwColor1', text="")
+                row.prop(Btrace, 'bwColor2', text="")
+            # Show Earth Colors
+            elif Btrace.mmColors == 'BRIGHT':
+                row = box.row(align=True)
+                row.prop(Btrace, 'brightColor1', text="")
+                row.prop(Btrace, 'brightColor2', text="")
+                row.prop(Btrace, 'brightColor3', text="")
+                row.prop(Btrace, 'brightColor4', text="")
+            # Show Earth Colors
+            elif Btrace.mmColors == 'EARTH':
+                row = box.row(align=True)
+                row.prop(Btrace, 'earthColor1', text="")
+                row.prop(Btrace, 'earthColor2', text="")
+                row.prop(Btrace, 'earthColor3', text="")
+                row.prop(Btrace, 'earthColor4', text="")
+                row.prop(Btrace, 'earthColor5', text="")
+            # Show Earth Colors
+            elif Btrace.mmColors == 'GREENBLUE':
+                row = box.row(align=True)
+                row.prop(Btrace, 'greenblueColor1', text="")
+                row.prop(Btrace, 'greenblueColor2', text="")
+                row.prop(Btrace, 'greenblueColor3', text="")
+            elif Btrace.mmColors == 'RANDOM':
+                row = box.row()
+
+        ############################
+        ## Curve Panel options
+        ############################
+        def curve_settings():
+            '''Button for curve options'''
+            row = self.layout.row()
+            row = box.row(align=True)
+
+            row.prop(Btrace, 'show_curve_settings', icon='CURVE_BEZCURVE', text="Curve Settings")
+            row.prop(Btrace, 'material_settings', icon='MATERIAL_DATA', text="Material Settings")
+            if Btrace.material_settings:
+                row = box.row()
+                row.label(text="Material Settings", icon='COLOR')
+                row = box.row()
+                row.prop(Btrace, "trace_mat_random")
+                if not Btrace.trace_mat_random:
+                    row = box.row()
+                    row.prop(Btrace, "trace_mat_color", text="")
                 else:
-                    ############################
-                    ## Object Curve Settings 
-                    ############################
-                    curve_spline, curve_handle, curve_depth, curve_resolution, curve_u = bTrace.curve_spline, bTrace.curve_handle, bTrace.curve_depth, bTrace.curve_resolution, bTrace.curve_u
-                    box.label(text="New Curve Settings")
-                    box.prop(bTrace, "curve_spline")
-                    box.prop(bTrace, "curve_handle")
+                    row.prop(Btrace, "mat_run_color_blender")
+                    if Btrace.mat_run_color_blender:
+                        row = box.row()
+                        row.operator("object.colorblenderclear", text="Reset Material Keyframes", icon="KEY_DEHLT")
+                        row.prop(Btrace, 'mmSkip', text="Keyframe every")
+                      
+                    color_blender()
+                row = box.row()
+            if Btrace.show_curve_settings:
+                #if  or btracemenu.tool_handwrite:
+                if len(bpy.context.selected_objects) > 0 and obj.type == 'CURVE': # selected curve options
                     col = box.column(align=True)
-                    col.prop(bTrace, "curve_depth")
-                    col.prop(bTrace, "curve_resolution")
-                    col.prop(bTrace, "curve_u")
-            
-        ######################
-        ## Start  Object Tools ###
-        ######################
-        row = self.layout.row()
-        row.label(text="Object Tools")
-        distort_curve = bTrace.distort_curve
-        tool_objectTrace, settings_objectTrace, convert_joinbefore, convert_edgetype = bTrace.tool_objectTrace, bTrace.settings_objectTrace, bTrace.convert_joinbefore, bTrace.convert_edgetype
-        animate = bTrace.animate
-        anim_auto, curve_join = bTrace.anim_auto, bTrace.curve_join
-        settings_particleTrace, settings_particleConnect = bTrace.settings_particleTrace, bTrace.settings_particleConnect
+                    col.label(text="Edit Curves for", icon='CURVE_BEZCURVE')
+                    col.label(text="Selected Curve Bevel Options")
+                    row = col.row(align=True)
+                    row.prop(obj.data, 'bevel_depth', text="Depth")
+                    row.prop(obj.data, 'bevel_resolution', text="Resolution")
+                    row = col.row(align=True)
+                    row.prop(obj.data, 'resolution_u')
+                else: # For new curve
+                    box.label(text="New Curve Settings", icon='CURVE_BEZCURVE')
+                    box.prop(Btrace, "curve_spline")
+                    box.prop(Btrace, "curve_handle")
+                    box.label(text="Bevel Options")
+                    col = box.column(align=True)
+                    row = col.row(align=True)
+                    row.prop(Btrace, "curve_depth", text="Depth")
+                    row.prop(Btrace, "curve_resolution", text="Resolution")
+                    row = col.row(align=True)
+                    row.prop(Btrace, "curve_u")
+
+        ############################
+        ## Grow Animation Panel options
+        ############################
+        def add_grow():
+            '''Button for grow animation option'''
+            row = box.row()
+            row.label(text="Animate Final Curve")
+            row = box.row()
+            row.prop(Btrace, "animate", text="Add Grow Curve Animation", icon="META_BALL")
+            row.label("")
+            if Btrace.animate:
+                box.label(text='Frame Animation Settings:', icon="META_BALL")
+                col = box.column(align=True)
+                col.prop(Btrace, 'anim_auto')
+                if not Btrace.anim_auto:
+                    row = col.row(align=True)
+                    row.prop(Btrace, 'anim_f_start')
+                    row.prop(Btrace, 'anim_length')
+                row = col.row(align=True)
+                row.prop(Btrace, 'anim_delay')
+                row.prop(Btrace, 'anim_f_fade')
+
+                box.label(text='Additional Settings')
+                row = box.row()
+                row.prop(Btrace, 'anim_tails')
+                row.prop(Btrace, 'anim_keepr')
+
+        ##################################################################
+        ## Start Btrace Panel
+        ##################################################################
+        col = self.layout.column(align=True)
+        #col.label(text="Trace Tools")
+        row = col.row()
+        row.prop(btracemenu, "tool_objectTrace", text="Ojbect Trace", icon="FORCE_MAGNETIC")
+        row.prop(btracemenu, "tool_objectsConnect", text="Object Connect", icon="OUTLINER_OB_EMPTY")
+        row = col.row()
+        row.prop(btracemenu, "tool_meshFollow", text="Mesh Follow", icon="DRIVER")
+        row.prop(btracemenu, "tool_handwrite", text="Handwriting", icon='BRUSH_DATA')
+        row = col.row()   
+        row.prop(btracemenu, "tool_particleTrace", icon="PARTICLES", text="Particle Trace")
+        row.prop(btracemenu, "tool_particleConnect", icon="MOD_PARTICLES", text="Particle Connect")
+        row = layout.row()
+        col = layout.column(align=True)
+        row = col.row()
+        row.prop(btracemenu, "tool_growCurve", icon="META_BALL", text="Grow Animation")
+        row.prop(btracemenu, "tool_fcurve", text="Fcurve Noise", icon='RNDCURVE')
+        row = col.row()
+        row.prop(btracemenu, "tool_colorblender", text="Color Blender", icon="COLOR")
+        row.label(text="")
+        row = layout.row()
+
+        ##########################
+        ## Start  Object Tools
+        ##########################
         sel = bpy.context.selected_objects
         ############################
         ### Object Trace
         ############################
-        box = self.layout.box()
-        row  = box.row ()
-        ObjectText="Show: Objects Trace"
-        if tool_objectTrace:
-            ObjectText="Hide: Objects Trace"
-        else:
-            ObjectText="Show: Objects Trace"
-        row.prop(bTrace, "tool_objectTrace", text=ObjectText, icon="FORCE_MAGNETIC")
-        if tool_objectTrace:
-            row  = box.row ()
+        if btracemenu.tool_objectTrace:
+            row = layout.row()
+            row.label(text="  Trace Tool:", icon="FORCE_CURVE")
+            box = self.layout.box()
+            row = box.row()
             row.label(text="Object Trace", icon="FORCE_MAGNETIC")
-            row.operator("object.btobjecttrace", text="Run!", icon="PLAY")  
-            row  = box.row ()
-            row.prop(bTrace, "settings_objectTrace", icon='MODIFIER', text='Settings')
-            row.label(text="")
-            if settings_objectTrace:
+            row.operator("object.btobjecttrace", text="Run!", icon="PLAY")
+            row = box.row()
+            row.prop(Btrace, "settings_toggle", icon='MODIFIER', text='Settings')
+            myselected = "Selected %d" % len(bpy.context.selected_objects)
+            row.label(text=myselected)
+            if Btrace.settings_toggle:
                 row = box.row()
                 row.label(text='Edge Draw Method')
                 row = box.row(align=True)
-                row.prop(bTrace, 'convert_edgetype')
-                box.prop(bTrace, "object_duplicate")
-                if len(sel) > 1 :
-                    box.prop(bTrace, 'convert_joinbefore')
+                row.prop(Btrace, 'convert_edgetype')
+                box.prop(Btrace, "object_duplicate")
+                if len(sel) > 1:
+                    box.prop(Btrace, 'convert_joinbefore')
                 else:
-                    convert_joinbefore = False
+                    Btrace.convert_joinbefore = False
                 row = box.row()
-                row.prop(bTrace, "distort_curve")
-                if distort_curve:
+                row.prop(Btrace, "distort_curve")
+                if Btrace.distort_curve:
                     col = box.column(align=True)
-                    col.prop(bTrace, "distort_modscale")
-                    col.prop(bTrace, "distort_noise")
+                    col.prop(Btrace, "distort_modscale")
+                    col.prop(Btrace, "distort_noise")
                 row = box.row()
-                row.prop(bTrace, "animate", text="Add Grow Curve Animation")
-                if animate:
-                    # animation settings here
-                    box.label(text='Frame Animation Settings:')
-                    col = box.column(align=True)
-                    col.prop(bTrace, 'anim_auto')
-                    if not anim_auto:
-                        row = col.row(align=True)
-                        row.prop(bTrace,'anim_f_start')
-                        row.prop(bTrace,'anim_length')
-                    row = col.row(align=True)
-                    row.prop(bTrace,'anim_delay')
-                    row.prop(bTrace,'anim_f_fade')
-
-                    box.label(text='Additional Settings')
-                    row = box.row()
-                    row.prop(bTrace,'anim_tails')
-                    row.prop(bTrace,'anim_keepr')
+                curve_settings()  # Show Curve/material settings
+                add_grow()  # Grow settings here
 
         ############################
         ### Objects Connect
         ############################
-        connect_noise = bTrace.connect_noise 
-        tool_objectsConnect, settings_objectsConnect, respect_order = bTrace.tool_objectsConnect, bTrace.settings_objectsConnect, bTrace.respect_order
-        box = self.layout.box()
-        row  = box.row ()
-        ObjectConnText="Show: Objects Connect"
-        if tool_objectsConnect:
-            ObjectConnText="Hide: Objects Connect"
-        else:
-            ObjectConnText="Show: Objects Connect"
-        row.prop(bTrace, "tool_objectsConnect", text=ObjectConnText, icon="OUTLINER_OB_EMPTY")
-        if tool_objectsConnect:
-            row  = box.row ()
+        if btracemenu.tool_objectsConnect:
+            row = layout.row()
+            row.label(text="  Trace Tool:", icon="FORCE_CURVE")
+            box = self.layout.box()
+            row = box.row()
             row.label(text="Objects Connect", icon="OUTLINER_OB_EMPTY")
             row.operator("object.btobjectsconnect", text="Run!", icon="PLAY")
             row = box.row()
-            row.prop(bTrace, "settings_objectsConnect", icon='MODIFIER', text='Settings')
-            row.prop(bTrace, "respect_order")
-            if respect_order:
-                box.operator("object.select_order")
-            if settings_objectsConnect:
-                box.prop(bTrace, "connect_noise")
-                if connect_noise:
+            row.prop(Btrace, "settings_toggle", icon='MODIFIER', text='Settings')
+            row.label(text="")
+            if Btrace.settings_toggle:
+                row = box.row()
+                row.prop(Btrace, "respect_order", text="Selection Options")
+                if Btrace.respect_order:
+                    box.operator("object.select_order", text="Click to start order selection", icon='UV_SYNC_SELECT')
+                row = box.row()
+                row.prop(Btrace, "connect_noise", text="Add F-Curve Noise")
+                if Btrace.connect_noise:
                     row = box.row()
-                    row.label(text="F-Curve Noise")
+                    row.label(text="F-Curve Noise", icon='RNDCURVE')
                     row = box.row(align=True)
-                    row.prop(bTrace, "fcnoise_rot")
-                    row.prop(bTrace, "fcnoise_loc")
-                    row.prop(bTrace, "fcnoise_scale")
+                    row.prop(Btrace, "fcnoise_rot")
+                    row.prop(Btrace, "fcnoise_loc")
+                    row.prop(Btrace, "fcnoise_scale")
                     col = box.column(align=True)
-                    col.prop(bTrace, "fcnoise_amp")
-                    col.prop(bTrace, "fcnoise_timescale")
-                    box.prop(bTrace, "fcnoise_key")
-                # Grow settings here
-                row = box.row()
-                row.prop(bTrace, "animate", text="Add Grow Curve Animation")
-                if animate:
-                    box.label(text='Frame Animation Settings:')
-                    col = box.column(align=True)
-                    col.prop(bTrace, 'anim_auto')
-                    if not anim_auto:
-                        row = col.row(align=True)
-                        row.prop(bTrace,'anim_f_start')
-                        row.prop(bTrace,'anim_length')
-                    row = col.row(align=True)
-                    row.prop(bTrace,'anim_delay')
-                    row.prop(bTrace,'anim_f_fade')
+                    col.prop(Btrace, "fcnoise_amp")
+                    col.prop(Btrace, "fcnoise_timescale")
+                    box.prop(Btrace, "fcnoise_key")
+                curve_settings()  # Show Curve/material settings
+                add_grow()  # Grow settings here
 
-                    box.label(text='Additional Settings')
-                    row = box.row()
-                    row.prop(bTrace,'anim_tails')
-                    row.prop(bTrace,'anim_keepr')
-    
         ############################
-        ### Handwriting Tools
+        ### Mesh Follow
         ############################
-        tool_handwrite = bTrace.tool_handwrite
-        box = self.layout.box()
-        row = box.row()
-        handText="Show: Handwriting Tool"
-        if tool_handwrite:
-            handText="Hide: Handwriting Tool"
-        else:
-            handText="Show: Handwriting Tool"
-        row.prop(bTrace, 'tool_handwrite', text=handText, icon='BRUSH_DATA')
-        if tool_handwrite:
+        if btracemenu.tool_meshFollow:
+            row = layout.row()
+            row.label(text="  Trace Tool:", icon="FORCE_CURVE")
+            box = self.layout.box()
             row = box.row()
-            row.label(text='Handwriting', icon='BRUSH_DATA')
-            row.operator("curve.btwriting", text="Run!", icon='PLAY')
-            box.prop(bTrace, "animate", text="Grow Curve Animation Settings")
-            if animate:
-                # animation settings here
-                box.label(text='Frame Animation Settings:')
+            row.label(text="Mesh Follow", icon="DRIVER")
+            row.operator("object.btmeshfollow", text="Run!", icon="PLAY")
+            row = box.row()
+            if Btrace.fol_mesh_type == 'OBJECT':
+                a, b = "Trace Object", "SNAP_VOLUME"
+            if Btrace.fol_mesh_type == 'VERTS':
+                a, b = "Trace Verts", "SNAP_VERTEX"
+            if Btrace.fol_mesh_type == 'EDGES':
+                a, b = "Trace Edges", "SNAP_EDGE"
+            if Btrace.fol_mesh_type == 'FACES':
+               a, b = "Trace Faces", "SNAP_FACE"
+            row.prop(Btrace, "settings_toggle", icon='MODIFIER', text='Settings')
+            row.label(text=a, icon=b)
+            if Btrace.settings_toggle:
                 col = box.column(align=True)
-                col.prop(bTrace, 'anim_auto')
-                if not anim_auto:
-                    row = col.row(align=True)
-                    row.prop(bTrace,'anim_f_start')
-                    row.prop(bTrace,'anim_length')
                 row = col.row(align=True)
-                row.prop(bTrace,'anim_delay')
-                row.prop(bTrace,'anim_f_fade')
+                row.prop(Btrace, "fol_mesh_type", expand=True)
+                row = col.row(align=True)
+                if Btrace.fol_mesh_type != 'OBJECT':
+                    row.prop(Btrace, "fol_sel_option", expand=True)
+                    row = box.row()
+                    if Btrace.fol_sel_option == 'RANDOM':
+                        row.label("Random Select of Total")
+                        row.prop(Btrace, "fol_perc_verts", text="%")
+                    if Btrace.fol_sel_option == 'CUSTOM':
+                        row.label("Choose selection in Edit Mode")
+                    if Btrace.fol_sel_option == 'ALL':
+                        row.label("Select All items")
+                col = box.column(align=True)
+                col.label("Time Options", icon="TIME")
+                col.prop(Btrace, "particle_step")
+                row = col.row(align=True)
+                row.prop(Btrace, "fol_start_frame")
+                row.prop(Btrace, "fol_end_frame")
+                curve_settings()  # Show Curve/material settings
+                add_grow()  # Grow settings here
 
-                box.label(text='Additional Settings')
-                row = box.row()
-                row.prop(bTrace,'anim_tails')
-                row.prop(bTrace,'anim_keepr')
-            box.label(text='Grease Pencil Writing Tools')
+         ############################
+        ### Handwriting Tools
+        ############################
+        if btracemenu.tool_handwrite:
+            row = layout.row()
+            row.label(text="  Trace Tool:", icon="FORCE_CURVE")
+            box = self.layout.box()
+            row = box.row()
+            row.label(text='Handwriting', icon='BRUSH_DATA')
+            row.operator("curve.btwriting", text="Run!", icon='PLAY')
+            row = box.row()
+            row = box.row()
+            row.label(text='Grease Pencil Writing Tools')
             col = box.column(align=True)
-            row = col.row()
+            row = col.row(align=True)
             row.operator("gpencil.draw", text="Draw", icon='BRUSH_DATA').mode = 'DRAW'
             row.operator("gpencil.draw", text="Poly", icon='VPAINT_HLT').mode = 'DRAW_POLY'
             row = col.row(align=True)
@@ -318,169 +488,123 @@ class addTracerObjectPanel(bpy.types.Panel):
             row = box.row()
             row.operator("gpencil.data_unlink", text="Delete Grease Pencil Layer", icon="CANCEL")
             row = box.row()
-            
-        
+            curve_settings()  # Show Curve/material settings
+            add_grow()  # Grow settings here
+
         ############################
         ### Particle Trace
         ############################
-        tool_particleTrace = bTrace.tool_particleTrace
-        box = self.layout.box()
-        row = box.row()
-        ParticleText="Show: Particle Trace"
-        if tool_particleTrace:
-            ParticleText="Hide: Particle Trace"
-        else:
-            ParticleText="Show: Particle Trace"
-        row.prop(bTrace, "tool_particleTrace", icon="PARTICLES", text=ParticleText)
-        if tool_particleTrace:
+        if btracemenu.tool_particleTrace:
+            row = layout.row()
+            row.label(text="  Trace Tool:", icon="FORCE_CURVE")
+            box = self.layout.box()
             row = box.row()
             row.label(text="Particle Trace", icon="PARTICLES")
             row.operator("particles.particletrace", text="Run!", icon="PLAY")
             row = box.row()
-            row.prop(bTrace, 'settings_particleTrace', icon='MODIFIER', text='Settings')
-            row.label(text='')
-            if settings_particleTrace:
-                box.prop(bTrace, "particle_step")
+            row.prop(Btrace, "settings_toggle", icon='MODIFIER', text='Settings')
+            row.label(text="")
+            if Btrace.settings_toggle:
+                box.prop(Btrace, "particle_step")
                 row = box.row()
-                row.prop(bTrace, "curve_join")
-                row.prop(bTrace, "animate", text="Add Grow Curve Animation")
-                if animate:
-                    # animation settings here
-                    box.label(text='Frame Animation Settings:')
-                    col = box.column(align=True)
-                    col.prop(bTrace, 'anim_auto')
-                    if not anim_auto:
-                        row = col.row(align=True)
-                        row.prop(bTrace,'anim_f_start')
-                        row.prop(bTrace,'anim_length')
-                    row = col.row(align=True)
-                    row.prop(bTrace,'anim_delay')
-                    row.prop(bTrace,'anim_f_fade')
+                row.prop(Btrace, "curve_join")
+                curve_settings()  # Show Curve/material settings
+                add_grow()  # Grow settings here
 
-                    box.label(text='Additional Settings')
-                    row = box.row()
-                    row.prop(bTrace,'anim_tails')
-                    row.prop(bTrace,'anim_keepr')
-        
         ############################
         ### Connect Particles
         ############################
-        particle_auto = bTrace.particle_auto
-        tool_particleConnect = bTrace.tool_particleConnect
-        box = self.layout.box()
-        row = box.row()
-        ParticleConnText="Show: Particle Connect"
-        if tool_particleConnect:
-            ParticleConnText="Hide: Particle Connect"
-        else:
-            ParticleConnText="Show: Particle Connect"
-        row.prop(bTrace, "tool_particleConnect", icon="MOD_PARTICLES", text=ParticleConnText)
-        if tool_particleConnect:
+        if btracemenu.tool_particleConnect:
+            row = layout.row()
+            row.label(text="  Trace Tool:", icon="FORCE_CURVE")
+            box = self.layout.box()
             row = box.row()
             row.label(text='Particle Connect', icon='MOD_PARTICLES')
             row.operator("particles.connect", icon="PLAY", text='Run!')
             row = box.row()
-            row.prop(bTrace, 'settings_particleConnect', icon='MODIFIER', text='Settings')
-            row.label(text='')
-            if settings_particleConnect:
-                box.prop(bTrace, "particle_step")
-                row= box.row()
-                row.prop(bTrace, 'particle_auto')
-                row.prop(bTrace, 'animate', text='Add Grow Curve Animation')
-                col = box.column(align=True)
-                if not particle_auto:
+            row.prop(Btrace, "settings_toggle", icon='MODIFIER', text='Settings')
+            row.label(text="")
+            if Btrace.settings_toggle:
+                box.prop(Btrace, "particle_step")
+                row = box.row()
+                row.prop(Btrace, 'particle_auto')
+                if not Btrace.particle_auto:
                     row = box.row(align=True)
-                    row.prop(bTrace, 'particle_f_start')
-                    row.prop(bTrace, 'particle_f_end')
-                if animate:
-                    # animation settings here
-                    box.label(text='Frame Animation Settings:')
-                    col = box.column(align=True)
-                    col.prop(bTrace, 'anim_auto')
-                    if not anim_auto:
-                        row = col.row(align=True)
-                        row.prop(bTrace,'anim_f_start')
-                        row.prop(bTrace,'anim_length')
-                    row = col.row(align=True)
-                    row.prop(bTrace,'anim_delay')
-                    row.prop(bTrace,'anim_f_fade')
+                    row.prop(Btrace, 'particle_f_start')
+                    row.prop(Btrace, 'particle_f_end')
+                curve_settings()  # Show Curve/material settings
+                add_grow()  # Grow settings here
 
-                    box.label(text='Additional Settings')
-                    row = box.row()
-                    row.prop(bTrace,'anim_tails')
-                    row.prop(bTrace,'anim_keepr')
-                
         #######################
-        #### Animate Curve ####
+        #### Grow Animation ####
         #######################
-        row = self.layout.row()
-        row.label(text="Curve Animation Tools")
-        
-        animation_settings = bTrace.animation_settings
-        settings_growCurve = bTrace.settings_growCurve
-        box = self.layout.box()
-        row = box.row()
-        GrowText="Show: Grow Curve Animation"
-        if animation_settings:
-            GrowText="Hide: Grow Curve Animation"
-        else:
-            GrowText="Show: Grow Curve Animation"
-        row.prop(bTrace, 'animation_settings', icon="META_BALL", text=GrowText)
-        if animation_settings:
+        if btracemenu.tool_growCurve:
+            row = layout.row()
+            row.label(text="  Curve Tool:", icon="OUTLINER_OB_CURVE")
+            box = self.layout.box()
             row = box.row()
             row.label(text="Grow Curve", icon="META_BALL")
             row.operator('curve.btgrow', text='Run!', icon='PLAY')
             row = box.row()
-            row.prop(bTrace, "settings_growCurve", icon='MODIFIER', text='Settings')
+            row.prop(Btrace, "settings_toggle", icon='MODIFIER', text='Settings')
             row.operator('object.btreset',  icon='KEY_DEHLT')
-            if settings_growCurve:
+            if Btrace.settings_toggle:
                 box.label(text='Frame Animation Settings:')
                 col = box.column(align=True)
-                col.prop(bTrace, 'anim_auto')
-                if not anim_auto:
+                col.prop(Btrace, 'anim_auto')
+                if not Btrace.anim_auto:
                     row = col.row(align=True)
-                    row.prop(bTrace,'anim_f_start')
-                    row.prop(bTrace,'anim_length')
+                    row.prop(Btrace, 'anim_f_start')
+                    row.prop(Btrace, 'anim_length')
                 row = col.row(align=True)
-                row.prop(bTrace,'anim_delay')
-                row.prop(bTrace,'anim_f_fade')
+                row.prop(Btrace, 'anim_delay')
+                row.prop(Btrace, 'anim_f_fade')
 
                 box.label(text='Additional Settings')
                 row = box.row()
-                row.prop(bTrace,'anim_tails')
-                row.prop(bTrace,'anim_keepr')
-                
+                row.prop(Btrace, 'anim_tails')
+                row.prop(Btrace, 'anim_keepr')
+
         #######################
         #### F-Curve Noise Curve ####
         #######################
-        tool_fcurve = bTrace.tool_fcurve
-        settings_fcurve = bTrace.settings_fcurve
-        box = self.layout.box()
-        row = box.row()
-        fcurveText="Show: F-Curve Noise"
-        if tool_fcurve:
-            fcurveText="Hide: F-Curve Noise"
-        else:
-            fcurveText="Show: F-Curve Noise"
-        row.prop(bTrace, "tool_fcurve", text=fcurveText, icon='RNDCURVE')
-        if tool_fcurve:
+        if btracemenu.tool_fcurve:
+            row = layout.row()
+            row.label(text="  Curve Tool:", icon="OUTLINER_OB_CURVE")
+            box = self.layout.box()
             row = box.row()
             row.label(text="F-Curve Noise", icon='RNDCURVE')
             row.operator("object.btfcnoise", icon='PLAY', text="Run!")
             row = box.row()
-            row.prop(bTrace, "settings_fcurve", icon='MODIFIER', text='Settings')
+            row.prop(Btrace, "settings_toggle", icon='MODIFIER', text='Settings')
             row.operator('object.btreset',  icon='KEY_DEHLT')
-            if settings_fcurve:
+            if Btrace.settings_toggle:
                 row = box.row(align=True)
-                row.prop(bTrace, "fcnoise_rot")
-                row.prop(bTrace, "fcnoise_loc")
-                row.prop(bTrace, "fcnoise_scale")
+                row.prop(Btrace, "fcnoise_rot")
+                row.prop(Btrace, "fcnoise_loc")
+                row.prop(Btrace, "fcnoise_scale")
                 col = box.column(align=True)
-                col.prop(bTrace, "fcnoise_amp")
-                col.prop(bTrace, "fcnoise_timescale")
-                box.prop(bTrace, "fcnoise_key")
+                col.prop(Btrace, "fcnoise_amp")
+                col.prop(Btrace, "fcnoise_timescale")
+                box.prop(Btrace, "fcnoise_key")
+
+        #######################
+        #### Color Blender ####
+        #######################
+        if btracemenu.tool_colorblender:
+            row = layout.row()
+            row.label(text="  Curve/Object Tool:", icon="OUTLINER_OB_CURVE")
+            box = self.layout.box()
+            row = box.row()
+            row.label(text="Color Blender", icon="COLOR")
+            row.operator("object.colorblender", icon='PLAY', text="Run!")
+            row = box.row()
+            row.operator("object.colorblenderclear", text="Reset Keyframes", icon="KEY_DEHLT")
+            row.prop(Btrace, 'mmSkip', text="Keyframe every")
+            color_blender()
+
 ###### END PANEL ##############
-###############################            
+###############################
 
 
 ################## ################## ################## ############
@@ -490,38 +614,37 @@ class addTracerObjectPanel(bpy.types.Panel):
 
 class OBJECT_OT_objecttrace(bpy.types.Operator):
     bl_idname = "object.btobjecttrace"
-    bl_label = "bTrace: Object Trace"
+    bl_label = "Btrace: Object Trace"
     bl_description = "Trace selected mesh object with a curve with the option to animate"
     bl_options = {'REGISTER', 'UNDO'}
-    
+
+
     @classmethod
     def poll(cls, context):
-        return (context.object and context.object.type in {'MESH','FONT'})
-    
+        return (context.object and context.object.type in {'MESH', 'FONT'})
+
     def invoke(self, context, event):
         import bpy
-        
+
         # Run through each selected object and convert to to a curved object
         brushObj = bpy.context.selected_objects
-        objectDupli = bpy.context.window_manager.curve_tracer.object_duplicate # Get duplicate check setting
-        convert_joinbefore = bpy.context.window_manager.curve_tracer.convert_joinbefore
-        animate = bpy.context.window_manager.curve_tracer.animate
+        Btrace = bpy.context.window_manager.curve_tracer
         # Duplicate Mesh
-        if objectDupli:
+        if Btrace.object_duplicate:
             bpy.ops.object.duplicate_move()
             brushObj = bpy.context.selected_objects
         # Join Mesh
-        if convert_joinbefore:
-            if len(brushObj) > 1: # Only run if multiple objects selected
+        if Btrace.convert_joinbefore:
+            if len(brushObj) > 1:  # Only run if multiple objects selected
                 bpy.ops.object.join()
                 brushObj = bpy.context.selected_objects
-        
+
         for i in brushObj:
             bpy.context.scene.objects.active = i
             if i and i.type != 'CURVE':
                 bpy.ops.object.btconvertcurve()
                 addtracemat(bpy.context.object.data)
-            if animate:
+            if Btrace.animate:
                 bpy.ops.curve.btgrow()
         return{"FINISHED"}
 
@@ -532,70 +655,63 @@ class OBJECT_OT_objecttrace(bpy.types.Operator):
 ## possible handle types: 'FREE' 'AUTO' 'VECTOR' 'ALIGNED'
 ################## ################## ################## ############
 
-
 class OBJECT_OT_objectconnect(bpy.types.Operator):
     bl_idname = "object.btobjectsconnect"
-    bl_label = "bTrace: Objects Connect"
+    bl_label = "Btrace: Objects Connect"
     bl_description = "Connect selected objects with a curve and add hooks to each node"
     bl_options = {'REGISTER', 'UNDO'}
-    
+
     @classmethod
     def poll(cls, context):
         return len(bpy.context.selected_objects) > 1
-    
+
     def invoke(self, context, event):
         import bpy, selection_utils
         list = []
-        bTrace = bpy.context.window_manager.curve_tracer
-        objectHandle = bTrace.curve_handle # Get Handle selection
-        if objectHandle == 'AUTOMATIC': # hackish because of naming conflict in api
-            objectHandle = 'AUTO'
-        objectrez = bTrace.curve_resolution # Get Bevel resolution 
-        objectdepth = bTrace.curve_depth # Get Bevel Depth
-        animate = bTrace.animate # add Grow Curve
-        respect_order = bTrace.respect_order # respect object selection order
-        connect_noise = bTrace.connect_noise 
-        # Check if bTrace group exists, if not create
+        Btrace = bpy.context.window_manager.curve_tracer
+        curve_handle = Btrace.curve_handle
+        if curve_handle == 'AUTOMATIC':  # hackish because of naming conflict in api
+            curve_handle = 'AUTO'
+        # Check if Btrace group exists, if not create
         bgroup = bpy.data.groups.keys()
-        if 'bTrace' not in bgroup:
-            bpy.ops.group.create(name="bTrace") 
+        if 'Btrace' not in bgroup:
+            bpy.ops.group.create(name="Btrace")
         #  check if noise
-        if connect_noise: 
+        if Btrace.connect_noise:
             bpy.ops.object.btfcnoise()
         # check if respect order is checked, create list of objects
-        if respect_order == True: 
+        if Btrace.respect_order == True:
             selobnames = selection_utils.selected
             obnames = []
             for ob in selobnames:
                 obnames.append(bpy.data.objects[ob])
         else:
-            obnames =  bpy.context.selected_objects # No selection order
+            obnames = bpy.context.selected_objects  # No selection order
 
-
-        for a in obnames:  
+        for a in obnames:
             list.append(a)
             a.select = False
 
         # trace the origins
-        tracer = bpy.data.curves.new('tracer','CURVE')
+        tracer = bpy.data.curves.new('tracer', 'CURVE')
         tracer.dimensions = '3D'
         spline = tracer.splines.new('BEZIER')
-        spline.bezier_points.add(len(list)-1)
-        curve = bpy.data.objects.new('curve',tracer)
+        spline.bezier_points.add(len(list) - 1)
+        curve = bpy.data.objects.new('curve', tracer)
         bpy.context.scene.objects.link(curve)
 
         # render ready curve
-        tracer.resolution_u = 64
-        tracer.bevel_resolution = objectrez # Set bevel resolution from Panel options
+        tracer.resolution_u = Btrace.curve_u
+        tracer.bevel_resolution = Btrace.curve_resolution  # Set bevel resolution from Panel options
         tracer.fill_mode = 'FULL'
-        tracer.bevel_depth = objectdepth # Set bevel depth from Panel options
+        tracer.bevel_depth = Btrace.curve_depth  # Set bevel depth from Panel options
 
         # move nodes to objects
         for i in range(len(list)):
             p = spline.bezier_points[i]
             p.co = list[i].location
-            p.handle_right_type=objectHandle
-            p.handle_left_type=objectHandle
+            p.handle_right_type = curve_handle
+            p.handle_left_type = curve_handle
 
         bpy.context.scene.objects.active = curve
         bpy.ops.object.mode_set(mode='OBJECT')
@@ -609,14 +725,14 @@ class OBJECT_OT_objectconnect(bpy.types.Operator):
             bpy.ops.object.mode_set(mode='OBJECT')
             curve.data.splines[0].bezier_points[i].select_control_point = False
             list[i].select = False
-        
+
         bpy.ops.object.select_all(action='DESELECT')
         curve.select = True # selected curve after it's created
         addtracemat(bpy.context.object.data) # Add material
-        if animate: # Add Curve Grow it?
+        if Btrace.animate: # Add Curve Grow it?
             bpy.ops.curve.btgrow()
-        bpy.ops.object.group_link(group="bTrace") # add to bTrace group
-        if bTrace.animate:
+        bpy.ops.object.group_link(group="Btrace") # add to Btrace group
+        if Btrace.animate:
             bpy.ops.curve.btgrow() # Add grow curve
         return{"FINISHED"}
 
@@ -626,75 +742,75 @@ class OBJECT_OT_objectconnect(bpy.types.Operator):
 ## creates a curve from each particle of a system
 ################## ################## ################## ############
 def  curvetracer(curvename, splinename):
-    bTrace = bpy.context.window_manager.curve_tracer
-    tracer = bpy.data.curves.new(splinename,'CURVE') 
+    Btrace = bpy.context.window_manager.curve_tracer
+    tracer = bpy.data.curves.new(splinename, 'CURVE')
     tracer.dimensions = '3D'
     curve = bpy.data.objects.new(curvename, tracer)
     bpy.context.scene.objects.link(curve)
-    addtracemat(tracer) #Add material
-    # tracer.materials.append(bpy.data.materials.get('TraceMat'))
-    try: tracer.fill_mode = 'FULL'
-    except: tracer.use_fill_front = tracer.use_fill_back = False
-    tracer.bevel_resolution = bTrace.curve_resolution
-    tracer.bevel_depth = bTrace.curve_depth
-    tracer.resolution_u = bTrace.curve_u
+    try:
+        tracer.fill_mode = 'FULL'
+    except:
+        tracer.use_fill_front = tracer.use_fill_back = False
+    tracer.bevel_resolution = Btrace.curve_resolution
+    tracer.bevel_depth = Btrace.curve_depth
+    tracer.resolution_u = Btrace.curve_u
     return tracer, curve
-    
+
 
 class OBJECT_OT_particletrace(bpy.types.Operator):
     bl_idname = "particles.particletrace"
-    bl_label = "bTrace: Particle Trace"
+    bl_label = "Btrace: Particle Trace"
     bl_description = "Creates a curve from each particle of a system. Keeping particle amount under 250 will make this run faster"
     bl_options = {'REGISTER', 'UNDO'}
-    
+
     @classmethod
     def poll(cls, context):
         return (bpy.context.object and bpy.context.object.particle_systems)
-    
+
     def execute(self, context):
-        bTrace = bpy.context.window_manager.curve_tracer
-        objectHandle = bTrace.curve_handle
-        stepSize = bTrace.particle_step    # step size in frames
-        curve_join = bTrace.curve_join # join curves after created
+        Btrace = bpy.context.window_manager.curve_tracer
+        particle_step = Btrace.particle_step    # step size in frames
         obj = bpy.context.object
         ps = obj.particle_systems.active
         curvelist = []
-        if objectHandle == 'AUTOMATIC': # hackish because of naming conflict in api
-            objectHandle = 'AUTO'
-        if objectHandle == 'FREE_ALIGN':
-            objectHandle = 'FREE'
-        
-        # Check if bTrace group exists, if not create
+        curve_handle = Btrace.curve_handle
+        if curve_handle == 'AUTOMATIC':  # hackish naming conflict
+            curve_handle = 'AUTO'
+        if curve_handle == 'FREE_ALIGN':  # hackish naming conflict
+            curve_handle = 'FREE'
+
+        # Check if Btrace group exists, if not create
         bgroup = bpy.data.groups.keys()
-        if 'bTrace' not in bgroup:
-            bpy.ops.group.create(name="bTrace") 
+        if 'Btrace' not in bgroup:
+            bpy.ops.group.create(name="Btrace")
 
-        if bTrace.curve_join:
+        if Btrace.curve_join:
             tracer = curvetracer('Tracer', 'Splines')
         for x in ps.particles:
-            if not bTrace.curve_join:
+            if not Btrace.curve_join:
                 tracer = curvetracer('Tracer.000', 'Spline.000')
             spline = tracer[0].splines.new('BEZIER')
-            spline.bezier_points.add((x.lifetime-1)//stepSize) #add point to spline based on step size
+            spline.bezier_points.add((x.lifetime - 1) // particle_step)  # add point to spline based on step size
             for t in list(range(int(x.lifetime))):
-                bpy.context.scene.frame_set(t+x.birth_time)
-                if not t%stepSize:
-                    p = spline.bezier_points[t//stepSize]
+                bpy.context.scene.frame_set(t + x.birth_time)
+                if not t % particle_step:
+                    p = spline.bezier_points[t // particle_step]
                     p.co = x.location
-                    p.handle_right_type = objectHandle
-                    p.handle_left_type = objectHandle
+                    p.handle_right_type = curve_handle
+                    p.handle_left_type = curve_handle
             particlecurve = tracer[1]
             curvelist.append(particlecurve)
         # add to group
         bpy.ops.object.select_all(action='DESELECT')
-        for curvename in curvelist:
-            curvename.select = True
-            bpy.context.scene.objects.active = curvename
-            bpy.ops.object.group_link(group="bTrace")
-            
-        if bTrace.animate:
-            bpy.ops.curve.btgrow() # Add grow curve
+        for curveobject in curvelist:
+            curveobject.select = True
+            bpy.context.scene.objects.active = curveobject
+            bpy.ops.object.group_link(group="Btrace")
+            addtracemat(curveobject.data)  # Add material
         
+        if Btrace.animate:
+            bpy.ops.curve.btgrow()  # Add grow curve
+
         return{"FINISHED"}
 
 
@@ -724,19 +840,14 @@ class OBJECT_OT_traceallparticles(bpy.types.Operator):
             self.report('INFO',"Grid distribution mode for particles not supported.")
             return{'FINISHED'}
         
-        bTrace = bpy.context.window_manager.curve_tracer
-        particleHandle = bTrace.curve_handle # Get Handle selection
-        particleSpline = bTrace.curve_spline # Get Spline selection  
-        stepSize = bTrace.particle_step    # step size in frames
-        particlerez = bTrace.curve_resolution # Get Bevel resolution 
-        particledepth = bTrace.curve_depth # Get Bevel Depth
-        particleauto = bTrace.particle_auto # Get Auto Time Range
-        particle_f_start = bTrace.particle_f_start # Get frame start
-        particle_f_end = bTrace.particle_f_end # Get frame end
-        if particleHandle == 'AUTOMATIC': # hackish because of naming conflict in api
-            particleHandle = 'AUTO'
-        if particleHandle == 'FREE_ALIGN':
-            particleHandle = 'FREE'        
+        Btrace = bpy.context.window_manager.curve_tracer
+        particle_f_start = Btrace.particle_f_start # Get frame start
+        particle_f_end = Btrace.particle_f_end # Get frame end
+        curve_handle = Btrace.curve_handle
+        if curve_handle == 'AUTOMATIC': # hackish because of naming conflict in api
+            curve_handle = 'AUTO'
+        if curve_handle == 'FREE_ALIGN':
+            curve_handle = 'FREE'        
         tracer = bpy.data.curves.new('Splines','CURVE') # define what kind of object to create
         curve = bpy.data.objects.new('Tracer',tracer) # Create new object with settings listed above
         bpy.context.scene.objects.link(curve) # Link newly created object to the scene
@@ -744,14 +855,12 @@ class OBJECT_OT_traceallparticles(bpy.types.Operator):
         spline.bezier_points.add(set.count-1)
 		
         tracer.dimensions = '3D'
-        tracer.resolution_u = 32
-        tracer.bevel_resolution = particlerez
+        tracer.resolution_u = Btrace.curve_u
+        tracer.bevel_resolution = Btrace.curve_resolution
         tracer.fill_mode = 'FULL'
-        tracer.bevel_depth = particledepth
-
-        addtracemat(tracer) #Add material
+        tracer.bevel_depth = Btrace.curve_depth
 
-        if particleauto:
+        if Btrace.particle_auto:
             f_start = int(set.frame_start)
             f_end = int(set.frame_end + set.lifetime)
         else:
@@ -759,12 +868,10 @@ class OBJECT_OT_traceallparticles(bpy.types.Operator):
                  particle_f_end = particle_f_start + 1
             f_start = particle_f_start
             f_end = particle_f_end
-        print ('range: ', f_start, '/', f_end)
 
         for bFrames in range(f_start, f_end):
             bpy.context.scene.frame_set(bFrames)
-            if not (bFrames-f_start) % stepSize:
-                print ('done frame: ',bFrames)
+            if not (bFrames-f_start) % Btrace.particle_step:
                 for bFrames in range(set.count):
                     if ps.particles[bFrames].alive_state != 'UNBORN': 
                         e = bFrames
@@ -773,16 +880,17 @@ class OBJECT_OT_traceallparticles(bpy.types.Operator):
                     bp.co = pt.location
                     #bp.handle_left = pt.location
                     #bp.handle_right = pt.location
-                    bp.handle_right_type = particleHandle
-                    bp.handle_left_type = particleHandle 
+                    bp.handle_right_type = curve_handle
+                    bp.handle_left_type = curve_handle 
                     bp.keyframe_insert('co')
                     bp.keyframe_insert('handle_left')
                     bp.keyframe_insert('handle_right')
         # Select new curve
         bpy.ops.object.select_all(action='DESELECT')
-        curve .select = True
+        curve.select = True
         bpy.context.scene.objects.active = curve
-        if bTrace.animate:
+        addtracemat(curve.data) #Add material
+        if Btrace.animate:
             bpy.ops.curve.btgrow()
         return{'FINISHED'}
 
@@ -797,21 +905,33 @@ class OBJECT_OT_writing(bpy.types.Operator):
     bl_description = 'Use Grease Pencil to write and convert to curves'
     bl_options = {'REGISTER', 'UNDO'}
 
-    @classmethod  ### Removed so panel still draws if nothing is selected
-    def poll(cls, context):
-        return (context.scene.grease_pencil != None)
+    # @classmethod  ### Removed so panel still draws if nothing is selected
+    # def poll(cls, context):
+    #     return (context.scene.grease_pencil or context.object.grease_pencil != None)
 
     def execute(self, context):
-        bTrace, obj = bpy.context.window_manager.curve_tracer, bpy.context.object
-        animate = bTrace.animate
+        Btrace = bpy.context.window_manager.curve_tracer
+        obj = bpy.context.object
         gactive = bpy.context.active_object # set selected object before convert
         bpy.ops.gpencil.convert(type='CURVE')
         gactiveCurve = bpy.context.active_object # get curve after convert
+        # render ready curve
+        gactiveCurve.data.resolution_u = Btrace.curve_u
+        gactiveCurve.data.bevel_resolution = Btrace.curve_resolution  # Set bevel resolution from Panel options
+        gactiveCurve.data.fill_mode = 'FULL'
+        gactiveCurve.data.bevel_depth = Btrace.curve_depth  # Set bevel depth from Panel options
+
         writeObj = bpy.context.selected_objects
-        for i in writeObj:
-            bpy.context.scene.objects.active = i
-            bpy.ops.curve.btgrow()
-            addtracemat(bpy.context.object.data) #Add material
+        if Btrace.animate:
+            for i in writeObj:
+                bpy.context.scene.objects.active = i
+                bpy.ops.curve.btgrow()
+                addtracemat(bpy.context.object.data) #Add material
+        else:
+            for i in writeObj:
+                bpy.context.scene.objects.active = i
+                addtracemat(bpy.context.object.data) #Add material
+
         # Delete grease pencil strokes
         bpy.context.scene.objects.active = gactive
         bpy.ops.gpencil.data_unlink()
@@ -819,7 +939,7 @@ class OBJECT_OT_writing(bpy.types.Operator):
         # Smooth object
         bpy.ops.object.shade_smooth()
         # Return to first frame
-        bpy.context.scene.frame_set(bTrace.anim_f_start)
+        bpy.context.scene.frame_set(Btrace.anim_f_start)
         
         return{'FINISHED'}
 
@@ -831,7 +951,7 @@ class OBJECT_OT_writing(bpy.types.Operator):
 
 class OBJECT_OT_convertcurve(bpy.types.Operator):
     bl_idname = "object.btconvertcurve"
-    bl_label = "bTrace: Create Curve"
+    bl_label = "Btrace: Create Curve"
     bl_description = "Convert mesh to curve using either Continuous, All Edges, or Sharp Edges"
     bl_options = {'REGISTER', 'UNDO'}
         
@@ -839,18 +959,7 @@ class OBJECT_OT_convertcurve(bpy.types.Operator):
         import bpy, random, mathutils
         from mathutils import Vector
 
-        bTrace = bpy.context.window_manager.curve_tracer
-        distort_modscale = bTrace.distort_modscale # add a scale to the modular random 
-        distort_curve = bTrace.distort_curve    # modulate the resulting curve
-        objectHandle = bTrace.curve_handle # Get Handle selection
-        objectSpline = bTrace.curve_spline # Get Spline selection
-        objectDupli = bTrace.object_duplicate # Get duplicate check setting
-        objectrez = bTrace.curve_resolution # Get Bevel resolution 
-        objectdepth = bTrace.curve_depth # Get Bevel Depth
-        objectU = bTrace.curve_u # Get Bevel Depth
-        objectnoise = bTrace.distort_noise # Get Bevel Depth
-        convert_joinbefore = bTrace.convert_joinbefore 
-        convert_edgetype = bTrace.convert_edgetype
+        Btrace = bpy.context.window_manager.curve_tracer
         traceobjects = bpy.context.selected_objects # create a list with all the selected objects
 
         obj = bpy.context.object
@@ -864,12 +973,12 @@ class OBJECT_OT_convertcurve(bpy.types.Operator):
         # make a continuous edge through all vertices
         if obj.type == 'MESH':
             # Add noise to mesh
-            if distort_curve:
+            if Btrace.distort_curve:
                 for v in obj.data.vertices:
                     for u in range(3):
-                        v.co[u] += objectnoise*(random.uniform(-1,1))
+                        v.co[u] += Btrace.distort_noise * (random.uniform(-1,1))
 
-            if convert_edgetype == 'CONTI':
+            if Btrace.convert_edgetype == 'CONTI':
                 ## Start Continuous edge
                 bpy.ops.object.mode_set(mode='EDIT')
                 bpy.ops.mesh.select_all(action='SELECT')
@@ -893,15 +1002,16 @@ class OBJECT_OT_convertcurve(bpy.types.Operator):
                     bpy.ops.object.mode_set(mode='EDIT')
                     bpy.context.tool_settings.mesh_select_mode = [True, False, False]
                     bpy.ops.mesh.edge_face_add()
+                    bpy.ops.mesh.select_all(action='DESELECT')
                     bpy.ops.object.mode_set(mode='OBJECT')
-                    verts[p1].select = verts[p2].select = False
+                    # verts[p1].select = verts[p2].select = False #Doesn't work after Bmesh merge
                     li.remove(p2)  # remove item from list.
                     p1 = p2
                 # Convert edges to curve
                 bpy.ops.object.mode_set(mode='OBJECT')
                 bpy.ops.object.convert(target='CURVE') 
             
-            if convert_edgetype == 'EDGEALL':
+            if Btrace.convert_edgetype == 'EDGEALL':
                 ## Start All edges
                 bpy.ops.object.mode_set(mode='EDIT')
                 bpy.ops.mesh.select_all(action='SELECT')
@@ -909,26 +1019,26 @@ class OBJECT_OT_convertcurve(bpy.types.Operator):
                 bpy.ops.object.mode_set()
                 bpy.ops.object.convert(target='CURVE')
                 for sp in obj.data.splines:
-                    sp.type = objectSpline
+                    sp.type = Btrace.curve_spline
 
         obj = bpy.context.object
         # Set spline type to custom property in panel
         bpy.ops.object.editmode_toggle()
-        bpy.ops.curve.spline_type_set(type=objectSpline) 
+        bpy.ops.curve.spline_type_set(type=Btrace.curve_spline) 
         # Set handle type to custom property in panel
-        bpy.ops.curve.handle_type_set(type=objectHandle) 
+        bpy.ops.curve.handle_type_set(type=Btrace.curve_handle) 
         bpy.ops.object.editmode_toggle()
         obj.data.fill_mode = 'FULL'
         # Set resolution to custom property in panel
-        obj.data.bevel_resolution = objectrez 
-        obj.data.resolution_u = objectU 
+        obj.data.bevel_resolution = Btrace.curve_resolution 
+        obj.data.resolution_u = Btrace.curve_u 
         # Set depth to custom property in panel
-        obj.data.bevel_depth = objectdepth 
+        obj.data.bevel_depth = Btrace.curve_depth 
         # Smooth object
         bpy.ops.object.shade_smooth()
         # Modulate curve radius and add distortion
-        if distort_curve: 
-            scale = distort_modscale
+        if Btrace.distort_curve: 
+            scale = Btrace.distort_modscale
             if scale == 0:
                 return{"FINISHED"}
             for u in obj.data.splines:
@@ -937,18 +1047,347 @@ class OBJECT_OT_convertcurve(bpy.types.Operator):
         return{"FINISHED"}
 
 
+################## ################## ################## ############
+## Mesh Follow, trace vertex or faces
+## Create curve at center of selection item, extruded along animation
+## Needs to be animated mesh!!!
+################## ################## ################## ############
+
+class OBJECT_OT_meshfollow(bpy.types.Operator):
+    bl_idname = "object.btmeshfollow"
+    bl_label = "Btrace: Vertex Trace"
+    bl_description = "Trace Vertex or Face on an animated mesh"
+    bl_options = {'REGISTER', 'UNDO'}
+        
+    
+    @classmethod
+    def poll(cls, context):
+        return (context.object and context.object.type in {'MESH'})
+
+    def execute(self, context):
+        import bpy, random
+        from mathutils import Vector
+
+        Btrace = bpy.context.window_manager.curve_tracer
+        distort_curve = Btrace.distort_curve    # modulate the resulting curve
+        stepsize = Btrace.particle_step
+        traceobjects = bpy.context.selected_objects  # create a list with all the selected objects
+
+        obj = bpy.context.object
+        scn = bpy.context.scene
+        meshdata = obj.data
+        cursor = bpy.context.scene.cursor_location.copy()  # Store the location to restore at end of script
+        drawmethod = Btrace.fol_mesh_type  # Draw from Edges, Verts, or Faces
+        if drawmethod == 'VERTS':
+            meshobjs = obj.data.vertices
+        if drawmethod == 'FACES':
+            meshobjs = obj.data.polygons  # untested
+        if drawmethod == 'EDGES':
+            meshobjs = obj.data.edges  # untested
+
+        # Frame properties
+        start_frame, end_frame = Btrace.fol_start_frame, Btrace.fol_end_frame
+        if start_frame > end_frame:  # Make sure the math works
+            startframe = end_frame - 5  # if start past end, goto (end - 5)
+        frames = int((end_frame - start_frame) / stepsize)
+
+        def getsel_option():  # Get selection objects.
+            sel = []
+            seloption, fol_mesh_type = Btrace.fol_sel_option, Btrace.fol_mesh_type  # options = 'random', 'custom', 'all'
+            if fol_mesh_type == 'OBJECT':
+                pass
+            else:
+                if seloption == 'CUSTOM':
+                    for i in meshobjs:
+                        if i.select == True:
+                            sel.append(i.index)
+                if seloption == 'RANDOM':
+                    for i in list(meshobjs):
+                        sel.append(i.index)
+                    finalsel = int(len(sel) * Btrace.fol_perc_verts)
+                    remove = len(sel) - finalsel
+                    for i in range(remove):
+                        sel.pop(random.randint(0, len(sel) - 1))
+                if seloption == 'ALL':
+                    for i in list(meshobjs):
+                        sel.append(i.index)
+
+            return sel
+
+        def get_coord(objindex):
+            obj_co = []  # list of vector coordinates to use
+            frame_x = start_frame
+            for i in range(frames):  # create frame numbers list
+                scn.frame_set(frame_x)
+                if drawmethod != 'OBJECT':
+                    followed_item = meshobjs[objindex]
+                    if drawmethod == 'VERTS':
+                        g_co = obj.matrix_local * followed_item.co  # find Vert vector
+
+                    if drawmethod == 'FACES':
+                        g_co = obj.matrix_local * followed_item.normal  # find Face vector
+
+                    if drawmethod == 'EDGES':
+                        v1 = followed_item.vertices[0]
+                        v2 = followed_item.vertices[1]
+                        co1 = bpy.context.object.data.vertices[v1]
+                        co2 = bpy.context.object.data.vertices[v2]
+                        localcenter = co1.co.lerp(co2.co, 0.5)
+                        g_co = obj.matrix_world * localcenter
+
+                if drawmethod == 'OBJECT':
+                    g_co = objindex.location.copy()
+
+                obj_co.append(g_co)
+                frame_x = frame_x + stepsize
+
+            scn.frame_set(start_frame)
+            return obj_co
+
+        def make_curve(co_list):
+            Btrace = bpy.context.window_manager.curve_tracer
+            tracer = bpy.data.curves.new('tracer','CURVE')
+            tracer.dimensions = '3D'
+            spline = tracer.splines.new('BEZIER')
+            spline.bezier_points.add(len(co_list)-  1)
+            curve = bpy.data.objects.new('curve',tracer)
+            scn.objects.link(curve)
+            curvelist.append(curve)
+            # render ready curve
+            tracer.resolution_u = Btrace.curve_u
+            tracer.bevel_resolution = Btrace.curve_resolution  # Set bevel resolution from Panel options
+            tracer.fill_mode = 'FULL'
+            tracer.bevel_depth = Btrace.curve_depth  # Set bevel depth from Panel options
+            curve_handle = Btrace.curve_handle
+            if curve_handle == 'AUTOMATIC': # hackish AUTOMATIC doesn't work here
+                curve_handle = 'AUTO'
+
+            # move bezier points to objects
+            for i in range(len(co_list)):
+                p = spline.bezier_points[i]
+                p.co = co_list[i]
+                p.handle_right_type = curve_handle
+                p.handle_left_type = curve_handle
+            return curve
+
+        # Run methods
+        # Check if Btrace group exists, if not create
+        bgroup = bpy.data.groups.keys()
+        if 'Btrace' not in bgroup:
+            bpy.ops.group.create(name="Btrace") 
+
+        Btrace = bpy.context.window_manager.curve_tracer
+        sel = getsel_option()  # Get selection
+        curvelist = []  # list to use for grow curve
+        
+        if Btrace.fol_mesh_type == 'OBJECT':
+            vector_list = get_coord(obj)
+            curvelist.append(make_curve(vector_list))
+        else:
+            for i in sel:
+                vector_list = get_coord(i)
+                curvelist.append(make_curve(vector_list))
+        # Select new curves and add to group
+        bpy.ops.object.select_all(action='DESELECT')
+        for curveobject in curvelist:
+            if curveobject.type == 'CURVE':
+                curveobject.select = True
+                bpy.context.scene.objects.active = curveobject
+                bpy.ops.object.group_link(group="Btrace")
+                addtracemat(curveobject.data)
+                curveobject.select = False
+
+        if Btrace.animate:  # Add grow curve
+            for curveobject in curvelist:
+                curveobject.select = True
+            bpy.ops.curve.btgrow()
+            for curveobject in curvelist:
+                curveobject.select = False
+
+        obj.select = False  # Deselect original object
+        return {'FINISHED'}
+
 ###################################################################
 #### Add Tracer Material
-###################################################################        
+###################################################################
 
 def addtracemat(matobj):
-    if 'TraceMat' not in bpy.data.materials:
-        TraceMat = bpy.data.materials.new('TraceMat')
-        TraceMat.diffuse_color = [0,.5,1]
-        TraceMat.specular_intensity = 0.5
-    matobj.materials.append(bpy.data.materials.get('TraceMat'))
+    # Need to add cycles or BI render material options
+    # if engine == 'CYCLES':
+        # Add cycles mat
+    # if engine == 'BLENDER_RENDER':
+        # Add blender interal mat
+    matslots = bpy.context.object.data.materials.items()  # Check if a material exists, skip if it does
+    if len(matslots) < 1:  # Make sure there is only one material slot
+        engine = bpy.context.scene.render.engine
+        Btrace = bpy.context.window_manager.curve_tracer
+        if not Btrace.mat_run_color_blender:  # Check if color blender is to be run
+            if Btrace.trace_mat_random:  # Create Random color for each item
+                # Use random color from chosen palette, assign color lists for each palette
+                import random
+                brightColors  = [Btrace.brightColor1, Btrace.brightColor2, Btrace.brightColor3, Btrace.brightColor4]
+                bwColors = [Btrace.bwColor1, Btrace.bwColor2]
+                customColors = [Btrace.mmColor1, Btrace.mmColor2, Btrace.mmColor3, Btrace.mmColor4, Btrace.mmColor5, Btrace.mmColor6, Btrace.mmColor7, Btrace.mmColor8]
+                earthColors = [Btrace.earthColor1, Btrace.earthColor2, Btrace.earthColor3, Btrace.earthColor4, Btrace.earthColor5]
+                greenblueColors = [Btrace.greenblueColor1, Btrace.greenblueColor2, Btrace.greenblueColor3]
+                if Btrace.mmColors == 'BRIGHT':
+                    #print(random.randint(0, len(brightColors) - 1))
+                    mat_color = brightColors[random.randint(0, len(brightColors) - 1)]
+                if Btrace.mmColors == 'BW':
+                    mat_color = bwColors[random.randint(0, len(bwColors) - 1)]
+                if Btrace.mmColors == 'CUSTOM':
+                    mat_color = customColors[random.randint(0, len(customColors) - 1)]
+                if Btrace.mmColors == 'EARTH':
+                    mat_color = earthColors[random.randint(0, len(earthColors) - 1)]
+                if Btrace.mmColors == 'GREENBLUE':
+                    mat_color = greenblueColors[random.randint(0, len(greenblueColors) - 1)]
+                if Btrace.mmColors == 'RANDOM':
+                    mat_color = (random.random(), random.random(), random.random())
+            else:  # Choose Single color
+                mat_color = Btrace.trace_mat_color
+            # mat_color = Btrace.trace_mat_color
+            TraceMat = bpy.data.materials.new('TraceMat')
+            TraceMat.diffuse_color = mat_color
+            TraceMat.specular_intensity = 0.5
+            matobj.materials.append(bpy.data.materials.get(TraceMat.name))
+
+        else:  # Run color blender operator
+            bpy.ops.object.colorblender()
+
     return {'FINISHED'}
+
+###################################################################
+#### Add Color Blender Material
+###################################################################
+
+# This is the magical material changer!
+class OBJECT_OT_materialChango(bpy.types.Operator):
+    bl_idname = 'object.colorblender'
+    bl_label = 'Color Blender'
+    bl_options = {'REGISTER', 'UNDO'}
+
+    def execute(self, context):
+
+        import bpy, random
+        Btrace = bpy.context.window_manager.curve_tracer  # properties panel
+        colorObjects = bpy.context.selected_objects
+
+        # Set color lists
+        brightColors  = [Btrace.brightColor1, Btrace.brightColor2, Btrace.brightColor3, Btrace.brightColor4]
+        bwColors = [Btrace.bwColor1, Btrace.bwColor2]
+        customColors = [Btrace.mmColor1, Btrace.mmColor2, Btrace.mmColor3, Btrace.mmColor4, Btrace.mmColor5, Btrace.mmColor6, Btrace.mmColor7, Btrace.mmColor8]
+        earthColors = [Btrace.earthColor1, Btrace.earthColor2, Btrace.earthColor3, Btrace.earthColor4, Btrace.earthColor5]
+        greenblueColors = [Btrace.greenblueColor1, Btrace.greenblueColor2, Btrace.greenblueColor3]
+
+        colorList = Btrace.mmColors
+
+        # Go through each selected object and run the operator
+        for i in colorObjects:
+            theObj = i
+            # Check to see if object has materials
+            checkMaterials = len(theObj.data.materials)
+            if checkMaterials == 0:
+                # Add a material
+                materialName = "colorblendMaterial"
+                madMat = bpy.data.materials.new(materialName)
+                theObj.data.materials.append(madMat)
+            else:                
+                pass # pass since we have what we need
+                
+            # assign the first material of the object to "mat"
+            mat = theObj.data.materials[0] 
+
+            # Numbers of frames to skip between keyframes
+            skip = Btrace.mmSkip
+
+            # Random material function
+            def colorblenderRandom():
+                for crazyNumber in range(3):
+                    mat.diffuse_color[crazyNumber] = random.random()
+            
+            def colorblenderCustom():
+                mat.diffuse_color = random.choice(customColors)
+                
+            # Black and white color        
+            def colorblenderBW():
+                mat.diffuse_color = random.choice(bwColors)
+            
+            # Bright colors
+            def colorblenderBright():
+                mat.diffuse_color = random.choice(brightColors)
+                
+            # Earth Tones
+            def colorblenderEarth():
+                mat.diffuse_color = random.choice(earthColors)
+                
+            # Green to Blue Tones
+            def colorblenderGreenBlue():
+                mat.diffuse_color = random.choice(greenblueColors)
+             
+            # define frame start/end variables
+            scn = bpy.context.scene       
+            start = scn.frame_start
+            end = scn.frame_end           
+            # Go to each frame in iteration and add material
+            while start<=(end+(skip-1)):
+               
+                bpy.ops.anim.change_frame(frame=start)
+                
+                # Check what colors setting is checked and run the appropriate function
+                if Btrace.mmColors=='RANDOM':
+                    colorblenderRandom()
+                elif Btrace.mmColors=='CUSTOM':
+                    colorblenderCustom()
+                elif Btrace.mmColors=='BW':
+                    colorblenderBW()
+                elif Btrace.mmColors=='BRIGHT':
+                    colorblenderBright()
+                elif Btrace.mmColors=='EARTH':
+                    colorblenderEarth()
+                elif Btrace.mmColors=='GREENBLUE':
+                    colorblenderGreenBlue()
+                else:
+                    pass
+                
+                # Add keyframe to material
+                mat.keyframe_insert('diffuse_color')
+                
+                # Increase frame number
+                start += skip
+        return{'FINISHED'}
+    
+###### This clears the keyframes ######
+class OBJECT_OT_clearColorblender(bpy.types.Operator):
+    bl_idname = 'object.colorblenderclear'
+    bl_label = 'Clear colorblendness'
+    bl_options = {'REGISTER', 'UNDO'}
+    
+    def invoke(self, context, event):
         
+        import bpy, random
+        mcolorblend = context.window_manager.colorblender_operator # properties panel
+        colorObjects = bpy.context.selected_objects
+        
+        # Go through each selected object and run the operator
+        for i in colorObjects:
+            theObj = i    
+            # assign the first material of the object to "mat"
+            matCl = theObj.data.materials[0] 
+            
+            # define frame start/end variables
+            scn = bpy.context.scene       
+            start = scn.frame_start
+            end = scn.frame_end
+
+            # Remove all keyframes from diffuse_color, super sloppy need to find better way
+            while start <= (end * 2):
+                bpy.ops.anim.change_frame(frame=start)
+                matCl.keyframe_delete('diffuse_color')
+                start += 1
+            
+        return{'FINISHED'}
+
+
 ################## ################## ################## ############
 ## F-Curve Noise
 ## will add noise modifiers to each selected object f-curves
@@ -958,26 +1397,26 @@ def addtracemat(matobj):
 
 class OBJECT_OT_fcnoise(bpy.types.Operator):
     bl_idname = "object.btfcnoise"
-    bl_label = "bTrace: F-curve Noise"
+    bl_label = "Btrace: F-curve Noise"
     bl_options = {'REGISTER', 'UNDO'}
     
     def execute(self, context):
         import bpy, random
         
-        bTrace = bpy.context.window_manager.curve_tracer
-        amp = bTrace.fcnoise_amp
-        timescale = bTrace.fcnoise_timescale
-        addkeyframe = bTrace.fcnoise_key
+        Btrace = bpy.context.window_manager.curve_tracer
+        amp = Btrace.fcnoise_amp
+        timescale = Btrace.fcnoise_timescale
+        addkeyframe = Btrace.fcnoise_key
         
         # This sets properties for Loc, Rot and Scale if they're checked in the Tools window
         noise_rot = 'rotation'
         noise_loc = 'location'
         noise_scale = 'scale'
-        if not bTrace.fcnoise_rot:
+        if not Btrace.fcnoise_rot:
             noise_rot = 'none'
-        if not bTrace.fcnoise_loc:
+        if not Btrace.fcnoise_loc:
             noise_loc = 'none'
-        if not bTrace.fcnoise_scale:
+        if not Btrace.fcnoise_scale:
             noise_scale = 'none'
             
         type = noise_loc, noise_rot, noise_scale # Add settings from panel for type of keyframes
@@ -1017,16 +1456,19 @@ class OBJECT_OT_curvegrow(bpy.types.Operator):
         return (context.object and context.object.type in {'CURVE'})
     
     def execute(self, context):
-        bTrace = bpy.context.window_manager.curve_tracer
-        anim_f_start, anim_length, anim_auto = bTrace.anim_f_start, bTrace.anim_length, bTrace.anim_auto
-        curve_resolution, curve_depth = bTrace.curve_resolution, bTrace.curve_depth
+        Btrace = bpy.context.window_manager.curve_tracer
+        anim_f_start, anim_length, anim_auto = Btrace.anim_f_start, Btrace.anim_length, Btrace.anim_auto
+        curve_resolution, curve_depth = Btrace.curve_resolution, Btrace.curve_depth
         # make the curve visible
         objs = bpy.context.selected_objects
         for i in objs: # Execute on multiple selected objects
             bpy.context.scene.objects.active = i
             obj = bpy.context.active_object
-            try: obj.data.fill_mode = 'FULL'
-            except: obj.data.use_fill_front = obj.data.use_fill_back = False
+            try:
+                obj.data.fill_mode = 'FULL'
+            except:
+                obj.data.dimensions = '3D'
+                obj.data.fill_mode = 'FULL'
             if not obj.data.bevel_resolution:
                 obj.data.bevel_resolution = curve_resolution
             if not obj.data.bevel_depth:
@@ -1042,10 +1484,10 @@ class OBJECT_OT_curvegrow(bpy.types.Operator):
             for sp in obj.data.splines:
                 sp.radius_interpolation = 'BSPLINE'
                 po = [p for p in sp.points] + [p for p in sp.bezier_points]
-                if not bTrace.anim_keepr:
-                    for p in po: 
+                if not Btrace.anim_keepr:
+                    for p in po:
                         p.radius = 1
-                if bTrace.anim_tails and not sp.use_cyclic_u:
+                if Btrace.anim_tails and not sp.use_cyclic_u:
                     po[0].radius = po[-1].radius = 0
                     po[1].radius = po[-2].radius = .65
                 ra = [p.radius for p in po]
@@ -1056,15 +1498,15 @@ class OBJECT_OT_curvegrow(bpy.types.Operator):
                     po[i].keyframe_insert('radius', frame=actual)
                     actual += step
                     po[i].radius = ra[i]
-                    po[i].keyframe_insert('radius', frame=(actual + bTrace.anim_delay))
+                    po[i].keyframe_insert('radius', frame=(actual + Btrace.anim_delay))
 
-                    if bTrace.anim_f_fade:
+                    if Btrace.anim_f_fade:
                         po[i].radius = ra[i]
-                        po[i].keyframe_insert('radius', frame=(actual + bTrace.anim_f_fade - step))
+                        po[i].keyframe_insert('radius', frame=(actual + Btrace.anim_f_fade - step))
                         po[i].radius = 0
-                        po[i].keyframe_insert('radius', frame=(actual + bTrace.anim_delay + bTrace.anim_f_fade))
+                        po[i].keyframe_insert('radius', frame=(actual + Btrace.anim_delay + Btrace.anim_f_fade))
 
-            bpy.context.scene.frame_set(bTrace.anim_f_start)
+            bpy.context.scene.frame_set(Btrace.anim_f_start)
         return{'FINISHED'}
 
 ################## ################## ################## ############
@@ -1090,7 +1532,9 @@ class OBJECT_OT_reset(bpy.types.Operator):
         return{'FINISHED'}
 
 ### Define Classes to register
-classes = [TracerProperties,
+classes = [
+    TracerProperties,
+    TracerPropertiesMenu,
     addTracerObjectPanel,
     OBJECT_OT_convertcurve,
     OBJECT_OT_objecttrace,
@@ -1100,12 +1544,18 @@ classes = [TracerProperties,
     OBJECT_OT_traceallparticles,
     OBJECT_OT_curvegrow,
     OBJECT_OT_reset,
-    OBJECT_OT_fcnoise]
+    OBJECT_OT_fcnoise,
+    OBJECT_OT_meshfollow,
+    OBJECT_OT_materialChango,
+    OBJECT_OT_clearColorblender
+    ]
 
 def register():
     for c in classes:
         bpy.utils.register_class(c)
     bpy.types.WindowManager.curve_tracer = bpy.props.PointerProperty(type=TracerProperties)
+    bpy.types.WindowManager.btrace_menu = bpy.props.PointerProperty(type=TracerPropertiesMenu, update=deselect_others)
+
 def unregister():
     for c in classes:
         bpy.utils.unregister_class(c)
diff --git a/release/scripts/addons_contrib/cmu_mocap_browser/__init__.py b/release/scripts/addons_contrib/cmu_mocap_browser/__init__.py
index 6011725..b586dc7 100644
--- a/release/scripts/addons_contrib/cmu_mocap_browser/__init__.py
+++ b/release/scripts/addons_contrib/cmu_mocap_browser/__init__.py
@@ -225,7 +225,7 @@ class CMUMocapDownloadImport(bpy.types.Operator):
                 bpy.ops.import_anim.asf(
                     filepath=self.local_file,
                     from_inches=True,
-                    rotX=True, rotZ=True,
+                    use_rot_x=True, use_rot_z=True,
                     armature_name=cml.subject_import_name)
             elif self.local_file.endswith("amc"):
                 ob = bpy.context.active_object
diff --git a/release/scripts/addons_contrib/curve_tools.py b/release/scripts/addons_contrib/curve_tools.py
index c578065..23c02e5 100644
--- a/release/scripts/addons_contrib/curve_tools.py
+++ b/release/scripts/addons_contrib/curve_tools.py
@@ -23,7 +23,7 @@ bl_info = {
     "blender": (2, 5, 9),
     "location": "Properties > Object data",
     "description": "Creates driven Lofts or Birails between curves",
-    "warning": "",
+    "warning": "may be buggy or incomplete",
     "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
         "Scripts/Curve/Curve_Tools",
     "tracker_url": "https://projects.blender.org/tracker/index.php?"\
diff --git a/release/scripts/addons_contrib/geodesic_domes/vefm_259.py b/release/scripts/addons_contrib/geodesic_domes/vefm_259.py
index f15f10b..ab79070 100644
--- a/release/scripts/addons_contrib/geodesic_domes/vefm_259.py
+++ b/release/scripts/addons_contrib/geodesic_domes/vefm_259.py
@@ -11,7 +11,8 @@ try:
 except:
     pass    
 
-from add_utils import AddObjectHelper, add_object_data
+from bpy_extras.object_utils import AddObjectHelper, object_data_add
+
 from collections import Counter
 
 '''PKHG not needed?
@@ -41,8 +42,8 @@ def vefm_add_object(selfobj):
     m = bpy.data.meshes.new(name= selfobj.name)
     m.from_pydata(v, e, f )
     # useful for development when the mesh may be invalid.
-    m.validate(verbose = False)
-    add_object_data(bpy.context, m, operator = None)    
+#PKHG not needed, as ideasman_42 says    m.validate(verbose = False)
+    object_data_add(bpy.context, m, operator = None)
 #???ERROR PKHG in AddSelf    setMaterial(bpy.context.active_object,pkhg_red_color)
 
 #extra test phase
@@ -920,8 +921,8 @@ class importmesh(mesh):
             newedge = edge(tmp[0],tmp[1])
             newedge.index = e.index
             self.edges.append(newedge)            
-#PKHG faces
-        for f in impmesh.data.faces:
+#PKHG faces with out bmesh replace next line polygons by faces
+        for f in impmesh.data.polygons:
             temp=[]
             for vert in f.vertices:  #PKHG a list! of indices 
                 a = self.verts[vert] #PKHG verts contains already vertex objects
diff --git a/release/scripts/addons_contrib/io_directx_bel/bel/uv.py b/release/scripts/addons_contrib/io_directx_bel/bel/uv.py
index 807ba95..ef85b76 100644
--- a/release/scripts/addons_contrib/io_directx_bel/bel/uv.py
+++ b/release/scripts/addons_contrib/io_directx_bel/bel/uv.py
@@ -78,4 +78,4 @@ def asVertsLocation(verts2d, idFaces) :
     conv1 = uvBlender.extend
     for f in idFaces : conv0([verts2d[vi] for vi in f])
     for f in coFaces : conv1(f)
-    return uvBlender
\ No newline at end of file
+    return uvBlender
diff --git a/release/scripts/addons_contrib/io_directx_bel/import_x.py b/release/scripts/addons_contrib/io_directx_bel/import_x.py
index 24649dc..00e8a72 100644
--- a/release/scripts/addons_contrib/io_directx_bel/import_x.py
+++ b/release/scripts/addons_contrib/io_directx_bel/import_x.py
@@ -973,4 +973,4 @@ BINARY FORMAT
 
 
         return {'FINISHED'}
-        
\ No newline at end of file
+        
diff --git a/release/scripts/addons_contrib/io_export_marmalade.py b/release/scripts/addons_contrib/io_export_marmalade.py
new file mode 100644
index 0000000..1641677
--- /dev/null
+++ b/release/scripts/addons_contrib/io_export_marmalade.py
@@ -0,0 +1,1479 @@
+# ***** 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 *****
+
+# Marmalade SDK is not responsible in any case of the following code.
+# This Blender add-on is freely shared for the Blender and Marmalade user communities.
+
+
+bl_info = {
+    "name": "Marmalade Cross-platform Apps (.group)",
+    "author": "Benoit Muller",
+    "version": (0, 6, 1),
+    "blender": (2, 6, 3),
+    "location": "File > Export > Marmalade cross-platform Apps (.group)",
+    "description": "Export Marmalade Format files (.group)",
+    "warning": "",
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"\
+        "Scripts/Import-Export/Marmalade_Exporter",
+    "tracker_url": "https://projects.blender.org/tracker/index.php?"\
+        "",
+    "category": "Import-Export"}
+
+import os
+import shutil
+from math import radians
+
+import bpy
+from mathutils import Matrix
+
+import mathutils
+import math
+
+import datetime
+
+import subprocess
+
+
+#Container for the exporter settings
+class MarmaladeExporterSettings:
+
+    def __init__(self,
+                 context,
+                 FilePath,
+                 CoordinateSystem=1,
+                 FlipNormals=False,
+                 ApplyModifiers=False,
+                 Scale=100,
+                 AnimFPS=30,
+                 ExportVertexColors=True,
+                 ExportMaterialColors=True,
+                 ExportTextures=True,
+                 CopyTextureFiles=True,
+                 ExportArmatures=False,
+                 ExportAnimationFrames=0,
+                 ExportAnimationActions=0,
+                 ExportMode=1,
+                 MergeModes=0,
+                 Verbose=False):
+        self.context = context
+        self.FilePath = FilePath
+        self.CoordinateSystem = int(CoordinateSystem)
+        self.FlipNormals = FlipNormals
+        self.ApplyModifiers = ApplyModifiers
+        self.Scale = Scale
+        self.AnimFPS = AnimFPS
+        self.ExportVertexColors = ExportVertexColors
+        self.ExportMaterialColors = ExportMaterialColors
+        self.ExportTextures = ExportTextures
+        self.CopyTextureFiles = CopyTextureFiles
+        self.ExportArmatures = ExportArmatures
+        self.ExportAnimationFrames = int(ExportAnimationFrames)
+        self.ExportAnimationActions = int(ExportAnimationActions)
+        self.ExportMode = int(ExportMode)
+        self.MergeModes = int(MergeModes)
+        self.Verbose = Verbose
+        self.WarningList = []
+
+
+def ExportMadeWithMarmaladeGroup(Config):
+    print("----------\nExporting to {}".format(Config.FilePath))
+    if Config.Verbose:
+        print("Opening File...")
+    Config.File = open(Config.FilePath, "w")
+
+    if Config.Verbose:
+        print("Done")
+
+    if Config.Verbose:
+        print("writing group header")
+
+    Config.File.write('// Marmalade group file exported from : %s\n' % bpy.data.filepath)
+    Config.File.write('// Exported %s\n' % str(datetime.datetime.now()))
+    Config.File.write("CIwResGroup\n{\n\tname \"%s\"\n" % bpy.path.display_name_from_filepath(Config.FilePath))
+
+    if Config.Verbose:
+        print("Generating Object list for export... (Root parents only)")
+    if Config.ExportMode == 1:
+        Config.ExportList = [Object for Object in Config.context.scene.objects
+                             if Object.type in {'ARMATURE', 'EMPTY', 'MESH'}
+                             and Object.parent is None]
+    else:
+        ExportList = [Object for Object in Config.context.selected_objects
+                      if Object.type in {'ARMATURE', 'EMPTY', 'MESH'}]
+        Config.ExportList = [Object for Object in ExportList
+                             if Object.parent not in ExportList]
+    if Config.Verbose:
+        print("  List: {}\nDone".format(Config.ExportList))
+
+    if Config.Verbose:
+        print("Setting up...")
+
+    if Config.ExportAnimationFrames:
+        if Config.Verbose:
+            print(bpy.context.scene)
+            print(bpy.context.scene.frame_current)
+        CurrentFrame = bpy.context.scene.frame_current
+        #comment because it crashes Blender on some old blend file: bpy.context.scene.frame_current = bpy.context.scene.frame_current
+    if Config.Verbose:
+        print("Done")
+    
+    Config.ObjectList = []
+    if Config.Verbose:
+        print("Writing Objects...")
+    WriteObjects(Config, Config.ExportList)
+    if Config.Verbose:
+        print("Done")
+
+    if Config.Verbose:
+        print("Objects Exported: {}".format(Config.ExportList))
+
+    if Config.ExportAnimationFrames:
+        if Config.Verbose:
+            print("Writing Animation...")
+        WriteKeyedAnimationSet(Config, bpy.context.scene)
+        bpy.context.scene.frame_current = CurrentFrame
+        if Config.Verbose:
+            print("Done")
+    Config.File.write("}\n")
+    CloseFile(Config)
+    print("Finished")
+
+
+def GetObjectChildren(Parent):
+    return [Object for Object in Parent.children
+            if Object.type in {'ARMATURE', 'EMPTY', 'MESH'}]
+
+
+#Returns the file path of first image texture from Material.
+def GetMaterialTextureFullPath(Config, Material):
+    if Material:
+        #Create a list of Textures that have type "IMAGE"
+        ImageTextures = [Material.texture_slots[TextureSlot].texture for TextureSlot in Material.texture_slots.keys() if Material.texture_slots[TextureSlot].texture.type == "IMAGE"]
+        #Refine a new list with only image textures that have a file source
+        TexImages = [Texture.image for Texture in ImageTextures if getattr(Texture.image, "source", "") == "FILE"]
+        ImageFiles = [Texture.image.filepath for Texture in ImageTextures if getattr(Texture.image, "source", "") == "FILE"]
+        if TexImages:
+            filepath = TexImages[0].filepath
+            if TexImages[0].packed_file:
+                TexImages[0].unpack()
+            if not os.path.exists(filepath):
+                #try relative path to the blend file
+                filepath = os.path.dirname(bpy.data.filepath) + filepath
+            #Marmalade doesn't like jpeg/tif so try to convert in png on the fly
+            if (TexImages[0].file_format == 'JPEG' or TexImages[0].file_format == 'TIFF') and os.path.exists(filepath):
+                marmaladeConvert = os.path.expandvars("%S3E_DIR%\\..\\tools\\ImageMagick\\win32\\convert.exe")
+                if (os.path.exists(marmaladeConvert)):
+                    srcImagefilepath = filepath
+                    filepath = os.path.splitext(filepath)[0] + '.png'
+                    if Config.Verbose:
+                        print("  /!\\ Converting Texture %s in PNG: %s{}..." % (TexImages[0].file_format, filepath))
+                        print('"%s" "%s" "%s"' % (marmaladeConvert, srcImagefilepath, filepath))
+                    subprocess.call([marmaladeConvert, srcImagefilepath, filepath])
+            return filepath
+    return None
+
+
+def WriteObjects(Config, ObjectList, geoFile=None, mtlFile=None, GeoModel=None,  bChildObjects=False):
+    Config.ObjectList += ObjectList
+
+    if bChildObjects == False and Config.MergeModes > 0:
+        if geoFile == None:
+            #we merge objects, so use name of group file for the name of Geo
+            geoFile, mtlFile = CreateGeoMtlFiles(Config, bpy.path.display_name_from_filepath(Config.FilePath))
+            GeoModel = CGeoModel(bpy.path.display_name_from_filepath(Config.FilePath))
+
+    for Object in ObjectList:
+        if Config.Verbose:
+            print("  Writing Object: {}...".format(Object.name))
+        
+        if Config.ExportArmatures and Object.type == "ARMATURE":           
+            Armature = Object.data
+            ParentList = [Bone for Bone in Armature.bones if Bone.parent is None]
+            if Config.Verbose:
+                print("    Writing Armature Bones...")
+            #Create the skel file
+            skelfullname = os.path.dirname(Config.FilePath) + "\models\%s.skel" % (StripName(Object.name))
+            ensure_dir(skelfullname)
+            if Config.Verbose:
+                print("      Creating skel file %s" % (skelfullname))
+
+            skelFile = open(skelfullname, "w")
+            skelFile.write('// skel file exported from : %r\n' % os.path.basename(bpy.data.filepath))   
+            skelFile.write("CIwAnimSkel\n")
+            skelFile.write("{\n")
+            skelFile.write("\tnumBones %d\n" % (len(Armature.bones)))
+            Config.File.write("\t\".\models\%s.skel\"\n" % (StripName(Object.name)))
+
+            WriteArmatureParentRootBones(Config, Object, ParentList, skelFile)
+
+            skelFile.write("}\n")
+            skelFile.close()
+            if Config.Verbose:
+                print("    Done")
+
+        ChildList = GetObjectChildren(Object)
+        if Config.ExportMode == 2:  # Selected Objects Only
+            ChildList = [Child for Child in ChildList
+                         if Child in Config.context.selected_objects]
+        if Config.Verbose:
+            print("    Writing Children...")
+        WriteObjects(Config, ChildList, geoFile, mtlFile, GeoModel, True)
+        if Config.Verbose:
+            print("    Done Writing Children")
+
+        if Object.type == "MESH":
+            if Config.Verbose:
+                print("    Generating Mesh...")
+            if Config.ApplyModifiers:
+                if Config.ExportArmatures:
+                    #Create a copy of the object and remove all armature modifiers so an unshaped
+                    #mesh can be created from it.
+                    Object2 = Object.copy()
+                    for Modifier in [Modifier for Modifier in Object2.modifiers if Modifier.type == "ARMATURE"]:
+                        Object2.modifiers.remove(Modifier)
+                    Mesh = Object2.to_mesh(bpy.context.scene, True, "PREVIEW")
+                else:
+                    Mesh = Object.to_mesh(bpy.context.scene, True, "PREVIEW")
+            else:
+                Mesh = Object.to_mesh(bpy.context.scene, False, "PREVIEW")
+            if Config.Verbose:
+                print("    Done")
+                print("    Writing Mesh...")
+
+            # Flip ZY axis (Blender Z up: Marmalade: Y up) ans Scale appropriately
+            X_ROT = mathutils.Matrix.Rotation(-math.pi / 2, 4, 'X')
+
+            if Config.MergeModes == 0:
+                # No merge, so all objects are exported in MODEL SPACE and not in world space
+                # Calculate Scale of the Export
+                meshScale = Object.matrix_world.to_scale()  # Export is working, even if user doesn't have use apply scale in Edit mode.
+
+                scalematrix = Matrix()
+                scalematrix[0][0] = meshScale.x * Config.Scale
+                scalematrix[1][1] = meshScale.y * Config.Scale
+                scalematrix[2][2] = meshScale.z * Config.Scale
+
+                meshRot = Object.matrix_world.to_quaternion()  # Export is working, even if user doesn't have use apply Rotation in Edit mode.
+                Mesh.transform(X_ROT * meshRot.to_matrix().to_4x4() * scalematrix)
+            else:
+                # In Merge mode, we need to keep relative postion of each objects, so we export in WORLD SPACE
+                SCALE_MAT = mathutils.Matrix.Scale(Config.Scale, 4)
+                Mesh.transform(SCALE_MAT * X_ROT * Object.matrix_world)
+
+             # manage merge options
+   
+            if Config.MergeModes == 0:
+                #one geo per Object, so use name of Object for the Geo file
+                geoFile, mtlFile = CreateGeoMtlFiles(Config, StripName(Object.name))
+                GeoModel = CGeoModel(StripName(Object.name))  
+                
+            # Write the Mesh in the Geo file   
+            WriteMesh(Config, Object, Mesh, geoFile, mtlFile, GeoModel)
+
+            if Config.MergeModes == 0:
+                # no merge so finalize the file, and discard the file and geo class
+                FinalizeGeoMtlFiles(Config, geoFile, mtlFile)
+                geoFile = None
+                mtlFile = None
+                GeoModel = None
+            elif Config.MergeModes == 1:
+                # merge in one Mesh, so keep the Geo class and prepare to change object
+                GeoModel.NewObject() 
+            elif Config.MergeModes == 2:
+                # merge several Meshes in one file: so clear the mesh data that we just written in the file,
+                # but keep Materials info that need to be merged across objects
+                GeoModel.ClearAllExceptMaterials()
+
+            if Config.Verbose:
+                print("    Done")
+
+            if Config.ApplyModifiers and Config.ExportArmatures:
+                bpy.data.objects.remove(Object2)
+            bpy.data.meshes.remove(Mesh)
+
+        if Config.Verbose:
+            print("  Done Writing Object: {}".format(Object.name))
+
+    if bChildObjects == False:
+        # we have finish to do all objects
+        if GeoModel:
+            if Config.MergeModes == 1:
+                # we have Merges all objects in one Mesh, so time to write this big mesh in the file
+                GeoModel.PrintGeoMesh(geoFile)
+                # time to write skinfile if any
+                if len(GeoModel.useBonesDict) > 0:
+                    # some mesh was not modified by the armature. so we must skinned the merged mesh.
+                    # So unskinned vertices from unarmatured meshes, are assigned to the root bone of the armature
+                    for i in range(0, len(GeoModel.vList)):
+                        if not i in GeoModel.skinnedVertices:
+                            GeoModel.skinnedVertices.append(i)
+                            useBonesKey = pow(2, GeoModel.armatureRootBoneIndex)
+                            vertexGroupIndices = list((GeoModel.armatureRootBoneIndex,))
+                            if useBonesKey not in GeoModel.useBonesDict:                          
+                                GeoModel.mapVertexGroupNames[GeoModel.armatureRootBoneIndex] = StripBoneName(GeoModel.armatureRootBone.name)
+                                VertexList = []
+                                VertexList.append("\t\tvertWeights { %d, 1.0}" % i)
+                                GeoModel.useBonesDict[useBonesKey] = (vertexGroupIndices, VertexList)
+                            else:
+                                pair_ListGroupIndices_ListAssignedVertices = GeoModel.useBonesDict[useBonesKey]
+                                pair_ListGroupIndices_ListAssignedVertices[1].append("\t\tvertWeights { %d, 1.0}" % i)
+                                GeoModel.useBonesDict[useBonesKey] = pair_ListGroupIndices_ListAssignedVertices
+                    # now generates the skin file
+                    PrintSkinWeights(Config, GeoModel.armatureObjectName, GeoModel.useBonesDict, GeoModel.mapVertexGroupNames, GeoModel.name)
+            if Config.MergeModes > 0:
+                WriteMeshMaterialsForGeoModel(Config, mtlFile, GeoModel)
+                FinalizeGeoMtlFiles(Config, geoFile, mtlFile)
+        geoFile = None
+        mtlFile = None
+        GeoModel = None
+
+
+def CreateGeoMtlFiles(Config, Name):
+    #Create the geo file
+    geofullname = os.path.dirname(Config.FilePath) + ("\models\%s.geo" % Name)
+    ensure_dir(geofullname)
+    if Config.Verbose:
+        print("      Creating geo file %s" % (geofullname))  
+    geoFile = open(geofullname, "w")
+    geoFile.write('// geo file exported from : %r\n' % os.path.basename(bpy.data.filepath))
+    geoFile.write("CIwModel\n")
+    geoFile.write("{\n")
+    geoFile.write("\tname \"%s\"\n" % Name)
+    # add it to the group
+    Config.File.write("\t\".\models\%s.geo\"\n" % Name)
+
+    # Create the mtl file
+    mtlfullname = os.path.dirname(Config.FilePath) + "\models\%s.mtl" % (Name)
+    ensure_dir(mtlfullname)
+    if Config.Verbose:
+        print("      Creating mtl file %s" % (mtlfullname))
+    mtlFile = open(mtlfullname, "w")
+    mtlFile.write('// mtl file exported from : %r\n' % os.path.basename(bpy.data.filepath))   
+    return geoFile, mtlFile
+
+
+def FinalizeGeoMtlFiles(Config, geoFile, mtlFile):
+    if Config.Verbose:
+        print("      Closing geo file")  
+    geoFile.write("}\n")
+    geoFile.close()
+    if Config.Verbose:
+        print("      Closing mtl file")  
+    mtlFile.close()
+
+
+def WriteMesh(Config, Object, Mesh,  geoFile=None, mtlFile=None, GeoModel=None):
+    if geoFile == None or mtlFile == None:
+        print (" ERROR not geo file arguments in WriteMesh method")
+        return
+
+    if GeoModel == None:
+        print (" ERROR not GeoModel arguments in WriteMesh method")
+        return
+
+    BuildOptimizedGeo(Config, Object, Mesh, GeoModel)
+    if Config.MergeModes == 0 or Config.MergeModes == 2:
+        #if we don't merge, or if we write several meshes into one file ... write the mesh everytime we do an object
+        GeoModel.PrintGeoMesh(geoFile)
+ 
+    if Config.Verbose:
+        print("      Done\n      Writing Mesh Materials...")
+
+    if Config.MergeModes == 0:
+        #No merge, so we can diretly write the Mtl file associated to this object
+        WriteMeshMaterialsForGeoModel(Config, mtlFile, GeoModel)
+
+    if Config.Verbose:
+        print("      Done")
+  
+    if Config.ExportArmatures:
+        if Config.Verbose:
+            print("      Writing Mesh Weights...")
+        WriteMeshSkinWeightsForGeoModel(Config, Object, Mesh, GeoModel)
+        if Config.Verbose:
+            print("      Done")
+
+
+###### optimized version fo Export, can be used also to merge several object in one single geo File ######
+
+# CGeoModel
+#  -> List Vertices
+#  -> List Normales
+#  -> List uv 0
+#  -> List uv 1
+#  -> List Vertex Colors
+#  -> List Materials
+#       -> Material name
+#       -> Blender Material Object
+#       -> List Tris -> Stream Indices v,vn,uv0,uv1,vc
+#       -> List Quads -> Stream Indices v,vn,uv0,uv1,vc
+
+
+#############
+#Store one Point of a Quad or Tri in marmalade geo format: //index-list is: { <int> <int> <int> <int> <int> }   //v,vn,uv0,uv1,vc
+#############                           
+class CGeoIndexList:
+    __slots__ = "v", "vn", "uv0", "uv1", "vc"
+    
+    def __init__(self, v, vn, uv0, uv1, vc):
+        self.v = v
+        self.vn = vn
+        self.uv0 = uv0
+        self.uv1 = uv1
+        self.vc = vc
+
+        
+#############
+#Store a Quad or a Tri in marmalade geo format : 3 or 4 CIndexList depending it is a Tri or a Quad
+#############                        
+class CGeoPoly:
+    __slots__ = "pointsList",
+    
+    def __init__(self):
+        self.pointsList = []
+
+    def AddPoint(self, v, vn, uv0, uv1, vc):
+        self.pointsList.append( CGeoIndexList(v, vn, uv0, uv1, vc))
+
+    def PointsCount(self):
+        return len(self.pointsList)
+
+    def PrintPoly(self, geoFile):
+        if len(self.pointsList) == 3:
+            geoFile.write("\t\t\t\tt ")
+        if len(self.pointsList) == 4:
+            geoFile.write("\t\t\t\tq ")
+        for point in self.pointsList:
+            geoFile.write(" {%d, %d, %d, %d, %d}" % (point.v, point.vn, point.uv0, point.uv1, point.vc))
+        geoFile.write("\n")
+
+
+#############
+#Store all the poly (tri or quad) assigned to a Material in marmalade geo format
+#############                        
+class CGeoMaterialPolys:
+    __slots__ = "name", "material", "quadList", "triList", "currentPoly"
+    
+    def __init__(self, name, material=None):
+        self.name = name
+        self.material = material
+        self.quadList = []
+        self.triList = []
+        self.currentPoly = None
+
+    def BeginPoly(self):
+        self.currentPoly = CGeoPoly()
+
+    def AddPoint(self, v, vn, uv0, uv1, vc):
+        self.currentPoly.AddPoint(v, vn, uv0, uv1, vc)       
+             
+    def EndPoly(self):
+        if (self.currentPoly.PointsCount() == 3):
+            self.triList.append(self.currentPoly)
+        if (self.currentPoly.PointsCount() == 4):
+            self.quadList.append(self.currentPoly)
+        self.currentPoly = None
+
+    def ClearPolys(self):
+        self.quadList = []
+        self.triList = []
+        self.currentPoly = None
+
+    def PrintMaterialPolys(self, geoFile):
+        geoFile.write("\t\tCSurface\n")
+        geoFile.write("\t\t{\n")
+        geoFile.write("\t\t\tmaterial \"%s\"\n" % self.name)
+        if self.triList:
+            geoFile.write("\t\t\tCTris\n")
+            geoFile.write("\t\t\t{\n")
+            geoFile.write("\t\t\t\tnumTris %d\n" % (len(self.triList)))
+            for poly in self.triList:
+                poly.PrintPoly(geoFile)
+            geoFile.write("\t\t\t}\n")
+
+        if self.quadList:
+            geoFile.write("\t\t\tCQuads\n")
+            geoFile.write("\t\t\t{\n")
+            geoFile.write("\t\t\t\tnumQuads %d\n" % (len(self.quadList)))
+            for poly in self.quadList:
+                poly.PrintPoly(geoFile)
+            geoFile.write("\t\t\t}\n")
+        geoFile.write("\t\t}\n")
+
+
+#############
+#Store all the information on a Model/Mesh (vertices, normal, certcies color, uv0, uv1, TRI, QUAD) in marmalade geo format
+#############  
+class CGeoModel:
+    __slots__ = ("name", "MaterialsDict", "vList", "vnList", "vcList", "uv0List", "uv1List",
+                "currentMaterialPolys", "vbaseIndex","vnbaseIndex", "uv0baseIndex", "uv1baseIndex",
+                "armatureObjectName", "useBonesDict", "mapVertexGroupNames", "armatureRootBone", "armatureRootBoneIndex", "skinnedVertices")
+                
+    def __init__(self, name):
+        self.name = name
+        self.MaterialsDict = {}
+        self.vList = []
+        self.vnList = []
+        self.vcList = []
+        self.uv0List = []
+        self.uv1List = []
+        self.currentMaterialPolys = None
+        #used xx baseIndex are used when merging several blender objects into one Mesh in the geo file (internal offset)
+        self.vbaseIndex = 0
+        self.vnbaseIndex = 0
+        self.uv0baseIndex = 0
+        self.uv1baseIndex = 0
+
+        # Store some information for skin management , when we merge several object in one big mesh (MergeModes 1)
+        # can only work if in the object list only one is rigged with an armature... and if it is located in 0,0,0
+        self.armatureObjectName = ""
+        #useBonesKey : bit field, where each bit is a VertexGroup.Index): Sum(2^VertGroupIndex).
+        #useBonesDict[useBonesKey] = tuple(VertexGroups.group, list(Vertex))
+        self.useBonesDict = {}
+        self.mapVertexGroupNames = {}
+        self.armatureRootBone = None
+        self.armatureRootBoneIndex = 0
+        self.skinnedVertices = []
+
+
+
+    def AddVertex(self, vertex):
+        self.vList.append(vertex.copy())
+
+    def AddVertexNormal(self, vertexN):
+        self.vnList.append(vertexN.copy())
+
+    # add a uv coordiantes and return the current Index in the stream (index is local to the object, when we merge several object into a one Mesh)
+    def AddVertexUV0(self, u, v):
+        self.uv0List.append((u, v))
+        return len(self.uv0List) - 1 - self.uv0baseIndex 
+
+    def AddVertexUV1(self, u, v):
+        self.uv1List.append((u, v))
+        return len(self.uv1List) - 1 - self.uv1baseIndex 
+
+    # add a vertexcolor if it doesn't already exist and return the current Index in the stream (index is global to all objects, when we merge several object into a one Mesh)
+    def AddVertexColor(self, r, g, b, a):
+        for i in range(0, len(self.vcList)):
+            col = self.vcList[i]
+            if col[0] == r and col[1] == g and col[2] == b and col[3] == a:
+                return i
+
+        self.vcList.append((r, g, b, a))
+        return len(self.vcList)-1
+
+    def BeginPoly(self, MaterialName, material=None):
+        if MaterialName not in self.MaterialsDict:
+            self.currentMaterialPolys = CGeoMaterialPolys(MaterialName, material)
+        else:
+            self.currentMaterialPolys = self.MaterialsDict[MaterialName]
+        self.currentMaterialPolys.BeginPoly()
+
+    def AddPoint(self, v, vn, uv0, uv1, vc):
+        if v != -1:
+            v += self.vbaseIndex
+        if vn != -1:
+            vn += self.vnbaseIndex
+        if uv0 != -1:
+            uv0 += self.uv0baseIndex
+        if uv1 != -1:
+            uv1 += self.uv1baseIndex
+                
+        self.currentMaterialPolys.AddPoint(v, vn, uv0, uv1, vc)       
+                              
+    def EndPoly(self):
+        self.currentMaterialPolys.EndPoly()
+        self.MaterialsDict[self.currentMaterialPolys.name] = self.currentMaterialPolys
+        self.currentMaterialPolys = None
+
+    def NewObject(self):
+        #used in Merge mode 1: allows to merge several blender objects into one Mesh.
+        self.vbaseIndex = len(self.vList)
+        self.vnbaseIndex = len(self.vnList)
+        self.uv0baseIndex = len(self.uv0List)
+        self.uv1baseIndex = len(self.uv1List)
+
+    def ClearAllExceptMaterials(self):
+        #used in Merge mode 2: one geo with several mesh
+        self.vList = []
+        self.vnList = []
+        self.vcList = []
+        self.uv0List = []
+        self.uv1List = []
+        self.currentMaterialPolys = None
+        self.vbaseIndex = 0
+        self.vnbaseIndex = 0
+        self.uv0baseIndex = 0
+        self.uv1baseIndex = 0
+        for GeoMaterialPolys in self.MaterialsDict.values():
+            GeoMaterialPolys.ClearPolys()
+        self.useBonesDict = {}
+        self.mapVertexGroupNames = {}
+        self.armatureObjectName = ""
+        self.armatureRootBone = None
+        self.armatureRootBoneIndex = 0
+        self.skinnedVertices = []
+
+    def PrintGeoMesh(self, geoFile):
+        geoFile.write("\tCMesh\n")
+        geoFile.write("\t{\n")
+        geoFile.write("\t\tname \"%s\"\n" % (StripName(self.name)))
+
+        if self.vList:
+            geoFile.write("\t\tCVerts\n")
+            geoFile.write("\t\t{\n")
+            geoFile.write("\t\t\tnumVerts %d\n" % len(self.vList))
+            for vertex in self.vList:
+                geoFile.write("\t\t\tv { %.9f, %.9f, %.9f }\n" % (vertex[0], vertex[1], vertex[2]))                      
+            geoFile.write("\t\t}\n")
+
+        if self.vnList:
+            geoFile.write("\t\tCVertNorms\n")
+            geoFile.write("\t\t{\n")
+            geoFile.write("\t\t\tnumVertNorms  %d\n" % len(self.vnList))
+            for vertexn in self.vnList:
+                geoFile.write("\t\t\tvn { %.9f, %.9f, %.9f }\n" % (vertexn[0], vertexn[1], vertexn[2]))                      
+            geoFile.write("\t\t}\n")
+
+        if self.vcList:
+            geoFile.write("\t\tCVertCols\n")
+            geoFile.write("\t\t{\n")
+            geoFile.write("\t\t\tnumVertCols %d\n" % len(self.vcList))
+            for color in self.vcList:
+                geoFile.write("\t\t\tcol { %.6f, %.6f, %.6f, %.6f }\n" % (color[0], color[1], color[2], color[3])) #alpha is not supported on blender for vertex colors           
+            geoFile.write("\t\t}\n")
+
+        if self.uv0List:
+            geoFile.write("\t\tCUVs\n")
+            geoFile.write("\t\t{\n")
+            geoFile.write("\t\t\tsetID 0\n")
+            geoFile.write("\t\t\tnumUVs %d\n" % len(self.uv0List))
+            for uv in self.uv0List:
+                 geoFile.write("\t\t\tuv { %.9f, %.9f }\n" % (uv[0], uv[1]))                       
+            geoFile.write("\t\t}\n")
+
+        if self.uv1List:
+            geoFile.write("\t\tCUVs\n")
+            geoFile.write("\t\t{\n")
+            geoFile.write("\t\t\tsetID 1\n")
+            geoFile.write("\t\t\tnumUVs %d\n" % len(self.uv1List))
+            for uv in self.uv1List:
+                 geoFile.write("\t\t\tuv { %.9f, %.9f }\n" % (uv[0], uv[1]))                       
+            geoFile.write("\t\t}\n")
+
+        for GeoMaterialPolys in self.MaterialsDict.values():
+            GeoMaterialPolys.PrintMaterialPolys(geoFile)
+        geoFile.write("\t}\n")
+
+    def GetMaterialList(self):
+        return list(self.MaterialsDict.keys())
+
+    def GetMaterialByName(self, name):
+        if name in self.MaterialsDict:
+            return self.MaterialsDict[name].material
+        else:
+            return None       
+
+
+
+#############
+# iterates faces, vertices ... and store the information in the GeoModel container
+def BuildOptimizedGeo(Config, Object, Mesh, GeoModel):
+    if GeoModel == None:
+        GeoModel = CGeoModel(filename, Object.name)
+
+    #Ensure tessfaces data are here
+    Mesh.update (calc_tessface=True)
+    
+    #Store Vertex stream, and Normal stream (use directly the order from blender collection
+    for Vertex in Mesh.vertices:
+        GeoModel.AddVertex(Vertex.co)
+        Normal = Vertex.normal
+        if Config.FlipNormals:
+            Normal = -Normal
+        GeoModel.AddVertexNormal(Normal)
+    #Check if some colors have been defined
+    vertexColours = None
+    if Config.ExportVertexColors and (len(Mesh.vertex_colors) > 0):
+        vertexColours = Mesh.tessface_vertex_colors[0].data
+
+    #Check if some uv coordinates have been defined
+    UVCoordinates = None
+    if Config.ExportTextures and (len(Mesh.uv_textures) > 0):
+        for UV in Mesh.tessface_uv_textures:
+            if UV.active_render:
+                UVCoordinates = UV.data
+                break
+
+    #Iterate on Faces and Store the poly (quad or tri) and the associate colors,UVs
+    for Face in Mesh.tessfaces:
+        # stream for vertex (we use the same for normal)
+        Vertices = list(Face.vertices)
+        if Config.CoordinateSystem == 1:
+            Vertices = Vertices[::-1]
+        # stream for vertex colors
+        if vertexColours:
+            MeshColor = vertexColours[Face.index]
+            if len(Vertices) == 3:
+                FaceColors = list((MeshColor.color1, MeshColor.color2, MeshColor.color3))
+            else:
+                FaceColors = list((MeshColor.color1, MeshColor.color2, MeshColor.color3, MeshColor.color4))
+            if Config.CoordinateSystem == 1:
+                FaceColors = FaceColors[::-1]
+            colorIndex = []
+            for color in FaceColors:
+                index = GeoModel.AddVertexColor(color[0], color[1], color[2], 1)  #rgba => no alpha on vertex color in Blender so use 1
+                colorIndex.append(index)
+        else:
+            colorIndex = list((-1,-1,-1,-1))
+
+        # stream for UV0 coordinates
+        if UVCoordinates:
+            uvFace = UVCoordinates[Face.index]
+            uvVertices = []
+            for uvVertex in uvFace.uv:
+                uvVertices.append(tuple(uvVertex))
+            if Config.CoordinateSystem == 1:
+                uvVertices = uvVertices[::-1]
+            uv0Index = []
+            for uvVertex in uvVertices:
+                index = GeoModel.AddVertexUV0(uvVertex[0], 1 - uvVertex[1]) 
+                uv0Index.append(index)
+        else:
+            uv0Index = list((-1, -1, -1, -1))
+
+        # stream for UV1 coordinates
+        uv1Index = list((-1, -1, -1, -1))
+
+        mat = None
+        # find the associated material
+        if Face.material_index < len(Mesh.materials):
+            mat = Mesh.materials[Face.material_index]
+        if mat:
+            matName =  mat.name
+        else:
+            matName = "NoMaterialAssigned"  # There is no material assigned in blender !!!, exporter have generated a default one          
+            
+        # now on the material, generates the tri/quad in v,vn,uv0,uv1,vc stream index
+        GeoModel.BeginPoly(matName, mat)
+
+        for i in range(0, len(Vertices)):
+            GeoModel.AddPoint(Vertices[i], Vertices[i], uv0Index[i], uv1Index[i], colorIndex[i])
+
+        GeoModel.EndPoly()
+
+
+                              
+#############
+# Get the list of Material in use by the CGeoModel
+def WriteMeshMaterialsForGeoModel(Config, mtlFile, GeoModel):
+    for matName in GeoModel.GetMaterialList():
+        Material = GeoModel.GetMaterialByName(matName)
+        WriteMaterial(Config, mtlFile, Material)
+
+
+def WriteMaterial(Config, mtlFile, Material=None):
+    mtlFile.write("CIwMaterial\n")
+    mtlFile.write("{\n")
+    if Material:
+        mtlFile.write("\tname \"%s\"\n" % Material.name)
+
+        if Config.ExportMaterialColors:
+            #if bpy.context.scene.world:
+            #    MatAmbientColor = Material.ambient * bpy.context.scene.world.ambient_color
+            MatAmbientColor = Material.ambient * Material.diffuse_color
+            mtlFile.write("\tcolAmbient {%.2f,%.2f,%.2f,%.2f} \n" % (min(255, MatAmbientColor[0] * 255), min(255, MatAmbientColor[1] * 255), min(255, MatAmbientColor[2] * 255), min(255, Material.alpha * 255)))
+            MatDiffuseColor = 255 * Material.diffuse_intensity * Material.diffuse_color
+            MatDiffuseColor = min((255, 255, 255)[:],MatDiffuseColor[:])
+            mtlFile.write("\tcolDiffuse  {%.2f,%.2f,%.2f} \n" % (MatDiffuseColor[:]))
+            MatSpecularColor = 255 * Material.specular_intensity * Material.specular_color
+            MatSpecularColor = min((255, 255, 255)[:],MatSpecularColor[:])
+            mtlFile.write("\tcolSpecular  {%.2f,%.2f,%.2f} \n" % (MatSpecularColor[:]))
+            # EmitColor = Material.emit * Material.diffuse_color
+            # mtlFile.write("\tcolEmissive {%.2f,%.2f,%.2f} \n" % (EmitColor* 255)[:])    
+    else:
+        mtlFile.write("\tname \"NoMaterialAssigned\" // There is no material assigned in blender !!!, exporter have generated a default one\n")
+
+    #Copy texture
+    if Config.ExportTextures:
+        Texture = GetMaterialTextureFullPath(Config, Material)
+        if Texture:
+            mtlFile.write("\ttexture0 .\\textures\\%s\n" % (bpy.path.basename(Texture)))
+            
+            if Config.CopyTextureFiles:
+                if not os.path.exists(Texture):
+                    #try relative path to the blend file
+                    Texture = os.path.dirname(bpy.data.filepath) + Texture
+                if os.path.exists(Texture):
+                    textureDest = os.path.dirname(Config.FilePath) + "\\models\\textures\\%s" % (bpy.path.basename(Texture))
+                    ensure_dir(textureDest)
+                    if Config.Verbose:
+                        print("      Copying the texture file %s ---> %s" % (Texture, textureDest))
+                    shutil.copy(Texture, textureDest)
+                else:
+                    if Config.Verbose:
+                        print("      CANNOT Copy texture file (not found) %s" % (Texture))
+    mtlFile.write("}\n")
+
+def GetFirstRootBone(ArmatureObject):
+    ArmatureBones = ArmatureObject.data.bones
+    ParentBoneList = [Bone for Bone in ArmatureBones if Bone.parent is None]
+    if ParentBoneList:
+        return ParentBoneList[0]
+    return None
+
+
+def GetVertexGroupFromBone(Object, Bone):
+    if Bone:
+        vertexGroupList = [VertexGroup for VertexGroup in Object.vertex_groups  if VertexGroup.name == Bone.name]
+        if vertexGroupList:
+            return vertexGroupList[0]
+    return None
+
+
+def GetBoneListNames(Bones):
+    boneList = []
+    for Bone in Bones:
+        boneList.append(Bone.name)
+        boneList += GetBoneListNames(Bone.children)
+    return boneList
+
+
+def FindUniqueIndexForRootBone(Object, RootVertexGroup):
+    if RootVertexGroup:
+        return RootVertexGroup.index
+    else:
+        #If there is not VertexGroup associated to the root bone name, we don't have a vertex index.
+        #so use the next available free index
+        return len(Object.vertex_groups)
+
+         
+def WriteMeshSkinWeightsForGeoModel(Config, Object, Mesh, GeoModel):
+    ArmatureList = [Modifier for Modifier in Object.modifiers if Modifier.type == "ARMATURE"]
+    if ArmatureList:
+        ArmatureObject = ArmatureList[0].object
+        if ArmatureObject is None:
+            return
+        RootBone = GetFirstRootBone(ArmatureObject)
+        RootVertexGroup = GetVertexGroupFromBone(Object, RootBone)
+        BoneNames = GetBoneListNames(ArmatureObject.data.bones)
+
+        GeoModel.armatureObjectName = StripName(ArmatureObject.name)
+        if RootBone:
+            GeoModel.armatureRootBone = RootBone
+            GeoModel.armatureRootBoneIndex = FindUniqueIndexForRootBone(Object, RootVertexGroup)
+
+        # Marmalade need to declare a vertex per list of affected bones
+        # so first we have to get all the combinations of affected bones that exist in the mesh
+        # to build thoses groups, we build a unique key (like a bit field, where each bit is a VertexGroup.Index): Sum(2^VertGroupIndex)... so we have a unique Number per combinations
+        
+        for Vertex in Mesh.vertices:
+            VertexIndex = Vertex.index + GeoModel.vbaseIndex
+            AddVertexToDicionarySkinWeights(Config, Object, Mesh, Vertex, GeoModel.useBonesDict, GeoModel.mapVertexGroupNames, VertexIndex, RootBone, RootVertexGroup, BoneNames)
+            GeoModel.skinnedVertices.append(VertexIndex)
+
+        if Config.MergeModes != 1:
+            # write skin file directly
+            PrintSkinWeights(Config, GeoModel.armatureObjectName, GeoModel.useBonesDict, GeoModel.mapVertexGroupNames, StripName(Object.name))
+
+
+def PrintSkinWeights(Config, ArmatureObjectName, useBonesDict, mapVertexGroupNames, GeoName):        
+        #Create the skin file
+        skinfullname = os.path.dirname(Config.FilePath) + "\models\%s.skin" % GeoName
+        ensure_dir(skinfullname)
+        if Config.Verbose:
+            print("      Creating skin file %s" % (skinfullname))
+        skinFile = open(skinfullname, "w")
+        skinFile.write('// skin file exported from : %r\n' % os.path.basename(bpy.data.filepath))   
+        skinFile.write("CIwAnimSkin\n")
+        skinFile.write("{\n")
+        skinFile.write("\tskeleton \"%s\"\n" % ArmatureObjectName)
+        skinFile.write("\tmodel \"%s\"\n" % GeoName)
+
+        # now we have Bones grouped in the dictionary , along with the associated influenced vertex weighting
+        # So simply iterate the dictionary
+        Config.File.write("\t\".\models\%s.skin\"\n" % GeoName)
+        for pair_ListGroupIndices_ListAssignedVertices in useBonesDict.values():
+            skinFile.write("\tCIwAnimSkinSet\n")
+            skinFile.write("\t{\n")
+            skinFile.write("\t\tuseBones {")
+            for vertexGroupIndex in pair_ListGroupIndices_ListAssignedVertices[0]:
+                skinFile.write(" %s" % mapVertexGroupNames[vertexGroupIndex])
+            skinFile.write(" }\n")
+            skinFile.write("\t\tnumVerts %d\n" % len(pair_ListGroupIndices_ListAssignedVertices[1]))
+            for VertexWeightString in pair_ListGroupIndices_ListAssignedVertices[1]:
+                skinFile.write(VertexWeightString)
+            skinFile.write("\t}\n")
+
+        skinFile.write("}\n")
+        skinFile.close()
+
+
+def AddVertexToDicionarySkinWeights(Config, Object, Mesh, Vertex, useBonesDict, mapVertexGroupNames, VertexIndex, RootBone, RootVertexGroup, BoneNames):
+    #build useBones
+    useBonesKey = 0
+    vertexGroupIndices = []
+    weightTotal = 0.0
+    if (len(Vertex.groups)) > 4:
+        print ("ERROR Vertex %d is influenced by more than 4 bones\n" % (VertexIndex))
+    for VertexGroup in Vertex.groups:
+        if (VertexGroup.weight > 0):
+            groupName = Object.vertex_groups[VertexGroup.group].name
+            if groupName in BoneNames:
+                mapVertexGroupNames[VertexGroup.group] = StripBoneName(groupName)
+                if (len(vertexGroupIndices))<4:  #ignore if more 4 bones are influencing the vertex
+                    useBonesKey = useBonesKey + pow(2, VertexGroup.group)
+                    vertexGroupIndices.append(VertexGroup.group)
+                    weightTotal = weightTotal + VertexGroup.weight
+    if (weightTotal == 0):
+        bWeightTotZero = True  #avoid divide by zero later on
+        if (RootBone):
+            if Config.Verbose:
+                print(" Warning Weight is ZERO for vertex %d => Add it to the root bone" % (VertexIndex))
+            RootBoneGroupIndex = FindUniqueIndexForRootBone(Object, RootVertexGroup)
+            mapVertexGroupNames[RootBoneGroupIndex] = StripBoneName(RootBone.name)
+            useBonesKey = pow(2, RootBoneGroupIndex)
+            vertexGroupIndices = list((RootBoneGroupIndex,))
+
+            weightTotal = 1
+    else:
+        bWeightTotZero = False
+    
+    if len(vertexGroupIndices) > 0:
+        vertexGroupIndices.sort();
+           
+        #build the vertex weight string: vertex indices, followed by influence weight for each bone
+        VertexWeightString = "\t\tvertWeights { %d" % (VertexIndex)
+        for vertexGroupIndex in vertexGroupIndices:
+            #get the weight of this specific VertexGroup (aka bone)
+            boneWeight = 1
+            for VertexGroup in Vertex.groups:
+                if VertexGroup.group == vertexGroupIndex:
+                    boneWeight = VertexGroup.weight
+            #calculate the influence of this bone compared to the total of weighting applied to this Vertex
+            if not bWeightTotZero:
+                VertexWeightString += ", %.7f" % (boneWeight / weightTotal)
+            else:
+                VertexWeightString += ", %.7f" % (1.0 / len(vertexGroupIndices))
+        VertexWeightString += "}"
+        if bWeightTotZero:
+            VertexWeightString += " // total weight was zero in blender , export assign it to the RootBone with weight 1." 
+        if (len(Vertex.groups)) > 4:
+            VertexWeightString += " // vertex is associated to more than 4 bones in blender !! skip some bone association (was associated to %d bones)." % (len(Vertex.groups))
+        VertexWeightString += "\n"
+           
+        #store in dictionnary information
+        if useBonesKey not in useBonesDict:
+            VertexList = []
+            VertexList.append(VertexWeightString)
+            useBonesDict[useBonesKey] = (vertexGroupIndices, VertexList)
+        else:
+            pair_ListGroupIndices_ListAssignedVertices = useBonesDict[useBonesKey]
+            pair_ListGroupIndices_ListAssignedVertices[1].append(VertexWeightString)
+            useBonesDict[useBonesKey] = pair_ListGroupIndices_ListAssignedVertices
+    else:
+        print ("ERROR Vertex %d is not skinned (it doesn't belong to any vertex group\n" % (VertexIndex)) 
+
+
+
+############# ARMATURE: Bone export, and Bone animation export 
+
+         
+def WriteArmatureParentRootBones(Config, Object, RootBonesList, skelFile):
+
+    if len(RootBonesList) > 1:
+        print(" /!\\  WARNING ,Marmelade need only one ROOT bone per armature, there is %d root bones " % len(RootBonesList))
+        print(RootBonesList)
+        
+    PoseBones = Object.pose.bones
+    for Bone in RootBonesList:
+        if Config.Verbose:
+            print("      Writing Root Bone: {}...".format(Bone.name))
+
+        PoseBone = PoseBones[Bone.name]
+        WriteBonePosition(Config, Object, Bone, PoseBones, PoseBone, skelFile, True)
+        if Config.Verbose:
+            print("      Done")
+        WriteArmatureChildBones(Config, Object, Bone.children, skelFile)
+
+            
+def WriteArmatureChildBones(Config, Object, BonesList, skelFile):
+    PoseBones = Object.pose.bones
+    for Bone in BonesList:
+        if Config.Verbose:
+            print("      Writing Child Bone: {}...".format(Bone.name))
+        PoseBone = PoseBones[Bone.name]
+        WriteBonePosition(Config, Object, Bone, PoseBones, PoseBone, skelFile, True)
+        if Config.Verbose:
+            print("      Done")
+            
+        WriteArmatureChildBones(Config, Object, Bone.children, skelFile)
+
+
+def WriteBonePosition(Config, Object, Bone, PoseBones, PoseBone, File, isRestPoseNotAnimPose):
+    # Compute armature scale : 
+    # Many others exporter require sthe user to do Apply Scale in Object Mode to have 1,1,1 scale and so that anim data are correctly scaled
+    # Here we retreive the Scale of the Armture Object.matrix_world.to_scale() and we use it to scale the bones :-)
+    # So new Blender user should not complain about bad animation export if they forgot to apply the Scale to 1,1,1
+    
+    armScale = Object.matrix_world.to_scale()
+    armRot = Object.matrix_world.to_quaternion()
+    if isRestPoseNotAnimPose:
+        #skel file, bone header
+        File.write("\tCIwAnimBone\n")
+        File.write("\t{\n")
+        File.write("\t\tname \"%s\"\n" % StripBoneName(Bone.name))
+        #get bone local matrix for rest pose
+        if Bone.parent:
+            File.write("\t\tparent \"%s\"\n" % StripBoneName(Bone.parent.name))
+            localmat = Bone.parent.matrix_local.inverted() * Bone.matrix_local
+        else:
+            localmat = Bone.matrix_local
+    else:
+        #anim file, bone header
+        File.write("\t\t\n")
+        File.write("\t\tbone \"%s\" \n" % StripBoneName(Bone.name))
+        localmat = PoseBone.matrix
+        #get bone local matrix for current anim pose
+        if Bone.parent:
+            ParentPoseBone = PoseBones[Bone.parent.name]
+            localmat = ParentPoseBone.matrix.inverted() * PoseBone.matrix
+        else:
+            localmat = PoseBone.matrix
+
+    if not Bone.parent:
+        #Flip Y Z axes (only on root bone, other bones are local to root bones, so no need to rotate)
+        X_ROT = mathutils.Matrix.Rotation(-math.pi / 2, 4, 'X')
+        if Config.MergeModes > 0:
+            # Merge mode is in world coordinates and not in model coordinates: so apply the world coordinate on the rootbone
+            localmat = X_ROT * Object.matrix_world * localmat
+            armScale.x =  armScale.y = armScale.z = 1
+        else:
+            localmat= X_ROT * armRot.to_matrix().to_4x4() * localmat #apply the armature rotation on the root bone
+
+    
+    loc = localmat.to_translation()
+    quat = localmat.to_quaternion()
+
+    #Scale the bone
+    loc.x *= (armScale.x * Config.Scale)
+    loc.y *= (armScale.y * Config.Scale)
+    loc.z *= (armScale.z * Config.Scale)
+    
+    File.write("\t\tpos { %.9f, %.9f, %.9f }\n" % (loc[0], loc[1], loc[2]))
+    File.write("\t\trot { %.9f, %.9f, %.9f, %.9f }\n" % (quat.w, quat.x, quat.y, quat.z))
+
+    if isRestPoseNotAnimPose:
+        File.write("\t}\n")
+
+      
+def WriteKeyedAnimationSet(Config, Scene):  
+    for Object in [Object for Object in Config.ObjectList if Object.animation_data]:
+        if Config.Verbose:
+            print("  Writing Animation Data for Object: {}".format(Object.name))
+        actions = []
+        if Config.ExportAnimationActions == 0 and Object.animation_data.action:
+            actions.append(Object.animation_data.action)
+        else:
+            actions = bpy.data.actions[:]   
+            DefaultAction = Object.animation_data.action
+        
+        for Action in actions:
+            if Config.ExportAnimationActions == 0:
+                animFileName = StripName(Object.name)
+            else:
+                Object.animation_data.action = Action
+                animFileName = "%s_%s" % (StripName(Object.name),StripName(Action.name))
+                          
+            #Object animated (aka single bone object)
+            #build key frame time list
+
+            keyframeTimes = set()
+            if Config.ExportAnimationFrames == 1:
+                # Exports only key frames
+                for FCurve in Action.fcurves:
+                    for Keyframe in FCurve.keyframe_points:
+                        if Keyframe.co[0] < Scene.frame_start:
+                            keyframeTimes.add(Scene.frame_start)
+                        elif Keyframe.co[0] > Scene.frame_end:
+                            keyframeTimes.add(Scene.frame_end)
+                        else:
+                            keyframeTimes.add(int(Keyframe.co[0]))
+            else:
+                # Exports all frames
+                keyframeTimes.update(range(Scene.frame_start, Scene.frame_end + 1, 1))
+            keyframeTimes = list(keyframeTimes)
+            keyframeTimes.sort()
+            if len(keyframeTimes):
+                #Create the anim file for offset animation (or single bone animation
+                animfullname = os.path.dirname(Config.FilePath) + "\\anims\\%s_offset.anim" % animFileName
+                #not yet supported
+                """
+                ##    ensure_dir(animfullname)
+                ##    if Config.Verbose:
+                ##        print("      Creating anim file (single bone animation) %s" % (animfullname))
+                ##    animFile = open(animfullname, "w")
+                ##    animFile.write('// anim file exported from : %r\n' % os.path.basename(bpy.data.filepath))   
+                ##    animFile.write("CIwAnim\n")
+                ##    animFile.write("{\n")
+                ##    animFile.write("\tent \"%s\"\n" % (StripName(Object.name)))
+                ##    animFile.write("\tskeleton \"SingleBone\"\n")
+                ##    animFile.write("\t\t\n")
+                ##
+                ##    Config.File.write("\t\".\\anims\\%s_offset.anim\"\n" % animFileName))
+                ##
+                ##    for KeyframeTime in keyframeTimes:
+                ##        #Scene.frame_set(KeyframeTime)    
+                ##        animFile.write("\tCIwAnimKeyFrame\n")
+                ##        animFile.write("\t{\n")
+                ##        animFile.write("\t\ttime %.2f // frame num %d \n" % (KeyframeTime/Config.AnimFPS, KeyframeTime))
+                ##        animFile.write("\t\t\n")
+                ##        animFile.write("\t\tbone \"SingleBone\" \n")
+                ##        #postion
+                ##        posx = 0
+                ##        for FCurve in Action.fcurves:
+                ##            if FCurve.data_path == "location" and FCurve.array_index == 0: posx = FCurve.evaluate(KeyframeTime)
+                ##        posy = 0
+                ##        for FCurve in Action.fcurves:
+                ##            if FCurve.data_path == "location" and FCurve.array_index == 1: posy = FCurve.evaluate(KeyframeTime)
+                ##        posz = 0
+                ##        for FCurve in Action.fcurves:
+                ##            if FCurve.data_path == "location" and FCurve.array_index == 2: posz = FCurve.evaluate(KeyframeTime)
+                ##        animFile.write("\t\tpos {%.9f,%.9f,%.9f}\n" % (posx, posy, posz))
+                ##        #rotation
+                ##        rot = Euler()
+                ##        rot[0] = 0
+                ##        for FCurve in Action.fcurves:
+                ##            if FCurve.data_path == "rotation_euler" and FCurve.array_index == 1: rot[0] = FCurve.evaluate(KeyframeTime)
+                ##        rot[1] = 0
+                ##        for FCurve in Action.fcurves:
+                ##            if FCurve.data_path == "rotation_euler" and FCurve.array_index == 2: rot[1] = FCurve.evaluate(KeyframeTime)
+                ##        rot[2] = 0
+                ##        for FCurve in Action.fcurves:
+                ##            if FCurve.data_path == "rotation_euler" and FCurve.array_index == 3: rot[2] = FCurve.evaluate(KeyframeTime)
+                ##        rot = rot.to_quaternion()
+                ##        animFile.write("\t\trot {%.9f,%.9f,%.9f,%.9f}\n" % (rot[0], rot[1], rot[2], rot[3]))
+                ##        #scale
+                ##        scalex = 0
+                ##        for FCurve in Action.fcurves:
+                ##            if FCurve.data_path == "scale" and FCurve.array_index == 0: scalex = FCurve.evaluate(KeyframeTime)
+                ##        scaley = 0
+                ##        for FCurve in Action.fcurves:
+                ##            if FCurve.data_path == "scale" and FCurve.array_index == 1: scaley = FCurve.evaluate(KeyframeTime)
+                ##        scalez = 0
+                ##        for FCurve in Action.fcurves:
+                ##            if FCurve.data_path == "scale" and FCurve.array_index == 2: scalez = FCurve.evaluate(KeyframeTime)
+                ##        animFile.write("\t\t//scale {%.9f,%.9f,%.9f}\n" % (scalex, scaley, scalez))
+                ##        #keyframe done
+                ##        animFile.write("\t}\n")
+                ##    animFile.write("}\n")
+                ##    animFile.close()
+                """
+            else:
+                if Config.Verbose:
+                    print("    Object %s has no useable animation data." % (StripName(Object.name)))
+
+            if Config.ExportArmatures and Object.type == "ARMATURE":
+                if Config.Verbose:
+                    print("    Writing Armature Bone Animation Data...\n")
+                PoseBones = Object.pose.bones
+                Bones = Object.data.bones
+                #riged bones animated 
+                #build key frame time list
+                keyframeTimes = set()
+                if Config.ExportAnimationFrames == 1:
+                    # Exports only key frames
+                    for FCurve in Action.fcurves:
+                        for Keyframe in FCurve.keyframe_points:
+                            if Keyframe.co[0] < Scene.frame_start:
+                                keyframeTimes.add(Scene.frame_start)
+                            elif Keyframe.co[0] > Scene.frame_end:
+                                keyframeTimes.add(Scene.frame_end)
+                            else:
+                                keyframeTimes.add(int(Keyframe.co[0]))
+                else:
+                    # Exports all frame
+                    keyframeTimes.update(range(Scene.frame_start, Scene.frame_end + 1, 1))
+                   
+                keyframeTimes = list(keyframeTimes)
+                keyframeTimes.sort()
+                if Config.Verbose:
+                    print("Exporting frames: ")
+                    print(keyframeTimes)
+                    if (Scene.frame_preview_end > Scene.frame_end):
+                        print(" WARNING: END Frame of animation in UI preview is Higher than the Scene Frame end:\n Scene.frame_end %d versus Scene.frame_preview_end %d.\n"
+                              % (Scene.frame_end, Scene.frame_preview_end))
+                        print(" => You might need to change the Scene End Frame, to match the current UI preview frame end...\n=> if you don't want to miss end of animation.\n")
+
+                if len(keyframeTimes):
+                    #Create the anim file
+                    animfullname = os.path.dirname(Config.FilePath) + "\\anims\\%s.anim" % animFileName
+                    ensure_dir(animfullname)
+                    if Config.Verbose:
+                        print("      Creating anim file (bones animation) %s\n" % (animfullname))
+                        print("      Frame count %d \n" % (len(keyframeTimes)))
+                    animFile = open(animfullname, "w")
+                    animFile.write('// anim file exported from : %r\n' % os.path.basename(bpy.data.filepath))   
+                    animFile.write("CIwAnim\n")
+                    animFile.write("{\n")
+                    animFile.write("\tskeleton \"%s\"\n" % (StripName(Object.name)))
+                    animFile.write("\t\t\n")
+
+                    Config.File.write("\t\".\\anims\\%s.anim\"\n" % animFileName)
+
+                    for KeyframeTime in keyframeTimes:
+                        if Config.Verbose:
+                            print("     Writing Frame %d:" % KeyframeTime)
+                        animFile.write("\tCIwAnimKeyFrame\n")
+                        animFile.write("\t{\n")
+                        animFile.write("\t\ttime %.2f // frame num %d \n" % (KeyframeTime / Config.AnimFPS, KeyframeTime))
+                        #for every frame write bones positions
+                        Scene.frame_set(KeyframeTime)
+                        for PoseBone in PoseBones:
+                            if Config.Verbose:
+                                print("      Writing Bone: {}...".format(PoseBone.name))
+                            animFile.write("\t\t\n")
+
+                            Bone = Bones[PoseBone.name]
+                            WriteBonePosition(Config, Object, Bone, PoseBones, PoseBone, animFile, False)
+                        #keyframe done
+                        animFile.write("\t}\n")
+                    animFile.write("}\n")
+                    animFile.close()
+            else:
+                if Config.Verbose:
+                    print("    Object %s has no useable animation data." % (StripName(Object.name)))
+        if Config.ExportAnimationActions == 1:
+            #set back the original default animation
+            Object.animation_data.action = DefaultAction
+        if Config.Verbose:
+            print("  Done") #Done with Object
+ 
+
+                                
+ 
+################## Utilities
+            
+def StripBoneName(name):
+    return name.replace(" ", "")
+
+
+def StripName(Name):
+    
+    def ReplaceSet(String, OldSet, NewChar):
+        for OldChar in OldSet:
+            String = String.replace(OldChar, NewChar)
+        return String
+    
+    import string
+    
+    NewName = ReplaceSet(Name, string.punctuation + " ", "_")
+    return NewName
+
+
+def ensure_dir(f):
+    d = os.path.dirname(f)
+    if not os.path.exists(d):
+        os.makedirs(d)
+        
+
+def CloseFile(Config):
+    if Config.Verbose:
+        print("Closing File...")
+    Config.File.close()
+    if Config.Verbose:
+        print("Done")
+
+
+CoordinateSystems = (
+    ("1", "Left-Handed", ""),
+    ("2", "Right-Handed", ""),
+    )
+
+
+AnimationFrameModes = (
+    ("0", "None", ""),
+    ("1", "Keyframes Only", ""),
+    ("2", "Full Animation", ""),
+    )
+
+AnimationActions = (
+    ("0", "Default Animation", ""),
+    ("1", "All Animations", ""),
+    )
+
+ExportModes = (
+    ("1", "All Objects", ""),
+    ("2", "Selected Objects", ""),
+    )
+
+MergeModes = (
+    ("0", "None", ""),
+    ("1", "Merge in one big Mesh", ""),
+    ("2", "Merge in unique Geo File containing several meshes", ""),
+    )
+
+
+from bpy.props import StringProperty, EnumProperty, BoolProperty, IntProperty
+
+
+class MarmaladeExporter(bpy.types.Operator):
+    """Export to the Marmalade model format (.group)"""
+
+    bl_idname = "export.marmalade"
+    bl_label = "Export Marmalade"
+
+    filepath = StringProperty(subtype='FILE_PATH')
+     #Export Mode
+    ExportMode = EnumProperty(
+        name="Export",
+        description="Select which objects to export. Only Mesh, Empty, " \
+                    "and Armature objects will be exported",
+        items=ExportModes,
+        default="1")
+
+    MergeModes = EnumProperty(
+        name="Merge",
+        description="Select if objects should be merged in one Geo File (it can be usefull if a scene is done by several cube/forms)." \
+                    "Do not merge rigged character that have an armature.",
+        items=MergeModes,
+        default="0")
+    
+    #General Options
+    Scale = IntProperty(
+        name="Scale Percent",
+        description="Scale percentage applied for export",
+        default=100, min=1, max=1000)
+    
+    FlipNormals = BoolProperty(
+        name="Flip Normals",
+        description="",
+        default=False)
+    ApplyModifiers = BoolProperty(
+        name="Apply Modifiers",
+        description="Apply object modifiers before export",
+        default=False)
+    ExportVertexColors = BoolProperty(
+        name="Export Vertices Colors",
+        description="Export colors set on vertices, if any",
+        default=True)
+    ExportMaterialColors = BoolProperty(
+        name="Export Material Colors",
+        description="Ambient color is exported on the Material",
+        default=True)
+    ExportTextures = BoolProperty(
+        name="Export Textures and UVs",
+        description="Exports UVs and Reference external image files to be used by the model",
+        default=True)
+    CopyTextureFiles = BoolProperty(
+        name="Copy Textures Files",
+        description="Copy referenced Textures files in the models\\textures directory",
+        default=True)
+    ExportArmatures = BoolProperty(
+        name="Export Armatures",
+        description="Export the bones of any armatures to deform meshes",
+        default=True)
+    ExportAnimationFrames = EnumProperty(
+        name="Animations Frames",
+        description="Select the type of animations to export. Only object " \
+                    "and armature bone animations can be exported. Keyframes exports only the keyed frames" \
+                    "Full Animation exports every frames, None disables animationq export. ",
+        items=AnimationFrameModes,
+        default="1")
+    ExportAnimationActions = EnumProperty(
+        name="Animations Actions",
+        description="By default only the Default Animation Action assoiated to an armature is exported." \
+                    "However if you have defined several animations on the same armature,"\
+                    "you can select to export all animations. You can see the list of animation actions in the DopeSheet window.",
+        items=AnimationActions,
+        default="0")
+    if bpy.context.scene:
+        defFPS = bpy.context.scene.render.fps
+    else:
+        defFPS = 30                 
+    AnimFPS = IntProperty(
+        name="Animation FPS",
+        description="Frame rate used to export animation in seconds (can be used to artficially slow down the exported animation, or to speed up it",
+        default=defFPS, min=1, max=300)
+
+    #Advance Options
+    CoordinateSystem = EnumProperty(
+        name="System",
+        description="Select a coordinate system to export to",
+        items=CoordinateSystems,
+        default="1")
+    
+    Verbose = BoolProperty(
+        name="Verbose",
+        description="Run the exporter in debug mode. Check the console for output",
+        default=True)
+
+    def execute(self, context):
+        #Append .group
+        FilePath = bpy.path.ensure_ext(self.filepath, ".group")
+
+        Config = MarmaladeExporterSettings(context,
+                                         FilePath,
+                                         CoordinateSystem=self.CoordinateSystem,
+                                         FlipNormals=self.FlipNormals,
+                                         ApplyModifiers=self.ApplyModifiers,
+                                         Scale=self.Scale,
+                                         AnimFPS=self.AnimFPS,
+                                         ExportVertexColors=self.ExportVertexColors,
+                                         ExportMaterialColors=self.ExportMaterialColors,
+                                         ExportTextures=self.ExportTextures,
+                                         CopyTextureFiles=self.CopyTextureFiles,
+                                         ExportArmatures=self.ExportArmatures,
+                                         ExportAnimationFrames=self.ExportAnimationFrames,
+                                         ExportAnimationActions=self.ExportAnimationActions,
+                                         ExportMode=self.ExportMode,
+                                         MergeModes=self.MergeModes,
+                                         Verbose=self.Verbose)
+
+        # Exit edit mode before exporting, so current object states are exported properly.
+        if bpy.ops.object.mode_set.poll():
+            bpy.ops.object.mode_set(mode='OBJECT')
+
+        ExportMadeWithMarmaladeGroup(Config)
+        return {"FINISHED"}
+
+    def invoke(self, context, event):
+        if not self.filepath:
+            self.filepath = bpy.path.ensure_ext(bpy.data.filepath, ".group")
+        WindowManager = context.window_manager
+        WindowManager.fileselect_add(self)
+        return {"RUNNING_MODAL"}
+
+
+def menu_func(self, context):
+    self.layout.operator(MarmaladeExporter.bl_idname, text="Marmalade cross-platform Apps (.group)")
+
+
+def register():
+    bpy.utils.register_module(__name__)
+
+    bpy.types.INFO_MT_file_export.append(menu_func)
+
+
+def unregister():
+    bpy.utils.unregister_module(__name__)
+
+    bpy.types.INFO_MT_file_export.remove(menu_func)
+
+
+if __name__ == "__main__":
+    register()
diff --git a/release/scripts/addons_contrib/io_import_lipSync_Importer.py b/release/scripts/addons_contrib/io_import_lipSync_Importer.py
index 15fa644..ebdf860 100644
--- a/release/scripts/addons_contrib/io_import_lipSync_Importer.py
+++ b/release/scripts/addons_contrib/io_import_lipSync_Importer.py
@@ -480,4 +480,4 @@ def unregister():
     clear_properties()
 
 if __name__ == "__main__":
-    register()
\ No newline at end of file
+    register()
diff --git a/release/scripts/addons_contrib/io_mesh_xyz/__init__.py b/release/scripts/addons_contrib/io_mesh_xyz/__init__.py
index e858d8f..0e870fc 100644
--- a/release/scripts/addons_contrib/io_mesh_xyz/__init__.py
+++ b/release/scripts/addons_contrib/io_mesh_xyz/__init__.py
@@ -20,17 +20,19 @@ bl_info = {
     "name": "XYZ Atomic Blender",
     "description": "Loading and manipulating atoms from XYZ files",
     "author": "Clemens Barth",
-    "version": (0,5),
+    "version": (0,6),
     "blender": (2,6),
     "location": "File -> Import -> XYZ (.xyz), Panel: View 3D - Tools",
     "warning": "",
-    "wiki_url": "http://development.root-1.de/Atomic_Blender.php",
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/"
+                "Import-Export/XYZ",
     "tracker_url": "http://projects.blender.org/tracker/"
                    "index.php?func=detail&aid=29646&group_id=153&atid=468",
     "category": "Import-Export"
 }
 
-
+import os
+import io
 import bpy
 from bpy.types import Operator, Panel
 from bpy_extras.io_utils import ImportHelper
@@ -40,10 +42,10 @@ from bpy.props import (StringProperty,
                        IntProperty,
                        FloatProperty)
 
-
-
 from . import import_xyz
 ATOM_XYZ_ERROR = ""
+ATOM_XYZ_NOTE  = ""
+ATOM_XYZ_PANEL = ""
 
 # -----------------------------------------------------------------------------
 #                                                                           GUI
@@ -52,100 +54,99 @@ ATOM_XYZ_ERROR = ""
 # 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  = "PROPERTIES"
-    #bl_region_type = "WINDOW"
-    #bl_context     = "physics"
-    # This could be also an option ... :
     bl_space_type  = "VIEW_3D"
     bl_region_type = "TOOL_PROPS"
 
     @classmethod
     def poll(self, context):
-        if import_xyz.ATOM_XYZ_FILEPATH == "":
+        global ATOM_XYZ_PANEL
+        
+        if ATOM_XYZ_PANEL == "0" and import_xyz.ATOM_XYZ_FILEPATH == "":
             return False
-        else:
+        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
-        scn    = bpy.context.scene
+
+        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, "atom_xyz_datafile")
+        col.prop(scn, "datafile")
         col.operator("atom_xyz.datafile_apply")
         row = box.row()
         col = row.column(align=True)
-        col.prop(scn, "atom_xyz_XYZ_file")
+        col.prop(scn, "XYZ_file")
         row = box.row()
-        # TODO, use lanel() instead
-        row.prop(scn, "atom_xyz_number_atoms")
+        row.prop(scn, "number_atoms")
         row = box.row()
         row.operator("atom_xyz.button_distance")
-        row.prop(scn, "atom_xyz_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, "atom_xyz_radius_how")
-
+        row.prop(scn, "radius_how")
         row = box.row()
         row.label(text="1. Change type of radii")
         row = box.row()
-        row.prop(scn, "atom_xyz_radius_type")
-
+        row.prop(scn, "radius_type")
         row = box.row()
         row.label(text="2. Change atom radii in pm")
         row = box.row()
-        row.prop(scn, "atom_xyz_radius_pm_name")
+        row.prop(scn, "radius_pm_name")
         row = box.row()
-        row.prop(scn, "atom_xyz_radius_pm")
-
+        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, "atom_xyz_radius_all")
+        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, "atom_xyz_number_frames")
+        col.prop(scn, "number_frames")
         row = box.row()
         col = row.column()
         col.label(text="Skip frames")
         col = row.column()
-        col.prop(scn, "atom_xyz_skip_frames")
+        col.prop(scn, "skip_frames")
         row = box.row()
         col = row.column()
         col.label(text="Frames/key")
         col = row.column()
-        col.prop(scn, "atom_xyz_images_per_key")        
-        
+        col.prop(scn, "images_per_key")        
         row = box.row()
         row.operator("atom_xyz.load_frames")
         row = box.row()
@@ -156,106 +157,99 @@ class CLASS_atom_xyz_prepare_panel(Panel):
         row.operator( "atom_xyz.render")
 
 
-class CLASS_atom_xyz_IO(bpy.types.PropertyGroup):
+class CLASS_atom_xyz_Properties(bpy.types.PropertyGroup):
 
     def Callback_radius_type(self, context):
-        scnn = bpy.context.scene
+        scn = bpy.context.scene.atom_xyz[0]
         import_xyz.DEF_atom_xyz_radius_type(
-                scnn.atom_xyz_radius_type,
-                scnn.atom_xyz_radius_how,
-                )
+                scn.radius_type,
+                scn.radius_how,)
 
     def Callback_radius_pm(self, context):
-        scnn = bpy.context.scene
+        scn = bpy.context.scene.atom_xyz[0]
         import_xyz.DEF_atom_xyz_radius_pm(
-                scnn.atom_xyz_radius_pm_name,
-                scnn.atom_xyz_radius_pm,
-                scnn.atom_xyz_radius_how,
-                )
+                scn.radius_pm_name,
+                scn.radius_pm,
+                scn.radius_how,)
 
     # In the file dialog window
-    scn = bpy.types.Scene
-    scn.use_atom_xyz_cam = BoolProperty(
+    use_camera = BoolProperty(
         name="Camera", default=False,
         description="Do you need a camera?")
-    scn.use_atom_xyz_lamp = BoolProperty(
+    use_lamp = BoolProperty(
         name="Lamp", default=False,
         description = "Do you need a lamp?")
-    scn.use_atom_xyz_mesh = BoolProperty(
+    use_mesh = BoolProperty(
         name = "Mesh balls", default=False,
         description = "Do you want to use mesh balls instead of NURBS?")
-    scn.atom_xyz_mesh_azimuth = IntProperty(
+    mesh_azimuth = IntProperty(
         name = "Azimuth", default=32, min=0,
         description = "Number of sectors (azimuth)")
-    scn.atom_xyz_mesh_zenith = IntProperty(
+    mesh_zenith = IntProperty(
         name = "Zenith", default=32, min=0,
         description = "Number of sectors (zenith)")
-    scn.atom_xyz_scale_ballradius = FloatProperty(
+    scale_ballradius = FloatProperty(
         name = "Balls", default=1.0, min=0.0,
         description = "Scale factor for all atom radii")
-    scn.atom_xyz_scale_distances = FloatProperty (
+    scale_distances = FloatProperty (
         name = "Distances", default=1.0, min=0.0,
         description = "Scale factor for all distances")
-    scn.use_atom_xyz_center = BoolProperty(
+    use_center = BoolProperty(
         name = "Object to origin", default=False,
         description = "Shall the object first put into the global origin "
         "before applying the offsets on the left?")
-    scn.atom_xyz_atomradius = EnumProperty(
+    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
-    scn.atom_xyz_datafile = StringProperty(
+    datafile = StringProperty(
         name = "", description="Path to your custom data file",
         maxlen = 256, default = "", subtype='FILE_PATH')
-    scn.atom_xyz_XYZ_file = StringProperty(
+    XYZ_file = StringProperty(
         name = "Path to file", default="",
         description = "Path of the XYZ file")
-    # TODO, remove this property, its used for display only!
-    scn.atom_xyz_number_atoms = StringProperty(name="",
+    number_atoms = StringProperty(name="",
         default="Number", description = "This output shows "
         "the number of atoms which have been loaded")
-    scn.atom_xyz_distance = StringProperty(
+    distance = StringProperty(
         name="", default="Distance (A)",
         description="Distance of 2 objects in Angstrom")
-    scn.atom_xyz_radius_how = EnumProperty(
+    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',)
-    scn.atom_xyz_radius_type = EnumProperty(
+    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)
-    scn.atom_xyz_radius_pm_name = StringProperty(
+    radius_pm_name = StringProperty(
         name="", default="Atom name",
         description="Put in the name of the atom (e.g. Hydrogen)")
-    scn.atom_xyz_radius_pm = FloatProperty(
+    radius_pm = FloatProperty(
         name="", default=100.0, min=0.0,
         description="Put in the radius of the atom (in pm)",
         update=Callback_radius_pm)
-    scn.atom_xyz_radius_all = FloatProperty(
-        name="Scale", default = 1.05, min=1.0,
+    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
-    scn.atom_xyz_number_frames = StringProperty(
+    number_frames = StringProperty(
         name="", default="0",
         description="This is the total number of frames stored in the xyz file")
-    scn.atom_xyz_skip_frames = IntProperty(
+    skip_frames = IntProperty(
         name="", default=0, min=0,
         description="Number of frames you want to skip.")
-    scn.atom_xyz_images_per_key = IntProperty(
-        name="", default=1, min=0,
+    images_per_key = IntProperty(
+        name="", default=1, min=1,
         description="Choose the number of images between 2 keys.")
 
 
@@ -268,7 +262,7 @@ class CLASS_atom_xyz_create_command(Operator):
 
     def execute(self, context):
         global ATOM_XYZ_ERROR
-        import os
+        global ATOM_XYZ_NOTE
  
         scn = bpy.context.scene
 
@@ -308,7 +302,6 @@ class CLASS_atom_xyz_create_command(Operator):
             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)
@@ -331,6 +324,9 @@ class CLASS_atom_xyz_create_command(Operator):
             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'}
 
@@ -343,8 +339,6 @@ class CLASS_atom_xyz_render(Operator):
 
     def execute(self, context):
         global ATOM_XYZ_ERROR
-        import os
- 
         scn = bpy.context.scene
 
         fstart = scn.frame_start
@@ -398,8 +392,7 @@ class CLASS_atom_xyz_render(Operator):
             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
-            
-        #print(os_str)    
+             
         os.system(os_str)    
         
         return {'FINISHED'}
@@ -412,9 +405,7 @@ class CLASS_atom_xyz_delete_keys(Operator):
     bl_description = "Delete the shape keys"
 
     def execute(self, context):
-    
         for element in import_xyz.STRUCTURE:
-        
             if element.data.shape_keys == None:
                 break
         
@@ -423,10 +414,8 @@ class CLASS_atom_xyz_delete_keys(Operator):
             element.select = True
         
             for key in element.data.shape_keys.key_blocks:
-            
                 bpy.ops.object.shape_key_remove()
         
-
         return {'FINISHED'}
 
 
@@ -438,8 +427,7 @@ class CLASS_atom_xyz_load_frames(Operator):
 
     def execute(self, context):
         global ATOM_XYZ_ERROR
-    
-        scn = bpy.context.scene
+        scn = bpy.context.scene.atom_xyz[0]
         
         KEYS_PRESENT = False
         for element in import_xyz.STRUCTURE:
@@ -456,7 +444,8 @@ class CLASS_atom_xyz_load_frames(Operator):
             return {'FINISHED'}
         
         
-        import_xyz.DEF_atom_xyz_build_frames(scn.atom_xyz_images_per_key, scn.atom_xyz_skip_frames)
+        import_xyz.DEF_atom_xyz_build_frames(scn.images_per_key, 
+                                             scn.skip_frames)
 
         return {'FINISHED'}
 
@@ -469,13 +458,12 @@ class CLASS_atom_xyz_datafile_apply(Operator):
     bl_description = "Use color and radii values stored in the custom file"
 
     def execute(self, context):
-    
-        scn = bpy.context.scene
+        scn = bpy.context.scene.atom_xyz[0]
 
-        if scn.atom_xyz_datafile == "":
+        if scn.datafile == "":
             return {'FINISHED'}
 
-        import_xyz.DEF_atom_xyz_custom_datafile(scn.atom_xyz_datafile)
+        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:
@@ -503,7 +491,7 @@ class CLASS_atom_xyz_separate_atom(Operator):
     bl_description = "Separate the atom you have chosen"
 
     def execute(self, context):
-        scn    = bpy.context.scene
+        scn = bpy.context.scene.atom_xyz[0]
 
         # Get first all important properties from the atom which the user
         # has chosen: location, color, scale
@@ -524,13 +512,13 @@ class CLASS_atom_xyz_separate_atom(Operator):
         # ... delete the new mesh including the separated vertex
         bpy.ops.object.select_all(action='DESELECT')
         new_object.select = True
-        bpy.ops.object.delete()  # TODO, use scene.objects.unlink()
+        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_atom_xyz_mesh == False:
+            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,
@@ -538,8 +526,8 @@ class CLASS_atom_xyz_separate_atom(Operator):
                                     layers=current_layers)
             else:
                 bpy.ops.mesh.primitive_uv_sphere_add(
-                                segments=scn.atom_xyz_mesh_azimuth,
-                                ring_count=scn.atom_xyz_mesh_zenith,
+                                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),
@@ -575,8 +563,8 @@ class CLASS_atom_xyz_distance_button(Operator):
     bl_description = "Measure the distance between two objects"
 
     def execute(self, context):
-        scn    = bpy.context.scene
-        dist   = import_xyz.DEF_atom_xyz_distance()
+        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
@@ -587,7 +575,7 @@ class CLASS_atom_xyz_distance_button(Operator):
            dist   = dist + " A"
 
         # Put the distance into the string of the output field.
-        scn.atom_xyz_distance = dist
+        scn.distance = dist
         return {'FINISHED'}
 
 
@@ -598,10 +586,10 @@ class CLASS_atom_xyz_radius_all_bigger_button(Operator):
     bl_description = "Increase the radii of the atoms"
 
     def execute(self, context):
-        scn = bpy.context.scene
+        scn = bpy.context.scene.atom_xyz[0]
         import_xyz.DEF_atom_xyz_radius_all(
-                scn.atom_xyz_radius_all,
-                scn.atom_xyz_radius_how,
+                scn.radius_all,
+                scn.radius_how,
                 )
         return {'FINISHED'}
 
@@ -613,52 +601,157 @@ class CLASS_atom_xyz_radius_all_smaller_button(Operator):
     bl_description = "Decrease the radii of the atoms"
 
     def execute(self, context):
-        scn = bpy.context.scene
+        scn = bpy.context.scene.atom_xyz[0]
         import_xyz.DEF_atom_xyz_radius_all(
-                1.0/scn.atom_xyz_radius_all,
-                scn.atom_xyz_radius_how,
+                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 ImportXYZ(Operator, ImportHelper):
+class CLASS_ImportXYZ(Operator, ImportHelper):
     bl_idname = "import_mesh.xyz"
     bl_label  = "Import XYZ (*.xyz)"
-
+    bl_options = {'PRESET', 'UNDO'}
+    
     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")
+    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")
+    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',)            
+    use_center = BoolProperty(
+        name = "Object to origin", default=True,
+        description = "Put the object into the global origin")           
+    datafile = StringProperty(
+        name = "", description="Path to your custom data file",
+        maxlen = 256, default = "", subtype='FILE_PATH')    
+
     def draw(self, context):
         layout = self.layout
-        scn = bpy.context.scene
-
         row = layout.row()
-        row.prop(scn, "use_atom_xyz_cam")
-        row.prop(scn, "use_atom_xyz_lamp")
+        row.prop(self, "use_camera")
+        row.prop(self, "use_lamp")
         row = layout.row()
         col = row.column()
-        col.prop(scn, "use_atom_xyz_mesh")
+        col.prop(self, "use_mesh")
         col = row.column(align=True)
-        col.prop(scn, "atom_xyz_mesh_azimuth")
-        col.prop(scn, "atom_xyz_mesh_zenith")
-
+        col.prop(self, "mesh_azimuth")
+        col.prop(self, "mesh_zenith")
         row = layout.row()
         col = row.column()
         col.label(text="Scaling factors")
         col = row.column(align=True)
-        col.prop(scn, "atom_xyz_scale_ballradius")
-        col.prop(scn, "atom_xyz_scale_distances")
-
+        col.prop(self, "scale_ballradius")
+        col.prop(self, "scale_distances")
         row = layout.row()
-        row.prop(scn, "use_atom_xyz_center")
-
+        row.prop(self, "use_center")
         row = layout.row()
-        row.prop(scn, "atom_xyz_atomradius")
+        row.prop(self, "atomradius")
+        row = layout.row()
+        row.prop(bpy.context.scene, "use_panel")
 
     def execute(self, context):
-        scn = bpy.context.scene
         
         import_xyz.ALL_FRAMES[:] = []
         import_xyz.NUMBER_FRAMES = 0
@@ -669,55 +762,55 @@ class ImportXYZ(Operator, ImportHelper):
         # This is in order to solve this strange 'relative path' thing.
         import_xyz.ATOM_XYZ_FILEPATH = bpy.path.abspath(self.filepath)
 
-        scn.atom_xyz_XYZ_file = import_xyz.ATOM_XYZ_FILEPATH
-
-        azimuth    = scn.atom_xyz_mesh_azimuth
-        zenith     = scn.atom_xyz_mesh_zenith
-        bradius    = scn.atom_xyz_scale_ballradius
-        bdistance  = scn.atom_xyz_scale_distances
-        radiustype = scn.atom_xyz_atomradius
-        center     = scn.use_atom_xyz_center
-        cam        = scn.use_atom_xyz_cam
-        lamp       = scn.use_atom_xyz_lamp
-        mesh       = scn.use_atom_xyz_mesh
-        datafile   = scn.atom_xyz_datafile
-
         # Execute main routine
         atom_number = import_xyz.DEF_atom_xyz_main(
-                mesh, azimuth, zenith, bradius,
-                radiustype, bdistance, 
-                center, cam, lamp, datafile)
-
-        scn.atom_xyz_number_atoms = str(atom_number) + " atoms"
-        scn.atom_xyz_number_frames = str(import_xyz.NUMBER_FRAMES)
-        
-        return {'FINISHED'}
+                      self.use_mesh,
+                      self.mesh_azimuth,
+                      self.mesh_zenith,
+                      self.scale_ballradius,
+                      self.atomradius,
+                      self.scale_distances,
+                      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_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_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
+
+        global ATOM_XYZ_PANEL
+        ATOM_XYZ_PANEL = bpy.context.scene.use_panel
+        DEF_panel_write_pref(bpy.context.scene.use_panel)
         
-   
-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)
         
 
 # The entry into the menu 'file -> import'
 def menu_func(self, context):
-    self.layout.operator(ImportXYZ.bl_idname, text="XYZ (.xyz)")
+    self.layout.operator(CLASS_ImportXYZ.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()
+    
 def unregister():
     bpy.utils.unregister_module(__name__)
     bpy.types.INFO_MT_file_import.remove(menu_func)
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 a126db3..d9f9499 100644
--- a/release/scripts/addons_contrib/io_mesh_xyz/import_xyz.py
+++ b/release/scripts/addons_contrib/io_mesh_xyz/import_xyz.py
@@ -25,7 +25,7 @@
 #
 #  Start of project              : 2011-12-01 by Clemens Barth
 #  First publication in Blender  : 2011-12-18
-#  Last modified                 : 2011-12-18
+#  Last modified                 : 2012-04-18
 #
 #  Acknowledgements: Thanks to ideasman, meta_androcto, truman, kilon,
 #  dairin0d, PKHG, Valter, etc
@@ -248,14 +248,12 @@ def DEF_atom_xyz_radius_type(rtype,how):
         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:
@@ -292,13 +290,11 @@ def DEF_atom_xyz_radius_pm(atomname, radius_pm, how):
         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":
@@ -330,14 +326,11 @@ def DEF_atom_xyz_radius_all(scale, how):
         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":
@@ -356,7 +349,6 @@ def DEF_atom_xyz_radius_all(scale, how):
                     obj.scale *= scale
 
 
-
 def DEF_atom_xyz_read_elements():
 
     ATOM_XYZ_ELEMENTS[:] = []
@@ -374,8 +366,6 @@ def DEF_atom_xyz_read_elements():
         ATOM_XYZ_ELEMENTS.append(li)
 
 
-
-
 def DEF_atom_xyz_read_xyz_file(filepath,radiustype):
 
     global NUMBER_FRAMES
@@ -404,13 +394,11 @@ def DEF_atom_xyz_read_xyz_file(filepath,radiustype):
             comment = line
             
             all_atoms= []
-            
             for i in range(number_atoms):
             
                 line = ATOM_XYZ_FILEPATH_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.
@@ -468,7 +456,6 @@ def DEF_atom_xyz_read_xyz_file(filepath,radiustype):
                         # atom name (e.g. 'Sodium') and its color.
                         elements.append(atom[1])
             
-            
             structure = []
             for element in elements:
                 atoms_one_type = []
@@ -482,7 +469,6 @@ def DEF_atom_xyz_read_xyz_file(filepath,radiustype):
                                                            atom[4],[]))
                 structure.append(atoms_one_type)
 
- 
             ALL_FRAMES.append(structure)
             NUMBER_FRAMES += 1
             FLAG = False
@@ -496,13 +482,9 @@ def DEF_atom_xyz_read_xyz_file(filepath,radiustype):
                 print(atom.element + "	" + str(atom.location))
         print()    
     """
-    
     return number_atoms
 
 
-
-
-
 # This reads a custom data file.
 def DEF_atom_xyz_custom_datafile(path_datafile):
 
@@ -526,7 +508,6 @@ def DEF_atom_xyz_custom_datafile(path_datafile):
         if "Atom" in line:
 
             line = data_file_p.readline()
-
             # Number
             line = data_file_p.readline()
             number = line[19:-1]
@@ -551,7 +532,6 @@ def DEF_atom_xyz_custom_datafile(path_datafile):
             # Van der Waals radius
             line = data_file_p.readline()
             radius_vdW = float(line[19:-1])
-
             radii = [radius_used,radius_atomic,radius_vdW]
             radii_ionic = []
 
@@ -564,15 +544,19 @@ def DEF_atom_xyz_custom_datafile(path_datafile):
 
     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, use_camera,use_lamp,path_datafile):
-
+def DEF_atom_xyz_main(use_mesh,
+                      Ball_azimuth,
+                      Ball_zenith,
+                      Ball_radius_factor,
+                      radiustype,
+                      Ball_distance_factor,
+                      put_to_center, 
+                      use_camera,
+                      use_lamp,
+                      path_datafile):
 
     # List of materials
     atom_material_list = []
@@ -585,19 +569,15 @@ def DEF_atom_xyz_main(use_mesh,Ball_azimuth,Ball_zenith,
     # ------------------------------------------------------------------------
     # READING DATA OF ATOMS
 
-
     Number_of_total_atoms = DEF_atom_xyz_read_xyz_file(ATOM_XYZ_FILEPATH, 
                                                        radiustype)
                                                
     # We show the atoms of the first frame.
     first_frame = ALL_FRAMES[0]
 
-
     # ------------------------------------------------------------------------
     # MATERIAL PROPERTIES FOR ATOMS
 
-
-
     # Create first a new list of materials for each type of atom
     # (e.g. hydrogen)
     for atoms_of_one_type in first_frame:
@@ -628,17 +608,13 @@ def DEF_atom_xyz_main(use_mesh,Ball_azimuth,Ball_zenith,
                     # The atom gets its properties.
                     atom.material = material
 
-
-
     # ------------------------------------------------------------------------
     # TRANSLATION OF THE STRUCTURE TO THE ORIGIN
 
-
     # It may happen that the structure in a XYZ file already has an offset
     # If chosen, the structure is first put into the center of the scene
     # (the offset is substracted).
 
-    
     if put_to_center == True:
 
         sum_vec = Vector((0.0,0.0,0.0))
@@ -655,21 +631,17 @@ def DEF_atom_xyz_main(use_mesh,Ball_azimuth,Ball_zenith,
             for atom in atoms_of_one_type:
                 atom.location -= sum_vec
     
-
     # ------------------------------------------------------------------------
     # SCALING
 
-    
     # Take all atoms and adjust their radii and scale the distances.
     for atoms_of_one_type in first_frame:
         for atom in atoms_of_one_type:
             atom.location *= Ball_distance_factor
     
-
     # ------------------------------------------------------------------------
     # DETERMINATION OF SOME GEOMETRIC PROPERTIES
 
-
     # In the following, some geometric properties of the whole object are
     # determined: center, size, etc.
     sum_vec = Vector((0.0,0.0,0.0))
@@ -692,10 +664,8 @@ def DEF_atom_xyz_main(use_mesh,Ball_azimuth,Ball_zenith,
     object_size = 0.0
     object_size = max(object_size_vec).length
 
-
     # ------------------------------------------------------------------------
     # CAMERA AND LAMP
-
     camera_factor = 15.0
 
     # If chosen a camera is put into the scene.
@@ -748,14 +718,12 @@ def DEF_atom_xyz_main(use_mesh,Ball_azimuth,Ball_zenith,
                                  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:
 
@@ -787,29 +755,22 @@ def DEF_atom_xyz_main(use_mesh,Ball_azimuth,Ball_zenith,
         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        : ", object_center_vec)
-    print("Size of object          : ", object_size)
+    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
 
-
     bpy.ops.object.select_all(action='DESELECT')
 
     # For each list of atoms of ONE type (e.g. Hydrogen)
@@ -871,28 +832,22 @@ def DEF_atom_xyz_main(use_mesh,Ball_azimuth,Ball_zenith,
 
     print()
 
-
     # ------------------------------------------------------------------------
     # SELECT ALL LOADED OBJECTS
     
-    
     bpy.ops.object.select_all(action='DESELECT')
     obj = None
     for obj in STRUCTURE:
         obj.select = True
-
     # 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):
 
     scn = bpy.context.scene
@@ -920,7 +875,8 @@ def DEF_atom_xyz_build_frames(frame_delta, frame_skip):
     
                 for atom_frame, atom_structure in zip(elements_frame, key.data):
     
-                    atom_structure.co = atom_frame.location - elements_structure.location
+                    atom_structure.co = (atom_frame.location 
+                                       - elements_structure.location)
     
                 key.name = atom_frame.name + "_frame_" + str(i) 
 
@@ -938,7 +894,6 @@ def DEF_atom_xyz_build_frames(frame_delta, frame_skip):
 
         element.data.shape_keys.key_blocks[1].value = 1.0
         element.data.shape_keys.key_blocks[2].value = 0.0
-
         element.data.shape_keys.key_blocks[1].keyframe_insert("value")     
         element.data.shape_keys.key_blocks[2].keyframe_insert("value")         
 
@@ -949,7 +904,6 @@ def DEF_atom_xyz_build_frames(frame_delta, frame_skip):
             element.data.shape_keys.key_blocks[number-1].value = 0.0
             element.data.shape_keys.key_blocks[number].value = 1.0
             element.data.shape_keys.key_blocks[number+1].value = 0.0
-
             element.data.shape_keys.key_blocks[number-1].keyframe_insert("value")     
             element.data.shape_keys.key_blocks[number].keyframe_insert("value")     
             element.data.shape_keys.key_blocks[number+1].keyframe_insert("value")         
@@ -960,7 +914,6 @@ def DEF_atom_xyz_build_frames(frame_delta, frame_skip):
             
         element.data.shape_keys.key_blocks[number].value = 1.0
         element.data.shape_keys.key_blocks[number-1].value = 0.0
-        
         element.data.shape_keys.key_blocks[number].keyframe_insert("value")     
         element.data.shape_keys.key_blocks[number-1].keyframe_insert("value")    
         
diff --git a/release/scripts/addons_contrib/io_scene_cod/__init__.py b/release/scripts/addons_contrib/io_scene_cod/__init__.py
new file mode 100644
index 0000000..00776ba
--- /dev/null
+++ b/release/scripts/addons_contrib/io_scene_cod/__init__.py
@@ -0,0 +1,475 @@
+# ##### 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>
+
+"""
+Blender-CoD: Blender Add-On for Call of Duty modding
+Version: alpha 3
+
+Copyright (c) 2011 CoDEmanX, Flybynyt -- blender-cod at online.de
+
+http://code.google.com/p/blender-cod/
+
+TODO
+- UI for xmodel and xanim import (planned for alpha 4/5)
+
+"""
+
+bl_info = {
+    "name": "Blender-CoD - Add-On for Call of Duty modding (alpha 3)",
+    "author": "CoDEmanX, Flybynyt",
+    "version": (0, 3, 5),
+    "blender": (2, 62, 3),
+    "location": "File > Import  |  File > Export",
+    "description": "Export models to *.XMODEL_EXPORT and animations to *.XANIM_EXPORT",
+    "warning": "Alpha version, please report any bugs!",
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Import-Export/Call_of_Duty_IO",
+    "tracker_url": "http://projects.blender.org/tracker/index.php?func=detail&aid=30482",
+    "support": "TESTING",
+    "category": "Import-Export"
+}
+
+# To support reload properly, try to access a package var, if it's there, reload everything
+if "bpy" in locals():
+    import imp
+    if "import_xmodel" in locals():
+        imp.reload(import_xmodel)
+    if "export_xmodel" in locals():
+        imp.reload(export_xmodel)
+    if "import_xanim" in locals():
+        imp.reload(import_xanim)
+    if "export_xanim" in locals():
+        imp.reload(export_xanim)
+
+import bpy
+from bpy.props import BoolProperty, IntProperty, FloatProperty, StringProperty, EnumProperty
+import bpy_extras.io_utils
+from bpy_extras.io_utils import ExportHelper, ImportHelper
+import time
+
+# Planned for alpha 4/5
+class ImportXmodel(bpy.types.Operator, ImportHelper):
+    """Load a CoD XMODEL_EXPORT File"""
+    bl_idname = "import_scene.xmodel"
+    bl_label = "Import XMODEL_EXPORT"
+    bl_options = {'PRESET'}
+
+    filename_ext = ".XMODEL_EXPORT"
+    filter_glob = StringProperty(default="*.XMODEL_EXPORT", options={'HIDDEN'})
+
+    #use_meshes = BoolProperty(name="Meshes", description="Import meshes", default=True)
+    #use_armature = BoolProperty(name="Armature", description="Import Armature", default=True)
+    #use_bind_armature = BoolProperty(name="Bind Meshes to Armature", description="Parent imported meshes to armature", default=True)
+
+    #use_split_objects = BoolProperty(name="Object", description="Import OBJ Objects into Blender Objects", default=True)
+    #use_split_groups = BoolProperty(name="Group", description="Import OBJ Groups into Blender Objects", default=True)
+
+    #use_image_search = BoolProperty(name="Image Search", description="Search subdirs for any assosiated images (Warning, may be slow)", default=True)
+
+    def execute(self, context):
+        from . import import_xmodel
+        start_time = time.clock()
+        result = import_xmodel.load(self, context, **self.as_keywords(ignore=("filter_glob", "check_existing")))
+
+        if not result:
+            self.report({'INFO'}, "Import finished in %.4f sec." % (time.clock() - start_time))
+            return {'FINISHED'}
+        else:
+            self.report({'ERROR'}, result)
+            return {'CANCELLED'}
+
+    """
+    def draw(self, context):
+        layout = self.layout
+
+        col = layout.column()
+        col.prop(self, "use_meshes")
+        col.prop(self, "use_armature")
+
+        row = layout.row()
+        row.active = self.use_meshes and self.use_armature
+        row.prop(self, "use_bind_armature")
+    """
+
+    @classmethod
+    def poll(self, context):
+        return (context.scene is not None)
+
+class ImportXanim(bpy.types.Operator, ImportHelper):
+    """Load a CoD XANIM_EXPORT File"""
+    bl_idname = "import_scene.xanim"
+    bl_label = "Import XANIM_EXPORT"
+    bl_options = {'PRESET'}
+
+    filename_ext = ".XANIM_EXPORT"
+    filter_glob = StringProperty(default="*.XANIM_EXPORT;*.NT_EXPORT", options={'HIDDEN'})
+
+    def execute(self, context):
+        # print("Selected: " + context.active_object.name)
+        from . import import_xanim
+
+        return import_xanim.load(self, context, **self.as_keywords(ignore=("filter_glob",)))
+
+class ExportXmodel(bpy.types.Operator, ExportHelper):
+    """Save a CoD XMODEL_EXPORT File"""
+
+    bl_idname = "export_scene.xmodel"
+    bl_label = 'Export XMODEL_EXPORT'
+    bl_options = {'PRESET'}
+
+    filename_ext = ".XMODEL_EXPORT"
+    filter_glob = StringProperty(default="*.XMODEL_EXPORT", options={'HIDDEN'})
+
+    # List of operator properties, the attributes will be assigned
+    # to the class instance from the operator settings before calling.
+
+    use_version = EnumProperty(
+        name="Format Version",
+        description="XMODEL_EXPORT format version for export",
+        items=(('5', "Version 5", "vCoD, CoD:UO"),
+               ('6', "Version 6", "CoD2, CoD4, CoD5, CoD7")),
+        default='6',
+        )
+
+    use_selection = BoolProperty(
+        name="Selection only",
+        description="Export selected meshes only (object or weight paint mode)",
+        default=False
+        )
+
+    use_vertex_colors = BoolProperty(
+        name="Vertex colors",
+        description="Export vertex colors (if disabled, white color will be used)",
+        default=True
+        )
+
+    use_vertex_colors_alpha = BoolProperty(
+        name="As alpha",
+        description="Turn RGB vertex colors into grayscale (average value) and use it as alpha transparency. White is 1 (opaque), black 0 (invisible)",
+        default=False
+        )
+
+    use_apply_modifiers = BoolProperty(
+        name="Apply Modifiers",
+        description="Apply all mesh modifiers except Armature (preview resolution)",
+        default=True
+        )
+
+    use_armature = BoolProperty(
+        name="Armature",
+        description="Export bones (if disabled, only a 'tag_origin' bone will be written)",
+        default=True
+        )
+
+    use_vertex_cleanup = BoolProperty(
+        name="Clean up vertices",
+        description="Try this if you have problems converting to xmodel. Skips vertices which aren't used by any face and updates references.",
+        default=False
+        )
+
+    use_armature_pose = BoolProperty(
+        name="Pose animation to models",
+        description="Export meshes with Armature modifier applied as a series of XMODEL_EXPORT files",
+        default=False
+        )
+
+    use_frame_start = IntProperty(
+        name="Start",
+        description="First frame to export",
+        default=1,
+        min=0
+        )
+
+    use_frame_end = IntProperty(
+        name="End",
+        description="Last frame to export",
+        default=250,
+        min=0
+        )
+
+    use_weight_min = BoolProperty(
+        name="Minimum bone weight",
+        description="Try this if you get 'too small weight' errors when converting",
+        default=False,
+        )
+
+    use_weight_min_threshold = FloatProperty(
+        name="Threshold",
+        description="Smallest allowed weight (minimum value)",
+        default=0.010097,
+        min=0.0,
+        max=1.0,
+        precision=6
+        )
+
+    def execute(self, context):
+        from . import export_xmodel
+        start_time = time.clock()
+        result = export_xmodel.save(self, context, **self.as_keywords(ignore=("filter_glob", "check_existing")))
+
+        if not result:
+            self.report({'INFO'}, "Export finished in %.4f sec." % (time.clock() - start_time))
+            return {'FINISHED'}
+        else:
+            self.report({'ERROR'}, result)
+            return {'CANCELLED'}
+
+    # Extend ExportHelper invoke function to support dynamic default values
+    def invoke(self, context, event):
+
+        #self.use_frame_start = context.scene.frame_start
+        self.use_frame_start = context.scene.frame_current
+
+        #self.use_frame_end = context.scene.frame_end
+        self.use_frame_end = context.scene.frame_current
+
+        return super().invoke(context, event)
+
+    def draw(self, context):
+        layout = self.layout
+
+        row = layout.row(align=True)
+        row.prop(self, "use_version", expand=True)
+
+        # Calculate number of selected mesh objects
+        if context.mode in ('OBJECT', 'PAINT_WEIGHT'):
+            meshes_selected = len([m for m in bpy.data.objects if m.type == 'MESH' and m.select])
+        else:
+            meshes_selected = 0
+
+        col = layout.column(align=True)
+        col.prop(self, "use_selection", "Selection only (%i meshes)" % meshes_selected)
+        col.enabled = bool(meshes_selected)
+
+        col = layout.column(align=True)
+        col.prop(self, "use_apply_modifiers")
+
+        col = layout.column(align=True)
+        col.enabled = not self.use_armature_pose
+        if self.use_armature and self.use_armature_pose:
+            col.prop(self, "use_armature", "Armature  (disabled)")
+        else:
+            col.prop(self, "use_armature")
+
+        if self.use_version == '6':
+
+            row = layout.row(align=True)
+            row.prop(self, "use_vertex_colors")
+
+            sub = row.split()
+            sub.active = self.use_vertex_colors
+            sub.prop(self, "use_vertex_colors_alpha")
+
+        col = layout.column(align=True)
+        col.label("Advanced:")
+
+        col = layout.column(align=True)
+        col.prop(self, "use_vertex_cleanup")
+
+        box = layout.box()
+
+        col = box.column(align=True)
+        col.prop(self, "use_armature_pose")
+
+        sub = box.column()
+        sub.active = self.use_armature_pose
+        sub.label(text="Frame range: (%i frames)" % (abs(self.use_frame_end - self.use_frame_start) + 1))
+
+        row = sub.row(align=True)
+        row.prop(self, "use_frame_start")
+        row.prop(self, "use_frame_end")
+
+        box = layout.box()
+
+        col = box.column(align=True)
+        col.prop(self, "use_weight_min")
+
+        sub = box.column()
+        sub.enabled = self.use_weight_min
+        sub.prop(self, "use_weight_min_threshold")
+
+    @classmethod
+    def poll(self, context):
+        return (context.scene is not None)
+
+class ExportXanim(bpy.types.Operator, ExportHelper):
+    """Save a XMODEL_XANIM File"""
+
+    bl_idname = "export_scene.xanim"
+    bl_label = 'Export XANIM_EXPORT'
+    bl_options = {'PRESET'}
+
+    filename_ext = ".XANIM_EXPORT"
+    filter_glob = StringProperty(default="*.XANIM_EXPORT", options={'HIDDEN'})
+
+    # List of operator properties, the attributes will be assigned
+    # to the class instance from the operator settings before calling.
+
+    use_selection = BoolProperty(
+        name="Selection only",
+        description="Export selected bones only (pose mode)",
+        default=False
+        )
+
+    use_framerate = IntProperty(
+        name="Framerate",
+        description="Set frames per second for export, 30 fps is commonly used.",
+        default=24,
+        min=1,
+        max=100
+        )
+
+    use_frame_start = IntProperty(
+        name="Start",
+        description="First frame to export",
+        default=1,
+        min=0
+        )
+
+    use_frame_end = IntProperty(
+        name="End",
+        description="Last frame to export",
+        default=250,
+        min=0
+        )
+
+    use_notetrack = BoolProperty(
+        name="Notetrack",
+        description="Export timeline markers as notetrack nodes",
+        default=True
+        )
+
+    use_notetrack_format = EnumProperty(
+        name="Notetrack format",
+        description="Notetrack format to use. Always set 'CoD 7' for Black Ops, even if not using notetrack!",
+        items=(('5', "CoD 5", "Separate NT_EXPORT notetrack file for 'World at War'"),
+               ('7', "CoD 7", "Separate NT_EXPORT notetrack file for 'Black Ops'"),
+               ('1', "all other", "Inline notetrack data for all CoD versions except WaW and BO")),
+        default='1',
+        )
+
+    def execute(self, context):
+        from . import export_xanim
+        start_time = time.clock()
+        result = export_xanim.save(self, context, **self.as_keywords(ignore=("filter_glob", "check_existing")))
+
+        if not result:
+            self.report({'INFO'}, "Export finished in %.4f sec." % (time.clock() - start_time))
+            return {'FINISHED'}
+        else:
+            self.report({'ERROR'}, result)
+            return {'CANCELLED'}
+
+    # Extend ExportHelper invoke function to support dynamic default values
+    def invoke(self, context, event):
+
+        self.use_frame_start = context.scene.frame_start
+        self.use_frame_end = context.scene.frame_end
+        self.use_framerate = round(context.scene.render.fps / context.scene.render.fps_base)
+
+        return super().invoke(context, event)
+
+    def draw(self, context):
+
+        layout = self.layout
+
+        bones_selected = 0
+        armature = None
+
+        # Take the first armature
+        for ob in bpy.data.objects:
+            if ob.type == 'ARMATURE' and len(ob.data.bones) > 0:
+                armature = ob.data
+
+                # Calculate number of selected bones if in pose-mode
+                if context.mode == 'POSE':
+                    bones_selected = len([b for b in armature.bones if b.select])
+
+                # Prepare info string
+                armature_info = "%s (%i bones)" % (ob.name, len(armature.bones))
+                break
+        else:
+            armature_info = "Not found!"
+
+        if armature:
+            icon = 'NONE'
+        else:
+            icon = 'ERROR'
+
+        col = layout.column(align=True)
+        col.label("Armature: %s" % armature_info, icon)
+
+        col = layout.column(align=True)
+        col.prop(self, "use_selection", "Selection only (%i bones)" % bones_selected)
+        col.enabled = bool(bones_selected)
+
+        layout.label(text="Frame range: (%i frames)" % (abs(self.use_frame_end - self.use_frame_start) + 1))
+
+        row = layout.row(align=True)
+        row.prop(self, "use_frame_start")
+        row.prop(self, "use_frame_end")
+
+        col = layout.column(align=True)
+        col.prop(self, "use_framerate")
+
+        # Calculate number of markers in export range
+        frame_min = min(self.use_frame_start, self.use_frame_end)
+        frame_max = max(self.use_frame_start, self.use_frame_end)
+        num_markers = len([m for m in context.scene.timeline_markers if frame_max >= m.frame >= frame_min])
+
+        col = layout.column(align=True)
+        col.prop(self, "use_notetrack", text="Notetrack (%i nodes)" % num_markers)
+
+        col = layout.column(align=True)
+        col.prop(self, "use_notetrack_format", expand=True)
+
+    @classmethod
+    def poll(self, context):
+        return (context.scene is not None)
+
+def menu_func_xmodel_import(self, context):
+    self.layout.operator(ImportXmodel.bl_idname, text="CoD Xmodel (.XMODEL_EXPORT)")
+"""
+def menu_func_xanim_import(self, context):
+    self.layout.operator(ImportXanim.bl_idname, text="CoD Xanim (.XANIM_EXPORT)")
+"""
+def menu_func_xmodel_export(self, context):
+    self.layout.operator(ExportXmodel.bl_idname, text="CoD Xmodel (.XMODEL_EXPORT)")
+
+def menu_func_xanim_export(self, context):
+    self.layout.operator(ExportXanim.bl_idname, text="CoD Xanim (.XANIM_EXPORT)")
+
+def register():
+    bpy.utils.register_module(__name__)
+
+    bpy.types.INFO_MT_file_import.append(menu_func_xmodel_import)
+    #bpy.types.INFO_MT_file_import.append(menu_func_xanim_import)
+    bpy.types.INFO_MT_file_export.append(menu_func_xmodel_export)
+    bpy.types.INFO_MT_file_export.append(menu_func_xanim_export)
+
+def unregister():
+    bpy.utils.unregister_module(__name__)
+
+    bpy.types.INFO_MT_file_import.remove(menu_func_xmodel_import)
+    #bpy.types.INFO_MT_file_import.remove(menu_func_xanim_import)
+    bpy.types.INFO_MT_file_export.remove(menu_func_xmodel_export)
+    bpy.types.INFO_MT_file_export.remove(menu_func_xanim_export)
+
+if __name__ == "__main__":
+    register()
diff --git a/release/scripts/addons_contrib/io_scene_cod/export_xanim.py b/release/scripts/addons_contrib/io_scene_cod/export_xanim.py
new file mode 100644
index 0000000..4cfd505
--- /dev/null
+++ b/release/scripts/addons_contrib/io_scene_cod/export_xanim.py
@@ -0,0 +1,231 @@
+# ##### 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>
+
+"""
+Blender-CoD: Blender Add-On for Call of Duty modding
+Version: alpha 3
+
+Copyright (c) 2011 CoDEmanX, Flybynyt -- blender-cod at online.de
+
+http://code.google.com/p/blender-cod/
+
+TODO
+- Test pose matrix exports, global or local?
+
+"""
+
+import bpy
+from datetime import datetime
+
+def save(self, context, filepath="",
+         use_selection=False,
+         use_framerate=24,
+         use_frame_start=1,
+         use_frame_end=250,
+         use_notetrack=True,
+         use_notetrack_format='1'):
+
+    armature = None
+    last_frame_current = context.scene.frame_current
+
+    # There's no context object right after object deletion, need to set one
+    if context.object:
+        last_mode = context.object.mode
+    else:
+        last_mode = 'OBJECT'
+
+        if bpy.data.objects:
+            context.scene.objects.active = bpy.data.objects[0]
+        else:
+            return "Nothing to export."
+
+    # HACK: Force an update, so that bone tree is properly sorted for hierarchy table export
+    bpy.ops.object.mode_set(mode='EDIT', toggle=False)
+    bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
+
+    # Check input objects, don't move this above hack!
+    for ob in bpy.data.objects:
+
+        # Take the first armature
+        if ob.type == 'ARMATURE' and len(ob.data.bones) > 0:
+            armature = ob
+            break
+    else:
+        return "No armature to export."
+
+    # Get the wanted bones
+    if use_selection:
+        bones = [b for b in armature.data.bones if b.select]
+    else:
+        bones = armature.data.bones
+
+    # Get armature matrix once for later global coords/matrices calculation per frame
+    a_matrix = armature.matrix_world
+
+    # There's valid data for export, create output file
+    try:
+        file = open(filepath, "w")
+    except IOError:
+        return "Could not open file for writing:\n%s" % filepath
+
+     # write the header
+    file.write("// XANIM_EXPORT file in CoD animation v3 format created with Blender v%s\n" \
+               % bpy.app.version_string)
+    file.write("// Source file: %s\n" % filepath)
+    file.write("// Export time: %s\n\n" % datetime.now().strftime("%d-%b-%Y %H:%M:%S"))
+    file.write("ANIMATION\n")
+    file.write("VERSION 3\n\n")
+
+    file.write("NUMPARTS %i\n" % len(bones))
+
+    # Write bone table
+    for i_bone, bone in enumerate(bones):
+        file.write("PART %i \"%s\"\n" % (i_bone, bone.name))
+
+    # Exporter shall use Blender's framerate (render settings, used as playback speed)
+    # Note: Time remapping not taken into account
+    file.write("\nFRAMERATE %i\n" % use_framerate)
+
+    file.write("NUMFRAMES %i\n\n" % (abs(use_frame_start - use_frame_end) + 1))
+
+    # If start frame greater than end frame, export animation reversed
+    if use_frame_start < use_frame_end:
+        frame_order = 1
+        frame_min = use_frame_start
+        frame_max = use_frame_end
+    else:
+        frame_order = -1
+        frame_min = use_frame_end
+        frame_max = use_frame_start
+
+    for i_frame, frame in enumerate(range(use_frame_start,
+                                          use_frame_end + frame_order,
+                                          frame_order),
+                                    frame_min):
+
+        file.write("FRAME %i\n" % i_frame)
+
+        # Set frame directly
+        context.scene.frame_set(frame)
+
+        # Get PoseBones for that frame
+        if use_selection:
+            bones = [b for b in armature.pose.bones if b.bone.select]
+        else:
+            bones = armature.pose.bones
+
+        # Write bone orientations
+        for i_bone, bone in enumerate(bones):
+
+            # Skip bone if 'Selection only' is enabled and bone not selected
+            if use_selection and not bone.bone.select: # It's actually posebone.bone!
+                continue
+
+            file.write("PART %i\n" % i_bone)
+
+
+            """ Doesn't seem to be right... or maybe it is? root can't have rotation, it rather sets the global orientation
+            if bone.parent is None:
+                file.write("OFFSET 0.000000 0.000000 0.000000\n")
+                file.write("SCALE 1.000000 1.000000 1.000000\n")
+                file.write("X 1.000000, 0.000000, 0.000000\n")
+                file.write("Y 0.000000, 1.000000, 0.000000\n")
+                file.write("Z 0.000000, 0.000000, 1.000000\n\n")
+            else:
+            """
+
+            b_tail = a_matrix * bone.tail
+            file.write("OFFSET %.6f %.6f %.6f\n" % (b_tail[0], b_tail[1], b_tail[2]))
+            file.write("SCALE 1.000000 1.000000 1.000000\n") # Is this even supported by CoD?
+            
+            file.write("X %.6f %.6f %.6f\n" % (bone.matrix[0][0], bone.matrix[1][0], bone.matrix[2][0]))
+            file.write("Y %.6f %.6f %.6f\n" % (bone.matrix[0][1], bone.matrix[1][1], bone.matrix[2][1]))
+            file.write("Z %.6f %.6f %.6f\n\n" % (bone.matrix[0][2], bone.matrix[1][2], bone.matrix[2][2]))
+
+            """
+            # Is a local matrix used (above) or a global?
+            # Rest pose bone roll shouldn't matter if local is used... o_O
+            # Note: Converting to xanim delta doesn't allow bone moves (only root?)
+            b_matrix = a_matrix * bone.matrix
+            file.write("X %.6f %.6f %.6f\n" % (b_matrix[0][0], b_matrix[1][0], b_matrix[2][0]))
+            file.write("Y %.6f %.6f %.6f\n" % (b_matrix[0][1], b_matrix[1][1], b_matrix[2][1]))
+            file.write("Z %.6f %.6f %.6f\n" % (b_matrix[0][2], b_matrix[1][2], b_matrix[2][2]))
+            """
+
+    # Blender timeline markers to notetrack nodes
+    markers = []
+    for m in context.scene.timeline_markers:
+        if frame_max >= m.frame >= frame_min:
+            markers.append([m.frame, m.name])
+    markers = sorted(markers)
+
+    # Cache marker string
+    marker_string = "NUMKEYS %i\n" % len(markers)
+
+    for m in markers:
+        marker_string += "FRAME %i \"%s\"\n" % (m[0], m[1])
+
+    # Write notetrack data
+    if use_notetrack_format == '7':
+        # Always 0 for CoD7, no matter if there are markers or not!
+        file.write("NUMKEYS 0\n")
+    else:
+        file.write("NOTETRACKS\n\n")
+
+        for i_bone, bone in enumerate(bones):
+
+            file.write("PART %i\n" % (i_bone))
+
+            if i_bone == 0 and use_notetrack and use_notetrack_format == '1' and len(markers) > 0:
+
+                file.write("NUMTRACKS 1\n\n")
+                file.write("NOTETRACK 0\n")
+                file.write(marker_string)
+                file.write("\n")
+
+            else:
+                file.write("NUMTRACKS 0\n\n")
+
+    # Close to flush buffers!
+    file.close()
+
+    if use_notetrack and use_notetrack_format in ('5', '7'):
+
+        import os.path
+        filepath = os.path.splitext(filepath)[0] + ".NT_EXPORT"
+
+        try:
+            file = open(filepath, "w")
+        except IOError:
+            return "Could not open file for writing:\n%s" % filepath
+
+        if use_notetrack_format == '7':
+            file.write("FIRSTFRAME %i\n" % use_frame_start)
+            file.write("NUMFRAMES %i\n" % (abs(use_frame_end - use_frame_start) + 1))
+        file.write(marker_string)
+
+        file.close()
+
+    # Set frame_current and mode back
+    context.scene.frame_set(last_frame_current)
+    bpy.ops.object.mode_set(mode=last_mode, toggle=False)
+
+    # Quit with no errors
+    return
diff --git a/release/scripts/addons_contrib/io_scene_cod/export_xmodel.py b/release/scripts/addons_contrib/io_scene_cod/export_xmodel.py
new file mode 100644
index 0000000..72874c2
--- /dev/null
+++ b/release/scripts/addons_contrib/io_scene_cod/export_xmodel.py
@@ -0,0 +1,732 @@
+# ##### 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>
+
+"""
+Blender-CoD: Blender Add-On for Call of Duty modding
+Version: alpha 3
+
+Copyright (c) 2011 CoDEmanX, Flybynyt -- blender-cod at online.de
+
+http://code.google.com/p/blender-cod/
+
+"""
+
+import bpy
+import os
+from datetime import datetime
+
+def save(self, context, filepath="",
+         use_version='6',
+         use_selection=False,
+         use_apply_modifiers=True,
+         use_armature=True,
+         use_vertex_colors=True,
+         use_vertex_colors_alpha=False,
+         use_vertex_cleanup=False,
+         use_armature_pose=False,
+         use_frame_start=1,
+         use_frame_end=250,
+         use_weight_min=False,
+         use_weight_min_threshold=0.010097):
+
+    # There's no context object right after object deletion, need to set one
+    if context.object:
+        last_mode = context.object.mode
+    else:
+        last_mode = 'OBJECT'
+
+        for ob in bpy.data.objects:
+            if ob.type == 'MESH':
+                context.scene.objects.active = ob
+                break
+        else:
+            return "No mesh to export."
+
+    # HACK: Force an update, so that bone tree is properly sorted for hierarchy table export
+    bpy.ops.object.mode_set(mode='EDIT', toggle=False)
+    bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
+
+    # Remember frame to set it back after export
+    last_frame_current = context.scene.frame_current
+
+    # Disable Armature for Pose animation export, bone.tail_local not available for PoseBones
+    if use_armature and use_armature_pose:
+        use_armature = False
+
+    # Don't iterate for a single frame
+    if not use_armature_pose or (use_armature_pose and use_frame_start == use_frame_end):
+        context.scene.frame_set(use_frame_start)
+
+        result = _write(self, context, filepath,
+                        use_version,
+                        use_selection,
+                        use_apply_modifiers,
+                        use_armature,
+                        use_vertex_colors,
+                        use_vertex_colors_alpha,
+                        use_vertex_cleanup,
+                        use_armature_pose,
+                        use_weight_min,
+                        use_weight_min_threshold)
+    else:
+
+        if use_frame_start < use_frame_end:
+            frame_order = 1
+            frame_min = use_frame_start
+            frame_max = use_frame_end
+        else:
+            frame_order = -1
+            frame_min = use_frame_end
+            frame_max = use_frame_start
+
+        # String length of highest frame number for filename padding
+        frame_strlen = len(str(frame_max))
+
+        filepath_split = os.path.splitext(filepath)
+
+        for i_frame, frame in enumerate(range(use_frame_start,
+                                              use_frame_end + frame_order,
+                                              frame_order
+                                              ),
+                                        frame_min):
+
+            # Set frame for export
+            # Don't do it directly to frame_current, as to_mesh() won't use updated frame!
+            context.scene.frame_set(frame)
+
+            # Generate filename including padded frame number
+            filepath_frame = "%s_%.*i%s" % (filepath_split[0], frame_strlen, i_frame, filepath_split[1])
+
+            result = _write(self, context, filepath_frame,
+                            use_version,
+                            use_selection,
+                            use_apply_modifiers,
+                            use_armature,
+                            use_vertex_colors,
+                            use_vertex_colors_alpha,
+                            use_vertex_cleanup,
+                            use_armature_pose,
+                            use_weight_min,
+                            use_weight_min_threshold
+                            )
+
+            # Quit iteration on error
+            if result:
+                context.scene.frame_set(last_frame_current)
+                return result
+
+    # Set frame back
+    context.scene.frame_set(last_frame_current)
+
+    # Set mode back
+    bpy.ops.object.mode_set(mode=last_mode, toggle=False)
+
+    # Handle possible error result of single frame export
+    return result
+
+def _write(self, context, filepath,
+           use_version,
+           use_selection,
+           use_apply_modifiers,
+           use_armature,
+           use_vertex_colors,
+           use_vertex_colors_alpha,
+           use_vertex_cleanup,
+           use_armature_pose,
+           use_weight_min,
+           use_weight_min_threshold):
+
+    num_verts = 0
+    num_verts_unique = 0
+    verts_unique = []
+    num_faces = 0
+    meshes = []
+    meshes_matrix = []
+    meshes_vgroup = []
+    objects = []
+    armature = None
+    bone_mapping = {}
+    materials = []
+
+    ob_count = 0
+    v_count = 0
+
+    # Check input objects, count them and convert mesh objects
+    for ob in bpy.data.objects:
+
+        # Take the first armature
+        if ob.type == 'ARMATURE' and use_armature and armature is None and len(ob.data.bones) > 0:
+            armature = ob
+            continue
+
+        if ob.type != 'MESH':
+            continue
+
+        # Skip meshes, which are unselected
+        if use_selection and not ob.select:
+            continue
+
+        # Set up modifiers whether to apply deformation or not
+        mod_states = []
+        for mod in ob.modifiers:
+            mod_states.append(mod.show_viewport)
+            if mod.type == 'ARMATURE':
+                mod.show_viewport = mod.show_viewport and use_armature_pose
+            else:
+                mod.show_viewport = mod.show_viewport and use_apply_modifiers
+
+        # to_mesh() applies enabled modifiers only
+        mesh = ob.to_mesh(scene=context.scene, apply_modifiers=True, settings='PREVIEW')
+
+        # Restore modifier settings
+        for i, mod in enumerate(ob.modifiers):
+            mod.show_viewport = mod_states[i]
+
+        # Skip invalid meshes
+        if len(mesh.vertices) < 3:
+            _skip_notice(ob.name, mesh.name, "Less than 3 vertices")
+            continue
+        if len(mesh.tessfaces) < 1:
+            _skip_notice(ob.name, mesh.name, "No faces")
+            continue
+        if len(ob.material_slots) < 1:
+            _skip_notice(ob.name, mesh.name, "No material")
+            continue
+        if not mesh.tessface_uv_textures:
+            _skip_notice(ob.name, mesh.name, "No UV texture, not unwrapped?")
+            continue
+
+        meshes.append(mesh)
+        meshes_matrix.append(ob.matrix_world)
+
+        if ob.vertex_groups:
+            meshes_vgroup.append(ob.vertex_groups)
+        else:
+            meshes_vgroup.append(None)
+
+        if use_vertex_cleanup:
+
+            # Retrieve verts which belong to a face
+            verts = []
+            for f in mesh.tessfaces:
+                for v in f.vertices:
+                    verts.append(v)
+
+            # Uniquify & sort
+            keys = {}
+            for e in verts:
+                keys[e] = 1
+            verts = list(keys.keys())
+
+        else:
+            verts = [v.index for v in mesh.vertices]
+
+        # Store vert sets, aligned to mesh objects
+        verts_unique.append(verts)
+
+        # As len(mesh.vertices) doesn't take unused verts into account, already count here
+        num_verts_unique += len(verts)
+
+        # Take quads into account!
+        for f in mesh.tessfaces:
+            if len(f.vertices) == 3:
+                num_faces += 1
+            else:
+                num_faces += 2
+
+        objects.append(ob.name)
+
+    if (num_verts or num_faces or len(objects)) == 0:
+        return "Nothing to export.\n" \
+               "Meshes must have at least:\n" \
+               "    3 vertices\n" \
+               "    1 face\n" \
+               "    1 material\n" \
+               "    UV mapping"
+
+    # There's valid data for export, create output file
+    try:
+        file = open(filepath, "w")
+    except IOError:
+        return "Could not open file for writing:\n%s" % filepath
+
+    # Write header
+    file.write("// XMODEL_EXPORT file in CoD model v%i format created with Blender v%s\n" \
+               % (int(use_version), bpy.app.version_string))
+
+    file.write("// Source file: %s\n" % bpy.data.filepath)
+    file.write("// Export time: %s\n\n" % datetime.now().strftime("%d-%b-%Y %H:%M:%S"))
+
+    if use_armature_pose:
+        file.write("// Posed model of frame %i\n\n" % bpy.context.scene.frame_current)
+
+    if use_weight_min:
+        file.write("// Minimum bone weight: %f\n\n" % use_weight_min_threshold)
+
+    file.write("MODEL\n")
+    file.write("VERSION %i\n" % int(use_version))
+
+    # Write armature data
+    if armature is None:
+
+        # Default rig
+        file.write("\nNUMBONES 1\n")
+        file.write("BONE 0 -1 \"tag_origin\"\n")
+
+        file.write("\nBONE 0\n")
+
+        if use_version == '5':
+            file.write("OFFSET 0.000000 0.000000 0.000000\n")
+            file.write("SCALE 1.000000 1.000000 1.000000\n")
+            file.write("X 1.000000 0.000000 0.000000\n")
+            file.write("Y 0.000000 1.000000 0.000000\n")
+            file.write("Z 0.000000 0.000000 1.000000\n")
+        else:
+            # Model format v6 has commas
+            file.write("OFFSET 0.000000, 0.000000, 0.000000\n")
+            file.write("SCALE 1.000000, 1.000000, 1.000000\n")
+            file.write("X 1.000000, 0.000000, 0.000000\n")
+            file.write("Y 0.000000, 1.000000, 0.000000\n")
+            file.write("Z 0.000000, 0.000000, 1.000000\n")
+
+    else:
+
+        # Either use posed armature bones for animation to model sequence export
+        if use_armature_pose:
+            bones = armature.pose.bones
+        # Or armature bones in rest pose for regular rigged models
+        else:
+            bones = armature.data.bones
+
+        file.write("\nNUMBONES %i\n" % len(bones))
+
+        # Get the armature object's orientation
+        a_matrix = armature.matrix_world
+
+        # Check for multiple roots, armature should have exactly one
+        roots = 0
+        for bone in bones:
+            if not bone.parent:
+                roots += 1
+        if roots != 1:
+            warning_string = "Warning: %i root bones found in armature object '%s'\n" \
+                             % (roots, armature.name)
+            print(warning_string)
+            file.write("// %s" % warning_string)
+
+        # Look up table for bone indices
+        bone_table = [b.name for b in bones]
+
+        # Write bone hierarchy table and create bone_mapping array for later use (vertex weights)
+        for i, bone in enumerate(bones):
+
+            if bone.parent:
+                try:
+                    bone_parent_index = bone_table.index(bone.parent.name)
+                except (ValueError):
+                    bone_parent_index = 0
+                    file.write("// Warning: \"%s\" not found in bone table, binding to root...\n"
+                               % bone.parent.name)
+            else:
+                bone_parent_index = -1
+
+            file.write("BONE %i %i \"%s\"\n" % (i, bone_parent_index, bone.name))
+            bone_mapping[bone.name] = i
+
+        # Write bone orientations
+        for i, bone in enumerate(bones):
+            file.write("\nBONE %i\n" % i)
+
+            # Using local tail for proper coordinates
+            b_tail = a_matrix * bone.tail_local
+
+            # TODO: Fix calculation/error: pose animation will use posebones, but they don't have tail_local!
+
+            # TODO: Fix rotation matrix calculation, calculation seems to be wrong...
+            #b_matrix = bone.matrix_local * a_matrix
+            #b_matrix = bone.matrix * a_matrix * bones[0].matrix.inverted()
+            #from mathutils import Matrix
+
+            # Is this the way to go? Or will it fix the root only, but mess up all other roll angles?
+            if i == 0:
+                b_matrix = ((1,0,0),(0,1,0),(0,0,1))
+            else:
+                b_matrix = a_matrix * bone.matrix_local
+                #from mathutils import Matrix
+                #b_matrix = bone.matrix_local * a_matrix * Matrix(((1,-0,0),(0,0,-1),(-0,1,0)))
+                
+            if use_version == '5':
+                file.write("OFFSET %.6f %.6f %.6f\n" % (b_tail[0], b_tail[1], b_tail[2]))
+                file.write("SCALE 1.000000 1.000000 1.000000\n") # Is this even supported by CoD?
+                file.write("X %.6f %.6f %.6f\n" % (b_matrix[0][0], b_matrix[1][0], b_matrix[2][0]))
+                file.write("Y %.6f %.6f %.6f\n" % (b_matrix[0][1], b_matrix[1][1], b_matrix[2][1]))
+                file.write("Z %.6f %.6f %.6f\n" % (b_matrix[0][2], b_matrix[1][2], b_matrix[2][2]))
+            else:
+                file.write("OFFSET %.6f, %.6f, %.6f\n" % (b_tail[0], b_tail[1], b_tail[2]))
+                file.write("SCALE 1.000000, 1.000000, 1.000000\n")
+                file.write("X %.6f, %.6f, %.6f\n" % (b_matrix[0][0], b_matrix[1][0], b_matrix[2][0]))
+                file.write("Y %.6f, %.6f, %.6f\n" % (b_matrix[0][1], b_matrix[1][1], b_matrix[2][1]))
+                file.write("Z %.6f, %.6f, %.6f\n" % (b_matrix[0][2], b_matrix[1][2], b_matrix[2][2]))
+
+    # Write vertex data
+    file.write("\nNUMVERTS %i\n" % num_verts_unique)
+
+    for i, me in enumerate(meshes):
+
+        # Get the right object matrix for mesh
+        mesh_matrix = meshes_matrix[i]
+
+        # Get bone influences per vertex
+        if armature is not None and meshes_vgroup[i] is not None:
+
+            groupNames, vWeightList = meshNormalizedWeights(meshes_vgroup[i],
+                                                            me,
+                                                            use_weight_min,
+                                                            use_weight_min_threshold
+                                                            )
+            # Get bones by vertex_group names, bind to root if can't find one 
+            groupIndices = [bone_mapping.get(g, -1) for g in groupNames]
+
+            weight_group_list = []
+            for weights in vWeightList:
+                weight_group_list.append(sorted(zip(weights, groupIndices), reverse=True))
+
+        # Use uniquified vert sets and count the verts
+        for i_vert, vert in enumerate(verts_unique[i]):
+            v = me.vertices[vert]
+
+            # Calculate global coords
+            x = mesh_matrix[0][0] * v.co[0] + \
+                mesh_matrix[0][1] * v.co[1] + \
+                mesh_matrix[0][2] * v.co[2] + \
+                mesh_matrix[0][3]
+
+            y = mesh_matrix[1][0] * v.co[0] + \
+                mesh_matrix[1][1] * v.co[1] + \
+                mesh_matrix[1][2] * v.co[2] + \
+                mesh_matrix[1][3]
+
+            z = mesh_matrix[2][0] * v.co[0] + \
+                mesh_matrix[2][1] * v.co[1] + \
+                mesh_matrix[2][2] * v.co[2] + \
+                mesh_matrix[2][3]
+                
+            #print("%.6f %.6f %.6f single calced xyz\n%.6f %.6f %.6f mat mult" % (x, y, z, ))
+
+            file.write("VERT %i\n" % (i_vert + v_count))
+
+            if use_version == '5':
+                file.write("OFFSET %.6f %.6f %.6f\n" % (x, y, z))
+            else:
+                file.write("OFFSET %.6f, %.6f, %.6f\n" % (x, y, z))
+
+            # Write bone influences
+            if armature is None or meshes_vgroup[i] is None:
+                file.write("BONES 1\n")
+                file.write("BONE 0 1.000000\n\n")
+            else:
+                cache = ""
+                c_bones = 0
+
+                for weight, bone_index in weight_group_list[v.index]:
+                    if (use_weight_min and round(weight, 6) < use_weight_min_threshold) or \
+                       (not use_weight_min and round(weight, 6) == 0):
+                        # No (more) bones with enough weight, totalweight of 0 would lead to error
+                        break
+                    cache += "BONE %i %.6f\n" % (bone_index, weight)
+                    c_bones += 1
+
+                if c_bones == 0:
+                    warning_string = "Warning: No bone influence found for vertex %i, binding to bone %i\n" \
+                                     % (v.index, bone_index)
+                    print(warning_string)
+                    file.write("// %s" % warning_string)
+                    file.write("BONES 1\n")
+                    file.write("BONE %i 0.000001\n\n" % bone_index) # HACK: Is a minimum weight a good idea?
+                else:
+                    file.write("BONES %i\n%s\n" % (c_bones, cache))
+
+        v_count += len(verts_unique[i]);
+
+    # TODO: Find a better way to keep track of the vertex index?
+    v_count = 0
+
+    # Prepare material array
+    for me in meshes:
+        for f in me.tessfaces:
+            try:
+                mat = me.materials[f.material_index]
+            except (IndexError):
+                # Mesh has no material with this index
+                # Note: material_index is never None (will be 0 instead)
+                continue
+            else:
+                if mat not in materials:
+                    materials.append(mat)
+
+    # Write face data
+    file.write("\nNUMFACES %i\n" % num_faces)
+
+    for i_me, me in enumerate(meshes):
+
+        #file.write("// Verts:\n%s\n" % list(enumerate(verts_unique[i_me])))
+
+        for f in me.tessfaces:
+
+            try:
+                mat = me.materials[f.material_index]
+
+            except (IndexError):
+                mat_index = 0
+
+                warning_string = "Warning: Assigned material with index %i not found, falling back to first\n" \
+                                  % f.material_index
+                print(warning_string)
+                file.write("// %s" % warning_string)
+
+            else:
+                try:
+                    mat_index = materials.index(mat)
+
+                except (ValueError):
+                    mat_index = 0
+
+                    warning_string = "Warning: Material \"%s\" not mapped, falling back to first\n" \
+                                      % mat.name
+                    print(warning_string)
+                    file.write("// %s" % warning_string)
+
+            # Support for vertex colors
+            if me.tessface_vertex_colors:
+                col = me.tessface_vertex_colors.active.data[f.index]
+
+            # Automatic triangulation support
+            f_v_orig = [v for v in enumerate(f.vertices)]
+
+            if len(f_v_orig) == 3:
+                f_v_iter = (f_v_orig[2], f_v_orig[1], f_v_orig[0]), # HACK: trailing comma to force a tuple
+            else:
+                f_v_iter = (f_v_orig[2], f_v_orig[1], f_v_orig[0]), (f_v_orig[3], f_v_orig[2], f_v_orig[0])
+
+            for iter in f_v_iter:
+
+                # TODO: Test material# export (v5 correct?)
+                if use_version == '5':
+                    file.write("TRI %i %i 0 1\n" % (ob_count, mat_index))
+                else:
+                    file.write("TRI %i %i 0 0\n" % (ob_count, mat_index))
+
+                for vi, v in iter:
+
+                    no = me.vertices[v].normal # Invert? Orientation seems to have no effect...
+
+                    uv = me.tessface_uv_textures.active
+                    uv1 = uv.data[f.index].uv[vi][0]
+                    uv2 = 1 - uv.data[f.index].uv[vi][1] # Flip!
+
+                    #if 0 > uv1 > 1 
+                    # TODO: Warn if accidentally tiling ( uv <0 or >1 )
+
+                    # Remap vert indices used by face
+                    if use_vertex_cleanup:
+                        vert_new = verts_unique[i_me].index(v) + v_count
+                        #file.write("// %i (%i) --> %i\n" % (v+v_count, v, vert_new))
+                    else:
+                        vert_new = v + v_count
+
+                    if use_version == '5':
+                        file.write("VERT %i %.6f %.6f %.6f %.6f %.6f\n" \
+                                   % (vert_new, uv1, uv2, no[0], no[1], no[2]))
+                    else:
+                        file.write("VERT %i\n" % vert_new)
+                        file.write("NORMAL %.6f %.6f %.6f\n" % (no[0], no[1], no[2]))
+
+                        if me.tessface_vertex_colors and use_vertex_colors:
+
+                            if vi == 0:
+                                c = col.color1
+                            elif vi == 1:
+                                c = col.color2
+                            elif vi == 2:
+                                c = col.color3
+                            else:
+                                c = col.color4
+
+                            if use_vertex_colors_alpha:
+
+                                # Turn RGB into grayscale (luminance conversion)
+                                c_lum = c[0] * 0.3 + c[1] * 0.59 + c[2] * 0.11
+                                file.write("COLOR 1.000000 1.000000 1.000000 %.6f\n" % c_lum)
+                            else:
+                                file.write("COLOR %.6f %.6f %.6f 1.000000\n" % (c[0], c[1], c[2]))
+
+                        else:
+                            file.write("COLOR 1.000000 1.000000 1.000000 1.000000\n")
+
+                        file.write("UV 1 %.6f %.6f\n" % (uv1, uv2))
+
+        # Note: Face types (tris/quads) have nothing to do with vert indices!
+        if use_vertex_cleanup:
+            v_count += len(verts_unique[i_me])
+        else:
+            v_count += len(me.vertices)
+
+        ob_count += 1
+
+    # Write object data
+    file.write("\nNUMOBJECTS %i\n" % len(objects))
+
+    for i_ob, ob in enumerate(objects):
+        file.write("OBJECT %i \"%s\"\n" % (i_ob, ob))
+
+    # Static material string
+    material_string = ("COLOR 0.000000 0.000000 0.000000 1.000000\n"
+                       "TRANSPARENCY 0.000000 0.000000 0.000000 1.000000\n"
+                       "AMBIENTCOLOR 0.000000 0.000000 0.000000 1.000000\n"
+                       "INCANDESCENCE 0.000000 0.000000 0.000000 1.000000\n"
+                       "COEFFS 0.800000 0.000000\n"
+                       "GLOW 0.000000 0\n"
+                       "REFRACTIVE 6 1.000000\n"
+                       "SPECULARCOLOR -1.000000 -1.000000 -1.000000 1.000000\n"
+                       "REFLECTIVECOLOR -1.000000 -1.000000 -1.000000 1.000000\n"
+                       "REFLECTIVE -1 -1.000000\n"
+                       "BLINN -1.000000 -1.000000\n"
+                       "PHONG -1.000000\n\n"
+                       )
+
+    if len(materials) > 0:
+        file.write("\nNUMMATERIALS %i\n" % len(materials))
+
+        for i_mat, mat in enumerate(materials):
+
+            try:
+                for i_ts, ts in enumerate(mat.texture_slots):
+
+                    # Skip empty slots and disabled textures
+                    if not ts or not mat.use_textures[i_ts]:
+                        continue
+
+                    # Image type and Color map? If yes, add to material array and index
+                    if ts.texture.type == 'IMAGE' and ts.use_map_color_diffuse:
+
+                        # Pick filename of the first color map
+                        imagepath = ts.texture.image.filepath
+                        imagename = os.path.split(imagepath)[1]
+                        if len(imagename) == 0:
+                            imagename = "untitled"
+                        break
+                else:
+                    raise(ValueError)
+
+            except:
+                imagename = "no color diffuse map found"
+
+            # Material can be assigned and None
+            if mat:
+                mat_name = mat.name
+                mat_shader = mat.diffuse_shader.capitalize()
+            else:
+                mat_name = "None"
+                mat_shader = "Lambert"
+
+            if use_version == '5':
+                file.write("MATERIAL %i \"%s\"\n" % (i_mat, imagename))
+                # or is it mat.name at filename?
+            else:
+                file.write("MATERIAL %i \"%s\" \"%s\" \"%s\"\n" % (
+                           i_mat,
+                           mat_name,
+                           mat_shader,
+                           imagename
+                           ))
+                file.write(material_string)
+    else:
+        # Write a default material
+        # Should never happen, nothing to export / mesh without material exceptions already caught
+        file.write("\nNUMMATERIALS 1\n")
+        if use_version == '5':
+            file.write("MATERIAL 0 \"default.tga\"\n")
+        else:
+            file.write("MATERIAL 0 \"$default\" \"Lambert\" \"untitled\"\n")
+            file.write(material_string)
+
+    # Close to flush buffers!
+    file.close()
+
+    # Remove meshes, which were made by to_mesh()
+    for mesh in meshes:
+        mesh.user_clear()
+        bpy.data.meshes.remove(mesh)    
+
+    # Quit with no errors
+    return
+
+# Taken from export_fbx.py by Campbell Barton
+# Modified to accept vertex_groups directly instead of mesh object
+def BPyMesh_meshWeight2List(vgroup, me):
+
+    """ Takes a mesh and return its group names and a list of lists, one list per vertex.
+    aligning the each vert list with the group names, each list contains float value for the weight.
+    These 2 lists can be modified and then used with list2MeshWeight to apply the changes.
+    """
+
+    # Clear the vert group.
+    groupNames = [g.name for g in vgroup]
+    len_groupNames = len(groupNames)
+
+    if not len_groupNames:
+        # no verts? return a vert aligned empty list
+        #return [[] for i in range(len(me.vertices))], []
+        return [], []
+
+    else:
+        vWeightList = [[0.0] * len_groupNames for i in range(len(me.vertices))]
+
+    for i, v in enumerate(me.vertices):
+        for g in v.groups:
+            # possible weights are out of range
+            index = g.group
+            if index < len_groupNames:
+                vWeightList[i][index] = g.weight
+
+    return groupNames, vWeightList
+
+def meshNormalizedWeights(vgroup, me, weight_min, weight_min_threshold):
+
+    groupNames, vWeightList = BPyMesh_meshWeight2List(vgroup, me)
+
+    if not groupNames:
+        return [], []
+
+    for vWeights in vWeightList:
+        tot = 0.0
+        for w in vWeights:
+            if weight_min and w < weight_min_threshold:
+                w = 0.0
+            tot += w
+
+        if tot:
+            for j, w in enumerate(vWeights):
+                vWeights[j] = w / tot
+
+    return groupNames, vWeightList
+
+def _skip_notice(ob_name, mesh_name, notice):
+    print("\nSkipped object \"%s\" (mesh \"%s\"): %s" % (ob_name, mesh_name, notice))
diff --git a/release/scripts/addons_contrib/io_scene_cod/import_xanim.py b/release/scripts/addons_contrib/io_scene_cod/import_xanim.py
new file mode 100644
index 0000000..4d79034
--- /dev/null
+++ b/release/scripts/addons_contrib/io_scene_cod/import_xanim.py
@@ -0,0 +1,38 @@
+# ##### 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>
+
+"""
+Blender-CoD: Blender Add-On for Call of Duty modding
+Version: alpha 3
+
+Copyright (c) 2011 CoDEmanX, Flybynyt -- blender-cod at online.de
+
+http://code.google.com/p/blender-cod/
+
+TODO
+- Implement xanim import (apply anim data to the armature of a loaded model)
+
+"""
+
+def load(self, context, **keywords):
+
+    #filepath = os.fsencode(filepath)
+
+    return {'FINISHED'}
diff --git a/release/scripts/addons_contrib/io_scene_cod/import_xmodel.py b/release/scripts/addons_contrib/io_scene_cod/import_xmodel.py
new file mode 100644
index 0000000..6f862e0
--- /dev/null
+++ b/release/scripts/addons_contrib/io_scene_cod/import_xmodel.py
@@ -0,0 +1,392 @@
+# ##### 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>
+
+"""
+Blender-CoD: Blender Add-On for Call of Duty modding
+Version: alpha 3
+
+Copyright (c) 2011 CoDEmanX, Flybynyt -- blender-cod at online.de
+
+http://code.google.com/p/blender-cod/
+
+NOTES
+- Code is in early state of development and work in progress!
+- Importing rigs from XMODEL_EXPORT v6 works, but the code is really messy.
+
+TODO
+- Implement full xmodel import
+
+"""
+
+import os
+import bpy
+from mathutils import *
+import math
+#from mathutils.geometry import tesselate_polygon
+#from io_utils import load_image, unpack_list, unpack_face_list
+
+def round_matrix_3x3(mat, precision=6):
+    return Matrix(((round(mat[0][0],precision), round(mat[0][1],precision), round(mat[0][2],precision)),
+                (round(mat[1][0],precision), round(mat[1][1],precision), round(mat[1][2],precision)),
+                (round(mat[2][0],precision), round(mat[2][1],precision), round(mat[2][2],precision))))
+
+def load(self, context, filepath=""):
+
+    filepath = os.fsencode(filepath)
+
+    test_0 = []
+    test_1 = []
+    test_2 = []
+    test_3 = []
+
+    state = 0
+
+    # placeholders
+    vec0 = Vector((0.0, 0.0, 0.0))
+    mat0 = Matrix(((0.0, 0.0, 0.0),(0.0, 0.0, 0.0),(0.0, 0.0, 0.0)))
+
+    numbones = 0
+    numbones_i = 0
+    bone_i = 0
+    bone_table = []
+    numverts = 0
+    vert_i = 0
+    vert_table = [] # allocate table? [0]*numverts
+    face_i = 0
+    face_tmp = []
+    face_table = []
+    bones_influencing_num = 0
+    bones_influencing_i = 0
+    numfaces = 0
+
+    print("\nImporting %s" % filepath)
+
+    try:
+        file = open(filepath, "r")
+    except IOError:
+        return "Could not open file for reading:\n%s" % filepath
+
+    for line in file:
+        line = line.strip()
+        line_split = line.split()
+
+        # Skip empty and comment lines
+        if not line or line[0] == "/":
+            continue
+
+        elif state == 0 and line_split[0] == "MODEL":
+            state = 1
+
+        elif state == 1 and line_split[0] == "VERSION":
+            if line_split[1] != "6":
+                error_string = "Unsupported version: %s" % line_split[1]
+                print("\n%s" % error_string)
+                return error_string
+            state = 2
+
+        elif state == 2 and line_split[0] == "NUMBONES":
+            numbones = int(line_split[1])
+            state = 3
+
+        elif state == 3 and line_split[0] == "BONE":
+            if numbones_i != int(line_split[1]):
+                error_string = "Unexpected bone number: %s (expected %i)" % (line_split[1], numbones_i)
+                print("\n%s" % error_string)
+                return error_string
+            bone_table.append((line_split[3][1:-1], int(line_split[2]), vec0, mat0))
+            test_0.append(line_split[3][1:-1])
+            test_1.append(int(line_split[2]))
+            if numbones_i >= numbones-1:
+                state = 4
+            else:
+                numbones_i += 1
+
+        elif state == 4 and line_split[0] == "BONE":
+            bone_num = int(line_split[1])
+            if bone_i != bone_num:
+                error_string = "Unexpected bone number: %s (expected %i)" % (line_split[1], bone_i)
+                print("\n%s" % error_string)
+                return error_string
+            state = 5
+
+        elif state == 5 and line_split[0] == "OFFSET":
+            # remove commas - line_split[#][:-1] would also work, but isn't as save
+            line_split = line.replace(",", "").split()
+
+            # should we check for len(line_split) to ensure we got enough elements?
+            # Note: we can't assign a new vector to tuple object, we need to change each value
+
+            bone_table[bone_i][2].xyz = Vector((float(line_split[1]), float(line_split[2]), float(line_split[3])))
+            #print("\nPROBLEMATIC: %s" % bone_table[bone_i][2])
+            #NO ERROR HERE, but for some reason the whole table will contain the same vectors
+            #bone_table[bone_i][2][0] = float(line_split[1])
+            #bone_table[bone_i][2][1] = float(line_split[2])
+            #bone_table[bone_i][2][2] = float(line_split[3])
+            test_2.append(Vector((float(line_split[1]),float(line_split[2]),float(line_split[3]))))
+
+            state = 6
+
+        elif state == 6 and line_split[0] == "SCALE":
+            # always 1.000000?! no processing so far...
+            state = 7
+
+        elif state == 7 and line_split[0] == "X":
+            line_split = line.replace(",", "").split()
+            bone_table[bone_i][3][0] = Vector((float(line_split[1]), float(line_split[2]), float(line_split[3])))
+
+            """ Use something like this:
+            bone.align_roll(targetmatrix[2])
+            roll = roll%360 #nicer to have it 0-359.99...
+            """
+            m_col = []
+            m_col.append((float(line_split[1]), float(line_split[2]), float(line_split[3])))
+            
+            state = 8
+
+        elif state == 8 and line_split[0] == "Y":
+            line_split = line.replace(",", "").split()
+            bone_table[bone_i][3][1] = Vector((float(line_split[1]), float(line_split[2]), float(line_split[3])))
+            
+            m_col.append((float(line_split[1]), float(line_split[2]), float(line_split[3])))
+
+            state = 9
+
+        elif state == 9 and line_split[0] == "Z":
+            line_split = line.replace(",", "").split()
+            vec_roll = Vector((float(line_split[1]), float(line_split[2]), float(line_split[3])))
+            ##bone_table[bone_i][3][2] = vec_roll
+            #print("bone_table: %s" % bone_table[bone_i][3][2])
+            
+            m_col.append((float(line_split[1]), float(line_split[2]), float(line_split[3])))
+
+            #test_3.append(Vector(vec_roll))
+            
+            test_3.append(m_col)
+            #print("test_3: %s\n\n" % test_3[:])
+
+            if bone_i >= numbones-1:
+                state = 10
+            else:
+                #print("\n---> Increasing bone: %3i" % bone_i)
+                #print("\t" + str(bone_table[bone_i][3]))
+                #print("\t" + str(bone_table[bone_i][0]))
+                bone_i += 1
+                state = 4
+
+        elif state == 10 and line_split[0] == "NUMVERTS":
+            numverts = int(line_split[1])
+            state = 11
+
+        elif state == 11 and line_split[0] == "VERT":
+            vert_num = int(line_split[1])
+            if vert_i != vert_num:
+                error_string = "Unexpected vertex number: %s (expected %i)" % (line_split[1], vert_i)
+                print("\n%s" % error_string)
+                return error_string
+            vert_i += 1
+            state = 12
+
+        elif state == 12 and line_split[0] == "OFFSET":
+            line_split = line.replace(",", "").split()
+            vert_table.append(Vector((float(line_split[1]), float(line_split[2]), float(line_split[3]))))
+            state = 13
+
+        elif state == 13 and line_split[0] == "BONES":
+            # TODO: process
+            bones_influencing_num = int(line_split[1])
+            state= 14
+
+        elif state == 14 and line_split[0] == "BONE":
+            # TODO: add bones to vert_table
+            if bones_influencing_i >= bones_influencing_num-1:
+                if vert_i >= numverts:
+                    state = 15
+                else:
+                    state = 11
+            else:
+                bones_influencing_i += 1
+                #state = 14
+
+        elif state == 15 and line_split[0] == "NUMFACES":
+            numfaces = int(line_split[1])
+            state = 16
+            
+        elif state == 16: #and line_split[0] == "TRI":
+            #face_i += 1
+            face_tmp = []
+            state = 17
+            
+        elif (state == 17 or state == 21 or state == 25) and line_split[0] == "VERT":
+            #print("face_tmp length: %i" % len(face_tmp))
+            face_tmp.append(int(line_split[1]))
+            state += 1
+        
+        elif (state == 18 or state == 22 or state == 26) and line_split[0] == "NORMAL":
+            state += 1
+            
+        elif (state == 19 or state == 23 or state == 27) and line_split[0] == "COLOR":
+            state += 1
+            
+        elif (state == 20 or state == 24 or state == 28) and line_split[0] == "UV":
+            state += 1
+        
+        elif state == 29:
+
+            #print("Adding face: %s\n%i faces so far (of %i)\n" % (str(face_tmp), face_i, numfaces))
+            face_table.append(face_tmp)
+            if (face_i >= numfaces - 1):
+                state = 30
+            else:
+                face_i += 1
+                face_tmp = []
+                state = 17
+                
+        elif state > 15 and state < 30 and line_split[0] == "NUMOBJECTS":
+            print("Bad numfaces, terminated loop\n")
+            state = 30
+            
+        elif state == 30:
+            print("Adding mesh!")
+            me = bpy.data.meshes.new("pymesh")
+            me.from_pydata(vert_table, [], face_table)
+            me.update()
+            ob = bpy.data.objects.new("Py-Mesh", me)
+            bpy.context.scene.objects.link(ob)
+            
+            state = 31
+
+        else: #elif state == 16:
+            #UNDONE
+            print("eh? state is %i line: %s" % (state, line))
+            pass
+
+        #print("\nCurrent state=" + str(state) + "\nLine:" + line)
+
+    #print("\n" + str(list(bone_table)) + "\n\n" + str(list(vert_table)))
+
+    #createRig(context, "Armature", Vector((0,0,0)), bone_table)
+
+    name = "Armature"
+    origin = Vector((0,0,0))
+    boneTable = bone_table
+
+    # If no context object, an object was deleted and mode is 'OBJECT' for sure
+    if context.object: #and context.mode is not 'OBJECT':
+
+        # Change mode, 'cause modes like POSE will lead to incorrect context poll
+        bpy.ops.object.mode_set(mode='OBJECT')
+
+    # Create armature and object
+    bpy.ops.object.add(
+        type='ARMATURE', 
+        enter_editmode=True,
+        location=origin)
+    ob = bpy.context.object
+    ob.show_x_ray = True
+    ob.name = name
+    amt = ob.data
+    amt.name = name + "Amt"
+    #amt.show_axes = True
+
+    # Create bones
+    bpy.ops.object.mode_set(mode='EDIT')
+    #for (bname, pname, vector, matrix) in boneTable:
+    #i = 0
+    for (t0, t1, t2, t3) in zip(test_0, test_1, test_2, test_3):
+
+        t3 = Matrix(t3)
+
+        bone = amt.edit_bones.new(t0)
+        if t1 != -1:
+            parent = amt.edit_bones[t1]
+            bone.parent = parent
+            bone.head = parent.tail
+
+            bone.align_roll((parent.matrix.to_3x3()*t3)[2])
+            #local_mat = parent.matrix.to_3x3() * t3()
+            #bone.align_roll(local_mat[2])
+            from math import degrees
+            print("t3[2]: %s\nroll: %f\n---------" % (t3.col[2], degrees(bone.roll)))
+            #bone.roll = math.radians(180 - math.degrees(bone.roll))
+            #print("###\nalign_roll: %s\nroll: %.2f\ntest_3:%s" % (t3, math.degrees(bone.roll), list(test_3)))
+            bone.use_connect = True
+        else:
+            bone.head = (0,0,0)
+            rot = Matrix.Translation((0,0,0))	# identity matrix
+            bone.align_roll(t3[2])
+            bone.use_connect = False
+        bone.tail = t2
+
+    file.close()
+
+"""
+def createRig(context, name, origin, boneTable):
+
+    # If no context object, an object was deleted and mode is 'OBJECT' for sure
+    if context.object: #and context.mode is not 'OBJECT':
+
+        # Change mode, 'cause modes like POSE will lead to incorrect context poll
+        bpy.ops.object.mode_set(mode='OBJECT')
+
+    # Create armature and object
+    bpy.ops.object.add(
+        type='ARMATURE', 
+        enter_editmode=True,
+        location=origin)
+    ob = bpy.context.object
+    ob.show_x_ray = True
+    ob.name = name
+    amt = ob.data
+    amt.name = name + "Amt"
+    #amt.show_axes = True
+
+    # Create bones
+    bpy.ops.object.mode_set(mode='EDIT')
+    #for (bname, pname, vector, matrix) in boneTable:
+    #i = 0
+    for i in range(len(test_0)):
+        t0 = test_0[i]
+        t1 = test_1[i]
+        t2 = test_2[i]
+        t3 = test_3[i]
+
+        bone = amt.edit_bones.new(t0)
+        if t1 != -1:
+            parent = amt.edit_bones[t1]
+            bone.parent = parent
+            bone.head = parent.tail
+            bone.use_connect = True
+            bone.align_roll(t3)
+            #print("align_roll: %s\nroll: %.2f" % (t3, math.degrees(bone.roll)))
+            #(trans, rot, scale) = parent.matrix.decompose()
+        else:
+            bone.head = (0,0,0)
+            rot = Matrix.Translation((0,0,0))	# identity matrix
+            bone.use_connect = False
+        #bone.tail = Vector(vector) * rot + bone.head
+        bone.tail = t2
+        #bone.tail = boneTable[i][2] #passing boneTable as parameter seems to break it :(
+        #i += 1
+
+    #outfile.write("\n%s" % str(boneTable))
+
+    bpy.ops.object.mode_set(mode='OBJECT')
+    return ob
+"""
diff --git a/release/scripts/addons_contrib/io_scene_open_street_map.py b/release/scripts/addons_contrib/io_scene_open_street_map.py
new file mode 100644
index 0000000..2ac806f
--- /dev/null
+++ b/release/scripts/addons_contrib/io_scene_open_street_map.py
@@ -0,0 +1,209 @@
+# ***** 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+# ***** END GPL LICENCE BLOCK *****
+
+# <pep8 compliant>
+
+bl_info = {
+    "name": "Open Street Map (.osm)",
+    "author": "Michael Anthrax Schlachter",
+    "version": (0, 1),
+    "blender": (2, 6, 3),
+    "location": "File > Import",
+    "description": "Load Open Street Map File",
+    "wiki_url": "",
+    "tracker_url": "",
+    "category": "Import-Export"}
+
+# originally written for blender 2.4x by (manthrax _at_ hotmail.com),
+# updated by for blender 2.6x by ideasman42
+# If you use it for something cool, send me an email and let me know!
+
+import bpy
+from mathutils import Vector, Matrix
+
+
+def parseBranch(nodes, bm, nmap, scale=100.0):
+    tidx = 0
+    inNode = 0
+    dlat = dlong = clat = clong = minlat = maxlat = minlong = maxlong = 0.0
+    for node in nodes:
+        if node.localName == "bounds":
+            if node.hasAttributes():
+                for i in range(node.attributes.length):
+                    at = node.attributes.item(i)
+                    if at.name == "minlat":
+                        minlat = float(at.nodeValue)
+                    elif at.name == "minlon":
+                        minlong = float(at.nodeValue)
+                    elif at.name == "maxlat":
+                        maxlat = float(at.nodeValue)
+                    elif at.name == "maxlon":
+                        maxlong = float(at.nodeValue)
+                dlat = maxlat - minlat
+                dlong = maxlong - minlong
+                clat = (maxlat + minlat) * 0.5
+                clong = (maxlong + minlong) * 0.5
+
+                print(dlat, dlong, clat, clong)
+
+        if node.localName == "way":
+            nid = None
+            refs = []
+            '''
+            if node.hasAttributes():
+                for i in range(node.attributes.length):
+                    at=node.attributes.item(i)
+                    print(at.name)
+            '''
+
+            for ch in node.childNodes:
+                if ch.localName == "nd":
+                    for i in range(ch.attributes.length):
+                        at = ch.attributes.item(i)
+                        #print(at.name)
+                        if at.name == "ref":
+                            refs.append(int(at.nodeValue))
+
+            first = 1
+            for r in refs:
+                if first == 0:
+                    edge = bm.edges.get((nmap[pr], nmap[r]))
+                    if edge is None:
+                        edge = bm.edges.new((nmap[pr], nmap[r]))
+                    del edge  # don't actually use it
+                else:
+                    first = 0
+                pr = r
+
+        if node.localName == "node":
+            if node.hasAttributes():
+                nid = None
+                nlong = None
+                nlat = None
+                logged = 0
+                for i in range(node.attributes.length):
+                    at = node.attributes.item(i)
+                    #print(at.name)
+                    if at.name == "id":
+                        nid = at.nodeValue
+                    elif at.name == "lon":
+                        nlong = at.nodeValue
+                    elif at.name == "lat":
+                        nlat = at.nodeValue
+
+                    if (nid is not None) and (nlat is not None) and (nlong is not None):
+                        fla = (float(nlat) - clat) * scale / dlat
+                        flo = (float(nlong) - clong) * scale / dlat
+                        vert = bm.verts.new((fla, flo, 0.0))
+                        nmap[int(nid)] = vert
+                        logged = 1
+                        break
+        tidx += 1
+        #if tidx > 1000:
+        #    break
+        tidx += parseBranch(node.childNodes, bm, nmap)
+
+    return tidx
+
+
+def read(context, filepath, scale=100.0):
+    import bmesh
+    from xml.dom import minidom
+
+    xmldoc = minidom.parse(filepath)
+
+    print("Starting parse: %r..." % filepath)
+    bm = bmesh.new()
+
+    nmap = {}
+    tidx = parseBranch(xmldoc.childNodes, bm, nmap)
+
+    # create mesh
+    name = bpy.path.display_name_from_filepath(filepath)
+    me = bpy.data.meshes.new(name)
+    bm.to_mesh(me)
+    obj = bpy.data.objects.new(name, me)
+
+    # scale by 1.5 is odd, need to look into that
+    global_matrix = Matrix(((+0.0, +1.0, +0.0, +0.0),
+                            (+1.5, -0.0, +0.0, +0.0),
+                            (+0.0, -0.0, -1.0, +0.0),
+                            (+0.0, +0.0, +0.0, +1.0)))
+    me.transform(global_matrix)
+
+    # create the object in the scene
+    scene = context.scene
+    scene.objects.link(obj)
+    scene.objects.active = obj
+    obj.select = True
+
+    print("Parse done... %d" % tidx)
+
+    return {'FINISHED'}
+
+## for testing
+#if __name__ == "__main__":
+#    read("/data/downloads/osm_parser/map.osm", bpy.context)
+
+
+# ----------------------------------------------------------------------------
+# blender integration
+
+from bpy.types import Operator
+from bpy_extras.io_utils import ImportHelper
+
+from bpy.props import StringProperty, FloatProperty
+
+
+class ImportOSM(Operator, ImportHelper):
+    '''Import OSM'''
+    bl_idname = "import.open_street_map"
+    bl_label = "Import OpenStreetMap (.osm)"
+
+    # ExportHelper mixin class uses this
+    filename_ext = ".osm"
+
+    filter_glob = StringProperty(
+            default="*.osm",
+            options={'HIDDEN'},
+            )
+
+    # List of operator properties, the attributes will be assigned
+    # to the class instance from the operator settings before calling.
+    scale = FloatProperty(
+            name="Scale",
+            default=100.0,
+            )
+
+    def execute(self, context):
+        return read(context, self.filepath, self.scale)
+
+
+# Only needed if you want to add into a dynamic menu
+def menu_func_export(self, context):
+    self.layout.operator(ImportOSM.bl_idname)
+
+
+def register():
+    bpy.utils.register_class(ImportOSM)
+    bpy.types.INFO_MT_file_import.append(menu_func_export)
+
+
+def unregister():
+    bpy.utils.unregister_class(ImportOSM)
+    bpy.types.INFO_MT_file_import.remove(menu_func_export)
diff --git a/release/scripts/addons_contrib/mesh_bevel_round.py b/release/scripts/addons_contrib/mesh_bevel_round.py
new file mode 100644
index 0000000..d2f494b
--- /dev/null
+++ b/release/scripts/addons_contrib/mesh_bevel_round.py
@@ -0,0 +1,2862 @@
+# ##### 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": \
+      "TODO",
+    "tracker_url": \
+      "TODO",
+    "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 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():
+            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:
+                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 lpt.length > 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])
+
+        # Parse close to the other face
+        if reversed:
+            face2 = ed2.facemain
+        else:
+            face2 = find(ed2.lfaces, lambda f: f != ed2.facemain)
+        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, ve1, 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?  We do if the end of the beveled edge
+                # isn't in the plane of other faces not adjacent to the edge
+                needcornerface = False
+                for f in vd.vertex.link_faces:
+                    if f == ed.lfaces[0] or f == ed.lfaces[1]:
+                        continue
+                    plane = face_plane(f)
+                    if not (on_plane(section[0], plane) and on_plane(section[-1], plane)):
+                        needcornerface = True
+                        break
+                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):
+        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 __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 polynomail
+    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 + vec)
+    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
+    
+
+# 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 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_edge_intersection_tools.py b/release/scripts/addons_contrib/mesh_edge_intersection_tools.py
index 2357e74..d2c3bad 100644
--- a/release/scripts/addons_contrib/mesh_edge_intersection_tools.py
+++ b/release/scripts/addons_contrib/mesh_edge_intersection_tools.py
@@ -25,7 +25,7 @@ bl_info = {
     "blender": (2, 5, 6),
     "category": "Mesh",
     "location": "View3D > EditMode > (w) Specials",
-    "warning": "Still under development, bug reports appreciated",
+    "warning": "Still under development",
     "wiki_url": "http://wiki.blender.org/index.php/"\
         "Extensions:2.5/Py/Scripts/Modeling/Edge_Slice",
     "tracker_url": "http://projects.blender.org/tracker/"\
@@ -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(limit=VTX_PRECISION)
+    bpy.ops.mesh.remove_doubles(mergedist=VTX_PRECISION)
     bpy.ops.mesh.select_all(action='TOGGLE') #unselect all
 
 
diff --git a/release/scripts/addons_contrib/mesh_face_info_select.py b/release/scripts/addons_contrib/mesh_face_info_select.py
new file mode 100644
index 0000000..cd9d48d
--- /dev/null
+++ b/release/scripts/addons_contrib/mesh_face_info_select.py
@@ -0,0 +1,124 @@
+# ##### 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": "Face info / select by type",
+    "author": "CoDEmanX",
+    "version": (0, 0, 3),
+    "blender": (2, 6, 2),
+    "location": "Object data > Face info / select",
+    "description": "Displays triangle, quad and ngon count of the active object. Allows to select faces by these type.",
+    "warning": "",
+    "wiki_url": "",
+    "tracker_url": "",
+    "support": 'TESTING',
+    "category": "Mesh"
+}
+
+# Written by CoDEmanX for frivus
+
+
+import bpy
+from bpy.props import EnumProperty
+
+class DATA_OP_facetype_select(bpy.types.Operator):
+    '''Selects 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")
+    @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')
+        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_by_number_vertices(number=3, type='EQUAL')
+        elif self.face_type == "4":
+            bpy.ops.mesh.select_by_number_vertices(number=4, type='EQUAL')
+        else:
+            bpy.ops.mesh.select_by_number_vertices(number=4, type='GREATER')
+
+        return {'FINISHED'}
+        
+
+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"
+
+    @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"
+
+
+def register():
+    bpy.utils.register_class(DATA_PT_info_panel)
+    bpy.utils.register_class(DATA_OP_facetype_select)
+
+
+def unregister():
+    bpy.utils.unregister_class(DATA_PT_info_panel)
+    bpy.utils.unregister_class(DATA_OP_facetype_select)
+
+
+if __name__ == "__main__":
+    register()
diff --git a/release/scripts/addons_contrib/mesh_inset_extrude.py b/release/scripts/addons_contrib/mesh_inset_extrude.py
index d6d1f09..b53c6af 100644
--- a/release/scripts/addons_contrib/mesh_inset_extrude.py
+++ b/release/scripts/addons_contrib/mesh_inset_extrude.py
@@ -5,11 +5,11 @@ bl_info = {
     'version': (0, 6),
     'blender': (2, 5, 9),
     'location': 'Search for Inset Extrude, map a key to the operator "mesh.inset_extrude", or use the default "I-key"',
-    'warning': "",
+    'warning': "Broken",
     'category': 'Mesh',
     'wiki_url': 'http://wiki.blender.org/index.php/Extensions:2.5/Py/Scripts/Modeling/Inset-Extrude'}
 
-import bpy
+import bpy, bmesh
 import bgl
 import blf
 from math import *
@@ -20,12 +20,12 @@ def find_sel_faces(mesh, individual_faces):
     selected_faces = []
     selected_islands = []
     if individual_faces:
-        for face in mesh.faces:
+        for face in mesh.polygons:
             if face.select and not face.hide:
                 selected_islands.append([face.index])
         return(selected_islands)
     
-    for face in mesh.faces:
+    for face in mesh.polygons:
         if face.select and not face.hide: selected_faces.append(face.index)
     selected_islands = []
     while len(selected_faces) != 0:
@@ -56,8 +56,8 @@ def island_extend(mesh, active_faces, selected_faces):
     for face in active_faces:
         cf = []
         for f in selected_faces:
-            for edge in mesh.faces[face].edge_keys:
-                if edge in mesh.faces[f].edge_keys and f not in connected_faces:
+            for edge in mesh.polygons[face].edge_keys:
+                if edge in mesh.polygons[f].edge_keys and f not in connected_faces:
                     connected_faces.append(f)
                     cf.append(f)
                     break
@@ -68,7 +68,7 @@ def island_extend(mesh, active_faces, selected_faces):
 def find_outer_edge(mesh, island):
     edges = []
     for face in island:
-        for edge in mesh.faces[face].edge_keys: edges.append(edge)
+        for edge in mesh.polygons[face].edge_keys: edges.append(edge)
     outer_edges = []
     for edge in edges:
         if edges.count(edge) == 1:
@@ -115,10 +115,10 @@ def find_norm_vectors(mesh, vert_dict):
 def find_edge_faces(mesh, sel_faces, vert_dict):
     edge_faces = []
     for face in sel_faces:
-        for vert in mesh.faces[face].vertices:
+        for vert in mesh.polygons[face].vertices:
             if vert in vert_dict:
-                vert_dict[vert].faces.append(mesh.faces[face].index)
-                if face not in edge_faces: edge_faces.append(mesh.faces[face].index)
+                vert_dict[vert].faces.append(mesh.polygons[face].index)
+                if face not in edge_faces: edge_faces.append(mesh.polygons[face].index)
     return edge_faces
 
 def find_offset_vec(mesh, vert_dict):
@@ -127,7 +127,7 @@ def find_offset_vec(mesh, vert_dict):
             rel_vec = []         # vertex vectors relative to active vertex
             a = 0       # nr of verts on side 'a' of plane
             b = 0       # on side b
-            for v in mesh.faces[face].vertices:
+            for v in mesh.polygons[face].vertices:
                 if v == vert: continue
                 rel_co = mesh.vertices[vert].co.copy() - mesh.vertices[v].co.copy()
                 rel_vec = rel_co/rel_co.length
@@ -144,7 +144,7 @@ def find_offset_vec(mesh, vert_dict):
                 break
         
         # find offset_vector
-        offset_vec_raw = Vector.cross(mesh.faces[middle_face].normal, vert_dict[vert].norm_vec)
+        offset_vec_raw = Vector.cross(mesh.polygons[middle_face].normal, vert_dict[vert].norm_vec)
         offset_vec_norm = offset_vec_raw / offset_vec_raw.length
         angle = acos(offset_vec_norm * vert_dict[vert].edge_vec)
         if sin(angle) == 0:
@@ -153,9 +153,9 @@ def find_offset_vec(mesh, vert_dict):
         
         if len(vert_dict[vert].faces) == 1:
             face_center = Vector([0, 0, 0])
-            for v in mesh.faces[middle_face].vertices:
+            for v in mesh.polygons[middle_face].vertices:
                 face_center += mesh.vertices[v].co.copy()
-            face_center /= len(mesh.faces[middle_face].vertices)
+            face_center /= len(mesh.polygons[middle_face].vertices)
             
             case1 = (face_center - mesh.vertices[vert].co.copy()) + offset_vec
             case2 = (face_center - mesh.vertices[vert].co.copy()) - offset_vec
@@ -163,11 +163,11 @@ def find_offset_vec(mesh, vert_dict):
                 offset_vec.negate()        
         
         else:
-            for edge in mesh.faces[middle_face].edge_keys:
+            for edge in mesh.polygons[middle_face].edge_keys:
                 test = False
                 for face in vert_dict[vert].faces:
                     if face == middle_face: continue
-                    if edge in mesh.faces[face].edge_keys: 
+                    if edge in mesh.polygons[face].edge_keys: 
                         test = True
                         break
                 if test:
@@ -190,7 +190,7 @@ def new_faces(mesh, island_dicts, edge_faces, outer_edges):
         vert_dict = island_dicts[edge_faces.index(island)]
         for face in island:
             f_verts = []
-            for vert in mesh.faces[face].vertices:
+            for vert in mesh.polygons[face].vertices:
                 if vert in vert_dict:
                     f_verts.append(vert_dict[vert].new_index)
                 else:
@@ -210,12 +210,12 @@ def new_faces(mesh, island_dicts, edge_faces, outer_edges):
     
     ef_size = 0
     for i in edge_faces: ef_size += len(i)
-    n_faces_old = len(mesh.faces)
+    n_faces_old = len(mesh.polygons)
     rim_select = range(n_faces_old - ef_size, (n_faces_old+len(faces_new)) - not_selected - ef_size)
     rim_noSelect = range((n_faces_old - ef_size) + (len(faces_new) - not_selected), n_faces_old - ef_size + len(faces_new))
-    mesh.faces.add(len(faces_new))
+    mesh.polygons.add(len(faces_new))
     for i in range(len(faces_new)):
-        mesh.faces[n_faces_old + i].vertices_raw = faces_new[i]
+        mesh.polygons[n_faces_old + i].vertices = faces_new[i]
     mesh.update(calc_edges = True)
     
     bpy.ops.object.mode_set(mode = 'EDIT')
@@ -223,7 +223,7 @@ def new_faces(mesh, island_dicts, edge_faces, outer_edges):
     bpy.ops.object.mode_set(mode = 'OBJECT')
     for island in edge_faces:
         for face in island:
-            mesh.faces[face].select = True
+            mesh.polygons[face].select = True
     bpy.ops.object.mode_set(mode = 'EDIT')
     bpy.ops.mesh.delete(type='FACE')
     bpy.ops.object.mode_set(mode = 'OBJECT')
@@ -235,12 +235,12 @@ def find_shortest_edge(mesh, edge_faces, vert_dict, outer_edges):
     # will be used for scaling the sensitivity of the interface
     shortest_edge = -1
     if len(edge_faces) == 1:
-        for edge in mesh.faces[edge_faces[0]].edge_keys:
+        for edge in mesh.polygons[edge_faces[0]].edge_keys:
             edgeco = mesh.vertices[edge[0]].co - mesh.vertices[edge[1]].co
             if shortest_edge < 0 or edgeco.length < shortest_edge:
                 shortest_edge = edgeco.length
     for face in edge_faces:        
-        for edge in mesh.faces[face].edge_keys:
+        for edge in mesh.polygons[face].edge_keys:
             if (edge not in outer_edges) and (edge[0] in vert_dict or edge[1] in vert_dict):
                 edgeco = mesh.vertices[edge[0]].co - mesh.vertices[edge[1]].co
                 if shortest_edge < 0 or edgeco.length < shortest_edge:
@@ -251,12 +251,12 @@ def find_displace_vecs(mesh, sel_faces, vert_dict):
     area = 0
     inside_verts = {}
     for face in sel_faces:
-        for vert in mesh.faces[face].vertices:
+        for vert in mesh.polygons[face].vertices:
             if vert in inside_verts:
-                inside_verts[vert].append(mesh.faces[face].normal)
+                inside_verts[vert].append(mesh.polygons[face].normal)
             else:
-                inside_verts[vert] = [mesh.faces[face].normal]
-        area += mesh.faces[face].area
+                inside_verts[vert] = [mesh.polygons[face].normal]
+        area += mesh.polygons[face].area
     displace_vecs = {}
     for vert in list(inside_verts.keys()):
         vec_norm = Vector([0,0,0])
@@ -279,8 +279,8 @@ def select_faces(mesh, rim_select, rim_noSelect, edge_faces, n_faces_old, ref_no
     all.extend(rim_select)
     all.extend(rim_noSelect)
     for face in all:
-        mesh.faces[face].select = True
-        mesh.faces[face].use_smooth = use_smooth
+        face = bpy.context.object.data.polygons.active = True
+        mesh.polygons[face].use_smooth = use_smooth
     bpy.ops.object.mode_set(mode = 'EDIT')
     bpy.ops.object.vertex_group_select()
     bpy.ops.mesh.normals_make_consistent()
@@ -289,15 +289,14 @@ def select_faces(mesh, rim_select, rim_noSelect, edge_faces, n_faces_old, ref_no
     bpy.ops.object.mode_set(mode = 'EDIT')
     ef_size = 0
     for i in edge_faces: ef_size += len(i)
-    if mesh.faces[n_faces_old - ef_size].normal * ref_normal < 0.9:
+    if mesh.polygons[n_faces_old - ef_size].normal * ref_normal < 0.9:
         bpy.ops.mesh.flip_normals()
     bpy.ops.mesh.select_all(action='DESELECT')
     bpy.ops.object.vertex_group_select()
     bpy.ops.object.vertex_group_remove()
     bpy.ops.object.mode_set(mode = 'OBJECT')
     for face in rim_select:
-        mesh.faces[face].select = True
-
+        bpy.context.object.data.polygons.active = True
 
 def run_inset_extrude(mesh, individual_faces):
     sel_faces = find_sel_faces(mesh, individual_faces)
@@ -318,8 +317,8 @@ def run_inset_extrude(mesh, individual_faces):
         
         edge_faces = find_edge_faces(mesh, island, vert_dict)
         edge_faces_islands.append(edge_faces)
-        ref_normal = mesh.faces[edge_faces[0]].normal.copy()
-        use_smooth = mesh.faces[edge_faces[0]].use_smooth
+        ref_normal = mesh.polygons[edge_faces[0]].normal.copy()
+        use_smooth = mesh.polygons[edge_faces[0]].use_smooth
         find_offset_vec(mesh, vert_dict)
         
         short_edge = find_shortest_edge(mesh, edge_faces, vert_dict, out_edges)
diff --git a/release/scripts/addons_contrib/mesh_looptools.py b/release/scripts/addons_contrib/mesh_looptools.py
new file mode 100644
index 0000000..cee5de6
--- /dev/null
+++ b/release/scripts/addons_contrib/mesh_looptools.py
@@ -0,0 +1,3728 @@
+# ##### 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': "LoopTools",
+    'author': "Bart Crouch",
+    'version': (3, 2, 4),
+    'blender': (2, 6, 2),
+    'location': "View3D > Toolbar and View3D > Specials (W-key)",
+    'warning': "Bridge & Loft functions removed",
+    'description': "Mesh modelling toolkit. Several tools to aid modelling",
+    'wiki_url': "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
+        "Scripts/Modeling/LoopTools",
+    'tracker_url': "http://projects.blender.org/tracker/index.php?"\
+        "func=detail&aid=26189",
+    'category': 'Mesh'}
+
+
+import bpy
+import mathutils
+import math
+
+
+##########################################
+####### General functions ################
+##########################################
+
+
+# used by all tools to improve speed on reruns
+looptools_cache = {}
+
+
+# force a full recalculation next time
+def cache_delete(tool):
+    if tool in looptools_cache:
+        del looptools_cache[tool]
+
+
+# check cache for stored information
+def cache_read(tool, object, mesh, input_method, boundaries):
+    # current tool not cached yet
+    if tool not in looptools_cache:
+        return(False, False, False, False, False)
+    # check if selected object didn't change
+    if object.name != looptools_cache[tool]["object"]:
+        return(False, False, False, False, False)
+    # check if input didn't change
+    if input_method != looptools_cache[tool]["input_method"]:
+        return(False, False, False, False, False)
+    if boundaries != looptools_cache[tool]["boundaries"]:
+        return(False, False, False, False, False)
+    modifiers = [mod.name for mod in object.modifiers if mod.show_viewport \
+        and mod.type == 'MIRROR']
+    if modifiers != looptools_cache[tool]["modifiers"]:
+        return(False, False, False, False, False)
+    input = [v.index for v in mesh.vertices if v.select and not v.hide]
+    if input != looptools_cache[tool]["input"]:
+        return(False, False, False, False, False)
+    # reading values
+    single_loops = looptools_cache[tool]["single_loops"]
+    loops = looptools_cache[tool]["loops"]
+    derived = looptools_cache[tool]["derived"]
+    mapping = looptools_cache[tool]["mapping"]
+    
+    return(True, single_loops, loops, derived, mapping)
+
+
+# store information in the cache
+def cache_write(tool, object, mesh, input_method, boundaries, single_loops,
+loops, derived, mapping):
+    # clear cache of current tool
+    if tool in looptools_cache:
+        del looptools_cache[tool]
+    # prepare values to be saved to cache
+    input = [v.index for v in mesh.vertices if v.select and not v.hide]
+    modifiers = [mod.name for mod in object.modifiers if mod.show_viewport \
+        and mod.type == 'MIRROR']
+    # update cache
+    looptools_cache[tool] = {"input": input, "object": object.name,
+        "input_method": input_method, "boundaries": boundaries,
+        "single_loops": single_loops, "loops": loops,
+        "derived": derived, "mapping": mapping, "modifiers": modifiers}
+
+
+# calculates natural cubic splines through all given knots
+def calculate_cubic_splines(mesh_mod, tknots, knots):
+    # hack for circular loops
+    if knots[0] == knots[-1] and len(knots) > 1:
+        circular = True
+        k_new1 = []
+        for k in range(-1, -5, -1):
+            if k - 1 < -len(knots):
+                k += len(knots)
+            k_new1.append(knots[k-1])
+        k_new2 = []
+        for k in range(4):
+            if k + 1 > len(knots) - 1:
+                k -= len(knots)
+            k_new2.append(knots[k+1])
+        for k in k_new1:
+            knots.insert(0, k)
+        for k in k_new2:
+            knots.append(k)
+        t_new1 = []
+        total1 = 0
+        for t in range(-1, -5, -1):
+            if t - 1 < -len(tknots):
+                t += len(tknots)
+            total1 += tknots[t] - tknots[t-1]
+            t_new1.append(tknots[0] - total1)
+        t_new2 = []
+        total2 = 0
+        for t in range(4):
+            if t + 1 > len(tknots) - 1:
+                t -= len(tknots)
+            total2 += tknots[t+1] - tknots[t]
+            t_new2.append(tknots[-1] + total2)
+        for t in t_new1:
+            tknots.insert(0, t)
+        for t in t_new2:
+            tknots.append(t)
+    else:
+        circular = False
+    # end of hack
+    
+    n = len(knots)
+    if n < 2:
+        return False
+    x = tknots[:]
+    locs = [mesh_mod.vertices[k].co[:] for k in knots]
+    result = []
+    for j in range(3):
+        a = []
+        for i in locs:
+            a.append(i[j])
+        h = []
+        for i in range(n-1):
+            if x[i+1] - x[i] == 0:
+                h.append(1e-8)
+            else:
+                h.append(x[i+1] - x[i])
+        q = [False]
+        for i in range(1, n-1):
+            q.append(3/h[i]*(a[i+1]-a[i]) - 3/h[i-1]*(a[i]-a[i-1]))
+        l = [1.0]
+        u = [0.0]
+        z = [0.0]
+        for i in range(1, n-1):
+            l.append(2*(x[i+1]-x[i-1]) - h[i-1]*u[i-1])
+            if l[i] == 0:
+                l[i] = 1e-8
+            u.append(h[i] / l[i])
+            z.append((q[i] - h[i-1] * z[i-1]) / l[i])
+        l.append(1.0)
+        z.append(0.0)
+        b = [False for i in range(n-1)]
+        c = [False for i in range(n)]
+        d = [False for i in range(n-1)]
+        c[n-1] = 0.0
+        for i in range(n-2, -1, -1):
+            c[i] = z[i] - u[i]*c[i+1]
+            b[i] = (a[i+1]-a[i])/h[i] - h[i]*(c[i+1]+2*c[i])/3
+            d[i] = (c[i+1]-c[i]) / (3*h[i])
+        for i in range(n-1):
+            result.append([a[i], b[i], c[i], d[i], x[i]])
+    splines = []
+    for i in range(len(knots)-1):
+        splines.append([result[i], result[i+n-1], result[i+(n-1)*2]])
+    if circular: # cleaning up after hack
+        knots = knots[4:-4]
+        tknots = tknots[4:-4]
+    
+    return(splines)
+
+
+# calculates linear splines through all given knots
+def calculate_linear_splines(mesh_mod, tknots, knots):
+    splines = []
+    for i in range(len(knots)-1):
+        a = mesh_mod.vertices[knots[i]].co
+        b = mesh_mod.vertices[knots[i+1]].co
+        d = b-a
+        t = tknots[i]
+        u = tknots[i+1]-t
+        splines.append([a, d, t, u]) # [locStart, locDif, tStart, tDif]
+    
+    return(splines)
+
+
+# calculate a best-fit plane to the given vertices
+def calculate_plane(mesh_mod, loop, method="best_fit", object=False):
+    # getting the vertex locations
+    locs = [mesh_mod.vertices[v].co.copy() for v in loop[0]]
+    
+    # calculating the center of masss
+    com = mathutils.Vector()
+    for loc in locs:
+        com += loc
+    com /= len(locs)
+    x, y, z = com
+    
+    if method == 'best_fit':
+        # creating the covariance matrix
+        mat = mathutils.Matrix(((0.0, 0.0, 0.0),
+                                (0.0, 0.0, 0.0),
+                                (0.0, 0.0, 0.0),
+                                ))
+        for loc in locs:
+            mat[0][0] += (loc[0]-x)**2
+            mat[1][0] += (loc[0]-x)*(loc[1]-y)
+            mat[2][0] += (loc[0]-x)*(loc[2]-z)
+            mat[0][1] += (loc[1]-y)*(loc[0]-x)
+            mat[1][1] += (loc[1]-y)**2
+            mat[2][1] += (loc[1]-y)*(loc[2]-z)
+            mat[0][2] += (loc[2]-z)*(loc[0]-x)
+            mat[1][2] += (loc[2]-z)*(loc[1]-y)
+            mat[2][2] += (loc[2]-z)**2
+        
+        # calculating the normal to the plane
+        normal = False
+        try:
+            mat.invert()
+        except:
+            if sum(mat[0]) == 0.0:
+                normal = mathutils.Vector((1.0, 0.0, 0.0))
+            elif sum(mat[1]) == 0.0:
+                normal = mathutils.Vector((0.0, 1.0, 0.0))
+            elif sum(mat[2]) == 0.0:
+                normal = mathutils.Vector((0.0, 0.0, 1.0))
+        if not normal:
+            # warning! this is different from .normalize()
+            itermax = 500
+            iter = 0
+            vec = mathutils.Vector((1.0, 1.0, 1.0))
+            vec2 = (mat * vec)/(mat * vec).length
+            while vec != vec2 and iter<itermax:
+                iter+=1
+                vec = vec2
+                vec2 = mat * vec
+                if vec2.length != 0:
+                    vec2 /= vec2.length
+            if vec2.length == 0:
+                vec2 = mathutils.Vector((1.0, 1.0, 1.0))
+            normal = vec2
+    
+    elif method == 'normal':
+        # averaging the vertex normals
+        v_normals = [mesh_mod.vertices[v].normal for v in loop[0]]
+        normal = mathutils.Vector()
+        for v_normal in v_normals:
+            normal += v_normal
+        normal /= len(v_normals)
+        normal.normalize()
+        
+    elif method == 'view':
+        # calculate view normal
+        rotation = bpy.context.space_data.region_3d.view_matrix.to_3x3().\
+            inverted()
+        normal = rotation * mathutils.Vector((0.0, 0.0, 1.0))
+        if object:
+            normal = object.matrix_world.inverted().to_euler().to_matrix() * \
+                     normal
+    
+    return(com, normal)
+
+
+# calculate splines based on given interpolation method (controller function)
+def calculate_splines(interpolation, mesh_mod, tknots, knots):
+    if interpolation == 'cubic':
+        splines = calculate_cubic_splines(mesh_mod, tknots, knots[:])
+    else: # interpolations == 'linear'
+        splines = calculate_linear_splines(mesh_mod, tknots, knots[:])
+    
+    return(splines)
+
+
+# check loops and only return valid ones
+def check_loops(loops, mapping, mesh_mod):
+    valid_loops = []
+    for loop, circular in loops:
+        # loop needs to have at least 3 vertices
+        if len(loop) < 3:
+            continue
+        # loop needs at least 1 vertex in the original, non-mirrored mesh
+        if mapping:
+            all_virtual = True
+            for vert in loop:
+                if mapping[vert] > -1:
+                    all_virtual = False
+                    break
+            if all_virtual:
+                continue
+        # vertices can not all be at the same location
+        stacked = True
+        for i in range(len(loop) - 1):
+            if (mesh_mod.vertices[loop[i]].co - \
+            mesh_mod.vertices[loop[i+1]].co).length > 1e-6:
+                stacked = False
+                break
+        if stacked:
+            continue    
+        # passed all tests, loop is valid
+        valid_loops.append([loop, circular])
+    
+    return(valid_loops)
+
+
+# input: mesh, output: dict with the edge-key as key and face-index as value
+def dict_edge_faces(mesh):
+    edge_faces = dict([[edge.key, []] for edge in mesh.edges if not edge.hide])
+    for face in mesh.tessfaces:
+        if face.hide:
+            continue
+        for key in face.edge_keys:
+            edge_faces[key].append(face.index)
+    
+    return(edge_faces)
+
+# input: mesh (edge-faces optional), output: dict with face-face connections
+def dict_face_faces(mesh, edge_faces=False):
+    if not edge_faces:
+        edge_faces = dict_edge_faces(mesh)
+    
+    connected_faces = dict([[face.index, []] for face in mesh.tessfaces if \
+        not face.hide])
+    for face in mesh.tessfaces:
+        if face.hide:
+            continue
+        for edge_key in face.edge_keys:
+            for connected_face in edge_faces[edge_key]:
+                if connected_face == face.index:
+                    continue
+                connected_faces[face.index].append(connected_face)
+    
+    return(connected_faces)
+
+
+# input: mesh, output: dict with the vert index as key and edge-keys as value
+def dict_vert_edges(mesh):
+    vert_edges = dict([[v.index, []] for v in mesh.vertices if not v.hide])
+    for edge in mesh.edges:
+        if edge.hide:
+            continue
+        for vert in edge.key:
+            vert_edges[vert].append(edge.key)
+    
+    return(vert_edges)
+
+
+# input: mesh, output: dict with the vert index as key and face index as value
+def dict_vert_faces(mesh):
+    vert_faces = dict([[v.index, []] for v in mesh.vertices if not v.hide])
+    for face in mesh.tessfaces:
+        if not face.hide:
+            for vert in face.vertices:
+                vert_faces[vert].append(face.index)
+                
+    return(vert_faces)
+
+
+# input: list of edge-keys, output: dictionary with vertex-vertex connections
+def dict_vert_verts(edge_keys):
+    # create connection data
+    vert_verts = {}
+    for ek in edge_keys:
+        for i in range(2):
+            if ek[i] in vert_verts:
+                vert_verts[ek[i]].append(ek[1-i])
+            else:
+                vert_verts[ek[i]] = [ek[1-i]]
+    
+    return(vert_verts)
+
+
+# calculate input loops
+def get_connected_input(object, mesh, scene, input):
+    # get mesh with modifiers applied
+    derived, mesh_mod = get_derived_mesh(object, mesh, scene)
+    
+    # calculate selected loops
+    edge_keys = [edge.key for edge in mesh_mod.edges if \
+        edge.select and not edge.hide]
+    loops = get_connected_selections(edge_keys)
+    
+    # if only selected loops are needed, we're done
+    if input == 'selected':
+        return(derived, mesh_mod, loops)
+    # elif input == 'all':    
+    loops = get_parallel_loops(mesh_mod, loops)
+    
+    return(derived, mesh_mod, loops)
+
+
+# sorts all edge-keys into a list of loops
+def get_connected_selections(edge_keys):
+    # create connection data
+    vert_verts = dict_vert_verts(edge_keys)
+    
+    # find loops consisting of connected selected edges
+    loops = []
+    while len(vert_verts) > 0:
+        loop = [iter(vert_verts.keys()).__next__()]
+        growing = True
+        flipped = False
+        
+        # extend loop
+        while growing:
+            # no more connection data for current vertex
+            if loop[-1] not in vert_verts:
+                if not flipped:
+                    loop.reverse()
+                    flipped = True
+                else:
+                    growing = False
+            else:
+                extended = False
+                for i, next_vert in enumerate(vert_verts[loop[-1]]):
+                    if next_vert not in loop:
+                        vert_verts[loop[-1]].pop(i)
+                        if len(vert_verts[loop[-1]]) == 0:
+                            del vert_verts[loop[-1]]
+                        # remove connection both ways
+                        if next_vert in vert_verts:
+                            if len(vert_verts[next_vert]) == 1:
+                                del vert_verts[next_vert]
+                            else:
+                                vert_verts[next_vert].remove(loop[-1])
+                        loop.append(next_vert)
+                        extended = True
+                        break
+                if not extended:
+                    # found one end of the loop, continue with next
+                    if not flipped:
+                        loop.reverse()
+                        flipped = True
+                    # found both ends of the loop, stop growing
+                    else:
+                        growing = False
+        
+        # check if loop is circular
+        if loop[0] in vert_verts:
+            if loop[-1] in vert_verts[loop[0]]:
+                # is circular
+                if len(vert_verts[loop[0]]) == 1:
+                    del vert_verts[loop[0]]
+                else:
+                    vert_verts[loop[0]].remove(loop[-1])
+                if len(vert_verts[loop[-1]]) == 1:
+                    del vert_verts[loop[-1]]
+                else:
+                    vert_verts[loop[-1]].remove(loop[0])
+                loop = [loop, True]
+            else:
+                # not circular
+                loop = [loop, False]
+        else:
+            # not circular
+            loop = [loop, False]
+        
+        loops.append(loop)
+    
+    return(loops)
+
+
+# get the derived mesh data, if there is a mirror modifier
+def get_derived_mesh(object, mesh, scene):
+    # check for mirror modifiers
+    if 'MIRROR' in [mod.type for mod in object.modifiers if mod.show_viewport]:
+        derived = True
+        # disable other modifiers
+        show_viewport = [mod.name for mod in object.modifiers if \
+            mod.show_viewport]
+        for mod in object.modifiers:
+            if mod.type != 'MIRROR':
+                mod.show_viewport = False
+        # get derived mesh
+        mesh_mod = object.to_mesh(scene, True, 'PREVIEW')
+        # re-enable other modifiers
+        for mod_name in show_viewport:
+            object.modifiers[mod_name].show_viewport = True
+    # no mirror modifiers, so no derived mesh necessary
+    else:
+        derived = False
+        mesh_mod = mesh
+    
+    return(derived, mesh_mod)
+
+
+# return a mapping of derived indices to indices
+def get_mapping(derived, mesh, mesh_mod, single_vertices, full_search, loops):
+    if not derived:
+        return(False)
+    
+    if full_search:
+        verts = [v for v in mesh.vertices if not v.hide]
+    else:
+        verts = [v for v in mesh.vertices if v.select and not v.hide]
+    
+    # non-selected vertices around single vertices also need to be mapped
+    if single_vertices:
+        mapping = dict([[vert, -1] for vert in single_vertices])
+        verts_mod = [mesh_mod.vertices[vert] for vert in single_vertices]
+        for v in verts:
+            for v_mod in verts_mod:
+                if (v.co - v_mod.co).length < 1e-6:
+                    mapping[v_mod.index] = v.index
+                    break
+        real_singles = [v_real for v_real in mapping.values() if v_real>-1]
+        
+        verts_indices = [vert.index for vert in verts]
+        for face in [face for face in mesh.tessfaces if not face.select \
+        and not face.hide]:
+            for vert in face.vertices:
+                if vert in real_singles:
+                    for v in face.vertices:
+                        if not v in verts_indices:
+                            if mesh.vertices[v] not in verts:
+                                verts.append(mesh.vertices[v])
+                    break
+    
+    # create mapping of derived indices to indices
+    mapping = dict([[vert, -1] for loop in loops for vert in loop[0]])
+    if single_vertices:
+        for single in single_vertices:
+            mapping[single] = -1
+    verts_mod = [mesh_mod.vertices[i] for i in mapping.keys()]
+    for v in verts:
+        for v_mod in verts_mod:
+            if (v.co - v_mod.co).length < 1e-6:
+                mapping[v_mod.index] = v.index
+                verts_mod.remove(v_mod)
+                break
+    
+    return(mapping)
+
+
+# returns a list of all loops parallel to the input, input included
+def get_parallel_loops(mesh_mod, loops):
+    # get required dictionaries
+    edge_faces = dict_edge_faces(mesh_mod)
+    connected_faces = dict_face_faces(mesh_mod, edge_faces)
+    # turn vertex loops into edge loops
+    edgeloops = []
+    for loop in loops:
+        edgeloop = [[sorted([loop[0][i], loop[0][i+1]]) for i in \
+            range(len(loop[0])-1)], loop[1]]
+        if loop[1]: # circular
+            edgeloop[0].append(sorted([loop[0][-1], loop[0][0]]))
+        edgeloops.append(edgeloop[:])
+    # variables to keep track while iterating
+    all_edgeloops = []
+    has_branches = False
+    
+    for loop in edgeloops:
+        # initialise with original loop
+        all_edgeloops.append(loop[0])
+        newloops = [loop[0]]
+        verts_used = []
+        for edge in loop[0]:
+            if edge[0] not in verts_used:
+                verts_used.append(edge[0])
+            if edge[1] not in verts_used:
+                verts_used.append(edge[1])
+        
+        # find parallel loops
+        while len(newloops) > 0:
+            side_a = []
+            side_b = []
+            for i in newloops[-1]:
+                i = tuple(i)
+                forbidden_side = False
+                if not i in edge_faces:
+                    # weird input with branches
+                    has_branches = True
+                    break
+                for face in edge_faces[i]:
+                    if len(side_a) == 0 and forbidden_side != "a":
+                        side_a.append(face)
+                        if forbidden_side:
+                            break
+                        forbidden_side = "a"
+                        continue
+                    elif side_a[-1] in connected_faces[face] and \
+                    forbidden_side != "a":
+                        side_a.append(face)
+                        if forbidden_side:
+                            break
+                        forbidden_side = "a"
+                        continue
+                    if len(side_b) == 0 and forbidden_side != "b":
+                        side_b.append(face)
+                        if forbidden_side:
+                            break
+                        forbidden_side = "b"
+                        continue
+                    elif side_b[-1] in connected_faces[face] and \
+                    forbidden_side != "b":
+                        side_b.append(face)
+                        if forbidden_side:
+                            break
+                        forbidden_side = "b"
+                        continue
+            
+            if has_branches:
+                # weird input with branches
+                break
+            
+            newloops.pop(-1)
+            sides = []
+            if side_a:
+                sides.append(side_a)
+            if side_b:
+                sides.append(side_b)
+            
+            for side in sides:
+                extraloop = []
+                for fi in side:
+                    for key in mesh_mod.tessfaces[fi].edge_keys:
+                        if key[0] not in verts_used and key[1] not in \
+                        verts_used:
+                            extraloop.append(key)
+                            break
+                if extraloop:
+                    for key in extraloop:
+                        for new_vert in key:
+                            if new_vert not in verts_used:
+                                verts_used.append(new_vert)
+                    newloops.append(extraloop)
+                    all_edgeloops.append(extraloop)
+    
+    # input contains branches, only return selected loop
+    if has_branches:
+        return(loops)
+    
+    # change edgeloops into normal loops
+    loops = []
+    for edgeloop in all_edgeloops:
+        loop = []
+        # grow loop by comparing vertices between consecutive edge-keys
+        for i in range(len(edgeloop)-1):
+            for vert in range(2):
+                if edgeloop[i][vert] in edgeloop[i+1]:
+                    loop.append(edgeloop[i][vert])
+                    break
+        if loop:
+            # add starting vertex
+            for vert in range(2):
+                if edgeloop[0][vert] != loop[0]:
+                    loop = [edgeloop[0][vert]] + loop
+                    break
+            # add ending vertex
+            for vert in range(2):
+                if edgeloop[-1][vert] != loop[-1]:
+                    loop.append(edgeloop[-1][vert])
+                    break
+            # check if loop is circular
+            if loop[0] == loop[-1]:
+                circular = True
+                loop = loop[:-1]
+            else:
+                circular = False
+        loops.append([loop, circular])
+    
+    return(loops)
+
+
+# gather initial data
+def initialise():
+    global_undo = bpy.context.user_preferences.edit.use_global_undo
+    bpy.context.user_preferences.edit.use_global_undo = False
+    bpy.ops.object.mode_set(mode='OBJECT')
+    object = bpy.context.active_object
+    mesh = bpy.context.active_object.data
+    
+    return(global_undo, object, mesh)
+
+
+# move the vertices to their new locations
+def move_verts(mesh, mapping, move, influence):
+    for loop in move:
+        for index, loc in loop:
+            if mapping:
+                if mapping[index] == -1:
+                    continue
+                else:
+                    index = mapping[index]
+            if influence >= 0:
+                mesh.vertices[index].co = loc*(influence/100) + \
+                    mesh.vertices[index].co*((100-influence)/100)
+            else:
+                mesh.vertices[index].co = loc
+
+
+# load custom tool settings 
+def settings_load(self):
+    lt = bpy.context.window_manager.looptools
+    tool = self.name.split()[0].lower()
+    keys = self.as_keywords().keys()
+    for key in keys:
+        setattr(self, key, getattr(lt, tool + "_" + key))
+
+
+# store custom tool settings
+def settings_write(self):
+    lt = bpy.context.window_manager.looptools
+    tool = self.name.split()[0].lower()
+    keys = self.as_keywords().keys()
+    for key in keys:
+        setattr(lt, tool + "_" + key, getattr(self, key))
+
+
+# clean up and set settings back to original state
+def terminate(global_undo):
+    bpy.ops.object.mode_set(mode='EDIT')
+    bpy.context.user_preferences.edit.use_global_undo = global_undo
+
+
+##########################################
+####### Bridge functions #################
+##########################################
+
+# calculate a cubic spline through the middle section of 4 given coordinates
+def bridge_calculate_cubic_spline(mesh, coordinates):
+    result = []
+    x = [0, 1, 2, 3]
+    
+    for j in range(3):
+        a = []
+        for i in coordinates:
+            a.append(float(i[j]))
+        h = []
+        for i in range(3):
+            h.append(x[i+1]-x[i])
+        q = [False]
+        for i in range(1,3):
+            q.append(3.0/h[i]*(a[i+1]-a[i])-3.0/h[i-1]*(a[i]-a[i-1]))
+        l = [1.0]
+        u = [0.0]
+        z = [0.0]
+        for i in range(1,3):
+            l.append(2.0*(x[i+1]-x[i-1])-h[i-1]*u[i-1])
+            u.append(h[i]/l[i])
+            z.append((q[i]-h[i-1]*z[i-1])/l[i])
+        l.append(1.0)
+        z.append(0.0)
+        b = [False for i in range(3)]
+        c = [False for i in range(4)]
+        d = [False for i in range(3)]
+        c[3] = 0.0
+        for i in range(2,-1,-1):
+            c[i] = z[i]-u[i]*c[i+1]
+            b[i] = (a[i+1]-a[i])/h[i]-h[i]*(c[i+1]+2.0*c[i])/3.0
+            d[i] = (c[i+1]-c[i])/(3.0*h[i])
+        for i in range(3):
+            result.append([a[i], b[i], c[i], d[i], x[i]])
+    spline = [result[1], result[4], result[7]]
+
+    return(spline)
+
+
+# return a list with new vertex location vectors, a list with face vertex 
+# integers, and the highest vertex integer in the virtual mesh
+def bridge_calculate_geometry(mesh, lines, vertex_normals, segments,
+interpolation, cubic_strength, min_width, max_vert_index):
+    new_verts = []
+    faces = []
+    
+    # calculate location based on interpolation method
+    def get_location(line, segment, splines):
+        v1 = mesh.vertices[lines[line][0]].co
+        v2 = mesh.vertices[lines[line][1]].co
+        if interpolation == 'linear':
+            return v1 + (segment/segments) * (v2-v1)
+        else: # interpolation == 'cubic'
+            m = (segment/segments)
+            ax,bx,cx,dx,tx = splines[line][0]
+            x = ax+bx*m+cx*m**2+dx*m**3
+            ay,by,cy,dy,ty = splines[line][1]
+            y = ay+by*m+cy*m**2+dy*m**3
+            az,bz,cz,dz,tz = splines[line][2]
+            z = az+bz*m+cz*m**2+dz*m**3
+            return mathutils.Vector((x, y, z))
+        
+    # no interpolation needed
+    if segments == 1:
+        for i, line in enumerate(lines):
+            if i < len(lines)-1:
+                faces.append([line[0], lines[i+1][0], lines[i+1][1], line[1]])
+    # more than 1 segment, interpolate
+    else:
+        # calculate splines (if necessary) once, so no recalculations needed
+        if interpolation == 'cubic':
+            splines = []
+            for line in lines:
+                v1 = mesh.vertices[line[0]].co
+                v2 = mesh.vertices[line[1]].co
+                size = (v2-v1).length * cubic_strength
+                splines.append(bridge_calculate_cubic_spline(mesh,
+                    [v1+size*vertex_normals[line[0]], v1, v2,
+                    v2+size*vertex_normals[line[1]]]))
+        else:
+            splines = False
+        
+        # create starting situation
+        virtual_width = [(mesh.vertices[lines[i][0]].co -
+                          mesh.vertices[lines[i+1][0]].co).length for i
+                          in range(len(lines)-1)]
+        new_verts = [get_location(0, seg, splines) for seg in range(1,
+            segments)]
+        first_line_indices = [i for i in range(max_vert_index+1,
+            max_vert_index+segments)]
+        
+        prev_verts = new_verts[:] # vertex locations of verts on previous line
+        prev_vert_indices = first_line_indices[:]
+        max_vert_index += segments - 1 # highest vertex index in virtual mesh
+        next_verts = [] # vertex locations of verts on current line
+        next_vert_indices = []
+        
+        for i, line in enumerate(lines):
+            if i < len(lines)-1:
+                v1 = line[0]
+                v2 = lines[i+1][0]
+                end_face = True
+                for seg in range(1, segments):
+                    loc1 = prev_verts[seg-1]
+                    loc2 = get_location(i+1, seg, splines)
+                    if (loc1-loc2).length < (min_width/100)*virtual_width[i] \
+                    and line[1]==lines[i+1][1]:
+                        # triangle, no new vertex
+                        faces.append([v1, v2, prev_vert_indices[seg-1],
+                            prev_vert_indices[seg-1]])
+                        next_verts += prev_verts[seg-1:]
+                        next_vert_indices += prev_vert_indices[seg-1:]
+                        end_face = False
+                        break
+                    else:
+                        if i == len(lines)-2 and lines[0] == lines[-1]:
+                            # quad with first line, no new vertex
+                            faces.append([v1, v2, first_line_indices[seg-1],
+                                prev_vert_indices[seg-1]])
+                            v2 = first_line_indices[seg-1]
+                            v1 = prev_vert_indices[seg-1]
+                        else:
+                            # quad, add new vertex
+                            max_vert_index += 1
+                            faces.append([v1, v2, max_vert_index,
+                                prev_vert_indices[seg-1]])
+                            v2 = max_vert_index
+                            v1 = prev_vert_indices[seg-1]
+                            new_verts.append(loc2)
+                            next_verts.append(loc2)
+                            next_vert_indices.append(max_vert_index)
+                if end_face:
+                    faces.append([v1, v2, lines[i+1][1], line[1]])
+                
+                prev_verts = next_verts[:]
+                prev_vert_indices = next_vert_indices[:]
+                next_verts = []
+                next_vert_indices = []
+    
+    return(new_verts, faces, max_vert_index)
+
+
+# calculate lines (list of lists, vertex indices) that are used for bridging
+def bridge_calculate_lines(mesh, loops, mode, twist, reverse):
+    lines = []
+    loop1, loop2 = [i[0] for i in loops]
+    loop1_circular, loop2_circular = [i[1] for i in loops]
+    circular = loop1_circular or loop2_circular
+    circle_full = False
+    
+    # calculate loop centers
+    centers = []
+    for loop in [loop1, loop2]:
+        center = mathutils.Vector()
+        for vertex in loop:
+            center += mesh.vertices[vertex].co
+        center /= len(loop)
+        centers.append(center)
+    for i, loop in enumerate([loop1, loop2]):
+        for vertex in loop:
+            if mesh.vertices[vertex].co == centers[i]:
+                # prevent zero-length vectors in angle comparisons
+                centers[i] += mathutils.Vector((0.01, 0, 0))
+                break
+    center1, center2 = centers
+    
+    # calculate the normals of the virtual planes that the loops are on
+    normals = []
+    normal_plurity = False
+    for i, loop in enumerate([loop1, loop2]):
+        # covariance matrix
+        mat = mathutils.Matrix(((0.0, 0.0, 0.0),
+                                (0.0, 0.0, 0.0),
+                                (0.0, 0.0, 0.0)))
+        x, y, z = centers[i]
+        for loc in [mesh.vertices[vertex].co for vertex in loop]:
+            mat[0][0] += (loc[0]-x)**2
+            mat[1][0] += (loc[0]-x)*(loc[1]-y)
+            mat[2][0] += (loc[0]-x)*(loc[2]-z)
+            mat[0][1] += (loc[1]-y)*(loc[0]-x)
+            mat[1][1] += (loc[1]-y)**2
+            mat[2][1] += (loc[1]-y)*(loc[2]-z)
+            mat[0][2] += (loc[2]-z)*(loc[0]-x)
+            mat[1][2] += (loc[2]-z)*(loc[1]-y)
+            mat[2][2] += (loc[2]-z)**2
+        # plane normal
+        normal = False
+        if sum(mat[0]) < 1e-6 or sum(mat[1]) < 1e-6 or sum(mat[2]) < 1e-6:
+            normal_plurity = True
+        try:
+            mat.invert()
+        except:
+            if sum(mat[0]) == 0:
+                normal = mathutils.Vector((1.0, 0.0, 0.0))
+            elif sum(mat[1]) == 0:
+                normal = mathutils.Vector((0.0, 1.0, 0.0))
+            elif sum(mat[2]) == 0:
+                normal = mathutils.Vector((0.0, 0.0, 1.0))
+        if not normal:
+            # warning! this is different from .normalize()
+            itermax = 500
+            iter = 0
+            vec = mathutils.Vector((1.0, 1.0, 1.0))
+            vec2 = (mat * vec)/(mat * vec).length
+            while vec != vec2 and iter<itermax:
+                iter+=1
+                vec = vec2
+                vec2 = mat * vec
+                if vec2.length != 0:
+                    vec2 /= vec2.length
+            if vec2.length == 0:
+                vec2 = mathutils.Vector((1.0, 1.0, 1.0))
+            normal = vec2
+        normals.append(normal)
+    # have plane normals face in the same direction (maximum angle: 90 degrees)
+    if ((center1 + normals[0]) - center2).length < \
+    ((center1 - normals[0]) - center2).length:
+        normals[0].negate()
+    if ((center2 + normals[1]) - center1).length > \
+    ((center2 - normals[1]) - center1).length:
+        normals[1].negate()
+    
+    # rotation matrix, representing the difference between the plane normals
+    axis = normals[0].cross(normals[1])
+    axis = mathutils.Vector([loc if abs(loc) > 1e-8 else 0 for loc in axis])
+    if axis.angle(mathutils.Vector((0, 0, 1)), 0) > 1.5707964:
+        axis.negate()
+    angle = normals[0].dot(normals[1])
+    rotation_matrix = mathutils.Matrix.Rotation(angle, 4, axis)
+    
+    # if circular, rotate loops so they are aligned
+    if circular:
+        # make sure loop1 is the circular one (or both are circular)
+        if loop2_circular and not loop1_circular:
+            loop1_circular, loop2_circular = True, False
+            loop1, loop2 = loop2, loop1
+        
+        # match start vertex of loop1 with loop2
+        target_vector = mesh.vertices[loop2[0]].co - center2
+        dif_angles = [[(rotation_matrix * (mesh.vertices[vertex].co - center1)
+                       ).angle(target_vector, 0), False, i] for
+                       i, vertex in enumerate(loop1)]
+        dif_angles.sort()
+        if len(loop1) != len(loop2):
+            angle_limit = dif_angles[0][0] * 1.2 # 20% margin
+            dif_angles = [[(mesh.vertices[loop2[0]].co - \
+                mesh.vertices[loop1[index]].co).length, angle, index] for \
+                angle, distance, index in dif_angles if angle <= angle_limit]
+            dif_angles.sort()
+        loop1 = loop1[dif_angles[0][2]:] + loop1[:dif_angles[0][2]]
+    
+    # have both loops face the same way
+    if normal_plurity and not circular:
+        second_to_first, second_to_second, second_to_last = \
+            [(mesh.vertices[loop1[1]].co - center1).\
+            angle(mesh.vertices[loop2[i]].co - center2) for i in [0, 1, -1]]
+        last_to_first, last_to_second = [(mesh.vertices[loop1[-1]].co - \
+            center1).angle(mesh.vertices[loop2[i]].co - center2) for \
+            i in [0, 1]]
+        if (min(last_to_first, last_to_second)*1.1 < min(second_to_first, \
+        second_to_second)) or (loop2_circular and second_to_last*1.1 < \
+        min(second_to_first, second_to_second)):
+            loop1.reverse()
+            if circular:
+                loop1 = [loop1[-1]] + loop1[:-1]
+    else:
+        angle = (mesh.vertices[loop1[0]].co - center1).\
+            cross(mesh.vertices[loop1[1]].co - center1).angle(normals[0], 0)
+        target_angle = (mesh.vertices[loop2[0]].co - center2).\
+            cross(mesh.vertices[loop2[1]].co - center2).angle(normals[1], 0)
+        limit = 1.5707964 # 0.5*pi, 90 degrees
+        if not ((angle > limit and target_angle > limit) or \
+        (angle < limit and target_angle < limit)):
+            loop1.reverse()
+            if circular:
+                loop1 = [loop1[-1]] + loop1[:-1]
+        elif normals[0].angle(normals[1]) > limit:
+            loop1.reverse()
+            if circular:
+                loop1 = [loop1[-1]] + loop1[:-1]
+    
+    # both loops have the same length
+    if len(loop1) == len(loop2):
+        # manual override
+        if twist:
+            if abs(twist) < len(loop1):
+                loop1 = loop1[twist:]+loop1[:twist]
+        if reverse:
+            loop1.reverse()
+        
+        lines.append([loop1[0], loop2[0]])
+        for i in range(1, len(loop1)):
+            lines.append([loop1[i], loop2[i]])
+    
+    # loops of different lengths
+    else:
+        # make loop1 longest loop
+        if len(loop2) > len(loop1):
+            loop1, loop2 = loop2, loop1
+            loop1_circular, loop2_circular = loop2_circular, loop1_circular
+        
+        # manual override
+        if twist:
+            if abs(twist) < len(loop1):
+                loop1 = loop1[twist:]+loop1[:twist]
+        if reverse:
+            loop1.reverse()
+            
+        # shortest angle difference doesn't always give correct start vertex
+        if loop1_circular and not loop2_circular:
+            shifting = 1
+            while shifting:
+                if len(loop1) - shifting < len(loop2):
+                    shifting = False
+                    break
+                to_last, to_first = [(rotation_matrix *
+                    (mesh.vertices[loop1[-1]].co - center1)).angle((mesh.\
+                    vertices[loop2[i]].co - center2), 0) for i in [-1, 0]]
+                if to_first < to_last:
+                    loop1 = [loop1[-1]] + loop1[:-1]
+                    shifting += 1
+                else:
+                    shifting = False
+                    break
+        
+        # basic shortest side first
+        if mode == 'basic':
+            lines.append([loop1[0], loop2[0]])
+            for i in range(1, len(loop1)):
+                if i >= len(loop2) - 1:
+                    # triangles
+                    lines.append([loop1[i], loop2[-1]])
+                else:
+                    # quads
+                    lines.append([loop1[i], loop2[i]])
+        
+        # shortest edge algorithm
+        else: # mode == 'shortest'
+            lines.append([loop1[0], loop2[0]])
+            prev_vert2 = 0
+            for i in range(len(loop1) -1):
+                if prev_vert2 == len(loop2) - 1 and not loop2_circular:
+                    # force triangles, reached end of loop2
+                    tri, quad = 0, 1
+                elif prev_vert2 == len(loop2) - 1 and loop2_circular:
+                    # at end of loop2, but circular, so check with first vert
+                    tri, quad = [(mesh.vertices[loop1[i+1]].co -
+                                  mesh.vertices[loop2[j]].co).length
+                                 for j in [prev_vert2, 0]]
+
+                    circle_full = 2
+                elif len(loop1) - 1 - i == len(loop2) - 1 - prev_vert2 and \
+                not circle_full:
+                    # force quads, otherwise won't make it to end of loop2
+                    tri, quad = 1, 0
+                else:
+                    # calculate if tri or quad gives shortest edge
+                    tri, quad = [(mesh.vertices[loop1[i+1]].co -
+                                  mesh.vertices[loop2[j]].co).length
+                                 for j in range(prev_vert2, prev_vert2+2)]
+                
+                # triangle
+                if tri < quad:
+                    lines.append([loop1[i+1], loop2[prev_vert2]])
+                    if circle_full == 2:
+                        circle_full = False
+                # quad
+                elif not circle_full:
+                    lines.append([loop1[i+1], loop2[prev_vert2+1]])
+                    prev_vert2 += 1
+                # quad to first vertex of loop2
+                else:
+                    lines.append([loop1[i+1], loop2[0]])
+                    prev_vert2 = 0
+                    circle_full = True
+    
+    # final face for circular loops
+    if loop1_circular and loop2_circular:
+        lines.append([loop1[0], loop2[0]])
+    
+    return(lines)
+
+
+# calculate number of segments needed
+def bridge_calculate_segments(mesh, lines, loops, segments):
+    # return if amount of segments is set by user
+    if segments != 0:
+        return segments
+    
+    # edge lengths
+    average_edge_length = [(mesh.vertices[vertex].co - \
+        mesh.vertices[loop[0][i+1]].co).length for loop in loops for \
+        i, vertex in enumerate(loop[0][:-1])]
+    # closing edges of circular loops
+    average_edge_length += [(mesh.vertices[loop[0][-1]].co - \
+        mesh.vertices[loop[0][0]].co).length for loop in loops if loop[1]] 
+    
+    # average lengths
+    average_edge_length = sum(average_edge_length) / len(average_edge_length)
+    average_bridge_length = sum([(mesh.vertices[v1].co - \
+        mesh.vertices[v2].co).length for v1, v2 in lines]) / len(lines)
+    
+    segments = max(1, round(average_bridge_length / average_edge_length))
+        
+    return(segments)
+
+
+# return dictionary with vertex index as key, and the normal vector as value
+def bridge_calculate_virtual_vertex_normals(mesh, lines, loops, edge_faces,
+edgekey_to_edge):
+    if not edge_faces: # interpolation isn't set to cubic
+        return False
+    
+    # pity reduce() isn't one of the basic functions in python anymore
+    def average_vector_dictionary(dic):
+        for key, vectors in dic.items():
+            #if type(vectors) == type([]) and len(vectors) > 1:
+            if len(vectors) > 1:
+                average = mathutils.Vector()
+                for vector in vectors:
+                    average += vector
+                average /= len(vectors)
+                dic[key] = [average]
+        return dic
+    
+    # get all edges of the loop
+    edges = [[edgekey_to_edge[tuple(sorted([loops[j][0][i],
+        loops[j][0][i+1]]))] for i in range(len(loops[j][0])-1)] for \
+        j in [0,1]]
+    edges = edges[0] + edges[1]
+    for j in [0, 1]:
+        if loops[j][1]: # circular
+            edges.append(edgekey_to_edge[tuple(sorted([loops[j][0][0],
+                loops[j][0][-1]]))])
+    
+    """
+    calculation based on face topology (assign edge-normals to vertices)
+    
+    edge_normal = face_normal x edge_vector
+    vertex_normal = average(edge_normals)
+    """
+    vertex_normals = dict([(vertex, []) for vertex in loops[0][0]+loops[1][0]])
+    for edge in edges:
+        faces = edge_faces[edge.key] # valid faces connected to edge
+        
+        if faces:
+            # get edge coordinates
+            v1, v2 = [mesh.vertices[edge.key[i]].co for i in [0,1]]
+            edge_vector = v1 - v2
+            if edge_vector.length < 1e-4:
+                # zero-length edge, vertices at same location
+                continue
+            edge_center = (v1 + v2) / 2
+            
+            # average face coordinates, if connected to more than 1 valid face
+            if len(faces) > 1:
+                face_normal = mathutils.Vector()
+                face_center = mathutils.Vector()
+                for face in faces:
+                    face_normal += face.normal
+                    face_center += face.center
+                face_normal /= len(faces)
+                face_center /= len(faces)
+            else:
+                face_normal = faces[0].normal
+                face_center = faces[0].center
+            if face_normal.length < 1e-4:
+                # faces with a surface of 0 have no face normal
+                continue
+            
+            # calculate virtual edge normal
+            edge_normal = edge_vector.cross(face_normal)
+            edge_normal.length = 0.01
+            if (face_center - (edge_center + edge_normal)).length > \
+            (face_center - (edge_center - edge_normal)).length:
+                # make normal face the correct way
+                edge_normal.negate()
+            edge_normal.normalize()
+            # add virtual edge normal as entry for both vertices it connects
+            for vertex in edge.key:
+                vertex_normals[vertex].append(edge_normal)
+    
+    """ 
+    calculation based on connection with other loop (vertex focused method) 
+    - used for vertices that aren't connected to any valid faces
+    
+    plane_normal = edge_vector x connection_vector
+    vertex_normal = plane_normal x edge_vector
+    """
+    vertices = [vertex for vertex, normal in vertex_normals.items() if not \
+        normal]
+    
+    if vertices:
+        # edge vectors connected to vertices
+        edge_vectors = dict([[vertex, []] for vertex in vertices])
+        for edge in edges:
+            for v in edge.key:
+                if v in edge_vectors:
+                    edge_vector = mesh.vertices[edge.key[0]].co - \
+                        mesh.vertices[edge.key[1]].co
+                    if edge_vector.length < 1e-4:
+                        # zero-length edge, vertices at same location
+                        continue
+                    edge_vectors[v].append(edge_vector)
+    
+        # connection vectors between vertices of both loops
+        connection_vectors = dict([[vertex, []] for vertex in vertices])
+        connections = dict([[vertex, []] for vertex in vertices])
+        for v1, v2 in lines:
+            if v1 in connection_vectors or v2 in connection_vectors:
+                new_vector = mesh.vertices[v1].co - mesh.vertices[v2].co
+                if new_vector.length < 1e-4:
+                    # zero-length connection vector,
+                    # vertices in different loops at same location
+                    continue
+                if v1 in connection_vectors:
+                    connection_vectors[v1].append(new_vector)
+                    connections[v1].append(v2)
+                if v2 in connection_vectors:
+                    connection_vectors[v2].append(new_vector)
+                    connections[v2].append(v1)
+        connection_vectors = average_vector_dictionary(connection_vectors)
+        connection_vectors = dict([[vertex, vector[0]] if vector else \
+            [vertex, []] for vertex, vector in connection_vectors.items()])
+        
+        for vertex, values in edge_vectors.items():
+            # vertex normal doesn't matter, just assign a random vector to it
+            if not connection_vectors[vertex]:
+                vertex_normals[vertex] = [mathutils.Vector((1, 0, 0))]
+                continue
+            
+            # calculate to what location the vertex is connected, 
+            # used to determine what way to flip the normal
+            connected_center = mathutils.Vector()
+            for v in connections[vertex]:
+                connected_center += mesh.vertices[v].co
+            if len(connections[vertex]) > 1:
+                connected_center /= len(connections[vertex])
+            if len(connections[vertex]) == 0:
+                # shouldn't be possible, but better safe than sorry
+                vertex_normals[vertex] = [mathutils.Vector((1, 0, 0))]
+                continue
+            
+            # can't do proper calculations, because of zero-length vector
+            if not values:
+                if (connected_center - (mesh.vertices[vertex].co + \
+                connection_vectors[vertex])).length < (connected_center - \
+                (mesh.vertices[vertex].co - connection_vectors[vertex])).\
+                length:
+                    connection_vectors[vertex].negate()
+                vertex_normals[vertex] = [connection_vectors[vertex].\
+                    normalized()]
+                continue
+            
+            # calculate vertex normals using edge-vectors,
+            # connection-vectors and the derived plane normal
+            for edge_vector in values:
+                plane_normal = edge_vector.cross(connection_vectors[vertex])
+                vertex_normal = edge_vector.cross(plane_normal)
+                vertex_normal.length = 0.1
+                if (connected_center - (mesh.vertices[vertex].co + \
+                vertex_normal)).length < (connected_center - \
+                (mesh.vertices[vertex].co - vertex_normal)).length:
+                # make normal face the correct way
+                    vertex_normal.negate()
+                vertex_normal.normalize()
+                vertex_normals[vertex].append(vertex_normal)
+    
+    # average virtual vertex normals, based on all edges it's connected to
+    vertex_normals = average_vector_dictionary(vertex_normals)
+    vertex_normals = dict([[vertex, vector[0]] for vertex, vector in \
+        vertex_normals.items()])
+    
+    return(vertex_normals)
+
+
+# add vertices to mesh
+def bridge_create_vertices(mesh, vertices):
+    start_index = len(mesh.vertices)
+    mesh.vertices.add(len(vertices))
+    for i in range(len(vertices)):
+        mesh.vertices[start_index + i].co = vertices[i]
+
+
+# add faces to mesh
+def bridge_create_faces(mesh, faces, twist):
+    # have the normal point the correct way
+    if twist < 0:
+        [face.reverse() for face in faces]
+        faces = [face[2:]+face[:2] if face[0]==face[1] else face for \
+            face in faces]
+    
+    # eekadoodle prevention
+    for i in range(len(faces)):
+        if not faces[i][-1]:
+            if faces[i][0] == faces[i][-1]:
+                faces[i] = [faces[i][1], faces[i][2], faces[i][3], faces[i][1]]
+            else:
+                faces[i] = [faces[i][-1]] + faces[i][:-1]
+    
+    start_faces = len(mesh.tessfaces)
+    mesh.tessfaces.add(len(faces))
+    for i in range(len(faces)):
+        mesh.tessfaces[start_faces + i].vertices_raw = faces[i]
+    mesh.update(calc_edges = True) # calc_edges prevents memory-corruption
+
+
+# calculate input loops
+def bridge_get_input(mesh):
+    # create list of internal edges, which should be skipped
+    eks_of_selected_faces = [item for sublist in [face.edge_keys for face \
+        in mesh.tessfaces if face.select and not face.hide] for item in sublist]
+    edge_count = {}
+    for ek in eks_of_selected_faces:
+        if ek in edge_count:
+            edge_count[ek] += 1
+        else:
+            edge_count[ek] = 1
+    internal_edges = [ek for ek in edge_count if edge_count[ek] > 1]
+    
+    # sort correct edges into loops
+    selected_edges = [edge.key for edge in mesh.edges if edge.select \
+        and not edge.hide and edge.key not in internal_edges]
+    loops = get_connected_selections(selected_edges)
+    
+    return(loops)
+
+
+# return values needed by the bridge operator
+def bridge_initialise(mesh, interpolation):
+    if interpolation == 'cubic':
+        # dict with edge-key as key and list of connected valid faces as value
+        face_blacklist = [face.index for face in mesh.tessfaces if face.select or \
+            face.hide]
+        edge_faces = dict([[edge.key, []] for edge in mesh.edges if not \
+            edge.hide])
+        for face in mesh.tessfaces:
+            if face.index in face_blacklist:
+                continue
+            for key in face.edge_keys:
+                edge_faces[key].append(face)
+        # dictionary with the edge-key as key and edge as value
+        edgekey_to_edge = dict([[edge.key, edge] for edge in mesh.edges if \
+            edge.select and not edge.hide])
+    else:
+        edge_faces = False
+        edgekey_to_edge = False
+    
+    # selected faces input
+    old_selected_faces = [face.index for face in mesh.tessfaces if face.select \
+        and not face.hide]
+    
+    # find out if faces created by bridging should be smoothed
+    smooth = False
+    if mesh.tessfaces:
+        if sum([face.use_smooth for face in mesh.tessfaces])/len(mesh.tessfaces) \
+        >= 0.5:
+            smooth = True
+    
+    return(edge_faces, edgekey_to_edge, old_selected_faces, smooth)
+
+
+# return a string with the input method
+def bridge_input_method(loft, loft_loop):
+    method = ""
+    if loft:
+        if loft_loop:
+            method = "Loft loop"
+        else:
+            method = "Loft no-loop"
+    else:
+        method = "Bridge"
+    
+    return(method)
+
+
+# match up loops in pairs, used for multi-input bridging
+def bridge_match_loops(mesh, loops):
+    # calculate average loop normals and centers
+    normals = []
+    centers = []
+    for vertices, circular in loops:
+        normal = mathutils.Vector()
+        center = mathutils.Vector()
+        for vertex in vertices:
+            normal += mesh.vertices[vertex].normal
+            center += mesh.vertices[vertex].co
+        normals.append(normal / len(vertices) / 10)
+        centers.append(center / len(vertices))
+    
+    # possible matches if loop normals are faced towards the center
+    # of the other loop
+    matches = dict([[i, []] for i in range(len(loops))])
+    matches_amount = 0
+    for i in range(len(loops) + 1):
+        for j in range(i+1, len(loops)):
+            if (centers[i] - centers[j]).length > (centers[i] - (centers[j] \
+            + normals[j])).length and (centers[j] - centers[i]).length > \
+            (centers[j] - (centers[i] + normals[i])).length:
+                matches_amount += 1
+                matches[i].append([(centers[i] - centers[j]).length, i, j])
+                matches[j].append([(centers[i] - centers[j]).length, j, i])
+    # if no loops face each other, just make matches between all the loops
+    if matches_amount == 0:
+        for i in range(len(loops) + 1):
+            for j in range(i+1, len(loops)):
+                matches[i].append([(centers[i] - centers[j]).length, i, j])
+                matches[j].append([(centers[i] - centers[j]).length, j, i])
+    for key, value in matches.items():
+        value.sort()
+    
+    # matches based on distance between centers and number of vertices in loops
+    new_order = []
+    for loop_index in range(len(loops)):
+        if loop_index in new_order:
+            continue
+        loop_matches = matches[loop_index]
+        if not loop_matches:
+            continue
+        shortest_distance = loop_matches[0][0]
+        shortest_distance *= 1.1
+        loop_matches = [[abs(len(loops[loop_index][0]) - \
+            len(loops[loop[2]][0])), loop[0], loop[1], loop[2]] for loop in \
+            loop_matches if loop[0] < shortest_distance]
+        loop_matches.sort()
+        for match in loop_matches:
+            if match[3] not in new_order:
+                new_order += [loop_index, match[3]]
+                break
+    
+    # reorder loops based on matches
+    if len(new_order) >= 2:
+        loops = [loops[i] for i in new_order]
+    
+    return(loops)
+
+
+# have normals of selection face outside
+def bridge_recalculate_normals():
+    bpy.ops.object.mode_set(mode = 'EDIT')
+    bpy.ops.mesh.normals_make_consistent()
+
+
+# remove old_selected_faces
+def bridge_remove_internal_faces(mesh, old_selected_faces):
+    select_mode = [i for i in bpy.context.tool_settings.mesh_select_mode]
+    bpy.context.tool_settings.mesh_select_mode = [False, False, True]
+    
+    # hack to keep track of the current selection
+    for edge in mesh.edges:
+        if edge.select and not edge.hide:
+            edge.bevel_weight = (edge.bevel_weight/3) + 0.2
+        else:
+            edge.bevel_weight = (edge.bevel_weight/3) + 0.6
+    
+    # remove faces
+    bpy.ops.object.mode_set(mode = 'EDIT')
+    bpy.ops.mesh.select_all(action = 'DESELECT')
+    bpy.ops.object.mode_set(mode = 'OBJECT')
+    for face in old_selected_faces:
+        mesh.tessfaces[face].select = True
+    bpy.ops.object.mode_set(mode = 'EDIT')
+    bpy.ops.mesh.delete(type = 'FACE')
+    
+    # restore old selection, using hack
+    bpy.ops.object.mode_set(mode = 'OBJECT')
+    bpy.context.tool_settings.mesh_select_mode = [False, True, False]
+    for edge in mesh.edges:
+        if edge.bevel_weight < 0.6:
+            edge.bevel_weight = (edge.bevel_weight-0.2) * 3
+            edge.select = True
+        else:
+            edge.bevel_weight = (edge.bevel_weight-0.6) * 3
+    bpy.ops.object.mode_set(mode = 'EDIT')
+    bpy.ops.object.mode_set(mode = 'OBJECT')
+    bpy.context.tool_settings.mesh_select_mode = select_mode
+
+
+# update list of internal faces that are flagged for removal
+def bridge_save_unused_faces(mesh, old_selected_faces, loops):
+    # key: vertex index, value: lists of selected faces using it
+    vertex_to_face = dict([[i, []] for i in range(len(mesh.vertices))])
+    [[vertex_to_face[vertex_index].append(face) for vertex_index in \
+        mesh.tessfaces[face].vertices] for face in old_selected_faces]
+    
+    # group selected faces that are connected
+    groups = []
+    grouped_faces = []
+    for face in old_selected_faces:
+        if face in grouped_faces:
+            continue
+        grouped_faces.append(face)
+        group = [face]
+        new_faces = [face]
+        while new_faces:
+            grow_face = new_faces[0]
+            for vertex in mesh.tessfaces[grow_face].vertices:
+                vertex_face_group = [face for face in vertex_to_face[vertex] \
+                    if face not in grouped_faces]
+                new_faces += vertex_face_group
+                grouped_faces += vertex_face_group
+                group += vertex_face_group
+            new_faces.pop(0)
+        groups.append(group)
+    
+    # key: vertex index, value: True/False (is it in a loop that is used)
+    used_vertices = dict([[i, 0] for i in range(len(mesh.vertices))])
+    for loop in loops:
+        for vertex in loop[0]:
+            used_vertices[vertex] = True
+    
+    # check if group is bridged, if not remove faces from internal faces list
+    for group in groups:
+        used = False
+        for face in group:
+            if used:
+                break
+            for vertex in mesh.tessfaces[face].vertices:
+                if used_vertices[vertex]:
+                    used = True
+                    break
+        if not used:
+            for face in group:
+                old_selected_faces.remove(face)
+
+
+# add the newly created faces to the selection
+def bridge_select_new_faces(mesh, amount, smooth):
+    select_mode = [i for i in bpy.context.tool_settings.mesh_select_mode]
+    bpy.context.tool_settings.mesh_select_mode = [False, False, True]
+    for i in range(amount):
+        mesh.tessfaces[-(i+1)].select = True
+        mesh.tessfaces[-(i+1)].use_smooth = smooth
+    bpy.ops.object.mode_set(mode = 'EDIT')
+    bpy.ops.object.mode_set(mode = 'OBJECT')
+    bpy.context.tool_settings.mesh_select_mode = select_mode
+
+
+# sort loops, so they are connected in the correct order when lofting
+def bridge_sort_loops(mesh, loops, loft_loop):
+    # simplify loops to single points, and prepare for pathfinding
+    x, y, z = [[sum([mesh.vertices[i].co[j] for i in loop[0]]) / \
+        len(loop[0]) for loop in loops] for j in range(3)]
+    nodes = [mathutils.Vector((x[i], y[i], z[i])) for i in range(len(loops))]
+    
+    active_node = 0
+    open = [i for i in range(1, len(loops))]
+    path = [[0,0]]
+    # connect node to path, that is shortest to active_node
+    while len(open) > 0:
+        distances = [(nodes[active_node] - nodes[i]).length for i in open]
+        active_node = open[distances.index(min(distances))]
+        open.remove(active_node)
+        path.append([active_node, min(distances)])
+    # check if we didn't start in the middle of the path
+    for i in range(2, len(path)):
+        if (nodes[path[i][0]]-nodes[0]).length < path[i][1]:
+            temp = path[:i]
+            path.reverse()
+            path = path[:-i] + temp
+            break
+    
+    # reorder loops
+    loops = [loops[i[0]] for i in path]
+    # if requested, duplicate first loop at last position, so loft can loop
+    if loft_loop:
+        loops = loops + [loops[0]]
+    
+    return(loops)
+
+
+##########################################
+####### Circle functions #################
+##########################################
+
+# convert 3d coordinates to 2d coordinates on plane
+def circle_3d_to_2d(mesh_mod, loop, com, normal):
+    # project vertices onto the plane
+    verts = [mesh_mod.vertices[v] for v in loop[0]]
+    verts_projected = [[v.co - (v.co - com).dot(normal) * normal, v.index]
+                       for v in verts]
+
+    # calculate two vectors (p and q) along the plane
+    m = mathutils.Vector((normal[0] + 1.0, normal[1], normal[2]))
+    p = m - (m.dot(normal) * normal)
+    if p.dot(p) == 0.0:
+        m = mathutils.Vector((normal[0], normal[1] + 1.0, normal[2]))
+        p = m - (m.dot(normal) * normal)
+    q = p.cross(normal)
+    
+    # change to 2d coordinates using perpendicular projection
+    locs_2d = []
+    for loc, vert in verts_projected:
+        vloc = loc - com
+        x = p.dot(vloc) / p.dot(p)
+        y = q.dot(vloc) / q.dot(q)
+        locs_2d.append([x, y, vert])
+    
+    return(locs_2d, p, q)
+
+
+# calculate a best-fit circle to the 2d locations on the plane
+def circle_calculate_best_fit(locs_2d):
+    # initial guess
+    x0 = 0.0
+    y0 = 0.0
+    r = 1.0
+    
+    # calculate center and radius (non-linear least squares solution)
+    for iter in range(500):
+        jmat = []
+        k = []
+        for v in locs_2d:
+            d = (v[0]**2-2.0*x0*v[0]+v[1]**2-2.0*y0*v[1]+x0**2+y0**2)**0.5
+            jmat.append([(x0-v[0])/d, (y0-v[1])/d, -1.0])
+            k.append(-(((v[0]-x0)**2+(v[1]-y0)**2)**0.5-r))
+        jmat2 = mathutils.Matrix(((0.0, 0.0, 0.0),
+                                  (0.0, 0.0, 0.0),
+                                  (0.0, 0.0, 0.0),
+                                  ))
+        k2 = mathutils.Vector((0.0, 0.0, 0.0))
+        for i in range(len(jmat)):
+            k2 += mathutils.Vector(jmat[i])*k[i]
+            jmat2[0][0] += jmat[i][0]**2
+            jmat2[1][0] += jmat[i][0]*jmat[i][1]
+            jmat2[2][0] += jmat[i][0]*jmat[i][2]
+            jmat2[1][1] += jmat[i][1]**2
+            jmat2[2][1] += jmat[i][1]*jmat[i][2]
+            jmat2[2][2] += jmat[i][2]**2
+        jmat2[0][1] = jmat2[1][0]
+        jmat2[0][2] = jmat2[2][0]
+        jmat2[1][2] = jmat2[2][1]
+        try:
+            jmat2.invert()
+        except:
+            pass
+        dx0, dy0, dr = jmat2 * k2
+        x0 += dx0
+        y0 += dy0
+        r += dr
+        # stop iterating if we're close enough to optimal solution
+        if abs(dx0)<1e-6 and abs(dy0)<1e-6 and abs(dr)<1e-6:
+            break
+    
+    # return center of circle and radius
+    return(x0, y0, r)
+
+
+# calculate circle so no vertices have to be moved away from the center
+def circle_calculate_min_fit(locs_2d):
+    # center of circle
+    x0 = (min([i[0] for i in locs_2d])+max([i[0] for i in locs_2d]))/2.0
+    y0 = (min([i[1] for i in locs_2d])+max([i[1] for i in locs_2d]))/2.0
+    center = mathutils.Vector([x0, y0])
+    # radius of circle
+    r = min([(mathutils.Vector([i[0], i[1]])-center).length for i in locs_2d])
+    
+    # return center of circle and radius
+    return(x0, y0, r)
+
+
+# calculate the new locations of the vertices that need to be moved
+def circle_calculate_verts(flatten, mesh_mod, locs_2d, com, p, q, normal):
+    # changing 2d coordinates back to 3d coordinates
+    locs_3d = []
+    for loc in locs_2d:
+        locs_3d.append([loc[2], loc[0]*p + loc[1]*q + com])
+    
+    if flatten: # flat circle
+        return(locs_3d)
+    
+    else: # project the locations on the existing mesh
+        vert_edges = dict_vert_edges(mesh_mod)
+        vert_faces = dict_vert_faces(mesh_mod)
+        faces = [f for f in mesh_mod.tessfaces if not f.hide]
+        rays = [normal, -normal]
+        new_locs = []
+        for loc in locs_3d:
+            projection = False
+            if mesh_mod.vertices[loc[0]].co == loc[1]: # vertex hasn't moved
+                projection = loc[1]
+            else:
+                dif = normal.angle(loc[1]-mesh_mod.vertices[loc[0]].co)
+                if -1e-6 < dif < 1e-6 or math.pi-1e-6 < dif < math.pi+1e-6:
+                    # original location is already along projection normal
+                    projection = mesh_mod.vertices[loc[0]].co
+                else:
+                    # quick search through adjacent faces
+                    for face in vert_faces[loc[0]]:
+                        verts = [mesh_mod.vertices[v].co for v in \
+                            mesh_mod.tessfaces[face].vertices]
+                        if len(verts) == 3: # triangle
+                            v1, v2, v3 = verts
+                            v4 = False
+                        else: # quad
+                            v1, v2, v3, v4 = verts
+                        for ray in rays:
+                            intersect = mathutils.geometry.\
+                            intersect_ray_tri(v1, v2, v3, ray, loc[1])
+                            if intersect:
+                                projection = intersect
+                                break
+                            elif v4:
+                                intersect = mathutils.geometry.\
+                                intersect_ray_tri(v1, v3, v4, ray, loc[1])
+                                if intersect:
+                                    projection = intersect
+                                    break
+                        if projection:
+                            break
+            if not projection:
+                # check if projection is on adjacent edges
+                for edgekey in vert_edges[loc[0]]:
+                    line1 = mesh_mod.vertices[edgekey[0]].co
+                    line2 = mesh_mod.vertices[edgekey[1]].co
+                    intersect, dist = mathutils.geometry.intersect_point_line(\
+                        loc[1], line1, line2)
+                    if 1e-6 < dist < 1 - 1e-6:
+                        projection = intersect
+                        break
+            if not projection:
+                # full search through the entire mesh
+                hits = []
+                for face in faces:
+                    verts = [mesh_mod.vertices[v].co for v in face.vertices]
+                    if len(verts) == 3: # triangle
+                        v1, v2, v3 = verts
+                        v4 = False
+                    else: # quad
+                        v1, v2, v3, v4 = verts
+                    for ray in rays:
+                        intersect = mathutils.geometry.intersect_ray_tri(\
+                            v1, v2, v3, ray, loc[1])
+                        if intersect:
+                            hits.append([(loc[1] - intersect).length,
+                                intersect])
+                            break
+                        elif v4:
+                            intersect = mathutils.geometry.intersect_ray_tri(\
+                                v1, v3, v4, ray, loc[1])
+                            if intersect:
+                                hits.append([(loc[1] - intersect).length,
+                                    intersect])
+                                break
+                if len(hits) >= 1:
+                    # if more than 1 hit with mesh, closest hit is new loc
+                    hits.sort()
+                    projection = hits[0][1]
+            if not projection:
+                # nothing to project on, remain at flat location
+                projection = loc[1]
+            new_locs.append([loc[0], projection])
+        
+        # return new positions of projected circle
+        return(new_locs)
+
+
+# check loops and only return valid ones
+def circle_check_loops(single_loops, loops, mapping, mesh_mod):
+    valid_single_loops = {}
+    valid_loops = []
+    for i, [loop, circular] in enumerate(loops):
+        # loop needs to have at least 3 vertices
+        if len(loop) < 3:
+            continue
+        # loop needs at least 1 vertex in the original, non-mirrored mesh
+        if mapping:
+            all_virtual = True
+            for vert in loop:
+                if mapping[vert] > -1:
+                    all_virtual = False
+                    break
+            if all_virtual:
+                continue
+        # loop has to be non-collinear
+        collinear = True
+        loc0 = mathutils.Vector(mesh_mod.vertices[loop[0]].co[:])
+        loc1 = mathutils.Vector(mesh_mod.vertices[loop[1]].co[:])
+        for v in loop[2:]:
+            locn = mathutils.Vector(mesh_mod.vertices[v].co[:])
+            if loc0 == loc1 or loc1 == locn:
+                loc0 = loc1
+                loc1 = locn
+                continue
+            d1 = loc1-loc0
+            d2 = locn-loc1
+            if -1e-6 < d1.angle(d2, 0) < 1e-6:
+                loc0 = loc1
+                loc1 = locn
+                continue
+            collinear = False
+            break
+        if collinear:
+            continue
+        # passed all tests, loop is valid
+        valid_loops.append([loop, circular])
+        valid_single_loops[len(valid_loops)-1] = single_loops[i]
+    
+    return(valid_single_loops, valid_loops)
+
+
+# calculate the location of single input vertices that need to be flattened
+def circle_flatten_singles(mesh_mod, com, p, q, normal, single_loop):
+    new_locs = []
+    for vert in single_loop:
+        loc = mathutils.Vector(mesh_mod.vertices[vert].co[:])
+        new_locs.append([vert,  loc - (loc-com).dot(normal)*normal])
+    
+    return(new_locs)
+
+
+# calculate input loops
+def circle_get_input(object, mesh, scene):
+    # get mesh with modifiers applied
+    derived, mesh_mod = get_derived_mesh(object, mesh, scene)
+    
+    # create list of edge-keys based on selection state
+    faces = False
+    for face in mesh.tessfaces:
+        if face.select and not face.hide:
+            faces = True
+            break
+    if faces:
+        # get selected, non-hidden , non-internal edge-keys
+        eks_selected = [key for keys in [face.edge_keys for face in \
+            mesh_mod.tessfaces if face.select and not face.hide] for key in keys]
+        edge_count = {}
+        for ek in eks_selected:
+            if ek in edge_count:
+                edge_count[ek] += 1
+            else:
+                edge_count[ek] = 1
+        edge_keys = [edge.key for edge in mesh_mod.edges if edge.select \
+            and not edge.hide and edge_count.get(edge.key, 1)==1]
+    else:
+        # no faces, so no internal edges either
+        edge_keys = [edge.key for edge in mesh_mod.edges if edge.select \
+            and not edge.hide]
+    
+    # add edge-keys around single vertices
+    verts_connected = dict([[vert, 1] for edge in [edge for edge in \
+        mesh_mod.edges if edge.select and not edge.hide] for vert in edge.key])
+    single_vertices = [vert.index for vert in mesh_mod.vertices if \
+        vert.select and not vert.hide and not \
+        verts_connected.get(vert.index, False)]
+    
+    if single_vertices and len(mesh.tessfaces)>0:
+        vert_to_single = dict([[v.index, []] for v in mesh_mod.vertices \
+            if not v.hide])
+        for face in [face for face in mesh_mod.tessfaces if not face.select \
+        and not face.hide]:
+            for vert in face.vertices:
+                if vert in single_vertices:
+                    for ek in face.edge_keys:
+                        if not vert in ek:
+                            edge_keys.append(ek)
+                            if vert not in vert_to_single[ek[0]]:
+                                vert_to_single[ek[0]].append(vert)
+                            if vert not in vert_to_single[ek[1]]:
+                                vert_to_single[ek[1]].append(vert)
+                    break
+    
+    # sort edge-keys into loops
+    loops = get_connected_selections(edge_keys)
+    
+    # find out to which loops the single vertices belong
+    single_loops = dict([[i, []] for i in range(len(loops))])
+    if single_vertices and len(mesh.tessfaces)>0:
+        for i, [loop, circular] in enumerate(loops):
+            for vert in loop:
+                if vert_to_single[vert]:
+                    for single in vert_to_single[vert]:
+                        if single not in single_loops[i]:
+                            single_loops[i].append(single)
+    
+    return(derived, mesh_mod, single_vertices, single_loops, loops)
+
+
+# recalculate positions based on the influence of the circle shape
+def circle_influence_locs(locs_2d, new_locs_2d, influence):
+    for i in range(len(locs_2d)):
+        oldx, oldy, j = locs_2d[i]
+        newx, newy, k = new_locs_2d[i]
+        altx = newx*(influence/100)+ oldx*((100-influence)/100)
+        alty = newy*(influence/100)+ oldy*((100-influence)/100)
+        locs_2d[i] = [altx, alty, j]
+    
+    return(locs_2d)
+
+
+# project 2d locations on circle, respecting distance relations between verts
+def circle_project_non_regular(locs_2d, x0, y0, r):
+    for i in range(len(locs_2d)):
+        x, y, j = locs_2d[i]
+        loc = mathutils.Vector([x-x0, y-y0])
+        loc.length = r
+        locs_2d[i] = [loc[0], loc[1], j]
+    
+    return(locs_2d)
+
+
+# project 2d locations on circle, with equal distance between all vertices
+def circle_project_regular(locs_2d, x0, y0, r):
+    # find offset angle and circling direction
+    x, y, i = locs_2d[0]
+    loc = mathutils.Vector([x-x0, y-y0])
+    loc.length = r
+    offset_angle = loc.angle(mathutils.Vector([1.0, 0.0]), 0.0)
+    loca = mathutils.Vector([x-x0, y-y0, 0.0])
+    if loc[1] < -1e-6:
+        offset_angle *= -1
+    x, y, j = locs_2d[1]
+    locb = mathutils.Vector([x-x0, y-y0, 0.0])
+    if loca.cross(locb)[2] >= 0:
+        ccw = 1
+    else:
+        ccw = -1
+    # distribute vertices along the circle
+    for i in range(len(locs_2d)):
+        t = offset_angle + ccw * (i / len(locs_2d) * 2 * math.pi)
+        x = math.cos(t) * r
+        y = math.sin(t) * r
+        locs_2d[i] = [x, y, locs_2d[i][2]]
+    
+    return(locs_2d)
+
+
+# shift loop, so the first vertex is closest to the center
+def circle_shift_loop(mesh_mod, loop, com):
+    verts, circular = loop
+    distances = [[(mesh_mod.vertices[vert].co - com).length, i] \
+        for i, vert in enumerate(verts)]
+    distances.sort()
+    shift = distances[0][1]
+    loop = [verts[shift:] + verts[:shift], circular]
+    
+    return(loop)
+
+
+##########################################
+####### Curve functions ##################
+##########################################
+
+# create lists with knots and points, all correctly sorted
+def curve_calculate_knots(loop, verts_selected):
+    knots = [v for v in loop[0] if v in verts_selected]
+    points = loop[0][:]
+    # circular loop, potential for weird splines
+    if loop[1]:
+        offset = int(len(loop[0]) / 4)
+        kpos = []
+        for k in knots:
+            kpos.append(loop[0].index(k))
+        kdif = []
+        for i in range(len(kpos) - 1):
+            kdif.append(kpos[i+1] - kpos[i])
+        kdif.append(len(loop[0]) - kpos[-1] + kpos[0])
+        kadd = []
+        for k in kdif:
+            if k > 2 * offset:
+                kadd.append([kdif.index(k), True])
+            # next 2 lines are optional, they insert
+            # an extra control point in small gaps
+            #elif k > offset:
+            #   kadd.append([kdif.index(k), False])
+        kins = []
+        krot = False
+        for k in kadd: # extra knots to be added
+            if k[1]: # big gap (break circular spline)
+                kpos = loop[0].index(knots[k[0]]) + offset
+                if kpos > len(loop[0]) - 1:
+                    kpos -= len(loop[0])
+                kins.append([knots[k[0]], loop[0][kpos]])
+                kpos2 = k[0] + 1
+                if kpos2 > len(knots)-1:
+                    kpos2 -= len(knots)
+                kpos2 = loop[0].index(knots[kpos2]) - offset
+                if kpos2 < 0:
+                    kpos2 += len(loop[0])
+                kins.append([loop[0][kpos], loop[0][kpos2]])
+                krot = loop[0][kpos2]
+            else: # small gap (keep circular spline)
+                k1 = loop[0].index(knots[k[0]])
+                k2 = k[0] + 1
+                if k2 > len(knots)-1:
+                    k2 -= len(knots)
+                k2 = loop[0].index(knots[k2])
+                if k2 < k1:
+                    dif = len(loop[0]) - 1 - k1 + k2
+                else:
+                    dif = k2 - k1
+                kn = k1 + int(dif/2)
+                if kn > len(loop[0]) - 1:
+                    kn -= len(loop[0])
+                kins.append([loop[0][k1], loop[0][kn]])
+        for j in kins: # insert new knots
+            knots.insert(knots.index(j[0]) + 1, j[1])
+        if not krot: # circular loop
+            knots.append(knots[0])
+            points = loop[0][loop[0].index(knots[0]):]
+            points += loop[0][0:loop[0].index(knots[0]) + 1]
+        else: # non-circular loop (broken by script)
+            krot = knots.index(krot)
+            knots = knots[krot:] + knots[0:krot]
+            if loop[0].index(knots[0]) > loop[0].index(knots[-1]):
+                points = loop[0][loop[0].index(knots[0]):]
+                points += loop[0][0:loop[0].index(knots[-1])+1]
+            else:
+                points = loop[0][loop[0].index(knots[0]):\
+                    loop[0].index(knots[-1]) + 1]
+    # non-circular loop, add first and last point as knots
+    else:
+        if loop[0][0] not in knots:
+            knots.insert(0, loop[0][0])
+        if loop[0][-1] not in knots:
+            knots.append(loop[0][-1])
+    
+    return(knots, points)
+
+
+# calculate relative positions compared to first knot
+def curve_calculate_t(mesh_mod, knots, points, pknots, regular, circular):
+    tpoints = []
+    loc_prev = False
+    len_total = 0
+    
+    for p in points:
+        if p in knots:
+            loc = pknots[knots.index(p)] # use projected knot location
+        else:
+            loc = mathutils.Vector(mesh_mod.vertices[p].co[:])
+        if not loc_prev:
+            loc_prev = loc
+        len_total += (loc-loc_prev).length
+        tpoints.append(len_total)
+        loc_prev = loc
+    tknots = []
+    for p in points:
+        if p in knots:
+            tknots.append(tpoints[points.index(p)])
+    if circular:
+        tknots[-1] = tpoints[-1]
+    
+    # regular option
+    if regular:
+        tpoints_average = tpoints[-1] / (len(tpoints) - 1)
+        for i in range(1, len(tpoints) - 1):
+            tpoints[i] = i * tpoints_average
+        for i in range(len(knots)):
+            tknots[i] = tpoints[points.index(knots[i])]
+        if circular:
+            tknots[-1] = tpoints[-1]
+    
+    
+    return(tknots, tpoints)
+
+
+# change the location of non-selected points to their place on the spline
+def curve_calculate_vertices(mesh_mod, knots, tknots, points, tpoints, splines,
+interpolation, restriction):
+    newlocs = {}
+    move = []
+    
+    for p in points:
+        if p in knots:
+            continue
+        m = tpoints[points.index(p)]
+        if m in tknots:
+            n = tknots.index(m)
+        else:
+            t = tknots[:]
+            t.append(m)
+            t.sort()
+            n = t.index(m) - 1
+        if n > len(splines) - 1:
+            n = len(splines) - 1
+        elif n < 0:
+            n = 0
+        
+        if interpolation == 'cubic':
+            ax, bx, cx, dx, tx = splines[n][0]
+            x = ax + bx*(m-tx) + cx*(m-tx)**2 + dx*(m-tx)**3
+            ay, by, cy, dy, ty = splines[n][1]
+            y = ay + by*(m-ty) + cy*(m-ty)**2 + dy*(m-ty)**3
+            az, bz, cz, dz, tz = splines[n][2]
+            z = az + bz*(m-tz) + cz*(m-tz)**2 + dz*(m-tz)**3
+            newloc = mathutils.Vector([x,y,z])
+        else: # interpolation == 'linear'
+            a, d, t, u = splines[n]
+            newloc = ((m-t)/u)*d + a
+
+        if restriction != 'none': # vertex movement is restricted
+            newlocs[p] = newloc
+        else: # set the vertex to its new location
+            move.append([p, newloc])
+        
+    if restriction != 'none': # vertex movement is restricted
+        for p in points:
+            if p in newlocs:
+                newloc = newlocs[p]
+            else:
+                move.append([p, mesh_mod.vertices[p].co])
+                continue
+            oldloc = mesh_mod.vertices[p].co
+            normal = mesh_mod.vertices[p].normal
+            dloc = newloc - oldloc
+            if dloc.length < 1e-6:
+                move.append([p, newloc])
+            elif restriction == 'extrude': # only extrusions
+                if dloc.angle(normal, 0) < 0.5 * math.pi + 1e-6:
+                    move.append([p, newloc])
+            else: # restriction == 'indent' only indentations
+                if dloc.angle(normal) > 0.5 * math.pi - 1e-6:
+                    move.append([p, newloc])
+
+    return(move)
+
+
+# trim loops to part between first and last selected vertices (including)
+def curve_cut_boundaries(mesh_mod, loops):
+    cut_loops = []
+    for loop, circular in loops:
+        if circular:
+            # don't cut
+            cut_loops.append([loop, circular])
+            continue
+        selected = [mesh_mod.vertices[v].select for v in loop]
+        first = selected.index(True)
+        selected.reverse()
+        last = -selected.index(True)
+        if last == 0:
+            cut_loops.append([loop[first:], circular])
+        else:
+            cut_loops.append([loop[first:last], circular])
+    
+    return(cut_loops)
+
+
+# calculate input loops
+def curve_get_input(object, mesh, boundaries, scene):
+    # get mesh with modifiers applied
+    derived, mesh_mod = get_derived_mesh(object, mesh, scene)
+    
+    # vertices that still need a loop to run through it
+    verts_unsorted = [v.index for v in mesh_mod.vertices if \
+        v.select and not v.hide]
+    # necessary dictionaries
+    vert_edges = dict_vert_edges(mesh_mod)
+    edge_faces = dict_edge_faces(mesh_mod)
+    correct_loops = []
+    
+    # find loops through each selected vertex
+    while len(verts_unsorted) > 0:
+        loops = curve_vertex_loops(mesh_mod, verts_unsorted[0], vert_edges,
+            edge_faces)
+        verts_unsorted.pop(0)
+        
+        # check if loop is fully selected
+        search_perpendicular = False
+        i = -1
+        for loop, circular in loops:
+            i += 1
+            selected = [v for v in loop if mesh_mod.vertices[v].select]
+            if len(selected) < 2:
+                # only one selected vertex on loop, don't use
+                loops.pop(i)
+                continue
+            elif len(selected) == len(loop):
+                search_perpendicular = loop
+                break
+        # entire loop is selected, find perpendicular loops
+        if search_perpendicular:
+            for vert in loop:
+                if vert in verts_unsorted:
+                    verts_unsorted.remove(vert)
+            perp_loops = curve_perpendicular_loops(mesh_mod, loop,
+                vert_edges, edge_faces)
+            for perp_loop in perp_loops:
+                correct_loops.append(perp_loop)
+        # normal input
+        else:
+            for loop, circular in loops:
+                correct_loops.append([loop, circular])
+    
+    # boundaries option
+    if boundaries:
+        correct_loops = curve_cut_boundaries(mesh_mod, correct_loops)
+    
+    return(derived, mesh_mod, correct_loops)
+
+
+# return all loops that are perpendicular to the given one
+def curve_perpendicular_loops(mesh_mod, start_loop, vert_edges, edge_faces):
+    # find perpendicular loops
+    perp_loops = []
+    for start_vert in start_loop:
+        loops = curve_vertex_loops(mesh_mod, start_vert, vert_edges,
+            edge_faces)
+        for loop, circular in loops:
+            selected = [v for v in loop if mesh_mod.vertices[v].select]
+            if len(selected) == len(loop):
+                continue
+            else:
+                perp_loops.append([loop, circular, loop.index(start_vert)])
+    
+    # trim loops to same lengths
+    shortest = [[len(loop[0]), i] for i, loop in enumerate(perp_loops)\
+        if not loop[1]]
+    if not shortest:
+        # all loops are circular, not trimming
+        return([[loop[0], loop[1]] for loop in perp_loops])
+    else:
+        shortest = min(shortest)
+    shortest_start = perp_loops[shortest[1]][2]
+    before_start = shortest_start
+    after_start = shortest[0] - shortest_start - 1
+    bigger_before = before_start > after_start
+    trimmed_loops = []
+    for loop in perp_loops:
+        # have the loop face the same direction as the shortest one
+        if bigger_before:
+            if loop[2] < len(loop[0]) / 2:
+                loop[0].reverse()
+                loop[2] = len(loop[0]) - loop[2] - 1
+        else:
+            if loop[2] > len(loop[0]) / 2:
+                loop[0].reverse()
+                loop[2] = len(loop[0]) - loop[2] - 1
+        # circular loops can shift, to prevent wrong trimming
+        if loop[1]:
+            shift = shortest_start - loop[2]
+            if loop[2] + shift > 0 and loop[2] + shift < len(loop[0]):
+                loop[0] = loop[0][-shift:] + loop[0][:-shift]
+            loop[2] += shift
+            if loop[2] < 0:
+                loop[2] += len(loop[0])
+            elif loop[2] > len(loop[0]) -1:
+                loop[2] -= len(loop[0])
+        # trim
+        start = max(0, loop[2] - before_start)
+        end = min(len(loop[0]), loop[2] + after_start + 1)
+        trimmed_loops.append([loop[0][start:end], False])
+    
+    return(trimmed_loops)
+
+
+# project knots on non-selected geometry
+def curve_project_knots(mesh_mod, verts_selected, knots, points, circular):
+    # function to project vertex on edge
+    def project(v1, v2, v3):
+        # v1 and v2 are part of a line
+        # v3 is projected onto it
+        v2 -= v1
+        v3 -= v1
+        p = v3.project(v2)
+        return(p + v1)
+    
+    if circular: # project all knots
+        start = 0
+        end = len(knots)
+        pknots = []
+    else: # first and last knot shouldn't be projected
+        start = 1
+        end = -1
+        pknots = [mathutils.Vector(mesh_mod.vertices[knots[0]].co[:])]
+    for knot in knots[start:end]:
+        if knot in verts_selected:
+            knot_left = knot_right = False
+            for i in range(points.index(knot)-1, -1*len(points), -1):
+                if points[i] not in knots:
+                    knot_left = points[i]
+                    break
+            for i in range(points.index(knot)+1, 2*len(points)):
+                if i > len(points) - 1:
+                    i -= len(points)
+                if points[i] not in knots:
+                    knot_right = points[i]
+                    break
+            if knot_left and knot_right and knot_left != knot_right:
+                knot_left = mathutils.Vector(\
+                    mesh_mod.vertices[knot_left].co[:])
+                knot_right = mathutils.Vector(\
+                    mesh_mod.vertices[knot_right].co[:])
+                knot = mathutils.Vector(mesh_mod.vertices[knot].co[:])
+                pknots.append(project(knot_left, knot_right, knot))
+            else:
+                pknots.append(mathutils.Vector(mesh_mod.vertices[knot].co[:]))
+        else: # knot isn't selected, so shouldn't be changed
+            pknots.append(mathutils.Vector(mesh_mod.vertices[knot].co[:]))
+    if not circular:
+        pknots.append(mathutils.Vector(mesh_mod.vertices[knots[-1]].co[:]))
+    
+    return(pknots)
+
+
+# find all loops through a given vertex
+def curve_vertex_loops(mesh_mod, start_vert, vert_edges, edge_faces):
+    edges_used = []
+    loops = []
+        
+    for edge in vert_edges[start_vert]:
+        if edge in edges_used:
+            continue
+        loop = []
+        circular = False
+        for vert in edge:
+            active_faces = edge_faces[edge]
+            new_vert = vert
+            growing = True
+            while growing:
+                growing = False
+                new_edges = vert_edges[new_vert]
+                loop.append(new_vert)
+                if len(loop) > 1:
+                    edges_used.append(tuple(sorted([loop[-1], loop[-2]])))
+                if len(new_edges) < 3 or len(new_edges) > 4:
+                    # pole
+                    break
+                else:
+                    # find next edge
+                    for new_edge in new_edges:
+                        if new_edge in edges_used:
+                            continue
+                        eliminate = False
+                        for new_face in edge_faces[new_edge]:
+                            if new_face in active_faces:
+                                eliminate = True
+                                break
+                        if eliminate:
+                            continue
+                        # found correct new edge
+                        active_faces = edge_faces[new_edge]
+                        v1, v2 = new_edge
+                        if v1 != new_vert:
+                            new_vert = v1
+                        else:
+                            new_vert = v2
+                        if new_vert == loop[0]:
+                            circular = True
+                        else:
+                            growing = True
+                        break
+            if circular:
+                break
+            loop.reverse()
+        loops.append([loop, circular])
+    
+    return(loops)
+
+
+##########################################
+####### Flatten functions ################
+##########################################
+
+# sort input into loops
+def flatten_get_input(mesh):
+    vert_verts = dict_vert_verts([edge.key for edge in mesh.edges \
+        if edge.select and not edge.hide])
+    verts = [v.index for v in mesh.vertices if v.select and not v.hide]
+    
+    # no connected verts, consider all selected verts as a single input
+    if not vert_verts:
+        return([[verts, False]])
+    
+    loops = []
+    while len(verts) > 0:
+        # start of loop
+        loop = [verts[0]]
+        verts.pop(0)
+        if loop[-1] in vert_verts:
+            to_grow = vert_verts[loop[-1]]
+        else:
+            to_grow = []
+        # grow loop
+        while len(to_grow) > 0:
+            new_vert = to_grow[0]
+            to_grow.pop(0)
+            if new_vert in loop:
+                continue
+            loop.append(new_vert)
+            verts.remove(new_vert)
+            to_grow += vert_verts[new_vert]
+        # add loop to loops
+        loops.append([loop, False])
+    
+    return(loops)
+
+
+# calculate position of vertex projections on plane
+def flatten_project(mesh, loop, com, normal):
+    verts = [mesh.vertices[v] for v in loop[0]]
+    verts_projected = [[v.index, mathutils.Vector(v.co[:]) - \
+        (mathutils.Vector(v.co[:])-com).dot(normal)*normal] for v in verts]
+    
+    return(verts_projected)
+
+
+##########################################
+####### Relax functions ##################
+##########################################
+
+# create lists with knots and points, all correctly sorted
+def relax_calculate_knots(loops):
+    all_knots = []
+    all_points = []
+    for loop, circular in loops:
+        knots = [[], []]
+        points = [[], []]
+        if circular:
+            if len(loop)%2 == 1: # odd
+                extend = [False, True, 0, 1, 0, 1]
+            else: # even
+                extend = [True, False, 0, 1, 1, 2]
+        else:
+            if len(loop)%2 == 1: # odd
+                extend = [False, False, 0, 1, 1, 2]
+            else: # even
+                extend = [False, False, 0, 1, 1, 2]
+        for j in range(2):
+            if extend[j]:
+                loop = [loop[-1]] + loop + [loop[0]]
+            for i in range(extend[2+2*j], len(loop), 2):
+                knots[j].append(loop[i])
+            for i in range(extend[3+2*j], len(loop), 2):
+                if loop[i] == loop[-1] and not circular:
+                    continue
+                if len(points[j]) == 0:
+                    points[j].append(loop[i])
+                elif loop[i] != points[j][0]:
+                    points[j].append(loop[i])
+            if circular:
+                if knots[j][0] != knots[j][-1]:
+                    knots[j].append(knots[j][0])
+        if len(points[1]) == 0:
+            knots.pop(1)
+            points.pop(1)
+        for k in knots:
+            all_knots.append(k)
+        for p in points:
+            all_points.append(p)
+    
+    return(all_knots, all_points)
+
+
+# calculate relative positions compared to first knot
+def relax_calculate_t(mesh_mod, knots, points, regular):
+    all_tknots = []
+    all_tpoints = []
+    for i in range(len(knots)):
+        amount = len(knots[i]) + len(points[i])
+        mix  = []
+        for j in range(amount):
+            if j%2 == 0:
+                mix.append([True, knots[i][round(j/2)]])
+            elif j == amount-1:
+                mix.append([True, knots[i][-1]])
+            else:
+                mix.append([False, points[i][int(j/2)]])
+        len_total = 0
+        loc_prev = False
+        tknots = []
+        tpoints = []
+        for m in mix:
+            loc = mathutils.Vector(mesh_mod.vertices[m[1]].co[:])
+            if not loc_prev:
+                loc_prev = loc
+            len_total += (loc - loc_prev).length
+            if m[0]:
+                tknots.append(len_total)
+            else:
+                tpoints.append(len_total)
+            loc_prev = loc
+        if regular:
+            tpoints = []
+            for p in range(len(points[i])):
+                tpoints.append((tknots[p] + tknots[p+1]) / 2)
+        all_tknots.append(tknots)
+        all_tpoints.append(tpoints)
+    
+    return(all_tknots, all_tpoints)
+
+
+# change the location of the points to their place on the spline
+def relax_calculate_verts(mesh_mod, interpolation, tknots, knots, tpoints,
+points, splines):
+    change = []
+    move = []
+    for i in range(len(knots)):
+        for p in points[i]:
+            m = tpoints[i][points[i].index(p)]
+            if m in tknots[i]:
+                n = tknots[i].index(m)
+            else:
+                t = tknots[i][:]
+                t.append(m)
+                t.sort()
+                n = t.index(m)-1
+            if n > len(splines[i]) - 1:
+                n = len(splines[i]) - 1
+            elif n < 0:
+                n = 0
+            
+            if interpolation == 'cubic':
+                ax, bx, cx, dx, tx = splines[i][n][0]
+                x = ax + bx*(m-tx) + cx*(m-tx)**2 + dx*(m-tx)**3
+                ay, by, cy, dy, ty = splines[i][n][1]
+                y = ay + by*(m-ty) + cy*(m-ty)**2 + dy*(m-ty)**3
+                az, bz, cz, dz, tz = splines[i][n][2]
+                z = az + bz*(m-tz) + cz*(m-tz)**2 + dz*(m-tz)**3
+                change.append([p, mathutils.Vector([x,y,z])])
+            else: # interpolation == 'linear'
+                a, d, t, u = splines[i][n]
+                if u == 0:
+                    u = 1e-8
+                change.append([p, ((m-t)/u)*d + a])
+    for c in change:
+        move.append([c[0], (mesh_mod.vertices[c[0]].co + c[1]) / 2])
+    
+    return(move)
+
+
+##########################################
+####### Space functions ##################
+##########################################
+
+# calculate relative positions compared to first knot
+def space_calculate_t(mesh_mod, knots):
+    tknots = []
+    loc_prev = False
+    len_total = 0
+    for k in knots:
+        loc = mathutils.Vector(mesh_mod.vertices[k].co[:])
+        if not loc_prev:
+            loc_prev = loc
+        len_total += (loc - loc_prev).length
+        tknots.append(len_total)
+        loc_prev = loc
+    amount = len(knots)
+    t_per_segment = len_total / (amount - 1)
+    tpoints = [i * t_per_segment for i in range(amount)]
+    
+    return(tknots, tpoints)
+
+
+# change the location of the points to their place on the spline
+def space_calculate_verts(mesh_mod, interpolation, tknots, tpoints, points,
+splines):
+    move = []
+    for p in points:
+        m = tpoints[points.index(p)]
+        if m in tknots:
+            n = tknots.index(m)
+        else:
+            t = tknots[:]
+            t.append(m)
+            t.sort()
+            n = t.index(m) - 1
+        if n > len(splines) - 1:
+            n = len(splines) - 1
+        elif n < 0:
+            n = 0
+        
+        if interpolation == 'cubic':
+            ax, bx, cx, dx, tx = splines[n][0]
+            x = ax + bx*(m-tx) + cx*(m-tx)**2 + dx*(m-tx)**3
+            ay, by, cy, dy, ty = splines[n][1]
+            y = ay + by*(m-ty) + cy*(m-ty)**2 + dy*(m-ty)**3
+            az, bz, cz, dz, tz = splines[n][2]
+            z = az + bz*(m-tz) + cz*(m-tz)**2 + dz*(m-tz)**3
+            move.append([p, mathutils.Vector([x,y,z])])
+        else: # interpolation == 'linear'
+            a, d, t, u = splines[n]
+            move.append([p, ((m-t)/u)*d + a])
+    
+    return(move)
+
+
+##########################################
+####### Operators ########################
+##########################################
+
+# bridge operator
+class Bridge(bpy.types.Operator):
+    bl_idname = 'mesh.looptools_bridge'
+    bl_label = "Bridge / Loft"
+    bl_description = "Bridge two, or loft several, loops of vertices"
+    bl_options = {'REGISTER', 'UNDO'}
+    
+    cubic_strength = bpy.props.FloatProperty(name = "Strength",
+        description = "Higher strength results in more fluid curves",
+        default = 1.0,
+        soft_min = -3.0,
+        soft_max = 3.0)
+    interpolation = bpy.props.EnumProperty(name = "Interpolation mode",
+        items = (('cubic', "Cubic", "Gives curved results"),
+            ('linear', "Linear", "Basic, fast, straight interpolation")),
+        description = "Interpolation mode: algorithm used when creating "\
+            "segments",
+        default = 'cubic')
+    loft = bpy.props.BoolProperty(name = "Loft",
+        description = "Loft multiple loops, instead of considering them as "\
+            "a multi-input for bridging",
+        default = False)
+    loft_loop = bpy.props.BoolProperty(name = "Loop",
+        description = "Connect the first and the last loop with each other",
+        default = False)
+    min_width = bpy.props.IntProperty(name = "Minimum width",
+        description = "Segments with an edge smaller than this are merged "\
+            "(compared to base edge)",
+        default = 0,
+        min = 0,
+        max = 100,
+        subtype = 'PERCENTAGE')
+    mode = bpy.props.EnumProperty(name = "Mode",
+        items = (('basic', "Basic", "Fast algorithm"), ('shortest',
+            "Shortest edge", "Slower algorithm with better vertex matching")),
+        description = "Algorithm used for bridging",
+        default = 'shortest')
+    remove_faces = bpy.props.BoolProperty(name = "Remove faces",
+        description = "Remove faces that are internal after bridging",
+        default = True)
+    reverse = bpy.props.BoolProperty(name = "Reverse",
+        description = "Manually override the direction in which the loops "\
+                      "are bridged. Only use if the tool gives the wrong " \
+                      "result",
+        default = False)
+    segments = bpy.props.IntProperty(name = "Segments",
+        description = "Number of segments used to bridge the gap "\
+            "(0 = automatic)",
+        default = 1,
+        min = 0,
+        soft_max = 20)
+    twist = bpy.props.IntProperty(name = "Twist",
+        description = "Twist what vertices are connected to each other",
+        default = 0)
+    
+    @classmethod
+    def poll(cls, context):
+        ob = context.active_object
+        return (ob and ob.type == 'MESH' and context.mode == 'EDIT_MESH')
+    
+    def draw(self, context):
+        layout = self.layout
+        #layout.prop(self, "mode") # no cases yet where 'basic' mode is needed
+        
+        # top row
+        col_top = layout.column(align=True)
+        row = col_top.row(align=True)
+        col_left = row.column(align=True)
+        col_right = row.column(align=True)
+        col_right.active = self.segments != 1
+        col_left.prop(self, "segments")
+        col_right.prop(self, "min_width", text="")
+        # bottom row
+        bottom_left = col_left.row()
+        bottom_left.active = self.segments != 1
+        bottom_left.prop(self, "interpolation", text="")
+        bottom_right = col_right.row()
+        bottom_right.active = self.interpolation == 'cubic'
+        bottom_right.prop(self, "cubic_strength")
+        # boolean properties
+        col_top.prop(self, "remove_faces")
+        if self.loft:
+            col_top.prop(self, "loft_loop")
+        
+        # override properties
+        col_top.separator()
+        row = layout.row(align = True)
+        row.prop(self, "twist")
+        row.prop(self, "reverse")
+    
+    def invoke(self, context, event):
+        # load custom settings
+        context.window_manager.looptools.bridge_loft = self.loft
+        settings_load(self)
+        return self.execute(context)
+    
+    def execute(self, context):
+        # initialise
+        global_undo, object, mesh = initialise()
+        edge_faces, edgekey_to_edge, old_selected_faces, smooth = \
+            bridge_initialise(mesh, self.interpolation)
+        settings_write(self)
+        
+        # check cache to see if we can save time
+        input_method = bridge_input_method(self.loft, self.loft_loop)
+        cached, single_loops, loops, derived, mapping = cache_read("Bridge",
+            object, mesh, input_method, False)
+        if not cached:
+            # get loops
+            loops = bridge_get_input(mesh)
+            if loops:
+                # reorder loops if there are more than 2
+                if len(loops) > 2:
+                    if self.loft:
+                        loops = bridge_sort_loops(mesh, loops, self.loft_loop)
+                    else:
+                        loops = bridge_match_loops(mesh, loops)
+        
+        # saving cache for faster execution next time
+        if not cached:
+            cache_write("Bridge", object, mesh, input_method, False, False,
+                loops, False, False)
+        
+        if loops:
+            # calculate new geometry
+            vertices = []
+            faces = []
+            max_vert_index = len(mesh.vertices)-1
+            for i in range(1, len(loops)):
+                if not self.loft and i%2 == 0:
+                    continue
+                lines = bridge_calculate_lines(mesh, loops[i-1:i+1],
+                    self.mode, self.twist, self.reverse)
+                vertex_normals = bridge_calculate_virtual_vertex_normals(mesh,
+                    lines, loops[i-1:i+1], edge_faces, edgekey_to_edge)
+                segments = bridge_calculate_segments(mesh, lines,
+                    loops[i-1:i+1], self.segments)
+                new_verts, new_faces, max_vert_index = \
+                    bridge_calculate_geometry(mesh, lines, vertex_normals,
+                    segments, self.interpolation, self.cubic_strength,
+                    self.min_width, max_vert_index)
+                if new_verts:
+                    vertices += new_verts
+                if new_faces:
+                    faces += new_faces
+            # make sure faces in loops that aren't used, aren't removed
+            if self.remove_faces and old_selected_faces:
+                bridge_save_unused_faces(mesh, old_selected_faces, loops)
+            # create vertices
+            if vertices:
+                bridge_create_vertices(mesh, vertices)
+            # create faces
+            if faces:
+                bridge_create_faces(mesh, faces, self.twist)
+                bridge_select_new_faces(mesh, len(faces), smooth)
+            # edge-data could have changed, can't use cache next run
+            if faces and not vertices:
+                cache_delete("Bridge")
+            # delete internal faces
+            if self.remove_faces and old_selected_faces:
+                bridge_remove_internal_faces(mesh, old_selected_faces)
+            # make sure normals are facing outside
+            bridge_recalculate_normals()
+        
+        terminate(global_undo)
+        return{'FINISHED'}
+
+
+# circle operator
+class Circle(bpy.types.Operator):
+    bl_idname = "mesh.looptools_circle"
+    bl_label = "Circle"
+    bl_description = "Move selected vertices into a circle shape"
+    bl_options = {'REGISTER', 'UNDO'}
+    
+    custom_radius = bpy.props.BoolProperty(name = "Radius",
+        description = "Force a custom radius",
+        default = False)
+    fit = bpy.props.EnumProperty(name = "Method",
+        items = (("best", "Best fit", "Non-linear least squares"),
+            ("inside", "Fit inside","Only move vertices towards the center")),
+        description = "Method used for fitting a circle to the vertices",
+        default = 'best')
+    flatten = bpy.props.BoolProperty(name = "Flatten",
+        description = "Flatten the circle, instead of projecting it on the " \
+            "mesh",
+        default = True)
+    influence = bpy.props.FloatProperty(name = "Influence",
+        description = "Force of the tool",
+        default = 100.0,
+        min = 0.0,
+        max = 100.0,
+        precision = 1,
+        subtype = 'PERCENTAGE')
+    radius = bpy.props.FloatProperty(name = "Radius",
+        description = "Custom radius for circle",
+        default = 1.0,
+        min = 0.0,
+        soft_max = 1000.0)
+    regular = bpy.props.BoolProperty(name = "Regular",
+        description = "Distribute vertices at constant distances along the " \
+            "circle",
+        default = True)
+    
+    @classmethod
+    def poll(cls, context):
+        ob = context.active_object
+        return(ob and ob.type == 'MESH' and context.mode == 'EDIT_MESH')
+    
+    def draw(self, context):
+        layout = self.layout
+        col = layout.column()
+        
+        col.prop(self, "fit")
+        col.separator()
+        
+        col.prop(self, "flatten")
+        row = col.row(align=True)
+        row.prop(self, "custom_radius")
+        row_right = row.row(align=True)
+        row_right.active = self.custom_radius
+        row_right.prop(self, "radius", text="")
+        col.prop(self, "regular")
+        col.separator()
+                
+        col.prop(self, "influence")
+    
+    def invoke(self, context, event):
+        # load custom settings
+        settings_load(self)
+        return self.execute(context)
+    
+    def execute(self, context):
+        # initialise
+        global_undo, object, mesh = initialise()
+        settings_write(self)
+        # check cache to see if we can save time
+        cached, single_loops, loops, derived, mapping = cache_read("Circle",
+            object, mesh, False, False)
+        if cached:
+            derived, mesh_mod = get_derived_mesh(object, mesh, context.scene)
+        else:
+            # find loops
+            derived, mesh_mod, single_vertices, single_loops, loops = \
+                circle_get_input(object, mesh, context.scene)
+            mapping = get_mapping(derived, mesh, mesh_mod, single_vertices,
+                False, loops)
+            single_loops, loops = circle_check_loops(single_loops, loops,
+                mapping, mesh_mod)
+        
+        # saving cache for faster execution next time
+        if not cached:
+            cache_write("Circle", object, mesh, False, False, single_loops,
+                loops, derived, mapping)
+        
+        move = []
+        for i, loop in enumerate(loops):
+            # best fitting flat plane
+            com, normal = calculate_plane(mesh_mod, loop)
+            # if circular, shift loop so we get a good starting vertex
+            if loop[1]:
+                loop = circle_shift_loop(mesh_mod, loop, com)
+            # flatten vertices on plane
+            locs_2d, p, q = circle_3d_to_2d(mesh_mod, loop, com, normal)
+            # calculate circle
+            if self.fit == 'best':
+                x0, y0, r = circle_calculate_best_fit(locs_2d)
+            else: # self.fit == 'inside'
+                x0, y0, r = circle_calculate_min_fit(locs_2d)
+            # radius override
+            if self.custom_radius:
+                r = self.radius / p.length
+            # calculate positions on circle
+            if self.regular:
+                new_locs_2d = circle_project_regular(locs_2d[:], x0, y0, r)
+            else:
+                new_locs_2d = circle_project_non_regular(locs_2d[:], x0, y0, r)
+            # take influence into account
+            locs_2d = circle_influence_locs(locs_2d, new_locs_2d,
+                self.influence)
+            # calculate 3d positions of the created 2d input
+            move.append(circle_calculate_verts(self.flatten, mesh_mod,
+                locs_2d, com, p, q, normal))
+            # flatten single input vertices on plane defined by loop
+            if self.flatten and single_loops:
+                move.append(circle_flatten_singles(mesh_mod, com, p, q,
+                    normal, single_loops[i]))
+        
+        # move vertices to new locations
+        move_verts(mesh, mapping, move, -1)
+        
+        # cleaning up 
+        if derived:
+            bpy.context.blend_data.meshes.remove(mesh_mod)
+        terminate(global_undo)
+        
+        return{'FINISHED'}
+
+
+# curve operator
+class Curve(bpy.types.Operator):
+    bl_idname = "mesh.looptools_curve"
+    bl_label = "Curve"
+    bl_description = "Turn a loop into a smooth curve"
+    bl_options = {'REGISTER', 'UNDO'}
+    
+    boundaries = bpy.props.BoolProperty(name = "Boundaries",
+        description = "Limit the tool to work within the boundaries of the "\
+            "selected vertices",
+        default = False)
+    influence = bpy.props.FloatProperty(name = "Influence",
+        description = "Force of the tool",
+        default = 100.0,
+        min = 0.0,
+        max = 100.0,
+        precision = 1,
+        subtype = 'PERCENTAGE')
+    interpolation = bpy.props.EnumProperty(name = "Interpolation",
+        items = (("cubic", "Cubic", "Natural cubic spline, smooth results"),
+            ("linear", "Linear", "Simple and fast linear algorithm")),
+        description = "Algorithm used for interpolation",
+        default = 'cubic')
+    regular = bpy.props.BoolProperty(name = "Regular",
+        description = "Distribute vertices at constant distances along the" \
+            "curve",
+        default = True)
+    restriction = bpy.props.EnumProperty(name = "Restriction",
+        items = (("none", "None", "No restrictions on vertex movement"),
+            ("extrude", "Extrude only","Only allow extrusions (no "\
+                "indentations)"),
+            ("indent", "Indent only", "Only allow indentation (no "\
+                "extrusions)")),
+        description = "Restrictions on how the vertices can be moved",
+        default = 'none')
+    
+    @classmethod
+    def poll(cls, context):
+        ob = context.active_object
+        return(ob and ob.type == 'MESH' and context.mode == 'EDIT_MESH')
+    
+    def draw(self, context):
+        layout = self.layout
+        col = layout.column()
+        
+        col.prop(self, "interpolation")
+        col.prop(self, "restriction")
+        col.prop(self, "boundaries")
+        col.prop(self, "regular")
+        col.separator()
+        
+        col.prop(self, "influence")
+    
+    def invoke(self, context, event):
+        # load custom settings
+        settings_load(self)
+        return self.execute(context)
+    
+    def execute(self, context):
+        # initialise
+        global_undo, object, mesh = initialise()
+        settings_write(self)
+        # check cache to see if we can save time
+        cached, single_loops, loops, derived, mapping = cache_read("Curve",
+            object, mesh, False, self.boundaries)
+        if cached:
+            derived, mesh_mod = get_derived_mesh(object, mesh, context.scene)
+        else:
+            # find loops
+            derived, mesh_mod, loops = curve_get_input(object, mesh,
+                self.boundaries, context.scene)
+            mapping = get_mapping(derived, mesh, mesh_mod, False, True, loops)
+            loops = check_loops(loops, mapping, mesh_mod)
+        verts_selected = [v.index for v in mesh_mod.vertices if v.select \
+            and not v.hide]
+        
+        # saving cache for faster execution next time
+        if not cached:
+            cache_write("Curve", object, mesh, False, self.boundaries, False,
+                loops, derived, mapping)
+        
+        move = []
+        for loop in loops:
+            knots, points = curve_calculate_knots(loop, verts_selected)
+            pknots = curve_project_knots(mesh_mod, verts_selected, knots,
+                points, loop[1])
+            tknots, tpoints = curve_calculate_t(mesh_mod, knots, points,
+                pknots, self.regular, loop[1])
+            splines = calculate_splines(self.interpolation, mesh_mod,
+                tknots, knots)
+            move.append(curve_calculate_vertices(mesh_mod, knots, tknots,
+                points, tpoints, splines, self.interpolation,
+                self.restriction))
+        
+        # move vertices to new locations
+        move_verts(mesh, mapping, move, self.influence)
+        
+        # cleaning up 
+        if derived:
+            bpy.context.blend_data.meshes.remove(mesh_mod)
+        
+        terminate(global_undo)
+        return{'FINISHED'}
+
+
+# flatten operator
+class Flatten(bpy.types.Operator):
+    bl_idname = "mesh.looptools_flatten"
+    bl_label = "Flatten"
+    bl_description = "Flatten vertices on a best-fitting plane"
+    bl_options = {'REGISTER', 'UNDO'}
+    
+    influence = bpy.props.FloatProperty(name = "Influence",
+        description = "Force of the tool",
+        default = 100.0,
+        min = 0.0,
+        max = 100.0,
+        precision = 1,
+        subtype = 'PERCENTAGE')
+    plane = bpy.props.EnumProperty(name = "Plane",
+        items = (("best_fit", "Best fit", "Calculate a best fitting plane"),
+            ("normal", "Normal", "Derive plane from averaging vertex "\
+            "normals"),
+            ("view", "View", "Flatten on a plane perpendicular to the "\
+            "viewing angle")),
+        description = "Plane on which vertices are flattened",
+        default = 'best_fit')
+    restriction = bpy.props.EnumProperty(name = "Restriction",
+        items = (("none", "None", "No restrictions on vertex movement"),
+            ("bounding_box", "Bounding box", "Vertices are restricted to "\
+            "movement inside the bounding box of the selection")),
+        description = "Restrictions on how the vertices can be moved",
+        default = 'none')
+    
+    @classmethod
+    def poll(cls, context):
+        ob = context.active_object
+        return(ob and ob.type == 'MESH' and context.mode == 'EDIT_MESH')
+    
+    def draw(self, context):
+        layout = self.layout
+        col = layout.column()
+        
+        col.prop(self, "plane")
+        #col.prop(self, "restriction")
+        col.separator()
+        
+        col.prop(self, "influence")
+    
+    def invoke(self, context, event):
+        # load custom settings
+        settings_load(self)
+        return self.execute(context)
+    
+    def execute(self, context):
+        # initialise
+        global_undo, object, mesh = initialise()
+        settings_write(self)
+        # check cache to see if we can save time
+        cached, single_loops, loops, derived, mapping = cache_read("Flatten",
+            object, mesh, False, False)
+        if not cached:
+            # order input into virtual loops
+            loops = flatten_get_input(mesh)
+            loops = check_loops(loops, mapping, mesh)
+        
+        # saving cache for faster execution next time
+        if not cached:
+            cache_write("Flatten", object, mesh, False, False, False, loops,
+                False, False)
+        
+        move = []
+        for loop in loops:
+            # calculate plane and position of vertices on them
+            com, normal = calculate_plane(mesh, loop, method=self.plane,
+                object=object)
+            to_move = flatten_project(mesh, loop, com, normal)
+            if self.restriction == 'none':
+                move.append(to_move)
+            else:
+                move.append(to_move)
+        move_verts(mesh, False, move, self.influence)
+        
+        terminate(global_undo)
+        return{'FINISHED'}
+
+
+# relax operator
+class Relax(bpy.types.Operator):
+    bl_idname = "mesh.looptools_relax"
+    bl_label = "Relax"
+    bl_description = "Relax the loop, so it is smoother"
+    bl_options = {'REGISTER', 'UNDO'}
+    
+    input = bpy.props.EnumProperty(name = "Input",
+        items = (("all", "Parallel (all)", "Also use non-selected "\
+                "parallel loops as input"),
+            ("selected", "Selection","Only use selected vertices as input")),
+        description = "Loops that are relaxed",
+        default = 'selected')
+    interpolation = bpy.props.EnumProperty(name = "Interpolation",
+        items = (("cubic", "Cubic", "Natural cubic spline, smooth results"),
+            ("linear", "Linear", "Simple and fast linear algorithm")),
+        description = "Algorithm used for interpolation",
+        default = 'cubic')
+    iterations = bpy.props.EnumProperty(name = "Iterations",
+        items = (("1", "1", "One"),
+            ("3", "3", "Three"),
+            ("5", "5", "Five"),
+            ("10", "10", "Ten"),
+            ("25", "25", "Twenty-five")),
+        description = "Number of times the loop is relaxed",
+        default = "1")
+    regular = bpy.props.BoolProperty(name = "Regular",
+        description = "Distribute vertices at constant distances along the" \
+            "loop",
+        default = True)
+    
+    @classmethod
+    def poll(cls, context):
+        ob = context.active_object
+        return(ob and ob.type == 'MESH' and context.mode == 'EDIT_MESH')
+    
+    def draw(self, context):
+        layout = self.layout
+        col = layout.column()
+        
+        col.prop(self, "interpolation")
+        col.prop(self, "input")
+        col.prop(self, "iterations")
+        col.prop(self, "regular")
+    
+    def invoke(self, context, event):
+        # load custom settings
+        settings_load(self)
+        return self.execute(context)
+    
+    def execute(self, context):
+        # initialise
+        global_undo, object, mesh = initialise()
+        settings_write(self)
+        # check cache to see if we can save time
+        cached, single_loops, loops, derived, mapping = cache_read("Relax",
+            object, mesh, self.input, False)
+        if cached:
+            derived, mesh_mod = get_derived_mesh(object, mesh, context.scene)
+        else:
+            # find loops
+            derived, mesh_mod, loops = get_connected_input(object, mesh,
+                context.scene, self.input)
+            mapping = get_mapping(derived, mesh, mesh_mod, False, False, loops)
+            loops = check_loops(loops, mapping, mesh_mod)
+        knots, points = relax_calculate_knots(loops)
+        
+        # saving cache for faster execution next time
+        if not cached:
+            cache_write("Relax", object, mesh, self.input, False, False, loops,
+                derived, mapping)
+        
+        for iteration in range(int(self.iterations)):
+            # calculate splines and new positions
+            tknots, tpoints = relax_calculate_t(mesh_mod, knots, points,
+                self.regular)
+            splines = []
+            for i in range(len(knots)):
+                splines.append(calculate_splines(self.interpolation, mesh_mod,
+                    tknots[i], knots[i]))
+            move = [relax_calculate_verts(mesh_mod, self.interpolation,
+                tknots, knots, tpoints, points, splines)]
+            move_verts(mesh, mapping, move, -1)
+        
+        # cleaning up 
+        if derived:
+            bpy.context.blend_data.meshes.remove(mesh_mod)
+        terminate(global_undo)
+        
+        return{'FINISHED'}
+
+
+# space operator
+class Space(bpy.types.Operator):
+    bl_idname = "mesh.looptools_space"
+    bl_label = "Space"
+    bl_description = "Space the vertices in a regular distrubtion on the loop"
+    bl_options = {'REGISTER', 'UNDO'}
+    
+    influence = bpy.props.FloatProperty(name = "Influence",
+        description = "Force of the tool",
+        default = 100.0,
+        min = 0.0,
+        max = 100.0,
+        precision = 1,
+        subtype = 'PERCENTAGE')
+    input = bpy.props.EnumProperty(name = "Input",
+        items = (("all", "Parallel (all)", "Also use non-selected "\
+                "parallel loops as input"),
+            ("selected", "Selection","Only use selected vertices as input")),
+        description = "Loops that are spaced",
+        default = 'selected')
+    interpolation = bpy.props.EnumProperty(name = "Interpolation",
+        items = (("cubic", "Cubic", "Natural cubic spline, smooth results"),
+            ("linear", "Linear", "Vertices are projected on existing edges")),
+        description = "Algorithm used for interpolation",
+        default = 'cubic')
+    
+    @classmethod
+    def poll(cls, context):
+        ob = context.active_object
+        return(ob and ob.type == 'MESH' and context.mode == 'EDIT_MESH')
+    
+    def draw(self, context):
+        layout = self.layout
+        col = layout.column()
+        
+        col.prop(self, "interpolation")
+        col.prop(self, "input")
+        col.separator()
+        
+        col.prop(self, "influence")
+    
+    def invoke(self, context, event):
+        # load custom settings
+        settings_load(self)
+        return self.execute(context)
+    
+    def execute(self, context):
+        # initialise
+        global_undo, object, mesh = initialise()
+        settings_write(self)
+        # check cache to see if we can save time
+        cached, single_loops, loops, derived, mapping = cache_read("Space",
+            object, mesh, self.input, False)
+        if cached:
+            derived, mesh_mod = get_derived_mesh(object, mesh, context.scene)
+        else:
+            # find loops
+            derived, mesh_mod, loops = get_connected_input(object, mesh,
+                context.scene, self.input)
+            mapping = get_mapping(derived, mesh, mesh_mod, False, False, loops)
+            loops = check_loops(loops, mapping, mesh_mod)
+        
+        # saving cache for faster execution next time
+        if not cached:
+            cache_write("Space", object, mesh, self.input, False, False, loops,
+                derived, mapping)
+        
+        move = []
+        for loop in loops:
+            # calculate splines and new positions
+            if loop[1]: # circular
+                loop[0].append(loop[0][0])
+            tknots, tpoints = space_calculate_t(mesh_mod, loop[0][:])
+            splines = calculate_splines(self.interpolation, mesh_mod,
+                tknots, loop[0][:])
+            move.append(space_calculate_verts(mesh_mod, self.interpolation,
+                tknots, tpoints, loop[0][:-1], splines))
+        
+        # move vertices to new locations
+        move_verts(mesh, mapping, move, self.influence)
+        
+        # cleaning up 
+        if derived:
+            bpy.context.blend_data.meshes.remove(mesh_mod)
+        terminate(global_undo)
+        
+        return{'FINISHED'}
+
+
+##########################################
+####### GUI and registration #############
+##########################################
+
+# menu containing all tools
+class VIEW3D_MT_edit_mesh_looptools(bpy.types.Menu):
+    bl_label = "LoopTools"
+    
+    def draw(self, context):
+        layout = self.layout
+        
+#        layout.operator("mesh.looptools_bridge", text="Bridge").loft = False
+        layout.operator("mesh.looptools_circle")
+        layout.operator("mesh.looptools_curve")
+        layout.operator("mesh.looptools_flatten")
+#        layout.operator("mesh.looptools_bridge", text="Loft").loft = True
+        layout.operator("mesh.looptools_relax")
+        layout.operator("mesh.looptools_space")
+
+
+# panel containing all tools
+class VIEW3D_PT_tools_looptools(bpy.types.Panel):
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'TOOLS'
+    bl_context = "mesh_edit"
+    bl_label = "LoopTools"
+
+    def draw(self, context):
+        layout = self.layout
+        col = layout.column(align=True)
+        lt = context.window_manager.looptools
+        
+        # bridge - first line
+#        split = col.split(percentage=0.15)
+#        if lt.display_bridge:
+#            split.prop(lt, "display_bridge", text="", icon='DOWNARROW_HLT')
+#        else:
+#            split.prop(lt, "display_bridge", text="", icon='RIGHTARROW')
+#        split.operator("mesh.looptools_bridge", text="Bridge").loft = False
+        # bridge - settings
+#        if lt.display_bridge:
+#            box = col.column(align=True).box().column()
+            #box.prop(self, "mode")
+            
+            # top row
+#            col_top = box.column(align=True)
+#            row = col_top.row(align=True)
+#            col_left = row.column(align=True)
+#            col_right = row.column(align=True)
+#            col_right.active = lt.bridge_segments != 1
+#            col_left.prop(lt, "bridge_segments")
+#            col_right.prop(lt, "bridge_min_width", text="")
+#            # bottom row
+#            bottom_left = col_left.row()
+#            bottom_left.active = lt.bridge_segments != 1
+#            bottom_left.prop(lt, "bridge_interpolation", text="")
+#            bottom_right = col_right.row()
+#            bottom_right.active = lt.bridge_interpolation == 'cubic'
+#            bottom_right.prop(lt, "bridge_cubic_strength")
+            # boolean properties
+#            col_top.prop(lt, "bridge_remove_faces")
+            
+            # override properties
+#            col_top.separator()
+#            row = box.row(align = True)
+#            row.prop(lt, "bridge_twist")
+#            row.prop(lt, "bridge_reverse")
+        
+        # circle - first line
+        split = col.split(percentage=0.15)
+        if lt.display_circle:
+            split.prop(lt, "display_circle", text="", icon='DOWNARROW_HLT')
+        else:
+            split.prop(lt, "display_circle", text="", icon='RIGHTARROW')
+        split.operator("mesh.looptools_circle")
+        # circle - settings
+        if lt.display_circle:
+            box = col.column(align=True).box().column()
+            box.prop(lt, "circle_fit")
+            box.separator()
+            
+            box.prop(lt, "circle_flatten")
+            row = box.row(align=True)
+            row.prop(lt, "circle_custom_radius")
+            row_right = row.row(align=True)
+            row_right.active = lt.circle_custom_radius
+            row_right.prop(lt, "circle_radius", text="")
+            box.prop(lt, "circle_regular")
+            box.separator()
+            
+            box.prop(lt, "circle_influence")
+        
+        # curve - first line
+        split = col.split(percentage=0.15)
+        if lt.display_curve:
+            split.prop(lt, "display_curve", text="", icon='DOWNARROW_HLT')
+        else:
+            split.prop(lt, "display_curve", text="", icon='RIGHTARROW')
+        split.operator("mesh.looptools_curve")
+        # curve - settings
+        if lt.display_curve:
+            box = col.column(align=True).box().column()
+            box.prop(lt, "curve_interpolation")
+            box.prop(lt, "curve_restriction")
+            box.prop(lt, "curve_boundaries")
+            box.prop(lt, "curve_regular")
+            box.separator()
+            
+            box.prop(lt, "curve_influence")
+        
+        # flatten - first line
+        split = col.split(percentage=0.15)
+        if lt.display_flatten:
+            split.prop(lt, "display_flatten", text="", icon='DOWNARROW_HLT')
+        else:
+            split.prop(lt, "display_flatten", text="", icon='RIGHTARROW')
+        split.operator("mesh.looptools_flatten")
+        # flatten - settings
+        if lt.display_flatten:
+            box = col.column(align=True).box().column()
+            box.prop(lt, "flatten_plane")
+            #box.prop(lt, "flatten_restriction")
+            box.separator()
+            
+            box.prop(lt, "flatten_influence")
+        
+        # loft - first line
+#        split = col.split(percentage=0.15)
+#        if lt.display_loft:
+#            split.prop(lt, "display_loft", text="", icon='DOWNARROW_HLT')
+#        else:
+#            split.prop(lt, "display_loft", text="", icon='RIGHTARROW')
+#        split.operator("mesh.looptools_bridge", text="Loft").loft = True
+#        # loft - settings
+#        if lt.display_loft:
+#            box = col.column(align=True).box().column()
+#            #box.prop(self, "mode")
+#            
+#            # top row
+#            col_top = box.column(align=True)
+#            row = col_top.row(align=True)
+#            col_left = row.column(align=True)
+#            col_right = row.column(align=True)
+#            col_right.active = lt.bridge_segments != 1
+#            col_left.prop(lt, "bridge_segments")
+#            col_right.prop(lt, "bridge_min_width", text="")
+#            # bottom row
+#            bottom_left = col_left.row()
+#            bottom_left.active = lt.bridge_segments != 1
+#            bottom_left.prop(lt, "bridge_interpolation", text="")
+#            bottom_right = col_right.row()
+#            bottom_right.active = lt.bridge_interpolation == 'cubic'
+#            bottom_right.prop(lt, "bridge_cubic_strength")
+#            # boolean properties
+#            col_top.prop(lt, "bridge_remove_faces")
+#            col_top.prop(lt, "bridge_loft_loop")
+#            
+#            # override properties
+#            col_top.separator()
+#            row = box.row(align = True)
+#            row.prop(lt, "bridge_twist")
+#            row.prop(lt, "bridge_reverse")
+        
+        # relax - first line
+        split = col.split(percentage=0.15)
+        if lt.display_relax:
+            split.prop(lt, "display_relax", text="", icon='DOWNARROW_HLT')
+        else:
+            split.prop(lt, "display_relax", text="", icon='RIGHTARROW')
+        split.operator("mesh.looptools_relax")
+        # relax - settings
+        if lt.display_relax:
+            box = col.column(align=True).box().column()
+            box.prop(lt, "relax_interpolation")
+            box.prop(lt, "relax_input")
+            box.prop(lt, "relax_iterations")
+            box.prop(lt, "relax_regular")
+        
+        # space - first line
+        split = col.split(percentage=0.15)
+        if lt.display_space:
+            split.prop(lt, "display_space", text="", icon='DOWNARROW_HLT')
+        else:
+            split.prop(lt, "display_space", text="", icon='RIGHTARROW')
+        split.operator("mesh.looptools_space")
+        # space - settings
+        if lt.display_space:
+            box = col.column(align=True).box().column()
+            box.prop(lt, "space_interpolation")
+            box.prop(lt, "space_input")
+            box.separator()
+            
+            box.prop(lt, "space_influence")
+
+
+# property group containing all properties for the gui in the panel
+class LoopToolsProps(bpy.types.PropertyGroup):
+    """
+    Fake module like class
+    bpy.context.window_manager.looptools
+    """
+    
+    # general display properties
+#    display_bridge = bpy.props.BoolProperty(name = "Bridge settings",
+#        description = "Display settings of the Bridge tool",
+#        default = False)
+    display_circle = bpy.props.BoolProperty(name = "Circle settings",
+        description = "Display settings of the Circle tool",
+        default = False)
+    display_curve = bpy.props.BoolProperty(name = "Curve settings",
+        description = "Display settings of the Curve tool",
+        default = False)
+    display_flatten = bpy.props.BoolProperty(name = "Flatten settings",
+        description = "Display settings of the Flatten tool",
+        default = False)
+#    display_loft = bpy.props.BoolProperty(name = "Loft settings",
+#        description = "Display settings of the Loft tool",
+#        default = False)
+    display_relax = bpy.props.BoolProperty(name = "Relax settings",
+        description = "Display settings of the Relax tool",
+        default = False)
+    display_space = bpy.props.BoolProperty(name = "Space settings",
+        description = "Display settings of the Space tool",
+        default = False)
+    
+    # bridge properties
+    bridge_cubic_strength = bpy.props.FloatProperty(name = "Strength",
+        description = "Higher strength results in more fluid curves",
+        default = 1.0,
+        soft_min = -3.0,
+        soft_max = 3.0)
+    bridge_interpolation = bpy.props.EnumProperty(name = "Interpolation mode",
+        items = (('cubic', "Cubic", "Gives curved results"),
+            ('linear', "Linear", "Basic, fast, straight interpolation")),
+        description = "Interpolation mode: algorithm used when creating "\
+            "segments",
+        default = 'cubic')
+    bridge_loft = bpy.props.BoolProperty(name = "Loft",
+        description = "Loft multiple loops, instead of considering them as "\
+            "a multi-input for bridging",
+        default = False)
+    bridge_loft_loop = bpy.props.BoolProperty(name = "Loop",
+        description = "Connect the first and the last loop with each other",
+        default = False)
+    bridge_min_width = bpy.props.IntProperty(name = "Minimum width",
+        description = "Segments with an edge smaller than this are merged "\
+            "(compared to base edge)",
+        default = 0,
+        min = 0,
+        max = 100,
+        subtype = 'PERCENTAGE')
+    bridge_mode = bpy.props.EnumProperty(name = "Mode",
+        items = (('basic', "Basic", "Fast algorithm"),
+                 ('shortest', "Shortest edge", "Slower algorithm with " \
+                                               "better vertex matching")),
+        description = "Algorithm used for bridging",
+        default = 'shortest')
+    bridge_remove_faces = bpy.props.BoolProperty(name = "Remove faces",
+        description = "Remove faces that are internal after bridging",
+        default = True)
+    bridge_reverse = bpy.props.BoolProperty(name = "Reverse",
+        description = "Manually override the direction in which the loops "\
+                      "are bridged. Only use if the tool gives the wrong " \
+                      "result",
+        default = False)
+    bridge_segments = bpy.props.IntProperty(name = "Segments",
+        description = "Number of segments used to bridge the gap "\
+            "(0 = automatic)",
+        default = 1,
+        min = 0,
+        soft_max = 20)
+    bridge_twist = bpy.props.IntProperty(name = "Twist",
+        description = "Twist what vertices are connected to each other",
+        default = 0)
+    
+    # circle properties
+    circle_custom_radius = bpy.props.BoolProperty(name = "Radius",
+        description = "Force a custom radius",
+        default = False)
+    circle_fit = bpy.props.EnumProperty(name = "Method",
+        items = (("best", "Best fit", "Non-linear least squares"),
+            ("inside", "Fit inside","Only move vertices towards the center")),
+        description = "Method used for fitting a circle to the vertices",
+        default = 'best')
+    circle_flatten = bpy.props.BoolProperty(name = "Flatten",
+        description = "Flatten the circle, instead of projecting it on the " \
+            "mesh",
+        default = True)
+    circle_influence = bpy.props.FloatProperty(name = "Influence",
+        description = "Force of the tool",
+        default = 100.0,
+        min = 0.0,
+        max = 100.0,
+        precision = 1,
+        subtype = 'PERCENTAGE')
+    circle_radius = bpy.props.FloatProperty(name = "Radius",
+        description = "Custom radius for circle",
+        default = 1.0,
+        min = 0.0,
+        soft_max = 1000.0)
+    circle_regular = bpy.props.BoolProperty(name = "Regular",
+        description = "Distribute vertices at constant distances along the " \
+            "circle",
+        default = True)
+    
+    # curve properties
+    curve_boundaries = bpy.props.BoolProperty(name = "Boundaries",
+        description = "Limit the tool to work within the boundaries of the "\
+            "selected vertices",
+        default = False)
+    curve_influence = bpy.props.FloatProperty(name = "Influence",
+        description = "Force of the tool",
+        default = 100.0,
+        min = 0.0,
+        max = 100.0,
+        precision = 1,
+        subtype = 'PERCENTAGE')
+    curve_interpolation = bpy.props.EnumProperty(name = "Interpolation",
+        items = (("cubic", "Cubic", "Natural cubic spline, smooth results"),
+            ("linear", "Linear", "Simple and fast linear algorithm")),
+        description = "Algorithm used for interpolation",
+        default = 'cubic')
+    curve_regular = bpy.props.BoolProperty(name = "Regular",
+        description = "Distribute vertices at constant distances along the" \
+            "curve",
+        default = True)
+    curve_restriction = bpy.props.EnumProperty(name = "Restriction",
+        items = (("none", "None", "No restrictions on vertex movement"),
+            ("extrude", "Extrude only","Only allow extrusions (no "\
+                "indentations)"),
+            ("indent", "Indent only", "Only allow indentation (no "\
+                "extrusions)")),
+        description = "Restrictions on how the vertices can be moved",
+        default = 'none')
+    
+    # flatten properties
+    flatten_influence = bpy.props.FloatProperty(name = "Influence",
+        description = "Force of the tool",
+        default = 100.0,
+        min = 0.0,
+        max = 100.0,
+        precision = 1,
+        subtype = 'PERCENTAGE')
+    flatten_plane = bpy.props.EnumProperty(name = "Plane",
+        items = (("best_fit", "Best fit", "Calculate a best fitting plane"),
+            ("normal", "Normal", "Derive plane from averaging vertex "\
+            "normals"),
+            ("view", "View", "Flatten on a plane perpendicular to the "\
+            "viewing angle")),
+        description = "Plane on which vertices are flattened",
+        default = 'best_fit')
+    flatten_restriction = bpy.props.EnumProperty(name = "Restriction",
+        items = (("none", "None", "No restrictions on vertex movement"),
+            ("bounding_box", "Bounding box", "Vertices are restricted to "\
+            "movement inside the bounding box of the selection")),
+        description = "Restrictions on how the vertices can be moved",
+        default = 'none')
+    
+    # relax properties
+    relax_input = bpy.props.EnumProperty(name = "Input",
+        items = (("all", "Parallel (all)", "Also use non-selected "\
+                "parallel loops as input"),
+            ("selected", "Selection","Only use selected vertices as input")),
+        description = "Loops that are relaxed",
+        default = 'selected')
+    relax_interpolation = bpy.props.EnumProperty(name = "Interpolation",
+        items = (("cubic", "Cubic", "Natural cubic spline, smooth results"),
+            ("linear", "Linear", "Simple and fast linear algorithm")),
+        description = "Algorithm used for interpolation",
+        default = 'cubic')
+    relax_iterations = bpy.props.EnumProperty(name = "Iterations",
+        items = (("1", "1", "One"),
+            ("3", "3", "Three"),
+            ("5", "5", "Five"),
+            ("10", "10", "Ten"),
+            ("25", "25", "Twenty-five")),
+        description = "Number of times the loop is relaxed",
+        default = "1")
+    relax_regular = bpy.props.BoolProperty(name = "Regular",
+        description = "Distribute vertices at constant distances along the" \
+            "loop",
+        default = True)
+    
+    # space properties
+    space_influence = bpy.props.FloatProperty(name = "Influence",
+        description = "Force of the tool",
+        default = 100.0,
+        min = 0.0,
+        max = 100.0,
+        precision = 1,
+        subtype = 'PERCENTAGE')
+    space_input = bpy.props.EnumProperty(name = "Input",
+        items = (("all", "Parallel (all)", "Also use non-selected "\
+                "parallel loops as input"),
+            ("selected", "Selection","Only use selected vertices as input")),
+        description = "Loops that are spaced",
+        default = 'selected')
+    space_interpolation = bpy.props.EnumProperty(name = "Interpolation",
+        items = (("cubic", "Cubic", "Natural cubic spline, smooth results"),
+            ("linear", "Linear", "Vertices are projected on existing edges")),
+        description = "Algorithm used for interpolation",
+        default = 'cubic')
+
+
+# draw function for integration in menus
+def menu_func(self, context):
+    self.layout.menu("VIEW3D_MT_edit_mesh_looptools")
+    self.layout.separator()
+
+
+# define classes for registration
+classes = [VIEW3D_MT_edit_mesh_looptools,
+    VIEW3D_PT_tools_looptools,
+    LoopToolsProps,
+    Bridge,
+    Circle,
+    Curve,
+    Flatten,
+    Relax,
+    Space]
+
+
+# registering and menu integration
+def register():
+    for c in classes:
+        bpy.utils.register_class(c)
+    bpy.types.VIEW3D_MT_edit_mesh_specials.prepend(menu_func)
+    bpy.types.WindowManager.looptools = bpy.props.PointerProperty(\
+        type = LoopToolsProps)
+
+
+# unregistering and removing menus
+def unregister():
+    for c in classes:
+        bpy.utils.unregister_class(c)
+    bpy.types.VIEW3D_MT_edit_mesh_specials.remove(menu_func)
+    try:
+        del bpy.types.WindowManager.looptools
+    except:
+        pass
+
+
+if __name__ == "__main__":
+    register()
diff --git a/release/scripts/addons_contrib/mesh_mextrude.py b/release/scripts/addons_contrib/mesh_mextrude.py
new file mode 100644
index 0000000..586b601
--- /dev/null
+++ b/release/scripts/addons_contrib/mesh_mextrude.py
@@ -0,0 +1,188 @@
+# ##### 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 #####
+
+################################################################################
+# Repeats extrusion + rotation + scale for one or more faces                   #
+
+################################################################################
+
+bl_info = {
+    "name": "MExtrude",
+    "author": "liero",
+    "version": (1, 2, 8),
+    "blender": (2, 6, 2),
+    "location": "View3D > Tool Shelf",
+    "description": "Repeat extrusions from faces to create organic shapes",
+    "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=28570",
+    "category": "Mesh"}
+
+import bpy, random
+from random import gauss
+from math import radians
+from mathutils import Euler
+from bpy.props import FloatProperty, IntProperty
+
+def vloc(self, r):
+    random.seed(self.ran + r)
+    return self.off * (1 + random.gauss(0, self.var1 / 3))
+
+def vrot(self,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
+
+class MExtrude(bpy.types.Operator):
+    bl_idname = 'object.mextrude'
+    bl_label = 'MExtrude'
+    bl_description = 'Multi Extrude'
+    bl_options = {'REGISTER', 'UNDO'}
+
+    off = FloatProperty(name='Offset', min=-2, soft_min=0.001, \
+        soft_max=2, max=5, default=.5, description='Translation')
+    rotx = FloatProperty(name='Rot X', min=-85, soft_min=-30, \
+        soft_max=30, max=85, default=0, description='X rotation')
+    roty = FloatProperty(name='Rot Y', min=-85, soft_min=-30, \
+        soft_max=30, max=85, default=0, description='Y rotation')
+    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')
+    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, \
+        soft_max=1, max=5, default=0, description='Rotation variation')
+    var3 = FloatProperty(name='Scale Noise', min=-5, soft_min=-1, \
+        soft_max=1, max=5, default=0, description='Scaling noise')
+    num = IntProperty(name='Repeat', min=1, max=50, soft_max=100, \
+        default=5, description='Repetitions')
+    ran = IntProperty(name='Seed', min=-9999, max=9999, default=0, \
+        description='Seed to feed random values')
+
+    @classmethod
+    def poll(cls, context):
+        return (context.object and context.object.type == 'MESH')
+
+    def draw(self, context):
+        layout = self.layout
+        column = layout.column(align=True)
+        column.label(text='Transformations:')
+        column.prop(self, 'off', slider=True)
+        column.prop(self, 'rotx', slider=True)
+        column.prop(self, 'roty', slider=True)
+        column.prop(self, 'rotz', slider=True)
+        column.prop(self, 'sca', slider=True)
+        column = layout.column(align=True)
+        column.label(text='Variation settings:')
+        column.prop(self, 'var1', slider=True)
+        column.prop(self, 'var2', slider=True)
+        column.prop(self, 'var3', slider=True)
+        column.prop(self, 'ran')
+        column = layout.column(align=False)
+        column.prop(self, 'num')
+
+    def execute(self, context):
+        obj = bpy.context.object
+        data, om, msv =  obj.data, obj.mode, []
+        msm = bpy.context.tool_settings.mesh_select_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
+        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()
+
+        # 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()
+
+
+        # 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:
+            self.report({'INFO'}, 'Select one or more faces...')
+        return{'FINISHED'}
+
+class BotonME(bpy.types.Panel):
+    bl_label = 'Multi Extrude'
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'TOOLS'
+
+    def draw(self, context):
+        layout = self.layout
+        layout.operator('object.mextrude')
+
+def register():
+    bpy.utils.register_class(MExtrude)
+    bpy.utils.register_class(BotonME)
+
+def unregister():
+    bpy.utils.unregister_class(MExtrude)
+    bpy.utils.unregister_class(BotonME)
+
+if __name__ == '__main__':
+    register()
diff --git a/release/scripts/addons_contrib/mesh_normal_smooth.py b/release/scripts/addons_contrib/mesh_normal_smooth.py
index 304dbeb..f5520ef 100644
--- a/release/scripts/addons_contrib/mesh_normal_smooth.py
+++ b/release/scripts/addons_contrib/mesh_normal_smooth.py
@@ -28,7 +28,7 @@ bl_info = {
     "blender": (2, 5, 7),
     "location": "View3D > Specials > Normal Smooth ",
     "description": "Smooth the vertex position based on the normals",
-    "warning": "",
+    "warning": "Broken",
     "wiki_url": "",
     "tracker_url": "",
     "category": "Mesh"}
@@ -65,10 +65,10 @@ def smoothVert(v1, v1in, me):
     newCo = []
     
     # Make sure there's faces, otherwise we do nothing
-    if len(me.faces):
+    if len(me.polygons):
         
         # Check every face
-        for f in me.faces:
+        for f in me.polygons:
             
             # Only check faces that this vert is in
             if v1in in f.vertices:
diff --git a/release/scripts/addons_contrib/mesh_select_vertex_groups.py b/release/scripts/addons_contrib/mesh_select_vertex_groups.py
index a418160..93a7db6 100644
--- a/release/scripts/addons_contrib/mesh_select_vertex_groups.py
+++ b/release/scripts/addons_contrib/mesh_select_vertex_groups.py
@@ -23,7 +23,7 @@ bl_info = {
     'blender': (2, 5, 9),
     'location': 'Toolbox',
     'description': 'Finds all the vertex groups that chosen verts are in, & any verts that are not in any group',
-    'warning': '', # used for warning icon and text in addons panel
+    'warning': 'Broken', # used for warning icon and text in addons panel
     "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
         "Scripts/Modeling/Select_Vertex_Groups",
     'tracker_url': 'https://projects.blender.org/tracker/index.php?'\
diff --git a/release/scripts/addons_contrib/mesh_show_vgroup_weights.py b/release/scripts/addons_contrib/mesh_show_vgroup_weights.py
new file mode 100644
index 0000000..d077a49
--- /dev/null
+++ b/release/scripts/addons_contrib/mesh_show_vgroup_weights.py
@@ -0,0 +1,468 @@
+# ***** 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 *****
+
+# <pep8 compliant> (Thanks to CodemanX on IRC)
+
+bl_info = {
+    "name": "Show Vertex Groups/Weights",
+    "author": "Jason van Gumster (Fweeb), Bartius Crouch",
+    "version": (0, 7, 1),
+    "blender": (2, 62, 3),
+    "location": "3D View > Properties Region > Show Weights",
+    "description": "Finds the vertex groups of a selected vertex and displays the corresponding weights",
+    "warning": "Requires bmesh",
+    "wiki_url": "http://wiki.blender.org/index.php?title=Extensions:2.6/Py/Scripts/Modeling/Show_Vertex_Group_Weights",
+    "tracker_url": "http://projects.blender.org/tracker/index.php?func=detail&aid=30609&group_id=153&atid=467",
+    "category": "Mesh"}
+
+#TODO - Add button for selecting vertices with no groups
+
+
+import bpy, bmesh, bgl, blf, mathutils
+
+
+# Borrowed/Modified from Bart Crouch's old Index Visualiser add-on
+def calc_callback(self, context):
+    #polling
+    if context.mode != "EDIT_MESH" or len(context.active_object.vertex_groups) == 0:
+        return
+
+    # get color info from theme
+    acol = context.user_preferences.themes[0].view_3d.editmesh_active
+    tcol = (acol[0] * 0.85, acol[1] * 0.85, acol[2] * 0.85)
+    
+    # get screen information
+    mid_x = context.region.width / 2.0
+    mid_y = context.region.height / 2.0
+    width = context.region.width
+    height = context.region.height
+    
+    # get matrices
+    view_mat = context.space_data.region_3d.perspective_matrix
+    ob_mat = context.active_object.matrix_world
+    total_mat = view_mat * ob_mat
+    
+    # calculate location info
+    texts = []
+    locs = []
+    weights  = []
+    me = context.active_object.data
+    bm = bmesh.from_edit_mesh(me)
+    dvert_lay = bm.verts.layers.deform.active
+
+    for v in bm.verts:
+        if v.select: #XXX Should check v.hide here, but it doesn't work
+            if bm.select_mode == {'VERT'} and bm.select_history.active is not None and bm.select_history.active.index == v.index:
+                locs.append([acol[0], acol[1], acol[2], v.index, v.co.to_4d()])
+            else:
+                locs.append([tcol[0], tcol[1], tcol[2], v.index, v.co.to_4d()])
+            dvert = v[dvert_lay]
+            for vgroup in context.active_object.vertex_groups:
+                if vgroup.index in dvert.keys():
+                    weights += [v.index, vgroup.index, dvert[vgroup.index]]
+
+    for loc in locs:
+        vec = total_mat * loc[4] # order is important
+        # dehomogenise
+        vec = mathutils.Vector((vec[0] / vec[3], vec[1] / vec[3], vec[2] / vec[3]))
+        x = int(mid_x + vec[0] * width / 2.0)
+        y = int(mid_y + vec[1] * height / 2.0)
+        texts += [loc[0], loc[1], loc[2], loc[3], x, y, 0]
+
+    # store as ID property in mesh
+    context.active_object.data["show_vgroup_verts"] = texts
+    context.active_object.data["show_vgroup_weights"] = weights
+
+
+# draw in 3d-view
+def draw_callback(self, context):
+    # polling
+    if context.mode != "EDIT_MESH" or len(context.active_object.vertex_groups) == 0:
+        return
+    # retrieving ID property data
+    try:
+        texts = context.active_object.data["show_vgroup_verts"]
+        weights = context.active_object.data["show_vgroup_weights"]
+    except:
+        return
+    if not texts:
+        return
+
+    bm = bmesh.from_edit_mesh(context.active_object.data)
+
+    if bm.select_mode == {'VERT'} and bm.select_history.active is not None:
+        active_vert = bm.select_history.active
+    else:
+        active_vert = None
+
+    # draw
+    blf.size(0, 13, 72)
+    blf.enable(0, blf.SHADOW)
+    blf.shadow(0, 3, 0.0, 0.0, 0.0, 1.0)
+    blf.shadow_offset(0, 2, -2)
+    for i in range(0, len(texts), 7):
+        bgl.glColor3f(texts[i], texts[i+1], texts[i+2])
+        blf.position(0, texts[i+4], texts[i+5], texts[i+6])
+        blf.draw(0, "Vertex " + str(int(texts[i+3])) + ":")
+        font_y = texts[i+5]
+        group_name = ""
+        for j in range(0, len(weights), 3):
+            if int(weights[j]) == int(texts[i+3]):
+                font_y -= 13
+                blf.position(0, texts[i+4] + 10, font_y, texts[i+6])
+                for group in context.active_object.vertex_groups:
+                    if group.index == int(weights[j+1]):
+                        group_name = group.name
+                        break
+                blf.draw(0, group_name + ": %.3f" % weights[j+2])
+        if group_name == "":
+            font_y -= 13
+            blf.position(0, texts[i+4] + 10, font_y, texts[i+6])
+            blf.draw(0, "No Groups")
+
+    # restore defaults
+    blf.disable(0, blf.SHADOW)
+
+
+# operator
+class ShowVGroupWeights(bpy.types.Operator):
+    bl_idname = "view3d.show_vgroup_weights"
+    bl_label = "Show Vertex Group Weights"
+    bl_description = "Toggle the display of the vertex groups and weights for selected vertices"
+    
+    @classmethod
+    def poll(cls, context):
+        return context.mode == 'EDIT_MESH'
+    
+    def __del__(self):
+        bpy.context.scene.display_indices = -1
+        clear_properties(full=False)
+    
+    def modal(self, context, event):
+        if context.area:
+            context.area.tag_redraw()
+
+        # removal of callbacks when operator is called again
+        if context.scene.display_indices == -1:
+            context.region.callback_remove(self.handle1)
+            context.region.callback_remove(self.handle2)
+            context.scene.display_indices = 0
+            return {'CANCELLED'}
+        
+        return {'PASS_THROUGH'}
+    
+    def invoke(self, context, event):
+        if context.area.type == 'VIEW_3D':
+            if context.scene.display_indices < 1:
+                # operator is called for the first time, start everything
+                context.scene.display_indices = 1
+                context.window_manager.modal_handler_add(self)
+                self.handle1 = context.region.callback_add(calc_callback,
+                    (self, context), 'POST_VIEW')
+                self.handle2 = context.region.callback_add(draw_callback,
+                    (self, context), 'POST_PIXEL')
+                return {'RUNNING_MODAL'}
+            else:
+                # operator is called again, stop displaying
+                context.scene.display_indices = -1
+                clear_properties(full=False)
+                return {'RUNNING_MODAL'}
+        else:
+            self.report({"WARNING"}, "View3D not found, can't run operator")
+            return {'CANCELLED'}
+
+
+# properties used by the script
+class InitProperties(bpy.types.Operator):
+    bl_idname = "view3d.init_find_weights"
+    bl_label = "Initialize properties for vgroup weights finder"
+    
+    def execute(self, context):
+        bpy.types.Scene.display_indices = bpy.props.IntProperty(
+            name="Display indices",
+            default=0)
+        context.scene.display_indices = 0
+        return {'FINISHED'}
+
+
+# removal of ID-properties when script is disabled
+def clear_properties(full=True):
+    # can happen on reload
+    if bpy.context.scene is None:
+        return
+    
+    if "show_vgroup_verts" in bpy.context.active_object.data.keys():
+        del bpy.context.active_object.data["show_vgroup_verts"]
+    if "show_vgroup_weights" in bpy.context.active_object.data.keys():
+        del bpy.context.active_object.data["show_vgroup_weights"]
+    if full:
+        props = ["display_indices"]
+        for p in props:
+            if p in bpy.types.Scene.bl_rna.properties:
+                exec("del bpy.types.Scene." + p)
+            if p in bpy.context.scene.keys():
+                del bpy.context.scene[p]
+
+
+class AssignVertexWeight(bpy.types.Operator):
+    bl_idname = "mesh.vertex_group_assign"
+    bl_label = "Assign Weights"
+    bl_description = "Assign weights for all of the groups on a specific vertex"
+
+    vgroup_weights = bpy.props.StringProperty(name = "Vertex Group Weights")
+
+    @classmethod
+    def poll(cls, context):
+        return context.mode == 'EDIT_MESH'
+
+    def execute(self, context):
+        me = context.active_object.data
+        bm = bmesh.from_edit_mesh(me)
+        dvert_lay = bm.verts.layers.deform.active
+        weights = eval(self.vgroup_weights) #XXX Would be nice if I didn't have to use an eval
+
+        for v in bm.verts:
+            if v.index == weights["__index__"]:
+                del weights["__index__"]
+                dvert = v[dvert_lay]
+                for vgroup in dvert.keys():
+                    dvert[vgroup] = weights[vgroup]
+                break
+
+        return {'FINISHED'}
+
+
+class RemoveFromVertexGroup(bpy.types.Operator):
+    bl_idname = "mesh.vertex_group_remove"
+    bl_label = "Remove Vertex from Group"
+    bl_description = "Remove a specific vertex from a specific vertex group"
+
+    #XXX abusing vector props here a bit; the first element is the vert index and the second is the group index
+    vert_and_group = bpy.props.IntVectorProperty(name = "Vertex and Group to remove", size = 2)
+
+    @classmethod
+    def poll(cls, context):
+        return context.mode == 'EDIT_MESH'
+
+    def execute(self, context):
+        ob = context.active_object
+        me = ob.data
+        bm = bmesh.from_edit_mesh(me)
+
+        # Save current selection
+        selected_verts = []
+        for v in bm.verts:
+            if v.select == True:
+                selected_verts.append(v.index)
+                if v.index != self.vert_and_group[0]:
+                    v.select = False
+
+        ob.vertex_groups.active_index = self.vert_and_group[1]
+        bpy.ops.object.vertex_group_remove_from()
+
+        # Re-select vertices
+        for v in bm.verts:
+            if v.index in selected_verts:
+                v.select = True
+
+        #XXX Hacky, but there's no other way to update the UI panels
+        bpy.ops.object.editmode_toggle()
+        bpy.ops.object.editmode_toggle()
+        return {'FINISHED'}
+
+
+class AddToVertexGroup(bpy.types.Operator):
+    bl_idname = "mesh.vertex_group_add"
+    bl_label = "Add Vertex to Group"
+    bl_description = "Add a specific vertex to a specific vertex group"
+
+    def avail_vgroups(self, context):
+        ob = context.active_object
+        bm = bmesh.from_edit_mesh(ob.data)
+        dvert_lay = bm.verts.layers.deform.active
+        items = []
+        self.vertex = bm.select_history.active.index
+
+        dvert = bm.select_history.active[dvert_lay]
+
+        items.append(("-1", "New Vertex Group", "-1", -1))
+
+        for i in ob.vertex_groups:
+            if i.index not in dvert.keys():
+                items.append((i.name, i.name, str(i.index), i.index))
+
+        return items
+
+    vertex = bpy.props.IntProperty()
+    available_vgroups = bpy.props.EnumProperty(items = avail_vgroups, name = "Available Groups")
+
+    @classmethod
+    def poll(cls, context):
+        return context.mode == 'EDIT_MESH'
+
+    def execute(self, context):
+        ob = context.active_object
+        me = ob.data
+        bm = bmesh.from_edit_mesh(me)
+        #print(self.available_vgroups)
+
+        # Save current selection
+        selected_verts = []
+        for v in bm.verts:
+            if v.select == True:
+                selected_verts.append(v.index)
+                if v.index != self.vertex:
+                    v.select = False
+
+        weight = context.tool_settings.vertex_group_weight
+        context.tool_settings.vertex_group_weight = 1.0
+        if self.available_vgroups == "-1":
+            bpy.ops.object.vertex_group_assign(new = True) #XXX Assumes self.vertex is the active vertex
+        else:
+            bpy.ops.object.vertex_group_set_active(group = self.available_vgroups)
+            bpy.ops.object.vertex_group_assign() #XXX Assumes self.vertex is the active vertex
+        context.tool_settings.vertex_group_weight = weight
+
+        # Re-select vertices
+        for v in bm.verts:
+            if v.index in selected_verts:
+                v.select = True
+
+        #XXX Hacky, but there's no other way to update the UI panels
+        bpy.ops.object.editmode_toggle()
+        bpy.ops.object.editmode_toggle()
+        return {'FINISHED'}
+
+
+class PanelShowWeights(bpy.types.Panel):
+    bl_label = "Show Weights"
+    bl_space_type = "VIEW_3D"
+    bl_region_type = "UI"
+
+    @classmethod
+    def poll(cls, context):
+        return context.mode == 'EDIT_MESH'
+
+    def draw(self, context):
+        layout = self.layout
+        ob = context.active_object
+        me = ob.data
+        bm = bmesh.from_edit_mesh(me)
+        dvert_lay = bm.verts.layers.deform.active
+
+        if context.scene.display_indices < 1:
+            layout.operator(ShowVGroupWeights.bl_idname, text = "Show Weights Overlay")
+        else:
+            layout.operator(ShowVGroupWeights.bl_idname, text = "Hide Weights Overlay")
+
+        if len(ob.vertex_groups) > 0:
+            # Active vertex
+            active_vert = bm.select_history.active
+            sub = layout.box()
+            col = sub.column(align = True)
+            if bm.select_mode == {'VERT'} and active_vert is not None:
+                col.label(text = "Active Vertex")
+                row = col.row()
+                row.label(text = "Vertex " + str(active_vert.index) + ":")
+                row.operator_menu_enum("mesh.vertex_group_add", "available_vgroups", text = "Add Group", icon = 'GROUP_VERTEX')
+                has_groups = False
+                vgroup_weights = {}
+
+                for i in me.vertices:
+                    if i.index == active_vert.index:
+                        vgroup_weights["__index__"] = i.index
+                        for j in range(len(i.groups)):
+                            for k in ob.vertex_groups:
+                                if k.index == i.groups[j].group:
+                                    has_groups = True
+                                    split = col.split(percentage = 0.90, align = True)
+                                    vgroup_weights[k.index] = i.groups[j].weight
+                                    row = split.row(align = True)
+                                    row.prop(i.groups[j], "weight", text = k.name, slider = True, emboss = not k.lock_weight)
+                                    row = split.row(align = True)
+                                    row.operator("mesh.vertex_group_remove", text = "R").vert_and_group = (i.index, k.index)
+                
+                if not has_groups:
+                    col.label(text = "    No Groups")
+                else:
+                    col.operator("mesh.vertex_group_assign").vgroup_weights = str(vgroup_weights)
+                layout.separator()
+            else:
+                col.label(text = "No Active Vertex")
+            layout.prop(context.window_manager, "show_vgroups_show_all", toggle = True)
+            # All selected vertices (except for the active vertex)
+            if context.window_manager.show_vgroups_show_all:
+                for v in bm.verts:
+                    if v.select:
+                        if active_vert is not None and v.index == active_vert.index:
+                            continue
+                        sub = layout.box()
+                        col = sub.column(align = True)
+                        col.label(text = "Vertex " + str(v.index) + ":")
+                        has_groups = False
+                        vgroup_weights = {}
+                        for i in me.vertices:
+                            if i.index == v.index:
+                                vgroup_weights["__index__"] = i.index
+                                for j in range(len(i.groups)):
+                                    for k in ob.vertex_groups:
+                                        if k.index == i.groups[j].group:
+                                            has_groups = True
+                                            split = col.split(percentage = 0.90, align = True)
+                                            vgroup_weights[k.index] = i.groups[j].weight
+                                            row = split.row(align = True)
+                                            row.prop(i.groups[j], "weight", text = k.name, slider = True, emboss = not k.lock_weight)
+                                            row = split.row(align = True)
+                                            row.operator("mesh.vertex_group_remove", text = "R").vert_and_group = (i.index, k.index)
+                        if not has_groups:
+                            col.label(text = "    No Groups")
+                        else:
+                            col.operator("mesh.vertex_group_assign").vgroup_weights = str(vgroup_weights)
+        else:
+            layout.label(text = "No Groups")
+
+
+def register():
+    bpy.types.WindowManager.show_vgroups_show_all = bpy.props.BoolProperty(
+        name = "Show All Selected Vertices",
+        description = "Show all vertices with vertex groups assigned to them",
+        default = False)
+    bpy.types.Mesh.assign_vgroup = bpy.props.StringProperty()
+    bpy.utils.register_class(ShowVGroupWeights)
+    bpy.utils.register_class(InitProperties)
+    bpy.ops.view3d.init_find_weights()
+    bpy.utils.register_class(AssignVertexWeight)
+    bpy.utils.register_class(RemoveFromVertexGroup)
+    bpy.utils.register_class(AddToVertexGroup)
+    bpy.utils.register_class(PanelShowWeights)
+    
+
+def unregister():
+    bpy.utils.unregister_class(ShowVGroupWeights)
+    bpy.utils.unregister_class(InitProperties)
+    clear_properties()
+    bpy.utils.unregister_class(AssignVertexWeight)
+    bpy.utils.unregister_class(RemoveFromVertexGroup)
+    bpy.utils.unregister_class(AddToVertexGroup)
+    bpy.utils.unregister_class(PanelShowWeights)
+    del bpy.types.WindowManager.show_vgroups_show_all
+    del bpy.types.Mesh.assign_vgroup
+
+if __name__ == "__main__":
+    register()
diff --git a/release/scripts/addons_contrib/mesh_solidify_wireframe.py b/release/scripts/addons_contrib/mesh_solidify_wireframe.py
new file mode 100644
index 0000000..0fd787d
--- /dev/null
+++ b/release/scripts/addons_contrib/mesh_solidify_wireframe.py
@@ -0,0 +1,271 @@
+# ##### 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": "Solid Wire Frame ALT",
+    "author": "Campbell Barton",
+    "version": (1, 0),
+    "blender": (2, 6, 2),
+    "location": "3D View Toolbar",
+    "description": "Make solid wire",
+    "warning": "",  # used for warning icon and text in addons panel
+    # "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"
+    #             "Scripts/Modeling/Mesh_WireFrane',
+    # "tracker_url": "https://projects.blender.org/tracker/index.php?"
+    #                "func=detail&aid=22929",
+    "category": "Mesh"}
+
+
+import bmesh
+import bpy
+
+
+def add_nor(no_a, no_b):
+    if no_a.dot(no_b) > 0.0:
+        return no_a + no_b
+    else:
+        return no_a - no_b
+
+
+def calc_boundary_tangent(v):
+    e_a, e_b = [e for e in v.link_edges if e.is_boundary][0:2]
+
+    l_a = e_a.link_loops[0]
+    l_b = e_b.link_loops[0]
+
+    # average edge face normal
+    no_face = add_nor(l_a.face.normal, l_b.face.normal)
+
+    # average edge direction
+    v_a = e_a.other_vert(v)
+    v_b = e_b.other_vert(v)
+
+    no_edge = (v_a.co - v.co).normalized() + (v.co - v_b.co).normalized()
+
+    # find the normal
+    no = no_edge.cross(no_face).normalized()
+
+    # check are we flipped the right way
+    ta = e_a.calc_tangent(l_a) + e_b.calc_tangent(l_b)
+    if no.dot(ta) < 0.0:
+        no.negate()
+
+    return no
+
+
+import math
+
+
+def shell_angle_to_dist(angle):
+    return 1.0 if angle < 0.000001 else abs(1.0 / math.cos(angle))
+
+
+# first make 2 verts per vert
+def solid_wire(bm_src, depth=0.01, use_boundary=True, use_even_offset=True):
+    bm_dst = bmesh.new()
+
+    bm_src.verts.index_update()
+
+    inset = depth
+
+    verts_neg = []
+    verts_pos = []
+
+    is_boundary = False
+
+    if use_boundary:
+        verts_boundary = [None] * len(bm_src.verts)
+
+    for v in bm_src.verts:
+        co = v.co
+        no_scale = v.normal * depth
+        verts_neg.append(bm_dst.verts.new(co - no_scale))
+        verts_pos.append(bm_dst.verts.new(co + no_scale))
+
+        if use_boundary:
+            v.tag = False
+            v.select = False
+
+    verts_loop = []
+
+    for f in bm_src.faces:
+        for l in f.loops:
+            l.index = len(verts_loop)
+            in_scale = l.calc_tangent() * inset
+
+            if use_even_offset:
+                in_scale *= shell_angle_to_dist((math.pi - l.calc_angle()) * 0.5)
+
+            verts_loop.append(bm_dst.verts.new(l.vert.co + in_scale))
+
+            # boundary
+            if use_boundary:
+                if l.edge.is_boundary:
+                    for v in (l.vert, l.link_loop_next.vert):
+                        if not v.tag:
+                            is_boundary = True
+                            v.tag = True             # don't copy the vert again
+                            l.edge.tag = False  # we didn't make a face yet
+
+                            v_boundary_tangent = calc_boundary_tangent(v)
+
+                            in_scale = v_boundary_tangent * inset
+
+                            if use_even_offset:
+                                in_scale *= shell_angle_to_dist((math.pi - l.calc_angle()) * 0.5)
+
+                            v_boundary = verts_boundary[v.index] = bm_dst.verts.new(v.co + in_scale)
+
+                            # TODO, make into generic function
+
+    # build faces
+    for f in bm_src.faces:
+        for l in f.loops:
+            l_next = l.link_loop_next
+            v_l1 = verts_loop[l.index]
+            v_l2 = verts_loop[l_next.index]
+
+            v_src_l1 = l.vert
+            v_src_l2 = l_next.vert
+
+            i_1 = v_src_l1.index
+            i_2 = v_src_l2.index
+
+            v_neg1 = verts_neg[i_1]
+            v_neg2 = verts_neg[i_2]
+
+            v_pos1 = verts_pos[i_1]
+            v_pos2 = verts_pos[i_2]
+
+            bm_dst.faces.new((v_l1, v_l2, v_neg2, v_neg1), f)
+            bm_dst.faces.new((v_l2, v_l1, v_pos1, v_pos2), f)
+
+            #
+            if use_boundary:
+
+                if v_src_l1.tag and v_src_l2.tag:
+                    # paranoid check, probably not needed
+                    assert(l.edge.is_boundary)
+
+                    # we know we only touch this edge/face once
+                    v_b1 = verts_boundary[i_1]
+                    v_b2 = verts_boundary[i_2]
+                    bm_dst.faces.new((v_b2, v_b1, v_neg1, v_neg2), f)
+                    bm_dst.faces.new((v_b1, v_b2, v_pos2, v_pos1), f)
+
+    return bm_dst
+
+
+def main(context, kw):
+    scene = bpy.context.scene
+    obact = scene.objects.active
+    me = bpy.data.meshes.new(name=obact.name)
+    ob = bpy.data.objects.new(me.name, me)
+    scene.objects.link(ob)
+    # scene.objects.active = ob
+
+    # can work but messes with undo
+    '''
+    if ob.mode == 'EDIT':
+        bm_src = bmesh.from_edit_mesh(obact.data)
+    else:
+    '''
+    if 1:
+        bm_src = bmesh.new()
+        bm_src.from_mesh(obact.data)
+
+    bm_dst = solid_wire(bm_src,
+                        depth=kw["thickness"],
+                        use_boundary=kw["use_boundary"],
+                        use_even_offset=kw["use_even_offset"])
+    bm_src.free()
+
+    bm_dst.to_mesh(me)
+
+    # copy some settings.
+    ob.matrix_world = obact.matrix_world
+    ob.layers = obact.layers
+    scene.objects.active = ob
+    ob.select = True
+    obact.select = False
+
+
+# ----------------------------------------------------------------------------
+# boiler plate code from here on
+
+from bpy.types import Operator, Panel
+from bpy.props import BoolProperty, FloatProperty
+
+
+class SolidWireFrameOperator(Operator):
+    ''''''
+    bl_idname = "mesh.solid_wire_frame"
+    bl_label = "Solid Wireframe"
+    bl_options = {'REGISTER', 'UNDO'}
+
+    thickness = FloatProperty(
+            name="Value",
+            description="Assignment value",
+            default=0.05,
+            min=0.0, max=100.0,
+            soft_min=0.0, soft_max=1.0,
+            )
+
+    use_boundary = BoolProperty(
+            description="Add wire to boundary faces",
+            default=True,
+            )
+
+    use_even_offset = BoolProperty(
+            description="Use even calculations",
+            default=True,
+            )
+
+    def execute(self, context):
+        main(context, self.as_keywords())
+        return {'FINISHED'}
+
+
+class VIEW3D_PT_solid_wire(Panel):
+    bl_space_type = "VIEW_3D"
+    bl_region_type = "TOOLS"
+    bl_label = "Solid Wire"
+
+    def draw(self, context):
+        self.layout.operator(SolidWireFrameOperator.bl_idname)
+
+
+'''
+def menu_func(self, context):
+    self.layout.operator(SolidWireFrameOperator.bl_idname)
+'''
+
+
+def register():
+    bpy.utils.register_module(__name__)
+
+    # bpy.types.VIEW3D_MT_edit_mesh_faces.append(menu_func)
+
+
+def unregister():
+    bpy.utils.unregister_module(__name__)
+
+    # bpy.types.VIEW3D_MT_edit_mesh_faces.remove(menu_func)
+
+if __name__ == "__main__":
+    register()
diff --git a/release/scripts/addons_contrib/mesh_vertex_slide.py b/release/scripts/addons_contrib/mesh_vertex_slide.py
index fcaf542..796d302 100644
--- a/release/scripts/addons_contrib/mesh_vertex_slide.py
+++ b/release/scripts/addons_contrib/mesh_vertex_slide.py
@@ -19,13 +19,13 @@
 # <pep8 compliant>
 
 bl_info = {
-    "name": "Vertex slide",
+    "name": "Vertex slide for Bmesh",
     "author": "Valter Battioli (ValterVB) and PKHG",
-    "version": (1, 1, 6),
-    "blender": (2, 6, 0),
+    "version": (2, 0, 0),
+    "blender": (2, 6, 2),
     "location": "View3D > Mesh > Vertices (CTRL V-key)",
     "description": "Slide a vertex along an edge or a line",
-    "warning": "",
+    "warning": "Work only with Blender 2.62 or higher",
     "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
         "Scripts/Modeling/Vertex_Slide2",
     "tracker_url": "http://projects.blender.org/tracker/index.php?"\
@@ -60,48 +60,49 @@ bl_info = {
 #ver. 1.1.5: Changed Lay out of the Help and the Key for reverse the 
 #            movement. Left/Right arrow rather than Pus/Minus numpad
 #ver. 1.1.6: Now the vertex movement is always coherent with Mouse movement
+#ver. 2.0.0: Update to Bmesh and remove all mode switching
+#ver. 2.0.1: Replaced Conv3DtoScreen2D function with location_3d_to_region_2d
+#ver. 2.0.2: Fix crash if there are some duplicate vertices
 #***********************************************************************
 
 import bpy
+import bmesh
 import bgl
 import blf
 from mathutils import Vector
 from bpy_extras.view3d_utils import location_3d_to_region_2d as loc3d2d
 
-
 # Equation of the line
 # Changing t we have a new point coordinate on the line along v0 v1
 # With t from 0 to 1  I move from v0 to v1
 def NewCoordinate(v0, v1, t):
     return v0 + t * (v1 - v0)
-
-
+    
 #  This class store Vertex data
 class Point():
     def __init__(self):
         self.original = self.Vertex()  # Original position
         self.new = self.Vertex()  # New position
         self.t = 0  # Used for move the vertex
-        self.x2D = 0  # Screen 2D cooord
-        self.y2D = 0  # Screen 2D cooord
+        self.x2D = 0  # Screen 2D cooord of the point
+        self.y2D = 0  # Screen 2D cooord of the point
         self.selected = False
 
     class Vertex():
         def __init__(self):
             self.co = None
             self.idx = None
-
-
-class VertexSlideOperator(bpy.types.Operator):
+            
+class BVertexSlideOperator(bpy.types.Operator):
     bl_idname = "vertex.slide"
     bl_label = "Vertex Slide"
     bl_options = {'REGISTER', 'UNDO', 'GRAB_POINTER', 'BLOCKING', 'INTERNAL'}
 
     Vertex1 = Point()  # First selected vertex data
-    LinkedVertices1 = []  # List of index of linked vertices of Vertex1
+    LinkedVertices1 = []  # List of index of linked verts of Vertex1
     Vertex2 = Point()  # Second selected vertex data
-    LinkedVertices2 = []  # List of index of linked vertices of Vertex2
-    ActiveVertex = None
+    LinkedVertices2 = []  # List of index of linked verts of Vertex2
+    ActiveVertex = None  # Index of vertex to be moved
     tmpMouse_x = 0
     tmpMouse = Vector((0, 0))
     Direction = 1.0  # Used for direction and precision of the movement
@@ -109,34 +110,13 @@ class VertexSlideOperator(bpy.types.Operator):
     VertLinkedIdx = 0  # Index of LinkedVertices1. Used only for 1 vertex select case
     LeftAltPress = False  # Flag to know if ALT is hold on
     LeftShiftPress = False  # Flag to know if SHIFT is hold on
+    obj = None  # Object
+    mesh = None  # Mesh
+    bm = None  # BMesh
 
-    # Convert a 3D coord to screen 2D coord
-    def Conv3DtoScreen2D(self, context, index):  # ^^^ could this function be replaced by bpy_extras.view3d_utils.location_3d_to_region_2d ?
-        # Get screen information
-        mid_x = context.region.width / 2.0
-        mid_y = context.region.height / 2.0
-        width = context.region.width
-        height = context.region.height
-
-        # Get matrices
-        view_mat = context.space_data.region_3d.perspective_matrix
-        ob_mat = context.active_object.matrix_world
-        total_mat = view_mat * ob_mat
-
-        Vertices = bpy.context.object.data.vertices
-        loc = Vertices[index].co.to_4d()  # Where I want draw
-
-        vec = total_mat * loc
-        if vec[3] != 0:
-            vec = vec / vec[3]
-        else:
-            vec = vec
-        x = int(mid_x + vec[0] * width / 2.0)
-        y = int(mid_y + vec[1] * height / 2.0)
-        return x, y
-
+    # OpenGL Function to draw on the screen help and pointer *
     def draw_callback_px(self, context):
-        x, y = self.Conv3DtoScreen2D(context, self.ActiveVertex)
+        x, y = loc3d2d(context.region, context.space_data.region_3d, self.bm.verts[self.ActiveVertex].co)
 
         # Draw an * at the active vertex
         blf.position(0, x, y, 0)
@@ -178,7 +158,6 @@ class VertexSlideOperator(bpy.types.Operator):
             bgl.glVertex2f(p.x2D, p.y2D)
         bgl.glEnd()
 
-
     # Compute the screen distance of two vertices
     def ScreenDistance(self, vertex_zero_co, vertex_one_co):
         matw = bpy.context.active_object.matrix_world
@@ -191,9 +170,8 @@ class VertexSlideOperator(bpy.types.Operator):
 
     def modal(self, context, event):
         if event.type == 'MOUSEMOVE':
-            bpy.ops.object.mode_set(mode='OBJECT')
-            Vertices = bpy.context.object.data.vertices
-            # Calculate the temp t valuse. Stored in td
+            Vertices = self.bm.verts
+            # Calculate the temp t value. Stored in td
             tmpMouse = Vector((event.mouse_x, event.mouse_y))
             t_diff = (tmpMouse - self.tmpMouse).length
             self.tmpMouse = tmpMouse
@@ -236,22 +214,45 @@ class VertexSlideOperator(bpy.types.Operator):
                                                                            self.LinkedVertices1[self.VertLinkedIdx].t)
                 self.ActiveVertex = self.Vertex1.original.idx
             self.tmpMouse_x = event.mouse_x
-            bpy.ops.object.mode_set(mode='EDIT')
+            context.area.tag_redraw()
+
+        elif event.type == 'LEFT_SHIFT':  # Hold left SHIFT for precision
+            self.LeftShiftPress = not self.LeftShiftPress
+            if self.LeftShiftPress:
+                self.Direction *= 0.1
+            else:
+                if self.Direction < 0:
+                    self.Direction = -1
+                else:
+                    self.Direction = 1
+
+        elif event.type == 'LEFT_ALT':  # Hold ALT to use continuous slide
+            self.LeftAltPress = not self.LeftAltPress
+            if self.LeftAltPress and self.Vertex2.original.idx is None:
+                vert = self.bm.verts[self.Vertex1.original.idx]
+                self.Vertex2.original.co = Vector((vert.co.x, vert.co.y, vert.co.z))
+                self.Vertex2.t = 0
+
+        elif event.type == 'LEFT_ARROW':  # Reverse direction
+            if self.Direction < 0.0:
+                self.Direction = - self.Direction
+
+        elif event.type == 'RIGHT_ARROW':  # Restore direction
+            if self.Direction > 0.0:
+                self.Direction = - self.Direction
 
         elif event.type == 'WHEELDOWNMOUSE':  # Change the vertex to be moved
             if self.Vertex2.original.idx is None:
                 if self.LeftAltPress:
-                    vert = bpy.context.object.data.vertices[self.Vertex1.original.idx]
+                    vert=self.bm.verts[self.Vertex1.original.idx]
                     self.Vertex2.original.co = Vector((vert.co.x, vert.co.y, vert.co.z))
                     self.Vertex2.t = 0
                 self.VertLinkedIdx = self.VertLinkedIdx + 1
                 if self.VertLinkedIdx > len(self.LinkedVertices1) - 1:
                     self.VertLinkedIdx = 0
                 bpy.ops.mesh.select_all(action='DESELECT')
-                bpy.ops.object.mode_set(mode='OBJECT')
-                bpy.context.object.data.vertices[self.Vertex1.original.idx].select = True
-                bpy.context.object.data.vertices[self.LinkedVertices1[self.VertLinkedIdx].original.idx].select = True
-                bpy.ops.object.mode_set(mode='EDIT')
+                self.bm.verts[self.Vertex1.original.idx].select = True
+                self.bm.verts[self.LinkedVertices1[self.VertLinkedIdx].original.idx].select = True
             else:
                 self.FirstVertexMove = not self.FirstVertexMove
                 if self.LeftAltPress == False:
@@ -264,18 +265,18 @@ class VertexSlideOperator(bpy.types.Operator):
             # Keep Vertex movement coherent with Mouse movement
             if self.Vertex2.original.idx is not None:
                 if self.FirstVertexMove: 
-                    tmpX1, tmpY1 = self.Conv3DtoScreen2D(context, self.Vertex1.original.idx)
-                    tmpX2, tmpY2 = self.Conv3DtoScreen2D(context, self.Vertex2.original.idx)
+                    tmpX1, tmpY1 = loc3d2d(context.region, context.space_data.region_3d, self.Vertex1.original.co)
+                    tmpX2, tmpY2 = loc3d2d(context.region, context.space_data.region_3d, self.Vertex2.original.co)
                     if ((tmpX1 > tmpX2 and self.Direction >= 0) or (tmpX2 > tmpX1 and self.Direction >= 0)):
                         self.Direction = -self.Direction
                 else:
-                    tmpX1, tmpY1 = self.Conv3DtoScreen2D(context, self.Vertex2.original.idx)
-                    tmpX2, tmpY2 = self.Conv3DtoScreen2D(context, self.Vertex1.original.idx)
+                    tmpX1, tmpY1 = loc3d2d(context.region, context.space_data.region_3d, self.Vertex2.original.co)
+                    tmpX2, tmpY2 = loc3d2d(context.region, context.space_data.region_3d, self.Vertex1.original.co)
                     if (tmpX1 < tmpX2 and self.Direction < 0) or (tmpX2 < tmpX1 and self.Direction >= 0):
                         self.Direction = -self.Direction
             else:
-                tmpX1, tmpY1 = self.Conv3DtoScreen2D(context, self.Vertex1.original.idx)
-                tmpX2, tmpY2 = self.Conv3DtoScreen2D(context, self.LinkedVertices1[self.VertLinkedIdx].original.idx)
+                tmpX1, tmpY1 = loc3d2d(context.region, context.space_data.region_3d, self.Vertex1.original.co)
+                tmpX2, tmpY2 = loc3d2d(context.region, context.space_data.region_3d, self.LinkedVertices1[self.VertLinkedIdx].original.co)
                 if ((tmpX1 > tmpX2 and self.Direction >= 0) or (tmpX2 > tmpX1 and self.Direction < 0)):
                     self.Direction = -self.Direction
             context.area.tag_redraw()
@@ -283,17 +284,15 @@ class VertexSlideOperator(bpy.types.Operator):
         elif event.type == 'WHEELUPMOUSE':  # Change the vertex to be moved
             if self.Vertex2.original.idx is None:
                 if self.LeftAltPress:
-                    vert = bpy.context.object.data.vertices[self.Vertex1.original.idx]
+                    vert = self.bm.verts[self.Vertex1.original.idx]
                     self.Vertex2.original.co = Vector((vert.co.x, vert.co.y, vert.co.z))
                     self.Vertex2.t = 0
                 self.VertLinkedIdx = self.VertLinkedIdx - 1
                 if self.VertLinkedIdx < 0:
                     self.VertLinkedIdx = len(self.LinkedVertices1) - 1
                 bpy.ops.mesh.select_all(action='DESELECT')
-                bpy.ops.object.mode_set(mode='OBJECT')
-                bpy.context.object.data.vertices[self.Vertex1.original.idx].select = True
-                bpy.context.object.data.vertices[self.LinkedVertices1[self.VertLinkedIdx].original.idx].select = True
-                bpy.ops.object.mode_set(mode='EDIT')
+                self.bm.verts[self.Vertex1.original.idx].select = True
+                self.bm.verts[self.LinkedVertices1[self.VertLinkedIdx].original.idx].select = True
             else:
                 self.FirstVertexMove = not self.FirstVertexMove
                 if self.LeftAltPress == False:
@@ -306,68 +305,40 @@ class VertexSlideOperator(bpy.types.Operator):
             # Keep Vertex movement coherent with Mouse movement
             if self.Vertex2.original.idx is not None:
                 if self.FirstVertexMove: 
-                    tmpX1, tmpY1 = self.Conv3DtoScreen2D(context, self.Vertex1.original.idx)
-                    tmpX2, tmpY2 = self.Conv3DtoScreen2D(context, self.Vertex2.original.idx)
+                    tmpX1, tmpY1 = loc3d2d(context.region, context.space_data.region_3d, self.Vertex1.original.co)
+                    tmpX2, tmpY2 = loc3d2d(context.region, context.space_data.region_3d, self.Vertex2.original.co)
                     if ((tmpX1 > tmpX2 and self.Direction >= 0) or (tmpX2 > tmpX1 and self.Direction >= 0)):
                         self.Direction = -self.Direction
                 else:
-                    tmpX1, tmpY1 = self.Conv3DtoScreen2D(context, self.Vertex2.original.idx)
-                    tmpX2, tmpY2 = self.Conv3DtoScreen2D(context, self.Vertex1.original.idx)
+                    tmpX1, tmpY1 = loc3d2d(context.region, context.space_data.region_3d, self.Vertex2.original.co)
+                    tmpX2, tmpY2 = loc3d2d(context.region, context.space_data.region_3d, self.Vertex1.original.co)
                     if (tmpX1 < tmpX2 and self.Direction < 0) or (tmpX2 < tmpX1 and self.Direction >= 0):
                         self.Direction = -self.Direction
             else:
-                tmpX1, tmpY1 = self.Conv3DtoScreen2D(context, self.Vertex1.original.idx)
-                tmpX2, tmpY2 = self.Conv3DtoScreen2D(context, self.LinkedVertices1[self.VertLinkedIdx].original.idx)
+                tmpX1, tmpY1 = loc3d2d(context.region, context.space_data.region_3d, self.Vertex1.original.co)
+                tmpX2, tmpY2 = loc3d2d(context.region, context.space_data.region_3d, self.LinkedVertices1[self.VertLinkedIdx].original.co)
                 if ((tmpX1 > tmpX2 and self.Direction >= 0) or (tmpX2 > tmpX1 and self.Direction < 0)):
                     self.Direction = -self.Direction
             context.area.tag_redraw()
 
-        elif event.type == 'LEFT_SHIFT':  # Hold left SHIFT for precision
-            self.LeftShiftPress = not self.LeftShiftPress
-            if self.LeftShiftPress:
-                self.Direction *= 0.1
-            else:
-                if self.Direction < 0:
-                    self.Direction = -1
-                else:
-                    self.Direction = 1
-
-        elif event.type == 'LEFT_ALT':  # Hold ALT to use continuous slide
-            self.LeftAltPress = not self.LeftAltPress
-            if self.LeftAltPress and self.Vertex2.original.idx is None:
-                vert = bpy.context.object.data.vertices[self.Vertex1.original.idx]
-                self.Vertex2.original.co = Vector((vert.co.x, vert.co.y, vert.co.z))
-                self.Vertex2.t = 0
-
-        elif event.type == 'LEFT_ARROW':  # Reverse direction
-            if self.Direction < 0.0:
-                self.Direction = - self.Direction
-
-        elif event.type == 'RIGHT_ARROW':  # Restore direction
-            if self.Direction > 0.0:
-                self.Direction = - self.Direction
-
         elif event.type == 'LEFTMOUSE':  # Confirm and exit
-            Vertices = bpy.context.object.data.vertices
+            Vertices = self.bm.verts
             bpy.ops.mesh.select_all(action='DESELECT')
-            bpy.ops.object.mode_set(mode='OBJECT')
             Vertices[self.Vertex1.original.idx].select = True
             if self.Vertex2.original.idx is not None:
                 Vertices[self.Vertex2.original.idx].select = True
-            bpy.ops.object.mode_set(mode='EDIT')
             context.region.callback_remove(self._handle)
+            context.area.tag_redraw()
             return {'FINISHED'}
 
         elif event.type in {'RIGHTMOUSE', 'ESC'}:  # Restore and exit
-            Vertices = bpy.context.object.data.vertices
+            Vertices = self.bm.verts
             bpy.ops.mesh.select_all(action='DESELECT')
-            bpy.ops.object.mode_set(mode='OBJECT')
             Vertices[self.Vertex1.original.idx].co = self.Vertex1.original.co
             Vertices[self.Vertex1.original.idx].select = True
             if self.Vertex2.original.idx is not None:
                 Vertices[self.Vertex2.original.idx].co = self.Vertex2.original.co
                 Vertices[self.Vertex2.original.idx].select = True
-            bpy.ops.object.mode_set(mode='EDIT')
             context.region.callback_remove(self._handle)
             context.area.tag_redraw()
             return {'CANCELLED'}
@@ -376,27 +347,31 @@ class VertexSlideOperator(bpy.types.Operator):
 
     def invoke(self, context, event):
         if context.active_object == None or context.active_object.type != "MESH":
-            print("Not any active object or not an mesh object:")
             self.report({'WARNING'}, "Not any active object or not an mesh object:")
             return {'CANCELLED'}
 
-        obj = bpy.context.object
-        mesh = obj.data
-        Selected = False
-        Count = 0
+        if context.active_object.mode != 'EDIT':
+            self.report({'WARNING'}, "Mesh isn't in Edit Mode")
+            return {'CANCELLED'}
+        
+        self.obj = bpy.context.object
+        self.mesh = self.obj.data
+        self.bm = bmesh.from_edit_mesh(self.mesh)
+
+        Count=0
+        Selected=False
         SelectedVertices = []  # Index of selected vertices
-        bpy.ops.object.mode_set(mode='OBJECT')
-        for vert in mesh.vertices:
-            if vert.select:
+        for i, v in enumerate(self.bm.verts):
+            if v.select and v.is_valid:
+                SelectedVertices.append(v.index)
                 Selected = True
-                SelectedVertices.append(vert.index)
-                Count += 1
+                Count += 1 
                 if (Count > 2):  # More than 2 vertices selected
                     Selected = False
                     break
+
         if Selected == False:
             self.report({'WARNING'}, "0 or more then 2 vertices selected, could not start")
-            bpy.ops.object.mode_set(mode='EDIT')
             return {'CANCELLED'}
 
         self.tmpMouse[0], self.tmpMouse[1] = (event.mouse_x, event.mouse_y)
@@ -407,91 +382,80 @@ class VertexSlideOperator(bpy.types.Operator):
         self.LinkedVertices1 = []
         self.LinkedVertices2 = []
 
-        # Store selected vertices data
+        # Store selected vertices data. To move in the first Loop
         self.Vertex1.original.idx = SelectedVertices[0]
-        self.Vertex1.original.co = mesh.vertices[SelectedVertices[0]].co.copy()
+        self.Vertex1.original.co = self.bm.verts[SelectedVertices[0]].co.copy()
         self.Vertex1.new = self.Vertex1.original
-        x, y = self.Conv3DtoScreen2D(context, SelectedVertices[0])  # For draw edge
+        x, y = loc3d2d(context.region, context.space_data.region_3d, self.bm.verts[SelectedVertices[0]].co)  # For draw edge
         self.Vertex1.x2D = x
         self.Vertex1.y2D = y
         if len(SelectedVertices) == 2:
             self.Vertex2.original.idx = SelectedVertices[1]
-            self.Vertex2.original.co = mesh.vertices[SelectedVertices[1]].co.copy()
+            self.Vertex2.original.co = self.bm.verts[SelectedVertices[1]].co.copy()
             self.Vertex2.new = self.Vertex2.original
-            x, y = self.Conv3DtoScreen2D(context, SelectedVertices[1])  # For draw edge
+            x, y = loc3d2d(context.region, context.space_data.region_3d, self.bm.verts[SelectedVertices[1]].co)  # For draw edge
             self.Vertex2.x2D = x
             self.Vertex2.y2D = y
 
         if len(SelectedVertices) == 2:
-            mesh.vertices[self.Vertex2.original.idx].select = False  # Unselect the second selected vertex
-        
+            self.bm.verts[self.Vertex2.original.idx].select = False  # Unselect the second selected vertex
+
         # Store linked vertices data, except the selected vertices
-        bpy.ops.object.mode_set(mode='EDIT')
-        bpy.ops.mesh.select_more()  # Select the linked vertices
-        bpy.ops.object.mode_set(mode='OBJECT')
-        mesh.vertices[self.Vertex1.original.idx].select = False  #So are selected only the linked vertices
-        for vert in mesh.vertices:
-            if vert.select:
-                self.LinkedVertices1.append(Point())
-                self.LinkedVertices1[-1].original.idx = vert.index
-                self.LinkedVertices1[-1].original.co = vert.co.copy()
-                self.LinkedVertices1[-1].new = self.LinkedVertices1[-1].original
-                x, y = self.Conv3DtoScreen2D(context, vert.index)  # For draw edge
-                self.LinkedVertices1[-1].x2D = x
-                self.LinkedVertices1[-1].y2D = y
-                vert.select = False
+        for i, vert in enumerate(self.bm.verts[self.Vertex1.original.idx].link_edges):
+            self.LinkedVertices1.append(Point())
+            self.LinkedVertices1[-1].original.idx = vert.other_vert(self.bm.verts[self.Vertex1.original.idx]).index   #e_0.other_vert(v_0).index
+            self.LinkedVertices1[-1].original.co = vert.other_vert(self.bm.verts[self.Vertex1.original.idx]).co.copy()
+            self.LinkedVertices1[-1].new = self.LinkedVertices1[-1].original
+            x, y = loc3d2d(context.region, context.space_data.region_3d, vert.other_vert(self.bm.verts[self.Vertex1.original.idx]).co)  # For draw edge
+            self.LinkedVertices1[-1].x2D = x
+            self.LinkedVertices1[-1].y2D = y
         if len(SelectedVertices) == 2:
-            mesh.vertices[self.Vertex2.original.idx].select = True  # Select the second selected vertex
-            bpy.ops.object.mode_set(mode='EDIT')
-            bpy.ops.mesh.select_more()  # Select the linked vertices
-            bpy.ops.object.mode_set(mode='OBJECT')
-            mesh.vertices[self.Vertex2.original.idx].select = False  #So are selected only the linked vertices
-            for vert in mesh.vertices:
-                if vert.select:
-                    self.LinkedVertices2.append(Point())
-                    self.LinkedVertices2[-1].original.idx = vert.index
-                    self.LinkedVertices2[-1].original.co = vert.co.copy()
-                    self.LinkedVertices2[-1].new = self.LinkedVertices1[-1].original
-                    x, y = self.Conv3DtoScreen2D(context, vert.index)  # For draw edge
-                    self.LinkedVertices2[-1].x2D = x
-                    self.LinkedVertices2[-1].y2D = y
-                    vert.select = False
+            for i, vert in enumerate(self.bm.verts[self.Vertex2.original.idx].link_edges):
+                self.LinkedVertices2.append(Point())
+                self.LinkedVertices2[-1].original.idx = vert.other_vert(self.bm.verts[self.Vertex2.original.idx]).index
+                self.LinkedVertices2[-1].original.co = vert.other_vert(self.bm.verts[self.Vertex2.original.idx]).co.copy()
+                self.LinkedVertices2[-1].new = self.LinkedVertices1[-1].original
+                x, y = loc3d2d(context.region, context.space_data.region_3d, vert.other_vert(self.bm.verts[self.Vertex2.original.idx]).co)  # For draw edge
+                self.LinkedVertices2[-1].x2D = x
+                self.LinkedVertices2[-1].y2D = y
 
         # Check for no linked vertex. Can be happen also with a mix of Select Mode
         # Need only with 1 vertex selected
         if len(SelectedVertices) == 1 and len(self.LinkedVertices1) == 0:
-            bpy.ops.object.mode_set(mode='EDIT')
             self.report({'WARNING'}, "Isolated vertex or mixed Select Mode!")
             return {'CANCELLED'}
-
-        mesh.vertices[self.Vertex1.original.idx].select = True  # Select the firs selected vertex
+        # Check for duplicate vertices. If some linked vertice have the same coords of selected vertice
+        # we have the error "division by 0
+        if self.Vertex1.original.co == self.Vertex2.original.co:
+            self.report({'WARNING'}, "At least one duplicate vertex")
+            return {'CANCELLED'}
+            
+        self.bm.verts[self.Vertex1.original.idx].select = True  # Select the first selected vertex
         if len(SelectedVertices) == 2:
-            mesh.vertices[self.Vertex2.original.idx].select = True  # Select the second selected vertex
+            self.bm.verts[self.Vertex2.original.idx].select = True  # Select the second selected vertex
         else:
-            mesh.vertices[self.LinkedVertices1[0].original.idx].select = True  # Select the first linked vertex
+            self.bm.verts[self.LinkedVertices1[0].original.idx].select = True  # Select the first linked vertex
         self.ActiveVertex = self.Vertex1.original.idx
 
         # Keep Vertex movement coherent with Mouse movement
-        tmpX1, tmpY1 = self.Conv3DtoScreen2D(context, self.Vertex1.original.idx)
+        tmpX1, tmpY1 = loc3d2d(context.region, context.space_data.region_3d, self.Vertex1.original.co)
         if len(SelectedVertices) == 2:
-            tmpX2, tmpY2 = self.Conv3DtoScreen2D(context, self.Vertex2.original.idx)
+            tmpX2, tmpY2 = loc3d2d(context.region, context.space_data.region_3d, self.Vertex2.original.co)
         else:
-            tmpX2, tmpY2 = self.Conv3DtoScreen2D(context, self.LinkedVertices1[0].original.idx)
+            tmpX2, tmpY2 = loc3d2d(context.region, context.space_data.region_3d, self.LinkedVertices1[0].original.co)
         if tmpX2 - tmpX1 < 0:
             self.Direction = -self.Direction
-        bpy.ops.object.mode_set(mode='EDIT')  #I must stay in Edit mode
 
         # Add the region OpenGL drawing callback
         # draw in view space with 'POST_VIEW' and 'PRE_VIEW'
         context.window_manager.modal_handler_add(self)
         self._handle = context.region.callback_add(self.__class__.draw_callback_px, (self, context), 'POST_PIXEL')
-        context.area.tag_redraw()
+        context.area.tag_redraw()  # Force the redraw of the 3D View
         return {'RUNNING_MODAL'}
 
-
 def menu_func(self, context):
     self.layout.operator_context = "INVOKE_DEFAULT"
-    self.layout.operator(VertexSlideOperator.bl_idname, text="Vertex Slide")
+    self.layout.operator(BVertexSlideOperator.bl_idname, text="Vertex Slide Bmesh")
 
 
 def register():
diff --git a/release/scripts/addons_contrib/object_drop_to_ground.py b/release/scripts/addons_contrib/object_drop_to_ground.py
index f9b93f1..471a0a6 100644
--- a/release/scripts/addons_contrib/object_drop_to_ground.py
+++ b/release/scripts/addons_contrib/object_drop_to_ground.py
@@ -16,214 +16,166 @@
 #
 # ##### END GPL LICENSE BLOCK #####
 bl_info = {
-    "name": "Drop to ground",
-    "author": "Unnikrishnan(kodemax), Florian Meyer(testscreenings)",
-    "version": (1, 1),
-    "blender": (2, 5, 9),
-    "location": "Tool shelf",
-    "description": "Drops the selected objects to the active object",
-    "warning": "Before using it do :- ctrl+a -> apply rotation on the object to be dropped",
-    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/Scripts/Object/Drop_to_ground",
+    'name': 'Drop to Ground',
+    'author': 'Unnikrishnan(kodemax), Florian Meyer(testscreenings)',
+    'version': (1,2),
+    "blender": (2, 6, 3),
+    'location': '3D View -> Tool Shelf -> Object Tools Panel (at the bottom)',
+    'description': 'Drop selected objects on active object',
+    'warning': '',
+    'wiki_url': 'http://wiki.blender.org/index.php/Extensions:2.5/Py/Scripts/Object/Drop_to_ground',
     "tracker_url": "http://projects.blender.org/tracker/?func=detail&atid=467&aid=25349",
-    "category": "Object"}
- 
-import bpy , random
+    'category': 'Object'}
+#################################################################
+import bpy, bmesh
+from mathutils import *
+from bpy.types import Operator
 from bpy.props import *
-import mathutils
-import math
- 
+#################################################################
 def get_align_matrix(location, normal):
-    up = mathutils.Vector((0,0,1))                      
+    up = Vector((0,0,1))                      
     angle = normal.angle(up)
     axis = up.cross(normal)                            
-    mat_rot = mathutils.Matrix.Rotation(angle, 4, axis) 
-    mat_loc = mathutils.Matrix.Translation(location)
+    mat_rot = Matrix.Rotation(angle, 4, axis) 
+    mat_loc = Matrix.Translation(location)
     mat_align = mat_rot * mat_loc                      
     return mat_align
 
-
-def get_lowest_Coord1(ob):
-    matrix = ob.matrix_world.copy()
-    verts = ob.data.vertices
-    lowest = mathutils.Vector((0,0,10000))
-    for vert in verts:
-        if (matrix * vert.co).z < lowest.z:
-            lowest = matrix * vert.co
-    return lowest
-
-
-def do_drop(context,tmpObj, ob):
-    print('\n', ob.name)
-    align_object = context.scene.align_object
-    use_center = context.scene.use_center
-    lowest = get_lowest_Coord1(ob)
-    location, normal, index = tmpObj.ray_cast(lowest, lowest + mathutils.Vector((0,0,-10000)))
-        
-    if not index == -1:
-        if not use_center:
-            temp = (bpy.context.scene.cursor_location).copy()
-            bpy.context.scene.cursor_location = lowest
-            bpy.ops.object.origin_set(type = 'ORIGIN_CURSOR')
-            
-        if align_object:
-            sca = ob.scale.copy()
-            mat_align = get_align_matrix(location, normal)
-            ob.matrix_world = mat_align
-            ob.scale = sca 
-            
-        else:
-            ob.location = location
-         
-        
-        if not use_center:
-            bpy.context.scene.cursor_location = temp
-            bpy.ops.object.origin_set(type = 'ORIGIN_GEOMETRY')
-   
-    else:
-        print('\nno hit')
-        return    
-
-# compute randomisation based on the general or specific percentage chosen
-# if the specific percentage is zero then the general percentage is used
-def compute_percentage(min,max,value,percentage):
-    range = max-min
-    general_percentage = 100
-    
-    if percentage == 0:
-        percentage_random = ( value -((range*(general_percentage/100))/2) )+ (range * (general_percentage / 100) * random.random())
-    else:
-        percentage_random = ( value - ((range*(percentage/100))/2)) + (range * (percentage / 100) * random.random())
-         
-    if percentage_random > max:
-        percentage_random = max
-    if percentage_random < min:
-        percentage_random = min
-    
-    return percentage_random 
-
-def main(self, context):
-
-    print('\n_______START__________')
-    obs = bpy.context.selected_objects
-    ground = bpy.context.active_object
-    obs.remove(ground)
-    context = bpy.context
-    sc = context.scene
-
-
+def transform_ground_to_world(sc, ground):
     tmpMesh = ground.to_mesh(sc, True, 'PREVIEW')
     tmpMesh.transform(ground.matrix_world)
-    tmpObj = bpy.data.objects.new('tmpGround', tmpMesh)
-    """tmpObj.update(sc, 1, 1, 1)"""
-    sc.objects.link(tmpObj)
+    tmp_ground = bpy.data.objects.new('tmpGround', tmpMesh)
+    sc.objects.link(tmp_ground)
     sc.update()
-
+    return tmp_ground
+
+def get_lowest_world_co_from_mesh(ob, mat_parent=None):
+    bme = bmesh.new()
+    bme.from_object(ob)
+    mat_to_world = ob.matrix_world.copy()
+    if mat_parent:
+        mat_to_world = mat_parent * mat_to_world
+    lowest=None
+    #bme.verts.index_update() #probably not needed
+    for v in bme.verts:
+        if not lowest:
+            lowest = v
+        if (mat_to_world * v.co).z < (mat_to_world * lowest.co).z:
+            lowest = v
+    lowest_co = mat_to_world * lowest.co
+    bme.free()
+    return lowest_co
+
+def get_lowest_world_co(context, ob, mat_parent=None):
+    if ob.type == 'MESH':
+        return get_lowest_world_co_from_mesh(ob)
+    
+    elif ob.type == 'EMPTY' and ob.dupli_type == 'GROUP':
+        if not ob.dupli_group:
+            return None
+        
+        else:
+            lowest_co = None
+            for ob_l in ob.dupli_group.objects:
+                if ob_l.type == 'MESH':
+                    lowest_ob_l = get_lowest_world_co_from_mesh(ob_l, ob.matrix_world)
+                    if not lowest_co:
+                        lowest_co = lowest_ob_l
+                    if lowest_ob_l.z < lowest_co.z:
+                        lowest_co = lowest_ob_l
+                        
+            return lowest_co
+
+def drop_objects(self, context):
+    ground = context.object
+    obs = context.selected_objects
+    obs.remove(ground)
+    tmp_ground = transform_ground_to_world(context.scene, ground)
+    down = Vector((0, 0, -10000))
+    
     for ob in obs:
-        bpy.ops.object.select_all(action='DESELECT')
-        ob.select = True
+        if self.use_origin:
+            lowest_world_co = ob.location
+        else:
+            lowest_world_co = get_lowest_world_co(context, ob)
+        if not lowest_world_co:
+            print(ob.type, 'is not supported. Failed to drop', ob.name)
+            continue
+        hit_location, hit_normal, hit_index = tmp_ground.ray_cast(lowest_world_co,
+                                                                  lowest_world_co + down)
+        if hit_index == -1:
+            print(ob.name, 'didn\'t hit the ground')
+            continue
+        
+        # simple drop down
+        to_ground_vec =  hit_location - lowest_world_co
+        ob.location += to_ground_vec
+        
+        # drop with align to hit normal
+        if self.align:
+            to_center_vec = ob.location - hit_location #vec: hit_loc to origin
+            # rotate object to align with face normal
+            mat_normal = get_align_matrix(hit_location, hit_normal)
+            rot_euler = mat_normal.to_euler()
+            mat_ob_tmp = ob.matrix_world.copy().to_3x3()
+            mat_ob_tmp.rotate(rot_euler)
+            mat_ob_tmp = mat_ob_tmp.to_4x4()
+            ob.matrix_world = mat_ob_tmp
+            # move_object to hit_location
+            ob.location = hit_location
+            # move object above surface again
+            to_center_vec.rotate(rot_euler)
+            ob.location += to_center_vec
         
-        #randomise location it its enabled
-        if sc.random_loc :
-            print("randomising the location of object : ", ob.name)
-            print("current location :" + str(ob.location))
-            bpy.ops.transform.translate(value=(compute_percentage(sc.rl_min_x,sc.rl_max_x,0,100),
-                           compute_percentage(sc.rl_min_y,sc.rl_max_y,0,100),
-                           compute_percentage(sc.rl_min_z,sc.rl_max_z,0,100)))
-            print("randomised location : ", str(ob.location))
-        do_drop(context, tmpObj, ob)
 
+    #cleanup
     bpy.ops.object.select_all(action='DESELECT')
-    tmpObj.select = True
+    tmp_ground.select = True
     bpy.ops.object.delete('EXEC_DEFAULT')
-
     for ob in obs:
         ob.select = True
     ground.select = True
-
- 
-class VIEW3D_PT_tools_drop_to_ground(bpy.types.Panel):
-    bl_space_type = 'VIEW_3D'
-    bl_region_type = 'TOOLS'
-    bl_label = "Drop to ground"
-    bl_context = "objectmode"
-
-    def draw(self, context):
-        active_obj = context.active_object
-        layout = self.layout
-        col = layout.column(align=True)
-        col.operator("object.drop_to_ground", text="Drop")
-        col.prop(context.scene, "align_object")
-        col.prop(context.scene, "use_center")
-        box= layout.box()
-        box.prop(context.scene, "random_loc")
-        
-        # random location gui appears only if its enabled
-        if bpy.context.scene.random_loc:
-            
-            row = box.row()
-            row.label(text="(X,Y,Z) [min/max]")
-            row = box.row()
-            a = row.split(percentage = 0.5, align = True)
-            a.prop(context.scene, "rl_min_x")
-            a.prop(context.scene, "rl_max_x")
-            row = box.row()
-            b = row.split(percentage = 0.5, align = True)
-            b.prop(context.scene, "rl_min_y")
-            b.prop(context.scene, "rl_max_y")
-            row = box.row()
-            b = row.split(percentage = 0.5, align = True)
-            b.prop(context.scene, "rl_min_z")
-            b.prop(context.scene, "rl_max_z")
-        
-class OBJECT_OT_drop_to_ground(bpy.types.Operator):
-    """Drop to ground"""
-    bl_idname = "object.drop_to_ground"
-    bl_label = "Drop to ground"
-    bl_description = "Drops selected objects onto the active object"
+    
+#################################################################
+class OBJECT_OT_drop_to_ground(Operator):
+    '''Drop selected objects on active object'''
+    bl_idname = "object.drop_on_active"
+    bl_label = "Drop to Ground"
     bl_options = {'REGISTER', 'UNDO'}
- 
+    bl_description = "Drop selected objects on active object"
+
+    align = BoolProperty(
+            name="Align to ground",
+            description="Aligns the object to the ground",
+            default=True)
+    use_origin = BoolProperty(
+            name="Use Center",
+            description="Drop to objects origins",
+            default=False)
+
+    ##### POLL #####
+    @classmethod
+    def poll(cls, context):
+        return len(context.selected_objects) >= 2
+    
+    ##### EXECUTE #####
     def execute(self, context):
-        main(self, context)
+        print('\nDropping Objects')
+        drop_objects(self, context)
         return {'FINISHED'}
 
- 
- 
-#### REGISTER ####
-
+#################################################################
+def drop_to_ground_button(self, context):
+    self.layout.operator(OBJECT_OT_drop_to_ground.bl_idname,
+                         text="Drop to Ground")
+    
 def register():
     bpy.utils.register_module(__name__)
-    bpy.types.Scene.align_object = BoolProperty(
-        name="Align object to ground",
-        description="Aligns the object to the ground",
-        default=True)
-    bpy.types.Scene.use_center = BoolProperty(
-        name="Use the center to drop",
-        description="When dropping the object will be relocated on the basis of its senter",
-        default=False)
+    bpy.types.VIEW3D_PT_tools_objectmode.append(drop_to_ground_button)
     
-    #random location props
-    bpy.types.Scene.random_loc = BoolProperty(
-        name="Random Location",
-        description="When dropping the object will be relocated randomly ",
-        default=False)
-    bpy.types.Scene.rl_min_x =  IntProperty(name="min", description = " Minimum of location randomisation while droped to the ground for the x axis", default = 0)
-    bpy.types.Scene.rl_max_x =  IntProperty(name="max", description = " Maximum of location randomisation while droped to the ground for the x axis", default = 0)
-    bpy.types.Scene.rl_min_y =  IntProperty(name="min", description = " Minimum of location randomisation while droped to the ground for the y axis", default = 0)
-    bpy.types.Scene.rl_max_y =  IntProperty(name="max", description = " Maximum of location randomisation while droped to the ground for the y axis", default = 0)
-    bpy.types.Scene.rl_min_z =  IntProperty(name="min", description = " Minimum of location randomisation while droped to the ground for the z axis", default = 0)
-    bpy.types.Scene.rl_max_z =  IntProperty(name="max", description = " Maximum of location randomisation while droped to the ground for the z axis", default = 0)
-     
 def unregister():
     bpy.utils.unregister_module(__name__)
-    del bpy.types.Scene.align_object
-    del bpy.types.Scene.use_center
-    del bpy.types.Scene.random_loc
-    del bpy.types.Scene.rl_min_x
-    del bpy.types.Scene.rl_max_x
-    del bpy.types.Scene.rl_min_y
-    del bpy.types.Scene.rl_max_y
-    del bpy.types.Scene.rl_min_z
-    del bpy.types.Scene.rl_max_z
-    
+    bpy.types.VIEW3D_PT_tools_objectmode.remove(drop_to_ground_button)
+
 if __name__ == '__main__':
     register()
diff --git a/release/scripts/addons_contrib/object_edit_linked.py b/release/scripts/addons_contrib/object_edit_linked.py
new file mode 100644
index 0000000..db3b181
--- /dev/null
+++ b/release/scripts/addons_contrib/object_edit_linked.py
@@ -0,0 +1,186 @@
+# ***** 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": "Edit Linked Library",
+    "author": "Jason van Gumster (Fweeb)",
+    "version": (0, 7, 0),
+    "blender": (2, 6, 0),
+    "location": "View3D > Toolshelf > Edit Linked Library",
+    "description": "Allows editing of objects linked from a .blend library.",
+    "wiki_url": "http://wiki.blender.org/index.php?title=Extensions:2.5/Py/Scripts/Object/Edit_Linked_Library",
+    "tracker_url": "http://projects.blender.org/tracker/index.php?func=detail&aid=29630&group_id=153&atid=467",
+    "category": "Object"}
+    
+
+import bpy
+from bpy.app.handlers import persistent
+
+settings = {
+    "original_file": "",
+    "linked_file": "",
+    "linked_objects": [],
+    }
+
+ at persistent
+def linked_file_check(context):
+    if settings["linked_file"] != "":
+        if settings["linked_file"] in {bpy.data.filepath, bpy.path.abspath(bpy.data.filepath)}:
+            print("Editing a linked library.")
+            bpy.ops.object.select_all(action = 'DESELECT')
+            for ob_name in settings["linked_objects"]:
+                bpy.data.objects[ob_name].select = True
+            if len(settings["linked_objects"]) == 1:
+                bpy.context.scene.objects.active = bpy.data.objects[settings["linked_objects"][0]]
+        else:
+            # For some reason, the linked editing session ended (failed to find a file or opened a different file before returning to the originating .blend)
+            settings["original_file"] = ""
+            settings["linked_file"] = ""
+
+
+
+class EditLinked(bpy.types.Operator):
+    '''Edit Linked Library'''
+    bl_idname = "object.edit_linked"
+    bl_label = "Edit Linked Library"
+
+    autosave = bpy.props.BoolProperty(name = "Autosave", description = "Automatically save the current file before opening the linked library", default = True)
+
+    @classmethod
+    def poll(cls, context):
+        return context.active_object is not None
+
+    def execute(self, context):
+        #print(bpy.context.active_object.library)
+        target = context.active_object
+
+        if target.dupli_group and target.dupli_group.library:
+            targetpath = target.dupli_group.library.filepath
+            settings["linked_objects"].extend([ob.name for ob in target.dupli_group.objects])
+        elif target.library:
+            targetpath = target.library.filepath
+            settings["linked_objects"].append(target.name)
+
+        if targetpath:
+            print(target.name + " is linked to " + targetpath)
+
+            if self.properties.autosave == True:
+                bpy.ops.wm.save_mainfile()
+
+            settings["original_file"] = bpy.data.filepath
+
+            # XXX: need to test for proxied rigs
+            settings["linked_file"] = bpy.path.abspath(targetpath)
+
+            bpy.ops.wm.open_mainfile(filepath=settings["linked_file"])
+            print("Opened linked file!")
+        else:
+            self.report({'WARNING'}, target.name + " is not linked")
+            print(target.name + " is not linked")
+
+        return {'FINISHED'}
+
+
+class ReturnToOriginal(bpy.types.Operator):
+    '''Return to the original file after editing the linked library .blend'''
+    bl_idname = "wm.return_to_original"
+    bl_label = "Return to Original File"
+
+    autosave = bpy.props.BoolProperty(name = "Autosave", description = "Automatically save the current file before opening original file", default = True)
+
+    @classmethod
+    def poll(cls, context):
+        # Probably the wrong context to check for here...
+        return context.active_object is not None
+    
+    def execute(self, context):
+        if self.properties.autosave == True:
+            bpy.ops.wm.save_mainfile()
+        bpy.ops.wm.open_mainfile(filepath=settings["original_file"])
+        settings["original_file"] = ""
+        settings["linked_objects"] = []
+        print("Back to the original!")
+        return {'FINISHED'}
+
+
+# UI
+# TODO: Add operators to the File menu? Hide the entire panel for non-linked objects?
+class PanelLinkedEdit(bpy.types.Panel):
+    bl_label = "Edit Linked Library"
+    bl_space_type = "VIEW_3D"
+    bl_region_type = "TOOLS"
+
+
+    def draw(self, context):
+        kc = bpy.context.window_manager.keyconfigs.addon
+        km = kc.keymaps["3D View"]
+        kmi_edit = km.keymap_items["object.edit_linked"]
+        kmi_return = km.keymap_items["wm.return_to_original"]
+
+        if settings["original_file"] == "" and ((context.active_object.dupli_group and context.active_object.dupli_group.library is not None) or context.active_object.library is not None):
+            kmi_edit.active = True
+            kmi_return.active = False
+            self.layout.operator("object.edit_linked").autosave = context.scene.edit_linked_autosave
+            self.layout.prop(context.scene, "edit_linked_autosave")
+        elif settings["original_file"] != "":
+            kmi_edit.active = False
+            kmi_return.active = True
+            self.layout.operator("wm.return_to_original").autosave = context.scene.edit_linked_autosave
+            self.layout.prop(context.scene, "edit_linked_autosave")
+        else:
+            kmi_edit.active = False
+            kmi_return.active = False
+            self.layout.label(text = "Active object is not linked")
+
+
+bpy.app.handlers.load_post.append(linked_file_check)
+
+
+def register():
+    bpy.utils.register_class(EditLinked)
+    bpy.utils.register_class(ReturnToOriginal)
+    bpy.utils.register_class(PanelLinkedEdit)
+
+    # Is there a better place to store this property?
+    bpy.types.Scene.edit_linked_autosave = bpy.props.BoolProperty(name = "Autosave", description = "Automatically save the current file before opening a linked file", default = True)
+
+    # Keymapping (deactivated by default; activated when a library object is selected)
+    kc = bpy.context.window_manager.keyconfigs.addon
+    km = kc.keymaps.new(name = "3D View", space_type='VIEW_3D')
+    kmi = km.keymap_items.new("object.edit_linked", 'NUMPAD_SLASH', 'PRESS', shift = True)
+    kmi.active = False
+    kmi = km.keymap_items.new("wm.return_to_original", 'NUMPAD_SLASH', 'PRESS', shift = True)
+    kmi.active = False
+
+
+def unregister():
+    bpy.utils.unregister_class(EditLinked)
+    bpy.utils.unregister_class(SaveAndResume)
+    bpy.utils.unregister_class(PanelLinkedEdit)
+
+    del bpy.types.Scene.edit_linked_autosave
+
+    kc = bpy.context.window_manager.keyconfigs.addon
+    km = kc.keymaps["3D View"]
+    km.keymap_items.remove(km.keymap_items["object.edit_linked"])
+    km.keymap_items.remove(km.keymap_items["wm.return_to_original"])
+
+
+if __name__ == "__main__":
+    register()
diff --git a/release/scripts/addons_contrib/object_mangle_tools.py b/release/scripts/addons_contrib/object_mangle_tools.py
new file mode 100644
index 0000000..a0e13e1
--- /dev/null
+++ b/release/scripts/addons_contrib/object_mangle_tools.py
@@ -0,0 +1,205 @@
+# mangle_tools.py (c) 2011 Phil Cote (cotejrp1)
+#
+# ***** 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": "Mangle Tools",
+    "author": "Phil Cote",
+    "version": (0, 2),
+    "blender": (2, 6, 3),
+    "location": "View3D > Tools",
+    "description": "Set of tools to mangle curves, meshes, and shape keys",
+    "warning": "", # used for warning icon and text in addons panel
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
+        "Scripts/",
+    "tracker_url": "https://projects.blender.org/tracker/index.php?"\
+        "func=detail&aid=29071",
+    "category": "Object"}
+
+import bpy
+import random
+import time
+from math import pi
+import bmesh
+
+def move_coordinate(context, co, is_curve=False):
+    xyz_const = context.scene.constraint_vector
+    random.seed(time.time())
+    multiplier = 1
+
+    # For curves, we base the multiplier on the circumference formula.
+    # This helps make curve changes more noticable.
+    if is_curve:
+        multiplier = 2 * pi
+    random_mag = context.scene.random_magnitude
+    if xyz_const[0]:    
+        co.x += .01 * random.randrange( -random_mag, random_mag ) * multiplier
+    if xyz_const[1]:
+        co.y += .01 * random.randrange( -random_mag, random_mag )  * multiplier
+    if xyz_const[2]:
+        co.z += .01 * random.randrange( -random_mag, random_mag ) * multiplier
+
+
+class MeshManglerOperator(bpy.types.Operator):
+    '''push vertices on the selected object around in random directions to 
+    create a crumpled look'''
+    bl_idname = "ba.mesh_mangler"
+    bl_label = "Mangle Mesh"
+    bl_options = { "REGISTER", "UNDO" }
+
+    @classmethod
+    def poll(cls, context):
+        ob = context.active_object
+        return ob != None and ob.type == 'MESH'
+
+    def execute(self, context):
+        mesh = context.active_object.data
+        bm = bmesh.new()
+        bm.from_mesh(mesh)
+        verts, faces = bm.verts, bm.faces
+        randomMag = context.scene.random_magnitude
+        random.seed( time.time() )
+
+        if mesh.shape_keys != None:
+            self.report( {"INFO"}, "Cannot mangle mesh: Shape keys present" )
+            return {'CANCELLED'}
+        
+        for vert in verts:
+            xVal = .01 * random.randrange( -randomMag, randomMag )
+            yVal = .01 * random.randrange( -randomMag, randomMag)
+            zVal = .01 * random.randrange( -randomMag, randomMag )
+            vert.co.x = vert.co.x + xVal
+            vert.co.y = vert.co.y + yVal
+            vert.co.z = vert.co.z + zVal
+                
+        bm.to_mesh(mesh)   
+        mesh.update()
+        return {'FINISHED'}
+
+
+class AnimanglerOperator(bpy.types.Operator):
+    '''makes a shape key and pushes the verts around on it to set up for random pulsating animation'''
+    bl_idname = "ba.ani_mangler"
+    bl_label = "Mangle Shape Key"
+
+
+    @classmethod
+    def poll(cls, context):
+        ob = context.active_object
+        return ob != None and ob.type in [ 'MESH', 'CURVE' ]
+
+    def execute(self, context):
+        scn = context.scene
+        mangleName = scn.mangle_name
+        ob = context.object
+        shapeKey = ob.shape_key_add( name=mangleName )
+        verts = shapeKey.data
+        
+        for vert in verts:
+            move_coordinate(context, vert.co, is_curve=ob.type=='CURVE')
+            
+        return {'FINISHED'}
+
+
+class CurveManglerOp(bpy.types.Operator):
+    '''Mangles a curve to the degree the user specifies'''
+    bl_idname = "ba.curve_mangler"
+    bl_label = "Mangle Curve"
+    bl_options = { 'REGISTER', 'UNDO' }
+
+    @classmethod
+    def poll(cls, context):
+        ob = context.active_object
+        return ob != None and ob.type == "CURVE"
+
+
+    def execute(self, context):
+
+        ob = context.active_object
+        if ob.data.shape_keys != None:
+            self.report({"INFO"}, "Cannot mangle curve.  Shape keys present")
+            return {'CANCELLED'}
+        splines = context.object.data.splines
+        
+        for spline in splines:
+            if spline.type == 'BEZIER':
+                points = spline.bezier_points
+            elif spline.type in ('POLY', 'NURBS'):
+                points = spline.points
+
+            for point in points:
+                move_coordinate(context, point.co, is_curve=True)
+
+        return {'FINISHED'}
+
+
+class MangleToolsPanel(bpy.types.Panel):
+    bl_label = "Mangle Tools"
+    bl_space_type = "VIEW_3D"
+    bl_region_type="TOOLS"
+    bl_context = "objectmode"
+    bl_options = {'DEFAULT_CLOSED'}
+
+    def draw(self, context):
+        scn = context.scene
+        layout = self.layout
+        col = layout.column()
+        col.prop(scn, "constraint_vector")
+        col.prop(scn, "random_magnitude")
+
+        col.operator("ba.curve_mangler")
+        col.operator("ba.mesh_mangler")
+        col.separator()
+        col.prop(scn, "mangle_name")
+        col.operator("ba.ani_mangler")
+
+
+IntProperty = bpy.props.IntProperty
+StringProperty = bpy.props.StringProperty
+BoolVectorProperty = bpy.props.BoolVectorProperty
+
+def register():
+    bpy.utils.register_class(AnimanglerOperator)
+    bpy.utils.register_class(MeshManglerOperator)
+    bpy.utils.register_class(CurveManglerOp)
+    bpy.utils.register_class(MangleToolsPanel)
+    scnType = bpy.types.Scene
+    
+                                    
+    scnType.constraint_vector = BoolVectorProperty(name="Mangle Constraint", 
+                                default=(True,True,True),
+                                subtype='XYZ',
+                                description="Constrains Mangle Direction")
+                                
+    scnType.random_magnitude = IntProperty( name = "Mangle Severity", 
+                              default = 10, min = 1, max = 30, 
+                              description = "Severity of mangling")
+    
+    scnType.mangle_name = StringProperty(name="Shape Key Name",
+                             default="mangle",
+                             description="Name given for mangled shape keys")
+def unregister():
+    bpy.utils.unregister_class(AnimanglerOperator)
+    bpy.utils.unregister_class(MeshManglerOperator)
+    bpy.utils.unregister_class(MangleToolsPanel)
+    bpy.utils.unregister_class(CurveManglerOp)
+
+
+if __name__ == "__main__":
+    register()
diff --git a/release/scripts/addons_contrib/object_render_wire.py b/release/scripts/addons_contrib/object_render_wire.py
new file mode 100644
index 0000000..c8d60ac
--- /dev/null
+++ b/release/scripts/addons_contrib/object_render_wire.py
@@ -0,0 +1,424 @@
+# ***** 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 th
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU 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.
+#
+# object_render_wire.py liero, meta-androcto,
+# Yorik van Havre, Alejandro Sierra, Howard Trickey
+# ***** END GPL LICENCE BLOCK *****
+
+bl_info = {
+    "name": "Render Wireframe",
+    "author": "Community",
+    "description": " WireRender & WireSoild modes",
+    "version": (2, 3),
+    "blender": (2, 6, 3),
+    "location": "Object > Render Wireframe",
+    "warning": '',
+    'wiki_url': 'http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts',
+    'tracker_url': 'https://projects.blender.org/tracker/index.php?'\
+                   'func=detail&aid=26997',
+    'category': 'Object'}
+
+import bpy, mathutils
+
+cube_faces = [ [0,3,2,1], [5,6,7,4], [0,1,5,4],
+               [7,6,2,3], [2,6,5,1], [0,4,7,3] ]
+cube_normals = [ mathutils.Vector((0,0,-1)),
+                 mathutils.Vector((0,0,1)),
+                 mathutils.Vector((0,-1,0)),
+                 mathutils.Vector((0,1,0)),
+                 mathutils.Vector((1,0,0)),
+                 mathutils.Vector((-1,0,0)) ]
+
+def create_cube(me, v, d):
+    x = v.co.x
+    y = v.co.y
+    z = v.co.z
+    coords=[ [x-d,y-d,z-d], [x+d,y-d,z-d], [x+d,y+d,z-d], [x-d,y+d,z-d],
+         [x-d,y-d,z+d], [x+d,y-d,z+d], [x+d,y+d,z+d], [x-d,y+d,z+d] ]
+    for coord in coords:
+        me.vertices.add(1)
+        me.vertices[-1].co = mathutils.Vector(coord)
+
+def norm_dot(e, k, fnorm, me):
+    v = me.vertices[e[1]].co - me.vertices[e[0]].co
+    if k == 1:
+        v = -v
+    v.normalize()
+    return v * fnorm
+
+def fill_cube_face(me, index, f):
+    return [index + cube_faces[f][i] for i in range(4)]
+
+# Coords of jth point of face f in cube instance i
+def cube_face_v(me, f, i, j):
+    return me.vertices[i + cube_faces[f][j]].co
+
+def cube_face_center(me, f, i):
+    return 0.5 * (cube_face_v(me, f, i, 0) + \
+                  cube_face_v(me, f, i, 2))
+
+# Return distance between points on two faces when
+# each point is projected onto the plane that goes through
+# the face center and is perpendicular to the line
+# through the face centers.
+def projected_dist(me, i1, i2, f1, f2, j1, j2):
+    f1center = cube_face_center(me, f1, i1)
+    f2center = cube_face_center(me, f2, i2)
+    axis_norm = (f2center - f1center).normalized()
+    v1 = cube_face_v(me, f1, i1, j1)
+    v2 = cube_face_v(me, f2, i2, j2)
+    v1proj = v1 - (axis_norm * (v1 - f1center)) * axis_norm
+    v2proj = v2 - (axis_norm * (v2 - f2center)) * axis_norm
+    return (v2proj - v1proj).length
+
+def skin_edges(me, i1, i2, f1, f2):
+    # Connect verts starting at i1 forming cube face f1
+    # to those starting at i2 forming cube face f2.
+    # Need to find best alignment to avoid a twist.
+    shortest_length = 1e6
+    f2_start_index = 0
+    for i in range(4):
+        x = projected_dist(me, i1, i2, f1, f2, 0, i)
+        if x < shortest_length:
+            shortest_length = x
+            f2_start_index = i
+    ans = []
+    j = f2_start_index
+    for i in range(4):
+        fdata = [i1 + cube_faces[f1][i],
+                 i2 + cube_faces[f2][j],
+                 i2 + cube_faces[f2][(j + 1) % 4],
+                 i1 + cube_faces[f1][(i - 1) % 4]]
+        if fdata[3] == 0:
+            fdata = [fdata[3]] + fdata[0:3]
+        ans.extend(fdata)
+        j = (j - 1) % 4
+    return ans
+            
+
+# Return map: v -> list of length len(node_normals) where
+# each element of the list is either None (no assignment)
+# or ((v0, v1), 0 or 1) giving an edge and direction that face is assigned to.
+def find_assignment(me, edges, vert_edges, node_normals):
+    nf = len(node_normals)
+    feasible = {}
+    for e in edges:
+        for k in (0, 1):
+            fds = [(f, norm_dot(e, k, node_normals[f], me)) for f in range(nf)]
+            feasible[(e, k)] = [fd for fd in fds if fd[1] > 0.01]
+    assignment = {}
+    for v, ves in vert_edges.items():
+        assignment[v] = best_assignment(ves, feasible, nf)
+    return assignment
+
+def best_assignment(ves, feasible, nf):
+    apartial = [ None ] * nf
+    return best_assign_help(ves, feasible, apartial, 0.0)[0]
+
+def best_assign_help(ves, feasible, apartial, sumpartial):
+    if len(ves) == 0:
+        return (apartial, sumpartial)
+    else:
+        ek0 = ves[0]
+        vesrest = ves[1:]
+        feas = feasible[ek0]
+        bestsum = 0
+        besta = None
+        for (f, d) in feas:
+            if apartial[f] is None:
+                ap = apartial[:]
+                ap[f] = ek0
+                # sum up d**2 to penalize smaller d's more
+                sp = sumpartial + d*d
+                (a, s) = best_assign_help(vesrest, feasible, ap, sp)
+                if s > bestsum:
+                    bestsum = s
+                    besta = a
+        if besta:
+            return (besta, bestsum)
+        else:
+            # not feasible to assign e0, k0; try to assign rest
+            return best_assign_help(vesrest, feasible, apartial, sumpartial)
+
+def assigned_face(e, assignment):
+    (v0, v1), dir = e
+    a = assignment[v1]
+    for j, ee in enumerate(a):
+        if e == ee:
+            return j
+    return -1
+
+def create_wired_mesh(me2, me, thick):
+    edges = []
+    vert_edges = {}
+    for be in me.edges:
+        if be.select and not be.hide:
+            e = (be.key[0], be.key[1])
+            edges.append(e)
+            for k in (0, 1):
+                if e[k] not in vert_edges:
+                    vert_edges[e[k]] = []
+                vert_edges[e[k]].append((e, k))
+
+    assignment = find_assignment(me, edges, vert_edges, cube_normals)
+
+    # Create the geometry
+    n_idx = {}   
+    for v in assignment:
+        vpos = me.vertices[v]
+        index = len(me2.vertices)
+        # We need to associate each node with the new geometry
+        n_idx[v] = index   
+        # Geometry for the nodes, each one a cube
+        create_cube(me2, vpos, thick)
+
+    # Skin using the new geometry 
+    cfaces = []  
+    for k, f in assignment.items():
+        # Skin the nodes
+        for i in range(len(cube_faces)):
+            if f[i] is None:
+                cfaces.extend(fill_cube_face(me2, n_idx[k], i))
+            else:
+                (v0, v1), dir = f[i]
+                # only skin between edges in forward direction
+                # to avoid making doubles
+                if dir == 1:
+                    # but first make sure other end actually assigned
+                    i2 = assigned_face(((v0, v1), 0), assignment)
+                    if i2 == -1:
+                        cfaces.extend(fill_cube_face(me2, n_idx[k], i))
+                    continue
+                i2 = assigned_face(((v0, v1), 1), assignment)
+                if i2 != -1:
+                    cfaces.extend(skin_edges(me2, n_idx[v0], n_idx[v1], i, i2))
+                else:
+                    # assignment failed for this edge
+                    cfaces.extend(fill_cube_face(me2, n_idx[k], i))
+
+    # adding faces to the mesh
+    me2.tessfaces.add(len(cfaces) // 4)
+    me2.tessfaces.foreach_set("vertices_raw", cfaces)
+    me2.update(calc_edges=True)
+
+# panel containing tools
+def wire_add(mallas):
+    if mallas:
+        bpy.ops.object.select_all(action='DESELECT')
+        bpy.context.scene.objects.active = mallas[0]
+        for o in mallas: o.select = True
+        bpy.ops.object.duplicate()
+        obj, sce = bpy.context.object, bpy.context.scene
+        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.object.mode_set()
+        bpy.ops.object.convert(target='CURVE')
+        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'}
+'''
+class VIEW3D_PT_tools_SolidifyWireframe(bpy.types.Panel):
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'TOOLS'
+    bl_context = "mesh_edit"
+    bl_label = "Solidify Wireframe"
+
+    def draw(self, context):
+        active_obj = context.active_object
+        layout = self.layout
+        col = layout.column(align=True)
+        col.operator("mesh.solidify_wireframe", text="Solidify")
+        col.prop(context.scene, "swThickness")
+        col.prop(context.scene, "swSelectNew")
+'''
+# a class for your operator
+class SolidifyWireframe(bpy.types.Operator):
+    '''Turns the selected edges of a mesh into solid objects'''
+    bl_idname = "mesh.solidify_wireframe"
+    bl_label = "Solidify Wireframe"
+    bl_options = {'REGISTER', 'UNDO'}
+    
+    def invoke(self, context, event):
+        return self.execute(context)
+
+    @classmethod
+    def poll(cls, context):
+        ob = context.active_object
+        return ob and ob.type == 'MESH'
+
+    def execute(self, context):
+        # Get the active object
+        ob_act = context.active_object
+        # getting current edit mode
+        currMode = ob_act.mode
+        # switching to object mode
+        bpy.ops.object.mode_set(mode='OBJECT')
+        bpy.ops.object.select_all(action='DESELECT')
+        # getting mesh data
+        mymesh = ob_act.data
+        #getting new mesh
+        newmesh = bpy.data.meshes.new(mymesh.name + " wire")
+        obj = bpy.data.objects.new(newmesh.name,newmesh)
+        obj.location = ob_act.location
+        obj.rotation_euler = ob_act.rotation_euler
+        obj.scale = ob_act.scale
+        context.scene.objects.link(obj)
+        create_wired_mesh(newmesh, mymesh, context.scene.swThickness)
+
+        # restoring original editmode if needed
+        if context.scene.swSelectNew:
+            obj.select = True
+            context.scene.objects.active = obj
+        else:
+            bpy.ops.object.mode_set(mode=currMode)
+
+        # returning after everything is done
+        return {'FINISHED'}
+		
+class WireMaterials(bpy.types.Operator):
+    bl_idname = 'scene.wire_render'
+    bl_label = 'Create 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
+
+        if 'mat_clay' not in bpy.data.materials:
+            mat = bpy.data.materials.new('mat_clay')
+            mat.specular_intensity = 0
+        else: mat = bpy.data.materials.get('mat_clay')
+        mat.diffuse_color = wm.col_clay
+        mat.use_shadeless = wm.shadeless_mat
+
+        if 'mat_wire' not in bpy.data.materials:
+            mat = bpy.data.materials.new('mat_wire')
+            mat.specular_intensity = 0
+            mat.use_transparency = True
+            mat.type = 'WIRE'
+            mat.offset_z = 0.1
+        else: mat = bpy.data.materials.get('mat_wire')
+        mat.diffuse_color = wm.col_wire
+        mat.use_shadeless = wm.shadeless_mat
+
+        try: bpy.ops.object.mode_set()
+        except: pass
+
+        if wm.selected_meshes: objetos = bpy.context.selected_objects
+        else: objetos = bpy.data.objects
+
+        mallas = [o for o in objetos if o.type == 'MESH' and o.is_visible(scn)]
+
+        for obj in mallas:
+            scn.objects.active = obj
+            print ('procesando >', obj.name)
+            obj.show_wire = wm.wire_view
+            for mat in obj.material_slots:
+                bpy.ops.object.material_slot_remove()
+            obj.data.materials.append(bpy.data.materials.get('mat_wire'))
+            obj.data.materials.append(bpy.data.materials.get('mat_clay'))
+            obj.material_slots.data.active_material_index = 1
+            bpy.ops.object.editmode_toggle()
+            bpy.ops.mesh.select_all(action='SELECT')
+            bpy.ops.object.material_slot_assign()
+            bpy.ops.object.mode_set()
+
+        if wm.wire_object:
+            if 'mat_wireobj' not in bpy.data.materials:
+                mat = bpy.data.materials.new('mat_wireobj')
+                mat.specular_intensity = 0
+            else: mat = bpy.data.materials.get('mat_wireobj')
+            mat.diffuse_color = wm.col_wire
+            mat.use_shadeless = wm.shadeless_mat
+            wire_add(mallas)
+
+        return{'FINISHED'}
+
+class PanelWMat(bpy.types.Panel):
+    bl_label = 'Setup Wire Render'
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'TOOLS'
+
+    def draw(self, context):
+        wm = bpy.context.window_manager
+        active_obj = context.active_object
+        layout = self.layout
+
+        column = layout.column(align=True)
+        column.prop(wm, 'col_clay')
+        column.prop(wm, 'col_wire')
+        column = layout.column(align=True)
+        column.prop(wm, 'selected_meshes')
+        column.prop(wm, 'shadeless_mat')
+        column.prop(wm, 'wire_view')
+        column.prop(wm, 'wire_object')
+        column.separator()
+        column.operator('scene.wire_render')
+        column.label(text='- - - - - - - - - - - - - - - - - - - - - -')
+        col = layout.column(align=True)
+        column.label(text='Solid WireFrame')
+        layout.operator("mesh.solidify_wireframe", text="Create Mesh Object")
+        col.prop(context.scene, "swThickness")
+        col.prop(context.scene, "swSelectNew")
+bpy.types.WindowManager.selected_meshes = bpy.props.BoolProperty(name='Selected Meshes', default=False, description='Apply materials to Selected Meshes / All Visible Meshes')
+bpy.types.WindowManager.shadeless_mat = bpy.props.BoolProperty(name='Shadeless', default=False, description='Generate Shadeless Materials')
+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.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)
+
+# Register the operator
+def solidifyWireframe_menu_func(self, context):
+        self.layout.operator(SolidifyWireframe.bl_idname, text="Solidify Wireframe", icon='PLUGIN')
+
+# Add "Solidify Wireframe" menu to the "Mesh" menu.
+def register():
+        bpy.utils.register_class(WireMaterials)
+        bpy.utils.register_class(PanelWMat)
+        bpy.utils.register_module(__name__)
+        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)
+        bpy.types.VIEW3D_MT_edit_mesh_edges.append(solidifyWireframe_menu_func)
+
+# Remove "Solidify Wireframe" menu entry from the "Mesh" menu.
+def unregister():
+        bpy.utils.unregister_class(WireMaterials)
+        bpy.utils.unregister_class(PanelWMat)
+        bpy.utils.unregister_module(__name__)
+        del bpy.types.Scene.swThickness
+        bpy.types.VIEW3D_MT_edit_mesh_edges.remove(solidifyWireframe_menu_func)
+
+if __name__ == "__main__":
+        register()
diff --git a/release/scripts/addons_contrib/oscurart_futurism.py b/release/scripts/addons_contrib/oscurart_futurism.py
index ab7e24c..683ff13 100644
--- a/release/scripts/addons_contrib/oscurart_futurism.py
+++ b/release/scripts/addons_contrib/oscurart_futurism.py
@@ -21,7 +21,6 @@ bl_info = {
     "author": "Oscurart",
     "version": (1, 1),
     "blender": (2, 5, 9),
-    "api": 40900,
     "location": "Object > Futurism",
     "description": "Adds a new Mesh Object",
     "warning": "",
diff --git a/release/scripts/addons_contrib/oscurart_mesh_thread.py b/release/scripts/addons_contrib/oscurart_mesh_thread.py
new file mode 100644
index 0000000..c82dfda
--- /dev/null
+++ b/release/scripts/addons_contrib/oscurart_mesh_thread.py
@@ -0,0 +1,103 @@
+# ##### 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": "Make Thread Mesh",
+    "author": "Oscurart",
+    "version": (1,0),
+    "blender": (2, 5, 9),
+    "api": 4000,
+    "location": "Add > Mesh > Thread",
+    "description": "Make a thread.",
+    "warning": "",
+    "wiki_url": "oscurart.blogspot.com",
+    "tracker_url": "",
+    "category": "Object"}
+
+
+
+import math
+import bpy
+
+
+def func_osc_screw(self, STRETCH,TURNS,DIAMETER,RESOLUTION):
+    # DATA PARA EL MESH
+    me = bpy.data.meshes.new("threadData")
+    obj = bpy.data.objects.new("Thread", me)     
+    bpy.context.scene.objects.link(obj)  
+      
+    # VARIABLES
+    vertexlist=[]
+    facelist=[]
+    facereset=0     
+    CANTDIV=360/RESOLUTION
+    ESPACIODIV=STRETCH/(TURNS+2+RESOLUTION)
+
+    # PARA CADA VERTICE EN EL RANGO DESDE CERO A LENGTH 
+    for vertice in range(0,TURNS+2+RESOLUTION):        
+        # SUMA EN LA LISTA UN VERTICE       
+        vertexlist.append((math.sin(math.radians(vertice*CANTDIV))*DIAMETER,vertice*ESPACIODIV,math.cos(math.radians(vertice*CANTDIV))*DIAMETER))
+        if vertice > RESOLUTION:
+            facelist.append((vertice-(RESOLUTION),vertice-((RESOLUTION)+1),vertice-1,vertice))    
+
+    # CONECTO OBJETO    
+    me.from_pydata(vertexlist,[],facelist)
+    me.update()
+    
+
+
+class oscMakeScrew (bpy.types.Operator):
+
+    bl_idname = "mesh.primitive_thread_oscurart"
+    bl_label = "Add Mesh Thread"
+    bl_description = "Create a Thread"
+    bl_options = {'REGISTER', 'UNDO'}
+
+    resolution = bpy.props.IntProperty (name="Resolution",default=10,min=3,max=1000)
+    stretch = bpy.props.FloatProperty (name="Stretch",default=1,min=0.000001,max=1000)
+    turns = bpy.props.IntProperty (name="Turns Steps",default=19,min=0)
+    diameter = bpy.props.FloatProperty (name="Diameter",default=1,min=0,max=1000)
+  
+    
+    
+    def execute(self, context):
+        func_osc_screw(self, self.stretch,self.turns,self.diameter,self.resolution)
+        return {'FINISHED'}
+
+
+# Registration
+
+def add_screw_list(self, context):
+    self.layout.operator(
+        "mesh.primitive_thread_oscurart",
+        text="Thread",
+        icon="PLUGIN")
+
+def register():
+    bpy.types.INFO_MT_mesh_add.append(add_screw_list)
+    bpy.utils.register_class(oscMakeScrew)
+
+
+def unregister():
+    bpy.types.INFO_MT_mesh_add.remove(add_screw_list)
+    bpy.utils.unregister_class(oscMakeScrew)
+
+
+if __name__ == '__main__':
+    register()
+
diff --git a/release/scripts/addons_contrib/oscurart_tools.py b/release/scripts/addons_contrib/oscurart_tools.py
new file mode 100644
index 0000000..b491cee
--- /dev/null
+++ b/release/scripts/addons_contrib/oscurart_tools.py
@@ -0,0 +1,2669 @@
+# ##### 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": "Oscurart Tools",
+    "author": "Oscurart",
+    "version": (2,9),
+    "blender": (2, 6, 2),
+    "location": "View3D > Tools > Oscurart Tools",
+    "description": "Tools for objects, render, shapes, and files.",
+    "warning": "",
+    "wiki_url": "oscurart.blogspot.com",
+    "tracker_url": "",
+    "category": "Object"}
+
+
+
+import bpy
+import math
+import sys
+import os
+import stat
+import bmesh
+
+## CREA PANELES EN TOOLS
+
+# VARIABLES DE ENTORNO
+bpy.types.Scene.osc_object_tools=bpy.props.BoolProperty(default=False)
+bpy.types.Scene.osc_mesh_tools=bpy.props.BoolProperty(default=False)
+bpy.types.Scene.osc_shapes_tools=bpy.props.BoolProperty(default=False)
+bpy.types.Scene.osc_render_tools=bpy.props.BoolProperty(default=False)
+bpy.types.Scene.osc_files_tools=bpy.props.BoolProperty(default=False)
+bpy.types.Scene.osc_overrides_tools=bpy.props.BoolProperty(default=False)
+
+# PANEL DE CONTROL
+class OscPanelControl(bpy.types.Panel):
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'TOOLS'
+    bl_label = "Oscurart Tools"
+    def draw(self,context):
+        active_obj = context.active_object
+        layout = self.layout             
+  
+        col = layout.column(align=1)         
+        col.prop(bpy.context.scene,"osc_object_tools",text="Object",icon="OBJECT_DATAMODE")
+        col.prop(bpy.context.scene,"osc_mesh_tools",text="Mesh",icon="EDITMODE_HLT")
+        col.prop(bpy.context.scene,"osc_shapes_tools",text="Shapes",icon="SHAPEKEY_DATA")
+        col.prop(bpy.context.scene,"osc_render_tools",text="Render",icon="SCENE")
+        col.prop(bpy.context.scene,"osc_files_tools",text="Files",icon="IMASEL")
+        col.prop(bpy.context.scene,"osc_overrides_tools",text="Overrides",icon="GREASEPENCIL")
+
+# POLLS
+class OscPollObject():
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'TOOLS'
+    
+    @classmethod
+    def poll(cls, context):
+        return(context.scene.osc_object_tools == True)
+    
+
+class OscPollMesh():
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'TOOLS'
+    
+    @classmethod
+    def poll(cls, context):
+        return(context.scene.osc_mesh_tools == True)    
+
+
+class OscPollShapes():
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'TOOLS'
+    
+    @classmethod
+    def poll(cls, context):
+        return(context.scene.osc_shapes_tools == True)
+
+class OscPollRender():
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'TOOLS'
+    
+    @classmethod
+    def poll(cls, context):
+        return(context.scene.osc_render_tools == True)
+    
+class OscPollFiles():
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'TOOLS'
+    
+    @classmethod
+    def poll(cls, context):
+        return(context.scene.osc_files_tools == True)  
+    
+class OscPollOverrides():
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'TOOLS'
+    
+    @classmethod
+    def poll(cls, context):
+        return(context.scene.osc_overrides_tools == True)       
+
+
+
+## PANELES    
+class OscPanelObject(OscPollObject, bpy.types.Panel):
+    bl_idname = "Oscurart Object Tools"
+    bl_label = "Object Tools"
+        
+    def draw(self, context):
+        active_obj = context.active_object
+        layout = self.layout        
+        col = layout.column(align=1)
+        row = col.row()           
+        
+        colrow = col.row(align=1)  
+        colrow.operator("objects.relink_objects_between_scenes",icon="LINKED")     
+        colrow.operator("objects.copy_objects_groups_layers",icon="LINKED")      
+        col.operator("object.distribute_apply_osc",icon="OBJECT_DATAMODE") 
+        colrow = col.row(align=1)
+        colrow.prop(bpy.context.scene,"SearchAndSelectOt",text="")
+        colrow.operator("object.search_and_select_osc",icon="ZOOM_SELECTED")       
+        colrow = col.row(align=1)
+        colrow.prop(bpy.context.scene,"RenameObjectOt",text="")
+        colrow.operator("object.rename_objects_osc",icon="SHORTDISPLAY")  
+        col.operator("object.duplicate_object_symmetry_osc",icon="OBJECT_DATAMODE", text="Duplicate Object Symmetry")      
+        colrow = col.row(align=1)
+        colrow.operator("object.modifiers_remove_osc",icon="MODIFIER", text="Remove Modifiers")
+        colrow.operator("object.modifiers_apply_osc",icon="MODIFIER", text="Apply Modifiers")
+        
+
+class OscPanelMesh(OscPollMesh, bpy.types.Panel):
+    bl_idname = "Oscurart Mesh Tools"
+    bl_label = "Mesh Tools"
+        
+    def draw(self, context):
+        active_obj = context.active_object
+        layout = self.layout        
+        col = layout.column(align=1)
+        row = col.row()           
+        
+        col.operator("mesh.select_side_osc",icon="VERTEXSEL")  
+        col.operator("mesh.normals_outside_osc",icon="SNAP_NORMAL")       
+        colrow=col.row(align=1)
+        colrow.operator("mesh.resym_osc",icon="UV_SYNC_SELECT") 
+        colrow.operator("mesh.resym_vertex_weights_osc",icon="UV_SYNC_SELECT") 
+        colrow=col.row(align=1)        
+        colrow.operator("file.export_groups_osc", icon='GROUP_VCOL')
+        colrow.operator("file.import_groups_osc", icon='GROUP_VCOL')        
+
+        
+class OscPanelShapes(OscPollShapes, bpy.types.Panel):
+    bl_idname = "Oscurart Shapes Tools"
+    bl_label = "Shapes Tools"
+        
+    def draw(self, context):
+        active_obj = context.active_object
+        layout = self.layout        
+        col = layout.column(align=1)
+        row = col.row()           
+
+        col.operator("object.shape_key_to_objects_osc",icon="OBJECT_DATAMODE")
+        col.operator("mesh.create_lmr_groups_osc",icon="GROUP_VERTEX")
+        col.operator("mesh.split_lr_shapes_osc",icon="SHAPEKEY_DATA")
+        colrow=col.row()
+        colrow.operator("mesh.create_symmetrical_layout_osc",icon="SETTINGS")         
+        colrow.operator("mesh.create_asymmetrical_layout_osc",icon="SETTINGS") 
+        
+class OscPanelRender(OscPollRender, bpy.types.Panel):
+    bl_idname = "Oscurart Render Tools"
+    bl_label = "Render Tools"
+        
+    def draw(self, context):
+        active_obj = context.active_object
+        layout = self.layout        
+        col = layout.column(align=1)
+        row = col.row() 
+
+        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")
+        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 = col.row(align=1)
+        colrow.prop(bpy.context.scene,"rcPARTS",text="Render Crop Parts") 
+        colrow.operator("render.render_crop_osc",icon="RENDER_REGION")  
+
+
+class OscPanelFiles(OscPollFiles, bpy.types.Panel):
+    bl_idname = "Oscurart Files Tools"
+    bl_label = "Files Tools"
+        
+    def draw(self, context):
+        active_obj = context.active_object
+        layout = self.layout        
+        col = layout.column(align=1)
+      
+        colrow = col.row()
+        colrow.operator("file.save_incremental_osc",icon="NEW")
+        colrow.operator("image.reload_images_osc",icon="IMAGE_COL")  
+        colrow = col.row(align=1)
+        colrow.prop(bpy.context.scene,"oscSearchText",text="")               
+        colrow.prop(bpy.context.scene,"oscReplaceText",text="")         
+        col.operator("file.replace_file_path_osc",icon="SHORTDISPLAY") 
+        
+        
+class OscPanelOverrides(OscPollOverrides, bpy.types.Panel):
+    bl_idname = "Oscurart Overrides"
+    bl_label = "Overrides Tools"
+        
+    def draw(self, context):
+        layout = self.layout
+
+        obj = context.object
+        
+        col = layout.box().column(align=1)
+
+        colrow = col.row()
+        col.operator("render.overrides_set_list", text="Create Override List",icon="GREASEPENCIL")
+        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")
+        
+        boxcol=layout.box().column(align=1)
+        boxcol.label(text="Danger Zone")
+        boxcolrow=boxcol.row()
+        boxcolrow.operator("render.apply_overrides", text="Apply Overrides",icon="ERROR")
+        boxcolrow.operator("render.restore_overrides", text="Restore Overrides",icon="ERROR")        
+
+
+        
+##---------------------------RELOAD IMAGES------------------
+
+class reloadImages (bpy.types.Operator):
+    bl_idname = "image.reload_images_osc"
+    bl_label = "Reload Images" 
+    bl_options =  {"REGISTER","UNDO"}
+    def execute(self,context):
+        for imgs in bpy.data.images:
+            imgs.reload()
+        return{"FINISHED"}
+
+##-----------------------------RESYM---------------------------
+
+def defResym(self, OFFSET, SUBD):
+    
+    ##EDIT    
+    bpy.ops.object.mode_set(mode='EDIT', toggle=False)
+    
+    ##SETEO VERTEX MODE        
+    bpy.context.tool_settings.mesh_select_mode[0]=1
+    bpy.context.tool_settings.mesh_select_mode[1]=0
+    bpy.context.tool_settings.mesh_select_mode[2]=0
+    
+    OBJETO = bpy.context.active_object
+    OBDATA = bmesh.from_edit_mesh(OBJETO.data)
+    OBDATA.select_flush(False)
+
+    if SUBD > 0:
+        USESUB=True
+        SUBLEV=SUBD
+    else:
+        USESUB=False
+        SUBLEV=1
+    
+    ## IGUALO VERTICES CERCANOS A CERO      
+    for vertice in OBDATA.verts[:]:
+        if abs(vertice.co[0]) < OFFSET  : 
+            vertice.co[0] = 0              
+            
+    ##BORRA IZQUIERDA
+    bpy.ops.mesh.select_all(action="DESELECT")
+       
+    for vertices in OBDATA.verts[:]:
+      if vertices.co[0] < 0:
+        vertices.select = 1
+    
+    ## BORRA COMPONENTES
+    bpy.ops.mesh.delete()
+    ## SUMA MIRROR
+    bpy.ops.object.modifier_add(type='MIRROR')    
+    ## SELECCIONO TODOS LOS COMPONENTES
+    bpy.ops.mesh.select_all(action="SELECT")
+    ## CREO UV TEXTURE DEL SIMETRICO
+    bpy.ops.mesh.uv_texture_add()
+    ## SETEO VARIABLE CON LA CANTIDAD DE UVS, RESTO UNO Y LE DOY UN NOMBRE
+    LENUVLISTSIM = len(bpy.data.objects[OBJETO.name].data.uv_textures)
+    LENUVLISTSIM = LENUVLISTSIM - 1
+    OBJETO.data.uv_textures[LENUVLISTSIM:][0].name = "SYMMETRICAL"
+    ## UNWRAP
+    bpy.ops.uv.unwrap(method='ANGLE_BASED', fill_holes=True, correct_aspect=False, use_subsurf_data=USESUB, uv_subsurf_level=SUBLEV)
+    ## MODO OBJETO
+    bpy.ops.object.mode_set(mode="OBJECT", toggle= False) 
+    ## APLICO MIRROR
+    bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Mirror")
+    ## VUELVO A EDIT MODE
+    bpy.ops.object.mode_set(mode="EDIT", toggle= False)
+    OBDATA = bmesh.from_edit_mesh(OBJETO.data)
+    OBDATA.select_flush(0)
+    ## CREO UV TEXTURE DEL ASIMETRICO
+    bpy.ops.mesh.uv_texture_add()
+    ## SETEO VARIABLE CON LA CANTIDAD DE UVS, RESTO UNO Y LE DOY UN NOMBRE
+    LENUVLISTASIM = len(OBJETO.data.uv_textures)
+    LENUVLISTASIM = LENUVLISTASIM  - 1
+    OBJETO.data.uv_textures[LENUVLISTASIM:][0].name = "ASYMMETRICAL"
+    ## SETEO UV ACTIVO
+    OBJETO.data.uv_textures.active = OBJETO.data.uv_textures["ASYMMETRICAL"]
+    ## UNWRAP
+    bpy.ops.uv.unwrap(method='ANGLE_BASED', fill_holes=True, correct_aspect=False, use_subsurf_data=USESUB, uv_subsurf_level=SUBLEV)
+    
+
+class resym (bpy.types.Operator):
+    bl_idname = "mesh.resym_osc"
+    bl_label = "ReSym Mesh" 
+    bl_options =  {"REGISTER","UNDO"}
+    OFFSET=bpy.props.FloatProperty(name="Offset", default=0.001, min=-0, max=0.1)
+    SUBD=bpy.props.IntProperty(name="Subdivisions Levels", default=0, min=0, max=4) 
+    def execute(self,context):
+        defResym(self, self.OFFSET, self.SUBD)
+        return{"FINISHED"}     
+        
+## -----------------------------------SELECT LEFT---------------------
+def side (self, nombre, offset): 
+    
+    bpy.ops.object.mode_set(mode="EDIT", toggle=0)
+    
+    OBJECT=bpy.context.active_object        
+    ODATA = bmesh.from_edit_mesh(OBJECT.data)
+    MODE=bpy.context.mode
+
+    
+    
+    ##SETEO VERTEX MODE
+    
+    bpy.context.tool_settings.mesh_select_mode[0]=1
+    bpy.context.tool_settings.mesh_select_mode[1]=0
+    bpy.context.tool_settings.mesh_select_mode[2]=0
+    
+    ## DESELECCIONA TODO
+    for VERTICE in ODATA.verts[:]:
+        VERTICE.select = False
+    
+    if nombre == False:
+        ## CONDICION QUE SI EL VERTICE ES MENOR A 0 LO SELECCIONA  
+        for VERTICES in ODATA.verts[:]:
+            if VERTICES.co[0] < (offset):
+                VERTICES.select = 1  
+    else:
+        ## CONDICION QUE SI EL VERTICE ES MENOR A 0 LO SELECCIONA        
+        for VERTICES in ODATA.verts[:]:
+            if VERTICES.co[0] > (offset):
+                VERTICES.select = 1                              
+
+    ODATA.select_flush(False)
+    
+    bpy.ops.object.mode_set(mode="EDIT", toggle=0)    
+
+
+class SelectMenor (bpy.types.Operator):
+    bl_idname = "mesh.select_side_osc"
+    bl_label = "Select Side" 
+    bl_options =  {"REGISTER","UNDO"}
+    
+    side = bpy.props.BoolProperty(name="Greater than zero", default=False)
+    offset = bpy.props.FloatProperty(name="Offset", default=0)
+    def execute(self,context):  
+        
+        side(self, self.side, self.offset)
+               
+        return{"FINISHED"}        
+           
+    
+    
+    
+
+##-----------------------------------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
+        for SHAPE in ACTOBJ.data.shape_keys.key_blocks:
+            if len(SHAPE.name) > 7:
+                SHAPE.name=SHAPE.name[:8]
+                
+        ## DUPLICO SHAPES Y CONECTO GRUPO
+        for SHAPE in ACTOBJ.data.shape_keys.key_blocks[1:]:
+            SHAPE.value=1
+            bpy.ops.object.shape_key_add(from_mix=True)
+            ACTOBJ.data.shape_keys.key_blocks[-1].name=SHAPE.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=SHAPE.name[:8]+"_R"
+            ACTOBJ.data.shape_keys.key_blocks[-1].vertex_group="_R"
+            bpy.ops.object.shape_key_clear() 
+        
+        print ("OPERACION TERMINADA")        
+        return{"FINISHED"}
+    
+    
+##----------------------------SHAPES LAYOUT-----------------------
+
+class CreaShapesLayout(bpy.types.Operator):
+    bl_idname = "mesh.create_symmetrical_layout_osc"
+    bl_label = "Symmetrical Layout"
+    bl_options =  {"REGISTER","UNDO"}
+    def execute(self, context):
+        
+  
+        SEL_OBJ= bpy.context.active_object
+        LISTA_KEYS = bpy.context.active_object.data.shape_keys.key_blocks[:]
+        
+        ##MODOS
+        EDITMODE = "bpy.ops.object.mode_set(mode='EDIT')"
+        OBJECTMODE = "bpy.ops.object.mode_set(mode='OBJECT')"
+        POSEMODE = "bpy.ops.object.mode_set(mode='POSE')"
+        
+        ##INDICE DE DRIVERS
+        varindex = 0
+        
+        ##CREA NOMBRES A LA ARMATURE
+        amt = bpy.data.armatures.new("ArmatureData")
+        ob = bpy.data.objects.new("RIG_LAYOUT_"+SEL_OBJ.name, amt)
+        
+        ##LINK A LA ESCENA
+        scn = bpy.context.scene
+        scn.objects.link(ob)
+        scn.objects.active = ob
+        ob.select = True
+        
+        
+        
+        
+        
+        eval(EDITMODE)
+        gx = 0
+        gy = 0
+        
+        
+        
+        for keyblock in LISTA_KEYS:
+            print ("KEYBLOCK EN CREACION DE HUESOS "+keyblock.name)
+        
+                
+            if keyblock.name[-2:] != "_L":
+                if keyblock.name[-2:] != "_R":
+        
+                    ##CREA HUESOS
+                
+                    bone = amt.edit_bones.new(keyblock.name)
+                    bone.head = (gx,0,0)
+                    bone.tail = (gx,0,1)
+                    gx = gx+2.2
+                    bone = amt.edit_bones.new(keyblock.name+"_CTRL")
+                    bone.head = (gy,0,0)
+                    bone.tail = (gy,0,0.2)
+                    gy = gy+2.2     
+                  
+                    ##SETEA ARMATURE ACTIVA
+                    bpy.context.scene.objects.active = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name]
+                    bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].select = 1
+                    ##DESELECCIONA (modo edit)
+                    eval(EDITMODE)
+                    bpy.ops.armature.select_all(action="DESELECT")
+                    
+                    ##EMPARENTA HUESOS
+                
+                    ##HUESO ACTIVO
+                    eval(OBJECTMODE)
+                    bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].data.bones.active = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].data.bones[keyblock.name] 
+                    ##MODO EDIT
+                    eval(EDITMODE)       
+                    ##DESELECCIONA (modo edit)
+                    bpy.ops.armature.select_all(action="DESELECT")    
+                    ##MODO OBJECT  
+                    eval(OBJECTMODE)    
+                    ##SELECCIONA UN HUESO
+                    bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].data.bones[keyblock.name+"_CTRL"].select = 1
+                    eval(EDITMODE)    
+                    ##EMPARENTA
+                    bpy.ops.armature.parent_set(type="OFFSET")
+                    ##DESELECCIONA (modo edit)
+                    bpy.ops.armature.select_all(action="DESELECT")      
+                     
+                    ##LE HAGO UNA VARIABLE DE PLACEBO
+                    keyblock.driver_add("value") 
+                    SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.expression = "var+var_001"
+                    SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables.new()
+                    SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables.new()           
+                      
+                    
+                    varindex = varindex + 1 
+        
+        
+        
+        for keyblock in LISTA_KEYS:
+            print ("KEYBLOCK SEGUNDA VUELTA :"+keyblock.name)    
+            
+            if keyblock.name[-2:] == "_L":
+                print("igual a L") 
+        
+                ##CREA DRIVERS Y LOS CONECTA
+                keyblock.driver_add("value")
+                keyblock.driver_add("value")
+                
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.expression = "var+var_001"
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables.new()
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables.new()
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var'].targets[0].id  = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name] 
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var'].targets[0].bone_target   = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].data.bones[(keyblock.name[:-2])+"_CTRL"].name
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var'].type = 'TRANSFORMS' 
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var'].targets[0].transform_space= "LOCAL_SPACE"        
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var'].targets[0].transform_type= "LOC_X"  
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var_001'].targets[0].id = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name]
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var_001'].targets[0].bone_target   = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].data.bones[(keyblock.name[:-2])+"_CTRL"].name    
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var_001'].type = 'TRANSFORMS'            
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var_001'].targets[0].transform_space= "LOCAL_SPACE"        
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var_001'].targets[0].transform_type= "LOC_Y"    
+                        
+                             
+                varindex = varindex + 1
+            
+                
+        
+          
+            if keyblock.name[-2:] == "_R":
+                print("igual a R") 
+                
+                ##CREA DRIVERS Y LOS CONECTA
+                keyblock.driver_add("value")
+                keyblock.driver_add("value")        
+                
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.expression = "-var+var_001"
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables.new()
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables.new()
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var'].targets[0].id  = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name] 
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var'].targets[0].bone_target   = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].data.bones[(keyblock.name[:-2])+"_CTRL"].name      
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var'].type = 'TRANSFORMS' 
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var'].targets[0].transform_space= "LOCAL_SPACE"                 
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var'].targets[0].transform_type= "LOC_X"  
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var_001'].targets[0].id = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name]
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var_001'].targets[0].bone_target   = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].data.bones[(keyblock.name[:-2])+"_CTRL"].name    
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var_001'].type = 'TRANSFORMS'            
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var_001'].targets[0].transform_space= "LOCAL_SPACE"        
+                SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var_001'].targets[0].transform_type= "LOC_Y" 
+                        
+                varindex = varindex + 1       
+                
+                
+                
+                
+        ## CREO DATA PARA SLIDERS
+        
+        ## creo data para los contenedores
+        verticess = [(-1,1,0),(1,1,0),(1,-1,0),(-1,-1,0)]
+        edgess = [(0,1),(1,2),(2,3),(3,0)]
+        
+        mesh = bpy.data.meshes.new(keyblock.name+"_data_container")
+        object = bpy.data.objects.new("GRAPHIC_CONTAINER", mesh)
+        bpy.context.scene.objects.link(object)
+        mesh.from_pydata(verticess,edgess,[])
+        
+        ## PONGO LOS LIMITES Y SETEO ICONOS
+        for keyblock in LISTA_KEYS:
+            print ("KEYBLOCK EN CREACION DE HUESOS "+keyblock.name)
+        
+                
+            if keyblock.name[-2:] != "_L":
+                if keyblock.name[-2:] != "_R":
+                    ## SETEO ICONOS
+                    bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name].custom_shape = bpy.data.objects['GRAPHIC_CONTAINER']
+                    bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].custom_shape = bpy.data.objects['GRAPHIC_CONTAINER']
+                    ## SETEO CONSTRAINTS
+                    eval(OBJECTMODE)
+                    bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].data.bones.active = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].data.bones[keyblock.name+"_CTRL"]
+                    ## SUMO CONSTRAINT
+                    eval(POSEMODE)
+                    bpy.ops.pose.constraint_add(type="LIMIT_LOCATION")
+                    
+                    bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].min_x = -1
+                    bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].use_min_x = 1
+                    bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].min_z = 0
+                    bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].use_min_z = 1
+                    bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].min_y = -1
+                    bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].use_min_y = 1
+                    
+                    bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].max_x =  1
+                    bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].use_max_x = 1
+                    bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].max_z =  0
+                    bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].use_max_z = 1
+                    bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].max_y =  1
+                    bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].use_max_y = 1
+                    
+                    bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].owner_space  = "LOCAL"
+                    
+        ## PARA QUE EL TEXTO FUNCIONE PASAMOS A OBJECT MODE
+        eval(OBJECTMODE)
+        
+        ## TEXTOS
+        for keyblock in LISTA_KEYS:
+            print ("KEYBLOCK EN TEXTOS "+keyblock.name)
+        
+                
+            if keyblock.name[-2:] != "_L":
+                if keyblock.name[-2:] != "_R":            
+                    ## creo tipografias
+                    bpy.ops.object.text_add(location=(0,0,0))
+                    bpy.data.objects['Text'].data.body = keyblock.name
+                    bpy.data.objects['Text'].name = "TEXTO_"+keyblock.name
+                    bpy.data.objects["TEXTO_"+keyblock.name].rotation_euler[0] = math.pi/2
+                    bpy.data.objects["TEXTO_"+keyblock.name].location.x = -1
+                    bpy.data.objects["TEXTO_"+keyblock.name].location.z = -1
+                    bpy.data.objects["TEXTO_"+keyblock.name].data.size = .2
+                    ## SETEO OBJETO ACTIVO
+                    bpy.context.scene.objects.active = bpy.data.objects["TEXTO_"+keyblock.name]
+                    bpy.ops.object.constraint_add(type="COPY_LOCATION")
+                    bpy.data.objects["TEXTO_"+keyblock.name].constraints['Copy Location'].target = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name]
+                    bpy.data.objects["TEXTO_"+keyblock.name].constraints['Copy Location'].subtarget = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].data.bones[keyblock.name].name
+                    
+                    bpy.ops.object.select_all(action="DESELECT")
+                    bpy.data.objects["TEXTO_"+keyblock.name].select = 1 
+                    bpy.context.scene.objects.active = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name]
+                    bpy.ops.object.parent_set(type="OBJECT") 
+                    
+        
+        ## EMPARENTA ICONO
+        
+        bpy.ops.object.select_all(action="DESELECT")
+        bpy.data.objects["GRAPHIC_CONTAINER"].select = 1 
+        bpy.context.scene.objects.active = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name]
+        bpy.ops.object.parent_set(type="OBJECT")
+        
+        eval(POSEMODE)  
+  
+        ## BORRA DRIVERS DE QUE NO SEAN LEFT O RIGHT
+        for driver in SEL_OBJ.data.shape_keys.animation_data.drivers:
+            if driver.data_path.count("_L") == False and driver.data_path.count("_R") == False :
+                SEL_OBJ.data.shape_keys.driver_remove(driver.data_path) 
+  
+  
+  
+  
+              
+        return{"FINISHED"}    
+        
+##----------------------------CREATE LMR GROUPS-------------------
+def createLMRGroups(self, FACTORVG, ADDVG):
+    ## SETEO VERTEX MODE EDIT
+    bpy.context.window.screen.scene.tool_settings.mesh_select_mode[0] = 1
+    bpy.context.window.screen.scene.tool_settings.mesh_select_mode[1] = 0
+    bpy.context.window.screen.scene.tool_settings.mesh_select_mode[2] = 0
+    
+    ## VARIABLES
+    ACTOBJ=bpy.context.active_object
+    bpy.ops.object.mode_set(mode="EDIT", toggle=False)
+    bpy.ops.mesh.select_all(action='DESELECT')
+    bpy.ops.object.mode_set(mode="OBJECT")
+    GRUPOS=["_L","_R"]
+    MIRRORINDEX=0      
+            
+    for LADO in GRUPOS:
+        if MIRRORINDEX == 0:
+            ## SUMO DOS VG
+            bpy.ops.object.vertex_group_add()        
+            ## ASIGNO TODOS LOS VERTICES AL GRUPO
+            bpy.ops.object.mode_set(mode='EDIT', toggle=False)
+            bpy.ops.mesh.select_all(action='SELECT')
+            bpy.ops.object.vertex_group_assign(new=False)
+            bpy.ops.mesh.select_all(action='DESELECT')
+            bpy.ops.object.mode_set(mode='WEIGHT_PAINT', toggle=False)        
+            ## SETEO VALORES
+            for VERTICE in ACTOBJ.data.vertices:
+                VERTICE.groups[-1].weight=(VERTICE.co[0]*FACTORVG)+ADDVG    
+            ## RENOMBRO
+            ACTOBJ.vertex_groups[-1].name=LADO    
+    
+        else:
+            ## SUMO DOS VG
+            bpy.ops.object.vertex_group_add()        
+            ## ASIGNO TODOS LOS VERTICES AL GRUPO
+            bpy.ops.object.mode_set(mode='EDIT', toggle=False)
+            bpy.ops.mesh.select_all(action='SELECT')
+            bpy.ops.object.vertex_group_assign(new=False)
+            bpy.ops.mesh.select_all(action='DESELECT')
+            bpy.ops.object.mode_set(mode='WEIGHT_PAINT', toggle=False)       
+            ## SETEO VALORES
+            for VERTICE in ACTOBJ.data.vertices:
+                VERTICE.groups[-1].weight=(-VERTICE.co[0]*FACTORVG)+ADDVG         
+            ## RENOMBRO
+            ACTOBJ.vertex_groups[-1].name=LADO
+        ## CAMBIO MIRROR INDEX
+        MIRRORINDEX+=1
+        
+    ## SETEO GRUPO ACTIVO   
+    ACTOBJ.vertex_groups.active_index=len(ACTOBJ.vertex_groups)       
+
+
+class CreaGrupos(bpy.types.Operator):
+    bl_idname = "mesh.create_lmr_groups_osc"
+    bl_label = "Create LM groups"
+    bl_description = "Create LM groups"
+    bl_options = {'REGISTER', 'UNDO'}
+
+    FACTORVG= bpy.props.FloatProperty(name="Factor", default=1, min=0, max=1000)
+    ADDVG= bpy.props.FloatProperty(name="Addition", default=.5, min=0, max=1000)
+    
+    def execute(self, context):
+
+        createLMRGroups(self, self.FACTORVG, self.ADDVG)
+
+        return {'FINISHED'}
+    
+##------------------------------NORMALS OUTSIDE--------------------    
+class normalsOutside(bpy.types.Operator):  
+    bl_idname = "mesh.normals_outside_osc"
+    bl_label = "Normals Outside"
+    bl_options =  {"REGISTER","UNDO"}
+    def execute(self, context):
+        for OBJETO in bpy.context.selected_objects:
+            ## SETEA OBJETO ACTIVO
+            bpy.data.scenes[0].objects.active = bpy.data.objects[OBJETO.name]
+            ## EDICION
+            bpy.ops.object.mode_set(mode='EDIT', toggle=False)
+            ## SELECCIONA TODOS LOS COMPONENTES 
+            bpy.ops.mesh.select_all(action="SELECT")
+            ## EXPULSA NORMALES
+            bpy.ops.mesh.normals_make_consistent(inside=False)
+            ## EDICION
+            bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
+        return{"FINISHED"}
+
+
+##------------------------------DISTRIBUTE---------------------------
+
+ 
+
+def distributeDef(self, context, X, Y, Z):    
+
+    ## LISTA DE OBJETOS
+    OBJETOS = list(bpy.context.selected_objects)
+
+    if X == True:
+        ## LISTA VACIA
+        LISTOBJ=[]
+        
+        ## LISTA DE OBJETOS Y NOMBRES
+        for OBJETO in OBJETOS:
+            LISTOBJ.append((OBJETO.location[0],OBJETO.name))
+        
+        ## REORDENO
+        LISTOBJ.sort()
+        
+        ## AVERIGUO MINIMO Y MAXIMO
+        MIN = min(LISTOBJ)[0]
+        MAX = max(LISTOBJ)[0]
+        DIF = (MAX - MIN) / (len(OBJETOS)-1)
+        TEMPDIF = 0
+        
+        print(MIN,MAX,DIF,TEMPDIF)
+        
+        ## ORDENO
+        for OBJETO in LISTOBJ:
+            bpy.data.objects[OBJETO[1]].location[0]= MIN+TEMPDIF
+            TEMPDIF+=DIF
+    
+
+    if Y == True:
+        ## LISTA VACIA
+        LISTOBJ=[]
+        
+        ## LISTA DE OBJETOS Y NOMBRES
+        for OBJETO in OBJETOS:
+            LISTOBJ.append((OBJETO.location[1],OBJETO.name))
+        
+        ## REORDENO
+        LISTOBJ.sort()
+        
+        ## AVERIGUO MINIMO Y MAXIMO
+        MIN = min(LISTOBJ)[0]
+        MAX = max(LISTOBJ)[0]
+        DIF = (MAX - MIN) / (len(OBJETOS)-1)
+        TEMPDIF = 0
+        
+        print(MIN,MAX,DIF,TEMPDIF)
+        
+        ## ORDENO
+        for OBJETO in LISTOBJ:
+            bpy.data.objects[OBJETO[1]].location[1]= MIN+TEMPDIF
+            TEMPDIF+=DIF
+    
+    if Z == True:
+        ## LISTA VACIA
+        LISTOBJ=[]
+        
+        ## LISTA DE OBJETOS Y NOMBRES
+        for OBJETO in OBJETOS:
+            LISTOBJ.append((OBJETO.location[2],OBJETO.name))
+        
+        ## REORDENO
+        LISTOBJ.sort()
+        
+        ## AVERIGUO MINIMO Y MAXIMO
+        MIN = min(LISTOBJ)[0]
+        MAX = max(LISTOBJ)[0]
+        DIF = (MAX - MIN) / (len(OBJETOS)-1)
+        TEMPDIF = 0
+        
+        print(MIN,MAX,DIF,TEMPDIF)
+        
+        ## ORDENO
+        for OBJETO in LISTOBJ:
+            bpy.data.objects[OBJETO[1]].location[2]= MIN+TEMPDIF
+            TEMPDIF+=DIF
+    
+
+
+
+      
+class DistributeMinMaxApply (bpy.types.Operator):
+    bl_idname = "object.distribute_apply_osc"
+    bl_label = "Distribute Objects" 
+    bl_options =  {"REGISTER","UNDO"}
+        
+    X=bpy.props.BoolProperty(default=False, name="X")
+    Y=bpy.props.BoolProperty(default=False, name="Y")
+    Z=bpy.props.BoolProperty(default=False, name="Z")
+
+    def execute(self, context):
+
+        distributeDef(self, context, self.X, self.Y, self.Z)
+        
+        return{"FINISHED"}            
+          
+
+
+##--------------------------------RENDER LAYER AT TIME----------------------------
+
+
+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=[]
+        try:
+            if OBJECT.type=="MESH" or OBJECT.type == "META":
+                for SLOT in OBJECT.material_slots[:]:
+                    SLOTLIST.append(SLOT.material)
+               
+                LISTMAT.append((OBJECT,SLOTLIST))
+
+        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:
+            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:
+                for OBJECT in bpy.data.groups[OVERRIDE[0]].objects[:]:
+                    if OBJECT.type == "MESH" or OBJECT.type == "META":
+                        for SLOT in OBJECT.material_slots[:]:
+                            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]
+
+        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.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
+            try:
+                for SLOT in OBJECT[1]:
+                    OBJECT[0].material_slots[SLOTIND].material=SLOT
+                    SLOTIND+=1
+            except:
+                print("OUT OF RANGE")
+        # RESTAURO FRAMES
+        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      
+
+
+class renderAll (bpy.types.Operator):
+    bl_idname="render.render_layers_at_time_osc"
+    bl_label="Render layers at time"
+    
+    FRAMETYPE=bpy.props.BoolProperty(default=False)
+
+    
+    def execute(self,context):
+        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):    
+        
+    ACTSCENE=bpy.context.scene
+    LISTMAT=[]
+    SCENES=bpy.data.scenes[:]
+    SCENELIST=bpy.context.scene.OscSelScenes
+    FC=bpy.context.scene.frame_current    
+    FS=bpy.context.scene.frame_start
+    FE=bpy.context.scene.frame_end    
+    ## GUARDO MATERIALES DE OBJETOS EN GRUPOS
+    for OBJECT in bpy.data.objects[:]:
+        SLOTLIST=[]
+        try:
+            if OBJECT.type=="MESH" or OBJECT.type == "META":
+                for SLOT in OBJECT.material_slots[:]:
+                    SLOTLIST.append(SLOT.material)
+               
+                LISTMAT.append((OBJECT,SLOTLIST))
+        except:
+            pass
+        
+  
+    for SCENE in SCENES:
+        if SCENE.name in SCENELIST:
+            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:
+                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:
+                    for OBJECT in bpy.data.groups[OVERRIDE[0]].objects[:]:
+                        if OBJECT.type == "MESH" or OBJECT.type == "META":
+                            for SLOT in OBJECT.material_slots[:]:
+                                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]
+
+            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.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
+                try:
+                    for SLOT in OBJECT[1]:
+                        OBJECT[0].material_slots[SLOTIND].material=SLOT
+                        SLOTIND+=1
+                except:
+                    print("OUT OF RANGE")
+                    
+            # RESTAURO FRAMES
+            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
+
+
+class renderSelected (bpy.types.Operator):
+    bl_idname="render.render_selected_scenes_osc"
+    bl_label="Render Selected Scenes"
+
+    FRAMETYPE=bpy.props.BoolProperty(default=False)
+ 
+    def execute(self,context):
+        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):
+    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=[]
+        try:
+            if OBJECT.type=="MESH" or OBJECT.type == "META":
+                for SLOT in OBJECT.material_slots[:]:
+                    SLOTLIST.append(SLOT.material)               
+                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:
+        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:
+            for OBJECT in bpy.data.groups[OVERRIDE[0]].objects[:]:
+                if OBJECT.type == "MESH" or OBJECT.type == "META":
+                    for SLOT in OBJECT.material_slots[:]:
+                        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]
+
+    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.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
+        try:
+            for SLOT in OBJECT[1]:
+                OBJECT[0].material_slots[SLOTIND].material=SLOT
+                SLOTIND+=1
+        except:
+            print("FUERA DE RANGO")    
+
+    # RESTAURO FRAMES
+    if FRAMETYPE == True:
+        SCENE.frame_start=FS
+        SCENE.frame_end=FE
+        SCENE.frame_end=FE
+        SCENE.frame_start=FS 
+
+
+class renderCurrent (bpy.types.Operator):
+    bl_idname="render.render_current_scene_osc"
+    bl_label="Render Current Scene"
+
+    FRAMETYPE=bpy.props.BoolProperty(default=False)
+
+    def execute(self,context):
+        
+        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) 
+
+
+class renderCrop (bpy.types.Operator):
+    bl_idname="render.render_crop_osc"
+    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
+        PARTS=bpy.context.scene.rcPARTS
+        PARTS=PARTS+1
+        while START < PARTS:
+            PARTES.append(START)
+            START=START+1
+        print(PARTES)
+        
+
+        
+        ##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
+        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
+        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
+            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")
+                
+        return{"FINISHED"}
+
+
+    
+##------------------------ SEARCH AND SELECT ------------------------
+
+## SETEO VARIABLE DE ENTORNO
+bpy.types.Scene.SearchAndSelectOt = bpy.props.StringProperty(default="Object name initials")
+
+
+class SearchAndSelectOt(bpy.types.Operator):
+    bl_idname = "object.search_and_select_osc"
+    bl_label = "Search And Select"
+    bl_options =  {"REGISTER","UNDO"}
+    def execute(self, context): 
+        for objeto in bpy.context.scene.objects:
+            variableNombre = bpy.context.scene.SearchAndSelectOt
+            if objeto.name.startswith(variableNombre) == True :
+                objeto.select = 1
+                print("Selecciona:" + str(objeto.name))
+        return{"FINISHED"}
+
+##-------------------------RENAME OBJECTS----------------------------------    
+
+## CREO VARIABLE
+bpy.types.Scene.RenameObjectOt = bpy.props.StringProperty(default="Type here")
+
+class renameObjectsOt (bpy.types.Operator):
+    bl_idname = "object.rename_objects_osc"
+    bl_label = "Rename Objects" 
+    bl_options =  {"REGISTER","UNDO"}
+    def execute(self,context):
+
+        ## LISTA
+        listaObj = bpy.context.selected_objects
+        
+        
+        
+        for objeto in listaObj:
+            print (objeto.name)
+            objeto.name = bpy.context.scene.RenameObjectOt
+        return{"FINISHED"}
+
+
+
+##-------------------------RESYM VG---------------------------------- 
+
+
+
+
+class resymVertexGroups (bpy.types.Operator):
+    bl_idname = "mesh.resym_vertex_weights_osc"
+    bl_label = "Resym Vertex Weights" 
+    bl_options =  {"REGISTER","UNDO"}
+    def execute(self,context):
+        
+        OBACTIVO=bpy.context.active_object
+        VGACTIVO=OBACTIVO.vertex_groups.active.index
+        MENORESACERO=[]
+        MAYORESACERO=[]
+        MENORESACEROYSG=[]
+        
+        
+        ## LISTA DE LOS VERTICES QUE ESTAN EN GRUPOS
+        VERTICESENGRUPOS=[0]
+        for vertice in OBACTIVO.data.vertices:
+            if len(vertice.groups.items()) > 0:
+                VERTICESENGRUPOS.append(vertice.index)  
+                
+                
+                
+        ## VERTICES MENORES A CERO
+        for verticeindex in VERTICESENGRUPOS:
+            for indices in OBACTIVO.data.vertices[verticeindex].groups:
+                if indices.group == VGACTIVO:     
+                    if bpy.context.active_object.data.vertices[verticeindex].co[0] < 0:
+                        MENORESACERO.append(bpy.context.active_object.data.vertices[verticeindex].index)
+                        
+        ## VERTICES MENORES A CERO Y SIN GRUPO
+        for vertice in OBACTIVO.data.vertices:
+            if vertice.co[0] < 0:
+                MENORESACEROYSG.append(vertice.index)               
+                
+        
+        ## VERTICES MAYORES A CERO
+        for verticeindex in VERTICESENGRUPOS:
+            for indices in OBACTIVO.data.vertices[verticeindex].groups:
+                if indices.group == VGACTIVO:     
+                    if bpy.context.active_object.data.vertices[verticeindex].co[0] > 0:
+                        MAYORESACERO.append(bpy.context.active_object.data.vertices[verticeindex].index)
+        
+        ## TE MUESTRA LAS LISTAS
+        print("-------------VERTICES EN GRUPOS-----------")        
+        print (VERTICESENGRUPOS)
+        print("-------------MENORES A CERO-----------")
+        print (MENORESACERO)
+        print("-------------MENORES A CERO SIN GRUPO-----------")
+        print (MENORESACEROYSG)
+        print("-------------MAYORES A CERO-----------")
+        print (MAYORESACERO)
+        
+        
+        ## SETEA WORK INDEX      
+        for vertices in MAYORESACERO:
+            for indices in OBACTIVO.data.vertices[vertices].groups:
+                if indices.group == VGACTIVO: 
+                    WORKINDEX = indices.group  
+        
+        ## DESELECCIONO COMPONENTES
+        bpy.ops.object.mode_set(mode="EDIT",toggle=0)
+        bpy.ops.mesh.select_all(action="DESELECT")
+        bpy.ops.object.mode_set(mode="OBJECT",toggle=0)
+        
+        
+        ## SETEO GRUPO
+        for verticemenor in MENORESACEROYSG:
+            for verticemayor in MAYORESACERO:
+                if OBACTIVO.data.vertices[verticemenor].co[0] == -OBACTIVO.data.vertices[verticemayor].co[0]:
+                    if OBACTIVO.data.vertices[verticemenor].co[1] == OBACTIVO.data.vertices[verticemayor].co[1]:   
+                        if OBACTIVO.data.vertices[verticemenor].co[2] == OBACTIVO.data.vertices[verticemayor].co[2]: 
+                            OBACTIVO.data.vertices[verticemenor].select = 1    
+        
+        ## ASSIGNO AL GRUPO
+        bpy.ops.object.mode_set(mode="EDIT",toggle=0)
+        bpy.ops.object.vertex_group_assign(new=False)
+        bpy.ops.mesh.select_all(action="DESELECT")
+        bpy.ops.object.mode_set(mode="OBJECT",toggle=0)
+        
+        ## MODO PINTURA
+        bpy.ops.object.mode_set(mode="WEIGHT_PAINT",toggle=0)
+        
+        
+        ##--------->> VUELVO A CREAR GRUPOS YA QUE LOS INDICES CAMBIARON
+        MENORESACERO=[]
+        MAYORESACERO=[]
+        
+        
+        ## LISTA DE LOS VERTICES QUE ESTAN EN GRUPOS
+        VERTICESENGRUPOS=[0]
+        for vertice in OBACTIVO.data.vertices:
+            if len(vertice.groups.items()) > 0:
+                VERTICESENGRUPOS.append(vertice.index)  
+                
+                
+                
+        ## VERTICES MENORES A CERO
+        for verticeindex in VERTICESENGRUPOS:
+            for indices in OBACTIVO.data.vertices[verticeindex].groups:
+                if indices.group == VGACTIVO:     
+                    if bpy.context.active_object.data.vertices[verticeindex].co[0] < 0:
+                        MENORESACERO.append(bpy.context.active_object.data.vertices[verticeindex].index)
+        
+        
+        
+        
+        ## VERTICES MAYORES A CERO
+        for verticeindex in VERTICESENGRUPOS:
+            for indices in OBACTIVO.data.vertices[verticeindex].groups:
+                if indices.group == VGACTIVO:     
+                    if bpy.context.active_object.data.vertices[verticeindex].co[0] > 0:
+                        MAYORESACERO.append(bpy.context.active_object.data.vertices[verticeindex].index)
+        
+        
+        ## SETEO WEIGHT     
+        for verticemenor in MENORESACERO:
+            for verticemayor in MAYORESACERO:
+                if OBACTIVO.data.vertices[verticemenor].co[0] == -OBACTIVO.data.vertices[verticemayor].co[0]:
+                    if OBACTIVO.data.vertices[verticemenor].co[1] == OBACTIVO.data.vertices[verticemayor].co[1]:   
+                        if OBACTIVO.data.vertices[verticemenor].co[2] == OBACTIVO.data.vertices[verticemayor].co[2]: 
+                            VARINMAY = 0
+                            VARINMEN = 0
+                            while  OBACTIVO.data.vertices[verticemayor].groups[VARINMAY].group != VGACTIVO:
+                                VARINMAY = VARINMAY+1
+                            while  OBACTIVO.data.vertices[verticemenor].groups[VARINMEN].group != VGACTIVO:
+                                VARINMEN = VARINMEN+1
+                            ##print("Varinmay: "+str(VARINMAY)+" .Varinmen "+str(VARINMEN))  
+                            OBACTIVO.data.vertices[verticemenor].groups[VARINMEN].weight = OBACTIVO.data.vertices[verticemayor].groups[VARINMAY].weight
+                            
+        
+                          
+        print("===============(TERMINADO)=============")       
+        return{"FINISHED"}
+
+
+
+##------------------------ SHAPES LAYOUT SYMMETRICA ------------------------
+
+
+
+class CreateLayoutAsymmetrical(bpy.types.Operator):
+    bl_idname = "mesh.create_asymmetrical_layout_osc"
+    bl_label = "Asymmetrical Layout"
+    bl_options =  {"REGISTER","UNDO"}
+    def execute(self, context): 
+                
+        SEL_OBJ= bpy.context.active_object
+        LISTA_KEYS = bpy.context.active_object.data.shape_keys.key_blocks
+        
+        ##MODOS
+        EDITMODE = "bpy.ops.object.mode_set(mode='EDIT')"
+        OBJECTMODE = "bpy.ops.object.mode_set(mode='OBJECT')"
+        POSEMODE = "bpy.ops.object.mode_set(mode='POSE')"
+        
+        ##INDICE DE DRIVERS
+        varindex = 0
+        
+        ##CREA NOMBRES A LA ARMATURE
+        amtas = bpy.data.armatures.new("ArmatureData")
+        obas = bpy.data.objects.new("RIG_LAYOUT_"+SEL_OBJ.name, amtas)
+        
+        ##LINK A LA ESCENA
+        scn = bpy.context.scene
+        scn.objects.link(obas)
+        scn.objects.active = obas
+        obas.select = True
+        
+        
+        
+        
+        
+        eval(EDITMODE)
+        gx = 0
+        gy = 0
+        
+        
+        
+        for keyblock in LISTA_KEYS:
+            print ("KEYBLOCK EN CREACION DE HUESOS "+keyblock.name)
+        
+                
+            if keyblock.name[-2:] != "_L":
+                if keyblock.name[-2:] != "_R":
+        
+                    ##CREA HUESOS
+                
+                    bone = amtas.edit_bones.new(keyblock.name)
+                    bone.head = (gx,0,0)
+                    bone.tail = (gx,0,1)
+                    gx = gx+2.2
+                    bone = amtas.edit_bones.new(keyblock.name+"_CTRL")
+                    bone.head = (gy,0,0)
+                    bone.tail = (gy,0,0.2)
+                    gy = gy+2.2     
+                  
+                    ##SETEA ARMATURE ACTIVA
+                    bpy.context.scene.objects.active = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name]
+                    bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].select = 1
+                    ##DESELECCIONA (modo edit)
+                    eval(EDITMODE)
+                    bpy.ops.armature.select_all(action="DESELECT")
+                    
+                    ##EMPARENTA HUESOS
+                
+                    ##HUESO ACTIVO
+                    eval(OBJECTMODE)
+                    bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].data.bones.active = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].data.bones[keyblock.name] 
+                    ##MODO EDIT
+                    eval(EDITMODE)       
+                    ##DESELECCIONA (modo edit)
+                    bpy.ops.armature.select_all(action="DESELECT")    
+                    ##MODO OBJECT  
+                    eval(OBJECTMODE)    
+                    ##SELECCIONA UN HUESO
+                    bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].data.bones[keyblock.name+"_CTRL"].select = 1
+                    eval(EDITMODE)    
+                    ##EMPARENTA
+                    bpy.ops.armature.parent_set(type="OFFSET")
+                    ##DESELECCIONA (modo edit)
+                    bpy.ops.armature.select_all(action="DESELECT")      
+                     
+                    ##CREA DRIVERS Y LOS CONECTA
+                    keyblock.driver_add("value")
+                    keyblock.driver_add("value")        
+                    
+                    SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.expression = "-var+var_001"
+                    SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables.new()
+                    SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables.new()
+                    SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var'].targets[0].id  = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name] 
+                    SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var'].targets[0].bone_target   = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].data.bones[(keyblock.name)+"_CTRL"].name      
+                    SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var'].type = 'TRANSFORMS' 
+                    SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var'].targets[0].transform_space= "LOCAL_SPACE"                 
+                    SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var'].targets[0].transform_type= "LOC_X"  
+                    SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var_001'].targets[0].id = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name]
+                    SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var_001'].targets[0].bone_target   = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].data.bones[(keyblock.name)+"_CTRL"].name    
+                    SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var_001'].type = 'TRANSFORMS'            
+                    SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var_001'].targets[0].transform_space= "LOCAL_SPACE"        
+                    SEL_OBJ.data.shape_keys.animation_data.drivers[varindex].driver.variables['var_001'].targets[0].transform_type= "LOC_Y" 
+                          
+                    
+                    varindex = varindex + 1 
+        
+        
+        
+             
+                
+                
+                
+                
+        ## CREO DATA PARA SLIDERS
+        
+        ## creo data para los contenedores
+        verticess = [(-.1,1,0),(.1,1,0),(.1,0,0),(-.1,0,0)]
+        edgess = [(0,1),(1,2),(2,3),(3,0)]
+        
+        mesh = bpy.data.meshes.new(keyblock.name+"_data_container")
+        object = bpy.data.objects.new("GRAPHIC_CONTAINER_AS", mesh)
+        bpy.context.scene.objects.link(object)
+        mesh.from_pydata(verticess,edgess,[])
+        
+        ## PONGO LOS LIMITES Y SETEO ICONOS
+        for keyblock in LISTA_KEYS:
+            print ("KEYBLOCK EN CREACION DE HUESOS "+keyblock.name)
+            ## SETEO ICONOS
+            bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name].custom_shape = bpy.data.objects['GRAPHIC_CONTAINER_AS']
+            bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].custom_shape = bpy.data.objects['GRAPHIC_CONTAINER_AS']
+            ## SETEO CONSTRAINTS
+            eval(OBJECTMODE)
+            bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].data.bones.active = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].data.bones[keyblock.name+"_CTRL"]
+            ## SUMO CONSTRAINT
+            eval(POSEMODE)
+            bpy.ops.pose.constraint_add(type="LIMIT_LOCATION")
+            
+            bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].min_x = 0
+            bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].use_min_x = 1
+            bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].min_z = 0
+            bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].use_min_z = 1
+            bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].min_y = 0
+            bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].use_min_y = 1
+            
+            bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].max_x =  0
+            bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].use_max_x = 1
+            bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].max_z =  0
+            bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].use_max_z = 1
+            bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].max_y =  1
+            bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].use_max_y = 1
+            
+            bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].pose.bones[keyblock.name+"_CTRL"].constraints['Limit Location'].owner_space  = "LOCAL"
+                    
+        ## PARA QUE EL TEXTO FUNCIONE PASAMOS A OBJECT MODE
+        eval(OBJECTMODE)
+        
+        ## TEXTOS
+        for keyblock in LISTA_KEYS:
+            print ("KEYBLOCK EN TEXTOS "+keyblock.name)            
+            ## creo tipografias
+            bpy.ops.object.text_add(location=(0,0,0))
+            bpy.data.objects['Text'].data.body = keyblock.name
+            bpy.data.objects['Text'].name = "TEXTO_"+keyblock.name
+            bpy.data.objects["TEXTO_"+keyblock.name].rotation_euler[0] = math.pi/2
+            bpy.data.objects["TEXTO_"+keyblock.name].location.x = -1
+            bpy.data.objects["TEXTO_"+keyblock.name].location.z = -1
+            bpy.data.objects["TEXTO_"+keyblock.name].data.size = .2
+            ## SETEO OBJETO ACTIVO
+            bpy.context.scene.objects.active = bpy.data.objects["TEXTO_"+keyblock.name]
+            bpy.ops.object.constraint_add(type="COPY_LOCATION")
+            bpy.data.objects["TEXTO_"+keyblock.name].constraints['Copy Location'].target = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name]
+            bpy.data.objects["TEXTO_"+keyblock.name].constraints['Copy Location'].subtarget = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name].data.bones[keyblock.name].name
+            
+            bpy.ops.object.select_all(action="DESELECT")
+            bpy.data.objects["TEXTO_"+keyblock.name].select = 1 
+            bpy.context.scene.objects.active = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name]
+            bpy.ops.object.parent_set(type="OBJECT") 
+            
+        
+        ## EMPARENTA ICONO
+        
+        bpy.ops.object.select_all(action="DESELECT")
+        bpy.data.objects["GRAPHIC_CONTAINER_AS"].select = 1 
+        bpy.context.scene.objects.active = bpy.data.objects["RIG_LAYOUT_"+SEL_OBJ.name]
+        bpy.ops.object.parent_set(type="OBJECT")
+        
+        eval(POSEMODE)  
+                  
+        
+
+        return{"FINISHED"}
+
+
+##------------------------ SHAPES LAYOUT SYMMETRICA ------------------------
+
+class saveIncremental(bpy.types.Operator):
+    bl_idname = "file.save_incremental_osc"
+    bl_label = "Save Incremental File"
+    bl_options =  {"REGISTER","UNDO"}
+    def execute(self, context):     
+        ##SETEO VARIABLES
+        filepath=bpy.data.filepath
+        
+        ##SI LA RUTA CONTIENE _V
+        if filepath.count("_v") == 0:
+            print("La escena no tiene numero")
+            stpath=filepath.rsplit(".blend")
+            incrementalValue=1
+            print("El output es: "+ stpath[0]+"_v0"+str(incrementalValue)+".blend")
+            output=stpath[0]+"_v0"+str(incrementalValue)+".blend"
+            bpy.ops.wm.save_as_mainfile(filepath=output)  
+            
+            
+        else:    
+            sfilepath=filepath.split("_v")[0]
+            idfilepath=(filepath.split("_v")[1])[:-6]
+            stpath=sfilepath+"_v"
+            incrementalValue=int(idfilepath)    
+            
+            if len(idfilepath) > 1 :
+                if idfilepath[0] == "0":
+                    print("El primer valor es cero")
+                    incrementalValue+=1
+                    print("El output es: "+ sfilepath+"_v0"+str(incrementalValue)+".blend")
+                    output=sfilepath+"_v0"+str(incrementalValue)+".blend"
+                    bpy.ops.wm.save_as_mainfile(filepath=output)
+                else:
+                    print("El primer valor no es cero")
+                    incrementalValue+=1
+                    print("El output es: "+ sfilepath+"_v"+str(incrementalValue)+".blend")  
+                    output=sfilepath+"_v0"+str(incrementalValue)+".blend"
+                    bpy.ops.wm.save_as_mainfile(filepath=output)              
+            
+            if len(idfilepath) <= 1 :
+                print("No tiene primer valor")  
+                incrementalValue+=1
+                print("El output es: "+ sfilepath+"_v0"+str(incrementalValue)+".blend")  
+                output=sfilepath+"_v0"+str(incrementalValue)+".blend"
+                bpy.ops.wm.save_as_mainfile(filepath=output)      
+        return{"FINISHED"}  
+    
+##------------------------ REPLACE FILE PATHS ------------------------ 
+
+bpy.types.Scene.oscSearchText = bpy.props.StringProperty(default="Search Text")
+bpy.types.Scene.oscReplaceText = bpy.props.StringProperty(default="Replace Text")
+
+class replaceFilePath(bpy.types.Operator):
+    bl_idname = "file.replace_file_path_osc"
+    bl_label = "Replace File Path"
+    bl_options =  {"REGISTER","UNDO"}
+    def execute(self, context):    
+        TEXTSEARCH=bpy.context.scene.oscSearchText
+        TEXTREPLACE=bpy.context.scene.oscReplaceText
+        
+        for image in bpy.data.images:
+            if image.filepath != '':
+                if image.filepath.count(TEXTSEARCH) == 2:
+                    FILEPATH=image.filepath
+                    FOLDER=FILEPATH.partition(TEXTSEARCH)[0]+TEXTREPLACE
+                    PREFIX=FILEPATH.partition(TEXTSEARCH)[-1].partition(TEXTSEARCH)[0]+TEXTREPLACE+FILEPATH.partition(TEXTSEARCH)[-1].partition(TEXTSEARCH)[2]        
+                    print("Reemplazo el path de: "+image.name)
+                    image.filepath=FOLDER+PREFIX   
+
+                if image.filepath.count(TEXTSEARCH) == 1:
+                    FILEPATH=image.filepath
+                    FOLDER=FILEPATH.partition(TEXTSEARCH)[0]+TEXTREPLACE+FILEPATH.partition(TEXTSEARCH)[-1]
+                        
+                    print("Reemplazo el path de: "+image.name)
+                    image.filepath= FOLDER
+
+                     
+        return{"FINISHED"}
+
+
+
+##------------------------ DUPLICATE OBJECTS SYMMETRY ------------------------ 
+
+def duplicateSymmetrical (self, disconect):
+    for objeto in bpy.context.selected_objects:
+                
+        OBSEL=objeto 
+        
+        #DESELECT AND SELECT OBJETO
+        bpy.ops.object.select_all(action='DESELECT') 
+        objeto.select = 1   
+        bpy.context.scene.objects.active=objeto
+        
+        #DUPLICA
+        bpy.ops.object.duplicate(linked=1)
+        
+        #OBJETO ACTIVO
+        OBDUP=bpy.context.active_object 
+           
+        print(OBDUP)
+        
+        #SUMA DRIVER
+        OBDUP.driver_add("location")
+        
+        ## LOCATIONS
+        
+        #EXPRESION
+        OBDUP.animation_data.drivers[0].driver.expression = "-var"
+        #CREA VARIABLE
+        OBDUP.animation_data.drivers[0].driver.variables.new()
+        #MODIFICO VARIABLE
+        OBDUP.animation_data.drivers[0].driver.variables[0].type = "TRANSFORMS"
+        OBDUP.animation_data.drivers[0].driver.variables[0].targets[0].id = objeto
+        OBDUP.animation_data.drivers[0].driver.variables[0].targets[0].transform_type = 'LOC_X'
+        
+        #EXPRESION
+        OBDUP.animation_data.drivers[1].driver.expression = "var"
+        #CREA VARIABLE
+        OBDUP.animation_data.drivers[1].driver.variables.new()
+        #MODIFICO VARIABLE
+        OBDUP.animation_data.drivers[1].driver.variables[0].type = "TRANSFORMS"
+        OBDUP.animation_data.drivers[1].driver.variables[0].targets[0].id = objeto
+        OBDUP.animation_data.drivers[1].driver.variables[0].targets[0].transform_type = 'LOC_Y'
+        
+        #EXPRESION
+        OBDUP.animation_data.drivers[2].driver.expression = "var"
+        #CREA VARIABLE
+        OBDUP.animation_data.drivers[2].driver.variables.new()
+        #MODIFICO VARIABLE
+        OBDUP.animation_data.drivers[2].driver.variables[0].type = "TRANSFORMS"
+        OBDUP.animation_data.drivers[2].driver.variables[0].targets[0].id = objeto
+        OBDUP.animation_data.drivers[2].driver.variables[0].targets[0].transform_type = 'LOC_Z'
+        
+        ## SCALE
+        OBDUP.driver_add("scale")
+        
+        
+        #EXPRESION
+        OBDUP.animation_data.drivers[3].driver.expression = "-var"
+        #CREA VARIABLE
+        OBDUP.animation_data.drivers[3].driver.variables.new()
+        #MODIFICO VARIABLE
+        OBDUP.animation_data.drivers[3].driver.variables[0].type = "TRANSFORMS"
+        OBDUP.animation_data.drivers[3].driver.variables[0].targets[0].id = objeto
+        OBDUP.animation_data.drivers[3].driver.variables[0].targets[0].transform_type = 'SCALE_X'
+                        
+        #EXPRESION
+        OBDUP.animation_data.drivers[4].driver.expression = "var"
+        #CREA VARIABLE
+        OBDUP.animation_data.drivers[4].driver.variables.new()
+        #MODIFICO VARIABLE
+        OBDUP.animation_data.drivers[4].driver.variables[0].type = "TRANSFORMS"
+        OBDUP.animation_data.drivers[4].driver.variables[0].targets[0].id = objeto
+        OBDUP.animation_data.drivers[4].driver.variables[0].targets[0].transform_type = 'SCALE_Y'
+                        
+                        
+        #EXPRESION
+        OBDUP.animation_data.drivers[5].driver.expression = "var"
+        #CREA VARIABLE
+        OBDUP.animation_data.drivers[5].driver.variables.new()
+        #MODIFICO VARIABLE
+        OBDUP.animation_data.drivers[5].driver.variables[0].type = "TRANSFORMS"
+        OBDUP.animation_data.drivers[5].driver.variables[0].targets[0].id = objeto
+        OBDUP.animation_data.drivers[5].driver.variables[0].targets[0].transform_type = 'SCALE_Z'
+                                                                                                      
+
+        ## ROTATION
+        OBDUP.driver_add("rotation_euler")
+        
+        
+        #EXPRESION
+        OBDUP.animation_data.drivers[6].driver.expression = "var"
+        #CREA VARIABLE
+        OBDUP.animation_data.drivers[6].driver.variables.new()
+        #MODIFICO VARIABLE
+        OBDUP.animation_data.drivers[6].driver.variables[0].type = "TRANSFORMS"
+        OBDUP.animation_data.drivers[6].driver.variables[0].targets[0].id = objeto
+        OBDUP.animation_data.drivers[6].driver.variables[0].targets[0].transform_type = 'ROT_X'
+                        
+        #EXPRESION
+        OBDUP.animation_data.drivers[7].driver.expression = "-var"
+        #CREA VARIABLE
+        OBDUP.animation_data.drivers[7].driver.variables.new()
+        #MODIFICO VARIABLE
+        OBDUP.animation_data.drivers[7].driver.variables[0].type = "TRANSFORMS"
+        OBDUP.animation_data.drivers[7].driver.variables[0].targets[0].id = objeto
+        OBDUP.animation_data.drivers[7].driver.variables[0].targets[0].transform_type = 'ROT_Y'
+                        
+                        
+        #EXPRESION
+        OBDUP.animation_data.drivers[8].driver.expression = "-var"
+        #CREA VARIABLE
+        OBDUP.animation_data.drivers[8].driver.variables.new()
+        #MODIFICO VARIABLE
+        OBDUP.animation_data.drivers[8].driver.variables[0].type = "TRANSFORMS"
+        OBDUP.animation_data.drivers[8].driver.variables[0].targets[0].id = objeto
+        OBDUP.animation_data.drivers[8].driver.variables[0].targets[0].transform_type = 'ROT_Z'               
+
+        if disconect != True:
+            bpy.ops.object.make_single_user(obdata=True, object=True) 
+            bpy.context.active_object.driver_remove("location") 
+            bpy.context.active_object.driver_remove("rotation_euler") 
+            bpy.context.active_object.driver_remove("scale")     
+
+
+class oscDuplicateSymmetricalOp (bpy.types.Operator):
+    bl_idname = "object.duplicate_object_symmetry_osc"
+    bl_label = "Oscurart Duplicate Symmetrical"  
+    bl_options =  {"REGISTER","UNDO"}
+    
+    desconecta = bpy.props.BoolProperty(name="Keep Connection", default=True)
+    
+    def execute(self,context):
+        
+        duplicateSymmetrical(self, self.desconecta)  
+                      
+        return{"FINISHED"}  
+        
+
+##---------------------------BATCH MAKER------------------
+
+
+def defoscBatchMaker(TYPE):
+    # REVISO SISTEMA
+    if sys.platform.startswith("w"):
+        print ("PLATFORM: WINDOWS")
+        SYSBAR="\\" 
+        EXTSYS=".bat" 
+        QUOTES='"'          
+    else:
+        print ("PLATFORM:LINUX")    
+        SYSBAR="/"
+        EXTSYS=".sh"
+        QUOTES=''
+    
+    print(TYPE)
+    
+    # CREO VARIABLES
+    FILENAME=bpy.data.filepath.rpartition(SYSBAR)[-1].rpartition(".")[0]
+    BINDIR=bpy.app[4]
+    SHFILE= bpy.data.filepath.rpartition(SYSBAR)[0]+SYSBAR+FILENAME+EXTSYS
+    FILEBATCH=open(SHFILE,"w")
+    FILESC=open(bpy.data.filepath.rpartition(SYSBAR)[0]+SYSBAR+"osRlat.py","w")
+    FILESSC=open(bpy.data.filepath.rpartition(SYSBAR)[0]+SYSBAR+"osRSlat.py","w")
+
+    
+    # DEFINO ARCHIVO DE BATCH
+    FILEBATCH.writelines("%s%s%s -b %s -x 1 -o %s -P %s%s.py  -s %s -e %s -a" % (QUOTES,BINDIR,QUOTES,bpy.data.filepath,bpy.context.scene.render.filepath,bpy.data.filepath.rpartition(SYSBAR)[0]+SYSBAR,TYPE,str(bpy.context.scene.frame_start),str(bpy.context.scene.frame_end)) )
+    FILEBATCH.close()        
+    
+    # SI ES LINUX LE DOY PERMISOS CHMOD
+    if EXTSYS == ".sh":
+        os.chmod(SHFILE, stat.S_IRWXU)
+        
+    
+    
+    # DEFINO LOS ARCHIVOS DE SCRIPT
+    FILESC.writelines("import bpy \nbpy.ops.render.render_layers_at_time_osc()\nbpy.ops.wm.quit_blender()" )
+    FILESC.close()    
+    FILESSC.writelines("import bpy \nbpy.ops.render.render_selected_scenes_osc()\nbpy.ops.wm.quit_blender()" )
+    FILESSC.close() 
+
+class oscBatchMaker (bpy.types.Operator):
+    bl_idname = "file.create_batch_maker_osc"
+    bl_label = "Make render batch" 
+    bl_options = {'REGISTER', 'UNDO'}
+        
+
+    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):
+        defoscBatchMaker(self.type)
+        return{"FINISHED"}
+
+
+##---------------------------REMOVE MODIFIERS Y APPLY MODIFIERS------------------
+
+class oscRemModifiers (bpy.types.Operator):
+    bl_idname = "object.modifiers_remove_osc"
+    bl_label = "Remove modifiers" 
+    bl_options =  {"REGISTER","UNDO"}
+    def execute(self,context):
+        for objeto in bpy.context.selected_objects:
+            for modificador in objeto.modifiers:
+                print(modificador.type)
+                bpy.context.scene.objects.active=objeto
+                bpy.ops.object.modifier_remove(modifier=modificador.name)
+        return{"FINISHED"}
+
+class oscApplyModifiers (bpy.types.Operator):
+    bl_idname = "object.modifiers_apply_osc"
+    bl_label = "Apply modifiers" 
+    bl_options =  {"REGISTER","UNDO"}
+    def execute(self,context):
+        for objeto in bpy.context.selected_objects:
+            bpy.ops.object.select_all(action='DESELECT')
+            bpy.context.scene.objects.active=objeto
+            objeto.select=True            
+            bpy.ops.object.make_single_user(type='SELECTED_OBJECTS', object=True, obdata=True, material=False, texture=False, animation=False)
+            for modificador in objeto.modifiers:
+                print(modificador.type)
+                # SUBSURF
+                if modificador.type == 'SUBSURF':
+                    if modificador.levels > 0:
+                        bpy.ops.object.modifier_apply(apply_as="DATA",modifier=modificador.name)
+                    else:
+                        bpy.ops.object.modifier_remove(modifier=modificador.name)          
+                # MESH DEFORM
+                if modificador.type == 'MESH_DEFORM':
+                    if modificador.object != None:
+                        bpy.ops.object.modifier_apply(apply_as="DATA",modifier=modificador.name)
+                    else:
+                        bpy.ops.object.modifier_remove(modifier=modificador.name)      
+                # ARRAY 
+                if modificador.type == 'ARRAY':
+                    bpy.ops.object.modifier_apply(apply_as="DATA",modifier=modificador.name)
+                # BEVEL 
+                if modificador.type == 'BEVEL':
+                    bpy.ops.object.modifier_apply(apply_as="DATA",modifier=modificador.name) 
+                # BOOLEAN
+                if modificador.type == 'BOOLEAN':
+                    if modificador.object != None:
+                        bpy.ops.object.modifier_apply(apply_as="DATA",modifier=modificador.name)
+                    else:
+                        bpy.ops.object.modifier_remove(modifier=modificador.name)                      
+                # BUILD
+                if modificador.type == 'BUILD':
+                    bpy.ops.object.modifier_apply(apply_as="DATA",modifier=modificador.name)            
+                # DECIMATE
+                if modificador.type == 'DECIMATE':
+                    bpy.ops.object.modifier_apply(apply_as="DATA",modifier=modificador.name) 
+                # EDGE SPLIT
+                if modificador.type == 'EDGE_SPLIT':
+                    bpy.ops.object.modifier_apply(apply_as="DATA",modifier=modificador.name)             
+                # MASK
+                if modificador.type == 'MASK':
+                    bpy.ops.object.modifier_apply(apply_as="DATA",modifier=modificador.name)              
+                # MIRROR
+                if modificador.type == 'MIRROR':
+                    bpy.ops.object.modifier_apply(apply_as="DATA",modifier=modificador.name) 
+                # MULTIRESOLUTION
+                if modificador.type == 'MULTIRES':
+                    bpy.ops.object.modifier_apply(apply_as="DATA",modifier=modificador.name)
+                # SCREW
+                if modificador.type == 'SCREW':
+                    bpy.ops.object.modifier_apply(apply_as="DATA",modifier=modificador.name)
+                # SOLIDIFY
+                if modificador.type == 'SOLIDIFY':
+                    bpy.ops.object.modifier_apply(apply_as="DATA",modifier=modificador.name)     
+                # UV_PROJECT
+                if modificador.type == 'UV_PROJECT':
+                    bpy.ops.object.modifier_apply(apply_as="DATA",modifier=modificador.name)              
+                # ARMATURE
+                if modificador.type == 'ARMATURE':
+                    if modificador.object != None:
+                        bpy.ops.object.modifier_apply(apply_as="DATA",modifier=modificador.name)
+                    else:
+                        bpy.ops.object.modifier_remove(modifier=modificador.name) 
+                # CAST
+                if modificador.type == 'CAST':
+                    bpy.ops.object.modifier_apply(apply_as="DATA",modifier=modificador.name) 
+                # CURVE
+                if modificador.type == 'CURVE':
+                    if modificador.object != None:
+                        bpy.ops.object.modifier_apply(apply_as="DATA",modifier=modificador.name)
+                    else:
+                        bpy.ops.object.modifier_remove(modifier=modificador.name)                              
+                # DISPLACE
+                if modificador.type == 'DISPLACE':
+                    if modificador.texture != None:
+                        bpy.ops.object.modifier_apply(apply_as="DATA",modifier=modificador.name)
+                    else:
+                        bpy.ops.object.modifier_remove(modifier=modificador.name)                  
+                # HOOK
+                if modificador.type == 'HOOK':
+                    if modificador.object != None:
+                        bpy.ops.object.modifier_apply(apply_as="DATA",modifier=modificador.name)
+                    else:
+                        bpy.ops.object.modifier_remove(modifier=modificador.name)                   
+                # LATTICE
+                if modificador.type == 'LATTICE':
+                    if modificador.object != None:
+                        bpy.ops.object.modifier_apply(apply_as="DATA",modifier=modificador.name)
+                    else:
+                        bpy.ops.object.modifier_remove(modifier=modificador.name)                
+                # SHRINK WRAP
+                if modificador.type == 'SHRINKWRAP':
+                    if modificador.target != None:
+                        bpy.ops.object.modifier_apply(apply_as="DATA",modifier=modificador.name)
+                    else:
+                        bpy.ops.object.modifier_remove(modifier=modificador.name)                  
+                # SIMPLE DEFORM
+                if modificador.type == 'SIMPLE_DEFORM':
+                    bpy.ops.object.modifier_apply(apply_as="DATA",modifier=modificador.name)                
+                # SMOOTH
+                if modificador.type == 'SMOOTH':
+                    bpy.ops.object.modifier_apply(apply_as="DATA",modifier=modificador.name)                  
+                # WARP
+                if modificador.type == 'WARP':
+                    if modificador.object_from != None:
+                        if modificador.object_to != None:
+                            bpy.ops.object.modifier_apply(apply_as="DATA",modifier=modificador.name)
+                    else:
+                        bpy.ops.object.modifier_remove(modifier=modificador.name)                 
+                # WAVE
+                if modificador.type == 'WAVE':
+                    bpy.ops.object.modifier_apply(apply_as="DATA",modifier=modificador.name) 
+        return{"FINISHED"}
+
+
+        
+##---------------------------SHAPES TO OBJECTS------------------
+
+class ShapeToObjects (bpy.types.Operator):
+    bl_idname = "object.shape_key_to_objects_osc"
+    bl_label = "Shapes To Objects" 
+    bl_options =  {"REGISTER","UNDO"}
+    def execute(self,context):
+        OBJACT=bpy.context.active_object    
+        for SHAPE in OBJACT.data.shape_keys.key_blocks[:]:
+            print(SHAPE.name)
+            bpy.ops.object.shape_key_clear()
+            SHAPE.value=1
+            mesh=OBJACT.to_mesh(bpy.context.scene, True, 'PREVIEW')
+            object=bpy.data.objects.new(SHAPE.name, mesh)
+            bpy.context.scene.objects.link(object)
+        return{"FINISHED"}
+    
+    
+
+##--------------------------OVERRIDES-----------------------------
+
+## PARA ESCENAS NUEVAS
+
+for scene in bpy.data.scenes[:]:
+    try:
+        scene['OVERRIDE']
+    except:
+        scene['OVERRIDE']="[]"
+
+
+
+class OverridesOp (bpy.types.Operator):
+    bl_idname = "render.overrides_set_list"
+    bl_label = "Overrides set list" 
+    bl_options =  {"REGISTER","UNDO"}
+    def execute(self,context):
+        for scene in bpy.data.scenes[:]:
+            try:
+                scene['OVERRIDE']
+            except:
+                scene['OVERRIDE']="[]"
+        return{"FINISHED"}        
+
+
+###------------------------IMPORT EXPORT GROUPS--------------------
+
+class OscExportVG (bpy.types.Operator):
+    bl_idname = "file.export_groups_osc"
+    bl_label = "Export Groups" 
+    bl_options =  {"REGISTER","UNDO"}
+    def execute(self,context):
+
+        OBSEL=bpy.context.active_object
+        
+        if os.sys.platform.count("win"):
+            print("WINDOWS")
+            BAR = "\\"
+        else:
+            print("LINUX")
+            BAR = "/"  
+        # VARIABLES
+        FILEPATH=bpy.data.filepath        
+        FILE=open(FILEPATH.rpartition(BAR)[0]+BAR+OBSEL.name+".xml", mode="w")
+        VERTLIST=[]
+
+        LENVER=len(OBSEL.data.vertices)        
+        
+        for VG in OBSEL.vertex_groups:
+            BONELIST=[]
+            for VERTICE in range(0,LENVER):
+                try:
+                    BONELIST.append((VERTICE,VG.weight(VERTICE),VG.name,))
+                except:
+                    pass
+            VERTLIST.append(BONELIST)
+        
+        ## CREO LA LISTA CON LOS NOMBRES DE LOS GRUPOS
+        NAMEGROUPLIST=[]
+        for VG in OBSEL.vertex_groups:
+            NAMEGROUPLIST.append(VG.name)
+        
+        ## AGREGO LOS NOMBRES A LA LISTA
+        VERTLIST.append(NAMEGROUPLIST)
+        
+        ## GUARDO Y CIERRO
+        FILE.writelines(str(VERTLIST))
+        FILE.close()
+        
+        ## ---- CREO OTRO ARCHIVO PARA LA DATA ----
+        # VARIABLES
+        FILEPATH=bpy.data.filepath        
+        FILE=open(FILEPATH.rpartition(BAR)[0]+BAR+OBSEL.name+"_DATA.xml", mode="w")        
+        
+        DATAVER=[]
+        
+        for VERT in OBSEL.data.vertices[:]:
+            TEMP=0
+            VGTEMP=0
+            LISTVGTEMP=[]            
+            
+            for GROUP in VERT.groups[:]:
+                LISTVGTEMP.append((GROUP.group,VGTEMP))
+                VGTEMP+=1
+            
+            LISTVGTEMP=sorted(LISTVGTEMP)
+            for GROUP in VERT.groups[:]:
+                DATAVER.append((VERT.index,TEMP,VERT.groups[LISTVGTEMP[TEMP][1]].weight))
+                TEMP+=1
+
+        
+        ## GUARDO Y CIERRO
+        FILE.writelines(str(DATAVER))
+        FILE.close()        
+        
+        return{"FINISHED"}
+        
+class OscImportVG (bpy.types.Operator):
+    bl_idname = "file.import_groups_osc"
+    bl_label = "Import Groups" 
+    bl_options =  {"REGISTER","UNDO"}
+    def execute(self,context):
+
+        OBSEL=bpy.context.active_object
+	# AVERIGUO EL SISTEMA
+        if os.sys.platform.count("win"):
+            print("WINDOWS")
+            BAR = "\\"
+        else:
+            print("LINUX")
+            BAR = "/" 
+        # VARIABLES 
+        FILEPATH=bpy.data.filepath
+        FILE=open(FILEPATH.rpartition(BAR)[0]+BAR+OBSEL.name+".xml", mode="r")
+        VERTLIST=FILE.readlines(0)
+        VERTLIST=eval(VERTLIST[0])
+        VERTLISTR=VERTLIST[:-1]
+        GROUPLIST=VERTLIST[-1:]
+        VGINDEX=0      
+        
+        ## MODO OBJECT
+        bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
+        
+        for GROUP in GROUPLIST[0]:
+            #CREO GRUPO
+            bpy.ops.object.vertex_group_add()
+            #CAMBIO NOMBRE
+            OBSEL.vertex_groups[-1].name=GROUP 
+         
+             
+       
+        
+        for VG in OBSEL.vertex_groups[:]:            
+            # SETEO VG
+            bpy.ops.object.vertex_group_set_active(group=VG.name)            
+            # EDIT    
+            bpy.ops.object.mode_set(mode='EDIT')               
+            # DESELECT
+            bpy.ops.mesh.select_all(action='DESELECT')                          
+            # OBJECT   
+            bpy.ops.object.mode_set(mode='OBJECT')              
+            # SELECCIONO LOS VERTICES             
+            for VERTI in VERTLISTR[VG.index]:
+                OBSEL.data.vertices[VERTI[0]].select=1                   
+            ## SETEO EL VALOR DEL PESO
+            bpy.context.tool_settings.vertex_group_weight=1                                  
+            # EDIT    
+            bpy.ops.object.mode_set(mode='EDIT')         
+            ## ASIGNO
+            bpy.ops.object.vertex_group_assign(new=False)
+
+        # CIERRO
+        FILE.close()
+        
+        
+        ## ----------- LEVANTO DATA ----
+        # VARIABLES 
+        FILEPATH=bpy.data.filepath
+        FILE=open(FILEPATH.rpartition(BAR)[0]+BAR+OBSEL.name+"_DATA.xml", mode="r")
+        DATAPVER=FILE.readlines(0)
+        DATAPVER=eval(DATAPVER[0])
+        
+        # PASO A MODO OBJECT      
+        bpy.ops.object.mode_set(mode='OBJECT')        
+        
+        #for VERT in DATAPVER:
+        for VERT in DATAPVER:
+            OBSEL.data.vertices[VERT[0]].groups[VERT[1]].weight=VERT[2]       
+        
+        # CIERRO
+        FILE.close()
+        
+   
+        # PASO A MODO PINTURA DE PESO       
+        bpy.ops.object.mode_set(mode='WEIGHT_PAINT')
+        return{"FINISHED"}
+
+
+## ------------------------------------ RELINK OBJECTS--------------------------------------   
+
+
+def relinkObjects (self):  
+    
+    LISTSCENE=[]
+    
+    for SCENE in bpy.data.scenes[:]:
+        if bpy.selection[-1] in SCENE.objects[:]:
+            LISTSCENE.append(SCENE)    
+
+    OBJECTS = bpy.selection[:-1]
+    
+    ## REMUEVO ESCENA ACTIVA
+    LISTSCENE.remove(bpy.context.scene)
+    
+    ## DESELECT
+    bpy.ops.object.select_all(action='DESELECT')
+    
+    ## SELECT
+    for OBJETO in OBJECTS:
+        if OBJETO.users != len(bpy.data.scenes):
+            print(OBJETO.name)
+            OBJETO.select = True
+        
+    ## LINK
+    for SCENE in LISTSCENE:
+        bpy.ops.object.make_links_scene(scene=SCENE.name)           
+    
+
+class OscRelinkObjectsBetween (bpy.types.Operator):
+    bl_idname = "objects.relink_objects_between_scenes"
+    bl_label = "Relink Objects Between Scenes" 
+    bl_options =  {"REGISTER","UNDO"}  
+    
+   
+      
+    def execute (self, context):
+        relinkObjects(self)        
+        return {'FINISHED'}
+    
+
+
+## ------------------------------------ COPY GROUPS AND LAYERS--------------------------------------   
+
+
+def CopyObjectGroupsAndLayers (self): 
+              
+    OBSEL=bpy.selection[:]
+    GLOBALLAYERS=str(OBSEL[-1].layers[:])
+    ACTSCENE=bpy.context.scene
+    GROUPS=OBSEL[-1].users_group
+    ERROR=False    
+    
+    for OBJECT in OBSEL[:-1]:
+        for scene in bpy.data.scenes[:]:
+            try:
+                ISINLAYER=False
+                bpy.context.window.screen.scene=scene
+                
+                if OBSEL[-1] in bpy.context.scene.objects[:]:
+                    scene.objects[OBJECT.name].layers=OBSEL[-1].layers
+                else:
+                    scene.objects[OBJECT.name].layers=list(eval(GLOBALLAYERS))
+                    ISINLAYER=True
+                    
+                
+                scene.objects.active=OBJECT
+                
+                for GROUP in GROUPS:
+                    bpy.ops.object.group_link(group=GROUP.name)      
+                
+                if ISINLAYER == False:                          
+                    print("-- %s was successfully copied in %s" % (OBJECT.name,scene.name))
+                else:
+                    print("++ %s copy data from %s in %s" % (OBJECT.name,ACTSCENE.name,scene.name))    
+            except:
+                print ("** %s was not copied in %s" % (OBJECT.name,scene.name))  
+                ERROR = True 
+    bpy.context.window.screen.scene=ACTSCENE 
+    
+    if ERROR == False:
+        self.report({'INFO'}, "All Objects were Successfully Copied")
+    else:
+        self.report({'WARNING'}, "Some Objects Could not be Copied")    
+           
+
+class OscCopyObjectGAL (bpy.types.Operator):
+    bl_idname = "objects.copy_objects_groups_layers"
+    bl_label = "Copy Groups And Layers" 
+    bl_options =  {"REGISTER","UNDO"}  
+   
+      
+    def execute (self, context):
+        CopyObjectGroupsAndLayers (self)        
+        return {'FINISHED'}
+    
+    
+## ------------------------------------ APPLY AND RESTORE OVERRIDES --------------------------------------   
+
+   
+
+class OscApplyOverrides(bpy.types.Operator):
+    bl_idname = "render.apply_overrides"
+    bl_label = "Apply Overrides in this Scene" 
+    bl_options =  {"REGISTER","UNDO"}  
+   
+      
+    def execute (self, context):
+        LISTMAT=[]
+        PROPTOLIST=list(eval(bpy.context.scene['OVERRIDE']))        
+        # REVISO SISTEMA
+        if sys.platform.startswith("w"):
+            print ("PLATFORM: WINDOWS")
+            SYSBAR="\\"           
+        else:
+            print ("PLATFORM:LINUX")    
+            SYSBAR="/"        
+        FILEPATH=bpy.data.filepath
+        ACTIVEFOLDER=FILEPATH.rpartition(SYSBAR)[0]
+        ENTFILEPATH= "%s%s%s_OVERRIDE.xml" %  (ACTIVEFOLDER,SYSBAR,bpy.context.scene.name)
+        XML=open(ENTFILEPATH ,mode="w")        
+        ## GUARDO MATERIALES DE OBJETOS EN GRUPOS
+        for OBJECT in bpy.data.objects[:]:
+            SLOTLIST=[]
+            try:
+                if OBJECT.type=="MESH" or OBJECT.type == "META":
+                    for SLOT in OBJECT.material_slots[:]:
+                        SLOTLIST.append(SLOT.material)                   
+                    LISTMAT.append((OBJECT,SLOTLIST))        
+            except:
+                pass        
+        try:
+            for OVERRIDE in PROPTOLIST:
+                for OBJECT in bpy.data.groups[OVERRIDE[0]].objects[:]:
+                    if OBJECT.type == "MESH" or OBJECT.type == "META":
+                        for SLOT in OBJECT.material_slots[:]:
+                            SLOT.material=bpy.data.materials[OVERRIDE[1]]             
+        except:
+            pass
+        
+        XML.writelines(str(LISTMAT))
+        XML.close()       
+        return {'FINISHED'}   
+    
+class OscRestoreOverrides(bpy.types.Operator):
+    bl_idname = "render.restore_overrides"
+    bl_label = "Restore Overrides in this Scene" 
+    bl_options =  {"REGISTER","UNDO"}  
+   
+      
+    def execute (self, context):
+        # REVISO SISTEMA
+        if sys.platform.startswith("w"):
+            print ("PLATFORM: WINDOWS")
+            SYSBAR="\\"           
+        else:
+            print ("PLATFORM:LINUX")    
+            SYSBAR="/"   
+        
+        FILEPATH=bpy.data.filepath
+        ACTIVEFOLDER=FILEPATH.rpartition(SYSBAR)[0]
+        ENTFILEPATH= "%s%s%s_OVERRIDE.xml" %  (ACTIVEFOLDER,SYSBAR,bpy.context.scene.name)
+        XML=open(ENTFILEPATH,mode="r")
+        RXML=XML.readlines(0)
+        
+        LISTMAT=list(eval(RXML[0]))     
+        
+        # RESTAURO MATERIALES  DE OVERRIDES  
+        for OBJECT in LISTMAT:
+            SLOTIND=0
+            try:
+                for SLOT in OBJECT[1]:
+                    OBJECT[0].material_slots[SLOTIND].material=SLOT
+                    SLOTIND+=1
+            except:
+                print("OUT OF RANGE")
+        # CIERRO
+        XML.close()
+       
+        return {'FINISHED'}     
+    
+    
+## ------------------------------------ CHECK OVERRIDES --------------------------------------   
+
+class OscCheckOverrides (bpy.types.Operator):
+    bl_idname = "render.check_overrides"
+    bl_label = "Check Overrides" 
+    bl_options =  {"REGISTER","UNDO"}  
+   
+      
+    def execute (self, context):
+        GROUPI=False
+        GLOBAL=0
+        GLOBALERROR=0
+        
+        print("==== STARTING CHECKING ====")
+        print("")
+        
+        for SCENE in bpy.data.scenes[:]:            
+            MATLIST=[]
+            MATI=False       
+                 
+            for MATERIAL in bpy.data.materials[:]:
+                MATLIST.append(MATERIAL.name)
+                
+            GROUPLIST=[]
+            for GROUP in bpy.data.groups[:]:
+                if GROUP.users > 0:
+                    GROUPLIST.append(GROUP.name)
+                
+            print("   %s Scene is checking" % (SCENE.name))
+            
+            for OVERRIDE in list(eval(SCENE['OVERRIDE'])):
+                # REVISO OVERRIDES EN GRUPOS
+                if OVERRIDE[0] in GROUPLIST:
+                    pass
+                else:                    
+                    print("** %s group are in conflict." % (OVERRIDE[0]))
+                    GROUPI=True
+                    GLOBALERROR+=1
+                # REVISO OVERRIDES EN GRUPOS    
+                if OVERRIDE[1] in MATLIST:
+                    pass
+                else:                 
+                    print("** %s material are in conflict." % (OVERRIDE[1]))
+                    MATI=True
+                    GLOBALERROR+=1
+            
+            if MATI is False:
+                print("-- Materials are ok.") 
+            else:    
+                GLOBAL+=1
+            if GROUPI is False:
+                print("-- Groups are ok.")   
+            else:    
+                GLOBAL+=1
+      
+        if GLOBAL < 1:     
+            self.report({'INFO'}, "Materials And Groups are Ok")     
+        if GLOBALERROR > 0:
+            self.report({'WARNING'}, "Override Error: Look in the Console")    
+        print("")
+
+        return {'FINISHED'}
+          
+     
+   
+##======================================================================================FIN DE SCRIPTS    
+    
+    
+def register():
+    pass
+
+def unregister():
+    pass
+
+if __name__ == "__main__":
+    register()
+
+
+
+## REGISTRA CLASSES
+bpy.utils.register_class(OscPanelControl)
+bpy.utils.register_class(OscPanelObject)
+bpy.utils.register_class(OscPanelMesh)
+bpy.utils.register_class(OscPanelShapes)
+bpy.utils.register_class(OscPanelRender)
+bpy.utils.register_class(OscPanelFiles)
+bpy.utils.register_class(OscPanelOverrides)
+bpy.utils.register_class(SelectMenor)
+bpy.utils.register_class(CreaGrupos)
+bpy.utils.register_class(CreaShapes)
+bpy.utils.register_class(normalsOutside)
+bpy.utils.register_class(resym)
+bpy.utils.register_class(reloadImages)
+bpy.utils.register_class(renderAll)
+bpy.utils.register_class(renderAllCF)
+bpy.utils.register_class(renderCrop)
+bpy.utils.register_class(SearchAndSelectOt)
+bpy.utils.register_class(CreaShapesLayout)
+bpy.utils.register_class(renameObjectsOt)
+bpy.utils.register_class(resymVertexGroups)
+bpy.utils.register_class(CreateLayoutAsymmetrical)
+bpy.utils.register_class(DistributeMinMaxApply)
+bpy.utils.register_class(saveIncremental)
+bpy.utils.register_class(replaceFilePath)
+bpy.utils.register_class(oscDuplicateSymmetricalOp)
+bpy.utils.register_class(oscBatchMaker)
+bpy.utils.register_class(oscRemModifiers)
+bpy.utils.register_class(oscApplyModifiers)
+bpy.utils.register_class(ShapeToObjects)
+bpy.utils.register_class(OverridesOp)
+bpy.utils.register_class(OscExportVG )
+bpy.utils.register_class(OscImportVG )
+bpy.utils.register_class(renderCurrent)
+bpy.utils.register_class(renderCurrentCF)
+bpy.utils.register_class(renderSelected)
+bpy.utils.register_class(renderSelectedCF)
+bpy.utils.register_class(OscRelinkObjectsBetween)
+bpy.utils.register_class(OscCopyObjectGAL) 
+bpy.utils.register_class(OscApplyOverrides)
+bpy.utils.register_class(OscRestoreOverrides)
+bpy.utils.register_class(OscCheckOverrides)
diff --git a/release/scripts/addons_contrib/particle_hair_lab.py b/release/scripts/addons_contrib/particle_hair_lab.py
new file mode 100644
index 0000000..d05f04b
--- /dev/null
+++ b/release/scripts/addons_contrib/particle_hair_lab.py
@@ -0,0 +1,1505 @@
+# ##### 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": "Grass Lab",
+    "author": "Ondrej Raha(lokhorn), meta-androcto",
+    "version": (0,5),
+    "blender": (2, 6, 0),
+    "location": "View3D > Tool Shelf > Grass Preset Panel",
+    "description": "Creates particle grass with material",
+    "warning": "",
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/Scripts/Object/grass_Lab",
+    "tracker_url": "",
+    "category": "Object"}
+
+
+import bpy
+from bpy.props import *
+
+# Returns the action we want to take
+def getActionToDo(obj):
+    if not obj or obj.type != 'MESH':
+        return 'NOT_OBJ_DO_NOTHING'
+    elif obj.type == 'MESH':
+        return 'GENERATE'
+    else:
+        return "DO_NOTHING"
+
+# TO DO
+"""
+class saveSelectionPanel(bpy.types.Panel):
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'TOOLS'
+
+    bl_label = "Selection Save"
+    bl_options = {"DEFAULT_CLOSED"}
+    bl_context = "particlemode"
+    
+
+    def draw(self, context):
+        layout = self.layout
+        col = layout.column(align=True)
+        
+        col.operator("save.selection", text="Save Selection 1")
+"""
+######GRASS########################
+class grassLabPanel(bpy.types.Panel):
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'TOOLS'
+
+    bl_label = "Grass Lab"
+    bl_context = "objectmode"
+    
+
+    def draw(self, context):
+        active_obj = bpy.context.active_object
+        active_scn = bpy.context.scene.name
+        layout = self.layout
+        col = layout.column(align=True)
+        
+        WhatToDo = getActionToDo(active_obj)
+      
+        
+        if WhatToDo == "GENERATE":
+            col.operator("grass.generate_grass", text="Create grass")
+
+            col.prop(context.scene, "grass_type")
+        else:
+            col.label(text="Select mesh object")
+        
+        if active_scn == "TestgrassScene":
+            col.operator("grass.switch_back", text="Switch back to scene")
+        else:
+            col.operator("grass.test_scene", text="Create Test Scene")
+
+# TO DO
+"""
+class saveSelection(bpy.types.Operator):
+    bl_idname = "save.selection"
+    bl_label = "Save Selection"
+    bl_description = "Save selected particles"
+    bl_register = True
+    bl_undo = True
+    
+    def execute(self, context):
+        
+        return {"FINISHED"}
+"""
+class testScene1(bpy.types.Operator):
+    bl_idname = "grass.switch_back"
+    bl_label = "Switch back to scene"
+    bl_description = "If you want keep this scene, switch scene in info window"
+    bl_register = True
+    bl_undo = True
+    
+    def execute(self, context):
+        scene = bpy.context.scene
+        bpy.data.scenes.remove(scene)
+        
+        return {"FINISHED"}
+        
+        
+class testScene2(bpy.types.Operator):
+    bl_idname = "grass.test_scene"
+    bl_label = "Create test scene"
+    bl_description = "You can switch scene in info panel"
+    bl_register = True
+    bl_undo = True
+    
+    def execute(self, context):
+# add new scene
+        bpy.ops.scene.new(type="NEW")
+        scene = bpy.context.scene
+        scene.name = "TestgrassScene"
+# render settings
+        render = scene.render
+        render.resolution_x = 1920
+        render.resolution_y = 1080
+        render.resolution_percentage = 50
+# add new world
+        world = bpy.data.worlds.new("grassWorld")
+        scene.world = world
+        world.use_sky_blend = True
+        world.use_sky_paper = True
+        world.horizon_color = (0.004393,0.02121,0.050)
+        world.zenith_color = (0.03335,0.227,0.359)
+       
+# add text
+        bpy.ops.object.text_add(location=(-0.292,0,-0.152), rotation =(1.571,0,0))
+        text = bpy.context.active_object
+        text.scale = (0.05,0.05,0.05)
+        text.data.body = "Grass Lab"
+        
+# add material to text
+        textMaterial = bpy.data.materials.new('textMaterial')
+        text.data.materials.append(textMaterial)
+        textMaterial.use_shadeless = True
+        
+# add camera
+        bpy.ops.object.camera_add(location = (0,-1,0),rotation = (1.571,0,0))
+        cam = bpy.context.active_object.data
+        cam.lens = 50
+        cam.draw_size = 0.1
+        
+# add spot lamp
+        bpy.ops.object.lamp_add(type="SPOT", location = (-0.7,-0.5,0.3), rotation =(1.223,0,-0.960))
+        lamp1 = bpy.context.active_object.data
+        lamp1.name = "Key Light"
+        lamp1.energy = 1.5
+        lamp1.distance = 1.5
+        lamp1.shadow_buffer_soft = 5
+        lamp1.shadow_buffer_size = 8192
+        lamp1.shadow_buffer_clip_end = 1.5
+        lamp1.spot_blend = 0.5
+        
+# add spot lamp2
+        bpy.ops.object.lamp_add(type="SPOT", location = (0.7,-0.6,0.1), rotation =(1.571,0,0.785))
+        lamp2 = bpy.context.active_object.data
+        lamp2.name = "Fill Light"
+        lamp2.color = (0.874,0.874,1)
+        lamp2.energy = 0.5
+        lamp2.distance = 1.5
+        lamp2.shadow_buffer_soft = 5
+        lamp2.shadow_buffer_size = 4096
+        lamp2.shadow_buffer_clip_end = 1.5
+        lamp2.spot_blend = 0.5
+        
+# light Rim
+        """
+        # add spot lamp3
+        bpy.ops.object.lamp_add(type="SPOT", location = (0.191,0.714,0.689), rotation =(0.891,0,2.884))
+        lamp3 = bpy.context.active_object.data
+        lamp3.name = "Rim Light"
+        lamp3.color = (0.194,0.477,1)
+        lamp3.energy = 3
+        lamp3.distance = 1.5
+        lamp3.shadow_buffer_soft = 5
+        lamp3.shadow_buffer_size = 4096
+        lamp3.shadow_buffer_clip_end = 1.5
+        lamp3.spot_blend = 0.5
+        """
+# add sphere
+# add sphere
+        bpy.ops.mesh.primitive_uv_sphere_add(size=0.1)
+        bpy.ops.object.shade_smooth()
+		
+        return {"FINISHED"}
+
+
+class Generategrass(bpy.types.Operator):
+    bl_idname = "grass.generate_grass"
+    bl_label = "Generate grass"
+    bl_description = "Create a grass"
+    bl_register = True
+    bl_undo = True
+    
+    def execute(self, context):
+# Make variable that is the current .blend file main data blocks
+        blend_data = context.blend_data
+        ob = bpy.context.active_object
+        scene = context.scene
+
+######################################################################
+########################Test screen grass########################
+        if scene.grass_type == '0':              
+            
+###############Create New Material##################
+# add new material
+            grassMaterial = bpy.data.materials.new('greengrassMat')
+            ob.data.materials.append(grassMaterial)
+            
+#Material settings
+            grassMaterial.preview_render_type = "HAIR"
+            grassMaterial.diffuse_color = (0.09710, 0.288, 0.01687)
+            grassMaterial.specular_color = (0.604, 0.465, 0.136)
+            grassMaterial.specular_intensity = 0.3
+            grassMaterial.ambient = 0
+            grassMaterial.use_cubic = True
+            grassMaterial.use_transparency = True
+            grassMaterial.alpha = 0
+            grassMaterial.use_transparent_shadows = True
+            #strand
+            grassMaterial.strand.use_blender_units = True
+            grassMaterial.strand.root_size = 0.00030
+            grassMaterial.strand.tip_size = 0.00010
+            grassMaterial.strand.size_min = 0.7
+            grassMaterial.strand.width_fade = 0.1
+            grassMaterial.strand.shape = 0.061
+            grassMaterial.strand.blend_distance = 0.001
+            
+            
+# add texture
+            grassTex = bpy.data.textures.new("greengrassTex", type='BLEND')
+            grassTex.use_preview_alpha = True
+            grassTex.use_color_ramp = True
+            ramp = grassTex.color_ramp
+            rampElements = ramp.elements
+            rampElements[0].position = 0
+            rampElements[0].color = [0.114,0.375,0.004025,0.38]
+            rampElements[1].position = 1
+            rampElements[1].color = [0.267,0.155,0.02687,0]
+            rampElement1 = rampElements.new(0.111)
+            rampElement1.color = [0.281,0.598,0.03157,0.65]
+            rampElement2 = rampElements.new(0.366)
+            rampElement2.color = [0.119,0.528,0.136,0.87]
+            rampElement3 = rampElements.new(0.608)
+            rampElement3.color = [0.247,0.713,0.006472,0.8]
+            rampElement4 = rampElements.new(0.828)
+            rampElement4.color = [0.01943,0.163,0.01242,0.64]
+    
+# add texture to material
+            MTex = grassMaterial.texture_slots.add()
+            MTex.texture = grassTex
+            MTex.texture_coords = "STRAND"
+            MTex.use_map_alpha = True
+            
+            
+            
+###############  Create Particles  ##################
+# Add new particle system
+            
+            NumberOfMaterials = 0
+            for i in ob.data.materials:
+                NumberOfMaterials +=1
+            
+            
+            bpy.ops.object.particle_system_add()
+#Particle settings setting it up!
+            grassParticles = bpy.context.object.particle_systems.active
+            grassParticles.name = "greengrassPar"
+            grassParticles.settings.type = "HAIR"
+            grassParticles.settings.use_advanced_hair = True
+            grassParticles.settings.count = 500
+            grassParticles.settings.normal_factor = 0.05
+            grassParticles.settings.factor_random = 0.001
+            grassParticles.settings.use_dynamic_rotation = True
+            
+            grassParticles.settings.material = NumberOfMaterials
+            
+            grassParticles.settings.use_strand_primitive = True
+            grassParticles.settings.use_hair_bspline = True
+            grassParticles.settings.render_step = 5
+            grassParticles.settings.length_random = 0.5
+            grassParticles.settings.draw_step = 5
+# children
+            grassParticles.settings.rendered_child_count = 50
+            grassParticles.settings.child_type = "INTERPOLATED"
+            grassParticles.settings.child_length = 0.250
+            grassParticles.settings.create_long_hair_children = True
+            grassParticles.settings.clump_shape = 0.074
+            grassParticles.settings.clump_factor = 0.55
+            grassParticles.settings.roughness_endpoint = 0.080
+            grassParticles.settings.roughness_end_shape = 0.80
+            grassParticles.settings.roughness_2 = 0.043
+            grassParticles.settings.roughness_2_size = 0.230
+        
+        
+######################################################################
+######################  Field Grass  ########################
+        if scene.grass_type == '1':
+###############Create New Material##################
+# add new material
+            grassMaterial = bpy.data.materials.new('fieldgrassMat')
+            ob.data.materials.append(grassMaterial)
+            
+#Material settings
+            grassMaterial.preview_render_type = "HAIR"
+            grassMaterial.diffuse_color = (0.229, 0.800, 0.010)
+            grassMaterial.specular_color = (0.010, 0.06072, 0.000825)
+            grassMaterial.specular_intensity = 0.3
+            grassMaterial.specular_hardness = 100
+            grassMaterial.use_specular_ramp = True
+            
+            ramp = grassMaterial.specular_ramp
+            rampElements = ramp.elements
+            rampElements[0].position = 0
+            rampElements[0].color = [0.0356,0.0652,0.009134,0]
+            rampElements[1].position = 1
+            rampElements[1].color = [0.352,0.750,0.231,1]
+            rampElement1 = rampElements.new(0.255)
+            rampElement1.color = [0.214,0.342,0.0578,0.31]
+            rampElement2 = rampElements.new(0.594)
+            rampElement2.color = [0.096,0.643,0.0861,0.72]
+            
+            grassMaterial.ambient = 0
+            grassMaterial.use_cubic = True
+            grassMaterial.use_transparency = True
+            grassMaterial.alpha = 0
+            grassMaterial.use_transparent_shadows = True
+            #strand
+            grassMaterial.strand.use_blender_units = True
+            grassMaterial.strand.root_size = 0.00030
+            grassMaterial.strand.tip_size = 0.00015
+            grassMaterial.strand.size_min = 0.450
+            grassMaterial.strand.width_fade = 0.1
+            grassMaterial.strand.shape = 0.02
+            grassMaterial.strand.blend_distance = 0.001
+            
+            
+# add texture
+            grassTex = bpy.data.textures.new("feildgrassTex", type='BLEND')
+            grassTex.name = "feildgrassTex"
+            grassTex.use_preview_alpha = True
+            grassTex.use_color_ramp = True
+            ramp = grassTex.color_ramp
+            rampElements = ramp.elements
+            rampElements[0].position = 0
+            rampElements[0].color = [0.009721,0.006049,0.003677,0.38]
+            rampElements[1].position = 1
+            rampElements[1].color = [0.04231,0.02029,0.01444,0.16]
+            rampElement1 = rampElements.new(0.111)
+            rampElement1.color = [0.01467,0.005307,0.00316,0.65]
+            rampElement2 = rampElements.new(0.366)
+            rampElement2.color = [0.0272,0.01364,0.01013,0.87]
+            rampElement3 = rampElements.new(0.608)
+            rampElement3.color = [0.04445,0.02294,0.01729,0.8]
+            rampElement4 = rampElements.new(0.828)
+            rampElement4.color = [0.04092,0.0185,0.01161,0.64]
+            
+# add texture to material
+            MTex = grassMaterial.texture_slots.add()
+            MTex.texture = grassTex
+            MTex.texture_coords = "STRAND"
+            MTex.use_map_alpha = True
+            
+            
+###############Create Particles##################
+# Add new particle system
+            
+            NumberOfMaterials = 0
+            for i in ob.data.materials:
+                NumberOfMaterials +=1
+            
+            
+            bpy.ops.object.particle_system_add()
+#Particle settings setting it up!
+            grassParticles = bpy.context.object.particle_systems.active
+            grassParticles.name = "fieldgrassPar"
+            grassParticles.settings.type = "HAIR"
+            grassParticles.settings.use_emit_random = True
+            grassParticles.settings.use_even_distribution = True
+            grassParticles.settings.use_advanced_hair = True
+            grassParticles.settings.count = 2000
+#Particle settings Velocity
+            grassParticles.settings.normal_factor = 0.060
+            grassParticles.settings.factor_random = 0.045
+            grassParticles.settings.use_dynamic_rotation = False
+            grassParticles.settings.brownian_factor = 0.070
+            grassParticles.settings.damping = 0.160
+            grassParticles.settings.material = NumberOfMaterials
+ # strands           
+            grassParticles.settings.use_strand_primitive = True
+            grassParticles.settings.use_hair_bspline = True
+            grassParticles.settings.render_step = 7
+            grassParticles.settings.length_random = 1.0
+            grassParticles.settings.draw_step = 2
+# children
+            grassParticles.settings.child_type = "INTERPOLATED"
+            grassParticles.settings.child_length = 0.160
+            grassParticles.settings.create_long_hair_children = False
+            grassParticles.settings.clump_factor = 0.000
+            grassParticles.settings.clump_shape = 0.000
+            grassParticles.settings.roughness_endpoint = 0.000
+            grassParticles.settings.roughness_end_shape = 1
+            grassParticles.settings.roughness_2 = 0.200
+            grassParticles.settings.roughness_2_size = 0.230
+        
+        
+######################################################################
+########################Short Clumpped grass##########################
+        elif scene.grass_type == '2':
+###############Create New Material##################
+# add new material
+            grassMaterial = bpy.data.materials.new('clumpygrassMat')
+            ob.data.materials.append(grassMaterial)
+            
+#Material settings
+            grassMaterial.preview_render_type = "HAIR"
+            grassMaterial.diffuse_color = (0.01504, 0.05222, 0.007724)
+            grassMaterial.specular_color = (0.02610, 0.196, 0.04444)
+            grassMaterial.specular_intensity = 0.5
+            grassMaterial.specular_hardness = 100
+            grassMaterial.ambient = 0
+            grassMaterial.use_cubic = True
+            grassMaterial.use_transparency = True
+            grassMaterial.alpha = 0
+            grassMaterial.use_transparent_shadows = True
+#strand
+            grassMaterial.strand.use_blender_units = True
+            grassMaterial.strand.root_size = 0.000315
+            grassMaterial.strand.tip_size = 0.00020
+            grassMaterial.strand.size_min = 0.2
+            grassMaterial.strand.width_fade = 0.1
+            grassMaterial.strand.shape = -0.900
+            grassMaterial.strand.blend_distance = 0.001
+            
+# add texture
+            grassTex = bpy.data.textures.new("clumpygrasstex", type='BLEND')
+            grassTex.use_preview_alpha = True
+            grassTex.use_color_ramp = True
+            ramp = grassTex.color_ramp
+            rampElements = ramp.elements
+            rampElements[0].position = 0
+            rampElements[0].color = [0.004025,0.002732,0.002428,0.38]
+            rampElements[1].position = 1
+            rampElements[1].color = [0.141,0.622,0.107,0.2]
+            rampElement1 = rampElements.new(0.202)
+            rampElement1.color = [0.01885,0.2177,0.01827,0.65]
+            rampElement2 = rampElements.new(0.499)
+            rampElement2.color = [0.114,0.309,0.09822,0.87]
+            rampElement3 = rampElements.new(0.828)
+            rampElement3.color = [0.141,0.427,0.117,0.64]
+            
+# add texture to material
+            MTex = grassMaterial.texture_slots.add()
+            MTex.texture = grassTex
+            MTex.texture_coords = "STRAND"
+            MTex.use_map_alpha = True
+            
+            
+###############Create Particles##################
+# Add new particle system
+            
+            NumberOfMaterials = 0
+            for i in ob.data.materials:
+                NumberOfMaterials +=1
+            
+            
+            bpy.ops.object.particle_system_add()
+#Particle settings setting it up!
+            grassParticles = bpy.context.object.particle_systems.active
+            grassParticles.name = "clumpygrass"
+            grassParticles.settings.type = "HAIR"
+            grassParticles.settings.use_advanced_hair = True
+            grassParticles.settings.hair_step = 2
+            grassParticles.settings.count = 250
+            grassParticles.settings.normal_factor = 0.0082
+            grassParticles.settings.tangent_factor = 0.001
+            grassParticles.settings.tangent_phase = 0.250
+            grassParticles.settings.factor_random = 0.001
+            grassParticles.settings.use_dynamic_rotation = True
+            
+            grassParticles.settings.material = NumberOfMaterials
+            
+            grassParticles.settings.use_strand_primitive = True
+            grassParticles.settings.use_hair_bspline = True
+            grassParticles.settings.render_step = 3
+            grassParticles.settings.length_random = 0.3
+            grassParticles.settings.draw_step = 3
+# children
+            grassParticles.settings.child_type = "INTERPOLATED"
+            grassParticles.settings.child_length = 0.667
+            grassParticles.settings.child_length_threshold = 0.111
+            grassParticles.settings.rendered_child_count = 200
+            grassParticles.settings.virtual_parents = 1
+            grassParticles.settings.clump_factor = 0.425
+            grassParticles.settings.clump_shape = -0.999
+            grassParticles.settings.roughness_endpoint = 0.003
+            grassParticles.settings.roughness_end_shape = 5
+            
+            
+        
+        return {'FINISHED'}
+		
+####
+######### HAIR LAB ##########
+####
+class HairLabPanel(bpy.types.Panel):
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'TOOLS'
+
+    bl_label = "Hair Lab"
+    bl_context = "objectmode"
+    
+
+    def draw(self, context):
+        active_obj = bpy.context.active_object
+        active_scn = bpy.context.scene.name
+        layout = self.layout
+        col = layout.column(align=True)
+        
+        WhatToDo = getActionToDo(active_obj)
+      
+        
+        if WhatToDo == "GENERATE":
+            col.operator("hair.generate_hair", text="Create Hair")
+
+            col.prop(context.scene, "hair_type")
+        else:
+            col.label(text="Select mesh object")
+        
+        if active_scn == "TestHairScene":
+            col.operator("hair.switch_back", text="Switch back to scene")
+        else:
+            col.operator("hair.test_scene", text="Create Test Scene")
+
+# TO DO
+"""
+class saveSelection(bpy.types.Operator):
+    bl_idname = "save.selection"
+    bl_label = "Save Selection"
+    bl_description = "Save selected particles"
+    bl_register = True
+    bl_undo = True
+    
+    def execute(self, context):
+        
+        return {"FINISHED"}
+"""
+class testScene3(bpy.types.Operator):
+    bl_idname = "hair.switch_back"
+    bl_label = "Switch back to scene"
+    bl_description = "If you want keep this scene, switch scene in info window"
+    bl_register = True
+    bl_undo = True
+    
+    def execute(self, context):
+        scene = bpy.context.scene
+        bpy.data.scenes.remove(scene)
+        
+        return {"FINISHED"}
+        
+        
+class testScene4(bpy.types.Operator):
+    bl_idname = "hair.test_scene"
+    bl_label = "Create test scene"
+    bl_description = "You can switch scene in info panel"
+    bl_register = True
+    bl_undo = True
+    
+    def execute(self, context):
+# add new scene
+        bpy.ops.scene.new(type="NEW")
+        scene = bpy.context.scene
+        scene.name = "TestHairScene"
+# render settings
+        render = scene.render
+        render.resolution_x = 1920
+        render.resolution_y = 1080
+        render.resolution_percentage = 50
+# add new world
+        world = bpy.data.worlds.new("HairWorld")
+        scene.world = world
+        world.use_sky_blend = True
+        world.use_sky_paper = True
+        world.horizon_color = (0.004393,0.02121,0.050)
+        world.zenith_color = (0.03335,0.227,0.359)
+        
+# add text
+        bpy.ops.object.text_add(location=(-0.292,0,-0.152), rotation =(1.571,0,0))
+        text = bpy.context.active_object
+        text.scale = (0.05,0.05,0.05)
+        text.data.body = "Hair Lab"
+        
+# add material to text
+        textMaterial = bpy.data.materials.new('textMaterial')
+        text.data.materials.append(textMaterial)
+        textMaterial.use_shadeless = True
+        
+# add camera
+        bpy.ops.object.camera_add(location = (0,-1,0),rotation = (1.571,0,0))
+        cam = bpy.context.active_object.data
+        cam.lens = 50
+        cam.draw_size = 0.1
+        
+# add spot lamp
+        bpy.ops.object.lamp_add(type="SPOT", location = (-0.7,-0.5,0.3), rotation =(1.223,0,-0.960))
+        lamp1 = bpy.context.active_object.data
+        lamp1.name = "Key Light"
+        lamp1.energy = 1.5
+        lamp1.distance = 1.5
+        lamp1.shadow_buffer_soft = 5
+        lamp1.shadow_buffer_size = 8192
+        lamp1.shadow_buffer_clip_end = 1.5
+        lamp1.spot_blend = 0.5
+        
+# add spot lamp2
+        bpy.ops.object.lamp_add(type="SPOT", location = (0.7,-0.6,0.1), rotation =(1.571,0,0.785))
+        lamp2 = bpy.context.active_object.data
+        lamp2.name = "Fill Light"
+        lamp2.color = (0.874,0.874,1)
+        lamp2.energy = 0.5
+        lamp2.distance = 1.5
+        lamp2.shadow_buffer_soft = 5
+        lamp2.shadow_buffer_size = 4096
+        lamp2.shadow_buffer_clip_end = 1.5
+        lamp2.spot_blend = 0.5
+        
+# light Rim
+        """
+        # add spot lamp3
+        bpy.ops.object.lamp_add(type="SPOT", location = (0.191,0.714,0.689), rotation =(0.891,0,2.884))
+        lamp3 = bpy.context.active_object.data
+        lamp3.name = "Rim Light"
+        lamp3.color = (0.194,0.477,1)
+        lamp3.energy = 3
+        lamp3.distance = 1.5
+        lamp3.shadow_buffer_soft = 5
+        lamp3.shadow_buffer_size = 4096
+        lamp3.shadow_buffer_clip_end = 1.5
+        lamp3.spot_blend = 0.5
+        """
+# add sphere
+        bpy.ops.mesh.primitive_uv_sphere_add(size=0.1)
+        bpy.ops.object.shade_smooth()       
+        return {"FINISHED"}
+
+
+class GenerateHair(bpy.types.Operator):
+    bl_idname = "hair.generate_hair"
+    bl_label = "Generate Hair"
+    bl_description = "Create a Hair"
+    bl_register = True
+    bl_undo = True
+    
+    def execute(self, context):
+# Make variable that is the current .blend file main data blocks
+        blend_data = context.blend_data
+        ob = bpy.context.active_object
+        scene = context.scene
+
+######################################################################
+########################Long Red Straight Hair########################
+        if scene.hair_type == '0':              
+            
+###############Create New Material##################
+# add new material
+            hairMaterial = bpy.data.materials.new('LongRedStraightHairMat')
+            ob.data.materials.append(hairMaterial)
+            
+#Material settings
+            hairMaterial.preview_render_type = "HAIR"
+            hairMaterial.diffuse_color = (0.287, 0.216, 0.04667)
+            hairMaterial.specular_color = (0.604, 0.465, 0.136)
+            hairMaterial.specular_intensity = 0.3
+            hairMaterial.ambient = 0
+            hairMaterial.use_cubic = True
+            hairMaterial.use_transparency = True
+            hairMaterial.alpha = 0
+            hairMaterial.use_transparent_shadows = True
+#strand
+            hairMaterial.strand.use_blender_units = True
+            hairMaterial.strand.root_size = 0.00030
+            hairMaterial.strand.tip_size = 0.00010
+            hairMaterial.strand.size_min = 0.7
+            hairMaterial.strand.width_fade = 0.1
+            hairMaterial.strand.shape = 0.061
+            hairMaterial.strand.blend_distance = 0.001
+            
+            
+# add texture
+            hairTex = bpy.data.textures.new("LongRedStraightHairTex", type='BLEND')
+            hairTex.use_preview_alpha = True
+            hairTex.use_color_ramp = True
+            ramp = hairTex.color_ramp
+            rampElements = ramp.elements
+            rampElements[0].position = 0
+            rampElements[0].color = [0.114,0.05613,0.004025,0.38]
+            rampElements[1].position = 1
+            rampElements[1].color = [0.267,0.155,0.02687,0]
+            rampElement1 = rampElements.new(0.111)
+            rampElement1.color = [0.281,0.168,0.03157,0.65]
+            rampElement2 = rampElements.new(0.366)
+            rampElement2.color = [0.288,0.135,0.006242,0.87]
+            rampElement3 = rampElements.new(0.608)
+            rampElement3.color = [0.247,0.113,0.006472,0.8]
+            rampElement4 = rampElements.new(0.828)
+            rampElement4.color = [0.253,0.09919,0.01242,0.64]
+    
+# add texture to material
+            MTex = hairMaterial.texture_slots.add()
+            MTex.texture = hairTex
+            MTex.texture_coords = "STRAND"
+            MTex.use_map_alpha = True
+            
+            
+            
+###############Create Particles##################
+# Add new particle system
+            
+            NumberOfMaterials = 0
+            for i in ob.data.materials:
+                NumberOfMaterials +=1
+            
+            
+            bpy.ops.object.particle_system_add()
+#Particle settings setting it up!
+            hairParticles = bpy.context.object.particle_systems.active
+            hairParticles.name = "LongRedStraightHairPar"
+            hairParticles.settings.type = "HAIR"
+            hairParticles.settings.use_advanced_hair = True
+            hairParticles.settings.count = 500
+            hairParticles.settings.normal_factor = 0.05
+            hairParticles.settings.factor_random = 0.001
+            hairParticles.settings.use_dynamic_rotation = True
+            
+            hairParticles.settings.material = NumberOfMaterials
+            
+            hairParticles.settings.use_strand_primitive = True
+            hairParticles.settings.use_hair_bspline = True
+            hairParticles.settings.render_step = 5
+            hairParticles.settings.length_random = 0.5
+            hairParticles.settings.draw_step = 5
+# children
+            hairParticles.settings.child_type = "INTERPOLATED"
+            hairParticles.settings.create_long_hair_children = True
+            hairParticles.settings.clump_factor = 0.55
+            hairParticles.settings.roughness_endpoint = 0.005
+            hairParticles.settings.roughness_end_shape = 5
+            hairParticles.settings.roughness_2 = 0.003
+            hairParticles.settings.roughness_2_size = 0.230
+        
+        
+######################################################################
+########################Long Brown Curl Hair##########################
+        if scene.hair_type == '1':
+###############Create New Material##################
+# add new material
+            hairMaterial = bpy.data.materials.new('LongBrownCurlHairMat')
+            ob.data.materials.append(hairMaterial)
+            
+#Material settings
+            hairMaterial.preview_render_type = "HAIR"
+            hairMaterial.diffuse_color = (0.662, 0.518, 0.458)
+            hairMaterial.specular_color = (0.351, 0.249, 0.230)
+            hairMaterial.specular_intensity = 0.3
+            hairMaterial.specular_hardness = 100
+            hairMaterial.use_specular_ramp = True
+            
+            ramp = hairMaterial.specular_ramp
+            rampElements = ramp.elements
+            rampElements[0].position = 0
+            rampElements[0].color = [0.0356,0.0152,0.009134,0]
+            rampElements[1].position = 1
+            rampElements[1].color = [0.352,0.250,0.231,1]
+            rampElement1 = rampElements.new(0.255)
+            rampElement1.color = [0.214,0.08244,0.0578,0.31]
+            rampElement2 = rampElements.new(0.594)
+            rampElement2.color = [0.296,0.143,0.0861,0.72]
+            
+            hairMaterial.ambient = 0
+            hairMaterial.use_cubic = True
+            hairMaterial.use_transparency = True
+            hairMaterial.alpha = 0
+            hairMaterial.use_transparent_shadows = True
+#strand
+            hairMaterial.strand.use_blender_units = True
+            hairMaterial.strand.root_size = 0.00030
+            hairMaterial.strand.tip_size = 0.00015
+            hairMaterial.strand.size_min = 0.450
+            hairMaterial.strand.width_fade = 0.1
+            hairMaterial.strand.shape = 0.02
+            hairMaterial.strand.blend_distance = 0.001
+            
+            
+# add texture
+            hairTex = bpy.data.textures.new("HairTex", type='BLEND')
+            hairTex.name = "LongBrownCurlHairTex"
+            hairTex.use_preview_alpha = True
+            hairTex.use_color_ramp = True
+            ramp = hairTex.color_ramp
+            rampElements = ramp.elements
+            rampElements[0].position = 0
+            rampElements[0].color = [0.009721,0.006049,0.003677,0.38]
+            rampElements[1].position = 1
+            rampElements[1].color = [0.04231,0.02029,0.01444,0.16]
+            rampElement1 = rampElements.new(0.111)
+            rampElement1.color = [0.01467,0.005307,0.00316,0.65]
+            rampElement2 = rampElements.new(0.366)
+            rampElement2.color = [0.0272,0.01364,0.01013,0.87]
+            rampElement3 = rampElements.new(0.608)
+            rampElement3.color = [0.04445,0.02294,0.01729,0.8]
+            rampElement4 = rampElements.new(0.828)
+            rampElement4.color = [0.04092,0.0185,0.01161,0.64]
+            
+# add texture to material
+            MTex = hairMaterial.texture_slots.add()
+            MTex.texture = hairTex
+            MTex.texture_coords = "STRAND"
+            MTex.use_map_alpha = True
+            
+            
+###############Create Particles##################
+# Add new particle system
+            
+            NumberOfMaterials = 0
+            for i in ob.data.materials:
+                NumberOfMaterials +=1
+            
+            
+            bpy.ops.object.particle_system_add()
+#Particle settings setting it up!
+            hairParticles = bpy.context.object.particle_systems.active
+            hairParticles.name = "LongBrownCurlHairPar"
+            hairParticles.settings.type = "HAIR"
+            hairParticles.settings.use_advanced_hair = True
+            hairParticles.settings.count = 500
+            hairParticles.settings.normal_factor = 0.05
+            hairParticles.settings.factor_random = 0.001
+            hairParticles.settings.use_dynamic_rotation = True
+            
+            hairParticles.settings.material = NumberOfMaterials
+            
+            hairParticles.settings.use_strand_primitive = True
+            hairParticles.settings.use_hair_bspline = True
+            hairParticles.settings.render_step = 7
+            hairParticles.settings.length_random = 0.5
+            hairParticles.settings.draw_step = 5
+# children
+            hairParticles.settings.child_type = "INTERPOLATED"
+            hairParticles.settings.create_long_hair_children = True
+            hairParticles.settings.clump_factor = 0.523
+            hairParticles.settings.clump_shape = 0.383
+            hairParticles.settings.roughness_endpoint = 0.002
+            hairParticles.settings.roughness_end_shape = 5
+            hairParticles.settings.roughness_2 = 0.003
+            hairParticles.settings.roughness_2_size = 2
+            
+            hairParticles.settings.kink = "CURL"
+            hairParticles.settings.kink_amplitude = 0.007597
+            hairParticles.settings.kink_frequency = 6
+            hairParticles.settings.kink_shape = 0.4
+            hairParticles.settings.kink_flat = 0.8
+        
+        
+######################################################################
+########################Short Dark Hair##########################
+        elif scene.hair_type == '2':
+###############Create New Material##################
+# add new material
+            hairMaterial = bpy.data.materials.new('ShortDarkHairMat')
+            ob.data.materials.append(hairMaterial)
+            
+#Material settings
+            hairMaterial.preview_render_type = "HAIR"
+            hairMaterial.diffuse_color = (0.560, 0.536, 0.506)
+            hairMaterial.specular_color = (0.196, 0.177, 0.162)
+            hairMaterial.specular_intensity = 0.5
+            hairMaterial.specular_hardness = 100
+            hairMaterial.ambient = 0
+            hairMaterial.use_cubic = True
+            hairMaterial.use_transparency = True
+            hairMaterial.alpha = 0
+            hairMaterial.use_transparent_shadows = True
+#strand
+            hairMaterial.strand.use_blender_units = True
+            hairMaterial.strand.root_size = 0.0002
+            hairMaterial.strand.tip_size = 0.0001
+            hairMaterial.strand.size_min = 0.3
+            hairMaterial.strand.width_fade = 0.1
+            hairMaterial.strand.shape = 0
+            hairMaterial.strand.blend_distance = 0.001
+            
+# add texture
+            hairTex = bpy.data.textures.new("ShortDarkHair", type='BLEND')
+            hairTex.use_preview_alpha = True
+            hairTex.use_color_ramp = True
+            ramp = hairTex.color_ramp
+            rampElements = ramp.elements
+            rampElements[0].position = 0
+            rampElements[0].color = [0.004025,0.002732,0.002428,0.38]
+            rampElements[1].position = 1
+            rampElements[1].color = [0.141,0.122,0.107,0.2]
+            rampElement1 = rampElements.new(0.202)
+            rampElement1.color = [0.01885,0.0177,0.01827,0.65]
+            rampElement2 = rampElements.new(0.499)
+            rampElement2.color = [0.114,0.109,0.09822,0.87]
+            rampElement3 = rampElements.new(0.828)
+            rampElement3.color = [0.141,0.127,0.117,0.64]
+            
+# add texture to material
+            MTex = hairMaterial.texture_slots.add()
+            MTex.texture = hairTex
+            MTex.texture_coords = "STRAND"
+            MTex.use_map_alpha = True
+            
+            
+###############Create Particles##################
+# Add new particle system
+            
+            NumberOfMaterials = 0
+            for i in ob.data.materials:
+                NumberOfMaterials +=1
+            
+            
+            bpy.ops.object.particle_system_add()
+#Particle settings setting it up!
+            hairParticles = bpy.context.object.particle_systems.active
+            hairParticles.name = "ShortDarkHair"
+            hairParticles.settings.type = "HAIR"
+            hairParticles.settings.use_advanced_hair = True
+            hairParticles.settings.hair_step = 2
+            hairParticles.settings.count = 450
+            hairParticles.settings.normal_factor = 0.007
+            hairParticles.settings.factor_random = 0.001
+            hairParticles.settings.use_dynamic_rotation = True
+            
+            hairParticles.settings.material = NumberOfMaterials
+            
+            hairParticles.settings.use_strand_primitive = True
+            hairParticles.settings.use_hair_bspline = True
+            hairParticles.settings.render_step = 3
+            hairParticles.settings.length_random = 0.3
+            hairParticles.settings.draw_step = 3
+# children
+            hairParticles.settings.child_type = "INTERPOLATED"
+            hairParticles.settings.rendered_child_count = 200
+            hairParticles.settings.virtual_parents = 1
+            hairParticles.settings.clump_factor = 0.425
+            hairParticles.settings.clump_shape = 0.1
+            hairParticles.settings.roughness_endpoint = 0.003
+            hairParticles.settings.roughness_end_shape = 5
+            
+            
+        
+        return {'FINISHED'}
+####
+######## FUR LAB ########
+####
+
+class FurLabPanel(bpy.types.Panel):
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'TOOLS'
+
+    bl_label = "Fur Lab"
+    bl_context = "objectmode"
+    
+
+    def draw(self, context):
+        active_obj = bpy.context.active_object
+        active_scn = bpy.context.scene.name
+        layout = self.layout
+        col = layout.column(align=True)
+        
+        WhatToDo = getActionToDo(active_obj)
+      
+        
+        if WhatToDo == "GENERATE":
+            col.operator("fur.generate_fur", text="Create Fur")
+
+            col.prop(context.scene, "fur_type")
+        else:
+            col.label(text="Select mesh object")
+        
+        if active_scn == "TestFurScene":
+            col.operator("hair.switch_back", text="Switch back to scene")
+        else:
+            col.operator("fur.test_scene", text="Create Test Scene")
+
+# TO DO
+"""
+class saveSelection(bpy.types.Operator):
+    bl_idname = "save.selection"
+    bl_label = "Save Selection"
+    bl_description = "Save selected particles"
+    bl_register = True
+    bl_undo = True
+    
+    def execute(self, context):
+        
+        return {"FINISHED"}
+"""
+class testScene5(bpy.types.Operator):
+    bl_idname = "fur.switch_back"
+    bl_label = "Switch back to scene"
+    bl_description = "If you want keep this scene, switch scene in info window"
+    bl_register = True
+    bl_undo = True
+    
+    def execute(self, context):
+        scene = bpy.context.scene
+        bpy.data.scenes.remove(scene)
+        
+        return {"FINISHED"}
+        
+        
+class testScene6(bpy.types.Operator):
+    bl_idname = "fur.test_scene"
+    bl_label = "Create test scene"
+    bl_description = "You can switch scene in info panel"
+    bl_register = True
+    bl_undo = True
+    
+    def execute(self, context):
+# add new scene
+        bpy.ops.scene.new(type="NEW")
+        scene = bpy.context.scene
+        scene.name = "TestFurScene"
+# render settings
+        render = scene.render
+        render.resolution_x = 1920
+        render.resolution_y = 1080
+        render.resolution_percentage = 50
+# add new world
+        world = bpy.data.worlds.new("FurWorld")
+        scene.world = world
+        world.use_sky_blend = True
+        world.use_sky_paper = True
+        world.horizon_color = (0.004393,0.02121,0.050)
+        world.zenith_color = (0.03335,0.227,0.359)
+        
+# add text
+        bpy.ops.object.text_add(location=(-0.292,0,-0.152), rotation =(1.571,0,0))
+        text = bpy.context.active_object
+        text.scale = (0.05,0.05,0.05)
+        text.data.body = "Fur Lab"
+        
+# add material to text
+        textMaterial = bpy.data.materials.new('textMaterial')
+        text.data.materials.append(textMaterial)
+        textMaterial.use_shadeless = True
+        
+# add camera
+        bpy.ops.object.camera_add(location = (0,-1,0),rotation = (1.571,0,0))
+        cam = bpy.context.active_object.data
+        cam.lens = 50
+        cam.draw_size = 0.1
+        
+# add spot lamp
+        bpy.ops.object.lamp_add(type="SPOT", location = (-0.7,-0.5,0.3), rotation =(1.223,0,-0.960))
+        lamp1 = bpy.context.active_object.data
+        lamp1.name = "Key Light"
+        lamp1.energy = 1.5
+        lamp1.distance = 1.5
+        lamp1.shadow_buffer_soft = 5
+        lamp1.shadow_buffer_size = 8192
+        lamp1.shadow_buffer_clip_end = 1.5
+        lamp1.spot_blend = 0.5
+        
+# add spot lamp2
+        bpy.ops.object.lamp_add(type="SPOT", location = (0.7,-0.6,0.1), rotation =(1.571,0,0.785))
+        lamp2 = bpy.context.active_object.data
+        lamp2.name = "Fill Light"
+        lamp2.color = (0.874,0.874,1)
+        lamp2.energy = 0.5
+        lamp2.distance = 1.5
+        lamp2.shadow_buffer_soft = 5
+        lamp2.shadow_buffer_size = 4096
+        lamp2.shadow_buffer_clip_end = 1.5
+        lamp2.spot_blend = 0.5
+        
+# light Rim
+        """
+        # add spot lamp3
+        bpy.ops.object.lamp_add(type="SPOT", location = (0.191,0.714,0.689), rotation =(0.891,0,2.884))
+        lamp3 = bpy.context.active_object.data
+        lamp3.name = "Rim Light"
+        lamp3.color = (0.194,0.477,1)
+        lamp3.energy = 3
+        lamp3.distance = 1.5
+        lamp3.shadow_buffer_soft = 5
+        lamp3.shadow_buffer_size = 4096
+        lamp3.shadow_buffer_clip_end = 1.5
+        lamp3.spot_blend = 0.5
+        """
+# add sphere
+        bpy.ops.mesh.primitive_uv_sphere_add(size=0.1)
+        bpy.ops.object.shade_smooth()       
+        return {"FINISHED"}
+
+
+class GenerateFur(bpy.types.Operator):
+    bl_idname = "fur.generate_fur"
+    bl_label = "Generate Fur"
+    bl_description = "Create a Fur"
+    bl_register = True
+    bl_undo = True
+    
+    def execute(self, context):
+# Make variable that is the current .blend file main data blocks
+        blend_data = context.blend_data
+        ob = bpy.context.active_object
+        scene = context.scene
+
+######################################################################
+########################Short Fur########################
+        if scene.fur_type == '0':              
+            
+###############Create New Material##################
+# add new material
+            furMaterial = bpy.data.materials.new('Fur 1')
+            ob.data.materials.append(furMaterial)
+            
+#Material settings
+            furMaterial.preview_render_type = "HAIR"
+            furMaterial.diffuse_color = (0.287, 0.216, 0.04667)
+            furMaterial.specular_color = (0.604, 0.465, 0.136)
+            furMaterial.specular_intensity = 0.3
+            furMaterial.ambient = 0
+            furMaterial.use_cubic = True
+            furMaterial.use_transparency = True
+            furMaterial.alpha = 0
+            furMaterial.use_transparent_shadows = True
+#strand
+            furMaterial.strand.use_blender_units = True
+            furMaterial.strand.root_size = 0.00030
+            furMaterial.strand.tip_size = 0.00010
+            furMaterial.strand.size_min = 0.7
+            furMaterial.strand.width_fade = 0.1
+            furMaterial.strand.shape = 0.061
+            furMaterial.strand.blend_distance = 0.001
+            
+            
+# add texture
+            furTex = bpy.data.textures.new("Fur1Tex", type='BLEND')
+            furTex.use_preview_alpha = True
+            furTex.use_color_ramp = True
+            ramp = furTex.color_ramp
+            rampElements = ramp.elements
+            rampElements[0].position = 0
+            rampElements[0].color = [0.114,0.05613,0.004025,0.38]
+            rampElements[1].position = 1
+            rampElements[1].color = [0.267,0.155,0.02687,0]
+            rampElement1 = rampElements.new(0.111)
+            rampElement1.color = [0.281,0.168,0.03157,0.65]
+            rampElement2 = rampElements.new(0.366)
+            rampElement2.color = [0.288,0.135,0.006242,0.87]
+            rampElement3 = rampElements.new(0.608)
+            rampElement3.color = [0.247,0.113,0.006472,0.8]
+            rampElement4 = rampElements.new(0.828)
+            rampElement4.color = [0.253,0.09919,0.01242,0.64]
+    
+# add texture to material
+            MTex = furMaterial.texture_slots.add()
+            MTex.texture = furTex
+            MTex.texture_coords = "STRAND"
+            MTex.use_map_alpha = True  
+            
+            
+###############Create Particles##################
+# Add new particle system
+            
+            NumberOfMaterials = 0
+            for i in ob.data.materials:
+                NumberOfMaterials +=1
+            
+            
+            bpy.ops.object.particle_system_add()
+#Particle settings setting it up!
+            furParticles = bpy.context.object.particle_systems.active
+            furParticles.name = "Fur1Par"
+            furParticles.settings.type = "HAIR"
+            furParticles.settings.use_advanced_hair = True
+            furParticles.settings.count = 500
+            furParticles.settings.normal_factor = 0.05
+            furParticles.settings.factor_random = 0.001
+            furParticles.settings.use_dynamic_rotation = True
+            
+            furParticles.settings.material = NumberOfMaterials
+            
+            furParticles.settings.use_strand_primitive = True
+            furParticles.settings.use_hair_bspline = True
+            furParticles.settings.render_step = 5
+            furParticles.settings.length_random = 0.5
+            furParticles.settings.draw_step = 5
+# children
+            furParticles.settings.child_type = "INTERPOLATED"
+            furParticles.settings.child_length = 0.134
+            furParticles.settings.create_long_hair_children = True
+            furParticles.settings.clump_factor = 0.55
+            furParticles.settings.roughness_endpoint = 0.005
+            furParticles.settings.roughness_end_shape = 5
+            furParticles.settings.roughness_2 = 0.003
+            furParticles.settings.roughness_2_size = 0.230
+        
+        
+######################################################################
+########################Dalmation Fur##########################
+        if scene.fur_type == '1':
+###############Create New Material##################
+# add new material
+            furMaterial = bpy.data.materials.new('Fur2Mat')
+            ob.data.materials.append(furMaterial)
+            
+#Material settings
+            furMaterial.preview_render_type = "HAIR"
+            furMaterial.diffuse_color = (0.300, 0.280, 0.280)
+            furMaterial.specular_color = (1.0, 1.0, 1.0)
+            furMaterial.specular_intensity = 0.500
+            furMaterial.specular_hardness = 50
+            
+            furMaterial.ambient = 0
+            furMaterial.use_cubic = True
+            furMaterial.use_transparency = True
+            furMaterial.alpha = 0
+            furMaterial.use_transparent_shadows = True
+#strand
+            furMaterial.strand.use_blender_units = True
+            furMaterial.strand.root_size = 0.00030
+            furMaterial.strand.tip_size = 0.00010
+            furMaterial.strand.size_min = 0.7
+            furMaterial.strand.width_fade = 0.1
+            furMaterial.strand.shape = 0.061
+            furMaterial.strand.blend_distance = 0.001
+            
+            
+# add texture
+            furTex = bpy.data.textures.new("Fur2Tex", type='BLEND')
+            furTex.name = "Fur2"
+            furTex.use_preview_alpha = True
+            furTex.use_color_ramp = True
+            ramp = furTex.color_ramp
+            rampElements = ramp.elements
+            rampElements[0].position = 0
+            rampElements[0].color = [1.0,1.0,1.0,1.0]
+            rampElements[1].position = 1
+            rampElements[1].color = [1.0,1.0,1.0,0.0]
+            rampElement1 = rampElements.new(0.116)
+            rampElement1.color = [1.0,1.0,1.0,1.0]
+       
+            
+# add texture to material
+            MTex = furMaterial.texture_slots.add()
+            MTex.texture = furTex
+            MTex.texture_coords = "STRAND"
+            MTex.use_map_alpha = True
+			
+# add texture 2
+            furTex = bpy.data.textures.new("Fur2bTex", type='CLOUDS')
+            furTex.name = "Fur2b"
+            furTex.use_preview_alpha = False
+            furTex.cloud_type = "COLOR"
+            furTex.noise_type = "HARD_NOISE"
+            furTex.noise_scale = 0.06410
+            furTex.use_color_ramp = True
+            ramp = furTex.color_ramp
+            rampElements = ramp.elements
+            rampElements[0].position = 0
+            rampElements[0].color = [1.0,1.0,1.0, 1.0]
+            rampElements[1].position = 1
+            rampElements[1].color = [0.0,0.0,0.0,1.0]
+            rampElement1 = rampElements.new(0.317)
+            rampElement1.color = [1.0,1.0,1.0,1.0]
+            rampElement2 = rampElements.new(0.347)
+            rampElement2.color = [0.0,0.0,0.0,1.0]
+            
+# add texture 2 to material
+            MTex = furMaterial.texture_slots.add()
+            MTex.texture = furTex
+            MTex.texture_coords = "GLOBAL"
+            MTex.use_map_alpha = True      
+            
+###############Create Particles##################
+# Add new particle system
+            
+            NumberOfMaterials = 0
+            for i in ob.data.materials:
+                NumberOfMaterials +=1
+            
+            
+            bpy.ops.object.particle_system_add()
+#Particle settings setting it up!
+            furParticles = bpy.context.object.particle_systems.active
+            furParticles.name = "Fur2Par"
+            furParticles.settings.type = "HAIR"
+            furParticles.settings.use_advanced_hair = True
+            furParticles.settings.count = 500
+            furParticles.settings.normal_factor = 0.05
+            furParticles.settings.factor_random = 0.001
+            furParticles.settings.use_dynamic_rotation = True
+            
+            furParticles.settings.material = NumberOfMaterials
+            
+            furParticles.settings.use_strand_primitive = True
+            furParticles.settings.use_hair_bspline = True
+            furParticles.settings.render_step = 5
+            furParticles.settings.length_random = 0.5
+            furParticles.settings.draw_step = 5
+# children
+            furParticles.settings.child_type = "INTERPOLATED"
+            furParticles.settings.child_length = 0.07227
+            furParticles.settings.create_long_hair_children = True
+            furParticles.settings.clump_factor = 0.55
+            furParticles.settings.roughness_endpoint = 0.005
+            furParticles.settings.roughness_end_shape = 5
+            furParticles.settings.roughness_2 = 0.003
+            furParticles.settings.roughness_2_size = 0.230
+        
+######################################################################
+########################Spotted_fur##########################
+        elif scene.fur_type == '2':
+
+###############Create New Material##################
+# add new material
+            furMaterial = bpy.data.materials.new('Fur3Mat')
+            ob.data.materials.append(furMaterial)
+            
+#Material settings
+            furMaterial.preview_render_type = "HAIR"
+            furMaterial.diffuse_color = (0.300, 0.280, 0.280)
+            furMaterial.specular_color = (1.0, 1.0, 1.0)
+            furMaterial.specular_intensity = 0.500
+            furMaterial.specular_hardness = 50
+            furMaterial.use_specular_ramp = True
+            
+            ramp = furMaterial.specular_ramp
+            rampElements = ramp.elements
+            rampElements[0].position = 0
+            rampElements[0].color = [0.0356,0.0152,0.009134,0]
+            rampElements[1].position = 1
+            rampElements[1].color = [0.352,0.250,0.231,1]
+            rampElement1 = rampElements.new(0.255)
+            rampElement1.color = [0.214,0.08244,0.0578,0.31]
+            rampElement2 = rampElements.new(0.594)
+            rampElement2.color = [0.296,0.143,0.0861,0.72]
+            
+            furMaterial.ambient = 0
+            furMaterial.use_cubic = True
+            furMaterial.use_transparency = True
+            furMaterial.alpha = 0
+            furMaterial.use_transparent_shadows = True
+#strand
+            furMaterial.strand.use_blender_units = True
+            furMaterial.strand.root_size = 0.00030
+            furMaterial.strand.tip_size = 0.00015
+            furMaterial.strand.size_min = 0.450
+            furMaterial.strand.width_fade = 0.1
+            furMaterial.strand.shape = 0.02
+            furMaterial.strand.blend_distance = 0.001
+            
+            
+# add texture
+            furTex = bpy.data.textures.new("Fur3Tex", type='BLEND')
+            furTex.name = "Fur3"
+            furTex.use_preview_alpha = True
+            furTex.use_color_ramp = True
+            ramp = furTex.color_ramp
+            rampElements = ramp.elements
+            rampElements[0].position = 0
+            rampElements[0].color = [0.009721,0.006049,0.003677,0.38]
+            rampElements[1].position = 1
+            rampElements[1].color = [0.04231,0.02029,0.01444,0.16]
+            rampElement1 = rampElements.new(0.111)
+            rampElement1.color = [0.01467,0.005307,0.00316,0.65]
+            rampElement2 = rampElements.new(0.366)
+            rampElement2.color = [0.0272,0.01364,0.01013,0.87]
+            rampElement3 = rampElements.new(0.608)
+            rampElement3.color = [0.04445,0.02294,0.01729,0.8]
+            rampElement4 = rampElements.new(0.828)
+            rampElement4.color = [0.04092,0.0185,0.01161,0.64]
+            
+# add texture to material
+            MTex = furMaterial.texture_slots.add()
+            MTex.texture = furTex
+            MTex.texture_coords = "STRAND"
+            MTex.use_map_alpha = True
+			
+# add texture 2
+            furTex = bpy.data.textures.new("Fur3bTex", type='CLOUDS')
+            furTex.name = "Fur3b"
+            furTex.use_preview_alpha = True
+            furTex.cloud_type = "COLOR"
+            furTex.use_color_ramp = True
+            ramp = furTex.color_ramp
+            rampElements = ramp.elements
+            rampElements[0].position = 0
+            rampElements[0].color = [0.009721,0.006049,0.003677,0.38]
+            rampElements[1].position = 1
+            rampElements[1].color = [0.04231,0.02029,0.01444,0.16]
+            rampElement1 = rampElements.new(0.111)
+            rampElement1.color = [0.01467,0.005307,0.00316,0.65]
+            rampElement2 = rampElements.new(0.366)
+            rampElement2.color = [0.0272,0.01364,0.01013,0.87]
+            rampElement3 = rampElements.new(0.608)
+            rampElement3.color = [0.04445,0.02294,0.01729,0.8]
+            rampElement4 = rampElements.new(0.828)
+            rampElement4.color = [0.04092,0.0185,0.01161,0.64]
+            
+# add texture 2 to material
+            MTex = furMaterial.texture_slots.add()
+            MTex.texture = furTex
+            MTex.texture_coords = "GLOBAL"
+            MTex.use_map_alpha = False      
+            
+###############Create Particles##################
+# Add new particle system
+            
+            NumberOfMaterials = 0
+            for i in ob.data.materials:
+                NumberOfMaterials +=1
+            
+            
+            bpy.ops.object.particle_system_add()
+#Particle settings setting it up!
+            furParticles = bpy.context.object.particle_systems.active
+            furParticles.name = "Fur3Par"
+            furParticles.settings.type = "HAIR"
+            furParticles.settings.use_advanced_hair = True
+            furParticles.settings.count = 500
+            furParticles.settings.normal_factor = 0.05
+            furParticles.settings.factor_random = 0.001
+            furParticles.settings.use_dynamic_rotation = True
+            
+            furParticles.settings.material = NumberOfMaterials
+            
+            furParticles.settings.use_strand_primitive = True
+            furParticles.settings.use_hair_bspline = True
+            furParticles.settings.render_step = 5
+            furParticles.settings.length_random = 0.5
+            furParticles.settings.draw_step = 5
+# children
+            furParticles.settings.child_type = "INTERPOLATED"
+            furParticles.settings.child_length = 0.134
+            furParticles.settings.create_long_hair_children = True
+            furParticles.settings.clump_factor = 0.55
+            furParticles.settings.roughness_endpoint = 0.005
+            furParticles.settings.roughness_end_shape = 5
+            furParticles.settings.roughness_2 = 0.003
+            furParticles.settings.roughness_2_size = 0.230
+        
+        return {'FINISHED'}
+def register():
+    bpy.utils.register_module(__name__)
+    bpy.types.Scene.grass_type = EnumProperty(
+        name="Type",
+        description="Select the type of grass",
+        items=[("0","Green Grass","Generate particle grass"),
+               ("1","Grassy Field","Generate particle grass"),
+               ("2","Clumpy Grass","Generate particle grass"),
+        
+              ],
+        default='0')
+    bpy.types.Scene.hair_type = EnumProperty(
+        name="Type",
+        description="Select the type of hair",
+        items=[("0","Long Red Straight Hair","Generate particle Hair"),
+               ("1","Long Brown Curl Hair","Generate particle Hair"),
+               ("2","Short Dark Hair","Generate particle Hair"),
+        
+              ],
+        default='0')
+    bpy.types.Scene.fur_type = EnumProperty(
+        name="Type",
+        description="Select the type of fur",
+        items=[("0","Short Fur","Generate particle Fur"),
+               ("1","Dalmation","Generate particle Fur"),
+               ("2","Fur3","Generate particle Fur"),
+        
+              ],
+        default='0')
+        
+def unregister():
+    bpy.utils.unregister_module(__name__)
+    del bpy.types.Scene.hair_type
+    
+if __name__ == "__main__":
+    register()
+    
+    
+
diff --git a/release/scripts/addons_contrib/presets/interface_theme/3ds_max.xml b/release/scripts/addons_contrib/presets/interface_theme/3ds_max.xml
new file mode 100644
index 0000000..370c57b
--- /dev/null
+++ b/release/scripts/addons_contrib/presets/interface_theme/3ds_max.xml
@@ -0,0 +1,828 @@
+<bpy>
+  <Theme>
+    <view_3d>
+      <ThemeView3D object_active="#ffffff"
+                   editmesh_active="#fcf8ff80"
+                   act_spline="#db2512"
+                   handle_align="#803060"
+                   handle_sel_align="#f090a0"
+                   handle_auto="#909000"
+                   handle_sel_auto="#f0ff40"
+                   bone_pose="#50c8ff"
+                   bone_solid="#c8c8c8"
+                   bundle_solid="#c8c8c8"
+                   camera="#000000"
+                   camera_path="#000000"
+                   frame_current="#60c040"
+                   edge_crease="#cc0099"
+                   extra_edge_len="#200000"
+                   edge_seam="#e69632"
+                   edge_select="#ff3d3d"
+                   edge_sharp="#ff2020"
+                   edge_facesel="#4b4b4b"
+                   empty="#000000"
+                   face="#a8a8a84d"
+                   extra_face_angle="#000080"
+                   extra_face_area="#002000"
+                   face_dot="#883737"
+                   facedot_size="2"
+                   normal="#22dddd"
+                   face_select="#ae606066"
+                   handle_free="#000000"
+                   handle_sel_free="#000000"
+                   grid="#505050"
+                   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="#fa3f00"
+                   outline_width="1"
+                   panel="#a5a5a5ff"
+                   speaker="#000000"
+                   transform="#ffffff"
+                   handle_vect="#409030"
+                   handle_sel_vect="#40c030"
+                   vertex="#5454f0"
+                   vertex_normal="#2361dd"
+                   vertex_select="#ae6060"
+                   vertex_size="3"
+                   wire="#000000">
+        <space>
+          <ThemeSpaceGeneric header="#b4b4b4"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#b4b4b4"
+                             button_text="#494949"
+                             button_text_hi="#ffffff"
+                             button_title="#494949"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#737373">
+          </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">
+        <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="#737373">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeClipEditor>
+    </clip_editor>
+    <console>
+      <ThemeConsole cursor="#dc6060"
+                    line_error="#dc6060"
+                    line_info="#00aa00"
+                    line_input="#ffffff"
+                    line_output="#000000">
+        <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="#b4b4b4">
+          </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="#505050"
+                      long_key="#0c0a0a"
+                      long_key_selected="#ff8c00"
+                      value_sliders="#000000"
+                      view_sliders="#969696">
+        <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="#737373">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#b4b4b4"
+                                 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="#d7ae6d"
+                        tiles="#b4b4b4">
+        <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="#0f0f0f"
+                             title="#000000"
+                             back="#b4b4b4">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#b4b4b4"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </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="#505050"
+                        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">
+        <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="#737373">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#b4b4b4"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeGraphEditor>
+    </graph_editor>
+    <image_editor>
+      <ThemeImageEditor editmesh_active="#ffffff80"
+                        face="#ffffff0a"
+                        face_dot="#ff0000"
+                        facedot_size="3"
+                        face_select="#7c00003c"
+                        scope_back="#b4b4b4ff"
+                        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="#5454f0"
+                        vertex_select="#d00000"
+                        vertex_size="3">
+        <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>
+      </ThemeImageEditor>
+    </image_editor>
+    <info>
+      <ThemeInfo>
+        <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="#b4b4b4">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeInfo>
+    </info>
+    <logic_editor>
+      <ThemeLogicEditor panel="#a5a5a5">
+        <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="#b4b4b4">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeLogicEditor>
+    </logic_editor>
+    <nla_editor>
+      <ThemeNLAEditor bars="#707070"
+                      bars_selected="#60c040"
+                      frame_current="#60c040"
+                      grid="#5e5e5e"
+                      strips="#0c0a0a"
+                      strips_selected="#ff8c00"
+                      view_sliders="#969696">
+        <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="#b4b4b4"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeNLAEditor>
+    </nla_editor>
+    <node_editor>
+      <ThemeNodeEditor converter_node="#deaf66"
+                       group_node="#3c753c"
+                       in_out_node="#faa044"
+                       node_backdrop="#9b9b9ba0"
+                       noodle_curving="5"
+                       operator_node="#9e733e"
+                       selected_text="#7f7070"
+                       wire_select="#ffffff"
+                       wire="#000000">
+        <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="#737373">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#a5a5a5"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeNodeEditor>
+    </node_editor>
+    <outliner>
+      <ThemeOutliner match="#337f33"
+                     selected_highlight="#82878c">
+        <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="#fff1e1"
+                             title="#000000"
+                             back="#b4b4b4">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeOutliner>
+    </outliner>
+    <properties>
+      <ThemeProperties panel="#b4b4b4">
+        <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="#b4b4b4">
+          </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"
+                           plugin_strip="#7e7e50"
+                           preview_back="#000000"
+                           scene_strip="#4e983e"
+                           transition_strip="#a25f6f"
+                           window_sliders="#a0a0a0">
+        <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="#949494">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeSequenceEditor>
+    </sequence_editor>
+    <text_editor>
+      <ThemeTextEditor cursor="#ff0000"
+                       syntax_special="#5f5f00"
+                       line_numbers_background="#404040"
+                       selected_text="#c67777"
+                       syntax_builtin="#800050"
+                       syntax_comment="#006432"
+                       syntax_numbers="#0000c8"
+                       syntax_string="#640000">
+        <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="#d1d1d1">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTextEditor>
+    </text_editor>
+    <timeline>
+      <ThemeTimeline frame_current="#60c040"
+                     grid="#505050">
+        <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="#999999">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTimeline>
+    </timeline>
+    <user_interface>
+      <ThemeUserInterface icon_alpha="1"
+                          icon_file="">
+        <wcol_box>
+          <ThemeWidgetColors inner="#d1d1d1ff"
+                             inner_sel="#646464ff"
+                             item="#191919ff"
+                             outline="#191919"
+                             shadedown="0"
+                             shadetop="0"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_box>
+        <wcol_list_item>
+          <ThemeWidgetColors inner="#00000000"
+                             inner_sel="#d8c555aa"
+                             item="#000000ff"
+                             outline="#000000"
+                             shadedown="0"
+                             shadetop="0"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_list_item>
+        <wcol_menu_back>
+          <ThemeWidgetColors inner="#b4b4b4ff"
+                             inner_sel="#2d2d2dff"
+                             item="#646464ff"
+                             outline="#424242"
+                             shadedown="30"
+                             shadetop="0"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_menu_back>
+        <wcol_menu_item>
+          <ThemeWidgetColors inner="#00000000"
+                             inner_sel="#8897a4ff"
+                             item="#ffffffff"
+                             outline="#000000"
+                             shadedown="5"
+                             shadetop="-5"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_menu_item>
+        <wcol_menu>
+          <ThemeWidgetColors inner="#aeaeaeff"
+                             inner_sel="#464646ff"
+                             item="#6d8da6ff"
+                             outline="#464646"
+                             shadedown="-5"
+                             shadetop="15"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             text_sel="#cccccc">
+          </ThemeWidgetColors>
+        </wcol_menu>
+        <wcol_num>
+          <ThemeWidgetColors inner="#c4c4c4ff"
+                             inner_sel="#999999ff"
+                             item="#708faaff"
+                             outline="#708faa"
+                             shadedown="0"
+                             shadetop="-10"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_num>
+        <wcol_option>
+          <ThemeWidgetColors inner="#a2a2a2ff"
+                             inner_sel="#bbb8a3ff"
+                             item="#ffffffff"
+                             outline="#747474"
+                             shadedown="0"
+                             shadetop="10"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             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="FALSE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_progress>
+        <wcol_pulldown>
+          <ThemeWidgetColors inner="#3f3f3fff"
+                             inner_sel="#536a7e26"
+                             item="#ffffffff"
+                             outline="#000000"
+                             shadedown="-20"
+                             shadetop="25"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_pulldown>
+        <wcol_radio>
+          <ThemeWidgetColors inner="#c3c3c3ff"
+                             inner_sel="#ddae64ff"
+                             item="#ffffffff"
+                             outline="#708faa"
+                             shadedown="0"
+                             shadetop="10"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_radio>
+        <wcol_regular>
+          <ThemeWidgetColors inner="#999999ff"
+                             inner_sel="#646464ff"
+                             item="#191919ff"
+                             outline="#191919"
+                             shadedown="0"
+                             shadetop="0"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_regular>
+        <wcol_scroll>
+          <ThemeWidgetColors inner="#708faa26"
+                             inner_sel="#646464b4"
+                             item="#a9a9a9ff"
+                             outline="#708faa"
+                             shadedown="0"
+                             shadetop="0"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_scroll>
+        <wcol_numslider>
+          <ThemeWidgetColors inner="#b4b4b4ff"
+                             inner_sel="#999999ff"
+                             item="#c9c9c9ff"
+                             outline="#747474"
+                             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="#d1d1d1ff"
+                             inner_sel="#999999ff"
+                             item="#5a5a5aff"
+                             outline="#535353"
+                             shadedown="25"
+                             shadetop="0"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_text>
+        <wcol_toggle>
+          <ThemeWidgetColors inner="#d0d0d0ff"
+                             inner_sel="#64717dff"
+                             item="#191919ff"
+                             outline="#708faa"
+                             shadedown="0"
+                             shadetop="10"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_toggle>
+        <wcol_tool>
+          <ThemeWidgetColors inner="#c4c4c4ff"
+                             inner_sel="#646464ff"
+                             item="#191919ff"
+                             outline="#708faa"
+                             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>
+        <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="#b4b4b4">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeUserPreferences>
+    </user_preferences>
+    <bone_color_sets>
+      <ThemeBoneColorSet active="#f70a0a"
+                         show_colored_constraints="FALSE"
+                         normal="#9a0000"
+                         select="#bd1111">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#fa9900"
+                         show_colored_constraints="FALSE"
+                         normal="#f74018"
+                         select="#f66913">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#83ef1d"
+                         show_colored_constraints="FALSE"
+                         normal="#1e9109"
+                         select="#59b70b">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#5ec1ef"
+                         show_colored_constraints="FALSE"
+                         normal="#0a3694"
+                         select="#3667df">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#f05d91"
+                         show_colored_constraints="FALSE"
+                         normal="#a9294e"
+                         select="#c1416a">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#8764d5"
+                         show_colored_constraints="FALSE"
+                         normal="#430c78"
+                         select="#543aa3">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#6fb6ab"
+                         show_colored_constraints="FALSE"
+                         normal="#24785a"
+                         select="#3c9579">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#9bc2cd"
+                         show_colored_constraints="FALSE"
+                         normal="#4b707c"
+                         select="#6a8691">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#f3ff00"
+                         show_colored_constraints="FALSE"
+                         normal="#f4c90c"
+                         select="#eec236">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#ffffff"
+                         show_colored_constraints="FALSE"
+                         normal="#1e2024"
+                         select="#484c56">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#d330d6"
+                         show_colored_constraints="FALSE"
+                         normal="#6f2f6a"
+                         select="#9845be">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#bbef5b"
+                         show_colored_constraints="FALSE"
+                         normal="#6c8e22"
+                         select="#7fb022">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#dedede"
+                         show_colored_constraints="FALSE"
+                         normal="#8d8d8d"
+                         select="#b0b0b0">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#bd6a11"
+                         show_colored_constraints="FALSE"
+                         normal="#834326"
+                         select="#8b5811">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#34622b"
+                         show_colored_constraints="FALSE"
+                         normal="#08310e"
+                         select="#1c430b">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+    </bone_color_sets>
+  </Theme>
+</bpy>
diff --git a/release/scripts/addons_contrib/presets/interface_theme/default.xml b/release/scripts/addons_contrib/presets/interface_theme/default.xml
new file mode 100644
index 0000000..6adb8df
--- /dev/null
+++ b/release/scripts/addons_contrib/presets/interface_theme/default.xml
@@ -0,0 +1,828 @@
+<bpy>
+  <Theme>
+    <view_3d>
+      <ThemeView3D object_active="#ffaa40"
+                   editmesh_active="#ffffff80"
+                   act_spline="#db2512"
+                   handle_align="#803060"
+                   handle_sel_align="#f090a0"
+                   handle_auto="#909000"
+                   handle_sel_auto="#f0ff40"
+                   bone_pose="#50c8ff"
+                   bone_solid="#c8c8c8"
+                   bundle_solid="#c8c8c8"
+                   camera="#000000"
+                   camera_path="#000000"
+                   frame_current="#60c040"
+                   edge_crease="#cc0099"
+                   extra_edge_len="#200000"
+                   edge_seam="#db2512"
+                   edge_select="#ffa000"
+                   edge_sharp="#00ffff"
+                   edge_facesel="#4b4b4b"
+                   empty="#000000"
+                   face="#00000012"
+                   extra_face_angle="#000080"
+                   extra_face_area="#002000"
+                   face_dot="#ff8500"
+                   facedot_size="4"
+                   normal="#22dddd"
+                   face_select="#ff85003c"
+                   handle_free="#000000"
+                   handle_sel_free="#000000"
+                   grid="#404040"
+                   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="#f15800"
+                   outline_width="1"
+                   panel="#a5a5a57f"
+                   speaker="#000000"
+                   transform="#ffffff"
+                   handle_vect="#409030"
+                   handle_sel_vect="#40c030"
+                   vertex="#000000"
+                   vertex_normal="#2361dd"
+                   vertex_select="#ff8500"
+                   vertex_size="3"
+                   wire="#000000">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#393939">
+          </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">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#393939">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeClipEditor>
+    </clip_editor>
+    <console>
+      <ThemeConsole cursor="#dc6060"
+                    line_error="#dc6060"
+                    line_info="#00aa00"
+                    line_input="#ffffff"
+                    line_output="#6080ff">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#000000">
+          </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="#5e5e5e"
+                      long_key="#0c0a0a"
+                      long_key_selected="#ff8c00"
+                      value_sliders="#000000"
+                      view_sliders="#969696">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#6b6b6b">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#666666"
+                                 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="#ff8c19"
+                        tiles="#919191">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#fafafa"
+                             text_hi="#0f0f0f"
+                             title="#000000"
+                             back="#4c4c4c">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#666666"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </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="#994030"
+                        handle_sel_auto_clamped="#f0af90"
+                        channel_group="#4f6549"
+                        channels_region="#707070"
+                        frame_current="#60c040"
+                        dopesheet_channel="#52606e"
+                        dopesheet_subchannel="#7c8996"
+                        handle_free="#000000"
+                        handle_sel_free="#000000"
+                        grid="#5e5e5e"
+                        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">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#6b6b6b">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#666666"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </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="#727272ff"
+                        preview_stitch_active="#00000000"
+                        preview_stitch_edge="#ff00ff33"
+                        preview_stitch_face="#7f7f0033"
+                        preview_stitch_stitchable="#00ff00ff"
+                        preview_stitch_unstitchable="#ff0000ff"
+                        preview_stitch_vert="#0000ff33"
+                        vertex="#000000"
+                        vertex_select="#ff8500"
+                        vertex_size="3">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#353535">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeImageEditor>
+    </image_editor>
+    <info>
+      <ThemeInfo>
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#727272">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeInfo>
+    </info>
+    <logic_editor>
+      <ThemeLogicEditor panel="#a5a5a5">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#646464">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeLogicEditor>
+    </logic_editor>
+    <nla_editor>
+      <ThemeNLAEditor bars="#707070"
+                      bars_selected="#60c040"
+                      frame_current="#60c040"
+                      grid="#5e5e5e"
+                      strips="#0c0a0a"
+                      strips_selected="#ff8c00"
+                      view_sliders="#969696">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#6b6b6b">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#666666"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeNLAEditor>
+    </nla_editor>
+    <node_editor>
+      <ThemeNodeEditor converter_node="#686a75"
+                       group_node="#69756e"
+                       in_out_node="#646464"
+                       node_backdrop="#9b9b9ba0"
+                       noodle_curving="5"
+                       operator_node="#6c696f"
+                       selected_text="#7f7070"
+                       wire_select="#ffffff"
+                       wire="#000000">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             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="#a5a5a5"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeNodeEditor>
+    </node_editor>
+    <outliner>
+      <ThemeOutliner match="#337f33"
+                     selected_highlight="#82878c">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#727272">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeOutliner>
+    </outliner>
+    <properties>
+      <ThemeProperties panel="#828282">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#727272">
+          </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"
+                           plugin_strip="#7e7e50"
+                           preview_back="#000000"
+                           scene_strip="#4e983e"
+                           transition_strip="#a25f6f"
+                           window_sliders="#a0a0a0">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#747474">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeSequenceEditor>
+    </sequence_editor>
+    <text_editor>
+      <ThemeTextEditor cursor="#ff0000"
+                       syntax_special="#5f5f00"
+                       line_numbers_background="#404040"
+                       selected_text="#c67777"
+                       syntax_builtin="#800050"
+                       syntax_comment="#006432"
+                       syntax_numbers="#0000c8"
+                       syntax_string="#640000">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#999999">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTextEditor>
+    </text_editor>
+    <timeline>
+      <ThemeTimeline frame_current="#60c040"
+                     grid="#5b5b5b">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#727272">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTimeline>
+    </timeline>
+    <user_interface>
+      <ThemeUserInterface icon_alpha="1"
+                          icon_file="">
+        <wcol_box>
+          <ThemeWidgetColors inner="#808080ff"
+                             inner_sel="#646464ff"
+                             item="#191919ff"
+                             outline="#191919"
+                             shadedown="0"
+                             shadetop="0"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_box>
+        <wcol_list_item>
+          <ThemeWidgetColors inner="#00000000"
+                             inner_sel="#5680c2ff"
+                             item="#000000ff"
+                             outline="#000000"
+                             shadedown="0"
+                             shadetop="0"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_list_item>
+        <wcol_menu_back>
+          <ThemeWidgetColors inner="#191919e6"
+                             inner_sel="#2d2d2de6"
+                             item="#646464ff"
+                             outline="#000000"
+                             shadedown="-20"
+                             shadetop="25"
+                             show_shaded="FALSE"
+                             text="#a0a0a0"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_menu_back>
+        <wcol_menu_item>
+          <ThemeWidgetColors inner="#00000000"
+                             inner_sel="#5680c2ff"
+                             item="#ffffffff"
+                             outline="#000000"
+                             shadedown="0"
+                             shadetop="38"
+                             show_shaded="TRUE"
+                             text="#ffffff"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_menu_item>
+        <wcol_menu>
+          <ThemeWidgetColors inner="#464646ff"
+                             inner_sel="#464646ff"
+                             item="#ffffffff"
+                             outline="#000000"
+                             shadedown="-15"
+                             shadetop="15"
+                             show_shaded="TRUE"
+                             text="#ffffff"
+                             text_sel="#cccccc">
+          </ThemeWidgetColors>
+        </wcol_menu>
+        <wcol_num>
+          <ThemeWidgetColors inner="#b4b4b4ff"
+                             inner_sel="#999999ff"
+                             item="#5a5a5aff"
+                             outline="#191919"
+                             shadedown="0"
+                             shadetop="-20"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_num>
+        <wcol_option>
+          <ThemeWidgetColors inner="#464646ff"
+                             inner_sel="#464646ff"
+                             item="#ffffffff"
+                             outline="#000000"
+                             shadedown="-15"
+                             shadetop="15"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             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="#5680c2ff"
+                             item="#ffffffff"
+                             outline="#000000"
+                             shadedown="-20"
+                             shadetop="25"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_pulldown>
+        <wcol_radio>
+          <ThemeWidgetColors inner="#464646ff"
+                             inner_sel="#5680c2ff"
+                             item="#ffffffff"
+                             outline="#000000"
+                             shadedown="-15"
+                             shadetop="15"
+                             show_shaded="TRUE"
+                             text="#ffffff"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_radio>
+        <wcol_regular>
+          <ThemeWidgetColors inner="#999999ff"
+                             inner_sel="#646464ff"
+                             item="#191919ff"
+                             outline="#191919"
+                             shadedown="0"
+                             shadetop="0"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_regular>
+        <wcol_scroll>
+          <ThemeWidgetColors inner="#505050b4"
+                             inner_sel="#646464b4"
+                             item="#808080ff"
+                             outline="#323232"
+                             shadedown="-5"
+                             shadetop="5"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_scroll>
+        <wcol_numslider>
+          <ThemeWidgetColors inner="#b4b4b4ff"
+                             inner_sel="#999999ff"
+                             item="#808080ff"
+                             outline="#191919"
+                             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="#999999ff"
+                             inner_sel="#999999ff"
+                             item="#5a5a5aff"
+                             outline="#191919"
+                             shadedown="25"
+                             shadetop="0"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_text>
+        <wcol_toggle>
+          <ThemeWidgetColors inner="#999999ff"
+                             inner_sel="#646464ff"
+                             item="#191919ff"
+                             outline="#191919"
+                             shadedown="0"
+                             shadetop="0"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_toggle>
+        <wcol_tool>
+          <ThemeWidgetColors inner="#999999ff"
+                             inner_sel="#646464ff"
+                             item="#191919ff"
+                             outline="#191919"
+                             shadedown="-15"
+                             shadetop="15"
+                             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>
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#727272">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeUserPreferences>
+    </user_preferences>
+    <bone_color_sets>
+      <ThemeBoneColorSet active="#f70a0a"
+                         show_colored_constraints="FALSE"
+                         normal="#9a0000"
+                         select="#bd1111">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#fa9900"
+                         show_colored_constraints="FALSE"
+                         normal="#f74018"
+                         select="#f66913">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#83ef1d"
+                         show_colored_constraints="FALSE"
+                         normal="#1e9109"
+                         select="#59b70b">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#5ec1ef"
+                         show_colored_constraints="FALSE"
+                         normal="#0a3694"
+                         select="#3667df">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#f05d91"
+                         show_colored_constraints="FALSE"
+                         normal="#a9294e"
+                         select="#c1416a">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#8764d5"
+                         show_colored_constraints="FALSE"
+                         normal="#430c78"
+                         select="#543aa3">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#6fb6ab"
+                         show_colored_constraints="FALSE"
+                         normal="#24785a"
+                         select="#3c9579">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#9bc2cd"
+                         show_colored_constraints="FALSE"
+                         normal="#4b707c"
+                         select="#6a8691">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#f3ff00"
+                         show_colored_constraints="FALSE"
+                         normal="#f4c90c"
+                         select="#eec236">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#ffffff"
+                         show_colored_constraints="FALSE"
+                         normal="#1e2024"
+                         select="#484c56">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#d330d6"
+                         show_colored_constraints="FALSE"
+                         normal="#6f2f6a"
+                         select="#9845be">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#bbef5b"
+                         show_colored_constraints="FALSE"
+                         normal="#6c8e22"
+                         select="#7fb022">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#dedede"
+                         show_colored_constraints="FALSE"
+                         normal="#8d8d8d"
+                         select="#b0b0b0">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#bd6a11"
+                         show_colored_constraints="FALSE"
+                         normal="#834326"
+                         select="#8b5811">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#34622b"
+                         show_colored_constraints="FALSE"
+                         normal="#08310e"
+                         select="#1c430b">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+    </bone_color_sets>
+  </Theme>
+</bpy>
diff --git a/release/scripts/addons_contrib/presets/interface_theme/default_theme.xml b/release/scripts/addons_contrib/presets/interface_theme/default_theme.xml
deleted file mode 100644
index e782455..0000000
--- a/release/scripts/addons_contrib/presets/interface_theme/default_theme.xml
+++ /dev/null
@@ -1,813 +0,0 @@
-<bpy>
-  <Theme>
-    <view_3d>
-      <ThemeView3D object_active="#ffaa40"
-                   editmesh_active="#ffffff80"
-                   act_spline="#db2512"
-                   handle_align="#803060"
-                   handle_sel_align="#f090a0"
-                   handle_auto="#909000"
-                   handle_sel_auto="#f0ff40"
-                   bone_pose="#50c8ff"
-                   bone_solid="#c8c8c8"
-                   bundle_solid="#c8c8c8"
-                   camera_path="#000000"
-                   frame_current="#60c040"
-                   edge_crease="#cc0099"
-                   extra_edge_len="#200000"
-                   edge_seam="#db2512"
-                   edge_select="#ffa000"
-                   edge_sharp="#00ffff"
-                   edge_facesel="#4b4b4b"
-                   face="#00000012"
-                   extra_face_angle="#000080"
-                   extra_face_area="#002000"
-                   face_dot="#ff8500"
-                   facedot_size="4"
-                   normal="#22dddd"
-                   face_select="#ff85003c"
-                   handle_free="#000000"
-                   handle_sel_free="#000000"
-                   grid="#404040"
-                   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="#f15800"
-                   outline_width="1"
-                   panel="#a5a5a57f"
-                   speaker="#000000"
-                   transform="#ffffff"
-                   handle_vect="#409030"
-                   handle_sel_vect="#40c030"
-                   vertex="#000000"
-                   vertex_normal="#2361dd"
-                   vertex_select="#ff8500"
-                   vertex_size="3"
-                   wire="#000000">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#393939">
-          </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">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#393939">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeClipEditor>
-    </clip_editor>
-    <console>
-      <ThemeConsole cursor="#dc6060"
-                    line_error="#dc6060"
-                    line_info="#00aa00"
-                    line_input="#ffffff"
-                    line_output="#6080ff">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#000000">
-          </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="#5e5e5e"
-                      long_key="#0c0a0a"
-                      long_key_selected="#ff8c00"
-                      value_sliders="#000000"
-                      view_sliders="#969696">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#6b6b6b">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#666666"
-                                 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="#ff8c19"
-                        tiles="#919191">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#fafafa"
-                             text_hi="#0f0f0f"
-                             title="#000000"
-                             back="#4c4c4c">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#666666"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </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="#994030"
-                        handle_sel_auto_clamped="#f0af90"
-                        channel_group="#4f6549"
-                        channels_region="#707070"
-                        frame_current="#60c040"
-                        dopesheet_channel="#52606e"
-                        dopesheet_subchannel="#7c8996"
-                        handle_free="#000000"
-                        handle_sel_free="#000000"
-                        grid="#5e5e5e"
-                        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">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#6b6b6b">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#666666"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </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="#727272ff"
-                        preview_stitch_active="#00000000"
-                        preview_stitch_edge="#ff00ff33"
-                        preview_stitch_face="#7f7f0033"
-                        preview_stitch_stitchable="#00ff00ff"
-                        preview_stitch_unstitchable="#ff0000ff"
-                        preview_stitch_vert="#0000ff33"
-                        vertex="#000000"
-                        vertex_select="#ff8500"
-                        vertex_size="3">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#353535">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeImageEditor>
-    </image_editor>
-    <info>
-      <ThemeInfo >
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#727272">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeInfo>
-    </info>
-    <logic_editor>
-      <ThemeLogicEditor panel="#a5a5a5">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#646464">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeLogicEditor>
-    </logic_editor>
-    <nla_editor>
-      <ThemeNLAEditor bars="#707070"
-                      bars_selected="#60c040"
-                      frame_current="#60c040"
-                      grid="#5e5e5e"
-                      strips="#0c0a0a"
-                      strips_selected="#ff8c00"
-                      view_sliders="#969696">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#6b6b6b">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#666666"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeNLAEditor>
-    </nla_editor>
-    <node_editor>
-      <ThemeNodeEditor converter_node="#686a75"
-                       group_node="#69756e"
-                       in_out_node="#646464"
-                       node_backdrop="#9b9b9ba0"
-                       noodle_curving="5"
-                       operator_node="#6c696f"
-                       selected_text="#7f7070"
-                       wire_select="#ffffff"
-                       wire="#000000">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             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="#a5a5a5"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeNodeEditor>
-    </node_editor>
-    <outliner>
-      <ThemeOutliner match="#337f33"
-                     selected_highlight="#82878c">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#727272">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeOutliner>
-    </outliner>
-    <properties>
-      <ThemeProperties panel="#828282">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#727272">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeProperties>
-    </properties>
-    <sequence_editor>
-      <ThemeSequenceEditor audio_strip="#2e8f8f"
-                           frame_current="#60c040"
-                           draw_action="#50c8ff"
-                           effect_strip="#a9547c"
-                           grid="#404040"
-                           image_strip="#6d5881"
-                           keyframe="#ff8500"
-                           meta_strip="#6d9183"
-                           movie_strip="#516987"
-                           plugin_strip="#7e7e50"
-                           scene_strip="#4e983e"
-                           transition_strip="#a25f6f"
-                           window_sliders="#a0a0a0">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#747474">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeSequenceEditor>
-    </sequence_editor>
-    <text_editor>
-      <ThemeTextEditor cursor="#ff0000"
-                       line_numbers_background="#404040"
-                       scroll_bar="#8f8f8f"
-                       selected_text="#c67777"
-                       syntax_builtin="#800050"
-                       syntax_comment="#006432"
-                       syntax_numbers="#0000c8"
-                       syntax_special="#5f5f00"
-                       syntax_string="#640000">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#999999">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeTextEditor>
-    </text_editor>
-    <timeline>
-      <ThemeTimeline frame_current="#60c040"
-                     grid="#5b5b5b">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#727272">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeTimeline>
-    </timeline>
-    <user_interface>
-      <ThemeUserInterface icon_alpha="1"
-                          icon_file="">
-        <wcol_box>
-          <ThemeWidgetColors inner="#808080ff"
-                             inner_sel="#646464ff"
-                             item="#191919ff"
-                             outline="#191919"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_box>
-        <wcol_list_item>
-          <ThemeWidgetColors inner="#00000000"
-                             inner_sel="#5680c2ff"
-                             item="#000000ff"
-                             outline="#000000"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_list_item>
-        <wcol_menu_back>
-          <ThemeWidgetColors inner="#191919e6"
-                             inner_sel="#2d2d2de6"
-                             item="#646464ff"
-                             outline="#000000"
-                             shadedown="-20"
-                             shadetop="25"
-                             show_shaded="FALSE"
-                             text="#a0a0a0"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_menu_back>
-        <wcol_menu_item>
-          <ThemeWidgetColors inner="#00000000"
-                             inner_sel="#5680c2ff"
-                             item="#ffffffff"
-                             outline="#000000"
-                             shadedown="0"
-                             shadetop="38"
-                             show_shaded="TRUE"
-                             text="#ffffff"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_menu_item>
-        <wcol_menu>
-          <ThemeWidgetColors inner="#464646ff"
-                             inner_sel="#464646ff"
-                             item="#ffffffff"
-                             outline="#000000"
-                             shadedown="-15"
-                             shadetop="15"
-                             show_shaded="TRUE"
-                             text="#ffffff"
-                             text_sel="#cccccc">
-          </ThemeWidgetColors>
-        </wcol_menu>
-        <wcol_num>
-          <ThemeWidgetColors inner="#b4b4b4ff"
-                             inner_sel="#999999ff"
-                             item="#5a5a5aff"
-                             outline="#191919"
-                             shadedown="0"
-                             shadetop="-20"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_num>
-        <wcol_option>
-          <ThemeWidgetColors inner="#464646ff"
-                             inner_sel="#464646ff"
-                             item="#ffffffff"
-                             outline="#000000"
-                             shadedown="-15"
-                             shadetop="15"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             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="#5680c2ff"
-                             item="#ffffffff"
-                             outline="#000000"
-                             shadedown="-20"
-                             shadetop="25"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_pulldown>
-        <wcol_radio>
-          <ThemeWidgetColors inner="#464646ff"
-                             inner_sel="#5680c2ff"
-                             item="#ffffffff"
-                             outline="#000000"
-                             shadedown="-15"
-                             shadetop="15"
-                             show_shaded="TRUE"
-                             text="#ffffff"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_radio>
-        <wcol_regular>
-          <ThemeWidgetColors inner="#999999ff"
-                             inner_sel="#646464ff"
-                             item="#191919ff"
-                             outline="#191919"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_regular>
-        <wcol_scroll>
-          <ThemeWidgetColors inner="#505050b4"
-                             inner_sel="#646464b4"
-                             item="#808080ff"
-                             outline="#323232"
-                             shadedown="-5"
-                             shadetop="5"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_scroll>
-        <wcol_numslider>
-          <ThemeWidgetColors inner="#b4b4b4ff"
-                             inner_sel="#999999ff"
-                             item="#808080ff"
-                             outline="#191919"
-                             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="#999999ff"
-                             inner_sel="#999999ff"
-                             item="#5a5a5aff"
-                             outline="#191919"
-                             shadedown="25"
-                             shadetop="0"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_text>
-        <wcol_toggle>
-          <ThemeWidgetColors inner="#999999ff"
-                             inner_sel="#646464ff"
-                             item="#191919ff"
-                             outline="#191919"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_toggle>
-        <wcol_tool>
-          <ThemeWidgetColors inner="#999999ff"
-                             inner_sel="#646464ff"
-                             item="#191919ff"
-                             outline="#191919"
-                             shadedown="-15"
-                             shadetop="15"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_tool>
-      </ThemeUserInterface>
-    </user_interface>
-    <user_preferences>
-      <ThemeUserPreferences >
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#727272">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeUserPreferences>
-    </user_preferences>
-    <bone_color_sets>
-      <ThemeBoneColorSet active="#f70a0a"
-                         show_colored_constraints="FALSE"
-                         normal="#9a0000"
-                         select="#bd1111">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#fa9900"
-                         show_colored_constraints="FALSE"
-                         normal="#f74018"
-                         select="#f66913">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#83ef1d"
-                         show_colored_constraints="FALSE"
-                         normal="#1e9109"
-                         select="#59b70b">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#5ec1ef"
-                         show_colored_constraints="FALSE"
-                         normal="#0a3694"
-                         select="#3667df">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f05d91"
-                         show_colored_constraints="FALSE"
-                         normal="#a9294e"
-                         select="#c1416a">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#8764d5"
-                         show_colored_constraints="FALSE"
-                         normal="#430c78"
-                         select="#543aa3">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#6fb6ab"
-                         show_colored_constraints="FALSE"
-                         normal="#24785a"
-                         select="#3c9579">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#9bc2cd"
-                         show_colored_constraints="FALSE"
-                         normal="#4b707c"
-                         select="#6a8691">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f3ff00"
-                         show_colored_constraints="FALSE"
-                         normal="#f4c90c"
-                         select="#eec236">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#ffffff"
-                         show_colored_constraints="FALSE"
-                         normal="#1e2024"
-                         select="#484c56">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#d330d6"
-                         show_colored_constraints="FALSE"
-                         normal="#6f2f6a"
-                         select="#9845be">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bbef5b"
-                         show_colored_constraints="FALSE"
-                         normal="#6c8e22"
-                         select="#7fb022">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#dedede"
-                         show_colored_constraints="FALSE"
-                         normal="#8d8d8d"
-                         select="#b0b0b0">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bd6a11"
-                         show_colored_constraints="FALSE"
-                         normal="#834326"
-                         select="#8b5811">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#34622b"
-                         show_colored_constraints="FALSE"
-                         normal="#08310e"
-                         select="#1c430b">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-    </bone_color_sets>
-  </Theme>
-</bpy>
diff --git a/release/scripts/addons_contrib/presets/interface_theme/maya.xml b/release/scripts/addons_contrib/presets/interface_theme/maya.xml
new file mode 100644
index 0000000..65d6245
--- /dev/null
+++ b/release/scripts/addons_contrib/presets/interface_theme/maya.xml
@@ -0,0 +1,828 @@
+<bpy>
+  <Theme>
+    <view_3d>
+      <ThemeView3D object_active="#43ffa3"
+                   editmesh_active="#ffffff80"
+                   act_spline="#db2512"
+                   handle_align="#803060"
+                   handle_sel_align="#f090a0"
+                   handle_auto="#909000"
+                   handle_sel_auto="#f0ff40"
+                   bone_pose="#50c8ff"
+                   bone_solid="#c8c8c8"
+                   bundle_solid="#c8c8c8"
+                   camera="#000000"
+                   camera_path="#000000"
+                   frame_current="#60c040"
+                   edge_crease="#cc0099"
+                   extra_edge_len="#200000"
+                   edge_seam="#db2512"
+                   edge_select="#ffa000"
+                   edge_sharp="#ff2020"
+                   edge_facesel="#4b4b4b"
+                   empty="#000000"
+                   face="#00000012"
+                   extra_face_angle="#000080"
+                   extra_face_area="#002000"
+                   face_dot="#ff8500"
+                   facedot_size="4"
+                   normal="#22dddd"
+                   face_select="#ff85003c"
+                   handle_free="#000000"
+                   handle_sel_free="#000000"
+                   grid="#7f7f7f"
+                   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="#f15800"
+                   outline_width="1"
+                   panel="#a5a5a57f"
+                   speaker="#000000"
+                   transform="#ffffff"
+                   handle_vect="#409030"
+                   handle_sel_vect="#40c030"
+                   vertex="#cc1b23"
+                   vertex_normal="#2361dd"
+                   vertex_select="#ff8500"
+                   vertex_size="3"
+                   wire="#64dcff">
+        <space>
+          <ThemeSpaceGeneric header="#444444"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#444444"
+                             button_text="#ffffff"
+                             button_text_hi="#ffffff"
+                             button_title="#ffffff"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#576471">
+          </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">
+        <space>
+          <ThemeSpaceGeneric header="#3a3a3a"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#444444"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#576471">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeClipEditor>
+    </clip_editor>
+    <console>
+      <ThemeConsole cursor="#dc6060"
+                    line_error="#dc6060"
+                    line_info="#00aa00"
+                    line_input="#ffffff"
+                    line_output="#6080ff">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#000000">
+          </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="#5e5e5e"
+                      long_key="#0c0a0a"
+                      long_key_selected="#ff8c00"
+                      value_sliders="#000000"
+                      view_sliders="#969696">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#6b6b6b">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#666666"
+                                 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="#ff8c19"
+                        tiles="#919191">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#fafafa"
+                             text_hi="#0f0f0f"
+                             title="#000000"
+                             back="#4c4c4c">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#666666"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </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="#994030"
+                        handle_sel_auto_clamped="#f0af90"
+                        channel_group="#4f6549"
+                        channels_region="#707070"
+                        frame_current="#60c040"
+                        dopesheet_channel="#52606e"
+                        dopesheet_subchannel="#7c8996"
+                        handle_free="#000000"
+                        handle_sel_free="#000000"
+                        grid="#5e5e5e"
+                        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">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#6b6b6b">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#666666"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </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="#727272ff"
+                        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="#000000"
+                        vertex_select="#ff8500"
+                        vertex_size="3">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#353535">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeImageEditor>
+    </image_editor>
+    <info>
+      <ThemeInfo>
+        <space>
+          <ThemeSpaceGeneric header="#444444"
+                             header_text="#dddddd"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#727272">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeInfo>
+    </info>
+    <logic_editor>
+      <ThemeLogicEditor panel="#a5a5a5">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#646464">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeLogicEditor>
+    </logic_editor>
+    <nla_editor>
+      <ThemeNLAEditor bars="#707070"
+                      bars_selected="#60c040"
+                      frame_current="#60c040"
+                      grid="#5e5e5e"
+                      strips="#0c0a0a"
+                      strips_selected="#ff8c00"
+                      view_sliders="#969696">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#6b6b6b">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#666666"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeNLAEditor>
+    </nla_editor>
+    <node_editor>
+      <ThemeNodeEditor converter_node="#686a75"
+                       group_node="#69756e"
+                       in_out_node="#646464"
+                       node_backdrop="#9b9b9ba0"
+                       noodle_curving="5"
+                       operator_node="#6c696f"
+                       selected_text="#7f7070"
+                       wire_select="#ffffff"
+                       wire="#000000">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             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="#a5a5a5"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeNodeEditor>
+    </node_editor>
+    <outliner>
+      <ThemeOutliner match="#356c1a"
+                     selected_highlight="#446e1c">
+        <space>
+          <ThemeSpaceGeneric header="#444444"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#dddddd"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#444444">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeOutliner>
+    </outliner>
+    <properties>
+      <ThemeProperties panel="#828282">
+        <space>
+          <ThemeSpaceGeneric header="#444444"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#dddddd"
+                             text_hi="#ffffff"
+                             title="#dddddd"
+                             back="#444444">
+          </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"
+                           plugin_strip="#7e7e50"
+                           preview_back="#000000"
+                           scene_strip="#4e983e"
+                           transition_strip="#a25f6f"
+                           window_sliders="#a0a0a0">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#747474">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeSequenceEditor>
+    </sequence_editor>
+    <text_editor>
+      <ThemeTextEditor cursor="#ff0000"
+                       syntax_special="#5f5f00"
+                       line_numbers_background="#404040"
+                       selected_text="#c67777"
+                       syntax_builtin="#800050"
+                       syntax_comment="#006432"
+                       syntax_numbers="#0000c8"
+                       syntax_string="#640000">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#999999">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTextEditor>
+    </text_editor>
+    <timeline>
+      <ThemeTimeline frame_current="#60c040"
+                     grid="#000000">
+        <space>
+          <ThemeSpaceGeneric header="#444444"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#737373">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTimeline>
+    </timeline>
+    <user_interface>
+      <ThemeUserInterface icon_alpha="1"
+                          icon_file="">
+        <wcol_box>
+          <ThemeWidgetColors inner="#696969ff"
+                             inner_sel="#646464ff"
+                             item="#191919ff"
+                             outline="#191919"
+                             shadedown="0"
+                             shadetop="0"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_box>
+        <wcol_list_item>
+          <ThemeWidgetColors inner="#00000000"
+                             inner_sel="#5680c2ff"
+                             item="#000000ff"
+                             outline="#000000"
+                             shadedown="0"
+                             shadetop="0"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_list_item>
+        <wcol_menu_back>
+          <ThemeWidgetColors inner="#444444ff"
+                             inner_sel="#2d2d2de6"
+                             item="#646464ff"
+                             outline="#000000"
+                             shadedown="-20"
+                             shadetop="25"
+                             show_shaded="FALSE"
+                             text="#a0a0a0"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_menu_back>
+        <wcol_menu_item>
+          <ThemeWidgetColors inner="#00000000"
+                             inner_sel="#658aaeff"
+                             item="#ffffffff"
+                             outline="#000000"
+                             shadedown="0"
+                             shadetop="38"
+                             show_shaded="FALSE"
+                             text="#ffffff"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_menu_item>
+        <wcol_menu>
+          <ThemeWidgetColors inner="#777777ff"
+                             inner_sel="#464646ff"
+                             item="#ffffffff"
+                             outline="#000000"
+                             shadedown="-15"
+                             shadetop="15"
+                             show_shaded="FALSE"
+                             text="#ffffff"
+                             text_sel="#cccccc">
+          </ThemeWidgetColors>
+        </wcol_menu>
+        <wcol_num>
+          <ThemeWidgetColors inner="#222222ff"
+                             inner_sel="#999999ff"
+                             item="#5a5a5aff"
+                             outline="#525252"
+                             shadedown="0"
+                             shadetop="-20"
+                             show_shaded="FALSE"
+                             text="#ffffff"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_num>
+        <wcol_option>
+          <ThemeWidgetColors inner="#2b2b2bff"
+                             inner_sel="#464646ff"
+                             item="#ffffffff"
+                             outline="#000000"
+                             shadedown="-15"
+                             shadetop="15"
+                             show_shaded="FALSE"
+                             text="#888284"
+                             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="#656969ff"
+                             item="#ffffffff"
+                             outline="#000000"
+                             shadedown="-20"
+                             shadetop="25"
+                             show_shaded="FALSE"
+                             text="#dddddd"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_pulldown>
+        <wcol_radio>
+          <ThemeWidgetColors inner="#292929ff"
+                             inner_sel="#678db2ff"
+                             item="#ffffffff"
+                             outline="#000000"
+                             shadedown="-15"
+                             shadetop="15"
+                             show_shaded="FALSE"
+                             text="#ffffff"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_radio>
+        <wcol_regular>
+          <ThemeWidgetColors inner="#999999ff"
+                             inner_sel="#646464ff"
+                             item="#191919ff"
+                             outline="#191919"
+                             shadedown="0"
+                             shadetop="0"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_regular>
+        <wcol_scroll>
+          <ThemeWidgetColors inner="#505050b4"
+                             inner_sel="#646464b4"
+                             item="#808080ff"
+                             outline="#323232"
+                             shadedown="-5"
+                             shadetop="5"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_scroll>
+        <wcol_numslider>
+          <ThemeWidgetColors inner="#535353ff"
+                             inner_sel="#999999ff"
+                             item="#808080ff"
+                             outline="#191919"
+                             shadedown="0"
+                             shadetop="-20"
+                             show_shaded="FALSE"
+                             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="#131313ff"
+                             inner_sel="#333230ff"
+                             item="#678db2ff"
+                             outline="#191919"
+                             shadedown="25"
+                             shadetop="0"
+                             show_shaded="TRUE"
+                             text="#dddddd"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_text>
+        <wcol_toggle>
+          <ThemeWidgetColors inner="#999999ff"
+                             inner_sel="#646464ff"
+                             item="#191919ff"
+                             outline="#191919"
+                             shadedown="0"
+                             shadetop="0"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_toggle>
+        <wcol_tool>
+          <ThemeWidgetColors inner="#2c2c2cff"
+                             inner_sel="#646464ff"
+                             item="#191919ff"
+                             outline="#191919"
+                             shadedown="-15"
+                             shadetop="15"
+                             show_shaded="FALSE"
+                             text="#8f8f8f"
+                             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>
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#444444">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeUserPreferences>
+    </user_preferences>
+    <bone_color_sets>
+      <ThemeBoneColorSet active="#f70a0a"
+                         show_colored_constraints="FALSE"
+                         normal="#9a0000"
+                         select="#bd1111">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#fa9900"
+                         show_colored_constraints="FALSE"
+                         normal="#f74018"
+                         select="#f66913">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#83ef1d"
+                         show_colored_constraints="FALSE"
+                         normal="#1e9109"
+                         select="#59b70b">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#5ec1ef"
+                         show_colored_constraints="FALSE"
+                         normal="#0a3694"
+                         select="#3667df">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#f05d91"
+                         show_colored_constraints="FALSE"
+                         normal="#a9294e"
+                         select="#c1416a">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#8764d5"
+                         show_colored_constraints="FALSE"
+                         normal="#430c78"
+                         select="#543aa3">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#6fb6ab"
+                         show_colored_constraints="FALSE"
+                         normal="#24785a"
+                         select="#3c9579">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#9bc2cd"
+                         show_colored_constraints="FALSE"
+                         normal="#4b707c"
+                         select="#6a8691">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#f3ff00"
+                         show_colored_constraints="FALSE"
+                         normal="#f4c90c"
+                         select="#eec236">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#ffffff"
+                         show_colored_constraints="FALSE"
+                         normal="#1e2024"
+                         select="#484c56">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#d330d6"
+                         show_colored_constraints="FALSE"
+                         normal="#6f2f6a"
+                         select="#9845be">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#bbef5b"
+                         show_colored_constraints="FALSE"
+                         normal="#6c8e22"
+                         select="#7fb022">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#dedede"
+                         show_colored_constraints="FALSE"
+                         normal="#8d8d8d"
+                         select="#b0b0b0">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#bd6a11"
+                         show_colored_constraints="FALSE"
+                         normal="#834326"
+                         select="#8b5811">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#34622b"
+                         show_colored_constraints="FALSE"
+                         normal="#08310e"
+                         select="#1c430b">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+    </bone_color_sets>
+  </Theme>
+</bpy>
diff --git a/release/scripts/addons_contrib/presets/interface_theme/modo.xml b/release/scripts/addons_contrib/presets/interface_theme/modo.xml
new file mode 100644
index 0000000..94407f5
--- /dev/null
+++ b/release/scripts/addons_contrib/presets/interface_theme/modo.xml
@@ -0,0 +1,828 @@
+<bpy>
+  <Theme>
+    <view_3d>
+      <ThemeView3D object_active="#ff8c19"
+                   editmesh_active="#ffffff80"
+                   act_spline="#db2512"
+                   handle_align="#803060"
+                   handle_sel_align="#f090a0"
+                   handle_auto="#909000"
+                   handle_sel_auto="#f0ff40"
+                   bone_pose="#50c8ff"
+                   bone_solid="#c8c8c8"
+                   bundle_solid="#c8c8c8"
+                   camera="#000000"
+                   camera_path="#000000"
+                   frame_current="#60c040"
+                   edge_crease="#cc0099"
+                   extra_edge_len="#200000"
+                   edge_seam="#db2512"
+                   edge_select="#ffa000"
+                   edge_sharp="#ff2020"
+                   edge_facesel="#4b4b4b"
+                   empty="#000000"
+                   face="#00000012"
+                   extra_face_angle="#002000"
+                   extra_face_area="#000080"
+                   face_dot="#ff8500"
+                   facedot_size="4"
+                   normal="#22dddd"
+                   face_select="#ff85003c"
+                   handle_free="#000000"
+                   handle_sel_free="#000000"
+                   grid="#5b6672"
+                   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="#f15800"
+                   outline_width="1"
+                   panel="#a5a5a57f"
+                   speaker="#000000"
+                   transform="#ffffff"
+                   handle_vect="#409030"
+                   handle_sel_vect="#40c030"
+                   vertex="#000000"
+                   vertex_normal="#2361dd"
+                   vertex_select="#ff8500"
+                   vertex_size="3"
+                   wire="#000000">
+        <space>
+          <ThemeSpaceGeneric header="#202020"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#484848"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#40464e">
+          </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">
+        <space>
+          <ThemeSpaceGeneric header="#202020"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#484848"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#40464e">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeClipEditor>
+    </clip_editor>
+    <console>
+      <ThemeConsole cursor="#dc6060"
+                    line_error="#dc6060"
+                    line_info="#00aa00"
+                    line_input="#ffffff"
+                    line_output="#6080ff">
+        <space>
+          <ThemeSpaceGeneric header="#202020"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#000000">
+          </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="#5b6672"
+                      long_key="#0c0a0a"
+                      long_key_selected="#ff8c00"
+                      value_sliders="#000000"
+                      view_sliders="#969696">
+        <space>
+          <ThemeSpaceGeneric header="#202020"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#9098a0">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#484848"
+                                 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="#ff8c19"
+                        tiles="#484848">
+        <space>
+          <ThemeSpaceGeneric header="#202020"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#726f6d"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#fafafa"
+                             text_hi="#0f0f0f"
+                             title="#000000"
+                             back="#9098a0">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#484848"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </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="#994030"
+                        handle_sel_auto_clamped="#f0af90"
+                        channel_group="#4f6549"
+                        channels_region="#707070"
+                        frame_current="#60c040"
+                        dopesheet_channel="#52606e"
+                        dopesheet_subchannel="#7c8996"
+                        handle_free="#000000"
+                        handle_sel_free="#000000"
+                        grid="#5b6672"
+                        handle_vertex="#000000"
+                        handle_vertex_select="#ff8500"
+                        handle_vertex_size="3"
+                        lastsel_point="#000000"
+                        panel="#ffffff"
+                        handle_vect="#409030"
+                        handle_sel_vect="#40c030"
+                        vertex="#000000"
+                        vertex_select="#ff8500"
+                        vertex_size="3"
+                        window_sliders="#969696">
+        <space>
+          <ThemeSpaceGeneric header="#202020"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#9098a0">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#484848"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </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="#727272ff"
+                        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="#000000"
+                        vertex_select="#ff8500"
+                        vertex_size="3">
+        <space>
+          <ThemeSpaceGeneric header="#202020"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#484848"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#9098a0">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeImageEditor>
+    </image_editor>
+    <info>
+      <ThemeInfo>
+        <space>
+          <ThemeSpaceGeneric header="#202020"
+                             header_text="#888888"
+                             header_text_hi="#ffffff"
+                             button="#725864"
+                             button_text="#f0f0f0"
+                             button_text_hi="#ffffff"
+                             button_title="#f1c2d8"
+                             text="#888884"
+                             text_hi="#ffffff"
+                             title="#c8c6c9"
+                             back="#9098a0">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeInfo>
+    </info>
+    <logic_editor>
+      <ThemeLogicEditor panel="#a5a5a5">
+        <space>
+          <ThemeSpaceGeneric header="#202020"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#9098a0">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeLogicEditor>
+    </logic_editor>
+    <nla_editor>
+      <ThemeNLAEditor bars="#707070"
+                      bars_selected="#60c040"
+                      frame_current="#60c040"
+                      grid="#5b6672"
+                      strips="#0c0a0a"
+                      strips_selected="#ff8c00"
+                      view_sliders="#969696">
+        <space>
+          <ThemeSpaceGeneric header="#202020"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#9098a0">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#484848"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeNLAEditor>
+    </nla_editor>
+    <node_editor>
+      <ThemeNodeEditor converter_node="#686a75"
+                       group_node="#69756e"
+                       in_out_node="#646464"
+                       node_backdrop="#9b9b9ba0"
+                       noodle_curving="5"
+                       operator_node="#6c696f"
+                       selected_text="#7f7070"
+                       wire_select="#ffffff"
+                       wire="#000000">
+        <space>
+          <ThemeSpaceGeneric header="#202020"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#9098a0">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#484848"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeNodeEditor>
+    </node_editor>
+    <outliner>
+      <ThemeOutliner match="#337f33"
+                     selected_highlight="#82878c">
+        <space>
+          <ThemeSpaceGeneric header="#202020"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#fdfcff"
+                             button_title="#070707"
+                             text="#000000"
+                             text_hi="#f49c1c"
+                             title="#0e0e0e"
+                             back="#9098a0">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeOutliner>
+    </outliner>
+    <properties>
+      <ThemeProperties panel="#827d7d">
+        <space>
+          <ThemeSpaceGeneric header="#202020"
+                             header_text="#000000"
+                             header_text_hi="#dff5ff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#3f3a2f"
+                             text="#000000"
+                             text_hi="#000000"
+                             title="#000000"
+                             back="#484848">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeProperties>
+    </properties>
+    <sequence_editor>
+      <ThemeSequenceEditor audio_strip="#2e8f8f"
+                           movieclip_strip="#20208f"
+                           frame_current="#60c040"
+                           draw_action="#50c8ff"
+                           effect_strip="#a9547c"
+                           grid="#5b6672"
+                           image_strip="#6d5881"
+                           keyframe="#ff8500"
+                           meta_strip="#6d9183"
+                           movie_strip="#516987"
+                           plugin_strip="#7e7e50"
+                           preview_back="#000000"
+                           scene_strip="#4e983e"
+                           transition_strip="#a25f6f"
+                           window_sliders="#a0a0a0">
+        <space>
+          <ThemeSpaceGeneric header="#202020"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#9098a0">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeSequenceEditor>
+    </sequence_editor>
+    <text_editor>
+      <ThemeTextEditor cursor="#ff0000"
+                       syntax_special="#5f5f00"
+                       line_numbers_background="#404040"
+                       selected_text="#c67777"
+                       syntax_builtin="#800050"
+                       syntax_comment="#006432"
+                       syntax_numbers="#0000c8"
+                       syntax_string="#640000">
+        <space>
+          <ThemeSpaceGeneric header="#202020"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#9098a0">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTextEditor>
+    </text_editor>
+    <timeline>
+      <ThemeTimeline frame_current="#60c040"
+                     grid="#5b6672">
+        <space>
+          <ThemeSpaceGeneric header="#202020"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#9098a0">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTimeline>
+    </timeline>
+    <user_interface>
+      <ThemeUserInterface icon_alpha="1"
+                          icon_file="">
+        <wcol_box>
+          <ThemeWidgetColors inner="#464646ff"
+                             inner_sel="#646464ff"
+                             item="#000000ff"
+                             outline="#191919"
+                             shadedown="0"
+                             shadetop="0"
+                             show_shaded="FALSE"
+                             text="#ffffff"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_box>
+        <wcol_list_item>
+          <ThemeWidgetColors inner="#00000000"
+                             inner_sel="#f49c1cff"
+                             item="#ffffffff"
+                             outline="#000000"
+                             shadedown="0"
+                             shadetop="0"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_list_item>
+        <wcol_menu_back>
+          <ThemeWidgetColors inner="#606060e6"
+                             inner_sel="#2d2d2de6"
+                             item="#646464ff"
+                             outline="#000000"
+                             shadedown="-20"
+                             shadetop="25"
+                             show_shaded="FALSE"
+                             text="#a0a0a0"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_menu_back>
+        <wcol_menu_item>
+          <ThemeWidgetColors inner="#00000000"
+                             inner_sel="#f49c1cff"
+                             item="#ffffffff"
+                             outline="#000000"
+                             shadedown="0"
+                             shadetop="38"
+                             show_shaded="FALSE"
+                             text="#ffffff"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_menu_item>
+        <wcol_menu>
+          <ThemeWidgetColors inner="#606060ff"
+                             inner_sel="#f49c1cff"
+                             item="#ffffffff"
+                             outline="#000000"
+                             shadedown="-15"
+                             shadetop="15"
+                             show_shaded="FALSE"
+                             text="#ffffff"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_menu>
+        <wcol_num>
+          <ThemeWidgetColors inner="#9098a0ff"
+                             inner_sel="#f49c1cff"
+                             item="#5a5a5aff"
+                             outline="#191919"
+                             shadedown="0"
+                             shadetop="-20"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_num>
+        <wcol_option>
+          <ThemeWidgetColors inner="#686868ff"
+                             inner_sel="#f49c1cff"
+                             item="#000000ff"
+                             outline="#000000"
+                             shadedown="-15"
+                             shadetop="15"
+                             show_shaded="FALSE"
+                             text="#ffffff"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_option>
+        <panel>
+          <ThemePanelColors header="#ffffff79"
+                            show_header="FALSE">
+          </ThemePanelColors>
+        </panel>
+        <wcol_progress>
+          <ThemeWidgetColors inner="#bebebeff"
+                             inner_sel="#646464b4"
+                             item="#444444ff"
+                             outline="#000000"
+                             shadedown="-5"
+                             shadetop="5"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_progress>
+        <wcol_pulldown>
+          <ThemeWidgetColors inner="#606060ff"
+                             inner_sel="#f49c1cff"
+                             item="#ffffffff"
+                             outline="#000000"
+                             shadedown="-20"
+                             shadetop="25"
+                             show_shaded="FALSE"
+                             text="#888888"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_pulldown>
+        <wcol_radio>
+          <ThemeWidgetColors inner="#464646ff"
+                             inner_sel="#f49c1cff"
+                             item="#ffffffff"
+                             outline="#000000"
+                             shadedown="-15"
+                             shadetop="15"
+                             show_shaded="FALSE"
+                             text="#ffffff"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_radio>
+        <wcol_regular>
+          <ThemeWidgetColors inner="#979999ff"
+                             inner_sel="#646464ff"
+                             item="#000000ff"
+                             outline="#000000"
+                             shadedown="0"
+                             shadetop="0"
+                             show_shaded="FALSE"
+                             text="#ffffff"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_regular>
+        <wcol_scroll>
+          <ThemeWidgetColors inner="#505050b4"
+                             inner_sel="#646464b4"
+                             item="#606060ff"
+                             outline="#323232"
+                             shadedown="-5"
+                             shadetop="5"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_scroll>
+        <wcol_numslider>
+          <ThemeWidgetColors inner="#b4b4b4ff"
+                             inner_sel="#999999ff"
+                             item="#9098a0ff"
+                             outline="#191919"
+                             shadedown="0"
+                             shadetop="-20"
+                             show_shaded="FALSE"
+                             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="#c9ce20"
+                                  inner_key_sel="#d7d34b">
+          </ThemeWidgetStateColors>
+        </wcol_state>
+        <wcol_text>
+          <ThemeWidgetColors inner="#999999ff"
+                             inner_sel="#999999ff"
+                             item="#5a5a5aff"
+                             outline="#93a56f"
+                             shadedown="25"
+                             shadetop="0"
+                             show_shaded="FALSE"
+                             text="#fdfdfd"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_text>
+        <wcol_toggle>
+          <ThemeWidgetColors inner="#999999ff"
+                             inner_sel="#f49c1cff"
+                             item="#5a5a5aff"
+                             outline="#302e2e"
+                             shadedown="0"
+                             shadetop="0"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_toggle>
+        <wcol_tool>
+          <ThemeWidgetColors inner="#606060ff"
+                             inner_sel="#f49c1cff"
+                             item="#000000ff"
+                             outline="#191919"
+                             shadedown="-15"
+                             shadetop="15"
+                             show_shaded="FALSE"
+                             text="#f1f1f1"
+                             text_sel="#000000">
+          </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>
+        <space>
+          <ThemeSpaceGeneric header="#202020"
+                             header_text="#000000"
+                             header_text_hi="#fdffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#ffffff"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#484848">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeUserPreferences>
+    </user_preferences>
+    <bone_color_sets>
+      <ThemeBoneColorSet active="#f70a0a"
+                         show_colored_constraints="FALSE"
+                         normal="#9a0000"
+                         select="#bd1111">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#fa9900"
+                         show_colored_constraints="FALSE"
+                         normal="#f74018"
+                         select="#f66913">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#83ef1d"
+                         show_colored_constraints="FALSE"
+                         normal="#1e9109"
+                         select="#59b70b">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#5ec1ef"
+                         show_colored_constraints="FALSE"
+                         normal="#0a3694"
+                         select="#3667df">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#f05d91"
+                         show_colored_constraints="FALSE"
+                         normal="#a9294e"
+                         select="#c1416a">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#8764d5"
+                         show_colored_constraints="FALSE"
+                         normal="#430c78"
+                         select="#543aa3">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#6fb6ab"
+                         show_colored_constraints="FALSE"
+                         normal="#24785a"
+                         select="#3c9579">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#9bc2cd"
+                         show_colored_constraints="FALSE"
+                         normal="#4b707c"
+                         select="#6a8691">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#f3ff00"
+                         show_colored_constraints="FALSE"
+                         normal="#f4c90c"
+                         select="#eec236">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#ffffff"
+                         show_colored_constraints="FALSE"
+                         normal="#1e2024"
+                         select="#484c56">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#d330d6"
+                         show_colored_constraints="FALSE"
+                         normal="#6f2f6a"
+                         select="#9845be">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#bbef5b"
+                         show_colored_constraints="FALSE"
+                         normal="#6c8e22"
+                         select="#7fb022">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#dedede"
+                         show_colored_constraints="FALSE"
+                         normal="#8d8d8d"
+                         select="#b0b0b0">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#bd6a11"
+                         show_colored_constraints="FALSE"
+                         normal="#834326"
+                         select="#8b5811">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#34622b"
+                         show_colored_constraints="FALSE"
+                         normal="#08310e"
+                         select="#1c430b">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+    </bone_color_sets>
+  </Theme>
+</bpy>
diff --git a/release/scripts/addons_contrib/presets/interface_theme/pinkified.xml b/release/scripts/addons_contrib/presets/interface_theme/pinkified.xml
new file mode 100644
index 0000000..6686ccf
--- /dev/null
+++ b/release/scripts/addons_contrib/presets/interface_theme/pinkified.xml
@@ -0,0 +1,828 @@
+<bpy>
+  <Theme>
+    <view_3d>
+      <ThemeView3D object_active="#ff0034"
+                   editmesh_active="#ff5edece"
+                   act_spline="#db2512"
+                   handle_align="#803060"
+                   handle_sel_align="#f090a0"
+                   handle_auto="#909000"
+                   handle_sel_auto="#f0ff40"
+                   bone_pose="#50c8ff"
+                   bone_solid="#424242"
+                   bundle_solid="#c8c8c8"
+                   camera="#000000"
+                   camera_path="#a0a0a0"
+                   frame_current="#60c040"
+                   edge_crease="#cc0099"
+                   extra_edge_len="#200000"
+                   edge_seam="#ff0000"
+                   edge_select="#b30025"
+                   edge_sharp="#7bff00"
+                   edge_facesel="#4b4b4b"
+                   empty="#000000"
+                   face="#ffffff0c"
+                   extra_face_angle="#008200"
+                   extra_face_area="#0000ff"
+                   face_dot="#ac0023"
+                   facedot_size="4"
+                   normal="#27ffff"
+                   face_select="#e8142f2c"
+                   handle_free="#000000"
+                   handle_sel_free="#000000"
+                   grid="#181818"
+                   lamp="#977f491e"
+                   lastsel_point="#f0ff40"
+                   nurb_uline="#909000"
+                   nurb_vline="#803060"
+                   nurb_sel_uline="#f0ff40"
+                   nurb_sel_vline="#f090a0"
+                   object_grouped="#127112"
+                   object_grouped_active="#55bb55"
+                   object_selected="#d1687d"
+                   outline_width="1"
+                   panel="#7575757f"
+                   speaker="#a63904"
+                   transform="#ffffff"
+                   handle_vect="#409030"
+                   handle_sel_vect="#40c030"
+                   vertex="#9a001f"
+                   vertex_normal="#2361dd"
+                   vertex_select="#ff0034"
+                   vertex_size="4"
+                   wire="#505050">
+        <space>
+          <ThemeSpaceGeneric header="#1a1a1a"
+                             header_text="#757575"
+                             header_text_hi="#ffffff"
+                             button="#161616"
+                             button_text="#6a6a6a"
+                             button_text_hi="#ffffff"
+                             button_title="#cccccc"
+                             text="#ffffff"
+                             text_hi="#ffffff"
+                             title="#c7c7c7"
+                             back="#111111">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeView3D>
+    </view_3d>
+    <clip_editor>
+      <ThemeClipEditor active_marker="#ffe6ea"
+                       frame_current="#60c040"
+                       disabled_marker="#7f0000"
+                       grid="#5e5e5e"
+                       handle_vertex="#000000"
+                       handle_vertex_select="#ffff00"
+                       handle_vertex_size="6"
+                       locked_marker="#7f7f7f"
+                       marker="#f68026"
+                       marker_outline="#3c3c3c"
+                       path_after="#007dff"
+                       path_before="#ff0b22"
+                       selected_marker="#ff2550">
+        <space>
+          <ThemeSpaceGeneric header="#232323"
+                             header_text="#aaaaaa"
+                             header_text_hi="#ffffff"
+                             button="#0b0b0b"
+                             button_text="#888888"
+                             button_text_hi="#ffffff"
+                             button_title="#adadad"
+                             text="#888888"
+                             text_hi="#ffffff"
+                             title="#6b6b6b"
+                             back="#232323">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeClipEditor>
+    </clip_editor>
+    <console>
+      <ThemeConsole cursor="#dc6060"
+                    line_error="#00df62"
+                    line_info="#ffd600"
+                    line_input="#a4a4a4"
+                    line_output="#ff336e">
+        <space>
+          <ThemeSpaceGeneric header="#1a1a1a"
+                             header_text="#ffffff"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#343434"
+                             button_text_hi="#ffffff"
+                             button_title="#ffffff"
+                             text="#828282"
+                             text_hi="#ffffff"
+                             title="#828282"
+                             back="#000000">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeConsole>
+    </console>
+    <dopesheet_editor>
+      <ThemeDopeSheet active_channels_group="#87b17d"
+                      channel_group="#4f6549"
+                      channels="#676767"
+                      channels_selected="#ff8099"
+                      frame_current="#99112c"
+                      dopesheet_channel="#39434d"
+                      dopesheet_subchannel="#15171a"
+                      grid="#0b0b0b"
+                      long_key="#0c0a0a"
+                      long_key_selected="#ff7500"
+                      value_sliders="#000000"
+                      view_sliders="#898989">
+        <space>
+          <ThemeSpaceGeneric header="#2a2a2a"
+                             header_text="#ffffff"
+                             header_text_hi="#ffffff"
+                             button="#2a2a2a"
+                             button_text="#636363"
+                             button_text_hi="#ffffff"
+                             button_title="#ffffff"
+                             text="#828282"
+                             text_hi="#ffffff"
+                             title="#ffffff"
+                             back="#2a2a2a">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#2a2a2a"
+                                 list_text="#b3b3b3"
+                                 list_text_hi="#ffffff"
+                                 list_title="#ffffff">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeDopeSheet>
+    </dopesheet_editor>
+    <file_browser>
+      <ThemeFileBrowser active_file="#ff004b"
+                        active_file_text="#ffffff"
+                        scroll_handle="#373737"
+                        scrollbar="#242424"
+                        selected_file="#88172d"
+                        tiles="#161616">
+        <space>
+          <ThemeSpaceGeneric header="#161616"
+                             header_text="#ffffff"
+                             header_text_hi="#ffffff"
+                             button="#161616"
+                             button_text="#dddddd"
+                             button_text_hi="#ffffff"
+                             button_title="#eaeaea"
+                             text="#fafafa"
+                             text_hi="#ffffff"
+                             title="#ffffff"
+                             back="#161616">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#181818"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#9b9b9b">
+          </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="#994030"
+                        handle_sel_auto_clamped="#f0af90"
+                        channel_group="#4f6549"
+                        channels_region="#707070"
+                        frame_current="#99112c"
+                        dopesheet_channel="#4c5966"
+                        dopesheet_subchannel="#7c8996"
+                        handle_free="#000000"
+                        handle_sel_free="#000000"
+                        grid="#1d1d1d"
+                        handle_vertex="#000000"
+                        handle_vertex_select="#ff004b"
+                        handle_vertex_size="3"
+                        lastsel_point="#000000"
+                        panel="#ffffff"
+                        handle_vect="#409030"
+                        handle_sel_vect="#40c030"
+                        vertex="#000000"
+                        vertex_select="#ff004b"
+                        vertex_size="3"
+                        window_sliders="#3b3b3b">
+        <space>
+          <ThemeSpaceGeneric header="#232323"
+                             header_text="#ffffff"
+                             header_text_hi="#ffffff"
+                             button="#232323"
+                             button_text="#757575"
+                             button_text_hi="#ffffff"
+                             button_title="#ffffff"
+                             text="#828282"
+                             text_hi="#ffffff"
+                             title="#ffffff"
+                             back="#232323">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#232323"
+                                 list_text="#cccccc"
+                                 list_text_hi="#ffffff"
+                                 list_title="#8d7878">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeGraphEditor>
+    </graph_editor>
+    <image_editor>
+      <ThemeImageEditor editmesh_active="#ffffff80"
+                        face="#ffffff0a"
+                        face_dot="#ff3d1d"
+                        facedot_size="3"
+                        face_select="#ff1d4a1a"
+                        scope_back="#0707075e"
+                        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="#f73c00"
+                        vertex_select="#df0041"
+                        vertex_size="3">
+        <space>
+          <ThemeSpaceGeneric header="#1a1a1a"
+                             header_text="#272727"
+                             header_text_hi="#ffffff"
+                             button="#070707"
+                             button_text="#bebebe"
+                             button_text_hi="#ffffff"
+                             button_title="#ffffff"
+                             text="#9c9c9c"
+                             text_hi="#ffffff"
+                             title="#ffffff"
+                             back="#1a1a1a">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeImageEditor>
+    </image_editor>
+    <info>
+      <ThemeInfo>
+        <space>
+          <ThemeSpaceGeneric header="#222222"
+                             header_text="#999999"
+                             header_text_hi="#cbcbcb"
+                             button="#161616"
+                             button_text="#0d0d0d"
+                             button_text_hi="#ffffff"
+                             button_title="#0d0d0d"
+                             text="#ffffff"
+                             text_hi="#ffffff"
+                             title="#ffffff"
+                             back="#090909">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeInfo>
+    </info>
+    <logic_editor>
+      <ThemeLogicEditor panel="#111111">
+        <space>
+          <ThemeSpaceGeneric header="#272727"
+                             header_text="#ffffff"
+                             header_text_hi="#ffffff"
+                             button="#111111"
+                             button_text="#ffffff"
+                             button_text_hi="#ffffff"
+                             button_title="#ffffff"
+                             text="#9d9d9d"
+                             text_hi="#ffffff"
+                             title="#ffffff"
+                             back="#272727">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeLogicEditor>
+    </logic_editor>
+    <nla_editor>
+      <ThemeNLAEditor bars="#707070"
+                      bars_selected="#60c040"
+                      frame_current="#99112c"
+                      grid="#5e5e5e"
+                      strips="#0c0a0a"
+                      strips_selected="#ff8c00"
+                      view_sliders="#969696">
+        <space>
+          <ThemeSpaceGeneric header="#1a1a1a"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#6b6b6b">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#666666"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeNLAEditor>
+    </nla_editor>
+    <node_editor>
+      <ThemeNodeEditor converter_node="#00465d"
+                       group_node="#26960e"
+                       in_out_node="#d9003a"
+                       node_backdrop="#454545ae"
+                       noodle_curving="5"
+                       operator_node="#d87200"
+                       selected_text="#ffdddd"
+                       wire_select="#ffe500"
+                       wire="#ff0000">
+        <space>
+          <ThemeSpaceGeneric header="#111111"
+                             header_text="#ffffff"
+                             header_text_hi="#ffffff"
+                             button="#0c0c0c"
+                             button_text="#bebebe"
+                             button_text_hi="#ffffff"
+                             button_title="#ffffff"
+                             text="#ffffff"
+                             text_hi="#565656"
+                             title="#ffffff"
+                             back="#111111">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#a5a5a5"
+                                 list_text="#343434"
+                                 list_text_hi="#ffffff"
+                                 list_title="#ffffff">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeNodeEditor>
+    </node_editor>
+    <outliner>
+      <ThemeOutliner match="#337f33"
+                     selected_highlight="#870027">
+        <space>
+          <ThemeSpaceGeneric header="#232323"
+                             header_text="#ffffff"
+                             header_text_hi="#ffffff"
+                             button="#585858"
+                             button_text="#8f8f8f"
+                             button_text_hi="#ffffff"
+                             button_title="#ffffff"
+                             text="#939393"
+                             text_hi="#ffffff"
+                             title="#ffffff"
+                             back="#232323">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeOutliner>
+    </outliner>
+    <properties>
+      <ThemeProperties panel="#131313">
+        <space>
+          <ThemeSpaceGeneric header="#1a1a1a"
+                             header_text="#757575"
+                             header_text_hi="#ffffff"
+                             button="#1e1e1e"
+                             button_text="#4e4e4e"
+                             button_text_hi="#ffffff"
+                             button_title="#414141"
+                             text="#999999"
+                             text_hi="#ffffff"
+                             title="#aeaeae"
+                             back="#1a1a1a">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeProperties>
+    </properties>
+    <sequence_editor>
+      <ThemeSequenceEditor audio_strip="#2e8f8f"
+                           movieclip_strip="#20208f"
+                           frame_current="#99112c"
+                           draw_action="#50c8ff"
+                           effect_strip="#e270a6"
+                           grid="#414141"
+                           image_strip="#675379"
+                           keyframe="#ff9f00"
+                           meta_strip="#6d9183"
+                           movie_strip="#516987"
+                           plugin_strip="#7e7e50"
+                           preview_back="#000000"
+                           scene_strip="#4e983e"
+                           transition_strip="#b33d59"
+                           window_sliders="#6d6d6d">
+        <space>
+          <ThemeSpaceGeneric header="#171717"
+                             header_text="#ffffff"
+                             header_text_hi="#ffffff"
+                             button="#171717"
+                             button_text="#979797"
+                             button_text_hi="#ffffff"
+                             button_title="#ffffff"
+                             text="#757575"
+                             text_hi="#ffffff"
+                             title="#ffffff"
+                             back="#171717">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeSequenceEditor>
+    </sequence_editor>
+    <text_editor>
+      <ThemeTextEditor cursor="#ffffff"
+                       syntax_special="#ffff00"
+                       line_numbers_background="#0a0a0a"
+                       selected_text="#561423"
+                       syntax_builtin="#ff009a"
+                       syntax_comment="#00ff7a"
+                       syntax_numbers="#0088ff"
+                       syntax_string="#f20000">
+        <space>
+          <ThemeSpaceGeneric header="#1a1a1a"
+                             header_text="#f2f2f2"
+                             header_text_hi="#ffffff"
+                             button="#1a1a1a"
+                             button_text="#ffffff"
+                             button_text_hi="#ffffff"
+                             button_title="#d0d0d0"
+                             text="#a9a9a9"
+                             text_hi="#ffffff"
+                             title="#ffffff"
+                             back="#050505">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTextEditor>
+    </text_editor>
+    <timeline>
+      <ThemeTimeline frame_current="#ff1d4a"
+                     grid="#343434">
+        <space>
+          <ThemeSpaceGeneric header="#232323"
+                             header_text="#828282"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#0d0d0d"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#757575"
+                             text_hi="#ffffff"
+                             title="#757575"
+                             back="#232323">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTimeline>
+    </timeline>
+    <user_interface>
+      <ThemeUserInterface icon_alpha="1"
+                          icon_file="">
+        <wcol_box>
+          <ThemeWidgetColors inner="#00000066"
+                             inner_sel="#ff1d4aff"
+                             item="#ffffffff"
+                             outline="#343434"
+                             shadedown="-5"
+                             shadetop="0"
+                             show_shaded="FALSE"
+                             text="#999999"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_box>
+        <wcol_list_item>
+          <ThemeWidgetColors inner="#c69e9e00"
+                             inner_sel="#4d262eff"
+                             item="#ffffffff"
+                             outline="#4e4e4e"
+                             shadedown="0"
+                             shadetop="-12"
+                             show_shaded="TRUE"
+                             text="#ffffff"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_list_item>
+        <wcol_menu_back>
+          <ThemeWidgetColors inner="#0c0c0cd0"
+                             inner_sel="#414141ff"
+                             item="#232323ff"
+                             outline="#3f3e3e"
+                             shadedown="-20"
+                             shadetop="4"
+                             show_shaded="FALSE"
+                             text="#a0a0a0"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_menu_back>
+        <wcol_menu_item>
+          <ThemeWidgetColors inner="#0c0c0c4e"
+                             inner_sel="#ff1d4aff"
+                             item="#ffffffff"
+                             outline="#222222"
+                             shadedown="0"
+                             shadetop="8"
+                             show_shaded="TRUE"
+                             text="#ffffff"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_menu_item>
+        <wcol_menu>
+          <ThemeWidgetColors inner="#2a2a2aff"
+                             inner_sel="#ff1d4aff"
+                             item="#000000ff"
+                             outline="#343434"
+                             shadedown="0"
+                             shadetop="12"
+                             show_shaded="TRUE"
+                             text="#dddddd"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_menu>
+        <wcol_num>
+          <ThemeWidgetColors inner="#0c0c0cff"
+                             inner_sel="#ff1d4aff"
+                             item="#5a5a5aff"
+                             outline="#343434"
+                             shadedown="-5"
+                             shadetop="9"
+                             show_shaded="TRUE"
+                             text="#757575"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_num>
+        <wcol_option>
+          <ThemeWidgetColors inner="#1b1b1bff"
+                             inner_sel="#000000ff"
+                             item="#ff002eff"
+                             outline="#000000"
+                             shadedown="0"
+                             shadetop="-14"
+                             show_shaded="TRUE"
+                             text="#808080"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_option>
+        <panel>
+          <ThemePanelColors header="#00000000"
+                            show_header="FALSE">
+          </ThemePanelColors>
+        </panel>
+        <wcol_progress>
+          <ThemeWidgetColors inner="#000000ff"
+                             inner_sel="#686868ff"
+                             item="#be0037ff"
+                             outline="#5d001a"
+                             shadedown="-88"
+                             shadetop="100"
+                             show_shaded="FALSE"
+                             text="#ffffff"
+                             text_sel="#ff1d4a">
+          </ThemeWidgetColors>
+        </wcol_progress>
+        <wcol_pulldown>
+          <ThemeWidgetColors inner="#0c0c0cff"
+                             inner_sel="#ff1d4aff"
+                             item="#ffffffff"
+                             outline="#000000"
+                             shadedown="-20"
+                             shadetop="25"
+                             show_shaded="FALSE"
+                             text="#b6b6b6"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_pulldown>
+        <wcol_radio>
+          <ThemeWidgetColors inner="#0c0c0cff"
+                             inner_sel="#ff1d4aff"
+                             item="#ffffffff"
+                             outline="#343434"
+                             shadedown="2"
+                             shadetop="6"
+                             show_shaded="TRUE"
+                             text="#b1b1b1"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_radio>
+        <wcol_regular>
+          <ThemeWidgetColors inner="#0c0c0cff"
+                             inner_sel="#ff1d4aff"
+                             item="#191919ff"
+                             outline="#191919"
+                             shadedown="0"
+                             shadetop="0"
+                             show_shaded="FALSE"
+                             text="#ffffff"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_regular>
+        <wcol_scroll>
+          <ThemeWidgetColors inner="#00000080"
+                             inner_sel="#000000ff"
+                             item="#4d4d4d33"
+                             outline="#111111"
+                             shadedown="12"
+                             shadetop="12"
+                             show_shaded="TRUE"
+                             text="#bababa"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_scroll>
+        <wcol_numslider>
+          <ThemeWidgetColors inner="#33141bff"
+                             inner_sel="#ff1d4aff"
+                             item="#800f26ff"
+                             outline="#343434"
+                             shadedown="0"
+                             shadetop="-16"
+                             show_shaded="TRUE"
+                             text="#f7f7f7"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_numslider>
+        <wcol_state>
+          <ThemeWidgetStateColors inner_anim="#194a00"
+                                  inner_anim_sel="#287700"
+                                  blend="1"
+                                  inner_driven="#b566ff"
+                                  inner_driven_sel="#ce99ff"
+                                  inner_key="#ffdf44"
+                                  inner_key_sel="#b39400">
+          </ThemeWidgetStateColors>
+        </wcol_state>
+        <wcol_text>
+          <ThemeWidgetColors inner="#0d0d0dff"
+                             inner_sel="#ff1d4aff"
+                             item="#414141ff"
+                             outline="#1a1a1a"
+                             shadedown="3"
+                             shadetop="-59"
+                             show_shaded="TRUE"
+                             text="#686868"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_text>
+        <wcol_toggle>
+          <ThemeWidgetColors inner="#3e3e3eff"
+                             inner_sel="#ff1d4aff"
+                             item="#1a1a1aff"
+                             outline="#343434"
+                             shadedown="0"
+                             shadetop="27"
+                             show_shaded="TRUE"
+                             text="#ffffff"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_toggle>
+        <wcol_tool>
+          <ThemeWidgetColors inner="#4d4d4dff"
+                             inner_sel="#ff1d4aff"
+                             item="#ffffffff"
+                             outline="#676767"
+                             shadedown="-15"
+                             shadetop="-5"
+                             show_shaded="TRUE"
+                             text="#d8d8d8"
+                             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>
+        <space>
+          <ThemeSpaceGeneric header="#1a1a1a"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#414141"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#686868"
+                             text_hi="#ffffff"
+                             title="#f2f2f2"
+                             back="#1a1a1a">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeUserPreferences>
+    </user_preferences>
+    <bone_color_sets>
+      <ThemeBoneColorSet active="#f70a0a"
+                         show_colored_constraints="FALSE"
+                         normal="#9a0000"
+                         select="#bd1111">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#fa9900"
+                         show_colored_constraints="FALSE"
+                         normal="#f74018"
+                         select="#f66913">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#83ef1d"
+                         show_colored_constraints="FALSE"
+                         normal="#1e9109"
+                         select="#59b70b">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#5ec1ef"
+                         show_colored_constraints="FALSE"
+                         normal="#0a3694"
+                         select="#3667df">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#f05d91"
+                         show_colored_constraints="FALSE"
+                         normal="#a9294e"
+                         select="#c1416a">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#8764d5"
+                         show_colored_constraints="FALSE"
+                         normal="#430c78"
+                         select="#543aa3">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#6fb6ab"
+                         show_colored_constraints="FALSE"
+                         normal="#24785a"
+                         select="#3c9579">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#9bc2cd"
+                         show_colored_constraints="FALSE"
+                         normal="#4b707c"
+                         select="#6a8691">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#f3ff00"
+                         show_colored_constraints="FALSE"
+                         normal="#f4c90c"
+                         select="#eec236">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#ffffff"
+                         show_colored_constraints="FALSE"
+                         normal="#1e2024"
+                         select="#484c56">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#d330d6"
+                         show_colored_constraints="FALSE"
+                         normal="#6f2f6a"
+                         select="#9845be">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#bbef5b"
+                         show_colored_constraints="FALSE"
+                         normal="#6c8e22"
+                         select="#7fb022">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#dedede"
+                         show_colored_constraints="FALSE"
+                         normal="#8d8d8d"
+                         select="#b0b0b0">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#bd6a11"
+                         show_colored_constraints="FALSE"
+                         normal="#834326"
+                         select="#8b5811">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#34622b"
+                         show_colored_constraints="FALSE"
+                         normal="#08310e"
+                         select="#1c430b">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+    </bone_color_sets>
+  </Theme>
+</bpy>
diff --git a/release/scripts/addons_contrib/presets/interface_theme/softblend.xml b/release/scripts/addons_contrib/presets/interface_theme/softblend.xml
new file mode 100644
index 0000000..79b9d62
--- /dev/null
+++ b/release/scripts/addons_contrib/presets/interface_theme/softblend.xml
@@ -0,0 +1,828 @@
+<bpy>
+  <Theme>
+    <view_3d>
+      <ThemeView3D object_active="#ffffff"
+                   editmesh_active="#ffffff00"
+                   act_spline="#c36c8c"
+                   handle_align="#e277b1"
+                   handle_sel_align="#ffffff"
+                   handle_auto="#30b6e5"
+                   handle_sel_auto="#ffffff"
+                   bone_pose="#50c8ff"
+                   bone_solid="#c8c8c8"
+                   bundle_solid="#c8c8c8"
+                   camera="#000000"
+                   camera_path="#000000"
+                   frame_current="#53c03b"
+                   edge_crease="#eb3bdd"
+                   extra_edge_len="#200000"
+                   edge_seam="#f0703b"
+                   edge_select="#f3f3f3"
+                   edge_sharp="#49a1ec"
+                   edge_facesel="#272727"
+                   empty="#000000"
+                   face="#838383ff"
+                   extra_face_angle="#cccccc"
+                   extra_face_area="#cccccc"
+                   face_dot="#52f27e"
+                   facedot_size="3"
+                   normal="#9cfcc8"
+                   face_select="#949494ff"
+                   handle_free="#cccccc"
+                   handle_sel_free="#ffffff"
+                   grid="#6e6e6e"
+                   lamp="#ffe56666"
+                   lastsel_point="#ffffff"
+                   nurb_uline="#a3a3a3"
+                   nurb_vline="#803060"
+                   nurb_sel_uline="#ffffff"
+                   nurb_sel_vline="#f090a0"
+                   object_grouped="#63bd87"
+                   object_grouped_active="#ffffff"
+                   object_selected="#88fca7"
+                   outline_width="1"
+                   panel="#aaa8a6ff"
+                   speaker="#000000"
+                   transform="#ffffff"
+                   handle_vect="#afafaf"
+                   handle_sel_vect="#ffffff"
+                   vertex="#343434"
+                   vertex_normal="#68a1db"
+                   vertex_select="#ff2f7a"
+                   vertex_size="4"
+                   wire="#242424">
+        <space>
+          <ThemeSpaceGeneric header="#aaa8a6"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#aaa8a6"
+                             button_text="#222222"
+                             button_text_hi="#ffffff"
+                             button_title="#313131"
+                             text="#ffffff"
+                             text_hi="#ffffff"
+                             title="#ffffff"
+                             back="#918f8d">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeView3D>
+    </view_3d>
+    <clip_editor>
+      <ThemeClipEditor active_marker="#ffffff"
+                       frame_current="#a3ff96"
+                       disabled_marker="#b54636"
+                       grid="#5e5e5e"
+                       handle_vertex="#000000"
+                       handle_vertex_select="#ff2f7a"
+                       handle_vertex_size="4"
+                       locked_marker="#7f7f7f"
+                       marker="#71cd7f"
+                       marker_outline="#000000"
+                       path_after="#5a7575"
+                       path_before="#22d8d1"
+                       selected_marker="#ff2f7a">
+        <space>
+          <ThemeSpaceGeneric header="#aaa8a6"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#aaa8a6"
+                             button_text="#222222"
+                             button_text_hi="#ffffff"
+                             button_title="#222222"
+                             text="#1a1a1a"
+                             text_hi="#ffffff"
+                             title="#1a1a1a"
+                             back="#aaa8a6">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeClipEditor>
+    </clip_editor>
+    <console>
+      <ThemeConsole cursor="#9cfcc8"
+                    line_error="#dc3a77"
+                    line_info="#00aa00"
+                    line_input="#ffffff"
+                    line_output="#6080ff">
+        <space>
+          <ThemeSpaceGeneric header="#aaa8a6"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#4d4d4d"
+                             button_text="#131313"
+                             button_text_hi="#ffffff"
+                             button_title="#131313"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#0c0c0c">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeConsole>
+    </console>
+    <dopesheet_editor>
+      <ThemeDopeSheet active_channels_group="#95adc1"
+                      channel_group="#8a9dac"
+                      channels="#9baeb9"
+                      channels_selected="#91ccb3"
+                      frame_current="#a3ff96"
+                      dopesheet_channel="#9baeb9"
+                      dopesheet_subchannel="#aaa8a6"
+                      grid="#7f7f7f"
+                      long_key="#0c0a0a"
+                      long_key_selected="#ecfc37"
+                      value_sliders="#000000"
+                      view_sliders="#333333">
+        <space>
+          <ThemeSpaceGeneric header="#aaa8a6"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#aaa8a6"
+                             button_text="#111111"
+                             button_text_hi="#a3a3a3"
+                             button_title="#111111"
+                             text="#222222"
+                             text_hi="#ffffff"
+                             title="#ffffff"
+                             back="#aaa8a6">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#aaa8a6"
+                                 list_text="#222222"
+                                 list_text_hi="#ffffff"
+                                 list_title="#cccccc">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeDopeSheet>
+    </dopesheet_editor>
+    <file_browser>
+      <ThemeFileBrowser active_file="#f1e593"
+                        active_file_text="#ffffff"
+                        scroll_handle="#8c8a88"
+                        scrollbar="#4d4b4d"
+                        selected_file="#f1e593"
+                        tiles="#aaa8a6">
+        <space>
+          <ThemeSpaceGeneric header="#aaa8a6"
+                             header_text="#afafaf"
+                             header_text_hi="#ffffff"
+                             button="#aaa8a6"
+                             button_text="#cccccc"
+                             button_text_hi="#ffffff"
+                             button_title="#222222"
+                             text="#222222"
+                             text_hi="#ffffff"
+                             title="#ffffff"
+                             back="#aaa8a6">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#aaa8a6"
+                                 list_text="#7f7f7f"
+                                 list_text_hi="#ffffff"
+                                 list_title="#3a3a3a">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeFileBrowser>
+    </file_browser>
+    <graph_editor>
+      <ThemeGraphEditor active_channels_group="#95adc1"
+                        handle_align="#1d1d1d"
+                        handle_sel_align="#f3f3f3"
+                        handle_auto="#696969"
+                        handle_sel_auto="#d4d4d4"
+                        handle_auto_clamped="#000000"
+                        handle_sel_auto_clamped="#000000"
+                        channel_group="#8a9dac"
+                        channels_region="#4d4d4d"
+                        frame_current="#a1ff8c"
+                        dopesheet_channel="#aaa8a6"
+                        dopesheet_subchannel="#aaa8a6"
+                        handle_free="#252525"
+                        handle_sel_free="#ececec"
+                        grid="#8f8f8f"
+                        handle_vertex="#525252"
+                        handle_vertex_select="#f1f1f1"
+                        handle_vertex_size="6"
+                        lastsel_point="#000000"
+                        panel="#989898"
+                        handle_vect="#191919"
+                        handle_sel_vect="#ffffff"
+                        vertex="#575757"
+                        vertex_select="#ffffff"
+                        vertex_size="3"
+                        window_sliders="#4d4d4d">
+        <space>
+          <ThemeSpaceGeneric header="#aaa8a6"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#aaa8a6"
+                             button_text="#222222"
+                             button_text_hi="#ffffff"
+                             button_title="#333333"
+                             text="#222222"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#aaa8a6">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#aaa8a6"
+                                 list_text="#222222"
+                                 list_text_hi="#ffffff"
+                                 list_title="#676767">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeGraphEditor>
+    </graph_editor>
+    <image_editor>
+      <ThemeImageEditor editmesh_active="#ffffff80"
+                        face="#00000032"
+                        face_dot="#ffffff"
+                        facedot_size="2"
+                        face_select="#ffffff3c"
+                        scope_back="#aaa8a6ff"
+                        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="#000000"
+                        vertex_select="#ffffff"
+                        vertex_size="3">
+        <space>
+          <ThemeSpaceGeneric header="#aaa8a6"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#aaa8a6"
+                             button_text="#222222"
+                             button_text_hi="#ffffff"
+                             button_title="#383838"
+                             text="#ffffff"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#2d2d2d">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeImageEditor>
+    </image_editor>
+    <info>
+      <ThemeInfo>
+        <space>
+          <ThemeSpaceGeneric header="#aaa8a6"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#aaa8a6"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#aaa8a6">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeInfo>
+    </info>
+    <logic_editor>
+      <ThemeLogicEditor panel="#aaa8a6">
+        <space>
+          <ThemeSpaceGeneric header="#aaa8a6"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#aaa8a6"
+                             button_text="#222222"
+                             button_text_hi="#ffffff"
+                             button_title="#111111"
+                             text="#222222"
+                             text_hi="#ffffff"
+                             title="#202020"
+                             back="#aaa8a6">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeLogicEditor>
+    </logic_editor>
+    <nla_editor>
+      <ThemeNLAEditor bars="#85c58f"
+                      bars_selected="#60c040"
+                      frame_current="#a3ff96"
+                      grid="#a39f9c"
+                      strips="#000000"
+                      strips_selected="#60c040"
+                      view_sliders="#4d4d4d">
+        <space>
+          <ThemeSpaceGeneric header="#aaa8a6"
+                             header_text="#a3a3a3"
+                             header_text_hi="#cccccc"
+                             button="#aaa8a6"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#333333"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#aaa8a6">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#aaa8a6"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeNLAEditor>
+    </nla_editor>
+    <node_editor>
+      <ThemeNodeEditor converter_node="#fffa90"
+                       group_node="#ffc173"
+                       in_out_node="#b1d9ff"
+                       node_backdrop="#d4d4d4ff"
+                       noodle_curving="5"
+                       operator_node="#beffcb"
+                       selected_text="#ffffff"
+                       wire_select="#ffffff"
+                       wire="#222222">
+        <space>
+          <ThemeSpaceGeneric header="#aaa8a6"
+                             header_text="#333333"
+                             header_text_hi="#ffffff"
+                             button="#aaa8a6"
+                             button_text="#222222"
+                             button_text_hi="#c5c5c5"
+                             button_title="#222222"
+                             text="#222222"
+                             text_hi="#ffffff"
+                             title="#a3a3a3"
+                             back="#aaa8a6">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#4d4d4d"
+                                 list_text="#676767"
+                                 list_text_hi="#ffffff"
+                                 list_title="#383838">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeNodeEditor>
+    </node_editor>
+    <outliner>
+      <ThemeOutliner match="#337f33"
+                     selected_highlight="#870027">
+        <space>
+          <ThemeSpaceGeneric header="#aaa8a6"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#aaa8a6"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#0f0f0f"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#ffffff"
+                             back="#aaa8a6">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeOutliner>
+    </outliner>
+    <properties>
+      <ThemeProperties panel="#aaa8a6">
+        <space>
+          <ThemeSpaceGeneric header="#aaa8a6"
+                             header_text="#222222"
+                             header_text_hi="#000000"
+                             button="#aaa8a6"
+                             button_text="#222222"
+                             button_text_hi="#ffffff"
+                             button_title="#222222"
+                             text="#222222"
+                             text_hi="#ffffff"
+                             title="#222222"
+                             back="#aaa8a6">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeProperties>
+    </properties>
+    <sequence_editor>
+      <ThemeSequenceEditor audio_strip="#e0d2a0"
+                           movieclip_strip="#20208f"
+                           frame_current="#a3ff96"
+                           draw_action="#50c8ff"
+                           effect_strip="#be8c76"
+                           grid="#afafaf"
+                           image_strip="#c99ac0"
+                           keyframe="#ffeb89"
+                           meta_strip="#91918d"
+                           movie_strip="#87a4c3"
+                           plugin_strip="#7e7e56"
+                           preview_back="#000000"
+                           scene_strip="#91b1a0"
+                           transition_strip="#d9777a"
+                           window_sliders="#777777">
+        <space>
+          <ThemeSpaceGeneric header="#aaa8a6"
+                             header_text="#a3a3a3"
+                             header_text_hi="#ffffff"
+                             button="#aaa8a6"
+                             button_text="#111111"
+                             button_text_hi="#ffffff"
+                             button_title="#111111"
+                             text="#333333"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#aaa8a6">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeSequenceEditor>
+    </sequence_editor>
+    <text_editor>
+      <ThemeTextEditor cursor="#54da70"
+                       syntax_special="#ca0c97"
+                       line_numbers_background="#a3a3a3"
+                       selected_text="#f1e593"
+                       syntax_builtin="#3162b2"
+                       syntax_comment="#535353"
+                       syntax_numbers="#b62440"
+                       syntax_string="#c31736">
+        <space>
+          <ThemeSpaceGeneric header="#aaa8a6"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#aaa8a6"
+                             button_text="#333333"
+                             button_text_hi="#ffffff"
+                             button_title="#222222"
+                             text="#222222"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#aaa8a6">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTextEditor>
+    </text_editor>
+    <timeline>
+      <ThemeTimeline frame_current="#a3ff96"
+                     grid="#838383">
+        <space>
+          <ThemeSpaceGeneric header="#aaa8a6"
+                             header_text="#a3a3a3"
+                             header_text_hi="#ffffff"
+                             button="#aaa8a6"
+                             button_text="#222222"
+                             button_text_hi="#a3a3a3"
+                             button_title="#aeacaa"
+                             text="#222222"
+                             text_hi="#ffffff"
+                             title="#cccccc"
+                             back="#aaa8a6">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTimeline>
+    </timeline>
+    <user_interface>
+      <ThemeUserInterface icon_alpha="1"
+                          icon_file="">
+        <wcol_box>
+          <ThemeWidgetColors inner="#aaa8a6ff"
+                             inner_sel="#aaa8a6ff"
+                             item="#ccccccff"
+                             outline="#9f9d9b"
+                             shadedown="6"
+                             shadetop="0"
+                             show_shaded="FALSE"
+                             text="#474747"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_box>
+        <wcol_list_item>
+          <ThemeWidgetColors inner="#f1e59333"
+                             inner_sel="#fff29c9a"
+                             item="#ffffffff"
+                             outline="#8c8a88"
+                             shadedown="0"
+                             shadetop="0"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_list_item>
+        <wcol_menu_back>
+          <ThemeWidgetColors inner="#aaa8a6ff"
+                             inner_sel="#aaa8a6ff"
+                             item="#ccccccff"
+                             outline="#474747"
+                             shadedown="0"
+                             shadetop="0"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_menu_back>
+        <wcol_menu_item>
+          <ThemeWidgetColors inner="#00000000"
+                             inner_sel="#aaa8a6ff"
+                             item="#000000ff"
+                             outline="#474747"
+                             shadedown="10"
+                             shadetop="-10"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_menu_item>
+        <wcol_menu>
+          <ThemeWidgetColors inner="#aaa8a6ff"
+                             inner_sel="#b0aeacff"
+                             item="#8e8c8bff"
+                             outline="#aaa8a6"
+                             shadedown="3"
+                             shadetop="-4"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_menu>
+        <wcol_num>
+          <ThemeWidgetColors inner="#353432ff"
+                             inner_sel="#353432ff"
+                             item="#222222ff"
+                             outline="#050505"
+                             shadedown="5"
+                             shadetop="-5"
+                             show_shaded="FALSE"
+                             text="#efefef"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_num>
+        <wcol_option>
+          <ThemeWidgetColors inner="#a5a3a1ff"
+                             inner_sel="#ccc9c7ff"
+                             item="#000000ff"
+                             outline="#acaaa8"
+                             shadedown="0"
+                             shadetop="-2"
+                             show_shaded="TRUE"
+                             text="#676767"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_option>
+        <panel>
+          <ThemePanelColors header="#00000004"
+                            show_header="TRUE">
+          </ThemePanelColors>
+        </panel>
+        <wcol_progress>
+          <ThemeWidgetColors inner="#aaa8a6ff"
+                             inner_sel="#aaa8a6ff"
+                             item="#96c78eff"
+                             outline="#474747"
+                             shadedown="-3"
+                             shadetop="3"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_progress>
+        <wcol_pulldown>
+          <ThemeWidgetColors inner="#aaa8a6ff"
+                             inner_sel="#aaa8a6ff"
+                             item="#ccccccff"
+                             outline="#474747"
+                             shadedown="-20"
+                             shadetop="25"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_pulldown>
+        <wcol_radio>
+          <ThemeWidgetColors inner="#a8a6a4ff"
+                             inner_sel="#95adc1ff"
+                             item="#aaa8a6ff"
+                             outline="#aaa8a6"
+                             shadedown="1"
+                             shadetop="-2"
+                             show_shaded="TRUE"
+                             text="#1a1a1a"
+                             text_sel="#1a1a1a">
+          </ThemeWidgetColors>
+        </wcol_radio>
+        <wcol_regular>
+          <ThemeWidgetColors inner="#7b7978ff"
+                             inner_sel="#95adc1ff"
+                             item="#979594ff"
+                             outline="#5f5e5c"
+                             shadedown="0"
+                             shadetop="-2"
+                             show_shaded="TRUE"
+                             text="#1a1a1a"
+                             text_sel="#1a1a1a">
+          </ThemeWidgetColors>
+        </wcol_regular>
+        <wcol_scroll>
+          <ThemeWidgetColors inner="#a4a2a0ff"
+                             inner_sel="#aaa8a6ff"
+                             item="#a2a19fff"
+                             outline="#82807f"
+                             shadedown="-5"
+                             shadetop="4"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_scroll>
+        <wcol_numslider>
+          <ThemeWidgetColors inner="#353432ff"
+                             inner_sel="#353432ff"
+                             item="#1f1f1fff"
+                             outline="#050505"
+                             shadedown="5"
+                             shadetop="-5"
+                             show_shaded="FALSE"
+                             text="#ffffff"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_numslider>
+        <wcol_state>
+          <ThemeWidgetStateColors inner_anim="#adb4c7"
+                                  inner_anim_sel="#c4cee0"
+                                  blend="1"
+                                  inner_driven="#c69cb1"
+                                  inner_driven_sel="#ecaacd"
+                                  inner_key="#c0bb83"
+                                  inner_key_sel="#dad37d">
+          </ThemeWidgetStateColors>
+        </wcol_state>
+        <wcol_text>
+          <ThemeWidgetColors inner="#a6a4a2ff"
+                             inner_sel="#f1e593ff"
+                             item="#c2b876ff"
+                             outline="#aaa8a6"
+                             shadedown="0"
+                             shadetop="-2"
+                             show_shaded="TRUE"
+                             text="#242424"
+                             text_sel="#242424">
+          </ThemeWidgetColors>
+        </wcol_text>
+        <wcol_toggle>
+          <ThemeWidgetColors inner="#a8a6a4ff"
+                             inner_sel="#95adc1ff"
+                             item="#aaa8a6ff"
+                             outline="#aaa8a6"
+                             shadedown="0"
+                             shadetop="-3"
+                             show_shaded="TRUE"
+                             text="#1c1c1c"
+                             text_sel="#1a1a1a">
+          </ThemeWidgetColors>
+        </wcol_toggle>
+        <wcol_tool>
+          <ThemeWidgetColors inner="#aaa8a6ff"
+                             inner_sel="#a19f9dff"
+                             item="#a19f9dff"
+                             outline="#a6a4a2"
+                             shadedown="-6"
+                             shadetop="5"
+                             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>
+        <space>
+          <ThemeSpaceGeneric header="#aaa8a6"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#aaa8a6"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#222222"
+                             text_hi="#ffffff"
+                             title="#222222"
+                             back="#aaa8a6">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeUserPreferences>
+    </user_preferences>
+    <bone_color_sets>
+      <ThemeBoneColorSet active="#f70a0a"
+                         show_colored_constraints="FALSE"
+                         normal="#9a0000"
+                         select="#bd1111">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#fa9900"
+                         show_colored_constraints="FALSE"
+                         normal="#f74018"
+                         select="#f66913">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#83ef1d"
+                         show_colored_constraints="FALSE"
+                         normal="#1e9109"
+                         select="#59b70b">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#5ec1ef"
+                         show_colored_constraints="FALSE"
+                         normal="#0a3694"
+                         select="#3667df">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#f05d91"
+                         show_colored_constraints="FALSE"
+                         normal="#a9294e"
+                         select="#c1416a">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#8764d5"
+                         show_colored_constraints="FALSE"
+                         normal="#430c78"
+                         select="#543aa3">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#6fb6ab"
+                         show_colored_constraints="FALSE"
+                         normal="#24785a"
+                         select="#3c9579">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#9bc2cd"
+                         show_colored_constraints="FALSE"
+                         normal="#4b707c"
+                         select="#6a8691">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#f3ff00"
+                         show_colored_constraints="FALSE"
+                         normal="#f4c90c"
+                         select="#eec236">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#ffffff"
+                         show_colored_constraints="FALSE"
+                         normal="#1e2024"
+                         select="#484c56">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#d330d6"
+                         show_colored_constraints="FALSE"
+                         normal="#6f2f6a"
+                         select="#9845be">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#bbef5b"
+                         show_colored_constraints="FALSE"
+                         normal="#6c8e22"
+                         select="#7fb022">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#dedede"
+                         show_colored_constraints="FALSE"
+                         normal="#8d8d8d"
+                         select="#b0b0b0">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#bd6a11"
+                         show_colored_constraints="FALSE"
+                         normal="#834326"
+                         select="#8b5811">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#34622b"
+                         show_colored_constraints="FALSE"
+                         normal="#08310e"
+                         select="#1c430b">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+    </bone_color_sets>
+  </Theme>
+</bpy>
diff --git a/release/scripts/addons_contrib/presets/interface_theme/softdefault.xml b/release/scripts/addons_contrib/presets/interface_theme/softdefault.xml
new file mode 100644
index 0000000..9a2e639
--- /dev/null
+++ b/release/scripts/addons_contrib/presets/interface_theme/softdefault.xml
@@ -0,0 +1,828 @@
+<bpy>
+  <Theme>
+    <view_3d>
+      <ThemeView3D object_active="#ffffff"
+                   editmesh_active="#ffffff72"
+                   act_spline="#db2512"
+                   handle_align="#803060"
+                   handle_sel_align="#f090a0"
+                   handle_auto="#909000"
+                   handle_sel_auto="#f0ff40"
+                   bone_pose="#50c8ff"
+                   bone_solid="#c8c8c8"
+                   bundle_solid="#c8c8c8"
+                   camera="#000000"
+                   camera_path="#000000"
+                   frame_current="#60c040"
+                   edge_crease="#cc57b4"
+                   extra_edge_len="#200000"
+                   edge_seam="#db5c3d"
+                   edge_select="#e3e3e3"
+                   edge_sharp="#3a9fff"
+                   edge_facesel="#4b4b4b"
+                   empty="#000000"
+                   face="#00000058"
+                   extra_face_angle="#002000"
+                   extra_face_area="#000080"
+                   face_dot="#9bff61"
+                   facedot_size="3"
+                   normal="#22dddd"
+                   face_select="#0000003c"
+                   handle_free="#000000"
+                   handle_sel_free="#000000"
+                   grid="#555555"
+                   lamp="#e3d45966"
+                   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="#ffffff"
+                   outline_width="1"
+                   panel="#a5a5a57f"
+                   speaker="#5c6db2"
+                   transform="#ffffff"
+                   handle_vect="#409030"
+                   handle_sel_vect="#40c030"
+                   vertex="#000000"
+                   vertex_normal="#2361dd"
+                   vertex_select="#ff6424"
+                   vertex_size="3"
+                   wire="#000000">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#404040">
+          </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">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#393939">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeClipEditor>
+    </clip_editor>
+    <console>
+      <ThemeConsole cursor="#8bdc66"
+                    line_error="#dc6060"
+                    line_info="#e4e585"
+                    line_input="#ffffff"
+                    line_output="#6080ff">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#000000">
+          </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="#5e5e5e"
+                      long_key="#0c0a0a"
+                      long_key_selected="#ff8c00"
+                      value_sliders="#000000"
+                      view_sliders="#969696">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#6b6b6b">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#666666"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeDopeSheet>
+    </dopesheet_editor>
+    <file_browser>
+      <ThemeFileBrowser active_file="#727272"
+                        active_file_text="#fafafa"
+                        scroll_handle="#7f7979"
+                        scrollbar="#a0a0a0"
+                        selected_file="#1e1e1e"
+                        tiles="#727272">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#fafafa"
+                             text_hi="#0f0f0f"
+                             title="#000000"
+                             back="#4c4c4c">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#666666"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </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="#ffffff"
+                        handle_auto_clamped="#994030"
+                        handle_sel_auto_clamped="#f0af90"
+                        channel_group="#8686b0"
+                        channels_region="#707070"
+                        frame_current="#7ec068"
+                        dopesheet_channel="#76879c"
+                        dopesheet_subchannel="#8699b0"
+                        handle_free="#ffffff"
+                        handle_sel_free="#000000"
+                        grid="#5e5e5e"
+                        handle_vertex="#000000"
+                        handle_vertex_select="#ffffff"
+                        handle_vertex_size="8"
+                        lastsel_point="#000000"
+                        panel="#ffffff"
+                        handle_vect="#409030"
+                        handle_sel_vect="#6ee854"
+                        vertex="#000000"
+                        vertex_select="#ffffff"
+                        vertex_size="5"
+                        window_sliders="#969696">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#6b6b6b">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#666666"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </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="#727272ff"
+                        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="#000000"
+                        vertex_select="#ff8500"
+                        vertex_size="3">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#353535">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeImageEditor>
+    </image_editor>
+    <info>
+      <ThemeInfo>
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#727272">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeInfo>
+    </info>
+    <logic_editor>
+      <ThemeLogicEditor panel="#a5a5a5">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#646464">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeLogicEditor>
+    </logic_editor>
+    <nla_editor>
+      <ThemeNLAEditor bars="#707070"
+                      bars_selected="#7ec068"
+                      frame_current="#7ec068"
+                      grid="#5e5e5e"
+                      strips="#0c0a0a"
+                      strips_selected="#ff8c00"
+                      view_sliders="#969696">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#6b6b6b">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#666666"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeNLAEditor>
+    </nla_editor>
+    <node_editor>
+      <ThemeNodeEditor converter_node="#b5b1ea"
+                       group_node="#d5ffa2"
+                       in_out_node="#b0cae0"
+                       node_backdrop="#858585ff"
+                       noodle_curving="5"
+                       operator_node="#ffa46c"
+                       selected_text="#ffffff"
+                       wire_select="#ffffff"
+                       wire="#000000">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#727272">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#a5a5a5"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeNodeEditor>
+    </node_editor>
+    <outliner>
+      <ThemeOutliner match="#337f33"
+                     selected_highlight="#82878c">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#727272">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeOutliner>
+    </outliner>
+    <properties>
+      <ThemeProperties panel="#828282">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#727272">
+          </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"
+                           plugin_strip="#7e7e50"
+                           preview_back="#000000"
+                           scene_strip="#4e983e"
+                           transition_strip="#a25f6f"
+                           window_sliders="#a0a0a0">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#747474">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeSequenceEditor>
+    </sequence_editor>
+    <text_editor>
+      <ThemeTextEditor cursor="#afff80"
+                       syntax_special="#92da66"
+                       line_numbers_background="#7c7c7c"
+                       selected_text="#bdbd8d"
+                       syntax_builtin="#ff5353"
+                       syntax_comment="#ffffff"
+                       syntax_numbers="#7dc8c8"
+                       syntax_string="#f7f185">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#727272">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTextEditor>
+    </text_editor>
+    <timeline>
+      <ThemeTimeline frame_current="#7ec068"
+                     grid="#565656">
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#727272">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTimeline>
+    </timeline>
+    <user_interface>
+      <ThemeUserInterface icon_alpha="1"
+                          icon_file="">
+        <wcol_box>
+          <ThemeWidgetColors inner="#6c6c6cff"
+                             inner_sel="#6c6c6cff"
+                             item="#4a4a4aff"
+                             outline="#646464"
+                             shadedown="0"
+                             shadetop="0"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_box>
+        <wcol_list_item>
+          <ThemeWidgetColors inner="#00000000"
+                             inner_sel="#6b8cafff"
+                             item="#000000ff"
+                             outline="#000000"
+                             shadedown="0"
+                             shadetop="0"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_list_item>
+        <wcol_menu_back>
+          <ThemeWidgetColors inner="#727272ff"
+                             inner_sel="#2d2d2de6"
+                             item="#646464ff"
+                             outline="#505050"
+                             shadedown="-20"
+                             shadetop="25"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#ececec">
+          </ThemeWidgetColors>
+        </wcol_menu_back>
+        <wcol_menu_item>
+          <ThemeWidgetColors inner="#00000000"
+                             inner_sel="#727272ff"
+                             item="#ffffffff"
+                             outline="#727272"
+                             shadedown="5"
+                             shadetop="-8"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_menu_item>
+        <wcol_menu>
+          <ThemeWidgetColors inner="#727272ff"
+                             inner_sel="#6c6c6cff"
+                             item="#464646ff"
+                             outline="#606060"
+                             shadedown="5"
+                             shadetop="-5"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             text_sel="#f5f5f5">
+          </ThemeWidgetColors>
+        </wcol_menu>
+        <wcol_num>
+          <ThemeWidgetColors inner="#595959ff"
+                             inner_sel="#444444ff"
+                             item="#3b3b3bff"
+                             outline="#606060"
+                             shadedown="5"
+                             shadetop="-5"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_num>
+        <wcol_option>
+          <ThemeWidgetColors inner="#727272ff"
+                             inner_sel="#838383ff"
+                             item="#000000ff"
+                             outline="#646464"
+                             shadedown="5"
+                             shadetop="-5"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_option>
+        <panel>
+          <ThemePanelColors header="#00000008"
+                            show_header="TRUE">
+          </ThemePanelColors>
+        </panel>
+        <wcol_progress>
+          <ThemeWidgetColors inner="#758b69ff"
+                             inner_sel="#93af84ff"
+                             item="#93af84ff"
+                             outline="#727272"
+                             shadedown="-5"
+                             shadetop="5"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_progress>
+        <wcol_pulldown>
+          <ThemeWidgetColors inner="#3f3f3fff"
+                             inner_sel="#727272ff"
+                             item="#000000ff"
+                             outline="#606060"
+                             shadedown="-5"
+                             shadetop="5"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_pulldown>
+        <wcol_radio>
+          <ThemeWidgetColors inner="#6c6c6cff"
+                             inner_sel="#6b8cafff"
+                             item="#ffffffff"
+                             outline="#646464"
+                             shadedown="5"
+                             shadetop="-5"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_radio>
+        <wcol_regular>
+          <ThemeWidgetColors inner="#999999ff"
+                             inner_sel="#646464ff"
+                             item="#191919ff"
+                             outline="#000000"
+                             shadedown="0"
+                             shadetop="0"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_regular>
+        <wcol_scroll>
+          <ThemeWidgetColors inner="#727272ff"
+                             inner_sel="#646464ff"
+                             item="#626262ff"
+                             outline="#6a6a6a"
+                             shadedown="-5"
+                             shadetop="5"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_scroll>
+        <wcol_numslider>
+          <ThemeWidgetColors inner="#595959ff"
+                             inner_sel="#595959ff"
+                             item="#494949ff"
+                             outline="#606060"
+                             shadedown="0"
+                             shadetop="-20"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_numslider>
+        <wcol_state>
+          <ThemeWidgetStateColors inner_anim="#98cc7e"
+                                  inner_anim_sel="#5aa633"
+                                  blend="0.5"
+                                  inner_driven="#cf5bff"
+                                  inner_driven_sel="#ac45d7"
+                                  inner_key="#f0ec75"
+                                  inner_key_sel="#d7d34b">
+          </ThemeWidgetStateColors>
+        </wcol_state>
+        <wcol_text>
+          <ThemeWidgetColors inner="#727272ff"
+                             inner_sel="#dbcc6fff"
+                             item="#91874aff"
+                             outline="#646464"
+                             shadedown="5"
+                             shadetop="-5"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_text>
+        <wcol_toggle>
+          <ThemeWidgetColors inner="#727272ff"
+                             inner_sel="#6b8cafff"
+                             item="#000000ff"
+                             outline="#646464"
+                             shadedown="5"
+                             shadetop="-5"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_toggle>
+        <wcol_tool>
+          <ThemeWidgetColors inner="#727272ff"
+                             inner_sel="#646464ff"
+                             item="#191919ff"
+                             outline="#646464"
+                             shadedown="5"
+                             shadetop="-5"
+                             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>
+        <space>
+          <ThemeSpaceGeneric header="#727272"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#000000"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#727272">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeUserPreferences>
+    </user_preferences>
+    <bone_color_sets>
+      <ThemeBoneColorSet active="#f70a0a"
+                         show_colored_constraints="FALSE"
+                         normal="#9a0000"
+                         select="#bd1111">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#fa9900"
+                         show_colored_constraints="FALSE"
+                         normal="#f74018"
+                         select="#f66913">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#83ef1d"
+                         show_colored_constraints="FALSE"
+                         normal="#1e9109"
+                         select="#59b70b">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#5ec1ef"
+                         show_colored_constraints="FALSE"
+                         normal="#0a3694"
+                         select="#3667df">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#f05d91"
+                         show_colored_constraints="FALSE"
+                         normal="#a9294e"
+                         select="#c1416a">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#8764d5"
+                         show_colored_constraints="FALSE"
+                         normal="#430c78"
+                         select="#543aa3">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#6fb6ab"
+                         show_colored_constraints="FALSE"
+                         normal="#24785a"
+                         select="#3c9579">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#9bc2cd"
+                         show_colored_constraints="FALSE"
+                         normal="#4b707c"
+                         select="#6a8691">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#f3ff00"
+                         show_colored_constraints="FALSE"
+                         normal="#f4c90c"
+                         select="#eec236">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#ffffff"
+                         show_colored_constraints="FALSE"
+                         normal="#1e2024"
+                         select="#484c56">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#d330d6"
+                         show_colored_constraints="FALSE"
+                         normal="#6f2f6a"
+                         select="#9845be">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#bbef5b"
+                         show_colored_constraints="FALSE"
+                         normal="#6c8e22"
+                         select="#7fb022">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#dedede"
+                         show_colored_constraints="FALSE"
+                         normal="#8d8d8d"
+                         select="#b0b0b0">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#bd6a11"
+                         show_colored_constraints="FALSE"
+                         normal="#834326"
+                         select="#8b5811">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#34622b"
+                         show_colored_constraints="FALSE"
+                         normal="#08310e"
+                         select="#1c430b">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+    </bone_color_sets>
+  </Theme>
+</bpy>
diff --git a/release/scripts/addons_contrib/presets/interface_theme/theme_3ds_max.xml b/release/scripts/addons_contrib/presets/interface_theme/theme_3ds_max.xml
deleted file mode 100644
index a928a82..0000000
--- a/release/scripts/addons_contrib/presets/interface_theme/theme_3ds_max.xml
+++ /dev/null
@@ -1,812 +0,0 @@
-<bpy>
-  <Theme>
-    <view_3d>
-      <ThemeView3D object_active="#ffffff"
-                   editmesh_active="#fcf8ff80"
-                   act_spline="#db2512"
-                   handle_align="#803060"
-                   handle_sel_align="#f090a0"
-                   handle_auto="#909000"
-                   handle_sel_auto="#f0ff40"
-                   bone_pose="#50c8ff"
-                   bone_solid="#c8c8c8"
-                   bundle_solid="#c8c8c8"
-                   camera_path="#000000"
-                   frame_current="#60c040"
-                   edge_crease="#cc0099"
-                   extra_edge_len="#200000"
-                   edge_seam="#e69632"
-                   edge_select="#ff3d3d"
-                   edge_sharp="#ff2020"
-                   edge_facesel="#4b4b4b"
-                   face="#a8a8a84d"
-                   extra_face_angle="#000080"
-                   extra_face_area="#002000"
-                   face_dot="#883737"
-                   facedot_size="2"
-                   normal="#22dddd"
-                   face_select="#ae606066"
-                   handle_free="#000000"
-                   handle_sel_free="#000000"
-                   grid="#505050"
-                   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="#fa3f00"
-                   outline_width="1"
-                   panel="#a5a5a5ff"
-                   speaker="#000000"
-                   transform="#ffffff"
-                   handle_vect="#409030"
-                   handle_sel_vect="#40c030"
-                   vertex="#5454f0"
-                   vertex_normal="#2361dd"
-                   vertex_select="#ae6060"
-                   vertex_size="3"
-                   wire="#000000">
-        <space>
-          <ThemeSpaceGeneric header="#b4b4b4"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#b4b4b4"
-                             button_text="#494949"
-                             button_text_hi="#ffffff"
-                             button_title="#494949"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#737373">
-          </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">
-        <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="#737373">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeClipEditor>
-    </clip_editor>
-    <console>
-      <ThemeConsole cursor="#dc6060"
-                    line_error="#dc6060"
-                    line_info="#00aa00"
-                    line_input="#ffffff"
-                    line_output="#000000">
-        <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="#b4b4b4">
-          </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="#505050"
-                      long_key="#0c0a0a"
-                      long_key_selected="#ff8c00"
-                      value_sliders="#000000"
-                      view_sliders="#969696">
-        <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="#737373">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#b4b4b4"
-                                 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="#d7ae6d"
-                        tiles="#b4b4b4">
-        <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="#0f0f0f"
-                             title="#000000"
-                             back="#b4b4b4">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#b4b4b4"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </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="#505050"
-                        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">
-        <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="#737373">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#b4b4b4"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeGraphEditor>
-    </graph_editor>
-    <image_editor>
-      <ThemeImageEditor editmesh_active="#ffffff80"
-                        face="#ffffff0a"
-                        face_dot="#ff0000"
-                        facedot_size="3"
-                        face_select="#7c00003c"
-                        scope_back="#b4b4b4ff"
-                        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="#5454f0"
-                        vertex_select="#d00000"
-                        vertex_size="3">
-        <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>
-      </ThemeImageEditor>
-    </image_editor>
-    <info>
-      <ThemeInfo >
-        <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="#b4b4b4">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeInfo>
-    </info>
-    <logic_editor>
-      <ThemeLogicEditor panel="#a5a5a5">
-        <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="#b4b4b4">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeLogicEditor>
-    </logic_editor>
-    <nla_editor>
-      <ThemeNLAEditor bars="#707070"
-                      bars_selected="#60c040"
-                      frame_current="#60c040"
-                      grid="#5e5e5e"
-                      strips="#0c0a0a"
-                      strips_selected="#ff8c00"
-                      view_sliders="#969696">
-        <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="#b4b4b4"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeNLAEditor>
-    </nla_editor>
-    <node_editor>
-      <ThemeNodeEditor converter_node="#deaf66"
-                       group_node="#3c753c"
-                       in_out_node="#faa044"
-                       node_backdrop="#9b9b9ba0"
-                       noodle_curving="5"
-                       operator_node="#9e733e"
-                       selected_text="#7f7070"
-                       wire_select="#ffffff"
-                       wire="#000000">
-        <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="#737373">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#a5a5a5"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeNodeEditor>
-    </node_editor>
-    <outliner>
-      <ThemeOutliner >
-        <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="#fff1e1"
-                             title="#000000"
-                             back="#b4b4b4">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeOutliner>
-    </outliner>
-    <properties>
-      <ThemeProperties panel="#b4b4b4">
-        <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="#b4b4b4">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeProperties>
-    </properties>
-    <sequence_editor>
-      <ThemeSequenceEditor audio_strip="#2e8f8f"
-                           frame_current="#60c040"
-                           draw_action="#50c8ff"
-                           effect_strip="#a9547c"
-                           grid="#404040"
-                           image_strip="#6d5881"
-                           keyframe="#ff8500"
-                           meta_strip="#6d9183"
-                           movie_strip="#516987"
-                           plugin_strip="#7e7e50"
-                           scene_strip="#4e983e"
-                           transition_strip="#a25f6f"
-                           window_sliders="#a0a0a0">
-        <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="#949494">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeSequenceEditor>
-    </sequence_editor>
-    <text_editor>
-      <ThemeTextEditor cursor="#ff0000"
-                       line_numbers_background="#404040"
-                       scroll_bar="#8f8f8f"
-                       selected_text="#c67777"
-                       syntax_builtin="#800050"
-                       syntax_comment="#006432"
-                       syntax_numbers="#0000c8"
-                       syntax_special="#5f5f00"
-                       syntax_string="#640000">
-        <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="#d1d1d1">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeTextEditor>
-    </text_editor>
-    <timeline>
-      <ThemeTimeline frame_current="#60c040"
-                     grid="#505050">
-        <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="#999999">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeTimeline>
-    </timeline>
-    <user_interface>
-      <ThemeUserInterface icon_alpha="1"
-                          icon_file="">
-        <wcol_box>
-          <ThemeWidgetColors inner="#d1d1d1ff"
-                             inner_sel="#646464ff"
-                             item="#191919ff"
-                             outline="#191919"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_box>
-        <wcol_list_item>
-          <ThemeWidgetColors inner="#00000000"
-                             inner_sel="#d8c555aa"
-                             item="#000000ff"
-                             outline="#000000"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_list_item>
-        <wcol_menu_back>
-          <ThemeWidgetColors inner="#b4b4b4ff"
-                             inner_sel="#2d2d2dff"
-                             item="#646464ff"
-                             outline="#424242"
-                             shadedown="30"
-                             shadetop="0"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_menu_back>
-        <wcol_menu_item>
-          <ThemeWidgetColors inner="#00000000"
-                             inner_sel="#8897a4ff"
-                             item="#ffffffff"
-                             outline="#000000"
-                             shadedown="5"
-                             shadetop="-5"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_menu_item>
-        <wcol_menu>
-          <ThemeWidgetColors inner="#aeaeaeff"
-                             inner_sel="#464646ff"
-                             item="#6d8da6ff"
-                             outline="#464646"
-                             shadedown="-5"
-                             shadetop="15"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#cccccc">
-          </ThemeWidgetColors>
-        </wcol_menu>
-        <wcol_num>
-          <ThemeWidgetColors inner="#c4c4c4ff"
-                             inner_sel="#999999ff"
-                             item="#708faaff"
-                             outline="#708faa"
-                             shadedown="0"
-                             shadetop="-10"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_num>
-        <wcol_option>
-          <ThemeWidgetColors inner="#a2a2a2ff"
-                             inner_sel="#bbb8a3ff"
-                             item="#ffffffff"
-                             outline="#747474"
-                             shadedown="0"
-                             shadetop="10"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             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="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_progress>
-        <wcol_pulldown>
-          <ThemeWidgetColors inner="#3f3f3fff"
-                             inner_sel="#536a7e26"
-                             item="#ffffffff"
-                             outline="#000000"
-                             shadedown="-20"
-                             shadetop="25"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_pulldown>
-        <wcol_radio>
-          <ThemeWidgetColors inner="#c3c3c3ff"
-                             inner_sel="#ddae64ff"
-                             item="#ffffffff"
-                             outline="#708faa"
-                             shadedown="0"
-                             shadetop="10"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_radio>
-        <wcol_regular>
-          <ThemeWidgetColors inner="#999999ff"
-                             inner_sel="#646464ff"
-                             item="#191919ff"
-                             outline="#191919"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_regular>
-        <wcol_scroll>
-          <ThemeWidgetColors inner="#708faa26"
-                             inner_sel="#646464b4"
-                             item="#a9a9a9ff"
-                             outline="#708faa"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_scroll>
-        <wcol_numslider>
-          <ThemeWidgetColors inner="#b4b4b4ff"
-                             inner_sel="#999999ff"
-                             item="#c9c9c9ff"
-                             outline="#747474"
-                             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="#d1d1d1ff"
-                             inner_sel="#999999ff"
-                             item="#5a5a5aff"
-                             outline="#535353"
-                             shadedown="25"
-                             shadetop="0"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_text>
-        <wcol_toggle>
-          <ThemeWidgetColors inner="#d0d0d0ff"
-                             inner_sel="#64717dff"
-                             item="#191919ff"
-                             outline="#708faa"
-                             shadedown="0"
-                             shadetop="10"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_toggle>
-        <wcol_tool>
-          <ThemeWidgetColors inner="#c4c4c4ff"
-                             inner_sel="#646464ff"
-                             item="#191919ff"
-                             outline="#708faa"
-                             shadedown="0"
-                             shadetop="-10"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_tool>
-      </ThemeUserInterface>
-    </user_interface>
-    <user_preferences>
-      <ThemeUserPreferences >
-        <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="#b4b4b4">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeUserPreferences>
-    </user_preferences>
-    <bone_color_sets>
-      <ThemeBoneColorSet active="#f70a0a"
-                         show_colored_constraints="FALSE"
-                         normal="#9a0000"
-                         select="#bd1111">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#fa9900"
-                         show_colored_constraints="FALSE"
-                         normal="#f74018"
-                         select="#f66913">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#83ef1d"
-                         show_colored_constraints="FALSE"
-                         normal="#1e9109"
-                         select="#59b70b">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#5ec1ef"
-                         show_colored_constraints="FALSE"
-                         normal="#0a3694"
-                         select="#3667df">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f05d91"
-                         show_colored_constraints="FALSE"
-                         normal="#a9294e"
-                         select="#c1416a">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#8764d5"
-                         show_colored_constraints="FALSE"
-                         normal="#430c78"
-                         select="#543aa3">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#6fb6ab"
-                         show_colored_constraints="FALSE"
-                         normal="#24785a"
-                         select="#3c9579">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#9bc2cd"
-                         show_colored_constraints="FALSE"
-                         normal="#4b707c"
-                         select="#6a8691">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f3ff00"
-                         show_colored_constraints="FALSE"
-                         normal="#f4c90c"
-                         select="#eec236">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#ffffff"
-                         show_colored_constraints="FALSE"
-                         normal="#1e2024"
-                         select="#484c56">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#d330d6"
-                         show_colored_constraints="FALSE"
-                         normal="#6f2f6a"
-                         select="#9845be">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bbef5b"
-                         show_colored_constraints="FALSE"
-                         normal="#6c8e22"
-                         select="#7fb022">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#dedede"
-                         show_colored_constraints="FALSE"
-                         normal="#8d8d8d"
-                         select="#b0b0b0">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bd6a11"
-                         show_colored_constraints="FALSE"
-                         normal="#834326"
-                         select="#8b5811">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#34622b"
-                         show_colored_constraints="FALSE"
-                         normal="#08310e"
-                         select="#1c430b">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-    </bone_color_sets>
-  </Theme>
-</bpy>
diff --git a/release/scripts/addons_contrib/presets/interface_theme/theme_blender_25x.xml b/release/scripts/addons_contrib/presets/interface_theme/theme_blender_25x.xml
deleted file mode 100644
index 10b9acf..0000000
--- a/release/scripts/addons_contrib/presets/interface_theme/theme_blender_25x.xml
+++ /dev/null
@@ -1,806 +0,0 @@
-<bpy>
-  <Theme>
-    <view_3d>
-      <ThemeView3D object_active="#ffaa40"
-                   editmesh_active="#ffffff80"
-                   act_spline="#db2512"
-                   handle_align="#803060"
-                   handle_sel_align="#f090a0"
-                   handle_auto="#909000"
-                   handle_sel_auto="#f0ff40"
-                   bone_pose="#50c8ff"
-                   bone_solid="#c8c8c8"
-                   bundle_solid="#c8c8c8"
-                   camera_path="#000000"
-                   frame_current="#60c040"
-                   edge_crease="#cc0099"
-                   extra_edge_len="#200000"
-                   edge_seam="#db2512"
-                   edge_select="#ffa000"
-                   edge_sharp="#00ffff"
-                   edge_facesel="#4b4b4b"
-                   face="#00000012"
-                   extra_face_angle="#000080"
-                   extra_face_area="#002000"
-                   face_dot="#ff8500"
-                   facedot_size="4"
-                   normal="#22dddd"
-                   face_select="#ff85003c"
-                   handle_free="#000000"
-                   handle_sel_free="#000000"
-                   grid="#4d4d4d"
-                   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="#f15800"
-                   outline_width="1"
-                   panel="#a5a5a57f"
-                   speaker="#000000"
-                   transform="#ffffff"
-                   handle_vect="#409030"
-                   handle_sel_vect="#40c030"
-                   vertex="#4ca6e8"
-                   vertex_normal="#2361dd"
-                   vertex_select="#ff8500"
-                   vertex_size="3"
-                   wire="#000000">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#5d656d">
-          </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">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#393939">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeClipEditor>
-    </clip_editor>
-    <console>
-      <ThemeConsole cursor="#dc6060"
-                    line_error="#dc6060"
-                    line_info="#00aa00"
-                    line_input="#ffffff"
-                    line_output="#6080ff">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#000000">
-          </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="#5e5e5e"
-                      long_key="#0c0a0a"
-                      long_key_selected="#ff8c00"
-                      value_sliders="#000000"
-                      view_sliders="#969696">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#6b6b6b">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#666666"
-                                 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="#ff8c19"
-                        tiles="#919191">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#fafafa"
-                             text_hi="#0f0f0f"
-                             title="#000000"
-                             back="#4c4c4c">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#666666"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </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="#994030"
-                        handle_sel_auto_clamped="#f0af90"
-                        channel_group="#4f6549"
-                        channels_region="#707070"
-                        frame_current="#60c040"
-                        dopesheet_channel="#52606e"
-                        dopesheet_subchannel="#7c8996"
-                        handle_free="#000000"
-                        handle_sel_free="#000000"
-                        grid="#5e5e5e"
-                        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">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#6b6b6b">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#666666"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </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="#727272ff"
-                        vertex="#000000"
-                        vertex_select="#ff8500"
-                        vertex_size="3">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#353535">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeImageEditor>
-    </image_editor>
-    <info>
-      <ThemeInfo >
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#727272">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeInfo>
-    </info>
-    <logic_editor>
-      <ThemeLogicEditor panel="#a5a5a5">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#646464">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeLogicEditor>
-    </logic_editor>
-    <nla_editor>
-      <ThemeNLAEditor bars="#707070"
-                      bars_selected="#60c040"
-                      frame_current="#60c040"
-                      grid="#5e5e5e"
-                      strips="#0c0a0a"
-                      strips_selected="#ff8c00"
-                      view_sliders="#969696">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#6b6b6b">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#666666"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeNLAEditor>
-    </nla_editor>
-    <node_editor>
-      <ThemeNodeEditor converter_node="#686a75"
-                       group_node="#69756e"
-                       in_out_node="#646464"
-                       node_backdrop="#9b9b9ba0"
-                       noodle_curving="5"
-                       operator_node="#6c696f"
-                       selected_text="#7f7070"
-                       wire_select="#ffffff"
-                       wire="#000000">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             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="#a5a5a5"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeNodeEditor>
-    </node_editor>
-    <outliner>
-      <ThemeOutliner >
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#727272">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeOutliner>
-    </outliner>
-    <properties>
-      <ThemeProperties panel="#828282">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#727272">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeProperties>
-    </properties>
-    <sequence_editor>
-      <ThemeSequenceEditor audio_strip="#2e8f8f"
-                           frame_current="#60c040"
-                           draw_action="#50c8ff"
-                           effect_strip="#a9547c"
-                           grid="#404040"
-                           image_strip="#6d5881"
-                           keyframe="#ff8500"
-                           meta_strip="#6d9183"
-                           movie_strip="#516987"
-                           plugin_strip="#7e7e50"
-                           scene_strip="#4e983e"
-                           transition_strip="#a25f6f"
-                           window_sliders="#a0a0a0">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#747474">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeSequenceEditor>
-    </sequence_editor>
-    <text_editor>
-      <ThemeTextEditor cursor="#ff0000"
-                       line_numbers_background="#404040"
-                       scroll_bar="#8f8f8f"
-                       selected_text="#c67777"
-                       syntax_builtin="#800050"
-                       syntax_comment="#006432"
-                       syntax_numbers="#0000c8"
-                       syntax_special="#5f5f00"
-                       syntax_string="#640000">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#999999">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeTextEditor>
-    </text_editor>
-    <timeline>
-      <ThemeTimeline frame_current="#60c040"
-                     grid="#5b5b5b">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#727272">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeTimeline>
-    </timeline>
-    <user_interface>
-      <ThemeUserInterface icon_alpha="1"
-                          icon_file="">
-        <wcol_box>
-          <ThemeWidgetColors inner="#808080ff"
-                             inner_sel="#646464ff"
-                             item="#191919ff"
-                             outline="#3b3b3b"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_box>
-        <wcol_list_item>
-          <ThemeWidgetColors inner="#00000000"
-                             inner_sel="#5680c2ff"
-                             item="#000000ff"
-                             outline="#000000"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_list_item>
-        <wcol_menu_back>
-          <ThemeWidgetColors inner="#191919ff"
-                             inner_sel="#2d2d2dff"
-                             item="#646464ff"
-                             outline="#2d2d2d"
-                             shadedown="-20"
-                             shadetop="25"
-                             show_shaded="FALSE"
-                             text="#a0a0a0"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_menu_back>
-        <wcol_menu_item>
-          <ThemeWidgetColors inner="#00000000"
-                             inner_sel="#5680c2ff"
-                             item="#ffffffff"
-                             outline="#727272"
-                             shadedown="0"
-                             shadetop="38"
-                             show_shaded="FALSE"
-                             text="#ffffff"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_menu_item>
-        <wcol_menu>
-          <ThemeWidgetColors inner="#464646ff"
-                             inner_sel="#464646ff"
-                             item="#a5a5a5ff"
-                             outline="#727272"
-                             shadedown="0"
-                             shadetop="10"
-                             show_shaded="TRUE"
-                             text="#ffffff"
-                             text_sel="#cccccc">
-          </ThemeWidgetColors>
-        </wcol_menu>
-        <wcol_num>
-          <ThemeWidgetColors inner="#969696ff"
-                             inner_sel="#999999ff"
-                             item="#5a5a5aff"
-                             outline="#454545"
-                             shadedown="0"
-                             shadetop="10"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_num>
-        <wcol_option>
-          <ThemeWidgetColors inner="#616161ff"
-                             inner_sel="#464646ff"
-                             item="#ffffffff"
-                             outline="#404040"
-                             shadedown="0"
-                             shadetop="5"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             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="#5680c2ff"
-                             item="#ffffffff"
-                             outline="#727272"
-                             shadedown="-20"
-                             shadetop="25"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_pulldown>
-        <wcol_radio>
-          <ThemeWidgetColors inner="#464646ff"
-                             inner_sel="#5680c2ff"
-                             item="#ffffffff"
-                             outline="#868686"
-                             shadedown="0"
-                             shadetop="10"
-                             show_shaded="TRUE"
-                             text="#ffffff"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_radio>
-        <wcol_regular>
-          <ThemeWidgetColors inner="#999999ff"
-                             inner_sel="#646464ff"
-                             item="#191919ff"
-                             outline="#191919"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_regular>
-        <wcol_scroll>
-          <ThemeWidgetColors inner="#646464b4"
-                             inner_sel="#646464b4"
-                             item="#727272ff"
-                             outline="#555555"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_scroll>
-        <wcol_numslider>
-          <ThemeWidgetColors inner="#b4b4b4ff"
-                             inner_sel="#999999ff"
-                             item="#808080ff"
-                             outline="#454545"
-                             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="#999999ff"
-                             inner_sel="#999999ff"
-                             item="#5a5a5aff"
-                             outline="#454545"
-                             shadedown="25"
-                             shadetop="0"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_text>
-        <wcol_toggle>
-          <ThemeWidgetColors inner="#b4b4b4ff"
-                             inner_sel="#646464ff"
-                             item="#191919ff"
-                             outline="#454545"
-                             shadedown="0"
-                             shadetop="5"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_toggle>
-        <wcol_tool>
-          <ThemeWidgetColors inner="#969696ff"
-                             inner_sel="#646464ff"
-                             item="#191919ff"
-                             outline="#454545"
-                             shadedown="0"
-                             shadetop="10"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_tool>
-      </ThemeUserInterface>
-    </user_interface>
-    <user_preferences>
-      <ThemeUserPreferences >
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#727272">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeUserPreferences>
-    </user_preferences>
-    <bone_color_sets>
-      <ThemeBoneColorSet active="#f70a0a"
-                         show_colored_constraints="FALSE"
-                         normal="#9a0000"
-                         select="#bd1111">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#fa9900"
-                         show_colored_constraints="FALSE"
-                         normal="#f74018"
-                         select="#f66913">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#83ef1d"
-                         show_colored_constraints="FALSE"
-                         normal="#1e9109"
-                         select="#59b70b">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#5ec1ef"
-                         show_colored_constraints="FALSE"
-                         normal="#0a3694"
-                         select="#3667df">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f05d91"
-                         show_colored_constraints="FALSE"
-                         normal="#a9294e"
-                         select="#c1416a">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#8764d5"
-                         show_colored_constraints="FALSE"
-                         normal="#430c78"
-                         select="#543aa3">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#6fb6ab"
-                         show_colored_constraints="FALSE"
-                         normal="#24785a"
-                         select="#3c9579">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#9bc2cd"
-                         show_colored_constraints="FALSE"
-                         normal="#4b707c"
-                         select="#6a8691">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f3ff00"
-                         show_colored_constraints="FALSE"
-                         normal="#f4c90c"
-                         select="#eec236">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#ffffff"
-                         show_colored_constraints="FALSE"
-                         normal="#1e2024"
-                         select="#484c56">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#d330d6"
-                         show_colored_constraints="FALSE"
-                         normal="#6f2f6a"
-                         select="#9845be">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bbef5b"
-                         show_colored_constraints="FALSE"
-                         normal="#6c8e22"
-                         select="#7fb022">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#dedede"
-                         show_colored_constraints="FALSE"
-                         normal="#8d8d8d"
-                         select="#b0b0b0">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bd6a11"
-                         show_colored_constraints="FALSE"
-                         normal="#834326"
-                         select="#8b5811">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#34622b"
-                         show_colored_constraints="FALSE"
-                         normal="#08310e"
-                         select="#1c430b">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-    </bone_color_sets>
-  </Theme>
-</bpy>
diff --git a/release/scripts/addons_contrib/presets/interface_theme/theme_maya.xml b/release/scripts/addons_contrib/presets/interface_theme/theme_maya.xml
deleted file mode 100644
index 176c7ee..0000000
--- a/release/scripts/addons_contrib/presets/interface_theme/theme_maya.xml
+++ /dev/null
@@ -1,812 +0,0 @@
-<bpy>
-  <Theme>
-    <view_3d>
-      <ThemeView3D object_active="#43ffa3"
-                   editmesh_active="#ffffff80"
-                   act_spline="#db2512"
-                   handle_align="#803060"
-                   handle_sel_align="#f090a0"
-                   handle_auto="#909000"
-                   handle_sel_auto="#f0ff40"
-                   bone_pose="#50c8ff"
-                   bone_solid="#c8c8c8"
-                   bundle_solid="#c8c8c8"
-                   camera_path="#000000"
-                   frame_current="#60c040"
-                   edge_crease="#cc0099"
-                   extra_edge_len="#200000"
-                   edge_seam="#db2512"
-                   edge_select="#ffa000"
-                   edge_sharp="#ff2020"
-                   edge_facesel="#4b4b4b"
-                   face="#00000012"
-                   extra_face_angle="#000080"
-                   extra_face_area="#002000"
-                   face_dot="#ff8500"
-                   facedot_size="4"
-                   normal="#22dddd"
-                   face_select="#ff85003c"
-                   handle_free="#000000"
-                   handle_sel_free="#000000"
-                   grid="#7f7f7f"
-                   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="#f15800"
-                   outline_width="1"
-                   panel="#a5a5a57f"
-                   speaker="#000000"
-                   transform="#ffffff"
-                   handle_vect="#409030"
-                   handle_sel_vect="#40c030"
-                   vertex="#cc1b23"
-                   vertex_normal="#2361dd"
-                   vertex_select="#ff8500"
-                   vertex_size="3"
-                   wire="#64dcff">
-        <space>
-          <ThemeSpaceGeneric header="#444444"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#444444"
-                             button_text="#ffffff"
-                             button_text_hi="#ffffff"
-                             button_title="#ffffff"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#576471">
-          </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">
-        <space>
-          <ThemeSpaceGeneric header="#3a3a3a"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#444444"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#576471">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeClipEditor>
-    </clip_editor>
-    <console>
-      <ThemeConsole cursor="#dc6060"
-                    line_error="#dc6060"
-                    line_info="#00aa00"
-                    line_input="#ffffff"
-                    line_output="#6080ff">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#000000">
-          </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="#5e5e5e"
-                      long_key="#0c0a0a"
-                      long_key_selected="#ff8c00"
-                      value_sliders="#000000"
-                      view_sliders="#969696">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#6b6b6b">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#666666"
-                                 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="#ff8c19"
-                        tiles="#919191">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#fafafa"
-                             text_hi="#0f0f0f"
-                             title="#000000"
-                             back="#4c4c4c">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#666666"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </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="#994030"
-                        handle_sel_auto_clamped="#f0af90"
-                        channel_group="#4f6549"
-                        channels_region="#707070"
-                        frame_current="#60c040"
-                        dopesheet_channel="#52606e"
-                        dopesheet_subchannel="#7c8996"
-                        handle_free="#000000"
-                        handle_sel_free="#000000"
-                        grid="#5e5e5e"
-                        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">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#6b6b6b">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#666666"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </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="#727272ff"
-                        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="#000000"
-                        vertex_select="#ff8500"
-                        vertex_size="3">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#353535">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeImageEditor>
-    </image_editor>
-    <info>
-      <ThemeInfo >
-        <space>
-          <ThemeSpaceGeneric header="#444444"
-                             header_text="#dddddd"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#727272">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeInfo>
-    </info>
-    <logic_editor>
-      <ThemeLogicEditor panel="#a5a5a5">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#646464">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeLogicEditor>
-    </logic_editor>
-    <nla_editor>
-      <ThemeNLAEditor bars="#707070"
-                      bars_selected="#60c040"
-                      frame_current="#60c040"
-                      grid="#5e5e5e"
-                      strips="#0c0a0a"
-                      strips_selected="#ff8c00"
-                      view_sliders="#969696">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#6b6b6b">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#666666"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeNLAEditor>
-    </nla_editor>
-    <node_editor>
-      <ThemeNodeEditor converter_node="#686a75"
-                       group_node="#69756e"
-                       in_out_node="#646464"
-                       node_backdrop="#9b9b9ba0"
-                       noodle_curving="5"
-                       operator_node="#6c696f"
-                       selected_text="#7f7070"
-                       wire_select="#ffffff"
-                       wire="#000000">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             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="#a5a5a5"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeNodeEditor>
-    </node_editor>
-    <outliner>
-      <ThemeOutliner >
-        <space>
-          <ThemeSpaceGeneric header="#444444"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#dddddd"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#444444">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeOutliner>
-    </outliner>
-    <properties>
-      <ThemeProperties panel="#828282">
-        <space>
-          <ThemeSpaceGeneric header="#444444"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#dddddd"
-                             text_hi="#ffffff"
-                             title="#dddddd"
-                             back="#444444">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeProperties>
-    </properties>
-    <sequence_editor>
-      <ThemeSequenceEditor audio_strip="#2e8f8f"
-                           frame_current="#60c040"
-                           draw_action="#50c8ff"
-                           effect_strip="#a9547c"
-                           grid="#404040"
-                           image_strip="#6d5881"
-                           keyframe="#ff8500"
-                           meta_strip="#6d9183"
-                           movie_strip="#516987"
-                           plugin_strip="#7e7e50"
-                           scene_strip="#4e983e"
-                           transition_strip="#a25f6f"
-                           window_sliders="#a0a0a0">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#747474">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeSequenceEditor>
-    </sequence_editor>
-    <text_editor>
-      <ThemeTextEditor cursor="#ff0000"
-                       line_numbers_background="#404040"
-                       scroll_bar="#8f8f8f"
-                       selected_text="#c67777"
-                       syntax_builtin="#800050"
-                       syntax_comment="#006432"
-                       syntax_numbers="#0000c8"
-                       syntax_special="#5f5f00"
-                       syntax_string="#640000">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#999999">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeTextEditor>
-    </text_editor>
-    <timeline>
-      <ThemeTimeline frame_current="#60c040"
-                     grid="#000000">
-        <space>
-          <ThemeSpaceGeneric header="#444444"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#737373">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeTimeline>
-    </timeline>
-    <user_interface>
-      <ThemeUserInterface icon_alpha="1"
-                          icon_file="">
-        <wcol_box>
-          <ThemeWidgetColors inner="#696969ff"
-                             inner_sel="#646464ff"
-                             item="#191919ff"
-                             outline="#191919"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_box>
-        <wcol_list_item>
-          <ThemeWidgetColors inner="#00000000"
-                             inner_sel="#5680c2ff"
-                             item="#000000ff"
-                             outline="#000000"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_list_item>
-        <wcol_menu_back>
-          <ThemeWidgetColors inner="#444444ff"
-                             inner_sel="#2d2d2de6"
-                             item="#646464ff"
-                             outline="#000000"
-                             shadedown="-20"
-                             shadetop="25"
-                             show_shaded="FALSE"
-                             text="#a0a0a0"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_menu_back>
-        <wcol_menu_item>
-          <ThemeWidgetColors inner="#00000000"
-                             inner_sel="#658aaeff"
-                             item="#ffffffff"
-                             outline="#000000"
-                             shadedown="0"
-                             shadetop="38"
-                             show_shaded="FALSE"
-                             text="#ffffff"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_menu_item>
-        <wcol_menu>
-          <ThemeWidgetColors inner="#777777ff"
-                             inner_sel="#464646ff"
-                             item="#ffffffff"
-                             outline="#000000"
-                             shadedown="-15"
-                             shadetop="15"
-                             show_shaded="FALSE"
-                             text="#ffffff"
-                             text_sel="#cccccc">
-          </ThemeWidgetColors>
-        </wcol_menu>
-        <wcol_num>
-          <ThemeWidgetColors inner="#222222ff"
-                             inner_sel="#999999ff"
-                             item="#5a5a5aff"
-                             outline="#525252"
-                             shadedown="0"
-                             shadetop="-20"
-                             show_shaded="FALSE"
-                             text="#ffffff"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_num>
-        <wcol_option>
-          <ThemeWidgetColors inner="#2b2b2bff"
-                             inner_sel="#464646ff"
-                             item="#ffffffff"
-                             outline="#000000"
-                             shadedown="-15"
-                             shadetop="15"
-                             show_shaded="FALSE"
-                             text="#888284"
-                             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="#656969ff"
-                             item="#ffffffff"
-                             outline="#000000"
-                             shadedown="-20"
-                             shadetop="25"
-                             show_shaded="FALSE"
-                             text="#dddddd"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_pulldown>
-        <wcol_radio>
-          <ThemeWidgetColors inner="#292929ff"
-                             inner_sel="#678db2ff"
-                             item="#ffffffff"
-                             outline="#000000"
-                             shadedown="-15"
-                             shadetop="15"
-                             show_shaded="FALSE"
-                             text="#ffffff"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_radio>
-        <wcol_regular>
-          <ThemeWidgetColors inner="#999999ff"
-                             inner_sel="#646464ff"
-                             item="#191919ff"
-                             outline="#191919"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_regular>
-        <wcol_scroll>
-          <ThemeWidgetColors inner="#505050b4"
-                             inner_sel="#646464b4"
-                             item="#808080ff"
-                             outline="#323232"
-                             shadedown="-5"
-                             shadetop="5"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_scroll>
-        <wcol_numslider>
-          <ThemeWidgetColors inner="#535353ff"
-                             inner_sel="#999999ff"
-                             item="#808080ff"
-                             outline="#191919"
-                             shadedown="0"
-                             shadetop="-20"
-                             show_shaded="FALSE"
-                             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="#131313ff"
-                             inner_sel="#333230ff"
-                             item="#678db2ff"
-                             outline="#191919"
-                             shadedown="25"
-                             shadetop="0"
-                             show_shaded="TRUE"
-                             text="#dddddd"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_text>
-        <wcol_toggle>
-          <ThemeWidgetColors inner="#999999ff"
-                             inner_sel="#646464ff"
-                             item="#191919ff"
-                             outline="#191919"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_toggle>
-        <wcol_tool>
-          <ThemeWidgetColors inner="#2c2c2cff"
-                             inner_sel="#646464ff"
-                             item="#191919ff"
-                             outline="#191919"
-                             shadedown="-15"
-                             shadetop="15"
-                             show_shaded="FALSE"
-                             text="#8f8f8f"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_tool>
-      </ThemeUserInterface>
-    </user_interface>
-    <user_preferences>
-      <ThemeUserPreferences >
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#444444">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeUserPreferences>
-    </user_preferences>
-    <bone_color_sets>
-      <ThemeBoneColorSet active="#f70a0a"
-                         show_colored_constraints="FALSE"
-                         normal="#9a0000"
-                         select="#bd1111">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#fa9900"
-                         show_colored_constraints="FALSE"
-                         normal="#f74018"
-                         select="#f66913">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#83ef1d"
-                         show_colored_constraints="FALSE"
-                         normal="#1e9109"
-                         select="#59b70b">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#5ec1ef"
-                         show_colored_constraints="FALSE"
-                         normal="#0a3694"
-                         select="#3667df">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f05d91"
-                         show_colored_constraints="FALSE"
-                         normal="#a9294e"
-                         select="#c1416a">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#8764d5"
-                         show_colored_constraints="FALSE"
-                         normal="#430c78"
-                         select="#543aa3">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#6fb6ab"
-                         show_colored_constraints="FALSE"
-                         normal="#24785a"
-                         select="#3c9579">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#9bc2cd"
-                         show_colored_constraints="FALSE"
-                         normal="#4b707c"
-                         select="#6a8691">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f3ff00"
-                         show_colored_constraints="FALSE"
-                         normal="#f4c90c"
-                         select="#eec236">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#ffffff"
-                         show_colored_constraints="FALSE"
-                         normal="#1e2024"
-                         select="#484c56">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#d330d6"
-                         show_colored_constraints="FALSE"
-                         normal="#6f2f6a"
-                         select="#9845be">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bbef5b"
-                         show_colored_constraints="FALSE"
-                         normal="#6c8e22"
-                         select="#7fb022">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#dedede"
-                         show_colored_constraints="FALSE"
-                         normal="#8d8d8d"
-                         select="#b0b0b0">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bd6a11"
-                         show_colored_constraints="FALSE"
-                         normal="#834326"
-                         select="#8b5811">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#34622b"
-                         show_colored_constraints="FALSE"
-                         normal="#08310e"
-                         select="#1c430b">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-    </bone_color_sets>
-  </Theme>
-</bpy>
diff --git a/release/scripts/addons_contrib/presets/interface_theme/theme_pinkified.xml b/release/scripts/addons_contrib/presets/interface_theme/theme_pinkified.xml
deleted file mode 100644
index 26a0f82..0000000
--- a/release/scripts/addons_contrib/presets/interface_theme/theme_pinkified.xml
+++ /dev/null
@@ -1,813 +0,0 @@
-<bpy>
-  <Theme>
-    <view_3d>
-      <ThemeView3D object_active="#ff0034"
-                   editmesh_active="#ff5edece"
-                   act_spline="#db2512"
-                   handle_align="#803060"
-                   handle_sel_align="#f090a0"
-                   handle_auto="#909000"
-                   handle_sel_auto="#f0ff40"
-                   bone_pose="#50c8ff"
-                   bone_solid="#424242"
-                   bundle_solid="#c8c8c8"
-                   camera_path="#a0a0a0"
-                   frame_current="#60c040"
-                   edge_crease="#cc0099"
-                   extra_edge_len="#200000"
-                   edge_seam="#ff0000"
-                   edge_select="#b30025"
-                   edge_sharp="#7bff00"
-                   edge_facesel="#4b4b4b"
-                   face="#ffffff0c"
-                   extra_face_angle="#008200"
-                   extra_face_area="#0000ff"
-                   face_dot="#ac0023"
-                   facedot_size="4"
-                   normal="#27ffff"
-                   face_select="#e8142f2c"
-                   handle_free="#000000"
-                   handle_sel_free="#000000"
-                   grid="#181818"
-                   lamp="#977f491e"
-                   lastsel_point="#f0ff40"
-                   nurb_uline="#909000"
-                   nurb_vline="#803060"
-                   nurb_sel_uline="#f0ff40"
-                   nurb_sel_vline="#f090a0"
-                   object_grouped="#127112"
-                   object_grouped_active="#55bb55"
-                   object_selected="#d1687d"
-                   outline_width="1"
-                   panel="#7575757f"
-                   speaker="#a63904"
-                   transform="#ffffff"
-                   handle_vect="#409030"
-                   handle_sel_vect="#40c030"
-                   vertex="#9a001f"
-                   vertex_normal="#2361dd"
-                   vertex_select="#ff0034"
-                   vertex_size="4"
-                   wire="#505050">
-        <space>
-          <ThemeSpaceGeneric header="#1a1a1a"
-                             header_text="#757575"
-                             header_text_hi="#ffffff"
-                             button="#161616"
-                             button_text="#6a6a6a"
-                             button_text_hi="#ffffff"
-                             button_title="#cccccc"
-                             text="#ffffff"
-                             text_hi="#ffffff"
-                             title="#c7c7c7"
-                             back="#111111">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeView3D>
-    </view_3d>
-    <clip_editor>
-      <ThemeClipEditor active_marker="#ffe6ea"
-                       frame_current="#60c040"
-                       disabled_marker="#7f0000"
-                       grid="#5e5e5e"
-                       handle_vertex="#000000"
-                       handle_vertex_select="#ffff00"
-                       handle_vertex_size="6"
-                       locked_marker="#7f7f7f"
-                       marker="#f68026"
-                       marker_outline="#3c3c3c"
-                       path_after="#007dff"
-                       path_before="#ff0b22"
-                       selected_marker="#ff2550">
-        <space>
-          <ThemeSpaceGeneric header="#232323"
-                             header_text="#aaaaaa"
-                             header_text_hi="#ffffff"
-                             button="#0b0b0b"
-                             button_text="#888888"
-                             button_text_hi="#ffffff"
-                             button_title="#adadad"
-                             text="#888888"
-                             text_hi="#ffffff"
-                             title="#6b6b6b"
-                             back="#232323">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeClipEditor>
-    </clip_editor>
-    <console>
-      <ThemeConsole cursor="#dc6060"
-                    line_error="#00df62"
-                    line_info="#ffd600"
-                    line_input="#a4a4a4"
-                    line_output="#ff336e">
-        <space>
-          <ThemeSpaceGeneric header="#1a1a1a"
-                             header_text="#ffffff"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#343434"
-                             button_text_hi="#ffffff"
-                             button_title="#ffffff"
-                             text="#828282"
-                             text_hi="#ffffff"
-                             title="#828282"
-                             back="#000000">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeConsole>
-    </console>
-    <dopesheet_editor>
-      <ThemeDopeSheet active_channels_group="#87b17d"
-                      channel_group="#4f6549"
-                      channels="#676767"
-                      channels_selected="#ff8099"
-                      frame_current="#99112c"
-                      dopesheet_channel="#39434d"
-                      dopesheet_subchannel="#15171a"
-                      grid="#0b0b0b"
-                      long_key="#0c0a0a"
-                      long_key_selected="#ff7500"
-                      value_sliders="#000000"
-                      view_sliders="#898989">
-        <space>
-          <ThemeSpaceGeneric header="#2a2a2a"
-                             header_text="#ffffff"
-                             header_text_hi="#ffffff"
-                             button="#2a2a2a"
-                             button_text="#636363"
-                             button_text_hi="#ffffff"
-                             button_title="#ffffff"
-                             text="#828282"
-                             text_hi="#ffffff"
-                             title="#ffffff"
-                             back="#2a2a2a">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#2a2a2a"
-                                 list_text="#b3b3b3"
-                                 list_text_hi="#ffffff"
-                                 list_title="#ffffff">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeDopeSheet>
-    </dopesheet_editor>
-    <file_browser>
-      <ThemeFileBrowser active_file="#ff004b"
-                        active_file_text="#ffffff"
-                        scroll_handle="#373737"
-                        scrollbar="#242424"
-                        selected_file="#88172d"
-                        tiles="#161616">
-        <space>
-          <ThemeSpaceGeneric header="#161616"
-                             header_text="#ffffff"
-                             header_text_hi="#ffffff"
-                             button="#161616"
-                             button_text="#dddddd"
-                             button_text_hi="#ffffff"
-                             button_title="#eaeaea"
-                             text="#fafafa"
-                             text_hi="#ffffff"
-                             title="#ffffff"
-                             back="#161616">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#181818"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#9b9b9b">
-          </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="#994030"
-                        handle_sel_auto_clamped="#f0af90"
-                        channel_group="#4f6549"
-                        channels_region="#707070"
-                        frame_current="#99112c"
-                        dopesheet_channel="#4c5966"
-                        dopesheet_subchannel="#7c8996"
-                        handle_free="#000000"
-                        handle_sel_free="#000000"
-                        grid="#1d1d1d"
-                        handle_vertex="#000000"
-                        handle_vertex_select="#ff004b"
-                        handle_vertex_size="3"
-                        lastsel_point="#000000"
-                        panel="#ffffff"
-                        handle_vect="#409030"
-                        handle_sel_vect="#40c030"
-                        vertex="#000000"
-                        vertex_select="#ff004b"
-                        vertex_size="3"
-                        window_sliders="#3b3b3b">
-        <space>
-          <ThemeSpaceGeneric header="#232323"
-                             header_text="#ffffff"
-                             header_text_hi="#ffffff"
-                             button="#232323"
-                             button_text="#757575"
-                             button_text_hi="#ffffff"
-                             button_title="#ffffff"
-                             text="#828282"
-                             text_hi="#ffffff"
-                             title="#ffffff"
-                             back="#232323">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#232323"
-                                 list_text="#cccccc"
-                                 list_text_hi="#ffffff"
-                                 list_title="#8d7878">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeGraphEditor>
-    </graph_editor>
-    <image_editor>
-      <ThemeImageEditor editmesh_active="#ffffff80"
-                        face="#ffffff0a"
-                        face_dot="#ff3d1d"
-                        facedot_size="3"
-                        face_select="#ff1d4a1a"
-                        scope_back="#0707075e"
-                        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="#f73c00"
-                        vertex_select="#df0041"
-                        vertex_size="3">
-        <space>
-          <ThemeSpaceGeneric header="#1a1a1a"
-                             header_text="#272727"
-                             header_text_hi="#ffffff"
-                             button="#070707"
-                             button_text="#bebebe"
-                             button_text_hi="#ffffff"
-                             button_title="#ffffff"
-                             text="#9c9c9c"
-                             text_hi="#ffffff"
-                             title="#ffffff"
-                             back="#1a1a1a">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeImageEditor>
-    </image_editor>
-    <info>
-      <ThemeInfo >
-        <space>
-          <ThemeSpaceGeneric header="#222222"
-                             header_text="#999999"
-                             header_text_hi="#cbcbcb"
-                             button="#161616"
-                             button_text="#0d0d0d"
-                             button_text_hi="#ffffff"
-                             button_title="#0d0d0d"
-                             text="#ffffff"
-                             text_hi="#ffffff"
-                             title="#ffffff"
-                             back="#090909">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeInfo>
-    </info>
-    <logic_editor>
-      <ThemeLogicEditor panel="#111111">
-        <space>
-          <ThemeSpaceGeneric header="#272727"
-                             header_text="#ffffff"
-                             header_text_hi="#ffffff"
-                             button="#111111"
-                             button_text="#ffffff"
-                             button_text_hi="#ffffff"
-                             button_title="#ffffff"
-                             text="#9d9d9d"
-                             text_hi="#ffffff"
-                             title="#ffffff"
-                             back="#272727">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeLogicEditor>
-    </logic_editor>
-    <nla_editor>
-      <ThemeNLAEditor bars="#707070"
-                      bars_selected="#60c040"
-                      frame_current="#99112c"
-                      grid="#5e5e5e"
-                      strips="#0c0a0a"
-                      strips_selected="#ff8c00"
-                      view_sliders="#969696">
-        <space>
-          <ThemeSpaceGeneric header="#1a1a1a"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#6b6b6b">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#666666"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeNLAEditor>
-    </nla_editor>
-    <node_editor>
-      <ThemeNodeEditor converter_node="#00465d"
-                       group_node="#26960e"
-                       in_out_node="#d9003a"
-                       node_backdrop="#454545ae"
-                       noodle_curving="5"
-                       operator_node="#d87200"
-                       selected_text="#ffdddd"
-                       wire_select="#ffe500"
-                       wire="#ff0000">
-        <space>
-          <ThemeSpaceGeneric header="#111111"
-                             header_text="#ffffff"
-                             header_text_hi="#ffffff"
-                             button="#0c0c0c"
-                             button_text="#bebebe"
-                             button_text_hi="#ffffff"
-                             button_title="#ffffff"
-                             text="#ffffff"
-                             text_hi="#565656"
-                             title="#ffffff"
-                             back="#111111">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#a5a5a5"
-                                 list_text="#343434"
-                                 list_text_hi="#ffffff"
-                                 list_title="#ffffff">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeNodeEditor>
-    </node_editor>
-    <outliner>
-      <ThemeOutliner match="#337f33"
-                     selected_highlight="#870027">
-        <space>
-          <ThemeSpaceGeneric header="#232323"
-                             header_text="#ffffff"
-                             header_text_hi="#ffffff"
-                             button="#585858"
-                             button_text="#8f8f8f"
-                             button_text_hi="#ffffff"
-                             button_title="#ffffff"
-                             text="#939393"
-                             text_hi="#ffffff"
-                             title="#ffffff"
-                             back="#232323">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeOutliner>
-    </outliner>
-    <properties>
-      <ThemeProperties panel="#131313">
-        <space>
-          <ThemeSpaceGeneric header="#1a1a1a"
-                             header_text="#757575"
-                             header_text_hi="#ffffff"
-                             button="#1e1e1e"
-                             button_text="#4e4e4e"
-                             button_text_hi="#ffffff"
-                             button_title="#414141"
-                             text="#999999"
-                             text_hi="#ffffff"
-                             title="#aeaeae"
-                             back="#1a1a1a">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeProperties>
-    </properties>
-    <sequence_editor>
-      <ThemeSequenceEditor audio_strip="#2e8f8f"
-                           frame_current="#99112c"
-                           draw_action="#50c8ff"
-                           effect_strip="#e270a6"
-                           grid="#414141"
-                           image_strip="#675379"
-                           keyframe="#ff9f00"
-                           meta_strip="#6d9183"
-                           movie_strip="#516987"
-                           plugin_strip="#7e7e50"
-                           scene_strip="#4e983e"
-                           transition_strip="#b33d59"
-                           window_sliders="#6d6d6d">
-        <space>
-          <ThemeSpaceGeneric header="#171717"
-                             header_text="#ffffff"
-                             header_text_hi="#ffffff"
-                             button="#171717"
-                             button_text="#979797"
-                             button_text_hi="#ffffff"
-                             button_title="#ffffff"
-                             text="#757575"
-                             text_hi="#ffffff"
-                             title="#ffffff"
-                             back="#171717">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeSequenceEditor>
-    </sequence_editor>
-    <text_editor>
-      <ThemeTextEditor cursor="#ffffff"
-                       line_numbers_background="#0a0a0a"
-                       scroll_bar="#000000"
-                       selected_text="#561423"
-                       syntax_builtin="#ff009a"
-                       syntax_comment="#00ff7a"
-                       syntax_numbers="#0088ff"
-                       syntax_special="#ffff00"
-                       syntax_string="#f20000">
-        <space>
-          <ThemeSpaceGeneric header="#1a1a1a"
-                             header_text="#f2f2f2"
-                             header_text_hi="#ffffff"
-                             button="#1a1a1a"
-                             button_text="#ffffff"
-                             button_text_hi="#ffffff"
-                             button_title="#d0d0d0"
-                             text="#a9a9a9"
-                             text_hi="#ffffff"
-                             title="#ffffff"
-                             back="#050505">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeTextEditor>
-    </text_editor>
-    <timeline>
-      <ThemeTimeline frame_current="#ff1d4a"
-                     grid="#343434">
-        <space>
-          <ThemeSpaceGeneric header="#232323"
-                             header_text="#828282"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#0d0d0d"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#757575"
-                             text_hi="#ffffff"
-                             title="#757575"
-                             back="#232323">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeTimeline>
-    </timeline>
-    <user_interface>
-      <ThemeUserInterface icon_alpha="1"
-                          icon_file="">
-        <wcol_box>
-          <ThemeWidgetColors inner="#00000066"
-                             inner_sel="#ff1d4aff"
-                             item="#ffffffff"
-                             outline="#343434"
-                             shadedown="-5"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#999999"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_box>
-        <wcol_list_item>
-          <ThemeWidgetColors inner="#c69e9e00"
-                             inner_sel="#4d262eff"
-                             item="#ffffffff"
-                             outline="#4e4e4e"
-                             shadedown="0"
-                             shadetop="-12"
-                             show_shaded="TRUE"
-                             text="#ffffff"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_list_item>
-        <wcol_menu_back>
-          <ThemeWidgetColors inner="#0c0c0cd0"
-                             inner_sel="#414141ff"
-                             item="#232323ff"
-                             outline="#3f3e3e"
-                             shadedown="-20"
-                             shadetop="4"
-                             show_shaded="FALSE"
-                             text="#a0a0a0"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_menu_back>
-        <wcol_menu_item>
-          <ThemeWidgetColors inner="#0c0c0c4e"
-                             inner_sel="#ff1d4aff"
-                             item="#ffffffff"
-                             outline="#222222"
-                             shadedown="0"
-                             shadetop="8"
-                             show_shaded="TRUE"
-                             text="#ffffff"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_menu_item>
-        <wcol_menu>
-          <ThemeWidgetColors inner="#2a2a2aff"
-                             inner_sel="#ff1d4aff"
-                             item="#000000ff"
-                             outline="#343434"
-                             shadedown="0"
-                             shadetop="12"
-                             show_shaded="TRUE"
-                             text="#dddddd"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_menu>
-        <wcol_num>
-          <ThemeWidgetColors inner="#0c0c0cff"
-                             inner_sel="#ff1d4aff"
-                             item="#5a5a5aff"
-                             outline="#343434"
-                             shadedown="-5"
-                             shadetop="9"
-                             show_shaded="TRUE"
-                             text="#757575"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_num>
-        <wcol_option>
-          <ThemeWidgetColors inner="#1b1b1bff"
-                             inner_sel="#000000ff"
-                             item="#ff002eff"
-                             outline="#000000"
-                             shadedown="0"
-                             shadetop="-14"
-                             show_shaded="TRUE"
-                             text="#808080"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_option>
-        <panel>
-          <ThemePanelColors header="#00000000"
-                            show_header="FALSE">
-          </ThemePanelColors>
-        </panel>
-        <wcol_progress>
-          <ThemeWidgetColors inner="#000000ff"
-                             inner_sel="#686868ff"
-                             item="#be0037ff"
-                             outline="#5d001a"
-                             shadedown="-88"
-                             shadetop="100"
-                             show_shaded="FALSE"
-                             text="#ffffff"
-                             text_sel="#ff1d4a">
-          </ThemeWidgetColors>
-        </wcol_progress>
-        <wcol_pulldown>
-          <ThemeWidgetColors inner="#0c0c0cff"
-                             inner_sel="#ff1d4aff"
-                             item="#ffffffff"
-                             outline="#000000"
-                             shadedown="-20"
-                             shadetop="25"
-                             show_shaded="FALSE"
-                             text="#b6b6b6"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_pulldown>
-        <wcol_radio>
-          <ThemeWidgetColors inner="#0c0c0cff"
-                             inner_sel="#ff1d4aff"
-                             item="#ffffffff"
-                             outline="#343434"
-                             shadedown="2"
-                             shadetop="6"
-                             show_shaded="TRUE"
-                             text="#b1b1b1"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_radio>
-        <wcol_regular>
-          <ThemeWidgetColors inner="#0c0c0cff"
-                             inner_sel="#ff1d4aff"
-                             item="#191919ff"
-                             outline="#191919"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#ffffff"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_regular>
-        <wcol_scroll>
-          <ThemeWidgetColors inner="#00000080"
-                             inner_sel="#000000ff"
-                             item="#4d4d4d33"
-                             outline="#111111"
-                             shadedown="12"
-                             shadetop="12"
-                             show_shaded="TRUE"
-                             text="#bababa"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_scroll>
-        <wcol_numslider>
-          <ThemeWidgetColors inner="#33141bff"
-                             inner_sel="#ff1d4aff"
-                             item="#800f26ff"
-                             outline="#343434"
-                             shadedown="0"
-                             shadetop="-16"
-                             show_shaded="TRUE"
-                             text="#f7f7f7"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_numslider>
-        <wcol_state>
-          <ThemeWidgetStateColors inner_anim="#194a00"
-                                  inner_anim_sel="#287700"
-                                  blend="1"
-                                  inner_driven="#b566ff"
-                                  inner_driven_sel="#ce99ff"
-                                  inner_key="#ffdf44"
-                                  inner_key_sel="#b39400">
-          </ThemeWidgetStateColors>
-        </wcol_state>
-        <wcol_text>
-          <ThemeWidgetColors inner="#0d0d0dff"
-                             inner_sel="#ff1d4aff"
-                             item="#414141ff"
-                             outline="#1a1a1a"
-                             shadedown="3"
-                             shadetop="-59"
-                             show_shaded="TRUE"
-                             text="#686868"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_text>
-        <wcol_toggle>
-          <ThemeWidgetColors inner="#3e3e3eff"
-                             inner_sel="#ff1d4aff"
-                             item="#1a1a1aff"
-                             outline="#343434"
-                             shadedown="0"
-                             shadetop="27"
-                             show_shaded="TRUE"
-                             text="#ffffff"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_toggle>
-        <wcol_tool>
-          <ThemeWidgetColors inner="#4d4d4dff"
-                             inner_sel="#ff1d4aff"
-                             item="#ffffffff"
-                             outline="#676767"
-                             shadedown="-15"
-                             shadetop="-5"
-                             show_shaded="TRUE"
-                             text="#d8d8d8"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_tool>
-      </ThemeUserInterface>
-    </user_interface>
-    <user_preferences>
-      <ThemeUserPreferences >
-        <space>
-          <ThemeSpaceGeneric header="#1a1a1a"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#414141"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#686868"
-                             text_hi="#ffffff"
-                             title="#f2f2f2"
-                             back="#1a1a1a">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeUserPreferences>
-    </user_preferences>
-    <bone_color_sets>
-      <ThemeBoneColorSet active="#f70a0a"
-                         show_colored_constraints="FALSE"
-                         normal="#9a0000"
-                         select="#bd1111">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#fa9900"
-                         show_colored_constraints="FALSE"
-                         normal="#f74018"
-                         select="#f66913">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#83ef1d"
-                         show_colored_constraints="FALSE"
-                         normal="#1e9109"
-                         select="#59b70b">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#5ec1ef"
-                         show_colored_constraints="FALSE"
-                         normal="#0a3694"
-                         select="#3667df">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f05d91"
-                         show_colored_constraints="FALSE"
-                         normal="#a9294e"
-                         select="#c1416a">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#8764d5"
-                         show_colored_constraints="FALSE"
-                         normal="#430c78"
-                         select="#543aa3">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#6fb6ab"
-                         show_colored_constraints="FALSE"
-                         normal="#24785a"
-                         select="#3c9579">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#9bc2cd"
-                         show_colored_constraints="FALSE"
-                         normal="#4b707c"
-                         select="#6a8691">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f3ff00"
-                         show_colored_constraints="FALSE"
-                         normal="#f4c90c"
-                         select="#eec236">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#ffffff"
-                         show_colored_constraints="FALSE"
-                         normal="#1e2024"
-                         select="#484c56">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#d330d6"
-                         show_colored_constraints="FALSE"
-                         normal="#6f2f6a"
-                         select="#9845be">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bbef5b"
-                         show_colored_constraints="FALSE"
-                         normal="#6c8e22"
-                         select="#7fb022">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#dedede"
-                         show_colored_constraints="FALSE"
-                         normal="#8d8d8d"
-                         select="#b0b0b0">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bd6a11"
-                         show_colored_constraints="FALSE"
-                         normal="#834326"
-                         select="#8b5811">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#34622b"
-                         show_colored_constraints="FALSE"
-                         normal="#08310e"
-                         select="#1c430b">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-    </bone_color_sets>
-  </Theme>
-</bpy>
diff --git a/release/scripts/addons_contrib/presets/interface_theme/theme_softblend.xml b/release/scripts/addons_contrib/presets/interface_theme/theme_softblend.xml
deleted file mode 100644
index 1c97511..0000000
--- a/release/scripts/addons_contrib/presets/interface_theme/theme_softblend.xml
+++ /dev/null
@@ -1,812 +0,0 @@
-<bpy>
-  <Theme>
-    <view_3d>
-      <ThemeView3D object_active="#ffffff"
-                   editmesh_active="#ffffff00"
-                   act_spline="#c36c8c"
-                   handle_align="#e277b1"
-                   handle_sel_align="#ffffff"
-                   handle_auto="#30b6e5"
-                   handle_sel_auto="#ffffff"
-                   bone_pose="#50c8ff"
-                   bone_solid="#c8c8c8"
-                   bundle_solid="#c8c8c8"
-                   camera_path="#000000"
-                   frame_current="#53c03b"
-                   edge_crease="#eb3bdd"
-                   extra_edge_len="#200000"
-                   edge_seam="#f0703b"
-                   edge_select="#f3f3f3"
-                   edge_sharp="#49a1ec"
-                   edge_facesel="#272727"
-                   face="#838383ff"
-                   extra_face_angle="#cccccc"
-                   extra_face_area="#cccccc"
-                   face_dot="#52f27e"
-                   facedot_size="3"
-                   normal="#9cfcc8"
-                   face_select="#949494ff"
-                   handle_free="#cccccc"
-                   handle_sel_free="#ffffff"
-                   grid="#6e6e6e"
-                   lamp="#ffe56666"
-                   lastsel_point="#ffffff"
-                   nurb_uline="#a3a3a3"
-                   nurb_vline="#803060"
-                   nurb_sel_uline="#ffffff"
-                   nurb_sel_vline="#f090a0"
-                   object_grouped="#63bd87"
-                   object_grouped_active="#ffffff"
-                   object_selected="#88fca7"
-                   outline_width="1"
-                   panel="#aaa8a6ff"
-                   speaker="#000000"
-                   transform="#ffffff"
-                   handle_vect="#afafaf"
-                   handle_sel_vect="#ffffff"
-                   vertex="#343434"
-                   vertex_normal="#68a1db"
-                   vertex_select="#ff2f7a"
-                   vertex_size="4"
-                   wire="#242424">
-        <space>
-          <ThemeSpaceGeneric header="#aaa8a6"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#aaa8a6"
-                             button_text="#222222"
-                             button_text_hi="#ffffff"
-                             button_title="#313131"
-                             text="#ffffff"
-                             text_hi="#ffffff"
-                             title="#ffffff"
-                             back="#918f8d">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeView3D>
-    </view_3d>
-    <clip_editor>
-      <ThemeClipEditor active_marker="#ffffff"
-                       frame_current="#a3ff96"
-                       disabled_marker="#b54636"
-                       grid="#5e5e5e"
-                       handle_vertex="#000000"
-                       handle_vertex_select="#ff2f7a"
-                       handle_vertex_size="4"
-                       locked_marker="#7f7f7f"
-                       marker="#71cd7f"
-                       marker_outline="#000000"
-                       path_after="#5a7575"
-                       path_before="#22d8d1"
-                       selected_marker="#ff2f7a">
-        <space>
-          <ThemeSpaceGeneric header="#aaa8a6"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#aaa8a6"
-                             button_text="#222222"
-                             button_text_hi="#ffffff"
-                             button_title="#222222"
-                             text="#1a1a1a"
-                             text_hi="#ffffff"
-                             title="#1a1a1a"
-                             back="#aaa8a6">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeClipEditor>
-    </clip_editor>
-    <console>
-      <ThemeConsole cursor="#9cfcc8"
-                    line_error="#dc3a77"
-                    line_info="#00aa00"
-                    line_input="#ffffff"
-                    line_output="#6080ff">
-        <space>
-          <ThemeSpaceGeneric header="#aaa8a6"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#4d4d4d"
-                             button_text="#131313"
-                             button_text_hi="#ffffff"
-                             button_title="#131313"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#0c0c0c">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeConsole>
-    </console>
-    <dopesheet_editor>
-      <ThemeDopeSheet active_channels_group="#95adc1"
-                      channel_group="#8a9dac"
-                      channels="#9baeb9"
-                      channels_selected="#91ccb3"
-                      frame_current="#a3ff96"
-                      dopesheet_channel="#9baeb9"
-                      dopesheet_subchannel="#aaa8a6"
-                      grid="#7f7f7f"
-                      long_key="#0c0a0a"
-                      long_key_selected="#ecfc37"
-                      value_sliders="#000000"
-                      view_sliders="#333333">
-        <space>
-          <ThemeSpaceGeneric header="#aaa8a6"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#aaa8a6"
-                             button_text="#111111"
-                             button_text_hi="#a3a3a3"
-                             button_title="#111111"
-                             text="#222222"
-                             text_hi="#ffffff"
-                             title="#ffffff"
-                             back="#aaa8a6">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#aaa8a6"
-                                 list_text="#222222"
-                                 list_text_hi="#ffffff"
-                                 list_title="#cccccc">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeDopeSheet>
-    </dopesheet_editor>
-    <file_browser>
-      <ThemeFileBrowser active_file="#f1e593"
-                        active_file_text="#ffffff"
-                        scroll_handle="#8c8a88"
-                        scrollbar="#4d4b4d"
-                        selected_file="#f1e593"
-                        tiles="#aaa8a6">
-        <space>
-          <ThemeSpaceGeneric header="#aaa8a6"
-                             header_text="#afafaf"
-                             header_text_hi="#ffffff"
-                             button="#aaa8a6"
-                             button_text="#cccccc"
-                             button_text_hi="#ffffff"
-                             button_title="#222222"
-                             text="#222222"
-                             text_hi="#ffffff"
-                             title="#ffffff"
-                             back="#aaa8a6">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#aaa8a6"
-                                 list_text="#7f7f7f"
-                                 list_text_hi="#ffffff"
-                                 list_title="#3a3a3a">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeFileBrowser>
-    </file_browser>
-    <graph_editor>
-      <ThemeGraphEditor active_channels_group="#95adc1"
-                        handle_align="#1d1d1d"
-                        handle_sel_align="#f3f3f3"
-                        handle_auto="#696969"
-                        handle_sel_auto="#d4d4d4"
-                        handle_auto_clamped="#000000"
-                        handle_sel_auto_clamped="#000000"
-                        channel_group="#8a9dac"
-                        channels_region="#4d4d4d"
-                        frame_current="#a1ff8c"
-                        dopesheet_channel="#aaa8a6"
-                        dopesheet_subchannel="#aaa8a6"
-                        handle_free="#252525"
-                        handle_sel_free="#ececec"
-                        grid="#8f8f8f"
-                        handle_vertex="#525252"
-                        handle_vertex_select="#f1f1f1"
-                        handle_vertex_size="6"
-                        lastsel_point="#000000"
-                        panel="#989898"
-                        handle_vect="#191919"
-                        handle_sel_vect="#ffffff"
-                        vertex="#575757"
-                        vertex_select="#ffffff"
-                        vertex_size="3"
-                        window_sliders="#4d4d4d">
-        <space>
-          <ThemeSpaceGeneric header="#aaa8a6"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#aaa8a6"
-                             button_text="#222222"
-                             button_text_hi="#ffffff"
-                             button_title="#333333"
-                             text="#222222"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#aaa8a6">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#aaa8a6"
-                                 list_text="#222222"
-                                 list_text_hi="#ffffff"
-                                 list_title="#676767">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeGraphEditor>
-    </graph_editor>
-    <image_editor>
-      <ThemeImageEditor editmesh_active="#ffffff80"
-                        face="#00000032"
-                        face_dot="#ffffff"
-                        facedot_size="2"
-                        face_select="#ffffff3c"
-                        scope_back="#aaa8a6ff"
-                        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="#000000"
-                        vertex_select="#ffffff"
-                        vertex_size="3">
-        <space>
-          <ThemeSpaceGeneric header="#aaa8a6"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#aaa8a6"
-                             button_text="#222222"
-                             button_text_hi="#ffffff"
-                             button_title="#383838"
-                             text="#ffffff"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#2d2d2d">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeImageEditor>
-    </image_editor>
-    <info>
-      <ThemeInfo >
-        <space>
-          <ThemeSpaceGeneric header="#aaa8a6"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#aaa8a6"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#aaa8a6">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeInfo>
-    </info>
-    <logic_editor>
-      <ThemeLogicEditor panel="#aaa8a6">
-        <space>
-          <ThemeSpaceGeneric header="#aaa8a6"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#aaa8a6"
-                             button_text="#222222"
-                             button_text_hi="#ffffff"
-                             button_title="#111111"
-                             text="#222222"
-                             text_hi="#ffffff"
-                             title="#202020"
-                             back="#aaa8a6">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeLogicEditor>
-    </logic_editor>
-    <nla_editor>
-      <ThemeNLAEditor bars="#85c58f"
-                      bars_selected="#60c040"
-                      frame_current="#a3ff96"
-                      grid="#a39f9c"
-                      strips="#000000"
-                      strips_selected="#60c040"
-                      view_sliders="#4d4d4d">
-        <space>
-          <ThemeSpaceGeneric header="#aaa8a6"
-                             header_text="#a3a3a3"
-                             header_text_hi="#cccccc"
-                             button="#aaa8a6"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#333333"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#aaa8a6">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#aaa8a6"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeNLAEditor>
-    </nla_editor>
-    <node_editor>
-      <ThemeNodeEditor converter_node="#fffa90"
-                       group_node="#ffc173"
-                       in_out_node="#b1d9ff"
-                       node_backdrop="#d4d4d4ff"
-                       noodle_curving="5"
-                       operator_node="#beffcb"
-                       selected_text="#ffffff"
-                       wire_select="#ffffff"
-                       wire="#222222">
-        <space>
-          <ThemeSpaceGeneric header="#aaa8a6"
-                             header_text="#333333"
-                             header_text_hi="#ffffff"
-                             button="#aaa8a6"
-                             button_text="#222222"
-                             button_text_hi="#c5c5c5"
-                             button_title="#222222"
-                             text="#222222"
-                             text_hi="#ffffff"
-                             title="#a3a3a3"
-                             back="#aaa8a6">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#4d4d4d"
-                                 list_text="#676767"
-                                 list_text_hi="#ffffff"
-                                 list_title="#383838">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeNodeEditor>
-    </node_editor>
-    <outliner>
-      <ThemeOutliner >
-        <space>
-          <ThemeSpaceGeneric header="#aaa8a6"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#aaa8a6"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#0f0f0f"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#ffffff"
-                             back="#aaa8a6">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeOutliner>
-    </outliner>
-    <properties>
-      <ThemeProperties panel="#aaa8a6">
-        <space>
-          <ThemeSpaceGeneric header="#aaa8a6"
-                             header_text="#222222"
-                             header_text_hi="#000000"
-                             button="#aaa8a6"
-                             button_text="#222222"
-                             button_text_hi="#ffffff"
-                             button_title="#222222"
-                             text="#222222"
-                             text_hi="#ffffff"
-                             title="#222222"
-                             back="#aaa8a6">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeProperties>
-    </properties>
-    <sequence_editor>
-      <ThemeSequenceEditor audio_strip="#e0d2a0"
-                           frame_current="#a3ff96"
-                           draw_action="#50c8ff"
-                           effect_strip="#be8c76"
-                           grid="#afafaf"
-                           image_strip="#c99ac0"
-                           keyframe="#ffeb89"
-                           meta_strip="#91918d"
-                           movie_strip="#87a4c3"
-                           plugin_strip="#7e7e56"
-                           scene_strip="#91b1a0"
-                           transition_strip="#d9777a"
-                           window_sliders="#777777">
-        <space>
-          <ThemeSpaceGeneric header="#aaa8a6"
-                             header_text="#a3a3a3"
-                             header_text_hi="#ffffff"
-                             button="#aaa8a6"
-                             button_text="#111111"
-                             button_text_hi="#ffffff"
-                             button_title="#111111"
-                             text="#333333"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#aaa8a6">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeSequenceEditor>
-    </sequence_editor>
-    <text_editor>
-      <ThemeTextEditor cursor="#54da70"
-                       line_numbers_background="#a3a3a3"
-                       scroll_bar="#8f8f8f"
-                       selected_text="#f1e593"
-                       syntax_builtin="#3162b2"
-                       syntax_comment="#535353"
-                       syntax_numbers="#b62440"
-                       syntax_special="#ca0c97"
-                       syntax_string="#c31736">
-        <space>
-          <ThemeSpaceGeneric header="#aaa8a6"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#aaa8a6"
-                             button_text="#333333"
-                             button_text_hi="#ffffff"
-                             button_title="#222222"
-                             text="#222222"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#aaa8a6">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeTextEditor>
-    </text_editor>
-    <timeline>
-      <ThemeTimeline frame_current="#a3ff96"
-                     grid="#838383">
-        <space>
-          <ThemeSpaceGeneric header="#aaa8a6"
-                             header_text="#a3a3a3"
-                             header_text_hi="#ffffff"
-                             button="#aaa8a6"
-                             button_text="#222222"
-                             button_text_hi="#a3a3a3"
-                             button_title="#aeacaa"
-                             text="#222222"
-                             text_hi="#ffffff"
-                             title="#cccccc"
-                             back="#aaa8a6">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeTimeline>
-    </timeline>
-    <user_interface>
-      <ThemeUserInterface icon_alpha="1"
-                          icon_file="">
-        <wcol_box>
-          <ThemeWidgetColors inner="#aaa8a6ff"
-                             inner_sel="#aaa8a6ff"
-                             item="#ccccccff"
-                             outline="#9f9d9b"
-                             shadedown="6"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#474747"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_box>
-        <wcol_list_item>
-          <ThemeWidgetColors inner="#f1e59333"
-                             inner_sel="#fff29c9a"
-                             item="#ffffffff"
-                             outline="#8c8a88"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_list_item>
-        <wcol_menu_back>
-          <ThemeWidgetColors inner="#aaa8a6ff"
-                             inner_sel="#aaa8a6ff"
-                             item="#ccccccff"
-                             outline="#474747"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_menu_back>
-        <wcol_menu_item>
-          <ThemeWidgetColors inner="#00000000"
-                             inner_sel="#aaa8a6ff"
-                             item="#000000ff"
-                             outline="#474747"
-                             shadedown="10"
-                             shadetop="-10"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_menu_item>
-        <wcol_menu>
-          <ThemeWidgetColors inner="#aaa8a6ff"
-                             inner_sel="#b0aeacff"
-                             item="#8e8c8bff"
-                             outline="#aaa8a6"
-                             shadedown="3"
-                             shadetop="-4"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_menu>
-        <wcol_num>
-          <ThemeWidgetColors inner="#353432ff"
-                             inner_sel="#353432ff"
-                             item="#222222ff"
-                             outline="#050505"
-                             shadedown="5"
-                             shadetop="-5"
-                             show_shaded="FALSE"
-                             text="#efefef"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_num>
-        <wcol_option>
-          <ThemeWidgetColors inner="#a5a3a1ff"
-                             inner_sel="#ccc9c7ff"
-                             item="#000000ff"
-                             outline="#acaaa8"
-                             shadedown="0"
-                             shadetop="-2"
-                             show_shaded="TRUE"
-                             text="#676767"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_option>
-        <panel>
-          <ThemePanelColors header="#00000004"
-                            show_header="TRUE">
-          </ThemePanelColors>
-        </panel>
-        <wcol_progress>
-          <ThemeWidgetColors inner="#aaa8a6ff"
-                             inner_sel="#aaa8a6ff"
-                             item="#96c78eff"
-                             outline="#474747"
-                             shadedown="-3"
-                             shadetop="3"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_progress>
-        <wcol_pulldown>
-          <ThemeWidgetColors inner="#aaa8a6ff"
-                             inner_sel="#aaa8a6ff"
-                             item="#ccccccff"
-                             outline="#474747"
-                             shadedown="-20"
-                             shadetop="25"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_pulldown>
-        <wcol_radio>
-          <ThemeWidgetColors inner="#a8a6a4ff"
-                             inner_sel="#95adc1ff"
-                             item="#aaa8a6ff"
-                             outline="#aaa8a6"
-                             shadedown="1"
-                             shadetop="-2"
-                             show_shaded="TRUE"
-                             text="#1a1a1a"
-                             text_sel="#1a1a1a">
-          </ThemeWidgetColors>
-        </wcol_radio>
-        <wcol_regular>
-          <ThemeWidgetColors inner="#7b7978ff"
-                             inner_sel="#95adc1ff"
-                             item="#979594ff"
-                             outline="#5f5e5c"
-                             shadedown="0"
-                             shadetop="-2"
-                             show_shaded="TRUE"
-                             text="#1a1a1a"
-                             text_sel="#1a1a1a">
-          </ThemeWidgetColors>
-        </wcol_regular>
-        <wcol_scroll>
-          <ThemeWidgetColors inner="#a4a2a0ff"
-                             inner_sel="#aaa8a6ff"
-                             item="#a2a19fff"
-                             outline="#82807f"
-                             shadedown="-5"
-                             shadetop="4"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_scroll>
-        <wcol_numslider>
-          <ThemeWidgetColors inner="#353432ff"
-                             inner_sel="#353432ff"
-                             item="#1f1f1fff"
-                             outline="#050505"
-                             shadedown="5"
-                             shadetop="-5"
-                             show_shaded="FALSE"
-                             text="#ffffff"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_numslider>
-        <wcol_state>
-          <ThemeWidgetStateColors inner_anim="#adb4c7"
-                                  inner_anim_sel="#c4cee0"
-                                  blend="1"
-                                  inner_driven="#c69cb1"
-                                  inner_driven_sel="#ecaacd"
-                                  inner_key="#c0bb83"
-                                  inner_key_sel="#dad37d">
-          </ThemeWidgetStateColors>
-        </wcol_state>
-        <wcol_text>
-          <ThemeWidgetColors inner="#a6a4a2ff"
-                             inner_sel="#f1e593ff"
-                             item="#c2b876ff"
-                             outline="#aaa8a6"
-                             shadedown="0"
-                             shadetop="-2"
-                             show_shaded="TRUE"
-                             text="#242424"
-                             text_sel="#242424">
-          </ThemeWidgetColors>
-        </wcol_text>
-        <wcol_toggle>
-          <ThemeWidgetColors inner="#a8a6a4ff"
-                             inner_sel="#95adc1ff"
-                             item="#aaa8a6ff"
-                             outline="#aaa8a6"
-                             shadedown="0"
-                             shadetop="-3"
-                             show_shaded="TRUE"
-                             text="#1c1c1c"
-                             text_sel="#1a1a1a">
-          </ThemeWidgetColors>
-        </wcol_toggle>
-        <wcol_tool>
-          <ThemeWidgetColors inner="#aaa8a6ff"
-                             inner_sel="#a19f9dff"
-                             item="#a19f9dff"
-                             outline="#a6a4a2"
-                             shadedown="-6"
-                             shadetop="5"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_tool>
-      </ThemeUserInterface>
-    </user_interface>
-    <user_preferences>
-      <ThemeUserPreferences >
-        <space>
-          <ThemeSpaceGeneric header="#aaa8a6"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#aaa8a6"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#222222"
-                             text_hi="#ffffff"
-                             title="#222222"
-                             back="#aaa8a6">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeUserPreferences>
-    </user_preferences>
-    <bone_color_sets>
-      <ThemeBoneColorSet active="#f70a0a"
-                         show_colored_constraints="FALSE"
-                         normal="#9a0000"
-                         select="#bd1111">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#fa9900"
-                         show_colored_constraints="FALSE"
-                         normal="#f74018"
-                         select="#f66913">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#83ef1d"
-                         show_colored_constraints="FALSE"
-                         normal="#1e9109"
-                         select="#59b70b">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#5ec1ef"
-                         show_colored_constraints="FALSE"
-                         normal="#0a3694"
-                         select="#3667df">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f05d91"
-                         show_colored_constraints="FALSE"
-                         normal="#a9294e"
-                         select="#c1416a">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#8764d5"
-                         show_colored_constraints="FALSE"
-                         normal="#430c78"
-                         select="#543aa3">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#6fb6ab"
-                         show_colored_constraints="FALSE"
-                         normal="#24785a"
-                         select="#3c9579">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#9bc2cd"
-                         show_colored_constraints="FALSE"
-                         normal="#4b707c"
-                         select="#6a8691">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f3ff00"
-                         show_colored_constraints="FALSE"
-                         normal="#f4c90c"
-                         select="#eec236">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#ffffff"
-                         show_colored_constraints="FALSE"
-                         normal="#1e2024"
-                         select="#484c56">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#d330d6"
-                         show_colored_constraints="FALSE"
-                         normal="#6f2f6a"
-                         select="#9845be">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bbef5b"
-                         show_colored_constraints="FALSE"
-                         normal="#6c8e22"
-                         select="#7fb022">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#dedede"
-                         show_colored_constraints="FALSE"
-                         normal="#8d8d8d"
-                         select="#b0b0b0">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bd6a11"
-                         show_colored_constraints="FALSE"
-                         normal="#834326"
-                         select="#8b5811">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#34622b"
-                         show_colored_constraints="FALSE"
-                         normal="#08310e"
-                         select="#1c430b">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-    </bone_color_sets>
-  </Theme>
-</bpy>
diff --git a/release/scripts/addons_contrib/presets/interface_theme/theme_softdefault.xml b/release/scripts/addons_contrib/presets/interface_theme/theme_softdefault.xml
deleted file mode 100644
index 3814fc7..0000000
--- a/release/scripts/addons_contrib/presets/interface_theme/theme_softdefault.xml
+++ /dev/null
@@ -1,813 +0,0 @@
-<bpy>
-  <Theme>
-    <view_3d>
-      <ThemeView3D object_active="#ffffff"
-                   editmesh_active="#ffffff72"
-                   act_spline="#db2512"
-                   handle_align="#803060"
-                   handle_sel_align="#f090a0"
-                   handle_auto="#909000"
-                   handle_sel_auto="#f0ff40"
-                   bone_pose="#50c8ff"
-                   bone_solid="#c8c8c8"
-                   bundle_solid="#c8c8c8"
-                   camera_path="#000000"
-                   frame_current="#60c040"
-                   edge_crease="#cc57b4"
-                   extra_edge_len="#200000"
-                   edge_seam="#db5c3d"
-                   edge_select="#e3e3e3"
-                   edge_sharp="#3a9fff"
-                   edge_facesel="#4b4b4b"
-                   face="#00000058"
-                   extra_face_angle="#002000"
-                   extra_face_area="#000080"
-                   face_dot="#9bff61"
-                   facedot_size="3"
-                   normal="#22dddd"
-                   face_select="#0000003c"
-                   handle_free="#000000"
-                   handle_sel_free="#000000"
-                   grid="#555555"
-                   lamp="#e3d45966"
-                   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="#ffffff"
-                   outline_width="1"
-                   panel="#a5a5a57f"
-                   speaker="#5c6db2"
-                   transform="#ffffff"
-                   handle_vect="#409030"
-                   handle_sel_vect="#40c030"
-                   vertex="#000000"
-                   vertex_normal="#2361dd"
-                   vertex_select="#ff6424"
-                   vertex_size="3"
-                   wire="#000000">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#404040">
-          </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">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#393939">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeClipEditor>
-    </clip_editor>
-    <console>
-      <ThemeConsole cursor="#8bdc66"
-                    line_error="#dc6060"
-                    line_info="#e4e585"
-                    line_input="#ffffff"
-                    line_output="#6080ff">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#000000">
-          </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="#5e5e5e"
-                      long_key="#0c0a0a"
-                      long_key_selected="#ff8c00"
-                      value_sliders="#000000"
-                      view_sliders="#969696">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#6b6b6b">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#666666"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeDopeSheet>
-    </dopesheet_editor>
-    <file_browser>
-      <ThemeFileBrowser active_file="#727272"
-                        active_file_text="#fafafa"
-                        scroll_handle="#7f7979"
-                        scrollbar="#a0a0a0"
-                        selected_file="#1e1e1e"
-                        tiles="#727272">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#fafafa"
-                             text_hi="#0f0f0f"
-                             title="#000000"
-                             back="#4c4c4c">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#666666"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </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="#ffffff"
-                        handle_auto_clamped="#994030"
-                        handle_sel_auto_clamped="#f0af90"
-                        channel_group="#8686b0"
-                        channels_region="#707070"
-                        frame_current="#7ec068"
-                        dopesheet_channel="#76879c"
-                        dopesheet_subchannel="#8699b0"
-                        handle_free="#ffffff"
-                        handle_sel_free="#000000"
-                        grid="#5e5e5e"
-                        handle_vertex="#000000"
-                        handle_vertex_select="#ffffff"
-                        handle_vertex_size="8"
-                        lastsel_point="#000000"
-                        panel="#ffffff"
-                        handle_vect="#409030"
-                        handle_sel_vect="#6ee854"
-                        vertex="#000000"
-                        vertex_select="#ffffff"
-                        vertex_size="5"
-                        window_sliders="#969696">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#6b6b6b">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#666666"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </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="#727272ff"
-                        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="#000000"
-                        vertex_select="#ff8500"
-                        vertex_size="3">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#353535">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeImageEditor>
-    </image_editor>
-    <info>
-      <ThemeInfo >
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#727272">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeInfo>
-    </info>
-    <logic_editor>
-      <ThemeLogicEditor panel="#a5a5a5">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#646464">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeLogicEditor>
-    </logic_editor>
-    <nla_editor>
-      <ThemeNLAEditor bars="#707070"
-                      bars_selected="#7ec068"
-                      frame_current="#7ec068"
-                      grid="#5e5e5e"
-                      strips="#0c0a0a"
-                      strips_selected="#ff8c00"
-                      view_sliders="#969696">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#6b6b6b">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#666666"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeNLAEditor>
-    </nla_editor>
-    <node_editor>
-      <ThemeNodeEditor converter_node="#b5b1ea"
-                       group_node="#d5ffa2"
-                       in_out_node="#b0cae0"
-                       node_backdrop="#858585ff"
-                       noodle_curving="5"
-                       operator_node="#ffa46c"
-                       selected_text="#ffffff"
-                       wire_select="#ffffff"
-                       wire="#000000">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#727272">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#a5a5a5"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeNodeEditor>
-    </node_editor>
-    <outliner>
-      <ThemeOutliner match="#337f33"
-                     selected_highlight="#82878c">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#727272">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeOutliner>
-    </outliner>
-    <properties>
-      <ThemeProperties panel="#828282">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#727272">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeProperties>
-    </properties>
-    <sequence_editor>
-      <ThemeSequenceEditor audio_strip="#2e8f8f"
-                           frame_current="#60c040"
-                           draw_action="#50c8ff"
-                           effect_strip="#a9547c"
-                           grid="#404040"
-                           image_strip="#6d5881"
-                           keyframe="#ff8500"
-                           meta_strip="#6d9183"
-                           movie_strip="#516987"
-                           plugin_strip="#7e7e50"
-                           scene_strip="#4e983e"
-                           transition_strip="#a25f6f"
-                           window_sliders="#a0a0a0">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#747474">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeSequenceEditor>
-    </sequence_editor>
-    <text_editor>
-      <ThemeTextEditor cursor="#afff80"
-                       line_numbers_background="#7c7c7c"
-                       scroll_bar="#8f8f8f"
-                       selected_text="#bdbd8d"
-                       syntax_builtin="#ff5353"
-                       syntax_comment="#ffffff"
-                       syntax_numbers="#7dc8c8"
-                       syntax_special="#92da66"
-                       syntax_string="#f7f185">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#727272">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeTextEditor>
-    </text_editor>
-    <timeline>
-      <ThemeTimeline frame_current="#7ec068"
-                     grid="#565656">
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#727272">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeTimeline>
-    </timeline>
-    <user_interface>
-      <ThemeUserInterface icon_alpha="1"
-                          icon_file="">
-        <wcol_box>
-          <ThemeWidgetColors inner="#6c6c6cff"
-                             inner_sel="#6c6c6cff"
-                             item="#4a4a4aff"
-                             outline="#646464"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_box>
-        <wcol_list_item>
-          <ThemeWidgetColors inner="#00000000"
-                             inner_sel="#6b8cafff"
-                             item="#000000ff"
-                             outline="#000000"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_list_item>
-        <wcol_menu_back>
-          <ThemeWidgetColors inner="#727272ff"
-                             inner_sel="#2d2d2de6"
-                             item="#646464ff"
-                             outline="#505050"
-                             shadedown="-20"
-                             shadetop="25"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ececec">
-          </ThemeWidgetColors>
-        </wcol_menu_back>
-        <wcol_menu_item>
-          <ThemeWidgetColors inner="#00000000"
-                             inner_sel="#727272ff"
-                             item="#ffffffff"
-                             outline="#727272"
-                             shadedown="5"
-                             shadetop="-8"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_menu_item>
-        <wcol_menu>
-          <ThemeWidgetColors inner="#727272ff"
-                             inner_sel="#6c6c6cff"
-                             item="#464646ff"
-                             outline="#606060"
-                             shadedown="5"
-                             shadetop="-5"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#f5f5f5">
-          </ThemeWidgetColors>
-        </wcol_menu>
-        <wcol_num>
-          <ThemeWidgetColors inner="#595959ff"
-                             inner_sel="#444444ff"
-                             item="#3b3b3bff"
-                             outline="#606060"
-                             shadedown="5"
-                             shadetop="-5"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_num>
-        <wcol_option>
-          <ThemeWidgetColors inner="#727272ff"
-                             inner_sel="#838383ff"
-                             item="#000000ff"
-                             outline="#646464"
-                             shadedown="5"
-                             shadetop="-5"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_option>
-        <panel>
-          <ThemePanelColors header="#00000008"
-                            show_header="TRUE">
-          </ThemePanelColors>
-        </panel>
-        <wcol_progress>
-          <ThemeWidgetColors inner="#758b69ff"
-                             inner_sel="#93af84ff"
-                             item="#93af84ff"
-                             outline="#727272"
-                             shadedown="-5"
-                             shadetop="5"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_progress>
-        <wcol_pulldown>
-          <ThemeWidgetColors inner="#3f3f3fff"
-                             inner_sel="#727272ff"
-                             item="#000000ff"
-                             outline="#606060"
-                             shadedown="-5"
-                             shadetop="5"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_pulldown>
-        <wcol_radio>
-          <ThemeWidgetColors inner="#6c6c6cff"
-                             inner_sel="#6b8cafff"
-                             item="#ffffffff"
-                             outline="#646464"
-                             shadedown="5"
-                             shadetop="-5"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_radio>
-        <wcol_regular>
-          <ThemeWidgetColors inner="#999999ff"
-                             inner_sel="#646464ff"
-                             item="#191919ff"
-                             outline="#000000"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_regular>
-        <wcol_scroll>
-          <ThemeWidgetColors inner="#727272ff"
-                             inner_sel="#646464ff"
-                             item="#626262ff"
-                             outline="#6a6a6a"
-                             shadedown="-5"
-                             shadetop="5"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_scroll>
-        <wcol_numslider>
-          <ThemeWidgetColors inner="#595959ff"
-                             inner_sel="#595959ff"
-                             item="#494949ff"
-                             outline="#606060"
-                             shadedown="0"
-                             shadetop="-20"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_numslider>
-        <wcol_state>
-          <ThemeWidgetStateColors inner_anim="#98cc7e"
-                                  inner_anim_sel="#5aa633"
-                                  blend="0.5"
-                                  inner_driven="#cf5bff"
-                                  inner_driven_sel="#ac45d7"
-                                  inner_key="#f0ec75"
-                                  inner_key_sel="#d7d34b">
-          </ThemeWidgetStateColors>
-        </wcol_state>
-        <wcol_text>
-          <ThemeWidgetColors inner="#727272ff"
-                             inner_sel="#dbcc6fff"
-                             item="#91874aff"
-                             outline="#646464"
-                             shadedown="5"
-                             shadetop="-5"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_text>
-        <wcol_toggle>
-          <ThemeWidgetColors inner="#727272ff"
-                             inner_sel="#6b8cafff"
-                             item="#000000ff"
-                             outline="#646464"
-                             shadedown="5"
-                             shadetop="-5"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_toggle>
-        <wcol_tool>
-          <ThemeWidgetColors inner="#727272ff"
-                             inner_sel="#646464ff"
-                             item="#191919ff"
-                             outline="#646464"
-                             shadedown="5"
-                             shadetop="-5"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_tool>
-      </ThemeUserInterface>
-    </user_interface>
-    <user_preferences>
-      <ThemeUserPreferences >
-        <space>
-          <ThemeSpaceGeneric header="#727272"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#000000"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#727272">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeUserPreferences>
-    </user_preferences>
-    <bone_color_sets>
-      <ThemeBoneColorSet active="#f70a0a"
-                         show_colored_constraints="FALSE"
-                         normal="#9a0000"
-                         select="#bd1111">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#fa9900"
-                         show_colored_constraints="FALSE"
-                         normal="#f74018"
-                         select="#f66913">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#83ef1d"
-                         show_colored_constraints="FALSE"
-                         normal="#1e9109"
-                         select="#59b70b">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#5ec1ef"
-                         show_colored_constraints="FALSE"
-                         normal="#0a3694"
-                         select="#3667df">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f05d91"
-                         show_colored_constraints="FALSE"
-                         normal="#a9294e"
-                         select="#c1416a">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#8764d5"
-                         show_colored_constraints="FALSE"
-                         normal="#430c78"
-                         select="#543aa3">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#6fb6ab"
-                         show_colored_constraints="FALSE"
-                         normal="#24785a"
-                         select="#3c9579">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#9bc2cd"
-                         show_colored_constraints="FALSE"
-                         normal="#4b707c"
-                         select="#6a8691">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f3ff00"
-                         show_colored_constraints="FALSE"
-                         normal="#f4c90c"
-                         select="#eec236">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#ffffff"
-                         show_colored_constraints="FALSE"
-                         normal="#1e2024"
-                         select="#484c56">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#d330d6"
-                         show_colored_constraints="FALSE"
-                         normal="#6f2f6a"
-                         select="#9845be">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bbef5b"
-                         show_colored_constraints="FALSE"
-                         normal="#6c8e22"
-                         select="#7fb022">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#dedede"
-                         show_colored_constraints="FALSE"
-                         normal="#8d8d8d"
-                         select="#b0b0b0">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bd6a11"
-                         show_colored_constraints="FALSE"
-                         normal="#834326"
-                         select="#8b5811">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#34622b"
-                         show_colored_constraints="FALSE"
-                         normal="#08310e"
-                         select="#1c430b">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-    </bone_color_sets>
-  </Theme>
-</bpy>
diff --git a/release/scripts/addons_contrib/presets/interface_theme/theme_zbrush.xml b/release/scripts/addons_contrib/presets/interface_theme/theme_zbrush.xml
deleted file mode 100644
index c8ad1fb..0000000
--- a/release/scripts/addons_contrib/presets/interface_theme/theme_zbrush.xml
+++ /dev/null
@@ -1,812 +0,0 @@
-<bpy>
-  <Theme>
-    <view_3d>
-      <ThemeView3D object_active="#c28d45"
-                   editmesh_active="#ffffff80"
-                   act_spline="#db2512"
-                   handle_align="#803060"
-                   handle_sel_align="#f090a0"
-                   handle_auto="#909000"
-                   handle_sel_auto="#f0ff40"
-                   bone_pose="#50c8ff"
-                   bone_solid="#c8c8c8"
-                   bundle_solid="#c8c8c8"
-                   camera_path="#000000"
-                   frame_current="#60c040"
-                   edge_crease="#cc0099"
-                   extra_edge_len="#200000"
-                   edge_seam="#db2512"
-                   edge_select="#c28d45"
-                   edge_sharp="#00ffff"
-                   edge_facesel="#4b4b4b"
-                   face="#00000054"
-                   extra_face_angle="#000080"
-                   extra_face_area="#002000"
-                   face_dot="#c28d45"
-                   facedot_size="2"
-                   normal="#22dddd"
-                   face_select="#81602e73"
-                   handle_free="#000000"
-                   handle_sel_free="#000000"
-                   grid="#353535"
-                   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="#f1f1f1"
-                   outline_width="1"
-                   panel="#a5a5a57f"
-                   speaker="#000000"
-                   transform="#ffffff"
-                   handle_vect="#409030"
-                   handle_sel_vect="#40c030"
-                   vertex="#a8a8a8"
-                   vertex_normal="#2361dd"
-                   vertex_select="#c28d45"
-                   vertex_size="3"
-                   wire="#000000">
-        <space>
-          <ThemeSpaceGeneric header="#3b3b3b"
-                             header_text="#b9b9b9"
-                             header_text_hi="#ffffff"
-                             button="#3b3b3b"
-                             button_text="#878787"
-                             button_text_hi="#ffffff"
-                             button_title="#949494"
-                             text="#b8b8b8"
-                             text_hi="#e9e9e9"
-                             title="#000000"
-                             back="#2c2e30">
-          </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">
-        <space>
-          <ThemeSpaceGeneric header="#3b3b3b"
-                             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="#2c2e30">
-          </ThemeSpaceGeneric>
-        </space>
-      </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="#4b4b4b"
-                      long_key="#0c0a0a"
-                      long_key_selected="#ff8c00"
-                      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="#848484"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#3b3b3b">
-          </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="#755729"
-                        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="#3a3a3a">
-          </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"
-                        handle_auto="#909000"
-                        handle_sel_auto="#f0ff40"
-                        handle_auto_clamped="#994030"
-                        handle_sel_auto_clamped="#f0af90"
-                        channel_group="#4f6549"
-                        channels_region="#707070"
-                        frame_current="#60c040"
-                        dopesheet_channel="#52606e"
-                        dopesheet_subchannel="#7c8996"
-                        handle_free="#000000"
-                        handle_sel_free="#000000"
-                        grid="#4b4b4b"
-                        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">
-        <space>
-          <ThemeSpaceGeneric header="#3b3b3b"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#3b3b3b"
-                             button_text="#8b8b8b"
-                             button_text_hi="#ffffff"
-                             button_title="#8b8b8b"
-                             text="#848484"
-                             text_hi="#ffffff"
-                             title="#8b8b8b"
-                             back="#3b3b3b">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#3b3b3b"
-                                 list_text="#8b8b8b"
-                                 list_text_hi="#ffffff"
-                                 list_title="#8b8b8b">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeGraphEditor>
-    </graph_editor>
-    <image_editor>
-      <ThemeImageEditor editmesh_active="#ffffff80"
-                        face="#7c7c7c0a"
-                        face_dot="#c28d45"
-                        facedot_size="3"
-                        face_select="#c28d453c"
-                        scope_back="#3b3b3bff"
-                        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="#a8a8a8"
-                        vertex_select="#c28d45"
-                        vertex_size="3">
-        <space>
-          <ThemeSpaceGeneric header="#3b3b3b"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#3b3b3b"
-                             button_text="#8b8b8b"
-                             button_text_hi="#ffffff"
-                             button_title="#8b8b8b"
-                             text="#8b8b8b"
-                             text_hi="#ffffff"
-                             title="#8b8b8b"
-                             back="#303030">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeImageEditor>
-    </image_editor>
-    <info>
-      <ThemeInfo >
-        <space>
-          <ThemeSpaceGeneric header="#3b3b3b"
-                             header_text="#8b8b8b"
-                             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">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeLogicEditor>
-    </logic_editor>
-    <nla_editor>
-      <ThemeNLAEditor bars="#707070"
-                      bars_selected="#60c040"
-                      frame_current="#60c040"
-                      grid="#585858"
-                      strips="#0c0a0a"
-                      strips_selected="#ff8c00"
-                      view_sliders="#969696">
-        <space>
-          <ThemeSpaceGeneric header="#3b3b3b"
-                             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="#8b8b8b"
-                             back="#4b4b4b">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#3b3b3b"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeNLAEditor>
-    </nla_editor>
-    <node_editor>
-      <ThemeNodeEditor converter_node="#686a75"
-                       group_node="#69756e"
-                       in_out_node="#646464"
-                       node_backdrop="#9b9b9ba0"
-                       noodle_curving="5"
-                       operator_node="#6c696f"
-                       selected_text="#7f7070"
-                       wire_select="#ffffff"
-                       wire="#000000">
-        <space>
-          <ThemeSpaceGeneric header="#3b3b3b"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#3b3b3b"
-                             button_text="#8b8b8b"
-                             button_text_hi="#ffffff"
-                             button_title="#8b8b8b"
-                             text="#8b8b8b"
-                             text_hi="#ffffff"
-                             title="#8b8b8b"
-                             back="#3b3b3b">
-          </ThemeSpaceGeneric>
-        </space>
-        <space_list>
-          <ThemeSpaceListGeneric list="#a5a5a5"
-                                 list_text="#000000"
-                                 list_text_hi="#ffffff"
-                                 list_title="#000000">
-          </ThemeSpaceListGeneric>
-        </space_list>
-      </ThemeNodeEditor>
-    </node_editor>
-    <outliner>
-      <ThemeOutliner >
-        <space>
-          <ThemeSpaceGeneric header="#3b3b3b"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#cacaca"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#3a3a3a">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeOutliner>
-    </outliner>
-    <properties>
-      <ThemeProperties panel="#828282">
-        <space>
-          <ThemeSpaceGeneric 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="#6d6d6d"
-                             back="#3b3b3b">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeProperties>
-    </properties>
-    <sequence_editor>
-      <ThemeSequenceEditor audio_strip="#2e8f8f"
-                           frame_current="#60c040"
-                           draw_action="#50c8ff"
-                           effect_strip="#a9547c"
-                           grid="#818181"
-                           image_strip="#6d5881"
-                           keyframe="#ff8500"
-                           meta_strip="#6d9183"
-                           movie_strip="#516987"
-                           plugin_strip="#7e7e50"
-                           scene_strip="#4e983e"
-                           transition_strip="#a25f6f"
-                           window_sliders="#a0a0a0">
-        <space>
-          <ThemeSpaceGeneric header="#3b3b3b"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#3b3b3b"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#848484"
-                             text_hi="#ffffff"
-                             title="#8b8b8b"
-                             back="#3b3b3b">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeSequenceEditor>
-    </sequence_editor>
-    <text_editor>
-      <ThemeTextEditor cursor="#ff0000"
-                       line_numbers_background="#404040"
-                       scroll_bar="#8f8f8f"
-                       selected_text="#c67777"
-                       syntax_builtin="#800050"
-                       syntax_comment="#006432"
-                       syntax_numbers="#0000c8"
-                       syntax_special="#5f5f00"
-                       syntax_string="#640000">
-        <space>
-          <ThemeSpaceGeneric header="#3b3b3b"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#3b3b3b"
-                             button_text="#8b8b8b"
-                             button_text_hi="#ffffff"
-                             button_title="#8b8b8b"
-                             text="#b8b8b8"
-                             text_hi="#ffffff"
-                             title="#8b8b8b"
-                             back="#4b4b4b">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeTextEditor>
-    </text_editor>
-    <timeline>
-      <ThemeTimeline frame_current="#60c040"
-                     grid="#464646">
-        <space>
-          <ThemeSpaceGeneric header="#3b3b3b"
-                             header_text="#000000"
-                             header_text_hi="#ffffff"
-                             button="#727272"
-                             button_text="#000000"
-                             button_text_hi="#ffffff"
-                             button_title="#000000"
-                             text="#848484"
-                             text_hi="#ffffff"
-                             title="#000000"
-                             back="#303030">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeTimeline>
-    </timeline>
-    <user_interface>
-      <ThemeUserInterface icon_alpha="1"
-                          icon_file="">
-        <wcol_box>
-          <ThemeWidgetColors inner="#3e3e3eff"
-                             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="#75582aae"
-                             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="#c28d45ff"
-                             item="#ffffffff"
-                             outline="#000000"
-                             shadedown="20"
-                             shadetop="0"
-                             show_shaded="TRUE"
-                             text="#b8b8b8"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_menu_item>
-        <wcol_menu>
-          <ThemeWidgetColors inner="#2f2f2fff"
-                             inner_sel="#464646ff"
-                             item="#777777ff"
-                             outline="#151515"
-                             shadedown="-5"
-                             shadetop="5"
-                             show_shaded="TRUE"
-                             text="#b8b8b8"
-                             text_sel="#cccccc">
-          </ThemeWidgetColors>
-        </wcol_menu>
-        <wcol_num>
-          <ThemeWidgetColors inner="#333333ff"
-                             inner_sel="#999999ff"
-                             item="#727272ff"
-                             outline="#1f1f1f"
-                             shadedown="0"
-                             shadetop="10"
-                             show_shaded="TRUE"
-                             text="#b8b8b8"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_num>
-        <wcol_option>
-          <ThemeWidgetColors inner="#3b3b3bff"
-                             inner_sel="#c28d45ff"
-                             item="#ffffffff"
-                             outline="#1f1f1f"
-                             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="#c28d45ff"
-                             item="#ffffffff"
-                             outline="#000000"
-                             shadedown="0"
-                             shadetop="25"
-                             show_shaded="TRUE"
-                             text="#b8b8b8"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_pulldown>
-        <wcol_radio>
-          <ThemeWidgetColors inner="#333333ff"
-                             inner_sel="#c28d45ff"
-                             item="#ffffffff"
-                             outline="#1f1f1f"
-                             shadedown="-5"
-                             shadetop="5"
-                             show_shaded="TRUE"
-                             text="#b8b8b8"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_radio>
-        <wcol_regular>
-          <ThemeWidgetColors inner="#999999ff"
-                             inner_sel="#646464ff"
-                             item="#191919ff"
-                             outline="#191919"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="FALSE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_regular>
-        <wcol_scroll>
-          <ThemeWidgetColors inner="#07070719"
-                             inner_sel="#646464b4"
-                             item="#2e2e2eff"
-                             outline="#1c1c1c"
-                             shadedown="0"
-                             shadetop="0"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_scroll>
-        <wcol_numslider>
-          <ThemeWidgetColors inner="#606068ff"
-                             inner_sel="#91919dff"
-                             item="#3a3a3aff"
-                             outline="#303030"
-                             shadedown="10"
-                             shadetop="-10"
-                             show_shaded="TRUE"
-                             text="#dfdfdf"
-                             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="#7a8287ff"
-                             inner_sel="#999999ff"
-                             item="#5a5a5aff"
-                             outline="#303030"
-                             shadedown="0"
-                             shadetop="5"
-                             show_shaded="TRUE"
-                             text="#000000"
-                             text_sel="#ffffff">
-          </ThemeWidgetColors>
-        </wcol_text>
-        <wcol_toggle>
-          <ThemeWidgetColors inner="#333333ff"
-                             inner_sel="#c28d45ff"
-                             item="#191919ff"
-                             outline="#1f1f1f"
-                             shadedown="0"
-                             shadetop="5"
-                             show_shaded="TRUE"
-                             text="#b8b8b8"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_toggle>
-        <wcol_tool>
-          <ThemeWidgetColors inner="#333333ff"
-                             inner_sel="#c28d45ff"
-                             item="#191919ff"
-                             outline="#1f1f1f"
-                             shadedown="0"
-                             shadetop="10"
-                             show_shaded="TRUE"
-                             text="#b8b8b8"
-                             text_sel="#000000">
-          </ThemeWidgetColors>
-        </wcol_tool>
-      </ThemeUserInterface>
-    </user_interface>
-    <user_preferences>
-      <ThemeUserPreferences >
-        <space>
-          <ThemeSpaceGeneric 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">
-          </ThemeSpaceGeneric>
-        </space>
-      </ThemeUserPreferences>
-    </user_preferences>
-    <bone_color_sets>
-      <ThemeBoneColorSet active="#f70a0a"
-                         show_colored_constraints="FALSE"
-                         normal="#9a0000"
-                         select="#bd1111">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#fa9900"
-                         show_colored_constraints="FALSE"
-                         normal="#f74018"
-                         select="#f66913">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#83ef1d"
-                         show_colored_constraints="FALSE"
-                         normal="#1e9109"
-                         select="#59b70b">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#5ec1ef"
-                         show_colored_constraints="FALSE"
-                         normal="#0a3694"
-                         select="#3667df">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f05d91"
-                         show_colored_constraints="FALSE"
-                         normal="#a9294e"
-                         select="#c1416a">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#8764d5"
-                         show_colored_constraints="FALSE"
-                         normal="#430c78"
-                         select="#543aa3">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#6fb6ab"
-                         show_colored_constraints="FALSE"
-                         normal="#24785a"
-                         select="#3c9579">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#9bc2cd"
-                         show_colored_constraints="FALSE"
-                         normal="#4b707c"
-                         select="#6a8691">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#f3ff00"
-                         show_colored_constraints="FALSE"
-                         normal="#f4c90c"
-                         select="#eec236">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#ffffff"
-                         show_colored_constraints="FALSE"
-                         normal="#1e2024"
-                         select="#484c56">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#d330d6"
-                         show_colored_constraints="FALSE"
-                         normal="#6f2f6a"
-                         select="#9845be">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bbef5b"
-                         show_colored_constraints="FALSE"
-                         normal="#6c8e22"
-                         select="#7fb022">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#dedede"
-                         show_colored_constraints="FALSE"
-                         normal="#8d8d8d"
-                         select="#b0b0b0">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#bd6a11"
-                         show_colored_constraints="FALSE"
-                         normal="#834326"
-                         select="#8b5811">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#34622b"
-                         show_colored_constraints="FALSE"
-                         normal="#08310e"
-                         select="#1c430b">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-      <ThemeBoneColorSet active="#000000"
-                         show_colored_constraints="FALSE"
-                         normal="#000000"
-                         select="#000000">
-      </ThemeBoneColorSet>
-    </bone_color_sets>
-  </Theme>
-</bpy>
diff --git a/release/scripts/addons_contrib/presets/interface_theme/toxic.xml b/release/scripts/addons_contrib/presets/interface_theme/toxic.xml
new file mode 100644
index 0000000..82d3e58
--- /dev/null
+++ b/release/scripts/addons_contrib/presets/interface_theme/toxic.xml
@@ -0,0 +1,828 @@
+<bpy>
+  <Theme>
+    <view_3d>
+      <ThemeView3D object_active="#97ff22"
+                   editmesh_active="#ffffff80"
+                   act_spline="#db2512"
+                   handle_align="#803060"
+                   handle_sel_align="#f090a0"
+                   handle_auto="#909000"
+                   handle_sel_auto="#f0ff40"
+                   bone_pose="#50c8ff"
+                   bone_solid="#c8c8c8"
+                   bundle_solid="#c8c8c8"
+                   camera="#000000"
+                   camera_path="#5a5a5a"
+                   frame_current="#60c040"
+                   edge_crease="#cc0099"
+                   extra_edge_len="#ffedf8"
+                   edge_seam="#db2512"
+                   edge_select="#3cbc2c"
+                   edge_sharp="#ff2020"
+                   edge_facesel="#6b6b6b"
+                   empty="#000000"
+                   face="#73828f12"
+                   extra_face_angle="#00c900"
+                   extra_face_area="#fff000"
+                   face_dot="#95fd20"
+                   facedot_size="4"
+                   normal="#22dddd"
+                   face_select="#3aba2a3c"
+                   handle_free="#7f7f7f"
+                   handle_sel_free="#3b3b3b"
+                   grid="#3f3f3f"
+                   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="#3ebe2e"
+                   outline_width="1"
+                   panel="#a5a5a57f"
+                   speaker="#535353"
+                   transform="#ffffff"
+                   handle_vect="#409030"
+                   handle_sel_vect="#40c030"
+                   vertex="#72cfdd"
+                   vertex_normal="#2361dd"
+                   vertex_select="#3cbc2c"
+                   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">
+        <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"
+                             title="#5d5d5d"
+                             back="#0d0d0d">
+          </ThemeSpaceGeneric>
+        </space>
+      </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"
+                      value_sliders="#000000"
+                      view_sliders="#969696">
+        <space>
+          <ThemeSpaceGeneric 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="#2f6629"
+                        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">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#181818"
+                                 list_text="#5d5d5d"
+                                 list_text_hi="#ffffff"
+                                 list_title="#9e9e9e">
+          </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="#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"
+                        panel="#ffffff"
+                        handle_vect="#409030"
+                        handle_sel_vect="#40c030"
+                        vertex="#ffffff"
+                        vertex_select="#ff8500"
+                        vertex_size="3"
+                        window_sliders="#969696">
+        <space>
+          <ThemeSpaceGeneric 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">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#1a1a1a"
+                                 list_text="#bbbbbb"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </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">
+        <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">
+          </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_hi="#ffffff"
+                             title="#5d5d5d"
+                             back="#000000">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeInfo>
+    </info>
+    <logic_editor>
+      <ThemeLogicEditor panel="#a5a5a5">
+        <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="#070707">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeLogicEditor>
+    </logic_editor>
+    <nla_editor>
+      <ThemeNLAEditor bars="#707070"
+                      bars_selected="#60c040"
+                      frame_current="#2f6421"
+                      grid="#5e5e5e"
+                      strips="#aa8d8d"
+                      strips_selected="#ff8c00"
+                      view_sliders="#969696">
+        <space>
+          <ThemeSpaceGeneric 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">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#0c0c0c"
+                                 list_text="#d8d8d8"
+                                 list_text_hi="#ffffff"
+                                 list_title="#383838">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeNLAEditor>
+    </nla_editor>
+    <node_editor>
+      <ThemeNodeEditor converter_node="#113941"
+                       group_node="#091a07"
+                       in_out_node="#273053"
+                       node_backdrop="#202030bc"
+                       noodle_curving="5"
+                       operator_node="#0e3157"
+                       selected_text="#7f7070"
+                       wire_select="#0019ff"
+                       wire="#6eafff">
+        <space>
+          <ThemeSpaceGeneric header="#000000"
+                             header_text="#c7c7c7"
+                             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">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#a5a5a5"
+                                 list_text="#ffffff"
+                                 list_text_hi="#b8ffff"
+                                 list_title="#ffffff">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeNodeEditor>
+    </node_editor>
+    <outliner>
+      <ThemeOutliner match="#356c1a"
+                     selected_highlight="#446e1c">
+        <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"
+                             text_hi="#ffffff"
+                             title="#9b9b9b"
+                             back="#070707">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeOutliner>
+    </outliner>
+    <properties>
+      <ThemeProperties panel="#6f4c82">
+        <space>
+          <ThemeSpaceGeneric header="#000000"
+                             header_text="#979797"
+                             header_text_hi="#ffffff"
+                             button="#0e0e0e"
+                             button_text="#c3c3c3"
+                             button_text_hi="#ffffff"
+                             button_title="#c5c5c5"
+                             text="#7d7d7d"
+                             text_hi="#ffffff"
+                             title="#5d5d5d"
+                             back="#000000">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeProperties>
+    </properties>
+    <sequence_editor>
+      <ThemeSequenceEditor audio_strip="#2e8f8f"
+                           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"
+                           plugin_strip="#7e7e50"
+                           preview_back="#000000"
+                           scene_strip="#4e983e"
+                           transition_strip="#a25f6f"
+                           window_sliders="#a0a0a0">
+        <space>
+          <ThemeSpaceGeneric 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">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeSequenceEditor>
+    </sequence_editor>
+    <text_editor>
+      <ThemeTextEditor cursor="#ff0000"
+                       syntax_special="#969629"
+                       line_numbers_background="#191919"
+                       selected_text="#ffffff"
+                       syntax_builtin="#cf3d99"
+                       syntax_comment="#249d60"
+                       syntax_numbers="#3c68ff"
+                       syntax_string="#cc3535">
+        <space>
+          <ThemeSpaceGeneric header="#000000"
+                             header_text="#b9b9b9"
+                             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">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTextEditor>
+    </text_editor>
+    <timeline>
+      <ThemeTimeline frame_current="#3fff00"
+                     grid="#707070">
+        <space>
+          <ThemeSpaceGeneric header="#000000"
+                             header_text="#979797"
+                             header_text_hi="#ffffff"
+                             button="#161616"
+                             button_text="#c3c3c3"
+                             button_text_hi="#ffffff"
+                             button_title="#c5c5c5"
+                             text="#c7c7c7"
+                             text_hi="#ffffff"
+                             title="#5d5d5d"
+                             back="#162c0c">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTimeline>
+    </timeline>
+    <user_interface>
+      <ThemeUserInterface icon_alpha="1"
+                          icon_file="">
+        <wcol_box>
+          <ThemeWidgetColors inner="#111111ff"
+                             inner_sel="#72a400ff"
+                             item="#191919ff"
+                             outline="#2a2a2a"
+                             shadedown="0"
+                             shadetop="-100"
+                             show_shaded="TRUE"
+                             text="#ffffff"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_box>
+        <wcol_list_item>
+          <ThemeWidgetColors inner="#111111ff"
+                             inner_sel="#649600ff"
+                             item="#191919ff"
+                             outline="#2a2a2a"
+                             shadedown="0"
+                             shadetop="-100"
+                             show_shaded="TRUE"
+                             text="#fdfdfd"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_list_item>
+        <wcol_menu_back>
+          <ThemeWidgetColors inner="#111111ff"
+                             inner_sel="#6c9e00ff"
+                             item="#191919ff"
+                             outline="#2a2a2a"
+                             shadedown="0"
+                             shadetop="-100"
+                             show_shaded="TRUE"
+                             text="#ffffff"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_menu_back>
+        <wcol_menu_item>
+          <ThemeWidgetColors inner="#111111ff"
+                             inner_sel="#6a9c00ff"
+                             item="#191919ff"
+                             outline="#2a2a2a"
+                             shadedown="0"
+                             shadetop="-100"
+                             show_shaded="TRUE"
+                             text="#fdfdfd"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_menu_item>
+        <wcol_menu>
+          <ThemeWidgetColors inner="#111111ff"
+                             inner_sel="#70a200ff"
+                             item="#2a2a2aff"
+                             outline="#2a2a2a"
+                             shadedown="0"
+                             shadetop="-100"
+                             show_shaded="TRUE"
+                             text="#ffffff"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_menu>
+        <wcol_num>
+          <ThemeWidgetColors inner="#111111ff"
+                             inner_sel="#76a800ff"
+                             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="#7aac00ff"
+                             item="#ffffffff"
+                             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="#669800ff"
+                             item="#191919ff"
+                             outline="#2a2a2a"
+                             shadedown="0"
+                             shadetop="-100"
+                             show_shaded="TRUE"
+                             text="#fdfdfd"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_progress>
+        <wcol_pulldown>
+          <ThemeWidgetColors inner="#111111ff"
+                             inner_sel="#6ea000ff"
+                             item="#191919ff"
+                             outline="#2a2a2a"
+                             shadedown="0"
+                             shadetop="-100"
+                             show_shaded="TRUE"
+                             text="#ffffff"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_pulldown>
+        <wcol_radio>
+          <ThemeWidgetColors inner="#111111ff"
+                             inner_sel="#7eb000ff"
+                             item="#191919ff"
+                             outline="#2a2a2a"
+                             shadedown="0"
+                             shadetop="-100"
+                             show_shaded="TRUE"
+                             text="#ffffff"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_radio>
+        <wcol_regular>
+          <ThemeWidgetColors inner="#0a0a0aff"
+                             inner_sel="#84b600ff"
+                             item="#191919ff"
+                             outline="#2a2a2a"
+                             shadedown="0"
+                             shadetop="-100"
+                             show_shaded="TRUE"
+                             text="#ffffff"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_regular>
+        <wcol_scroll>
+          <ThemeWidgetColors inner="#171717ff"
+                             inner_sel="#689a00ff"
+                             item="#689a00ff"
+                             outline="#2a2a2a"
+                             shadedown="0"
+                             shadetop="-100"
+                             show_shaded="TRUE"
+                             text="#fdfdfd"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_scroll>
+        <wcol_numslider>
+          <ThemeWidgetColors inner="#111111ff"
+                             inner_sel="#111111ff"
+                             item="#74a600ff"
+                             outline="#2a2a2a"
+                             shadedown="0"
+                             shadetop="-100"
+                             show_shaded="TRUE"
+                             text="#ffffff"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_numslider>
+        <wcol_state>
+          <ThemeWidgetStateColors inner_anim="#56ff00"
+                                  inner_anim_sel="#56ff00"
+                                  blend="0.1"
+                                  inner_driven="#629400"
+                                  inner_driven_sel="#609200"
+                                  inner_key="#fff400"
+                                  inner_key_sel="#fff400">
+          </ThemeWidgetStateColors>
+        </wcol_state>
+        <wcol_text>
+          <ThemeWidgetColors inner="#111111ff"
+                             inner_sel="#7cae00ff"
+                             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="#78aa00ff"
+                             item="#191919ff"
+                             outline="#2a2a2a"
+                             shadedown="0"
+                             shadetop="-100"
+                             show_shaded="TRUE"
+                             text="#ffffff"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_toggle>
+        <wcol_tool>
+          <ThemeWidgetColors inner="#79b224ff"
+                             inner_sel="#80b200ff"
+                             item="#191919ff"
+                             outline="#2a2a2a"
+                             shadedown="0"
+                             shadetop="-100"
+                             show_shaded="TRUE"
+                             text="#ffffff"
+                             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>
+        <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">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeUserPreferences>
+    </user_preferences>
+    <bone_color_sets>
+      <ThemeBoneColorSet active="#f70a0a"
+                         show_colored_constraints="FALSE"
+                         normal="#9a0000"
+                         select="#bd1111">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#fa9900"
+                         show_colored_constraints="FALSE"
+                         normal="#f74018"
+                         select="#f66913">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#83ef1d"
+                         show_colored_constraints="FALSE"
+                         normal="#1e9109"
+                         select="#59b70b">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#5ec1ef"
+                         show_colored_constraints="FALSE"
+                         normal="#0a3694"
+                         select="#3667df">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#f05d91"
+                         show_colored_constraints="FALSE"
+                         normal="#a9294e"
+                         select="#c1416a">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#8764d5"
+                         show_colored_constraints="FALSE"
+                         normal="#430c78"
+                         select="#543aa3">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#6fb6ab"
+                         show_colored_constraints="FALSE"
+                         normal="#24785a"
+                         select="#3c9579">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#9bc2cd"
+                         show_colored_constraints="FALSE"
+                         normal="#4b707c"
+                         select="#6a8691">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#f3ff00"
+                         show_colored_constraints="FALSE"
+                         normal="#f4c90c"
+                         select="#eec236">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#ffffff"
+                         show_colored_constraints="FALSE"
+                         normal="#1e2024"
+                         select="#484c56">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#d330d6"
+                         show_colored_constraints="FALSE"
+                         normal="#6f2f6a"
+                         select="#9845be">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#bbef5b"
+                         show_colored_constraints="FALSE"
+                         normal="#6c8e22"
+                         select="#7fb022">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#dedede"
+                         show_colored_constraints="FALSE"
+                         normal="#8d8d8d"
+                         select="#b0b0b0">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#bd6a11"
+                         show_colored_constraints="FALSE"
+                         normal="#834326"
+                         select="#8b5811">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#34622b"
+                         show_colored_constraints="FALSE"
+                         normal="#08310e"
+                         select="#1c430b">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+    </bone_color_sets>
+  </Theme>
+</bpy>
diff --git a/release/scripts/addons_contrib/presets/interface_theme/zbrush.xml b/release/scripts/addons_contrib/presets/interface_theme/zbrush.xml
new file mode 100644
index 0000000..194cde8
--- /dev/null
+++ b/release/scripts/addons_contrib/presets/interface_theme/zbrush.xml
@@ -0,0 +1,828 @@
+<bpy>
+  <Theme>
+    <view_3d>
+      <ThemeView3D object_active="#c28d45"
+                   editmesh_active="#ffffff80"
+                   act_spline="#db2512"
+                   handle_align="#803060"
+                   handle_sel_align="#f090a0"
+                   handle_auto="#909000"
+                   handle_sel_auto="#f0ff40"
+                   bone_pose="#50c8ff"
+                   bone_solid="#c8c8c8"
+                   bundle_solid="#c8c8c8"
+                   camera="#000000"
+                   camera_path="#000000"
+                   frame_current="#60c040"
+                   edge_crease="#cc0099"
+                   extra_edge_len="#200000"
+                   edge_seam="#db2512"
+                   edge_select="#c28d45"
+                   edge_sharp="#00ffff"
+                   edge_facesel="#4b4b4b"
+                   empty="#000000"
+                   face="#00000054"
+                   extra_face_angle="#000080"
+                   extra_face_area="#002000"
+                   face_dot="#c28d45"
+                   facedot_size="2"
+                   normal="#22dddd"
+                   face_select="#81602e73"
+                   handle_free="#000000"
+                   handle_sel_free="#000000"
+                   grid="#353535"
+                   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="#f1f1f1"
+                   outline_width="1"
+                   panel="#a5a5a57f"
+                   speaker="#000000"
+                   transform="#ffffff"
+                   handle_vect="#409030"
+                   handle_sel_vect="#40c030"
+                   vertex="#a8a8a8"
+                   vertex_normal="#2361dd"
+                   vertex_select="#c28d45"
+                   vertex_size="3"
+                   wire="#000000">
+        <space>
+          <ThemeSpaceGeneric header="#3b3b3b"
+                             header_text="#b9b9b9"
+                             header_text_hi="#ffffff"
+                             button="#3b3b3b"
+                             button_text="#878787"
+                             button_text_hi="#ffffff"
+                             button_title="#949494"
+                             text="#b8b8b8"
+                             text_hi="#e9e9e9"
+                             title="#000000"
+                             back="#2c2e30">
+          </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">
+        <space>
+          <ThemeSpaceGeneric header="#3b3b3b"
+                             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="#2c2e30">
+          </ThemeSpaceGeneric>
+        </space>
+      </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="#4b4b4b"
+                      long_key="#0c0a0a"
+                      long_key_selected="#ff8c00"
+                      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="#848484"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#3b3b3b">
+          </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="#755729"
+                        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="#3a3a3a">
+          </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"
+                        handle_auto="#909000"
+                        handle_sel_auto="#f0ff40"
+                        handle_auto_clamped="#994030"
+                        handle_sel_auto_clamped="#f0af90"
+                        channel_group="#4f6549"
+                        channels_region="#707070"
+                        frame_current="#60c040"
+                        dopesheet_channel="#52606e"
+                        dopesheet_subchannel="#7c8996"
+                        handle_free="#000000"
+                        handle_sel_free="#000000"
+                        grid="#4b4b4b"
+                        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">
+        <space>
+          <ThemeSpaceGeneric header="#3b3b3b"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#3b3b3b"
+                             button_text="#8b8b8b"
+                             button_text_hi="#ffffff"
+                             button_title="#8b8b8b"
+                             text="#848484"
+                             text_hi="#ffffff"
+                             title="#8b8b8b"
+                             back="#3b3b3b">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#3b3b3b"
+                                 list_text="#8b8b8b"
+                                 list_text_hi="#ffffff"
+                                 list_title="#8b8b8b">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeGraphEditor>
+    </graph_editor>
+    <image_editor>
+      <ThemeImageEditor editmesh_active="#ffffff80"
+                        face="#7c7c7c0a"
+                        face_dot="#c28d45"
+                        facedot_size="3"
+                        face_select="#c28d453c"
+                        scope_back="#3b3b3bff"
+                        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="#a8a8a8"
+                        vertex_select="#c28d45"
+                        vertex_size="3">
+        <space>
+          <ThemeSpaceGeneric header="#3b3b3b"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#3b3b3b"
+                             button_text="#8b8b8b"
+                             button_text_hi="#ffffff"
+                             button_title="#8b8b8b"
+                             text="#8b8b8b"
+                             text_hi="#ffffff"
+                             title="#8b8b8b"
+                             back="#303030">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeImageEditor>
+    </image_editor>
+    <info>
+      <ThemeInfo>
+        <space>
+          <ThemeSpaceGeneric header="#3b3b3b"
+                             header_text="#8b8b8b"
+                             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">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeLogicEditor>
+    </logic_editor>
+    <nla_editor>
+      <ThemeNLAEditor bars="#707070"
+                      bars_selected="#60c040"
+                      frame_current="#60c040"
+                      grid="#585858"
+                      strips="#0c0a0a"
+                      strips_selected="#ff8c00"
+                      view_sliders="#969696">
+        <space>
+          <ThemeSpaceGeneric header="#3b3b3b"
+                             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="#8b8b8b"
+                             back="#4b4b4b">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#3b3b3b"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeNLAEditor>
+    </nla_editor>
+    <node_editor>
+      <ThemeNodeEditor converter_node="#686a75"
+                       group_node="#69756e"
+                       in_out_node="#646464"
+                       node_backdrop="#9b9b9ba0"
+                       noodle_curving="5"
+                       operator_node="#6c696f"
+                       selected_text="#7f7070"
+                       wire_select="#ffffff"
+                       wire="#000000">
+        <space>
+          <ThemeSpaceGeneric header="#3b3b3b"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#3b3b3b"
+                             button_text="#8b8b8b"
+                             button_text_hi="#ffffff"
+                             button_title="#8b8b8b"
+                             text="#8b8b8b"
+                             text_hi="#ffffff"
+                             title="#8b8b8b"
+                             back="#3b3b3b">
+          </ThemeSpaceGeneric>
+        </space>
+        <space_list>
+          <ThemeSpaceListGeneric list="#a5a5a5"
+                                 list_text="#000000"
+                                 list_text_hi="#ffffff"
+                                 list_title="#000000">
+          </ThemeSpaceListGeneric>
+        </space_list>
+      </ThemeNodeEditor>
+    </node_editor>
+    <outliner>
+      <ThemeOutliner match="#245824"
+                     selected_highlight="#212844">
+        <space>
+          <ThemeSpaceGeneric header="#3b3b3b"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#cacaca"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#3a3a3a">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeOutliner>
+    </outliner>
+    <properties>
+      <ThemeProperties panel="#828282">
+        <space>
+          <ThemeSpaceGeneric 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="#6d6d6d"
+                             back="#3b3b3b">
+          </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"
+                           plugin_strip="#7e7e50"
+                           preview_back="#000000"
+                           scene_strip="#4e983e"
+                           transition_strip="#a25f6f"
+                           window_sliders="#a0a0a0">
+        <space>
+          <ThemeSpaceGeneric header="#3b3b3b"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#3b3b3b"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#848484"
+                             text_hi="#ffffff"
+                             title="#8b8b8b"
+                             back="#3b3b3b">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeSequenceEditor>
+    </sequence_editor>
+    <text_editor>
+      <ThemeTextEditor cursor="#ff0000"
+                       syntax_special="#5f5f00"
+                       line_numbers_background="#404040"
+                       selected_text="#c67777"
+                       syntax_builtin="#800050"
+                       syntax_comment="#006432"
+                       syntax_numbers="#0000c8"
+                       syntax_string="#640000">
+        <space>
+          <ThemeSpaceGeneric header="#3b3b3b"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#3b3b3b"
+                             button_text="#8b8b8b"
+                             button_text_hi="#ffffff"
+                             button_title="#8b8b8b"
+                             text="#b8b8b8"
+                             text_hi="#ffffff"
+                             title="#8b8b8b"
+                             back="#4b4b4b">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTextEditor>
+    </text_editor>
+    <timeline>
+      <ThemeTimeline frame_current="#60c040"
+                     grid="#464646">
+        <space>
+          <ThemeSpaceGeneric header="#3b3b3b"
+                             header_text="#000000"
+                             header_text_hi="#ffffff"
+                             button="#727272"
+                             button_text="#000000"
+                             button_text_hi="#ffffff"
+                             button_title="#000000"
+                             text="#848484"
+                             text_hi="#ffffff"
+                             title="#000000"
+                             back="#303030">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeTimeline>
+    </timeline>
+    <user_interface>
+      <ThemeUserInterface icon_alpha="1"
+                          icon_file="">
+        <wcol_box>
+          <ThemeWidgetColors inner="#3e3e3eff"
+                             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="#75582aae"
+                             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="#c28d45ff"
+                             item="#ffffffff"
+                             outline="#000000"
+                             shadedown="20"
+                             shadetop="0"
+                             show_shaded="TRUE"
+                             text="#b8b8b8"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_menu_item>
+        <wcol_menu>
+          <ThemeWidgetColors inner="#2f2f2fff"
+                             inner_sel="#464646ff"
+                             item="#777777ff"
+                             outline="#151515"
+                             shadedown="-5"
+                             shadetop="5"
+                             show_shaded="TRUE"
+                             text="#b8b8b8"
+                             text_sel="#cccccc">
+          </ThemeWidgetColors>
+        </wcol_menu>
+        <wcol_num>
+          <ThemeWidgetColors inner="#333333ff"
+                             inner_sel="#999999ff"
+                             item="#727272ff"
+                             outline="#1f1f1f"
+                             shadedown="0"
+                             shadetop="10"
+                             show_shaded="TRUE"
+                             text="#b8b8b8"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_num>
+        <wcol_option>
+          <ThemeWidgetColors inner="#3b3b3bff"
+                             inner_sel="#c28d45ff"
+                             item="#ffffffff"
+                             outline="#1f1f1f"
+                             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="#c28d45ff"
+                             item="#ffffffff"
+                             outline="#000000"
+                             shadedown="0"
+                             shadetop="25"
+                             show_shaded="TRUE"
+                             text="#b8b8b8"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_pulldown>
+        <wcol_radio>
+          <ThemeWidgetColors inner="#333333ff"
+                             inner_sel="#c28d45ff"
+                             item="#ffffffff"
+                             outline="#1f1f1f"
+                             shadedown="-5"
+                             shadetop="5"
+                             show_shaded="TRUE"
+                             text="#b8b8b8"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_radio>
+        <wcol_regular>
+          <ThemeWidgetColors inner="#999999ff"
+                             inner_sel="#646464ff"
+                             item="#191919ff"
+                             outline="#191919"
+                             shadedown="0"
+                             shadetop="0"
+                             show_shaded="FALSE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_regular>
+        <wcol_scroll>
+          <ThemeWidgetColors inner="#07070719"
+                             inner_sel="#646464b4"
+                             item="#2e2e2eff"
+                             outline="#1c1c1c"
+                             shadedown="0"
+                             shadetop="0"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_scroll>
+        <wcol_numslider>
+          <ThemeWidgetColors inner="#606068ff"
+                             inner_sel="#91919dff"
+                             item="#3a3a3aff"
+                             outline="#303030"
+                             shadedown="10"
+                             shadetop="-10"
+                             show_shaded="TRUE"
+                             text="#dfdfdf"
+                             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="#7a8287ff"
+                             inner_sel="#999999ff"
+                             item="#5a5a5aff"
+                             outline="#303030"
+                             shadedown="0"
+                             shadetop="5"
+                             show_shaded="TRUE"
+                             text="#000000"
+                             text_sel="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_text>
+        <wcol_toggle>
+          <ThemeWidgetColors inner="#333333ff"
+                             inner_sel="#c28d45ff"
+                             item="#191919ff"
+                             outline="#1f1f1f"
+                             shadedown="0"
+                             shadetop="5"
+                             show_shaded="TRUE"
+                             text="#b8b8b8"
+                             text_sel="#000000">
+          </ThemeWidgetColors>
+        </wcol_toggle>
+        <wcol_tool>
+          <ThemeWidgetColors inner="#333333ff"
+                             inner_sel="#c28d45ff"
+                             item="#191919ff"
+                             outline="#1f1f1f"
+                             shadedown="0"
+                             shadetop="10"
+                             show_shaded="TRUE"
+                             text="#b8b8b8"
+                             text_sel="#000000">
+          </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>
+        <space>
+          <ThemeSpaceGeneric 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">
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeUserPreferences>
+    </user_preferences>
+    <bone_color_sets>
+      <ThemeBoneColorSet active="#f70a0a"
+                         show_colored_constraints="FALSE"
+                         normal="#9a0000"
+                         select="#bd1111">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#fa9900"
+                         show_colored_constraints="FALSE"
+                         normal="#f74018"
+                         select="#f66913">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#83ef1d"
+                         show_colored_constraints="FALSE"
+                         normal="#1e9109"
+                         select="#59b70b">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#5ec1ef"
+                         show_colored_constraints="FALSE"
+                         normal="#0a3694"
+                         select="#3667df">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#f05d91"
+                         show_colored_constraints="FALSE"
+                         normal="#a9294e"
+                         select="#c1416a">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#8764d5"
+                         show_colored_constraints="FALSE"
+                         normal="#430c78"
+                         select="#543aa3">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#6fb6ab"
+                         show_colored_constraints="FALSE"
+                         normal="#24785a"
+                         select="#3c9579">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#9bc2cd"
+                         show_colored_constraints="FALSE"
+                         normal="#4b707c"
+                         select="#6a8691">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#f3ff00"
+                         show_colored_constraints="FALSE"
+                         normal="#f4c90c"
+                         select="#eec236">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#ffffff"
+                         show_colored_constraints="FALSE"
+                         normal="#1e2024"
+                         select="#484c56">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#d330d6"
+                         show_colored_constraints="FALSE"
+                         normal="#6f2f6a"
+                         select="#9845be">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#bbef5b"
+                         show_colored_constraints="FALSE"
+                         normal="#6c8e22"
+                         select="#7fb022">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#dedede"
+                         show_colored_constraints="FALSE"
+                         normal="#8d8d8d"
+                         select="#b0b0b0">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#bd6a11"
+                         show_colored_constraints="FALSE"
+                         normal="#834326"
+                         select="#8b5811">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#34622b"
+                         show_colored_constraints="FALSE"
+                         normal="#08310e"
+                         select="#1c430b">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+      <ThemeBoneColorSet active="#000000"
+                         show_colored_constraints="FALSE"
+                         normal="#000000"
+                         select="#000000">
+      </ThemeBoneColorSet>
+    </bone_color_sets>
+  </Theme>
+</bpy>
diff --git a/release/scripts/addons_contrib/presets/keyconfig/blender_2012_experimental.py b/release/scripts/addons_contrib/presets/keyconfig/blender_2012_experimental.py
new file mode 100644
index 0000000..757937a
--- /dev/null
+++ b/release/scripts/addons_contrib/presets/keyconfig/blender_2012_experimental.py
@@ -0,0 +1,816 @@
+""" An experimental new keymap for Blender.
+    Work in progress!
+"""
+import bpy
+
+###############################################################
+# Some configuration variables to toggle various ideas on/off #
+###############################################################
+DEVELOPER_HOTKEYS = False  # Weird hotkeys that only developers use
+
+WINDOW_TYPE_SWITCHING = False  # Shift-f# hotkeys for switching window types
+
+SUBSURF_RELATIVE = True  # Make subsurf hotkeys work by relative
+                         # shifting instead of absolute setting
+
+MAYA_STYLE_MANIPULATORS = False  # Maya-style "QWER" hotkeys for manipulators
+
+
+
+
+###############################
+# Custom operators/menus/etc. #
+###############################
+
+class ShiftSubsurfLevel(bpy.types.Operator):
+    ''' Shifts the subsurf level of the selected objects up or
+        down by the given amount.  Has maximum limit, to avoid
+        going crazy and running out of RAM.
+    '''
+    bl_idname = "object.shift_subsurf_level"
+    bl_label = "Shift Subsurf Level"
+
+    delta = bpy.props.IntProperty(name="Delta", description="Amount to increase/decrease the subsurf level.", default=1)
+    min = bpy.props.IntProperty(name="Minimum", description="The lowest subsurf level to shift to.", default=0)
+    max = bpy.props.IntProperty(name="Maximum", description="The highest subsurf level to shift to.", default=4)
+
+    @classmethod
+    def poll(cls, context):
+        return context.active_object is not None
+
+    def execute(self, context):
+        for obj in context.selected_objects:
+            # Find the last subsurf modifier in the stack
+            m = None
+            for mod in obj.modifiers:
+                if mod.type == "SUBSURF":
+                    m = mod
+
+            # Add a subsurf modifier if necessary
+            if not m and self.delta > 0:
+                m = obj.modifiers.new(name="Subsurf", type='SUBSURF')
+                m.levels = 0
+
+            # Adjust it's subsurf level
+            if m:
+                if self.delta > 0:
+                    if (m.levels + self.delta) <= self.max:
+                        m.levels += self.delta
+                elif self.delta < 0:
+                    if (m.levels + self.delta) >= self.min:
+                        m.levels += self.delta
+        return {'FINISHED'}
+bpy.utils.register_class(ShiftSubsurfLevel)
+
+
+class SetManipulator(bpy.types.Operator):
+    '''Set's the manipulator mode.'''
+    bl_idname = "view3d.manipulator_set"
+    bl_label = "Set Manipulator"
+    mode = bpy.props.EnumProperty(items=[("NONE", "None", ""),
+                                         ("TRANSLATE", "Translate", ""),
+                                         ("ROTATE", "Rotate", ""),
+                                         ("SCALE", "Scale", "")],
+                                         default="NONE")
+
+    def execute(self, context):
+        if self.mode == "NONE":
+            context.space_data.show_manipulator = False
+        elif self.mode == "TRANSLATE":
+            context.space_data.show_manipulator = True
+            context.space_data.use_manipulator_translate = True
+            context.space_data.use_manipulator_rotate = False
+            context.space_data.use_manipulator_scale = False
+        elif self.mode == "ROTATE":
+            context.space_data.show_manipulator = True
+            context.space_data.use_manipulator_translate = False
+            context.space_data.use_manipulator_rotate = True
+            context.space_data.use_manipulator_scale = False
+        elif self.mode == "SCALE":
+            context.space_data.show_manipulator = True
+            context.space_data.use_manipulator_translate = False
+            context.space_data.use_manipulator_rotate = False
+            context.space_data.use_manipulator_scale = True
+
+        return {'FINISHED'}
+bpy.utils.register_class(SetManipulator)
+
+
+class ModeSwitchMenu(bpy.types.Menu):
+    """ A menu for switching between object modes.
+    """
+    bl_idname = "OBJECT_MT_mode_switch_menu"
+    bl_label = "Switch Mode"
+
+    def draw(self, context):
+        layout = self.layout
+        layout.operator_enum("object.mode_set", "mode")
+
+bpy.utils.register_class(ModeSwitchMenu)
+# Work around
+bpy.ops.object.mode_set(mode='OBJECT', toggle=False)  # XXX, WHY IS THE KEYMAP DOING THIS? - campbell
+
+
+
+
+
+
+######################################################################
+######################################################################
+############### KEYMAP BEGINS ########################################
+######################################################################
+######################################################################
+wm = bpy.context.window_manager
+kc = wm.keyconfigs.new('Blender 2012 (experimental!)')
+
+
+##############
+# Map Window #
+##############
+km = kc.keymaps.new('Window', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+#------
+# Quit
+#------
+kmi = km.keymap_items.new('wm.quit_blender', 'Q', 'PRESS', ctrl=True)
+
+#----------------------
+# Operator search menu
+#----------------------
+kmi = km.keymap_items.new('wm.search_menu', 'TAB', 'PRESS')
+
+#-----------------
+# File management
+#-----------------
+# Open
+kmi = km.keymap_items.new('wm.read_homefile', 'N', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('wm.save_homefile', 'U', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('wm.open_mainfile', 'O', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('wm.link_append', 'O', 'PRESS', ctrl=True, alt=True)
+
+# Save
+kmi = km.keymap_items.new('wm.save_mainfile', 'S', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('wm.save_as_mainfile', 'S', 'PRESS', shift=True, ctrl=True)
+
+#------------------
+# Window switching
+#------------------
+if WINDOW_TYPE_SWITCHING:
+    kmi = km.keymap_items.new('wm.context_set_enum', 'F2', 'PRESS', shift=True)
+    kmi.properties.data_path = 'area.type'
+    kmi.properties.value = 'LOGIC_EDITOR'
+    kmi = km.keymap_items.new('wm.context_set_enum', 'F3', 'PRESS', shift=True)
+    kmi.properties.data_path = 'area.type'
+    kmi.properties.value = 'NODE_EDITOR'
+    kmi = km.keymap_items.new('wm.context_set_enum', 'F4', 'PRESS', shift=True)
+    kmi.properties.data_path = 'area.type'
+    kmi.properties.value = 'CONSOLE'
+    kmi = km.keymap_items.new('wm.context_set_enum', 'F5', 'PRESS', shift=True)
+    kmi.properties.data_path = 'area.type'
+    kmi.properties.value = 'VIEW_3D'
+    kmi = km.keymap_items.new('wm.context_set_enum', 'F6', 'PRESS', shift=True)
+    kmi.properties.data_path = 'area.type'
+    kmi.properties.value = 'GRAPH_EDITOR'
+    kmi = km.keymap_items.new('wm.context_set_enum', 'F7', 'PRESS', shift=True)
+    kmi.properties.data_path = 'area.type'
+    kmi.properties.value = 'PROPERTIES'
+    kmi = km.keymap_items.new('wm.context_set_enum', 'F8', 'PRESS', shift=True)
+    kmi.properties.data_path = 'area.type'
+    kmi.properties.value = 'SEQUENCE_EDITOR'
+    kmi = km.keymap_items.new('wm.context_set_enum', 'F9', 'PRESS', shift=True)
+    kmi.properties.data_path = 'area.type'
+    kmi.properties.value = 'OUTLINER'
+    kmi = km.keymap_items.new('wm.context_set_enum', 'F10', 'PRESS', shift=True)
+    kmi.properties.data_path = 'area.type'
+    kmi.properties.value = 'IMAGE_EDITOR'
+    kmi = km.keymap_items.new('wm.context_set_enum', 'F11', 'PRESS', shift=True)
+    kmi.properties.data_path = 'area.type'
+    kmi.properties.value = 'TEXT_EDITOR'
+    kmi = km.keymap_items.new('wm.context_set_enum', 'F12', 'PRESS', shift=True)
+    kmi.properties.data_path = 'area.type'
+    kmi.properties.value = 'DOPESHEET_EDITOR'
+
+#-------------
+# NDof Device
+#-------------
+kmi = km.keymap_items.new('wm.call_menu', 'NDOF_BUTTON_MENU', 'PRESS')
+kmi.properties.name = 'USERPREF_MT_ndof_settings'
+kmi = km.keymap_items.new('wm.ndof_sensitivity_change', 'NDOF_BUTTON_PLUS', 'PRESS')
+kmi.properties.decrease = False
+kmi.properties.fast = False
+kmi = km.keymap_items.new('wm.ndof_sensitivity_change', 'NDOF_BUTTON_MINUS', 'PRESS')
+kmi.properties.decrease = True
+kmi.properties.fast = False
+kmi = km.keymap_items.new('wm.ndof_sensitivity_change', 'NDOF_BUTTON_PLUS', 'PRESS', shift=True)
+kmi.properties.decrease = False
+kmi.properties.fast = True
+kmi = km.keymap_items.new('wm.ndof_sensitivity_change', 'NDOF_BUTTON_MINUS', 'PRESS', shift=True)
+kmi.properties.decrease = True
+kmi.properties.fast = True
+
+#------
+# Misc
+#------
+kmi = km.keymap_items.new('wm.window_fullscreen_toggle', 'F11', 'PRESS', alt=True)
+
+#-----------------------
+# Development/debugging
+#-----------------------
+if DEVELOPER_HOTKEYS:
+    kmi = km.keymap_items.new('wm.redraw_timer', 'T', 'PRESS', ctrl=True, alt=True)
+    kmi = km.keymap_items.new('wm.debug_menu', 'D', 'PRESS', ctrl=True, alt=True)
+
+#-----
+# ???
+#-----
+kmi = km.keymap_items.new('info.reports_display_update', 'TIMER', 'ANY', any=True)
+
+
+
+
+##################
+# 3D View Global #
+##################
+km = kc.keymaps.new('3D View', space_type='VIEW_3D', region_type='WINDOW', modal=False)
+
+#-----------------
+# View navigation
+#-----------------
+# ???
+kmi = km.keymap_items.new('view3d.rotate', 'MOUSEROTATE', 'ANY')
+kmi = km.keymap_items.new('view3d.smoothview', 'TIMER1', 'ANY', any=True)
+
+# Perspective/ortho
+kmi = km.keymap_items.new('view3d.view_persportho', 'NUMPAD_5', 'PRESS')
+
+# Camera view
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_0', 'PRESS')
+kmi.properties.type = 'CAMERA'
+
+# Basics with mouse
+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.dolly', 'MIDDLEMOUSE', 'PRESS', shift=True, ctrl=True)
+
+# Basics with mouse wheel
+kmi = km.keymap_items.new('view3d.zoom', 'WHEELINMOUSE', 'PRESS')
+kmi.properties.delta = 1
+kmi = km.keymap_items.new('view3d.zoom', 'WHEELOUTMOUSE', 'PRESS')
+kmi.properties.delta = -1
+kmi = km.keymap_items.new('view3d.view_pan', 'WHEELUPMOUSE', 'PRESS', ctrl=True)
+kmi.properties.type = 'PANRIGHT'
+kmi = km.keymap_items.new('view3d.view_pan', 'WHEELDOWNMOUSE', 'PRESS', ctrl=True)
+kmi.properties.type = 'PANLEFT'
+kmi = km.keymap_items.new('view3d.view_pan', 'WHEELUPMOUSE', 'PRESS', shift=True)
+kmi.properties.type = 'PANUP'
+kmi = km.keymap_items.new('view3d.view_pan', 'WHEELDOWNMOUSE', 'PRESS', shift=True)
+kmi.properties.type = 'PANDOWN'
+kmi = km.keymap_items.new('view3d.view_orbit', 'WHEELUPMOUSE', 'PRESS', ctrl=True, alt=True)
+kmi.properties.type = 'ORBITLEFT'
+kmi = km.keymap_items.new('view3d.view_orbit', 'WHEELDOWNMOUSE', 'PRESS', ctrl=True, alt=True)
+kmi.properties.type = 'ORBITRIGHT'
+kmi = km.keymap_items.new('view3d.view_orbit', 'WHEELUPMOUSE', 'PRESS', shift=True, alt=True)
+kmi.properties.type = 'ORBITUP'
+kmi = km.keymap_items.new('view3d.view_orbit', 'WHEELDOWNMOUSE', 'PRESS', shift=True, alt=True)
+kmi.properties.type = 'ORBITDOWN'
+
+# Basics with trackpad
+kmi = km.keymap_items.new('view3d.rotate', 'TRACKPADPAN', 'ANY', alt=True)
+kmi = km.keymap_items.new('view3d.move', 'TRACKPADPAN', 'ANY')
+kmi = km.keymap_items.new('view3d.zoom', 'TRACKPADZOOM', 'ANY')
+
+# Basics with numpad
+kmi = km.keymap_items.new('view3d.view_orbit', 'NUMPAD_8', 'PRESS')
+kmi.properties.type = 'ORBITUP'
+kmi = km.keymap_items.new('view3d.view_orbit', 'NUMPAD_2', 'PRESS')
+kmi.properties.type = 'ORBITDOWN'
+kmi = km.keymap_items.new('view3d.view_orbit', 'NUMPAD_4', 'PRESS')
+kmi.properties.type = 'ORBITLEFT'
+kmi = km.keymap_items.new('view3d.view_orbit', 'NUMPAD_6', 'PRESS')
+kmi.properties.type = 'ORBITRIGHT'
+kmi = km.keymap_items.new('view3d.view_pan', 'NUMPAD_8', 'PRESS', ctrl=True)
+kmi.properties.type = 'PANUP'
+kmi = km.keymap_items.new('view3d.view_pan', 'NUMPAD_2', 'PRESS', ctrl=True)
+kmi.properties.type = 'PANDOWN'
+kmi = km.keymap_items.new('view3d.view_pan', 'NUMPAD_4', 'PRESS', ctrl=True)
+kmi.properties.type = 'PANLEFT'
+kmi = km.keymap_items.new('view3d.view_pan', 'NUMPAD_6', 'PRESS', ctrl=True)
+kmi.properties.type = 'PANRIGHT'
+kmi = km.keymap_items.new('view3d.zoom', 'NUMPAD_PLUS', 'PRESS')
+kmi.properties.delta = 1
+kmi = km.keymap_items.new('view3d.zoom', 'NUMPAD_MINUS', 'PRESS')
+kmi.properties.delta = -1
+
+# Zoom in/out alternatives
+kmi = km.keymap_items.new('view3d.zoom', 'EQUAL', 'PRESS', ctrl=True)
+kmi.properties.delta = 1
+kmi = km.keymap_items.new('view3d.zoom', 'MINUS', 'PRESS', ctrl=True)
+kmi.properties.delta = -1
+
+# Front/Right/Top/Back/Left/Bottom
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS')
+kmi.properties.type = 'FRONT'
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS')
+kmi.properties.type = 'RIGHT'
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS')
+kmi.properties.type = 'TOP'
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS', ctrl=True)
+kmi.properties.type = 'BACK'
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS', ctrl=True)
+kmi.properties.type = 'LEFT'
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS', ctrl=True)
+kmi.properties.type = 'BOTTOM'
+
+# Selection-aligned Front/Right/Top/Back/Left/Bottom
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS', shift=True)
+kmi.properties.type = 'FRONT'
+kmi.properties.align_active = True
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS', shift=True)
+kmi.properties.type = 'RIGHT'
+kmi.properties.align_active = True
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS', shift=True)
+kmi.properties.type = 'TOP'
+kmi.properties.align_active = True
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_1', 'PRESS', shift=True, ctrl=True)
+kmi.properties.type = 'BACK'
+kmi.properties.align_active = True
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_3', 'PRESS', shift=True, ctrl=True)
+kmi.properties.type = 'LEFT'
+kmi.properties.align_active = True
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NUMPAD_7', 'PRESS', shift=True, ctrl=True)
+kmi.properties.type = 'BOTTOM'
+kmi.properties.align_active = True
+
+# NDOF Device
+kmi = km.keymap_items.new('view3d.ndof_orbit', 'NDOF_BUTTON_MENU', 'ANY')
+kmi = km.keymap_items.new('view3d.ndof_pan', 'NDOF_BUTTON_MENU', 'ANY', shift=True)
+kmi = km.keymap_items.new('view3d.view_selected', 'NDOF_BUTTON_FIT', 'PRESS')
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NDOF_BUTTON_FRONT', 'PRESS')
+kmi.properties.type = 'FRONT'
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NDOF_BUTTON_BACK', 'PRESS')
+kmi.properties.type = 'BACK'
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NDOF_BUTTON_LEFT', 'PRESS')
+kmi.properties.type = 'LEFT'
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NDOF_BUTTON_RIGHT', 'PRESS')
+kmi.properties.type = 'RIGHT'
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NDOF_BUTTON_TOP', 'PRESS')
+kmi.properties.type = 'TOP'
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NDOF_BUTTON_BOTTOM', 'PRESS')
+kmi.properties.type = 'BOTTOM'
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NDOF_BUTTON_FRONT', 'PRESS', shift=True)
+kmi.properties.type = 'FRONT'
+kmi.properties.align_active = True
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NDOF_BUTTON_RIGHT', 'PRESS', shift=True)
+kmi.properties.type = 'RIGHT'
+kmi.properties.align_active = True
+kmi = km.keymap_items.new('view3d.viewnumpad', 'NDOF_BUTTON_TOP', 'PRESS', shift=True)
+kmi.properties.type = 'TOP'
+kmi.properties.align_active = True
+
+# Fly mode
+kmi = km.keymap_items.new('view3d.fly', 'F', 'PRESS', shift=True)
+
+# Misc
+kmi = km.keymap_items.new('view3d.view_selected', 'NUMPAD_PERIOD', 'PRESS')
+kmi = km.keymap_items.new('view3d.view_center_cursor', 'NUMPAD_PERIOD', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('view3d.zoom_camera_1_to_1', 'NUMPAD_ENTER', 'PRESS', shift=True)
+kmi = km.keymap_items.new('view3d.view_center_camera', 'HOME', 'PRESS')
+kmi = km.keymap_items.new('view3d.view_all', 'HOME', 'PRESS')
+kmi.properties.center = False
+kmi = km.keymap_items.new('view3d.view_all', 'C', 'PRESS', shift=True)
+kmi.properties.center = True
+
+#-----------
+# Selection
+#-----------
+# Click select
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS')
+kmi.properties.extend = False
+kmi.properties.center = False
+kmi.properties.enumerate = False
+kmi.properties.object = False
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True)
+kmi.properties.extend = True
+kmi.properties.center = False
+kmi.properties.enumerate = False
+kmi.properties.object = False
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', ctrl=True)
+kmi.properties.extend = False
+kmi.properties.center = True
+kmi.properties.enumerate = False
+kmi.properties.object = True
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', alt=True)
+kmi.properties.extend = False
+kmi.properties.center = False
+kmi.properties.enumerate = True
+kmi.properties.object = False
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True)
+kmi.properties.extend = True
+kmi.properties.center = True
+kmi.properties.enumerate = False
+kmi.properties.object = False
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True)
+kmi.properties.extend = False
+kmi.properties.center = True
+kmi.properties.enumerate = True
+kmi.properties.object = False
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, alt=True)
+kmi.properties.extend = True
+kmi.properties.center = False
+kmi.properties.enumerate = True
+kmi.properties.object = False
+kmi = km.keymap_items.new('view3d.select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi.properties.extend = True
+kmi.properties.center = True
+kmi.properties.enumerate = True
+kmi.properties.object = False
+
+# Box select
+kmi = km.keymap_items.new('view3d.select_border', 'B', 'PRESS')
+
+# Lasso select
+kmi = km.keymap_items.new('view3d.select_lasso', 'EVT_TWEAK_A', 'ANY', ctrl=True)
+kmi.properties.deselect = False
+kmi = km.keymap_items.new('view3d.select_lasso', 'EVT_TWEAK_A', 'ANY', shift=True, ctrl=True)
+kmi.properties.deselect = True
+
+# Paint select
+kmi = km.keymap_items.new('view3d.select_circle', 'C', 'PRESS')
+
+#-------------
+# Manipulator
+#-------------
+kmi = km.keymap_items.new('view3d.manipulator', 'LEFTMOUSE', 'PRESS', any=True)
+kmi.properties.release_confirm = True
+
+if MAYA_STYLE_MANIPULATORS:
+    kmi = km.keymap_items.new('view3d.manipulator_set', 'Q', 'PRESS')
+    kmi.properties.mode = 'NONE'
+    kmi = km.keymap_items.new('view3d.manipulator_set', 'W', 'PRESS')
+    kmi.properties.mode = 'TRANSLATE'
+    kmi = km.keymap_items.new('view3d.manipulator_set', 'E', 'PRESS')
+    kmi.properties.mode = 'ROTATE'
+    kmi = km.keymap_items.new('view3d.manipulator_set', 'R', 'PRESS')
+    kmi.properties.mode = 'SCALE'
+else:
+    kmi = km.keymap_items.new('wm.context_toggle', 'SPACE', 'PRESS', ctrl=True)
+    kmi.properties.data_path = 'space_data.show_manipulator'
+
+#-----------------------
+# Transforms via hotkey
+#-----------------------
+# Grab, rotate scale
+kmi = km.keymap_items.new('transform.translate', 'G', 'PRESS')
+kmi = km.keymap_items.new('transform.translate', 'EVT_TWEAK_S', 'ANY')
+kmi = km.keymap_items.new('transform.rotate', 'R', 'PRESS')
+kmi = km.keymap_items.new('transform.resize', 'S', 'PRESS')
+
+# Mirror, shear, warp, to-sphere
+kmi = km.keymap_items.new('transform.mirror', 'M', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('transform.shear', 'S', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi = km.keymap_items.new('transform.warp', 'W', 'PRESS', shift=True)
+kmi = km.keymap_items.new('transform.tosphere', 'S', 'PRESS', shift=True, alt=True)
+
+#-------------------------
+# Transform texture space
+#-------------------------
+kmi = km.keymap_items.new('transform.translate', 'T', 'PRESS', shift=True)
+kmi.properties.texture_space = True
+kmi = km.keymap_items.new('transform.resize', 'T', 'PRESS', shift=True, alt=True)
+kmi.properties.texture_space = True
+
+#------------------
+# Transform spaces
+#------------------
+kmi = km.keymap_items.new('transform.select_orientation', 'SPACE', 'PRESS', alt=True)
+kmi = km.keymap_items.new('transform.create_orientation', 'SPACE', 'PRESS', ctrl=True, alt=True)
+kmi.properties.use = True
+
+#----------
+# Snapping
+#----------
+kmi = km.keymap_items.new('wm.context_toggle', 'TAB', 'PRESS', shift=True)
+kmi.properties.data_path = 'tool_settings.use_snap'
+kmi = km.keymap_items.new('transform.snap_type', 'TAB', 'PRESS', shift=True, ctrl=True)
+
+#---------------
+# Snapping Menu
+#---------------
+kmi = km.keymap_items.new('wm.call_menu', 'S', 'PRESS', shift=True)
+kmi.properties.name = 'VIEW3D_MT_snap'
+
+#-----------
+# 3d cursor
+#-----------
+kmi = km.keymap_items.new('view3d.cursor3d', 'ACTIONMOUSE', 'PRESS')
+
+#-------------------
+# Toggle local view
+#-------------------
+kmi = km.keymap_items.new('view3d.localview', 'NUMPAD_SLASH', 'PRESS')
+
+#--------
+# Layers
+#--------
+kmi = km.keymap_items.new('view3d.layers', 'ACCENT_GRAVE', 'PRESS')
+kmi.properties.nr = 0
+kmi = km.keymap_items.new('view3d.layers', 'ONE', 'PRESS', any=True)
+kmi.properties.nr = 1
+kmi = km.keymap_items.new('view3d.layers', 'TWO', 'PRESS', any=True)
+kmi.properties.nr = 2
+kmi = km.keymap_items.new('view3d.layers', 'THREE', 'PRESS', any=True)
+kmi.properties.nr = 3
+kmi = km.keymap_items.new('view3d.layers', 'FOUR', 'PRESS', any=True)
+kmi.properties.nr = 4
+kmi = km.keymap_items.new('view3d.layers', 'FIVE', 'PRESS', any=True)
+kmi.properties.nr = 5
+kmi = km.keymap_items.new('view3d.layers', 'SIX', 'PRESS', any=True)
+kmi.properties.nr = 6
+kmi = km.keymap_items.new('view3d.layers', 'SEVEN', 'PRESS', any=True)
+kmi.properties.nr = 7
+kmi = km.keymap_items.new('view3d.layers', 'EIGHT', 'PRESS', any=True)
+kmi.properties.nr = 8
+kmi = km.keymap_items.new('view3d.layers', 'NINE', 'PRESS', any=True)
+kmi.properties.nr = 9
+kmi = km.keymap_items.new('view3d.layers', 'ZERO', 'PRESS', any=True)
+kmi.properties.nr = 10
+
+#------------------
+# Viewport drawing
+#------------------
+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', 'PRESS', alt=True)
+kmi.properties.data_path = 'space_data.viewport_shade'
+kmi.properties.value_1 = 'TEXTURED'
+kmi.properties.value_2 = 'SOLID'
+
+#-------------
+# Pivot point
+#-------------
+kmi = km.keymap_items.new('wm.context_set_enum', 'COMMA', 'PRESS')
+kmi.properties.data_path = 'space_data.pivot_point'
+kmi.properties.value = 'BOUNDING_BOX_CENTER'
+kmi = km.keymap_items.new('wm.context_set_enum', 'COMMA', 'PRESS', ctrl=True)
+kmi.properties.data_path = 'space_data.pivot_point'
+kmi.properties.value = 'MEDIAN_POINT'
+kmi = km.keymap_items.new('wm.context_toggle', 'COMMA', 'PRESS', alt=True)
+kmi.properties.data_path = 'space_data.use_pivot_point_align'
+kmi = km.keymap_items.new('wm.context_set_enum', 'PERIOD', 'PRESS')
+kmi.properties.data_path = 'space_data.pivot_point'
+kmi.properties.value = 'CURSOR'
+kmi = km.keymap_items.new('wm.context_set_enum', 'PERIOD', 'PRESS', ctrl=True)
+kmi.properties.data_path = 'space_data.pivot_point'
+kmi.properties.value = 'INDIVIDUAL_ORIGINS'
+kmi = km.keymap_items.new('wm.context_set_enum', 'PERIOD', 'PRESS', alt=True)
+kmi.properties.data_path = 'space_data.pivot_point'
+kmi.properties.value = 'ACTIVE_ELEMENT'
+
+#------
+# Misc
+#------
+kmi = km.keymap_items.new('view3d.clip_border', 'B', 'PRESS', alt=True)
+kmi = km.keymap_items.new('view3d.zoom_border', 'B', 'PRESS', shift=True)
+kmi = km.keymap_items.new('view3d.render_border', 'B', 'PRESS', shift=True)
+kmi = km.keymap_items.new('view3d.camera_to_view', 'NUMPAD_0', 'PRESS', ctrl=True, alt=True)
+kmi = km.keymap_items.new('view3d.object_as_camera', 'NUMPAD_0', 'PRESS', ctrl=True)
+
+
+
+#######################
+# Transform Modal Map #
+#######################
+km = kc.keymaps.new('Transform Modal Map', space_type='EMPTY', region_type='WINDOW', modal=True)
+
+# Cancel
+kmi = km.keymap_items.new_modal('CANCEL', 'ESC', 'PRESS', any=True)
+
+# Confirm
+kmi = km.keymap_items.new_modal('CONFIRM', 'LEFTMOUSE', 'PRESS', any=True)
+kmi = km.keymap_items.new_modal('CONFIRM', 'RET', 'PRESS', any=True)
+kmi = km.keymap_items.new_modal('CONFIRM', 'NUMPAD_ENTER', 'PRESS', any=True)
+
+# Snapping
+kmi = km.keymap_items.new_modal('SNAP_TOGGLE', 'TAB', 'PRESS', shift=True)
+kmi = km.keymap_items.new_modal('SNAP_INV_ON', 'LEFT_CTRL', 'PRESS', any=True)
+kmi = km.keymap_items.new_modal('SNAP_INV_OFF', 'LEFT_CTRL', 'RELEASE', any=True)
+kmi = km.keymap_items.new_modal('SNAP_INV_ON', 'RIGHT_CTRL', 'PRESS', any=True)
+kmi = km.keymap_items.new_modal('SNAP_INV_OFF', 'RIGHT_CTRL', 'RELEASE', any=True)
+kmi = km.keymap_items.new_modal('ADD_SNAP', 'A', 'PRESS')
+kmi = km.keymap_items.new_modal('REMOVE_SNAP', 'A', 'PRESS', alt=True)
+
+# Proportional edit adjusting
+kmi = km.keymap_items.new_modal('PROPORTIONAL_SIZE_UP', 'PAGE_UP', 'PRESS')
+kmi = km.keymap_items.new_modal('PROPORTIONAL_SIZE_DOWN', 'PAGE_DOWN', 'PRESS')
+kmi = km.keymap_items.new_modal('PROPORTIONAL_SIZE_UP', 'WHEELDOWNMOUSE', 'PRESS')
+kmi = km.keymap_items.new_modal('PROPORTIONAL_SIZE_DOWN', 'WHEELUPMOUSE', 'PRESS')
+
+# Auto-ik adjusting
+kmi = km.keymap_items.new_modal('AUTOIK_CHAIN_LEN_UP', 'PAGE_UP', 'PRESS', shift=True)
+kmi = km.keymap_items.new_modal('AUTOIK_CHAIN_LEN_DOWN', 'PAGE_DOWN', 'PRESS', shift=True)
+kmi = km.keymap_items.new_modal('AUTOIK_CHAIN_LEN_UP', 'WHEELDOWNMOUSE', 'PRESS', shift=True)
+kmi = km.keymap_items.new_modal('AUTOIK_CHAIN_LEN_DOWN', 'WHEELUPMOUSE', 'PRESS', shift=True)
+
+# Constraining to axes
+kmi = km.keymap_items.new_modal('AXIS_X', 'X', 'PRESS')
+kmi = km.keymap_items.new_modal('AXIS_Y', 'Y', 'PRESS')
+kmi = km.keymap_items.new_modal('AXIS_Z', 'Z', 'PRESS')
+kmi = km.keymap_items.new_modal('PLANE_X', 'X', 'PRESS', shift=True)
+kmi = km.keymap_items.new_modal('PLANE_Y', 'Y', 'PRESS', shift=True)
+kmi = km.keymap_items.new_modal('PLANE_Z', 'Z', 'PRESS', shift=True)
+
+# ???
+#kmi = km.keymap_items.new_modal('TRANSLATE', 'G', 'PRESS')
+#kmi = km.keymap_items.new_modal('ROTATE', 'R', 'PRESS')
+#kmi = km.keymap_items.new_modal('RESIZE', 'S', 'PRESS')
+
+
+
+####################
+# Object Non-modal #
+####################
+km = kc.keymaps.new('Object Non-modal', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+
+#-----------------------
+# Object mode switching
+#-----------------------
+kmi = km.keymap_items.new('wm.call_menu', 'SPACE', 'PRESS')
+kmi.properties.name = 'OBJECT_MT_mode_switch_menu'
+
+
+
+#############
+# Mesh Edit #
+#############
+km = kc.keymaps.new('Mesh', space_type='EMPTY', region_type='WINDOW', modal=False)
+
+#---------------------------------
+# Vertex/Edge/Face mode switching
+#---------------------------------
+kmi = km.keymap_items.new('wm.call_menu', 'TAB', 'PRESS', ctrl=True)
+kmi.properties.name = 'VIEW3D_MT_edit_mesh_select_mode'
+
+#-----------
+# Selection
+#-----------
+kmi = km.keymap_items.new('mesh.loop_select', 'SELECTMOUSE', 'PRESS', alt=True)
+kmi.properties.extend = False
+kmi = km.keymap_items.new('mesh.loop_select', 'SELECTMOUSE', 'PRESS', shift=True, alt=True)
+kmi.properties.extend = True
+kmi = km.keymap_items.new('mesh.edgering_select', 'SELECTMOUSE', 'PRESS', ctrl=True, alt=True)
+kmi.properties.extend = False
+kmi = km.keymap_items.new('mesh.edgering_select', 'SELECTMOUSE', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi.properties.extend = True
+kmi = km.keymap_items.new('mesh.select_shortest_path', 'SELECTMOUSE', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('mesh.select_all', 'A', 'PRESS')
+kmi.properties.action = 'TOGGLE'
+kmi = km.keymap_items.new('mesh.select_all', 'I', 'PRESS', ctrl=True)
+kmi.properties.action = 'INVERT'
+kmi = km.keymap_items.new('mesh.select_more', 'NUMPAD_PLUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('mesh.select_less', 'NUMPAD_MINUS', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('mesh.select_non_manifold', 'M', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi = km.keymap_items.new('mesh.select_linked', 'L', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('mesh.select_linked_pick', 'L', 'PRESS')
+kmi.properties.deselect = False
+kmi = km.keymap_items.new('mesh.select_linked_pick', 'L', 'PRESS', shift=True)
+kmi.properties.deselect = True
+kmi = km.keymap_items.new('mesh.faces_select_linked_flat', 'F', 'PRESS', shift=True, ctrl=True, alt=True)
+kmi = km.keymap_items.new('mesh.select_similar', 'G', 'PRESS', shift=True)
+
+#----------------------
+# Proportional editing
+#----------------------
+kmi = km.keymap_items.new('wm.context_toggle_enum', 'O', 'PRESS')
+kmi.properties.data_path = 'tool_settings.proportional_edit'
+kmi.properties.value_1 = 'DISABLED'
+kmi.properties.value_2 = 'ENABLED'
+kmi = km.keymap_items.new('wm.context_cycle_enum', 'O', 'PRESS', shift=True)
+kmi.properties.data_path = 'tool_settings.proportional_edit_falloff'
+kmi = km.keymap_items.new('wm.context_toggle_enum', 'O', 'PRESS', alt=True)
+kmi.properties.data_path = 'tool_settings.proportional_edit'
+kmi.properties.value_1 = 'DISABLED'
+kmi.properties.value_2 = 'CONNECTED'
+
+#--------
+# Hiding
+#--------
+kmi = km.keymap_items.new('mesh.hide', 'H', 'PRESS')
+kmi.properties.unselected = False
+kmi = km.keymap_items.new('mesh.hide', 'H', 'PRESS', shift=True)
+kmi.properties.unselected = True
+kmi = km.keymap_items.new('mesh.reveal', 'H', 'PRESS', alt=True)
+
+#--------
+# Create
+#--------
+kmi = km.keymap_items.new('mesh.loopcut_slide', 'R', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('mesh.knifetool', 'K', 'PRESS')
+kmi = km.keymap_items.new('view3d.edit_mesh_extrude_move_normal', 'E', 'PRESS')
+kmi = km.keymap_items.new('wm.call_menu', 'E', 'PRESS', alt=True)
+kmi.properties.name = 'VIEW3D_MT_edit_mesh_extrude'
+kmi = km.keymap_items.new('mesh.edge_face_add', 'F', 'PRESS')
+kmi = km.keymap_items.new('mesh.vert_connect', 'J', 'PRESS')
+kmi = km.keymap_items.new('mesh.spin', 'R', 'PRESS', alt=True)
+kmi = km.keymap_items.new('mesh.fill', 'F', 'PRESS', alt=True)
+kmi = km.keymap_items.new('mesh.beautify_fill', 'F', 'PRESS', shift=True, alt=True)
+kmi = km.keymap_items.new('mesh.duplicate_move', 'D', 'PRESS', shift=True)
+kmi = km.keymap_items.new('wm.call_menu', 'A', 'PRESS', shift=True)
+kmi.properties.name = 'INFO_MT_mesh_add'
+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
+
+#--------
+# Delete
+#--------
+kmi = km.keymap_items.new('wm.call_menu', 'X', 'PRESS')
+kmi.properties.name = 'VIEW3D_MT_edit_mesh_delete'
+kmi = km.keymap_items.new('wm.call_menu', 'DEL', 'PRESS')
+kmi.properties.name = 'VIEW3D_MT_edit_mesh_delete'
+
+#----------
+# Separate
+#----------
+kmi = km.keymap_items.new('mesh.rip_move', 'V', 'PRESS')
+kmi = km.keymap_items.new('mesh.split', 'Y', 'PRESS')
+kmi = km.keymap_items.new('mesh.separate', 'P', 'PRESS')
+
+#-------
+# Merge
+#-------
+kmi = km.keymap_items.new('mesh.merge', 'M', 'PRESS', alt=True)
+
+#-----------
+# Transform
+#-----------
+kmi = km.keymap_items.new('transform.shrink_fatten', 'S', 'PRESS', alt=True)
+kmi = km.keymap_items.new('transform.edge_crease', 'E', 'PRESS', shift=True)
+kmi = km.keymap_items.new('mesh.quads_convert_to_tris', 'T', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('mesh.quads_convert_to_tris', 'T', 'PRESS', shift=True, ctrl=True)
+kmi.properties.use_beauty = False
+kmi = km.keymap_items.new('mesh.tris_convert_to_quads', 'J', 'PRESS', alt=True)
+
+#------------
+# Tool Menus
+#------------
+kmi = km.keymap_items.new('wm.call_menu', 'W', 'PRESS')
+kmi.properties.name = 'VIEW3D_MT_edit_mesh_specials'
+kmi = km.keymap_items.new('wm.call_menu', 'F', 'PRESS', ctrl=True)
+kmi.properties.name = 'VIEW3D_MT_edit_mesh_faces'
+kmi = km.keymap_items.new('wm.call_menu', 'E', 'PRESS', ctrl=True)
+kmi.properties.name = 'VIEW3D_MT_edit_mesh_edges'
+kmi = km.keymap_items.new('wm.call_menu', 'V', 'PRESS', ctrl=True)
+kmi.properties.name = 'VIEW3D_MT_edit_mesh_vertices'
+
+#------
+# UV's
+#------
+kmi = km.keymap_items.new('wm.call_menu', 'U', 'PRESS')
+kmi.properties.name = 'VIEW3D_MT_uv_map'
+
+#-------------------
+# Calculate normals
+#-------------------
+kmi = km.keymap_items.new('mesh.normals_make_consistent', 'N', 'PRESS', ctrl=True)
+kmi.properties.inside = False
+kmi = km.keymap_items.new('mesh.normals_make_consistent', 'N', 'PRESS', shift=True, ctrl=True)
+kmi.properties.inside = True
+
+#-------------------
+# Subsurf shortcuts
+#-------------------
+
+if SUBSURF_RELATIVE:
+    kmi = km.keymap_items.new('object.shift_subsurf_level', 'EQUAL', 'CLICK')
+    kmi.properties.delta = 1
+    kmi.properties.max = 4
+    kmi = km.keymap_items.new('object.shift_subsurf_level', 'MINUS', 'CLICK')
+    kmi.properties.delta = -1
+    kmi.properties.min = 0
+else:
+    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
+
+#---------
+# Rigging
+#---------
+kmi = km.keymap_items.new('object.vertex_parent_set', 'P', 'PRESS', ctrl=True)
+kmi = km.keymap_items.new('wm.call_menu', 'H', 'PRESS', ctrl=True)
+kmi.properties.name = 'VIEW3D_MT_hook'
+kmi = km.keymap_items.new('wm.call_menu', 'G', 'PRESS', ctrl=True)
+kmi.properties.name = 'VIEW3D_MT_vertex_group'
diff --git a/release/scripts/addons_contrib/render_time.py b/release/scripts/addons_contrib/render_time.py
new file mode 100644
index 0000000..7647196
--- /dev/null
+++ b/release/scripts/addons_contrib/render_time.py
@@ -0,0 +1,172 @@
+# ***** 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": "Render Time Estimation",
+    "author": "Jason van Gumster (Fweeb)",
+    "version": (0, 5, 0),
+    "blender": (2, 62, 1),
+    "location": "UV/Image Editor > Properties > Image",
+    "description": "Estimates the time to complete rendering on animations",
+    "warning": "Does not work on OpenGL renders",
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Render/Render_Time_Estimation",
+    "tracker_url": "http://projects.blender.org/tracker/index.php?func=detail&aid=30452&group_id=153&atid=467",
+    "category": "Render"}
+
+
+import bpy, time
+from bpy.app.handlers import persistent
+from datetime import timedelta
+import blf
+
+
+timer = {"average": 0.0, "total": 0.0, "time_start": 0.0, "is_rendering": False, "hud": False}
+
+def set_rendering(scene):
+    timer["is_rendering"] = True
+
+ at persistent
+def unset_rendering(scene):
+    timer["is_rendering"] = False
+
+ at persistent
+def start_timer(scene):
+    set_rendering(scene)
+
+    if scene.frame_current == scene.frame_start:
+        timer["average"] = 0.0
+        timer["total"] = 0.0
+
+    timer["time_start"] = time.time()
+
+ at persistent
+def end_timer(scene):
+    render_time = time.time() - timer["time_start"]
+    timer["total"] += render_time
+    if scene.frame_current == scene.frame_start:
+        timer["average"] = render_time
+    else:
+        timer["average"] = (timer["average"] + render_time) / 2
+
+    print("Total render time: " + str(timedelta(seconds = timer["total"])))
+    print("Estimated completion: " + str(timedelta(seconds = (timer["average"] * (scene.frame_end - scene.frame_current)))))
+
+
+# UI
+
+def image_panel_rendertime(self, context):
+    scene = context.scene
+    layout = self.layout
+
+    if context.space_data.image is not None and context.space_data.image.type == 'RENDER_RESULT':
+        layout.label(text = "Total render time: " + str(timedelta(seconds = timer["total"])))
+
+        if timer["is_rendering"] and scene.frame_current != scene.frame_start:
+            layout.label(text = "Estimated completion: " + str(timedelta(seconds = (timer["average"] * (scene.frame_end - scene.frame_current)))))
+
+def draw_callback_px(self, context):
+    scene = context.scene
+
+    font_id = 0  # XXX, need to find out how best to get this.
+
+    # draw some text
+    blf.position(font_id, 15, 30, 0)
+    blf.size(font_id, 18, 72)
+    blf.enable(font_id, blf.SHADOW)
+    blf.shadow(font_id, 5, 0.0, 0.0, 0.0, 1.0)
+
+    blf.draw(font_id, "Total render time " + str(timedelta(seconds = timer["total"])))
+    if timer["is_rendering"] and scene.frame_current != scene.frame_start:
+        blf.position(font_id, 15, 12, 0)
+        blf.draw(font_id, "Estimated completion: " + str(timedelta(seconds = (timer["average"] * (scene.frame_end - scene.frame_current)))))
+
+    # restore defaults
+    blf.disable(font_id, blf.SHADOW)
+
+class RenderTimeHUD(bpy.types.Operator):
+    bl_idname = "view2d.rendertime_hud"
+    bl_label = "Display Render Times"
+    last_activity = 'NONE'
+
+    def modal(self, context, event):
+        if context.area:
+            context.area.tag_redraw()
+
+        #if event.type in {'ESC'}:
+        if timer["hud"] == False:
+            context.region.callback_remove(self._handle)
+            return {'CANCELLED'}
+
+        return {'PASS_THROUGH'}
+
+    def invoke(self, context, event):
+        if context.area.type == 'IMAGE_EDITOR':
+            if timer["hud"] == False:
+                context.window_manager.modal_handler_add(self)
+
+                # Add the region OpenGL drawing callback
+                self._handle = context.region.callback_add(draw_callback_px, (self, context), 'POST_PIXEL')
+                timer["hud"] = True
+                return {'RUNNING_MODAL'}
+            else:
+                timer["hud"] = False
+                return {'CANCELLED'}
+        else:
+            self.report({'WARNING'}, "UV/Image Editor not found, cannot run operator")
+            return {'CANCELLED'}
+
+def display_hud(self, context):
+    scene = context.scene
+    layout = self.layout
+    layout.operator("view2d.rendertime_hud")
+
+
+# Registration
+
+def register():
+    bpy.app.handlers.render_complete.append(unset_rendering)
+    bpy.app.handlers.render_cancel.append(unset_rendering)
+    bpy.app.handlers.render_pre.append(start_timer)
+    bpy.app.handlers.render_post.append(end_timer)
+    bpy.types.IMAGE_PT_image_properties.append(image_panel_rendertime)
+    bpy.utils.register_class(RenderTimeHUD)
+    bpy.types.IMAGE_HT_header.append(display_hud)
+
+    # Keymapping      XXX TODO - This doesn't work for some reason
+    #kc = bpy.context.window_manager.keyconfigs.addon
+    #km = kc.keymaps.new(name = "View 2D", space_type = 'IMAGE_EDITOR')
+    #kmi = km.keymap_items.new("view2d.rendertime_hud", 'E', 'PRESS')
+    #kmi.active = True
+
+def unregister():
+    #kc = bpy.context.window_manager.keyconfigs.addon
+    #km = kc.keymaps["View 2D"]
+    #km.keymap_items.remove(km.keymap_items["view2d.rendertime_hud"])
+
+    bpy.types.IMAGE_HT_header.remove(display_hud)
+    bpy.utils.register_class(RenderTimeHUD)
+    bpy.app.handlers.render_pre.remove(start_timer)
+    bpy.app.handlers.render_post.remove(end_timer)
+    bpy.app.handlers.render_cancel.append(unset_rendering)
+    bpy.app.handlers.render_complete.remove(unset_rendering)
+    bpy.types.IMAGE_PT_image_properties.remove(image_panel_rendertime)
+
+if __name__ == '__main__':
+    register()
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 51ce0f9..e79df1f 100644
--- a/release/scripts/addons_contrib/space_view3d_enhanced_3d_cursor.py
+++ b/release/scripts/addons_contrib/space_view3d_enhanced_3d_cursor.py
@@ -21,9 +21,8 @@ bl_info = {
     "name": "Enhanced 3D Cursor",
     "description": "Cursor history and bookmarks; drag/snap cursor.",
     "author": "dairin0d",
-    "version": (2, 8, 1),
-    "blender": (2, 6, 0),
-    "api": 35853, # just copied from some Blender 2.59 script # 31236 ?
+    "version": (2, 8, 5),
+    "blender": (2, 6, 3),
     "location": "View3D > Action mouse; F10; Properties panel",
     "warning": "",
     "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
@@ -34,12 +33,60 @@ bl_info = {
 #============================================================================#
 
 """
+ATTENTION:
+somewhere around 45447 revision object.ray_cast() starts conflicting with
+mesh.update(calc_tessface=True) -- at least when invoked within one
+operator cycle, object.ray_cast() crashes if object's tessfaces were
+update()d earlier in the code. However, not update()ing the meshes
+seems to work fine -- ray_cast() does its job, and it's possible to
+access tessfaces afterwards.
+mesh.calc_tessface() -- ? crashes too
+
+Seems like now axes are stored in columns instead of rows.
+Perhaps it's better to write utility functions to create/decompose
+matrices from/to 3D-vector axes and a translation component
+
+Breakdown:
+    Addon registration
+    Keymap utils
+    Various utils (e.g. find_region)
+    OpenGL; drawing utils
+    Non-undoable data storage
+    Cursor utils
+    Stick-object
+    Cursor monitor
+    Addon's GUI
+    Addon's properties
+    Addon's operators
+    ID Block emulator
+    Mesh cache
+    Snap utils
+    View3D utils
+    Transform orientation / coordinate system utils
+    Generic transform utils
+    Main operator
+    ...
+.
+
+First step is to re-make the cursor addon (make something usable first).
+CAD tools should be done without the hassle.
+
 TODO:
+    strip trailing space? (one of campbellbarton's commits did that)
+    
     IDEAS:
+        - implement 'GIMBAL' orientation (euler axes)
+        - mini-Z-buffer in the vicinity of mouse coords (using raycasts)
+        - an orientation that points towards cursor
+          (from current selection to cursor)
+        - user coordinate systems (using e.g. empties to store different
+          systems; when user switches to such UCS, origin will be set to
+          "cursor", cursor will be sticked to the empty, and a custom
+          transform orientation will be aligned with the empty)
+          - "Stick" transform orientation that is always aligned with the
+            object cursor is "sticked" to?
         - make 'NORMAL' system also work for bones?
-        - an option to select which normals/tangentials
-          are displayed? (only N, only T1, N+T1, all,
-          only meaningful)
+        - user preferences? (stored in a file)
         - create spline/edge_mesh from history?
         - API to access history/bookmarks/operators from other scripts?
         - Snap selection to bookmark?
@@ -73,13 +120,14 @@ Borrowed code/logic:
 import bpy
 import bgl
 import blf
+import bmesh
 
 from mathutils import Vector, Matrix, Quaternion, Euler
 
 from mathutils.geometry import (intersect_line_sphere,
                                 intersect_ray_tri,
                                 barycentric_transform,
-                                tesselate_polygon,
+                                tessellate_polygon,
                                 intersect_line_line,
                                 intersect_line_plane,
                                 )
@@ -440,13 +488,28 @@ class EnhancedSetCursor(bpy.types.Operator):
                 self.process_axis_input(event)
             
             if event.alt:
+                jc = (", " if tfm_opts.use_comma_separator else "\t")
                 if event.type in self.key_map["copy_axes"]:
-                    wm.clipboard = "\t".join(self.get_axes_text(True))
+                    wm.clipboard = jc.join(self.get_axes_text(True))
                 elif event.type in self.key_map["cut_axes"]:
-                    wm.clipboard = "\t".join(self.get_axes_text(True))
+                    wm.clipboard = jc.join(self.get_axes_text(True))
                     self.set_axes_text("\t\t\t")
                 elif event.type in self.key_map["paste_axes"]:
-                    self.set_axes_text(wm.clipboard, True)
+                    if jc == "\t":
+                        self.set_axes_text(wm.clipboard, True)
+                    else:
+                        jc = jc.strip()
+                        ttext = ""
+                        brackets = 0
+                        for c in wm.clipboard:
+                            if c in "[{(":
+                                brackets += 1
+                            elif c in "]})":
+                                brackets -= 1
+                            if (brackets == 0) and (c == jc):
+                                c = "\t"
+                            ttext += c
+                        self.set_axes_text(ttext, True)
             
             if event.type in self.key_coordsys_map:
                 new_orientation = self.key_coordsys_map[event.type]
@@ -889,7 +952,17 @@ class EnhancedSetCursor(bpy.types.Operator):
     def gizmo_scale(self, pos):
         return self.gizmo_distance(pos) * self.gizmo_factor
     
-    def draw_3d(self):
+    def check_v3d_local(self, context):
+        csu_v3d = self.csu.space_data
+        v3d = context.space_data
+        if csu_v3d.local_view:
+            return csu_v3d != v3d
+        return v3d.local_view
+    
+    def draw_3d(self, context):
+        if self.check_v3d_local(context):
+            return
+        
         if time.time() < (self.click_start + self.click_period):
             return
         
@@ -991,7 +1064,7 @@ class EnhancedSetCursor(bpy.types.Operator):
                 bgl.glColor4f(0, 1, 0, 0.5)
                 
                 co = sui.potential_snap_elements
-                tris = tesselate_polygon([co])
+                tris = tessellate_polygon([co])
                 bgl.glBegin(bgl.GL_TRIANGLES)
                 for tri in tris:
                     for vi in tri:
@@ -1000,6 +1073,9 @@ class EnhancedSetCursor(bpy.types.Operator):
                 bgl.glEnd()
     
     def draw_2d(self, context):
+        if self.check_v3d_local(context):
+            return
+        
         r = context.region
         rv3d = context.region_data
         
@@ -1089,6 +1165,9 @@ class EnhancedSetCursor(bpy.types.Operator):
         bgl.glLineWidth(1)
     
     def draw_axes_coords(self, context, header_size):
+        if self.check_v3d_local(context):
+            return
+        
         if time.time() < (self.click_start + self.click_period):
             return
         
@@ -1128,7 +1207,7 @@ class EnhancedSetCursor(bpy.types.Operator):
             axes_text = self.get_axes_text()
             
             for i in range(3):
-                color = tet.text
+                color = tet.space.text
                 alpha = (1.0 if self.allowed_axes[i] else 0.5)
                 text = axis_prefix + axis_names[i] + " : "
                 axis_cells.append(TextCell(text, color, alpha))
@@ -1139,7 +1218,7 @@ class EnhancedSetCursor(bpy.types.Operator):
                     else:
                         color = tet.syntax_string
                 else:
-                    color = tet.text
+                    color = tet.space.text
                 text = axes_text[i]
                 coord_cells.append(TextCell(text, color))
         except Exception as e:
@@ -1150,7 +1229,7 @@ class EnhancedSetCursor(bpy.types.Operator):
         try:
             snap_type = self.su.implementation.snap_type
             if snap_type is None:
-                color = tet.text
+                color = tet.space.text
             elif (not self.use_object_centers) or \
                     (snap_type == 'INCREMENT'):
                 color = tet.syntax_numbers
@@ -1162,13 +1241,13 @@ class EnhancedSetCursor(bpy.types.Operator):
             mode_cells.append(TextCell(text, color))
             
             if self.csu.tou.is_custom:
-                color = tet.text
+                color = tet.space.text
             else:
                 color = tet.syntax_builtin
             text = self.csu.tou.get_title()
             mode_cells.append(TextCell(text, color))
             
-            color = tet.text
+            color = tet.space.text
             text = self.csu.get_pivot_name(raw=True)
             if self.use_object_centers:
                 color = tet.syntax_special
@@ -1187,7 +1266,7 @@ class EnhancedSetCursor(bpy.types.Operator):
             xyz_margin = 16
             blend_margin = 32
             
-            color = tet.back
+            color = tet.space.back
             bgl.glColor4f(color[0], color[1], color[2], 1.0)
             draw_rect(0, 0, hdr_w, hdr_h)
             
@@ -1252,7 +1331,7 @@ class EnhancedSetCursor(bpy.types.Operator):
             bgl.glEnable(bgl.GL_BLEND)
             bgl.glShadeModel(bgl.GL_SMOOTH)
             gl_enable(bgl.GL_SMOOTH, True)
-            color = tet.back
+            color = tet.space.back
             bgl.glBegin(bgl.GL_TRIANGLE_STRIP)
             bgl.glColor4f(color[0], color[1], color[2], 1.0)
             bgl.glVertex2i(0, 0)
@@ -1281,7 +1360,7 @@ class EnhancedSetCursor(bpy.types.Operator):
             bgl.glEnable(bgl.GL_BLEND)
             bgl.glShadeModel(bgl.GL_SMOOTH)
             gl_enable(bgl.GL_SMOOTH, True)
-            color = tet.back
+            color = tet.space.back
             bgl.glBegin(bgl.GL_TRIANGLE_STRIP)
             bgl.glColor4f(color[0], color[1], color[2], 1.0)
             bgl.glVertex2i(0, 0)
@@ -1340,14 +1419,13 @@ class EnhancedSetCursor(bpy.types.Operator):
                 self.get_normal_params(tfm_opts, dest_point)
             
             snapshot = bpy.data.objects.new("normal_snapshot", None)
+            
             if tangential:
-                #snapshot.matrix_world = Matrix(
-                #    (x.to_4d(), y.to_4d(), _z.to_4d(), p0.to_4d()))
-                snapshot.matrix_world = Matrix(
-                    (_z.to_4d(), y.to_4d(), x.to_4d(), p0.to_4d()))
+                m = MatrixCompose(_z, y, x, p0)
             else:
-                snapshot.matrix_world = Matrix(
-                    (_x.to_4d(), y.to_4d(), z.to_4d(), p0.to_4d()))
+                m = MatrixCompose(_x, y, z, p0)
+            snapshot.matrix_world = m
+            
             snapshot.empty_draw_type = 'SINGLE_ARROW'
             #snapshot.empty_draw_type = 'ARROWS'
             #snapshot.layers = [True] * 20 # ?
@@ -1513,7 +1591,7 @@ def gather_particles(**kwargs):
             if context_mode == 'EDIT_MESH':
                 # We currently don't need to create particles
                 # for these; vertices are enough now.
-                #for face in active_object.data.faces:
+                #for face in active_object.data.polygons:
                 #    pass
                 #for edge in active_object.data.edges:
                 #    pass
@@ -1552,7 +1630,8 @@ def gather_particles(**kwargs):
             elif context_mode == 'POSE':
                 active_bone = active_object.data.bones.active
                 if active_bone:
-                    active_element = active_bone.matrix_local.translation.to_3d()
+                    active_element = active_bone.\
+                        matrix_local.translation.to_3d()
                     active_element = active_object.\
                         matrix_world * active_element
                 
@@ -1616,7 +1695,7 @@ def gather_particles(**kwargs):
                 else:
                     t1 = Vector((0, 0, 1)).cross(normal)
                 t2 = t1.cross(normal)
-                normal_system = Matrix((t1, t2, normal))
+                normal_system = MatrixCompose(t1, t2, normal)
                 
                 median, bbox_center = calc_median_bbox_pivots(positions)
                 median = m * median
@@ -1638,9 +1717,9 @@ def gather_particles(**kwargs):
                 bbox_center = active_element
                 
                 normal_system = active_object.matrix_world.to_3x3()
-                normal_system[0].normalize()
-                normal_system[1].normalize()
-                normal_system[2].normalize()
+                normal_system.col[0].normalize()
+                normal_system.col[1].normalize()
+                normal_system.col[2].normalize()
             
             if context_mode not in {'EDIT_ARMATURE', 'POSE'}:
                 bpy.ops.object.mode_set(mode=prev_mode)
@@ -1653,8 +1732,6 @@ def gather_particles(**kwargs):
                 active_element = active_object.\
                     matrix_world.to_translation()
         
-        # These are equivalent (though scene's is slower)
-        #cursor_pos = get_cursor_location(scene=scene)
         cursor_pos = get_cursor_location(v3d=space_data)
     
     #elif area_type == 'IMAGE_EDITOR':
@@ -2088,18 +2165,19 @@ class View3DUtility:
         
         if rv3d.view_perspective == 'CAMERA':
             d = self.get_direction()
-            v3d.camera.matrix_world.translation[:3] = pos - d * rv3d.view_distance
+            v3d.camera.matrix_world.translation = pos - d * rv3d.view_distance
         else:
             if v3d.lock_object:
                 obj, bone = self._get_lock_obj_bone()
                 if bone:
                     try:
-                        bone.matrix.translation[:3] = obj.matrix_world.inverted() * pos
+                        bone.matrix.translation = \
+                            obj.matrix_world.inverted() * pos
                     except:
                         # this is some degenerate object
-                        bone.matrix.translation[:3] = pos
+                        bone.matrix.translation = pos
                 else:
-                    obj.matrix_world.translation[:3] = pos
+                    obj.matrix_world.translation = pos
             elif v3d.lock_cursor:
                 set_cursor_location(pos, v3d=v3d)
             else:
@@ -2135,7 +2213,7 @@ class View3DUtility:
     def get_matrix(self):
         m = self.get_rotation().to_matrix()
         m.resize_4x4()
-        m.translation[:3] = self.get_viewpoint()
+        m.translation = self.get_viewpoint()
         return m
     
     def get_point(self, xy, pos):
@@ -2266,11 +2344,12 @@ class SnapUtilityBase:
                 if not use_object_centers:
                     self.potential_snap_elements = [
                         (obj.matrix_world * obj.data.vertices[vi].co)
-                        for vi in obj.data.faces[face_id].vertices
+                        for vi in obj.data.tessfaces[face_id].vertices
                     ]
                 
                 if use_object_centers:
-                    self.extra_snap_points = [obj.matrix_world.to_translation()]
+                    self.extra_snap_points = \
+                        [obj.matrix_world.to_translation()]
                 elif alt_snap:
                     pse = self.potential_snap_elements
                     n = len(pse)
@@ -2333,13 +2412,16 @@ class SnapUtilityBase:
                     direction.rotate(sys_matrix)
                     
                     if axes_of_freedom == 2:
-                        # Constrained in one axis. Find intersection with plane.
+                        # Constrained in one axis.
+                        # Find intersection with plane.
                         i_p = intersect_line_plane(a, b, start, direction)
                         if i_p is not None:
                             pos = i_p
                     elif axes_of_freedom == 1:
-                        # Constrained in two axes. Find nearest point to line.
-                        i_p = intersect_line_line(a, b, start, start + direction)
+                        # Constrained in two axes.
+                        # Find nearest point to line.
+                        i_p = intersect_line_line(a, b, start,
+                                                  start + direction)
                         if i_p is not None:
                             pos = i_p[1]
         #end if do_raycast
@@ -2388,8 +2470,12 @@ class Snap3DUtility(SnapUtilityBase):
         self.bbox_cache = {}#collections.OrderedDict()
         self.sys_matrix_key = [0.0] * 9
         
-        vertex_coords, faces = prepare_gridbox_mesh(subdiv=2)
-        mesh = create_mesh(vertex_coords, faces)
+        bm = prepare_gridbox_mesh(subdiv=2)
+        mesh = bpy.data.meshes.new(tmp_name)
+        bm.to_mesh(mesh)
+        mesh.update(calc_tessface=True)
+        #mesh.calc_tessface()
+        
         self.bbox_obj = self.cache.create_temporary_mesh_obj(mesh, Matrix())
         self.bbox_obj.hide = True
         self.bbox_obj.draw_type = 'WIRE'
@@ -2451,7 +2537,7 @@ class Snap3DUtility(SnapUtilityBase):
                 sys_matrix = m.copy()
                 try:
                     sys_matrix_inv = sys_matrix.inverted()
-                except:
+                except Exception:
                     # this is some degenerate system
                     sys_matrix_inv = Matrix()
             m_combined = sys_matrix_inv * m
@@ -2478,13 +2564,10 @@ class Snap3DUtility(SnapUtilityBase):
         
         half = (bbox[1] - bbox[0]) * 0.5
         
-        sys_matrix3 = sys_matrix.to_3x3()
-        
-        m = Matrix()
-        m[0][:3] = sys_matrix3 * Vector((half[0], 0, 0))
-        m[1][:3] = sys_matrix3 * Vector((0, half[1], 0))
-        m[2][:3] = sys_matrix3 * Vector((0, 0, half[2]))
-        m.translation[:3] = sys_matrix * (bbox[0] + half)
+        m = MatrixCompose(half[0], half[1], half[2])
+        m = sys_matrix.to_3x3() * m
+        m.resize_4x4()
+        m.translation = sys_matrix * (bbox[0] + half)
         self.bbox_obj.matrix_world = m
         
         return self.bbox_obj
@@ -2645,17 +2728,18 @@ class Snap3DUtility(SnapUtilityBase):
         
         _ln = ln.copy()
         
-        face = obj.data.faces[face_id]
+        face = obj.data.tessfaces[face_id]
         L = None
         t1 = None
         
         if self.snap_type == 'VERTEX' or self.snap_type == 'VOLUME':
             for v0 in face.vertices:
-                p0 = obj.data.vertices[v0].co
+                v = obj.data.vertices[v0]
+                p0 = v.co
                 l = (lp - p0).length_squared
                 if (L is None) or (l < L):
                     p = p0
-                    ln = obj.data.vertices[v0].normal.copy()
+                    ln = v.normal.copy()
                     #t1 = ln.cross(_ln)
                     L = l
             
@@ -2724,7 +2808,7 @@ class Snap3DUtility(SnapUtilityBase):
                         L = l
             '''
         
-        n = ln#.copy()
+        n = ln.copy()
         n.rotate(m)
         n.normalize()
         
@@ -2743,16 +2827,12 @@ class Snap3DUtility(SnapUtilityBase):
         t2 = t1.cross(n)
         t2.normalize()
         
-        matrix = Matrix()
-        matrix[0][:3] = t1
-        matrix[1][:3] = t2
-        matrix[2][:3] = n
-        matrix.translation[:3] = p
+        matrix = MatrixCompose(t1, t2, n, p)
         
         return (matrix, face_id, obj, orig_obj)
     
     def interpolate_normal(self, obj, face_id, p, orig, ray):
-        face = obj.data.faces[face_id]
+        face = obj.data.tessfaces[face_id]
         
         use_smooth = face.use_smooth
         if self.interpolation == 'NEVER':
@@ -2779,7 +2859,7 @@ class Snap3DUtility(SnapUtilityBase):
             for vi in face.vertices]
         
         if len(face.vertices) != 3:
-            tris = tesselate_polygon([co])
+            tris = tessellate_polygon([co])
             for tri in tris:
                 i0, i1, i2 = tri
                 if intersect_ray_tri(co[i0], co[i1], co[i2], ray, orig):
@@ -2871,6 +2951,9 @@ class MeshCache:
                 if self.edit_object is None:
                     self.edit_object = self.__convert(
                                 obj, True, False, False)
+                    #self.edit_object.data.update(calc_tessface=True)
+                    #self.edit_object.data.calc_tessface()
+                    self.edit_object.data.calc_normals()
                 return self.edit_object
         
         # A usual object. Cached data will suffice.
@@ -2889,6 +2972,11 @@ class MeshCache:
             rco = None
         
         self.object_cache[obj] = rco
+        if rco:
+            #rco.data.update(calc_tessface=True)
+            #rco.data.calc_tessface()
+            rco.data.calc_normals()
+            pass
         
         return rco
     
@@ -3143,6 +3231,12 @@ class TransformExtraOptionsProp(bpy.types.PropertyGroup):
         default=8,
         min=2,
         max=64)
+    use_comma_separator = bpy.props.BoolProperty(
+        name="Use comma separator",
+        description="Use comma separator when copying/pasting"\
+                    "coordinate values (instead of Tab character)",
+        default=True,
+        options={'HIDDEN'})
 
 # ===== 3D VECTOR LOCATION ===== #
 class LocationProp(bpy.types.PropertyGroup):
@@ -3187,10 +3281,19 @@ def update_history_id(self, context):
     
     pos = history.get_pos()
     if pos is not None:
+        # History doesn't depend on view (?)
         cursor_pos = get_cursor_location(scene=scene)
+        
+        if CursorHistoryProp.update_cursor_on_id_change:
+            # Set cursor position anyway (we're changing v3d's
+            # cursor, which may be separate from scene's)
+            # This, however, should be done cautiously
+            # from scripts, since, e.g., CursorMonitor
+            # can supply wrong context -> cursor will be set
+            # in a different view than required
+            set_cursor_location(pos, v3d=context.space_data)
+        
         if pos != cursor_pos:
-            set_cursor_location(pos, scene=scene)
-            
             if (history.current_id == 0) and (history.last_id <= 1):
                 history.last_id = 1
             else:
@@ -3200,6 +3303,8 @@ def update_history_id(self, context):
 class CursorHistoryProp(bpy.types.PropertyGroup):
     max_size_limit = 500
     
+    update_cursor_on_id_change = True
+    
     show_trace = bpy.props.BoolProperty(
         name="Trace",
         description="Show history trace",
@@ -3264,7 +3369,7 @@ class CursorHistoryProp(bpy.types.PropertyGroup):
         bgl.glColor4f(1.0, 0.75, 0.5, 1.0)
         bgl.glVertex3f(p[0], p[1], p[2])
         
-        p = get_cursor_location(scene=scene)
+        p = get_cursor_location(v3d=context.space_data)
         bgl.glColor4f(1.0, 1.0, 0.25, 1.0)
         bgl.glVertex3f(p[0], p[1], p[2])
         
@@ -3315,10 +3420,11 @@ class NewCursor3DBookmark(bpy.types.Operator):
         
         bookmark = library.bookmarks.add(name=self.name)
         
-        cusor_pos = get_cursor_location(scene=context.scene)
+        cusor_pos = get_cursor_location(v3d=context.space_data)
         
         try:
-            bookmark.pos = library.convert_from_abs(cusor_pos, True)
+            bookmark.pos = library.convert_from_abs(context.space_data,
+                                                    cusor_pos, True)
         except Exception as exc:
             self.report('ERROR_INVALID_CONTEXT', exc.args[0])
             return {'CANCELLED'}
@@ -3362,10 +3468,11 @@ class OverwriteCursor3DBookmark(bpy.types.Operator):
         if not bookmark:
             return {'CANCELLED'}
         
-        cusor_pos = get_cursor_location(scene=context.scene)
+        cusor_pos = get_cursor_location(v3d=context.space_data)
         
         try:
-            bookmark.pos = library.convert_from_abs(cusor_pos, True)
+            bookmark.pos = library.convert_from_abs(context.space_data,
+                                                    cusor_pos, True)
         except Exception as exc:
             self.report('ERROR_INVALID_CONTEXT', exc.args[0])
             return {'CANCELLED'}
@@ -3394,8 +3501,9 @@ class RecallCursor3DBookmark(bpy.types.Operator):
             return {'CANCELLED'}
         
         try:
-            bookmark_pos = library.convert_to_abs(bookmark.pos, True)
-            set_cursor_location(bookmark_pos, scene=context.scene)
+            bookmark_pos = library.convert_to_abs(context.space_data,
+                                                  bookmark.pos, True)
+            set_cursor_location(bookmark_pos, v3d=context.space_data)
         except Exception as exc:
             self.report('ERROR_INVALID_CONTEXT', exc.args[0])
             return {'CANCELLED'}
@@ -3423,14 +3531,16 @@ class SwapCursor3DBookmark(bpy.types.Operator):
         if not bookmark:
             return {'CANCELLED'}
         
-        cusor_pos = get_cursor_location(scene=context.scene)
+        cusor_pos = get_cursor_location(v3d=context.space_data)
         
         try:
-            bookmark_pos = library.convert_to_abs(bookmark.pos, True)
+            bookmark_pos = library.convert_to_abs(context.space_data,
+                                                  bookmark.pos, True)
             
-            set_cursor_location(bookmark_pos, scene=context.scene)
+            set_cursor_location(bookmark_pos, v3d=context.space_data)
             
-            bookmark.pos = library.convert_from_abs(cusor_pos, True,
+            bookmark.pos = library.convert_from_abs(context.space_data,
+                                                    cusor_pos, True,
                 use_history=False)
         except Exception as exc:
             self.report('ERROR_INVALID_CONTEXT', exc.args[0])
@@ -3467,8 +3577,8 @@ class AddEmptyAtCursor3DBookmark(bpy.types.Operator):
             return {'CANCELLED'}
         
         try:
-            #bookmark_pos = library.convert_to_abs(bookmark.pos, True)
-            matrix = library.get_matrix(use_history=False, warn=True)
+            matrix = library.get_matrix(use_history=False,
+                                        v3d=context.space_data, warn=True)
             bookmark_pos = matrix * bookmark.pos
         except Exception as exc:
             self.report('ERROR_INVALID_CONTEXT', exc.args[0])
@@ -3477,7 +3587,6 @@ class AddEmptyAtCursor3DBookmark(bpy.types.Operator):
         name = "{}.{}".format(library.name, bookmark.name)
         obj = bpy.data.objects.new(name, None)
         obj.matrix_world = to_matrix4x4(matrix, bookmark_pos)
-        #obj.empty_draw_type = 'SPHERE'
         context.scene.objects.link(obj)
         
         """
@@ -3530,7 +3639,7 @@ class BookmarkLibraryProp(bpy.types.PropertyGroup):
         options={'HIDDEN'})
     
     # Returned None means "operation is not aplicable"
-    def get_matrix(self, use_history, warn=True, **kwargs):
+    def get_matrix(self, use_history, v3d, warn=True, **kwargs):
         #particles, csu = gather_particles(**kwargs)
         
         # Ensure we have relevant CSU (Blender will crash
@@ -3542,7 +3651,7 @@ class BookmarkLibraryProp(bpy.types.PropertyGroup):
         if self.offset:
             # history? or keep separate for each scene?
             if not use_history:
-                csu.source_pos = get_cursor_location(scene=csu.tou.scene)
+                csu.source_pos = get_cursor_location(v3d=v3d)
             else:
                 settings = find_settings()
                 history = settings.history
@@ -3586,19 +3695,16 @@ class BookmarkLibraryProp(bpy.types.PropertyGroup):
         
         return csu.get_matrix(sys_name, self.offset, pivot)
     
-    def convert_to_abs(self, pos, warn=False, **kwargs):
-        if "use_history" in kwargs:
-            del kwargs["use_history"]
-        matrix = self.get_matrix(False, warn, **kwargs)
+    def convert_to_abs(self, v3d, pos, warn=False, **kwargs):
+        kwargs.pop("use_history", None)
+        matrix = self.get_matrix(False, v3d, warn, **kwargs)
         if not matrix:
             return None
         return matrix * pos
     
-    def convert_from_abs(self, pos, warn=False, **kwargs):
-        use_history = kwargs.get("use_history", True)
-        if "use_history" in kwargs:
-            del kwargs["use_history"]
-        matrix = self.get_matrix(use_history, warn, **kwargs)
+    def convert_from_abs(self, v3d, pos, warn=False, **kwargs):
+        use_history = kwargs.pop("use_history", True)
+        matrix = self.get_matrix(use_history, v3d, warn, **kwargs)
         if not matrix:
             return None
         
@@ -3616,7 +3722,7 @@ class BookmarkLibraryProp(bpy.types.PropertyGroup):
         if not bookmark:
             return
         
-        pos = self.convert_to_abs(bookmark.pos)
+        pos = self.convert_to_abs(context.space_data, bookmark.pos)
         if pos is None:
             return
         
@@ -3825,6 +3931,7 @@ class TransformExtraOptions(bpy.types.Panel):
         layout.prop(tfm_opts, "use_relative_coords")
         layout.prop(tfm_opts, "snap_only_to_solid")
         layout.prop(tfm_opts, "snap_interpolate_normals_mode", text="")
+        layout.prop(tfm_opts, "use_comma_separator")
         #layout.prop(tfm_opts, "snap_element_screen_size")
 
 class Cursor3DTools(bpy.types.Panel):
@@ -3844,7 +3951,7 @@ class Cursor3DTools(bpy.types.Panel):
         # If addon is enabled by default, the new scene
         # created on Blender startup will have disabled
         # standard Cursor3D behavior. However, if user
-        # creates new scene, somewhy Cursor3D is active
+        # creates new scene, somehow Cursor3D is active
         # as if nothing happened xD
         update_keymap(True)
         #=============================================#
@@ -3942,14 +4049,14 @@ class SetCursorDialog(bpy.types.Operator):
         self.matrix = self.csu.get_matrix()
         
         pos = self.matrix * self.pos
-        set_cursor_location(pos, scene=context.scene)
+        set_cursor_location(pos, v3d=context.space_data)
         
         return {'FINISHED'}
 
     def invoke(self, context, event):
         scene = context.scene
         
-        cursor_pos = get_cursor_location(scene=scene)
+        cursor_pos = get_cursor_location(v3d=context.space_data)
         
         particles, self.csu = gather_particles(context=context)
         self.csu.source_pos = cursor_pos
@@ -3980,6 +4087,126 @@ class SetCursorDialog(bpy.types.Operator):
         row.prop(tfm_opts, "use_relative_coords", text="Relative")
         row.prop(v3d, "transform_orientation", text="")
 
+class AlignOrientation(bpy.types.Operator):
+    bl_idname = "view3d.align_orientation"
+    bl_label = "Align Orientation"
+    bl_description = "Rotates active object to match axis of current "\
+        "orientation to axis of another orientation"
+    
+    axes_items = [
+        ('X', 'X', 'X axis'),
+        ('Y', 'Y', 'Y axis'),
+        ('Z', 'Z', 'Z axis'),
+        ('-X', '-X', '-X axis'),
+        ('-Y', '-Y', '-Y axis'),
+        ('-Z', '-Z', '-Z axis'),
+    ]
+    
+    axes_items_ = [
+        ('X', 'X', 'X axis'),
+        ('Y', 'Y', 'Y axis'),
+        ('Z', 'Z', 'Z axis'),
+        (' ', ' ', 'Same as source axis'),
+    ]
+    
+    axes_ids = {'X':0, 'Y':1, 'Z':2}
+    
+    def get_orients(self, context):
+        orients = []
+        orients.append(('GLOBAL', "Global", ""))
+        orients.append(('LOCAL', "Local", ""))
+        orients.append(('GIMBAL', "Gimbal", ""))
+        orients.append(('NORMAL', "Normal", ""))
+        orients.append(('VIEW', "View", ""))
+        
+        for orientation in context.scene.orientations:
+            name = orientation.name
+            orients.append((name, name, ""))
+        
+        return orients
+    
+    src_axis = bpy.props.EnumProperty(default='Z', items=axes_items,
+                                      name="Initial axis")
+    #src_orient = bpy.props.EnumProperty(default='GLOBAL', items=get_orients)
+    
+    dest_axis = bpy.props.EnumProperty(default=' ', items=axes_items_,
+                                       name="Final axis")
+    dest_orient = bpy.props.EnumProperty(items=get_orients,
+                                         name="Final orientation")
+    
+    @classmethod
+    def poll(cls, context):
+        return (context.area.type == 'VIEW_3D') and context.object
+    
+    def execute(self, context):
+        obj = context.object
+        scene = context.scene
+        v3d = context.space_data
+        rv3d = context.region_data
+        
+        tou = TransformOrientationUtility(scene, v3d, rv3d)
+        
+        src_matrix = tou.get_matrix(v3d.transform_orientation)
+        src_axes = MatrixDecompose(src_matrix)
+        src_axis_name = self.src_axis
+        if src_axis_name.startswith("-"):
+            src_axis_name = src_axis_name[1:]
+            src_axis = -src_axes[self.axes_ids[src_axis_name]]
+        else:
+            src_axis = src_axes[self.axes_ids[src_axis_name]]
+        
+        dest_matrix = tou.get_matrix(self.dest_orient)
+        dest_axes = MatrixDecompose(dest_matrix)
+        if self.dest_axis != ' ':
+            dest_axis_name = self.dest_axis
+        else:
+            dest_axis_name = src_axis_name
+        dest_axis = dest_axes[self.axes_ids[dest_axis_name]]
+        
+        q = src_axis.rotation_difference(dest_axis)
+        
+        m = obj.matrix_world.to_3x3()
+        m.rotate(q)
+        m.resize_4x4()
+        m.translation = obj.matrix_world.translation.copy()
+        
+        obj.matrix_world = m
+        
+        bpy.ops.ed.undo_push(message="Align Orientation")
+        
+        return {'FINISHED'}
+    
+    # ATTENTION!
+    # This _must_ be a dialog, because with 'UNDO' option
+    # the last selected orientation may revert to the previous state
+    def invoke(self, context, event):
+        wm = context.window_manager
+        return wm.invoke_props_dialog(self)
+
+class CopyOrientation(bpy.types.Operator):
+    bl_idname = "view3d.copy_orientation"
+    bl_label = "Copy Orientation"
+    bl_description = "Makes a copy of current orientation"
+    
+    def execute(self, context):
+        scene = context.scene
+        v3d = context.space_data
+        rv3d = context.region_data
+        
+        tou = TransformOrientationUtility(scene, v3d, rv3d)
+        
+        orient = create_transform_orientation(scene,
+            name=tou.get()+".copy", matrix=tou.get_matrix())
+        
+        tou.set(orient.name)
+        
+        return {'FINISHED'}
+
+def transform_orientations_panel_extension(self, context):
+    row = self.layout.row()
+    row.operator("view3d.align_orientation", text="Align")
+    row.operator("view3d.copy_orientation", text="Copy")
+
 # ===== CURSOR MONITOR ===== #
 class CursorMonitor(bpy.types.Operator):
     '''Monitor changes in cursor location and write to history'''
@@ -4030,8 +4257,8 @@ class CursorMonitor(bpy.types.Operator):
             # (OR addon was disabled)
             return self.cancel(context)
         
-        # Somewhy after addod re-registration this permanently
-        # becomes False
+        # Somewhy after addon re-registration
+        # this permanently becomes False
         CursorMonitor.is_running = True
         
         if self.update_storage(runtime_settings):
@@ -4058,11 +4285,15 @@ class CursorMonitor(bpy.types.Operator):
             self.just_initialized = False
         # ================== #
         
+        # Seems like recalc_csu() in this place causes trouble
+        # if space type is switched from 3D to e.g. UV
+        '''
         tfm_operator = CursorDynamicSettings.active_transform_operator
         if tfm_operator:
             CursorDynamicSettings.csu = tfm_operator.csu
         else:
             CursorDynamicSettings.recalc_csu(context, event.value)
+        '''
         
         return {'PASS_THROUGH'}
     
@@ -4076,6 +4307,7 @@ class CursorMonitor(bpy.types.Operator):
         last_locations = {}
         
         for scene in bpy.data.scenes:
+            # History doesn't depend on view (?)
             curr_pos = get_cursor_location(scene=scene)
             
             last_locations[scene.name] = curr_pos
@@ -4132,7 +4364,11 @@ class CursorMonitor(bpy.types.Operator):
                 history.entries.remove(last_id)
             
             # make sure the most recent history entry is displayed
+            
+            CursorHistoryProp.update_cursor_on_id_change = False
             history.current_id = 0
+            CursorHistoryProp.update_cursor_on_id_change = True
+            
             history.curr_id = history.current_id
             history.last_id = 1
             
@@ -4172,6 +4408,7 @@ class CursorMonitor(bpy.types.Operator):
         #self._timer = context.window_manager. \
         #    event_timer_add(0.1, context.window)
         
+        #'''
         #self._draw_callback_view = context.region.callback_add( \
         #    draw_callback_view, (self, context), 'POST_VIEW')
         self._draw_callback_view = find_region(context.area).\
@@ -4184,6 +4421,7 @@ class CursorMonitor(bpy.types.Operator):
         self._draw_header_px = find_region(context.area, 'HEADER').\
             callback_add(draw_callback_header_px, \
             (self, context), 'POST_PIXEL')
+        #'''
         
         # Here we cannot return 'PASS_THROUGH',
         # or Blender will crash!
@@ -4194,12 +4432,14 @@ class CursorMonitor(bpy.types.Operator):
         #type(self).is_running = False
         
         # Unregister callbacks...
+        #'''
         #context.region.callback_remove(self._draw_callback_view)
         find_region(context.area).callback_remove(self._draw_callback_view)
         find_region(context.area).callback_remove(self._draw_callback_px)
         
         find_region(context.area, 'HEADER').\
             callback_remove(self._draw_header_px)
+        #'''
         
         return {'CANCELLED'}
 
@@ -4212,6 +4452,58 @@ def to_matrix4x4(orient, pos):
     m.translation = pos.to_3d()
     return m
 
+def MatrixCompose(*args):
+    size = len(args)
+    m = Matrix.Identity(size)
+    axes = m.col # m.row
+    
+    if size == 2:
+        for i in (0, 1):
+            c = args[i]
+            if isinstance(c, Vector):
+                axes[i] = c.to_2d()
+            elif hasattr(c, "__iter__"):
+                axes[i] = Vector(c).to_2d()
+            else:
+                axes[i][i] = c
+    else:
+        for i in (0, 1, 2):
+            c = args[i]
+            if isinstance(c, Vector):
+                axes[i][:3] = c.to_3d()
+            elif hasattr(c, "__iter__"):
+                axes[i][:3] = Vector(c).to_3d()
+            else:
+                axes[i][i] = c
+        
+        if size == 4:
+            c = args[3]
+            if isinstance(c, Vector):
+                m.translation = c.to_3d()
+            elif hasattr(c, "__iter__"):
+                m.translation = Vector(c).to_3d()
+    
+    return m
+
+def MatrixDecompose(m, res_size=None):
+    size = len(m)
+    axes = m.col # m.row
+    if res_size is None:
+        res_size = size
+    
+    if res_size == 2:
+        return (axes[0].to_2d(), axes[1].to_2d())
+    else:
+        x = axes[0].to_3d()
+        y = axes[1].to_3d()
+        z = (axes[2].to_3d() if size > 2 else Vector())
+        if res_size == 3:
+            return (x, y, z)
+        
+        t = (m.translation.to_3d() if size == 4 else Vector())
+        if res_size == 4:
+            return (x, y, z, t)
+
 def angle_axis_to_quat(angle, axis):
     w = math.cos(angle / 2.0)
     xyz = axis.normalized() * math.sin(angle / 2.0)
@@ -4229,7 +4521,8 @@ def clamp_angle(ang):
     ang = (ang % twoPi)
     return ((ang - twoPi) if (ang > math.pi) else ang)
 
-def prepare_grid_mesh(nx=1, ny=1, sx=1.0, sy=1.0, z=0.0, xyz_indices=(0,1,2)):
+def prepare_grid_mesh(bm, nx=1, ny=1, sx=1.0, sy=1.0,
+                      z=0.0, xyz_indices=(0,1,2)):
     vertices = []
     for i in range(nx + 1):
         x = 2 * (i / nx) - 1
@@ -4238,24 +4531,26 @@ def prepare_grid_mesh(nx=1, ny=1, sx=1.0, sy=1.0, z=0.0, xyz_indices=(0,1,2)):
             y = 2 * (j / ny) - 1
             y *= sy
             pos = (x, y, z)
-            vertices.append(pos[xyz_indices[0]])
-            vertices.append(pos[xyz_indices[1]])
-            vertices.append(pos[xyz_indices[2]])
+            vert = bm.verts.new((pos[xyz_indices[0]],
+                                 pos[xyz_indices[1]],
+                                 pos[xyz_indices[2]]))
+            vertices.append(vert)
     
-    faces = []
     nxmax = nx + 1
     for i in range(nx):
         i1 = i + 1
         for j in range(ny):
             j1 = j + 1
-            faces.append(j + i * nxmax)
-            faces.append(j1 + i * nxmax)
-            faces.append(j1 + i1 * nxmax)
-            faces.append(j + i1 * nxmax)
-    
-    return vertices, faces
+            verts = [vertices[j + i * nxmax],
+                     vertices[j1 + i * nxmax],
+                     vertices[j1 + i1 * nxmax],
+                     vertices[j + i1 * nxmax]]
+            bm.faces.new(verts)
+    #return
 
 def prepare_gridbox_mesh(subdiv=1):
+    bm = bmesh.new()
+    
     sides = [
         (-1, (0,1,2)), # -Z
         (1, (1,0,2)), # +Z
@@ -4265,27 +4560,11 @@ def prepare_gridbox_mesh(subdiv=1):
         (1, (2,1,0)), # +X
         ]
     
-    vertices = []
-    faces = []
-    
     for side in sides:
-        vs, fs = prepare_grid_mesh(nx=subdiv, ny=subdiv, z=side[0],
-            xyz_indices=side[1])
-        
-        n = len(vertices) // 3
-        vertices.extend(vs)
-        faces.extend(((f + n) for f in fs))
+        prepare_grid_mesh(bm, nx=subdiv, ny=subdiv,
+            z=side[0], xyz_indices=side[1])
     
-    return vertices, faces
-
-def create_mesh(vertex_coords, faces):
-    mesh = bpy.data.meshes.new(tmp_name)
-    mesh.vertices.add(len(vertex_coords) // 3)
-    mesh.faces.add(len(faces) // 4)
-    mesh.vertices.foreach_set("co", vertex_coords)
-    mesh.faces.foreach_set("vertices_raw", faces)
-    mesh.update()
-    return mesh
+    return bm
 
 # ===== DRAWING UTILITIES ===== #
 class GfxCell:
@@ -4580,7 +4859,11 @@ def draw_callback_view(self, context):
         # It's nice to have bookmark position update interactively
         # However, this still can be slow if there are many
         # selected objects
-        CursorDynamicSettings.recalc_csu(context, 'PRESS')
+        
+        # ATTENTION!!!
+        # This eats a lot of processor time!
+        #CursorDynamicSettings.recalc_csu(context, 'PRESS')
+        pass
     
     history = settings.history
     
@@ -4612,7 +4895,7 @@ def draw_callback_view(self, context):
         bgl.glDepthRange(0.0, 1.0)
     
     if tfm_operator:
-        tfm_operator.draw_3d()
+        tfm_operator.draw_3d(context)
     
     if is_drawing:
         # Restore previous OpenGL settings
@@ -4818,6 +5101,11 @@ def update_keymap(activate):
         kmi.active = not activate
 
 def register():
+    bpy.utils.register_class(AlignOrientation)
+    bpy.utils.register_class(CopyOrientation)
+    bpy.types.VIEW3D_PT_transform_orientations.append(
+        transform_orientations_panel_extension)
+    
     bpy.utils.register_class(SetCursorDialog)
     
     bpy.utils.register_class(NewCursor3DBookmarkLibrary)
@@ -4923,6 +5211,11 @@ def unregister():
     bpy.utils.unregister_class(AddEmptyAtCursor3DBookmark)
     
     bpy.utils.unregister_class(SetCursorDialog)
+    
+    bpy.types.VIEW3D_PT_transform_orientations.remove(
+        transform_orientations_panel_extension)
+    bpy.utils.unregister_class(CopyOrientation)
+    bpy.utils.unregister_class(AlignOrientation)
 
 class DelayRegistrationOperator(bpy.types.Operator):
     bl_idname = "wm.enhanced_3d_cursor_registration"
diff --git a/release/scripts/addons_contrib/space_view3d_paint_bprojection.py b/release/scripts/addons_contrib/space_view3d_paint_bprojection.py
new file mode 100644
index 0000000..461f90e
--- /dev/null
+++ b/release/scripts/addons_contrib/space_view3d_paint_bprojection.py
@@ -0,0 +1,1126 @@
+bl_info = {
+    "name": "BProjection",
+    "description": "Help Clone tool",
+    "author": "kgeogeo",
+    "version": (1, 0),
+    "blender": (2, 6, 3),
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/3D_interaction/bprojection",
+    "tracker_url":"http://projects.blender.org/tracker/index.php?func=detail&aid=30521&group_id=153&atid=468",
+    "category": "Paint"}
+
+import bpy
+from bpy.types import Panel, Operator
+from bpy.props import IntProperty, FloatProperty, BoolProperty, IntVectorProperty, StringProperty, FloatVectorProperty, CollectionProperty
+from bpy_extras import view3d_utils
+import math
+from math import *
+import mathutils
+from mathutils import *
+
+# Main function for align the plan to view
+def align_to_view(context):
+    ob = context.object        
+    rotation = ob.custom_rotation
+    scale = ob.custom_scale
+    z = ob.custom_location.z
+    pos = [ob.custom_location.x, ob.custom_location.y]
+    
+    reg = context.area.regions[4]        
+    width = reg.width
+    height = reg.height 
+    
+    sd = context.space_data    
+    r3d = sd.region_3d     
+    r3d.update()
+    vr = r3d.view_rotation
+    quat = mathutils.Quaternion((0.0, 0.0, 1.0), math.radians(float(rotation)))
+    v = Vector((pos[0],pos[1],z))
+    v.rotate(vr)
+
+    em = bpy.data.objects['Empty for BProjection']
+    img = bpy.data.textures['Texture for BProjection'].image
+    if img and img.size[1] != 0:
+        prop = img.size[0]/img.size[1]
+    else: prop = 1    
+    
+    if ob.custom_linkscale:    
+        em.scale = Vector((prop*scale[0], scale[0], 1))
+    else:
+        em.scale = Vector((prop*scale[0], scale[1], 1))
+    pos_cur = em.location - sd.cursor_location
+    rot_cur1 = em.rotation_euler.to_quaternion()
+    em.location = v + ob.location            
+    em.rotation_euler = Quaternion.to_euler(vr*quat)
+        
+    if ob.custom_c3d:
+        if ob.custom_old_scale != ob.custom_scale:
+            pos_cur = em.location - sd.cursor_location        
+        rot_cur2 = em.rotation_euler.to_quaternion()
+        rot_cur1.invert()
+        pos_cur.rotate(rot_cur1)
+        pos_cur.rotate(rot_cur2)
+        v = em.location - pos_cur
+        sd.cursor_location =  v
+
+# Function to update the properties
+def update_Location(self, context):          
+    align_to_view(context)
+
+# Function to update the scaleUV
+def update_UVScale(self, context):
+    v = Vector((context.object.custom_offsetuv[0]/10 + 0.5, context.object.custom_offsetuv[1]/10 + 0.5))
+    l = Vector((0.0,0.0))
+    ob = context.object
+    s = ob.custom_scaleuv
+    os = ob.custom_old_scaleuv 
+    scale = s - os
+    uvdata = ob.data.uv_layers.active.data
+    for i in range(trunc(pow(ob.custom_sub+1, 2)*4)):
+        vres =  v - uvdata[len(uvdata)-1-i].uv  
+        uvdata[len(uvdata)-1-i].uv.x = v.x - vres.x/os[0]*s[0]
+        uvdata[len(uvdata)-1-i].uv.y = v.y - vres.y/os[1]*s[1]
+
+    ob.custom_old_scaleuv = s  
+    align_to_view(context)
+
+def update_PropUVScale(self, context):
+    ob = context.object
+    if ob.custom_linkscaleuv:
+        ob.custom_scaleuv = [ob.custom_propscaleuv,ob.custom_propscaleuv]
+
+def update_LinkUVScale(self, context):
+    ob = context.object
+    if ob.custom_linkscaleuv:
+        ob.custom_propscaleuv = ob.custom_scaleuv.x
+        update_PropUVScale(self, context)
+    else:
+        update_UVScale(self, context) 
+        
+# Function to update the offsetUV
+def update_UVOffset(self, context):
+    ob = context.object
+    o = ob.custom_offsetuv
+    oo = ob.custom_old_offsetuv 
+    uvdata = ob.data.uv_layers.active.data
+    for i in range(trunc(pow(ob.custom_sub+1, 2)*4)):
+        uvdata[len(uvdata)-1-i].uv = [uvdata[len(uvdata)-1-i].uv[0] - oo[0]/10 + o[0]/10, uvdata[len(uvdata)-1-i].uv[1] - oo[1]/10 + o[1]/10]   
+    ob.custom_old_offsetuv = o
+    
+    align_to_view(context)
+
+# Function to update the flip horizontal
+def update_FlipUVX(self, context):          
+    uvdata = context.object.data.uv_layers.active.data
+    for i in range(trunc(pow(context.object.custom_sub+1, 2)*4)):
+        x = uvdata[len(uvdata)-1-i].uv[0]
+        uvdata[len(uvdata)-1-i].uv[0] = 1 - x
+    
+    align_to_view(context)
+
+# Function to update the flip vertical
+def update_FlipUVY(self, context):          
+    uvdata = context.object.data.uv_layers.active.data
+    for i in range(trunc(pow(context.object.custom_sub+1, 2)*4)):
+        y = uvdata[len(uvdata)-1-i].uv[1]
+        uvdata[len(uvdata)-1-i].uv[1] = 1 - y
+    
+    align_to_view(context)
+
+# Function to update
+def update_Rotation(self, context):              
+    if context.object.custom_rotc3d:
+        ob = context.object
+        angle = ob.custom_rotation - ob.custom_old_rotation
+        sd = context.space_data
+        vr = sd.region_3d.view_rotation.copy()        
+        c = sd.cursor_location.copy() - ob.location
+        e = bpy.data.objects['Empty for BProjection'].location - ob.location
+        vo = Vector((0.0, 0.0, 1.0))
+        vo.rotate(vr)
+        quat = mathutils.Quaternion(vo, math.radians(angle))
+        v = e-c
+        v.rotate(quat)
+        vr.invert()
+        v.rotate(vr)
+        c.rotate(vr)
+        context.object.custom_location = c + v
+    else:        
+        align_to_view(context)
+   
+    context.object.custom_old_rotation = context.object.custom_rotation
+
+# Function to update scale
+def update_Scale(self, context):              
+    ob = context.object
+    
+    if context.object.custom_scac3d:
+        #ob.custom_c3d = False
+        sd = context.space_data
+        r3d =  sd.region_3d
+        vr = r3d.view_rotation.copy()
+        vr.invert()
+        e = bpy.data.objects['Empty for BProjection'].location - ob.location
+        c = sd.cursor_location.copy() - ob.location
+        ce = e - c
+        
+        s = ob.custom_scale
+        os = ob.custom_old_scale
+        delta =  ob.custom_scale - ob.custom_old_scale
+        c.rotate(vr)
+        ce.rotate(vr)
+        
+        img = bpy.data.textures['Texture for BProjection'].image
+        if img and img.size[1] != 0:
+            prop = img.size[0]/img.size[1]
+        else: prop = 1
+        
+        v = Vector((s.x*ce.x/os.x, s.y*ce.y/os.y,0.0))
+        ob.custom_location = c + v
+        #ob.custom_c3d = True
+        
+
+    else:          
+        align_to_view(context)
+            
+    
+    ob.custom_old_scale = ob.custom_scale
+
+def update_PropScale(self, context):
+    ob = context.object
+    if ob.custom_linkscale:
+        ob.custom_scale = [ob.custom_propscale,ob.custom_propscale]
+    
+def update_LinkScale(self, context):
+    ob = context.object
+    if ob.custom_linkscale:
+        ob.custom_propscale = ob.custom_scale.x
+        update_PropScale(self, context)
+    else:
+        update_Scale(self, context) 
+
+def update_activeviewname(self, context):
+    if self.custom_active:
+        context.object.custom_active_view = self.custom_active_view
+
+class custom_props(bpy.types.PropertyGroup):
+    custom_location = FloatVectorProperty(name="Location", description="Location of the plan",
+                                           default=(0,0,-1.0),
+                                           subtype = 'XYZ', size=3)
+                                           
+    custom_rotation = FloatProperty(name="Rotation", description="Rotate the plane",
+                                     min=-180, max=180, default=0)
+                                         
+    custom_scale = FloatVectorProperty(name="Scales", description="Scale the planes",
+                                       subtype = 'XYZ', default=(1.0, 1.0),min = 0.1, size=2)
+    custom_propscale = FloatProperty(name="PropScale", description="Scale the Plan",
+                                           default=1.0,min = 0.1)
+                                                                                    
+    custom_linkscale = BoolProperty(name="linkscale", default=True)
+   
+    # UV properties
+    custom_scaleuv = FloatVectorProperty(name="ScaleUV", description="Scale the texture's UV",
+                                            default=(1.0,1.0),min = 0.01, subtype = 'XYZ', size=2)
+    custom_propscaleuv = FloatProperty(name="PropScaleUV", description="Scale the texture's UV",
+                                           default=1.0,min = 0.01) 
+    custom_offsetuv = FloatVectorProperty(name="OffsetUV", description="Decal the texture's UV",
+                                            default=(0.0,0.0), subtype = 'XYZ', size=2)       
+    custom_linkscaleuv = BoolProperty(name="linkscaleUV", default=True)
+    custom_flipuvx = BoolProperty(name="flipuvx", default=False)
+    custom_flipuvy = BoolProperty(name="flipuvy", default=False)
+    
+    # other properties
+    custom_active= BoolProperty(name="custom_active", default=True)   
+    custom_expand = BoolProperty(name="expand", default=False)
+    
+    custom_active_view = StringProperty(name = "custom_active_view",default = "View",update = update_activeviewname)
+    
+    custom_image = StringProperty(name = "custom_image",default = "")
+    
+    custom_index = IntProperty()
+
+# Function to create custom properties
+def createcustomprops(context):
+    Ob = bpy.types.Object    
+    
+    # plane properties 
+    Ob.custom_location = FloatVectorProperty(name="Location", description="Location of the plan",
+                                           default=(5.0,0.0,-1.0),
+                                           subtype = 'XYZ', size=3, update = update_Location)
+                                           
+    Ob.custom_rotation = FloatProperty(name="Rotation", description="Rotate the plane",
+                                     min=-180, max=180, default=0,update = update_Rotation)
+                                     
+    Ob.custom_old_rotation = FloatProperty(name="old_Rotation", description="Old Rotate the plane",
+                                         min=-180, max=180, default=0)
+                                         
+    Ob.custom_scale = FloatVectorProperty(name="Scales", description="Scale the planes",
+                                          subtype = 'XYZ', default=(1.0, 1.0),min = 0.1, size=2,update = update_Scale)
+    Ob.custom_propscale = FloatProperty(name="PropScale", description="Scale the Plan",
+                                           default=1.0,min = 0.1,update = update_PropScale)
+    Ob.custom_old_scale = FloatVectorProperty(name="old_Scales", description="Old Scale the planes",
+                                          subtype = 'XYZ', default=(1.0, 1.0),min = 0.1, size=2)
+                                          
+    Ob.custom_linkscale = BoolProperty(name="linkscale", default=True, update = update_LinkScale)
+    
+                                
+    Ob.custom_sub = IntProperty(name="Subdivide", description="Number of subdivision of the plan",
+                                     min=1, max=20, default=10)                                
+    
+    # UV properties
+    Ob.custom_scaleuv = FloatVectorProperty(name="ScaleUV", description="Scale the texture's UV",
+                                            default=(1.0,1.0),min = 0.01, subtype = 'XYZ', size=2,update = update_UVScale)
+    Ob.custom_propscaleuv = FloatProperty(name="PropScaleUV", description="Scale the texture's UV",
+                                           default=1.0,min = 0.01,update = update_PropUVScale)    
+    Ob.custom_old_scaleuv = FloatVectorProperty(name="old_ScaleUV", description="Scale the texture's UV",
+                                                default=(1.0,1.0),min = 0.01, subtype = 'XYZ', size=2)
+    Ob.custom_offsetuv = FloatVectorProperty(name="OffsetUV", description="Decal the texture's UV",
+                                            default=(0.0,0.0), subtype = 'XYZ', size=2,update = update_UVOffset)    
+    Ob.custom_old_offsetuv = FloatVectorProperty(name="old_OffsetUV", description="Decal the texture's UV",
+                                                 default=(0.0,0.0), subtype = 'XYZ', size=2)    
+    Ob.custom_linkscaleuv = BoolProperty(name="linkscaleUV", default=True, update = update_LinkUVScale)
+    Ob.custom_flipuvx = BoolProperty(name="flipuvx", default=False, update = update_FlipUVX)
+    Ob.custom_flipuvy = BoolProperty(name="flipuvy", default=False, update = update_FlipUVY)
+    
+    # other properties    
+    Ob.custom_c3d = BoolProperty(name="c3d", default=True)
+    Ob.custom_rot = BoolProperty(name="rot", default=True)
+    Ob.custom_rotc3d = BoolProperty(name="rotc3d", default=False)
+    Ob.custom_scac3d = BoolProperty(name="scac3d", default=False)
+    Ob.custom_expand = BoolProperty(name="expand", default=True)
+    Ob.custom_active_view = StringProperty(name = "custom_active_view",default = "View")
+    
+    Ob.custom_props = CollectionProperty(type = custom_props)
+
+# Function to remove custom properties
+def removecustomprops():    
+    list_prop = ['custom_location', 'custom_rotation', 'custom_old_rotation', 'custom_scale', 'custom_old_scale', 'custom_c3d',
+                 'custom_rot', 'custom_rotc3d', 'custom_scaleuv', 'custom_flipuvx', 'custom_flipuvy', 'custom_linkscale',
+                 'custom_linkscaleuv', 'custom_old_scaleuv', 'custom_offsetuv', 'custom_old_offsetuv', 'custom_scac3d', 'custom_sub',
+                 'custom_expand', 'custom_active_view', 'custom_propscaleuv', 'custom_props', 'custom_propscale']
+    for prop in list_prop:
+        try:
+            del bpy.context.object[prop]
+        except:
+            do = 'nothing'
+
+# Oprerator Class to create view            
+class CreateView(Operator):
+    bl_idname = "object.create_view"
+    bl_label = "Create a new view"
+
+    def execute(self, context):              
+        ob = context.object
+        new_props = ob.custom_props.add()
+        
+        ob.custom_active_view = new_props.custom_active_view               
+        new_props.custom_index = len(bpy.context.object.custom_props)-1
+        bpy.ops.object.active_view(index = new_props.custom_index)
+        ob.data.shape_keys.key_blocks[ob.active_shape_key_index].mute = True
+        bpy.ops.object.shape_key_add(from_mix = False)
+        ob.data.shape_keys.key_blocks[ob.active_shape_key_index].value = 1.0
+        return {'FINISHED'}
+
+# Oprerator Class to copy view 
+class SaveView(Operator):
+    bl_idname = "object.save_view"
+    bl_label = "copy the view"
+    
+    index = IntProperty(default = 0)
+    
+    def execute(self, context):              
+        ob = context.object
+        prop = ob.custom_props[self.index]        
+        prop.custom_location =  ob.custom_location                    
+        prop.custom_rotation =  ob.custom_rotation                    
+        prop.custom_scale =  ob.custom_scale                  
+        prop.custom_linkscale =  ob.custom_linkscale                                      
+        prop.custom_scaleuv = ob.custom_scaleuv
+        prop.custom_propscale = ob.custom_propscale
+        prop.custom_offsetuv =  ob.custom_offsetuv  
+        prop.custom_linkscaleuv = ob.custom_linkscaleuv
+        prop.custom_propscaleuv = ob.custom_propscaleuv
+        prop.custom_flipuvx = ob.custom_flipuvx
+        prop.custom_flipuvy = ob.custom_flipuvy
+        try:
+            prop.custom_image = bpy.data.textures['Texture for BProjection'].image.name
+        except:
+            do = 'nothing'
+        
+        return {'FINISHED'}
+
+# Oprerator Class to copy view 
+class PasteView(Operator):
+    bl_idname = "object.paste_view"
+    bl_label = "paste the view"
+    
+    index = IntProperty(default = 0)
+    
+    def execute(self, context):              
+        ob = context.object
+        prop = ob.custom_props[self.index]
+        ob.custom_linkscale =  prop.custom_linkscale
+        ob.custom_offsetuv =  prop.custom_offsetuv 
+        ob.custom_linkscaleuv = prop.custom_linkscaleuv
+        ob.custom_scaleuv = prop.custom_scaleuv
+        ob.custom_propscaleuv = prop.custom_propscaleuv       
+        ob.custom_rotation =  prop.custom_rotation                    
+        ob.custom_scale =  prop.custom_scale
+        ob.custom_propscale = prop.custom_propscale 
+        ob.custom_location =  prop.custom_location                    
+        if prop.custom_image != '':
+            if bpy.data.textures['Texture for BProjection'].image.name != prop.custom_image:
+                bpy.data.textures['Texture for BProjection'].image = bpy.data.images[prop.custom_image]
+                bpy.ops.object.applyimage()
+        if ob.custom_flipuvx != prop.custom_flipuvx:
+            ob.custom_flipuvx = prop.custom_flipuvx
+        if ob.custom_flipuvy != prop.custom_flipuvy:
+            ob.custom_flipuvy = prop.custom_flipuvy
+        
+        return {'FINISHED'}
+
+# Oprerator Class to remove view 
+class RemoveView(Operator):
+    bl_idname = "object.remove_view"
+    bl_label = "Rmeove the view"
+    
+    index = IntProperty(default = 0)
+    
+    def execute(self, context):              
+        ob = context.object
+        
+        ob.active_shape_key_index =  self.index + 1
+        bpy.ops.object.shape_key_remove()
+        
+        if  context.object.custom_props[self.index].custom_active: 
+            if len(ob.custom_props) > 0:
+                bpy.ops.object.active_view(index = self.index-1)
+            if self.index == 0 and len(ob.custom_props) > 1:
+                bpy.ops.object.active_view(index = 1)            
+                
+        ob.custom_props.remove(self.index)
+        
+        print(len(context.object.custom_props))
+                
+        if len(context.object.custom_props) == 0:
+            ob.custom_scale = [1,1]
+            ob.custom_rotation = 0
+            ob.custom_scaleuv =[1.0,1.0]
+            ob.custom_offsetuv =[0.0,0.0]
+            ob.custom_propscaleuv = 1.0
+            ob.custom_propscale = 1.0
+            if ob.custom_flipuvx == True:
+                ob.custom_flipuvx = False
+            if ob.custom_flipuvy == True:
+                ob.custom_flipuvy = False
+            
+            bpy.ops.object.create_view()            
+                 
+        i=0
+        for item in context.object.custom_props:
+            item.custom_index = i           
+            i+=1 
+
+        for item in [item for item in context.object.custom_props if item.custom_active]:
+                ob.active_shape_key_index = item.custom_index+1
+           
+        return {'FINISHED'}
+
+# Oprerator Class to copy view 
+class ActiveView(Operator):
+    bl_idname = "object.active_view"
+    bl_label = "Active the view"
+    
+    index = IntProperty(default = 0)
+    
+    def execute(self, context):
+        ob = context.object
+        for item in [ item for item in ob.custom_props if item.custom_active == True]:
+                bpy.ops.object.save_view(index = item.custom_index)
+                item.custom_active = False
+        ob.custom_props[self.index].custom_active  = True
+        ob.custom_active_view = ob.custom_props[self.index].custom_active_view 
+        ob.active_shape_key_index =  self.index + 1
+        
+        for i in ob.data.shape_keys.key_blocks:
+            i.mute = True
+        
+        ob.data.shape_keys.key_blocks[ob.active_shape_key_index].mute = False
+        
+        bpy.ops.object.paste_view(index = self.index)         
+        
+        return {'FINISHED'}
+
+# Draw Class to show the panel
+class BProjection(Panel):
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'UI'
+    bl_label = "BProjection"
+
+    @classmethod
+    def poll(cls, context):
+        return (context.image_paint_object or context.sculpt_object)
+
+    def draw(self, context):        
+        layout = self.layout
+                
+        try: 
+            bpy.data.objects['Empty for BProjection']
+            
+            tex = bpy.data.textures['Texture for BProjection']
+            ob = context.object
+                        
+            col = layout.column(align =True)
+            col.operator("object.removebprojectionplane", text="Remove BProjection plane")           
+                
+            box = layout.box()
+
+            row = box.row()
+            if not ob.custom_expand:
+                row.prop(ob, "custom_expand", text  = "", icon="TRIA_RIGHT", emboss=False)
+                row.label(text=ob.custom_active_view)
+            else:
+                row.prop(ob, "custom_expand", text = "" , icon="TRIA_DOWN", emboss=False)                
+                row.label(text=ob.custom_active_view)
+                
+                col = box.column(align =True)
+                col.template_ID(tex, "image", open="image.open")
+                row  = box.row(align=True)
+                row.operator('object.applyimage', text="Apply image", icon = 'FILE_TICK')
+                row.prop(ob, "custom_c3d",text="", icon='CURSOR')
+                row.prop(ob, "custom_rot",text="", icon='ROTATE')
+                row  = box.row(align =True)
+                row.label(text="Location:")
+                row  = box.row(align =True)
+                row.prop(ob,'custom_location', text='')
+                row  = box.row(align =True)            
+                row.prop(ob,'custom_rotation')
+                row.prop(ob,'custom_rotc3d',text="",icon='MANIPUL')            
+                row  = box.row(align =True)
+                row.label(text="Scale:")
+                row  = box.row(align =True) 
+                if ob.custom_linkscale :
+                    row.prop(ob, "custom_propscale",text="")
+                    row.prop(ob, "custom_linkscale",text="",icon='LINKED')
+                else: 
+                    row.prop(ob,'custom_scale',text='')
+                    row.prop(ob, "custom_linkscale",text="",icon='UNLINKED')
+                row.prop(ob,'custom_scac3d',text="",icon='MANIPUL')                            
+                row  = box.row(align =True)
+                row.label(text="UV's Offset:")
+                row  = box.row(align =True)
+                row.prop(ob,'custom_offsetuv',text='')
+                row.prop(ob, "custom_flipuvx",text="",icon='ARROW_LEFTRIGHT')   
+                row.prop(ob, "custom_flipuvy",text="",icon='FULLSCREEN_ENTER') 
+                row  = box.row(align =True)
+                row.label(text="UV's Scale:")
+                row  = box.row(align =True)                            
+                if ob.custom_linkscaleuv:
+                    row.prop(ob,'custom_propscaleuv',text='')
+                    row.prop(ob, "custom_linkscaleuv",text="",icon='LINKED')
+                else: 
+                    row.prop(ob,'custom_scaleuv',text='')
+                    row.prop(ob, "custom_linkscaleuv",text="",icon='UNLINKED')            
+                row = box.column(align =True)
+                row.prop(ob.material_slots['Material for BProjection'].material,'alpha', slider = True)
+                row = box.column(align =True)
+
+                
+            for item in ob.custom_props:
+                box = layout.box()
+                row = box.row()
+                if item.custom_active:
+                    row.operator("object.active_view",text = "", icon='RADIOBUT_ON', emboss = False).index = item.custom_index 
+                else:
+                    row.operator("object.active_view",text = "", icon='RADIOBUT_OFF', emboss = False).index = item.custom_index 
+                row.prop(item, "custom_active_view", text="")        
+                row.operator('object.remove_view', text="", icon = 'PANEL_CLOSE', emboss = False).index = item.custom_index
+            row = layout.row()
+            row.operator('object.create_view', text="Create View", icon = 'RENDER_STILL')        
+
+        except:
+            col = layout.column(align = True)
+            col.operator("object.addbprojectionplane", text="Add BProjection plan")
+                   
+
+# Oprerator Class to apply the image to the plane             
+class ApplyImage(Operator):
+    bl_idname = "object.applyimage"
+    bl_label = "Apply image"
+
+    def execute(self, context):        
+        img = bpy.data.textures['Texture for BProjection'].image
+        em = bpy.data.objects['Empty for BProjection']
+        ob = context.object
+        cm = context.object.mode
+               
+        bpy.ops.object.editmode_toggle()
+        f = ob.data.polygons
+        nbface = len(ob.data.polygons)
+        uvdata = ob.data.uv_textures.active.data 
+        wasnul = False
+        if len(uvdata) == 0:
+            bpy.ops.object.editmode_toggle()
+            uvdata = ob.data.uv_textures.active.data
+            wasnul = True                        
+        
+        
+        vglen = trunc(pow(ob.custom_sub+1, 2))
+        
+        for i in range(vglen):  
+            uvdata[f[nbface-i-1].index].image = img
+        
+        if wasnul == False:
+            bpy.ops.object.editmode_toggle()
+        else:
+            bpy.ops.object.mode_set(mode = cm, toggle=False)
+                
+        align_to_view(context)
+        
+        return {'FINISHED'}
+
+# Oprerator Class to make the 4 or 6 point and scale the plan
+class IntuitiveScale(Operator):
+    bl_idname = "object.intuitivescale"
+    bl_label = "Draw lines"
+
+    def invoke(self, context, event):
+        ob = context.object 
+        x = event.mouse_region_x
+        y = event.mouse_region_y                
+        if len(ob.grease_pencil.layers.active.frames) == 0: 
+            bpy.ops.gpencil.draw(mode='DRAW', stroke=[{"name":"", "pen_flip":False,
+                                                       "is_start":True, "location":(0, 0, 0),
+                                                       "mouse":(x,y), "pressure":1, "time":0}])
+        else:
+            if ob.custom_linkscale:
+                nb_point = 4
+            else:
+                nb_point = 6
+                   
+            if len(ob.grease_pencil.layers.active.frames[0].strokes) < nb_point:
+                bpy.ops.gpencil.draw(mode='DRAW', stroke=[{"name":"", "pen_flip":False,
+                                                           "is_start":True, "location":(0, 0, 0),
+                                                           "mouse":(x,y), "pressure":1, "time":0}])
+                                                           
+            if len(ob.grease_pencil.layers.active.frames[0].strokes) == nb_point:
+                s = ob.grease_pencil.layers.active.frames[0]
+                v1 = s.strokes[1].points[0].co - s.strokes[0].points[0].co
+                if not ob.custom_linkscale:
+                    v2 = s.strokes[4].points[0].co - s.strokes[3].points[0].co
+                else:
+                    v2 = s.strokes[3].points[0].co - s.strokes[2].points[0].co
+                propx = v1.x/v2.x                
+                ob.custom_scale[0] *= abs(propx)
+                
+                if not ob.custom_linkscale:
+                    v1 = s.strokes[2].points[0].co - s.strokes[0].points[0].co
+                    v2 = s.strokes[5].points[0].co - s.strokes[3].points[0].co
+                    propy = v1.y/v2.y
+                    ob.custom_scale[1] *= abs(propy)
+                bpy.ops.gpencil.active_frame_delete()
+        
+        return {'FINISHED'}
+
+# Oprerator Class to configure all wath is needed
+class AddBProjectionPlane(Operator):
+    bl_idname = "object.addbprojectionplane"
+    bl_label = "Configure"
+    
+    def creatematerial(self, context):        
+        try:
+            matBProjection = bpy.data.materials['Material for BProjection']
+        except:            
+            bpy.data.textures.new(name='Texture for BProjection',type='IMAGE')
+    
+            bpy.data.materials.new(name='Material for BProjection')
+            
+            matBProjection = bpy.data.materials['Material for BProjection']
+            matBProjection.texture_slots.add()
+            matBProjection.use_shadeless = True
+            matBProjection.use_transparency = True
+            matBProjection.active_texture = bpy.data.textures['Texture for BProjection']
+        
+            index = matBProjection.active_texture_index
+            matBProjection.texture_slots[index].texture_coords = 'UV'
+        
+        ob = context.object 
+        old_index = ob.active_material_index
+        bpy.ops.object.material_slot_add()
+        index = ob.active_material_index
+        ob.material_slots[index].material = bpy.data.materials['Material for BProjection']
+        bpy.ops.object.material_slot_assign()
+        ob.active_material_index = old_index
+        ob.data.update()
+            
+    def execute(self, context):    
+        try:
+            bpy.data.objects['Empty for BProjection']
+
+        except:            
+            createcustomprops(context)
+            cm = bpy.context.object.mode
+            bpy.ops.object.mode_set(mode = 'OBJECT', toggle=False)
+            
+            context.space_data.show_relationship_lines = False
+            
+            ob = context.object
+        
+            bpy.ops.object.add()
+            em = context.object
+            em.name = "Empty for BProjection"
+                        
+            bpy.data.scenes['Scene'].objects.active = ob
+            ob.select = True
+    
+            bpy.ops.object.editmode_toggle()
+    
+            bpy.ops.mesh.primitive_plane_add()
+            bpy.ops.object.vertex_group_assign(new = True)
+            ob.vertex_groups.active.name = 'texture plane'   
+            bpy.ops.uv.unwrap()
+            
+            bpy.ops.object.editmode_toggle()
+            for i in range(4):
+                ob.data.edges[len(ob.data.edges)-1-i].crease = 1
+            bpy.ops.object.editmode_toggle()
+
+            bpy.ops.mesh.subdivide(number_cuts = ob.custom_sub)
+    
+            em.select = True
+            bpy.ops.object.hook_add_selob()
+            em.select = False
+            em.hide = True   
+                     
+            self.creatematerial(context)
+  
+          
+            bpy.ops.gpencil.data_add()
+            ob.grease_pencil.draw_mode = 'VIEW'
+            bpy.ops.gpencil.layer_add()
+            ob.grease_pencil.layers.active.color = [1.0,0,0]
+            
+            bpy.ops.object.editmode_toggle()
+            
+            bpy.ops.object.shape_key_add(from_mix = False)
+            
+            bpy.ops.object.create_view()
+            # ----------------------------------------------
+            # 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[4-1].idname = 'view3d.pan_view3d'
+            km.keymap_items[26-1].idname = 'view3d.preset_view3d'
+            km.keymap_items[26-1].properties.view = 'FRONT'
+            km.keymap_items[28-1].idname = 'view3d.preset_view3d'
+            km.keymap_items[28-1].properties.view = 'RIGHT'            
+            km.keymap_items[32-1].idname = 'view3d.preset_view3d'
+            km.keymap_items[32-1].properties.view = 'TOP'
+            km.keymap_items[34-1].idname = 'view3d.preset_view3d'
+            km.keymap_items[34-1].properties.view = 'BACK'
+            km.keymap_items[35-1].idname = 'view3d.preset_view3d'
+            km.keymap_items[35-1].properties.view = 'LEFT'            
+            km.keymap_items[36-1].idname = 'view3d.preset_view3d'
+            km.keymap_items[36-1].properties.view = 'BOTTOM'                                   
+            km = context.window_manager.keyconfigs.default.keymaps['Image Paint']
+            kmi = km.keymap_items.new("object.intuitivescale", 'LEFTMOUSE', 'PRESS', shift=True)
+                        
+            align_to_view(context)
+            
+            context.space_data.cursor_location = em.location
+            
+            bpy.ops.object.mode_set(mode = cm, toggle=False)
+            
+        return {'FINISHED'}
+
+# Oprerator Class to remove what is no more needed    
+class RemoveBProjectionPlane(Operator):
+    bl_idname = "object.removebprojectionplane"
+    bl_label = "Configure"
+
+    def removematerial(self, context):
+        ob = context.object 
+        i = 0
+
+        for ms in ob.material_slots:
+            if ms.name == 'Material for BProjection':
+                index = i
+            i+=1
+                
+        ob.active_material_index = index
+        bpy.ops.object.material_slot_remove()
+    
+    def execute(self, context):
+        try:               
+            cm = bpy.context.object.mode
+            bpy.ops.object.mode_set(mode = 'OBJECT', toggle=False)
+            
+            context.space_data.show_relationship_lines = True
+            
+            bpy.ops.object.modifier_remove(modifier="Hook-Empty for BProjection")
+            
+            self.removematerial(context)
+
+            ob = context.object
+    
+            bpy.ops.object.editmode_toggle()
+    
+            bpy.ops.mesh.reveal()
+                                   
+            bpy.ops.mesh.select_all()
+            bpy.ops.object.editmode_toggle() 
+            if ob.data.vertices[0].select:
+                bpy.ops.object.editmode_toggle()
+                bpy.ops.mesh.select_all()
+                bpy.ops.object.editmode_toggle()
+            bpy.ops.object.editmode_toggle()                    
+            
+            ob.vertex_groups.active.name = 'texture plane'
+            bpy.ops.object.vertex_group_select()
+            bpy.ops.mesh.delete()
+            bpy.ops.object.vertex_group_remove()
+    
+            bpy.ops.object.editmode_toggle()
+   
+            ob.select = False
+                
+            em = bpy.data.objects['Empty for BProjection']
+            bpy.data.scenes['Scene'].objects.active = em
+            em.hide = False
+            em.select = True
+            bpy.ops.object.delete()
+    
+            bpy.data.scenes['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[26-1].idname = 'view3d.viewnumpad'
+            km.keymap_items[26-1].properties.type = 'FRONT'
+            km.keymap_items[28-1].idname = 'view3d.viewnumpad'
+            km.keymap_items[28-1].properties.type = 'RIGHT'            
+            km.keymap_items[32-1].idname = 'view3d.viewnumpad'
+            km.keymap_items[32-1].properties.type = 'TOP'
+            km.keymap_items[34-1].idname = 'view3d.viewnumpad'
+            km.keymap_items[34-1].properties.type = 'BACK'
+            km.keymap_items[35-1].idname = 'view3d.viewnumpad'
+            km.keymap_items[35-1].properties.type = 'LEFT'            
+            km.keymap_items[36-1].idname = 'view3d.viewnumpad'
+            km.keymap_items[36-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)
+            
+            bpy.ops.object.mode_set(mode = cm, toggle=False)
+            
+            for i in ob.data.shape_keys.key_blocks:
+                bpy.ops.object.shape_key_remove()
+            bpy.ops.object.shape_key_remove()    
+            
+            removecustomprops()
+                    
+        except:
+            nothing = 0
+        
+        return {'FINISHED'}
+
+# Oprerator Class to rotate the view3D
+class RotateView3D(Operator):
+    bl_idname = "view3d.rotate_view3d"
+    bl_label = "Rotate the View3D"
+    
+    first_mouse = Vector((0,0))
+
+    pan = Vector((0,0))
+
+    key = ['']
+ 
+    first_time = True
+    
+    def vect_sphere(self, context, mx, my):
+        width = context.area.regions[4].width
+        height = context.area.regions[4].height
+           
+        if width >= height:
+            ratio = height/width
+        
+            x = 2*mx/width
+            y = 2*ratio*my/height
+            
+            x = x - 1
+            y = y - ratio
+        else:
+            ratio = width/height
+        
+            x = 2*ratio*mx/width
+            y = 2*my/height
+ 
+            x = x - ratio
+            y = y - 1
+        
+        z2 = 1 - x * x - y * y
+        if z2 > 0:
+            z= sqrt(z2)
+        else : z=0
+            
+        p = Vector((x, y, z))
+        p.normalize()
+        return p
+    
+    def tracball(self, context, mx, my, origine):
+        sd = context.space_data
+        ob = context.object         
+        if ob.custom_rot:
+            vr_b = sd.region_3d.view_rotation.copy()
+            vr_b.invert()
+            pos_init = sd.region_3d.view_location - origine
+            sd.region_3d.view_location = origine
+        
+        v1 = self.vect_sphere(context, self.first_mouse.x, self.first_mouse.y)
+        v2 = self.vect_sphere(context, mx, my)
+                        
+        axis = Vector.cross(v1,v2);
+        angle = Vector.angle(v1,v2);
+            
+        q =  Quaternion(axis,-2*angle)
+                        
+        sd.region_3d.view_rotation *=q
+        sd.region_3d.update()
+        
+        if ob.custom_rot:
+            vr_a = sd.region_3d.view_rotation.copy()                           
+            pos_init.rotate(vr_a*vr_b)            
+            sd.region_3d.view_location =  pos_init + origine
+        
+        self.first_mouse = Vector((mx, my))
+                
+    def modal(self, context, event):                                
+        ob = context.object 
+        reg = context.area.regions[4]        
+        if event.value == 'PRESS':
+            self.pan = Vector((event.mouse_region_x, event.mouse_region_y))
+                    
+            self.key = [event.type]
+
+        if event.value == 'RELEASE':
+            self.key = [''] 
+
+        if event.type == 'MOUSEMOVE':                        
+            
+            if '' in self.key:
+                self.tracball(context, event.mouse_region_x, event.mouse_region_y,ob.location)
+                align_to_view(context)
+                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')
+                    context.user_preferences.view.rotation_angle = rot_ang   
+                    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)
+                ob.custom_location += loc              
+                                   
+            if 'S' in self.key:                
+                s = ob.custom_scale
+                if ob.custom_linkscale:
+                    ob.custom_propscale += deltax/20
+                else:
+                    ob.custom_scale = [s[0] + deltax/20, s[1] + deltay/20]
+                                          
+            if 'Z' in self.key:                
+                ob.custom_location.z+=deltax/10
+                      
+            if 'R' in self.key:
+                ob.custom_rotation+=deltax
+                    
+            if 'U' in self.key:
+                suv = ob.custom_scaleuv
+                if ob.custom_linkscaleuv:    
+                    ob.custom_propscaleuv += deltax/50
+                else:
+                    ob.custom_scaleuv= [suv[0] + deltax/50 , suv[1] + deltay/50]               
+
+            if 'Y' in self.key:       
+                ouv = ob.custom_offsetuv
+                ob.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))
+                        
+        elif event.type == 'MIDDLEMOUSE'and event.value == 'RELEASE':       
+            
+            return {'FINISHED'}
+        
+        if 'C' in self.key:
+            ob.custom_scale = [1,1]
+            ob.custom_rotation = 0
+            ob.custom_scaleuv =[1.0,1.0]
+            ob.custom_offsetuv =[0.0,0.0]
+            ob.custom_propscaleuv = 1.0
+            ob.custom_propscale = 1.0
+            if ob.custom_flipuvx == True:
+                ob.custom_flipuvx = False
+            if ob.custom_flipuvy == True:
+                ob.custom_flipuvy = False
+                    
+        return {'RUNNING_MODAL'}
+    
+    def execute(self, context):        
+        align_to_view(context)  
+        
+        return{'FINISHED'}
+
+    def invoke(self, context, event):
+        context.window_manager.modal_handler_add(self)
+        self.first_mouse = Vector((event.mouse_region_x,event.mouse_region_y))
+        self.first_time = True
+        
+        return {'RUNNING_MODAL'}
+
+# Oprerator Class to pan the view3D
+class PanView3D(bpy.types.Operator):
+    bl_idname = "view3d.pan_view3d"
+    bl_label = "Pan View3D"
+    
+    first_mouse = Vector((0,0))
+
+    def modal(self, context, event):
+        ob = context.object
+        width = context.area.regions[4].width
+        height = context.area.regions[4].height
+
+        deltax = event.mouse_region_x - self.first_mouse.x
+        deltay = event.mouse_region_y - self.first_mouse.y                
+        
+        sd = context.space_data              
+        r3d =  sd.region_3d
+        vr = r3d.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, r3d, pos, v_init)
+        pos = [0,0]
+        vbl = view3d_utils.region_2d_to_location_3d(context.region, r3d, pos, v_init)        
+        loc = vbl - v       
+        sd.region_3d.view_location += loc         
+        loc.rotate(vr)
+        ob.custom_location += loc
+
+        self.first_mouse.x = event.mouse_region_x
+        self.first_mouse.y = event.mouse_region_y
+
+        if event.type == 'MIDDLEMOUSE'and event.value == 'RELEASE':
+            return {'FINISHED'}
+        
+        return {'RUNNING_MODAL'}
+                
+    def invoke(self, context, event):
+        context.window_manager.modal_handler_add(self)
+        self.first_mouse.x = event.mouse_region_x
+        self.first_mouse.y = event.mouse_region_y   
+        
+        return {'RUNNING_MODAL'}
+
+    def execute(self, context):        
+        align_to_view(context)  
+        
+        return{'FINISHED'}
+
+# Oprerator Class to zoom the view3D
+class ZoomView3D(Operator):
+    bl_idname = "view3d.zoom_view3d"
+    bl_label = "Zoom View3D"
+
+    delta = FloatProperty(
+        name="delta",
+        description="Delta",
+        min=-1.0, max=1,
+        default=1.0)
+
+    def invoke(self, context, event):                   
+        ob = context.object 
+        sd = context.space_data
+        
+        bpy.ops.view3d.zoom(delta = self.delta)
+        
+        align_to_view(context)
+        
+        return {'FINISHED'}
+
+    def execute(self, context):        
+        align_to_view(context)
+        
+        return{'FINISHED'}
+
+# Oprerator Class to use numpad shortcut
+class PresetView3D(Operator):
+    bl_idname = "view3d.preset_view3d"
+    bl_label = "Preset View3D"
+
+    view = StringProperty(name="View", description="Select the view", default='TOP')
+
+    def invoke(self, context, event):                   
+        ob = context.object 
+        origine = ob.location
+        sd = context.space_data
+
+        if ob.custom_rot:
+            vr_b = sd.region_3d.view_rotation.copy()
+            vr_b.invert()
+            pos_init = sd.region_3d.view_location - origine
+            sd.region_3d.view_location = origine
+
+        tmp = context.user_preferences.view.smooth_view
+        context.user_preferences.view.smooth_view = 0
+        bpy.ops.view3d.viewnumpad(type=self.view)
+        align_to_view(context)        
+        context.user_preferences.view.smooth_view = tmp
+     
+        if ob.custom_rot:
+            vr_a = sd.region_3d.view_rotation.copy()                           
+            pos_init.rotate(vr_a*vr_b)            
+            sd.region_3d.view_location =  pos_init + origine
+               
+                    
+        return {'FINISHED'}
+
+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/addons_contrib/system_project_folder.py b/release/scripts/addons_contrib/system_project_folder.py
new file mode 100644
index 0000000..e1250e1
--- /dev/null
+++ b/release/scripts/addons_contrib/system_project_folder.py
@@ -0,0 +1,83 @@
+# system_project_folder.py (c) 2010 Dany Lebel (Axon_D)
+#
+# ***** 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": "Project Folder",
+    "author": "Dany Lebel (Axon_D), Spirou4D",
+    "version": (0,3, 1),
+    "blender": (2, 6, 1),
+    "api": 43260,
+    "location": "Info -> File Menu -> Project Folder",
+    "description": "Open the project folder in a file browser",
+    "warning": "",
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/Scripts/System/Project_Folder",
+    "tracker_url": "http://projects.blender.org/tracker/index.php?func=detail&aid=25910",
+    "category": "System"}
+
+
+import bpy
+import os
+from platform import system as currentOS
+
+
+class ProjectFolder(bpy.types.Operator):
+    """Open the Project Folder in a file Browser"""
+    bl_idname = "file.project_folder"
+    bl_label = "Project Folder"
+    
+    
+    def execute(self, context):
+        try :
+            path = self.path()
+        except ValueError:
+            self.report({'INFO'}, "No project folder yet")
+            return {'FINISHED'}
+        
+        bpy.ops.wm.path_open(filepath=path)
+
+        
+        return {'FINISHED'}
+
+    def path(self):
+        filepath = bpy.data.filepath
+        relpath = bpy.path.relpath(filepath)
+        path = filepath[0: -1 * (relpath.__len__() - 2)]
+        return path
+
+
+# Registration
+
+def menu_func(self, context):
+    self.layout.operator(
+        ProjectFolder.bl_idname,
+        text="Project Folder", 
+        icon="FILESEL")
+
+def register():
+    bpy.utils.register_class(ProjectFolder)
+    bpy.types.INFO_MT_file.prepend(menu_func)
+
+def unregister():
+    bpy.utils.unregister_class(ProjectFolder)
+    bpy.types.INFO_MT_file.remove(menu_func)
+
+if __name__ == "__main__":
+    register()
diff --git a/release/scripts/addons_contrib/text_intellisense.py b/release/scripts/addons_contrib/text_intellisense.py
new file mode 100644
index 0000000..1e1c0cb
--- /dev/null
+++ b/release/scripts/addons_contrib/text_intellisense.py
@@ -0,0 +1,436 @@
+# ***** 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": "Intellisense for Text Editor",
+	"author": "Mackraken",
+	"version": (0, 2),
+	"blender": (2, 6, 0),
+	"api": 41851,
+	"location": "Ctrl + Space at Text Editor",
+	"description": "Adds intellense to the Text Editor",
+	"warning": "Only works with 2.57 intellisense",
+	"wiki_url": "",
+	"tracker_url": "",
+	"category": "Development"}
+
+import bpy
+
+def complete(context):
+	from console import intellisense
+	from console_python import get_console
+	
+	sc = context.space_data
+	text = sc.text
+	
+	region = context.region
+	for area in context.screen.areas:
+		if area.type=="CONSOLE":
+			region = area.regions[1]
+			break
+	
+	console = get_console(hash(region))[0]
+
+	line = text.current_line.body
+	cursor = text.current_character
+	
+	result  = intellisense.expand(line, cursor, console.locals, bpy.app.debug)
+	
+	return result
+
+	
+class Intellimenu(bpy.types.Menu):
+	bl_label = ""
+	bl_idname = "IntelliMenu"
+	
+	text = ""
+	
+	def draw(self, context):
+		layout = self.layout
+		#Very ugly see how can i fix this
+		options = complete(context)
+		
+		options = options[2].split("  ")
+		for op in options:
+			layout.operator("text.intellioptions", text=op).text=op
+		
+#This operator executes when hits Ctrl+Space at the text editor
+
+class Intellisense(bpy.types.Operator):
+	#'''Tooltip'''
+	bl_idname = "text.intellisense"
+	bl_label = "Text Editor Intellisense"
+	
+	text = ""
+	
+#	@classmethod
+#	def poll(cls, context):
+#		return context.active_object is not None
+
+	def execute(self, context):
+		sc = context.space_data
+		text = sc.text
+		
+		if text.current_character>0:
+			result = complete(context)
+	
+			#print(result)
+			
+			if result[2]=="":
+				text.current_line.body = result[0]
+				bpy.ops.text.move(type='LINE_END')
+			else:
+				bpy.ops.wm.call_menu(name=Intellimenu.bl_idname)
+
+		return {'FINISHED'}
+	
+#this operator completes the line with the options you choose from the menu
+class Intellioptions(bpy.types.Operator):
+	#'''Tooltip'''
+	bl_idname = "text.intellioptions"
+	bl_label = "Intellisense options"
+
+	text = bpy.props.StringProperty()
+	
+	@classmethod
+	def poll(cls, context):
+		return context.active_object is not None
+
+	def execute(self, context):
+		sc = context.space_data
+		text = sc.text
+		
+		comp = self.text
+		line = text.current_line.body
+		
+		lline = len(line)
+		lcomp = len(comp)
+		
+		#intersect text 
+		intersect = [-1,-1]
+		
+		for i in range(lcomp):
+			val1 = comp[0:i+1]
+			
+			for j in range(lline):
+				val2 = line[lline-j-1::]
+				#print("	",j, val2)
+			
+				if val1==val2:
+					intersect = [i, j]
+					break
+				
+		if intersect[0]>-1:
+			newline = line[0:lline-intersect[1]-1]+comp
+		else:
+			newline = line + comp
+			
+		#print(newline)		
+		text.current_line.body = newline
+			
+		bpy.ops.text.move(type='LINE_END')
+		   
+
+		return {'FINISHED'}
+
+def send_console(context, all=0):
+	
+	sc = context.space_data
+	text = sc.text
+	
+	console = None
+	
+	for area in bpy.context.screen.areas:
+		if area.type=="CONSOLE":
+			from console_python import get_console
+				
+			console = get_console(hash(area.regions[1]))[0]
+
+	if console==None:
+		return {'FINISHED'}
+	
+	if all:
+		
+		for l in text.lines:
+			console.push(l.body)
+			
+	else:
+		#print(console.prompt)
+		console.push(text.current_line.body)
+	
+	
+	
+	
+class TestLine(bpy.types.Operator):
+	#'''Tooltip'''
+	bl_idname = "text.test_line"
+	bl_label = "Test line"
+
+	all = bpy.props.BoolProperty(default=False)
+	
+	
+#   @classmethod
+#   def poll(cls, context):
+#	   return context.active_object is not None
+
+	def execute(self, context):
+		#print("test line")
+		
+		#send_console(context, self.all)
+		sc = context.space_data
+		text = sc.text
+		
+		line = text.current_line.body
+		console = None
+		
+		for area in bpy.context.screen.areas:
+			if area.type=="CONSOLE":
+				from console_python import get_console
+					
+				console = get_console(hash(area.regions[1]))[0]
+		
+		if console==None:
+			return {'FINISHED'}
+				
+		command = ""
+			
+		forindex = line.find("for ")
+		if forindex >-1:
+			
+			var = line[forindex+4:-1]
+			var = var[0:var.find(" ")]
+			state = line[line.rindex(" ")+1:-1]
+			 
+			command = var + " = " +state+"[0]"
+			
+				
+		else:
+			command = line
+			
+		#print(command)
+		try:
+			console.push(command)
+		except:
+			pass
+		
+		bpy.ops.text.line_break()
+		
+
+		return {'FINISHED'}
+class SetBreakPoint(bpy.types.Operator):
+	bl_idname = "text.set_breakpoint"
+	bl_label = "Set Breakpoint"
+	
+	def execute(self, context):
+		
+		sc = bpy.context.space_data
+		text = sc.text
+		
+		line = text.current_line
+		br = " #breakpoint"
+		#print(line.body.find(br))
+		if line.body.find(br)>-1:
+			
+			line.body = line.body.replace(br, "")
+		else:
+			
+			line.body += br
+		
+		return {'FINISHED'}
+
+class Debug(bpy.types.Operator):
+	bl_idname = "text.debug"
+	bl_label = "Debug"
+	
+	def execute(self, context):
+		
+		binpath = bpy.app.binary_path
+			
+		addonspath = binpath[0:binpath.rindex("\\")+1]+str(bpy.app.version[0])+"."+str(bpy.app.version[1])+"\\scripts\\addons\\"
+		
+		print(addonspath)
+			
+		sc = context.space_data
+		text = sc.text
+		
+		br = " #breakpoint"
+	
+		filepath = addonspath+"debug.py"
+		file = open(filepath, "w")
+		file.write("import pdb\n")
+		
+		for line in text.lines:
+			l = line.body
+			
+			if line.body.find(br)>-1:
+				indent = ""
+				for letter in line.body:
+					
+					if not letter.isalpha():
+						indent+=letter
+					else:
+						break
+				file.write(l[0:-len(br)]+"\n")
+				
+				file.write(indent+"pdb.set_trace()\n")
+				
+			else:
+				file.write(line.body+"\n")
+						
+				
+		
+		file.close()
+		
+		import pdb
+		import debug
+		
+		pdb.runcall("debug")	
+		
+		
+		return {'FINISHED'}
+
+
+class DebugPanel(bpy.types.Panel):
+	bl_label = "Debug"
+	bl_idname = "text.test_line"
+	bl_space_type = "TEXT_EDITOR"
+	bl_region_type = "UI"
+	#bl_context = "object"
+
+	text = bpy.props.StringProperty()
+	
+	def draw(self, context):
+		layout = self.layout
+		row = layout.row()
+		
+		text = self.text
+		row = layout.row()
+		row.operator("text.debug", text ="Debug")
+		row = layout.row()
+		row.operator("text.set_breakpoint")
+		row = layout.row()
+		row.operator("text.test_line").all=False
+		row = layout.row()
+		row.operator("text.test_line", text ="Test All").all=True
+		
+		row = layout.row()
+		row.label(text="Coming Soon ...")
+
+
+### ASSIGN A KEY
+ 
+#section = Input section. "Window, Text, ..."
+#name = operator name or wm.call_menu 
+#type = key 
+#event = keyboard event (Press, release, ...)
+#mods = array containing key modifiers (["ctrl", "alt", "shift"]
+#propvalue = menu name, if name is set to "wm.call_menu"
+#overwrite doesnt work at the moment
+
+def assignKey(section, name, type, event, mods=[],propvalue = "",  overwrite=0):
+	
+	kconf = bpy.context.window_manager.keyconfigs.active
+	
+	
+	#check section
+	validsections = [item.name for item in kconf.keymaps]
+	if not section in validsections:
+		print(section  + " is not a valid section.")
+		#print(validsections)	
+		return False
+	
+	#check type
+	type = type.upper()
+	validkeys = [item.identifier for item in bpy.types.KeyMapItem.bl_rna.properties['type'].enum_items]
+	if not type in validkeys:
+		print(type + " is not a valid key.")
+		#print(validkeys)
+		return False
+
+
+	#check event
+	event = event.upper()   
+	validevents = [item.identifier for item in bpy.types.KeyMapItem.bl_rna.properties['value'].enum_items]
+	if not event in validevents:
+		print(event + " is not a valid event.")
+		#print(validevents)
+		
+	kmap = kconf.keymaps[section] 
+
+	
+#   get mods
+	for i, mod in enumerate(mods):
+		mods[i]= mod.lower()
+		
+	#any, shift, ctrl, alt, oskey
+	kmod = [False, False, False, False, False]
+	
+	if "any" in mods: kmod[0] = True
+	if "shift" in mods: kmod[1] = True
+	if "ctrl" in mods: kmod[2] = True
+	if "alt" in mods: kmod[3] = True
+	if "oskey" in mods: kmod[4] = True
+	
+#   #check if key exist
+	kexists = False
+  
+	for key in kmap.keymap_items:
+		keymods = [key.any, key.shift, key.ctrl, key.alt, key.oskey]
+		if key.type == type and keymods == kmod:
+			kexists = True
+			print(key,"key exists")
+			break
+			
+	if kexists:
+		#overwrite?
+		if overwrite:
+			key.idname=name
+			
+			#key.type = type
+		
+	else:
+		#create key
+		key = kmap.keymap_items.new(name, type, event, False)
+		key.any = kmod[0]
+		key.shift = kmod[1]
+		key.ctrl = kmod[2]
+		key.alt = kmod[3]
+		key.oskey = kmod[4]
+				
+		if propvalue!="": key.properties.name = propvalue
+
+
+
+
+classes = [Intellisense, Intellioptions, Intellimenu, DebugPanel, TestLine, SetBreakPoint, Debug]
+
+def register():
+	
+	for c in classes:
+		bpy.utils.register_class(c)
+
+	assignKey("Text", "text.intellisense", "SPACE", "Press",  ["ctrl"])
+	assignKey("Text", "text.test_line", "RET", "Press", [],"",1)
+
+def unregister():
+	for c in classes:
+		bpy.utils.unregister_class(c)
+
+if __name__ == "__main__":
+	register()
diff --git a/release/scripts/modules/addon_utils.py b/release/scripts/modules/addon_utils.py
index 2b1616a..588c10e 100644
--- a/release/scripts/modules/addon_utils.py
+++ b/release/scripts/modules/addon_utils.py
@@ -65,7 +65,7 @@ def modules(module_cache):
     def fake_module(mod_name, mod_path, speedy=True, force_support=None):
         global error_encoding
 
-        if _bpy.app.debug:
+        if _bpy.app.debug_python:
             print("fake_module", mod_path, mod_name)
         import ast
         ModuleType = type(ast)
@@ -284,7 +284,7 @@ def enable(module_name, default_set=True):
 
     mod.__addon_enabled__ = True
 
-    if _bpy.app.debug:
+    if _bpy.app.debug_python:
         print("\taddon_utils.enable", mod.__name__)
 
     return mod
@@ -323,7 +323,7 @@ def disable(module_name, default_set=True):
             if addon:
                 addons.remove(addon)
 
-    if _bpy.app.debug:
+    if _bpy.app.debug_python:
         print("\taddon_utils.disable", module_name)
 
 
diff --git a/release/scripts/modules/blend_render_info.py b/release/scripts/modules/blend_render_info.py
index 7c30b48..5a09f66 100755
--- a/release/scripts/modules/blend_render_info.py
+++ b/release/scripts/modules/blend_render_info.py
@@ -75,7 +75,7 @@ def read_blend_rend_chunk(path):
         # Now we want the scene name, start and end frame. this is 32bites long
         start_frame, end_frame = struct.unpack('>2i' if is_big_endian else '<2i', blendfile.read(8))
 
-        scene_name = blendfile.read(24)
+        scene_name = blendfile.read(64)
 
         scene_name = scene_name[:scene_name.index(b'\0')]
 
diff --git a/release/scripts/modules/bpy/__init__.py b/release/scripts/modules/bpy/__init__.py
index 75572a6..621484f 100644
--- a/release/scripts/modules/bpy/__init__.py
+++ b/release/scripts/modules/bpy/__init__.py
@@ -50,7 +50,9 @@ def main():
     # Possibly temp. addons path
     from os.path import join, dirname, normpath
     sys.path.append(normpath(join(dirname(__file__),
-                                   "..", "..", "addons", "modules")))
+                                  "..", "..", "addons", "modules")))
+    sys.path.append(join(utils.user_resource('SCRIPTS'),
+                         "addons", "modules"))
 
     # fake module to allow:
     #   from bpy.types import Panel
diff --git a/release/scripts/modules/bpy/path.py b/release/scripts/modules/bpy/path.py
index 98a3c81..7b54af9 100644
--- a/release/scripts/modules/bpy/path.py
+++ b/release/scripts/modules/bpy/path.py
@@ -118,6 +118,14 @@ def clean_name(name, replace="_"):
     return name
 
 
+def _clean_utf8(name):
+    name = _os.path.splitext(basename(name))[0]
+    if type(name) == bytes:
+        return name.decode("utf8", "replace")
+    else:
+        return name.encode("utf8", "replace").decode("utf8")
+
+
 def display_name(name):
     """
     Creates a display string from name to be used menus and the user interface.
@@ -126,17 +134,18 @@ def display_name(name):
     filenames and module names.
     """
 
-    name_base = _os.path.splitext(name)[0]
+    name = _os.path.splitext(name)[0]
 
     # string replacements
-    name_base = name_base.replace("_colon_", ":")
+    name = name.replace("_colon_", ":")
 
-    name_base = name_base.replace("_", " ")
+    name = name.replace("_", " ")
 
-    if name_base.islower():
-        return name_base.lower().title()
-    else:
-        return name_base
+    if name.islower():
+        name = name.lower().title()
+
+    name = _clean_utf8(name)
+    return name
 
 
 def display_name_from_filepath(name):
@@ -144,8 +153,10 @@ def display_name_from_filepath(name):
     Returns the path stripped of directory and extension,
     ensured to be utf8 compatible.
     """
+
     name = _os.path.splitext(basename(name))[0]
-    return name.encode("utf8", "replace").decode("utf8")
+    name = _clean_utf8(name)
+    return name
 
 
 def resolve_ncase(path):
diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py
index 63ba213..2824d62 100644
--- a/release/scripts/modules/bpy/utils.py
+++ b/release/scripts/modules/bpy/utils.py
@@ -57,7 +57,7 @@ _script_module_dirs = "startup", "modules"
 
 
 def _test_import(module_name, loaded_modules):
-    use_time = _bpy.app.debug
+    use_time = _bpy.app.debug_python
 
     if module_name in loaded_modules:
         return None
@@ -126,7 +126,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
        as modules.
     :type refresh_scripts: bool
     """
-    use_time = _bpy.app.debug
+    use_time = _bpy.app.debug_python
 
     prefs = _bpy.context.user_preferences
 
@@ -426,7 +426,7 @@ def preset_find(name, preset_path, display_name=False, ext=".py"):
 def keyconfig_set(filepath):
     from os.path import basename, splitext
 
-    if _bpy.app.debug:
+    if _bpy.app.debug_python:
         print("loading preset:", filepath)
 
     keyconfigs = _bpy.context.window_manager.keyconfigs
diff --git a/release/scripts/modules/bpy_extras/image_utils.py b/release/scripts/modules/bpy_extras/image_utils.py
index 7d40951..c21b750 100644
--- a/release/scripts/modules/bpy_extras/image_utils.py
+++ b/release/scripts/modules/bpy_extras/image_utils.py
@@ -97,7 +97,7 @@ def load_image(imagepath,
 
         # image path has been checked so the path could not be read for some
         # reason, so be sure to return a placeholder
-        if place_holder:
+        if place_holder and image is None:
             image = _image_load_placeholder(path)
 
         return image
diff --git a/release/scripts/modules/bpy_extras/io_utils.py b/release/scripts/modules/bpy_extras/io_utils.py
index 38fdb8f..593fc85 100644
--- a/release/scripts/modules/bpy_extras/io_utils.py
+++ b/release/scripts/modules/bpy_extras/io_utils.py
@@ -335,7 +335,7 @@ path_reference_mode = EnumProperty(
                ('MATCH', "Match", "Match Absolute/Relative "
                                   "setting with input path"),
                ('STRIP', "Strip Path", "Filename only"),
-               ('COPY', "Copy", "copy the file to the destination path "
+               ('COPY', "Copy", "Copy the file to the destination path "
                                 "(or subdirectory)"),
                ),
         default='AUTO'
diff --git a/release/scripts/modules/bpy_extras/mesh_utils.py b/release/scripts/modules/bpy_extras/mesh_utils.py
index 601ffae..3ce4515 100644
--- a/release/scripts/modules/bpy_extras/mesh_utils.py
+++ b/release/scripts/modules/bpy_extras/mesh_utils.py
@@ -19,17 +19,17 @@
 # <pep8-80 compliant>
 
 __all__ = (
-    "mesh_linked_faces",
+    "mesh_linked_tessfaces",
     "edge_face_count_dict",
     "edge_face_count",
-    "edge_loops_from_faces",
+    "edge_loops_from_tessfaces",
     "edge_loops_from_edges",
-    "ngon_tesselate",
+    "ngon_tessellate",
     "face_random_points",
     )
 
 
-def mesh_linked_faces(mesh):
+def mesh_linked_tessfaces(mesh):
     """
     Splits the mesh into connected faces, use this for seperating cubes from
     other mesh elements within 1 mesh datablock.
@@ -42,20 +42,21 @@ def mesh_linked_faces(mesh):
 
     # Build vert face connectivity
     vert_faces = [[] for i in range(len(mesh.vertices))]
-    for f in mesh.faces:
+    for f in mesh.tessfaces:
         for v in f.vertices:
             vert_faces[v].append(f)
 
     # sort faces into connectivity groups
-    face_groups = [[f] for f in mesh.faces]
-    face_mapping = list(range(len(mesh.faces)))  # map old, new face location
+    face_groups = [[f] for f in mesh.tessfaces]
+    # map old, new face location
+    face_mapping = list(range(len(mesh.tessfaces)))
 
     # Now clump faces iteratively
     ok = True
     while ok:
         ok = False
 
-        for i, f in enumerate(mesh.faces):
+        for i, f in enumerate(mesh.tessfaces):
             mapped_index = face_mapping[f.index]
             mapped_group = face_groups[mapped_index]
 
@@ -90,7 +91,7 @@ def edge_face_count_dict(mesh):
        faces using each edge.
     :rtype: dict
     """
-    face_edge_keys = [face.edge_keys for face in mesh.faces]
+    face_edge_keys = [face.edge_keys for face in mesh.tessfaces]
     face_edge_count = {}
     for face_keys in face_edge_keys:
         for key in face_keys:
@@ -112,11 +113,11 @@ def edge_face_count(mesh):
     return [get(edge_face_count, ed.key, 0) for ed in mesh.edges]
 
 
-def edge_loops_from_faces(mesh, faces=None, seams=()):
+def edge_loops_from_tessfaces(mesh, tessfaces=None, seams=()):
     """
     Edge loops defined by faces
 
-    Takes me.faces or a list of faces and returns the edge loops
+    Takes me.tessfaces or a list of faces and returns the edge loops
     These edge loops are the edges that sit between quads, so they dont touch
     1 quad, note: not connected will make 2 edge loops,
     both only containing 2 edges.
@@ -126,22 +127,21 @@ def edge_loops_from_faces(mesh, faces=None, seams=()):
 
     :arg mesh: the mesh used to get edge loops from.
     :type mesh: :class:`bpy.types.Mesh`
-    :arg faces: optional face list to only use some of the meshes faces.
-    :type faces: :class:`bpy.types.MeshFaces`, sequence or or NoneType
+    :arg tessfaces: optional face list to only use some of the meshes faces.
+    :type tessfaces: :class:`bpy.types.MeshTessFace`, sequence or or NoneType
     :return: return a list of edge vertex index lists.
     :rtype: list
     """
 
     OTHER_INDEX = 2, 3, 0, 1  # opposite face index
 
-    if faces is None:
-        faces = mesh.faces
+    if tessfaces is None:
+        tessfaces = mesh.tessfaces
 
     edges = {}
 
-    for f in faces:
-#        if len(f) == 4:
-        if f.vertices_raw[3] != 0:
+    for f in tessfaces:
+        if len(f.vertices) == 4:
             edge_keys = f.edge_keys
             for i, edkey in enumerate(f.edge_keys):
                 edges.setdefault(edkey, []).append(edge_keys[OTHER_INDEX[i]])
@@ -257,7 +257,7 @@ def edge_loops_from_edges(mesh, edges=None):
     return line_polys
 
 
-def ngon_tesselate(from_data, indices, fix_loops=True):
+def ngon_tessellate(from_data, indices, fix_loops=True):
     '''
     Takes a polyline of indices (fgon) and returns a list of face
     indicie lists. Designed to be used for importers that need indices for an
@@ -270,7 +270,7 @@ def ngon_tesselate(from_data, indices, fix_loops=True):
        polylines are delt with correctly.
     '''
 
-    from mathutils.geometry import tesselate_polygon
+    from mathutils.geometry import tessellate_polygon
     from mathutils import Vector
     vector_to_tuple = Vector.to_tuple
 
@@ -304,7 +304,7 @@ def ngon_tesselate(from_data, indices, fix_loops=True):
             if verts[i][1] == verts[i - 1][0]:
                 verts.pop(i - 1)
 
-        fill = tesselate_polygon([verts])
+        fill = tessellate_polygon([verts])
 
     else:
         '''
@@ -412,7 +412,7 @@ def ngon_tesselate(from_data, indices, fix_loops=True):
                     vert_map[i + ii] = vert[2]
                 ii += len(verts)
 
-        fill = tesselate_polygon([[v[0] for v in loop] for loop in loop_list])
+        fill = tessellate_polygon([[v[0] for v in loop] for loop in loop_list])
         #draw_loops(loop_list)
         #raise 'done loop'
         # map to original indices
@@ -443,14 +443,14 @@ def ngon_tesselate(from_data, indices, fix_loops=True):
     return fill
 
 
-def face_random_points(num_points, faces):
+def face_random_points(num_points, tessfaces):
     """
-    Generates a list of random points over mesh faces.
+    Generates a list of random points over mesh tessfaces.
 
     :arg num_points: the number of random points to generate on each face.
     :type int:
-    :arg faces: list of the faces to generate points on.
-    :type faces: :class:`bpy.types.MeshFaces`, sequence
+    :arg tessfaces: list of the faces to generate points on.
+    :type tessfaces: :class:`bpy.types.MeshTessFace`, sequence
     :return: list of random points over all faces.
     :rtype: list
     """
@@ -460,7 +460,7 @@ def face_random_points(num_points, faces):
 
     # Split all quads into 2 tris, tris remain unchanged
     tri_faces = []
-    for f in faces:
+    for f in tessfaces:
         tris = []
         verts = f.id_data.vertices
         fv = f.vertices[:]
@@ -476,7 +476,7 @@ def face_random_points(num_points, faces):
         tri_faces.append(tris)
 
     # For each face, generate the required number of random points
-    sampled_points = [None] * (num_points * len(faces))
+    sampled_points = [None] * (num_points * len(tessfaces))
     for i, tf in enumerate(tri_faces):
         for k in range(num_points):
             # If this is a quad, we need to weight its 2 tris by their area
diff --git a/release/scripts/modules/bpy_extras/object_utils.py b/release/scripts/modules/bpy_extras/object_utils.py
index 66b774e..b1de1fd 100644
--- a/release/scripts/modules/bpy_extras/object_utils.py
+++ b/release/scripts/modules/bpy_extras/object_utils.py
@@ -21,12 +21,15 @@
 __all__ = (
     "add_object_align_init",
     "object_data_add",
+    "AddObjectHelper",
     )
 
 
 import bpy
 import mathutils
 
+from bpy.props import BoolProperty, FloatVectorProperty
+
 
 def add_object_align_init(context, operator):
     """
@@ -86,7 +89,7 @@ def add_object_align_init(context, operator):
     return location * rotation
 
 
-def object_data_add(context, obdata, operator=None):
+def object_data_add(context, obdata, operator=None, use_active_layer=True):
     """
     Add an object using the view context and preference to to initialize the
     location, rotation and layer.
@@ -111,7 +114,18 @@ def object_data_add(context, obdata, operator=None):
     base = scene.objects.link(obj_new)
     base.select = True
 
+    v3d = None
     if context.space_data and context.space_data.type == 'VIEW_3D':
+        v3d = context.space_data
+
+    if use_active_layer:
+        if v3d and v3d.local_view:
+            base.layers_from_view(context.space_data)
+            base.layers[scene.active_layer] = True
+        else:
+            base.layers = [True if i == scene.active_layer
+                else False for i in range(len(scene.layers))]
+    if v3d:
         base.layers_from_view(context.space_data)
 
     obj_new.matrix_world = add_object_align_init(context, operator)
@@ -153,3 +167,23 @@ def object_data_add(context, obdata, operator=None):
             bpy.ops.object.mode_set(mode='EDIT')
 
     return base
+
+
+class AddObjectHelper:
+    def view_align_update_callback(self, context):
+        if not self.view_align:
+            self.rotation.zero()
+
+    view_align = BoolProperty(
+            name="Align to View",
+            default=False,
+            update=view_align_update_callback,
+            )
+    location = FloatVectorProperty(
+            name="Location",
+            subtype='TRANSLATION',
+            )
+    rotation = FloatVectorProperty(
+            name="Rotation",
+            subtype='EULER',
+            )
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py
index 088e239..91d8f1b 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -366,14 +366,15 @@ class Mesh(bpy_types.ID):
         :type edges: iterable object
         :arg faces:
 
-           iterator of faces, each faces contains three or four indices to
+           iterator of faces, each faces contains three or more indices to
            the *vertices* argument. eg: [(5, 6, 8, 9), (1, 2, 3), ...]
 
         :type faces: iterable object
         """
         self.vertices.add(len(vertices))
         self.edges.add(len(edges))
-        self.faces.add(len(faces))
+        self.loops.add(sum((len(f) for f in faces)))
+        self.polygons.add(len(faces))
 
         vertices_flat = [f for v in vertices for f in v]
         self.vertices.foreach_set("co", vertices_flat)
@@ -383,19 +384,19 @@ class Mesh(bpy_types.ID):
         self.edges.foreach_set("vertices", edges_flat)
         del edges_flat
 
-        def treat_face(f):
-            if len(f) == 3:
-                if f[2] == 0:
-                    return f[2], f[0], f[1], 0
-                else:
-                    return f[0], f[1], f[2], 0
-            elif f[2] == 0 or f[3] == 0:
-                return f[2], f[3], f[0], f[1]
-            return f
+        # this is different in bmesh
+        loop_index = 0
+        for i, p in enumerate(self.polygons):
+            f = faces[i]
+            loop_len = len(f)
+            p.loop_start = loop_index
+            p.loop_total = loop_len
+            p.vertices = f
+            loop_index += loop_len
 
-        faces_flat = [v for f in faces for v in treat_face(f)]
-        self.faces.foreach_set("vertices_raw", faces_flat)
-        del faces_flat
+        # if no edges - calculae them
+        if faces and (not edges):
+            self.update(calc_edges=True)
 
     @property
     def edge_keys(self):
@@ -410,7 +411,7 @@ class MeshEdge(StructRNA):
         return ord_ind(*tuple(self.vertices))
 
 
-class MeshFace(StructRNA):
+class MeshTessFace(StructRNA):
     __slots__ = ()
 
     @property
@@ -446,6 +447,22 @@ class MeshFace(StructRNA):
                     )
 
 
+class MeshPolygon(StructRNA):
+    __slots__ = ()
+
+    @property
+    def edge_keys(self):
+        verts = self.vertices[:]
+        vlen = len(self.vertices)
+        return [ord_ind(verts[i], verts[(i + 1) % vlen]) for i in range(vlen)]
+
+    @property
+    def loop_indices(self):
+        start = self.loop_start
+        end = start + self.loop_total
+        return range(start, end)
+
+
 class Text(bpy_types.ID):
     __slots__ = ()
 
@@ -654,7 +671,9 @@ class Header(StructRNA, _GenericUI, metaclass=RNAMeta):
 class Menu(StructRNA, _GenericUI, metaclass=RNAMeta):
     __slots__ = ()
 
-    def path_menu(self, searchpaths, operator, props_default={}):
+    def path_menu(self, searchpaths, operator,
+                  props_default={}, filter_ext=None):
+
         layout = self.layout
         # hard coded to set the operators 'filepath' to the filename.
 
@@ -670,17 +689,16 @@ class Menu(StructRNA, _GenericUI, metaclass=RNAMeta):
         files = []
         for directory in searchpaths:
             files.extend([(f, os.path.join(directory, f))
-                           for f in os.listdir(directory)])
+                           for f in os.listdir(directory)
+                           if (not f.startswith("."))
+                           if ((filter_ext is None) or
+                               (filter_ext(os.path.splitext(f)[1])))
+                          ])
 
         files.sort()
 
         for f, filepath in files:
-
-            if f.startswith("."):
-                continue
-
-            preset_name = bpy.path.display_name(f)
-            props = layout.operator(operator, text=preset_name)
+            props = layout.operator(operator, text=bpy.path.display_name(f))
 
             for attr, value in props_default.items():
                 setattr(props, attr, value)
@@ -697,4 +715,5 @@ class Menu(StructRNA, _GenericUI, metaclass=RNAMeta):
         """
         import bpy
         self.path_menu(bpy.utils.preset_paths(self.preset_subdir),
-                       self.preset_operator)
+                       self.preset_operator,
+                       filter_ext=lambda ext: ext.lower() in {".py", ".xml"})
diff --git a/release/scripts/modules/console_python.py b/release/scripts/modules/console_python.py
index 6c49283..4ddde0d 100644
--- a/release/scripts/modules/console_python.py
+++ b/release/scripts/modules/console_python.py
@@ -246,7 +246,7 @@ def autocomplete(context):
                 line=line,
                 cursor=current_line.current_character,
                 namespace=console.locals,
-                private=bpy.app.debug)
+                private=bpy.app.debug_python)
 
         line_new = result[0]
         current_line.body, current_line.current_character, scrollback = result
@@ -306,9 +306,6 @@ def banner(context):
     add_scrollback("Convenience Imports: from mathutils import *; "
                    "from math import *", 'OUTPUT')
     add_scrollback("", 'OUTPUT')
-    # add_scrollback("  WARNING!!! Blender 2.5 API is subject to change, "
-    #                "see API reference for more info", 'ERROR')
-    # add_scrollback("", 'OUTPUT')
     sc.prompt = PROMPT
 
     return {'FINISHED'}
diff --git a/release/scripts/modules/rna_xml.py b/release/scripts/modules/rna_xml.py
index eae7840..710035d 100644
--- a/release/scripts/modules/rna_xml.py
+++ b/release/scripts/modules/rna_xml.py
@@ -346,7 +346,7 @@ def xml_file_run(context, filepath, rna_map):
         value = _get_context_val(context, rna_path)
 
         if value is not Ellipsis and value is not None:
-            print("  loading XML: %r" % rna_path)
+            print("  loading XML: %r -> %r" % (filepath, rna_path))
             xml2rna(xml_node, root_rna=value)
 
 
diff --git a/release/scripts/modules/sys_info.py b/release/scripts/modules/sys_info.py
index 10aba96..0fa80a8 100644
--- a/release/scripts/modules/sys_info.py
+++ b/release/scripts/modules/sys_info.py
@@ -57,66 +57,66 @@ def write_sysinfo(op):
     else:
         output = bpy.data.texts.new(name=output_filename)
 
-    header = '= Blender {} System Information =\n'.format(bpy.app.version_string)
-    lilies = '{}\n\n'.format(len(header) * '=')
-    firstlilies = '{}\n'.format(len(header) * '=')
+    header = "= Blender %s System Information =\n" % bpy.app.version_string
+    lilies = "%s\n\n" % (len(header) * "=")
+    firstlilies = "%s\n" % (len(header) * "=")
     output.write(firstlilies)
     output.write(header)
     output.write(lilies)
 
     # build info
-    output.write('\nBlender:\n')
+    output.write("\nBlender:\n")
     output.write(lilies)
-    output.write('version {}, revision {}. {}\n'.format(bpy.app.version_string, bpy.app.build_revision, bpy.app.build_type))
-    output.write('build date: {}, {}\n'.format(bpy.app.build_date, bpy.app.build_time))
-    output.write('platform: {}\n'.format(bpy.app.build_platform))
-    output.write('binary path: {}\n'.format(bpy.app.binary_path))
-    output.write('build cflags: {}\n'.format(bpy.app.build_cflags))
-    output.write('build cxxflags: {}\n'.format(bpy.app.build_cxxflags))
-    output.write('build linkflags: {}\n'.format(bpy.app.build_linkflags))
-    output.write('build system: {}\n'.format(bpy.app.build_system))
+    output.write("version %s, revision %r. %r\n" % (bpy.app.version_string, bpy.app.build_revision, bpy.app.build_type))
+    output.write("build date: %r, %r\n" % (bpy.app.build_date, bpy.app.build_time))
+    output.write("platform: %r\n" % (bpy.app.build_platform))
+    output.write("binary path: %r\n" % (bpy.app.binary_path))
+    output.write("build cflags: %r\n" % (bpy.app.build_cflags))
+    output.write("build cxxflags: %r\n" % (bpy.app.build_cxxflags))
+    output.write("build linkflags: %r\n" % (bpy.app.build_linkflags))
+    output.write("build system: %r\n" % (bpy.app.build_system))
 
     # python info
-    output.write('\nPython:\n')
+    output.write("\nPython:\n")
     output.write(lilies)
-    output.write('version: {}\n'.format(sys.version))
-    output.write('paths:\n')
+    output.write("version: %s\n" % (sys.version))
+    output.write("paths:\n")
     for p in sys.path:
-        output.write('\t{}\n'.format(p))
+        output.write("\t%r\n" % (p))
 
-    output.write('\nDirectories:\n')
+    output.write("\nDirectories:\n")
     output.write(lilies)
-    output.write('scripts: {}\n'.format(bpy.utils.script_paths()))
-    output.write('user scripts: {}\n'.format(bpy.utils.user_script_path()))
-    output.write('datafiles: {}\n'.format(bpy.utils.user_resource('DATAFILES')))
-    output.write('config: {}\n'.format(bpy.utils.user_resource('CONFIG')))
-    output.write('scripts : {}\n'.format(bpy.utils.user_resource('SCRIPTS')))
-    output.write('autosave: {}\n'.format(bpy.utils.user_resource('AUTOSAVE')))
-    output.write('tempdir: {}\n'.format(bpy.app.tempdir))
-
-    output.write('\nFFmpeg:\n')
+    output.write("scripts: %r\n" % (bpy.utils.script_paths()))
+    output.write("user scripts: %r\n" % (bpy.utils.user_script_path()))
+    output.write("datafiles: %r\n" % (bpy.utils.user_resource('DATAFILES')))
+    output.write("config: %r\n" % (bpy.utils.user_resource('CONFIG')))
+    output.write("scripts : %r\n" % (bpy.utils.user_resource('SCRIPTS')))
+    output.write("autosave: %r\n" % (bpy.utils.user_resource('AUTOSAVE')))
+    output.write("tempdir: %r\n" % (bpy.app.tempdir))
+
+    output.write("\nFFmpeg:\n")
     output.write(lilies)
     ffmpeg = bpy.app.ffmpeg
     if ffmpeg.supported:
         for lib in ['avcodec', 'avdevice', 'avformat', 'avutil', 'swscale']:
-            output.write('{}:{}{}\n'.format(lib, " " * (10 - len(lib)),
-                         getattr(ffmpeg, lib + '_version_string')))
+            output.write("%r:%r%r\n" % (lib, " " * (10 - len(lib)),
+                         getattr(ffmpeg, lib + "_version_string")))
     else:
-        output.write('Blender was built without FFmpeg support\n')
+        output.write("Blender was built without FFmpeg support\n")
 
     if bpy.app.background:
-        output.write('\nOpenGL: missing, background mode\n')
+        output.write("\nOpenGL: missing, background mode\n")
     else:
-        output.write('\nOpenGL\n')
+        output.write("\nOpenGL\n")
         output.write(lilies)
-        output.write('renderer:\t{}\n'.format(bgl.glGetString(bgl.GL_RENDERER)))
-        output.write('vendor:\t\t{}\n'.format(bgl.glGetString(bgl.GL_VENDOR)))
-        output.write('version:\t{}\n'.format(bgl.glGetString(bgl.GL_VERSION)))
-        output.write('extensions:\n')
+        output.write("renderer:\t%r\n" % (bgl.glGetString(bgl.GL_RENDERER)))
+        output.write("vendor:\t\t%r\n" % (bgl.glGetString(bgl.GL_VENDOR)))
+        output.write("version:\t%r\n" % (bgl.glGetString(bgl.GL_VERSION)))
+        output.write("extensions:\n")
 
         glext = bgl.glGetString(bgl.GL_EXTENSIONS)
         glext = textWrap(glext, 70)
         for l in glext:
-            output.write('\t\t{}\n'.format(l))
+            output.write("\t\t%r\n" % (l))
 
     op.report({'INFO'}, "System information generated in 'system-info.txt'")
diff --git a/release/scripts/presets/fluid/honey.py b/release/scripts/presets/fluid/honey.py
new file mode 100644
index 0000000..fbeb7f2
--- /dev/null
+++ b/release/scripts/presets/fluid/honey.py
@@ -0,0 +1,3 @@
+import bpy
+bpy.context.fluid.settings.viscosity_base = 2.0
+bpy.context.fluid.settings.viscosity_exponent = 3
diff --git a/release/scripts/presets/fluid/oil.py b/release/scripts/presets/fluid/oil.py
new file mode 100644
index 0000000..3d73de9
--- /dev/null
+++ b/release/scripts/presets/fluid/oil.py
@@ -0,0 +1,3 @@
+import bpy
+bpy.context.fluid.settings.viscosity_base = 5.0
+bpy.context.fluid.settings.viscosity_exponent = 5
diff --git a/release/scripts/presets/fluid/water.py b/release/scripts/presets/fluid/water.py
new file mode 100644
index 0000000..0b68ad2
--- /dev/null
+++ b/release/scripts/presets/fluid/water.py
@@ -0,0 +1,3 @@
+import bpy
+bpy.context.fluid.settings.viscosity_base = 1.0
+bpy.context.fluid.settings.viscosity_exponent = 6
diff --git a/release/scripts/presets/interface_theme/back_to_black.xml b/release/scripts/presets/interface_theme/back_to_black.xml
index 76c30bb..66a2ae5 100644
--- a/release/scripts/presets/interface_theme/back_to_black.xml
+++ b/release/scripts/presets/interface_theme/back_to_black.xml
@@ -11,6 +11,7 @@
                    bone_pose="#50c8ff"
                    bone_solid="#c8c8c8"
                    bundle_solid="#c8c8c8"
+                   camera="#000000"
                    camera_path="#5a5a5a"
                    frame_current="#60c040"
                    edge_crease="#cc0099"
@@ -19,6 +20,7 @@
                    edge_select="#ffa000"
                    edge_sharp="#ff2020"
                    edge_facesel="#6b6b6b"
+                   empty="#000000"
                    face="#73828f12"
                    extra_face_angle="#00c900"
                    extra_face_area="#fff000"
@@ -404,6 +406,7 @@
     </properties>
     <sequence_editor>
       <ThemeSequenceEditor audio_strip="#2e8f8f"
+                           movieclip_strip="#20208f"
                            frame_current="#2f5f23"
                            draw_action="#50c8ff"
                            effect_strip="#a9547c"
@@ -413,6 +416,7 @@
                            meta_strip="#6d9183"
                            movie_strip="#516987"
                            plugin_strip="#7e7e50"
+                           preview_back="#000000"
                            scene_strip="#4e983e"
                            transition_strip="#a25f6f"
                            window_sliders="#a0a0a0">
@@ -434,13 +438,12 @@
     </sequence_editor>
     <text_editor>
       <ThemeTextEditor cursor="#ff0000"
+                       syntax_special="#969629"
                        line_numbers_background="#191919"
-                       scroll_bar="#acacac"
                        selected_text="#ffffff"
                        syntax_builtin="#cf3d99"
                        syntax_comment="#249d60"
                        syntax_numbers="#3c68ff"
-                       syntax_special="#969629"
                        syntax_string="#cc3535">
         <space>
           <ThemeSpaceGeneric header="#000000"
@@ -687,6 +690,18 @@
                              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>
diff --git a/release/scripts/presets/interface_theme/blender_24x.xml b/release/scripts/presets/interface_theme/blender_24x.xml
index 046a059..d36e542 100644
--- a/release/scripts/presets/interface_theme/blender_24x.xml
+++ b/release/scripts/presets/interface_theme/blender_24x.xml
@@ -11,6 +11,7 @@
                    bone_pose="#50c8ff"
                    bone_solid="#c8c8c8"
                    bundle_solid="#c8c8c8"
+                   camera="#000000"
                    camera_path="#000000"
                    frame_current="#60c040"
                    edge_crease="#cc0099"
@@ -19,6 +20,7 @@
                    edge_select="#cece38"
                    edge_sharp="#ff2020"
                    edge_facesel="#4b4b4b"
+                   empty="#000000"
                    face="#0032961e"
                    extra_face_angle="#000080"
                    extra_face_area="#002000"
@@ -155,10 +157,10 @@
     </dopesheet_editor>
     <file_browser>
       <ThemeFileBrowser active_file="#828282"
-                        active_file_text="#fafafa"
+                        active_file_text="#ffffff"
                         scroll_handle="#7f7070"
                         scrollbar="#a0a0a0"
-                        selected_file="#7f7f7f"
+                        selected_file="#a0a0d0"
                         tiles="#b4b4b4">
         <space>
           <ThemeSpaceGeneric header="#b4b4b4"
@@ -171,7 +173,7 @@
                              text="#000000"
                              text_hi="#0f0f0f"
                              title="#000000"
-                             back="#b4b4b4">
+                             back="#808080">
           </ThemeSpaceGeneric>
         </space>
         <space_list>
@@ -260,7 +262,7 @@
                              text="#000000"
                              text_hi="#ffffff"
                              title="#000000"
-                             back="#757575">
+                             back="#353535">
           </ThemeSpaceGeneric>
         </space>
       </ThemeImageEditor>
@@ -379,7 +381,7 @@
                              text="#000000"
                              text_hi="#ffffff"
                              title="#000000"
-                             back="#b4b4b4">
+                             back="#999999">
           </ThemeSpaceGeneric>
         </space>
       </ThemeOutliner>
@@ -404,6 +406,7 @@
     </properties>
     <sequence_editor>
       <ThemeSequenceEditor audio_strip="#2e8f8f"
+                           movieclip_strip="#20208f"
                            frame_current="#60c040"
                            draw_action="#50c8ff"
                            effect_strip="#a9547c"
@@ -413,6 +416,7 @@
                            meta_strip="#6d9183"
                            movie_strip="#516987"
                            plugin_strip="#7e7e50"
+                           preview_back="#000000"
                            scene_strip="#4e983e"
                            transition_strip="#a25f6f"
                            window_sliders="#a0a0a0">
@@ -434,13 +438,12 @@
     </sequence_editor>
     <text_editor>
       <ThemeTextEditor cursor="#ff0000"
+                       syntax_special="#5f5f00"
                        line_numbers_background="#818181"
-                       scroll_bar="#8f8f8f"
                        selected_text="#c67777"
                        syntax_builtin="#800050"
                        syntax_comment="#006432"
                        syntax_numbers="#0000c8"
-                       syntax_special="#5f5f00"
                        syntax_string="#640000">
         <space>
           <ThemeSpaceGeneric header="#b4b4b4"
@@ -687,6 +690,18 @@
                              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>
diff --git a/release/scripts/presets/interface_theme/elsyiun.xml b/release/scripts/presets/interface_theme/elsyiun.xml
index cce51d6..9e4c17a 100644
--- a/release/scripts/presets/interface_theme/elsyiun.xml
+++ b/release/scripts/presets/interface_theme/elsyiun.xml
@@ -1,7 +1,7 @@
 <bpy>
   <Theme>
     <view_3d>
-      <ThemeView3D object_active="#ff7c00"
+      <ThemeView3D object_active="#ffc280"
                    editmesh_active="#ffffff80"
                    act_spline="#db2512"
                    handle_align="#803060"
@@ -11,6 +11,7 @@
                    bone_pose="#50c8ff"
                    bone_solid="#c8c8c8"
                    bundle_solid="#c8c8c8"
+                   camera="#000000"
                    camera_path="#000000"
                    frame_current="#60c040"
                    edge_crease="#cc0099"
@@ -19,11 +20,12 @@
                    edge_select="#cb7027"
                    edge_sharp="#00ffff"
                    edge_facesel="#4b4b4b"
+                   empty="#000000"
                    face="#00000036"
                    extra_face_angle="#000080"
                    extra_face_area="#002000"
                    face_dot="#be6925"
-                   facedot_size="2"
+                   facedot_size="3"
                    normal="#22dddd"
                    face_select="#a47c5b73"
                    handle_free="#000000"
@@ -37,16 +39,16 @@
                    nurb_sel_vline="#f090a0"
                    object_grouped="#083008"
                    object_grouped_active="#55bb55"
-                   object_selected="#ffffff"
+                   object_selected="#ff8500"
                    outline_width="1"
                    panel="#a5a5a57f"
                    speaker="#000000"
                    transform="#ffffff"
                    handle_vect="#409030"
                    handle_sel_vect="#40c030"
-                   vertex="#93b2c2"
+                   vertex="#657780"
                    vertex_normal="#2361dd"
-                   vertex_select="#be6925"
+                   vertex_select="#ff7c00"
                    vertex_size="3"
                    wire="#000000">
         <space>
@@ -404,6 +406,7 @@
     </properties>
     <sequence_editor>
       <ThemeSequenceEditor audio_strip="#2e8f8f"
+                           movieclip_strip="#20208f"
                            frame_current="#60c040"
                            draw_action="#50c8ff"
                            effect_strip="#a9547c"
@@ -413,6 +416,7 @@
                            meta_strip="#6d9183"
                            movie_strip="#516987"
                            plugin_strip="#7e7e50"
+                           preview_back="#000000"
                            scene_strip="#4e983e"
                            transition_strip="#a25f6f"
                            window_sliders="#a0a0a0">
@@ -434,13 +438,12 @@
     </sequence_editor>
     <text_editor>
       <ThemeTextEditor cursor="#8b8bff"
+                       syntax_special="#c080d0"
                        line_numbers_background="#2e2e2e"
-                       scroll_bar="#8f8f8f"
                        selected_text="#4e4e8f"
                        syntax_builtin="#808bed"
                        syntax_comment="#cd8b00"
                        syntax_numbers="#f0ad6d"
-                       syntax_special="#c080d0"
                        syntax_string="#ffcd8b">
         <space>
           <ThemeSpaceGeneric header="#3b3b3b"
@@ -687,6 +690,18 @@
                              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>
diff --git a/release/scripts/presets/interface_theme/hexagon.xml b/release/scripts/presets/interface_theme/hexagon.xml
index 07c0565..4f6dbb3 100644
--- a/release/scripts/presets/interface_theme/hexagon.xml
+++ b/release/scripts/presets/interface_theme/hexagon.xml
@@ -11,6 +11,7 @@
                    bone_pose="#50c8ff"
                    bone_solid="#c8c8c8"
                    bundle_solid="#c8c8c8"
+                   camera="#000000"
                    camera_path="#000000"
                    frame_current="#60c040"
                    edge_crease="#cc0099"
@@ -19,6 +20,7 @@
                    edge_select="#1151ce"
                    edge_sharp="#ff2020"
                    edge_facesel="#4b4b4b"
+                   empty="#000000"
                    face="#affff418"
                    extra_face_angle="#00008a"
                    extra_face_area="#002000"
@@ -404,6 +406,7 @@
     </properties>
     <sequence_editor>
       <ThemeSequenceEditor audio_strip="#2e8f8f"
+                           movieclip_strip="#20208f"
                            frame_current="#60c040"
                            draw_action="#50c8ff"
                            effect_strip="#a9547c"
@@ -413,6 +416,7 @@
                            meta_strip="#6d9183"
                            movie_strip="#516987"
                            plugin_strip="#7e7e50"
+                           preview_back="#000000"
                            scene_strip="#4e983e"
                            transition_strip="#a25f6f"
                            window_sliders="#a0a0a0">
@@ -434,13 +438,12 @@
     </sequence_editor>
     <text_editor>
       <ThemeTextEditor cursor="#ff0000"
+                       syntax_special="#5f5f00"
                        line_numbers_background="#5a5e6a"
-                       scroll_bar="#8f8f8f"
                        selected_text="#c67777"
                        syntax_builtin="#800050"
                        syntax_comment="#006432"
                        syntax_numbers="#0000c8"
-                       syntax_special="#5f5f00"
                        syntax_string="#640000">
         <space>
           <ThemeSpaceGeneric header="#5c606c"
@@ -687,6 +690,18 @@
                              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>
diff --git a/release/scripts/presets/interface_theme/ubuntu_ambiance.xml b/release/scripts/presets/interface_theme/ubuntu_ambiance.xml
index 40e311c..3897c41 100644
--- a/release/scripts/presets/interface_theme/ubuntu_ambiance.xml
+++ b/release/scripts/presets/interface_theme/ubuntu_ambiance.xml
@@ -11,6 +11,7 @@
                    bone_pose="#50c8ff"
                    bone_solid="#c8c8c8"
                    bundle_solid="#c8c8c8"
+                   camera="#000000"
                    camera_path="#000000"
                    frame_current="#60c040"
                    edge_crease="#ce33b8"
@@ -19,6 +20,7 @@
                    edge_select="#f68d46"
                    edge_sharp="#ff4c00"
                    edge_facesel="#4b4b4b"
+                   empty="#000000"
                    face="#75757512"
                    extra_face_angle="#002000"
                    extra_face_area="#0059ee"
@@ -404,6 +406,7 @@
     </properties>
     <sequence_editor>
       <ThemeSequenceEditor audio_strip="#2e8f8f"
+                           movieclip_strip="#20208f"
                            frame_current="#c06e11"
                            draw_action="#50c8ff"
                            effect_strip="#a9547c"
@@ -413,6 +416,7 @@
                            meta_strip="#6d9183"
                            movie_strip="#516987"
                            plugin_strip="#7e7e50"
+                           preview_back="#000000"
                            scene_strip="#4e983e"
                            transition_strip="#a25f6f"
                            window_sliders="#a0a0a0">
@@ -434,13 +438,12 @@
     </sequence_editor>
     <text_editor>
       <ThemeTextEditor cursor="#df5106"
+                       syntax_special="#8c8c28"
                        line_numbers_background="#3c3b37"
-                       scroll_bar="#696965"
                        selected_text="#ffffff"
                        syntax_builtin="#df3ac2"
                        syntax_comment="#249d60"
                        syntax_numbers="#3c68ff"
-                       syntax_special="#8c8c28"
                        syntax_string="#aa2694">
         <space>
           <ThemeSpaceGeneric header="#464541"
@@ -687,6 +690,18 @@
                              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="#ffffff">
+          </ThemeWidgetColors>
+        </wcol_tooltip>
       </ThemeUserInterface>
     </user_interface>
     <user_preferences>
diff --git a/release/scripts/presets/keyconfig/maya.py b/release/scripts/presets/keyconfig/maya.py
index 5e1e5d0..fe011a5 100644
--- a/release/scripts/presets/keyconfig/maya.py
+++ b/release/scripts/presets/keyconfig/maya.py
@@ -134,25 +134,45 @@ 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.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.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.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.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.properties.center = 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.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.properties.enumerate = 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.properties.extend = True
 kmi.properties.center = True
+kmi.properties.object = False
 kmi.properties.enumerate = True
-kmi.properties.extend = True
 kmi = km.keymap_items.new('view3d.select_border', 'EVT_TWEAK_S', 'ANY')
 kmi.properties.extend = False
 kmi = km.keymap_items.new('view3d.select_lasso', 'EVT_TWEAK_A', 'ANY', ctrl=True)
@@ -164,7 +184,7 @@ kmi = km.keymap_items.new('view3d.zoom_border', 'B', 'PRESS', shift=True)
 kmi = km.keymap_items.new('view3d.render_border', 'B', 'PRESS', shift=True)
 kmi = km.keymap_items.new('view3d.camera_to_view', 'NUMPAD_0', 'PRESS', ctrl=True, alt=True)
 kmi = km.keymap_items.new('view3d.object_as_camera', 'NUMPAD_0', 'PRESS', ctrl=True)
-kmi = km.keymap_items.new('wm.call_menu', 'S', 'PRESS', shift=True)
+kmi = km.keymap_items.new('wm.call_menu', 'S', 'PRESS', shift=True, ctrl=True)
 kmi.properties.name = 'VIEW3D_MT_snap'
 kmi = km.keymap_items.new('wm.context_set_enum', 'COMMA', 'PRESS')
 kmi.properties.data_path = 'space_data.pivot_point'
@@ -333,7 +353,7 @@ kmi = km.keymap_items.new('mesh.fill', 'F', 'PRESS', alt=True)
 kmi = km.keymap_items.new('mesh.beautify_fill', 'F', 'PRESS', shift=True, alt=True)
 kmi = km.keymap_items.new('mesh.quads_convert_to_tris', 'T', 'PRESS', ctrl=True)
 kmi = km.keymap_items.new('mesh.tris_convert_to_quads', 'J', 'PRESS', alt=True)
-kmi = km.keymap_items.new('mesh.edge_flip', 'F', 'PRESS', shift=True, ctrl=True)
+# kmi = km.keymap_items.new('mesh.edge_flip', 'F', 'PRESS', shift=True, ctrl=True) # removed since bmesh, can be made into something else?
 kmi = km.keymap_items.new('mesh.rip_move', 'V', 'PRESS')
 kmi = km.keymap_items.new('mesh.merge', 'M', 'PRESS', alt=True)
 kmi = km.keymap_items.new('transform.shrink_fatten', 'S', 'PRESS', ctrl=True, alt=True)
@@ -346,9 +366,10 @@ 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.knife_cut', 'LEFTMOUSE', 'PRESS', key_modifier='K')
-kmi = km.keymap_items.new('mesh.knife_cut', 'LEFTMOUSE', 'PRESS', shift=True, key_modifier='K')
-kmi.properties.type = 'MIDPOINTS'
+kmi = km.keymap_items.new('mesh.knifetool', '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'
 kmi = km.keymap_items.new('object.vertex_parent_set', 'P', 'PRESS', ctrl=True)
 kmi = km.keymap_items.new('wm.call_menu', 'W', 'PRESS', ctrl=True)
 kmi.properties.name = 'VIEW3D_MT_edit_mesh_specials'
@@ -376,5 +397,17 @@ kmi.properties.value_1 = 'DISABLED'
 kmi.properties.value_2 = 'CONNECTED'
 kmi = km.keymap_items.new('mesh.select_all', 'SELECTMOUSE', 'CLICK')
 kmi.properties.action = 'DESELECT'
+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
 
 wm.keyconfigs.active = kc
diff --git a/release/scripts/startup/bl_operators/add_mesh_torus.py b/release/scripts/startup/bl_operators/add_mesh_torus.py
index 5b28cdf..75a6cd7 100644
--- a/release/scripts/startup/bl_operators/add_mesh_torus.py
+++ b/release/scripts/startup/bl_operators/add_mesh_torus.py
@@ -21,6 +21,13 @@ import bpy
 from bpy.types import Operator
 import mathutils
 
+from bpy.props import (FloatProperty,
+                       IntProperty,
+                       BoolProperty,
+                       )
+
+from bpy_extras import object_utils
+
 
 def add_torus(major_rad, minor_rad, major_seg, minor_seg):
     from math import cos, sin, pi
@@ -75,14 +82,8 @@ def add_torus(major_rad, minor_rad, major_seg, minor_seg):
 
     return verts, faces
 
-from bpy.props import (FloatProperty,
-                       IntProperty,
-                       BoolProperty,
-                       FloatVectorProperty,
-                       )
-
 
-class AddTorus(Operator):
+class AddTorus(Operator, object_utils.AddObjectHelper):
     '''Add a torus mesh'''
     bl_idname = "mesh.primitive_torus_add"
     bl_label = "Add Torus"
@@ -131,42 +132,32 @@ class AddTorus(Operator):
             default=0.5,
             )
 
-    # 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):
-
         if self.use_abso == 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,
-                                    self.major_segments,
-                                    self.minor_segments)
+                                     self.minor_radius,
+                                     self.major_segments,
+                                     self.minor_segments)
 
         mesh = bpy.data.meshes.new("Torus")
 
         mesh.vertices.add(len(verts_loc) // 3)
-        mesh.faces.add(len(faces) // 4)
+
+        nbr_loops = len(faces)
+        nbr_polys = nbr_loops // 4
+        mesh.loops.add(nbr_loops)
+        mesh.polygons.add(nbr_polys)
 
         mesh.vertices.foreach_set("co", verts_loc)
-        mesh.faces.foreach_set("vertices_raw", faces)
+        mesh.polygons.foreach_set("loop_start", range(0, nbr_loops, 4))
+        mesh.polygons.foreach_set("loop_total", (4,) * nbr_polys)
+        mesh.loops.foreach_set("vertex_index", faces)
         mesh.update()
 
-        from bpy_extras import object_utils
         object_utils.object_data_add(context, mesh, operator=self)
 
         return {'FINISHED'}
diff --git a/release/scripts/startup/bl_operators/anim.py b/release/scripts/startup/bl_operators/anim.py
index d26a772..2689cfd 100644
--- a/release/scripts/startup/bl_operators/anim.py
+++ b/release/scripts/startup/bl_operators/anim.py
@@ -67,15 +67,16 @@ class ANIM_OT_keying_set_export(Operator):
         scene = context.scene
         ks = scene.keying_sets.active
 
-        f.write("# Keying Set: %s\n" % ks.name)
+        f.write("# Keying Set: %s\n" % ks.bl_idname)
 
         f.write("import bpy\n\n")
-        # XXX, why not current scene?
-        f.write("scene= bpy.data.scenes[0]\n\n")
+        f.write("scene = bpy.context.scene\n\n")
 
         # Add KeyingSet and set general settings
         f.write("# Keying Set Level declarations\n")
-        f.write("ks= scene.keying_sets.new(name=\"%s\")\n" % ks.name)
+        f.write("ks = scene.keying_sets.new(idname=\"%s\", name=\"%s\")\n"
+                "" % (ks.bl_idname, ks.bl_label))
+        f.write("ks.bl_description = \"%s\"\n" % ks.bl_description)
 
         if not ks.is_path_absolute:
             f.write("ks.is_path_absolute = False\n")
diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py
index 7a80b43..ffa6627 100644
--- a/release/scripts/startup/bl_operators/clip.py
+++ b/release/scripts/startup/bl_operators/clip.py
@@ -99,11 +99,11 @@ def CLIP_default_settings_from_track(clip, track):
     pattern = track.pattern_max - track.pattern_min
     search = track.search_max - track.search_min
 
-    pattern[0] = pattern[0] * clip.size[0]
-    pattern[1] = pattern[1] * clip.size[1]
+    pattern[0] = pattern[0] * width
+    pattern[1] = pattern[1] * height
 
-    search[0] = search[0] * clip.size[0]
-    search[1] = search[1] * clip.size[1]
+    search[0] = search[0] * width
+    search[1] = search[1] * height
 
     settings.default_tracker = track.tracker
     settings.default_pyramid_levels = track.pyramid_levels
@@ -709,17 +709,23 @@ class CLIP_OT_setup_tracking_scene(Operator):
 
     @staticmethod
     def _createMesh(scene, name, vertices, faces):
-        from bpy_extras.io_utils import unpack_list, unpack_face_list
+        from bpy_extras.io_utils import unpack_list
 
         mesh = bpy.data.meshes.new(name=name)
 
         mesh.vertices.add(len(vertices))
         mesh.vertices.foreach_set("co", unpack_list(vertices))
 
-        mesh.faces.add(len(faces))
-        mesh.faces.foreach_set("vertices_raw", unpack_face_list(faces))
+        nbr_loops = len(faces)
+        nbr_polys = nbr_loops // 4
+        mesh.loops.add(nbr_loops)
+        mesh.polygons.add(nbr_polys)
+
+        mesh.polygons.foreach_set("loop_start", range(0, nbr_loops, 4))
+        mesh.polygons.foreach_set("loop_total", (4,) * nbr_polys)
+        mesh.loops.foreach_set("vertex_index", faces)
 
-        mesh.update(calc_edges=True)
+        mesh.update()
 
         ob = bpy.data.objects.new(name=name, object_data=mesh)
 
@@ -737,7 +743,7 @@ class CLIP_OT_setup_tracking_scene(Operator):
 
     def _createGround(self, scene):
         vertices = self._getPlaneVertices(4.0, 0.0)
-        faces = [(0, 1, 2, 3)]
+        faces = [0, 1, 2, 3]
 
         ob = self._createMesh(scene, "Ground", vertices, faces)
         ob["is_ground"] = True
@@ -775,12 +781,12 @@ class CLIP_OT_setup_tracking_scene(Operator):
     def _createSampleObject(self, scene):
         vertices = self._getPlaneVertices(1.0, -1.0) + \
             self._getPlaneVertices(1.0, 1.0)
-        faces = ((0, 1, 2, 3),
-                 (4, 7, 6, 5),
-                 (0, 4, 5, 1),
-                 (1, 5, 6, 2),
-                 (2, 6, 7, 3),
-                 (3, 7, 4, 0))
+        faces = (0, 1, 2, 3,
+                 4, 7, 6, 5,
+                 0, 4, 5, 1,
+                 1, 5, 6, 2,
+                 2, 6, 7, 3,
+                 3, 7, 4, 0)
 
         return self._createMesh(scene, "Cube", vertices, faces)
 
diff --git a/release/scripts/startup/bl_operators/console.py b/release/scripts/startup/bl_operators/console.py
index 8afcdf5..099cb02 100644
--- a/release/scripts/startup/bl_operators/console.py
+++ b/release/scripts/startup/bl_operators/console.py
@@ -23,15 +23,19 @@ from bpy.types import Operator
 from bpy.props import StringProperty
 
 
+def _lang_module_get(sc):
+    return __import__("console_" + sc.language)
+
+
 class ConsoleExec(Operator):
-    '''Execute the current console line as a python expression'''
+    """Execute the current console line as a python expression"""
     bl_idname = "console.execute"
     bl_label = "Console Execute"
 
     def execute(self, context):
         sc = context.space_data
 
-        module = __import__("console_" + sc.language)
+        module = _lang_module_get(sc)
         execute = getattr(module, "execute", None)
 
         if execute:
@@ -50,7 +54,7 @@ class ConsoleAutocomplete(Operator):
 
     def execute(self, context):
         sc = context.space_data
-        module = __import__("console_" + sc.language)
+        module = _lang_module_get(sc)
         autocomplete = getattr(module, "autocomplete", None)
 
         if autocomplete:
@@ -62,7 +66,7 @@ class ConsoleAutocomplete(Operator):
 
 
 class ConsoleBanner(Operator):
-    '''Print a message when the terminal initializes'''
+    """Print a message when the terminal initializes"""
     bl_idname = "console.banner"
     bl_label = "Console Banner"
 
@@ -73,7 +77,7 @@ class ConsoleBanner(Operator):
         if not sc.language:
             sc.language = 'python'
 
-        module = __import__("console_" + sc.language)
+        module = _lang_module_get(sc)
         banner = getattr(module, "banner", None)
 
         if banner:
@@ -85,7 +89,7 @@ class ConsoleBanner(Operator):
 
 
 class ConsoleLanguage(Operator):
-    '''Set the current language for this console'''
+    """Set the current language for this console"""
     bl_idname = "console.language"
     bl_label = "Console Language"
 
diff --git a/release/scripts/startup/bl_operators/image.py b/release/scripts/startup/bl_operators/image.py
index 4c04aa3..1b7d5e3 100644
--- a/release/scripts/startup/bl_operators/image.py
+++ b/release/scripts/startup/bl_operators/image.py
@@ -67,7 +67,7 @@ class EditExternally(Operator):
             self.report({'ERROR'}, "Image path not set")
             return {'CANCELLED'}
 
-        if not os.path.exists(filepath):
+        if not os.path.exists(filepath) or not os.path.isfile(filepath):
             self.report({'ERROR'},
                         "Image path %r not found, image may be packed or "
                         "unsaved" % filepath)
@@ -96,6 +96,10 @@ class EditExternally(Operator):
             self.report({'ERROR'}, "Context incorrect, image not found")
             return {'CANCELLED'}
 
+        if image.packed_file:
+            self.report({'ERROR'}, "Image is packed, unpack before editing")
+            return {'CANCELLED'}
+
         filepath = bpy.path.abspath(image.filepath, library=image.library)
 
         self.filepath = os.path.normpath(filepath)
diff --git a/release/scripts/startup/bl_operators/mesh.py b/release/scripts/startup/bl_operators/mesh.py
index 3e20601..4ed43a6 100644
--- a/release/scripts/startup/bl_operators/mesh.py
+++ b/release/scripts/startup/bl_operators/mesh.py
@@ -24,50 +24,6 @@ from bpy.types import Operator
 from bpy.props import EnumProperty
 
 
-class MeshSelectInteriorFaces(Operator):
-    '''Select faces where all edges have more than 2 face users'''
-
-    bl_idname = "mesh.faces_select_interior"
-    bl_label = "Select Interior Faces"
-    bl_options = {'REGISTER', 'UNDO'}
-
-    @classmethod
-    def poll(cls, context):
-        ob = context.active_object
-        return (ob and ob.type == 'MESH')
-
-    def execute(self, context):
-        from bpy_extras import mesh_utils
-        ob = context.active_object
-        context.tool_settings.mesh_select_mode = False, False, True
-        is_editmode = (ob.mode == 'EDIT')
-        if is_editmode:
-            bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
-
-        mesh = ob.data
-
-        face_list = mesh.faces[:]
-        face_edge_keys = [face.edge_keys for face in face_list]
-
-        edge_face_count = mesh_utils.edge_face_count_dict(mesh)
-
-        def test_interior(index):
-            for key in face_edge_keys[index]:
-                if edge_face_count[key] < 3:
-                    return False
-            return True
-
-        for index, face in enumerate(face_list):
-            if(test_interior(index)):
-                face.select = True
-            else:
-                face.select = False
-
-        if is_editmode:
-            bpy.ops.object.mode_set(mode='EDIT', toggle=False)
-        return {'FINISHED'}
-
-
 class MeshMirrorUV(Operator):
     '''Copy mirror UV coordinates on the X axis based on a mirrored mesh'''
     bl_idname = "mesh.faces_mirror_uv"
@@ -99,7 +55,7 @@ class MeshMirrorUV(Operator):
         mirror_gt = {}
         mirror_lt = {}
 
-        vcos = [v.co.to_tuple(5) for v in mesh.vertices]
+        vcos = (v.co.to_tuple(5) for v in mesh.vertices)
 
         for i, co in enumerate(vcos):
             if co[0] > 0.0:
@@ -120,50 +76,60 @@ class MeshMirrorUV(Operator):
                 if j is not None:
                     vmap[i] = j
 
-        active_uv_layer = mesh.uv_textures.active.data
-        fuvs = [(uv.uv1, uv.uv2, uv.uv3, uv.uv4) for uv in active_uv_layer]
-        fuvs_cpy = [(uv[0].copy(), uv[1].copy(), uv[2].copy(), uv[3].copy())
-                    for uv in fuvs]
-
-        # as a list
-        faces = mesh.faces[:]
-
-        fuvsel = [(False not in uv.select_uv) for uv in active_uv_layer]
-        fcents = [f.center for f in faces]
-
-        # find mirror faces
-        mirror_fm = {}
-        for i, f in enumerate(faces):
-            verts = list(f.vertices)
-            verts.sort()
-            verts = tuple(verts)
-            mirror_fm[verts] = i
-
-        fmap = {}
-        for i, f in enumerate(faces):
-            verts = [vmap.get(j) for j in f.vertices]
-            if None not in verts:
-                verts.sort()
-                j = mirror_fm.get(tuple(verts))
+        polys = mesh.polygons
+        loops = mesh.loops
+        verts = mesh.vertices
+        uv_loops = mesh.uv_layers.active.data
+        nbr_polys = len(polys)
+
+        mirror_pm = {}
+        pmap = {}
+        puvs = [None] * nbr_polys
+        puvs_cpy = [None] * nbr_polys
+        puvsel = [None] * nbr_polys
+        pcents = [None] * nbr_polys
+        vidxs = [None] * nbr_polys
+        for i, p in enumerate(polys):
+            lstart = lend = p.loop_start
+            lend += p.loop_total
+            puvs[i] = tuple(uv.uv for uv in uv_loops[lstart:lend])
+            puvs_cpy[i] = tuple(uv.copy() for uv in puvs[i])
+            puvsel[i] = (False not in
+                               (uv.select for uv in uv_loops[lstart:lend]))
+            # Vert idx of the poly.
+            vidxs[i] = tuple(sorted(l.vertex_index
+                                    for l in loops[lstart:lend]))
+            # As we have no poly.center yet...
+            pcents[i] = tuple(map(lambda x: x / p.loop_total,
+                                  map(sum, zip(*(verts[idx].co
+                                                 for idx in vidxs[i])))))
+            # Preparing next step finding matching polys.
+            mirror_pm[vidxs[i]] = i
+
+        for i in range(nbr_polys):
+            # Find matching mirror poly.
+            tvidxs = [vmap.get(j) for j in vidxs[i]]
+            if None not in tvidxs:
+                tvidxs.sort()
+                j = mirror_pm.get(tuple(tvidxs))
                 if j is not None:
-                    fmap[i] = j
-
-        for i, j in fmap.items():
+                    pmap[i] = j
 
-            if not fuvsel[i] or not fuvsel[j]:
+        for i, j in pmap.items():
+            if not puvsel[i] or not puvsel[j]:
                 continue
-            elif DIR == 0 and fcents[i][0] < 0.0:
+            elif DIR == 0 and pcents[i][0] < 0.0:
                 continue
-            elif DIR == 1 and fcents[i][0] > 0.0:
+            elif DIR == 1 and pcents[i][0] > 0.0:
                 continue
 
             # copy UVs
-            uv1 = fuvs[i]
-            uv2 = fuvs_cpy[j]
+            uv1 = puvs[i]
+            uv2 = puvs_cpy[j]
 
             # get the correct rotation
-            v1 = faces[j].vertices[:]
-            v2 = [vmap[k] for k in faces[i].vertices[:]]
+            v1 = vidxs[j]
+            v2 = tuple(vmap[k] for k in vidxs[i])
 
             if len(v1) == len(v2):
                 for k in range(len(v1)):
diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py
index 019cd37..8268d7a 100644
--- a/release/scripts/startup/bl_operators/object.py
+++ b/release/scripts/startup/bl_operators/object.py
@@ -27,7 +27,7 @@ from bpy.props import (StringProperty,
 
 
 class SelectPattern(Operator):
-    '''Select object matching a naming pattern'''
+    '''Select objects matching a naming pattern'''
     bl_idname = "object.select_pattern"
     bl_label = "Select Pattern"
     bl_options = {'REGISTER', 'UNDO'}
@@ -125,7 +125,7 @@ class SelectCamera(Operator):
 
 
 class SelectHierarchy(Operator):
-    '''Select object relative to the active object's position''' \
+    '''Select object relative to the active object's position ''' \
     '''in the hierarchy'''
     bl_idname = "object.select_hierarchy"
     bl_label = "Select Hierarchy"
@@ -367,79 +367,25 @@ class ShapeTransfer(Operator):
                                     (orig_shape_coords[i] - orig_coords[i]))
 
             elif mode == 'RELATIVE_FACE':
-                for face in me.faces:
-                    i1, i2, i3, i4 = face.vertices_raw
-                    if i4 != 0:
-                        pt = barycentric_transform(orig_shape_coords[i1],
-                                                   orig_coords[i4],
-                                                   orig_coords[i1],
-                                                   orig_coords[i2],
-                                                   target_coords[i4],
-                                                   target_coords[i1],
-                                                   target_coords[i2],
-                                                   )
-                        median_coords[i1].append(pt)
-
-                        pt = barycentric_transform(orig_shape_coords[i2],
-                                                   orig_coords[i1],
-                                                   orig_coords[i2],
-                                                   orig_coords[i3],
-                                                   target_coords[i1],
-                                                   target_coords[i2],
-                                                   target_coords[i3],
-                                                   )
-                        median_coords[i2].append(pt)
-
-                        pt = barycentric_transform(orig_shape_coords[i3],
-                                                   orig_coords[i2],
-                                                   orig_coords[i3],
-                                                   orig_coords[i4],
-                                                   target_coords[i2],
-                                                   target_coords[i3],
-                                                   target_coords[i4],
-                                                   )
-                        median_coords[i3].append(pt)
-
-                        pt = barycentric_transform(orig_shape_coords[i4],
-                                                   orig_coords[i3],
-                                                   orig_coords[i4],
-                                                   orig_coords[i1],
-                                                   target_coords[i3],
-                                                   target_coords[i4],
-                                                   target_coords[i1],
-                                                   )
-                        median_coords[i4].append(pt)
-
-                    else:
-                        pt = barycentric_transform(orig_shape_coords[i1],
-                                                   orig_coords[i3],
-                                                   orig_coords[i1],
-                                                   orig_coords[i2],
-                                                   target_coords[i3],
-                                                   target_coords[i1],
-                                                   target_coords[i2],
-                                                   )
-                        median_coords[i1].append(pt)
-
-                        pt = barycentric_transform(orig_shape_coords[i2],
-                                                   orig_coords[i1],
-                                                   orig_coords[i2],
-                                                   orig_coords[i3],
-                                                   target_coords[i1],
-                                                   target_coords[i2],
-                                                   target_coords[i3],
-                                                   )
-                        median_coords[i2].append(pt)
-
-                        pt = barycentric_transform(orig_shape_coords[i3],
-                                                   orig_coords[i2],
-                                                   orig_coords[i3],
-                                                   orig_coords[i1],
-                                                   target_coords[i2],
-                                                   target_coords[i3],
-                                                   target_coords[i1],
+                loops_vidxs = me.loops.foreach_get("vert_index")
+                for poly in me.polygons:
+                    l_start = l_stop = poly.loop_start
+                    l_stop += poly.loop_total
+                    idxs = loops_vidxs[l_start:l_stop]
+                    v_before = idxs[-2]
+                    v = idxs[-1]
+                    for v_after in idxs:
+                        pt = barycentric_transform(orig_shape_coords[v],
+                                                   orig_coords[v_before],
+                                                   orig_coords[v],
+                                                   orig_coords[v_after],
+                                                   target_coords[v_before],
+                                                   target_coords[v],
+                                                   target_coords[v_after],
                                                    )
-                        median_coords[i3].append(pt)
+                        median_coords[v].append(pt)
+                        v_before = v
+                        v = v_after
 
             elif mode == 'RELATIVE_EDGE':
                 for ed in me.edges:
@@ -539,11 +485,11 @@ class JoinUVs(Operator):
                         "Object: %s, Mesh: '%s' has no UVs"
                         % (obj.name, mesh.name))
         else:
-            len_faces = len(mesh.faces)
+            nbr_loops = len(mesh.loops)
 
             # seems to be the fastest way to create an array
-            uv_array = array.array('f', [0.0] * 8) * len_faces
-            mesh.uv_textures.active.data.foreach_get("uv_raw", uv_array)
+            uv_array = array.array('f', [0.0] * 2) * nbr_loops
+            mesh.uv_layers.active.data.foreach_get("uv", uv_array)
 
             objects = context.selected_editable_objects[:]
 
@@ -558,22 +504,33 @@ class JoinUVs(Operator):
                         if mesh_other.tag == False:
                             mesh_other.tag = True
 
-                            if len(mesh_other.faces) != len_faces:
+                            if len(mesh_other.loops) != nbr_loops:
                                 self.report({'WARNING'}, "Object: %s, Mesh: "
-                                            "'%s' has %d faces, expected %d\n"
+                                            "'%s' has %d loops (for %d faces),"
+                                            " expected %d\n"
                                             % (obj_other.name,
                                                mesh_other.name,
-                                               len(mesh_other.faces),
-                                               len_faces),
-                                               )
+                                               len(mesh_other.loops),
+                                               len(mesh_other.polygons),
+                                               nbr_loops,
+                                               ),
+                                           )
                             else:
-                                uv_other = mesh_other.uv_textures.active
+                                uv_other = mesh_other.uv_layers.active
                                 if not uv_other:
-                                    # should return the texture it adds
-                                    uv_other = mesh_other.uv_textures.new()
+                                    mesh_other.uv_textures.new()
+                                    uv_other = mesh_other.uv_layers.active
+                                    if not uv_other:
+                                        self.report({'ERROR'}, "Could not add "
+                                                    "a new UV map tp object "
+                                                    "'%s' (Mesh '%s')\n"
+                                                    % (obj_other.name,
+                                                       mesh_other.name,
+                                                       ),
+                                                    )
 
                                 # finally do the copy
-                                uv_other.data.foreach_set("uv_raw", uv_array)
+                                uv_other.data.foreach_set("uv", uv_array)
 
         if is_editmode:
             bpy.ops.object.mode_set(mode='EDIT', toggle=False)
@@ -616,16 +573,21 @@ class MakeDupliFace(Operator):
             face_verts = [axis for obj in objects
                           for v in matrix_to_quad(obj.matrix_world)
                           for axis in v]
+            nbr_verts = len(face_verts) // 3
+            nbr_faces = nbr_verts // 4
 
-            faces = list(range(len(face_verts) // 3))
+            faces = list(range(nbr_verts))
 
             mesh = bpy.data.meshes.new(data.name + "_dupli")
 
-            mesh.vertices.add(len(face_verts) // 3)
-            mesh.faces.add(len(face_verts) // 12)
+            mesh.vertices.add(nbr_verts)
+            mesh.loops.add(nbr_faces * 4)  # Safer than nbr_verts.
+            mesh.polygons.add(nbr_faces)
 
             mesh.vertices.foreach_set("co", face_verts)
-            mesh.faces.foreach_set("vertices_raw", faces)
+            mesh.loops.foreach_set("vertex_index", faces)
+            mesh.polygons.foreach_set("loop_start", range(0, nbr_faces * 4, 4))
+            mesh.polygons.foreach_set("loop_total", (4,) * nbr_faces)
             mesh.update()  # generates edge data
 
             # pick an object to use
@@ -729,3 +691,29 @@ class TransformsToDeltasAnim(Operator):
         context.scene.frame_set(context.scene.frame_current)
 
         return {'FINISHED'}
+
+
+class DupliOffsetFromCursor(Operator):
+    '''Set offset used for DupliGroup based on cursor position'''
+    bl_idname = "object.dupli_offset_from_cursor"
+    bl_label = "Set Offset From Cursor"
+    bl_options = {'REGISTER', 'UNDO'}
+
+    group = IntProperty(
+            name="Group",
+            description="Group index to set offset for",
+            default=0,
+            )
+
+    @classmethod
+    def poll(cls, context):
+        return  context.active_object is not None
+
+    def execute(self, context):
+        scene = context.scene
+        ob = context.active_object
+        group = self.group
+
+        ob.users_group[group].dupli_offset = scene.cursor_location
+
+        return {'FINISHED'}
diff --git a/release/scripts/startup/bl_operators/object_randomize_transform.py b/release/scripts/startup/bl_operators/object_randomize_transform.py
index d3d70f8..834df04 100644
--- a/release/scripts/startup/bl_operators/object_randomize_transform.py
+++ b/release/scripts/startup/bl_operators/object_randomize_transform.py
@@ -92,7 +92,6 @@ def randomize_selected(seed, delta, loc, rot, scale, scale_even, scale_min):
 from bpy.props import (IntProperty,
                        BoolProperty,
                        FloatVectorProperty)
-from math import pi
 
 
 class RandomizeLocRotSize(Operator):
@@ -136,8 +135,8 @@ class RandomizeLocRotSize(Operator):
     rot = FloatVectorProperty(
             name="Rotation",
             description="Maximun rotation over each axis",
-            min=-pi,
-            max=pi,
+            min=-3.141592,  # math.pi
+            max=+3.141592,
             default=(0.0, 0.0, 0.0),
             subtype='EULER',
             )
diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py
index 1a17cd9..6297945 100644
--- a/release/scripts/startup/bl_operators/presets.py
+++ b/release/scripts/startup/bl_operators/presets.py
@@ -20,6 +20,7 @@
 
 import bpy
 from bpy.types import Menu, Operator
+from bpy.props import StringProperty, BoolProperty
 
 
 class AddPresetBase():
@@ -31,13 +32,13 @@ class AddPresetBase():
     # bl_label = "Add a Python Preset"
     bl_options = {'REGISTER'}  # only because invoke_props_popup requires.
 
-    name = bpy.props.StringProperty(
+    name = StringProperty(
             name="Name",
             description="Name of the preset, used to make the path name",
             maxlen=64,
             options={'SKIP_SAVE'},
             )
-    remove_active = bpy.props.BoolProperty(
+    remove_active = BoolProperty(
             default=False,
             options={'HIDDEN', 'SKIP_SAVE'},
             )
@@ -166,12 +167,10 @@ class ExecutePreset(Operator):
     bl_idname = "script.execute_preset"
     bl_label = "Execute a Python Preset"
 
-    filepath = bpy.props.StringProperty(
-            name="Path",
-            description="Path of the Python file to execute",
-            maxlen=512,
+    filepath = StringProperty(
+            subtype='FILE_PATH',
             )
-    menu_idname = bpy.props.StringProperty(
+    menu_idname = StringProperty(
             name="Menu ID Name",
             description="ID name of the menu this was called from",
             )
@@ -296,6 +295,24 @@ class AddPresetCloth(AddPresetBase, Operator):
     preset_subdir = "cloth"
 
 
+class AddPresetFluid(AddPresetBase, Operator):
+    '''Add a Fluid Preset'''
+    bl_idname = "fluid.preset_add"
+    bl_label = "Add Fluid Preset"
+    preset_menu = "FLUID_MT_presets"
+
+    preset_defines = [
+    "fluid = bpy.context.fluid"
+    ]
+
+    preset_values = [
+    "fluid.settings.viscosity_base",
+    "fluid.settings.viscosity_exponent",
+    ]
+
+    preset_subdir = "fluid"
+
+
 class AddPresetSunSky(AddPresetBase, Operator):
     '''Add a Sky & Atmosphere Preset'''
     bl_idname = "lamp.sunsky_preset_add"
@@ -456,7 +473,7 @@ class AddPresetOperator(AddPresetBase, Operator):
     bl_label = "Operator Preset"
     preset_menu = "WM_MT_operator_presets"
 
-    operator = bpy.props.StringProperty(
+    operator = StringProperty(
             name="Operator",
             maxlen=64,
             options={'HIDDEN'},
diff --git a/release/scripts/startup/bl_operators/uvcalc_follow_active.py b/release/scripts/startup/bl_operators/uvcalc_follow_active.py
index 7482556..d6f6576 100644
--- a/release/scripts/startup/bl_operators/uvcalc_follow_active.py
+++ b/release/scripts/startup/bl_operators/uvcalc_follow_active.py
@@ -30,6 +30,7 @@ def extend(obj, operator, EXTEND_MODE):
 
     me = obj.data
     me_verts = me.vertices
+
     # script will fail without UVs
     if not me.uv_textures:
         me.uv_textures.new()
@@ -52,17 +53,15 @@ def extend(obj, operator, EXTEND_MODE):
         '''
 
         def face_edge_vs(vi):
-            # assume a quad
-            return [(vi[0], vi[1]), (vi[1], vi[2]), (vi[2], vi[3]), (vi[3], vi[0])]
+            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
 
-        faceUVsource = me.uv_textures.active.data[face_source.index]
-        uvs_source = [faceUVsource.uv1, faceUVsource.uv2, faceUVsource.uv3, faceUVsource.uv4]
-
-        faceUVtarget = me.uv_textures.active.data[face_target.index]
-        uvs_target = [faceUVtarget.uv1, faceUVtarget.uv2, faceUVtarget.uv3, faceUVtarget.uv4]
+        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
 
@@ -135,15 +134,12 @@ def extend(obj, operator, EXTEND_MODE):
             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]])
 
-    if not me.uv_textures:
-        me.uv_textures.new()
-
-    face_act = me.faces.active
+    face_act = me.polygons.active
     if face_act == -1:
         operator.report({'ERROR'}, "No active face")
         return
 
-    face_sel = [f for f in me.faces if len(f.vertices) == 4 and f.select]
+    face_sel = [f for f in me.polygons if len(f.vertices) == 4 and f.select]
 
     face_act_local_index = -1
     for i, f in enumerate(face_sel):
@@ -172,7 +168,7 @@ def extend(obj, operator, EXTEND_MODE):
                 edge_faces[edkey] = [i]
 
     if EXTEND_MODE == 'LENGTH':
-        edge_loops = mesh_utils.edge_loops_from_faces(me, face_sel, [ed.key for ed in me.edges if ed.use_seam])
+        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]
diff --git a/release/scripts/startup/bl_operators/uvcalc_lightmap.py b/release/scripts/startup/bl_operators/uvcalc_lightmap.py
index 3159466..3bd0d6f 100644
--- a/release/scripts/startup/bl_operators/uvcalc_lightmap.py
+++ b/release/scripts/startup/bl_operators/uvcalc_lightmap.py
@@ -88,8 +88,8 @@ class prettyface(object):
             self.children = []
 
         else:  # blender face
-            # self.uv = data.uv
-            self.uv = data.id_data.uv_textures.active.data[data.index].uv  # XXX25
+            uv_layer = data.id_data.uv_layers.active.data
+            self.uv = [uv_layer[i].uv for i in data.loop_indices]
 
             # cos = [v.co for v in data]
             cos = [data.id_data.vertices[v].co for v in data.vertices]  # XXX25
@@ -158,7 +158,8 @@ class prettyface(object):
                 I = [i for a, i in angles_co]
 
                 #~ fuv = f.uv
-                fuv = f.id_data.uv_textures.active.data[f.index].uv  # XXX25
+                uv_layer = f.id_data.uv_layers.active.data
+                fuv = [uv_layer[i].uv for i in f.loops]  # XXX25
 
                 if self.rot:
                     fuv[I[2]] = p1
@@ -219,15 +220,10 @@ def lightmap_uvpack(meshes,
         face_groups = []
 
     for me in meshes:
-        # Add face UV if it does not exist.
-        # All new faces are selected.
-        if not me.uv_textures:
-            me.uv_textures.new()
-
         if PREF_SEL_ONLY:
-            faces = [f for f in me.faces if f.select]
+            faces = [f for f in me.polygons if f.select]
         else:
-            faces = me.faces[:]
+            faces = me.polygons[:]
 
         if PREF_PACK_IN_ONE:
             face_groups[0].extend(faces)
@@ -237,6 +233,11 @@ def lightmap_uvpack(meshes,
         if PREF_NEW_UVLAYER:
             me.uv_textures.new()
 
+        # Add face UV if it does not exist.
+        # All new faces are selected.
+        if not me.uv_textures:
+            me.uv_textures.new()
+
     for face_sel in face_groups:
         print("\nStarting unwrap")
 
@@ -244,7 +245,7 @@ def lightmap_uvpack(meshes,
             print("\tWarning, less then 4 faces, skipping")
             continue
 
-        pretty_faces = [prettyface(f) for f in face_sel if len(f.vertices) == 4]
+        pretty_faces = [prettyface(f) for f in face_sel if f.loop_total == 4]
 
         # Do we have any triangles?
         if len(pretty_faces) != len(face_sel):
@@ -268,7 +269,7 @@ def lightmap_uvpack(meshes,
 
                 return f, lens, lens_order
 
-            tri_lengths = [trylens(f) for f in face_sel if len(f.vertices) == 3]
+            tri_lengths = [trylens(f) for f in face_sel if f.loop_total == 3]
             del trylens
 
             def trilensdiff(t1, t2):
@@ -528,7 +529,7 @@ def unwrap(operator, context, **kwargs):
         if obj and obj.type == 'MESH':
             meshes = [obj.data]
     else:
-        meshes = list({me for obj in context.selected_objects if obj.type == 'MESH' for me in (obj.data,) if me.faces and me.library is None})
+        meshes = list({me for obj in context.selected_objects if obj.type == 'MESH' for me in (obj.data,) if me.polygons and me.library is None})
 
     if not meshes:
         operator.report({'ERROR'}, "No mesh object")
@@ -548,7 +549,16 @@ class LightMapPack(Operator):
     '''Follow UVs from active quads along continuous face loops'''
     bl_idname = "uv.lightmap_pack"
     bl_label = "Lightmap Pack"
-    bl_options = {'REGISTER', 'UNDO'}
+
+    # 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.
+    # 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.
+    # This fixes infinite image creation reported there [#30968] (sergey)
+    bl_options = {'UNDO'}
 
     PREF_CONTEXT = bpy.props.EnumProperty(
             name="Selection",
diff --git a/release/scripts/startup/bl_operators/uvcalc_smart_project.py b/release/scripts/startup/bl_operators/uvcalc_smart_project.py
index 622d19a..1e18825 100644
--- a/release/scripts/startup/bl_operators/uvcalc_smart_project.py
+++ b/release/scripts/startup/bl_operators/uvcalc_smart_project.py
@@ -757,12 +757,9 @@ def VectoQuat(vec):
 
 class thickface(object):
     __slost__= "v", "uv", "no", "area", "edge_keys"
-    def __init__(self, face, uvface, mesh_verts):
+    def __init__(self, face, uv_layer, mesh_verts):
         self.v = [mesh_verts[i] for i in face.vertices]
-        if len(self.v)==4:
-            self.uv = uvface.uv1, uvface.uv2, uvface.uv3, uvface.uv4
-        else:
-            self.uv = uvface.uv1, uvface.uv2, uvface.uv3
+        self.uv = [uv_layer[i].uv for i in face.loop_indices]
 
         self.no = face.normal
         self.area = face.area
@@ -892,13 +889,13 @@ def main(context,
         if not me.uv_textures: # Mesh has no UV Coords, don't bother.
             me.uv_textures.new()
 
-        uv_layer = me.uv_textures.active.data
+        uv_layer = me.uv_layers.active.data
         me_verts = list(me.vertices)
 
         if USER_ONLY_SELECTED_FACES:
-            meshFaces = [thickface(f, uv_layer[i], me_verts) for i, f in enumerate(me.faces) if f.select]
+            meshFaces = [thickface(f, uv_layer, me_verts) for i, f in enumerate(me.polygons) if f.select]
         else:
-        	meshFaces = [thickface(f, uv_layer[i], me_verts) for i, f in enumerate(me.faces)]
+            meshFaces = [thickface(f, uv_layer, me_verts) for i, f in enumerate(me.polygons)]
 
         if not meshFaces:
             continue
@@ -1117,7 +1114,7 @@ class SmartProject(Operator):
 
     angle_limit = FloatProperty(
             name="Angle Limit",
-            description="lower for more projection groups, higher for less distortion",
+            description="Lower for more projection groups, higher for less distortion",
             min=1.0, max=89.0,
             default=66.0,
             )
diff --git a/release/scripts/startup/bl_operators/vertexpaint_dirt.py b/release/scripts/startup/bl_operators/vertexpaint_dirt.py
index 85be72b..bfbde2f 100644
--- a/release/scripts/startup/bl_operators/vertexpaint_dirt.py
+++ b/release/scripts/startup/bl_operators/vertexpaint_dirt.py
@@ -26,8 +26,6 @@ def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean,
     from mathutils import Vector
     from math import acos
 
-    #BPyMesh.meshCalcNormals(me)
-
     vert_tone = [0.0] * len(me.vertices)
 
     min_tone = 180.0
@@ -95,7 +93,7 @@ def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean,
     tone_range = max_tone - min_tone
 
     if not tone_range:
-        return
+        return {'CANCELLED'}
 
     active_col_layer = None
 
@@ -109,18 +107,17 @@ def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean,
         active_col_layer = me.vertex_colors[0].data
 
     if not active_col_layer:
-        return('CANCELLED', )
-
-    for i, f in enumerate(me.faces):
-        if not me.use_paint_mask or f.select:
-
-            f_col = active_col_layer[i]
+        return
 
-            f_col = [f_col.color1, f_col.color2, f_col.color3, f_col.color4]
+    use_paint_mask = me.use_paint_mask
 
-            for j, v in enumerate(f.vertices):
-                col = f_col[j]
-                tone = vert_tone[me.vertices[v].index]
+    for i, p in enumerate(me.polygons):
+        if not use_paint_mask or p.select:
+            for loop_index in p.loop_indices:
+                loop = me.loops[loop_index]
+                v = loop.vertex_index
+                col = active_col_layer[loop_index].color
+                tone = vert_tone[v]
                 tone = (tone - min_tone) / tone_range
 
                 if dirt_only:
@@ -131,6 +128,8 @@ def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean,
                 col[1] = tone * col[1]
                 col[2] = tone * col[2]
 
+    return {'FINISHED'}
+
 
 import bpy
 from bpy.types import Operator
@@ -156,19 +155,19 @@ class VertexPaintDirt(Operator):
             )
     clean_angle = FloatProperty(
             name="Highlight Angle",
-            description="Less then 90 limits the angle used in the tonal range",
+            description="Less than 90 limits the angle used in the tonal range",
             min=0.0, max=180.0,
             default=180.0,
             )
     dirt_angle = FloatProperty(
             name="Dirt Angle",
-            description="Less then 90 limits the angle used in the tonal range",
+            description="Less than 90 limits the angle used in the tonal range",
             min=0.0, max=180.0,
             default=0.0,
             )
     dirt_only = BoolProperty(
             name="Dirt Only",
-            description="Dont calculate cleans for convex areas",
+            description="Don't calculate cleans for convex areas",
             default=False,
             )
 
@@ -185,8 +184,8 @@ class VertexPaintDirt(Operator):
 
         t = time.time()
 
-        applyVertexDirt(mesh, self.blur_iterations, self.blur_strength, radians(self.dirt_angle), radians(self.clean_angle), self.dirt_only)
+        ret = applyVertexDirt(mesh, self.blur_iterations, self.blur_strength, radians(self.dirt_angle), radians(self.clean_angle), self.dirt_only)
 
         print('Dirt calculated in %.6f' % (time.time() - t))
 
-        return {'FINISHED'}
+        return ret
diff --git a/release/scripts/startup/bl_operators/view3d.py b/release/scripts/startup/bl_operators/view3d.py
index 315b7e5..9b1bf25 100644
--- a/release/scripts/startup/bl_operators/view3d.py
+++ b/release/scripts/startup/bl_operators/view3d.py
@@ -76,7 +76,9 @@ class VIEW3D_OT_edit_mesh_extrude_move(Operator):
             bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN',
                     TRANSFORM_OT_translate={
                         "constraint_orientation": 'NORMAL',
-                        "constraint_axis": (True, True, False)})
+                        # not a popular choice, too restrictive for retopo.
+                        #~ "constraint_axis": (True, True, False)})
+                        "constraint_axis": (False, False, False)})
         else:
             bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN')
 
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index 6184082..926ad9b 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -29,9 +29,6 @@ from bpy.props import (StringProperty,
 
 from rna_prop_ui import rna_idprop_ui_prop_get, rna_idprop_ui_prop_clear
 
-import subprocess
-import os
-
 
 class MESH_OT_delete_edgeloop(Operator):
     '''Delete an edge loop by merging the faces on each side to a single face loop'''
@@ -146,12 +143,12 @@ class BRUSH_OT_active_index_set(Operator):
     bl_label = "Set Brush Number"
 
     mode = StringProperty(
-            name="mode",
+            name="Mode",
             description="Paint mode to set brush for",
             maxlen=1024,
             )
     index = IntProperty(
-            name="number",
+            name="Number",
             description="Brush number",
             )
 
@@ -644,6 +641,10 @@ class WM_OT_context_modal_mouse(Operator):
 
     data_path_iter = data_path_iter
     data_path_item = data_path_item
+    header_text = StringProperty(
+            name="Header Text",
+            description="Text to display in header during scale",
+            )
 
     input_scale = FloatProperty(
             description="Scale the mouse movement by this value before applying the delta",
@@ -703,14 +704,24 @@ class WM_OT_context_modal_mouse(Operator):
         if event_type == 'MOUSEMOVE':
             delta = event.mouse_x - self.initial_x
             self._values_delta(delta)
+            header_text = self.header_text
+            if header_text:
+                if len(self._values) == 1:
+                    (item, ) = self._values.keys()
+                    header_text = header_text % eval("item.%s" % self.data_path_item)
+                else:
+                    header_text = (self.header_text % delta) + " (delta)"
+                context.area.header_text_set(header_text)
 
         elif 'LEFTMOUSE' == event_type:
             item = next(iter(self._values.keys()))
             self._values_clear()
+            context.area.header_text_set()
             return operator_value_undo_return(item)
 
         elif event_type in {'RIGHTMOUSE', 'ESC'}:
             self._values_restore()
+            context.area.header_text_set()
             return {'CANCELLED'}
 
         return {'RUNNING_MODAL'}
@@ -1028,6 +1039,7 @@ class WM_OT_properties_add(Operator):
     '''Internal use (edit a property data_path)'''
     bl_idname = "wm.properties_add"
     bl_label = "Add Property"
+    bl_options = {'UNDO'}
 
     data_path = rna_path
 
@@ -1070,6 +1082,7 @@ class WM_OT_properties_remove(Operator):
     '''Internal use (edit a property data_path)'''
     bl_idname = "wm.properties_remove"
     bl_label = "Remove Property"
+    bl_options = {'UNDO'}
 
     data_path = rna_path
     property = rna_property
@@ -1182,22 +1195,30 @@ class WM_OT_copy_prev_settings(Operator):
 class WM_OT_blenderplayer_start(Operator):
     '''Launch the blender-player with the current blend-file'''
     bl_idname = "wm.blenderplayer_start"
-    bl_label = "Start"
-
-    blender_bin_path = bpy.app.binary_path
-    blender_bin_dir = os.path.dirname(blender_bin_path)
-    ext = os.path.splitext(blender_bin_path)[-1]
-    player_path = os.path.join(blender_bin_dir, "blenderplayer" + ext)
+    bl_label = "Start Game In Player"
 
     def execute(self, context):
+        import os
         import sys
+        import subprocess
+
+        # these remain the same every execution
+        blender_bin_path = bpy.app.binary_path
+        blender_bin_dir = os.path.dirname(blender_bin_path)
+        ext = os.path.splitext(blender_bin_path)[-1]
+        player_path = os.path.join(blender_bin_dir, "blenderplayer" + ext)
+        # done static vars
 
         if sys.platform == "darwin":
-            self.player_path = os.path.join(self.blender_bin_dir, "../../../blenderplayer.app/Contents/MacOS/blenderplayer")
+            player_path = os.path.join(blender_bin_dir, "../../../blenderplayer.app/Contents/MacOS/blenderplayer")
+
+        if not os.path.exists(player_path):
+            self.report({'ERROR'}, "Player path: %r not found" % player_path)
+            return {'CANCELLED'}
 
-        filepath = bpy.app.tempdir + "game.blend"
+        filepath = os.path.join(bpy.app.tempdir, "game.blend")
         bpy.ops.wm.save_as_mainfile(filepath=filepath, check_existing=False, copy=True)
-        subprocess.call([self.player_path, filepath])
+        subprocess.call([player_path, filepath])
         return {'FINISHED'}
 
 
diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py
index d1bc069..08529a0 100644
--- a/release/scripts/startup/bl_ui/properties_data_armature.py
+++ b/release/scripts/startup/bl_ui/properties_data_armature.py
@@ -204,7 +204,7 @@ class DATA_PT_pose_library(ArmatureButtonsPanel, Panel):
             pose_marker_active = poselib.pose_markers.active
 
             if pose_marker_active is not None:
-                col.operator("poselib.pose_remove", icon='ZOOMOUT', text="").pose = pose_marker_active.name
+                col.operator("poselib.pose_remove", icon='ZOOMOUT', text="")
                 col.operator("poselib.apply_pose", icon='ZOOM_SELECTED', text="").pose_index = poselib.pose_markers.active_index
 
             col.operator("poselib.action_sanitise", icon='HELP', text="")  # XXX: put in menu?
@@ -289,7 +289,7 @@ class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, Panel):
                 row.prop(itasc, "damping_max", text="Damp", slider=True)
                 row.prop(itasc, "damping_epsilon", text="Eps", slider=True)
 
-from .properties_animviz import (
+from bl_ui.properties_animviz import (
     MotionPathButtonsPanel,
     OnionSkinButtonsPanel,
     )
diff --git a/release/scripts/startup/bl_ui/properties_data_bone.py b/release/scripts/startup/bl_ui/properties_data_bone.py
index 807e5e6..10c4c1f 100644
--- a/release/scripts/startup/bl_ui/properties_data_bone.py
+++ b/release/scripts/startup/bl_ui/properties_data_bone.py
@@ -206,8 +206,10 @@ class BONE_PT_display(BoneButtonsPanel, Panel):
             split = layout.split()
 
             col = split.column()
-            col.prop(bone, "show_wire", text="Wireframe")
             col.prop(bone, "hide", text="Hide")
+            sub = col.column()
+            sub.active = bool(pchan.custom_shape)
+            sub.prop(bone, "show_wire", text="Wireframe")
 
             if pchan:
                 col = split.column()
diff --git a/release/scripts/startup/bl_ui/properties_data_camera.py b/release/scripts/startup/bl_ui/properties_data_camera.py
index 1d7559b..5da41a6 100644
--- a/release/scripts/startup/bl_ui/properties_data_camera.py
+++ b/release/scripts/startup/bl_ui/properties_data_camera.py
@@ -88,11 +88,7 @@ class DATA_PT_lens(CameraButtonsPanel, Panel):
             col.prop(cam, "ortho_scale")
 
         col = layout.column()
-        if cam.type == 'ORTHO':
-            if cam.use_panorama:
-                col.alert = True
-            else:
-                col.enabled = False
+        col.enabled = cam.type == 'PERSP'
 
         col.prop(cam, "use_panorama")
 
diff --git a/release/scripts/startup/bl_ui/properties_data_curve.py b/release/scripts/startup/bl_ui/properties_data_curve.py
index 91230c9..b8a37e3 100644
--- a/release/scripts/startup/bl_ui/properties_data_curve.py
+++ b/release/scripts/startup/bl_ui/properties_data_curve.py
@@ -93,7 +93,7 @@ class DATA_PT_shape_curve(CurveButtonsPanel, Panel):
             col.label(text="Twisting:")
             col.prop(curve, "twist_mode", text="")
             col.prop(curve, "twist_smooth", text="Smooth")
-        if is_text:
+        elif is_text:
             col.label(text="Display:")
             col.prop(curve, "use_fast_edit", text="Fast Editing")
 
@@ -113,6 +113,14 @@ class DATA_PT_shape_curve(CurveButtonsPanel, Panel):
             sub.prop(curve, "fill_mode", text="")
             col.prop(curve, "use_fill_deform")
 
+        if is_curve:
+            col.label(text="Path / Curve-Deform:")
+            sub = col.column()
+            subsub = sub.row()
+            subsub.prop(curve, "use_radius")
+            subsub.prop(curve, "use_stretch")
+            sub.prop(curve, "use_deform_bounds")
+
 
 class DATA_PT_curve_texture_space(CurveButtonsPanel, Panel):
     bl_label = "Texture Space"
@@ -186,19 +194,13 @@ class DATA_PT_pathanim(CurveButtonsPanelCurve, Panel):
         layout.active = curve.use_path
 
         col = layout.column()
-        layout.prop(curve, "path_duration", text="Frames")
-        layout.prop(curve, "eval_time")
-
-        split = layout.split()
+        col.prop(curve, "path_duration", text="Frames")
+        col.prop(curve, "eval_time")
 
-        col = split.column()
-        col.prop(curve, "use_path_follow")
-        col.prop(curve, "use_stretch")
-        col.prop(curve, "use_deform_bounds")
-
-        col = split.column()
-        col.prop(curve, "use_radius")
-        col.prop(curve, "use_time_offset", text="Offset Children")
+        # these are for paths only
+        row = layout.row()
+        row.prop(curve, "use_path_follow")
+        row.prop(curve, "use_time_offset", text="Offset Children")
 
 
 class DATA_PT_active_spline(CurveButtonsPanelActive, Panel):
@@ -320,10 +322,10 @@ class DATA_PT_font(CurveButtonsPanel, Panel):
         split = layout.split()
 
         col = split.column()
-        colsub = col.column(align=True)
-        colsub.label(text="Underline:")
-        colsub.prop(text, "underline_position", text="Position")
-        colsub.prop(text, "underline_height", text="Thickness")
+        sub = col.column(align=True)
+        sub.label(text="Underline:")
+        sub.prop(text, "underline_position", text="Position")
+        sub.prop(text, "underline_height", text="Thickness")
 
         col = split.column()
         col.label(text="Character:")
diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py
index 7828d90..fd96fa4 100644
--- a/release/scripts/startup/bl_ui/properties_data_mesh.py
+++ b/release/scripts/startup/bl_ui/properties_data_mesh.py
@@ -162,7 +162,7 @@ class DATA_PT_vertex_groups(MeshButtonsPanel, Panel):
             row = layout.row()
 
             sub = row.row(align=True)
-            sub.operator("object.vertex_group_assign", text="Assign")
+            sub.operator("object.vertex_group_assign", text="Assign").new = False
             sub.operator("object.vertex_group_remove_from", text="Remove")
 
             sub = row.row(align=True)
@@ -233,7 +233,10 @@ class DATA_PT_shape_keys(MeshButtonsPanel, Panel):
             sub.prop(ob, "use_shape_key_edit_mode", text="")
 
             sub = row.row()
-            sub.operator("object.shape_key_clear", icon='X', text="")
+            if key.use_relative:
+                sub.operator("object.shape_key_clear", icon='X', text="")
+            else:
+                sub.operator("object.shape_key_retime", icon='RECOVER_LAST', text="")
 
             row = layout.row()
             row.prop(kb, "name")
@@ -259,8 +262,9 @@ class DATA_PT_shape_keys(MeshButtonsPanel, Panel):
                     col.prop_search(kb, "relative_key", key, "key_blocks", text="")
 
             else:
-                row = layout.row()
+                row = layout.column()
                 row.active = enable_edit_value
+                row.prop(key, "eval_time")
                 row.prop(key, "slurph")
 
 
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 354b70c..9c4e79c 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -25,6 +25,7 @@ class ModifierButtonsPanel():
     bl_space_type = 'PROPERTIES'
     bl_region_type = 'WINDOW'
     bl_context = "modifier"
+    bl_options = {'HIDE_HEADER'}
 
 
 class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
@@ -122,6 +123,14 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         split.prop(md, "width")
         split.prop(md, "use_only_vertices")
 
+        # -- new modifier only, this may be reverted in favor of 2.62 mod.
+        '''
+        split = layout.split()
+        split.prop(md, "use_even_offset")
+        split.prop(md, "use_distance_offset")
+        '''
+        # -- end
+
         layout.label(text="Limit Method:")
         layout.row().prop(md, "limit_method", expand=True)
         if md.limit_method == 'ANGLE':
@@ -310,6 +319,9 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         col.label(text="Vertex Group:")
         col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
 
+        layout.separator()
+        layout.prop(md, "strength", slider=True)
+
     def MASK(self, layout, ob, md):
         split = layout.split()
 
@@ -428,11 +440,15 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
 
         layout.separator()
 
-        flow = layout.column_flow()
-        flow.prop(md, "time")
-        flow.prop(md, "resolution")
-        flow.prop(md, "spatial_size")
-        flow.prop(md, "depth")
+        split = layout.split()
+        
+        col = split.column()
+        col.prop(md, "time")
+        col.prop(md, "resolution")
+        
+        col = split.column()
+        col.prop(md, "spatial_size")
+        col.prop(md, "depth")
 
         layout.label("Waves:")
 
diff --git a/release/scripts/startup/bl_ui/properties_game.py b/release/scripts/startup/bl_ui/properties_game.py
index ee5702e..c3f1c42 100644
--- a/release/scripts/startup/bl_ui/properties_game.py
+++ b/release/scripts/startup/bl_ui/properties_game.py
@@ -122,7 +122,8 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel, Panel):
             col = split.column()
             col.label(text="Attributes:")
             col.prop(game, "mass")
-            col.prop(soft, "weld_threshold")
+            # disabled in the code
+            # col.prop(soft, "weld_threshold")
             col.prop(soft, "location_iterations")
             col.prop(soft, "linear_stiffness", slider=True)
             col.prop(soft, "dynamic_friction", slider=True)
@@ -165,7 +166,12 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel, Panel):
             subsub.active = game.use_anisotropic_friction
             subsub.prop(game, "friction_coefficients", text="", slider=True)
 
-        elif physics_type in {'SENSOR', 'INVISIBLE', 'NO_COLLISION', 'OCCLUDE'}:
+        elif physics_type == 'SENSOR':
+            col = layout.column()
+            col.prop(game, "use_actor", text="Detect Actors")
+            col.prop(ob, "hide_render", text="Invisible")
+
+        elif physics_type in {'INVISIBLE', 'NO_COLLISION', 'OCCLUDE'}:
             layout.prop(ob, "hide_render", text="Invisible")
 
         elif physics_type == 'NAVMESH':
@@ -329,7 +335,7 @@ class RENDER_PT_game_stereo(RenderButtonsPanel, Panel):
                 col.prop(gs, "dome_angle", slider=True)
 
                 col = split.column()
-                col.prop(gs, "dome_tesselation", text="Tesselation")
+                col.prop(gs, "dome_tessellation", text="Tessellation")
                 col.prop(gs, "dome_tilt")
 
             elif dome_type == 'PANORAM_SPH':
@@ -337,7 +343,7 @@ class RENDER_PT_game_stereo(RenderButtonsPanel, Panel):
 
                 col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
                 col = split.column()
-                col.prop(gs, "dome_tesselation", text="Tesselation")
+                col.prop(gs, "dome_tessellation", text="Tessellation")
 
             else:  # cube map
                 col = split.column()
diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py
index f01c2ba..d7b4b1a 100644
--- a/release/scripts/startup/bl_ui/properties_object.py
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -90,7 +90,7 @@ class OBJECT_PT_delta_transform(ObjectButtonsPanel, Panel):
             #row.column().prop(ob, "delta_rotation_axis_angle", text="Rotation")
             row.column().label(text="Not for Axis-Angle")
         else:
-            row.column().prop(ob, "delta_rotation_euler", text="Rotation")
+            row.column().prop(ob, "delta_rotation_euler", text="Delta Rotation")
 
         row.column().prop(ob, "delta_scale")
 
@@ -162,7 +162,6 @@ class OBJECT_PT_groups(ObjectButtonsPanel, Panel):
 
         # XXX, this is bad practice, yes, I wrote it :( - campbell
         index = 0
-        value = str(tuple(context.scene.cursor_location))
         for group in bpy.data.groups:
             if ob.name in group.objects:
                 col = layout.column(align=True)
@@ -181,9 +180,8 @@ class OBJECT_PT_groups(ObjectButtonsPanel, Panel):
                 col = split.column()
                 col.prop(group, "dupli_offset", text="")
 
-                props = col.operator("wm.context_set_value", text="From Cursor")
-                props.data_path = "object.users_group[%d].dupli_offset" % index
-                props.value = value
+                props = col.operator("object.dupli_offset_from_cursor", text="From Cursor")
+                props.group = index
                 index += 1
 
 
@@ -211,8 +209,11 @@ class OBJECT_PT_display(ObjectButtonsPanel, Panel):
         col = split.column()
         col.prop(ob, "show_name", text="Name")
         col.prop(ob, "show_axis", text="Axis")
-        col.prop(ob, "show_wire", text="Wire")
-        col.prop(ob, "color", text="Object Color")
+        if ob.type in {"MESH", "CURVE", "SURFACE", "META", "FONT"}:
+            # Makes no sense for cameras, armtures, etc.!
+            col.prop(ob, "show_wire", text="Wire")
+            # Only useful with object having faces/materials...
+            col.prop(ob, "color", text="Object Color")
 
         col = split.column()
         col.prop(ob, "show_texture_space", text="Texture Space")
@@ -280,7 +281,7 @@ class OBJECT_PT_relations_extras(ObjectButtonsPanel, Panel):
         row.prop(ob, "slow_parent_offset", text="Offset")
 
 
-from .properties_animviz import (
+from bl_ui.properties_animviz import (
     MotionPathButtonsPanel,
     OnionSkinButtonsPanel,
     )
diff --git a/release/scripts/startup/bl_ui/properties_object_constraint.py b/release/scripts/startup/bl_ui/properties_object_constraint.py
index 68c0069..bfa2b4f 100644
--- a/release/scripts/startup/bl_ui/properties_object_constraint.py
+++ b/release/scripts/startup/bl_ui/properties_object_constraint.py
@@ -796,7 +796,6 @@ class ConstraintButtonsPanel():
         layout.operator("clip.constraint_to_fcurve")
 
     def OBJECT_SOLVER(self, context, layout, con):
-        scene = context.scene
         clip = self._getConstraintClip(context, con)
 
         layout.prop(con, "use_active_clip")
@@ -816,12 +815,13 @@ class ConstraintButtonsPanel():
         layout.operator("clip.constraint_to_fcurve")
 
     def SCRIPT(self, context, layout, con):
-        layout.label("Blender 2.5 has no py-constraints")
+        layout.label("Blender 2.6 doesn't support python constraints yet.")
 
 
 class OBJECT_PT_constraints(ConstraintButtonsPanel, Panel):
     bl_label = "Object Constraints"
     bl_context = "constraint"
+    bl_options = {'HIDE_HEADER'}
 
     @classmethod
     def poll(cls, context):
@@ -846,6 +846,7 @@ class OBJECT_PT_constraints(ConstraintButtonsPanel, Panel):
 class BONE_PT_constraints(ConstraintButtonsPanel, Panel):
     bl_label = "Bone Constraints"
     bl_context = "bone_constraint"
+    bl_options = {'HIDE_HEADER'}
 
     @classmethod
     def poll(cls, context):
diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py
index 4e511f1..9200c68 100644
--- a/release/scripts/startup/bl_ui/properties_particle.py
+++ b/release/scripts/startup/bl_ui/properties_particle.py
@@ -21,7 +21,7 @@ import bpy
 from bpy.types import Panel
 from rna_prop_ui import PropertyPanel
 
-from .properties_physics_common import (
+from bl_ui.properties_physics_common import (
     point_cache_ui,
     effector_weights_ui,
     basic_force_field_settings_ui,
@@ -380,6 +380,7 @@ class PARTICLE_PT_velocity(ParticleButtonsPanel, Panel):
 
 class PARTICLE_PT_rotation(ParticleButtonsPanel, Panel):
     bl_label = "Rotation"
+    bl_options = {'DEFAULT_CLOSED'}
     COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     @classmethod
@@ -394,6 +395,15 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel, Panel):
         else:
             return False
 
+    def draw_header(self, context):
+        psys = context.particle_system
+        if psys:
+            part = psys.settings
+        else:
+            part = context.space_data.pin_id
+
+        self.layout.prop(part, "use_rotations", text="")
+
     def draw(self, context):
         layout = self.layout
 
@@ -403,14 +413,9 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel, Panel):
         else:
             part = context.space_data.pin_id
 
-        layout.enabled = particle_panel_enabled(context, psys)
-
-        layout.prop(part, "use_dynamic_rotation")
+        layout.enabled = particle_panel_enabled(context, psys) and part.use_rotations
 
-        if part.use_dynamic_rotation:
-            layout.label(text="Initial Rotation Axis:")
-        else:
-            layout.label(text="Rotation Axis:")
+        layout.label(text="Initial Orientation:")
 
         split = layout.split()
 
@@ -423,16 +428,17 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel, Panel):
         col.prop(part, "phase_factor_random", text="Random", slider=True)
 
         if part.type != 'HAIR':
-            col = layout.column()
-            if part.use_dynamic_rotation:
-                col.label(text="Initial Angular Velocity:")
-            else:
-                col.label(text="Angular Velocity:")
-            sub = col.row(align=True)
-            sub.prop(part, "angular_velocity_mode", text="")
-            subsub = sub.column()
-            subsub.active = part.angular_velocity_mode != 'NONE'
-            subsub.prop(part, "angular_velocity_factor", text="")
+            layout.label(text="Angular Velocity:")
+
+            split = layout.split()
+            col = split.column(align=True)
+            col.prop(part, "angular_velocity_mode", text="")
+            sub = col.column()
+            sub.active = part.angular_velocity_mode != 'NONE'
+            sub.prop(part, "angular_velocity_factor", text="")
+
+            col = split.column()
+            col.prop(part, "use_dynamic_rotation")
 
 
 class PARTICLE_PT_physics(ParticleButtonsPanel, Panel):
@@ -1178,43 +1184,34 @@ class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, Panel):
         ob = context.object
         psys = context.particle_system
 
-        row = layout.row()
-        row.label(text="Vertex Group")
-        row.label(text="Negate")
+        split = layout.split(percentage=0.85)
 
-        row = layout.row()
-        row.prop_search(psys, "vertex_group_density", ob, "vertex_groups", text="Density")
-        row.prop(psys, "invert_vertex_group_density", text="")
+        col = split.column()
+        col.label(text="Vertex Group:")
+        col.prop_search(psys, "vertex_group_density", ob, "vertex_groups", text="Density")
+        col.prop_search(psys, "vertex_group_length", ob, "vertex_groups", text="Length")
+        col.prop_search(psys, "vertex_group_clump", ob, "vertex_groups", text="Clump")
+        col.prop_search(psys, "vertex_group_kink", ob, "vertex_groups", text="Kink")
+        col.prop_search(psys, "vertex_group_roughness_1", ob, "vertex_groups", text="Roughness 1")
+        col.prop_search(psys, "vertex_group_roughness_2", ob, "vertex_groups", text="Roughness 2")
+        col.prop_search(psys, "vertex_group_roughness_end", ob, "vertex_groups", text="Roughness End")
+
+        col = split.column()
+        col.label(text="Negate:")
+        col.alignment = 'RIGHT'
+        col.prop(psys, "invert_vertex_group_density", text="")
+        col.prop(psys, "invert_vertex_group_length", text="")
+        col.prop(psys, "invert_vertex_group_clump", text="")
+        col.prop(psys, "invert_vertex_group_kink", text="")
+        col.prop(psys, "invert_vertex_group_roughness_1", text="")
+        col.prop(psys, "invert_vertex_group_roughness_2", text="")
+        col.prop(psys, "invert_vertex_group_roughness_end", text="")
 
         # Commented out vertex groups don't work and are still waiting for better implementation
         # row = layout.row()
         # row.prop_search(psys, "vertex_group_velocity", ob, "vertex_groups", text="Velocity")
         # row.prop(psys, "invert_vertex_group_velocity", text="")
 
-        row = layout.row()
-        row.prop_search(psys, "vertex_group_length", ob, "vertex_groups", text="Length")
-        row.prop(psys, "invert_vertex_group_length", text="")
-
-        row = layout.row()
-        row.prop_search(psys, "vertex_group_clump", ob, "vertex_groups", text="Clump")
-        row.prop(psys, "invert_vertex_group_clump", text="")
-
-        row = layout.row()
-        row.prop_search(psys, "vertex_group_kink", ob, "vertex_groups", text="Kink")
-        row.prop(psys, "invert_vertex_group_kink", text="")
-
-        row = layout.row()
-        row.prop_search(psys, "vertex_group_roughness_1", ob, "vertex_groups", text="Roughness 1")
-        row.prop(psys, "invert_vertex_group_roughness_1", text="")
-
-        row = layout.row()
-        row.prop_search(psys, "vertex_group_roughness_2", ob, "vertex_groups", text="Roughness 2")
-        row.prop(psys, "invert_vertex_group_roughness_2", text="")
-
-        row = layout.row()
-        row.prop_search(psys, "vertex_group_roughness_end", ob, "vertex_groups", text="Roughness End")
-        row.prop(psys, "invert_vertex_group_roughness_end", text="")
-
         # row = layout.row()
         # row.prop_search(psys, "vertex_group_size", ob, "vertex_groups", text="Size")
         # row.prop(psys, "invert_vertex_group_size", text="")
diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py b/release/scripts/startup/bl_ui/properties_physics_cloth.py
index dc64aac..e313112 100644
--- a/release/scripts/startup/bl_ui/properties_physics_cloth.py
+++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py
@@ -20,7 +20,7 @@
 import bpy
 from bpy.types import Menu, Panel
 
-from .properties_physics_common import (
+from bl_ui.properties_physics_common import (
     point_cache_ui,
     effector_weights_ui,
     )
@@ -31,9 +31,6 @@ def cloth_panel_enabled(md):
 
 
 class CLOTH_MT_presets(Menu):
-    '''
-    Creates the menu items by scanning scripts/templates
-    '''
     bl_label = "Cloth Presets"
     preset_subdir = "cloth"
     preset_operator = "script.execute_preset"
diff --git a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
index d6aeea8..04696c7 100644
--- a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
+++ b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
@@ -17,11 +17,10 @@
 # ##### END GPL LICENSE BLOCK #####
 
 # <pep8 compliant>
-
 import bpy
 from bpy.types import Panel
 
-from .properties_physics_common import (
+from bl_ui.properties_physics_common import (
     point_cache_ui,
     effector_weights_ui,
     )
@@ -217,7 +216,7 @@ class PHYSICS_PT_dp_canvas_output(PhysicButtonsPanel, Panel):
 
                 # paint-map output
                 row = layout.row()
-                row.prop_search(surface, "output_name_a", ob.data, "vertex_colors", text="Paintmap layer: ")
+                row.prop_search(surface, "output_name_a", ob.data, "vertex_colors", text="Paintmap layer:")
                 if surface.output_exists(object=ob, index=0):
                     ic = 'ZOOMOUT'
                 else:
@@ -227,7 +226,7 @@ class PHYSICS_PT_dp_canvas_output(PhysicButtonsPanel, Panel):
 
                 # wet-map output
                 row = layout.row()
-                row.prop_search(surface, "output_name_b", ob.data, "vertex_colors", text="Wetmap layer: ")
+                row.prop_search(surface, "output_name_b", ob.data, "vertex_colors", text="Wetmap layer:")
                 if surface.output_exists(object=ob, index=1):
                     ic = 'ZOOMOUT'
                 else:
@@ -237,7 +236,7 @@ class PHYSICS_PT_dp_canvas_output(PhysicButtonsPanel, Panel):
 
             elif surface_type == 'WEIGHT':
                 row = layout.row()
-                row.prop_search(surface, "output_name_a", ob, "vertex_groups", text="Vertex Group: ")
+                row.prop_search(surface, "output_name_a", ob, "vertex_groups", text="Vertex Group:")
                 if surface.output_exists(object=ob, index=0):
                     ic = 'ZOOMOUT'
                 else:
@@ -270,7 +269,7 @@ class PHYSICS_PT_dp_canvas_output(PhysicButtonsPanel, Panel):
                 sub.prop(surface, "output_name_b", text="")
             else:
                 col = layout.column()
-                col.prop(surface, "output_name_a", text="Filename: ")
+                col.prop(surface, "output_name_a", text="Filename:")
                 if surface_type == 'DISPLACE':
                     col.prop(surface, "displace_type", text="Displace Type")
                     col.prop(surface, "depth_clamp")
@@ -309,7 +308,7 @@ class PHYSICS_PT_dp_canvas_initial_color(PhysicButtonsPanel, Panel):
             layout.prop_search(surface, "init_layername", ob.data, "uv_textures", text="UV Map:")
 
         elif surface.init_color_type == 'VERTEX_COLOR':
-            layout.prop_search(surface, "init_layername", ob.data, "vertex_colors", text="Color Layer: ")
+            layout.prop_search(surface, "init_layername", ob.data, "vertex_colors", text="Color Layer:")
 
 
 class PHYSICS_PT_dp_effects(PhysicButtonsPanel, Panel):
diff --git a/release/scripts/startup/bl_ui/properties_physics_field.py b/release/scripts/startup/bl_ui/properties_physics_field.py
index bc7f330..2229b9d 100644
--- a/release/scripts/startup/bl_ui/properties_physics_field.py
+++ b/release/scripts/startup/bl_ui/properties_physics_field.py
@@ -20,7 +20,7 @@
 import bpy
 from bpy.types import Panel
 
-from .properties_physics_common import (
+from bl_ui.properties_physics_common import (
     basic_force_field_settings_ui,
     basic_force_field_falloff_ui,
     )
diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py
index 363b0f2..beb525b 100644
--- a/release/scripts/startup/bl_ui/properties_physics_fluid.py
+++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py
@@ -18,7 +18,14 @@
 
 # <pep8 compliant>
 import bpy
-from bpy.types import Panel
+from bpy.types import Panel, Menu
+
+
+class FLUID_MT_presets(Menu):
+    bl_label = "Fluid Presets"
+    preset_subdir = "fluid"
+    preset_operator = "script.execute_preset"
+    draw = Menu.draw_preset
 
 
 class PhysicButtonsPanel():
@@ -42,17 +49,17 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, Panel):
         md = context.fluid
         fluid = md.settings
 
-        row = layout.row()
+        col = layout.column()
         if fluid is None:
-            row.label("Built without fluids")
+            col.label("Built without fluids")
             return
 
-        row.prop(fluid, "type")
-        if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID'}:
-            row.prop(fluid, "use", text="")
+        col.prop(fluid, "type")
+        if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID', 'OBSTACLE'}:
+            col.prop(fluid, "use")
 
         layout = layout.column()
-        if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID'}:
+        if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID', 'OBSTACLE'}:
             layout.active = fluid.use
 
         if fluid.type == 'DOMAIN':
@@ -134,15 +141,11 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, Panel):
             col.prop(fluid, "inflow_velocity", text="")
 
         elif fluid.type == 'OUTFLOW':
-            split = layout.split()
-
-            col = split.column()
+            col = layout.column()
             col.label(text="Volume Initialization:")
             col.prop(fluid, "volume_initialization", text="")
             col.prop(fluid, "use_animated_mesh")
 
-            split.column()
-
         elif fluid.type == 'PARTICLE':
             split = layout.split()
 
@@ -226,16 +229,14 @@ class PHYSICS_PT_domain_gravity(PhysicButtonsPanel, Panel):
 
         col = split.column()
         col.label(text="Viscosity Presets:")
-        sub = col.column(align=True)
-        sub.prop(fluid, "viscosity_preset", text="")
-
-        if fluid.viscosity_preset == 'MANUAL':
-            sub.prop(fluid, "viscosity_base", text="Base")
-            sub.prop(fluid, "viscosity_exponent", text="Exponent", slider=True)
-        else:
-            # just for padding to prevent jumping around
-            sub.separator()
-            sub.separator()
+        sub = col.row(align=True)
+        sub.menu("FLUID_MT_presets", text=bpy.types.FLUID_MT_presets.bl_label)
+        sub.operator("fluid.preset_add", text="", icon='ZOOMIN')
+        sub.operator("fluid.preset_add", text="", icon='ZOOMOUT').remove_active = True
+
+        subsub = col.column(align=True)
+        subsub.prop(fluid, "viscosity_base", text="Base")
+        subsub.prop(fluid, "viscosity_exponent", text="Exponent", slider=True)
 
         col.label(text="Optimization:")
         col.prop(fluid, "grid_levels", slider=True)
diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py
index 4c41364..9f760f2 100644
--- a/release/scripts/startup/bl_ui/properties_physics_smoke.py
+++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py
@@ -20,7 +20,7 @@
 import bpy
 from bpy.types import Panel
 
-from .properties_physics_common import (
+from bl_ui.properties_physics_common import (
     point_cache_ui,
     effector_weights_ui,
     )
diff --git a/release/scripts/startup/bl_ui/properties_physics_softbody.py b/release/scripts/startup/bl_ui/properties_physics_softbody.py
index 78c74a7..ea4180c 100644
--- a/release/scripts/startup/bl_ui/properties_physics_softbody.py
+++ b/release/scripts/startup/bl_ui/properties_physics_softbody.py
@@ -20,7 +20,7 @@
 import bpy
 from bpy.types import Panel
 
-from .properties_physics_common import (
+from bl_ui.properties_physics_common import (
     point_cache_ui,
     effector_weights_ui,
     )
diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py
index 7879f15..1c78549 100644
--- a/release/scripts/startup/bl_ui/properties_scene.py
+++ b/release/scripts/startup/bl_ui/properties_scene.py
@@ -115,7 +115,8 @@ class SCENE_PT_keying_sets(SceneButtonsPanel, Panel):
             row = layout.row()
 
             col = row.column()
-            col.prop(ks, "name")
+            col.prop(ks, "bl_label")
+            col.prop(ks, "bl_description")
 
             subcol = col.column()
             subcol.operator_context = 'INVOKE_DEFAULT'
diff --git a/release/scripts/startup/bl_ui/properties_texture.py b/release/scripts/startup/bl_ui/properties_texture.py
index 13d25e6..3204758 100644
--- a/release/scripts/startup/bl_ui/properties_texture.py
+++ b/release/scripts/startup/bl_ui/properties_texture.py
@@ -52,7 +52,7 @@ class TEXTURE_MT_envmap_specials(Menu):
         layout.operator("texture.envmap_clear", icon='FILE_REFRESH')
         layout.operator("texture.envmap_clear_all", icon='FILE_REFRESH')
 
-from .properties_material import active_node_mat
+from bl_ui.properties_material import active_node_mat
 
 
 def context_tex_datablock(context):
diff --git a/release/scripts/startup/bl_ui/properties_world.py b/release/scripts/startup/bl_ui/properties_world.py
index 23f35d6..76d70aa 100644
--- a/release/scripts/startup/bl_ui/properties_world.py
+++ b/release/scripts/startup/bl_ui/properties_world.py
@@ -49,16 +49,17 @@ class WORLD_PT_context_world(WorldButtonsPanel, Panel):
         scene = context.scene
         world = context.world
         space = context.space_data
+        rd = context.scene.render
 
         texture_count = world and len(world.texture_slots.keys())
 
-        split = layout.split(percentage=0.65)
+        split = layout.split(percentage=0.85)
         if scene:
             split.template_ID(scene, "world", new="world.new")
         elif world:
             split.template_ID(space, "pin_id")
 
-        if texture_count:
+        if texture_count and rd.engine != 'CYCLES':
             split.label(text=str(texture_count), icon='TEXTURE')
 
 
diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py
index eb97e54..5cbe03b 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -298,7 +298,11 @@ class CLIP_PT_tools_orientation(Panel):
         settings = sc.clip.tracking.settings
 
         col = layout.column(align=True)
-        col.operator("clip.set_floor")
+        row = col.row()
+        props = row.operator("clip.set_plane", text="Floor")
+        props.plane = 'FLOOR'
+        props = row.operator("clip.set_plane", text="Wall")
+        props.plane = 'WALL'
         col.operator("clip.set_origin")
 
         row = col.row()
@@ -474,6 +478,41 @@ class CLIP_PT_track(Panel):
             layout.label(text=label_text)
 
 
+class CLIP_PT_track_settings(Panel):
+    bl_space_type = 'CLIP_EDITOR'
+    bl_region_type = 'UI'
+    bl_label = "Tracking Settings"
+    bl_options = {'DEFAULT_CLOSED'}
+
+    @classmethod
+    def poll(cls, context):
+        sc = context.space_data
+
+        return sc.mode == 'TRACKING' and sc.clip
+
+    def draw(self, context):
+        layout = self.layout
+        clip = context.space_data.clip
+        settings = clip.tracking.settings
+
+        col = layout.column()
+
+        active = clip.tracking.tracks.active
+        if active:
+            col.prop(active, "tracker")
+
+            if active.tracker == 'KLT':
+                col.prop(active, "pyramid_levels")
+            col.prop(active, "correlation_min")
+
+            col.separator()
+            col.prop(active, "frames_limit")
+            col.prop(active, "margin")
+            col.prop(active, "pattern_match", text="Match")
+
+        col.prop(settings, "speed")
+
+
 class CLIP_PT_tracking_camera(Panel):
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'UI'
@@ -593,41 +632,6 @@ class CLIP_PT_marker_display(Panel):
         row.prop(sc, "path_length", text="Length")
 
 
-class CLIP_PT_track_settings(Panel):
-    bl_space_type = 'CLIP_EDITOR'
-    bl_region_type = 'UI'
-    bl_label = "Tracking Settings"
-    bl_options = {'DEFAULT_CLOSED'}
-
-    @classmethod
-    def poll(cls, context):
-        sc = context.space_data
-
-        return sc.mode == 'TRACKING' and sc.clip
-
-    def draw(self, context):
-        layout = self.layout
-        clip = context.space_data.clip
-        settings = clip.tracking.settings
-
-        col = layout.column()
-
-        active = clip.tracking.tracks.active
-        if active:
-            col.prop(active, "tracker")
-
-            if active.tracker == 'KLT':
-                col.prop(active, "pyramid_levels")
-            col.prop(active, "correlation_min")
-
-            col.separator()
-            col.prop(active, "frames_limit")
-            col.prop(active, "margin")
-            col.prop(active, "pattern_match", text="Match")
-
-        col.prop(settings, "speed")
-
-
 class CLIP_PT_stabilization(Panel):
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'UI'
@@ -684,6 +688,8 @@ class CLIP_PT_stabilization(Panel):
         row.active = stab.rotation_track is not None
         row.prop(stab, "influence_rotation")
 
+        layout.prop(stab, "filter_type")
+
 
 class CLIP_PT_marker(Panel):
     bl_space_type = 'CLIP_EDITOR'
@@ -932,7 +938,10 @@ class CLIP_MT_reconstruction(Menu):
         layout = self.layout
 
         layout.operator("clip.set_origin")
-        layout.operator("clip.set_floor")
+        props = layout.operator("clip.set_plane", text="Set Floor")
+        props.plane = 'FLOOR'
+        props = layout.operator("clip.set_plane", text="Set Wall")
+        props.plane = 'WALL'
 
         layout.operator("clip.set_axis", text="Set X Axis").axis = "X"
         layout.operator("clip.set_axis", text="Set Y Axis").axis = "Y"
@@ -979,8 +988,7 @@ class CLIP_MT_select(Menu):
 
         layout.separator()
 
-        props = layout.operator("clip.select_all", text="Select/Deselect all")
-        props.action = 'TOGGLE'
+        layout.operator("clip.select_all").action = 'TOGGLE'
         layout.operator("clip.select_all", text="Inverse").action = 'INVERT'
 
         layout.menu("CLIP_MT_select_grouped")
diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py
index b7d69fb..e39ed4e 100644
--- a/release/scripts/startup/bl_ui/space_dopesheet.py
+++ b/release/scripts/startup/bl_ui/space_dopesheet.py
@@ -210,7 +210,7 @@ class DOPESHEET_MT_marker(Menu):
     def draw(self, context):
         layout = self.layout
 
-        from .space_time import marker_menu_generic
+        from bl_ui.space_time import marker_menu_generic
         marker_menu_generic(layout)
 
         st = context.space_data
diff --git a/release/scripts/startup/bl_ui/space_graph.py b/release/scripts/startup/bl_ui/space_graph.py
index 36ba5ee..8c28835 100644
--- a/release/scripts/startup/bl_ui/space_graph.py
+++ b/release/scripts/startup/bl_ui/space_graph.py
@@ -26,7 +26,7 @@ class GRAPH_HT_header(Header):
     bl_space_type = 'GRAPH_EDITOR'
 
     def draw(self, context):
-        from .space_dopesheet import dopesheet_filter
+        from bl_ui.space_dopesheet import dopesheet_filter
 
         layout = self.layout
 
@@ -144,7 +144,7 @@ class GRAPH_MT_marker(Menu):
     def draw(self, context):
         layout = self.layout
 
-        from .space_time import marker_menu_generic
+        from bl_ui.space_time import marker_menu_generic
         marker_menu_generic(layout)
 
         # TODO: pose markers for action edit mode only?
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index c0cc692..861a567 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -19,7 +19,7 @@
 # <pep8 compliant>
 import bpy
 from bpy.types import Header, Menu, Panel
-from .properties_paint_common import UnifiedPaintPanel
+from bl_ui.properties_paint_common import UnifiedPaintPanel
 
 
 class ImagePaintPanel(UnifiedPaintPanel):
@@ -97,7 +97,7 @@ class IMAGE_MT_select(Menu):
 
         layout.separator()
 
-        layout.operator("uv.select_all")
+        layout.operator("uv.select_all").action = 'TOGGLE'
         layout.operator("uv.select_all", text="Inverse").action = 'INVERT'
         layout.operator("uv.unlink_selected")
 
diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py
index b6a450e..66d18fc 100644
--- a/release/scripts/startup/bl_ui/space_info.py
+++ b/release/scripts/startup/bl_ui/space_info.py
@@ -105,47 +105,46 @@ class INFO_MT_file(Menu):
     def draw(self, context):
         layout = self.layout
 
-        layout.operator_context = 'EXEC_AREA'
-        layout.operator("wm.read_homefile", text="New", icon='NEW')
         layout.operator_context = 'INVOKE_AREA'
+        layout.operator("wm.read_homefile", text="New", icon='NEW')
         layout.operator("wm.open_mainfile", text="Open...", icon='FILE_FOLDER')
-        layout.menu("INFO_MT_file_open_recent")
+        layout.menu("INFO_MT_file_open_recent", icon='OPEN_RECENT')
         layout.operator("wm.recover_last_session", icon='RECOVER_LAST')
-        layout.operator("wm.recover_auto_save", text="Recover Auto Save...")
+        layout.operator("wm.recover_auto_save", text="Recover Auto Save...", icon='RECOVER_AUTO')
 
         layout.separator()
 
         layout.operator_context = 'INVOKE_AREA'
         layout.operator("wm.save_mainfile", text="Save", icon='FILE_TICK').check_existing = False
         layout.operator_context = 'INVOKE_AREA'
-        layout.operator("wm.save_as_mainfile", text="Save As...")
+        layout.operator("wm.save_as_mainfile", text="Save As...", icon='SAVE_AS')
         layout.operator_context = 'INVOKE_AREA'
-        layout.operator("wm.save_as_mainfile", text="Save Copy...").copy = True
+        layout.operator("wm.save_as_mainfile", text="Save Copy...", icon='SAVE_COPY').copy = True
 
         layout.separator()
 
         layout.operator("screen.userpref_show", text="User Preferences...", icon='PREFERENCES')
 
         layout.operator_context = 'EXEC_AREA'
-        layout.operator("wm.save_homefile")
-        layout.operator("wm.read_factory_settings")
+        layout.operator("wm.save_homefile", icon='SAVE_PREFS')
+        layout.operator("wm.read_factory_settings", icon='LOAD_FACTORY')
 
         layout.separator()
 
         layout.operator_context = 'INVOKE_AREA'
-        layout.operator("wm.link_append", text="Link")
-        props = layout.operator("wm.link_append", text="Append")
+        layout.operator("wm.link_append", text="Link", icon='LINK_BLEND')
+        props = layout.operator("wm.link_append", text="Append", icon='APPEND_BLEND')
         props.link = False
         props.instance_groups = False
 
         layout.separator()
 
-        layout.menu("INFO_MT_file_import")
-        layout.menu("INFO_MT_file_export")
+        layout.menu("INFO_MT_file_import", icon='IMPORT')
+        layout.menu("INFO_MT_file_export", icon='EXPORT')
 
         layout.separator()
 
-        layout.menu("INFO_MT_file_external_data")
+        layout.menu("INFO_MT_file_external_data", icon='EXTERNAL_DATA')
 
         layout.separator()
 
@@ -362,7 +361,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-262/'
+        layout.operator("wm.url_open", text="Release Log", icon='URL').url = 'http://www.blender.org/development/release-logs/blender-263/'
 
         layout.separator()
 
diff --git a/release/scripts/startup/bl_ui/space_nla.py b/release/scripts/startup/bl_ui/space_nla.py
index 33610f3..b15dcb3 100644
--- a/release/scripts/startup/bl_ui/space_nla.py
+++ b/release/scripts/startup/bl_ui/space_nla.py
@@ -26,7 +26,7 @@ class NLA_HT_header(Header):
     bl_space_type = 'NLA_EDITOR'
 
     def draw(self, context):
-        from .space_dopesheet import dopesheet_filter
+        from bl_ui.space_dopesheet import dopesheet_filter
 
         layout = self.layout
 
@@ -104,7 +104,7 @@ class NLA_MT_marker(Menu):
     def draw(self, context):
         layout = self.layout
 
-        from .space_time import marker_menu_generic
+        from bl_ui.space_time import marker_menu_generic
         marker_menu_generic(layout)
 
 
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py
index 09af7af..aae9505 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -75,6 +75,13 @@ class SEQUENCER_HT_header(Header):
                     row.prop(ed, "overlay_frame", text="")
                     row.prop(ed, "overlay_lock", text="", icon='LOCKED')
 
+                row = layout.row(align=True)
+                props = row.operator("render.opengl", text="", icon='RENDER_STILL')
+                props.sequencer = True
+                props = row.operator("render.opengl", text="", icon='RENDER_ANIMATION')
+                props.animation = True
+                props.sequencer = True
+
         layout.template_running_jobs()
 
 
@@ -143,7 +150,7 @@ class SEQUENCER_MT_select(Menu):
         layout.operator("sequencer.select_handles", text="Left Handle").side = 'LEFT'
         layout.operator("sequencer.select_handles", text="Right Handle").side = 'RIGHT'
         layout.separator()
-        layout.operator_menu_enum("object.select_grouped", "type", text="Grouped")
+        layout.operator_menu_enum("sequencer.select_grouped", "type", text="Grouped")
         layout.operator("sequencer.select_linked")
         layout.operator("sequencer.select_all").action = 'TOGGLE'
         layout.operator("sequencer.select_all").action = 'INVERT'
@@ -155,7 +162,7 @@ class SEQUENCER_MT_marker(Menu):
     def draw(self, context):
         layout = self.layout
 
-        from .space_time import marker_menu_generic
+        from bl_ui.space_time import marker_menu_generic
         marker_menu_generic(layout)
 
 
@@ -185,6 +192,12 @@ class SEQUENCER_MT_add(Menu):
         else:
             layout.operator_menu_enum("sequencer.scene_strip_add", "scene", text="Scene...")
 
+        if len(bpy.data.movieclips) > 10:
+            layout.operator_context = 'INVOKE_DEFAULT'
+            layout.operator("sequencer.movieclip_strip_add", text="Clips...")
+        else:
+            layout.operator_menu_enum("sequencer.movieclip_strip_add", "clip", text="Clip...")
+
         layout.operator("sequencer.movie_strip_add", text="Movie")
         layout.operator("sequencer.image_strip_add", text="Image")
         layout.operator("sequencer.sound_strip_add", text="Sound")
@@ -264,6 +277,9 @@ class SEQUENCER_MT_strip(Menu):
                 layout.separator()
                 # layout.operator("sequencer.movie_change")
                 layout.operator("sequencer.rendersize")
+            elif stype == 'SOUND':
+                layout.separator()
+                layout.operator("sequencer.crossfade_sounds")
 
         layout.separator()
 
@@ -276,7 +292,10 @@ class SEQUENCER_MT_strip(Menu):
         #}
 
         layout.separator()
-        layout.operator("sequencer.reload")
+        props = layout.operator("sequencer.reload", text="Reload Strips")
+        props.adjust_length = False
+        props = layout.operator("sequencer.reload", text="Reload Strips and Adjust Length")
+        props.adjust_length = True
         layout.operator("sequencer.reassign_inputs")
         layout.operator("sequencer.swap_inputs")
         layout.separator()
@@ -531,7 +550,7 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, Panel):
         if not strip:
             return False
 
-        return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'META',
+        return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'MOVIECLIP', 'META',
                               'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
                               'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
                               'PLUGIN',
@@ -694,7 +713,7 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel, Panel):
         if not strip:
             return False
 
-        return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'META',
+        return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'MOVIECLIP', 'META',
                               'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
                               'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
                               'PLUGIN',
@@ -710,6 +729,15 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel, Panel):
         col.label(text="Video:")
         col.prop(strip, "strobe")
 
+        if strip.type == 'MOVIECLIP':
+            col = layout.column()
+            col.label(text="Tracker:")
+            col.prop(strip, "stabilize2d")
+
+            col = layout.column()
+            col.label(text="Distortion:")
+            col.prop(strip, "undistort")
+
         row = layout.row()
         row.label(text="Flip:")
         row.prop(strip, "use_flip_x", text="X")
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 2efeff0..7010c4f 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -244,6 +244,9 @@ class USERPREF_PT_interface(Panel):
 
         col.prop(view, "show_splash")
 
+        if os.name == 'nt':
+            col.prop(view, "quit_dialog")
+
 
 class USERPREF_PT_edit(Panel):
     bl_space_type = 'USER_PREFERENCES'
@@ -301,6 +304,11 @@ class USERPREF_PT_edit(Panel):
         col.separator()
         col.label(text="Playback:")
         col.prop(edit, "use_negative_frames")
+        col.separator()
+        col.separator()
+        col.separator()
+        col.label(text="Animation Editors:")
+        col.prop(edit, "fcurve_unselected_alpha", text="F-Curve Visibility")
 
         row.separator()
         row.separator()
@@ -625,6 +633,14 @@ class USERPREF_PT_theme(Panel):
             col.label(text="Menu Back:")
             ui_items_general(col, ui)
 
+            ui = theme.user_interface.wcol_tooltip
+            col.label(text="Tooltip:")
+            ui_items_general(col, ui)
+
+            ui = theme.user_interface.wcol_tooltip
+            col.label(text="Tooltip:")
+            ui_items_general(col, ui)
+
             ui = theme.user_interface.wcol_menu_item
             col.label(text="Menu Item:")
             ui_items_general(col, ui)
@@ -829,7 +845,7 @@ class USERPREF_PT_file(Panel):
         col.prop(system, "use_tabs_as_spaces")
 
 
-from .space_userpref_keymap import InputKeyMapPanel
+from bl_ui.space_userpref_keymap import InputKeyMapPanel
 
 
 class USERPREF_MT_ndof_settings(Menu):
@@ -899,6 +915,7 @@ class USERPREF_PT_input(Panel, InputKeyMapPanel):
         sub1.prop(inputs, "use_mouse_emulate_3_button")
         sub.prop(inputs, "use_mouse_continuous")
         sub.prop(inputs, "drag_threshold")
+        sub.prop(inputs, "tweak_threshold")
 
         sub.label(text="Select With:")
         sub.row().prop(inputs, "select_mouse", expand=True)
@@ -936,8 +953,6 @@ class USERPREF_PT_input(Panel, InputKeyMapPanel):
         sub.label(text="NDOF Device:")
         sub.prop(inputs, "ndof_sensitivity", text="NDOF Sensitivity")
 
-        col.prop(inputs, "tweak_threshold")
-
         row.separator()
 
     def draw(self, context):
@@ -1107,6 +1122,10 @@ class USERPREF_PT_addons(Panel):
                         split = colsub.row().split(percentage=0.15)
                         split.label(text="Location:")
                         split.label(text=info["location"])
+                    if mod:
+                        split = colsub.row().split(percentage=0.15)
+                        split.label(text="File:")
+                        split.label(text=mod.__file__)
                     if info["author"]:
                         split = colsub.row().split(percentage=0.15)
                         split.label(text="Author:")
diff --git a/release/scripts/startup/bl_ui/space_userpref_keymap.py b/release/scripts/startup/bl_ui/space_userpref_keymap.py
index 030e1ee..5869722 100644
--- a/release/scripts/startup/bl_ui/space_userpref_keymap.py
+++ b/release/scripts/startup/bl_ui/space_userpref_keymap.py
@@ -18,7 +18,7 @@
 
 # <pep8 compliant>
 import bpy
-from bpy.types import Menu, OperatorProperties
+from bpy.types import Menu
 
 
 class USERPREF_MT_keyconfigs(Menu):
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 93cec33..9cf5205 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -19,6 +19,7 @@
 # <pep8 compliant>
 import bpy
 from bpy.types import Header, Menu, Panel
+from bl_ui.properties_paint_common import UnifiedPaintPanel
 
 
 class VIEW3D_HT_header(Header):
@@ -51,6 +52,10 @@ class VIEW3D_HT_header(Header):
             elif obj:
                 if mode_string not in {'PAINT_TEXTURE'}:
                     sub.menu("VIEW3D_MT_%s" % mode_string.lower())
+                if mode_string in {'SCULPT', 'PAINT_VERTEX', 'PAINT_WEIGHT', 'PAINT_TEXTURE'}:
+                    sub.menu("VIEW3D_MT_brush")
+                if mode_string == 'SCULPT':
+                    sub.menu("VIEW3D_MT_hide")
             else:
                 sub.menu("VIEW3D_MT_object")
 
@@ -80,22 +85,23 @@ class VIEW3D_HT_header(Header):
                     row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
 
         # Snap
-        snap_element = toolsettings.snap_element
-        row = layout.row(align=True)
-        row.prop(toolsettings, "use_snap", text="")
-        row.prop(toolsettings, "snap_element", text="", icon_only=True)
-        if snap_element != 'INCREMENT':
-            row.prop(toolsettings, "snap_target", text="")
-            if obj:
-                if obj.mode == 'OBJECT':
-                    row.prop(toolsettings, "use_snap_align_rotation", text="")
-                elif obj.mode == 'EDIT':
-                    row.prop(toolsettings, "use_snap_self", text="")
-
-        if snap_element == 'VOLUME':
-            row.prop(toolsettings, "use_snap_peel_object", text="")
-        elif snap_element == 'FACE':
-            row.prop(toolsettings, "use_snap_project", text="")
+        if not obj or obj.mode not in {'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT'}:
+            snap_element = toolsettings.snap_element
+            row = layout.row(align=True)
+            row.prop(toolsettings, "use_snap", text="")
+            row.prop(toolsettings, "snap_element", text="", icon_only=True)
+            if snap_element != 'INCREMENT':
+                row.prop(toolsettings, "snap_target", text="")
+                if obj:
+                    if obj.mode == 'OBJECT' and snap_element != 'VOLUME':
+                        row.prop(toolsettings, "use_snap_align_rotation", text="")
+                    elif obj.mode == 'EDIT':
+                        row.prop(toolsettings, "use_snap_self", text="")
+
+            if snap_element == 'VOLUME':
+                row.prop(toolsettings, "use_snap_peel_object", text="")
+            elif snap_element == 'FACE':
+                row.prop(toolsettings, "use_snap_project", text="")
 
         # OpenGL render
         row = layout.row(align=True)
@@ -125,7 +131,7 @@ class ShowHideMenu():
         layout = self.layout
 
         layout.operator("%s.reveal" % self._operator_name, text="Show Hidden")
-        layout.operator("%s.hide" % self._operator_name, text="Hide Selected")
+        layout.operator("%s.hide" % self._operator_name, text="Hide Selected").unselected = False
         layout.operator("%s.hide" % self._operator_name, text="Hide Unselected").unselected = True
 
 
@@ -421,7 +427,7 @@ class VIEW3D_MT_select_object(Menu):
 
         layout.separator()
 
-        layout.operator("object.select_all", text="Select/Deselect All").action = 'TOGGLE'
+        layout.operator("object.select_all").action = 'TOGGLE'
         layout.operator("object.select_all", text="Inverse").action = 'INVERT'
         layout.operator("object.select_random", text="Random")
         layout.operator("object.select_mirror", text="Mirror")
@@ -446,7 +452,7 @@ class VIEW3D_MT_select_pose(Menu):
 
         layout.separator()
 
-        layout.operator("pose.select_all", text="Select/Deselect All").action = 'TOGGLE'
+        layout.operator("pose.select_all").action = 'TOGGLE'
         layout.operator("pose.select_all", text="Inverse").action = 'INVERT'
         layout.operator("pose.select_flip_active", text="Flip Active")
         layout.operator("pose.select_constraint_target", text="Constraint Target")
@@ -483,9 +489,9 @@ class VIEW3D_MT_select_particle(Menu):
 
         layout.separator()
 
-        layout.operator("particle.select_all", text="Select/Deselect All").action = 'TOGGLE'
+        layout.operator("particle.select_all").action = 'TOGGLE'
         layout.operator("particle.select_linked")
-        layout.operator("particle.select_all").action = 'INVERT'
+        layout.operator("particle.select_all", text="Inverse").action = 'INVERT'
 
         layout.separator()
 
@@ -509,7 +515,7 @@ class VIEW3D_MT_select_edit_mesh(Menu):
 
         layout.separator()
 
-        layout.operator("mesh.select_all", text="Select/Deselect All").action = 'TOGGLE'
+        layout.operator("mesh.select_all").action = 'TOGGLE'
         layout.operator("mesh.select_all", text="Inverse").action = 'INVERT'
 
         layout.separator()
@@ -518,16 +524,15 @@ class VIEW3D_MT_select_edit_mesh(Menu):
         layout.operator("mesh.select_nth", text="Every N Number of Verts")
         layout.operator("mesh.edges_select_sharp", text="Sharp Edges")
         layout.operator("mesh.faces_select_linked_flat", text="Linked Flat Faces")
-        layout.operator("mesh.faces_select_interior", text="Interior Faces")
+        layout.operator("mesh.select_interior_faces", text="Interior Faces")
         layout.operator("mesh.select_axis", text="Side of Active")
 
         layout.separator()
 
-        layout.operator("mesh.select_by_number_vertices", text="Triangles").type = 'TRIANGLES'
-        layout.operator("mesh.select_by_number_vertices", text="Quads").type = 'QUADS'
+        layout.operator("mesh.select_by_number_vertices", 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_by_number_vertices", text="Loose Verts/Edges").type = 'OTHER'
+        layout.operator("mesh.select_loose_verts", text="Loose Verts/Edges")
         layout.operator("mesh.select_similar", text="Similar")
 
         layout.separator()
@@ -561,7 +566,7 @@ class VIEW3D_MT_select_edit_curve(Menu):
 
         layout.separator()
 
-        layout.operator("curve.select_all", text="Select/Deselect All").action = 'TOGGLE'
+        layout.operator("curve.select_all").action = 'TOGGLE'
         layout.operator("curve.select_all", text="Inverse").action = 'INVERT'
         layout.operator("curve.select_random")
         layout.operator("curve.select_nth", text="Every Nth Number of Points")
@@ -590,7 +595,7 @@ class VIEW3D_MT_select_edit_surface(Menu):
 
         layout.separator()
 
-        layout.operator("curve.select_all", text="Select/Deselect All").action = 'TOGGLE'
+        layout.operator("curve.select_all").action = 'TOGGLE'
         layout.operator("curve.select_all", text="Inverse").action = 'INVERT'
         layout.operator("curve.select_random")
         layout.operator("curve.select_nth", text="Every Nth Number of Points")
@@ -616,7 +621,7 @@ class VIEW3D_MT_select_edit_metaball(Menu):
         layout.separator()
 
         layout.operator("mball.select_all").action = 'TOGGLE'
-        layout.operator("mball.select_all").action = 'INVERT'
+        layout.operator("mball.select_all", text="Inverse").action = 'INVERT'
 
         layout.separator()
 
@@ -633,7 +638,8 @@ class VIEW3D_MT_select_edit_lattice(Menu):
 
         layout.separator()
 
-        layout.operator("lattice.select_all", text="Select/Deselect All")
+        layout.operator("lattice.select_all").action = 'TOGGLE'
+        layout.operator("lattice.select_all", text="Inverse").action = 'INVERT'
 
 
 class VIEW3D_MT_select_edit_armature(Menu):
@@ -646,7 +652,7 @@ class VIEW3D_MT_select_edit_armature(Menu):
 
         layout.separator()
 
-        layout.operator("armature.select_all", text="Select/Deselect All").action = 'TOGGLE'
+        layout.operator("armature.select_all").action = 'TOGGLE'
         layout.operator("armature.select_all", text="Inverse").action = 'INVERT'
 
         layout.separator()
@@ -788,11 +794,17 @@ class VIEW3D_MT_object_specials(Menu):
                 props.data_path_iter = "selected_editable_objects"
                 props.data_path_item = "data.lens"
                 props.input_scale = 0.1
+                if obj.data.lens_unit == 'MILLIMETERS':
+                    props.header_text = "Camera Lens Angle: %.1fmm"
+                else:
+                    props.header_text = "Camera Lens Angle: %.1f\u00B0"
+
             else:
                 props = layout.operator("wm.context_modal_mouse", text="Camera Lens Scale")
                 props.data_path_iter = "selected_editable_objects"
                 props.data_path_item = "data.ortho_scale"
                 props.input_scale = 0.01
+                props.header_text = "Camera Lens Scale: %.3f"
 
             if not obj.data.dof_object:
                 #layout.label(text="Test Has DOF obj");
@@ -800,6 +812,7 @@ class VIEW3D_MT_object_specials(Menu):
                 props.data_path_iter = "selected_editable_objects"
                 props.data_path_item = "data.dof_distance"
                 props.input_scale = 0.02
+                props.header_text = "DOF Distance: %.3f"
 
         if obj.type in {'CURVE', 'FONT'}:
             layout.operator_context = 'INVOKE_REGION_WIN'
@@ -808,11 +821,13 @@ class VIEW3D_MT_object_specials(Menu):
             props.data_path_iter = "selected_editable_objects"
             props.data_path_item = "data.extrude"
             props.input_scale = 0.01
+            props.header_text = "Extrude Size: %.3f"
 
             props = layout.operator("wm.context_modal_mouse", text="Width Size")
             props.data_path_iter = "selected_editable_objects"
             props.data_path_item = "data.offset"
             props.input_scale = 0.01
+            props.header_text = "Width Size: %.3f"
 
         if obj.type == 'EMPTY':
             layout.operator_context = 'INVOKE_REGION_WIN'
@@ -821,6 +836,7 @@ class VIEW3D_MT_object_specials(Menu):
             props.data_path_iter = "selected_editable_objects"
             props.data_path_item = "empty_draw_size"
             props.input_scale = 0.01
+            props.header_text = "Empty Draw Size: %.3f"
 
         if obj.type == 'LAMP':
             layout.operator_context = 'INVOKE_REGION_WIN'
@@ -828,12 +844,14 @@ class VIEW3D_MT_object_specials(Menu):
             props = layout.operator("wm.context_modal_mouse", text="Energy")
             props.data_path_iter = "selected_editable_objects"
             props.data_path_item = "data.energy"
+            props.header_text = "Lamp Energy: %.3f"
 
             if obj.data.type in {'SPOT', 'AREA', 'POINT'}:
                 props = layout.operator("wm.context_modal_mouse", text="Falloff Distance")
                 props.data_path_iter = "selected_editable_objects"
                 props.data_path_item = "data.distance"
                 props.input_scale = 0.1
+                props.header_text = "Lamp Falloff Distance: %.1f"
 
             if obj.data.type == 'SPOT':
                 layout.separator()
@@ -841,21 +859,25 @@ class VIEW3D_MT_object_specials(Menu):
                 props.data_path_iter = "selected_editable_objects"
                 props.data_path_item = "data.spot_size"
                 props.input_scale = 0.01
+                props.header_text = "Spot Size: %.2f"
 
                 props = layout.operator("wm.context_modal_mouse", text="Spot Blend")
                 props.data_path_iter = "selected_editable_objects"
                 props.data_path_item = "data.spot_blend"
                 props.input_scale = -0.01
+                props.header_text = "Spot Blend: %.2f"
 
                 props = layout.operator("wm.context_modal_mouse", text="Clip Start")
                 props.data_path_iter = "selected_editable_objects"
                 props.data_path_item = "data.shadow_buffer_clip_start"
                 props.input_scale = 0.05
+                props.header_text = "Clip Start: %.2f"
 
                 props = layout.operator("wm.context_modal_mouse", text="Clip End")
                 props.data_path_iter = "selected_editable_objects"
                 props.data_path_item = "data.shadow_buffer_clip_end"
                 props.input_scale = 0.05
+                props.header_text = "Clip End: %.2f"
 
         layout.separator()
 
@@ -1014,6 +1036,73 @@ class VIEW3D_MT_object_game(Menu):
         layout.operator("object.game_property_clear")
 
 
+# ********** Brush menu **********
+class VIEW3D_MT_brush(Menu):
+    bl_label = "Brush"
+
+    def draw(self, context):
+        layout = self.layout
+
+        settings = UnifiedPaintPanel.paint_settings(context)
+        brush = settings.brush
+
+        ups = context.tool_settings.unified_paint_settings
+        layout.prop(ups, "use_unified_size", text="Unified Size")
+        layout.prop(ups, "use_unified_strength", text="Unified Strength")
+        layout.separator()
+
+        # brush paint modes
+        layout.menu("VIEW3D_MT_brush_paint_modes")
+
+        # brush tool
+        if context.sculpt_object:
+            layout.operator("brush.reset")
+            layout.prop_menu_enum(brush, "sculpt_tool")
+        elif context.image_paint_object:
+            layout.prop_menu_enum(brush, "image_tool")
+        elif context.vertex_paint_object or context.weight_paint_object:
+            layout.prop_menu_enum(brush, "vertex_tool")
+
+        # skip if no active brush
+        if not brush:
+            return
+
+        # TODO: still missing a lot of brush options here
+
+        # sculpt options
+        if context.sculpt_object:
+
+            sculpt_tool = brush.sculpt_tool
+
+            layout.separator()
+            layout.operator_menu_enum("brush.curve_preset", "shape", text='Curve Preset')
+            layout.separator()
+
+            if sculpt_tool != 'GRAB':
+                layout.prop_menu_enum(brush, "stroke_method")
+
+                if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
+                    layout.prop_menu_enum(brush, "direction")
+
+                if sculpt_tool == 'LAYER':
+                    layout.prop(brush, "use_persistent")
+                    layout.operator("sculpt.set_persistent_base")
+
+
+class VIEW3D_MT_brush_paint_modes(Menu):
+    bl_label = "Enabled Modes"
+
+    def draw(self, context):
+        layout = self.layout
+
+        settings = UnifiedPaintPanel.paint_settings(context)
+        brush = settings.brush
+
+        layout.prop(brush, "use_paint_sculpt", text="Sculpt")
+        layout.prop(brush, "use_paint_vertex", text="Vertex Paint")
+        layout.prop(brush, "use_paint_weight", text="Weight Paint")
+        layout.prop(brush, "use_paint_image", text="Texture Paint")
+
 # ********** Vertex paint menu **********
 
 
@@ -1099,6 +1188,7 @@ class VIEW3D_MT_paint_weight(Menu):
         layout.operator("object.vertex_group_invert", text="Invert")
         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_fix", text="Fix Deforms")
 
         layout.separator()
@@ -1116,7 +1206,6 @@ class VIEW3D_MT_sculpt(Menu):
 
         toolsettings = context.tool_settings
         sculpt = toolsettings.sculpt
-        brush = toolsettings.sculpt.brush
 
         layout.operator("ed.undo")
         layout.operator("ed.redo")
@@ -1130,30 +1219,32 @@ class VIEW3D_MT_sculpt(Menu):
         layout.prop(sculpt, "lock_x")
         layout.prop(sculpt, "lock_y")
         layout.prop(sculpt, "lock_z")
+
         layout.separator()
-        layout.operator_menu_enum("brush.curve_preset", "shape")
-        layout.separator()
+        layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
+        layout.prop(sculpt, "show_low_resolution")
+        layout.prop(sculpt, "show_brush")
+        layout.prop(sculpt, "use_deform_only")
 
-        if brush is not None:  # unlikely but can happen
-            sculpt_tool = brush.sculpt_tool
 
-            if sculpt_tool != 'GRAB':
-                layout.prop_menu_enum(brush, "stroke_method")
+class VIEW3D_MT_hide(Menu):
+    bl_label = "Hide"
 
-                if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
-                    layout.prop_menu_enum(brush, "direction")
+    def draw(self, context):
+        layout = self.layout
 
-                if sculpt_tool == 'LAYER':
-                    layout.prop(brush, "use_persistent")
-                    layout.operator("sculpt.set_persistent_base")
+        op = layout.operator("paint.hide_show", text="Show All")
+        op.action = 'SHOW'
+        op.area = 'ALL'
 
-        layout.separator()
-        layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
-        layout.prop(sculpt, "show_brush")
+        op = layout.operator("paint.hide_show", text="Hide Bounding Box")
+        op.action = 'HIDE'
+        op.area = 'INSIDE'
+
+        op = layout.operator("paint.hide_show", text="Show Bounding Box")
+        op.action = 'SHOW'
+        op.area = 'INSIDE'
 
-        # TODO, make available from paint menu!
-        layout.prop(toolsettings, "sculpt_paint_use_unified_size", text="Unify Size")
-        layout.prop(toolsettings, "sculpt_paint_use_unified_strength", text="Unify Strength")
 
 # ********** Particle menu **********
 
@@ -1478,7 +1569,8 @@ class VIEW3D_MT_edit_mesh(Menu):
         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")
-        layout.operator("mesh.delete", text="Delete...")
+        layout.menu("VIEW3D_MT_edit_mesh_delete")
+        layout.menu("VIEW3D_MT_edit_mesh_dissolve")
 
         layout.separator()
 
@@ -1510,12 +1602,14 @@ class VIEW3D_MT_edit_mesh_specials(Menu):
         layout.operator("mesh.subdivide", text="Subdivide Smooth").smoothness = 1.0
         layout.operator("mesh.merge", text="Merge...")
         layout.operator("mesh.remove_doubles")
-        layout.operator("mesh.hide", text="Hide")
+        layout.operator("mesh.hide", text="Hide").unselected = False
         layout.operator("mesh.reveal", text="Reveal")
-        layout.operator("mesh.select_all").action = 'INVERT'
+        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.bevel", text="Bevel")
+        layout.operator("mesh.inset")
+        layout.operator("mesh.bevel", text="Bevel")
+        layout.operator("mesh.bridge_edge_loops")
         layout.operator("mesh.faces_shade_smooth")
         layout.operator("mesh.faces_shade_flat")
         layout.operator("mesh.blend_from_shape")
@@ -1588,7 +1682,9 @@ class VIEW3D_MT_edit_mesh_vertices(Menu):
         layout.operator("mesh.merge")
         layout.operator("mesh.rip_move")
         layout.operator("mesh.split")
-        layout.operator("mesh.separate")
+        layout.operator_menu_enum("mesh.separate", "type")
+        layout.operator("mesh.vert_connect")
+        layout.operator("mesh.vert_slide")
 
         layout.separator()
 
@@ -1637,6 +1733,12 @@ class VIEW3D_MT_edit_mesh_edges(Menu):
 
         layout.separator()
 
+        layout.operator("mesh.bevel")
+        layout.operator("mesh.edge_split")
+        layout.operator("mesh.bridge_edge_loops")
+
+        layout.separator()
+
         layout.operator("TRANSFORM_OT_edge_slide")
         layout.operator("TRANSFORM_OT_edge_crease")
         layout.operator("mesh.loop_multi_select", text="Edge Loop").ring = False
@@ -1659,24 +1761,18 @@ class VIEW3D_MT_edit_mesh_faces(Menu):
         layout.operator_context = 'INVOKE_REGION_WIN'
 
         layout.operator("mesh.flip_normals")
-        # layout.operator("mesh.bevel")
-        # layout.operator("mesh.bevel")
         layout.operator("mesh.edge_face_add")
         layout.operator("mesh.fill")
         layout.operator("mesh.beautify_fill")
+        layout.operator("mesh.inset")
+        layout.operator("mesh.bevel")
         layout.operator("mesh.solidify")
         layout.operator("mesh.sort_faces")
 
         layout.separator()
 
-        layout.operator("mesh.fgon_make")
-        layout.operator("mesh.fgon_clear")
-
-        layout.separator()
-
         layout.operator("mesh.quads_convert_to_tris")
         layout.operator("mesh.tris_convert_to_quads")
-        layout.operator("mesh.edge_flip")
 
         layout.separator()
 
@@ -1693,9 +1789,9 @@ class VIEW3D_MT_edit_mesh_faces(Menu):
         layout.separator()
 
         layout.operator_menu_enum("mesh.uvs_rotate", "direction")
-        layout.operator_menu_enum("mesh.uvs_mirror", "axis")
+        layout.operator("mesh.uvs_reverse")
         layout.operator_menu_enum("mesh.colors_rotate", "direction")
-        layout.operator_menu_enum("mesh.colors_mirror", "axis")
+        layout.operator("mesh.colors_reverse")
 
 
 class VIEW3D_MT_edit_mesh_normals(Menu):
@@ -1712,6 +1808,38 @@ class VIEW3D_MT_edit_mesh_normals(Menu):
         layout.operator("mesh.flip_normals")
 
 
+class VIEW3D_MT_edit_mesh_delete(Menu):
+    bl_label = "Delete"
+
+    def draw(self, context):
+        layout = self.layout
+
+        layout.operator_enum("mesh.delete", "type")
+
+        layout.separator()
+
+        layout.operator("mesh.dissolve")
+        layout.operator("mesh.edge_collapse")
+        layout.operator("mesh.delete_edgeloop")
+
+
+class VIEW3D_MT_edit_mesh_dissolve(Menu):
+    bl_label = "Dissolve"
+
+    def draw(self, context):
+        layout = self.layout
+
+        layout.operator("mesh.dissolve")
+
+        layout.separator()
+
+        layout.operator_enum("mesh.dissolve", "type")
+
+        layout.separator()
+
+        layout.operator("mesh.dissolve_limited")
+
+
 class VIEW3D_MT_edit_mesh_showhide(ShowHideMenu, Menu):
     _operator_name = "mesh"
 
@@ -1908,7 +2036,7 @@ class VIEW3D_MT_edit_meta_showhide(Menu):
         layout = self.layout
 
         layout.operator("mball.reveal_metaelems", text="Show Hidden")
-        layout.operator("mball.hide_metaelems", text="Hide Selected")
+        layout.operator("mball.hide_metaelems", text="Hide Selected").unselected = False
         layout.operator("mball.hide_metaelems", text="Hide Unselected").unselected = True
 
 
@@ -2050,14 +2178,18 @@ class VIEW3D_PT_view3d_properties(Panel):
         view = context.space_data
 
         col = layout.column()
-        col.active = view.region_3d.view_perspective != 'CAMERA'
+        col.active = bool(view.region_3d.view_perspective != 'CAMERA' or
+                          view.region_quadview)
         col.prop(view, "lens")
         col.label(text="Lock to Object:")
         col.prop(view, "lock_object", text="")
         lock_object = view.lock_object
         if lock_object:
             if lock_object.type == 'ARMATURE':
-                col.prop_search(view, "lock_bone", lock_object.data, "edit_bones" if lock_object.mode == 'EDIT' else "bones", text="")
+                col.prop_search(view, "lock_bone", lock_object.data,
+                                "edit_bones" if lock_object.mode == 'EDIT'
+                                             else "bones",
+                                text="")
         else:
             col.prop(view, "lock_cursor", text="Lock to Cursor")
 
@@ -2246,9 +2378,10 @@ class VIEW3D_PT_view3d_meshdisplay(Panel):
 
         col.separator()
         col.label(text="Normals:")
-        col.prop(mesh, "show_normal_face", text="Face")
-        col.prop(mesh, "show_normal_vertex", text="Vertex")
-        col.prop(context.scene.tool_settings, "normal_size", text="Normal Size")
+        row = col.row(align=True)
+        row.prop(mesh, "show_normal_vertex", text="", icon='VERTEXSEL')
+        row.prop(mesh, "show_normal_face", text="", icon='FACESEL')
+        row.prop(context.scene.tool_settings, "normal_size", text="Size")
 
         col.separator()
         col.label(text="Numerics:")
@@ -2352,10 +2485,12 @@ class VIEW3D_PT_background_image(Panel):
                     column.prop(bg.clip_user, "use_render_undistorted")
 
                 if has_bg:
-                    box.prop(bg, "opacity", slider=True)
+                    col = box.column()
+                    col.prop(bg, "show_on_foreground")
+                    col.prop(bg, "opacity", slider=True)
                     if bg.view_axis != 'CAMERA':
-                        box.prop(bg, "size")
-                        row = box.row(align=True)
+                        col.prop(bg, "size")
+                        row = col.row(align=True)
                         row.prop(bg, "offset_x", text="X")
                         row.prop(bg, "offset_y", text="Y")
 
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 5171a6d..c494590 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -19,7 +19,7 @@
 # <pep8 compliant>
 import bpy
 from bpy.types import Menu, Panel
-from .properties_paint_common import UnifiedPaintPanel
+from bl_ui.properties_paint_common import UnifiedPaintPanel
 
 
 class View3DPanel():
@@ -142,9 +142,17 @@ class VIEW3D_PT_tools_meshedit(View3DPanel, Panel):
         col.operator("mesh.spin")
         col.operator("mesh.screw")
 
+        row = col.row(align=True)
+        props = row.operator("mesh.knife_tool", text="Knife")
+        props.use_occlude_geometry = True
+        props.only_select = False
+        props = row.operator("mesh.knife_tool", text="Select")
+        props.use_occlude_geometry = False
+        props.only_select = True
+
         col = layout.column(align=True)
         col.label(text="Remove:")
-        col.operator("mesh.delete")
+        col.menu("VIEW3D_MT_edit_mesh_delete")
         col.operator("mesh.merge")
         col.operator("mesh.remove_doubles")
 
@@ -198,6 +206,8 @@ class VIEW3D_PT_tools_meshedit_options(View3DPanel, Panel):
         col.label("Edge Select Mode:")
         col.prop(tool_settings, "edge_path_mode", text="")
         col.prop(tool_settings, "edge_path_live_unwrap")
+        col.label("Double Threshold:")
+        col.prop(tool_settings, "double_threshold", text="")
 
 # ********** default tools for editmode_curve ****************
 
@@ -500,7 +510,7 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
         # Sculpt Mode #
 
         elif context.sculpt_object and brush:
-            tool = brush.sculpt_tool
+            capabilities = brush.sculpt_capabilities
 
             col = layout.column()
 
@@ -519,47 +529,43 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
 
             self.prop_unified_size(row, context, brush, "use_pressure_size")
 
-            if tool not in {'SNAKE_HOOK', 'GRAB', 'ROTATE'}:
+            # strength, use_strength_pressure, and use_strength_attenuation
+            if capabilities.has_strength:
                 col.separator()
-
                 row = col.row(align=True)
 
-                if brush.use_space and tool != 'SMOOTH':
-                    if brush.use_space_atten:
-                        row.prop(brush, "use_space_atten", toggle=True, text="", icon='LOCKED')
+                if capabilities.has_space_attenuation:
+                    if brush.use_space_attenuation:
+                        row.prop(brush, "use_space_attenuation", toggle=True, text="", icon='LOCKED')
                     else:
-                        row.prop(brush, "use_space_atten", toggle=True, text="", icon='UNLOCKED')
+                        row.prop(brush, "use_space_attenuation", toggle=True, text="", icon='UNLOCKED')
 
                 self.prop_unified_strength(row, context, brush, "strength", text="Strength")
                 self.prop_unified_strength(row, context, brush, "use_pressure_strength")
 
-            if tool == 'ROTATE':
-                row = col.row(align=True)
-                self.prop_unified_strength(row, context, brush, "strength", text="Strength")
-                self.prop_unified_strength(row, context, brush, "use_pressure_strength")
-
-            if tool != 'SMOOTH':
+            # auto_smooth_factor and use_inverse_smooth_pressure
+            if capabilities.has_auto_smooth:
                 col.separator()
 
                 row = col.row(align=True)
                 row.prop(brush, "auto_smooth_factor", slider=True)
                 row.prop(brush, "use_inverse_smooth_pressure", toggle=True, text="")
 
-            if tool in {'GRAB', 'SNAKE_HOOK'}:
+            # normal_weight
+            if capabilities.has_normal_weight:
                 col.separator()
-
                 row = col.row(align=True)
                 row.prop(brush, "normal_weight", slider=True)
 
-            if tool in {'CREASE', 'BLOB'}:
+            # crease_pinch_factor
+            if capabilities.has_pinch_factor:
                 col.separator()
-
                 row = col.row(align=True)
                 row.prop(brush, "crease_pinch_factor", slider=True, text="Pinch")
 
-            if tool not in {'PINCH', 'INFLATE', 'SMOOTH'}:
+            # use_original_normal and sculpt_plane
+            if capabilities.has_sculpt_plane:
                 row = col.row(align=True)
-
                 col.separator()
 
                 if brush.use_original_normal:
@@ -569,8 +575,8 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
 
                 row.prop(brush, "sculpt_plane", text="")
 
-            #if tool in {'CLAY', 'CLAY_TUBES', 'FLATTEN', 'FILL', 'SCRAPE'}:
-            if tool in {'CLAY', 'FLATTEN', 'FILL', 'SCRAPE'}:
+            # plane_offset, use_offset_pressure, use_plane_trim, plane_trim
+            if capabilities.has_plane_offset:
                 row = col.row(align=True)
                 row.prop(brush, "plane_offset", slider=True)
                 row.prop(brush, "use_offset_pressure", text="")
@@ -583,24 +589,28 @@ class VIEW3D_PT_tools_brush(Panel, View3DPaintPanel):
                 row.active = brush.use_plane_trim
                 row.prop(brush, "plane_trim", slider=True, text="Distance")
 
-            if tool == 'LAYER':
+            # height
+            if capabilities.has_height:
                 row = col.row()
                 row.prop(brush, "height", slider=True, text="Height")
 
+            # use_frontface
             col.separator()
-
             row = col.row()
             row.prop(brush, "use_frontface", text="Front Faces Only")
 
+            # direction
             col.separator()
             col.row().prop(brush, "direction", expand=True)
 
-            if tool in {'DRAW', 'CREASE', 'BLOB', 'INFLATE', 'LAYER', 'CLAY'}:
+            # use_accumulate
+            if capabilities.has_accumulate:
                 col.separator()
 
                 col.prop(brush, "use_accumulate")
 
-            if tool == 'LAYER':
+            # use_persistent, set_persistent_base
+            if capabilities.has_persistence:
                 col.separator()
 
                 ob = context.sculpt_object
@@ -714,7 +724,7 @@ class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel):
             col = layout.column()
             col.active = tex_slot.map_mode in {'FIXED'}
             col.label(text="Angle:")
-            if not brush.use_anchor and brush.sculpt_tool not in {'GRAB', 'SNAKE_HOOK', 'THUMB', 'ROTATE'} and tex_slot.map_mode in {'FIXED'}:
+            if brush.sculpt_capabilities.has_random_texture_angle:
                 col.prop(brush, "texture_angle_source_random", text="")
             else:
                 col.prop(brush, "texture_angle_source_no_random", text="")
@@ -733,10 +743,6 @@ class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel):
             col.active = tex_slot.map_mode in {'FIXED', 'TILED'}
             col.prop(tex_slot, "angle", text="")
 
-            #col = layout.column()
-            #col.prop(brush, "use_random_rotation")
-            #col.active = (not brush.use_rake) and (not brush.use_anchor) and (brush.sculpt_tool not in {'GRAB', 'SNAKE_HOOK', 'THUMB', 'ROTATE'}) and tex_slot.map_mode in {'FIXED'}
-
             split = layout.split()
             split.prop(tex_slot, "offset")
             split.prop(tex_slot, "scale")
@@ -759,40 +765,6 @@ class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel):
             sub.prop(brush, "texture_overlay_alpha", text="Alpha")
 
 
-class VIEW3D_PT_tools_brush_tool(Panel, View3DPaintPanel):
-    bl_label = "Tool"
-    bl_options = {'DEFAULT_CLOSED'}
-
-    @classmethod
-    def poll(cls, context):
-        settings = cls.paint_settings(context)
-        return (settings and settings.brush and
-            (context.sculpt_object or context.image_paint_object or
-            context.vertex_paint_object or context.weight_paint_object))
-
-    def draw(self, context):
-        layout = self.layout
-
-        settings = self.paint_settings(context)
-        brush = settings.brush
-
-        col = layout.column(align=True)
-
-        if context.sculpt_object:
-            col.prop(brush, "sculpt_tool", expand=False, text="")
-            col.operator("brush.reset")
-        elif context.image_paint_object:
-            col.prop(brush, "image_tool", expand=False, text="")
-        elif context.vertex_paint_object or context.weight_paint_object:
-            col.prop(brush, "vertex_tool", expand=False, text="")
-
-        row = layout.row(align=True)
-        row.prop(brush, "use_paint_sculpt", text="", icon='SCULPTMODE_HLT')
-        row.prop(brush, "use_paint_vertex", text="", icon='VPAINT_HLT')
-        row.prop(brush, "use_paint_weight", text="", icon='WPAINT_HLT')
-        row.prop(brush, "use_paint_image", text="", icon='TPAINT_HLT')
-
-
 class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
     bl_label = "Stroke"
     bl_options = {'DEFAULT_CLOSED'}
@@ -832,7 +804,7 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
                 row.active = brush.use_space
                 row.prop(brush, "spacing", text="Spacing")
 
-            if (brush.sculpt_tool not in {'GRAB', 'THUMB', 'SNAKE_HOOK', 'ROTATE'}) and (not brush.use_anchor) and (not brush.use_restore_mesh):
+            if brush.sculpt_capabilities.has_smooth_stroke:
                 col = layout.column()
                 col.separator()
 
@@ -843,6 +815,7 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
                 sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
                 sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
 
+            if brush.sculpt_capabilities.has_jitter:
                 col.separator()
 
                 row = col.row(align=True)
@@ -869,21 +842,13 @@ class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
             col.separator()
 
             col = layout.column()
-            col.active = (not brush.use_anchor) and (brush.sculpt_tool not in {'GRAB', 'THUMB', 'ROTATE', 'SNAKE_HOOK'})
+            col.active = brush.sculpt_capabilities.has_spacing
             col.prop(brush, "use_space")
 
             row = col.row()
             row.active = brush.use_space
             row.prop(brush, "spacing", text="Spacing")
 
-            #col.prop(brush, "use_space_atten", text="Adaptive Strength")
-            #col.prop(brush, "use_adaptive_space", text="Adaptive Spacing")
-
-            #col.separator()
-
-            #if image_paint:
-            #    row.prop(brush, "use_pressure_spacing", toggle=True, text="")
-
 
 class VIEW3D_PT_tools_brush_curve(Panel, View3DPaintPanel):
     bl_label = "Curve"
@@ -989,8 +954,7 @@ class VIEW3D_PT_tools_brush_appearance(Panel, View3DPaintPanel):
         col = layout.column()
 
         if context.sculpt_object and context.tool_settings.sculpt:
-            #if brush.sculpt_tool in {'DRAW', 'INFLATE', 'CLAY', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN', 'FILL', 'SCRAPE', 'CLAY_TUBES'}:
-            if brush.sculpt_tool in {'DRAW', 'INFLATE', 'CLAY', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN', 'FILL', 'SCRAPE'}:
+            if brush.sculpt_capabilities.has_secondary_color:
                 col.prop(brush, "cursor_color_add", text="Add Color")
                 col.prop(brush, "cursor_color_subtract", text="Subtract Color")
             else:
@@ -1023,6 +987,7 @@ class VIEW3D_PT_tools_weightpaint(View3DPanel, Panel):
         col.operator("object.vertex_group_invert", text="Invert")
         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_fix", text="Fix Deforms")
 
 
@@ -1133,13 +1098,15 @@ class VIEW3D_PT_tools_projectpaint(View3DPanel, Panel):
 
         row = split.row()
         row.active = (ipaint.use_stencil_layer)
-        row.menu("VIEW3D_MT_tools_projectpaint_stencil", text=mesh.uv_texture_stencil.name)
+        stencil_text = mesh.uv_texture_stencil.name if mesh.uv_texture_stencil else ""
+        row.menu("VIEW3D_MT_tools_projectpaint_stencil", text=stencil_text)
         row.prop(ipaint, "invert_stencil", text="", icon='IMAGE_ALPHA')
 
         row = layout.row()
         row.active = (settings.brush.image_tool == 'CLONE')
-        row.prop(ipaint, "use_clone_layer", text="Layer")
-        row.menu("VIEW3D_MT_tools_projectpaint_clone", text=mesh.uv_texture_clone.name)
+        row.prop(ipaint, "use_clone_layer", text="Clone")
+        clone_text = mesh.uv_texture_clone.name if mesh.uv_texture_clone else ""
+        row.menu("VIEW3D_MT_tools_projectpaint_clone", text=clone_text)
 
         layout.prop(ipaint, "seam_bleed")
 
diff --git a/release/scripts/startup/keyingsets_builtins.py b/release/scripts/startup/keyingsets_builtins.py
index 1caf7c4..b769388 100644
--- a/release/scripts/startup/keyingsets_builtins.py
+++ b/release/scripts/startup/keyingsets_builtins.py
@@ -38,8 +38,20 @@ from bpy.types import KeyingSetInfo
 # Built-In KeyingSets
 
 
+# "Defines"
+# Keep these in sync with those in ED_keyframing.h!
+ANIM_KS_LOCATION_ID = "Location"
+ANIM_KS_ROTATION_ID = "Rotation"
+ANIM_KS_SCALING_ID = "Scaling"
+ANIM_KS_LOC_ROT_SCALE_ID = "LocRotScale"
+ANIM_KS_AVAILABLE_ID = "Available"
+ANIM_KS_WHOLE_CHARACTER_ID = "WholeCharacter"
+
+
 # Location
 class BUILTIN_KSI_Location(KeyingSetInfo):
+    """Insert a keyframe on each of the location channels"""
+    bl_idname = ANIM_KS_LOCATION_ID
     bl_label = "Location"
 
     # poll - use predefined callback for selected bones/objects
@@ -54,6 +66,8 @@ class BUILTIN_KSI_Location(KeyingSetInfo):
 
 # Rotation
 class BUILTIN_KSI_Rotation(KeyingSetInfo):
+    """Insert a keyframe on each of the rotation channels"""
+    bl_idname = ANIM_KS_ROTATION_ID
     bl_label = "Rotation"
 
     # poll - use predefined callback for selected bones/objects
@@ -62,12 +76,14 @@ class BUILTIN_KSI_Rotation(KeyingSetInfo):
     # iterator - use callback for selected bones/objects
     iterator = keyingsets_utils.RKS_ITER_selected_item
 
-    # generator - use callback for location
+    # generator - use callback for rotation
     generate = keyingsets_utils.RKS_GEN_rotation
 
 
 # Scale
 class BUILTIN_KSI_Scaling(KeyingSetInfo):
+    """Insert a keyframe on each of the scale channels"""
+    bl_idname = ANIM_KS_SCALING_ID
     bl_label = "Scaling"
 
     # poll - use predefined callback for selected bones/objects
@@ -76,7 +92,7 @@ class BUILTIN_KSI_Scaling(KeyingSetInfo):
     # iterator - use callback for selected bones/objects
     iterator = keyingsets_utils.RKS_ITER_selected_item
 
-    # generator - use callback for location
+    # generator - use callback for scaling
     generate = keyingsets_utils.RKS_GEN_scaling
 
 # ------------
@@ -84,6 +100,7 @@ class BUILTIN_KSI_Scaling(KeyingSetInfo):
 
 # LocRot
 class BUILTIN_KSI_LocRot(KeyingSetInfo):
+    """Insert a keyframe on each of the location and rotation channels"""
     bl_label = "LocRot"
 
     # poll - use predefined callback for selected bones/objects
@@ -102,6 +119,7 @@ class BUILTIN_KSI_LocRot(KeyingSetInfo):
 
 # LocScale
 class BUILTIN_KSI_LocScale(KeyingSetInfo):
+    """Insert a keyframe on each of the location and scale channels"""
     bl_label = "LocScale"
 
     # poll - use predefined callback for selected bones/objects
@@ -120,6 +138,10 @@ class BUILTIN_KSI_LocScale(KeyingSetInfo):
 
 # LocRotScale
 class BUILTIN_KSI_LocRotScale(KeyingSetInfo):
+    """
+    Insert a keyframe on each of the location, rotation, and scale channels
+    """
+    bl_idname = ANIM_KS_LOC_ROT_SCALE_ID
     bl_label = "LocRotScale"
 
     # poll - use predefined callback for selected bones/objects
@@ -140,6 +162,7 @@ class BUILTIN_KSI_LocRotScale(KeyingSetInfo):
 
 # RotScale
 class BUILTIN_KSI_RotScale(KeyingSetInfo):
+    """Insert a keyframe on each of the rotation and scale channels"""
     bl_label = "RotScale"
 
     # poll - use predefined callback for selected bones/objects
@@ -160,6 +183,10 @@ class BUILTIN_KSI_RotScale(KeyingSetInfo):
 
 # Location
 class BUILTIN_KSI_VisualLoc(KeyingSetInfo):
+    """
+    Insert a keyframe on each of the location channels, taking into account
+    effects of constraints and relationships
+    """
     bl_label = "Visual Location"
 
     bl_options = {'INSERTKEY_VISUAL'}
@@ -176,6 +203,10 @@ class BUILTIN_KSI_VisualLoc(KeyingSetInfo):
 
 # Rotation
 class BUILTIN_KSI_VisualRot(KeyingSetInfo):
+    """
+    Insert a keyframe on each of the rotation channels, taking into account
+    effects of constraints and relationships
+    """
     bl_label = "Visual Rotation"
 
     bl_options = {'INSERTKEY_VISUAL'}
@@ -192,6 +223,10 @@ class BUILTIN_KSI_VisualRot(KeyingSetInfo):
 
 # VisualLocRot
 class BUILTIN_KSI_VisualLocRot(KeyingSetInfo):
+    """
+    Insert a keyframe on each of the location and rotation channels,
+    taking into account effects of constraints and relationships
+    """
     bl_label = "Visual LocRot"
 
     bl_options = {'INSERTKEY_VISUAL'}
@@ -214,6 +249,8 @@ class BUILTIN_KSI_VisualLocRot(KeyingSetInfo):
 
 # Available
 class BUILTIN_KSI_Available(KeyingSetInfo):
+    """Insert a keyframe on each of the already existing F-Curves"""
+    bl_idname = ANIM_KS_AVAILABLE_ID
     bl_label = "Available"
 
     # poll - selected objects or selected object with animation data
@@ -236,6 +273,11 @@ class BUILTIN_KSI_Available(KeyingSetInfo):
 
 # All properties that are likely to get animated in a character rig
 class BUILTIN_KSI_WholeCharacter(KeyingSetInfo):
+    """
+    Insert a keyframe for all properties that are likely to get animated in a
+    character rig (useful when blocking out a shot)
+    """
+    bl_idname = ANIM_KS_WHOLE_CHARACTER_ID
     bl_label = "Whole Character"
 
     # these prefixes should be avoided, as they are not really bones
@@ -379,6 +421,7 @@ class BUILTIN_KSI_WholeCharacter(KeyingSetInfo):
 
 # Delta Location
 class BUILTIN_KSI_DeltaLocation(KeyingSetInfo):
+    """Insert keyframes for additional location offset"""
     bl_label = "Delta Location"
 
     # poll - selected objects only (and only if active object in object mode)
@@ -404,6 +447,7 @@ class BUILTIN_KSI_DeltaLocation(KeyingSetInfo):
 
 # Delta Rotation
 class BUILTIN_KSI_DeltaRotation(KeyingSetInfo):
+    """Insert keyframes for additional rotation offset"""
     bl_label = "Delta Rotation"
 
     # poll - selected objects only (and only if active object in object mode)
@@ -437,6 +481,7 @@ class BUILTIN_KSI_DeltaRotation(KeyingSetInfo):
 
 # Delta Scale
 class BUILTIN_KSI_DeltaScale(KeyingSetInfo):
+    """Insert keyframes for additional scaling factor"""
     bl_label = "Delta Scale"
 
     # poll - selected objects only (and only if active object in object mode)
diff --git a/release/scripts/templates/addon_add_object.py b/release/scripts/templates/addon_add_object.py
index 1fc74ff..3900f59 100644
--- a/release/scripts/templates/addon_add_object.py
+++ b/release/scripts/templates/addon_add_object.py
@@ -1,6 +1,6 @@
 bl_info = {
     "name": "New Object",
-    "author": "YourNameHere",
+    "author": "Your Name Here",
     "version": (1, 0),
     "blender": (2, 5, 5),
     "location": "View3D > Add > Mesh > New Object",
@@ -12,8 +12,9 @@ bl_info = {
 
 
 import bpy
+from bpy.types import Operator
 from bpy.props import FloatVectorProperty
-from add_utils import AddObjectHelper, add_object_data
+from bpy_extras.object_utils import AddObjectHelper, object_data_add
 from mathutils import Vector
 
 
@@ -30,14 +31,14 @@ def add_object(self, context):
     edges = []
     faces = [[0, 1, 2, 3]]
 
-    mesh = bpy.data.meshes.new(name='New Object Mesh')
+    mesh = bpy.data.meshes.new(name="New Object Mesh")
     mesh.from_pydata(verts, edges, faces)
     # useful for development when the mesh may be invalid.
     # mesh.validate(verbose=True)
-    add_object_data(context, mesh, operator=self)
+    object_data_add(context, mesh, operator=self)
 
 
-class OBJECT_OT_add_object(bpy.types.Operator, AddObjectHelper):
+class OBJECT_OT_add_object(Operator, AddObjectHelper):
     """Add a Mesh Object"""
     bl_idname = "mesh.add_object"
     bl_label = "Add Mesh Object"
@@ -45,10 +46,10 @@ class OBJECT_OT_add_object(bpy.types.Operator, AddObjectHelper):
     bl_options = {'REGISTER', 'UNDO'}
 
     scale = FloatVectorProperty(
-            name='scale',
+            name="scale",
             default=(1.0, 1.0, 1.0),
             subtype='TRANSLATION',
-            description='scaling',
+            description="scaling",
             )
 
     def execute(self, context):
@@ -77,5 +78,5 @@ def unregister():
     bpy.types.INFO_MT_mesh_add.remove(add_object_button)
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     register()
diff --git a/release/scripts/templates/bmesh_simple.py b/release/scripts/templates/bmesh_simple.py
new file mode 100644
index 0000000..656febf
--- /dev/null
+++ b/release/scripts/templates/bmesh_simple.py
@@ -0,0 +1,21 @@
+# This example assumes we have a mesh object selected
+
+import bpy
+import bmesh
+
+# Get the active mesh
+me = bpy.context.object.data
+
+
+# Get a BMesh representation
+bm = bmesh.new()   # create an empty BMesh
+bm.from_mesh(me)   # fill it in from a Mesh
+
+
+# Modify the BMesh, can do anything here...
+for v in bm.verts:
+    v.co.x += 1.0
+
+
+# Finish up, write the bmesh back to the mesh
+bm.to_mesh(me)
diff --git a/release/scripts/templates/gamelogic_basic.py b/release/scripts/templates/gamelogic_simple.py
similarity index 100%
rename from release/scripts/templates/gamelogic_basic.py
rename to release/scripts/templates/gamelogic_simple.py
diff --git a/release/scripts/templates/operator_export.py b/release/scripts/templates/operator_export.py
deleted file mode 100644
index 3a7040a..0000000
--- a/release/scripts/templates/operator_export.py
+++ /dev/null
@@ -1,75 +0,0 @@
-import bpy
-
-
-def write_some_data(context, filepath, use_some_setting):
-    print("running write_some_data...")
-    f = open(filepath, 'w')
-    f.write("Hello World %s" % use_some_setting)
-    f.close()
-
-    return {'FINISHED'}
-
-
-# ExportHelper is a helper class, defines filename and
-# invoke() function which calls the file selector.
-from bpy_extras.io_utils import ExportHelper
-from bpy.props import StringProperty, BoolProperty, EnumProperty
-
-
-class ExportSomeData(bpy.types.Operator, ExportHelper):
-    '''This appears in the tooltip of the operator and in the generated docs.'''
-    bl_idname = "export.some_data"  # this is important since its how bpy.ops.export.some_data is constructed
-    bl_label = "Export Some Data"
-
-    # ExportHelper mixin class uses this
-    filename_ext = ".txt"
-
-    filter_glob = StringProperty(
-            default="*.txt",
-            options={'HIDDEN'},
-            )
-
-    # List of operator properties, the attributes will be assigned
-    # to the class instance from the operator settings before calling.
-    use_setting = BoolProperty(
-            name="Example Boolean",
-            description="Example Tooltip",
-            default=True,
-            )
-
-    type = EnumProperty(
-            name="Example Enum",
-            description="Choose between two items",
-            items=(('OPT_A', "First Option", "Description one"),
-                   ('OPT_B', "Second Option", "Description two")),
-            default='OPT_A',
-            )
-
-    @classmethod
-    def poll(cls, context):
-        return context.active_object is not None
-
-    def execute(self, context):
-        return write_some_data(context, self.filepath, self.use_setting)
-
-
-# Only needed if you want to add into a dynamic menu
-def menu_func_export(self, context):
-    self.layout.operator(ExportSomeData.bl_idname, text="Text Export Operator")
-
-
-def register():
-    bpy.utils.register_class(ExportSomeData)
-    bpy.types.INFO_MT_file_export.append(menu_func_export)
-
-
-def unregister():
-    bpy.utils.unregister_class(ExportSomeData)
-    bpy.types.INFO_MT_file_export.remove(menu_func_export)
-
-
-if __name__ == "__main__":
-    register()
-
-    # test call
-    bpy.ops.export.some_data('INVOKE_DEFAULT')
diff --git a/release/scripts/templates/operator_file_export.py b/release/scripts/templates/operator_file_export.py
new file mode 100644
index 0000000..e3e0217
--- /dev/null
+++ b/release/scripts/templates/operator_file_export.py
@@ -0,0 +1,72 @@
+import bpy
+
+
+def write_some_data(context, filepath, use_some_setting):
+    print("running write_some_data...")
+    f = open(filepath, 'w', encoding='utf-8')
+    f.write("Hello World %s" % use_some_setting)
+    f.close()
+
+    return {'FINISHED'}
+
+
+# ExportHelper is a helper class, defines filename and
+# invoke() function which calls the file selector.
+from bpy_extras.io_utils import ExportHelper
+from bpy.props import StringProperty, BoolProperty, EnumProperty
+from bpy.types import Operator
+
+
+class ExportSomeData(Operator, ExportHelper):
+    '''This appears in the tooltip of the operator and in the generated docs'''
+    bl_idname = "export_test.some_data"  # important since its how bpy.ops.import_test.some_data is constructed
+    bl_label = "Export Some Data"
+
+    # ExportHelper mixin class uses this
+    filename_ext = ".txt"
+
+    filter_glob = StringProperty(
+            default="*.txt",
+            options={'HIDDEN'},
+            )
+
+    # List of operator properties, the attributes will be assigned
+    # to the class instance from the operator settings before calling.
+    use_setting = BoolProperty(
+            name="Example Boolean",
+            description="Example Tooltip",
+            default=True,
+            )
+
+    type = EnumProperty(
+            name="Example Enum",
+            description="Choose between two items",
+            items=(('OPT_A', "First Option", "Description one"),
+                   ('OPT_B', "Second Option", "Description two")),
+            default='OPT_A',
+            )
+
+    def execute(self, context):
+        return write_some_data(context, self.filepath, self.use_setting)
+
+
+# Only needed if you want to add into a dynamic menu
+def menu_func_export(self, context):
+    self.layout.operator(ExportSomeData.bl_idname, text="Text Export Operator")
+
+
+def register():
+    bpy.utils.register_class(ExportSomeData)
+    bpy.types.INFO_MT_file_export.append(menu_func_export)
+
+
+def unregister():
+    bpy.utils.unregister_class(ExportSomeData)
+    bpy.types.INFO_MT_file_export.remove(menu_func_export)
+
+
+if __name__ == "__main__":
+    register()
+
+    # test call
+    bpy.ops.export_test.some_data('INVOKE_DEFAULT')
diff --git a/release/scripts/templates/operator_file_import.py b/release/scripts/templates/operator_file_import.py
new file mode 100644
index 0000000..80d850a
--- /dev/null
+++ b/release/scripts/templates/operator_file_import.py
@@ -0,0 +1,75 @@
+import bpy
+
+
+def read_some_data(context, filepath, use_some_setting):
+    print("running read_some_data...")
+    f = open(filepath, 'r', encoding='utf-8')
+    data = f.read()
+    f.close()
+
+    # would normally load the data here
+    print(data)
+
+    return {'FINISHED'}
+
+
+# ImportHelper is a helper class, defines filename and
+# invoke() function which calls the file selector.
+from bpy_extras.io_utils import ImportHelper
+from bpy.props import StringProperty, BoolProperty, EnumProperty
+from bpy.types import Operator
+
+
+class ImportSomeData(Operator, ImportHelper):
+    '''This appears in the tooltip of the operator and in the generated docs'''
+    bl_idname = "import_test.some_data"  # important since its how bpy.ops.import_test.some_data is constructed
+    bl_label = "Import Some Data"
+
+    # ImportHelper mixin class uses this
+    filename_ext = ".txt"
+
+    filter_glob = StringProperty(
+            default="*.txt",
+            options={'HIDDEN'},
+            )
+
+    # List of operator properties, the attributes will be assigned
+    # to the class instance from the operator settings before calling.
+    use_setting = BoolProperty(
+            name="Example Boolean",
+            description="Example Tooltip",
+            default=True,
+            )
+
+    type = EnumProperty(
+            name="Example Enum",
+            description="Choose between two items",
+            items=(('OPT_A', "First Option", "Description one"),
+                   ('OPT_B', "Second Option", "Description two")),
+            default='OPT_A',
+            )
+
+    def execute(self, context):
+        return read_some_data(context, self.filepath, self.use_setting)
+
+
+# Only needed if you want to add into a dynamic menu
+def menu_func_import(self, context):
+    self.layout.operator(ImportSomeData.bl_idname, text="Text Import Operator")
+
+
+def register():
+    bpy.utils.register_class(ImportSomeData)
+    bpy.types.INFO_MT_file_import.append(menu_func_import)
+
+
+def unregister():
+    bpy.utils.unregister_class(ImportSomeData)
+    bpy.types.INFO_MT_file_import.remove(menu_func_import)
+
+
+if __name__ == "__main__":
+    register()
+
+    # test call
+    bpy.ops.import_test.some_data('INVOKE_DEFAULT')
diff --git a/release/scripts/templates/operator_mesh_add.py b/release/scripts/templates/operator_mesh_add.py
index d89b7e8..3228e3c 100644
--- a/release/scripts/templates/operator_mesh_add.py
+++ b/release/scripts/templates/operator_mesh_add.py
@@ -1,4 +1,5 @@
 import bpy
+import bmesh
 
 
 def add_box(width, height, depth):
@@ -7,31 +8,29 @@ def add_box(width, height, depth):
     no actual mesh data creation is done here.
     """
 
-    vertices = [1.0, 1.0, -1.0,
-                1.0, -1.0, -1.0,
-                -1.0, -1.0, -1.0,
-                -1.0, 1.0, -1.0,
-                1.0, 1.0, 1.0,
-                1.0, -1.0, 1.0,
-                -1.0, -1.0, 1.0,
-                -1.0, 1.0, 1.0,
-                ]
-
-    faces = [0, 1, 2, 3,
-             4, 7, 6, 5,
-             0, 4, 5, 1,
-             1, 5, 6, 2,
-             2, 6, 7, 3,
-             4, 0, 3, 7,
+    verts = [(+1.0, +1.0, -1.0),
+             (+1.0, -1.0, -1.0),
+             (-1.0, -1.0, -1.0),
+             (-1.0, +1.0, -1.0),
+             (+1.0, +1.0, +1.0),
+             (+1.0, -1.0, +1.0),
+             (-1.0, -1.0, +1.0),
+             (-1.0, +1.0, +1.0),
+             ]
+
+    faces = [(0, 1, 2, 3),
+             (4, 7, 6, 5),
+             (0, 4, 5, 1),
+             (1, 5, 6, 2),
+             (2, 6, 7, 3),
+             (4, 0, 3, 7),
             ]
 
     # apply size
-    for i in range(0, len(vertices), 3):
-        vertices[i] *= width
-        vertices[i + 1] *= depth
-        vertices[i + 2] *= height
+    for i, v in enumerate(verts):
+        verts[i] = v[0] * width, v[1] * depth, v[2] * height
 
-    return vertices, faces
+    return verts, faces
 
 
 from bpy.props import FloatProperty, BoolProperty, FloatVectorProperty
@@ -85,11 +84,15 @@ class AddBox(bpy.types.Operator):
 
         mesh = bpy.data.meshes.new("Box")
 
-        mesh.vertices.add(len(verts_loc) // 3)
-        mesh.faces.add(len(faces) // 4)
+        bm = bmesh.new()
 
-        mesh.vertices.foreach_set("co", verts_loc)
-        mesh.faces.foreach_set("vertices_raw", faces)
+        for v_co in verts_loc:
+            bm.verts.new(v_co)
+
+        for f_idx in faces:
+            bm.faces.new([bm.verts[i] for i in f_idx])
+
+        bm.to_mesh(mesh)
         mesh.update()
 
         # add the mesh as an object into the scene with this utility module
diff --git a/release/scripts/templates/ui_panel_simple.py b/release/scripts/templates/ui_panel_simple.py
index cde6126..6226240 100644
--- a/release/scripts/templates/ui_panel_simple.py
+++ b/release/scripts/templates/ui_panel_simple.py
@@ -2,6 +2,7 @@ import bpy
 
 
 class HelloWorldPanel(bpy.types.Panel):
+    """Creates a Panel in the Object properties window"""
     bl_label = "Hello World Panel"
     bl_idname = "OBJECT_PT_hello"
     bl_space_type = "PROPERTIES"
diff --git a/release/text/readme.html b/release/text/readme.html
index a9f5e70..78ee25b 100644
--- a/release/text/readme.html
+++ b/release/text/readme.html
@@ -12,18 +12,18 @@
   </style>
 </head>
 <body>
-<p class="title"><b>Blender 2.62</b></p>
+<p class="title"><b>Blender 2.63</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, Solaris and FreeBSD and has a large world-wide community.</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.62</b></p>
-<p class="body">The Blender Foundation and online developer community is proud to present Blender 2.62. This release is the third official stable release of the Blender 2.6 series, in which we will refine the 2.5 series and add exciting new features again.<a href="http://www.blender.org/development/release-logs/blender-262/">More information about this release</a>.</p>
+<p class="header"><b>2.63</b></p>
+<p class="body">The Blender Foundation and online developer community is proud to present Blender 2.63. This release is the fourth 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-263/">More information about this release</a>.</p>
 <p><br></p>
 <p class="header"><b>Bugs</b></p>
-<p class="body">Although Blender 2.62 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.63 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>
@@ -33,25 +33,25 @@
 <p><br></p>
 <p class="header"><b>Installation</b></p>
 <p class="body"><b>Windows: </b>The download .zip contains a Blender folder. You may put this anywhere on your hard drive. To launch Blender, double-click on Blender.exe.</p>
-<p class="body"><b>Linux, FreeBSD, Solaris: </b>Unpack the archive, Then run the Blender executable.</p>
+<p class="body"><b>Linux, FreeBSD: </b>Unpack the archive, Then run the Blender executable.</p>
 <p class="body"><b>Mac OS X: </b>The downloaded package includes blender.app. Optionally copy this to your Applications folder, and add it to the dock by dragging it from there to the dock.</p>
 <p></p>
 <p class="body"><b>Installing Addons (all systems)</b> Addons can be installed from the user preferences addons section, download an addon as a .py or .zip file, then press the "Install Addon" button and select the file to install it.</p>
 <p><br></p>
 <p class="header"><b>Getting Started</b></p>
-<p class="body">When opening Blender, you’ll see large 3D view in the center, a Toolbar on the left, a Properties area and an Outliner area on the right and a Timeline at the bottom.</p>
+<p class="body">When opening Blender, you’ll see large 3D view in the center, a Toolbar on the left, a Properties editor and an Outliner on the right and a Timeline at the bottom.</p>
 <p class="body">Orbit around in the 3D view by holding the middle mouse button and dragging. Alternatively, hold the alt key and drag the left mouse button. Additionally, hold Shift to pan the view and Ctrl to zoom.</p>
 <p class="body">Select objects using the right mouse button. With the object selected, perform actions by clicking any of the tool buttons on the left, or make changes to its properties by altering any of the setting on the right.</p>
-<p class="body">For more information on how to use Blender, <a href="http://www.blender.org/education-help/">watch tutorials</a> or <a href="http://wiki.blender.org/index.php/Doc:Manual">read the manual</a>.</p>
+<p class="body">For more information on how to use Blender, <a href="http://www.blender.org/education-help/">watch tutorials</a> or <a href="http://wiki.blender.org/index.php/Doc:2.6/Manual">read the manual</a>.</p>
 <p><br></p>
 <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-262/">www.blender.org/development/release-logs/blender-262/</a><br>
+	Full release log 			<a href="http://www.blender.org/development/release-logs/blender-263/">www.blender.org/development/release-logs/blender-263/</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:Manual">wiki.blender.org/index.php/Doc:Manual</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>
-	IRC 				<a href="irc://irc.freenode.net/#blenderchat">#blenderchat on irc.freenode.net</a><br>
+	IRC 				<a href="irc://irc.freenode.net/#blenderchat">#blenderchat</a> or <a href="irc://irc.freenode.net/#blender">#blender</a> on irc.freenode.net<br>
 </p>
 <p class="body">Developers:</p>
 <p class="body">	Development				<a href="http://www.blender.org/development/">www.blender.org/development/</a><br>
diff --git a/release/windows/installer/00.sconsblender.nsi b/release/windows/installer/00.sconsblender.nsi
index eb9b662..f6e5b78 100644
--- a/release/windows/installer/00.sconsblender.nsi
+++ b/release/windows/installer/00.sconsblender.nsi
@@ -90,7 +90,6 @@ Function .onInit
 
   ${If} ${RunningX64}
     ${If} "[BITNESS]" == "32"
-    ${OrIf} "[BITNESS]" == "-mingw"
       StrCpy $INSTDIR "$PROGRAMFILES32\Blender Foundation\Blender" ; Can't use InstallDir inside Section
     ${ElseIf} "[BITNESS]" == "64"
       StrCpy $INSTDIR "$PROGRAMFILES64\Blender Foundation\Blender"
diff --git a/source/SConscript b/source/SConscript
index 0002cb4..cfb204c 100644
--- a/source/SConscript
+++ b/source/SConscript
@@ -9,5 +9,5 @@ if env['WITH_BF_GAMEENGINE']:
 if env['WITH_BF_PLAYER']:
     SConscript (['blenderplayer/bad_level_call_stubs/SConscript'])
 
-if env['OURPLATFORM'] in ('win64-vc', 'win32-vc', 'win32-mingw', 'linuxcross'):
+if env['OURPLATFORM'] in ('win64-vc', 'win32-vc', 'win32-mingw', 'linuxcross', 'win64-mingw'):
     SConscript (['icons/SConscript'])
diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt
index 21c6ad6..cb17a87 100644
--- a/source/blender/CMakeLists.txt
+++ b/source/blender/CMakeLists.txt
@@ -92,6 +92,7 @@ add_subdirectory(editors)
 add_subdirectory(windowmanager)
 add_subdirectory(blenkernel)
 add_subdirectory(blenlib)
+add_subdirectory(bmesh)
 add_subdirectory(render)
 add_subdirectory(blenfont)
 add_subdirectory(blenloader)
diff --git a/source/blender/SConscript b/source/blender/SConscript
index ea5101f..c3a7089 100644
--- a/source/blender/SConscript
+++ b/source/blender/SConscript
@@ -3,6 +3,7 @@ Import ('env')
 import sys
 
 SConscript(['avi/SConscript',
+            'bmesh/SConscript',
             'blenkernel/SConscript',
             'blenlib/SConscript',
             'blenloader/SConscript',
diff --git a/source/blender/avi/AVI_avi.h b/source/blender/avi/AVI_avi.h
index ea073f7..a579bf7 100644
--- a/source/blender/avi/AVI_avi.h
+++ b/source/blender/avi/AVI_avi.h
@@ -50,8 +50,8 @@
  *
  */
 
-#ifndef __AVI_H__
-#define __AVI_H__
+#ifndef __AVI_AVI_H__
+#define __AVI_AVI_H__
 
 #include "MEM_sys_types.h"
 #include <stdio.h> /* for FILE */
@@ -249,7 +249,7 @@ AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...);
 AviError AVI_close_compress (AviMovie *movie);
 
 /**
- * Choose a compression option for <movie>. Possible options are
+ * Choose a compression option for \<movie\>. Possible options are
  * AVI_OPTION_TYPE_MAIN, AVI_OPTION_TYPE_STRH, AVI_OPTION_TYPE_STRF
  */
 AviError AVI_set_compress_option (AviMovie *movie,
@@ -272,7 +272,7 @@ AviError AVI_set_compress_option (AviMovie *movie,
 #define AVI_OPTION_TYPE_STRF 2
 
 /**
- * Direct the streams <avist_type> to <movie>. Redirect <stream_num>
+ * Direct the streams \<avist_type\> to \<movie\>. Redirect \<stream_num\>
  * streams.
  */
 int AVI_get_stream (AviMovie *movie, int avist_type, int stream_num);
@@ -305,5 +305,5 @@ AviError AVI_write_frame (AviMovie *movie, int frame_num, ...);
 AviError AVI_print_error (AviError error);
 void AVI_set_debug (int mode);
 
-#endif /* __AVI_H__ */
+#endif /* __AVI_AVI_H__ */
 
diff --git a/source/blender/avi/intern/avi.c b/source/blender/avi/intern/avi.c
index c6fdd2e..59ce879 100644
--- a/source/blender/avi/intern/avi.c
+++ b/source/blender/avi/intern/avi.c
@@ -43,7 +43,9 @@
 #include "MEM_guardedalloc.h"
 #include "MEM_sys_types.h"
 
-#include "BLI_winstuff.h"
+#ifdef WIN32
+#  include "BLI_winstuff.h"
+#endif
 
 #include "AVI_avi.h"
 #include "avi_intern.h"
@@ -53,7 +55,7 @@
 static int AVI_DEBUG=0;
 static char DEBUG_FCC[4];
 
-#define DEBUG_PRINT(x) if(AVI_DEBUG) printf("AVI DEBUG: " x);
+#define DEBUG_PRINT(x) if (AVI_DEBUG) { printf("AVI DEBUG: " x); } (void)0
 
 /* local functions */
 char *fcc_to_char (unsigned int fcc);
@@ -197,13 +199,12 @@ AviError AVI_print_error (AviError in_error)
 
 	return in_error;
 }
-/*
+#if 0
 void AVI_set_debug (int mode)
 {
 	AVI_DEBUG= mode;
 }
-*/
-/*
+
 int AVI_is_avi (char *name)
 {
 	FILE *fp;
@@ -217,14 +218,15 @@ int AVI_is_avi (char *name)
 		!GET_FCC (fp) ||
 		GET_FCC (fp) != FCC("AVI ")) {
 		ret = 0;
-	} else {
+	}
+	else {
 		ret = 1;
 	}
 
 	fclose(fp);
 	return ret;
 }
-*/
+#endif
 
 int AVI_is_avi (const char *name)
 {
@@ -313,9 +315,11 @@ int AVI_is_avi (const char *name)
 				fcca == FCC ("RAW ") ||
 				fcca == 0) {
 				movie.streams[temp].format = AVI_FORMAT_AVI_RGB;
-			} else if (fcca == FCC ("mjpg")||fcca == FCC ("MJPG")) {
+			}
+			else if (fcca == FCC ("mjpg")||fcca == FCC ("MJPG")) {
 				movie.streams[temp].format = AVI_FORMAT_MJPEG;
-			} else {
+			}
+			else {
 				MEM_freeN(movie.streams);
 				fclose(movie.fp);
 				return 0;
@@ -380,10 +384,12 @@ int AVI_is_avi (const char *name)
 						fcca == FCC ("rgb ") ||
 						fcca == FCC ("RAW ") ||
 						fcca == 0 ) {
-					} else if ( fcca == FCC ("mjpg") || 
+					}
+					else if ( fcca == FCC ("mjpg") ||
 						fcca == FCC ("MJPG")) {
 							movie.streams[temp].format = AVI_FORMAT_MJPEG;
-					} else {
+					}
+					else {
 						MEM_freeN(movie.streams);
 						fclose(movie.fp);
 						return 0;
@@ -392,7 +398,8 @@ 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);
+		}
+		else fseek (movie.fp, movie.streams[temp].sf_size, SEEK_CUR);
 
 		/* Walk to the next LIST */		
 		while (GET_FCC (movie.fp) != FCC("LIST")) {
@@ -496,9 +503,11 @@ AviError AVI_open_movie (const char *name, AviMovie *movie)
 				fcca == FCC ("RAW ") ||
 				fcca == 0) {
 				movie->streams[temp].format = AVI_FORMAT_AVI_RGB;
-			} else if (fcca == FCC ("mjpg")||fcca == FCC ("MJPG")) {
+			}
+			else if (fcca == FCC ("mjpg")||fcca == FCC ("MJPG")) {
 				movie->streams[temp].format = AVI_FORMAT_MJPEG;
-			} else {
+			}
+			else {
 				return AVI_ERROR_COMPRESSION;
 			}
 		}
@@ -559,17 +568,20 @@ AviError AVI_open_movie (const char *name, AviMovie *movie)
 						fcca == FCC ("rgb ") ||
 						fcca == FCC ("RAW ") ||
 						fcca == 0 ) {
-					} else if ( fcca == FCC ("mjpg") || 
+					}
+					else if ( fcca == FCC ("mjpg") ||
 						fcca == FCC ("MJPG")) {
 							movie->streams[temp].format = AVI_FORMAT_MJPEG;
-					} else {
+					}
+					else {
 						return AVI_ERROR_COMPRESSION;
 					}
 				}
 
 			} 
 			if (j > 0) fseek (movie->fp, j, SEEK_CUR);
-		} else fseek (movie->fp, movie->streams[temp].sf_size, SEEK_CUR);
+		}
+		else fseek (movie->fp, movie->streams[temp].sf_size, SEEK_CUR);
 		
 		/* Walk to the next LIST */		
 		while (GET_FCC (movie->fp) != FCC("LIST")) {
@@ -596,7 +608,8 @@ AviError AVI_open_movie (const char *name, AviMovie *movie)
 				break;
 			else
 				fseek (movie->fp, size-4, SEEK_CUR);
-		} else {
+		}
+		else {
 			fseek (movie->fp, size, SEEK_CUR);
 		}
 		if (ftell(movie->fp) > movie->size) {
@@ -659,8 +672,8 @@ void *AVI_read_frame (AviMovie *movie, AviFormat format, int frame, int stream)
 	void *buffer;
 
 	/* Retrieve the record number of the desired frame in the index 
-		If a chunk has Size 0 we need to rewind to previous frame */
-	while(rewind && frame > -1) {
+	 * If a chunk has Size 0 we need to rewind to previous frame */
+	while (rewind && frame > -1) {
 		i=0;
 		cur_frame=-1;
 		rewind = 0;
@@ -671,7 +684,8 @@ void *AVI_read_frame (AviMovie *movie, AviFormat format, int frame, int stream)
 				if ((cur_frame == frame -1) && (movie->entries[i].Size == 0)) {
 					rewind = 1;
 					frame = frame -1;
-				} else {
+				}
+				else {
 					cur_frame++;
 				}
 			}
@@ -729,6 +743,7 @@ AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...)
 	int i;
 	int64_t header_pos1, header_pos2;
 	int64_t stream_pos1, stream_pos2;
+	int64_t junk_pos;
 
 	movie->type = AVI_MOVIE_WRITE;
 	movie->fp = fopen (name, "wb");
@@ -798,13 +813,14 @@ AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...)
 		movie->streams[i].sh.bottom = 0;
 
 		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) 
 										+ sizeof(AviMJPEGUnknown),"moviestreamformatL");
 				movie->streams[i].sf_size = sizeof(AviBitmapInfoHeader) + sizeof(AviMJPEGUnknown);
-			} else {
-*/
+			}
+			else {
+#endif
 			movie->streams[i].sf = MEM_mallocN (sizeof(AviBitmapInfoHeader),  "moviestreamformatS");
 			movie->streams[i].sf_size = sizeof(AviBitmapInfoHeader);
 
@@ -836,8 +852,10 @@ AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...)
 				tmp->f = 2;
 				tmp->g = 1;
 			}
-		} else if (movie->streams[i].sh.Type == FCC("auds")) {
-			;
+		}
+		else if (movie->streams[i].sh.Type == FCC("auds")) {
+			// pass
+		}
 */
 		}
 	}
@@ -884,9 +902,11 @@ AviError AVI_open_compress (char *name, AviMovie *movie, int streams, ...)
 		fseek (movie->fp, stream_pos2, SEEK_SET);
 	}
 
-	if (ftell(movie->fp) < 2024 - 8) {
+	junk_pos= ftell(movie->fp);
+
+	if (junk_pos < 2024 - 8) {
 		chunk.fcc = FCC("JUNK");
-		chunk.size = 2024-8-ftell(movie->fp);
+		chunk.size = 2024 - 8 - (int)junk_pos;
 
 		awrite (movie, &chunk, 1, sizeof(AviChunk), movie->fp, AVI_CHUNK);
 
diff --git a/source/blender/avi/intern/avi_intern.h b/source/blender/avi/intern/avi_intern.h
index 1530795..c8d54fe 100644
--- a/source/blender/avi/intern/avi_intern.h
+++ b/source/blender/avi/intern/avi_intern.h
@@ -29,8 +29,8 @@
  *  \ingroup avi
  */
 
-#ifndef AVI_INTERN_H
-#define AVI_INTERN_H
+#ifndef __AVI_INTERN_H__
+#define __AVI_INTERN_H__
 
 #include <stdio.h> /* for FILE */
 
diff --git a/source/blender/avi/intern/avirgb.c b/source/blender/avi/intern/avirgb.c
index 42a094b..8e5806c 100644
--- a/source/blender/avi/intern/avirgb.c
+++ b/source/blender/avi/intern/avirgb.c
@@ -94,7 +94,8 @@ void *avi_converter_from_avi_rgb (AviMovie *movie, int stream, unsigned char *bu
 		MEM_freeN (buffer);
 		
 		return buf;
-	} else {
+	}
+	else {
 		buf = MEM_mallocN (movie->header->Height * movie->header->Width * 3, "fromavirgbbuf");
 	
 		rowstride = movie->header->Width*3;
diff --git a/source/blender/avi/intern/endian.h b/source/blender/avi/intern/endian.h
index 7a443fa..3229f32 100644
--- a/source/blender/avi/intern/endian.h
+++ b/source/blender/avi/intern/endian.h
@@ -34,8 +34,8 @@
  */
 
 
-#ifndef AVI_ENDIAN_H
-#define AVI_ENDIAN_H
+#ifndef __ENDIAN_H__
+#define __ENDIAN_H__
 
 #include <stdio.h>
 #include "AVI_avi.h"
diff --git a/source/blender/avi/intern/mjpeg.c b/source/blender/avi/intern/mjpeg.c
index dab0b21..f6ebcab 100644
--- a/source/blender/avi/intern/mjpeg.c
+++ b/source/blender/avi/intern/mjpeg.c
@@ -159,7 +159,7 @@ static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsign
 	jpeg_create_decompress(&dinfo);
 	jpegmemsrcmgr_build(&dinfo, inBuffer, bufsize);
 	jpeg_read_header(&dinfo, TRUE);
-	if (dinfo.dc_huff_tbl_ptrs[0] == NULL){
+	if (dinfo.dc_huff_tbl_ptrs[0] == NULL) {
 		std_huff_tables(&dinfo);
 	}
 	dinfo.out_color_space = JCS_RGB;
@@ -181,13 +181,13 @@ static int Decode_JPEG(unsigned char *inBuffer, unsigned char *outBuffer, unsign
 
 	numbytes= 0;
 	jpeg_read_header(&dinfo, TRUE);
-	if (dinfo.dc_huff_tbl_ptrs[0] == NULL){
+	if (dinfo.dc_huff_tbl_ptrs[0] == NULL) {
 		std_huff_tables(&dinfo);
 	}
 
 	jpeg_start_decompress(&dinfo);
 	rowstride= dinfo.output_width*dinfo.output_components;
-	for (y= 0; y<dinfo.output_height; y++){
+	for (y= 0; y<dinfo.output_height; y++) {
 		jpeg_read_scanlines(&dinfo, (JSAMPARRAY) &outBuffer, 1);
 		outBuffer += rowstride;
 	}
@@ -251,7 +251,7 @@ static void Compress_JPEG(int quality, unsigned char *outbuffer, unsigned char *
 	jpeg_write_marker (&cinfo, JPEG_COM, marker, 60);
 
 	rowstride= cinfo.image_width*cinfo.input_components;
-	for (y = 0; y < cinfo.image_height; y++){
+	for (y = 0; y < cinfo.image_height; y++) {
 		jpeg_write_scanlines(&cinfo, (JSAMPARRAY) &inBuffer, 1);
 		inBuffer += rowstride;
 	}
@@ -301,7 +301,8 @@ static int check_and_decode_jpeg(unsigned char *inbuf, unsigned char *outbuf, in
 		MEM_freeN(tmpbuf);
 		
 		return ret;
-	} else {
+	}
+	else {
 		return Decode_JPEG(inbuf, outbuf, width, height, bufsize);
 	}
 }
@@ -329,7 +330,8 @@ static void check_and_compress_jpeg(int quality, unsigned char *outbuf, unsigned
 		Compress_JPEG(quality, outbuf, tmpbuf, jwidth, jheight, bufsize);
 
 		MEM_freeN(tmpbuf);
-	} else {
+	}
+	else {
 		Compress_JPEG(quality, outbuf, inbuf, width, height, bufsize);
 	}
 }
@@ -369,7 +371,8 @@ void *avi_converter_to_mjpeg (AviMovie *movie, int stream, unsigned char *buffer
 	buf = MEM_mallocN (movie->header->Height * movie->header->Width * 3, "avi.avi_converter_to_mjpeg 1");	
 	if (!movie->interlace) {
 		check_and_compress_jpeg(movie->streams[stream].sh.Quality/100, buf, buffer,  movie->header->Width, movie->header->Height, bufsize);
-	} else {
+	}
+	else {
 		deinterlace (movie->odd_fields, buf, buffer, movie->header->Width, movie->header->Height);
 		MEM_freeN (buffer);
 	
diff --git a/source/blender/avi/intern/options.c b/source/blender/avi/intern/options.c
index 483b708..a2fd756 100644
--- a/source/blender/avi/intern/options.c
+++ b/source/blender/avi/intern/options.c
@@ -34,12 +34,13 @@
  *  \ingroup avi
  */
 
-
 #include "AVI_avi.h"
 #include "avi_intern.h"
 #include "endian.h"
 
-#include "BLI_winstuff.h"
+#ifdef WIN32
+#  include "BLI_winstuff.h"
+#endif
 
 /* avi_set_compress_options gets its own file... now don't WE feel important? */
 
diff --git a/source/blender/avi/intern/rgb32.c b/source/blender/avi/intern/rgb32.c
index e3be082..c6830d9 100644
--- a/source/blender/avi/intern/rgb32.c
+++ b/source/blender/avi/intern/rgb32.c
@@ -82,7 +82,7 @@ void *avi_converter_to_rgb32 (AviMovie *movie, int stream, unsigned char *buffer
 	to= buf; from= buffer;
 	i=movie->header->Height*movie->header->Width;
 	
-	while(i--) {
+	while (i--) {
 		memcpy(to, from, 3);
 		to+=4; from+=3;
 	}
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h
index a045f47..911a94c 100644
--- a/source/blender/blenfont/BLF_api.h
+++ b/source/blender/blenfont/BLF_api.h
@@ -29,8 +29,8 @@
  */
 
 
-#ifndef BLF_API_H
-#define BLF_API_H
+#ifndef __BLF_API_H__
+#define __BLF_API_H__
 
 struct rctf;
 
@@ -59,12 +59,12 @@ void BLF_size(int fontid, int size, int dpi);
  * to enable this.
  *
  * The order of the matrix is like GL:
-
-	| m[0]  m[4]  m[8]  m[12] |
-	| m[1]  m[5]  m[9]  m[13] |
-	| m[2]  m[6]  m[10] m[14] |
-	| m[3]  m[7]  m[11] m[15] |
-
+ *
+ *  | m[0]  m[4]  m[8]  m[12] |
+ *  | m[1]  m[5]  m[9]  m[13] |
+ *  | m[2]  m[6]  m[10] m[14] |
+ *  | m[3]  m[7]  m[11] m[15] |
+ *
  */
 void BLF_matrix(int fontid, const double m[16]);
 
@@ -76,61 +76,49 @@ void BLF_draw_default_ascii(float x, float y, float z, const char *str, size_t l
 void BLF_draw(int fontid, const char *str, size_t len);
 void BLF_draw_ascii(int fontid, const char *str, size_t len);
 
-/*
- * This function return the bounding box of the string
+/* This function return the bounding box of the string
  * and are not multiplied by the aspect.
  */
 void BLF_boundbox(int fontid, const char *str, struct rctf *box);
 
-/*
- * The next both function return the width and height
+/* The next both function return the width and height
  * of the string, using the current font and both value 
  * are multiplied by the aspect of the font.
  */
 float BLF_width(int fontid, const char *str);
 float BLF_height(int fontid, const char *str);
 
-/*
- * Return dimensions of the font without any sample text.
- */
+/* Return dimensions of the font without any sample text. */
 float BLF_height_max(int fontid);
 float BLF_width_max(int fontid);
 float BLF_descender(int fontid);
 float BLF_ascender(int fontid);
 
-/*
- * The following function return the width and height of the string, but
+/* The following function return the width and height of the string, but
  * just in one call, so avoid extra freetype2 stuff.
  */
 void BLF_width_and_height(int fontid, const char *str, float *width, float *height);
 
-/*
- * For fixed width fonts only, returns the width of a
+/* For fixed width fonts only, returns the width of a
  * character.
  */
 float BLF_fixed_width(int fontid);
 
-/*
- * and this two function return the width and height
+/* and this two function return the width and height
  * of the string, using the default font and both value
  * are multiplied by the aspect of the font.
  */
 float BLF_width_default(const char *str);
 float BLF_height_default(const char *str);
 
-/*
- * Set rotation for default font.
- */
+/* Set rotation for default font. */
 void BLF_rotation_default(float angle);
 
-/*
- * Enable/disable options to the default font.
- */
+/* Enable/disable options to the default font. */
 void BLF_enable_default(int option);
 void BLF_disable_default(int option);
 
-/*
- * By default, rotation and clipping are disable and
+/* By default, rotation and clipping are disable and
  * have to be enable/disable using BLF_enable/disable.
  */
 void BLF_rotation(int fontid, float angle);
@@ -141,39 +129,34 @@ void BLF_blur(int fontid, int size);
 void BLF_enable(int fontid, int option);
 void BLF_disable(int fontid, int option);
 
-/*
- * Shadow options, level is the blur level, can be 3, 5 or 0 and
+/* Shadow options, level is the blur level, can be 3, 5 or 0 and
  * the other argument are the rgba color.
- * Take care that shadow need to be enable using BLF_enable!!.
+ * Take care that shadow need to be enable using BLF_enable!!!
  */
 void BLF_shadow(int fontid, int level, float r, float g, float b, float a);
 
-/*
- * Set the offset for shadow text, this is the current cursor
+/* Set the offset for shadow text, this is the current cursor
  * position plus this offset, don't need call BLF_position before
  * this function, the current position is calculate only on
  * BLF_draw, so it's safe call this whenever you like.
  */
 void BLF_shadow_offset(int fontid, int x, int y);
 
-/*
- * Set the buffer, size and number of channels to draw, one thing to take care is call
+/* Set the buffer, size and number of channels to draw, one thing to take care is call
  * this function with NULL pointer when we finish, for example:
- *	BLF_buffer(my_fbuf, my_cbuf, 100, 100, 4);
  *
- *	... set color, position and draw ...
+ *     BLF_buffer(my_fbuf, my_cbuf, 100, 100, 4);
+ *
+ *     ... set color, position and draw ...
  *
- *	BLF_buffer(NULL, NULL, 0, 0, 0);
+ *     BLF_buffer(NULL, NULL, 0, 0, 0);
  */
 void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch);
 
-/*
- * Set the color to be used for text.
- */
+/* Set the color to be used for text. */
 void BLF_buffer_col(int fontid, float r, float g, float b, float a);
 
-/*
- * Draw the string into the buffer, this function draw in both buffer, float and unsigned char _BUT_
+/* Draw the string into the buffer, this function draw in both buffer, float and unsigned char _BUT_
  * it's not necessary set both buffer, NULL is valid here.
  */
 void BLF_draw_buffer(int fontid, const char *str);
@@ -200,8 +183,8 @@ void BLF_dir_free(char **dirs, int count);
 
 #define BLF_DRAW_STR_DUMMY_MAX 1024
 
-// XXX, bad design
+/* XXX, bad design */
 extern int blf_mono_font;
-extern int blf_mono_font_render; // dont mess drawing with render threads.
+extern int blf_mono_font_render; /* don't mess drawing with render threads. */
 
-#endif /* BLF_API_H */
+#endif /* __BLF_API_H__ */
diff --git a/source/blender/blenfont/BLF_translation.h b/source/blender/blenfont/BLF_translation.h
index ce53b76..2c786f8 100644
--- a/source/blender/blenfont/BLF_translation.h
+++ b/source/blender/blenfont/BLF_translation.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef BLF_TRANSLATION_H
-#define BLF_TRANSLATION_H
+#ifndef __BLF_TRANSLATION_H__
+#define __BLF_TRANSLATION_H__
 
 #define TEXT_DOMAIN_NAME "blender"
 
@@ -47,8 +47,7 @@ const char *BLF_pgettext(const char *context, const char *message);
 
 /* blf_lang.c */
 
-/*
- * Search the path directory to the locale files, this try all
+/* Search the path directory to the locale files, this try all
  * the case for Linux, Win and Mac.
  */
 void BLF_lang_init(void);
@@ -57,22 +56,45 @@ void BLF_lang_init(void);
 void BLF_lang_set(const char *);
 
 /* Set the current encoding name. */
-void BLF_lang_encoding_name(const char *str);
-
 void BLF_lang_encoding(const char *str);
 
 /* translation */
 int BLF_translate_iface(void);
 int BLF_translate_tooltips(void);
-const char *BLF_translate_do_iface(const char *msgid);
-const char *BLF_translate_do_tooltip(const char *msgid);
+const char *BLF_translate_do_iface(const char *contex, const char *msgid);
+const char *BLF_translate_do_tooltip(const char *contex, const char *msgid);
 
 
-/*#define _(msgid) BLF_gettext(msgid)*/
 /* The "translation-marker" macro. */
 #define N_(msgid) msgid
+#define CTX_N_(context, msgid) msgid
 /* Those macros should be used everywhere in UI code. */
-#define IFACE_(msgid) BLF_translate_do_iface(msgid)
-#define TIP_(msgid) BLF_translate_do_tooltip(msgid)
+#ifdef WITH_INTERNATIONAL
+/*	#define _(msgid) BLF_gettext(msgid) */
+	#define IFACE_(msgid) BLF_translate_do_iface(NULL, msgid)
+	#define TIP_(msgid) BLF_translate_do_tooltip(NULL, msgid)
+	#define CTX_IFACE_(context, msgid) BLF_translate_do_iface(context, msgid)
+	#define CTX_TIP_(context, msgid) BLF_translate_do_tooltip(context, msgid)
+#else
+/*	#define _(msgid) msgid */
+	#define IFACE_(msgid) msgid
+	#define TIP_(msgid) msgid
+	#define CTX_IFACE_(context, msgid) msgid
+	#define CTX_TIP_(context, msgid) msgid
+#endif
+
+/******************************************************************************
+ * All i18n contexts must be defined here.
+ * This is a nice way to be sure not to use a context twice for different
+ * things, and limit the number of existing contexts!
+ */
+
+/* Default, void context. Just in case... */
+#define BLF_I18NCONTEXT_DEFAULT ""
+
+/* Default context for operator names/labels. */
+#define BLF_I18NCONTEXT_OPERATOR_DEFAULT "Operator"
+
+
 
-#endif /* BLF_TRANSLATION_H */
+#endif /* __BLF_TRANSLATION_H__ */
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index a387b41..626c591 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -62,13 +62,13 @@
 static FontBLF *global_font[BLF_MAX_FONT] = {0};
 
 /* Default size and dpi, for BLF_draw_default. */
-static int global_font_default= -1;
-static int global_font_points= 11;
-static int global_font_dpi= 72;
+static int global_font_default = -1;
+static int global_font_points = 11;
+static int global_font_dpi = 72;
 
-// XXX, should these be made into global_font_'s too?
-int blf_mono_font= -1;
-int blf_mono_font_render= -1;
+/* XXX, should these be made into global_font_'s too? */
+int blf_mono_font = -1;
+int blf_mono_font_render = -1;
 
 static FontBLF *BLF_get(int fontid)
 {
@@ -81,11 +81,11 @@ int BLF_init(int points, int dpi)
 {
 	int i;
 
-	for (i= 0; i < BLF_MAX_FONT; i++)
-		global_font[i]= NULL;
+	for (i = 0; i < BLF_MAX_FONT; i++)
+		global_font[i] = NULL;
 
-	global_font_points= points;
-	global_font_dpi= dpi;
+	global_font_points = points;
+	global_font_dpi = dpi;
 	return blf_font_init();
 }
 
@@ -94,11 +94,11 @@ void BLF_exit(void)
 	FontBLF *font;
 	int i;
 
-	for (i= 0; i < BLF_MAX_FONT; i++) {
-		font= global_font[i];
+	for (i = 0; i < BLF_MAX_FONT; i++) {
+		font = global_font[i];
 		if (font) {
 			blf_font_free(font);
-			global_font[i]= NULL;
+			global_font[i] = NULL;
 		}
 	}
 
@@ -110,8 +110,8 @@ void BLF_cache_clear(void)
 	FontBLF *font;
 	int i;
 
-	for (i= 0; i < BLF_MAX_FONT; i++) {
-		font= global_font[i];
+	for (i = 0; i < BLF_MAX_FONT; i++) {
+		font = global_font[i];
 		if (font)
 			blf_glyph_cache_clear(font);
 	}
@@ -122,8 +122,8 @@ static int blf_search(const char *name)
 	FontBLF *font;
 	int i;
 
-	for (i= 0; i < BLF_MAX_FONT; i++) {
-		font= global_font[i];
+	for (i = 0; i < BLF_MAX_FONT; i++) {
+		font = global_font[i];
 		if (font && (!strcmp(font->name, name)))
 			return i;
 	}
@@ -135,8 +135,8 @@ static int blf_search_available(void)
 {
 	int i;
 
-	for (i= 0; i < BLF_MAX_FONT; i++)
-		if(!global_font[i])
+	for (i = 0; i < BLF_MAX_FONT; i++)
+		if (!global_font[i])
 			return i;
 	
 	return -1;
@@ -152,7 +152,7 @@ int BLF_load(const char *name)
 		return -1;
 
 	/* check if we already load this font. */
-	i= blf_search(name);
+	i = blf_search(name);
 	if (i >= 0) {
 		/*font= global_font[i];*/ /*UNUSED*/
 		return i;
@@ -164,13 +164,13 @@ int BLF_load(const char *name)
 		return -1;
 	}
 
-	filename= blf_dir_search(name);
+	filename = blf_dir_search(name);
 	if (!filename) {
 		printf("Can't find font: %s\n", name);
 		return -1;
 	}
 
-	font= blf_font_new(name, filename);
+	font = blf_font_new(name, filename);
 	MEM_freeN(filename);
 
 	if (!font) {
@@ -178,7 +178,7 @@ int BLF_load(const char *name)
 		return -1;
 	}
 
-	global_font[i]= font;
+	global_font[i] = font;
 	return i;
 }
 
@@ -200,13 +200,13 @@ int BLF_load_unique(const char *name)
 		return -1;
 	}
 
-	filename= blf_dir_search(name);
+	filename = blf_dir_search(name);
 	if (!filename) {
 		printf("Can't find font: %s\n", name);
 		return -1;
 	}
 
-	font= blf_font_new(name, filename);
+	font = blf_font_new(name, filename);
 	MEM_freeN(filename);
 
 	if (!font) {
@@ -214,13 +214,13 @@ int BLF_load_unique(const char *name)
 		return -1;
 	}
 
-	global_font[i]= font;
+	global_font[i] = font;
 	return i;
 }
 
 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);
@@ -235,7 +235,7 @@ int BLF_load_mem(const char *name, unsigned char *mem, int mem_size)
 	if (!name)
 		return -1;
 
-	i= blf_search(name);
+	i = blf_search(name);
 	if (i >= 0) {
 		/*font= global_font[i];*/ /*UNUSED*/
 		return i;
@@ -252,13 +252,13 @@ int BLF_load_mem(const char *name, unsigned char *mem, int mem_size)
 		return -1;
 	}
 
-	font= blf_font_new_from_mem(name, mem, mem_size);
+	font = blf_font_new_from_mem(name, mem, mem_size);
 	if (!font) {
 		printf("Can't load font: %s from memory!!\n", name);
 		return -1;
 	}
 
-	global_font[i]= font;
+	global_font[i] = font;
 	return i;
 }
 
@@ -285,13 +285,13 @@ int BLF_load_mem_unique(const char *name, unsigned char *mem, int mem_size)
 		return -1;
 	}
 
-	font= blf_font_new_from_mem(name, mem, mem_size);
+	font = blf_font_new_from_mem(name, mem, mem_size);
 	if (!font) {
 		printf("Can't load font: %s from memory!!\n", name);
 		return -1;
 	}
 
-	global_font[i]= font;
+	global_font[i] = font;
 	return i;
 }
 
@@ -300,19 +300,19 @@ void BLF_unload(const char *name)
 	FontBLF *font;
 	int i;
 
-	for (i= 0; i < BLF_MAX_FONT; i++) {
-		font= global_font[i];
+	for (i = 0; i < BLF_MAX_FONT; i++) {
+		font = global_font[i];
 
 		if (font && (!strcmp(font->name, name))) {
 			blf_font_free(font);
-			global_font[i]= NULL;
+			global_font[i] = NULL;
 		}
 	}
 }
 
 void BLF_enable(int fontid, int option)
 {
-	FontBLF *font= BLF_get(fontid);
+	FontBLF *font = BLF_get(fontid);
 
 	if (font) {
 		font->flags |= option;
@@ -321,7 +321,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;
@@ -330,7 +330,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;
@@ -339,7 +339,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;
@@ -348,18 +348,18 @@ 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;
-		font->aspect[1]= y;
-		font->aspect[2]= z;
+		font->aspect[0] = x;
+		font->aspect[1] = y;
+		font->aspect[2] = 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));
@@ -368,24 +368,24 @@ 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;
 		float remainder;
 
 		if (font->flags & BLF_ASPECT) {
-			xa= font->aspect[0];
-			ya= font->aspect[1];
-			za= font->aspect[2];
+			xa = font->aspect[0];
+			ya = font->aspect[1];
+			za = font->aspect[2];
 		}
 		else {
-			xa= 1.0f;
-			ya= 1.0f;
-			za= 1.0f;
+			xa = 1.0f;
+			ya = 1.0f;
+			za = 1.0f;
 		}
 
-		remainder= x - floorf(x);
+		remainder = x - floorf(x);
 		if (remainder > 0.4f && remainder < 0.6f) {
 			if (remainder < 0.5f)
 				x -= 0.1f * xa;
@@ -393,7 +393,7 @@ void BLF_position(int fontid, float x, float y, float z)
 				x += 0.1f * xa;
 		}
 
-		remainder= y - floorf(y);
+		remainder = y - floorf(y);
 		if (remainder > 0.4f && remainder < 0.6f) {
 			if (remainder < 0.5f)
 				y -= 0.1f * ya;
@@ -401,7 +401,7 @@ void BLF_position(int fontid, float x, float y, float z)
 				y += 0.1f * ya;
 		}
 
-		remainder= z - floorf(z);
+		remainder = z - floorf(z);
 		if (remainder > 0.4f && remainder < 0.6f) {
 			if (remainder < 0.5f)
 				z -= 0.1f * za;
@@ -409,15 +409,15 @@ void BLF_position(int fontid, float x, float y, float z)
 				z += 0.1f * za;
 		}
 
-		font->pos[0]= x;
-		font->pos[1]= y;
-		font->pos[2]= z;
+		font->pos[0] = x;
+		font->pos[1] = y;
+		font->pos[2] = 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);
@@ -426,10 +426,10 @@ 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;
+		font->blur = size;
 	}
 }
 
@@ -439,7 +439,7 @@ void BLF_draw_default(float x, float y, float z, const char *str, size_t len)
 		return;
 
 	if (global_font_default == -1)
-		global_font_default= blf_search("default");
+		global_font_default = blf_search("default");
 
 	if (global_font_default == -1) {
 		printf("Warning: Can't found default font!!\n");
@@ -458,7 +458,7 @@ void BLF_draw_default_ascii(float x, float y, float z, const char *str, size_t l
 		return;
 
 	if (global_font_default == -1)
-		global_font_default= blf_search("default");
+		global_font_default = blf_search("default");
 
 	if (global_font_default == -1) {
 		printf("Warning: Can't found default font!!\n");
@@ -472,10 +472,10 @@ 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;
+		font->angle = angle;
 	}
 }
 
@@ -511,11 +511,11 @@ static void blf_draw__start(FontBLF *font, GLint *mode, GLint *param)
 	if (font->flags & BLF_ROTATION)
 		glRotatef(font->angle, 0.0f, 0.0f, 1.0f);
 
-	if(font->shadow || font->blur)
+	if (font->shadow || font->blur)
 		glGetFloatv(GL_CURRENT_COLOR, font->orig_col);
 
 	/* always bind the texture for the first glyph */
-	font->tex_bind_state= -1;
+	font->tex_bind_state = -1;
 
 	/* Save the current parameter to restore it later. */
 	glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, param);
@@ -544,7 +544,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) {
@@ -556,7 +556,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) {
@@ -568,7 +568,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);
@@ -577,7 +577,7 @@ 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);
@@ -586,7 +586,7 @@ void BLF_width_and_height(int fontid, const char *str, float *width, float *heig
 
 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);
@@ -597,7 +597,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);
@@ -609,7 +609,7 @@ float BLF_fixed_width(int fontid)
 float BLF_width_default(const char *str)
 {
 	if (global_font_default == -1)
-		global_font_default= blf_search("default");
+		global_font_default = blf_search("default");
 
 	if (global_font_default == -1) {
 		printf("Error: Can't found default font!!\n");
@@ -622,7 +622,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);
@@ -633,7 +633,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;
@@ -644,7 +644,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;
@@ -655,7 +655,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;
@@ -666,7 +666,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;
@@ -678,7 +678,7 @@ float BLF_ascender(int fontid)
 float BLF_height_default(const char *str)
 {
 	if (global_font_default == -1)
-		global_font_default= blf_search("default");
+		global_font_default = blf_search("default");
 
 	if (global_font_default == -1) {
 		printf("Error: Can't found default font!!\n");
@@ -692,88 +692,88 @@ 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;
+		font->angle = 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;
-		font->clip_rec.ymin= ymin;
-		font->clip_rec.xmax= xmax;
-		font->clip_rec.ymax= ymax;
+		font->clip_rec.xmin = xmin;
+		font->clip_rec.ymin = ymin;
+		font->clip_rec.xmax = xmax;
+		font->clip_rec.ymax = 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;
-		font->clip_rec.ymin= ymin;
-		font->clip_rec.xmax= xmax;
-		font->clip_rec.ymax= ymax;
+		font->clip_rec.xmin = xmin;
+		font->clip_rec.ymin = ymin;
+		font->clip_rec.xmax = xmax;
+		font->clip_rec.ymax = 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;
-		font->shadow_col[0]= r;
-		font->shadow_col[1]= g;
-		font->shadow_col[2]= b;
-		font->shadow_col[3]= a;
+		font->shadow = level;
+		font->shadow_col[0] = r;
+		font->shadow_col[1] = g;
+		font->shadow_col[2] = b;
+		font->shadow_col[3] = 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;
-		font->shadow_y= y;
+		font->shadow_x = x;
+		font->shadow_y = y;
 	}
 }
 
 void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch)
 {
-	FontBLF *font= BLF_get(fontid);
+	FontBLF *font = BLF_get(fontid);
 
 	if (font) {
-		font->b_fbuf= fbuf;
-		font->b_cbuf= cbuf;
-		font->bw= w;
-		font->bh= h;
-		font->bch= nch;
+		font->b_fbuf = fbuf;
+		font->b_cbuf = cbuf;
+		font->bw = w;
+		font->bh = h;
+		font->bch = nch;
 	}
 }
 
 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->b_col[0]= r;
-		font->b_col[1]= g;
-		font->b_col[2]= b;
-		font->b_col[3]= a;
+		font->b_col[0] = r;
+		font->b_col[1] = g;
+		font->b_col[2] = b;
+		font->b_col[3] = 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->b_fbuf || font->b_cbuf)) {
 		blf_font_buffer(font, str);
diff --git a/source/blender/blenfont/intern/blf_dir.c b/source/blender/blenfont/intern/blf_dir.c
index b82393f..824f171 100644
--- a/source/blender/blenfont/intern/blf_dir.c
+++ b/source/blender/blenfont/intern/blf_dir.c
@@ -51,17 +51,17 @@
 #include "blf_internal_types.h"
 #include "blf_internal.h"
 
-static ListBase global_font_dir= { NULL, NULL };
+static ListBase global_font_dir = { NULL, NULL };
 
 static DirBLF *blf_dir_find(const char *path)
 {
 	DirBLF *p;
 	
-	p= global_font_dir.first;
+	p = global_font_dir.first;
 	while (p) {
 		if (BLI_path_cmp(p->path, path) == 0)
 			return p;
-		p= p->next;
+		p = p->next;
 	}
 	return NULL;
 }
@@ -70,12 +70,12 @@ void BLF_dir_add(const char *path)
 {
 	DirBLF *dir;
 	
-	dir= blf_dir_find(path);
+	dir = blf_dir_find(path);
 	if (dir) /* already in the list ? just return. */
 		return;
 	
-	dir= (DirBLF *)MEM_callocN(sizeof(DirBLF), "BLF_dir_add");
-	dir->path= BLI_strdup(path);
+	dir = (DirBLF *)MEM_callocN(sizeof(DirBLF), "BLF_dir_add");
+	dir->path = BLI_strdup(path);
 	BLI_addhead(&global_font_dir, dir);
 }
 
@@ -83,7 +83,7 @@ void BLF_dir_rem(const char *path)
 {
 	DirBLF *dir;
 	
-	dir= blf_dir_find(path);
+	dir = blf_dir_find(path);
 	if (dir) {
 		BLI_remlink(&global_font_dir, dir);
 		MEM_freeN(dir->path);
@@ -98,19 +98,19 @@ char **BLF_dir_get(int *ndir)
 	char *path;
 	int i, count;
 	
-	count= BLI_countlist(&global_font_dir);
+	count = BLI_countlist(&global_font_dir);
 	if (!count)
 		return NULL;
 	
-	dirs= (char **)MEM_callocN(sizeof(char *) * count, "BLF_dir_get");
-	p= global_font_dir.first;
-	i= 0;
+	dirs = (char **)MEM_callocN(sizeof(char *) * count, "BLF_dir_get");
+	p = global_font_dir.first;
+	i = 0;
 	while (p) {
-		path= BLI_strdup(p->path);
-		dirs[i]= path;
-		p= p->next;
+		path = BLI_strdup(p->path);
+		dirs[i] = path;
+		p = p->next;
 	}
-	*ndir= i;
+	*ndir = i;
 	return dirs;
 }
 
@@ -119,8 +119,8 @@ void BLF_dir_free(char **dirs, int count)
 	char *path;
 	int i;
 	
-	for (i= 0; i < count; i++) {
-		path= dirs[i];
+	for (i = 0; i < count; i++) {
+		path = dirs[i];
 		MEM_freeN(path);
 	}
 	MEM_freeN(dirs);
@@ -130,12 +130,12 @@ char *blf_dir_search(const char *file)
 {
 	DirBLF *dir;
 	char full_path[FILE_MAX];
-	char *s= NULL;
+	char *s = NULL;
 
-	for(dir=global_font_dir.first; dir; dir= dir->next) {
+	for (dir = global_font_dir.first; dir; dir = dir->next) {
 		BLI_join_dirfile(full_path, sizeof(full_path), dir->path, file);
 		if (BLI_exists(full_path)) {
-			s= BLI_strdup(full_path);
+			s = BLI_strdup(full_path);
 			break;
 		}
 	}
@@ -143,32 +143,32 @@ char *blf_dir_search(const char *file)
 	if (!s) {
 		/* check the current directory, why not ? */
 		if (BLI_exists(file))
-			s= BLI_strdup(file);
+			s = BLI_strdup(file);
 	}
 
 	return s;
 }
 
-#if 0 // UNUSED
+#if 0 /* UNUSED */
 int blf_dir_split(const char *str, char *file, int *size)
 {
 	int i, len;
 	char *s;
 	
 	/* Window, Linux or Mac, this is always / */
-	s= strrchr(str, '/');
+	s = strrchr(str, '/');
 	if (s) {
-		len= s - str;
-		for (i= 0; i < len; i++)
-			file[i]= str[i];
-
-		file[i]= '.';
-		file[i+1]= 't';
-		file[i+2]= 't';
-		file[i+3]= 'f';
-		file[i+4]= '\0';
+		len = s - str;
+		for (i = 0; i < len; i++)
+			file[i] = str[i];
+
+		file[i] = '.';
+		file[i+1] = 't';
+		file[i+2] = 't';
+		file[i+3] = 'f';
+		file[i+4] = '\0';
 		s++;
-		*size= atoi(s);
+		*size = atoi(s);
 		return 1;
 	}
 	return 0;
@@ -183,24 +183,24 @@ char *blf_dir_metrics_search(const char *filename)
 	char *mfile;
 	char *s;
 
-	mfile= BLI_strdup(filename);
-	s= strrchr(mfile, '.');
+	mfile = BLI_strdup(filename);
+	s = strrchr(mfile, '.');
 	if (s) {
 		if (BLI_strnlen(s, 4) < 4) {
 			MEM_freeN(mfile);
 			return NULL;
 		}
 		s++;
-		s[0]= 'a';
-		s[1]= 'f';
-		s[2]= 'm';
+		s[0] = 'a';
+		s[1] = 'f';
+		s[2] = 'm';
 
 		/* first check .afm */
 		if (BLI_exists(s))
 			return s;
 
 		/* and now check .pfm */
-		s[0]= 'p';
+		s[0] = 'p';
 
 		if (BLI_exists(s))
 			return s;
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 7ec7e23..7a4e1d4 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -73,43 +73,43 @@ void blf_font_size(FontBLF *font, int size, int dpi)
 	GlyphCacheBLF *gc;
 	FT_Error err;
 
-	err= FT_Set_Char_Size(font->face, 0, (size * 64), dpi, dpi);
+	err = FT_Set_Char_Size(font->face, 0, (size * 64), dpi, dpi);
 	if (err) {
 		/* FIXME: here we can go through the fixed size and choice a close one */
 		printf("The current font don't support the size, %d and dpi, %d\n", size, dpi);
 		return;
 	}
 
-	font->size= size;
-	font->dpi= dpi;
+	font->size = size;
+	font->dpi = dpi;
 
-	gc= blf_glyph_cache_find(font, size, dpi);
+	gc = blf_glyph_cache_find(font, size, dpi);
 	if (gc)
-		font->glyph_cache= gc;
+		font->glyph_cache = gc;
 	else {
-		gc= blf_glyph_cache_new(font);
+		gc = blf_glyph_cache_new(font);
 		if (gc)
-			font->glyph_cache= gc;
+			font->glyph_cache = gc;
 		else
-			font->glyph_cache= NULL;
+			font->glyph_cache = NULL;
 	}
 }
 
 static void blf_font_ensure_ascii_table(FontBLF *font)
 {
-	GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table;
+	GlyphBLF **glyph_ascii_table = font->glyph_cache->glyph_ascii_table;
 
 	/* build ascii on demand */
-	if(glyph_ascii_table['0']==NULL) {
+	if (glyph_ascii_table['0'] == NULL) {
 		GlyphBLF *g;
 		unsigned int i;
-		for(i=0; i<256; i++) {
-			g= blf_glyph_search(font->glyph_cache, i);
+		for (i = 0; i<256; i++) {
+			g = blf_glyph_search(font->glyph_cache, i);
 			if (!g) {
-				FT_UInt glyph_index= FT_Get_Char_Index(font->face, i);
-				g= blf_glyph_add(font, glyph_index, i);
+				FT_UInt glyph_index = FT_Get_Char_Index(font->face, i);
+				g = blf_glyph_add(font, glyph_index, i);
 			}
-			glyph_ascii_table[i]= g;
+			glyph_ascii_table[i] = g;
 		}
 	}
 }
@@ -122,67 +122,69 @@ static void blf_font_ensure_ascii_table(FontBLF *font)
 /* Note,
  * blf_font_ensure_ascii_table(font); must be called before this macro */
 
-#define BLF_UTF8_NEXT_FAST(_font, _g, _str, _i, _c, _glyph_ascii_table)       \
-	if(((_c)= (_str)[_i]) < 0x80) {                                           \
-		_g= (_glyph_ascii_table)[_c];                                         \
-		_i++;                                                                 \
-	}                                                                         \
-	else if ((_c= BLI_str_utf8_as_unicode_step(_str, &(_i)))!=BLI_UTF8_ERR) { \
-		if ((_g= blf_glyph_search((_font)->glyph_cache, _c)) == NULL) {       \
-			_g= blf_glyph_add(_font,                                          \
-			                  FT_Get_Char_Index((_font)->face, _c), _c);      \
-		}                                                                     \
-	}                                                                         \
-
-
-#define BLF_KERNING_VARS(_font, _has_kerning, _kern_mode)                     \
-	const short _has_kerning= FT_HAS_KERNING((_font)->face);                  \
-	const FT_UInt _kern_mode= (_has_kerning == 0) ? 0 :                       \
-	                         (((_font)->flags & BLF_KERNING_DEFAULT) ?        \
-	                          ft_kerning_default : FT_KERNING_UNFITTED)       \
-
-
-#define BLF_KERNING_STEP(_font, _kern_mode, _g_prev, _g, _delta, _pen_x)      \
-{                                                                             \
-	if (_g_prev) {                                                            \
-		_delta.x= _delta.y= 0;                                                \
-		if (FT_Get_Kerning((_font)->face,                                     \
-		                   (_g_prev)->idx,                                    \
-		                   (_g)->idx,                                         \
-		                   _kern_mode,                                        \
-		                   &(_delta)) == 0)                                   \
-		{                                                                     \
-			_pen_x += delta.x >> 6;                                           \
-		}                                                                     \
-	}                                                                         \
-}                                                                             \
+#define BLF_UTF8_NEXT_FAST(_font, _g, _str, _i, _c, _glyph_ascii_table)          \
+	if (((_c) = (_str)[_i]) < 0x80) {                                            \
+		_g = (_glyph_ascii_table)[_c];                                           \
+		_i++;                                                                    \
+	}                                                                            \
+	else if ((_c = BLI_str_utf8_as_unicode_step(_str, &(_i))) != BLI_UTF8_ERR) { \
+		if ((_g = blf_glyph_search((_font)->glyph_cache, _c)) == NULL) {         \
+			_g = blf_glyph_add(_font,                                            \
+			                  FT_Get_Char_Index((_font)->face, _c), _c);         \
+		}                                                                        \
+	}                                                                            \
+
+
+#define BLF_KERNING_VARS(_font, _has_kerning, _kern_mode)                        \
+	const short _has_kerning = FT_HAS_KERNING((_font)->face);                    \
+	const FT_UInt _kern_mode = (_has_kerning == 0) ? 0 :                         \
+	                         (((_font)->flags & BLF_KERNING_DEFAULT) ?           \
+	                          ft_kerning_default : FT_KERNING_UNFITTED)          \
+
+
+#define BLF_KERNING_STEP(_font, _kern_mode, _g_prev, _g, _delta, _pen_x)         \
+{                                                                                \
+	if (_g_prev) {                                                               \
+		_delta.x = _delta.y = 0;                                                 \
+		if (FT_Get_Kerning((_font)->face,                                        \
+		                   (_g_prev)->idx,                                       \
+		                   (_g)->idx,                                            \
+		                   _kern_mode,                                           \
+		                   &(_delta)) == 0)                                      \
+		{                                                                        \
+			_pen_x += delta.x >> 6;                                              \
+		}                                                                        \
+	}                                                                            \
+}                                                                                \
 
 void blf_font_draw(FontBLF *font, const char *str, unsigned int len)
 {
 	unsigned int c;
-	GlyphBLF *g, *g_prev= NULL;
+	GlyphBLF *g, *g_prev = NULL;
 	FT_Vector delta;
-	int pen_x= 0, pen_y= 0;
-	size_t i= 0;
-	GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table;
+	int pen_x = 0, pen_y = 0;
+	size_t i = 0;
+	GlyphBLF **glyph_ascii_table = font->glyph_cache->glyph_ascii_table;
 
 	BLF_KERNING_VARS(font, has_kerning, kern_mode);
 
 	blf_font_ensure_ascii_table(font);
 
 	while (str[i] && i < len) {
-
 		BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table);
 
-		if (c == BLI_UTF8_ERR)  break;
-		if (g == NULL)          continue;
-		if (has_kerning)        BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x);
+		if (c == BLI_UTF8_ERR)
+			break;
+		if (g == NULL)
+			continue;
+		if (has_kerning)
+			BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x);
 
 		/* do not return this loop if clipped, we want every character tested */
 		blf_glyph_render(font, g, (float)pen_x, (float)pen_y);
 
 		pen_x += g->advance;
-		g_prev= g;
+		g_prev = g;
 	}
 }
 
@@ -190,24 +192,26 @@ void blf_font_draw(FontBLF *font, const char *str, unsigned int len)
 void blf_font_draw_ascii(FontBLF *font, const char *str, unsigned int len)
 {
 	unsigned char c;
-	GlyphBLF *g, *g_prev= NULL;
+	GlyphBLF *g, *g_prev = NULL;
 	FT_Vector delta;
-	int pen_x= 0, pen_y= 0;
-	GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table;
+	int pen_x = 0, pen_y = 0;
+	GlyphBLF **glyph_ascii_table = font->glyph_cache->glyph_ascii_table;
 
 	BLF_KERNING_VARS(font, has_kerning, kern_mode);
 
 	blf_font_ensure_ascii_table(font);
 
-	while ((c= *(str++)) && len--) {
-		if ((g= glyph_ascii_table[c]) == NULL) continue;
-		if (has_kerning) BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x);
+	while ((c = *(str++)) && len--) {
+		if ((g = glyph_ascii_table[c]) == NULL)
+			continue;
+		if (has_kerning)
+			BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x);
 
 		/* do not return this loop if clipped, we want every character tested */
 		blf_glyph_render(font, g, (float)pen_x, (float)pen_y);
 
 		pen_x += g->advance;
-		g_prev= g;
+		g_prev = g;
 	}
 }
 
@@ -215,17 +219,17 @@ void blf_font_draw_ascii(FontBLF *font, const char *str, unsigned int len)
 void blf_font_buffer(FontBLF *font, const char *str)
 {
 	unsigned int c;
-	GlyphBLF *g, *g_prev= NULL;
+	GlyphBLF *g, *g_prev = NULL;
 	FT_Vector delta;
-	int pen_x= (int)font->pos[0], pen_y= 0;
-	size_t i= 0;
-	GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table;
+	int pen_x = (int)font->pos[0], pen_y = 0;
+	size_t i = 0;
+	GlyphBLF **glyph_ascii_table = font->glyph_cache->glyph_ascii_table;
 
 	/* buffer specific vars*/
-	const unsigned char b_col_char[4]= {font->b_col[0] * 255,
-	                                    font->b_col[1] * 255,
-	                                    font->b_col[2] * 255,
-	                                    font->b_col[3] * 255};
+	const unsigned char b_col_char[4] = {font->b_col[0] * 255,
+	                                     font->b_col[1] * 255,
+	                                     font->b_col[2] * 255,
+	                                     font->b_col[3] * 255};
 	unsigned char *cbuf;
 	int chx, chy;
 	int y, x;
@@ -236,15 +240,17 @@ void blf_font_buffer(FontBLF *font, const char *str)
 	blf_font_ensure_ascii_table(font);
 
 	while (str[i]) {
-
 		BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table);
 
-		if (c == BLI_UTF8_ERR)  break;
-		if (g == NULL)          continue;
-		if (has_kerning)        BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x);
+		if (c == BLI_UTF8_ERR)
+			break;
+		if (g == NULL)
+			continue;
+		if (has_kerning)
+			BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x);
 
-		chx= pen_x + ((int)g->pos_x);
-		chy= (int)font->pos[1] + g->height;
+		chx = pen_x + ((int)g->pos_x);
+		chy = (int)font->pos[1] + g->height;
 
 		if (g->pitch < 0) {
 			pen_y = (int)font->pos[1] + (g->height - (int)g->pos_y);
@@ -254,42 +260,43 @@ void blf_font_buffer(FontBLF *font, const char *str)
 		}
 
 		if ((chx + g->width) >= 0 && chx < font->bw && (pen_y + g->height) >= 0 && pen_y < font->bh) {
-			/* dont draw beyond the buffer bounds */
-			int width_clip= g->width;
-			int height_clip= g->height;
-			int yb_start= g->pitch < 0 ? 0 : g->height-1;
-
-			if (width_clip + chx > font->bw)	width_clip  -= chx + width_clip - font->bw;
-			if (height_clip + pen_y > font->bh) height_clip -= pen_y + height_clip - font->bh;
+			/* don't draw beyond the buffer bounds */
+			int width_clip = g->width;
+			int height_clip = g->height;
+			int yb_start = g->pitch < 0 ? 0 : g->height-1;
+
+			if (width_clip + chx > font->bw)
+				width_clip -= chx + width_clip - font->bw;
+			if (height_clip + pen_y > font->bh)
+				height_clip -= pen_y + height_clip - font->bh;
 			
 			/* drawing below the image? */
-			if(pen_y < 0) {
+			if (pen_y < 0) {
 				yb_start += (g->pitch < 0) ? -pen_y : pen_y;
 				height_clip += pen_y;
-				pen_y= 0;
+				pen_y = 0;
 			}
 
 			if (font->b_fbuf) {
-				int yb= yb_start;
-				for (y=(chy >= 0 ? 0:-chy); y < height_clip; y++) {
-					for (x=(chx >= 0 ? 0:-chx); x < width_clip; x++) {
-						
-						a= *(g->bitmap + x + (yb * g->pitch)) / 255.0f;
+				int yb = yb_start;
+				for (y = ((chy >= 0) ? 0 : -chy); y < height_clip; y++) {
+					for (x = ((chx >= 0) ? 0 : -chx); x < width_clip; x++) {
+						a = *(g->bitmap + x + (yb * g->pitch)) / 255.0f;
 
-						if(a > 0.0f) {
+						if (a > 0.0f) {
 							float alphatest;
-							fbuf= font->b_fbuf + font->bch * ((chx + x) + ((pen_y + y)*font->bw));
+							fbuf = font->b_fbuf + font->bch * ((chx + x) + ((pen_y + y)*font->bw));
 							if (a >= 1.0f) {
-								fbuf[0]= font->b_col[0];
-								fbuf[1]= font->b_col[1];
-								fbuf[2]= font->b_col[2];
-								fbuf[3]= (alphatest= (fbuf[3] + (font->b_col[3]))) < 1.0f ? alphatest : 1.0f;
+								fbuf[0] = font->b_col[0];
+								fbuf[1] = font->b_col[1];
+								fbuf[2] = font->b_col[2];
+								fbuf[3] = (alphatest = (fbuf[3] + (font->b_col[3]))) < 1.0f ? alphatest : 1.0f;
 							}
 							else {
-								fbuf[0]= (font->b_col[0]*a) + (fbuf[0] * (1-a));
-								fbuf[1]= (font->b_col[1]*a) + (fbuf[1] * (1-a));
-								fbuf[2]= (font->b_col[2]*a) + (fbuf[2] * (1-a));
-								fbuf[3]= (alphatest= (fbuf[3] + (font->b_col[3]*a))) < 1.0f ? alphatest : 1.0f;
+								fbuf[0] = (font->b_col[0]*a) + (fbuf[0] * (1-a));
+								fbuf[1] = (font->b_col[1]*a) + (fbuf[1] * (1-a));
+								fbuf[2] = (font->b_col[2]*a) + (fbuf[2] * (1-a));
+								fbuf[3] = (alphatest = (fbuf[3] + (font->b_col[3]*a))) < 1.0f ? alphatest : 1.0f;
 							}
 						}
 					}
@@ -302,25 +309,26 @@ void blf_font_buffer(FontBLF *font, const char *str)
 			}
 
 			if (font->b_cbuf) {
-				int yb= yb_start;
-				for (y= 0; y < height_clip; y++) {
-					for (x= 0; x < width_clip; x++) {
-						a= *(g->bitmap + x + (yb * g->pitch)) / 255.0f;
+				int yb = yb_start;
+				for (y = 0; y < height_clip; y++) {
+					for (x = 0; x < width_clip; x++) {
+						a = *(g->bitmap + x + (yb * g->pitch)) / 255.0f;
 
-						if(a > 0.0f) {
+						if (a > 0.0f) {
 							int alphatest;
-							cbuf= font->b_cbuf + font->bch * ((chx + x) + ((pen_y + y)*font->bw));
+							cbuf = font->b_cbuf + font->bch * ((chx + x) + ((pen_y + y)*font->bw));
 							if (a >= 1.0f) {
-								cbuf[0]= b_col_char[0];
-								cbuf[1]= b_col_char[1];
-								cbuf[2]= b_col_char[2];
-								cbuf[3]= (alphatest= ((int)cbuf[3] + (int)b_col_char[3])) < 255 ? alphatest : 255;
+								cbuf[0] = b_col_char[0];
+								cbuf[1] = b_col_char[1];
+								cbuf[2] = b_col_char[2];
+								cbuf[3] = (alphatest = ((int)cbuf[3] + (int)b_col_char[3])) < 255 ? alphatest : 255;
 							}
 							else {
-								cbuf[0]= (b_col_char[0]*a) + (cbuf[0] * (1-a));
-								cbuf[1]= (b_col_char[1]*a) + (cbuf[1] * (1-a));
-								cbuf[2]= (b_col_char[2]*a) + (cbuf[2] * (1-a));
-								cbuf[3]= (alphatest= ((int)cbuf[3] + (int)((font->b_col[3]*a)*255.0f))) < 255 ? alphatest : 255;
+								cbuf[0] = (b_col_char[0]*a) + (cbuf[0] * (1-a));
+								cbuf[1] = (b_col_char[1]*a) + (cbuf[1] * (1-a));
+								cbuf[2] = (b_col_char[2]*a) + (cbuf[2] * (1-a));
+								cbuf[3] = (alphatest = ((int)cbuf[3] + (int)((font->b_col[3]*a)*255.0f))) <
+								          255 ? alphatest : 255;
 							}
 						}
 					}
@@ -334,58 +342,60 @@ void blf_font_buffer(FontBLF *font, const char *str)
 		}
 
 		pen_x += g->advance;
-		g_prev= g;
+		g_prev = g;
 	}
 }
 
 void blf_font_boundbox(FontBLF *font, const char *str, rctf *box)
 {
 	unsigned int c;
-	GlyphBLF *g, *g_prev= NULL;
+	GlyphBLF *g, *g_prev = NULL;
 	FT_Vector delta;
-	int pen_x= 0, pen_y= 0;
-	size_t i= 0;
-	GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table;
+	int pen_x = 0, pen_y = 0;
+	size_t i = 0;
+	GlyphBLF **glyph_ascii_table = font->glyph_cache->glyph_ascii_table;
 
 	rctf gbox;
 
 	BLF_KERNING_VARS(font, has_kerning, kern_mode);
 
-	box->xmin= 32000.0f;
-	box->xmax= -32000.0f;
-	box->ymin= 32000.0f;
-	box->ymax= -32000.0f;
+	box->xmin = 32000.0f;
+	box->xmax = -32000.0f;
+	box->ymin = 32000.0f;
+	box->ymax = -32000.0f;
 
 	blf_font_ensure_ascii_table(font);
 
 	while (str[i]) {
-
 		BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table);
 
-		if (c == BLI_UTF8_ERR)  break;
-		if (g == NULL)          continue;
-		if (has_kerning)        BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x);
+		if (c == BLI_UTF8_ERR)
+			break;
+		if (g == NULL)
+			continue;
+		if (has_kerning)
+			BLF_KERNING_STEP(font, kern_mode, g_prev, g, delta, pen_x);
 
-		gbox.xmin= pen_x;
-		gbox.xmax= pen_x + g->advance;
-		gbox.ymin= g->box.ymin + pen_y;
-		gbox.ymax= g->box.ymax + pen_y;
+		gbox.xmin = pen_x;
+		gbox.xmax = pen_x + g->advance;
+		gbox.ymin = g->box.ymin + pen_y;
+		gbox.ymax = g->box.ymax + pen_y;
 
-		if (gbox.xmin < box->xmin) box->xmin= gbox.xmin;
-		if (gbox.ymin < box->ymin) box->ymin= gbox.ymin;
+		if (gbox.xmin < box->xmin) box->xmin = gbox.xmin;
+		if (gbox.ymin < box->ymin) box->ymin = gbox.ymin;
 
-		if (gbox.xmax > box->xmax) box->xmax= gbox.xmax;
-		if (gbox.ymax > box->ymax) box->ymax= gbox.ymax;
+		if (gbox.xmax > box->xmax) box->xmax = gbox.xmax;
+		if (gbox.ymax > box->ymax) box->ymax = gbox.ymax;
 
 		pen_x += g->advance;
-		g_prev= g;
+		g_prev = g;
 	}
 
 	if (box->xmin > box->xmax) {
-		box->xmin= 0.0f;
-		box->ymin= 0.0f;
-		box->xmax= 0.0f;
-		box->ymax= 0.0f;
+		box->xmin = 0.0f;
+		box->ymin = 0.0f;
+		box->xmax = 0.0f;
+		box->ymax = 0.0f;
 	}
 }
 
@@ -395,17 +405,17 @@ void blf_font_width_and_height(FontBLF *font, const char *str, float *width, flo
 	rctf box;
 
 	if (font->flags & BLF_ASPECT) {
-		xa= font->aspect[0];
-		ya= font->aspect[1];
+		xa = font->aspect[0];
+		ya = font->aspect[1];
 	}
 	else {
-		xa= 1.0f;
-		ya= 1.0f;
+		xa = 1.0f;
+		ya = 1.0f;
 	}
 
 	blf_font_boundbox(font, str, &box);
-	*width= ((box.xmax - box.xmin) * xa);
-	*height= ((box.ymax - box.ymin) * ya);
+	*width = ((box.xmax - box.xmin) * xa);
+	*height = ((box.ymax - box.ymin) * ya);
 }
 
 float blf_font_width(FontBLF *font, const char *str)
@@ -414,9 +424,9 @@ float blf_font_width(FontBLF *font, const char *str)
 	rctf box;
 
 	if (font->flags & BLF_ASPECT)
-		xa= font->aspect[0];
+		xa = font->aspect[0];
 	else
-		xa= 1.0f;
+		xa = 1.0f;
 
 	blf_font_boundbox(font, str, &box);
 	return (box.xmax - box.xmin) * xa;
@@ -428,9 +438,9 @@ float blf_font_height(FontBLF *font, const char *str)
 	rctf box;
 
 	if (font->flags & BLF_ASPECT)
-		ya= font->aspect[1];
+		ya = font->aspect[1];
 	else
-		ya= 1.0f;
+		ya = 1.0f;
 
 	blf_font_boundbox(font, str, &box);
 	return (box.ymax - box.ymin) * ya;
@@ -439,9 +449,9 @@ float blf_font_height(FontBLF *font, const char *str)
 float blf_font_fixed_width(FontBLF *font)
 {
 	const unsigned int c = ' ';
-	GlyphBLF *g= blf_glyph_search(font->glyph_cache, c);
+	GlyphBLF *g = blf_glyph_search(font->glyph_cache, c);
 	if (!g) {
-		g= blf_glyph_add(font, FT_Get_Char_Index(font->face, c), c);
+		g = blf_glyph_add(font, FT_Get_Char_Index(font->face, c), c);
 
 		/* if we don't find the glyph. */
 		if (!g) {
@@ -456,9 +466,9 @@ void blf_font_free(FontBLF *font)
 {
 	GlyphCacheBLF *gc;
 
-	font->glyph_cache= NULL;
+	font->glyph_cache = NULL;
 	while (font->cache.first) {
-		gc= font->cache.first;
+		gc = font->cache.first;
 		BLI_remlink(&font->cache, gc);
 		blf_glyph_cache_free(gc);
 	}
@@ -475,38 +485,38 @@ static void blf_font_fill(FontBLF *font)
 {
 	unsigned int i;
 
-	font->aspect[0]= 1.0f;
-	font->aspect[1]= 1.0f;
-	font->aspect[2]= 1.0f;
-	font->pos[0]= 0.0f;
-	font->pos[1]= 0.0f;
-	font->angle= 0.0f;
-
-	for (i= 0; i < 16; i++)
-		font->m[i]= 0;
-
-	font->clip_rec.xmin= 0.0f;
-	font->clip_rec.xmax= 0.0f;
-	font->clip_rec.ymin= 0.0f;
-	font->clip_rec.ymax= 0.0f;
-	font->flags= 0;
-	font->dpi= 0;
-	font->size= 0;
-	font->cache.first= NULL;
-	font->cache.last= NULL;
-	font->glyph_cache= NULL;
-	font->blur= 0;
-	font->max_tex_size= -1;
-	font->b_fbuf= NULL;
-	font->b_cbuf= NULL;
-	font->bw= 0;
-	font->bh= 0;
-	font->bch= 0;
-	font->b_col[0]= 0;
-	font->b_col[1]= 0;
-	font->b_col[2]= 0;
-	font->b_col[3]= 0;
-	font->ft_lib= ft_lib;
+	font->aspect[0] = 1.0f;
+	font->aspect[1] = 1.0f;
+	font->aspect[2] = 1.0f;
+	font->pos[0] = 0.0f;
+	font->pos[1] = 0.0f;
+	font->angle = 0.0f;
+
+	for (i = 0; i < 16; i++)
+		font->m[i] = 0;
+
+	font->clip_rec.xmin = 0.0f;
+	font->clip_rec.xmax = 0.0f;
+	font->clip_rec.ymin = 0.0f;
+	font->clip_rec.ymax = 0.0f;
+	font->flags = 0;
+	font->dpi = 0;
+	font->size = 0;
+	font->cache.first = NULL;
+	font->cache.last = NULL;
+	font->glyph_cache = NULL;
+	font->blur = 0;
+	font->max_tex_size = -1;
+	font->b_fbuf = NULL;
+	font->b_cbuf = NULL;
+	font->bw = 0;
+	font->bh = 0;
+	font->bch = 0;
+	font->b_col[0] = 0;
+	font->b_col[1] = 0;
+	font->b_col[2] = 0;
+	font->b_col[3] = 0;
+	font->ft_lib = ft_lib;
 }
 
 FontBLF *blf_font_new(const char *name, const char *filename)
@@ -515,14 +525,14 @@ FontBLF *blf_font_new(const char *name, const char *filename)
 	FT_Error err;
 	char *mfile;
 
-	font= (FontBLF *)MEM_callocN(sizeof(FontBLF), "blf_font_new");
-	err= FT_New_Face(ft_lib, filename, 0, &font->face);
+	font = (FontBLF *)MEM_callocN(sizeof(FontBLF), "blf_font_new");
+	err = FT_New_Face(ft_lib, filename, 0, &font->face);
 	if (err) {
 		MEM_freeN(font);
 		return NULL;
 	}
 
-	err= FT_Select_Charmap(font->face, ft_encoding_unicode);
+	err = FT_Select_Charmap(font->face, ft_encoding_unicode);
 	if (err) {
 		printf("Can't set the unicode character map!\n");
 		FT_Done_Face(font->face);
@@ -530,17 +540,17 @@ FontBLF *blf_font_new(const char *name, const char *filename)
 		return NULL;
 	}
 
-	mfile= blf_dir_metrics_search(filename);
+	mfile = blf_dir_metrics_search(filename);
 	if (mfile) {
-		err= FT_Attach_File(font->face, mfile);
-		if(err) {
+		err = FT_Attach_File(font->face, mfile);
+		if (err) {
 			fprintf(stderr, "FT_Attach_File failed to load '%s' with error %d\n", filename, (int)err);
 		}
 		MEM_freeN(mfile);
 	}
 
-	font->name= BLI_strdup(name);
-	font->filename= BLI_strdup(filename);
+	font->name = BLI_strdup(name);
+	font->filename = BLI_strdup(filename);
 	blf_font_fill(font);
 	return font;
 }
@@ -549,9 +559,9 @@ void blf_font_attach_from_mem(FontBLF *font, const unsigned char *mem, int mem_s
 {
 	FT_Open_Args open;
 
-	open.flags= FT_OPEN_MEMORY;
-	open.memory_base= (FT_Byte *)mem;
-	open.memory_size= mem_size;
+	open.flags = FT_OPEN_MEMORY;
+	open.memory_base = (FT_Byte *)mem;
+	open.memory_size = mem_size;
 	FT_Attach_Stream(font->face, &open);
 }
 
@@ -560,14 +570,14 @@ FontBLF *blf_font_new_from_mem(const char *name, unsigned char *mem, int mem_siz
 	FontBLF *font;
 	FT_Error err;
 
-	font= (FontBLF *)MEM_callocN(sizeof(FontBLF), "blf_font_new_from_mem");
-	err= FT_New_Memory_Face(ft_lib, mem, mem_size, 0, &font->face);
+	font = (FontBLF *)MEM_callocN(sizeof(FontBLF), "blf_font_new_from_mem");
+	err = FT_New_Memory_Face(ft_lib, mem, mem_size, 0, &font->face);
 	if (err) {
 		MEM_freeN(font);
 		return NULL;
 	}
 
-	err= FT_Select_Charmap(font->face, ft_encoding_unicode);
+	err = FT_Select_Charmap(font->face, ft_encoding_unicode);
 	if (err) {
 		printf("Can't set the unicode character map!\n");
 		FT_Done_Face(font->face);
@@ -575,8 +585,8 @@ FontBLF *blf_font_new_from_mem(const char *name, unsigned char *mem, int mem_siz
 		return NULL;
 	}
 
-	font->name= BLI_strdup(name);
-	font->filename= NULL;
+	font->name = BLI_strdup(name);
+	font->filename = NULL;
 	blf_font_fill(font);
 	return font;
 }
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index f0cfcdc..033efbf 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -59,11 +59,11 @@ GlyphCacheBLF *blf_glyph_cache_find(FontBLF *font, int size, int dpi)
 {
 	GlyphCacheBLF *p;
 
-	p= (GlyphCacheBLF *)font->cache.first;
+	p = (GlyphCacheBLF *)font->cache.first;
 	while (p) {
 		if (p->size == size && p->dpi == dpi)
 			return p;
-		p= p->next;
+		p = p->next;
 	}
 	return NULL;
 }
@@ -73,43 +73,43 @@ GlyphCacheBLF *blf_glyph_cache_new(FontBLF *font)
 {
 	GlyphCacheBLF *gc;
 
-	gc= (GlyphCacheBLF *)MEM_callocN(sizeof(GlyphCacheBLF), "blf_glyph_cache_new");
-	gc->next= NULL;
-	gc->prev= NULL;
-	gc->size= font->size;
-	gc->dpi= font->dpi;
+	gc = (GlyphCacheBLF *)MEM_callocN(sizeof(GlyphCacheBLF), "blf_glyph_cache_new");
+	gc->next = NULL;
+	gc->prev = NULL;
+	gc->size = font->size;
+	gc->dpi = font->dpi;
 
 	memset(gc->glyph_ascii_table, 0, sizeof(gc->glyph_ascii_table));
 	memset(gc->bucket, 0, sizeof(gc->bucket));
 
-	gc->textures= (GLuint *)malloc(sizeof(GLuint)*256);
-	gc->ntex= 256;
-	gc->cur_tex= -1;
-	gc->x_offs= 0;
-	gc->y_offs= 0;
-	gc->pad= 3;
+	gc->textures = (GLuint *)malloc(sizeof(GLuint)*256);
+	gc->ntex = 256;
+	gc->cur_tex = -1;
+	gc->x_offs = 0;
+	gc->y_offs = 0;
+	gc->pad = 3;
 
-	gc->num_glyphs= font->face->num_glyphs;
-	gc->rem_glyphs= font->face->num_glyphs;
-	gc->ascender= ((float)font->face->size->metrics.ascender) / 64.0f;
-	gc->descender= ((float)font->face->size->metrics.descender) / 64.0f;
+	gc->num_glyphs = font->face->num_glyphs;
+	gc->rem_glyphs = font->face->num_glyphs;
+	gc->ascender = ((float)font->face->size->metrics.ascender) / 64.0f;
+	gc->descender = ((float)font->face->size->metrics.descender) / 64.0f;
 
 	if (FT_IS_SCALABLE(font->face)) {
-		gc->max_glyph_width= (float)((font->face->bbox.xMax - font->face->bbox.xMin) *
-					(((float)font->face->size->metrics.x_ppem) /
-					 ((float)font->face->units_per_EM)));
+		gc->max_glyph_width = (float)((font->face->bbox.xMax - font->face->bbox.xMin) *
+		                              (((float)font->face->size->metrics.x_ppem) /
+		                               ((float)font->face->units_per_EM)));
 
-		gc->max_glyph_height= (float)((font->face->bbox.yMax - font->face->bbox.yMin) *
-					(((float)font->face->size->metrics.y_ppem) /
-					 ((float)font->face->units_per_EM)));
+		gc->max_glyph_height = (float)((font->face->bbox.yMax - font->face->bbox.yMin) *
+		                               (((float)font->face->size->metrics.y_ppem) /
+		                                ((float)font->face->units_per_EM)));
 	}
 	else {
-		gc->max_glyph_width= ((float)font->face->size->metrics.max_advance) / 64.0f;
-		gc->max_glyph_height= ((float)font->face->size->metrics.height) / 64.0f;
+		gc->max_glyph_width = ((float)font->face->size->metrics.max_advance) / 64.0f;
+		gc->max_glyph_height = ((float)font->face->size->metrics.height) / 64.0f;
 	}
 
-	gc->p2_width= 0;
-	gc->p2_height= 0;
+	gc->p2_width = 0;
+	gc->p2_height = 0;
 
 	BLI_addhead(&font->cache, gc);
 	return gc;
@@ -121,10 +121,10 @@ void blf_glyph_cache_clear(FontBLF *font)
 	GlyphBLF *g;
 	int i;
 
-	for(gc=font->cache.first; gc; gc=gc->next) {
-		for (i= 0; i < 257; i++) {
+	for (gc = font->cache.first; gc; gc = gc->next) {
+		for (i = 0; i < 257; i++) {
 			while (gc->bucket[i].first) {
-				g= gc->bucket[i].first;
+				g = gc->bucket[i].first;
 				BLI_remlink(&(gc->bucket[i]), g);
 				blf_glyph_free(g);
 			}
@@ -139,9 +139,9 @@ void blf_glyph_cache_free(GlyphCacheBLF *gc)
 	GlyphBLF *g;
 	int i;
 
-	for (i= 0; i < 257; i++) {
+	for (i = 0; i < 257; i++) {
 		while (gc->bucket[i].first) {
-			g= gc->bucket[i].first;
+			g = gc->bucket[i].first;
 			BLI_remlink(&(gc->bucket[i]), g);
 			blf_glyph_free(g);
 		}
@@ -163,25 +163,25 @@ static void blf_glyph_cache_texture(FontBLF *font, GlyphCacheBLF *gc)
 
 	if (gc->cur_tex >= gc->ntex) {
 		gc->ntex *= 2;
-		gc->textures= (GLuint *)realloc((void *)gc->textures, sizeof(GLuint)*gc->ntex);
+		gc->textures = (GLuint *)realloc((void *)gc->textures, sizeof(GLuint)*gc->ntex);
 	}
 
-	gc->p2_width= blf_next_p2((gc->rem_glyphs * gc->max_glyph_width) + (gc->pad * 2));
+	gc->p2_width = blf_next_p2((gc->rem_glyphs * gc->max_glyph_width) + (gc->pad * 2));
 	if (gc->p2_width > font->max_tex_size)
-		gc->p2_width= font->max_tex_size;
+		gc->p2_width = font->max_tex_size;
 
-	i= (int)((gc->p2_width - (gc->pad * 2)) / gc->max_glyph_width);
-	gc->p2_height= blf_next_p2(((gc->num_glyphs / i) + 1) * gc->max_glyph_height);
+	i = (int)((gc->p2_width - (gc->pad * 2)) / gc->max_glyph_width);
+	gc->p2_height = blf_next_p2(((gc->num_glyphs / i) + 1) * gc->max_glyph_height);
 
 	if (gc->p2_height > font->max_tex_size)
-		gc->p2_height= font->max_tex_size;
+		gc->p2_height = font->max_tex_size;
 
-	tot_mem= gc->p2_width * gc->p2_height;
-	buf= (unsigned char *)malloc(tot_mem);
+	tot_mem = gc->p2_width * gc->p2_height;
+	buf = (unsigned char *)malloc(tot_mem);
 	memset((void *)buf, 0, tot_mem);
 
 	glGenTextures(1, &gc->textures[gc->cur_tex]);
-	glBindTexture(GL_TEXTURE_2D, (font->tex_bind_state= gc->textures[gc->cur_tex]));
+	glBindTexture(GL_TEXTURE_2D, (font->tex_bind_state = gc->textures[gc->cur_tex]));
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -196,12 +196,12 @@ GlyphBLF *blf_glyph_search(GlyphCacheBLF *gc, unsigned int c)
 	GlyphBLF *p;
 	unsigned int key;
 
-	key= blf_hash(c);
-	p= gc->bucket[key].first;
+	key = blf_hash(c);
+	p = gc->bucket[key].first;
 	while (p) {
 		if (p->c == c)
 			return p;
-		p= p->next;
+		p = p->next;
 	}
 	return NULL;
 }
@@ -216,7 +216,7 @@ GlyphBLF *blf_glyph_add(FontBLF *font, unsigned int index, unsigned int c)
 	FT_BBox bbox;
 	unsigned int key;
 
-	g= blf_glyph_search(font->glyph_cache, c);
+	g = blf_glyph_search(font->glyph_cache, c);
 	if (g)
 		return g;
 
@@ -228,7 +228,7 @@ GlyphBLF *blf_glyph_add(FontBLF *font, unsigned int index, unsigned int c)
 		return NULL;
 
 	/* get the glyph. */
-	slot= font->face->glyph;
+	slot = font->face->glyph;
 
 	if (sharp) {
 		err = FT_Render_Glyph(slot, FT_RENDER_MODE_MONO);
@@ -239,47 +239,48 @@ GlyphBLF *blf_glyph_add(FontBLF *font, unsigned int index, unsigned int c)
 		err += FT_Bitmap_Convert(font->ft_lib, &slot->bitmap, &tempbitmap, 1); /* Does Blender use Pitch 1 always? It works so far */
 		err += FT_Bitmap_Copy(font->ft_lib, &tempbitmap, &slot->bitmap);
 		err += FT_Bitmap_Done(font->ft_lib, &tempbitmap);
-	} else {
+	}
+	else {
 		err = FT_Render_Glyph(slot, FT_RENDER_MODE_NORMAL);
 	}
 
 	if (err || slot->format != FT_GLYPH_FORMAT_BITMAP)
 		return NULL;
 
-	g= (GlyphBLF *)MEM_callocN(sizeof(GlyphBLF), "blf_glyph_add");
-	g->c= c;
-	g->idx= (FT_UInt)index;
-	g->xoff= -1;
-	g->yoff= -1;
-	bitmap= slot->bitmap;
-	g->width= bitmap.width;
-	g->height= bitmap.rows;
+	g = (GlyphBLF *)MEM_callocN(sizeof(GlyphBLF), "blf_glyph_add");
+	g->c = c;
+	g->idx = (FT_UInt)index;
+	g->xoff = -1;
+	g->yoff = -1;
+	bitmap = slot->bitmap;
+	g->width = bitmap.width;
+	g->height = bitmap.rows;
 
 	if (g->width && g->height) {
 		if (sharp) {
 			/* Font buffer uses only 0 or 1 values, Blender expects full 0..255 range */
 			int i;
-			for (i=0; i < (g->width * g->height); i++) {
+			for (i = 0; i < (g->width * g->height); i++) {
 				bitmap.buffer[i] = 255 * bitmap.buffer[i];
 			}
 		}
 
-		g->bitmap= (unsigned char *)MEM_mallocN(g->width * g->height, "glyph bitmap");
+		g->bitmap = (unsigned char *)MEM_mallocN(g->width * g->height, "glyph bitmap");
 		memcpy((void *)g->bitmap, (void *)bitmap.buffer, g->width * g->height);
 	}
 
-	g->advance= ((float)slot->advance.x) / 64.0f;
-	g->pos_x= slot->bitmap_left;
-	g->pos_y= slot->bitmap_top;
-	g->pitch= slot->bitmap.pitch;
+	g->advance = ((float)slot->advance.x) / 64.0f;
+	g->pos_x = slot->bitmap_left;
+	g->pos_y = slot->bitmap_top;
+	g->pitch = slot->bitmap.pitch;
 
 	FT_Outline_Get_CBox(&(slot->outline), &bbox);
-	g->box.xmin= ((float)bbox.xMin) / 64.0f;
-	g->box.xmax= ((float)bbox.xMax) / 64.0f;
-	g->box.ymin= ((float)bbox.yMin) / 64.0f;
-	g->box.ymax= ((float)bbox.yMax) / 64.0f;
+	g->box.xmin = ((float)bbox.xMin) / 64.0f;
+	g->box.xmax = ((float)bbox.xMax) / 64.0f;
+	g->box.ymin = ((float)bbox.yMin) / 64.0f;
+	g->box.ymax = ((float)bbox.yMax) / 64.0f;
 
-	key= blf_hash(g->c);
+	key = blf_hash(g->c);
 	BLI_addhead(&(font->glyph_cache->bucket[key]), g);
 	return g;
 }
@@ -296,7 +297,6 @@ void blf_glyph_free(GlyphBLF *g)
 
 static void blf_texture_draw(float uv[2][2], float dx, float y1, float dx1, float y2)
 {
-	
 	glBegin(GL_QUADS);
 	glTexCoord2f(uv[0][0], uv[0][1]);
 	glVertex2f(dx, y1);
@@ -310,27 +310,26 @@ static void blf_texture_draw(float uv[2][2], float dx, float y1, float dx1, floa
 	glTexCoord2f(uv[1][0], uv[0][1]);
 	glVertex2f(dx1, y1);
 	glEnd();
-	
 }
 
 static void blf_texture5_draw(const float shadow_col[4], float uv[2][2], float x1, float y1, float x2, float y2)
 {
-	float soft[25]= {1/60.0f, 1/60.0f, 2/60.0f, 1/60.0f, 1/60.0f,
-	                 1/60.0f, 3/60.0f, 5/60.0f, 3/60.0f, 1/60.0f,
-	                 2/60.0f, 5/60.0f, 8/60.0f, 5/60.0f, 2/60.0f,
-	                 1/60.0f, 3/60.0f, 5/60.0f, 3/60.0f, 1/60.0f,
-	                 1/60.0f, 1/60.0f, 2/60.0f, 1/60.0f, 1/60.0f};
+	float soft[25] = {1/60.0f, 1/60.0f, 2/60.0f, 1/60.0f, 1/60.0f,
+	                  1/60.0f, 3/60.0f, 5/60.0f, 3/60.0f, 1/60.0f,
+	                  2/60.0f, 5/60.0f, 8/60.0f, 5/60.0f, 2/60.0f,
+	                  1/60.0f, 3/60.0f, 5/60.0f, 3/60.0f, 1/60.0f,
+	                  1/60.0f, 1/60.0f, 2/60.0f, 1/60.0f, 1/60.0f};
 	
-	float color[4], *fp= soft;
+	float color[4], *fp = soft;
 	int dx, dy;
 
-	color[0]= shadow_col[0];
-	color[1]= shadow_col[1];
-	color[2]= shadow_col[2];
+	color[0] = shadow_col[0];
+	color[1] = shadow_col[1];
+	color[2] = shadow_col[2];
 	
-	for(dx=-2; dx<3; dx++) {
-		for(dy=-2; dy<3; dy++, fp++) {
-			color[3]= *(fp) * shadow_col[3];
+	for (dx = -2; dx < 3; dx++) {
+		for (dy = -2; dy < 3; dy++, fp++) {
+			color[3] = *(fp) * shadow_col[3];
 			glColor4fv(color);
 			blf_texture_draw(uv, x1+dx, y1+dy, x2+dx, y2+dy);
 		}
@@ -341,20 +340,20 @@ static void blf_texture5_draw(const float shadow_col[4], float uv[2][2], float x
 
 static void blf_texture3_draw(const float shadow_col[4], float uv[2][2], float x1, float y1, float x2, float y2)
 {
-	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 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 color[4], *fp= soft;
+	float color[4], *fp = soft;
 	int dx, dy;
 
-	color[0]= shadow_col[0];
-	color[1]= shadow_col[1];
-	color[2]= shadow_col[2];
+	color[0] = shadow_col[0];
+	color[1] = shadow_col[1];
+	color[2] = shadow_col[2];
 
-	for(dx=-1; dx<2; dx++) {
-		for(dy=-1; dy<2; dy++, fp++) {
-			color[3]= *(fp) * shadow_col[3];
+	for (dx = -1; dx < 2; dx++) {
+		for (dy = -1; dy < 2; dy++, fp++) {
+			color[3] = *(fp) * shadow_col[3];
 			glColor4fv(color);
 			blf_texture_draw(uv, x1+dx, y1+dy, x2+dx, y2+dy);
 		}
@@ -373,30 +372,30 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
 		return 1;
 
 	if (g->build_tex == 0) {
-		GlyphCacheBLF *gc= font->glyph_cache;
+		GlyphCacheBLF *gc = font->glyph_cache;
 
 		if (font->max_tex_size == -1)
 			glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint *)&font->max_tex_size);
 
 		if (gc->cur_tex == -1) {
 			blf_glyph_cache_texture(font, gc);
-			gc->x_offs= gc->pad;
-			gc->y_offs= gc->pad;
+			gc->x_offs = gc->pad;
+			gc->y_offs = gc->pad;
 		}
 
 		if (gc->x_offs > (gc->p2_width - gc->max_glyph_width)) {
-			gc->x_offs= gc->pad;
+			gc->x_offs = gc->pad;
 			gc->y_offs += gc->max_glyph_height;
 
 			if (gc->y_offs > (gc->p2_height - gc->max_glyph_height)) {
-				gc->y_offs= gc->pad;
+				gc->y_offs = gc->pad;
 				blf_glyph_cache_texture(font, gc);
 			}
 		}
 
-		g->tex= gc->textures[gc->cur_tex];
-		g->xoff= gc->x_offs;
-		g->yoff= gc->y_offs;
+		g->tex = gc->textures[gc->cur_tex];
+		g->xoff = gc->x_offs;
+		g->yoff = gc->y_offs;
 
 		glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
 		glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
@@ -407,32 +406,32 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
 		glTexSubImage2D(GL_TEXTURE_2D, 0, g->xoff, g->yoff, g->width, g->height, GL_ALPHA, GL_UNSIGNED_BYTE, g->bitmap);
 		glPopClientAttrib();
 
-		g->uv[0][0]= ((float)g->xoff) / ((float)gc->p2_width);
-		g->uv[0][1]= ((float)g->yoff) / ((float)gc->p2_height);
-		g->uv[1][0]= ((float)(g->xoff + g->width)) / ((float)gc->p2_width);
-		g->uv[1][1]= ((float)(g->yoff + g->height)) / ((float)gc->p2_height);
+		g->uv[0][0] = ((float)g->xoff) / ((float)gc->p2_width);
+		g->uv[0][1] = ((float)g->yoff) / ((float)gc->p2_height);
+		g->uv[1][0] = ((float)(g->xoff + g->width)) / ((float)gc->p2_width);
+		g->uv[1][1] = ((float)(g->yoff + g->height)) / ((float)gc->p2_height);
 
 		/* update the x offset for the next glyph. */
 		gc->x_offs += (int)(g->box.xmax - g->box.xmin + gc->pad);
 
 		gc->rem_glyphs--;
-		g->build_tex= 1;
+		g->build_tex = 1;
 	}
 
-	xo= 0.0f;
-	yo= 0.0f;
+	xo = 0.0f;
+	yo = 0.0f;
 
 	if (font->flags & BLF_SHADOW) {
-		xo= x;
-		yo= y;
+		xo = x;
+		yo = y;
 		x += font->shadow_x;
 		y += font->shadow_y;
 	}
 
-	dx= floor(x + g->pos_x);
-	dx1= dx + g->width;
-	y1= y + g->pos_y;
-	y2= y + g->pos_y - g->height;
+	dx = floor(x + g->pos_x);
+	dx1 = dx + g->width;
+	y1 = y + g->pos_y;
+	y2 = y + g->pos_y - g->height;
 
 	if (font->flags & BLF_CLIPPING) {
 		if (!BLI_in_rctf(&font->clip_rec, dx + font->pos[0], y1 + font->pos[1]))
@@ -446,12 +445,12 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
 	}
 
 	if (font->tex_bind_state != g->tex) {
-		glBindTexture(GL_TEXTURE_2D, (font->tex_bind_state= g->tex));
+		glBindTexture(GL_TEXTURE_2D, (font->tex_bind_state = g->tex));
 	}
 
 	if (font->flags & BLF_SHADOW) {
 
-		switch(font->shadow) {
+		switch (font->shadow) {
 			case 3:
 				blf_texture3_draw(font->shadow_col, g->uv, dx, y1, dx1, y2);
 				break;
@@ -466,16 +465,16 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
 
 		glColor4fv(font->orig_col);
 
-		x= xo;
-		y= yo;
+		x = xo;
+		y = yo;
 
-		dx= floor(x + g->pos_x);
-		dx1= dx + g->width;
-		y1= y + g->pos_y;
-		y2= y + g->pos_y - g->height;
+		dx = floor(x + g->pos_x);
+		dx1 = dx + g->width;
+		y1 = y + g->pos_y;
+		y2 = y + g->pos_y - g->height;
 	}
 
-	switch(font->blur) {
+	switch (font->blur) {
 		case 3:
 			blf_texture3_draw(font->orig_col, g->uv, dx, y1, dx1, y2);
 			break;
diff --git a/source/blender/blenfont/intern/blf_internal.h b/source/blender/blenfont/intern/blf_internal.h
index 2012466..f43fa8a 100644
--- a/source/blender/blenfont/intern/blf_internal.h
+++ b/source/blender/blenfont/intern/blf_internal.h
@@ -28,8 +28,8 @@
  */
 
 
-#ifndef BLF_INTERNAL_H
-#define BLF_INTERNAL_H
+#ifndef __BLF_INTERNAL_H__
+#define __BLF_INTERNAL_H__
 
 struct FontBLF;
 struct GlyphBLF;
@@ -41,7 +41,7 @@ unsigned int blf_hash(unsigned int val);
 
 char *blf_dir_search(const char *file);
 char *blf_dir_metrics_search(const char *filename);
-// int blf_dir_split(const char *str, char *file, int *size); // UNUSED
+/* int blf_dir_split(const char *str, char *file, int *size);  *//* UNUSED */
 
 int blf_font_init(void);
 void blf_font_exit(void);
@@ -72,4 +72,4 @@ struct GlyphBLF *blf_glyph_add(struct FontBLF *font, unsigned int index, unsigne
 void blf_glyph_free(struct GlyphBLF *g);
 int blf_glyph_render(struct FontBLF *font, struct GlyphBLF *g, float x, float y);
 
-#endif /* BLF_INTERNAL_H */
+#endif /* __BLF_INTERNAL_H__ */
diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h
index e8021aa..cbe7975 100644
--- a/source/blender/blenfont/intern/blf_internal_types.h
+++ b/source/blender/blenfont/intern/blf_internal_types.h
@@ -28,8 +28,8 @@
  */
 
 
-#ifndef BLF_INTERNAL_TYPES_H
-#define BLF_INTERNAL_TYPES_H
+#ifndef __BLF_INTERNAL_TYPES_H__
+#define __BLF_INTERNAL_TYPES_H__
 
 typedef struct GlyphCacheBLF {
 	struct GlyphCacheBLF *next;
@@ -223,4 +223,4 @@ typedef struct DirBLF {
 	char *path;
 } DirBLF;
 
-#endif /* BLF_INTERNAL_TYPES_H */
+#endif /* __BLF_INTERNAL_TYPES_H__ */
diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c
index d96011f..435ca87 100644
--- a/source/blender/blenfont/intern/blf_lang.c
+++ b/source/blender/blenfont/intern/blf_lang.c
@@ -55,7 +55,7 @@
 
 #include "MEM_guardedalloc.h"
 
-#include "BLI_linklist.h"	/* linknode */
+#include "BLI_linklist.h" /* linknode */
 #include "BLI_string.h"
 #include "BLI_utildefines.h"
 #include "BLI_path_util.h"
@@ -82,7 +82,7 @@ static const char *locales[] = {
 	"spanish", "es",
 	"catalan", "ca_AD",
 	"czech", "cs_CZ",
-	"ptb", "pt_BR",
+	"ptb", "pt",
 #if defined (_WIN32) && !defined(FREE_WINDOWS)
 	"Chinese (Simplified)_China.1252", "zh_CN",
 	"Chinese (Traditional)_China.1252", "zh_TW",
@@ -101,15 +101,16 @@ static const char *locales[] = {
 	"greek", "el_GR",
 	"korean", "ko_KR",
 	"nepali", "ne_NP",
-	"persian", "fa_PE",
+	"persian", "fa_IR",
 	"indonesian", "id_ID",
 	"serbian (latin)", "sr_RS at latin",
-	"kyrgyz", "ky",
+	"kyrgyz", "ky_KG",
+	"turkish", "tr_TR",
 };
 
 void BLF_lang_init(void)
 {
-	char *messagepath= BLI_get_folder(BLENDER_DATAFILES, "locale");
+	char *messagepath = BLI_get_folder(BLENDER_DATAFILES, "locale");
 	
 	BLI_strncpy(global_encoding_name, SYSTEM_ENCODING_DEFAULT, sizeof(global_encoding_name));
 	
@@ -118,7 +119,7 @@ void BLF_lang_init(void)
 	}
 	else {
 		printf("%s: 'locale' data path for translations not found, continuing\n", __func__);
-		global_messagepath[0]= '\0';
+		global_messagepath[0] = '\0';
 	}
 	
 }
@@ -126,18 +127,18 @@ void BLF_lang_init(void)
 /* get LANG/LANGUAGE environment variable */
 static void get_language_variable(const char *varname, char *var, int maxlen)
 {
-	char *env= getenv(varname);
+	char *env = getenv(varname);
 
-	if(env) {
+	if (env) {
 		char *s;
 
 		/* store defaul locale */
 		BLI_strncpy(var, env, maxlen);
 
 		/* use first language as default */
-		s= strchr(var, ':');
-		if(s)
-			s[0]= 0;
+		s = strchr(var, ':');
+		if (s)
+			s[0] = 0;
 	}
 }
 
@@ -146,7 +147,7 @@ static void get_language_variable(const char *varname, char *var, int maxlen)
  */
 static void get_language(const char *locale, const char *lang, char *language, int maxlen)
 {
-	if(locale[0]) {
+	if (locale[0]) {
 		BLI_strncpy(language, locale, maxlen);
 	}
 	else {
@@ -154,9 +155,9 @@ static void get_language(const char *locale, const char *lang, char *language, i
 
 		BLI_strncpy(language, lang, maxlen);
 
-		s= strchr(language, '.');
-		if(s)
-			s[0]= 0;
+		s = strchr(language, '.');
+		if (s)
+			s[0] = 0;
 	}
 }
 
@@ -165,22 +166,22 @@ void BLF_lang_set(const char *str)
 {
 	char *locreturn;
 	const char *short_locale;
-	int ok= 1;
+	int ok = 1;
 	const char *long_locale = locales[2 * U.language];
 
-	if((U.transopts&USER_DOTRANSLATE)==0)
+	if ((U.transopts&USER_DOTRANSLATE) == 0)
 		return;
 
-	if(str)
+	if (str)
 		short_locale = str;
 	else
 		short_locale = locales[ 2 * U.language + 1];
 
 #if defined (_WIN32) && !defined(FREE_WINDOWS)
-	if(short_locale) {
+	if (short_locale) {
 		char *envStr;
 
-		if( U.language==0 )/* use system setting */
+		if (U.language == 0)/* use system setting */
 			envStr = BLI_sprintfN( "LANG=%s", getenv("LANG") );
 		else
 			envStr = BLI_sprintfN( "LANG=%s", short_locale );
@@ -189,48 +190,48 @@ void BLF_lang_set(const char *str)
 		MEM_freeN(envStr);
 	}
 
-	locreturn= setlocale(LC_ALL, long_locale);
+	locreturn = setlocale(LC_ALL, long_locale);
 
 	if (locreturn == NULL) {
-		if(G.f & G_DEBUG)
+		if (G.debug & G_DEBUG)
 			printf("Could not change locale to %s\n", long_locale);
 
-		ok= 0;
+		ok = 0;
 	}
 #else
 	{
-		static char default_lang[64]="\0";
-		static char default_language[64]="\0";
+		static char default_lang[64] ="\0";
+		static char default_language[64] ="\0";
 
-		if(default_lang[0]==0)
+		if (default_lang[0] == 0)
 			get_language_variable("LANG", default_lang, sizeof(default_lang));
 
-		if(default_language[0]==0)
+		if (default_language[0] == 0)
 			get_language_variable("LANGUAGE", default_language, sizeof(default_language));
 
-		if(short_locale[0]) {
-			if(G.f & G_DEBUG)
+		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);
 		}
 		else {
-			if(G.f & G_DEBUG)
+			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);
+		locreturn = setlocale(LC_ALL, short_locale);
 
-		if(locreturn == NULL) {
-			char *short_locale_utf8= NULL;
+		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 (short_locale[0]) {
+				short_locale_utf8 = BLI_sprintfN("%s.UTF-8", short_locale);
+				locreturn = setlocale(LC_ALL, short_locale_utf8);
 			}
 
 			if (locreturn == NULL) {
@@ -238,8 +239,8 @@ void BLF_lang_set(const char *str)
 
 				get_language(long_locale, default_lang, language, sizeof(language));
 
-				if(G.f & G_DEBUG) {
-					if(short_locale[0])
+				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");
@@ -251,19 +252,19 @@ void BLF_lang_set(const char *str)
 				BLI_setenv("LANG", default_lang);
 				BLI_setenv("LANGUAGE", language);
 
-				locreturn= setlocale(LC_ALL, "");
+				locreturn = setlocale(LC_ALL, "");
 
-				ok= 0;
+				ok = 0;
 			}
 
-			if(short_locale_utf8)
+			if (short_locale_utf8)
 				MEM_freeN(short_locale_utf8);
 		}
 	}
 #endif
 
-	if(ok) {
-		//printf("Change locale to %s\n", locreturn );
+	if (ok) {
+		/*printf("Change locale to %s\n", locreturn ); */
 		BLI_strncpy(global_language, locreturn, sizeof(global_language));
 	}
 
diff --git a/source/blender/blenfont/intern/blf_translation.c b/source/blender/blenfont/intern/blf_translation.c
index 0ddb654..12fa15a 100644
--- a/source/blender/blenfont/intern/blf_translation.c
+++ b/source/blender/blenfont/intern/blf_translation.c
@@ -57,34 +57,34 @@
 #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;
+static const char unifont_filename[] ="droidsans.ttf.gz";
+static unsigned char *unifont_ttf = NULL;
+static int unifont_size = 0;
 
 unsigned char *BLF_get_unifont(int *unifont_size_r)
 {
-	if(unifont_ttf==NULL) {
+	if (unifont_ttf == NULL) {
 		char *fontpath = BLI_get_folder(BLENDER_DATAFILES, "fonts");
 		if (fontpath) {
 			char unifont_path[1024];
 
 			BLI_snprintf(unifont_path, sizeof(unifont_path), "%s/%s", fontpath, unifont_filename);
 
-			unifont_ttf= (unsigned char*)BLI_file_ungzip_to_mem(unifont_path, &unifont_size);
+			unifont_ttf = (unsigned char*)BLI_file_ungzip_to_mem(unifont_path, &unifont_size);
 		}
 		else {
 			printf("%s: 'fonts' data path not found for international font, continuing\n", __func__);
 		}
 	}
 
-	*unifont_size_r= unifont_size;
+	*unifont_size_r = unifont_size;
 
 	return unifont_ttf;
 }
 
 void BLF_free_unifont(void)
 {
-	if(unifont_ttf)
+	if (unifont_ttf)
 		MEM_freeN(unifont_ttf);
 }
 
@@ -93,8 +93,8 @@ void BLF_free_unifont(void)
 const char* BLF_gettext(const char *msgid)
 {
 #ifdef WITH_INTERNATIONAL
-	if( msgid[0] )
-		return gettext( msgid );
+	if (msgid && msgid[0])
+		return gettext(msgid);
 	return "";
 #else
 	return msgid;
@@ -111,6 +111,9 @@ const char *BLF_pgettext(const char *context, const char *message)
 
 	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;
@@ -154,26 +157,36 @@ int BLF_translate_tooltips(void)
 #endif
 }
 
-const char *BLF_translate_do_iface(const char *msgid)
+const char *BLF_translate_do_iface(const char *context, const char *msgid)
 {
 #ifdef WITH_INTERNATIONAL
-	if(BLF_translate_iface())
-		return BLF_gettext(msgid);
+	if (BLF_translate_iface()) {
+		if (context)
+			return BLF_pgettext(context, msgid);
+		else
+			return BLF_gettext(msgid);
+	}
 	else
 		return msgid;
 #else
+	(void)context;
 	return msgid;
 #endif
 }
 
-const char *BLF_translate_do_tooltip(const char *msgid)
+const char *BLF_translate_do_tooltip(const char *context, const char *msgid)
 {
 #ifdef WITH_INTERNATIONAL
-	if(BLF_translate_tooltips())
-		return BLF_gettext(msgid);
+	if (BLF_translate_tooltips()) {
+		if (context)
+			return BLF_pgettext(context, msgid);
+		else
+			return BLF_gettext(msgid);
+	}
 	else
 		return msgid;
 #else
+	(void)context;
 	return msgid;
 #endif
 }
diff --git a/source/blender/blenfont/intern/blf_util.c b/source/blender/blenfont/intern/blf_util.c
index 45e01e5..8240906 100644
--- a/source/blender/blenfont/intern/blf_util.c
+++ b/source/blender/blenfont/intern/blf_util.c
@@ -53,7 +53,7 @@ unsigned int blf_hash(unsigned int val)
 {
 	unsigned int key;
 
-	key= val;
+	key = val;
 	key += ~(key << 16);
 	key ^= (key >> 5);
 	key += (key << 3);
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h
index a887412..3a28af9 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -25,24 +25,52 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_DERIVEDMESH_H
-#define BKE_DERIVEDMESH_H
+#ifndef __BKE_DERIVEDMESH_H__
+#define __BKE_DERIVEDMESH_H__
 
-/** \file BKE_DerivedMesh.h
- *  \ingroup bke
+/*
+ * Basic design of the DerivedMesh system:
+ *
+ * DerivedMesh is a common set of interfaces for mesh systems.
+ *
+ * There are three main mesh data structures in Blender: Mesh, CDDM, and BMesh.
+ * These, and a few others, all implement DerivedMesh interfaces, 
+ * which contains unified drawing interfaces, a few utility interfaces, 
+ * and a bunch of read-only interfaces intended mostly for conversion from 
+ * one format to another.
+ *
+ * All Mesh structures in blender make use of CustomData, which is used to store
+ * per-element attributes and interpolate them (e.g. uvs, vcols, vgroups, etc).
+ * 
+ * Mesh is the "serialized" structure, used for storing object-mode mesh data
+ * and also for saving stuff to disk.  It's interfaces are also what DerivedMesh
+ * uses to communicate with.
+ * 
+ * CDDM is a little mesh library, that uses Mesh data structures in the backend.
+ * It's mostly used for modifiers, and has the advantages of not taking much
+ * resources.
+ *
+ * BMesh is a full-on brep, used for editmode, some modifiers, etc.  It's much
+ * more capable (if memory-intensive) then CDDM.
  *
- *  \todo
- *  - Make drawMapped* functions take a predicate function that
- *    determines whether to draw the edge (this predicate can
- *    also set color, etc). This will be slightly more general 
- *    and allow some of the functions to be collapsed.
- *  - Once accessor functions are added then single element draw
- *    functions can be implemented using primitive accessors.
- *  - Add function to dispatch to renderer instead of using
- *    conversion to DLM.
+ * DerivedMesh is somewhat hackish.  Many places assumes that a DerivedMesh is
+ * a CDDM (most of the time by simply copying it and converting it to one).
+ * CDDM is the original structure for modifiers, but has since been superseded
+ * by BMesh, at least for the foreseeable future.
  */
 
+/*
+ * Note: This structure is read-only, for all practical purposes.
+ *       At some point in the future, we may want to consider
+ *       creating a replacement structure that implements a proper
+ *       abstract mesh kernel interface.  Or, we can leave this
+ *       as it is and stick with using BMesh and CDDM.
+ */
+
+
 #include "DNA_customdata_types.h"
+#include "DNA_meshdata_types.h"
+
 #include "BKE_customdata.h"
 #include "BKE_bvhutils.h"
 
@@ -53,20 +81,26 @@ struct MTFace;
 struct Object;
 struct Scene;
 struct Mesh;
-struct EditMesh;
+struct BMEditMesh;
 struct KeyBlock;
 struct ModifierData;
 struct MCol;
 struct ColorBand;
 struct GPUVertexAttribs;
 struct GPUDrawObject;
+struct BMEditMesh;
 struct ListBase;
 struct PBVH;
 
 /* number of sub-elements each mesh element has (for interpolation) */
 #define SUB_ELEMS_VERT 0
 #define SUB_ELEMS_EDGE 2
-#define SUB_ELEMS_FACE 4
+#define SUB_ELEMS_FACE 50
+
+/*
+ * Note: all mface interfaces now officially operate on tessellated data.
+ *       Also, the mface origindex layer indexes mpolys, not mfaces.
+ */
 
 typedef struct DMGridData {
 	float co[3];
@@ -78,41 +112,82 @@ typedef struct DMGridAdjacency {
 	int rotation[4];
 } DMGridAdjacency;
 
+/* keep in sync with MFace/MPoly types */
+typedef struct DMFlagMat {
+	short mat_nr;
+	char flag;
+} DMFlagMat;
+
 typedef enum DerivedMeshType {
 	DM_TYPE_CDDM,
-	DM_TYPE_EDITMESH,
+	DM_TYPE_EDITBMESH,
 	DM_TYPE_CCGDM
 } DerivedMeshType;
 
+typedef enum DMDrawOption {
+	/* the element is hidden or otherwise non-drawable */
+	DM_DRAW_OPTION_SKIP = 0,
+	/* normal drawing */
+	DM_DRAW_OPTION_NORMAL = 1,
+	/* draw, but don't set the color from mcol */
+	DM_DRAW_OPTION_NO_MCOL = 2,
+	/* used in drawMappedFaces, use GL stipple for the face */
+	DM_DRAW_OPTION_STIPPLE = 3,
+} DMDrawOption;
+
+/* Drawing callback types */
+typedef int (*DMSetMaterial)(int mat_nr, void *attribs);
+typedef int (*DMCompareDrawOptions)(void *userData, int cur_index, int next_index);
+typedef void (*DMSetDrawInterpOptions)(void *userData, int index, float t);
+typedef DMDrawOption (*DMSetDrawOptions)(void *userData, int index);
+typedef DMDrawOption (*DMSetDrawOptionsTex)(struct MTFace *tface, int has_vcol, int matnr);
+
+typedef enum DMDrawFlag {
+	DM_DRAW_USE_COLORS = 1,
+	DM_DRAW_ALWAYS_SMOOTH = 2
+} DMDrawFlag;
+
+typedef enum DMDirtyFlag {
+	/* dm has valid tessellated faces, but tessellated CDDATA need to be updated. */
+	DM_DIRTY_TESS_CDLAYERS = 1 << 0,
+} DMDirtyFlag;
+
 typedef struct DerivedMesh DerivedMesh;
 struct DerivedMesh {
 	/* Private DerivedMesh data, only for internal DerivedMesh use */
-	CustomData vertData, edgeData, faceData;
-	int numVertData, numEdgeData, numFaceData;
+	CustomData vertData, edgeData, faceData, loopData, polyData;
+	int numVertData, numEdgeData, numTessFaceData, numLoopData, numPolyData;
 	int needsFree; /* checked on ->release, is set to 0 for cached results */
 	int deformedOnly; /* set by modifier stack if only deformed from original */
 	BVHCache bvhCache;
 	struct GPUDrawObject *drawObject;
 	DerivedMeshType type;
 	float auto_bump_scale;
+	DMDirtyFlag dirty;
+
+	/* calculate vert and face normals */
+	void (*calcNormals)(DerivedMesh *dm);
+
+	/* recalculates mesh tessellation */
+	void (*recalcTessellation)(DerivedMesh *dm);
 
 	/* Misc. Queries */
 
 	/* Also called in Editmode */
 	int (*getNumVerts)(DerivedMesh *dm);
-	/* Also called in Editmode */
-	int (*getNumFaces)(DerivedMesh *dm);
-
 	int (*getNumEdges)(DerivedMesh *dm);
+	int (*getNumTessFaces)(DerivedMesh *dm);
+	int (*getNumLoops)(DerivedMesh *dm);
+	int (*getNumPolys)(DerivedMesh *dm);
 
-	/* copy a single vert/edge/face from the derived mesh into
+	/* copy a single vert/edge/tessellated face from the derived mesh into
 	 * *{vert/edge/face}_r. note that the current implementation
 	 * of this function can be quite slow, iterating over all
 	 * elements (editmesh)
 	 */
 	void (*getVert)(DerivedMesh *dm, int index, struct MVert *vert_r);
 	void (*getEdge)(DerivedMesh *dm, int index, struct MEdge *edge_r);
-	void (*getFace)(DerivedMesh *dm, int index, struct MFace *face_r);
+	void (*getTessFace)(DerivedMesh *dm, int index, struct MFace *face_r);
 
 	/* return a pointer to the entire array of verts/edges/face from the
 	 * derived mesh. if such an array does not exist yet, it will be created,
@@ -121,21 +196,27 @@ struct DerivedMesh {
 	 */
 	struct MVert *(*getVertArray)(DerivedMesh *dm);
 	struct MEdge *(*getEdgeArray)(DerivedMesh *dm);
-	struct MFace *(*getFaceArray)(DerivedMesh *dm);
+	struct MFace *(*getTessFaceArray)(DerivedMesh *dm);
+	struct MLoop *(*getLoopArray)(DerivedMesh *dm);
+	struct MPoly *(*getPolyArray)(DerivedMesh *dm);
 
 	/* copy all verts/edges/faces from the derived mesh into
 	 * *{vert/edge/face}_r (must point to a buffer large enough)
 	 */
 	void (*copyVertArray)(DerivedMesh *dm, struct MVert *vert_r);
 	void (*copyEdgeArray)(DerivedMesh *dm, struct MEdge *edge_r);
-	void (*copyFaceArray)(DerivedMesh *dm, struct MFace *face_r);
+	void (*copyTessFaceArray)(DerivedMesh *dm, struct MFace *face_r);
+	void (*copyLoopArray)(DerivedMesh *dm, struct MLoop *loop_r);
+	void (*copyPolyArray)(DerivedMesh *dm, struct MPoly *poly_r);
 
 	/* return a copy of all verts/edges/faces from the derived mesh
 	 * it is the caller's responsibility to free the returned pointer
 	 */
 	struct MVert *(*dupVertArray)(DerivedMesh *dm);
 	struct MEdge *(*dupEdgeArray)(DerivedMesh *dm);
-	struct MFace *(*dupFaceArray)(DerivedMesh *dm);
+	struct MFace *(*dupTessFaceArray)(DerivedMesh *dm);
+	struct MLoop *(*dupLoopArray)(DerivedMesh *dm);
+	struct MPoly *(*dupPolyArray)(DerivedMesh *dm);
 
 	/* return a pointer to a single element of vert/edge/face custom data
 	 * from the derived mesh (this gives a pointer to the actual data, not
@@ -143,7 +224,7 @@ struct DerivedMesh {
 	 */
 	void *(*getVertData)(DerivedMesh *dm, int index, int type);
 	void *(*getEdgeData)(DerivedMesh *dm, int index, int type);
-	void *(*getFaceData)(DerivedMesh *dm, int index, int type);
+	void *(*getTessFaceData)(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
@@ -151,43 +232,58 @@ struct DerivedMesh {
 	 */
 	void *(*getVertDataArray)(DerivedMesh *dm, int type);
 	void *(*getEdgeDataArray)(DerivedMesh *dm, int type);
-	void *(*getFaceDataArray)(DerivedMesh *dm, int type);
-
+	void *(*getTessFaceDataArray)(DerivedMesh *dm, int type);
+	
+	/* retrieves the base CustomData structures for 
+	 * verts/edges/tessfaces/loops/facdes*/
+	CustomData *(*getVertDataLayout)(DerivedMesh *dm);
+	CustomData *(*getEdgeDataLayout)(DerivedMesh *dm);
+	CustomData *(*getTessFaceDataLayout)(DerivedMesh *dm);
+	CustomData *(*getLoopDataLayout)(DerivedMesh *dm);
+	CustomData *(*getPolyDataLayout)(DerivedMesh *dm);
+	
+	/*copies all customdata for an element source into dst at index dest*/
+	void (*copyFromVertCData)(DerivedMesh *dm, int source, CustomData *dst, int dest);
+	void (*copyFromEdgeCData)(DerivedMesh *dm, int source, CustomData *dst, int dest);
+	void (*copyFromFaceCData)(DerivedMesh *dm, int source, CustomData *dst, int dest);
+	
 	/* optional grid access for subsurf */
 	int (*getNumGrids)(DerivedMesh *dm);
 	int (*getGridSize)(DerivedMesh *dm);
 	DMGridData **(*getGridData)(DerivedMesh *dm);
 	DMGridAdjacency *(*getGridAdjacency)(DerivedMesh *dm);
 	int *(*getGridOffset)(DerivedMesh *dm);
+	DMFlagMat *(*getGridFlagMats)(DerivedMesh *dm);
+	unsigned int **(*getGridHidden)(DerivedMesh *dm);
+	
 
 	/* Iterate over each mapped vertex in the derived mesh, calling the
 	 * given function with the original vert and the mapped vert's new
 	 * coordinate and normal. For historical reasons the normal can be
 	 * passed as a float or short array, only one should be non-NULL.
 	 */
-	void (*foreachMappedVert)(
-						  DerivedMesh *dm,
-						  void (*func)(void *userData, int index, float *co,
-									   float *no_f, short *no_s),
-						  void *userData);
+	void (*foreachMappedVert)(DerivedMesh *dm,
+	                          void (*func)(void *userData, int index, const float co[3],
+	                                       const float no_f[3], const short no_s[3]),
+	                          void *userData);
 
 	/* Iterate over each mapped edge in the derived mesh, calling the
 	 * given function with the original edge and the mapped edge's new
 	 * coordinates.
 	 */
 	void (*foreachMappedEdge)(DerivedMesh *dm,
-							  void (*func)(void *userData, int index,
-										   float *v0co, float *v1co),
-							  void *userData);
+	                          void (*func)(void *userData, int index,
+	                                       const float v0co[3], const float v1co[3]),
+	                          void *userData);
 
 	/* Iterate over each mapped face in the derived mesh, calling the
 	 * given function with the original face and the mapped face's (or
 	 * faces') center and normal.
 	 */
 	void (*foreachMappedFaceCenter)(DerivedMesh *dm,
-									void (*func)(void *userData, int index,
-												 float *cent, float *no),
-									void *userData);
+	                                void (*func)(void *userData, int index,
+	                                             const float cent[3], const float no[3]),
+	                                void *userData);
 
 	/* Iterate over all vertex points, calling DO_MINMAX with given args.
 	 *
@@ -210,7 +306,7 @@ struct DerivedMesh {
 
 	/* Get a map of vertices to faces
 	 */
-	struct ListBase *(*getFaceMap)(struct Object *ob, DerivedMesh *dm);
+	const struct MeshElemMap *(*getPolyMap)(struct Object *ob, DerivedMesh *dm);
 
 	/* Get the BVH used for paint modes
 	 */
@@ -241,33 +337,21 @@ struct DerivedMesh {
 	 * Also called for *final* editmode DerivedMeshes
 	 */
 	void (*drawFacesSolid)(DerivedMesh *dm, float (*partial_redraw_planes)[4],
-						   int fast, int (*setMaterial)(int, void *attribs));
-
-	/* Draw all faces
-	 *  o If useTwoSided, draw front and back using col arrays
-	 *  o col1,col2 are arrays of length numFace*4 of 4 component colors
-	 *    in ABGR format, and should be passed as per-face vertex color.
-	 */
-	void (*drawFacesColored)(DerivedMesh *dm, int useTwoSided,
-							 unsigned char *col1, unsigned char *col2);
+						   int fast, DMSetMaterial setMaterial);
 
 	/* Draw all faces using MTFace 
 	 *  o Drawing options too complicated to enumerate, look at code.
 	 */
 	void (*drawFacesTex)(DerivedMesh *dm,
-						 int (*setDrawOptions)(struct MTFace *tface,
-							 int has_mcol, int matnr),
-						int (*compareDrawOptions)(void *userData,
-							 int cur_index,
-							 int next_index),
-						void *userData);
+	                     DMSetDrawOptionsTex setDrawOptions,
+						 DMCompareDrawOptions compareDrawOptions,
+						 void *userData);
 
 	/* Draw all faces with GLSL materials
 	 *  o setMaterial is called for every different material nr
 	 *  o Only if setMaterial returns true
 	 */
-	void (*drawFacesGLSL)(DerivedMesh *dm,
-		int (*setMaterial)(int, void *attribs));
+	void (*drawFacesGLSL)(DerivedMesh *dm, DMSetMaterial setMaterial);
 
 	/* Draw mapped faces (no color, or texture)
 	 *  o Only if !setDrawOptions or
@@ -283,23 +367,18 @@ struct DerivedMesh {
 	 * smooth shaded.
 	 */
 	void (*drawMappedFaces)(DerivedMesh *dm,
-							int (*setDrawOptions)(void *userData, int index,
-												  int *drawSmooth_r),
-							int (*setMaterial)(int, void *attribs),
-							int (*compareDrawOptions)(void *userData,
-							                          int cur_index,
-							                          int next_index),
-							void *userData, int useColors);
+							DMSetDrawOptions setDrawOptions,
+							DMSetMaterial setMaterial,
+							DMCompareDrawOptions compareDrawOptions,
+							void *userData,
+							DMDrawFlag flag);
 
 	/* Draw mapped faces using MTFace 
 	 *  o Drawing options too complicated to enumerate, look at code.
 	 */
 	void (*drawMappedFacesTex)(DerivedMesh *dm,
-							   int (*setDrawOptions)(void *userData,
-													 int index),
-							   int (*compareDrawOptions)(void *userData,
-							                             int cur_index,
-							                             int next_index),
+							   DMSetDrawOptions setDrawOptions,
+							   DMCompareDrawOptions compareDrawOptions,
 							   void *userData);
 
 	/* Draw mapped faces with GLSL materials
@@ -308,8 +387,8 @@ struct DerivedMesh {
 	 *  o Only if setMaterial and setDrawOptions return true
 	 */
 	void (*drawMappedFacesGLSL)(DerivedMesh *dm,
-		int (*setMaterial)(int, void *attribs),
-		int (*setDrawOptions)(void *userData, int index),
+		DMSetMaterial setMaterial,
+		DMSetDrawOptions setDrawOptions,
 		void *userData);
 
 	/* Draw mapped edges as lines
@@ -317,7 +396,7 @@ struct DerivedMesh {
 	 *    returns true
 	 */
 	void (*drawMappedEdges)(DerivedMesh *dm,
-							int (*setDrawOptions)(void *userData, int index),
+							DMSetDrawOptions setDrawOptions,
 							void *userData);
 
 	/* Draw mapped edges as lines with interpolation values
@@ -328,11 +407,8 @@ struct DerivedMesh {
 	 * NOTE: This routine is optional!
 	 */
 	void (*drawMappedEdgesInterp)(DerivedMesh *dm, 
-								  int (*setDrawOptions)(void *userData,
-														int index), 
-								  void (*setDrawInterpOptions)(void *userData,
-															   int index,
-															   float t),
+								  DMSetDrawOptions setDrawOptions,
+								  DMSetDrawInterpOptions setDrawInterpOptions,
 								  void *userData);
 
 	/* Draw all faces with materials
@@ -348,24 +424,25 @@ struct DerivedMesh {
 	void (*release)(DerivedMesh *dm);
 };
 
-/* utility function to initialise a DerivedMesh's function pointers to
+/* utility function to initialize a DerivedMesh's function pointers to
  * the default implementation (for those functions which have a default)
  */
 void DM_init_funcs(DerivedMesh *dm);
 
-/* utility function to initialise a DerivedMesh for the desired number
+/* utility function to initialize a DerivedMesh for the desired number
  * of vertices, edges and faces (doesn't allocate memory for them, just
  * sets up the custom data layers)
  */
-void DM_init(DerivedMesh *dm, DerivedMeshType type,
-             int numVerts, int numEdges, int numFaces);
+void DM_init(DerivedMesh *dm, DerivedMeshType type, int numVerts, int numEdges, 
+             int numFaces, int numLoops, int numPolys);
 
-/* utility function to initialise a DerivedMesh for the desired number
+/* utility function to initialize a DerivedMesh for the desired number
  * of vertices, edges and faces, with a layer setup copied from source
  */
 void DM_from_template(DerivedMesh *dm, DerivedMesh *source,
-					  DerivedMeshType type,
-					  int numVerts, int numEdges, int numFaces);
+			  DerivedMeshType type,
+			  int numVerts, int numEdges, int numFaces,
+		      int numLoops, int numPolys);
 
 /* utility function to release a DerivedMesh's layers
  * returns 1 if DerivedMesh has to be released by the backend, 0 otherwise
@@ -374,7 +451,15 @@ int DM_release(DerivedMesh *dm);
 
 /* utility function to convert a DerivedMesh to a Mesh
  */
-void DM_to_mesh(DerivedMesh *dm, struct Mesh *me);
+void DM_to_mesh(DerivedMesh *dm, struct Mesh *me, struct Object *ob);
+
+struct BMEditMesh *DM_to_editbmesh(struct DerivedMesh *dm,
+                                   struct BMEditMesh *existing, int do_tessellate);
+
+/* conversion to bmesh only */
+void          DM_to_bmesh_ex(struct DerivedMesh *dm, struct BMesh *bm);
+struct BMesh *DM_to_bmesh(struct DerivedMesh *dm);
+
 
 /* utility function to convert a DerivedMesh to a shape key block 
  */
@@ -392,11 +477,15 @@ void DM_set_only_copy(DerivedMesh *dm, CustomDataMask mask);
  * freed, see BKE_customdata.h for the different options
  */
 void DM_add_vert_layer(struct DerivedMesh *dm, int type, int alloctype,
-					   void *layer);
+                       void *layer);
 void DM_add_edge_layer(struct DerivedMesh *dm, int type, int alloctype,
-					   void *layer);
-void DM_add_face_layer(struct DerivedMesh *dm, int type, int alloctype,
-					   void *layer);
+                       void *layer);
+void DM_add_tessface_layer(struct DerivedMesh *dm, int type, int alloctype,
+                           void *layer);
+void DM_add_loop_layer(DerivedMesh *dm, int type, int alloctype,
+                       void *layer);
+void DM_add_poly_layer(struct DerivedMesh *dm, int type, int alloctype,
+                       void *layer);
 
 /* custom data access functions
  * return pointer to data from first layer which matches type
@@ -405,7 +494,7 @@ void DM_add_face_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_face_data(struct DerivedMesh *dm, int index, int type);
+void *DM_get_tessface_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)
@@ -414,7 +503,9 @@ void *DM_get_face_data(struct DerivedMesh *dm, int index, int type);
  */
 void *DM_get_vert_data_layer(struct DerivedMesh *dm, int type);
 void *DM_get_edge_data_layer(struct DerivedMesh *dm, int type);
-void *DM_get_face_data_layer(struct DerivedMesh *dm, int type);
+void *DM_get_tessface_data_layer(struct DerivedMesh *dm, int type);
+void *DM_get_poly_data_layer(struct DerivedMesh *dm, int type);
+void *DM_get_loop_data_layer(struct DerivedMesh *dm, int type);
 
 /* custom data setting functions
  * copy supplied data into first layer of type using layer's copy function
@@ -422,7 +513,7 @@ void *DM_get_face_data_layer(struct DerivedMesh *dm, int type);
  */
 void DM_set_vert_data(struct DerivedMesh *dm, int index, int type, void *data);
 void DM_set_edge_data(struct DerivedMesh *dm, int index, int type, void *data);
-void DM_set_face_data(struct DerivedMesh *dm, int index, int type, void *data);
+void DM_set_tessface_data(struct DerivedMesh *dm, int index, int type, void *data);
 
 /* custom data copy functions
  * copy count elements from source_index in source to dest_index in dest
@@ -432,7 +523,11 @@ void DM_copy_vert_data(struct DerivedMesh *source, struct DerivedMesh *dest,
 					   int source_index, int dest_index, int count);
 void DM_copy_edge_data(struct DerivedMesh *source, struct DerivedMesh *dest,
 					   int source_index, int dest_index, int count);
-void DM_copy_face_data(struct DerivedMesh *source, struct DerivedMesh *dest,
+void DM_copy_tessface_data(struct DerivedMesh *source, struct DerivedMesh *dest,
+                       int source_index, int dest_index, int count);
+void DM_copy_loop_data(struct DerivedMesh *source, struct DerivedMesh *dest,
+                       int source_index, int dest_index, int count);
+void DM_copy_poly_data(struct DerivedMesh *source, struct DerivedMesh *dest,
 					   int source_index, int dest_index, int count);
 
 /* custom data free functions
@@ -441,7 +536,16 @@ void DM_copy_face_data(struct DerivedMesh *source, struct DerivedMesh *dest,
  */
 void DM_free_vert_data(struct DerivedMesh *dm, int index, int count);
 void DM_free_edge_data(struct DerivedMesh *dm, int index, int count);
-void DM_free_face_data(struct DerivedMesh *dm, int index, int count);
+void DM_free_tessface_data(struct DerivedMesh *dm, int index, int count);
+void DM_free_loop_data(struct DerivedMesh *dm, int index, int count);
+void DM_free_poly_data(struct DerivedMesh *dm, int index, int count);
+
+/*sets up mpolys for a DM based on face iterators in source*/
+void DM_DupPolys(DerivedMesh *source, DerivedMesh *target);
+
+void DM_ensure_tessface(DerivedMesh *dm);
+
+void DM_update_tessface_data(DerivedMesh *dm);
 
 /* interpolates vertex data from the vertices indexed by src_indices in the
  * source mesh using the given weights and stores the result in the vertex
@@ -472,19 +576,27 @@ void DM_interp_edge_data(struct DerivedMesh *source, struct DerivedMesh *dest,
  * vert_weights[i] multiplied by weights[i].
  */
 typedef float FaceVertWeight[SUB_ELEMS_FACE][SUB_ELEMS_FACE];
-void DM_interp_face_data(struct DerivedMesh *source, struct DerivedMesh *dest,
+void DM_interp_tessface_data(struct DerivedMesh *source, struct DerivedMesh *dest,
 						 int *src_indices,
 						 float *weights, FaceVertWeight *vert_weights,
 						 int count, int dest_index);
 
-void DM_swap_face_data(struct DerivedMesh *dm, int index, const int *corner_indices);
+void DM_swap_tessface_data(struct DerivedMesh *dm, int index, const int *corner_indices);
+
+void DM_interp_loop_data(struct DerivedMesh *source, struct DerivedMesh *dest,
+                         int *src_indices,
+                         float *weights, int count, int dest_index);
+
+void DM_interp_poly_data(struct DerivedMesh *source, struct DerivedMesh *dest,
+                         int *src_indices,
+                         float *weights, int count, int dest_index);
 
 /* Temporary? A function to give a colorband to derivedmesh for vertexcolor ranges */
 void vDM_ColorBand_store(struct ColorBand *coba);
 
 /* Simple function to get me->totvert amount of vertices/normals,
-   correctly deformed and subsurfered. Needed especially when vertexgroups are involved.
-   In use now by vertex/weigt paint and particles */
+ * correctly deformed and subsurfered. Needed especially when vertexgroups are involved.
+ * In use now by vertex/weight paint and particles */
 float *mesh_get_mapped_verts_nors(struct Scene *scene, struct Object *ob);
 
 	/* */
@@ -493,11 +605,15 @@ DerivedMesh *mesh_get_derived_final(struct Scene *scene, struct Object *ob,
 DerivedMesh *mesh_get_derived_deform(struct Scene *scene, struct Object *ob,
 									 CustomDataMask dataMask);
 
-DerivedMesh *mesh_create_derived_for_modifier(struct Scene *scene, struct Object *ob, struct ModifierData *md);
+DerivedMesh *mesh_create_derived_for_modifier(struct Scene *scene, struct Object *ob,
+											  struct ModifierData *md, int build_shapekey_layers);
 
 DerivedMesh *mesh_create_derived_render(struct Scene *scene, struct Object *ob,
 										CustomDataMask dataMask);
 
+DerivedMesh *getEditDerivedBMesh(struct BMEditMesh *em, struct Object *ob,
+                                           float (*vertexCos)[3]);
+
 DerivedMesh *mesh_create_derived_index_render(struct Scene *scene, struct Object *ob, CustomDataMask dataMask, int index);
 
 		/* same as above but wont use render settings */
@@ -516,27 +632,22 @@ DerivedMesh *mesh_create_derived_no_virtual(struct Scene *scene, struct Object *
 DerivedMesh *mesh_create_derived_physics(struct Scene *scene, struct Object *ob, float (*vertCos)[3],
 											CustomDataMask dataMask);
 
-DerivedMesh *editmesh_get_derived(struct EditMesh *em, float (*vertexCos)[3]);
-DerivedMesh *editmesh_get_derived_base(struct Object *, struct EditMesh *em);
-DerivedMesh *editmesh_get_derived_cage(struct Scene *scene, struct Object *, 
-									   struct EditMesh *em, CustomDataMask dataMask);
-DerivedMesh *editmesh_get_derived_cage_and_final(struct Scene *scene, struct Object *, 
-												 struct EditMesh *em, DerivedMesh **final_r,
+DerivedMesh *editbmesh_get_derived_base(struct Object *, struct BMEditMesh *em);
+DerivedMesh *editbmesh_get_derived_cage(struct Scene *scene, struct Object *, 
+									   struct BMEditMesh *em, CustomDataMask dataMask);
+DerivedMesh *editbmesh_get_derived_cage_and_final(struct Scene *scene, struct Object *, 
+						 struct BMEditMesh *em, DerivedMesh **final_r,
 												 CustomDataMask dataMask);
-float (*editmesh_get_vertex_cos(struct EditMesh *em, int *numVerts_r))[3];
-int editmesh_modifier_is_enabled(struct Scene *scene, struct ModifierData *md, DerivedMesh *dm);
-void makeDerivedMesh(struct Scene *scene, struct Object *ob, struct EditMesh *em, CustomDataMask dataMask);
+float (*editbmesh_get_vertex_cos(struct BMEditMesh *em, int *numVerts_r))[3];
+int editbmesh_modifier_is_enabled(struct Scene *scene, struct ModifierData *md, DerivedMesh *dm);
+void makeDerivedMesh(struct Scene *scene, struct Object *ob, struct BMEditMesh *em, 
+	CustomDataMask dataMask, int build_shapekey_layers);
 
 /* returns an array of deform matrices for crazyspace correction, and the
-   number of modifiers left */
-int editmesh_get_first_deform_matrices(struct Scene *, struct Object *, struct EditMesh *em,
+ * number of modifiers left */
+int editbmesh_get_first_deform_matrices(struct Scene *, struct Object *, struct BMEditMesh *em,
 									   float (**deformmats)[3][3], float (**deformcos)[3]);
 
-/* returns an array of deform matrices for crazyspace correction when sculpting,
-   and the number of modifiers left */
-int sculpt_get_deform_matrices(struct Scene *scene, struct Object *ob,
-								float (**deformmats)[3][3], float (**deformcos)[3]);
-
 void weight_to_rgb(float r_rgb[3], const float weight);
 /* Update the weight MCOL preview layer.
  * If weights are NULL, use object's active vgroup(s).
@@ -574,16 +685,6 @@ typedef struct DMVertexAttribs {
 	int tottface, totmcol, tottang, totorco;
 } DMVertexAttribs;
 
-/* should be local, bmesh replaces this */
-typedef struct {
-	DerivedMesh dm;
-
-	struct EditMesh *em;
-	float (*vertexCos)[3];
-	float (*vertexNos)[3];
-	float (*faceNos)[3];
-} EditMeshDerivedMesh;
-
 void DM_vertex_attributes_from_gpu(DerivedMesh *dm,
 	struct GPUVertexAttribs *gattribs, DMVertexAttribs *attribs);
 
@@ -593,6 +694,8 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm);
 /* Set object's bounding box based on DerivedMesh min/max data */
 void DM_set_object_boundbox(struct Object *ob, DerivedMesh *dm);
 
+void DM_init_origspace(DerivedMesh *dm);
+
 /* debug only */
 #ifndef NDEBUG
 char *DM_debug_info(DerivedMesh *dm);
diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h
index 67efb77..564cd23 100644
--- a/source/blender/blenkernel/BKE_action.h
+++ b/source/blender/blenkernel/BKE_action.h
@@ -24,8 +24,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_ACTION_H
-#define BKE_ACTION_H
+#ifndef __BKE_ACTION_H__
+#define __BKE_ACTION_H__
 /** \file BKE_action.h
  *  \ingroup bke
  *  \brief Blender kernel action and pose functionality.
diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h
index a55955c..d605776 100644
--- a/source/blender/blenkernel/BKE_anim.h
+++ b/source/blender/blenkernel/BKE_anim.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_ANIM_H
-#define BKE_ANIM_H
+#ifndef __BKE_ANIM_H__
+#define __BKE_ANIM_H__
 
 /** \file BKE_anim.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h
index 8e5b313..e648523 100644
--- a/source/blender/blenkernel/BKE_animsys.h
+++ b/source/blender/blenkernel/BKE_animsys.h
@@ -23,8 +23,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_ANIM_SYS_H
-#define BKE_ANIM_SYS_H
+#ifndef __BKE_ANIMSYS_H__
+#define __BKE_ANIMSYS_H__
 
 /** \file BKE_animsys.h
  *  \ingroup bke
@@ -81,7 +81,7 @@ void BKE_relink_animdata(struct AnimData *adt);
 /* KeyingSets API */
 
 /* Used to create a new 'custom' KeyingSet for the user, that will be automatically added to the stack */
-struct KeyingSet *BKE_keyingset_add(struct ListBase *list, const char name[], short flag, short keyingflag);
+struct KeyingSet *BKE_keyingset_add(struct ListBase *list, const char idname[], const char name[], short flag, short keyingflag);
 
 /* Add a path to a KeyingSet */
 struct KS_Path *BKE_keyingset_add_path(struct KeyingSet *ks, struct ID *id, const char group_name[], const char rna_path[], int array_index, short flag, short groupmode);
@@ -105,10 +105,12 @@ void BKE_keyingsets_free(struct ListBase *list);
 /* Path Fixing API */
 
 /* Fix all the paths for the given ID+AnimData */
-void BKE_animdata_fix_paths_rename(struct ID *owner_id, struct AnimData *adt, const char *prefix, const char *oldName, const char *newName, int oldSubscript, int newSubscript, int verify_paths);
+void BKE_animdata_fix_paths_rename(struct ID *owner_id, struct AnimData *adt, struct ID *ref_id, const char *prefix,
+                                   const char *oldName, const char *newName, int oldSubscript, int newSubscript,
+                                   int verify_paths);
 
 /* Fix all the paths for the entire database... */
-void BKE_all_animdata_fix_paths_rename(const char *prefix, const char *oldName, const char *newName);
+void BKE_all_animdata_fix_paths_rename(ID *ref_id, const char *prefix, const char *oldName, const char *newName);
 
 /* -------------------------------------- */
 
@@ -160,4 +162,4 @@ void animsys_evaluate_action_group(struct PointerRNA *ptr, struct bAction *act,
 
 /* ************************************* */
 
-#endif /* BKE_ANIM_SYS_H*/
+#endif /* __BKE_ANIMSYS_H__*/
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h
index 07d8d69..dfe3fde 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_ARMATURE_H
-#define BKE_ARMATURE_H
+#ifndef __BKE_ARMATURE_H__
+#define __BKE_ARMATURE_H__
 
 /** \file BKE_armature.h
  *  \ingroup bke
@@ -82,11 +82,14 @@ void free_armature(struct bArmature *arm);
 void make_local_armature(struct bArmature *arm);
 struct bArmature *copy_armature(struct bArmature *arm);
 
+/* Bounding box. */
+struct BoundBox *BKE_armature_get_bb(struct Object *ob);
+
 int bone_autoside_name (char name[64], int strip_number, short axis, float head, float tail);
 
 struct Bone *get_named_bone (struct bArmature *arm, const char *name);
 
-float distfactor_to_bone(const float vec[3], const float b1[3], const float b2[3], float rad1, float rad2, float rdist);
+float distfactor_to_bone(const float vec[3], const float b1[3], const float b2[3], float r1, float r2, float rdist);
 
 void where_is_armature (struct bArmature *arm);
 void where_is_armature_bone(struct Bone *bone, struct Bone *prevbone);
@@ -97,16 +100,17 @@ void where_is_pose_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(float *vec, float roll, float mat[][3]);
+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);
 
 int get_selected_defgroups(struct Object *ob, char *defbase_sel, int defbase_len);
 
 /* Common Conversions Between Co-ordinate Spaces */
 void armature_mat_world_to_pose(struct Object *ob, float inmat[][4], float outmat[][4]);
-void armature_loc_world_to_pose(struct Object *ob, float *inloc, float *outloc);
+void armature_loc_world_to_pose(struct Object *ob, const float inloc[3], float outloc[3]);
 void armature_mat_pose_to_bone(struct bPoseChannel *pchan, float inmat[][4], float outmat[][4]);
-void armature_loc_pose_to_bone(struct bPoseChannel *pchan, float *inloc, float *outloc);
+void armature_loc_pose_to_bone(struct bPoseChannel *pchan, const float inloc[3], float outloc[3]);
+void armature_mat_bone_to_pose(struct bPoseChannel *pchan, float inmat[][4], float outmat[][4]);
 void armature_mat_pose_to_delta(float delta_mat[][4], float pose_mat[][4], float arm_mat[][4]);
 
 void armature_mat_pose_to_bone_ex(struct Object *ob, struct bPoseChannel *pchan, float inmat[][4], float outmat[][4]);
@@ -132,7 +136,6 @@ Mat4 *b_bone_spline_setup(struct bPoseChannel *pchan, int rest);
 
 /* like EBONE_VISIBLE */
 #define PBONE_VISIBLE(arm, bone) (((bone)->layer & (arm)->layer) && !((bone)->flag & BONE_HIDDEN_P))
-#define _BONE_VISIBLE(arm, bone) (((bone)->layer & (arm)->layer) && !((bone)->flag & BONE_HIDDEN_P))
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index c5a5c13..5afe27f 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_BLENDER_H
-#define BKE_BLENDER_H
+#ifndef __BKE_BLENDER_H__
+#define __BKE_BLENDER_H__
 
 /** \file BKE_blender.h
  *  \ingroup bke
@@ -41,7 +41,7 @@ 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			262
+#define BLENDER_VERSION			263
 #define BLENDER_SUBVERSION		0
 
 #define BLENDER_MINVERSION		250
diff --git a/source/blender/blenkernel/BKE_bmesh.h b/source/blender/blenkernel/BKE_bmesh.h
index c8df6c4..bcb50a9 100644
--- a/source/blender/blenkernel/BKE_bmesh.h
+++ b/source/blender/blenkernel/BKE_bmesh.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_BMESH_H
-#define BKE_BMESH_H
+#ifndef __BKE_BMESH_H__
+#define __BKE_BMESH_H__
 
 /** \file BKE_bmesh.h
  *  \ingroup bke
@@ -35,157 +35,10 @@
  *
  */
 
-#include "DNA_listBase.h"
-#include "BLI_utildefines.h"
-#include "BLI_ghash.h"
-#include "BLI_mempool.h"
-#include "BLI_memarena.h"
-#include "DNA_image_types.h"
-#include "BLI_editVert.h"
-#include "BKE_DerivedMesh.h"
-//XXX #include "transform.h"
+/*NOTE: this is the bmesh 1.0 code.  it's completely outdated.*/
 
-/*forward declerations*/
-struct BME_Vert;
-struct BME_Edge;
-struct BME_Poly;
-struct BME_Loop;
-
-
-/*Notes on further structure Cleanup:
-	-Remove the tflags, they belong in custom data layers
-	-Remove the eflags completely, they are mostly not used
-	-Remove the selection/vis/bevel weight flag/values ect and move them to custom data
-	-Remove EID member and move to custom data
-	-Add a radial cycle length, disk cycle length and loop cycle length attributes to custom data and have eulers maintain/use them if present.
-	-Move data such as vertex coordinates/normals to custom data and leave pointers in structures to active layer data.
-	-Remove BME_CycleNode structure?
-*/
-typedef struct BME_CycleNode{
-	struct BME_CycleNode *next, *prev;
-	void *data;
-} BME_CycleNode;
-
-typedef struct BME_Mesh
-{
-	ListBase verts, edges, polys;
-	/*memory pools used for storing mesh elements*/
-	struct BLI_mempool *vpool;
-	struct BLI_mempool *epool;
-	struct BLI_mempool *ppool;
-	struct BLI_mempool *lpool;
-	/*some scratch arrays used by eulers*/
-	struct BME_Vert **vtar;
-	struct BME_Edge **edar;
-	struct BME_Loop **lpar;
-	struct BME_Poly **plar;
-	int vtarlen, edarlen, lparlen, plarlen;
-	int totvert, totedge, totpoly, totloop;				/*record keeping*/
-	int nextv, nexte, nextp, nextl;						/*Next element ID for verts/edges/faces/loops. Never reused*/
-	struct CustomData vdata, edata, pdata, ldata;	/*Custom Data Layer information*/
-} BME_Mesh;
-
-typedef struct BME_Vert
-{
-	struct BME_Vert *next, *prev;
-	int	EID;
-	float co[3];									
-	float no[3];									
-	struct BME_Edge *edge;							/*first edge in the disk cycle for this vertex*/
-	void *data;										/*custom vertex data*/
-	int eflag1, eflag2;								/*reserved for use by eulers*/
-	int tflag1, tflag2;								/*reserved for use by tools*/
-	unsigned short flag, h;
-	float bweight;
-} BME_Vert;
-
-typedef struct BME_Edge
-{
-	struct BME_Edge *next, *prev;
-	int EID;
-	struct BME_Vert *v1, *v2;						/*note that order of vertex pointers means nothing to eulers*/
-	struct BME_CycleNode d1, d2;					/*disk cycle nodes for v1 and v2 respectivley*/
-	struct BME_Loop *loop;							/*first BME_Loop in the radial cycle around this edge*/
-	void *data;										/*custom edge data*/
-	int eflag1, eflag2;								/*reserved for use by eulers*/
-	int tflag1, tflag2;								/*reserved for use by tools*/
-	unsigned short flag, h;
-	float crease, bweight;
-} BME_Edge;
-
-typedef struct BME_Loop 
-{	
-	struct BME_Loop *next, *prev;					/*circularly linked list around face*/
-	int EID;
-	struct BME_CycleNode radial;					/*circularly linked list used to find faces around an edge*/
-	struct BME_Vert *v;								/*vertex that this loop starts at.*/
-	struct BME_Edge *e;								/*edge this loop belongs to*/
-	struct BME_Poly *f;								/*face this loop belongs to*/	
-	void *data;										/*custom per face vertex data*/
-	int eflag1, eflag2;								/*reserved for use by eulers*/
-	int tflag1, tflag2;								/*reserved for use by tools*/
-	unsigned short flag, h;
-} BME_Loop;
-
-typedef struct BME_Poly
-{
-	struct BME_Poly *next, *prev;
-	int EID;
-	struct BME_Loop *loopbase;						/*First editloop around Polygon.*/
-	unsigned int len;								/*total length of the face. Eulers should preserve this data*/
-	void *data;										/*custom face data*/
-	int eflag1, eflag2;								/*reserved for use by eulers*/
-	int tflag1, tflag2;								/*reserved for use by tools*/
-	unsigned short flag, h, mat_nr;
-} BME_Poly;
-
-/*EDGE UTILITIES*/
-int BME_verts_in_edge(struct BME_Vert *v1, struct BME_Vert *v2, struct BME_Edge *e);
-int BME_vert_in_edge(struct BME_Edge *e, BME_Vert *v);
-struct BME_Vert *BME_edge_getothervert(struct BME_Edge *e, struct BME_Vert *v);
-
-/*GENERAL CYCLE*/
-int BME_cycle_length(void *h);
-
-/*DISK CYCLE*/
-struct BME_Edge *BME_disk_nextedge(struct BME_Edge *e, struct BME_Vert *v); 
-struct BME_CycleNode *BME_disk_getpointer(struct BME_Edge *e, struct BME_Vert *v);
-struct BME_Edge *BME_disk_next_edgeflag(struct BME_Edge *e, struct BME_Vert *v, int eflag, int tflag);
-int BME_disk_count_edgeflag(struct BME_Vert *v, int eflag, int tflag);
-
-/*RADIAL CYCLE*/
-struct BME_Loop *BME_radial_nextloop(struct BME_Loop *l);
-int BME_radial_find_face(struct BME_Edge *e,struct BME_Poly *f);
-
-/*LOOP CYCLE*/
-struct BME_Loop *BME_loop_find_loop(struct BME_Poly *f, struct BME_Vert *v);
-
-/*MESH CREATION/DESTRUCTION*/
-struct BME_Mesh *BME_make_mesh(int allocsize[4]);
-void BME_free_mesh(struct BME_Mesh *bm);
-/*FULL MESH VALIDATION*/
-int BME_validate_mesh(struct BME_Mesh *bm, int halt);
-/*ENTER/EXIT MODELLING LOOP*/
-int BME_model_begin(struct BME_Mesh *bm);
-void BME_model_end(struct BME_Mesh *bm);
-
-/*MESH CONSTRUCTION API.*/
-/*MAKE*/
-struct BME_Vert *BME_MV(struct BME_Mesh *bm, float *vec);
-struct BME_Edge *BME_ME(struct BME_Mesh *bm, struct BME_Vert *v1, struct BME_Vert *v2);
-struct BME_Poly *BME_MF(struct BME_Mesh *bm, struct BME_Vert *v1, struct BME_Vert *v2, struct BME_Edge **elist, int len);
-/*KILL*/
-int BME_KV(struct BME_Mesh *bm, struct BME_Vert *v);
-int BME_KE(struct BME_Mesh *bm, struct BME_Edge *e);
-int BME_KF(struct BME_Mesh *bm, struct BME_Poly *bply);
-/*SPLIT*/
-struct BME_Vert *BME_SEMV(struct BME_Mesh *bm, struct BME_Vert *tv, struct BME_Edge *e, struct BME_Edge **re);
-struct BME_Poly *BME_SFME(struct BME_Mesh *bm, struct BME_Poly *f, struct BME_Vert *v1, struct BME_Vert *v2, struct BME_Loop **rl);
-/*JOIN*/
-int BME_JEKV(struct BME_Mesh *bm, struct BME_Edge *ke, struct BME_Vert *kv);
-struct BME_Poly *BME_JFKE(struct BME_Mesh *bm, struct BME_Poly *f1, struct BME_Poly *f2,struct BME_Edge *e); /*no reason to return BME_Poly pointer?*/
-/*NORMAL FLIP(Is its own inverse)*/
-int BME_loop_reverse(struct BME_Mesh *bm, struct BME_Poly *f);
+/* uncomment to use the new bevel operator as a modifier */
+// #define USE_BM_BEVEL_OP_AS_MOD
 
 /* bevel tool defines */
 /* element flags */
@@ -208,9 +61,13 @@ int BME_loop_reverse(struct BME_Mesh *bm, struct BME_Poly *f);
 #define BME_BEVEL_RUNNING		(1<<9)
 #define BME_BEVEL_RES			(1<<10)
 
+#define BME_BEVEL_EVEN			(1<<11) /* this is a new setting not related to old (trunk bmesh bevel code) but adding
+                                         * here because they are mixed - campbell */
+#define BME_BEVEL_DIST			(1<<12) /* same as above */
+
 typedef struct BME_TransData {
-	BME_Mesh *bm; /* the bmesh the vert belongs to */
-	BME_Vert *v;  /* pointer to the vert this tdata applies to */
+	struct BMesh *bm; /* the bmesh the vert belongs to */
+	struct BMVert *v;  /* pointer to the vert this tdata applies to */
 	float co[3];  /* the original coordinate */
 	float org[3]; /* the origin */
 	float vec[3]; /* a directional vector; always, always normalize! */
@@ -225,13 +82,14 @@ typedef struct BME_TransData {
 } BME_TransData;
 
 typedef struct BME_TransData_Head {
-	GHash *gh;       /* the hash structure for element lookup */
-	MemArena *ma;    /* the memory "pool" we will be drawing individual elements from */
+	struct GHash *gh;       /* the hash structure for element lookup */
+	struct MemArena *ma;    /* the memory "pool" we will be drawing individual elements from */
 	int len;
 } BME_TransData_Head;
 
+/* this is no longer used */
 typedef struct BME_Glob { /* stored in Global G for Transform() purposes */
-	BME_Mesh *bm;
+	struct BMesh *bm;
 	BME_TransData_Head *td;
 	struct TransInfo *Trans; /* a pointer to the global Trans struct */
 	int imval[2]; /* for restoring original mouse co when initTransform() is called multiple times */
@@ -239,14 +97,9 @@ typedef struct BME_Glob { /* stored in Global G for Transform() purposes */
 	int res;
 } BME_Glob;
 
-struct BME_TransData *BME_get_transdata(struct BME_TransData_Head *td, struct BME_Vert *v);
+struct BME_TransData *BME_get_transdata(struct BME_TransData_Head *td, struct BMVert *v);
 void BME_free_transdata(struct BME_TransData_Head *td);
-float *BME_bevel_calc_polynormal(struct BME_Poly *f, struct BME_TransData_Head *td);
-struct BME_Mesh *BME_bevel(struct BME_Mesh *bm, float value, int res, int options, int defgrp_index, float angle, BME_TransData_Head **rtd);
+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);
 
-/*CONVERSION FUNCTIONS*/
-struct BME_Mesh *BME_editmesh_to_bmesh(EditMesh *em);
-void   BME_bmesh_to_editmesh(struct BME_Mesh *bm, BME_TransData_Head *td, EditMesh *em);
-struct BME_Mesh *BME_derivedmesh_to_bmesh(struct DerivedMesh *dm);
-struct DerivedMesh *BME_bmesh_to_derivedmesh(struct BME_Mesh *bm, struct DerivedMesh *dm);
 #endif
diff --git a/source/blender/blenkernel/BKE_bmeshCustomData.h b/source/blender/blenkernel/BKE_bmeshCustomData.h
deleted file mode 100644
index 7934103..0000000
--- a/source/blender/blenkernel/BKE_bmeshCustomData.h
+++ /dev/null
@@ -1,105 +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) 2004 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Geoffrey Bantle.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-
-#ifndef BKE_BMESHCUSTOMDATA_H
-#define BKE_BMESHCUSTOMDATA_H
-
-/** \file BKE_bmeshCustomData.h
- *  \ingroup bke
- *  \since January 2007
- *  \brief BMesh modeler structure and functions - custom data.
- */
-
-struct BLI_mempool;
-
-/*Custom Data Types and defines
-	Eventual plan is to move almost everything to custom data and let caller
-	decide when making the mesh what layers they want to store in the mesh
-
-	This stuff should probably go in a seperate file....
-*/
-
-#define BME_CD_FACETEX		0		/*Image texture/texface*/
-#define BME_CD_LOOPTEX		1		/*UV coordinates*/
-#define BME_CD_LOOPCOL		2		/*Vcolors*/
-#define BME_CD_DEFORMVERT	3		/*Vertex Group/Weights*/
-#define BME_CD_NUMTYPES		4
-
-typedef struct BME_CustomDataLayer {
-	int type;       				/* type of data in layer */
-	int offset;     				/* offset of layer in block */
-	int active;     				/* offset of active layer*/
-	char name[32];  				/* layer name */
-} BME_CustomDataLayer;
-
-typedef struct BME_CustomData {
-	struct BME_CustomDataLayer *layers;	/*Custom Data Layers*/
-	struct BLI_mempool *pool;				/*pool for alloc of blocks*/
-	int totlayer, totsize;         	/*total layers and total size in bytes of each block*/
-} BME_CustomData;
-
-typedef struct BME_CustomDataInit{
-	int layout[BME_CD_NUMTYPES];
-	int active[BME_CD_NUMTYPES];
-	int totlayers;
-	char *nametemplate;
-} BME_CustomDataInit;
-
-/*Custom data types*/
-typedef struct BME_DeformWeight {
-	int				def_nr;
-	float			weight;
-} BME_DeformWeight;
-
-typedef struct BME_DeformVert {
-	struct BME_DeformWeight *dw;
-	int totweight;
-} BME_DeformVert;
-
-typedef struct BME_facetex{
-	struct Image *tpage;
-	char flag, transp;
-	short mode, tile, unwrap;
-}BME_facetex;
-
-typedef struct BME_looptex{
-	float u, v;
-}BME_looptex;
-
-typedef struct BME_loopcol{
-	char r, g, b, a;
-}BME_loopcol;
-
-/*CUSTOM DATA API*/
-void BME_CD_Create(struct BME_CustomData *data, struct BME_CustomDataInit *init, int initalloc);
-void BME_CD_Free(struct BME_CustomData *data);
-void BME_CD_free_block(struct BME_CustomData *data, void **block);
-void BME_CD_copy_data(const struct BME_CustomData *source, struct BME_CustomData *dest, void *src_block, void **dest_block);
-void BME_CD_set_default(struct BME_CustomData *data, void **block);
-
-#endif
diff --git a/source/blender/blenkernel/BKE_bmfont.h b/source/blender/blenkernel/BKE_bmfont.h
index 71fd2ae..6c0cbe3 100644
--- a/source/blender/blenkernel/BKE_bmfont.h
+++ b/source/blender/blenkernel/BKE_bmfont.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_BMFONT_H
-#define BKE_BMFONT_H
+#ifndef __BKE_BMFONT_H__
+#define __BKE_BMFONT_H__
 
 /** \file BKE_bmfont.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/BKE_bmfont_types.h b/source/blender/blenkernel/BKE_bmfont_types.h
index a4d3706..a5be0be 100644
--- a/source/blender/blenkernel/BKE_bmfont_types.h
+++ b/source/blender/blenkernel/BKE_bmfont_types.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_BMFONT_TYPES_H
-#define BKE_BMFONT_TYPES_H
+#ifndef __BKE_BMFONT_TYPES_H__
+#define __BKE_BMFONT_TYPES_H__
 
 /** \file BKE_bmfont_types.h
  *  \ingroup bke
@@ -34,10 +34,11 @@
  */
 #define is_power_of_two(N) ((N ^ (N - 1)) == (2 * N - 1))
 /*
-Moved to IMB_imbuf_types.h where it will live close to the ImBuf type.
-It is used as a userflag bit mask.
-#define IB_BITMAPFONT 1
-*/
+ * Moved to IMB_imbuf_types.h where it will live close to the ImBuf type.
+ * It is used as a userflag bit mask.
+ */
+// #define IB_BITMAPFONT 1
+
 typedef struct bmGlyph {
 	unsigned short unicode;
 	short locx, locy;
diff --git a/source/blender/blenkernel/BKE_boids.h b/source/blender/blenkernel/BKE_boids.h
index 18e8be1..bb724c6 100644
--- a/source/blender/blenkernel/BKE_boids.h
+++ b/source/blender/blenkernel/BKE_boids.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_BOIDS_H
-#define BKE_BOIDS_H
+#ifndef __BKE_BOIDS_H__
+#define __BKE_BOIDS_H__
 
 /** \file BKE_boids.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/BKE_booleanops_mesh.h b/source/blender/blenkernel/BKE_booleanops_mesh.h
index 4c4a2dc..2e48b66 100644
--- a/source/blender/blenkernel/BKE_booleanops_mesh.h
+++ b/source/blender/blenkernel/BKE_booleanops_mesh.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_BOOLEANOPS_MESH_H
-#define BKE_BOOLEANOPS_MESH_H
+#ifndef __BKE_BOOLEANOPS_MESH_H__
+#define __BKE_BOOLEANOPS_MESH_H__
 
 /** \file BKE_booleanops_mesh.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h
index 13f7263..1ff9bc4 100644
--- a/source/blender/blenkernel/BKE_brush.h
+++ b/source/blender/blenkernel/BKE_brush.h
@@ -26,8 +26,8 @@
  * General operations for brushes.
  */
 
-#ifndef BKE_BRUSH_H
-#define BKE_BRUSH_H
+#ifndef __BKE_BRUSH_H__
+#define __BKE_BRUSH_H__
 
 /** \file BKE_brush.h
  *  \ingroup bke
@@ -52,7 +52,6 @@ void brush_reset_sculpt(struct Brush *brush);
 struct ImBuf *get_brush_icon(struct Brush *brush);
 
 /* brush library operations used by different paint panels */
-int brush_delete(struct Brush **current_brush);
 int brush_texture_set_nr(struct Brush *brush, int nr);
 int brush_texture_delete(struct Brush *brush);
 int brush_clone_image_set_nr(struct Brush *brush, int nr);
@@ -60,7 +59,7 @@ int brush_clone_image_delete(struct Brush *brush);
 
 /* jitter */
 void brush_jitter_pos(const struct Scene *scene, struct Brush *brush,
-					  float *pos, float *jitterpos);
+                      const float pos[2], float jitterpos[2]);
 
 /* brush curve */
 void brush_curve_preset(struct Brush *b, /*enum CurveMappingPreset*/int preset);
@@ -75,13 +74,13 @@ void brush_imbuf_new(const struct Scene *scene, struct Brush *brush, short flt,
 /* painting */
 struct BrushPainter;
 typedef struct BrushPainter BrushPainter;
-typedef int (*BrushFunc)(void *user, struct ImBuf *ibuf, float *lastpos, float *pos);
+typedef int (*BrushFunc)(void *user, struct ImBuf *ibuf, const float lastpos[2], const float pos[2]);
 
 BrushPainter *brush_painter_new(struct Scene *scene, struct Brush *brush);
 void brush_painter_require_imbuf(BrushPainter *painter, short flt,
-	short texonly, int size);
-int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos,
-	double time, float pressure, void *user, int use_color_correction);
+                                 short texonly, int size);
+int brush_painter_paint(BrushPainter *painter, BrushFunc func, const float pos[2],
+                        double time, float pressure, void *user, int use_color_correction);
 void brush_painter_break_stroke(BrushPainter *painter);
 void brush_painter_free(BrushPainter *painter);
 
diff --git a/source/blender/blenkernel/BKE_bullet.h b/source/blender/blenkernel/BKE_bullet.h
index 5eb653f..2103eea 100644
--- a/source/blender/blenkernel/BKE_bullet.h
+++ b/source/blender/blenkernel/BKE_bullet.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_BULLET_H
-#define BKE_BULLET_H
+#ifndef __BKE_BULLET_H__
+#define __BKE_BULLET_H__
 
 /** \file BKE_bullet.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/BKE_bvhutils.h b/source/blender/blenkernel/BKE_bvhutils.h
index 07f0c2f..ab3d751 100644
--- a/source/blender/blenkernel/BKE_bvhutils.h
+++ b/source/blender/blenkernel/BKE_bvhutils.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_BVHUTILS_H
-#define BKE_BVHUTILS_H
+#ifndef __BKE_BVHUTILS_H__
+#define __BKE_BVHUTILS_H__
 
 /** \file BKE_bvhutils.h
  *  \ingroup bke
@@ -75,7 +75,7 @@ typedef struct BVHTreeFromMesh
  *
  * The tree is build in mesh space coordinates, this means special care must be made on queries
  * so that the coordinates and rays are first translated on the mesh local coordinates.
- * Reason for this is that later bvh_from_mesh_* might use a cache system and so it becames possible to reuse
+ * Reason for this is that later bvh_from_mesh_* might use a cache system and so it becomes possible to reuse
  * a BVHTree.
  * 
  * free_bvhtree_from_mesh should be called when the tree is no longer needed.
@@ -88,7 +88,7 @@ BVHTree* bvhtree_from_mesh_verts(struct BVHTreeFromMesh *data, struct DerivedMes
  *
  * The tree is build in mesh space coordinates, this means special care must be made on queries
  * so that the coordinates and rays are first translated on the mesh local coordinates.
- * Reason for this is that later bvh_from_mesh_* might use a cache system and so it becames possible to reuse
+ * Reason for this is that later bvh_from_mesh_* might use a cache system and so it becomes possible to reuse
  * a BVHTree.
  *
  * The returned value is the same as in data->tree, its only returned to make it easier to test
@@ -106,8 +106,8 @@ BVHTree* bvhtree_from_mesh_edges(struct BVHTreeFromMesh *data, struct DerivedMes
 void free_bvhtree_from_mesh(struct BVHTreeFromMesh *data);
 
 /*
-* Math functions used by callbacks
-*/
+ * Math functions used by callbacks
+ */
 float bvhtree_ray_tri_intersection(const BVHTreeRay *ray, const float m_dist, const float v0[3], const float v1[3], const float v2[3]);
 float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const float v2[3], const float p[3], int *v, int *e, float nearest[3]);
 
@@ -124,7 +124,7 @@ typedef struct LinkNode* BVHCache;
 
 
 /*
- * Queries a bvhcache for the chache bvhtree of the request type
+ * Queries a bvhcache for the cache bvhtree of the request type
  */
 BVHTree *bvhcache_find(BVHCache *cache, int type);
 
diff --git a/source/blender/blenkernel/BKE_camera.h b/source/blender/blenkernel/BKE_camera.h
index 72e22dc..6d10219 100644
--- a/source/blender/blenkernel/BKE_camera.h
+++ b/source/blender/blenkernel/BKE_camera.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_CAMERA_H
-#define BKE_CAMERA_H
+#ifndef __BKE_CAMERA_H__
+#define __BKE_CAMERA_H__
 
 /** \file BKE_camera.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/BKE_cdderivedmesh.h b/source/blender/blenkernel/BKE_cdderivedmesh.h
index c71c86e..bdfe736 100644
--- a/source/blender/blenkernel/BKE_cdderivedmesh.h
+++ b/source/blender/blenkernel/BKE_cdderivedmesh.h
@@ -32,27 +32,34 @@
  *   mesh elements (vertices, edges and faces) as layers of custom element data.
  */
 
-#ifndef BKE_CDDERIVEDMESH_H
-#define BKE_CDDERIVEDMESH_H
+#ifndef __BKE_CDDERIVEDMESH_H__
+#define __BKE_CDDERIVEDMESH_H__
 
 #include "BKE_DerivedMesh.h"
 
 struct DerivedMesh;
-struct EditMesh;
+struct BMEditMesh;
 struct Mesh;
 struct Object;
 
 /* creates a new CDDerivedMesh */
-struct DerivedMesh *CDDM_new(int numVerts, int numEdges, int numFaces);
+struct DerivedMesh *CDDM_new(int numVerts, int numEdges, int numFaces,
+                             int numLoops, int numPolys);
+
+/*tests if a given DerivedMesh is a CDDM*/
+int CDDM_Check(struct DerivedMesh *dm);
 
 /* creates a CDDerivedMesh from the given Mesh, this will reference the
-   original data in Mesh, but it is safe to apply vertex coordinates or
-   calculate normals as those functions will automtically create new
-   data to not overwrite the original */
+ * original data in Mesh, but it is safe to apply vertex coordinates or
+ * calculate normals as those functions will automatically create new
+ * data to not overwrite the original */
 struct DerivedMesh *CDDM_from_mesh(struct Mesh *mesh, struct Object *ob);
 
-/* creates a CDDerivedMesh from the given EditMesh */
-struct DerivedMesh *CDDM_from_editmesh(struct EditMesh *em, struct Mesh *me);
+/* creates a CDDerivedMesh from the given BMEditMesh */
+DerivedMesh *CDDM_from_BMEditMesh(struct BMEditMesh *em, struct Mesh *me, int use_mdisps, int use_tessface);
+
+/* merge verts  */
+DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap);
 
 /* creates a CDDerivedMesh from the given curve object */
 struct DerivedMesh *CDDM_from_curve(struct Object *ob);
@@ -65,13 +72,20 @@ DerivedMesh *CDDM_from_curve_customDB(struct Object *ob, struct ListBase *dispba
  * custom element data.
  */
 struct DerivedMesh *CDDM_copy(struct DerivedMesh *dm);
+struct DerivedMesh *CDDM_copy_from_tessface(struct DerivedMesh *dm);
 
 /* creates a CDDerivedMesh with the same layer stack configuration as the
  * given DerivedMesh and containing the requested numbers of elements.
- * elements are initialised to all zeros
+ * elements are initialized to all zeros
  */
 struct DerivedMesh *CDDM_from_template(struct DerivedMesh *source,
-								  int numVerts, int numEdges, int numFaces);
+                                  int numVerts, int numEdges, int numFaces,
+                                  int numLoops, int numPolys);
+
+/*converts mfaces to mpolys.  note things may break if there are not valid
+ *medges surrounding each mface.
+ */
+void CDDM_tessfaces_to_faces(struct DerivedMesh *dm);
 
 /* applies vertex coordinates or normals to a CDDerivedMesh. if the MVert
  * layer is a referenced layer, it will be duplicate to not overwrite the
@@ -82,19 +96,32 @@ void CDDM_apply_vert_normals(struct DerivedMesh *cddm, short (*vertNormals)[3]);
 
 /* recalculates vertex and face normals for a CDDerivedMesh
  */
+void CDDM_calc_normals_mapping_ex(struct DerivedMesh *dm, const short only_face_normals);
+void CDDM_calc_normals_mapping(struct DerivedMesh *dm);
 void CDDM_calc_normals(struct DerivedMesh *dm);
+void CDDM_calc_normals_tessface(struct DerivedMesh *dm);
 
 /* calculates edges for a CDDerivedMesh (from face data)
  * this completely replaces the current edge data in the DerivedMesh
+ * builds edges from the tessellated face data.
  */
+void CDDM_calc_edges_tessface(struct DerivedMesh *dm);
+
+/* same as CDDM_calc_edges_tessface only makes edges from ngon faces instead of tessellation
+ * faces*/
 void CDDM_calc_edges(struct DerivedMesh *dm);
 
+/* reconstitute face triangulation */
+void CDDM_recalc_tessellation(struct DerivedMesh *dm);
+void CDDM_recalc_tessellation_ex(struct DerivedMesh *dm, const int do_face_nor_cpy);
+
 /* lowers the number of vertices/edges/faces in a CDDerivedMesh
  * the layer data stays the same size
  */
 void CDDM_lower_num_verts(struct DerivedMesh *dm, int numVerts);
 void CDDM_lower_num_edges(struct DerivedMesh *dm, int numEdges);
-void CDDM_lower_num_faces(struct DerivedMesh *dm, int numFaces);
+void CDDM_lower_num_polys(struct DerivedMesh *dm, int numPolys);
+void CDDM_lower_num_tessfaces(DerivedMesh *dm, int numTessFaces);
 
 /* vertex/edge/face access functions
  * should always succeed if index is within bounds
@@ -102,7 +129,9 @@ void CDDM_lower_num_faces(struct DerivedMesh *dm, int numFaces);
  */
 struct MVert *CDDM_get_vert(struct DerivedMesh *dm, int index);
 struct MEdge *CDDM_get_edge(struct DerivedMesh *dm, int index);
-struct MFace *CDDM_get_face(struct DerivedMesh *dm, int index);
+struct MFace *CDDM_get_tessface(struct DerivedMesh *dm, int index);
+struct MLoop *CDDM_get_loop(struct DerivedMesh *dm, int index);
+struct MPoly *CDDM_get_poly(struct DerivedMesh *dm, int index);
 
 /* vertex/edge/face array access functions - return the array holding the
  * desired data
@@ -111,6 +140,18 @@ struct MFace *CDDM_get_face(struct DerivedMesh *dm, int index);
  */
 struct MVert *CDDM_get_verts(struct DerivedMesh *dm);
 struct MEdge *CDDM_get_edges(struct DerivedMesh *dm);
-struct MFace *CDDM_get_faces(struct DerivedMesh *dm);
+struct MFace *CDDM_get_tessfaces(struct DerivedMesh *dm);
+struct MLoop *CDDM_get_loops(struct DerivedMesh *dm);
+struct MPoly *CDDM_get_polys(struct DerivedMesh *dm);
+
+/* Assigns news m*** layers to the cddm.  Note that you must handle
+ * freeing the old ones yourself.  Also you must ensure dm->num****Data
+ * is correct.*/
+void CDDM_set_mvert(struct DerivedMesh *dm, struct MVert *mvert);
+void CDDM_set_medge(struct DerivedMesh *dm, struct MEdge *medge);
+void CDDM_set_mface(struct DerivedMesh *dm, struct MFace *mface);
+void CDDM_set_mloop(struct DerivedMesh *dm, struct MLoop *mloop);
+void CDDM_set_mpoly(struct DerivedMesh *dm, struct MPoly *mpoly);
+
 #endif
 
diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h
index 6d42b8d..623dbd9 100644
--- a/source/blender/blenkernel/BKE_cloth.h
+++ b/source/blender/blenkernel/BKE_cloth.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_CLOTH_H
-#define BKE_CLOTH_H
+#ifndef __BKE_CLOTH_H__
+#define __BKE_CLOTH_H__
 
 /** \file BKE_cloth.h
  *  \ingroup bke
@@ -51,7 +51,7 @@ struct CollisionTree;
 #define SOFTGOALSNAP  0.999f
 
 /* This is approximately the smallest number that can be
-* represented by a float, given its precision. */
+ * represented by a float, given its precision. */
 #define ALMOST_ZERO		FLT_EPSILON
 
 /* Bits to or into the ClothVertex.flags. */
@@ -60,15 +60,15 @@ struct CollisionTree;
 #define CLOTH_VERT_FLAG_PINNED_EM 3
 
 /**
-* This structure describes a cloth object against which the
-* simulation can run.
-*
-* The m and n members of this structure represent the assumed
-* rectangular ordered grid for which the original paper is written.
-* At some point they need to disappear and we need to determine out
-* own connectivity of the mesh based on the actual edges in the mesh.
-*
-**/
+ * This structure describes a cloth object against which the
+ * simulation can run.
+ *
+ * The m and n members of this structure represent the assumed
+ * rectangular ordered grid for which the original paper is written.
+ * At some point they need to disappear and we need to determine out
+ * own connectivity of the mesh based on the actual edges in the mesh.
+ *
+ */
 typedef struct Cloth
 {
 	struct ClothVertex	*verts;			/* The vertices that represent this cloth. */
@@ -94,12 +94,12 @@ typedef struct Cloth
 typedef struct ClothVertex
 {
 	int	flags;		/* General flags per vertex.		*/
-	float	v [3];		/* The velocity of the point.		*/
-	float	xconst [3];	/* constrained position			*/
-	float	x [3];		/* The current position of this vertex.	*/
-	float 	xold [3];	/* The previous position of this vertex.*/
-	float	tx [3];		/* temporary position */
-	float 	txold [3];	/* temporary old position */
+	float	v[3];		/* The velocity of the point.		*/
+	float	xconst[3];	/* constrained position			*/
+	float	x[3];		/* The current position of this vertex.	*/
+	float 	xold[3];	/* The previous position of this vertex.*/
+	float	tx[3];		/* temporary position */
+	float 	txold[3];	/* temporary old position */
 	float 	tv[3];		/* temporary "velocity", mostly used as tv = tx-txold */
 	float 	mass;		/* mass / weight of the vertex		*/
 	float 	goal;		/* goal, from SB			*/
@@ -198,38 +198,32 @@ int cloth_bvh_objcollision (struct Object *ob, struct ClothModifierData * clmd,
 ////////////////////////////////////////////////
 
 // needed for cloth.c
-int implicit_init ( struct Object *ob, struct ClothModifierData *clmd );
-int implicit_free ( struct ClothModifierData *clmd );
-int implicit_solver ( struct Object *ob, float frame, struct ClothModifierData *clmd, struct ListBase *effectors );
-void implicit_set_positions ( struct ClothModifierData *clmd );
-
-// globally needed
-void clmdSetInterruptCallBack ( int ( *f ) ( void ) );
-////////////////////////////////////////////////
-
+int implicit_init (struct Object *ob, struct ClothModifierData *clmd );
+int implicit_free (struct ClothModifierData *clmd );
+int implicit_solver (struct Object *ob, float frame, struct ClothModifierData *clmd, struct ListBase *effectors );
+void implicit_set_positions (struct ClothModifierData *clmd );
 
 /////////////////////////////////////////////////
 // cloth.c
 ////////////////////////////////////////////////
 
 // needed for modifier.c
-void cloth_free_modifier_extern ( struct ClothModifierData *clmd );
-void cloth_free_modifier ( struct ClothModifierData *clmd );
-void cloth_init ( struct ClothModifierData *clmd );
-void clothModifier_do ( struct ClothModifierData *clmd, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm, float (*vertexCos)[3]);
+void cloth_free_modifier_extern (struct ClothModifierData *clmd );
+void cloth_free_modifier (struct ClothModifierData *clmd );
+void cloth_init (struct ClothModifierData *clmd );
+void clothModifier_do (struct ClothModifierData *clmd, struct Scene *scene, struct Object *ob, struct DerivedMesh *dm, float (*vertexCos)[3]);
 
-void cloth_update_normals ( ClothVertex *verts, int nVerts, struct MFace *face, int totface );
 int cloth_uses_vgroup(struct ClothModifierData *clmd);
 
 // needed for collision.c
-void bvhtree_update_from_cloth ( struct ClothModifierData *clmd, int moving );
-void bvhselftree_update_from_cloth ( struct ClothModifierData *clmd, int moving );
+void bvhtree_update_from_cloth (struct ClothModifierData *clmd, int moving );
+void bvhselftree_update_from_cloth (struct ClothModifierData *clmd, int moving );
 
 // needed for button_object.c
-void cloth_clear_cache ( struct Object *ob, struct ClothModifierData *clmd, float framenr );
+void cloth_clear_cache (struct Object *ob, struct ClothModifierData *clmd, float framenr );
 
 // needed for cloth.c
-int cloth_add_spring ( struct ClothModifierData *clmd, unsigned int indexA, unsigned int indexB, float restlength, int spring_type);
+int cloth_add_spring (struct ClothModifierData *clmd, unsigned int indexA, unsigned int indexB, float restlength, int spring_type);
 
 ////////////////////////////////////////////////
 
@@ -243,14 +237,14 @@ typedef enum
 
 
 /* This structure defines how to call the solver.
-*/
+ */
 typedef struct
 {
 	const char		*name;
 	CM_SOLVER_ID	id;
-	int	( *init ) ( struct Object *ob, struct ClothModifierData *clmd );
-	int	( *solver ) ( struct Object *ob, float framenr, struct ClothModifierData *clmd, struct ListBase *effectors );
-	int	( *free ) ( struct ClothModifierData *clmd );
+	int	( *init ) (struct Object *ob, struct ClothModifierData *clmd );
+	int	( *solver ) (struct Object *ob, float framenr, struct ClothModifierData *clmd, struct ListBase *effectors );
+	int	( *free ) (struct ClothModifierData *clmd );
 }
 CM_SOLVER_DEF;
 
diff --git a/source/blender/blenkernel/BKE_collision.h b/source/blender/blenkernel/BKE_collision.h
index acb3ae0..24bce63 100644
--- a/source/blender/blenkernel/BKE_collision.h
+++ b/source/blender/blenkernel/BKE_collision.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_COLLISIONS_H
-#define BKE_COLLISIONS_H
+#ifndef __BKE_COLLISION_H__
+#define __BKE_COLLISION_H__
 
 /** \file BKE_collision.h
  *  \ingroup bke
@@ -130,25 +130,19 @@ FaceCollPair;
 // used in modifier.c from collision.c
 /////////////////////////////////////////////////
 
-BVHTree *bvhtree_build_from_mvert ( struct MFace *mfaces, unsigned int numfaces, struct MVert *x, unsigned int numverts, float epsilon );
-void bvhtree_update_from_mvert ( BVHTree * bvhtree, struct MFace *faces, int numfaces, struct MVert *x, struct MVert *xnew, int numverts, int moving );
+BVHTree *bvhtree_build_from_mvert(struct MFace *mfaces, unsigned int numfaces, struct MVert *x, unsigned int numverts, float epsilon );
+void bvhtree_update_from_mvert(BVHTree * bvhtree, struct MFace *faces, int numfaces, struct MVert *x, struct MVert *xnew, int numverts, int moving );
 
 /////////////////////////////////////////////////
 
-struct LinkNode *BLI_linklist_append_fast ( struct LinkNode **listp, void *ptr );
-
 // move Collision modifier object inter-frame with step = [0,1]
 // defined in collisions.c
-void collision_move_object ( struct CollisionModifierData *collmd, float step, float prevstep );
-
-// interface for collision functions
-void collisions_compute_barycentric ( float pv[3], float p1[3], float p2[3], float p3[3], float *w1, float *w2, float *w3 );
-void interpolateOnTriangle ( float to[3], float v1[3], float v2[3], float v3[3], double w1, double w2, double w3 );
+void collision_move_object(struct CollisionModifierData *collmd, float step, float prevstep);
 
 /////////////////////////////////////////////////
 // used in effect.c
 /////////////////////////////////////////////////
-struct Object **get_collisionobjects(struct Scene *scene, struct Object *self, struct Group *group, unsigned int *numcollobj);
+struct Object **get_collisionobjects(struct Scene *scene, struct Object *self, struct Group *group, unsigned int *numcollobj, unsigned int modifier_type);
 
 typedef struct ColliderCache {
 	struct ColliderCache *next, *prev;
diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h
index b358209..1da0caf 100644
--- a/source/blender/blenkernel/BKE_colortools.h
+++ b/source/blender/blenkernel/BKE_colortools.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL/BL DUAL LICENSE BLOCK *****
  */
-#ifndef BKE_COLORTOOLS_H
-#define BKE_COLORTOOLS_H
+#ifndef __BKE_COLORTOOLS_H__
+#define __BKE_COLORTOOLS_H__
 
 /** \file BKE_colortools.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h
index 925d118..f834ad5 100644
--- a/source/blender/blenkernel/BKE_constraint.h
+++ b/source/blender/blenkernel/BKE_constraint.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_CONSTRAINT_H
-#define BKE_CONSTRAINT_H
+#ifndef __BKE_CONSTRAINT_H__
+#define __BKE_CONSTRAINT_H__
 
 /** \file BKE_constraint.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h
index 0aefe22..b2bd840 100644
--- a/source/blender/blenkernel/BKE_context.h
+++ b/source/blender/blenkernel/BKE_context.h
@@ -23,8 +23,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_CONTEXT_H
-#define BKE_CONTEXT_H
+#ifndef __BKE_CONTEXT_H__
+#define __BKE_CONTEXT_H__
 
 /** \file BKE_context.h
  *  \ingroup bke
@@ -39,7 +39,6 @@ extern "C" {
 
 struct ARegion;
 struct bScreen;
-struct EditMesh;
 struct ListBase;
 struct Main;
 struct Object;
@@ -118,6 +117,7 @@ bContext *CTX_copy(const bContext *C);
 /* Stored Context */
 
 bContextStore *CTX_store_add(ListBase *contexts, const char *name, PointerRNA *ptr);
+bContextStore *CTX_store_add_all(ListBase *contexts, bContextStore *context);
 void CTX_store_set(bContext *C, bContextStore *store);
 bContextStore *CTX_store_copy(bContextStore *store);
 void CTX_store_free(bContextStore *store);
@@ -171,10 +171,10 @@ const char *CTX_wm_operator_poll_msg_get(struct bContext *C);
 void CTX_wm_operator_poll_msg_set(struct bContext *C, const char *msg);
 
 /* Data Context
-
-   - listbases consist of CollectionPointerLink items and must be
-	 freed with BLI_freelistN!
-   - the dir listbase consits of LinkData items */
+ *
+ * - listbases consist of CollectionPointerLink items and must be
+ *   freed with BLI_freelistN!
+ * - the dir listbase consits of LinkData items */
 
 /* data type, needed so we can tell between a NULL pointer and an empty list */
 enum {
@@ -202,16 +202,21 @@ short CTX_data_type_get(struct bContextDataResult *result);
 int CTX_data_equals(const char *member, const char *str);
 int CTX_data_dir(const char *member);
 
-/*void CTX_data_pointer_set(bContextDataResult *result, void *data);
-void CTX_data_list_add(bContextDataResult *result, void *data);*/
+#if 0
+void CTX_data_pointer_set(bContextDataResult *result, void *data);
+void CTX_data_list_add(bContextDataResult *result, void *data);
+#endif
 
 #define CTX_DATA_BEGIN(C, Type, instance, member)                             \
 	{                                                                         \
 		ListBase ctx_data_list;                                               \
 		CollectionPointerLink *ctx_link;                                      \
 		CTX_data_##member(C, &ctx_data_list);                                 \
-		for(ctx_link=ctx_data_list.first; ctx_link; ctx_link=ctx_link->next) {\
-			Type instance= ctx_link->ptr.data;
+		for (ctx_link = ctx_data_list.first;                                  \
+		     ctx_link;                                                        \
+		     ctx_link = ctx_link->next)                                       \
+		{                                                                     \
+			Type instance = ctx_link->ptr.data;
 
 #define CTX_DATA_END                                                          \
 		}                                                                     \
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h
index f070474..fa3a1a6 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_CURVE_H
-#define BKE_CURVE_H
+#ifndef __BKE_CURVE_H__
+#define __BKE_CURVE_H__
 
 /** \file BKE_curve.h
  *  \ingroup bke
@@ -54,27 +54,27 @@ struct Scene;
 #define CU_DO_RADIUS(cu, nu) ((CU_DO_TILT(cu, nu) || ((cu)->flag & CU_PATH_RADIUS) || (cu)->bevobj || (cu)->ext1!=0.0f || (cu)->ext2!=0.0f) ? 1:0)
 
 
-void unlink_curve( struct Curve *cu);
+void unlink_curve(struct Curve *cu);
 void free_curve_editNurb_keyIndex(struct EditNurb *editnurb);
 void free_curve_editNurb(struct Curve *cu);
-void free_curve( struct Curve *cu);
+void free_curve(struct Curve *cu);
 void BKE_free_editfont(struct Curve *cu);
 struct Curve *add_curve(const char *name, int type);
-struct Curve *copy_curve( struct Curve *cu);
-void make_local_curve( struct Curve *cu);
+struct Curve *copy_curve(struct Curve *cu);
+void make_local_curve(struct Curve *cu);
 struct ListBase *curve_editnurbs(struct Curve *cu);
-short curve_type( struct Curve *cu);
-void test_curve_type( struct Object *ob);
-void update_curve_dimension( struct Curve *cu );
-void tex_space_curve( struct Curve *cu);
-int count_curveverts( struct ListBase *nurb);
-int count_curveverts_without_handles( struct ListBase *nurb);
-void freeNurb( struct Nurb *nu);
-void freeNurblist( struct ListBase *lb);
-struct Nurb *duplicateNurb( struct Nurb *nu);
-void duplicateNurblist( struct ListBase *lb1,  struct ListBase *lb2);
-void test2DNurb( struct Nurb *nu);
-void minmaxNurb( struct Nurb *nu, float *min, float *max);
+short curve_type(struct Curve *cu);
+void test_curve_type(struct Object *ob);
+void update_curve_dimension(struct Curve *cu );
+void tex_space_curve(struct Curve *cu);
+int count_curveverts(struct ListBase *nurb);
+int count_curveverts_without_handles(struct ListBase *nurb);
+void freeNurb(struct Nurb *nu);
+void freeNurblist(struct ListBase *lb);
+struct Nurb *duplicateNurb(struct Nurb *nu);
+void duplicateNurblist(struct ListBase *lb1,  struct ListBase *lb2);
+void test2DNurb(struct Nurb *nu);
+void minmaxNurb(struct Nurb *nu, float *min, float *max);
 
 void nurbs_knot_calc_u(struct Nurb *nu);
 void nurbs_knot_calc_v(struct Nurb *nu);
@@ -83,19 +83,19 @@ void makeNurbfaces(struct Nurb *nu, float *coord_array, int rowstride, int resol
 void makeNurbcurve(struct Nurb *nu, float *coord_array, float *tilt_array, float *radius_array, float *weight_array, int resolu, int stride);
 void forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride);
 float *make_orco_curve(struct Scene *scene, struct Object *ob);
-float *make_orco_surf( struct Object *ob);
+float *make_orco_surf(struct Object *ob);
 void makebevelcurve(struct Scene *scene, struct Object *ob,  struct ListBase *disp, int forRender);
 
-void makeBevelList( struct Object *ob);
+void makeBevelList(struct Object *ob);
 
-void calchandleNurb( struct BezTriple *bezt, struct BezTriple *prev,  struct BezTriple *next, int mode);
-void calchandlesNurb( struct Nurb *nu);
-void testhandlesNurb( struct Nurb *nu);
-void autocalchandlesNurb( struct Nurb *nu, int flag);
+void calchandleNurb(struct BezTriple *bezt, struct BezTriple *prev,  struct BezTriple *next, int mode);
+void calchandlesNurb(struct Nurb *nu);
+void testhandlesNurb(struct Nurb *nu);
+void autocalchandlesNurb(struct Nurb *nu, int flag);
 void autocalchandlesNurb_all(ListBase *editnurb, int flag);
 void sethandlesNurb(ListBase *editnurb, short code);
 
-void switchdirectionNurb( struct Nurb *nu);
+void switchdirectionNurb(struct Nurb *nu);
 
 void addNurbPoints(struct Nurb *nu, int number);
 void addNurbPointsBezier(struct Nurb *nu, int number);
@@ -107,11 +107,11 @@ float (*curve_getKeyVertexCos(struct Curve *cu, struct ListBase *lb, float *key)
 void curve_applyKeyVertexTilts(struct Curve *cu, struct ListBase *lb, float *key);
 
 /* nurb checks if they can be drawn, also clamp order func */
-int check_valid_nurb_u( struct Nurb *nu);
-int check_valid_nurb_v( struct Nurb *nu);
+int check_valid_nurb_u(struct Nurb *nu);
+int check_valid_nurb_v(struct Nurb *nu);
 
-int clamp_nurb_order_u( struct Nurb *nu);
-int clamp_nurb_order_v( struct Nurb *nu);
+int clamp_nurb_order_u(struct Nurb *nu);
+int clamp_nurb_order_v(struct Nurb *nu);
 
 ListBase *BKE_curve_nurbs(struct Curve *cu);
 
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h
index 7ad25ac..6a3625e 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -31,8 +31,8 @@
  *  \brief CustomData interface, see also DNA_customdata_types.h.
  */
 
-#ifndef BKE_CUSTOMDATA_H
-#define BKE_CUSTOMDATA_H
+#ifndef __BKE_CUSTOMDATA_H__
+#define __BKE_CUSTOMDATA_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -40,11 +40,15 @@ extern "C" {
 
 #include "../blenloader/BLO_sys_types.h" /* XXX, should have a more generic include for this */
 
+struct BMesh;
 struct ID;
 struct CustomData;
 struct CustomDataLayer;
 typedef uint64_t CustomDataMask;
 
+/*a data type large enough to hold 1 element from any customdata layer type*/
+typedef struct {unsigned char data[64];} CDBlockBytes;
+
 extern const CustomDataMask CD_MASK_BAREMESH;
 extern const CustomDataMask CD_MASK_MESH;
 extern const CustomDataMask CD_MASK_EDITMESH;
@@ -55,7 +59,7 @@ extern const CustomDataMask CD_MASK_FACECORNERS;
 /* for ORIGINDEX layer type, indicates no original index for this element */
 #define ORIGINDEX_NONE -1
 
-/* initialises a CustomData object with the same layer setup as source and
+/* initializes a CustomData object with the same layer setup as source and
  * memory space for totelem elements. mask must be an array of length
  * CD_NUMTYPES elements, that indicate if a layer can be copied. */
 
@@ -65,11 +69,31 @@ extern const CustomDataMask CD_MASK_FACECORNERS;
 #define CD_DEFAULT   2  /* allocate and set to default */
 #define CD_REFERENCE 3  /* use data pointers, set layer flag NOFREE */
 #define CD_DUPLICATE 4  /* do a full copy of all layers, only allowed if source
-						   has same number of elements */
+                         * has same number of elements */
 
 #define CD_TYPE_AS_MASK(_type) (CustomDataMask)((CustomDataMask)1 << (CustomDataMask)(_type))
 
-/* initialises a CustomData object with the same layer setup as source.
+/**
+ * Checks if the layer at physical offset \a layer_n (in data->layers) support math
+ * the below operations.
+ */
+int CustomData_layer_has_math(struct CustomData *data, int layer_n);
+
+/* 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
+ * implemented for mloopuv/mloopcol, for now.*/
+void CustomData_data_copy_value(int type, void *source, void *dest);
+
+/* compares if data1 is equal to data2.  type is a valid CustomData type
+ * enum (e.g. CD_MLOOPUV). the layer type's equal function is used to compare
+ * the data, if it exists, otherwise memcmp is used.*/
+int CustomData_data_equals(int type, void *data1, void *data2);
+void CustomData_data_initminmax(int type, void *min, void *max);
+void CustomData_data_dominmax(int type, void *data, void *min, void *max);
+void CustomData_data_multiply(int type, void *data, float fac);
+void CustomData_data_add(int type, void *data1, void *data2);
+
+/* initializes a CustomData object with the same layer setup as source.
  * mask is a bitfield where (mask & (1 << (layer type))) indicates
  * if a layer should be copied or not. alloctype must be one of the above. */
 void CustomData_copy(const struct CustomData *source, struct CustomData *dest,
@@ -83,6 +107,12 @@ void CustomData_update_typemap(struct CustomData *data);
 void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
 					  CustomDataMask mask, int alloctype, int totelem);
 
+/* bmesh version of CustomData_merge; merges the layouts of source and dest,
+ * then goes through the mesh and makes sure all the customdata blocks are
+ * consistent with the new layout.*/
+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
  * itself, though)
  */
@@ -95,7 +125,7 @@ void CustomData_free_temporary(struct CustomData *data, int totelem);
  * backed by an external data array. the different allocation types are
  * defined above. returns the data of the layer.
  *
- * in editmode, use EM_add_data_layer instead of this function
+ * in editmode, use EDBM_data_layer_add instead of this function
  */
 void *CustomData_add_layer(struct CustomData *data, int type, int alloctype,
 						   void *layer, int totelem);
@@ -106,14 +136,14 @@ void *CustomData_add_layer_named(struct CustomData *data, int type, int alloctyp
 /* frees the active or first data layer with the give type.
  * returns 1 on succes, 0 if no layer with the given type is found
  *
- * in editmode, use EM_free_data_layer instead of this function
+ * in editmode, use EDBM_data_layer_free instead of this function
  */
 int CustomData_free_layer(struct CustomData *data, int type, int totelem, int index);
 
 /* frees the layer index with the give type.
  * returns 1 on succes, 0 if no layer with the given type is found
  *
- * in editmode, use EM_free_data_layer instead of this function
+ * in editmode, use EDBM_data_layer_free instead of this function
  */
 int CustomData_free_layer_active(struct CustomData *data, int type, int totelem);
 
@@ -149,13 +179,9 @@ void CustomData_copy_data(const struct CustomData *source,
 						  struct CustomData *dest, int source_index,
 						  int dest_index, int count);
 void CustomData_copy_elements(int type, void *source, void *dest, int count);
-void CustomData_em_copy_data(const struct CustomData *source,
-							struct CustomData *dest, void *src_block,
-							void **dest_block);
 void CustomData_bmesh_copy_data(const struct CustomData *source, 
                                 struct CustomData *dest, void *src_block, 
                                 void **dest_block);
-void CustomData_em_validate_data(struct CustomData *data, void *block, int sub_elements);
 
 /* frees data in a CustomData object
  * return 1 on success, 0 on failure
@@ -179,17 +205,14 @@ 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_em_interp(struct CustomData *data,  void **src_blocks,
-						  float *weights, float *sub_weights, int count,
-						  void *dest_block);
 void CustomData_bmesh_interp(struct CustomData *data, void **src_blocks, 
 							 float *weights, float *sub_weights, int count, 
 							 void *dest_block);
 
 
 /* swaps the data in the element corners, to new corners with indices as
-   specified in corner_indices. for edges this is an array of length 2, for
-   faces an array of length 4 */
+ * specified in corner_indices. for edges this is an array of length 2, for
+ * faces an array of length 4 */
 void CustomData_swap(struct CustomData *data, int index, const int *corner_indices);
 
 /* gets a pointer to the data element at index from the first layer of type
@@ -197,8 +220,6 @@ void CustomData_swap(struct CustomData *data, int index, const int *corner_indic
  */
 void *CustomData_get(const struct CustomData *data, int index, int type);
 void *CustomData_get_n(const struct CustomData *data, int type, int index, int n);
-void *CustomData_em_get(const struct CustomData *data, void *block, int type);
-void *CustomData_em_get_n(const struct CustomData *data, void *block, int type, int n);
 void *CustomData_bmesh_get(const struct CustomData *data, void *block, int type);
 void *CustomData_bmesh_get_n(const struct CustomData *data, void *block, int type, int n);
 
@@ -234,10 +255,6 @@ int CustomData_get_stencil_layer(const struct CustomData *data, int type);
  */
 void CustomData_set(const struct CustomData *data, int index, int type,
 					void *source);
-void CustomData_em_set(struct CustomData *data, void *block, int type,
-					   void *source);
-void CustomData_em_set_n(struct CustomData *data, void *block, int type, int n,
-						 void *source);
 
 void CustomData_bmesh_set(const struct CustomData *data, void *block, int type, 
 						  void *source);
@@ -271,19 +288,11 @@ void CustomData_set_layer_stencil_index(struct CustomData *data, int type, int n
 /* adds flag to the layer flags */
 void CustomData_set_layer_flag(struct CustomData *data, int type, int flag);
 
-/* alloc/free a block of custom data attached to one element in editmode */
-void CustomData_em_set_default(struct CustomData *data, void **block);
-void CustomData_em_free_block(struct CustomData *data, void **block);
-
 void CustomData_bmesh_set_default(struct CustomData *data, void **block);
 void CustomData_bmesh_free_block(struct CustomData *data, void **block);
 
 /* copy custom data to/from layers as in mesh/derivedmesh, to editmesh
-   blocks of data. the CustomData's must not be compatible  */
-void CustomData_to_em_block(const struct CustomData *source,
-							struct CustomData *dest, int index, void **block);
-void CustomData_from_em_block(const struct CustomData *source,
-							  struct CustomData *dest, void *block, int index);
+ * blocks of data. the CustomData's must not be compatible */
 void CustomData_to_bmesh_block(const struct CustomData *source, 
 							struct CustomData *dest, int src_index, void **dest_block);
 void CustomData_from_bmesh_block(const struct CustomData *source, 
@@ -303,14 +312,15 @@ void CustomData_set_layer_unique_name(struct CustomData *data, int index);
 void CustomData_validate_layer_name(const struct CustomData *data, int type, char *name, char *outname);
 
 /* for file reading compatibility, returns false if the layer was freed,
-   only after this test passes, layer->data should be assigned */
+ * only after this test passes, layer->data should be assigned */
 int CustomData_verify_versions(struct CustomData *data, int index);
 
 /*BMesh specific customdata stuff*/
 void CustomData_to_bmeshpoly(struct CustomData *fdata, struct CustomData *pdata,
-                             struct CustomData *ldata);
+                             struct CustomData *ldata, int totloop, int totpoly);
 void CustomData_from_bmeshpoly(struct CustomData *fdata, struct CustomData *pdata, struct CustomData *ldata, int total);
-void CustomData_bmesh_init_pool(struct CustomData *data, int allocsize);
+void CustomData_bmesh_update_active_layers(struct CustomData *fdata, struct CustomData *pdata, struct CustomData *ldata);
+void CustomData_bmesh_init_pool(struct CustomData *data, int totelem, const char htype);
 
 /* External file storage */
 
diff --git a/source/blender/blenkernel/BKE_customdata_file.h b/source/blender/blenkernel/BKE_customdata_file.h
index be7aaa7..c4c41c2 100644
--- a/source/blender/blenkernel/BKE_customdata_file.h
+++ b/source/blender/blenkernel/BKE_customdata_file.h
@@ -18,8 +18,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_CUSTOMDATA_FILE_H
-#define BKE_CUSTOMDATA_FILE_H
+#ifndef __BKE_CUSTOMDATA_FILE_H__
+#define __BKE_CUSTOMDATA_FILE_H__
 
 /** \file BKE_customdata_file.h
  *  \ingroup bke
@@ -57,5 +57,5 @@ void cdf_remove(const char *filename);
 CDataFileLayer *cdf_layer_find(CDataFile *cdf, int type, const char *name);
 CDataFileLayer *cdf_layer_add(CDataFile *cdf, int type, const char *name, size_t datasize);
 
-#endif /* BKE_CUSTOMDATA_FILE_H */
+#endif /* __BKE_CUSTOMDATA_FILE_H__ */
 
diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h
index 1174789..17275b6 100644
--- a/source/blender/blenkernel/BKE_deform.h
+++ b/source/blender/blenkernel/BKE_deform.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_DEFORM_H
-#define BKE_DEFORM_H
+#ifndef __BKE_DEFORM_H__
+#define __BKE_DEFORM_H__
 
 /** \file BKE_deform.h
  *  \ingroup bke
@@ -53,6 +53,7 @@ struct MDeformWeight	*defvert_find_index(const struct MDeformVert *dv, const int
 struct MDeformWeight	*defvert_verify_index(struct MDeformVert *dv, const int defgroup);
 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);
 
 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);
@@ -64,6 +65,7 @@ void defvert_sync_mapped(struct MDeformVert *dvert_dst, const struct MDeformVert
                          const int *flip_map, const int flip_map_len, const int use_verify);
 void defvert_remap (struct MDeformVert *dvert, int *map, const int map_len);
 void defvert_flip(struct MDeformVert *dvert, const int *flip_map, const int flip_map_len);
+void defvert_flip_merged(struct MDeformVert *dvert, const int *flip_map, const int flip_map_len);
 void defvert_normalize(struct MDeformVert *dvert);
 void defvert_normalize_lock(struct MDeformVert *dvert, const int def_nr_lock);
 
diff --git a/source/blender/blenkernel/BKE_depsgraph.h b/source/blender/blenkernel/BKE_depsgraph.h
index 5d47590..b7edf04 100644
--- a/source/blender/blenkernel/BKE_depsgraph.h
+++ b/source/blender/blenkernel/BKE_depsgraph.h
@@ -23,8 +23,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef DEPSGRAPH_API
-#define DEPSGRAPH_API
+#ifndef __BKE_DEPSGRAPH_H__
+#define __BKE_DEPSGRAPH_H__
 
 /** \file BKE_depsgraph.h
  *  \ingroup bke
@@ -34,9 +34,7 @@
 extern "C" {
 #endif
 
-/*
-#define DEPS_DEBUG
-*/
+// #define DEPS_DEBUG
 
 struct ID;
 struct Main;
@@ -97,9 +95,6 @@ short		are_obs_related(struct DagForest	*dag, void *ob1, void *ob2);
 int					is_acyclic(struct DagForest	*dag); //
 //int					get_cycles(struct DagForest	*dag, struct DagNodeQueue **queues, int *count); //
 
-void	boundbox_deps(void);
-void	draw_all_deps(void);
-
 /* ********** API *************** */
 /* Note that the DAG never executes changes in Objects, only sets flags in Objects */
 
diff --git a/source/blender/blenkernel/BKE_displist.h b/source/blender/blenkernel/BKE_displist.h
index 2d86320..5a36add 100644
--- a/source/blender/blenkernel/BKE_displist.h
+++ b/source/blender/blenkernel/BKE_displist.h
@@ -27,8 +27,8 @@
 
 */
 
-#ifndef BKE_DISPLIST_H
-#define BKE_DISPLIST_H
+#ifndef __BKE_DISPLIST_H__
+#define __BKE_DISPLIST_H__
 
 /** \file BKE_displist.h
  *  \ingroup bke
@@ -63,7 +63,6 @@ struct ListBase;
 struct Material;
 struct Bone;
 struct Mesh;
-struct EditMesh;
 struct DerivedMesh;
 
 /* used for curves, nurbs, mball, importing */
diff --git a/source/blender/blenkernel/BKE_dynamicpaint.h b/source/blender/blenkernel/BKE_dynamicpaint.h
index 75b3c5b..a715227 100644
--- a/source/blender/blenkernel/BKE_dynamicpaint.h
+++ b/source/blender/blenkernel/BKE_dynamicpaint.h
@@ -11,8 +11,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_DYNAMIC_PAINT_H_
-#define BKE_DYNAMIC_PAINT_H_
+#ifndef __BKE_DYNAMICPAINT_H__
+#define __BKE_DYNAMICPAINT_H__
 
 struct bContext;
 struct wmOperator;
@@ -32,7 +32,7 @@ typedef struct PaintSurfaceData {
 typedef struct PaintPoint {
 
 	/* Wet paint is handled at effect layer only
-	*  and mixed to surface when drying */
+	 * and mixed to surface when drying */
 	float e_color[3];
 	float e_alpha;
 	float wetness;
@@ -88,4 +88,4 @@ void dynamicPaint_outputSurfaceImage(struct DynamicPaintSurface *surface, char*
 #define DPAINT_WAVE_OBSTACLE 1
 #define DPAINT_WAVE_REFLECT_ONLY 2
 
-#endif /* BKE_DYNAMIC_PAINT_H_ */
+#endif /* __BKE_DYNAMICPAINT_H__ */
diff --git a/source/blender/blenkernel/BKE_effect.h b/source/blender/blenkernel/BKE_effect.h
index 3ebd57d..bb17c89 100644
--- a/source/blender/blenkernel/BKE_effect.h
+++ b/source/blender/blenkernel/BKE_effect.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_EFFECT_H
-#define BKE_EFFECT_H
+#ifndef __BKE_EFFECT_H__
+#define __BKE_EFFECT_H__
 
 /** \file BKE_effect.h
  *  \ingroup bke
@@ -109,10 +109,6 @@ typedef struct EffectorCache {
 	int flag;
 } EffectorCache;
 
-struct Effect *copy_effect(struct Effect *eff);
-void copy_effects(struct ListBase *lbn, struct ListBase *lb);
-void deselectall_eff(struct Object *ob);
-
 void			free_partdeflect(struct PartDeflect *pd);
 struct ListBase *pdInitEffectors(struct Scene *scene, struct Object *ob_src, struct ParticleSystem *psys_src, struct EffectorWeights *weights);
 void			pdEndEffectors(struct ListBase **effectors);
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h
index 27e9140..b615ac6 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -23,8 +23,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_FCURVE_H
-#define BKE_FCURVE_H
+#ifndef __BKE_FCURVE_H__
+#define __BKE_FCURVE_H__
 
 /** \file BKE_fcurve.h
  *  \ingroup bke
@@ -135,7 +135,7 @@ typedef struct FModifierTypeInfo {
 	void (*evaluate_modifier)(struct FCurve *fcu, struct FModifier *fcm, float *cvalue, float evaltime);
 } FModifierTypeInfo;
 
-/* Values which describe the behaviour of a FModifier Type */
+/* Values which describe the behavior of a FModifier Type */
 typedef enum eFMI_Action_Types {
 		/* modifier only modifies values outside of data range */
 	FMI_TYPE_EXTRAPOLATION = 0,
@@ -270,4 +270,4 @@ void fcurve_store_samples(struct FCurve *fcu, void *data, int start, int end, Fc
 }
 #endif
 
-#endif /* BKE_FCURVE_H*/
+#endif /* __BKE_FCURVE_H__*/
diff --git a/source/blender/blenkernel/BKE_fluidsim.h b/source/blender/blenkernel/BKE_fluidsim.h
index 2b2c7a4..c2b1b1d 100644
--- a/source/blender/blenkernel/BKE_fluidsim.h
+++ b/source/blender/blenkernel/BKE_fluidsim.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_FLUIDSIM_H
-#define BKE_FLUIDSIM_H
+#ifndef __BKE_FLUIDSIM_H__
+#define __BKE_FLUIDSIM_H__
 
 /** \file BKE_fluidsim.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/BKE_font.h b/source/blender/blenkernel/BKE_font.h
index e164294..e94787c 100644
--- a/source/blender/blenkernel/BKE_font.h
+++ b/source/blender/blenkernel/BKE_font.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_VFONT_H
-#define BKE_VFONT_H
+#ifndef __BKE_FONT_H__
+#define __BKE_FONT_H__
 
 /** \file BKE_font.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h
index ee3edbb..950c3c2 100644
--- a/source/blender/blenkernel/BKE_global.h
+++ b/source/blender/blenkernel/BKE_global.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_GLOBAL_H
-#define BKE_GLOBAL_H
+#ifndef __BKE_GLOBAL_H__
+#define __BKE_GLOBAL_H__
 
 /** \file BKE_global.h
  *  \ingroup bke
@@ -69,6 +69,7 @@ typedef struct Global {
 
 	short rt;
 	int f;
+	int debug;
 
 	/* Used for BMesh transformations */
 	struct BME_Glob *editBMesh;
@@ -104,7 +105,6 @@ typedef struct Global {
 
 /* #define G_FACESELECT	(1 <<  8) use (mesh->editflag & ME_EDIT_PAINT_MASK) */
 
-#define G_DEBUG			(1 << 12)
 #define G_SCRIPT_AUTOEXEC (1 << 13)
 #define G_SCRIPT_OVERRIDE_PREF (1 << 14) /* when this flag is set ignore the userprefs */
 
@@ -113,6 +113,18 @@ typedef struct Global {
 
 /* #define G_AUTOMATKEYS	(1 << 30)   also removed */
 
+/* G.debug */
+enum {
+	G_DEBUG =           (1 << 0), /* general debug flag, print more info in unexpected cases */
+	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 */
+};
+
+#define G_DEBUG_ALL  (G_DEBUG | G_DEBUG_FFMPEG | G_DEBUG_PYTHON | G_DEBUG_EVENTS | G_DEBUG_WM)
+
+
 /* G.fileflags */
 
 #define G_AUTOPACK               (1 << 0)
@@ -154,6 +166,11 @@ typedef struct Global {
 #  error Either __BIG_ENDIAN__ or __LITTLE_ENDIAN__ must be defined.
 #endif
 
+/* there is really no good place for this */
+#if defined(FREE_WINDOWS) && ((__GNUC__ < 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ < 6)))
+#  error "Mingw requires GCC 4.6 minimum"
+#endif
+
 #define L_ENDIAN	1
 #define B_ENDIAN	0
 
diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h
index dbb1107..bb0216f 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -23,8 +23,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_GPENCIL_H
-#define BKE_GPENCIL_H
+#ifndef __BKE_GPENCIL_H__
+#define __BKE_GPENCIL_H__
 
 /** \file BKE_gpencil.h
  *  \ingroup bke
@@ -63,4 +63,4 @@ struct bGPDlayer *gpencil_layer_getactive(struct bGPdata *gpd);
 void gpencil_layer_setactive(struct bGPdata *gpd, struct bGPDlayer *active);
 void gpencil_layer_delactive(struct bGPdata *gpd);
 
-#endif /*  BKE_GPENCIL_H */
+#endif /*  __BKE_GPENCIL_H__ */
diff --git a/source/blender/blenkernel/BKE_group.h b/source/blender/blenkernel/BKE_group.h
index 044a406..6629f0b 100644
--- a/source/blender/blenkernel/BKE_group.h
+++ b/source/blender/blenkernel/BKE_group.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_GROUP_H
-#define BKE_GROUP_H
+#ifndef __BKE_GROUP_H__
+#define __BKE_GROUP_H__
 
 /** \file BKE_group.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/BKE_icons.h b/source/blender/blenkernel/BKE_icons.h
index ee18a41..e1f8df9 100644
--- a/source/blender/blenkernel/BKE_icons.h
+++ b/source/blender/blenkernel/BKE_icons.h
@@ -25,16 +25,16 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_ICONS_H
-#define BKE_ICONS_H
+#ifndef __BKE_ICONS_H__
+#define __BKE_ICONS_H__
 
 /** \file BKE_icons.h
  *  \ingroup bke
  */
 
 /*
- Resizable Icons for Blender
-*/
+ * Resizable Icons for Blender
+ */
 
 typedef void (*DrawInfoFreeFP) (void *drawinfo);
 
@@ -82,7 +82,7 @@ void BKE_previewimg_free(struct PreviewImage **prv);
 void BKE_previewimg_free_id(struct ID *id);
 
 /* create a new preview image */
-struct PreviewImage* BKE_previewimg_create(void) ;
+struct PreviewImage* BKE_previewimg_create(void);
 
 /* create a copy of the preview image */
 struct PreviewImage* BKE_previewimg_copy(struct PreviewImage *prv);
@@ -90,4 +90,4 @@ struct PreviewImage* BKE_previewimg_copy(struct PreviewImage *prv);
 /* retrieve existing or create new preview image */
 struct PreviewImage* BKE_previewimg_get(struct ID *id);
 
-#endif /*  BKE_ICONS_H */
+#endif /*  __BKE_ICONS_H__ */
diff --git a/source/blender/blenkernel/BKE_idcode.h b/source/blender/blenkernel/BKE_idcode.h
index 57855a7..2a01ef3 100644
--- a/source/blender/blenkernel/BKE_idcode.h
+++ b/source/blender/blenkernel/BKE_idcode.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_ID_INFO_H
-#define BKE_ID_INFO_H
+#ifndef __BKE_IDCODE_H__
+#define __BKE_IDCODE_H__
 
 /** \file BKE_idcode.h
  *  \ingroup bke
@@ -35,8 +35,8 @@
 /**
  * Convert an idcode into a name.
  * 
- * @param code The code to convert.
- * @return A static string representing the name of
+ * \param code The code to convert.
+ * \return A static string representing the name of
  * the code.
  */
 const char *BKE_idcode_to_name(int code);
@@ -44,8 +44,8 @@ const char *BKE_idcode_to_name(int code);
 /**
  * Convert an idcode into a name (plural).
  * 
- * @param code The code to convert.
- * @return A static string representing the name of
+ * \param code The code to convert.
+ * \return A static string representing the name of
  * the code.
  */
 const char *BKE_idcode_to_name_plural(int code);
@@ -53,32 +53,32 @@ const char *BKE_idcode_to_name_plural(int code);
 /**
  * Convert a name into an idcode (ie. ID_SCE)
  * 
- * @param name The name to convert.
- * @return The code for the name, or 0 if invalid.
+ * \param name The name to convert.
+ * \return The code for the name, or 0 if invalid.
  */
 int BKE_idcode_from_name(const char *name);
 
 /**
  * Return non-zero when an ID type is linkable.
  * 
- * @param code The code to check.
- * @return Boolean, 0 when non linkable.
+ * \param code The code to check.
+ * \return Boolean, 0 when non linkable.
  */
 int BKE_idcode_is_linkable(int code);
 
 /**
  * Return if the ID code is a valid ID code.
  * 
- * @param code The code to check.
- * @return Boolean, 0 when invalid.
+ * \param code The code to check.
+ * \return Boolean, 0 when invalid.
  */
 int BKE_idcode_is_valid(int code);
 
 /**
  * Return an ID code and steps the index forward 1.
  *
- * @param index, start as 0.
- * @return the code, 0 when all codes have been returned.
+ * \param index start as 0.
+ * \return the code, 0 when all codes have been returned.
  */
 int BKE_idcode_iter_step(int *index);
 
diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h
index fbe5bf2..173adcc 100644
--- a/source/blender/blenkernel/BKE_idprop.h
+++ b/source/blender/blenkernel/BKE_idprop.h
@@ -23,8 +23,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
  
-#ifndef _BKE_IDPROP_H
-#define _BKE_IDPROP_H
+#ifndef __BKE_IDPROP_H__
+#define __BKE_IDPROP_H__
 
 /** \file BKE_idprop.h
  *  \ingroup bke
@@ -58,8 +58,8 @@ typedef union IDPropertyTemplate {
 
 /* ----------- Property Array Type ---------- */
 
-/*note: as a start to move away from the stupid IDP_New function, this type
-  has it's own allocation function.*/
+/* note: as a start to move away from the stupid IDP_New function, this type
+ * has it's own allocation function.*/
 IDProperty *IDP_NewIDPArray(const char *name);
 IDProperty *IDP_CopyIDPArray(IDProperty *array);
 
@@ -75,7 +75,6 @@ void IDP_ResizeIDPArray(struct IDProperty *prop, int len);
 /*this function works for strings too!*/
 void IDP_ResizeArray(struct IDProperty *prop, int newlen);
 void IDP_FreeArray(struct IDProperty *prop);
-void IDP_UnlinkArray(struct IDProperty *prop);
 
 /* ---------- String Type ------------ */
 IDProperty *IDP_NewString(const char *st, const char *name, int maxlen);/* maxlen excludes '\0' */
@@ -94,104 +93,108 @@ void IDP_UnlinkID(struct IDProperty *prop);
 void IDP_SyncGroupValues(struct IDProperty *dest, struct IDProperty *src);
 
 /**
- replaces all properties with the same name in a destination group from a source group.
-*/
+ * replaces all properties with the same name in a destination group from a source group.
+ */
 void IDP_ReplaceGroupInGroup(struct IDProperty *dest, struct IDProperty *src);
 
-/** checks if a property with the same name as prop exists, and if so replaces it.
-  Use this to preserve order!*/
+/**
+ * Checks if a property with the same name as prop exists, and if so replaces it.
+ * Use this to preserve order!*/
 void IDP_ReplaceInGroup(struct IDProperty *group, struct IDProperty *prop);
 
 /**
-This function has a sanity check to make sure ID properties with the same name don't
-get added to the group.
-
-The sanity check just means the property is not added to the group if another property
-exists with the same name; the client code using ID properties then needs to detect this 
-(the function that adds new properties to groups, IDP_AddToGroup, returns 0 if a property can't
-be added to the group, and 1 if it can) and free the property.
-
-Currently the code to free ID properties is designesd to leave the actual struct
-you pass it un-freed, this is needed for how the system works.  This means
-to free an ID property, you first call IDP_FreeProperty then MEM_freeN the
-struct.  In the future this will just be IDP_FreeProperty and the code will
-be reorganized to work properly.
-*/
+ * This function has a sanity check to make sure ID properties with the same name don't
+ * get added to the group.
+ * 
+ * The sanity check just means the property is not added to the group if another property
+ * exists with the same name; the client code using ID properties then needs to detect this 
+ * (the function that adds new properties to groups, IDP_AddToGroup, returns 0 if a property can't
+ * be added to the group, and 1 if it can) and free the property.
+ * 
+ * Currently the code to free ID properties is designed to leave the actual struct
+ * you pass it un-freed, this is needed for how the system works.  This means
+ * to free an ID property, you first call IDP_FreeProperty then MEM_freeN the
+ * struct.  In the future this will just be IDP_FreeProperty and the code will
+ * be reorganized to work properly.
+ */
 int IDP_AddToGroup(struct IDProperty *group, struct IDProperty *prop);
 
 /** this is the same as IDP_AddToGroup, only you pass an item
-  in the group list to be inserted after.*/
+ * in the group list to be inserted after. */
 int IDP_InsertToGroup(struct IDProperty *group, struct IDProperty *previous, 
 					  struct IDProperty *pnew);
 
 /** \note this does not free the property!!
-
- To free the property, you have to do:
- IDP_FreeProperty(prop); //free all subdata
- MEM_freeN(prop); //free property struct itself
-
-*/
+ *
+ * To free the property, you have to do:
+ * IDP_FreeProperty(prop); //free all subdata
+ * MEM_freeN(prop); //free property struct itself
+ */
 void IDP_RemFromGroup(struct IDProperty *group, struct IDProperty *prop);
 
 IDProperty *IDP_GetPropertyFromGroup(struct IDProperty *prop, const char *name);
 /** same as above but ensure type match */
 IDProperty *IDP_GetPropertyTypeFromGroup(struct IDProperty *prop, const char *name, const char type);
 
-/** Get an iterator to iterate over the members of an id property group.
- Note that this will automatically free the iterator once iteration is complete;
- if you stop the iteration before hitting the end, make sure to call
- IDP_FreeIterBeforeEnd().*/
+/**
+ * Get an iterator to iterate over the members of an id property group.
+ * Note that this will automatically free the iterator once iteration is complete;
+ * if you stop the iteration before hitting the end, make sure to call
+ * IDP_FreeIterBeforeEnd(). */
 void *IDP_GetGroupIterator(struct IDProperty *prop);
 
-/** Returns the next item in the iteration.  To use, simple for a loop like the following:
- while (IDP_GroupIterNext(iter) != NULL) {
-	. . .
- }*/
+/**
+ * Returns the next item in the iteration.  To use, simple for a loop like the following:
+ * while (IDP_GroupIterNext(iter) != NULL) {
+ *     ...
+ * }
+ */
 IDProperty *IDP_GroupIterNext(void *vself);
 
-/** Frees the iterator pointed to at vself, only use this if iteration is stopped early; 
-  when the iterator hits the end of the list it'll automatially free itself.*/
+/**
+ * Frees the iterator pointed to at vself, only use this if iteration is stopped early; 
+ * when the iterator hits the end of the list it'll automatically free itself.*/
 void IDP_FreeIterBeforeEnd(void *vself);
 
 /*-------- Main Functions --------*/
 /** Get the Group property that contains the id properties for ID id.  Set create_if_needed
-  to create the Group property and attach it to id if it doesn't exist; otherwise
-  the function will return NULL if there's no Group property attached to the ID.*/
+ * to create the Group property and attach it to id if it doesn't exist; otherwise
+ * the function will return NULL if there's no Group property attached to the ID.*/
 struct IDProperty *IDP_GetProperties(struct ID *id, int create_if_needed);
 struct IDProperty *IDP_CopyProperty(struct IDProperty *prop);
 
 int IDP_EqualsProperties(struct IDProperty *prop1, struct IDProperty *prop2);
 
 /**
-Allocate a new ID.
-
-This function takes three arguments: the ID property type, a union which defines
-it's initial value, and a name.
-
-The union is simple to use; see the top of this header file for its definition. 
-An example of using this function:
-
- IDPropertyTemplate val;
- IDProperty *group, *idgroup, *color;
- group = IDP_New(IDP_GROUP, val, "group1"); //groups don't need a template.
-
- val.array.len = 4
- val.array.type = IDP_FLOAT;
- color = IDP_New(IDP_ARRAY, val, "color1");
-
- idgroup = IDP_GetProperties(some_id, 1);
- IDP_AddToGroup(idgroup, color);
- IDP_AddToGroup(idgroup, group);
-
-Note that you MUST either attach the id property to an id property group with 
-IDP_AddToGroup or MEM_freeN the property, doing anything else might result in
-a memory leak.
-*/
+ * Allocate a new ID.
+ *
+ * This function takes three arguments: the ID property type, a union which defines
+ * it's initial value, and a name.
+ *
+ * The union is simple to use; see the top of this header file for its definition. 
+ * An example of using this function:
+ *
+ *     IDPropertyTemplate val;
+ *     IDProperty *group, *idgroup, *color;
+ *     group = IDP_New(IDP_GROUP, val, "group1"); //groups don't need a template.
+ *    
+ *     val.array.len = 4
+ *     val.array.type = IDP_FLOAT;
+ *     color = IDP_New(IDP_ARRAY, val, "color1");
+ *    
+ *     idgroup = IDP_GetProperties(some_id, 1);
+ *     IDP_AddToGroup(idgroup, color);
+ *     IDP_AddToGroup(idgroup, group);
+ * 
+ * Note that you MUST either attach the id property to an id property group with 
+ * IDP_AddToGroup or MEM_freeN the property, doing anything else might result in
+ * a memory leak.
+ */
 struct IDProperty *IDP_New(const int type, const IDPropertyTemplate *val, const char *name);
 
 /** \note this will free all child properties of list arrays and groups!
-  Also, note that this does NOT unlink anything!  Plus it doesn't free
-  the actual struct IDProperty struct either.*/
+ * Also, note that this does NOT unlink anything!  Plus it doesn't free
+ * the actual struct IDProperty struct either.*/
 void IDP_FreeProperty(struct IDProperty *prop);
 
 /** Unlinks any struct IDProperty<->ID linkage that might be going on.*/
@@ -204,4 +207,4 @@ void IDP_UnlinkProperty(struct IDProperty *prop);
 #define IDP_IDPArray(prop) ((IDProperty*)(prop)->data.pointer)
 #define IDP_Double(prop) (*(double*)&(prop)->data.val)
 
-#endif /* _BKE_IDPROP_H */
+#endif /* __BKE_IDPROP_H__ */
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index 5cdc353..c2112d1 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_IMAGE_H
-#define BKE_IMAGE_H
+#ifndef __BKE_IMAGE_H__
+#define __BKE_IMAGE_H__
 
 /** \file BKE_image.h
  *  \ingroup bke
@@ -54,10 +54,10 @@ int		BKE_alphatest_ibuf(struct ImBuf *ibuf);
 int		BKE_write_ibuf_stamp(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf);
 int		BKE_write_ibuf(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf);
 int     BKE_write_ibuf_as(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf, const short is_copy);
-void	BKE_makepicstring(char *string, const char *base, const char *relbase, int frame, char imtype, const short use_ext, const short use_frames);
+void	BKE_makepicstring(char *string, const char *base, const char *relbase, int frame, const char imtype, const short use_ext, const short use_frames);
 int		BKE_add_image_extension(char *string, const char imtype);
 char	BKE_ftype_to_imtype(const int ftype);
-int		BKE_imtype_to_ftype(char imtype);
+int		BKE_imtype_to_ftype(const char imtype);
 
 int		BKE_imtype_is_movie(const char imtype);
 int		BKE_imtype_supports_zbuf(const char imtype);
@@ -68,6 +68,8 @@ char	BKE_imtype_valid_depths(const char imtype);
 
 char    BKE_imtype_from_arg(const char *arg);
 
+void    BKE_imformat_defaults(struct ImageFormatData *im_format);
+
 struct anim *openanim(const char *name, int flags, int streamindex);
 
 void	image_de_interlace(struct Image *ima, int odd);
@@ -149,9 +151,6 @@ void BKE_image_assign_ibuf(struct Image *ima, struct ImBuf *ibuf);
 void BKE_image_user_calc_frame(struct ImageUser *iuser, int cfra, int fieldnr);
 int BKE_image_user_get_frame(const struct ImageUser *iuser, int cfra, int fieldnr);
 
-/* fix things in ImageUser when new image gets assigned */
-void BKE_image_user_new_image(struct Image *ima, struct ImageUser *iuser);
-
 /* sets index offset for multilayer files */
 struct RenderPass *BKE_image_multilayer_index(struct RenderResult *rr, struct ImageUser *iuser);
 
diff --git a/source/blender/blenkernel/BKE_ipo.h b/source/blender/blenkernel/BKE_ipo.h
index d21b059..547e7de 100644
--- a/source/blender/blenkernel/BKE_ipo.h
+++ b/source/blender/blenkernel/BKE_ipo.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_IPO_H
-#define BKE_IPO_H
+#ifndef __BKE_IPO_H__
+#define __BKE_IPO_H__
 
 /** \file BKE_ipo.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/BKE_key.h b/source/blender/blenkernel/BKE_key.h
index c055bb2..63d9d73 100644
--- a/source/blender/blenkernel/BKE_key.h
+++ b/source/blender/blenkernel/BKE_key.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_KEY_H
-#define BKE_KEY_H
+#ifndef __BKE_KEY_H__
+#define __BKE_KEY_H__
 
 /** \file BKE_key.h
  *  \ingroup bke
@@ -48,8 +48,10 @@ extern "C" {
 #endif
 
 void free_key(struct Key *sc); 
+void free_key_nolib(struct Key *key);
 struct Key *add_key(struct ID *id);
 struct Key *copy_key(struct Key *key);
+struct Key *copy_key_nolib(struct Key *key);
 void make_local_key(struct Key *key);
 void sort_keys(struct Key *key);
 
@@ -61,6 +63,7 @@ float *do_ob_key(struct Scene *scene, struct Object *ob);
 
 struct Key *ob_get_key(struct Object *ob);
 struct KeyBlock *add_keyblock(struct Key *key, const char *name);
+struct KeyBlock *add_keyblock_ctime(struct Key *key, const char * name, const short do_force);
 struct KeyBlock *ob_get_keyblock(struct Object *ob);
 struct KeyBlock *ob_get_reference_keyblock(struct Object *ob);
 struct KeyBlock *key_get_keyblock(struct Key *key, int index);
@@ -87,4 +90,4 @@ extern int slurph_opt;
 };
 #endif
 
-#endif // BKE_KEY_H
+#endif // __BKE_KEY_H__
diff --git a/source/blender/blenkernel/BKE_lamp.h b/source/blender/blenkernel/BKE_lamp.h
index cc9452a..50e2557 100644
--- a/source/blender/blenkernel/BKE_lamp.h
+++ b/source/blender/blenkernel/BKE_lamp.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_LAMP_H
-#define BKE_LAMP_H
+#ifndef __BKE_LAMP_H__
+#define __BKE_LAMP_H__
 
 /** \file BKE_lamp.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h
index b539530..29c7851 100644
--- a/source/blender/blenkernel/BKE_lattice.h
+++ b/source/blender/blenkernel/BKE_lattice.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_LATTICE_H
-#define BKE_LATTICE_H
+#ifndef __BKE_LATTICE_H__
+#define __BKE_LATTICE_H__
 
 /** \file BKE_lattice.h
  *  \ingroup bke
@@ -63,7 +63,7 @@ void curve_deform_vector(struct Scene *scene, struct Object *cuOb, struct Object
 
 void lattice_deform_verts(struct Object *laOb, struct Object *target,
                           struct DerivedMesh *dm, float (*vertexCos)[3],
-                          int numVerts, const char *vgroup);
+                          int numVerts, const char *vgroup, float influence);
 void armature_deform_verts(struct Object *armOb, struct Object *target,
                            struct DerivedMesh *dm, float (*vertexCos)[3],
                            float (*defMats)[3][3], int numVerts, int deformflag,
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index e8d6c85..b18d250 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_LIBRARY_TYPES_H
-#define BKE_LIBRARY_TYPES_H
+#ifndef __BKE_LIBRARY_H__
+#define __BKE_LIBRARY_H__
 
 /** \file BKE_library.h
  *  \ingroup bke
@@ -58,6 +58,7 @@ int id_make_local(struct ID *id, int test);
 int id_single_user(struct bContext *C, struct ID *id, struct PointerRNA *ptr, struct PropertyRNA *prop);
 int id_copy(struct ID *id, struct ID **newid, int test);
 int id_unlink(struct ID *id, int test);
+void id_sort_by_name(struct ListBase *lb, struct ID *id);
 
 int new_id(struct ListBase *lb, struct ID *id, const char *name);
 void id_clear_lib_data(struct Main *bmain, struct ID *id);
@@ -83,9 +84,10 @@ void BKE_library_make_local(struct Main *bmain, struct Library *lib, int untagge
 struct ID *find_id(const char *type, const char *name);
 void clear_id_newpoins(void);
 
-void IDnames_to_pupstring(const char **str, const char *title, const char *extraops, struct ListBase *lb,struct ID* link, short *nr);
-void IMAnames_to_pupstring(const char **str, const char *title, const char *extraops, struct ListBase *lb, struct ID *link, short *nr);
-void IPOnames_to_pupstring(const char **str, const char *title, const char *extraops, struct ListBase *lb, struct ID* link, short *nr, int blocktype);
+void IDnames_to_pupstring(const char **str, const char *title, const char *extraops,
+                          struct ListBase *lb,struct ID* link, short *nr);
+void IMAnames_to_pupstring(const char **str, const char *title, const char *extraops,
+                           struct ListBase *lb, struct ID *link, short *nr);
 
 void flag_listbase_ids(ListBase *lb, short flag, short value);
 void flag_all_listbases_ids(short flag, short value);
diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h
index 05ba60b..ffcbb6e 100644
--- a/source/blender/blenkernel/BKE_main.h
+++ b/source/blender/blenkernel/BKE_main.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_MAIN_H
-#define BKE_MAIN_H
+#ifndef __BKE_MAIN_H__
+#define __BKE_MAIN_H__
 
 /** \file BKE_main.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h
index 0079ecb..99561a6 100644
--- a/source/blender/blenkernel/BKE_material.h
+++ b/source/blender/blenkernel/BKE_material.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_MATERIAL_H
-#define BKE_MATERIAL_H
+#ifndef __BKE_MATERIAL_H__
+#define __BKE_MATERIAL_H__
 
 /** \file BKE_material.h
  *  \ingroup bke
@@ -50,7 +50,6 @@ void free_material(struct Material *sc);
 void test_object_materials(struct ID *id);
 void resize_object_material(struct Object *ob, const short totcol);
 void init_material(struct Material *ma);
-struct Material *add_material_main(struct Main *main, const char *name);
 struct Material *add_material(const char *name);
 struct Material *copy_material(struct Material *ma);
 struct Material *localize_material(struct Material *ma);
@@ -99,10 +98,6 @@ void free_matcopybuf(void);
 void copy_matcopybuf(struct Material *ma);
 void paste_matcopybuf(struct Material *ma);
 
-void clear_mat_mtex_copybuf(void);
-void copy_mat_mtex_copybuf(struct ID *id);
-void paste_mat_mtex_copybuf(struct ID *id);
-
 /* handle backward compatibility for tface/materials called from doversion (fileload=1) or Help Menu (fileload=0) */	
 int do_version_tface(struct Main *main, int fileload);
 
diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h
index 3dde54f..fafd2a3 100644
--- a/source/blender/blenkernel/BKE_mball.h
+++ b/source/blender/blenkernel/BKE_mball.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_MBALL_H
-#define BKE_MBALL_H
+#ifndef __BKE_MBALL_H__
+#define __BKE_MBALL_H__
 
 /** \file BKE_mball.h
  *  \ingroup bke
@@ -166,7 +166,7 @@ struct Object *find_basis_mball(struct Scene *scene, struct Object *ob);
 int is_basis_mball(struct Object *ob);
 int is_mball_basis_for(struct Object *ob1, struct Object *ob2);
 void metaball_polygonize(struct Scene *scene, struct Object *ob, struct ListBase *dispbase);
-void calc_mballco(struct MetaElem *ml, float *vec);
+void calc_mballco(struct MetaElem *ml, float vec[3]);
 float densfunc(struct MetaElem *ball, float x, float y, float z);
 float metaball(float x, float y, float z);
 void accum_mballfaces(int i1, int i2, int i3, int i4);
@@ -174,5 +174,10 @@ void *new_pgn_element(int size);
 int nextcwedge (int edge, int face);
 void BKE_freecubetable(void);
 
+int BKE_metaball_minmax(struct MetaBall *mb, float min[3], float max[3]);
+int BKE_metaball_center_median(struct MetaBall *mb, float cent[3]);
+int BKE_metaball_center_bounds(struct MetaBall *mb, float cent[3]);
+void BKE_metaball_translate(struct MetaBall *mb, float offset[3]);
+
 #endif
 
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index 30a4b15..742e6ef 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_MESH_H
-#define BKE_MESH_H
+#ifndef __BKE_MESH_H__
+#define __BKE_MESH_H__
 
 /** \file BKE_mesh.h
  *  \ingroup bke
@@ -36,7 +36,8 @@
 struct BoundBox;
 struct DispList;
 struct ListBase;
-struct EditMesh;
+struct BMEditMesh;
+struct BMesh;
 struct Mesh;
 struct MPoly;
 struct MLoop;
@@ -60,19 +61,69 @@ struct UvElement;
 extern "C" {
 #endif
 
-struct EditMesh *BKE_mesh_get_editmesh(struct Mesh *me);
-void BKE_mesh_end_editmesh(struct Mesh *me, struct EditMesh *em);
+struct BMesh *BKE_mesh_to_bmesh(struct Mesh *me, struct Object *ob);
+
+/*
+ * this function recreates a tessellation.
+ * returns number of tessellation faces.
+ *
+ * use_poly_origindex sets whether or not the tessellation faces' origindex
+ * layer should point to original poly indices or real poly indices.
+ *
+ * use_face_origindex sets the tessellation faces' origindex layer
+ * to point to the tessellation faces themselves, not the polys.
+ *
+ * if both of the above are 0, it'll use the indices of the mpolys of the MPoly
+ * data in pdata, and ignore the origindex layer altogether.
+ */
+int mesh_recalcTessellation(struct CustomData *fdata, struct CustomData *ldata, struct CustomData *pdata,
+                           struct MVert *mvert,
+                           int totface, int totloop, int totpoly,
+                           const int do_face_normals);
 
 /* for forwards compat only quad->tri polys to mface, skip ngons.
  */
 int mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata,
 	struct CustomData *pdata, int totface, int totloop, int totpoly);
 
+/*calculates a face normal.*/
+void mesh_calc_poly_normal(struct MPoly *mpoly, struct MLoop *loopstart, 
+                           struct MVert *mvarray, float no[3]);
+
+void mesh_calc_poly_normal_coords(struct MPoly *mpoly, struct MLoop *loopstart,
+                                  const float (*vertex_coords)[3], float no[3]);
+
+void mesh_calc_poly_center(struct MPoly *mpoly, struct MLoop *loopstart,
+                           struct MVert *mvarray, float cent[3]);
+
+float mesh_calc_poly_area(struct MPoly *mpoly, struct MLoop *loopstart,
+                          struct MVert *mvarray, float polynormal[3]);
+
+/* Find the index of the loop in 'poly' which references vertex,
+ * returns -1 if not found */
+int poly_find_loop_from_vert(const struct MPoly *poly,
+							 const struct MLoop *loopstart,
+							 unsigned vert);
+
+/* Fill 'adj_r' with the loop indices in 'poly' adjacent to the
+ * vertex. Returns the index of the loop matching vertex, or -1 if the
+ * vertex is not in 'poly' */
+int poly_get_adj_loops_from_vert(unsigned adj_r[3], const struct MPoly *poly,
+								 const struct MLoop *mloop, unsigned vert);
+
+/* update the hide flag for edges and polys from the corresponding
+ * flag in verts */
+void mesh_flush_hidden_from_verts(const struct MVert *mvert,
+								  const struct MLoop *mloop,
+								  struct MEdge *medge, int totedge,
+								  struct MPoly *mpoly, int totpoly);
+
 void unlink_mesh(struct Mesh *me);
-void free_mesh(struct Mesh *me);
+void free_mesh(struct Mesh *me, int unlink);
 struct Mesh *add_mesh(const char *name);
 struct Mesh *copy_mesh(struct Mesh *me);
-void mesh_update_customdata_pointers(struct Mesh *me);
+void mesh_update_customdata_pointers(struct Mesh *me, const short do_ensure_tess_cd);
+
 void make_local_mesh(struct Mesh *me);
 void boundbox_mesh(struct Mesh *me, float *loc, float *size);
 void tex_space_mesh(struct Mesh *me);
@@ -82,31 +133,55 @@ int test_index_face(struct MFace *mface, struct CustomData *mfdata, int mfindex,
 struct Mesh *get_mesh(struct Object *ob);
 void set_mesh(struct Object *ob, struct Mesh *me);
 void mball_to_mesh(struct ListBase *lb, struct Mesh *me);
-int nurbs_to_mdata(struct Object *ob, struct MVert **allvert, int *_totvert,
-	struct MEdge **alledge, int *_totedge, struct MFace **allface, int *_totface);
-int nurbs_to_mdata_customdb(struct Object *ob, struct ListBase *dispbase,
-	struct MVert **allvert, int *_totvert, struct MEdge **alledge, int *_totedge,
-	struct MFace **allface, int *_totface);
+int nurbs_to_mdata(struct Object *ob, struct MVert **allvert, int *totvert,
+	struct MEdge **alledge, int *totedge, struct MLoop **allloop, struct MPoly **allpoly,
+	int *totloop, int *totpoly);
+int nurbs_to_mdata_customdb(struct Object *ob, struct ListBase *dispbase, struct MVert **allvert, int *_totvert,
+	struct MEdge **alledge, int *_totedge, struct MLoop **allloop, struct MPoly **allpoly,
+	int *_totloop, int *_totpoly);
 void nurbs_to_mesh(struct Object *ob);
 void mesh_to_curve(struct Scene *scene, struct Object *ob);
 void free_dverts(struct MDeformVert *dvert, int totvert);
 void copy_dverts(struct MDeformVert *dst, struct MDeformVert *src, int totvert); /* __NLA */
 void mesh_delete_material_index(struct Mesh *me, short index);
 void mesh_set_smooth_flag(struct Object *meshOb, int enableSmooth);
+void BKE_mesh_convert_mfaces_to_mpolys(struct Mesh *mesh);
+void mesh_calc_normals_tessface(struct MVert *mverts, int numVerts,struct  MFace *mfaces, int numFaces, float (*faceNors_r)[3]);
+
+/* used for unit testing; compares two meshes, checking only
+ * differences we care about.  should be usable with leaf's
+ * testing framework I get RNA work done, will use hackish
+ * testing code for now.*/
+const char *mesh_cmp(struct Mesh *me1, struct Mesh *me2, float thresh);
 
 struct BoundBox *mesh_get_bb(struct Object *ob);
-void mesh_get_texspace(struct Mesh *me, float *loc_r, float *rot_r, float *size_r);
+void mesh_get_texspace(struct Mesh *me, float r_loc[3], float r_rot[3], float r_size[3]);
 
 /* if old, it converts mface->edcode to edge drawflags */
 void make_edges(struct Mesh *me, int old);
 
-void mesh_strip_loose_faces(struct Mesh *me);
+void mesh_strip_loose_faces(struct Mesh *me); /* Needed for compatibility (some old read code). */
+void mesh_strip_loose_polysloops(struct Mesh *me);
 void mesh_strip_loose_edges(struct Mesh *me);
 
 	/* Calculate vertex and face normals, face normals are returned in *faceNors_r if non-NULL
 	 * and vertex normals are stored in actual mverts.
 	 */
-void mesh_calc_normals(struct MVert *mverts, int numVerts, struct MFace *mfaces, int numFaces, float (*faceNors_r)[3]);
+void mesh_calc_normals_mapping(
+        struct MVert *mverts, int numVerts,
+        struct MLoop *mloop, struct MPoly *mpolys, int numLoops, int numPolys, float (*polyNors_r)[3],
+        struct MFace *mfaces, int numFaces, int *origIndexFace, float (*faceNors_r)[3]);
+	/* extended version of 'mesh_calc_normals' with option not to calc vertex normals */
+void mesh_calc_normals_mapping_ex(
+        struct MVert *mverts, int numVerts,
+        struct MLoop *mloop, struct MPoly *mpolys, int numLoops, int numPolys, float (*polyNors_r)[3],
+        struct MFace *mfaces, int numFaces, int *origIndexFace, float (*faceNors_r)[3],
+        const short only_face_normals);
+
+void mesh_calc_normals(
+        struct MVert *mverts, int numVerts,
+        struct MLoop *mloop, struct MPoly *mpolys,
+        int numLoops, int numPolys, float (*polyNors_r)[3]);
 
 	/* Return a newly MEM_malloc'd array of all the mesh vertex locations
 	 * (_numVerts_r_ may be NULL) */
@@ -129,26 +204,18 @@ typedef struct UvMapVert {
 	unsigned char tfindex, separate, flag;
 } UvMapVert;
 
-typedef struct UvElementMap {
-	/* address UvElements by their vertex */
-	struct UvElement **vert;
-	/* UvElement Store */
-	struct UvElement *buf;
-	/* Total number of UVs in the layer. Useful to know */
-	int totalUVs;
-	/* Number of Islands in the mesh */
-	int totalIslands;
-	/* Stores the starting index in buf where each island begins */
-	int *islandIndices;
-} UvElementMap;
-
+/* UvElement stores per uv information so that we can quickly access information for a uv.
+ * it is actually an improved UvMapVert, including an island and a direct pointer to the face
+ * to avoid initializing face arrays */
 typedef struct UvElement {
 	/* Next UvElement corresponding to same vertex */
 	struct UvElement *next;
 	/* Face the element belongs to */
-	struct EditFace *face;
+	struct BMFace *face;
 	/* Index in the editFace of the uv */
-	unsigned char tfindex;
+	struct BMLoop *l;
+	/* index in loop. */
+	unsigned short tfindex;
 	/* Whether this element is the first of coincident elements */
 	unsigned char separate;
 	/* general use flag */
@@ -157,30 +224,50 @@ typedef struct UvElement {
 	unsigned short island;
 } UvElement;
 
+
+/* UvElementMap is a container for UvElements of a mesh. It stores some UvElements belonging to the
+ * same uv island in sequence and the number of uvs per island so it is possible to access all uvs
+ * belonging to an island directly by iterating through the buffer.
+ */
+typedef struct UvElementMap {
+	/* address UvElements by their vertex */
+	struct UvElement **vert;
+	/* UvElement Store */
+	struct UvElement *buf;
+	/* Total number of UVs in the layer. Useful to know */
+	int totalUVs;
+	/* Number of Islands in the mesh */
+	int totalIslands;
+	/* Stores the starting index in buf where each island begins */
+	int *islandIndices;
+} UvElementMap;
+
 /* invalid island index is max short. If any one has the patience
  * to make that many islands, he can bite me :p */
 #define INVALID_ISLAND 0xFFFF
 
-
-UvVertMap *make_uv_vert_map(struct MFace *mface, struct MTFace *tface, unsigned int totface, unsigned int totvert, int selected, float *limit);
+UvVertMap *make_uv_vert_map(struct MPoly *mpoly, struct MLoop *mloop, struct MLoopUV *mloopuv, unsigned int totpoly, unsigned int totvert, int selected, float *limit);
 UvMapVert *get_uv_map_vert(UvVertMap *vmap, unsigned int v);
 void free_uv_vert_map(UvVertMap *vmap);
 
 /* Connectivity data */
+typedef struct MeshElemMap {
+	int *indices;
+	int count;
+} MeshElemMap;
+	
 typedef struct IndexNode {
 	struct IndexNode *next, *prev;
 	int index;
 } IndexNode;
-void create_vert_face_map(struct ListBase **map, IndexNode **mem, const struct MFace *mface,
-                          const int totvert, const int totface);
+
+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(struct ListBase **map, IndexNode **mem, const struct MEdge *medge,
                           const int totvert, const int totedge);
 
-/* functions for making menu's from customdata layers */
-int mesh_layers_menu_charlen(struct CustomData *data, int type); /* use this to work out how many chars to allocate */
-void mesh_layers_menu_concat(struct CustomData *data, int type, char *str);
-int mesh_layers_menu(struct CustomData *data, int type);
-
 /* vertex level transformations & checks (no derived mesh) */
 
 int minmax_mesh(struct Mesh *me, float min[3], float max[3]);
@@ -189,11 +276,14 @@ int mesh_center_bounds(struct Mesh *me, float cent[3]);
 void mesh_translate(struct Mesh *me, float offset[3], int do_keys);
 
 /* mesh_validate.c */
+/* XXX Loop v/e are unsigned, so using max uint_32 value as invalid marker... */
+#define INVALID_LOOP_EDGE_MARKER 4294967295u
 int BKE_mesh_validate_arrays(
-		struct Mesh *me,
+        struct Mesh *me,
         struct MVert *mverts, unsigned int totvert,
         struct MEdge *medges, unsigned int totedge,
-        struct MFace *mfaces, unsigned int totface,
+        struct MLoop *mloops, unsigned int totloop,
+        struct MPoly *mpolys, unsigned int totpoly,
         struct MDeformVert *dverts, /* assume totvert length */
         const short do_verbose, const short do_fixes);
 int BKE_mesh_validate(struct Mesh *me, int do_verbose);
@@ -203,14 +293,18 @@ void BKE_mesh_calc_edges(struct Mesh *mesh, int update);
 
 void BKE_mesh_ensure_navmesh(struct Mesh *me);
 
-/*convert a triangle of loop facedata to mface facedata*/
+void BKE_mesh_tessface_calc(struct Mesh *mesh);
+void BKE_mesh_tessface_ensure(struct Mesh *mesh);
+void BKE_mesh_tessface_clear(struct Mesh *mesh);
+
+/* Convert a triangle or quadrangle of loop/poly data to tessface data */
 void mesh_loops_to_mface_corners(struct CustomData *fdata, struct CustomData *ldata,
                                  struct CustomData *pdata, int lindex[4], int findex,
                                  const int polyindex, const int mf_len,
-                                 const int numTex, const int numCol, const int hasWCol);
+                                 const int numTex, const int numCol, const int hasPCol, const int hasOrigSpace);
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* BKE_MESH_H */
+#endif /* __BKE_MESH_H__ */
diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h
index f72bc5b..b4320b7 100644
--- a/source/blender/blenkernel/BKE_modifier.h
+++ b/source/blender/blenkernel/BKE_modifier.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_MODIFIER_H
-#define BKE_MODIFIER_H
+#ifndef __BKE_MODIFIER_H__
+#define __BKE_MODIFIER_H__
 
 /** \file BKE_modifier.h
  *  \ingroup bke
@@ -35,7 +35,6 @@
 #include "BKE_customdata.h"
 
 struct ID;
-struct EditMesh;
 struct DerivedMesh;
 struct DagForest;
 struct DagNode;
@@ -45,6 +44,7 @@ struct ListBase;
 struct LinkNode;
 struct bArmature;
 struct ModifierData;
+struct BMEditMesh;
 
 typedef enum {
 	/* Should not be used, only for None modifier type */
@@ -92,7 +92,7 @@ typedef enum {
 	eModifierTypeFlag_RequiresOriginalData = (1<<5),
 
 	/* For modifiers that support pointcache, so we can check to see if it has files we need to deal with
-	*/
+	 */
 	eModifierTypeFlag_UsesPointCache = (1<<6),
 
 	/* For physics modifiers, max one per type */
@@ -101,7 +101,7 @@ typedef enum {
 	/* Some modifier can't be added manually by user */
 	eModifierTypeFlag_NoUserAdd = (1<<8),
 
-	/* For modifiers that use CD_WEIGHT_MCOL for preview. */
+	/* For modifiers that use CD_PREVIEW_MCOL for preview. */
 	eModifierTypeFlag_UsesPreview = (1<<9)
 } ModifierTypeFlag;
 
@@ -154,13 +154,13 @@ typedef struct ModifierTypeInfo {
 	 */
 	void (*deformVertsEM)(
 				struct ModifierData *md, struct Object *ob,
-				struct EditMesh *editData, struct DerivedMesh *derivedData,
+				struct BMEditMesh *editData, struct DerivedMesh *derivedData,
 				float (*vertexCos)[3], int numVerts);
 
 	/* Set deform matrix per vertex for crazyspace correction */
 	void (*deformMatricesEM)(
 				struct ModifierData *md, struct Object *ob,
-				struct EditMesh *editData, struct DerivedMesh *derivedData,
+				struct BMEditMesh *editData, struct DerivedMesh *derivedData,
 				float (*vertexCos)[3], float (*defMats)[3][3], int numVerts);
 
 	/********************* Non-deform modifier functions *********************/
@@ -198,7 +198,7 @@ typedef struct ModifierTypeInfo {
 	 */
 	struct DerivedMesh *(*applyModifierEM)(
 								struct ModifierData *md, struct Object *ob,
-								struct EditMesh *editData,
+								struct BMEditMesh *editData,
 								struct DerivedMesh *derivedData);
 
 
@@ -357,16 +357,21 @@ int           modifiers_isPreview(struct Object *ob);
 
 int           modifiers_indexInObject(struct Object *ob, struct ModifierData *md);
 
+typedef struct CDMaskLink {
+	struct CDMaskLink *next;
+	CustomDataMask mask;
+} CDMaskLink;
+
 /* Calculates and returns a linked list of CustomDataMasks indicating the
  * data required by each modifier in the stack pointed to by md for correct
  * evaluation, assuming the data indicated by dataMask is required at the
  * end of the stack.
  */
-struct LinkNode *modifiers_calcDataMasks(struct Scene *scene, 
-										 struct Object *ob,
-										 struct ModifierData *md,
-										 CustomDataMask dataMask,
-										 int required_mode);
+struct CDMaskLink *modifiers_calcDataMasks(struct Scene *scene, 
+										   struct Object *ob,
+										   struct ModifierData *md,
+										   CustomDataMask dataMask,
+										   int required_mode);
 struct ModifierData *modifiers_getLastPreview(struct Scene *scene,
                                               struct ModifierData *md,
                                               int required_mode);
diff --git a/source/blender/blenkernel/BKE_movieclip.h b/source/blender/blenkernel/BKE_movieclip.h
index eabbf45..d7b2f27 100644
--- a/source/blender/blenkernel/BKE_movieclip.h
+++ b/source/blender/blenkernel/BKE_movieclip.h
@@ -24,8 +24,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_MOVIECLIP_H
-#define BKE_MOVIECLIP_H
+#ifndef __BKE_MOVIECLIP_H__
+#define __BKE_MOVIECLIP_H__
 
 /** \file BKE_movieclip.h
  *  \ingroup bke
@@ -51,18 +51,17 @@ struct ImBuf *BKE_movieclip_get_postprocessed_ibuf(struct MovieClip *clip, struc
 struct ImBuf *BKE_movieclip_get_stable_ibuf(struct MovieClip *clip, struct MovieClipUser *user, float loc[2], float *scale, float *angle, int postprocess_flag);
 struct ImBuf *BKE_movieclip_get_ibuf_flag(struct MovieClip *clip, struct MovieClipUser *user, int flag, int cache_flag);
 void BKE_movieclip_get_size(struct MovieClip *clip, struct MovieClipUser *user, int *width, int *height);
+int BKE_movieclip_get_duration(struct MovieClip *clip);
 void BKE_movieclip_aspect(struct MovieClip *clip, float *aspx, float *aspy);
 int BKE_movieclip_has_frame(struct MovieClip *clip, struct MovieClipUser *user);
 void BKE_movieclip_user_set_frame(struct MovieClipUser *user, int framenr);
 
-void BKE_movieclip_select_track(struct MovieClip *clip, struct MovieTrackingTrack *track, int area, int extend);
-
 void BKE_movieclip_update_scopes(struct MovieClip *clip, struct MovieClipUser *user, struct MovieClipScopes *scopes);
 
 void BKE_movieclip_get_cache_segments(struct MovieClip *clip, struct MovieClipUser *user, int *totseg_r, int **points_r);
 
 void BKE_movieclip_build_proxy_frame(struct MovieClip *clip, int clip_flag, struct MovieDistortion *distortion,
-			int cfra, int *build_sizes, int build_count, int undistorted);
+                                     int cfra, int *build_sizes, int build_count, int undistorted);
 
 /* cacheing flags */
 #define MOVIECLIP_CACHE_SKIP        (1<<0)
diff --git a/source/blender/blenkernel/BKE_multires.h b/source/blender/blenkernel/BKE_multires.h
index 4f1262c..bc34b01 100644
--- a/source/blender/blenkernel/BKE_multires.h
+++ b/source/blender/blenkernel/BKE_multires.h
@@ -25,33 +25,42 @@
  * ***** END GPL LICENSE BLOCK *****
  */ 
 
-#ifndef BKE_MULTIRES_H
-#define BKE_MULTIRES_H
+#ifndef __BKE_MULTIRES_H__
+#define __BKE_MULTIRES_H__
 
 /** \file BKE_multires.h
  *  \ingroup bke
  */
 
+enum MultiresModifiedFlags;
 struct DerivedMesh;
-struct Mesh;
+struct GridHidden;
+struct MDisps;
 struct MFace;
+struct Mesh;
+struct ModifierData;
 struct Multires;
 struct MultiresModifierData;
-struct ModifierData;
 struct Object;
 struct Scene;
-struct MDisps;
 
-void multires_mark_as_modified(struct Object *ob);
+/* Delete mesh mdisps */
+void multires_customdata_delete(struct Mesh *me);
+
+void multires_mark_as_modified(struct Object *ob, enum MultiresModifiedFlags flags);
 
 void multires_force_update(struct Object *ob);
 void multires_force_render_update(struct Object *ob);
 void multires_force_external_reload(struct Object *ob);
 
+/* internal, only called in subsurf_ccg.c */
+void multires_modifier_update_mdisps(struct DerivedMesh *dm);
+void multires_modifier_update_hidden(struct DerivedMesh *dm);
+
 void multiresModifier_set_levels_from_disps(struct MultiresModifierData *mmd, struct Object *ob);
 
 struct DerivedMesh *multires_dm_create_from_derived(struct MultiresModifierData*,
-	int local_mmd, struct DerivedMesh*, struct Object *, int, int);
+	int local_mmd, struct DerivedMesh*, struct Object *, int);
 
 struct MultiresModifierData *find_multires_modifier_before(struct Scene *scene,
 	struct ModifierData *lastmd);
@@ -71,6 +80,14 @@ int multiresModifier_reshapeFromDeformMod(struct Scene *scene, struct MultiresMo
 
 void multires_stitch_grids(struct Object *);
 
+/*switch mdisp data in dm between tangent and object space*/
+enum {
+	MULTIRES_SPACE_TANGENT,
+	MULTIRES_SPACE_OBJECT,
+	MULTIRES_SPACE_ABSOLUTE
+};
+void multires_set_space(struct DerivedMesh *dm, struct Object *ob, int from, int to);
+
 /* Related to the old multires */
 void multires_free(struct Multires *mr);
 void multires_load_old(struct Object *ob, struct Mesh *me);
@@ -80,19 +97,13 @@ void multiresModifier_scale_disp(struct Scene *scene, struct Object *ob);
 void multiresModifier_prepare_join(struct Scene *scene, struct Object *ob, struct Object *to_ob);
 
 int multires_mdisp_corners(struct MDisps *s);
-void multires_mdisp_smooth_bounds(struct MDisps *disps);
 
 /* update multires data after topology changing */
-void multires_topology_changed(struct Scene *scene, struct Object *ob);
+void multires_topology_changed(struct Mesh *me);
 
 /**** interpolation stuff ****/
 void old_mdisps_bilinear(float out[3], float (*disps)[3], const int st, float u, float v);
-void mdisp_rot_crn_to_face(const int S, const int corners, const int face_side, const float x, const float y, float *u, float *v);
 int mdisp_rot_face_to_crn(const int corners, const int face_side, const float u, const float v, float *x, float *y);
-int mdisp_rot_face_to_quad_crn(const int corners, const int face_side, const float u, const float v, float *x, float *y);
-void mdisp_apply_weight(const int S, const int corners, int x, int y, const int face_side, float crn_weight[4][2], float *u_r, float *v_r);
-void mdisp_flip_disp(const int S, const int corners, const float axis_x[2], const float axis_y[2], float disp[3]);
-void mdisp_join_tris(struct MDisps *dst, struct MDisps *tri1, struct MDisps *tri2);
 
-#endif // BKE_MULTIRES_H
+#endif // __BKE_MULTIRES_H__
 
diff --git a/source/blender/blenkernel/BKE_navmesh_conversion.h b/source/blender/blenkernel/BKE_navmesh_conversion.h
index ab5c2b1..8de53ed 100644
--- a/source/blender/blenkernel/BKE_navmesh_conversion.h
+++ b/source/blender/blenkernel/BKE_navmesh_conversion.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_NAVMESH_CONVERSION_H
-#define BKE_NAVMESH_CONVERSION_H
+#ifndef __BKE_NAVMESH_CONVERSION_H__
+#define __BKE_NAVMESH_CONVERSION_H__
 
 struct DerivedMesh;
 
diff --git a/source/blender/blenkernel/BKE_nla.h b/source/blender/blenkernel/BKE_nla.h
index 773c5ce..921972c 100644
--- a/source/blender/blenkernel/BKE_nla.h
+++ b/source/blender/blenkernel/BKE_nla.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_NLA_H
-#define BKE_NLA_H
+#ifndef __BKE_NLA_H__
+#define __BKE_NLA_H__
 
 /** \file BKE_nla.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 0cccd8a..cb161b2 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_NODE_H
-#define BKE_NODE_H
+#ifndef __BKE_NODE_H__
+#define __BKE_NODE_H__
 
 /** \file BKE_node.h
  *  \ingroup bke
@@ -50,6 +50,7 @@ struct GPUMaterial;
 struct GPUNode;
 struct GPUNodeStack;
 struct ID;
+struct ImageFormatData;
 struct ListBase;
 struct Main;
 struct uiBlock;
@@ -112,8 +113,9 @@ typedef struct bNodeSocketType {
 typedef struct bNodeTemplate {
 	int type;
 	
-	/* group tree */
-	struct bNodeTree *ngroup;
+	struct Main *main;
+	struct Scene *scene;
+	struct bNodeTree *ngroup;	/* group tree */
 } bNodeTemplate;
 
 /** Defines a node type.
@@ -163,7 +165,7 @@ typedef struct bNodeType {
 	/// Create a template from an existing node.
 	struct bNodeTemplate (*templatefunc)(struct bNode *);
 	/** If a node can be made from the template in the given node tree.
-	 * \example Node groups can not be created inside their own node tree.
+	 * \note Node groups can not be created inside their own node tree.
 	 */
 	int (*validfunc)(struct bNodeTree *ntree, struct bNodeTemplate *ntemp);
 	
@@ -178,6 +180,10 @@ 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);
 	
 	/* **** execution callbacks **** */
 	void *(*initexecfunc)(struct bNode *node);
@@ -187,24 +193,10 @@ typedef struct bNodeType {
 	 * when a final generic version of execution code is defined, this will be changed anyway
 	 */
 	void (*newexecfunc)(void *data, int thread, struct bNode *, void *nodedata, struct bNodeStack **, struct bNodeStack **);
-	/* This is the muting callback.
-	 * XXX Mimics the newexecfunc signature... Not sure all of this will be useful, we will see.
-	 */
-	void (*mutefunc)(void *data, int thread, struct bNode *, void *nodedata, struct bNodeStack **, struct bNodeStack **);
-	/* And the muting util.
-	 * Returns links as a ListBase, as pairs of bNodeStack* if in/out bNodeStacks were provided,
-	 * else as pairs of bNodeSocket* if node tree was provided.
-	 */
-	ListBase (*mutelinksfunc)(struct bNodeTree *, struct bNode *, struct bNodeStack **, struct bNodeStack **,
-	                          struct GPUNodeStack *, struct GPUNodeStack *);
 	/* gpu */
 	int (*gpufunc)(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *in, struct GPUNodeStack *out);
 	/* extended gpu function */
 	int (*gpuextfunc)(struct GPUMaterial *mat, struct bNode *node, void *nodedata, struct GPUNodeStack *in, struct GPUNodeStack *out);
-	/* This is the muting gpu callback.
-	 * XXX Mimics the gpuextfunc signature... Not sure all of this will be useful, we will see.
-	 */
-	int (*gpumutefunc)(struct GPUMaterial *, struct bNode *, void *, struct GPUNodeStack *, struct GPUNodeStack *);
 } bNodeType;
 
 /* node->exec, now in use for composites (#define for break is same as ready yes) */
@@ -282,12 +274,8 @@ typedef struct bNodeTreeType
 	
 	int (*validate_link)(struct bNodeTree *ntree, struct bNodeLink *link);
 
-	/* Default muting pointers. */
-	void (*mutefunc)(void *data, int thread, struct bNode *, void *nodedata, struct bNodeStack **, struct bNodeStack **);
-	ListBase (*mutelinksfunc)(struct bNodeTree *, struct bNode *, struct bNodeStack **, struct bNodeStack **,
-	                          struct GPUNodeStack *, struct GPUNodeStack *);
-	/* gpu */
-	int (*gpumutefunc)(struct GPUMaterial *, struct bNode *, void *, struct GPUNodeStack *, struct GPUNodeStack *);
+	/* Default internal linking. */
+	ListBase (*internal_connect)(struct bNodeTree *, struct bNode *node);
 } bNodeTreeType;
 
 /* ************** GENERIC API, TREES *************** */
@@ -341,7 +329,7 @@ struct bNode	*nodeAddNode(struct bNodeTree *ntree, struct bNodeTemplate *ntemp);
 void			nodeUnlinkNode(struct bNodeTree *ntree, struct bNode *node);
 void			nodeUniqueName(struct bNodeTree *ntree, struct bNode *node);
 
-void			nodeRegisterType(struct bNodeTreeType *ttype, struct bNodeType *ntype) ;
+void			nodeRegisterType(struct bNodeTreeType *ttype, struct bNodeType *ntype);
 void			nodeMakeDynamicType(struct bNode *node);
 int				nodeDynamicUnlinkText(struct ID *txtid);
 
@@ -351,6 +339,7 @@ struct bNode	*nodeCopyNode(struct bNodeTree *ntree, struct bNode *node);
 struct bNodeLink *nodeAddLink(struct bNodeTree *ntree, struct bNode *fromnode, struct bNodeSocket *fromsock, struct bNode *tonode, struct bNodeSocket *tosock);
 void			nodeRemLink(struct bNodeTree *ntree, struct bNodeLink *link);
 void			nodeRemSocketLinks(struct bNodeTree *ntree, struct bNodeSocket *sock);
+void			nodeInternalRelink(struct bNodeTree *ntree, struct bNode *node);
 
 void			nodeSpaceCoords(struct bNode *node, float *locx, float *locy);
 void			nodeAttachNode(struct bNode *node, struct bNode *parent);
@@ -375,6 +364,7 @@ int				nodeUpdateID(struct bNodeTree *ntree, struct ID *id);
 void			nodeFreePreview(struct bNode *node);
 
 int				nodeSocketIsHidden(struct bNodeSocket *sock);
+void			nodeSocketSetType(struct bNodeSocket *sock, int type);
 
 /* ************** NODE TYPE ACCESS *************** */
 
@@ -416,18 +406,12 @@ 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_mute(struct bNodeType *ntype,
-                               void (*mutefunc)(void *data, int thread, struct bNode *, void *nodedata,
-                                                struct bNodeStack **, struct bNodeStack **),
-                               ListBase (*mutelinksfunc)(struct bNodeTree *, struct bNode *, struct bNodeStack **,
-                                                         struct bNodeStack **, struct GPUNodeStack*, struct GPUNodeStack*));
+void			node_type_internal_connect(struct bNodeType *ntype, ListBase (*internal_connect)(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,
                                                                              void *nodedata, struct GPUNodeStack *in,
                                                                              struct GPUNodeStack *out));
-void			node_type_gpu_mute(struct bNodeType *ntype, int (*gpumutefunc)(struct GPUMaterial *, struct bNode *, void *,
-                                                                               struct GPUNodeStack *, struct GPUNodeStack *));
 void			node_type_compatibility(struct bNodeType *ntype, short compatibility);
 
 /* ************** COMMON NODES *************** */
@@ -653,6 +637,7 @@ void			ntreeGPUMaterialNodes(struct bNodeTree *ntree, struct GPUMaterial *mat);
 #define CMP_NODE_TRANSFORM	264
 #define CMP_NODE_MOVIEDISTORTION	265
 #define CMP_NODE_DOUBLEEDGEMASK    266
+#define CMP_NODE_OUTPUT_MULTI_FILE__DEPRECATED	267	/* DEPRECATED multi file node has been merged into regular CMP_NODE_OUTPUT_FILE */
 
 #define CMP_NODE_GLARE		301
 #define CMP_NODE_TONEMAP	302
@@ -692,6 +677,9 @@ void ntreeCompositTagGenerators(struct bNodeTree *ntree);
 void ntreeCompositForceHidden(struct bNodeTree *ntree, struct Scene *scene);
 void ntreeCompositClearTags(struct bNodeTree *ntree);
 
+struct bNodeSocket *ntreeCompositOutputFileAddSocket(struct bNodeTree *ntree, struct bNode *node,
+                                                     const char *name, struct ImageFormatData *im_format);
+int ntreeCompositOutputFileRemoveActiveSocket(struct bNodeTree *ntree, struct bNode *node);
 
 /* ************** TEXTURE NODES *************** */
 
@@ -727,9 +715,7 @@ struct TexResult;
 
 /* API */
 int  ntreeTexTagAnimated(struct bNodeTree *ntree);
-void ntreeTexSetPreviewFlag(int);
 void ntreeTexCheckCyclics(struct bNodeTree *ntree);
-char* ntreeTexOutputMenu(struct bNodeTree *ntree);
 
 struct bNodeTreeExec *ntreeTexBeginExecTree(struct bNodeTree *ntree, int use_tree_data);
 void ntreeTexEndExecTree(struct bNodeTreeExec *exec, int use_tree_data);
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 828b0b4..9713207 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_OBJECT_H
-#define BKE_OBJECT_H
+#ifndef __BKE_OBJECT_H__
+#define __BKE_OBJECT_H__
 
 /** \file BKE_object.h
  *  \ingroup bke
@@ -67,6 +67,8 @@ void update_base_layer(struct Scene *scene, struct Object *ob);
 void free_object(struct Object *ob);
 void object_free_display(struct Object *ob);
 
+int object_support_modifier_type(struct Object *ob, int modifier_type);
+
 void object_link_modifiers(struct Object *ob, struct Object *from);
 void object_free_modifiers(struct Object *ob);
 
@@ -83,9 +85,6 @@ struct Object *copy_object(struct Object *ob);
 void make_local_object(struct Object *ob);
 int object_is_libdata(struct Object *ob);
 int object_data_is_libdata(struct Object *ob);
-void set_mblur_offs(float blur);
-void set_field_offs(float field);
-void disable_speed_curve(int val);
 
 void object_scale_to_mat3(struct Object *ob, float mat[][3]);
 void object_rot_to_mat3(struct Object *ob, float mat[][3]);
@@ -104,13 +103,13 @@ void where_is_object_mat(struct Scene *scene, struct Object *ob, float obmat[4][
 struct BoundBox *unit_boundbox(void);
 void boundbox_set_from_min_max(struct BoundBox *bb, float min[3], float max[3]);
 struct BoundBox *object_get_boundbox(struct Object *ob);
-void object_get_dimensions(struct Object *ob, float *value);
+void object_get_dimensions(struct Object *ob, float vec[3]);
 void object_set_dimensions(struct Object *ob, const float *value);
 void object_boundbox_flag(struct Object *ob, int flag, int set);
 void minmax_object(struct Object *ob, float min[3], float max[3]);
-int minmax_object_duplis(struct Scene *scene, struct Object *ob, float *min, float *max);
+int minmax_object_duplis(struct Scene *scene, struct Object *ob, float min[3], float max[3]);
 
-/* sometimes min-max isnt enough, we need to loop over each point */
+/* sometimes min-max isn't enough, we need to loop over each point */
 void BKE_object_foreach_display_point(
         struct Object *ob, float obmat[4][4],
         void (*func_cb)(const float[3], void *), void *user_data);
@@ -122,7 +121,6 @@ void BKE_scene_foreach_display_point(
 
 int BKE_object_parent_loop_check(const struct Object *parent, const struct Object *ob);
 
-void solve_tracking (struct Object *ob, float targetmat[][4]);
 int ray_hit_boundbox(struct BoundBox *bb, float ray_start[3], float ray_normal[3]);
 
 void *object_tfm_backup(struct Object *ob);
diff --git a/source/blender/blenkernel/BKE_ocean.h b/source/blender/blenkernel/BKE_ocean.h
index c8ce3f8..7c0d99b 100644
--- a/source/blender/blenkernel/BKE_ocean.h
+++ b/source/blender/blenkernel/BKE_ocean.h
@@ -23,8 +23,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_OCEAN_H
-#define BKE_OCEAN_H
+#ifndef __BKE_OCEAN_H__
+#define __BKE_OCEAN_H__
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/source/blender/blenkernel/BKE_packedFile.h b/source/blender/blenkernel/BKE_packedFile.h
index 606d616..1eff20c 100644
--- a/source/blender/blenkernel/BKE_packedFile.h
+++ b/source/blender/blenkernel/BKE_packedFile.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_PACKEDFILE_H
-#define BKE_PACKEDFILE_H
+#ifndef __BKE_PACKEDFILE_H__
+#define __BKE_PACKEDFILE_H__
 
 /** \file BKE_packedFile.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 081b79b..acf39d8 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -25,14 +25,16 @@
  * ***** END GPL LICENSE BLOCK *****
  */ 
 
-#ifndef BKE_PAINT_H
-#define BKE_PAINT_H
+#ifndef __BKE_PAINT_H__
+#define __BKE_PAINT_H__
 
 /** \file BKE_paint.h
  *  \ingroup bke
  */
 
 struct Brush;
+struct MDisps;
+struct MeshElemMap;
 struct MFace;
 struct MultireModifierData;
 struct MVert;
@@ -61,19 +63,25 @@ void paint_brush_set(struct Paint *paint, struct Brush *br);
 int paint_facesel_test(struct Object *ob);
 int paint_vertsel_test(struct Object *ob);
 
+/* partial visibility */
+int paint_is_face_hidden(const struct MFace *f, const struct MVert *mvert);
+int paint_is_grid_face_hidden(const unsigned int *grid_hidden,
+							  int gridsize, int x, int y);
+
 /* Session data (mode-specific) */
 
 typedef struct SculptSession {
 	/* Mesh data (not copied) can come either directly from a Mesh, or from a MultiresDM */
 	struct MultiresModifierData *multires; /* Special handling for multires meshes */
 	struct MVert *mvert;
-	struct MFace *mface;
-	int totvert, totface;
+	struct MPoly *mpoly;
+	struct MLoop *mloop;
+	int totvert, totpoly;
 	float *face_normals;
 	struct KeyBlock *kb;
 	
 	/* Mesh connectivity */
-	struct ListBase *fmap;
+	const struct MeshElemMap *pmap;
 
 	/* PBVH acceleration structure */
 	struct PBVH *pbvh;
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h
index dbefbd9..67dba6f 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_PARTICLE_H
-#define BKE_PARTICLE_H
+#ifndef __BKE_PARTICLE_H__
+#define __BKE_PARTICLE_H__
 
 /** \file BKE_particle.h
  *  \ingroup bke
@@ -64,7 +64,7 @@ struct BVHTreeRayHit;
 #define LOOP_EXISTING_PARTICLES for(p=0, pa=psys->particles; p<psys->totpart; p++, pa++) if(!(pa->flag & PARS_UNEXIST))
 #define LOOP_SHOWN_PARTICLES for(p=0, pa=psys->particles; p<psys->totpart; p++, pa++) if(!(pa->flag & (PARS_UNEXIST|PARS_NO_DISP)))
 /* OpenMP: Can only advance one variable within loop definition. */
-#define LOOP_DYNAMIC_PARTICLES for(p=0; p<psys->totpart; p++ ) if((pa=psys->particles+p)->state.time > 0.f)
+#define LOOP_DYNAMIC_PARTICLES for(p=0; p<psys->totpart; p++ ) if((pa=psys->particles+p)->state.time > 0.0f)
 
 #define PSYS_FRAND_COUNT	1024
 #define PSYS_FRAND(seed)	psys->frand[(seed) % PSYS_FRAND_COUNT]
@@ -80,12 +80,12 @@ typedef struct ParticleSimulationData {
 	struct ParticleSystemModifierData *psmd;
 	struct ListBase *colliders;
 	/* Courant number. This is used to implement an adaptive time step. Only the
-	   maximum value per time step is important. Only sph_integrate makes use of
-	   this at the moment. Other solvers could, too. */
+	 * maximum value per time step is important. Only sph_integrate makes use of
+	 * this at the moment. Other solvers could, too. */
 	float courant_num;
 } ParticleSimulationData;
 
-typedef struct ParticleTexture{
+typedef struct ParticleTexture {
 	float ivel;							/* used in reset */
 	float time, life, exist, size;		/* used in init */
 	float damp, gravity, field;			/* used in physics */
@@ -93,13 +93,13 @@ typedef struct ParticleTexture{
 	float rough1, rough2, roughe;		/* used in path caching */
 } ParticleTexture;
 
-typedef struct ParticleSeam{
+typedef struct ParticleSeam {
 	float v0[3], v1[3];
 	float nor[3], dir[3], tan[3];
 	float length2;
 } ParticleSeam;
 
-typedef struct ParticleCacheKey{
+typedef struct ParticleCacheKey {
 	float co[3];
 	float vel[3];
 	float rot[4];
@@ -319,7 +319,7 @@ void psys_free_particles(struct ParticleSystem *psys);
 void psys_free_children(struct ParticleSystem *psys);
 
 void psys_interpolate_particle(short type, struct ParticleKey keys[4], float dt, struct ParticleKey *result, int velocity);
-void psys_vec_rot_to_face(struct DerivedMesh *dm, struct ParticleData *pa, float *vec);
+void psys_vec_rot_to_face(struct DerivedMesh *dm, struct ParticleData *pa, float vec[3]);
 void psys_mat_hair_to_object(struct Object *ob, struct DerivedMesh *dm, short from, struct ParticleData *pa, float hairmat[][4]);
 void psys_mat_hair_to_global(struct Object *ob, struct DerivedMesh *dm, short from, struct ParticleData *pa, float hairmat[][4]);
 void psys_mat_hair_to_orco(struct Object *ob, struct DerivedMesh *dm, short from, struct ParticleData *pa, float hairmat[][4]);
diff --git a/source/blender/blenkernel/BKE_plugin_types.h b/source/blender/blenkernel/BKE_plugin_types.h
index 73c6dae..8f9706f 100644
--- a/source/blender/blenkernel/BKE_plugin_types.h
+++ b/source/blender/blenkernel/BKE_plugin_types.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_PLUGIN_TYPES_H
-#define BKE_PLUGIN_TYPES_H
+#ifndef __BKE_PLUGIN_TYPES_H__
+#define __BKE_PLUGIN_TYPES_H__
 
 /** \file BKE_plugin_types.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h
index d1b0acf..d7d7324 100644
--- a/source/blender/blenkernel/BKE_pointcache.h
+++ b/source/blender/blenkernel/BKE_pointcache.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_POINTCACHE_H
-#define BKE_POINTCACHE_H
+#ifndef __BKE_POINTCACHE_H__
+#define __BKE_POINTCACHE_H__
 
 /** \file BKE_pointcache.h
  *  \ingroup bke
@@ -187,7 +187,7 @@ typedef struct PTCacheBaker {
 #define PEK_HIDE		4
 #define PEK_USE_WCO		8
 
-typedef struct PTCacheEditKey{
+typedef struct PTCacheEditKey {
 	float *co;
 	float *vel;
 	float *rot;
@@ -288,12 +288,6 @@ void BKE_ptcache_mem_pointers_init(struct PTCacheMem *pm);
 void BKE_ptcache_mem_pointers_incr(struct PTCacheMem *pm);
 int  BKE_ptcache_mem_pointers_seek(int point_index, struct PTCacheMem *pm);
 
-/* Copy a specific data type from cache data to point data. */
-void	BKE_ptcache_data_get(void **data, int type, int index, void *to);
-
-/* Copy a specific data type from point data to cache data. */
-void	BKE_ptcache_data_set(void **data, int type, void *from);
-
 /* Main cache reading call. */
 int		BKE_ptcache_read(PTCacheID *pid, float cfra);
 
diff --git a/source/blender/blenkernel/BKE_property.h b/source/blender/blenkernel/BKE_property.h
index 779c83a..a29dc0e 100644
--- a/source/blender/blenkernel/BKE_property.h
+++ b/source/blender/blenkernel/BKE_property.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_PROPERTY_H
-#define BKE_PROPERTY_H
+#ifndef __BKE_PROPERTY_H__
+#define __BKE_PROPERTY_H__
 
 /** \file BKE_property.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/BKE_report.h b/source/blender/blenkernel/BKE_report.h
index 784f8a6..aa625fa 100644
--- a/source/blender/blenkernel/BKE_report.h
+++ b/source/blender/blenkernel/BKE_report.h
@@ -23,8 +23,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_REPORT_H
-#define BKE_REPORT_H
+#ifndef __BKE_REPORT_H__
+#define __BKE_REPORT_H__
 
 /** \file BKE_report.h
  *  \ingroup bke
@@ -54,7 +54,11 @@ __attribute__ ((format (printf, 3, 4)))
 ;
 
 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, ...)
+#ifdef __GNUC__
+__attribute__ ((format (printf, 2, 3)))
+#endif
+;
 
 ReportType BKE_report_print_level(ReportList *reports);
 void BKE_report_print_level_set(ReportList *reports, ReportType level);
@@ -66,6 +70,8 @@ char *BKE_reports_string(ReportList *reports, ReportType level);
 void BKE_reports_print(ReportList *reports, ReportType level);
 
 Report *BKE_reports_last_displayable(ReportList *reports);
+
+int BKE_reports_contain(ReportList *reports, ReportType level);
 	
 #ifdef __cplusplus
 }
diff --git a/source/blender/blenkernel/BKE_sca.h b/source/blender/blenkernel/BKE_sca.h
index cfcc0e1..22b4451 100644
--- a/source/blender/blenkernel/BKE_sca.h
+++ b/source/blender/blenkernel/BKE_sca.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_SCA_H
-#define BKE_SCA_H
+#ifndef __BKE_SCA_H__
+#define __BKE_SCA_H__
 
 /** \file BKE_sca.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h
index 2df5e7a..e46d99e 100644
--- a/source/blender/blenkernel/BKE_scene.h
+++ b/source/blender/blenkernel/BKE_scene.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_SCENE_H
-#define BKE_SCENE_H
+#ifndef __BKE_SCENE_H__
+#define __BKE_SCENE_H__
 
 /** \file BKE_scene.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h
index 44b92f7..fbb93c7 100644
--- a/source/blender/blenkernel/BKE_screen.h
+++ b/source/blender/blenkernel/BKE_screen.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_SCREEN_H
-#define BKE_SCREEN_H
+#ifndef __BKE_SCREEN_H__
+#define __BKE_SCREEN_H__
 
 /** \file BKE_screen.h
  *  \ingroup bke
@@ -55,7 +55,7 @@ struct wmWindowManager;
 #include "RNA_types.h"
 
 /* spacetype has everything stored to get an editor working, it gets initialized via 
-   ED_spacetypes_init() in editors/area/spacetypes.c   */
+ * ED_spacetypes_init() in editors/area/spacetypes.c   */
 /* an editor in Blender is a combined ScrArea + SpaceType + SpaceData */
 
 #define BKE_ST_MAXNAME	64
diff --git a/source/blender/blenkernel/BKE_script.h b/source/blender/blenkernel/BKE_script.h
index d8ceaf2..7bd801a 100644
--- a/source/blender/blenkernel/BKE_script.h
+++ b/source/blender/blenkernel/BKE_script.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_SCRIPT_H
-#define BKE_SCRIPT_H
+#ifndef __BKE_SCRIPT_H__
+#define __BKE_SCRIPT_H__
 
 /** \file BKE_script.h
  *  \ingroup bke
@@ -46,4 +46,4 @@ void free_script (struct Script *script);
 }
 #endif
 
-#endif /* BKE_SCRIPT_H */
+#endif /* __BKE_SCRIPT_H__ */
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index ed0730b..598d1b6 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -23,8 +23,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_SEQUENCER_H
-#define BKE_SEQUENCER_H
+#ifndef __BKE_SEQUENCER_H__
+#define __BKE_SEQUENCER_H__
 
 /** \file BKE_sequencer.h
  *  \ingroup bke
@@ -40,6 +40,8 @@ struct Strip;
 struct StripElem;
 struct bSound;
 
+struct SeqIndexBuildContext;
+
 #define BUILD_SEQAR_COUNT_NOTHING  0
 #define BUILD_SEQAR_COUNT_CURRENT  1
 #define BUILD_SEQAR_COUNT_CHILDREN 2
@@ -67,14 +69,14 @@ void seq_array(struct Editing *ed, struct Sequence ***seqarray, int *tot, int us
 #define SEQP_BEGIN(ed, _seq)                                                  \
 {                                                                             \
 	SeqIterator iter;                                                         \
-		for(seq_begin(ed, &iter, 1); iter.valid; seq_next(&iter)) {           \
-			_seq= iter.seq;
+		for (seq_begin(ed, &iter, 1); iter.valid; seq_next(&iter)) {          \
+			_seq = iter.seq;
 			
 #define SEQ_BEGIN(ed, _seq)                                                   \
 	{                                                                         \
 		SeqIterator iter;                                                     \
-		for(seq_begin(ed, &iter, 0); iter.valid; seq_next(&iter)) {           \
-			_seq= iter.seq;
+		for (seq_begin(ed, &iter, 0); iter.valid; seq_next(&iter)) {          \
+			_seq = iter.seq;
 
 #define SEQ_END                                                               \
 		}                                                                     \
@@ -99,8 +101,14 @@ int seq_cmp_render_data(const SeqRenderData * a, const SeqRenderData * b);
 unsigned int seq_hash_render_data(const SeqRenderData * a);
 
 /* Wipe effect */
-enum {DO_SINGLE_WIPE, DO_DOUBLE_WIPE, DO_BOX_WIPE, DO_CROSS_WIPE,
-	DO_IRIS_WIPE,DO_CLOCK_WIPE};
+enum {
+	DO_SINGLE_WIPE,
+	DO_DOUBLE_WIPE,
+	DO_BOX_WIPE,
+	DO_CROSS_WIPE,
+	DO_IRIS_WIPE,
+	DO_CLOCK_WIPE
+};
 
 
 struct SeqEffectHandle {
@@ -110,11 +118,11 @@ struct SeqEffectHandle {
 	void (*init_plugin)(struct Sequence *seq, const char *fname);
 	
 	/* number of input strips needed 
-		(called directly after construction) */
+	 * (called directly after construction) */
 	int (*num_inputs)(void);
 	
 	/* load is called first time after readblenfile in
-		get_sequence_effect automatically */
+	 * get_sequence_effect automatically */
 	void (*load)(struct Sequence *seq);
 	
 	/* duplicate */
@@ -124,23 +132,21 @@ struct SeqEffectHandle {
 	void (*free)(struct Sequence *seq);
 	
 	/* returns: -1: no input needed,
-	0: no early out, 
-	1: out = ibuf1, 
-	2: out = ibuf2 */
+	 * 0: no early out,
+	 * 1: out = ibuf1,
+	 * 2: out = ibuf2 */
 	int (*early_out)(struct Sequence *seq, float facf0, float facf1); 
 	
 	/* stores the y-range of the effect IPO */
-	void (*store_icu_yrange)(struct Sequence * seq,
-                                 short adrcode, float *ymin, float *ymax);
+	void (*store_icu_yrange)(struct Sequence * seq, short adrcode, float *ymin, float *ymax);
 	
 	/* stores the default facf0 and facf1 if no IPO is present */
-	void (*get_default_fac)(struct Sequence *seq, float cfra,
-                                float * facf0, float * facf1);
+	void (*get_default_fac)(struct Sequence *seq, float cfra, float * facf0, float * facf1);
 	
 	/* execute the effect
-           sequence effects are only required to either support
-           float-rects or byte-rects 
-           (mixed cases are handled one layer up...) */
+	 * sequence effects are only required to either support
+	 * float-rects or byte-rects
+	 * (mixed cases are handled one layer up...) */
 	
 	struct ImBuf* (*execute)(
 		SeqRenderData context,
@@ -153,10 +159,10 @@ struct SeqEffectHandle {
 /* ********************* prototypes *************** */
 
 /* **********************************************************************
-   * sequence.c
-
-   * sequencer render functions
-   ********************************************************************** */
+ * sequence.c
+ *
+ * sequencer render functions
+ * ********************************************************************** */
 
 struct ImBuf *give_ibuf_seq(SeqRenderData context, float cfra, int chanshown);
 struct ImBuf *give_ibuf_seq_threaded(SeqRenderData context, float cfra, int chanshown);
@@ -168,7 +174,7 @@ void give_ibuf_prefetch_request(SeqRenderData context, float cfra, int chan_show
 int seqbase_recursive_apply(struct ListBase *seqbase, int (*apply_func)(struct Sequence *seq, void *), void *arg);
 int seq_recursive_apply(struct Sequence *seq, int (*apply_func)(struct Sequence *, void *), void *arg);
 
-/* maintainance functions, mostly for RNA */
+/* maintenance functions, mostly for RNA */
 // extern 
 void seq_free_sequence(struct Scene *scene, struct Sequence *seq);
 void seq_free_sequence_recurse(struct Scene *scene, struct Sequence *seq);
@@ -179,7 +185,6 @@ struct Editing *seq_give_editing(struct Scene *scene, int alloc);
 const char *give_seqname(struct Sequence *seq);
 void calc_sequence(struct Scene *scene, struct Sequence *seq);
 void calc_sequence_disp(struct Scene *scene, struct Sequence *seq);
-void new_tstripdata(struct Sequence *seq);
 void reload_sequence_new_file(struct Scene *scene, struct Sequence * seq, int lock_range);
 void sort_seq(struct Scene *scene);
 void build_seqar_cb(struct ListBase *seqbase, struct Sequence  ***seqar, int *totseq,
@@ -194,16 +199,17 @@ void update_changed_seq_and_deps(struct Scene *scene, struct Sequence *changed_s
 int input_have_to_preprocess(
 	SeqRenderData context, struct Sequence * seq, float cfra);
 
-void seq_proxy_rebuild(struct Main * bmain, 
-                       struct Scene *scene, struct Sequence * seq,
+struct SeqIndexBuildContext *seq_proxy_rebuild_context(struct Main *bmain, struct Scene *scene, struct Sequence *seq);
+void seq_proxy_rebuild(struct SeqIndexBuildContext *context,
                        short *stop, short *do_update, float *progress);
+void seq_proxy_rebuild_finish(struct SeqIndexBuildContext *context, short stop);
 
 
 /* **********************************************************************
-   seqcache.c
-
-   Sequencer memory cache management functions
-   ********************************************************************** */
+ * seqcache.c
+ *
+ * Sequencer memory cache management functions
+ * ********************************************************************** */
 
 typedef enum {
 	SEQ_STRIPELEM_IBUF,
@@ -221,20 +227,20 @@ struct ImBuf * seq_stripelem_cache_get(
 	float cfra, seq_stripelem_ibuf_t type);
 
 /* passed ImBuf is properly refed, so ownership is *not* 
-   transfered to the cache.
-   you can pass the same ImBuf multiple times to the cache without problems.
-*/
+ * transfered to the cache.
+ * you can pass the same ImBuf multiple times to the cache without problems.
+ */
    
 void seq_stripelem_cache_put(
 	SeqRenderData context, struct Sequence * seq, 
 	float cfra, seq_stripelem_ibuf_t type, struct ImBuf * nval);
 
 /* **********************************************************************
-   seqeffects.c 
-
-   Sequencer effect strip managment functions
-   **********************************************************************
-*/
+ * seqeffects.c
+ *
+ * Sequencer effect strip managment functions
+ *  **********************************************************************
+ */
 
 /* intern */
 struct SeqEffectHandle get_sequence_blend(struct Sequence *seq);
@@ -246,9 +252,9 @@ int get_sequence_effect_num_inputs(int seq_type);
 
 
 /* **********************************************************************
-   Sequencer editing functions
-   **********************************************************************
-*/
+ * Sequencer editing functions
+ * **********************************************************************
+ */
    
 /* for transform but also could use elsewhere */
 int seq_tx_get_start(struct Sequence *seq);
@@ -283,7 +289,6 @@ void seq_update_sound_bounds_all(struct Scene *scene);
 void seq_update_sound_bounds(struct Scene* scene, struct Sequence *seq);
 void seq_update_muting(struct Editing *ed);
 void seq_update_sound(struct Scene *scene, struct bSound *sound);
-void seqbase_sound_reload(struct Scene *scene, ListBase *seqbase);
 void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq);
 void seqbase_dupli_recursive(struct Scene *scene, struct Scene *scene_to, ListBase *nseqbase, ListBase *seqbase, int dupe_flag);
 
@@ -334,11 +339,11 @@ struct Sequence *sequencer_add_sound_strip(struct bContext *C, ListBase *seqbase
 struct Sequence *sequencer_add_movie_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load);
 
 /* view3d draw callback, run when not in background view */
-typedef struct ImBuf *(*SequencerDrawView)(struct Scene *, struct Object *, int, int, unsigned int, int, char[256]);
+typedef struct ImBuf *(*SequencerDrawView)(struct Scene *, struct Object *, int, int, unsigned int, int, int, char[256]);
 extern SequencerDrawView sequencer_view3d_cb;
 
 /* copy/paste */
 extern ListBase seqbase_clipboard;
 extern int seqbase_clipboard_frame;
 
-#endif // BKE_SEQUENCER_H
+#endif // __BKE_SEQUENCER_H__
diff --git a/source/blender/blenkernel/BKE_shrinkwrap.h b/source/blender/blenkernel/BKE_shrinkwrap.h
index d1fef8b..626dd64 100644
--- a/source/blender/blenkernel/BKE_shrinkwrap.h
+++ b/source/blender/blenkernel/BKE_shrinkwrap.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_SHRINKWRAP_H
-#define BKE_SHRINKWRAP_H
+#ifndef __BKE_SHRINKWRAP_H__
+#define __BKE_SHRINKWRAP_H__
 
 /** \file BKE_shrinkwrap.h
  *  \ingroup bke
@@ -90,7 +90,7 @@ void space_transform_invert(const struct SpaceTransform *data, float *co);
  *    - Normal projection
  *
  * ShrinkwrapCalcData encapsulates all needed data for shrinkwrap functions.
- * (So that you dont have to pass an enormous amount of arguments to functions)
+ * (So that you don't have to pass an enormous amount of arguments to functions)
  */
 
 struct Object;
diff --git a/source/blender/blenkernel/BKE_sketch.h b/source/blender/blenkernel/BKE_sketch.h
index 1dd82c1..9cdf9a8 100644
--- a/source/blender/blenkernel/BKE_sketch.h
+++ b/source/blender/blenkernel/BKE_sketch.h
@@ -19,8 +19,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_SKETCH_H
-#define BKE_SKETCH_H
+#ifndef __BKE_SKETCH_H__
+#define __BKE_SKETCH_H__
 
 /** \file BKE_sketch.h
  *  \ingroup bke
@@ -142,7 +142,7 @@ void sk_reverseStroke(SK_Stroke *stk);
 void sk_filterLastContinuousStroke(SK_Stroke *stk);
 void sk_filterStroke(SK_Stroke *stk, int start, int end);
 
-void sk_initPoint(SK_Point *pt, SK_DrawData *dd, float *no);
+void sk_initPoint(SK_Point *pt, SK_DrawData *dd, const float no[3]);
 void sk_copyPoint(SK_Point *dst, SK_Point *src);
 
 int sk_stroke_filtermval(SK_DrawData *dd);
diff --git a/source/blender/blenkernel/BKE_smoke.h b/source/blender/blenkernel/BKE_smoke.h
index 51acef4..1e97bc0 100644
--- a/source/blender/blenkernel/BKE_smoke.h
+++ b/source/blender/blenkernel/BKE_smoke.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_SMOKE_H_
-#define BKE_SMOKE_H_
+#ifndef __BKE_SMOKE_H__
+#define __BKE_SMOKE_H__
 
 /** \file BKE_smoke.h
  *  \ingroup bke
@@ -45,4 +45,4 @@ void smokeModifier_copy(struct SmokeModifierData *smd, struct SmokeModifierData
 
 long long smoke_get_mem_req(int xres, int yres, int zres, int amplify);
 
-#endif /* BKE_SMOKE_H_ */
+#endif /* __BKE_SMOKE_H__ */
diff --git a/source/blender/blenkernel/BKE_softbody.h b/source/blender/blenkernel/BKE_softbody.h
index c889aa8..6714225 100644
--- a/source/blender/blenkernel/BKE_softbody.h
+++ b/source/blender/blenkernel/BKE_softbody.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_SOFTBODY_H
-#define BKE_SOFTBODY_H
+#ifndef __BKE_SOFTBODY_H__
+#define __BKE_SOFTBODY_H__
 
 /** \file BKE_softbody.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/BKE_sound.h b/source/blender/blenkernel/BKE_sound.h
index fdf1d09..8b01dbd 100644
--- a/source/blender/blenkernel/BKE_sound.h
+++ b/source/blender/blenkernel/BKE_sound.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_SOUND_H
-#define BKE_SOUND_H
+#ifndef __BKE_SOUND_H__
+#define __BKE_SOUND_H__
 
 /** \file BKE_sound.h
  *  \ingroup bke
@@ -79,7 +79,7 @@ void sound_load(struct Main *main, struct bSound* sound);
 
 void sound_free(struct bSound* sound);
 
-#ifdef AUD_CAPI
+#ifdef __AUD_C_API_H__
 AUD_Device* sound_mixdown(struct Scene *scene, AUD_DeviceSpecs specs, int start, float volume);
 #endif
 
diff --git a/source/blender/blenkernel/BKE_speaker.h b/source/blender/blenkernel/BKE_speaker.h
index d309c04..fddcfb2 100644
--- a/source/blender/blenkernel/BKE_speaker.h
+++ b/source/blender/blenkernel/BKE_speaker.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_SPEAKER_H
-#define BKE_SPEAKER_H
+#ifndef __BKE_SPEAKER_H__
+#define __BKE_SPEAKER_H__
 
 /** \file BKE_speaker.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/BKE_subsurf.h b/source/blender/blenkernel/BKE_subsurf.h
index dcbd045..8179c68 100644
--- a/source/blender/blenkernel/BKE_subsurf.h
+++ b/source/blender/blenkernel/BKE_subsurf.h
@@ -24,28 +24,35 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_SUBSURF_H
-#define BKE_SUBSURF_H
+#ifndef __BKE_SUBSURF_H__
+#define __BKE_SUBSURF_H__
 
 /** \file BKE_subsurf.h
  *  \ingroup bke
  */
 
+/* struct DerivedMesh is used directly */
+#include "BKE_DerivedMesh.h"
+
+struct DMFlagMat;
 struct DMGridAdjacency;
 struct DMGridData;
 struct DerivedMesh;
-struct EditMesh;
-struct IndexNode;
-struct ListBase;
+struct MeshElemMap;
 struct Mesh;
+struct MPoly;
 struct MultiresSubsurf;
 struct Object;
 struct PBVH;
 struct SubsurfModifierData;
-struct _CCGEdge;
-struct _CCGFace;
-struct _CCGSubsurf;
-struct _CCGVert;
+struct CCGEdge;
+struct CCGFace;
+struct CCGSubsurf;
+struct CCGVert;
+struct EdgeHash;
+struct PBVH;
+struct DMGridData;
+struct DMGridAdjacency;
 
 /**************************** External *****************************/
 
@@ -57,31 +64,56 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
 
 void subsurf_calculate_limit_positions(struct Mesh *me, float (*positions_r)[3]);
 
+/* get gridsize from 'level', level must be greater than zero */
+int ccg_gridsize(int level);
+
+/* x/y grid coordinates at 'low_level' can be multiplied by the result
+ * of this function to convert to grid coordinates at 'high_level' */
+int ccg_factor(int low_level, int high_level);
+
+void subsurf_copy_grid_hidden(struct DerivedMesh *dm,
+							  const struct MPoly *mpoly,
+							  struct MVert *mvert,
+							  const struct MDisps *mdisps);
+
+typedef enum MultiresModifiedFlags {
+	/* indicates the grids have been sculpted on, so MDisps
+	 * have to be updated */
+	MULTIRES_COORDS_MODIFIED = 1,
+	/* indicates elements have been hidden or unhidden */
+	MULTIRES_HIDDEN_MODIFIED = 2
+} MultiresModifiedFlags;
+
 /**************************** Internal *****************************/
 
 typedef struct CCGDerivedMesh {
 	DerivedMesh dm;
 
-	struct _CCGSubSurf *ss;
+	struct CCGSubSurf *ss;
 	int freeSS;
 	int drawInteriorEdges, useSubsurfUv;
 
-	struct {int startVert; struct _CCGVert *vert;} *vertMap;
-	struct {int startVert; int startEdge; struct _CCGEdge *edge;} *edgeMap;
+	struct {int startVert; struct CCGVert *vert;} *vertMap;
+	struct {int startVert; int startEdge; struct CCGEdge *edge;} *edgeMap;
 	struct {int startVert; int startEdge;
-			int startFace; struct _CCGFace *face;} *faceMap;
+			int startFace; struct CCGFace *face;} *faceMap;
 
 	short *edgeFlags;
-	char *faceFlags;
+	struct DMFlagMat *faceFlags;
+
+	int *reverseFaceMap;
 
 	struct PBVH *pbvh;
-	struct ListBase *fmap;
-	struct IndexNode *fmap_mem;
+
+	struct MeshElemMap *pmap;
+	int *pmap_mem;
 
 	struct DMGridData **gridData;
 	struct DMGridAdjacency *gridAdjacency;
 	int *gridOffset;
-	struct _CCGFace **gridFaces;
+	struct CCGFace **gridFaces;
+	struct DMFlagMat *gridFlagMats;
+	unsigned int **gridHidden;
 
 	struct {
 		struct MultiresModifierData *mmd;
@@ -91,10 +123,10 @@ typedef struct CCGDerivedMesh {
 		float (*orco)[3];
 
 		struct Object *ob;
-		int modified;
-
-		void (*update)(DerivedMesh*);
+		MultiresModifiedFlags modified_flags;
 	} multires;
+
+	struct EdgeHash *ehash;
 } CCGDerivedMesh;
 
 #endif
diff --git a/source/blender/blenkernel/BKE_suggestions.h b/source/blender/blenkernel/BKE_suggestions.h
index a0a2704..9b61d91 100644
--- a/source/blender/blenkernel/BKE_suggestions.h
+++ b/source/blender/blenkernel/BKE_suggestions.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_SUGGESTIONS_H
-#define BKE_SUGGESTIONS_H
+#ifndef __BKE_SUGGESTIONS_H__
+#define __BKE_SUGGESTIONS_H__
 
 /** \file BKE_suggestions.h
  *  \ingroup bke
@@ -36,19 +36,19 @@ extern "C" {
 #endif
 
 /* ****************************************************************************
-Suggestions should be added in sorted order although a linear sorting method is
-implemented. The list is then divided up based on the prefix provided by
-update_suggestions:
-
-Example:
-  Prefix: ab
-  aaa <-- first
-  aab
-  aba <-- firstmatch
-  abb <-- lastmatch
-  baa
-  bab <-- last
-**************************************************************************** */
+ * Suggestions should be added in sorted order although a linear sorting method is
+ * implemented. The list is then divided up based on the prefix provided by
+ * update_suggestions:
+ *
+ * Example:
+ *   Prefix: ab
+ *   aaa <-- first
+ *   aab
+ *   aba <-- firstmatch
+ *   abb <-- lastmatch
+ *   baa
+ *   bab <-- last
+ **************************************************************************** */
 
 struct Text;
 
diff --git a/source/blender/blenkernel/BKE_tessmesh.h b/source/blender/blenkernel/BKE_tessmesh.h
new file mode 100644
index 0000000..3a80665
--- /dev/null
+++ b/source/blender/blenkernel/BKE_tessmesh.h
@@ -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.
+ *
+ * Contributor(s): Joseph Eagar.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BKE_TESSMESH_H__
+#define __BKE_TESSMESH_H__
+
+#include "BKE_customdata.h"
+#include "bmesh.h"
+
+struct BMesh;
+struct BMLoop;
+struct BMFace;
+struct Mesh;
+struct DerivedMesh;
+
+/* ok: the EDBM module is for editmode bmesh stuff.  in contrast, the 
+ *     BMEdit module is for code shared with blenkernel that concerns
+ *     the BMEditMesh structure.
+ */
+
+/* this structure replaces EditMesh.
+ *
+ * through this, you get access to both the edit bmesh,
+ * it's tessellation, and various stuff that doesn't belong in the BMesh
+ * struct itself.
+ *
+ * the entire derivedmesh and modifier system works with this structure,
+ * and not BMesh.  Mesh->edit_bmesh stores a pointer to this structure. */
+typedef struct BMEditMesh {
+	struct BMesh *bm;
+
+	/*this is for undoing failed operations*/
+	struct BMEditMesh *emcopy;
+	int emcopyusers;
+	
+	/* we store tessellations as triplets of three loops,
+	 * which each define a triangle.*/
+	struct BMLoop *(*looptris)[3];
+	int tottri;
+
+	/*derivedmesh stuff*/
+	struct DerivedMesh *derivedFinal, *derivedCage;
+	CustomDataMask lastDataMask;
+
+	/* index tables, to map indices to elements via
+	 * EDBM_index_arrays_init and associated functions.  don't
+	 * touch this or read it directly.*/
+	struct BMVert **vert_index;
+	struct BMEdge **edge_index;
+	struct BMFace **face_index;
+
+	/*selection mode*/
+	short selectmode;
+	short mat_nr;
+
+	/*Mesh structure this editmesh came from, if it came from one*/
+	struct Mesh *me;
+	struct Object *ob;
+
+	/*temp variables for x-mirror editing*/
+	int mirror_cdlayer; /* -1 is invalid */
+	int mirr_free_arrays;
+} BMEditMesh;
+
+void BMEdit_RecalcTessellation(BMEditMesh *tm);
+BMEditMesh *BMEdit_Create(BMesh *bm, int do_tessellate);
+BMEditMesh *BMEdit_Copy(BMEditMesh *tm);
+BMEditMesh *BMEdit_FromObject(struct Object *ob);
+void BMEdit_Free(BMEditMesh *em);
+void BMEdit_UpdateLinkedCustomData(BMEditMesh *em);
+
+#endif /* __BKE_TESSMESH_H__ */
diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h
index f0c0545..0a94d89 100644
--- a/source/blender/blenkernel/BKE_text.h
+++ b/source/blender/blenkernel/BKE_text.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_TEXT_H
-#define BKE_TEXT_H
+#ifndef __BKE_TEXT_H__
+#define __BKE_TEXT_H__
 
 /** \file BKE_text.h
  *  \ingroup bke
@@ -60,8 +60,8 @@ void	txt_order_cursors	(struct Text *text);
 int		txt_find_string		(struct Text *text, const char *findstr, int wrap, int match_case);
 int		txt_has_sel			(struct Text *text);
 int		txt_get_span		(struct TextLine *from, struct TextLine *to);
-int		txt_utf8_offset_to_index(char *str, int offset);
-int		txt_utf8_index_to_offset(char *str, int index);
+int		txt_utf8_offset_to_index(const char *str, int offset);
+int		txt_utf8_index_to_offset(const char *str, int index);
 void	txt_move_up			(struct Text *text, short sel);
 void	txt_move_down		(struct Text *text, short sel);
 void	txt_move_left		(struct Text *text, short sel);
@@ -92,8 +92,6 @@ void	txt_backspace_word	(struct Text *text);
 int		txt_add_char		(struct Text *text, unsigned int add);
 int		txt_add_raw_char	(struct Text *text, unsigned int add);
 int		txt_replace_char	(struct Text *text, unsigned int add);
-void	txt_export_to_object(struct Text *text);
-void	txt_export_to_objects(struct Text *text);
 void	txt_unindent		(struct Text *text);
 void 	txt_comment			(struct Text *text);
 void 	txt_indent			(struct Text *text);
@@ -107,15 +105,13 @@ struct TextMarker	*txt_find_marker		(struct Text *text, struct TextLine *line, i
 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);
-struct TextMarker	*txt_prev_marker_color	(struct Text *text, struct TextMarker *marker);
-struct TextMarker	*txt_next_marker_color	(struct Text *text, struct TextMarker *marker);
 
 /* utility functions, could be moved somewhere more generic but are python/text related  */
-int text_check_bracket(char ch);
-int text_check_delim(char ch);
-int text_check_digit(char ch);
-int text_check_identifier(char ch);
-int text_check_whitespace(char ch);
+int text_check_bracket(const char ch);
+int text_check_delim(const char ch);
+int text_check_digit(const char ch);
+int text_check_identifier(const char ch);
+int text_check_whitespace(const char ch);
 
 
 /* Undo opcodes */
diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h
index a67a06e..2574c45 100644
--- a/source/blender/blenkernel/BKE_texture.h
+++ b/source/blender/blenkernel/BKE_texture.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_TEXTURE_H
-#define BKE_TEXTURE_H
+#ifndef __BKE_TEXTURE_H__
+#define __BKE_TEXTURE_H__
 
 /** \file BKE_texture.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/BKE_tracking.h b/source/blender/blenkernel/BKE_tracking.h
index f720050..2bb8fc6 100644
--- a/source/blender/blenkernel/BKE_tracking.h
+++ b/source/blender/blenkernel/BKE_tracking.h
@@ -24,10 +24,10 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_TRACKING_H
-#define BKE_TRACKING_H
+#ifndef __BKE_TRACKING_H__
+#define __BKE_TRACKING_H__
 
-/** \file BKE_trackingp.h
+/** \file BKE_tracking.h
  *  \ingroup bke
  *  \author Sergey Sharybin
  */
@@ -52,9 +52,9 @@ void BKE_tracking_clamp_track(struct MovieTrackingTrack *track, int event);
 void BKE_tracking_track_flag(struct MovieTrackingTrack *track, int area, int flag, int clear);
 
 struct MovieTrackingTrack *BKE_tracking_add_track(struct MovieTracking *tracking, struct ListBase *tracksbase,
-			float x, float y, int framenr, int width, int height);
+                                                  float x, float y, int framenr, int width, int height);
 struct MovieTrackingMarker *BKE_tracking_insert_marker(struct MovieTrackingTrack *track,
-			struct MovieTrackingMarker *marker);
+                                                       struct MovieTrackingMarker *marker);
 void BKE_tracking_delete_marker(struct MovieTrackingTrack *track, int framenr);
 
 struct MovieTrackingMarker *BKE_tracking_get_marker(struct MovieTrackingTrack *track, int framenr);
@@ -67,14 +67,15 @@ void BKE_tracking_free_track(struct MovieTrackingTrack *track);
 
 void BKE_tracking_clear_path(struct MovieTrackingTrack *track, int ref_frame, int action);
 
-int BKE_tracking_test_join_tracks(struct MovieTrackingTrack *dst_track, struct MovieTrackingTrack *src_track);
 void BKE_tracking_join_tracks(struct MovieTrackingTrack *dst_track, struct MovieTrackingTrack *src_track);
 void BKE_tracking_free(struct MovieTracking *tracking);
 
 struct ImBuf *BKE_tracking_get_pattern_imbuf(struct ImBuf *ibuf, struct MovieTrackingTrack *track,
-			struct MovieTrackingMarker *marker, int margin, int anchored, float pos[2], int origin[2]);
+                                             struct MovieTrackingMarker *marker, int margin, int anchored,
+                                             float pos[2], int origin[2]);
 struct ImBuf *BKE_tracking_get_search_imbuf(struct ImBuf *ibuf, struct MovieTrackingTrack *track,
-			struct MovieTrackingMarker *marker, int margin, int anchored, float pos[2], int origin[2]);
+                                            struct MovieTrackingMarker *marker, int margin, int anchored,
+                                            float pos[2], int origin[2]);
 
 void BKE_track_unique_name(struct ListBase *tracksbase, struct MovieTrackingTrack *track);
 
@@ -86,7 +87,7 @@ void BKE_tracking_camera_to_blender(struct MovieTracking *tracking, struct Scene
 
 void BKE_get_tracking_mat(struct Scene *scene, struct Object *ob, float mat[4][4]);
 void BKE_tracking_projection_matrix(struct MovieTracking *tracking, struct MovieTrackingObject *object,
-			int framenr, int winx, int winy, float mat[4][4]);
+                                    int framenr, int winx, int winy, float mat[4][4]);
 
 struct ListBase *BKE_tracking_get_tracks(struct MovieTracking *tracking);
 struct MovieTrackingReconstruction *BKE_tracking_get_reconstruction(struct MovieTracking *tracking);
@@ -96,7 +97,7 @@ struct MovieTrackingObject *BKE_tracking_active_object(struct MovieTracking *tra
 struct MovieTrackingObject *BKE_tracking_get_camera_object(struct MovieTracking *tracking);
 struct ListBase *BKE_tracking_object_tracks(struct MovieTracking *tracking, struct MovieTrackingObject *object);
 struct MovieTrackingReconstruction *BKE_tracking_object_reconstruction(struct MovieTracking *tracking,
-			struct MovieTrackingObject *object);
+                                                                       struct MovieTrackingObject *object);
 
 void BKE_tracking_disable_imbuf_channels(struct ImBuf *ibuf, int disable_red, int disable_green, int disable_blue, int grayscale);
 
@@ -116,29 +117,29 @@ int BKE_tracking_next(struct MovieTrackingContext *context);
 
 /* Camera solving */
 int BKE_tracking_can_reconstruct(struct MovieTracking *tracking, struct MovieTrackingObject *object,
-			char *error_msg, int error_size);
+                                 char *error_msg, int error_size);
 
 struct MovieReconstructContext* BKE_tracking_reconstruction_context_new(struct MovieTracking *tracking,
 			struct MovieTrackingObject *object, int keyframe1, int keyframe2, int width, int height);
 void BKE_tracking_reconstruction_context_free(struct MovieReconstructContext *context);
-void BKE_tracking_solve_reconstruction(struct MovieReconstructContext *context,
-			short *stop, short *do_update, float *progress, char *stats_message, int message_size);
+void BKE_tracking_solve_reconstruction(struct MovieReconstructContext *context, short *stop, short *do_update,
+                                       float *progress, char *stats_message, int message_size);
 int BKE_tracking_finish_reconstruction(struct MovieReconstructContext *context, struct MovieTracking *tracking);
 
 struct MovieReconstructedCamera *BKE_tracking_get_reconstructed_camera(struct MovieTracking *tracking,
 			struct MovieTrackingObject *object, int framenr);
-void BKE_tracking_get_interpolated_camera(struct MovieTracking *tracking,
-			struct MovieTrackingObject *object, int framenr, float mat[4][4]);
+void BKE_tracking_get_interpolated_camera(struct MovieTracking *tracking, struct MovieTrackingObject *object,
+                                          int framenr, float mat[4][4]);
 
 /* Feature detection */
 void BKE_tracking_detect_fast(struct MovieTracking *tracking, struct ListBase *tracksbase, struct ImBuf *imbuf,
-			int framenr, int margin, int min_trackness, int min_distance, struct bGPDlayer *layer,
-			int place_outside_layer);
+                              int framenr, int margin, int min_trackness, int min_distance, struct bGPDlayer *layer,
+                              int place_outside_layer);
 
 /* 2D stabilization */
 void BKE_tracking_stabilization_data(struct MovieTracking *tracking, int framenr, int width, int height, float loc[2], float *scale, float *angle);
 struct ImBuf *BKE_tracking_stabilize(struct MovieTracking *tracking, int framenr, struct ImBuf *ibuf, float loc[2], float *scale, float *angle);
-void BKE_tracking_stabdata_to_mat4(int width, int height, float loc[2], float scale, float angle, float mat[4][4]);
+void BKE_tracking_stabdata_to_mat4(int width, int height, float aspect, float loc[2], float scale, float angle, float mat[4][4]);
 
 /* Distortion/Undistortion */
 void BKE_tracking_apply_intrinsics(struct MovieTracking *tracking, float co[2], float nco[2]);
@@ -147,7 +148,7 @@ void BKE_tracking_invert_intrinsics(struct MovieTracking *tracking, float co[2],
 struct MovieDistortion *BKE_tracking_distortion_create(void);
 struct MovieDistortion *BKE_tracking_distortion_copy(struct MovieDistortion *distortion);
 struct ImBuf *BKE_tracking_distortion_exec(struct MovieDistortion *distortion, struct MovieTracking *tracking,
-			struct ImBuf *ibuf, int width, int height, float overscan, int undistort);
+                                           struct ImBuf *ibuf, int width, int height, float overscan, int undistort);
 void BKE_tracking_distortion_destroy(struct MovieDistortion *distortion);
 
 struct ImBuf *BKE_tracking_undistort(struct MovieTracking *tracking, struct ImBuf *ibuf, int width, int height, float overscan);
@@ -163,11 +164,18 @@ struct MovieTrackingObject *BKE_tracking_named_object(struct MovieTracking *trac
 void BKE_tracking_select_track(struct ListBase *tracksbase, struct MovieTrackingTrack *track, int area, int extend);
 void BKE_tracking_deselect_track(struct MovieTrackingTrack *track, int area);
 
-#define TRACK_SELECTED(track)				((((track)->flag&TRACK_HIDDEN)==0) && ((track)->flag&SELECT || (track)->pat_flag&SELECT || (track)->search_flag&SELECT))
-#define TRACK_AREA_SELECTED(track, area)	((((track)->flag&TRACK_HIDDEN)==0) && ((area)==TRACK_AREA_POINT?(track)->flag&SELECT : ((area)==TRACK_AREA_PAT?(track)->pat_flag&SELECT:(track)->search_flag&SELECT)))
-#define TRACK_VIEW_SELECTED(sc, track)		((TRACK_AREA_SELECTED(track, TRACK_AREA_POINT) || (((sc)->flag&SC_SHOW_MARKER_PATTERN && TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))) || (((sc)->flag&SC_SHOW_MARKER_SEARCH && TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH)))))
+#define TRACK_SELECTED(track)				((track)->flag&SELECT || (track)->pat_flag&SELECT || (track)->search_flag&SELECT)
 
-#define MARKER_VISIBLE(sc, marker)			(((marker)->flag&MARKER_DISABLED)==0 || ((sc)->flag&SC_HIDE_DISABLED)==0)
+#define TRACK_AREA_SELECTED(track, area)	((area)==TRACK_AREA_POINT ? (track)->flag&SELECT : \
+                                                                        ((area)==TRACK_AREA_PAT ? (track)->pat_flag&SELECT : \
+                                                                                                  (track)->search_flag&SELECT))
+
+#define TRACK_VIEW_SELECTED(sc, track)		((((track)->flag & TRACK_HIDDEN)==0) && \
+                                             (  TRACK_AREA_SELECTED(track, TRACK_AREA_POINT) || \
+                                                (((sc)->flag & SC_SHOW_MARKER_PATTERN) && TRACK_AREA_SELECTED(track, TRACK_AREA_PAT)) || \
+                                                (((sc)->flag & SC_SHOW_MARKER_SEARCH) && TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))))
+
+#define MARKER_VISIBLE(sc, marker)			(((marker)->flag & MARKER_DISABLED)==0 || ((sc)->flag & SC_HIDE_DISABLED)==0)
 
 #define TRACK_CLEAR_UPTO		0
 #define TRACK_CLEAR_REMAINED	1
diff --git a/source/blender/blenkernel/BKE_unit.h b/source/blender/blenkernel/BKE_unit.h
index db586f6..e3ad49e 100644
--- a/source/blender/blenkernel/BKE_unit.h
+++ b/source/blender/blenkernel/BKE_unit.h
@@ -20,8 +20,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_UNIT_H
-#define BKE_UNIT_H
+#ifndef __BKE_UNIT_H__
+#define __BKE_UNIT_H__
 
 /** \file BKE_unit.h
  *  \ingroup bke
@@ -76,4 +76,4 @@ double		bUnit_GetScaler(void *usys_pt, int index);
 }
 #endif
 
-#endif /* BKE_UNIT_H */
+#endif /* __BKE_UNIT_H__ */
diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h
index a6a9bb0..39458cb 100644
--- a/source/blender/blenkernel/BKE_utildefines.h
+++ b/source/blender/blenkernel/BKE_utildefines.h
@@ -33,8 +33,8 @@
  */
 
 
-#ifndef BKE_UTILDEFINES_H
-#define BKE_UTILDEFINES_H
+#ifndef __BKE_UTILDEFINES_H__
+#define __BKE_UTILDEFINES_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -89,4 +89,4 @@ extern "C" {
 }
 #endif
 
-#endif // BKE_UTILDEFINES_H
+#endif // __BKE_UTILDEFINES_H__
diff --git a/source/blender/blenkernel/BKE_world.h b/source/blender/blenkernel/BKE_world.h
index fe25279..16ff3ac 100644
--- a/source/blender/blenkernel/BKE_world.h
+++ b/source/blender/blenkernel/BKE_world.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_WORLD_H
-#define BKE_WORLD_H
+#ifndef __BKE_WORLD_H__
+#define __BKE_WORLD_H__
 
 /** \file BKE_world.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/BKE_writeavi.h b/source/blender/blenkernel/BKE_writeavi.h
index c906761..03174fb 100644
--- a/source/blender/blenkernel/BKE_writeavi.h
+++ b/source/blender/blenkernel/BKE_writeavi.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_WRITEAVI_H
-#define BKE_WRITEAVI_H
+#ifndef __BKE_WRITEAVI_H__
+#define __BKE_WRITEAVI_H__
 
 /** \file BKE_writeavi.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/BKE_writeffmpeg.h b/source/blender/blenkernel/BKE_writeffmpeg.h
index 4c42d1e..c35105f 100644
--- a/source/blender/blenkernel/BKE_writeffmpeg.h
+++ b/source/blender/blenkernel/BKE_writeffmpeg.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_WRITEFFMPEG_H
-#define BKE_WRITEFFMPEG_H
+#ifndef __BKE_WRITEFFMPEG_H__
+#define __BKE_WRITEFFMPEG_H__
 
 /** \file BKE_writeffmpeg.h
  *  \ingroup bke
@@ -75,6 +75,7 @@ void filepath_ffmpeg(char* string, struct RenderData* rd);
 extern void ffmpeg_set_preset(struct RenderData *rd, int preset);
 extern void ffmpeg_verify_image_type(struct RenderData *rd, struct ImageFormatData *imf);
 extern void ffmpeg_verify_codec_settings(struct RenderData *rd);
+extern int  ffmpeg_alpha_channel_supported(struct RenderData *rd);
 
 extern struct IDProperty *ffmpeg_property_add(struct RenderData *Rd, const char *type, int opt_index, int parent_index);
 extern int ffmpeg_property_add_string(struct RenderData *rd, const char *type, const char *str);
diff --git a/source/blender/blenkernel/BKE_writeframeserver.h b/source/blender/blenkernel/BKE_writeframeserver.h
index 040550d..cb607e1 100644
--- a/source/blender/blenkernel/BKE_writeframeserver.h
+++ b/source/blender/blenkernel/BKE_writeframeserver.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BKE_WRITEFRAMESERVER_H
-#define BKE_WRITEFRAMESERVER_H
+#ifndef __BKE_WRITEFRAMESERVER_H__
+#define __BKE_WRITEFRAMESERVER_H__
 
 /** \file BKE_writeframeserver.h
  *  \ingroup bke
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 42e6f1d..c2a83b5 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -23,7 +23,7 @@
 #
 # ***** END GPL LICENSE BLOCK *****
 
-set(INC 
+set(INC
 	.
 	../avi
 	../blenfont
@@ -34,18 +34,15 @@ set(INC
 	../imbuf
 	../makesdna
 	../makesrna
+	../bmesh
 	../modifiers
 	../nodes
 	../render/extern/include
-	../../../intern/bsp/extern
-	../../../intern/decimation/extern
-	../../../intern/elbeem/extern
 	../../../intern/guardedalloc
 	../../../intern/iksolver/extern
 	../../../intern/memutil
 	../../../intern/mikktspace
 	../../../intern/opennl/extern
-	../../../intern/smoke/extern
 
 	# XXX - BAD LEVEL CALL WM_api.h
 	../windowmanager
@@ -57,12 +54,6 @@ set(INC_SYS
 )
 
 set(SRC
-	intern/BME_Customdata.c
-	intern/BME_conversions.c
-	intern/BME_eulers.c
-	intern/BME_mesh.c
-	intern/BME_structure.c
-	intern/BME_tools.c
 	intern/CCGSubSurf.c
 	intern/DerivedMesh.c
 	intern/action.c
@@ -90,8 +81,8 @@ set(SRC
 	intern/depsgraph.c
 	intern/displist.c
 	intern/dynamicpaint.c
-	intern/effect.c
 	intern/editderivedmesh.c
+	intern/effect.c
 	intern/fcurve.c
 	intern/fluidsim.c
 	intern/fmodifier.c
@@ -114,12 +105,13 @@ set(SRC
 	intern/mesh.c
 	intern/mesh_validate.c
 	intern/modifier.c
+	intern/modifiers_bmesh.c
 	intern/movieclip.c
 	intern/multires.c
 	intern/nla.c
 	intern/node.c
-	intern/ocean.c
 	intern/object.c
+	intern/ocean.c
 	intern/packedFile.c
 	intern/paint.c
 	intern/particle.c
@@ -148,7 +140,6 @@ set(SRC
 	intern/unit.c
 	intern/world.c
 	intern/writeavi.c
-	intern/writeffmpeg.c
 	intern/writeframeserver.c
 	
 	BKE_DerivedMesh.h
@@ -158,7 +149,6 @@ set(SRC
 	BKE_armature.h
 	BKE_blender.h
 	BKE_bmesh.h
-	BKE_bmeshCustomData.h
 	BKE_bmfont.h
 	BKE_bmfont_types.h
 	BKE_boids.h
@@ -205,8 +195,8 @@ set(SRC
 	BKE_multires.h
 	BKE_nla.h
 	BKE_node.h
-	BKE_ocean.h
 	BKE_object.h
+	BKE_ocean.h
 	BKE_packedFile.h
 	BKE_paint.h
 	BKE_particle.h
@@ -227,6 +217,7 @@ set(SRC
 	BKE_speaker.h
 	BKE_subsurf.h
 	BKE_suggestions.h
+	BKE_tessmesh.h
 	BKE_text.h
 	BKE_texture.h
 	BKE_tracking.h
@@ -234,12 +225,10 @@ set(SRC
 	BKE_utildefines.h
 	BKE_world.h
 	BKE_writeavi.h
-	BKE_writeffmpeg.h
 	BKE_writeframeserver.h
 	depsgraph_private.h
-	intern/CCGSubSurf.h
-	intern/bmesh_private.h
 	nla_private.h
+	intern/CCGSubSurf.h
 )
 
 add_definitions(-DGLEW_STATIC)
@@ -304,6 +293,10 @@ if(WITH_CODEC_QUICKTIME)
 endif()
 
 if(WITH_CODEC_FFMPEG)
+	list(APPEND SRC
+		intern/writeffmpeg.c
+		BKE_writeffmpeg.h
+	)
 	list(APPEND INC
 		../../../intern/ffmpeg
 	)
@@ -336,10 +329,16 @@ if(WITH_OPENMP)
 endif()
 
 if(WITH_MOD_FLUID)
+	list(APPEND INC
+		../../../intern/elbeem/extern
+	)
 	add_definitions(-DWITH_MOD_FLUID)
 endif()
 
 if(WITH_MOD_SMOKE)
+	list(APPEND INC
+		../../../intern/smoke/extern
+	)
 	add_definitions(-DWITH_SMOKE)
 endif()
 
@@ -347,6 +346,18 @@ 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
+	)
+endif()
+
 if(WITH_JACK)
 	add_definitions(-DWITH_JACK)
 endif()
@@ -391,6 +402,10 @@ if(WITH_FFTW3)
 	add_definitions(-DFFTW3=1)
 endif()
 
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
 ## Warnings as errors, this is too strict!
 #if(MSVC)
 #	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
diff --git a/source/blender/blenkernel/SConscript b/source/blender/blenkernel/SConscript
index 62a8aa8..ee9e6bc 100644
--- a/source/blender/blenkernel/SConscript
+++ b/source/blender/blenkernel/SConscript
@@ -12,6 +12,7 @@ incs += ' #/intern/iksolver/extern ../blenloader'
 incs += ' #/extern/bullet2/src'
 incs += ' #/intern/opennl/extern #/intern/bsp/extern'
 incs += ' ../gpu #/extern/glew/include'
+incs += ' ../bmesh'
 incs += ' #/intern/smoke/extern'
 incs += ' #/intern/mikktspace'
 incs += ' #/intern/audaspace/intern'
@@ -22,8 +23,11 @@ incs += ' ' + env['BF_ZLIB_INC']
 
 defs = [ 'GLEW_STATIC' ]
 
-defs.append('WITH_SMOKE')  # TODO, make optional
-defs.append('WITH_FRAMESERVER')  # TODO, make optional
+if env['WITH_BF_SMOKE']:
+    defs.append('WITH_SMOKE')
+
+if env['WITH_BF_FRAMESERVER']:
+    defs.append('WITH_FRAMESERVER')
 
 if env['WITH_BF_PYTHON']:
     incs += ' ../python'
@@ -107,7 +111,10 @@ if env['WITH_BF_FFTW3']:
     defs.append('FFTW3=1')
     incs += ' ' + env['BF_FFTW3_INC'] 
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
+
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
 
 if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
diff --git a/source/blender/blenkernel/depsgraph_private.h b/source/blender/blenkernel/depsgraph_private.h
index 0338d10..f27ee2f 100644
--- a/source/blender/blenkernel/depsgraph_private.h
+++ b/source/blender/blenkernel/depsgraph_private.h
@@ -27,8 +27,8 @@
  *  \ingroup bke
  */
 
-#ifndef DEPSGRAPH_PRIVATE
-#define DEPSGRAPH_PRIVATE
+#ifndef __DEPSGRAPH_PRIVATE_H__
+#define __DEPSGRAPH_PRIVATE_H__
 
 #include "BKE_depsgraph.h"
 #include "DNA_constraint_types.h"
@@ -132,6 +132,4 @@ void graph_print_queue(DagNodeQueue *nqueue);
 void graph_print_queue_dist(DagNodeQueue *nqueue);
 void graph_print_adj_list(void);
 
-int build_deps(short mask);
-
-#endif
+#endif /* __DEPSGRAPH_PRIVATE_H__ */
diff --git a/source/blender/blenkernel/intern/BME_Customdata.c b/source/blender/blenkernel/intern/BME_Customdata.c
deleted file mode 100644
index bb909dc..0000000
--- a/source/blender/blenkernel/intern/BME_Customdata.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * BME_customdata.c    jan 2007
- *
- *	Custom Data functions for Bmesh
- *
- *
- * ***** 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) 2004 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Geoffrey Bantle, Brecht Van Lommel, Ben Batt
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/blenkernel/intern/BME_Customdata.c
- *  \ingroup bke
- */
-
-
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-#include "BKE_bmeshCustomData.h"
-#include "bmesh_private.h"
-
-/********************* Layer type information **********************/
-typedef struct BME_LayerTypeInfo {
-	int size;
-	const char *defaultname;
-	void (*copy)(const void *source, void *dest, int count);
-	void (*free)(void *data, int count, int size);
-	void (*interp)(void **sources, float *weights, float *sub_weights, int count, void *dest);
-	void (*set_default)(void *data, int count);
-} BME_LayerTypeInfo;
-const BME_LayerTypeInfo BMELAYERTYPEINFO[BME_CD_NUMTYPES] = {
-	{sizeof(BME_facetex), "TexFace", NULL, NULL, NULL, NULL},
-	{sizeof(BME_looptex), "UV", NULL, NULL, NULL, NULL},
-	{sizeof(BME_loopcol), "VCol", NULL, NULL, NULL, NULL},
-	{sizeof(BME_DeformVert), "Group", NULL, NULL, NULL, NULL}
-};
-static const BME_LayerTypeInfo *BME_layerType_getInfo(int type)
-{
-	if(type < 0 || type >= CD_NUMTYPES) return NULL;
-
-	return &BMELAYERTYPEINFO[type];
-}
-void BME_CD_Create(BME_CustomData *data, BME_CustomDataInit *init, int initalloc)
-{
-	int i, j, offset=0;
-	const BME_LayerTypeInfo *info;
-	
-	/*initialize data members*/
-	data->layers = NULL;
-	data->pool = NULL;
-	data->totlayer = 0;
-	data->totsize = 0;
-
-	/*first count how many layers to alloc*/
-	for(i=0; i < BME_CD_NUMTYPES; i++){
-		info = BME_layerType_getInfo(i);
-		data->totlayer += init->layout[i];
-		data->totsize  += (init->layout[i] * info->size);
-	}
-	/*alloc our layers*/
-	if(data->totlayer){
-		/*alloc memory*/
-		data->layers = MEM_callocN(sizeof(BME_CustomDataLayer)*data->totlayer, "BMesh Custom Data Layers");
-		data->pool = BLI_mempool_create(data->totsize, initalloc, initalloc, FALSE, FALSE);
-		/*initialize layer data*/
-		for(i=0; i < BME_CD_NUMTYPES; i++){
-			if(init->layout[i]){
-				info = BME_layerType_getInfo(i);
-				for(j=0; j < init->layout[i]; j++){
-					if(j==0) data->layers[j+i].active = init->active[i];
-					data->layers[j+i].type = i;
-					data->layers[j+i].offset = offset;	
-					strcpy(data->layers[j+i].name, &(init->nametemplate[j+i]));
-					offset += info->size;
-				}
-			}
-		}
-	}
-}
-
-void BME_CD_Free(BME_CustomData *data)
-{
-	if(data->pool) BLI_mempool_destroy(data->pool);
-}
-
-/*Block level ops*/
-void BME_CD_free_block(BME_CustomData *data, void **block)
-{
-	const BME_LayerTypeInfo *typeInfo;
-	int i;
-
-	if(!*block) return;
-	for(i = 0; i < data->totlayer; ++i) {
-		typeInfo = BME_layerType_getInfo(data->layers[i].type);
-		if(typeInfo->free) {
-			int offset = data->layers[i].offset;
-			typeInfo->free((char*)*block + offset, 1, typeInfo->size);
-		}
-	}
-	BLI_mempool_free(data->pool, *block);
-	*block = NULL;
-}
-
-
-static void BME_CD_alloc_block(BME_CustomData *data, void **block)
-{	
-	
-	if (*block) BME_CD_free_block(data, block); //if we copy layers that have their own free functions like deformverts
-	
-	if (data->totsize > 0)
-		*block = BLI_mempool_alloc(data->pool);	
-	else
-		*block = NULL;
-}
-
-void BME_CD_copy_data(const BME_CustomData *source, BME_CustomData *dest,
-							void *src_block, void **dest_block)
-{
-	const BME_LayerTypeInfo *typeInfo;
-	int dest_i, src_i;
-
-	if (!*dest_block) /*for addXXXlist functions!*/
-		BME_CD_alloc_block(dest, dest_block);
-	
-	/* copies a layer at a time */
-	dest_i = 0;
-	for(src_i = 0; src_i < source->totlayer; ++src_i) {
-
-		/* find the first dest layer with type >= the source type
-		 * (this should work because layers are ordered by type)
-		 */
-		while(dest_i < dest->totlayer
-			  && dest->layers[dest_i].type < source->layers[src_i].type)
-			++dest_i;
-
-		/* if there are no more dest layers, we're done */
-		if(dest_i >= dest->totlayer) return;
-
-		/* if we found a matching layer, copy the data */
-		if(dest->layers[dest_i].type == source->layers[src_i].type &&
-			strcmp(dest->layers[dest_i].name, source->layers[src_i].name) == 0) {
-			char *src_data = (char*)src_block + source->layers[src_i].offset;
-			char *dest_data = (char*)*dest_block + dest->layers[dest_i].offset;
-
-			typeInfo = BME_layerType_getInfo(source->layers[src_i].type);
-
-			if(typeInfo->copy)
-				typeInfo->copy(src_data, dest_data, 1);
-			else
-				memcpy(dest_data, src_data, typeInfo->size);
-
-			/* if there are multiple source & dest layers of the same type,
-			 * we don't want to copy all source layers to the same dest, so
-			 * increment dest_i
-			 */
-			++dest_i;
-		}
-	}
-}
-void BME_CD_set_default(BME_CustomData *data, void **block)
-{
-	const BME_LayerTypeInfo *typeInfo;
-	int i;
-
-	if (!*block)
-		BME_CD_alloc_block(data, block); //for addXXXlist functions...
-
-	for(i = 0; i < data->totlayer; ++i) {
-		int offset = data->layers[i].offset;
-
-		typeInfo = BME_layerType_getInfo(data->layers[i].type);
-
-		if(typeInfo->set_default)
-			typeInfo->set_default((char*)*block + offset, 1);
-	}
-}
diff --git a/source/blender/blenkernel/intern/BME_conversions.c b/source/blender/blenkernel/intern/BME_conversions.c
deleted file mode 100644
index ce1da61..0000000
--- a/source/blender/blenkernel/intern/BME_conversions.c
+++ /dev/null
@@ -1,648 +0,0 @@
-/*
- * BME_mesh.c    jan 2007
- *
- *	BMesh mesh level functions.
- *
- *
- * ***** 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.
- * about this.	
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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) 2007 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Geoffrey Bantle, Levi Schooley.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/blenkernel/intern/BME_conversions.c
- *  \ingroup bke
- */
-
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-
-#include "BLI_edgehash.h"
-#include "BLI_listbase.h"
-#include "BLI_utildefines.h"
-
-#include "BKE_mesh.h"
-#include "BKE_cdderivedmesh.h"
-
-//XXX #include "BIF_editmesh.h"
-//XXX #include "editmesh.h"
-#include "bmesh_private.h"
-
-//XXX #include "BSE_edit.h"
-
-/* XXX IMPORTANT: editmesh stuff doesn't belong in kernel! (ton) */
-
-/*merge these functions*/
-static void BME_DMcorners_to_loops(BME_Mesh *bm, CustomData *facedata, int index, BME_Poly *f, int numCol, int numTex){
-	int i, j;
-	BME_Loop *l;
-	MTFace *texface;
-	MTexPoly *texpoly;
-	MCol *mcol;
-	MLoopCol *mloopcol;
-	MLoopUV *mloopuv;
-
-	for(i=0; i< numTex; i++){
-		texface = CustomData_get_layer_n(facedata, CD_MTFACE, i);
-		texpoly = CustomData_bmesh_get_n(&bm->pdata, f->data, CD_MTEXPOLY, i);
-
-		texpoly->tpage = texface[index].tpage;
-		texpoly->flag = texface[index].flag;
-		texpoly->transp = texface[index].transp;
-		texpoly->mode = texface[index].mode;
-		texpoly->tile = texface[index].tile;
-		texpoly->unwrap = texface[index].unwrap;
-
-		j = 0;
-		l = f->loopbase;
-		do{
-			mloopuv = CustomData_bmesh_get_n(&bm->ldata, l->data, CD_MLOOPUV, i);
-			mloopuv->uv[0] = texface[index].uv[j][0];
-			mloopuv->uv[1] = texface[index].uv[j][1];
-			j++;
-			l = l->next;
-		}while(l!=f->loopbase);
-	}
-
-	for(i=0; i < numCol; i++){
-		mcol = CustomData_get_layer_n(facedata, CD_MCOL, i);
-		j = 0;
-		l = f->loopbase;
-		do{
-			mloopcol = CustomData_bmesh_get_n(&bm->ldata, l->data, CD_MLOOPCOL, i);
-			mloopcol->r = mcol[(index*4)+j].r;
-			mloopcol->g = mcol[(index*4)+j].g;
-			mloopcol->b = mcol[(index*4)+j].b;
-			mloopcol->a = mcol[(index*4)+j].a;
-			j++;
-			l = l->next;
-		}while(l!=f->loopbase);
-	}
-}
-
-static void BME_DMloops_to_corners(BME_Mesh *bm, CustomData *facedata, int index, BME_Poly *f,int numCol, int numTex){
-	int i, j;
-	BME_Loop *l;
-	MTFace *texface;
-	MTexPoly *texpoly;
-	MCol *mcol;
-	MLoopCol *mloopcol;
-	MLoopUV *mloopuv;
-
-	for(i=0; i < numTex; i++){
-		texface = CustomData_get_layer_n(facedata, CD_MTFACE, i);
-		texpoly = CustomData_bmesh_get_n(&bm->pdata, f->data, CD_MTEXPOLY, i);
-		
-		texface[index].tpage = texpoly->tpage;
-		texface[index].flag = texpoly->flag;
-		texface[index].transp = texpoly->transp;
-		texface[index].mode = texpoly->mode;
-		texface[index].tile = texpoly->tile;
-		texface[index].unwrap = texpoly->unwrap;
-
-		j = 0;
-		l = f->loopbase;
-		do{
-			mloopuv = CustomData_bmesh_get_n(&bm->ldata, l->data, CD_MLOOPUV, i);
-			texface[index].uv[j][0] = mloopuv->uv[0];
-			texface[index].uv[j][1] = mloopuv->uv[1];
-			j++;
-			l = l->next;
-		}while(l!=f->loopbase);
-
-	}
-	for(i=0; i < numCol; i++){
-		mcol = CustomData_get_layer_n(facedata,CD_MCOL, i);
-		j = 0;
-		l = f->loopbase;
-		do{
-			mloopcol = CustomData_bmesh_get_n(&bm->ldata, l->data, CD_MLOOPCOL, i);
-			mcol[(index*4) + j].r = mloopcol->r;
-			mcol[(index*4) + j].g = mloopcol->g;
-			mcol[(index*4) + j].b = mloopcol->b;
-			mcol[(index*4) + j].a = mloopcol->a;
-			j++;
-			l = l->next;
-		}while(l!=f->loopbase);
-	}
-}
-
-
-static void BME_corners_to_loops(BME_Mesh *bm, CustomData *facedata, void *face_block, BME_Poly *f,int numCol, int numTex){
-	int i, j;
-	BME_Loop *l;
-	MTFace *texface;
-	MTexPoly *texpoly;
-	MCol *mcol;
-	MLoopCol *mloopcol;
-	MLoopUV *mloopuv;
-
-	for(i=0; i < numTex; i++){
-		texface = CustomData_em_get_n(facedata, face_block, CD_MTFACE, i);
-		texpoly = CustomData_bmesh_get_n(&bm->pdata, f->data, CD_MTEXPOLY, i);
-		
-		texpoly->tpage = texface->tpage;
-		texpoly->flag = texface->flag;
-		texpoly->transp = texface->transp;
-		texpoly->mode = texface->mode;
-		texpoly->tile = texface->tile;
-		texpoly->unwrap = texface->unwrap;
-
-		j = 0;
-		l = f->loopbase;
-		do{
-			mloopuv = CustomData_bmesh_get_n(&bm->ldata, l->data, CD_MLOOPUV, i);
-			mloopuv->uv[0] = texface->uv[j][0];
-			mloopuv->uv[1] = texface->uv[j][1];
-			j++;
-			l = l->next;
-		}while(l!=f->loopbase);
-
-	}
-	for(i=0; i < numCol; i++){
-		mcol = CustomData_em_get_n(facedata, face_block, CD_MCOL, i);
-		j = 0;
-		l = f->loopbase;
-		do{
-			mloopcol = CustomData_bmesh_get_n(&bm->ldata, l->data, CD_MLOOPCOL, i);
-			mloopcol->r = mcol[j].r;
-			mloopcol->g = mcol[j].g;
-			mloopcol->b = mcol[j].b;
-			mloopcol->a = mcol[j].a;
-			j++;
-			l = l->next;
-		}while(l!=f->loopbase);
-	}
-}
-
-static void BME_loops_to_corners(BME_Mesh *bm, CustomData *facedata, void *face_block, BME_Poly *f,int numCol, int numTex){
-	int i, j;
-	BME_Loop *l;
-	MTFace *texface;
-	MTexPoly *texpoly;
-	MCol *mcol;
-	MLoopCol *mloopcol;
-	MLoopUV *mloopuv;
-
-	for(i=0; i < numTex; i++){
-		texface = CustomData_em_get_n(facedata, face_block, CD_MTFACE, i);
-		texpoly = CustomData_bmesh_get_n(&bm->pdata, f->data, CD_MTEXPOLY, i);
-		
-		texface->tpage = texpoly->tpage;
-		texface->flag = texpoly->flag;
-		texface->transp = texpoly->transp;
-		texface->mode = texpoly->mode;
-		texface->tile = texpoly->tile;
-		texface->unwrap = texpoly->unwrap;
-
-		j = 0;
-		l = f->loopbase;
-		do{
-			mloopuv = CustomData_bmesh_get_n(&bm->ldata, l->data, CD_MLOOPUV, i);
-			texface->uv[j][0] = mloopuv->uv[0];
-			texface->uv[j][1] = mloopuv->uv[1];
-			j++;
-			l = l->next;
-		}while(l!=f->loopbase);
-
-	}
-	for(i=0; i < numCol; i++){
-		mcol = CustomData_em_get_n(facedata, face_block, CD_MCOL, i);
-		j = 0;
-		l = f->loopbase;
-		do{
-			mloopcol = CustomData_bmesh_get_n(&bm->ldata, l->data, CD_MLOOPCOL, i);
-			mcol[j].r = mloopcol->r;
-			mcol[j].g = mloopcol->g;
-			mcol[j].b = mloopcol->b;
-			mcol[j].a = mloopcol->a;
-			j++;
-			l = l->next;
-		}while(l!=f->loopbase);
-	}
-}
-/*move the EditMesh conversion functions to editmesh_tools.c*/
-BME_Mesh *BME_editmesh_to_bmesh(EditMesh *em) {
-	BME_Mesh *bm;
-	int allocsize[4] = {512,512,2048,512}, numTex, numCol;
-	BME_Vert *v1, *v2;
-	BME_Edge *e, *edar[4];
-	BME_Poly *f;
-
-	EditVert *eve;
-	EditEdge *eed;
-	EditFace *efa;
-
-	int len;
-	bm = BME_make_mesh(allocsize);
-
-	/*copy custom data layout*/
-	CustomData_copy(&em->vdata, &bm->vdata, CD_MASK_BMESH, CD_CALLOC, 0);
-	CustomData_copy(&em->edata, &bm->edata, CD_MASK_BMESH, CD_CALLOC, 0);
-	CustomData_copy(&em->fdata, &bm->pdata, CD_MASK_BMESH, CD_CALLOC, 0);
-
-	/*copy face corner data*/
-	CustomData_to_bmeshpoly(&em->fdata, &bm->pdata, &bm->ldata);
-	/*initialize memory pools*/
-	CustomData_bmesh_init_pool(&bm->vdata, allocsize[0]);
-	CustomData_bmesh_init_pool(&bm->edata, allocsize[1]);
-	CustomData_bmesh_init_pool(&bm->ldata, allocsize[2]);
-	CustomData_bmesh_init_pool(&bm->pdata, allocsize[3]);
-	/*needed later*/
-	numTex = CustomData_number_of_layers(&bm->pdata, CD_MTEXPOLY);
-	numCol = CustomData_number_of_layers(&bm->ldata, CD_MLOOPCOL);
-
-	BME_model_begin(bm);
-	/*add verts*/
-	eve= em->verts.first;
-	while(eve) {
-		v1 = BME_MV(bm,eve->co);
-		VECCOPY(v1->no,eve->no);
-		v1->flag = eve->f;
-		v1->h = eve->h;
-		v1->bweight = eve->bweight;
-		/*Copy Custom Data*/
-		CustomData_bmesh_copy_data(&em->vdata, &bm->vdata, eve->data, &v1->data);
-		eve->tmp.v = (EditVert*)v1;
-		eve = eve->next;
-	}
-	
-	/*add edges*/
-	eed= em->edges.first;
-	while(eed) {
-		v1 = (BME_Vert*)eed->v1->tmp.v;
-		v2 = (BME_Vert*)eed->v2->tmp.v;
-		e = BME_ME(bm, v1, v2);
-		e->crease = eed->crease;
-		e->bweight = eed->bweight;
-		e->flag = eed->f & SELECT;
-		if(eed->sharp) e->flag |= ME_SHARP;
-		if(eed->seam) e->flag |= ME_SEAM;
-		//XXX if(eed->h & EM_FGON) e->flag |= ME_FGON;
-		if(eed->h & 1) e->flag |= ME_HIDE;
-		eed->tmp.e = (EditEdge*)e;
-		CustomData_bmesh_copy_data(&em->edata, &bm->edata, eed->data, &e->data);
-		eed = eed->next;
-	}
-	/*add faces.*/
-	efa= em->faces.first;
-	while(efa) {
-		if(efa->v4) len = 4;
-		else len = 3;
-		
-		edar[0] = (BME_Edge*)efa->e1->tmp.e;
-		edar[1] = (BME_Edge*)efa->e2->tmp.e;
-		edar[2] = (BME_Edge*)efa->e3->tmp.e;
-		if(len == 4){
-			edar[3] = (BME_Edge*)efa->e4->tmp.e;
-		}
-		
-		/*find v1 and v2*/
-		v1 = (BME_Vert*)efa->v1->tmp.v;
-		v2 = (BME_Vert*)efa->v2->tmp.v;
-		
-		f = BME_MF(bm,v1,v2,edar,len);
-		f->mat_nr = efa->mat_nr;
-		f->flag = efa->flag;
-		if(efa->h) {
-			f->flag |= ME_HIDE;
-			f->flag &= ~ME_FACE_SEL;
-		}
-		else {
-			if(efa->f & 1) f->flag |= ME_FACE_SEL;
-			else f->flag &= ~ME_FACE_SEL;
-		}
-		CustomData_bmesh_copy_data(&em->fdata, &bm->pdata, efa->data, &f->data);
-		BME_corners_to_loops(bm, &em->fdata, efa->data, f,numCol,numTex);
-		efa = efa->next;
-	}
-	BME_model_end(bm);
-	return bm;
-}
-/* adds the geometry in the bmesh to editMesh (does not free editMesh)
- * if td != NULL, the transdata will be mapped to the EditVert's co */
-void BME_bmesh_to_editmesh(BME_Mesh *bm, BME_TransData_Head *td, EditMesh *em) {
-	BME_Vert *v1;
-	BME_Edge *e;
-	BME_Poly *f;
-	
-	BME_TransData *vtd;
-
-	EditVert *eve1, /* *eve2, *eve3, *eve4, */ /* UNUSED */ **evlist;
-	EditEdge *eed;
-	EditFace *efa;
-
-	int totvert, len, i, numTex, numCol;
-
-	if (em == NULL) return;
-
-	CustomData_copy(&bm->vdata, &em->vdata, CD_MASK_BMESH, CD_CALLOC, 0);
-	CustomData_copy(&bm->edata, &em->edata, CD_MASK_BMESH, CD_CALLOC, 0);
-	CustomData_copy(&bm->pdata, &em->fdata, CD_MASK_BMESH, CD_CALLOC, 0);
-	CustomData_from_bmeshpoly(&em->fdata, &bm->pdata, &bm->ldata,0);
-	numTex = CustomData_number_of_layers(&bm->pdata, CD_MTEXPOLY);
-	numCol = CustomData_number_of_layers(&bm->ldata, CD_MLOOPCOL);
-
-
-	/* convert to EditMesh */
-	/* make editverts */
-	totvert = BLI_countlist(&(bm->verts));
-	evlist= (EditVert **)MEM_mallocN(totvert*sizeof(void *),"evlist");
-	for (i=0,v1=bm->verts.first;v1;v1=v1->next,i++) {
-		v1->tflag1 = i;
-		eve1 = NULL; //XXX addvertlist(v1->co,NULL);
-		if (td && (vtd = BME_get_transdata(td,v1))) {
-			vtd->loc = eve1->co;
-		}
-		eve1->keyindex = i;
-		evlist[i]= eve1;
-		eve1->f = (unsigned char)v1->flag;
-		eve1->h = (unsigned char)v1->h;
-		eve1->bweight = v1->bweight;
-		CustomData_em_copy_data(&bm->vdata, &em->vdata, v1->data, &eve1->data);
-	}
-	
-	/* make edges */
-	for (e=bm->edges.first;e;e=e->next) {
-		if(0) { //XXX if(!(findedgelist(evlist[e->v1->tflag1], evlist[e->v2->tflag1]))){
-			eed= NULL; //XXX addedgelist(evlist[e->v1->tflag1], evlist[e->v2->tflag1], NULL);
-			eed->crease = e->crease;
-			eed->bweight = e->bweight;
-			if(e->flag & ME_SEAM) eed->seam = 1;
-			if(e->flag & ME_SHARP) eed->sharp = 1;
-			if(e->flag & SELECT) eed->f |= SELECT;
-			//XXX if(e->flag & ME_FGON) eed->h= EM_FGON; // 2 different defines!
-			if(e->flag & ME_HIDE) eed->h |= 1;
-			if(em->selectmode==SCE_SELECT_EDGE) { 
-				; //XXX EM_select_edge(eed, eed->f & SELECT);
-			}
-			CustomData_em_copy_data(&bm->edata, &em->edata, e->data, &eed->data);
-		}
-	}
-
-	/* make faces */
-	for (f=bm->polys.first;f;f=f->next) {
-		len = BME_cycle_length(f->loopbase);
-		if (len==3 || len==4) {
-			eve1= evlist[f->loopbase->v->tflag1];
-			/* eve2= evlist[f->loopbase->next->v->tflag1]; */ /* UNUSED */
-			/* eve3= evlist[f->loopbase->next->next->v->tflag1]; */ /* UNUSED */
-			/* if (len == 4) {
-				eve4= evlist[f->loopbase->prev->v->tflag1];
-			}
-			else {
-				eve4= NULL;
-			} */ /* UNUSED */
-
-			efa = NULL; //XXX addfacelist(eve1, eve2, eve3, eve4, NULL, NULL);
-			efa->mat_nr = (unsigned char)f->mat_nr;
-			efa->flag= f->flag & ~ME_HIDE;
-			if(f->flag & ME_FACE_SEL) {
-				efa->f |= SELECT;
-			}
-			if(f->flag & ME_HIDE) efa->h= 1;
-			// XXX flag depricated
-			// if((G.f & G_FACESELECT) && (efa->f & SELECT))
-				//XXX EM_select_face(efa, 1); /* flush down */
-			CustomData_em_copy_data(&bm->pdata, &em->fdata, f->data, &efa->data);
-			BME_loops_to_corners(bm, &em->fdata, efa->data, f,numCol,numTex);
-		}
-	}
-
-	MEM_freeN(evlist);
-
-}
-
-/* Adds the geometry found in dm to bm
-  */
-BME_Mesh *BME_derivedmesh_to_bmesh(DerivedMesh *dm)
-{
-	
-	BME_Mesh *bm;
-	int allocsize[4] = {512,512,2048,512};
-	MVert *mvert, *mv;
-	MEdge *medge, *me;
-	MFace *mface, *mf;
-	int totface,totedge,totvert,i,len, numTex, numCol;
-	BME_Vert *v1=NULL,*v2=NULL, **vert_array;
-	BME_Edge *e=NULL;
-	BME_Poly *f=NULL;
-	
-	EdgeHash *edge_hash = BLI_edgehash_new();
-
-	bm = BME_make_mesh(allocsize);
-	/*copy custom data layout*/
-	CustomData_copy(&dm->vertData, &bm->vdata, CD_MASK_BMESH, CD_CALLOC, 0);
-	CustomData_copy(&dm->edgeData, &bm->edata, CD_MASK_BMESH, CD_CALLOC, 0);
-	CustomData_copy(&dm->faceData, &bm->pdata, CD_MASK_BMESH, CD_CALLOC, 0);
-
-	/*copy face corner data*/
-	CustomData_to_bmeshpoly(&dm->faceData, &bm->pdata, &bm->ldata);
-	/*initialize memory pools*/
-	CustomData_bmesh_init_pool(&bm->vdata, allocsize[0]);
-	CustomData_bmesh_init_pool(&bm->edata, allocsize[1]);
-	CustomData_bmesh_init_pool(&bm->ldata, allocsize[2]);
-	CustomData_bmesh_init_pool(&bm->pdata, allocsize[3]);
-	/*needed later*/
-	numTex = CustomData_number_of_layers(&bm->pdata, CD_MTEXPOLY);
-	numCol = CustomData_number_of_layers(&bm->ldata, CD_MLOOPCOL);
-
-	totvert = dm->getNumVerts(dm);
-	totedge = dm->getNumEdges(dm);
-	totface = dm->getNumFaces(dm);
-	mvert = dm->getVertArray(dm);
-	medge = dm->getEdgeArray(dm);
-	mface = dm->getFaceArray(dm);
-
-	vert_array = MEM_mallocN(sizeof(*vert_array)*totvert,"BME_derivedmesh_to_bmesh BME_Vert* array");
-
-	BME_model_begin(bm);
-	/*add verts*/
-	for(i=0,mv = mvert; i < totvert;i++,mv++){
-		v1 = BME_MV(bm,mv->co);
-		vert_array[i] = v1;
-		v1->flag = mv->flag;
-		v1->bweight = mv->bweight/255.0f;
-		CustomData_to_bmesh_block(&dm->vertData, &bm->vdata, i, &v1->data);
-	}
-	/*add edges*/
-	for(i=0,me = medge; i < totedge;i++,me++){
-		v1 = vert_array[me->v1];
-		v2 = vert_array[me->v2];
-		e = BME_ME(bm, v1, v2);
-		e->crease = me->crease/255.0f;
-		e->bweight = me->bweight/255.0f;
-		e->flag = (unsigned char)me->flag;
-		BLI_edgehash_insert(edge_hash,me->v1,me->v2,e);
-		CustomData_to_bmesh_block(&dm->edgeData, &bm->edata, i, &e->data);
-	}
-	/*add faces.*/
-	for(i=0,mf = mface; i < totface;i++,mf++){
-		BME_Edge *edar[4];
-		if(mf->v4) len = 4;
-		else len = 3;
-		
-		edar[0] = BLI_edgehash_lookup(edge_hash,mf->v1,mf->v2);
-		edar[1] = BLI_edgehash_lookup(edge_hash,mf->v2,mf->v3);
-		if(len == 4){
-			edar[2] = BLI_edgehash_lookup(edge_hash,mf->v3,mf->v4);
-			edar[3] = BLI_edgehash_lookup(edge_hash,mf->v4,mf->v1);
-		}
-		else
-			edar[2] = BLI_edgehash_lookup(edge_hash,mf->v3,mf->v1);
-		
-		/*find v1 and v2*/
-		v1 = vert_array[mf->v1];
-		v2 = vert_array[mf->v2];
-		
-		f = BME_MF(bm,v1,v2,edar,len);
-		f->mat_nr = mf->mat_nr;
-		f->flag = mf->flag;
-		CustomData_to_bmesh_block(&dm->faceData,&bm->pdata,i,&f->data);
-		BME_DMcorners_to_loops(bm, &dm->faceData,i,f, numCol,numTex);
-	}
-	
-	BME_model_end(bm);
-	BLI_edgehash_free(edge_hash, NULL);
-	MEM_freeN(vert_array);
-	return bm;
-}
-
-DerivedMesh *BME_bmesh_to_derivedmesh(BME_Mesh *bm, DerivedMesh *dm)
-{
-	MFace *mface, *mf;
-	MEdge *medge, *me;
-	MVert *mvert, *mv;
-	int *origindex;
-	int totface, totedge, totvert, i, /* bmeshok, */ /* UNUSED */ len, numTex, numCol;
-
-	BME_Vert *v1=NULL;
-	BME_Edge *e=NULL, *oe=NULL;
-	BME_Poly *f=NULL;
-	
-	DerivedMesh *result;
-	EdgeHash *edge_hash = BLI_edgehash_new();
-
-	totvert = BLI_countlist(&(bm->verts));
-	totedge = 0;
-	
-	/*we cannot have double edges in a derived mesh!*/
-	for(i=0, v1=bm->verts.first; v1; v1=v1->next, i++) v1->tflag1 = i;
-	for(e=bm->edges.first; e; e=e->next){
-		oe = BLI_edgehash_lookup(edge_hash,e->v1->tflag1, e->v2->tflag1);
-		if(!oe){
-			totedge++;
-			BLI_edgehash_insert(edge_hash,e->v1->tflag1,e->v2->tflag1,e);
-			e->tflag2 = 1;
-		}
-		else{
-			e->tflag2 = 0;
-		}
-	}
-	
-	/*count quads and tris*/
-	totface = 0;
-	/* bmeshok = 1; */ /* UNUSED */
-	for(f=bm->polys.first;f;f=f->next){
-		len = BME_cycle_length(f->loopbase);
-		if(len == 3 || len == 4) totface++;
-	}
-	
-	/*convert back to mesh*/
-	result = CDDM_from_template(dm,totvert,totedge,totface);
-	CustomData_merge(&bm->vdata, &result->vertData, CD_MASK_BMESH, CD_CALLOC, totvert);
-	CustomData_merge(&bm->edata, &result->edgeData, CD_MASK_BMESH, CD_CALLOC, totedge);
-	CustomData_merge(&bm->pdata, &result->faceData, CD_MASK_BMESH, CD_CALLOC, totface);
-	CustomData_from_bmeshpoly(&result->faceData, &bm->pdata, &bm->ldata,totface);
-	numTex = CustomData_number_of_layers(&bm->pdata, CD_MTEXPOLY);
-	numCol = CustomData_number_of_layers(&bm->ldata, CD_MLOOPCOL);
-
-
-	/*Make Verts*/
-	mvert = CDDM_get_verts(result);
-	origindex = result->getVertDataArray(result, CD_ORIGINDEX);
-	for(i=0,v1=bm->verts.first,mv=mvert;v1;v1=v1->next,i++,mv++){
-		VECCOPY(mv->co,v1->co);
-		mv->flag = (unsigned char)v1->flag;
-		mv->bweight = (char)(255.0*v1->bweight);
-		CustomData_from_bmesh_block(&bm->vdata, &result->vertData, &v1->data, i);
-		origindex[i] = ORIGINDEX_NONE;
-	}
-	medge = CDDM_get_edges(result);
-	origindex = result->getEdgeDataArray(result, CD_ORIGINDEX);
-	i=0;
-	for(e=bm->edges.first,me=medge;e;e=e->next){
-		if(e->tflag2){
-			if(e->v1->tflag1 < e->v2->tflag1){
-				me->v1 = e->v1->tflag1;
-				me->v2 = e->v2->tflag1;
-			}
-			else{
-				me->v1 = e->v2->tflag1;
-				me->v2 = e->v1->tflag1;
-			}
-		
-			me->crease = (char)(255.0*e->crease);
-			me->bweight = (char)(255.0*e->bweight);
-			me->flag = e->flag;
-			CustomData_from_bmesh_block(&bm->edata, &result->edgeData, &e->data, i);
-			origindex[i] = ORIGINDEX_NONE;
-			me++;
-			i++;
-		}
-	}
-	if(totface){
-		mface = CDDM_get_faces(result);
-		origindex = result->getFaceDataArray(result, CD_ORIGINDEX);
-		/*make faces*/
-		for(i=0,f=bm->polys.first;f;f=f->next){
-			mf = &mface[i];
-			len = BME_cycle_length(f->loopbase);
-			if(len==3 || len==4){
-				mf->v1 = f->loopbase->v->tflag1;
-				mf->v2 = f->loopbase->next->v->tflag1;
-				mf->v3 = f->loopbase->next->next->v->tflag1;
-				if(len == 4){
-					mf->v4 = f->loopbase->prev->v->tflag1;
-				}
-				/* test and rotate indexes if necessary so that verts 3 and 4 aren't index 0 */
-				if(mf->v3 == 0 || (len == 4 && mf->v4 == 0)){
-					test_index_face(mf, NULL, i, len);
-				}
-				mf->mat_nr = (unsigned char)f->mat_nr;
-				mf->flag = (unsigned char)f->flag;
-				CustomData_from_bmesh_block(&bm->pdata, &result->faceData, &f->data, i);
-				BME_DMloops_to_corners(bm, &result->faceData, i, f,numCol,numTex);
-				origindex[i] = ORIGINDEX_NONE;
-				i++;
-			}
-		}
-	}
-	BLI_edgehash_free(edge_hash, NULL);
-	return result;
-}
diff --git a/source/blender/blenkernel/intern/BME_eulers.c b/source/blender/blenkernel/intern/BME_eulers.c
deleted file mode 100644
index 25970dd..0000000
--- a/source/blender/blenkernel/intern/BME_eulers.c
+++ /dev/null
@@ -1,973 +0,0 @@
-/*
- * BME_eulers.c    jan 2007
- *
- *	BMesh Euler construction API.
- *
- *
- * ***** 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.
- * about this.	
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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) 2004 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Geoffrey Bantle.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/blenkernel/intern/BME_eulers.c
- *  \ingroup bke
- */
-
-
-#include "MEM_guardedalloc.h"
-#include "BLI_listbase.h"
-#include "BLI_utildefines.h"
-
-#include "bmesh_private.h"
-
-/*********************************************************
- *                    "Euler API"                        *
- *                                                       *
- *                                                       *
- *	 Primitive construction operators for mesh tools.    *
- *                                                       *
- **********************************************************/
-
-
-/*
-	The functions in this file represent the 'primitive' or 'atomic' operators that
-	mesh tools use to manipulate the topology of the structure.* The purpose of these
-	functions is to provide a trusted set of operators to manipulate the mesh topology
-	and which can also be combined together like building blocks to create more 
-	sophisticated tools. It needs to be stressed that NO manipulation of an existing 
-	mesh structure should be done outside of these functions.
-	
-	In the BMesh system, each euler is named by an ancronym which describes what it actually does.
-	Furthermore each Euler has a logical inverse. An important design criteria of all Eulers is that
-	through a Euler's logical inverse you can 'undo' an operation. (Special note should
-	be taken of BME_loop_reverse, which is its own inverse).
-		
-	BME_MF/KF: Make Face and Kill Face
-	BME_ME/KE: Make Edge and Kill Edge
-	BME_MV/KV: Make Vert and Kill Vert
-	BME_SEMV/JEKV: Split Edge, Make Vert and Join Edge, Kill Vert
-	BME_SFME/JFKE: Split Face, Make Edge and Join Face, Kill Edge
-	BME_loop_reverse: Reverse a Polygon's loop cycle. (used for flip normals for one)
-	
-	Using a combination of these eleven eulers any non-manifold modelling operation can be achieved.
-	Each Euler operator has a detailed explanation of what is does in the comments preceding its 
-	code. 
-
-   *The term "Euler Operator" is actually a misnomer when referring to a non-manifold 
-	data structure. Its use is in keeping with the convention established by others.
-
-	TODO:
-	-Finish inserting 'strict' validation in all Eulers
-*/
-
-void *BME_exit(char *s) {
-	if (s) printf("%s\n",s);
-	return NULL;
-}
-
-#define RETCLEAR(bm) {bm->rval->v = bm->rval->e = bm->rval->f = bm->rva->l = NULL;}
-/*MAKE Eulers*/
-
-/**
- *			BME_MV
- *
- *	MAKE VERT EULER:
- *	
- *	Makes a single loose vertex.
- *
- *	Returns -
- *	A BME_Vert pointer.
- */
-
-BME_Vert *BME_MV(BME_Mesh *bm, float *vec){
-	BME_Vert *v = BME_addvertlist(bm, NULL);	
-	VECCOPY(v->co,vec);
-	return v;
-}
-
-/**
- *			BME_ME
- *
- *	MAKE EDGE EULER:
- *	
- *	Makes a single wire edge between two vertices.
- *	If the caller does not want there to be duplicate
- *	edges between the vertices, it is up to them to check 
- *	for this condition beforehand.
- *
- *	Returns -
- *	A BME_Edge pointer.
- */
-
-BME_Edge *BME_ME(BME_Mesh *bm, BME_Vert *v1, BME_Vert *v2){
-	BME_Edge *e=NULL;
-	BME_CycleNode *d1=NULL, *d2=NULL;
-	int valance1=0, valance2=0, edok;
-	
-	/*edge must be between two distinct vertices...*/
-	if(v1 == v2) return NULL;
-	
-	#ifndef BME_FASTEULER
-	/*count valance of v1*/
-	if(v1->edge){ 
-		d1 = BME_disk_getpointer(v1->edge,v1);
-		if(d1) valance1 = BME_cycle_length(d1);
-		else BME_error();
-	}
-	if(v2->edge){
-		d2 = BME_disk_getpointer(v2->edge,v2);
-		if(d2) valance2 = BME_cycle_length(d2);
-		else BME_error();
-	}
-	#endif
-	
-	/*go ahead and add*/
-	e = BME_addedgelist(bm, v1, v2, NULL);
-	BME_disk_append_edge(e, e->v1);
-	BME_disk_append_edge(e, e->v2);
-	
-	#ifndef BME_FASTEULER
-	/*verify disk cycle lengths*/
-	d1 = BME_disk_getpointer(e, e->v1);
-	edok = BME_cycle_validate(valance1+1, d1);
-	if(!edok) BME_error();
-	d2 = BME_disk_getpointer(e, e->v2);
-	edok = BME_cycle_validate(valance2+1, d2);
-	if(!edok) BME_error();
-	
-	/*verify that edge actually made it into the cycle*/
-	edok = BME_disk_hasedge(v1, e);
-	if(!edok) BME_error();
-	edok = BME_disk_hasedge(v2, e);
-	if(!edok) BME_error();
-	#endif
-	return e;
-}
-
-
-
-/**
- *			BME_MF
- *
- *	MAKE FACE EULER:
- *	Takes a list of edge pointers which form a closed loop and makes a face 
- *  from them. The first edge in elist is considered to be the start of the 
- *	polygon, and v1 and v2 are its vertices and determine the winding of the face 
- *  Other than the first edge, no other assumptions are made about the order of edges
- *  in the elist array. To verify that it is a single closed loop and derive the correct 
- *  order a simple series of verifications is done and all elements are visited.
- *		
- *  Returns -
- *	A BME_Poly pointer
- */
-
-#define MF_CANDIDATE	1
-#define MF_VISITED		2
-#define MF_TAKEN		4 
-
-BME_Poly *BME_MF(BME_Mesh *bm, BME_Vert *v1, BME_Vert *v2, BME_Edge **elist, int len)
-{
-	BME_Poly *f = NULL;
-	BME_Edge *curedge;
-	BME_Vert *curvert, *tv, **vlist;
-	int i, j, done, cont, edok;
-	
-	if(len < 2) return NULL;
-	
-	/*make sure that v1 and v2 are in elist[0]*/
-	if(BME_verts_in_edge(v1,v2,elist[0]) == 0) return NULL;
-	
-	/*clear euler flags*/
-	for(i=0;i<len;i++) elist[i]->eflag1=elist[i]->eflag2 = 0;
-	for(i=0;i<len;i++){
-		elist[i]->eflag1 |= MF_CANDIDATE;
-		
-		/*if elist[i] has a loop, count its radial length*/
-		if(elist[i]->loop) elist[i]->eflag2 = BME_cycle_length(&(elist[i]->loop->radial));
-		else elist[i]->eflag2 = 0;
-	}
-	
-	/*	For each vertex in each edge, it must have exactly two MF_CANDIDATE edges attached to it
-		Note that this does not gauruntee that face is a single closed loop. At best it gauruntees
-		that elist contains a finite number of seperate closed loops.
-	*/
-	for(i=0; i<len; i++){
-		edok = BME_disk_count_edgeflag(elist[i]->v1, MF_CANDIDATE, 0);
-		if(edok != 2) return NULL;
-		edok = BME_disk_count_edgeflag(elist[i]->v2, MF_CANDIDATE, 0);
-		if(edok != 2) return NULL;
-	}
-	
-	/*set start edge, start vert and target vert for our loop traversal*/
-	curedge = elist[0];
-	tv = v1;
-	curvert = v2;
-	
-	if(bm->vtarlen < len){
-		MEM_freeN(bm->vtar);
-		bm->vtar = MEM_callocN(sizeof(BME_Vert *)* len, "BMesh Vert pointer array");
-		bm->vtarlen = len;
-	}
-	/*insert tv into vlist since its the first vertex in face*/
-	i=0;
-	vlist=bm->vtar;
-	vlist[i] = tv;
-
-	/*	Basic procedure: Starting with curv we find the edge in it's disk cycle which hasn't 
-		been visited yet. When we do, we put curv in a linked list and find the next MF_CANDIDATE
-		edge, loop until we find TV. We know TV is reachable because of test we did earlier.
-	*/
-	done=0;
-	while(!done){
-		/*add curvert to vlist*/
-		/*insert some error cheking here for overflows*/
-		i++;
-		vlist[i] = curvert;
-		
-		/*mark curedge as visited*/
-		curedge->eflag1 |= MF_VISITED;
-		
-		/*find next edge and vert*/
-		curedge = BME_disk_next_edgeflag(curedge, curvert, MF_CANDIDATE, 0);
-		curvert = BME_edge_getothervert(curedge, curvert);
-		if(curvert == tv){
-			curedge->eflag1 |= MF_VISITED;
-			done=1;
-		}
-	}
-
-	/*	Verify that all edges have been visited It's possible that we did reach tv 
-		from sv, but that several unconnected loops were passed in via elist.
-	*/
-	cont=1;
-	for(i=0; i<len; i++){
-		if((elist[i]->eflag1 & MF_VISITED) == 0) cont = 0;
-	}
-	
-	/*if we get this far, its ok to allocate the face and add the loops*/
-	if(cont){
-		BME_Loop *l;
-		BME_Edge *e;
-		f = BME_addpolylist(bm, NULL);
-		f->len = len;
-		for(i=0;i<len;i++){
-			curvert = vlist[i];
-			l = BME_create_loop(bm,curvert,NULL,f,NULL);
-			if(!(f->loopbase)) f->loopbase = l;
-			BME_cycle_append(f->loopbase, l);
-		}
-		
-		/*take care of edge pointers and radial cycle*/
-		for(i=0, l = f->loopbase; i<len; i++, l=l->next){
-			e = NULL;
-			if(l == f->loopbase) e = elist[0]; /*first edge*/
-			
-			else{/*search elist for others*/
-				for(j=1; j<len; j++){
-					edok = BME_verts_in_edge(l->v, l->next->v, elist[j]);
-					if(edok){ 
-						e = elist[j];
-						break;
-					}
-				}
-			}
-			l->e = e; /*set pointer*/
-			BME_radial_append(e, l); /*append into radial*/
-		}
-
-		f->len = len;
-		
-		/*Validation Loop cycle*/
-		edok = BME_cycle_validate(len, f->loopbase);
-		if(!edok) BME_error();
-		for(i=0, l = f->loopbase; i<len; i++, l=l->next){
-			/*validate loop vert pointers*/
-			edok = BME_verts_in_edge(l->v, l->next->v, l->e);
-			if(!edok) BME_error();
-			/*validate the radial cycle of each edge*/
-			edok = BME_cycle_length(&(l->radial));
-			if(edok != (l->e->eflag2 + 1)) BME_error();
-		}
-	}
-	return f;
-}
-
-/* KILL Eulers */
-
-/**
- *			BME_KV
- *
- *	KILL VERT EULER:
- *	
- *	Kills a single loose vertex.
- *
- *	Returns -
- *	1 for success, 0 for failure.
- */
-
-int BME_KV(BME_Mesh *bm, BME_Vert *v){
-	if(v->edge == NULL){ 
-		BLI_remlink(&(bm->verts), v);
-		BME_free_vert(bm,v);
-		return 1;
-	}
-	return 0;
-}
-
-/**
- *			BME_KE
- *
- *	KILL EDGE EULER:
- *	
- *	Kills a wire edge.
- *
- *	Returns -
- *	1 for success, 0 for failure.
- */
-
-int BME_KE(BME_Mesh *bm, BME_Edge *e){
-	int edok;
-	
-	/*Make sure that no faces!*/
-	if(e->loop == NULL){
-		BME_disk_remove_edge(e, e->v1);
-		BME_disk_remove_edge(e, e->v2);
-		
-		/*verify that edge out of disk*/
-		edok = BME_disk_hasedge(e->v1, e);
-		if(edok) BME_error();
-		edok = BME_disk_hasedge(e->v2, e);
-		if(edok) BME_error();
-		
-		/*remove and deallocate*/
-		BLI_remlink(&(bm->edges), e);
-		BME_free_edge(bm, e);
-		return 1;
-	}
-	return 0;
-}
-
-/**
- *			BME_KF
- *
- *	KILL FACE EULER:
- *	
- *	The logical inverse of BME_MF.
- *	Kills a face and removes each of its loops from the radial that it belongs to.
- *
- *  Returns -
- *	1 for success, 0 for failure.
-*/
-
-int BME_KF(BME_Mesh *bm, BME_Poly *bply){
-	BME_Loop *newbase,*oldbase, *curloop;
-	int i,len=0;
-	
-	/*add validation to make sure that radial cycle is cleaned up ok*/
-	/*deal with radial cycle first*/
-	len = BME_cycle_length(bply->loopbase);
-	for(i=0, curloop=bply->loopbase; i < len; i++, curloop = curloop->next) 
-		BME_radial_remove_loop(curloop, curloop->e);
-	
-	/*now deallocate the editloops*/
-	for(i=0; i < len; i++){
-		newbase = bply->loopbase->next;
-		oldbase = bply->loopbase;
-		BME_cycle_remove(oldbase, oldbase);
-		BME_free_loop(bm, oldbase);
-		bply->loopbase = newbase;
-	}
-	
-	BLI_remlink(&(bm->polys), bply);
-	BME_free_poly(bm, bply);
-	return 1;
-}
-
-/*SPLIT Eulers*/
-
-/**
- *			BME_SEMV
- *
- *	SPLIT EDGE MAKE VERT:
- *	Takes a given edge and splits it into two, creating a new vert.
- *
- *
- *		Before:	OV---------TV	
- *		After:	OV----NV---TV
- *
- *  Returns -
- *	BME_Vert pointer.
- *
-*/
-
-BME_Vert *BME_SEMV(BME_Mesh *bm, BME_Vert *tv, BME_Edge *e, BME_Edge **re){
-	BME_Vert *nv, *ov;
-	BME_CycleNode *diskbase;
-	BME_Edge *ne;
-	int i, edok, valance1=0, valance2=0;
-	
-	if(BME_vert_in_edge(e,tv) == 0) return NULL;
-	ov = BME_edge_getothervert(e,tv);
-	//v2 = tv;
-
-	/*count valance of v1*/
-	diskbase = BME_disk_getpointer(e, ov);
-	valance1 = BME_cycle_length(diskbase);
-	/*count valance of v2*/
-	diskbase = BME_disk_getpointer(e, tv);
-	valance2 = BME_cycle_length(diskbase);
-	
-	nv = BME_addvertlist(bm, tv);
-	ne = BME_addedgelist(bm, nv, tv, e);
-	
-	//e->v2 = nv;
-	/*remove e from v2's disk cycle*/
-	BME_disk_remove_edge(e, tv);
-	/*swap out tv for nv in e*/
-	BME_edge_swapverts(e, tv, nv);
-	/*add e to nv's disk cycle*/
-	BME_disk_append_edge(e, nv);
-	/*add ne to nv's disk cycle*/
-	BME_disk_append_edge(ne, nv);
-	/*add ne to tv's disk cycle*/
-	BME_disk_append_edge(ne, tv);
-	/*verify disk cycles*/
-	diskbase = BME_disk_getpointer(ov->edge,ov);
-	edok = BME_cycle_validate(valance1, diskbase);
-	if(!edok) BME_error();
-	diskbase = BME_disk_getpointer(tv->edge,tv);
-	edok = BME_cycle_validate(valance2, diskbase);
-	if(!edok) BME_error();
-	diskbase = BME_disk_getpointer(nv->edge,nv);
-	edok = BME_cycle_validate(2, diskbase);
-	if(!edok) BME_error();
-	
-	/*Split the radial cycle if present*/
-	if(e->loop){
-		BME_Loop *nl,*l;
-		BME_CycleNode *radEBase=NULL, *radNEBase=NULL;
-		int radlen = BME_cycle_length(&(e->loop->radial));
-		/*Take the next loop. Remove it from radial. Split it. Append to appropriate radials.*/
-		while(e->loop){
-			l=e->loop;
-			l->f->len++;
-			BME_radial_remove_loop(l,e);
-			
-			nl = BME_create_loop(bm,NULL,NULL,l->f,l);
-			nl->prev = l;
-			nl->next = l->next;
-			nl->prev->next = nl;
-			nl->next->prev = nl;
-			nl->v = nv;
-			
-			/*assign the correct edge to the correct loop*/
-			if(BME_verts_in_edge(nl->v, nl->next->v, e)){
-				nl->e = e;
-				l->e = ne;
-				
-				/*append l into ne's rad cycle*/
-				if(!radNEBase){
-					radNEBase = &(l->radial);
-					radNEBase->next = NULL;
-					radNEBase->prev = NULL;
-				}
-				
-				if(!radEBase){
-					radEBase = &(nl->radial);
-					radEBase->next = NULL;
-					radEBase->prev = NULL;
-				}
-				
-				BME_cycle_append(radEBase,&(nl->radial));
-				BME_cycle_append(radNEBase,&(l->radial));
-					
-			}
-			else if(BME_verts_in_edge(nl->v,nl->next->v,ne)){
-				nl->e = ne;
-				l->e = e;
-				
-				if(!radNEBase){
-					radNEBase = &(nl->radial);
-					radNEBase->next = NULL;
-					radNEBase->prev = NULL;
-				}
-				if(!radEBase){
-					radEBase = &(l->radial);
-					radEBase->next = NULL;
-					radEBase->prev = NULL;
-				}
-				BME_cycle_append(radEBase,&(l->radial));
-				BME_cycle_append(radNEBase,&(nl->radial));
-			}
-					
-		}
-		
-		e->loop = radEBase->data;
-		ne->loop = radNEBase->data;
-		
-		/*verify length of radial cycle*/
-		edok = BME_cycle_validate(radlen,&(e->loop->radial));
-		if(!edok) BME_error();
-		edok = BME_cycle_validate(radlen,&(ne->loop->radial));
-		if(!edok) BME_error();
-		
-		/*verify loop->v and loop->next->v pointers for e*/
-		for(i=0,l=e->loop; i < radlen; i++, l = l->radial.next->data){
-			if(!(l->e == e)) BME_error();
-			if(!(l->radial.data == l)) BME_error();
-			if(l->prev->e != ne && l->next->e != ne) BME_error();
-			edok = BME_verts_in_edge(l->v, l->next->v, e);
-			if(!edok) BME_error();
-			if(l->v == l->next->v) BME_error();
-			if(l->e == l->next->e) BME_error();
-			/*verify loop cycle for kloop->f*/
-			edok = BME_cycle_validate(l->f->len, l->f->loopbase);
-			if(!edok) BME_error();
-		}
-		/*verify loop->v and loop->next->v pointers for ne*/
-		for(i=0,l=ne->loop; i < radlen; i++, l = l->radial.next->data){
-			if(!(l->e == ne)) BME_error();
-			if(!(l->radial.data == l)) BME_error();
-			if(l->prev->e != e && l->next->e != e) BME_error();
-			edok = BME_verts_in_edge(l->v, l->next->v, ne);
-			if(!edok) BME_error();
-			if(l->v == l->next->v) BME_error();
-			if(l->e == l->next->e) BME_error();
-			/*verify loop cycle for kloop->f. Redundant*/
-			edok = BME_cycle_validate(l->f->len, l->f->loopbase);
-			if(!edok) BME_error();
-		}
-	}
-	
-	if(re) *re = ne;
-	return nv;
-}
-
-/**
- *			BME_SFME
- *
- *	SPLIT FACE MAKE EDGE:
- *
- *	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.
- *
- *	Examples:
- *	
- *     Before:               After:
- *	 ----------           ----------
- *	 |		  |           |        | 
- *	 |        |           |   f1   |
- *	v1   f1   v2          v1======v2
- *	 |        |           |   f2   |
- *	 |        |           |        |
- *	 ----------           ---------- 
- *
- *	Note that the input vertices can be part of the same edge. This will result in a two edged face.
- *  This is desirable for advanced construction tools and particularly essential for edge bevel. Because
- *  of this it is up to the caller to decide what to do with the extra edge.
- *
- *	Returns -
- *  A BME_Poly pointer
- */
-BME_Poly *BME_SFME(BME_Mesh *bm, BME_Poly *f, BME_Vert *v1, BME_Vert *v2, BME_Loop **rl){
-
-	BME_Poly *f2;
-	BME_Loop *v1loop = NULL, *v2loop = NULL, *curloop, *f1loop=NULL, *f2loop=NULL;
-	BME_Edge *e;
-	int i, len, f1len, f2len;
-	
-	
-	/*verify that v1 and v2 are in face.*/
-	len = BME_cycle_length(f->loopbase);
-	for(i = 0, curloop = f->loopbase; i < len; i++, curloop = curloop->next){
-		if(curloop->v == v1) v1loop = curloop;
-		else if(curloop->v == v2) v2loop = curloop;
-	}
-	
-	if(!v1loop || !v2loop) return NULL;
-	
-	/*allocate new edge between v1 and v2*/
-	e = BME_addedgelist(bm, v1, v2,NULL);
-	BME_disk_append_edge(e, v1);
-	BME_disk_append_edge(e, v2);
-	
-	f2 = BME_addpolylist(bm,f);
-	f1loop = BME_create_loop(bm,v2,e,f,v2loop);
-	f2loop = BME_create_loop(bm,v1,e,f2,v1loop);
-	
-	f1loop->prev = v2loop->prev;
-	f2loop->prev = v1loop->prev;
-	v2loop->prev->next = f1loop;
-	v1loop->prev->next = f2loop;
-	
-	f1loop->next = v1loop;
-	f2loop->next = v2loop;
-	v1loop->prev = f1loop;
-	v2loop->prev = f2loop;
-	
-	f2->loopbase = f2loop;
-	f->loopbase = f1loop;
-	
-	/*validate both loops*/
-	/*I dont know how many loops are supposed to be in each face at this point! FIXME!*/
-	
-	/*go through all of f2's loops and make sure they point to it properly.*/
-	f2len = BME_cycle_length(f2->loopbase);
-	for(i=0, curloop = f2->loopbase; i < f2len; i++, curloop = curloop->next) curloop->f = f2;
-	
-	/*link up the new loops into the new edges radial*/
-	BME_radial_append(e, f1loop);
-	BME_radial_append(e, f2loop);
-	
-	
-	f2->len = f2len;
-	
-	f1len = BME_cycle_length(f->loopbase);
-	f->len = f1len;
-	
-	if(rl) *rl = f2loop;
-	return f2;
-}
-
-
-/**
- *			BME_JEKV
- *
- *	JOIN EDGE KILL VERT:
- *	Takes a an edge and pointer to one of its vertices and collapses
- *	the edge on that vertex.
- *	
- *	Before:    OE      KE
- *             	 ------- -------
- *               |     ||      |
- *		OV     KV      TV
- *
- *
- *   After:             OE      
- *             	 ---------------
- *               |             |
- *		OV             TV
- *
- *
- *	Restrictions:
- *	KV is a vertex that must have a valance of exactly two. Furthermore
- *  both edges in KV's disk cycle (OE and KE) must be unique (no double
- *  edges).
- *
- *	It should also be noted that this euler has the possibility of creating
- *	faces with just 2 edges. It is up to the caller to decide what to do with
- *  these faces.
- *
- *  Returns -
- *	1 for success, 0 for failure.
- */
-int BME_JEKV(BME_Mesh *bm, BME_Edge *ke, BME_Vert *kv)
-{
-	BME_Edge *oe;
-	BME_Vert *ov, *tv;
-	BME_CycleNode *diskbase;
-	BME_Loop *killoop,*nextl;
-	int len,radlen=0, halt = 0, i, valance1, valance2,edok;
-	
-	if(BME_vert_in_edge(ke,kv) == 0) return 0;
-	diskbase = BME_disk_getpointer(kv->edge, kv);
-	len = BME_cycle_length(diskbase);
-	
-	if(len == 2){
-		oe = BME_disk_nextedge(ke, kv);
-		tv = BME_edge_getothervert(ke, kv);
-		ov = BME_edge_getothervert(oe, kv);		
-		halt = BME_verts_in_edge(kv, tv, oe); //check for double edges
-		
-		if(halt) return 0;
-		else{
-			
-			/*For verification later, count valance of ov and tv*/
-			diskbase = BME_disk_getpointer(ov->edge, ov);
-			valance1 = BME_cycle_length(diskbase);
-			diskbase = BME_disk_getpointer(tv->edge, tv);
-			valance2 = BME_cycle_length(diskbase);
-			
-			/*remove oe from kv's disk cycle*/
-			BME_disk_remove_edge(oe,kv);
-			/*relink oe->kv to be oe->tv*/
-			BME_edge_swapverts(oe, kv, tv);
-			/*append oe to tv's disk cycle*/
-			BME_disk_append_edge(oe, tv);
-			/*remove ke from tv's disk cycle*/
-			BME_disk_remove_edge(ke, tv);
-		
-			
-
-			/*deal with radial cycle of ke*/
-			if(ke->loop){
-				/*first step, fix the neighboring loops of all loops in ke's radial cycle*/
-				radlen = BME_cycle_length(&(ke->loop->radial));
-				for(i=0,killoop = ke->loop; i<radlen; i++, killoop = BME_radial_nextloop(killoop)){
-					/*relink loops and fix vertex pointer*/
-					killoop->next->prev = killoop->prev;
-					killoop->prev->next = killoop->next;
-					if(killoop->next->v == kv) killoop->next->v = tv;
-					
-					/*fix len attribute of face*/
-					killoop->f->len--;
-					if(killoop->f->loopbase == killoop) killoop->f->loopbase = killoop->next;
-				}
-				/*second step, remove all the hanging loops attached to ke*/
-				killoop = ke->loop;
-				radlen = BME_cycle_length(&(ke->loop->radial));
-				/*make sure we have enough room in bm->lpar*/
-				if(bm->lparlen < radlen){
-					MEM_freeN(bm->lpar);
-					bm->lpar = MEM_callocN(sizeof(BME_Loop *)* radlen, "BMesh Loop pointer array");
-					bm->lparlen = bm->lparlen * radlen;
-				}
-				/*this should be wrapped into a bme_free_radial function to be used by BME_KF as well...*/
-				i=0;
-				while(i<radlen){
-					bm->lpar[i] = killoop;
-					killoop = killoop->radial.next->data;
-					i++;
-				}
-				i=0;
-				while(i<radlen){
-					BME_free_loop(bm,bm->lpar[i]);
-					i++;
-				}
-				/*Validate radial cycle of oe*/
-				edok = BME_cycle_validate(radlen,&(oe->loop->radial));
-				
-			}
-			
-
-			/*Validate disk cycles*/
-			diskbase = BME_disk_getpointer(ov->edge,ov);
-			edok = BME_cycle_validate(valance1, diskbase);
-			if(!edok) BME_error();
-			diskbase = BME_disk_getpointer(tv->edge,tv);
-			edok = BME_cycle_validate(valance2, diskbase);
-			if(!edok) BME_error();
-			
-			/*Validate loop cycle of all faces attached to oe*/
-			for(i=0,nextl = oe->loop; i<radlen; i++, nextl = BME_radial_nextloop(nextl)){
-				edok = BME_cycle_validate(nextl->f->len,nextl->f->loopbase);
-				if(!edok) BME_error();
-			}
-			/*deallocate edge*/
-			BLI_remlink(&(bm->edges), ke);
-			BME_free_edge(bm, ke);
-			/*deallocate vertex*/
-			BLI_remlink(&(bm->verts), kv);
-			BME_free_vert(bm, kv);	
-			return 1;
-		}
-	}
-	return 0;
-}
-
-
-/**
- *			BME_loop_reverse
- *
- *	FLIP FACE EULER
- *
- *	Changes the winding order of a face from CW to CCW or vice versa.
- *	This euler is a bit peculiar in compairson to others as it is its
- *	own inverse.
- *
- *	TODO: reinsert validation code.
- *
- *  Returns -
- *	1 for success, 0 for failure.
- */
-
-int BME_loop_reverse(BME_Mesh *bm, BME_Poly *f){
-	BME_Loop *l = f->loopbase, *curloop, *oldprev, *oldnext;
-	int i, j, edok, len = 0;
-
-	len = BME_cycle_length(l);
-	if(bm->edarlen < len){
-		MEM_freeN(bm->edar);
-		bm->edar = MEM_callocN(sizeof(BME_Edge *)* len, "BMesh Edge pointer array");
-		bm->edarlen = len;
-	}
-	
-	for(i=0, curloop = l; i< len; i++, curloop=curloop->next){
-		curloop->e->eflag1 = 0;
-		curloop->e->eflag2 = BME_cycle_length(&curloop->radial);
-		BME_radial_remove_loop(curloop, curloop->e);
-		/*in case of border edges we HAVE to zero out curloop->radial Next/Prev*/
-		curloop->radial.next = curloop->radial.prev = NULL;
-		bm->edar[i] = curloop->e;
-	}
-	
-	/*actually reverse the loop. This belongs in BME_cycle_reverse!*/
-	for(i=0, curloop = l; i < len; i++){
-		oldnext = curloop->next;
-		oldprev = curloop->prev;
-		curloop->next = oldprev;
-		curloop->prev = oldnext;
-		curloop = oldnext;
-	}
-
-	if(len == 2){ //two edged face
-		//do some verification here!
-		l->e = bm->edar[1];
-		l->next->e = bm->edar[0];
-	}
-	else{
-		for(i=0, curloop = l; i < len; i++, curloop = curloop->next){
-			edok = 0;
-			for(j=0; j < len; j++){
-				edok = BME_verts_in_edge(curloop->v, curloop->next->v, bm->edar[j]);
-				if(edok){
-					curloop->e = bm->edar[j];
-					break;
-				}
-			}
-		}
-	}
-	/*rebuild radial*/
-	for(i=0, curloop = l; i < len; i++, curloop = curloop->next) BME_radial_append(curloop->e, curloop);
-	
-	/*validate radial*/
-	for(i=0, curloop = l; i < len; i++, curloop = curloop->next){
-		edok = BME_cycle_validate(curloop->e->eflag2, &(curloop->radial));
-		if(!edok){
-			BME_error();
-		}
-	}
-	return 1;
-}
-
-/**
- *			BME_JFKE
- *
- *	JOIN FACE KILL EDGE:
- *	
- *	Takes two faces joined by a single 2-manifold edge and fuses them togather.
- *	The edge shared by the faces must not be connected to any other edges which have
- *	Both faces in its radial cycle
- *
- *	Examples:
- *	
- *        A                   B
- *	 ----------           ----------
- *	 |		  |           |        | 
- *	 |   f1   |           |   f1   |
- *	v1========v2 = Ok!    v1==V2==v3 == Wrong!
- *	 |   f2   |           |   f2   |
- *	 |        |           |        |
- *	 ----------           ---------- 
- *
- *	In the example A, faces f1 and f2 are joined by a single edge, and the euler can safely be used.
- *	In example B however, f1 and f2 are joined by multiple edges and will produce an error. The caller
- *	in this case should call BME_JEKV on the extra edges before attempting to fuse f1 and f2.
- *
- *	Also note that the order of arguments decides whether or not certain per-face attributes are present
- *	in the resultant face. For instance vertex winding, material index, smooth flags, ect are inherited
- *	from f1, not f2.
- *
- *  Returns -
- *	A BME_Poly pointer
-*/
-
-BME_Poly *BME_JFKE(BME_Mesh *bm, BME_Poly *f1, BME_Poly *f2, BME_Edge *e)
-{
-	
-	BME_Loop *curloop, *f1loop=NULL, *f2loop=NULL;
-	int loopok = 0, newlen = 0,i, f1len=0, f2len=0, radlen=0, edok;
-	
-	if(f1 == f2) return NULL; //can't join a face to itself
-	/*verify that e is in both f1 and f2*/
-	f1len = BME_cycle_length(f1->loopbase);
-	f2len = BME_cycle_length(f2->loopbase);
-	for(i=0, curloop = f1->loopbase; i < f1len; i++, curloop = curloop->next){
-		if(curloop->e == e){ 
-			f1loop = curloop;
-			break;
-		}
-	}
-	for(i=0, curloop = f2->loopbase; i < f2len; i++, curloop = curloop->next){
-		if(curloop->e==e){
-			f2loop = curloop;
-			break;
-		}
-	}
-	if(!(f1loop && f2loop)) return NULL;
-	
-	/*validate that edge is 2-manifold edge*/
-	radlen = BME_cycle_length(&(f1loop->radial));
-	if(radlen != 2) return NULL;
-
-	/*validate direction of f2's loop cycle is compatible.*/
-	if(f1loop->v == f2loop->v) return NULL;
-	
-	/*
-		Finally validate that for each face, each vertex has another edge in its disk cycle that is 
-		not e, and not shared.
-	*/
-	if(BME_radial_find_face(f1loop->next->e,f2)) return NULL;
-	if(BME_radial_find_face(f1loop->prev->e,f2)) return NULL;
-	if(BME_radial_find_face(f2loop->next->e,f1)) return NULL;
-	if(BME_radial_find_face(f2loop->prev->e,f1)) return NULL;
-	
-	/*join the two loops*/
-	f1loop->prev->next = f2loop->next;
-	f2loop->next->prev = f1loop->prev;
-	
-	f1loop->next->prev = f2loop->prev;
-	f2loop->prev->next = f1loop->next;
-	
-	/*if f1loop was baseloop, give f1loop->next the base.*/
-	if(f1->loopbase == f1loop) f1->loopbase = f1loop->next;
-	
-	/*validate the new loop*/
-	loopok = BME_cycle_validate((f1len+f2len)-2, f1->loopbase);
-	if(!loopok) BME_error();
-	
-	/*make sure each loop points to the proper face*/
-	newlen = BME_cycle_length(f1->loopbase);
-	for(i = 0, curloop = f1->loopbase; i < newlen; i++, curloop = curloop->next) curloop->f = f1;
-	
-	f1->len = newlen;
-	
-	edok = BME_cycle_validate(f1->len, f1->loopbase);
-	if(!edok) BME_error();
-	
-	/*remove edge from the disk cycle of its two vertices.*/
-	BME_disk_remove_edge(f1loop->e, f1loop->e->v1);
-	BME_disk_remove_edge(f1loop->e, f1loop->e->v2);
-	
-	/*deallocate edge and its two loops as well as f2*/
-	BLI_remlink(&(bm->edges), f1loop->e);
-	BLI_remlink(&(bm->polys), f2);
-	BME_free_edge(bm, f1loop->e);
-	BME_free_loop(bm, f1loop);
-	BME_free_loop(bm, f2loop);
-	BME_free_poly(bm, f2);	
-	return f1;
-}
diff --git a/source/blender/blenkernel/intern/BME_mesh.c b/source/blender/blenkernel/intern/BME_mesh.c
deleted file mode 100644
index cda66de..0000000
--- a/source/blender/blenkernel/intern/BME_mesh.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * BME_mesh.c    jan 2007
- *
- *	BMesh mesh level functions.
- *
- *
- * ***** 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.
- * about this.	
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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) 2007 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Geoffrey Bantle.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/blenkernel/intern/BME_mesh.c
- *  \ingroup bke
- */
-
-
-#include "BLI_listbase.h"
-#include "MEM_guardedalloc.h"
-#include "BKE_bmesh.h"
-#include "bmesh_private.h"
-
-/*	
- *	BME MAKE MESH
- *
- *  Allocates a new BME_Mesh structure.
- *  Returns -
- *  Pointer to a Bmesh
- *
-*/
-
-BME_Mesh *BME_make_mesh(int allocsize[4])
-{
-	/*allocate the structure*/
-	BME_Mesh *bm = MEM_callocN(sizeof(BME_Mesh),"BMesh");
-	/*allocate the memory pools for the mesh elements*/
-	bm->vpool = BLI_mempool_create(sizeof(BME_Vert), allocsize[0], allocsize[0], FALSE, FALSE);
-	bm->epool = BLI_mempool_create(sizeof(BME_Edge), allocsize[1], allocsize[1], FALSE, FALSE);
-	bm->lpool = BLI_mempool_create(sizeof(BME_Loop), allocsize[2], allocsize[2], FALSE, FALSE);
-	bm->ppool = BLI_mempool_create(sizeof(BME_Poly), allocsize[3], allocsize[3], FALSE, FALSE);
-	return bm;
-}
-/*	
- *	BME FREE MESH
- *
- *	Frees a BME_Mesh structure.
-*/
-
-void BME_free_mesh(BME_Mesh *bm)
-{
-	BME_Vert *v;
-	BME_Edge *e;
-	BME_Loop *l;
-	BME_Poly *f;
-
-	for(v=bm->verts.first; v; v=v->next) CustomData_bmesh_free_block(&bm->vdata, &v->data);
-	for(e=bm->edges.first; e; e=e->next) CustomData_bmesh_free_block(&bm->edata, &e->data);
-	for(f=bm->polys.first; f; f=f->next){
-		CustomData_bmesh_free_block(&bm->pdata, &f->data);
-		l = f->loopbase;
-		do{
-			CustomData_bmesh_free_block(&bm->ldata, &l->data);
-			l = l->next;
-		}while(l!=f->loopbase);
-	}
-
-	/*Free custom data pools, This should probably go in CustomData_free?*/
-	if(bm->vdata.totlayer) BLI_mempool_destroy(bm->vdata.pool);
-	if(bm->edata.totlayer) BLI_mempool_destroy(bm->edata.pool);
-	if(bm->ldata.totlayer) BLI_mempool_destroy(bm->ldata.pool);
-	if(bm->pdata.totlayer) BLI_mempool_destroy(bm->pdata.pool);
-
-	 /*free custom data*/
-	CustomData_free(&bm->vdata,0);
-	CustomData_free(&bm->edata,0);
-	CustomData_free(&bm->ldata,0);
-	CustomData_free(&bm->pdata,0);
-
-	/*destroy element pools*/
-	BLI_mempool_destroy(bm->vpool);
-	BLI_mempool_destroy(bm->epool);
-	BLI_mempool_destroy(bm->ppool);
-	BLI_mempool_destroy(bm->lpool);
-	
-	MEM_freeN(bm);	
-}
-
-/*	
- *	BME MODEL BEGIN AND END
- *
- *	These two functions represent the 'point of entry' for tools. Every BMesh tool
- *	must begin with a call to BME_model_end() and finish with a call to BME_model_end().
- *	No modification of mesh data is allowed except in between these two calls.
- *
- *  The purpose of these calls is allow for housekeeping tasks to be performed,
- *  such as allocating/freeing scratch arrays or performing debug validation of 
- *  the mesh structure.
- *
- *  Returns -
- *  Nothing
- *
-*/
-
-int BME_model_begin(BME_Mesh *bm){
-	/*Initialize some scratch pointer arrays used by eulers*/
-	bm->vtar = MEM_callocN(sizeof(BME_Vert *) * 1024, "BMesh scratch vert array");
-	bm->edar = MEM_callocN(sizeof(BME_Edge *) * 1024, "BMesh scratch edge array");
-	bm->lpar = MEM_callocN(sizeof(BME_Loop *) * 1024, "BMesh scratch loop array");
-	bm->plar = MEM_callocN(sizeof(BME_Poly *) * 1024, "BMesh scratch poly array");
-
-	bm->vtarlen = bm->edarlen = bm->lparlen = bm->plarlen = 1024;
-
-	return 1;
-}
-
-void BME_model_end(BME_Mesh *bm){
-	int meshok, totvert, totedge, totpoly;
-
-	totvert = BLI_countlist(&(bm->verts));
-	totedge = BLI_countlist(&(bm->edges));
-	totpoly = BLI_countlist(&(bm->polys));
-
-	if(bm->vtar) MEM_freeN(bm->vtar);
-	if(bm->edar) MEM_freeN(bm->edar);
-	if(bm->lpar) MEM_freeN(bm->lpar);
-	if(bm->plar) MEM_freeN(bm->plar);
-	
-	bm->vtar = NULL;
-	bm->edar = NULL;
-	bm->lpar = NULL;
-	bm->plar = NULL;
-	bm->vtarlen = bm->edarlen = bm->lparlen = bm->plarlen = 0;
-	
-	
-	if(bm->totvert!=totvert || bm->totedge!=totedge || bm->totpoly!=totpoly)
-		BME_error();
-	
-	meshok = BME_validate_mesh(bm, 1);
-	if(!meshok){
-		BME_error();
-	}
-}
-
-/*	
- *	BME VALIDATE MESH
- *
- *	There are several levels of validation for meshes. At the 
- *  Euler level, some basic validation is done to local topology.
- *  To catch more subtle problems however, BME_validate_mesh() is 
- *  called by BME_model_end() whenever a tool is done executing.
- *  The purpose of this function is to insure that during the course 
- *  of tool execution that nothing has been done to invalidate the 
- *  structure, and if it has, provide a way of reporting that so that
- *  we can restore the proper structure from a backup. Since a full mesh
- *  validation would be too expensive, this is presented as a compromise.
- *
- *	TODO 
- *	
- *	-Make this only part of debug builds
- */
-
-#define VHALT(halt) {BME_error(); if(halt) return 0;}
-
-int BME_validate_mesh(struct BME_Mesh *bm, int halt)
-{
-	BME_Vert *v;
-	BME_Edge *e;
-	BME_Poly *f;
-	BME_Loop *l;
-	BME_CycleNode *diskbase;
-	int i, ok;
-	
-	/*Simple edge verification*/
-	for(e=bm->edges.first; e; e=e->next){
-		if(e->v1 == e->v2) VHALT(halt);
-		/*validate e->d1.data and e->d2.data*/
-		if(e->d1.data != e || e->d2.data != e) VHALT(halt);
-		/*validate e->loop->e*/
-		if(e->loop){
-			if(e->loop->e != e) VHALT(halt);
-		}
-	}
-	
-	/*calculate disk cycle lengths*/
-	for(v=bm->verts.first; v; v=v->next) v->tflag1 = v->tflag2 = 0;
-	for(e=bm->edges.first; e; e=e->next){ 
-		e->v1->tflag1++;
-		e->v2->tflag1++;
-	}
-	/*Validate vertices and disk cycle*/
-	for(v=bm->verts.first; v; v=v->next){
-		/*validate v->edge pointer*/
-		if(v->tflag1){
-			if(v->edge){
-				ok = BME_vert_in_edge(v->edge,v);
-				if(!ok) VHALT(halt);
-				/*validate length of disk cycle*/
-				diskbase = BME_disk_getpointer(v->edge, v);
-				ok = BME_cycle_validate(v->tflag1, diskbase);
-				if(!ok) VHALT(halt);
-				/*validate that each edge in disk cycle contains V*/
-				for(i=0, e=v->edge; i < v->tflag1; i++, e = BME_disk_nextedge(e,v)){
-					ok = BME_vert_in_edge(e, v);
-					if(!ok) VHALT(halt);
-				}
-			}
-			else VHALT(halt);
-		}
-	}
-	/*validate edges*/
-	for(e=bm->edges.first; e; e=e->next){
-		/*seperate these into BME_disk_hasedge (takes pointer to edge)*/
-		/*search v1 disk cycle for edge*/
-		ok = BME_disk_hasedge(e->v1,e);
-		if(!ok) VHALT(halt);
-		/*search v2 disk cycle for edge*/
-		ok = BME_disk_hasedge(e->v2,e);
-		if(!ok) VHALT(halt);
-	}
-	
-	for(e=bm->edges.first; e; e=e->next) e->tflag2 = 0; //store incident faces
-	/*Validate the loop cycle integrity.*/
-	for(f=bm->polys.first; f; f=f->next){
-		ok = BME_cycle_length(f->loopbase);
-		if(ok > 1){
-			f->tflag1 = ok;
-		}
-		else VHALT(halt);
-		for(i=0, l=f->loopbase; i < f->tflag1; i++, l=l->next){
-			/*verify loop->v pointers*/
-			ok = BME_verts_in_edge(l->v, l->next->v, l->e);
-			if(!ok) VHALT(halt);
-			/*verify radial node data pointer*/
-			if(l->radial.data != l) VHALT(halt);
-			/*validate l->e->loop poitner*/
-			if(l->e->loop == NULL) VHALT(halt);
-			/*validate l->f pointer*/
-			if(l->f != f) VHALT(halt);
-			/*see if l->e->loop is actually in radial cycle*/
-			
-			l->e->tflag2++;
-		 }
-	}
-	
-	/*validate length of radial cycle*/
-	for(e=bm->edges.first; e; e=e->next){
-		if(e->loop){
-			ok = BME_cycle_validate(e->tflag2,&(e->loop->radial));
-			if(!ok) VHALT(halt);
-		}
-	}
-	
-	/*validate that EIDs are within range... if not indicates corrupted mem*/
-
-	/*if we get this far, pretty safe to return 1*/
-	return 1;
-}
-
-/*	Currently just a convient place for a breakpoint.
-	Probably should take an error string
-*/
-void BME_error(void){
-	printf("BME modelling error!");
-}
diff --git a/source/blender/blenkernel/intern/BME_structure.c b/source/blender/blenkernel/intern/BME_structure.c
deleted file mode 100644
index 6d8a833..0000000
--- a/source/blender/blenkernel/intern/BME_structure.c
+++ /dev/null
@@ -1,628 +0,0 @@
-/*
- * BME_structure.c    jan 2007
- *
- *	Low level routines for manipulating the BMesh structure.
- *
- *
- * ***** 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.
- * about this.	
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public 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) 2007 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Geoffrey Bantle.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/blenkernel/intern/BME_structure.c
- *  \ingroup bke
- */
-
-
-#include <limits.h>
-
-#include "MEM_guardedalloc.h"
-#include "BLI_listbase.h"
-#include "BLI_utildefines.h"
-#include "BKE_bmesh.h"
-/**
- *	MISC utility functions.
- *
- */
- 
-int BME_vert_in_edge(BME_Edge *e, BME_Vert *v){
-	if(e->v1 == v || e->v2 == v) return 1;
-	return 0;
-}
-int BME_verts_in_edge(BME_Vert *v1, BME_Vert *v2, BME_Edge *e){
-	if(e->v1 == v1 && e->v2 == v2) return 1;
-	else if(e->v1 == v2 && e->v2 == v1) return 1;
-	return 0;
-}
-
-BME_Vert *BME_edge_getothervert(BME_Edge *e, BME_Vert *v){	
-	if(e->v1 == v) return e->v2;
-	else if(e->v2 == v) return e->v1;
-	return NULL;
-}
-
-int BME_edge_swapverts(BME_Edge *e, BME_Vert *orig, BME_Vert *new){
-	if(e->v1 == orig){ 
-		e->v1 = new;
-		e->d1.next = NULL;
-		e->d1.prev = NULL;
-		return 1;
-	}
-	else if(e->v2 == orig){
-		e->v2 = new;
-		e->d2.next = NULL;
-		e->d2.prev = NULL;
-		return 1;
-	}
-	return 0;
-}
-
-/**
- *	ALLOCATION/DEALLOCATION FUNCTIONS
- */
-
-BME_Vert *BME_addvertlist(BME_Mesh *bm, BME_Vert *example){
-	BME_Vert *v=NULL;
-	v = BLI_mempool_alloc(bm->vpool);
-	v->next = v->prev = NULL;
-	v->EID = bm->nextv;
-	v->co[0] = v->co[1] = v->co[2] = 0.0f;
-	v->no[0] = v->no[1] = v->no[2] = 0.0f;
-	v->edge = NULL;
-	v->data = NULL;
-	v->eflag1 = v->eflag2 = v->tflag1 = v->tflag2 = 0;
-	v->flag = v->h = 0;
-	v->bweight = 0.0f;
-	BLI_addtail(&(bm->verts), v);
-	bm->nextv++;
-	bm->totvert++;
-
-	if(example){
-		VECCOPY(v->co,example->co);
-		CustomData_bmesh_copy_data(&bm->vdata, &bm->vdata, example->data, &v->data);
-	}
-	else
-		CustomData_bmesh_set_default(&bm->vdata, &v->data);
-
-	return v;
-}
-BME_Edge *BME_addedgelist(BME_Mesh *bm, BME_Vert *v1, BME_Vert *v2, BME_Edge *example){
-	BME_Edge *e=NULL;
-	e = BLI_mempool_alloc(bm->epool);
-	e->next = e->prev = NULL;
-	e->EID = bm->nexte;
-	e->v1 = v1;
-	e->v2 = v2;
-	e->d1.next = e->d1.prev = e->d2.next = e->d2.prev = NULL;
-	e->d1.data = e;
-	e->d2.data = e;
-	e->loop = NULL;
-	e->data = NULL;
-	e->eflag1 = e->eflag2 = e->tflag1 = e->tflag2 = 0;
-	e->flag = e->h = 0;
-	e->crease = e->bweight = 0.0f;
-	bm->nexte++;
-	bm->totedge++;
-	BLI_addtail(&(bm->edges), e);
-	
-	if(example)
-		CustomData_bmesh_copy_data(&bm->edata, &bm->edata, example->data, &e->data);
-	else
-		CustomData_bmesh_set_default(&bm->edata, &e->data);
-
-
-	return e;
-}
-BME_Loop *BME_create_loop(BME_Mesh *bm, BME_Vert *v, BME_Edge *e, BME_Poly *f, BME_Loop *example){
-	BME_Loop *l=NULL;
-	l = BLI_mempool_alloc(bm->lpool);
-	l->next = l->prev = NULL;
-	l->EID = bm->nextl;
-	l->radial.next = l->radial.prev = NULL;
-	l->radial.data = l;
-	l->v = v;
-	l->e = e;
-	l->f = f;
-	l->data = NULL;
-	l->eflag1 = l->eflag2 = l->tflag1 = l->tflag2 = 0;
-	l->flag = l->h = 0; //stupid waste!
-	bm->nextl++;
-	bm->totloop++;
-	
-	if(example)
-		CustomData_bmesh_copy_data(&bm->ldata, &bm->ldata, example->data, &l->data);
-	else
-		CustomData_bmesh_set_default(&bm->ldata, &l->data);
-
-	return l;
-}
-
-BME_Poly *BME_addpolylist(BME_Mesh *bm, BME_Poly *example){
-	BME_Poly *f = NULL;
-	f = BLI_mempool_alloc(bm->ppool);
-	f->next = f->prev = NULL;
-	f->EID = bm->nextp;
-	f->loopbase = NULL;
-	f->len = 0;
-	f->data = NULL;
-	f->eflag1 = f->eflag2 = f->tflag1 = f->tflag2 = 0;
-	f->flag = f->h = f->mat_nr;
-	BLI_addtail(&(bm->polys),f);
-	bm->nextp++;
-	bm->totpoly++;
-
-	if(example)
-		CustomData_bmesh_copy_data(&bm->pdata, &bm->pdata, example->data, &f->data);
-	else
-		CustomData_bmesh_set_default(&bm->pdata, &f->data);
-
-
-	return f;
-}
-
-/*	free functions dont do much *yet*. When per-vertex, per-edge and per-face/faceloop
-	data is added though these will be needed.
-*/
-void BME_free_vert(BME_Mesh *bm, BME_Vert *v){
-	bm->totvert--;
-	CustomData_bmesh_free_block(&bm->vdata, &v->data);
-	BLI_mempool_free(bm->vpool, v);
-}
-void BME_free_edge(BME_Mesh *bm, BME_Edge *e){
-	bm->totedge--;
-	CustomData_bmesh_free_block(&bm->edata, &e->data);
-	BLI_mempool_free(bm->epool, e);
-}
-void BME_free_poly(BME_Mesh *bm, BME_Poly *f){
-	bm->totpoly--;
-	CustomData_bmesh_free_block(&bm->pdata, &f->data);
-	BLI_mempool_free(bm->ppool, f);
-}
-void BME_free_loop(BME_Mesh *bm, BME_Loop *l){
-	bm->totloop--;
-	CustomData_bmesh_free_block(&bm->ldata, &l->data);
-	BLI_mempool_free(bm->lpool, l);
-}
-/**
- *	BMESH CYCLES
- *
- *	Cycles are circular doubly linked lists that form the basis of adjacency
- *	information in the BME modeller. Full adjacency relations can be derived
- *	from examining these cycles very quickly. Although each cycle is a double
- *  circular linked list, each one is considered to have a 'base' or 'head',
- *	and care must be taken by Euler code when modifying the contents of a cycle.
- *
- *	The contents of this file are split into two parts. First there are the 
- *	BME_cycle family of functions which are generic circular double linked list 
- *	procedures. The second part contains higher level procedures for supporting 
- *	modification of specific cycle types.
- *
- *	The three cycles explicitly stored in the BMesh data structure are as follows:
- *
- *	1: The Disk Cycle - A circle of edges around a vertex
- *     Base: vertex->edge pointer.
- *	   
- *     This cycle is the most complicated in terms of its structure. Each BME_Edge contains	
- *	   two BME_CycleNode structures to keep track of that edge's membership in the disk cycle
- *	   of each of its vertices. However for any given vertex it may be the first in some edges
- *	   in its disk cycle and the second for others. The BME_disk_XXX family of functions contain
- *	   some nice utilities for navigating disk cycles in a way that hides this detail from the 
- *	   tool writer.
- *
- *		Note that the disk cycle is completley independant from face data. One advantage of this
- *		is that wire edges are fully integrated into the topology database. Another is that the 
- *	    the disk cycle has no problems dealing with non-manifold conditions involving faces.
- *
- *		Functions relating to this cycle:
- *		
- *			BME_disk_append_edge
- *			BME_disk_remove_edge
- *			BME_disk_nextedge
- *			BME_disk_getpointer
- *
- *	2: The Radial Cycle - A circle of face edges (BME_Loop) around an edge
- *	   Base: edge->loop->radial structure.
- *
- *		The radial cycle is similar to the radial cycle in the radial edge data structure.*
- *		Unlike the radial edge however, the radial cycle does not require a large amount of memory 
- *		to store non-manifold conditions since BMesh does not keep track of region/shell
- *		information.
- *		
- *		Functions relating to this cycle:
- *			
- *			BME_radial_append
- *			BME_radial_remove_loop
- *			BME_radial_nextloop
- *			BME_radial_find_face
- *		
- *
- *	3: The Loop Cycle - A circle of face edges around a polygon.
- *     Base: polygon->loopbase.
- *
- *	   The loop cycle keeps track of a faces vertices and edges. It should be noted that the
- *     direction of a loop cycle is either CW or CCW depending on the face normal, and is 
- *     not oriented to the faces editedges. 
- *
- *		Functions relating to this cycle:
- *		
- *			BME_cycle_XXX family of functions.
- *
- *	
- *	Note that the order of elements in all cycles except the loop cycle is undefined. This 
- *  leads to slightly increased seek time for deriving some adjacency relations, however the 
- *  advantage is that no intrinsic properties of the data structures are dependant upon the 
- *  cycle order and all non-manifold conditions are represented trivially.
- *
-*/
- 
- 
-void BME_cycle_append(void *h, void *nt)
-{
-	BME_CycleNode *oldtail, *head, *newtail;
-	
-	head = (BME_CycleNode*)h;
-	newtail = (BME_CycleNode*)nt;
-	
-	if(head->next == NULL){
-		head->next = newtail;
-		head->prev = newtail;
-		newtail->next = head;
-		newtail->prev = head;
-	}
-	else{
-		oldtail = head->prev;
-		oldtail->next = newtail;
-		newtail->next = head;
-		newtail->prev = oldtail;
-		head->prev = newtail;
-		
-	}
-}
-
-/**
- *			BME_cycle_length
- *
- *	Count the nodes in a cycle.
- *
- *  Returns -
- *	Integer
- */
-
-int BME_cycle_length(void *h){
-	
-	int len = 0;
-	BME_CycleNode *head, *curnode;
-	head = (BME_CycleNode*)h;
-	
-	if(head){ 
-		len = 1;
-		for(curnode = head->next; curnode != head; curnode=curnode->next){ 
-			if(len == INT_MAX){ //check for infinite loop/corrupted cycle
-					return -1;
-			}
-			len++;
-		}
-	}
-	return len;
-}
-
-
-/**
- *			BME_cycle_remove
- *
- *	Removes a node from a cycle.
- *
- *  Returns -
- *	1 for success, 0 for failure.
- */
-
-int BME_cycle_remove(void *h, void *remn)
-{
-	int i, len;
-	BME_CycleNode *head, *remnode, *curnode;
-	
-	head = (BME_CycleNode*)h;
-	remnode = (BME_CycleNode*)remn;
-	len = BME_cycle_length(h);
-	
-	if(len == 1 && head == remnode){
-		head->next = NULL;
-		head->prev = NULL;
-		return 1;
-	}
-	else{
-		for(i=0, curnode = head; i < len; curnode = curnode->next){
-			if(curnode == remnode){
-				remnode->prev->next = remnode->next;
-				remnode->next->prev = remnode->prev;
-				/*zero out remnode pointers, important!*/
-				//remnode->next = NULL;
-				//remnode->prev = NULL;
-				return 1;
-		
-			}
-		}
-	}
-	return 0;
-}
-
-/**
- *			BME_cycle_validate
- *
- *	Validates a cycle. Takes as an argument the expected length of the cycle and
- *	a pointer to the cycle head or base.
- *
- *
- *  Returns -
- *	1 for success, 0 for failure.
- */
-
-int BME_cycle_validate(int len, void *h){
-	int i;
-	BME_CycleNode *curnode, *head;
-	head = (BME_CycleNode*)h;
-	
-	/*forward validation*/
-	for(i = 0, curnode = head; i < len; i++, curnode = curnode->next);
-	if(curnode != head) return 0;
-	
-	/*reverse validation*/
-	for(i = 0, curnode = head; i < len; i++, curnode = curnode->prev);
-	if(curnode != head) return 0;
-	
-	return 1;
-}
-
-/*Begin Disk Cycle routines*/
-
-/**
- *			BME_disk_nextedge
- *
- *	Find the next edge in a disk cycle
- *
- *  Returns -
- *	Pointer to the next edge in the disk cycle for the vertex v.
- */
- 
-BME_Edge *BME_disk_nextedge(BME_Edge *e, BME_Vert *v)
-{	
-	if(BME_vert_in_edge(e, v)){
-		if(e->v1 == v) return e->d1.next->data;
-		else if(e->v2 == v) return e->d2.next->data;
-	}
-	return NULL;
-}
-
-/**
- *			BME_disk_getpointer
- *
- *	Given an edge and one of its vertices, find the apporpriate CycleNode
- *
- *  Returns -
- *	Pointer to BME_CycleNode.
- */
-BME_CycleNode *BME_disk_getpointer(BME_Edge *e, BME_Vert *v){
-	/*returns pointer to the cycle node for the appropriate vertex in this disk*/
-	if(e->v1 == v) return &(e->d1);
-	else if (e->v2 == v) return &(e->d2);
-	return NULL;
-}
-
-/**
- *			BME_disk_append_edge
- *
- *	Appends edge to the end of a vertex disk cycle.
- *
- *  Returns -
- *	1 for success, 0 for failure
- */
-
-int BME_disk_append_edge(BME_Edge *e, BME_Vert *v)
-{ 
-	
-	BME_CycleNode *base, *tail;
-	
-	if(BME_vert_in_edge(e, v) == 0) return 0; /*check to make sure v is in e*/
-	
-	/*check for loose vert first*/
-	if(v->edge == NULL){
-		v->edge = e;
-		base = tail = BME_disk_getpointer(e, v);
-		BME_cycle_append(base, tail); /*circular reference is ok!*/
-		return 1;
-	}
-	
-	/*insert e at the end of disk cycle and make it the new v->edge*/
-	base = BME_disk_getpointer(v->edge, v);
-	tail = BME_disk_getpointer(e, v);
-	BME_cycle_append(base, tail);
-	return 1;
-}
-
-/**
- *			BME_disk_remove_edge
- *
- *	Removes an edge from a disk cycle. If the edge to be removed is
- *	at the base of the cycle, the next edge becomes the new base.
- *
- *
- *  Returns -
- *	Nothing
- */
-
-void BME_disk_remove_edge(BME_Edge *e, BME_Vert *v)
-{
-	BME_CycleNode *base, *remnode;
-	BME_Edge *newbase;
-	int len;
-	
-	base = BME_disk_getpointer(v->edge, v);
-	remnode = BME_disk_getpointer(e, v);
-	
-	/*first deal with v->edge pointer...*/
-	len = BME_cycle_length(base);
-	if(len == 1) newbase = NULL;
-	else if(v->edge == e) newbase = base->next-> data;
-	else newbase = v->edge;
-	
-	/*remove and rebase*/
-	BME_cycle_remove(base, remnode);
-	v->edge = newbase;
-}
-
-/**
- *			BME_disk_next_edgeflag
- *
- *	Searches the disk cycle of v, starting with e, for the 
- *  next edge that has either eflag or tflag.
- *
- *	BME_Edge pointer.
- */
-
-BME_Edge *BME_disk_next_edgeflag(BME_Edge *e, BME_Vert *v, int eflag, int tflag){
-	
-	/* BME_CycleNode *diskbase; */ /* UNUSED */
-	BME_Edge *curedge;
-	int /* len, */ /* UNUSED */ ok;
-	
-	if(eflag && tflag) return NULL;
-	
-	ok = BME_vert_in_edge(e,v);
-	if(ok){
-		/* diskbase = BME_disk_getpointer(e, v); */ /* UNUSED */
-		/* len = BME_cycle_length(diskbase); */ /* UNUSED */
-		curedge = BME_disk_nextedge(e,v);
-		while(curedge != e){
-			if(tflag){
-				if(curedge->tflag1 == tflag) return curedge;
-			}
-			else if(eflag){
-				if(curedge->eflag1 == eflag) return curedge;
-			}
-			curedge = BME_disk_nextedge(curedge, v);
-		}
-	}
-	return NULL;
-}
-
-/**
- *			BME_disk_count_edgeflag
- *
- *	Counts number of edges in this verts disk cycle which have 
- *	either eflag or tflag (but not both!)
- *
- *  Returns -
- *	Integer.
- */
-
-int BME_disk_count_edgeflag(BME_Vert *v, int eflag, int tflag){
-	BME_CycleNode *diskbase;
-	BME_Edge *curedge;
-	int i, len=0, count=0;
-	
-	if(v->edge){
-		if(eflag && tflag) return 0; /*tflag and eflag are reserved for different functions!*/
-		diskbase = BME_disk_getpointer(v->edge, v);
-		len = BME_cycle_length(diskbase);
-		
-		for(i = 0, curedge=v->edge; i<len; i++){
-			if(tflag){
-				if(curedge->tflag1 == tflag) count++;
-			}
-			else if(eflag){
-				if(curedge->eflag1 == eflag) count++;
-			}
-			curedge = BME_disk_nextedge(curedge, v);
-		}
-	}
-	return count;
-}
-
-int BME_disk_hasedge(BME_Vert *v, BME_Edge *e){
-	BME_CycleNode *diskbase;
-	BME_Edge *curedge;
-	int i, len=0;
-	
-	if(v->edge){
-		diskbase = BME_disk_getpointer(v->edge,v);
-		len = BME_cycle_length(diskbase);
-		
-		for(i = 0, curedge=v->edge; i<len; i++){
-			if(curedge == e) return 1;
-			else curedge=BME_disk_nextedge(curedge, v);
-		}
-	}
-	return 0;
-}
-/*end disk cycle routines*/
-
-BME_Loop *BME_radial_nextloop(BME_Loop *l){
-	return (BME_Loop*)(l->radial.next->data);
-}
-
-void BME_radial_append(BME_Edge *e, BME_Loop *l){
-	if(e->loop == NULL) e->loop = l;
-	BME_cycle_append(&(e->loop->radial), &(l->radial));
-}
-
-void BME_radial_remove_loop(BME_Loop *l, BME_Edge *e)
-{
-	BME_Loop *newbase;
-	int len;
-	
-	/*deal with edge->loop pointer*/
-	len = BME_cycle_length(&(e->loop->radial));
-	if(len == 1) newbase = NULL;
-	else if(e->loop == l) newbase = e->loop->radial.next->data;
-	else newbase = e->loop;
-	
-	/*remove and rebase*/
-	BME_cycle_remove(&(e->loop->radial), &(l->radial));
-	e->loop = newbase;
-}
-
-int BME_radial_find_face(BME_Edge *e,BME_Poly *f)
-{
-		
-	BME_Loop *curloop;
-	int i, len;
-	
-	len = BME_cycle_length(&(e->loop->radial));
-	for(i = 0, curloop = e->loop; i < len; i++, curloop = curloop->radial.next->data){
-		if(curloop->f == f) return 1;
-	}
-	return 0;
-}
-
-struct BME_Loop *BME_loop_find_loop(struct BME_Poly *f, struct BME_Vert *v) {
-	BME_Loop *l;
-	int i, len;
-	
-	len = BME_cycle_length(f->loopbase);
-	for (i = 0, l=f->loopbase; i < len; i++, l=l->next) {
-		if (l->v == v) return l;
-	}
-	return NULL;
-}
diff --git a/source/blender/blenkernel/intern/BME_tools.c b/source/blender/blenkernel/intern/BME_tools.c
deleted file mode 100644
index 44258f9..0000000
--- a/source/blender/blenkernel/intern/BME_tools.c
+++ /dev/null
@@ -1,1343 +0,0 @@
-/*
- * BME_tools.c    jan 2007
- *
- *	Functions for changing the topology of a mesh.
- *
- *
- * ***** 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) 2004 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Geoffrey Bantle and Levi Schooley.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/blenkernel/intern/BME_tools.c
- *  \ingroup bke
- */
-
-
-#include <math.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-
-#include "BLI_math.h"
-#include "BLI_utildefines.h"
-
-#include "BKE_bmesh.h"
-
-/*split this all into a seperate bevel.c file in src*/
-
-/* ------- Bevel code starts here -------- */
-
-BME_TransData_Head *BME_init_transdata(int bufsize) {
-	BME_TransData_Head *td;
-
-	td = MEM_callocN(sizeof(BME_TransData_Head), "BMesh transdata header");
-	td->gh = BLI_ghash_new(BLI_ghashutil_ptrhash,BLI_ghashutil_ptrcmp, "BME_init_transdata gh");
-	td->ma = BLI_memarena_new(bufsize, "BME_TransData arena");
-	BLI_memarena_use_calloc(td->ma);
-
-	return td;
-}
-
-void BME_free_transdata(BME_TransData_Head *td) {
-	BLI_ghash_free(td->gh,NULL,NULL);
-	BLI_memarena_free(td->ma);
-	MEM_freeN(td);
-}
-
-BME_TransData *BME_assign_transdata(
-        BME_TransData_Head *td, BME_Mesh *bm, BME_Vert *v,
-        float *co, float *org, float *vec, float *loc,
-        float factor, float weight, float maxfactor, float *max)
-{
-	BME_TransData *vtd;
-	int is_new = 0;
-
-	if (v == NULL) return NULL;
-
-	if ((vtd = BLI_ghash_lookup(td->gh, v)) == NULL && bm != NULL) {
-		vtd = BLI_memarena_alloc(td->ma, sizeof(*vtd));
-		BLI_ghash_insert(td->gh, v, vtd);
-		td->len++;
-		is_new = 1;
-	}
-
-	vtd->bm = bm;
-	vtd->v = v;
-
-	if (co != NULL) {
-		copy_v3_v3(vtd->co, co);
-	}
-
-	if (org == NULL && is_new) {
-		copy_v3_v3(vtd->org, v->co); /* default */
-	}
-	else if (org != NULL) {
-		copy_v3_v3(vtd->org,org);
-	}
-
-	if (vec != NULL) {
-		copy_v3_v3(vtd->vec,vec);
-		normalize_v3(vtd->vec);
-	}
-
-	vtd->loc = loc;
-
-	vtd->factor = factor;
-	vtd->weight = weight;
-	vtd->maxfactor = maxfactor;
-	vtd->max = max;
-
-	return vtd;
-}
-
-BME_TransData *BME_get_transdata(BME_TransData_Head *td, BME_Vert *v) {
-	BME_TransData *vtd;
-	vtd = BLI_ghash_lookup(td->gh, v);
-	return vtd;
-}
-
-/* a hack (?) to use the transdata memarena to allocate floats for use with the max limits */
-float *BME_new_transdata_float(BME_TransData_Head *td) {
-	return BLI_memarena_alloc(td->ma, sizeof(float));
-}
-
-static int BME_is_nonmanifold_vert(BME_Mesh *UNUSED(bm), BME_Vert *v) {
-	BME_Edge *e, *oe;
-	BME_Loop *l;
-	int len, count, flag;
-
-	if (v->edge == NULL) {
-		/* loose vert */
-		return 1;
-	}
-
-	/* count edges while looking for non-manifold edges */
-	oe = v->edge;
-	for (len=0,e=v->edge; e != oe || (e == oe && len == 0); len++,e=BME_disk_nextedge(e,v)) {
-		if (e->loop == NULL) {
-			/* loose edge */
-			return 1;
-		}
-
-		if (BME_cycle_length(&(e->loop->radial)) > 2) {
-			/* edge shared by more than two faces */
-			return 1;
-		}
-	}
-
-	count = 1;
-	flag = 1;
-	e = NULL;
-	oe = v->edge;
-	l = oe->loop;
-	while(e != oe) {
-		if (l->v == v) l = l->prev;
-		else l = l->next;
-		e = l->e;
-		count++; /* count the edges */
-
-		if (flag && l->radial.next->data == l) {
-			/* we've hit the edge of an open mesh, reset once */
-			flag = 0;
-			count = 1;
-			oe = e;
-			e = NULL;
-			l = oe->loop;
-		}
-		else if (l->radial.next->data == l) {
-			/* break the loop */
-			e = oe;
-		}
-		else {
-			l = l->radial.next->data;
-		}
-	}
-
-	if (count < len) {
-		/* vert shared by multiple regions */
-		return 1;
-	}
-
-	return 0;
-}
-
-/* a wrapper for BME_JFKE that [for now just] checks to
- * make sure loop directions are compatible */
-static BME_Poly *BME_JFKE_safe(BME_Mesh *bm, BME_Poly *f1, BME_Poly *f2, BME_Edge *e) {
-	BME_Loop *l1, *l2;
-
-	l1 = e->loop;
-	l2 = l1->radial.next->data;
-	if (l1->v == l2->v) {
-		BME_loop_reverse(bm, f2);
-	}
-
-	return BME_JFKE(bm, f1, f2, e);
-}
-
-/* a wrapper for BME_SFME that transfers element flags */
-static BME_Poly *BME_split_face(BME_Mesh *bm, BME_Poly *f, BME_Vert *v1, BME_Vert *v2, BME_Loop **nl, BME_Edge *example) {
-	BME_Poly *nf;
-	nf = BME_SFME(bm,f,v1,v2,nl);
-	nf->flag = f->flag;
-	/* if the edge was selected, select this face, too */
-	if (example && (example->flag & SELECT)) f->flag |= ME_FACE_SEL;
-	nf->h = f->h;
-	nf->mat_nr = f->mat_nr;
-	if (nl && example) {
-		(*nl)->e->flag = example->flag;
-		(*nl)->e->h = example->h;
-		(*nl)->e->crease = example->crease;
-		(*nl)->e->bweight = example->bweight;
-	}
-
-	return nf;
-}
-
-
-#if 0
-static void BME_data_interp_from_verts(BME_Mesh *bm, BME_Vert *v1, BME_Vert *v2, BME_Vert *v, float fac)
-{
-	void *src[2];
-	float w[2];
-	if (v1->data && v2->data) {
-		src[0]= v1->data;
-		src[1]= v2->data;
-		w[0] = 1.0f-fac;
-		w[1] = fac;
-		CustomData_bmesh_interp(&bm->vdata, src, w, NULL, 2, v->data);
-	}
-}
-#endif
-
-
-static void BME_data_facevert_edgesplit(BME_Mesh *bm, BME_Vert *v1, BME_Vert *UNUSED(v2), BME_Vert *v, BME_Edge *e1, float fac){
-	void *src[2];
-	float w[2];
-	BME_Loop *l=NULL, *v1loop = NULL, *vloop = NULL, *v2loop = NULL;
-	
-	w[0] = 1.0f - fac;
-	w[1] = fac;
-
-	if(!e1->loop) return;
-	l = e1->loop;
-	do{
-		if(l->v == v1){ 
-			v1loop = l;
-			vloop = v1loop->next;
-			v2loop = vloop->next;
-		}else if(l->v == v){
-			v1loop = l->next;
-			vloop = l;
-			v2loop = l->prev;
-			
-		}
-
-		src[0] = v1loop->data;
-		src[1] = v2loop->data;					
-
-		CustomData_bmesh_interp(&bm->ldata, src,w, NULL, 2, vloop->data); 				
-		l = l->radial.next->data;
-	}while(l!=e1->loop);
-}
-
-
-/* a wrapper for BME_SEMV that transfers element flags */ /*add custom data interpolation in here!*/
-static BME_Vert *BME_split_edge(BME_Mesh *bm, BME_Vert *v, BME_Edge *e, BME_Edge **ne, float percent) {
-	BME_Vert *nv, *v2;
-	float len;
-
-	v2 = BME_edge_getothervert(e,v);
-	nv = BME_SEMV(bm,v,e,ne);
-	if (nv == NULL) return NULL;
-	VECSUB(nv->co,v2->co,v->co);
-	len = len_v3(nv->co);
-	VECADDFAC(nv->co,v->co,nv->co,len*percent);
-	nv->flag = v->flag;
-	nv->bweight = v->bweight;
-	if (ne) {
-		(*ne)->flag = e->flag;
-		(*ne)->h = e->h;
-		(*ne)->crease = e->crease;
-		(*ne)->bweight = e->bweight;
-	}
-	/*v->nv->v2*/
-	BME_data_facevert_edgesplit(bm,v2, v, nv, e, 0.75);	
-	return nv;
-}
-
-static void BME_collapse_vert(BME_Mesh *bm, BME_Edge *ke, BME_Vert *kv, float fac){
-	void *src[2];
-	float w[2];
-	BME_Loop *l=NULL, *kvloop=NULL, *tvloop=NULL;
-	BME_Vert *tv = BME_edge_getothervert(ke,kv);
-
-	w[0] = 1.0f - fac;
-	w[1] = fac;
-
-	if(ke->loop){
-		l = ke->loop;
-		do{
-			if(l->v == tv && l->next->v == kv){
-				tvloop = l;
-				kvloop = l->next;
-
-				src[0] = kvloop->data;
-				src[1] = tvloop->data;
-				CustomData_bmesh_interp(&bm->ldata, src,w, NULL, 2, kvloop->data); 								
-			}
-			l=l->radial.next->data;
-		}while(l!=ke->loop);
-	}
-	BME_JEKV(bm,ke,kv);
-}
-
-
-
-static int BME_bevel_is_split_vert(BME_Loop *l) {
-	/* look for verts that have already been added to the edge when
-	 * beveling other polys; this can be determined by testing the
-	 * vert and the edges around it for originality
-	 */
-	if ((l->v->tflag1 & BME_BEVEL_ORIG)==0
-			&& (l->e->tflag1 & BME_BEVEL_ORIG)
-			&& (l->prev->e->tflag1 & BME_BEVEL_ORIG))
-	{
-		return 1;
-	}
-	return 0;
-}
-
-/* get a vector, vec, that points from v1->co to wherever makes sense to
- * the bevel operation as a whole based on the relationship between v1 and v2
- * (won't necessarily be a vec from v1->co to v2->co, though it probably will be);
- * the return value is -1 for failure, 0 if we used vert co's, and 1 if we used transform origins */
-static int BME_bevel_get_vec(float *vec, BME_Vert *v1, BME_Vert *v2, BME_TransData_Head *td)
-{
-	BME_TransData *vtd1, *vtd2;
-
-	vtd1 = BME_get_transdata(td,v1);
-	vtd2 = BME_get_transdata(td,v2);
-	if (!vtd1 || !vtd2) {
-		//printf("BME_bevel_get_vec() got called without proper BME_TransData\n");
-		return -1;
-	}
-
-	/* compare the transform origins to see if we can use the vert co's;
-	 * if they belong to different origins, then we will use the origins to determine
-	 * the vector */
-	if (compare_v3v3(vtd1->org,vtd2->org,0.000001f)) {
-		sub_v3_v3v3(vec, v2->co, v1->co);
-		if (len_v3(vec) < 0.000001f) {
-			zero_v3(vec);
-		}
-		return 0;
-	}
-	else {
-		sub_v3_v3v3(vec,vtd2->org,vtd1->org);
-		if (len_v3(vec) < 0.000001f) {
-			zero_v3(vec);
-		}
-		return 1;
-	}
-}
-
-/* "Projects" a vector perpendicular to vec2 against vec1, such that
- * the projected vec1 + vec2 has a min distance of 1 from the "edge" defined by vec2.
- * note: the direction, is_forward, is used in conjunction with up_vec to determine
- * whether this is a convex or concave corner. If it is a concave corner, it will
- * be projected "backwards." If vec1 is before vec2, is_forward should be 0 (we are projecting backwards).
- * vec1 is the vector to project onto (expected to be normalized)
- * vec2 is the direction of projection (pointing away from vec1)
- * up_vec is used for orientation (expected to be normalized)
- * returns the length of the projected vector that lies along vec1 */
-static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec, int is_forward, BME_TransData_Head *UNUSED(td))
-{
-	float factor, vec3[3], tmp[3],c1,c2;
-
-	cross_v3_v3v3(tmp,vec1,vec2);
-	normalize_v3(tmp);
-	factor = dot_v3v3(up_vec,tmp);
-	if ((factor > 0 && is_forward) || (factor < 0 && !is_forward)) {
-		cross_v3_v3v3(vec3,vec2,tmp); /* hmm, maybe up_vec should be used instead of tmp */
-	}
-	else {
-		cross_v3_v3v3(vec3,tmp,vec2); /* hmm, maybe up_vec should be used instead of tmp */
-	}
-	normalize_v3(vec3);
-	c1 = dot_v3v3(vec3,vec1);
-	c2 = dot_v3v3(vec1,vec1);
-	if (fabsf(c1) < 0.000001f || fabsf(c2) < 0.000001f) {
-		factor = 0.0f;
-	}
-	else {
-		factor = c2/c1;
-	}
-
-	return factor;
-}
-
-/* BME_bevel_split_edge() is the main math work-house; its responsibilities are:
- * using the vert and the loop passed, get or make the split vert, set its coordinates
- * and transform properties, and set the max limits.
- * Finally, return the split vert. */
-static BME_Vert *BME_bevel_split_edge(BME_Mesh *bm, BME_Vert *v, BME_Vert *v1, BME_Loop *l, float *up_vec, float value, BME_TransData_Head *td) {
-	BME_TransData *vtd, *vtd1 /* , *vtd2 */ /* UNUSED */;
-	BME_Vert *sv, *v2, *v3 /* , *ov */ /* UNUSED */;
-	BME_Loop *lv1, *lv2;
-	BME_Edge *ne, *e1, *e2;
-	float maxfactor, scale, len, dis, vec1[3], vec2[3], t_up_vec[3];
-	int is_edge, forward /* , is_split_vert */ /* UNUSED */;
-
-	if (l == NULL) {
-		/* what you call operator overloading in C :)
-		 * I wanted to use the same function for both wire edges and poly loops
-		 * so... here we walk around edges to find the needed verts */
-		forward = 1;
-		/* is_split_vert = 0; */ /* UNUSED */
-		if (v->edge == NULL) {
-			//printf("We can't split a loose vert's edge!\n");
-			return NULL;
-		}
-		e1 = v->edge; /* we just use the first two edges */
-		e2 = BME_disk_nextedge(v->edge, v);
-		if (e1 == e2) {
-			//printf("You need at least two edges to use BME_bevel_split_edge()\n");
-			return NULL;
-		}
-		v2 = BME_edge_getothervert(e1, v);
-		v3 = BME_edge_getothervert(e2, v);
-		if (v1 != v2 && v1 != v3) {
-			//printf("Error: more than 2 edges in v's disk cycle, or v1 does not share an edge with v\n");
-			return NULL;
-		}
-		if (v1 == v2) {
-			v2 = v3;
-		}
-		else {
-			e1 = e2;
-		}
-		/* ov = BME_edge_getothervert(e1,v); */ /* UNUSED */
-		sv = BME_split_edge(bm,v,e1,&ne,0);
-		//BME_data_interp_from_verts(bm, v, ov, sv, 0.25); /*this is technically wrong...*/
-		//BME_data_interp_from_faceverts(bm, v, ov, sv, 0.25);
-		//BME_data_interp_from_faceverts(bm, ov, v, sv, 0.25);
-		BME_assign_transdata(td, bm, sv, sv->co, sv->co, NULL, sv->co, 0, -1, -1, NULL); /* quick default */
-		sv->tflag1 |= BME_BEVEL_BEVEL;
-		ne->tflag1 = BME_BEVEL_ORIG; /* mark edge as original, even though it isn't */
-		BME_bevel_get_vec(vec1,v1,v,td);
-		BME_bevel_get_vec(vec2,v2,v,td);
-		cross_v3_v3v3(t_up_vec,vec1,vec2);
-		normalize_v3(t_up_vec);
-		up_vec = t_up_vec;
-	}
-	else {
-		/* establish loop direction */
-		if (l->v == v) {
-			forward = 1;
-			lv1 = l->next;
-			lv2 = l->prev;
-			v1 = l->next->v;
-			v2 = l->prev->v;
-		}
-		else if (l->next->v == v) {
-			forward = 0;
-			lv1 = l;
-			lv2 = l->next->next;
-			v1 = l->v;
-			v2 = l->next->next->v;
-		}
-		else {
-			//printf("ERROR: BME_bevel_split_edge() - v must be adjacent to l\n");
-			return NULL;
-		}
-
-		if (BME_bevel_is_split_vert(lv1)) {
-			/* is_split_vert = 1; */ /* UNUSED */
-			sv = v1;
-			if (forward) v1 = l->next->next->v;
-			else v1 = l->prev->v;
-		}
-		else {
-			/* is_split_vert = 0; */ /* UNUSED */
-			/* ov = BME_edge_getothervert(l->e,v); */ /* UNUSED */
-			sv = BME_split_edge(bm,v,l->e,&ne,0);
-			//BME_data_interp_from_verts(bm, v, ov, sv, 0.25); /*this is technically wrong...*/
-			//BME_data_interp_from_faceverts(bm, v, ov, sv, 0.25);
-			//BME_data_interp_from_faceverts(bm, ov, v, sv, 0.25);
-			BME_assign_transdata(td, bm, sv, sv->co, sv->co, NULL, sv->co, 0, -1, -1, NULL); /* quick default */
-			sv->tflag1 |= BME_BEVEL_BEVEL;
-			ne->tflag1 = BME_BEVEL_ORIG; /* mark edge as original, even though it isn't */
-		}
-
-		if (BME_bevel_is_split_vert(lv2)) {
-			if (forward) v2 = lv2->prev->v;
-			else v2 = lv2->next->v;
-		}
-	}
-
-	is_edge = BME_bevel_get_vec(vec1,v,v1,td); /* get the vector we will be projecting onto */
-	BME_bevel_get_vec(vec2,v,v2,td); /* get the vector we will be projecting parallel to */
-	len = len_v3(vec1);
-	normalize_v3(vec1);
-
-	vtd = BME_get_transdata(td, sv);
-	vtd1 = BME_get_transdata(td, v);
-	/* vtd2 = BME_get_transdata(td,v1); */ /* UNUSED */
-
-	if (vtd1->loc == NULL) {
-		/* this is a vert with data only for calculating initial weights */
-		if (vtd1->weight < 0) {
-			vtd1->weight = 0;
-		}
-		scale = vtd1->weight/vtd1->factor;
-		if (!vtd1->max) {
-			vtd1->max = BME_new_transdata_float(td);
-			*vtd1->max = -1;
-		}
-	}
-	else {
-		scale = vtd1->weight;
-	}
-	vtd->max = vtd1->max;
-
-	if (is_edge && vtd1->loc != NULL) {
-		maxfactor = vtd1->maxfactor;
-	}
-	else {
-		maxfactor = scale*BME_bevel_project_vec(vec1,vec2,up_vec,forward,td);
-		if (vtd->maxfactor > 0 && vtd->maxfactor < maxfactor) {
-			maxfactor = vtd->maxfactor;
-		}
-	}
-
-	dis = (v1->tflag1 & BME_BEVEL_ORIG)? len/3 : len/2;
-	if (is_edge || dis > maxfactor*value) {
-		dis = maxfactor*value;
-	}
-	madd_v3_v3v3fl(sv->co, v->co, vec1, dis);
-	sub_v3_v3v3(vec1, sv->co, vtd1->org);
-	dis = len_v3(vec1);
-	normalize_v3(vec1);
-	BME_assign_transdata(td, bm, sv, vtd1->org, vtd1->org, vec1, sv->co, dis, scale, maxfactor, vtd->max);
-
-	return sv;
-}
-
-static float BME_bevel_set_max(BME_Vert *v1, BME_Vert *v2, float value, BME_TransData_Head *td) {
-	BME_TransData *vtd1, *vtd2;
-	float max, fac1, fac2, vec1[3], vec2[3], vec3[3];
-
-	BME_bevel_get_vec(vec1,v1,v2,td);
-	vtd1 = BME_get_transdata(td,v1);
-	vtd2 = BME_get_transdata(td,v2);
-
-	if (vtd1->loc == NULL) {
-		fac1 = 0;
-	}
-	else {
-		copy_v3_v3(vec2, vtd1->vec);
-		mul_v3_fl(vec2, vtd1->factor);
-		if (dot_v3v3(vec1, vec1)) {
-			project_v3_v3v3(vec2, vec2,vec1);
-			fac1 = len_v3(vec2) / value;
-		}
-		else {
-			fac1 = 0;
-		}
-	}
-
-	if (vtd2->loc == NULL) {
-		fac2 = 0;
-	}
-	else {
-		copy_v3_v3(vec3, vtd2->vec);
-		mul_v3_fl(vec3, vtd2->factor);
-		if (dot_v3v3(vec1, vec1)) {
-			project_v3_v3v3(vec2, vec3, vec1);
-			fac2 = len_v3(vec2) / value;
-		}
-		else {
-			fac2 = 0;
-		}
-	}
-
-	if (fac1 || fac2) {
-		max = len_v3(vec1) / (fac1 + fac2);
-		if (vtd1->max && (*vtd1->max < 0 || max < *vtd1->max)) {
-			*vtd1->max = max;
-		}
-		if (vtd2->max && (*vtd2->max < 0 || max < *vtd2->max)) {
-			*vtd2->max = max;
-		}
-	}
-	else {
-		max = -1;
-	}
-
-	return max;
-}
-
-static BME_Vert *BME_bevel_wire(BME_Mesh *bm, BME_Vert *v, float value, int res, int UNUSED(options), BME_TransData_Head *td) {
-	BME_Vert *ov1, *ov2, *v1, *v2;
-
-	ov1 = BME_edge_getothervert(v->edge, v);
-	ov2 = BME_edge_getothervert(BME_disk_nextedge(v->edge, v), v);
-
-	/* split the edges */
-	v1 = BME_bevel_split_edge(bm,v,ov1,NULL,NULL,value,td);
-	v1->tflag1 |= BME_BEVEL_NONMAN;
-	v2 = BME_bevel_split_edge(bm,v,ov2,NULL,NULL,value,td);
-	v2->tflag1 |= BME_BEVEL_NONMAN;
-
-	if (value > 0.5) {
-		BME_bevel_set_max(v1,ov1,value,td);
-		BME_bevel_set_max(v2,ov2,value,td);
-	}
-
-	/* remove the original vert */
-	if (res) {
-		BME_JEKV(bm,v->edge,v);
-	}
-
-	return v1;
-}
-
-static BME_Loop *BME_bevel_edge(BME_Mesh *bm, BME_Loop *l, float value, int UNUSED(options), float *up_vec, BME_TransData_Head *td) {
-	BME_Vert *v1, *v2, *kv;
-	BME_Loop *kl=NULL, *nl;
-	BME_Edge *e;
-	BME_Poly *f;
-
-	f = l->f;
-	e = l->e;
-
-	if ((l->e->tflag1 & BME_BEVEL_BEVEL) == 0
-		&& ((l->v->tflag1 & BME_BEVEL_BEVEL) || (l->next->v->tflag1 & BME_BEVEL_BEVEL)))
-	{ /* sanity check */
-		return l;
-	}
-
-	/* checks and operations for prev edge */
-	/* first, check to see if this edge was inset previously */
-	if ((l->prev->e->tflag1 & BME_BEVEL_ORIG) == 0
-		&& (l->v->tflag1 & BME_BEVEL_NONMAN) == 0) {
-		kl = l->prev->radial.next->data;
-		if (kl->v == l->v) kl = kl->prev;
-		else kl = kl->next;
-		kv = l->v;
-	}
-	else {
-		kv = NULL;
-	}
-	/* get/make the first vert to be used in SFME */
-	if (l->v->tflag1 & BME_BEVEL_NONMAN){
-		v1 = l->v;
-	}
-	else { /* we'll need to split the previous edge */
-		v1 = BME_bevel_split_edge(bm,l->v,NULL,l->prev,up_vec,value,td);
-	}
-	/* if we need to clean up geometry... */
-	if (kv) {
-		l = l->next;
-		if (kl->v == kv) {
-			BME_split_face(bm,kl->f,kl->prev->v,kl->next->v,&nl,kl->prev->e);
-			BME_JFKE(bm,((BME_Loop*)kl->prev->radial.next->data)->f,kl->f,kl->prev->e);
-			BME_collapse_vert(bm, kl->e, kv, 1.0);
-			//BME_JEKV(bm,kl->e,kv);
-			
-		}
-		else {
-			BME_split_face(bm,kl->f,kl->next->next->v,kl->v,&nl,kl->next->e);
-			BME_JFKE(bm,((BME_Loop*)kl->next->radial.next->data)->f,kl->f,kl->next->e);
-			BME_collapse_vert(bm, kl->e, kv, 1.0);
-			//BME_JEKV(bm,kl->e,kv);
-		}
-		l = l->prev;
-	}
-
-	/* checks and operations for the next edge */
-	/* first, check to see if this edge was inset previously  */
-	if ((l->next->e->tflag1 & BME_BEVEL_ORIG) == 0
-		&& (l->next->v->tflag1 & BME_BEVEL_NONMAN) == 0) {
-		kl = l->next->radial.next->data;
-		if (kl->v == l->next->v) kl = kl->prev;
-		else kl = kl->next;
-		kv = l->next->v;
-	}
-	else {
-		kv = NULL;
-	}
-	/* get/make the second vert to be used in SFME */
-	if (l->next->v->tflag1 & BME_BEVEL_NONMAN) {
-		v2 = l->next->v;
-	}
-	else { /* we'll need to split the next edge */
-		v2 = BME_bevel_split_edge(bm,l->next->v,NULL,l->next,up_vec,value,td);
-	}
-	/* if we need to clean up geometry... */
-	if (kv) {
-		if (kl->v == kv) {
-			BME_split_face(bm,kl->f,kl->prev->v,kl->next->v,&nl,kl->prev->e);
-			BME_JFKE(bm,((BME_Loop*)kl->prev->radial.next->data)->f,kl->f,kl->prev->e);
-			BME_collapse_vert(bm, kl->e, kv, 1.0);
-			//BME_JEKV(bm,kl->e,kv);
-		}
-		else {
-			BME_split_face(bm,kl->f,kl->next->next->v,kl->v,&nl,kl->next->e);
-			BME_JFKE(bm,((BME_Loop*)kl->next->radial.next->data)->f,kl->f,kl->next->e);
-			BME_collapse_vert(bm, kl->e, kv, 1.0);
-			//BME_JEKV(bm,kl->e,kv);
-		}
-	}
-
-	if ((v1->tflag1 & BME_BEVEL_NONMAN)==0 || (v2->tflag1 & BME_BEVEL_NONMAN)==0) {
-		BME_split_face(bm,f,v2,v1,&l,e);
-		l->e->tflag1 = BME_BEVEL_BEVEL;
-		l = l->radial.next->data;
-	}
-
-	if (l->f != f){
-		//printf("Whoops! You got something out of order in BME_bevel_edge()!\n");
-	}
-
-	return l;
-}
-
-static BME_Loop *BME_bevel_vert(BME_Mesh *bm, BME_Loop *l, float value, int UNUSED(options), float *up_vec, BME_TransData_Head *td) {
-	BME_Vert *v1, *v2;
-	/* BME_Poly *f; */ /* UNUSED */
-
-	/* get/make the first vert to be used in SFME */
-	/* may need to split the previous edge */
-	v1 = BME_bevel_split_edge(bm,l->v,NULL,l->prev,up_vec,value,td);
-
-	/* get/make the second vert to be used in SFME */
-	/* may need to split this edge (so move l) */
-	l = l->prev;
-	v2 = BME_bevel_split_edge(bm,l->next->v,NULL,l->next,up_vec,value,td);
-	l = l->next->next;
-
-	/* "cut off" this corner */
-	/* f = */ /* UNUSED */ BME_split_face(bm,l->f,v2,v1,NULL,l->e);
-
-	return l;
-}
-
-/**
- *			BME_bevel_poly
- *
- *	Polygon inset tool:
- *
- *	Insets a polygon/face based on the tflag1's of its vertices
- *	and edges. Used by the bevel tool only, for now.
- *  The parameter "value" is the distance to inset (should be negative).
- *  The parameter "options" is not currently used.
- *
- *	Returns -
- *  A BME_Poly pointer to the resulting inner face.
-*/
-static BME_Poly *BME_bevel_poly(BME_Mesh *bm, BME_Poly *f, float value, int options, BME_TransData_Head *td) {
-	BME_Loop *l, *ol;
-	BME_TransData *vtd1, *vtd2;
-	float up_vec[3], vec1[3], vec2[3], vec3[3], fac1, fac2, max = -1;
-	int len, i;
-
-	up_vec[0] = 0.0f;
-	up_vec[1] = 0.0f;
-	up_vec[2] = 0.0f;
-	/* find a good normal for this face (there's better ways, I'm sure) */
-	ol = f->loopbase;
-	l = ol->next;
-	for (i=0,ol=f->loopbase,l=ol->next; l->next!=ol; l=l->next) {
-		BME_bevel_get_vec(vec1,l->next->v,ol->v,td);
-		BME_bevel_get_vec(vec2,l->v,ol->v,td);
-		cross_v3_v3v3(vec3, vec2, vec1);
-		add_v3_v3(up_vec, vec3);
-		i++;
-	}
-	mul_v3_fl(up_vec,1.0f/i);
-	normalize_v3(up_vec);
-
-	for (i=0,len=f->len; i<len; i++,l=l->next) {
-		if ((l->e->tflag1 & BME_BEVEL_BEVEL) && (l->e->tflag1 & BME_BEVEL_ORIG)) {
-			max = 1.0f;
-			l = BME_bevel_edge(bm, l, value, options, up_vec, td);
-		}
-		else if ((l->v->tflag1 & BME_BEVEL_BEVEL) && (l->v->tflag1 & BME_BEVEL_ORIG) && (l->prev->e->tflag1 & BME_BEVEL_BEVEL) == 0) {
-			max = 1.0f;
-			l = BME_bevel_vert(bm, l, value, options, up_vec, td);
-		}
-	}
-
-	/* max pass */
-	if (value > 0.5 && max > 0) {
-		max = -1;
-		for (i=0,len=f->len; i<len; i++,l=l->next) {
-			if ((l->e->tflag1 & BME_BEVEL_BEVEL) || (l->e->tflag1 & BME_BEVEL_ORIG)) {
-				BME_bevel_get_vec(vec1,l->v,l->next->v,td);
-				vtd1 = BME_get_transdata(td,l->v);
-				vtd2 = BME_get_transdata(td,l->next->v);
-				if (vtd1->loc == NULL) {
-					fac1 = 0;
-				}
-				else {
-					copy_v3_v3(vec2,vtd1->vec);
-					mul_v3_fl(vec2,vtd1->factor);
-					if (dot_v3v3(vec1, vec1)) {
-						project_v3_v3v3(vec2,vec2,vec1);
-						fac1 = len_v3(vec2)/value;
-					}
-					else {
-						fac1 = 0;
-					}
-				}
-				if (vtd2->loc == NULL) {
-					fac2 = 0;
-				}
-				else {
-					copy_v3_v3(vec3,vtd2->vec);
-					mul_v3_fl(vec3,vtd2->factor);
-					if (dot_v3v3(vec1, vec1)) {
-						project_v3_v3v3(vec2,vec3,vec1);
-						fac2 = len_v3(vec2)/value;
-					}
-					else {
-						fac2 = 0;
-					}
-				}
-				if (fac1 || fac2) {
-					max = len_v3(vec1)/(fac1 + fac2);
-					if (vtd1->max && (*vtd1->max < 0 || max < *vtd1->max)) {
-						*vtd1->max = max;
-					}
-					if (vtd2->max && (*vtd2->max < 0 || max < *vtd2->max)) {
-						*vtd2->max = max;
-					}
-				}
-			}
-		}
-	}
-
-	return l->f;
-}
-
-static void BME_bevel_add_vweight(BME_TransData_Head *td, BME_Mesh *bm, BME_Vert *v, float weight, float factor, int options)
-{
-	BME_TransData *vtd;
-
-	if (v->tflag1 & BME_BEVEL_NONMAN) return;
-	v->tflag1 |= BME_BEVEL_BEVEL;
-	if ( (vtd = BME_get_transdata(td, v)) ) {
-		if (options & BME_BEVEL_EMIN) {
-			vtd->factor = 1.0;
-			if (vtd->weight < 0 || weight < vtd->weight) {
-				vtd->weight = weight;
-			}
-		}
-		else if (options & BME_BEVEL_EMAX) {
-			vtd->factor = 1.0;
-			if (weight > vtd->weight) {
-				vtd->weight = weight;
-			}
-		}
-		else if (vtd->weight < 0) {
-			vtd->factor = factor;
-			vtd->weight = weight;
-		}
-		else {
-			vtd->factor += factor; /* increment number of edges with weights (will be averaged) */
-			vtd->weight += weight; /* accumulate all the weights */
-		}
-	}
-	else {
-		/* we'll use vtd->loc == NULL to mark that this vert is not moving */
-		vtd = BME_assign_transdata(td, bm, v, v->co, NULL, NULL, NULL, factor, weight, -1, NULL);
-	}
-}
-
-static float BME_bevel_get_angle(BME_Mesh *UNUSED(bm), BME_Edge *e, BME_Vert *v) {
-	BME_Vert *v1, *v2;
-	BME_Loop *l1, *l2;
-	float vec1[3], vec2[3], vec3[3], vec4[3];
-
-	l1 = e->loop;
-	l2 = e->loop->radial.next->data;
-	if (l1->v == v) {
-		v1 = l1->prev->v;
-		v2 = l1->next->v;
-	}
-	else {
-		v1 = l1->next->next->v;
-		v2 = l1->v;
-	}
-	VECSUB(vec1,v1->co,v->co);
-	VECSUB(vec2,v2->co,v->co);
-	cross_v3_v3v3(vec3,vec1,vec2);
-
-	l1 = l2;
-	if (l1->v == v) {
-		v1 = l1->prev->v;
-		v2 = l1->next->v;
-	}
-	else {
-		v1 = l1->next->next->v;
-		v2 = l1->v;
-	}
-	VECSUB(vec1,v1->co,v->co);
-	VECSUB(vec2,v2->co,v->co);
-	cross_v3_v3v3(vec4,vec2,vec1);
-
-	normalize_v3(vec3);
-	normalize_v3(vec4);
-
-	return dot_v3v3(vec3,vec4);
-}
-static int BME_face_sharededges(BME_Poly *f1, BME_Poly *f2){
-	BME_Loop *l;
-	int count = 0;
-	
-	l = f1->loopbase;
-	do{
-		if(BME_radial_find_face(l->e,f2)) count++;
-		l = l->next;
-	}while(l != f1->loopbase);
-	
-	return count;
-}
-/**
- *			BME_bevel_initialize
- *
- *	Prepare the mesh for beveling:
- *
- *	Sets the tflag1's of the mesh elements based on the options passed.
- *
- *	Returns -
- *  A BME_Mesh pointer to the BMesh passed as a parameter.
-*/
-static BME_Mesh *BME_bevel_initialize(BME_Mesh *bm, int options, int UNUSED(defgrp_index), float angle, BME_TransData_Head *td) {
-	BME_Vert *v;
-	BME_Edge *e;
-	BME_Poly *f;
-	/* BME_TransData *vtd; */ /* UNUSED */
-	/* MDeformVert *dvert; */ /* UNUSED */
-	/* MDeformWeight *dw; */ /* UNUSED */
-	int len;
-	float weight, threshold;
-
-	/* vert pass */
-	for (v=bm->verts.first; v; v=v->next) {
-		/* dvert = NULL; */ /* UNUSED */
-		/* dw = NULL; */ /* UNUSED */
-		v->tflag1 = BME_BEVEL_ORIG;
-		/* originally coded, a vertex gets tagged with BME_BEVEL_BEVEL in this pass if
-		 * the vert is manifold (or is shared by only two edges - wire bevel)
-		 * BME_BEVEL_SELECT is passed and the vert has v->flag&SELECT or
-		 * BME_BEVEL_VWEIGHT is passed, and the vert has a defgrp and weight
-		 * BME_BEVEL_ANGLE is not passed
-		 * BME_BEVEL_EWEIGHT is not passed
-		 */
-		/* originally coded, a vertex gets tagged with BME_BEVEL_NONMAN in this pass if
-		 * the vert is loose, shared by multiple regions, or is shared by wire edges
-		 * note: verts belonging to edges of open meshes are not tagged with BME_BEVEL_NONMAN
-		 */
-		/* originally coded, a vertex gets a transform weight set in this pass if
-		 * BME_BEVEL_VWEIGHT is passed, and the vert has a defgrp and weight
-		 */
-
-		/* get disk cycle length */
-		if (v->edge == NULL) {
-			len = 0;
-		}
-		else {
-			len = BME_cycle_length(BME_disk_getpointer(v->edge,v));
-			/* we'll assign a default transform data to every vert (except the loose ones) */
-			/* vtd = */ /* UNUSED */ BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 0, -1, -1, NULL);
-		}
-
-		/* check for non-manifold vert */
-		if (BME_is_nonmanifold_vert(bm,v)) {
-			v->tflag1 |= BME_BEVEL_NONMAN;
-		}
-
-		/* BME_BEVEL_BEVEL tests */
-		if ((v->tflag1 & BME_BEVEL_NONMAN) == 0 || len == 2) { /* either manifold vert, or wire vert */
-			if (((options & BME_BEVEL_SELECT) && (v->flag & SELECT))
-				|| ((options & BME_BEVEL_WEIGHT) && (options & BME_BEVEL_VERT)) /* use weights for verts */
-				|| ((options & BME_BEVEL_ANGLE) == 0
-					&& (options & BME_BEVEL_SELECT) == 0
-					&& (options & BME_BEVEL_WEIGHT) == 0))
-			{
-				if (options & BME_BEVEL_WEIGHT) {
-					/* do vert weight stuff */
-					//~ dvert = CustomData_em_get(&bm->vdata,v->data,CD_MDEFORMVERT);
-					//~ if (!dvert) continue;
-					//~ for (i = 0; i < dvert->totweight; ++i) {
-						//~ if(dvert->dw[i].def_nr == defgrp_index) {
-							//~ dw = &dvert->dw[i];
-							//~ break;
-						//~ }
-					//~ }
-					//~ if (!dw || dw->weight == 0.0) continue;
-					if (v->bweight == 0.0) continue;
-					/* vtd = */ /* UNUSED */ BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 1.0, v->bweight, -1, NULL);
-					v->tflag1 |= BME_BEVEL_BEVEL;
-				}
-				else {
-					/* vtd = */ /* UNUSED */ BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 1.0, 1.0, -1, NULL);
-					v->tflag1 |= BME_BEVEL_BEVEL;
-				}
-			}
-		}
-	}
-
-	/* edge pass */
-	threshold = (float)cos((angle + 0.001) * M_PI / 180.0);
-	for (e=bm->edges.first; e; e=e->next) {
-		e->tflag1 = BME_BEVEL_ORIG;
-		weight = 0.0;
-		/* originally coded, an edge gets tagged with BME_BEVEL_BEVEL in this pass if
-		 * BME_BEVEL_VERT is not set
-		 * the edge is manifold (shared by exactly two faces)
-		 * BME_BEVEL_SELECT is passed and the edge has e->flag&SELECT or
-		 * BME_BEVEL_EWEIGHT is passed, and the edge has the crease set or
-		 * BME_BEVEL_ANGLE is passed, and the edge is sharp enough
-		 * BME_BEVEL_VWEIGHT is passed, and both verts are set for bevel
-		 */
-		/* originally coded, a vertex gets tagged with BME_BEVEL_BEVEL in this pass if
-		 * the vert belongs to the edge
-		 * the vert is not tagged with BME_BEVEL_NONMAN
-		 * the edge is eligible for bevel (even if BME_BEVEL_VERT is set, or the edge is shared by less than 2 faces)
-		 */
-		/* originally coded, a vertex gets a transform weight set in this pass if
-		 * the vert belongs to the edge
-		 * the edge has a weight
-		 */
-		/* note: edge weights are cumulative at the verts,
-		 * i.e. the vert's weight is the average of the weights of its weighted edges
-		 */
-
-		if (e->loop == NULL) {
-			len = 0;
-			e->v1->tflag1 |= BME_BEVEL_NONMAN;
-			e->v2->tflag1 |= BME_BEVEL_NONMAN;
-		}
-		else {
-			len = BME_cycle_length(&(e->loop->radial));
-		}
-
-		if (len > 2) {
-			/* non-manifold edge of the worst kind */
-			continue;
-		}
-
-		if ((options & BME_BEVEL_SELECT) && (e->flag & SELECT)) {
-			weight = 1.0;
-			/* stupid editmode doesn't always flush selections, or something */
-			e->v1->flag |= SELECT;
-			e->v2->flag |= SELECT;
-		}
-		else if ((options & BME_BEVEL_WEIGHT) && (options & BME_BEVEL_VERT) == 0) {
-			weight = e->bweight;
-		}
-		else if (options & BME_BEVEL_ANGLE) {
-			if ((e->v1->tflag1 & BME_BEVEL_NONMAN) == 0 && BME_bevel_get_angle(bm,e,e->v1) < threshold) {
-				e->tflag1 |= BME_BEVEL_BEVEL;
-				e->v1->tflag1 |= BME_BEVEL_BEVEL;
-				BME_bevel_add_vweight(td, bm, e->v1, 1.0, 1.0, options);
-			}
-			else {
-				BME_bevel_add_vweight(td, bm, e->v1, 0.0, 1.0, options);
-			}
-			if ((e->v2->tflag1 & BME_BEVEL_NONMAN) == 0 && BME_bevel_get_angle(bm,e,e->v2) < threshold) {
-				e->tflag1 |= BME_BEVEL_BEVEL;
-				e->v2->tflag1 |= BME_BEVEL_BEVEL;
-				BME_bevel_add_vweight(td, bm, e->v2, 1.0, 1.0, options);
-			}
-			else {
-				BME_bevel_add_vweight(td, bm, e->v2, 0.0, 1.0, options);
-			}
-		}
-		//~ else if ((options & BME_BEVEL_VWEIGHT) && (options & BME_BEVEL_VERT) == 0) {
-			//~ if ((e->v1->tflag1 & BME_BEVEL_BEVEL) && (e->v2->tflag1 & BME_BEVEL_BEVEL)) {
-				//~ e->tflag1 |= BME_BEVEL_BEVEL;
-			//~ }
-		//~ }
-		else if ((options & BME_BEVEL_SELECT) == 0
-			&& (options & BME_BEVEL_VERT) == 0)
-		{
-			weight = 1.0;
-		}
-
-		if (weight > 0.0) {
-			e->tflag1 |= BME_BEVEL_BEVEL;
-			BME_bevel_add_vweight(td, bm, e->v1, weight, 1.0, options);
-			BME_bevel_add_vweight(td, bm, e->v2, weight, 1.0, options);
-		}
-
-		if (len != 2 || options & BME_BEVEL_VERT) {
-			e->tflag1 &= ~BME_BEVEL_BEVEL;
-		}
-	}
-
-	/* face pass */
-	for (f=bm->polys.first; f; f=f->next) f->tflag1 = BME_BEVEL_ORIG;
-
-	/*clean up edges with 2 faces that share more than one edge*/
-	for (e=bm->edges.first; e; e=e->next){
-		if(e->tflag1 & BME_BEVEL_BEVEL){
-			int count = 0;
-			count = BME_face_sharededges(e->loop->f, ((BME_Loop*)e->loop->radial.next->data)->f);
-			if(count > 1){
-				e->tflag1 &= ~BME_BEVEL_BEVEL;
-			}	
-		}
-	}
-
-	return bm;
-
-}
-
-/* tags all elements as originals */
-static BME_Mesh *BME_bevel_reinitialize(BME_Mesh *bm) {
-	BME_Vert *v;
-	BME_Edge *e;
-	BME_Poly *f;
-
-	for (v = bm->verts.first; v; v=v->next) {
-		v->tflag1 |= BME_BEVEL_ORIG;
-	}
-
-	for (e=bm->edges.first; e; e=e->next) {
-		e->tflag1 |= BME_BEVEL_ORIG;
-	}
-
-	for (f=bm->polys.first; f; f=f->next) {
-		f->tflag1 |= BME_BEVEL_ORIG;
-	}
-	return bm;
-
-}
-
-/**
- *			BME_bevel_mesh
- *
- *	Mesh beveling tool:
- *
- *	Bevels an entire mesh. It currently uses the tflag1's of
- *	its vertices and edges to track topological changes.
- *  The parameter "value" is the distance to inset (should be negative).
- *  The parameter "options" is not currently used.
- *
- *	Returns -
- *  A BME_Mesh pointer to the BMesh passed as a parameter.
-*/
-
-static void bmesh_dissolve_disk(BME_Mesh *bm, BME_Vert *v){
-	BME_Poly *f;
-	BME_Edge *e;
-	int done, len;
-	
-	if(v->edge){
-		done = 0;
-		while(!done){
-			done = 1;
-			e = v->edge; /*loop the edge looking for a edge to dissolve*/
-			do{
-				f = NULL;
-				len = BME_cycle_length(&(e->loop->radial));
-				if(len == 2){
-					f = BME_JFKE_safe(bm,e->loop->f, ((BME_Loop*)(e->loop->radial.next->data))->f, e);
-				}
-				if(f){ 
-					done = 0;
-					break;
-				}
-				e = BME_disk_nextedge(e,v);
-			}while(e != v->edge);
-		}
-		BME_collapse_vert(bm, v->edge, v, 1.0);
-		//BME_JEKV(bm,v->edge,v);
-	}
-}
-static BME_Mesh *BME_bevel_mesh(BME_Mesh *bm, float value, int res, int options, int UNUSED(defgrp_index), BME_TransData_Head *td) {
-	BME_Vert *v, *nv;
-	BME_Edge *e, *oe;
-	BME_Loop *l, *l2;
-	BME_Poly *f;
-	unsigned int i, len;
-
-	for (f=bm->polys.first; f; f=f->next) {
-		if(f->tflag1 & BME_BEVEL_ORIG) {
-			BME_bevel_poly(bm,f,value,options,td);
-		}
-	}
-
-	/* here we will loop through all the verts to clean up the left over geometry */
-	/* crazy idea. when res == 0, don't remove the original geometry */
-	for (v = bm->verts.first; v; /* we may kill v, so increment in-loop */) {
-		nv = v->next;
-		if ((v->tflag1 & BME_BEVEL_NONMAN) && (v->tflag1 & BME_BEVEL_BEVEL) && (v->tflag1 & BME_BEVEL_ORIG)) {
-			v = BME_bevel_wire(bm, v, value, res, options, td);
-		}
-		else if (res && ((v->tflag1 & BME_BEVEL_BEVEL) && (v->tflag1 & BME_BEVEL_ORIG))) {
-			int count = 0;
-			/* first, make sure we're not sitting on an edge to be removed */
-			oe = v->edge;
-			e = BME_disk_nextedge(oe,v);
-			while ((e->tflag1 & BME_BEVEL_BEVEL) && (e->tflag1 & BME_BEVEL_ORIG)) {
-				e = BME_disk_nextedge(e,v);
-				if (e == oe) {
-					//printf("Something's wrong! We can't remove every edge here!\n");
-					break;
-				}
-			}
-			/* look for original edges, and remove them */
-			oe = e;
-			while ( (e = BME_disk_next_edgeflag(oe, v, 0, BME_BEVEL_ORIG | BME_BEVEL_BEVEL)) ) {
-				count++;
-				/* join the faces (we'll split them later) */
-				f = BME_JFKE_safe(bm,e->loop->f,((BME_Loop*)e->loop->radial.next->data)->f,e);
-				if (!f){
-					//printf("Non-manifold geometry not getting tagged right?\n");
-				}
-			}
-
-			/*need to do double check *before* you bevel to make sure that manifold edges are for two faces that share only *one* edge to make sure it doesnt hang here!*/
-
-
-			/* all original edges marked to be beveled have been removed;
-			 * now we need to link up the edges for this "corner" */
-			len = BME_cycle_length(BME_disk_getpointer(v->edge, v));
-			for (i=0,e=v->edge; i < len; i++,e=BME_disk_nextedge(e,v)) {
-				l = e->loop;
-				l2 = l->radial.next->data;
-				if (l->v != v) l = l->next;
-				if (l2->v != v) l2 = l2->next;
-				/* look for faces that have had the original edges removed via JFKE */
-				if (l->f->len > 3) {
-					BME_split_face(bm,l->f,l->next->v,l->prev->v,&l,l->e); /* clip this corner off */
-					if (len > 2) {
-						l->e->tflag1 |= BME_BEVEL_BEVEL;
-					}
-				}
-				if (l2->f->len > 3) {
-					BME_split_face(bm,l2->f,l2->next->v,l2->prev->v,&l,l2->e); /* clip this corner off */
-					if (len > 2) {
-						l->e->tflag1 |= BME_BEVEL_BEVEL;
-					}
-				}
-			}
-			bmesh_dissolve_disk(bm, v);
-		}
-		v = nv;
-	}
-
-	return bm;
-}
-
-static BME_Mesh *BME_tesselate(BME_Mesh *bm) {
-	BME_Loop *l, *nextloop;
-	BME_Poly *f;
-
-	for (f=bm->polys.first; f; f=f->next) {
-		l = f->loopbase;
-		while (l->f->len > 4) {
-			nextloop = l->next->next->next;
-			/* make a quad */
-			BME_split_face(bm,l->f,l->v,nextloop->v,NULL,l->e);
-			l = nextloop;
-		}
-	}
-	return bm;
-}
-
-
-/*Main bevel function:
-	Should be only one exported
-
-*/
-
-/* options that can be passed:
- * BME_BEVEL_VWEIGHT	<---- v, Look at vertex weights; use defgrp_index if option is present
- * BME_BEVEL_SELECT		<---- v,e, check selection for verts and edges
- * BME_BEVEL_ANGLE		<---- v,e, don't bevel-tag verts - tag verts per edge
- * BME_BEVEL_VERT		<---- e, don't tag edges
- * BME_BEVEL_EWEIGHT	<---- e, use crease flag for now
- * BME_BEVEL_PERCENT	<---- Will need to think about this one; will probably need to incorporate into actual bevel routine
- * BME_BEVEL_RADIUS		<---- Will need to think about this one; will probably need to incorporate into actual bevel routine
- * All weights/limits are stored per-vertex
- */
-BME_Mesh *BME_bevel(BME_Mesh *bm, float value, int res, int options, int defgrp_index, float angle, BME_TransData_Head **rtd) {
-	BME_Vert *v;
-	BME_TransData_Head *td;
-	BME_TransData *vtd;
-	int i;
-	float fac=1, d;
-
-	td = BME_init_transdata(BLI_MEMARENA_STD_BUFSIZE);
-
-	BME_bevel_initialize(bm, options, defgrp_index, angle, td);
-
-	/* recursion math courtesy of Martin Poirier (theeth) */
-	for (i=0; i<res-1; i++) {
-		if (i==0) fac += 1.0f/3.0f; else fac += 1.0f/(3 * i * 2.0f);
-	}
-	d = 1.0f/fac;
-	/* crazy idea. if res == 0, don't remove original geometry */
-	for (i=0; i<res || (res==0 && i==0); i++) {
-		if (i != 0) BME_bevel_reinitialize(bm);
-		BME_model_begin(bm);
-		BME_bevel_mesh(bm,d,res,options,defgrp_index,td);
-		BME_model_end(bm);
-		if (i==0) d /= 3; else d /= 2;
-	}
-
-	BME_tesselate(bm);
-
-	if (rtd) {
-		*rtd = td;
-		return bm;
-	}
-
-	/* transform pass */
-	for (v = bm->verts.first; v; v=v->next) {
-		if ( (vtd = BME_get_transdata(td, v)) ) {
-			if (vtd->max && (*vtd->max > 0 && value > *vtd->max)) {
-				d = *vtd->max;
-			}
-			else {
-				d = value;
-			}
-			madd_v3_v3v3fl(v->co,vtd->org,vtd->vec,vtd->factor*d);
-		}
-		v->tflag1 = 0;
-	}
-
-	BME_free_transdata(td);
-	return bm;
-}
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c
index 3ab52a7..f571897 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf.c
@@ -8,21 +8,17 @@
 #include <math.h>
 
 #include "CCGSubSurf.h"
+#include "BKE_subsurf.h"
 
 #include "MEM_guardedalloc.h"
 #include "BLO_sys_types.h" // for intptr_t support
 
-#ifdef _MSC_VER
-#define CCG_INLINE __inline
-#else
-#define CCG_INLINE inline
-#endif
+#include "BLI_utildefines.h" /* for BLI_assert */
 
-/* copied from BKE_utildefines.h ugh */
-#ifdef __GNUC__
-#  define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
+#ifdef _MSC_VER
+#  define CCG_INLINE __inline
 #else
-#  define UNUSED(x) x
+#  define CCG_INLINE inline
 #endif
 
 /* used for normalize_v3 in BLI_math_vector
@@ -31,7 +27,7 @@
 
 /***/
 
-typedef unsigned char	byte;
+typedef unsigned char byte;
 
 /***/
 
@@ -54,27 +50,32 @@ typedef struct _EHash {
 	CCGAllocatorHDL allocator;
 } EHash;
 
-#define EHASH_alloc(eh, nb)			((eh)->allocatorIFC.alloc((eh)->allocator, nb))
-#define EHASH_free(eh, ptr)			((eh)->allocatorIFC.free((eh)->allocator, ptr))
+#define EHASH_alloc(eh, nb)     ((eh)->allocatorIFC.alloc((eh)->allocator, nb))
+#define EHASH_free(eh, ptr)     ((eh)->allocatorIFC.free((eh)->allocator, ptr))
+
+#define EHASH_hash(eh, item)    (((uintptr_t) (item)) % ((unsigned int) (eh)->curSize))
 
-#define EHASH_hash(eh, item)	(((uintptr_t) (item))%((unsigned int) (eh)->curSize))
+static void ccgSubSurf__sync(CCGSubSurf *ss);
+static int _edge_isBoundary(const CCGEdge *e);
 
-static EHash *_ehash_new(int estimatedNumEntries, CCGAllocatorIFC *allocatorIFC, CCGAllocatorHDL allocator) {
+static EHash *_ehash_new(int estimatedNumEntries, CCGAllocatorIFC *allocatorIFC, CCGAllocatorHDL allocator)
+{
 	EHash *eh = allocatorIFC->alloc(allocator, sizeof(*eh));
 	eh->allocatorIFC = *allocatorIFC;
 	eh->allocator = allocator;
 	eh->numEntries = 0;
 	eh->curSizeIdx = 0;
-	while (kHashSizes[eh->curSizeIdx]<estimatedNumEntries)
+	while (kHashSizes[eh->curSizeIdx] < estimatedNumEntries)
 		eh->curSizeIdx++;
 	eh->curSize = kHashSizes[eh->curSizeIdx];
-	eh->buckets = EHASH_alloc(eh, eh->curSize*sizeof(*eh->buckets));
-	memset(eh->buckets, 0, eh->curSize*sizeof(*eh->buckets));
+	eh->buckets = EHASH_alloc(eh, eh->curSize * sizeof(*eh->buckets));
+	memset(eh->buckets, 0, eh->curSize * sizeof(*eh->buckets));
 
 	return eh;
 }
 typedef void (*EHEntryFreeFP)(EHEntry *, void *);
-static void _ehash_free(EHash *eh, EHEntryFreeFP freeEntry, void *userData) {
+static void _ehash_free(EHash *eh, EHEntryFreeFP freeEntry, void *userData)
+{
 	int numBuckets = eh->curSize;
 
 	while (numBuckets--) {
@@ -93,22 +94,23 @@ static void _ehash_free(EHash *eh, EHEntryFreeFP freeEntry, void *userData) {
 	EHASH_free(eh, eh);
 }
 
-static void _ehash_insert(EHash *eh, EHEntry *entry) {
+static void _ehash_insert(EHash *eh, EHEntry *entry)
+{
 	int numBuckets = eh->curSize;
 	int hash = EHASH_hash(eh, entry->key);
 	entry->next = eh->buckets[hash];
 	eh->buckets[hash] = entry;
 	eh->numEntries++;
 
-	if (eh->numEntries > (numBuckets*3)) {
+	if (eh->numEntries > (numBuckets * 3)) {
 		EHEntry **oldBuckets = eh->buckets;
 		eh->curSize = kHashSizes[++eh->curSizeIdx];
 		
-		eh->buckets = EHASH_alloc(eh, eh->curSize*sizeof(*eh->buckets));
-		memset(eh->buckets, 0, eh->curSize*sizeof(*eh->buckets));
+		eh->buckets = EHASH_alloc(eh, eh->curSize * sizeof(*eh->buckets));
+		memset(eh->buckets, 0, eh->curSize * sizeof(*eh->buckets));
 
 		while (numBuckets--) {
-			for (entry = oldBuckets[numBuckets]; entry;) {
+			for (entry = oldBuckets[numBuckets]; entry; ) {
 				EHEntry *next = entry->next;
 				
 				hash = EHASH_hash(eh, entry->key);
@@ -123,14 +125,15 @@ static void _ehash_insert(EHash *eh, EHEntry *entry) {
 	}
 }
 
-static void *_ehash_lookupWithPrev(EHash *eh, void *key, void ***prevp_r) {
+static void *_ehash_lookupWithPrev(EHash *eh, void *key, void ***prevp_r)
+{
 	int hash = EHASH_hash(eh, key);
-	void **prevp = (void**) &eh->buckets[hash];
+	void **prevp = (void **) &eh->buckets[hash];
 	EHEntry *entry;
 	
-	for (; (entry = *prevp); prevp = (void**) &entry->next) {
-		if (entry->key==key) {
-			*prevp_r = (void**) prevp;
+	for (; (entry = *prevp); prevp = (void **) &entry->next) {
+		if (entry->key == key) {
+			*prevp_r = (void **) prevp;
 			return entry;
 		}
 	}
@@ -138,12 +141,13 @@ static void *_ehash_lookupWithPrev(EHash *eh, void *key, void ***prevp_r) {
 	return NULL;
 }
 
-static void *_ehash_lookup(EHash *eh, void *key) {
+static void *_ehash_lookup(EHash *eh, void *key)
+{
 	int hash = EHASH_hash(eh, key);
 	EHEntry *entry;
 	
 	for (entry = eh->buckets[hash]; entry; entry = entry->next)
-		if (entry->key==key)
+		if (entry->key == key)
 			break;
 	
 	return entry;
@@ -157,55 +161,64 @@ typedef struct _EHashIterator {
 	EHEntry *curEntry;
 } EHashIterator;
 
-static EHashIterator *_ehashIterator_new(EHash *eh) {
+static EHashIterator *_ehashIterator_new(EHash *eh)
+{
 	EHashIterator *ehi = EHASH_alloc(eh, sizeof(*ehi));
 	ehi->eh = eh;
 	ehi->curEntry = NULL;
 	ehi->curBucket = -1;
 	while (!ehi->curEntry) {
 		ehi->curBucket++;
-		if (ehi->curBucket==ehi->eh->curSize)
+		if (ehi->curBucket == ehi->eh->curSize)
 			break;
 		ehi->curEntry = ehi->eh->buckets[ehi->curBucket];
 	}
 	return ehi;
 }
-static void _ehashIterator_free(EHashIterator *ehi) {
+static void _ehashIterator_free(EHashIterator *ehi)
+{
 	EHASH_free(ehi->eh, ehi);
 }
 
-static void *_ehashIterator_getCurrent(EHashIterator *ehi) {
+static void *_ehashIterator_getCurrent(EHashIterator *ehi)
+{
 	return ehi->curEntry;
 }
 
-static void _ehashIterator_next(EHashIterator *ehi) {
+static void _ehashIterator_next(EHashIterator *ehi)
+{
 	if (ehi->curEntry) {
 		ehi->curEntry = ehi->curEntry->next;
 		while (!ehi->curEntry) {
 			ehi->curBucket++;
-			if (ehi->curBucket==ehi->eh->curSize)
+			if (ehi->curBucket == ehi->eh->curSize)
 				break;
 			ehi->curEntry = ehi->eh->buckets[ehi->curBucket];
 		}
 	}
 }
-static int _ehashIterator_isStopped(EHashIterator *ehi) {
+static int _ehashIterator_isStopped(EHashIterator *ehi)
+{
 	return !ehi->curEntry;
 }
 
 /***/
 
-static void *_stdAllocator_alloc(CCGAllocatorHDL UNUSED(a), int numBytes) {
+static void *_stdAllocator_alloc(CCGAllocatorHDL UNUSED(a), int numBytes)
+{
 	return malloc(numBytes);
 }
-static void *_stdAllocator_realloc(CCGAllocatorHDL UNUSED(a), void *ptr, int newSize, int UNUSED(oldSize)) {
+static void *_stdAllocator_realloc(CCGAllocatorHDL UNUSED(a), void *ptr, int newSize, int UNUSED(oldSize))
+{
 	return realloc(ptr, newSize);
 }
-static void _stdAllocator_free(CCGAllocatorHDL UNUSED(a), void *ptr) {
+static void _stdAllocator_free(CCGAllocatorHDL UNUSED(a), void *ptr)
+{
 	free(ptr);
 }
 
-static CCGAllocatorIFC *_getStandardAllocatorIFC(void) {
+static CCGAllocatorIFC *_getStandardAllocatorIFC(void)
+{
 	static CCGAllocatorIFC ifc;
 
 	ifc.alloc = _stdAllocator_alloc;
@@ -218,45 +231,86 @@ static CCGAllocatorIFC *_getStandardAllocatorIFC(void) {
 
 /***/
 
-static int VertDataEqual(const float *a, const float *b) {
-	return a[0]==b[0] && a[1]==b[1] && a[2]==b[2];
+int ccg_gridsize(int level)
+{
+	BLI_assert(level > 0);
+	BLI_assert(level <= 31);
+         
+	return (1 << (level - 1)) + 1;
+}
+
+int ccg_factor(int low_level, int high_level)
+{
+	BLI_assert(low_level > 0 && high_level > 0);
+	BLI_assert(low_level <= high_level);
+
+	return 1 << (high_level - low_level);
+}
+
+static int ccg_edgesize(int level)
+{
+	BLI_assert(level > 0);
+	BLI_assert(level <= 30);
+	
+	return 1 + (1 << level);
 }
-#define VertDataZero(av)				{ float *_a = (float*) av; _a[0] = _a[1] = _a[2] = 0.0f; }
-#define VertDataCopy(av, bv)			{ float *_a = (float*) av, *_b = (float*) bv; _a[0] =_b[0]; _a[1] =_b[1]; _a[2] =_b[2]; }
-#define VertDataAdd(av, bv)				{ float *_a = (float*) av, *_b = (float*) bv; _a[0]+=_b[0]; _a[1]+=_b[1]; _a[2]+=_b[2]; }
-#define VertDataSub(av, bv)				{ float *_a = (float*) av, *_b = (float*) bv; _a[0]-=_b[0]; _a[1]-=_b[1]; _a[2]-=_b[2]; }
-#define VertDataMulN(av, n)				{ float *_a = (float*) av; _a[0]*=n; _a[1]*=n; _a[2]*=n; }
+
+static int ccg_spacing(int high_level, int low_level)
+{
+	BLI_assert(high_level > 0 && low_level > 0);
+	BLI_assert(high_level >= low_level);
+	BLI_assert((high_level - low_level) <= 30);
+
+	return 1 << (high_level - low_level);
+}
+
+static int ccg_edgebase(int level)
+{
+	BLI_assert(level > 0);
+	BLI_assert(level <= 30);
+
+	return level + (1 << level) - 1;
+}
+
+/***/
+
+static int VertDataEqual(const float *a, const float *b)
+{
+	return a[0] == b[0] && a[1] == b[1] && a[2] == b[2];
+}
+#define VertDataZero(av)     { float *_a = (float *)av; _a[0] = _a[1] = _a[2] = 0.0f; }
+#define VertDataCopy(av, bv) { float *_a = (float *)av, *_b = (float *) bv; _a[0]  = _b[0]; _a[1]  = _b[1]; _a[2]  = _b[2]; }
+#define VertDataAdd(av, bv)  { float *_a = (float *)av, *_b = (float *) bv; _a[0] += _b[0]; _a[1] += _b[1]; _a[2] += _b[2]; }
+#define VertDataSub(av, bv)  { float *_a = (float *)av, *_b = (float *) bv; _a[0] -= _b[0]; _a[1] -= _b[1]; _a[2] -= _b[2]; }
+#define VertDataMulN(av, n)  { float *_a = (float *)av; float _n = n; _a[0] *= _n; _a[1] *= _n; _a[2] *= _n; }
 #define VertDataAvg4(tv, av, bv, cv, dv) \
 	{ \
-		float *_t = (float*) tv, *_a = (float*) av, *_b = (float*) bv, *_c = (float*) cv, *_d = (float*) dv; \
-		_t[0] = (_a[0]+_b[0]+_c[0]+_d[0])*.25f; \
-		_t[1] = (_a[1]+_b[1]+_c[1]+_d[1])*.25f; \
-		_t[2] = (_a[2]+_b[2]+_c[2]+_d[2])*.25f; \
+		float *_t = (float *) tv, *_a = (float *) av, *_b = (float *) bv, *_c = (float *) cv, *_d = (float *) dv; \
+		_t[0] = (_a[0] + _b[0] + _c[0] + _d[0]) * 0.25f; \
+		_t[1] = (_a[1] + _b[1] + _c[1] + _d[1]) * 0.25f; \
+		_t[2] = (_a[2] + _b[2] + _c[2] + _d[2]) * 0.25f; \
 	}
-#define NormZero(av)					{ float *_a = (float*) av; _a[0] = _a[1] = _a[2] = 0.0f; }
-#define NormCopy(av, bv)				{ float *_a = (float*) av, *_b = (float*) bv; _a[0] =_b[0]; _a[1] =_b[1]; _a[2] =_b[2]; }
-#define NormAdd(av, bv)					{ float *_a = (float*) av, *_b = (float*) bv; _a[0]+=_b[0]; _a[1]+=_b[1]; _a[2]+=_b[2]; }
-
-
-static int _edge_isBoundary(const CCGEdge *e);
+#define NormZero(av)     { float *_a = (float *) av; _a[0] = _a[1] = _a[2] = 0.0f; }
+#define NormCopy(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0]  = _b[0]; _a[1]  = _b[1]; _a[2]  = _b[2]; }
+#define NormAdd(av, bv)  { float *_a = (float *) av, *_b = (float *) bv; _a[0] += _b[0]; _a[1] += _b[1]; _a[2] += _b[2]; }
 
 /***/
 
 enum {
-	Vert_eEffected=		(1<<0),
-	Vert_eChanged=		(1<<1),
-	Vert_eSeam=			(1<<2),
+	Vert_eEffected =    (1 << 0),
+	Vert_eChanged =     (1 << 1),
+	Vert_eSeam =        (1 << 2)
 } /*VertFlags*/;
 enum {
-	Edge_eEffected=		(1<<0),
+	Edge_eEffected =    (1 << 0)
 } /*CCGEdgeFlags*/;
 enum {
-	Face_eEffected=		(1<<0),
+	Face_eEffected =    (1 << 0)
 } /*FaceFlags*/;
 
-struct _CCGVert {
-	CCGVert		*next;	/* EHData.next */
-	CCGVertHDL	vHDL;	/* EHData.key */
+struct CCGVert {
+	CCGVert     *next;  /* EHData.next */
+	CCGVertHDL vHDL;    /* EHData.key */
 
 	short numEdges, numFaces, flags, pad;
 
@@ -265,26 +319,34 @@ struct _CCGVert {
 //	byte *levelData;
 //	byte *userData;
 };
-#define VERT_getLevelData(v)		((byte*) &(v)[1])
 
-struct _CCGEdge {
-	CCGEdge		*next;	/* EHData.next */
-	CCGEdgeHDL	eHDL;	/* EHData.key */
+static CCG_INLINE byte *VERT_getLevelData(CCGVert *v)
+{
+	return (byte *)(&(v)[1]);
+}
+
+struct CCGEdge {
+	CCGEdge     *next;  /* EHData.next */
+	CCGEdgeHDL eHDL;    /* EHData.key */
 
 	short numFaces, flags;
 	float crease;
 
-	CCGVert *v0,*v1;
+	CCGVert *v0, *v1;
 	CCGFace **faces;
 
 //	byte *levelData;
 //	byte *userData;
 };
-#define EDGE_getLevelData(e)		((byte*) &(e)[1])
 
-struct _CCGFace {
-	CCGFace		*next;	/* EHData.next */
-	CCGFaceHDL	fHDL;	/* EHData.key */
+static CCG_INLINE byte *EDGE_getLevelData(CCGEdge *e)
+{
+	return (byte *)(&(e)[1]);
+}
+
+struct CCGFace {
+	CCGFace     *next;  /* EHData.next */
+	CCGFaceHDL fHDL;    /* EHData.key */
 
 	short numVerts, flags, pad1, pad2;
 
@@ -294,22 +356,34 @@ struct _CCGFace {
 //	byte **gridData;
 //	byte *userData;
 };
-#define FACE_getVerts(f)		((CCGVert**) &(f)[1])
-#define FACE_getEdges(f)		((CCGEdge**) &(FACE_getVerts(f)[(f)->numVerts]))
-#define FACE_getCenterData(f)	((byte*) &(FACE_getEdges(f)[(f)->numVerts]))
+
+static CCG_INLINE CCGVert **FACE_getVerts(CCGFace *f)
+{
+	return (CCGVert **)(&f[1]);
+}
+
+static CCG_INLINE CCGEdge **FACE_getEdges(CCGFace *f)
+{
+	return (CCGEdge **)(&(FACE_getVerts(f)[f->numVerts]));
+}
+
+static CCG_INLINE byte *FACE_getCenterData(CCGFace *f)
+{
+	return (byte *)(&(FACE_getEdges(f)[(f)->numVerts]));
+}
 
 typedef enum {
 	eSyncState_None = 0,
 	eSyncState_Vert,
 	eSyncState_Edge,
 	eSyncState_Face,
-	eSyncState_Partial,
+	eSyncState_Partial
 } SyncState;
 
-struct _CCGSubSurf {
-	EHash *vMap;	/* map of CCGVertHDL -> Vert */
-	EHash *eMap;	/* map of CCGEdgeHDL -> Edge */
-	EHash *fMap;	/* map of CCGFaceHDL -> Face */
+struct CCGSubSurf {
+	EHash *vMap;    /* map of CCGVertHDL -> Vert */
+	EHash *eMap;    /* map of CCGEdgeHDL -> Edge */
+	EHash *fMap;    /* map of CCGFaceHDL -> Face */
 
 	CCGMeshIFC meshIFC;
 	
@@ -324,18 +398,18 @@ struct _CCGSubSurf {
 
 	void *q, *r;
 		
-		// data for calc vert normals
+	/* data for calc vert normals */
 	int calcVertNormals;
 	int normalDataOffset;
 
-		// data for age'ing (to debug sync)
+	/* data for age'ing (to debug sync) */
 	int currentAge;
 	int useAgeCounts;
 	int vertUserAgeOffset;
 	int edgeUserAgeOffset;
 	int faceUserAgeOffset;
 
-		// data used during syncing
+	/* data used during syncing */
 	SyncState syncState;
 
 	EHash *oldVMap, *oldEMap, *oldFMap;
@@ -344,14 +418,19 @@ struct _CCGSubSurf {
 	CCGEdge **tempEdges;
 };
 
-#define CCGSUBSURF_alloc(ss, nb)			((ss)->allocatorIFC.alloc((ss)->allocator, nb))
-#define CCGSUBSURF_realloc(ss, ptr, nb, ob)	((ss)->allocatorIFC.realloc((ss)->allocator, ptr, nb, ob))
-#define CCGSUBSURF_free(ss, ptr)			((ss)->allocatorIFC.free((ss)->allocator, ptr))
+#define CCGSUBSURF_alloc(ss, nb)            ((ss)->allocatorIFC.alloc((ss)->allocator, nb))
+#define CCGSUBSURF_realloc(ss, ptr, nb, ob) ((ss)->allocatorIFC.realloc((ss)->allocator, ptr, nb, ob))
+#define CCGSUBSURF_free(ss, ptr)            ((ss)->allocatorIFC.free((ss)->allocator, ptr))
 
 /***/
 
-static CCGVert *_vert_new(CCGVertHDL vHDL, CCGSubSurf *ss) {
-	CCGVert *v = CCGSUBSURF_alloc(ss, sizeof(CCGVert) + ss->meshIFC.vertDataSize * (ss->subdivLevels+1) + ss->meshIFC.vertUserSize);
+static CCGVert *_vert_new(CCGVertHDL vHDL, CCGSubSurf *ss)
+{
+	int num_vert_data = ss->subdivLevels + 1;
+	CCGVert *v = CCGSUBSURF_alloc(ss,
+	                              sizeof(CCGVert) +
+	                              ss->meshIFC.vertDataSize * num_vert_data +
+	                              ss->meshIFC.vertUserSize);
 	byte *userData;
 
 	v->vHDL = vHDL;
@@ -362,75 +441,92 @@ static CCGVert *_vert_new(CCGVertHDL vHDL, CCGSubSurf *ss) {
 
 	userData = ccgSubSurf_getVertUserData(ss, v);
 	memset(userData, 0, ss->meshIFC.vertUserSize);
-	if (ss->useAgeCounts) *((int*) &userData[ss->vertUserAgeOffset]) = ss->currentAge;
+	if (ss->useAgeCounts) *((int *) &userData[ss->vertUserAgeOffset]) = ss->currentAge;
 
 	return v;
 }
-static void _vert_remEdge(CCGVert *v, CCGEdge *e) {
+static void _vert_remEdge(CCGVert *v, CCGEdge *e)
+{
 	int i;
-	for (i=0; i<v->numEdges; i++) {
-		if (v->edges[i]==e) {
+	for (i = 0; i < v->numEdges; i++) {
+		if (v->edges[i] == e) {
 			v->edges[i] = v->edges[--v->numEdges];
 			break;
 		}
 	}
 }
-static void _vert_remFace(CCGVert *v, CCGFace *f) {
+static void _vert_remFace(CCGVert *v, CCGFace *f)
+{
 	int i;
-	for (i=0; i<v->numFaces; i++) {
-		if (v->faces[i]==f) {
+	for (i = 0; i < v->numFaces; i++) {
+		if (v->faces[i] == f) {
 			v->faces[i] = v->faces[--v->numFaces];
 			break;
 		}
 	}
 }
-static void _vert_addEdge(CCGVert *v, CCGEdge *e, CCGSubSurf *ss) {
-	v->edges = CCGSUBSURF_realloc(ss, v->edges, (v->numEdges+1)*sizeof(*v->edges), v->numEdges*sizeof(*v->edges));
+static void _vert_addEdge(CCGVert *v, CCGEdge *e, CCGSubSurf *ss)
+{
+	v->edges = CCGSUBSURF_realloc(ss, v->edges, (v->numEdges + 1) * sizeof(*v->edges), v->numEdges * sizeof(*v->edges));
 	v->edges[v->numEdges++] = e;
 }
-static void _vert_addFace(CCGVert *v, CCGFace *f, CCGSubSurf *ss) {
-	v->faces = CCGSUBSURF_realloc(ss, v->faces, (v->numFaces+1)*sizeof(*v->faces), v->numFaces*sizeof(*v->faces));
+static void _vert_addFace(CCGVert *v, CCGFace *f, CCGSubSurf *ss)
+{
+	v->faces = CCGSUBSURF_realloc(ss, v->faces, (v->numFaces + 1) * sizeof(*v->faces), v->numFaces * sizeof(*v->faces));
 	v->faces[v->numFaces++] = f;
 }
-static CCGEdge *_vert_findEdgeTo(const CCGVert *v, const CCGVert *vQ) {
+static CCGEdge *_vert_findEdgeTo(const CCGVert *v, const CCGVert *vQ)
+{
 	int i;
-	for (i=0; i<v->numEdges; i++) {
-		CCGEdge *e = v->edges[v->numEdges-1-i]; // XXX, note reverse
-		if (	(e->v0==v && e->v1==vQ) ||
-				(e->v1==v && e->v0==vQ))
+	for (i = 0; i < v->numEdges; i++) {
+		CCGEdge *e = v->edges[v->numEdges - 1 - i]; // XXX, note reverse
+		if ((e->v0 == v && e->v1 == vQ) ||
+		    (e->v1 == v && e->v0 == vQ))
+		{
 			return e;
+		}
 	}
 	return NULL;
 }
-static int _vert_isBoundary(const CCGVert *v) {
+static int _vert_isBoundary(const CCGVert *v)
+{
 	int i;
-	for (i=0; i<v->numEdges; i++)
+	for (i = 0; i < v->numEdges; i++)
 		if (_edge_isBoundary(v->edges[i]))
 			return 1;
 	return 0;
 }
 
-static void *_vert_getCo(CCGVert *v, int lvl, int dataSize) {
-	return &VERT_getLevelData(v)[lvl*dataSize];
+static void *_vert_getCo(CCGVert *v, int lvl, int dataSize)
+{
+	return &VERT_getLevelData(v)[lvl * dataSize];
 }
-static float *_vert_getNo(CCGVert *v, int lvl, int dataSize, int normalDataOffset) {
-	return (float*) &VERT_getLevelData(v)[lvl*dataSize + normalDataOffset];
+static float *_vert_getNo(CCGVert *v, int lvl, int dataSize, int normalDataOffset)
+{
+	return (float *) &VERT_getLevelData(v)[lvl * dataSize + normalDataOffset];
 }
 
-static void _vert_free(CCGVert *v, CCGSubSurf *ss) {
+static void _vert_free(CCGVert *v, CCGSubSurf *ss)
+{
 	CCGSUBSURF_free(ss, v->edges);
 	CCGSUBSURF_free(ss, v->faces);
 	CCGSUBSURF_free(ss, v);
 }
 
-static int VERT_seam(const CCGVert *v) {
+static int VERT_seam(const CCGVert *v)
+{
 	return ((v->flags & Vert_eSeam) != 0);
 }
 
 /***/
 
-static CCGEdge *_edge_new(CCGEdgeHDL eHDL, CCGVert *v0, CCGVert *v1, float crease, CCGSubSurf *ss) {
-	CCGEdge *e = CCGSUBSURF_alloc(ss, sizeof(CCGEdge) + ss->meshIFC.vertDataSize *((ss->subdivLevels+1) + (1<<(ss->subdivLevels+1))-1) + ss->meshIFC.edgeUserSize);
+static CCGEdge *_edge_new(CCGEdgeHDL eHDL, CCGVert *v0, CCGVert *v1, float crease, CCGSubSurf *ss)
+{
+	int num_edge_data = ccg_edgebase(ss->subdivLevels + 1);
+	CCGEdge *e = CCGSUBSURF_alloc(ss,
+	                              sizeof(CCGEdge) +
+	                              ss->meshIFC.vertDataSize * num_edge_data +
+	                              ss->meshIFC.edgeUserSize);
 	byte *userData;
 
 	e->eHDL = eHDL;
@@ -445,57 +541,68 @@ static CCGEdge *_edge_new(CCGEdgeHDL eHDL, CCGVert *v0, CCGVert *v1, float creas
 
 	userData = ccgSubSurf_getEdgeUserData(ss, e);
 	memset(userData, 0, ss->meshIFC.edgeUserSize);
-	if (ss->useAgeCounts) *((int*) &userData[ss->edgeUserAgeOffset]) = ss->currentAge;
+	if (ss->useAgeCounts) *((int *) &userData[ss->edgeUserAgeOffset]) = ss->currentAge;
 
 	return e;
 }
-static void _edge_remFace(CCGEdge *e, CCGFace *f) {
+static void _edge_remFace(CCGEdge *e, CCGFace *f)
+{
 	int i;
-	for (i=0; i<e->numFaces; i++) {
-		if (e->faces[i]==f) {
+	for (i = 0; i < e->numFaces; i++) {
+		if (e->faces[i] == f) {
 			e->faces[i] = e->faces[--e->numFaces];
 			break;
 		}
 	}
 }
-static void _edge_addFace(CCGEdge *e, CCGFace *f, CCGSubSurf *ss) {
-	e->faces = CCGSUBSURF_realloc(ss, e->faces, (e->numFaces+1)*sizeof(*e->faces), e->numFaces*sizeof(*e->faces));
+static void _edge_addFace(CCGEdge *e, CCGFace *f, CCGSubSurf *ss)
+{
+	e->faces = CCGSUBSURF_realloc(ss, e->faces, (e->numFaces + 1) * sizeof(*e->faces), e->numFaces * sizeof(*e->faces));
 	e->faces[e->numFaces++] = f;
 }
-static int _edge_isBoundary(const CCGEdge *e) {
-	return e->numFaces<2;
+static int _edge_isBoundary(const CCGEdge *e)
+{
+	return e->numFaces < 2;
 }
 
-static CCGVert *_edge_getOtherVert(CCGEdge *e, CCGVert *vQ) {
-	if (vQ==e->v0) {
+static CCGVert *_edge_getOtherVert(CCGEdge *e, CCGVert *vQ)
+{
+	if (vQ == e->v0) {
 		return e->v1;
-	} else {
+	}
+	else {
 		return e->v0;
 	}
 }
 
-static void *_edge_getCo(CCGEdge *e, int lvl, int x, int dataSize) {
-	int levelBase = lvl + (1<<lvl) - 1;
-	return &EDGE_getLevelData(e)[dataSize*(levelBase + x)];
+static void *_edge_getCo(CCGEdge *e, int lvl, int x, int dataSize)
+{
+	int levelBase = ccg_edgebase(lvl);
+	return &EDGE_getLevelData(e)[dataSize * (levelBase + x)];
 }
-static float *_edge_getNo(CCGEdge *e, int lvl, int x, int dataSize, int normalDataOffset) {
-	int levelBase = lvl + (1<<lvl) - 1;
-	return (float*) &EDGE_getLevelData(e)[dataSize*(levelBase + x) + normalDataOffset];
+static float *_edge_getNo(CCGEdge *e, int lvl, int x, int dataSize, int normalDataOffset)
+{
+	int levelBase = ccg_edgebase(lvl);
+	return (float *) &EDGE_getLevelData(e)[dataSize * (levelBase + x) + normalDataOffset];
 }
-static void *_edge_getCoVert(CCGEdge *e, CCGVert *v, int lvl, int x, int dataSize) {
-	int levelBase = lvl + (1<<lvl) - 1;
-	if (v==e->v0) {
-		return &EDGE_getLevelData(e)[dataSize*(levelBase + x)];
-	} else {
-		return &EDGE_getLevelData(e)[dataSize*(levelBase + (1<<lvl) - x)];		
+static void *_edge_getCoVert(CCGEdge *e, CCGVert *v, int lvl, int x, int dataSize)
+{
+	int levelBase = ccg_edgebase(lvl);
+	if (v == e->v0) {
+		return &EDGE_getLevelData(e)[dataSize * (levelBase + x)];
+	}
+	else {
+		return &EDGE_getLevelData(e)[dataSize * (levelBase + (1 << lvl) - x)];
 	}
 }
 
-static void _edge_free(CCGEdge *e, CCGSubSurf *ss) {
+static void _edge_free(CCGEdge *e, CCGSubSurf *ss)
+{
 	CCGSUBSURF_free(ss, e->faces);
 	CCGSUBSURF_free(ss, e);
 }
-static void _edge_unlinkMarkAndFree(CCGEdge *e, CCGSubSurf *ss) {
+static void _edge_unlinkMarkAndFree(CCGEdge *e, CCGSubSurf *ss)
+{
 	_vert_remEdge(e->v0, e);
 	_vert_remEdge(e->v1, e);
 	e->v0->flags |= Vert_eEffected;
@@ -503,7 +610,8 @@ static void _edge_unlinkMarkAndFree(CCGEdge *e, CCGSubSurf *ss) {
 	_edge_free(e, ss);
 }
 
-static float EDGE_getSharpness(CCGEdge *e, int lvl) {
+static float EDGE_getSharpness(CCGEdge *e, int lvl)
+{
 	if (!lvl)
 		return e->crease;
 	else if (!e->crease)
@@ -514,9 +622,17 @@ static float EDGE_getSharpness(CCGEdge *e, int lvl) {
 		return e->crease - lvl;
 }
 
-static CCGFace *_face_new(CCGFaceHDL fHDL, CCGVert **verts, CCGEdge **edges, int numVerts, CCGSubSurf *ss) {
-	int maxGridSize = 1 + (1<<(ss->subdivLevels-1));
-	CCGFace *f = CCGSUBSURF_alloc(ss, sizeof(CCGFace) + sizeof(CCGVert*)*numVerts + sizeof(CCGEdge*)*numVerts + ss->meshIFC.vertDataSize *(1 + numVerts*maxGridSize + numVerts*maxGridSize*maxGridSize) + ss->meshIFC.faceUserSize);
+static CCGFace *_face_new(CCGFaceHDL fHDL, CCGVert **verts, CCGEdge **edges, int numVerts, CCGSubSurf *ss)
+{
+	int maxGridSize = ccg_gridsize(ss->subdivLevels);
+	int num_face_data = (numVerts * maxGridSize +
+	                     numVerts * maxGridSize * maxGridSize + 1);
+	CCGFace *f = CCGSUBSURF_alloc(ss,
+	                              sizeof(CCGFace) +
+	                              sizeof(CCGVert *) * numVerts +
+	                              sizeof(CCGEdge *) * numVerts +
+	                              ss->meshIFC.vertDataSize * num_face_data +
+	                              ss->meshIFC.faceUserSize);
 	byte *userData;
 	int i;
 
@@ -524,7 +640,7 @@ static CCGFace *_face_new(CCGFaceHDL fHDL, CCGVert **verts, CCGEdge **edges, int
 	f->fHDL = fHDL;
 	f->flags = 0;
 
-	for (i=0; i<numVerts; i++) {
+	for (i = 0; i < numVerts; i++) {
 		FACE_getVerts(f)[i] = verts[i];
 		FACE_getEdges(f)[i] = edges[i];
 		_vert_addFace(verts[i], f, ss);
@@ -533,107 +649,126 @@ static CCGFace *_face_new(CCGFaceHDL fHDL, CCGVert **verts, CCGEdge **edges, int
 
 	userData = ccgSubSurf_getFaceUserData(ss, f);
 	memset(userData, 0, ss->meshIFC.faceUserSize);
-	if (ss->useAgeCounts) *((int*) &userData[ss->faceUserAgeOffset]) = ss->currentAge;
+	if (ss->useAgeCounts) *((int *) &userData[ss->faceUserAgeOffset]) = ss->currentAge;
 
 	return f;
 }
 
-static CCG_INLINE void *_face_getIECo(CCGFace *f, int lvl, int S, int x, int levels, int dataSize) {
-	int maxGridSize = 1 + (1<<(levels-1));
-	int spacing = 1<<(levels-lvl);
-	byte *gridBase = FACE_getCenterData(f) + dataSize*(1 + S*(maxGridSize + maxGridSize*maxGridSize));
-	return &gridBase[dataSize*x*spacing];
+static CCG_INLINE void *_face_getIECo(CCGFace *f, int lvl, int S, int x, int levels, int dataSize)
+{
+	int maxGridSize = ccg_gridsize(levels);
+	int spacing = ccg_spacing(levels, lvl);
+	byte *gridBase = FACE_getCenterData(f) + dataSize * (1 + S * (maxGridSize + maxGridSize * maxGridSize));
+	return &gridBase[dataSize * x * spacing];
+}
+static CCG_INLINE void *_face_getIENo(CCGFace *f, int lvl, int S, int x, int levels, int dataSize, int normalDataOffset)
+{
+	int maxGridSize = ccg_gridsize(levels);
+	int spacing = ccg_spacing(levels, lvl);
+	byte *gridBase = FACE_getCenterData(f) + dataSize * (1 + S * (maxGridSize + maxGridSize * maxGridSize));
+	return &gridBase[dataSize * x * spacing + normalDataOffset];
 }
-static CCG_INLINE void *_face_getIENo(CCGFace *f, int lvl, int S, int x, int levels, int dataSize, int normalDataOffset) {
-	int maxGridSize = 1 + (1<<(levels-1));
-	int spacing = 1<<(levels-lvl);
-	byte *gridBase = FACE_getCenterData(f) + dataSize*(1 + S*(maxGridSize + maxGridSize*maxGridSize));
-	return &gridBase[dataSize*x*spacing + normalDataOffset];
+static CCG_INLINE void *_face_getIFCo(CCGFace *f, int lvl, int S, int x, int y, int levels, int dataSize)
+{
+	int maxGridSize = ccg_gridsize(levels);
+	int spacing = ccg_spacing(levels, lvl);
+	byte *gridBase = FACE_getCenterData(f) + dataSize * (1 + S * (maxGridSize + maxGridSize * maxGridSize));
+	return &gridBase[dataSize * (maxGridSize + (y * maxGridSize + x) * spacing)];
 }
-static CCG_INLINE void *_face_getIFCo(CCGFace *f, int lvl, int S, int x, int y, int levels, int dataSize) {
-	int maxGridSize = 1 + (1<<(levels-1));
-	int spacing = 1<<(levels-lvl);
-	byte *gridBase = FACE_getCenterData(f) + dataSize*(1 + S*(maxGridSize + maxGridSize*maxGridSize));
-	return &gridBase[dataSize*(maxGridSize + (y*maxGridSize + x)*spacing)];
+static CCG_INLINE float *_face_getIFNo(CCGFace *f, int lvl, int S, int x, int y, int levels, int dataSize, int normalDataOffset)
+{
+	int maxGridSize = ccg_gridsize(levels);
+	int spacing = ccg_spacing(levels, lvl);
+	byte *gridBase = FACE_getCenterData(f) + dataSize * (1 + S * (maxGridSize + maxGridSize * maxGridSize));
+	return (float *) &gridBase[dataSize * (maxGridSize + (y * maxGridSize + x) * spacing) + normalDataOffset];
 }
-static CCG_INLINE float *_face_getIFNo(CCGFace *f, int lvl, int S, int x, int y, int levels, int dataSize, int normalDataOffset) {
-	int maxGridSize = 1 + (1<<(levels-1));
-	int spacing = 1<<(levels-lvl);
-	byte *gridBase = FACE_getCenterData(f) + dataSize*(1 + S*(maxGridSize + maxGridSize*maxGridSize));
-	return (float*) &gridBase[dataSize*(maxGridSize + (y*maxGridSize + x)*spacing) + normalDataOffset];
+static int _face_getVertIndex(CCGFace *f, CCGVert *v)
+{
+	int i;
+	for (i = 0; i < f->numVerts; i++)
+		if (FACE_getVerts(f)[i] == v)
+			return i;
+	return -1;
 }
-static int _face_getVertIndex(CCGFace *f, CCGVert *v) {
+static int _face_getEdgeIndex(CCGFace *f, CCGEdge *e)
+{
 	int i;
-	for (i=0; i<f->numVerts; i++)
-		if (FACE_getVerts(f)[i]==v)
+	for (i = 0; i < f->numVerts; i++)
+		if (FACE_getEdges(f)[i] == e)
 			return i;
 	return -1;
 }
-static CCG_INLINE void *_face_getIFCoEdge(CCGFace *f, CCGEdge *e, int lvl, int eX, int eY, int levels, int dataSize) {
-	int maxGridSize = 1 + (1<<(levels-1));
-	int spacing = 1<<(levels-lvl);
-	int S, x, y, cx, cy;
+static CCG_INLINE void *_face_getIFCoEdge(CCGFace *f, CCGEdge *e, int f_ed_idx, int lvl, int eX, int eY, int levels, int dataSize)
+{
+	int maxGridSize = ccg_gridsize(levels);
+	int spacing = ccg_spacing(levels, lvl);
+	int x, y, cx, cy;
 
-	for (S=0; S<f->numVerts; S++)
-		if (FACE_getEdges(f)[S]==e)
-			break;
+	BLI_assert(f_ed_idx == _face_getEdgeIndex(f, e));
 
-	eX = eX*spacing;
-	eY = eY*spacing;
-	if (e->v0!=FACE_getVerts(f)[S]) {
-		eX = (maxGridSize*2 - 1)-1 - eX;
+	eX = eX * spacing;
+	eY = eY * spacing;
+	if (e->v0 != FACE_getVerts(f)[f_ed_idx]) {
+		eX = (maxGridSize * 2 - 1) - 1 - eX;
 	}
 	y = maxGridSize - 1 - eX;
 	x = maxGridSize - 1 - eY;
-	if (x<0) {
-		S = (S+f->numVerts-1)%f->numVerts;
+	if (x < 0) {
+		f_ed_idx = (f_ed_idx + f->numVerts - 1) % f->numVerts;
 		cx = y;
 		cy = -x;
-	} else if (y<0) {
-		S = (S+1)%f->numVerts;
+	}
+	else if (y < 0) {
+		f_ed_idx = (f_ed_idx + 1) % f->numVerts;
 		cx = -y;
 		cy = x;
-	} else {
+	}
+	else {
 		cx = x;
 		cy = y;
 	}
-	return _face_getIFCo(f, levels, S, cx, cy, levels, dataSize);
+	return _face_getIFCo(f, levels, f_ed_idx, cx, cy, levels, dataSize);
 }
-static float *_face_getIFNoEdge(CCGFace *f, CCGEdge *e, int lvl, int eX, int eY, int levels, int dataSize, int normalDataOffset) {
-	return (float*) ((byte*) _face_getIFCoEdge(f, e, lvl, eX, eY, levels, dataSize) + normalDataOffset);
+static float *_face_getIFNoEdge(CCGFace *f, CCGEdge *e, int f_ed_idx, int lvl, int eX, int eY, int levels, int dataSize, int normalDataOffset)
+{
+	return (float *) ((byte *) _face_getIFCoEdge(f, e, f_ed_idx, lvl, eX, eY, levels, dataSize) + normalDataOffset);
 }
-static void _face_calcIFNo(CCGFace *f, int lvl, int S, int x, int y, float *no, int levels, int dataSize) {
-	float *a = _face_getIFCo(f, lvl, S, x+0, y+0, levels, dataSize);
-	float *b = _face_getIFCo(f, lvl, S, x+1, y+0, levels, dataSize);
-	float *c = _face_getIFCo(f, lvl, S, x+1, y+1, levels, dataSize);
-	float *d = _face_getIFCo(f, lvl, S, x+0, y+1, levels, dataSize);
-	float a_cX = c[0]-a[0], a_cY = c[1]-a[1], a_cZ = c[2]-a[2];
-	float b_dX = d[0]-b[0], b_dY = d[1]-b[1], b_dZ = d[2]-b[2];
+static void _face_calcIFNo(CCGFace *f, int lvl, int S, int x, int y, float *no, int levels, int dataSize)
+{
+	float *a = _face_getIFCo(f, lvl, S, x + 0, y + 0, levels, dataSize);
+	float *b = _face_getIFCo(f, lvl, S, x + 1, y + 0, levels, dataSize);
+	float *c = _face_getIFCo(f, lvl, S, x + 1, y + 1, levels, dataSize);
+	float *d = _face_getIFCo(f, lvl, S, x + 0, y + 1, levels, dataSize);
+	float a_cX = c[0] - a[0], a_cY = c[1] - a[1], a_cZ = c[2] - a[2];
+	float b_dX = d[0] - b[0], b_dY = d[1] - b[1], b_dZ = d[2] - b[2];
 	float length;
 
-	no[0] = b_dY*a_cZ - b_dZ*a_cY;
-	no[1] = b_dZ*a_cX - b_dX*a_cZ;
-	no[2] = b_dX*a_cY - b_dY*a_cX;
+	no[0] = b_dY * a_cZ - b_dZ * a_cY;
+	no[1] = b_dZ * a_cX - b_dX * a_cZ;
+	no[2] = b_dX * a_cY - b_dY * a_cX;
 
-	length = sqrt(no[0]*no[0] + no[1]*no[1] + no[2]*no[2]);
+	length = sqrtf(no[0] * no[0] + no[1] * no[1] + no[2] * no[2]);
 
-	if (length>EPSILON) {
-		float invLength = 1.f/length;
+	if (length > EPSILON) {
+		float invLength = 1.0f / length;
 
 		no[0] *= invLength;
 		no[1] *= invLength;
 		no[2] *= invLength;
-	} else {
+	}
+	else {
 		NormZero(no);
 	}
 }
 
-static void _face_free(CCGFace *f, CCGSubSurf *ss) {
+static void _face_free(CCGFace *f, CCGSubSurf *ss)
+{
 	CCGSUBSURF_free(ss, f);
 }
-static void _face_unlinkMarkAndFree(CCGFace *f, CCGSubSurf *ss) {
+static void _face_unlinkMarkAndFree(CCGFace *f, CCGSubSurf *ss)
+{
 	int j;
-	for (j=0; j<f->numVerts; j++) {
+	for (j = 0; j < f->numVerts; j++) {
 		_vert_remFace(FACE_getVerts(f)[j], f);
 		_edge_remFace(FACE_getEdges(f)[j], f);
 		FACE_getVerts(f)[j]->flags |= Vert_eEffected;
@@ -643,15 +778,17 @@ static void _face_unlinkMarkAndFree(CCGFace *f, CCGSubSurf *ss) {
 
 /***/
 
-CCGSubSurf *ccgSubSurf_new(CCGMeshIFC *ifc, int subdivLevels, CCGAllocatorIFC *allocatorIFC, CCGAllocatorHDL allocator) {
+CCGSubSurf *ccgSubSurf_new(CCGMeshIFC *ifc, int subdivLevels, CCGAllocatorIFC *allocatorIFC, CCGAllocatorHDL allocator)
+{
 	if (!allocatorIFC) {
 		allocatorIFC = _getStandardAllocatorIFC();
 		allocator = NULL;
 	}
 
-	if (subdivLevels<1) {
+	if (subdivLevels < 1) {
 		return NULL;
-	} else {
+	}
+	else {
 		CCGSubSurf *ss = allocatorIFC->alloc(allocator, sizeof(*ss));
 
 		ss->allocatorIFC = *allocatorIFC;
@@ -691,7 +828,8 @@ CCGSubSurf *ccgSubSurf_new(CCGMeshIFC *ifc, int subdivLevels, CCGAllocatorIFC *a
 	}
 }
 
-void ccgSubSurf_free(CCGSubSurf *ss) {
+void ccgSubSurf_free(CCGSubSurf *ss)
+{
 	CCGAllocatorIFC allocatorIFC = ss->allocatorIFC;
 	CCGAllocatorHDL allocator = ss->allocator;
 
@@ -719,7 +857,8 @@ void ccgSubSurf_free(CCGSubSurf *ss) {
 	}
 }
 
-CCGError ccgSubSurf_setAllowEdgeCreation(CCGSubSurf *ss, int allowEdgeCreation, float defaultCreaseValue, void *defaultUserData) {
+CCGError ccgSubSurf_setAllowEdgeCreation(CCGSubSurf *ss, int allowEdgeCreation, float defaultCreaseValue, void *defaultUserData)
+{
 	if (ss->defaultEdgeUserData) {
 		CCGSUBSURF_free(ss, ss->defaultEdgeUserData);
 	}
@@ -730,13 +869,15 @@ CCGError ccgSubSurf_setAllowEdgeCreation(CCGSubSurf *ss, int allowEdgeCreation,
 
 	if (defaultUserData) {
 		memcpy(ss->defaultEdgeUserData, defaultUserData, ss->meshIFC.edgeUserSize);
-	} else {
+	}
+	else {
 		memset(ss->defaultEdgeUserData, 0, ss->meshIFC.edgeUserSize);
 	}
 
 	return eCCGError_None;
 }
-void ccgSubSurf_getAllowEdgeCreation(CCGSubSurf *ss, int *allowEdgeCreation_r, float *defaultCreaseValue_r, void *defaultUserData_r) {
+void ccgSubSurf_getAllowEdgeCreation(CCGSubSurf *ss, int *allowEdgeCreation_r, float *defaultCreaseValue_r, void *defaultUserData_r)
+{
 	if (allowEdgeCreation_r) *allowEdgeCreation_r = ss->allowEdgeCreation;
 	if (ss->allowEdgeCreation) {
 		if (defaultCreaseValue_r) *defaultCreaseValue_r = ss->defaultCreaseValue;
@@ -744,10 +885,12 @@ void ccgSubSurf_getAllowEdgeCreation(CCGSubSurf *ss, int *allowEdgeCreation_r, f
 	}
 }
 
-CCGError ccgSubSurf_setSubdivisionLevels(CCGSubSurf *ss, int subdivisionLevels) {
-	if (subdivisionLevels<=0) {
+CCGError ccgSubSurf_setSubdivisionLevels(CCGSubSurf *ss, int subdivisionLevels)
+{
+	if (subdivisionLevels <= 0) {
 		return eCCGError_InvalidValue;
-	} else if (subdivisionLevels!=ss->subdivLevels) {
+	}
+	else if (subdivisionLevels != ss->subdivLevels) {
 		ss->numGrids = 0;
 		ss->subdivLevels = subdivisionLevels;
 		_ehash_free(ss->vMap, (EHEntryFreeFP) _vert_free, ss);
@@ -770,19 +913,23 @@ void ccgSubSurf_getUseAgeCounts(CCGSubSurf *ss, int *useAgeCounts_r, int *vertUs
 	if (faceUserOffset_r) *faceUserOffset_r = ss->faceUserAgeOffset;
 }
 
-CCGError ccgSubSurf_setUseAgeCounts(CCGSubSurf *ss, int useAgeCounts, int vertUserOffset, int edgeUserOffset, int faceUserOffset) {
+CCGError ccgSubSurf_setUseAgeCounts(CCGSubSurf *ss, int useAgeCounts, int vertUserOffset, int edgeUserOffset, int faceUserOffset)
+{
 	if (useAgeCounts) {
-		if (	(vertUserOffset+4>ss->meshIFC.vertUserSize) ||
-				(edgeUserOffset+4>ss->meshIFC.edgeUserSize) ||
-				(faceUserOffset+4>ss->meshIFC.faceUserSize)) {
+		if ((vertUserOffset + 4 > ss->meshIFC.vertUserSize) ||
+		    (edgeUserOffset + 4 > ss->meshIFC.edgeUserSize) ||
+		    (faceUserOffset + 4 > ss->meshIFC.faceUserSize))
+		{
 			return eCCGError_InvalidValue;
-		}  else {
+		}
+		else {
 			ss->useAgeCounts = 1;
 			ss->vertUserAgeOffset = vertUserOffset;
 			ss->edgeUserAgeOffset = edgeUserOffset;
 			ss->faceUserAgeOffset = faceUserOffset;
 		}
-	} else {
+	}
+	else {
 		ss->useAgeCounts = 0;
 		ss->vertUserAgeOffset = ss->edgeUserAgeOffset = ss->faceUserAgeOffset = 0;
 	}
@@ -790,15 +937,18 @@ CCGError ccgSubSurf_setUseAgeCounts(CCGSubSurf *ss, int useAgeCounts, int vertUs
 	return eCCGError_None;
 }
 
-CCGError ccgSubSurf_setCalcVertexNormals(CCGSubSurf *ss, int useVertNormals, int normalDataOffset) {
+CCGError ccgSubSurf_setCalcVertexNormals(CCGSubSurf *ss, int useVertNormals, int normalDataOffset)
+{
 	if (useVertNormals) {
-		if (normalDataOffset<0 || normalDataOffset+12>ss->meshIFC.vertDataSize) {
+		if (normalDataOffset < 0 || normalDataOffset + 12 > ss->meshIFC.vertDataSize) {
 			return eCCGError_InvalidValue;
-		} else {
+		}
+		else {
 			ss->calcVertNormals = 1;
 			ss->normalDataOffset = normalDataOffset;
 		}
-	} else {
+	}
+	else {
 		ss->calcVertNormals = 0;
 		ss->normalDataOffset = 0;
 	}
@@ -808,8 +958,9 @@ CCGError ccgSubSurf_setCalcVertexNormals(CCGSubSurf *ss, int useVertNormals, int
 
 /***/
 
-CCGError ccgSubSurf_initFullSync(CCGSubSurf *ss) {
-	if (ss->syncState!=eSyncState_None) {
+CCGError ccgSubSurf_initFullSync(CCGSubSurf *ss)
+{
+	if (ss->syncState != eSyncState_None) {
 		return eCCGError_InvalidSyncState;
 	}
 
@@ -826,16 +977,17 @@ CCGError ccgSubSurf_initFullSync(CCGSubSurf *ss) {
 	ss->numGrids = 0;
 
 	ss->lenTempArrays = 12;
-	ss->tempVerts = MEM_mallocN(sizeof(*ss->tempVerts)*ss->lenTempArrays, "CCGSubsurf tempVerts");
-	ss->tempEdges = MEM_mallocN(sizeof(*ss->tempEdges)*ss->lenTempArrays, "CCGSubsurf tempEdges");
+	ss->tempVerts = MEM_mallocN(sizeof(*ss->tempVerts) * ss->lenTempArrays, "CCGSubsurf tempVerts");
+	ss->tempEdges = MEM_mallocN(sizeof(*ss->tempEdges) * ss->lenTempArrays, "CCGSubsurf tempEdges");
 
 	ss->syncState = eSyncState_Vert;
 
 	return eCCGError_None;
 }
 
-CCGError ccgSubSurf_initPartialSync(CCGSubSurf *ss) {
-	if (ss->syncState!=eSyncState_None) {
+CCGError ccgSubSurf_initPartialSync(CCGSubSurf *ss)
+{
+	if (ss->syncState != eSyncState_None) {
 		return eCCGError_InvalidSyncState;
 	}
 
@@ -846,16 +998,19 @@ CCGError ccgSubSurf_initPartialSync(CCGSubSurf *ss) {
 	return eCCGError_None;
 }
 
-CCGError ccgSubSurf_syncVertDel(CCGSubSurf *ss, CCGVertHDL vHDL) {
-	if (ss->syncState!=eSyncState_Partial) {
+CCGError ccgSubSurf_syncVertDel(CCGSubSurf *ss, CCGVertHDL vHDL)
+{
+	if (ss->syncState != eSyncState_Partial) {
 		return eCCGError_InvalidSyncState;
-	} else {
+	}
+	else {
 		void **prevp;
 		CCGVert *v = _ehash_lookupWithPrev(ss->vMap, vHDL, &prevp);
 
 		if (!v || v->numFaces || v->numEdges) {
 			return eCCGError_InvalidValue;
-		} else {
+		}
+		else {
 			*prevp = v->next;
 			_vert_free(v, ss);
 		}
@@ -864,16 +1019,19 @@ CCGError ccgSubSurf_syncVertDel(CCGSubSurf *ss, CCGVertHDL vHDL) {
 	return eCCGError_None;
 }
 
-CCGError ccgSubSurf_syncEdgeDel(CCGSubSurf *ss, CCGEdgeHDL eHDL) {
-	if (ss->syncState!=eSyncState_Partial) {
+CCGError ccgSubSurf_syncEdgeDel(CCGSubSurf *ss, CCGEdgeHDL eHDL)
+{
+	if (ss->syncState != eSyncState_Partial) {
 		return eCCGError_InvalidSyncState;
-	} else {
+	}
+	else {
 		void **prevp;
 		CCGEdge *e = _ehash_lookupWithPrev(ss->eMap, eHDL, &prevp);
 
 		if (!e || e->numFaces) {
 			return eCCGError_InvalidValue;
-		} else {
+		}
+		else {
 			*prevp = e->next;
 			_edge_unlinkMarkAndFree(e, ss);
 		}
@@ -882,16 +1040,19 @@ CCGError ccgSubSurf_syncEdgeDel(CCGSubSurf *ss, CCGEdgeHDL eHDL) {
 	return eCCGError_None;
 }
 
-CCGError ccgSubSurf_syncFaceDel(CCGSubSurf *ss, CCGFaceHDL fHDL) {
-	if (ss->syncState!=eSyncState_Partial) {
+CCGError ccgSubSurf_syncFaceDel(CCGSubSurf *ss, CCGFaceHDL fHDL)
+{
+	if (ss->syncState != eSyncState_Partial) {
 		return eCCGError_InvalidSyncState;
-	} else {
+	}
+	else {
 		void **prevp;
 		CCGFace *f = _ehash_lookupWithPrev(ss->fMap, fHDL, &prevp);
 
 		if (!f) {
 			return eCCGError_InvalidValue;
-		} else {
+		}
+		else {
 			*prevp = f->next;
 			_face_unlinkMarkAndFree(f, ss);
 		}
@@ -900,55 +1061,60 @@ CCGError ccgSubSurf_syncFaceDel(CCGSubSurf *ss, CCGFaceHDL fHDL) {
 	return eCCGError_None;
 }
 
-CCGError ccgSubSurf_syncVert(CCGSubSurf *ss, CCGVertHDL vHDL, const void *vertData, int seam, CCGVert **v_r) {
+CCGError ccgSubSurf_syncVert(CCGSubSurf *ss, CCGVertHDL vHDL, const void *vertData, int seam, CCGVert **v_r)
+{
 	void **prevp;
 	CCGVert *v = NULL;
-	short seamflag = (seam)? Vert_eSeam: 0;
+	short seamflag = (seam) ? Vert_eSeam : 0;
 	
-	if (ss->syncState==eSyncState_Partial) {
+	if (ss->syncState == eSyncState_Partial) {
 		v = _ehash_lookupWithPrev(ss->vMap, vHDL, &prevp);
 		if (!v) {
 			v = _vert_new(vHDL, ss);
-			VertDataCopy(_vert_getCo(v,0,ss->meshIFC.vertDataSize), vertData);
-			_ehash_insert(ss->vMap, (EHEntry*) v);
-			v->flags = Vert_eEffected|seamflag;
-		} else if (!VertDataEqual(vertData, _vert_getCo(v, 0, ss->meshIFC.vertDataSize)) || ((v->flags & Vert_eSeam) != seamflag)) {
+			VertDataCopy(_vert_getCo(v, 0, ss->meshIFC.vertDataSize), vertData);
+			_ehash_insert(ss->vMap, (EHEntry *) v);
+			v->flags = Vert_eEffected | seamflag;
+		}
+		else if (!VertDataEqual(vertData, _vert_getCo(v, 0, ss->meshIFC.vertDataSize)) || ((v->flags & Vert_eSeam) != seamflag)) {
 			int i, j;
 
-			VertDataCopy(_vert_getCo(v,0,ss->meshIFC.vertDataSize), vertData);
-			v->flags = Vert_eEffected|seamflag;
+			VertDataCopy(_vert_getCo(v, 0, ss->meshIFC.vertDataSize), vertData);
+			v->flags = Vert_eEffected | seamflag;
 
-			for (i=0; i<v->numEdges; i++) {
+			for (i = 0; i < v->numEdges; i++) {
 				CCGEdge *e = v->edges[i];
 				e->v0->flags |= Vert_eEffected;
 				e->v1->flags |= Vert_eEffected;
 			}
-			for (i=0; i<v->numFaces; i++) {
+			for (i = 0; i < v->numFaces; i++) {
 				CCGFace *f = v->faces[i];
-				for (j=0; j<f->numVerts; j++) {
+				for (j = 0; j < f->numVerts; j++) {
 					FACE_getVerts(f)[j]->flags |= Vert_eEffected;
 				}
 			}
 		}
-	} else {
-		if (ss->syncState!=eSyncState_Vert) { 
+	}
+	else {
+		if (ss->syncState != eSyncState_Vert) {
 			return eCCGError_InvalidSyncState;
 		}
 
 		v = _ehash_lookupWithPrev(ss->oldVMap, vHDL, &prevp);
 		if (!v) {
 			v = _vert_new(vHDL, ss);
-			VertDataCopy(_vert_getCo(v,0,ss->meshIFC.vertDataSize), vertData);
-			_ehash_insert(ss->vMap, (EHEntry*) v);
-			v->flags = Vert_eEffected|seamflag;
-		} else if (!VertDataEqual(vertData, _vert_getCo(v, 0, ss->meshIFC.vertDataSize)) || ((v->flags & Vert_eSeam) != seamflag)) {
+			VertDataCopy(_vert_getCo(v, 0, ss->meshIFC.vertDataSize), vertData);
+			_ehash_insert(ss->vMap, (EHEntry *) v);
+			v->flags = Vert_eEffected | seamflag;
+		}
+		else if (!VertDataEqual(vertData, _vert_getCo(v, 0, ss->meshIFC.vertDataSize)) || ((v->flags & Vert_eSeam) != seamflag)) {
 			*prevp = v->next;
-			_ehash_insert(ss->vMap, (EHEntry*) v);
-			VertDataCopy(_vert_getCo(v,0,ss->meshIFC.vertDataSize), vertData);
-			v->flags = Vert_eEffected|Vert_eChanged|seamflag;
-		} else {
+			_ehash_insert(ss->vMap, (EHEntry *) v);
+			VertDataCopy(_vert_getCo(v, 0, ss->meshIFC.vertDataSize), vertData);
+			v->flags = Vert_eEffected | Vert_eChanged | seamflag;
+		}
+		else {
 			*prevp = v->next;
-			_ehash_insert(ss->vMap, (EHEntry*) v);
+			_ehash_insert(ss->vMap, (EHEntry *) v);
 			v->flags = 0;
 		}
 	}
@@ -957,13 +1123,14 @@ CCGError ccgSubSurf_syncVert(CCGSubSurf *ss, CCGVertHDL vHDL, const void *vertDa
 	return eCCGError_None;
 }
 
-CCGError ccgSubSurf_syncEdge(CCGSubSurf *ss, CCGEdgeHDL eHDL, CCGVertHDL e_vHDL0, CCGVertHDL e_vHDL1, float crease, CCGEdge **e_r) {
+CCGError ccgSubSurf_syncEdge(CCGSubSurf *ss, CCGEdgeHDL eHDL, CCGVertHDL e_vHDL0, CCGVertHDL e_vHDL1, float crease, CCGEdge **e_r)
+{
 	void **prevp;
 	CCGEdge *e = NULL, *eNew;
 
-	if (ss->syncState==eSyncState_Partial) {
+	if (ss->syncState == eSyncState_Partial) {
 		e = _ehash_lookupWithPrev(ss->eMap, eHDL, &prevp);
-		if (!e || e->v0->vHDL!=e_vHDL0 || e->v1->vHDL!=e_vHDL1 || crease!=e->crease) {
+		if (!e || e->v0->vHDL != e_vHDL0 || e->v1->vHDL != e_vHDL1 || crease != e->crease) {
 			CCGVert *v0 = _ehash_lookup(ss->vMap, e_vHDL0);
 			CCGVert *v1 = _ehash_lookup(ss->vMap, e_vHDL1);
 
@@ -974,33 +1141,37 @@ CCGError ccgSubSurf_syncEdge(CCGSubSurf *ss, CCGEdgeHDL eHDL, CCGVertHDL e_vHDL0
 				eNew->next = e->next;
 
 				_edge_unlinkMarkAndFree(e, ss);
-			} else {
-				_ehash_insert(ss->eMap, (EHEntry*) eNew);
+			}
+			else {
+				_ehash_insert(ss->eMap, (EHEntry *) eNew);
 			}
 
 			eNew->v0->flags |= Vert_eEffected;
 			eNew->v1->flags |= Vert_eEffected;
 		}
-	} else {
-		if (ss->syncState==eSyncState_Vert) {
+	}
+	else {
+		if (ss->syncState == eSyncState_Vert) {
 			ss->syncState = eSyncState_Edge;
-		} else if (ss->syncState!=eSyncState_Edge) {
+		}
+		else if (ss->syncState != eSyncState_Edge) {
 			return eCCGError_InvalidSyncState;
 		}
 
 		e = _ehash_lookupWithPrev(ss->oldEMap, eHDL, &prevp);
-		if (!e || e->v0->vHDL!=e_vHDL0 || e->v1->vHDL!=e_vHDL1|| e->crease!=crease) {
+		if (!e || e->v0->vHDL != e_vHDL0 || e->v1->vHDL != e_vHDL1 || e->crease != crease) {
 			CCGVert *v0 = _ehash_lookup(ss->vMap, e_vHDL0);
 			CCGVert *v1 = _ehash_lookup(ss->vMap, e_vHDL1);
 			e = _edge_new(eHDL, v0, v1, crease, ss);
-			_ehash_insert(ss->eMap, (EHEntry*) e);
+			_ehash_insert(ss->eMap, (EHEntry *) e);
 			e->v0->flags |= Vert_eEffected;
 			e->v1->flags |= Vert_eEffected;
-		} else {
+		}
+		else {
 			*prevp = e->next;
-			_ehash_insert(ss->eMap, (EHEntry*) e);
+			_ehash_insert(ss->eMap, (EHEntry *) e);
 			e->flags = 0;
-			if ((e->v0->flags|e->v1->flags)&Vert_eChanged) {
+			if ((e->v0->flags | e->v1->flags) & Vert_eChanged) {
 				e->v0->flags |= Vert_eEffected;
 				e->v1->flags |= Vert_eEffected;
 			}
@@ -1011,32 +1182,35 @@ CCGError ccgSubSurf_syncEdge(CCGSubSurf *ss, CCGEdgeHDL eHDL, CCGVertHDL e_vHDL0
 	return eCCGError_None;
 }
 
-CCGError ccgSubSurf_syncFace(CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGVertHDL *vHDLs, CCGFace **f_r) {
+CCGError ccgSubSurf_syncFace(CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGVertHDL *vHDLs, CCGFace **f_r)
+{
 	void **prevp;
 	CCGFace *f = NULL, *fNew;
 	int j, k, topologyChanged = 0;
 
-	if (numVerts>ss->lenTempArrays) {
-		ss->lenTempArrays = (numVerts<ss->lenTempArrays*2)?ss->lenTempArrays*2:numVerts;
-		ss->tempVerts = MEM_reallocN(ss->tempVerts, sizeof(*ss->tempVerts)*ss->lenTempArrays);
-		ss->tempEdges = MEM_reallocN(ss->tempEdges, sizeof(*ss->tempEdges)*ss->lenTempArrays);
+	if (numVerts > ss->lenTempArrays) {
+		ss->lenTempArrays = (numVerts < ss->lenTempArrays * 2) ? ss->lenTempArrays * 2 : numVerts;
+		ss->tempVerts = MEM_reallocN(ss->tempVerts, sizeof(*ss->tempVerts) * ss->lenTempArrays);
+		ss->tempEdges = MEM_reallocN(ss->tempEdges, sizeof(*ss->tempEdges) * ss->lenTempArrays);
 	}
 
-	if (ss->syncState==eSyncState_Partial) {
+	if (ss->syncState == eSyncState_Partial) {
 		f = _ehash_lookupWithPrev(ss->fMap, fHDL, &prevp);
 
-		for (k=0; k<numVerts; k++) {
+		for (k = 0; k < numVerts; k++) {
 			ss->tempVerts[k] = _ehash_lookup(ss->vMap, vHDLs[k]);
 		}
-		for (k=0; k<numVerts; k++) {
-			ss->tempEdges[k] = _vert_findEdgeTo(ss->tempVerts[k], ss->tempVerts[(k+1)%numVerts]);
+		for (k = 0; k < numVerts; k++) {
+			ss->tempEdges[k] = _vert_findEdgeTo(ss->tempVerts[k], ss->tempVerts[(k + 1) % numVerts]);
 		}
 
 		if (f) {
-			if (	f->numVerts!=numVerts ||
-					memcmp(FACE_getVerts(f), ss->tempVerts, sizeof(*ss->tempVerts)*numVerts) ||
-					memcmp(FACE_getEdges(f), ss->tempEdges, sizeof(*ss->tempEdges)*numVerts))
+			if (f->numVerts != numVerts ||
+			    memcmp(FACE_getVerts(f), ss->tempVerts, sizeof(*ss->tempVerts) * numVerts) ||
+			    memcmp(FACE_getEdges(f), ss->tempEdges, sizeof(*ss->tempEdges) * numVerts))
+			{
 				topologyChanged = 1;
+			}
 		}
 
 		if (!f || topologyChanged) {
@@ -1049,70 +1223,75 @@ CCGError ccgSubSurf_syncFace(CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGV
 				fNew->next = f->next;
 
 				_face_unlinkMarkAndFree(f, ss);
-			} else {
+			}
+			else {
 				ss->numGrids += numVerts;
-				_ehash_insert(ss->fMap, (EHEntry*) fNew);
+				_ehash_insert(ss->fMap, (EHEntry *) fNew);
 			}
 
-			for (k=0; k<numVerts; k++)
+			for (k = 0; k < numVerts; k++)
 				FACE_getVerts(fNew)[k]->flags |= Vert_eEffected;
 		}
-	} else {
-		if (ss->syncState==eSyncState_Vert || ss->syncState==eSyncState_Edge) {
+	}
+	else {
+		if (ss->syncState == eSyncState_Vert || ss->syncState == eSyncState_Edge) {
 			ss->syncState = eSyncState_Face;
-		} else if (ss->syncState!=eSyncState_Face) {
+		}
+		else if (ss->syncState != eSyncState_Face) {
 			return eCCGError_InvalidSyncState;
 		}
 
 		f = _ehash_lookupWithPrev(ss->oldFMap, fHDL, &prevp);
 
-		for (k=0; k<numVerts; k++) {
+		for (k = 0; k < numVerts; k++) {
 			ss->tempVerts[k] = _ehash_lookup(ss->vMap, vHDLs[k]);
 
 			if (!ss->tempVerts[k])
 				return eCCGError_InvalidValue;
 		}
-		for (k=0; k<numVerts; k++) {
-			ss->tempEdges[k] = _vert_findEdgeTo(ss->tempVerts[k], ss->tempVerts[(k+1)%numVerts]);
+		for (k = 0; k < numVerts; k++) {
+			ss->tempEdges[k] = _vert_findEdgeTo(ss->tempVerts[k], ss->tempVerts[(k + 1) % numVerts]);
 
 			if (!ss->tempEdges[k]) {
 				if (ss->allowEdgeCreation) {
-					CCGEdge *e = ss->tempEdges[k] = _edge_new((CCGEdgeHDL) -1, ss->tempVerts[k], ss->tempVerts[(k+1)%numVerts], ss->defaultCreaseValue, ss);
-					_ehash_insert(ss->eMap, (EHEntry*) e);
+					CCGEdge *e = ss->tempEdges[k] = _edge_new((CCGEdgeHDL) - 1, ss->tempVerts[k], ss->tempVerts[(k + 1) % numVerts], ss->defaultCreaseValue, ss);
+					_ehash_insert(ss->eMap, (EHEntry *) e);
 					e->v0->flags |= Vert_eEffected;
 					e->v1->flags |= Vert_eEffected;
 					if (ss->meshIFC.edgeUserSize) {
 						memcpy(ccgSubSurf_getEdgeUserData(ss, e), ss->defaultEdgeUserData, ss->meshIFC.edgeUserSize);
 					}
-				} else {
+				}
+				else {
 					return eCCGError_InvalidValue;
 				}
 			}
 		}
 
 		if (f) {
-			if (	f->numVerts!=numVerts ||
-					memcmp(FACE_getVerts(f), ss->tempVerts, sizeof(*ss->tempVerts)*numVerts) ||
-					memcmp(FACE_getEdges(f), ss->tempEdges, sizeof(*ss->tempEdges)*numVerts))
+			if (f->numVerts != numVerts ||
+			    memcmp(FACE_getVerts(f), ss->tempVerts, sizeof(*ss->tempVerts) * numVerts) ||
+			    memcmp(FACE_getEdges(f), ss->tempEdges, sizeof(*ss->tempEdges) * numVerts))
 				topologyChanged = 1;
 		}
 
 		if (!f || topologyChanged) {
 			f = _face_new(fHDL, ss->tempVerts, ss->tempEdges, numVerts, ss);
-			_ehash_insert(ss->fMap, (EHEntry*) f);
+			_ehash_insert(ss->fMap, (EHEntry *) f);
 			ss->numGrids += numVerts;
 
-			for (k=0; k<numVerts; k++)
+			for (k = 0; k < numVerts; k++)
 				FACE_getVerts(f)[k]->flags |= Vert_eEffected;
-		} else {
+		}
+		else {
 			*prevp = f->next;
-			_ehash_insert(ss->fMap, (EHEntry*) f);
+			_ehash_insert(ss->fMap, (EHEntry *) f);
 			f->flags = 0;
 			ss->numGrids += f->numVerts;
 
-			for (j=0; j<f->numVerts; j++) {
-				if (FACE_getVerts(f)[j]->flags&Vert_eChanged) {
-					for (k=0; k<f->numVerts; k++)
+			for (j = 0; j < f->numVerts; j++) {
+				if (FACE_getVerts(f)[j]->flags & Vert_eChanged) {
+					for (k = 0; k < f->numVerts; k++)
 						FACE_getVerts(f)[k]->flags |= Vert_eEffected;
 					break;
 				}
@@ -1124,13 +1303,14 @@ CCGError ccgSubSurf_syncFace(CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGV
 	return eCCGError_None;
 }
 
-static void ccgSubSurf__sync(CCGSubSurf *ss);
-CCGError ccgSubSurf_processSync(CCGSubSurf *ss) {
-	if (ss->syncState==eSyncState_Partial) {
+CCGError ccgSubSurf_processSync(CCGSubSurf *ss)
+{
+	if (ss->syncState == eSyncState_Partial) {
 		ss->syncState = eSyncState_None;
 
 		ccgSubSurf__sync(ss);
-	} else if (ss->syncState) {
+	}
+	else if (ss->syncState) {
 		_ehash_free(ss->oldFMap, (EHEntryFreeFP) _face_unlinkMarkAndFree, ss);
 		_ehash_free(ss->oldEMap, (EHEntryFreeFP) _edge_unlinkMarkAndFree, ss);
 		_ehash_free(ss->oldVMap, (EHEntryFreeFP) _vert_free, ss);
@@ -1146,201 +1326,213 @@ CCGError ccgSubSurf_processSync(CCGSubSurf *ss) {
 		ss->syncState = eSyncState_None;
 
 		ccgSubSurf__sync(ss);
-	} else {
+	}
+	else {
 		return eCCGError_InvalidSyncState;
 	}
 
 	return eCCGError_None;
 }
 
-#define VERT_getNo(e, lvl)					_vert_getNo(e, lvl, vertDataSize, normalDataOffset)
-#define EDGE_getNo(e, lvl, x)				_edge_getNo(e, lvl, x, vertDataSize, normalDataOffset)
-#define FACE_getIFNo(f, lvl, S, x, y)		_face_getIFNo(f, lvl, S, x, y, subdivLevels, vertDataSize, normalDataOffset)
-#define FACE_calcIFNo(f, lvl, S, x, y, no)	_face_calcIFNo(f, lvl, S, x, y, no, subdivLevels, vertDataSize)
-#define FACE_getIENo(f, lvl, S, x)			_face_getIENo(f, lvl, S, x, subdivLevels, vertDataSize, normalDataOffset)
+#define VERT_getNo(e, lvl)                  _vert_getNo(e, lvl, vertDataSize, normalDataOffset)
+#define EDGE_getNo(e, lvl, x)               _edge_getNo(e, lvl, x, vertDataSize, normalDataOffset)
+#define FACE_getIFNo(f, lvl, S, x, y)       _face_getIFNo(f, lvl, S, x, y, subdivLevels, vertDataSize, normalDataOffset)
+#define FACE_calcIFNo(f, lvl, S, x, y, no)  _face_calcIFNo(f, lvl, S, x, y, no, subdivLevels, vertDataSize)
+#define FACE_getIENo(f, lvl, S, x)          _face_getIENo(f, lvl, S, x, subdivLevels, vertDataSize, normalDataOffset)
+
 static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
-	CCGVert **effectedV, CCGEdge **effectedE, CCGFace **effectedF,
-	int numEffectedV, int numEffectedE, int numEffectedF) {
-	int i,ptrIdx;
+                                        CCGVert **effectedV, CCGEdge **effectedE, CCGFace **effectedF,
+                                        int numEffectedV, int numEffectedE, int numEffectedF)
+{
+	int i, ptrIdx;
 	int subdivLevels = ss->subdivLevels;
 	int lvl = ss->subdivLevels;
-	int edgeSize = 1 + (1<<lvl);
-	int gridSize = 1 + (1<<(lvl-1));
+	int edgeSize = ccg_edgesize(lvl);
+	int gridSize = ccg_gridsize(lvl);
 	int normalDataOffset = ss->normalDataOffset;
 	int vertDataSize = ss->meshIFC.vertDataSize;
 
-	#pragma omp parallel for private(ptrIdx) if(numEffectedF*edgeSize*edgeSize*4 >= CCG_OMP_LIMIT)
-	for (ptrIdx=0; ptrIdx<numEffectedF; ptrIdx++) {
-		CCGFace *f = (CCGFace*) effectedF[ptrIdx];
+	#pragma omp parallel for private(ptrIdx) if (numEffectedF * edgeSize * edgeSize * 4 >= CCG_OMP_LIMIT)
+	for (ptrIdx = 0; ptrIdx < numEffectedF; ptrIdx++) {
+		CCGFace *f = (CCGFace *) effectedF[ptrIdx];
 		int S, x, y;
 		float no[3];
 
-		for (S=0; S<f->numVerts; S++) {
-			for (y=0; y<gridSize-1; y++)
-				for (x=0; x<gridSize-1; x++)
+		for (S = 0; S < f->numVerts; S++) {
+			for (y = 0; y < gridSize - 1; y++)
+				for (x = 0; x < gridSize - 1; x++)
 					NormZero(FACE_getIFNo(f, lvl, S, x, y));
 
-			if (FACE_getEdges(f)[(S-1+f->numVerts)%f->numVerts]->flags&Edge_eEffected)
-				for (x=0; x<gridSize-1; x++)
-					NormZero(FACE_getIFNo(f, lvl, S, x, gridSize-1));
-			if (FACE_getEdges(f)[S]->flags&Edge_eEffected)
-				for (y=0; y<gridSize-1; y++)
-					NormZero(FACE_getIFNo(f, lvl, S, gridSize-1, y));
-			if (FACE_getVerts(f)[S]->flags&Vert_eEffected)
-				NormZero(FACE_getIFNo(f, lvl, S, gridSize-1, gridSize-1));
+			if (FACE_getEdges(f)[(S - 1 + f->numVerts) % f->numVerts]->flags & Edge_eEffected)
+				for (x = 0; x < gridSize - 1; x++)
+					NormZero(FACE_getIFNo(f, lvl, S, x, gridSize - 1));
+			if (FACE_getEdges(f)[S]->flags & Edge_eEffected)
+				for (y = 0; y < gridSize - 1; y++)
+					NormZero(FACE_getIFNo(f, lvl, S, gridSize - 1, y));
+			if (FACE_getVerts(f)[S]->flags & Vert_eEffected)
+				NormZero(FACE_getIFNo(f, lvl, S, gridSize - 1, gridSize - 1));
 		}
 
-		for (S=0; S<f->numVerts; S++) {
-			int yLimit = !(FACE_getEdges(f)[(S-1+f->numVerts)%f->numVerts]->flags&Edge_eEffected);
-			int xLimit = !(FACE_getEdges(f)[S]->flags&Edge_eEffected);
+		for (S = 0; S < f->numVerts; S++) {
+			int yLimit = !(FACE_getEdges(f)[(S - 1 + f->numVerts) % f->numVerts]->flags & Edge_eEffected);
+			int xLimit = !(FACE_getEdges(f)[S]->flags & Edge_eEffected);
 			int yLimitNext = xLimit;
 			int xLimitPrev = yLimit;
 			
-			for (y=0; y<gridSize - 1; y++) {
-				for (x=0; x<gridSize - 1; x++) {
-					int xPlusOk = (!xLimit || x<gridSize-2);
-					int yPlusOk = (!yLimit || y<gridSize-2);
+			for (y = 0; y < gridSize - 1; y++) {
+				for (x = 0; x < gridSize - 1; x++) {
+					int xPlusOk = (!xLimit || x < gridSize - 2);
+					int yPlusOk = (!yLimit || y < gridSize - 2);
 
 					FACE_calcIFNo(f, lvl, S, x, y, no);
 
-					NormAdd(FACE_getIFNo(f, lvl, S, x+0, y+0), no);
+					NormAdd(FACE_getIFNo(f, lvl, S, x + 0, y + 0), no);
 					if (xPlusOk)
-						NormAdd(FACE_getIFNo(f, lvl, S, x+1, y+0), no);
+						NormAdd(FACE_getIFNo(f, lvl, S, x + 1, y + 0), no);
 					if (yPlusOk)
-						NormAdd(FACE_getIFNo(f, lvl, S, x+0, y+1), no);
+						NormAdd(FACE_getIFNo(f, lvl, S, x + 0, y + 1), no);
 					if (xPlusOk && yPlusOk) {
-						if (x<gridSize-2 || y<gridSize-2 || FACE_getVerts(f)[S]->flags&Vert_eEffected) {
-							NormAdd(FACE_getIFNo(f, lvl, S, x+1, y+1), no);
+						if (x < gridSize - 2 || y < gridSize - 2 || FACE_getVerts(f)[S]->flags & Vert_eEffected) {
+							NormAdd(FACE_getIFNo(f, lvl, S, x + 1, y + 1), no);
 						}
 					}
 
-					if (x==0 && y==0) {
+					if (x == 0 && y == 0) {
 						int K;
 
-						if (!yLimitNext || 1<gridSize-1)
-							NormAdd(FACE_getIFNo(f, lvl, (S+1)%f->numVerts, 0, 1), no);
-						if (!xLimitPrev || 1<gridSize-1)
-							NormAdd(FACE_getIFNo(f, lvl, (S-1+f->numVerts)%f->numVerts, 1, 0), no);
+						if (!yLimitNext || 1 < gridSize - 1)
+							NormAdd(FACE_getIFNo(f, lvl, (S + 1) % f->numVerts, 0, 1), no);
+						if (!xLimitPrev || 1 < gridSize - 1)
+							NormAdd(FACE_getIFNo(f, lvl, (S - 1 + f->numVerts) % f->numVerts, 1, 0), no);
 
-						for (K=0; K<f->numVerts; K++) {
-							if (K!=S) {
+						for (K = 0; K < f->numVerts; K++) {
+							if (K != S) {
 								NormAdd(FACE_getIFNo(f, lvl, K, 0, 0), no);
 							}
 						}
-					} else if (y==0) {
-						NormAdd(FACE_getIFNo(f, lvl, (S+1)%f->numVerts, 0, x), no);
-						if (!yLimitNext || x<gridSize-2)
-							NormAdd(FACE_getIFNo(f, lvl, (S+1)%f->numVerts, 0, x+1), no);
-					} else if (x==0) {
-						NormAdd(FACE_getIFNo(f, lvl, (S-1+f->numVerts)%f->numVerts, y, 0), no);
-						if (!xLimitPrev || y<gridSize-2)
-							NormAdd(FACE_getIFNo(f, lvl, (S-1+f->numVerts)%f->numVerts, y+1, 0), no);
+					}
+					else if (y == 0) {
+						NormAdd(FACE_getIFNo(f, lvl, (S + 1) % f->numVerts, 0, x), no);
+						if (!yLimitNext || x < gridSize - 2)
+							NormAdd(FACE_getIFNo(f, lvl, (S + 1) % f->numVerts, 0, x + 1), no);
+					}
+					else if (x == 0) {
+						NormAdd(FACE_getIFNo(f, lvl, (S - 1 + f->numVerts) % f->numVerts, y, 0), no);
+						if (!xLimitPrev || y < gridSize - 2)
+							NormAdd(FACE_getIFNo(f, lvl, (S - 1 + f->numVerts) % f->numVerts, y + 1, 0), no);
 					}
 				}
 			}
 		}
 	}
-		// XXX can I reduce the number of normalisations here?
-	for (ptrIdx=0; ptrIdx<numEffectedV; ptrIdx++) {
-		CCGVert *v = (CCGVert*) effectedV[ptrIdx];
+	/* XXX can I reduce the number of normalisations here? */
+	for (ptrIdx = 0; ptrIdx < numEffectedV; ptrIdx++) {
+		CCGVert *v = (CCGVert *) effectedV[ptrIdx];
 		float length, *no = _vert_getNo(v, lvl, vertDataSize, normalDataOffset);
 
 		NormZero(no);
 
-		for (i=0; i<v->numFaces; i++) {
+		for (i = 0; i < v->numFaces; i++) {
 			CCGFace *f = v->faces[i];
-			NormAdd(no, FACE_getIFNo(f, lvl, _face_getVertIndex(f,v), gridSize-1, gridSize-1));
+			NormAdd(no, FACE_getIFNo(f, lvl, _face_getVertIndex(f, v), gridSize - 1, gridSize - 1));
 		}
 
-		length = sqrt(no[0]*no[0] + no[1]*no[1] + no[2]*no[2]);
+		length = sqrtf(no[0] * no[0] + no[1] * no[1] + no[2] * no[2]);
 
-		if (length>EPSILON) {
-			float invLength = 1.0f/length;
+		if (length > EPSILON) {
+			float invLength = 1.0f / length;
 			no[0] *= invLength;
 			no[1] *= invLength;
 			no[2] *= invLength;
-		} else {
+		}
+		else {
 			NormZero(no);
 		}
 
-		for (i=0; i<v->numFaces; i++) {
+		for (i = 0; i < v->numFaces; i++) {
 			CCGFace *f = v->faces[i];
-			NormCopy(FACE_getIFNo(f, lvl, _face_getVertIndex(f,v), gridSize-1, gridSize-1), no);
+			NormCopy(FACE_getIFNo(f, lvl, _face_getVertIndex(f, v), gridSize - 1, gridSize - 1), no);
 		}
 	}
-	for (ptrIdx=0; ptrIdx<numEffectedE; ptrIdx++) {
-		CCGEdge *e = (CCGEdge*) effectedE[ptrIdx];
+	for (ptrIdx = 0; ptrIdx < numEffectedE; ptrIdx++) {
+		CCGEdge *e = (CCGEdge *) effectedE[ptrIdx];
 
 		if (e->numFaces) {
-			CCGFace *fLast = e->faces[e->numFaces-1];
+			CCGFace *fLast = e->faces[e->numFaces - 1];
 			int x;
 
-			for (i=0; i<e->numFaces-1; i++) {
+			for (i = 0; i < e->numFaces - 1; i++) {
 				CCGFace *f = e->faces[i];
+				const int f_ed_idx = _face_getEdgeIndex(f, e);
+				const int f_ed_idx_last = _face_getEdgeIndex(fLast, e);
 
-				for (x=1; x<edgeSize-1; x++) {
-					NormAdd(_face_getIFNoEdge(fLast, e, lvl, x, 0, subdivLevels, vertDataSize, normalDataOffset),
-							_face_getIFNoEdge(f, e, lvl, x, 0, subdivLevels, vertDataSize, normalDataOffset));
+				for (x = 1; x < edgeSize - 1; x++) {
+					NormAdd(_face_getIFNoEdge(fLast, e, f_ed_idx_last, lvl, x, 0, subdivLevels, vertDataSize, normalDataOffset),
+					        _face_getIFNoEdge(f, e, f_ed_idx, lvl, x, 0, subdivLevels, vertDataSize, normalDataOffset));
 				}
 			}
 
-			for (i=0; i<e->numFaces-1; i++) {
+			for (i = 0; i < e->numFaces - 1; i++) {
 				CCGFace *f = e->faces[i];
+				const int f_ed_idx = _face_getEdgeIndex(f, e);
+				const int f_ed_idx_last = _face_getEdgeIndex(fLast, e);
 
-				for (x=1; x<edgeSize-1; x++) {
-					NormCopy(_face_getIFNoEdge(f, e, lvl, x, 0, subdivLevels, vertDataSize, normalDataOffset),
-							_face_getIFNoEdge(fLast, e, lvl, x, 0, subdivLevels, vertDataSize, normalDataOffset));
+				for (x = 1; x < edgeSize - 1; x++) {
+					NormCopy(_face_getIFNoEdge(f, e, f_ed_idx, lvl, x, 0, subdivLevels, vertDataSize, normalDataOffset),
+					         _face_getIFNoEdge(fLast, e, f_ed_idx_last, lvl, x, 0, subdivLevels, vertDataSize, normalDataOffset));
 				}
 			}
 		}
 	}
 
-	#pragma omp parallel for private(ptrIdx) if(numEffectedF*edgeSize*edgeSize*4 >= CCG_OMP_LIMIT)
-	for (ptrIdx=0; ptrIdx<numEffectedF; ptrIdx++) {
-		CCGFace *f = (CCGFace*) effectedF[ptrIdx];
+	#pragma omp parallel for private(ptrIdx) if (numEffectedF * edgeSize * edgeSize * 4 >= CCG_OMP_LIMIT)
+	for (ptrIdx = 0; ptrIdx < numEffectedF; ptrIdx++) {
+		CCGFace *f = (CCGFace *) effectedF[ptrIdx];
 		int S, x, y;
 
-		for (S=0; S<f->numVerts; S++) {
-			NormCopy(FACE_getIFNo(f, lvl, (S+1)%f->numVerts, 0, gridSize-1),
-					 FACE_getIFNo(f, lvl, S, gridSize-1, 0));
+		for (S = 0; S < f->numVerts; S++) {
+			NormCopy(FACE_getIFNo(f, lvl, (S + 1) % f->numVerts, 0, gridSize - 1),
+			         FACE_getIFNo(f, lvl, S, gridSize - 1, 0));
 		}
 
-		for (S=0; S<f->numVerts; S++) {
-			for (y=0; y<gridSize; y++) {
-				for (x=0; x<gridSize; x++) {
+		for (S = 0; S < f->numVerts; S++) {
+			for (y = 0; y < gridSize; y++) {
+				for (x = 0; x < gridSize; x++) {
 					float *no = FACE_getIFNo(f, lvl, S, x, y);
-					float length = sqrt(no[0]*no[0] + no[1]*no[1] + no[2]*no[2]);
+					float length = sqrtf(no[0] * no[0] + no[1] * no[1] + no[2] * no[2]);
 
-					if (length>EPSILON) {
-						float invLength = 1.0f/length;
+					if (length > EPSILON) {
+						float invLength = 1.0f / length;
 						no[0] *= invLength;
 						no[1] *= invLength;
 						no[2] *= invLength;
-					} else {
+					}
+					else {
 						NormZero(no);
 					}
 				}
 			}
 
-			VertDataCopy((float*)((byte*)FACE_getCenterData(f) + normalDataOffset),
-				FACE_getIFNo(f, lvl, S, 0, 0));
+			VertDataCopy((float *)((byte *)FACE_getCenterData(f) + normalDataOffset),
+			             FACE_getIFNo(f, lvl, S, 0, 0));
 
-			for (x=1; x<gridSize-1; x++)
+			for (x = 1; x < gridSize - 1; x++)
 				NormCopy(FACE_getIENo(f, lvl, S, x),
-					FACE_getIFNo(f, lvl, S, x, 0));
+				         FACE_getIFNo(f, lvl, S, x, 0));
 		}
 	}
 
-	for (ptrIdx=0; ptrIdx<numEffectedE; ptrIdx++) {
-		CCGEdge *e = (CCGEdge*) effectedE[ptrIdx];
+	for (ptrIdx = 0; ptrIdx < numEffectedE; ptrIdx++) {
+		CCGEdge *e = (CCGEdge *) effectedE[ptrIdx];
 
 		if (e->numFaces) {
 			CCGFace *f = e->faces[0];
 			int x;
+			const int f_ed_idx = _face_getEdgeIndex(f, e);
 
-			for (x=0; x<edgeSize; x++)
+			for (x = 0; x < edgeSize; x++)
 				NormCopy(EDGE_getNo(e, lvl, x),
-					_face_getIFNoEdge(f, e, lvl, x, 0, subdivLevels, vertDataSize, normalDataOffset));
+				         _face_getIFNoEdge(f, e, f_ed_idx, lvl, x, 0, subdivLevels, vertDataSize, normalDataOffset));
 		}
 		else {
 			/* set to zero here otherwise the normals are uninitialized memory
@@ -1349,7 +1541,7 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
 			 * most likely not used so just zero out. */
 			int x;
 
-			for (x=0; x<edgeSize; x++) {
+			for (x = 0; x < edgeSize; x++) {
 				NormZero(EDGE_getNo(e, lvl, x));
 			}
 		}
@@ -1357,38 +1549,40 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
 }
 #undef FACE_getIFNo
 
-#define VERT_getCo(v, lvl)				_vert_getCo(v, lvl, vertDataSize)
-#define EDGE_getCo(e, lvl, x)			_edge_getCo(e, lvl, x, vertDataSize)
-#define FACE_getIECo(f, lvl, S, x)		_face_getIECo(f, lvl, S, x, subdivLevels, vertDataSize)
-#define FACE_getIFCo(f, lvl, S, x, y)	_face_getIFCo(f, lvl, S, x, y, subdivLevels, vertDataSize)
+#define VERT_getCo(v, lvl)              _vert_getCo(v, lvl, vertDataSize)
+#define EDGE_getCo(e, lvl, x)           _edge_getCo(e, lvl, x, vertDataSize)
+#define FACE_getIECo(f, lvl, S, x)      _face_getIECo(f, lvl, S, x, subdivLevels, vertDataSize)
+#define FACE_getIFCo(f, lvl, S, x, y)   _face_getIFCo(f, lvl, S, x, y, subdivLevels, vertDataSize)
+
 static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
-	CCGVert **effectedV, CCGEdge **effectedE, CCGFace **effectedF,
-	int numEffectedV, int numEffectedE, int numEffectedF, int curLvl) {
+                                        CCGVert **effectedV, CCGEdge **effectedE, CCGFace **effectedF,
+                                        int numEffectedV, int numEffectedE, int numEffectedF, int curLvl)
+{
 	int subdivLevels = ss->subdivLevels;
-	int edgeSize = 1 + (1<<curLvl);
-	int gridSize = 1 + (1<<(curLvl-1));
-	int nextLvl = curLvl+1;
+	int edgeSize = ccg_edgesize(curLvl);
+	int gridSize = ccg_gridsize(curLvl);
+	int nextLvl = curLvl + 1;
 	int ptrIdx, cornerIdx, i;
 	int vertDataSize = ss->meshIFC.vertDataSize;
 	void *q = ss->q, *r = ss->r;
 
-	#pragma omp parallel for private(ptrIdx) if(numEffectedF*edgeSize*edgeSize*4 >= CCG_OMP_LIMIT)
-	for (ptrIdx=0; ptrIdx<numEffectedF; ptrIdx++) {
-		CCGFace *f = (CCGFace*) effectedF[ptrIdx];
+	#pragma omp parallel for private(ptrIdx) if (numEffectedF * edgeSize * edgeSize * 4 >= CCG_OMP_LIMIT)
+	for (ptrIdx = 0; ptrIdx < numEffectedF; ptrIdx++) {
+		CCGFace *f = (CCGFace *) effectedF[ptrIdx];
 		int S, x, y;
 
-			/* interior face midpoints
-			 *  o old interior face points
-			 */
-		for (S=0; S<f->numVerts; S++) {
-			for (y=0; y<gridSize-1; y++) {
-				for (x=0; x<gridSize-1; x++) {
-					int fx = 1 + 2*x;
-					int fy = 1 + 2*y;
-					void *co0 = FACE_getIFCo(f, curLvl, S, x+0, y+0);
-					void *co1 = FACE_getIFCo(f, curLvl, S, x+1, y+0);
-					void *co2 = FACE_getIFCo(f, curLvl, S, x+1, y+1);
-					void *co3 = FACE_getIFCo(f, curLvl, S, x+0, y+1);
+		/* interior face midpoints
+		 * - old interior face points
+		 */
+		for (S = 0; S < f->numVerts; S++) {
+			for (y = 0; y < gridSize - 1; y++) {
+				for (x = 0; x < gridSize - 1; x++) {
+					int fx = 1 + 2 * x;
+					int fy = 1 + 2 * y;
+					void *co0 = FACE_getIFCo(f, curLvl, S, x + 0, y + 0);
+					void *co1 = FACE_getIFCo(f, curLvl, S, x + 1, y + 0);
+					void *co2 = FACE_getIFCo(f, curLvl, S, x + 1, y + 1);
+					void *co3 = FACE_getIFCo(f, curLvl, S, x + 0, y + 1);
 					void *co = FACE_getIFCo(f, nextLvl, S, fx, fy);
 
 					VertDataAvg4(co, co0, co1, co2, co3);
@@ -1396,52 +1590,52 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
 			}
 		}
 
-			/* interior edge midpoints
-			 *  o old interior edge points
-			 *  o new interior face midpoints
-			 */
-		for (S=0; S<f->numVerts; S++) {
-			for (x=0; x<gridSize-1; x++) {
-				int fx = x*2 + 1;
-				void *co0 = FACE_getIECo(f, curLvl, S, x+0);
-				void *co1 = FACE_getIECo(f, curLvl, S, x+1);
-				void *co2 = FACE_getIFCo(f, nextLvl, (S+1)%f->numVerts, 1, fx);
+		/* interior edge midpoints
+		 * - old interior edge points
+		 * - new interior face midpoints
+		 */
+		for (S = 0; S < f->numVerts; S++) {
+			for (x = 0; x < gridSize - 1; x++) {
+				int fx = x * 2 + 1;
+				void *co0 = FACE_getIECo(f, curLvl, S, x + 0);
+				void *co1 = FACE_getIECo(f, curLvl, S, x + 1);
+				void *co2 = FACE_getIFCo(f, nextLvl, (S + 1) % f->numVerts, 1, fx);
 				void *co3 = FACE_getIFCo(f, nextLvl, S, fx, 1);
-				void *co = FACE_getIECo(f, nextLvl, S, fx);
+				void *co  = FACE_getIECo(f, nextLvl, S, fx);
 				
 				VertDataAvg4(co, co0, co1, co2, co3);
 			}
 
-					/* interior face interior edge midpoints
-					 *  o old interior face points
-					 *  o new interior face midpoints
-					 */
-
-				/* vertical */
-			for (x=1; x<gridSize-1; x++) {
-				for (y=0; y<gridSize-1; y++) {
-					int fx = x*2;
-					int fy = y*2+1;
-					void *co0 = FACE_getIFCo(f, curLvl, S, x, y+0);
-					void *co1 = FACE_getIFCo(f, curLvl, S, x, y+1);
-					void *co2 = FACE_getIFCo(f, nextLvl, S, fx-1, fy);
-					void *co3 = FACE_getIFCo(f, nextLvl, S, fx+1, fy);
-					void *co = FACE_getIFCo(f, nextLvl, S, fx, fy);
+			/* interior face interior edge midpoints
+			 * - old interior face points
+			 * - new interior face midpoints
+			 */
+
+			/* vertical */
+			for (x = 1; x < gridSize - 1; x++) {
+				for (y = 0; y < gridSize - 1; y++) {
+					int fx = x * 2;
+					int fy = y * 2 + 1;
+					void *co0 = FACE_getIFCo(f, curLvl, S, x, y + 0);
+					void *co1 = FACE_getIFCo(f, curLvl, S, x, y + 1);
+					void *co2 = FACE_getIFCo(f, nextLvl, S, fx - 1, fy);
+					void *co3 = FACE_getIFCo(f, nextLvl, S, fx + 1, fy);
+					void *co  = FACE_getIFCo(f, nextLvl, S, fx, fy);
 
 					VertDataAvg4(co, co0, co1, co2, co3);
 				}
 			}
 
-				/* horizontal */
-			for (y=1; y<gridSize-1; y++) {
-				for (x=0; x<gridSize-1; x++) {
-					int fx = x*2+1;
-					int fy = y*2;
-					void *co0 = FACE_getIFCo(f, curLvl, S, x+0, y);
-					void *co1 = FACE_getIFCo(f, curLvl, S, x+1, y);
-					void *co2 = FACE_getIFCo(f, nextLvl, S, fx, fy-1);
-					void *co3 = FACE_getIFCo(f, nextLvl, S, fx, fy+1);
-					void *co = FACE_getIFCo(f, nextLvl, S, fx, fy);
+			/* horizontal */
+			for (y = 1; y < gridSize - 1; y++) {
+				for (x = 0; x < gridSize - 1; x++) {
+					int fx = x * 2 + 1;
+					int fy = y * 2;
+					void *co0 = FACE_getIFCo(f, curLvl, S, x + 0, y);
+					void *co1 = FACE_getIFCo(f, curLvl, S, x + 1, y);
+					void *co2 = FACE_getIFCo(f, nextLvl, S, fx, fy - 1);
+					void *co3 = FACE_getIFCo(f, nextLvl, S, fx, fy + 1);
+					void *co  = FACE_getIFCo(f, nextLvl, S, fx, fy);
 
 					VertDataAvg4(co, co0, co1, co2, co3);
 				}
@@ -1449,44 +1643,46 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
 		}
 	}
 
-		/* exterior edge midpoints
-		 *  o old exterior edge points
-		 *  o new interior face midpoints
-		 */
-	for (ptrIdx=0; ptrIdx<numEffectedE; ptrIdx++) {
-		CCGEdge *e = (CCGEdge*) effectedE[ptrIdx];
+	/* exterior edge midpoints
+	 * - old exterior edge points
+	 * - new interior face midpoints
+	 */
+	for (ptrIdx = 0; ptrIdx < numEffectedE; ptrIdx++) {
+		CCGEdge *e = (CCGEdge *) effectedE[ptrIdx];
 		float sharpness = EDGE_getSharpness(e, curLvl);
 		int x, j;
 
 		if (_edge_isBoundary(e) || sharpness > 1.0f) {
-			for (x=0; x<edgeSize-1; x++) {
-				int fx = x*2 + 1;
-				void *co0 = EDGE_getCo(e, curLvl, x+0);
-				void *co1 = EDGE_getCo(e, curLvl, x+1);
-				void *co = EDGE_getCo(e, nextLvl, fx);
+			for (x = 0; x < edgeSize - 1; x++) {
+				int fx = x * 2 + 1;
+				void *co0 = EDGE_getCo(e, curLvl, x + 0);
+				void *co1 = EDGE_getCo(e, curLvl, x + 1);
+				void *co  = EDGE_getCo(e, nextLvl, fx);
 
 				VertDataCopy(co, co0);
 				VertDataAdd(co, co1);
 				VertDataMulN(co, 0.5f);
 			}
-		} else {
-			for (x=0; x<edgeSize-1; x++) {
-				int fx = x*2 + 1;
-				void *co0 = EDGE_getCo(e, curLvl, x+0);
-				void *co1 = EDGE_getCo(e, curLvl, x+1);
-				void *co = EDGE_getCo(e, nextLvl, fx);
+		}
+		else {
+			for (x = 0; x < edgeSize - 1; x++) {
+				int fx = x * 2 + 1;
+				void *co0 = EDGE_getCo(e, curLvl, x + 0);
+				void *co1 = EDGE_getCo(e, curLvl, x + 1);
+				void *co  = EDGE_getCo(e, nextLvl, fx);
 				int numFaces = 0;
 
 				VertDataCopy(q, co0);
 				VertDataAdd(q, co1);
 
-				for (j=0; j<e->numFaces; j++) {
+				for (j = 0; j < e->numFaces; j++) {
 					CCGFace *f = e->faces[j];
-					VertDataAdd(q, _face_getIFCoEdge(f, e, nextLvl, fx, 1, subdivLevels, vertDataSize));
+					const int f_ed_idx = _face_getEdgeIndex(f, e);
+					VertDataAdd(q, _face_getIFCoEdge(f, e, f_ed_idx, nextLvl, fx, 1, subdivLevels, vertDataSize));
 					numFaces++;
 				}
 
-				VertDataMulN(q, 1.0f/(2.0f+numFaces));
+				VertDataMulN(q, 1.0f / (2.0f + numFaces));
 
 				VertDataCopy(r, co0);
 				VertDataAdd(r, co1);
@@ -1500,35 +1696,36 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
 		}
 	}
 
-		/* exterior vertex shift
-		 *  o old vertex points (shifting)
-		 *  o old exterior edge points
-		 *  o new interior face midpoints
-		 */
-	for (ptrIdx=0; ptrIdx<numEffectedV; ptrIdx++) {
-		CCGVert *v = (CCGVert*) effectedV[ptrIdx];
+	/* exterior vertex shift
+	 * - old vertex points (shifting)
+	 * - old exterior edge points
+	 * - new interior face midpoints
+	 */
+	for (ptrIdx = 0; ptrIdx < numEffectedV; ptrIdx++) {
+		CCGVert *v = (CCGVert *) effectedV[ptrIdx];
 		void *co = VERT_getCo(v, curLvl);
 		void *nCo = VERT_getCo(v, nextLvl);
 		int sharpCount = 0, allSharp = 1;
 		float avgSharpness = 0.0;
 		int j, seam = VERT_seam(v), seamEdges = 0;
 
-		for (j=0; j<v->numEdges; j++) {
+		for (j = 0; j < v->numEdges; j++) {
 			CCGEdge *e = v->edges[j];
 			float sharpness = EDGE_getSharpness(e, curLvl);
 
 			if (seam && _edge_isBoundary(e))
 				seamEdges++;
 
-			if (sharpness!=0.0f) {
+			if (sharpness != 0.0f) {
 				sharpCount++;
 				avgSharpness += sharpness;
-			} else {
+			}
+			else {
 				allSharp = 0;
 			}
 		}
 
-		if(sharpCount) {
+		if (sharpCount) {
 			avgSharpness /= sharpCount;
 			if (avgSharpness > 1.0f) {
 				avgSharpness = 1.0f;
@@ -1540,11 +1737,12 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
 
 		if (!v->numEdges) {
 			VertDataCopy(nCo, co);
-		} else if (_vert_isBoundary(v)) {
+		}
+		else if (_vert_isBoundary(v)) {
 			int numBoundary = 0;
 
 			VertDataZero(r);
-			for (j=0; j<v->numEdges; j++) {
+			for (j = 0; j < v->numEdges; j++) {
 				CCGEdge *e = v->edges[j];
 				if (_edge_isBoundary(e)) {
 					VertDataAdd(r, _edge_getCoVert(e, v, curLvl, 1, vertDataSize));
@@ -1554,35 +1752,36 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
 
 			VertDataCopy(nCo, co);
 			VertDataMulN(nCo, 0.75f);
-			VertDataMulN(r, 0.25f/numBoundary);
+			VertDataMulN(r, 0.25f / numBoundary);
 			VertDataAdd(nCo, r);
-		} else {
-			int cornerIdx = (1 + (1<<(curLvl))) - 2;
+		}
+		else {
+			int cornerIdx = (1 + (1 << (curLvl))) - 2;
 			int numEdges = 0, numFaces = 0;
 
 			VertDataZero(q);
-			for (j=0; j<v->numFaces; j++) {
+			for (j = 0; j < v->numFaces; j++) {
 				CCGFace *f = v->faces[j];
-				VertDataAdd(q, FACE_getIFCo(f, nextLvl, _face_getVertIndex(f,v), cornerIdx, cornerIdx));
+				VertDataAdd(q, FACE_getIFCo(f, nextLvl, _face_getVertIndex(f, v), cornerIdx, cornerIdx));
 				numFaces++;
 			}
-			VertDataMulN(q, 1.0f/numFaces);
+			VertDataMulN(q, 1.0f / numFaces);
 			VertDataZero(r);
-			for (j=0; j<v->numEdges; j++) {
+			for (j = 0; j < v->numEdges; j++) {
 				CCGEdge *e = v->edges[j];
-				VertDataAdd(r, _edge_getCoVert(e, v, curLvl, 1,vertDataSize));
+				VertDataAdd(r, _edge_getCoVert(e, v, curLvl, 1, vertDataSize));
 				numEdges++;
 			}
-			VertDataMulN(r, 1.0f/numEdges);
+			VertDataMulN(r, 1.0f / numEdges);
 
 			VertDataCopy(nCo, co);
-			VertDataMulN(nCo, numEdges-2.0f);
+			VertDataMulN(nCo, numEdges - 2.0f);
 			VertDataAdd(nCo, q);
 			VertDataAdd(nCo, r);
-			VertDataMulN(nCo, 1.0f/numEdges);
+			VertDataMulN(nCo, 1.0f / numEdges);
 		}
 
-		if ((sharpCount>1 && v->numFaces) || seam) {
+		if ((sharpCount > 1 && v->numFaces) || seam) {
 			VertDataZero(q);
 
 			if (seam) {
@@ -1591,112 +1790,116 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
 				allSharp = 1;
 			}
 
-			for (j=0; j<v->numEdges; j++) {
+			for (j = 0; j < v->numEdges; j++) {
 				CCGEdge *e = v->edges[j];
 				float sharpness = EDGE_getSharpness(e, curLvl);
 
 				if (seam) {
 					if (_edge_isBoundary(e))
 						VertDataAdd(q, _edge_getCoVert(e, v, curLvl, 1, vertDataSize));
-				} else if (sharpness != 0.0f) {
+				}
+				else if (sharpness != 0.0f) {
 					VertDataAdd(q, _edge_getCoVert(e, v, curLvl, 1, vertDataSize));
 				}
 			}
 
-			VertDataMulN(q, (float) 1/sharpCount);
+			VertDataMulN(q, (float) 1 / sharpCount);
 
-			if (sharpCount!=2 || allSharp) {
-					// q = q + (co-q)*avgSharpness
+			if (sharpCount != 2 || allSharp) {
+				/* q = q + (co - q) * avgSharpness */
 				VertDataCopy(r, co);
 				VertDataSub(r, q);
 				VertDataMulN(r, avgSharpness);
 				VertDataAdd(q, r);
 			}
 
-				// r = co*.75 + q*.25
+			/* r = co * 0.75 + q * 0.25 */
 			VertDataCopy(r, co);
 			VertDataMulN(r, .75f);
 			VertDataMulN(q, .25f);
 			VertDataAdd(r, q);
 
-				// nCo = nCo  + (r-nCo)*avgSharpness
+			/* nCo = nCo  + (r - nCo) * avgSharpness */
 			VertDataSub(r, nCo);
 			VertDataMulN(r, avgSharpness);
 			VertDataAdd(nCo, r);
 		}
 	}
 
-		/* exterior edge interior shift
-		 *  o old exterior edge midpoints (shifting)
-		 *  o old exterior edge midpoints
-		 *  o new interior face midpoints
-		 */
-	for (ptrIdx=0; ptrIdx<numEffectedE; ptrIdx++) {
-		CCGEdge *e = (CCGEdge*) effectedE[ptrIdx];
+	/* exterior edge interior shift
+	 * - old exterior edge midpoints (shifting)
+	 * - old exterior edge midpoints
+	 * - new interior face midpoints
+	 */
+	for (ptrIdx = 0; ptrIdx < numEffectedE; ptrIdx++) {
+		CCGEdge *e = (CCGEdge *) effectedE[ptrIdx];
 		float sharpness = EDGE_getSharpness(e, curLvl);
 		int sharpCount = 0;
 		float avgSharpness = 0.0;
 		int x, j;
 
-		if (sharpness!=0.0f) {
+		if (sharpness != 0.0f) {
 			sharpCount = 2;
 			avgSharpness += sharpness;
 
 			if (avgSharpness > 1.0f) {
 				avgSharpness = 1.0f;
 			}
-		} else {
+		}
+		else {
 			sharpCount = 0;
 			avgSharpness = 0;
 		}
 
-		if (_edge_isBoundary(e) && (!e->numFaces || sharpCount<2)) {
-			for (x=1; x<edgeSize-1; x++) {
-				int fx = x*2;
+		if (_edge_isBoundary(e) && (!e->numFaces || sharpCount < 2)) {
+			for (x = 1; x < edgeSize - 1; x++) {
+				int fx = x * 2;
 				void *co = EDGE_getCo(e, curLvl, x);
 				void *nCo = EDGE_getCo(e, nextLvl, fx);
-				VertDataCopy(r, EDGE_getCo(e, curLvl, x-1));
-				VertDataAdd(r, EDGE_getCo(e, curLvl, x+1));
+				VertDataCopy(r, EDGE_getCo(e, curLvl, x - 1));
+				VertDataAdd(r, EDGE_getCo(e, curLvl, x + 1));
 				VertDataMulN(r, 0.5f);
 				VertDataCopy(nCo, co);
 				VertDataMulN(nCo, 0.75f);
 				VertDataMulN(r, 0.25f);
 				VertDataAdd(nCo, r);
 			}
-		} else {
-			for (x=1; x<edgeSize-1; x++) {
-				int fx = x*2;
+		}
+		else {
+			for (x = 1; x < edgeSize - 1; x++) {
+				int fx = x * 2;
 				void *co = EDGE_getCo(e, curLvl, x);
 				void *nCo = EDGE_getCo(e, nextLvl, fx);
 				int numFaces = 0;
 
 				VertDataZero(q);
 				VertDataZero(r);
-				VertDataAdd(r, EDGE_getCo(e, curLvl, x-1));
-				VertDataAdd(r, EDGE_getCo(e, curLvl, x+1));
-				for (j=0; j<e->numFaces; j++) {
+				VertDataAdd(r, EDGE_getCo(e, curLvl, x - 1));
+				VertDataAdd(r, EDGE_getCo(e, curLvl, x + 1));
+				for (j = 0; j < e->numFaces; j++) {
 					CCGFace *f = e->faces[j];
-					VertDataAdd(q, _face_getIFCoEdge(f, e, nextLvl, fx-1, 1, subdivLevels, vertDataSize));
-					VertDataAdd(q, _face_getIFCoEdge(f, e, nextLvl, fx+1, 1, subdivLevels, vertDataSize));
+					int f_ed_idx = _face_getEdgeIndex(f, e);
+					VertDataAdd(q, _face_getIFCoEdge(f, e, f_ed_idx, nextLvl, fx - 1, 1, subdivLevels, vertDataSize));
+					VertDataAdd(q, _face_getIFCoEdge(f, e, f_ed_idx, nextLvl, fx + 1, 1, subdivLevels, vertDataSize));
 
-					VertDataAdd(r, _face_getIFCoEdge(f, e, curLvl, x, 1, subdivLevels, vertDataSize));
+					VertDataAdd(r, _face_getIFCoEdge(f, e, f_ed_idx, curLvl, x, 1, subdivLevels, vertDataSize));
 					numFaces++;
 				}
-				VertDataMulN(q, 1.0f/(numFaces*2.0f));
-				VertDataMulN(r, 1.0f/(2.0f + numFaces));
+				VertDataMulN(q, 1.0f / (numFaces * 2.0f));
+				VertDataMulN(r, 1.0f / (2.0f + numFaces));
 
 				VertDataCopy(nCo, co);
 				VertDataMulN(nCo, (float) numFaces);
 				VertDataAdd(nCo, q);
 				VertDataAdd(nCo, r);
-				VertDataMulN(nCo, 1.0f/(2+numFaces));
+				VertDataMulN(nCo, 1.0f / (2 + numFaces));
 
-				if (sharpCount==2) {
+				if (sharpCount == 2) {
 					VertDataCopy(q, co);
 					VertDataMulN(q, 6.0f);
-					VertDataAdd(q, EDGE_getCo(e, curLvl, x-1));
-					VertDataAdd(q, EDGE_getCo(e, curLvl, x+1));
-					VertDataMulN(q, 1/8.0f);
+					VertDataAdd(q, EDGE_getCo(e, curLvl, x - 1));
+					VertDataAdd(q, EDGE_getCo(e, curLvl, x + 1));
+					VertDataMulN(q, 1 / 8.0f);
 
 					VertDataSub(q, nCo);
 					VertDataMulN(q, avgSharpness);
@@ -1706,7 +1909,7 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
 		}
 	}
 
-	#pragma omp parallel private(ptrIdx) if(numEffectedF*edgeSize*edgeSize*4 >= CCG_OMP_LIMIT)
+	#pragma omp parallel private(ptrIdx) if (numEffectedF * edgeSize * edgeSize * 4 >= CCG_OMP_LIMIT)
 	{
 		void *q, *r;
 
@@ -1717,53 +1920,55 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
 		}
 
 		#pragma omp for schedule(static)
-		for (ptrIdx=0; ptrIdx<numEffectedF; ptrIdx++) {
-			CCGFace *f = (CCGFace*) effectedF[ptrIdx];
+		for (ptrIdx = 0; ptrIdx < numEffectedF; ptrIdx++) {
+			CCGFace *f = (CCGFace *) effectedF[ptrIdx];
 			int S, x, y;
 
-				/* interior center point shift
-				 *  o old face center point (shifting)
-				 *  o old interior edge points
-				 *  o new interior face midpoints
-				 */
+			/* interior center point shift
+			 * - old face center point (shifting)
+			 * - old interior edge points
+			 * - new interior face midpoints
+			 */
 			VertDataZero(q);
-			for (S=0; S<f->numVerts; S++) {
+			for (S = 0; S < f->numVerts; S++) {
 				VertDataAdd(q, FACE_getIFCo(f, nextLvl, S, 1, 1));
 			}
-			VertDataMulN(q, 1.0f/f->numVerts);
+			VertDataMulN(q, 1.0f / f->numVerts);
 			VertDataZero(r);
-			for (S=0; S<f->numVerts; S++) {
+			for (S = 0; S < f->numVerts; S++) {
 				VertDataAdd(r, FACE_getIECo(f, curLvl, S, 1));
 			}
-			VertDataMulN(r, 1.0f/f->numVerts);
+			VertDataMulN(r, 1.0f / f->numVerts);
 
-			VertDataMulN(FACE_getCenterData(f), f->numVerts-2.0f);
+			VertDataMulN(FACE_getCenterData(f), f->numVerts - 2.0f);
 			VertDataAdd(FACE_getCenterData(f), q);
 			VertDataAdd(FACE_getCenterData(f), r);
-			VertDataMulN(FACE_getCenterData(f), 1.0f/f->numVerts);
-
-			for (S=0; S<f->numVerts; S++) {
-					/* interior face shift
-					 *  o old interior face point (shifting)
-					 *  o new interior edge midpoints
-					 *  o new interior face midpoints
-					 */
-				for (x=1; x<gridSize-1; x++) {
-					for (y=1; y<gridSize-1; y++) {
-						int fx = x*2;
-						int fy = y*2;
+			VertDataMulN(FACE_getCenterData(f), 1.0f / f->numVerts);
+
+			for (S = 0; S < f->numVerts; S++) {
+				/* interior face shift
+				 * - old interior face point (shifting)
+				 * - new interior edge midpoints
+				 * - new interior face midpoints
+				 */
+				for (x = 1; x < gridSize - 1; x++) {
+					for (y = 1; y < gridSize - 1; y++) {
+						int fx = x * 2;
+						int fy = y * 2;
 						void *co = FACE_getIFCo(f, curLvl, S, x, y);
 						void *nCo = FACE_getIFCo(f, nextLvl, S, fx, fy);
 						
-						VertDataAvg4(q, FACE_getIFCo(f, nextLvl, S, fx-1, fy-1),
-							FACE_getIFCo(f, nextLvl, S, fx+1, fy-1),
-							FACE_getIFCo(f, nextLvl, S, fx+1, fy+1),
-							FACE_getIFCo(f, nextLvl, S, fx-1, fy+1));
-
-						VertDataAvg4(r, FACE_getIFCo(f, nextLvl, S, fx-1, fy+0),
-							FACE_getIFCo(f, nextLvl, S, fx+1, fy+0),
-							FACE_getIFCo(f, nextLvl, S, fx+0, fy-1),
-							FACE_getIFCo(f, nextLvl, S, fx+0, fy+1));
+						VertDataAvg4(q,
+						             FACE_getIFCo(f, nextLvl, S, fx - 1, fy - 1),
+						             FACE_getIFCo(f, nextLvl, S, fx + 1, fy - 1),
+						             FACE_getIFCo(f, nextLvl, S, fx + 1, fy + 1),
+						             FACE_getIFCo(f, nextLvl, S, fx - 1, fy + 1));
+
+						VertDataAvg4(r,
+						             FACE_getIFCo(f, nextLvl, S, fx - 1, fy + 0),
+						             FACE_getIFCo(f, nextLvl, S, fx + 1, fy + 0),
+						             FACE_getIFCo(f, nextLvl, S, fx + 0, fy - 1),
+						             FACE_getIFCo(f, nextLvl, S, fx + 0, fy + 1));
 
 						VertDataCopy(nCo, co);
 						VertDataSub(nCo, q);
@@ -1772,25 +1977,27 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
 					}
 				}
 
-					/* interior edge interior shift
-					 *  o old interior edge point (shifting)
-					 *  o new interior edge midpoints
-					 *  o new interior face midpoints
-					 */
-				for (x=1; x<gridSize-1; x++) {
-					int fx = x*2;
+				/* interior edge interior shift
+				 * - old interior edge point (shifting)
+				 * - new interior edge midpoints
+				 * - new interior face midpoints
+				 */
+				for (x = 1; x < gridSize - 1; x++) {
+					int fx = x * 2;
 					void *co = FACE_getIECo(f, curLvl, S, x);
 					void *nCo = FACE_getIECo(f, nextLvl, S, fx);
 					
-					VertDataAvg4(q, FACE_getIFCo(f, nextLvl, (S+1)%f->numVerts, 1, fx-1),
-						FACE_getIFCo(f, nextLvl, (S+1)%f->numVerts, 1, fx+1),
-						FACE_getIFCo(f, nextLvl, S, fx+1, +1),
-						FACE_getIFCo(f, nextLvl, S, fx-1, +1));
-
-					VertDataAvg4(r, FACE_getIECo(f, nextLvl, S, fx-1),
-						FACE_getIECo(f, nextLvl, S, fx+1),
-						FACE_getIFCo(f, nextLvl, (S+1)%f->numVerts, 1, fx),
-						FACE_getIFCo(f, nextLvl, S, fx, 1));
+					VertDataAvg4(q,
+					             FACE_getIFCo(f, nextLvl, (S + 1) % f->numVerts, 1, fx - 1),
+					             FACE_getIFCo(f, nextLvl, (S + 1) % f->numVerts, 1, fx + 1),
+					             FACE_getIFCo(f, nextLvl, S, fx + 1, +1),
+					             FACE_getIFCo(f, nextLvl, S, fx - 1, +1));
+
+					VertDataAvg4(r,
+					             FACE_getIECo(f, nextLvl, S, fx - 1),
+					             FACE_getIECo(f, nextLvl, S, fx + 1),
+					             FACE_getIFCo(f, nextLvl, (S + 1) % f->numVerts, 1, fx),
+					             FACE_getIFCo(f, nextLvl, S, fx, 1));
 
 					VertDataCopy(nCo, co);
 					VertDataSub(nCo, q);
@@ -1807,47 +2014,48 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
 		}
 	}
 
-		/* copy down */
-	edgeSize = 1 + (1<<(nextLvl));
-	gridSize = 1 + (1<<((nextLvl)-1));
-	cornerIdx = gridSize-1;
+	/* copy down */
+	edgeSize = ccg_edgesize(nextLvl);
+	gridSize = ccg_gridsize(nextLvl);
+	cornerIdx = gridSize - 1;
 
-	#pragma omp parallel for private(i) if(numEffectedF*edgeSize*edgeSize*4 >= CCG_OMP_LIMIT)
-	for (i=0; i<numEffectedE; i++) {
+	#pragma omp parallel for private(i) if (numEffectedF * edgeSize * edgeSize * 4 >= CCG_OMP_LIMIT)
+	for (i = 0; i < numEffectedE; i++) {
 		CCGEdge *e = effectedE[i];
 		VertDataCopy(EDGE_getCo(e, nextLvl, 0), VERT_getCo(e->v0, nextLvl));
-		VertDataCopy(EDGE_getCo(e, nextLvl, edgeSize-1), VERT_getCo(e->v1, nextLvl));
+		VertDataCopy(EDGE_getCo(e, nextLvl, edgeSize - 1), VERT_getCo(e->v1, nextLvl));
 	}
 
-	#pragma omp parallel for private(i) if(numEffectedF*edgeSize*edgeSize*4 >= CCG_OMP_LIMIT)
-	for (i=0; i<numEffectedF; i++) {
+	#pragma omp parallel for private(i) if (numEffectedF * edgeSize * edgeSize * 4 >= CCG_OMP_LIMIT)
+	for (i = 0; i < numEffectedF; i++) {
 		CCGFace *f = effectedF[i];
 		int S, x;
 
-		for (S=0; S<f->numVerts; S++) {
+		for (S = 0; S < f->numVerts; S++) {
 			CCGEdge *e = FACE_getEdges(f)[S];
-			CCGEdge *prevE = FACE_getEdges(f)[(S+f->numVerts-1)%f->numVerts];
+			CCGEdge *prevE = FACE_getEdges(f)[(S + f->numVerts - 1) % f->numVerts];
 
 			VertDataCopy(FACE_getIFCo(f, nextLvl, S, 0, 0), FACE_getCenterData(f));
 			VertDataCopy(FACE_getIECo(f, nextLvl, S, 0), FACE_getCenterData(f));
 			VertDataCopy(FACE_getIFCo(f, nextLvl, S, cornerIdx, cornerIdx), VERT_getCo(FACE_getVerts(f)[S], nextLvl));
 			VertDataCopy(FACE_getIECo(f, nextLvl, S, cornerIdx), EDGE_getCo(FACE_getEdges(f)[S], nextLvl, cornerIdx));
-			for (x=1; x<gridSize-1; x++) {
+			for (x = 1; x < gridSize - 1; x++) {
 				void *co = FACE_getIECo(f, nextLvl, S, x);
 				VertDataCopy(FACE_getIFCo(f, nextLvl, S, x, 0), co);
-				VertDataCopy(FACE_getIFCo(f, nextLvl, (S+1)%f->numVerts, 0, x), co);
+				VertDataCopy(FACE_getIFCo(f, nextLvl, (S + 1) % f->numVerts, 0, x), co);
 			}
-			for (x=0; x<gridSize-1; x++) {
-				int eI = gridSize-1-x;
-				VertDataCopy(FACE_getIFCo(f, nextLvl, S, cornerIdx, x), _edge_getCoVert(e, FACE_getVerts(f)[S], nextLvl, eI,vertDataSize));
-				VertDataCopy(FACE_getIFCo(f, nextLvl, S, x, cornerIdx), _edge_getCoVert(prevE, FACE_getVerts(f)[S], nextLvl, eI,vertDataSize));
+			for (x = 0; x < gridSize - 1; x++) {
+				int eI = gridSize - 1 - x;
+				VertDataCopy(FACE_getIFCo(f, nextLvl, S, cornerIdx, x), _edge_getCoVert(e, FACE_getVerts(f)[S], nextLvl, eI, vertDataSize));
+				VertDataCopy(FACE_getIFCo(f, nextLvl, S, x, cornerIdx), _edge_getCoVert(prevE, FACE_getVerts(f)[S], nextLvl, eI, vertDataSize));
 			}
 		}
 	}
 }
 
 
-static void ccgSubSurf__sync(CCGSubSurf *ss) {
+static void ccgSubSurf__sync(CCGSubSurf *ss)
+{
 	CCGVert **effectedV;
 	CCGEdge **effectedE;
 	CCGFace **effectedF;
@@ -1858,27 +2066,27 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) {
 	int curLvl, nextLvl;
 	void *q = ss->q, *r = ss->r;
 
-	effectedV = MEM_mallocN(sizeof(*effectedV)*ss->vMap->numEntries, "CCGSubsurf effectedV");
-	effectedE = MEM_mallocN(sizeof(*effectedE)*ss->eMap->numEntries, "CCGSubsurf effectedE");
-	effectedF = MEM_mallocN(sizeof(*effectedF)*ss->fMap->numEntries, "CCGSubsurf effectedF");
+	effectedV = MEM_mallocN(sizeof(*effectedV) * ss->vMap->numEntries, "CCGSubsurf effectedV");
+	effectedE = MEM_mallocN(sizeof(*effectedE) * ss->eMap->numEntries, "CCGSubsurf effectedE");
+	effectedF = MEM_mallocN(sizeof(*effectedF) * ss->fMap->numEntries, "CCGSubsurf effectedF");
 	numEffectedV = numEffectedE = numEffectedF = 0;
-	for (i=0; i<ss->vMap->curSize; i++) {
-		CCGVert *v = (CCGVert*) ss->vMap->buckets[i];
+	for (i = 0; i < ss->vMap->curSize; i++) {
+		CCGVert *v = (CCGVert *) ss->vMap->buckets[i];
 		for (; v; v = v->next) {
-			if (v->flags&Vert_eEffected) {
+			if (v->flags & Vert_eEffected) {
 				effectedV[numEffectedV++] = v;
 
-				for (j=0; j<v->numEdges; j++) {
+				for (j = 0; j < v->numEdges; j++) {
 					CCGEdge *e = v->edges[j];
-					if (!(e->flags&Edge_eEffected)) {
+					if (!(e->flags & Edge_eEffected)) {
 						effectedE[numEffectedE++] = e;
 						e->flags |= Edge_eEffected;
 					}
 				}
 
-				for (j=0; j<v->numFaces; j++) {
+				for (j = 0; j < v->numFaces; j++) {
 					CCGFace *f = v->faces[j];
-					if (!(f->flags&Face_eEffected)) {
+					if (!(f->flags & Face_eEffected)) {
 						effectedF[numEffectedF++] = f;
 						f->flags |= Face_eEffected;
 					}
@@ -1888,20 +2096,20 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) {
 	}
 
 	curLvl = 0;
-	nextLvl = curLvl+1;
+	nextLvl = curLvl + 1;
 
-	for (ptrIdx=0; ptrIdx<numEffectedF; ptrIdx++) {
+	for (ptrIdx = 0; ptrIdx < numEffectedF; ptrIdx++) {
 		CCGFace *f = effectedF[ptrIdx];
 		void *co = FACE_getCenterData(f);
 		VertDataZero(co);
-		for (i=0; i<f->numVerts; i++) {
+		for (i = 0; i < f->numVerts; i++) {
 			VertDataAdd(co, VERT_getCo(FACE_getVerts(f)[i], curLvl));
 		}
-		VertDataMulN(co, 1.0f/f->numVerts);
+		VertDataMulN(co, 1.0f / f->numVerts);
 
 		f->flags = 0;
 	}
-	for (ptrIdx=0; ptrIdx<numEffectedE; ptrIdx++) {
+	for (ptrIdx = 0; ptrIdx < numEffectedE; ptrIdx++) {
 		CCGEdge *e = effectedE[ptrIdx];
 		void *co = EDGE_getCo(e, nextLvl, 1);
 		float sharpness = EDGE_getSharpness(e, curLvl);
@@ -1910,16 +2118,17 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) {
 			VertDataCopy(co, VERT_getCo(e->v0, curLvl));
 			VertDataAdd(co, VERT_getCo(e->v1, curLvl));
 			VertDataMulN(co, 0.5f);
-		} else {
+		}
+		else {
 			int numFaces = 0;
 			VertDataCopy(q, VERT_getCo(e->v0, curLvl));
 			VertDataAdd(q, VERT_getCo(e->v1, curLvl));
-			for (i=0; i<e->numFaces; i++) {
+			for (i = 0; i < e->numFaces; i++) {
 				CCGFace *f = e->faces[i];
 				VertDataAdd(q, FACE_getCenterData(f));
 				numFaces++;
 			}
-			VertDataMulN(q, 1.0f/(2.0f+numFaces));
+			VertDataMulN(q, 1.0f / (2.0f + numFaces));
 
 			VertDataCopy(r, VERT_getCo(e->v0, curLvl));
 			VertDataAdd(r, VERT_getCo(e->v1, curLvl));
@@ -1933,7 +2142,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) {
 
 		// edge flags cleared later
 	}
-	for (ptrIdx=0; ptrIdx<numEffectedV; ptrIdx++) {
+	for (ptrIdx = 0; ptrIdx < numEffectedV; ptrIdx++) {
 		CCGVert *v = effectedV[ptrIdx];
 		void *co = VERT_getCo(v, curLvl);
 		void *nCo = VERT_getCo(v, nextLvl);
@@ -1941,22 +2150,23 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) {
 		float avgSharpness = 0.0;
 		int seam = VERT_seam(v), seamEdges = 0;
 
-		for (i=0; i<v->numEdges; i++) {
+		for (i = 0; i < v->numEdges; i++) {
 			CCGEdge *e = v->edges[i];
 			float sharpness = EDGE_getSharpness(e, curLvl);
 
 			if (seam && _edge_isBoundary(e))
 				seamEdges++;
 
-			if (sharpness!=0.0f) {
+			if (sharpness != 0.0f) {
 				sharpCount++;
 				avgSharpness += sharpness;
-			} else {
+			}
+			else {
 				allSharp = 0;
 			}
 		}
 
-		if(sharpCount) {
+		if (sharpCount) {
 			avgSharpness /= sharpCount;
 			if (avgSharpness > 1.0f) {
 				avgSharpness = 1.0f;
@@ -1968,11 +2178,12 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) {
 
 		if (!v->numEdges) {
 			VertDataCopy(nCo, co);
-		} else if (_vert_isBoundary(v)) {
+		}
+		else if (_vert_isBoundary(v)) {
 			int numBoundary = 0;
 
 			VertDataZero(r);
-			for (i=0; i<v->numEdges; i++) {
+			for (i = 0; i < v->numEdges; i++) {
 				CCGEdge *e = v->edges[i];
 				if (_edge_isBoundary(e)) {
 					VertDataAdd(r, VERT_getCo(_edge_getOtherVert(e, v), curLvl));
@@ -1981,34 +2192,35 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) {
 			}
 			VertDataCopy(nCo, co);
 			VertDataMulN(nCo, 0.75f);
-			VertDataMulN(r, 0.25f/numBoundary);
+			VertDataMulN(r, 0.25f / numBoundary);
 			VertDataAdd(nCo, r);
-		} else {
+		}
+		else {
 			int numEdges = 0, numFaces = 0;
 
 			VertDataZero(q);
-			for (i=0; i<v->numFaces; i++) {
+			for (i = 0; i < v->numFaces; i++) {
 				CCGFace *f = v->faces[i];
 				VertDataAdd(q, FACE_getCenterData(f));
 				numFaces++;
 			}
-			VertDataMulN(q, 1.0f/numFaces);
+			VertDataMulN(q, 1.0f / numFaces);
 			VertDataZero(r);
-			for (i=0; i<v->numEdges; i++) {
+			for (i = 0; i < v->numEdges; i++) {
 				CCGEdge *e = v->edges[i];
 				VertDataAdd(r, VERT_getCo(_edge_getOtherVert(e, v), curLvl));
 				numEdges++;
 			}
-			VertDataMulN(r, 1.0f/numEdges);
+			VertDataMulN(r, 1.0f / numEdges);
 
 			VertDataCopy(nCo, co);
-			VertDataMulN(nCo, numEdges-2.0f);
+			VertDataMulN(nCo, numEdges - 2.0f);
 			VertDataAdd(nCo, q);
 			VertDataAdd(nCo, r);
-			VertDataMulN(nCo, 1.0f/numEdges);
+			VertDataMulN(nCo, 1.0f / numEdges);
 		}
 
-		if (sharpCount>1 || seam) {
+		if (sharpCount > 1 || seam) {
 			VertDataZero(q);
 
 			if (seam) {
@@ -2017,7 +2229,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) {
 				allSharp = 1;
 			}
 
-			for (i=0; i<v->numEdges; i++) {
+			for (i = 0; i < v->numEdges; i++) {
 				CCGEdge *e = v->edges[i];
 				float sharpness = EDGE_getSharpness(e, curLvl);
 
@@ -2026,29 +2238,30 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) {
 						CCGVert *oV = _edge_getOtherVert(e, v);
 						VertDataAdd(q, VERT_getCo(oV, curLvl));
 					}
-				} else if (sharpness != 0.0f) {
+				}
+				else if (sharpness != 0.0f) {
 					CCGVert *oV = _edge_getOtherVert(e, v);
 					VertDataAdd(q, VERT_getCo(oV, curLvl));
 				}
 			}
 
-			VertDataMulN(q, (float) 1/sharpCount);
+			VertDataMulN(q, (float) 1 / sharpCount);
 
-			if (sharpCount!=2 || allSharp) {
-					// q = q + (co-q)*avgSharpness
+			if (sharpCount != 2 || allSharp) {
+				/* q = q + (co - q) * avgSharpness */
 				VertDataCopy(r, co);
 				VertDataSub(r, q);
 				VertDataMulN(r, avgSharpness);
 				VertDataAdd(q, r);
 			}
 
-				// r = co*.75 + q*.25
+			/* r = co * 0.75 + q * 0.25 */
 			VertDataCopy(r, co);
 			VertDataMulN(r, 0.75f);
 			VertDataMulN(q, 0.25f);
 			VertDataAdd(r, q);
 
-				// nCo = nCo  + (r-nCo)*avgSharpness
+			/* nCo = nCo  + (r - nCo) * avgSharpness */
 			VertDataSub(r, nCo);
 			VertDataMulN(r, avgSharpness);
 			VertDataAdd(nCo, r);
@@ -2058,35 +2271,35 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) {
 	}
 
 	if (ss->useAgeCounts) {
-		for (i=0; i<numEffectedV; i++) {
+		for (i = 0; i < numEffectedV; i++) {
 			CCGVert *v = effectedV[i];
 			byte *userData = ccgSubSurf_getVertUserData(ss, v);
-			*((int*) &userData[ss->vertUserAgeOffset]) = ss->currentAge;
+			*((int *) &userData[ss->vertUserAgeOffset]) = ss->currentAge;
 		}
 
-		for (i=0; i<numEffectedE; i++) {
+		for (i = 0; i < numEffectedE; i++) {
 			CCGEdge *e = effectedE[i];
 			byte *userData = ccgSubSurf_getEdgeUserData(ss, e);
-			*((int*) &userData[ss->edgeUserAgeOffset]) = ss->currentAge;
+			*((int *) &userData[ss->edgeUserAgeOffset]) = ss->currentAge;
 		}
 
-		for (i=0; i<numEffectedF; i++) {
+		for (i = 0; i < numEffectedF; i++) {
 			CCGFace *f = effectedF[i];
 			byte *userData = ccgSubSurf_getFaceUserData(ss, f);
-			*((int*) &userData[ss->faceUserAgeOffset]) = ss->currentAge;
+			*((int *) &userData[ss->faceUserAgeOffset]) = ss->currentAge;
 		}
 	}
 
-	for (i=0; i<numEffectedE; i++) {
+	for (i = 0; i < numEffectedE; i++) {
 		CCGEdge *e = effectedE[i];
 		VertDataCopy(EDGE_getCo(e, nextLvl, 0), VERT_getCo(e->v0, nextLvl));
 		VertDataCopy(EDGE_getCo(e, nextLvl, 2), VERT_getCo(e->v1, nextLvl));
 	}
-	for (i=0; i<numEffectedF; i++) {
+	for (i = 0; i < numEffectedF; i++) {
 		CCGFace *f = effectedF[i];
-		for (S=0; S<f->numVerts; S++) {
+		for (S = 0; S < f->numVerts; S++) {
 			CCGEdge *e = FACE_getEdges(f)[S];
-			CCGEdge *prevE = FACE_getEdges(f)[(S+f->numVerts-1)%f->numVerts];
+			CCGEdge *prevE = FACE_getEdges(f)[(S + f->numVerts - 1) % f->numVerts];
 
 			VertDataCopy(FACE_getIFCo(f, nextLvl, S, 0, 0), FACE_getCenterData(f));
 			VertDataCopy(FACE_getIECo(f, nextLvl, S, 0), FACE_getCenterData(f));
@@ -2098,22 +2311,22 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) {
 		}
 	}
 
-	for (curLvl=1; curLvl<subdivLevels; curLvl++) {
+	for (curLvl = 1; curLvl < subdivLevels; curLvl++) {
 		ccgSubSurf__calcSubdivLevel(ss,
-			effectedV, effectedE, effectedF,
-			numEffectedV, numEffectedE, numEffectedF, curLvl);
+		                            effectedV, effectedE, effectedF,
+		                            numEffectedV, numEffectedE, numEffectedF, curLvl);
 	}
 
 	if (ss->calcVertNormals)
 		ccgSubSurf__calcVertNormals(ss,
-			effectedV, effectedE, effectedF,
-			numEffectedV, numEffectedE, numEffectedF);
+		                            effectedV, effectedE, effectedF,
+		                            numEffectedV, numEffectedE, numEffectedF);
 
-	for (ptrIdx=0; ptrIdx<numEffectedV; ptrIdx++) {
+	for (ptrIdx = 0; ptrIdx < numEffectedV; ptrIdx++) {
 		CCGVert *v = effectedV[ptrIdx];
 		v->flags = 0;
 	}
-	for (ptrIdx=0; ptrIdx<numEffectedE; ptrIdx++) {
+	for (ptrIdx = 0; ptrIdx < numEffectedE; ptrIdx++) {
 		CCGEdge *e = effectedE[ptrIdx];
 		e->flags = 0;
 	}
@@ -2128,11 +2341,11 @@ static void ccgSubSurf__allFaces(CCGSubSurf *ss, CCGFace ***faces, int *numFaces
 	CCGFace **array;
 	int i, num;
 
-	if(!*faces) {
-		array = MEM_mallocN(sizeof(*array)*ss->fMap->numEntries, "CCGSubsurf allFaces");
+	if (!*faces) {
+		array = MEM_mallocN(sizeof(*array) * ss->fMap->numEntries, "CCGSubsurf allFaces");
 		num = 0;
-		for (i=0; i<ss->fMap->curSize; i++) {
-			CCGFace *f = (CCGFace*) ss->fMap->buckets[i];
+		for (i = 0; i < ss->fMap->curSize; i++) {
+			CCGFace *f = (CCGFace *) ss->fMap->buckets[i];
 
 			for (; f; f = f->next)
 				array[num++] = f;
@@ -2140,10 +2353,11 @@ static void ccgSubSurf__allFaces(CCGSubSurf *ss, CCGFace ***faces, int *numFaces
 
 		*faces = array;
 		*numFaces = num;
-		*freeFaces= 1;
+		*freeFaces = 1;
+	}
+	else {
+		*freeFaces = 0;
 	}
-	else
-		*freeFaces= 0;
 }
 
 static void ccgSubSurf__effectedFaceNeighbours(CCGSubSurf *ss, CCGFace **faces, int numFaces, CCGVert ***verts, int *numVerts, CCGEdge ***edges, int *numEdges)
@@ -2152,39 +2366,39 @@ static void ccgSubSurf__effectedFaceNeighbours(CCGSubSurf *ss, CCGFace **faces,
 	CCGEdge **arrayE;
 	int numV, numE, i, j;
 
-	arrayV = MEM_mallocN(sizeof(*arrayV)*ss->vMap->numEntries, "CCGSubsurf arrayV");
-	arrayE = MEM_mallocN(sizeof(*arrayE)*ss->eMap->numEntries, "CCGSubsurf arrayV");
+	arrayV = MEM_mallocN(sizeof(*arrayV) * ss->vMap->numEntries, "CCGSubsurf arrayV");
+	arrayE = MEM_mallocN(sizeof(*arrayE) * ss->eMap->numEntries, "CCGSubsurf arrayV");
 	numV = numE = 0;
 
-	for (i=0; i<numFaces; i++) {
+	for (i = 0; i < numFaces; i++) {
 		CCGFace *f = faces[i];
 		f->flags |= Face_eEffected;
 	}
 
-	for (i=0; i<ss->vMap->curSize; i++) {
-		CCGVert *v = (CCGVert*) ss->vMap->buckets[i];
+	for (i = 0; i < ss->vMap->curSize; i++) {
+		CCGVert *v = (CCGVert *) ss->vMap->buckets[i];
 
 		for (; v; v = v->next) {
-			for(j=0; j<v->numFaces; j++)
-				if(!(v->faces[j]->flags & Face_eEffected))
+			for (j = 0; j < v->numFaces; j++)
+				if (!(v->faces[j]->flags & Face_eEffected))
 					break;
 			
-			if(j == v->numFaces) {
+			if (j == v->numFaces) {
 				arrayV[numV++] = v;
 				v->flags |= Vert_eEffected;
 			}
 		}
 	}
 
-	for (i=0; i<ss->eMap->curSize; i++) {
-		CCGEdge *e = (CCGEdge*) ss->eMap->buckets[i];
+	for (i = 0; i < ss->eMap->curSize; i++) {
+		CCGEdge *e = (CCGEdge *) ss->eMap->buckets[i];
 
 		for (; e; e = e->next) {
-			for(j=0; j<e->numFaces; j++)
-				if(!(e->faces[j]->flags & Face_eEffected))
+			for (j = 0; j < e->numFaces; j++)
+				if (!(e->faces[j]->flags & Face_eEffected))
 					break;
 			
-			if(j == e->numFaces) {
+			if (j == e->numFaces) {
 				e->flags |= Edge_eEffected;
 				arrayE[numE++] = e;
 			}
@@ -2204,34 +2418,34 @@ CCGError ccgSubSurf_updateFromFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF
 	int vertDataSize = ss->meshIFC.vertDataSize, freeF;
 
 	subdivLevels = ss->subdivLevels;
-	lvl = (lvl)? lvl: subdivLevels;
-	gridSize = 1 + (1<<(lvl-1));
-	cornerIdx = gridSize-1;
+	lvl = (lvl) ? lvl : subdivLevels;
+	gridSize = ccg_gridsize(lvl);
+	cornerIdx = gridSize - 1;
 
 	ccgSubSurf__allFaces(ss, &effectedF, &numEffectedF, &freeF);
 
-	for (i=0; i<numEffectedF; i++) {
+	for (i = 0; i < numEffectedF; i++) {
 		CCGFace *f = effectedF[i];
 
-		for (S=0; S<f->numVerts; S++) {
+		for (S = 0; S < f->numVerts; S++) {
 			CCGEdge *e = FACE_getEdges(f)[S];
-			CCGEdge *prevE = FACE_getEdges(f)[(S+f->numVerts-1)%f->numVerts];
+			CCGEdge *prevE = FACE_getEdges(f)[(S + f->numVerts - 1) % f->numVerts];
 
 			VertDataCopy(FACE_getCenterData(f), FACE_getIFCo(f, lvl, S, 0, 0));
 			VertDataCopy(VERT_getCo(FACE_getVerts(f)[S], lvl), FACE_getIFCo(f, lvl, S, cornerIdx, cornerIdx));
 
-			for (x=0; x<gridSize; x++)
+			for (x = 0; x < gridSize; x++)
 				VertDataCopy(FACE_getIECo(f, lvl, S, x), FACE_getIFCo(f, lvl, S, x, 0));
 
-			for (x=0; x<gridSize; x++) {
-				int eI = gridSize-1-x;
-				VertDataCopy(_edge_getCoVert(e, FACE_getVerts(f)[S], lvl, eI,vertDataSize), FACE_getIFCo(f, lvl, S, cornerIdx, x));
-				VertDataCopy(_edge_getCoVert(prevE, FACE_getVerts(f)[S], lvl, eI,vertDataSize), FACE_getIFCo(f, lvl, S, x, cornerIdx));
+			for (x = 0; x < gridSize; x++) {
+				int eI = gridSize - 1 - x;
+				VertDataCopy(_edge_getCoVert(e, FACE_getVerts(f)[S], lvl, eI, vertDataSize), FACE_getIFCo(f, lvl, S, cornerIdx, x));
+				VertDataCopy(_edge_getCoVert(prevE, FACE_getVerts(f)[S], lvl, eI, vertDataSize), FACE_getIFCo(f, lvl, S, x, cornerIdx));
 			}
 		}
 	}
 
-	if(freeF) MEM_freeN(effectedF);
+	if (freeF) MEM_freeN(effectedF);
 
 	return eCCGError_None;
 }
@@ -2243,27 +2457,27 @@ CCGError ccgSubSurf_updateToFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF,
 	int vertDataSize = ss->meshIFC.vertDataSize, freeF;
 
 	subdivLevels = ss->subdivLevels;
-	lvl = (lvl)? lvl: subdivLevels;
-	gridSize = 1 + (1<<(lvl-1));
-	cornerIdx = gridSize-1;
+	lvl = (lvl) ? lvl : subdivLevels;
+	gridSize = ccg_gridsize(lvl);
+	cornerIdx = gridSize - 1;
 
 	ccgSubSurf__allFaces(ss, &effectedF, &numEffectedF, &freeF);
 
-	for (i=0; i<numEffectedF; i++) {
+	for (i = 0; i < numEffectedF; i++) {
 		CCGFace *f = effectedF[i];
 
-		for (S=0; S<f->numVerts; S++) {
-			int prevS = (S+f->numVerts-1)%f->numVerts;
+		for (S = 0; S < f->numVerts; S++) {
+			int prevS = (S + f->numVerts - 1) % f->numVerts;
 			CCGEdge *e = FACE_getEdges(f)[S];
 			CCGEdge *prevE = FACE_getEdges(f)[prevS];
 
-			for (x=0; x<gridSize; x++) {
-				int eI = gridSize-1-x;
-				VertDataCopy(FACE_getIFCo(f, lvl, S, cornerIdx, x), _edge_getCoVert(e, FACE_getVerts(f)[S], lvl, eI,vertDataSize));
-				VertDataCopy(FACE_getIFCo(f, lvl, S, x, cornerIdx), _edge_getCoVert(prevE, FACE_getVerts(f)[S], lvl, eI,vertDataSize));
+			for (x = 0; x < gridSize; x++) {
+				int eI = gridSize - 1 - x;
+				VertDataCopy(FACE_getIFCo(f, lvl, S, cornerIdx, x), _edge_getCoVert(e, FACE_getVerts(f)[S], lvl, eI, vertDataSize));
+				VertDataCopy(FACE_getIFCo(f, lvl, S, x, cornerIdx), _edge_getCoVert(prevE, FACE_getVerts(f)[S], lvl, eI, vertDataSize));
 			}
 
-			for (x=1; x<gridSize-1; x++) {
+			for (x = 1; x < gridSize - 1; x++) {
 				VertDataCopy(FACE_getIFCo(f, lvl, S, 0, x), FACE_getIECo(f, lvl, prevS, x));
 				VertDataCopy(FACE_getIFCo(f, lvl, S, x, 0), FACE_getIECo(f, lvl, S, x));
 			}
@@ -2273,13 +2487,13 @@ CCGError ccgSubSurf_updateToFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF,
 		}
 	}
 
-	if(freeF) MEM_freeN(effectedF);
+	if (freeF) MEM_freeN(effectedF);
 
 	return eCCGError_None;
 }
 
 /* stitch together face grids, averaging coordinates at edges
-   and vertices, for multires displacements */
+ * and vertices, for multires displacements */
 CCGError ccgSubSurf_stitchFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF, int numEffectedF)
 {
 	CCGVert **effectedV;
@@ -2289,163 +2503,164 @@ CCGError ccgSubSurf_stitchFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF, in
 	int vertDataSize = ss->meshIFC.vertDataSize;
 
 	subdivLevels = ss->subdivLevels;
-	lvl = (lvl)? lvl: subdivLevels;
-	gridSize = 1 + (1<<(lvl-1));
-	edgeSize = 1 + (1<<lvl);
-	cornerIdx = gridSize-1;
+	lvl = (lvl) ? lvl : subdivLevels;
+	gridSize = ccg_gridsize(lvl);
+	edgeSize = ccg_edgesize(lvl);
+	cornerIdx = gridSize - 1;
 
 	ccgSubSurf__allFaces(ss, &effectedF, &numEffectedF, &freeF);
 	ccgSubSurf__effectedFaceNeighbours(ss, effectedF, numEffectedF,
-		&effectedV, &numEffectedV, &effectedE, &numEffectedE);
+	                                   &effectedV, &numEffectedV, &effectedE, &numEffectedE);
 
 	/* zero */
-	for (i=0; i<numEffectedV; i++) {
+	for (i = 0; i < numEffectedV; i++) {
 		CCGVert *v = effectedV[i];
-		if(v->numFaces)
+		if (v->numFaces)
 			VertDataZero(VERT_getCo(v, lvl));
 	}
 
-	for (i=0; i<numEffectedE; i++) {
+	for (i = 0; i < numEffectedE; i++) {
 		CCGEdge *e = effectedE[i];
 
-		if(e->numFaces)
-			for (x=0; x<edgeSize; x++)
+		if (e->numFaces)
+			for (x = 0; x < edgeSize; x++)
 				VertDataZero(EDGE_getCo(e, lvl, x));
 	}
 
 	/* add */
-	for (i=0; i<numEffectedF; i++) {
+	for (i = 0; i < numEffectedF; i++) {
 		CCGFace *f = effectedF[i];
 
 		VertDataZero(FACE_getCenterData(f));
 
-		for (S=0; S<f->numVerts; S++)
-			for (x=0; x<gridSize; x++)
+		for (S = 0; S < f->numVerts; S++)
+			for (x = 0; x < gridSize; x++)
 				VertDataZero(FACE_getIECo(f, lvl, S, x));
 
-		for (S=0; S<f->numVerts; S++) {
-			int prevS = (S+f->numVerts-1)%f->numVerts;
+		for (S = 0; S < f->numVerts; S++) {
+			int prevS = (S + f->numVerts - 1) % f->numVerts;
 			CCGEdge *e = FACE_getEdges(f)[S];
 			CCGEdge *prevE = FACE_getEdges(f)[prevS];
 
 			VertDataAdd(FACE_getCenterData(f), FACE_getIFCo(f, lvl, S, 0, 0));
-			if (FACE_getVerts(f)[S]->flags&Vert_eEffected)
+			if (FACE_getVerts(f)[S]->flags & Vert_eEffected)
 				VertDataAdd(VERT_getCo(FACE_getVerts(f)[S], lvl), FACE_getIFCo(f, lvl, S, cornerIdx, cornerIdx));
 
-			for (x=1; x<gridSize-1; x++) {
+			for (x = 1; x < gridSize - 1; x++) {
 				VertDataAdd(FACE_getIECo(f, lvl, S, x), FACE_getIFCo(f, lvl, S, x, 0));
 				VertDataAdd(FACE_getIECo(f, lvl, prevS, x), FACE_getIFCo(f, lvl, S, 0, x));
 			}
 
-			for (x=0; x<gridSize-1; x++) {
-				int eI = gridSize-1-x;
-				if (FACE_getEdges(f)[S]->flags&Edge_eEffected)
-					VertDataAdd(_edge_getCoVert(e, FACE_getVerts(f)[S], lvl, eI,vertDataSize), FACE_getIFCo(f, lvl, S, cornerIdx, x));
-				if (FACE_getEdges(f)[prevS]->flags&Edge_eEffected)
-					if(x != 0)
-						VertDataAdd(_edge_getCoVert(prevE, FACE_getVerts(f)[S], lvl, eI,vertDataSize), FACE_getIFCo(f, lvl, S, x, cornerIdx));
+			for (x = 0; x < gridSize - 1; x++) {
+				int eI = gridSize - 1 - x;
+				if (FACE_getEdges(f)[S]->flags & Edge_eEffected)
+					VertDataAdd(_edge_getCoVert(e, FACE_getVerts(f)[S], lvl, eI, vertDataSize), FACE_getIFCo(f, lvl, S, cornerIdx, x));
+				if (FACE_getEdges(f)[prevS]->flags & Edge_eEffected)
+					if (x != 0)
+						VertDataAdd(_edge_getCoVert(prevE, FACE_getVerts(f)[S], lvl, eI, vertDataSize), FACE_getIFCo(f, lvl, S, x, cornerIdx));
 			}
 		}
 	}
 
 	/* average */
-	for (i=0; i<numEffectedV; i++) {
+	for (i = 0; i < numEffectedV; i++) {
 		CCGVert *v = effectedV[i];
-		if(v->numFaces)
-			VertDataMulN(VERT_getCo(v, lvl), 1.0f/v->numFaces);
+		if (v->numFaces)
+			VertDataMulN(VERT_getCo(v, lvl), 1.0f / v->numFaces);
 	}
 
-	for (i=0; i<numEffectedE; i++) {
+	for (i = 0; i < numEffectedE; i++) {
 		CCGEdge *e = effectedE[i];
 
 		VertDataCopy(EDGE_getCo(e, lvl, 0), VERT_getCo(e->v0, lvl));
-		VertDataCopy(EDGE_getCo(e, lvl, edgeSize-1), VERT_getCo(e->v1, lvl));
+		VertDataCopy(EDGE_getCo(e, lvl, edgeSize - 1), VERT_getCo(e->v1, lvl));
 
-		if(e->numFaces)
-			for (x=1; x<edgeSize-1; x++)
-				VertDataMulN(EDGE_getCo(e, lvl, x), 1.0f/e->numFaces);
+		if (e->numFaces)
+			for (x = 1; x < edgeSize - 1; x++)
+				VertDataMulN(EDGE_getCo(e, lvl, x), 1.0f / e->numFaces);
 	}
 
 	/* copy */
-	for (i=0; i<numEffectedF; i++) {
+	for (i = 0; i < numEffectedF; i++) {
 		CCGFace *f = effectedF[i];
 
-		VertDataMulN(FACE_getCenterData(f), 1.0f/f->numVerts);
+		VertDataMulN(FACE_getCenterData(f), 1.0f / f->numVerts);
 
-		for (S=0; S<f->numVerts; S++)
-			for (x=1; x<gridSize-1; x++)
+		for (S = 0; S < f->numVerts; S++)
+			for (x = 1; x < gridSize - 1; x++)
 				VertDataMulN(FACE_getIECo(f, lvl, S, x), 0.5f);
 
-		for (S=0; S<f->numVerts; S++) {
-			int prevS = (S+f->numVerts-1)%f->numVerts;
+		for (S = 0; S < f->numVerts; S++) {
+			int prevS = (S + f->numVerts - 1) % f->numVerts;
 			CCGEdge *e = FACE_getEdges(f)[S];
 			CCGEdge *prevE = FACE_getEdges(f)[prevS];
 
 			VertDataCopy(FACE_getIFCo(f, lvl, S, 0, 0), FACE_getCenterData(f));
 			VertDataCopy(FACE_getIFCo(f, lvl, S, cornerIdx, cornerIdx), VERT_getCo(FACE_getVerts(f)[S], lvl));
 
-			for (x=1; x<gridSize-1; x++) {
+			for (x = 1; x < gridSize - 1; x++) {
 				VertDataCopy(FACE_getIFCo(f, lvl, S, x, 0), FACE_getIECo(f, lvl, S, x));
 				VertDataCopy(FACE_getIFCo(f, lvl, S, 0, x), FACE_getIECo(f, lvl, prevS, x));
 			}
 
-			for (x=0; x<gridSize-1; x++) {
-				int eI = gridSize-1-x;
-				VertDataCopy(FACE_getIFCo(f, lvl, S, cornerIdx, x), _edge_getCoVert(e, FACE_getVerts(f)[S], lvl, eI,vertDataSize));
-				VertDataCopy(FACE_getIFCo(f, lvl, S, x, cornerIdx), _edge_getCoVert(prevE, FACE_getVerts(f)[S], lvl, eI,vertDataSize));
+			for (x = 0; x < gridSize - 1; x++) {
+				int eI = gridSize - 1 - x;
+				VertDataCopy(FACE_getIFCo(f, lvl, S, cornerIdx, x), _edge_getCoVert(e, FACE_getVerts(f)[S], lvl, eI, vertDataSize));
+				VertDataCopy(FACE_getIFCo(f, lvl, S, x, cornerIdx), _edge_getCoVert(prevE, FACE_getVerts(f)[S], lvl, eI, vertDataSize));
 			}
 
 			VertDataCopy(FACE_getIECo(f, lvl, S, 0), FACE_getCenterData(f));
-			VertDataCopy(FACE_getIECo(f, lvl, S, gridSize-1), FACE_getIFCo(f, lvl, S, gridSize-1, 0));
+			VertDataCopy(FACE_getIECo(f, lvl, S, gridSize - 1), FACE_getIFCo(f, lvl, S, gridSize - 1, 0));
 		}
 	}
 
-	for (i=0; i<numEffectedV; i++)
+	for (i = 0; i < numEffectedV; i++)
 		effectedV[i]->flags = 0;
-	for (i=0; i<numEffectedE; i++)
+	for (i = 0; i < numEffectedE; i++)
 		effectedE[i]->flags = 0;
-	for (i=0; i<numEffectedF; i++)
+	for (i = 0; i < numEffectedF; i++)
 		effectedF[i]->flags = 0;
 
 	MEM_freeN(effectedE);
 	MEM_freeN(effectedV);
-	if(freeF) MEM_freeN(effectedF);
+	if (freeF) MEM_freeN(effectedF);
 
 	return eCCGError_None;
 }
 
 /* update normals for specified faces */
-CCGError ccgSubSurf_updateNormals(CCGSubSurf *ss, CCGFace **effectedF, int numEffectedF) {
+CCGError ccgSubSurf_updateNormals(CCGSubSurf *ss, CCGFace **effectedF, int numEffectedF)
+{
 	CCGVert **effectedV;
 	CCGEdge **effectedE;
 	int i, numEffectedV, numEffectedE, freeF;
 
 	ccgSubSurf__allFaces(ss, &effectedF, &numEffectedF, &freeF);
 	ccgSubSurf__effectedFaceNeighbours(ss, effectedF, numEffectedF,
-		&effectedV, &numEffectedV, &effectedE, &numEffectedE);
+	                                   &effectedV, &numEffectedV, &effectedE, &numEffectedE);
 
 	if (ss->calcVertNormals)
 		ccgSubSurf__calcVertNormals(ss,
-			effectedV, effectedE, effectedF,
-			numEffectedV, numEffectedE, numEffectedF);
+		                            effectedV, effectedE, effectedF,
+		                            numEffectedV, numEffectedE, numEffectedF);
 
-	for (i=0; i<numEffectedV; i++)
+	for (i = 0; i < numEffectedV; i++)
 		effectedV[i]->flags = 0;
-	for (i=0; i<numEffectedE; i++)
+	for (i = 0; i < numEffectedE; i++)
 		effectedE[i]->flags = 0;
-	for (i=0; i<numEffectedF; i++)
+	for (i = 0; i < numEffectedF; i++)
 		effectedF[i]->flags = 0;
 
 	MEM_freeN(effectedE);
 	MEM_freeN(effectedV);
-	if(freeF) MEM_freeN(effectedF);
+	if (freeF) MEM_freeN(effectedF);
 
 	return eCCGError_None;
 }
 
 /* compute subdivision levels from a given starting point, used by
-   multires subdivide/propagate, by filling in coordinates at a
-   certain level, and then subdividing that up to the highest level */
+ * multires subdivide/propagate, by filling in coordinates at a
+ * certain level, and then subdividing that up to the highest level */
 CCGError ccgSubSurf_updateLevels(CCGSubSurf *ss, int lvl, CCGFace **effectedF, int numEffectedF)
 {
 	CCGVert **effectedV;
@@ -2455,24 +2670,24 @@ CCGError ccgSubSurf_updateLevels(CCGSubSurf *ss, int lvl, CCGFace **effectedF, i
 
 	ccgSubSurf__allFaces(ss, &effectedF, &numEffectedF, &freeF);
 	ccgSubSurf__effectedFaceNeighbours(ss, effectedF, numEffectedF,
-		&effectedV, &numEffectedV, &effectedE, &numEffectedE);
+	                                   &effectedV, &numEffectedV, &effectedE, &numEffectedE);
 
-	for (curLvl=lvl; curLvl<subdivLevels; curLvl++) {
+	for (curLvl = lvl; curLvl < subdivLevels; curLvl++) {
 		ccgSubSurf__calcSubdivLevel(ss,
-			effectedV, effectedE, effectedF,
-			numEffectedV, numEffectedE, numEffectedF, curLvl);
+		                            effectedV, effectedE, effectedF,
+		                            numEffectedV, numEffectedE, numEffectedF, curLvl);
 	}
 
-	for (i=0; i<numEffectedV; i++)
+	for (i = 0; i < numEffectedV; i++)
 		effectedV[i]->flags = 0;
-	for (i=0; i<numEffectedE; i++)
+	for (i = 0; i < numEffectedE; i++)
 		effectedE[i]->flags = 0;
-	for (i=0; i<numEffectedF; i++)
+	for (i = 0; i < numEffectedF; i++)
 		effectedF[i]->flags = 0;
 
 	MEM_freeN(effectedE);
 	MEM_freeN(effectedV);
-	if(freeF) MEM_freeN(effectedF);
+	if (freeF) MEM_freeN(effectedF);
 
 	return eCCGError_None;
 }
@@ -2484,272 +2699,353 @@ CCGError ccgSubSurf_updateLevels(CCGSubSurf *ss, int lvl, CCGFace **effectedF, i
 
 /*** External API accessor functions ***/
 
-int ccgSubSurf_getNumVerts(const CCGSubSurf *ss) {
+int ccgSubSurf_getNumVerts(const CCGSubSurf *ss)
+{
 	return ss->vMap->numEntries;
 }
-int ccgSubSurf_getNumEdges(const CCGSubSurf *ss) {
+int ccgSubSurf_getNumEdges(const CCGSubSurf *ss)
+{
 	return ss->eMap->numEntries;
 }
-int ccgSubSurf_getNumFaces(const CCGSubSurf *ss) {
+int ccgSubSurf_getNumFaces(const CCGSubSurf *ss)
+{
 	return ss->fMap->numEntries;
 }
 
-CCGVert *ccgSubSurf_getVert(CCGSubSurf *ss, CCGVertHDL v) {
-	return (CCGVert*) _ehash_lookup(ss->vMap, v);
+CCGVert *ccgSubSurf_getVert(CCGSubSurf *ss, CCGVertHDL v)
+{
+	return (CCGVert *) _ehash_lookup(ss->vMap, v);
 }
-CCGEdge *ccgSubSurf_getEdge(CCGSubSurf *ss, CCGEdgeHDL e) {
-	return (CCGEdge*) _ehash_lookup(ss->eMap, e);
+CCGEdge *ccgSubSurf_getEdge(CCGSubSurf *ss, CCGEdgeHDL e)
+{
+	return (CCGEdge *) _ehash_lookup(ss->eMap, e);
 }
-CCGFace *ccgSubSurf_getFace(CCGSubSurf *ss, CCGFaceHDL f) {
-	return (CCGFace*) _ehash_lookup(ss->fMap, f);
+CCGFace *ccgSubSurf_getFace(CCGSubSurf *ss, CCGFaceHDL f)
+{
+	return (CCGFace *) _ehash_lookup(ss->fMap, f);
 }
 
-int ccgSubSurf_getSubdivisionLevels(const CCGSubSurf *ss) {
+int ccgSubSurf_getSubdivisionLevels(const CCGSubSurf *ss)
+{
 	return ss->subdivLevels;
 }
-int ccgSubSurf_getEdgeSize(const CCGSubSurf *ss) {
+int ccgSubSurf_getEdgeSize(const CCGSubSurf *ss)
+{
 	return ccgSubSurf_getEdgeLevelSize(ss, ss->subdivLevels);
 }
-int ccgSubSurf_getEdgeLevelSize(const CCGSubSurf *ss, int level) {
-	if (level<1 || level>ss->subdivLevels) {
+int ccgSubSurf_getEdgeLevelSize(const CCGSubSurf *ss, int level)
+{
+	if (level < 1 || level > ss->subdivLevels) {
 		return -1;
-	} else {
-		return 1 + (1<<level);
+	}
+	else {
+		return ccg_edgesize(level);
 	}
 }
-int ccgSubSurf_getGridSize(const CCGSubSurf *ss) {
+int ccgSubSurf_getGridSize(const CCGSubSurf *ss)
+{
 	return ccgSubSurf_getGridLevelSize(ss, ss->subdivLevels);
 }
-int ccgSubSurf_getGridLevelSize(const CCGSubSurf *ss, int level) {
-	if (level<1 || level>ss->subdivLevels) {
+int ccgSubSurf_getGridLevelSize(const CCGSubSurf *ss, int level)
+{
+	if (level < 1 || level > ss->subdivLevels) {
 		return -1;
-	} else {
-		return 1 + (1<<(level-1));
+	}
+	else {
+		return ccg_gridsize(level);
 	}
 }
 
 /* Vert accessors */
 
-CCGVertHDL ccgSubSurf_getVertVertHandle(CCGVert *v) {
+CCGVertHDL ccgSubSurf_getVertVertHandle(CCGVert *v)
+{
 	return v->vHDL;
 }
-int ccgSubSurf_getVertAge(CCGSubSurf *ss, CCGVert *v) {
+int ccgSubSurf_getVertAge(CCGSubSurf *ss, CCGVert *v)
+{
 	if (ss->useAgeCounts) {
 		byte *userData = ccgSubSurf_getVertUserData(ss, v);
-		return ss->currentAge - *((int*) &userData[ss->vertUserAgeOffset]);
-	} else {
+		return ss->currentAge - *((int *) &userData[ss->vertUserAgeOffset]);
+	}
+	else {
 		return 0;
 	}
 }
-void *ccgSubSurf_getVertUserData(CCGSubSurf *ss, CCGVert *v) {
-	return VERT_getLevelData(v) + ss->meshIFC.vertDataSize*(ss->subdivLevels+1);
+void *ccgSubSurf_getVertUserData(CCGSubSurf *ss, CCGVert *v)
+{
+	return VERT_getLevelData(v) + ss->meshIFC.vertDataSize * (ss->subdivLevels + 1);
 }
-int ccgSubSurf_getVertNumFaces(CCGVert *v) {
+int ccgSubSurf_getVertNumFaces(CCGVert *v)
+{
 	return v->numFaces;
 }
-CCGFace *ccgSubSurf_getVertFace(CCGVert *v, int index) {
-	if (index<0 || index>=v->numFaces) {
+CCGFace *ccgSubSurf_getVertFace(CCGVert *v, int index)
+{
+	if (index < 0 || index >= v->numFaces) {
 		return NULL;
-	} else {
+	}
+	else {
 		return v->faces[index];
 	}
 }
-int ccgSubSurf_getVertNumEdges(CCGVert *v) {
+int ccgSubSurf_getVertNumEdges(CCGVert *v)
+{
 	return v->numEdges;
 }
-CCGEdge *ccgSubSurf_getVertEdge(CCGVert *v, int index) {
-	if (index<0 || index>=v->numEdges) {
+CCGEdge *ccgSubSurf_getVertEdge(CCGVert *v, int index)
+{
+	if (index < 0 || index >= v->numEdges) {
 		return NULL;
-	} else {
+	}
+	else {
 		return v->edges[index];
 	}
 }
-void *ccgSubSurf_getVertData(CCGSubSurf *ss, CCGVert *v) {
+void *ccgSubSurf_getVertData(CCGSubSurf *ss, CCGVert *v)
+{
 	return ccgSubSurf_getVertLevelData(ss, v, ss->subdivLevels);
 }
-void *ccgSubSurf_getVertLevelData(CCGSubSurf *ss, CCGVert *v, int level) {
-	if (level<0 || level>ss->subdivLevels) {
+void *ccgSubSurf_getVertLevelData(CCGSubSurf *ss, CCGVert *v, int level)
+{
+	if (level < 0 || level > ss->subdivLevels) {
 		return NULL;
-	} else {
+	}
+	else {
 		return _vert_getCo(v, level, ss->meshIFC.vertDataSize);
 	}
 }
 
 /* Edge accessors */
 
-CCGEdgeHDL ccgSubSurf_getEdgeEdgeHandle(CCGEdge *e) {
+CCGEdgeHDL ccgSubSurf_getEdgeEdgeHandle(CCGEdge *e)
+{
 	return e->eHDL;
 }
-int ccgSubSurf_getEdgeAge(CCGSubSurf *ss, CCGEdge *e) {
+int ccgSubSurf_getEdgeAge(CCGSubSurf *ss, CCGEdge *e)
+{
 	if (ss->useAgeCounts) {
 		byte *userData = ccgSubSurf_getEdgeUserData(ss, e);
-		return ss->currentAge - *((int*) &userData[ss->edgeUserAgeOffset]);
-	} else {
+		return ss->currentAge - *((int *) &userData[ss->edgeUserAgeOffset]);
+	}
+	else {
 		return 0;
 	}
 }
-void *ccgSubSurf_getEdgeUserData(CCGSubSurf *ss, CCGEdge *e) {
-	return EDGE_getLevelData(e) + ss->meshIFC.vertDataSize *((ss->subdivLevels+1) + (1<<(ss->subdivLevels+1))-1);
+void *ccgSubSurf_getEdgeUserData(CCGSubSurf *ss, CCGEdge *e)
+{
+	return (EDGE_getLevelData(e) +
+	        ss->meshIFC.vertDataSize * ccg_edgebase(ss->subdivLevels + 1));
 }
-int ccgSubSurf_getEdgeNumFaces(CCGEdge *e) {
+int ccgSubSurf_getEdgeNumFaces(CCGEdge *e)
+{
 	return e->numFaces;
 }
-CCGFace *ccgSubSurf_getEdgeFace(CCGEdge *e, int index) {
-	if (index<0 || index>=e->numFaces) {
+CCGFace *ccgSubSurf_getEdgeFace(CCGEdge *e, int index)
+{
+	if (index < 0 || index >= e->numFaces) {
 		return NULL;
-	} else {
+	}
+	else {
 		return e->faces[index];
 	}
 }
-CCGVert *ccgSubSurf_getEdgeVert0(CCGEdge *e) {
+CCGVert *ccgSubSurf_getEdgeVert0(CCGEdge *e)
+{
 	return e->v0;
 }
-CCGVert *ccgSubSurf_getEdgeVert1(CCGEdge *e) {
+CCGVert *ccgSubSurf_getEdgeVert1(CCGEdge *e)
+{
 	return e->v1;
 }
-void *ccgSubSurf_getEdgeDataArray(CCGSubSurf *ss, CCGEdge *e) {
+void *ccgSubSurf_getEdgeDataArray(CCGSubSurf *ss, CCGEdge *e)
+{
 	return ccgSubSurf_getEdgeData(ss, e, 0);
 }
-void *ccgSubSurf_getEdgeData(CCGSubSurf *ss, CCGEdge *e, int x) {
+void *ccgSubSurf_getEdgeData(CCGSubSurf *ss, CCGEdge *e, int x)
+{
 	return ccgSubSurf_getEdgeLevelData(ss, e, x, ss->subdivLevels);
 }
-void *ccgSubSurf_getEdgeLevelData(CCGSubSurf *ss, CCGEdge *e, int x, int level) {
-	if (level<0 || level>ss->subdivLevels) {
+void *ccgSubSurf_getEdgeLevelData(CCGSubSurf *ss, CCGEdge *e, int x, int level)
+{
+	if (level < 0 || level > ss->subdivLevels) {
 		return NULL;
-	} else {
+	}
+	else {
 		return _edge_getCo(e, level, x, ss->meshIFC.vertDataSize);
 	}
 }
-float ccgSubSurf_getEdgeCrease(CCGEdge *e) {
+float ccgSubSurf_getEdgeCrease(CCGEdge *e)
+{
 	return e->crease;
 }
 
 /* Face accessors */
 
-CCGFaceHDL ccgSubSurf_getFaceFaceHandle(CCGSubSurf *UNUSED(ss), CCGFace *f) {
+CCGFaceHDL ccgSubSurf_getFaceFaceHandle(CCGFace *f)
+{
 	return f->fHDL;
 }
-int ccgSubSurf_getFaceAge(CCGSubSurf *ss, CCGFace *f) {
+int ccgSubSurf_getFaceAge(CCGSubSurf *ss, CCGFace *f)
+{
 	if (ss->useAgeCounts) {
 		byte *userData = ccgSubSurf_getFaceUserData(ss, f);
-		return ss->currentAge - *((int*) &userData[ss->faceUserAgeOffset]);
-	} else {
+		return ss->currentAge - *((int *) &userData[ss->faceUserAgeOffset]);
+	}
+	else {
 		return 0;
 	}
 }
-void *ccgSubSurf_getFaceUserData(CCGSubSurf *ss, CCGFace *f) {
-	int maxGridSize = 1 + (1<<(ss->subdivLevels-1));
-	return FACE_getCenterData(f) + ss->meshIFC.vertDataSize *(1 + f->numVerts*maxGridSize + f->numVerts*maxGridSize*maxGridSize);
+void *ccgSubSurf_getFaceUserData(CCGSubSurf *ss, CCGFace *f)
+{
+	int maxGridSize = ccg_gridsize(ss->subdivLevels);
+	return FACE_getCenterData(f) + ss->meshIFC.vertDataSize * (1 + f->numVerts * maxGridSize + f->numVerts * maxGridSize * maxGridSize);
 }
-int ccgSubSurf_getFaceNumVerts(CCGFace *f) {
+int ccgSubSurf_getFaceNumVerts(CCGFace *f)
+{
 	return f->numVerts;
 }
-CCGVert *ccgSubSurf_getFaceVert(CCGSubSurf *UNUSED(ss), CCGFace *f, int index) {
-	if (index<0 || index>=f->numVerts) {
+CCGVert *ccgSubSurf_getFaceVert(CCGFace *f, int index)
+{
+	if (index < 0 || index >= f->numVerts) {
 		return NULL;
-	} else {
+	}
+	else {
 		return FACE_getVerts(f)[index];
 	}
 }
-CCGEdge *ccgSubSurf_getFaceEdge(CCGSubSurf *UNUSED(ss), CCGFace *f, int index) {
-	if (index<0 || index>=f->numVerts) {
+CCGEdge *ccgSubSurf_getFaceEdge(CCGFace *f, int index)
+{
+	if (index < 0 || index >= f->numVerts) {
 		return NULL;
-	} else {
+	}
+	else {
 		return FACE_getEdges(f)[index];
 	}
 }
-int ccgSubSurf_getFaceEdgeIndex(CCGFace *f, CCGEdge *e) {
+int ccgSubSurf_getFaceEdgeIndex(CCGFace *f, CCGEdge *e)
+{
 	int i;
 
-	for (i=0; i<f->numVerts; i++)
-		if (FACE_getEdges(f)[i]==e)
+	for (i = 0; i < f->numVerts; i++) {
+		if (FACE_getEdges(f)[i] == e) {
 			return i;
-
+		}
+	}
 	return -1;
 }
-void *ccgSubSurf_getFaceCenterData(CCGFace *f) {
+void *ccgSubSurf_getFaceCenterData(CCGFace *f)
+{
 	return FACE_getCenterData(f);
 }
-void *ccgSubSurf_getFaceGridEdgeDataArray(CCGSubSurf *ss, CCGFace *f, int gridIndex) {
+void *ccgSubSurf_getFaceGridEdgeDataArray(CCGSubSurf *ss, CCGFace *f, int gridIndex)
+{
 	return ccgSubSurf_getFaceGridEdgeData(ss, f, gridIndex, 0);
 }
-void *ccgSubSurf_getFaceGridEdgeData(CCGSubSurf *ss, CCGFace *f, int gridIndex, int x) {
+void *ccgSubSurf_getFaceGridEdgeData(CCGSubSurf *ss, CCGFace *f, int gridIndex, int x)
+{
 	return _face_getIECo(f, ss->subdivLevels, gridIndex, x, ss->subdivLevels, ss->meshIFC.vertDataSize);
 }
-void *ccgSubSurf_getFaceGridDataArray(CCGSubSurf *ss, CCGFace *f, int gridIndex) {
+void *ccgSubSurf_getFaceGridDataArray(CCGSubSurf *ss, CCGFace *f, int gridIndex)
+{
 	return ccgSubSurf_getFaceGridData(ss, f, gridIndex, 0, 0);
 }
-void *ccgSubSurf_getFaceGridData(CCGSubSurf *ss, CCGFace *f, int gridIndex, int x, int y) {
+void *ccgSubSurf_getFaceGridData(CCGSubSurf *ss, CCGFace *f, int gridIndex, int x, int y)
+{
 	return _face_getIFCo(f, ss->subdivLevels, gridIndex, x, y, ss->subdivLevels, ss->meshIFC.vertDataSize);
 }
 
 /*** External API iterator functions ***/
 
-CCGVertIterator *ccgSubSurf_getVertIterator(CCGSubSurf *ss) {
-	return (CCGVertIterator*) _ehashIterator_new(ss->vMap);
+CCGVertIterator *ccgSubSurf_getVertIterator(CCGSubSurf *ss)
+{
+	return (CCGVertIterator *) _ehashIterator_new(ss->vMap);
 }
-CCGEdgeIterator *ccgSubSurf_getEdgeIterator(CCGSubSurf *ss) {
-	return (CCGEdgeIterator*) _ehashIterator_new(ss->eMap);
+CCGEdgeIterator *ccgSubSurf_getEdgeIterator(CCGSubSurf *ss)
+{
+	return (CCGEdgeIterator *) _ehashIterator_new(ss->eMap);
 }
-CCGFaceIterator *ccgSubSurf_getFaceIterator(CCGSubSurf *ss) {
-	return (CCGFaceIterator*) _ehashIterator_new(ss->fMap);
+CCGFaceIterator *ccgSubSurf_getFaceIterator(CCGSubSurf *ss)
+{
+	return (CCGFaceIterator *) _ehashIterator_new(ss->fMap);
 }
 
-CCGVert *ccgVertIterator_getCurrent(CCGVertIterator *vi) {
-	return (CCGVert*) _ehashIterator_getCurrent((EHashIterator*) vi);
+CCGVert *ccgVertIterator_getCurrent(CCGVertIterator *vi)
+{
+	return (CCGVert *) _ehashIterator_getCurrent((EHashIterator *) vi);
 }
-int ccgVertIterator_isStopped(CCGVertIterator *vi) {
-	return _ehashIterator_isStopped((EHashIterator*) vi);
+int ccgVertIterator_isStopped(CCGVertIterator *vi)
+{
+	return _ehashIterator_isStopped((EHashIterator *) vi);
 }
-void ccgVertIterator_next(CCGVertIterator *vi) {
-	_ehashIterator_next((EHashIterator*) vi); 
+void ccgVertIterator_next(CCGVertIterator *vi)
+{
+	_ehashIterator_next((EHashIterator *) vi);
 }
-void ccgVertIterator_free(CCGVertIterator *vi) {
-	_ehashIterator_free((EHashIterator*) vi);
+void ccgVertIterator_free(CCGVertIterator *vi)
+{
+	_ehashIterator_free((EHashIterator *) vi);
 }
 
-CCGEdge *ccgEdgeIterator_getCurrent(CCGEdgeIterator *vi) {
-	return (CCGEdge*) _ehashIterator_getCurrent((EHashIterator*) vi);
+CCGEdge *ccgEdgeIterator_getCurrent(CCGEdgeIterator *vi)
+{
+	return (CCGEdge *) _ehashIterator_getCurrent((EHashIterator *) vi);
 }
-int ccgEdgeIterator_isStopped(CCGEdgeIterator *vi) {
-	return _ehashIterator_isStopped((EHashIterator*) vi);
+int ccgEdgeIterator_isStopped(CCGEdgeIterator *vi)
+{
+	return _ehashIterator_isStopped((EHashIterator *) vi);
 }
-void ccgEdgeIterator_next(CCGEdgeIterator *vi) {
-	_ehashIterator_next((EHashIterator*) vi); 
+void ccgEdgeIterator_next(CCGEdgeIterator *vi)
+{
+	_ehashIterator_next((EHashIterator *) vi);
 }
-void ccgEdgeIterator_free(CCGEdgeIterator *vi) {
-	_ehashIterator_free((EHashIterator*) vi);
+void ccgEdgeIterator_free(CCGEdgeIterator *vi)
+{
+	_ehashIterator_free((EHashIterator *) vi);
 }
 
-CCGFace *ccgFaceIterator_getCurrent(CCGFaceIterator *vi) {
-	return (CCGFace*) _ehashIterator_getCurrent((EHashIterator*) vi);
+CCGFace *ccgFaceIterator_getCurrent(CCGFaceIterator *vi)
+{
+	return (CCGFace *) _ehashIterator_getCurrent((EHashIterator *) vi);
 }
-int ccgFaceIterator_isStopped(CCGFaceIterator *vi) {
-	return _ehashIterator_isStopped((EHashIterator*) vi);
+int ccgFaceIterator_isStopped(CCGFaceIterator *vi)
+{
+	return _ehashIterator_isStopped((EHashIterator *) vi);
 }
-void ccgFaceIterator_next(CCGFaceIterator *vi) {
-	_ehashIterator_next((EHashIterator*) vi); 
+void ccgFaceIterator_next(CCGFaceIterator *vi)
+{
+	_ehashIterator_next((EHashIterator *) vi);
 }
-void ccgFaceIterator_free(CCGFaceIterator *vi) {
-	_ehashIterator_free((EHashIterator*) vi);
+void ccgFaceIterator_free(CCGFaceIterator *vi)
+{
+	_ehashIterator_free((EHashIterator *) vi);
 }
 
 /*** Extern API final vert/edge/face interface ***/
 
-int ccgSubSurf_getNumFinalVerts(const CCGSubSurf *ss) {
-	int edgeSize = 1 + (1<<ss->subdivLevels);
-	int gridSize = 1 + (1<<(ss->subdivLevels-1));
-	int numFinalVerts = ss->vMap->numEntries + ss->eMap->numEntries*(edgeSize-2) + ss->fMap->numEntries + ss->numGrids*((gridSize-2) + ((gridSize-2)*(gridSize-2)));
+int ccgSubSurf_getNumFinalVerts(const CCGSubSurf *ss)
+{
+	int edgeSize = ccg_edgesize(ss->subdivLevels);
+	int gridSize = ccg_gridsize(ss->subdivLevels);
+	int numFinalVerts = (ss->vMap->numEntries +
+	                     ss->eMap->numEntries * (edgeSize - 2) +
+	                     ss->fMap->numEntries +
+	                     ss->numGrids * ((gridSize - 2) + ((gridSize - 2) * (gridSize - 2))));
+
 	return numFinalVerts;
 }
-int ccgSubSurf_getNumFinalEdges(const CCGSubSurf *ss) {
-	int edgeSize = 1 + (1<<ss->subdivLevels);
-	int gridSize = 1 + (1<<(ss->subdivLevels-1));
-	int numFinalEdges = ss->eMap->numEntries*(edgeSize-1) + ss->numGrids*((gridSize-1) + 2*((gridSize-2)*(gridSize-1)));
+int ccgSubSurf_getNumFinalEdges(const CCGSubSurf *ss)
+{
+	int edgeSize = ccg_edgesize(ss->subdivLevels);
+	int gridSize = ccg_gridsize(ss->subdivLevels);
+	int numFinalEdges = (ss->eMap->numEntries * (edgeSize - 1) +
+	                     ss->numGrids * ((gridSize - 1) + 2 * ((gridSize - 2) * (gridSize - 1))));
+
 	return numFinalEdges;
 }
-int ccgSubSurf_getNumFinalFaces(const CCGSubSurf *ss) {
-	int gridSize = 1 + (1<<(ss->subdivLevels-1));
-	int numFinalFaces = ss->numGrids*((gridSize-1)*(gridSize-1));
+int ccgSubSurf_getNumFinalFaces(const CCGSubSurf *ss)
+{
+	int gridSize = ccg_gridsize(ss->subdivLevels);
+	int numFinalFaces = ss->numGrids * ((gridSize - 1) * (gridSize - 1));
 	return numFinalFaces;
 }
diff --git a/source/blender/blenkernel/intern/CCGSubSurf.h b/source/blender/blenkernel/intern/CCGSubSurf.h
index 543411f..e73ef6b 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf.h
+++ b/source/blender/blenkernel/intern/CCGSubSurf.h
@@ -8,28 +8,27 @@ typedef void* CCGVertHDL;
 typedef void* CCGEdgeHDL;
 typedef void* CCGFaceHDL;
 
-typedef struct _CCGVert CCGVert;
-typedef struct _CCGEdge CCGEdge;
-typedef struct _CCGFace CCGFace;
+typedef struct CCGSubSurf CCGSubSurf;
+typedef struct CCGVert CCGVert;
+typedef struct CCGEdge CCGEdge;
+typedef struct CCGFace CCGFace;
 
-typedef struct _CCGMeshIFC CCGMeshIFC;
-struct _CCGMeshIFC {
+typedef struct CCGMeshIFC {
 	int			vertUserSize, edgeUserSize, faceUserSize;
 
 	int			vertDataSize;
-};
+} CCGMeshIFC;
 
 /***/
 
 typedef void* CCGAllocatorHDL;
 
-typedef struct _CCGAllocatorIFC CCGAllocatorIFC;
-struct _CCGAllocatorIFC {
+typedef struct CCGAllocatorIFC {
 	void*		(*alloc)			(CCGAllocatorHDL a, int numBytes);
 	void*		(*realloc)			(CCGAllocatorHDL a, void *ptr, int newSize, int oldSize);
 	void		(*free)				(CCGAllocatorHDL a, void *ptr);
 	void		(*release)			(CCGAllocatorHDL a);
-};
+} CCGAllocatorIFC;
 
 /***/
 
@@ -46,13 +45,9 @@ typedef enum {
 
 /***/
 
-typedef struct _CCGSubSurf CCGSubSurf;
-
 CCGSubSurf*	ccgSubSurf_new	(CCGMeshIFC *ifc, int subdivisionLevels, CCGAllocatorIFC *allocatorIFC, CCGAllocatorHDL allocator);
 void		ccgSubSurf_free	(CCGSubSurf *ss);
 
-CCGError	ccgSubSurf_sync	(CCGSubSurf *ss);
-
 CCGError	ccgSubSurf_initFullSync		(CCGSubSurf *ss);
 CCGError	ccgSubSurf_initPartialSync	(CCGSubSurf *ss);
 
@@ -121,10 +116,10 @@ void*		ccgSubSurf_getEdgeData				(CCGSubSurf *ss, CCGEdge *e, int x);
 void*		ccgSubSurf_getEdgeLevelData			(CCGSubSurf *ss, CCGEdge *e, int x, int level);
 
 CCGFace*	ccgSubSurf_getFace					(CCGSubSurf *ss, CCGFaceHDL f);
-CCGFaceHDL	ccgSubSurf_getFaceFaceHandle		(CCGSubSurf *ss, CCGFace *f);
+CCGFaceHDL	ccgSubSurf_getFaceFaceHandle		(CCGFace *f);
 int			ccgSubSurf_getFaceNumVerts			(CCGFace *f);
-CCGVert*	ccgSubSurf_getFaceVert				(CCGSubSurf *ss, CCGFace *f, int index);
-CCGEdge*	ccgSubSurf_getFaceEdge				(CCGSubSurf *ss, CCGFace *f, int index);
+CCGVert*	ccgSubSurf_getFaceVert				(CCGFace *f, int index);
+CCGEdge*	ccgSubSurf_getFaceEdge				(CCGFace *f, int index);
 int			ccgSubSurf_getFaceEdgeIndex			(CCGFace *f, CCGEdge *e);
 
 int			ccgSubSurf_getFaceAge				(CCGSubSurf *ss, CCGFace *f);
@@ -141,9 +136,9 @@ int			ccgSubSurf_getNumFinalFaces		(const CCGSubSurf *ss);
 
 /***/
 
-typedef struct _CCGVertIterator CCGVertIterator;
-typedef struct _CCGEdgeIterator CCGEdgeIterator;
-typedef struct _CCGFaceIterator CCGFaceIterator;
+typedef struct CCGVertIterator CCGVertIterator;
+typedef struct CCGEdgeIterator CCGEdgeIterator;
+typedef struct CCGFaceIterator CCGFaceIterator;
 
 CCGVertIterator*	ccgSubSurf_getVertIterator	(CCGSubSurf *ss);
 CCGEdgeIterator*	ccgSubSurf_getEdgeIterator	(CCGSubSurf *ss);
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 27aeeb9..c28958d 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -31,25 +31,28 @@
 
 
 #include <string.h>
-
+#include <limits.h>
 
 #include "MEM_guardedalloc.h"
 
 #include "DNA_cloth_types.h"
 #include "DNA_key_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_armature_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h" // N_T
 
 #include "BLI_blenlib.h"
-#include "BLI_editVert.h"
 #include "BLI_math.h"
 #include "BLI_memarena.h"
+#include "BLI_array.h"
 #include "BLI_pbvh.h"
 #include "BLI_utildefines.h"
 #include "BLI_linklist.h"
 
+#include "BLF_translation.h"
+
 #include "BKE_cdderivedmesh.h"
 #include "BKE_displist.h"
 #include "BKE_key.h"
@@ -60,7 +63,11 @@
 #include "BKE_texture.h"
 #include "BKE_multires.h"
 #include "BKE_armature.h"
+#include "BKE_particle.h"
+#include "BKE_tessmesh.h"
+#include "BKE_bvhutils.h"
 #include "BKE_deform.h"
+#include "BKE_global.h" /* For debug flag, DM_update_tessface_data() func. */
 
 #ifdef WITH_GAMEENGINE
 #include "BKE_navmesh_conversion.h"
@@ -76,7 +83,8 @@ static DerivedMesh *navmesh_dm_createNavMeshForVisualization(DerivedMesh *dm);
 #include "GPU_extensions.h"
 #include "GPU_material.h"
 
-extern GLubyte stipple_quarttone[128]; /* glutil.c, bad level data */
+static void add_shapekey_layers(DerivedMesh *dm, Mesh *me, Object *ob);
+static void shapekey_layers_to_keyblocks(DerivedMesh *dm, Mesh *me, int actshape_uid);
 
 ///////////////////////////////////
 ///////////////////////////////////
@@ -109,26 +117,63 @@ static MEdge *dm_getEdgeArray(DerivedMesh *dm)
 	return medge;
 }
 
-static MFace *dm_getFaceArray(DerivedMesh *dm)
+static MFace *dm_getTessFaceArray(DerivedMesh *dm)
 {
 	MFace *mface = CustomData_get_layer(&dm->faceData, CD_MFACE);
 
 	if (!mface) {
-		mface = CustomData_add_layer(&dm->faceData, CD_MFACE, CD_CALLOC, NULL,
-			dm->getNumFaces(dm));
+		int numTessFaces = dm->getNumTessFaces(dm);
+		
+		if (!numTessFaces) {
+			/* Do not add layer if there's no elements in it, this leads to issues later when
+			 * this layer is needed with non-zero size, but currently CD stuff does not check
+			 * for requested layer size on creation and just returns layer which was previously
+			 * added (sergey) */
+			return NULL;
+		}
+		
+		mface = CustomData_add_layer(&dm->faceData, CD_MFACE, CD_CALLOC, NULL, numTessFaces);
 		CustomData_set_layer_flag(&dm->faceData, CD_MFACE, CD_FLAG_TEMPORARY);
-		dm->copyFaceArray(dm, mface);
+		dm->copyTessFaceArray(dm, mface);
 	}
 
 	return mface;
 }
 
+static MLoop *dm_getLoopArray(DerivedMesh *dm)
+{
+	MLoop *mloop = CustomData_get_layer(&dm->loopData, CD_MLOOP);
+
+	if (!mloop) {
+		mloop = CustomData_add_layer(&dm->loopData, CD_MLOOP, CD_CALLOC, NULL,
+			dm->getNumLoops(dm));
+		CustomData_set_layer_flag(&dm->loopData, CD_MLOOP, CD_FLAG_TEMPORARY);
+		dm->copyLoopArray(dm, mloop);
+	}
+
+	return mloop;
+}
+
+static MPoly *dm_getPolyArray(DerivedMesh *dm)
+{
+	MPoly *mpoly = CustomData_get_layer(&dm->polyData, CD_MPOLY);
+
+	if (!mpoly) {
+		mpoly = CustomData_add_layer(&dm->polyData, CD_MPOLY, CD_CALLOC, NULL,
+			dm->getNumPolys(dm));
+		CustomData_set_layer_flag(&dm->polyData, CD_MPOLY, CD_FLAG_TEMPORARY);
+		dm->copyPolyArray(dm, mpoly);
+	}
+
+	return mpoly;
+}
+
 static MVert *dm_dupVertArray(DerivedMesh *dm)
 {
 	MVert *tmp = MEM_callocN(sizeof(*tmp) * dm->getNumVerts(dm),
 							 "dm_dupVertArray tmp");
 
-	if(tmp) dm->copyVertArray(dm, tmp);
+	if (tmp) dm->copyVertArray(dm, tmp);
 
 	return tmp;
 }
@@ -138,73 +183,139 @@ static MEdge *dm_dupEdgeArray(DerivedMesh *dm)
 	MEdge *tmp = MEM_callocN(sizeof(*tmp) * dm->getNumEdges(dm),
 							 "dm_dupEdgeArray tmp");
 
-	if(tmp) dm->copyEdgeArray(dm, tmp);
+	if (tmp) dm->copyEdgeArray(dm, tmp);
 
 	return tmp;
 }
 
 static MFace *dm_dupFaceArray(DerivedMesh *dm)
 {
-	MFace *tmp = MEM_callocN(sizeof(*tmp) * dm->getNumFaces(dm),
+	MFace *tmp = MEM_callocN(sizeof(*tmp) * dm->getNumTessFaces(dm),
 							 "dm_dupFaceArray tmp");
 
-	if(tmp) dm->copyFaceArray(dm, tmp);
+	if (tmp) dm->copyTessFaceArray(dm, tmp);
+
+	return tmp;
+}
+
+static MLoop *dm_dupLoopArray(DerivedMesh *dm)
+{
+	MLoop *tmp = MEM_callocN(sizeof(*tmp) * dm->getNumLoops(dm),
+							 "dm_dupLoopArray tmp");
+
+	if (tmp) dm->copyLoopArray(dm, tmp);
 
 	return tmp;
 }
 
+static MPoly *dm_dupPolyArray(DerivedMesh *dm)
+{
+	MPoly *tmp = MEM_callocN(sizeof(*tmp) * dm->getNumPolys(dm),
+							 "dm_dupPolyArray tmp");
+
+	if (tmp) dm->copyPolyArray(dm, tmp);
+
+	return tmp;
+}
+
+static CustomData *dm_getVertCData(DerivedMesh *dm)
+{
+	return &dm->vertData;
+}
+
+static CustomData *dm_getEdgeCData(DerivedMesh *dm)
+{
+	return &dm->edgeData;
+}
+
+static CustomData *dm_getTessFaceCData(DerivedMesh *dm)
+{
+	return &dm->faceData;
+}
+
+static CustomData *dm_getLoopCData(DerivedMesh *dm)
+{
+	return &dm->loopData;
+}
+
+static CustomData *dm_getPolyCData(DerivedMesh *dm)
+{
+	return &dm->polyData;
+}
+
 void DM_init_funcs(DerivedMesh *dm)
 {
 	/* default function implementations */
 	dm->getVertArray = dm_getVertArray;
 	dm->getEdgeArray = dm_getEdgeArray;
-	dm->getFaceArray = dm_getFaceArray;
+	dm->getTessFaceArray = dm_getTessFaceArray;
+	dm->getLoopArray = dm_getLoopArray;
+	dm->getPolyArray = dm_getPolyArray;
 	dm->dupVertArray = dm_dupVertArray;
 	dm->dupEdgeArray = dm_dupEdgeArray;
-	dm->dupFaceArray = dm_dupFaceArray;
+	dm->dupTessFaceArray = dm_dupFaceArray;
+	dm->dupLoopArray = dm_dupLoopArray;
+	dm->dupPolyArray = dm_dupPolyArray;
+
+	dm->getVertDataLayout = dm_getVertCData;
+	dm->getEdgeDataLayout = dm_getEdgeCData;
+	dm->getTessFaceDataLayout = dm_getTessFaceCData;
+	dm->getLoopDataLayout = dm_getLoopCData;
+	dm->getPolyDataLayout = dm_getPolyCData;
 
 	dm->getVertData = DM_get_vert_data;
 	dm->getEdgeData = DM_get_edge_data;
-	dm->getFaceData = DM_get_face_data;
+	dm->getTessFaceData = DM_get_tessface_data;
 	dm->getVertDataArray = DM_get_vert_data_layer;
 	dm->getEdgeDataArray = DM_get_edge_data_layer;
-	dm->getFaceDataArray = DM_get_face_data_layer;
+	dm->getTessFaceDataArray = DM_get_tessface_data_layer;
 
 	bvhcache_init(&dm->bvhCache);
 }
 
-void DM_init(DerivedMesh *dm, DerivedMeshType type,
-			 int numVerts, int numEdges, int numFaces)
+void DM_init(DerivedMesh *dm, DerivedMeshType type, int numVerts, int numEdges,
+             int numTessFaces, int numLoops, int numPolys)
 {
 	dm->type = type;
 	dm->numVertData = numVerts;
 	dm->numEdgeData = numEdges;
-	dm->numFaceData = numFaces;
+	dm->numTessFaceData = numTessFaces;
+	dm->numLoopData = numLoops;
+	dm->numPolyData = numPolys;
 
 	DM_init_funcs(dm);
 	
 	dm->needsFree = 1;
 	dm->auto_bump_scale = -1.0f;
+	dm->dirty = 0;
 }
 
 void DM_from_template(DerivedMesh *dm, DerivedMesh *source, DerivedMeshType type,
-					  int numVerts, int numEdges, int numFaces)
+                      int numVerts, int numEdges, int numTessFaces,
+                      int numLoops, int numPolys)
 {
 	CustomData_copy(&source->vertData, &dm->vertData, CD_MASK_DERIVEDMESH,
 					CD_CALLOC, numVerts);
 	CustomData_copy(&source->edgeData, &dm->edgeData, CD_MASK_DERIVEDMESH,
 					CD_CALLOC, numEdges);
 	CustomData_copy(&source->faceData, &dm->faceData, CD_MASK_DERIVEDMESH,
-					CD_CALLOC, numFaces);
+					CD_CALLOC, numTessFaces);
+	CustomData_copy(&source->loopData, &dm->loopData, CD_MASK_DERIVEDMESH,
+	                CD_CALLOC, numLoops);
+	CustomData_copy(&source->polyData, &dm->polyData, CD_MASK_DERIVEDMESH,
+	                CD_CALLOC, numPolys);
 
 	dm->type = type;
 	dm->numVertData = numVerts;
 	dm->numEdgeData = numEdges;
-	dm->numFaceData = numFaces;
+	dm->numTessFaceData = numTessFaces;
+	dm->numLoopData = numLoops;
+	dm->numPolyData = numPolys;
 
 	DM_init_funcs(dm);
 
 	dm->needsFree = 1;
+	dm->dirty = 0;
 }
 
 int DM_release(DerivedMesh *dm)
@@ -214,64 +325,227 @@ int DM_release(DerivedMesh *dm)
 		GPU_drawobject_free( dm );
 		CustomData_free(&dm->vertData, dm->numVertData);
 		CustomData_free(&dm->edgeData, dm->numEdgeData);
-		CustomData_free(&dm->faceData, dm->numFaceData);
+		CustomData_free(&dm->faceData, dm->numTessFaceData);
+		CustomData_free(&dm->loopData, dm->numLoopData);
+		CustomData_free(&dm->polyData, dm->numPolyData);
 
 		return 1;
 	}
 	else {
 		CustomData_free_temporary(&dm->vertData, dm->numVertData);
 		CustomData_free_temporary(&dm->edgeData, dm->numEdgeData);
-		CustomData_free_temporary(&dm->faceData, dm->numFaceData);
+		CustomData_free_temporary(&dm->faceData, dm->numTessFaceData);
+		CustomData_free_temporary(&dm->loopData, dm->numLoopData);
+		CustomData_free_temporary(&dm->polyData, dm->numPolyData);
 
 		return 0;
 	}
 }
 
-void DM_to_mesh(DerivedMesh *dm, Mesh *me)
+void DM_DupPolys(DerivedMesh *source, DerivedMesh *target)
+{
+	CustomData_free(&target->loopData, source->numLoopData);
+	CustomData_free(&target->polyData, source->numPolyData);
+
+	CustomData_copy(&source->loopData, &target->loopData, CD_MASK_DERIVEDMESH, CD_DUPLICATE, source->numLoopData);
+	CustomData_copy(&source->polyData, &target->polyData, CD_MASK_DERIVEDMESH, CD_DUPLICATE, source->numPolyData);
+
+	target->numLoopData = source->numLoopData;
+	target->numPolyData = source->numPolyData;
+
+	if (!CustomData_has_layer(&target->polyData, CD_MPOLY)) {
+		MPoly *mpoly;
+		MLoop *mloop;
+
+		mloop = source->dupLoopArray(source);
+		mpoly = source->dupPolyArray(source);
+		CustomData_add_layer(&target->loopData, CD_MLOOP, CD_ASSIGN, mloop, source->numLoopData);
+		CustomData_add_layer(&target->polyData, CD_MPOLY, CD_ASSIGN, mpoly, source->numPolyData);
+	}
+}
+
+/* note: until all modifiers can take MPoly's as input,
+ * use this at the start of modifiers  */
+void DM_ensure_tessface(DerivedMesh *dm)
+{
+	const int numTessFaces = dm->getNumTessFaces(dm);
+	const int numPolys =     dm->getNumPolys(dm);
+
+	if ( (numTessFaces == 0) && (numPolys != 0)) {
+		dm->recalcTessellation(dm);
+
+		if (dm->getNumTessFaces(dm) != 0) {
+			/* printf("info %s: polys -> ngons calculated\n", __func__); */
+		}
+		else {
+			printf("warning %s: could not create tessfaces from %d polygons, dm->type=%d\n",
+			       __func__, numPolys, dm->type);
+		}
+	}
+
+	else if (dm->dirty && DM_DIRTY_TESS_CDLAYERS) {
+		BLI_assert(CustomData_has_layer(&dm->faceData, CD_POLYINDEX));
+		DM_update_tessface_data(dm);
+	}
+
+	dm->dirty &= ~DM_DIRTY_TESS_CDLAYERS;
+}
+
+/* Update tessface CD data from loop/poly ones. Needed when not retessellating after modstack evaluation. */
+/* NOTE: Assumes dm has valid tessellated data! */
+void DM_update_tessface_data(DerivedMesh *dm)
+{
+	MFace *mf = dm->getTessFaceArray(dm);
+	MPoly *mp = dm->getPolyArray(dm);
+	MLoop *ml = dm->getLoopArray(dm);
+
+	CustomData *fdata = dm->getTessFaceDataLayout(dm);
+	CustomData *pdata = dm->getPolyDataLayout(dm);
+	CustomData *ldata = dm->getLoopDataLayout(dm);
+
+	const int numTex = CustomData_number_of_layers(pdata, CD_MTEXPOLY);
+	const int numCol = CustomData_number_of_layers(ldata, CD_MLOOPCOL);
+	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 mf_idx,
+	    totface = dm->getNumTessFaces(dm),
+	    ml_idx[4];
+
+	/* Should never occure, but better abort than segfault! */
+	if (!polyindex)
+		return;
+
+	CustomData_from_bmeshpoly(fdata, pdata, ldata, totface);
+
+	for (mf_idx = 0; mf_idx < totface; mf_idx++, mf++) {
+		const int mf_len = mf->v4 ? 4 : 3;
+		int i, not_done;
+
+		/* Find out loop indices. */
+		/* XXX Is there a better way to do this? */
+		/* NOTE: This assumes tessface are valid and in sync with loop/poly… Else, most likely, segfault! */
+		for (i = mp[polyindex[mf_idx]].loopstart, not_done = mf_len; not_done; i++) {
+			MLoop *tml = &ml[i];
+			if (tml->v == mf->v1) {
+				ml_idx[0] = i;
+				not_done--;
+			}
+			else if (tml->v == mf->v2) {
+				ml_idx[1] = i;
+				not_done--;
+			}
+			else if (tml->v == mf->v3) {
+				ml_idx[2] = i;
+				not_done--;
+			}
+			else if (mf_len == 4 && tml->v == mf->v4) {
+				ml_idx[3] = i;
+				not_done--;
+			}
+		}
+		mesh_loops_to_mface_corners(fdata, ldata, pdata,
+		                            ml_idx, mf_idx, polyindex[mf_idx],
+		                            mf_len,
+		                            numTex, numCol, hasPCol, hasOrigSpace);
+	}
+
+	if (G.debug & G_DEBUG)
+		printf("%s: Updated tessellated customdata of dm %p\n", __func__, dm);
+
+	dm->dirty &= ~DM_DIRTY_TESS_CDLAYERS;
+}
+
+void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob)
 {
 	/* dm might depend on me, so we need to do everything with a local copy */
 	Mesh tmp = *me;
-	int totvert, totedge, totface;
-
+	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));
 
 	totvert = tmp.totvert = dm->getNumVerts(dm);
 	totedge = tmp.totedge = dm->getNumEdges(dm);
-	totface = tmp.totface = dm->getNumFaces(dm);
+	totloop = tmp.totloop = dm->getNumLoops(dm);
+	totpoly = tmp.totpoly = dm->getNumPolys(dm);
 
 	CustomData_copy(&dm->vertData, &tmp.vdata, CD_MASK_MESH, CD_DUPLICATE, totvert);
 	CustomData_copy(&dm->edgeData, &tmp.edata, CD_MASK_MESH, CD_DUPLICATE, totedge);
-	CustomData_copy(&dm->faceData, &tmp.fdata, CD_MASK_MESH, CD_DUPLICATE, totface);
+	CustomData_copy(&dm->loopData, &tmp.ldata, CD_MASK_MESH, CD_DUPLICATE, totloop);
+	CustomData_copy(&dm->polyData, &tmp.pdata, CD_MASK_MESH, CD_DUPLICATE, totpoly);
 
+	if (CustomData_has_layer(&dm->vertData, CD_SHAPEKEY)) {
+		KeyBlock *kb;
+		int uid;
+		
+		if (ob) {
+			kb = BLI_findlink(&me->key->block, ob->shapenr-1);
+			if (kb) {
+				uid = kb->uid;
+			}
+			else {
+				printf("%s: error - could not find active shapekey %d!\n",
+				       __func__, ob->shapenr-1);
+
+				uid = INT_MAX;
+			}
+		}
+		else {
+			/*if no object, set to INT_MAX so we don't mess up any shapekey layers*/
+			uid = INT_MAX;
+		}
+
+		shapekey_layers_to_keyblocks(dm, me, uid);
+		did_shapekeys = 1;
+	}
+	
 	/* not all DerivedMeshes store their verts/edges/faces in CustomData, so
-	   we set them here in case they are missing */
-	if(!CustomData_has_layer(&tmp.vdata, CD_MVERT))
+	 * we set them here in case they are missing */
+	if (!CustomData_has_layer(&tmp.vdata, CD_MVERT))
 		CustomData_add_layer(&tmp.vdata, CD_MVERT, CD_ASSIGN, dm->dupVertArray(dm), totvert);
-	if(!CustomData_has_layer(&tmp.edata, CD_MEDGE))
+	if (!CustomData_has_layer(&tmp.edata, CD_MEDGE))
 		CustomData_add_layer(&tmp.edata, CD_MEDGE, CD_ASSIGN, dm->dupEdgeArray(dm), totedge);
-	if(!CustomData_has_layer(&tmp.fdata, CD_MFACE))
-		CustomData_add_layer(&tmp.fdata, CD_MFACE, CD_ASSIGN, dm->dupFaceArray(dm), totface);
+	if (!CustomData_has_layer(&tmp.pdata, CD_MPOLY)) {
+		tmp.mloop = dm->dupLoopArray(dm);
+		tmp.mpoly = dm->dupPolyArray(dm);
+
+		CustomData_add_layer(&tmp.ldata, CD_MLOOP, CD_ASSIGN, tmp.mloop, tmp.totloop);
+		CustomData_add_layer(&tmp.pdata, CD_MPOLY, CD_ASSIGN, tmp.mpoly, tmp.totpoly);
+	}
 
 	/* object had got displacement layer, should copy this layer to save sculpted data */
 	/* NOTE: maybe some other layers should be copied? nazgul */
-	if(CustomData_has_layer(&me->fdata, CD_MDISPS)) {
-		if (totface == me->totface) {
-			MDisps *mdisps = CustomData_get_layer(&me->fdata, CD_MDISPS);
-			CustomData_add_layer(&tmp.fdata, CD_MDISPS, CD_DUPLICATE, mdisps, totface);
+	if (CustomData_has_layer(&me->ldata, CD_MDISPS)) {
+		if (totloop == me->totloop) {
+			MDisps *mdisps = CustomData_get_layer(&me->ldata, CD_MDISPS);
+			CustomData_add_layer(&tmp.ldata, CD_MDISPS, CD_DUPLICATE, mdisps, totloop);
 		}
 	}
 
-	mesh_update_customdata_pointers(&tmp);
+	/* yes, must be before _and_ after tessellate */
+	mesh_update_customdata_pointers(&tmp, TRUE);
+
+	BKE_mesh_tessface_calc(&tmp);
 
 	CustomData_free(&me->vdata, me->totvert);
 	CustomData_free(&me->edata, me->totedge);
 	CustomData_free(&me->fdata, me->totface);
-
-	/* if the number of verts has changed, remove invalid data */
-	if(tmp.totvert != me->totvert) {
-		if(tmp.key) tmp.key->id.us--;
+	CustomData_free(&me->ldata, me->totloop);
+	CustomData_free(&me->pdata, me->totpoly);
+
+	/* ok, this should now use new CD shapekey data,
+	 * which shouuld be fed through the modifier
+	 * stack*/
+	if (tmp.totvert != me->totvert && !did_shapekeys && me->key) {
+		printf("%s: YEEK! this should be recoded! Shape key loss!: ID '%s'\n", __func__, tmp.id.name);
+		if (tmp.key) tmp.key->id.us--;
 		tmp.key = NULL;
 	}
 
@@ -284,16 +558,16 @@ void DM_to_meshkey(DerivedMesh *dm, Mesh *me, KeyBlock *kb)
 	float *fp;
 	MVert *mvert;
 	
-	if(totvert==0 || me->totvert==0 || me->totvert!=totvert) return;
+	if (totvert==0 || me->totvert==0 || me->totvert!=totvert) return;
 	
-	if(kb->data) MEM_freeN(kb->data);
+	if (kb->data) MEM_freeN(kb->data);
 	kb->data= MEM_callocN(me->key->elemsize*me->totvert, "kb->data");
 	kb->totelem= totvert;
 	
 	fp= kb->data;
 	mvert=dm->getVertDataArray(dm, CD_MVERT);
 	
-	for(a=0; a<kb->totelem; a++, fp+=3, mvert++) {
+	for (a=0; a<kb->totelem; a++, fp+=3, mvert++) {
 		copy_v3_v3(fp, mvert->co);
 	}
 }
@@ -315,9 +589,19 @@ void DM_add_edge_layer(DerivedMesh *dm, int type, int alloctype, void *layer)
 	CustomData_add_layer(&dm->edgeData, type, alloctype, layer, dm->numEdgeData);
 }
 
-void DM_add_face_layer(DerivedMesh *dm, int type, int alloctype, void *layer)
+void DM_add_tessface_layer(DerivedMesh *dm, int type, int alloctype, void *layer)
+{
+	CustomData_add_layer(&dm->faceData, type, alloctype, layer, dm->numTessFaceData);
+}
+
+void DM_add_loop_layer(DerivedMesh *dm, int type, int alloctype, void *layer)
 {
-	CustomData_add_layer(&dm->faceData, type, alloctype, layer, dm->numFaceData);
+	CustomData_add_layer(&dm->loopData, type, alloctype, layer, dm->numLoopData);
+}
+
+void DM_add_poly_layer(DerivedMesh *dm, int type, int alloctype, void *layer)
+{
+	CustomData_add_layer(&dm->polyData, type, alloctype, layer, dm->numPolyData);
 }
 
 void *DM_get_vert_data(DerivedMesh *dm, int index, int type)
@@ -330,14 +614,14 @@ void *DM_get_edge_data(DerivedMesh *dm, int index, int type)
 	return CustomData_get(&dm->edgeData, index, type);
 }
 
-void *DM_get_face_data(DerivedMesh *dm, int index, int type)
+void *DM_get_tessface_data(DerivedMesh *dm, int index, int type)
 {
 	return CustomData_get(&dm->faceData, index, type);
 }
 
 void *DM_get_vert_data_layer(DerivedMesh *dm, int type)
 {
-	if(type == CD_MVERT)
+	if (type == CD_MVERT)
 		return dm->getVertArray(dm);
 
 	return CustomData_get_layer(&dm->vertData, type);
@@ -345,20 +629,30 @@ void *DM_get_vert_data_layer(DerivedMesh *dm, int type)
 
 void *DM_get_edge_data_layer(DerivedMesh *dm, int type)
 {
-	if(type == CD_MEDGE)
+	if (type == CD_MEDGE)
 		return dm->getEdgeArray(dm);
 
 	return CustomData_get_layer(&dm->edgeData, type);
 }
 
-void *DM_get_face_data_layer(DerivedMesh *dm, int type)
+void *DM_get_tessface_data_layer(DerivedMesh *dm, int type)
 {
-	if(type == CD_MFACE)
-		return dm->getFaceArray(dm);
+	if (type == CD_MFACE)
+		return dm->getTessFaceArray(dm);
 
 	return CustomData_get_layer(&dm->faceData, type);
 }
 
+void *DM_get_poly_data_layer(DerivedMesh *dm, int type)
+{
+	return CustomData_get_layer(&dm->polyData, type);
+}
+
+void *DM_get_loop_data_layer(DerivedMesh *dm, int type)
+{
+	return CustomData_get_layer(&dm->loopData, type);
+}
+
 void DM_set_vert_data(DerivedMesh *dm, int index, int type, void *data)
 {
 	CustomData_set(&dm->vertData, index, type, data);
@@ -369,7 +663,7 @@ void DM_set_edge_data(DerivedMesh *dm, int index, int type, void *data)
 	CustomData_set(&dm->edgeData, index, type, data);
 }
 
-void DM_set_face_data(DerivedMesh *dm, int index, int type, void *data)
+void DM_set_tessface_data(DerivedMesh *dm, int index, int type, void *data)
 {
 	CustomData_set(&dm->faceData, index, type, data);
 }
@@ -388,13 +682,27 @@ void DM_copy_edge_data(DerivedMesh *source, DerivedMesh *dest,
 						 source_index, dest_index, count);
 }
 
-void DM_copy_face_data(DerivedMesh *source, DerivedMesh *dest,
+void DM_copy_tessface_data(DerivedMesh *source, DerivedMesh *dest,
 					   int source_index, int dest_index, int count)
 {
 	CustomData_copy_data(&source->faceData, &dest->faceData,
 						 source_index, dest_index, count);
 }
 
+void DM_copy_loop_data(DerivedMesh *source, DerivedMesh *dest,
+                       int source_index, int dest_index, int count)
+{
+	CustomData_copy_data(&source->loopData, &dest->loopData,
+	                     source_index, dest_index, count);
+}
+
+void DM_copy_poly_data(DerivedMesh *source, DerivedMesh *dest,
+                       int source_index, int dest_index, int count)
+{
+	CustomData_copy_data(&source->polyData, &dest->polyData,
+	                     source_index, dest_index, count);
+}
+
 void DM_free_vert_data(struct DerivedMesh *dm, int index, int count)
 {
 	CustomData_free_elem(&dm->vertData, index, count);
@@ -405,11 +713,21 @@ void DM_free_edge_data(struct DerivedMesh *dm, int index, int count)
 	CustomData_free_elem(&dm->edgeData, index, count);
 }
 
-void DM_free_face_data(struct DerivedMesh *dm, int index, int count)
+void DM_free_tessface_data(struct DerivedMesh *dm, int index, int count)
 {
 	CustomData_free_elem(&dm->faceData, index, count);
 }
 
+void DM_free_loop_data(struct DerivedMesh *dm, int index, int count)
+{
+	CustomData_free_elem(&dm->loopData, index, count);
+}
+
+void DM_free_poly_data(struct DerivedMesh *dm, int index, int count)
+{
+	CustomData_free_elem(&dm->polyData, index, count);
+}
+
 void DM_interp_vert_data(DerivedMesh *source, DerivedMesh *dest,
 						 int *src_indices, float *weights,
 						 int count, int dest_index)
@@ -427,7 +745,7 @@ void DM_interp_edge_data(DerivedMesh *source, DerivedMesh *dest,
 					  weights, (float*)vert_weights, count, dest_index);
 }
 
-void DM_interp_face_data(DerivedMesh *source, DerivedMesh *dest,
+void DM_interp_tessface_data(DerivedMesh *source, DerivedMesh *dest,
 						 int *src_indices,
 						 float *weights, FaceVertWeight *vert_weights,
 						 int count, int dest_index)
@@ -436,18 +754,33 @@ void DM_interp_face_data(DerivedMesh *source, DerivedMesh *dest,
 					  weights, (float*)vert_weights, count, dest_index);
 }
 
-void DM_swap_face_data(DerivedMesh *dm, int index, const int *corner_indices)
+void DM_swap_tessface_data(DerivedMesh *dm, int index, const int *corner_indices)
 {
 	CustomData_swap(&dm->faceData, index, corner_indices);
 }
 
-///
+void DM_interp_loop_data(DerivedMesh *source, DerivedMesh *dest,
+                         int *src_indices,
+                         float *weights, int count, int dest_index)
+{
+	CustomData_interp(&source->loopData, &dest->loopData, src_indices,
+	                  weights, NULL, count, dest_index);
+}
+
+void DM_interp_poly_data(DerivedMesh *source, DerivedMesh *dest,
+                         int *src_indices,
+                         float *weights, int count, int dest_index)
+{
+	CustomData_interp(&source->polyData, &dest->polyData, src_indices,
+	                  weights, NULL, count, dest_index);
+}
 
+///
 DerivedMesh *mesh_create_derived(Mesh *me, Object *ob, float (*vertCos)[3])
 {
 	DerivedMesh *dm = CDDM_from_mesh(me, ob);
 	
-	if(!dm)
+	if (!dm)
 		return NULL;
 	
 	if (vertCos)
@@ -458,17 +791,25 @@ DerivedMesh *mesh_create_derived(Mesh *me, Object *ob, float (*vertCos)[3])
 	return dm;
 }
 
-DerivedMesh *mesh_create_derived_for_modifier(Scene *scene, Object *ob, ModifierData *md)
+/***/
+
+DerivedMesh *mesh_create_derived_for_modifier(Scene *scene, Object *ob, 
+                                              ModifierData *md, int build_shapekey_layers)
 {
 	Mesh *me = ob->data;
 	ModifierTypeInfo *mti = modifierType_getInfo(md->type);
 	DerivedMesh *dm;
+	KeyBlock *kb;
 
 	md->scene= scene;
 	
 	if (!(md->mode&eModifierMode_Realtime)) return NULL;
 	if (mti->isDisabled && mti->isDisabled(md, 0)) return NULL;
-
+	
+	if (build_shapekey_layers && me->key && (kb = BLI_findlink(&me->key->block, ob->shapenr-1))) {
+		key_to_mesh(kb, me);
+	}
+	
 	if (mti->type==eModifierTypeType_OnlyDeform) {
 		int numVerts;
 		float (*deformedVerts)[3] = mesh_getVertexCos(me, &numVerts);
@@ -476,33 +817,41 @@ DerivedMesh *mesh_create_derived_for_modifier(Scene *scene, Object *ob, Modifier
 		mti->deformVerts(md, ob, NULL, deformedVerts, numVerts, 0, 0);
 		dm = mesh_create_derived(me, ob, deformedVerts);
 
+		if (build_shapekey_layers)
+			add_shapekey_layers(dm, me, ob);
+		
 		MEM_freeN(deformedVerts);
-	} else {
+	}
+	else {
 		DerivedMesh *tdm = mesh_create_derived(me, ob, NULL);
+
+		if (build_shapekey_layers)
+			add_shapekey_layers(tdm, me, ob);
+		
 		dm = mti->applyModifier(md, ob, tdm, 0, 0);
 
-		if(tdm != dm) tdm->release(tdm);
+		if (tdm != dm) tdm->release(tdm);
 	}
 
 	return dm;
 }
 
-static float *get_editmesh_orco_verts(EditMesh *em)
+static float *get_editbmesh_orco_verts(BMEditMesh *em)
 {
-	EditVert *eve;
+	BMIter iter;
+	BMVert *eve;
 	float *orco;
 	int a, totvert;
 
 	/* these may not really be the orco's, but it's only for preview.
 	 * could be solver better once, but isn't simple */
 
-	totvert= 0;
-	for(eve=em->verts.first; eve; eve=eve->next)
-		totvert++;
+	totvert= em->bm->totvert;
 	
-	orco = MEM_mallocN(sizeof(float)*3*totvert, "EditMesh Orco");
+	orco = MEM_mallocN(sizeof(float)*3*totvert, "BMEditMesh Orco");
 
-	for(a=0, eve=em->verts.first; eve; eve=eve->next, a+=3) {
+	eve = BM_iter_new(&iter, em->bm, BM_VERTS_OF_MESH, NULL);
+	for (a=0; eve; eve=BM_iter_step(&iter), a+=3) {
 		copy_v3_v3(orco+a, eve->co);
 	}
 	
@@ -510,28 +859,27 @@ static float *get_editmesh_orco_verts(EditMesh *em)
 }
 
 /* orco custom data layer */
-
-static void *get_orco_coords_dm(Object *ob, EditMesh *em, int layer, int *free)
+static void *get_orco_coords_dm(Object *ob, BMEditMesh *em, int layer, int *free)
 {
 	*free= 0;
 
-	if(layer == CD_ORCO) {
+	if (layer == CD_ORCO) {
 		/* get original coordinates */
 		*free= 1;
 
-		if(em)
-			return (float(*)[3])get_editmesh_orco_verts(em);
+		if (em)
+			return (float(*)[3])get_editbmesh_orco_verts(em);
 		else
 			return (float(*)[3])get_mesh_orco_verts(ob);
 	}
-	else if(layer == CD_CLOTH_ORCO) {
+	else if (layer == CD_CLOTH_ORCO) {
 		/* apply shape key for cloth, this should really be solved
-		   by a more flexible customdata system, but not simple */
-		if(!em) {
+		 * by a more flexible customdata system, but not simple */
+		if (!em) {
 			ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth);
 			KeyBlock *kb= key_get_keyblock(ob_get_key(ob), clmd->sim_parms->shapekey_rest);
 
-			if(kb->data)
+			if (kb->data)
 				return kb->data;
 		}
 
@@ -541,20 +889,20 @@ static void *get_orco_coords_dm(Object *ob, EditMesh *em, int layer, int *free)
 	return NULL;
 }
 
-static DerivedMesh *create_orco_dm(Object *ob, Mesh *me, EditMesh *em, int layer)
+static DerivedMesh *create_orco_dm(Object *ob, Mesh *me, BMEditMesh *em, int layer)
 {
 	DerivedMesh *dm;
 	float (*orco)[3];
 	int free;
 
-	if(em) dm= CDDM_from_editmesh(em, me);
+	if (em) dm= CDDM_from_BMEditMesh(em, me, FALSE, FALSE);
 	else dm= CDDM_from_mesh(me, ob);
 
 	orco= get_orco_coords_dm(ob, em, layer, &free);
 
-	if(orco) {
+	if (orco) {
 		CDDM_apply_vert_coords(dm, orco);
-		if(free) MEM_freeN(orco);
+		if (free) MEM_freeN(orco);
 	}
 
 	CDDM_calc_normals(dm);
@@ -562,18 +910,19 @@ static DerivedMesh *create_orco_dm(Object *ob, Mesh *me, EditMesh *em, int layer
 	return dm;
 }
 
-static void add_orco_dm(Object *ob, EditMesh *em, DerivedMesh *dm, DerivedMesh *orcodm, int layer)
+static void add_orco_dm(Object *ob, BMEditMesh *em, DerivedMesh *dm,
+						DerivedMesh *orcodm, int layer)
 {
 	float (*orco)[3], (*layerorco)[3];
 	int totvert, free;
 
 	totvert= dm->getNumVerts(dm);
 
-	if(orcodm) {
+	if (orcodm) {
 		orco= MEM_callocN(sizeof(float)*3*totvert, "dm orco");
 		free= 1;
 
-		if(orcodm->getNumVerts(orcodm) == totvert)
+		if (orcodm->getNumVerts(orcodm) == totvert)
 			orcodm->getVertCos(orcodm, orco);
 		else
 			dm->getVertCos(dm, orco);
@@ -581,17 +930,17 @@ static void add_orco_dm(Object *ob, EditMesh *em, DerivedMesh *dm, DerivedMesh *
 	else
 		orco= get_orco_coords_dm(ob, em, layer, &free);
 
-	if(orco) {
-		if(layer == CD_ORCO)
+	if (orco) {
+		if (layer == CD_ORCO)
 			transform_mesh_orco_verts(ob->data, orco, totvert, 0);
 
-		if(!(layerorco = DM_get_vert_data_layer(dm, layer))) {
+		if (!(layerorco = DM_get_vert_data_layer(dm, layer))) {
 			DM_add_vert_layer(dm, layer, CD_CALLOC, NULL);
 			layerorco = DM_get_vert_data_layer(dm, layer);
 		}
 
 		memcpy(layerorco, orco, sizeof(float)*3*totvert);
-		if(free) MEM_freeN(orco);
+		if (free) MEM_freeN(orco);
 	}
 }
 
@@ -607,22 +956,22 @@ void weight_to_rgb(float r_rgb[3], const float weight)
 {
 	const float blend= ((weight/2.0f)+0.5f);
 
-	if (weight<=0.25f){	// blue->cyan
+	if (weight<=0.25f) {	// blue->cyan
 		r_rgb[0]= 0.0f;
 		r_rgb[1]= blend*weight*4.0f;
 		r_rgb[2]= blend;
 	}
-	else if (weight<=0.50f){	// cyan->green
+	else if (weight<=0.50f) {	// cyan->green
 		r_rgb[0]= 0.0f;
 		r_rgb[1]= blend;
 		r_rgb[2]= blend*(1.0f-((weight-0.25f)*4.0f));
 	}
-	else if (weight <= 0.75f){	// green->yellow
+	else if (weight <= 0.75f) {	// green->yellow
 		r_rgb[0]= blend * ((weight-0.50f)*4.0f);
 		r_rgb[1]= blend;
 		r_rgb[2]= 0.0f;
 	}
-	else if (weight <= 1.0f){ // yellow->red
+	else if (weight <= 1.0f) { // yellow->red
 		r_rgb[0]= blend;
 		r_rgb[1]= blend * (1.0f-((weight-0.75f)*4.0f));
 		r_rgb[2]= 0.0f;
@@ -646,13 +995,19 @@ static void weightpaint_color(unsigned char r_col[4], ColorBand *coba, const flo
 {
 	float colf[4];
 
-	if(coba) do_colorband(coba, input, colf);
-	else     weight_to_rgb(colf, input);
+	if (coba) {
+		do_colorband(coba, input, colf);
+	}
+	else {
+		weight_to_rgb(colf, input);
+	}
 
-	r_col[3] = (unsigned char)(colf[0] * 255.0f);
-	r_col[2] = (unsigned char)(colf[1] * 255.0f);
-	r_col[1] = (unsigned char)(colf[2] * 255.0f);
-	r_col[0] = 255;
+	/* don't use rgb_float_to_uchar() here because
+	 * the resulting float doesn't need 0-1 clamp check */
+	r_col[0] = (unsigned char)(colf[0] * 255.0f);
+	r_col[1] = (unsigned char)(colf[1] * 255.0f);
+	r_col[2] = (unsigned char)(colf[2] * 255.0f);
+	r_col[3] = 255;
 }
 
 
@@ -775,36 +1130,56 @@ void DM_update_weight_mcol(Object *ob, DerivedMesh *dm, int const draw_flag,
 {
 	ColorBand *coba= stored_cb;	/* warning, not a local var */
 
-	MFace *mf = dm->getFaceArray(dm);
-	int numFaces = dm->getNumFaces(dm);
-	int numVerts = dm->getNumVerts(dm);
 	unsigned char *wtcol_v;
-	unsigned char *wtcol_f = dm->getFaceDataArray(dm, CD_WEIGHT_MCOL);
-	int i;
+#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 no CD_WEIGHT_MCOL existed yet, add a new one! */
+#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_WEIGHT_MCOL, CD_CALLOC, NULL, numFaces);
+		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) {
+			if (indices) {
 				w = MEM_callocN(sizeof(float)*numVerts, "Temp weight array DM_update_weight_mcol");
 				i = num;
-				while(i--)
+				while (i--)
 					w[indices[i]] = weights[i];
 			}
 
 			/* Convert float weights to colors. */
 			wtcol_v = calc_colors_from_weights_array(numVerts, w);
 
-			if(indices)
+			if (indices)
 				MEM_freeN(w);
 		}
 
@@ -813,7 +1188,13 @@ void DM_update_weight_mcol(Object *ob, DerivedMesh *dm, int const draw_flag,
 			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;
 
@@ -830,11 +1211,138 @@ void DM_update_weight_mcol(Object *ob, DerivedMesh *dm, int const draw_flag,
 
 			do {
 				copy_v4_v4_char((char *)&wtcol_f_step[fidx * 4],
-						        (char *)&wtcol_v[4 * (*(&mf->v1 + fidx))]);
+				                (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_growitems(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;
+
+				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);
 	}
+
+	dm->dirty |= DM_DIRTY_TESS_CDLAYERS;
+}
+
+
+static void shapekey_layers_to_keyblocks(DerivedMesh *dm, Mesh *me, int actshape_uid)
+{
+	KeyBlock *kb;
+	int i, j, tot;
+	
+	if (!me->key)
+		return;	
+	
+	tot = CustomData_number_of_layers(&dm->vertData, CD_SHAPEKEY);
+	for (i=0; i<tot; i++) {
+		CustomDataLayer *layer = &dm->vertData.layers[CustomData_get_layer_index_n(&dm->vertData, CD_SHAPEKEY, i)];
+		float (*cos)[3], (*kbcos)[3];
+		
+		for (kb=me->key->block.first; kb; kb=kb->next) {
+			if (kb->uid == layer->uid)
+				break;
+		}
+		
+		if (!kb) {
+			kb = add_keyblock(me->key, layer->name);
+			kb->uid = layer->uid;
+		}
+		
+		if (kb->data)
+			MEM_freeN(kb->data);
+		
+		cos = CustomData_get_layer_n(&dm->vertData, CD_SHAPEKEY, i);
+		kb->totelem = dm->numVertData;
+
+		kb->data = kbcos = MEM_mallocN(sizeof(float)*3*kb->totelem, "kbcos DerivedMesh.c");
+		if (kb->uid == actshape_uid) {
+			MVert *mvert = dm->getVertArray(dm);
+			
+			for (j=0; j<dm->numVertData; j++, kbcos++, mvert++) {
+				copy_v3_v3(*kbcos, mvert->co);
+			}
+		}
+		else {
+			for (j=0; j<kb->totelem; j++, cos++, kbcos++) {
+				copy_v3_v3(*kbcos, *cos);
+			}
+		}
+	}
+	
+	for (kb=me->key->block.first; kb; kb=kb->next) {
+		if (kb->totelem != dm->numVertData) {
+			if (kb->data)
+				MEM_freeN(kb->data);
+			
+			kb->totelem = dm->numVertData;
+			kb->data = MEM_callocN(sizeof(float)*3*kb->totelem, "kb->data derivedmesh.c");
+			fprintf(stderr, "%s: lost a shapekey layer: '%s'! (bmesh internal error)\n", __func__, kb->name);
+		}
+	}
+}
+
+static void add_shapekey_layers(DerivedMesh *dm, Mesh *me, Object *UNUSED(ob))
+{
+	KeyBlock *kb;
+	Key *key = me->key;
+	int i;
+	const size_t shape_alloc_len = sizeof(float) * 3 * me->totvert;
+
+	if (!me->key)
+		return;
+
+	/* ensure we can use mesh vertex count for derived mesh custom data */
+	if (me->totvert != dm->getNumVerts(dm)) {
+		fprintf(stderr,
+		        "%s: vertex size mismatch (mesh/dm) '%s' (%d != %d)\n",
+		        __func__, me->id.name+2, me->totvert, dm->getNumVerts(dm));
+		return;
+	}
+
+	for (i=0, kb=key->block.first; kb; kb=kb->next, i++) {
+		int ci;
+		float *array;
+
+		if (me->totvert != kb->totelem) {
+			fprintf(stderr,
+			        "%s: vertex size mismatch (Mesh '%s':%d != KeyBlock '%s':%d)\n",
+			        __func__, me->id.name + 2, me->totvert, kb->name, kb->totelem);
+			array = MEM_callocN(shape_alloc_len, __func__);
+		}
+		else {
+			array = MEM_mallocN(shape_alloc_len, __func__);
+			memcpy(array, kb->data, shape_alloc_len);
+		}
+
+		CustomData_add_layer_named(&dm->vertData, CD_SHAPEKEY, CD_ASSIGN, array, dm->numVertData, kb->name);
+		ci = CustomData_get_layer_index_n(&dm->vertData, CD_SHAPEKEY, i);
+
+		dm->vertData.layers[ci].uid = kb->uid;
+	}
 }
 
 /* new value for useDeform -1  (hack for the gameengine):
@@ -845,14 +1353,16 @@ void DM_update_weight_mcol(Object *ob, DerivedMesh *dm, int const draw_flag,
 static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos)[3],
 								DerivedMesh **deform_r, DerivedMesh **final_r,
 								int useRenderParams, int useDeform,
-								int needMapping, CustomDataMask dataMask, int index, int useCache)
+								int needMapping, CustomDataMask dataMask, 
+								int index, int useCache, int build_shapekey_layers)
 {
 	Mesh *me = ob->data;
 	ModifierData *firstmd, *md, *previewmd = NULL;
-	LinkNode *datamasks, *curr;
-	CustomDataMask mask, nextmask, append_mask = 0;
+	CDMaskLink *datamasks, *curr;
+	/* XXX Always copying POLYINDEX, else tessellated data are no more valid! */
+	CustomDataMask mask, nextmask, append_mask = CD_MASK_POLYINDEX;
 	float (*deformedVerts)[3] = NULL;
-	DerivedMesh *dm, *orcodm, *clothorcodm, *finaldm;
+	DerivedMesh *dm=NULL, *orcodm, *clothorcodm, *finaldm;
 	int numVerts = me->totvert;
 	int required_mode;
 	int isPrevDeform= FALSE;
@@ -869,20 +1379,20 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
 	const int do_final_wmcol = (scene->toolsettings->weights_preview == WP_WPREVIEW_FINAL) && do_wmcol;
 #endif
 	const int do_final_wmcol = FALSE;
-	int do_init_wmcol = ((dataMask & CD_MASK_WEIGHT_MCOL) && (ob->mode & OB_MODE_WEIGHT_PAINT) && !do_final_wmcol);
+	int do_init_wmcol = ((dataMask & CD_MASK_PREVIEW_MCOL) && (ob->mode & OB_MODE_WEIGHT_PAINT) && !do_final_wmcol);
 	/* XXX Same as above... For now, only weights preview in WPaint mode. */
 	const int do_mod_wmcol = do_init_wmcol;
 
-	if(mmd && !mmd->sculptlvl)
+	if (mmd && !mmd->sculptlvl)
 		has_multires = 0;
 
-	if(!skipVirtualArmature) {
+	if (!skipVirtualArmature) {
 		firstmd = modifiers_getVirtualModifierList(ob);
 	}
 	else {
 		/* game engine exception */
 		firstmd = ob->modifiers.first;
-		if(firstmd && firstmd->type == eModifierType_Armature)
+		if (firstmd && firstmd->type == eModifierType_Armature)
 			firstmd = firstmd->next;
 	}
 
@@ -890,13 +1400,13 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
 
 	modifiers_clearErrors(ob);
 
-	if(useRenderParams) required_mode = eModifierMode_Render;
+	if (useRenderParams) required_mode = eModifierMode_Render;
 	else required_mode = eModifierMode_Realtime;
 
 	datamasks = modifiers_calcDataMasks(scene, ob, md, dataMask, required_mode);
 	curr = datamasks;
 
-	if(do_mod_wmcol || do_mod_mcol) {
+	if (do_mod_wmcol || do_mod_mcol) {
 		/* Find the last active modifier generating a preview, or NULL if none. */
 		/* XXX Currently, DPaint modifier just ignores this.
 		 *     Needs a stupid hack...
@@ -904,33 +1414,34 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
 		previewmd = modifiers_getLastPreview(scene, md, required_mode);
 	}
 
-	if(deform_r) *deform_r = NULL;
+	if (deform_r) *deform_r = NULL;
 	*final_r = NULL;
 
-	if(useDeform) {
-		if(inputVertexCos)
+	if (useDeform) {
+		if (inputVertexCos)
 			deformedVerts = inputVertexCos;
 		
 		/* Apply all leading deforming modifiers */
-		for(;md; md = md->next, curr = curr->next) {
+		for (;md; md = md->next, curr = curr->next) {
 			ModifierTypeInfo *mti = modifierType_getInfo(md->type);
 
 			md->scene= scene;
 			
-			if(!modifier_isEnabled(scene, md, required_mode)) continue;
-			if(useDeform < 0 && mti->dependsOnTime && mti->dependsOnTime(md)) continue;
+			if (!modifier_isEnabled(scene, md, required_mode)) continue;
+			if (useDeform < 0 && mti->dependsOnTime && mti->dependsOnTime(md)) continue;
 
-			if(mti->type == eModifierTypeType_OnlyDeform) {
-				if(!deformedVerts)
+			if (mti->type == eModifierTypeType_OnlyDeform) {
+				if (!deformedVerts)
 					deformedVerts = mesh_getVertexCos(me, &numVerts);
 
 				mti->deformVerts(md, ob, NULL, deformedVerts, numVerts, useRenderParams, useDeform);
-			} else {
+			}
+			else {
 				break;
 			}
 			
 			/* grab modifiers until index i */
-			if((index >= 0) && (modifiers_indexInObject(ob, md) >= index))
+			if ((index >= 0) && (modifiers_indexInObject(ob, md) >= index))
 				break;
 		}
 
@@ -940,15 +1451,19 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
 		 */
 		if (deform_r) {
 			*deform_r = CDDM_from_mesh(me, ob);
-
-			if(deformedVerts) {
+			 
+			if (build_shapekey_layers)
+				add_shapekey_layers(dm, me, ob);
+			
+			if (deformedVerts) {
 				CDDM_apply_vert_coords(*deform_r, deformedVerts);
 				CDDM_calc_normals(*deform_r);
 			}
 		}
-	} else {
-		/* default behaviour for meshes */
-		if(inputVertexCos)
+	}
+	else {
+		/* default behavior for meshes */
+		if (inputVertexCos)
 			deformedVerts = inputVertexCos;
 		else
 			deformedVerts = mesh_getVertexCos(me, &numVerts);
@@ -962,41 +1477,41 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
 	orcodm = NULL;
 	clothorcodm = NULL;
 
-	for(;md; md = md->next, curr = curr->next) {
+	for (;md; md = md->next, curr = curr->next) {
 		ModifierTypeInfo *mti = modifierType_getInfo(md->type);
 
 		md->scene= scene;
 
-		if(!modifier_isEnabled(scene, md, required_mode)) continue;
-		if(mti->type == eModifierTypeType_OnlyDeform && !useDeform) continue;
-		if((mti->flags & eModifierTypeFlag_RequiresOriginalData) && dm) {
-			modifier_setError(md, "Modifier requires original data, bad stack position.");
+		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."));
 			continue;
 		}
-		if(sculpt_mode && (!has_multires || multires_applied)) {
+		if (sculpt_mode && (!has_multires || multires_applied)) {
 			int unsupported= 0;
 
-			if(scene->toolsettings->sculpt->flags & SCULPT_ONLY_DEFORM)
+			if (scene->toolsettings->sculpt->flags & SCULPT_ONLY_DEFORM)
 				unsupported|= mti->type != eModifierTypeType_OnlyDeform;
 
 			unsupported|= md->type == eModifierType_Multires && ((MultiresModifierData*)md)->sculptlvl==0;
 			unsupported|= multires_applied;
 
-			if(unsupported) {
-				modifier_setError(md, "Not supported in sculpt mode.");
+			if (unsupported) {
+				modifier_setError(md, "%s", TIP_("Not supported in sculpt mode."));
 				continue;
 			}
 		}
-		if(needMapping && !modifier_supportsMapping(md)) continue;
-		if(useDeform < 0 && mti->dependsOnTime && mti->dependsOnTime(md)) continue;
+		if (needMapping && !modifier_supportsMapping(md)) continue;
+		if (useDeform < 0 && mti->dependsOnTime && mti->dependsOnTime(md)) continue;
 
 		/* add an orco layer if needed by this modifier */
-		if(mti->requiredDataMask)
+		if (mti->requiredDataMask)
 			mask = mti->requiredDataMask(ob, md);
 		else
 			mask = 0;
 
-		if(dm && (mask & CD_MASK_ORCO))
+		if (dm && (mask & CD_MASK_ORCO))
 			add_orco_dm(ob, NULL, dm, orcodm, CD_ORCO);
 
 		/* How to apply modifier depends on (a) what we already have as
@@ -1004,10 +1519,10 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
 		 * deformed vertices) and (b) what type the modifier is.
 		 */
 
-		if(mti->type == eModifierTypeType_OnlyDeform) {
+		if (mti->type == eModifierTypeType_OnlyDeform) {
 			/* No existing verts to deform, need to build them. */
-			if(!deformedVerts) {
-				if(dm) {
+			if (!deformedVerts) {
+				if (dm) {
 					/* Deforming a derived mesh, read the vertex locations
 					 * out of the mesh and deform them. Once done with this
 					 * run of deformers verts will be written back.
@@ -1016,34 +1531,36 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
 					deformedVerts =
 						MEM_mallocN(sizeof(*deformedVerts) * numVerts, "dfmv");
 					dm->getVertCos(dm, deformedVerts);
-				} else {
+				}
+				else {
 					deformedVerts = mesh_getVertexCos(me, &numVerts);
 				}
 			}
 
 			/* if this is not the last modifier in the stack then recalculate the normals
 			 * to avoid giving bogus normals to the next modifier see: [#23673] */
-			if(isPrevDeform &&  mti->dependsOnNormals && mti->dependsOnNormals(md)) {
+			if (isPrevDeform &&  mti->dependsOnNormals && mti->dependsOnNormals(md)) {
 				/* XXX, this covers bug #23673, but we may need normal calc for other types */
-				if(dm && dm->type == DM_TYPE_CDDM) {
+				if (dm && dm->type == DM_TYPE_CDDM) {
 					CDDM_apply_vert_coords(dm, deformedVerts);
 					CDDM_calc_normals(dm);
 				}
 			}
 
 			mti->deformVerts(md, ob, dm, deformedVerts, numVerts, useRenderParams, useDeform);
-		} else {
+		}
+		else {
 			DerivedMesh *ndm;
 
 			/* determine which data layers are needed by following modifiers */
-			if(curr->next)
-				nextmask= (CustomDataMask)GET_INT_FROM_POINTER(curr->next->link);
+			if (curr->next)
+				nextmask= curr->next->mask;
 			else
 				nextmask= dataMask;
 
 			/* apply vertex coordinates or build a DerivedMesh as necessary */
-			if(dm) {
-				if(deformedVerts) {
+			if (dm) {
+				if (deformedVerts) {
 					DerivedMesh *tdm = CDDM_copy(dm);
 					dm->release(dm);
 					dm = tdm;
@@ -1051,15 +1568,19 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
 					CDDM_apply_vert_coords(dm, deformedVerts);
 					CDDM_calc_normals(dm);
 				}
-			} else {
+			}
+			else {
 				dm = CDDM_from_mesh(me, ob);
 
-				if(deformedVerts) {
+				if (build_shapekey_layers)
+					add_shapekey_layers(dm, me, ob);
+
+				if (deformedVerts) {
 					CDDM_apply_vert_coords(dm, deformedVerts);
 					CDDM_calc_normals(dm);
 				}
 
-				if(do_init_wmcol)
+				if (do_init_wmcol)
 					DM_update_weight_mcol(ob, dm, draw_flag, NULL, 0, NULL);
 
 				/* Constructive modifiers need to have an origindex
@@ -1069,79 +1590,82 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
 				 * requests it, this way Mirror, Solidify etc will keep ORIGINDEX
 				 * data by using generic DM_copy_vert_data() functions.
 				 */
-				if(needMapping || (nextmask & CD_MASK_ORIGINDEX)) {
+				if (needMapping || (nextmask & CD_MASK_ORIGINDEX)) {
 					/* calc */
 					DM_add_vert_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL);
 					DM_add_edge_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL);
-					DM_add_face_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL);
+					DM_add_poly_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL);
 
 					range_vn_i(DM_get_vert_data_layer(dm, CD_ORIGINDEX), dm->numVertData, 0);
 					range_vn_i(DM_get_edge_data_layer(dm, CD_ORIGINDEX), dm->numEdgeData, 0);
-					range_vn_i(DM_get_face_data_layer(dm, CD_ORIGINDEX), dm->numFaceData, 0);
+					range_vn_i(DM_get_poly_data_layer(dm, CD_ORIGINDEX), dm->numPolyData, 0);
 				}
 			}
 
 			
 			/* set the DerivedMesh to only copy needed data */
-			mask= (CustomDataMask)GET_INT_FROM_POINTER(curr->link);
+			mask= curr->mask;
 			/* needMapping check here fixes bug [#28112], otherwise its
 			 * possible that it wont be copied */
 			mask |= append_mask;
 			DM_set_only_copy(dm, mask | (needMapping ? CD_MASK_ORIGINDEX : 0));
 			
 			/* add cloth rest shape key if need */
-			if(mask & CD_MASK_CLOTH_ORCO)
+			if (mask & CD_MASK_CLOTH_ORCO)
 				add_orco_dm(ob, NULL, dm, clothorcodm, CD_CLOTH_ORCO);
 
 			/* add an origspace layer if needed */
-			if(((CustomDataMask)GET_INT_FROM_POINTER(curr->link)) & CD_MASK_ORIGSPACE)
-				if(!CustomData_has_layer(&dm->faceData, CD_ORIGSPACE))
-					DM_add_face_layer(dm, CD_ORIGSPACE, CD_DEFAULT, NULL);
+			if ((curr->mask) & CD_MASK_ORIGSPACE_MLOOP) {
+				if (!CustomData_has_layer(&dm->loopData, CD_ORIGSPACE_MLOOP)) {
+					DM_add_loop_layer(dm, CD_ORIGSPACE_MLOOP, CD_CALLOC, NULL);
+					DM_init_origspace(dm);
+				}
+			}
 
 			ndm = mti->applyModifier(md, ob, dm, useRenderParams, useCache);
 
-			if(ndm) {
+			if (ndm) {
 				/* if the modifier returned a new dm, release the old one */
-				if(dm && dm != ndm) dm->release(dm);
+				if (dm && dm != ndm) dm->release(dm);
 
 				dm = ndm;
 
-				if(deformedVerts) {
-					if(deformedVerts != inputVertexCos)
+				if (deformedVerts) {
+					if (deformedVerts != inputVertexCos)
 						MEM_freeN(deformedVerts);
 
 					deformedVerts = NULL;
 				}
-			} 
+			}
 
 			/* create an orco derivedmesh in parallel */
-			if(nextmask & CD_MASK_ORCO) {
-				if(!orcodm)
+			if (nextmask & CD_MASK_ORCO) {
+				if (!orcodm)
 					orcodm= create_orco_dm(ob, me, NULL, CD_ORCO);
 
 				nextmask &= ~CD_MASK_ORCO;
 				DM_set_only_copy(orcodm, nextmask | CD_MASK_ORIGINDEX);
 				ndm = mti->applyModifier(md, ob, orcodm, useRenderParams, 0);
 
-				if(ndm) {
+				if (ndm) {
 					/* if the modifier returned a new dm, release the old one */
-					if(orcodm && orcodm != ndm) orcodm->release(orcodm);
+					if (orcodm && orcodm != ndm) orcodm->release(orcodm);
 					orcodm = ndm;
 				}
 			}
 
 			/* create cloth orco derivedmesh in parallel */
-			if(nextmask & CD_MASK_CLOTH_ORCO) {
-				if(!clothorcodm)
+			if (nextmask & CD_MASK_CLOTH_ORCO) {
+				if (!clothorcodm)
 					clothorcodm= create_orco_dm(ob, me, NULL, CD_CLOTH_ORCO);
 
 				nextmask &= ~CD_MASK_CLOTH_ORCO;
 				DM_set_only_copy(clothorcodm, nextmask | CD_MASK_ORIGINDEX);
 				ndm = mti->applyModifier(md, ob, clothorcodm, useRenderParams, 0);
 
-				if(ndm) {
+				if (ndm) {
 					/* if the modifier returned a new dm, release the old one */
-					if(clothorcodm && clothorcodm != ndm) clothorcodm->release(clothorcodm);
+					if (clothorcodm && clothorcodm != ndm) clothorcodm->release(clothorcodm);
 					clothorcodm = ndm;
 				}
 			}
@@ -1149,32 +1673,32 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
 			/* in case of dynamic paint, make sure preview mask remains for following modifiers */
 			/* XXX Temp and hackish solution! */
 			if (md->type == eModifierType_DynamicPaint)
-				append_mask |= CD_MASK_WEIGHT_MCOL;
+				append_mask |= CD_MASK_PREVIEW_MLOOPCOL;
 			/* In case of active preview modifier, make sure preview mask remains for following modifiers. */
 			else if ((md == previewmd) && (do_mod_wmcol)) {
 				DM_update_weight_mcol(ob, dm, draw_flag, NULL, 0, NULL);
-				append_mask |= CD_MASK_WEIGHT_MCOL;
+				append_mask |= CD_MASK_PREVIEW_MLOOPCOL;
 			}
 		}
 
 		isPrevDeform= (mti->type == eModifierTypeType_OnlyDeform);
 
 		/* grab modifiers until index i */
-		if((index >= 0) && (modifiers_indexInObject(ob, md) >= index))
+		if ((index >= 0) && (modifiers_indexInObject(ob, md) >= index))
 			break;
 
-		if(sculpt_mode && md->type == eModifierType_Multires)
+		if (sculpt_mode && md->type == eModifierType_Multires)
 			multires_applied = 1;
 	}
 
-	for(md=firstmd; md; md=md->next)
+	for (md=firstmd; md; md=md->next)
 		modifier_freeTemporaryData(md);
 
 	/* Yay, we are done. If we have a DerivedMesh and deformed vertices
 	 * need to apply these back onto the DerivedMesh. If we have no
 	 * DerivedMesh then we need to build one.
 	 */
-	if(dm && deformedVerts) {
+	if (dm && deformedVerts) {
 		finaldm = CDDM_copy(dm);
 
 		dm->release(dm);
@@ -1183,39 +1707,107 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
 		CDDM_calc_normals(finaldm);
 
 #if 0 /* For later nice mod preview! */
-		/* In case we need modified weights in CD_WEIGHT_MCOL, we have to re-compute it. */
-		if(do_final_wmcol)
+		/* In case we need modified weights in CD_PREVIEW_MCOL, we have to re-compute it. */
+		if (do_final_wmcol)
 			DM_update_weight_mcol(ob, finaldm, draw_flag, NULL, 0, NULL);
 #endif
-	} else if(dm) {
+	}
+	else if (dm) {
 		finaldm = dm;
 
 #if 0 /* For later nice mod preview! */
-		/* In case we need modified weights in CD_WEIGHT_MCOL, we have to re-compute it. */
-		if(do_final_wmcol)
+		/* In case we need modified weights in CD_PREVIEW_MCOL, we have to re-compute it. */
+		if (do_final_wmcol)
 			DM_update_weight_mcol(ob, finaldm, draw_flag, NULL, 0, NULL);
 #endif
-	} else {
-		finaldm = CDDM_from_mesh(me, ob);
+	}
+	else {
+		int recalc_normals= 0;
 
-		if(deformedVerts) {
+		finaldm = CDDM_from_mesh(me, ob);
+		
+		if (build_shapekey_layers) {
+			add_shapekey_layers(finaldm, me, ob);
+			recalc_normals= 1;
+		}
+		
+		if (deformedVerts) {
 			CDDM_apply_vert_coords(finaldm, deformedVerts);
+			recalc_normals= 1;
+		}
+
+		if (recalc_normals) {
 			CDDM_calc_normals(finaldm);
 		}
 
 		/* In this case, we should never have weight-modifying modifiers in stack... */
-		if(do_init_wmcol)
+		if (do_init_wmcol)
 			DM_update_weight_mcol(ob, finaldm, draw_flag, NULL, 0, NULL);
 	}
 
 	/* add an orco layer if needed */
-	if(dataMask & CD_MASK_ORCO) {
+	if (dataMask & CD_MASK_ORCO) {
 		add_orco_dm(ob, NULL, finaldm, orcodm, CD_ORCO);
 
-		if(deform_r && *deform_r)
+		if (deform_r && *deform_r)
 			add_orco_dm(ob, NULL, *deform_r, NULL, CD_ORCO);
 	}
 
+	{
+		/* calculating normals can re-calculate tessfaces in some cases */
+#if 0
+		int num_tessface = finaldm->getNumTessFaces(finaldm);
+#endif
+		/* --------------------------------------------------------------------- */
+		/* First calculate the polygon and vertex normals, re-tessellation
+		 * copies these into the tessface's normal layer */
+
+
+		/* comment because this causes a bug when deform is applied after a
+		 * bug when applied after a subsurf modifier (SubSurf -> Cast) for eg,
+		 * it also looks like this isn't even needed since code above recalc's
+		 * normals - campbell */
+#if 0
+		finaldm->calcNormals(finaldm);
+#endif
+
+		/* Re-tessellation is necessary to push render data (uvs, textures, colors)
+		 * from loops and polys onto the tessfaces. This may be currently be
+		 * redundant in cases where the render mode doesn't use these inputs, but
+		 * ideally eventually tessellation would happen on-demand, and this is one
+		 * of the primary places it would be needed. */
+#if 0
+		if (num_tessface == 0 && finaldm->getNumTessFaces(finaldm) == 0)
+#else
+		if (finaldm->getNumTessFaces(finaldm) == 0) /* || !CustomData_has_layer(&finaldm->faceData, CD_POLYINDEX)) */
+#endif
+		{
+			finaldm->recalcTessellation(finaldm);
+		}
+		/* Even if tessellation is not needed, some modifiers migh 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));
+			DM_update_tessface_data(finaldm);
+		}
+		/* Need to watch this, it can cause issues, see bug [#29338]             */
+		/* take care with this block, we really need testing frameworks          */
+		/* --------------------------------------------------------------------- */
+
+		/* without this, drawing ngon tri's faces will show ugly tessellated face
+		 * normals and will also have to calculate normals on the fly, try avoid
+		 * this where possible since calculating polygon normals isn't fast,
+		 * note that this isn't a problem for subsurf (only quads) or editmode
+		 * which deals with drawing differently.
+		 *
+		 * Never calc vertex normals because other code ensures these are up to date.
+		 */
+		if ((finaldm->type == DM_TYPE_CDDM) && (CustomData_has_layer(&finaldm->faceData, CD_NORMAL) == FALSE)) {
+			CDDM_calc_normals_mapping_ex(finaldm, TRUE);
+		}
+	}
+
 #ifdef WITH_GAMEENGINE
 	/* NavMesh - this is a hack but saves having a NavMesh modifier */
 	if ((ob->gameflag & OB_NAVMESH) && (finaldm->type == DM_TYPE_CDDM)) {
@@ -1230,46 +1822,49 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
 
 	*final_r = finaldm;
 
-	if(orcodm)
+	if (orcodm)
 		orcodm->release(orcodm);
-	if(clothorcodm)
+	if (clothorcodm)
 		clothorcodm->release(clothorcodm);
 
-	if(deformedVerts && deformedVerts != inputVertexCos)
+	if (deformedVerts && deformedVerts != inputVertexCos)
 		MEM_freeN(deformedVerts);
 
-	BLI_linklist_free(datamasks, NULL);
+	BLI_linklist_free((LinkNode*)datamasks, NULL);
 }
 
-float (*editmesh_get_vertex_cos(EditMesh *em, int *numVerts_r))[3]
+float (*editbmesh_get_vertex_cos(BMEditMesh *em, int *numVerts_r))[3]
 {
-	int i, numVerts = *numVerts_r = BLI_countlist(&em->verts);
+	int i, numVerts = *numVerts_r = em->bm->totvert;
 	float (*cos)[3];
-	EditVert *eve;
+	BMIter iter;
+	BMVert *eve;
+
+	cos = MEM_mallocN(sizeof(float)*3*numVerts, "vertexcos");
 
-	cos = MEM_mallocN(sizeof(*cos)*numVerts, "vertexcos");
-	for (i=0,eve=em->verts.first; i<numVerts; i++,eve=eve->next) {
+	eve = BM_iter_new(&iter, em->bm, BM_VERTS_OF_MESH, NULL);
+	for (i=0; eve; eve=BM_iter_step(&iter), i++) {
 		copy_v3_v3(cos[i], eve->co);
 	}
 
 	return cos;
 }
 
-int editmesh_modifier_is_enabled(Scene *scene, ModifierData *md, DerivedMesh *dm)
+int editbmesh_modifier_is_enabled(Scene *scene, ModifierData *md, DerivedMesh *dm)
 {
 	ModifierTypeInfo *mti = modifierType_getInfo(md->type);
 	int required_mode = eModifierMode_Realtime | eModifierMode_Editmode;
 
-	if(!modifier_isEnabled(scene, md, required_mode)) return 0;
-	if((mti->flags & eModifierTypeFlag_RequiresOriginalData) && dm) {
-		modifier_setError(md, "Modifier requires original data, bad stack position.");
+	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."));
 		return 0;
 	}
 	
 	return 1;
 }
 
-static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, DerivedMesh **cage_r,
+static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, DerivedMesh **cage_r,
 									DerivedMesh **final_r,
 									CustomDataMask dataMask)
 {
@@ -1278,13 +1873,13 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri
 	CustomDataMask mask;
 	DerivedMesh *dm, *orcodm = NULL;
 	int i, numVerts = 0, cageIndex = modifiers_getCageIndex(scene, ob, NULL, 1);
-	LinkNode *datamasks, *curr;
+	CDMaskLink *datamasks, *curr;
 	int required_mode = eModifierMode_Realtime | eModifierMode_Editmode;
 
 	modifiers_clearErrors(ob);
 
-	if(cage_r && cageIndex == -1) {
-		*cage_r = editmesh_get_derived(em, NULL);
+	if (cage_r && cageIndex == -1) {
+		*cage_r = getEditDerivedBMesh(em, ob, NULL);
 	}
 
 	dm = NULL;
@@ -1293,18 +1888,18 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri
 	datamasks = modifiers_calcDataMasks(scene, ob, md, dataMask, required_mode);
 
 	curr = datamasks;
-	for(i = 0; md; i++, md = md->next, curr = curr->next) {
+	for (i = 0; md; i++, md = md->next, curr = curr->next) {
 		ModifierTypeInfo *mti = modifierType_getInfo(md->type);
 
 		md->scene= scene;
 		
-		if(!editmesh_modifier_is_enabled(scene, md, dm))
+		if (!editbmesh_modifier_is_enabled(scene, md, dm))
 			continue;
 
 		/* add an orco layer if needed by this modifier */
-		if(dm && mti->requiredDataMask) {
+		if (dm && mti->requiredDataMask) {
 			mask = mti->requiredDataMask(ob, md);
-			if(mask & CD_MASK_ORCO)
+			if (mask & CD_MASK_ORCO)
 				add_orco_dm(ob, em, dm, orcodm, CD_ORCO);
 		}
 
@@ -1313,10 +1908,10 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri
 		 * deformed vertices) and (b) what type the modifier is.
 		 */
 
-		if(mti->type == eModifierTypeType_OnlyDeform) {
+		if (mti->type == eModifierTypeType_OnlyDeform) {
 			/* No existing verts to deform, need to build them. */
-			if(!deformedVerts) {
-				if(dm) {
+			if (!deformedVerts) {
+				if (dm) {
 					/* Deforming a derived mesh, read the vertex locations
 					 * out of the mesh and deform them. Once done with this
 					 * run of deformers verts will be written back.
@@ -1325,45 +1920,49 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri
 					deformedVerts =
 						MEM_mallocN(sizeof(*deformedVerts) * numVerts, "dfmv");
 					dm->getVertCos(dm, deformedVerts);
-				} else {
-					deformedVerts = editmesh_get_vertex_cos(em, &numVerts);
+				}
+				else {
+					deformedVerts = editbmesh_get_vertex_cos(em, &numVerts);
 				}
 			}
 
 			if (mti->deformVertsEM)
 				mti->deformVertsEM(md, ob, em, dm, deformedVerts, numVerts);
 			else mti->deformVerts(md, ob, dm, deformedVerts, numVerts, 0, 0);
-		} else {
+		}
+		else {
 			DerivedMesh *ndm;
 
 			/* apply vertex coordinates or build a DerivedMesh as necessary */
-			if(dm) {
-				if(deformedVerts) {
+			if (dm) {
+				if (deformedVerts) {
 					DerivedMesh *tdm = CDDM_copy(dm);
-					if(!(cage_r && dm == *cage_r)) dm->release(dm);
+					if (!(cage_r && dm == *cage_r)) dm->release(dm);
 					dm = tdm;
 
 					CDDM_apply_vert_coords(dm, deformedVerts);
 					CDDM_calc_normals(dm);
-				} else if(cage_r && dm == *cage_r) {
+				}
+				else if (cage_r && dm == *cage_r) {
 					/* dm may be changed by this modifier, so we need to copy it
 					 */
 					dm = CDDM_copy(dm);
 				}
 
-			} else {
-				dm = CDDM_from_editmesh(em, ob->data);
+			}
+			else {
+				dm = CDDM_from_BMEditMesh(em, ob->data, FALSE, FALSE);
 
-				if(deformedVerts) {
+				if (deformedVerts) {
 					CDDM_apply_vert_coords(dm, deformedVerts);
 					CDDM_calc_normals(dm);
 				}
 			}
 
 			/* create an orco derivedmesh in parallel */
-			mask= (CustomDataMask)GET_INT_FROM_POINTER(curr->link);
-			if(mask & CD_MASK_ORCO) {
-				if(!orcodm)
+			mask= curr->mask;
+			if (mask & CD_MASK_ORCO) {
+				if (!orcodm)
 					orcodm= create_orco_dm(ob, ob->data, em, CD_ORCO);
 
 				mask &= ~CD_MASK_ORCO;
@@ -1374,21 +1973,24 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri
 				else
 					ndm = mti->applyModifier(md, ob, orcodm, 0, 0);
 
-				if(ndm) {
+				if (ndm) {
 					/* if the modifier returned a new dm, release the old one */
-					if(orcodm && orcodm != ndm) orcodm->release(orcodm);
+					if (orcodm && orcodm != ndm) orcodm->release(orcodm);
 					orcodm = ndm;
 				}
 			}
 
 			/* set the DerivedMesh to only copy needed data */
-			mask= (CustomDataMask)GET_INT_FROM_POINTER(curr->link); /* CD_MASK_ORCO may have been cleared above */
+			mask= curr->mask; /* CD_MASK_ORCO may have been cleared above */
 
 			DM_set_only_copy(dm, mask | CD_MASK_ORIGINDEX);
 
-			if(mask & CD_MASK_ORIGSPACE)
-				if(!CustomData_has_layer(&dm->faceData, CD_ORIGSPACE))
-					DM_add_face_layer(dm, CD_ORIGSPACE, CD_DEFAULT, NULL);
+			if (mask & CD_MASK_ORIGSPACE_MLOOP) {
+				if (!CustomData_has_layer(&dm->loopData, CD_ORIGSPACE_MLOOP)) {
+					DM_add_loop_layer(dm, CD_ORIGSPACE_MLOOP, CD_CALLOC, NULL);
+					DM_init_origspace(dm);
+				}
+			}
 			
 			if (mti->applyModifierEM)
 				ndm = mti->applyModifierEM(md, ob, em, dm);
@@ -1396,7 +1998,7 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri
 				ndm = mti->applyModifier(md, ob, dm, 0, 0);
 
 			if (ndm) {
-				if(dm && dm != ndm)
+				if (dm && dm != ndm)
 					dm->release(dm);
 
 				dm = ndm;
@@ -1408,50 +2010,76 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri
 			}
 		}
 
-		if(cage_r && i == cageIndex) {
-			if(dm && deformedVerts) {
+		if (cage_r && i == cageIndex) {
+			if (dm && deformedVerts) {
 				*cage_r = CDDM_copy(dm);
 				CDDM_apply_vert_coords(*cage_r, deformedVerts);
-			} else if(dm) {
+			}
+			else if (dm) {
 				*cage_r = dm;
-			} else {
+			}
+			else {
 				*cage_r =
-					editmesh_get_derived(em,
+					getEditDerivedBMesh(em, ob,
 						deformedVerts ? MEM_dupallocN(deformedVerts) : NULL);
 			}
 		}
 	}
 
-	BLI_linklist_free(datamasks, NULL);
+	BLI_linklist_free((LinkNode*)datamasks, NULL);
 
 	/* Yay, we are done. If we have a DerivedMesh and deformed vertices need
 	 * to apply these back onto the DerivedMesh. If we have no DerivedMesh
 	 * then we need to build one.
 	 */
-	if(dm && deformedVerts) {
+	if (dm && deformedVerts) {
 		*final_r = CDDM_copy(dm);
 
-		if(!(cage_r && dm == *cage_r)) dm->release(dm);
+		if (!(cage_r && dm == *cage_r)) dm->release(dm);
 
 		CDDM_apply_vert_coords(*final_r, deformedVerts);
-		CDDM_calc_normals(*final_r);
-	} else if (dm) {
+		CDDM_calc_normals(*final_r); /* was CDDM_calc_normals_mapping - campbell */
+	}
+	else if (dm) {
 		*final_r = dm;
-	} else if (!deformedVerts && cage_r && *cage_r) {
+		(*final_r)->calcNormals(*final_r); /* BMESH_ONLY - BMESH_TODO. check if this is needed */
+	}
+	else if (!deformedVerts && cage_r && *cage_r) {
+		/* cage should already have up to date normals */
 		*final_r = *cage_r;
-	} else {
-		*final_r = editmesh_get_derived(em, deformedVerts);
+		(*final_r)->calcNormals(*final_r); /* BMESH_ONLY - BMESH_TODO. check if this is needed */
+	}
+	else {
+		/* this is just a copy of the editmesh, no need to calc normals */
+		*final_r = getEditDerivedBMesh(em, ob, deformedVerts);
 		deformedVerts = NULL;
 	}
 
+	/* --- */
+	/* BMESH_ONLY, ensure tessface's used for drawing,
+	 * but don't recalculate if the last modifier in the stack gives us tessfaces
+	 * check if the derived meshes are DM_TYPE_EDITBMESH before calling, this isn't essential
+	 * but quiets annoying error messages since tessfaces wont be created. */
+	if ((*final_r)->type != DM_TYPE_EDITBMESH) {
+		DM_ensure_tessface(*final_r);
+	}
+	if (cage_r) {
+		if ((*cage_r)->type != DM_TYPE_EDITBMESH) {
+			if (*cage_r != *final_r) {
+				DM_ensure_tessface(*cage_r);
+			}
+		}
+	}
+	/* --- */
+
 	/* add an orco layer if needed */
-	if(dataMask & CD_MASK_ORCO)
+	if (dataMask & CD_MASK_ORCO)
 		add_orco_dm(ob, em, *final_r, orcodm, CD_ORCO);
 
-	if(orcodm)
+	if (orcodm)
 		orcodm->release(orcodm);
 
-	if(deformedVerts)
+	if (deformedVerts)
 		MEM_freeN(deformedVerts);
 }
 
@@ -1482,32 +2110,39 @@ static void clear_mesh_caches(Object *ob)
 		ob->derivedDeform= NULL;
 	}
 
-	if(ob->sculpt) {
+	if (ob->sculpt) {
 		object_sculpt_modifiers_changed(ob);
 	}
 }
 
-static void mesh_build_data(Scene *scene, Object *ob, CustomDataMask dataMask)
+static void mesh_build_data(Scene *scene, Object *ob, CustomDataMask dataMask,
+                            int build_shapekey_layers)
 {
 	Object *obact = scene->basact?scene->basact->object:NULL;
-	int editing = paint_facesel_test(ob) || paint_vertsel_test(ob);/* paint_vertsel_test */
+	int editing = paint_facesel_test(ob);
 	/* 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)));
+	int needMapping = (ob==obact) && (editing || (ob->mode & (OB_MODE_WEIGHT_PAINT|OB_MODE_VERTEX_PAINT|OB_MODE_TEXTURE_PAINT)));
 
 	clear_mesh_caches(ob);
 
 	mesh_calc_modifiers(scene, ob, NULL, &ob->derivedDeform,
 						&ob->derivedFinal, 0, 1,
-						needMapping, dataMask, -1, 1);
+						needMapping, dataMask, -1, 1, build_shapekey_layers);
 
 	DM_set_object_boundbox (ob, ob->derivedFinal);
 
 	ob->derivedFinal->needsFree = 0;
 	ob->derivedDeform->needsFree = 0;
 	ob->lastDataMask = dataMask;
+
+	if ((ob->mode & OB_MODE_SCULPT) && ob->sculpt) {
+		/* create PBVH immediately (would be created on the fly too,
+		 * but this avoids waiting on first stroke) */
+		ob->sculpt->pbvh= ob->derivedFinal->getPBVH(ob, ob->derivedFinal);
+	}
 }
 
-static void editmesh_build_data(Scene *scene, Object *obedit, EditMesh *em, CustomDataMask dataMask)
+static void editbmesh_build_data(Scene *scene, Object *obedit, BMEditMesh *em, CustomDataMask dataMask)
 {
 	clear_mesh_caches(obedit);
 
@@ -1524,7 +2159,7 @@ static void editmesh_build_data(Scene *scene, Object *obedit, EditMesh *em, Cust
 		em->derivedCage = NULL;
 	}
 
-	editmesh_calc_modifiers(scene, obedit, em, &em->derivedCage, &em->derivedFinal, dataMask);
+	editbmesh_calc_modifiers(scene, obedit, em, &em->derivedCage, &em->derivedFinal, dataMask);
 	DM_set_object_boundbox (obedit, em->derivedFinal);
 
 	em->lastDataMask = dataMask;
@@ -1532,12 +2167,14 @@ static void editmesh_build_data(Scene *scene, Object *obedit, EditMesh *em, Cust
 	em->derivedCage->needsFree = 0;
 }
 
-void makeDerivedMesh(Scene *scene, Object *ob, EditMesh *em, CustomDataMask dataMask)
+void makeDerivedMesh(Scene *scene, Object *ob, BMEditMesh *em,
+                     CustomDataMask dataMask, int build_shapekey_layers)
 {
 	if (em) {
-		editmesh_build_data(scene, ob, em, dataMask);
-	} else {
-		mesh_build_data(scene, ob, dataMask);
+		editbmesh_build_data(scene, ob, em, dataMask);
+	}
+	else {
+		mesh_build_data(scene, ob, dataMask, build_shapekey_layers);
 	}
 }
 
@@ -1548,8 +2185,8 @@ DerivedMesh *mesh_get_derived_final(Scene *scene, Object *ob, CustomDataMask dat
 	/* if there's no derived mesh or the last data mask used doesn't include
 	 * the data we need, rebuild the derived mesh
 	 */
-	if(!ob->derivedFinal || (dataMask & ob->lastDataMask) != dataMask)
-		mesh_build_data(scene, ob, dataMask);
+	if (!ob->derivedFinal || (dataMask & ob->lastDataMask) != dataMask)
+		mesh_build_data(scene, ob, dataMask, 0);
 
 	return ob->derivedFinal;
 }
@@ -1559,8 +2196,8 @@ DerivedMesh *mesh_get_derived_deform(Scene *scene, Object *ob, CustomDataMask da
 	/* if there's no derived mesh or the last data mask used doesn't include
 	 * the data we need, rebuild the derived mesh
 	 */
-	if(!ob->derivedDeform || (dataMask & ob->lastDataMask) != dataMask)
-		mesh_build_data(scene, ob, dataMask);
+	if (!ob->derivedDeform || (dataMask & ob->lastDataMask) != dataMask)
+		mesh_build_data(scene, ob, dataMask, 0);
 
 	return ob->derivedDeform;
 }
@@ -1569,7 +2206,7 @@ DerivedMesh *mesh_create_derived_render(Scene *scene, Object *ob, CustomDataMask
 {
 	DerivedMesh *final;
 	
-	mesh_calc_modifiers(scene, ob, NULL, NULL, &final, 1, 1, 0, dataMask, -1, 0);
+	mesh_calc_modifiers(scene, ob, NULL, NULL, &final, 1, 1, 0, dataMask, -1, 0, 0);
 
 	return final;
 }
@@ -1578,7 +2215,7 @@ DerivedMesh *mesh_create_derived_index_render(Scene *scene, Object *ob, CustomDa
 {
 	DerivedMesh *final;
 	
-	mesh_calc_modifiers(scene, ob, NULL, NULL, &final, 1, 1, 0, dataMask, index, 0);
+	mesh_calc_modifiers(scene, ob, NULL, NULL, &final, 1, 1, 0, dataMask, index, 0, 0);
 
 	return final;
 }
@@ -1587,7 +2224,7 @@ DerivedMesh *mesh_create_derived_view(Scene *scene, Object *ob, CustomDataMask d
 {
 	DerivedMesh *final;
 
-	mesh_calc_modifiers(scene, ob, NULL, NULL, &final, 0, 1, 0, dataMask, -1, 0);
+	mesh_calc_modifiers(scene, ob, NULL, NULL, &final, 0, 1, 0, dataMask, -1, 0, 0);
 
 	return final;
 }
@@ -1597,7 +2234,7 @@ DerivedMesh *mesh_create_derived_no_deform(Scene *scene, Object *ob, float (*ver
 {
 	DerivedMesh *final;
 	
-	mesh_calc_modifiers(scene, ob, vertCos, NULL, &final, 0, 0, 0, dataMask, -1, 0);
+	mesh_calc_modifiers(scene, ob, vertCos, NULL, &final, 0, 0, 0, dataMask, -1, 0, 0);
 
 	return final;
 }
@@ -1607,7 +2244,7 @@ DerivedMesh *mesh_create_derived_no_virtual(Scene *scene, Object *ob, float (*ve
 {
 	DerivedMesh *final;
 	
-	mesh_calc_modifiers(scene, ob, vertCos, NULL, &final, 0, -1, 0, dataMask, -1, 0);
+	mesh_calc_modifiers(scene, ob, vertCos, NULL, &final, 0, -1, 0, dataMask, -1, 0, 0);
 
 	return final;
 }
@@ -1617,7 +2254,7 @@ DerivedMesh *mesh_create_derived_physics(Scene *scene, Object *ob, float (*vertC
 {
 	DerivedMesh *final;
 	
-	mesh_calc_modifiers(scene, ob, vertCos, NULL, &final, 0, -1, 1, dataMask, -1, 0);
+	mesh_calc_modifiers(scene, ob, vertCos, NULL, &final, 0, -1, 1, dataMask, -1, 0, 0);
 
 	return final;
 }
@@ -1628,59 +2265,60 @@ DerivedMesh *mesh_create_derived_no_deform_render(Scene *scene, Object *ob,
 {
 	DerivedMesh *final;
 
-	mesh_calc_modifiers(scene, ob, vertCos, NULL, &final, 1, 0, 0, dataMask, -1, 0);
+	mesh_calc_modifiers(scene, ob, vertCos, NULL, &final, 1, 0, 0, dataMask, -1, 0, 0);
 
 	return final;
 }
 
 /***/
 
-DerivedMesh *editmesh_get_derived_cage_and_final(Scene *scene, Object *obedit, EditMesh *em, DerivedMesh **final_r,
+DerivedMesh *editbmesh_get_derived_cage_and_final(Scene *scene, Object *obedit, BMEditMesh *em, DerivedMesh **final_r,
 												 CustomDataMask dataMask)
 {
 	/* if there's no derived mesh or the last data mask used doesn't include
 	 * the data we need, rebuild the derived mesh
 	 */
-	if(!em->derivedCage ||
+	if (!em->derivedCage ||
 	   (em->lastDataMask & dataMask) != dataMask)
-		editmesh_build_data(scene, obedit, em, dataMask);
+		editbmesh_build_data(scene, obedit, em, dataMask);
 
 	*final_r = em->derivedFinal;
 	return em->derivedCage;
 }
 
-DerivedMesh *editmesh_get_derived_cage(Scene *scene, Object *obedit, EditMesh *em, CustomDataMask dataMask)
+DerivedMesh *editbmesh_get_derived_cage(Scene *scene, Object *obedit, BMEditMesh *em, CustomDataMask dataMask)
 {
 	/* if there's no derived mesh or the last data mask used doesn't include
 	 * the data we need, rebuild the derived mesh
 	 */
-	if(!em->derivedCage ||
+	if (!em->derivedCage ||
 	   (em->lastDataMask & dataMask) != dataMask)
-		editmesh_build_data(scene, obedit, em, dataMask);
+		editbmesh_build_data(scene, obedit, em, dataMask);
 
 	return em->derivedCage;
 }
 
-DerivedMesh *editmesh_get_derived_base(Object *UNUSED(obedit), EditMesh *em)
+DerivedMesh *editbmesh_get_derived_base(Object *obedit, BMEditMesh *em)
 {
-	return editmesh_get_derived(em, NULL);
+	return getEditDerivedBMesh(em, obedit, NULL);
 }
 
 
 /* ********* For those who don't grasp derived stuff! (ton) :) *************** */
 
-static void make_vertexcosnos__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
+static void make_vertexcosnos__mapFunc(void *userData, int index, const float co[3],
+                                       const float no_f[3], const short no_s[3])
 {
 	float *vec = userData;
 	
 	vec+= 6*index;
 
 	/* check if we've been here before (normal should not be 0) */
-	if(vec[3] || vec[4] || vec[5]) return;
+	if (vec[3] || vec[4] || vec[5]) return;
 
 	copy_v3_v3(vec, co);
 	vec+= 3;
-	if(no_f) {
+	if (no_f) {
 		copy_v3_v3(vec, no_f);
 	}
 	else {
@@ -1700,20 +2338,20 @@ float *mesh_get_mapped_verts_nors(Scene *scene, Object *ob)
 	float *vertexcosnos;
 	
 	/* lets prevent crashing... */
-	if(ob->type!=OB_MESH || me->totvert==0)
+	if (ob->type!=OB_MESH || me->totvert==0)
 		return NULL;
 	
-	dm= mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
+	dm= mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH|CD_MASK_ORIGINDEX);
 	vertexcosnos= MEM_callocN(6*sizeof(float)*me->totvert, "vertexcosnos map");
 	
-	if(dm->foreachMappedVert) {
+	if (dm->foreachMappedVert) {
 		dm->foreachMappedVert(dm, make_vertexcosnos__mapFunc, vertexcosnos);
 	}
 	else {
 		float *fp= vertexcosnos;
 		int a;
 		
-		for(a=0; a< me->totvert; a++, fp+=6) {
+		for (a=0; a< me->totvert; a++, fp+=6) {
 			dm->getVertCo(dm, a, fp);
 			dm->getVertNo(dm, a, fp+3);
 		}
@@ -1733,7 +2371,7 @@ typedef struct
 	MVert * mvert;		// vertices & normals
 	float (*orco)[3];
 	float (*tangent)[4];	// destination
-	int numFaces;
+	int numTessFaces;
 
 } SGLSLMeshToTangent;
 
@@ -1743,7 +2381,7 @@ typedef struct
 static int GetNumFaces(const SMikkTSpaceContext * pContext)
 {
 	SGLSLMeshToTangent * pMesh = (SGLSLMeshToTangent *) pContext->m_pUserData;
-	return pMesh->numFaces;
+	return pMesh->numTessFaces;
 }
 
 static int GetNumVertsOfFace(const SMikkTSpaceContext * pContext, const int face_num)
@@ -1765,7 +2403,7 @@ static void GetTextureCoordinate(const SMikkTSpaceContext * pContext, float fUV[
 	//assert(vert_index>=0 && vert_index<4);
 	SGLSLMeshToTangent * pMesh = (SGLSLMeshToTangent *) pContext->m_pUserData;
 
-	if(pMesh->mtface!=NULL) {
+	if (pMesh->mtface!=NULL) {
 		float * uv = pMesh->mtface[face_num].uv[vert_index];
 		fUV[0]=uv[0]; fUV[1]=uv[1];
 	}
@@ -1781,8 +2419,8 @@ static void GetNormal(const SMikkTSpaceContext * pContext, float fNorm[], const
 	SGLSLMeshToTangent * pMesh = (SGLSLMeshToTangent *) pContext->m_pUserData;
 
 	const int smoothnormal = (pMesh->mface[face_num].flag & ME_SMOOTH);
-	if(!smoothnormal) {	// flat
-		if(pMesh->precomputedFaceNormals) {
+	if (!smoothnormal) {	// flat
+		if (pMesh->precomputedFaceNormals) {
 			copy_v3_v3(fNorm, &pMesh->precomputedFaceNormals[3*face_num]);
 		}
 		else {
@@ -1791,7 +2429,7 @@ static void GetNormal(const SMikkTSpaceContext * pContext, float fNorm[], const
 			float *p1= pMesh->mvert[mf->v2].co;
 			float *p2= pMesh->mvert[mf->v3].co;
 
-			if(mf->v4) {
+			if (mf->v4) {
 				float *p3 = pMesh->mvert[mf->v4].co;
 				normal_quad_v3(fNorm, p0, p1, p2, p3);
 			}
@@ -1829,28 +2467,28 @@ void DM_add_tangent_layer(DerivedMesh *dm)
 	int i, j, len, mf_vi[4], totvert, totface, iCalcNewMethod;
 	float *nors;
 
-	if(CustomData_get_layer_index(&dm->faceData, CD_TANGENT) != -1)
+	if (CustomData_get_layer_index(&dm->faceData, CD_TANGENT) != -1)
 		return;
 
-	nors = dm->getFaceDataArray(dm, CD_NORMAL);
+	nors = dm->getTessFaceDataArray(dm, CD_NORMAL);
 
 	/* check we have all the needed layers */
 	totvert= dm->getNumVerts(dm);
-	totface= dm->getNumFaces(dm);
+	totface= dm->getNumTessFaces(dm);
 
 	mvert= dm->getVertArray(dm);
-	mface= dm->getFaceArray(dm);
-	mtface= dm->getFaceDataArray(dm, CD_MTFACE);
+	mface= dm->getTessFaceArray(dm);
+	mtface= dm->getTessFaceDataArray(dm, CD_MTFACE);
 
-	if(!mtface) {
+	if (!mtface) {
 		orco= dm->getVertDataArray(dm, CD_ORCO);
-		if(!orco)
+		if (!orco)
 			return;
 	}
 	
 	/* create tangent layer */
-	DM_add_face_layer(dm, CD_TANGENT, CD_CALLOC, NULL);
-	tangent= DM_get_face_data_layer(dm, CD_TANGENT);
+	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");
@@ -1859,7 +2497,7 @@ void DM_add_tangent_layer(DerivedMesh *dm)
 
 	// new computation method
 	iCalcNewMethod = 1;
-	if(iCalcNewMethod != 0) {
+	if (iCalcNewMethod != 0) {
 		SGLSLMeshToTangent mesh2tangent= {0};
 		SMikkTSpaceContext sContext= {0};
 		SMikkTSpaceInterface sInterface= {0};
@@ -1870,7 +2508,7 @@ void DM_add_tangent_layer(DerivedMesh *dm)
 		mesh2tangent.mvert = mvert;
 		mesh2tangent.orco = orco;
 		mesh2tangent.tangent = tangent;
-		mesh2tangent.numFaces = totface;
+		mesh2tangent.numTessFaces = totface;
 
 		sContext.m_pUserData = &mesh2tangent;
 		sContext.m_pInterface = &sInterface;
@@ -1885,9 +2523,9 @@ void DM_add_tangent_layer(DerivedMesh *dm)
 		iCalcNewMethod = genTangSpaceDefault(&sContext);
 	}
 
-	if(!iCalcNewMethod) {
+	if (!iCalcNewMethod) {
 		/* sum tangents at connected vertices */
-		for(i=0, tf=mtface, mf=mface; i < totface; mf++, tf++, i++) {
+		for (i=0, tf=mtface, mf=mface; i < totface; mf++, tf++, i++) {
 			v1= &mvert[mf->v1];
 			v2= &mvert[mf->v2];
 			v3= &mvert[mf->v3];
@@ -1901,7 +2539,7 @@ void DM_add_tangent_layer(DerivedMesh *dm)
 				normal_tri_v3( fno,v3->co, v2->co, v1->co);
 			}
 		
-			if(mtface) {
+			if (mtface) {
 				uv1= tf->uv[0];
 				uv2= tf->uv[1];
 				uv3= tf->uv[2];
@@ -1912,7 +2550,7 @@ void DM_add_tangent_layer(DerivedMesh *dm)
 				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)
+				if (v4)
 					map_to_sphere( &uv[3][0], &uv[3][1],orco[mf->v4][0], orco[mf->v4][1], orco[mf->v4][2]);
 			}
 		
@@ -1921,7 +2559,7 @@ void DM_add_tangent_layer(DerivedMesh *dm)
 			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) {
+			if (mf->v4) {
 				v4= &mvert[mf->v4];
 			
 				tangent_from_uv(uv1, uv3, uv4, v1->co, v3->co, v4->co, fno, tang);
@@ -1932,14 +2570,14 @@ void DM_add_tangent_layer(DerivedMesh *dm)
 		}
 	
 		/* write tangent to layer */
-		for(i=0, tf=mtface, mf=mface; i < totface; mf++, tf++, i++, tangent+=4) {
+		for (i=0, tf=mtface, mf=mface; i < totface; mf++, tf++, i++, tangent+=4) {
 			len= (mf->v4)? 4 : 3; 
 
-			if(mtface == NULL) {
+			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)
+				if (len==4)
 					map_to_sphere( &uv[3][0], &uv[3][1],orco[mf->v4][0], orco[mf->v4][1], orco[mf->v4][2]);
 			}
 		
@@ -1948,7 +2586,7 @@ void DM_add_tangent_layer(DerivedMesh *dm)
 			mf_vi[2]= mf->v3;
 			mf_vi[3]= mf->v4;
 		
-			for(j=0; j<len; j++) {
+			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;
@@ -1963,20 +2601,18 @@ void DM_add_tangent_layer(DerivedMesh *dm)
 void DM_calc_auto_bump_scale(DerivedMesh *dm)
 {
 	/* int totvert= dm->getNumVerts(dm); */ /* UNUSED */
-	int totface= dm->getNumFaces(dm);
+	int totface= dm->getNumTessFaces(dm);
 
 	MVert * mvert = dm->getVertArray(dm);
-	MFace * mface = dm->getFaceArray(dm);
-	MTFace * mtface = dm->getFaceDataArray(dm, CD_MTFACE);
+	MFace * mface = dm->getTessFaceArray(dm);
+	MTFace * mtface = dm->getTessFaceDataArray(dm, CD_MTFACE);
 
-	if(mtface)
-	{
+	if (mtface) {
 		double dsum = 0.0;
 		int nr_accumulated = 0;
 		int f;
 
-		for ( f=0; f<totface; f++ )
-		{
+		for ( f=0; f < totface; f++ ) {
 			{
 				float * verts[4], * tex_coords[4];
 				const int nr_verts = mface[f].v4!=0 ? 4 : 3;
@@ -1984,47 +2620,47 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm)
 
 				verts[0]=mvert[mface[f].v1].co; verts[1]=mvert[mface[f].v2].co; verts[2]=mvert[mface[f].v3].co;
 				tex_coords[0]=mtface[f].uv[0]; tex_coords[1]=mtface[f].uv[1]; tex_coords[2]=mtface[f].uv[2];
-				if(nr_verts==4)
-				{
+				if (nr_verts==4) {
 					verts[3]=mvert[mface[f].v4].co;
 					tex_coords[3]=mtface[f].uv[3];
 				}
 
 				// discard degenerate faces
 				is_degenerate = 0;
-				if(	equals_v3v3(verts[0], verts[1]) || equals_v3v3(verts[0], verts[2]) || equals_v3v3(verts[1], verts[2]) ||
+				if (	equals_v3v3(verts[0], verts[1]) || equals_v3v3(verts[0], verts[2]) || equals_v3v3(verts[1], verts[2]) ||
 					equals_v2v2(tex_coords[0], tex_coords[1]) || equals_v2v2(tex_coords[0], tex_coords[2]) || equals_v2v2(tex_coords[1], tex_coords[2]) )
 				{
 					is_degenerate = 1;
 				}
 
 				// verify last vertex as well if this is a quad
-				if ( is_degenerate==0 && nr_verts==4 )
-				{
-					if(	equals_v3v3(verts[3], verts[0]) || equals_v3v3(verts[3], verts[1]) || equals_v3v3(verts[3], verts[2]) ||
-						equals_v2v2(tex_coords[3], tex_coords[0]) || equals_v2v2(tex_coords[3], tex_coords[1]) || equals_v2v2(tex_coords[3], tex_coords[2]) )
+				if (is_degenerate == 0 && nr_verts == 4) {
+					if (equals_v3v3(verts[3], verts[0]) || equals_v3v3(verts[3], verts[1]) || equals_v3v3(verts[3], verts[2]) ||
+					    equals_v2v2(tex_coords[3], tex_coords[0]) || equals_v2v2(tex_coords[3], tex_coords[1]) || equals_v2v2(tex_coords[3], tex_coords[2]) )
 					{
 						is_degenerate = 1;
 					}
 
 					// verify the winding is consistent
-					if ( is_degenerate==0 )
-					{
+					if (is_degenerate == 0) {
 						float prev_edge[2];
 						int is_signed = 0;
 						sub_v2_v2v2(prev_edge, tex_coords[0], tex_coords[3]);
 
 						i = 0;
-						while ( is_degenerate==0 && i<4 )
-						{
+						while (is_degenerate == 0 && i < 4) {
 							float cur_edge[2], signed_area;
 							sub_v2_v2v2(cur_edge, tex_coords[(i+1)&0x3], tex_coords[i]);
 							signed_area = prev_edge[0]*cur_edge[1] - prev_edge[1]*cur_edge[0];
-							if ( i==0 ) is_signed = signed_area<0.0f ? 1 : 0;
-							else if((is_signed!=0)!=(signed_area<0.0f)) is_degenerate=1;
 
-							if ( is_degenerate==0 )
-							{
+							if (i == 0 ) {
+								is_signed = (signed_area < 0.0f) ? 1 : 0;
+							}
+							else if ((is_signed != 0) != (signed_area < 0.0f)) {
+								is_degenerate = 1;
+							}
+
+							if (is_degenerate == 0) {
 								copy_v2_v2(prev_edge, cur_edge);
 								++i;
 							}
@@ -2033,13 +2669,11 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm)
 				}
 
 				// proceed if not a degenerate face
-				if ( is_degenerate==0 )
-				{
+				if (is_degenerate == 0) {
 					int nr_tris_to_pile=0;
 					// quads split at shortest diagonal
 					int offs = 0;		// initial triangulation is 0,1,2 and 0, 2, 3
-					if ( nr_verts==4 )
-					{
+					if (nr_verts == 4) {
 						float pos_len_diag0, pos_len_diag1;
 						float vtmp[3];
 						sub_v3_v3v3(vtmp, verts[2], verts[0]);
@@ -2047,10 +2681,10 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm)
 						sub_v3_v3v3(vtmp, verts[3], verts[1]);
 						pos_len_diag1 = dot_v3v3(vtmp, vtmp);
 
-						if(pos_len_diag1<pos_len_diag0)
+						if (pos_len_diag1<pos_len_diag0) {
 							offs=1;		// alter split
-						else if(pos_len_diag0==pos_len_diag1)		// do UV check instead
-						{
+						}
+						else if (pos_len_diag0==pos_len_diag1) { /* do UV check instead */
 							float tex_len_diag0, tex_len_diag1;
 
 							sub_v2_v2v2(vtmp, tex_coords[2], tex_coords[0]);
@@ -2058,15 +2692,13 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm)
 							sub_v2_v2v2(vtmp, tex_coords[3], tex_coords[1]);
 							tex_len_diag1 = dot_v2v2(vtmp, vtmp);
 
-							if(tex_len_diag1<tex_len_diag0)
-							{
-								offs=1;		// alter split
+							if (tex_len_diag1<tex_len_diag0) {
+								offs=1; /* alter split */
 							}
 						}
 					}
-					nr_tris_to_pile = nr_verts-2 ;
-					if ( nr_tris_to_pile==1 || nr_tris_to_pile==2 )
-					{
+					nr_tris_to_pile = nr_verts - 2;
+					if (nr_tris_to_pile==1 || nr_tris_to_pile==2) {
 						const int indices[] = {offs+0, offs+1, offs+2, offs+0, offs+2, (offs+3)&0x3 };
 						int t;
 						for ( t=0; t<nr_tris_to_pile; t++ )
@@ -2081,8 +2713,7 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm)
 							sub_v2_v2v2(edge_t1, tex_coords[indices[t*3+2]], tex_coords[indices[t*3+0]]);
 
 							f2x_area_uv = fabsf(edge_t0[0]*edge_t1[1] - edge_t0[1]*edge_t1[0]);
-							if ( f2x_area_uv>FLT_EPSILON )
-							{
+							if (f2x_area_uv>FLT_EPSILON) {
 								float norm[3], v0[3], v1[3], f2x_surf_area, fsurf_ratio;
 								sub_v3_v3v3(v0, p1, p0);
 								sub_v3_v3v3(v1, p2, p0);
@@ -2107,8 +2738,7 @@ void DM_calc_auto_bump_scale(DerivedMesh *dm)
 			dm->auto_bump_scale = use_as_render_bump_scale;
 		}
 	}
-	else
-	{
+	else {
 		dm->auto_bump_scale = 1.0f;
 	}
 }
@@ -2124,64 +2754,98 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
 	memset(attribs, 0, sizeof(DMVertexAttribs));
 
 	vdata = &dm->vertData;
-	fdata = &dm->faceData;
-
-	/* ugly hack, editmesh derivedmesh doesn't copy face data, this way we
-	 * can use offsets instead */
-	if(dm->type == DM_TYPE_EDITMESH)
-		tfdata = &((EditMeshDerivedMesh*)dm)->em->fdata;
-	else
-		tfdata = fdata;
-
+	fdata = tfdata = dm->getTessFaceDataLayout(dm);
+	
 	/* calc auto bump scale if necessary */
-	if(dm->auto_bump_scale<=0.0f)
+	if (dm->auto_bump_scale <= 0.0f)
 		DM_calc_auto_bump_scale(dm);
 
 	/* add a tangent layer if necessary */
-	for(b = 0; b < gattribs->totlayer; b++)
-		if(gattribs->layer[b].type == CD_TANGENT)
-			if(CustomData_get_layer_index(fdata, CD_TANGENT) == -1)
+	for (b = 0; b < gattribs->totlayer; b++)
+		if (gattribs->layer[b].type == CD_TANGENT)
+			if (CustomData_get_layer_index(fdata, CD_TANGENT) == -1)
 				DM_add_tangent_layer(dm);
 
-	for(b = 0; b < gattribs->totlayer; b++) {
-		if(gattribs->layer[b].type == CD_MTFACE) {
+	for (b = 0; b < gattribs->totlayer; b++) {
+		if (gattribs->layer[b].type == CD_MTFACE) {
 			/* uv coordinates */
-			if(gattribs->layer[b].name[0])
-				layer = CustomData_get_named_layer_index(tfdata, CD_MTFACE,
-					gattribs->layer[b].name);
-			else
-				layer = CustomData_get_active_layer_index(tfdata, CD_MTFACE);
+			if (dm->type == DM_TYPE_EDITBMESH) {
+				/* exception .. */
+				CustomData *ldata = dm->getLoopDataLayout(dm);
+
+				if (gattribs->layer[b].name[0])
+					layer = CustomData_get_named_layer_index(ldata, CD_MLOOPUV,
+						gattribs->layer[b].name);
+				else
+					layer = CustomData_get_active_layer_index(ldata, CD_MLOOPUV);
+
+				if (layer != -1) {
+					a = attribs->tottface++;
+
+					attribs->tface[a].array = tfdata->layers[layer].data;
+					attribs->tface[a].emOffset = tfdata->layers[layer].offset;
+					attribs->tface[a].glIndex = gattribs->layer[b].glindex;
+					attribs->tface[a].glTexco = gattribs->layer[b].gltexco;
+				}
+			}
+			else {
+				if (gattribs->layer[b].name[0])
+					layer = CustomData_get_named_layer_index(tfdata, CD_MTFACE,
+						gattribs->layer[b].name);
+				else
+					layer = CustomData_get_active_layer_index(tfdata, CD_MTFACE);
 
-			if(layer != -1) {
-				a = attribs->tottface++;
+				if (layer != -1) {
+					a = attribs->tottface++;
 
-				attribs->tface[a].array = tfdata->layers[layer].data;
-				attribs->tface[a].emOffset = tfdata->layers[layer].offset;
-				attribs->tface[a].glIndex = gattribs->layer[b].glindex;
-				attribs->tface[a].glTexco = gattribs->layer[b].gltexco;
+					attribs->tface[a].array = tfdata->layers[layer].data;
+					attribs->tface[a].emOffset = tfdata->layers[layer].offset;
+					attribs->tface[a].glIndex = gattribs->layer[b].glindex;
+					attribs->tface[a].glTexco = gattribs->layer[b].gltexco;
+				}
 			}
 		}
-		else if(gattribs->layer[b].type == CD_MCOL) {
-			/* vertex colors */
-			if(gattribs->layer[b].name[0])
-				layer = CustomData_get_named_layer_index(tfdata, CD_MCOL,
-					gattribs->layer[b].name);
-			else
-				layer = CustomData_get_active_layer_index(tfdata, CD_MCOL);
+		else if (gattribs->layer[b].type == CD_MCOL) {
+			if (dm->type == DM_TYPE_EDITBMESH) {
+				/* exception .. */
+				CustomData *ldata = dm->getLoopDataLayout(dm);
+
+				if (gattribs->layer[b].name[0])
+					layer = CustomData_get_named_layer_index(ldata, CD_MLOOPCOL,
+						gattribs->layer[b].name);
+				else
+					layer = CustomData_get_active_layer_index(ldata, CD_MLOOPCOL);
 
-			if(layer != -1) {
-				a = attribs->totmcol++;
+				if (layer != -1) {
+					a = attribs->totmcol++;
 
-				attribs->mcol[a].array = tfdata->layers[layer].data;
-				attribs->mcol[a].emOffset = tfdata->layers[layer].offset;
-				attribs->mcol[a].glIndex = gattribs->layer[b].glindex;
+					attribs->mcol[a].array = tfdata->layers[layer].data;
+					attribs->mcol[a].emOffset = tfdata->layers[layer].offset;
+					attribs->mcol[a].glIndex = gattribs->layer[b].glindex;
+				}
+			}
+			else {
+				/* vertex colors */
+				if (gattribs->layer[b].name[0])
+					layer = CustomData_get_named_layer_index(tfdata, CD_MCOL,
+						gattribs->layer[b].name);
+				else
+					layer = CustomData_get_active_layer_index(tfdata, CD_MCOL);
+
+				if (layer != -1) {
+					a = attribs->totmcol++;
+
+					attribs->mcol[a].array = tfdata->layers[layer].data;
+					attribs->mcol[a].emOffset = tfdata->layers[layer].offset;
+					attribs->mcol[a].glIndex = gattribs->layer[b].glindex;
+				}
 			}
 		}
-		else if(gattribs->layer[b].type == CD_TANGENT) {
+		else if (gattribs->layer[b].type == CD_TANGENT) {
 			/* tangents */
 			layer = CustomData_get_layer_index(fdata, CD_TANGENT);
 
-			if(layer != -1) {
+			if (layer != -1) {
 				attribs->tottang = 1;
 
 				attribs->tang.array = fdata->layers[layer].data;
@@ -2189,11 +2853,11 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
 				attribs->tang.glIndex = gattribs->layer[b].glindex;
 			}
 		}
-		else if(gattribs->layer[b].type == CD_ORCO) {
+		else if (gattribs->layer[b].type == CD_ORCO) {
 			/* original coordinates */
 			layer = CustomData_get_layer_index(vdata, CD_ORCO);
 
-			if(layer != -1) {
+			if (layer != -1) {
 				attribs->totorco = 1;
 
 				attribs->orco.array = vdata->layers[layer].data;
@@ -2214,7 +2878,7 @@ void DM_set_object_boundbox(Object *ob, DerivedMesh *dm)
 
 	dm->getMinMax(dm, min, max);
 
-	if(!ob->bb)
+	if (!ob->bb)
 		ob->bb= MEM_callocN(sizeof(BoundBox), "DM-BoundBox");
 
 	boundbox_set_from_min_max(ob->bb, min, max);
@@ -2223,12 +2887,21 @@ void DM_set_object_boundbox(Object *ob, DerivedMesh *dm)
 /* --- NAVMESH (begin) --- */
 #ifdef WITH_GAMEENGINE
 
-BM_INLINE int navmesh_bit(int a, int b)
+/* BMESH_TODO, navmesh is not working right currently
+ * All tools set this as MPoly data, but derived mesh currently draws from MFace (tessface)
+ *
+ * Proposed solution, rather then copy CD_RECAST into the MFace array,
+ * use ORIGINDEX to get the original poly index and then get the CD_RECAST
+ * data from the original me->mpoly layer. - campbell
+ */
+
+
+BLI_INLINE int navmesh_bit(int a, int b)
 {
 	return (a & (1 << b)) >> b;
 }
 
-BM_INLINE void navmesh_intToCol(int i, float col[3])
+BLI_INLINE void navmesh_intToCol(int i, float col[3])
 {
 	int	r = navmesh_bit(i, 0) + navmesh_bit(i, 3) * 2 + 1;
 	int	g = navmesh_bit(i, 1) + navmesh_bit(i, 4) * 2 + 1;
@@ -2243,26 +2916,27 @@ static void navmesh_drawColored(DerivedMesh *dm)
 	int a, glmode;
 	MVert *mvert = (MVert *)CustomData_get_layer(&dm->vertData, CD_MVERT);
 	MFace *mface = (MFace *)CustomData_get_layer(&dm->faceData, CD_MFACE);
-	int *polygonIdx = (int *)CustomData_get_layer(&dm->faceData, CD_RECAST);
+	int *polygonIdx = (int *)CustomData_get_layer(&dm->polyData, CD_RECAST);
 	float col[3];
 
 	if (!polygonIdx)
 		return;
 
-	/*
+#if 0
 	//UI_ThemeColor(TH_WIRE);
 	glDisable(GL_LIGHTING);
 	glLineWidth(2.0);
 	dm->drawEdges(dm, 0, 1);
 	glLineWidth(1.0);
-	glEnable(GL_LIGHTING);*/
+	glEnable(GL_LIGHTING);
+#endif
 
 	glDisable(GL_LIGHTING);
-	/*  if(GPU_buffer_legacy(dm) ) */ { /* TODO - VBO draw code, not high priority - campbell */
+	/*  if (GPU_buffer_legacy(dm) ) */ { /* TODO - VBO draw code, not high priority - campbell */
 		DEBUG_VBO( "Using legacy code. drawNavMeshColored\n" );
 		//glShadeModel(GL_SMOOTH);
 		glBegin(glmode = GL_QUADS);
-		for(a = 0; a < dm->numFaceData; a++, mface++) {
+		for (a = 0; a < dm->numTessFaceData; a++, mface++) {
 			int new_glmode = mface->v4?GL_QUADS:GL_TRIANGLES;
 			int pi = polygonIdx[a];
 			if (pi <= 0) {
@@ -2272,7 +2946,7 @@ static void navmesh_drawColored(DerivedMesh *dm)
 				navmesh_intToCol(pi, col);
 			}
 
-			if(new_glmode != glmode) {
+			if (new_glmode != glmode) {
 				glEnd();
 				glBegin(glmode = new_glmode);
 			}
@@ -2280,7 +2954,7 @@ static void navmesh_drawColored(DerivedMesh *dm)
 			glVertex3fv(mvert[mface->v1].co);
 			glVertex3fv(mvert[mface->v2].co);
 			glVertex3fv(mvert[mface->v3].co);
-			if(mface->v4) {
+			if (mface->v4) {
 				glVertex3fv(mvert[mface->v4].co);
 			}
 		}
@@ -2290,8 +2964,8 @@ static void navmesh_drawColored(DerivedMesh *dm)
 }
 
 static void navmesh_DM_drawFacesTex(DerivedMesh *dm,
-			int (*setDrawOptions)(MTFace *tface, int has_mcol, int matnr),
-			int (*compareDrawOptions)(void *userData, int cur_index, int next_index),
+			DMSetDrawOptionsTex setDrawOptions,
+			DMCompareDrawOptions compareDrawOptions,
 			void *userData)
 {
 	(void) setDrawOptions;
@@ -2303,7 +2977,7 @@ static void navmesh_DM_drawFacesTex(DerivedMesh *dm,
 
 static void navmesh_DM_drawFacesSolid(DerivedMesh *dm,
                                       float (*partial_redraw_planes)[4],
-                                      int UNUSED(fast), int (*setMaterial)(int, void *attribs))
+                                      int UNUSED(fast), DMSetMaterial setMaterial)
 {
 	(void) partial_redraw_planes;
 	(void) setMaterial;
@@ -2315,7 +2989,7 @@ static void navmesh_DM_drawFacesSolid(DerivedMesh *dm,
 static DerivedMesh *navmesh_dm_createNavMeshForVisualization(DerivedMesh *dm)
 {
 	DerivedMesh *result;
-	int maxFaces = dm->getNumFaces(dm);
+	int maxFaces = dm->getNumPolys(dm);
 	int *recastData;
 	int vertsPerPoly=0, nverts=0, ndtris=0, npolys=0;
 	float* verts=NULL;
@@ -2324,14 +2998,14 @@ static DerivedMesh *navmesh_dm_createNavMeshForVisualization(DerivedMesh *dm)
 	int res;
 
 	result = CDDM_copy(dm);
-	if (!CustomData_has_layer(&result->faceData, CD_RECAST)) {
-		int *sourceRecastData = (int*)CustomData_get_layer(&dm->faceData, CD_RECAST);
+	if (!CustomData_has_layer(&result->polyData, CD_RECAST)) {
+		int *sourceRecastData = (int*)CustomData_get_layer(&dm->polyData, CD_RECAST);
 		if (sourceRecastData) {
-			CustomData_add_layer_named(&result->faceData, CD_RECAST, CD_DUPLICATE,
+			CustomData_add_layer_named(&result->polyData, CD_RECAST, CD_DUPLICATE,
 			                           sourceRecastData, maxFaces, "recastData");
 		}
 	}
-	recastData = (int*)CustomData_get_layer(&result->faceData, CD_RECAST);
+	recastData = (int*)CustomData_get_layer(&result->polyData, CD_RECAST);
 
 	/* note: This is not good design! - really should not be doing this */
 	result->drawFacesTex =  navmesh_DM_drawFacesTex;
@@ -2366,7 +3040,7 @@ static DerivedMesh *navmesh_dm_createNavMeshForVisualization(DerivedMesh *dm)
 		}
 	}
 	else {
-		printf("Error during creation polygon infos\n");
+		printf("%s: Error during creation polygon infos\n", __func__);
 	}
 
 	/* clean up */
@@ -2393,6 +3067,32 @@ static DerivedMesh *navmesh_dm_createNavMeshForVisualization(DerivedMesh *dm)
 /* --- NAVMESH (end) --- */
 
 
+void DM_init_origspace(DerivedMesh *dm)
+{
+	static float default_osf[4][2] = {{0, 0}, {1, 0}, {1, 1}, {0, 1}};
+
+	OrigSpaceLoop *lof_array = CustomData_get_layer(&dm->loopData, CD_ORIGSPACE_MLOOP);
+	OrigSpaceLoop *lof;
+	const int numpoly = dm->getNumPolys(dm);
+	// const int numloop = dm->getNumLoops(dm);
+	MPoly *mp = dm->getPolyArray(dm);
+	int i, j;
+
+	for (i = 0; i < numpoly; i++, mp++) {
+		/* only quads/tri's for now */
+		if (mp->totloop == 3 || mp->totloop == 4) {
+			lof = lof_array + mp->loopstart;
+			for (j = 0; j < mp->totloop; j++, lof++) {
+				copy_v2_v2(lof->uv, default_osf[j]);
+			}
+		}
+	}
+
+	dm->dirty |= DM_DIRTY_TESS_CDLAYERS;
+}
+
+
+
 /* derivedmesh info printing function,
  * to help track down differences DM output */
 
@@ -2429,26 +3129,35 @@ char *DM_debug_info(DerivedMesh *dm)
 	BLI_dynstr_appendf(dynstr, "    'ptr': '%p',\n", (void *)dm);
 	switch (dm->type) {
 		case DM_TYPE_CDDM:     tstr = "DM_TYPE_CDDM";     break;
-		case DM_TYPE_EDITMESH: tstr = "DM_TYPE_EDITMESH";  break;
+		case DM_TYPE_EDITBMESH: tstr = "DM_TYPE_EDITMESH";  break;
 		case DM_TYPE_CCGDM:    tstr = "DM_TYPE_CCGDM";     break;
 		default:               tstr = "UNKNOWN";           break;
 	}
 	BLI_dynstr_appendf(dynstr, "    'type': '%s',\n", tstr);
 	BLI_dynstr_appendf(dynstr, "    'numVertData': %d,\n", dm->numVertData);
 	BLI_dynstr_appendf(dynstr, "    'numEdgeData': %d,\n", dm->numEdgeData);
-	BLI_dynstr_appendf(dynstr, "    'numFaceData': %d,\n", dm->numFaceData);
+	BLI_dynstr_appendf(dynstr, "    'numTessFaceData': %d,\n", dm->numTessFaceData);
+	BLI_dynstr_appendf(dynstr, "    'numPolyData': %d,\n", dm->numPolyData);
 	BLI_dynstr_appendf(dynstr, "    'deformedOnly': %d,\n", dm->deformedOnly);
 
 	BLI_dynstr_appendf(dynstr, "    'vertexLayers': (\n");
 	dm_debug_info_layers(dynstr, dm, dm->getVertDataArray);
 	BLI_dynstr_appendf(dynstr, "    ),\n");
 
+	BLI_dynstr_appendf(dynstr, "    'loopLayers': (\n");
+	dm_debug_info_layers(dynstr, dm, DM_get_loop_data_layer);
+	BLI_dynstr_appendf(dynstr, "    ),\n");
+
 	BLI_dynstr_appendf(dynstr, "    'edgeLayers': (\n");
 	dm_debug_info_layers(dynstr, dm, dm->getEdgeDataArray);
 	BLI_dynstr_appendf(dynstr, "    ),\n");
 
-	BLI_dynstr_appendf(dynstr, "    'faceLayers': (\n");
-	dm_debug_info_layers(dynstr, dm, dm->getFaceDataArray);
+	BLI_dynstr_appendf(dynstr, "    'tessFaceLayers': (\n");
+	dm_debug_info_layers(dynstr, dm, dm->getTessFaceDataArray);
+	BLI_dynstr_appendf(dynstr, "    ),\n");
+
+	BLI_dynstr_appendf(dynstr, "    'polyLayers': (\n");
+	dm_debug_info_layers(dynstr, dm, DM_get_poly_data_layer);
 	BLI_dynstr_appendf(dynstr, "    ),\n");
 
 	BLI_dynstr_appendf(dynstr, "}\n");
@@ -2461,7 +3170,7 @@ char *DM_debug_info(DerivedMesh *dm)
 void DM_debug_print(DerivedMesh *dm)
 {
 	char *str = DM_debug_info(dm);
-	printf("%s", str);
+	puts(str);
 	fflush(stdout);
 	MEM_freeN(str);
 }
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 767401a..93401a5 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -65,17 +65,17 @@
 #include "RNA_access.h"
 
 /* *********************** NOTE ON POSE AND ACTION **********************
-
-  - Pose is the local (object level) component of armature. The current
-	object pose is saved in files, and (will be) is presorted for dependency
-  - Actions have fewer (or other) channels, and write data to a Pose
-  - Currently ob->pose data is controlled in where_is_pose only. The (recalc)
-	event system takes care of calling that
-  - The NLA system (here too) uses Poses as interpolation format for Actions
-  - Therefore we assume poses to be static, and duplicates of poses have channels in
-	same order, for quick interpolation reasons
-
-  ****************************** (ton) ************************************ */
+ *
+ * - Pose is the local (object level) component of armature. The current
+ *   object pose is saved in files, and (will be) is presorted for dependency
+ * - Actions have fewer (or other) channels, and write data to a Pose
+ * - Currently ob->pose data is controlled in where_is_pose only. The (recalc)
+ *   event system takes care of calling that
+ * - The NLA system (here too) uses Poses as interpolation format for Actions
+ * - Therefore we assume poses to be static, and duplicates of poses have channels in
+ *   same order, for quick interpolation reasons
+ *
+ * ****************************** (ton) ************************************ */
 
 /* ***************** Library data level operations on action ************** */
 
@@ -415,7 +415,7 @@ bPoseChannel *get_pose_channel(const bPose *pose, const char *name)
 	if (ELEM(NULL, pose, name) || (name[0] == 0))
 		return NULL;
 	
-	if(pose->chanhash)
+	if (pose->chanhash)
 		return BLI_ghash_lookup(pose->chanhash, (void *)name);
 	
 	return BLI_findstring(&((bPose *)pose)->chanbase, name, offsetof(bPoseChannel, name));
@@ -432,7 +432,7 @@ bPoseChannel *verify_pose_channel(bPose *pose, const char *name)
 	
 	/* See if this channel exists */
 	chan= BLI_findstring(&pose->chanbase, name, offsetof(bPoseChannel, name));
-	if(chan) {
+	if (chan) {
 		return chan;
 	}
 
@@ -464,10 +464,11 @@ bPoseChannel *get_active_posechannel (Object *ob)
 {
 	bArmature *arm= (ob) ? ob->data : NULL;
 	bPoseChannel *pchan;
-	
-	if ELEM3(NULL, ob, ob->pose, arm)
+
+	if (ELEM3(NULL, ob, ob->pose, arm)) {
 		return NULL;
-	
+	}
+
 	/* find active */
 	for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
 		if ((pchan->bone) && (pchan->bone == arm->act_bone) && (pchan->bone->layer & arm->layer))
@@ -523,7 +524,7 @@ void copy_pose (bPose **dst, bPose *src, int copycon)
 			pchan->mpath= NULL; /* motion paths should not get copied yet... */
 		}
 		
-		if(pchan->prop) {
+		if (pchan->prop) {
 			pchan->prop= IDP_CopyProperty(pchan->prop);
 		}
 	}
@@ -545,8 +546,8 @@ void init_pose_itasc(bItasc *itasc)
 		itasc->numstep = 4;
 		itasc->precision = 0.005f;
 		itasc->flag = ITASC_AUTO_STEP|ITASC_INITIAL_REITERATION;
-		itasc->feedback = 20.f;
-		itasc->maxvel = 50.f;
+		itasc->feedback = 20.0f;
+		itasc->maxvel = 50.0f;
 		itasc->solver = ITASC_SOLVER_SDLS;
 		itasc->dampmax = 0.5;
 		itasc->dampeps = 0.15;
@@ -570,18 +571,18 @@ void init_pose_ikparam(bPose *pose)
 
 void make_pose_channels_hash(bPose *pose) 
 {
-	if(!pose->chanhash) {
+	if (!pose->chanhash) {
 		bPoseChannel *pchan;
 
 		pose->chanhash= BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "make_pose_chan gh");
-		for(pchan=pose->chanbase.first; pchan; pchan=pchan->next)
+		for (pchan=pose->chanbase.first; pchan; pchan=pchan->next)
 			BLI_ghash_insert(pose->chanhash, pchan->name, pchan);
 	}
 }
 
 void free_pose_channels_hash(bPose *pose) 
 {
-	if(pose->chanhash) {
+	if (pose->chanhash) {
 		BLI_ghash_free(pose->chanhash, NULL, NULL);
 		pose->chanhash= NULL;
 	}
@@ -656,7 +657,7 @@ static void copy_pose_channel_data(bPoseChannel *pchan, const bPoseChannel *chan
 	pchan->flag= chan->flag;
 	
 	con= chan->constraints.first;
-	for(pcon= pchan->constraints.first; pcon && con; pcon= pcon->next, con= con->next) {
+	for (pcon= pchan->constraints.first; pcon && con; pcon= pcon->next, con= con->next) {
 		pcon->enforce= con->enforce;
 		pcon->headtail= con->headtail;
 	}
@@ -689,13 +690,13 @@ void duplicate_pose_channel_data(bPoseChannel *pchan, const bPoseChannel *pchan_
 	copy_constraints(&pchan->constraints, &pchan_from->constraints, TRUE);
 
 	/* id-properties */
-	if(pchan->prop) {
+	if (pchan->prop) {
 		/* unlikely but possible it exists */
 		IDP_FreeProperty(pchan->prop);
 		MEM_freeN(pchan->prop);
 		pchan->prop= NULL;
 	}
-	if(pchan_from->prop) {
+	if (pchan_from->prop) {
 		pchan->prop= IDP_CopyProperty(pchan_from->prop);
 	}
 
@@ -727,19 +728,19 @@ void update_pose_constraint_flags(bPose *pose)
 				
 				pchan->constflag |= PCHAN_HAS_IK;
 				
-				if(data->tar==NULL || (data->tar->type==OB_ARMATURE && data->subtarget[0]==0))
+				if (data->tar==NULL || (data->tar->type==OB_ARMATURE && data->subtarget[0]==0))
 					pchan->constflag |= PCHAN_HAS_TARGET;
 				
 				/* negative rootbone = recalc rootbone index. used in do_versions */
-				if(data->rootbone<0) {
+				if (data->rootbone<0) {
 					data->rootbone= 0;
 					
-					if(data->flag & CONSTRAINT_IK_TIP) parchan= pchan;
+					if (data->flag & CONSTRAINT_IK_TIP) parchan= pchan;
 					else parchan= pchan->parent;
 					
-					while(parchan) {
+					while (parchan) {
 						data->rootbone++;
-						if((parchan->bone->flag & BONE_CONNECTED)==0)
+						if ((parchan->bone->flag & BONE_CONNECTED)==0)
 							break;
 						parchan= parchan->parent;
 					}
@@ -837,7 +838,7 @@ void pose_remove_group (Object *ob)
 		/* now, remove it from the pose */
 		BLI_freelinkN(&pose->agroups, grp);
 		pose->active_group--;
-		if(pose->active_group < 0 || pose->agroups.first == NULL) {
+		if (pose->active_group < 0 || pose->agroups.first == NULL) {
 			pose->active_group= 0;
 		}
 	}
@@ -932,7 +933,7 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
 	}	
 	
 	if (foundvert || foundmod) {
-		if(min==max) max+= 1.0f;
+		if (min==max) max+= 1.0f;
 		*start= min;
 		*end= max;
 	}
@@ -1054,7 +1055,7 @@ short action_get_item_transforms (bAction *act, Object *ob, bPoseChannel *pchan,
 /* Copy the data from the action-pose (src) into the pose */
 /* both args are assumed to be valid */
 /* exported to game engine */
-/* Note! this assumes both poses are aligned, this isnt always true when dealing with user poses */
+/* Note! this assumes both poses are aligned, this isn't always true when dealing with user poses */
 void extract_pose_from_pose(bPose *pose, const bPose *src)
 {
 	const bPoseChannel *schan;
@@ -1097,7 +1098,7 @@ void copy_pose_result(bPose *to, bPose *from)
 {
 	bPoseChannel *pchanto, *pchanfrom;
 	
-	if(to==NULL || from==NULL) {
+	if (to==NULL || from==NULL) {
 		printf("pose result copy error to:%p from:%p\n", (void *)to, (void *)from); // debug temp
 		return;
 	}
@@ -1108,9 +1109,9 @@ void copy_pose_result(bPose *to, bPose *from)
 	}
 
 
-	for(pchanfrom= from->chanbase.first; pchanfrom; pchanfrom= pchanfrom->next) {
+	for (pchanfrom= from->chanbase.first; pchanfrom; pchanfrom= pchanfrom->next) {
 		pchanto= get_pose_channel(to, pchanfrom->name);
-		if(pchanto) {
+		if (pchanto) {
 			copy_m4_m4(pchanto->pose_mat, pchanfrom->pose_mat);
 			copy_m4_m4(pchanto->chan_mat, pchanfrom->chan_mat);
 			
@@ -1199,7 +1200,7 @@ static void blend_pose_strides(bPose *dst, bPose *src, float srcweight, short mo
 {
 	float dstweight;
 	
-	switch (mode){
+	switch (mode) {
 		case ACTSTRIPMODE_BLEND:
 			dstweight = 1.0F - srcweight;
 			break;
@@ -1214,23 +1215,22 @@ static void blend_pose_strides(bPose *dst, bPose *src, float srcweight, short mo
 }
 
 
-/* 
-
-bone matching diagram, strips A and B
-
-				 .------------------------.
-				 |         A              |
-				 '------------------------'
-				 .          .             b2
-				 .          .-------------v----------.
-				 .      	|         B   .          |
-				 .          '------------------------'
-				 .          .             .
-				 .          .             .
-offset:          .    0     .    A-B      .  A-b2+B     
-				 .          .             .
-
-*/
+/*
+ * bone matching diagram, strips A and B
+ * 
+ *                  .------------------------.
+ *                  |         A              |
+ *                  '------------------------'
+ *                  .          .             b2
+ *                  .          .-------------v----------.
+ *                  .          |         B   .          |
+ *                  .          '------------------------'
+ *                  .          .             .
+ *                  .          .             .
+ * offset:          .    0     .    A-B      .  A-b2+B
+ *                  .          .             .
+ *
+ * */
 
 
 static void blend_pose_offset_bone(bActionStrip *strip, bPose *dst, bPose *src, float srcweight, short mode)
@@ -1238,15 +1238,15 @@ static void blend_pose_offset_bone(bActionStrip *strip, bPose *dst, bPose *src,
 	/* matching offset bones */
 	/* take dst offset, and put src on on that location */
 	
-	if(strip->offs_bone[0]==0)
+	if (strip->offs_bone[0]==0)
 		return;
 	
 	/* are we also blending with matching bones? */
-	if(strip->prev && strip->start>=strip->prev->start) {
+	if (strip->prev && strip->start>=strip->prev->start) {
 		bPoseChannel *dpchan= get_pose_channel(dst, strip->offs_bone);
-		if(dpchan) {
+		if (dpchan) {
 			bPoseChannel *spchan= get_pose_channel(src, strip->offs_bone);
-			if(spchan) {
+			if (spchan) {
 				float vec[3];
 				
 				/* dst->ctime has the internal strip->prev action time */
@@ -1254,7 +1254,7 @@ static void blend_pose_offset_bone(bActionStrip *strip, bPose *dst, bPose *src,
 				
 				float ctime= get_actionstrip_frame(strip, src->ctime, 1);
 				
-				if( ctime > strip->prev->end) {
+				if ( ctime > strip->prev->end) {
 					bActionChannel *achan;
 					
 					/* add src to dest, minus the position of src on strip->prev->end */
@@ -1262,7 +1262,7 @@ static void blend_pose_offset_bone(bActionStrip *strip, bPose *dst, bPose *src,
 					ctime= get_actionstrip_frame(strip, strip->prev->end, 0);
 					
 					achan= get_action_channel(strip->act, strip->offs_bone);
-					if(achan && achan->ipo) {
+					if (achan && achan->ipo) {
 						bPoseChannel pchan;
 						/* Evaluates and sets the internal ipo value */
 						calc_ipo(achan->ipo, ctime);
@@ -1294,8 +1294,8 @@ static void blend_pose_offset_bone(bActionStrip *strip, bPose *dst, bPose *src,
 }
 
 /* added "sizecorr" here, to allow armatures to be scaled and still have striding.
-   Only works for uniform scaling. In general I'd advise against scaling armatures ever though! (ton)
-*/
+ * Only works for uniform scaling. In general I'd advise against scaling armatures ever though! (ton)
+ */
 static float stridechannel_frame(Object *ob, float sizecorr, bActionStrip *strip, Path *path, float pathdist, float *stride_offset)
 {
 	bAction *act= strip->act;
@@ -1303,19 +1303,19 @@ static float stridechannel_frame(Object *ob, float sizecorr, bActionStrip *strip
 	bActionChannel *achan= get_action_channel(act, name);
 	int stride_axis= strip->stride_axis;
 
-	if(achan && achan->ipo) {
+	if (achan && achan->ipo) {
 		IpoCurve *icu= NULL;
 		float minx=0.0f, maxx=0.0f, miny=0.0f, maxy=0.0f;
 		int foundvert= 0;
 		
-		if(stride_axis==0) stride_axis= AC_LOC_X;
-		else if(stride_axis==1) stride_axis= AC_LOC_Y;
+		if (stride_axis==0) stride_axis= AC_LOC_X;
+		else if (stride_axis==1) stride_axis= AC_LOC_Y;
 		else stride_axis= AC_LOC_Z;
 		
 		/* calculate the min/max */
 		for (icu=achan->ipo->curve.first; icu; icu=icu->next) {
-			if(icu->adrcode==stride_axis) {
-				if(icu->totvert>1) {
+			if (icu->adrcode==stride_axis) {
+				if (icu->totvert>1) {
 					foundvert= 1;
 					minx= icu->bezt[0].vec[1][0];
 					maxx= icu->bezt[icu->totvert-1].vec[1][0];
@@ -1327,7 +1327,7 @@ static float stridechannel_frame(Object *ob, float sizecorr, bActionStrip *strip
 			}
 		}
 		
-		if(foundvert && miny!=maxy) {
+		if (foundvert && miny!=maxy) {
 			float stridelen= sizecorr*fabs(maxy-miny), striptime;
 			float actiondist, pdist, pdistNewNormalized, offs;
 			float vec1[4], vec2[4], dir[3];
@@ -1367,10 +1367,10 @@ static float stridechannel_frame(Object *ob, float sizecorr, bActionStrip *strip
 static void cyclic_offs_bone(Object *ob, bPose *pose, bActionStrip *strip, float time)
 {
 	/* only called when strip has cyclic, so >= 1.0f works... */
-	if(time >= 1.0f) {
+	if (time >= 1.0f) {
 		bActionChannel *achan= get_action_channel(strip->act, strip->offs_bone);
 
-		if(achan && achan->ipo) {
+		if (achan && achan->ipo) {
 			IpoCurve *icu= NULL;
 			Bone *bone;
 			float min[3]={0.0f, 0.0f, 0.0f}, max[3]={0.0f, 0.0f, 0.0f};
@@ -1378,13 +1378,13 @@ static void cyclic_offs_bone(Object *ob, bPose *pose, bActionStrip *strip, float
 			
 			/* calculate the min/max */
 			for (icu=achan->ipo->curve.first; icu; icu=icu->next) {
-				if(icu->totvert>1) {
+				if (icu->totvert>1) {
 					
-					if(icu->adrcode==AC_LOC_X)
+					if (icu->adrcode==AC_LOC_X)
 						index= 0;
-					else if(icu->adrcode==AC_LOC_Y)
+					else if (icu->adrcode==AC_LOC_Y)
 						index= 1;
-					else if(icu->adrcode==AC_LOC_Z)
+					else if (icu->adrcode==AC_LOC_Z)
 						index= 2;
 					else
 						continue;
@@ -1394,11 +1394,11 @@ static void cyclic_offs_bone(Object *ob, bPose *pose, bActionStrip *strip, float
 					max[index]= icu->bezt[icu->totvert-1].vec[1][1];
 				}
 			}
-			if(foundvert) {
+			if (foundvert) {
 				/* bring it into armature space */
 				sub_v3_v3v3(min, max, min);
 				bone= get_named_bone(ob->data, strip->offs_bone);	/* weak */
-				if(bone) {
+				if (bone) {
 					mul_mat3_m4_v3(bone->arm_mat, min);
 					
 					/* dominant motion, cyclic_offset was cleared in rest_pose */
@@ -1406,10 +1406,11 @@ static void cyclic_offs_bone(Object *ob, bPose *pose, bActionStrip *strip, float
 						if (strip->flag & ACTSTRIP_CYCLIC_USEX) pose->cyclic_offset[0]= time*min[0];
 						if (strip->flag & ACTSTRIP_CYCLIC_USEY) pose->cyclic_offset[1]= time*min[1];
 						if (strip->flag & ACTSTRIP_CYCLIC_USEZ) pose->cyclic_offset[2]= time*min[2];
-					} else {
-						if( fabs(min[0]) >= fabs(min[1]) && fabs(min[0]) >= fabs(min[2]))
+					}
+					else {
+						if ( fabs(min[0]) >= fabs(min[1]) && fabs(min[0]) >= fabs(min[2]))
 							pose->cyclic_offset[0]= time*min[0];
-						else if( fabs(min[1]) >= fabs(min[0]) && fabs(min[1]) >= fabs(min[2]))
+						else if ( fabs(min[1]) >= fabs(min[0]) && fabs(min[1]) >= fabs(min[2]))
 							pose->cyclic_offset[1]= time*min[1];
 						else
 							pose->cyclic_offset[2]= time*min[2];
@@ -1426,12 +1427,12 @@ static Object *get_parent_path(Object *ob)
 {
 	bConstraint *con;
 	
-	if(ob->parent && ob->parent->type==OB_CURVE)
+	if (ob->parent && ob->parent->type==OB_CURVE)
 		return ob->parent;
 	
 	for (con = ob->constraints.first; con; con=con->next) {
-		if(con->type==CONSTRAINT_TYPE_FOLLOWPATH) {
-			if(con->enforce>0.5f) {
+		if (con->type==CONSTRAINT_TYPE_FOLLOWPATH) {
+			if (con->enforce>0.5f) {
 				bFollowPathConstraint *data= con->data;
 				return data->tar;
 			}
@@ -1455,7 +1456,7 @@ static void do_nla(Scene *scene, Object *ob, int blocktype)
 	float scene_cfra= BKE_curframe(scene);
 	int	doit, dostride;
 	
-	if(blocktype==ID_AR) {
+	if (blocktype==ID_AR) {
 		copy_pose(&tpose, ob->pose, 1);
 		rest_pose(ob->pose);		// potentially destroying current not-keyed pose
 	}
@@ -1466,30 +1467,30 @@ static void do_nla(Scene *scene, Object *ob, int blocktype)
 	/* check on extend to left or right, when no strip is hit by 'cfra' */
 	for (strip=ob->nlastrips.first; strip; strip=strip->next) {
 		/* escape loop on a hit */
-		if( scene_cfra >= strip->start && scene_cfra <= strip->end + 0.1f)	/* note 0.1 comes back below */
+		if ( scene_cfra >= strip->start && scene_cfra <= strip->end + 0.1f)	/* note 0.1 comes back below */
 			break;
-		if(scene_cfra < strip->start) {
-			if(stripfirst==NULL)
+		if (scene_cfra < strip->start) {
+			if (stripfirst==NULL)
 				stripfirst= strip;
-			else if(stripfirst->start > strip->start)
+			else if (stripfirst->start > strip->start)
 				stripfirst= strip;
 		}
-		else if(scene_cfra > strip->end) {
-			if(striplast==NULL)
+		else if (scene_cfra > strip->end) {
+			if (striplast==NULL)
 				striplast= strip;
-			else if(striplast->end < strip->end)
+			else if (striplast->end < strip->end)
 				striplast= strip;
 		}
 	}
-	if(strip==NULL) {	/* extend */
-		if(striplast)
+	if (strip==NULL) {	/* extend */
+		if (striplast)
 			scene_cfra= striplast->end;
-		else if(stripfirst)
+		else if (stripfirst)
 			scene_cfra= stripfirst->start;
 	}
 	
 	/* and now go over all strips */
-	for (strip=ob->nlastrips.first; strip; strip=strip->next){
+	for (strip=ob->nlastrips.first; strip; strip=strip->next) {
 		doit=dostride= 0;
 		
 		if (strip->act && !(strip->flag & ACTSTRIP_MUTE)) {	/* so theres an action */
@@ -1497,41 +1498,41 @@ static void do_nla(Scene *scene, Object *ob, int blocktype)
 			/* Determine if the current frame is within the strip's range */
 			length = strip->end-strip->start;
 			actlength = strip->actend-strip->actstart;
-			striptime = (scene_cfra-(strip->start)) / length;
-			stripframe = (scene_cfra-(strip->start)) ;
+			striptime = (scene_cfra - strip->start) / length;
+			stripframe = (scene_cfra - strip->start);
 
-			if (striptime>=0.0){
+			if (striptime>=0.0) {
 				
-				if(blocktype==ID_AR) 
+				if (blocktype==ID_AR) 
 					rest_pose(tpose);
 				
 				/* To handle repeat, we add 0.1 frame extra to make sure the last frame is included */
 				if (striptime < 1.0f + 0.1f/length) {
 					
 					/* Handle path */
-					if ((strip->flag & ACTSTRIP_USESTRIDE) && (blocktype==ID_AR) && (ob->ipoflag & OB_DISABLE_PATH)==0){
+					if ((strip->flag & ACTSTRIP_USESTRIDE) && (blocktype==ID_AR) && (ob->ipoflag & OB_DISABLE_PATH)==0) {
 						Object *parent= get_parent_path(ob);
 						
 						if (parent) {
 							Curve *cu = parent->data;
 							float ctime, pdist;
 							
-							if (cu->flag & CU_PATH){
+							if (cu->flag & CU_PATH) {
 								/* Ensure we have a valid path */
-								if(cu->path==NULL || cu->path->data==NULL) makeDispListCurveTypes(scene, parent, 0);
-								if(cu->path) {
+								if (cu->path==NULL || cu->path->data==NULL) makeDispListCurveTypes(scene, parent, 0);
+								if (cu->path) {
 									
 									/* Find the position on the path */
 									ctime= bsystem_time(scene, ob, scene_cfra, 0.0);
 									
-									if(calc_ipo_spec(cu->ipo, CU_SPEED, &ctime)==0) {
+									if (calc_ipo_spec(cu->ipo, CU_SPEED, &ctime)==0) {
 										/* correct for actions not starting on zero */
 										ctime= (ctime - strip->actstart)/cu->pathlen;
 										CLAMP(ctime, 0.0, 1.0);
 									}
 									pdist = ctime*cu->path->totdist;
 									
-									if(tpose && strip->stridechannel[0]) {
+									if (tpose && strip->stridechannel[0]) {
 										striptime= stridechannel_frame(parent, ob->size[0], strip, cu->path, pdist, tpose->stride_offset);
 									}									
 									else {
@@ -1546,12 +1547,12 @@ static void do_nla(Scene *scene, Object *ob, int blocktype)
 									frametime = (striptime * actlength) + strip->actstart;
 									frametime= bsystem_time(scene, ob, frametime, 0.0);
 									
-									if(blocktype==ID_AR) {
+									if (blocktype==ID_AR) {
 										extract_pose_from_action (tpose, strip->act, frametime);
 									}
-									else if(blocktype==ID_OB) {
+									else if (blocktype==ID_OB) {
 										extract_ipochannels_from_action(&tchanbase, &ob->id, strip->act, "Object", frametime);
-										if(key)
+										if (key)
 											extract_ipochannels_from_action(&tchanbase, &key->id, strip->act, "Shape", frametime);
 									}
 									doit=dostride= 1;
@@ -1560,28 +1561,28 @@ static void do_nla(Scene *scene, Object *ob, int blocktype)
 						}
 					}
 					/* To handle repeat, we add 0.1 frame extra to make sure the last frame is included */
-					else  {
+					else {
 						
 						/* Mod to repeat */
-						if(strip->repeat!=1.0f) {
+						if (strip->repeat!=1.0f) {
 							float cycle= striptime*strip->repeat;
 							
 							striptime = (float)fmod (cycle, 1.0f + 0.1f/length);
 							cycle-= striptime;
 							
-							if(blocktype==ID_AR)
+							if (blocktype==ID_AR)
 								cyclic_offs_bone(ob, tpose, strip, cycle);
 						}
 
 						frametime = (striptime * actlength) + strip->actstart;
 						frametime= nla_time(scene, frametime, (float)strip->repeat);
 							
-						if(blocktype==ID_AR) {
+						if (blocktype==ID_AR) {
 							extract_pose_from_action (tpose, strip->act, frametime);
 						}
-						else if(blocktype==ID_OB) {
+						else if (blocktype==ID_OB) {
 							extract_ipochannels_from_action(&tchanbase, &ob->id, strip->act, "Object", frametime);
-							if(key)
+							if (key)
 								extract_ipochannels_from_action(&tchanbase, &key->id, strip->act, "Shape", frametime);
 						}
 						
@@ -1590,24 +1591,24 @@ static void do_nla(Scene *scene, Object *ob, int blocktype)
 				}
 				/* Handle extend */
 				else {
-					if (strip->flag & ACTSTRIP_HOLDLASTFRAME){
+					if (strip->flag & ACTSTRIP_HOLDLASTFRAME) {
 						/* we want the strip to hold on the exact fraction of the repeat value */
 						
 						frametime = actlength * (strip->repeat-(int)strip->repeat);
-						if(frametime<=0.000001f) frametime= actlength;	/* rounding errors... */
+						if (frametime<=0.000001f) frametime= actlength;	/* rounding errors... */
 						frametime= bsystem_time(scene, ob, frametime+strip->actstart, 0.0);
 						
-						if(blocktype==ID_AR)
+						if (blocktype==ID_AR)
 							extract_pose_from_action (tpose, strip->act, frametime);
-						else if(blocktype==ID_OB) {
+						else if (blocktype==ID_OB) {
 							extract_ipochannels_from_action(&tchanbase, &ob->id, strip->act, "Object", frametime);
-							if(key)
+							if (key)
 								extract_ipochannels_from_action(&tchanbase, &key->id, strip->act, "Shape", frametime);
 						}
 						
 						/* handle cycle hold */
-						if(strip->repeat!=1.0f) {
-							if(blocktype==ID_AR)
+						if (strip->repeat!=1.0f) {
+							if (blocktype==ID_AR)
 								cyclic_offs_bone(ob, tpose, strip, strip->repeat-1.0f);
 						}
 						
@@ -1616,24 +1617,24 @@ static void do_nla(Scene *scene, Object *ob, int blocktype)
 				}
 				
 				/* Handle blendin & blendout */
-				if (doit){
+				if (doit) {
 					/* Handle blendin */
 					
-					if (strip->blendin>0.0 && stripframe<=strip->blendin && scene_cfra>=strip->start){
+					if (strip->blendin>0.0 && stripframe<=strip->blendin && scene_cfra>=strip->start) {
 						blendfac = stripframe/strip->blendin;
 					}
-					else if (strip->blendout>0.0 && stripframe>=(length-strip->blendout) && scene_cfra<=strip->end){
+					else if (strip->blendout>0.0 && stripframe>=(length-strip->blendout) && scene_cfra<=strip->end) {
 						blendfac = (length-stripframe)/(strip->blendout);
 					}
 					else
 						blendfac = 1;
 					
-					if(blocktype==ID_AR) {/* Blend this pose with the accumulated pose */
+					if (blocktype==ID_AR) {/* Blend this pose with the accumulated pose */
 						/* offset bone, for matching cycles */
 						blend_pose_offset_bone (strip, ob->pose, tpose, blendfac, strip->mode);
 						
 						blend_poses (ob->pose, tpose, blendfac, strip->mode);
-						if(dostride)
+						if (dostride)
 							blend_pose_strides (ob->pose, tpose, blendfac, strip->mode);
 					}
 					else {
@@ -1645,10 +1646,10 @@ static void do_nla(Scene *scene, Object *ob, int blocktype)
 		}
 	}
 	
-	if(blocktype==ID_OB) {
+	if (blocktype==ID_OB) {
 		execute_ipochannels(&chanbase);
 	}
-	else if(blocktype==ID_AR) {
+	else if (blocktype==ID_AR) {
 		/* apply stride offset to object */
 		add_v3_v3(ob->obmat[3], ob->pose->stride_offset);
 	}
@@ -1656,7 +1657,7 @@ static void do_nla(Scene *scene, Object *ob, int blocktype)
 	/* free */
 	if (tpose)
 		free_pose(tpose);
-	if(chanbase.first)
+	if (chanbase.first)
 		BLI_freelistN(&chanbase);
 }
 
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index fabc353..1ec9f7d 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -29,7 +29,6 @@
  *  \ingroup bke
  */
 
-
 #include <stdio.h>
 #include <math.h>
 #include <string.h>
@@ -37,7 +36,6 @@
 #include "MEM_guardedalloc.h"
 
 #include "BLI_blenlib.h"
-#include "BLI_editVert.h"
 #include "BLI_math.h"
 #include "BLI_rand.h"
 #include "BLI_utildefines.h"
@@ -46,6 +44,7 @@
 #include "DNA_armature_types.h"
 #include "DNA_group_types.h"
 #include "DNA_key_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_vfont_types.h"
@@ -65,6 +64,7 @@
 #include "BKE_particle.h"
 #include "BKE_scene.h"
 #include "BKE_utildefines.h"
+#include "BKE_tessmesh.h"
 #include "BKE_depsgraph.h"
 #include "BKE_anim.h"
 #include "BKE_report.h"
@@ -80,7 +80,7 @@ static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBas
 /* ******************************************************************** */
 /* Animation Visualisation */
 
-/* Initialise the default settings for animation visualisation */
+/* Initialize the default settings for animation visualisation */
 void animviz_settings_init(bAnimVizSettings *avs)
 {
 	/* sanity check */
@@ -233,7 +233,7 @@ typedef struct MPathTarget {
 /* get list of motion paths to be baked for the given object
  * 	- assumes the given list is ready to be used
  */
-// TODO: it would be nice in future to be able to update objects dependant on these bones too?
+// TODO: it would be nice in future to be able to update objects dependent on these bones too?
 void animviz_get_object_motionpaths(Object *ob, ListBase *targets)
 {
 	MPathTarget *mpt;
@@ -317,7 +317,7 @@ static void motionpaths_calc_update_scene(Scene *scene)
 	/* find the last object with the tag 
 	 *	- all those afterwards are assumed to not be relevant for our calculations
 	 */
-	// optimise further by moving out...
+	// optimize further by moving out...
 	for (base=scene->base.first; base; base=base->next) {
 		if (base->object->flag & BA_TEMP_TAG)
 			last = base;
@@ -415,7 +415,7 @@ void animviz_calc_motionpaths(Scene *scene, ListBase *targets)
 	}
 	if (efra <= sfra) return;
 	
-	/* optimise the depsgraph for faster updates */
+	/* optimize the depsgraph for faster updates */
 	// TODO: whether this is used should depend on some setting for the level of optimisations used
 	motionpaths_calc_optimise_depsgraph(scene, targets);
 	
@@ -452,11 +452,11 @@ void animviz_calc_motionpaths(Scene *scene, ListBase *targets)
 
 /* free curve path data 
  * NOTE: frees the path itself!
- * NOTE: this is increasingly innacurate with non-uniform BevPoint subdivisions [#24633]
+ * NOTE: this is increasingly inaccurate with non-uniform BevPoint subdivisions [#24633]
  */
 void free_path(Path *path)
 {
-	if(path->data) MEM_freeN(path->data);
+	if (path->data) MEM_freeN(path->data);
 	MEM_freeN(path);
 }
 
@@ -479,29 +479,29 @@ void calc_curvepath(Object *ob)
 	/* in a path vertices are with equal differences: path->len = number of verts */
 	/* NOW WITH BEVELCURVE!!! */
 	
-	if(ob==NULL || ob->type != OB_CURVE) return;
+	if (ob==NULL || ob->type != OB_CURVE) return;
 	cu= ob->data;
 
 	nurbs= BKE_curve_nurbs(cu);
 	nu= nurbs->first;
 
-	if(cu->path) free_path(cu->path);
+	if (cu->path) free_path(cu->path);
 	cu->path= NULL;
 	
 	bl= cu->bev.first;
-	if(bl==NULL || !bl->nr) return;
+	if (bl==NULL || !bl->nr) return;
 
 	cu->path=path= MEM_callocN(sizeof(Path), "calc_curvepath");
 	
 	/* if POLY: last vertice != first vertice */
 	cycl= (bl->poly!= -1);
 	
-	if(cycl) tot= bl->nr;
+	if (cycl) tot= bl->nr;
 	else tot= bl->nr-1;
 	
 	path->len= tot+1;
 	/* exception: vector handle paths and polygon paths should be subdivided at least a factor resolu */
-	if(path->len<nu->resolu*SEGMENTSU(nu)) path->len= nu->resolu*SEGMENTSU(nu);
+	if (path->len<nu->resolu*SEGMENTSU(nu)) path->len= nu->resolu*SEGMENTSU(nu);
 	
 	dist= (float *)MEM_mallocN((tot+1)*4, "calcpathdist");
 
@@ -509,9 +509,9 @@ void calc_curvepath(Object *ob)
 	bevp= bevpfirst= (BevPoint *)(bl+1);
 	fp= dist;
 	*fp= 0;
-	for(a=0; a<tot; a++) {
+	for (a=0; a<tot; a++) {
 		fp++;
-		if(cycl && a==tot-1)
+		if (cycl && a==tot-1)
 			sub_v3_v3v3(xyz, bevpfirst->vec, bevp->vec);
 		else
 			sub_v3_v3v3(xyz, (bevp+1)->vec, bevp->vec);
@@ -534,17 +534,17 @@ void calc_curvepath(Object *ob)
 	fac= 1.0f/((float)path->len-1.0f);
 		fac = fac * path->totdist;
 	
-	for(a=0; a<path->len; a++) {
+	for (a=0; a<path->len; a++) {
 		
 		d= ((float)a)*fac;
 		
 		/* we're looking for location (distance) 'd' in the array */
-		while((d>= *fp) && fp<maxdist) {
+		while ((d>= *fp) && fp<maxdist) {
 			fp++;
-			if(bevp<bevplast) bevp++;
+			if (bevp<bevplast) bevp++;
 			bevpn= bevp+1;
-			if(bevpn>bevplast) {
-				if(cycl) bevpn= bevpfirst;
+			if (bevpn>bevplast) {
+				if (cycl) bevpn= bevpfirst;
 				else bevpn= bevplast;
 			}
 		}
@@ -571,15 +571,15 @@ void calc_curvepath(Object *ob)
 /* is this only used internally?*/
 int interval_test(int min, int max, int p1, int cycl)
 {
-	if(cycl) {
-		if(p1 < min) 
+	if (cycl) {
+		if (p1 < min) 
 			p1=  ((p1 -min) % (max-min+1)) + max+1;
-		else if(p1 > max)
+		else if (p1 > max)
 			p1=  ((p1 -min) % (max-min+1)) + min;
 	}
 	else {
-		if(p1 < min) p1= min;
-		else if(p1 > max) p1= max;
+		if (p1 < min) p1= min;
+		else if (p1 > max) p1= max;
 	}
 	return p1;
 }
@@ -603,9 +603,9 @@ int where_on_path(Object *ob, float ctime, float vec[4], float dir[3], float qua
 	float data[4];
 	int cycl=0, s0, s1, s2, s3;
 
-	if(ob==NULL || ob->type != OB_CURVE) return 0;
+	if (ob==NULL || ob->type != OB_CURVE) return 0;
 	cu= ob->data;
-	if(cu->path==NULL || cu->path->data==NULL) {
+	if (cu->path==NULL || cu->path->data==NULL) {
 		printf("no path!\n");
 		return 0;
 	}
@@ -616,7 +616,7 @@ int where_on_path(Object *ob, float ctime, float vec[4], float dir[3], float qua
 	bl= cu->bev.first;
 	if (!bl) return 0;
 	if (!bl->nr) return 0;
-	if(bl->poly> -1) cycl= 1;
+	if (bl->poly> -1) cycl= 1;
 
 	ctime *= (path->len-1);
 	
@@ -635,7 +635,7 @@ int where_on_path(Object *ob, float ctime, float vec[4], float dir[3], float qua
 	p3= pp + s3;
 
 	/* note, commented out for follow constraint */
-	//if(cu->flag & CU_FOLLOW) {
+	//if (cu->flag & CU_FOLLOW) {
 
 		key_curve_tangent_weights(1.0f-fac, data, KEY_BSPLINE);
 
@@ -648,9 +648,9 @@ int where_on_path(Object *ob, float ctime, float vec[4], float dir[3], float qua
 	nu= cu->nurb.first;
 
 	/* make sure that first and last frame are included in the vectors here  */
-	if(nu->type == CU_POLY) key_curve_position_weights(1.0f-fac, data, KEY_LINEAR);
-	else if(nu->type == CU_BEZIER) key_curve_position_weights(1.0f-fac, data, KEY_LINEAR);
-	else if(s0==s1 || p2==p3) key_curve_position_weights(1.0f-fac, data, KEY_CARDINAL);
+	if (nu->type == CU_POLY) key_curve_position_weights(1.0f-fac, data, KEY_LINEAR);
+	else if (nu->type == CU_BEZIER) key_curve_position_weights(1.0f-fac, data, KEY_LINEAR);
+	else if (s0==s1 || p2==p3) key_curve_position_weights(1.0f-fac, data, KEY_CARDINAL);
 	else key_curve_position_weights(1.0f-fac, data, KEY_BSPLINE);
 
 	vec[0]= data[0]*p0->vec[0] + data[1]*p1->vec[0] + data[2]*p2->vec[0] + data[3]*p3->vec[0] ; /* X */
@@ -662,22 +662,22 @@ int where_on_path(Object *ob, float ctime, float vec[4], float dir[3], float qua
 		float totfac, q1[4], q2[4];
 
 		totfac= data[0]+data[3];
-		if(totfac>FLT_EPSILON)	interp_qt_qtqt(q1, p0->quat, p3->quat, data[3] / totfac);
+		if (totfac>FLT_EPSILON)	interp_qt_qtqt(q1, p0->quat, p3->quat, data[3] / totfac);
 		else					copy_qt_qt(q1, p1->quat);
 
 		totfac= data[1]+data[2];
-		if(totfac>FLT_EPSILON)	interp_qt_qtqt(q2, p1->quat, p2->quat, data[2] / totfac);
+		if (totfac>FLT_EPSILON)	interp_qt_qtqt(q2, p1->quat, p2->quat, data[2] / totfac);
 		else					copy_qt_qt(q2, p3->quat);
 
 		totfac = data[0]+data[1]+data[2]+data[3];
-		if(totfac>FLT_EPSILON)	interp_qt_qtqt(quat, q1, q2, (data[1]+data[2]) / totfac);
+		if (totfac>FLT_EPSILON)	interp_qt_qtqt(quat, q1, q2, (data[1]+data[2]) / totfac);
 		else					copy_qt_qt(quat, q2);
 	}
 
-	if(radius)
+	if (radius)
 		*radius= data[0]*p0->radius + data[1]*p1->radius + data[2]*p2->radius + data[3]*p3->radius;
 
-	if(weight)
+	if (weight)
 		*weight= data[0]*p0->weight + data[1]*p1->weight + data[2]*p2->weight + data[3]*p3->weight;
 
 	return 1;
@@ -710,23 +710,23 @@ static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, i
 	GroupObject *go;
 	float mat[4][4], tmat[4][4];
 	
-	if(ob->dup_group==NULL) return;
+	if (ob->dup_group==NULL) return;
 	group= ob->dup_group;
 	
 	/* simple preventing of too deep nested groups */
-	if(level>MAX_DUPLI_RECUR) return;
+	if (level>MAX_DUPLI_RECUR) return;
 	
 	/* handles animated groups, and */
 	/* we need to check update for objects that are not in scene... */
 	group_handle_recalc_and_update(scene, ob, group);
 	animated= animated || group_is_animated(ob, group);
 	
-	for(go= group->gobject.first; go; go= go->next) {
+	for (go= group->gobject.first; go; go= go->next) {
 		/* note, if you check on layer here, render goes wrong... it still deforms verts and uses parent imat */
-		if(go->ob!=ob) {
+		if (go->ob!=ob) {
 			
 			/* group dupli offset, should apply after everything else */
-			if(!is_zero_v3(group->dupli_ofs)) {
+			if (!is_zero_v3(group->dupli_ofs)) {
 				copy_m4_m4(tmat, go->ob->obmat);
 				sub_v3_v3v3(tmat[3], tmat[3], group->dupli_ofs);
 				mult_m4_m4m4(mat, ob->obmat, tmat);
@@ -738,7 +738,7 @@ static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, i
 			dob= new_dupli_object(lb, go->ob, mat, ob->lay, 0, OB_DUPLIGROUP, animated);
 
 			/* check the group instance and object layers match, also that the object visible flags are ok. */
-			if(	(dob->origlay & group->layer)==0 ||
+			if (	(dob->origlay & group->layer)==0 ||
 				(G.rendering==0 && dob->ob->restrictflag & OB_RESTRICT_VIEW) ||
 				(G.rendering && dob->ob->restrictflag & OB_RESTRICT_RENDER)
 			) {
@@ -748,7 +748,7 @@ static void group_duplilist(ListBase *lb, Scene *scene, Object *ob, int level, i
 				dob->no_draw= 0;
 			}
 
-			if(go->ob->transflag & OB_DUPLI) {
+			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, level+1, animated);
 				copy_m4_m4(dob->ob->obmat, dob->omat);
@@ -840,7 +840,8 @@ typedef struct vertexDupliData {
 
 /* ------------- */
 
-static void vertex_dupli__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
+static void vertex_dupli__mapFunc(void *userData, int index, const float co[3],
+                                  const float no_f[3], const short no_s[3])
 {
 	DupliObject *dob;
 	vertexDupliData *vdd= userData;
@@ -854,11 +855,11 @@ static void vertex_dupli__mapFunc(void *userData, int index, float *co, float *n
 	copy_m4_m4(obmat, vdd->obmat);
 	copy_v3_v3(obmat[3], vec);
 	
-	if(vdd->par->transflag & OB_DUPLIROT) {
-		if(no_f) {
+	if (vdd->par->transflag & OB_DUPLIROT) {
+		if (no_f) {
 			vec[0]= -no_f[0]; vec[1]= -no_f[1]; vec[2]= -no_f[2];
 		}
-		else if(no_s) {
+		else if (no_s) {
 			vec[0]= -no_s[0]; vec[1]= -no_s[1]; vec[2]= -no_s[2];
 		}
 		
@@ -876,10 +877,10 @@ static void vertex_dupli__mapFunc(void *userData, int index, float *co, float *n
 	/* restore the original layer so that each dupli will have proper dob->origlay */
 	vdd->ob->lay = origlay;
 
-	if(vdd->orco)
+	if (vdd->orco)
 		copy_v3_v3(dob->orco, vdd->orco[index]);
 	
-	if(vdd->ob->transflag & OB_DUPLI) {
+	if (vdd->ob->transflag & OB_DUPLI) {
 		float tmpmat[4][4];
 		copy_m4_m4(tmpmat, vdd->ob->obmat);
 		copy_m4_m4(vdd->ob->obmat, obmat); /* pretend we are really this mat */
@@ -898,7 +899,7 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
 	Scene *sce = NULL;
 	Group *group = NULL;
 	GroupObject * go = NULL;
-	EditMesh *em;
+	BMEditMesh *em;
 	float vec[3], no[3], pmat[4][4];
 	int totvert, a, oblay;
 	unsigned int lay;
@@ -906,17 +907,17 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
 	copy_m4_m4(pmat, par->obmat);
 	
 	/* simple preventing of too deep nested groups */
-	if(level>MAX_DUPLI_RECUR) return;
+	if (level>MAX_DUPLI_RECUR) return;
 	
-	em = BKE_mesh_get_editmesh(me);
+	em = me->edit_btmesh;
 	
-	if(em) {
-		dm= editmesh_get_derived_cage(scene, par, em, CD_MASK_BAREMESH);
-		BKE_mesh_end_editmesh(me, em);
-	} else
+	if (em) {
+		dm= editbmesh_get_derived_cage(scene, par, em, CD_MASK_BAREMESH);
+	}
+	else
 		dm= mesh_get_derived_deform(scene, par, CD_MASK_BAREMESH);
 	
-	if(G.rendering) {
+	if (G.rendering) {
 		vdd.orco= (float(*)[3])get_mesh_orco_verts(par);
 		transform_mesh_orco_verts(me, vdd.orco, me->totvert, 0);
 	}
@@ -930,7 +931,8 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
 		sce = (Scene *)id;
 		lay= sce->lay;
 		base= sce->base.first;
-	} else {
+	}
+	else {
 		group = (Group *)id;
 		lay= group->layer;
 		go = group->gobject.first;
@@ -941,23 +943,24 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
 		if (sce) {
 			ob_iter= base->object;
 			oblay = base->lay;
-		} else {
+		}
+		else {
 			ob_iter= go->ob;
 			oblay = ob_iter->lay;
 		}
 		
 		if (lay & oblay && scene->obedit!=ob_iter) {
 			ob=ob_iter->parent;
-			while(ob) {
-				if(ob==par) {
+			while (ob) {
+				if (ob==par) {
 					ob = ob_iter;
 	/* End Scene/Group object loop, below is generic */
 					
 					
 					/* par_space_mat - only used for groups so we can modify the space dupli's are in
-					   when par_space_mat is NULL ob->obmat can be used instead of ob__obmat
-					*/
-					if(par_space_mat)
+					 * when par_space_mat is NULL ob->obmat can be used instead of ob__obmat
+					 */
+					if (par_space_mat)
 						mult_m4_m4m4(vdd.obmat, par_space_mat, ob->obmat);
 					else
 						copy_m4_m4(vdd.obmat, ob->obmat);
@@ -972,20 +975,20 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
 					copy_m4_m4(vdd.pmat, pmat);
 					
 					/* mballs have a different dupli handling */
-					if(ob->type!=OB_MBALL) ob->flag |= OB_DONE;	/* doesnt render */
+					if (ob->type!=OB_MBALL) ob->flag |= OB_DONE;	/* doesnt render */
 
-					if(me->edit_mesh) {
+					if (me->edit_btmesh) {
 						dm->foreachMappedVert(dm, vertex_dupli__mapFunc, (void*) &vdd);
 					}
 					else {
-						for(a=0; a<totvert; a++) {
+						for (a=0; a<totvert; a++) {
 							dm->getVertCo(dm, a, vec);
 							dm->getVertNo(dm, a, no);
 							
 							vertex_dupli__mapFunc(&vdd, a, vec, no, NULL);
 						}
 					}
-					if(sce) {
+					if (sce) {
 						/* Set proper layer in case of scene looping,
 						 * in case of groups the object layer will be
 						 * changed when it's duplicated due to the
@@ -1003,7 +1006,7 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl
 		else		go= go->next;		/* group loop */
 	}
 
-	if(vdd.orco)
+	if (vdd.orco)
 		MEM_freeN(vdd.orco);
 	dm->release(dm);
 }
@@ -1015,44 +1018,45 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
 	DupliObject *dob;
 	DerivedMesh *dm;
 	Mesh *me= par->data;
-	MTFace *mtface;
-	MFace *mface;
+	MLoopUV *mloopuv;
+	MPoly *mpoly, *mp;
+	MLoop *mloop;
 	MVert *mvert;
 	float pmat[4][4], imat[3][3], (*orco)[3] = NULL, w;
 	int lay, oblay, totface, a;
 	Scene *sce = NULL;
 	Group *group = NULL;
 	GroupObject *go = NULL;
-	EditMesh *em;
+	BMEditMesh *em;
 	float ob__obmat[4][4]; /* needed for groups where the object matrix needs to be modified */
 	
 	/* simple preventing of too deep nested groups */
-	if(level>MAX_DUPLI_RECUR) return;
+	if (level>MAX_DUPLI_RECUR) return;
 	
 	copy_m4_m4(pmat, par->obmat);
-	
-	em = BKE_mesh_get_editmesh(me);
-	if(em) {
-		dm= editmesh_get_derived_cage(scene, par, em, CD_MASK_BAREMESH);
-		BKE_mesh_end_editmesh(me, em);
+	em = me->edit_btmesh;
+
+	if (em) {
+		dm= editbmesh_get_derived_cage(scene, par, em, CD_MASK_BAREMESH);
 	}
 	else {
 		dm = mesh_get_derived_deform(scene, par, CD_MASK_BAREMESH);
 	}
 
-	totface= dm->getNumFaces(dm);
-	mface= dm->getFaceArray(dm);
+	totface= dm->getNumPolys(dm);
+	mpoly= dm->getPolyArray(dm);
+	mloop= dm->getLoopArray(dm);
 	mvert= dm->getVertArray(dm);
 
-	if(G.rendering) {
+	if (G.rendering) {
 
 		orco= (float(*)[3])get_mesh_orco_verts(par);
 		transform_mesh_orco_verts(me, orco, me->totvert, 0);
-		mtface= me->mtface;
+		mloopuv= me->mloopuv;
 	}
 	else {
 		orco= NULL;
-		mtface= NULL;
+		mloopuv= NULL;
 	}
 	
 	/* having to loop on scene OR group objects is NOT FUN */
@@ -1060,7 +1064,8 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
 		sce = (Scene *)id;
 		lay= sce->lay;
 		base= sce->base.first;
-	} else {
+	}
+	else {
 		group = (Group *)id;
 		lay= group->layer;
 		go = group->gobject.first;
@@ -1071,22 +1076,23 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
 		if (sce) {
 			ob_iter= base->object;
 			oblay = base->lay;
-		} else {
+		}
+		else {
 			ob_iter= go->ob;
 			oblay = ob_iter->lay;
 		}
 		
 		if (lay & oblay && scene->obedit!=ob_iter) {
 			ob=ob_iter->parent;
-			while(ob) {
-				if(ob==par) {
+			while (ob) {
+				if (ob==par) {
 					ob = ob_iter;
 	/* End Scene/Group object loop, below is generic */
 					
 					/* par_space_mat - only used for groups so we can modify the space dupli's are in
-					   when par_space_mat is NULL ob->obmat can be used instead of ob__obmat
-					*/
-					if(par_space_mat)
+					 * when par_space_mat is NULL ob->obmat can be used instead of ob__obmat
+					 */
+					if (par_space_mat)
 						mult_m4_m4m4(ob__obmat, par_space_mat, ob->obmat);
 					else
 						copy_m4_m4(ob__obmat, ob->obmat);
@@ -1094,24 +1100,38 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
 					copy_m3_m4(imat, ob->parentinv);
 						
 					/* mballs have a different dupli handling */
-					if(ob->type!=OB_MBALL) ob->flag |= OB_DONE;	/* doesnt render */
-
-					for(a=0; a<totface; a++) {
-						int mv1 = mface[a].v1;
-						int mv2 = mface[a].v2;
-						int mv3 = mface[a].v3;
-						int mv4 = mface[a].v4;
-						float *v1= mvert[mv1].co;
-						float *v2= mvert[mv2].co;
-						float *v3= mvert[mv3].co;
-						float *v4= (mv4)? mvert[mv4].co: NULL;
+					if (ob->type!=OB_MBALL) ob->flag |= OB_DONE;	/* doesnt render */
+
+					for (a=0, mp= mpoly; a<totface; a++, mp++) {
+						int mv1;
+						int mv2;
+						int mv3;
+						/* int mv4; */ /* UNUSED */
+						float *v1;
+						float *v2;
+						float *v3;
+						/* float *v4; */ /* UNUSED */
 						float cent[3], quat[4], mat[3][3], mat3[3][3], tmat[4][4], obmat[4][4];
+						MLoop *loopstart= mloop + mp->loopstart;
+
+						if (mp->totloop < 3) {
+							/* highly unlikely but to be safe */
+							continue;
+						}
+						else {
+							v1= mvert[(mv1= loopstart[0].v)].co;
+							v2= mvert[(mv2= loopstart[1].v)].co;
+							v3= mvert[(mv3= loopstart[2].v)].co;
+#if 0
+							if (mp->totloop > 3) {
+								v4= mvert[(mv4= loopstart[3].v)].co;
+							}
+#endif
+						}
 
 						/* translation */
-						if(v4)
-							cent_quad_v3(cent, v1, v2, v3, v4);
-						else
-							cent_tri_v3(cent, v1, v2, v3);
+						mesh_calc_poly_center(mp, loopstart, mvert, cent);
+
 						mul_m4_v3(pmat, cent);
 						
 						sub_v3_v3v3(cent, cent, pmat[3]);
@@ -1126,8 +1146,8 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
 						quat_to_mat3( mat,quat);
 						
 						/* scale */
-						if(par->transflag & OB_DUPLIFACES_SCALE) {
-							float size= v4? area_quad_v3(v1, v2, v3, v4): area_tri_v3(v1, v2, v3);
+						if (par->transflag & OB_DUPLIFACES_SCALE) {
+							float size= mesh_calc_poly_area(mp, loopstart, mvert, NULL);
 							size= sqrtf(size) * par->dupfacesca;
 							mul_m3_fl(mat, size);
 						}
@@ -1139,29 +1159,25 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
 						mul_m4_m4m3(obmat, tmat, mat);
 						
 						dob= new_dupli_object(lb, ob, obmat, par->lay, a, OB_DUPLIFACES, animated);
-						if(G.rendering) {
-							w= (mv4)? 0.25f: 1.0f/3.0f;
-
-							if(orco) {
-								madd_v3_v3v3fl(dob->orco, dob->orco, orco[mv1], w);
-								madd_v3_v3v3fl(dob->orco, dob->orco, orco[mv2], w);
-								madd_v3_v3v3fl(dob->orco, dob->orco, orco[mv3], w);
-								if (mv4) {
-									madd_v3_v3v3fl(dob->orco, dob->orco, orco[mv4], w);
+						if (G.rendering) {
+							w= 1.0f / (float)mp->totloop;
+
+							if (orco) {
+								int j;
+								for (j = 0; j < mpoly->totloop; j++) {
+									madd_v3_v3fl(dob->orco, orco[loopstart[j].v], w);
 								}
 							}
 
-							if(mtface) {
-								madd_v2_v2v2fl(dob->uv, dob->uv, mtface[a].uv[0], w);
-								madd_v2_v2v2fl(dob->uv, dob->uv, mtface[a].uv[1], w);
-								madd_v2_v2v2fl(dob->uv, dob->uv, mtface[a].uv[2], w);
-								if (mv4) {
-									madd_v2_v2v2fl(dob->uv, dob->uv, mtface[a].uv[3], w);
+							if (mloopuv) {
+								int j;
+								for (j = 0; j < mpoly->totloop; j++) {
+									madd_v2_v2fl(dob->orco, mloopuv[loopstart[j].v].uv, w);
 								}
 							}
 						}
 						
-						if(ob->transflag & OB_DUPLI) {
+						if (ob->transflag & OB_DUPLI) {
 							float tmpmat[4][4];
 							copy_m4_m4(tmpmat, ob->obmat);
 							copy_m4_m4(ob->obmat, obmat); /* pretend we are really this mat */
@@ -1179,7 +1195,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
 		else		go= go->next;		/* group loop */
 	}
 
-	if(orco)
+	if (orco)
 		MEM_freeN(orco);
 	
 	dm->release(dm);
@@ -1204,20 +1220,20 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
 
 	int no_draw_flag = PARS_UNEXIST;
 
-	if(psys==NULL) return;
+	if (psys==NULL) return;
 	
 	/* simple preventing of too deep nested groups */
-	if(level>MAX_DUPLI_RECUR) return;
+	if (level>MAX_DUPLI_RECUR) return;
 	
 	part=psys->part;
 
-	if(part==NULL)
+	if (part==NULL)
 		return;
 
-	if(!psys_check_enabled(par, psys))
+	if (!psys_check_enabled(par, psys))
 		return;
 
-	if(G.rendering == 0)
+	if (G.rendering == 0)
 		no_draw_flag |= PARS_NO_DISP;
 	
 	ctime = BKE_curframe(scene); /* NOTE: in old animsys, used parent object's timeoffset... */
@@ -1227,7 +1243,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
 
 	BLI_srandom(31415926 + psys->seed);
 
-	if((psys->renderdata || part->draw_as==PART_DRAW_REND) && ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
+	if ((psys->renderdata || part->draw_as==PART_DRAW_REND) && ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
 		ParticleSimulationData sim= {NULL};
 		sim.scene= scene;
 		sim.ob= par;
@@ -1237,24 +1253,24 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
 		invert_m4_m4(par->imat, par->obmat);
 
 		/* first check for loops (particle system object used as dupli object) */
-		if(part->ren_as == PART_DRAW_OB) {
-			if(ELEM(part->dup_ob, NULL, par))
+		if (part->ren_as == PART_DRAW_OB) {
+			if (ELEM(part->dup_ob, NULL, par))
 				return;
 		}
 		else { /*PART_DRAW_GR */
-			if(part->dup_group == NULL || part->dup_group->gobject.first == NULL)
+			if (part->dup_group == NULL || part->dup_group->gobject.first == NULL)
 				return;
 
-			for(go=part->dup_group->gobject.first; go; go=go->next)
-				if(go->ob == par)
+			for (go=part->dup_group->gobject.first; go; go=go->next)
+				if (go->ob == par)
 					return;
 		}
 
 		/* if we have a hair particle system, use the path cache */
-		if(part->type == PART_HAIR) {
-			if(psys->flag & PSYS_HAIR_DONE)
+		if (part->type == PART_HAIR) {
+			if (psys->flag & PSYS_HAIR_DONE)
 				hair= (totchild == 0 || psys->childcache) && psys->pathcache;
-			if(!hair)
+			if (!hair)
 				return;
 			
 			/* we use cache, update totchild according to cached data */
@@ -1267,15 +1283,15 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
 		psys->lattice = psys_get_lattice(&sim);
 
 		/* gather list of objects or single object */
-		if(part->ren_as==PART_DRAW_GR) {
+		if (part->ren_as==PART_DRAW_GR) {
 			group_handle_recalc_and_update(scene, par, part->dup_group);
 
-			if(part->draw & PART_DRAW_COUNT_GR) {
-				for(dw=part->dupliweights.first; dw; dw=dw->next)
+			if (part->draw & PART_DRAW_COUNT_GR) {
+				for (dw=part->dupliweights.first; dw; dw=dw->next)
 					totgroup += dw->count;
 			}
 			else {
-				for(go=part->dup_group->gobject.first; go; go=go->next)
+				for (go=part->dup_group->gobject.first; go; go=go->next)
 					totgroup++;
 			}
 
@@ -1285,11 +1301,11 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
 			obcopylist = MEM_callocN(totgroup*sizeof(Object), "dupgroup copy list");
 
 			
-			if(part->draw & PART_DRAW_COUNT_GR && totgroup) {
+			if (part->draw & PART_DRAW_COUNT_GR && totgroup) {
 				dw = part->dupliweights.first;
 
-				for(a=0; a<totgroup; dw=dw->next) {
-					for(b=0; b<dw->count; b++, a++) {
+				for (a=0; a<totgroup; dw=dw->next) {
+					for (b=0; b<dw->count; b++, a++) {
 						oblist[a] = dw->ob;
 						obcopylist[a] = *dw->ob;
 					}
@@ -1297,7 +1313,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
 			}
 			else {
 				go = part->dup_group->gobject.first;
-				for(a=0; a<totgroup; a++, go=go->next) {
+				for (a=0; a<totgroup; a++, go=go->next) {
 					oblist[a] = go->ob;
 					obcopylist[a] = *go->ob;
 				}
@@ -1308,15 +1324,15 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
 			obcopy = *ob;
 		}
 
-		if(totchild==0 || part->draw & PART_DRAW_PARENT)
+		if (totchild==0 || part->draw & PART_DRAW_PARENT)
 			a = 0;
 		else
 			a = totpart;
 
-		for(pa=psys->particles,counter=0; a<totpart+totchild; a++,pa++,counter++) {
-			if(a<totpart) {
+		for (pa=psys->particles,counter=0; a<totpart+totchild; a++,pa++,counter++) {
+			if (a<totpart) {
 				/* handle parent particle */
-				if(pa->flag & no_draw_flag)
+				if (pa->flag & no_draw_flag)
 					continue;
 
 				/* pa_num = pa->num; */ /* UNUSED */
@@ -1333,18 +1349,18 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
 			}
 
 			/* some hair paths might be non-existent so they can't be used for duplication */
-			if(hair &&
+			if (hair &&
 				((a < totpart && psys->pathcache[a]->steps < 0) ||
 				(a >= totpart && psys->childcache[a-totpart]->steps < 0)))
 				continue;
 
-			if(part->ren_as==PART_DRAW_GR) {
+			if (part->ren_as==PART_DRAW_GR) {
 				/* prevent divide by zero below [#28336] */
-				if(totgroup == 0)
+				if (totgroup == 0)
 					continue;
 
 				/* for groups, pick the object based on settings */
-				if(part->draw&PART_DRAW_RAND_GR)
+				if (part->draw&PART_DRAW_RAND_GR)
 					b= BLI_rand() % totgroup;
 				else
 					b= a % totgroup;
@@ -1358,9 +1374,9 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
 				oldobmat= obcopy.obmat;
 			}
 
-			if(hair) {
+			if (hair) {
 				/* hair we handle separate and compute transform based on hair keys */
-				if(a < totpart) {
+				if (a < totpart) {
 					cache = psys->pathcache[a];
 					psys_get_dupli_path_transform(&sim, pa, NULL, cache, pamat, &scale);
 				}
@@ -1376,7 +1392,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
 			else {
 				/* first key */
 				state.time = ctime;
-				if(psys_get_particle_state(&sim, a, &state, 0) == 0) {
+				if (psys_get_particle_state(&sim, a, &state, 0) == 0) {
 					continue;
 				}
 				else {
@@ -1388,28 +1404,27 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
 				}
 			}
 
-			if(part->ren_as==PART_DRAW_GR && psys->part->draw & PART_DRAW_WHOLE_GR) {
-				for(go= part->dup_group->gobject.first, b=0; go; go= go->next, b++) {
+			if (part->ren_as==PART_DRAW_GR && psys->part->draw & PART_DRAW_WHOLE_GR) {
+				for (go= part->dup_group->gobject.first, b=0; go; go= go->next, b++) {
 
+					copy_m4_m4(tmat, oblist[b]->obmat);
+					/* apply particle scale */
+					mul_mat3_m4_fl(tmat, size*scale);
+					mul_v3_fl(tmat[3], size*scale);
 					/* group dupli offset, should apply after everything else */
-					if(!is_zero_v3(part->dup_group->dupli_ofs)) {
-						copy_m4_m4(tmat, oblist[b]->obmat);
+					if (!is_zero_v3(part->dup_group->dupli_ofs))
 						sub_v3_v3v3(tmat[3], tmat[3], part->dup_group->dupli_ofs);
-						mult_m4_m4m4(tmat, pamat, tmat);
-					}
-					else {
-						mult_m4_m4m4(tmat, pamat, oblist[b]->obmat);
-					}
+					/* individual particle transform */
+					mult_m4_m4m4(tmat, pamat, tmat);
 
-					mul_mat3_m4_fl(tmat, size*scale);
-					if(par_space_mat)
+					if (par_space_mat)
 						mult_m4_m4m4(mat, par_space_mat, tmat);
 					else
 						copy_m4_m4(mat, tmat);
 
 					dob= new_dupli_object(lb, go->ob, mat, par->lay, counter, OB_DUPLIPARTS, animated);
 					copy_m4_m4(dob->omat, obcopylist[b].obmat);
-					if(G.rendering)
+					if (G.rendering)
 						psys_get_dupli_texture(psys, part, sim.psmd, pa, cpa, dob->uv, dob->orco);
 				}
 			}
@@ -1421,7 +1436,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
 				obmat[3][0] = obmat[3][1] = obmat[3][2] = 0.0f;
 
 				/* particle rotation uses x-axis as the aligned axis, so pre-rotate the object accordingly */
-				if((part->draw & PART_DRAW_ROTATE_OB) == 0) {
+				if ((part->draw & PART_DRAW_ROTATE_OB) == 0) {
 					float xvec[3], q[4];
 					xvec[0] = -1.f;
 					xvec[1] = xvec[2] = 0;
@@ -1433,7 +1448,7 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
 				/* Normal particles and cached hair live in global space so we need to
 				 * remove the real emitter's transformation before 2nd order duplication.
 				 */
-				if(par_space_mat && GS(id->name) != ID_GR)
+				if (par_space_mat && GS(id->name) != ID_GR)
 					mult_m4_m4m4(mat, psys->imat, pamat);
 				else
 					copy_m4_m4(mat, pamat);
@@ -1441,24 +1456,24 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
 				mult_m4_m4m4(tmat, mat, obmat);
 				mul_mat3_m4_fl(tmat, size*scale);
 
-				if(par_space_mat)
+				if (par_space_mat)
 					mult_m4_m4m4(mat, par_space_mat, tmat);
 				else
 					copy_m4_m4(mat, tmat);
 
-				if(part->draw & PART_DRAW_GLOBAL_OB)
+				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, GS(id->name) == ID_GR ? OB_DUPLIGROUP : OB_DUPLIPARTS, animated);
 				copy_m4_m4(dob->omat, oldobmat);
-				if(G.rendering)
+				if (G.rendering)
 					psys_get_dupli_texture(psys, part, sim.psmd, pa, cpa, dob->uv, dob->orco);
 			}
 		}
 
 		/* restore objects since they were changed in where_is_object_time */
-		if(part->ren_as==PART_DRAW_GR) {
-			for(a=0; a<totgroup; a++)
+		if (part->ren_as==PART_DRAW_GR) {
+			for (a=0; a<totgroup; a++)
 				*(oblist[a])= obcopylist[a];
 		}
 		else
@@ -1466,12 +1481,12 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
 	}
 
 	/* clean up */
-	if(oblist)
+	if (oblist)
 		MEM_freeN(oblist);
-	if(obcopylist)
+	if (obcopylist)
 		MEM_freeN(obcopylist);
 
-	if(psys->lattice) {
+	if (psys->lattice) {
 		end_latt_deform(psys->lattice);
 		psys->lattice = NULL;
 	}
@@ -1482,14 +1497,14 @@ static Object *find_family_object(Object **obar, char *family, char ch)
 	Object *ob;
 	int flen;
 	
-	if( obar[(int)ch] ) return obar[(int)ch];
+	if ( obar[(int)ch] ) return obar[(int)ch];
 	
 	flen= strlen(family);
 	
 	ob= G.main->object.first;
-	while(ob) {
-		if( ob->id.name[flen+2]==ch ) {
-			if( strncmp(ob->id.name+2, family, flen)==0 ) break;
+	while (ob) {
+		if ( ob->id.name[flen+2]==ch ) {
+			if ( strncmp(ob->id.name+2, family, flen)==0 ) break;
 		}
 		ob= ob->id.next;
 	}
@@ -1509,14 +1524,14 @@ static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int level, i
 	int slen, a;
 	
 	/* simple preventing of too deep nested groups */
-	if(level>MAX_DUPLI_RECUR) return;
+	if (level>MAX_DUPLI_RECUR) return;
 	
 	copy_m4_m4(pmat, par->obmat);
 	
 	/* in par the family name is stored, use this to find the other objects */
 	
 	chartransdata= BKE_text_to_curve(G.main, scene, par, FO_DUPLI);
-	if(chartransdata==NULL) return;
+	if (chartransdata==NULL) return;
 
 	cu= par->data;
 	slen= strlen(cu->str);
@@ -1526,10 +1541,10 @@ static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int level, i
 	
 	ct= chartransdata;
 	
-	for(a=0; a<slen; a++, ct++) {
+	for (a=0; a<slen; a++, ct++) {
 		
 		ob= find_family_object(obar, cu->family, cu->str[a]);
-		if(ob) {
+		if (ob) {
 			vec[0]= fsize*(ct->xof - xof);
 			vec[1]= fsize*(ct->yof - yof);
 			vec[2]= 0.0;
@@ -1550,7 +1565,7 @@ static void font_duplilist(ListBase *lb, Scene *scene, Object *par, int level, i
 
 static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBase *duplilist, float par_space_mat[][4], int level, int animated)
 {	
-	if((ob->transflag & OB_DUPLI)==0)
+	if ((ob->transflag & OB_DUPLI)==0)
 		return;
 	
 	/* Should the dupli's be generated for this object? - Respect restrict flags */
@@ -1558,43 +1573,45 @@ static void object_duplilist_recursive(ID *id, Scene *scene, Object *ob, ListBas
 		if (ob->restrictflag & OB_RESTRICT_RENDER) {
 			return;
 		}
-	} else {
+	}
+	else {
 		if (ob->restrictflag & OB_RESTRICT_VIEW) {
 			return;
 		}
 	}
 
-	if(ob->transflag & OB_DUPLIPARTS) {
+	if (ob->transflag & OB_DUPLIPARTS) {
 		ParticleSystem *psys = ob->particlesystem.first;
-		for(; psys; psys=psys->next)
+		for (; psys; psys=psys->next)
 			new_particle_duplilist(duplilist, id, scene, ob, par_space_mat, psys, level+1, animated);
 	}
-	else if(ob->transflag & OB_DUPLIVERTS) {
-		if(ob->type==OB_MESH) {
+	else if (ob->transflag & OB_DUPLIVERTS) {
+		if (ob->type==OB_MESH) {
 			vertex_duplilist(duplilist, id, scene, ob, par_space_mat, level+1, animated);
 		}
-		else if(ob->type==OB_FONT) {
+		else if (ob->type==OB_FONT) {
 			if (GS(id->name)==ID_SCE) { /* TODO - support dupligroups */
 				font_duplilist(duplilist, scene, ob, level+1, animated);
 			}
 		}
 	}
-	else if(ob->transflag & OB_DUPLIFACES) {
-		if(ob->type==OB_MESH)
+	else if (ob->transflag & OB_DUPLIFACES) {
+		if (ob->type==OB_MESH)
 			face_duplilist(duplilist, id, scene, ob, par_space_mat, level+1, animated);
 	}
-	else if(ob->transflag & OB_DUPLIFRAMES) {
+	else if (ob->transflag & OB_DUPLIFRAMES) {
 		if (GS(id->name)==ID_SCE) { /* TODO - support dupligroups */
 			frames_duplilist(duplilist, scene, ob, level+1, animated);
 		}
-	} else if(ob->transflag & OB_DUPLIGROUP) {
+	}
+	else if (ob->transflag & OB_DUPLIGROUP) {
 		DupliObject *dob;
 		
 		group_duplilist(duplilist, scene, ob, level+1, animated); /* now recursive */
 
 		if (level==0) {
-			for(dob= duplilist->first; dob; dob= dob->next)
-				if(dob->type == OB_DUPLIGROUP)
+			for (dob= duplilist->first; dob; dob= dob->next)
+				if (dob->type == OB_DUPLIGROUP)
 					copy_m4_m4(dob->ob->obmat, dob->mat);
 		}
 	}
@@ -1615,9 +1632,9 @@ void free_object_duplilist(ListBase *lb)
 	DupliObject *dob;
 	
 	/* loop in reverse order, if object is instanced multiple times
-	   the original layer may not really be original otherwise, proper
-	   solution is more complicated */
-	for(dob= lb->last; dob; dob= dob->prev) {
+	 * the original layer may not really be original otherwise, proper
+	 * solution is more complicated */
+	for (dob= lb->last; dob; dob= dob->prev) {
 		dob->ob->lay= dob->origlay;
 		copy_m4_m4(dob->ob->obmat, dob->omat);
 	}
@@ -1628,17 +1645,17 @@ void free_object_duplilist(ListBase *lb)
 
 int count_duplilist(Object *ob)
 {
-	if(ob->transflag & OB_DUPLI) {
-		if(ob->transflag & OB_DUPLIVERTS) {
-			if(ob->type==OB_MESH) {
-				if(ob->transflag & OB_DUPLIVERTS) {
+	if (ob->transflag & OB_DUPLI) {
+		if (ob->transflag & OB_DUPLIVERTS) {
+			if (ob->type==OB_MESH) {
+				if (ob->transflag & OB_DUPLIVERTS) {
 					ParticleSystem *psys = ob->particlesystem.first;
 					int pdup=0;
 
-					for(; psys; psys=psys->next)
+					for (; psys; psys=psys->next)
 						pdup += psys->totpart;
 
-					if(pdup==0){
+					if (pdup==0) {
 						Mesh *me= ob->data;
 						return me->totvert;
 					}
@@ -1647,7 +1664,7 @@ int count_duplilist(Object *ob)
 				}
 			}
 		}
-		else if(ob->transflag & OB_DUPLIFRAMES) {
+		else if (ob->transflag & OB_DUPLIFRAMES) {
 			int tot= ob->dupend - ob->dupsta; 
 			tot/= (ob->dupon+ob->dupoff);
 			return tot*ob->dupon;
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index b32421a..75b9ae5 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -45,6 +45,7 @@
 #include "DNA_anim_types.h"
 #include "DNA_lamp_types.h"
 #include "DNA_material_types.h"
+#include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_texture_types.h"
 #include "DNA_world_types.h"
@@ -88,6 +89,7 @@ short id_type_can_have_animdata (ID *id)
 		case ID_LA: case ID_CA: case ID_WO:
 		case ID_SPK:
 		case ID_SCE:
+		case ID_MC:
 		{
 			return 1;
 		}
@@ -396,8 +398,8 @@ void action_move_fcurves_by_basepath (bAction *srcAct, bAction *dstAct, const ch
 	FCurve *fcu, *fcn=NULL;
 	
 	/* sanity checks */
-	if ELEM3(NULL, srcAct, dstAct, basepath) {
-		if (G.f & G_DEBUG) {
+	if (ELEM3(NULL, srcAct, dstAct, basepath)) {
+		if (G.debug & G_DEBUG) {
 			printf("ERROR: action_partition_fcurves_by_basepath(%p, %p, %p) has insufficient info to work with\n",
 					(void *)srcAct, (void *)dstAct, (void *)basepath);
 		}
@@ -477,8 +479,8 @@ void BKE_animdata_separate_by_basepath (ID *srcID, ID *dstID, ListBase *basepath
 	LinkData *ld;
 	
 	/* sanity checks */
-	if ELEM(NULL, srcID, dstID) {
-		if (G.f & G_DEBUG)
+	if (ELEM(NULL, srcID, dstID)) {
+		if (G.debug & G_DEBUG)
 			printf("ERROR: no source or destination ID to separate AnimData with\n");
 		return;
 	}
@@ -487,8 +489,8 @@ void BKE_animdata_separate_by_basepath (ID *srcID, ID *dstID, ListBase *basepath
 	srcAdt = BKE_animdata_from_id(srcID);
 	dstAdt = BKE_id_add_animdata(dstID);
 	
-	if ELEM(NULL, srcAdt, dstAdt) {
-		if (G.f & G_DEBUG)
+	if (ELEM(NULL, srcAdt, dstAdt)) {
+		if (G.debug & G_DEBUG)
 			printf("ERROR: no AnimData for this pair of ID's\n");
 		return;
 	}
@@ -631,7 +633,8 @@ static void fcurves_path_rename_fix (ID *owner_id, const char *prefix, char *old
 }
 
 /* Check RNA-Paths for a list of Drivers */
-static void drivers_path_rename_fix (ID *owner_id, const char *prefix, const char *oldName, const char *newName, const char *oldKey, const char *newKey, ListBase *curves, int verify_paths)
+static void drivers_path_rename_fix(ID *owner_id, ID *ref_id, const char *prefix, const char *oldName, const char *newName,
+                                    const char *oldKey, const char *newKey, ListBase *curves, int verify_paths)
 {
 	FCurve *fcu;
 	
@@ -657,7 +660,7 @@ static void drivers_path_rename_fix (ID *owner_id, const char *prefix, const cha
 					
 					/* also fix the bone-name (if applicable) */
 					if (strstr(prefix, "bones")) {
-						if ( ((dtar->id) && (GS(dtar->id->name) == ID_OB)) &&
+						if ( ((dtar->id) && (GS(dtar->id->name) == ID_OB) && (!ref_id || ((Object*)(dtar->id))->data == ref_id)) &&
 							 (dtar->pchan_name[0]) && (strcmp(oldName, dtar->pchan_name)==0) )
 						{
 							BLI_strncpy(dtar->pchan_name, newName, sizeof(dtar->pchan_name));
@@ -691,7 +694,8 @@ static void nlastrips_path_rename_fix (ID *owner_id, const char *prefix, char *o
  * NOTE: it is assumed that the structure we're replacing is <prefix><["><name><"]>
  * 		i.e. pose.bones["Bone"]
  */
-void BKE_animdata_fix_paths_rename (ID *owner_id, AnimData *adt, const char *prefix, const char *oldName, const char *newName, int oldSubscript, int newSubscript, int verify_paths)
+void BKE_animdata_fix_paths_rename(ID *owner_id, AnimData *adt, ID *ref_id, const char *prefix, const char *oldName,
+                                   const char *newName, int oldSubscript, int newSubscript, int verify_paths)
 {
 	NlaTrack *nlt;
 	char *oldN, *newN;
@@ -717,7 +721,7 @@ void BKE_animdata_fix_paths_rename (ID *owner_id, AnimData *adt, const char *pre
 		fcurves_path_rename_fix(owner_id, prefix, oldN, newN, &adt->tmpact->curves, verify_paths);
 		
 	/* Drivers - Drivers are really F-Curves */
-	drivers_path_rename_fix(owner_id, prefix, oldName, newName, oldN, newN, &adt->drivers, verify_paths);
+	drivers_path_rename_fix(owner_id, ref_id, prefix, oldName, newName, oldN, newN, &adt->drivers, verify_paths);
 	
 	/* NLA Data - Animation Data for Strips */
 	for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next)
@@ -793,6 +797,9 @@ void BKE_animdata_main_cb (Main *mainptr, ID_AnimData_Edit_Callback func, void *
 	/* speakers */
 	ANIMDATA_IDS_CB(mainptr->speaker.first);
 
+	/* movie clips */
+	ANIMDATA_IDS_CB(mainptr->movieclip.first);
+
 	/* objects */
 	ANIMDATA_IDS_CB(mainptr->object.first);
 	
@@ -808,7 +815,7 @@ void BKE_animdata_main_cb (Main *mainptr, ID_AnimData_Edit_Callback func, void *
  * 		i.e. pose.bones["Bone"]
  */
 /* TODO: use BKE_animdata_main_cb for looping over all data  */
-void BKE_all_animdata_fix_paths_rename (const char *prefix, const char *oldName, const char *newName)
+void BKE_all_animdata_fix_paths_rename(ID *ref_id, const char *prefix, const char *oldName, const char *newName)
 {
 	Main *mainptr= G.main;
 	ID *id;
@@ -820,7 +827,7 @@ void BKE_all_animdata_fix_paths_rename (const char *prefix, const char *oldName,
 #define RENAMEFIX_ANIM_IDS(first) \
 	for (id= first; id; id= id->next) { \
 		AnimData *adt= BKE_animdata_from_id(id); \
-		BKE_animdata_fix_paths_rename(id, adt, prefix, oldName, newName, 0, 0, 1);\
+		BKE_animdata_fix_paths_rename(id, adt, ref_id, prefix, oldName, newName, 0, 0, 1);\
 	}
 	
 	/* another version of this macro for nodetrees */
@@ -830,9 +837,9 @@ void BKE_all_animdata_fix_paths_rename (const char *prefix, const char *oldName,
 		NtId_Type *ntp= (NtId_Type *)id; \
 		if (ntp->nodetree) { \
 			AnimData *adt2= BKE_animdata_from_id((ID *)ntp); \
-			BKE_animdata_fix_paths_rename((ID *)ntp, adt2, prefix, oldName, newName, 0, 0, 1);\
+			BKE_animdata_fix_paths_rename((ID *)ntp, adt2, ref_id, prefix, oldName, newName, 0, 0, 1);\
 		} \
-		BKE_animdata_fix_paths_rename(id, adt, prefix, oldName, newName, 0, 0, 1);\
+		BKE_animdata_fix_paths_rename(id, adt, ref_id, prefix, oldName, newName, 0, 0, 1);\
 	}
 	
 	/* nodes */
@@ -874,6 +881,9 @@ void BKE_all_animdata_fix_paths_rename (const char *prefix, const char *oldName,
 	/* speakers */
 	RENAMEFIX_ANIM_IDS(mainptr->speaker.first);
 
+	/* movie clips */
+	RENAMEFIX_ANIM_IDS(mainptr->movieclip.first);
+
 	/* objects */
 	RENAMEFIX_ANIM_IDS(mainptr->object.first); 
 	
@@ -896,7 +906,7 @@ KS_Path *BKE_keyingset_find_path (KeyingSet *ks, ID *id, const char group_name[]
 	KS_Path *ksp;
 	
 	/* sanity checks */
-	if ELEM3(NULL, ks, rna_path, id)
+	if (ELEM3(NULL, ks, rna_path, id))
 		return NULL;
 	
 	/* loop over paths in the current KeyingSet, finding the first one where all settings match 
@@ -934,14 +944,16 @@ KS_Path *BKE_keyingset_find_path (KeyingSet *ks, ID *id, const char group_name[]
 /* Defining Tools --------------------------- */
 
 /* Used to create a new 'custom' KeyingSet for the user, that will be automatically added to the stack */
-KeyingSet *BKE_keyingset_add (ListBase *list, const char name[], short flag, short keyingflag)
+KeyingSet *BKE_keyingset_add (ListBase *list, const char idname[], const char name[], short flag, short keyingflag)
 {
 	KeyingSet *ks;
 	
 	/* allocate new KeyingSet */
 	ks= MEM_callocN(sizeof(KeyingSet), "KeyingSet");
 
-	BLI_strncpy(ks->name, name ? name : "KeyingSet", 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;
@@ -949,8 +961,11 @@ KeyingSet *BKE_keyingset_add (ListBase *list, const char name[], short flag, sho
 	/* add KeyingSet to list */
 	BLI_addtail(list, ks);
 	
-	/* make sure KeyingSet has a unique name (this helps with identification) */
-	BLI_uniquename(list, ks, "KeyingSet", '.', offsetof(KeyingSet, name), sizeof(ks->name));
+	/* 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). */
+	BLI_uniquename(list, ks, "Keying Set", '.', offsetof(KeyingSet, name), sizeof(ks->name));
 	
 	/* return new KeyingSet for further editing */
 	return ks;
@@ -964,21 +979,21 @@ KS_Path *BKE_keyingset_add_path (KeyingSet *ks, ID *id, const char group_name[],
 	KS_Path *ksp;
 	
 	/* sanity checks */
-	if ELEM(NULL, ks, rna_path) {
-		printf("ERROR: no Keying Set and/or RNA Path to add path with \n");
+	if (ELEM(NULL, ks, rna_path)) {
+		printf("ERROR: no Keying Set and/or RNA Path to add path with\n");
 		return NULL;
 	}
 	
 	/* ID is required for all types of KeyingSets */
 	if (id == NULL) {
-		printf("ERROR: No ID provided for Keying Set Path. \n");
+		printf("ERROR: No ID provided for Keying Set Path\n");
 		return NULL;
 	}
 	
 	/* don't add if there is already a matching KS_Path in the KeyingSet */
 	if (BKE_keyingset_find_path(ks, id, group_name, rna_path, array_index, groupmode)) {
-		if (G.f & G_DEBUG)
-			printf("ERROR: destination already exists in Keying Set \n");
+		if (G.debug & G_DEBUG)
+			printf("ERROR: destination already exists in Keying Set\n");
 		return NULL;
 	}
 	
@@ -1016,11 +1031,11 @@ KS_Path *BKE_keyingset_add_path (KeyingSet *ks, ID *id, const char group_name[],
 void BKE_keyingset_free_path (KeyingSet *ks, KS_Path *ksp)
 {
 	/* sanity check */
-	if ELEM(NULL, ks, ksp)
+	if (ELEM(NULL, ks, ksp))
 		return;
 
 	/* free RNA-path info */
-	if(ksp->rna_path)
+	if (ksp->rna_path)
 		MEM_freeN(ksp->rna_path);
 
 	/* free path itself */
@@ -1117,17 +1132,14 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i
 	//printf("%p %s %i %f\n", ptr, path, array_index, value);
 	
 	/* get property to write to */
-	if (RNA_path_resolve(ptr, path, &new_ptr, &prop)) 
-	{
+	if (RNA_path_resolve(ptr, path, &new_ptr, &prop)) {
 		/* set value - only for animatable numerical values */
-		if (RNA_property_animateable(&new_ptr, prop)) 
-		{
+		if (RNA_property_animateable(&new_ptr, prop)) {
 			int array_len= RNA_property_array_length(&new_ptr, prop);
 			
-			if (array_len && array_index >= array_len)
-			{
-				if (G.f & G_DEBUG) {
-					printf("Animato: Invalid array index. ID = '%s',  '%s[%d]', array length is %d \n",
+			if (array_len && array_index >= array_len) {
+				if (G.debug & G_DEBUG) {
+					printf("Animato: Invalid array index. ID = '%s',  '%s[%d]', array length is %d\n",
 						(ptr && ptr->id.data) ? (((ID *)ptr->id.data)->name+2) : "<No ID>",
 						path, array_index, array_len-1);
 				}
@@ -1135,8 +1147,7 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i
 				return 0;
 			}
 			
-			switch (RNA_property_type(prop)) 
-			{
+			switch (RNA_property_type(prop)) {
 				case PROP_BOOLEAN:
 					if (array_len)
 						RNA_property_boolean_set_index(&new_ptr, prop, array_index, ANIMSYS_FLOAT_AS_BOOL(value));
@@ -1169,7 +1180,7 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i
 			if (RNA_property_update_check(prop)) {
 				short skip_updates_hack = 0;
 				
-				/* optimisation hacks: skip property updates for those properties
+				/* optimization hacks: skip property updates for those properties
 				 * for we know that which the updates in RNA were really just for
 				 * flushing property editing via UI/Py
 				 */
@@ -1184,9 +1195,9 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i
 #endif
 
 			/* as long as we don't do property update, we still tag datablock
-			   as having been updated. this flag does not cause any updates to
-			   be run, it's for e.g. render engines to synchronize data */
-			if(new_ptr.id.data) {
+			 * as having been updated. this flag does not cause any updates to
+			 * be run, it's for e.g. render engines to synchronize data */
+			if (new_ptr.id.data) {
 				ID *id= new_ptr.id.data;
 				id->flag |= LIB_ID_RECALC;
 				DAG_id_type_tag(G.main, GS(id->name));
@@ -1200,8 +1211,8 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i
 		/* failed to get path */
 		// XXX don't tag as failed yet though, as there are some legit situations (Action Constraint) 
 		// where some channels will not exist, but shouldn't lock up Action
-		if (G.f & G_DEBUG) {
-			printf("Animato: Invalid path. ID = '%s',  '%s[%d]' \n",
+		if (G.debug & G_DEBUG) {
+			printf("Animato: Invalid path. ID = '%s',  '%s[%d]'\n",
 				(ptr && ptr->id.data) ? (((ID *)ptr->id.data)->name+2) : "<No ID>", 
 				path, array_index);
 		}
@@ -1244,8 +1255,7 @@ static void animsys_evaluate_fcurves (PointerRNA *ptr, ListBase *list, AnimMappe
 		/* check if this F-Curve doesn't belong to a muted group */
 		if ((fcu->grp == NULL) || (fcu->grp->flag & AGRP_MUTED)==0) {
 			/* check if this curve should be skipped */
-			if ((fcu->flag & (FCURVE_MUTED|FCURVE_DISABLED)) == 0) 
-			{
+			if ((fcu->flag & (FCURVE_MUTED|FCURVE_DISABLED)) == 0) {
 				calculate_fcurve(fcu, ctime);
 				animsys_execute_fcurve(ptr, remap, fcu); 
 			}
@@ -1270,8 +1280,7 @@ static void animsys_evaluate_drivers (PointerRNA *ptr, AnimData *adt, float ctim
 		short ok= 0;
 		
 		/* check if this driver's curve should be skipped */
-		if ((fcu->flag & (FCURVE_MUTED|FCURVE_DISABLED)) == 0) 
-		{
+		if ((fcu->flag & (FCURVE_MUTED|FCURVE_DISABLED)) == 0) {
 			/* check if driver itself is tagged for recalculation */
 			if ((driver) && !(driver->flag & DRIVER_FLAG_INVALID)/*&& (driver->flag & DRIVER_FLAG_RECALC)*/) {	// XXX driver recalc flag is not set yet by depsgraph!
 				/* evaluate this using values set already in other places */
@@ -1317,7 +1326,7 @@ static void action_idcode_patch_check (ID *id, bAction *act)
 	}
 	else if (act->idroot != idcode) {
 		/* only report this error if debug mode is enabled (to save performance everywhere else) */
-		if (G.f & G_DEBUG) {
+		if (G.debug & G_DEBUG) {
 			printf("AnimSys Safety Check Failed: Action '%s' is not meant to be used from ID-Blocks of type %d such as '%s'\n",
 				act->id.name+2, idcode, id->name);
 		}
@@ -1332,7 +1341,7 @@ void animsys_evaluate_action_group (PointerRNA *ptr, bAction *act, bActionGroup
 	FCurve *fcu;
 	
 	/* check if mapper is appropriate for use here (we set to NULL if it's inappropriate) */
-	if ELEM(NULL, act, agrp) return;
+	if (ELEM(NULL, act, agrp)) return;
 	if ((remap) && (remap->target != act)) remap= NULL;
 	
 	action_idcode_patch_check(ptr->id.data, act);
@@ -1345,8 +1354,7 @@ void animsys_evaluate_action_group (PointerRNA *ptr, bAction *act, bActionGroup
 	for (fcu= agrp->channels.first; (fcu) && (fcu->grp == agrp); fcu= fcu->next) 
 	{
 		/* check if this curve should be skipped */
-		if ((fcu->flag & (FCURVE_MUTED|FCURVE_DISABLED)) == 0) 
-		{
+		if ((fcu->flag & (FCURVE_MUTED|FCURVE_DISABLED)) == 0) {
 			calculate_fcurve(fcu, ctime);
 			animsys_execute_fcurve(ptr, remap, fcu); 
 		}
@@ -1372,7 +1380,7 @@ void animsys_evaluate_action (PointerRNA *ptr, bAction *act, AnimMapper *remap,
 /* calculate influence of strip based for given frame based on blendin/out values */
 static float nlastrip_get_influence (NlaStrip *strip, float cframe)
 {
-	/* sanity checks - normalise the blendin/out values? */
+	/* sanity checks - normalize the blendin/out values? */
 	strip->blendin= fabsf(strip->blendin);
 	strip->blendout= fabsf(strip->blendout);
 	
@@ -1582,14 +1590,14 @@ static NlaEvalChannel *nlaevalchan_verify (PointerRNA *ptr, ListBase *channels,
 		/* get path, remapped as appropriate to work in its new environment */
 	/* free_path= */ /* UNUSED */ animsys_remap_path(strip->remap, fcu->rna_path, &path);
 	
-		/* a valid property must be available, and it must be animateable */
+		/* a valid property must be available, and it must be animatable */
 	if (RNA_path_resolve(ptr, path, &new_ptr, &prop) == 0) {
-		if (G.f & G_DEBUG) printf("NLA Strip Eval: Cannot resolve path \n");
+		if (G.debug & G_DEBUG) printf("NLA Strip Eval: Cannot resolve path\n");
 		return NULL;
 	}
-		/* only ok if animateable */
+		/* only ok if animatable */
 	else if (RNA_property_animateable(&new_ptr, prop) == 0) {
-		if (G.f & G_DEBUG) printf("NLA Strip Eval: Property not animateable \n");
+		if (G.debug & G_DEBUG) printf("NLA Strip Eval: Property not animatable\n");
 		return NULL;
 	}
 	
@@ -1669,7 +1677,7 @@ static void nlaevalchan_buffers_accumulate (ListBase *channels, ListBase *tmp_bu
 {
 	NlaEvalChannel *nec, *necn, *necd;
 	
-	/* optimise - abort if no channels */
+	/* optimize - abort if no channels */
 	if (tmp_buffer->first == NULL)
 		return;
 	
@@ -1705,14 +1713,14 @@ static void nlaeval_fmodifiers_join_stacks (ListBase *result, ListBase *list1, L
 	FModifier *fcm1, *fcm2;
 	
 	/* if list1 is invalid...  */
-	if ELEM(NULL, list1, list1->first) {
+	if (ELEM(NULL, list1, list1->first)) {
 		if (list2 && list2->first) {
 			result->first= list2->first;
 			result->last= list2->last;
 		}
 	}
 	/* if list 2 is invalid... */
-	else if ELEM(NULL, list2, list2->first) {
+	else if (ELEM(NULL, list2, list2->first)) {
 		result->first= list1->first;
 		result->last= list1->last;
 	}
@@ -1737,9 +1745,9 @@ static void nlaeval_fmodifiers_split_stacks (ListBase *list1, ListBase *list2)
 	FModifier *fcm1, *fcm2;
 	
 	/* if list1/2 is invalid... just skip */
-	if ELEM(NULL, list1, list2)
+	if (ELEM(NULL, list1, list2))
 		return;
-	if ELEM(NULL, list1->first, list2->first)
+	if (ELEM(NULL, list1->first, list2->first))
 		return;
 		
 	/* get endpoints */
@@ -2137,7 +2145,7 @@ static void animsys_evaluate_overrides (PointerRNA *ptr, AnimData *adt)
 
 /* Overview of how this system works:
  *	1) Depsgraph sorts data as necessary, so that data is in an order that means 
- *		that all dependences are resolved before dependants.
+ *		that all dependencies are resolved before dependants.
  *	2) All normal animation is evaluated, so that drivers have some basis values to
  *		work with
  *		a.	NLA stacks are done first, as the Active Actions act as 'tweaking' tracks
@@ -2146,14 +2154,14 @@ static void animsys_evaluate_overrides (PointerRNA *ptr, AnimData *adt)
  *
  * --------------< often in a separate phase... >------------------ 
  *
- *	3) Drivers/expressions are evaluated on top of this, in an order where dependences are
+ *	3) Drivers/expressions are evaluated on top of this, in an order where dependencies are
  *		resolved nicely. 
  *	   Note: it may be necessary to have some tools to handle the cases where some higher-level
  *		drivers are added and cause some problematic dependencies that didn't exist in the local levels...
  *
  * --------------< always executed >------------------ 
  *
- * Maintainance of editability of settings (XXX):
+ * Maintenance of editability of settings (XXX):
  *	In order to ensure that settings that are animated can still be manipulated in the UI without requiring
  *	that keyframes are added to prevent these values from being overwritten, we use 'overrides'. 
  *
@@ -2163,7 +2171,7 @@ static void animsys_evaluate_overrides (PointerRNA *ptr, AnimData *adt)
  *
  * Current Status:
  *	- Currently (as of September 2009), overrides we haven't needed to (fully) implement overrides. 
- * 	  However, the code fo this is relatively harmless, so is left in the code for now.
+ * 	  However, the code for this is relatively harmless, so is left in the code for now.
  */
 
 /* Evaluation loop for evaluation animation data 
@@ -2177,7 +2185,7 @@ void BKE_animsys_evaluate_animdata (Scene *scene, ID *id, AnimData *adt, float c
 	PointerRNA id_ptr;
 	
 	/* sanity checks */
-	if ELEM(NULL, id, adt)
+	if (ELEM(NULL, id, adt))
 		return;
 	
 	/* get pointer to ID-block for RNA to use */
@@ -2188,11 +2196,9 @@ void BKE_animsys_evaluate_animdata (Scene *scene, ID *id, AnimData *adt, float c
 	 *	  that overrides 'rough' work in NLA
 	 */
 	// TODO: need to double check that this all works correctly
-	if ((recalc & ADT_RECALC_ANIM) || (adt->recalc & ADT_RECALC_ANIM))
-	{
+	if ((recalc & ADT_RECALC_ANIM) || (adt->recalc & ADT_RECALC_ANIM)) {
 		/* evaluate NLA data */
-		if ((adt->nla_tracks.first) && !(adt->flag & ADT_NLA_EVAL_OFF))
-		{
+		if ((adt->nla_tracks.first) && !(adt->flag & ADT_NLA_EVAL_OFF)) {
 			/* evaluate NLA-stack 
 			 *	- active action is evaluated as part of the NLA stack as the last item
 			 */
@@ -2225,8 +2231,7 @@ void BKE_animsys_evaluate_animdata (Scene *scene, ID *id, AnimData *adt, float c
 	animsys_evaluate_overrides(&id_ptr, adt);
 	
 	/* execute and clear all cached property update functions */
-	if (scene)
-	{
+	if (scene) {
 		Main *bmain = G.main; // xxx - to get passed in!
 		RNA_property_update_cache_flush(bmain, scene);
 		RNA_property_update_cache_free();
@@ -2247,8 +2252,8 @@ void BKE_animsys_evaluate_all_animation (Main *main, Scene *scene, float ctime)
 {
 	ID *id;
 
-	if (G.f & G_DEBUG)
-		printf("Evaluate all animation - %f \n", ctime);
+	if (G.debug & G_DEBUG)
+		printf("Evaluate all animation - %f\n", ctime);
 	
 	/* macros for less typing 
 	 *	- only evaluate animation data for id if it has users (and not just fake ones)
@@ -2281,16 +2286,16 @@ void BKE_animsys_evaluate_all_animation (Main *main, Scene *scene, float ctime)
 		} \
 	}
 	
-	/* optimisation: 
+	/* optimization: 
 	 * when there are no actions, don't go over database and loop over heaps of datablocks, 
 	 * which should ultimately be empty, since it is not possible for now to have any animation 
 	 * without some actions, and drivers wouldn't get affected by any state changes
 	 *
 	 * however, if there are some curves, we will need to make sure that their 'ctime' property gets
-	 * set correctly, so this optimisation must be skipped in that case...
+	 * set correctly, so this optimization must be skipped in that case...
 	 */
 	if ((main->action.first == NULL) && (main->curve.first == NULL)) {
-		if (G.f & G_DEBUG)
+		if (G.debug & G_DEBUG)
 			printf("\tNo Actions, so no animation needs to be evaluated...\n");
 			
 		return;
@@ -2335,9 +2340,12 @@ void BKE_animsys_evaluate_all_animation (Main *main, Scene *scene, float ctime)
 	/* speakers */
 	EVAL_ANIM_IDS(main->speaker.first, ADT_RECALC_ANIM);
 
+	/* movie clips */
+	EVAL_ANIM_IDS(main->movieclip.first, ADT_RECALC_ANIM);
+
 	/* objects */
 		/* ADT_RECALC_ANIM doesn't need to be supplied here, since object AnimData gets 
-		 * this tagged by Depsgraph on framechange. This optimisation means that objects
+		 * this tagged by Depsgraph on framechange. This optimization means that objects
 		 * linked from other (not-visible) scenes will not need their data calculated.
 		 */
 	EVAL_ANIM_IDS(main->object.first, 0); 
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 02b9330..0f3e27a 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.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
@@ -73,38 +73,38 @@
 #include "BIK_api.h"
 #include "BKE_sketch.h"
 
-/*	**************** Generic Functions, data level *************** */
+/* **************** Generic Functions, data level *************** */
 
 bArmature *add_armature(const char *name)
 {
 	bArmature *arm;
-	
-	arm= alloc_libblock (&G.main->armature, ID_AR, name);
+
+	arm = alloc_libblock (&G.main->armature, ID_AR, name);
 	arm->deformflag = ARM_DEF_VGROUP|ARM_DEF_ENVELOPE;
 	arm->flag = ARM_COL_CUSTOM; /* custom bone-group colors */
-	arm->layer= 1;
+	arm->layer = 1;
 	return arm;
 }
 
 bArmature *get_armature(Object *ob)
 {
-	if(ob->type==OB_ARMATURE)
+	if (ob->type == OB_ARMATURE)
 		return (bArmature *)ob->data;
 	return NULL;
 }
 
-void free_bonelist (ListBase *lb)
+void free_bonelist(ListBase *lb)
 {
 	Bone *bone;
 
-	for(bone=lb->first; bone; bone=bone->next) {
-		if(bone->prop) {
+	for (bone = lb->first; bone; bone = bone->next) {
+		if (bone->prop) {
 			IDP_FreeProperty(bone->prop);
 			MEM_freeN(bone->prop);
 		}
 		free_bonelist(&bone->childbase);
 	}
-	
+
 	BLI_freelistN(lb);
 }
 
@@ -112,13 +112,13 @@ void free_armature(bArmature *arm)
 {
 	if (arm) {
 		free_bonelist(&arm->bonebase);
-		
+
 		/* free editmode data */
 		if (arm->edbo) {
 			BLI_freelistN(arm->edbo);
-			
+
 			MEM_freeN(arm->edbo);
-			arm->edbo= NULL;
+			arm->edbo = NULL;
 		}
 
 		/* free sketch */
@@ -126,48 +126,51 @@ void free_armature(bArmature *arm)
 			freeSketch(arm->sketch);
 			arm->sketch = NULL;
 		}
-		
+
 		/* free animation data */
 		if (arm->adt) {
 			BKE_free_animdata(&arm->id);
-			arm->adt= NULL;
+			arm->adt = NULL;
 		}
 	}
 }
 
 void make_local_armature(bArmature *arm)
 {
-	Main *bmain= G.main;
-	int is_local= FALSE, is_lib= FALSE;
+	Main *bmain = G.main;
+	int is_local = FALSE, is_lib = FALSE;
 	Object *ob;
 
-	if (arm->id.lib==NULL) return;
-	if (arm->id.us==1) {
+	if (arm->id.lib == NULL)
+		return;
+	if (arm->id.us == 1) {
 		id_clear_lib_data(bmain, &arm->id);
 		return;
 	}
 
-	for(ob= bmain->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) {
-		if(ob->data == arm) {
-			if(ob->id.lib) is_lib= TRUE;
-			else is_local= TRUE;
+	for (ob = bmain->object.first; ob && ELEM(0, is_lib, is_local); ob = ob->id.next) {
+		if (ob->data == arm) {
+			if (ob->id.lib)
+				is_lib = TRUE;
+			else
+				is_local = TRUE;
 		}
 	}
 
-	if(is_local && is_lib == FALSE) {
+	if (is_local && is_lib == FALSE) {
 		id_clear_lib_data(bmain, &arm->id);
 	}
-	else if(is_local && is_lib) {
-		bArmature *arm_new= copy_armature(arm);
-		arm_new->id.us= 0;
+	else if (is_local && is_lib) {
+		bArmature *arm_new = copy_armature(arm);
+		arm_new->id.us = 0;
 
 		/* Remap paths of new ID using old library as base. */
 		BKE_id_lib_local_paths(bmain, arm->id.lib, &arm_new->id);
 
-		for(ob= bmain->object.first; ob; ob= ob->id.next) {
-			if(ob->data == arm) {
-				if(ob->id.lib==NULL) {
-					ob->data= arm_new;
+		for (ob = bmain->object.first; ob; ob = ob->id.next) {
+			if (ob->data == arm) {
+				if (ob->id.lib == NULL) {
+					ob->data = arm_new;
 					arm_new->id.us++;
 					arm->id.us--;
 				}
@@ -176,105 +179,104 @@ void make_local_armature(bArmature *arm)
 	}
 }
 
-static void	copy_bonechildren (Bone* newBone, Bone* oldBone, Bone* actBone, Bone **newActBone)
+static void copy_bonechildren(Bone* newBone, Bone* oldBone, Bone* actBone, Bone **newActBone)
 {
-	Bone	*curBone, *newChildBone;
-	
-	if(oldBone == actBone)
-		*newActBone= newBone;
+	Bone *curBone, *newChildBone;
+
+	if (oldBone == actBone)
+		*newActBone = newBone;
 
-	if(oldBone->prop)
-		newBone->prop= IDP_CopyProperty(oldBone->prop);
+	if (oldBone->prop)
+		newBone->prop = IDP_CopyProperty(oldBone->prop);
 
-	/*	Copy this bone's list*/
+	/* Copy this bone's list */
 	BLI_duplicatelist(&newBone->childbase, &oldBone->childbase);
-	
-	/*	For each child in the list, update it's children*/
-	newChildBone=newBone->childbase.first;
-	for (curBone=oldBone->childbase.first;curBone;curBone=curBone->next){
-		newChildBone->parent=newBone;
+
+	/* For each child in the list, update it's children */
+	newChildBone = newBone->childbase.first;
+	for (curBone = oldBone->childbase.first; curBone; curBone = curBone->next) {
+		newChildBone->parent = newBone;
 		copy_bonechildren(newChildBone, curBone, actBone, newActBone);
-		newChildBone=newChildBone->next;
+		newChildBone = newChildBone->next;
 	}
 }
 
 bArmature *copy_armature(bArmature *arm)
 {
 	bArmature *newArm;
-	Bone		*oldBone, *newBone;
-	Bone		*newActBone= NULL;
-	
-	newArm= copy_libblock(&arm->id);
+	Bone *oldBone, *newBone;
+	Bone *newActBone= NULL;
+
+	newArm = copy_libblock(&arm->id);
 	BLI_duplicatelist(&newArm->bonebase, &arm->bonebase);
-	
-	/*	Duplicate the childrens' lists*/
-	newBone=newArm->bonebase.first;
-	for (oldBone=arm->bonebase.first;oldBone;oldBone=oldBone->next){
-		newBone->parent=NULL;
-		copy_bonechildren (newBone, oldBone, arm->act_bone, &newActBone);
-		newBone=newBone->next;
-	};
-	
-	newArm->act_bone= newActBone;
-
-	newArm->edbo= NULL;
-	newArm->act_edbone= NULL;
-	newArm->sketch= NULL;
+
+	/* Duplicate the childrens' lists*/
+	newBone = newArm->bonebase.first;
+	for (oldBone = arm->bonebase.first; oldBone; oldBone = oldBone->next) {
+		newBone->parent = NULL;
+		copy_bonechildren(newBone, oldBone, arm->act_bone, &newActBone);
+		newBone = newBone->next;
+	}
+
+	newArm->act_bone = newActBone;
+
+	newArm->edbo = NULL;
+	newArm->act_edbone = NULL;
+	newArm->sketch = NULL;
 
 	return newArm;
 }
 
-static Bone *get_named_bone_bonechildren (Bone *bone, const char *name)
+static Bone *get_named_bone_bonechildren(Bone *bone, const char *name)
 {
 	Bone *curBone, *rbone;
-	
-	if (!strcmp (bone->name, name))
+
+	if (!strcmp(bone->name, name))
 		return bone;
-	
-	for (curBone=bone->childbase.first; curBone; curBone=curBone->next){
-		rbone=get_named_bone_bonechildren (curBone, name);
+
+	for (curBone = bone->childbase.first; curBone; curBone = curBone->next) {
+		rbone = get_named_bone_bonechildren(curBone, name);
 		if (rbone)
 			return rbone;
 	}
-	
+
 	return NULL;
 }
 
 
-Bone *get_named_bone (bArmature *arm, const char *name)
-/*
-	Walk the list until the bone is found
- */
+/* Walk the list until the bone is found */
+Bone *get_named_bone(bArmature *arm, const char *name)
 {
-	Bone *bone=NULL, *curBone;
-	
-	if (!arm) return NULL;
-	
-	for (curBone=arm->bonebase.first; curBone; curBone=curBone->next){
-		bone = get_named_bone_bonechildren (curBone, name);
+	Bone *bone = NULL, *curBone;
+
+	if (!arm)
+		return NULL;
+
+	for (curBone = arm->bonebase.first; curBone; curBone = curBone->next) {
+		bone = get_named_bone_bonechildren(curBone, name);
 		if (bone)
 			return bone;
 	}
-	
+
 	return bone;
 }
 
-/* Finds the best possible extension to the name on a particular axis. (For renaming, check for unique names afterwards)
- * 	strip_number: removes number extensions  (TODO: not used)
- *	axis: the axis to name on
- *	head/tail: the head/tail co-ordinate of the bone on the specified axis
- */
-int bone_autoside_name (char name[MAXBONENAME], int UNUSED(strip_number), short axis, float head, float tail)
+/* Finds the best possible extension to the name on a particular axis. (For renaming, check for
+ * unique names afterwards) strip_number: removes number extensions  (TODO: not used)
+ * axis: the axis to name on
+ * head/tail: the head/tail co-ordinate of the bone on the specified axis */
+int bone_autoside_name(char name[MAXBONENAME], int UNUSED(strip_number), short axis, float head, float tail)
 {
 	unsigned int len;
-	char	basename[MAXBONENAME]= "";
-	char 	extension[5]= "";
+	char basename[MAXBONENAME] = "";
+	char extension[5] = "";
 
-	len= strlen(name);
-	if (len == 0) return 0;
+	len = strlen(name);
+	if (len == 0)
+		return 0;
 	BLI_strncpy(basename, name, sizeof(basename));
-	
-	/* Figure out extension to append: 
+
+	/* Figure out extension to append:
 	 *	- The extension to append is based upon the axis that we are working on.
 	 *	- If head happens to be on 0, then we must consider the tail position as well to decide
 	 *	  which side the bone is on
@@ -323,41 +325,44 @@ int bone_autoside_name (char name[MAXBONENAME], int UNUSED(strip_number), short
 		else {
 			if (head < 0)
 				strcpy(extension, "R");
+			/* XXX Shouldn't this be simple else, as for z and y axes? */
 			else if (head > 0)
 				strcpy(extension, "L");
 		}
 	}
 
-	/* Simple name truncation 
+	/* Simple name truncation
 	 *	- truncate if there is an extension and it wouldn't be able to fit
 	 *	- otherwise, just append to end
 	 */
 	if (extension[0]) {
 		int change = 1;
-		
+
 		while (change) { /* remove extensions */
 			change = 0;
-			if (len > 2 && basename[len-2]=='.') {
-				if (basename[len-1]=='L' || basename[len-1] == 'R' ) { /* L R */
+			if (len > 2 && basename[len-2] == '.') {
+				if (basename[len-1] == 'L' || basename[len-1] == 'R') { /* L R */
 					basename[len-2] = '\0';
-					len-=2;
-					change= 1;
+					len -= 2;
+					change = 1;
 				}
-			} else if (len > 3 && basename[len-3]=='.') {
-				if (	(basename[len-2]=='F' && basename[len-1] == 'r') ||	/* Fr */
-						(basename[len-2]=='B' && basename[len-1] == 'k')	/* Bk */
-				) {
+			}
+			else if (len > 3 && basename[len-3] == '.') {
+				if ((basename[len-2] == 'F' && basename[len-1] == 'r') || /* Fr */
+				   (basename[len-2] == 'B' && basename[len-1] == 'k'))   /* Bk */
+				{
 					basename[len-3] = '\0';
-					len-=3;
-					change= 1;
+					len -= 3;
+					change = 1;
 				}
-			} else if (len > 4 && basename[len-4]=='.') {
-				if (	(basename[len-3]=='T' && basename[len-2]=='o' && basename[len-1] == 'p') ||	/* Top */
-						(basename[len-3]=='B' && basename[len-2]=='o' && basename[len-1] == 't')	/* Bot */
-				) {
+			}
+			else if (len > 4 && basename[len-4] == '.') {
+				if ((basename[len-3] == 'T' && basename[len-2] == 'o' && basename[len-1] == 'p') || /* Top */
+				   (basename[len-3] == 'B' && basename[len-2] == 'o' && basename[len-1] == 't'))   /* Bot */
+				{
 					basename[len-4] = '\0';
-					len-=4;
-					change= 1;
+					len -= 4;
+					change = 1;
 				}
 			}
 		}
@@ -371,9 +376,8 @@ int bone_autoside_name (char name[MAXBONENAME], int UNUSED(strip_number), short
 		return 1;
 	}
 
-	else {
+	else
 		return 0;
-	}
 }
 
 /* ************* B-Bone support ******************* */
@@ -387,37 +391,35 @@ static void equalize_bezier(float *data, int desired)
 	float pdist[MAX_BBONE_SUBDIV+1];
 	float temp[MAX_BBONE_SUBDIV+1][4];
 	int a, nr;
-	
-	pdist[0]= 0.0f;
-	for(a=0, fp= data; a<MAX_BBONE_SUBDIV; a++, fp+=4) {
+
+	pdist[0] = 0.0f;
+	for (a = 0, fp = data; a < MAX_BBONE_SUBDIV; a++, fp += 4) {
 		copy_qt_qt(temp[a], fp);
-		pdist[a+1]= pdist[a]+len_v3v3(fp, fp+4);
+		pdist[a+1] = pdist[a] + len_v3v3(fp, fp+4);
 	}
 	/* do last point */
 	copy_qt_qt(temp[a], fp);
-	totdist= pdist[a];
-	
+	totdist = pdist[a];
+
 	/* go over distances and calculate new points */
-	ddist= totdist/((float)desired);
-	nr= 1;
-	for(a=1, fp= data+4; a<desired; a++, fp+=4) {
-		
-		dist= ((float)a)*ddist;
-		
+	ddist = totdist/((float)desired);
+	nr = 1;
+	for (a = 1, fp = data+4; a < desired; a++, fp += 4) {
+		dist = ((float)a)*ddist;
+
 		/* we're looking for location (distance) 'dist' in the array */
-		while((dist>= pdist[nr]) && nr<MAX_BBONE_SUBDIV) {
+		while ((dist >= pdist[nr]) && nr < MAX_BBONE_SUBDIV)
 			nr++;
-		}
-		
-		fac1= pdist[nr]- pdist[nr-1];
-		fac2= pdist[nr]-dist;
-		fac1= fac2/fac1;
-		fac2= 1.0f-fac1;
-		
-		fp[0]= fac1*temp[nr-1][0]+ fac2*temp[nr][0];
-		fp[1]= fac1*temp[nr-1][1]+ fac2*temp[nr][1];
-		fp[2]= fac1*temp[nr-1][2]+ fac2*temp[nr][2];
-		fp[3]= fac1*temp[nr-1][3]+ fac2*temp[nr][3];
+
+		fac1 = pdist[nr] - pdist[nr-1];
+		fac2 = pdist[nr] - dist;
+		fac1 = fac2 / fac1;
+		fac2 = 1.0f - fac1;
+
+		fp[0] = fac1*temp[nr-1][0] + fac2*temp[nr][0];
+		fp[1] = fac1*temp[nr-1][1] + fac2*temp[nr][1];
+		fp[2] = fac1*temp[nr-1][2] + fac2*temp[nr][2];
+		fp[3] = fac1*temp[nr-1][3] + fac2*temp[nr][3];
 	}
 	/* set last point, needed for orientation calculus */
 	copy_qt_qt(fp, temp[MAX_BBONE_SUBDIV]);
@@ -429,261 +431,267 @@ Mat4 *b_bone_spline_setup(bPoseChannel *pchan, int rest)
 {
 	static Mat4 bbone_array[MAX_BBONE_SUBDIV];
 	static Mat4 bbone_rest_array[MAX_BBONE_SUBDIV];
-	Mat4 *result_array= (rest)? bbone_rest_array: bbone_array;
+	Mat4 *result_array = (rest) ? bbone_rest_array : bbone_array;
 	bPoseChannel *next, *prev;
-	Bone *bone= pchan->bone;
-	float h1[3], h2[3], scale[3], length, hlength1, hlength2, roll1=0.0f, roll2;
+	Bone *bone = pchan->bone;
+	float h1[3], h2[3], scale[3], length, hlength1, hlength2, roll1 = 0.0f, roll2;
 	float mat3[3][3], imat[4][4], posemat[4][4], scalemat[4][4], iscalemat[4][4];
 	float data[MAX_BBONE_SUBDIV+1][4], *fp;
-	int a, doscale= 0;
+	int a, doscale = 0;
 
-	length= bone->length;
+	length = bone->length;
 
-	if(!rest) {
+	if (!rest) {
 		/* check if we need to take non-uniform bone scaling into account */
-		scale[0]= len_v3(pchan->pose_mat[0]);
-		scale[1]= len_v3(pchan->pose_mat[1]);
-		scale[2]= len_v3(pchan->pose_mat[2]);
+		scale[0] = len_v3(pchan->pose_mat[0]);
+		scale[1] = len_v3(pchan->pose_mat[1]);
+		scale[2] = len_v3(pchan->pose_mat[2]);
 
-		if(fabsf(scale[0] - scale[1]) > 1e-6f || fabsf(scale[1] - scale[2]) > 1e-6f) {
+		if (fabsf(scale[0] - scale[1]) > 1e-6f || fabsf(scale[1] - scale[2]) > 1e-6f) {
 			unit_m4(scalemat);
-			scalemat[0][0]= scale[0];
-			scalemat[1][1]= scale[1];
-			scalemat[2][2]= scale[2];
+			scalemat[0][0] = scale[0];
+			scalemat[1][1] = scale[1];
+			scalemat[2][2] = scale[2];
 			invert_m4_m4(iscalemat, scalemat);
 
 			length *= scale[1];
 			doscale = 1;
 		}
 	}
-	
-	hlength1= bone->ease1*length*0.390464f;		// 0.5*sqrt(2)*kappa, the handle length for near-perfect circles
-	hlength2= bone->ease2*length*0.390464f;
-	
+
+	hlength1 = bone->ease1*length*0.390464f; /* 0.5*sqrt(2)*kappa, the handle length for near-perfect circles */
+	hlength2 = bone->ease2*length*0.390464f;
+
 	/* evaluate next and prev bones */
-	if(bone->flag & BONE_CONNECTED)
-		prev= pchan->parent;
+	if (bone->flag & BONE_CONNECTED)
+		prev = pchan->parent;
 	else
-		prev= NULL;
-	
-	next= pchan->child;
-	
-	/* find the handle points, since this is inside bone space, the 
-		first point = (0,0,0)
-		last point =  (0, length, 0) */
-	
-	if(rest) {
+		prev = NULL;
+
+	next = pchan->child;
+
+	/* find the handle points, since this is inside bone space, the
+	 * first point = (0,0,0)
+	 * last point =  (0, length, 0) */
+	if (rest) {
 		invert_m4_m4(imat, pchan->bone->arm_mat);
 	}
-	else if(doscale) {
+	else if (doscale) {
 		copy_m4_m4(posemat, pchan->pose_mat);
 		normalize_m4(posemat);
 		invert_m4_m4(imat, posemat);
 	}
 	else
 		invert_m4_m4(imat, pchan->pose_mat);
-	
-	if(prev) {
+
+	if (prev) {
 		float difmat[4][4], result[3][3], imat3[3][3];
 
 		/* transform previous point inside this bone space */
-		if(rest)
+		if (rest)
 			copy_v3_v3(h1, prev->bone->arm_head);
 		else
 			copy_v3_v3(h1, prev->pose_head);
 		mul_m4_v3(imat, h1);
 
-		if(prev->bone->segments>1) {
+		if (prev->bone->segments>1) {
 			/* if previous bone is B-bone too, use average handle direction */
-			h1[1]-= length;
-			roll1= 0.0f;
+			h1[1] -= length;
+			roll1 = 0.0f;
 		}
 
 		normalize_v3(h1);
 		mul_v3_fl(h1, -hlength1);
 
-		if(prev->bone->segments==1) {
+		if (prev->bone->segments == 1) {
 			/* find the previous roll to interpolate */
-			if(rest)
+			if (rest)
 				mult_m4_m4m4(difmat, imat, prev->bone->arm_mat);
 			else
 				mult_m4_m4m4(difmat, imat, prev->pose_mat);
-			copy_m3_m4(result, difmat);				// the desired rotation at beginning of next bone
-			
-			vec_roll_to_mat3(h1, 0.0f, mat3);			// the result of vec_roll without roll
-			
+			copy_m3_m4(result, difmat); /* the desired rotation at beginning of next bone */
+
+			vec_roll_to_mat3(h1, 0.0f, mat3); /* the result of vec_roll without roll */
+
 			invert_m3_m3(imat3, mat3);
-			mul_m3_m3m3(mat3, result, imat3);			// the matrix transforming vec_roll to desired roll
-			
-			roll1= (float)atan2(mat3[2][0], mat3[2][2]);
+			mul_m3_m3m3(mat3, result, imat3); /* the matrix transforming vec_roll to desired roll */
+
+			roll1 = (float)atan2(mat3[2][0], mat3[2][2]);
 		}
 	}
 	else {
-		h1[0]= 0.0f; h1[1]= hlength1; h1[2]= 0.0f;
-		roll1= 0.0f;
+		h1[0] = 0.0f; h1[1] = hlength1; h1[2] = 0.0f;
+		roll1 = 0.0f;
 	}
-	if(next) {
+	if (next) {
 		float difmat[4][4], result[3][3], imat3[3][3];
-		
+
 		/* transform next point inside this bone space */
-		if(rest)
+		if (rest)
 			copy_v3_v3(h2, next->bone->arm_tail);
 		else
 			copy_v3_v3(h2, next->pose_tail);
 		mul_m4_v3(imat, h2);
+
 		/* if next bone is B-bone too, use average handle direction */
-		if(next->bone->segments>1);
-		else h2[1]-= length;
+		if (next->bone->segments>1)
+			;
+		else
+			h2[1]-= length;
 		normalize_v3(h2);
-		
+
 		/* find the next roll to interpolate as well */
-		if(rest)
+		if (rest)
 			mult_m4_m4m4(difmat, imat, next->bone->arm_mat);
 		else
 			mult_m4_m4m4(difmat, imat, next->pose_mat);
-		copy_m3_m4(result, difmat);				// the desired rotation at beginning of next bone
-		
-		vec_roll_to_mat3(h2, 0.0f, mat3);			// the result of vec_roll without roll
-		
+		copy_m3_m4(result, difmat); /* the desired rotation at beginning of next bone */
+
+		vec_roll_to_mat3(h2, 0.0f, mat3); /* the result of vec_roll without roll */
+
 		invert_m3_m3(imat3, mat3);
-		mul_m3_m3m3(mat3, imat3, result);			// the matrix transforming vec_roll to desired roll
-		
-		roll2= (float)atan2(mat3[2][0], mat3[2][2]);
-		
+		mul_m3_m3m3(mat3, imat3, result); /* the matrix transforming vec_roll to desired roll */
+
+		roll2 = (float)atan2(mat3[2][0], mat3[2][2]);
+
 		/* and only now negate handle */
 		mul_v3_fl(h2, -hlength2);
 	}
 	else {
-		h2[0]= 0.0f; h2[1]= -hlength2; h2[2]= 0.0f;
-		roll2= 0.0;
+		h2[0] = 0.0f; h2[1] = -hlength2; h2[2] = 0.0f;
+		roll2 = 0.0;
 	}
 
 	/* make curve */
-	if(bone->segments > MAX_BBONE_SUBDIV)
-		bone->segments= MAX_BBONE_SUBDIV;
-	
-	forward_diff_bezier(0.0, h1[0],		h2[0],			0.0,		data[0],	MAX_BBONE_SUBDIV, 4*sizeof(float));
-	forward_diff_bezier(0.0, h1[1],		length + h2[1],	length,		data[0]+1,	MAX_BBONE_SUBDIV, 4*sizeof(float));
-	forward_diff_bezier(0.0, h1[2],		h2[2],			0.0,		data[0]+2,	MAX_BBONE_SUBDIV, 4*sizeof(float));
-	forward_diff_bezier(roll1, roll1 + 0.390464f*(roll2-roll1), roll2 - 0.390464f*(roll2-roll1),	roll2,	data[0]+3,	MAX_BBONE_SUBDIV, 4*sizeof(float));
-	
-	equalize_bezier(data[0], bone->segments);	// note: does stride 4!
-	
+	if (bone->segments > MAX_BBONE_SUBDIV)
+		bone->segments = MAX_BBONE_SUBDIV;
+
+	forward_diff_bezier(0.0,   h1[0],                           h2[0],                           0.0,    data[0],
+	                    MAX_BBONE_SUBDIV, 4*sizeof(float));
+	forward_diff_bezier(0.0,   h1[1],                           length + h2[1],                  length, data[0]+1,
+	                    MAX_BBONE_SUBDIV, 4*sizeof(float));
+	forward_diff_bezier(0.0,   h1[2],                           h2[2],                           0.0,    data[0]+2,
+	                    MAX_BBONE_SUBDIV, 4*sizeof(float));
+	forward_diff_bezier(roll1, roll1 + 0.390464f*(roll2-roll1), roll2 - 0.390464f*(roll2-roll1), roll2,  data[0]+3,
+	                    MAX_BBONE_SUBDIV, 4*sizeof(float));
+
+	equalize_bezier(data[0], bone->segments); /* note: does stride 4! */
+
 	/* make transformation matrices for the segments for drawing */
-	for(a=0, fp= data[0]; a<bone->segments; a++, fp+=4) {
+	for (a = 0, fp = data[0]; a < bone->segments; a++, fp += 4) {
 		sub_v3_v3v3(h1, fp+4, fp);
-		vec_roll_to_mat3(h1, fp[3], mat3);		// fp[3] is roll
+		vec_roll_to_mat3(h1, fp[3], mat3); /* fp[3] is roll */
 
 		copy_m4_m3(result_array[a].mat, mat3);
 		copy_v3_v3(result_array[a].mat[3], fp);
 
-		if(doscale) {
+		if (doscale) {
 			/* correct for scaling when this matrix is used in scaled space */
-			mul_serie_m4(result_array[a].mat, iscalemat, result_array[a].mat,
-				scalemat, NULL, NULL, NULL, NULL, NULL);
+			mul_serie_m4(result_array[a].mat, iscalemat, result_array[a].mat, scalemat, NULL, NULL, NULL, NULL, NULL);
 		}
 	}
-	
+
 	return result_array;
 }
 
 /* ************ Armature Deform ******************* */
 
 typedef struct bPoseChanDeform {
-	Mat4		*b_bone_mats;
-	DualQuat	*dual_quat;
-	DualQuat	*b_bone_dual_quats;
+	Mat4     *b_bone_mats;
+	DualQuat *dual_quat;
+	DualQuat *b_bone_dual_quats;
 } bPoseChanDeform;
 
 static void pchan_b_bone_defmats(bPoseChannel *pchan, bPoseChanDeform *pdef_info, int use_quaternion)
 {
-	Bone *bone= pchan->bone;
-	Mat4 *b_bone= b_bone_spline_setup(pchan, 0);
-	Mat4 *b_bone_rest= b_bone_spline_setup(pchan, 1);
+	Bone *bone = pchan->bone;
+	Mat4 *b_bone = b_bone_spline_setup(pchan, 0);
+	Mat4 *b_bone_rest = b_bone_spline_setup(pchan, 1);
 	Mat4 *b_bone_mats;
-	DualQuat *b_bone_dual_quats= NULL;
-	float tmat[4][4]= MAT4_UNITY;
+	DualQuat *b_bone_dual_quats = NULL;
+	float tmat[4][4] = MAT4_UNITY;
 	int a;
-	
+
 	/* allocate b_bone matrices and dual quats */
-	b_bone_mats= MEM_mallocN((1+bone->segments)*sizeof(Mat4), "BBone defmats");
-	pdef_info->b_bone_mats= b_bone_mats;
+	b_bone_mats = MEM_mallocN((1+bone->segments)*sizeof(Mat4), "BBone defmats");
+	pdef_info->b_bone_mats = b_bone_mats;
 
-	if(use_quaternion) {
-		b_bone_dual_quats= MEM_mallocN((bone->segments)*sizeof(DualQuat), "BBone dqs");
-		pdef_info->b_bone_dual_quats= b_bone_dual_quats;
+	if (use_quaternion) {
+		b_bone_dual_quats = MEM_mallocN((bone->segments)*sizeof(DualQuat), "BBone dqs");
+		pdef_info->b_bone_dual_quats = b_bone_dual_quats;
 	}
-	
+
 	/* first matrix is the inverse arm_mat, to bring points in local bone space
-	   for finding out which segment it belongs to */
+	 * for finding out which segment it belongs to */
 	invert_m4_m4(b_bone_mats[0].mat, bone->arm_mat);
 
 	/* then we make the b_bone_mats:
-		- first transform to local bone space
-		- translate over the curve to the bbone mat space
-		- transform with b_bone matrix
-		- transform back into global space */
+	 * - first transform to local bone space
+	 * - translate over the curve to the bbone mat space
+	 * - transform with b_bone matrix
+	 * - transform back into global space */
 
-	for(a=0; a<bone->segments; a++) {
+	for (a = 0; a < bone->segments; a++) {
 		invert_m4_m4(tmat, b_bone_rest[a].mat);
 
-		mul_serie_m4(b_bone_mats[a+1].mat, pchan->chan_mat, bone->arm_mat,
-			b_bone[a].mat, tmat, b_bone_mats[0].mat, NULL, NULL, NULL);
+		mul_serie_m4(b_bone_mats[a+1].mat, pchan->chan_mat, bone->arm_mat, b_bone[a].mat, tmat, b_bone_mats[0].mat,
+		             NULL, NULL, NULL);
 
-		if(use_quaternion)
-			mat4_to_dquat( &b_bone_dual_quats[a],bone->arm_mat, b_bone_mats[a+1].mat);
+		if (use_quaternion)
+			mat4_to_dquat(&b_bone_dual_quats[a], bone->arm_mat, b_bone_mats[a+1].mat);
 	}
 }
 
-static void b_bone_deform(bPoseChanDeform *pdef_info, Bone *bone, float *co, DualQuat *dq, float defmat[][3])
+static void b_bone_deform(bPoseChanDeform *pdef_info, Bone *bone, float co[3], DualQuat *dq, float defmat[][3])
 {
-	Mat4 *b_bone= pdef_info->b_bone_mats;
-	float (*mat)[4]= b_bone[0].mat;
+	Mat4 *b_bone = pdef_info->b_bone_mats;
+	float (*mat)[4] = b_bone[0].mat;
 	float segment, y;
 	int a;
-	
+
 	/* need to transform co back to bonespace, only need y */
-	y= mat[0][1]*co[0] + mat[1][1]*co[1] + mat[2][1]*co[2] + mat[3][1];
-	
+	y = mat[0][1]*co[0] + mat[1][1]*co[1] + mat[2][1]*co[2] + mat[3][1];
+
 	/* now calculate which of the b_bones are deforming this */
-	segment= bone->length/((float)bone->segments);
-	a= (int)(y/segment);
-	
+	segment = bone->length/((float)bone->segments);
+	a = (int)(y/segment);
+
 	/* note; by clamping it extends deform at endpoints, goes best with
-	   straight joints in restpos. */
+	 * straight joints in restpos. */
 	CLAMP(a, 0, bone->segments-1);
 
-	if(dq) {
+	if (dq) {
 		copy_dq_dq(dq, &(pdef_info->b_bone_dual_quats)[a]);
 	}
 	else {
 		mul_m4_v3(b_bone[a+1].mat, co);
 
-		if(defmat)
+		if (defmat) {
 			copy_m3_m4(defmat, b_bone[a+1].mat);
+		}
 	}
 }
 
 /* using vec with dist to bone b1 - b2 */
 float distfactor_to_bone(const float vec[3], const float b1[3], const float b2[3], float rad1, float rad2, float rdist)
 {
-	float dist=0.0f; 
+	float dist = 0.0f;
 	float bdelta[3];
 	float pdelta[3];
 	float hsqr, a, l, rad;
-	
+
 	sub_v3_v3v3(bdelta, b2, b1);
 	l = normalize_v3(bdelta);
-	
+
 	sub_v3_v3v3(pdelta, vec, b1);
-	
+
 	a = dot_v3v3(bdelta, pdelta);
 	hsqr = dot_v3v3(pdelta, pdelta);
-	
+
 	if (a < 0.0f) {
 		/* If we're past the end of the bone, do a spherical field attenuation thing */
 		dist = len_squared_v3v3(b1, vec);
-		rad= rad1;
+		rad = rad1;
 	}
 	else if (a > l) {
 		/* If we're past the end of the bone, do a spherical field attenuation thing */
@@ -691,22 +699,23 @@ float distfactor_to_bone(const float vec[3], const float b1[3], const float b2[3
 		rad = rad2;
 	}
 	else {
-		dist= (hsqr - (a*a));
-		
-		if(l!=0.0f) {
-			rad= a/l;
-			rad= rad*rad2 + (1.0f-rad)*rad1;
+		dist = (hsqr - (a*a));
+
+		if (l != 0.0f) {
+			rad = a/l;
+			rad = rad*rad2 + (1.0f-rad)*rad1;
 		}
-		else rad= rad1;
+		else
+			rad = rad1;
 	}
-	
-	a= rad*rad;
-	if(dist < a) 
+
+	a = rad*rad;
+	if (dist < a)
 		return 1.0f;
 	else {
-		l= rad+rdist;
-		l*= l;
-		if(rdist==0.0f || dist >= l) 
+		l = rad+rdist;
+		l *= l;
+		if (rdist == 0.0f || dist >= l)
 			return 0.0f;
 		else {
 			a = sqrtf(dist)-rad;
@@ -719,7 +728,7 @@ static void pchan_deform_mat_add(bPoseChannel *pchan, float weight, float bbonem
 {
 	float wmat[3][3];
 
-	if(pchan->bone->segments>1)
+	if (pchan->bone->segments > 1)
 		copy_m3_m3(wmat, bbonemat);
 	else
 		copy_m3_m4(wmat, pchan->chan_mat);
@@ -728,40 +737,41 @@ static void pchan_deform_mat_add(bPoseChannel *pchan, float weight, float bbonem
 	add_m3_m3m3(mat, mat, wmat);
 }
 
-static float dist_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, float *vec, DualQuat *dq, float mat[][3], float *co)
+static float dist_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, float vec[3], DualQuat *dq,
+                              float mat[][3], float *co)
 {
-	Bone *bone= pchan->bone;
-	float fac, contrib=0.0;
+	Bone *bone = pchan->bone;
+	float fac, contrib = 0.0;
 	float cop[3], bbonemat[3][3];
 	DualQuat bbonedq;
 
-	if(bone==NULL) return 0.0f;
-	
+	if (bone == NULL)
+		return 0.0f;
+
 	copy_v3_v3(cop, co);
 
-	fac= distfactor_to_bone(cop, bone->arm_head, bone->arm_tail, bone->rad_head, bone->rad_tail, bone->dist);
-	
+	fac = distfactor_to_bone(cop, bone->arm_head, bone->arm_tail, bone->rad_head, bone->rad_tail, bone->dist);
+
 	if (fac > 0.0f) {
-		
-		fac*=bone->weight;
-		contrib= fac;
-		if(contrib > 0.0f) {
-			if(vec) {
-				if(bone->segments>1)
-					// applies on cop and bbonemat
-					b_bone_deform(pdef_info, bone, cop, NULL, (mat)?bbonemat:NULL);
+		fac *= bone->weight;
+		contrib = fac;
+		if (contrib > 0.0f) {
+			if (vec) {
+				if (bone->segments > 1)
+					/* applies on cop and bbonemat */
+					b_bone_deform(pdef_info, bone, cop, NULL, (mat) ? bbonemat : NULL);
 				else
 					mul_m4_v3(pchan->chan_mat, cop);
 
-				//	Make this a delta from the base position
+				/* Make this a delta from the base position */
 				sub_v3_v3(cop, co);
 				madd_v3_v3fl(vec, cop, fac);
 
-				if(mat)
+				if (mat)
 					pchan_deform_mat_add(pchan, fac, bbonemat, mat);
 			}
 			else {
-				if(bone->segments>1) {
+				if (bone->segments > 1) {
 					b_bone_deform(pdef_info, bone, cop, &bbonedq, NULL);
 					add_weighted_dq_dq(dq, &bbonedq, fac);
 				}
@@ -770,11 +780,12 @@ static float dist_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, f
 			}
 		}
 	}
-	
+
 	return contrib;
 }
 
-static void pchan_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, float weight, float *vec, DualQuat *dq, float mat[][3], float *co, float *contrib)
+static void pchan_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, float weight, float vec[3], DualQuat *dq,
+                              float mat[][3], float *co, float *contrib)
 {
 	float cop[3], bbonemat[3][3];
 	DualQuat bbonedq;
@@ -784,22 +795,22 @@ static void pchan_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, f
 
 	copy_v3_v3(cop, co);
 
-	if(vec) {
-		if(pchan->bone->segments>1)
-			// applies on cop and bbonemat
-			b_bone_deform(pdef_info, pchan->bone, cop, NULL, (mat)?bbonemat:NULL);
+	if (vec) {
+		if (pchan->bone->segments>1)
+			/* applies on cop and bbonemat */
+			b_bone_deform(pdef_info, pchan->bone, cop, NULL, (mat) ? bbonemat : NULL);
 		else
 			mul_m4_v3(pchan->chan_mat, cop);
-		
-		vec[0]+=(cop[0]-co[0])*weight;
-		vec[1]+=(cop[1]-co[1])*weight;
-		vec[2]+=(cop[2]-co[2])*weight;
 
-		if(mat)
+		vec[0] += (cop[0]-co[0])*weight;
+		vec[1] += (cop[1]-co[1])*weight;
+		vec[2] += (cop[2]-co[2])*weight;
+
+		if (mat)
 			pchan_deform_mat_add(pchan, weight, bbonemat, mat);
 	}
 	else {
-		if(pchan->bone->segments>1) {
+		if (pchan->bone->segments > 1) {
 			b_bone_deform(pdef_info, pchan->bone, cop, &bbonedq, NULL);
 			add_weighted_dq_dq(dq, &bbonedq, weight);
 		}
@@ -807,107 +818,105 @@ static void pchan_bone_deform(bPoseChannel *pchan, bPoseChanDeform *pdef_info, f
 			add_weighted_dq_dq(dq, pdef_info->dual_quat, weight);
 	}
 
-	(*contrib)+=weight;
+	(*contrib) += weight;
 }
 
-void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
-						   float (*vertexCos)[3], float (*defMats)[3][3],
-						   int numVerts, int deformflag, 
-						   float (*prevCos)[3], const char *defgrp_name)
+void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm, float (*vertexCos)[3],
+                           float (*defMats)[3][3], int numVerts, int deformflag,
+                           float (*prevCos)[3], const char *defgrp_name)
 {
 	bPoseChanDeform *pdef_info_array;
-	bPoseChanDeform *pdef_info= NULL;
-	bArmature *arm= armOb->data;
+	bPoseChanDeform *pdef_info = NULL;
+	bArmature *arm = armOb->data;
 	bPoseChannel *pchan, **defnrToPC = NULL;
-	int *defnrToPCIndex= NULL;
+	int *defnrToPCIndex = NULL;
 	MDeformVert *dverts = NULL;
 	bDeformGroup *dg;
-	DualQuat *dualquats= NULL;
+	DualQuat *dualquats = NULL;
 	float obinv[4][4], premat[4][4], postmat[4][4];
 	const short use_envelope = deformflag & ARM_DEF_ENVELOPE;
 	const short use_quaternion = deformflag & ARM_DEF_QUATERNION;
-	const short invert_vgroup= deformflag & ARM_DEF_INVERT_VGROUP;
-	int defbase_tot = 0;		/* safety for vertexgroup index overflow */
-	int i, target_totvert = 0;	/* safety for vertexgroup overflow */
+	const short invert_vgroup = deformflag & ARM_DEF_INVERT_VGROUP;
+	int defbase_tot = 0;       /* safety for vertexgroup index overflow */
+	int i, target_totvert = 0; /* safety for vertexgroup overflow */
 	int use_dverts = 0;
 	int armature_def_nr;
 	int totchan;
 
-	if(arm->edbo) return;
-	
+	if (arm->edbo) return;
+
 	invert_m4_m4(obinv, target->obmat);
 	copy_m4_m4(premat, target->obmat);
 	mult_m4_m4m4(postmat, obinv, armOb->obmat);
 	invert_m4_m4(premat, postmat);
 
 	/* bone defmats are already in the channels, chan_mat */
-	
+
 	/* initialize B_bone matrices and dual quaternions */
-	totchan= BLI_countlist(&armOb->pose->chanbase);
+	totchan = BLI_countlist(&armOb->pose->chanbase);
 
-	if(use_quaternion) {
-		dualquats= MEM_callocN(sizeof(DualQuat)*totchan, "dualquats");
+	if (use_quaternion) {
+		dualquats = MEM_callocN(sizeof(DualQuat)*totchan, "dualquats");
 	}
-	
-	pdef_info_array= MEM_callocN(sizeof(bPoseChanDeform)*totchan, "bPoseChanDeform");
 
-	totchan= 0;
-	pdef_info= pdef_info_array;
-	for(pchan= armOb->pose->chanbase.first; pchan; pchan= pchan->next, pdef_info++) {
-		if(!(pchan->bone->flag & BONE_NO_DEFORM)) {
-			if(pchan->bone->segments > 1)
+	pdef_info_array = MEM_callocN(sizeof(bPoseChanDeform)*totchan, "bPoseChanDeform");
+
+	totchan = 0;
+	pdef_info = pdef_info_array;
+	for (pchan = armOb->pose->chanbase.first; pchan; pchan = pchan->next, pdef_info++) {
+		if (!(pchan->bone->flag & BONE_NO_DEFORM)) {
+			if (pchan->bone->segments > 1)
 				pchan_b_bone_defmats(pchan, pdef_info, use_quaternion);
 
-			if(use_quaternion) {
-				pdef_info->dual_quat= &dualquats[totchan++];
-				mat4_to_dquat( pdef_info->dual_quat,pchan->bone->arm_mat, pchan->chan_mat);
+			if (use_quaternion) {
+				pdef_info->dual_quat = &dualquats[totchan++];
+				mat4_to_dquat(pdef_info->dual_quat, pchan->bone->arm_mat, pchan->chan_mat);
 			}
 		}
 	}
 
 	/* get the def_nr for the overall armature vertex group if present */
-	armature_def_nr= defgroup_name_index(target, defgrp_name);
-	
-	if(ELEM(target->type, OB_MESH, OB_LATTICE)) {
+	armature_def_nr = defgroup_name_index(target, defgrp_name);
+
+	if (ELEM(target->type, OB_MESH, OB_LATTICE)) {
 		defbase_tot = BLI_countlist(&target->defbase);
-		
-		if(target->type==OB_MESH) {
-			Mesh *me= target->data;
+
+		if (target->type == OB_MESH) {
+			Mesh *me = target->data;
 			dverts = me->dvert;
-			if(dverts)
+			if (dverts)
 				target_totvert = me->totvert;
 		}
 		else {
-			Lattice *lt= target->data;
+			Lattice *lt = target->data;
 			dverts = lt->dvert;
-			if(dverts)
+			if (dverts)
 				target_totvert = lt->pntsu*lt->pntsv*lt->pntsw;
 		}
 	}
-	
+
 	/* get a vertex-deform-index to posechannel array */
-	if(deformflag & ARM_DEF_VGROUP) {
-		if(ELEM(target->type, OB_MESH, OB_LATTICE)) {
+	if (deformflag & ARM_DEF_VGROUP) {
+		if (ELEM(target->type, OB_MESH, OB_LATTICE)) {
 			/* if we have a DerivedMesh, only use dverts if it has them */
-			if(dm)
-				if(dm->getVertData(dm, 0, CD_MDEFORMVERT))
+			if (dm)
+				if (dm->getVertData(dm, 0, CD_MDEFORMVERT))
 					use_dverts = 1;
 				else use_dverts = 0;
-			else if(dverts) use_dverts = 1;
+			else if (dverts) use_dverts = 1;
 
-			if(use_dverts) {
+			if (use_dverts) {
 				defnrToPC = MEM_callocN(sizeof(*defnrToPC) * defbase_tot, "defnrToBone");
 				defnrToPCIndex = MEM_callocN(sizeof(*defnrToPCIndex) * defbase_tot, "defnrToIndex");
-				for(i = 0, dg = target->defbase.first; dg;
-					i++, dg = dg->next) {
+				for (i = 0, dg = target->defbase.first; dg; i++, dg = dg->next) {
 					defnrToPC[i] = get_pose_channel(armOb->pose, dg->name);
 					/* exclude non-deforming bones */
-					if(defnrToPC[i]) {
-						if(defnrToPC[i]->bone->flag & BONE_NO_DEFORM) {
-							defnrToPC[i]= NULL;
+					if (defnrToPC[i]) {
+						if (defnrToPC[i]->bone->flag & BONE_NO_DEFORM) {
+							defnrToPC[i] = NULL;
 						}
 						else {
-							defnrToPCIndex[i]= BLI_findindex(&armOb->pose->chanbase, defnrToPC[i]);
+							defnrToPCIndex[i] = BLI_findindex(&armOb->pose->chanbase, defnrToPC[i]);
 						}
 					}
 				}
@@ -915,119 +924,117 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
 		}
 	}
 
-	for(i = 0; i < numVerts; i++) {
+	for (i = 0; i < numVerts; i++) {
 		MDeformVert *dvert;
 		DualQuat sumdq, *dq = NULL;
 		float *co, dco[3];
 		float sumvec[3], summat[3][3];
 		float *vec = NULL, (*smat)[3] = NULL;
 		float contrib = 0.0f;
-		float armature_weight = 1.0f;	/* default to 1 if no overall def group */
-		float prevco_weight = 1.0f;		/* weight for optional cached vertexcos */
+		float armature_weight = 1.0f; /* default to 1 if no overall def group */
+		float prevco_weight = 1.0f;   /* weight for optional cached vertexcos */
 
-		if(use_quaternion) {
+		if (use_quaternion) {
 			memset(&sumdq, 0, sizeof(DualQuat));
-			dq= &sumdq;
+			dq = &sumdq;
 		}
 		else {
 			sumvec[0] = sumvec[1] = sumvec[2] = 0.0f;
-			vec= sumvec;
+			vec = sumvec;
 
-			if(defMats) {
+			if (defMats) {
 				zero_m3(summat);
 				smat = summat;
 			}
 		}
 
-		if(use_dverts || armature_def_nr >= 0) {
-			if(dm) dvert = dm->getVertData(dm, i, CD_MDEFORMVERT);
-			else if(dverts && i < target_totvert) dvert = dverts + i;
-			else dvert = NULL;
-		} else
+		if (use_dverts || armature_def_nr >= 0) {
+			if (dm)
+				dvert = dm->getVertData(dm, i, CD_MDEFORMVERT);
+			else if (dverts && i < target_totvert)
+				dvert = dverts + i;
+			else
+				dvert = NULL;
+		}
+		else
 			dvert = NULL;
 
-		if(armature_def_nr >= 0 && dvert) {
-			armature_weight= defvert_find_weight(dvert, armature_def_nr);
+		if (armature_def_nr >= 0 && dvert) {
+			armature_weight = defvert_find_weight(dvert, armature_def_nr);
 
-			if(invert_vgroup) {
-				armature_weight= 1.0f-armature_weight;
-			}
+			if (invert_vgroup)
+				armature_weight = 1.0f-armature_weight;
 
 			/* hackish: the blending factor can be used for blending with prevCos too */
-			if(prevCos) {
-				prevco_weight= armature_weight;
-				armature_weight= 1.0f;
+			if (prevCos) {
+				prevco_weight = armature_weight;
+				armature_weight = 1.0f;
 			}
 		}
 
 		/* check if there's any  point in calculating for this vert */
-		if(armature_weight == 0.0f) continue;
-		
+		if (armature_weight == 0.0f)
+			continue;
+
 		/* get the coord we work on */
-		co= prevCos?prevCos[i]:vertexCos[i];
-		
+		co = prevCos ? prevCos[i] : vertexCos[i];
+
 		/* Apply the object's matrix */
 		mul_m4_v3(premat, co);
-		
-		if(use_dverts && dvert && dvert->totweight) { // use weight groups ?
-			MDeformWeight *dw= dvert->dw;
+
+		if (use_dverts && dvert && dvert->totweight) { /* use weight groups ? */
+			MDeformWeight *dw = dvert->dw;
 			int deformed = 0;
 			unsigned int j;
-			
-			for (j= dvert->totweight; j != 0; j--, dw++) {
+
+			for (j = dvert->totweight; j != 0; j--, dw++) {
 				const int index = dw->def_nr;
-				if(index < defbase_tot && (pchan= defnrToPC[index])) {
+				if (index < defbase_tot && (pchan = defnrToPC[index])) {
 					float weight = dw->weight;
-					Bone *bone= pchan->bone;
-					pdef_info= pdef_info_array + defnrToPCIndex[index];
+					Bone *bone = pchan->bone;
+					pdef_info = pdef_info_array + defnrToPCIndex[index];
 
 					deformed = 1;
-					
-					if(bone && bone->flag & BONE_MULT_VG_ENV) {
-						weight *= distfactor_to_bone(co, bone->arm_head,
-													 bone->arm_tail,
-													 bone->rad_head,
-													 bone->rad_tail,
-													 bone->dist);
+
+					if (bone && bone->flag & BONE_MULT_VG_ENV) {
+						weight *= distfactor_to_bone(co, bone->arm_head, bone->arm_tail,
+						                             bone->rad_head, bone->rad_tail, bone->dist);
 					}
 					pchan_bone_deform(pchan, pdef_info, weight, vec, dq, smat, co, &contrib);
 				}
 			}
 			/* if there are vertexgroups but not groups with bones
-			 * (like for softbody groups)
-			 */
-			if(deformed == 0 && use_envelope) {
-				pdef_info= pdef_info_array;
-				for(pchan= armOb->pose->chanbase.first; pchan;
-					pchan= pchan->next, pdef_info++) {
-					if(!(pchan->bone->flag & BONE_NO_DEFORM))
+			 * (like for softbody groups) */
+			if (deformed == 0 && use_envelope) {
+				pdef_info = pdef_info_array;
+				for (pchan = armOb->pose->chanbase.first; pchan; pchan = pchan->next, pdef_info++) {
+					if (!(pchan->bone->flag & BONE_NO_DEFORM))
 						contrib += dist_bone_deform(pchan, pdef_info, vec, dq, smat, co);
 				}
 			}
 		}
-		else if(use_envelope) {
-			pdef_info= pdef_info_array;
-			for(pchan = armOb->pose->chanbase.first; pchan;
-				pchan = pchan->next, pdef_info++) {
-				if(!(pchan->bone->flag & BONE_NO_DEFORM))
+		else if (use_envelope) {
+			pdef_info = pdef_info_array;
+			for (pchan = armOb->pose->chanbase.first; pchan; pchan = pchan->next, pdef_info++) {
+				if (!(pchan->bone->flag & BONE_NO_DEFORM))
 					contrib += dist_bone_deform(pchan, pdef_info, vec, dq, smat, co);
 			}
 		}
 
 		/* actually should be EPSILON? weight values and contrib can be like 10e-39 small */
-		if(contrib > 0.0001f) {
-			if(use_quaternion) {
+		if (contrib > 0.0001f) {
+			if (use_quaternion) {
 				normalize_dq(dq, contrib);
 
-				if(armature_weight != 1.0f) {
+				if (armature_weight != 1.0f) {
 					copy_v3_v3(dco, co);
-					mul_v3m3_dq( dco, (defMats)? summat: NULL,dq);
+					mul_v3m3_dq( dco, (defMats) ? summat : NULL,dq);
 					sub_v3_v3(dco, co);
 					mul_v3_fl(dco, armature_weight);
 					add_v3_v3(co, dco);
 				}
 				else
-					mul_v3m3_dq( co, (defMats)? summat: NULL,dq);
+					mul_v3m3_dq( co, (defMats) ? summat : NULL,dq);
 
 				smat = summat;
 			}
@@ -1036,47 +1043,46 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
 				add_v3_v3v3(co, vec, co);
 			}
 
-			if(defMats) {
+			if (defMats) {
 				float pre[3][3], post[3][3], tmpmat[3][3];
 
 				copy_m3_m4(pre, premat);
 				copy_m3_m4(post, postmat);
 				copy_m3_m3(tmpmat, defMats[i]);
 
-				if(!use_quaternion) /* quaternion already is scale corrected */
+				if (!use_quaternion) /* quaternion already is scale corrected */
 					mul_m3_fl(smat, armature_weight/contrib);
 
-				mul_serie_m3(defMats[i], tmpmat, pre, smat, post,
-					NULL, NULL, NULL, NULL);
+				mul_serie_m3(defMats[i], tmpmat, pre, smat, post, NULL, NULL, NULL, NULL);
 			}
 		}
-		
+
 		/* always, check above code */
 		mul_m4_v3(postmat, co);
-		
-		
+
 		/* interpolate with previous modifier position using weight group */
-		if(prevCos) {
-			float mw= 1.0f - prevco_weight;
-			vertexCos[i][0]= prevco_weight*vertexCos[i][0] + mw*co[0];
-			vertexCos[i][1]= prevco_weight*vertexCos[i][1] + mw*co[1];
-			vertexCos[i][2]= prevco_weight*vertexCos[i][2] + mw*co[2];
+		if (prevCos) {
+			float mw = 1.0f - prevco_weight;
+			vertexCos[i][0] = prevco_weight*vertexCos[i][0] + mw*co[0];
+			vertexCos[i][1] = prevco_weight*vertexCos[i][1] + mw*co[1];
+			vertexCos[i][2] = prevco_weight*vertexCos[i][2] + mw*co[2];
 		}
 	}
 
-	if(dualquats) MEM_freeN(dualquats);
-	if(defnrToPC) MEM_freeN(defnrToPC);
-	if(defnrToPCIndex) MEM_freeN(defnrToPCIndex);
+	if (dualquats)
+		MEM_freeN(dualquats);
+	if (defnrToPC)
+		MEM_freeN(defnrToPC);
+	if (defnrToPCIndex)
+		MEM_freeN(defnrToPCIndex);
 
 	/* free B_bone matrices */
-	pdef_info= pdef_info_array;
-	for(pchan = armOb->pose->chanbase.first; pchan; pchan = pchan->next, pdef_info++) {
-		if(pdef_info->b_bone_mats) {
+	pdef_info = pdef_info_array;
+	for (pchan = armOb->pose->chanbase.first; pchan; pchan = pchan->next, pdef_info++) {
+		if (pdef_info->b_bone_mats)
 			MEM_freeN(pdef_info->b_bone_mats);
-		}
-		if(pdef_info->b_bone_dual_quats) {
+		if (pdef_info->b_bone_dual_quats)
 			MEM_freeN(pdef_info->b_bone_dual_quats);
-		}
 	}
 
 	MEM_freeN(pdef_info_array);
@@ -1084,7 +1090,8 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
 
 /* ************ END Armature Deform ******************* */
 
-void get_objectspace_bone_matrix (struct Bone* bone, float M_accumulatedMatrix[][4], int UNUSED(root), int UNUSED(posed))
+void get_objectspace_bone_matrix(struct Bone* bone, float M_accumulatedMatrix[][4], int UNUSED(root),
+                                 int UNUSED(posed))
 {
 	copy_m4_m4(M_accumulatedMatrix, bone->arm_mat);
 }
@@ -1092,29 +1099,29 @@ void get_objectspace_bone_matrix (struct Bone* bone, float M_accumulatedMatrix[]
 /* **************** Space to Space API ****************** */
 
 /* Convert World-Space Matrix to Pose-Space Matrix */
-void armature_mat_world_to_pose(Object *ob, float inmat[][4], float outmat[][4]) 
+void armature_mat_world_to_pose(Object *ob, float inmat[][4], float outmat[][4])
 {
 	float obmat[4][4];
-	
+
 	/* prevent crashes */
-	if (ob==NULL) return;
-	
+	if (ob == NULL)
+		return;
+
 	/* get inverse of (armature) object's matrix  */
 	invert_m4_m4(obmat, ob->obmat);
-	
+
 	/* multiply given matrix by object's-inverse to find pose-space matrix */
 	mult_m4_m4m4(outmat, inmat, obmat);
 }
 
-/* Convert Wolrd-Space Location to Pose-Space Location
+/* Convert World-Space Location to Pose-Space Location
  * NOTE: this cannot be used to convert to pose-space location of the supplied
- * 		pose-channel into its local space (i.e. 'visual'-keyframing) 
- */
-void armature_loc_world_to_pose(Object *ob, float *inloc, float *outloc) 
+ *       pose-channel into its local space (i.e. 'visual'-keyframing) */
+void armature_loc_world_to_pose(Object *ob, const float inloc[3], float outloc[3])
 {
-	float xLocMat[4][4]= MAT4_UNITY;
+	float xLocMat[4][4] = MAT4_UNITY;
 	float nLocMat[4][4];
-	
+
 	/* build matrix for location */
 	copy_v3_v3(xLocMat[3], inloc);
 
@@ -1123,6 +1130,24 @@ void armature_loc_world_to_pose(Object *ob, float *inloc, float *outloc)
 	copy_v3_v3(outloc, nLocMat[3]);
 }
 
+/* Simple helper, computes the offset bone matrix.
+ *     offs_bone = yoffs(b-1) + root(b) + bonemat(b).
+ * Not exported, as it is only used in this file currently... */
+static void get_offset_bone_mat(Bone *bone, float offs_bone[][4])
+{
+	if (!bone->parent)
+		return;
+
+	/* Bone transform itself. */
+	copy_m4_m3(offs_bone, bone->bone_mat);
+
+	/* The bone's root offset (is in the parent's coordinate system). */
+	copy_v3_v3(offs_bone[3], bone->head);
+
+	/* Get the length translation of parent (length along y axis). */
+	offs_bone[3][1] += bone->parent->length;
+}
+
 /* Construct the matrices (rot/scale and loc) to apply the PoseChannels into the armature (object) space.
  * I.e. (roughly) the "pose_mat(b-1) * yoffs(b-1) * d_root(b) * bone_mat(b)" in the
  *     pose_mat(b)= pose_mat(b-1) * yoffs(b-1) * d_root(b) * bone_mat(b) * chan_mat(b)
@@ -1146,28 +1171,21 @@ void pchan_to_pose_mat(bPoseChannel *pchan, float rotscale_mat[][4], float loc_m
 	bPoseChannel *parchan;
 
 	/* set up variables for quicker access below */
-	bone= pchan->bone;
-	parbone= bone->parent;
-	parchan= pchan->parent;
-
-	if(parchan) {
-		float offs_bone[4][4]; /* yoffs(b-1) + root(b) + bonemat(b). */
-
-		/* Bone transform itself. */
-		copy_m4_m3(offs_bone, bone->bone_mat);
+	bone = pchan->bone;
+	parbone = bone->parent;
+	parchan = pchan->parent;
 
-		/* The bone's root offset (is in the parent's coordinate system). */
-		copy_v3_v3(offs_bone[3], bone->head);
-
-		/* Get the length translation of parent (length along y axis). */
-		offs_bone[3][1]+= parbone->length;
+	if (parchan) {
+		float offs_bone[4][4];
+		/* yoffs(b-1) + root(b) + bonemat(b). */
+		get_offset_bone_mat(bone, offs_bone);
 
 		/* Compose the rotscale matrix for this bone. */
-		if((bone->flag & BONE_HINGE) && (bone->flag & BONE_NO_SCALE)) {
+		if ((bone->flag & BONE_HINGE) && (bone->flag & BONE_NO_SCALE)) {
 			/* Parent rest rotation and scale. */
 			mult_m4_m4m4(rotscale_mat, parbone->arm_mat, offs_bone);
 		}
-		else if(bone->flag & BONE_HINGE) {
+		else if (bone->flag & BONE_HINGE) {
 			/* Parent rest rotation and pose scale. */
 			float tmat[4][4], tscale[3];
 
@@ -1180,7 +1198,7 @@ void pchan_to_pose_mat(bPoseChannel *pchan, float rotscale_mat[][4], float loc_m
 
 			mult_m4_m4m4(rotscale_mat, tmat, offs_bone);
 		}
-		else if(bone->flag & BONE_NO_SCALE) {
+		else if (bone->flag & BONE_NO_SCALE) {
 			/* Parent pose rotation and rest scale (i.e. no scaling). */
 			float tmat[4][4];
 			copy_m4_m4(tmat, parchan->pose_mat);
@@ -1195,7 +1213,7 @@ void pchan_to_pose_mat(bPoseChannel *pchan, float rotscale_mat[][4], float loc_m
 		/* NOTE: That version deos not modify bone's loc when HINGE/NO_SCALE options are set. */
 
 		/* In this case, use the object's space *orientation*. */
-		if(bone->flag & BONE_NO_LOCAL_LOCATION) {
+		if (bone->flag & BONE_NO_LOCAL_LOCATION) {
 			/* XXX I'm sure that code can be simplified! */
 			float bone_loc[4][4], bone_rotscale[3][3], tmat4[4][4], tmat3[3][3];
 			unit_m4(bone_loc);
@@ -1212,7 +1230,7 @@ void pchan_to_pose_mat(bPoseChannel *pchan, float rotscale_mat[][4], float loc_m
 			mult_m4_m4m4(loc_mat, bone_loc, tmat4);
 		}
 		/* Those flags do not affect position, use plain parent transform space! */
-		else if(bone->flag & (BONE_HINGE|BONE_NO_SCALE)) {
+		else if (bone->flag & (BONE_HINGE|BONE_NO_SCALE)) {
 			mult_m4_m4m4(loc_mat, parchan->pose_mat, offs_bone);
 		}
 		/* Else (i.e. default, usual case), just use the same matrix for rotation/scaling, and location. */
@@ -1224,7 +1242,7 @@ void pchan_to_pose_mat(bPoseChannel *pchan, float rotscale_mat[][4], float loc_m
 		/* NOTE: That version modifies bone's loc when HINGE/NO_SCALE options are set. */
 
 		/* In these cases we need to compute location separately */
-		if(bone->flag & (BONE_HINGE|BONE_NO_SCALE|BONE_NO_LOCAL_LOCATION)) {
+		if (bone->flag & (BONE_HINGE|BONE_NO_SCALE|BONE_NO_LOCAL_LOCATION)) {
 			float bone_loc[4][4], bone_rotscale[3][3], tmat4[4][4], tmat3[3][3];
 			unit_m4(bone_loc);
 			unit_m4(loc_mat);
@@ -1234,16 +1252,16 @@ void pchan_to_pose_mat(bPoseChannel *pchan, float rotscale_mat[][4], float loc_m
 
 			/* "No local location" is not transformed by bone matrix. */
 			/* This only affects orientations (rotations), as scale is always 1.0 here. */
-			if(bone->flag & BONE_NO_LOCAL_LOCATION)
+			if (bone->flag & BONE_NO_LOCAL_LOCATION)
 				unit_m3(bone_rotscale);
 			else
 				/* We could also use bone->bone_mat directly, here... */
 				copy_m3_m4(bone_rotscale, offs_bone);
 
-			if(bone->flag & BONE_HINGE) {
+			if (bone->flag & BONE_HINGE) {
 				copy_m3_m4(tmat3, parbone->arm_mat);
 				/* for hinge-only, we use armature *rotation*, but pose mat *scale*! */
-				if(!(bone->flag & BONE_NO_SCALE)) {
+				if (!(bone->flag & BONE_NO_SCALE)) {
 					float size[3], tsmat[3][3];
 					mat4_to_size(size, parchan->pose_mat);
 					size_to_mat3(tsmat, size);
@@ -1251,7 +1269,7 @@ void pchan_to_pose_mat(bPoseChannel *pchan, float rotscale_mat[][4], float loc_m
 				}
 				mul_m3_m3m3(bone_rotscale, tmat3, bone_rotscale);
 			}
-			else if(bone->flag & BONE_NO_SCALE) {
+			else if (bone->flag & BONE_NO_SCALE) {
 				/* For no-scale only, normalized parent pose mat is enough! */
 				copy_m3_m4(tmat3, parchan->pose_mat);
 				normalize_m3(tmat3);
@@ -1276,7 +1294,7 @@ void pchan_to_pose_mat(bPoseChannel *pchan, float rotscale_mat[][4], float loc_m
 		/* Rotation/scaling. */
 		copy_m4_m4(rotscale_mat, pchan->bone->arm_mat);
 		/* Translation. */
-		if(pchan->bone->flag & BONE_NO_LOCAL_LOCATION) {
+		if (pchan->bone->flag & BONE_NO_LOCAL_LOCATION) {
 			/* Translation of arm_mat, without the rotation. */
 			unit_m4(loc_mat);
 			copy_v3_v3(loc_mat[3], pchan->bone->arm_mat[3]);
@@ -1288,29 +1306,44 @@ void pchan_to_pose_mat(bPoseChannel *pchan, float rotscale_mat[][4], float loc_m
 
 /* Convert Pose-Space Matrix to Bone-Space Matrix.
  * NOTE: this cannot be used to convert to pose-space transforms of the supplied
- *       pose-channel into its local space (i.e. 'visual'-keyframing)
- */
+ *       pose-channel into its local space (i.e. 'visual'-keyframing) */
 void armature_mat_pose_to_bone(bPoseChannel *pchan, float inmat[][4], float outmat[][4])
 {
-	float rotscale_mat[4][4], loc_mat[4][4];
+	float rotscale_mat[4][4], loc_mat[4][4], inmat_[4][4];
+
+	/* Security, this allows to call with inmat == outmat! */
+	copy_m4_m4(inmat_, inmat);
 
 	pchan_to_pose_mat(pchan, rotscale_mat, loc_mat);
 	invert_m4(rotscale_mat);
 	invert_m4(loc_mat);
 
-	mult_m4_m4m4(outmat, rotscale_mat, inmat);
-	mul_v3_m4v3(outmat[3], loc_mat, inmat[3]);
+	mult_m4_m4m4(outmat, rotscale_mat, inmat_);
+	mul_v3_m4v3(outmat[3], loc_mat, inmat_[3]);
+}
+
+/* Convert Bone-Space Matrix to Pose-Space Matrix. */
+void armature_mat_bone_to_pose(bPoseChannel *pchan, float inmat[][4], float outmat[][4])
+{
+	float rotscale_mat[4][4], loc_mat[4][4], inmat_[4][4];
+
+	/* Security, this allows to call with inmat == outmat! */
+	copy_m4_m4(inmat_, inmat);
+
+	pchan_to_pose_mat(pchan, rotscale_mat, loc_mat);
+
+	mult_m4_m4m4(outmat, rotscale_mat, inmat_);
+	mul_v3_m4v3(outmat[3], loc_mat, inmat_[3]);
 }
 
 /* Convert Pose-Space Location to Bone-Space Location
  * NOTE: this cannot be used to convert to pose-space location of the supplied
- * 		pose-channel into its local space (i.e. 'visual'-keyframing) 
- */
-void armature_loc_pose_to_bone(bPoseChannel *pchan, float *inloc, float *outloc) 
+ *       pose-channel into its local space (i.e. 'visual'-keyframing) */
+void armature_loc_pose_to_bone(bPoseChannel *pchan, const float inloc[3], float outloc[3])
 {
-	float xLocMat[4][4]= MAT4_UNITY;
+	float xLocMat[4][4] = MAT4_UNITY;
 	float nLocMat[4][4];
-	
+
 	/* build matrix for location */
 	copy_v3_v3(xLocMat[3], inloc);
 
@@ -1340,21 +1373,22 @@ void armature_mat_pose_to_bone_ex(Object *ob, bPoseChannel *pchan, float inmat[]
 void pchan_mat3_to_rot(bPoseChannel *pchan, float mat[][3], short use_compat)
 {
 	switch(pchan->rotmode) {
-	case ROT_MODE_QUAT:
-		mat3_to_quat(pchan->quat, mat);
-		break;
-	case ROT_MODE_AXISANGLE:
-		mat3_to_axis_angle(pchan->rotAxis, &pchan->rotAngle, mat);
-		break;
-	default: /* euler */
-		if(use_compat)	mat3_to_compatible_eulO(pchan->eul, pchan->eul, pchan->rotmode, mat);
-		else			mat3_to_eulO(pchan->eul, pchan->rotmode, mat);
+		case ROT_MODE_QUAT:
+			mat3_to_quat(pchan->quat, mat);
+			break;
+		case ROT_MODE_AXISANGLE:
+			mat3_to_axis_angle(pchan->rotAxis, &pchan->rotAngle, mat);
+			break;
+		default: /* euler */
+			if (use_compat)
+				mat3_to_compatible_eulO(pchan->eul, pchan->eul, pchan->rotmode, mat);
+			else
+				mat3_to_eulO(pchan->eul, pchan->rotmode, mat);
 	}
 }
 
 /* Apply a 4x4 matrix to the pose bone,
- * similar to object_apply_mat4()
- */
+ * similar to object_apply_mat4() */
 void pchan_apply_mat4(bPoseChannel *pchan, float mat[][4], short use_compat)
 {
 	float rot[3][3];
@@ -1364,12 +1398,11 @@ void pchan_apply_mat4(bPoseChannel *pchan, float mat[][4], short use_compat)
 
 /* Remove rest-position effects from pose-transform for obtaining
  * 'visual' transformation of pose-channel.
- * (used by the Visual-Keyframing stuff)
- */
+ * (used by the Visual-Keyframing stuff) */
 void armature_mat_pose_to_delta(float delta_mat[][4], float pose_mat[][4], float arm_mat[][4])
 {
 	float imat[4][4];
-	
+
 	invert_m4_m4(imat, arm_mat);
 	mult_m4_m4m4(delta_mat, imat, pose_mat);
 }
@@ -1377,10 +1410,9 @@ void armature_mat_pose_to_delta(float delta_mat[][4], float pose_mat[][4], float
 /* **************** Rotation Mode Conversions ****************************** */
 /* Used for Objects and Pose Channels, since both can have multiple rotation representations */
 
-/* Called from RNA when rotation mode changes 
- *	- the result should be that the rotations given in the provided pointers have had conversions 
- *	  applied (as appropriate), such that the rotation of the element hasn't 'visually' changed 
- */
+/* Called from RNA when rotation mode changes
+ * - the result should be that the rotations given in the provided pointers have had conversions
+ *   applied (as appropriate), such that the rotation of the element hasn't 'visually' changed  */
 void BKE_rotMode_change_values (float quat[4], float eul[3], float axis[3], float *angle, short oldMode, short newMode)
 {
 	/* check if any change - if so, need to convert data */
@@ -1392,7 +1424,7 @@ void BKE_rotMode_change_values (float quat[4], float eul[3], float axis[3], floa
 		else if (oldMode == ROT_MODE_QUAT) {
 			/* quat to euler */
 			normalize_qt(quat);
-			quat_to_eulO( eul, newMode,quat);
+			quat_to_eulO(eul, newMode,quat);
 		}
 		/* else { no conversion needed } */
 	}
@@ -1403,51 +1435,51 @@ void BKE_rotMode_change_values (float quat[4], float eul[3], float axis[3], floa
 		}
 		else if (oldMode > 0) {
 			/* euler to quat */
-			eulO_to_quat( quat,eul, oldMode);
+			eulO_to_quat(quat, eul, oldMode);
 		}
 		/* else { no conversion needed } */
 	}
 	else if (newMode == ROT_MODE_AXISANGLE) { /* to axis-angle */
 		if (oldMode > 0) {
 			/* euler to axis angle */
-			eulO_to_axis_angle( axis, angle,eul, oldMode);
+			eulO_to_axis_angle(axis, angle, eul, oldMode);
 		}
 		else if (oldMode == ROT_MODE_QUAT) {
 			/* quat to axis angle */
 			normalize_qt(quat);
-			quat_to_axis_angle( axis, angle,quat);
+			quat_to_axis_angle(axis, angle, quat);
 		}
-		
+
 		/* when converting to axis-angle, we need a special exception for the case when there is no axis */
 		if (IS_EQF(axis[0], axis[1]) && IS_EQF(axis[1], axis[2])) {
 			/* for now, rotate around y-axis then (so that it simply becomes the roll) */
-			axis[1]= 1.0f;
+			axis[1] = 1.0f;
 		}
 	}
 }
 
-/* **************** The new & simple (but OK!) armature evaluation ********* */ 
-
-/*  ****************** And how it works! ****************************************
-
-  This is the bone transformation trick; they're hierarchical so each bone(b)
-  is in the coord system of bone(b-1):
-
-  arm_mat(b)= arm_mat(b-1) * yoffs(b-1) * d_root(b) * bone_mat(b) 
-  
-  -> yoffs is just the y axis translation in parent's coord system
-  -> d_root is the translation of the bone root, also in parent's coord system
-
-  pose_mat(b)= pose_mat(b-1) * yoffs(b-1) * d_root(b) * bone_mat(b) * chan_mat(b)
-
-  we then - in init deform - store the deform in chan_mat, such that:
+/* **************** The new & simple (but OK!) armature evaluation ********* */
 
-  pose_mat(b)= arm_mat(b) * chan_mat(b)
-  
-  *************************************************************************** */
-/*  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, float *roll) 
+/* ****************** And how it works! ****************************************
+ *
+ * This is the bone transformation trick; they're hierarchical so each bone(b)
+ * is in the coord system of bone(b-1):
+ *
+ * arm_mat(b)= arm_mat(b-1) * yoffs(b-1) * d_root(b) * bone_mat(b)
+ *
+ * -> yoffs is just the y axis translation in parent's coord system
+ * -> d_root is the translation of the bone root, also in parent's coord system
+ *
+ * pose_mat(b)= pose_mat(b-1) * yoffs(b-1) * d_root(b) * bone_mat(b) * chan_mat(b)
+ *
+ * we then - in init deform - store the deform in chan_mat, such that:
+ *
+ * pose_mat(b)= arm_mat(b) * chan_mat(b)
+ *
+ * *************************************************************************** */
+/* 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)
 {
 	if (vec)
 		copy_v3_v3(vec, mat[1]);
@@ -1459,55 +1491,58 @@ void mat3_to_vec_roll(float mat[][3], float *vec, float *roll)
 		invert_m3_m3(vecmatinv, vecmat);
 		mul_m3_m3m3(rollmat, vecmatinv, mat);
 
-		*roll= (float)atan2(rollmat[2][0], rollmat[2][2]);
+		*roll = (float)atan2(rollmat[2][0], rollmat[2][2]);
 	}
 }
 
-/*	Calculates the rest matrix of a bone based
-	On its vector and a roll around that vector */
-void vec_roll_to_mat3(float *vec, float roll, float mat[][3])
+/* Calculates the rest matrix of a bone based
+ * On its vector and a roll around that vector */
+void vec_roll_to_mat3(const float vec[3], const float roll, float mat[][3])
 {
-	float	nor[3], axis[3], target[3]={0,1,0};
-	float	theta;
-	float	rMatrix[3][3], bMatrix[3][3];
+	float nor[3], axis[3], target[3] = {0, 1, 0};
+	float theta;
+	float rMatrix[3][3], bMatrix[3][3];
 
 	normalize_v3_v3(nor, vec);
-	
-	/*	Find Axis & Amount for bone matrix*/
-	cross_v3_v3v3(axis,target,nor);
+
+	/* Find Axis & Amount for bone matrix */
+	cross_v3_v3v3(axis, target, nor);
 
 	/* was 0.0000000000001, caused bug [#23954], smaller values give unstable
 	 * roll when toggling editmode.
 	 *
 	 * was 0.00001, causes bug [#27675], with 0.00000495,
 	 * 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]...
 	 */
-	if (dot_v3v3(axis,axis) > 0.000001f) {
+	if (dot_v3v3(axis,axis) > 1.0e-13f) {
 		/* if nor is *not* a multiple of target ... */
 		normalize_v3(axis);
-		
-		theta= angle_normalized_v3v3(target, nor);
-		
-		/*	Make Bone matrix*/
-		vec_rot_to_mat3( bMatrix,axis, theta);
+
+		theta = angle_normalized_v3v3(target, nor);
+
+		/* Make Bone matrix*/
+		vec_rot_to_mat3(bMatrix, axis, theta);
 	}
 	else {
 		/* if nor is a multiple of target ... */
 		float updown;
-		
+
 		/* point same direction, or opposite? */
-		updown = ( dot_v3v3(target,nor) > 0 ) ? 1.0f : -1.0f;
-		
-		/* I think this should work ... */
-		bMatrix[0][0]=updown; bMatrix[0][1]=0.0;    bMatrix[0][2]=0.0;
-		bMatrix[1][0]=0.0;    bMatrix[1][1]=updown; bMatrix[1][2]=0.0;
-		bMatrix[2][0]=0.0;    bMatrix[2][1]=0.0;    bMatrix[2][2]=1.0;
-	}
-	
-	/*	Make Roll matrix*/
-	vec_rot_to_mat3( rMatrix,nor, roll);
-	
-	/*	Combine and output result*/
+		updown = (dot_v3v3(target,nor) > 0) ? 1.0f : -1.0f;
+
+		/* I think this should work... */
+		bMatrix[0][0] = updown; bMatrix[0][1] = 0.0;    bMatrix[0][2] = 0.0;
+		bMatrix[1][0] = 0.0;    bMatrix[1][1] = updown; bMatrix[1][2] = 0.0;
+		bMatrix[2][0] = 0.0;    bMatrix[2][1] = 0.0;    bMatrix[2][2] = 1.0;
+	}
+
+	/* Make Roll matrix */
+	vec_rot_to_mat3(rMatrix, nor, roll);
+
+	/* Combine and output result */
 	mul_m3_m3m3(mat, rMatrix, bMatrix);
 }
 
@@ -1517,32 +1552,25 @@ void vec_roll_to_mat3(float *vec, float roll, float mat[][3])
 void where_is_armature_bone(Bone *bone, Bone *prevbone)
 {
 	float vec[3];
-	
+
 	/* Bone Space */
 	sub_v3_v3v3(vec, bone->tail, bone->head);
 	vec_roll_to_mat3(vec, bone->roll, bone->bone_mat);
 
-	bone->length= len_v3v3(bone->head, bone->tail);
-	
+	bone->length = len_v3v3(bone->head, bone->tail);
+
 	/* this is called on old file reading too... */
-	if(bone->xwidth==0.0f) {
-		bone->xwidth= 0.1f;
-		bone->zwidth= 0.1f;
-		bone->segments= 1;
-	}
-	
-	if(prevbone) {
-		float offs_bone[4][4];  // yoffs(b-1) + root(b) + bonemat(b)
-		
-		/* bone transform itself */
-		copy_m4_m3(offs_bone, bone->bone_mat);
-				
-		/* The bone's root offset (is in the parent's coordinate system) */
-		copy_v3_v3(offs_bone[3], bone->head);
-
-		/* Get the length translation of parent (length along y axis) */
-		offs_bone[3][1]+= prevbone->length;
-		
+	if (bone->xwidth == 0.0f) {
+		bone->xwidth = 0.1f;
+		bone->zwidth = 0.1f;
+		bone->segments = 1;
+	}
+
+	if (prevbone) {
+		float offs_bone[4][4];
+		/* yoffs(b-1) + root(b) + bonemat(b) */
+		get_offset_bone_mat(bone, offs_bone);
+
 		/* Compose the matrix for this bone  */
 		mult_m4_m4m4(bone->arm_mat, prevbone->arm_mat, offs_bone);
 	}
@@ -1550,22 +1578,22 @@ void where_is_armature_bone(Bone *bone, Bone *prevbone)
 		copy_m4_m3(bone->arm_mat, bone->bone_mat);
 		copy_v3_v3(bone->arm_mat[3], bone->head);
 	}
-	
+
 	/* and the kiddies */
-	prevbone= bone;
-	for(bone= bone->childbase.first; bone; bone= bone->next) {
+	prevbone = bone;
+	for (bone = bone->childbase.first; bone; bone = bone->next) {
 		where_is_armature_bone(bone, prevbone);
 	}
 }
 
-/* updates vectors and matrices on rest-position level, only needed 
-   after editing armature itself, now only on reading file */
-void where_is_armature (bArmature *arm)
+/* updates vectors and matrices on rest-position level, only needed
+ * after editing armature itself, now only on reading file */
+void where_is_armature(bArmature *arm)
 {
 	Bone *bone;
-	
+
 	/* hierarchical from root to children */
-	for(bone= arm->bonebase.first; bone; bone= bone->next) {
+	for (bone = arm->bonebase.first; bone; bone = bone->next) {
 		where_is_armature_bone(bone, NULL);
 	}
 }
@@ -1574,115 +1602,117 @@ void where_is_armature (bArmature *arm)
  * when used with linked libraries this copies from the linked pose into the local pose */
 static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected)
 {
-	bPose *pose= ob->pose, *frompose= from->pose;
+	bPose *pose = ob->pose, *frompose = from->pose;
 	bPoseChannel *pchan, *pchanp, pchanw;
 	bConstraint *con;
 	int error = 0;
-	
-	if (frompose==NULL) return;
+
+	if (frompose == NULL)
+		return;
 
 	/* in some cases when rigs change, we cant synchronize
 	 * to avoid crashing check for possible errors here */
-	for (pchan= pose->chanbase.first; pchan; pchan= pchan->next) {
+	for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
 		if (pchan->bone->layer & layer_protected) {
-			if(get_pose_channel(frompose, pchan->name) == NULL) {
-				printf("failed to sync proxy armature because '%s' is missing pose channel '%s'\n", from->id.name, pchan->name);
+			if (get_pose_channel(frompose, pchan->name) == NULL) {
+				printf("failed to sync proxy armature because '%s' is missing pose channel '%s'\n",
+				       from->id.name, pchan->name);
 				error = 1;
 			}
 		}
 	}
 
-	if(error)
+	if (error)
 		return;
-	
+
 	/* clear all transformation values from library */
 	rest_pose(frompose);
-	
+
 	/* copy over all of the proxy's bone groups */
-		/* TODO for later - implement 'local' bone groups as for constraints
-		 *	Note: this isn't trivial, as bones reference groups by index not by pointer, 
-		 *		 so syncing things correctly needs careful attention
-		 */
+		/* TODO for later
+		 * - implement 'local' bone groups as for constraints
+		 * Note: this isn't trivial, as bones reference groups by index not by pointer,
+		 *       so syncing things correctly needs careful attention */
 	BLI_freelistN(&pose->agroups);
 	BLI_duplicatelist(&pose->agroups, &frompose->agroups);
-	pose->active_group= frompose->active_group;
-	
-	for (pchan= pose->chanbase.first; pchan; pchan= pchan->next) {
-		pchanp= get_pose_channel(frompose, pchan->name);
+	pose->active_group = frompose->active_group;
+
+	for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
+		pchanp = get_pose_channel(frompose, pchan->name);
 
 		if (pchan->bone->layer & layer_protected) {
 			ListBase proxylocal_constraints = {NULL, NULL};
-			
+
 			/* copy posechannel to temp, but restore important pointers */
-			pchanw= *pchanp;
-			pchanw.prev= pchan->prev;
-			pchanw.next= pchan->next;
-			pchanw.parent= pchan->parent;
-			pchanw.child= pchan->child;
-			
+			pchanw = *pchanp;
+			pchanw.prev = pchan->prev;
+			pchanw.next = pchan->next;
+			pchanw.parent = pchan->parent;
+			pchanw.child = pchan->child;
+
 			/* this is freed so copy a copy, else undo crashes */
-			if(pchanw.prop) {
-				pchanw.prop= IDP_CopyProperty(pchanw.prop);
+			if (pchanw.prop) {
+				pchanw.prop = IDP_CopyProperty(pchanw.prop);
 
 				/* use the values from the the existing props */
-				if(pchan->prop) {
+				if (pchan->prop) {
 					IDP_SyncGroupValues(pchanw.prop, pchan->prop);
 				}
 			}
 
-			/* constraints - proxy constraints are flushed... local ones are added after 
-			 *	1. extract constraints not from proxy (CONSTRAINT_PROXY_LOCAL) from pchan's constraints
-			 *	2. copy proxy-pchan's constraints on-to new
-			 *	3. add extracted local constraints back on top 
+			/* constraints - proxy constraints are flushed... local ones are added after
+			 *     1. extract constraints not from proxy (CONSTRAINT_PROXY_LOCAL) from pchan's constraints
+			 *     2. copy proxy-pchan's constraints on-to new
+			 *     3. add extracted local constraints back on top
 			 *
-			 *  note for copy_constraints: when copying constraints, disable 'do_extern' otherwise we get the libs direct linked in this blend.
-			 */
+			 * Note for copy_constraints: when copying constraints, disable 'do_extern' otherwise
+			 *                            we get the libs direct linked in this blend. */
 			extract_proxylocal_constraints(&proxylocal_constraints, &pchan->constraints);
 			copy_constraints(&pchanw.constraints, &pchanp->constraints, FALSE);
 			BLI_movelisttolist(&pchanw.constraints, &proxylocal_constraints);
-			
+
 			/* constraints - set target ob pointer to own object */
-			for (con= pchanw.constraints.first; con; con= con->next) {
-				bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
+			for (con = pchanw.constraints.first; con; con = con->next) {
+				bConstraintTypeInfo *cti = constraint_get_typeinfo(con);
 				ListBase targets = {NULL, NULL};
 				bConstraintTarget *ct;
-				
+
 				if (cti && cti->get_constraint_targets) {
 					cti->get_constraint_targets(con, &targets);
-					
-					for (ct= targets.first; ct; ct= ct->next) {
+
+					for (ct = targets.first; ct; ct = ct->next) {
 						if (ct->tar == from)
 							ct->tar = ob;
 					}
-					
+
 					if (cti->flush_constraint_targets)
 						cti->flush_constraint_targets(con, &targets, 0);
 				}
 			}
-			
+
 			/* free stuff from current channel */
 			free_pose_channel(pchan);
-			
+
 			/* the final copy */
-			*pchan= pchanw;
+			*pchan = pchanw;
 		}
 		else {
 			/* always copy custom shape */
-			pchan->custom= pchanp->custom;
-			pchan->custom_tx= pchanp->custom_tx;
+			pchan->custom = pchanp->custom;
+			pchan->custom_tx = pchanp->custom_tx;
 
 			/* ID-Property Syncing */
 			{
-				IDProperty *prop_orig= pchan->prop;
-				if(pchanp->prop) {
-					pchan->prop= IDP_CopyProperty(pchanp->prop);
-					if(prop_orig) {
+				IDProperty *prop_orig = pchan->prop;
+				if (pchanp->prop) {
+					pchan->prop = IDP_CopyProperty(pchanp->prop);
+					if (prop_orig) {
 						/* copy existing values across when types match */
 						IDP_SyncGroupValues(pchan->prop, prop_orig);
 					}
 				}
 				else {
-					pchan->prop= NULL;
+					pchan->prop = NULL;
 				}
 				if (prop_orig) {
 					IDP_FreeProperty(prop_orig);
@@ -1695,20 +1725,20 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected
 
 static int rebuild_pose_bone(bPose *pose, Bone *bone, bPoseChannel *parchan, int counter)
 {
-	bPoseChannel *pchan = verify_pose_channel (pose, bone->name);   // verify checks and/or adds
+	bPoseChannel *pchan = verify_pose_channel(pose, bone->name); /* verify checks and/or adds */
+
+	pchan->bone = bone;
+	pchan->parent = parchan;
 
-	pchan->bone= bone;
-	pchan->parent= parchan;
-	
 	counter++;
-	
-	for(bone= bone->childbase.first; bone; bone= bone->next) {
-		counter= rebuild_pose_bone(pose, bone, pchan, counter);
+
+	for (bone = bone->childbase.first; bone; bone = bone->next) {
+		counter = rebuild_pose_bone(pose, bone, pchan, counter);
 		/* for quick detecting of next bone in chain, only b-bone uses it now */
-		if(bone->flag & BONE_CONNECTED)
-			pchan->child= get_pose_channel(pose, bone->name);
+		if (bone->flag & BONE_CONNECTED)
+			pchan->child = get_pose_channel(pose, bone->name);
 	}
-	
+
 	return counter;
 }
 
@@ -1719,52 +1749,52 @@ void armature_rebuild_pose(Object *ob, bArmature *arm)
 	Bone *bone;
 	bPose *pose;
 	bPoseChannel *pchan, *next;
-	int counter=0;
-		
+	int counter = 0;
+
 	/* only done here */
-	if(ob->pose==NULL) {
+	if (ob->pose == NULL) {
 		/* create new pose */
-		ob->pose= MEM_callocN(sizeof(bPose), "new pose");
-		
+		ob->pose = MEM_callocN(sizeof(bPose), "new pose");
+
 		/* set default settings for animviz */
 		animviz_settings_init(&ob->pose->avs);
 	}
-	pose= ob->pose;
-	
+	pose = ob->pose;
+
 	/* clear */
-	for(pchan= pose->chanbase.first; pchan; pchan= pchan->next) {
-		pchan->bone= NULL;
-		pchan->child= NULL;
+	for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
+		pchan->bone = NULL;
+		pchan->child = NULL;
 	}
-	
+
 	/* first step, check if all channels are there */
-	for(bone= arm->bonebase.first; bone; bone= bone->next) {
-		counter= rebuild_pose_bone(pose, bone, NULL, counter);
+	for (bone = arm->bonebase.first; bone; bone = bone->next) {
+		counter = rebuild_pose_bone(pose, bone, NULL, counter);
 	}
 
 	/* and a check for garbage */
-	for(pchan= pose->chanbase.first; pchan; pchan= next) {
-		next= pchan->next;
-		if(pchan->bone==NULL) {
+	for (pchan = pose->chanbase.first; pchan; pchan = next) {
+		next = pchan->next;
+		if (pchan->bone == NULL) {
 			free_pose_channel(pchan);
 			free_pose_channels_hash(pose);
 			BLI_freelinkN(&pose->chanbase, pchan);
 		}
 	}
-	// printf("rebuild pose %s, %d bones\n", ob->id.name, counter);
-	
+	/* printf("rebuild pose %s, %d bones\n", ob->id.name, counter); */
+
 	/* synchronize protected layers with proxy */
-	if(ob->proxy) {
+	if (ob->proxy) {
 		object_copy_proxy_drivers(ob, ob->proxy);
 		pose_proxy_synchronize(ob, ob->proxy, arm->layer_protected);
 	}
-	
-	update_pose_constraint_flags(ob->pose); // for IK detection for example
-	
+
+	update_pose_constraint_flags(ob->pose); /* for IK detection for example */
+
 	/* the sorting */
-	if(counter>1)
+	if (counter>1)
 		DAG_pose_sort(ob);
-	
+
 	ob->pose->flag &= ~POSE_RECALC;
 	ob->pose->flag |= POSE_WAS_REBUILT;
 
@@ -1777,19 +1807,19 @@ void armature_rebuild_pose(Object *ob, bArmature *arm)
 /* Temporary evaluation tree data used for Spline IK */
 typedef struct tSplineIK_Tree {
 	struct tSplineIK_Tree *next, *prev;
-	
-	int 	type;					/* type of IK that this serves (CONSTRAINT_TYPE_KINEMATIC or ..._SPLINEIK) */
-	
-	short free_points;				/* free the point positions array */
-	short chainlen;					/* number of bones in the chain */
-	
-	float *points;					/* parametric positions for the joints along the curve */
-	bPoseChannel **chain;			/* chain of bones to affect using Spline IK (ordered from the tip) */
-	
-	bPoseChannel *root;				/* bone that is the root node of the chain */
-	
-	bConstraint *con;				/* constraint for this chain */
-	bSplineIKConstraint *ikData;	/* constraint settings for this chain */
+
+	int type;                    /* type of IK that this serves (CONSTRAINT_TYPE_KINEMATIC or ..._SPLINEIK) */
+
+	short free_points;           /* free the point positions array */
+	short chainlen;              /* number of bones in the chain */
+
+	float *points;               /* parametric positions for the joints along the curve */
+	bPoseChannel **chain;        /* chain of bones to affect using Spline IK (ordered from the tip) */
+
+	bPoseChannel *root;          /* bone that is the root node of the chain */
+
+	bConstraint *con;            /* constraint for this chain */
+	bSplineIKConstraint *ikData; /* constraint settings for this chain */
 } tSplineIK_Tree;
 
 /* ----------- */
@@ -1797,7 +1827,7 @@ typedef struct tSplineIK_Tree {
 /* Tag the bones in the chain formed by the given bone for IK */
 static void splineik_init_tree_from_pchan(Scene *scene, Object *UNUSED(ob), bPoseChannel *pchan_tip)
 {
-	bPoseChannel *pchan, *pchanRoot=NULL;
+	bPoseChannel *pchan, *pchanRoot = NULL;
 	bPoseChannel *pchanChain[255];
 	bConstraint *con = NULL;
 	bSplineIKConstraint *ikData = NULL;
@@ -1805,157 +1835,156 @@ static void splineik_init_tree_from_pchan(Scene *scene, Object *UNUSED(ob), bPos
 	float totLength = 0.0f;
 	short free_joints = 0;
 	int segcount = 0;
-	
+
 	/* find the SplineIK constraint */
-	for (con= pchan_tip->constraints.first; con; con= con->next) {
+	for (con = pchan_tip->constraints.first; con; con = con->next) {
 		if (con->type == CONSTRAINT_TYPE_SPLINEIK) {
-			ikData= con->data;
-			
+			ikData = con->data;
+
 			/* target can only be curve */
-			if ((ikData->tar == NULL) || (ikData->tar->type != OB_CURVE))  
+			if ((ikData->tar == NULL) || (ikData->tar->type != OB_CURVE))
 				continue;
 			/* skip if disabled */
-			if ( (con->enforce == 0.0f) || (con->flag & (CONSTRAINT_DISABLE|CONSTRAINT_OFF)) )
+			if ((con->enforce == 0.0f) || (con->flag & (CONSTRAINT_DISABLE|CONSTRAINT_OFF)))
 				continue;
-			
+
 			/* otherwise, constraint is ok... */
 			break;
 		}
 	}
 	if (con == NULL)
 		return;
-		
-	/* make sure that the constraint targets are ok 
-	 *	- this is a workaround for a depsgraph bug...
+
+	/* make sure that the constraint targets are ok
+	 *     - this is a workaround for a depsgraph bug...
 	 */
 	if (ikData->tar) {
-		Curve *cu= ikData->tar->data;
-		
+		Curve *cu = ikData->tar->data;
+
 		/* note: when creating constraints that follow path, the curve gets the CU_PATH set now,
-		 *		currently for paths to work it needs to go through the bevlist/displist system (ton) 
+		 *       currently for paths to work it needs to go through the bevlist/displist system (ton)
 		 */
-		
+
 		/* only happens on reload file, but violates depsgraph still... fix! */
-		if ((cu->path==NULL) || (cu->path->data==NULL))
+		if ((cu->path == NULL) || (cu->path->data == NULL))
 			makeDispListCurveTypes(scene, ikData->tar, 0);
 	}
-	
-	/* find the root bone and the chain of bones from the root to the tip 
-	 * NOTE: this assumes that the bones are connected, but that may not be true...
-	 */
-	for (pchan= pchan_tip; pchan && (segcount < ikData->chainlen); pchan= pchan->parent, segcount++) {
+
+	/* find the root bone and the chain of bones from the root to the tip
+	 * NOTE: this assumes that the bones are connected, but that may not be true... */
+	for (pchan = pchan_tip; pchan && (segcount < ikData->chainlen); pchan = pchan->parent, segcount++) {
 		/* store this segment in the chain */
-		pchanChain[segcount]= pchan;
-		
+		pchanChain[segcount] = pchan;
+
 		/* if performing rebinding, calculate the length of the bone */
-		boneLengths[segcount]= pchan->bone->length;
+		boneLengths[segcount] = pchan->bone->length;
 		totLength += boneLengths[segcount];
 	}
-	
+
 	if (segcount == 0)
 		return;
 	else
-		pchanRoot= pchanChain[segcount-1];
-	
+		pchanRoot = pchanChain[segcount-1];
+
 	/* perform binding step if required */
 	if ((ikData->flag & CONSTRAINT_SPLINEIK_BOUND) == 0) {
-		float segmentLen= (1.0f / (float)segcount);
+		float segmentLen = (1.0f / (float)segcount);
 		int i;
-		
+
 		/* setup new empty array for the points list */
-		if (ikData->points) 
+		if (ikData->points)
 			MEM_freeN(ikData->points);
-		ikData->numpoints= ikData->chainlen+1; 
-		ikData->points= MEM_callocN(sizeof(float)*ikData->numpoints, "Spline IK Binding");
-		
+		ikData->numpoints = ikData->chainlen+1;
+		ikData->points = MEM_callocN(sizeof(float)*ikData->numpoints, "Spline IK Binding");
+
 		/* bind 'tip' of chain (i.e. first joint = tip of bone with the Spline IK Constraint) */
 		ikData->points[0] = 1.0f;
-		
-		/* perform binding of the joints to parametric positions along the curve based 
+
+		/* perform binding of the joints to parametric positions along the curve based
 		 * proportion of the total length that each bone occupies
 		 */
 		for (i = 0; i < segcount; i++) {
-			/* 'head' joints, travelling towards the root of the chain
-			 * 	- 2 methods; the one chosen depends on whether we've got usable lengths
+			/* 'head' joints, traveling towards the root of the chain
+			 *  - 2 methods; the one chosen depends on whether we've got usable lengths
 			 */
 			if ((ikData->flag & CONSTRAINT_SPLINEIK_EVENSPLITS) || (totLength == 0.0f)) {
 				/* 1) equi-spaced joints */
-				ikData->points[i+1]= ikData->points[i] - segmentLen;
+				ikData->points[i+1] = ikData->points[i] - segmentLen;
 			}
 			else {
-				/*	2) to find this point on the curve, we take a step from the previous joint
-				 *	  a distance given by the proportion that this bone takes
+				/* 2) to find this point on the curve, we take a step from the previous joint
+				 *    a distance given by the proportion that this bone takes
 				 */
-				ikData->points[i+1]= ikData->points[i] - (boneLengths[i] / totLength);
+				ikData->points[i+1] = ikData->points[i] - (boneLengths[i] / totLength);
 			}
 		}
-		
+
 		/* spline has now been bound */
 		ikData->flag |= CONSTRAINT_SPLINEIK_BOUND;
 	}
-	
+
 	/* apply corrections for sensitivity to scaling on a copy of the bind points,
 	 * since it's easier to determine the positions of all the joints beforehand this way
 	 */
 	if ((ikData->flag & CONSTRAINT_SPLINEIK_SCALE_LIMITED) && (totLength != 0.0f)) {
-		Curve *cu= (Curve *)ikData->tar->data;
+		Curve *cu = (Curve *)ikData->tar->data;
 		float splineLen, maxScale;
 		int i;
-		
-		/* make a copy of the points array, that we'll store in the tree 
-		 *	- although we could just multiply the points on the fly, this approach means that
-		 * 	  we can introduce per-segment stretchiness later if it is necessary
+
+		/* make a copy of the points array, that we'll store in the tree
+		 *     - although we could just multiply the points on the fly, this approach means that
+		 *       we can introduce per-segment stretchiness later if it is necessary
 		 */
-		jointPoints= MEM_dupallocN(ikData->points);
-		free_joints= 1;
-		
+		jointPoints = MEM_dupallocN(ikData->points);
+		free_joints = 1;
+
 		/* get the current length of the curve */
-		// NOTE: this is assumed to be correct even after the curve was resized
-		splineLen= cu->path->totdist;
-		
-		/* calculate the scale factor to multiply all the path values by so that the 
+		/* NOTE: this is assumed to be correct even after the curve was resized */
+		splineLen = cu->path->totdist;
+
+		/* calculate the scale factor to multiply all the path values by so that the
 		 * bone chain retains its current length, such that
-		 *	maxScale * splineLen = totLength
+		 *     maxScale * splineLen = totLength
 		 */
 		maxScale = totLength / splineLen;
-		
+
 		/* apply scaling correction to all of the temporary points */
-		// TODO: this is really not adequate enough on really short chains
+		/* TODO: this is really not adequate enough on really short chains */
 		for (i = 0; i < segcount; i++)
 			jointPoints[i] *= maxScale;
 	}
 	else {
 		/* just use the existing points array */
-		jointPoints= ikData->points;
-		free_joints= 0;
+		jointPoints = ikData->points;
+		free_joints = 0;
 	}
-	
+
 	/* make a new Spline-IK chain, and store it in the IK chains */
-	// TODO: we should check if there is already an IK chain on this, since that would take presidence...
+	/* TODO: we should check if there is already an IK chain on this, since that would take presidence... */
 	{
 		/* make new tree */
-		tSplineIK_Tree *tree= MEM_callocN(sizeof(tSplineIK_Tree), "SplineIK Tree");
-		tree->type= CONSTRAINT_TYPE_SPLINEIK;
-		
-		tree->chainlen= segcount;
-		
+		tSplineIK_Tree *tree = MEM_callocN(sizeof(tSplineIK_Tree), "SplineIK Tree");
+		tree->type = CONSTRAINT_TYPE_SPLINEIK;
+
+		tree->chainlen = segcount;
+
 		/* copy over the array of links to bones in the chain (from tip to root) */
-		tree->chain= MEM_callocN(sizeof(bPoseChannel*)*segcount, "SplineIK Chain");
+		tree->chain = MEM_callocN(sizeof(bPoseChannel*)*segcount, "SplineIK Chain");
 		memcpy(tree->chain, pchanChain, sizeof(bPoseChannel*)*segcount);
-		
+
 		/* store reference to joint position array */
-		tree->points= jointPoints;
-		tree->free_points= free_joints;
-		
+		tree->points = jointPoints;
+		tree->free_points = free_joints;
+
 		/* store references to different parts of the chain */
-		tree->root= pchanRoot;
-		tree->con= con;
-		tree->ikData= ikData;
-		
+		tree->root = pchanRoot;
+		tree->con = con;
+		tree->ikData = ikData;
+
 		/* AND! link the tree to the root */
 		BLI_addtail(&pchanRoot->siktree, tree);
 	}
-	
+
 	/* mark root channel having an IK tree */
 	pchanRoot->flag |= POSE_IKSPLINE;
 }
@@ -1964,9 +1993,9 @@ static void splineik_init_tree_from_pchan(Scene *scene, Object *UNUSED(ob), bPos
 static void splineik_init_tree(Scene *scene, Object *ob, float UNUSED(ctime))
 {
 	bPoseChannel *pchan;
-	
+
 	/* find the tips of Spline IK chains, which are simply the bones which have been tagged as such */
-	for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+	for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
 		if (pchan->constflag & PCHAN_HAS_SPLINEIK)
 			splineik_init_tree_from_pchan(scene, ob, pchan);
 	}
@@ -1975,23 +2004,24 @@ static void splineik_init_tree(Scene *scene, Object *ob, float UNUSED(ctime))
 /* ----------- */
 
 /* Evaluate spline IK for a given bone */
-static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *ob, bPoseChannel *pchan, int index, float ctime)
+static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *ob, bPoseChannel *pchan,
+                                   int index, float ctime)
 {
-	bSplineIKConstraint *ikData= tree->ikData;
-	float poseHead[3], poseTail[3], poseMat[4][4]; 
-	float splineVec[3], scaleFac, radius=1.0f;
-	
+	bSplineIKConstraint *ikData = tree->ikData;
+	float poseHead[3], poseTail[3], poseMat[4][4];
+	float splineVec[3], scaleFac, radius =1.0f;
+
 	/* firstly, calculate the bone matrix the standard way, since this is needed for roll control */
 	where_is_pose_bone(scene, ob, pchan, ctime, 1);
-	
+
 	copy_v3_v3(poseHead, pchan->pose_head);
 	copy_v3_v3(poseTail, pchan->pose_tail);
-	
+
 	/* step 1: determine the positions for the endpoints of the bone */
 	{
 		float vec[4], dir[3], rad;
-		float tailBlendFac= 1.0f;
-		
+		float tailBlendFac = 1.0f;
+
 		/* determine if the bone should still be affected by SplineIK */
 		if (tree->points[index+1] >= 1.0f) {
 			/* spline doesn't affect the bone anymore, so done... */
@@ -2000,110 +2030,110 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
 		}
 		else if ((tree->points[index] >= 1.0f) && (tree->points[index+1] < 1.0f)) {
 			/* blending factor depends on the amount of the bone still left on the chain */
-			tailBlendFac= (1.0f - tree->points[index+1]) / (tree->points[index] - tree->points[index+1]);
+			tailBlendFac = (1.0f - tree->points[index+1]) / (tree->points[index] - tree->points[index+1]);
 		}
-		
+
 		/* tail endpoint */
-		if ( where_on_path(ikData->tar, tree->points[index], vec, dir, NULL, &rad, NULL) ) {
-			/* apply curve's object-mode transforms to the position 
+		if (where_on_path(ikData->tar, tree->points[index], vec, dir, NULL, &rad, NULL)) {
+			/* apply curve's object-mode transforms to the position
 			 * unless the option to allow curve to be positioned elsewhere is activated (i.e. no root)
 			 */
 			if ((ikData->flag & CONSTRAINT_SPLINEIK_NO_ROOT) == 0)
 				mul_m4_v3(ikData->tar->obmat, vec);
-			
+
 			/* convert the position to pose-space, then store it */
 			mul_m4_v3(ob->imat, vec);
 			interp_v3_v3v3(poseTail, pchan->pose_tail, vec, tailBlendFac);
-			
+
 			/* set the new radius */
-			radius= rad;
+			radius = rad;
 		}
-		
+
 		/* head endpoint */
-		if ( where_on_path(ikData->tar, tree->points[index+1], vec, dir, NULL, &rad, NULL) ) {
-			/* apply curve's object-mode transforms to the position 
+		if (where_on_path(ikData->tar, tree->points[index+1], vec, dir, NULL, &rad, NULL)) {
+			/* apply curve's object-mode transforms to the position
 			 * unless the option to allow curve to be positioned elsewhere is activated (i.e. no root)
 			 */
 			if ((ikData->flag & CONSTRAINT_SPLINEIK_NO_ROOT) == 0)
 				mul_m4_v3(ikData->tar->obmat, vec);
-			
+
 			/* store the position, and convert it to pose space */
 			mul_m4_v3(ob->imat, vec);
 			copy_v3_v3(poseHead, vec);
-			
+
 			/* set the new radius (it should be the average value) */
 			radius = (radius+rad) / 2;
 		}
 	}
-	
-	/* step 2: determine the implied transform from these endpoints 
-	 *	- splineVec: the vector direction that the spline applies on the bone
-	 *	- scaleFac: the factor that the bone length is scaled by to get the desired amount
+
+	/* step 2: determine the implied transform from these endpoints
+	 *     - splineVec: the vector direction that the spline applies on the bone
+	 *     - scaleFac: the factor that the bone length is scaled by to get the desired amount
 	 */
 	sub_v3_v3v3(splineVec, poseTail, poseHead);
-	scaleFac= len_v3(splineVec) / pchan->bone->length;
-	
-	/* step 3: compute the shortest rotation needed to map from the bone rotation to the current axis 
-	 * 	- this uses the same method as is used for the Damped Track Constraint (see the code there for details)
+	scaleFac = len_v3(splineVec) / pchan->bone->length;
+
+	/* step 3: compute the shortest rotation needed to map from the bone rotation to the current axis
+	 *      - this uses the same method as is used for the Damped Track Constraint (see the code there for details)
 	 */
 	{
 		float dmat[3][3], rmat[3][3], tmat[3][3];
 		float raxis[3], rangle;
-		
+
 		/* compute the raw rotation matrix from the bone's current matrix by extracting only the
-		 * orientation-relevant axes, and normalising them
+		 * orientation-relevant axes, and normalizing them
 		 */
 		copy_v3_v3(rmat[0], pchan->pose_mat[0]);
 		copy_v3_v3(rmat[1], pchan->pose_mat[1]);
 		copy_v3_v3(rmat[2], pchan->pose_mat[2]);
 		normalize_m3(rmat);
-		
-		/* also, normalise the orientation imposed by the bone, now that we've extracted the scale factor */
+
+		/* also, normalize the orientation imposed by the bone, now that we've extracted the scale factor */
 		normalize_v3(splineVec);
-		
+
 		/* calculate smallest axis-angle rotation necessary for getting from the
 		 * current orientation of the bone, to the spline-imposed direction
 		 */
 		cross_v3_v3v3(raxis, rmat[1], splineVec);
-		
-		rangle= dot_v3v3(rmat[1], splineVec);
-		rangle= acos( MAX2(-1.0f, MIN2(1.0f, rangle)) );
-		
-		/* multiply the magnitude of the angle by the influence of the constraint to 
-		 * control the influence of the SplineIK effect 
+
+		rangle = dot_v3v3(rmat[1], splineVec);
+		rangle = acos(MAX2(-1.0f, MIN2(1.0f, rangle)));
+
+		/* multiply the magnitude of the angle by the influence of the constraint to
+		 * control the influence of the SplineIK effect
 		 */
 		rangle *= tree->con->enforce;
-		
-		/* construct rotation matrix from the axis-angle rotation found above 
+
+		/* 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
 		 */
 		axis_angle_to_mat3(dmat, raxis, rangle);
-		
+
 		/* combine these rotations so that the y-axis of the bone is now aligned as the spline dictates,
 		 * while still maintaining roll control from the existing bone animation
 		 */
-		mul_m3_m3m3(tmat, dmat, rmat); // m1, m3, m2
+		mul_m3_m3m3(tmat, dmat, rmat); /* m1, m3, m2 */
 		normalize_m3(tmat); /* attempt to reduce shearing, though I doubt this'll really help too much now... */
 		copy_m4_m3(poseMat, tmat);
 	}
-	
+
 	/* step 4: set the scaling factors for the axes */
 	{
 		/* only multiply the y-axis by the scaling factor to get nice volume-preservation */
 		mul_v3_fl(poseMat[1], scaleFac);
-		
+
 		/* set the scaling factors of the x and z axes from... */
 		switch (ikData->xzScaleMode) {
 			case CONSTRAINT_SPLINEIK_XZS_ORIGINAL:
 			{
 				/* original scales get used */
 				float scale;
-				
+
 				/* x-axis scale */
-				scale= len_v3(pchan->pose_mat[0]);
+				scale = len_v3(pchan->pose_mat[0]);
 				mul_v3_fl(poseMat[0], scale);
 				/* z-axis scale */
-				scale= len_v3(pchan->pose_mat[2]);
+				scale = len_v3(pchan->pose_mat[2]);
 				mul_v3_fl(poseMat[2], scale);
 			}
 				break;
@@ -2111,28 +2141,28 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
 			{
 				/* 'volume preservation' */
 				float scale;
-				
-				/* calculate volume preservation factor which is 
-				 * basically the inverse of the y-scaling factor 
+
+				/* calculate volume preservation factor which is
+				 * basically the inverse of the y-scaling factor
 				 */
 				if (fabsf(scaleFac) != 0.0f) {
-					scale= 1.0f / fabsf(scaleFac);
-					
+					scale = 1.0f / fabsf(scaleFac);
+
 					/* we need to clamp this within sensible values */
-					// NOTE: these should be fine for now, but should get sanitised in future
+					/* NOTE: these should be fine for now, but should get sanitised in future */
 					CLAMP(scale, 0.0001f, 100000.0f);
 				}
 				else
-					scale= 1.0f;
-				
+					scale = 1.0f;
+
 				/* apply the scaling */
 				mul_v3_fl(poseMat[0], scale);
 				mul_v3_fl(poseMat[2], scale);
 			}
 				break;
 		}
-		
-		/* finally, multiply the x and z scaling by the radius of the curve too, 
+
+		/* finally, multiply the x and z scaling by the radius of the curve too,
 		 * to allow automatic scales to get tweaked still
 		 */
 		if ((ikData->flag & CONSTRAINT_SPLINEIK_NO_CURVERAD) == 0) {
@@ -2140,7 +2170,7 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
 			mul_v3_fl(poseMat[2], radius);
 		}
 	}
-	
+
 	/* step 5: set the location of the bone in the matrix */
 	if (ikData->flag & CONSTRAINT_SPLINEIK_NO_ROOT) {
 		/* when the 'no-root' option is affected, the chain can retain
@@ -2157,19 +2187,19 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
 			copy_v3_v3(poseHead, pchan->pose_head);
 		}
 		else {
-			// FIXME: this introduces popping artifacts when we reach 0.0
+			/* FIXME: this introduces popping artifacts when we reach 0.0 */
 			interp_v3_v3v3(poseHead, pchan->pose_head, poseHead, tree->con->enforce);
 		}
 	}
 	copy_v3_v3(poseMat[3], poseHead);
-	
+
 	/* finally, store the new transform */
 	copy_m4_m4(pchan->pose_mat, poseMat);
 	copy_v3_v3(pchan->pose_head, poseHead);
-	
+
 	/* recalculate tail, as it's now outdated after the head gets adjusted above! */
 	where_is_pose_bone_tail(pchan);
-	
+
 	/* done! */
 	pchan->flag |= POSE_DONE;
 }
@@ -2178,24 +2208,26 @@ static void splineik_evaluate_bone(tSplineIK_Tree *tree, Scene *scene, Object *o
 static void splineik_execute_tree(Scene *scene, Object *ob, bPoseChannel *pchan_root, float ctime)
 {
 	tSplineIK_Tree *tree;
-	
+
 	/* for each pose-tree, execute it if it is spline, otherwise just free it */
 	while ((tree = pchan_root->siktree.first) != NULL) {
 		int i;
-		
+
 		/* walk over each bone in the chain, calculating the effects of spline IK
-		 * 	- the chain is traversed in the opposite order to storage order (i.e. parent to children)
-		 *	  so that dependencies are correct
+		 *     - the chain is traversed in the opposite order to storage order (i.e. parent to children)
+		 *       so that dependencies are correct
 		 */
-		for (i= tree->chainlen-1; i >= 0; i--) {
-			bPoseChannel *pchan= tree->chain[i];
+		for (i = tree->chainlen-1; i >= 0; i--) {
+			bPoseChannel *pchan = tree->chain[i];
 			splineik_evaluate_bone(tree, scene, ob, pchan, i, ctime);
 		}
-		
+
 		/* free the tree info specific to SplineIK trees now */
-		if (tree->chain) MEM_freeN(tree->chain);
-		if (tree->free_points) MEM_freeN(tree->points);
-		
+		if (tree->chain)
+			MEM_freeN(tree->chain);
+		if (tree->free_points)
+			MEM_freeN(tree->points);
+
 		/* free this tree */
 		BLI_freelinkN(&pchan_root->siktree, tree);
 	}
@@ -2209,10 +2241,10 @@ void pchan_to_mat4(bPoseChannel *pchan, float chan_mat[4][4])
 	float smat[3][3];
 	float rmat[3][3];
 	float tmat[3][3];
-	
+
 	/* get scaling matrix */
 	size_to_mat3(smat, pchan->size);
-	
+
 	/* rotations may either be quats, eulers (with various rotation orders), or axis-angle */
 	if (pchan->rotmode > 0) {
 		/* euler rotations (will cause gimble lock, but this can be alleviated a bit with rotation orders) */
@@ -2225,22 +2257,22 @@ void pchan_to_mat4(bPoseChannel *pchan, float chan_mat[4][4])
 	else {
 		/* quats are normalised before use to eliminate scaling issues */
 		float quat[4];
-		
-		/* NOTE: we now don't normalise the stored values anymore, since this was kindof evil in some cases
-		 * but if this proves to be too problematic, switch back to the old system of operating directly on 
+
+		/* NOTE: we now don't normalize the stored values anymore, since this was kindof evil in some cases
+		 * but if this proves to be too problematic, switch back to the old system of operating directly on
 		 * the stored copy
 		 */
 		normalize_qt_qt(quat, pchan->quat);
 		quat_to_mat3(rmat, quat);
 	}
-	
+
 	/* calculate matrix of bone (as 3x3 matrix, but then copy the 4x4) */
 	mul_m3_m3m3(tmat, rmat, smat);
 	copy_m4_m3(chan_mat, tmat);
-	
+
 	/* prevent action channels breaking chains */
 	/* need to check for bone here, CONSTRAINT_TYPE_ACTION uses this call */
-	if ((pchan->bone==NULL) || !(pchan->bone->flag & BONE_CONNECTED)) {
+	if ((pchan->bone == NULL) || !(pchan->bone->flag & BONE_CONNECTED)) {
 		copy_v3_v3(chan_mat[3], pchan->loc);
 	}
 }
@@ -2249,7 +2281,7 @@ void pchan_to_mat4(bPoseChannel *pchan, float chan_mat[4][4])
 /* used in constraint.c too */
 void pchan_calc_mat(bPoseChannel *pchan)
 {
-	/* this is just a wrapper around the copy of this function which calculates the matrix 
+	/* this is just a wrapper around the copy of this function which calculates the matrix
 	 * and stores the result in any given channel
 	 */
 	pchan_to_mat4(pchan, pchan->chan_mat);
@@ -2267,26 +2299,26 @@ static void do_strip_modifiers(Scene *scene, Object *armob, Bone *bone, bPoseCha
 
 	for (strip=armob->nlastrips.first; strip; strip=strip->next) {
 		do_modif=0;
-		
+
 		if (scene_cfra>=strip->start && scene_cfra<=strip->end)
 			do_modif=1;
-		
+
 		if ((scene_cfra > strip->end) && (strip->flag & ACTSTRIP_HOLDLASTFRAME)) {
 			do_modif=1;
-			
-			/* if there are any other strips active, ignore modifiers for this strip - 
-			 * 'hold' option should only hold action modifiers if there are 
+
+			/* if there are any other strips active, ignore modifiers for this strip -
+			 * 'hold' option should only hold action modifiers if there are
 			 * no other active strips */
 			for (strip2=strip->next; strip2; strip2=strip2->next) {
 				if (strip2 == strip) continue;
-				
+
 				if (scene_cfra>=strip2->start && scene_cfra<=strip2->end) {
 					if (!(strip2->flag & ACTSTRIP_MUTE))
 						do_modif=0;
 				}
 			}
-			
-			/* if there are any later, activated, strips with 'hold' set, they take precedence, 
+
+			/* if there are any later, activated, strips with 'hold' set, they take precedence,
 			 * so ignore modifiers for this strip */
 			for (strip2=strip->next; strip2; strip2=strip2->next) {
 				if (scene_cfra < strip2->start) continue;
@@ -2295,54 +2327,54 @@ static void do_strip_modifiers(Scene *scene, Object *armob, Bone *bone, bPoseCha
 				}
 			}
 		}
-		
+
 		if (do_modif) {
 			/* temporal solution to prevent 2 strips accumulating */
-			if(scene_cfra==strip->end && strip->next && strip->next->start==scene_cfra)
+			if (scene_cfra==strip->end && strip->next && strip->next->start==scene_cfra)
 				continue;
-			
-			for(amod= strip->modifiers.first; amod; amod= amod->next) {
+
+			for (amod= strip->modifiers.first; amod; amod= amod->next) {
 				switch (amod->type) {
 				case ACTSTRIP_MOD_DEFORM:
 				{
 					/* validate first */
-					if(amod->ob && amod->ob->type==OB_CURVE && amod->channel[0]) {
-						
-						if( strcmp(pchan->name, amod->channel)==0 ) {
+					if (amod->ob && amod->ob->type==OB_CURVE && amod->channel[0]) {
+
+						if ( strcmp(pchan->name, amod->channel)==0 ) {
 							float mat4[4][4], mat3[3][3];
-							
+
 							curve_deform_vector(scene, amod->ob, armob, bone->arm_mat[3], pchan->pose_mat[3], mat3, amod->no_rot_axis);
 							copy_m4_m4(mat4, pchan->pose_mat);
 							mul_m4_m3m4(pchan->pose_mat, mat3, mat4);
-							
+
 						}
 					}
 				}
 					break;
-				case ACTSTRIP_MOD_NOISE:	
+				case ACTSTRIP_MOD_NOISE:
 				{
-					if( strcmp(pchan->name, amod->channel)==0 ) {
+					if ( strcmp(pchan->name, amod->channel)==0 ) {
 						float nor[3], loc[3], ofs;
 						float eul[3], size[3], eulo[3], sizeo[3];
-						
+
 						/* calculate turbulance */
 						ofs = amod->turbul / 200.0f;
-						
+
 						/* make a copy of starting conditions */
 						copy_v3_v3(loc, pchan->pose_mat[3]);
 						mat4_to_eul( eul,pchan->pose_mat);
 						mat4_to_size( size,pchan->pose_mat);
 						copy_v3_v3(eulo, eul);
 						copy_v3_v3(sizeo, size);
-						
+
 						/* apply noise to each set of channels */
 						if (amod->channels & 4) {
 							/* for scaling */
 							nor[0] = BLI_gNoise(amod->noisesize, size[0]+ofs, size[1], size[2], 0, 0) - ofs;
-							nor[1] = BLI_gNoise(amod->noisesize, size[0], size[1]+ofs, size[2], 0, 0) - ofs;	
+							nor[1] = BLI_gNoise(amod->noisesize, size[0], size[1]+ofs, size[2], 0, 0) - ofs;
 							nor[2] = BLI_gNoise(amod->noisesize, size[0], size[1], size[2]+ofs, 0, 0) - ofs;
 							add_v3_v3(size, nor);
-							
+
 							if (sizeo[0] != 0)
 								mul_v3_fl(pchan->pose_mat[0], size[0] / sizeo[0]);
 							if (sizeo[1] != 0)
@@ -2353,21 +2385,21 @@ static void do_strip_modifiers(Scene *scene, Object *armob, Bone *bone, bPoseCha
 						if (amod->channels & 2) {
 							/* for rotation */
 							nor[0] = BLI_gNoise(amod->noisesize, eul[0]+ofs, eul[1], eul[2], 0, 0) - ofs;
-							nor[1] = BLI_gNoise(amod->noisesize, eul[0], eul[1]+ofs, eul[2], 0, 0) - ofs;	
+							nor[1] = BLI_gNoise(amod->noisesize, eul[0], eul[1]+ofs, eul[2], 0, 0) - ofs;
 							nor[2] = BLI_gNoise(amod->noisesize, eul[0], eul[1], eul[2]+ofs, 0, 0) - ofs;
-							
+
 							compatible_eul(nor, eulo);
 							add_v3_v3(eul, nor);
 							compatible_eul(eul, eulo);
-							
+
 							loc_eul_size_to_mat4(pchan->pose_mat, loc, eul, size);
 						}
 						if (amod->channels & 1) {
 							/* for location */
 							nor[0] = BLI_gNoise(amod->noisesize, loc[0]+ofs, loc[1], loc[2], 0, 0) - ofs;
-							nor[1] = BLI_gNoise(amod->noisesize, loc[0], loc[1]+ofs, loc[2], 0, 0) - ofs;	
+							nor[1] = BLI_gNoise(amod->noisesize, loc[0], loc[1]+ofs, loc[2], 0, 0) - ofs;
 							nor[2] = BLI_gNoise(amod->noisesize, loc[0], loc[1], loc[2]+ofs, 0, 0) - ofs;
-							
+
 							add_v3_v3v3(pchan->pose_mat[3], loc, nor);
 						}
 					}
@@ -2385,7 +2417,7 @@ static void do_strip_modifiers(Scene *scene, Object *armob, Bone *bone, bPoseCha
 void where_is_pose_bone_tail(bPoseChannel *pchan)
 {
 	float vec[3];
-	
+
 	copy_v3_v3(vec, pchan->pose_mat[1]);
 	mul_v3_fl(vec, pchan->bone->length);
 	add_v3_v3v3(pchan->pose_tail, pchan->pose_head, vec);
@@ -2398,13 +2430,15 @@ void where_is_pose_bone_tail(bPoseChannel *pchan)
 void where_is_pose_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float ctime, int do_extra)
 {
 	/* This gives a chan_mat with actions (ipos) results. */
-	if(do_extra)
+	if (do_extra)
 		pchan_calc_mat(pchan);
 	else
 		unit_m4(pchan->chan_mat);
 
 	/* Construct the posemat based on PoseChannels, that we do before applying constraints. */
-	/* pose_mat(b)= pose_mat(b-1) * yoffs(b-1) * d_root(b) * bone_mat(b) * chan_mat(b) */
+	/* pose_mat(b) = pose_mat(b-1) * yoffs(b-1) * d_root(b) * bone_mat(b) * chan_mat(b) */
+	armature_mat_bone_to_pose(pchan, pchan->chan_mat, pchan->pose_mat);
+#if 0 /* XXX Old code, will remove this later. */
 	{
 		float rotscale_mat[4][4], loc_mat[4][4];
 		pchan_to_pose_mat(pchan, rotscale_mat, loc_mat);
@@ -2413,16 +2447,16 @@ void where_is_pose_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float cti
 		/* Location. */
 		mul_v3_m4v3(pchan->pose_mat[3], loc_mat, pchan->chan_mat[3]);
 	}
+#endif
 
 	/* Only rootbones get the cyclic offset (unless user doesn't want that). */
 	/* XXX That could be a problem for snapping and other "reverse transform" features... */
-	if(!pchan->parent) {
-		if((pchan->bone->flag & BONE_NO_CYCLICOFFSET) == 0)
+	if (!pchan->parent) {
+		if ((pchan->bone->flag & BONE_NO_CYCLICOFFSET) == 0)
 			add_v3_v3(pchan->pose_mat[3], ob->pose->cyclic_offset);
 	}
 
-	if(do_extra) {
-
+	if (do_extra) {
 #if 0	/* XXX OLD ANIMSYS, NLASTRIPS ARE NO LONGER USED */
 		/* do NLA strip modifiers - i.e. curve follow */
 		do_strip_modifiers(scene, ob, bone, pchan);
@@ -2439,10 +2473,10 @@ void where_is_pose_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float cti
 			/* prepare PoseChannel for Constraint solving
 			 * - makes a copy of matrix, and creates temporary struct to use
 			 */
-			cob= constraints_make_evalob(scene, ob, pchan, CONSTRAINT_OBTYPE_BONE);
+			cob = constraints_make_evalob(scene, ob, pchan, CONSTRAINT_OBTYPE_BONE);
 
 			/* Solve PoseChannel's Constraints */
-			solve_constraints(&pchan->constraints, cob, ctime);	// ctime doesnt alter objects
+			solve_constraints(&pchan->constraints, cob, ctime);	/* ctime doesnt alter objects */
 
 			/* cleanup after Constraint Solving
 			 * - applies matrix back to pchan, and frees temporary struct used
@@ -2450,7 +2484,7 @@ void where_is_pose_bone(Scene *scene, Object *ob, bPoseChannel *pchan, float cti
 			constraints_clear_evalob(cob);
 
 			/* prevent constraints breaking a chain */
-			if(pchan->bone->flag & BONE_CONNECTED) {
+			if (pchan->bone->flag & BONE_CONNECTED) {
 				copy_v3_v3(pchan->pose_mat[3], vec);
 			}
 		}
@@ -2471,22 +2505,23 @@ void where_is_pose (Scene *scene, Object *ob)
 	bPoseChannel *pchan;
 	float imat[4][4];
 	float ctime;
-	
-	if(ob->type!=OB_ARMATURE) return;
+
+	if (ob->type != OB_ARMATURE)
+		return;
 	arm = ob->data;
-	
-	if(ELEM(NULL, arm, scene)) return;
-	if((ob->pose==NULL) || (ob->pose->flag & POSE_RECALC)) 
+
+	if (ELEM(NULL, arm, scene))
+		return;
+	if ((ob->pose == NULL) || (ob->pose->flag & POSE_RECALC))
 		armature_rebuild_pose(ob, arm);
-	   
-	ctime= BKE_curframe(scene);	/* not accurate... */
-	
+
+	ctime = BKE_curframe(scene); /* not accurate... */
+
 	/* In editmode or restposition we read the data from the bones */
-	if(arm->edbo || (arm->flag & ARM_RESTPOS)) {
-		
-		for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
-			bone= pchan->bone;
-			if(bone) {
+	if (arm->edbo || (arm->flag & ARM_RESTPOS)) {
+		for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+			bone = pchan->bone;
+			if (bone) {
 				copy_m4_m4(pchan->pose_mat, bone->arm_mat);
 				copy_v3_v3(pchan->pose_head, bone->arm_head);
 				copy_v3_v3(pchan->pose_tail, bone->arm_tail);
@@ -2494,44 +2529,44 @@ void where_is_pose (Scene *scene, Object *ob)
 		}
 	}
 	else {
-		invert_m4_m4(ob->imat, ob->obmat);	// imat is needed 
-		
+		invert_m4_m4(ob->imat, ob->obmat); /* imat is needed */
+
 		/* 1. clear flags */
-		for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+		for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
 			pchan->flag &= ~(POSE_DONE|POSE_CHAIN|POSE_IKTREE|POSE_IKSPLINE);
 		}
-		
+
 		/* 2a. construct the IK tree (standard IK) */
 		BIK_initialize_tree(scene, ob, ctime);
-		
-		/* 2b. construct the Spline IK trees 
+
+		/* 2b. construct the Spline IK trees
 		 *  - this is not integrated as an IK plugin, since it should be able
 		 *	  to function in conjunction with standard IK
 		 */
 		splineik_init_tree(scene, ob, ctime);
-		
+
 		/* 3. the main loop, channels are already hierarchical sorted from root to children */
-		for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+		for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
 			/* 4a. if we find an IK root, we handle it separated */
-			if(pchan->flag & POSE_IKTREE) {
+			if (pchan->flag & POSE_IKTREE) {
 				BIK_execute_tree(scene, ob, pchan, ctime);
 			}
 			/* 4b. if we find a Spline IK root, we handle it separated too */
-			else if(pchan->flag & POSE_IKSPLINE) {
+			else if (pchan->flag & POSE_IKSPLINE) {
 				splineik_execute_tree(scene, ob, pchan, ctime);
 			}
 			/* 5. otherwise just call the normal solver */
-			else if(!(pchan->flag & POSE_DONE)) {
+			else if (!(pchan->flag & POSE_DONE)) {
 				where_is_pose_bone(scene, ob, pchan, ctime, 1);
 			}
 		}
 		/* 6. release the IK tree */
 		BIK_release_tree(scene, ob, ctime);
 	}
-		
+
 	/* calculating deform matrices */
-	for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
-		if(pchan->bone) {
+	for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+		if (pchan->bone) {
 			invert_m4_m4(imat, pchan->bone->arm_mat);
 			mult_m4_m4m4(pchan->chan_mat, pchan->pose_mat, imat);
 		}
@@ -2545,19 +2580,19 @@ int get_selected_defgroups(Object *ob, char *dg_selection, int defbase_tot)
 {
 	bDeformGroup *defgroup;
 	unsigned int i;
-	Object *armob= object_pose_armature_get(ob);
-	int dg_flags_sel_tot= 0;
-
-	if(armob) {
-		bPose *pose= armob->pose;
-		for (i= 0, defgroup= ob->defbase.first; i < defbase_tot && defgroup; defgroup = defgroup->next, i++) {
-			bPoseChannel *pchan= get_pose_channel(pose, defgroup->name);
-			if(pchan && (pchan->bone->flag & BONE_SELECTED)) {
-				dg_selection[i]= TRUE;
+	Object *armob = object_pose_armature_get(ob);
+	int dg_flags_sel_tot = 0;
+
+	if (armob) {
+		bPose *pose = armob->pose;
+		for (i = 0, defgroup = ob->defbase.first; i < defbase_tot && defgroup; defgroup = defgroup->next, i++) {
+			bPoseChannel *pchan = get_pose_channel(pose, defgroup->name);
+			if (pchan && (pchan->bone->flag & BONE_SELECTED)) {
+				dg_selection[i] = TRUE;
 				dg_flags_sel_tot++;
 			}
 			else {
-				dg_selection[i]= FALSE;
+				dg_selection[i] = FALSE;
 			}
 		}
 	}
@@ -2567,3 +2602,54 @@ int get_selected_defgroups(Object *ob, char *dg_selection, int defbase_tot)
 
 	return dg_flags_sel_tot;
 }
+
+/************** Bounding box ********************/
+int minmax_armature(Object *ob, float min[3], float max[3])
+{
+	bPoseChannel *pchan;
+
+	/* For now, we assume where_is_pose has already been called (hence we have valid data in pachan). */
+	for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+		DO_MINMAX(pchan->pose_head, min, max);
+		DO_MINMAX(pchan->pose_tail, min, max);
+	}
+
+	return (ob->pose->chanbase.first != NULL);
+}
+
+void boundbox_armature(Object *ob, float *loc, float *size)
+{
+	BoundBox *bb;
+	float min[3], max[3];
+	float mloc[3], msize[3];
+
+	if (ob->bb == NULL)
+		ob->bb = MEM_callocN(sizeof(BoundBox), "Armature boundbox");
+	bb = ob->bb;
+
+	if (!loc)
+		loc = mloc;
+	if (!size)
+		size = msize;
+
+	INIT_MINMAX(min, max);
+	if (!minmax_armature(ob, min, max)) {
+		min[0] = min[1] = min[2] = -1.0f;
+		max[0] = max[1] = max[2] = 1.0f;
+	}
+
+	mid_v3_v3v3(loc, min, max);
+
+	size[0] = (max[0] - min[0]) / 2.0f;
+	size[1] = (max[1] - min[1]) / 2.0f;
+	size[2] = (max[2] - min[2]) / 2.0f;
+
+	boundbox_set_from_min_max(bb, min, max);
+}
+
+BoundBox *BKE_armature_get_bb(Object *ob)
+{
+	boundbox_armature(ob, NULL, NULL);
+
+	return ob->bb;
+}
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index a864461..9c9b207 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -31,13 +31,13 @@
 
 
 #ifndef _WIN32 
-	#include <unistd.h> // for read close
+#  include <unistd.h> // for read close
 #else
-	#include <io.h> // for open close read
-	#define open _open
-	#define read _read
-	#define close _close
-	#define write _write
+#  include <io.h> // for open close read
+#  define open _open
+#  define read _read
+#  define close _close
+#  define write _write
 #endif
 
 #include <stdlib.h>
@@ -78,6 +78,7 @@
 #include "BKE_screen.h"
 #include "BKE_sequencer.h"
 #include "BKE_sound.h"
+#include "RE_pipeline.h"
 
 
 #include "BLO_undofile.h"
@@ -127,7 +128,7 @@ void initglobals(void)
 
 	strcpy(G.ima, "//");
 
-	if(BLENDER_SUBVERSION)
+	if (BLENDER_SUBVERSION)
 		BLI_snprintf(versionstr, sizeof(versionstr), "blender.org %d.%d", BLENDER_VERSION, BLENDER_SUBVERSION);
 	else
 		BLI_snprintf(versionstr, sizeof(versionstr), "blender.org %d", BLENDER_VERSION);
@@ -174,7 +175,7 @@ static void clean_paths(Main *main)
 
 	bpath_traverse_main(main, clean_paths_visit_cb, BPATH_TRAVERSE_SKIP_MULTIFILE, NULL);
 
-	for(scene= main->scene.first; scene; scene= scene->id.next) {
+	for (scene= main->scene.first; scene; scene= scene->id.next) {
 		BLI_clean(scene->r.pic);
 	}
 }
@@ -193,21 +194,26 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
 	char mode;
 
 	/* 'u' = undo save, 'n' = no UI load */
-	if(bfd->main->screen.first==NULL) mode= 'u';
-	else if(G.fileflags & G_FILE_NO_UI) mode= 'n';
+	if (bfd->main->screen.first==NULL) mode= 'u';
+	else if (G.fileflags & G_FILE_NO_UI) mode= 'n';
 	else mode= 0;
 
 	recover= (G.fileflags & G_FILE_RECOVER);
 
+	/* Free all render results, without this stale data gets displayed after loading files */
+	if (mode != 'u') {
+		RE_FreeAllRenderResults();
+	}
+
 	/* Only make filepaths compatible when loading for real (not undo) */
-	if(mode != 'u') {
+	if (mode != 'u') {
 		clean_paths(bfd->main);
 	}
 
 	/* XXX here the complex windowmanager matching */
 	
 	/* no load screens? */
-	if(mode) {
+	if (mode) {
 		/* comes from readfile.c */
 		extern void lib_link_screen_restore(Main *, bScreen *, Scene *);
 		
@@ -219,9 +225,9 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
 		curscreen= CTX_wm_screen(C);
 		/* but use new Scene pointer */
 		curscene= bfd->curscene;
-		if(curscene==NULL) curscene= bfd->main->scene.first;
+		if (curscene==NULL) curscene= bfd->main->scene.first;
 		/* and we enforce curscene to be in current screen */
-		if(curscreen) curscreen->scene= curscene; /* can run in bgmode */
+		if (curscreen) curscreen->scene= curscene; /* can run in bgmode */
 
 		/* clear_global will free G.main, here we can still restore pointers */
 		lib_link_screen_restore(bfd->main, curscreen, curscene);
@@ -250,7 +256,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
 	}
 	
 	/* case G_FILE_NO_UI or no screens in file */
-	if(mode) {
+	if (mode) {
 		/* leave entire context further unaltered? */
 		CTX_data_scene_set(C, curscene);
 	}
@@ -266,16 +272,16 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
 		CTX_wm_menu_set(C, NULL);
 	}
 	
-	/* this can happen when active scene was lib-linked, and doesnt exist anymore */
-	if(CTX_data_scene(C)==NULL) {
+	/* 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);
 		CTX_wm_screen(C)->scene= CTX_data_scene(C);
 		curscene= CTX_data_scene(C);
 	}
 
 	/* special cases, override loaded flags: */
-	if(G.f != bfd->globalf) {
-		const int flags_keep= (G_DEBUG | G_SWAP_EXCHANGE | G_SCRIPT_AUTOEXEC | G_SCRIPT_OVERRIDE_PREF);
+	if (G.f != bfd->globalf) {
+		const int flags_keep = (G_SWAP_EXCHANGE | G_SCRIPT_AUTOEXEC | G_SCRIPT_OVERRIDE_PREF);
 		bfd->globalf= (bfd->globalf & ~flags_keep) | (G.f & flags_keep);
 	}
 
@@ -291,7 +297,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
 	if (G.main->versionfile < 250)
 		do_versions_ipos_to_animato(G.main);
 	
-	if(recover && bfd->filename[0] && G.relbase_valid) {
+	if (recover && bfd->filename[0] && G.relbase_valid) {
 		/* in case of autosave or quit.blend, use original filename instead
 		 * use relbase_valid to make sure the file is saved, else we get <memory2> in the filename */
 		filepath= bfd->filename;
@@ -304,7 +310,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
 #endif
 	
 	/* these are the same at times, should never copy to the same location */
-	if(G.main->name != filepath)
+	if (G.main->name != filepath)
 		BLI_strncpy(G.main->name, filepath, FILE_MAX);
 
 	/* baseflags, groups, make depsgraph, etc */
@@ -317,7 +323,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
 
 static int handle_subversion_warning(Main *main, ReportList *reports)
 {
-	if(main->minversionfile > BLENDER_VERSION ||
+	if (main->minversionfile > BLENDER_VERSION ||
 	   (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!", main->minversionfile, main->minsubversionfile);
@@ -328,11 +334,11 @@ static int handle_subversion_warning(Main *main, ReportList *reports)
 
 static void keymap_item_free(wmKeyMapItem *kmi)
 {
-	if(kmi->properties) {
+	if (kmi->properties) {
 		IDP_FreeProperty(kmi->properties);
 		MEM_freeN(kmi->properties);
 	}
-	if(kmi->ptr)
+	if (kmi->ptr)
 		MEM_freeN(kmi->ptr);
 }
 
@@ -342,19 +348,19 @@ void BKE_userdef_free(void)
 	wmKeyMapItem *kmi;
 	wmKeyMapDiffItem *kmdi;
 
-	for(km=U.user_keymaps.first; km; km=km->next) {
-		for(kmdi=km->diff_items.first; kmdi; kmdi=kmdi->next) {
-			if(kmdi->add_item) {
+	for (km=U.user_keymaps.first; km; km=km->next) {
+		for (kmdi=km->diff_items.first; kmdi; kmdi=kmdi->next) {
+			if (kmdi->add_item) {
 				keymap_item_free(kmdi->add_item);
 				MEM_freeN(kmdi->add_item);
 			}
-			if(kmdi->remove_item) {
+			if (kmdi->remove_item) {
 				keymap_item_free(kmdi->remove_item);
 				MEM_freeN(kmdi->remove_item);
 			}
 		}
 
-		for(kmi=km->items.first; kmi; kmi=kmi->next)
+		for (kmi=km->items.first; kmi; kmi=kmi->next)
 			keymap_item_free(kmi);
 
 		BLI_freelistN(&km->diff_items);
@@ -373,14 +379,14 @@ int BKE_read_file(bContext *C, const char *filepath, ReportList *reports)
 	BlendFileData *bfd;
 	int retval= BKE_READ_FILE_OK;
 
-	if(strstr(filepath, BLENDER_STARTUP_FILE)==NULL) /* dont print user-pref loading */
+	if (strstr(filepath, BLENDER_STARTUP_FILE)==NULL) /* don't print user-pref loading */
 		printf("read blend: %s\n", filepath);
 
 	bfd= BLO_read_from_file(filepath, reports);
 	if (bfd) {
-		if(bfd->user) retval= BKE_READ_FILE_OK_USERPREFS;
+		if (bfd->user) retval= BKE_READ_FILE_OK_USERPREFS;
 		
-		if(0==handle_subversion_warning(bfd->main, reports)) {
+		if (0==handle_subversion_warning(bfd->main, reports)) {
 			free_main(bfd->main);
 			MEM_freeN(bfd);
 			bfd= NULL;
@@ -466,7 +472,7 @@ static int read_undosave(bContext *C, UndoElem *uel)
 	char mainstr[sizeof(G.main->name)];
 	int success=0, fileflags;
 	
-	/* This is needed so undoing/redoing doesnt crash with threaded previews going */
+	/* This is needed so undoing/redoing doesn't crash with threaded previews going */
 	WM_jobs_stop_all(CTX_wm_manager(C));
 
 	BLI_strncpy(mainstr, G.main->name, sizeof(mainstr));	/* temporal store */
@@ -474,7 +480,7 @@ static int read_undosave(bContext *C, UndoElem *uel)
 	fileflags= G.fileflags;
 	G.fileflags |= G_FILE_NO_UI;
 
-	if(UNDO_DISK) 
+	if (UNDO_DISK) 
 		success= (BKE_read_file(C, uel->str, NULL) != BKE_READ_FILE_FAIL);
 	else
 		success= BKE_read_file_from_memfile(C, &uel->memfile, NULL);
@@ -483,7 +489,7 @@ static int read_undosave(bContext *C, UndoElem *uel)
 	BLI_strncpy(G.main->name, mainstr, sizeof(G.main->name)); /* restore */
 	G.fileflags= fileflags;
 
-	if(success) {
+	if (success) {
 		/* important not to update time here, else non keyed tranforms are lost */
 		DAG_on_visible_update(G.main, FALSE);
 	}
@@ -498,11 +504,11 @@ void BKE_write_undo(bContext *C, const char *name)
 	int nr /*, success */ /* UNUSED */;
 	UndoElem *uel;
 	
-	if( (U.uiflag & USER_GLOBALUNDO)==0) return;
-	if( U.undosteps==0) return;
+	if ( (U.uiflag & USER_GLOBALUNDO)==0) return;
+	if ( U.undosteps==0) return;
 	
 	/* remove all undos after (also when curundo==NULL) */
-	while(undobase.last != curundo) {
+	while (undobase.last != curundo) {
 		uel= undobase.last;
 		BLI_remlink(&undobase, uel);
 		BLO_free_memfile(&uel->memfile);
@@ -517,13 +523,13 @@ void BKE_write_undo(bContext *C, const char *name)
 	/* and limit amount to the maximum */
 	nr= 0;
 	uel= undobase.last;
-	while(uel) {
+	while (uel) {
 		nr++;
-		if(nr==U.undosteps) break;
+		if (nr==U.undosteps) break;
 		uel= uel->prev;
 	}
-	if(uel) {
-		while(undobase.first!=uel) {
+	if (uel) {
+		while (undobase.first!=uel) {
 			UndoElem *first= undobase.first;
 			BLI_remlink(&undobase, first);
 			/* the merge is because of compression */
@@ -534,7 +540,7 @@ void BKE_write_undo(bContext *C, const char *name)
 
 
 	/* disk save version */
-	if(UNDO_DISK) {
+	if (UNDO_DISK) {
 		static int counter= 0;
 		char filepath[FILE_MAX];
 		char numstr[32];
@@ -554,31 +560,31 @@ void BKE_write_undo(bContext *C, const char *name)
 	else {
 		MemFile *prevfile=NULL;
 		
-		if(curundo->prev) prevfile= &(curundo->prev->memfile);
+		if (curundo->prev) prevfile= &(curundo->prev->memfile);
 		
 		memused= MEM_get_memory_in_use();
 		/* success= */ /* UNUSED */ BLO_write_file_mem(CTX_data_main(C), prevfile, &curundo->memfile, G.fileflags);
 		curundo->undosize= MEM_get_memory_in_use() - memused;
 	}
 
-	if(U.undomemory != 0) {
+	if (U.undomemory != 0) {
 		/* limit to maximum memory (afterwards, we can't know in advance) */
 		totmem= 0;
 		maxmem= ((uintptr_t)U.undomemory)*1024*1024;
 
 		/* keep at least two (original + other) */
 		uel= undobase.last;
-		while(uel && uel->prev) {
+		while (uel && uel->prev) {
 			totmem+= uel->undosize;
-			if(totmem>maxmem) break;
+			if (totmem>maxmem) break;
 			uel= uel->prev;
 		}
 
-		if(uel) {
-			if(uel->prev && uel->prev->prev)
+		if (uel) {
+			if (uel->prev && uel->prev->prev)
 				uel= uel->prev;
 
-			while(undobase.first!=uel) {
+			while (undobase.first!=uel) {
 				UndoElem *first= undobase.first;
 				BLI_remlink(&undobase, first);
 				/* the merge is because of compression */
@@ -593,27 +599,26 @@ void BKE_write_undo(bContext *C, const char *name)
 void BKE_undo_step(bContext *C, int step)
 {
 	
-	if(step==0) {
+	if (step==0) {
 		read_undosave(C, curundo);
 	}
-	else if(step==1) {
+	else if (step==1) {
 		/* curundo should never be NULL, after restart or load file it should call undo_save */
-		if(curundo==NULL || curundo->prev==NULL) ; // XXX error("No undo available");
+		if (curundo==NULL || curundo->prev==NULL) ; // XXX error("No undo available");
 		else {
-			if(G.f & G_DEBUG) printf("undo %s\n", curundo->name);
+			if (G.debug & G_DEBUG) printf("undo %s\n", curundo->name);
 			curundo= curundo->prev;
 			read_undosave(C, curundo);
 		}
 	}
 	else {
-		
 		/* curundo has to remain current situation! */
 		
-		if(curundo==NULL || curundo->next==NULL) ; // XXX error("No redo available");
+		if (curundo==NULL || curundo->next==NULL) ; // XXX error("No redo available");
 		else {
 			read_undosave(C, curundo->next);
 			curundo= curundo->next;
-			if(G.f & G_DEBUG) printf("redo %s\n", curundo->name);
+			if (G.debug & G_DEBUG) printf("redo %s\n", curundo->name);
 		}
 	}
 }
@@ -623,7 +628,7 @@ void BKE_reset_undo(void)
 	UndoElem *uel;
 	
 	uel= undobase.first;
-	while(uel) {
+	while (uel) {
 		BLO_free_memfile(&uel->memfile);
 		uel= uel->next;
 	}
@@ -644,7 +649,7 @@ void BKE_undo_name(bContext *C, const char *name)
 {
 	UndoElem *uel= BLI_rfindstring(&undobase, name, offsetof(UndoElem, name));
 
-	if(uel && uel->prev) {
+	if (uel && uel->prev) {
 		curundo= uel->prev;
 		BKE_undo_step(C, 0);
 	}
@@ -653,7 +658,7 @@ void BKE_undo_name(bContext *C, const char *name)
 /* name optional */
 int BKE_undo_valid(const char *name)
 {
-	if(name) {
+	if (name) {
 		UndoElem *uel= BLI_rfindstring(&undobase, name, offsetof(UndoElem, name));
 		return uel && uel->prev;
 	}
@@ -667,10 +672,10 @@ const char *BKE_undo_get_name(int nr, int *active)
 {
 	UndoElem *uel= BLI_findlink(&undobase, nr);
 	
-	if(active) *active= 0;
+	if (active) *active= 0;
 	
-	if(uel) {
-		if(active && uel==curundo)
+	if (uel) {
+		if (active && uel==curundo)
 			*active= 1;
 		return uel->name;
 	}
@@ -685,7 +690,7 @@ char *BKE_undo_menu_string(void)
 
 	BLI_dynstr_append(ds, "Global Undo History %t");
 	
-	for(uel= undobase.first; uel; uel= uel->next) {
+	for (uel= undobase.first; uel; uel= uel->next) {
 		BLI_dynstr_append(ds, "|");
 		BLI_dynstr_append(ds, uel->name);
 	}
@@ -704,34 +709,34 @@ void BKE_undo_save_quit(void)
 	int file;
 	char str[FILE_MAX];
 	
-	if( (U.uiflag & USER_GLOBALUNDO)==0) return;
+	if ( (U.uiflag & USER_GLOBALUNDO)==0) return;
 	
 	uel= curundo;
-	if(uel==NULL) {
+	if (uel==NULL) {
 		printf("No undo buffer to save recovery file\n");
 		return;
 	}
 	
 	/* no undo state to save */
-	if(undobase.first==undobase.last) return;
+	if (undobase.first==undobase.last) return;
 		
 	BLI_make_file_string("/", str, BLI_temporary_dir(), "quit.blend");
 
-	file = open(str,O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666);
-	if(file == -1) {
+	file = BLI_open(str,O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666);
+	if (file == -1) {
 		//XXX error("Unable to save %s, check you have permissions", str);
 		return;
 	}
 
 	chunk= uel->memfile.chunks.first;
-	while(chunk) {
-		if( write(file, chunk->buf, chunk->size) != chunk->size) break;
+	while (chunk) {
+		if ( write(file, chunk->buf, chunk->size) != chunk->size) break;
 		chunk= chunk->next;
 	}
 	
 	close(file);
 	
-	if(chunk) ; //XXX error("Unable to save %s, internal error", str);
+	if (chunk) ; //XXX error("Unable to save %s, internal error", str);
 	else printf("Saved session recovery to %s\n", str);
 }
 
@@ -741,9 +746,9 @@ Main *BKE_undo_get_main(Scene **scene)
 	Main *mainp= NULL;
 	BlendFileData *bfd= BLO_read_from_memfile(G.main, G.main->name, &curundo->memfile, NULL);
 	
-	if(bfd) {
+	if (bfd) {
 		mainp= bfd->main;
-		if(scene)
+		if (scene)
 			*scene= bfd->curscene;
 		
 		MEM_freeN(bfd);
diff --git a/source/blender/blenkernel/intern/bmesh_private.h b/source/blender/blenkernel/intern/bmesh_private.h
deleted file mode 100644
index d0b0388..0000000
--- a/source/blender/blenkernel/intern/bmesh_private.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * BME_private.h    jan 2007
- *
- *	low level, 'private' function prototypes for bmesh kernel.
- *
- *
- * ***** 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) 2004 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): Geoffrey Bantle.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/blenkernel/intern/bmesh_private.h
- *  \ingroup bke
- */
-
-
-#ifndef BMESH_PRIVATE
-#define BMESH_PRIVATE
-
-#include "BKE_bmesh.h"
-
-/*ALLOCATION/DEALLOCATION*/
-struct BME_Vert *BME_addvertlist(struct BME_Mesh *bm, struct BME_Vert *example);
-struct BME_Edge *BME_addedgelist(struct BME_Mesh *bm, struct BME_Vert *v1, struct BME_Vert *v2, struct BME_Edge *example);
-struct BME_Poly *BME_addpolylist(struct BME_Mesh *bm, struct BME_Poly *example); 
-struct BME_Loop *BME_create_loop(struct BME_Mesh *bm, struct BME_Vert *v, struct BME_Edge *e, struct BME_Poly *f, struct BME_Loop *example);
-
-void BME_free_vert(struct BME_Mesh *bm, struct BME_Vert *v);
-void BME_free_edge(struct BME_Mesh *bm, struct BME_Edge *e);
-void BME_free_poly(struct BME_Mesh *bm, struct BME_Poly *f);
-void BME_free_loop(struct BME_Mesh *bm, struct BME_Loop *l);
-
-/*DOUBLE CIRCULAR LINKED LIST FUNCTIONS*/
-void BME_cycle_append(void *h, void *nt);
-int BME_cycle_remove(void *h, void *remn);
-int BME_cycle_validate(int len, void *h);
-/*DISK CYCLE MANAGMENT*/
-int BME_disk_append_edge(struct BME_Edge *e, struct BME_Vert *v);
-void BME_disk_remove_edge(struct BME_Edge *e, struct BME_Vert *v);
-/*RADIAL CYCLE MANAGMENT*/
-void BME_radial_append(struct BME_Edge *e, struct BME_Loop *l);
-void BME_radial_remove_loop(struct BME_Loop *l, struct BME_Edge *e);
-
-/*MISC FUNCTIONS*/
-int BME_edge_swapverts(struct BME_Edge *e, struct BME_Vert *orig, struct BME_Vert *new); /*relink edge*/
-int BME_disk_hasedge(struct BME_Vert *v, struct BME_Edge *e);
-
-/*Error reporting. Shouldnt be called by tools ever.*/
-void BME_error(void);
-#endif
diff --git a/source/blender/blenkernel/intern/bmfont.c b/source/blender/blenkernel/intern/bmfont.c
index 0211dcd..04ac6cb 100644
--- a/source/blender/blenkernel/intern/bmfont.c
+++ b/source/blender/blenkernel/intern/bmfont.c
@@ -138,14 +138,14 @@ void readBitmapFontVersion0(ImBuf * ibuf, unsigned char * rect, int step)
 			bmfont->glyphs[i].sizey    = buffer[index++];
 			bmfont->glyphs[i].advance  = buffer[index++];
 			bmfont->glyphs[i].reserved = buffer[index++];
-			if (G.f & G_DEBUG) {
+			if (G.debug & G_DEBUG) {
 				printfGlyph(&bmfont->glyphs[i]);
 			}
 		}
 		
 		MEM_freeN(buffer);
 		
-		if (G.f & G_DEBUG) {
+		if (G.debug & G_DEBUG) {
 			printf("Oldy = %d Newy = %d\n", ibuf->y, ibuf->y - ysize);
 			printf("glyphcount = %d\n", glyphcount);
 			printf("bytes = %d\n", bytes);
@@ -163,7 +163,8 @@ void readBitmapFontVersion0(ImBuf * ibuf, unsigned char * rect, int step)
 			// we're going to fake alpha here:
 			calcAlpha(ibuf);
 		}
-	} else {
+	}
+	else {
 		printf("readBitmapFontVersion0: corrupted bitmapfont\n");
 	}
 }
@@ -183,7 +184,8 @@ void detectBitmapFont(ImBuf *ibuf)
 				// printf("found 8bit font !\n");
 				// round y size down
 				// do the 8 bit font stuff. (not yet)
-			} else {
+			}
+			else {
 				// we try all 4 possible combinations
 				for (i = 0; i < 4; i++) {
 					if (rect[0] == 'B' && rect[4] == 'F' && rect[8] == 'N' && rect[12] == 'T') {
@@ -194,7 +196,8 @@ void detectBitmapFont(ImBuf *ibuf)
 						
 						if (version == 0) {
 							readBitmapFontVersion0(ibuf, rect, 4);
-						} else {
+						}
+						else {
 							printf("detectBitmapFont :Unsupported version %d\n", version);
 						}
 						
@@ -223,10 +226,12 @@ int locateGlyph(bmFont *bmfont, unsigned short unicode)
 
 			if (bmfont->glyphs[current].unicode == unicode) {
 				break;
-			} else if (bmfont->glyphs[current].unicode < unicode) {
+			}
+			else if (bmfont->glyphs[current].unicode < unicode) {
 				// have to move up
 				min = current;
-			} else {
+			}
+			else {
 				// have to move down
 				max = current;
 			}
@@ -281,7 +286,7 @@ void matrixGlyph(ImBuf * ibuf, unsigned short unicode,
 				*advance = 2.0f * bmfont->glyphs[index].advance / (float) bmfont->glyphs[0].advance;
 
 				// printfGlyph(&bmfont->glyphs[index]);
-				// printf("%c %d %0.5f %0.5f %0.5f %0.5f %0.5f \n", unicode, index, *sizex, *sizey, *transx, *transy, *advance);
+				// printf("%c %d %0.5f %0.5f %0.5f %0.5f %0.5f\n", unicode, index, *sizex, *sizey, *transx, *transy, *advance);
 			}
 		}
 	}
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c
index d454bef..a556c99 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -83,15 +83,15 @@ static int rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val,
 	pd_point_from_particle(bbd->sim, pa, &pa->state, &epoint);
 
 	/* first find out goal/predator with highest priority */
-	if(effectors) for(cur = effectors->first; cur; cur=cur->next) {
+	if (effectors) for (cur = effectors->first; cur; cur=cur->next) {
 		Object *eob = cur->ob;
 		PartDeflect *pd = cur->pd;
 
-		if(gabr->ob && (rule->type != eBoidRuleType_Goal || gabr->ob != bpa->ground)) {
-			if(gabr->ob == eob) {
+		if (gabr->ob && (rule->type != eBoidRuleType_Goal || gabr->ob != bpa->ground)) {
+			if (gabr->ob == eob) {
 				/* TODO: effectors with multiple points */
-				if(get_effector_data(cur, &efd, &epoint, 0)) {
-					if(cur->pd && cur->pd->forcefield == PFIELD_BOID)
+				if (get_effector_data(cur, &efd, &epoint, 0)) {
+					if (cur->pd && cur->pd->forcefield == PFIELD_BOID)
 						priority = mul * pd->f_strength * effector_falloff(cur, &efd, &epoint, bbd->part->effector_weights);
 					else
 						priority = 1.0;
@@ -101,21 +101,21 @@ static int rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val,
 				break;
 			}
 		}
-		else if(rule->type == eBoidRuleType_Goal && eob == bpa->ground)
+		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)) {
+		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)
+			if (temp == 0.0f)
 				; /* do nothing */
-			else if(temp > priority) {
+			else if (temp > priority) {
 				priority = temp;
 				eff = cur;
 				efd = cur_efd;
 				len = efd.distance;
 			}
 			/* choose closest object with same priority */
-			else if(temp == priority && efd.distance < len) {
+			else if (temp == priority && efd.distance < len) {
 				eff = cur;
 				efd = cur_efd;
 				len = efd.distance;
@@ -124,7 +124,7 @@ static int rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val,
 	}
 
 	/* if the object doesn't have effector data we have to fake it */
-	if(eff == NULL && gabr->ob) {
+	if (eff == NULL && gabr->ob) {
 		memset(&temp_eff, 0, sizeof(EffectorCache));
 		temp_eff.ob = gabr->ob;
 		temp_eff.scene = bbd->sim->scene;
@@ -134,12 +134,12 @@ static int rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val,
 	}
 
 	/* then use that effector */
-	if(priority > (rule->type==eBoidRuleType_Avoid ? gabr->fear_factor : 0.0f)) { /* with avoid, factor is "fear factor" */
+	if (priority > (rule->type==eBoidRuleType_Avoid ? gabr->fear_factor : 0.0f)) { /* with avoid, factor is "fear factor" */
 		Object *eob = eff->ob;
 		PartDeflect *pd = eff->pd;
 		float surface = (pd && pd->shape == PFIELD_SHAPE_SURFACE) ? 1.0f : 0.0f;
 
-		if(gabr->options & BRULE_GOAL_AVOID_PREDICT) {
+		if (gabr->options & BRULE_GOAL_AVOID_PREDICT) {
 			/* estimate future location of target */
 			get_effector_data(eff, &efd, &epoint, 1);
 
@@ -149,14 +149,14 @@ static int rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val,
 			efd.distance = len_v3(efd.vec_to_point);
 		}
 
-		if(rule->type == eBoidRuleType_Goal && boids->options & BOID_ALLOW_CLIMB && surface!=0.0f) {
-			if(!bbd->goal_ob || bbd->goal_priority < priority) {
+		if (rule->type == eBoidRuleType_Goal && boids->options & BOID_ALLOW_CLIMB && surface!=0.0f) {
+			if (!bbd->goal_ob || bbd->goal_priority < priority) {
 				bbd->goal_ob = eob;
 				copy_v3_v3(bbd->goal_co, efd.loc);
 				copy_v3_v3(bbd->goal_nor, efd.nor);
 			}
 		}
-		else if(rule->type == eBoidRuleType_Avoid && bpa->data.mode == eBoidMode_Climbing &&
+		else if (rule->type == eBoidRuleType_Avoid && bpa->data.mode == eBoidMode_Climbing &&
 			priority > 2.0f * gabr->fear_factor) {
 			/* detach from surface and try to fly away from danger */
 			negate_v3_v3(efd.vec_to_point, bpa->gravity);
@@ -168,12 +168,12 @@ static int rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val,
 		bbd->wanted_speed = val->max_speed * priority;
 
 		/* with goals factor is approach velocity factor */
-		if(rule->type == eBoidRuleType_Goal && boids->landing_smoothness > 0.0f) {
+		if (rule->type == eBoidRuleType_Goal && boids->landing_smoothness > 0.0f) {
 			float len2 = 2.0f*len_v3(pa->prev_state.vel);
 
 			surface *= pa->size * boids->height;
 
-			if(len2 > 0.0f && efd.distance - surface < len2) {
+			if (len2 > 0.0f && efd.distance - surface < len2) {
 				len2 = (efd.distance - surface)/len2;
 				bbd->wanted_speed *= powf(len2, boids->landing_smoothness);
 			}
@@ -199,7 +199,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
 	int ret = 0;
 
 	//check deflector objects first
-	if(acbr->options & BRULE_ACOLL_WITH_DEFLECTORS && bbd->sim->colliders) {
+	if (acbr->options & BRULE_ACOLL_WITH_DEFLECTORS && bbd->sim->colliders) {
 		ParticleCollision col;
 		BVHTreeRayHit hit;
 		float radius = val->personal_space * pa->size, ray_dir[3];
@@ -213,23 +213,23 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
 		hit.dist = col.original_ray_length = len_v3(ray_dir);
 
 		/* find out closest deflector object */
-		for(coll = bbd->sim->colliders->first; coll; coll=coll->next) {
+		for (coll = bbd->sim->colliders->first; coll; coll=coll->next) {
 			/* don't check with current ground object */
-			if(coll->ob == bpa->ground)
+			if (coll->ob == bpa->ground)
 				continue;
 
 			col.current = coll->ob;
 			col.md = coll->collmd;
 
-			if(col.md && col.md->bvhtree)
+			if (col.md && col.md->bvhtree)
 				BLI_bvhtree_ray_cast(col.md->bvhtree, col.co1, ray_dir, radius, &hit, BKE_psys_collision_neartest_cb, &col);
 		}
 		/* then avoid that object */
-		if(hit.index>=0) {
+		if (hit.index>=0) {
 			t = hit.dist/col.original_ray_length;
 
 			/* avoid head-on collision */
-			if(dot_v3v3(col.pce.nor, pa->prev_state.ave) < -0.99f) {
+			if (dot_v3v3(col.pce.nor, pa->prev_state.ave) < -0.99f) {
 				/* don't know why, but uneven range [0.0,1.0] */
 				/* works much better than even [-1.0,1.0] */
 				bbd->wanted_co[0] = BLI_frand();
@@ -250,10 +250,9 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
 	}
 
 	//check boids in own system
-	if(acbr->options & BRULE_ACOLL_WITH_BOIDS)
-	{
+	if (acbr->options & BRULE_ACOLL_WITH_BOIDS) {
 		neighbors = BLI_kdtree_range_search(bbd->sim->psys->tree, acbr->look_ahead * len_v3(pa->prev_state.vel), pa->prev_state.co, pa->prev_state.ave, &ptn);
-		if(neighbors > 1) for(n=1; n<neighbors; n++) {
+		if (neighbors > 1) for (n=1; n<neighbors; n++) {
 			copy_v3_v3(co1, pa->prev_state.co);
 			copy_v3_v3(vel1, pa->prev_state.vel);
 			copy_v3_v3(co2, (bbd->sim->psys->particles + ptn[n].index)->prev_state.co);
@@ -266,10 +265,10 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
 			inp = dot_v3v3(vec,vec);
 
 			/* velocities not parallel */
-			if(inp != 0.0f) {
+			if (inp != 0.0f) {
 				t = -dot_v3v3(loc, vec)/inp;
 				/* cpa is not too far in the future so investigate further */
-				if(t > 0.0f && t < t_min) {
+				if (t > 0.0f && t < t_min) {
 					madd_v3_v3fl(co1, vel1, t);
 					madd_v3_v3fl(co2, vel2, t);
 					
@@ -278,7 +277,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
 					len = normalize_v3(vec);
 
 					/* distance of cpa is close enough */
-					if(len < 2.0f * val->personal_space * pa->size) {
+					if (len < 2.0f * val->personal_space * pa->size) {
 						t_min = t;
 
 						mul_v3_fl(vec, len_v3(vel1));
@@ -291,15 +290,15 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
 			}
 		}
 	}
-	if(ptn){ MEM_freeN(ptn); ptn=NULL; }
+	if (ptn) { MEM_freeN(ptn); ptn=NULL; }
 
 	/* check boids in other systems */
-	for(pt=bbd->sim->psys->targets.first; pt; pt=pt->next) {
+	for (pt=bbd->sim->psys->targets.first; pt; pt=pt->next) {
 		ParticleSystem *epsys = psys_get_target_system(bbd->sim->ob, pt);
 
-		if(epsys) {
+		if (epsys) {
 			neighbors = BLI_kdtree_range_search(epsys->tree, acbr->look_ahead * len_v3(pa->prev_state.vel), pa->prev_state.co, pa->prev_state.ave, &ptn);
-			if(neighbors > 0) for(n=0; n<neighbors; n++) {
+			if (neighbors > 0) for (n=0; n<neighbors; n++) {
 				copy_v3_v3(co1, pa->prev_state.co);
 				copy_v3_v3(vel1, pa->prev_state.vel);
 				copy_v3_v3(co2, (epsys->particles + ptn[n].index)->prev_state.co);
@@ -312,10 +311,10 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
 				inp = dot_v3v3(vec,vec);
 
 				/* velocities not parallel */
-				if(inp != 0.0f) {
+				if (inp != 0.0f) {
 					t = -dot_v3v3(loc, vec)/inp;
 					/* cpa is not too far in the future so investigate further */
-					if(t > 0.0f && t < t_min) {
+					if (t > 0.0f && t < t_min) {
 						madd_v3_v3fl(co1, vel1, t);
 						madd_v3_v3fl(co2, vel2, t);
 						
@@ -324,7 +323,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
 						len = normalize_v3(vec);
 
 						/* distance of cpa is close enough */
-						if(len < 2.0f * val->personal_space * pa->size) {
+						if (len < 2.0f * val->personal_space * pa->size) {
 							t_min = t;
 
 							mul_v3_fl(vec, len_v3(vel1));
@@ -337,12 +336,12 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
 				}
 			}
 
-			if(ptn){ MEM_freeN(ptn); ptn=NULL; }
+			if (ptn) { MEM_freeN(ptn); ptn=NULL; }
 		}
 	}
 
 
-	if(ptn && nearest==0)
+	if (ptn && nearest==0)
 		MEM_freeN(ptn);
 
 	return ret;
@@ -356,7 +355,7 @@ static int rule_separate(BoidRule *UNUSED(rule), BoidBrainData *bbd, BoidValues
 	int neighbors = BLI_kdtree_range_search(bbd->sim->psys->tree, 2.0f * val->personal_space * pa->size, pa->prev_state.co, NULL, &ptn);
 	int ret = 0;
 
-	if(neighbors > 1 && ptn[1].dist!=0.0f) {
+	if (neighbors > 1 && ptn[1].dist!=0.0f) {
 		sub_v3_v3v3(vec, pa->prev_state.co, bbd->sim->psys->particles[ptn[1].index].state.co);
 		mul_v3_fl(vec, (2.0f * val->personal_space * pa->size - ptn[1].dist) / ptn[1].dist);
 		add_v3_v3(bbd->wanted_co, vec);
@@ -364,16 +363,16 @@ static int rule_separate(BoidRule *UNUSED(rule), BoidBrainData *bbd, BoidValues
 		len = ptn[1].dist;
 		ret = 1;
 	}
-	if(ptn){ MEM_freeN(ptn); ptn=NULL; }
+	if (ptn) { MEM_freeN(ptn); ptn=NULL; }
 
 	/* check other boid systems */
-	for(pt=bbd->sim->psys->targets.first; pt; pt=pt->next) {
+	for (pt=bbd->sim->psys->targets.first; pt; pt=pt->next) {
 		ParticleSystem *epsys = psys_get_target_system(bbd->sim->ob, pt);
 
-		if(epsys) {
+		if (epsys) {
 			neighbors = BLI_kdtree_range_search(epsys->tree, 2.0f * val->personal_space * pa->size, pa->prev_state.co, NULL, &ptn);
 			
-			if(neighbors > 0 && ptn[0].dist < len) {
+			if (neighbors > 0 && ptn[0].dist < len) {
 				sub_v3_v3v3(vec, pa->prev_state.co, ptn[0].co);
 				mul_v3_fl(vec, (2.0f * val->personal_space * pa->size - ptn[0].dist) / ptn[1].dist);
 				add_v3_v3(bbd->wanted_co, vec);
@@ -382,7 +381,7 @@ static int rule_separate(BoidRule *UNUSED(rule), BoidBrainData *bbd, BoidValues
 				ret = 1;
 			}
 
-			if(ptn){ MEM_freeN(ptn); ptn=NULL; }
+			if (ptn) { MEM_freeN(ptn); ptn=NULL; }
 		}
 	}
 	return ret;
@@ -395,8 +394,8 @@ static int rule_flock(BoidRule *UNUSED(rule), BoidBrainData *bbd, BoidValues *UN
 	int n;
 	int ret = 0;
 
-	if(neighbors > 1) {
-		for(n=1; n<neighbors; n++) {
+	if (neighbors > 1) {
+		for (n=1; n<neighbors; n++) {
 			add_v3_v3(loc, bbd->sim->psys->particles[ptn[n].index].prev_state.co);
 			add_v3_v3(vec, bbd->sim->psys->particles[ptn[n].index].prev_state.vel);
 		}
@@ -423,7 +422,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
 	int n = (flbr->queue_size <= 1) ? bbd->sim->psys->totpart : flbr->queue_size;
 	int i, ret = 0, p = pa - bbd->sim->psys->particles;
 
-	if(flbr->ob) {
+	if (flbr->ob) {
 		float vec2[3], t;
 
 		/* first check we're not blocking the leader*/
@@ -435,10 +434,10 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
 		mul = dot_v3v3(vec, vec);
 
 		/* leader is not moving */
-		if(mul < 0.01f) {
+		if (mul < 0.01f) {
 			len = len_v3(loc);
 			/* too close to leader */
-			if(len < 2.0f * val->personal_space * pa->size) {
+			if (len < 2.0f * val->personal_space * pa->size) {
 				copy_v3_v3(bbd->wanted_co, loc);
 				bbd->wanted_speed = val->max_speed;
 				return 1;
@@ -448,7 +447,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
 			t = dot_v3v3(loc, vec)/mul;
 
 			/* possible blocking of leader in near future */
-			if(t > 0.0f && t < 3.0f) {
+			if (t > 0.0f && t < 3.0f) {
 				copy_v3_v3(vec2, vec);
 				mul_v3_fl(vec2, t);
 
@@ -456,7 +455,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
 
 				len = len_v3(vec2);
 
-				if(len < 2.0f * val->personal_space * pa->size) {
+				if (len < 2.0f * val->personal_space * pa->size) {
 					copy_v3_v3(bbd->wanted_co, vec2);
 					bbd->wanted_speed = val->max_speed * (3.0f - t)/3.0f;
 					return 1;
@@ -465,7 +464,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
 		}
 
 		/* not blocking so try to follow leader */
-		if(p && flbr->options & BRULE_LEADER_IN_LINE) {
+		if (p && flbr->options & BRULE_LEADER_IN_LINE) {
 			copy_v3_v3(vec, bbd->sim->psys->particles[p-1].prev_state.vel);
 			copy_v3_v3(loc, bbd->sim->psys->particles[p-1].prev_state.co);
 		}
@@ -483,11 +482,11 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
 			
 		ret = 1;
 	}
-	else if(p % n) {
+	else if (p % n) {
 		float vec2[3], t, t_min = 3.0f;
 
 		/* first check we're not blocking any leaders */
-		for(i = 0; i< bbd->sim->psys->totpart; i+=n){
+		for (i = 0; i< bbd->sim->psys->totpart; i+=n) {
 			copy_v3_v3(vec, bbd->sim->psys->particles[i].prev_state.vel);
 
 			sub_v3_v3v3(loc, pa->prev_state.co, bbd->sim->psys->particles[i].prev_state.co);
@@ -495,10 +494,10 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
 			mul = dot_v3v3(vec, vec);
 
 			/* leader is not moving */
-			if(mul < 0.01f) {
+			if (mul < 0.01f) {
 				len = len_v3(loc);
 				/* too close to leader */
-				if(len < 2.0f * val->personal_space * pa->size) {
+				if (len < 2.0f * val->personal_space * pa->size) {
 					copy_v3_v3(bbd->wanted_co, loc);
 					bbd->wanted_speed = val->max_speed;
 					return 1;
@@ -508,7 +507,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
 				t = dot_v3v3(loc, vec)/mul;
 
 				/* possible blocking of leader in near future */
-				if(t > 0.0f && t < t_min) {
+				if (t > 0.0f && t < t_min) {
 					copy_v3_v3(vec2, vec);
 					mul_v3_fl(vec2, t);
 
@@ -516,7 +515,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
 
 					len = len_v3(vec2);
 
-					if(len < 2.0f * val->personal_space * pa->size) {
+					if (len < 2.0f * val->personal_space * pa->size) {
 						t_min = t;
 						copy_v3_v3(bbd->wanted_co, loc);
 						bbd->wanted_speed = val->max_speed * (3.0f - t)/3.0f;
@@ -526,10 +525,10 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
 			}
 		}
 
-		if(ret) return 1;
+		if (ret) return 1;
 
 		/* not blocking so try to follow leader */
-		if(flbr->options & BRULE_LEADER_IN_LINE) {
+		if (flbr->options & BRULE_LEADER_IN_LINE) {
 			copy_v3_v3(vec, bbd->sim->psys->particles[p-1].prev_state.vel);
 			copy_v3_v3(loc, bbd->sim->psys->particles[p-1].prev_state.co);
 		}
@@ -555,7 +554,7 @@ static int rule_average_speed(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
 	BoidRuleAverageSpeed *asbr = (BoidRuleAverageSpeed*)rule;
 	float vec[3] = {0.0f, 0.0f, 0.0f};
 
-	if(asbr->wander > 0.0f) {
+	if (asbr->wander > 0.0f) {
 		/* abuse pa->r_ave for wandering */
 		bpa->wander[0] += asbr->wander * (-1.0f + 2.0f * BLI_frand());
 		bpa->wander[1] += asbr->wander * (-1.0f + 2.0f * BLI_frand());
@@ -574,7 +573,7 @@ static int rule_average_speed(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
 		add_v3_v3(bbd->wanted_co, vec);
 
 		/* leveling */
-		if(asbr->level > 0.0f && psys_uses_gravity(bbd->sim)) {
+		if (asbr->level > 0.0f && psys_uses_gravity(bbd->sim)) {
 			project_v3_v3v3(vec, bbd->wanted_co, bbd->sim->scene->physics_settings.gravity);
 			mul_v3_fl(vec, asbr->level);
 			sub_v3_v3(bbd->wanted_co, vec);
@@ -584,14 +583,14 @@ static int rule_average_speed(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
 		copy_v3_v3(bbd->wanted_co, pa->prev_state.ave);
 
 		/* may happen at birth */
-		if(dot_v2v2(bbd->wanted_co,bbd->wanted_co)==0.0f) {
+		if (dot_v2v2(bbd->wanted_co,bbd->wanted_co)==0.0f) {
 			bbd->wanted_co[0] = 2.0f*(0.5f - BLI_frand());
 			bbd->wanted_co[1] = 2.0f*(0.5f - BLI_frand());
 			bbd->wanted_co[2] = 2.0f*(0.5f - BLI_frand());
 		}
 		
 		/* leveling */
-		if(asbr->level > 0.0f && psys_uses_gravity(bbd->sim)) {
+		if (asbr->level > 0.0f && psys_uses_gravity(bbd->sim)) {
 			project_v3_v3v3(vec, bbd->wanted_co, bbd->sim->scene->physics_settings.gravity);
 			mul_v3_fl(vec, asbr->level);
 			sub_v3_v3(bbd->wanted_co, vec);
@@ -619,49 +618,49 @@ static int rule_fight(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Parti
 
 	/* calculate own group strength */
 	int neighbors = BLI_kdtree_range_search(bbd->sim->psys->tree, fbr->distance, pa->prev_state.co, NULL, &ptn);
-	for(n=0; n<neighbors; n++) {
+	for (n=0; n<neighbors; n++) {
 		bpa = bbd->sim->psys->particles[ptn[n].index].boid;
 		health += bpa->data.health;
 	}
 
 	f_strength += bbd->part->boids->strength * health;
 
-	if(ptn){ MEM_freeN(ptn); ptn=NULL; }
+	if (ptn) { MEM_freeN(ptn); ptn=NULL; }
 
 	/* add other friendlies and calculate enemy strength and find closest enemy */
-	for(pt=bbd->sim->psys->targets.first; pt; pt=pt->next) {
+	for (pt=bbd->sim->psys->targets.first; pt; pt=pt->next) {
 		ParticleSystem *epsys = psys_get_target_system(bbd->sim->ob, pt);
-		if(epsys) {
+		if (epsys) {
 			epars = epsys->particles;
 
 			neighbors = BLI_kdtree_range_search(epsys->tree, fbr->distance, pa->prev_state.co, NULL, &ptn);
 			
 			health = 0.0f;
 
-			for(n=0; n<neighbors; n++) {
+			for (n=0; n<neighbors; n++) {
 				bpa = epars[ptn[n].index].boid;
 				health += bpa->data.health;
 
-				if(n==0 && pt->mode==PTARGET_MODE_ENEMY && ptn[n].dist < closest_dist) {
+				if (n==0 && pt->mode==PTARGET_MODE_ENEMY && ptn[n].dist < closest_dist) {
 					copy_v3_v3(closest_enemy, ptn[n].co);
 					closest_dist = ptn[n].dist;
 					enemy_pa = epars + ptn[n].index;
 				}
 			}
-			if(pt->mode==PTARGET_MODE_ENEMY)
+			if (pt->mode==PTARGET_MODE_ENEMY)
 				e_strength += epsys->part->boids->strength * health;
-			else if(pt->mode==PTARGET_MODE_FRIEND)
+			else if (pt->mode==PTARGET_MODE_FRIEND)
 				f_strength += epsys->part->boids->strength * health;
 
-			if(ptn){ MEM_freeN(ptn); ptn=NULL; }
+			if (ptn) { MEM_freeN(ptn); ptn=NULL; }
 		}
 	}
 	/* decide action if enemy presence found */
-	if(e_strength > 0.0f) {
+	if (e_strength > 0.0f) {
 		sub_v3_v3v3(bbd->wanted_co, closest_enemy, pa->prev_state.co);
 
 		/* attack if in range */
-		if(closest_dist <= bbd->part->boids->range + pa->size + enemy_pa->size) {
+		if (closest_dist <= bbd->part->boids->range + pa->size + enemy_pa->size) {
 			float damage = BLI_frand();
 			float enemy_dir[3];
 
@@ -671,7 +670,7 @@ static int rule_fight(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Parti
 			bbd->wanted_speed = 0.0f;
 
 			/* must face enemy to fight */
-			if(dot_v3v3(pa->prev_state.ave, enemy_dir)>0.5f) {
+			if (dot_v3v3(pa->prev_state.ave, enemy_dir)>0.5f) {
 				bpa = enemy_pa->boid;
 				bpa->data.health -= bbd->part->boids->strength * bbd->timestep * ((1.0f-bbd->part->boids->accuracy)*damage + bbd->part->boids->accuracy);
 			}
@@ -683,9 +682,9 @@ static int rule_fight(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Parti
 
 		/* check if boid doesn't want to fight */
 		bpa = pa->boid;
-		if(bpa->data.health/bbd->part->boids->health * bbd->part->boids->aggression < e_strength / f_strength) {
+		if (bpa->data.health/bbd->part->boids->health * bbd->part->boids->aggression < e_strength / f_strength) {
 			/* decide to flee */
-			if(closest_dist < fbr->flee_distance * fbr->distance) {
+			if (closest_dist < fbr->flee_distance * fbr->distance) {
 				negate_v3(bbd->wanted_co);
 				bbd->wanted_speed = val->max_speed;
 			}
@@ -723,7 +722,7 @@ static void set_boid_values(BoidValues *val, BoidSettings *boids, ParticleData *
 {
 	BoidParticle *bpa = pa->boid;
 
-	if(ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing)) {
+	if (ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing)) {
 		val->max_speed = boids->land_max_speed * bpa->data.health/boids->health;
 		val->max_acc = boids->land_max_acc * val->max_speed;
 		val->max_ave = boids->land_max_ave * (float)M_PI * bpa->data.health/boids->health;
@@ -745,7 +744,7 @@ static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float grou
 {
 	BoidParticle *bpa = pa->boid;
 
-	if(bpa->data.mode == eBoidMode_Climbing) {
+	if (bpa->data.mode == eBoidMode_Climbing) {
 		SurfaceModifierData *surmd = NULL;
 		float x[3], v[3];
 		
@@ -767,7 +766,7 @@ static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float grou
 		BVHTreeRayHit hit;
 		float radius = 0.0f, t, ray_dir[3];
 
-		if(!bbd->sim->colliders)
+		if (!bbd->sim->colliders)
 			return NULL;
 
 		/* first try to find below boid */
@@ -779,16 +778,16 @@ static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float grou
 		hit.dist = col.original_ray_length = len_v3(ray_dir);
 		col.pce.inside = 0;
 
-		for(coll = bbd->sim->colliders->first; coll; coll = coll->next){
+		for (coll = bbd->sim->colliders->first; coll; coll = coll->next) {
 			col.current = coll->ob;
 			col.md = coll->collmd;
 			col.fac1 = col.fac2 = 0.f;
 
-			if(col.md && col.md->bvhtree)
+			if (col.md && col.md->bvhtree)
 				BLI_bvhtree_ray_cast(col.md->bvhtree, col.co1, ray_dir, radius, &hit, BKE_psys_collision_neartest_cb, &col);
 		}
 		/* then use that object */
-		if(hit.index>=0) {
+		if (hit.index>=0) {
 			t = hit.dist/col.original_ray_length;
 			interp_v3_v3v3(ground_co, col.co1, col.co2, t);
 			normalize_v3_v3(ground_nor, col.pce.nor);
@@ -804,15 +803,15 @@ static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float grou
 		hit.index = -1;
 		hit.dist = col.original_ray_length = len_v3(ray_dir);
 
-		for(coll = bbd->sim->colliders->first; coll; coll = coll->next){
+		for (coll = bbd->sim->colliders->first; coll; coll = coll->next) {
 			col.current = coll->ob;
 			col.md = coll->collmd;
 
-			if(col.md && col.md->bvhtree)
+			if (col.md && col.md->bvhtree)
 				BLI_bvhtree_ray_cast(col.md->bvhtree, col.co1, ray_dir, radius, &hit, BKE_psys_collision_neartest_cb, &col);
 		}
 		/* then use that object */
-		if(hit.index>=0) {
+		if (hit.index>=0) {
 			t = hit.dist/col.original_ray_length;
 			interp_v3_v3v3(ground_co, col.co1, col.co2, t);
 			normalize_v3_v3(ground_nor, col.pce.nor);
@@ -831,13 +830,13 @@ static int boid_rule_applies(ParticleData *pa, BoidSettings *UNUSED(boids), Boid
 {
 	BoidParticle *bpa = pa->boid;
 
-	if(rule==NULL)
+	if (rule==NULL)
 		return 0;
 	
-	if(ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing) && rule->flag & BOIDRULE_ON_LAND)
+	if (ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing) && rule->flag & BOIDRULE_ON_LAND)
 		return 1;
 	
-	if(bpa->data.mode==eBoidMode_InAir && rule->flag & BOIDRULE_IN_AIR)
+	if (bpa->data.mode==eBoidMode_InAir && rule->flag & BOIDRULE_IN_AIR)
 		return 1;
 
 	return 0;
@@ -846,12 +845,12 @@ void boids_precalc_rules(ParticleSettings *part, float cfra)
 {
 	BoidState *state = part->boids->states.first;
 	BoidRule *rule;
-	for(; state; state=state->next) {
-		for(rule = state->rules.first; rule; rule=rule->next) {
-			if(rule->type==eBoidRuleType_FollowLeader) {
+	for (; state; state=state->next) {
+		for (rule = state->rules.first; rule; rule=rule->next) {
+			if (rule->type==eBoidRuleType_FollowLeader) {
 				BoidRuleFollowLeader *flbr = (BoidRuleFollowLeader*) rule;
 
-				if(flbr->ob && flbr->cfra != cfra) {
+				if (flbr->ob && flbr->cfra != cfra) {
 					/* save object locations for velocity calculations */
 					copy_v3_v3(flbr->oloc, flbr->loc);
 					copy_v3_v3(flbr->loc, flbr->ob->obmat[3]);
@@ -890,16 +889,16 @@ static float boid_goal_signed_dist(float *boid_co, float *goal_co, float *goal_n
 /* wanted_co is relative to boid location */
 static int apply_boid_rule(BoidBrainData *bbd, BoidRule *rule, BoidValues *val, ParticleData *pa, float fuzziness)
 {
-	if(rule==NULL)
+	if (rule==NULL)
 		return 0;
 
-	if(boid_rule_applies(pa, bbd->part->boids, rule)==0)
+	if (boid_rule_applies(pa, bbd->part->boids, rule)==0)
 		return 0;
 
-	if(boid_rules[rule->type](rule, bbd, val, pa)==0)
+	if (boid_rules[rule->type](rule, bbd, val, pa)==0)
 		return 0;
 
-	if(fuzziness < 0.0f || compare_len_v3v3(bbd->wanted_co, pa->prev_state.vel, fuzziness * len_v3(pa->prev_state.vel))==0)
+	if (fuzziness < 0.0f || compare_len_v3v3(bbd->wanted_co, pa->prev_state.vel, fuzziness * len_v3(pa->prev_state.vel))==0)
 		return 1;
 	else
 		return 0;
@@ -909,14 +908,14 @@ static BoidState *get_boid_state(BoidSettings *boids, ParticleData *pa)
 	BoidState *state = boids->states.first;
 	BoidParticle *bpa = pa->boid;
 
-	for(; state; state=state->next) {
-		if(state->id==bpa->data.state_id)
+	for (; state; state=state->next) {
+		if (state->id==bpa->data.state_id)
 			return state;
 	}
 
 	/* for some reason particle isn't at a valid state */
 	state = boids->states.first;
-	if(state)
+	if (state)
 		bpa->data.state_id = state->id;
 
 	return state;
@@ -938,7 +937,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
 	int rand;
 	//BoidCondition *cond;
 
-	if(bpa->data.health <= 0.0f) {
+	if (bpa->data.health <= 0.0f) {
 		pa->alive = PARS_DYING;
 		pa->dietime = bbd->cfra;
 		return;
@@ -946,8 +945,8 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
 
 	//planned for near future
 	//cond = state->conditions.first;
-	//for(; cond; cond=cond->next) {
-	//	if(boid_condition_is_true(cond)) {
+	//for (; cond; cond=cond->next) {
+	//	if (boid_condition_is_true(cond)) {
 	//		pa->boid->state_id = cond->state_id;
 	//		state = get_boid_state(boids, pa);
 	//		break; /* only first true condition is used */
@@ -966,8 +965,8 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
 	switch(state->ruleset_type) {
 		case eBoidRulesetType_Fuzzy:
 		{
-			for(rule = state->rules.first; rule; rule = rule->next) {
-				if(apply_boid_rule(bbd, rule, &val, pa, state->rule_fuzziness))
+			for (rule = state->rules.first; rule; rule = rule->next) {
+				if (apply_boid_rule(bbd, rule, &val, pa, state->rule_fuzziness))
 					break; /* only first nonzero rule that comes through fuzzy rule is applied */
 			}
 			break;
@@ -983,8 +982,8 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
 		{
 			float wanted_co[3] = {0.0f, 0.0f, 0.0f}, wanted_speed = 0.0f;
 			int n = 0;
-			for(rule = state->rules.first; rule; rule=rule->next) {
-				if(apply_boid_rule(bbd, rule, &val, pa, -1.0f)) {
+			for (rule = state->rules.first; rule; rule=rule->next) {
+				if (apply_boid_rule(bbd, rule, &val, pa, -1.0f)) {
 					add_v3_v3(wanted_co, bbd->wanted_co);
 					wanted_speed += bbd->wanted_speed;
 					n++;
@@ -992,7 +991,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
 				}
 			}
 
-			if(n > 1) {
+			if (n > 1) {
 				mul_v3_fl(wanted_co, 1.0f/(float)n);
 				wanted_speed /= (float)n;
 			}
@@ -1005,11 +1004,11 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
 	}
 
 	/* decide on jumping & liftoff */
-	if(bpa->data.mode == eBoidMode_OnLand) {
+	if (bpa->data.mode == eBoidMode_OnLand) {
 		/* fuzziness makes boids capable of misjudgement */
 		float mul = 1.0f + state->rule_fuzziness;
 		
-		if(boids->options & BOID_ALLOW_FLIGHT && bbd->wanted_co[2] > 0.0f) {
+		if (boids->options & BOID_ALLOW_FLIGHT && bbd->wanted_co[2] > 0.0f) {
 			float cvel[3], dir[3];
 
 			copy_v3_v3(dir, pa->prev_state.ave);
@@ -1018,15 +1017,15 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
 			copy_v3_v3(cvel, bbd->wanted_co);
 			normalize_v2(cvel);
 
-			if(dot_v2v2(cvel, dir) > 0.95f / mul)
+			if (dot_v2v2(cvel, dir) > 0.95f / mul)
 				bpa->data.mode = eBoidMode_Liftoff;
 		}
-		else if(val.jump_speed > 0.0f) {
+		else if (val.jump_speed > 0.0f) {
 			float jump_v[3];
 			int jump = 0;
 
 			/* jump to get to a location */
-			if(bbd->wanted_co[2] > 0.0f) {
+			if (bbd->wanted_co[2] > 0.0f) {
 				float cvel[3], dir[3];
 				float z_v, ground_v, cur_v;
 				float len;
@@ -1041,7 +1040,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
 
 				/* first of all, are we going in a suitable direction? */
 				/* or at a suitably slow speed */
-				if(dot_v2v2(cvel, dir) > 0.95f / mul || len <= state->rule_fuzziness) {
+				if (dot_v2v2(cvel, dir) > 0.95f / mul || len <= state->rule_fuzziness) {
 					/* try to reach goal at highest point of the parabolic path */
 					cur_v = len_v2(pa->prev_state.vel);
 					z_v = sasqrt(-2.0f * bbd->sim->scene->physics_settings.gravity[2] * bbd->wanted_co[2]);
@@ -1049,7 +1048,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
 
 					len = sasqrt((ground_v-cur_v)*(ground_v-cur_v) + z_v*z_v);
 
-					if(len < val.jump_speed * mul || bbd->part->boids->options & BOID_ALLOW_FLIGHT) {
+					if (len < val.jump_speed * mul || bbd->part->boids->options & BOID_ALLOW_FLIGHT) {
 						jump = 1;
 
 						len = MIN2(len, val.jump_speed);
@@ -1066,11 +1065,11 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
 			}
 
 			/* jump to go faster */
-			if(jump == 0 && val.jump_speed > val.max_speed && bbd->wanted_speed > val.max_speed) {
+			if (jump == 0 && val.jump_speed > val.max_speed && bbd->wanted_speed > val.max_speed) {
 				
 			}
 
-			if(jump) {
+			if (jump) {
 				copy_v3_v3(pa->prev_state.vel, jump_v);
 				bpa->data.mode = eBoidMode_Falling;
 			}
@@ -1099,14 +1098,14 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 	/* make sure there's something in new velocity, location & rotation */
 	copy_particle_key(&pa->state,&pa->prev_state,0);
 
-	if(bbd->part->flag & PART_SIZEMASS)
+	if (bbd->part->flag & PART_SIZEMASS)
 		pa_mass*=pa->size;
 
 	/* if boids can't fly they fall to the ground */
-	if((boids->options & BOID_ALLOW_FLIGHT)==0 && ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing)==0 && psys_uses_gravity(bbd->sim))
+	if ((boids->options & BOID_ALLOW_FLIGHT)==0 && ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing)==0 && psys_uses_gravity(bbd->sim))
 		bpa->data.mode = eBoidMode_Falling;
 
-	if(bpa->data.mode == eBoidMode_Falling) {
+	if (bpa->data.mode == eBoidMode_Falling) {
 		/* Falling boids are only effected by gravity. */
 		acc[2] = bbd->sim->scene->physics_settings.gravity[2];
 	}
@@ -1116,11 +1115,11 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 		float level = landing_level + 1.0f;
 		float new_vel[3];
 
-		if(bpa->data.mode == eBoidMode_Liftoff) {
+		if (bpa->data.mode == eBoidMode_Liftoff) {
 			bpa->data.mode = eBoidMode_InAir;
 			bpa->ground = boid_find_ground(bbd, pa, ground_co, ground_nor);
 		}
-		else if(bpa->data.mode == eBoidMode_InAir && boids->options & BOID_ALLOW_LAND) {
+		else if (bpa->data.mode == eBoidMode_InAir && boids->options & BOID_ALLOW_LAND) {
 			/* auto-leveling & landing if close to ground */
 
 			bpa->ground = boid_find_ground(bbd, pa, ground_co, ground_nor);
@@ -1130,13 +1129,13 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 
 			landing_level = - boids->landing_smoothness * pa->prev_state.vel[2] * pa_mass;
 
-			if(pa->prev_state.vel[2] < 0.0f) {
-				if(level < 1.0f) {
+			if (pa->prev_state.vel[2] < 0.0f) {
+				if (level < 1.0f) {
 					bbd->wanted_co[0] = bbd->wanted_co[1] = bbd->wanted_co[2] = 0.0f;
 					bbd->wanted_speed = 0.0f;
 					bpa->data.mode = eBoidMode_Falling;
 				}
-				else if(level < landing_level) {
+				else if (level < landing_level) {
 					bbd->wanted_speed *= (level - 1.0f)/landing_level;
 					bbd->wanted_co[2] *= (level - 1.0f)/landing_level;
 				}
@@ -1147,7 +1146,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 		new_speed = normalize_v3_v3(wanted_dir, bbd->wanted_co);
 
 		/* first check if we have valid direction we want to go towards */
-		if(new_speed == 0.0f) {
+		if (new_speed == 0.0f) {
 			copy_v3_v3(new_dir, old_dir);
 		}
 		else {
@@ -1159,7 +1158,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 
 			/* choose random direction to turn if wanted velocity */
 			/* is directly behind regardless of z-coordinate */
-			if(dot_v2v2(old_dir2, wanted_dir2) < -0.99f) {
+			if (dot_v2v2(old_dir2, wanted_dir2) < -0.99f) {
 				wanted_dir[0] = 2.0f*(0.5f - BLI_frand());
 				wanted_dir[1] = 2.0f*(0.5f - BLI_frand());
 				wanted_dir[2] = 2.0f*(0.5f - BLI_frand());
@@ -1186,7 +1185,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 		/* constrain speed with maximum acceleration */
 		old_speed = len_v3(pa->prev_state.vel);
 		
-		if(bbd->wanted_speed < old_speed)
+		if (bbd->wanted_speed < old_speed)
 			new_speed = MAX2(bbd->wanted_speed, old_speed - val.max_acc);
 		else
 			new_speed = MIN2(bbd->wanted_speed, old_speed + val.max_acc);
@@ -1196,7 +1195,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 		mul_v3_fl(new_vel, new_speed);
 
 		/* maintain minimum flying velocity if not landing */
-		if(level >= landing_level) {
+		if (level >= landing_level) {
 			float len2 = dot_v2v2(new_vel,new_vel);
 			float root;
 
@@ -1225,7 +1224,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 	pd_point_from_particle(bbd->sim, pa, &pa->state, &epoint);
 	pdDoEffectors(bbd->sim->psys->effectors, bbd->sim->colliders, bbd->part->effector_weights, &epoint, force, NULL);
 
-	if(ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing)) {
+	if (ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing)) {
 		float length = normalize_v3(force);
 
 		length = MAX2(0.0f, length - boids->land_stick_force);
@@ -1255,7 +1254,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 
 	madd_v3_v3fl(pa->state.vel, acc, dtime);
 
-	//if(bpa->data.mode != eBoidMode_InAir)
+	//if (bpa->data.mode != eBoidMode_InAir)
 	bpa->ground = boid_find_ground(bbd, pa, ground_co, ground_nor);
 
 	/* change modes, constrain movement & keep track of down vector */
@@ -1269,7 +1268,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 			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) {
+			if (dot_v3v3(bpa->data.acc, pa->state.vel) > 0.0f) {
 				project_v3_v3v3(dvec, bpa->data.acc, pa->state.vel);
 				sub_v3_v3v3(dvec, bpa->data.acc, dvec);
 			}
@@ -1282,21 +1281,21 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 			normalize_v3(bpa->gravity);
 
 			/* stick boid on goal when close enough */
-			if(bbd->goal_ob && boid_goal_signed_dist(pa->state.co, bbd->goal_co, bbd->goal_nor) <= pa->size * boids->height) {
+			if (bbd->goal_ob && boid_goal_signed_dist(pa->state.co, bbd->goal_co, bbd->goal_nor) <= pa->size * boids->height) {
 				bpa->data.mode = eBoidMode_Climbing;
 				bpa->ground = bbd->goal_ob;
 				boid_find_ground(bbd, pa, ground_co, ground_nor);
 				boid_climb(boids, pa, ground_co, ground_nor);
 			}
-			else if(pa->state.co[2] <= ground_co[2] + pa->size * boids->height) {
+			else if (pa->state.co[2] <= ground_co[2] + pa->size * boids->height) {
 				/* land boid when below ground */
-				if(boids->options & BOID_ALLOW_LAND) {
+				if (boids->options & BOID_ALLOW_LAND) {
 					pa->state.co[2] = ground_co[2] + pa->size * boids->height;
 					pa->state.vel[2] = 0.0f;
 					bpa->data.mode = eBoidMode_OnLand;
 				}
 				/* fly above ground */
-				else if(bpa->ground) {
+				else if (bpa->ground) {
 					pa->state.co[2] = ground_co[2] + pa->size * boids->height;
 					pa->state.vel[2] = 0.0f;
 				}
@@ -1316,22 +1315,22 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 			madd_v3_v3fl(bpa->gravity, grav, dtime);
 			normalize_v3(bpa->gravity);
 
-			if(boids->options & BOID_ALLOW_LAND) {
+			if (boids->options & BOID_ALLOW_LAND) {
 				/* stick boid on goal when close enough */
-				if(bbd->goal_ob && boid_goal_signed_dist(pa->state.co, bbd->goal_co, bbd->goal_nor) <= pa->size * boids->height) {
+				if (bbd->goal_ob && boid_goal_signed_dist(pa->state.co, bbd->goal_co, bbd->goal_nor) <= pa->size * boids->height) {
 					bpa->data.mode = eBoidMode_Climbing;
 					bpa->ground = bbd->goal_ob;
 					boid_find_ground(bbd, pa, ground_co, ground_nor);
 					boid_climb(boids, pa, ground_co, ground_nor);
 				}
 				/* land boid when really near ground */
-				else if(pa->state.co[2] <= ground_co[2] + 1.01f * pa->size * boids->height){
+				else if (pa->state.co[2] <= ground_co[2] + 1.01f * pa->size * boids->height) {
 					pa->state.co[2] = ground_co[2] + pa->size * boids->height;
 					pa->state.vel[2] = 0.0f;
 					bpa->data.mode = eBoidMode_OnLand;
 				}
 				/* if we're falling, can fly and want to go upwards lets fly */
-				else if(boids->options & BOID_ALLOW_FLIGHT && bbd->wanted_co[2] > 0.0f)
+				else if (boids->options & BOID_ALLOW_FLIGHT && bbd->wanted_co[2] > 0.0f)
 					bpa->data.mode = eBoidMode_InAir;
 			}
 			else
@@ -1360,14 +1359,14 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 		case eBoidMode_OnLand:
 		{
 			/* stick boid on goal when close enough */
-			if(bbd->goal_ob && boid_goal_signed_dist(pa->state.co, bbd->goal_co, bbd->goal_nor) <= pa->size * boids->height) {
+			if (bbd->goal_ob && boid_goal_signed_dist(pa->state.co, bbd->goal_co, bbd->goal_nor) <= pa->size * boids->height) {
 				bpa->data.mode = eBoidMode_Climbing;
 				bpa->ground = bbd->goal_ob;
 				boid_find_ground(bbd, pa, ground_co, ground_nor);
 				boid_climb(boids, pa, ground_co, ground_nor);
 			}
 			/* ground is too far away so boid falls */
-			else if(pa->state.co[2]-ground_co[2] > 1.1f * pa->size * boids->height)
+			else if (pa->state.co[2]-ground_co[2] > 1.1f * pa->size * boids->height)
 				bpa->data.mode = eBoidMode_Falling;
 			else {
 				/* constrain to surface */
@@ -1375,7 +1374,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 				pa->state.vel[2] = 0.0f;
 			}
 
-			if(boids->banking > 0.0f) {
+			if (boids->banking > 0.0f) {
 				float grav[3];
 				/* Don't take gravity's strength in to account, */
 				/* otherwise amount of banking is hard to control. */
@@ -1399,18 +1398,18 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 
 	/* save direction to state.ave unless the boid is falling */
 	/* (boids can't effect their direction when falling) */
-	if(bpa->data.mode!=eBoidMode_Falling && len_v3(pa->state.vel) > 0.1f*pa->size) {
+	if (bpa->data.mode!=eBoidMode_Falling && len_v3(pa->state.vel) > 0.1f*pa->size) {
 		copy_v3_v3(pa->state.ave, pa->state.vel);
 		pa->state.ave[2] *= bbd->part->boids->pitch;
 		normalize_v3(pa->state.ave);
 	}
 
 	/* apply damping */
-	if(ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing))
+	if (ELEM(bpa->data.mode, eBoidMode_OnLand, eBoidMode_Climbing))
 		mul_v3_fl(pa->state.vel, 1.0f - 0.2f*bbd->part->dampfac);
 
 	/* calculate rotation matrix based on forward & down vectors */
-	if(bpa->data.mode == eBoidMode_InAir) {
+	if (bpa->data.mode == eBoidMode_InAir) {
 		copy_v3_v3(mat[0], pa->state.ave);
 
 		project_v3_v3v3(dvec, bpa->gravity, pa->state.ave);
@@ -1435,7 +1434,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 BoidRule *boid_new_rule(int type)
 {
 	BoidRule *rule = NULL;
-	if(type <= 0)
+	if (type <= 0)
 		return NULL;
 
 	switch(type) {
@@ -1502,7 +1501,7 @@ BoidState *boid_new_state(BoidSettings *boids)
 	BoidState *state = MEM_callocN(sizeof(BoidState), "BoidState");
 
 	state->id = boids->last_state_id++;
-	if(state->id)
+	if (state->id)
 		BLI_snprintf(state->name, sizeof(state->name), "State %i", state->id);
 	else
 		strcpy(state->name, "State");
@@ -1528,10 +1527,10 @@ BoidState *boid_duplicate_state(BoidSettings *boids, BoidState *state)
 }
 void boid_free_settings(BoidSettings *boids)
 {
-	if(boids) {
+	if (boids) {
 		BoidState *state = boids->states.first;
 
-		for(; state; state=state->next) {
+		for (; state; state=state->next) {
 			BLI_freelistN(&state->rules);
 			BLI_freelistN(&state->conditions);
 			BLI_freelistN(&state->actions);
@@ -1546,7 +1545,7 @@ BoidSettings *boid_copy_settings(BoidSettings *boids)
 {
 	BoidSettings *nboids = NULL;
 
-	if(boids) {
+	if (boids) {
 		BoidState *state;
 		BoidState *nstate;
 
@@ -1556,7 +1555,7 @@ BoidSettings *boid_copy_settings(BoidSettings *boids)
 
 		state = boids->states.first;
 		nstate = nboids->states.first;
-		for(; state; state=state->next, nstate=nstate->next) {
+		for (; state; state=state->next, nstate=nstate->next) {
 			BLI_duplicatelist(&nstate->rules, &state->rules);
 			BLI_duplicatelist(&nstate->conditions, &state->conditions);
 			BLI_duplicatelist(&nstate->actions, &state->actions);
@@ -1569,8 +1568,8 @@ BoidState *boid_get_current_state(BoidSettings *boids)
 {
 	BoidState *state = boids->states.first;
 
-	for(; state; state=state->next) {
-		if(state->flag & BOIDSTATE_CURRENT)
+	for (; state; state=state->next) {
+		if (state->flag & BOIDSTATE_CURRENT)
 			break;
 	}
 
diff --git a/source/blender/blenkernel/intern/booleanops_mesh.c b/source/blender/blenkernel/intern/booleanops_mesh.c
index 8dbf2c1..31c90d5 100644
--- a/source/blender/blenkernel/intern/booleanops_mesh.c
+++ b/source/blender/blenkernel/intern/booleanops_mesh.c
@@ -45,7 +45,7 @@
 	void
 CSG_DestroyMeshDescriptor(
 	CSG_MeshDescriptor *mesh
-){
+) {
 	// Call mesh descriptors destroy function....
 	mesh->m_destroy_func(mesh);
 }
@@ -66,7 +66,7 @@ static
 	void
 CSG_DestroyCSGMeshInternals(
 	CSG_MeshDescriptor *mesh
-){
+) {
 	CSG_FreeVertexDescriptor(&(mesh->m_vertex_iterator));
 	CSG_FreeFaceDescriptor(&(mesh->m_face_iterator));
 }
@@ -102,7 +102,7 @@ MakeCSGMeshFromBlenderBase(
 CSG_LoadBlenderMesh(
 	Object * obj,
 	CSG_MeshDescriptor *output
-){
+) {
 
 	Mesh *me;
 	if (output == NULL || obj == NULL) return 0;
@@ -132,7 +132,7 @@ CSG_LoadBlenderMesh(
 	int
 CSG_AddMeshToBlender(
 	CSG_MeshDescriptor *mesh
-){
+) {
 	Mesh *me_new = NULL;
 	Object *ob_new = NULL;
 	float inv_mat[4][4];
@@ -172,7 +172,7 @@ CSG_PerformOp(
 	CSG_MeshDescriptor *mesh2,
 	int int_op_type,
 	CSG_MeshDescriptor *output
-){
+) {
 
 	CSG_OperationType op_type;
 	CSG_BooleanOperation * bool_op = CSG_NewBooleanFunction();
@@ -208,7 +208,8 @@ CSG_PerformOp(
 			mesh2->m_vertex_iterator,		
 			InterpFaceVertexData	
 		);
-	} else {
+	}
+	else {
 		success = 
 		CSG_PerformBooleanOperation(
 			bool_op,
@@ -241,7 +242,7 @@ NewBooleanMeshTest(
 	struct Base * base,
 	struct Base * base_select,
 	int op_type
-){
+) {
 
 	CSG_MeshDescriptor m1,m2,output;
 	CSG_MeshDescriptor output2,output3;
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index f2514c1..e7ba09d 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -197,23 +197,23 @@ void make_local_brush(Brush *brush)
 	Scene *scene;
 	int is_local= FALSE, is_lib= FALSE;
 
-	if(brush->id.lib==NULL) return;
+	if (brush->id.lib==NULL) return;
 
-	if(brush->clone.image) {
+	if (brush->clone.image) {
 		/* special case: ima always local immediately. Clone image should only
-		   have one user anyway. */
+		 * have one user anyway. */
 		id_clear_lib_data(bmain, &brush->clone.image->id);
 		extern_local_brush(brush);
 	}
 
-	for(scene= bmain->scene.first; scene && ELEM(0, is_lib, is_local); scene=scene->id.next) {
-		if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) {
-			if(scene->id.lib) is_lib= TRUE;
+	for (scene= bmain->scene.first; scene && ELEM(0, is_lib, is_local); scene=scene->id.next) {
+		if (paint_brush(&scene->toolsettings->imapaint.paint)==brush) {
+			if (scene->id.lib) is_lib= TRUE;
 			else is_local= TRUE;
 		}
 	}
 
-	if(is_local && is_lib == FALSE) {
+	if (is_local && is_lib == FALSE) {
 		id_clear_lib_data(bmain, &brush->id);
 		extern_local_brush(brush);
 
@@ -223,7 +223,7 @@ void make_local_brush(Brush *brush)
 			brush->id.us++;
 		}
 	}
-	else if(is_local && is_lib) {
+	else if (is_local && is_lib) {
 		Brush *brush_new= copy_brush(brush);
 		brush_new->id.us= 1; /* only keep fake user */
 		brush_new->id.flag |= LIB_FAKEUSER;
@@ -231,9 +231,9 @@ void make_local_brush(Brush *brush)
 		/* Remap paths of new ID using old library as base. */
 		BKE_id_lib_local_paths(bmain, brush->id.lib, &brush_new->id);
 		
-		for(scene= bmain->scene.first; scene; scene=scene->id.next) {
-			if(paint_brush(&scene->toolsettings->imapaint.paint)==brush) {
-				if(scene->id.lib==NULL) {
+		for (scene= bmain->scene.first; scene; scene=scene->id.next) {
+			if (paint_brush(&scene->toolsettings->imapaint.paint)==brush) {
+				if (scene->id.lib==NULL) {
 					paint_brush_set(&scene->toolsettings->imapaint.paint, brush_new);
 				}
 			}
@@ -248,13 +248,13 @@ void brush_debug_print_state(Brush *br)
 	brush_set_defaults(&def);
 	
 #define BR_TEST(field, t)					\
-	if(br->field != def.field)				\
+	if (br->field != def.field)				\
 		printf("br->" #field " = %" #t ";\n", br->field)
 
 #define BR_TEST_FLAG(_f)				\
-	if((br->flag & _f) && !(def.flag & _f))		\
+	if ((br->flag & _f) && !(def.flag & _f))		\
 		printf("br->flag |= " #_f ";\n");	\
-	else if(!(br->flag & _f) && (def.flag & _f))	\
+	else if (!(br->flag & _f) && (def.flag & _f))	\
 		printf("br->flag &= ~" #_f ";\n")
 	
 
@@ -331,10 +331,8 @@ void brush_debug_print_state(Brush *br)
 void brush_reset_sculpt(Brush *br)
 {
 	/* enable this to see any non-default
-	   settings used by a brush:
-
-	brush_debug_print_state(br);
-	*/
+	 * settings used by a brush: */
+	// brush_debug_print_state(br);
 
 	brush_set_defaults(br);
 	brush_curve_preset(br, CURVE_PRESET_SMOOTH);
@@ -414,7 +412,7 @@ void brush_curve_preset(Brush *b, /*CurveMappingPreset*/int preset)
 {
 	CurveMap *cm = NULL;
 
-	if(!b->curve)
+	if (!b->curve)
 		b->curve = curvemapping_add(1, 0, 0, 1, 1);
 
 	cm = b->curve->cm;
@@ -432,12 +430,12 @@ int brush_texture_set_nr(Brush *brush, int nr)
 	id= (ID *)brush->mtex.tex;
 
 	idtest= (ID*)BLI_findlink(&G.main->tex, nr-1);
-	if(idtest==NULL) { /* new tex */
-		if(id) idtest= (ID *)copy_texture((Tex *)id);
+	if (idtest==NULL) { /* new tex */
+		if (id) idtest= (ID *)copy_texture((Tex *)id);
 		else idtest= (ID *)add_texture("Tex");
 		idtest->us--;
 	}
-	if(idtest!=id) {
+	if (idtest!=id) {
 		brush_texture_delete(brush);
 
 		brush->mtex.tex= (Tex*)idtest;
@@ -451,7 +449,7 @@ int brush_texture_set_nr(Brush *brush, int nr)
 
 int brush_texture_delete(Brush *brush)
 {
-	if(brush->mtex.tex)
+	if (brush->mtex.tex)
 		brush->mtex.tex->id.us--;
 
 	return 1;
@@ -459,10 +457,10 @@ int brush_texture_delete(Brush *brush)
 
 int brush_clone_image_set_nr(Brush *brush, int nr)
 {
-	if(brush && nr > 0) {
+	if (brush && nr > 0) {
 		Image *ima= (Image*)BLI_findlink(&G.main->image, nr-1);
 
-		if(ima) {
+		if (ima) {
 			brush_clone_image_delete(brush);
 			brush->clone.image= ima;
 			id_us_plus(&ima->id);
@@ -543,7 +541,7 @@ void brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texfall,
 
 	if (flt) {
 		copy_v3_v3(brush_rgb, brush->rgb);
-		if(use_color_correction){
+		if (use_color_correction) {
 			srgb_to_linearrgb_v3_v3(brush_rgb, brush_rgb);
 		}
 
@@ -719,7 +717,7 @@ void brush_scale_unprojected_radius(float *unprojected_radius,
 {
 	float scale = new_brush_size;
 	/* avoid division by zero */
-	if(old_brush_size != 0)
+	if (old_brush_size != 0)
 		scale /= (float)old_brush_size;
 	(*unprojected_radius) *= scale;
 }
@@ -731,7 +729,7 @@ void brush_scale_size(int *brush_size,
 {
 	float scale = new_unprojected_radius;
 	/* avoid division by zero */
-	if(old_unprojected_radius != 0)
+	if (old_unprojected_radius != 0)
 		scale /= new_unprojected_radius;
 	(*brush_size)= (int)((float)(*brush_size) * scale);
 }
@@ -833,7 +831,9 @@ void brush_painter_free(BrushPainter *painter)
 	MEM_freeN(painter);
 }
 
-static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf, int x, int y, int w, int h, int xt, int yt, float *pos)
+static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf,
+                                     int x, int y, int w, int h, int xt, int yt,
+                                     const float pos[2])
 {
 	Scene *scene= painter->scene;
 	Brush *brush= painter->brush;
@@ -855,8 +855,8 @@ static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf, i
 	dotexold = (oldtexibuf != NULL);
 
 	/* 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) */
+	 * 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);
 
@@ -923,7 +923,7 @@ static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf, i
 	}
 }
 
-static void brush_painter_fixed_tex_partial_update(BrushPainter *painter, float *pos)
+static void brush_painter_fixed_tex_partial_update(BrushPainter *painter, const float pos[2])
 {
 	const Scene *scene= painter->scene;
 	Brush *brush= painter->brush;
@@ -978,7 +978,7 @@ static void brush_painter_fixed_tex_partial_update(BrushPainter *painter, float
 		brush_painter_do_partial(painter, NULL, x1, y2, x2, ibuf->y, 0, 0, pos);
 }
 
-static void brush_painter_refresh_cache(BrushPainter *painter, float *pos, int use_color_correction)
+static void brush_painter_refresh_cache(BrushPainter *painter, const float pos[2], int use_color_correction)
 {
 	const Scene *scene= painter->scene;
 	Brush *brush= painter->brush;
@@ -1042,15 +1042,15 @@ static void brush_apply_pressure(BrushPainter *painter, Brush *brush, float pres
 		brush->spacing = MAX2(1.0f, painter->startspacing*(1.5f-pressure));
 }
 
-void brush_jitter_pos(const Scene *scene, Brush *brush, float pos[2], float jitterpos[2])
+void brush_jitter_pos(const Scene *scene, Brush *brush, const float pos[2], float jitterpos[2])
 {
 	int use_jitter= brush->jitter != 0;
 
 	/* jitter-ed brush gives weird and unpredictable result for this
-	   kinds of stroke, so manyally disable jitter usage (sergey) */
-	use_jitter&= (brush->flag & (BRUSH_RESTORE_MESH|BRUSH_ANCHORED)) == 0;
+	 * kinds of stroke, so manyally disable jitter usage (sergey) */
+	use_jitter &= (brush->flag & (BRUSH_RESTORE_MESH|BRUSH_ANCHORED)) == 0;
 
-	if(use_jitter){
+	if (use_jitter) {
 		float rand_pos[2];
 		const int radius= brush_size(scene, brush);
 		const int diameter= 2*radius;
@@ -1069,14 +1069,15 @@ void brush_jitter_pos(const Scene *scene, Brush *brush, float pos[2], float jitt
 	}
 }
 
-int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, double time, float pressure, void *user, int use_color_correction)
+int brush_painter_paint(BrushPainter *painter, BrushFunc func, const float pos[2], double time, float pressure,
+                        void *user, int use_color_correction)
 {
 	Scene *scene= painter->scene;
 	Brush *brush= painter->brush;
 	int totpaintops= 0;
 
 	if (pressure == 0.0f) {
-		if(painter->lastpressure) // XXX - hack, operator misses
+		if (painter->lastpressure) // XXX - hack, operator misses
 			pressure= painter->lastpressure;
 		else
 			pressure = 1.0f;	/* zero pressure == not using tablet */
@@ -1136,7 +1137,7 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl
 		const int radius= brush_size(scene, brush);
 
 		/* compute brush spacing adapted to brush radius, spacing may depend
-		   on pressure, so update it */
+		 * on pressure, so update it */
 		brush_apply_pressure(painter, brush, painter->lastpressure);
 		spacing= MAX2(1.0f, radius)*brush->spacing*0.01f;
 
@@ -1171,7 +1172,8 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl
 				painter->accumdistance -= spacing;
 				startdistance -= spacing;
 			}
-		} else {
+		}
+		else {
 			brush_jitter_pos(scene, brush, pos, finalpos);
 
 			if (painter->cache.enabled)
@@ -1185,8 +1187,8 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl
 		}
 
 		/* do airbrush paint ops, based on the number of paint ops left over
-		   from regular painting. this is a temporary solution until we have
-		   accurate time stamps for mouse move events */
+		 * from regular painting. this is a temporary solution until we have
+		 * accurate time stamps for mouse move events */
 		if (brush->flag & BRUSH_AIRBRUSH) {
 			double curtime= time;
 			double painttime= brush->rate*totpaintops;
@@ -1229,19 +1231,19 @@ int brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, doubl
 /* Uses the brush curve control to find a strength value between 0 and 1 */
 float brush_curve_strength_clamp(Brush *br, float p, const float len)
 {
-	if(p >= len)	return 0;
+	if (p >= len)	return 0;
 	else			p= p/len;
 
 	p= curvemapping_evaluateF(br->curve, 0, p);
-	if(p < 0.0f)		p= 0.0f;
-	else if(p > 1.0f)	p= 1.0f;
+	if (p < 0.0f)		p= 0.0f;
+	else if (p > 1.0f)	p= 1.0f;
 	return p;
 }
 /* same as above but can return negative values if the curve enables
  * used for sculpt only */
 float brush_curve_strength(Brush *br, float p, const float len)
 {
-	if(p >= len)
+	if (p >= len)
 		p= 1.0f;
 	else
 		p= p/len;
@@ -1258,7 +1260,7 @@ unsigned int *brush_gen_texture_cache(Brush *br, int half_side)
 	int hasrgb, ix, iy;
 	int side = half_side * 2;
 	
-	if(mtex->tex) {
+	if (mtex->tex) {
 		float x, y, step = 2.0 / side, co[3];
 
 		texcache = MEM_callocN(sizeof(int) * side * side, "Brush texture cache");
@@ -1279,7 +1281,7 @@ unsigned int *brush_gen_texture_cache(Brush *br, int half_side)
 				 * intensity, so calculate one (formula from do_material_tex).
 				 * if the texture didn't give an RGB value, copy the intensity across
 				 */
-				if(hasrgb & TEX_RGB)
+				if (hasrgb & TEX_RGB)
 					texres.tin = (0.35f * texres.tr + 0.45f *
 								  texres.tg + 0.2f * texres.tb);
 
@@ -1308,17 +1310,17 @@ struct ImBuf *brush_gen_radial_control_imbuf(Brush *br)
 	im->rect_float = MEM_callocN(sizeof(float) * side * side, "radial control rect");
 	im->x = im->y = side;
 
-	for(i=0; i<side; ++i) {
-		for(j=0; j<side; ++j) {
+	for (i=0; i<side; ++i) {
+		for (j=0; j<side; ++j) {
 			float magn= sqrt(pow(i - half, 2) + pow(j - half, 2));
 			im->rect_float[i*side + j]= brush_curve_strength_clamp(br, magn, half);
 		}
 	}
 
 	/* Modulate curve with texture */
-	if(texcache) {
-		for(i=0; i<side; ++i) {
-			for(j=0; j<side; ++j) {
+	if (texcache) {
+		for (i=0; i<side; ++i) {
+			for (j=0; j<side; ++j) {
 				const int col= texcache[i*side+j];
 				im->rect_float[i*side+j]*= (((char*)&col)[0]+((char*)&col)[1]+((char*)&col)[2])/3.0f/255.0f;
 			}
diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c
index 1aad0a2..009b7ca 100644
--- a/source/blender/blenkernel/intern/bvhutils.c
+++ b/source/blender/blenkernel/intern/bvhutils.c
@@ -36,12 +36,11 @@
 
 #include "DNA_meshdata_types.h"
 
-#include "BLI_editVert.h"
 #include "BLI_utildefines.h"
 #include "BLI_linklist.h"
 
 #include "BKE_DerivedMesh.h"
-
+#include "BKE_tessmesh.h"
 
 #include "BLI_math.h"
 #include "MEM_guardedalloc.h"
@@ -52,7 +51,7 @@ float bvhtree_ray_tri_intersection(const BVHTreeRay *ray, const float UNUSED(m_d
 {
 	float dist;
 
-	if(isect_ray_tri_epsilon_v3(ray->origin, ray->direction, v0, v1, v2, &dist, NULL, FLT_EPSILON))
+	if (isect_ray_tri_epsilon_v3(ray->origin, ray->direction, v0, v1, v2, &dist, NULL, FLT_EPSILON))
 		return dist;
 
 	return FLT_MAX;
@@ -68,8 +67,7 @@ static float sphereray_tri_intersection(const BVHTreeRay *ray, float radius, con
 	normal_tri_v3(plane_normal, v0, v1, v2);
 
 	madd_v3_v3v3fl(p1, ray->origin, ray->direction, m_dist);
-	if(isect_sweeping_sphere_tri_v3(ray->origin, p1, radius, v0, v1, v2, &idist, hit_point))
-	{
+	if (isect_sweeping_sphere_tri_v3(ray->origin, p1, radius, v0, v1, v2, &idist, hit_point)) {
 		return idist * m_dist;
 	}
 
@@ -112,24 +110,18 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f
 	S = A01 * B1 - A11 * B0;
 	T = A01 * B0 - A00 * B1;
 
-	if ( S + T <= Det )
-	{
-		if ( S < 0.0f )
-		{
-			if ( T < 0.0f )  // Region 4
-			{
-				if ( B0 < 0.0f )
-				{
+	if (S + T <= Det) {
+		if (S < 0.0f) {
+			if (T < 0.0f) { /* Region 4 */
+				if (B0 < 0.0f) {
 					T = 0.0f;
-					if ( -B0 >= A00 )
-					{
+					if (-B0 >= A00) {
 						S = 1.0f;
 						sqrDist = A00 + 2.0f * B0 + C;
 						lv = 1;
 					}
-					else
-					{
-						if(fabsf(A00) > FLT_EPSILON)
+					else {
+						if (fabsf(A00) > FLT_EPSILON)
 							S = -B0/A00;
 						else
 							S = 0.0f;
@@ -137,24 +129,20 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f
 						le = 0;
 					}
 				}
-				else
-				{
+				else {
 					S = 0.0f;
-					if ( B1 >= 0.0f )
-					{
+					if (B1 >= 0.0f) {
 						T = 0.0f;
 						sqrDist = C;
 						lv = 0;
 					}
-					else if ( -B1 >= A11 )
-					{
+					else if (-B1 >= A11) {
 						T = 1.0f;
 						sqrDist = A11 + 2.0f * B1 + C;
 						lv = 2;
 					}
-					else
-					{
-						if(fabsf(A11) > FLT_EPSILON)
+					else {
+						if (fabsf(A11) > FLT_EPSILON)
 							T = -B1 / A11;
 						else
 							T = 0.0f;
@@ -163,24 +151,20 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f
 					}
 				}
 			}
-			else  // Region 3
-			{
+			else { /* Region 3 */
 				S = 0.0f;
-				if ( B1 >= 0.0f )
-				{
+				if (B1 >= 0.0f) {
 					T = 0.0f;
 					sqrDist = C;
 					lv = 0;
 				}
-				else if ( -B1 >= A11 )
-				{
+				else if (-B1 >= A11) {
 					T = 1.0f;
 					sqrDist = A11 + 2.0f * B1 + C;
 					lv = 2;
 				}
-				else
-				{
-					if(fabsf(A11) > FLT_EPSILON)
+				else {
+					if (fabsf(A11) > FLT_EPSILON)
 						T = -B1 / A11;
 					else
 						T = 0.0;
@@ -189,24 +173,20 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f
 				}
 			}
 		}
-		else if ( T < 0.0f )  // Region 5
-		{
+		else if (T < 0.0f) { /* Region 5 */
 			T = 0.0f;
-			if ( B0 >= 0.0f )
-			{
+			if (B0 >= 0.0f) {
 				S = 0.0f;
 				sqrDist = C;
 				lv = 0;
 			}
-			else if ( -B0 >= A00 )
-			{
+			else if (-B0 >= A00) {
 				S = 1.0f;
 				sqrDist = A00 + 2.0f * B0 + C;
 				lv = 1;
 			}
-			else
-			{
-				if(fabsf(A00) > FLT_EPSILON)
+			else {
+				if (fabsf(A00) > FLT_EPSILON)
 					S = -B0 / A00;
 				else
 					S = 0.0f;
@@ -214,69 +194,59 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f
 				le = 0;
 			}
 		}
-		else  // Region 0
-		{
+		else { /* Region 0 */
 			// Minimum at interior lv
 			float invDet;
-			if(fabsf(Det) > FLT_EPSILON)
+			if (fabsf(Det) > FLT_EPSILON)
 				invDet = 1.0f / Det;
 			else
 				invDet = 0.0f;
 			S *= invDet;
 			T *= invDet;
 			sqrDist = S * ( A00 * S + A01 * T + 2.0f * B0) +
-					T * ( A01 * S + A11 * T + 2.0f * B1 ) + C;
+			          T * ( A01 * S + A11 * T + 2.0f * B1 ) + C;
 		}
 	}
-	else
-	{
+	else {
 		float tmp0, tmp1, numer, denom;
 
-		if ( S < 0.0f )  // Region 2
-		{
+		if (S < 0.0f) { /* Region 2 */
 			tmp0 = A01 + B0;
 			tmp1 = A11 + B1;
-			if ( tmp1 > tmp0 )
-			{
+			if ( tmp1 > tmp0 ) {
 				numer = tmp1 - tmp0;
 				denom = A00 - 2.0f * A01 + A11;
-				if ( numer >= denom )
-				{
+				if ( numer >= denom ) {
 					S = 1.0f;
 					T = 0.0f;
 					sqrDist = A00 + 2.0f * B0 + C;
 					lv = 1;
 				}
-				else
-				{
-					if(fabsf(denom) > FLT_EPSILON)
+				else {
+					if (fabsf(denom) > FLT_EPSILON)
 						S = numer / denom;
 					else
 						S = 0.0f;
 					T = 1.0f - S;
 					sqrDist = S * ( A00 * S + A01 * T + 2.0f * B0 ) +
-							T * ( A01 * S + A11 * T + 2.0f * B1 ) + C;
+					          T * ( A01 * S + A11 * T + 2.0f * B1 ) + C;
 					le = 2;
 				}
 			}
-			else
-			{
+			else {
 				S = 0.0f;
-				if ( tmp1 <= 0.0f )
-				{
+				if ( tmp1 <= 0.0f ) {
 					T = 1.0f;
 					sqrDist = A11 + 2.0f * B1 + C;
 					lv = 2;
 				}
-				else if ( B1 >= 0.0f )
-				{
+				else if (B1 >= 0.0f) {
 					T = 0.0f;
 					sqrDist = C;
 					lv = 0;
 				}
-				else
-				{
-					if(fabsf(A11) > FLT_EPSILON)
+				else {
+					if (fabsf(A11) > FLT_EPSILON)
 						T = -B1 / A11;
 					else
 						T = 0.0f;
@@ -285,51 +255,43 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f
 				}
 			}
 		}
-		else if ( T < 0.0f )  // Region 6
-		{
+		else if (T < 0.0f) { /* Region 6 */
 			tmp0 = A01 + B1;
 			tmp1 = A00 + B0;
-			if ( tmp1 > tmp0 )
-			{
+			if ( tmp1 > tmp0 ) {
 				numer = tmp1 - tmp0;
 				denom = A00 - 2.0f * A01 + A11;
-				if ( numer >= denom )
-				{
+				if ( numer >= denom ) {
 					T = 1.0f;
 					S = 0.0f;
 					sqrDist = A11 + 2.0f * B1 + C;
 					lv = 2;
 				}
-				else
-				{
-					if(fabsf(denom) > FLT_EPSILON)
+				else {
+					if (fabsf(denom) > FLT_EPSILON)
 						T = numer / denom;
 					else
 						T = 0.0f;
 					S = 1.0f - T;
 					sqrDist = S * ( A00 * S + A01 * T + 2.0f * B0 ) +
-							T * ( A01 * S + A11 * T + 2.0f * B1 ) + C;
+					          T * ( A01 * S + A11 * T + 2.0f * B1 ) + C;
 					le = 2;
 				}
 			}
-			else
-			{
+			else {
 				T = 0.0f;
-				if ( tmp1 <= 0.0f )
-				{
+				if (tmp1 <= 0.0f) {
 					S = 1.0f;
 					sqrDist = A00 + 2.0f * B0 + C;
 					lv = 1;
 				}
-				else if ( B0 >= 0.0f )
-				{
+				else if (B0 >= 0.0f) {
 					S = 0.0f;
 					sqrDist = C;
 					lv = 0;
 				}
-				else
-				{
-					if(fabsf(A00) > FLT_EPSILON)
+				else {
+					if (fabsf(A00) > FLT_EPSILON)
 						S = -B0 / A00;
 					else
 						S = 0.0f;
@@ -338,35 +300,30 @@ float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const f
 				}
 			}
 		}
-		else  // Region 1
-		{
+		else { /* Region 1 */
 			numer = A11 + B1 - A01 - B0;
-			if ( numer <= 0.0f )
-			{
+			if ( numer <= 0.0f ) {
 				S = 0.0f;
 				T = 1.0f;
 				sqrDist = A11 + 2.0f * B1 + C;
 				lv = 2;
 			}
-			else
-			{
+			else {
 				denom = A00 - 2.0f * A01 + A11;
-				if ( numer >= denom )
-				{
+				if ( numer >= denom ) {
 					S = 1.0f;
 					T = 0.0f;
 					sqrDist = A00 + 2.0f * B0 + C;
 					lv = 1;
 				}
-				else
-				{
-					if(fabsf(denom) > FLT_EPSILON)
+				else {
+					if (fabsf(denom) > FLT_EPSILON)
 						S = numer / denom;
 					else
 						S = 0.0f;
 					T = 1.0f - S;
 					sqrDist = S * ( A00 * S + A01 * T + 2.0f * B0 ) +
-							T * ( A01 * S + A11 * T + 2.0f * B1 ) + C;
+					          T * ( A01 * S + A11 * T + 2.0f * B1 ) + C;
 					le = 2;
 				}
 			}
@@ -422,8 +379,7 @@ static void mesh_faces_nearest_point(void *userdata, int index, const float co[3
 		int vertex, edge;
 		
 		dist = nearest_point_in_tri_surface(t0, t1, t2, co, &vertex, &edge, nearest_tmp);
-		if(dist < nearest->dist)
-		{
+		if (dist < nearest->dist) {
 			nearest->index = index;
 			nearest->dist = dist;
 			copy_v3_v3(nearest->co, nearest_tmp);
@@ -434,7 +390,7 @@ static void mesh_faces_nearest_point(void *userdata, int index, const float co[3
 		t2 = t3;
 		t3 = NULL;
 
-	} while(t2);
+	} while (t2);
 }
 
 // Callback to bvh tree raycast. The tree must bust have been built using bvhtree_from_mesh_faces.
@@ -455,13 +411,12 @@ static void mesh_faces_spherecast(void *userdata, int index, const BVHTreeRay *r
 	do
 	{	
 		float dist;
-		if(data->sphere_radius == 0.0f)
+		if (data->sphere_radius == 0.0f)
 			dist = bvhtree_ray_tri_intersection(ray, hit->dist, t0, t1, t2);
 		else
 			dist = sphereray_tri_intersection(ray, data->sphere_radius, hit->dist, t0, t1, t2);
 
-		if(dist >= 0 && dist < hit->dist)
-		{
+		if (dist >= 0 && dist < hit->dist) {
 			hit->index = index;
 			hit->dist = dist;
 			madd_v3_v3v3fl(hit->co, ray->origin, ray->direction, dist);
@@ -473,7 +428,7 @@ static void mesh_faces_spherecast(void *userdata, int index, const BVHTreeRay *r
 		t2 = t3;
 		t3 = NULL;
 
-	} while(t2);
+	} while (t2);
 }
 
 // Callback to bvh tree nearest point. The tree must bust have been built using bvhtree_from_mesh_edges.
@@ -492,8 +447,7 @@ static void mesh_edges_nearest_point(void *userdata, int index, const float co[3
 	closest_to_line_segment_v3(nearest_tmp, co, t0, t1);
 	dist = len_squared_v3v3(nearest_tmp, co);
 	
-	if(dist < nearest->dist)
-	{
+	if (dist < nearest->dist) {
 		nearest->index = index;
 		nearest->dist = dist;
 		copy_v3_v3(nearest->co, nearest_tmp);
@@ -511,20 +465,18 @@ BVHTree* bvhtree_from_mesh_verts(BVHTreeFromMesh *data, DerivedMesh *mesh, float
 	BVHTree *tree = bvhcache_find(&mesh->bvhCache, BVHTREE_FROM_VERTICES);
 
 	//Not in cache
-	if(tree == NULL)
-	{
+	if (tree == NULL) {
 		int i;
 		int numVerts= mesh->getNumVerts(mesh);
 		MVert *vert	= mesh->getVertDataArray(mesh, CD_MVERT);
 
-		if(vert != NULL)
-		{
+		if (vert != NULL) {
 			tree = BLI_bvhtree_new(numVerts, epsilon, tree_type, axis);
 
-			if(tree != NULL)
-			{
-				for(i = 0; i < numVerts; i++)
+			if (tree != NULL) {
+				for (i = 0; i < numVerts; i++) {
 					BLI_bvhtree_insert(tree, i, vert[i].co, 1);
+				}
 
 				BLI_bvhtree_balance(tree);
 
@@ -534,8 +486,7 @@ BVHTree* bvhtree_from_mesh_verts(BVHTreeFromMesh *data, DerivedMesh *mesh, float
 			}
 		}
 	}
-	else
-	{
+	else {
 //		printf("BVHTree is already build, using cached tree\n");
 	}
 
@@ -544,8 +495,7 @@ BVHTree* bvhtree_from_mesh_verts(BVHTreeFromMesh *data, DerivedMesh *mesh, float
 	memset(data, 0, sizeof(*data));
 	data->tree = tree;
 
-	if(data->tree)
-	{
+	if (data->tree) {
 		data->cached = TRUE;
 
 		//a NULL nearest callback works fine
@@ -555,7 +505,7 @@ BVHTree* bvhtree_from_mesh_verts(BVHTreeFromMesh *data, DerivedMesh *mesh, float
 
 		data->mesh = mesh;
 		data->vert = mesh->getVertDataArray(mesh, CD_MVERT);
-		data->face = mesh->getFaceDataArray(mesh, CD_MFACE);
+		data->face = mesh->getTessFaceDataArray(mesh, CD_MFACE);
 
 		data->sphere_radius = epsilon;
 	}
@@ -569,48 +519,97 @@ BVHTree* bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float
 	BVHTree *tree = bvhcache_find(&mesh->bvhCache, BVHTREE_FROM_FACES);
 
 	//Not in cache
-	if(tree == NULL)
-	{
+	if (tree == NULL) {
 		int i;
-		int numFaces= mesh->getNumFaces(mesh);
-		MVert *vert	= mesh->getVertDataArray(mesh, CD_MVERT);
-		MFace *face = mesh->getFaceDataArray(mesh, CD_MFACE);
+		int numFaces= mesh->getNumTessFaces(mesh);
+
+		/* BMESH specific check that we have tessfaces,
+		 * we _could_ tessellate here but rather not - campbell
+		 *
+		 * this assert checks we have tessfaces,
+		 * if not caller should use DM_ensure_tessface() */
+		BLI_assert(!(numFaces == 0 && mesh->getNumPolys(mesh) != 0));
 
-		if(vert != NULL && face != NULL)
-		{
+		if (numFaces != 0) {
 			/* Create a bvh-tree of the given target */
 			tree = BLI_bvhtree_new(numFaces, epsilon, tree_type, axis);
-			if(tree != NULL)
-			{
-				/* XXX, for snap only, em & dm are assumed to be aligned, since dm is the em's cage */
-				EditMesh *em= data->em_evil;
-				if(em) {
-					EditFace *efa= em->faces.first;
-					for(i = 0; i < numFaces; i++, efa= efa->next) {
-						if(!(efa->f & 1) && efa->h==0 && !((efa->v1->f&1)+(efa->v2->f&1)+(efa->v3->f&1)+(efa->v4?efa->v4->f&1:0))) {
+			if (tree != NULL) {
+				BMEditMesh *em= data->em_evil;
+				if (em) {
+					/* data->em_evil is only set for snapping, and only for the mesh of the object
+					 * which is currently open in edit mode. When set, the bvhtree should not contain
+					 * faces that will interfere with snapping (e.g. faces that are hidden/selected
+					 * or faces that have selected verts).*/
+
+					/* XXX, for snap only, em & dm are assumed to be aligned, since dm is the em's cage */
+
+					/* Insert BMesh-tessellation triangles into the bvh tree, unless they are hidden
+					 * and/or selected. Even if the faces themselves are not selected for the snapped
+					 * transform, having a vertex selected means the face (and thus it's tessellated
+					 * triangles) will be moving and will not be a good snap targets.*/
+					for (i = 0; i < em->tottri; i++) {
+						BMLoop **tri = em->looptris[i];
+						BMFace *f;
+						BMVert *v;
+						BMIter iter;
+						int insert;
+
+						/* Each loop of the triangle points back to the BMFace it was tessellated from.
+						 * All three should point to the same face, so just use the face from the first
+						 * loop.*/
+						f = tri[0]->f;
+
+						/* If the looptris is ordered such that all triangles tessellated from a single
+						 * faces are consecutive elements in the array, then we could speed up the tests
+						 * below by using the insert value from the previous iteration.*/
+
+						/*Start with the assumption the triangle should be included for snapping.*/
+						insert = 1;
+
+						if (BM_elem_flag_test(f, BM_ELEM_SELECT) || BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
+							/* Don't insert triangles tessellated from faces that are hidden
+							 * or selected*/
+							insert = 0;
+						}
+						else {
+							BM_ITER_ELEM (v, &iter, f, BM_VERTS_OF_FACE) {
+								if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
+									/* Don't insert triangles tessellated from faces that have
+									 * any selected verts.*/
+									insert = 0;
+								}
+							}
+						}
+
+						if (insert) {
+							/* No reason found to block hit-testing the triangle for snap,
+							 * so insert it now.*/
+							float co[4][3];
+							copy_v3_v3(co[0], tri[0]->v->co);
+							copy_v3_v3(co[1], tri[1]->v->co);
+							copy_v3_v3(co[2], tri[2]->v->co);
+					
+							BLI_bvhtree_insert(tree, i, co[0], 3);
+						}
+					}
+				}
+				else {
+					MVert *vert	= mesh->getVertDataArray(mesh, CD_MVERT);
+					MFace *face = mesh->getTessFaceDataArray(mesh, CD_MFACE);
+
+					if (vert != NULL && face != NULL) {
+						for (i = 0; i < numFaces; i++) {
 							float co[4][3];
 							copy_v3_v3(co[0], vert[ face[i].v1 ].co);
 							copy_v3_v3(co[1], vert[ face[i].v2 ].co);
 							copy_v3_v3(co[2], vert[ face[i].v3 ].co);
-							if(face[i].v4)
+							if (face[i].v4)
 								copy_v3_v3(co[3], vert[ face[i].v4 ].co);
 					
 							BLI_bvhtree_insert(tree, i, co[0], face[i].v4 ? 4 : 3);
 						}
 					}
 				}
-				else {
-					for(i = 0; i < numFaces; i++) {
-						float co[4][3];
-						copy_v3_v3(co[0], vert[ face[i].v1 ].co);
-						copy_v3_v3(co[1], vert[ face[i].v2 ].co);
-						copy_v3_v3(co[2], vert[ face[i].v3 ].co);
-						if(face[i].v4)
-							copy_v3_v3(co[3], vert[ face[i].v4 ].co);
-				
-						BLI_bvhtree_insert(tree, i, co[0], face[i].v4 ? 4 : 3);
-					}
-				}
 				BLI_bvhtree_balance(tree);
 
 				//Save on cache for later use
@@ -619,8 +618,7 @@ BVHTree* bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float
 			}
 		}
 	}
-	else
-	{
+	else {
 //		printf("BVHTree is already build, using cached tree\n");
 	}
 
@@ -629,8 +627,7 @@ BVHTree* bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float
 	memset(data, 0, sizeof(*data));
 	data->tree = tree;
 
-	if(data->tree)
-	{
+	if (data->tree) {
 		data->cached = TRUE;
 
 		data->nearest_callback = mesh_faces_nearest_point;
@@ -638,7 +635,7 @@ BVHTree* bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float
 
 		data->mesh = mesh;
 		data->vert = mesh->getVertDataArray(mesh, CD_MVERT);
-		data->face = mesh->getFaceDataArray(mesh, CD_MFACE);
+		data->face = mesh->getTessFaceDataArray(mesh, CD_MFACE);
 
 		data->sphere_radius = epsilon;
 	}
@@ -652,21 +649,18 @@ BVHTree* bvhtree_from_mesh_edges(BVHTreeFromMesh *data, DerivedMesh *mesh, float
 	BVHTree *tree = bvhcache_find(&mesh->bvhCache, BVHTREE_FROM_EDGES);
 
 	//Not in cache
-	if(tree == NULL)
+	if (tree == NULL)
 	{
 		int i;
 		int numEdges= mesh->getNumEdges(mesh);
 		MVert *vert	= mesh->getVertDataArray(mesh, CD_MVERT);
 		MEdge *edge = mesh->getEdgeDataArray(mesh, CD_MEDGE);
 
-		if(vert != NULL && edge != NULL)
-		{
+		if (vert != NULL && edge != NULL) {
 			/* Create a bvh-tree of the given target */
 			tree = BLI_bvhtree_new(numEdges, epsilon, tree_type, axis);
-			if(tree != NULL)
-			{
-				for(i = 0; i < numEdges; i++)
-				{
+			if (tree != NULL) {
+				for (i = 0; i < numEdges; i++) {
 					float co[4][3];
 					copy_v3_v3(co[0], vert[ edge[i].v1 ].co);
 					copy_v3_v3(co[1], vert[ edge[i].v2 ].co);
@@ -691,8 +685,7 @@ BVHTree* bvhtree_from_mesh_edges(BVHTreeFromMesh *data, DerivedMesh *mesh, float
 	memset(data, 0, sizeof(*data));
 	data->tree = tree;
 
-	if(data->tree)
-	{
+	if (data->tree) {
 		data->cached = TRUE;
 
 		data->nearest_callback = mesh_edges_nearest_point;
@@ -711,9 +704,8 @@ BVHTree* bvhtree_from_mesh_edges(BVHTreeFromMesh *data, DerivedMesh *mesh, float
 // Frees data allocated by a call to bvhtree_from_mesh_*.
 void free_bvhtree_from_mesh(struct BVHTreeFromMesh *data)
 {
-	if(data->tree)
-	{
-		if(!data->cached)
+	if (data->tree) {
+		if (!data->cached)
 			BLI_bvhtree_free(data->tree);
 
 		memset( data, 0, sizeof(*data) );
@@ -734,8 +726,7 @@ static void bvhcacheitem_set_if_match(void *_cached, void *_search)
 	BVHCacheItem * cached = (BVHCacheItem *)_cached;
 	BVHCacheItem * search = (BVHCacheItem *)_search;
 
-	if(search->type == cached->type)
-	{
+	if (search->type == cached->type) {
 		search->tree = cached->tree;		
 	}
 } 
@@ -763,7 +754,7 @@ void bvhcache_insert(BVHCache *cache, BVHTree *tree, int type)
 	item->type = type;
 	item->tree = tree;
 
-	BLI_linklist_prepend( cache, item );
+	BLI_linklist_prepend(cache, item);
 }
 
 
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index f55ceab..1280122 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -91,23 +91,23 @@ void make_local_camera(Camera *cam)
 	 * - mixed: make copy
 	 */
 	
-	if(cam->id.lib==NULL) return;
-	if(cam->id.us==1) {
+	if (cam->id.lib==NULL) return;
+	if (cam->id.us==1) {
 		id_clear_lib_data(bmain, &cam->id);
 		return;
 	}
 	
-	for(ob= bmain->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) {
-		if(ob->data==cam) {
-			if(ob->id.lib) is_lib= TRUE;
+	for (ob= bmain->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) {
+		if (ob->data==cam) {
+			if (ob->id.lib) is_lib= TRUE;
 			else is_local= TRUE;
 		}
 	}
 	
-	if(is_local && is_lib == FALSE) {
+	if (is_local && is_lib == FALSE) {
 		id_clear_lib_data(bmain, &cam->id);
 	}
-	else if(is_local && is_lib) {
+	else if (is_local && is_lib) {
 		Camera *cam_new= copy_camera(cam);
 
 		cam_new->id.us= 0;
@@ -115,9 +115,9 @@ void make_local_camera(Camera *cam)
 		/* Remap paths of new ID using old library as base. */
 		BKE_id_lib_local_paths(bmain, cam->id.lib, &cam_new->id);
 
-		for(ob= bmain->object.first; ob; ob= ob->id.next) {
-			if(ob->data == cam) {
-				if(ob->id.lib==NULL) {
+		for (ob= bmain->object.first; ob; ob= ob->id.next) {
+			if (ob->data == cam) {
+				if (ob->id.lib==NULL) {
 					ob->data= cam_new;
 					cam_new->id.us++;
 					cam->id.us--;
@@ -138,10 +138,10 @@ void object_camera_mode(RenderData *rd, Object *cam_ob)
 {
 	rd->mode &= ~(R_ORTHO|R_PANORAMA);
 
-	if(cam_ob && cam_ob->type==OB_CAMERA) {
+	if (cam_ob && cam_ob->type==OB_CAMERA) {
 		Camera *cam= cam_ob->data;
-		if(cam->type == CAM_ORTHO) rd->mode |= R_ORTHO;
-		if(cam->flag & CAM_PANORAMA) rd->mode |= R_PANORAMA;
+		if (cam->type == CAM_ORTHO) rd->mode |= R_ORTHO;
+		if (cam->flag & CAM_PANORAMA) rd->mode |= R_PANORAMA;
 	}
 }
 
@@ -168,7 +168,7 @@ float object_camera_dof_distance(Object *ob)
 float camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y)
 {
 	/* sensor size used to fit to. for auto, sensor_x is both x and y. */
-	if(sensor_fit == CAMERA_SENSOR_FIT_VERT)
+	if (sensor_fit == CAMERA_SENSOR_FIT_VERT)
 		return sensor_y;
 
 	return sensor_x;
@@ -176,8 +176,8 @@ float camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y)
 
 int camera_sensor_fit(int sensor_fit, float sizex, float sizey)
 {
-	if(sensor_fit == CAMERA_SENSOR_FIT_AUTO) {
-		if(sizex >= sizey)
+	if (sensor_fit == CAMERA_SENSOR_FIT_AUTO) {
+		if (sizex >= sizey)
 			return CAMERA_SENSOR_FIT_HOR;
 		else
 			return CAMERA_SENSOR_FIT_VERT;
@@ -202,14 +202,14 @@ void camera_params_init(CameraParams *params)
 
 void camera_params_from_object(CameraParams *params, Object *ob)
 {
-	if(!ob)
+	if (!ob)
 		return;
 
-	if(ob->type==OB_CAMERA) {
+	if (ob->type==OB_CAMERA) {
 		/* camera object */
 		Camera *cam= ob->data;
 
-		if(cam->type == CAM_ORTHO)
+		if (cam->type == CAM_ORTHO)
 			params->is_ortho= TRUE;
 		params->lens= cam->lens;
 		params->ortho_scale= cam->ortho_scale;
@@ -224,14 +224,14 @@ void camera_params_from_object(CameraParams *params, Object *ob)
 		params->clipsta= cam->clipsta;
 		params->clipend= cam->clipend;
 	}
-	else if(ob->type==OB_LAMP) {
+	else if (ob->type==OB_LAMP) {
 		/* lamp object */
 		Lamp *la= ob->data;
 		float fac= cosf((float)M_PI*la->spotsize/360.0f);
 		float phi= acos(fac);
 
 		params->lens= 16.0f*fac/sinf(phi);
-		if(params->lens==0.0f)
+		if (params->lens==0.0f)
 			params->lens= 35.0f;
 
 		params->clipsta= la->clipsta;
@@ -246,7 +246,7 @@ void camera_params_from_view3d(CameraParams *params, View3D *v3d, RegionView3D *
 	params->clipsta= v3d->near;
 	params->clipend= v3d->far;
 
-	if(rv3d->persp==RV3D_CAMOB) {
+	if (rv3d->persp==RV3D_CAMOB) {
 		/* camera view */
 		camera_params_from_object(params, v3d->camera);
 
@@ -260,7 +260,7 @@ void camera_params_from_view3d(CameraParams *params, View3D *v3d, RegionView3D *
 
 		params->zoom= 1.0f/params->zoom;
 	}
-	else if(rv3d->persp==RV3D_ORTHO) {
+	else if (rv3d->persp==RV3D_ORTHO) {
 		/* orthographic view */
 		params->clipend *= 0.5f;	// otherwise too extreme low zbuffer quality
 		params->clipsta= - params->clipend;
@@ -283,10 +283,10 @@ void camera_params_compute_viewplane(CameraParams *params, int winx, int winy, f
 
 	/* fields rendering */
 	params->ycor= yasp/xasp;
-	if(params->use_fields)
+	if (params->use_fields)
 		params->ycor *= 2.0f;
 
-	if(params->is_ortho) {
+	if (params->is_ortho) {
 		/* orthographic camera */
 		/* scale == 1.0 means exact 1 to 1 mapping */
 		pixsize= params->ortho_scale;
@@ -300,7 +300,7 @@ void camera_params_compute_viewplane(CameraParams *params, int winx, int winy, f
 	/* determine sensor fit */
 	sensor_fit = camera_sensor_fit(params->sensor_fit, xasp*winx, yasp*winy);
 
-	if(sensor_fit==CAMERA_SENSOR_FIT_HOR)
+	if (sensor_fit==CAMERA_SENSOR_FIT_HOR)
 		viewfac= winx;
 	else
 		viewfac= params->ycor * winy;
@@ -312,10 +312,10 @@ void camera_params_compute_viewplane(CameraParams *params, int winx, int winy, f
 
 	/* compute view plane:
 	 * fully centered, zbuffer fills in jittered between -.5 and +.5 */
-	viewplane.xmin= -0.5f*(float)winx;
-	viewplane.ymin= -0.5f*params->ycor*(float)winy;
-	viewplane.xmax=  0.5f*(float)winx;
-	viewplane.ymax=  0.5f*params->ycor*(float)winy;
+	viewplane.xmin = -0.5f*(float)winx;
+	viewplane.ymin = -0.5f*params->ycor*(float)winy;
+	viewplane.xmax =  0.5f*(float)winx;
+	viewplane.ymax =  0.5f*params->ycor*(float)winy;
 
 	/* lens shift and offset */
 	dx= params->shiftx*viewfac + winx*params->offsetx;
@@ -327,8 +327,8 @@ void camera_params_compute_viewplane(CameraParams *params, int winx, int winy, f
 	viewplane.ymax += dy;
 
 	/* fields offset */
-	if(params->field_second) {
-		if(params->field_odd) {
+	if (params->field_second) {
+		if (params->field_odd) {
 			viewplane.ymin-= 0.5f * params->ycor;
 			viewplane.ymax-= 0.5f * params->ycor;
 		}
@@ -356,7 +356,7 @@ void camera_params_compute_matrix(CameraParams *params)
 	rctf viewplane= params->viewplane;
 
 	/* compute projection matrix */
-	if(params->is_ortho)
+	if (params->is_ortho)
 		orthographic_m4(params->winmat, viewplane.xmin, viewplane.xmax,
 			viewplane.ymin, viewplane.ymax, params->clipsta, params->clipend);
 	else
@@ -378,7 +378,7 @@ void camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const sh
 		float aspy= (float) scene->r.ysch*scene->r.yasp;
 		int sensor_fit= camera_sensor_fit(camera->sensor_fit, aspx, aspy);
 
-		if(sensor_fit==CAMERA_SENSOR_FIT_HOR) {
+		if (sensor_fit==CAMERA_SENSOR_FIT_HOR) {
 			r_asp[0]= 1.0;
 			r_asp[1]= aspy / aspx;
 		}
@@ -392,7 +392,7 @@ void camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const sh
 		r_asp[1]= 1.0f;
 	}
 
-	if(camera->type==CAM_ORTHO) {
+	if (camera->type==CAM_ORTHO) {
 		facx= 0.5f * camera->ortho_scale * r_asp[0] * scale[0];
 		facy= 0.5f * camera->ortho_scale * r_asp[1] * scale[1];
 		r_shift[0]= camera->shiftx * camera->ortho_scale * scale[0];
@@ -408,7 +408,7 @@ void camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const sh
 
 		*r_drawsize= drawsize / ((scale[0] + scale[1] + scale[2]) / 3.0f);
 
-		if(do_clip) {
+		if (do_clip) {
 			/* fixed depth, variable size (avoids exceeding clipping range) */
 			depth = -(camera->clipsta + 0.1f);
 			fac = depth / (camera->lens/(-half_sensor) * scale[2]);
@@ -465,7 +465,7 @@ static void camera_to_frame_view_cb(const float co[3], void *user_data)
 	data->tot++;
 }
 
-/* dont move the camera, just yield the fit location */
+/* don't move the camera, just yield the fit location */
 /* only valid for perspective cameras */
 int camera_view_frame_fit_to_scene(Scene *scene, struct View3D *v3d, Object *camera_ob, float r_co[3])
 {
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 5af3dc1..4de7df0 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -1,4 +1,4 @@
-/*
+ /*
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -36,19 +36,24 @@
 
 #include "GL/glew.h"
 
+#include "BLI_math.h"
 #include "BLI_blenlib.h"
 #include "BLI_edgehash.h"
-#include "BLI_editVert.h"
 #include "BLI_math.h"
 #include "BLI_pbvh.h"
+#include "BLI_array.h"
+#include "BLI_smallhash.h"
 #include "BLI_utildefines.h"
+#include "BLI_scanfill.h"
 
 #include "BKE_cdderivedmesh.h"
 #include "BKE_global.h"
 #include "BKE_mesh.h"
 #include "BKE_paint.h"
+#include "BKE_utildefines.h"
+#include "BKE_tessmesh.h"
 
-
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_object_types.h"
 #include "DNA_curve_types.h" /* for Curve */
@@ -68,18 +73,20 @@ typedef struct {
 	DerivedMesh dm;
 
 	/* these point to data in the DerivedMesh custom data layers,
-	   they are only here for efficiency and convenience **/
+	 * they are only here for efficiency and convenience **/
 	MVert *mvert;
 	MEdge *medge;
 	MFace *mface;
+	MLoop *mloop;
+	MPoly *mpoly;
 
 	/* Cached */
 	struct PBVH *pbvh;
 	int pbvh_draw;
 
 	/* Mesh connectivity */
-	struct ListBase *fmap;
-	struct IndexNode *fmap_mem;
+	MeshElemMap *pmap;
+	int *pmap_mem;
 } CDDerivedMesh;
 
 /**************** DerivedMesh interface functions ****************/
@@ -93,9 +100,26 @@ static int cdDM_getNumEdges(DerivedMesh *dm)
 	return dm->numEdgeData;
 }
 
-static int cdDM_getNumFaces(DerivedMesh *dm)
+static int cdDM_getNumTessFaces(DerivedMesh *dm)
+{
+	/* uncomment and add a breakpoint on the printf()
+	 * to help debug tessfaces issues since BMESH merge. */
+#if 0
+	if (dm->numTessFaceData == 0 && dm->numPolyData != 0) {
+		printf("%s: has no faces!, call DM_ensure_tessface() if you need them\n");
+	}
+#endif
+	return dm->numTessFaceData;
+}
+
+static int cdDM_getNumLoops(DerivedMesh *dm)
+{
+	return dm->numLoopData;
+}
+
+static int cdDM_getNumPolys(DerivedMesh *dm)
 {
-	return dm->numFaceData;
+	return dm->numPolyData;
 }
 
 static void cdDM_getVert(DerivedMesh *dm, int index, MVert *vert_r)
@@ -110,7 +134,7 @@ static void cdDM_getEdge(DerivedMesh *dm, int index, MEdge *edge_r)
 	*edge_r = cddm->medge[index];
 }
 
-static void cdDM_getFace(DerivedMesh *dm, int index, MFace *face_r)
+static void cdDM_getTessFace(DerivedMesh *dm, int index, MFace *face_r)
 {
 	CDDerivedMesh *cddm = (CDDerivedMesh *)dm;
 	*face_r = cddm->mface[index];
@@ -128,10 +152,22 @@ static void cdDM_copyEdgeArray(DerivedMesh *dm, MEdge *edge_r)
 	memcpy(edge_r, cddm->medge, sizeof(*edge_r) * dm->numEdgeData);
 }
 
-static void cdDM_copyFaceArray(DerivedMesh *dm, MFace *face_r)
+static void cdDM_copyTessFaceArray(DerivedMesh *dm, MFace *face_r)
 {
 	CDDerivedMesh *cddm = (CDDerivedMesh *)dm;
-	memcpy(face_r, cddm->mface, sizeof(*face_r) * dm->numFaceData);
+	memcpy(face_r, cddm->mface, sizeof(*face_r) * dm->numTessFaceData);
+}
+
+static void cdDM_copyLoopArray(DerivedMesh *dm, MLoop *loop_r)
+{
+	CDDerivedMesh *cddm = (CDDerivedMesh *)dm;
+	memcpy(loop_r, cddm->mloop, sizeof(*loop_r) * dm->numLoopData);
+}
+
+static void cdDM_copyPolyArray(DerivedMesh *dm, MPoly *poly_r)
+{
+	CDDerivedMesh *cddm = (CDDerivedMesh *)dm;
+	memcpy(poly_r, cddm->mpoly, sizeof(*poly_r) * dm->numPolyData);
 }
 
 static void cdDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3])
@@ -143,8 +179,10 @@ static void cdDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3])
 		for (i=0; i<dm->numVertData; i++) {
 			DO_MINMAX(cddm->mvert[i].co, min_r, max_r);
 		}
-	} else {
-		min_r[0] = min_r[1] = min_r[2] = max_r[0] = max_r[1] = max_r[2] = 0.0;
+	}
+	else {
+		zero_v3(min_r);
+		zero_v3(max_r);
 	}
 }
 
@@ -160,7 +198,7 @@ static void cdDM_getVertCos(DerivedMesh *dm, float (*cos_r)[3])
 	MVert *mv = CDDM_get_verts(dm);
 	int i;
 
-	for(i = 0; i < dm->numVertData; i++, mv++)
+	for (i = 0; i < dm->numVertData; i++, mv++)
 		copy_v3_v3(cos_r[i], mv->co);
 }
 
@@ -170,18 +208,19 @@ static void cdDM_getVertNo(DerivedMesh *dm, int index, float no_r[3])
 	normal_short_to_float_v3(no_r, cddm->mvert[index].no);
 }
 
-static ListBase *cdDM_getFaceMap(Object *ob, DerivedMesh *dm)
+static const MeshElemMap *cdDM_getPolyMap(Object *ob, DerivedMesh *dm)
 {
 	CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
 
-	if(!cddm->fmap && ob->type == OB_MESH) {
+	if (!cddm->pmap && ob->type == OB_MESH) {
 		Mesh *me= ob->data;
 
-		create_vert_face_map(&cddm->fmap, &cddm->fmap_mem, me->mface,
-					 me->totvert, me->totface);
+		create_vert_poly_map(&cddm->pmap, &cddm->pmap_mem,
+		                     me->mpoly, me->mloop,
+		                     me->totvert, me->totpoly, me->totloop);
 	}
 
-	return cddm->fmap;
+	return cddm->pmap;
 }
 
 static int can_pbvh_draw(Object *ob, DerivedMesh *dm)
@@ -191,49 +230,52 @@ static int can_pbvh_draw(Object *ob, DerivedMesh *dm)
 	int deformed= 0;
 
 	/* active modifiers means extra deformation, which can't be handled correct
-	   on bith of PBVH and sculpt "layer" levels, so use PBVH only for internal brush
-	   stuff and show final DerivedMesh so user would see actual object shape */
+	 * on birth of PBVH and sculpt "layer" levels, so use PBVH only for internal brush
+	 * stuff and show final DerivedMesh so user would see actual object shape */
 	deformed|= ob->sculpt->modifiers_active;
 
 	/* as in case with modifiers, we can't synchronize deformation made against
-	   PBVH and non-locked keyblock, so also use PBVH only for brushes and
-	   final DM to give final result to user */
+	 * PBVH and non-locked keyblock, so also use PBVH only for brushes and
+	 * final DM to give final result to user */
 	deformed|= ob->sculpt->kb && (ob->shapeflag&OB_SHAPE_LOCK) == 0;
 
-	if(deformed)
+	if (deformed)
 		return 0;
 
-	return (cddm->mvert == me->mvert) || ob->sculpt->kb;
+	return cddm->mvert == me->mvert || ob->sculpt->kb;
 }
 
 static struct PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm)
 {
 	CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
 
-	if(!ob) {
+	if (!ob) {
 		cddm->pbvh= NULL;
 		return NULL;
 	}
 
-	if(!ob->sculpt)
+	if (!ob->sculpt)
 		return NULL;
-	if(ob->sculpt->pbvh) {
+	if (ob->sculpt->pbvh) {
 		cddm->pbvh= ob->sculpt->pbvh;
 		cddm->pbvh_draw = can_pbvh_draw(ob, dm);
 	}
 
 	/* always build pbvh from original mesh, and only use it for drawing if
-	   this derivedmesh is just original mesh. it's the multires subsurf dm
-	   that this is actually for, to support a pbvh on a modified mesh */
-	if(!cddm->pbvh && ob->type == OB_MESH) {
+	 * this derivedmesh is just original mesh. it's the multires subsurf dm
+	 * that this is actually for, to support a pbvh on a modified mesh */
+	if (!cddm->pbvh && ob->type == OB_MESH) {
 		SculptSession *ss= ob->sculpt;
 		Mesh *me= ob->data;
 		cddm->pbvh = BLI_pbvh_new();
 		cddm->pbvh_draw = can_pbvh_draw(ob, dm);
+
+		BKE_mesh_tessface_ensure(me);
+		
 		BLI_pbvh_build_mesh(cddm->pbvh, me->mface, me->mvert,
 		                    me->totface, me->totvert);
 
-		if(ss->modifiers_active && ob->derivedDeform) {
+		if (ss->modifiers_active && ob->derivedDeform) {
 			DerivedMesh *deformdm= ob->derivedDeform;
 			float (*vertCos)[3];
 			int totvert;
@@ -250,13 +292,13 @@ static struct PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm)
 }
 
 /* update vertex normals so that drawing smooth faces works during sculpt
-   TODO: proper fix is to support the pbvh in all drawing modes */
+ * TODO: proper fix is to support the pbvh in all drawing modes */
 static void cdDM_update_normals_from_pbvh(DerivedMesh *dm)
 {
 	CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
 	float (*face_nors)[3];
 
-	if(!cddm->pbvh || !cddm->pbvh_draw || !dm->numFaceData)
+	if (!cddm->pbvh || !cddm->pbvh_draw || !dm->numTessFaceData)
 		return;
 
 	face_nors = CustomData_get_layer(&dm->faceData, CD_NORMAL);
@@ -270,16 +312,16 @@ static void cdDM_drawVerts(DerivedMesh *dm)
 	MVert *mv = cddm->mvert;
 	int i;
 
-	if( GPU_buffer_legacy(dm) ) {
+	if ( GPU_buffer_legacy(dm) ) {
 		glBegin(GL_POINTS);
-		for(i = 0; i < dm->numVertData; i++, mv++)
+		for (i = 0; i < dm->numVertData; i++, mv++)
 			glVertex3fv(mv->co);
 		glEnd();
 	}
 	else {	/* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */
 		GPU_vertex_setup(dm);
-		if( !GPU_buffer_legacy(dm) ) {
-			if(dm->drawObject->tot_triangle_point)
+		if ( !GPU_buffer_legacy(dm) ) {
+			if (dm->drawObject->tot_triangle_point)
 				glDrawArrays(GL_POINTS,0, dm->drawObject->tot_triangle_point);
 			else
 				glDrawArrays(GL_POINTS,0, dm->drawObject->tot_loose_point);
@@ -292,24 +334,25 @@ static void cdDM_drawUVEdges(DerivedMesh *dm)
 {
 	CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
 	MFace *mf = cddm->mface;
-	MTFace *tf = DM_get_face_data_layer(dm, CD_MTFACE);
+	MTFace *tf = DM_get_tessface_data_layer(dm, CD_MTFACE);
 	int i;
 
-	if(mf) {
-		if( GPU_buffer_legacy(dm) ) {
+	if (mf) {
+		if ( GPU_buffer_legacy(dm) ) {
 			glBegin(GL_LINES);
-			for(i = 0; i < dm->numFaceData; i++, mf++, tf++) {
-				if(!(mf->flag&ME_HIDE)) {
+			for (i = 0; i < dm->numTessFaceData; i++, mf++, tf++) {
+				if (!(mf->flag&ME_HIDE)) {
 					glVertex2fv(tf->uv[0]);
 					glVertex2fv(tf->uv[1]);
 
 					glVertex2fv(tf->uv[1]);
 					glVertex2fv(tf->uv[2]);
 
-					if(!mf->v4) {
+					if (!mf->v4) {
 						glVertex2fv(tf->uv[2]);
 						glVertex2fv(tf->uv[0]);
-					} else {
+					}
+					else {
 						glVertex2fv(tf->uv[2]);
 						glVertex2fv(tf->uv[3]);
 
@@ -327,21 +370,21 @@ static void cdDM_drawUVEdges(DerivedMesh *dm)
 			int curpos = 0;
 
 			GPU_uvedge_setup(dm);
-			if( !GPU_buffer_legacy(dm) ) {
-				for(i = 0; i < dm->numFaceData; i++, mf++) {
-					if(!(mf->flag&ME_HIDE)) {
+			if ( !GPU_buffer_legacy(dm) ) {
+				for (i = 0; i < dm->numTessFaceData; i++, mf++) {
+					if (!(mf->flag&ME_HIDE)) {
 						draw = 1;
 					} 
 					else {
 						draw = 0;
 					}
-					if( prevdraw != draw ) {
-						if( prevdraw > 0 && (curpos-prevstart) > 0) {
+					if ( prevdraw != draw ) {
+						if ( prevdraw > 0 && (curpos-prevstart) > 0) {
 							glDrawArrays(GL_LINES,prevstart,curpos-prevstart);
 						}
 						prevstart = curpos;
 					}
-					if( mf->v4 ) {
+					if ( mf->v4 ) {
 						curpos += 8;
 					}
 					else {
@@ -349,7 +392,7 @@ static void cdDM_drawUVEdges(DerivedMesh *dm)
 					}
 					prevdraw = draw;
 				}
-				if( prevdraw > 0 && (curpos-prevstart) > 0 ) {
+				if ( prevdraw > 0 && (curpos-prevstart) > 0 ) {
 					glDrawArrays(GL_LINES,prevstart,curpos-prevstart);
 				}
 			}
@@ -365,12 +408,13 @@ static void cdDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int drawAllEdges
 	MEdge *medge = cddm->medge;
 	int i;
 	
-	if( GPU_buffer_legacy(dm) ) {
+	if ( GPU_buffer_legacy(dm) ) {
 		DEBUG_VBO( "Using legacy code. cdDM_drawEdges\n" );
 		glBegin(GL_LINES);
-		for(i = 0; i < dm->numEdgeData; i++, medge++) {
-			if((drawAllEdges || (medge->flag&ME_EDGEDRAW))
-			   && (drawLooseEdges || !(medge->flag&ME_LOOSEEDGE))) {
+		for (i = 0; i < dm->numEdgeData; i++, medge++) {
+			if ((drawAllEdges || (medge->flag & ME_EDGEDRAW)) &&
+			    (drawLooseEdges || !(medge->flag & ME_LOOSEEDGE)))
+			{
 				glVertex3fv(mvert[medge->v1].co);
 				glVertex3fv(mvert[medge->v2].co);
 			}
@@ -380,28 +424,29 @@ static void cdDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int drawAllEdges
 	else {	/* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */
 		int prevstart = 0;
 		int prevdraw = 1;
-		int draw = 1;
+		int draw = TRUE;
 
 		GPU_edge_setup(dm);
-		if( !GPU_buffer_legacy(dm) ) {
-			for(i = 0; i < dm->numEdgeData; i++, medge++) {
-				if((drawAllEdges || (medge->flag&ME_EDGEDRAW))
-				   && (drawLooseEdges || !(medge->flag&ME_LOOSEEDGE))) {
-					draw = 1;
+		if (!GPU_buffer_legacy(dm)) {
+			for (i = 0; i < dm->numEdgeData; i++, medge++) {
+				if ((drawAllEdges || (medge->flag & ME_EDGEDRAW)) &&
+				    (drawLooseEdges || !(medge->flag & ME_LOOSEEDGE)))
+				{
+					draw = TRUE;
 				} 
 				else {
-					draw = 0;
+					draw = FALSE;
 				}
-				if( prevdraw != draw ) {
-					if( prevdraw > 0 && (i-prevstart) > 0 ) {
-						GPU_buffer_draw_elements( dm->drawObject->edges, GL_LINES, prevstart*2, (i-prevstart)*2  );
+				if ( prevdraw != draw ) {
+					if ( prevdraw > 0 && (i-prevstart) > 0 ) {
+						GPU_buffer_draw_elements(dm->drawObject->edges, GL_LINES, prevstart * 2, (i - prevstart) * 2);
 					}
 					prevstart = i;
 				}
 				prevdraw = draw;
 			}
-			if( prevdraw > 0 && (i-prevstart) > 0 ) {
-				GPU_buffer_draw_elements( dm->drawObject->edges, GL_LINES, prevstart*2, (i-prevstart)*2  );
+			if ( prevdraw > 0 && (i-prevstart) > 0 ) {
+				GPU_buffer_draw_elements(dm->drawObject->edges, GL_LINES, prevstart * 2, (i-prevstart) * 2);
 			}
 		}
 		GPU_buffer_unbind();
@@ -415,11 +460,11 @@ static void cdDM_drawLooseEdges(DerivedMesh *dm)
 	MEdge *medge = cddm->medge;
 	int i;
 
-	if( GPU_buffer_legacy(dm) ) {
+	if ( GPU_buffer_legacy(dm) ) {
 		DEBUG_VBO( "Using legacy code. cdDM_drawLooseEdges\n" );
 		glBegin(GL_LINES);
-		for(i = 0; i < dm->numEdgeData; i++, medge++) {
-			if(medge->flag&ME_LOOSEEDGE) {
+		for (i = 0; i < dm->numEdgeData; i++, medge++) {
+			if (medge->flag&ME_LOOSEEDGE) {
 				glVertex3fv(mvert[medge->v1].co);
 				glVertex3fv(mvert[medge->v2].co);
 			}
@@ -432,24 +477,24 @@ static void cdDM_drawLooseEdges(DerivedMesh *dm)
 		int draw = 1;
 
 		GPU_edge_setup(dm);
-		if( !GPU_buffer_legacy(dm) ) {
-			for(i = 0; i < dm->numEdgeData; i++, medge++) {
-				if(medge->flag&ME_LOOSEEDGE) {
+		if ( !GPU_buffer_legacy(dm) ) {
+			for (i = 0; i < dm->numEdgeData; i++, medge++) {
+				if (medge->flag&ME_LOOSEEDGE) {
 					draw = 1;
 				} 
 				else {
 					draw = 0;
 				}
-				if( prevdraw != draw ) {
-					if( prevdraw > 0 && (i-prevstart) > 0) {
-						GPU_buffer_draw_elements( dm->drawObject->edges, GL_LINES, prevstart*2, (i-prevstart)*2  );
+				if ( prevdraw != draw ) {
+					if ( prevdraw > 0 && (i-prevstart) > 0) {
+						GPU_buffer_draw_elements(dm->drawObject->edges, GL_LINES, prevstart * 2, (i - prevstart) * 2);
 					}
 					prevstart = i;
 				}
 				prevdraw = draw;
 			}
-			if( prevdraw > 0 && (i-prevstart) > 0 ) {
-				GPU_buffer_draw_elements( dm->drawObject->edges, GL_LINES, prevstart*2, (i-prevstart)*2  );
+			if ( prevdraw > 0 && (i-prevstart) > 0 ) {
+				GPU_buffer_draw_elements(dm->drawObject->edges, GL_LINES, prevstart * 2, (i - prevstart) * 2);
 			}
 		}
 		GPU_buffer_unbind();
@@ -458,50 +503,44 @@ static void cdDM_drawLooseEdges(DerivedMesh *dm)
 
 static void cdDM_drawFacesSolid(DerivedMesh *dm,
 				float (*partial_redraw_planes)[4],
-				int UNUSED(fast), int (*setMaterial)(int, void *attribs))
+				int UNUSED(fast), DMSetMaterial setMaterial)
 {
 	CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
 	MVert *mvert = cddm->mvert;
 	MFace *mface = cddm->mface;
-	float *nors= dm->getFaceDataArray(dm, CD_NORMAL);
+	float *nors= dm->getTessFaceDataArray(dm, CD_NORMAL);
 	int a, glmode = -1, shademodel = -1, matnr = -1, drawCurrentMat = 1;
 
 #define PASSVERT(index) {						\
-	if(shademodel == GL_SMOOTH) {				\
+	if (shademodel == GL_SMOOTH) {				\
 		short *no = mvert[index].no;			\
 		glNormal3sv(no);						\
 	}											\
 	glVertex3fv(mvert[index].co);	\
 }
 
-	if(cddm->pbvh && cddm->pbvh_draw) {
-		if(dm->numFaceData) {
+	if (cddm->pbvh && cddm->pbvh_draw) {
+		if (dm->numTessFaceData) {
 			float (*face_nors)[3] = CustomData_get_layer(&dm->faceData, CD_NORMAL);
 
-			/* should be per face */
-			if(!setMaterial(mface->mat_nr+1, NULL))
-				return;
-
-			glShadeModel((mface->flag & ME_SMOOTH)? GL_SMOOTH: GL_FLAT);
-			BLI_pbvh_draw(cddm->pbvh, partial_redraw_planes, face_nors, (mface->flag & ME_SMOOTH));
+			BLI_pbvh_draw(cddm->pbvh, partial_redraw_planes, face_nors, setMaterial);
 			glShadeModel(GL_FLAT);
 		}
 
 		return;
 	}
 
-	if( GPU_buffer_legacy(dm) ) {
+	if ( GPU_buffer_legacy(dm) ) {
 		DEBUG_VBO( "Using legacy code. cdDM_drawFacesSolid\n" );
 		glBegin(glmode = GL_QUADS);
-		for(a = 0; a < dm->numFaceData; a++, mface++) {
+		for (a = 0; a < dm->numTessFaceData; a++, mface++) {
 			int new_glmode, new_matnr, new_shademodel;
 
 			new_glmode = mface->v4?GL_QUADS:GL_TRIANGLES;
 			new_matnr = mface->mat_nr + 1;
 			new_shademodel = (mface->flag & ME_SMOOTH)?GL_SMOOTH:GL_FLAT;
 			
-			if(new_glmode != glmode || new_matnr != matnr
-			   || new_shademodel != shademodel) {
+			if (new_glmode != glmode || new_matnr != matnr || new_shademodel != shademodel) {
 				glEnd();
 
 				drawCurrentMat = setMaterial(matnr = new_matnr, NULL);
@@ -510,17 +549,18 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm,
 				glBegin(glmode = new_glmode);
 			} 
 			
-			if(drawCurrentMat) {
-				if(shademodel == GL_FLAT) {
+			if (drawCurrentMat) {
+				if (shademodel == GL_FLAT) {
 					if (nors) {
 						glNormal3fv(nors);
 					}
 					else {
 						/* TODO make this better (cache facenormals as layer?) */
 						float nor[3];
-						if(mface->v4) {
+						if (mface->v4) {
 							normal_quad_v3( nor,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co, mvert[mface->v4].co);
-						} else {
+						}
+						else {
 							normal_tri_v3( nor,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co);
 						}
 						glNormal3fv(nor);
@@ -530,24 +570,25 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm,
 				PASSVERT(mface->v1);
 				PASSVERT(mface->v2);
 				PASSVERT(mface->v3);
-				if(mface->v4) {
+				if (mface->v4) {
 					PASSVERT(mface->v4);
 				}
 			}
 
-			if(nors) nors += 3;
+			if (nors) nors += 3;
 		}
 		glEnd();
 	}
 	else {	/* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */
 		GPU_vertex_setup( dm );
 		GPU_normal_setup( dm );
-		if( !GPU_buffer_legacy(dm) ) {
+		if ( !GPU_buffer_legacy(dm) ) {
 			glShadeModel(GL_SMOOTH);
-			for( a = 0; a < dm->drawObject->totmaterial; a++ ) {
-				if( setMaterial(dm->drawObject->materials[a].mat_nr+1, NULL) )
+			for (a = 0; a < dm->drawObject->totmaterial; a++) {
+				if (setMaterial(dm->drawObject->materials[a].mat_nr + 1, NULL)) {
 					glDrawArrays(GL_TRIANGLES, dm->drawObject->materials[a].start,
-						     dm->drawObject->materials[a].totpoint);
+					             dm->drawObject->materials[a].totpoint);
+				}
 			}
 		}
 		GPU_buffer_unbind( );
@@ -557,148 +598,62 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm,
 	glShadeModel(GL_FLAT);
 }
 
-static void cdDM_drawFacesColored(DerivedMesh *dm, int useTwoSided, unsigned char *col1, unsigned char *col2)
-{
-	CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
-	int a, glmode;
-	unsigned char *cp1, *cp2;
-	MVert *mvert = cddm->mvert;
-	MFace *mface = cddm->mface;
-
-	cp1 = col1;
-	if(col2) {
-		cp2 = col2;
-	} else {
-		cp2 = NULL;
-		useTwoSided = 0;
-	}
-
-	/* there's a conflict here... twosided colors versus culling...? */
-	/* defined by history, only texture faces have culling option */
-	/* we need that as mesh option builtin, next to double sided lighting */
-	if(col2) {
-		glEnable(GL_CULL_FACE);
-	}
-
-	cdDM_update_normals_from_pbvh(dm);
-
-	if( GPU_buffer_legacy(dm) ) {
-		DEBUG_VBO( "Using legacy code. cdDM_drawFacesColored\n" );
-		glShadeModel(GL_SMOOTH);
-		glBegin(glmode = GL_QUADS);
-		for(a = 0; a < dm->numFaceData; a++, mface++, cp1 += 16) {
-			int new_glmode = mface->v4?GL_QUADS:GL_TRIANGLES;
-
-			if(new_glmode != glmode) {
-				glEnd();
-				glBegin(glmode = new_glmode);
-			}
-				
-			glColor3ubv(cp1+0);
-			glVertex3fv(mvert[mface->v1].co);
-			glColor3ubv(cp1+4);
-			glVertex3fv(mvert[mface->v2].co);
-			glColor3ubv(cp1+8);
-			glVertex3fv(mvert[mface->v3].co);
-			if(mface->v4) {
-				glColor3ubv(cp1+12);
-				glVertex3fv(mvert[mface->v4].co);
-			}
-				
-			if(useTwoSided) {
-				glColor3ubv(cp2+8);
-				glVertex3fv(mvert[mface->v3].co );
-				glColor3ubv(cp2+4);
-				glVertex3fv(mvert[mface->v2].co );
-				glColor3ubv(cp2+0);
-				glVertex3fv(mvert[mface->v1].co );
-				if(mface->v4) {
-					glColor3ubv(cp2+12);
-					glVertex3fv(mvert[mface->v4].co );
-				}
-			}
-			if(col2) cp2 += 16;
-		}
-		glEnd();
-	}
-	else { /* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */
-		GPU_color4_upload(dm,cp1);
-		GPU_vertex_setup(dm);
-		GPU_color_setup(dm);
-		if( !GPU_buffer_legacy(dm) ) {
-			glShadeModel(GL_SMOOTH);
-			glDrawArrays(GL_TRIANGLES, 0, dm->drawObject->tot_triangle_point);
-
-			if( useTwoSided ) {
-				GPU_color4_upload(dm,cp2);
-				GPU_color_setup(dm);
-				glCullFace(GL_FRONT);
-				glDrawArrays(GL_TRIANGLES, 0, dm->drawObject->tot_triangle_point);
-				glCullFace(GL_BACK);
-			}
-		}
-		GPU_buffer_unbind();
-	}
-
-	glShadeModel(GL_FLAT);
-	glDisable(GL_CULL_FACE);
-}
-
 static void cdDM_drawFacesTex_common(DerivedMesh *dm,
-			   int (*drawParams)(MTFace *tface, int has_mcol, int matnr),
-			   int (*drawParamsMapped)(void *userData, int index),
-			   int (*compareDrawOptions)(void *userData, int cur_index, int next_index),
+			   DMSetDrawOptionsTex drawParams,
+			   DMSetDrawOptions drawParamsMapped,
+			   DMCompareDrawOptions compareDrawOptions,
 			   void *userData) 
 {
 	CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
 	MVert *mv = cddm->mvert;
-	MFace *mf = DM_get_face_data_layer(dm, CD_MFACE);
-	MCol *realcol = dm->getFaceDataArray(dm, CD_TEXTURE_MCOL);
-	float *nors= dm->getFaceDataArray(dm, CD_NORMAL);
-	MTFace *tf = DM_get_face_data_layer(dm, CD_MTFACE);
-	int i, j, orig, *index = DM_get_face_data_layer(dm, CD_ORIGINDEX);
+	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->getFaceDataArray(dm, CD_WEIGHT_MCOL);
-	if(!mcol)
-		mcol = dm->getFaceDataArray(dm, CD_MCOL);
+	MCol *mcol = dm->getTessFaceDataArray(dm, CD_PREVIEW_MCOL);
+	if (!mcol)
+		mcol = dm->getTessFaceDataArray(dm, CD_MCOL);
 
 	cdDM_update_normals_from_pbvh(dm);
 
-	if( GPU_buffer_legacy(dm) ) {
+	if ( GPU_buffer_legacy(dm) ) {
 		DEBUG_VBO( "Using legacy code. cdDM_drawFacesTex_common\n" );
-		for(i = 0; i < dm->numFaceData; i++, mf++) {
+		for (i = 0; i < dm->numTessFaceData; i++, mf++) {
 			MVert *mvert;
-			int flag;
+			DMDrawOption draw_option;
 			unsigned char *cp = NULL;
 
-			if(drawParams) {
-				flag = drawParams(tf? &tf[i]: NULL, (mcol != NULL), mf->mat_nr);
+			if (drawParams) {
+				draw_option = drawParams(tf? &tf[i]: NULL, (mcol != NULL), mf->mat_nr);
 			}
 			else {
-				if(index) {
+				if (index) {
 					orig = *index++;
-					if(orig == ORIGINDEX_NONE)		{ if(nors) nors += 3; continue; }
-					if(drawParamsMapped) flag = drawParamsMapped(userData, orig);
-					else	{ if(nors) nors += 3; continue; }
+					if (orig == ORIGINDEX_NONE)		{ if (nors) nors += 3; continue; }
+					if (drawParamsMapped) draw_option = drawParamsMapped(userData, orig);
+					else	{ if (nors) nors += 3; continue; }
 				}
 				else
-					if(drawParamsMapped) flag = drawParamsMapped(userData, i);
-					else	{ if(nors) nors += 3; continue; }
+					if (drawParamsMapped) draw_option = drawParamsMapped(userData, i);
+					else	{ if (nors) nors += 3; continue; }
 			}
 			
-			if(flag != 0) {
-				if (flag==1 && mcol)
+			if (draw_option != DM_DRAW_OPTION_SKIP) {
+				if (draw_option != DM_DRAW_OPTION_NO_MCOL && mcol)
 					cp= (unsigned char*) &mcol[i*4];
 
-				if(!(mf->flag&ME_SMOOTH)) {
+				if (!(mf->flag&ME_SMOOTH)) {
 					if (nors) {
 						glNormal3fv(nors);
 					}
 					else {
 						float nor[3];
-						if(mf->v4) {
+						if (mf->v4) {
 							normal_quad_v3( nor,mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co, mv[mf->v4].co);
-						} else {
+						}
+						else {
 							normal_tri_v3( nor,mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co);
 						}
 						glNormal3fv(nor);
@@ -706,55 +661,60 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
 				}
 
 				glBegin(mf->v4?GL_QUADS:GL_TRIANGLES);
-				if(tf) glTexCoord2fv(tf[i].uv[0]);
-				if(cp) glColor3ub(cp[3], cp[2], cp[1]);
+				if (tf) glTexCoord2fv(tf[i].uv[0]);
+				if (cp) glColor3ub(cp[3], cp[2], cp[1]);
 				mvert = &mv[mf->v1];
-				if(mf->flag&ME_SMOOTH) glNormal3sv(mvert->no);
+				if (mf->flag&ME_SMOOTH) glNormal3sv(mvert->no);
 				glVertex3fv(mvert->co);
 					
-				if(tf) glTexCoord2fv(tf[i].uv[1]);
-				if(cp) glColor3ub(cp[7], cp[6], cp[5]);
+				if (tf) glTexCoord2fv(tf[i].uv[1]);
+				if (cp) glColor3ub(cp[7], cp[6], cp[5]);
 				mvert = &mv[mf->v2];
-				if(mf->flag&ME_SMOOTH) glNormal3sv(mvert->no);
+				if (mf->flag&ME_SMOOTH) glNormal3sv(mvert->no);
 				glVertex3fv(mvert->co);
 
-				if(tf) glTexCoord2fv(tf[i].uv[2]);
-				if(cp) glColor3ub(cp[11], cp[10], cp[9]);
+				if (tf) glTexCoord2fv(tf[i].uv[2]);
+				if (cp) glColor3ub(cp[11], cp[10], cp[9]);
 				mvert = &mv[mf->v3];
-				if(mf->flag&ME_SMOOTH) glNormal3sv(mvert->no);
+				if (mf->flag&ME_SMOOTH) glNormal3sv(mvert->no);
 				glVertex3fv(mvert->co);
 
-				if(mf->v4) {
-					if(tf) glTexCoord2fv(tf[i].uv[3]);
-					if(cp) glColor3ub(cp[15], cp[14], cp[13]);
+				if (mf->v4) {
+					if (tf) glTexCoord2fv(tf[i].uv[3]);
+					if (cp) glColor3ub(cp[15], cp[14], cp[13]);
 					mvert = &mv[mf->v4];
-					if(mf->flag&ME_SMOOTH) glNormal3sv(mvert->no);
+					if (mf->flag&ME_SMOOTH) glNormal3sv(mvert->no);
 					glVertex3fv(mvert->co);
 				}
 				glEnd();
 			}
 			
-			if(nors) nors += 3;
+			if (nors) nors += 3;
 		}
-	} else { /* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */
+	}
+	else { /* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */
 		MCol *col = realcol;
-		if(!col)
+		if (!col)
 			col = mcol;
 
 		GPU_vertex_setup( dm );
 		GPU_normal_setup( dm );
 		GPU_uv_setup( dm );
-		if( col != NULL ) {
-			/*if( realcol && dm->drawObject->colType == CD_TEXTURE_MCOL )  {
+		if ( col != NULL ) {
+#if 0
+			if ( realcol && dm->drawObject->colType == CD_TEXTURE_MCOL ) {
 				col = 0;
-			} else if( mcol && dm->drawObject->colType == CD_MCOL ) {
+			}
+			else if ( mcol && dm->drawObject->colType == CD_MCOL ) {
 				col = 0;
 			}
 			
-			if( col != 0 ) {*/
-				unsigned char *colors = MEM_mallocN(dm->getNumFaces(dm)*4*3*sizeof(unsigned char), "cdDM_drawFacesTex_common");
-				for( i=0; i < dm->getNumFaces(dm); i++ ) {
-					for( j=0; j < 4; j++ ) {
+			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;
@@ -763,57 +723,58 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
 				}
 				GPU_color3_upload(dm,colors);
 				MEM_freeN(colors);
-				if(realcol)
+				if (realcol)
 					dm->drawObject->colType = CD_TEXTURE_MCOL;
-				else if(mcol)
+				else if (mcol)
 					dm->drawObject->colType = CD_MCOL;
-			//}
+			}
 			GPU_color_setup( dm );
 		}
 
-		if( !GPU_buffer_legacy(dm) ) {
+		if ( !GPU_buffer_legacy(dm) ) {
 			int tottri = dm->drawObject->tot_triangle_point/3;
 			int next_actualFace= dm->drawObject->triangle_to_mface[0];
 
 			glShadeModel( GL_SMOOTH );
 			/* lastFlag = 0; */ /* UNUSED */
-			for(i = 0; i < tottri; i++) {
+			for (i = 0; i < tottri; i++) {
 				int actualFace = next_actualFace;
-				int flag = 1;
+				DMDrawOption draw_option = DM_DRAW_OPTION_NORMAL;
 				int flush = 0;
 
-				if(i != tottri-1)
+				if (i != tottri-1)
 					next_actualFace= dm->drawObject->triangle_to_mface[i+1];
 
-				if(drawParams) {
-					flag = drawParams(tf? &tf[actualFace]: NULL, (mcol != NULL), mf[actualFace].mat_nr);
+				if (drawParams) {
+					draw_option = drawParams(tf? &tf[actualFace]: NULL, (mcol != NULL), mf[actualFace].mat_nr);
 				}
 				else {
-					if(index) {
+					if (index) {
 						orig = index[actualFace];
-						if(orig == ORIGINDEX_NONE) continue;
-						if(drawParamsMapped)
-							flag = drawParamsMapped(userData, orig);
+						if (orig == ORIGINDEX_NONE) continue;
+						if (drawParamsMapped)
+							draw_option = drawParamsMapped(userData, orig);
 					}
 					else
-						if(drawParamsMapped)
-							flag = drawParamsMapped(userData, actualFace);
+						if (drawParamsMapped)
+							draw_option = drawParamsMapped(userData, actualFace);
 				}
 
 				/* flush buffer if current triangle isn't drawable or it's last triangle */
-				flush= !flag || i == tottri - 1;
+				flush= (draw_option == DM_DRAW_OPTION_SKIP) || (i == tottri - 1);
 
-				if(!flush && compareDrawOptions) {
+				if (!flush && compareDrawOptions) {
 					/* also compare draw options and flush buffer if they're different
-					   need for face selection highlight in edit mode */
+					 * need for face selection highlight in edit mode */
 					flush|= compareDrawOptions(userData, actualFace, next_actualFace) == 0;
 				}
 
-				if(flush) {
+				if (flush) {
 					int first= startFace*3;
-					int count= (i-startFace+(flag ? 1 : 0))*3; /* Add one to the length if we're drawing at the end of the array */
+					/* Add one to the length if we're drawing at the end of the array */
+					int count= (i-startFace+(draw_option != DM_DRAW_OPTION_SKIP ? 1 : 0))*3;
 
-					if(count) {
+					if (count) {
 						if (col)
 							GPU_color_switch(1);
 						else
@@ -833,57 +794,58 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
 }
 
 static void cdDM_drawFacesTex(DerivedMesh *dm,
-			   int (*setDrawOptions)(MTFace *tface, int has_mcol, int matnr),
-			   int (*compareDrawOptions)(void *userData, int cur_index, int next_index),
+			   DMSetDrawOptionsTex setDrawOptions,
+			   DMCompareDrawOptions compareDrawOptions,
 			   void *userData)
 {
 	cdDM_drawFacesTex_common(dm, setDrawOptions, NULL, compareDrawOptions, userData);
 }
 
 static void cdDM_drawMappedFaces(DerivedMesh *dm,
-			int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r),
-			int (*setMaterial)(int, void *attribs),
-			int (*compareDrawOptions)(void *userData, int cur_index, int next_index),
-			void *userData, int useColors)
+			DMSetDrawOptions setDrawOptions,
+			DMSetMaterial setMaterial,
+			DMCompareDrawOptions compareDrawOptions,
+			void *userData, DMDrawFlag flag)
 {
 	CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
 	MVert *mv = cddm->mvert;
 	MFace *mf = cddm->mface;
 	MCol *mc;
-	float *nors= dm->getFaceDataArray(dm, CD_NORMAL);
-	int i, orig, *index = DM_get_face_data_layer(dm, CD_ORIGINDEX);
+	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);
 
-	mc = DM_get_face_data_layer(dm, CD_ID_MCOL);
-	if(!mc)
-		mc = DM_get_face_data_layer(dm, CD_WEIGHT_MCOL);
-	if(!mc)
-		mc = DM_get_face_data_layer(dm, CD_MCOL);
+	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);
 
 	cdDM_update_normals_from_pbvh(dm);
 
 	/* back-buffer always uses legacy since VBO's would need the
 	 * color array temporarily overwritten for drawing, then reset. */
-	if( GPU_buffer_legacy(dm) || G.f & G_BACKBUFSEL) {
+	if ( GPU_buffer_legacy(dm) || G.f & G_BACKBUFSEL) {
 		DEBUG_VBO( "Using legacy code. cdDM_drawMappedFaces\n" );
-		for(i = 0; i < dm->numFaceData; i++, mf++) {
-			int drawSmooth = (mf->flag & ME_SMOOTH);
-			int draw= 1;
+		for (i = 0; i < dm->numTessFaceData; i++, mf++) {
+			int drawSmooth = (flag & DM_DRAW_ALWAYS_SMOOTH) ? 1 : (mf->flag & ME_SMOOTH);
+			DMDrawOption draw_option= DM_DRAW_OPTION_NORMAL;
 
 			orig= (index==NULL) ? i : *index++;
 			
-			if(orig == ORIGINDEX_NONE)
-				draw= setMaterial(mf->mat_nr + 1, NULL);
+			if (orig == ORIGINDEX_NONE)
+				draw_option= setMaterial(mf->mat_nr + 1, NULL);
 			else if (setDrawOptions != NULL)
-				draw= setDrawOptions(userData, orig, &drawSmooth);
+				draw_option= setDrawOptions(userData, orig);
 
-			if(draw) {
+			if (draw_option != DM_DRAW_OPTION_SKIP) {
 				unsigned char *cp = NULL;
 
-				if(useColors && mc)
+				if (useColors && mc)
 					cp = (unsigned char *)&mc[i * 4];
 
 				/* no need to set shading mode to flat because
-				*  normals are already used to change shading */
+				 *  normals are already used to change shading */
 				glShadeModel(GL_SMOOTH);
 				glBegin(mf->v4?GL_QUADS:GL_TRIANGLES);
 
@@ -893,36 +855,38 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm,
 					}
 					else {
 						float nor[3];
-						if(mf->v4) {
+						if (mf->v4) {
 							normal_quad_v3( nor,mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co, mv[mf->v4].co);
-						} else {
+						}
+						else {
 							normal_tri_v3( nor,mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co);
 						}
 						glNormal3fv(nor);
 					}
 
-					if(cp) glColor3ub(cp[3], cp[2], cp[1]);
+					if (cp) glColor3ub(cp[3], cp[2], cp[1]);
 					glVertex3fv(mv[mf->v1].co);
-					if(cp) glColor3ub(cp[7], cp[6], cp[5]);
+					if (cp) glColor3ub(cp[7], cp[6], cp[5]);
 					glVertex3fv(mv[mf->v2].co);
-					if(cp) glColor3ub(cp[11], cp[10], cp[9]);
+					if (cp) glColor3ub(cp[11], cp[10], cp[9]);
 					glVertex3fv(mv[mf->v3].co);
-					if(mf->v4) {
-						if(cp) glColor3ub(cp[15], cp[14], cp[13]);
+					if (mf->v4) {
+						if (cp) glColor3ub(cp[15], cp[14], cp[13]);
 						glVertex3fv(mv[mf->v4].co);
 					}
-				} else {
-					if(cp) glColor3ub(cp[3], cp[2], cp[1]);
+				}
+				else {
+					if (cp) glColor3ub(cp[3], cp[2], cp[1]);
 					glNormal3sv(mv[mf->v1].no);
 					glVertex3fv(mv[mf->v1].co);
-					if(cp) glColor3ub(cp[7], cp[6], cp[5]);
+					if (cp) glColor3ub(cp[7], cp[6], cp[5]);
 					glNormal3sv(mv[mf->v2].no);
 					glVertex3fv(mv[mf->v2].co);
-					if(cp) glColor3ub(cp[11], cp[10], cp[9]);
+					if (cp) glColor3ub(cp[11], cp[10], cp[9]);
 					glNormal3sv(mv[mf->v3].no);
 					glVertex3fv(mv[mf->v3].co);
-					if(mf->v4) {
-						if(cp) glColor3ub(cp[15], cp[14], cp[13]);
+					if (mf->v4) {
+						if (cp) glColor3ub(cp[15], cp[14], cp[13]);
 						glNormal3sv(mv[mf->v4].no);
 						glVertex3fv(mv[mf->v4].co);
 					}
@@ -938,16 +902,16 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm,
 		int prevstart = 0;
 		GPU_vertex_setup(dm);
 		GPU_normal_setup(dm);
-		if( useColors && mc )
+		if ( useColors && mc )
 			GPU_color_setup(dm);
-		if( !GPU_buffer_legacy(dm) ) {
+		if ( !GPU_buffer_legacy(dm) ) {
 			int tottri = dm->drawObject->tot_triangle_point/3;
 			glShadeModel(GL_SMOOTH);
 			
-			if(tottri == 0) {
+			if (tottri == 0) {
 				/* avoid buffer problems in following code */
 			}
-			if(setDrawOptions == NULL) {
+			if (setDrawOptions == NULL) {
 				/* just draw the entire face array */
 				glDrawArrays(GL_TRIANGLES, 0, (tottri) * 3);
 			}
@@ -955,43 +919,44 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm,
 				/* we need to check if the next material changes */
 				int next_actualFace= dm->drawObject->triangle_to_mface[0];
 				
-				for( i = 0; i < tottri; i++ ) {
+				for ( i = 0; i < tottri; i++ ) {
 					//int actualFace = dm->drawObject->triangle_to_mface[i];
 					int actualFace = next_actualFace;
 					MFace *mface= mf + actualFace;
-					int drawSmooth= (mface->flag & ME_SMOOTH);
-					int draw = 1;
+					/*int drawSmooth= (flag & DM_DRAW_ALWAYS_SMOOTH) ? 1 : (mface->flag & ME_SMOOTH);*/ /* UNUSED */
+					DMDrawOption draw_option = DM_DRAW_OPTION_NORMAL;
 					int flush = 0;
 
-					if(i != tottri-1)
+					if (i != tottri-1)
 						next_actualFace= dm->drawObject->triangle_to_mface[i+1];
 
 					orig= (index==NULL) ? actualFace : index[actualFace];
 
-					if(orig == ORIGINDEX_NONE)
-						draw= setMaterial(mface->mat_nr + 1, NULL);
+					if (orig == ORIGINDEX_NONE)
+						draw_option= setMaterial(mface->mat_nr + 1, NULL);
 					else if (setDrawOptions != NULL)
-						draw= setDrawOptions(userData, orig, &drawSmooth);
+						draw_option= setDrawOptions(userData, orig);
 	
 					/* Goal is to draw as long of a contiguous triangle
-					   array as possible, so draw when we hit either an
-					   invisible triangle or at the end of the array */
+					 * array as possible, so draw when we hit either an
+					 * invisible triangle or at the end of the array */
 
 					/* flush buffer if current triangle isn't drawable or it's last triangle... */
-					flush= !draw || i == tottri - 1;
+					flush= (draw_option == DM_DRAW_OPTION_SKIP) || (i == tottri - 1);
 
 					/* ... or when material setting is dissferent  */
 					flush|= mf[actualFace].mat_nr != mf[next_actualFace].mat_nr;
 
-					if(!flush && compareDrawOptions) {
+					if (!flush && compareDrawOptions) {
 						flush|= compareDrawOptions(userData, actualFace, next_actualFace) == 0;
 					}
 
-					if(flush) {
+					if (flush) {
 						int first= prevstart*3;
-						int count= (i-prevstart+(draw ? 1 : 0))*3; /* Add one to the length if we're drawing at the end of the array */
+						/* Add one to the length if we're drawing at the end of the array */
+						int count= (i-prevstart+(draw_option != DM_DRAW_OPTION_SKIP ? 1 : 0))*3;
 
-						if(count)
+						if (count)
 							glDrawArrays(GL_TRIANGLES, first, count);
 
 						prevstart = i + 1;
@@ -1006,8 +971,8 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm,
 }
 
 static void cdDM_drawMappedFacesTex(DerivedMesh *dm,
-			   int (*setDrawOptions)(void *userData, int index),
-			   int (*compareDrawOptions)(void *userData, int cur_index, int next_index),
+			   DMSetDrawOptions setDrawOptions,
+			   DMCompareDrawOptions compareDrawOptions,
 			   void *userData)
 {
 	cdDM_drawFacesTex_common(dm, NULL, setDrawOptions, compareDrawOptions, userData);
@@ -1018,25 +983,25 @@ static void cddm_draw_attrib_vertex(DMVertexAttribs *attribs, MVert *mvert, int
 	int b;
 
 	/* orco texture coordinates */
-	if(attribs->totorco) {
-		if(attribs->orco.glTexco)
+	if (attribs->totorco) {
+		if (attribs->orco.glTexco)
 			glTexCoord3fv(attribs->orco.array[index]);
 		else
 			glVertexAttrib3fvARB(attribs->orco.glIndex, attribs->orco.array[index]);
 	}
 
 	/* uv texture coordinates */
-	for(b = 0; b < attribs->tottface; b++) {
+	for (b = 0; b < attribs->tottface; b++) {
 		MTFace *tf = &attribs->tface[b].array[a];
 
-		if(attribs->tface[b].glTexco)
+		if (attribs->tface[b].glTexco)
 			glTexCoord2fv(tf->uv[vert]);
 		else
 			glVertexAttrib2fvARB(attribs->tface[b].glIndex, tf->uv[vert]);
 	}
 
 	/* vertex colors */
-	for(b = 0; b < attribs->totmcol; b++) {
+	for (b = 0; b < attribs->totmcol; b++) {
 		MCol *cp = &attribs->mcol[b].array[a*4 + vert];
 		GLubyte col[4];
 		col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a;
@@ -1044,13 +1009,13 @@ static void cddm_draw_attrib_vertex(DMVertexAttribs *attribs, MVert *mvert, int
 	}
 
 	/* tangent for normal mapping */
-	if(attribs->tottang) {
+	if (attribs->tottang) {
 		float *tang = attribs->tang.array[a*4 + vert];
 		glVertexAttrib4fvARB(attribs->tang.glIndex, tang);
 	}
 
 	/* vertex normal */
-	if(smoothnormal)
+	if (smoothnormal)
 		glNormal3sv(mvert[index].no);
 	
 	/* vertex coordinate */
@@ -1058,8 +1023,8 @@ static void cddm_draw_attrib_vertex(DMVertexAttribs *attribs, MVert *mvert, int
 }
 
 static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
-			   int (*setMaterial)(int, void *attribs),
-			   int (*setDrawOptions)(void *userData, int index),
+			   DMSetMaterial setMaterial,
+			   DMSetDrawOptions setDrawOptions,
 			   void *userData)
 {
 	CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
@@ -1067,10 +1032,10 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
 	DMVertexAttribs attribs;
 	MVert *mvert = cddm->mvert;
 	MFace *mface = cddm->mface;
-	/* MTFace *tf = dm->getFaceDataArray(dm, CD_MTFACE); */ /* UNUSED */
-	float (*nors)[3] = dm->getFaceDataArray(dm, CD_NORMAL);
+	/* MTFace *tf = dm->getTessFaceDataArray(dm, CD_MTFACE); */ /* UNUSED */
+	float (*nors)[3] = dm->getTessFaceDataArray(dm, CD_NORMAL);
 	int a, b, dodraw, matnr, new_matnr;
-	int orig, *index = dm->getFaceDataArray(dm, CD_ORIGINDEX);
+	int orig, *index = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
 
 	cdDM_update_normals_from_pbvh(dm);
 
@@ -1079,52 +1044,53 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
 
 	glShadeModel(GL_SMOOTH);
 
-	if( GPU_buffer_legacy(dm) || setDrawOptions != NULL ) {
+	if ( GPU_buffer_legacy(dm) || setDrawOptions != NULL ) {
 		DEBUG_VBO( "Using legacy code. cdDM_drawMappedFacesGLSL\n" );
 		memset(&attribs, 0, sizeof(attribs));
 
 		glBegin(GL_QUADS);
 
-		for(a = 0; a < dm->numFaceData; a++, mface++) {
+		for (a = 0; a < dm->numTessFaceData; a++, mface++) {
 			const int smoothnormal = (mface->flag & ME_SMOOTH);
 			new_matnr = mface->mat_nr + 1;
 
-			if(new_matnr != matnr) {
+			if (new_matnr != matnr) {
 				glEnd();
 
 				dodraw = setMaterial(matnr = new_matnr, &gattribs);
-				if(dodraw)
+				if (dodraw)
 					DM_vertex_attributes_from_gpu(dm, &gattribs, &attribs);
 
 				glBegin(GL_QUADS);
 			}
 
-			if(!dodraw) {
+			if (!dodraw) {
 				continue;
 			}
-			else if(setDrawOptions) {
+			else if (setDrawOptions) {
 				orig = (index)? index[a]: a;
 
-				if(orig == ORIGINDEX_NONE) {
+				if (orig == ORIGINDEX_NONE) {
 					/* since the material is set by setMaterial(), faces with no
 					 * origin can be assumed to be generated by a modifier */ 
 					
 					/* continue */
 				}
-				else if(!setDrawOptions(userData, orig))
+				else if (setDrawOptions(userData, orig) == DM_DRAW_OPTION_SKIP)
 					continue;
 			}
 
-			if(!smoothnormal) {
-				if(nors) {
+			if (!smoothnormal) {
+				if (nors) {
 					glNormal3fv(nors[a]);
 				}
 				else {
 					/* TODO ideally a normal layer should always be available */
 					float nor[3];
-					if(mface->v4) {
+					if (mface->v4) {
 						normal_quad_v3( nor,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co, mvert[mface->v4].co);
-					} else {
+					}
+					else {
 						normal_tri_v3( nor,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co);
 					}
 					glNormal3fv(nor);
@@ -1135,7 +1101,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
 			cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v2, 1, smoothnormal);
 			cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v3, 2, smoothnormal);
 
-			if(mface->v4)
+			if (mface->v4)
 				cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v4, 3, smoothnormal);
 			else
 				cddm_draw_attrib_vertex(&attribs, mvert, a, mface->v3, 2, smoothnormal);
@@ -1156,21 +1122,21 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
 		GPU_vertex_setup(dm);
 		GPU_normal_setup(dm);
 
-		if( !GPU_buffer_legacy(dm) ) {
-			for( i = 0; i < dm->drawObject->tot_triangle_point/3; i++ ) {
+		if ( !GPU_buffer_legacy(dm) ) {
+			for ( i = 0; i < dm->drawObject->tot_triangle_point/3; i++ ) {
 
 				a = dm->drawObject->triangle_to_mface[i];
 
 				mface = mf + a;
 				new_matnr = mface->mat_nr + 1;
 
-				if(new_matnr != matnr ) {
+				if (new_matnr != matnr ) {
 					numfaces = curface - start;
-					if( numfaces > 0 ) {
+					if ( numfaces > 0 ) {
 
-						if( dodraw ) {
+						if ( dodraw ) {
 
-							if( numdata != 0 ) {
+							if ( numdata != 0 ) {
 
 								GPU_buffer_unlock(buffer);
 
@@ -1179,7 +1145,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
 
 							glDrawArrays(GL_TRIANGLES,start*3,numfaces*3);
 
-							if( numdata != 0 ) {
+							if ( numdata != 0 ) {
 
 								GPU_buffer_free(buffer);
 
@@ -1192,43 +1158,43 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
 					start = curface;
 					/* prevdraw = dodraw; */ /* UNUSED */
 					dodraw = setMaterial(matnr = new_matnr, &gattribs);
-					if(dodraw) {
+					if (dodraw) {
 						DM_vertex_attributes_from_gpu(dm, &gattribs, &attribs);
 
-						if(attribs.totorco) {
+						if (attribs.totorco) {
 							datatypes[numdata].index = attribs.orco.glIndex;
 							datatypes[numdata].size = 3;
 							datatypes[numdata].type = GL_FLOAT;
 							numdata++;
 						}
-						for(b = 0; b < attribs.tottface; b++) {
+						for (b = 0; b < attribs.tottface; b++) {
 							datatypes[numdata].index = attribs.tface[b].glIndex;
 							datatypes[numdata].size = 2;
 							datatypes[numdata].type = GL_FLOAT;
 							numdata++;
 						}	
-						for(b = 0; b < attribs.totmcol; b++) {
+						for (b = 0; b < attribs.totmcol; b++) {
 							datatypes[numdata].index = attribs.mcol[b].glIndex;
 							datatypes[numdata].size = 4;
 							datatypes[numdata].type = GL_UNSIGNED_BYTE;
 							numdata++;
 						}	
-						if(attribs.tottang) {
+						if (attribs.tottang) {
 							datatypes[numdata].index = attribs.tang.glIndex;
 							datatypes[numdata].size = 4;
 							datatypes[numdata].type = GL_FLOAT;
 							numdata++;
 						}
-						if( numdata != 0 ) {
+						if ( numdata != 0 ) {
 							elementsize = GPU_attrib_element_size( datatypes, numdata );
 							buffer = GPU_buffer_alloc( elementsize*dm->drawObject->tot_triangle_point);
-							if( buffer == NULL ) {
+							if ( buffer == NULL ) {
 								GPU_buffer_unbind();
 								dm->drawObject->legacy = 1;
 								return;
 							}
 							varray = GPU_buffer_lock_stream(buffer);
-							if( varray == NULL ) {
+							if ( varray == NULL ) {
 								GPU_buffer_unbind();
 								GPU_buffer_free(buffer);
 								dm->drawObject->legacy = 1;
@@ -1236,7 +1202,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
 							}
 						}
 						else {
-							/* if the buffer was set, dont use it again.
+							/* if the buffer was set, don't use it again.
 							 * prevdraw was assumed true but didnt run so set to false - [#21036] */
 							/* prevdraw= 0; */ /* UNUSED */
 							buffer= NULL;
@@ -1244,15 +1210,15 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
 					}
 				}
 
-				if(dodraw && numdata != 0 ) {
+				if (dodraw && numdata != 0 ) {
 					offset = 0;
-					if(attribs.totorco) {
+					if (attribs.totorco) {
 						copy_v3_v3((float *)&varray[elementsize*curface*3],(float *)attribs.orco.array[mface->v1]);
 						copy_v3_v3((float *)&varray[elementsize*curface*3+elementsize],(float *)attribs.orco.array[mface->v2]);
 						copy_v3_v3((float *)&varray[elementsize*curface*3+elementsize*2],(float *)attribs.orco.array[mface->v3]);
 						offset += sizeof(float)*3;
 					}
-					for(b = 0; b < attribs.tottface; b++) {
+					for (b = 0; b < attribs.tottface; b++) {
 						MTFace *tf = &attribs.tface[b].array[a];
 						copy_v2_v2((float *)&varray[elementsize*curface*3+offset],tf->uv[0]);
 						copy_v2_v2((float *)&varray[elementsize*curface*3+offset+elementsize],tf->uv[1]);
@@ -1260,7 +1226,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
 						copy_v2_v2((float *)&varray[elementsize*curface*3+offset+elementsize*2],tf->uv[2]);
 						offset += sizeof(float)*2;
 					}
-					for(b = 0; b < attribs.totmcol; b++) {
+					for (b = 0; b < attribs.totmcol; b++) {
 						MCol *cp = &attribs.mcol[b].array[a*4 + 0];
 						GLubyte col[4];
 						col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a;
@@ -1273,7 +1239,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
 						copy_v4_v4_char((char *)&varray[elementsize*curface*3+offset+elementsize*2], (char *)col);
 						offset += sizeof(unsigned char)*4;
 					}	
-					if(attribs.tottang) {
+					if (attribs.tottang) {
 						float *tang = attribs.tang.array[a*4 + 0];
 						copy_v4_v4((float *)&varray[elementsize*curface*3+offset], tang);
 						tang = attribs.tang.array[a*4 + 1];
@@ -1285,23 +1251,23 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
 					(void)offset;
 				}
 				curface++;
-				if(mface->v4) {
-					if(dodraw && numdata != 0 ) {
+				if (mface->v4) {
+					if (dodraw && numdata != 0 ) {
 						offset = 0;
-						if(attribs.totorco) {
+						if (attribs.totorco) {
 							copy_v3_v3((float *)&varray[elementsize*curface*3],(float *)attribs.orco.array[mface->v3]);
 							copy_v3_v3((float *)&varray[elementsize*curface*3+elementsize],(float *)attribs.orco.array[mface->v4]);
 							copy_v3_v3((float *)&varray[elementsize*curface*3+elementsize*2],(float *)attribs.orco.array[mface->v1]);
 							offset += sizeof(float)*3;
 						}
-						for(b = 0; b < attribs.tottface; b++) {
+						for (b = 0; b < attribs.tottface; b++) {
 							MTFace *tf = &attribs.tface[b].array[a];
 							copy_v2_v2((float *)&varray[elementsize*curface*3+offset],tf->uv[2]);
 							copy_v2_v2((float *)&varray[elementsize*curface*3+offset+elementsize],tf->uv[3]);
 							copy_v2_v2((float *)&varray[elementsize*curface*3+offset+elementsize*2],tf->uv[0]);
 							offset += sizeof(float)*2;
 						}
-						for(b = 0; b < attribs.totmcol; b++) {
+						for (b = 0; b < attribs.totmcol; b++) {
 							MCol *cp = &attribs.mcol[b].array[a*4 + 2];
 							GLubyte col[4];
 							col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a;
@@ -1314,7 +1280,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
 							copy_v4_v4_char((char *)&varray[elementsize*curface*3+offset+elementsize*2], (char *)col);
 							offset += sizeof(unsigned char)*4;
 						}	
-						if(attribs.tottang) {
+						if (attribs.tottang) {
 							float *tang = attribs.tang.array[a*4 + 2];
 							copy_v4_v4((float *)&varray[elementsize*curface*3+offset], tang);
 							tang = attribs.tang.array[a*4 + 3];
@@ -1330,9 +1296,9 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
 				}
 			}
 			numfaces = curface - start;
-			if( numfaces > 0 ) {
-				if( dodraw ) {
-					if( numdata != 0 ) {
+			if ( numfaces > 0 ) {
+				if ( dodraw ) {
+					if ( numdata != 0 ) {
 						GPU_buffer_unlock(buffer);
 						GPU_interleaved_attrib_setup(buffer,datatypes,numdata);
 					}
@@ -1347,7 +1313,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
 	glShadeModel(GL_FLAT);
 }
 
-static void cdDM_drawFacesGLSL(DerivedMesh *dm,int (*setMaterial)(int, void *attribs))
+static void cdDM_drawFacesGLSL(DerivedMesh *dm, DMSetMaterial setMaterial)
 {
 	dm->drawMappedFacesGLSL(dm, setMaterial, NULL, NULL);
 }
@@ -1361,9 +1327,9 @@ static void cdDM_drawMappedFacesMat(DerivedMesh *dm,
 	DMVertexAttribs attribs;
 	MVert *mvert = cddm->mvert;
 	MFace *mf = cddm->mface;
-	float (*nors)[3] = dm->getFaceDataArray(dm, CD_NORMAL);
+	float (*nors)[3] = dm->getTessFaceDataArray(dm, CD_NORMAL);
 	int a, matnr, new_matnr;
-	int orig, *index = dm->getFaceDataArray(dm, CD_ORIGINDEX);
+	int orig, *index = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
 
 	cdDM_update_normals_from_pbvh(dm);
 
@@ -1375,13 +1341,13 @@ static void cdDM_drawMappedFacesMat(DerivedMesh *dm,
 
 	glBegin(GL_QUADS);
 
-	for(a = 0; a < dm->numFaceData; a++, mf++) {
+	for (a = 0; a < dm->numTessFaceData; a++, mf++) {
 		const int smoothnormal = (mf->flag & ME_SMOOTH);
 
 		/* material */
 		new_matnr = mf->mat_nr + 1;
 
-		if(new_matnr != matnr) {
+		if (new_matnr != matnr) {
 			glEnd();
 
 			setMaterial(userData, matnr = new_matnr, &gattribs);
@@ -1391,23 +1357,23 @@ static void cdDM_drawMappedFacesMat(DerivedMesh *dm,
 		}
 
 		/* skipping faces */
-		if(setFace) {
+		if (setFace) {
 			orig = (index)? index[a]: a;
 
-			if(orig != ORIGINDEX_NONE && !setFace(userData, orig))
+			if (orig != ORIGINDEX_NONE && !setFace(userData, orig))
 				continue;
 		}
 
 		/* smooth normal */
-		if(!smoothnormal) {
-			if(nors) {
+		if (!smoothnormal) {
+			if (nors) {
 				glNormal3fv(nors[a]);
 			}
 			else {
 				/* TODO ideally a normal layer should always be available */
 				float nor[3];
 
-				if(mf->v4)
+				if (mf->v4)
 					normal_quad_v3( nor,mvert[mf->v1].co, mvert[mf->v2].co, mvert[mf->v3].co, mvert[mf->v4].co);
 				else
 					normal_tri_v3( nor,mvert[mf->v1].co, mvert[mf->v2].co, mvert[mf->v3].co);
@@ -1421,7 +1387,7 @@ static void cdDM_drawMappedFacesMat(DerivedMesh *dm,
 		cddm_draw_attrib_vertex(&attribs, mvert, a, mf->v2, 1, smoothnormal);
 		cddm_draw_attrib_vertex(&attribs, mvert, a, mf->v3, 2, smoothnormal);
 
-		if(mf->v4)
+		if (mf->v4)
 			cddm_draw_attrib_vertex(&attribs, mvert, a, mf->v4, 3, smoothnormal);
 		else
 			cddm_draw_attrib_vertex(&attribs, mvert, a, mf->v3, 2, smoothnormal);
@@ -1431,7 +1397,7 @@ static void cdDM_drawMappedFacesMat(DerivedMesh *dm,
 	glShadeModel(GL_FLAT);
 }
 
-static void cdDM_drawMappedEdges(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index), void *userData)
+static void cdDM_drawMappedEdges(DerivedMesh *dm, DMSetDrawOptions setDrawOptions, void *userData)
 {
 	CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
 	MVert *vert = cddm->mvert;
@@ -1439,15 +1405,15 @@ static void cdDM_drawMappedEdges(DerivedMesh *dm, int (*setDrawOptions)(void *us
 	int i, orig, *index = DM_get_edge_data_layer(dm, CD_ORIGINDEX);
 
 	glBegin(GL_LINES);
-	for(i = 0; i < dm->numEdgeData; i++, edge++) {
-		if(index) {
+	for (i = 0; i < dm->numEdgeData; i++, edge++) {
+		if (index) {
 			orig = *index++;
-			if(setDrawOptions && orig == ORIGINDEX_NONE) continue;
+			if (setDrawOptions && orig == ORIGINDEX_NONE) continue;
 		}
 		else
 			orig = i;
 
-		if(!setDrawOptions || setDrawOptions(userData, orig)) {
+		if (!setDrawOptions || (setDrawOptions(userData, orig) != DM_DRAW_OPTION_SKIP)) {
 			glVertex3fv(vert[edge->v1].co);
 			glVertex3fv(vert[edge->v2].co);
 		}
@@ -1456,18 +1422,17 @@ static void cdDM_drawMappedEdges(DerivedMesh *dm, int (*setDrawOptions)(void *us
 }
 
 static void cdDM_foreachMappedVert(
-						   DerivedMesh *dm,
-						   void (*func)(void *userData, int index, float *co,
-										float *no_f, short *no_s),
-						   void *userData)
+        DerivedMesh *dm,
+        void (*func)(void *userData, int index, const float co[3], const float no_f[3], const short no_s[3]),
+        void *userData)
 {
 	MVert *mv = CDDM_get_verts(dm);
 	int i, orig, *index = DM_get_vert_data_layer(dm, CD_ORIGINDEX);
 
-	for(i = 0; i < dm->numVertData; i++, mv++) {
-		if(index) {
+	for (i = 0; i < dm->numVertData; i++, mv++) {
+		if (index) {
 			orig = *index++;
-			if(orig == ORIGINDEX_NONE) continue;
+			if (orig == ORIGINDEX_NONE) continue;
 			func(userData, orig, mv->co, NULL, mv->no);
 		}
 		else
@@ -1476,20 +1441,19 @@ static void cdDM_foreachMappedVert(
 }
 
 static void cdDM_foreachMappedEdge(
-						   DerivedMesh *dm,
-						   void (*func)(void *userData, int index,
-										float *v0co, float *v1co),
-						   void *userData)
+        DerivedMesh *dm,
+        void (*func)(void *userData, int index, const float v0co[3], const float v1co[3]),
+        void *userData)
 {
 	CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
 	MVert *mv = cddm->mvert;
 	MEdge *med = cddm->medge;
 	int i, orig, *index = DM_get_edge_data_layer(dm, CD_ORIGINDEX);
 
-	for(i = 0; i < dm->numEdgeData; i++, med++) {
+	for (i = 0; i < dm->numEdgeData; i++, med++) {
 		if (index) {
 			orig = *index++;
-			if(orig == ORIGINDEX_NONE) continue;
+			if (orig == ORIGINDEX_NONE) continue;
 			func(userData, orig, mv[med->v1].co, mv[med->v2].co);
 		}
 		else
@@ -1498,48 +1462,86 @@ static void cdDM_foreachMappedEdge(
 }
 
 static void cdDM_foreachMappedFaceCenter(
-						   DerivedMesh *dm,
-						   void (*func)(void *userData, int index,
-										float *cent, float *no),
-						   void *userData)
+        DerivedMesh *dm,
+        void (*func)(void *userData, int index, const float cent[3], const float no[3]),
+        void *userData)
 {
 	CDDerivedMesh *cddm = (CDDerivedMesh*)dm;
 	MVert *mv = cddm->mvert;
-	MFace *mf = cddm->mface;
-	int i, orig, *index = DM_get_face_data_layer(dm, CD_ORIGINDEX);
+	MPoly *mp = cddm->mpoly;
+	MLoop *ml = cddm->mloop;
+	int i, j, orig, *index;
 
-	for(i = 0; i < dm->numFaceData; i++, mf++) {
+	index = CustomData_get_layer(&dm->polyData, CD_ORIGINDEX);
+	mp = cddm->mpoly;
+	for (i = 0; i < dm->numPolyData; i++, mp++) {
 		float cent[3];
 		float no[3];
 
 		if (index) {
 			orig = *index++;
-			if(orig == ORIGINDEX_NONE) continue;
+			if (orig == ORIGINDEX_NONE) continue;
 		}
 		else
 			orig = i;
-
-		copy_v3_v3(cent, mv[mf->v1].co);
-		add_v3_v3(cent, mv[mf->v2].co);
-		add_v3_v3(cent, mv[mf->v3].co);
-
-		if (mf->v4) {
-			normal_quad_v3( no,mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co, mv[mf->v4].co);
-			add_v3_v3(cent, mv[mf->v4].co);
-			mul_v3_fl(cent, 0.25f);
-		} else {
-			normal_tri_v3( no,mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co);
-			mul_v3_fl(cent, 0.33333333333f);
+		
+		ml = &cddm->mloop[mp->loopstart];
+		cent[0] = cent[1] = cent[2] = 0.0f;
+		for (j=0; j<mp->totloop; j++, ml++) {
+			add_v3_v3v3(cent, cent, mv[ml->v].co);
+		}
+		mul_v3_fl(cent, 1.0f / (float)j);
+
+		ml = &cddm->mloop[mp->loopstart];
+		if (j > 3) {
+			normal_quad_v3(no,
+			               mv[(ml + 0)->v].co,
+			               mv[(ml + 1)->v].co,
+			               mv[(ml + 2)->v].co,
+			               mv[(ml + 3)->v].co);
+		}
+		else {
+			normal_tri_v3(no,
+			              mv[(ml + 0)->v].co,
+			              mv[(ml + 1)->v].co,
+			              mv[(ml + 2)->v].co);
 		}
 
 		func(userData, orig, cent, no);
 	}
+
+}
+
+void CDDM_recalc_tessellation_ex(DerivedMesh *dm, const int do_face_nor_cpy)
+{
+	CDDerivedMesh *cddm = (CDDerivedMesh*)dm;
+
+	dm->numTessFaceData = mesh_recalcTessellation(&dm->faceData, &dm->loopData, &dm->polyData,
+	                                             cddm->mvert,
+	                                             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
+	 * from loops and polys to faces */
+	CustomData_bmesh_update_active_layers(&dm->faceData, &dm->polyData, &dm->loopData);
+}
+
+void CDDM_recalc_tessellation(DerivedMesh *dm)
+{
+	CDDM_recalc_tessellation_ex(dm, TRUE);
 }
 
 static void cdDM_free_internal(CDDerivedMesh *cddm)
 {
-	if(cddm->fmap) MEM_freeN(cddm->fmap);
-	if(cddm->fmap_mem) MEM_freeN(cddm->fmap_mem);
+	if (cddm->pmap) MEM_freeN(cddm->pmap);
+	if (cddm->pmap_mem) MEM_freeN(cddm->pmap_mem);
 }
 
 static void cdDM_release(DerivedMesh *dm)
@@ -1552,6 +1554,11 @@ static void cdDM_release(DerivedMesh *dm)
 	}
 }
 
+int CDDM_Check(DerivedMesh *dm)
+{
+	return dm && dm->getMinMax == cdDM_getMinMax;
+}
+
 /**************** CDDM interface functions ****************/
 static CDDerivedMesh *cdDM_create(const char *desc)
 {
@@ -1564,28 +1571,37 @@ static CDDerivedMesh *cdDM_create(const char *desc)
 	dm->getMinMax = cdDM_getMinMax;
 
 	dm->getNumVerts = cdDM_getNumVerts;
-	dm->getNumFaces = cdDM_getNumFaces;
 	dm->getNumEdges = cdDM_getNumEdges;
+	dm->getNumTessFaces = cdDM_getNumTessFaces;
+	dm->getNumLoops = cdDM_getNumLoops;
+	dm->getNumPolys = cdDM_getNumPolys;
 
 	dm->getVert = cdDM_getVert;
 	dm->getEdge = cdDM_getEdge;
-	dm->getFace = cdDM_getFace;
+	dm->getTessFace = cdDM_getTessFace;
+
 	dm->copyVertArray = cdDM_copyVertArray;
 	dm->copyEdgeArray = cdDM_copyEdgeArray;
-	dm->copyFaceArray = cdDM_copyFaceArray;
+	dm->copyTessFaceArray = cdDM_copyTessFaceArray;
+	dm->copyLoopArray = cdDM_copyLoopArray;
+	dm->copyPolyArray = cdDM_copyPolyArray;
+
 	dm->getVertData = DM_get_vert_data;
 	dm->getEdgeData = DM_get_edge_data;
-	dm->getFaceData = DM_get_face_data;
+	dm->getTessFaceData = DM_get_tessface_data;
 	dm->getVertDataArray = DM_get_vert_data_layer;
 	dm->getEdgeDataArray = DM_get_edge_data_layer;
-	dm->getFaceDataArray = DM_get_face_data_layer;
+	dm->getTessFaceDataArray = DM_get_tessface_data_layer;
+
+	dm->calcNormals = CDDM_calc_normals_mapping;
+	dm->recalcTessellation = CDDM_recalc_tessellation;
 
 	dm->getVertCos = cdDM_getVertCos;
 	dm->getVertCo = cdDM_getVertCo;
 	dm->getVertNo = cdDM_getVertNo;
 
 	dm->getPBVH = cdDM_getPBVH;
-	dm->getFaceMap = cdDM_getFaceMap;
+	dm->getPolyMap = cdDM_getPolyMap;
 
 	dm->drawVerts = cdDM_drawVerts;
 
@@ -1595,7 +1611,6 @@ static CDDerivedMesh *cdDM_create(const char *desc)
 	dm->drawMappedEdges = cdDM_drawMappedEdges;
 
 	dm->drawFacesSolid = cdDM_drawFacesSolid;
-	dm->drawFacesColored = cdDM_drawFacesColored;
 	dm->drawFacesTex = cdDM_drawFacesTex;
 	dm->drawFacesGLSL = cdDM_drawFacesGLSL;
 	dm->drawMappedFaces = cdDM_drawMappedFaces;
@@ -1612,24 +1627,30 @@ static CDDerivedMesh *cdDM_create(const char *desc)
 	return cddm;
 }
 
-DerivedMesh *CDDM_new(int numVerts, int numEdges, int numFaces)
+DerivedMesh *CDDM_new(int numVerts, int numEdges, int numTessFaces, int numLoops, int numPolys)
 {
 	CDDerivedMesh *cddm = cdDM_create("CDDM_new dm");
 	DerivedMesh *dm = &cddm->dm;
 
-	DM_init(dm, DM_TYPE_CDDM, numVerts, numEdges, numFaces);
+	DM_init(dm, DM_TYPE_CDDM, numVerts, numEdges, numTessFaces, numLoops, numPolys);
 
 	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, numFaces);
+	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);
 	CustomData_add_layer(&dm->edgeData, CD_MEDGE, CD_CALLOC, NULL, numEdges);
-	CustomData_add_layer(&dm->faceData, CD_MFACE, CD_CALLOC, NULL, numFaces);
+	CustomData_add_layer(&dm->faceData, CD_MFACE, CD_CALLOC, NULL, numTessFaces);
+	CustomData_add_layer(&dm->loopData, CD_MLOOP, CD_CALLOC, NULL, numLoops);
+	CustomData_add_layer(&dm->polyData, CD_MPOLY, CD_CALLOC, NULL, numPolys);
 
 	cddm->mvert = CustomData_get_layer(&dm->vertData, CD_MVERT);
 	cddm->medge = CustomData_get_layer(&dm->edgeData, CD_MEDGE);
 	cddm->mface = CustomData_get_layer(&dm->faceData, CD_MFACE);
+	cddm->mloop = CustomData_get_layer(&dm->loopData, CD_MLOOP);
+	cddm->mpoly = CustomData_get_layer(&dm->polyData, CD_MPOLY);
 
 	return dm;
 }
@@ -1640,10 +1661,12 @@ 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 */
 
-	DM_init(dm, DM_TYPE_CDDM, mesh->totvert, mesh->totedge, mesh->totface);
+	DM_init(dm, DM_TYPE_CDDM, mesh->totvert, mesh->totedge, mesh->totface,
+	            mesh->totloop, mesh->totpoly);
 
 	dm->deformedOnly = 1;
 
@@ -1653,185 +1676,341 @@ 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, alloctype,
+	CustomData_merge(&mesh->fdata, &dm->faceData, mask|CD_MASK_POLYINDEX, alloctype,
 					 mesh->totface);
+	CustomData_merge(&mesh->ldata, &dm->loopData, mask, alloctype,
+	                 mesh->totloop);
+	CustomData_merge(&mesh->pdata, &dm->polyData, mask, alloctype,
+	                 mesh->totpoly);
 
 	cddm->mvert = CustomData_get_layer(&dm->vertData, CD_MVERT);
 	cddm->medge = CustomData_get_layer(&dm->edgeData, CD_MEDGE);
+	cddm->mloop = CustomData_get_layer(&dm->loopData, CD_MLOOP);
+	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
+	 * on the default cube, (after editmode toggle too) - campbell */
+#if 0
+	BLI_assert(CustomData_has_layer(&cddm->dm.faceData, CD_POLYINDEX));
+#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;
 }
 
-DerivedMesh *CDDM_from_editmesh(EditMesh *em, Mesh *UNUSED(me))
+DerivedMesh *CDDM_from_curve(Object *ob)
 {
-	DerivedMesh *dm = CDDM_new(BLI_countlist(&em->verts),
-							   BLI_countlist(&em->edges),
-							   BLI_countlist(&em->faces));
-	CDDerivedMesh *cddm = (CDDerivedMesh*)dm;
-	EditVert *eve;
-	EditEdge *eed;
-	EditFace *efa;
-	MVert *mvert = cddm->mvert;
-	MEdge *medge = cddm->medge;
-	MFace *mface = cddm->mface;
-	int i, *index;
+	return CDDM_from_curve_customDB(ob, &ob->disp);
+}
 
+DerivedMesh *CDDM_from_curve_customDB(Object *ob, ListBase *dispbase)
+{
+	DerivedMesh *dm;
+	CDDerivedMesh *cddm;
+	MVert *allvert;
+	MEdge *alledge;
+	MLoop *allloop;
+	MPoly *allpoly;
+	int totvert, totedge, totloop, totpoly;
+
+	if (nurbs_to_mdata_customdb(ob, dispbase, &allvert, &totvert, &alledge,
+		&totedge, &allloop, &allpoly, &totloop, &totpoly) != 0) {
+		/* Error initializing mdata. This often happens when curve is empty */
+		return CDDM_new(0, 0, 0, 0, 0);
+	}
+
+	dm = CDDM_new(totvert, totedge, 0, totloop, totpoly);
 	dm->deformedOnly = 1;
 
-	CustomData_merge(&em->vdata, &dm->vertData, CD_MASK_DERIVEDMESH,
-					 CD_CALLOC, dm->numVertData);
-	/* CustomData_merge(&em->edata, &dm->edgeData, CD_MASK_DERIVEDMESH,
-					 CD_CALLOC, dm->numEdgeData); */
-	CustomData_merge(&em->fdata, &dm->faceData, CD_MASK_DERIVEDMESH,
-					 CD_CALLOC, dm->numFaceData);
+	cddm = (CDDerivedMesh*)dm;
+
+	memcpy(cddm->mvert, allvert, totvert*sizeof(MVert));
+	memcpy(cddm->medge, alledge, totedge*sizeof(MEdge));
+	memcpy(cddm->mloop, allloop, totloop*sizeof(MLoop));
+	memcpy(cddm->mpoly, allpoly, totpoly*sizeof(MPoly));
+
+	MEM_freeN(allvert);
+	MEM_freeN(alledge);
+	MEM_freeN(allloop);
+	MEM_freeN(allpoly);
+
+	CDDM_calc_edges(dm);
+
+	return dm;
+}
+
+static void loops_to_customdata_corners(BMesh *bm, CustomData *facedata,
+					  int cdindex, BMLoop *l3[3],
+					  int numCol, int numTex)
+{
+	BMLoop *l;
+	BMFace *f = l3[0]->f;
+	MTFace *texface;
+	MTexPoly *texpoly;
+	MCol *mcol;
+	MLoopCol *mloopcol;
+	MLoopUV *mloopuv;
+	int i, j, hasPCol = CustomData_has_layer(&bm->ldata, CD_PREVIEW_MLOOPCOL);
+
+	for (i=0; i < numTex; i++) {
+		texface = CustomData_get_n(facedata, CD_MTFACE, cdindex, i);
+		texpoly = CustomData_bmesh_get_n(&bm->pdata, f->head.data, CD_MTEXPOLY, i);
+		
+		ME_MTEXFACE_CPY(texface, texpoly);
+	
+		for (j=0; j<3; j++) {
+			l = l3[j];
+			mloopuv = CustomData_bmesh_get_n(&bm->ldata, l->head.data, CD_MLOOPUV, i);
+			copy_v2_v2(texface->uv[j], mloopuv->uv);
+		}
+	}
+
+	for (i=0; i < numCol; i++) {
+		mcol = CustomData_get_n(facedata, CD_MCOL, cdindex, i);
+		
+		for (j=0; j<3; j++) {
+			l = l3[j];
+			mloopcol = CustomData_bmesh_get_n(&bm->ldata, l->head.data, CD_MLOOPCOL, i);
+			MESH_MLOOPCOL_TO_MCOL(mloopcol, &mcol[j]);
+		}
+	}
 
-	/* set eve->hash to vert index */
-	for(i = 0, eve = em->verts.first; eve; eve = eve->next, ++i)
-		eve->tmp.l = i;
+	if (hasPCol) {
+		mcol = CustomData_get(facedata, cdindex, CD_PREVIEW_MCOL);
 
-	/* Need to be able to mark loose edges */
-	for(eed = em->edges.first; eed; eed = eed->next) {
-		eed->f2 = 0;
+		for (j=0; j<3; j++) {
+			l = l3[j];
+			mloopcol = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_PREVIEW_MLOOPCOL);
+			MESH_MLOOPCOL_TO_MCOL(mloopcol, &mcol[j]);
+		}
 	}
-	for(efa = em->faces.first; efa; efa = efa->next) {
-		efa->e1->f2 = 1;
-		efa->e2->f2 = 1;
-		efa->e3->f2 = 1;
-		if(efa->e4) efa->e4->f2 = 1;
+}
+
+DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdisps, int use_tessface)
+{
+	BMesh *bm = em->bm;
+
+	DerivedMesh *dm = CDDM_new(bm->totvert,
+	                           bm->totedge,
+	                           use_tessface ? em->tottri : 0,
+	                           bm->totloop,
+	                           bm->totface);
+
+	CDDerivedMesh *cddm = (CDDerivedMesh*)dm;
+	BMIter iter, liter;
+	BMVert *eve;
+	BMEdge *eed;
+	BMFace *efa;
+	MVert *mvert = cddm->mvert;
+	MEdge *medge = cddm->medge;
+	MFace *mface = cddm->mface;
+	MLoop *mloop = cddm->mloop;
+	MPoly *mpoly = cddm->mpoly;
+	int numCol = CustomData_number_of_layers(&bm->ldata, CD_MLOOPCOL);
+	int numTex = CustomData_number_of_layers(&bm->pdata, CD_MTEXPOLY);
+	int *index, add_orig;
+	int has_crease, has_edge_bweight, has_vert_bweight;
+	CustomDataMask mask;
+	unsigned int i, j;
+	
+	has_edge_bweight = CustomData_has_layer(&bm->edata, CD_BWEIGHT);
+	has_vert_bweight = CustomData_has_layer(&bm->vdata, CD_BWEIGHT);
+	has_crease = CustomData_has_layer(&bm->edata, CD_CREASE);
+	
+	dm->deformedOnly = 1;
+	
+	/*don't add origindex layer if one already exists*/
+	add_orig = !CustomData_has_layer(&bm->pdata, CD_ORIGINDEX);
+
+	mask = use_mdisps ? CD_MASK_DERIVEDMESH|CD_MASK_MDISPS : CD_MASK_DERIVEDMESH;
+	
+	/* don't process shapekeys, we only feed them through the modifier stack as needed,
+	 * e.g. for applying modifiers or the like*/
+	mask &= ~CD_MASK_SHAPEKEY;
+	CustomData_merge(&bm->vdata, &dm->vertData, mask,
+	                 CD_CALLOC, dm->numVertData);
+	CustomData_merge(&bm->edata, &dm->edgeData, mask,
+	                 CD_CALLOC, dm->numEdgeData);
+	CustomData_merge(&bm->ldata, &dm->loopData, mask,
+	                 CD_CALLOC, dm->numLoopData);
+	CustomData_merge(&bm->pdata, &dm->polyData, mask,
+	                 CD_CALLOC, dm->numPolyData);
+	
+	/*add tessellation mface layers*/
+	if (use_tessface) {
+		CustomData_from_bmeshpoly(&dm->faceData, &dm->polyData, &dm->loopData, em->tottri);
 	}
 
 	index = dm->getVertDataArray(dm, CD_ORIGINDEX);
-	for(i = 0, eve = em->verts.first; i < dm->numVertData;
-		i++, eve = eve->next, index++) {
+
+	eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL);
+	for (i=0; eve; eve=BM_iter_step(&iter), i++, index++) {
 		MVert *mv = &mvert[i];
 
 		copy_v3_v3(mv->co, eve->co);
 
+		BM_elem_index_set(eve, i); /* set_inline */
+
 		normal_float_to_short_v3(mv->no, eve->no);
-		mv->bweight = (unsigned char) (eve->bweight * 255.0f);
 
-		mv->flag = 0;
+		mv->flag = BM_vert_flag_to_mflag(eve);
 
-		*index = i;
+		if (has_vert_bweight)
+			mv->bweight = (unsigned char)(BM_elem_float_data_get(&bm->vdata, eve, CD_BWEIGHT)*255.0f);
 
-		CustomData_from_em_block(&em->vdata, &dm->vertData, eve->data, i);
+		if (add_orig) *index = i;
+
+		CustomData_from_bmesh_block(&bm->vdata, &dm->vertData, eve->head.data, i);
 	}
+	bm->elem_index_dirty &= ~BM_VERT;
 
 	index = dm->getEdgeDataArray(dm, CD_ORIGINDEX);
-	for(i = 0, eed = em->edges.first; i < dm->numEdgeData;
-		i++, eed = eed->next, index++) {
+	eed = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, NULL);
+	for (i=0; eed; eed=BM_iter_step(&iter), i++, index++) {
 		MEdge *med = &medge[i];
 
-		med->v1 = eed->v1->tmp.l;
-		med->v2 = eed->v2->tmp.l;
-		med->crease = (unsigned char) (eed->crease * 255.0f);
-		med->bweight = (unsigned char) (eed->bweight * 255.0f);
-		med->flag = ME_EDGEDRAW|ME_EDGERENDER;
-		
-		if(eed->seam) med->flag |= ME_SEAM;
-		if(eed->sharp) med->flag |= ME_SHARP;
-		if(!eed->f2) med->flag |= ME_LOOSEEDGE;
+		BM_elem_index_set(eed, i); /* set_inline */
 
-		*index = i;
+		med->v1 = BM_elem_index_get(eed->v1);
+		med->v2 = BM_elem_index_get(eed->v2);
 
-		/* CustomData_from_em_block(&em->edata, &dm->edgeData, eed->data, i); */
-	}
+		if (has_crease)
+			med->crease = (unsigned char)(BM_elem_float_data_get(&bm->edata, eed, CD_CREASE)*255.0f);
+		if (has_edge_bweight)
+			med->bweight = (unsigned char)(BM_elem_float_data_get(&bm->edata, eed, CD_BWEIGHT)*255.0f);
+		
+		med->flag = BM_edge_flag_to_mflag(eed);
 
-	index = dm->getFaceDataArray(dm, CD_ORIGINDEX);
-	for(i = 0, efa = em->faces.first; i < dm->numFaceData;
-		i++, efa = efa->next, index++) {
-		MFace *mf = &mface[i];
+		CustomData_from_bmesh_block(&bm->edata, &dm->edgeData, eed->head.data, i);
+		if (add_orig) *index = i;
+	}
+	bm->elem_index_dirty &= ~BM_EDGE;
 
-		mf->v1 = efa->v1->tmp.l;
-		mf->v2 = efa->v2->tmp.l;
-		mf->v3 = efa->v3->tmp.l;
-		mf->v4 = efa->v4 ? efa->v4->tmp.l : 0;
-		mf->mat_nr = efa->mat_nr;
-		mf->flag = efa->flag;
+	/* avoid this where possiblem, takes extra memory */
+	if (use_tessface) {
+		int *polyindex;
 
-		*index = i;
+		BM_mesh_elem_index_ensure(bm, BM_FACE);
 
-		CustomData_from_em_block(&em->fdata, &dm->faceData, efa->data, i);
-		test_index_face(mf, &dm->faceData, i, efa->v4?4:3);
-	}
+		polyindex = dm->getTessFaceDataArray(dm, CD_POLYINDEX);
+		index = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
+		for (i = 0; i < dm->numTessFaceData; i++, index++, polyindex++) {
+			MFace *mf = &mface[i];
+			BMLoop **l = em->looptris[i];
+			efa = l[0]->f;
 
-	return dm;
-}
-
-DerivedMesh *CDDM_from_curve(Object *ob)
-{
-	return CDDM_from_curve_customDB(ob, &ob->disp);
-}
+			mf->v1 = BM_elem_index_get(l[0]->v);
+			mf->v2 = BM_elem_index_get(l[1]->v);
+			mf->v3 = BM_elem_index_get(l[2]->v);
+			mf->v4 = 0;
+			mf->mat_nr = efa->mat_nr;
+			mf->flag = BM_face_flag_to_mflag(efa);
 
-DerivedMesh *CDDM_from_curve_customDB(Object *ob, ListBase *dispbase)
-{
-	DerivedMesh *dm;
-	CDDerivedMesh *cddm;
-	MVert *allvert;
-	MEdge *alledge;
-	MFace *allface;
-	int totvert, totedge, totface;
+			*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);
 
-	if (nurbs_to_mdata_customdb(ob, dispbase, &allvert, &totvert, &alledge,
-		&totedge, &allface, &totface) != 0) {
-		/* Error initializing mdata. This often happens when curve is empty */
-		return CDDM_new(0, 0, 0);
+			loops_to_customdata_corners(bm, &dm->faceData, i, l, numCol, numTex);
+			test_index_face(mf, &dm->faceData, i, 3);
+		}
 	}
+	
+	index = CustomData_get_layer(&dm->polyData, CD_ORIGINDEX);
+	j = 0;
+	efa = BM_iter_new(&iter, bm, BM_FACES_OF_MESH, NULL);
+	for (i=0; efa; i++, efa=BM_iter_step(&iter), index++) {
+		BMLoop *l;
+		MPoly *mp = &mpoly[i];
+
+		BM_elem_index_set(efa, i); /* set_inline */
+
+		mp->totloop = efa->len;
+		mp->flag = BM_face_flag_to_mflag(efa);
+		mp->loopstart = j;
+		mp->mat_nr = efa->mat_nr;
+		
+		BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+			mloop->v = BM_elem_index_get(l->v);
+			mloop->e = BM_elem_index_get(l->e);
+			CustomData_from_bmesh_block(&bm->ldata, &dm->loopData, l->head.data, j);
 
-	dm = CDDM_new(totvert, totedge, totface);
-	dm->deformedOnly = 1;
-
-	cddm = (CDDerivedMesh*)dm;
+			j++;
+			mloop++;
+		}
 
-	memcpy(cddm->mvert, allvert, totvert*sizeof(MVert));
-	memcpy(cddm->medge, alledge, totedge*sizeof(MEdge));
-	memcpy(cddm->mface, allface, totface*sizeof(MFace));
+		CustomData_from_bmesh_block(&bm->pdata, &dm->polyData, efa->head.data, i);
 
-	MEM_freeN(allvert);
-	MEM_freeN(alledge);
-	MEM_freeN(allface);
+		if (add_orig) *index = i;
+	}
+	bm->elem_index_dirty &= ~BM_FACE;
 
 	return dm;
 }
 
-DerivedMesh *CDDM_copy(DerivedMesh *source)
+static DerivedMesh *cddm_copy_ex(DerivedMesh *source, int faces_from_tessfaces)
 {
 	CDDerivedMesh *cddm = cdDM_create("CDDM_copy cddm");
 	DerivedMesh *dm = &cddm->dm;
 	int numVerts = source->numVertData;
 	int numEdges = source->numEdgeData;
-	int numFaces = source->numFaceData;
+	int numTessFaces = source->numTessFaceData;
+	int numLoops = source->numLoopData;
+	int numPolys = source->numPolyData;
 
 	/* ensure these are created if they are made on demand */
 	source->getVertDataArray(source, CD_ORIGINDEX);
 	source->getEdgeDataArray(source, CD_ORIGINDEX);
-	source->getFaceDataArray(source, CD_ORIGINDEX);
+	source->getTessFaceDataArray(source, CD_ORIGINDEX);
 
 	/* this initializes dm, and copies all non mvert/medge/mface layers */
-	DM_from_template(dm, source, DM_TYPE_CDDM, numVerts, numEdges, numFaces);
+	DM_from_template(dm, source, DM_TYPE_CDDM, numVerts, numEdges, numTessFaces,
+		numLoops, numPolys);
 	dm->deformedOnly = source->deformedOnly;
+	dm->dirty = source->dirty;
 
 	CustomData_copy_data(&source->vertData, &dm->vertData, 0, 0, numVerts);
 	CustomData_copy_data(&source->edgeData, &dm->edgeData, 0, 0, numEdges);
-	CustomData_copy_data(&source->faceData, &dm->faceData, 0, 0, numFaces);
+	CustomData_copy_data(&source->faceData, &dm->faceData, 0, 0, numTessFaces);
 
 	/* now add mvert/medge/mface layers */
 	cddm->mvert = source->dupVertArray(source);
 	cddm->medge = source->dupEdgeArray(source);
-	cddm->mface = source->dupFaceArray(source);
+	cddm->mface = source->dupTessFaceArray(source);
 
 	CustomData_add_layer(&dm->vertData, CD_MVERT, CD_ASSIGN, cddm->mvert, numVerts);
 	CustomData_add_layer(&dm->edgeData, CD_MEDGE, CD_ASSIGN, cddm->medge, numEdges);
-	CustomData_add_layer(&dm->faceData, CD_MFACE, CD_ASSIGN, cddm->mface, numFaces);
+	CustomData_add_layer(&dm->faceData, CD_MFACE, CD_ASSIGN, cddm->mface, numTessFaces);
+	
+	if (!faces_from_tessfaces)
+		DM_DupPolys(source, dm);
+	else
+		CDDM_tessfaces_to_faces(dm);
+
+	cddm->mloop = CustomData_get_layer(&dm->loopData, CD_MLOOP);
+	cddm->mpoly = CustomData_get_layer(&dm->polyData, CD_MPOLY);
 
 	return dm;
 }
 
+DerivedMesh *CDDM_copy(DerivedMesh *source)
+{
+	return cddm_copy_ex(source, 0);
+}
+
+DerivedMesh *CDDM_copy_from_tessface(DerivedMesh *source)
+{
+	return cddm_copy_ex(source, 1);
+}
+
 /* note, the CD_ORIGINDEX layers are all 0, so if there is a direct
- * relationship betwen mesh data this needs to be set by the caller. */
+ * relationship between mesh data this needs to be set by the caller. */
 DerivedMesh *CDDM_from_template(DerivedMesh *source,
-								int numVerts, int numEdges, int numFaces)
+                                int numVerts, int numEdges, int numTessFaces,
+                                int numLoops, int numPolys)
 {
 	CDDerivedMesh *cddm = cdDM_create("CDDM_from_template dest");
 	DerivedMesh *dm = &cddm->dm;
@@ -1839,26 +2018,32 @@ DerivedMesh *CDDM_from_template(DerivedMesh *source,
 	/* ensure these are created if they are made on demand */
 	source->getVertDataArray(source, CD_ORIGINDEX);
 	source->getEdgeDataArray(source, CD_ORIGINDEX);
-	source->getFaceDataArray(source, CD_ORIGINDEX);
+	source->getTessFaceDataArray(source, CD_ORIGINDEX);
 
 	/* this does a copy of all non mvert/medge/mface layers */
-	DM_from_template(dm, source, DM_TYPE_CDDM, numVerts, numEdges, numFaces);
+	DM_from_template(dm, source, DM_TYPE_CDDM, numVerts, numEdges, numTessFaces, numLoops, numPolys);
 
 	/* now add mvert/medge/mface layers */
 	CustomData_add_layer(&dm->vertData, CD_MVERT, CD_CALLOC, NULL, numVerts);
 	CustomData_add_layer(&dm->edgeData, CD_MEDGE, CD_CALLOC, NULL, numEdges);
-	CustomData_add_layer(&dm->faceData, CD_MFACE, CD_CALLOC, NULL, numFaces);
+	CustomData_add_layer(&dm->faceData, CD_MFACE, CD_CALLOC, NULL, numTessFaces);
+	CustomData_add_layer(&dm->loopData, CD_MLOOP, CD_CALLOC, NULL, numLoops);
+	CustomData_add_layer(&dm->polyData, CD_MPOLY, CD_CALLOC, NULL, numPolys);
 
-	if(!CustomData_get_layer(&dm->vertData, CD_ORIGINDEX))
+	if (!CustomData_get_layer(&dm->vertData, CD_ORIGINDEX))
 		CustomData_add_layer(&dm->vertData, CD_ORIGINDEX, CD_CALLOC, NULL, numVerts);
-	if(!CustomData_get_layer(&dm->edgeData, CD_ORIGINDEX))
+	if (!CustomData_get_layer(&dm->edgeData, CD_ORIGINDEX))
 		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, numFaces);
+	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);
 	cddm->mface = CustomData_get_layer(&dm->faceData, CD_MFACE);
+	cddm->mloop = CustomData_get_layer(&dm->loopData, CD_MLOOP);
+	cddm->mpoly = CustomData_get_layer(&dm->polyData, CD_MPOLY);
 
 	return dm;
 }
@@ -1873,7 +2058,7 @@ void CDDM_apply_vert_coords(DerivedMesh *dm, float (*vertCoords)[3])
 	vert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT, dm->numVertData);
 	cddm->mvert = vert;
 
-	for(i = 0; i < dm->numVertData; ++i, ++vert)
+	for (i = 0; i < dm->numVertData; ++i, ++vert)
 		copy_v3_v3(vert->co, vertCoords[i]);
 }
 
@@ -1887,31 +2072,291 @@ void CDDM_apply_vert_normals(DerivedMesh *dm, short (*vertNormals)[3])
 	vert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT, dm->numVertData);
 	cddm->mvert = vert;
 
-	for(i = 0; i < dm->numVertData; ++i, ++vert)
+	for (i = 0; i < dm->numVertData; ++i, ++vert)
 		copy_v3_v3_short(vert->no, vertNormals[i]);
 }
 
+void CDDM_calc_normals_mapping_ex(DerivedMesh *dm, const short only_face_normals)
+{
+	CDDerivedMesh *cddm = (CDDerivedMesh*)dm;
+	float (*face_nors)[3] = NULL;
+
+	if (dm->numVertData == 0) return;
+
+	/* now we skip calculating vertex normals for referenced layer,
+	 * no need to duplicate verts.
+	 * WATCH THIS, bmesh only change!,
+	 * need to take care of the side effects here - campbell */
+	#if 0
+	/* we don't want to overwrite any referenced layers */
+	cddm->mvert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT, dm->numVertData);
+	#endif
+
+
+	if (dm->numTessFaceData == 0) {
+		/* No tessellation on this mesh yet, need to calculate one.
+		 *
+		 * Important not to update face normals from polys since it
+		 * interfears with assigning the new normal layer in the following code.
+		 */
+		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));
+		CustomData_free_layers(&dm->faceData, CD_NORMAL, dm->numTessFaceData);
+	}
+
+
+	face_nors = MEM_mallocN(sizeof(float)*3*dm->numTessFaceData, "face_nors");
+
+	/* calculate face normals */
+	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,
+								 only_face_normals);
+
+	CustomData_add_layer(&dm->faceData, CD_NORMAL, CD_ASSIGN,
+						 face_nors, dm->numTessFaceData);
+}
+
+
+void CDDM_calc_normals_mapping(DerivedMesh *dm)
+{
+	/* use this to skip calculating normals on original vert's, this may need to be changed */
+	const short only_face_normals = CustomData_is_referenced_layer(&dm->vertData, CD_MVERT);
+
+	CDDM_calc_normals_mapping_ex(dm, only_face_normals);
+}
+
+/* bmesh note: this matches what we have in trunk */
 void CDDM_calc_normals(DerivedMesh *dm)
 {
 	CDDerivedMesh *cddm = (CDDerivedMesh*)dm;
+	float (*poly_nors)[3];
+
+	if (dm->numVertData == 0) return;
+
+	/* we don't want to overwrite any referenced layers */
+	cddm->mvert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT, dm->numVertData);
+
+	/* fill in if it exists */
+	poly_nors = CustomData_get_layer(&dm->polyData, CD_NORMAL);
+	if (!poly_nors) {
+		poly_nors = CustomData_add_layer(&dm->polyData, CD_NORMAL, CD_CALLOC, NULL, dm->numPolyData);
+	}
+
+	mesh_calc_normals(cddm->mvert, dm->numVertData, CDDM_get_loops(dm), CDDM_get_polys(dm),
+	                  dm->numLoopData, dm->numPolyData, poly_nors);
+}
+
+void CDDM_calc_normals_tessface(DerivedMesh *dm)
+{
+	CDDerivedMesh *cddm = (CDDerivedMesh*)dm;
 	float (*face_nors)[3];
 
-	if(dm->numVertData == 0) return;
+	if (dm->numVertData == 0) return;
 
 	/* we don't want to overwrite any referenced layers */
 	cddm->mvert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT, dm->numVertData);
 
-	/* make a face normal layer if not present */
+	/* fill in if it exists */
 	face_nors = CustomData_get_layer(&dm->faceData, CD_NORMAL);
-	if(!face_nors)
-		face_nors = CustomData_add_layer(&dm->faceData, CD_NORMAL, CD_CALLOC,
-										 NULL, dm->numFaceData);
+	if (!face_nors) {
+		face_nors = CustomData_add_layer(&dm->faceData, CD_NORMAL, CD_CALLOC, NULL, dm->numTessFaceData);
+	}
 
-	/* calculate face normals */
-	mesh_calc_normals(cddm->mvert, dm->numVertData, CDDM_get_faces(dm), dm->numFaceData, face_nors);
+	mesh_calc_normals_tessface(cddm->mvert, dm->numVertData,
+							   cddm->mface, dm->numTessFaceData, face_nors);
 }
 
-void CDDM_calc_edges(DerivedMesh *dm)
+#if 1
+/* merge verts
+ *
+ * vtargetmap is a table that maps vertices to target vertices.  a value of -1
+ * indicates a vertex is a target, and is to be kept.
+ *
+ * this frees dm, and returns a new one.
+ *
+ * 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.
+ */
+DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap)
+{
+	CDDerivedMesh *cddm = (CDDerivedMesh*)dm;
+	CDDerivedMesh *cddm2 = NULL;
+	MVert *mv, *mvert = NULL;
+	BLI_array_declare(mvert);
+	MEdge *med, *medge = NULL;
+	BLI_array_declare(medge);
+	MPoly *mp, *mpoly = NULL;
+	BLI_array_declare(mpoly);
+	MLoop *ml, *mloop = NULL;
+	BLI_array_declare(mloop);
+	EdgeHash *ehash = BLI_edgehash_new();
+	int *newv = NULL, *newe = NULL, *newl = NULL;
+	int *oldv = NULL, *olde = NULL, *oldl = NULL, *oldp = NULL;
+	BLI_array_declare(oldv); BLI_array_declare(olde); BLI_array_declare(oldl); BLI_array_declare(oldp);
+	int i, j, c, totloop, totpoly;
+	
+	totloop = dm->numLoopData;
+	totpoly = dm->numPolyData;
+	
+	newv = MEM_callocN(sizeof(int)*dm->numVertData, "newv vtable CDDM_merge_verts");
+	newe = MEM_callocN(sizeof(int)*dm->numEdgeData, "newv etable CDDM_merge_verts");
+	newl = MEM_callocN(sizeof(int)*totloop, "newv ltable CDDM_merge_verts");
+	
+	/*fill newl with destination vertex indices*/
+	mv = cddm->mvert;
+	c = 0;
+	for (i=0; i<dm->numVertData; i++, mv++) {
+		if (vtargetmap[i] == -1) {
+			BLI_array_append(oldv, i);
+			newv[i] = c++;
+			BLI_array_append(mvert, *mv);
+		}
+	}
+	
+	/*now link target vertices to destination indices*/
+	for (i=0; i<dm->numVertData; i++) {
+		if (vtargetmap[i] != -1) {
+			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];
+		}
+	}
+
+	/*now go through and fix edges and faces*/
+	med = cddm->medge;
+	c = 0;
+	for (i=0; i<dm->numEdgeData; i++, med++) {
+		
+		if (LIKELY(med->v1 != med->v2)) {
+			const unsigned int v1 = (vtargetmap[med->v1] != -1) ? vtargetmap[med->v1] : med->v1;
+			const unsigned int v2 = (vtargetmap[med->v2] != -1) ? vtargetmap[med->v2] : med->v2;
+			void **eh_p= BLI_edgehash_lookup_p(ehash, v1, v2);
+
+			if (eh_p) {
+				newe[i] = GET_INT_FROM_POINTER(*eh_p);
+			}
+			else {
+				BLI_array_append(olde, i);
+				newe[i] = c;
+				BLI_array_append(medge, *med);
+				BLI_edgehash_insert(ehash, v1, v2, SET_INT_IN_POINTER(c));
+				c++;
+			}
+		}
+		else {
+			newe[i] = -1;
+		}
+	}
+	
+	mp = cddm->mpoly;
+	for (i=0; i<totpoly; i++, mp++) {
+		MPoly *mp2;
+		
+		ml = cddm->mloop + mp->loopstart;
+
+		c = 0;
+		for (j=0; j<mp->totloop; j++, ml++) {
+			med = cddm->medge + ml->e;
+			if (LIKELY(med->v1 != med->v2)) {
+				newl[j+mp->loopstart] = BLI_array_count(mloop);
+				BLI_array_append(oldl, j+mp->loopstart);
+				BLI_array_append(mloop, *ml);
+				c++;
+			}
+		}
+
+		if (UNLIKELY(c == 0)) {
+			continue;
+		}
+		
+		mp2 = BLI_array_append_r(mpoly, *mp);
+		mp2->totloop = c;
+		mp2->loopstart = BLI_array_count(mloop) - c;
+		
+		BLI_array_append(oldp, i);
+	}
+	
+	/*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*/
+	med = medge;
+	for (i=0; i<cddm2->dm.numEdgeData; i++, med++) {
+		if (newv[med->v1] != -1)
+			med->v1 = newv[med->v1];
+		if (newv[med->v2] != -1)
+			med->v2 = newv[med->v2];
+		
+		CustomData_copy_data(&dm->edgeData, &cddm2->dm.edgeData, olde[i], i, 1);
+	}
+	
+	/*update loop indices and copy customdata*/
+	ml = mloop;
+	for (i=0; i<cddm2->dm.numLoopData; i++, ml++) {
+		if (newe[ml->e] != -1)
+			ml->e = newe[ml->e];
+		if (newv[ml->v] != -1)
+			ml->v = newv[ml->v];
+			
+		CustomData_copy_data(&dm->loopData, &cddm2->dm.loopData, oldl[i], i, 1);
+	}
+	
+	/*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);
+	}
+	
+	/*copy poly customdata*/
+	mp = mpoly;
+	for (i=0; i<cddm2->dm.numPolyData; i++, mp++) {
+		CustomData_copy_data(&dm->polyData, &cddm2->dm.polyData, oldp[i], i, 1);
+	}
+	
+	/*copy over data.  CustomData_add_layer can do this, need to look it up.*/
+	memcpy(cddm2->mvert, mvert, sizeof(MVert)*BLI_array_count(mvert));
+	memcpy(cddm2->medge, medge, sizeof(MEdge)*BLI_array_count(medge));
+	memcpy(cddm2->mloop, mloop, sizeof(MLoop)*BLI_array_count(mloop));
+	memcpy(cddm2->mpoly, mpoly, sizeof(MPoly)*BLI_array_count(mpoly));
+	BLI_array_free(mvert); BLI_array_free(medge); BLI_array_free(mloop); BLI_array_free(mpoly);
+	
+	if (newv) 
+		MEM_freeN(newv); 
+	if (newe)
+		MEM_freeN(newe); 
+	if (newl)
+		MEM_freeN(newl);
+	if (oldv) 
+		MEM_freeN(oldv); 
+	if (olde) 
+		MEM_freeN(olde); 
+	if (oldl) 
+		MEM_freeN(oldl); 
+	if (oldp) 
+		MEM_freeN(oldp);
+	if (ehash)
+		BLI_edgehash_free(ehash, NULL);
+
+	/*free old derivedmesh*/
+	dm->needsFree = 1;
+	dm->release(dm);
+	
+	return (DerivedMesh*)cddm2;
+}
+#endif
+
+void CDDM_calc_edges_tessface(DerivedMesh *dm)
 {
 	CDDerivedMesh *cddm = (CDDerivedMesh*)dm;
 	CustomData edgeData;
@@ -1919,7 +2364,7 @@ void CDDM_calc_edges(DerivedMesh *dm)
 	MFace *mf = cddm->mface;
 	MEdge *med;
 	EdgeHash *eh = BLI_edgehash_new();
-	int i, *index, numEdges, maxFaces = dm->numFaceData;
+	int i, *index, numEdges, maxFaces = dm->numTessFaceData;
 
 	for (i = 0; i < maxFaces; i++, mf++) {
 		if (!BLI_edgehash_haskey(eh, mf->v1, mf->v2))
@@ -1932,7 +2377,8 @@ void CDDM_calc_edges(DerivedMesh *dm)
 				BLI_edgehash_insert(eh, mf->v3, mf->v4, NULL);
 			if (!BLI_edgehash_haskey(eh, mf->v4, mf->v1))
 				BLI_edgehash_insert(eh, mf->v4, mf->v1, NULL);
-		} else {
+		}
+		else {
 			if (!BLI_edgehash_haskey(eh, mf->v3, mf->v1))
 				BLI_edgehash_insert(eh, mf->v3, mf->v1, NULL);
 		}
@@ -1948,7 +2394,7 @@ void CDDM_calc_edges(DerivedMesh *dm)
 	ehi = BLI_edgehashIterator_new(eh);
 	med = CustomData_get_layer(&edgeData, CD_MEDGE);
 	index = CustomData_get_layer(&edgeData, CD_ORIGINDEX);
-	for(i = 0; !BLI_edgehashIterator_isDone(ehi);
+	for (i = 0; !BLI_edgehashIterator_isDone(ehi);
 		BLI_edgehashIterator_step(ehi), ++i, ++med, ++index) {
 		BLI_edgehashIterator_getKey(ehi, &med->v1, &med->v2);
 
@@ -1967,6 +2413,82 @@ void CDDM_calc_edges(DerivedMesh *dm)
 	BLI_edgehash_free(eh, NULL);
 }
 
+/* warning, this uses existing edges but CDDM_calc_edges_tessface() doesn't */
+void CDDM_calc_edges(DerivedMesh *dm)
+{
+	CDDerivedMesh *cddm = (CDDerivedMesh*)dm;
+	CustomData edgeData;
+	EdgeHashIterator *ehi;
+	MPoly *mp = cddm->mpoly;
+	MLoop *ml;
+	MEdge *med;
+	EdgeHash *eh = BLI_edgehash_new();
+	int v1, v2;
+	int *eindex;
+	int i, j, *index, numEdges = cddm->dm.numEdgeData, maxFaces = dm->numPolyData;
+
+	eindex = DM_get_edge_data_layer(dm, CD_ORIGINDEX);
+
+	med = cddm->medge;
+	if (med) {
+		for (i=0; i < numEdges; i++, med++) {
+			BLI_edgehash_insert(eh, med->v1, med->v2, SET_INT_IN_POINTER(i+1));
+		}
+	}
+
+	for (i=0; i < maxFaces; i++, mp++) {
+		ml = cddm->mloop + mp->loopstart;
+		for (j=0; j<mp->totloop; j++, ml++) {
+			v1 = ml->v;
+			v2 = ME_POLY_LOOP_NEXT(cddm->mloop, mp, j)->v;
+			if (!BLI_edgehash_haskey(eh, v1, v2)) {
+				BLI_edgehash_insert(eh, v1, v2, NULL);
+			}
+		}
+	}
+
+	numEdges = BLI_edgehash_size(eh);
+
+	/* write new edges into a temporary CustomData */
+	memset(&edgeData, 0, sizeof(edgeData));
+	CustomData_add_layer(&edgeData, CD_MEDGE, CD_CALLOC, NULL, numEdges);
+	CustomData_add_layer(&edgeData, CD_ORIGINDEX, CD_CALLOC, NULL, numEdges);
+
+	ehi = BLI_edgehashIterator_new(eh);
+	med = CustomData_get_layer(&edgeData, CD_MEDGE);
+	index = CustomData_get_layer(&edgeData, CD_ORIGINDEX);
+	for (i = 0; !BLI_edgehashIterator_isDone(ehi);
+	    BLI_edgehashIterator_step(ehi), ++i, ++med, ++index) {
+		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];
+
+		BLI_edgehashIterator_setValue(ehi, SET_INT_IN_POINTER(i));
+	}
+	BLI_edgehashIterator_free(ehi);
+
+	/* free old CustomData and assign new one */
+	CustomData_free(&dm->edgeData, dm->numEdgeData);
+	dm->edgeData = edgeData;
+	dm->numEdgeData = numEdges;
+
+	cddm->medge = CustomData_get_layer(&dm->edgeData, CD_MEDGE);
+
+	mp = cddm->mpoly;
+	for (i=0; i < maxFaces; i++, mp++) {
+		ml = cddm->mloop + mp->loopstart;
+		for (j=0; j<mp->totloop; j++, ml++) {
+			v1 = ml->v;
+			v2 = ME_POLY_LOOP_NEXT(cddm->mloop, mp, j)->v;
+			ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(eh, v1, v2));
+		}
+	}
+
+	BLI_edgehash_free(eh, NULL);
+}
+
 void CDDM_lower_num_verts(DerivedMesh *dm, int numVerts)
 {
 	if (numVerts < dm->numVertData)
@@ -1983,14 +2505,24 @@ void CDDM_lower_num_edges(DerivedMesh *dm, int numEdges)
 	dm->numEdgeData = numEdges;
 }
 
-void CDDM_lower_num_faces(DerivedMesh *dm, int numFaces)
+void CDDM_lower_num_tessfaces(DerivedMesh *dm, int numTessFaces)
 {
-	if (numFaces < dm->numFaceData)
-		CustomData_free_elem(&dm->faceData, numFaces, dm->numFaceData-numFaces);
+	if (numTessFaces < dm->numTessFaceData)
+		CustomData_free_elem(&dm->faceData, numTessFaces, dm->numTessFaceData-numTessFaces);
 
-	dm->numFaceData = numFaces;
+	dm->numTessFaceData = numTessFaces;
 }
 
+void CDDM_lower_num_polys(DerivedMesh *dm, int numPolys)
+{
+	if (numPolys < dm->numPolyData)
+		CustomData_free_elem(&dm->polyData, numPolys, dm->numPolyData-numPolys);
+
+	dm->numPolyData = numPolys;
+}
+
+/* mesh element access functions */
+
 MVert *CDDM_get_vert(DerivedMesh *dm, int index)
 {
 	return &((CDDerivedMesh*)dm)->mvert[index];
@@ -2001,11 +2533,23 @@ MEdge *CDDM_get_edge(DerivedMesh *dm, int index)
 	return &((CDDerivedMesh*)dm)->medge[index];
 }
 
-MFace *CDDM_get_face(DerivedMesh *dm, int index)
+MFace *CDDM_get_tessface(DerivedMesh *dm, int index)
 {
 	return &((CDDerivedMesh*)dm)->mface[index];
 }
 
+MLoop *CDDM_get_loop(DerivedMesh *dm, int index)
+{
+	return &((CDDerivedMesh*)dm)->mloop[index];
+}
+
+MPoly *CDDM_get_poly(DerivedMesh *dm, int index)
+{
+	return &((CDDerivedMesh*)dm)->mpoly[index];
+}
+
+/* array access functions */
+
 MVert *CDDM_get_verts(DerivedMesh *dm)
 {
 	return ((CDDerivedMesh*)dm)->mvert;
@@ -2016,8 +2560,159 @@ MEdge *CDDM_get_edges(DerivedMesh *dm)
 	return ((CDDerivedMesh*)dm)->medge;
 }
 
-MFace *CDDM_get_faces(DerivedMesh *dm)
+MFace *CDDM_get_tessfaces(DerivedMesh *dm)
 {
 	return ((CDDerivedMesh*)dm)->mface;
 }
 
+MLoop *CDDM_get_loops(DerivedMesh *dm)
+{
+	return ((CDDerivedMesh*)dm)->mloop;
+}
+
+MPoly *CDDM_get_polys(DerivedMesh *dm)
+{
+	return ((CDDerivedMesh*)dm)->mpoly;
+}
+
+void CDDM_tessfaces_to_faces(DerivedMesh *dm)
+{
+	/*converts mfaces to mpolys/mloops*/
+	CDDerivedMesh *cddm = (CDDerivedMesh*)dm;
+	MFace *mf;
+	MEdge *me;
+	EdgeHash *eh = BLI_edgehash_new();
+	int i, totloop;
+
+	/* ... on second thaughts, better comment this and assume caller knows edge state. */
+#if 0
+	/* ensure we have all the edges we need */
+	CDDM_calc_edges_tessface(dm);
+#else
+#  ifndef NDEBUG
+	{
+		/* ensure we have correct edges on non release builds */
+		i = cddm->dm.numEdgeData;
+		CDDM_calc_edges_tessface(dm);
+		BLI_assert(cddm->dm.numEdgeData == i);
+	}
+#  endif
+#endif
+
+	/*build edge hash*/
+	me = cddm->medge;
+	for (i=0; i<cddm->dm.numEdgeData; i++, me++) {
+		BLI_edgehash_insert(eh, me->v1, me->v2, SET_INT_IN_POINTER(i));
+	}
+
+	mf = cddm->mface;
+	totloop = 0;
+	for (i=0; i<cddm->dm.numTessFaceData; i++, mf++) {
+		totloop += mf->v4 ? 4 : 3;
+	}
+
+	CustomData_free(&cddm->dm.polyData, cddm->dm.numPolyData);
+	CustomData_free(&cddm->dm.loopData, cddm->dm.numLoopData);
+	
+	cddm->dm.numLoopData = totloop;
+	cddm->dm.numPolyData = cddm->dm.numTessFaceData;
+
+	if (totloop) {
+		MLoop *ml;
+		MPoly *mp;
+		int l, *polyindex;
+
+		cddm->mloop = MEM_callocN(sizeof(MLoop)*totloop, "cddm->mloop in CDDM_tessfaces_to_faces");
+		cddm->mpoly = MEM_callocN(sizeof(MPoly)*cddm->dm.numTessFaceData, "cddm->mpoly in CDDM_tessfaces_to_faces");
+
+		CustomData_add_layer(&cddm->dm.loopData, CD_MLOOP, CD_ASSIGN, cddm->mloop, totloop);
+		CustomData_add_layer(&cddm->dm.polyData, CD_MPOLY, CD_ASSIGN, cddm->mpoly, cddm->dm.numPolyData);
+		CustomData_merge(&cddm->dm.faceData, &cddm->dm.polyData,
+			CD_MASK_ORIGINDEX, CD_DUPLICATE, cddm->dm.numTessFaceData);
+
+		polyindex = CustomData_get_layer(&cddm->dm.faceData, CD_POLYINDEX);
+
+		mf = cddm->mface;
+		mp = cddm->mpoly;
+		ml = cddm->mloop;
+		l = 0;
+		for (i=0; i<cddm->dm.numTessFaceData; i++, mf++, mp++, polyindex++) {
+			mp->flag = mf->flag;
+			mp->loopstart = l;
+			mp->mat_nr = mf->mat_nr;
+			mp->totloop = mf->v4 ? 4 : 3;
+
+			ml->v = mf->v1;
+			ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(eh, mf->v1, mf->v2));
+			ml++, l++;
+
+			ml->v = mf->v2;
+			ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(eh, mf->v2, mf->v3));
+			ml++, l++;
+
+			ml->v = mf->v3;
+			ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(eh, mf->v3, mf->v4?mf->v4:mf->v1));
+			ml++, l++;
+
+			if (mf->v4) {
+				ml->v = mf->v4;
+				ml->e =	GET_INT_FROM_POINTER(BLI_edgehash_lookup(eh, mf->v4, mf->v1));
+				ml++, l++;
+			}
+
+			*polyindex = i;
+		}
+	}
+
+	BLI_edgehash_free(eh, NULL);
+}
+
+void CDDM_set_mvert(DerivedMesh *dm, MVert *mvert)
+{
+	CDDerivedMesh *cddm = (CDDerivedMesh*)dm;
+	
+	if (!CustomData_has_layer(&dm->vertData, CD_MVERT))
+		CustomData_add_layer(&dm->vertData, CD_MVERT, CD_ASSIGN, mvert, dm->numVertData);
+				
+	cddm->mvert = mvert;
+}
+
+void CDDM_set_medge(DerivedMesh *dm, MEdge *medge)
+{
+	CDDerivedMesh *cddm = (CDDerivedMesh*)dm;
+
+	if (!CustomData_has_layer(&dm->edgeData, CD_MEDGE))
+		CustomData_add_layer(&dm->edgeData, CD_MEDGE, CD_ASSIGN, medge, dm->numEdgeData);
+
+	cddm->medge = medge;
+}
+
+void CDDM_set_mface(DerivedMesh *dm, MFace *mface)
+{
+	CDDerivedMesh *cddm = (CDDerivedMesh*)dm;
+
+	if (!CustomData_has_layer(&dm->faceData, CD_MFACE))
+		CustomData_add_layer(&dm->faceData, CD_MFACE, CD_ASSIGN, mface, dm->numTessFaceData);
+
+	cddm->mface = mface;
+}
+
+void CDDM_set_mloop(DerivedMesh *dm, MLoop *mloop)
+{
+	CDDerivedMesh *cddm = (CDDerivedMesh*)dm;
+
+	if (!CustomData_has_layer(&dm->loopData, CD_MLOOP))
+		CustomData_add_layer(&dm->loopData, CD_MLOOP, CD_ASSIGN, mloop, dm->numLoopData);
+
+	cddm->mloop = mloop;
+}
+
+void CDDM_set_mpoly(DerivedMesh *dm, MPoly *mpoly)
+{
+	CDDerivedMesh *cddm = (CDDerivedMesh*)dm;
+
+	if (!CustomData_has_layer(&dm->polyData, CD_MPOLY))
+		CustomData_add_layer(&dm->polyData, CD_MPOLY, CD_ASSIGN, mpoly, dm->numPolyData);
+
+	cddm->mpoly = mpoly;
+}
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index 1beaa59..a0c273c 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -35,11 +35,14 @@
 #include "DNA_object_types.h"
 #include "DNA_meshdata_types.h"
 
+#include "BLI_utildefines.h"
 #include "BLI_math.h"
 #include "BLI_edgehash.h"
 #include "BLI_utildefines.h"
 #include "BLI_linklist.h"
 
+#include "BLF_translation.h"
+
 #include "BKE_cdderivedmesh.h"
 #include "BKE_cloth.h"
 #include "BKE_effect.h"
@@ -111,9 +114,9 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm );
 void cloth_init ( ClothModifierData *clmd )
 {	
 	/* Initialize our new data structure to reasonable values. */
-	clmd->sim_parms->gravity [0] = 0.0;
-	clmd->sim_parms->gravity [1] = 0.0;
-	clmd->sim_parms->gravity [2] = -9.81;
+	clmd->sim_parms->gravity[0] = 0.0;
+	clmd->sim_parms->gravity[1] = 0.0;
+	clmd->sim_parms->gravity[2] = -9.81;
 	clmd->sim_parms->structural = 15.0;
 	clmd->sim_parms->shear = 15.0;
 	clmd->sim_parms->bending = 0.5;
@@ -155,10 +158,10 @@ void cloth_init ( ClothModifierData *clmd )
 	clmd->sim_parms->goalfrict = 0.0f;
 	clmd->sim_parms->velocity_smooth = 0.0f;
 
-	if(!clmd->sim_parms->effector_weights)
+	if (!clmd->sim_parms->effector_weights)
 		clmd->sim_parms->effector_weights = BKE_add_effector_weights(NULL);
 
-	if(clmd->point_cache)
+	if (clmd->point_cache)
 		clmd->point_cache->step = 1;
 }
 
@@ -170,25 +173,25 @@ static BVHTree *bvhselftree_build_from_cloth (ClothModifierData *clmd, float eps
 	ClothVertex *verts;
 	float co[12];
 
-	if(!clmd)
+	if (!clmd)
 		return NULL;
 
 	cloth = clmd->clothObject;
 
-	if(!cloth)
+	if (!cloth)
 		return NULL;
 	
 	verts = cloth->verts;
 	
 	// in the moment, return zero if no faces there
-	if(!cloth->numverts)
+	if (!cloth->numverts)
 		return NULL;
 	
 	// create quadtree with k=26
 	bvhtree = BLI_bvhtree_new(cloth->numverts, epsilon, 4, 6);
 	
 	// fill tree
-	for(i = 0; i < cloth->numverts; i++, verts++)
+	for (i = 0; i < cloth->numverts; i++, verts++)
 	{
 		copy_v3_v3(&co[0*3], verts->xold);
 		
@@ -210,32 +213,32 @@ static BVHTree *bvhtree_build_from_cloth (ClothModifierData *clmd, float epsilon
 	MFace *mfaces;
 	float co[12];
 
-	if(!clmd)
+	if (!clmd)
 		return NULL;
 
 	cloth = clmd->clothObject;
 
-	if(!cloth)
+	if (!cloth)
 		return NULL;
 	
 	verts = cloth->verts;
 	mfaces = cloth->mfaces;
 	
 	// in the moment, return zero if no faces there
-	if(!cloth->numfaces)
+	if (!cloth->numfaces)
 		return NULL;
 	
 	// create quadtree with k=26
 	bvhtree = BLI_bvhtree_new(cloth->numfaces, epsilon, 4, 26);
 	
 	// fill tree
-	for(i = 0; i < cloth->numfaces; i++, mfaces++)
+	for (i = 0; i < cloth->numfaces; i++, mfaces++)
 	{
 		copy_v3_v3(&co[0*3], verts[mfaces->v1].xold);
 		copy_v3_v3(&co[1*3], verts[mfaces->v2].xold);
 		copy_v3_v3(&co[2*3], verts[mfaces->v3].xold);
 		
-		if(mfaces->v4)
+		if (mfaces->v4)
 			copy_v3_v3(&co[3*3], verts[mfaces->v4].xold);
 		
 		BLI_bvhtree_insert(bvhtree, i, co, (mfaces->v4 ? 4 : 3));
@@ -257,43 +260,42 @@ void bvhtree_update_from_cloth(ClothModifierData *clmd, int moving)
 	float co[12], co_moving[12];
 	int ret = 0;
 	
-	if(!bvhtree)
+	if (!bvhtree)
 		return;
 	
 	mfaces = cloth->mfaces;
 	
 	// update vertex position in bvh tree
-	if(verts && mfaces)
+	if (verts && mfaces)
 	{
-		for(i = 0; i < cloth->numfaces; i++, mfaces++)
+		for (i = 0; i < cloth->numfaces; i++, mfaces++)
 		{
 			copy_v3_v3(&co[0*3], verts[mfaces->v1].txold);
 			copy_v3_v3(&co[1*3], verts[mfaces->v2].txold);
 			copy_v3_v3(&co[2*3], verts[mfaces->v3].txold);
 			
-			if(mfaces->v4)
+			if (mfaces->v4)
 				copy_v3_v3(&co[3*3], verts[mfaces->v4].txold);
 		
 			// copy new locations into array
-			if(moving)
+			if (moving)
 			{
 				// update moving positions
 				copy_v3_v3(&co_moving[0*3], verts[mfaces->v1].tx);
 				copy_v3_v3(&co_moving[1*3], verts[mfaces->v2].tx);
 				copy_v3_v3(&co_moving[2*3], verts[mfaces->v3].tx);
 				
-				if(mfaces->v4)
+				if (mfaces->v4)
 					copy_v3_v3(&co_moving[3*3], verts[mfaces->v4].tx);
 				
 				ret = BLI_bvhtree_update_node(bvhtree, i, co, co_moving, (mfaces->v4 ? 4 : 3));
 			}
-			else
-			{
+			else {
 				ret = BLI_bvhtree_update_node(bvhtree, i, co, NULL, (mfaces->v4 ? 4 : 3));
 			}
 			
 			// check if tree is already full
-			if(!ret)
+			if (!ret)
 				break;
 		}
 		
@@ -311,33 +313,32 @@ void bvhselftree_update_from_cloth(ClothModifierData *clmd, int moving)
 	float co[12], co_moving[12];
 	int ret = 0;
 	
-	if(!bvhtree)
+	if (!bvhtree)
 		return;
 	
 	mfaces = cloth->mfaces;
 	
 	// update vertex position in bvh tree
-	if(verts && mfaces)
+	if (verts && mfaces)
 	{
-		for(i = 0; i < cloth->numverts; i++, verts++)
+		for (i = 0; i < cloth->numverts; i++, verts++)
 		{
 			copy_v3_v3(&co[0*3], verts->txold);
 			
 			// copy new locations into array
-			if(moving)
+			if (moving)
 			{
 				// update moving positions
 				copy_v3_v3(&co_moving[0*3], verts->tx);
 				
 				ret = BLI_bvhtree_update_node(bvhtree, i, co, co_moving, 1);
 			}
-			else
-			{
+			else {
 				ret = BLI_bvhtree_update_node(bvhtree, i, co, NULL, 1);
 			}
 			
 			// check if tree is already full
-			if(!ret)
+			if (!ret)
 				break;
 		}
 		
@@ -352,7 +353,7 @@ void cloth_clear_cache(Object *ob, ClothModifierData *clmd, float framenr)
 	BKE_ptcache_id_from_cloth(&pid, ob, clmd);
 
 	// don't do anything as long as we're in editmode!
-	if(pid.cache->edit && ob->mode & OB_MODE_PARTICLE_EDIT)
+	if (pid.cache->edit && ob->mode & OB_MODE_PARTICLE_EDIT)
 		return;
 	
 	BKE_ptcache_id_clear(&pid, PTCACHE_CLEAR_AFTER, framenr);
@@ -365,13 +366,13 @@ 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(!cloth_from_object(ob, clmd, result, framenr, 1)) {
+	if (clmd->clothObject == NULL) {	
+		if (!cloth_from_object(ob, clmd, result, framenr, 1)) {
 			BKE_ptcache_invalidate(cache);
 			return 0;
 		}
 	
-		if(clmd->clothObject == NULL) {
+		if (clmd->clothObject == NULL) {
 			BKE_ptcache_invalidate(cache);
 			return 0;
 		}
@@ -399,7 +400,7 @@ static int do_step_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul
 	mvert = result->getVertArray(result);
 
 	/* force any pinned verts to their constrained location. */
-	for(i = 0; i < clmd->clothObject->numverts; i++, verts++) {
+	for (i = 0; i < clmd->clothObject->numverts; i++, verts++) {
 		/* save the previous position. */
 		copy_v3_v3(verts->xold, verts->xconst);
 		copy_v3_v3(verts->txold, verts->x);
@@ -414,7 +415,7 @@ static int do_step_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul
 	tstart();
 
 	/* call the solver. */
-	if(solvers [clmd->sim_parms->solver_type].solver)
+	if (solvers [clmd->sim_parms->solver_type].solver)
 		ret = solvers[clmd->sim_parms->solver_type].solver(ob, framenr, clmd, effectors);
 
 	tend();
@@ -445,9 +446,9 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived
 	BKE_ptcache_id_time(&pid, scene, framenr, &startframe, &endframe, &timescale);
 	clmd->sim_parms->timescale= timescale;
 
-	if(clmd->sim_parms->reset
-		|| (framenr == (startframe - clmd->sim_parms->preroll) && clmd->sim_parms->preroll != 0)
-		|| (clmd->clothObject && dm->getNumVerts(dm) != clmd->clothObject->numverts))
+	if (clmd->sim_parms->reset ||
+	    (framenr == (startframe - clmd->sim_parms->preroll) && clmd->sim_parms->preroll != 0) ||
+	    (clmd->clothObject && dm->getNumVerts(dm) != clmd->clothObject->numverts))
 	{
 		clmd->sim_parms->reset = 0;
 		cache->flag |= PTCACHE_OUTDATED;
@@ -462,11 +463,11 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived
 	clmd->sim_parms->dt = clmd->sim_parms->timescale / clmd->sim_parms->stepsPerFrame;
 
 	/* handle continuous simulation with the play button */
-	if(BKE_ptcache_get_continue_physics() || ((clmd->sim_parms->preroll > 0) && (framenr > startframe - clmd->sim_parms->preroll) && (framenr < startframe))) {
+	if (BKE_ptcache_get_continue_physics() || ((clmd->sim_parms->preroll > 0) && (framenr > startframe - clmd->sim_parms->preroll) && (framenr < startframe))) {
 		BKE_ptcache_invalidate(cache);
 
 		/* do simulation */
-		if(!do_init_cloth(ob, clmd, dm, framenr))
+		if (!do_init_cloth(ob, clmd, dm, framenr))
 			return;
 
 		do_step_cloth(ob, clmd, dm, framenr);
@@ -478,19 +479,19 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived
 	}
 
 	/* simulation is only active during a specific period */
-	if(framenr < startframe) {
+	if (framenr < startframe) {
 		BKE_ptcache_invalidate(cache);
 		return;
 	}
-	else if(framenr > endframe) {
+	else if (framenr > endframe) {
 		framenr= endframe;
 	}
 
 	/* initialize simulation data if it didn't exist already */
-	if(!do_init_cloth(ob, clmd, dm, framenr))
+	if (!do_init_cloth(ob, clmd, dm, framenr))
 		return;
 
-	if((framenr == startframe) && (clmd->sim_parms->preroll == 0)) {
+	if ((framenr == startframe) && (clmd->sim_parms->preroll == 0)) {
 		BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED);
 		do_init_cloth(ob, clmd, dm, framenr);
 		BKE_ptcache_validate(cache, framenr);
@@ -502,33 +503,33 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived
 	/* try to read from cache */
 	cache_result = BKE_ptcache_read(&pid, (float)framenr+scene->r.subframe);
 
-	if(cache_result == PTCACHE_READ_EXACT || cache_result == PTCACHE_READ_INTERPOLATED) {
+	if (cache_result == PTCACHE_READ_EXACT || cache_result == PTCACHE_READ_INTERPOLATED) {
 		implicit_set_positions(clmd);
 		cloth_to_object (ob, clmd, vertexCos);
 
 		BKE_ptcache_validate(cache, framenr);
 
-		if(cache_result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED)
+		if (cache_result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED)
 			BKE_ptcache_write(&pid, framenr);
 
 		clmd->clothObject->last_frame= framenr;
 
 		return;
 	}
-	else if(cache_result==PTCACHE_READ_OLD) {
+	else if (cache_result==PTCACHE_READ_OLD) {
 		implicit_set_positions(clmd);
 	}
-	else if( /*ob->id.lib ||*/ (cache->flag & PTCACHE_BAKED)) { /* 2.4x disabled lib, but this can be used in some cases, testing further - campbell */
+	else if ( /*ob->id.lib ||*/ (cache->flag & PTCACHE_BAKED)) { /* 2.4x disabled lib, but this can be used in some cases, testing further - campbell */
 		/* if baked and nothing in cache, do nothing */
 		BKE_ptcache_invalidate(cache);
 		return;
 	}
 
-	if(framenr!=clmd->clothObject->last_frame+1)
+	if (framenr!=clmd->clothObject->last_frame+1)
 		return;
 
 	/* if on second frame, write cache for first frame */
-	if(cache->simframe == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0))
+	if (cache->simframe == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0))
 		BKE_ptcache_write(&pid, startframe);
 
 	clmd->sim_parms->timescale *= framenr - cache->simframe;
@@ -536,7 +537,7 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived
 	/* do simulation */
 	BKE_ptcache_validate(cache, framenr);
 
-	if(!do_step_cloth(ob, clmd, dm, framenr)) {
+	if (!do_step_cloth(ob, clmd, dm, framenr)) {
 		BKE_ptcache_invalidate(cache);
 	}
 	else
@@ -576,7 +577,7 @@ void cloth_free_modifier(ClothModifierData *clmd )
 		if ( cloth->springs != NULL )
 		{
 			LinkNode *search = cloth->springs;
-			while(search)
+			while (search)
 			{
 				ClothSpring *spring = search->link;
 						
@@ -602,12 +603,12 @@ void cloth_free_modifier(ClothModifierData *clmd )
 		if ( cloth->mfaces )
 			MEM_freeN ( cloth->mfaces );
 		
-		if(cloth->edgehash)
+		if (cloth->edgehash)
 			BLI_edgehash_free ( cloth->edgehash, NULL );
 		
 		
 		/*
-		if(clmd->clothObject->facemarks)
+		if (clmd->clothObject->facemarks)
 		MEM_freeN(clmd->clothObject->facemarks);
 		*/
 		MEM_freeN ( cloth );
@@ -619,7 +620,7 @@ void cloth_free_modifier(ClothModifierData *clmd )
 void cloth_free_modifier_extern ( ClothModifierData *clmd )
 {
 	Cloth	*cloth = NULL;
-	if(G.rt > 0)
+	if (G.rt > 0)
 		printf("cloth_free_modifier_extern\n");
 	
 	if ( !clmd )
@@ -629,7 +630,7 @@ void cloth_free_modifier_extern ( ClothModifierData *clmd )
 	
 	if ( cloth )
 	{	
-		if(G.rt > 0)
+		if (G.rt > 0)
 			printf("cloth_free_modifier_extern in\n");
 		
 		// If our solver provides a free function, call it
@@ -649,7 +650,7 @@ void cloth_free_modifier_extern ( ClothModifierData *clmd )
 		if ( cloth->springs != NULL )
 		{
 			LinkNode *search = cloth->springs;
-			while(search)
+			while (search)
 			{
 				ClothSpring *spring = search->link;
 						
@@ -675,12 +676,12 @@ void cloth_free_modifier_extern ( ClothModifierData *clmd )
 		if ( cloth->mfaces )
 			MEM_freeN ( cloth->mfaces );
 		
-		if(cloth->edgehash)
+		if (cloth->edgehash)
 			BLI_edgehash_free ( cloth->edgehash, NULL );
 		
 		
 		/*
-		if(clmd->clothObject->facemarks)
+		if (clmd->clothObject->facemarks)
 		MEM_freeN(clmd->clothObject->facemarks);
 		*/
 		MEM_freeN ( cloth );
@@ -776,20 +777,20 @@ static void cloth_apply_vgroup ( ClothModifierData *clmd, DerivedMesh *dm )
 					
 					if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SCALING )
 					{
-						if( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_struct-1))
+						if ( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_struct-1))
 						{
 							verts->struct_stiff = dvert->dw [j].weight;
 							verts->shear_stiff = dvert->dw [j].weight;
 						}
 						
-						if( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_bend-1))
+						if ( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_bend-1))
 						{
 							verts->bend_stiff = dvert->dw [j].weight;
 						}
 					}
 					/*
 					// for later
-					if( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_weight-1))
+					if ( dvert->dw[j].def_nr == (clmd->sim_parms->vgroup_weight-1))
 					{
 						verts->mass = dvert->dw [j].weight;
 					}
@@ -814,7 +815,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
 	if ( clmd->clothObject != NULL )
 	{
 		cloth_free_modifier ( clmd );
-		if(G.rt > 0)
+		if (G.rt > 0)
 			printf("cloth_free_modifier cloth_from_object\n");
 	}
 
@@ -827,9 +828,8 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
 		cloth = clmd->clothObject;
 		clmd->clothObject->edgehash = NULL;
 	}
-	else if ( !clmd->clothObject )
-	{
-		modifier_setError ( & ( clmd->modifier ), "Out of memory on allocating clmd->clothObject." );
+	else if (!clmd->clothObject) {
+		modifier_setError(&(clmd->modifier), "%s", TIP_("Out of memory on allocating clmd->clothObject."));
 		return 0;
 	}
 
@@ -843,7 +843,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
 	clmd->clothObject->springs = NULL;
 	clmd->clothObject->numsprings = -1;
 	
-	if( clmd->sim_parms->shapekey_rest )
+	if ( clmd->sim_parms->shapekey_rest )
 		shapekey_rest = dm->getVertDataArray ( dm, CD_CLOTH_ORCO );
 
 	mvert = dm->getVertArray ( dm );
@@ -853,13 +853,13 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
 	// set initial values
 	for ( i = 0; i < dm->getNumVerts(dm); i++, verts++ )
 	{
-		if(first)
+		if (first)
 		{
 			copy_v3_v3( verts->x, mvert[i].co );
 
 			mul_m4_v3( ob->obmat, verts->x );
 
-			if( shapekey_rest ) {
+			if ( shapekey_rest ) {
 				verts->xrest= shapekey_rest[i];
 				mul_m4_v3( ob->obmat, verts->xrest );
 			}
@@ -894,14 +894,14 @@ 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 ), "Can't build springs." );
+		modifier_setError(&(clmd->modifier), "%s", TIP_("Can't build springs."));
 		printf("cloth_free_modifier cloth_build_springs\n");
 		return 0;
 	}
 	
 	for ( i = 0; i < dm->getNumVerts(dm); i++)
 	{
-		if((!(cloth->verts[i].flags & CLOTH_VERT_FLAG_PINNED)) && (cloth->verts[i].goal > ALMOST_ZERO))
+		if ((!(cloth->verts[i].flags & CLOTH_VERT_FLAG_PINNED)) && (cloth->verts[i].goal > ALMOST_ZERO))
 		{
 			cloth_add_spring (clmd, i, i, 0.0, CLOTH_SPRING_TYPE_GOAL);
 		}
@@ -912,12 +912,12 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
 		solvers [clmd->sim_parms->solver_type].init ( ob, clmd );
 	}
 	
-	if(!first)
+	if (!first)
 		implicit_set_positions(clmd);
 
 	clmd->clothObject->bvhtree = bvhtree_build_from_cloth ( clmd, MAX2(clmd->coll_parms->epsilon, clmd->coll_parms->distance_repel) );
 	
-	for(i = 0; i < dm->getNumVerts(dm); i++)
+	for (i = 0; i < dm->getNumVerts(dm); i++)
 	{
 		maxdist = MAX2(maxdist, clmd->coll_parms->selfepsilon* ( cloth->verts[i].avg_spring_len*2.0f));
 	}
@@ -930,8 +930,8 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
 static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm )
 {
 	unsigned int numverts = dm->getNumVerts ( dm );
-	unsigned int numfaces = dm->getNumFaces ( dm );
-	MFace *mface = dm->getFaceArray( dm );
+	unsigned int numfaces = dm->getNumTessFaces ( dm );
+	MFace *mface = dm->getTessFaceArray( dm );
 	unsigned int i = 0;
 
 	/* Allocate our vertices. */
@@ -940,7 +940,7 @@ static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm )
 	if ( clmd->clothObject->verts == NULL )
 	{
 		cloth_free_modifier ( clmd );
-		modifier_setError ( & ( clmd->modifier ), "Out of memory on allocating clmd->clothObject->verts." );
+		modifier_setError(&(clmd->modifier), "%s", TIP_("Out of memory on allocating clmd->clothObject->verts."));
 		printf("cloth_free_modifier clmd->clothObject->verts\n");
 		return;
 	}
@@ -951,7 +951,7 @@ static void cloth_from_mesh ( ClothModifierData *clmd, DerivedMesh *dm )
 	if ( clmd->clothObject->mfaces == NULL )
 	{
 		cloth_free_modifier ( clmd );
-		modifier_setError ( & ( clmd->modifier ), "Out of memory on allocating clmd->clothObject->mfaces." );
+		modifier_setError(&(clmd->modifier), "%s", TIP_("Out of memory on allocating clmd->clothObject->mfaces."));
 		printf("cloth_free_modifier clmd->clothObject->mfaces\n");
 		return;
 	}
@@ -977,13 +977,13 @@ int cloth_add_spring ( ClothModifierData *clmd, unsigned int indexA, unsigned in
 	Cloth *cloth = clmd->clothObject;
 	ClothSpring *spring = NULL;
 	
-	if(cloth)
+	if (cloth)
 	{
 		// TODO: look if this spring is already there
 		
 		spring = ( ClothSpring * ) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
 		
-		if(!spring)
+		if (!spring)
 			return 0;
 		
 		spring->ij = indexA;
@@ -1009,7 +1009,7 @@ static void cloth_free_errorsprings(Cloth *cloth, EdgeHash *UNUSED(edgehash), Li
 	if ( cloth->springs != NULL )
 	{
 		LinkNode *search = cloth->springs;
-		while(search)
+		while (search)
 		{
 			ClothSpring *spring = search->link;
 						
@@ -1021,7 +1021,7 @@ static void cloth_free_errorsprings(Cloth *cloth, EdgeHash *UNUSED(edgehash), Li
 		cloth->springs = NULL;
 	}
 	
-	if(edgelist)
+	if (edgelist)
 	{
 		for ( i = 0; i < cloth->numverts; i++ )
 		{
@@ -1031,7 +1031,7 @@ static void cloth_free_errorsprings(Cloth *cloth, EdgeHash *UNUSED(edgehash), Li
 		MEM_freeN ( edgelist );
 	}
 	
-	if(cloth->edgehash)
+	if (cloth->edgehash)
 		BLI_edgehash_free ( cloth->edgehash, NULL );
 }
 
@@ -1043,9 +1043,9 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
 	unsigned int i = 0;
 	unsigned int numverts = (unsigned int)dm->getNumVerts ( dm );
 	unsigned int numedges = (unsigned int)dm->getNumEdges ( dm );
-	unsigned int numfaces = (unsigned int)dm->getNumFaces ( dm );
+	unsigned int numfaces = (unsigned int)dm->getNumTessFaces ( dm );
 	MEdge *medge = dm->getEdgeArray ( dm );
-	MFace *mface = dm->getFaceArray ( dm );
+	MFace *mface = dm->getTessFaceArray ( dm );
 	int index2 = 0; // our second vertex index
 	LinkNode **edgelist = NULL;
 	EdgeHash *edgehash = NULL;
@@ -1059,7 +1059,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
 
 	edgelist = MEM_callocN ( sizeof ( LinkNode * ) * numverts, "cloth_edgelist_alloc" );
 	
-	if(!edgelist)
+	if (!edgelist)
 		return 0;
 	
 	for ( i = 0; i < numverts; i++ )
@@ -1095,17 +1095,16 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
 			
 			BLI_linklist_prepend ( &cloth->springs, spring );
 		}
-		else
-		{
+		else {
 			cloth_free_errorsprings(cloth, edgehash, edgelist);
 			return 0;
 		}
 	}
 	
-	if(struct_springs > 0)
+	if (struct_springs > 0)
 		clmd->sim_parms->avg_spring_len /= struct_springs;
 	
-	for(i = 0; i < numverts; i++)
+	for (i = 0; i < numverts; i++)
 	{
 		cloth->verts[i].avg_spring_len = cloth->verts[i].avg_spring_len * 0.49f / ((float)cloth->verts[i].spring_count);
 	}
@@ -1119,7 +1118,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
 		
 		spring = ( ClothSpring *) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
 		
-		if(!spring)
+		if (!spring)
 		{
 			cloth_free_errorsprings(cloth, edgehash, edgelist);
 			return 0;
@@ -1141,7 +1140,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
 		// if ( mface[i].v4 ) --> Quad face
 		spring = ( ClothSpring * ) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
 		
-		if(!spring)
+		if (!spring)
 		{
 			cloth_free_errorsprings(cloth, edgehash, edgelist);
 			return 0;
@@ -1160,7 +1159,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
 		BLI_linklist_prepend ( &cloth->springs, spring );
 	}
 	
-	if(numfaces) {
+	if (numfaces) {
 		// bending springs
 		search2 = cloth->springs;
 		for ( i = struct_springs; i < struct_springs+shear_springs; i++ )
@@ -1177,12 +1176,12 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
 				
 				// check for existing spring
 				// check also if startpoint is equal to endpoint
-				if ( !BLI_edgehash_haskey ( edgehash, MIN2(tspring2->ij, index2), MAX2(tspring2->ij, index2) )
-				&& ( index2!=tspring2->ij ) )
+				if (!BLI_edgehash_haskey(edgehash, MIN2(tspring2->ij, index2), MAX2(tspring2->ij, index2)) &&
+				    (index2 != tspring2->ij))
 				{
 					spring = ( ClothSpring * ) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
 					
-					if(!spring)
+					if (!spring)
 					{
 						cloth_free_errorsprings(cloth, edgehash, edgelist);
 						return 0;
@@ -1203,7 +1202,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
 			search2 = search2->next;
 		}
 	}
-	else if(struct_springs > 2) {
+	else if (struct_springs > 2) {
 		/* bending springs for hair strands */
 		/* The current algorightm only goes through the edges in order of the mesh edges list	*/
 		/* and makes springs between the outer vert of edges sharing a vertice. This works just */
@@ -1213,15 +1212,15 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
 		/* of the strands. -jahka */
 		search = cloth->springs;
 		search2 = search->next;
-		while(search && search2)
+		while (search && search2)
 		{
 			tspring = search->link;
 			tspring2 = search2->link;
 
-			if(tspring->ij == tspring2->kl) {
+			if (tspring->ij == tspring2->kl) {
 				spring = ( ClothSpring * ) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
 				
-				if(!spring)
+				if (!spring)
 				{
 					cloth_free_errorsprings(cloth, edgehash, edgelist);
 					return 0;
@@ -1248,7 +1247,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
 	
 	for ( i = 0; i < numfaces; i++ ) // edge springs
 	{
-		if(mface[i].v4)
+		if (mface[i].v4)
 		{
 			BLI_edgehash_insert ( edgehash, MIN2(mface[i].v1, mface[i].v3), MAX2(mface[i].v3, mface[i].v1), NULL );
 			
@@ -1271,7 +1270,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
 	
 	cloth->edgehash = edgehash;
 	
-	if(G.rt>0)
+	if (G.rt>0)
 		printf("avg_len: %f\n",clmd->sim_parms->avg_spring_len);
 
 	return 1;
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 456c0c9..5b03f73 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -42,6 +42,7 @@
 #include "DNA_scene_types.h"
 #include "DNA_meshdata_types.h"
 
+#include "BLI_utildefines.h"
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
 #include "BLI_edgehash.h"
@@ -74,17 +75,17 @@ Collision modifier code start
 ***********************************/
 
 /* step is limited from 0 (frame start position) to 1 (frame end position) */
-void collision_move_object ( CollisionModifierData *collmd, float step, float prevstep )
+void collision_move_object(CollisionModifierData *collmd, float step, float prevstep)
 {
 	float tv[3] = {0, 0, 0};
 	unsigned int i = 0;
 
 	for ( i = 0; i < collmd->numverts; i++ )
 	{
-		VECSUB ( tv, collmd->xnew[i].co, collmd->x[i].co );
+		sub_v3_v3v3 ( tv, collmd->xnew[i].co, collmd->x[i].co );
 		VECADDS ( collmd->current_x[i].co, collmd->x[i].co, tv, prevstep );
 		VECADDS ( collmd->current_xnew[i].co, collmd->x[i].co, tv, step );
-		VECSUB ( collmd->current_v[i].co, collmd->current_xnew[i].co, collmd->current_x[i].co );
+		sub_v3_v3v3 ( collmd->current_v[i].co, collmd->current_xnew[i].co, collmd->current_x[i].co );
 	}
 
 	bvhtree_update_from_mvert ( collmd->bvhtree, collmd->mfaces, collmd->numfaces, collmd->current_x, collmd->current_xnew, collmd->numverts, 1 );
@@ -173,7 +174,7 @@ Collision modifier code end
 * copied from SOLVE_CUBIC.C --> GSL
 */
 
-#define mySWAP(a,b) do { double tmp = b ; b = a ; a = tmp ; } while(0)
+#define mySWAP(a,b) do { double tmp = b ; b = a ; a = tmp ; } while (0)
 #if 0 /* UNUSED */
 static int 
 gsl_poly_solve_cubic (double a, double b, double c, 
@@ -193,10 +194,10 @@ gsl_poly_solve_cubic (double a, double b, double c,
 
 	if (R == 0 && Q == 0)
 	{
-		*x0 = - a / 3 ;
-		*x1 = - a / 3 ;
-		*x2 = - a / 3 ;
-		return 3 ;
+		*x0 = - a / 3;
+		*x1 = - a / 3;
+		*x2 = - a / 3;
+		return 3;
 	}
 	else if (CR2 == CQ3) 
 	{
@@ -221,7 +222,7 @@ gsl_poly_solve_cubic (double a, double b, double c,
 			*x1 = - sqrtQ - a / 3;
 			*x2 = 2 * sqrtQ - a / 3;
 		}
-		return 3 ;
+		return 3;
 	}
 	else if (CR2 < CQ3) /* equivalent to R2 < Q3 */
 	{
@@ -236,14 +237,14 @@ gsl_poly_solve_cubic (double a, double b, double c,
 		/* Sort *x0, *x1, *x2 into increasing order */
 
 		if (*x0 > *x1)
-			mySWAP(*x0, *x1) ;
+			mySWAP(*x0, *x1);
 
 		if (*x1 > *x2)
 		{
-			mySWAP(*x1, *x2) ;
+			mySWAP(*x1, *x2);
 
 			if (*x0 > *x1)
-				mySWAP(*x0, *x1) ;
+				mySWAP(*x0, *x1);
 		}
 
 		return 3;
@@ -252,7 +253,7 @@ gsl_poly_solve_cubic (double a, double b, double c,
 	{
 		double sgnR = (R >= 0 ? 1 : -1);
 		double A = -sgnR * pow (fabs (R) + sqrt (R2 - Q3), 1.0/3.0);
-		double B = Q / A ;
+		double B = Q / A;
 		*x0 = A + B - a / 3;
 		return 1;
 	}
@@ -296,27 +297,27 @@ gsl_poly_solve_quadratic (double a, double b, double c,
 		{
 			double sgnb = (b > 0 ? 1 : -1);
 			double temp = -0.5 * (b + sgnb * sqrt (disc));
-			double r1 = temp / a ;
-			double r2 = c / temp ;
+			double r1 = temp / a;
+			double r2 = c / temp;
 
 			if (r1 < r2) 
 			{
-				*x0 = r1 ;
-				*x1 = r2 ;
+				*x0 = r1;
+				*x1 = r2;
 			} 
 			else 
 			{
-				*x0 = r2 ;
-				*x1 = r1 ;
+				*x0 = r2;
+				*x1 = r1;
 			}
 		}
 		return 2;
 	}
 	else if (disc == 0) 
 	{
-		*x0 = -0.5 * b / a ;
-		*x1 = -0.5 * b / a ;
-		return 2 ;
+		*x0 = -0.5 * b / a;
+		*x1 = -0.5 * b / a;
+		return 2;
 	}
 	else
 	{
@@ -485,10 +486,10 @@ static void collision_compute_barycentric ( float pv[3], float p1[3], float p2[3
 
 DO_INLINE void collision_interpolateOnTriangle ( float to[3], float v1[3], float v2[3], float v3[3], double w1, double w2, double w3 )
 {
-	to[0] = to[1] = to[2] = 0;
-	VECADDMUL ( to, v1, w1 );
-	VECADDMUL ( to, v2, w2 );
-	VECADDMUL ( to, v3, w3 );
+	zero_v3(to);
+	VECADDMUL(to, v1, w1);
+	VECADDMUL(to, v2, w2);
+	VECADDMUL(to, v3, w3);
 }
 
 #ifndef WITH_ELTOPO
@@ -528,10 +529,10 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM
 
 		collision_interpolateOnTriangle ( v2, collmd->current_v[collpair->bp1].co, collmd->current_v[collpair->bp2].co, collmd->current_v[collpair->bp3].co, u1, u2, u3 );
 
-		VECSUB ( relativeVelocity, v2, v1 );
+		sub_v3_v3v3 ( relativeVelocity, v2, v1 );
 
 		// Calculate the normal component of the relative velocity (actually only the magnitude - the direction is stored in 'normal').
-		magrelVel = INPR ( relativeVelocity, collpair->normal );
+		magrelVel = dot_v3v3( relativeVelocity, collpair->normal );
 
 		// printf("magrelVel: %f\n", magrelVel);
 
@@ -550,11 +551,11 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM
 			// calculate tangential velocity
 			copy_v3_v3 ( temp, collpair->normal );
 			mul_v3_fl( temp, magrelVel );
-			VECSUB ( vrel_t_pre, relativeVelocity, temp );
+			sub_v3_v3v3 ( vrel_t_pre, relativeVelocity, temp );
 
 			// 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 = MIN2 ( clmd->coll_parms->friction * 0.01f * magrelVel, sqrtf( INPR ( vrel_t_pre,vrel_t_pre ) ) );
+			magtangent = MIN2 ( clmd->coll_parms->friction * 0.01f * magrelVel, sqrtf( dot_v3v3( vrel_t_pre,vrel_t_pre ) ) );
 
 			// Apply friction impulse.
 			if ( magtangent > ALMOST_ZERO )
@@ -665,8 +666,8 @@ static CollPair* cloth_edge_collision ( ModifierData *md1, ModifierData *md2,
 										BVHTreeOverlap *overlap, CollPair *collpair,
 										GHash *visithash, MemArena *arena)
 {
-	ClothModifierData *clmd = ( ClothModifierData * ) md1;
-	CollisionModifierData *collmd = ( CollisionModifierData * ) md2;
+	ClothModifierData *clmd = (ClothModifierData *)md1;
+	CollisionModifierData *collmd = (CollisionModifierData *) md2;
 	MFace *face1=NULL, *face2 = NULL;
 	ClothVertex *verts1 = clmd->clothObject->verts;
 	double distance = 0;
@@ -858,10 +859,10 @@ static int cloth_edge_collision_response_moving ( ClothModifierData *clmd, Colli
 		VECADDFAC(v1, cloth1->verts[collpair->ap1].tv, cloth1->verts[collpair->ap2].tv, w1);
 		VECADDFAC(v2, collmd->current_v[collpair->bp1].co, collmd->current_v[collpair->bp2].co, w2);
 		
-		VECSUB ( relativeVelocity, v2, v1);
+		sub_v3_v3v3 ( relativeVelocity, v2, v1);
 		
 		// Calculate the normal component of the relative velocity (actually only the magnitude - the direction is stored in 'normal').
-		magrelVel = INPR ( relativeVelocity, collpair->normal );
+		magrelVel = dot_v3v3 ( relativeVelocity, collpair->normal );
 
 		// If v_n_mag < 0 the edges are approaching each other.
 		if ( magrelVel > ALMOST_ZERO )
@@ -875,13 +876,13 @@ static int cloth_edge_collision_response_moving ( ClothModifierData *clmd, Colli
 			zero_v3(pimpulse);
 			
 			// calculate tangential velocity
-			VECCOPY ( temp, collpair->normal );
+			copy_v3_v3 ( temp, collpair->normal );
 			mul_v3_fl( temp, magrelVel );
-			VECSUB ( vrel_t_pre, relativeVelocity, temp );
+			sub_v3_v3v3 ( vrel_t_pre, relativeVelocity, temp );
 
 			// 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 = MIN2 ( clmd->coll_parms->friction * 0.01 * magrelVel,sqrt ( INPR ( vrel_t_pre,vrel_t_pre ) ) );
+			magtangent = MIN2 ( clmd->coll_parms->friction * 0.01 * magrelVel,sqrt ( dot_v3v3 ( vrel_t_pre,vrel_t_pre ) ) );
 
 			// Apply friction impulse.
 			if ( magtangent > ALMOST_ZERO )
@@ -960,10 +961,10 @@ static int cloth_collision_response_moving ( ClothModifierData *clmd, CollisionM
 			// Calculate relative "velocity".
 			collision_interpolateOnTriangle ( v1, collmd->current_v[collpair->bp1].co, collmd->current_v[collpair->bp2].co, collmd->current_v[collpair->bp3].co, w1, w2, w3);
 			
-			VECSUB ( relativeVelocity, v1, cloth1->verts[collpair->collp].tv);
+			sub_v3_v3v3 ( relativeVelocity, v1, cloth1->verts[collpair->collp].tv);
 			
 			// Calculate the normal component of the relative velocity (actually only the magnitude - the direction is stored in 'normal').
-			magrelVel = INPR ( relativeVelocity, collpair->normal );
+			magrelVel = dot_v3v3 ( relativeVelocity, collpair->normal );
 	
 			// If v_n_mag < 0 the edges are approaching each other.
 			if ( magrelVel > ALMOST_ZERO )
@@ -975,13 +976,13 @@ static int cloth_collision_response_moving ( ClothModifierData *clmd, CollisionM
 				float temp[3], spf;
 	
 				// calculate tangential velocity
-				VECCOPY ( temp, collpair->normal );
+				copy_v3_v3 ( temp, collpair->normal );
 				mul_v3_fl( temp, magrelVel );
-				VECSUB ( vrel_t_pre, relativeVelocity, temp );
+				sub_v3_v3v3 ( vrel_t_pre, relativeVelocity, temp );
 	
 				// 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 = MIN2 ( clmd->coll_parms->friction * 0.01 * magrelVel,sqrt ( INPR ( vrel_t_pre,vrel_t_pre ) ) );
+				magtangent = MIN2 ( clmd->coll_parms->friction * 0.01 * magrelVel,sqrt ( dot_v3v3 ( vrel_t_pre,vrel_t_pre ) ) );
 	
 				// Apply friction impulse.
 				if ( magtangent > ALMOST_ZERO )
@@ -1020,16 +1021,17 @@ static int cloth_collision_response_moving ( ClothModifierData *clmd, CollisionM
 	
 				result = 1;
 			}
-		} else {	
+		}
+		else {
 			w1 = collpair->bary[0]; w2 = collpair->bary[1]; w3 = collpair->bary[2];			
 
 			// Calculate relative "velocity".
 			collision_interpolateOnTriangle ( v1, cloth1->verts[collpair->ap1].tv, cloth1->verts[collpair->ap2].tv, cloth1->verts[collpair->ap3].tv, w1, w2, w3 );
 	
-			VECSUB ( relativeVelocity, collmd->current_v[collpair->collp].co, v1);
+			sub_v3_v3v3 ( relativeVelocity, collmd->current_v[collpair->collp].co, v1);
 			
 			// Calculate the normal component of the relative velocity (actually only the magnitude - the direction is stored in 'normal').
-			magrelVel = INPR ( relativeVelocity, collpair->normal );
+			magrelVel = dot_v3v3 ( relativeVelocity, collpair->normal );
 	
 			// If v_n_mag < 0 the edges are approaching each other.
 			if ( magrelVel > ALMOST_ZERO )
@@ -1041,13 +1043,13 @@ static int cloth_collision_response_moving ( ClothModifierData *clmd, CollisionM
 				float temp[3], spf;
 	
 				// calculate tangential velocity
-				VECCOPY ( temp, collpair->normal );
+				copy_v3_v3 ( temp, collpair->normal );
 				mul_v3_fl( temp, magrelVel );
-				VECSUB ( vrel_t_pre, relativeVelocity, temp );
+				sub_v3_v3v3 ( vrel_t_pre, relativeVelocity, temp );
 	
 				// 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 = MIN2 ( clmd->coll_parms->friction * 0.01 * magrelVel,sqrt ( INPR ( vrel_t_pre,vrel_t_pre ) ) );
+				magtangent = MIN2 ( clmd->coll_parms->friction * 0.01 * magrelVel,sqrt ( dot_v3v3 ( vrel_t_pre,vrel_t_pre ) ) );
 	
 				// Apply friction impulse.
 				if ( magtangent > ALMOST_ZERO )
@@ -1183,8 +1185,8 @@ int cloth_point_tri_moving_v3v3_f(float v1[2][3], int i1, float v2[2][3], int i2
 static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, BVHTreeOverlap *overlap, 
 								   CollPair *collpair, double dt, GHash *gh, MemArena *arena)
 {
-	ClothModifierData *clmd = ( ClothModifierData * ) md1;
-	CollisionModifierData *collmd = ( CollisionModifierData * ) md2;
+	ClothModifierData *clmd = (ClothModifierData *)md1;
+	CollisionModifierData *collmd = (CollisionModifierData *) md2;
 	MFace *face1=NULL, *face2 = NULL;
 	ClothVertex *verts1 = clmd->clothObject->verts;
 	double distance = 0;
@@ -1352,7 +1354,8 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, BVHTree
 				
 				collpair->flag = COLLISION_USE_COLLFACE;
 				collpair++;
-			} else if (ret && j >= 3) { /*coll vert versus cloth face*/
+			}
+			else if (ret && j >= 3) { /*coll vert versus cloth face*/
 				collpair->ap1 = ap1; collpair->ap2 = ap2; collpair->ap3 = ap3;
 				collpair->collp = collp;
 				
@@ -1379,7 +1382,7 @@ static void machine_epsilon_offset(Cloth *cloth)
 	
 	cv = cloth->verts;
 	for (i=0; i<cloth->numverts; i++, cv++) {
-		/*aggrevatingly enough, it's necassary to offset the coordinates
+		/*aggrevatingly enough, it's necessary to offset the coordinates
 		 by a multiple of the 32-bit floating point epsilon when switching
 		 into doubles*/
 		#define RNDSIGN (float)(-1*(BLI_rand()%2==0)|1)
@@ -1397,8 +1400,8 @@ static void machine_epsilon_offset(Cloth *cloth)
 static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, 
 	BVHTreeOverlap *overlap, CollPair *collpair, float dt )
 {
-	ClothModifierData *clmd = ( ClothModifierData * ) md1;
-	CollisionModifierData *collmd = ( CollisionModifierData * ) md2;
+	ClothModifierData *clmd = (ClothModifierData *)md1;
+	CollisionModifierData *collmd = (CollisionModifierData *) md2;
 	Cloth *cloth = clmd->clothObject;
 	MFace *face1=NULL, *face2 = NULL;
 #ifdef USE_BULLET
@@ -1544,9 +1547,9 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2,
 
 			collision_interpolateOnTriangle ( v2, collmd->current_v[collpair->bp1].co, collmd->current_v[collpair->bp2].co, collmd->current_v[collpair->bp3].co, u1, u2, u3 );
 
-			VECSUB ( relativeVelocity, v2, v1 );
+			sub_v3_v3v3 ( relativeVelocity, v2, v1 );
 
-			if(sqrt(INPR(relativeVelocity, relativeVelocity)) >= distance)
+			if (sqrt(dot_v3v3(relativeVelocity, relativeVelocity)) >= distance)
 			{
 				// check for collision in the future
 				collpair->flag |= COLLISION_IN_FUTURE;
@@ -1591,10 +1594,10 @@ static int cloth_collision_response_moving( ClothModifierData *clmd, CollisionMo
 
 		collision_interpolateOnTriangle ( v2, collmd->current_v[collpair->bp1].co, collmd->current_v[collpair->bp2].co, collmd->current_v[collpair->bp3].co, u1, u2, u3 );
 
-		VECSUB ( relativeVelocity, v2, v1 );
+		sub_v3_v3v3 ( relativeVelocity, v2, v1 );
 
 		// Calculate the normal component of the relative velocity (actually only the magnitude - the direction is stored in 'normal').
-		magrelVel = INPR ( relativeVelocity, collpair->normal );
+		magrelVel = dot_v3v3 ( relativeVelocity, collpair->normal );
 
 		// printf("magrelVel: %f\n", magrelVel);
 
@@ -1611,13 +1614,13 @@ static int cloth_collision_response_moving( ClothModifierData *clmd, CollisionMo
 			float temp[3];
 
 			// calculate tangential velocity
-			VECCOPY ( temp, collpair->normal );
+			copy_v3_v3 ( temp, collpair->normal );
 			mul_v3_fl( temp, magrelVel );
-			VECSUB ( vrel_t_pre, relativeVelocity, temp );
+			sub_v3_v3v3 ( vrel_t_pre, relativeVelocity, temp );
 
 			// 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 = MIN2 ( clmd->coll_parms->friction * 0.01 * magrelVel,sqrt ( INPR ( vrel_t_pre,vrel_t_pre ) ) );
+			magtangent = MIN2 ( clmd->coll_parms->friction * 0.01 * magrelVel,sqrt ( dot_v3v3 ( vrel_t_pre,vrel_t_pre ) ) );
 
 			// Apply friction impulse.
 			if ( magtangent > ALMOST_ZERO )
@@ -1674,9 +1677,9 @@ static int cloth_collision_response_moving( ClothModifierData *clmd, CollisionMo
 static float projectPointOntoLine(float *p, float *a, float *b) 
 {
 	float ba[3], pa[3];
-	VECSUB(ba, b, a);
-	VECSUB(pa, p, a);
-	return INPR(pa, ba) / INPR(ba, ba);
+	sub_v3_v3v3(ba, b, a);
+	sub_v3_v3v3(pa, p, a);
+	return dot_v3v3(pa, ba) / dot_v3v3(ba, ba);
 }
 
 static void calculateEENormal(float *np1, float *np2, float *np3, float *np4,float *out_normal) 
@@ -1684,8 +1687,8 @@ static void calculateEENormal(float *np1, float *np2, float *np3, float *np4,flo
 	float line1[3], line2[3];
 	float length;
 
-	VECSUB(line1, np2, np1);
-	VECSUB(line2, np3, np1);
+	sub_v3_v3v3(line1, np2, np1);
+	sub_v3_v3v3(line2, np3, np1);
 
 	// printf("l1: %f, l1: %f, l2: %f, l2: %f\n", line1[0], line1[1], line2[0], line2[1]);
 
@@ -1696,7 +1699,7 @@ static void calculateEENormal(float *np1, float *np2, float *np3, float *np4,flo
 	length = normalize_v3(out_normal);
 	if (length <= FLT_EPSILON)
 	{ // lines are collinear
-		VECSUB(out_normal, np2, np1);
+		sub_v3_v3v3(out_normal, np2, np1);
 		normalize_v3(out_normal);
 	}
 }
@@ -1707,19 +1710,19 @@ static void findClosestPointsEE(float *x1, float *x2, float *x3, float *x4, floa
 	
 	double a, b, c, e, f; 
 
-	VECSUB(temp, x2, x1);
-	a = INPR(temp, temp);
+	sub_v3_v3v3(temp, x2, x1);
+	a = dot_v3v3(temp, temp);
 
-	VECSUB(temp2, x4, x3);
-	b = -INPR(temp, temp2);
+	sub_v3_v3v3(temp2, x4, x3);
+	b = -dot_v3v3(temp, temp2);
 
-	c = INPR(temp2, temp2);
+	c = dot_v3v3(temp2, temp2);
 
-	VECSUB(temp2, x3, x1);
-	e = INPR(temp, temp2);
+	sub_v3_v3v3(temp2, x3, x1);
+	e = dot_v3v3(temp, temp2);
 
-	VECSUB(temp, x4, x3);
-	f = -INPR(temp, temp2);
+	sub_v3_v3v3(temp, x4, x3);
+	f = -dot_v3v3(temp, temp2);
 
 	*w1 = (e * c - b * f) / (a * c - b * b);
 	*w2 = (f - b * *w1) / c;
@@ -1734,11 +1737,11 @@ static float edgedge_distance(float np11[3], float np12[3], float np21[3], float
 	float temp[3], temp2[3];
 	float dist_a1, dist_a2;
 	
-	VECSUB(line1, np12, np11);
-	VECSUB(line2, np22, np21);
+	sub_v3_v3v3(line1, np12, np11);
+	sub_v3_v3v3(line2, np22, np21);
 
 	cross_v3_v3v3(cross, line1, line2);
-	length = INPR(cross, cross);
+	length = dot_v3v3(cross, cross);
 
 	if (length < FLT_EPSILON) 
 	{
@@ -1747,11 +1750,11 @@ static float edgedge_distance(float np11[3], float np12[3], float np21[3], float
 		{
 			*out_a1 = 0;
 			calculateEENormal(np11, np12, np21, np22, out_normal);
-			VECSUB(temp, np22, np21);
+			sub_v3_v3v3(temp, np22, np21);
 			mul_v3_fl(temp, *out_a2);
 			VECADD(temp2, temp, np21);
 			VECADD(temp2, temp2, np11);
-			return INPR(temp2, temp2);
+			return dot_v3v3(temp2, temp2);
 		}
 
 		CLAMP(*out_a2, 0.0, 1.0);
@@ -1763,11 +1766,11 @@ static float edgedge_distance(float np11[3], float np12[3], float np21[3], float
 				calculateEENormal(np11, np12, np21, np22, out_normal);
 
 				// return (np22 - (np11 + (np12 - np11) * out_a1)).lengthSquared();
-				VECSUB(temp, np12, np11);
+				sub_v3_v3v3(temp, np12, np11);
 				mul_v3_fl(temp, *out_a1);
 				VECADD(temp2, temp, np11);
-				VECSUB(temp2, np22, temp2);
-				return INPR(temp2, temp2);
+				sub_v3_v3v3(temp2, np22, temp2);
+				return dot_v3v3(temp2, temp2);
 			}
 		} 
 		else 
@@ -1778,40 +1781,40 @@ static float edgedge_distance(float np11[3], float np12[3], float np21[3], float
 				calculateEENormal(np11, np11, np21, np22, out_normal);
 
 				// return (np21 - (np11 + (np12 - np11) * out_a1)).lengthSquared();
-				VECSUB(temp, np12, np11);
+				sub_v3_v3v3(temp, np12, np11);
 				mul_v3_fl(temp, *out_a1);
 				VECADD(temp2, temp, np11);
-				VECSUB(temp2, np21, temp2);
-				return INPR(temp2, temp2);
+				sub_v3_v3v3(temp2, np21, temp2);
+				return dot_v3v3(temp2, temp2);
 			}
 		}
 
 		CLAMP(*out_a1, 0.0, 1.0);
 		calculateEENormal(np11, np12, np21, np22, out_normal);
-		if(*out_a1 > .5)
+		if (*out_a1 > .5)
 		{
-			if(*out_a2 > .5)
+			if (*out_a2 > .5)
 			{
-				VECSUB(temp, np12, np22);
+				sub_v3_v3v3(temp, np12, np22);
 			}
 			else
 			{
-				VECSUB(temp, np12, np21);
+				sub_v3_v3v3(temp, np12, np21);
 			}
 		}
 		else
 		{
-			if(*out_a2 > .5)
+			if (*out_a2 > .5)
 			{
-				VECSUB(temp, np11, np22);
+				sub_v3_v3v3(temp, np11, np22);
 			}
 			else
 			{
-				VECSUB(temp, np11, np21);
+				sub_v3_v3v3(temp, np11, np21);
 			}
 		}
 
-		return INPR(temp, temp);
+		return dot_v3v3(temp, temp);
 	}
 	else
 	{
@@ -1826,18 +1829,18 @@ static float edgedge_distance(float np11[3], float np12[3], float np21[3], float
 			float p1[3], p2[3];
 			
 			// p1= np11 + (np12 - np11) * out_a1;
-			VECSUB(temp, np12, np11);
+			sub_v3_v3v3(temp, np12, np11);
 			mul_v3_fl(temp, *out_a1);
 			VECADD(p1, np11, temp);
 			
 			// p2 = np21 + (np22 - np21) * out_a2;
-			VECSUB(temp, np22, np21);
+			sub_v3_v3v3(temp, np22, np21);
 			mul_v3_fl(temp, *out_a2);
 			VECADD(p2, np21, temp);
 
 			calculateEENormal(np11, np12, np21, np22, out_normal);
-			VECSUB(temp, p1, p2);
-			return INPR(temp, temp);
+			sub_v3_v3v3(temp, p1, p2);
+			return dot_v3v3(temp, temp);
 		}
 
 		
@@ -1857,7 +1860,7 @@ static float edgedge_distance(float np11[3], float np12[3], float np21[3], float
 			float p1[3];
 
 			// p1 = np11 + (np12 - np11) * out_a1;
-			VECSUB(temp, np12, np11);
+			sub_v3_v3v3(temp, np12, np11);
 			mul_v3_fl(temp, *out_a1);
 			VECADD(p1, np11, temp);
 
@@ -1867,11 +1870,11 @@ static float edgedge_distance(float np11[3], float np12[3], float np21[3], float
 			calculateEENormal(np11, np12, np21, np22, out_normal);
 
 			// return (p1 - (np21 + (np22 - np21) * out_a2)).lengthSquared();
-			VECSUB(temp, np22, np21);
+			sub_v3_v3v3(temp, np22, np21);
 			mul_v3_fl(temp, *out_a2);
 			VECADD(temp, temp, np21);
-			VECSUB(temp, p1, temp);
-			return INPR(temp, temp);
+			sub_v3_v3v3(temp, p1, temp);
+			return dot_v3v3(temp, temp);
 		} 
 		else 
 		{	
@@ -1879,7 +1882,7 @@ static float edgedge_distance(float np11[3], float np12[3], float np21[3], float
 			float p2[3];
 			
 			// p2 = np21 + (np22 - np21) * out_a2;
-			VECSUB(temp, np22, np21);
+			sub_v3_v3v3(temp, np22, np21);
 			mul_v3_fl(temp, *out_a2);
 			VECADD(p2, np21, temp);
 
@@ -1889,11 +1892,11 @@ static float edgedge_distance(float np11[3], float np12[3], float np21[3], float
 			calculateEENormal(np11, np12, np21, np22, out_normal);
 			
 			// return ((np11 + (np12 - np11) * out_a1) - p2).lengthSquared();
-			VECSUB(temp, np12, np11);
+			sub_v3_v3v3(temp, np12, np11);
 			mul_v3_fl(temp, *out_a1);
 			VECADD(temp, temp, np11);
-			VECSUB(temp, temp, p2);
-			return INPR(temp, temp);
+			sub_v3_v3v3(temp, temp, p2);
+			return dot_v3v3(temp, temp);
 		}
 	}
 	
@@ -1919,11 +1922,11 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
 	cloth1 = clmd->clothObject;
 	verts1 = cloth1->verts;
 
-	for(i = 0; i < 9; i++)
+	for (i = 0; i < 9; i++)
 	{
 		// 9 edge - edge possibilities
 
-		if(i == 0) // cloth edge: 1-2; coll edge: 1-2
+		if (i == 0) // cloth edge: 1-2; coll edge: 1-2
 		{
 			edgecollpair.p11 = collpair->ap1;
 			edgecollpair.p12 = collpair->ap2;
@@ -1931,7 +1934,7 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
 			edgecollpair.p21 = collpair->bp1;
 			edgecollpair.p22 = collpair->bp2;
 		}
-		else if(i == 1) // cloth edge: 1-2; coll edge: 2-3
+		else if (i == 1) // cloth edge: 1-2; coll edge: 2-3
 		{
 			edgecollpair.p11 = collpair->ap1;
 			edgecollpair.p12 = collpair->ap2;
@@ -1939,7 +1942,7 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
 			edgecollpair.p21 = collpair->bp2;
 			edgecollpair.p22 = collpair->bp3;
 		}
-		else if(i == 2) // cloth edge: 1-2; coll edge: 1-3
+		else if (i == 2) // cloth edge: 1-2; coll edge: 1-3
 		{
 			edgecollpair.p11 = collpair->ap1;
 			edgecollpair.p12 = collpair->ap2;
@@ -1947,7 +1950,7 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
 			edgecollpair.p21 = collpair->bp1;
 			edgecollpair.p22 = collpair->bp3;
 		}
-		else if(i == 3) // cloth edge: 2-3; coll edge: 1-2
+		else if (i == 3) // cloth edge: 2-3; coll edge: 1-2
 		{
 			edgecollpair.p11 = collpair->ap2;
 			edgecollpair.p12 = collpair->ap3;
@@ -1955,7 +1958,7 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
 			edgecollpair.p21 = collpair->bp1;
 			edgecollpair.p22 = collpair->bp2;
 		}
-		else if(i == 4) // cloth edge: 2-3; coll edge: 2-3
+		else if (i == 4) // cloth edge: 2-3; coll edge: 2-3
 		{
 			edgecollpair.p11 = collpair->ap2;
 			edgecollpair.p12 = collpair->ap3;
@@ -1963,7 +1966,7 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
 			edgecollpair.p21 = collpair->bp2;
 			edgecollpair.p22 = collpair->bp3;
 		}
-		else if(i == 5) // cloth edge: 2-3; coll edge: 1-3
+		else if (i == 5) // cloth edge: 2-3; coll edge: 1-3
 		{
 			edgecollpair.p11 = collpair->ap2;
 			edgecollpair.p12 = collpair->ap3;
@@ -1971,7 +1974,7 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
 			edgecollpair.p21 = collpair->bp1;
 			edgecollpair.p22 = collpair->bp3;
 		}
-		else if(i ==6) // cloth edge: 1-3; coll edge: 1-2
+		else if (i ==6) // cloth edge: 1-3; coll edge: 1-2
 		{
 			edgecollpair.p11 = collpair->ap1;
 			edgecollpair.p12 = collpair->ap3;
@@ -1979,7 +1982,7 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
 			edgecollpair.p21 = collpair->bp1;
 			edgecollpair.p22 = collpair->bp2;
 		}
-		else if(i ==7) // cloth edge: 1-3; coll edge: 2-3
+		else if (i ==7) // cloth edge: 1-3; coll edge: 2-3
 		{
 			edgecollpair.p11 = collpair->ap1;
 			edgecollpair.p12 = collpair->ap3;
@@ -1987,7 +1990,7 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
 			edgecollpair.p21 = collpair->bp2;
 			edgecollpair.p22 = collpair->bp3;
 		}
-		else if(i == 8) // cloth edge: 1-3; coll edge: 1-3
+		else if (i == 8) // cloth edge: 1-3; coll edge: 1-3
 		{
 			edgecollpair.p11 = collpair->ap1;
 			edgecollpair.p12 = collpair->ap3;
@@ -1996,29 +1999,29 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
 			edgecollpair.p22 = collpair->bp3;
 		}
 		/*
-		if((edgecollpair.p11 == 3) && (edgecollpair.p12 == 16))
+		if ((edgecollpair.p11 == 3) && (edgecollpair.p12 == 16))
 			printf("Ahier!\n");
-		if((edgecollpair.p11 == 16) && (edgecollpair.p12 == 3))
+		if ((edgecollpair.p11 == 16) && (edgecollpair.p12 == 3))
 			printf("Ahier!\n");
 		*/
 
 		// if ( !cloth_are_edges_adjacent ( clmd, collmd, &edgecollpair ) )
 		{
 			// always put coll points in p21/p22
-			VECSUB ( x1, verts1[edgecollpair.p12].txold, verts1[edgecollpair.p11].txold );
-			VECSUB ( v1, verts1[edgecollpair.p12].tv, verts1[edgecollpair.p11].tv );
+			sub_v3_v3v3 ( x1, verts1[edgecollpair.p12].txold, verts1[edgecollpair.p11].txold );
+			sub_v3_v3v3 ( v1, verts1[edgecollpair.p12].tv, verts1[edgecollpair.p11].tv );
 
-			VECSUB ( x2, verts2[edgecollpair.p21].co, verts1[edgecollpair.p11].txold );
-			VECSUB ( v2, velocity2[edgecollpair.p21].co, verts1[edgecollpair.p11].tv );
+			sub_v3_v3v3 ( x2, verts2[edgecollpair.p21].co, verts1[edgecollpair.p11].txold );
+			sub_v3_v3v3 ( v2, velocity2[edgecollpair.p21].co, verts1[edgecollpair.p11].tv );
 
-			VECSUB ( x3, verts2[edgecollpair.p22].co, verts1[edgecollpair.p11].txold );
-			VECSUB ( v3, velocity2[edgecollpair.p22].co, verts1[edgecollpair.p11].tv );
+			sub_v3_v3v3 ( x3, verts2[edgecollpair.p22].co, verts1[edgecollpair.p11].txold );
+			sub_v3_v3v3 ( v3, velocity2[edgecollpair.p22].co, verts1[edgecollpair.p11].tv );
 
 			numsolutions = cloth_get_collision_time ( x1, v1, x2, v2, x3, v3, solution );
 
-			if((edgecollpair.p11 == 3 && edgecollpair.p12==16)|| (edgecollpair.p11==16 && edgecollpair.p12==3))
+			if ((edgecollpair.p11 == 3 && edgecollpair.p12==16)|| (edgecollpair.p11==16 && edgecollpair.p12==3))
 			{
-				if(edgecollpair.p21==6 || edgecollpair.p22 == 6)
+				if (edgecollpair.p21==6 || edgecollpair.p22 == 6)
 				{
 					printf("dist: %f, sol[k]: %f, sol2[k]: %f\n", distance, solution[k], solution2[k]);
 					printf("a1: %f, a2: %f, b1: %f, b2: %f\n", x1[0], x2[0], x3[0], v1[0]);
@@ -2047,30 +2050,30 @@ static int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModi
 					// TODO: check for collisions
 					distance = edgedge_distance(triA[0], triA[1], triB[0], triB[1], &a, &b, out_normal);
 					
-					if ((distance <= clmd->coll_parms->epsilon + BLI_bvhtree_getepsilon ( collmd->bvhtree ) + ALMOST_ZERO) && (INPR(out_normal, out_normal) > 0))
+					if ((distance <= clmd->coll_parms->epsilon + BLI_bvhtree_getepsilon ( collmd->bvhtree ) + ALMOST_ZERO) && (dot_v3v3(out_normal, out_normal) > 0))
 					{
 						float vrel_1_to_2[3], temp[3], temp2[3], out_normalVelocity;
 						float desiredVn;
 
-						VECCOPY(vrel_1_to_2, verts1[edgecollpair.p11].tv);
+						copy_v3_v3(vrel_1_to_2, verts1[edgecollpair.p11].tv);
 						mul_v3_fl(vrel_1_to_2, 1.0 - a);
-						VECCOPY(temp, verts1[edgecollpair.p12].tv);
+						copy_v3_v3(temp, verts1[edgecollpair.p12].tv);
 						mul_v3_fl(temp, a);
 
 						VECADD(vrel_1_to_2, vrel_1_to_2, temp);
 
-						VECCOPY(temp, verts1[edgecollpair.p21].tv);
+						copy_v3_v3(temp, verts1[edgecollpair.p21].tv);
 						mul_v3_fl(temp, 1.0 - b);
-						VECCOPY(temp2, verts1[edgecollpair.p22].tv);
+						copy_v3_v3(temp2, verts1[edgecollpair.p22].tv);
 						mul_v3_fl(temp2, b);
 						VECADD(temp, temp, temp2);
 
-						VECSUB(vrel_1_to_2, vrel_1_to_2, temp);
+						sub_v3_v3v3(vrel_1_to_2, vrel_1_to_2, temp);
 
-						out_normalVelocity = INPR(vrel_1_to_2, out_normal);
+						out_normalVelocity = dot_v3v3(vrel_1_to_2, out_normal);
 /*
 						// this correction results in wrong normals sometimes?
-						if(out_normalVelocity < 0.0)
+						if (out_normalVelocity < 0.0)
 						{
 							out_normalVelocity*= -1.0;
 							negate_v3(out_normal);
@@ -2130,20 +2133,20 @@ static int cloth_collision_moving ( ClothModifierData *clmd, CollisionModifierDa
 }
 #endif
 
-static void add_collision_object(Object ***objs, unsigned int *numobj, unsigned int *maxobj, Object *ob, Object *self, int level)
+static void add_collision_object(Object ***objs, unsigned int *numobj, unsigned int *maxobj, Object *ob, Object *self, int level, unsigned int modifier_type)
 {
 	CollisionModifierData *cmd= NULL;
 
-	if(ob == self)
+	if (ob == self)
 		return;
 
 	/* only get objects with collision modifier */
-	if(ob->pd && ob->pd->deflect)
-		cmd= (CollisionModifierData *)modifiers_findByType(ob, eModifierType_Collision);
+	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) {
+		if (*numobj >= *maxobj) {
 			*maxobj *= 2;
 			*objs= MEM_reallocN(*objs, sizeof(Object*)*(*maxobj));
 		}
@@ -2153,19 +2156,19 @@ static void add_collision_object(Object ***objs, unsigned int *numobj, unsigned
 	}
 
 	/* objects in dupli groups, one level only for now */
-	if(ob->dup_group && level == 0) {
+	if (ob->dup_group && level == 0) {
 		GroupObject *go;
 		Group *group= ob->dup_group;
 
 		/* add objects */
-		for(go= group->gobject.first; go; go= go->next)
-			add_collision_object(objs, numobj, maxobj, go->ob, self, level+1);
+		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
 // collision object will exclude self 
-Object **get_collisionobjects(Scene *scene, Object *self, Group *group, unsigned int *numcollobj)
+Object **get_collisionobjects(Scene *scene, Object *self, Group *group, unsigned int *numcollobj, unsigned int modifier_type)
 {
 	Base *base;
 	Object **objs;
@@ -2175,17 +2178,17 @@ Object **get_collisionobjects(Scene *scene, Object *self, Group *group, unsigned
 	objs= MEM_callocN(sizeof(Object *)*maxobj, "CollisionObjectsArray");
 
 	/* gather all collision objects */
-	if(group) {
+	if (group) {
 		/* use specified group */
-		for(go= group->gobject.first; go; go= go->next)
-			add_collision_object(&objs, &numobj, &maxobj, go->ob, self, 0);
+		for (go= group->gobject.first; go; go= go->next)
+			add_collision_object(&objs, &numobj, &maxobj, go->ob, self, 0, modifier_type);
 	}
 	else {
 		Scene *sce_iter;
 		/* add objects in same layer in scene */
-		for(SETLOOPER(scene, sce_iter, base)) {
-			if(base->lay & self->lay)
-				add_collision_object(&objs, &numobj, &maxobj, base->object, self, 0);
+		for (SETLOOPER(scene, sce_iter, base)) {
+			if (base->lay & self->lay)
+				add_collision_object(&objs, &numobj, &maxobj, base->object, self, 0, modifier_type);
 
 		}
 	}
@@ -2200,14 +2203,14 @@ static void add_collider_cache_object(ListBase **objs, Object *ob, Object *self,
 	CollisionModifierData *cmd= NULL;
 	ColliderCache *col;
 
-	if(ob == self)
+	if (ob == self)
 		return;
 
-	if(ob->pd && ob->pd->deflect)
+	if (ob->pd && ob->pd->deflect)
 		cmd =(CollisionModifierData *)modifiers_findByType(ob, eModifierType_Collision);
 	
-	if(cmd && cmd->bvhtree) {	
-		if(*objs == NULL)
+	if (cmd && cmd->bvhtree) {	
+		if (*objs == NULL)
 			*objs = MEM_callocN(sizeof(ListBase), "ColliderCache array");
 
 		col = MEM_callocN(sizeof(ColliderCache), "ColliderCache");
@@ -2219,12 +2222,12 @@ static void add_collider_cache_object(ListBase **objs, Object *ob, Object *self,
 	}
 
 	/* objects in dupli groups, one level only for now */
-	if(ob->dup_group && level == 0) {
+	if (ob->dup_group && level == 0) {
 		GroupObject *go;
 		Group *group= ob->dup_group;
 
 		/* add objects */
-		for(go= group->gobject.first; go; go= go->next)
+		for (go= group->gobject.first; go; go= go->next)
 			add_collider_cache_object(objs, go->ob, self, level+1);
 	}
 }
@@ -2235,8 +2238,8 @@ ListBase *get_collider_cache(Scene *scene, Object *self, Group *group)
 	ListBase *objs= NULL;
 	
 	/* add object in same layer in scene */
-	if(group) {
-		for(go= group->gobject.first; go; go= go->next)
+	if (group) {
+		for (go= group->gobject.first; go; go= go->next)
 			add_collider_cache_object(&objs, go->ob, self, 0);
 	}
 	else {
@@ -2244,8 +2247,8 @@ ListBase *get_collider_cache(Scene *scene, Object *self, Group *group)
 		Base *base;
 
 		/* add objects in same layer in scene */
-		for(SETLOOPER(scene, sce_iter, base)) {
-			if(!self || (base->lay & self->lay))
+		for (SETLOOPER(scene, sce_iter, base)) {
+			if (!self || (base->lay & self->lay))
 				add_collider_cache_object(&objs, base->object, self, 0);
 
 		}
@@ -2256,7 +2259,7 @@ ListBase *get_collider_cache(Scene *scene, Object *self, Group *group)
 
 void free_collider_cache(ListBase **colliders)
 {
-	if(*colliders) {
+	if (*colliders) {
 		BLI_freelistN(*colliders);
 		MEM_freeN(*colliders);
 		*colliders = NULL;
@@ -2282,13 +2285,13 @@ static void cloth_bvh_objcollisions_nearcheck ( ClothModifierData * clmd, Collis
 
 	for ( i = 0; i < numresult; i++ )
 	{
-		*collisions_index = cloth_collision ( ( ModifierData * ) clmd, ( ModifierData * ) collmd,
+		*collisions_index = cloth_collision ( (ModifierData *)clmd, (ModifierData *)collmd,
 											  overlap+i, *collisions_index, dt, tri_visithash, arena );
 	}
 
 	for ( i = 0; i < numresult; i++ )
 	{
-		*collisions_index = cloth_edge_collision ( ( ModifierData * ) clmd, ( ModifierData * ) collmd,
+		*collisions_index = cloth_edge_collision ( (ModifierData *)clmd, (ModifierData *)collmd,
 												   overlap+i, *collisions_index, visithash, arena );
 	}
 	BLI_ghash_free(visithash, NULL, NULL);
@@ -2297,7 +2300,7 @@ static void cloth_bvh_objcollisions_nearcheck ( ClothModifierData * clmd, Collis
 #else /* WITH_ELTOPO */
 	for ( i = 0; i < numresult; i++ )
 	{
-		*collisions_index = cloth_collision ( ( ModifierData * ) clmd, ( ModifierData * ) collmd,
+		*collisions_index = cloth_collision ( (ModifierData *)clmd, (ModifierData *)collmd,
 											  overlap+i, *collisions_index, dt );
 	}
 #endif /* WITH_ELTOPO */
@@ -2384,9 +2387,9 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
 	bvhtree_update_from_cloth ( clmd, 1 ); // 0 means STATIC, 1 means MOVING (see later in this function)
 	bvhselftree_update_from_cloth ( clmd, 0 ); // 0 means STATIC, 1 means MOVING (see later in this function)
 	
-	collobjs = get_collisionobjects(clmd->scene, ob, clmd->coll_parms->group, &numcollobj);
+	collobjs = get_collisionobjects(clmd->scene, ob, clmd->coll_parms->group, &numcollobj, eModifierType_Collision);
 	
-	if(!collobjs)
+	if (!collobjs)
 		return 0;
 
 	do
@@ -2399,14 +2402,14 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
 		collisions_index = MEM_callocN(sizeof(CollPair *) *numcollobj , "CollPair");
 		
 		// check all collision objects
-		for(i = 0; i < numcollobj; i++)
+		for (i = 0; i < numcollobj; i++)
 		{
 			Object *collob= collobjs[i];
 			CollisionModifierData *collmd = (CollisionModifierData*)modifiers_findByType(collob, eModifierType_Collision);
 			BVHTreeOverlap *overlap = NULL;
 			unsigned int result = 0;
 			
-			if(!collmd->bvhtree)
+			if (!collmd->bvhtree)
 				continue;
 			
 			/* move object to position (step) in time */
@@ -2417,7 +2420,7 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
 			overlap = BLI_bvhtree_overlap ( cloth_bvh, collmd->bvhtree, &result );
 				
 			// go to next object if no overlap is there
-			if( result && overlap ) {
+			if ( result && overlap ) {
 				/* check if collisions really happen (costly near check) */
 				cloth_bvh_objcollisions_nearcheck ( clmd, collmd, &collisions[i], 
 					&collisions_index[i], result, overlap, dt/(float)clmd->coll_parms->loop_count);
@@ -2432,7 +2435,7 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
 		}
 		rounds++;
 		
-		for(i = 0; i < numcollobj; i++)
+		for (i = 0; i < numcollobj; i++)
 		{
 			if ( collisions[i] ) MEM_freeN ( collisions[i] );
 		}
@@ -2466,7 +2469,7 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
 		////////////////////////////////////////////////////////////
 		if ( clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_SELF )
 		{
-			for(l = 0; l < (unsigned int)clmd->coll_parms->self_loop_count; l++)
+			for (l = 0; l < (unsigned int)clmd->coll_parms->self_loop_count; l++)
 			{
 				// TODO: add coll quality rounds again
 				BVHTreeOverlap *overlap = NULL;
@@ -2499,14 +2502,14 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
 	
 						if ( clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL )
 						{
-							if ( ( cloth->verts [i].flags & CLOTH_VERT_FLAG_PINNED )
-										&& ( cloth->verts [j].flags & CLOTH_VERT_FLAG_PINNED ) )
+							if ( ( cloth->verts [i].flags & CLOTH_VERT_FLAG_PINNED ) &&
+							     ( cloth->verts [j].flags & CLOTH_VERT_FLAG_PINNED ) )
 							{
 								continue;
 							}
 						}
 	
-						VECSUB ( temp, verts[i].tx, verts[j].tx );
+						sub_v3_v3v3 ( temp, verts[i].tx, verts[j].tx );
 	
 						if ( ( ABS ( temp[0] ) > mindistance ) || ( ABS ( temp[1] ) > mindistance ) || ( ABS ( temp[2] ) > mindistance ) ) continue;
 	
@@ -2537,13 +2540,12 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
 								mul_v3_fl( temp, correction * -0.5 );
 								VECADD ( verts[j].tx, verts[j].tx, temp );
 	
-								VECSUB ( verts[i].tx, verts[i].tx, temp );
+								sub_v3_v3v3 ( verts[i].tx, verts[i].tx, temp );
 							}
 							ret = 1;
 							ret2 += ret;
 						}
-						else
-						{
+						else {
 							// check for approximated time collisions
 						}
 					}
@@ -2564,7 +2566,7 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
 				{
 					if ( ! ( verts [i].flags & CLOTH_VERT_FLAG_PINNED ) )
 					{
-						VECSUB ( verts[i].tv, verts[i].tx, verts[i].txold );
+						sub_v3_v3v3 ( verts[i].tv, verts[i].tx, verts[i].txold );
 					}
 				}
 			}
@@ -2573,7 +2575,7 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
 	}
 	while ( ret2 && ( clmd->coll_parms->loop_count>rounds ) );
 	
-	if(collobjs)
+	if (collobjs)
 		MEM_freeN(collobjs);
 
 	return 1|MIN2 ( ret, 1 );
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 108b4e4..25391a3 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -64,7 +64,7 @@ CurveMapping *curvemapping_add(int tot, float minx, float miny, float maxx, floa
 	
 	cumap= MEM_callocN(sizeof(CurveMapping), "new curvemap");
 	cumap->flag= CUMA_DO_CLIP;
-	if(tot==4) cumap->cur= 3;		/* rhms, hack for 'col' curve? */
+	if (tot==4) cumap->cur= 3;		/* rhms, hack for 'col' curve? */
 	
 	clipminx = MIN2(minx, maxx);
 	clipminy = MIN2(miny, maxy);
@@ -77,7 +77,7 @@ CurveMapping *curvemapping_add(int tot, float minx, float miny, float maxx, floa
 	cumap->white[0]= cumap->white[1]= cumap->white[2]= 1.0f;
 	cumap->bwmul[0]= cumap->bwmul[1]= cumap->bwmul[2]= 1.0f;
 	
-	for(a=0; a<tot; a++) {
+	for (a=0; a<tot; a++) {
 		cumap->cm[a].flag= CUMA_EXTEND_EXTRAPOLATE;
 		cumap->cm[a].totpoint= 2;
 		cumap->cm[a].curve= MEM_callocN(2*sizeof(CurveMapPoint), "curve points");
@@ -97,11 +97,11 @@ void curvemapping_free(CurveMapping *cumap)
 {
 	int a;
 	
-	if(cumap) {
-		for(a=0; a<CM_TOT; a++) {
-			if(cumap->cm[a].curve) MEM_freeN(cumap->cm[a].curve);
-			if(cumap->cm[a].table) MEM_freeN(cumap->cm[a].table);
-			if(cumap->cm[a].premultable) MEM_freeN(cumap->cm[a].premultable);
+	if (cumap) {
+		for (a=0; a<CM_TOT; a++) {
+			if (cumap->cm[a].curve) MEM_freeN(cumap->cm[a].curve);
+			if (cumap->cm[a].table) MEM_freeN(cumap->cm[a].table);
+			if (cumap->cm[a].premultable) MEM_freeN(cumap->cm[a].premultable);
 		}
 		MEM_freeN(cumap);
 	}
@@ -111,14 +111,14 @@ CurveMapping *curvemapping_copy(CurveMapping *cumap)
 {
 	int a;
 	
-	if(cumap) {
+	if (cumap) {
 		CurveMapping *cumapn= MEM_dupallocN(cumap);
-		for(a=0; a<CM_TOT; a++) {
-			if(cumap->cm[a].curve) 
+		for (a=0; a<CM_TOT; a++) {
+			if (cumap->cm[a].curve) 
 				cumapn->cm[a].curve= MEM_dupallocN(cumap->cm[a].curve);
-			if(cumap->cm[a].table) 
+			if (cumap->cm[a].table) 
 				cumapn->cm[a].table= MEM_dupallocN(cumap->cm[a].table);
-			if(cumap->cm[a].premultable) 
+			if (cumap->cm[a].premultable) 
 				cumapn->cm[a].premultable= MEM_dupallocN(cumap->cm[a].premultable);
 		}
 		return cumapn;
@@ -130,13 +130,13 @@ void curvemapping_set_black_white(CurveMapping *cumap, const float black[3], con
 {
 	int a;
 	
-	if(white)
+	if (white)
 		copy_v3_v3(cumap->white, white);
-	if(black)
+	if (black)
 		copy_v3_v3(cumap->black, black);
 	
-	for(a=0; a<3; a++) {
-		if(cumap->white[a]==cumap->black[a])
+	for (a=0; a<3; a++) {
+		if (cumap->white[a]==cumap->black[a])
 			cumap->bwmul[a]= 0.0f;
 		else
 			cumap->bwmul[a]= 1.0f/(cumap->white[a] - cumap->black[a]);
@@ -154,8 +154,8 @@ void curvemap_remove(CurveMap *cuma, int flag)
 	
 	/* well, lets keep the two outer points! */
 	cmp[0]= cuma->curve[0];
-	for(a=1, b=1; a<cuma->totpoint-1; a++) {
-		if(!(cuma->curve[a].flag & flag)) {
+	for (a=1, b=1; a<cuma->totpoint-1; a++) {
+		if (!(cuma->curve[a].flag & flag)) {
 			cmp[b]= cuma->curve[a];
 			b++;
 		}
@@ -175,8 +175,8 @@ void curvemap_insert(CurveMap *cuma, float x, float y)
 		
 	/* insert fragments of the old one and the new point to the new curve */
 	cuma->totpoint++;
-	for(a=0, b=0; a<cuma->totpoint; a++) {
-		if((x < cuma->curve[a].x) && !foundloc) {
+	for (a=0, b=0; a<cuma->totpoint; a++) {
+		if ((x < cuma->curve[a].x) && !foundloc) {
 			cmp[a].x= x;
 			cmp[a].y= y;
 			cmp[a].flag= CUMA_SELECT;
@@ -199,7 +199,7 @@ void curvemap_insert(CurveMap *cuma, float x, float y)
 
 void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset, int slope)
 {
-	if(cuma->curve)
+	if (cuma->curve)
 		MEM_freeN(cuma->curve);
 
 	switch(preset) {
@@ -295,7 +295,7 @@ void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset, int slope)
 		cuma->curve = newpoints;
 	}
 	
-	if(cuma->table) {
+	if (cuma->table) {
 		MEM_freeN(cuma->table);
 		cuma->table= NULL;
 	}
@@ -306,9 +306,9 @@ void curvemap_sethandle(CurveMap *cuma, int type)
 {
 	int a;
 	
-	for(a=0; a<cuma->totpoint; a++) {
-		if(cuma->curve[a].flag & CUMA_SELECT) {
-			if(type) cuma->curve[a].flag |= CUMA_VECTOR;
+	for (a=0; a<cuma->totpoint; a++) {
+		if (cuma->curve[a].flag & CUMA_SELECT) {
+			if (type) cuma->curve[a].flag |= CUMA_VECTOR;
 			else cuma->curve[a].flag &= ~CUMA_VECTOR;
 		}
 	}
@@ -323,13 +323,13 @@ static void calchandle_curvemap(BezTriple *bezt, BezTriple *prev, BezTriple *nex
 	float len,len_a, len_b;
 	float dvec_a[2], dvec_b[2];
 
-	if(bezt->h1==0 && bezt->h2==0) {
+	if (bezt->h1==0 && bezt->h2==0) {
 		return;
 	}
 	
 	p2= bezt->vec[1];
 	
-	if(prev==NULL) {
+	if (prev==NULL) {
 		p3= next->vec[1];
 		pt[0]= 2.0f*p2[0] - p3[0];
 		pt[1]= 2.0f*p2[1] - p3[1];
@@ -339,7 +339,7 @@ static void calchandle_curvemap(BezTriple *bezt, BezTriple *prev, BezTriple *nex
 		p1= prev->vec[1];
 	}
 	
-	if(next==NULL) {
+	if (next==NULL) {
 		p1= prev->vec[1];
 		pt[0]= 2.0f*p2[0] - p1[0];
 		pt[1]= 2.0f*p2[1] - p1[1];
@@ -355,59 +355,59 @@ static void calchandle_curvemap(BezTriple *bezt, BezTriple *prev, BezTriple *nex
 	len_a= len_v2(dvec_a);
 	len_b= len_v2(dvec_b);
 
-	if(len_a==0.0f) len_a=1.0f;
-	if(len_b==0.0f) len_b=1.0f;
+	if (len_a==0.0f) len_a=1.0f;
+	if (len_b==0.0f) len_b=1.0f;
 
-	if(bezt->h1==HD_AUTO || bezt->h2==HD_AUTO) { /* auto */
+	if (bezt->h1==HD_AUTO || bezt->h2==HD_AUTO) { /* auto */
 		float tvec[2];
 		tvec[0]= dvec_b[0]/len_b + dvec_a[0]/len_a;
 		tvec[1]= dvec_b[1]/len_b + dvec_a[1]/len_a;
 
 		len= len_v2(tvec) * 2.5614f;
-		if(len!=0.0f) {
+		if (len!=0.0f) {
 			
-			if(bezt->h1==HD_AUTO) {
+			if (bezt->h1==HD_AUTO) {
 				len_a/=len;
 				madd_v2_v2v2fl(p2-3, p2, tvec, -len_a);
 			}
-			if(bezt->h2==HD_AUTO) {
+			if (bezt->h2==HD_AUTO) {
 				len_b/=len;
 				madd_v2_v2v2fl(p2+3, p2, tvec,  len_b);
 			}
 		}
 	}
 
-	if(bezt->h1==HD_VECT) {	/* vector */
+	if (bezt->h1==HD_VECT) {	/* vector */
 		madd_v2_v2v2fl(p2-3, p2, dvec_a, -1.0f/3.0f);
 	}
-	if(bezt->h2==HD_VECT) {
+	if (bezt->h2==HD_VECT) {
 		madd_v2_v2v2fl(p2+3, p2, dvec_b,  1.0f/3.0f);
 	}
 }
 
 /* in X, out Y. 
-   X is presumed to be outside first or last */
+ * X is presumed to be outside first or last */
 static float curvemap_calc_extend(CurveMap *cuma, float x, const float first[2], const float last[2])
 {
-	if(x <= first[0]) {
-		if((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0) {
+	if (x <= first[0]) {
+		if ((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0) {
 			/* no extrapolate */
 			return first[1];
 		}
 		else {
-			if(cuma->ext_in[0]==0.0f)
+			if (cuma->ext_in[0]==0.0f)
 				return first[1] + cuma->ext_in[1]*10000.0f;
 			else
 				return first[1] + cuma->ext_in[1]*(x - first[0])/cuma->ext_in[0];
 		}
 	}
-	else if(x >= last[0]) {
-		if((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0) {
+	else if (x >= last[0]) {
+		if ((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0) {
 			/* no extrapolate */
 			return last[1];
 		}
 		else {
-			if(cuma->ext_out[0]==0.0f)
+			if (cuma->ext_out[0]==0.0f)
 				return last[1] - cuma->ext_out[1]*10000.0f;
 			else
 				return last[1] + cuma->ext_out[1]*(x - last[0])/cuma->ext_out[0];
@@ -424,7 +424,7 @@ static void curvemap_make_table(CurveMap *cuma, rctf *clipr)
 	float *fp, *allpoints, *lastpoint, curf, range;
 	int a, totpoint;
 	
-	if(cuma->curve==NULL) return;
+	if (cuma->curve==NULL) return;
 	
 	/* default rect also is table range */
 	cuma->mintable= clipr->xmin;
@@ -433,59 +433,59 @@ static void curvemap_make_table(CurveMap *cuma, rctf *clipr)
 	/* hrmf... we now rely on blender ipo beziers, these are more advanced */
 	bezt= MEM_callocN(cuma->totpoint*sizeof(BezTriple), "beztarr");
 	
-	for(a=0; a<cuma->totpoint; a++) {
+	for (a=0; a<cuma->totpoint; a++) {
 		cuma->mintable= MIN2(cuma->mintable, cmp[a].x);
 		cuma->maxtable= MAX2(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)
+		if (cmp[a].flag & CUMA_VECTOR)
 			bezt[a].h1= bezt[a].h2= HD_VECT;
 		else
 			bezt[a].h1= bezt[a].h2= HD_AUTO;
 	}
 	
-	for(a=0; a<cuma->totpoint; a++) {
-		if(a==0)
+	for (a=0; a<cuma->totpoint; a++) {
+		if (a==0)
 			calchandle_curvemap(bezt, NULL, bezt+1, 0);
-		else if(a==cuma->totpoint-1)
+		else if (a==cuma->totpoint-1)
 			calchandle_curvemap(bezt+a, bezt+a-1, NULL, 0);
 		else
 			calchandle_curvemap(bezt+a, bezt+a-1, bezt+a+1, 0);
 	}
 	
 	/* first and last handle need correction, instead of pointing to center of next/prev, 
-		we let it point to the closest handle */
-	if(cuma->totpoint>2) {
+	 * we let it point to the closest handle */
+	if (cuma->totpoint>2) {
 		float hlen, nlen, vec[3];
 		
-		if(bezt[0].h2==HD_AUTO) {
+		if (bezt[0].h2==HD_AUTO) {
 			
 			hlen= len_v3v3(bezt[0].vec[1], bezt[0].vec[2]);	/* original handle length */
 			/* clip handle point */
 			copy_v3_v3(vec, bezt[1].vec[0]);
-			if(vec[0] < bezt[0].vec[1][0])
+			if (vec[0] < bezt[0].vec[1][0])
 				vec[0]= bezt[0].vec[1][0];
 			
 			sub_v3_v3(vec, bezt[0].vec[1]);
 			nlen= len_v3(vec);
-			if(nlen>FLT_EPSILON) {
+			if (nlen>FLT_EPSILON) {
 				mul_v3_fl(vec, hlen/nlen);
 				add_v3_v3v3(bezt[0].vec[2], vec, bezt[0].vec[1]);
 				sub_v3_v3v3(bezt[0].vec[0], bezt[0].vec[1], vec);
 			}
 		}
 		a= cuma->totpoint-1;
-		if(bezt[a].h2==HD_AUTO) {
+		if (bezt[a].h2==HD_AUTO) {
 			
 			hlen= len_v3v3(bezt[a].vec[1], bezt[a].vec[0]);	/* original handle length */
 			/* clip handle point */
 			copy_v3_v3(vec, bezt[a-1].vec[2]);
-			if(vec[0] > bezt[a].vec[1][0])
+			if (vec[0] > bezt[a].vec[1][0])
 				vec[0]= bezt[a].vec[1][0];
 			
 			sub_v3_v3(vec, bezt[a].vec[1]);
 			nlen= len_v3(vec);
-			if(nlen>FLT_EPSILON) {
+			if (nlen>FLT_EPSILON) {
 				mul_v3_fl(vec, hlen/nlen);
 				add_v3_v3v3(bezt[a].vec[0], vec, bezt[a].vec[1]);
 				sub_v3_v3v3(bezt[a].vec[2], bezt[a].vec[1], vec);
@@ -493,12 +493,12 @@ static void curvemap_make_table(CurveMap *cuma, rctf *clipr)
 		}
 	}	
 	/* make the bezier curve */
-	if(cuma->table)
+	if (cuma->table)
 		MEM_freeN(cuma->table);
 	totpoint= (cuma->totpoint-1)*CM_RESOL;
 	fp= allpoints= MEM_callocN(totpoint*2*sizeof(float), "table");
 	
-	for(a=0; a<cuma->totpoint-1; a++, fp += 2*CM_RESOL) {
+	for (a=0; a<cuma->totpoint-1; a++, fp += 2*CM_RESOL) {
 		correct_bezpart(bezt[a].vec[1], bezt[a].vec[2], bezt[a+1].vec[0], bezt[a+1].vec[1]);
 		forward_diff_bezier(bezt[a].vec[1][0], bezt[a].vec[2][0], bezt[a+1].vec[0][0], bezt[a+1].vec[1][0], fp, CM_RESOL-1, 2*sizeof(float));	
 		forward_diff_bezier(bezt[a].vec[1][1], bezt[a].vec[2][1], bezt[a+1].vec[0][1], bezt[a+1].vec[1][1], fp+1, CM_RESOL-1, 2*sizeof(float));
@@ -529,20 +529,20 @@ static void curvemap_make_table(CurveMap *cuma, rctf *clipr)
 	lastpoint= allpoints + 2*(totpoint-1);
 	cmp= MEM_callocN((CM_TABLE+1)*sizeof(CurveMapPoint), "dist table");
 	
-	for(a=0; a<=CM_TABLE; a++) {
+	for (a=0; a<=CM_TABLE; a++) {
 		curf= cuma->mintable + range*(float)a;
 		cmp[a].x= curf;
 		
 		/* get the first x coordinate larger than curf */
-		while(curf >= fp[0] && fp!=lastpoint) {
+		while (curf >= fp[0] && fp!=lastpoint) {
 			fp+=2;
 		}
-		if(fp==allpoints || (curf >= fp[0] && fp==lastpoint))
+		if (fp==allpoints || (curf >= fp[0] && fp==lastpoint))
 			cmp[a].y= curvemap_calc_extend(cuma, curf, allpoints, lastpoint);
 		else {
 			float fac1= fp[0] - fp[-2];
 			float fac2= fp[0] - curf;
-			if(fac1 > FLT_EPSILON)
+			if (fac1 > FLT_EPSILON)
 				fac1= fac2/fac1;
 			else
 				fac1= 0.0f;
@@ -560,9 +560,9 @@ void curvemapping_premultiply(CurveMapping *cumap, int restore)
 {
 	int a;
 	
-	if(restore) {
-		if(cumap->flag & CUMA_PREMULLED) {
-			for(a=0; a<3; a++) {
+	if (restore) {
+		if (cumap->flag & CUMA_PREMULLED) {
+			for (a=0; a<3; a++) {
 				MEM_freeN(cumap->cm[a].table);
 				cumap->cm[a].table= cumap->cm[a].premultable;
 				cumap->cm[a].premultable= NULL;
@@ -572,23 +572,23 @@ void curvemapping_premultiply(CurveMapping *cumap, int restore)
 		}
 	}
 	else {
-		if((cumap->flag & CUMA_PREMULLED)==0) {
+		if ((cumap->flag & CUMA_PREMULLED)==0) {
 			/* verify and copy */
-			for(a=0; a<3; a++) {
-				if(cumap->cm[a].table==NULL)
+			for (a=0; a<3; a++) {
+				if (cumap->cm[a].table==NULL)
 					curvemap_make_table(cumap->cm+a, &cumap->clipr);
 				cumap->cm[a].premultable= cumap->cm[a].table;
 				cumap->cm[a].table= MEM_mallocN((CM_TABLE+1)*sizeof(CurveMapPoint), "premul table");
 				memcpy(cumap->cm[a].table, cumap->cm[a].premultable, (CM_TABLE+1)*sizeof(CurveMapPoint));
 			}
 			
-			if(cumap->cm[3].table==NULL)
+			if (cumap->cm[3].table==NULL)
 				curvemap_make_table(cumap->cm+3, &cumap->clipr);
 		
 			/* premul */
-			for(a=0; a<3; a++) {
+			for (a=0; a<3; a++) {
 				int b;
-				for(b=0; b<=CM_TABLE; b++) {
+				for (b=0; b<=CM_TABLE; b++) {
 					cumap->cm[a].table[b].y= curvemap_evaluateF(cumap->cm+3, cumap->cm[a].table[b].y);
 				}
 			}
@@ -602,8 +602,8 @@ static int sort_curvepoints(const void *a1, const void *a2)
 {
 	const struct CurveMapPoint *x1=a1, *x2=a2;
 	
-	if( x1->x > x2->x ) return 1;
-	else if( x1->x < x2->x) return -1;
+	if ( x1->x > x2->x ) return 1;
+	else if ( x1->x < x2->x) return -1;
 	return 0;
 }
 
@@ -622,21 +622,21 @@ void curvemapping_changed(CurveMapping *cumap, int rem_doubles)
 	cumap->changed_timestamp++;
 
 	/* clamp with clip */
-	if(cumap->flag & CUMA_DO_CLIP) {
-		for(a=0; a<cuma->totpoint; a++) {
-			if(cmp[a].flag & CUMA_SELECT) {
-				if(cmp[a].x < clipr->xmin)
+	if (cumap->flag & CUMA_DO_CLIP) {
+		for (a=0; a<cuma->totpoint; a++) {
+			if (cmp[a].flag & CUMA_SELECT) {
+				if (cmp[a].x < clipr->xmin)
 					dx= MIN2(dx, cmp[a].x - clipr->xmin);
-				else if(cmp[a].x > clipr->xmax)
+				else if (cmp[a].x > clipr->xmax)
 					dx= MAX2(dx, cmp[a].x - clipr->xmax);
-				if(cmp[a].y < clipr->ymin)
+				if (cmp[a].y < clipr->ymin)
 					dy= MIN2(dy, cmp[a].y - clipr->ymin);
-				else if(cmp[a].y > clipr->ymax)
+				else if (cmp[a].y > clipr->ymax)
 					dy= MAX2(dy, cmp[a].y - clipr->ymax);
 			}
 		}
-		for(a=0; a<cuma->totpoint; a++) {
-			if(cmp[a].flag & CUMA_SELECT) {
+		for (a=0; a<cuma->totpoint; a++) {
+			if (cmp[a].flag & CUMA_SELECT) {
 				cmp[a].x -= dx;
 				cmp[a].y -= dy;
 			}
@@ -647,25 +647,25 @@ void curvemapping_changed(CurveMapping *cumap, int rem_doubles)
 	qsort(cmp, cuma->totpoint, sizeof(CurveMapPoint), sort_curvepoints);
 	
 	/* remove doubles, threshold set on 1% of default range */
-	if(rem_doubles && cuma->totpoint>2) {
-		for(a=0; a<cuma->totpoint-1; a++) {
+	if (rem_doubles && cuma->totpoint>2) {
+		for (a=0; a<cuma->totpoint-1; a++) {
 			dx= cmp[a].x - cmp[a+1].x;
 			dy= cmp[a].y - cmp[a+1].y;
-			if( sqrtf(dx*dx + dy*dy) < thresh ) {
-				if(a==0) {
+			if ( sqrtf(dx*dx + dy*dy) < thresh ) {
+				if (a==0) {
 					cmp[a+1].flag|= 2;
-					if(cmp[a+1].flag & CUMA_SELECT)
+					if (cmp[a+1].flag & CUMA_SELECT)
 						cmp[a].flag |= CUMA_SELECT;
 				}
 				else {
 					cmp[a].flag|= 2;
-					if(cmp[a].flag & CUMA_SELECT)
+					if (cmp[a].flag & CUMA_SELECT)
 						cmp[a+1].flag |= CUMA_SELECT;
 				}
 				break;	/* we assume 1 deletion per edit is ok */
 			}
 		}
-		if(a != cuma->totpoint-1)
+		if (a != cuma->totpoint-1)
 			curvemap_remove(cuma, 2);
 	}	
 	curvemap_make_table(cuma, clipr);
@@ -682,11 +682,11 @@ float curvemap_evaluateF(CurveMap *cuma, float value)
 	i= (int)fi;
 	
 	/* fi is table float index and should check against table range i.e. [0.0 CM_TABLE] */
-	if(fi<0.0f || fi>CM_TABLE)
+	if (fi<0.0f || fi>CM_TABLE)
 		return curvemap_calc_extend(cuma, value, &cuma->table[0].x, &cuma->table[CM_TABLE].x);
 	else {
-		if(i<0) return cuma->table[0].y;
-		if(i>=CM_TABLE) return cuma->table[CM_TABLE].y;
+		if (i<0) return cuma->table[0].y;
+		if (i>=CM_TABLE) return cuma->table[CM_TABLE].y;
 		
 		fi= fi-(float)i;
 		return (1.0f-fi)*cuma->table[i].y + (fi)*cuma->table[i+1].y; 
@@ -699,9 +699,9 @@ float curvemapping_evaluateF(CurveMapping *cumap, int cur, float value)
 	CurveMap *cuma= cumap->cm+cur;
 	
 	/* allocate or bail out */
-	if(cuma->table==NULL) {
+	if (cuma->table==NULL) {
 		curvemap_make_table(cuma, &cumap->clipr);
-		if(cuma->table==NULL)
+		if (cuma->table==NULL)
 			return 1.0f-value;
 	}
 	return curvemap_evaluateF(cuma, value);
@@ -750,11 +750,11 @@ void curvemapping_do_ibuf(CurveMapping *cumap, ImBuf *ibuf)
 	int stride= 4;
 	float *pix_out;
 	
-	if(ibuf==NULL)
+	if (ibuf==NULL)
 		return;
-	if(ibuf->rect_float==NULL)
+	if (ibuf->rect_float==NULL)
 		IMB_float_from_rect(ibuf);
-	else if(ibuf->rect==NULL)
+	else if (ibuf->rect==NULL)
 		imb_addrectImBuf(ibuf);
 	
 	if (!ibuf->rect || !ibuf->rect_float)
@@ -769,11 +769,11 @@ void curvemapping_do_ibuf(CurveMapping *cumap, ImBuf *ibuf)
 	pix_in= ibuf->rect_float;
 	pix_out= tmpbuf->rect_float;
 
-	if(ibuf->channels)
+	if (ibuf->channels)
 		stride= ibuf->channels;
 	
-	for(pixel= ibuf->x*ibuf->y; pixel>0; pixel--, pix_in+=stride, pix_out+=stride) {
-		if(stride<3) {
+	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];
@@ -783,7 +783,7 @@ void curvemapping_do_ibuf(CurveMapping *cumap, ImBuf *ibuf)
 			pix_out[0]= col[0];
 			pix_out[1]= col[1];
 			pix_out[2]= col[2];
-			if(stride>3)
+			if (stride>3)
 				pix_out[3]= pix_in[3];
 			else
 				pix_out[3]= 1.f;
@@ -801,21 +801,21 @@ int curvemapping_RGBA_does_something(CurveMapping *cumap)
 {
 	int a;
 	
-	if(cumap->black[0]!=0.0f) return 1;
-	if(cumap->black[1]!=0.0f) return 1;
-	if(cumap->black[2]!=0.0f) return 1;
-	if(cumap->white[0]!=1.0f) return 1;
-	if(cumap->white[1]!=1.0f) return 1;
-	if(cumap->white[2]!=1.0f) return 1;
+	if (cumap->black[0]!=0.0f) return 1;
+	if (cumap->black[1]!=0.0f) return 1;
+	if (cumap->black[2]!=0.0f) return 1;
+	if (cumap->white[0]!=1.0f) return 1;
+	if (cumap->white[1]!=1.0f) return 1;
+	if (cumap->white[2]!=1.0f) return 1;
 	
-	for(a=0; a<CM_TOT; a++) {
-		if(cumap->cm[a].curve) {
-			if(cumap->cm[a].totpoint!=2)  return 1;
+	for (a=0; a<CM_TOT; a++) {
+		if (cumap->cm[a].curve) {
+			if (cumap->cm[a].totpoint!=2)  return 1;
 			
-			if(cumap->cm[a].curve[0].x != 0.0f) return 1;
-			if(cumap->cm[a].curve[0].y != 0.0f) return 1;
-			if(cumap->cm[a].curve[1].x != 1.0f) return 1;
-			if(cumap->cm[a].curve[1].y != 1.0f) return 1;
+			if (cumap->cm[a].curve[0].x != 0.0f) return 1;
+			if (cumap->cm[a].curve[0].y != 0.0f) return 1;
+			if (cumap->cm[a].curve[1].x != 1.0f) return 1;
+			if (cumap->cm[a].curve[1].y != 1.0f) return 1;
 		}
 	}
 	return 0;
@@ -825,10 +825,10 @@ void curvemapping_initialize(CurveMapping *cumap)
 {
 	int a;
 	
-	if(cumap==NULL) return;
+	if (cumap==NULL) return;
 	
-	for(a=0; a<CM_TOT; a++) {
-		if(cumap->cm[a].table==NULL)
+	for (a=0; a<CM_TOT; a++) {
+		if (cumap->cm[a].table==NULL)
 			curvemap_make_table(cumap->cm+a, &cumap->clipr);
 	}
 }
@@ -841,14 +841,14 @@ void curvemapping_table_RGBA(CurveMapping *cumap, float **array, int *size)
 	*array = MEM_callocN(sizeof(float)*(*size)*4, "CurveMapping");
 	curvemapping_initialize(cumap);
 
-	for(a=0; a<*size; a++) {
-		if(cumap->cm[0].table)
+	for (a=0; a<*size; a++) {
+		if (cumap->cm[0].table)
 			(*array)[a*4+0]= cumap->cm[0].table[a].y;
-		if(cumap->cm[1].table)
+		if (cumap->cm[1].table)
 			(*array)[a*4+1]= cumap->cm[1].table[a].y;
-		if(cumap->cm[2].table)
+		if (cumap->cm[2].table)
 			(*array)[a*4+2]= cumap->cm[2].table[a].y;
-		if(cumap->cm[3].table)
+		if (cumap->cm[3].table)
 			(*array)[a*4+3]= cumap->cm[3].table[a].y;
 	}
 }
@@ -867,7 +867,7 @@ DO_INLINE int get_bin_float(float f)
 	return bin;
 }
 
-DO_INLINE void save_sample_line(Scopes *scopes, const int idx, const float fx, float *rgb, float *ycc)
+DO_INLINE void save_sample_line(Scopes *scopes, const int idx, const float fx, const float rgb[3], const float ycc[3])
 {
 	float yuv[3];
 
@@ -986,8 +986,11 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, int use_color_management)
 
 	for (y = 0; y < ibuf->y; y++) {
 		if (savedlines<scopes->sample_lines && y>=((savedlines)*ibuf->y)/(scopes->sample_lines+1)) {
-			saveline=1;
-		} else saveline=0;
+			saveline = 1;
+		}
+		else {
+			saveline = 0;
+		}
 		for (x = 0; x < ibuf->x; x++) {
 
 			if (is_float) {
@@ -1005,7 +1008,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, int use_color_management)
 			luma = rgb_to_luma(rgb);
 
 			/* check for min max */
-			if(ycc_mode == -1 ) {
+			if (ycc_mode == -1 ) {
 				for (c=0; c<3; c++) {
 					if (rgb[c] < scopes->minmax[c][0]) scopes->minmax[c][0] = rgb[c];
 					if (rgb[c] > scopes->minmax[c][1]) scopes->minmax[c][1] = rgb[c];
@@ -1026,7 +1029,7 @@ void scopes_update(Scopes *scopes, ImBuf *ibuf, int use_color_management)
 			bin_lum[ get_bin_float(luma) ] += 1;
 
 			/* save sample if needed */
-			if(saveline) {
+			if (saveline) {
 				const float fx = (float)x / (float)ibuf->x;
 				const int idx = 2*(ibuf->x*savedlines+x);
 				save_sample_line(scopes, idx, fx, rgb, ycc);
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index ad89a9c..0a6e8a1 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -40,7 +40,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
-#include "BLI_editVert.h"
 #include "BLI_kdopbvh.h"
 #include "BLI_utildefines.h"
 
@@ -77,8 +76,12 @@
 #include "BKE_global.h"
 #include "BKE_library.h"
 #include "BKE_idprop.h"
+#include "BKE_mesh.h"
 #include "BKE_shrinkwrap.h"
 #include "BKE_mesh.h"
+#include "BKE_tessmesh.h"
+#include "BKE_tracking.h"
+#include "BKE_movieclip.h"
 #include "BKE_tracking.h"
 #include "BKE_movieclip.h"
 
@@ -220,6 +223,7 @@ 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) {
@@ -262,7 +266,7 @@ static void constraint_pchan_diff_mat(bPoseChannel *pchan, float diff_mat[4][4])
 		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.
@@ -270,13 +274,12 @@ static void constraint_pchan_diff_mat(bPoseChannel *pchan, float diff_mat[4][4])
  */
 void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4], short from, short to)
 {
-	float tempmat[4][4];
 	float diff_mat[4][4];
 	float imat[4][4];
 	
 	/* prevent crashes in these unlikely events  */
 	if (ob==NULL || mat==NULL) return;
-	/* optimise trick - check if need to do anything */
+	/* optimize trick - check if need to do anything */
 	if (from == to) return;
 	
 	/* are we dealing with pose-channels or objects */
@@ -287,8 +290,7 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4
 			{
 				/* world to pose */
 				invert_m4_m4(imat, ob->obmat);
-				copy_m4_m4(tempmat, mat);
-				mult_m4_m4m4(mat, imat, tempmat);
+				mult_m4_m4m4(mat, imat, mat);
 				
 				/* use pose-space as stepping stone for other spaces... */
 				if (ELEM(to, CONSTRAINT_SPACE_LOCAL, CONSTRAINT_SPACE_PARLOCAL)) {
@@ -301,32 +303,31 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4
 			{
 				/* pose to world */
 				if (to == CONSTRAINT_SPACE_WORLD) {
-					copy_m4_m4(tempmat, mat);
-					mult_m4_m4m4(mat, ob->obmat, tempmat);
+					mult_m4_m4m4(mat, ob->obmat, mat);
 				}
 				/* pose to local */
 				else if (to == CONSTRAINT_SPACE_LOCAL) {
 					if (pchan->bone) {
+						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);
-
-						copy_m4_m4(tempmat, mat);
-						mult_m4_m4m4(mat, imat, tempmat);
+						mult_m4_m4m4(mat, imat, mat);
 
 						/* override with local location */
 						if ((pchan->parent) && (pchan->bone->flag & BONE_NO_LOCAL_LOCATION)) {
 							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 */
 				else if (to == CONSTRAINT_SPACE_PARLOCAL) {
 					if (pchan->bone) {
 						invert_m4_m4(imat, pchan->bone->arm_mat);
-						copy_m4_m4(tempmat, mat);
-						mult_m4_m4m4(mat, imat, tempmat);
+						mult_m4_m4m4(mat, imat, mat);
 					}
 				}
 			}
@@ -336,10 +337,12 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4
 				/* local to pose - do inverse procedure that was done for pose to local */
 				if (pchan->bone) {
 					/* we need the posespace_matrix = local_matrix + (parent_posespace_matrix + restpos) */
+					armature_mat_bone_to_pose(pchan, mat, mat);
+#if 0
 					constraint_pchan_diff_mat(pchan, diff_mat);
 
-					copy_m4_m4(tempmat, mat);
-					mult_m4_m4m4(mat, diff_mat, tempmat);
+					mult_m4_m4m4(mat, diff_mat, mat);
+#endif
 				}
 				
 				/* use pose-space as stepping stone for other spaces */
@@ -354,8 +357,7 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4
 				/* local + parent to pose */
 				if (pchan->bone) {					
 					copy_m4_m4(diff_mat, pchan->bone->arm_mat);
-					copy_m4_m4(tempmat, mat);
-					mult_m4_m4m4(mat, tempmat, diff_mat);
+					mult_m4_m4m4(mat, mat, diff_mat);
 				}
 				
 				/* use pose-space as stepping stone for other spaces */
@@ -375,8 +377,7 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4
 				/* 'subtract' parent's effects from owner */
 				mult_m4_m4m4(diff_mat, ob->parent->obmat, ob->parentinv);
 				invert_m4_m4(imat, diff_mat);
-				copy_m4_m4(tempmat, mat);
-				mult_m4_m4m4(mat, imat, tempmat);
+				mult_m4_m4m4(mat, imat, mat);
 			}
 			else {
 				/* Local space in this case will have to be defined as local to the owner's 
@@ -387,17 +388,15 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4
 				zero_v3(diff_mat[3]);
 				
 				invert_m4_m4(imat, diff_mat);
-				copy_m4_m4(tempmat, mat);
-				mult_m4_m4m4(mat, imat, tempmat);
+				mult_m4_m4m4(mat, imat, mat);
 			}
 		}
 		else if (from==CONSTRAINT_SPACE_LOCAL && to==CONSTRAINT_SPACE_WORLD) {
 			/* check that object has a parent - otherwise this won't work */
 			if (ob->parent) {
 				/* 'add' parent's effect back to owner */
-				copy_m4_m4(tempmat, mat);
 				mult_m4_m4m4(diff_mat, ob->parent->obmat, ob->parentinv);
-				mult_m4_m4m4(mat, diff_mat, tempmat);
+				mult_m4_m4m4(mat, diff_mat, mat);
 			}
 			else {
 				/* Local space in this case will have to be defined as local to the owner's 
@@ -407,8 +406,7 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4
 				normalize_m4(diff_mat);
 				zero_v3(diff_mat[3]);
 				
-				copy_m4_m4(tempmat, mat);
-				mult_m4_m4m4(mat, diff_mat, tempmat);
+				mult_m4_m4m4(mat, diff_mat, mat);
 			}
 		}
 	}
@@ -421,7 +419,7 @@ static void contarget_get_mesh_mat (Object *ob, const char *substring, float mat
 {
 	DerivedMesh *dm = NULL;
 	Mesh *me= ob->data;
-	EditMesh *em = BKE_mesh_get_editmesh(me);
+	BMEditMesh *em = me->edit_btmesh;
 	float vec[3] = {0.0f, 0.0f, 0.0f};
 	float normal[3] = {0.0f, 0.0f, 0.0f}, plane[3];
 	float imat[3][3], tmat[3][3];
@@ -437,7 +435,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_editmesh(em, ob->data);
+		dm = CDDM_from_BMEditMesh(em, ob->data, FALSE, FALSE);
 		freeDM= 1;
 	}
 	else {
@@ -492,7 +490,7 @@ static void contarget_get_mesh_mat (Object *ob, const char *substring, float mat
 			copy_v3_v3(plane, tmat[1]);
 			
 			cross_v3_v3v3(mat[0], normal, plane);
-			if(len_v3(mat[0]) < 1e-3f) {
+			if (len_v3(mat[0]) < 1e-3f) {
 				copy_v3_v3(plane, tmat[0]);
 				cross_v3_v3v3(mat[0], normal, plane);
 			}
@@ -511,8 +509,6 @@ static void contarget_get_mesh_mat (Object *ob, const char *substring, float mat
 	/* free temporary DerivedMesh created (in EditMode case) */
 	if (dm && freeDM)
 		dm->release(dm);
-	if (em)
-		BKE_mesh_end_editmesh(me, em);
 }
 
 /* function that sets the given matrix based on given vertex group in lattice */
@@ -580,7 +576,7 @@ static void constraint_target_to_mat4 (Object *ob, const char *substring, float
 	/* Current method just takes the average location of all the points in the
 	 * VertexGroup, and uses that as the location value of the targets. Where 
 	 * possible, the orientation will also be calculated, by calculating an
-	 * 'average' vertex normal, and deriving the rotaation from that.
+	 * 'average' vertex normal, and deriving the rotation from that.
 	 *
 	 * NOTE: EditMode is not currently supported, and will most likely remain that
 	 *		way as constraints can only really affect things on object/bone level.
@@ -675,7 +671,7 @@ static void default_get_tarmat (bConstraint *con, bConstraintOb *UNUSED(cob), bC
 }
 
 /* This following macro should be used for all standard single-target *_get_tars functions 
- * to save typing and reduce maintainance woes.
+ * to save typing and reduce maintenance woes.
  * (Hopefully all compilers will be happy with the lines with just a space on them. Those are
  *  really just to help this code easier to read)
  */
@@ -709,7 +705,7 @@ static void default_get_tarmat (bConstraint *con, bConstraintOb *UNUSED(cob), bC
 	}
 	
 /* This following macro should be used for all standard single-target *_get_tars functions 
- * to save typing and reduce maintainance woes. It does not do the subtarget related operations
+ * to save typing and reduce maintenance woes. It does not do the subtarget related operations
  * (Hopefully all compilers will be happy with the lines with just a space on them. Those are
  *  really just to help this code easier to read)
  */
@@ -728,7 +724,7 @@ static void default_get_tarmat (bConstraint *con, bConstraintOb *UNUSED(cob), bC
 	}
 
 /* This following macro should be used for all standard single-target *_flush_tars functions
- * to save typing and reduce maintainance woes.
+ * to save typing and reduce maintenance woes.
  * Note: the pointer to ct will be changed to point to the next in the list (as it gets removed)
  * (Hopefully all compilers will be happy with the lines with just a space on them. Those are
  *  really just to help this code easier to read)
@@ -749,7 +745,7 @@ static void default_get_tarmat (bConstraint *con, bConstraintOb *UNUSED(cob), bC
 	}
 	
 /* This following macro should be used for all standard single-target *_flush_tars functions
- * to save typing and reduce maintainance woes. It does not do the subtarget related operations.
+ * to save typing and reduce maintenance woes. It does not do the subtarget related operations.
  * Note: the pointer to ct will be changed to point to the next in the list (as it gets removed)
  * (Hopefully all compilers will be happy with the lines with just a space on them. Those are
  *  really just to help this code easier to read)
@@ -824,7 +820,7 @@ static void childof_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta
 		float parmat[4][4];
 		
 		/* simple matrix parenting */
-		if(data->flag == CHILDOF_ALL) {
+		if (data->flag == CHILDOF_ALL) {
 			
 			/* multiply target (parent matrix) by offset (parent inverse) to get 
 			 * the effect of the parent that will be exherted on the owner
@@ -1914,7 +1910,7 @@ static void samevolume_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
 
 	mat4_to_size(obsize, cob->matrix);
 	
-	/* calculate normalising scale factor for non-essential values */
+	/* calculate normalizing scale factor for non-essential values */
 	if (obsize[data->flag] != 0) 
 		fac = sqrtf(volume / obsize[data->flag]) / obsize[data->flag];
 	
@@ -2152,7 +2148,7 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint
 		float s, t;
 		short axis;
 		
-		/* initialise return matrix */
+		/* initialize return matrix */
 		unit_m4(ct->matrix);
 		
 		/* get the transform matrix of the target */
@@ -2186,8 +2182,8 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint
 		CLAMP(s, 0, 1);
 		t = (s * (data->end-data->start)) + data->start;
 		
-		if (G.f & G_DEBUG)
-			printf("do Action Constraint %s - Ob %s Pchan %s \n", con->name, cob->ob->id.name+2, (cob->pchan)?cob->pchan->name:NULL);
+		if (G.debug & G_DEBUG)
+			printf("do Action Constraint %s - Ob %s Pchan %s\n", con->name, cob->ob->id.name+2, (cob->pchan)?cob->pchan->name:NULL);
 		
 		/* Get the appropriate information from the action */
 		if (cob->type == CONSTRAINT_OBTYPE_BONE) {
@@ -2225,7 +2221,7 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint
 			object_to_mat4(&workob, ct->matrix);
 		}
 		else {
-			/* behaviour undefined... */
+			/* behavior undefined... */
 			puts("Error: unknown owner type for Action Constraint");
 		}
 	}
@@ -2321,7 +2317,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
 		
 		/* Vector object -> target */
 		sub_v3_v3v3(vec, ct->matrix[3], cob->matrix[3]);
-		switch (data->lockflag){
+		switch (data->lockflag) {
 		case LOCK_X: /* LOCK X */
 		{
 			switch (data->trackflag) {
@@ -2882,7 +2878,7 @@ static void minmax_new_data (void *cdata)
 	
 	data->minmaxflag = TRACK_Z;
 	data->offset = 0.0f;
-	data->cache[0] = data->cache[1] = data->cache[2] = 0.0f;
+	zero_v3(data->cache);
 	data->flag = 0;
 }
 
@@ -3192,25 +3188,15 @@ static void clampto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta
 					/* find bounding-box range where target is located */
 					if (ownLoc[clamp_axis] < curveMin[clamp_axis]) {
 						/* bounding-box range is before */
-						offset= curveMin[clamp_axis];
-						
-						while (ownLoc[clamp_axis] < offset)
-							offset -= len;
-						
+						offset = curveMin[clamp_axis] - ceil((curveMin[clamp_axis] - ownLoc[clamp_axis]) / len) * len;
+
 						/* now, we calculate as per normal, except using offset instead of curveMin[clamp_axis] */
 						curvetime = (ownLoc[clamp_axis] - offset) / (len);
 					}
 					else if (ownLoc[clamp_axis] > curveMax[clamp_axis]) {
 						/* bounding-box range is after */
-						offset= curveMax[clamp_axis];
-						
-						while (ownLoc[clamp_axis] > offset) {
-							if ((offset + len) > ownLoc[clamp_axis])
-								break;
-							else
-								offset += len;
-						}
-						
+						offset= curveMax[clamp_axis] + (int)((ownLoc[clamp_axis] - curveMax[clamp_axis]) / len) * len;
+
 						/* now, we calculate as per normal, except using offset instead of curveMax[clamp_axis] */
 						curvetime = (ownLoc[clamp_axis] - offset) / (len);
 					}
@@ -3453,7 +3439,7 @@ static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
 {
 	bShrinkwrapConstraint *scon = (bShrinkwrapConstraint *) con->data;
 	
-	if( VALID_CONS_TARGET(ct) && (ct->tar->type == OB_MESH) )
+	if ( VALID_CONS_TARGET(ct) && (ct->tar->type == OB_MESH) )
 	{
 		int fail = FALSE;
 		float co[3] = {0.0f, 0.0f, 0.0f};
@@ -3475,7 +3461,7 @@ static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
 		
 		unit_m4(ct->matrix);
 		
-		if(target != NULL)
+		if (target != NULL)
 		{
 			space_transform_from_matrixs(&transform, cob->matrix, ct->tar->obmat);
 			
@@ -3484,12 +3470,12 @@ static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
 				case MOD_SHRINKWRAP_NEAREST_SURFACE:
 				case MOD_SHRINKWRAP_NEAREST_VERTEX:
 					
-					if(scon->shrinkType == MOD_SHRINKWRAP_NEAREST_VERTEX)
+					if (scon->shrinkType == MOD_SHRINKWRAP_NEAREST_VERTEX)
 						bvhtree_from_mesh_verts(&treeData, target, 0.0, 2, 6);
 					else
 						bvhtree_from_mesh_faces(&treeData, target, 0.0, 2, 6);
 					
-					if(treeData.tree == NULL)
+					if (treeData.tree == NULL)
 					{
 						fail = TRUE;
 						break;
@@ -3500,19 +3486,18 @@ static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
 					BLI_bvhtree_find_nearest(treeData.tree, co, &nearest, treeData.nearest_callback, &treeData);
 					
 					dist = len_v3v3(co, nearest.co);
-					if(dist != 0.0f) {
+					if (dist != 0.0f) {
 						interp_v3_v3v3(co, co, nearest.co, (dist - scon->dist)/dist);	/* linear interpolation */
 					}
 					space_transform_invert(&transform, co);
 				break;
 				
 				case MOD_SHRINKWRAP_PROJECT:
-					if(scon->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS) no[0] = 1.0f;
-					if(scon->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS) no[1] = 1.0f;
-					if(scon->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS) no[2] = 1.0f;
+					if (scon->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS) no[0] = 1.0f;
+					if (scon->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS) no[1] = 1.0f;
+					if (scon->projAxis & MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS) no[2] = 1.0f;
 					
-					if(INPR(no,no) < FLT_EPSILON)
-					{
+					if (dot_v3v3(no, no) < FLT_EPSILON) {
 						fail = TRUE;
 						break;
 					}
@@ -3521,13 +3506,13 @@ static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
 					
 					
 					bvhtree_from_mesh_faces(&treeData, target, scon->dist, 4, 6);
-					if(treeData.tree == NULL)
+					if (treeData.tree == NULL)
 					{
 						fail = TRUE;
 						break;
 					}
 					
-					if(normal_projection_project_vertex(0, co, no, &transform, treeData.tree, &hit, treeData.raycast_callback, &treeData) == FALSE)
+					if (normal_projection_project_vertex(0, co, no, &transform, treeData.tree, &hit, treeData.raycast_callback, &treeData) == FALSE)
 					{
 						fail = TRUE;
 						break;
@@ -3540,10 +3525,9 @@ static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
 			
 			target->release(target);
 			
-			if(fail == TRUE)
-			{
+			if (fail == TRUE) {
 				/* Don't move the point */
-				co[0] = co[1] = co[2] = 0.0f;
+				zero_v3(co);
 			}
 			
 			/* co is in local object coordinates, change it to global and update target position */
@@ -3641,7 +3625,7 @@ static void damptrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
 		
 		/* find the (unit) direction that the axis we're interested in currently points 
 		 *	- mul_mat3_m4_v3() only takes the 3x3 (rotation+scaling) components of the 4x4 matrix 
-		 *	- the normalisation step at the end should take care of any unwanted scaling
+		 *	- the normalization step at the end should take care of any unwanted scaling
 		 *	  left over in the 3x3 matrix we used
 		 */
 		copy_v3_v3(obvec, track_dir_vecs[data->trackflag]);
@@ -3898,7 +3882,7 @@ static void pivotcon_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *t
 
 	/* correct the pivot by the rotation axis otherwise the pivot translates when it shouldnt */
 	mat3_to_axis_angle(axis, &angle, rotMat);
-	if(angle) {
+	if (angle) {
 		float dvec[3];
 		sub_v3_v3v3(vec, pivot, cob->matrix[3]);
 		project_v3_v3v3(dvec, vec, axis);
@@ -3924,7 +3908,7 @@ static bConstraintTypeInfo CTI_PIVOT = {
 	NULL, /* relink data */
 	pivotcon_id_looper, /* id looper */
 	NULL, /* copy data */
-	NULL, /* new data */ // XXX: might be needed to get 'normal' pivot behaviour...
+	NULL, /* new data */ // XXX: might be needed to get 'normal' pivot behavior...
 	pivotcon_get_tars, /* get constraint targets */
 	pivotcon_flush_tars, /* flush constraint targets */
 	default_get_tarmat, /* get target matrix */
@@ -3933,28 +3917,28 @@ static bConstraintTypeInfo CTI_PIVOT = {
 
 /* ----------- Follow Track ------------- */
 
-static void followtrack_new_data (void *cdata)
+static void followtrack_new_data(void *cdata)
 {
-	bFollowTrackConstraint *data= (bFollowTrackConstraint *)cdata;
-	
-	data->clip= NULL;
+	bFollowTrackConstraint *data = (bFollowTrackConstraint *)cdata;
+
+	data->clip = NULL;
 	data->flag |= FOLLOWTRACK_ACTIVECLIP;
 }
 
-static void followtrack_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
+static void followtrack_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
 {
-	bFollowTrackConstraint *data= con->data;
-	
+	bFollowTrackConstraint *data = con->data;
+
 	func(con, (ID**)&data->clip, userdata);
 	func(con, (ID**)&data->camera, userdata);
 	func(con, (ID**)&data->depth_ob, userdata);
 }
 
-static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets))
+static void followtrack_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets))
 {
-	Scene *scene= cob->scene;
-	bFollowTrackConstraint *data= con->data;
-	MovieClip *clip= data->clip;
+	Scene *scene = cob->scene;
+	bFollowTrackConstraint *data = con->data;
+	MovieClip *clip = data->clip;
 	MovieTracking *tracking;
 	MovieTrackingTrack *track;
 	MovieTrackingObject *tracking_object;
@@ -3966,17 +3950,17 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
 	if (!clip || !data->track[0] || !camob)
 		return;
 
-	tracking= &clip->tracking;
+	tracking = &clip->tracking;
 
-	if(data->object[0])
-		tracking_object= BKE_tracking_named_object(tracking, data->object);
+	if (data->object[0])
+		tracking_object = BKE_tracking_named_object(tracking, data->object);
 	else
-		tracking_object= BKE_tracking_get_camera_object(tracking);
+		tracking_object = BKE_tracking_get_camera_object(tracking);
 
-	if(!tracking_object)
+	if (!tracking_object)
 		return;
 
-	track= BKE_tracking_named_track(tracking, tracking_object, data->track);
+	track = BKE_tracking_named_track(tracking, tracking_object, data->track);
 
 	if (!track)
 		return;
@@ -3987,7 +3971,7 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
 
 			copy_m4_m4(obmat, cob->matrix);
 
-			if((tracking_object->flag&TRACKING_OBJECT_CAMERA)==0) {
+			if ((tracking_object->flag & TRACKING_OBJECT_CAMERA)==0) {
 				float imat[4][4];
 
 				copy_m4_m4(mat, camob->obmat);
@@ -4009,15 +3993,15 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
 	else {
 		MovieTrackingMarker *marker;
 		float vec[3], disp[3], axis[3], mat[4][4];
-		float aspect= (scene->r.xsch*scene->r.xasp) / (scene->r.ysch*scene->r.yasp);
+		float aspect= (scene->r.xsch * scene->r.xasp) / (scene->r.ysch * scene->r.yasp);
 		float len, d;
 
 		where_is_object_mat(scene, camob, mat);
 
 		/* camera axis */
-		vec[0]= 0.0f;
-		vec[1]= 0.0f;
-		vec[2]= 1.0f;
+		vec[0] = 0.0f;
+		vec[1] = 0.0f;
+		vec[2] = 1.0f;
 		mul_v3_m4v3(axis, mat, vec);
 
 		/* distance to projection plane */
@@ -4025,13 +4009,13 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
 		sub_v3_v3(vec, mat[3]);
 		project_v3_v3v3(disp, vec, axis);
 
-		len= len_v3(disp);
+		len = len_v3(disp);
 
 		if (len > FLT_EPSILON) {
 			CameraParams params;
 			float pos[2], rmat[4][4];
 
-			marker= BKE_tracking_get_marker(track, scene->r.cfra);
+			marker = BKE_tracking_get_marker(track, scene->r.cfra);
 
 			add_v2_v2v2(pos, marker->pos, track->offset);
 
@@ -4039,12 +4023,14 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
 			camera_params_from_object(&params, camob);
 
 			if (params.is_ortho) {
-				vec[0]= params.ortho_scale * (pos[0]-0.5f+params.shiftx);
-				vec[1]= params.ortho_scale * (pos[1]-0.5f+params.shifty);
-				vec[2]= -len;
+				vec[0] = params.ortho_scale * (pos[0] - 0.5f + params.shiftx);
+				vec[1] = params.ortho_scale * (pos[1] - 0.5f + params.shifty);
+				vec[2] = -len;
 
-				if (aspect > 1.0f) vec[1] /= aspect;
-				else vec[0] *= aspect;
+				if (aspect > 1.0f)
+					vec[1] /= aspect;
+				else
+					vec[0] *= aspect;
 
 				mul_v3_m4v3(disp, camob->obmat, vec);
 
@@ -4055,14 +4041,16 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
 				copy_v3_v3(cob->matrix[3], disp);
 			}
 			else {
-				d= (len*params.sensor_x) / (2.0f*params.lens);
+				d=  (len * params.sensor_x) / (2.0f * params.lens);
 
-				vec[0]= d*(2.0f*(pos[0]+params.shiftx)-1.0f);
-				vec[1]= d*(2.0f*(pos[1]+params.shifty)-1.0f);
-				vec[2]= -len;
+				vec[0] = d * (2.0f * (pos[0] + params.shiftx) - 1.0f);
+				vec[1] = d * (2.0f * (pos[1] + params.shifty) - 1.0f);
+				vec[2] = -len;
 
-				if (aspect > 1.0f) vec[1] /= aspect;
-				else vec[0] *= aspect;
+				if (aspect > 1.0f)
+					vec[1] /= aspect;
+				else
+					vec[0] *= aspect;
 
 				mul_v3_m4v3(disp, camob->obmat, vec);
 
@@ -4074,9 +4062,9 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
 				copy_v3_v3(cob->matrix[3], disp);
 			}
 
-			if(data->depth_ob && data->depth_ob->derivedFinal) {
-				Object *depth_ob= data->depth_ob;
-				BVHTreeFromMesh treeData= NULL_BVHTreeFromMesh;
+			if (data->depth_ob && data->depth_ob->derivedFinal) {
+				Object *depth_ob = data->depth_ob;
+				BVHTreeFromMesh treeData = NULL_BVHTreeFromMesh;
 				BVHTreeRayHit hit;
 				float ray_start[3], ray_end[3], ray_nor[3], imat[4][4];
 				int result;
@@ -4090,12 +4078,12 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
 
 				bvhtree_from_mesh_faces(&treeData, depth_ob->derivedFinal, 0.0f, 4, 6);
 
-				hit.dist= FLT_MAX;
-				hit.index= -1;
+				hit.dist = FLT_MAX;
+				hit.index = -1;
 
-				result= BLI_bvhtree_ray_cast(treeData.tree, ray_start, ray_nor, 0.0f, &hit, treeData.raycast_callback, &treeData);
+				result = BLI_bvhtree_ray_cast(treeData.tree, ray_start, ray_nor, 0.0f, &hit, treeData.raycast_callback, &treeData);
 
-				if(result != -1) {
+				if (result != -1) {
 					mul_v3_m4v3(cob->matrix[3], depth_ob->obmat, hit.co);
 				}
 
@@ -4123,34 +4111,34 @@ static bConstraintTypeInfo CTI_FOLLOWTRACK = {
 
 /* ----------- Camre Solver ------------- */
 
-static void camerasolver_new_data (void *cdata)
+static void camerasolver_new_data(void *cdata)
 {
-	bCameraSolverConstraint *data= (bCameraSolverConstraint *)cdata;
-	
+	bCameraSolverConstraint *data = (bCameraSolverConstraint *)cdata;
+
 	data->clip = NULL;
 	data->flag |= CAMERASOLVER_ACTIVECLIP;
 }
 
-static void camerasolver_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
+static void camerasolver_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
 {
-	bCameraSolverConstraint *data= con->data;
-	
+	bCameraSolverConstraint *data = con->data;
+
 	func(con, (ID**)&data->clip, userdata);
 }
 
-static void camerasolver_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets))
+static void camerasolver_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets))
 {
-	Scene *scene= cob->scene;
-	bCameraSolverConstraint *data= con->data;
-	MovieClip *clip= data->clip;
+	Scene *scene = cob->scene;
+	bCameraSolverConstraint *data = con->data;
+	MovieClip *clip = data->clip;
 
 	if (data->flag & CAMERASOLVER_ACTIVECLIP)
-		clip= scene->clip;
+		clip = scene->clip;
 
 	if (clip) {
 		float mat[4][4], obmat[4][4];
-		MovieTracking *tracking= &clip->tracking;
-		MovieTrackingObject *object= BKE_tracking_get_camera_object(tracking);
+		MovieTracking *tracking = &clip->tracking;
+		MovieTrackingObject *object = BKE_tracking_get_camera_object(tracking);
 
 		BKE_tracking_get_interpolated_camera(tracking, object, scene->r.cfra, mat);
 
@@ -4178,16 +4166,16 @@ static bConstraintTypeInfo CTI_CAMERASOLVER = {
 
 /* ----------- Object Solver ------------- */
 
-static void objectsolver_new_data (void *cdata)
+static void objectsolver_new_data(void *cdata)
 {
-	bObjectSolverConstraint *data= (bObjectSolverConstraint *)cdata;
+	bObjectSolverConstraint *data = (bObjectSolverConstraint *)cdata;
 
 	data->clip = NULL;
 	data->flag |= OBJECTSOLVER_ACTIVECLIP;
 	unit_m4(data->invmat);
 }
 
-static void objectsolver_id_looper (bConstraint *con, ConstraintIDFunc func, void *userdata)
+static void objectsolver_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
 {
 	bObjectSolverConstraint *data= con->data;
 
@@ -4195,26 +4183,26 @@ static void objectsolver_id_looper (bConstraint *con, ConstraintIDFunc func, voi
 	func(con, (ID**)&data->camera, userdata);
 }
 
-static void objectsolver_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets))
+static void objectsolver_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *UNUSED(targets))
 {
-	Scene *scene= cob->scene;
-	bObjectSolverConstraint *data= con->data;
-	MovieClip *clip= data->clip;
-	Object *camob= data->camera ? data->camera : scene->camera;
+	Scene *scene = cob->scene;
+	bObjectSolverConstraint *data = con->data;
+	MovieClip *clip = data->clip;
+	Object *camob = data->camera ? data->camera : scene->camera;
 
 	if (data->flag & OBJECTSOLVER_ACTIVECLIP)
 		clip= scene->clip;
 
-	if(!camob || !clip)
+	if (!camob || !clip)
 		return;
 
 	if (clip) {
-		MovieTracking *tracking= &clip->tracking;
+		MovieTracking *tracking = &clip->tracking;
 		MovieTrackingObject *object;
 
-		object= BKE_tracking_named_object(tracking, data->object);
+		object = BKE_tracking_named_object(tracking, data->object);
 
-		if(object) {
+		if (object) {
 			float mat[4][4], obmat[4][4], imat[4][4], cammat[4][4], camimat[4][4], parmat[4][4];
 
 			where_is_object_mat(scene, camob, cammat);
@@ -4298,7 +4286,7 @@ static void constraints_init_typeinfo (void)
  */
 bConstraintTypeInfo *get_constraint_typeinfo (int type)
 {
-	/* initialise the type-info list? */
+	/* initialize the type-info list? */
 	if (CTI_INIT) {
 		constraints_init_typeinfo();
 		CTI_INIT = 0;
@@ -4312,7 +4300,7 @@ bConstraintTypeInfo *get_constraint_typeinfo (int type)
 		return constraintsTypeInfo[type];
 	}
 	else {
-		printf("No valid constraint type-info data available. Type = %i \n", type);
+		printf("No valid constraint type-info data available. Type = %i\n", type);
 	}
 	
 	return NULL;
@@ -4402,7 +4390,7 @@ void remove_constraints_type (ListBase *list, short type, short last_only)
 
 /* ......... */
 
-/* Creates a new constraint, initialises its data, and returns it */
+/* Creates a new constraint, initializes its data, and returns it */
 static bConstraint *add_new_constraint_internal (const char *name, short type)
 {
 	bConstraint *con= MEM_callocN(sizeof(bConstraint), "Constraint");
@@ -4416,7 +4404,7 @@ static bConstraint *add_new_constraint_internal (const char *name, short type)
 
 	/* Determine a basic name, and info */
 	if (cti) {
-		/* initialise constraint data */
+		/* initialize constraint data */
 		con->data = MEM_callocN(cti->size, cti->structName);
 		
 		/* only constraints that change any settings need this */
@@ -4580,7 +4568,7 @@ void copy_constraints (ListBase *dst, const ListBase *src, int do_extern)
 			if (cti->copy_data)
 				cti->copy_data(con, srccon);
 			
-			/* for proxies we dont want to make extern */
+			/* for proxies we don't want to make extern */
 			if (do_extern) {
 				/* go over used ID-links for this constraint to ensure that they are valid for proxies */
 				if (cti->id_looper)
@@ -4726,7 +4714,7 @@ void get_constraint_target_matrix (struct Scene *scene, bConstraint *con, int n,
 		
 		/* only calculate the target matrix on the first target */
 		ct= (bConstraintTarget *)targets.first;
-		while(ct && n-- > 0)
+		while (ct && n-- > 0)
 			ct= ct->next;
 
 		if (ct) {
@@ -4761,7 +4749,7 @@ void get_constraint_targets_for_solving (bConstraint *con, bConstraintOb *cob, L
 		cti->get_constraint_targets(con, targets);
 		
 		/* set matrices 
-		 * 	- calculate if possible, otherwise just initialise as identity matrix 
+		 * 	- calculate if possible, otherwise just initialize as identity matrix 
 		 */
 		if (cti->get_target_matrix) {
 			for (ct= targets->first; ct; ct= ct->next) 
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index 05c56fa..e9dd4d0 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -120,8 +120,8 @@ bContextStore *CTX_store_add(ListBase *contexts, const char *name, PointerRNA *p
 	 * we have to copy the context to ensure */
 	ctx= contexts->last;
 
-	if(!ctx || ctx->used) {
-		if(ctx) {
+	if (!ctx || ctx->used) {
+		if (ctx) {
 			lastctx= ctx;
 			ctx= MEM_dupallocN(lastctx);
 			BLI_duplicatelist(&ctx->entries, &lastctx->entries);
@@ -141,6 +141,35 @@ bContextStore *CTX_store_add(ListBase *contexts, const char *name, PointerRNA *p
 	return ctx;
 }
 
+bContextStore *CTX_store_add_all(ListBase *contexts, bContextStore *context)
+{
+	bContextStoreEntry *entry, *tentry;
+	bContextStore *ctx, *lastctx;
+
+	/* ensure we have a context to put the entries in, if it was already used
+	 * we have to copy the context to ensure */
+	ctx= contexts->last;
+
+	if (!ctx || ctx->used) {
+		if (ctx) {
+			lastctx= ctx;
+			ctx= MEM_dupallocN(lastctx);
+			BLI_duplicatelist(&ctx->entries, &lastctx->entries);
+		}
+		else
+			ctx= MEM_callocN(sizeof(bContextStore), "bContextStore");
+
+		BLI_addtail(contexts, ctx);
+	}
+
+	for (tentry= context->entries.first; tentry; tentry= tentry->next) {
+		entry= MEM_dupallocN(tentry);
+		BLI_addtail(&ctx->entries, entry);
+	}
+
+	return ctx;
+}
+
 void CTX_store_set(bContext *C, bContextStore *store)
 {
 	C->wm.store= store;
@@ -166,7 +195,7 @@ void CTX_store_free_list(ListBase *contexts)
 {
 	bContextStore *ctx;
 
-	while((ctx= contexts->first)) {
+	while ((ctx= contexts->first)) {
 		BLI_remlink(contexts, ctx);
 		CTX_store_free(ctx);
 	}
@@ -243,127 +272,127 @@ struct ReportList *CTX_wm_reports(const bContext *C)
 
 View3D *CTX_wm_view3d(const bContext *C)
 {
-	if(C->wm.area && C->wm.area->spacetype==SPACE_VIEW3D)
+	if (C->wm.area && C->wm.area->spacetype==SPACE_VIEW3D)
 		return C->wm.area->spacedata.first;
 	return NULL;
 }
 
 RegionView3D *CTX_wm_region_view3d(const bContext *C)
 {
-	if(C->wm.area && C->wm.area->spacetype==SPACE_VIEW3D)
-		if(C->wm.region)
+	if (C->wm.area && C->wm.area->spacetype==SPACE_VIEW3D)
+		if (C->wm.region)
 			return C->wm.region->regiondata;
 	return NULL;
 }
 
 struct SpaceText *CTX_wm_space_text(const bContext *C)
 {
-	if(C->wm.area && C->wm.area->spacetype==SPACE_TEXT)
+	if (C->wm.area && C->wm.area->spacetype==SPACE_TEXT)
 		return C->wm.area->spacedata.first;
 	return NULL;
 }
 
 struct SpaceConsole *CTX_wm_space_console(const bContext *C)
 {
-	if(C->wm.area && C->wm.area->spacetype==SPACE_CONSOLE)
+	if (C->wm.area && C->wm.area->spacetype==SPACE_CONSOLE)
 		return C->wm.area->spacedata.first;
 	return NULL;
 }
 
 struct SpaceImage *CTX_wm_space_image(const bContext *C)
 {
-	if(C->wm.area && C->wm.area->spacetype==SPACE_IMAGE)
+	if (C->wm.area && C->wm.area->spacetype==SPACE_IMAGE)
 		return C->wm.area->spacedata.first;
 	return NULL;
 }
 
 struct SpaceButs *CTX_wm_space_buts(const bContext *C)
 {
-	if(C->wm.area && C->wm.area->spacetype==SPACE_BUTS)
+	if (C->wm.area && C->wm.area->spacetype==SPACE_BUTS)
 		return C->wm.area->spacedata.first;
 	return NULL;
 }
 
 struct SpaceFile *CTX_wm_space_file(const bContext *C)
 {
-	if(C->wm.area && C->wm.area->spacetype==SPACE_FILE)
+	if (C->wm.area && C->wm.area->spacetype==SPACE_FILE)
 		return C->wm.area->spacedata.first;
 	return NULL;
 }
 
 struct SpaceSeq *CTX_wm_space_seq(const bContext *C)
 {
-	if(C->wm.area && C->wm.area->spacetype==SPACE_SEQ)
+	if (C->wm.area && C->wm.area->spacetype==SPACE_SEQ)
 		return C->wm.area->spacedata.first;
 	return NULL;
 }
 
 struct SpaceOops *CTX_wm_space_outliner(const bContext *C)
 {
-	if(C->wm.area && C->wm.area->spacetype==SPACE_OUTLINER)
+	if (C->wm.area && C->wm.area->spacetype==SPACE_OUTLINER)
 		return C->wm.area->spacedata.first;
 	return NULL;
 }
 
 struct SpaceNla *CTX_wm_space_nla(const bContext *C)
 {
-	if(C->wm.area && C->wm.area->spacetype==SPACE_NLA)
+	if (C->wm.area && C->wm.area->spacetype==SPACE_NLA)
 		return C->wm.area->spacedata.first;
 	return NULL;
 }
 
 struct SpaceTime *CTX_wm_space_time(const bContext *C)
 {
-	if(C->wm.area && C->wm.area->spacetype==SPACE_TIME)
+	if (C->wm.area && C->wm.area->spacetype==SPACE_TIME)
 		return C->wm.area->spacedata.first;
 	return NULL;
 }
 
 struct SpaceNode *CTX_wm_space_node(const bContext *C)
 {
-	if(C->wm.area && C->wm.area->spacetype==SPACE_NODE)
+	if (C->wm.area && C->wm.area->spacetype==SPACE_NODE)
 		return C->wm.area->spacedata.first;
 	return NULL;
 }
 
 struct SpaceLogic *CTX_wm_space_logic(const bContext *C)
 {
-	if(C->wm.area && C->wm.area->spacetype==SPACE_LOGIC)
+	if (C->wm.area && C->wm.area->spacetype==SPACE_LOGIC)
 		return C->wm.area->spacedata.first;
 	return NULL;
 }
 
 struct SpaceIpo *CTX_wm_space_graph(const bContext *C)
 {
-	if(C->wm.area && C->wm.area->spacetype==SPACE_IPO)
+	if (C->wm.area && C->wm.area->spacetype==SPACE_IPO)
 		return C->wm.area->spacedata.first;
 	return NULL;
 }
 
 struct SpaceAction *CTX_wm_space_action(const bContext *C)
 {
-	if(C->wm.area && C->wm.area->spacetype==SPACE_ACTION)
+	if (C->wm.area && C->wm.area->spacetype==SPACE_ACTION)
 		return C->wm.area->spacedata.first;
 	return NULL;
 }
 
 struct SpaceInfo *CTX_wm_space_info(const bContext *C)
 {
-	if(C->wm.area && C->wm.area->spacetype==SPACE_INFO)
+	if (C->wm.area && C->wm.area->spacetype==SPACE_INFO)
 		return C->wm.area->spacedata.first;
 	return NULL;
 }
 
 struct SpaceUserPref *CTX_wm_space_userpref(const bContext *C)
 {
-	if(C->wm.area && C->wm.area->spacetype==SPACE_USERPREF)
+	if (C->wm.area && C->wm.area->spacetype==SPACE_USERPREF)
 		return C->wm.area->spacedata.first;
 	return NULL;
 }
 
 struct SpaceClip *CTX_wm_space_clip(const bContext *C)
 {
-	if(C->wm.area && C->wm.area->spacetype==SPACE_CLIP)
+	if (C->wm.area && C->wm.area->spacetype==SPACE_CLIP)
 		return C->wm.area->spacedata.first;
 	return NULL;
 }
@@ -381,7 +410,7 @@ void CTX_wm_window_set(bContext *C, wmWindow *win)
 {
 	C->wm.window= win;
 	C->wm.screen= (win)? win->screen: NULL;
-	if(C->wm.screen)
+	if (C->wm.screen)
 		C->data.scene= C->wm.screen->scene;
 	C->wm.area= NULL;
 	C->wm.region= NULL;
@@ -390,7 +419,7 @@ void CTX_wm_window_set(bContext *C, wmWindow *win)
 void CTX_wm_screen_set(bContext *C, bScreen *screen)
 {
 	C->wm.screen= screen;
-	if(C->wm.screen)
+	if (C->wm.screen)
 		C->data.scene= C->wm.screen->scene;
 	C->wm.area= NULL;
 	C->wm.region= NULL;
@@ -438,7 +467,7 @@ static int ctx_data_get(bContext *C, const char *member, bContextDataResult *res
 
 	memset(result, 0, sizeof(bContextDataResult));
 #ifdef WITH_PYTHON
-	if(CTX_py_dict_get(C)) {
+	if (CTX_py_dict_get(C)) {
 		return BPY_context_member_get(C, member, result);
 //		if (BPY_context_member_get(C, member, result))
 //			return 1;
@@ -448,43 +477,43 @@ static int ctx_data_get(bContext *C, const char *member, bContextDataResult *res
 	 * loops requesting data from ourselfs in a context callback */
 
 	/* Ok, this looks evil...
-	 * if(ret) done= -(-ret | -done);
+	 * if (ret) done= -(-ret | -done);
 	 *
 	 * Values in order of importance
 	 * (0, -1, 1) - Where 1 is highest priority
 	 * */
-	if(done!=1 && recursion < 1 && C->wm.store) {
+	if (done!=1 && recursion < 1 && C->wm.store) {
 		bContextStoreEntry *entry;
 
 		C->data.recursion= 1;
 
 		entry= BLI_rfindstring(&C->wm.store->entries, member, offsetof(bContextStoreEntry, name));
-		if(entry) {
+		if (entry) {
 			result->ptr= entry->ptr;
 			done= 1;
 		}
 	}
-	if(done!=1 && recursion < 2 && C->wm.region) {
+	if (done!=1 && recursion < 2 && C->wm.region) {
 		C->data.recursion= 2;
-		if(C->wm.region->type && C->wm.region->type->context) {
+		if (C->wm.region->type && C->wm.region->type->context) {
 			ret = C->wm.region->type->context(C, member, result);
-			if(ret) done= -(-ret | -done);
+			if (ret) done= -(-ret | -done);
 
 		}
 	}
-	if(done!=1 && recursion < 3 && C->wm.area) {
+	if (done!=1 && recursion < 3 && C->wm.area) {
 		C->data.recursion= 3;
-		if(C->wm.area->type && C->wm.area->type->context) {
+		if (C->wm.area->type && C->wm.area->type->context) {
 			ret = C->wm.area->type->context(C, member, result);
-			if(ret) done= -(-ret | -done);
+			if (ret) done= -(-ret | -done);
 		}
 	}
-	if(done!=1 && recursion < 4 && C->wm.screen) {
+	if (done!=1 && recursion < 4 && C->wm.screen) {
 		bContextDataCallback cb= C->wm.screen->context;
 		C->data.recursion= 4;
-		if(cb) {
+		if (cb) {
 			ret = cb(C, member, result);
-			if(ret) done= -(-ret | -done);
+			if (ret) done= -(-ret | -done);
 		}
 	}
 
@@ -497,7 +526,7 @@ static void *ctx_data_pointer_get(const bContext *C, const char *member)
 {
 	bContextDataResult result;
 
-	if(C && ctx_data_get((bContext*)C, member, &result)==1)
+	if (C && ctx_data_get((bContext*)C, member, &result)==1)
 		return result.ptr.data;
 
 	return NULL;
@@ -512,7 +541,7 @@ static int ctx_data_pointer_verify(const bContext *C, const char *member, void *
 		*pointer= NULL;
 		return 1;
 	}
-	else if(ctx_data_get((bContext*)C, member, &result)==1) {
+	else if (ctx_data_get((bContext*)C, member, &result)==1) {
 		*pointer= result.ptr.data;
 		return 1;
 	}
@@ -526,7 +555,7 @@ static int ctx_data_collection_get(const bContext *C, const char *member, ListBa
 {
 	bContextDataResult result;
 
-	if(ctx_data_get((bContext*)C, member, &result)==1) {
+	if (ctx_data_get((bContext*)C, member, &result)==1) {
 		*list= result.list;
 		return 1;
 	}
@@ -541,7 +570,7 @@ PointerRNA CTX_data_pointer_get(const bContext *C, const char *member)
 {
 	bContextDataResult result;
 
-	if(ctx_data_get((bContext*)C, member, &result)==1)
+	if (ctx_data_get((bContext*)C, member, &result)==1)
 		return result.ptr;
 	else
 		return PointerRNA_NULL;
@@ -551,7 +580,7 @@ PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, Stru
 {
 	PointerRNA ptr = CTX_data_pointer_get(C, member);
 
-	if(ptr.data && RNA_struct_is_a(ptr.type, type))
+	if (ptr.data && RNA_struct_is_a(ptr.type, type))
 		return ptr;
 	
 	return PointerRNA_NULL;
@@ -561,7 +590,7 @@ ListBase CTX_data_collection_get(const bContext *C, const char *member)
 {
 	bContextDataResult result;
 
-	if(ctx_data_get((bContext*)C, member, &result)==1) {
+	if (ctx_data_get((bContext*)C, member, &result)==1) {
 		return result.list;
 	}
 	else {
@@ -576,7 +605,7 @@ int CTX_data_get(const bContext *C, const char *member, PointerRNA *r_ptr, ListB
 	bContextDataResult result;
 	int ret= ctx_data_get((bContext*)C, member, &result);
 
-	if(ret==1) {
+	if (ret==1) {
 		*r_ptr= result.ptr;
 		*r_lb= result.list;
 		*r_type= result.type;
@@ -594,10 +623,10 @@ static void data_dir_add(ListBase *lb, const char *member)
 {
 	LinkData *link;
 	
-	if(strcmp(member, "scene") == 0) /* exception */
+	if (strcmp(member, "scene") == 0) /* exception */
 		return;
 
-	if(BLI_findstring(lb, member, offsetof(LinkData, data)))
+	if (BLI_findstring(lb, member, offsetof(LinkData, data)))
 		return;
 	
 	link= MEM_callocN(sizeof(LinkData), "LinkData");
@@ -613,35 +642,35 @@ ListBase CTX_data_dir_get(const bContext *C)
 
 	memset(&lb, 0, sizeof(lb));
 
-	if(C->wm.store) {
+	if (C->wm.store) {
 		bContextStoreEntry *entry;
 
-		for(entry=C->wm.store->entries.first; entry; entry=entry->next)
+		for (entry=C->wm.store->entries.first; entry; entry=entry->next)
 			data_dir_add(&lb, entry->name);
 	}
-	if(C->wm.region && C->wm.region->type && C->wm.region->type->context) {
+	if (C->wm.region && C->wm.region->type && C->wm.region->type->context) {
 		memset(&result, 0, sizeof(result));
 		C->wm.region->type->context(C, "", &result);
 
-		if(result.dir)
-			for(a=0; result.dir[a]; a++)
+		if (result.dir)
+			for (a=0; result.dir[a]; a++)
 				data_dir_add(&lb, result.dir[a]);
 	}
-	if(C->wm.area && C->wm.area->type && C->wm.area->type->context) {
+	if (C->wm.area && C->wm.area->type && C->wm.area->type->context) {
 		memset(&result, 0, sizeof(result));
 		C->wm.area->type->context(C, "", &result);
 
-		if(result.dir)
-			for(a=0; result.dir[a]; a++)
+		if (result.dir)
+			for (a=0; result.dir[a]; a++)
 				data_dir_add(&lb, result.dir[a]);
 	}
-	if(C->wm.screen && C->wm.screen->context) {
+	if (C->wm.screen && C->wm.screen->context) {
 		bContextDataCallback cb= C->wm.screen->context;
 		memset(&result, 0, sizeof(result));
 		cb(C, "", &result);
 
-		if(result.dir)
-			for(a=0; result.dir[a]; a++)
+		if (result.dir)
+			for (a=0; result.dir[a]; a++)
 				data_dir_add(&lb, result.dir[a]);
 	}
 
@@ -692,7 +721,7 @@ int ctx_data_list_count(const bContext *C, int (*func)(const bContext*, ListBase
 {
 	ListBase list;
 
-	if(func(C, &list)) {
+	if (func(C, &list)) {
 		int tot= BLI_countlist(&list);
 		BLI_freelistN(&list);
 		return tot;
@@ -722,7 +751,7 @@ Main *CTX_data_main(const bContext *C)
 {
 	Main *bmain;
 
-	if(ctx_data_pointer_verify(C, "blend_data", (void*)&bmain))
+	if (ctx_data_pointer_verify(C, "blend_data", (void*)&bmain))
 		return bmain;
 	else
 		return C->data.main;
@@ -737,7 +766,7 @@ Scene *CTX_data_scene(const bContext *C)
 {
 	Scene *scene;
 
-	if(ctx_data_pointer_verify(C, "scene", (void*)&scene))
+	if (ctx_data_pointer_verify(C, "scene", (void*)&scene))
 		return scene;
 	else
 		return C->data.scene;
@@ -747,7 +776,7 @@ int CTX_data_mode_enum(const bContext *C)
 {
 	Object *obedit= CTX_data_edit_object(C);
 
-	if(obedit) {
+	if (obedit) {
 		switch(obedit->type) {
 			case OB_MESH:
 				return CTX_MODE_EDIT_MESH;
@@ -768,13 +797,13 @@ int CTX_data_mode_enum(const bContext *C)
 	else {
 		Object *ob = CTX_data_active_object(C);
 
-		if(ob) {
-			if(ob->mode & OB_MODE_POSE) return CTX_MODE_POSE;
-			else if(ob->mode & OB_MODE_SCULPT)  return CTX_MODE_SCULPT;
-			else if(ob->mode & OB_MODE_WEIGHT_PAINT) return CTX_MODE_PAINT_WEIGHT;
-			else if(ob->mode & OB_MODE_VERTEX_PAINT) return CTX_MODE_PAINT_VERTEX;
-			else if(ob->mode & OB_MODE_TEXTURE_PAINT) return CTX_MODE_PAINT_TEXTURE;
-			else if(ob->mode & OB_MODE_PARTICLE_EDIT) return CTX_MODE_PARTICLE;
+		if (ob) {
+			if (ob->mode & OB_MODE_POSE) return CTX_MODE_POSE;
+			else if (ob->mode & OB_MODE_SCULPT)  return CTX_MODE_SCULPT;
+			else if (ob->mode & OB_MODE_WEIGHT_PAINT) return CTX_MODE_PAINT_WEIGHT;
+			else if (ob->mode & OB_MODE_VERTEX_PAINT) return CTX_MODE_PAINT_VERTEX;
+			else if (ob->mode & OB_MODE_TEXTURE_PAINT) return CTX_MODE_PAINT_TEXTURE;
+			else if (ob->mode & OB_MODE_PARTICLE_EDIT) return CTX_MODE_PARTICLE;
 		}
 	}
 
@@ -815,7 +844,7 @@ ToolSettings *CTX_data_tool_settings(const bContext *C)
 {
 	Scene *scene = CTX_data_scene(C);
 
-	if(scene)
+	if (scene)
 		return scene->toolsettings;
 	else
 		return NULL;
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 6536dfb..9232fe8 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -66,46 +66,46 @@
 /* globals */
 
 /* local */
-static int cu_isectLL(float *v1, float *v2, float *v3, float *v4, 
+static int cu_isectLL(const float v1[3], const float v2[3], const float v3[3], const float v4[3],
                       short cox, short coy,
-                      float *labda, float *mu, float *vec);
+                      float *labda, float *mu, float vec[3]);
 
 void unlink_curve(Curve *cu)
 {
 	int a;
 	
-	for(a=0; a<cu->totcol; a++) {
-		if(cu->mat[a]) cu->mat[a]->id.us--;
+	for (a=0; a<cu->totcol; a++) {
+		if (cu->mat[a]) cu->mat[a]->id.us--;
 		cu->mat[a]= NULL;
 	}
-	if(cu->vfont) cu->vfont->id.us--; 
+	if (cu->vfont) cu->vfont->id.us--; 
 	cu->vfont= NULL;
 
-	if(cu->vfontb) cu->vfontb->id.us--; 
+	if (cu->vfontb) cu->vfontb->id.us--; 
 	cu->vfontb= NULL;
 
-	if(cu->vfonti) cu->vfonti->id.us--; 
+	if (cu->vfonti) cu->vfonti->id.us--; 
 	cu->vfonti= NULL;
 
-	if(cu->vfontbi) cu->vfontbi->id.us--; 
+	if (cu->vfontbi) cu->vfontbi->id.us--; 
 	cu->vfontbi= NULL;
 	
-	if(cu->key) cu->key->id.us--;
+	if (cu->key) cu->key->id.us--;
 	cu->key= NULL;
 }
 
 /* frees editcurve entirely */
 void BKE_free_editfont(Curve *cu)
 {
-	if(cu->editfont) {
+	if (cu->editfont) {
 		EditFont *ef= cu->editfont;
 		
-		if(ef->oldstr) MEM_freeN(ef->oldstr);
-		if(ef->oldstrinfo) MEM_freeN(ef->oldstrinfo);
-		if(ef->textbuf) MEM_freeN(ef->textbuf);
-		if(ef->textbufinfo) MEM_freeN(ef->textbufinfo);
-		if(ef->copybuf) MEM_freeN(ef->copybuf);
-		if(ef->copybufinfo) MEM_freeN(ef->copybufinfo);
+		if (ef->oldstr) MEM_freeN(ef->oldstr);
+		if (ef->oldstrinfo) MEM_freeN(ef->oldstrinfo);
+		if (ef->textbuf) MEM_freeN(ef->textbuf);
+		if (ef->textbufinfo) MEM_freeN(ef->textbufinfo);
+		if (ef->copybuf) MEM_freeN(ef->copybuf);
+		if (ef->copybufinfo) MEM_freeN(ef->copybufinfo);
 		
 		MEM_freeN(ef);
 		cu->editfont= NULL;
@@ -123,7 +123,7 @@ void free_curve_editNurb_keyIndex(EditNurb *editnurb)
 
 void free_curve_editNurb (Curve *cu)
 {
-	if(cu->editnurb) {
+	if (cu->editnurb) {
 		freeNurblist(&cu->editnurb->nurbs);
 		free_curve_editNurb_keyIndex(cu->editnurb);
 		MEM_freeN(cu->editnurb);
@@ -143,21 +143,20 @@ void free_curve(Curve *cu)
 	unlink_curve(cu);
 	BKE_free_animdata((ID *)cu);
 	
-	if(cu->mat) MEM_freeN(cu->mat);
-	if(cu->str) MEM_freeN(cu->str);
-	if(cu->strinfo) MEM_freeN(cu->strinfo);
-	if(cu->bb) MEM_freeN(cu->bb);
-	if(cu->path) free_path(cu->path);
-	if(cu->tb) MEM_freeN(cu->tb);
+	if (cu->mat) MEM_freeN(cu->mat);
+	if (cu->str) MEM_freeN(cu->str);
+	if (cu->strinfo) MEM_freeN(cu->strinfo);
+	if (cu->bb) MEM_freeN(cu->bb);
+	if (cu->path) free_path(cu->path);
+	if (cu->tb) MEM_freeN(cu->tb);
 }
 
 Curve *add_curve(const char *name, int type)
 {
 	Curve *cu;
 
-	cu= alloc_libblock(&G.main->curve, ID_CU, name);
-	
-	cu->size[0]= cu->size[1]= cu->size[2]= 1.0;
+	cu = alloc_libblock(&G.main->curve, ID_CU, name);
+	copy_v3_fl(cu->size, 1.0f);
 	cu->flag= CU_FRONT|CU_BACK|CU_DEFORM_BOUNDS_OFF|CU_PATH_RADIUS;
 	cu->pathlen= 100;
 	cu->resolu= cu->resolv= (type == OB_SURF) ? 4 : 12;
@@ -173,7 +172,7 @@ Curve *add_curve(const char *name, int type)
 	
 	cu->bb= unit_boundbox();
 	
-	if(type==OB_FONT) {
+	if (type==OB_FONT) {
 		cu->vfont= cu->vfontb= cu->vfonti= cu->vfontbi= get_builtin_font();
 		cu->vfont->id.us+=4;
 		cu->str= MEM_mallocN(12, "str");
@@ -198,7 +197,7 @@ Curve *copy_curve(Curve *cu)
 	duplicateNurblist( &(cun->nurb), &(cu->nurb));
 
 	cun->mat= MEM_dupallocN(cu->mat);
-	for(a=0; a<cun->totcol; a++) {
+	for (a=0; a<cun->totcol; a++) {
 		id_us_plus((ID *)cun->mat[a]);
 	}
 	
@@ -208,7 +207,7 @@ Curve *copy_curve(Curve *cu)
 	cun->bb= MEM_dupallocN(cu->bb);
 	
 	cun->key= copy_key(cu->key);
-	if(cun->key) cun->key->from= (ID *)cun;
+	if (cun->key) cun->key->from= (ID *)cun;
 	
 	cun->disp.first= cun->disp.last= NULL;
 	cun->bev.first= cun->bev.last= NULL;
@@ -220,7 +219,7 @@ Curve *copy_curve(Curve *cu)
 
 #if 0	// XXX old animation system
 	/* single user ipo too */
-	if(cun->ipo) cun->ipo= copy_ipo(cun->ipo);
+	if (cun->ipo) cun->ipo= copy_ipo(cun->ipo);
 #endif // XXX old animation system
 
 	id_us_plus((ID *)cun->vfont);
@@ -238,7 +237,7 @@ static void extern_local_curve(Curve *cu)
 	id_lib_extern((ID *)cu->vfonti);
 	id_lib_extern((ID *)cu->vfontbi);
 	
-	if(cu->mat) {
+	if (cu->mat) {
 		extern_local_matarar(cu->mat, cu->totcol);
 	}
 }
@@ -254,34 +253,34 @@ void make_local_curve(Curve *cu)
 	 * - mixed: do a copy
 	 */
 	
-	if(cu->id.lib==NULL) return;
+	if (cu->id.lib==NULL) return;
 
-	if(cu->id.us==1) {
+	if (cu->id.us==1) {
 		id_clear_lib_data(bmain, &cu->id);
 		extern_local_curve(cu);
 		return;
 	}
 
-	for(ob= bmain->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) {
-		if(ob->data == cu) {
-			if(ob->id.lib) is_lib= TRUE;
+	for (ob= bmain->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) {
+		if (ob->data == cu) {
+			if (ob->id.lib) is_lib= TRUE;
 			else is_local= TRUE;
 		}
 	}
 
-	if(is_local && is_lib == FALSE) {
+	if (is_local && is_lib == FALSE) {
 		id_clear_lib_data(bmain, &cu->id);
 		extern_local_curve(cu);
 	}
-	else if(is_local && is_lib) {
+	else if (is_local && is_lib) {
 		Curve *cu_new= copy_curve(cu);
 		cu_new->id.us= 0;
 
 		BKE_id_lib_local_paths(bmain, cu->id.lib, &cu_new->id);
 
-		for(ob= bmain->object.first; ob; ob= ob->id.next) {
-			if(ob->data==cu) {
-				if(ob->id.lib==NULL) {
+		for (ob= bmain->object.first; ob; ob= ob->id.next) {
+			if (ob->data==cu) {
+				if (ob->id.lib==NULL) {
 					ob->data= cu_new;
 					cu_new->id.us++;
 					cu->id.us--;
@@ -306,15 +305,15 @@ short curve_type(Curve *cu)
 	Nurb *nu;
 	int type= cu->type;
 
-	if(cu->vfont) {
+	if (cu->vfont) {
 		return OB_FONT;
 	}
 
-	if(!cu->type) {
+	if (!cu->type) {
 		type= OB_CURVE;
 
 		for (nu= cu->nurb.first; nu; nu= nu->next) {
-			if(nu->pntsv>1) {
+			if (nu->pntsv>1) {
 				type= OB_SURF;
 			}
 		}
@@ -328,18 +327,18 @@ void update_curve_dimension(Curve *cu)
 	ListBase *nurbs= BKE_curve_nurbs(cu);
 	Nurb *nu= nurbs->first;
 
-	if(cu->flag&CU_3D) {
-		for( ; nu; nu= nu->next) {
+	if (cu->flag&CU_3D) {
+		for ( ; nu; nu= nu->next) {
 			nu->flag &= ~CU_2D;
 		}
 	}
 	else {
-		for( ; nu; nu= nu->next) {
+		for ( ; nu; nu= nu->next) {
 			nu->flag |= CU_2D;
 			test2DNurb(nu);
 
 			/* since the handles are moved they need to be auto-located again */
-			if(nu->type == CU_BEZIER)
+			if (nu->type == CU_BEZIER)
 				calchandlesNurb(nu);
 		}
 	}
@@ -349,7 +348,7 @@ void test_curve_type(Object *ob)
 {
 	ob->type= curve_type(ob->data);
 
-	if(ob->type==OB_CURVE)
+	if (ob->type==OB_CURVE)
 		update_curve_dimension((Curve *)ob->data);
 }
 
@@ -360,51 +359,51 @@ void tex_space_curve(Curve *cu)
 	float *fp, min[3], max[3];
 	int tot, doit= 0;
 	
-	if(cu->bb==NULL) cu->bb= MEM_callocN(sizeof(BoundBox), "boundbox");
+	if (cu->bb==NULL) cu->bb= MEM_callocN(sizeof(BoundBox), "boundbox");
 	bb= cu->bb;
 	
 	INIT_MINMAX(min, max);
 
 	dl= cu->disp.first;
-	while(dl) {
+	while (dl) {
 		
 		tot = ELEM(dl->type, DL_INDEX3, DL_INDEX4) ? dl->nr : dl->nr * dl->parts;
 
-		if(tot) doit= 1;
+		if (tot) doit= 1;
 		fp= dl->verts;
-		while(tot--) {
+		while (tot--) {
 			DO_MINMAX(fp, min, max);
 			fp += 3;
 		}
 		dl= dl->next;
 	}
 
-	if(!doit) {
+	if (!doit) {
 		min[0] = min[1] = min[2] = -1.0f;
 		max[0] = max[1] = max[2] = 1.0f;
 	}
 
 	boundbox_set_from_min_max(bb, min, max);
 
-	if(cu->texflag & CU_AUTOSPACE) {
+	if (cu->texflag & CU_AUTOSPACE) {
 		mid_v3_v3v3(cu->loc, min, max);
 		cu->size[0]= (max[0]-min[0])/2.0f;
 		cu->size[1]= (max[1]-min[1])/2.0f;
 		cu->size[2]= (max[2]-min[2])/2.0f;
 
-		cu->rot[0]= cu->rot[1]= cu->rot[2]= 0.0f;
+		zero_v3(cu->rot);
 
-		if(cu->size[0]==0.0f) cu->size[0]= 1.0f;
-		else if(cu->size[0]>0.0f && cu->size[0]<0.00001f) cu->size[0]= 0.00001f;
-		else if(cu->size[0]<0.0f && cu->size[0]> -0.00001f) cu->size[0]= -0.00001f;
+		if (cu->size[0]==0.0f) cu->size[0]= 1.0f;
+		else if (cu->size[0]>0.0f && cu->size[0]<0.00001f) cu->size[0]= 0.00001f;
+		else if (cu->size[0]<0.0f && cu->size[0]> -0.00001f) cu->size[0]= -0.00001f;
 	
-		if(cu->size[1]==0.0f) cu->size[1]= 1.0f;
-		else if(cu->size[1]>0.0f && cu->size[1]<0.00001f) cu->size[1]= 0.00001f;
-		else if(cu->size[1]<0.0f && cu->size[1]> -0.00001f) cu->size[1]= -0.00001f;
+		if (cu->size[1]==0.0f) cu->size[1]= 1.0f;
+		else if (cu->size[1]>0.0f && cu->size[1]<0.00001f) cu->size[1]= 0.00001f;
+		else if (cu->size[1]<0.0f && cu->size[1]> -0.00001f) cu->size[1]= -0.00001f;
 	
-		if(cu->size[2]==0.0f) cu->size[2]= 1.0f;
-		else if(cu->size[2]>0.0f && cu->size[2]<0.00001f) cu->size[2]= 0.00001f;
-		else if(cu->size[2]<0.0f && cu->size[2]> -0.00001f) cu->size[2]= -0.00001f;
+		if (cu->size[2]==0.0f) cu->size[2]= 1.0f;
+		else if (cu->size[2]>0.0f && cu->size[2]<0.00001f) cu->size[2]= 0.00001f;
+		else if (cu->size[2]<0.0f && cu->size[2]> -0.00001f) cu->size[2]= -0.00001f;
 
 	}
 }
@@ -415,9 +414,9 @@ int count_curveverts(ListBase *nurb)
 	int tot=0;
 	
 	nu= nurb->first;
-	while(nu) {
-		if(nu->bezt) tot+= 3*nu->pntsu;
-		else if(nu->bp) tot+= nu->pntsu*nu->pntsv;
+	while (nu) {
+		if (nu->bezt) tot+= 3*nu->pntsu;
+		else if (nu->bp) tot+= nu->pntsu*nu->pntsv;
 		
 		nu= nu->next;
 	}
@@ -430,9 +429,9 @@ int count_curveverts_without_handles(ListBase *nurb)
 	int tot=0;
 	
 	nu= nurb->first;
-	while(nu) {
-		if(nu->bezt) tot+= nu->pntsu;
-		else if(nu->bp) tot+= nu->pntsu*nu->pntsv;
+	while (nu) {
+		if (nu->bezt) tot+= nu->pntsu;
+		else if (nu->bp) tot+= nu->pntsu*nu->pntsv;
 		
 		nu= nu->next;
 	}
@@ -444,17 +443,17 @@ int count_curveverts_without_handles(ListBase *nurb)
 void freeNurb(Nurb *nu)
 {
 
-	if(nu==NULL) return;
+	if (nu==NULL) return;
 
-	if(nu->bezt) MEM_freeN(nu->bezt);
+	if (nu->bezt) MEM_freeN(nu->bezt);
 	nu->bezt= NULL;
-	if(nu->bp) MEM_freeN(nu->bp);
+	if (nu->bp) MEM_freeN(nu->bp);
 	nu->bp= NULL;
-	if(nu->knotsu) MEM_freeN(nu->knotsu);
+	if (nu->knotsu) MEM_freeN(nu->knotsu);
 	nu->knotsu= NULL;
-	if(nu->knotsv) MEM_freeN(nu->knotsv);
+	if (nu->knotsv) MEM_freeN(nu->knotsv);
 	nu->knotsv= NULL;
-	/* if(nu->trim.first) freeNurblist(&(nu->trim)); */
+	/* if (nu->trim.first) freeNurblist(&(nu->trim)); */
 
 	MEM_freeN(nu);
 
@@ -465,10 +464,10 @@ void freeNurblist(ListBase *lb)
 {
 	Nurb *nu, *next;
 
-	if(lb==NULL) return;
+	if (lb==NULL) return;
 
 	nu= lb->first;
-	while(nu) {
+	while (nu) {
 		next= nu->next;
 		freeNurb(nu);
 		nu= next;
@@ -482,10 +481,10 @@ Nurb *duplicateNurb(Nurb *nu)
 	int len;
 
 	newnu= (Nurb*)MEM_mallocN(sizeof(Nurb),"duplicateNurb");
-	if(newnu==NULL) return NULL;
+	if (newnu==NULL) return NULL;
 	memcpy(newnu, nu, sizeof(Nurb));
 
-	if(nu->bezt) {
+	if (nu->bezt) {
 		newnu->bezt=
 			(BezTriple*)MEM_mallocN((nu->pntsu)* sizeof(BezTriple),"duplicateNurb2");
 		memcpy(newnu->bezt, nu->bezt, nu->pntsu*sizeof(BezTriple));
@@ -498,16 +497,16 @@ Nurb *duplicateNurb(Nurb *nu)
 		
 		newnu->knotsu= newnu->knotsv= NULL;
 		
-		if(nu->knotsu) {
+		if (nu->knotsu) {
 			len= KNOTSU(nu);
-			if(len) {
+			if (len) {
 				newnu->knotsu= MEM_mallocN(len*sizeof(float), "duplicateNurb4");
 				memcpy(newnu->knotsu, nu->knotsu, sizeof(float)*len);
 			}
 		}
-		if(nu->pntsv>1 && nu->knotsv) {
+		if (nu->pntsv>1 && nu->knotsv) {
 			len= KNOTSV(nu);
-			if(len) {
+			if (len) {
 				newnu->knotsv= MEM_mallocN(len*sizeof(float), "duplicateNurb5");
 				memcpy(newnu->knotsv, nu->knotsv, sizeof(float)*len);
 			}
@@ -523,7 +522,7 @@ void duplicateNurblist(ListBase *lb1, ListBase *lb2)
 	freeNurblist(lb1);
 	
 	nu= lb2->first;
-	while(nu) {
+	while (nu) {
 		nun= duplicateNurb(nu);
 		BLI_addtail(lb1, nun);
 		
@@ -537,13 +536,13 @@ void test2DNurb(Nurb *nu)
 	BPoint *bp;
 	int a;
 	
-	if((nu->flag & CU_2D)==0)
+	if ((nu->flag & CU_2D)==0)
 		return;
 
-	if(nu->type == CU_BEZIER) {
+	if (nu->type == CU_BEZIER) {
 		a= nu->pntsu;
 		bezt= nu->bezt;
-		while(a--) {
+		while (a--) {
 			bezt->vec[0][2]= 0.0; 
 			bezt->vec[1][2]= 0.0; 
 			bezt->vec[2][2]= 0.0;
@@ -553,7 +552,7 @@ void test2DNurb(Nurb *nu)
 	else {
 		a= nu->pntsu*nu->pntsv;
 		bp= nu->bp;
-		while(a--) {
+		while (a--) {
 			bp->vec[2]= 0.0;
 			bp++;
 		}
@@ -566,10 +565,10 @@ void minmaxNurb(Nurb *nu, float *min, float *max)
 	BPoint *bp;
 	int a;
 
-	if(nu->type == CU_BEZIER) {
+	if (nu->type == CU_BEZIER) {
 		a= nu->pntsu;
 		bezt= nu->bezt;
-		while(a--) {
+		while (a--) {
 			DO_MINMAX(bezt->vec[0], min, max);
 			DO_MINMAX(bezt->vec[1], min, max);
 			DO_MINMAX(bezt->vec[2], min, max);
@@ -579,7 +578,7 @@ void minmaxNurb(Nurb *nu, float *min, float *max)
 	else {
 		a= nu->pntsu*nu->pntsv;
 		bp= nu->bp;
-		while(a--) {
+		while (a--) {
 			DO_MINMAX(bp->vec, min, max);
 			bp++;
 		}
@@ -593,14 +592,14 @@ void addNurbPoints(Nurb *nu, int number)
 	int i;
 	nu->bp= (BPoint *)MEM_mallocN((nu->pntsu + number) * sizeof(BPoint), "rna_Curve_spline_points_add");
 
-	if(tmp) {
+	if (tmp) {
 		memmove(nu->bp, tmp, nu->pntsu * sizeof(BPoint));
 		MEM_freeN(tmp);
 	}
 
 	memset(nu->bp + nu->pntsu, 0, number * sizeof(BPoint));
 
-	for(i=0, tmp= nu->bp + nu->pntsu; i < number; i++, tmp++) {
+	for (i=0, tmp= nu->bp + nu->pntsu; i < number; i++, tmp++) {
 		tmp->radius= 1.0f;
 	}
 
@@ -613,14 +612,14 @@ void addNurbPointsBezier(Nurb *nu, int number)
 	int i;
 	nu->bezt= (BezTriple *)MEM_mallocN((nu->pntsu + number) * sizeof(BezTriple), "rna_Curve_spline_points_add");
 
-	if(tmp) {
+	if (tmp) {
 		memmove(nu->bezt, tmp, nu->pntsu * sizeof(BezTriple));
 		MEM_freeN(tmp);
 	}
 
 	memset(nu->bezt + nu->pntsu, 0, number * sizeof(BezTriple));
 
-	for(i=0, tmp= nu->bezt + nu->pntsu; i < number; i++, tmp++) {
+	for (i=0, tmp= nu->bezt + nu->pntsu; i < number; i++, tmp++) {
 		tmp->radius= 1.0f;
 	}
 
@@ -640,25 +639,25 @@ static void calcknots(float *knots, const short pnts, const short order, const s
 	switch(flag & (CU_NURB_ENDPOINT|CU_NURB_BEZIER)) {
 	case CU_NURB_ENDPOINT:
 		k= 0.0;
-		for(a=1; a <= pnts_order; a++) {
+		for (a=1; a <= pnts_order; a++) {
 			knots[a-1]= k;
-			if(a >= order && a <= pnts) k+= 1.0f;
+			if (a >= order && a <= pnts) k+= 1.0f;
 		}
 		break;
 	case CU_NURB_BEZIER:
 		/* Warning, the order MUST be 2 or 4,
 		 * if this is not enforced, the displist will be corrupt */
-		if(order==4) {
+		if (order==4) {
 			k= 0.34;
-			for(a=0; a < pnts_order; a++) {
+			for (a=0; a < pnts_order; a++) {
 				knots[a]= floorf(k);
 				k+= (1.0f/3.0f);
 			}
 		}
-		else if(order==3) {
+		else if (order==3) {
 			k= 0.6f;
-			for(a=0; a < pnts_order; a++) {
-				if(a >= order && a <= pnts) k+= 0.5f;
+			for (a=0; a < pnts_order; a++) {
+				if (a >= order && a <= pnts) k+= 0.5f;
 				knots[a]= floorf(k);
 			}
 		}
@@ -667,7 +666,7 @@ static void calcknots(float *knots, const short pnts, const short order, const s
 		}
 		break;
 	default:
-		for(a=0; a < pnts_order; a++) {
+		for (a=0; a < pnts_order; a++) {
 			knots[a]= (float)a;
 		}
 		break;
@@ -679,22 +678,22 @@ static void makecyclicknots(float *knots, short pnts, short order)
 {
 	int a, b, order2, c;
 
-	if(knots==NULL) return;
+	if (knots==NULL) return;
 
 	order2=order-1;
 
 	/* do first long rows (order -1), remove identical knots at endpoints */
-	if(order>2) {
+	if (order>2) {
 		b= pnts+order2;
-		for(a=1; a<order2; a++) {
-			if(knots[b]!= knots[b-a]) break;
+		for (a=1; a<order2; a++) {
+			if (knots[b]!= knots[b-a]) break;
 		}
-		if(a==order2) knots[pnts+order-2]+= 1.0f;
+		if (a==order2) knots[pnts+order-2]+= 1.0f;
 	}
 
 	b= order;
 		c=pnts + order + order2;
-	for(a=pnts+order2; a<c; a++) {
+	for (a=pnts+order2; a<c; a++) {
 		knots[a]= knots[a-1]+ (knots[b]-knots[b-1]);
 		b--;
 	}
@@ -704,28 +703,31 @@ static void makecyclicknots(float *knots, short pnts, short order)
 
 static void makeknots(Nurb *nu, short uv)
 {
-	if(nu->type == CU_NURBS) {
-		if(uv == 1) {
-			if(nu->knotsu) MEM_freeN(nu->knotsu);
-			if(check_valid_nurb_u(nu)) {
+	if (nu->type == CU_NURBS) {
+		if (uv == 1) {
+			if (nu->knotsu) MEM_freeN(nu->knotsu);
+			if (check_valid_nurb_u(nu)) {
 				nu->knotsu= MEM_callocN(4+sizeof(float)*KNOTSU(nu), "makeknots");
-				if(nu->flagu & CU_NURB_CYCLIC) {
+				if (nu->flagu & CU_NURB_CYCLIC) {
 					calcknots(nu->knotsu, nu->pntsu, nu->orderu, 0);  /* cyclic should be uniform */
 					makecyclicknots(nu->knotsu, nu->pntsu, nu->orderu);
-				} else {
+				}
+				else {
 					calcknots(nu->knotsu, nu->pntsu, nu->orderu, nu->flagu);
 				}
 			}
 			else nu->knotsu= NULL;
 		
-		} else if(uv == 2) {
-			if(nu->knotsv) MEM_freeN(nu->knotsv);
-			if(check_valid_nurb_v(nu)) {
+		}
+		else if (uv == 2) {
+			if (nu->knotsv) MEM_freeN(nu->knotsv);
+			if (check_valid_nurb_v(nu)) {
 				nu->knotsv= MEM_callocN(4+sizeof(float)*KNOTSV(nu), "makeknots");
-				if(nu->flagv & CU_NURB_CYCLIC) {
+				if (nu->flagv & CU_NURB_CYCLIC) {
 					calcknots(nu->knotsv, nu->pntsv, nu->orderv, 0);  /* cyclic should be uniform */
 					makecyclicknots(nu->knotsv, nu->pntsv, nu->orderv);
-				} else {
+				}
+				else {
 					calcknots(nu->knotsv, nu->pntsv, nu->orderv, nu->flagv);
 				}
 			}
@@ -753,19 +755,19 @@ static void basisNurb(float t, short order, short pnts, float *knots, float *bas
 		opp2 = orderpluspnts-1;
 
 	/* this is for float inaccuracy */
-	if(t < knots[0]) t= knots[0];
-	else if(t > knots[opp2]) t= knots[opp2];
+	if (t < knots[0]) t= knots[0];
+	else if (t > knots[opp2]) t= knots[opp2];
 
 	/* this part is order '1' */
 		o2 = order + 1;
-	for(i=0;i<opp2;i++) {
-		if(knots[i]!=knots[i+1] && t>= knots[i] && t<=knots[i+1]) {
+	for (i=0;i<opp2;i++) {
+		if (knots[i]!=knots[i+1] && t>= knots[i] && t<=knots[i+1]) {
 			basis[i]= 1.0;
 			i1= i-o2;
-			if(i1<0) i1= 0;
+			if (i1<0) i1= 0;
 			i2= i;
 			i++;
-			while(i<opp2) {
+			while (i<opp2) {
 				basis[i]= 0.0;
 				i++;
 			}
@@ -776,17 +778,17 @@ static void basisNurb(float t, short order, short pnts, float *knots, float *bas
 	basis[i]= 0.0;
 	
 	/* this is order 2,3,... */
-	for(j=2; j<=order; j++) {
+	for (j=2; j<=order; j++) {
 
-		if(i2+j>= orderpluspnts) i2= opp2-j;
+		if (i2+j>= orderpluspnts) i2= opp2-j;
 
-		for(i= i1; i<=i2; i++) {
-			if(basis[i]!=0.0f)
+		for (i= i1; i<=i2; i++) {
+			if (basis[i]!=0.0f)
 				d= ((t-knots[i])*basis[i]) / (knots[i+j-1]-knots[i]);
 			else
 				d= 0.0f;
 
-			if(basis[i+1] != 0.0f)
+			if (basis[i+1] != 0.0f)
 				e= ((knots[i+j]-t)*basis[i+1]) / (knots[i+j]-knots[i+1]);
 			else
 				e= 0.0;
@@ -798,10 +800,10 @@ static void basisNurb(float t, short order, short pnts, float *knots, float *bas
 	*start= 1000;
 	*end= 0;
 
-	for(i=i1; i<=i2; i++) {
-		if(basis[i] > 0.0f) {
+	for (i=i1; i<=i2; i++) {
+		if (basis[i] > 0.0f) {
 			*end= i;
-			if(*start==1000) *start= i;
+			if (*start==1000) *start= i;
 		}
 	}
 }
@@ -818,21 +820,21 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int
 	
 	int totu = nu->pntsu*resolu, totv = nu->pntsv*resolv;
 	
-	if(nu->knotsu==NULL || nu->knotsv==NULL) return;
-	if(nu->orderu>nu->pntsu) return;
-	if(nu->orderv>nu->pntsv) return;
-	if(coord_array==NULL) return;
+	if (nu->knotsu==NULL || nu->knotsv==NULL) return;
+	if (nu->orderu>nu->pntsu) return;
+	if (nu->orderv>nu->pntsv) return;
+	if (coord_array==NULL) return;
 	
 	/* allocate and initialize */
 	len = totu * totv;
-	if(len==0) return;
+	if (len==0) return;
 	
 
 	
 	sum= (float *)MEM_callocN(sizeof(float)*len, "makeNurbfaces1");
 	
 	len= totu*totv;
-	if(len==0) {
+	if (len==0) {
 		MEM_freeN(sum);
 		return;
 	}
@@ -840,8 +842,8 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int
 	bp= nu->bp;
 	i= nu->pntsu*nu->pntsv;
 	ratcomp=0;
-	while(i--) {
-		if(bp->vec[3] != 1.0f) {
+	while (i--) {
+		if (bp->vec[3] != 1.0f) {
 			ratcomp= 1;
 			break;
 		}
@@ -850,7 +852,7 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int
 	
 	fp= nu->knotsu;
 	ustart= fp[nu->orderu-1];
-	if(nu->flagu & CU_NURB_CYCLIC) uend= fp[nu->pntsu+nu->orderu-1];
+	if (nu->flagu & CU_NURB_CYCLIC) uend= fp[nu->pntsu+nu->orderu-1];
 	else uend= fp[nu->pntsu];
 	ustep= (uend-ustart)/((nu->flagu & CU_NURB_CYCLIC) ? totu : totu - 1);
 	
@@ -859,7 +861,7 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int
 	fp= nu->knotsv;
 	vstart= fp[nu->orderv-1];
 	
-	if(nu->flagv & CU_NURB_CYCLIC) vend= fp[nu->pntsv+nu->orderv-1];
+	if (nu->flagv & CU_NURB_CYCLIC) vend= fp[nu->pntsv+nu->orderv-1];
 	else vend= fp[nu->pntsv];
 	vstep= (vend-vstart)/((nu->flagv & CU_NURB_CYCLIC) ? totv : totv - 1);
 	
@@ -869,29 +871,29 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int
 	jend= (int *)MEM_mallocN(sizeof(float)*totv, "makeNurbfaces5");
 
 	/* precalculation of basisv and jstart,jend */
-	if(nu->flagv & CU_NURB_CYCLIC) cycl= nu->orderv-1; 
+	if (nu->flagv & CU_NURB_CYCLIC) cycl= nu->orderv-1; 
 	else cycl= 0;
 	v= vstart;
 	basis= basisv;
 	curv= totv;
-	while(curv--) {
+	while (curv--) {
 		basisNurb(v, nu->orderv, (short)(nu->pntsv+cycl), nu->knotsv, basis, jstart+curv, jend+curv);
 		basis+= KNOTSV(nu);
 		v+= vstep;
 	}
 
-	if(nu->flagu & CU_NURB_CYCLIC) cycl= nu->orderu-1; 
+	if (nu->flagu & CU_NURB_CYCLIC) cycl= nu->orderu-1; 
 	else cycl= 0;
 	in= coord_array;
 	u= ustart;
 	curu= totu;
-	while(curu--) {
+	while (curu--) {
 
 		basisNurb(u, nu->orderu, (short)(nu->pntsu+cycl), nu->knotsu, basisu, &istart, &iend);
 
 		basis= basisv;
 		curv= totv;
-		while(curv--) {
+		while (curv--) {
 
 			jsta= jstart[curv];
 			jen= jend[curv];
@@ -900,21 +902,21 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int
 			sumdiv= 0.0;
 			fp= sum;
 
-			for(j= jsta; j<=jen; j++) {
+			for (j= jsta; j<=jen; j++) {
 
-				if(j>=nu->pntsv) jofs= (j - nu->pntsv);
+				if (j>=nu->pntsv) jofs= (j - nu->pntsv);
 				else jofs= j;
 				bp= nu->bp+ nu->pntsu*jofs+istart-1;
 
-				for(i= istart; i<=iend; i++, fp++) {
+				for (i= istart; i<=iend; i++, fp++) {
 
-					if(i>= nu->pntsu) {
+					if (i>= nu->pntsu) {
 						iofs= i- nu->pntsu;
 						bp= nu->bp+ nu->pntsu*jofs+iofs;
 					}
 					else bp++;
 
-					if(ratcomp) {
+					if (ratcomp) {
 						*fp= basisu[i]*basis[j]*bp->vec[3];
 						sumdiv+= *fp;
 					}
@@ -922,10 +924,10 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int
 				}
 			}
 		
-			if(ratcomp) {
+			if (ratcomp) {
 				fp= sum;
-				for(j= jsta; j<=jen; j++) {
-					for(i= istart; i<=iend; i++, fp++) {
+				for (j= jsta; j<=jen; j++) {
+					for (i= istart; i<=iend; i++, fp++) {
 						*fp/= sumdiv;
 					}
 				}
@@ -933,21 +935,21 @@ void makeNurbfaces(Nurb *nu, float *coord_array, int rowstride, int resolu, int
 
 			/* one! (1.0) real point now */
 			fp= sum;
-			for(j= jsta; j<=jen; j++) {
+			for (j= jsta; j<=jen; j++) {
 
-				if(j>=nu->pntsv) jofs= (j - nu->pntsv);
+				if (j>=nu->pntsv) jofs= (j - nu->pntsv);
 				else jofs= j;
 				bp= nu->bp+ nu->pntsu*jofs+istart-1;
 
-				for(i= istart; i<=iend; i++, fp++) {
+				for (i= istart; i<=iend; i++, fp++) {
 
-					if(i>= nu->pntsu) {
+					if (i>= nu->pntsu) {
 						iofs= i- nu->pntsu;
 						bp= nu->bp+ nu->pntsu*jofs+iofs;
 					}
 					else bp++;
 
-					if(*fp != 0.0f) {
+					if (*fp != 0.0f) {
 						in[0]+= (*fp) * bp->vec[0];
 						in[1]+= (*fp) * bp->vec[1];
 						in[2]+= (*fp) * bp->vec[2];
@@ -980,53 +982,53 @@ void makeNurbcurve(Nurb *nu, float *coord_array, float *tilt_array, float *radiu
 	float *coord_fp= coord_array, *tilt_fp= tilt_array, *radius_fp= radius_array, *weight_fp= weight_array;
 	int i, len, istart, iend, cycl;
 
-	if(nu->knotsu==NULL) return;
-	if(nu->orderu>nu->pntsu) return;
-	if(coord_array==NULL) return;
+	if (nu->knotsu==NULL) return;
+	if (nu->orderu>nu->pntsu) return;
+	if (coord_array==NULL) return;
 
 	/* allocate and initialize */
 	len= nu->pntsu;
-	if(len==0) return;
+	if (len==0) return;
 	sum= (float *)MEM_callocN(sizeof(float)*len, "makeNurbcurve1");
 	
 	resolu= (resolu*SEGMENTSU(nu));
 	
-	if(resolu==0) {
+	if (resolu==0) {
 		MEM_freeN(sum);
 		return;
 	}
 
 	fp= nu->knotsu;
 	ustart= fp[nu->orderu-1];
-	if(nu->flagu & CU_NURB_CYCLIC) uend= fp[nu->pntsu+nu->orderu-1];
+	if (nu->flagu & CU_NURB_CYCLIC) uend= fp[nu->pntsu+nu->orderu-1];
 	else uend= fp[nu->pntsu];
 	ustep= (uend-ustart)/(resolu - ((nu->flagu & CU_NURB_CYCLIC) ? 0 : 1));
 	
 	basisu= (float *)MEM_mallocN(sizeof(float)*KNOTSU(nu), "makeNurbcurve3");
 
-	if(nu->flagu & CU_NURB_CYCLIC) cycl= nu->orderu-1; 
+	if (nu->flagu & CU_NURB_CYCLIC) cycl= nu->orderu-1; 
 	else cycl= 0;
 
 	u= ustart;
-	while(resolu--) {
+	while (resolu--) {
 
 		basisNurb(u, nu->orderu, (short)(nu->pntsu+cycl), nu->knotsu, basisu, &istart, &iend);
 		/* calc sum */
 		sumdiv= 0.0;
 		fp= sum;
 		bp= nu->bp+ istart-1;
-		for(i= istart; i<=iend; i++, fp++) {
+		for (i= istart; i<=iend; i++, fp++) {
 
-			if(i>=nu->pntsu) bp= nu->bp+(i - nu->pntsu);
+			if (i>=nu->pntsu) bp= nu->bp+(i - nu->pntsu);
 			else bp++;
 
 			*fp= basisu[i]*bp->vec[3];
 			sumdiv+= *fp;
 		}
-		if(sumdiv != 0.0f) if(sumdiv < 0.999f || sumdiv > 1.001f) {
+		if (sumdiv != 0.0f) if (sumdiv < 0.999f || sumdiv > 1.001f) {
 			/* is normalizing needed? */
 			fp= sum;
-			for(i= istart; i<=iend; i++, fp++) {
+			for (i= istart; i<=iend; i++, fp++) {
 				*fp/= sumdiv;
 			}
 		}
@@ -1034,12 +1036,12 @@ void makeNurbcurve(Nurb *nu, float *coord_array, float *tilt_array, float *radiu
 		/* one! (1.0) real point */
 		fp= sum;
 		bp= nu->bp+ istart-1;
-		for(i= istart; i<=iend; i++, fp++) {
+		for (i= istart; i<=iend; i++, fp++) {
 
-			if(i>=nu->pntsu) bp= nu->bp+(i - nu->pntsu);
+			if (i>=nu->pntsu) bp= nu->bp+(i - nu->pntsu);
 			else bp++;
 
-			if(*fp != 0.0f) {
+			if (*fp != 0.0f) {
 				
 				coord_fp[0]+= (*fp) * bp->vec[0];
 				coord_fp[1]+= (*fp) * bp->vec[1];
@@ -1090,7 +1092,7 @@ void forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int i
 	q2= 2*rt2+6*rt3;
 	q3= 6*rt3;
 
-	for(a=0; a<=it; a++) {
+	for (a=0; a<=it; a++) {
 		*p= q0;
 		p = (float *)(((char *)p)+stride);
 		q0+= q1;
@@ -1106,11 +1108,11 @@ static void forward_diff_bezier_cotangent(float *p0, float *p1, float *p2, float
 	 *
 	 * This could also be optimized like forward_diff_bezier */
 	int a;
-	for(a=0; a<=it; a++) {
+	for (a=0; a<=it; a++) {
 		float t = (float)a / (float)it;
 
 		int i;
-		for(i=0; i<3; i++) {
+		for (i=0; i<3; i++) {
 			p[i]= (-6*t + 6)*p0[i] + (18*t - 12)*p1[i] + (-18*t + 6)*p2[i] + (6*t)*p3[i];
 		}
 		normalize_v3(p);
@@ -1133,15 +1135,15 @@ float *make_orco_surf(Object *ob)
 	
 	/* first calculate the size of the datablock */
 	nu= cu->nurb.first;
-	while(nu) {
+	while (nu) {
 		/* as we want to avoid the seam in a cyclic nurbs
-		texture wrapping, reserve extra orco data space to save these extra needed
-		vertex based UV coordinates for the meridian vertices.
-		Vertices on the 0/2pi boundary are not duplicated inside the displist but later in
-		the renderface/vert construction.
-		
-		See also convertblender.c: init_render_surf()
-		*/
+		 * texture wrapping, reserve extra orco data space to save these extra needed
+		 * vertex based UV coordinates for the meridian vertices.
+		 * Vertices on the 0/2pi boundary are not duplicated inside the displist but later in
+		 * the renderface/vert construction.
+		 *
+		 * See also convertblender.c: init_render_surf()
+		 */
 
 		resolu= cu->resolu_ren ? cu->resolu_ren : nu->resolu;
 		resolv= cu->resolv_ren ? cu->resolv_ren : nu->resolv;
@@ -1150,7 +1152,7 @@ float *make_orco_surf(Object *ob)
 		sizev = nu->pntsv*resolv;
 		if (nu->flagu & CU_NURB_CYCLIC) sizeu++;
 		if (nu->flagv & CU_NURB_CYCLIC) sizev++;
-		if(nu->pntsv>1) tot+= sizeu * sizev;
+		if (nu->pntsv>1) tot+= sizeu * sizev;
 		
 		nu= nu->next;
 	}
@@ -1158,24 +1160,24 @@ float *make_orco_surf(Object *ob)
 	fp= coord_array= MEM_callocN(3*sizeof(float)*tot, "make_orco");
 	
 	nu= cu->nurb.first;
-	while(nu) {
+	while (nu) {
 		resolu= cu->resolu_ren ? cu->resolu_ren : nu->resolu;
 		resolv= cu->resolv_ren ? cu->resolv_ren : nu->resolv;
 
-		if(nu->pntsv>1) {
+		if (nu->pntsv>1) {
 			sizeu = nu->pntsu*resolu;
 			sizev = nu->pntsv*resolv;
 			if (nu->flagu & CU_NURB_CYCLIC) sizeu++;
 			if (nu->flagv & CU_NURB_CYCLIC) sizev++;
 			
-			if(cu->flag & CU_UV_ORCO) {
-				for(b=0; b< sizeu; b++) {
-					for(a=0; a< sizev; a++) {
+			if (cu->flag & CU_UV_ORCO) {
+				for (b=0; b< sizeu; b++) {
+					for (a=0; a< sizev; a++) {
 						
-						if(sizev <2) fp[0]= 0.0f;
+						if (sizev <2) fp[0]= 0.0f;
 						else fp[0]= -1.0f + 2.0f*((float)a)/(sizev - 1);
 						
-						if(sizeu <2) fp[1]= 0.0f;
+						if (sizeu <2) fp[1]= 0.0f;
 						else fp[1]= -1.0f + 2.0f*((float)b)/(sizeu - 1);
 						
 						fp[2]= 0.0;
@@ -1190,12 +1192,12 @@ float *make_orco_surf(Object *ob)
 				
 				makeNurbfaces(nu, tdata, 0, resolu, resolv);
 				
-				for(b=0; b<sizeu; b++) {
+				for (b=0; b<sizeu; b++) {
 					int use_b= b;
 					if (b==sizeu-1 && (nu->flagu & CU_NURB_CYCLIC))
 						use_b= 0;
 					
-					for(a=0; a<sizev; a++) {
+					for (a=0; a<sizev; a++) {
 						int use_a= a;
 						if (a==sizev-1 && (nu->flagv & CU_NURB_CYCLIC))
 							use_a= 0;
@@ -1236,7 +1238,8 @@ float *make_orco_curve(Scene *scene, Object *ob)
 	for (dl=disp.first; dl; dl=dl->next) {
 		if (dl->type==DL_INDEX3) {
 			numVerts += dl->nr;
-		} else if (dl->type==DL_SURF) {
+		}
+		else if (dl->type==DL_SURF) {
 			/* convertblender.c uses the Surface code for creating renderfaces when cyclic U only (closed circle beveling) */
 			if (dl->flag & DL_CYCL_U) {
 				if (dl->flag & DL_CYCL_V)
@@ -1257,7 +1260,8 @@ float *make_orco_curve(Scene *scene, Object *ob)
 					fp[0]= 2.0f*u/(dl->nr-1) - 1.0f;
 					fp[1]= 0.0;
 					fp[2]= 0.0;
-				} else {
+				}
+				else {
 					copy_v3_v3(fp, &dl->verts[u*3]);
 
 					fp[0]= (fp[0]-cu->loc[0])/cu->size[0];
@@ -1265,7 +1269,8 @@ float *make_orco_curve(Scene *scene, Object *ob)
 					fp[2]= (fp[2]-cu->loc[2])/cu->size[2];
 				}
 			}
-		} else if (dl->type==DL_SURF) {
+		}
+		else if (dl->type==DL_SURF) {
 			int sizeu= dl->nr, sizev= dl->parts;
 			
 			/* exception as handled in convertblender.c too */
@@ -1281,7 +1286,8 @@ float *make_orco_curve(Scene *scene, Object *ob)
 						fp[0]= 2.0f*u/(sizev - 1) - 1.0f;
 						fp[1]= 2.0f*v/(sizeu - 1) - 1.0f;
 						fp[2]= 0.0;
-					} else {
+					}
+					else {
 						float *vert;
 						int realv= v % dl->nr;
 						int realu= u % dl->parts;
@@ -1317,13 +1323,13 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
 	disp->first = disp->last = NULL;
 
 	/* if a font object is being edited, then do nothing */
-// XXX	if( ob == obedit && ob->type == OB_FONT ) return;
+// XXX	if ( ob == obedit && ob->type == OB_FONT ) return;
 
-	if(cu->bevobj) {
+	if (cu->bevobj) {
 		if (cu->bevobj->type!=OB_CURVE) return;
 
 		bevcu= cu->bevobj->data;
-		if(bevcu->ext1==0.0f && bevcu->ext2==0.0f) {
+		if (bevcu->ext1==0.0f && bevcu->ext2==0.0f) {
 			ListBase bevdisp= {NULL, NULL};
 			facx= cu->bevobj->size[0];
 			facy= cu->bevobj->size[1];
@@ -1331,27 +1337,28 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
 			if (forRender) {
 				makeDispListCurveTypes_forRender(scene, cu->bevobj, &bevdisp, NULL, 0);
 				dl= bevdisp.first;
-			} else {
+			}
+			else {
 				dl= cu->bevobj->disp.first;
-				if(dl==NULL) {
+				if (dl==NULL) {
 					makeDispListCurveTypes(scene, cu->bevobj, 0);
 					dl= cu->bevobj->disp.first;
 				}
 			}
 
-			while(dl) {
-				if ELEM(dl->type, DL_POLY, DL_SEGM) {
+			while (dl) {
+				if (ELEM(dl->type, DL_POLY, DL_SEGM)) {
 					dlnew= MEM_mallocN(sizeof(DispList), "makebevelcurve1");
 					*dlnew= *dl;
 					dlnew->verts= MEM_mallocN(3*sizeof(float)*dl->parts*dl->nr, "makebevelcurve1");
 					memcpy(dlnew->verts, dl->verts, 3*sizeof(float)*dl->parts*dl->nr);
 
-					if(dlnew->type==DL_SEGM) dlnew->flag |= (DL_FRONT_CURVE|DL_BACK_CURVE);
+					if (dlnew->type==DL_SEGM) dlnew->flag |= (DL_FRONT_CURVE|DL_BACK_CURVE);
 
 					BLI_addtail(disp, dlnew);
 					fp= dlnew->verts;
 					nr= dlnew->parts*dlnew->nr;
-					while(nr--) {
+					while (nr--) {
 						fp[2]= fp[1]*facy;
 						fp[1]= -fp[0]*facx;
 						fp[0]= 0.0;
@@ -1364,10 +1371,10 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
 			freedisplist(&bevdisp);
 		}
 	}
-	else if(cu->ext1==0.0f && cu->ext2==0.0f) {
+	else if (cu->ext1==0.0f && cu->ext2==0.0f) {
 		;
 	}
-	else if(cu->ext2==0.0f) {
+	else if (cu->ext2==0.0f) {
 		dl= MEM_callocN(sizeof(DispList), "makebevelcurve2");
 		dl->verts= MEM_mallocN(2*3*sizeof(float), "makebevelcurve2");
 		BLI_addtail(disp, dl);
@@ -1382,7 +1389,7 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
 		fp[3]= fp[4]= 0.0;
 		fp[5]= cu->ext1;
 	}
-	else if( (cu->flag & (CU_FRONT|CU_BACK))==0 && cu->ext1==0.0f)	{ // we make a full round bevel in that case
+	else if ( (cu->flag & (CU_FRONT|CU_BACK))==0 && cu->ext1==0.0f)	{ // we make a full round bevel in that case
 		
 		nr= 4+ 2*cu->bevresol;
 		   
@@ -1399,7 +1406,7 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
 		dangle= (2.0f*(float)M_PI/(nr));
 		angle= -(nr-1)*dangle;
 		
-		for(a=0; a<nr; a++) {
+		for (a=0; a<nr; a++) {
 			fp[0]= 0.0;
 			fp[1]= (cosf(angle)*(cu->ext2));
 			fp[2]= (sinf(angle)*(cu->ext2)) - cu->ext1;
@@ -1413,9 +1420,9 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
 		/* bevel now in three parts, for proper vertex normals */
 		/* part 1, back */
 
-		if((cu->flag & CU_BACK) || !(cu->flag & CU_FRONT)) {
+		if ((cu->flag & CU_BACK) || !(cu->flag & CU_FRONT)) {
 			dnr= nr= 2+ cu->bevresol;
-			if( (cu->flag & (CU_FRONT|CU_BACK))==0)
+			if ( (cu->flag & (CU_FRONT|CU_BACK))==0)
 				nr= 3+ 2*cu->bevresol;
 
 			dl= MEM_callocN(sizeof(DispList), "makebevelcurve p1");
@@ -1431,7 +1438,7 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
 			dangle= (0.5*M_PI/(dnr-1));
 			angle= -(nr-1)*dangle;
 
-			for(a=0; a<nr; a++) {
+			for (a=0; a<nr; a++) {
 				fp[0]= 0.0;
 				fp[1]= (float)(cosf(angle)*(cu->ext2));
 				fp[2]= (float)(sinf(angle)*(cu->ext2)) - cu->ext1;
@@ -1441,7 +1448,7 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
 		}
 		
 		/* part 2, sidefaces */
-		if(cu->ext1!=0.0f) {
+		if (cu->ext1!=0.0f) {
 			nr= 2;
 			
 			dl= MEM_callocN(sizeof(DispList), "makebevelcurve p2");
@@ -1457,7 +1464,7 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
 			fp[4]= cu->ext2;
 			fp[5]= cu->ext1;
 			
-			if( (cu->flag & (CU_FRONT|CU_BACK))==0) {
+			if ( (cu->flag & (CU_FRONT|CU_BACK))==0) {
 				dl= MEM_dupallocN(dl);
 				dl->verts= MEM_dupallocN(dl->verts);
 				BLI_addtail(disp, dl);
@@ -1471,9 +1478,9 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
 		}
 		
 		/* part 3, front */
-		if((cu->flag & CU_FRONT) || !(cu->flag & CU_BACK)) {
+		if ((cu->flag & CU_FRONT) || !(cu->flag & CU_BACK)) {
 			dnr= nr= 2+ cu->bevresol;
-			if( (cu->flag & (CU_FRONT|CU_BACK))==0)
+			if ( (cu->flag & (CU_FRONT|CU_BACK))==0)
 				nr= 3+ 2*cu->bevresol;
 
 			dl= MEM_callocN(sizeof(DispList), "makebevelcurve p3");
@@ -1489,7 +1496,7 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
 			angle= 0.0;
 			dangle= (0.5*M_PI/(dnr-1));
 
-			for(a=0; a<nr; a++) {
+			for (a=0; a<nr; a++) {
 				fp[0]= 0.0;
 				fp[1]= (float)(cosf(angle)*(cu->ext2));
 				fp[2]= (float)(sinf(angle)*(cu->ext2)) + cu->ext1;
@@ -1500,34 +1507,37 @@ void makebevelcurve(Scene *scene, Object *ob, ListBase *disp, int forRender)
 	}
 }
 
-static int cu_isectLL(float *v1, float *v2, float *v3, float *v4, short cox, short coy, float *labda, float *mu, float *vec)
+static int cu_isectLL(const float v1[3], const float v2[3], const float v3[3], const float v4[3],
+                      short cox, short coy,
+                      float *labda, float *mu, float vec[3])
 {
 	/* return:
-		-1: colliniar
-		 0: no intersection of segments
-		 1: exact intersection of segments
-		 2: cross-intersection of segments
-	*/
+	 * -1: colliniar
+	 *  0: no intersection of segments
+	 *  1: exact intersection of segments
+	 *  2: cross-intersection of segments
+	 */
 	float deler;
 
 	deler= (v1[cox]-v2[cox])*(v3[coy]-v4[coy])-(v3[cox]-v4[cox])*(v1[coy]-v2[coy]);
-	if(deler==0.0f) return -1;
+	if (deler==0.0f) return -1;
 
 	*labda= (v1[coy]-v3[coy])*(v3[cox]-v4[cox])-(v1[cox]-v3[cox])*(v3[coy]-v4[coy]);
 	*labda= -(*labda/deler);
 
 	deler= v3[coy]-v4[coy];
-	if(deler==0) {
+	if (deler==0) {
 		deler=v3[cox]-v4[cox];
 		*mu= -(*labda*(v2[cox]-v1[cox])+v1[cox]-v3[cox])/deler;
-	} else {
+	}
+	else {
 		*mu= -(*labda*(v2[coy]-v1[coy])+v1[coy]-v3[coy])/deler;
 	}
 	vec[cox]= *labda*(v2[cox]-v1[cox])+v1[cox];
 	vec[coy]= *labda*(v2[coy]-v1[coy])+v1[coy];
 
-	if(*labda>=0.0f && *labda<=1.0f && *mu>=0.0f && *mu<=1.0f) {
-		if(*labda==0.0f || *labda==1.0f || *mu==0.0f || *mu==1.0f) return 1;
+	if (*labda>=0.0f && *labda<=1.0f && *mu>=0.0f && *mu<=1.0f) {
+		if (*labda==0.0f || *labda==1.0f || *mu==0.0f || *mu==1.0f) return 1;
 		return 2;
 	}
 	return 0;
@@ -1558,22 +1568,22 @@ static short bevelinside(BevList *bl1,BevList *bl2)
 	nr= bl1->nr;
 	prevbevp= bevp+(nr-1);
 
-	while(nr--) {
+	while (nr--) {
 		min= prevbevp->vec[1];
 		max= bevp->vec[1];
-		if(max<min) {
+		if (max<min) {
 			min= max;
 			max= prevbevp->vec[1];
 		}
-		if(min!=max) {
-			if(min<=hvec1[1] && max>=hvec1[1]) {
+		if (min!=max) {
+			if (min<=hvec1[1] && max>=hvec1[1]) {
 				/* there's a transition, calc intersection point */
 				mode= cu_isectLL(prevbevp->vec, bevp->vec, hvec1, hvec2, 0, 1, &lab, &mu, vec);
 				/* if lab==0.0 or lab==1.0 then the edge intersects exactly a transition
-					   only allow for one situation: we choose lab= 1.0
+				 * only allow for one situation: we choose lab= 1.0
 				 */
-				if(mode >= 0 && lab != 0.0f) {
-					if(vec[0]<hvec1[0]) links++;
+				if (mode >= 0 && lab != 0.0f) {
+					if (vec[0]<hvec1[0]) links++;
 					else rechts++;
 				}
 			}
@@ -1582,7 +1592,7 @@ static short bevelinside(BevList *bl1,BevList *bl2)
 		bevp++;
 	}
 	
-	if( (links & 1) && (rechts & 1) ) return 1;
+	if ( (links & 1) && (rechts & 1) ) return 1;
 	return 0;
 }
 
@@ -1597,8 +1607,8 @@ static int vergxcobev(const void *a1, const void *a2)
 {
 	const struct bevelsort *x1=a1,*x2=a2;
 
-	if( x1->left > x2->left ) return 1;
-	else if( x1->left < x2->left) return -1;
+	if ( x1->left > x2->left ) return 1;
+	else if ( x1->left < x2->left) return -1;
 	return 0;
 }
 
@@ -1610,8 +1620,8 @@ static void calc_bevel_sin_cos(float x1, float y1, float x2, float y2, float *si
 
 	t01= (float)sqrt(x1*x1+y1*y1);
 	t02= (float)sqrt(x2*x2+y2*y2);
-	if(t01==0.0f) t01= 1.0f;
-	if(t02==0.0f) t02= 1.0f;
+	if (t01==0.0f) t01= 1.0f;
+	if (t02==0.0f) t02= 1.0f;
 
 	x1/=t01; 
 	y1/=t01;
@@ -1619,18 +1629,19 @@ static void calc_bevel_sin_cos(float x1, float y1, float x2, float y2, float *si
 	y2/=t02;
 
 	t02= x1*x2+y1*y2;
-	if(fabs(t02)>=1.0) t02= .5*M_PI;
+	if (fabs(t02)>=1.0) t02= .5*M_PI;
 	else t02= (saacos(t02))/2.0f;
 
 	t02= (float)sin(t02);
-	if(t02==0.0f) t02= 1.0f;
+	if (t02==0.0f) t02= 1.0f;
 
 	x3= x1-x2;
 	y3= y1-y2;
-	if(x3==0 && y3==0) {
+	if (x3==0 && y3==0) {
 		x3= y1;
 		y3= -x1;
-	} else {
+	}
+	else {
 		t01= (float)sqrt(x3*x3+y3*y3);
 		x3/=t01; 
 		y3/=t01;
@@ -1647,21 +1658,21 @@ static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *
 	float fac, dfac, t[4];
 	int a;
 	
-	if(tilt_array==NULL && radius_array==NULL)
+	if (tilt_array==NULL && radius_array==NULL)
 		return;
 	
 	last= nu->bezt+(nu->pntsu-1);
 	
 	/* returns a point */
-	if(prevbezt==nu->bezt) {
-		if(nu->flagu & CU_NURB_CYCLIC) pprev= last;
+	if (prevbezt==nu->bezt) {
+		if (nu->flagu & CU_NURB_CYCLIC) pprev= last;
 		else pprev= prevbezt;
 	}
 	else pprev= prevbezt-1;
 	
 	/* next point */
-	if(bezt==last) {
-		if(nu->flagu & CU_NURB_CYCLIC) next= nu->bezt;
+	if (bezt==last) {
+		if (nu->flagu & CU_NURB_CYCLIC) next= nu->bezt;
 		else next= bezt;
 	}
 	else next= bezt+1;
@@ -1669,11 +1680,12 @@ static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *
 	fac= 0.0;
 	dfac= 1.0f/(float)resolu;
 	
-	for(a=0; a<resolu; a++, fac+= dfac) {
+	for (a=0; a<resolu; a++, fac+= dfac) {
 		if (tilt_array) {
 			if (nu->tilt_interp==KEY_CU_EASE) { /* May as well support for tilt also 2.47 ease interp */
 				*tilt_array = prevbezt->alfa + (bezt->alfa - prevbezt->alfa)*(3.0f*fac*fac - 2.0f*fac*fac*fac);
-			} else {
+			}
+			else {
 				key_curve_position_weights(fac, t, nu->tilt_interp);
 				*tilt_array= t[0]*pprev->alfa + t[1]*prevbezt->alfa + t[2]*bezt->alfa + t[3]*next->alfa;
 			}
@@ -1687,7 +1699,8 @@ static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *
 				 * Note! - this only takes the 2 points into account,
 				 * giving much more localized results to changes in radius, sometimes you want that */
 				*radius_array = prevbezt->radius + (bezt->radius - prevbezt->radius)*(3.0f*fac*fac - 2.0f*fac*fac*fac);
-			} else {
+			}
+			else {
 				
 				/* reuse interpolation from tilt if we can */
 				if (tilt_array==NULL || nu->tilt_interp != nu->radius_interp) {
@@ -1699,7 +1712,7 @@ static void alfa_bezpart(BezTriple *prevbezt, BezTriple *bezt, Nurb *nu, float *
 			radius_array = (float *)(((char *)radius_array) + stride); 
 		}
 
-		if(weight_array) {
+		if (weight_array) {
 			/* basic interpolation for now, could copy tilt interp too  */
 			*weight_array = prevbezt->weight + (bezt->weight - prevbezt->weight)*(3.0f*fac*fac - 2.0f*fac*fac*fac);
 
@@ -1740,7 +1753,7 @@ static void bevel_list_calc_bisect(BevList *bl)
 	bevp0= bevp1-1;
 
 	nr= bl->nr;
-	while(nr--) {
+	while (nr--) {
 		/* totally simple */
 		bisect_v3_v3v3v3(bevp1->dir, bevp0->vec, bevp1->vec, bevp2->vec);
 
@@ -1759,8 +1772,8 @@ static void bevel_list_flip_tangents(BevList *bl)
 	bevp0= bevp1-1;
 
 	nr= bl->nr;
-	while(nr--) {
-		if(RAD2DEGF(angle_v2v2(bevp0->tan, bevp1->tan)) > 90.0f)
+	while (nr--) {
+		if (RAD2DEGF(angle_v2v2(bevp0->tan, bevp1->tan)) > 90.0f)
 			negate_v3(bevp1->tan);
 
 		bevp0= bevp1;
@@ -1779,7 +1792,7 @@ static void bevel_list_apply_tilt(BevList *bl)
 	bevp1= bevp2+(bl->nr-1);
 
 	nr= bl->nr;
-	while(nr--) {
+	while (nr--) {
 		axis_angle_to_quat(q, bevp1->dir, bevp1->alfa);
 		mul_qt_qtqt(bevp1->quat, q, bevp1->quat);
 		normalize_qt(bevp1->quat);
@@ -1798,7 +1811,7 @@ static void bevel_list_smooth(BevList *bl, int smooth_iter)
 	float bevp0_quat[4];
 	int a;
 
-	for(a=0; a < smooth_iter; a++) {
+	for (a=0; a < smooth_iter; a++) {
 
 		bevp2= (BevPoint *)(bl+1);
 		bevp1= bevp2+(bl->nr-1);
@@ -1806,7 +1819,7 @@ static void bevel_list_smooth(BevList *bl, int smooth_iter)
 
 		nr= bl->nr;
 
-		if(bl->poly== -1) { /* check its not cyclic */
+		if (bl->poly== -1) { /* check its not cyclic */
 			/* skip the first point */
 			/* bevp0= bevp1; */
 			bevp1= bevp2;
@@ -1822,7 +1835,7 @@ static void bevel_list_smooth(BevList *bl, int smooth_iter)
 
 		copy_qt_qt(bevp0_quat, bevp0->quat);
 
-		while(nr--) {
+		while (nr--) {
 			/* interpolate quats */
 			float zaxis[3] = {0,0,1}, cross[3], q2[4];
 			interp_qt_qtqt(q, bevp0_quat, bevp2->quat, 0.5);
@@ -1856,7 +1869,7 @@ static void make_bevel_list_3D_zup(BevList *bl)
 	bevp0= bevp1-1;
 
 	nr= bl->nr;
-	while(nr--) {
+	while (nr--) {
 		/* totally simple */
 		bisect_v3_v3v3v3(bevp1->dir, bevp0->vec, bevp1->vec, bevp2->vec);
 		vec_to_quat( bevp1->quat,bevp1->dir, 5, 1);
@@ -1880,15 +1893,15 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
 	bevp0= bevp1-1;
 
 	nr= bl->nr;
-	while(nr--) {
+	while (nr--) {
 
-		if(nr+4 > bl->nr) { /* first time and second time, otherwise first point adjusts last */
+		if (nr+4 > bl->nr) { /* first time and second time, otherwise first point adjusts last */
 			vec_to_quat( bevp1->quat,bevp1->dir, 5, 1);
 		}
 		else {
 			float angle= angle_normalized_v3v3(bevp0->dir, bevp1->dir);
 
-			if(angle > 0.0f) { /* otherwise we can keep as is */
+			if (angle > 0.0f) { /* otherwise we can keep as is */
 				float cross_tmp[3];
 				cross_v3_v3v3(cross_tmp, bevp0->dir, bevp1->dir);
 				axis_angle_to_quat(q, cross_tmp, angle);
@@ -1904,7 +1917,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
 		bevp2++;
 	}
 
-	if(bl->poly != -1) { /* check for cyclic */
+	if (bl->poly != -1) { /* check for cyclic */
 
 		/* Need to correct for the start/end points not matching
 		 * do this by calculating the tilt angle difference, then apply
@@ -1948,7 +1961,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
 		/* flip rotation if needs be */
 		cross_v3_v3v3(cross_tmp, vec_1, vec_2);
 		normalize_v3(cross_tmp);
-		if(angle_normalized_v3v3(bevp_first->dir, cross_tmp) < DEG2RADF(90.0f))
+		if (angle_normalized_v3v3(bevp_first->dir, cross_tmp) < DEG2RADF(90.0f))
 			angle = -angle;
 
 		bevp2= (BevPoint *)(bl+1);
@@ -1956,7 +1969,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl)
 		bevp0= bevp1-1;
 
 		nr= bl->nr;
-		while(nr--) {
+		while (nr--) {
 			ang_fac= angle * (1.0f-((float)nr/bl->nr)); /* also works */
 
 			axis_angle_to_quat(q, bevp1->dir, ang_fac);
@@ -1977,7 +1990,7 @@ static void make_bevel_list_3D_tangent(BevList *bl)
 	float bevp0_tan[3], cross_tmp[3];
 
 	bevel_list_calc_bisect(bl);
-	if(bl->poly== -1) /* check its not cyclic */
+	if (bl->poly== -1) /* check its not cyclic */
 		bevel_list_cyclic_fix_3D(bl); // XXX - run this now so tangents will be right before doing the flipping
 	bevel_list_flip_tangents(bl);
 
@@ -1987,7 +2000,7 @@ static void make_bevel_list_3D_tangent(BevList *bl)
 	bevp0= bevp1-1;
 
 	nr= bl->nr;
-	while(nr--) {
+	while (nr--) {
 
 		cross_v3_v3v3(cross_tmp, bevp1->tan, bevp1->dir);
 		cross_v3_v3v3(bevp1->tan, cross_tmp, bevp1->dir);
@@ -2007,7 +2020,7 @@ static void make_bevel_list_3D_tangent(BevList *bl)
 	copy_v3_v3(bevp0_tan, bevp0->tan);
 
 	nr= bl->nr;
-	while(nr--) {
+	while (nr--) {
 
 		/* make perpendicular, modify tan in place, is ok */
 		float cross_tmp[3];
@@ -2036,10 +2049,10 @@ static void make_bevel_list_3D(BevList *bl, int smooth_iter, int twist_mode)
 		make_bevel_list_3D_zup(bl);
 	}
 
-	if(bl->poly== -1) /* check its not cyclic */
+	if (bl->poly== -1) /* check its not cyclic */
 		bevel_list_cyclic_fix_3D(bl);
 
-	if(smooth_iter)
+	if (smooth_iter)
 		bevel_list_smooth(bl, smooth_iter);
 
 	bevel_list_apply_tilt(bl);
@@ -2073,11 +2086,11 @@ static void make_bevel_list_segment_3D(BevList *bl)
 void makeBevelList(Object *ob)
 {
 	/*
-	 - convert all curves to polys, with indication of resol and flags for double-vertices
-	 - possibly; do a smart vertice removal (in case Nurb)
-	 - separate in individual blicks with BoundBox
-	 - AutoHole detection
-	*/
+	 * - convert all curves to polys, with indication of resol and flags for double-vertices
+	 * - possibly; do a smart vertice removal (in case Nurb)
+	 * - separate in individual blicks with BoundBox
+	 * - AutoHole detection
+	 */
 	Curve *cu;
 	Nurb *nu;
 	BezTriple *bezt, *prevbezt;
@@ -2098,12 +2111,15 @@ void makeBevelList(Object *ob)
 	/* STEP 1: MAKE POLYS  */
 
 	BLI_freelistN(&(cu->bev));
-	if(cu->editnurb && ob->type!=OB_FONT) {
+	if (cu->editnurb && ob->type!=OB_FONT) {
 		ListBase *nurbs= curve_editnurbs(cu);
-		nu= nurbs->first;
-	} else nu= cu->nurb.first;
+		nu = nurbs->first;
+	}
+	else {
+		nu = cu->nurb.first;
+	}
 	
-	while(nu) {
+	while (nu) {
 		
 		/* check if we will calculate tilt data */
 		do_tilt = CU_DO_TILT(cu, nu);
@@ -2112,29 +2128,30 @@ void makeBevelList(Object *ob)
 		
 		/* check we are a single point? also check we are not a surface and that the orderu is sane,
 		 * enforced in the UI but can go wrong possibly */
-		if(!check_valid_nurb_u(nu)) {
+		if (!check_valid_nurb_u(nu)) {
 			bl= MEM_callocN(sizeof(BevList)+1*sizeof(BevPoint), "makeBevelList1");
 			BLI_addtail(&(cu->bev), bl);
 			bl->nr= 0;
-		} else {
-			if(G.rendering && cu->resolu_ren!=0) 
+		}
+		else {
+			if (G.rendering && cu->resolu_ren!=0) 
 				resolu= cu->resolu_ren;
 			else
 				resolu= nu->resolu;
 			
-			if(nu->type == CU_POLY) {
+			if (nu->type == CU_POLY) {
 				len= nu->pntsu;
 				bl= MEM_callocN(sizeof(BevList)+len*sizeof(BevPoint), "makeBevelList2");
 				BLI_addtail(&(cu->bev), bl);
 	
-				if(nu->flagu & CU_NURB_CYCLIC) bl->poly= 0;
+				if (nu->flagu & CU_NURB_CYCLIC) bl->poly= 0;
 				else bl->poly= -1;
 				bl->nr= len;
 				bl->dupe_nr= 0;
 				bevp= (BevPoint *)(bl+1);
 				bp= nu->bp;
 	
-				while(len--) {
+				while (len--) {
 					copy_v3_v3(bevp->vec, bp->vec);
 					bevp->alfa= bp->alfa;
 					bevp->radius= bp->radius;
@@ -2144,19 +2161,19 @@ void makeBevelList(Object *ob)
 					bp++;
 				}
 			}
-			else if(nu->type == CU_BEZIER) {
+			else if (nu->type == CU_BEZIER) {
 	
 				len= resolu*(nu->pntsu+ (nu->flagu & CU_NURB_CYCLIC) -1)+1;	/* in case last point is not cyclic */
 				bl= MEM_callocN(sizeof(BevList)+len*sizeof(BevPoint), "makeBevelBPoints");
 				BLI_addtail(&(cu->bev), bl);
 	
-				if(nu->flagu & CU_NURB_CYCLIC) bl->poly= 0;
+				if (nu->flagu & CU_NURB_CYCLIC) bl->poly= 0;
 				else bl->poly= -1;
 				bevp= (BevPoint *)(bl+1);
 	
 				a= nu->pntsu-1;
 				bezt= nu->bezt;
-				if(nu->flagu & CU_NURB_CYCLIC) {
+				if (nu->flagu & CU_NURB_CYCLIC) {
 					a++;
 					prevbezt= nu->bezt+(nu->pntsu-1);
 				}
@@ -2165,8 +2182,8 @@ void makeBevelList(Object *ob)
 					bezt++;
 				}
 				
-				while(a--) {
-					if(prevbezt->h2==HD_VECT && bezt->h1==HD_VECT) {
+				while (a--) {
+					if (prevbezt->h2==HD_VECT && bezt->h1==HD_VECT) {
 
 						copy_v3_v3(bevp->vec, prevbezt->vec[1]);
 						bevp->alfa= prevbezt->alfa;
@@ -2183,7 +2200,7 @@ void makeBevelList(Object *ob)
 						int j;
 						
 						/* BevPoint must stay aligned to 4 so sizeof(BevPoint)/sizeof(float) works */
-						for(j=0; j<3; j++) {
+						for (j=0; j<3; j++) {
 							forward_diff_bezier(	prevbezt->vec[1][j],	prevbezt->vec[2][j],
 													bezt->vec[0][j],		bezt->vec[1][j],
 													&(bevp->vec[j]), resolu, sizeof(BevPoint));
@@ -2197,7 +2214,7 @@ void makeBevelList(Object *ob)
 										 resolu, sizeof(BevPoint));
 
 						
-						if(cu->twist_mode==CU_TWIST_TANGENT) {
+						if (cu->twist_mode==CU_TWIST_TANGENT) {
 							forward_diff_bezier_cotangent(
 													prevbezt->vec[1],	prevbezt->vec[2],
 													bezt->vec[0],		bezt->vec[1],
@@ -2205,12 +2222,12 @@ void makeBevelList(Object *ob)
 						}
 
 						/* indicate with handlecodes double points */
-						if(prevbezt->h1==prevbezt->h2) {
-							if(prevbezt->h1==0 || prevbezt->h1==HD_VECT) bevp->split_tag= TRUE;
+						if (prevbezt->h1==prevbezt->h2) {
+							if (prevbezt->h1==0 || prevbezt->h1==HD_VECT) bevp->split_tag= TRUE;
 						}
 						else {
-							if(prevbezt->h1==0 || prevbezt->h1==HD_VECT) bevp->split_tag= TRUE;
-							else if(prevbezt->h2==0 || prevbezt->h2==HD_VECT) bevp->split_tag= TRUE;
+							if (prevbezt->h1==0 || prevbezt->h1==HD_VECT) bevp->split_tag= TRUE;
+							else if (prevbezt->h2==0 || prevbezt->h2==HD_VECT) bevp->split_tag= TRUE;
 						}
 						bl->nr+= resolu;
 						bevp+= resolu;
@@ -2219,7 +2236,7 @@ void makeBevelList(Object *ob)
 					bezt++;
 				}
 				
-				if((nu->flagu & CU_NURB_CYCLIC)==0) {	    /* not cyclic: endpoint */
+				if ((nu->flagu & CU_NURB_CYCLIC)==0) {	    /* not cyclic: endpoint */
 					copy_v3_v3(bevp->vec, prevbezt->vec[1]);
 					bevp->alfa= prevbezt->alfa;
 					bevp->radius= prevbezt->radius;
@@ -2227,15 +2244,15 @@ void makeBevelList(Object *ob)
 					bl->nr++;
 				}
 			}
-			else if(nu->type == CU_NURBS) {
-				if(nu->pntsv==1) {
+			else if (nu->type == CU_NURBS) {
+				if (nu->pntsv==1) {
 					len= (resolu*SEGMENTSU(nu));
 					
 					bl= MEM_callocN(sizeof(BevList)+len*sizeof(BevPoint), "makeBevelList3");
 					BLI_addtail(&(cu->bev), bl);
 					bl->nr= len;
 					bl->dupe_nr= 0;
-					if(nu->flagu & CU_NURB_CYCLIC) bl->poly= 0;
+					if (nu->flagu & CU_NURB_CYCLIC) bl->poly= 0;
 					else bl->poly= -1;
 					bevp= (BevPoint *)(bl+1);
 					
@@ -2252,16 +2269,16 @@ void makeBevelList(Object *ob)
 
 	/* STEP 2: DOUBLE POINTS AND AUTOMATIC RESOLUTION, REDUCE DATABLOCKS */
 	bl= cu->bev.first;
-	while(bl) {
+	while (bl) {
 		if (bl->nr) { /* null bevel items come from single points */
 			nr= bl->nr;
 			bevp1= (BevPoint *)(bl+1);
 			bevp0= bevp1+(nr-1);
 			nr--;
-			while(nr--) {
-				if( fabs(bevp0->vec[0]-bevp1->vec[0])<0.00001 ) {
-					if( fabs(bevp0->vec[1]-bevp1->vec[1])<0.00001 ) {
-						if( fabs(bevp0->vec[2]-bevp1->vec[2])<0.00001 ) {
+			while (nr--) {
+				if ( fabs(bevp0->vec[0]-bevp1->vec[0])<0.00001 ) {
+					if ( fabs(bevp0->vec[1]-bevp1->vec[1])<0.00001 ) {
+						if ( fabs(bevp0->vec[2]-bevp1->vec[2])<0.00001 ) {
 							bevp0->dupe_tag= TRUE;
 							bl->dupe_nr++;
 						}
@@ -2274,9 +2291,9 @@ void makeBevelList(Object *ob)
 		bl= bl->next;
 	}
 	bl= cu->bev.first;
-	while(bl) {
+	while (bl) {
 		blnext= bl->next;
-		if(bl->nr && bl->dupe_nr) {
+		if (bl->nr && bl->dupe_nr) {
 			nr= bl->nr- bl->dupe_nr+1;	/* +1 because vectorbezier sets flag too */
 			blnew= MEM_mallocN(sizeof(BevList)+nr*sizeof(BevPoint), "makeBevelList4");
 			memcpy(blnew, bl, sizeof(BevList));
@@ -2286,8 +2303,8 @@ void makeBevelList(Object *ob)
 			bevp0= (BevPoint *)(bl+1);
 			bevp1= (BevPoint *)(blnew+1);
 			nr= bl->nr;
-			while(nr--) {
-				if(bevp0->dupe_tag==0) {
+			while (nr--) {
+				if (bevp0->dupe_tag==0) {
 					memcpy(bevp1, bevp0, sizeof(BevPoint));
 					bevp1++;
 					blnew->nr++;
@@ -2303,8 +2320,8 @@ void makeBevelList(Object *ob)
 	/* STEP 3: POLYS COUNT AND AUTOHOLE */
 	bl= cu->bev.first;
 	poly= 0;
-	while(bl) {
-		if(bl->nr && bl->poly>=0) {
+	while (bl) {
+		if (bl->nr && bl->poly>=0) {
 			poly++;
 			bl->poly= poly;
 			bl->hole= 0;
@@ -2314,17 +2331,17 @@ void makeBevelList(Object *ob)
 	
 
 	/* find extreme left points, also test (turning) direction */
-	if(poly>0) {
+	if (poly>0) {
 		sd= sortdata= MEM_mallocN(sizeof(struct bevelsort)*poly, "makeBevelList5");
 		bl= cu->bev.first;
-		while(bl) {
-			if(bl->poly>0) {
+		while (bl) {
+			if (bl->poly>0) {
 
 				min= 300000.0;
 				bevp= (BevPoint *)(bl+1);
 				nr= bl->nr;
-				while(nr--) {
-					if(min>bevp->vec[0]) {
+				while (nr--) {
+					if (min>bevp->vec[0]) {
 						min= bevp->vec[0];
 						bevp1= bevp;
 					}
@@ -2334,15 +2351,15 @@ void makeBevelList(Object *ob)
 				sd->left= min;
 
 				bevp= (BevPoint *)(bl+1);
-				if(bevp1== bevp) bevp0= bevp+ (bl->nr-1);
+				if (bevp1== bevp) bevp0= bevp+ (bl->nr-1);
 				else bevp0= bevp1-1;
 				bevp= bevp+ (bl->nr-1);
-				if(bevp1== bevp) bevp2= (BevPoint *)(bl+1);
+				if (bevp1== bevp) bevp2= (BevPoint *)(bl+1);
 				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]);
 
-				if(inp > 0.0f) sd->dir= 1;
+				if (inp > 0.0f) sd->dir= 1;
 				else sd->dir= 0;
 
 				sd++;
@@ -2353,11 +2370,11 @@ void makeBevelList(Object *ob)
 		qsort(sortdata,poly,sizeof(struct bevelsort), vergxcobev);
 
 		sd= sortdata+1;
-		for(a=1; a<poly; a++, sd++) {
+		for (a=1; a<poly; a++, sd++) {
 			bl= sd->bl;	    /* is bl a hole? */
 			sd1= sortdata+ (a-1);
-			for(b=a-1; b>=0; b--, sd1--) {	/* all polys to the left */
-				if(bevelinside(sd1->bl, bl)) {
+			for (b=a-1; b>=0; b--, sd1--) {	/* all polys to the left */
+				if (bevelinside(sd1->bl, bl)) {
 					bl->hole= 1- sd1->bl->hole;
 					break;
 				}
@@ -2365,15 +2382,15 @@ void makeBevelList(Object *ob)
 		}
 
 		/* turning direction */
-		if((cu->flag & CU_3D)==0) {
+		if ((cu->flag & CU_3D)==0) {
 			sd= sortdata;
-			for(a=0; a<poly; a++, sd++) {
-				if(sd->bl->hole==sd->dir) {
+			for (a=0; a<poly; a++, sd++) {
+				if (sd->bl->hole==sd->dir) {
 					bl= sd->bl;
 					bevp1= (BevPoint *)(bl+1);
 					bevp2= bevp1+ (bl->nr-1);
 					nr= bl->nr/2;
-					while(nr--) {
+					while (nr--) {
 						SWAP(BevPoint, *bevp1, *bevp2);
 						bevp1++;
 						bevp2--;
@@ -2385,16 +2402,16 @@ void makeBevelList(Object *ob)
 	}
 
 	/* STEP 4: 2D-COSINES or 3D ORIENTATION */
-	if((cu->flag & CU_3D)==0) {
+	if ((cu->flag & CU_3D)==0) {
 		/* note: bevp->dir and bevp->quat are not needed for beveling but are
 		 * used when making a path from a 2D curve, therefor they need to be set - Campbell */
 		bl= cu->bev.first;
-		while(bl) {
+		while (bl) {
 
-			if(bl->nr < 2) {
+			if (bl->nr < 2) {
 				/* do nothing */
 			}
-			else if(bl->nr==2) {	/* 2 pnt, treat separate */
+			else if (bl->nr==2) {	/* 2 pnt, treat separate */
 				bevp2= (BevPoint *)(bl+1);
 				bevp1= bevp2+1;
 
@@ -2414,7 +2431,7 @@ void makeBevelList(Object *ob)
 				bevp0= bevp1-1;
 
 				nr= bl->nr;
-				while(nr--) {
+				while (nr--) {
 					x1= bevp1->vec[0]- bevp0->vec[0];
 					x2= bevp1->vec[0]- bevp2->vec[0];
 					y1= bevp1->vec[1]- bevp0->vec[1];
@@ -2434,7 +2451,7 @@ void makeBevelList(Object *ob)
 				}
 
 				/* correct non-cyclic cases */
-				if(bl->poly== -1) {
+				if (bl->poly== -1) {
 					bevp= (BevPoint *)(bl+1);
 					bevp1= bevp+1;
 					bevp->sina= bevp1->sina;
@@ -2454,12 +2471,12 @@ void makeBevelList(Object *ob)
 	}
 	else { /* 3D Curves */
 		bl= cu->bev.first;
-		while(bl) {
+		while (bl) {
 
-			if(bl->nr < 2) {
+			if (bl->nr < 2) {
 				/* do nothing */
 			}
-			else if(bl->nr==2) {	/* 2 pnt, treat separate */
+			else if (bl->nr==2) {	/* 2 pnt, treat separate */
 				make_bevel_list_segment_3D(bl);
 			}
 			else {
@@ -2478,20 +2495,20 @@ void makeBevelList(Object *ob)
  */
 
 /* mode: is not zero when FCurve, is 2 when forced horizontal for autohandles */
-void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
+static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode, int skip_align)
 {
 	float *p1,*p2,*p3, pt[3];
 	float dvec_a[3], dvec_b[3];
 	float len, len_a, len_b;
 	const float eps= 1e-5;
 
-	if(bezt->h1==0 && bezt->h2==0) {
+	if (bezt->h1==0 && bezt->h2==0) {
 		return;
 	}
 
 	p2= bezt->vec[1];
 
-	if(prev==NULL) {
+	if (prev==NULL) {
 		p3= next->vec[1];
 		pt[0]= 2.0f*p2[0] - p3[0];
 		pt[1]= 2.0f*p2[1] - p3[1];
@@ -2502,7 +2519,7 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
 		p1= prev->vec[1];
 	}
 
-	if(next==NULL) {
+	if (next==NULL) {
 		pt[0]= 2.0f*p2[0] - p1[0];
 		pt[1]= 2.0f*p2[1] - p1[1];
 		pt[2]= 2.0f*p2[2] - p1[2];
@@ -2524,42 +2541,42 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
 		len_b= len_v3(dvec_b);
 	}
 
-	if(len_a==0.0f) len_a=1.0f;
-	if(len_b==0.0f) len_b=1.0f;
+	if (len_a==0.0f) len_a=1.0f;
+	if (len_b==0.0f) len_b=1.0f;
 
 
-	if(ELEM(bezt->h1,HD_AUTO,HD_AUTO_ANIM) || ELEM(bezt->h2,HD_AUTO,HD_AUTO_ANIM)) {    /* auto */
+	if (ELEM(bezt->h1,HD_AUTO,HD_AUTO_ANIM) || ELEM(bezt->h2,HD_AUTO,HD_AUTO_ANIM)) {    /* auto */
 		float tvec[3];
 		tvec[0]= dvec_b[0]/len_b + dvec_a[0]/len_a;
 		tvec[1]= dvec_b[1]/len_b + dvec_a[1]/len_a;
 		tvec[2]= dvec_b[2]/len_b + dvec_a[2]/len_a;
 		len= len_v3(tvec) * 2.5614f;
 
-		if(len!=0.0f) {
+		if (len!=0.0f) {
 			int leftviolate=0, rightviolate=0;	/* for mode==2 */
 			
-			if(len_a>5.0f*len_b) len_a= 5.0f*len_b;
-			if(len_b>5.0f*len_a) len_b= 5.0f*len_a;
+			if (len_a>5.0f*len_b) len_a= 5.0f*len_b;
+			if (len_b>5.0f*len_a) len_b= 5.0f*len_a;
 			
-			if(ELEM(bezt->h1,HD_AUTO,HD_AUTO_ANIM)) {
+			if (ELEM(bezt->h1,HD_AUTO,HD_AUTO_ANIM)) {
 				len_a/=len;
 				madd_v3_v3v3fl(p2-3, p2, tvec, -len_a);
 				
-				if((bezt->h1==HD_AUTO_ANIM) && next && prev) { /* keep horizontal if extrema */
+				if ((bezt->h1==HD_AUTO_ANIM) && next && prev) { /* keep horizontal if extrema */
 					float ydiff1= prev->vec[1][1] - bezt->vec[1][1];
 					float ydiff2= next->vec[1][1] - bezt->vec[1][1];
-					if( (ydiff1 <= 0.0f && ydiff2 <= 0.0f) || (ydiff1 >= 0.0f && ydiff2 >= 0.0f) ) {
+					if ( (ydiff1 <= 0.0f && ydiff2 <= 0.0f) || (ydiff1 >= 0.0f && ydiff2 >= 0.0f) ) {
 						bezt->vec[0][1]= bezt->vec[1][1];
 					}
 					else { /* handles should not be beyond y coord of two others */
-						if(ydiff1 <= 0.0f) {
-							if(prev->vec[1][1] > bezt->vec[0][1]) {
+						if (ydiff1 <= 0.0f) {
+							if (prev->vec[1][1] > bezt->vec[0][1]) {
 								bezt->vec[0][1]= prev->vec[1][1]; 
 								leftviolate= 1;
 							}
 						}
 						else {
-							if(prev->vec[1][1] < bezt->vec[0][1]) {
+							if (prev->vec[1][1] < bezt->vec[0][1]) {
 								bezt->vec[0][1]= prev->vec[1][1]; 
 								leftviolate= 1;
 							}
@@ -2567,25 +2584,25 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
 					}
 				}
 			}
-			if(ELEM(bezt->h2,HD_AUTO,HD_AUTO_ANIM)) {
+			if (ELEM(bezt->h2,HD_AUTO,HD_AUTO_ANIM)) {
 				len_b/=len;
 				madd_v3_v3v3fl(p2+3, p2, tvec,  len_b);
 				
-				if((bezt->h2==HD_AUTO_ANIM) && next && prev) { /* keep horizontal if extrema */
+				if ((bezt->h2==HD_AUTO_ANIM) && next && prev) { /* keep horizontal if extrema */
 					float ydiff1= prev->vec[1][1] - bezt->vec[1][1];
 					float ydiff2= next->vec[1][1] - bezt->vec[1][1];
-					if( (ydiff1 <= 0.0f && ydiff2 <= 0.0f) || (ydiff1 >= 0.0f && ydiff2 >= 0.0f) ) {
+					if ( (ydiff1 <= 0.0f && ydiff2 <= 0.0f) || (ydiff1 >= 0.0f && ydiff2 >= 0.0f) ) {
 						bezt->vec[2][1]= bezt->vec[1][1];
 					}
 					else { /* andles should not be beyond y coord of two others */
-						if(ydiff1 <= 0.0f) {
-							if(next->vec[1][1] < bezt->vec[2][1]) {
+						if (ydiff1 <= 0.0f) {
+							if (next->vec[1][1] < bezt->vec[2][1]) {
 								bezt->vec[2][1]= next->vec[1][1]; 
 								rightviolate= 1;
 							}
 						}
 						else {
-							if(next->vec[1][1] > bezt->vec[2][1]) {
+							if (next->vec[1][1] > bezt->vec[2][1]) {
 								bezt->vec[2][1]= next->vec[1][1]; 
 								rightviolate= 1;
 							}
@@ -2593,7 +2610,7 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
 					}
 				}
 			}
-			if(leftviolate || rightviolate) { /* align left handle */
+			if (leftviolate || rightviolate) { /* align left handle */
 				float h1[3], h2[3];
 				float dot;
 				
@@ -2605,7 +2622,7 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
 
 				dot= dot_v3v3(h1, h2);
 
-				if(leftviolate) {
+				if (leftviolate) {
 					mul_v3_fl(h1, dot * len_b);
 					sub_v3_v3v3(p2+3, p2, h1);
 				}
@@ -2618,29 +2635,36 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
 		}
 	}
 
-	if(bezt->h1==HD_VECT) {	/* vector */
+	if (bezt->h1==HD_VECT) {	/* vector */
 		madd_v3_v3v3fl(p2-3, p2, dvec_a, -1.0f/3.0f);
 	}
-	if(bezt->h2==HD_VECT) {
+	if (bezt->h2==HD_VECT) {
 		madd_v3_v3v3fl(p2+3, p2, dvec_b,  1.0f/3.0f);
 	}
 
+	if (skip_align) {
+		/* handles need to be updated during animation and applying stuff like hooks,
+		 * but in such situatios it's quite difficult to distinguish in which order
+		 * align handles should be aligned so skip them for now */
+		return;
+	}
+
 	len_b= len_v3v3(p2, p2+3);
 	len_a= len_v3v3(p2, p2-3);
-	if(len_a==0.0f) len_a= 1.0f;
-	if(len_b==0.0f) len_b= 1.0f;
+	if (len_a==0.0f) len_a= 1.0f;
+	if (len_b==0.0f) len_b= 1.0f;
 
-	if(bezt->f1 & SELECT) { /* order of calculation */
-		if(bezt->h2==HD_ALIGN) { /* aligned */
-			if(len_a>eps) {
+	if (bezt->f1 & SELECT) { /* order of calculation */
+		if (bezt->h2==HD_ALIGN) { /* aligned */
+			if (len_a>eps) {
 				len= len_b/len_a;
 				p2[3]= p2[0]+len*(p2[0] - p2[-3]);
 				p2[4]= p2[1]+len*(p2[1] - p2[-2]);
 				p2[5]= p2[2]+len*(p2[2] - p2[-1]);
 			}
 		}
-		if(bezt->h1==HD_ALIGN) {
-			if(len_b>eps) {
+		if (bezt->h1==HD_ALIGN) {
+			if (len_b>eps) {
 				len= len_a/len_b;
 				p2[-3]= p2[0]+len*(p2[0] - p2[3]);
 				p2[-2]= p2[1]+len*(p2[1] - p2[4]);
@@ -2649,16 +2673,16 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
 		}
 	}
 	else {
-		if(bezt->h1==HD_ALIGN) {
-			if(len_b>eps) {
+		if (bezt->h1==HD_ALIGN) {
+			if (len_b>eps) {
 				len= len_a/len_b;
 				p2[-3]= p2[0]+len*(p2[0] - p2[3]);
 				p2[-2]= p2[1]+len*(p2[1] - p2[4]);
 				p2[-1]= p2[2]+len*(p2[2] - p2[5]);
 			}
 		}
-		if(bezt->h2==HD_ALIGN) {	/* aligned */
-			if(len_a>eps) {
+		if (bezt->h2==HD_ALIGN) {	/* aligned */
+			if (len_a>eps) {
 				len= len_b/len_a;
 				p2[3]= p2[0]+len*(p2[0] - p2[-3]);
 				p2[4]= p2[1]+len*(p2[1] - p2[-2]);
@@ -2668,25 +2692,25 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
 	}
 }
 
-void calchandlesNurb(Nurb *nu) /* first, if needed, set handle flags */
+static void calchandlesNurb_intern(Nurb *nu, int skip_align)
 {
 	BezTriple *bezt, *prev, *next;
 	short a;
 
-	if(nu->type != CU_BEZIER) return;
-	if(nu->pntsu<2) return;
+	if (nu->type != CU_BEZIER) return;
+	if (nu->pntsu<2) return;
 	
 	a= nu->pntsu;
 	bezt= nu->bezt;
-	if(nu->flagu & CU_NURB_CYCLIC) prev= bezt+(a-1);
+	if (nu->flagu & CU_NURB_CYCLIC) prev= bezt+(a-1);
 	else prev= NULL;
 	next= bezt+1;
 
-	while(a--) {
-		calchandleNurb(bezt, prev, next, 0);
+	while (a--) {
+		calchandleNurb_intern(bezt, prev, next, 0, skip_align);
 		prev= bezt;
-		if(a==1) {
-			if(nu->flagu & CU_NURB_CYCLIC) next= nu->bezt;
+		if (a==1) {
+			if (nu->flagu & CU_NURB_CYCLIC) next= nu->bezt;
 			else next= NULL;
 		}
 		else next++;
@@ -2695,42 +2719,52 @@ void calchandlesNurb(Nurb *nu) /* first, if needed, set handle flags */
 	}
 }
 
+void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode)
+{
+	calchandleNurb_intern(bezt, prev, next, mode, FALSE);
+}
+
+void calchandlesNurb(Nurb *nu) /* first, if needed, set handle flags */
+{
+	calchandlesNurb_intern(nu, FALSE);
+}
+
 
 void testhandlesNurb(Nurb *nu)
 {
 	/* use when something has changed with handles.
-	it treats all BezTriples with the following rules:
-	PHASE 1: do types have to be altered?
-	   Auto handles: become aligned when selection status is NOT(000 || 111)
-	   Vector handles: become 'nothing' when (one half selected AND other not)
-	PHASE 2: recalculate handles
-	*/
+	 * it treats all BezTriples with the following rules:
+	 * PHASE 1: do types have to be altered?
+	 *    Auto handles: become aligned when selection status is NOT(000 || 111)
+	 *    Vector handles: become 'nothing' when (one half selected AND other not)
+	 * PHASE 2: recalculate handles
+	 */
 	BezTriple *bezt;
 	short flag, a;
 
-	if(nu->type != CU_BEZIER) return;
+	if (nu->type != CU_BEZIER) return;
 
 	bezt= nu->bezt;
 	a= nu->pntsu;
-	while(a--) {
+	while (a--) {
 		flag= 0;
-		if(bezt->f1 & SELECT) flag++;
-		if(bezt->f2 & SELECT) flag += 2;
-		if(bezt->f3 & SELECT) flag += 4;
+		if (bezt->f1 & SELECT) flag++;
+		if (bezt->f2 & SELECT) flag += 2;
+		if (bezt->f3 & SELECT) flag += 4;
 		
-		if( !(flag==0 || flag==7) ) {
-			if(ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM)) {   /* auto */
+		if ( !(flag==0 || flag==7) ) {
+			if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM)) {   /* auto */
 				bezt->h1= HD_ALIGN;
 			}
-			if(ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) {   /* auto */
+			if (ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM)) {   /* auto */
 				bezt->h2= HD_ALIGN;
 			}
 			
-			if(bezt->h1==HD_VECT) {   /* vector */
-				if(flag < 4) bezt->h1= 0;
+			if (bezt->h1==HD_VECT) {   /* vector */
+				if (flag < 4) bezt->h1= 0;
 			}
-			if(bezt->h2==HD_VECT) {   /* vector */
-				if( flag > 3) bezt->h2= 0;
+			if (bezt->h2==HD_VECT) {   /* vector */
+				if ( flag > 3) bezt->h2= 0;
 			}
 		}
 		bezt++;
@@ -2746,61 +2780,61 @@ void autocalchandlesNurb(Nurb *nu, int flag)
 	BezTriple *bezt2, *bezt1, *bezt0;
 	int i, align, leftsmall, rightsmall;
 
-	if(nu==NULL || nu->bezt==NULL) return;
+	if (nu==NULL || nu->bezt==NULL) return;
 	
 	bezt2 = nu->bezt;
 	bezt1 = bezt2 + (nu->pntsu-1);
 	bezt0 = bezt1 - 1;
 	i = nu->pntsu;
 
-	while(i--) {
+	while (i--) {
 		
 		align= leftsmall= rightsmall= 0;
 		
 		/* left handle: */
-		if(flag==0 || (bezt1->f1 & flag) ) {
+		if (flag==0 || (bezt1->f1 & flag) ) {
 			bezt1->h1= 0;
 			/* distance too short: vectorhandle */
-			if( len_v3v3( bezt1->vec[1], bezt0->vec[1] ) < 0.0001f) {
+			if ( len_v3v3( bezt1->vec[1], bezt0->vec[1] ) < 0.0001f) {
 				bezt1->h1= HD_VECT;
 				leftsmall= 1;
 			}
 			else {
 				/* aligned handle? */
-				if(dist_to_line_v2(bezt1->vec[1], bezt1->vec[0], bezt1->vec[2]) < 0.0001f) {
+				if (dist_to_line_v2(bezt1->vec[1], bezt1->vec[0], bezt1->vec[2]) < 0.0001f) {
 					align= 1;
 					bezt1->h1= HD_ALIGN;
 				}
 				/* or vector handle? */
-				if(dist_to_line_v2(bezt1->vec[0], bezt1->vec[1], bezt0->vec[1]) < 0.0001f)
+				if (dist_to_line_v2(bezt1->vec[0], bezt1->vec[1], bezt0->vec[1]) < 0.0001f)
 					bezt1->h1= HD_VECT;
 				
 			}
 		}
 		/* right handle: */
-		if(flag==0 || (bezt1->f3 & flag) ) {
+		if (flag==0 || (bezt1->f3 & flag) ) {
 			bezt1->h2= 0;
 			/* distance too short: vectorhandle */
-			if( len_v3v3( bezt1->vec[1], bezt2->vec[1] ) < 0.0001f) {
+			if ( len_v3v3( bezt1->vec[1], bezt2->vec[1] ) < 0.0001f) {
 				bezt1->h2= HD_VECT;
 				rightsmall= 1;
 			}
 			else {
 				/* aligned handle? */
-				if(align) bezt1->h2= HD_ALIGN;
+				if (align) bezt1->h2= HD_ALIGN;
 
 				/* or vector handle? */
-				if(dist_to_line_v2(bezt1->vec[2], bezt1->vec[1], bezt2->vec[1]) < 0.0001f)
+				if (dist_to_line_v2(bezt1->vec[2], bezt1->vec[1], bezt2->vec[1]) < 0.0001f)
 					bezt1->h2= HD_VECT;
 				
 			}
 		}
-		if(leftsmall && bezt1->h2==HD_ALIGN) bezt1->h2= 0;
-		if(rightsmall && bezt1->h1==HD_ALIGN) bezt1->h1= 0;
+		if (leftsmall && bezt1->h2==HD_ALIGN) bezt1->h2= 0;
+		if (rightsmall && bezt1->h1==HD_ALIGN) bezt1->h1= 0;
 		
 		/* undesired combination: */
-		if(bezt1->h1==HD_ALIGN && bezt1->h2==HD_VECT) bezt1->h1= 0;
-		if(bezt1->h2==HD_ALIGN && bezt1->h1==HD_VECT) bezt1->h2= 0;
+		if (bezt1->h1==HD_ALIGN && bezt1->h2==HD_VECT) bezt1->h1= 0;
+		if (bezt1->h2==HD_ALIGN && bezt1->h1==HD_VECT) bezt1->h2= 0;
 		
 		bezt0= bezt1;
 		bezt1= bezt2;
@@ -2815,7 +2849,7 @@ void autocalchandlesNurb_all(ListBase *editnurb, int flag)
 	Nurb *nu;
 	
 	nu= editnurb->first;
-	while(nu) {
+	while (nu) {
 		autocalchandlesNurb(nu, flag);
 		nu= nu->next;
 	}
@@ -2833,19 +2867,19 @@ void sethandlesNurb(ListBase *editnurb, short code)
 	BezTriple *bezt;
 	short a, ok=0;
 
-	if(code==1 || code==2) {
+	if (code==1 || code==2) {
 		nu= editnurb->first;
-		while(nu) {
-			if(nu->type == CU_BEZIER) {
+		while (nu) {
+			if (nu->type == CU_BEZIER) {
 				bezt= nu->bezt;
 				a= nu->pntsu;
-				while(a--) {
-					if((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) {
-						if(bezt->f1 & SELECT) bezt->h1= code;
-						if(bezt->f3 & SELECT) bezt->h2= code;
-						if(bezt->h1!=bezt->h2) {
-							if ELEM(bezt->h1, HD_ALIGN, HD_AUTO) bezt->h1= HD_FREE;
-							if ELEM(bezt->h2, HD_ALIGN, HD_AUTO) bezt->h2= HD_FREE;
+				while (a--) {
+					if ((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) {
+						if (bezt->f1 & SELECT) bezt->h1= code;
+						if (bezt->f3 & SELECT) bezt->h2= code;
+						if (bezt->h1!=bezt->h2) {
+							if (ELEM(bezt->h1, HD_ALIGN, HD_AUTO)) bezt->h1 = HD_FREE;
+							if (ELEM(bezt->h2, HD_ALIGN, HD_AUTO)) bezt->h2 = HD_FREE;
 						}
 					}
 					bezt++;
@@ -2861,34 +2895,36 @@ void sethandlesNurb(ListBase *editnurb, short code)
 		nu= editnurb->first;
 		if (code == 5) {
 			ok = HD_ALIGN;
-		} else if (code == 6) {
+		}
+		else if (code == 6) {
 			ok = HD_FREE;
-		} else {
+		}
+		else {
 			/* Toggle */
-			while(nu) {
-				if(nu->type == CU_BEZIER) {
+			while (nu) {
+				if (nu->type == CU_BEZIER) {
 					bezt= nu->bezt;
 					a= nu->pntsu;
-					while(a--) {
-						if((bezt->f1 & SELECT) && bezt->h1) ok= 1;
-						if((bezt->f3 & SELECT) && bezt->h2) ok= 1;
-						if(ok) break;
+					while (a--) {
+						if ((bezt->f1 & SELECT) && bezt->h1) ok= 1;
+						if ((bezt->f3 & SELECT) && bezt->h2) ok= 1;
+						if (ok) break;
 						bezt++;
 					}
 				}
 				nu= nu->next;
 			}
-			if(ok) ok= HD_FREE;
+			if (ok) ok= HD_FREE;
 			else ok= HD_ALIGN;
 		}
 		nu= editnurb->first;
-		while(nu) {
-			if(nu->type == CU_BEZIER) {
+		while (nu) {
+			if (nu->type == CU_BEZIER) {
 				bezt= nu->bezt;
 				a= nu->pntsu;
-				while(a--) {
-					if(bezt->f1 & SELECT) bezt->h1= ok;
-					if(bezt->f3 & SELECT) bezt->h2= ok;
+				while (a--) {
+					if (bezt->f1 & SELECT) bezt->h1= ok;
+					if (bezt->f3 & SELECT) bezt->h2= ok;
 	
 					bezt++;
 				}
@@ -2902,9 +2938,9 @@ void sethandlesNurb(ListBase *editnurb, short code)
 static void swapdata(void *adr1, void *adr2, int len)
 {
 
-	if(len<=0) return;
+	if (len<=0) return;
 
-	if(len<65) {
+	if (len<65) {
 		char adr[64];
 
 		memcpy(adr, adr1, len);
@@ -2929,24 +2965,24 @@ void switchdirectionNurb(Nurb *nu)
 	float *fp1, *fp2, *tempf;
 	int a, b;
 
-	if(nu->pntsu==1 && nu->pntsv==1) return;
+	if (nu->pntsu==1 && nu->pntsv==1) return;
 
-	if(nu->type == CU_BEZIER) {
+	if (nu->type == CU_BEZIER) {
 		a= nu->pntsu;
 		bezt1= nu->bezt;
 		bezt2= bezt1+(a-1);
-		if(a & 1) a+= 1;	/* if odd, also swap middle content */
+		if (a & 1) a+= 1;	/* if odd, also swap middle content */
 		a/= 2;
-		while(a>0) {
-			if(bezt1!=bezt2) SWAP(BezTriple, *bezt1, *bezt2);
+		while (a>0) {
+			if (bezt1!=bezt2) SWAP(BezTriple, *bezt1, *bezt2);
 
 			swapdata(bezt1->vec[0], bezt1->vec[2], 12);
-			if(bezt1!=bezt2) swapdata(bezt2->vec[0], bezt2->vec[2], 12);
+			if (bezt1!=bezt2) swapdata(bezt2->vec[0], bezt2->vec[2], 12);
 
 			SWAP(char, bezt1->h1, bezt1->h2);
 			SWAP(short, bezt1->f1, bezt1->f3);
 			
-			if(bezt1!=bezt2) {
+			if (bezt1!=bezt2) {
 				SWAP(char, bezt2->h1, bezt2->h2);
 				SWAP(short, bezt2->f1, bezt2->f3);
 				bezt1->alfa= -bezt1->alfa;
@@ -2957,12 +2993,12 @@ void switchdirectionNurb(Nurb *nu)
 			bezt2--;
 		}
 	}
-	else if(nu->pntsv==1) {
+	else if (nu->pntsv==1) {
 		a= nu->pntsu;
 		bp1= nu->bp;
 		bp2= bp1+(a-1);
 		a/= 2;
-		while(bp1!=bp2 && a>0) {
+		while (bp1!=bp2 && a>0) {
 			SWAP(BPoint, *bp1, *bp2);
 			a--;
 			bp1->alfa= -bp1->alfa;
@@ -2970,15 +3006,15 @@ void switchdirectionNurb(Nurb *nu)
 			bp1++; 
 			bp2--;
 		}
-		if(nu->type == CU_NURBS) {
+		if (nu->type == CU_NURBS) {
 			/* no knots for too short paths */
-			if(nu->knotsu) {
+			if (nu->knotsu) {
 				/* inverse knots */
 				a= KNOTSU(nu);
 				fp1= nu->knotsu;
 				fp2= fp1+(a-1);
 				a/= 2;
-				while(fp1!=fp2 && a>0) {
+				while (fp1!=fp2 && a>0) {
 					SWAP(float, *fp1, *fp2);
 					a--;
 					fp1++; 
@@ -2988,7 +3024,7 @@ void switchdirectionNurb(Nurb *nu)
 				a= KNOTSU(nu);
 				fp1= nu->knotsu;
 				fp2=tempf= MEM_mallocN(sizeof(float)*a, "switchdirect");
-				while(a--) {
+				while (a--) {
 					fp2[0]= fabs(fp1[1]-fp1[0]);
 					fp1++;
 					fp2++;
@@ -2999,7 +3035,7 @@ void switchdirectionNurb(Nurb *nu)
 				fp2= tempf;
 				fp1[0]= 0.0;
 				fp1++;
-				while(a--) {
+				while (a--) {
 					fp1[0]= fp1[-1]+fp2[0];
 					fp1++;
 					fp2++;
@@ -3010,14 +3046,14 @@ void switchdirectionNurb(Nurb *nu)
 	}
 	else {
 		
-		for(b=0; b<nu->pntsv; b++) {
+		for (b=0; b<nu->pntsv; b++) {
 		
 			bp1= nu->bp+b*nu->pntsu;
 			a= nu->pntsu;
 			bp2= bp1+(a-1);
 			a/= 2;
 			
-			while(bp1!=bp2 && a>0) {
+			while (bp1!=bp2 && a>0) {
 				SWAP(BPoint, *bp1, *bp2);
 				a--;
 				bp1++; 
@@ -3044,7 +3080,8 @@ float (*curve_getVertexCos(Curve *UNUSED(cu), ListBase *lb, int *numVerts_r))[3]
 				copy_v3_v3(co, bezt->vec[1]); co+=3;
 				copy_v3_v3(co, bezt->vec[2]); co+=3;
 			}
-		} else {
+		}
+		else {
 			BPoint *bp = nu->bp;
 
 			for (i=0; i<nu->pntsu*nu->pntsv; i++,bp++) {
@@ -3071,13 +3108,16 @@ void curve_applyVertexCos(Curve *UNUSED(cu), ListBase *lb, float (*vertexCos)[3]
 				copy_v3_v3(bezt->vec[1], co); co+=3;
 				copy_v3_v3(bezt->vec[2], co); co+=3;
 			}
-		} else {
+		}
+		else {
 			BPoint *bp = nu->bp;
 
 			for (i=0; i<nu->pntsu*nu->pntsv; i++,bp++) {
 				copy_v3_v3(bp->vec, co); co+=3;
 			}
 		}
+
+		calchandlesNurb_intern(nu, TRUE);
 	}
 }
 
@@ -3102,7 +3142,7 @@ float (*curve_getKeyVertexCos(Curve *UNUSED(cu), ListBase *lb, float *key))[3]
 		else {
 			BPoint *bp = nu->bp;
 
-			for(i=0; i<nu->pntsu*nu->pntsv; i++,bp++) {
+			for (i=0; i<nu->pntsu*nu->pntsv; i++,bp++) {
 				copy_v3_v3(co, key); co+=3; key+=3;
 				key++; /* skip tilt */
 			}
@@ -3117,11 +3157,11 @@ void curve_applyKeyVertexTilts(Curve *UNUSED(cu), ListBase *lb, float *key)
 	Nurb *nu;
 	int i;
 
-	for(nu=lb->first; nu; nu=nu->next) {
-		if(nu->type == CU_BEZIER) {
+	for (nu=lb->first; nu; nu=nu->next) {
+		if (nu->type == CU_BEZIER) {
 			BezTriple *bezt = nu->bezt;
 
-			for(i=0; i<nu->pntsu; i++,bezt++) {
+			for (i=0; i<nu->pntsu; i++,bezt++) {
 				key+=3*3;
 				bezt->alfa= *key;
 				key+=3;
@@ -3130,7 +3170,7 @@ void curve_applyKeyVertexTilts(Curve *UNUSED(cu), ListBase *lb, float *key)
 		else {
 			BPoint *bp = nu->bp;
 
-			for(i=0; i<nu->pntsu*nu->pntsv; i++,bp++) {
+			for (i=0; i<nu->pntsu*nu->pntsv; i++,bp++) {
 				key+=3;
 				bp->alfa= *key;
 				key++;
@@ -3149,7 +3189,8 @@ int check_valid_nurb_u( struct Nurb *nu )
 	if (((nu->flag & CU_NURB_CYCLIC)==0) && (nu->flagu & CU_NURB_BEZIER)) { /* Bezier U Endpoints */
 		if (nu->orderu==4) {
 			if (nu->pntsu < 5)			return 0; /* bezier with 4 orderu needs 5 points */
-		} else if (nu->orderu != 3)		return 0; /* order must be 3 or 4 */
+		}
+		else if (nu->orderu != 3)		return 0; /* order must be 3 or 4 */
 	}
 	return 1;
 }
@@ -3163,7 +3204,8 @@ int check_valid_nurb_v( struct Nurb *nu)
 	if (((nu->flag & CU_NURB_CYCLIC)==0) && (nu->flagv & CU_NURB_BEZIER)) { /* Bezier V Endpoints */
 		if (nu->orderv==4) {
 			if (nu->pntsv < 5)			return 0; /* bezier with 4 orderu needs 5 points */
-		} else if (nu->orderv != 3)		return 0; /* order must be 3 or 4 */
+		}
+		else if (nu->orderv != 3)		return 0; /* order must be 3 or 4 */
 	}
 	return 1;
 }
@@ -3171,11 +3213,11 @@ int check_valid_nurb_v( struct Nurb *nu)
 int clamp_nurb_order_u( struct Nurb *nu )
 {
 	int change = 0;
-	if(nu->pntsu<nu->orderu) {
+	if (nu->pntsu<nu->orderu) {
 		nu->orderu= nu->pntsu;
 		change= 1;
 	}
-	if(((nu->flagu & CU_NURB_CYCLIC)==0) && (nu->flagu & CU_NURB_BEZIER)) {
+	if (((nu->flagu & CU_NURB_CYCLIC)==0) && (nu->flagu & CU_NURB_BEZIER)) {
 		CLAMP(nu->orderu, 3,4);
 		change= 1;
 	}
@@ -3185,11 +3227,11 @@ int clamp_nurb_order_u( struct Nurb *nu )
 int clamp_nurb_order_v( struct Nurb *nu)
 {
 	int change = 0;
-	if(nu->pntsv<nu->orderv) {
+	if (nu->pntsv<nu->orderv) {
 		nu->orderv= nu->pntsv;
 		change= 1;
 	}
-	if(((nu->flagv & CU_NURB_CYCLIC)==0) && (nu->flagv & CU_NURB_BEZIER)) {
+	if (((nu->flagv & CU_NURB_CYCLIC)==0) && (nu->flagv & CU_NURB_BEZIER)) {
 		CLAMP(nu->orderv, 3,4);
 		change= 1;
 	}
@@ -3213,7 +3255,7 @@ int minmax_curve(Curve *cu, float min[3], float max[3])
 	ListBase *nurb_lb= BKE_curve_nurbs(cu);
 	Nurb *nu;
 
-	for(nu= nurb_lb->first; nu; nu= nu->next)
+	for (nu= nurb_lb->first; nu; nu= nu->next)
 		minmaxNurb(nu, min, max);
 
 	return (nurb_lb->first != NULL);
@@ -3227,14 +3269,14 @@ int curve_center_median(Curve *cu, float cent[3])
 
 	zero_v3(cent);
 
-	for(nu= nurb_lb->first; nu; nu= nu->next) {
+	for (nu= nurb_lb->first; nu; nu= nu->next) {
 		int i;
 
-		if(nu->type == CU_BEZIER) {
+		if (nu->type == CU_BEZIER) {
 			BezTriple *bezt;
 			i= nu->pntsu;
 			total += i * 3;
-			for(bezt= nu->bezt; i--; bezt++) {
+			for (bezt= nu->bezt; i--; bezt++) {
 				add_v3_v3(cent, bezt->vec[0]);
 				add_v3_v3(cent, bezt->vec[1]);
 				add_v3_v3(cent, bezt->vec[2]);
@@ -3244,7 +3286,7 @@ int curve_center_median(Curve *cu, float cent[3])
 			BPoint *bp;
 			i= nu->pntsu*nu->pntsv;
 			total += i;
-			for(bp= nu->bp; i--; bp++) {
+			for (bp= nu->bp; i--; bp++) {
 				add_v3_v3(cent, bp->vec);
 			}
 		}
@@ -3259,7 +3301,7 @@ int curve_center_bounds(Curve *cu, float cent[3])
 {
 	float min[3], max[3];
 	INIT_MINMAX(min, max);
-	if(minmax_curve(cu, min, max)) {
+	if (minmax_curve(cu, min, max)) {
 		mid_v3_v3v3(cent, min, max);
 		return 1;
 	}
@@ -3273,13 +3315,13 @@ void curve_translate(Curve *cu, float offset[3], int do_keys)
 	Nurb *nu;
 	int i;
 
-	for(nu= nurb_lb->first; nu; nu= nu->next) {
+	for (nu= nurb_lb->first; nu; nu= nu->next) {
 		BezTriple *bezt;
 		BPoint *bp;
 
-		if(nu->type == CU_BEZIER) {
+		if (nu->type == CU_BEZIER) {
 			i= nu->pntsu;
-			for(bezt= nu->bezt; i--; bezt++) {
+			for (bezt= nu->bezt; i--; bezt++) {
 				add_v3_v3(bezt->vec[0], offset);
 				add_v3_v3(bezt->vec[1], offset);
 				add_v3_v3(bezt->vec[2], offset);
@@ -3287,7 +3329,7 @@ void curve_translate(Curve *cu, float offset[3], int do_keys)
 		}
 		else {
 			i= nu->pntsu*nu->pntsv;
-			for(bp= nu->bp; i--; bp++) {
+			for (bp= nu->bp; i--; bp++) {
 				add_v3_v3(bp->vec, offset);
 			}
 		}
@@ -3308,10 +3350,10 @@ void curve_delete_material_index(Curve *cu, int index)
 {
 	const int curvetype= curve_type(cu);
 
-	if(curvetype == OB_FONT) {
+	if (curvetype == OB_FONT) {
 		struct CharInfo *info= cu->strinfo;
 		int i;
-		for(i= cu->len-1; i >= 0; i--, info++) {
+		for (i= cu->len-1; i >= 0; i--, info++) {
 			if (info->mat_nr && info->mat_nr>=index) {
 				info->mat_nr--;
 			}
@@ -3321,7 +3363,7 @@ void curve_delete_material_index(Curve *cu, int index)
 		Nurb *nu;
 
 		for (nu= cu->nurb.first; nu; nu= nu->next) {
-			if(nu->mat_nr && nu->mat_nr>=index) {
+			if (nu->mat_nr && nu->mat_nr>=index) {
 				nu->mat_nr--;
 				if (curvetype == OB_CURVE) nu->charidx--;
 			}
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index f840774..1514716 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -44,19 +44,25 @@
 #include "DNA_meshdata_types.h"
 #include "DNA_ID.h"
 
+#include "BLI_utildefines.h"
 #include "BLI_blenlib.h"
 #include "BLI_linklist.h"
 #include "BLI_math.h"
 #include "BLI_mempool.h"
 #include "BLI_utildefines.h"
 
+#include "BKE_utildefines.h"
 #include "BKE_customdata.h"
 #include "BKE_customdata_file.h"
 #include "BKE_global.h"
 #include "BKE_main.h"
-#include "BKE_utildefines.h"
 #include "BKE_multires.h"
 
+#include "bmesh.h"
+
+#include <math.h>
+#include <string.h>
+
 /* number of layers to add when growing a CustomData object */
 #define CUSTOMDATA_GROW 5
 
@@ -96,10 +102,10 @@ typedef struct LayerTypeInfo {
 	void (*swap)(void *data, const int *corner_indices);
 
 	/* a function to set a layer's data to default values. if NULL, the
-	   default is assumed to be all zeros */
+	 * default is assumed to be all zeros */
 	void (*set_default)(void *data, int count);
 
-    /* functions necassary for geometry collapse*/
+	/* functions necessary for geometry collapse*/
 	int (*equal)(void *data1, void *data2);
 	void (*multiply)(void *data, float fac);
 	void (*initminmax)(void *min, void *max);
@@ -115,11 +121,6 @@ typedef struct LayerTypeInfo {
 
 	/* a function to determine file size */
 	size_t (*filesize)(CDataFile *cdf, void *data, int count);
-
-	/* a function to validate layer contents depending on
-	 * sub-elements count
-	 */
-	void (*validate)(void *source, int sub_elements);
 } LayerTypeInfo;
 
 static void layerCopy_mdeformvert(const void *source, void *dest,
@@ -129,10 +130,10 @@ static void layerCopy_mdeformvert(const void *source, void *dest,
 
 	memcpy(dest, source, count * size);
 
-	for(i = 0; i < count; ++i) {
+	for (i = 0; i < count; ++i) {
 		MDeformVert *dvert = (MDeformVert *)((char *)dest + i * size);
 
-		if(dvert->totweight) {
+		if (dvert->totweight) {
 			MDeformWeight *dw = MEM_callocN(dvert->totweight * sizeof(*dw),
 											"layerCopy_mdeformvert dw");
 
@@ -148,10 +149,10 @@ static void layerFree_mdeformvert(void *data, int count, int size)
 {
 	int i;
 
-	for(i = 0; i < count; ++i) {
+	for (i = 0; i < count; ++i) {
 		MDeformVert *dvert = (MDeformVert *)((char *)data + i * size);
 
-		if(dvert->dw) {
+		if (dvert->dw) {
 			MEM_freeN(dvert->dw);
 			dvert->dw = NULL;
 			dvert->totweight = 0;
@@ -159,6 +160,40 @@ static void layerFree_mdeformvert(void *data, int count, int size)
 	}
 }
 
+/* copy just zeros in this case */
+static void layerCopy_bmesh_elem_py_ptr(const void *UNUSED(source), void *dest,
+                                        int count)
+{
+	int i, size = sizeof(void *);
+
+	for (i = 0; i < count; ++i) {
+		void **ptr = (void **)((char *)dest + i * size);
+		*ptr = NULL;
+	}
+}
+
+#ifndef WITH_PYTHON
+void bpy_bm_generic_invalidate(void *UNUSED(self))
+{
+	/* dummy */
+}
+#endif
+
+static void layerFree_bmesh_elem_py_ptr(void *data, int count, int size)
+{
+	extern void bpy_bm_generic_invalidate(void *self);
+
+	int i;
+
+	for (i = 0; i < count; ++i) {
+		void **ptr = (void *)((char *)data + i * size);
+		if (*ptr) {
+			bpy_bm_generic_invalidate(*ptr);
+		}
+	}
+}
+
+
 static void linklist_free_simple(void *link)
 {
 	MEM_freeN(link);
@@ -172,28 +207,28 @@ static void layerInterp_mdeformvert(void **sources, float *weights,
 	LinkNode *node;
 	int i, j, totweight;
 
-	if(count <= 0) return;
+	if (count <= 0) return;
 
 	/* build a list of unique def_nrs for dest */
 	totweight = 0;
-	for(i = 0; i < count; ++i) {
+	for (i = 0; i < count; ++i) {
 		MDeformVert *source = sources[i];
 		float interp_weight = weights ? weights[i] : 1.0f;
 
-		for(j = 0; j < source->totweight; ++j) {
+		for (j = 0; j < source->totweight; ++j) {
 			MDeformWeight *dw = &source->dw[j];
 
-			for(node = dest_dw; node; node = node->next) {
+			for (node = dest_dw; node; node = node->next) {
 				MDeformWeight *tmp_dw = (MDeformWeight *)node->link;
 
-				if(tmp_dw->def_nr == dw->def_nr) {
+				if (tmp_dw->def_nr == dw->def_nr) {
 					tmp_dw->weight += dw->weight * interp_weight;
 					break;
 				}
 			}
 
 			/* if this def_nr is not in the list, add it */
-			if(!node) {
+			if (!node) {
 				MDeformWeight *tmp_dw = MEM_callocN(sizeof(*tmp_dw),
 											"layerInterp_mdeformvert tmp_dw");
 				tmp_dw->def_nr = dw->def_nr;
@@ -205,14 +240,14 @@ static void layerInterp_mdeformvert(void **sources, float *weights,
 	}
 
 	/* now we know how many unique deform weights there are, so realloc */
-	if(dvert->dw) MEM_freeN(dvert->dw);
+	if (dvert->dw) MEM_freeN(dvert->dw);
 
-	if(totweight) {
+	if (totweight) {
 		dvert->dw = MEM_callocN(sizeof(*dvert->dw) * totweight,
 								"layerInterp_mdeformvert dvert->dw");
 		dvert->totweight = totweight;
 
-		for(i = 0, node = dest_dw; node; node = node->next, ++i)
+		for (i = 0, node = dest_dw; node; node = node->next, ++i)
 			dvert->dw[i] = *((MDeformWeight *)node->link);
 	}
 	else
@@ -230,7 +265,7 @@ static void layerInterp_msticky(void **sources, float *weights,
 	int i;
 
 	co[0] = co[1] = 0.0f;
-	for(i = 0; i < count; i++) {
+	for (i = 0; i < count; i++) {
 		w = weights ? weights[i] : 1.0f;
 		mst = (MSticky*)sources[i];
 
@@ -248,7 +283,7 @@ static void layerCopy_tface(const void *source, void *dest, int count)
 	MTFace *dest_tf = (MTFace*)dest;
 	int i;
 
-	for(i = 0; i < count; ++i)
+	for (i = 0; i < count; ++i)
 		dest_tf[i] = source_tf[i];
 }
 
@@ -260,16 +295,16 @@ static void layerInterp_tface(void **sources, float *weights,
 	float uv[4][2] = {{0.0f}};
 	float *sub_weight;
 
-	if(count <= 0) return;
+	if (count <= 0) return;
 
 	sub_weight = sub_weights;
-	for(i = 0; i < count; ++i) {
+	for (i = 0; i < count; ++i) {
 		float weight = weights ? weights[i] : 1;
 		MTFace *src = sources[i];
 
-		for(j = 0; j < 4; ++j) {
-			if(sub_weights) {
-				for(k = 0; k < 4; ++k, ++sub_weight) {
+		for (j = 0; j < 4; ++j) {
+			if (sub_weights) {
+				for (k = 0; k < 4; ++k, ++sub_weight) {
 					madd_v2_v2fl(uv[j], src->uv[k], (*sub_weight) * weight);
 				}
 			}
@@ -295,18 +330,18 @@ static void layerSwap_tface(void *data, const int *corner_indices)
 	char flag = tf->flag & ~(TF_SEL1 | TF_SEL2 | TF_SEL3 | TF_SEL4);
 	int j;
 
-	for(j = 0; j < 4; ++j) {
+	for (j = 0; j < 4; ++j) {
 		const int source_index = corner_indices[j];
 
 		copy_v2_v2(uv[j], tf->uv[source_index]);
 
 		// swap pinning flags around
-		if(tf->unwrap & pin_flags[source_index]) {
+		if (tf->unwrap & pin_flags[source_index]) {
 			unwrap |= pin_flags[j];
 		}
 
 		// swap selection flags around
-		if(tf->flag & sel_flags[source_index]) {
+		if (tf->flag & sel_flags[source_index]) {
 			flag |= sel_flags[j];
 		}
 	}
@@ -323,7 +358,7 @@ static void layerDefault_tface(void *data, int count)
 	MTFace *tf = (MTFace*)data;
 	int i;
 
-	for(i = 0; i < count; i++)
+	for (i = 0; i < count; i++)
 		tf[i] = default_tf;
 }
 
@@ -351,7 +386,7 @@ static void layerCopy_origspace_face(const void *source, void *dest, int count)
 	OrigSpaceFace *dest_tf = (OrigSpaceFace*)dest;
 	int i;
 
-	for(i = 0; i < count; ++i)
+	for (i = 0; i < count; ++i)
 		dest_tf[i] = source_tf[i];
 }
 
@@ -363,19 +398,20 @@ static void layerInterp_origspace_face(void **sources, float *weights,
 	float uv[4][2] = {{0.0f}};
 	float *sub_weight;
 
-	if(count <= 0) return;
+	if (count <= 0) return;
 
 	sub_weight = sub_weights;
-	for(i = 0; i < count; ++i) {
+	for (i = 0; i < count; ++i) {
 		float weight = weights ? weights[i] : 1;
 		OrigSpaceFace *src = sources[i];
 
-		for(j = 0; j < 4; ++j) {
-			if(sub_weights) {
-				for(k = 0; k < 4; ++k, ++sub_weight) {
+		for (j = 0; j < 4; ++j) {
+			if (sub_weights) {
+				for (k = 0; k < 4; ++k, ++sub_weight) {
 					madd_v2_v2fl(uv[j], src->uv[k], (*sub_weight) * weight);
 				}
-			} else {
+			}
+			else {
 				madd_v2_v2fl(uv[j], src->uv[j], weight);
 			}
 		}
@@ -393,7 +429,7 @@ static void layerSwap_origspace_face(void *data, const int *corner_indices)
 	float uv[4][2];
 	int j;
 
-	for(j = 0; j < 4; ++j) {
+	for (j = 0; j < 4; ++j) {
 		copy_v2_v2(uv[j], osf->uv[corner_indices[j]]);
 	}
 	memcpy(osf->uv, uv, sizeof(osf->uv));
@@ -405,7 +441,7 @@ static void layerDefault_origspace_face(void *data, int count)
 	OrigSpaceFace *osf = (OrigSpaceFace*)data;
 	int i;
 
-	for(i = 0; i < count; i++)
+	for (i = 0; i < count; i++)
 		osf[i] = default_osf;
 }
 
@@ -415,14 +451,14 @@ static void layerSwap_mdisps(void *data, const int *ci)
 	float (*d)[3] = NULL;
 	int corners, cornersize, S;
 
-	if(s->disps) {
+	if (s->disps) {
 		int nverts= (ci[1] == 3) ? 4 : 3; /* silly way to know vertex count of face */
 		corners= multires_mdisp_corners(s);
 		cornersize= s->totdisp/corners;
 
-		if(corners!=nverts) {
+		if (corners!=nverts) {
 			/* happens when face changed vertex count in edit mode
-			   if it happened, just forgot displacement */
+			 * if it happened, just forgot displacement */
 
 			MEM_freeN(s->disps);
 			s->totdisp= (s->totdisp/corners)*nverts;
@@ -432,7 +468,7 @@ static void layerSwap_mdisps(void *data, const int *ci)
 
 		d= MEM_callocN(sizeof(float) * 3 * s->totdisp, "mdisps swap");
 
-		for(S = 0; S < corners; S++)
+		for (S = 0; S < corners; S++)
 			memcpy(d + cornersize*S, s->disps + cornersize*ci[S], cornersize*3*sizeof(float));
 		
 		MEM_freeN(s->disps);
@@ -440,162 +476,43 @@ static void layerSwap_mdisps(void *data, const int *ci)
 	}
 }
 
-static void layerInterp_mdisps(void **sources, float *UNUSED(weights),
-				float *sub_weights, int count, void *dest)
-{
-	MDisps *d = dest;
-	MDisps *s = NULL;
-	int st, stl;
-	int i, x, y;
-	int side, S, dst_corners, src_corners;
-	float crn_weight[4][2];
-	float (*sw)[4] = (void*)sub_weights;
-	float (*disps)[3], (*out)[3];
-
-	/* happens when flipping normals of newly created mesh */
-	if(!d->totdisp)
-		return;
-
-	s = sources[0];
-	dst_corners = multires_mdisp_corners(d);
-	src_corners = multires_mdisp_corners(s);
-
-	if(sub_weights && count == 2 && src_corners == 3) {
-		src_corners = multires_mdisp_corners(sources[1]);
-
-		/* special case -- converting two triangles to quad */
-		if(src_corners == 3 && dst_corners == 4) {
-			MDisps tris[2];
-			int vindex[4] = {0};
-
-			for(i = 0; i < 2; i++)
-				for(y = 0; y < 4; y++)
-					for(x = 0; x < 4; x++)
-						if(sw[x+i*4][y])
-							vindex[x] = y;
-
-			for(i = 0; i < 2; i++) {
-				float sw_m4[4][4] = {{0}};
-				int a = 7 & ~(1 << vindex[i*2] | 1 << vindex[i*2+1]);
-
-				sw_m4[0][vindex[i*2+1]] = 1;
-				sw_m4[1][vindex[i*2]] = 1;
-
-				for(x = 0; x < 3; x++)
-					if(a & (1 << x))
-						sw_m4[2][x] = 1;
-
-				tris[i] = *((MDisps*)sources[i]);
-				tris[i].disps = MEM_dupallocN(tris[i].disps);
-				layerInterp_mdisps(&sources[i], NULL, (float*)sw_m4, 1, &tris[i]);
-			}
-
-			mdisp_join_tris(d, &tris[0], &tris[1]);
-
-			for(i = 0; i < 2; i++)
-				MEM_freeN(tris[i].disps);
-
-			return;
-		}
-	}
-
-	/* For now, some restrictions on the input */
-	if(count != 1 || !sub_weights) {
-		for(i = 0; i < d->totdisp; ++i)
-			zero_v3(d->disps[i]);
-
-		return;
-	}
-
-	/* Initialize the destination */
-	disps = MEM_callocN(3*d->totdisp*sizeof(float), "iterp disps");
-
-	side = sqrt(d->totdisp / dst_corners);
-	st = (side<<1)-1;
-	stl = st - 1;
-
-	sw= (void*)sub_weights;
-	for(i = 0; i < 4; ++i) {
-		crn_weight[i][0] = 0 * sw[i][0] + stl * sw[i][1] + stl * sw[i][2] + 0 * sw[i][3];
-		crn_weight[i][1] = 0 * sw[i][0] + 0 * sw[i][1] + stl * sw[i][2] + stl * sw[i][3];
-	}
-
-	multires_mdisp_smooth_bounds(s);
-
-	out = disps;
-	for(S = 0; S < dst_corners; S++) {
-		float base[2], axis_x[2], axis_y[2];
-
-		mdisp_apply_weight(S, dst_corners, 0, 0, st, crn_weight, &base[0], &base[1]);
-		mdisp_apply_weight(S, dst_corners, side-1, 0, st, crn_weight, &axis_x[0], &axis_x[1]);
-		mdisp_apply_weight(S, dst_corners, 0, side-1, st, crn_weight, &axis_y[0], &axis_y[1]);
-
-		sub_v2_v2(axis_x, base);
-		sub_v2_v2(axis_y, base);
-		normalize_v2(axis_x);
-		normalize_v2(axis_y);
-
-		for(y = 0; y < side; ++y) {
-			for(x = 0; x < side; ++x, ++out) {
-				int crn;
-				float face_u, face_v, crn_u, crn_v;
-
-				mdisp_apply_weight(S, dst_corners, x, y, st, crn_weight, &face_u, &face_v);
-				crn = mdisp_rot_face_to_quad_crn(src_corners, st, face_u, face_v, &crn_u, &crn_v);
-
-				old_mdisps_bilinear((*out), &s->disps[crn*side*side], side, crn_u, crn_v);
-				mdisp_flip_disp(crn, dst_corners, axis_x, axis_y, *out);
-			}
-		}
-	}
-
-	MEM_freeN(d->disps);
-	d->disps = disps;
-}
-
 static void layerCopy_mdisps(const void *source, void *dest, int count)
 {
 	int i;
 	const MDisps *s = source;
 	MDisps *d = dest;
 
-	for(i = 0; i < count; ++i) {
-		if(s[i].disps) {
+	for (i = 0; i < count; ++i) {
+		if (s[i].disps) {
 			d[i].disps = MEM_dupallocN(s[i].disps);
+			d[i].hidden = MEM_dupallocN(s[i].hidden);
 			d[i].totdisp = s[i].totdisp;
+			d[i].level = s[i].level;
 		}
 		else {
 			d[i].disps = NULL;
+			d[i].hidden = NULL;
 			d[i].totdisp = 0;
+			d[i].level = 0;
 		}
 		
 	}
 }
 
-static void layerValidate_mdisps(void *data, int sub_elements)
-{
-	MDisps *disps = data;
-	if(disps->disps) {
-		int corners = multires_mdisp_corners(disps);
-
-		if(corners != sub_elements) {
-			MEM_freeN(disps->disps);
-			disps->totdisp = disps->totdisp / corners * sub_elements;
-			disps->disps = MEM_callocN(3*disps->totdisp*sizeof(float), "layerValidate_mdisps");
-		}
-	}
-}
-
 static void layerFree_mdisps(void *data, int count, int UNUSED(size))
 {
 	int i;
 	MDisps *d = data;
 
-	for(i = 0; i < count; ++i) {
-		if(d[i].disps)
+	for (i = 0; i < count; ++i) {
+		if (d[i].disps)
 			MEM_freeN(d[i].disps);
+		if (d[i].hidden)
+			MEM_freeN(d[i].hidden);
 		d[i].disps = NULL;
+		d[i].hidden = NULL;
 		d[i].totdisp = 0;
+		d[i].level = 0;
 	}
 }
 
@@ -604,11 +521,11 @@ static int layerRead_mdisps(CDataFile *cdf, void *data, int count)
 	MDisps *d = data;
 	int i;
 
-	for(i = 0; i < count; ++i) {
-		if(!d[i].disps)
+	for (i = 0; i < count; ++i) {
+		if (!d[i].disps)
 			d[i].disps = MEM_callocN(sizeof(float)*3*d[i].totdisp, "mdisps read");
 
-		if(!cdf_read_data(cdf, d[i].totdisp*3*sizeof(float), d[i].disps)) {
+		if (!cdf_read_data(cdf, d[i].totdisp*3*sizeof(float), d[i].disps)) {
 			printf("failed to read multires displacement %d/%d %d\n", i, count, d[i].totdisp);
 			return 0;
 		}
@@ -622,8 +539,8 @@ static int layerWrite_mdisps(CDataFile *cdf, void *data, int count)
 	MDisps *d = data;
 	int i;
 
-	for(i = 0; i < count; ++i) {
-		if(!cdf_write_data(cdf, d[i].totdisp*3*sizeof(float), d[i].disps)) {
+	for (i = 0; i < count; ++i) {
+		if (!cdf_write_data(cdf, d[i].totdisp*3*sizeof(float), d[i].disps)) {
 			printf("failed to write multires displacement %d/%d %d\n", i, count, d[i].totdisp);
 			return 0;
 		}
@@ -638,7 +555,7 @@ static size_t layerFilesize_mdisps(CDataFile *UNUSED(cdf), void *data, int count
 	size_t size = 0;
 	int i;
 
-	for(i = 0; i < count; ++i)
+	for (i = 0; i < count; ++i)
 		size += d[i].totdisp*3*sizeof(float);
 
 	return size;
@@ -724,7 +641,7 @@ static void layerDefault_mloopcol(void *data, int count)
 	MLoopCol default_mloopcol = {255,255,255,255};
 	MLoopCol *mlcol = (MLoopCol*)data;
 	int i;
-	for(i = 0; i < count; i++)
+	for (i = 0; i < count; i++)
 		mlcol[i] = default_mloopcol;
 
 }
@@ -744,20 +661,21 @@ static void layerInterp_mloopcol(void **sources, float *weights,
 	col.a = col.r = col.g = col.b = 0;
 
 	sub_weight = sub_weights;
-	for(i = 0; i < count; ++i){
+	for (i = 0; i < count; ++i) {
 		float weight = weights ? weights[i] : 1;
 		MLoopCol *src = sources[i];
-		if(sub_weights){
-			col.a += src->a * (*sub_weight) * weight;
+		if (sub_weights) {
 			col.r += src->r * (*sub_weight) * weight;
 			col.g += src->g * (*sub_weight) * weight;
 			col.b += src->b * (*sub_weight) * weight;
+			col.a += src->a * (*sub_weight) * weight;
 			sub_weight++;
-		} else {
-			col.a += src->a * weight;
+		}
+		else {
 			col.r += src->r * weight;
 			col.g += src->g * weight;
 			col.b += src->b * weight;
+			col.a += src->a * weight;
 		}
 	}
 	
@@ -768,10 +686,10 @@ static void layerInterp_mloopcol(void **sources, float *weights,
 	CLAMP(col.g, 0.0f, 255.0f);
 	CLAMP(col.b, 0.0f, 255.0f);
 	
-	mc->a = (int)col.a;
 	mc->r = (int)col.r;
 	mc->g = (int)col.g;
 	mc->b = (int)col.b;
+	mc->a = (int)col.a;
 }
 
 static void layerCopyValue_mloopuv(void *source, void *dest)
@@ -827,7 +745,7 @@ static void layerInterp_mloopuv(void **sources, float *weights,
 
 	if (sub_weights) {
 		const float *sub_weight = sub_weights;
-		for(i = 0; i < count; i++) {
+		for (i = 0; i < count; i++) {
 			float weight = weights ? weights[i] : 1.0f;
 			MLoopUV *src = sources[i];
 			madd_v2_v2fl(uv, src->uv, (*sub_weight) * weight);
@@ -835,7 +753,7 @@ static void layerInterp_mloopuv(void **sources, float *weights,
 		}
 	}
 	else {
-		for(i = 0; i < count; i++) {
+		for (i = 0; i < count; i++) {
 			float weight = weights ? weights[i] : 1;
 			MLoopUV *src = sources[i];
 			madd_v2_v2fl(uv, src->uv, weight);
@@ -843,6 +761,77 @@ static void layerInterp_mloopuv(void **sources, float *weights,
 	}
 }
 
+/* origspace is almost exact copy of mloopuv's, keep in sync */
+static void layerCopyValue_mloop_origspace(void *source, void *dest)
+{
+	OrigSpaceLoop *luv1 = source, *luv2 = dest;
+
+	copy_v2_v2(luv2->uv, luv1->uv);
+}
+
+static int layerEqual_mloop_origspace(void *data1, void *data2)
+{
+	OrigSpaceLoop *luv1 = data1, *luv2 = data2;
+
+	return len_squared_v2v2(luv1->uv, luv2->uv) < 0.00001f;
+}
+
+static void layerMultiply_mloop_origspace(void *data, float fac)
+{
+	OrigSpaceLoop *luv = data;
+
+	mul_v2_fl(luv->uv, fac);
+}
+
+static void layerInitMinMax_mloop_origspace(void *vmin, void *vmax)
+{
+	OrigSpaceLoop *min = vmin, *max = vmax;
+
+	INIT_MINMAX2(min->uv, max->uv);
+}
+
+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);
+}
+
+static void layerAdd_mloop_origspace(void *data1, void *data2)
+{
+	OrigSpaceLoop *l1 = data1, *l2 = data2;
+
+	add_v2_v2(l1->uv, l2->uv);
+}
+
+static void layerInterp_mloop_origspace(void **sources, float *weights,
+                                float *sub_weights, int count, void *dest)
+{
+	OrigSpaceLoop *mluv = dest;
+	float *uv= mluv->uv;
+	int i;
+
+	zero_v2(uv);
+
+	if (sub_weights) {
+		const float *sub_weight = sub_weights;
+		for (i = 0; i < count; i++) {
+			float weight = weights ? weights[i] : 1.0f;
+			OrigSpaceLoop *src = sources[i];
+			madd_v2_v2fl(uv, src->uv, (*sub_weight) * weight);
+			sub_weight++;
+		}
+	}
+	else {
+		for (i = 0; i < count; i++) {
+			float weight = weights ? weights[i] : 1;
+			OrigSpaceLoop *src = sources[i];
+			madd_v2_v2fl(uv, src->uv, weight);
+		}
+	}
+}
+/* --- end copy */
+
 static void layerInterp_mcol(void **sources, float *weights,
 							 float *sub_weights, int count, void *dest)
 {
@@ -857,23 +846,24 @@ static void layerInterp_mcol(void **sources, float *weights,
 
 	float *sub_weight;
 
-	if(count <= 0) return;
+	if (count <= 0) return;
 	
 	sub_weight = sub_weights;
-	for(i = 0; i < count; ++i) {
+	for (i = 0; i < count; ++i) {
 		float weight = weights ? weights[i] : 1;
 
-		for(j = 0; j < 4; ++j) {
-			if(sub_weights) {
+		for (j = 0; j < 4; ++j) {
+			if (sub_weights) {
 				MCol *src = sources[i];
-				for(k = 0; k < 4; ++k, ++sub_weight, ++src) {
+				for (k = 0; k < 4; ++k, ++sub_weight, ++src) {
 					const float w= (*sub_weight) * weight;
 					col[j].a += src->a * w;
 					col[j].r += src->r * w;
 					col[j].g += src->g * w;
 					col[j].b += src->b * w;
 				}
-			} else {
+			}
+			else {
 				MCol *src = sources[i];
 				col[j].a += src[j].a * weight;
 				col[j].r += src[j].r * weight;
@@ -883,7 +873,7 @@ static void layerInterp_mcol(void **sources, float *weights,
 		}
 	}
 
-	for(j = 0; j < 4; ++j) {
+	for (j = 0; j < 4; ++j) {
 		
 		/* Subdivide smooth or fractal can cause problems without clamping
 		 * although weights should also not cause this situation */
@@ -905,7 +895,7 @@ static void layerSwap_mcol(void *data, const int *corner_indices)
 	MCol col[4];
 	int j;
 
-	for(j = 0; j < 4; ++j)
+	for (j = 0; j < 4; ++j)
 		col[j] = mcol[corner_indices[j]];
 
 	memcpy(mcol, col, sizeof(col));
@@ -917,7 +907,7 @@ static void layerDefault_mcol(void *data, int count)
 	MCol *mcol = (MCol*)data;
 	int i;
 
-	for(i = 0; i < 4*count; i++) {
+	for (i = 0; i < 4*count; i++) {
 		mcol[i] = default_mcol;
 	}
 }
@@ -929,17 +919,17 @@ static void layerInterp_bweight(void **sources, float *weights,
 	float **in = (float **)sources;
 	int i;
 	
-	if(count <= 0) return;
+	if (count <= 0) return;
 
 	*f = 0.0f;
 
 	if (weights) {
-		for(i = 0; i < count; ++i) {
+		for (i = 0; i < count; ++i) {
 			*f += *in[i] * weights[i];
 		}
 	}
 	else {
-		for(i = 0; i < count; ++i) {
+		for (i = 0; i < count; ++i) {
 			*f += *in[i];
 		}
 	}
@@ -952,17 +942,17 @@ static void layerInterp_shapekey(void **sources, float *weights,
 	float **in = (float **)sources;
 	int i;
 
-	if(count <= 0) return;
+	if (count <= 0) return;
 
 	zero_v3(co);
 
 	if (weights) {
-		for(i = 0; i < count; ++i) {
+		for (i = 0; i < count; ++i) {
 			madd_v3_v3fl(co, in[i], weights[i]);
 		}
 	}
 	else {
-		for(i = 0; i < count; ++i) {
+		for (i = 0; i < count; ++i) {
 			add_v3_v3(co, in[i]);
 		}
 	}
@@ -992,7 +982,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
 	{sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
 	/* 8: CD_NORMAL */
 	/* 3 floats per normal vector */
-	{sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
+	{sizeof(float)*3, "vec3f", 1, NULL, NULL, NULL, NULL, NULL, NULL},
 	/* 9: CD_POLYINDEX */
 	{sizeof(int), "MIntProperty", 1, NULL, NULL, NULL, NULL, NULL, NULL},
 	/* 10: CD_PROP_FLT */
@@ -1007,7 +997,8 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
 	/* 14: CD_ORCO */
 	{sizeof(float)*3, "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
 	/* 15: CD_MTEXPOLY */
-	{sizeof(MTexPoly), "MTexPoly", 1, "Face Texture", NULL, NULL, NULL, NULL, NULL},
+	/* note, when we expose the UV Map / TexFace split to the user, change this back to face Texture */
+	{sizeof(MTexPoly), "MTexPoly", 1, "UVMap"/* "Face Texture" */, NULL, NULL, NULL, NULL, NULL},
 	/* 16: CD_MLOOPUV */
 	{sizeof(MLoopUV), "MLoopUV", 1, "UV coord", NULL, NULL, layerInterp_mloopuv, NULL, NULL,
 	 layerEqual_mloopuv, layerMultiply_mloopuv, layerInitMinMax_mloopuv, 
@@ -1020,11 +1011,11 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
 	{sizeof(float)*4*4, "", 0, NULL, NULL, NULL, NULL, NULL, NULL},
 	/* 19: CD_MDISPS */
 	{sizeof(MDisps), "MDisps", 1, NULL, layerCopy_mdisps,
-	 layerFree_mdisps, layerInterp_mdisps, layerSwap_mdisps, NULL,
+	 layerFree_mdisps, NULL, layerSwap_mdisps, NULL,
 	 NULL, NULL, NULL, NULL, NULL, NULL, 
-	 layerRead_mdisps, layerWrite_mdisps, layerFilesize_mdisps, layerValidate_mdisps},
-	/* 20: CD_WEIGHT_MCOL */
-	{sizeof(MCol)*4, "MCol", 4, "WeightCol", NULL, NULL, layerInterp_mcol,
+	 layerRead_mdisps, layerWrite_mdisps, layerFilesize_mdisps},
+	/* 20: CD_PREVIEW_MCOL */
+	{sizeof(MCol)*4, "MCol", 4, "PreviewCol", NULL, NULL, layerInterp_mcol,
 	 layerSwap_mcol, layerDefault_mcol},
 	/* 21: CD_ID_MCOL */
 	{sizeof(MCol)*4, "MCol", 4, "IDCol", NULL, NULL, layerInterp_mcol,
@@ -1037,9 +1028,8 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
 	/* 24: CD_RECAST */
 	{sizeof(MRecast), "MRecast", 1,"Recast",NULL,NULL,NULL,NULL}
 
-#ifdef USE_BMESH_FORWARD_COMPAT
-	,
 /* BMESH ONLY */
+	,
 	/* 25: CD_MPOLY */
 	{sizeof(MPoly), "MPoly", 1, "NGon Face", NULL, NULL, NULL, NULL, NULL},
 	/* 26: CD_MLOOP */
@@ -1052,60 +1042,78 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
 	{sizeof(float), "", 0, "BevelWeight", NULL, NULL, layerInterp_bweight},
 	/* 30: CD_CREASE */
 	{sizeof(float), "", 0, "SubSurfCrease", NULL, NULL, layerInterp_bweight},
-	/* 31: CD_WEIGHT_MLOOPCOL */
-	{sizeof(MLoopCol), "MLoopCol", 1, "WeightLoopCol", NULL, NULL, layerInterp_mloopcol, NULL,
+    /* 31: CD_ORIGSPACE_MLOOP */
+	{sizeof(OrigSpaceLoop), "OrigSpaceLoop", 1, "OS Loop", NULL, NULL, layerInterp_mloop_origspace, NULL, NULL,
+	 layerEqual_mloop_origspace, layerMultiply_mloop_origspace, layerInitMinMax_mloop_origspace,
+	 layerAdd_mloop_origspace, layerDoMinMax_mloop_origspace, layerCopyValue_mloop_origspace},
+	/* 32: CD_PREVIEW_MLOOPCOL */
+	{sizeof(MLoopCol), "MLoopCol", 1, "PreviewLoopCol", NULL, NULL, layerInterp_mloopcol, NULL,
 	 layerDefault_mloopcol, layerEqual_mloopcol, layerMultiply_mloopcol, layerInitMinMax_mloopcol,
 	 layerAdd_mloopcol, layerDoMinMax_mloopcol, layerCopyValue_mloopcol},
+	/* 33: CD_BM_ELEM_PYPTR */
+	{sizeof(void *), "", 1, NULL, layerCopy_bmesh_elem_py_ptr,
+	 layerFree_bmesh_elem_py_ptr, NULL, NULL, NULL},
+
 /* END BMESH ONLY */
 
-#endif /* USE_BMESH_FORWARD_COMPAT */
 
 };
 
+/* note, numbers are from trunk and need updating for bmesh */
+
 static const char *LAYERTYPENAMES[CD_NUMTYPES] = {
 	/*   0-4 */ "CDMVert", "CDMSticky", "CDMDeformVert", "CDMEdge", "CDMFace",
 	/*   5-9 */ "CDMTFace", "CDMCol", "CDOrigIndex", "CDNormal", "CDFlags",
 	/* 10-14 */ "CDMFloatProperty", "CDMIntProperty","CDMStringProperty", "CDOrigSpace", "CDOrco",
 	/* 15-19 */ "CDMTexPoly", "CDMLoopUV", "CDMloopCol", "CDTangent", "CDMDisps",
-	/* 20-24 */"CDWeightMCol", "CDIDMCol", "CDTextureMCol", "CDClothOrco", "CDMRecast"
+	/* 20-24 */"CDPreviewMCol", "CDIDMCol", "CDTextureMCol", "CDClothOrco", "CDMRecast"
 
-#ifdef USE_BMESH_FORWARD_COMPAT
+/* BMESH ONLY */
 	,
 	/* 25-29 */ "CDMPoly", "CDMLoop", "CDShapeKeyIndex", "CDShapeKey", "CDBevelWeight",
-	/* 30-31 */ "CDSubSurfCrease", "CDWeightLoopCol"
+	/* 30-32 */ "CDSubSurfCrease", "CDOrigSpaceLoop", "CDPreviewLoopCol"
+/* END BMESH ONLY */
 
-#endif /* USE_BMESH_FORWARD_COMPAT */
 };
 
+
 const CustomDataMask CD_MASK_BAREMESH =
-	CD_MASK_MVERT | CD_MASK_MEDGE | CD_MASK_MFACE;
+	CD_MASK_MVERT | CD_MASK_MEDGE | CD_MASK_MFACE | CD_MASK_MLOOP | CD_MASK_MPOLY | CD_MASK_BWEIGHT;
 const CustomDataMask CD_MASK_MESH =
 	CD_MASK_MVERT | CD_MASK_MEDGE | CD_MASK_MFACE |
 	CD_MASK_MSTICKY | CD_MASK_MDEFORMVERT | CD_MASK_MTFACE | CD_MASK_MCOL |
-	CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_PROP_STR | CD_MASK_MDISPS | CD_MASK_RECAST;
+	CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_PROP_STR | CD_MASK_MDISPS |
+	CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL | CD_MASK_MPOLY | CD_MASK_MLOOP |
+	CD_MASK_MTEXPOLY | CD_MASK_NORMAL | CD_MASK_RECAST;
 const CustomDataMask CD_MASK_EDITMESH =
-	CD_MASK_MSTICKY | CD_MASK_MDEFORMVERT | CD_MASK_MTFACE |
-	CD_MASK_MCOL|CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_PROP_STR | CD_MASK_MDISPS | CD_MASK_RECAST;
+	CD_MASK_MSTICKY | CD_MASK_MDEFORMVERT | CD_MASK_MTFACE | CD_MASK_MLOOPUV |
+	CD_MASK_MLOOPCOL | CD_MASK_MTEXPOLY | CD_MASK_SHAPE_KEYINDEX |
+	CD_MASK_MCOL|CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_PROP_STR |
+	CD_MASK_MDISPS | CD_MASK_SHAPEKEY | CD_MASK_RECAST;
 const CustomDataMask CD_MASK_DERIVEDMESH =
 	CD_MASK_MSTICKY | CD_MASK_MDEFORMVERT | CD_MASK_MTFACE |
-	CD_MASK_MCOL | CD_MASK_ORIGINDEX | CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_CLOTH_ORCO |
-	CD_MASK_PROP_STR | CD_MASK_ORIGSPACE | CD_MASK_ORCO | CD_MASK_TANGENT | CD_MASK_WEIGHT_MCOL | CD_MASK_RECAST;
-const CustomDataMask CD_MASK_BMESH = 
-	CD_MASK_MSTICKY | CD_MASK_MDEFORMVERT | CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_PROP_STR;
+	CD_MASK_MCOL | CD_MASK_PROP_FLT | CD_MASK_PROP_INT | CD_MASK_CLOTH_ORCO |
+	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;
+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 | 
+	CD_MASK_PROP_STR | CD_MASK_SHAPEKEY | CD_MASK_SHAPE_KEYINDEX | CD_MASK_MDISPS | CD_MASK_CREASE | CD_MASK_BWEIGHT | CD_MASK_RECAST;
 const CustomDataMask CD_MASK_FACECORNERS =
 	CD_MASK_MTFACE | CD_MASK_MCOL | CD_MASK_MTEXPOLY | CD_MASK_MLOOPUV |
 	CD_MASK_MLOOPCOL;
 
 static const LayerTypeInfo *layerType_getInfo(int type)
 {
-	if(type < 0 || type >= CD_NUMTYPES) return NULL;
+	if (type < 0 || type >= CD_NUMTYPES) return NULL;
 
 	return &LAYERTYPEINFO[type];
 }
 
 static const char *layerType_getName(int type)
 {
-	if(type < 0 || type >= CD_NUMTYPES) return NULL;
+	if (type < 0 || type >= CD_NUMTYPES) return NULL;
 
 	return LAYERTYPENAMES[type];
 }
@@ -1140,9 +1148,10 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
 {
 	/*const LayerTypeInfo *typeInfo;*/
 	CustomDataLayer *layer, *newlayer;
+	void *data;
 	int i, type, number = 0, lasttype = -1, lastactive = 0, lastrender = 0, lastclone = 0, lastmask = 0, lastflag = 0;
 
-	for(i = 0; i < source->totlayer; ++i) {
+	for (i = 0; i < source->totlayer; ++i) {
 		layer = &source->layers[i];
 		/*typeInfo = layerType_getInfo(layer->type);*/ /*UNUSED*/
 
@@ -1160,18 +1169,31 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
 		else
 			number++;
 
-		if(lastflag & CD_FLAG_NOCOPY) continue;
-		else if(!(mask & CD_TYPE_AS_MASK(type))) continue;
-		else if(number < CustomData_number_of_layers(dest, type)) continue;
+		if (lastflag & CD_FLAG_NOCOPY) continue;
+		else if (!(mask & CD_TYPE_AS_MASK(type))) continue;
+		else if (number < CustomData_number_of_layers(dest, type)) continue;
+
+		switch (alloctype) {
+			case CD_ASSIGN:
+			case CD_REFERENCE:
+			case CD_DUPLICATE:
+				data = layer->data;
+				break;
+			default:
+				data = NULL;
+				break;
+		}
 
-		if((alloctype == CD_ASSIGN) && (lastflag & CD_FLAG_NOFREE))
+		if ((alloctype == CD_ASSIGN) && (lastflag & CD_FLAG_NOFREE))
 			newlayer = customData_add_layer__internal(dest, type, CD_REFERENCE,
-				layer->data, totelem, layer->name);
+				data, totelem, layer->name);
 		else
 			newlayer = customData_add_layer__internal(dest, type, alloctype,
-				layer->data, totelem, layer->name);
+				data, totelem, layer->name);
 		
-		if(newlayer) {
+		if (newlayer) {
+			newlayer->uid = layer->uid;
+			
 			newlayer->active = lastactive;
 			newlayer->active_rnd = lastrender;
 			newlayer->active_clone = lastclone;
@@ -1188,7 +1210,7 @@ void CustomData_copy(const struct CustomData *source, struct CustomData *dest,
 {
 	memset(dest, 0, sizeof(*dest));
 
-	if(source->external)
+	if (source->external)
 		dest->external= MEM_dupallocN(source->external);
 
 	CustomData_merge(source, dest, mask, alloctype, totelem);
@@ -1198,20 +1220,20 @@ static void customData_free_layer__internal(CustomDataLayer *layer, int totelem)
 {
 	const LayerTypeInfo *typeInfo;
 
-	if(!(layer->flag & CD_FLAG_NOFREE) && layer->data) {
+	if (!(layer->flag & CD_FLAG_NOFREE) && layer->data) {
 		typeInfo = layerType_getInfo(layer->type);
 
-		if(typeInfo->free)
+		if (typeInfo->free)
 			typeInfo->free(layer->data, totelem, typeInfo->size);
 
-		if(layer->data)
+		if (layer->data)
 			MEM_freeN(layer->data);
 	}
 }
 
 static void CustomData_external_free(CustomData *data)
 {
-	if(data->external) {
+	if (data->external) {
 		MEM_freeN(data->external);
 		data->external= NULL;
 	}
@@ -1221,10 +1243,10 @@ void CustomData_free(CustomData *data, int totelem)
 {
 	int i;
 
-	for(i = 0; i < data->totlayer; ++i)
+	for (i = 0; i < data->totlayer; ++i)
 		customData_free_layer__internal(&data->layers[i], totelem);
 
-	if(data->layers)
+	if (data->layers)
 		MEM_freeN(data->layers);
 	
 	CustomData_external_free(data);
@@ -1237,7 +1259,7 @@ static void customData_update_offsets(CustomData *data)
 	const LayerTypeInfo *typeInfo;
 	int i, offset = 0;
 
-	for(i = 0; i < data->totlayer; ++i) {
+	for (i = 0; i < data->totlayer; ++i) {
 		typeInfo = layerType_getInfo(data->layers[i].type);
 
 		data->layers[i].offset = offset;
@@ -1252,8 +1274,8 @@ int CustomData_get_layer_index(const CustomData *data, int type)
 {
 	int i; 
 
-	for(i=0; i < data->totlayer; ++i)
-		if(data->layers[i].type == type)
+	for (i=0; i < data->totlayer; ++i)
+		if (data->layers[i].type == type)
 			return i;
 
 	return -1;
@@ -1274,8 +1296,8 @@ int CustomData_get_named_layer_index(const CustomData *data, int type, const cha
 {
 	int i;
 
-	for(i=0; i < data->totlayer; ++i)
-		if(data->layers[i].type == type && strcmp(data->layers[i].name, name)==0)
+	for (i=0; i < data->totlayer; ++i)
+		if (data->layers[i].type == type && strcmp(data->layers[i].name, name)==0)
 			return i;
 
 	return -1;
@@ -1297,8 +1319,8 @@ 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)
+	for (i=0; i < data->totlayer; ++i)
+		if (data->layers[i].type == type)
 			return i + data->layers[i].active_rnd;
 
 	return -1;
@@ -1308,8 +1330,8 @@ 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)
+	for (i=0; i < data->totlayer; ++i)
+		if (data->layers[i].type == type)
 			return i + data->layers[i].active_clone;
 
 	return -1;
@@ -1319,8 +1341,8 @@ int CustomData_get_stencil_layer_index(const CustomData *data, int type)
 {
 	int i;
 
-	for(i=0; i < data->totlayer; ++i)
-		if(data->layers[i].type == type)
+	for (i=0; i < data->totlayer; ++i)
+		if (data->layers[i].type == type)
 			return i + data->layers[i].active_mask;
 
 	return -1;
@@ -1330,8 +1352,8 @@ 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)
+	for (i=0; i < data->totlayer; ++i)
+		if (data->layers[i].type == type)
 			return data->layers[i].active;
 
 	return -1;
@@ -1341,8 +1363,8 @@ 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)
+	for (i=0; i < data->totlayer; ++i)
+		if (data->layers[i].type == type)
 			return data->layers[i].active_rnd;
 
 	return -1;
@@ -1352,8 +1374,8 @@ 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)
+	for (i=0; i < data->totlayer; ++i)
+		if (data->layers[i].type == type)
 			return data->layers[i].active_clone;
 
 	return -1;
@@ -1363,8 +1385,8 @@ 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)
+	for (i=0; i < data->totlayer; ++i)
+		if (data->layers[i].type == type)
 			return data->layers[i].active_mask;
 
 	return -1;
@@ -1374,8 +1396,8 @@ void CustomData_set_layer_active(CustomData *data, int type, int n)
 {
 	int i;
 
-	for(i=0; i < data->totlayer; ++i)
-		if(data->layers[i].type == type)
+	for (i=0; i < data->totlayer; ++i)
+		if (data->layers[i].type == type)
 			data->layers[i].active = n;
 }
 
@@ -1383,8 +1405,8 @@ void CustomData_set_layer_render(CustomData *data, int type, int n)
 {
 	int i;
 
-	for(i=0; i < data->totlayer; ++i)
-		if(data->layers[i].type == type)
+	for (i=0; i < data->totlayer; ++i)
+		if (data->layers[i].type == type)
 			data->layers[i].active_rnd = n;
 }
 
@@ -1392,8 +1414,8 @@ void CustomData_set_layer_clone(CustomData *data, int type, int n)
 {
 	int i;
 
-	for(i=0; i < data->totlayer; ++i)
-		if(data->layers[i].type == type)
+	for (i=0; i < data->totlayer; ++i)
+		if (data->layers[i].type == type)
 			data->layers[i].active_clone = n;
 }
 
@@ -1401,8 +1423,8 @@ void CustomData_set_layer_stencil(CustomData *data, int type, int n)
 {
 	int i;
 
-	for(i=0; i < data->totlayer; ++i)
-		if(data->layers[i].type == type)
+	for (i=0; i < data->totlayer; ++i)
+		if (data->layers[i].type == type)
 			data->layers[i].active_mask = n;
 }
 
@@ -1411,8 +1433,8 @@ void CustomData_set_layer_active_index(CustomData *data, int type, int n)
 {
 	int i;
 
-	for(i=0; i < data->totlayer; ++i)
-		if(data->layers[i].type == type)
+	for (i=0; i < data->totlayer; ++i)
+		if (data->layers[i].type == type)
 			data->layers[i].active = n-i;
 }
 
@@ -1420,8 +1442,8 @@ void CustomData_set_layer_render_index(CustomData *data, int type, int n)
 {
 	int i;
 
-	for(i=0; i < data->totlayer; ++i)
-		if(data->layers[i].type == type)
+	for (i=0; i < data->totlayer; ++i)
+		if (data->layers[i].type == type)
 			data->layers[i].active_rnd = n-i;
 }
 
@@ -1429,8 +1451,8 @@ void CustomData_set_layer_clone_index(CustomData *data, int type, int n)
 {
 	int i;
 
-	for(i=0; i < data->totlayer; ++i)
-		if(data->layers[i].type == type)
+	for (i=0; i < data->totlayer; ++i)
+		if (data->layers[i].type == type)
 			data->layers[i].active_clone = n-i;
 }
 
@@ -1438,8 +1460,8 @@ void CustomData_set_layer_stencil_index(CustomData *data, int type, int n)
 {
 	int i;
 
-	for(i=0; i < data->totlayer; ++i)
-		if(data->layers[i].type == type)
+	for (i=0; i < data->totlayer; ++i)
+		if (data->layers[i].type == type)
 			data->layers[i].active_mask = n-i;
 }
 
@@ -1447,8 +1469,8 @@ void CustomData_set_layer_flag(struct CustomData *data, int type, int flag)
 {
 	int i;
 
-	for(i=0; i < data->totlayer; ++i)
-		if(data->layers[i].type == type)
+	for (i=0; i < data->totlayer; ++i)
+		if (data->layers[i].type == type)
 			data->layers[i].flag |= flag;
 }
 
@@ -1456,7 +1478,7 @@ static int customData_resize(CustomData *data, int amount)
 {
 	CustomDataLayer *tmp = MEM_callocN(sizeof(*tmp)*(data->maxlayer + amount),
 									   "CustomData->layers");
-	if(!tmp) return 0;
+	if (!tmp) return 0;
 
 	data->maxlayer += amount;
 	if (data->layers) {
@@ -1473,36 +1495,43 @@ static CustomDataLayer *customData_add_layer__internal(CustomData *data,
 {
 	const LayerTypeInfo *typeInfo= layerType_getInfo(type);
 	int size = typeInfo->size * totelem, flag = 0, index = data->totlayer;
-	void *newlayerdata;
+	void *newlayerdata = NULL;
+
+	/* Passing a layerdata to copy from with an alloctype that won't copy is
+	 * most likely a bug */
+	BLI_assert(!layerdata ||
+	           (alloctype == CD_ASSIGN) ||
+	           (alloctype == CD_DUPLICATE) ||
+	           (alloctype == CD_REFERENCE));
 
 	if (!typeInfo->defaultname && CustomData_has_layer(data, type))
 		return &data->layers[CustomData_get_layer_index(data, type)];
 
-	if((alloctype == CD_ASSIGN) || (alloctype == CD_REFERENCE)) {
+	if ((alloctype == CD_ASSIGN) || (alloctype == CD_REFERENCE)) {
 		newlayerdata = layerdata;
 	}
-	else {
+	else if (size > 0) {
 		newlayerdata = MEM_callocN(size, layerType_getName(type));
-		if(!newlayerdata)
+		if (!newlayerdata)
 			return NULL;
 	}
 
-	if (alloctype == CD_DUPLICATE) {
-		if(typeInfo->copy)
+	if (alloctype == CD_DUPLICATE && layerdata) {
+		if (typeInfo->copy)
 			typeInfo->copy(layerdata, newlayerdata, totelem);
 		else
 			memcpy(newlayerdata, layerdata, size);
 	}
 	else if (alloctype == CD_DEFAULT) {
-		if(typeInfo->set_default)
+		if (typeInfo->set_default)
 			typeInfo->set_default((char*)newlayerdata, totelem);
 	}
 	else if (alloctype == CD_REFERENCE)
 		flag |= CD_FLAG_NOFREE;
 
-	if(index >= data->maxlayer) {
-		if(!customData_resize(data, CUSTOMDATA_GROW)) {
-			if(newlayerdata != layerdata)
+	if (index >= data->maxlayer) {
+		if (!customData_resize(data, CUSTOMDATA_GROW)) {
+			if (newlayerdata != layerdata)
 				MEM_freeN(newlayerdata);
 			return NULL;
 		}
@@ -1511,26 +1540,27 @@ static CustomDataLayer *customData_add_layer__internal(CustomData *data,
 	data->totlayer++;
 
 	/* keep layers ordered by type */
-	for( ; index > 0 && data->layers[index - 1].type > type; --index)
+	for ( ; index > 0 && data->layers[index - 1].type > type; --index)
 		data->layers[index] = data->layers[index - 1];
 
 	data->layers[index].type = type;
 	data->layers[index].flag = flag;
 	data->layers[index].data = newlayerdata;
 
-	if(name || (name=typeInfo->defaultname)) {
+	if (name || (name=typeInfo->defaultname)) {
 		BLI_strncpy(data->layers[index].name, name, sizeof(data->layers[index].name));
 		CustomData_set_layer_unique_name(data, index);
 	}
 	else
 		data->layers[index].name[0] = '\0';
 
-	if(index > 0 && data->layers[index-1].type == type) {
+	if (index > 0 && data->layers[index-1].type == type) {
 		data->layers[index].active = data->layers[index-1].active;
 		data->layers[index].active_rnd = data->layers[index-1].active_rnd;
 		data->layers[index].active_clone = data->layers[index-1].active_clone;
 		data->layers[index].active_mask = data->layers[index-1].active_mask;
-	} else {
+	}
+	else {
 		data->layers[index].active = 0;
 		data->layers[index].active_rnd = 0;
 		data->layers[index].active_clone = 0;
@@ -1552,7 +1582,7 @@ void *CustomData_add_layer(CustomData *data, int type, int alloctype,
 										   totelem, typeInfo->defaultname);
 	CustomData_update_typemap(data);
 
-	if(layer)
+	if (layer)
 		return layer->data;
 
 	return NULL;
@@ -1568,7 +1598,7 @@ void *CustomData_add_layer_named(CustomData *data, int type, int alloctype,
 										   totelem, name);
 	CustomData_update_typemap(data);
 
-	if(layer)
+	if (layer)
 		return layer->data;
 
 	return NULL;
@@ -1634,8 +1664,8 @@ int CustomData_number_of_layers(const CustomData *data, int type)
 {
 	int i, number = 0;
 
-	for(i = 0; i < data->totlayer; i++)
-		if(data->layers[i].type == type)
+	for (i = 0; i < data->totlayer; i++)
+		if (data->layers[i].type == type)
 			number++;
 	
 	return number;
@@ -1648,18 +1678,18 @@ void *CustomData_duplicate_referenced_layer(struct CustomData *data, const int t
 
 	/* get the layer index of the first layer of type */
 	layer_index = CustomData_get_active_layer_index(data, type);
-	if(layer_index < 0) return NULL;
+	if (layer_index < 0) return NULL;
 
 	layer = &data->layers[layer_index];
 
 	if (layer->flag & CD_FLAG_NOFREE) {
-		/* MEM_dupallocN won’t work in case of complex layers, like e.g.
+		/* MEM_dupallocN won't work in case of complex layers, like e.g.
 		 * CD_MDEFORMVERT, which has pointers to allocated data...
 		 * So in case a custom copy function is defined, use it!
 		 */
 		const LayerTypeInfo *typeInfo = layerType_getInfo(layer->type);
 
-		if(typeInfo->copy) {
+		if (typeInfo->copy) {
 			char *dest_data = MEM_mallocN(typeInfo->size * totelem, "CD duplicate ref layer");
 			typeInfo->copy(layer->data, dest_data, totelem);
 			layer->data = dest_data;
@@ -1681,18 +1711,18 @@ void *CustomData_duplicate_referenced_layer_named(struct CustomData *data,
 
 	/* get the layer index of the desired layer */
 	layer_index = CustomData_get_named_layer_index(data, type, name);
-	if(layer_index < 0) return NULL;
+	if (layer_index < 0) return NULL;
 
 	layer = &data->layers[layer_index];
 
 	if (layer->flag & CD_FLAG_NOFREE) {
-		/* MEM_dupallocN won’t work in case of complex layers, like e.g.
+		/* MEM_dupallocN won't work in case of complex layers, like e.g.
 		 * CD_MDEFORMVERT, which has pointers to allocated data...
 		 * So in case a custom copy function is defined, use it!
 		 */
 		const LayerTypeInfo *typeInfo = layerType_getInfo(layer->type);
 
-		if(typeInfo->copy) {
+		if (typeInfo->copy) {
 			char *dest_data = MEM_mallocN(typeInfo->size * totelem, "CD duplicate ref layer");
 			typeInfo->copy(layer->data, dest_data, totelem);
 			layer->data = dest_data;
@@ -1713,7 +1743,7 @@ int CustomData_is_referenced_layer(struct CustomData *data, int type)
 
 	/* get the layer index of the first layer of type */
 	layer_index = CustomData_get_active_layer_index(data, type);
-	if(layer_index < 0) return 0;
+	if (layer_index < 0) return 0;
 
 	layer = &data->layers[layer_index];
 
@@ -1725,7 +1755,7 @@ void CustomData_free_temporary(CustomData *data, int totelem)
 	CustomDataLayer *layer;
 	int i, j;
 
-	for(i = 0, j = 0; i < data->totlayer; ++i) {
+	for (i = 0, j = 0; i < data->totlayer; ++i) {
 		layer = &data->layers[i];
 
 		if (i != j)
@@ -1739,7 +1769,7 @@ void CustomData_free_temporary(CustomData *data, int totelem)
 
 	data->totlayer = j;
 
-	if(data->totlayer <= data->maxlayer-CUSTOMDATA_GROW)
+	if (data->totlayer <= data->maxlayer-CUSTOMDATA_GROW)
 		customData_resize(data, -CUSTOMDATA_GROW);
 
 	customData_update_offsets(data);
@@ -1750,8 +1780,8 @@ void CustomData_set_only_copy(const struct CustomData *data,
 {
 	int i;
 
-	for(i = 0; i < data->totlayer; ++i)
-		if(!(mask & CD_TYPE_AS_MASK(data->layers[i].type)))
+	for (i = 0; i < data->totlayer; ++i)
+		if (!(mask & CD_TYPE_AS_MASK(data->layers[i].type)))
 			data->layers[i].flag |= CD_FLAG_NOCOPY;
 }
 
@@ -1775,20 +1805,20 @@ void CustomData_copy_data(const CustomData *source, CustomData *dest,
 
 	/* copies a layer at a time */
 	dest_i = 0;
-	for(src_i = 0; src_i < source->totlayer; ++src_i) {
+	for (src_i = 0; src_i < source->totlayer; ++src_i) {
 
 		/* find the first dest layer with type >= the source type
 		 * (this should work because layers are ordered by type)
 		 */
-		while(dest_i < dest->totlayer
-			  && dest->layers[dest_i].type < source->layers[src_i].type)
+		while (dest_i < dest->totlayer && dest->layers[dest_i].type < source->layers[src_i].type) {
 			++dest_i;
+		}
 
 		/* if there are no more dest layers, we're done */
-		if(dest_i >= dest->totlayer) return;
+		if (dest_i >= dest->totlayer) return;
 
 		/* if we found a matching layer, copy the data */
-		if(dest->layers[dest_i].type == source->layers[src_i].type) {
+		if (dest->layers[dest_i].type == source->layers[src_i].type) {
 			char *src_data = source->layers[src_i].data;
 			char *dest_data = dest->layers[dest_i].data;
 
@@ -1798,13 +1828,15 @@ void CustomData_copy_data(const CustomData *source, CustomData *dest,
 			dest_offset = dest_index * typeInfo->size;
 			
 			if (!src_data || !dest_data) {
-				printf("%s: warning null data for %s type (%p --> %p), skipping\n",
-				       __func__, layerType_getName(source->layers[src_i].type),
-				       (void *)src_data, (void *)dest_data);
+				if (src_data != NULL && dest_data != NULL) {
+					printf("%s: warning null data for %s type (%p --> %p), skipping\n",
+					       __func__, layerType_getName(source->layers[src_i].type),
+					       (void *)src_data, (void *)dest_data);
+				}
 				continue;
 			}
 			
-			if(typeInfo->copy)
+			if (typeInfo->copy)
 				typeInfo->copy(src_data + src_offset,
 								dest_data + dest_offset,
 								count);
@@ -1827,11 +1859,11 @@ void CustomData_free_elem(CustomData *data, int index, int count)
 	int i;
 	const LayerTypeInfo *typeInfo;
 
-	for(i = 0; i < data->totlayer; ++i) {
-		if(!(data->layers[i].flag & CD_FLAG_NOFREE)) {
+	for (i = 0; i < data->totlayer; ++i) {
+		if (!(data->layers[i].flag & CD_FLAG_NOFREE)) {
 			typeInfo = layerType_getInfo(data->layers[i].type);
 
-			if(typeInfo->free) {
+			if (typeInfo->free) {
 				int offset = typeInfo->size * index;
 
 				typeInfo->free((char *)data->layers[i].data + offset,
@@ -1856,31 +1888,31 @@ void CustomData_interp(const CustomData *source, CustomData *dest,
 	/* slow fallback in case we're interpolating a ridiculous number of
 	 * elements
 	 */
-	if(count > SOURCE_BUF_SIZE)
+	if (count > SOURCE_BUF_SIZE)
 		sources = MEM_callocN(sizeof(*sources) * count,
 							  "CustomData_interp sources");
 
 	/* interpolates a layer at a time */
 	dest_i = 0;
-	for(src_i = 0; src_i < source->totlayer; ++src_i) {
+	for (src_i = 0; src_i < source->totlayer; ++src_i) {
 		const LayerTypeInfo *typeInfo= layerType_getInfo(source->layers[src_i].type);
-		if(!typeInfo->interp) continue;
+		if (!typeInfo->interp) continue;
 
 		/* find the first dest layer with type >= the source type
 		 * (this should work because layers are ordered by type)
 		 */
-		while(dest_i < dest->totlayer
-			  && dest->layers[dest_i].type < source->layers[src_i].type)
+		while (dest_i < dest->totlayer && dest->layers[dest_i].type < source->layers[src_i].type) {
 			++dest_i;
+		}
 
 		/* if there are no more dest layers, we're done */
-		if(dest_i >= dest->totlayer) return;
+		if (dest_i >= dest->totlayer) return;
 
 		/* if we found a matching layer, copy the data */
-		if(dest->layers[dest_i].type == source->layers[src_i].type) {
+		if (dest->layers[dest_i].type == source->layers[src_i].type) {
 			void *src_data = source->layers[src_i].data;
 
-			for(j = 0; j < count; ++j)
+			for (j = 0; j < count; ++j)
 				sources[j] = (char *)src_data
 							 + typeInfo->size * src_indices[j];
 
@@ -1897,7 +1929,7 @@ void CustomData_interp(const CustomData *source, CustomData *dest,
 		}
 	}
 
-	if(count > SOURCE_BUF_SIZE) MEM_freeN(sources);
+	if (count > SOURCE_BUF_SIZE) MEM_freeN(sources);
 }
 
 void CustomData_swap(struct CustomData *data, int index, const int *corner_indices)
@@ -1905,10 +1937,10 @@ void CustomData_swap(struct CustomData *data, int index, const int *corner_indic
 	const LayerTypeInfo *typeInfo;
 	int i;
 
-	for(i = 0; i < data->totlayer; ++i) {
+	for (i = 0; i < data->totlayer; ++i) {
 		typeInfo = layerType_getInfo(data->layers[i].type);
 
-		if(typeInfo->swap) {
+		if (typeInfo->swap) {
 			int offset = typeInfo->size * index;
 
 			typeInfo->swap((char *)data->layers[i].data + offset, corner_indices);
@@ -1923,7 +1955,7 @@ void *CustomData_get(const CustomData *data, int index, int type)
 	
 	/* get the layer index of the active layer of type */
 	layer_index = CustomData_get_active_layer_index(data, type);
-	if(layer_index < 0) return NULL;
+	if (layer_index < 0) return NULL;
 
 	/* get the offset of the desired element */
 	offset = layerType_getInfo(type)->size * index;
@@ -1938,7 +1970,7 @@ void *CustomData_get_n(const CustomData *data, int type, int index, int n)
 
 	/* get the layer index of the first layer of type */
 	layer_index = data->typemap[type];
-	if(layer_index < 0) return NULL;
+	if (layer_index < 0) return NULL;
 
 	offset = layerType_getInfo(type)->size * index;
 	return (char *)data->layers[layer_index+n].data + offset;
@@ -1948,7 +1980,7 @@ void *CustomData_get_layer(const CustomData *data, int type)
 {
 	/* get the layer index of the active layer of type */
 	int layer_index = CustomData_get_active_layer_index(data, type);
-	if(layer_index < 0) return NULL;
+	if (layer_index < 0) return NULL;
 
 	return data->layers[layer_index].data;
 }
@@ -1957,7 +1989,7 @@ void *CustomData_get_layer_n(const CustomData *data, int type, int n)
 {
 	/* get the layer index of the active layer of type */
 	int layer_index = CustomData_get_layer_index_n(data, type, n);
-	if(layer_index < 0) return NULL;
+	if (layer_index < 0) return NULL;
 
 	return data->layers[layer_index].data;
 }
@@ -1966,7 +1998,7 @@ void *CustomData_get_layer_named(const struct CustomData *data, int type,
 								 const char *name)
 {
 	int layer_index = CustomData_get_named_layer_index(data, type, name);
-	if(layer_index < 0) return NULL;
+	if (layer_index < 0) return NULL;
 
 	return data->layers[layer_index].data;
 }
@@ -1977,7 +2009,7 @@ int CustomData_set_layer_name(const CustomData *data, int type, int n, const cha
 	/* get the layer index of the first layer of type */
 	int layer_index = CustomData_get_layer_index_n(data, type, n);
 
-	if(layer_index < 0) return 0;
+	if (layer_index < 0) return 0;
 	if (!name) return 0;
 	
 	strcpy(data->layers[layer_index].name, name);
@@ -1990,7 +2022,7 @@ void *CustomData_set_layer(const CustomData *data, int type, void *ptr)
 	/* get the layer index of the first layer of type */
 	int layer_index = CustomData_get_active_layer_index(data, type);
 
-	if(layer_index < 0) return NULL;
+	if (layer_index < 0) return NULL;
 
 	data->layers[layer_index].data = ptr;
 
@@ -2001,7 +2033,7 @@ void *CustomData_set_layer_n(const struct CustomData *data, int type, int n, voi
 {
 	/* get the layer index of the first layer of type */
 	int layer_index = CustomData_get_layer_index_n(data, type, n);
-	if(layer_index < 0) return NULL;
+	if (layer_index < 0) return NULL;
 
 	data->layers[layer_index].data = ptr;
 
@@ -2013,326 +2045,177 @@ void CustomData_set(const CustomData *data, int index, int type, void *source)
 	void *dest = CustomData_get(data, index, type);
 	const LayerTypeInfo *typeInfo = layerType_getInfo(type);
 
-	if(!dest) return;
+	if (!dest) return;
 
-	if(typeInfo->copy)
+	if (typeInfo->copy)
 		typeInfo->copy(source, dest, 1);
 	else
 		memcpy(dest, source, typeInfo->size);
 }
 
-/* EditMesh functions */
-
-void CustomData_em_free_block(CustomData *data, void **block)
+/*Bmesh functions*/
+/*needed to convert to/from different face reps*/
+void CustomData_to_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *ldata,
+                             int totloop, int totpoly)
 {
-	const LayerTypeInfo *typeInfo;
 	int i;
-
-	if(!*block) return;
-
-	for(i = 0; i < data->totlayer; ++i) {
-		if(!(data->layers[i].flag & CD_FLAG_NOFREE)) {
-			typeInfo = layerType_getInfo(data->layers[i].type);
-
-			if(typeInfo->free) {
-				int offset = data->layers[i].offset;
-				typeInfo->free((char*)*block + offset, 1, typeInfo->size);
-			}
+	for (i=0; i < fdata->totlayer; i++) {
+		if (fdata->layers[i].type == CD_MTFACE) {
+			CustomData_add_layer_named(pdata, CD_MTEXPOLY, CD_CALLOC, NULL, totpoly, fdata->layers[i].name);
+			CustomData_add_layer_named(ldata, CD_MLOOPUV, CD_CALLOC, NULL, totloop, fdata->layers[i].name);
 		}
-	}
-
-	MEM_freeN(*block);
-	*block = NULL;
-}
-
-static void CustomData_em_alloc_block(CustomData *data, void **block)
-{
-	/* TODO: optimize free/alloc */
-
-	if (*block)
-		CustomData_em_free_block(data, block);
-
-	if (data->totsize > 0)
-		*block = MEM_callocN(data->totsize, "CustomData EM block");
-	else
-		*block = NULL;
-}
-
-void CustomData_em_copy_data(const CustomData *source, CustomData *dest,
-							void *src_block, void **dest_block)
-{
-	const LayerTypeInfo *typeInfo;
-	int dest_i, src_i;
-
-	if (!*dest_block)
-		CustomData_em_alloc_block(dest, dest_block);
-	
-	/* copies a layer at a time */
-	dest_i = 0;
-	for(src_i = 0; src_i < source->totlayer; ++src_i) {
-
-		/* find the first dest layer with type >= the source type
-		 * (this should work because layers are ordered by type)
-		 */
-		while(dest_i < dest->totlayer
-			  && dest->layers[dest_i].type < source->layers[src_i].type)
-			++dest_i;
-
-		/* if there are no more dest layers, we're done */
-		if(dest_i >= dest->totlayer) return;
-
-		/* if we found a matching layer, copy the data */
-		if(dest->layers[dest_i].type == source->layers[src_i].type &&
-			strcmp(dest->layers[dest_i].name, source->layers[src_i].name) == 0) {
-			char *src_data = (char*)src_block + source->layers[src_i].offset;
-			char *dest_data = (char*)*dest_block + dest->layers[dest_i].offset;
-
-			typeInfo = layerType_getInfo(source->layers[src_i].type);
-
-			if(typeInfo->copy)
-				typeInfo->copy(src_data, dest_data, 1);
-			else
-				memcpy(dest_data, src_data, typeInfo->size);
-
-			/* if there are multiple source & dest layers of the same type,
-			 * we don't want to copy all source layers to the same dest, so
-			 * increment dest_i
-			 */
-			++dest_i;
+		else if (fdata->layers[i].type == CD_MCOL) {
+			CustomData_add_layer_named(ldata, CD_MLOOPCOL, CD_CALLOC, NULL, totloop, fdata->layers[i].name);
+		}
+		else if (fdata->layers[i].type == CD_MDISPS) {
+			CustomData_add_layer_named(ldata, CD_MDISPS, CD_CALLOC, NULL, totloop, fdata->layers[i].name);
 		}
 	}
 }
 
-void CustomData_em_validate_data(CustomData *data, void *block, int sub_elements)
+void CustomData_from_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *ldata, int total)
 {
 	int i;
-	for(i = 0; i < data->totlayer; i++) {
-		const LayerTypeInfo *typeInfo = layerType_getInfo(data->layers[i].type);
-		char *leayer_data = (char*)block + data->layers[i].offset;
-
-		if(typeInfo->validate)
-			typeInfo->validate(leayer_data, sub_elements);
+	for (i=0; i < pdata->totlayer; i++) {
+		if (pdata->layers[i].type == CD_MTEXPOLY) {
+			CustomData_add_layer_named(fdata, CD_MTFACE, CD_CALLOC, NULL, total, pdata->layers[i].name);
+		}
 	}
-}
-
-void *CustomData_em_get(const CustomData *data, void *block, int type)
-{
-	int layer_index;
-	
-	/* get the layer index of the first layer of type */
-	layer_index = CustomData_get_active_layer_index(data, type);
-	if(layer_index < 0) return NULL;
-
-	return (char *)block + data->layers[layer_index].offset;
-}
-
-void *CustomData_em_get_n(const CustomData *data, void *block, int type, int n)
-{
-	int layer_index;
-	
-	/* get the layer index of the first layer of type */
-	layer_index = CustomData_get_layer_index_n(data, type, n);
-	if(layer_index < 0) return NULL;
-
-	return (char *)block + data->layers[layer_index].offset;
-}
-
-void CustomData_em_set(CustomData *data, void *block, int type, void *source)
-{
-	void *dest = CustomData_em_get(data, block, type);
-	const LayerTypeInfo *typeInfo = layerType_getInfo(type);
-
-	if(!dest) return;
-
-	if(typeInfo->copy)
-		typeInfo->copy(source, dest, 1);
-	else
-		memcpy(dest, source, typeInfo->size);
-}
-
-void CustomData_em_set_n(CustomData *data, void *block, int type, int n, void *source)
-{
-	void *dest = CustomData_em_get_n(data, block, type, n);
-	const LayerTypeInfo *typeInfo = layerType_getInfo(type);
-
-	if(!dest) return;
-
-	if(typeInfo->copy)
-		typeInfo->copy(source, dest, 1);
-	else
-		memcpy(dest, source, typeInfo->size);
-}
-
-void CustomData_em_interp(CustomData *data, void **src_blocks, float *weights,
-						  float *sub_weights, int count, void *dest_block)
-{
-	int i, j;
-	void *source_buf[SOURCE_BUF_SIZE];
-	void **sources = source_buf;
-
-	/* slow fallback in case we're interpolating a ridiculous number of
-	 * elements
-	 */
-	if(count > SOURCE_BUF_SIZE)
-		sources = MEM_callocN(sizeof(*sources) * count,
-							  "CustomData_interp sources");
-
-	/* interpolates a layer at a time */
-	for(i = 0; i < data->totlayer; ++i) {
-		CustomDataLayer *layer = &data->layers[i];
-		const LayerTypeInfo *typeInfo = layerType_getInfo(layer->type);
-
-		if(typeInfo->interp) {
-			for(j = 0; j < count; ++j)
-				sources[j] = (char *)src_blocks[j] + layer->offset;
-
-			typeInfo->interp(sources, weights, sub_weights, count,
-							  (char *)dest_block + layer->offset);
+	for (i=0; i < ldata->totlayer; i++) {
+		if (ldata->layers[i].type == CD_MLOOPCOL) {
+			CustomData_add_layer_named(fdata, CD_MCOL, CD_CALLOC, NULL, total, ldata->layers[i].name);
+		}
+		else if (ldata->layers[i].type == CD_PREVIEW_MLOOPCOL) {
+			CustomData_add_layer_named(fdata, CD_PREVIEW_MCOL, CD_CALLOC, NULL, total, ldata->layers[i].name);
+		}
+		else if (ldata->layers[i].type == CD_ORIGSPACE_MLOOP) {
+			CustomData_add_layer_named(fdata, CD_ORIGSPACE, CD_CALLOC, NULL, total, ldata->layers[i].name);
 		}
 	}
 
-	if(count > SOURCE_BUF_SIZE) MEM_freeN(sources);
+	CustomData_bmesh_update_active_layers(fdata, pdata, ldata);
 }
 
-void CustomData_em_set_default(CustomData *data, void **block)
+void CustomData_bmesh_update_active_layers(CustomData *fdata, CustomData *pdata, CustomData *ldata)
 {
-	const LayerTypeInfo *typeInfo;
-	int i;
+	int act;
 
-	if (!*block)
-		CustomData_em_alloc_block(data, block);
+	if (CustomData_has_layer(pdata, CD_MTEXPOLY)) {
+		act = CustomData_get_active_layer(pdata, CD_MTEXPOLY);
+		CustomData_set_layer_active(ldata, CD_MLOOPUV, act);
+		CustomData_set_layer_active(fdata, CD_MTFACE, act);
 
-	for(i = 0; i < data->totlayer; ++i) {
-		int offset = data->layers[i].offset;
+		act = CustomData_get_render_layer(pdata, CD_MTEXPOLY);
+		CustomData_set_layer_render(ldata, CD_MLOOPUV, act);
+		CustomData_set_layer_render(fdata, CD_MTFACE, act);
 
-		typeInfo = layerType_getInfo(data->layers[i].type);
+		act = CustomData_get_clone_layer(pdata, CD_MTEXPOLY);
+		CustomData_set_layer_clone(ldata, CD_MLOOPUV, act);
+		CustomData_set_layer_clone(fdata, CD_MTFACE, act);
 
-		if(typeInfo->set_default)
-			typeInfo->set_default((char*)*block + offset, 1);
+		act = CustomData_get_stencil_layer(pdata, CD_MTEXPOLY);
+		CustomData_set_layer_stencil(ldata, CD_MLOOPUV, act);
+		CustomData_set_layer_stencil(fdata, CD_MTFACE, act);
 	}
-}
 
-void CustomData_to_em_block(const CustomData *source, CustomData *dest,
-							int src_index, void **dest_block)
-{
-	const LayerTypeInfo *typeInfo;
-	int dest_i, src_i, src_offset;
+	if (CustomData_has_layer(ldata, CD_MLOOPCOL)) {
+		act = CustomData_get_active_layer(ldata, CD_MLOOPCOL);
+		CustomData_set_layer_active(fdata, CD_MCOL, act);
 
-	if (!*dest_block)
-		CustomData_em_alloc_block(dest, dest_block);
-	
-	/* copies a layer at a time */
-	dest_i = 0;
-	for(src_i = 0; src_i < source->totlayer; ++src_i) {
-
-		/* find the first dest layer with type >= the source type
-		 * (this should work because layers are ordered by type)
-		 */
-		while(dest_i < dest->totlayer
-			  && dest->layers[dest_i].type < source->layers[src_i].type)
-			++dest_i;
-
-		/* if there are no more dest layers, we're done */
-		if(dest_i >= dest->totlayer) return;
-
-		/* if we found a matching layer, copy the data */
-		if(dest->layers[dest_i].type == source->layers[src_i].type) {
-			int offset = dest->layers[dest_i].offset;
-			char *src_data = source->layers[src_i].data;
-			char *dest_data = (char*)*dest_block + offset;
-
-			typeInfo = layerType_getInfo(dest->layers[dest_i].type);
-			src_offset = src_index * typeInfo->size;
+		act = CustomData_get_render_layer(ldata, CD_MLOOPCOL);
+		CustomData_set_layer_render(fdata, CD_MCOL, act);
 
-			if(typeInfo->copy)
-				typeInfo->copy(src_data + src_offset, dest_data, 1);
-			else
-				memcpy(dest_data, src_data + src_offset, typeInfo->size);
+		act = CustomData_get_clone_layer(ldata, CD_MLOOPCOL);
+		CustomData_set_layer_clone(fdata, CD_MCOL, act);
 
-			/* if there are multiple source & dest layers of the same type,
-			 * we don't want to copy all source layers to the same dest, so
-			 * increment dest_i
-			 */
-			++dest_i;
-		}
+		act = CustomData_get_stencil_layer(ldata, CD_MLOOPCOL);
+		CustomData_set_layer_stencil(fdata, CD_MCOL, act);
 	}
 }
 
-void CustomData_from_em_block(const CustomData *source, CustomData *dest,
-							  void *src_block, int dest_index)
+void CustomData_bmesh_init_pool(CustomData *data, int totelem, const char htype)
 {
-	const LayerTypeInfo *typeInfo;
-	int dest_i, src_i, dest_offset;
-
-	/* copies a layer at a time */
-	dest_i = 0;
-	for(src_i = 0; src_i < source->totlayer; ++src_i) {
-
-		/* find the first dest layer with type >= the source type
-		 * (this should work because layers are ordered by type)
-		 */
-		while(dest_i < dest->totlayer
-			  && dest->layers[dest_i].type < source->layers[src_i].type)
-			++dest_i;
+	int chunksize;
 
-		/* if there are no more dest layers, we're done */
-		if(dest_i >= dest->totlayer) return;
+	/* Dispose old pools before calling here to avoid leaks */
+	BLI_assert(data->pool == NULL);
 
-		/* if we found a matching layer, copy the data */
-		if(dest->layers[dest_i].type == source->layers[src_i].type) {
-			int offset = source->layers[src_i].offset;
-			char *src_data = (char*)src_block + offset;
-			char *dest_data = dest->layers[dest_i].data;
-
-			typeInfo = layerType_getInfo(dest->layers[dest_i].type);
-			dest_offset = dest_index * typeInfo->size;
-
-			if(typeInfo->copy)
-				typeInfo->copy(src_data, dest_data + dest_offset, 1);
-			else
-				memcpy(dest_data + dest_offset, src_data, typeInfo->size);
-
-			/* if there are multiple source & dest layers of the same type,
-			 * we don't want to copy all source layers to the same dest, so
-			 * increment dest_i
-			 */
-			++dest_i;
-		}
+	switch (htype) {
+		case BM_VERT: chunksize = bm_mesh_chunksize_default.totvert;  break;
+		case BM_EDGE: chunksize = bm_mesh_chunksize_default.totedge;  break;
+		case BM_LOOP: chunksize = bm_mesh_chunksize_default.totloop;  break;
+		case BM_FACE: chunksize = bm_mesh_chunksize_default.totface;  break;
+		default:
+			BLI_assert(0);
+			chunksize = 512;
+			break;
 	}
 
+	/* If there are no layers, no pool is needed just yet */
+	if (data->totlayer) {
+		data->pool = BLI_mempool_create(data->totsize, totelem, chunksize, BLI_MEMPOOL_SYSMALLOC);
+	}
 }
 
-/*Bmesh functions*/
-/*needed to convert to/from different face reps*/
-void CustomData_to_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *ldata)
+void CustomData_bmesh_merge(CustomData *source, CustomData *dest, 
+                            CustomDataMask mask, int alloctype, BMesh *bm, const char htype)
 {
-	int i;
-	for(i=0; i < fdata->totlayer; i++){
-		if(fdata->layers[i].type == CD_MTFACE){
-			CustomData_add_layer(pdata, CD_MTEXPOLY, CD_CALLOC, &(fdata->layers[i].name), 0);
-			CustomData_add_layer(ldata, CD_MLOOPUV, CD_CALLOC, &(fdata->layers[i].name), 0);
+	BMHeader *h;
+	BMIter iter;
+	CustomData destold;
+	void *tmp;
+	int t;
+
+	/* copy old layer description so that old data can be copied into
+	 * the new allocation */
+	destold = *dest;
+	if (destold.layers) destold.layers = MEM_dupallocN(destold.layers);
+	
+	CustomData_merge(source, dest, mask, alloctype, 0);
+	dest->pool = NULL;
+	CustomData_bmesh_init_pool(dest, 512, htype);
+
+	switch (htype) {
+		case BM_VERT:
+			t = BM_VERTS_OF_MESH; break;
+		case BM_EDGE:
+			t = BM_EDGES_OF_MESH; break;
+		case BM_LOOP:
+			t = BM_LOOPS_OF_FACE; break;
+		case BM_FACE:
+			t = BM_FACES_OF_MESH; break;
+		default: /* should never happen */
+			BLI_assert(!"invalid type given");
+			t = BM_VERTS_OF_MESH;
+	}
+
+	if (t != BM_LOOPS_OF_FACE) {
+		/*ensure all current elements follow new customdata layout*/
+		BM_ITER_MESH (h, &iter, bm, t) {
+			tmp = NULL;
+			CustomData_bmesh_copy_data(&destold, dest, h->data, &tmp);
+			CustomData_bmesh_free_block(&destold, &h->data);
+			h->data = tmp;
 		}
-		else if(fdata->layers[i].type == CD_MCOL)
-			CustomData_add_layer(ldata, CD_MLOOPCOL, CD_CALLOC, &(fdata->layers[i].name), 0);
-	}		
-}
-void CustomData_from_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *ldata, int total)
-{
-	int i;
-	for(i=0; i < pdata->totlayer; i++){
-		if(pdata->layers[i].type == CD_MTEXPOLY)
-			CustomData_add_layer(fdata, CD_MTFACE, CD_CALLOC, &(pdata->layers[i].name), total);
 	}
-	for(i=0; i < ldata->totlayer; i++){
-		if(ldata->layers[i].type == CD_MLOOPCOL)
-			CustomData_add_layer(fdata, CD_MCOL, CD_CALLOC, &(ldata->layers[i].name), total);
+	else {
+		BMFace *f;
+		BMLoop *l;
+		BMIter liter;
+
+		/*ensure all current elements follow new customdata layout*/
+		BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+			BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+				tmp = NULL;
+				CustomData_bmesh_copy_data(&destold, dest, l->head.data, &tmp);
+				CustomData_bmesh_free_block(&destold, &l->head.data);
+				l->head.data = tmp;
+			}
+		}
 	}
-}
 
-
-void CustomData_bmesh_init_pool(CustomData *data, int allocsize)
-{
-	if(data->totlayer)data->pool = BLI_mempool_create(data->totsize, allocsize, allocsize, FALSE, FALSE);
+	if (destold.pool) BLI_mempool_destroy(destold.pool);
+	if (destold.layers) MEM_freeN(destold.layers);
 }
 
 void CustomData_bmesh_free_block(CustomData *data, void **block)
@@ -2340,19 +2223,21 @@ void CustomData_bmesh_free_block(CustomData *data, void **block)
 	const LayerTypeInfo *typeInfo;
 	int i;
 
-	if(!*block) return;
-	for(i = 0; i < data->totlayer; ++i) {
-		if(!(data->layers[i].flag & CD_FLAG_NOFREE)) {
+	if (!*block) return;
+	for (i = 0; i < data->totlayer; ++i) {
+		if (!(data->layers[i].flag & CD_FLAG_NOFREE)) {
 			typeInfo = layerType_getInfo(data->layers[i].type);
 
-			if(typeInfo->free) {
+			if (typeInfo->free) {
 				int offset = data->layers[i].offset;
 				typeInfo->free((char*)*block + offset, 1, typeInfo->size);
 			}
 		}
 	}
 
-	BLI_mempool_free(data->pool, *block);
+	if (data->totsize)
+		BLI_mempool_free(data->pool, *block);
+
 	*block = NULL;
 }
 
@@ -2363,7 +2248,7 @@ static void CustomData_bmesh_alloc_block(CustomData *data, void **block)
 		CustomData_bmesh_free_block(data, block);
 
 	if (data->totsize > 0)
-		*block = BLI_mempool_calloc(data->pool);
+		*block = BLI_mempool_alloc(data->pool);
 	else
 		*block = NULL;
 }
@@ -2374,32 +2259,35 @@ void CustomData_bmesh_copy_data(const CustomData *source, CustomData *dest,
 	const LayerTypeInfo *typeInfo;
 	int dest_i, src_i;
 
-	if (!*dest_block)
+	if (!*dest_block) {
 		CustomData_bmesh_alloc_block(dest, dest_block);
+		if (*dest_block)
+			memset(*dest_block, 0, dest->totsize);
+	}
 	
 	/* copies a layer at a time */
 	dest_i = 0;
-	for(src_i = 0; src_i < source->totlayer; ++src_i) {
+	for (src_i = 0; src_i < source->totlayer; ++src_i) {
 
 		/* find the first dest layer with type >= the source type
 		 * (this should work because layers are ordered by type)
 		 */
-		while(dest_i < dest->totlayer
-			  && dest->layers[dest_i].type < source->layers[src_i].type)
+		while (dest_i < dest->totlayer && dest->layers[dest_i].type < source->layers[src_i].type) {
 			++dest_i;
+		}
 
 		/* if there are no more dest layers, we're done */
-		if(dest_i >= dest->totlayer) return;
+		if (dest_i >= dest->totlayer) return;
 
 		/* if we found a matching layer, copy the data */
-		if(dest->layers[dest_i].type == source->layers[src_i].type &&
+		if (dest->layers[dest_i].type == source->layers[src_i].type &&
 			strcmp(dest->layers[dest_i].name, source->layers[src_i].name) == 0) {
 			char *src_data = (char*)src_block + source->layers[src_i].offset;
 			char *dest_data = (char*)*dest_block + dest->layers[dest_i].offset;
 
 			typeInfo = layerType_getInfo(source->layers[src_i].type);
 
-			if(typeInfo->copy)
+			if (typeInfo->copy)
 				typeInfo->copy(src_data, dest_data, 1);
 			else
 				memcpy(dest_data, src_data, typeInfo->size);
@@ -2420,7 +2308,7 @@ void *CustomData_bmesh_get(const CustomData *data, void *block, int type)
 	
 	/* get the layer index of the first layer of type */
 	layer_index = CustomData_get_active_layer_index(data, type);
-	if(layer_index < 0) return NULL;
+	if (layer_index < 0) return NULL;
 
 	return (char *)block + data->layers[layer_index].offset;
 }
@@ -2431,7 +2319,7 @@ void *CustomData_bmesh_get_n(const CustomData *data, void *block, int type, int
 	
 	/* get the layer index of the first layer of type */
 	layer_index = CustomData_get_layer_index(data, type);
-	if(layer_index < 0) return NULL;
+	if (layer_index < 0) return NULL;
 
 	return (char *)block + data->layers[layer_index+n].offset;
 }
@@ -2439,20 +2327,87 @@ void *CustomData_bmesh_get_n(const CustomData *data, void *block, int type, int
 /*gets from the layer at physical index n, note: doesn't check type.*/
 void *CustomData_bmesh_get_layer_n(const CustomData *data, void *block, int n)
 {
-	if(n < 0 || n >= data->totlayer) return NULL;
+	if (n < 0 || n >= data->totlayer) return NULL;
 
 	return (char *)block + data->layers[n].offset;
 }
 
+int CustomData_layer_has_math(struct CustomData *data, int layer_n)
+{
+	const LayerTypeInfo *typeInfo = layerType_getInfo(data->layers[layer_n].type);
+	
+	if (typeInfo->equal && typeInfo->add && typeInfo->multiply && 
+	    typeInfo->initminmax && typeInfo->dominmax) return 1;
+	
+	return 0;
+}
+
+/* copies the "value" (e.g. mloopuv uv or mloopcol colors) from one block to
+ * another, while not overwriting anything else (e.g. flags)*/
+void CustomData_data_copy_value(int type, void *source, void *dest)
+{
+	const LayerTypeInfo *typeInfo = layerType_getInfo(type);
+
+	if (!dest) return;
+
+	if (typeInfo->copyvalue)
+		typeInfo->copyvalue(source, dest);
+	else
+		memcpy(dest, source, typeInfo->size);
+}
+
+int CustomData_data_equals(int type, void *data1, void *data2)
+{
+	const LayerTypeInfo *typeInfo = layerType_getInfo(type);
+
+	if (typeInfo->equal)
+		return typeInfo->equal(data1, data2);
+	else return !memcmp(data1, data2, typeInfo->size);
+}
+
+void CustomData_data_initminmax(int type, void *min, void *max)
+{
+	const LayerTypeInfo *typeInfo = layerType_getInfo(type);
+
+	if (typeInfo->initminmax)
+		typeInfo->initminmax(min, max);
+}
+
+
+void CustomData_data_dominmax(int type, void *data, void *min, void *max)
+{
+	const LayerTypeInfo *typeInfo = layerType_getInfo(type);
+
+	if (typeInfo->dominmax)
+		typeInfo->dominmax(data, min, max);
+}
+
+
+void CustomData_data_multiply(int type, void *data, float fac)
+{
+	const LayerTypeInfo *typeInfo = layerType_getInfo(type);
+
+	if (typeInfo->multiply)
+		typeInfo->multiply(data, fac);
+}
+
+
+void CustomData_data_add(int type, void *data1, void *data2)
+{
+	const LayerTypeInfo *typeInfo = layerType_getInfo(type);
+
+	if (typeInfo->add)
+		typeInfo->add(data1, data2);
+}
 
 void CustomData_bmesh_set(const CustomData *data, void *block, int type, void *source)
 {
 	void *dest = CustomData_bmesh_get(data, block, type);
 	const LayerTypeInfo *typeInfo = layerType_getInfo(type);
 
-	if(!dest) return;
+	if (!dest) return;
 
-	if(typeInfo->copy)
+	if (typeInfo->copy)
 		typeInfo->copy(source, dest, 1);
 	else
 		memcpy(dest, source, typeInfo->size);
@@ -2463,9 +2418,9 @@ void CustomData_bmesh_set_n(CustomData *data, void *block, int type, int n, void
 	void *dest = CustomData_bmesh_get_n(data, block, type, n);
 	const LayerTypeInfo *typeInfo = layerType_getInfo(type);
 
-	if(!dest) return;
+	if (!dest) return;
 
-	if(typeInfo->copy)
+	if (typeInfo->copy)
 		typeInfo->copy(source, dest, 1);
 	else
 		memcpy(dest, source, typeInfo->size);
@@ -2476,9 +2431,9 @@ void CustomData_bmesh_set_layer_n(CustomData *data, void *block, int n, void *so
 	void *dest = CustomData_bmesh_get_layer_n(data, block, n);
 	const LayerTypeInfo *typeInfo = layerType_getInfo(data->layers[n].type);
 
-	if(!dest) return;
+	if (!dest) return;
 
-	if(typeInfo->copy)
+	if (typeInfo->copy)
 		typeInfo->copy(source, dest, 1);
 	else
 		memcpy(dest, source, typeInfo->size);
@@ -2494,16 +2449,16 @@ void CustomData_bmesh_interp(CustomData *data, void **src_blocks, float *weights
 	/* slow fallback in case we're interpolating a ridiculous number of
 	 * elements
 	 */
-	if(count > SOURCE_BUF_SIZE)
+	if (count > SOURCE_BUF_SIZE)
 		sources = MEM_callocN(sizeof(*sources) * count,
 							  "CustomData_interp sources");
 
 	/* interpolates a layer at a time */
-	for(i = 0; i < data->totlayer; ++i) {
+	for (i = 0; i < data->totlayer; ++i) {
 		CustomDataLayer *layer = &data->layers[i];
 		const LayerTypeInfo *typeInfo = layerType_getInfo(layer->type);
-		if(typeInfo->interp) {
-			for(j = 0; j < count; ++j)
+		if (typeInfo->interp) {
+			for (j = 0; j < count; ++j)
 				sources[j] = (char *)src_blocks[j] + layer->offset;
 
 			typeInfo->interp(sources, weights, sub_weights, count,
@@ -2511,7 +2466,7 @@ void CustomData_bmesh_interp(CustomData *data, void **src_blocks, float *weights
 		}
 	}
 
-	if(count > SOURCE_BUF_SIZE) MEM_freeN(sources);
+	if (count > SOURCE_BUF_SIZE) MEM_freeN(sources);
 }
 
 void CustomData_bmesh_set_default(CustomData *data, void **block)
@@ -2522,12 +2477,12 @@ void CustomData_bmesh_set_default(CustomData *data, void **block)
 	if (!*block)
 		CustomData_bmesh_alloc_block(data, block);
 
-	for(i = 0; i < data->totlayer; ++i) {
+	for (i = 0; i < data->totlayer; ++i) {
 		int offset = data->layers[i].offset;
 
 		typeInfo = layerType_getInfo(data->layers[i].type);
 
-		if(typeInfo->set_default)
+		if (typeInfo->set_default)
 			typeInfo->set_default((char*)*block + offset, 1);
 		else memset((char*)*block + offset, 0, typeInfo->size);
 	}
@@ -2544,20 +2499,20 @@ void CustomData_to_bmesh_block(const CustomData *source, CustomData *dest,
 	
 	/* copies a layer at a time */
 	dest_i = 0;
-	for(src_i = 0; src_i < source->totlayer; ++src_i) {
+	for (src_i = 0; src_i < source->totlayer; ++src_i) {
 
 		/* find the first dest layer with type >= the source type
 		 * (this should work because layers are ordered by type)
 		 */
-		while(dest_i < dest->totlayer
-			  && dest->layers[dest_i].type < source->layers[src_i].type)
+		while (dest_i < dest->totlayer && dest->layers[dest_i].type < source->layers[src_i].type) {
 			++dest_i;
+		}
 
 		/* if there are no more dest layers, we're done */
-		if(dest_i >= dest->totlayer) return;
+		if (dest_i >= dest->totlayer) return;
 
 		/* if we found a matching layer, copy the data */
-		if(dest->layers[dest_i].type == source->layers[src_i].type) {
+		if (dest->layers[dest_i].type == source->layers[src_i].type) {
 			int offset = dest->layers[dest_i].offset;
 			char *src_data = source->layers[src_i].data;
 			char *dest_data = (char*)*dest_block + offset;
@@ -2565,7 +2520,7 @@ void CustomData_to_bmesh_block(const CustomData *source, CustomData *dest,
 			typeInfo = layerType_getInfo(dest->layers[dest_i].type);
 			src_offset = src_index * typeInfo->size;
 
-			if(typeInfo->copy)
+			if (typeInfo->copy)
 				typeInfo->copy(src_data + src_offset, dest_data, 1);
 			else
 				memcpy(dest_data, src_data + src_offset, typeInfo->size);
@@ -2587,20 +2542,20 @@ void CustomData_from_bmesh_block(const CustomData *source, CustomData *dest,
 
 	/* copies a layer at a time */
 	dest_i = 0;
-	for(src_i = 0; src_i < source->totlayer; ++src_i) {
+	for (src_i = 0; src_i < source->totlayer; ++src_i) {
 
 		/* find the first dest layer with type >= the source type
 		 * (this should work because layers are ordered by type)
 		 */
-		while(dest_i < dest->totlayer
-			  && dest->layers[dest_i].type < source->layers[src_i].type)
+		while (dest_i < dest->totlayer && dest->layers[dest_i].type < source->layers[src_i].type) {
 			++dest_i;
+		}
 
 		/* if there are no more dest layers, we're done */
-		if(dest_i >= dest->totlayer) return;
+		if (dest_i >= dest->totlayer) return;
 
 		/* if we found a matching layer, copy the data */
-		if(dest->layers[dest_i].type == source->layers[src_i].type) {
+		if (dest->layers[dest_i].type == source->layers[src_i].type) {
 			int offset = source->layers[src_i].offset;
 			char *src_data = (char*)src_block + offset;
 			char *dest_data = dest->layers[dest_i].data;
@@ -2608,7 +2563,7 @@ void CustomData_from_bmesh_block(const CustomData *source, CustomData *dest,
 			typeInfo = layerType_getInfo(dest->layers[dest_i].type);
 			dest_offset = dest_index * typeInfo->size;
 
-			if(typeInfo->copy)
+			if (typeInfo->copy)
 				typeInfo->copy(src_data, dest_data + dest_offset, 1);
 			else
 				memcpy(dest_data + dest_offset, src_data, typeInfo->size);
@@ -2645,7 +2600,7 @@ const char *CustomData_layertype_name(int type)
 
 static int  CustomData_is_property_layer(int type)
 {
-	if((type == CD_PROP_FLT) || (type == CD_PROP_INT) || (type == CD_PROP_STR))
+	if ((type == CD_PROP_FLT) || (type == CD_PROP_INT) || (type == CD_PROP_STR))
 		return 1;
 	return 0;
 }
@@ -2654,17 +2609,17 @@ static int cd_layer_find_dupe(CustomData *data, const char *name, int type, int
 {
 	int i;
 	/* see if there is a duplicate */
-	for(i=0; i<data->totlayer; i++) {
-		if(i != index) {
+	for (i=0; i<data->totlayer; i++) {
+		if (i != index) {
 			CustomDataLayer *layer= &data->layers[i];
 			
-			if(CustomData_is_property_layer(type)) {
-				if(CustomData_is_property_layer(layer->type) && strcmp(layer->name, name)==0) {
+			if (CustomData_is_property_layer(type)) {
+				if (CustomData_is_property_layer(layer->type) && strcmp(layer->name, name)==0) {
 					return 1;
 				}
 			}
-			else{
-				if(i!=index && layer->type==type && strcmp(layer->name, name)==0) {
+			else {
+				if (i!=index && layer->type==type && strcmp(layer->name, name)==0) {
 					return 1;
 				}
 			}
@@ -2701,13 +2656,13 @@ void CustomData_validate_layer_name(const CustomData *data, int type, char *name
 	int index = -1;
 
 	/* if a layer name was given, try to find that layer */
-	if(name[0])
+	if (name[0])
 		index = CustomData_get_named_layer_index(data, type, name);
 
-	if(index < 0) {
+	if (index < 0) {
 		/* either no layer was specified, or the layer we want has been
-		* deleted, so assign the active layer to name
-		*/
+		 * deleted, so assign the active layer to name
+		 */
 		index = CustomData_get_active_layer_index(data, type);
 		strcpy(outname, data->layers[index].name);
 	}
@@ -2755,13 +2710,13 @@ void CustomData_external_reload(CustomData *data, ID *UNUSED(id), CustomDataMask
 	const LayerTypeInfo *typeInfo;
 	int i;
 
-	for(i=0; i<data->totlayer; i++) {
+	for (i=0; i<data->totlayer; i++) {
 		layer = &data->layers[i];
 		typeInfo = layerType_getInfo(layer->type);
 
-		if(!(mask & CD_TYPE_AS_MASK(layer->type)));
-		else if((layer->flag & CD_FLAG_EXTERNAL) && (layer->flag & CD_FLAG_IN_MEMORY)) {
-			if(typeInfo->free)
+		if (!(mask & CD_TYPE_AS_MASK(layer->type)));
+		else if ((layer->flag & CD_FLAG_EXTERNAL) && (layer->flag & CD_FLAG_IN_MEMORY)) {
+			if (typeInfo->free)
 				typeInfo->free(layer->data, totelem, typeInfo->size);
 			layer->flag &= ~CD_FLAG_IN_MEMORY;
 		}
@@ -2778,42 +2733,42 @@ void CustomData_external_read(CustomData *data, ID *id, CustomDataMask mask, int
 	const LayerTypeInfo *typeInfo;
 	int i, update = 0;
 
-	if(!external)
+	if (!external)
 		return;
 	
-	for(i=0; i<data->totlayer; i++) {
+	for (i=0; i<data->totlayer; i++) {
 		layer = &data->layers[i];
 		typeInfo = layerType_getInfo(layer->type);
 
-		if(!(mask & CD_TYPE_AS_MASK(layer->type)));
-		else if(layer->flag & CD_FLAG_IN_MEMORY);
-		else if((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->read)
+		if (!(mask & CD_TYPE_AS_MASK(layer->type)));
+		else if (layer->flag & CD_FLAG_IN_MEMORY);
+		else if ((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->read)
 			update= 1;
 	}
 
-	if(!update)
+	if (!update)
 		return;
 
 	customdata_external_filename(filename, id, external);
 
 	cdf= cdf_create(CDF_TYPE_MESH);
-	if(!cdf_read_open(cdf, filename)) {
+	if (!cdf_read_open(cdf, filename)) {
 		fprintf(stderr, "Failed to read %s layer from %s.\n", layerType_getName(layer->type), filename);
 		return;
 	}
 
-	for(i=0; i<data->totlayer; i++) {
+	for (i=0; i<data->totlayer; i++) {
 		layer = &data->layers[i];
 		typeInfo = layerType_getInfo(layer->type);
 
-		if(!(mask & CD_TYPE_AS_MASK(layer->type)));
-		else if(layer->flag & CD_FLAG_IN_MEMORY);
-		else if((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->read) {
+		if (!(mask & CD_TYPE_AS_MASK(layer->type)));
+		else if (layer->flag & CD_FLAG_IN_MEMORY);
+		else if ((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->read) {
 			blay= cdf_layer_find(cdf, layer->type, layer->name);
 
-			if(blay) {
-				if(cdf_read_layer(cdf, blay)) {
-					if(typeInfo->read(cdf, layer->data, totelem));
+			if (blay) {
+				if (cdf_read_layer(cdf, blay)) {
+					if (typeInfo->read(cdf, layer->data, totelem));
 					else break;
 					layer->flag |= CD_FLAG_IN_MEMORY;
 				}
@@ -2837,20 +2792,20 @@ void CustomData_external_write(CustomData *data, ID *id, CustomDataMask mask, in
 	int i, update = 0;
 	char filename[FILE_MAX];
 
-	if(!external)
+	if (!external)
 		return;
 
 	/* test if there is anything to write */
-	for(i=0; i<data->totlayer; i++) {
+	for (i=0; i<data->totlayer; i++) {
 		layer = &data->layers[i];
 		typeInfo = layerType_getInfo(layer->type);
 
-		if(!(mask & CD_TYPE_AS_MASK(layer->type)));
-		else if((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->write)
+		if (!(mask & CD_TYPE_AS_MASK(layer->type)));
+		else if ((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->write)
 			update= 1;
 	}
 
-	if(!update)
+	if (!update)
 		return;
 
 	/* make sure data is read before we try to write */
@@ -2859,12 +2814,12 @@ void CustomData_external_write(CustomData *data, ID *id, CustomDataMask mask, in
 
 	cdf= cdf_create(CDF_TYPE_MESH);
 
-	for(i=0; i<data->totlayer; i++) {
+	for (i=0; i<data->totlayer; i++) {
 		layer = &data->layers[i];
 		typeInfo = layerType_getInfo(layer->type);
 
-		if((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->filesize) {
-			if(layer->flag & CD_FLAG_IN_MEMORY) {
+		if ((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->filesize) {
+			if (layer->flag & CD_FLAG_IN_MEMORY) {
 				cdf_layer_add(cdf, layer->type, layer->name,
 					typeInfo->filesize(cdf, layer->data, totelem));
 			}
@@ -2875,20 +2830,20 @@ void CustomData_external_write(CustomData *data, ID *id, CustomDataMask mask, in
 		}
 	}
 
-	if(!cdf_write_open(cdf, filename)) {
+	if (!cdf_write_open(cdf, filename)) {
 		fprintf(stderr, "Failed to open %s for writing.\n", filename);
 		return;
 	}
 
-	for(i=0; i<data->totlayer; i++) {
+	for (i=0; i<data->totlayer; i++) {
 		layer = &data->layers[i];
 		typeInfo = layerType_getInfo(layer->type);
 
-		if((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->write) {
+		if ((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->write) {
 			blay= cdf_layer_find(cdf, layer->type, layer->name);
 
-			if(cdf_write_layer(cdf, blay)) {
-				if(typeInfo->write(cdf, layer->data, totelem));
+			if (cdf_write_layer(cdf, blay)) {
+				if (typeInfo->write(cdf, layer->data, totelem));
 				else break;
 			}
 			else
@@ -2896,19 +2851,19 @@ void CustomData_external_write(CustomData *data, ID *id, CustomDataMask mask, in
 		}
 	}
 
-	if(i != data->totlayer) {
+	if (i != data->totlayer) {
 		fprintf(stderr, "Failed to write data to %s.\n", filename);
 		cdf_free(cdf);
 		return;
 	}
 
-	for(i=0; i<data->totlayer; i++) {
+	for (i=0; i<data->totlayer; i++) {
 		layer = &data->layers[i];
 		typeInfo = layerType_getInfo(layer->type);
 
-		if((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->write) {
-			if(free) {
-				if(typeInfo->free)
+		if ((layer->flag & CD_FLAG_EXTERNAL) && typeInfo->write) {
+			if (free) {
+				if (typeInfo->free)
 					typeInfo->free(layer->data, totelem, typeInfo->size);
 				layer->flag &= ~CD_FLAG_IN_MEMORY;
 			}
@@ -2926,14 +2881,14 @@ void CustomData_external_add(CustomData *data, ID *UNUSED(id), int type, int UNU
 	int layer_index;
 
 	layer_index = CustomData_get_active_layer_index(data, type);
-	if(layer_index < 0) return;
+	if (layer_index < 0) return;
 
 	layer = &data->layers[layer_index];
 
-	if(layer->flag & CD_FLAG_EXTERNAL)
+	if (layer->flag & CD_FLAG_EXTERNAL)
 		return;
 
-	if(!external) {
+	if (!external) {
 		external= MEM_callocN(sizeof(CustomDataExternal), "CustomDataExternal");
 		data->external= external;
 	}
@@ -2950,26 +2905,26 @@ void CustomData_external_remove(CustomData *data, ID *id, int type, int totelem)
 	int layer_index; // i, remove_file;
 
 	layer_index = CustomData_get_active_layer_index(data, type);
-	if(layer_index < 0) return;
+	if (layer_index < 0) return;
 
 	layer = &data->layers[layer_index];
 
-	if(!external)
+	if (!external)
 		return;
 
-	if(layer->flag & CD_FLAG_EXTERNAL) {
-		if(!(layer->flag & CD_FLAG_IN_MEMORY))
+	if (layer->flag & CD_FLAG_EXTERNAL) {
+		if (!(layer->flag & CD_FLAG_IN_MEMORY))
 			CustomData_external_read(data, id, CD_TYPE_AS_MASK(layer->type), totelem);
 
 		layer->flag &= ~CD_FLAG_EXTERNAL;
 
 #if 0
 		remove_file= 1;
-		for(i=0; i<data->totlayer; i++)
-			if(data->layers[i].flag & CD_FLAG_EXTERNAL)
+		for (i=0; i<data->totlayer; i++)
+			if (data->layers[i].flag & CD_FLAG_EXTERNAL)
 				remove_file= 0;
 
-		if(remove_file) {
+		if (remove_file) {
 			customdata_external_filename(filename, id, external);
 			cdf_remove(filename);
 			CustomData_external_free(data);
@@ -2984,7 +2939,7 @@ int CustomData_external_test(CustomData *data, int type)
 	int layer_index;
 
 	layer_index = CustomData_get_active_layer_index(data, type);
-	if(layer_index < 0) return 0;
+	if (layer_index < 0) return 0;
 
 	layer = &data->layers[layer_index];
 	return (layer->flag & CD_FLAG_EXTERNAL);
@@ -2996,7 +2951,7 @@ void CustomData_external_remove_object(CustomData *data, ID *id)
 	CustomDataExternal *external= data->external;
 	char filename[FILE_MAX];
 
-	if(!external)
+	if (!external)
 		return;
 
 	customdata_external_filename(filename, id, external);
diff --git a/source/blender/blenkernel/intern/customdata_file.c b/source/blender/blenkernel/intern/customdata_file.c
index 7589801..6d0dabe 100644
--- a/source/blender/blenkernel/intern/customdata_file.c
+++ b/source/blender/blenkernel/intern/customdata_file.c
@@ -103,19 +103,21 @@ struct CDataFile {
 
 static int cdf_endian(void)
 {
-	if(ENDIAN_ORDER == L_ENDIAN)
+	if (ENDIAN_ORDER == L_ENDIAN)
 		return CDF_ENDIAN_LITTLE;
 	else
 		return CDF_ENDIAN_BIG;
 }
 
-/*static int cdf_data_type_size(int datatype)
+#if 0
+static int cdf_data_type_size(int datatype)
 {
-	if(datatype == CDF_DATA_FLOAT)
+	if (datatype == CDF_DATA_FLOAT)
 		return sizeof(float);
 	
 	return 0;
-}*/
+}
+#endif
 
 CDataFile *cdf_create(int type)
 {
@@ -131,7 +133,7 @@ void cdf_free(CDataFile *cdf)
 	cdf_read_close(cdf);
 	cdf_write_close(cdf);
 
-	if(cdf->layer)
+	if (cdf->layer)
 		MEM_freeN(cdf->layer);
 
 	MEM_freeN(cdf);
@@ -151,38 +153,38 @@ static int cdf_read_header(CDataFile *cdf)
 
 	header= &cdf->header;
 
-	if(!fread(header, sizeof(CDataFileHeader), 1, cdf->readf))
+	if (!fread(header, sizeof(CDataFileHeader), 1, cdf->readf))
 		return 0;
 	
-	if(memcmp(header->ID, "BCDF", sizeof(header->ID)) != 0)
+	if (memcmp(header->ID, "BCDF", sizeof(header->ID)) != 0)
 		return 0;
-	if(header->version > CDF_VERSION)
+	if (header->version > CDF_VERSION)
 		return 0;
 
 	cdf->switchendian= header->endian != cdf_endian();
 	header->endian= cdf_endian();
 
-	if(cdf->switchendian) {
+	if (cdf->switchendian) {
 		SWITCH_INT(header->type);
 		SWITCH_INT(header->totlayer);
 		SWITCH_INT(header->structbytes);
 	}
 
-	if(!ELEM(header->type, CDF_TYPE_IMAGE, CDF_TYPE_MESH))
+	if (!ELEM(header->type, CDF_TYPE_IMAGE, CDF_TYPE_MESH))
 		return 0;
 
 	offset += header->structbytes;
 	header->structbytes= sizeof(CDataFileHeader);
 
-	if(fseek(f, offset, SEEK_SET) != 0)
+	if (fseek(f, offset, SEEK_SET) != 0)
 		return 0;
 	
-	if(header->type == CDF_TYPE_IMAGE) {
+	if (header->type == CDF_TYPE_IMAGE) {
 		image= &cdf->btype.image;
-		if(!fread(image, sizeof(CDataFileImageHeader), 1, f))
+		if (!fread(image, sizeof(CDataFileImageHeader), 1, f))
 			return 0;
 
-		if(cdf->switchendian) {
+		if (cdf->switchendian) {
 			SWITCH_INT(image->width);
 			SWITCH_INT(image->height);
 			SWITCH_INT(image->tile_size);
@@ -192,44 +194,44 @@ static int cdf_read_header(CDataFile *cdf)
 		offset += image->structbytes;
 		image->structbytes= sizeof(CDataFileImageHeader);
 	}
-	else if(header->type == CDF_TYPE_MESH) {
+	else if (header->type == CDF_TYPE_MESH) {
 		mesh= &cdf->btype.mesh;
-		if(!fread(mesh, sizeof(CDataFileMeshHeader), 1, f))
+		if (!fread(mesh, sizeof(CDataFileMeshHeader), 1, f))
 			return 0;
 
-		if(cdf->switchendian)
+		if (cdf->switchendian)
 			SWITCH_INT(mesh->structbytes);
 
 		offset += mesh->structbytes;
 		mesh->structbytes= sizeof(CDataFileMeshHeader);
 	}
 
-	if(fseek(f, offset, SEEK_SET) != 0)
+	if (fseek(f, offset, SEEK_SET) != 0)
 		return 0;
 
 	cdf->layer= MEM_callocN(sizeof(CDataFileLayer)*header->totlayer, "CDataFileLayer");
 	cdf->totlayer= header->totlayer;
 
-	for(a=0; a<header->totlayer; a++) {
+	for (a=0; a<header->totlayer; a++) {
 		layer= &cdf->layer[a];
 
-		if(!fread(layer, sizeof(CDataFileLayer), 1, f))
+		if (!fread(layer, sizeof(CDataFileLayer), 1, f))
 			return 0;
 
-		if(cdf->switchendian) {
+		if (cdf->switchendian) {
 			SWITCH_INT(layer->type);
 			SWITCH_INT(layer->datatype);
 			SWITCH_INT64(layer->datasize);
 			SWITCH_INT(layer->structbytes);
 		}
 
-		if(layer->datatype != CDF_DATA_FLOAT)
+		if (layer->datatype != CDF_DATA_FLOAT)
 			return 0;
 
 		offset += layer->structbytes;
 		layer->structbytes= sizeof(CDataFileLayer);
 
-		if(fseek(f, offset, SEEK_SET) != 0)
+		if (fseek(f, offset, SEEK_SET) != 0)
 			return 0;
 	}
 
@@ -249,24 +251,24 @@ static int cdf_write_header(CDataFile *cdf)
 
 	header= &cdf->header;
 
-	if(!fwrite(header, sizeof(CDataFileHeader), 1, f))
+	if (!fwrite(header, sizeof(CDataFileHeader), 1, f))
 		return 0;
 	
-	if(header->type == CDF_TYPE_IMAGE) {
+	if (header->type == CDF_TYPE_IMAGE) {
 		image= &cdf->btype.image;
-		if(!fwrite(image, sizeof(CDataFileImageHeader), 1, f))
+		if (!fwrite(image, sizeof(CDataFileImageHeader), 1, f))
 			return 0;
 	}
-	else if(header->type == CDF_TYPE_MESH) {
+	else if (header->type == CDF_TYPE_MESH) {
 		mesh= &cdf->btype.mesh;
-		if(!fwrite(mesh, sizeof(CDataFileMeshHeader), 1, f))
+		if (!fwrite(mesh, sizeof(CDataFileMeshHeader), 1, f))
 			return 0;
 	}
 
-	for(a=0; a<header->totlayer; a++) {
+	for (a=0; a<header->totlayer; a++) {
 		layer= &cdf->layer[a];
 
-		if(!fwrite(layer, sizeof(CDataFileLayer), 1, f))
+		if (!fwrite(layer, sizeof(CDataFileLayer), 1, f))
 			return 0;
 	}
 
@@ -277,18 +279,18 @@ int cdf_read_open(CDataFile *cdf, const char *filename)
 {
 	FILE *f;
 
-	f= fopen(filename, "rb");
-	if(!f)
+	f= BLI_fopen(filename, "rb");
+	if (!f)
 		return 0;
 	
 	cdf->readf= f;
 
-	if(!cdf_read_header(cdf)) {
+	if (!cdf_read_header(cdf)) {
 		cdf_read_close(cdf);
 		return 0;
 	}
 
-	if(cdf->header.type != cdf->type) {
+	if (cdf->header.type != cdf->type) {
 		cdf_read_close(cdf);
 		return 0;
 	}
@@ -303,8 +305,8 @@ int cdf_read_layer(CDataFile *cdf, CDataFileLayer *blay)
 
 	/* seek to right location in file */
 	offset= cdf->dataoffset;
-	for(a=0; a<cdf->totlayer; a++) {
-		if(&cdf->layer[a] == blay)
+	for (a=0; a<cdf->totlayer; a++) {
+		if (&cdf->layer[a] == blay)
 			break;
 		else
 			offset += cdf->layer[a].datasize;
@@ -319,15 +321,16 @@ int cdf_read_data(CDataFile *cdf, unsigned int size, void *data)
 	unsigned int a;
 
 	/* read data */
-	if(!fread(data, size, 1, cdf->readf))
+	if (!fread(data, size, 1, cdf->readf))
 		return 0;
 
 	/* switch endian if necessary */
-	if(cdf->switchendian) {
+	if (cdf->switchendian) {
 		fdata= data;
 
-		for(a=0; a<size/sizeof(float); a++)
-			SWITCH_INT(fdata[a])
+		for (a=0; a<size/sizeof(float); a++) {
+			SWITCH_INT(fdata[a]);
+		}
 	}
 
 	return 1;
@@ -335,7 +338,7 @@ int cdf_read_data(CDataFile *cdf, unsigned int size, void *data)
 
 void cdf_read_close(CDataFile *cdf)
 {
-	if(cdf->readf) {
+	if (cdf->readf) {
 		fclose(cdf->readf);
 		cdf->readf= NULL;
 	}
@@ -348,8 +351,8 @@ int cdf_write_open(CDataFile *cdf, const char *filename)
 	CDataFileMeshHeader *mesh;
 	FILE *f;
 
-	f= fopen(filename, "wb");
-	if(!f)
+	f= BLI_fopen(filename, "wb");
+	if (!f)
 		return 0;
 	
 	cdf->writef= f;
@@ -366,13 +369,13 @@ int cdf_write_open(CDataFile *cdf, const char *filename)
 	header->type= cdf->type;
 	header->totlayer= cdf->totlayer;
 
-	if(cdf->type == CDF_TYPE_IMAGE) {
+	if (cdf->type == CDF_TYPE_IMAGE) {
 		/* fill image header */
 		image= &cdf->btype.image;
 		image->structbytes= sizeof(CDataFileImageHeader);
 		image->tile_size= CDF_TILE_SIZE;
 	}
-	else if(cdf->type == CDF_TYPE_MESH) {
+	else if (cdf->type == CDF_TYPE_MESH) {
 		/* fill mesh header */
 		mesh= &cdf->btype.mesh;
 		mesh->structbytes= sizeof(CDataFileMeshHeader);
@@ -391,7 +394,7 @@ int cdf_write_layer(CDataFile *UNUSED(cdf), CDataFileLayer *UNUSED(blay))
 int cdf_write_data(CDataFile *cdf, unsigned int size, void *data)
 {
 	/* write data */
-	if(!fwrite(data, size, 1, cdf->writef))
+	if (!fwrite(data, size, 1, cdf->writef))
 		return 0;
 
 	return 1;
@@ -399,7 +402,7 @@ int cdf_write_data(CDataFile *cdf, unsigned int size, void *data)
 
 void cdf_write_close(CDataFile *cdf)
 {
-	if(cdf->writef) {
+	if (cdf->writef) {
 		fclose(cdf->writef);
 		cdf->writef= NULL;
 	}
@@ -417,10 +420,10 @@ CDataFileLayer *cdf_layer_find(CDataFile *cdf, int type, const char *name)
 	CDataFileLayer *layer;
 	int a;
 
-	for(a=0; a<cdf->totlayer; a++) {
+	for (a=0; a<cdf->totlayer; a++) {
 		layer= &cdf->layer[a];
 
-		if(layer->type == type && strcmp(layer->name, name) == 0)
+		if (layer->type == type && strcmp(layer->name, name) == 0)
 			return layer;
 	}
 	
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index a95cd8d..1232177 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -32,7 +32,7 @@
 
 #include <string.h>
 #include <math.h>
-#include "ctype.h"
+#include <ctype.h>
 
 #include "MEM_guardedalloc.h"
 
@@ -49,10 +49,10 @@ void defgroup_copy_list(ListBase *outbase, ListBase *inbase)
 {
 	bDeformGroup *defgroup, *defgroupn;
 
-	outbase->first= outbase->last= NULL;
+	outbase->first = outbase->last = NULL;
 
-	for (defgroup = inbase->first; defgroup; defgroup=defgroup->next){
-		defgroupn= defgroup_duplicate(defgroup);
+	for (defgroup = inbase->first; defgroup; defgroup = defgroup->next) {
+		defgroupn = defgroup_duplicate(defgroup);
 		BLI_addtail(outbase, defgroupn);
 	}
 }
@@ -64,12 +64,12 @@ bDeformGroup *defgroup_duplicate(bDeformGroup *ingroup)
 	if (!ingroup)
 		return NULL;
 
-	outgroup=MEM_callocN(sizeof(bDeformGroup), "copy deformGroup");
+	outgroup = MEM_callocN(sizeof(bDeformGroup), "copy deformGroup");
 
 	/* For now, just copy everything over. */
-	memcpy (outgroup, ingroup, sizeof(bDeformGroup));
+	memcpy(outgroup, ingroup, sizeof(bDeformGroup));
 
-	outgroup->next=outgroup->prev=NULL;
+	outgroup->next = outgroup->prev = NULL;
 
 	return outgroup;
 }
@@ -86,9 +86,9 @@ void defvert_copy(MDeformVert *dvert_dst, const MDeformVert *dvert_src)
 			MEM_freeN(dvert_dst->dw);
 
 		if (dvert_src->totweight)
-			dvert_dst->dw= MEM_dupallocN(dvert_src->dw);
+			dvert_dst->dw = MEM_dupallocN(dvert_src->dw);
 		else
-			dvert_dst->dw= NULL;
+			dvert_dst->dw = NULL;
 
 		dvert_dst->totweight = dvert_src->totweight;
 	}
@@ -102,19 +102,19 @@ void defvert_copy_index(MDeformVert *dvert_dst, const MDeformVert *dvert_src, co
 {
 	MDeformWeight *dw_src, *dw_dst;
 
-	dw_src= defvert_find_index(dvert_src, defgroup);
+	dw_src = defvert_find_index(dvert_src, defgroup);
 
 	if (dw_src) {
 		/* source is valid, verify destination */
-		dw_dst= defvert_verify_index(dvert_dst, defgroup);
-		dw_dst->weight= dw_src->weight;
+		dw_dst = defvert_verify_index(dvert_dst, defgroup);
+		dw_dst->weight = dw_src->weight;
 	}
 	else {
 		/* source was NULL, assign zero, could also remove */
-		dw_dst= defvert_find_index(dvert_dst, defgroup);
+		dw_dst = defvert_find_index(dvert_dst, defgroup);
 
 		if (dw_dst) {
-			dw_dst->weight= 0.0f;
+			dw_dst->weight = 0.0f;
 		}
 	}
 }
@@ -127,13 +127,13 @@ void defvert_sync(MDeformVert *dvert_dst, const MDeformVert *dvert_src, int use_
 	if (dvert_src->totweight && dvert_dst->totweight) {
 		int i;
 		MDeformWeight *dw_src;
-		for (i=0, dw_src=dvert_src->dw; i < dvert_src->totweight; i++, dw_src++) {
+		for (i = 0, dw_src = dvert_src->dw; i < dvert_src->totweight; i++, dw_src++) {
 			MDeformWeight *dw_dst;
-			if (use_verify) dw_dst= defvert_verify_index(dvert_dst, dw_src->def_nr);
-			else            dw_dst= defvert_find_index(dvert_dst, dw_src->def_nr);
+			if (use_verify) dw_dst = defvert_verify_index(dvert_dst, dw_src->def_nr);
+			else            dw_dst = defvert_find_index(dvert_dst, dw_src->def_nr);
 
 			if (dw_dst) {
-				dw_dst->weight= dw_src->weight;
+				dw_dst->weight = dw_src->weight;
 			}
 		}
 	}
@@ -146,14 +146,14 @@ void defvert_sync_mapped(MDeformVert *dvert_dst, const MDeformVert *dvert_src,
 	if (dvert_src->totweight && dvert_dst->totweight) {
 		int i;
 		MDeformWeight *dw_src;
-		for (i=0, dw_src=dvert_src->dw; i < dvert_src->totweight; i++, dw_src++) {
+		for (i = 0, dw_src = dvert_src->dw; i < dvert_src->totweight; i++, dw_src++) {
 			if (dw_src->def_nr < flip_map_len) {
 				MDeformWeight *dw_dst;
-				if (use_verify) dw_dst= defvert_verify_index(dvert_dst, flip_map[dw_src->def_nr]);
-				else            dw_dst= defvert_find_index(dvert_dst, flip_map[dw_src->def_nr]);
+				if (use_verify) dw_dst = defvert_verify_index(dvert_dst, flip_map[dw_src->def_nr]);
+				else            dw_dst = defvert_find_index(dvert_dst, flip_map[dw_src->def_nr]);
 
 				if (dw_dst) {
-					dw_dst->weight= dw_src->weight;
+					dw_dst->weight = dw_src->weight;
 				}
 			}
 		}
@@ -163,13 +163,13 @@ void defvert_sync_mapped(MDeformVert *dvert_dst, const MDeformVert *dvert_src,
 /* be sure all flip_map values are valid */
 void defvert_remap(MDeformVert *dvert, int *map, const int map_len)
 {
-	MDeformWeight *dw= dvert->dw;
+	MDeformWeight *dw = dvert->dw;
 	unsigned int i;
-	for (i= dvert->totweight; i != 0; i--, dw++) {
+	for (i = dvert->totweight; i != 0; i--, dw++) {
 		if (dw->def_nr < map_len) {
-			dw->def_nr= map[dw->def_nr];
+			dw->def_nr = map[dw->def_nr];
 
-			/* just incase */
+			/* just in case */
 			BLI_assert(dw->def_nr >= 0);
 		}
 	}
@@ -180,24 +180,24 @@ void defvert_normalize(MDeformVert *dvert)
 	if (dvert->totweight <= 0) {
 		/* nothing */
 	}
-	else if (dvert->totweight==1) {
-		dvert->dw[0].weight= 1.0f;
+	else if (dvert->totweight == 1) {
+		dvert->dw[0].weight = 1.0f;
 	}
 	else {
 		MDeformWeight *dw;
 		unsigned int i;
-		float tot_weight= 0.0f;
+		float tot_weight = 0.0f;
 
-		for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
+		for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
 			tot_weight += dw->weight;
 		}
 
 		if (tot_weight > 0.0f) {
-			float scalar= 1.0f / tot_weight;
-			for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
+			float scalar = 1.0f / tot_weight;
+			for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
 				dw->weight *= scalar;
 
-				/* incase of division errors with very low weights */
+				/* in case of division errors with very low weights */
 				CLAMP(dw->weight, 0.0f, 1.0f);
 			}
 		}
@@ -209,36 +209,36 @@ void defvert_normalize_lock(MDeformVert *dvert, const int def_nr_lock)
 	if (dvert->totweight <= 0) {
 		/* nothing */
 	}
-	else if (dvert->totweight==1) {
-		dvert->dw[0].weight= 1.0f;
+	else if (dvert->totweight == 1) {
+		dvert->dw[0].weight = 1.0f;
 	}
 	else {
 		MDeformWeight *dw_lock = NULL;
 		MDeformWeight *dw;
 		unsigned int i;
-		float tot_weight= 0.0f;
-		float lock_iweight= 1.0f;
+		float tot_weight = 0.0f;
+		float lock_iweight = 1.0f;
 
-		for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
-			if(dw->def_nr != def_nr_lock) {
+		for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
+			if (dw->def_nr != def_nr_lock) {
 				tot_weight += dw->weight;
 			}
 			else {
-				dw_lock= dw;
+				dw_lock = dw;
 				lock_iweight = (1.0f - dw_lock->weight);
 				CLAMP(lock_iweight, 0.0f, 1.0f);
 			}
 		}
 
 		if (tot_weight > 0.0f) {
-			/* paranoid, should be 1.0 but incase of float error clamp anyway */
+			/* paranoid, should be 1.0 but in case of float error clamp anyway */
 
-			float scalar= (1.0f / tot_weight) * lock_iweight;
-			for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
-				if(dw != dw_lock) {
+			float scalar = (1.0f / tot_weight) * lock_iweight;
+			for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
+				if (dw != dw_lock) {
 					dw->weight *= scalar;
 
-					/* incase of division errors with very low weights */
+					/* in case of division errors with very low weights */
 					CLAMP(dw->weight, 0.0f, 1.0f);
 				}
 			}
@@ -251,15 +251,39 @@ void defvert_flip(MDeformVert *dvert, const int *flip_map, const int flip_map_le
 	MDeformWeight *dw;
 	int i;
 
-	for (dw= dvert->dw, i=0; i<dvert->totweight; dw++, i++) {
+	for (dw = dvert->dw, i = 0; i<dvert->totweight; dw++, i++) {
 		if (dw->def_nr < flip_map_len) {
 			if (flip_map[dw->def_nr] >= 0) {
-				dw->def_nr= flip_map[dw->def_nr];
+				dw->def_nr = flip_map[dw->def_nr];
 			}
 		}
 	}
 }
 
+void defvert_flip_merged(MDeformVert *dvert, const int *flip_map, const int flip_map_len)
+{
+	MDeformWeight *dw, *dw_cpy;
+	float weight;
+	int i, totweight = dvert->totweight;
+
+	/* copy weights */
+	for (dw = dvert->dw, i = 0; i < totweight; dw++, i++) {
+		if (dw->def_nr < flip_map_len) {
+			if (flip_map[dw->def_nr] >= 0) {
+				/* error checkers complain of this but we'll never get NULL return */
+				dw_cpy = defvert_verify_index(dvert, flip_map[dw->def_nr]);
+				dw = &dvert->dw[i]; /* in case array got realloced */
+
+				/* distribute weights: if only one of the vertex groups was
+				 * assigned this will halve the weights, otherwise it gets
+				 * evened out. this keeps it proportional to other groups */
+				weight = 0.5f * (dw_cpy->weight + dw->weight);
+				dw_cpy->weight = weight;
+				dw->weight = weight;
+			}
+		}
+	}
+}
 
 bDeformGroup *defgroup_find_name(Object *ob, const char *name)
 {
@@ -268,7 +292,7 @@ bDeformGroup *defgroup_find_name(Object *ob, const char *name)
 	 */
 	bDeformGroup *curdef;
 
-	for (curdef = ob->defbase.first; curdef; curdef=curdef->next) {
+	for (curdef = ob->defbase.first; curdef; curdef = curdef->next) {
 		if (!strcmp(curdef->name, name)) {
 			return curdef;
 		}
@@ -287,7 +311,7 @@ int defgroup_name_index(Object *ob, const char *name)
 	int def_nr;
 
 	if (name && name[0] != '\0') {
-		for (curdef=ob->defbase.first, def_nr=0; curdef; curdef=curdef->next, def_nr++) {
+		for (curdef = ob->defbase.first, def_nr = 0; curdef; curdef = curdef->next, def_nr++) {
 			if (!strcmp(curdef->name, name))
 				return def_nr;
 		}
@@ -299,33 +323,33 @@ int defgroup_name_index(Object *ob, const char *name)
 /* note, must be freed */
 int *defgroup_flip_map(Object *ob, int *flip_map_len, int use_default)
 {
-	int defbase_tot= *flip_map_len= BLI_countlist(&ob->defbase);
+	int defbase_tot = *flip_map_len = BLI_countlist(&ob->defbase);
 
-	if (defbase_tot==0) {
+	if (defbase_tot == 0) {
 		return NULL;
 	}
 	else {
 		bDeformGroup *dg;
 		char name[sizeof(dg->name)];
-		int i, flip_num, *map= MEM_mallocN(defbase_tot * sizeof(int), __func__);
+		int i, flip_num, *map = MEM_mallocN(defbase_tot * sizeof(int), __func__);
 
-		for (i=0; i < defbase_tot; i++) {
-			map[i]= -1;
+		for (i = 0; i < defbase_tot; i++) {
+			map[i] = -1;
 		}
 
-		for (dg=ob->defbase.first, i=0; dg; dg=dg->next, i++) {
+		for (dg = ob->defbase.first, i = 0; dg; dg = dg->next, i++) {
 			if (map[i] == -1) { /* may be calculated previously */
 
-				/* incase no valid value is found, use this */
+				/* in case no valid value is found, use this */
 				if (use_default)
-					map[i]= i;
+					map[i] = i;
 
 				flip_side_name(name, dg->name, FALSE);
 				if (strcmp(name, dg->name)) {
-					flip_num= defgroup_name_index(ob, name);
+					flip_num = defgroup_name_index(ob, name);
 					if (flip_num >= 0) {
-						map[i]= flip_num;
-						map[flip_num]= i; /* save an extra lookup */
+						map[i] = flip_num;
+						map[flip_num] = i; /* save an extra lookup */
 					}
 				}
 			}
@@ -337,30 +361,29 @@ int *defgroup_flip_map(Object *ob, int *flip_map_len, int use_default)
 /* note, must be freed */
 int *defgroup_flip_map_single(Object *ob, int *flip_map_len, int use_default, int defgroup)
 {
-	int defbase_tot= *flip_map_len= BLI_countlist(&ob->defbase);
+	int defbase_tot = *flip_map_len = BLI_countlist(&ob->defbase);
 
-	if (defbase_tot==0) {
+	if (defbase_tot == 0) {
 		return NULL;
 	}
 	else {
 		bDeformGroup *dg;
 		char name[sizeof(dg->name)];
-		int i, flip_num, *map= MEM_mallocN(defbase_tot * sizeof(int), __func__);
+		int i, flip_num, *map = MEM_mallocN(defbase_tot * sizeof(int), __func__);
 
-		for (i=0; i < defbase_tot; i++) {
-			if (use_default) map[i]= i;
-			else             map[i]= -1;
+		for (i = 0; i < defbase_tot; i++) {
+			map[i] = use_default ? i : -1;
 		}
 
-		dg= BLI_findlink(&ob->defbase, defgroup);
+		dg = BLI_findlink(&ob->defbase, defgroup);
 
 		flip_side_name(name, dg->name, FALSE);
 		if (strcmp(name, dg->name)) {
-			flip_num= defgroup_name_index(ob, name);
+			flip_num = defgroup_name_index(ob, name);
 
 			if (flip_num >= 0) {
-				map[defgroup]= flip_num;
-				map[flip_num]= defgroup;
+				map[defgroup] = flip_num;
+				map[flip_num] = defgroup;
 			}
 		}
 
@@ -370,7 +393,7 @@ int *defgroup_flip_map_single(Object *ob, int *flip_map_len, int use_default, in
 
 int defgroup_flip_index(Object *ob, int index, int use_default)
 {
-	bDeformGroup *dg= BLI_findlink(&ob->defbase, index);
+	bDeformGroup *dg = BLI_findlink(&ob->defbase, index);
 	int flip_index = -1;
 
 	if (dg) {
@@ -378,18 +401,18 @@ int defgroup_flip_index(Object *ob, int index, int use_default)
 		flip_side_name(name, dg->name, 0);
 
 		if (strcmp(name, dg->name))
-			flip_index= defgroup_name_index(ob, name);
+			flip_index = defgroup_name_index(ob, name);
 	}
 
-	return (flip_index==-1 && use_default) ? index : flip_index;
+	return (flip_index == -1 && use_default) ? index : flip_index;
 }
 
 static int defgroup_find_name_dupe(const char *name, bDeformGroup *dg, Object *ob)
 {
 	bDeformGroup *curdef;
 
-	for (curdef = ob->defbase.first; curdef; curdef=curdef->next) {
-		if (dg!=curdef) {
+	for (curdef = ob->defbase.first; curdef; curdef = curdef->next) {
+		if (dg != curdef) {
 			if (!strcmp(curdef->name, name)) {
 				return 1;
 			}
@@ -401,147 +424,149 @@ static int defgroup_find_name_dupe(const char *name, bDeformGroup *dg, Object *o
 
 static int defgroup_unique_check(void *arg, const char *name)
 {
-	struct {Object *ob; void *dg;} *data= arg;
+	struct {Object *ob; void *dg;} *data = arg;
 	return defgroup_find_name_dupe(name, data->dg, data->ob);
 }
 
 void defgroup_unique_name(bDeformGroup *dg, Object *ob)
 {
 	struct {Object *ob; void *dg;} data;
-	data.ob= ob;
-	data.dg= dg;
+	data.ob = ob;
+	data.dg = dg;
 
 	BLI_uniquename_cb(defgroup_unique_check, &data, "Group", '.', dg->name, sizeof(dg->name));
 }
 
+BLI_INLINE int is_char_sep(const char c)
+{
+	return ELEM4(c, '.', ' ', '-', '_');
+}
+
 /* finds the best possible flipped name. For renaming; check for unique names afterwards */
 /* if strip_number: removes number extensions
- * note: dont use sizeof() for 'name' or 'from_name' */
+ * note: don't use sizeof() for 'name' or 'from_name' */
 void flip_side_name(char name[MAX_VGROUP_NAME], const char from_name[MAX_VGROUP_NAME], int strip_number)
 {
 	int     len;
-	char    prefix[MAX_VGROUP_NAME]=  "";   /* The part before the facing */
-	char    suffix[MAX_VGROUP_NAME]=  "";   /* The part after the facing */
-	char    replace[MAX_VGROUP_NAME]= "";   /* The replacement string */
-	char    number[MAX_VGROUP_NAME]=  "";   /* The number extension string */
-	char    *index=NULL;
+	char    prefix[MAX_VGROUP_NAME]  = "";   /* The part before the facing */
+	char    suffix[MAX_VGROUP_NAME]  = "";   /* The part after the facing */
+	char    replace[MAX_VGROUP_NAME] = "";   /* The replacement string */
+	char    number[MAX_VGROUP_NAME]  = "";   /* The number extension string */
+	char    *index = NULL;
 
 	/* always copy the name, since this can be called with an uninitialized string */
 	BLI_strncpy(name, from_name, MAX_VGROUP_NAME);
 
-	len= BLI_strnlen(from_name, MAX_VGROUP_NAME);
+	len = BLI_strnlen(from_name, MAX_VGROUP_NAME);
 	if (len < 3) {
 		/* we don't do names like .R or .L */
 		return;
 	}
 
 	/* We first check the case with a .### extension, let's find the last period */
-	if (isdigit(name[len-1])) {
-		index= strrchr(name, '.'); // last occurrence
+	if (isdigit(name[len - 1])) {
+		index = strrchr(name, '.'); // last occurrence
 		if (index && isdigit(index[1]) ) { // doesnt handle case bone.1abc2 correct..., whatever!
-			if (strip_number==0)
+			if (strip_number == 0) {
 				BLI_strncpy(number, index, sizeof(number));
-			*index= 0;
-			len= BLI_strnlen(name, MAX_VGROUP_NAME);
+			}
+			*index = 0;
+			len = BLI_strnlen(name, MAX_VGROUP_NAME);
 		}
 	}
 
 	BLI_strncpy(prefix, name, sizeof(prefix));
 
-#define IS_SEPARATOR(a) ((a)=='.' || (a)==' ' || (a)=='-' || (a)=='_')
-
 	/* first case; separator . - _ with extensions r R l L  */
-	if (IS_SEPARATOR(name[len-2]) ) {
-		switch(name[len-1]) {
+	if (is_char_sep(name[len - 2]) ) {
+		switch(name[len - 1]) {
 			case 'l':
-				prefix[len-1]= 0;
+				prefix[len - 1] = 0;
 				strcpy(replace, "r");
 				break;
 			case 'r':
-				prefix[len-1]= 0;
+				prefix[len - 1] = 0;
 				strcpy(replace, "l");
 				break;
 			case 'L':
-				prefix[len-1]= 0;
+				prefix[len - 1] = 0;
 				strcpy(replace, "R");
 				break;
 			case 'R':
-				prefix[len-1]= 0;
+				prefix[len - 1] = 0;
 				strcpy(replace, "L");
 				break;
 		}
 	}
 	/* case; beginning with r R l L , with separator after it */
-	else if (IS_SEPARATOR(name[1]) ) {
+	else if (is_char_sep(name[1]) ) {
 		switch(name[0]) {
 			case 'l':
 				strcpy(replace, "r");
-				BLI_strncpy(suffix, name+1, sizeof(suffix));
-				prefix[0]= 0;
+				BLI_strncpy(suffix, name + 1, sizeof(suffix));
+				prefix[0] = 0;
 				break;
 			case 'r':
 				strcpy(replace, "l");
-				BLI_strncpy(suffix, name+1, sizeof(suffix));
-				prefix[0]= 0;
+				BLI_strncpy(suffix, name + 1, sizeof(suffix));
+				prefix[0] = 0;
 				break;
 			case 'L':
 				strcpy(replace, "R");
-				BLI_strncpy(suffix, name+1, sizeof(suffix));
-				prefix[0]= 0;
+				BLI_strncpy(suffix, name + 1, sizeof(suffix));
+				prefix[0] = 0;
 				break;
 			case 'R':
 				strcpy(replace, "L");
-				BLI_strncpy(suffix, name+1, sizeof(suffix));
-				prefix[0]= 0;
+				BLI_strncpy(suffix, name + 1, sizeof(suffix));
+				prefix[0] = 0;
 				break;
 		}
 	}
 	else if (len > 5) {
 		/* hrms, why test for a separator? lets do the rule 'ultimate left or right' */
 		index = BLI_strcasestr(prefix, "right");
-		if (index==prefix || index==prefix+len-5) {
-			if (index[0]=='r')
+		if (index == prefix || index == prefix + len - 5) {
+			if (index[0] == 'r')
 				strcpy(replace, "left");
 			else {
-				if (index[1]=='I')
+				if (index[1] == 'I')
 					strcpy(replace, "LEFT");
 				else
 					strcpy(replace, "Left");
 			}
-			*index= 0;
-			BLI_strncpy(suffix, index+5, sizeof(suffix));
+			*index = 0;
+			BLI_strncpy(suffix, index + 5, sizeof(suffix));
 		}
 		else {
 			index = BLI_strcasestr(prefix, "left");
-			if (index==prefix || index==prefix+len-4) {
-				if (index[0]=='l')
+			if (index == prefix || index == prefix + len - 4) {
+				if (index[0] == 'l')
 					strcpy(replace, "right");
 				else {
-					if (index[1]=='E')
+					if (index[1] == 'E')
 						strcpy(replace, "RIGHT");
 					else
 						strcpy(replace, "Right");
 				}
-				*index= 0;
+				*index = 0;
 				BLI_strncpy(suffix, index + 4, sizeof(suffix));
 			}
 		}
 	}
 
-#undef IS_SEPARATOR
-
 	BLI_snprintf (name, MAX_VGROUP_NAME, "%s%s%s%s", prefix, replace, suffix, number);
 }
 
 float defvert_find_weight(const struct MDeformVert *dvert, const int defgroup)
 {
-	MDeformWeight *dw= defvert_find_index(dvert, defgroup);
+	MDeformWeight *dw = defvert_find_index(dvert, defgroup);
 	return dw ? dw->weight : 0.0f;
 }
 
 /* take care with this the rationale is:
- * - if the object has no vertex group. act like vertex group isnt set and return 1.0,
- * - if the vertex group exists but the 'defgroup' isnt found on this vertex, _still_ return 0.0
+ * - if the object has no vertex group. act like vertex group isn't set and return 1.0,
+ * - if the vertex group exists but the 'defgroup' isn't found on this vertex, _still_ return 0.0
  *
  * This is a bit confusing, just saves some checks from the caller.
  */
@@ -550,7 +575,7 @@ float defvert_array_find_weight_safe(const struct MDeformVert *dvert, const int
 	if (defgroup == -1 || dvert == NULL)
 		return 1.0f;
 
-	return defvert_find_weight(dvert+index, defgroup);
+	return defvert_find_weight(dvert + index, defgroup);
 }
 
 
@@ -560,7 +585,7 @@ MDeformWeight *defvert_find_index(const MDeformVert *dvert, const int defgroup)
 		MDeformWeight *dw = dvert->dw;
 		unsigned int i;
 
-		for (i= dvert->totweight; i != 0; i--, dw++) {
+		for (i = dvert->totweight; i != 0; i--, dw++) {
 			if (dw->def_nr == defgroup) {
 				return dw;
 			}
@@ -580,19 +605,19 @@ MDeformWeight *defvert_verify_index(MDeformVert *dvert, const int defgroup)
 	if (!dvert || defgroup < 0)
 		return NULL;
 
-	dw_new= defvert_find_index(dvert, defgroup);
+	dw_new = defvert_find_index(dvert, defgroup);
 	if (dw_new)
 		return dw_new;
 
-	dw_new= MEM_callocN(sizeof(MDeformWeight)*(dvert->totweight+1), "deformWeight");
+	dw_new = MEM_callocN(sizeof(MDeformWeight) * (dvert->totweight + 1), "deformWeight");
 	if (dvert->dw) {
-		memcpy(dw_new, dvert->dw, sizeof(MDeformWeight)*dvert->totweight);
+		memcpy(dw_new, dvert->dw, sizeof(MDeformWeight) * dvert->totweight);
 		MEM_freeN(dvert->dw);
 	}
-	dvert->dw= dw_new;
+	dvert->dw = dw_new;
 	dw_new += dvert->totweight;
-	dw_new->weight= 0.0f;
-	dw_new->def_nr= defgroup;
+	dw_new->weight = 0.0f;
+	dw_new->def_nr = defgroup;
 	/* Group index */
 
 	dvert->totweight++;
@@ -603,7 +628,7 @@ MDeformWeight *defvert_verify_index(MDeformVert *dvert, const int defgroup)
 /* TODO. merge with code above! */
 
 /* Adds the given vertex to the specified vertex group, with given weight.
- * warning, this does NOT check for existign, assume caller already knows its not there */
+ * warning, this does NOT check for existing, assume caller already knows its not there */
 void defvert_add_index_notest(MDeformVert *dvert, int defgroup, const float weight)
 {
 	MDeformWeight *dw_new;
@@ -612,9 +637,9 @@ void defvert_add_index_notest(MDeformVert *dvert, int defgroup, const float weig
 	if (!dvert || defgroup < 0)
 		return;
 
-	dw_new = MEM_callocN(sizeof(MDeformWeight)*(dvert->totweight+1), "defvert_add_to group, new deformWeight");
-	if(dvert->dw) {
-		memcpy(dw_new, dvert->dw, sizeof(MDeformWeight)*dvert->totweight);
+	dw_new = MEM_callocN(sizeof(MDeformWeight) * (dvert->totweight + 1), "defvert_add_to group, new deformWeight");
+	if (dvert->dw) {
+		memcpy(dw_new, dvert->dw, sizeof(MDeformWeight) * dvert->totweight);
 		MEM_freeN(dvert->dw);
 	}
 	dvert->dw = dw_new;
@@ -634,7 +659,7 @@ void defvert_remove_group(MDeformVert *dvert, MDeformWeight *dw)
 		int i = dw - dvert->dw;
 
 		/* Security check! */
-		if(i < 0 || i >= dvert->totweight) {
+		if (i < 0 || i >= dvert->totweight) {
 			return;
 		}
 
@@ -643,16 +668,16 @@ void defvert_remove_group(MDeformVert *dvert, MDeformWeight *dw)
 		 * this deform weight, and reshuffle the others.
 		 */
 		if (dvert->totweight) {
-			dw_new = MEM_mallocN(sizeof(MDeformWeight)*(dvert->totweight), __func__);
+			dw_new = MEM_mallocN(sizeof(MDeformWeight) * (dvert->totweight), __func__);
 			if (dvert->dw) {
-#if 1			/* since we dont care about order, swap this with the last, save a memcpy */
+#if 1			/* since we don't care about order, swap this with the last, save a memcpy */
 				if (i != dvert->totweight) {
-					dvert->dw[i]= dvert->dw[dvert->totweight];
+					dvert->dw[i] = dvert->dw[dvert->totweight];
 				}
 				memcpy(dw_new, dvert->dw, sizeof(MDeformWeight) * dvert->totweight);
 #else
-				memcpy(dw_new, dvert->dw, sizeof(MDeformWeight)*i);
-				memcpy(dw_new+i, dvert->dw+i+1, sizeof(MDeformWeight)*(dvert->totweight-i));
+				memcpy(dw_new, dvert->dw, sizeof(MDeformWeight) * i);
+				memcpy(dw_new + i, dvert->dw + i + 1, sizeof(MDeformWeight) * (dvert->totweight - i));
 #endif
 				MEM_freeN(dvert->dw);
 			}
@@ -665,3 +690,13 @@ void defvert_remove_group(MDeformVert *dvert, MDeformWeight *dw)
 		}
 	}
 }
+
+void defvert_clear(MDeformVert *dvert)
+{
+	if (dvert->dw) {
+		MEM_freeN(dvert->dw);
+		dvert->dw = NULL;
+	}
+
+	dvert->totweight = 0;
+}
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 19fc75a..aa6d429 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -34,7 +34,10 @@
 
 #include "MEM_guardedalloc.h"
 
-#include "BLI_winstuff.h"
+#ifdef WIN32
+#  include "BLI_winstuff.h"
+#endif
+
 #include "BLI_utildefines.h"
 #include "BLI_listbase.h"
 #include "BLI_ghash.h"
@@ -75,7 +78,7 @@
  
 /* Queue and stack operations for dag traversal 
  *
- * the queue store a list of freenodes to avoid successives alloc/dealloc
+ * the queue store a list of freenodes to avoid successive alloc/dealloc
  */
 
 DagNodeQueue * queue_create (int slots) 
@@ -156,7 +159,7 @@ void push_queue(DagNodeQueue *queue, DagNode *node)
 	int i;
 
 	if (node == NULL) {
-		fprintf(stderr,"pushing null node \n");
+		fprintf(stderr,"pushing null node\n");
 		return;
 	}
 	/*fprintf(stderr,"BFS push : %s %d\n",((ID *) node->ob)->name, queue->count);*/
@@ -169,7 +172,8 @@ void push_queue(DagNodeQueue *queue, DagNode *node)
 			queue->freenodes->first = NULL;
 		}
 		queue->freenodes->count--;
-	} else { /* alllocating more */		
+	}
+	else { /* alllocating more */
 		elem = MEM_mallocN(sizeof(DagNodeQueueElem),"DAG queue elem1");
 		elem->node = NULL;
 		elem->next = NULL;
@@ -213,7 +217,8 @@ void push_stack(DagNodeQueue *queue, DagNode *node)
 			queue->freenodes->first = NULL;
 		}
 		queue->freenodes->count--;
-	} else { /* alllocating more */
+	}
+	else { /* alllocating more */
 		elem = MEM_mallocN(sizeof(DagNodeQueueElem),"DAG queue elem1");
 		elem->node = NULL;
 		elem->next = NULL;
@@ -263,8 +268,9 @@ DagNode * pop_queue(DagNodeQueue *queue)
 		elem->next = NULL;
 		queue->freenodes->count++;
 		return node;
-	} else {
-		fprintf(stderr,"return null \n");
+	}
+	else {
+		fprintf(stderr,"return null\n");
 		return NULL;
 	}
 }
@@ -346,10 +352,10 @@ static void dag_add_collision_field_relation(DagForest *dag, Scene *scene, Objec
 
 	// would be nice to have a list of colliders here
 	// so for now walk all objects in scene check 'same layer rule'
-	for(base = scene->base.first; base; base= base->next) {
-		if((base->lay & ob->lay) && base->object->pd) {
+	for (base = scene->base.first; base; base= base->next) {
+		if ((base->lay & ob->lay) && base->object->pd) {
 			Object *ob1= base->object;
-			if((ob1->pd->deflect || ob1->pd->forcefield) && (ob1 != ob))  {
+			if ((ob1->pd->deflect || ob1->pd->forcefield) && (ob1 != ob)) {
 				node2 = dag_get_node(dag, ob1);					
 				dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Field Collision");
 			}
@@ -380,7 +386,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
 	node->customdata_mask= 0;
 	
 	if (ob->type == OB_ARMATURE) {
-		if (ob->pose){
+		if (ob->pose) {
 			bPoseChannel *pchan;
 			bConstraint *con;
 			
@@ -395,15 +401,15 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
 						
 						for (ct= targets.first; ct; ct= ct->next) {
 							if (ct->tar && ct->tar != ob) {
-								// fprintf(stderr,"armature %s target :%s \n", ob->id.name, target->id.name);
+								// fprintf(stderr,"armature %s target :%s\n", ob->id.name, target->id.name);
 								node3 = dag_get_node(dag, ct->tar);
 								
 								if (ct->subtarget[0]) {
 									dag_add_relation(dag,node3,node, DAG_RL_OB_DATA|DAG_RL_DATA_DATA, cti->name);
-									if(ct->tar->type == OB_MESH)
+									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);
@@ -421,14 +427,14 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
 	
 	/* driver dependencies, nla modifiers */
 #if 0 // XXX old animation system
-	if(ob->nlastrips.first) {
+	if (ob->nlastrips.first) {
 		bActionStrip *strip;
 		bActionChannel *chan;
-		for(strip= ob->nlastrips.first; strip; strip= strip->next) {
-			if(strip->modifiers.first) {
+		for (strip= ob->nlastrips.first; strip; strip= strip->next) {
+			if (strip->modifiers.first) {
 				bActionModifier *amod;
-				for(amod= strip->modifiers.first; amod; amod= amod->next) {
-					if(amod->ob) {
+				for (amod= strip->modifiers.first; amod; amod= amod->next) {
+					if (amod->ob) {
 						node2 = dag_get_node(dag, amod->ob);
 						dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "NLA Strip Modifier");
 					}
@@ -447,7 +453,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
 	if (ob->modifiers.first) {
 		ModifierData *md;
 		
-		for(md=ob->modifiers.first; md; md=md->next) {
+		for (md=ob->modifiers.first; md; md=md->next) {
 			ModifierTypeInfo *mti = modifierType_getInfo(md->type);
 			
 			if (mti->updateDepgraph) mti->updateDepgraph(md, dag, scene, ob, node);
@@ -468,11 +474,11 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
 				dag_add_relation(dag,node2,node,DAG_RL_DATA_OB|DAG_RL_OB_OB, "Bone Parent");
 				break;
 			default:
-				if(ob->parent->type==OB_LATTICE) 
+				if (ob->parent->type==OB_LATTICE) 
 					dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_OB, "Lattice Parent");
-				else if(ob->parent->type==OB_CURVE) {
+				else if (ob->parent->type==OB_CURVE) {
 					Curve *cu= ob->parent->data;
-					if(cu->flag & CU_PATH) 
+					if (cu->flag & CU_PATH) 
 						dag_add_relation(dag,node2,node,DAG_RL_DATA_OB|DAG_RL_OB_OB, "Curve Parent");
 					else
 						dag_add_relation(dag,node2,node,DAG_RL_OB_OB, "Curve Parent");
@@ -481,7 +487,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
 					dag_add_relation(dag,node2,node,DAG_RL_OB_OB, "Parent");
 		}
 		/* exception case: parent is duplivert */
-		if(ob->type==OB_MBALL && (ob->parent->transflag & OB_DUPLIVERTS)) {
+		if (ob->type==OB_MBALL && (ob->parent->transflag & OB_DUPLIVERTS)) {
 			dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_OB, "Duplivert");
 		}
 		
@@ -494,10 +500,10 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
 	}
 	
 	if (ob->transflag & OB_DUPLI) {
-		if((ob->transflag & OB_DUPLIGROUP) && ob->dup_group) {
+		if ((ob->transflag & OB_DUPLIGROUP) && ob->dup_group) {
 			GroupObject *go;
-			for(go= ob->dup_group->gobject.first; go; go= go->next) {
-				if(go->ob) {
+			for (go= ob->dup_group->gobject.first; go; go= go->next) {
+				if (go->ob) {
 					node2 = dag_get_node(dag, go->ob);
 					/* node2 changes node1, this keeps animations updated in groups?? not logical? */
 					dag_add_relation(dag, node2, node, DAG_RL_OB_OB, "Dupligroup");
@@ -508,7 +514,7 @@ 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(modifiers_isSoftbodyEnabled(ob) || modifiers_isClothEnabled(ob) || ob->particlesystem.first)
+		if (modifiers_isSoftbodyEnabled(ob) || modifiers_isClothEnabled(ob) || ob->particlesystem.first)
 			dag_add_collision_field_relation(dag, scene, ob, node); /* TODO: use effectorweight->group */
 	}
 	
@@ -535,7 +541,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
 		{
 			Object *mom= find_basis_mball(scene, ob);
 			
-			if(mom!=ob) {
+			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!
 			}
@@ -546,16 +552,16 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
 		{
 			Curve *cu= ob->data;
 			
-			if(cu->bevobj) {
+			if (cu->bevobj) {
 				node2 = dag_get_node(dag, cu->bevobj);
 				dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Curve Bevel");
 			}
-			if(cu->taperobj) {
+			if (cu->taperobj) {
 				node2 = dag_get_node(dag, cu->taperobj);
 				dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Curve Taper");
 			}
-			if(ob->type == OB_FONT) {
-				if(cu->textoncurve) {
+			if (ob->type == OB_FONT) {
+				if (cu->textoncurve) {
 					node2 = dag_get_node(dag, cu->textoncurve);
 					dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Texture On Curve");
 				}
@@ -566,10 +572,10 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
 	
 	/* particles */
 	psys= ob->particlesystem.first;
-	if(psys) {
+	if (psys) {
 		GroupObject *go;
 
-		for(; psys; psys=psys->next) {
+		for (; psys; psys=psys->next) {
 			BoidRule *rule = NULL;
 			BoidState *state = NULL;
 			ParticleSettings *part= psys->part;
@@ -578,32 +584,32 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
 
 			dag_add_relation(dag, node, node, DAG_RL_OB_DATA, "Particle-Object Relation");
 
-			if(!psys_check_enabled(ob, psys))
+			if (!psys_check_enabled(ob, psys))
 				continue;
 
-			if(ELEM(part->phystype,PART_PHYS_KEYED,PART_PHYS_BOIDS)) {
+			if (ELEM(part->phystype,PART_PHYS_KEYED,PART_PHYS_BOIDS)) {
 				ParticleTarget *pt = psys->targets.first;
 
-				for(; pt; pt=pt->next) {
-					if(pt->ob && BLI_findlink(&pt->ob->particlesystem, pt->psys-1)) {
+				for (; pt; pt=pt->next) {
+					if (pt->ob && BLI_findlink(&pt->ob->particlesystem, pt->psys-1)) {
 						node2 = dag_get_node(dag, pt->ob);
 						dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Particle Targets");
 					}
 			   }
 			}
 
-			if(part->ren_as == PART_DRAW_OB && part->dup_ob) {
+			if (part->ren_as == PART_DRAW_OB && part->dup_ob) {
 				node2 = dag_get_node(dag, part->dup_ob);
 				/* note that this relation actually runs in the wrong direction, the problem
-				   is that dupli system all have this (due to parenting), and the render
-				   engine instancing assumes particular ordering of objects in list */
+				 * is that dupli system all have this (due to parenting), and the render
+				 * engine instancing assumes particular ordering of objects in list */
 				dag_add_relation(dag, node, node2, DAG_RL_OB_OB, "Particle Object Visualisation");
-				if(part->dup_ob->type == OB_MBALL)
+				if (part->dup_ob->type == OB_MBALL)
 					dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA, "Particle Object Visualisation");
 			}
 
-			if(part->ren_as == PART_DRAW_GR && part->dup_group) {
-				for(go=part->dup_group->gobject.first; go; go=go->next) {
+			if (part->ren_as == PART_DRAW_GR && part->dup_group) {
+				for (go=part->dup_group->gobject.first; go; go=go->next) {
 					node2 = dag_get_node(dag, go->ob);
 					dag_add_relation(dag, node2, node, DAG_RL_OB_OB, "Particle Group Visualisation");
 				}
@@ -611,8 +617,8 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
 
 			effectors = pdInitEffectors(scene, ob, psys, part->effector_weights);
 
-			if(effectors) for(eff = effectors->first; eff; eff=eff->next) {
-				if(eff->psys) {
+			if (effectors) for (eff = effectors->first; eff; eff=eff->next) {
+				if (eff->psys) {
 					node2 = dag_get_node(dag, eff->ob);
 					dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Particle Field");
 				}
@@ -620,16 +626,16 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
 
 			pdEndEffectors(&effectors);
 
-			if(part->boids) {
-				for(state = part->boids->states.first; state; state=state->next) {
-					for(rule = state->rules.first; rule; rule=rule->next) {
+			if (part->boids) {
+				for (state = part->boids->states.first; state; state=state->next) {
+					for (rule = state->rules.first; rule; rule=rule->next) {
 						Object *ruleob = NULL;
-						if(rule->type==eBoidRuleType_Avoid)
+						if (rule->type==eBoidRuleType_Avoid)
 							ruleob = ((BoidRuleGoalAvoid*)rule)->ob;
-						else if(rule->type==eBoidRuleType_FollowLeader)
+						else if (rule->type==eBoidRuleType_FollowLeader)
 							ruleob = ((BoidRuleFollowLeader*)rule)->ob;
 
-						if(ruleob) {
+						if (ruleob) {
 							node2 = dag_get_node(dag, ruleob);
 							dag_add_relation(dag, node2, node, DAG_RL_OB_DATA, "Boid Rule");
 						}
@@ -645,28 +651,28 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
 		ListBase targets = {NULL, NULL};
 		bConstraintTarget *ct;
 		
-		if(!cti)
+		if (!cti)
 			continue;
 
 		/* special case for camera tracking -- it doesn't use targets to define relations */
-		if(ELEM3(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_CAMERASOLVER, CONSTRAINT_TYPE_OBJECTSOLVER)) {
+		if (ELEM3(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_CAMERASOLVER, CONSTRAINT_TYPE_OBJECTSOLVER)) {
 			int depends_on_camera= 0;
 
-			if(cti->type==CONSTRAINT_TYPE_FOLLOWTRACK) {
+			if (cti->type==CONSTRAINT_TYPE_FOLLOWTRACK) {
 				bFollowTrackConstraint *data= (bFollowTrackConstraint *)con->data;
 
-				if((data->clip || data->flag&FOLLOWTRACK_ACTIVECLIP) && data->track[0])
+				if ((data->clip || data->flag&FOLLOWTRACK_ACTIVECLIP) && data->track[0])
 					depends_on_camera= 1;
 
-				if(data->depth_ob) {
+				if (data->depth_ob) {
 					node2 = dag_get_node(dag, data->depth_ob);
 					dag_add_relation(dag, node2, node, DAG_RL_DATA_OB|DAG_RL_OB_OB, cti->name);
 				}
 			}
-			else if(cti->type==CONSTRAINT_TYPE_OBJECTSOLVER)
+			else if (cti->type==CONSTRAINT_TYPE_OBJECTSOLVER)
 				depends_on_camera= 1;
 
-			if(depends_on_camera && scene->camera) {
+			if (depends_on_camera && scene->camera) {
 				node2 = dag_get_node(dag, scene->camera);
 				dag_add_relation(dag, node2, node, DAG_RL_DATA_OB|DAG_RL_OB_OB, cti->name);
 			}
@@ -733,22 +739,22 @@ struct DagForest *build_dag(Main *bmain, Scene *sce, short mask)
 	scenenode = dag_add_node(dag, sce);	
 	
 	/* add current scene objects */
-	for(base = sce->base.first; base; base= base->next) {
+	for (base = sce->base.first; base; base= base->next) {
 		ob= base->object;
 		
 		build_dag_object(dag, scenenode, sce, ob, mask);
-		if(ob->proxy)
+		if (ob->proxy)
 			build_dag_object(dag, scenenode, sce, ob->proxy, mask);
 		
 		/* handled in next loop */
-		if(ob->dup_group) 
+		if (ob->dup_group) 
 			ob->dup_group->id.flag |= LIB_DOIT;
 	}
 	
 	/* add groups used in current scene objects */
-	for(group= bmain->group.first; group; group= group->id.next) {
-		if(group->id.flag & LIB_DOIT) {
-			for(go= group->gobject.first; go; go= go->next) {
+	for (group= bmain->group.first; group; group= group->id.next) {
+		if (group->id.flag & LIB_DOIT) {
+			for (go= group->gobject.first; go; go= go->next) {
 				build_dag_object(dag, scenenode, sce, go->ob, mask);
 			}
 			group->id.flag &= ~LIB_DOIT;
@@ -756,14 +762,14 @@ struct DagForest *build_dag(Main *bmain, Scene *sce, short mask)
 	}
 	
 	/* Now all relations were built, but we need to solve 1 exceptional case;
-	   When objects have multiple "parents" (for example parent + constraint working on same object)
-	   the relation type has to be synced. One of the parents can change, and should give same event to child */
+	 * When objects have multiple "parents" (for example parent + constraint working on same object)
+	 * the relation type has to be synced. One of the parents can change, and should give same event to child */
 	
 	/* nodes were callocced, so we can use node->color for temporal storage */
-	for(node = sce->theDag->DagNode.first; node; node= node->next) {
-		if(node->type==ID_OB) {
-			for(itA = node->child; itA; itA= itA->next) {
-				if(itA->node->type==ID_OB) {
+	for (node = sce->theDag->DagNode.first; node; node= node->next) {
+		if (node->type==ID_OB) {
+			for (itA = node->child; itA; itA= itA->next) {
+				if (itA->node->type==ID_OB) {
 					itA->node->color |= itA->type;
 				}
 			}
@@ -773,10 +779,10 @@ struct DagForest *build_dag(Main *bmain, Scene *sce, short mask)
 		}
 	}
 	/* now set relations equal, so that when only one parent changes, the correct recalcs are found */
-	for(node = sce->theDag->DagNode.first; node; node= node->next) {
-		if(node->type==ID_OB) {
-			for(itA = node->child; itA; itA= itA->next) {
-				if(itA->node->type==ID_OB) {
+	for (node = sce->theDag->DagNode.first; node; node= node->next) {
+		if (node->type==ID_OB) {
+			for (itA = node->child; itA; itA= itA->next) {
+				if (itA->node->type==ID_OB) {
 					itA->type |= itA->node->color;
 				}
 			}
@@ -827,7 +833,7 @@ void free_forest(DagForest *Dag)
 
 DagNode * dag_find_node (DagForest *forest,void * fob)
 {
-	if(forest->nodeHash)
+	if (forest->nodeHash)
 		return BLI_ghash_lookup(forest->nodeHash, fob);
 
 	return NULL;
@@ -846,18 +852,19 @@ 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;
 			forest->numNodes++;
-		} else {
+		}
+		else {
 			forest->DagNode.last = node;
 			forest->DagNode.first = node;
 			forest->numNodes = 1;
 		}
 
-		if(!forest->nodeHash)
+		if (!forest->nodeHash)
 			forest->nodeHash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "dag_add_node gh");
 		BLI_ghash_insert(forest->nodeHash, fob, node);
 	}
@@ -890,7 +897,8 @@ DagNode * dag_get_sub_node (DagForest *forest,void * fob)
 				prev->next = mainchild->next;
 				MEM_freeN(mainchild);
 				break;
-			} else {
+			}
+			else {
 				((DagNode *) forest->DagNode.first)->child = mainchild->next;
 				MEM_freeN(mainchild);
 				break;
@@ -954,9 +962,9 @@ void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel
 
 static const char *dag_node_name(DagNode *node)
 {
-	if(node->ob == NULL)
+	if (node->ob == NULL)
 		return "null";
-	else if(ugly_hack_sorry)
+	else if (ugly_hack_sorry)
 		return ((ID*)(node->ob))->name+2;
 	else
 		return ((bPoseChannel*)(node->ob))->name;
@@ -968,7 +976,7 @@ static void dag_node_print_dependencies(DagNode *node)
 
 	printf("%s depends on:\n", dag_node_name(node));
 
-	for(itA= node->parent; itA; itA= itA->next)
+	for (itA= node->parent; itA; itA= itA->next)
 		printf("  %s through %s\n", dag_node_name(itA->node), itA->name);
 	printf("\n");
 }
@@ -977,16 +985,16 @@ static int dag_node_print_dependency_recurs(DagNode *node, DagNode *endnode)
 {
 	DagAdjList *itA;
 
-	if(node->color == DAG_BLACK)
+	if (node->color == DAG_BLACK)
 		return 0;
 
 	node->color= DAG_BLACK;
 
-	if(node == endnode)
+	if (node == endnode)
 		return 1;
 
-	for(itA= node->parent; itA; itA= itA->next) {
-		if(dag_node_print_dependency_recurs(itA->node, endnode)) {
+	for (itA= node->parent; itA; itA= itA->next) {
+		if (dag_node_print_dependency_recurs(itA->node, endnode)) {
 			printf("  %s depends on %s through %s.\n", dag_node_name(node), dag_node_name(itA->node), itA->name);
 			return 1;
 		}
@@ -999,7 +1007,7 @@ static void dag_node_print_dependency_cycle(DagForest *dag, DagNode *startnode,
 {
 	DagNode *node;
 
-	for(node = dag->DagNode.first; node; node= node->next)
+	for (node = dag->DagNode.first; node; node= node->next)
 		node->color= DAG_WHITE;
 
 	printf("  %s depends on %s through %s.\n", dag_node_name(endnode), dag_node_name(startnode), name);
@@ -1015,8 +1023,8 @@ static int dag_node_recurs_level(DagNode *node, int level)
 	node->color= DAG_BLACK;	/* done */
 	newlevel= ++level;
 	
-	for(itA= node->parent; itA; itA= itA->next) {
-		if(itA->node->color==DAG_WHITE) {
+	for (itA= node->parent; itA; itA= itA->next) {
+		if (itA->node->color==DAG_WHITE) {
 			itA->node->ancestor_count= dag_node_recurs_level(itA->node, level);
 			newlevel= MAX2(newlevel, level+itA->node->ancestor_count);
 		}
@@ -1033,25 +1041,25 @@ static void dag_check_cycle(DagForest *dag)
 	DagAdjList *itA;
 
 	/* debugging print */
-	if(dag_print_dependencies)
-		for(node = dag->DagNode.first; node; node= node->next)
+	if (dag_print_dependencies)
+		for (node = dag->DagNode.first; node; node= node->next)
 			dag_node_print_dependencies(node);
 
 	/* tag nodes unchecked */
-	for(node = dag->DagNode.first; node; node= node->next)
+	for (node = dag->DagNode.first; node; node= node->next)
 		node->color= DAG_WHITE;
 	
-	for(node = dag->DagNode.first; node; node= node->next) {
-		if(node->color==DAG_WHITE) {
+	for (node = dag->DagNode.first; node; node= node->next) {
+		if (node->color==DAG_WHITE) {
 			node->ancestor_count= dag_node_recurs_level(node, 0);
 		}
 	}
 	
 	/* check relations, and print errors */
-	for(node = dag->DagNode.first; node; node= node->next) {
-		for(itA= node->parent; itA; itA= itA->next) {
-			if(itA->node->ancestor_count > node->ancestor_count) {
-				if(node->ob && itA->node->ob) {
+	for (node = dag->DagNode.first; node; node= node->next) {
+		for (itA= node->parent; itA; itA= itA->next) {
+			if (itA->node->ancestor_count > node->ancestor_count) {
+				if (node->ob && itA->node->ob) {
 					printf("Dependency cycle detected:\n");
 					dag_node_print_dependency_cycle(dag, itA->node, node, itA->name);
 				}
@@ -1060,7 +1068,7 @@ static void dag_check_cycle(DagForest *dag)
 	}
 
 	/* parent relations are only needed for cycle checking, so free now */
-	for(node = dag->DagNode.first; node; node= node->next) {
+	for (node = dag->DagNode.first; node; node= node->next) {
 		while (node->parent) {
 			itA = node->parent->next;
 			MEM_freeN(node->parent);			
@@ -1110,16 +1118,16 @@ void graph_bfs(void)
 	DagAdjList *itA;
 	int minheight;
 	
-	/* fprintf(stderr,"starting BFS \n ------------\n"); */	
+	/* fprintf(stderr,"starting BFS\n ------------\n"); */
 	nqueue = queue_create(DAGQUEUEALLOC);
 	for ( i=0; i<50; i++)
 		pos[i] = 0;
 	
 	/* Init
-	 * dagnode.first is alway the root (scene) 
+	 * dagnode.first is always the root (scene)
 	 */
 	node = MainDag->DagNode.first;
-	while(node) {
+	while (node) {
 		node->color = DAG_WHITE;
 		node->BFS_dist = 9999;
 		node->k = 0;
@@ -1131,13 +1139,13 @@ void graph_bfs(void)
 		node->color = DAG_GRAY;
 		node->BFS_dist = 1;
 		push_queue(nqueue,node);  
-		while(nqueue->count) {
+		while (nqueue->count) {
 			node = pop_queue(nqueue);
 			
 			minheight = pos[node->BFS_dist];
 			itA = node->child;
-			while(itA != NULL) {
-				if(itA->node->color == DAG_WHITE) {
+			while (itA != NULL) {
+				if (itA->node->color == DAG_WHITE) {
 					itA->node->color = DAG_GRAY;
 					itA->node->BFS_dist = node->BFS_dist + 1;
 					itA->node->k = (float) minheight;
@@ -1145,7 +1153,7 @@ void graph_bfs(void)
 				}
 				
 				else {
-					fprintf(stderr,"bfs not dag tree edge color :%i \n",itA->node->color);
+					fprintf(stderr,"bfs not dag tree edge color :%i\n",itA->node->color);
 				}
 
 				
@@ -1154,14 +1162,14 @@ void graph_bfs(void)
 			if (pos[node->BFS_dist] > node->k ) {
 				pos[node->BFS_dist] += 1;				
 				node->k = (float) pos[node->BFS_dist];
-			} else {
+			}
+			else {
 				pos[node->BFS_dist] = (int) node->k +1;
 			}
 			set_node_xy(node, node->BFS_dist*DEPSX*2, pos[node->BFS_dist]*DEPSY*2);
 			node->color = DAG_BLACK;
-			/*
-			fprintf(stderr,"BFS node : %20s %i %5.0f %5.0f\n",((ID *) node->ob)->name,node->BFS_dist, node->x, node->y);
-			*/
+
+			// fprintf(stderr,"BFS node : %20s %i %5.0f %5.0f\n",((ID *) node->ob)->name,node->BFS_dist, node->x, node->y);
 		}
 	}
 	queue_delete(nqueue);
@@ -1182,14 +1190,14 @@ int pre_and_post_source_BFS(DagForest *dag, short mask, DagNode *source, graph_a
 	DagNodeQueue *nqueue;
 	DagAdjList *itA;
 	int	retval = 0;
-	/* fprintf(stderr,"starting BFS \n ------------\n"); */	
+	/* fprintf(stderr,"starting BFS\n ------------\n"); */
 	
 	/* Init
-		* dagnode.first is alway the root (scene) 
-		*/
+	 * dagnode.first is always the root (scene)
+	 */
 	node = dag->DagNode.first;
 	nqueue = queue_create(DAGQUEUEALLOC);
-	while(node) {
+	while (node) {
 		node->color = DAG_WHITE;
 		node->BFS_dist = 9999;
 		node = node->next;
@@ -1201,12 +1209,12 @@ int pre_and_post_source_BFS(DagForest *dag, short mask, DagNode *source, graph_a
 		node->BFS_dist = 1;
 		pre_func(node->ob,data);
 		
-		while(nqueue->count) {
+		while (nqueue->count) {
 			node = pop_queue(nqueue);
 			
 			itA = node->child;
-			while(itA != NULL) {
-				if((itA->node->color == DAG_WHITE) && (itA->type & mask)) {
+			while (itA != NULL) {
+				if ((itA->node->color == DAG_WHITE) && (itA->type & mask)) {
 					itA->node->color = DAG_GRAY;
 					itA->node->BFS_dist = node->BFS_dist + 1;
 					push_queue(nqueue,itA->node);
@@ -1220,9 +1228,8 @@ int pre_and_post_source_BFS(DagForest *dag, short mask, DagNode *source, graph_a
 			}
 			post_func(node->ob,data);
 			node->color = DAG_BLACK;
-			/*
-			fprintf(stderr,"BFS node : %20s %i %5.0f %5.0f\n",((ID *) node->ob)->name,node->BFS_dist, node->x, node->y);
-			*/
+
+			// fprintf(stderr,"BFS node : %20s %i %5.0f %5.0f\n",((ID *) node->ob)->name,node->BFS_dist, node->x, node->y);
 		}
 	}
 	queue_delete(nqueue);
@@ -1244,7 +1251,7 @@ DagNodeQueue * graph_dfs(void)
 	int maxpos=0;
 	/* int	is_cycle = 0; */ /* UNUSED */
 	/*
-	 *fprintf(stderr,"starting DFS \n ------------\n");
+	 *fprintf(stderr,"starting DFS\n ------------\n");
 	 */	
 	nqueue = queue_create(DAGQUEUEALLOC);
 	retqueue = queue_create(MainDag->numNodes);
@@ -1252,10 +1259,10 @@ DagNodeQueue * graph_dfs(void)
 		pos[i] = 0;
 	
 	/* Init
-	 * dagnode.first is alway the root (scene) 
+	 * dagnode.first is always the root (scene)
 	 */
 	node = MainDag->DagNode.first;
-	while(node) {
+	while (node) {
 		node->color = DAG_WHITE;
 		node->DFS_dist = 9999;
 		node->DFS_dvtm = node->DFS_fntm = 9999;
@@ -1275,7 +1282,7 @@ DagNodeQueue * graph_dfs(void)
 		time++;
 		push_stack(nqueue,node);  
 			
-		while(nqueue->count) {
+		while (nqueue->count) {
 			//graph_print_queue(nqueue);
 
 			skip = 0;
@@ -1284,8 +1291,8 @@ DagNodeQueue * graph_dfs(void)
 			minheight = pos[node->DFS_dist];
 
 			itA = node->child;
-			while(itA != NULL) {
-				if(itA->node->color == DAG_WHITE) {
+			while (itA != NULL) {
+				if (itA->node->color == DAG_WHITE) {
 					itA->node->DFS_dvtm = time;
 					itA->node->color = DAG_GRAY;
 
@@ -1295,28 +1302,31 @@ DagNodeQueue * graph_dfs(void)
 					push_stack(nqueue,itA->node);
 					skip = 1;
 					break;
-				} else { 
+				}
+				else {
 					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);
+						fprintf(stderr,"dfs back edge :%15s %15s\n",((ID *) node->ob)->name, ((ID *) itA->node->ob)->name);
 						/* is_cycle = 1; */ /* UNUSED */
-					} else if (itA->node->color == DAG_BLACK) {
-						;
+					}
+					else if (itA->node->color == DAG_BLACK) {
 						/* already processed node but we may want later to change distance either to shorter to longer.
 						 * DFS_dist is the first encounter  
-						*/
-						/*if (node->DFS_dist >= itA->node->DFS_dist)
+						 */
+#if 0
+						if (node->DFS_dist >= itA->node->DFS_dist)
 							itA->node->DFS_dist = node->DFS_dist + 1;
 
-							fprintf(stderr,"dfs forward or cross edge :%15s %i-%i %15s %i-%i \n",
+							fprintf(stderr,"dfs forward or cross edge :%15s %i-%i %15s %i-%i\n",
 								((ID *) node->ob)->name,
 								node->DFS_dvtm, 
 								node->DFS_fntm, 
 								((ID *) itA->node->ob)->name, 
 								itA->node->DFS_dvtm,
 								itA->node->DFS_fntm);
-					*/
-					} else 
-						fprintf(stderr,"dfs unknown edge \n");
+#endif
+					}
+					else
+						fprintf(stderr,"dfs unknown edge\n");
 				}
 				itA = itA->next;
 			}			
@@ -1332,14 +1342,14 @@ DagNodeQueue * graph_dfs(void)
 				if (pos[node->DFS_dist] > node->k ) {
 					pos[node->DFS_dist] += 1;				
 					node->k = (float) pos[node->DFS_dist];
-				} else {
+				}
+				else {
 					pos[node->DFS_dist] = (int) node->k +1;
 				}
 				set_node_xy(node, node->DFS_dist*DEPSX*2, pos[node->DFS_dist]*DEPSY*2);
 				
-				/*
-				fprintf(stderr,"DFS node : %20s %i %i %i %i\n",((ID *) node->ob)->name,node->BFS_dist, node->DFS_dist, node->DFS_dvtm, node->DFS_fntm );
-				*/
+				// fprintf(stderr,"DFS node : %20s %i %i %i %i\n",((ID *) node->ob)->name,node->BFS_dist, node->DFS_dist, node->DFS_dvtm, node->DFS_fntm );
+
 				push_stack(retqueue,node);
 				
 			}
@@ -1347,7 +1357,7 @@ DagNodeQueue * graph_dfs(void)
 	}
 		node = node->next;
 	} while (node);
-//	fprintf(stderr,"i size : %i \n", maxpos);
+//	fprintf(stderr,"i size : %i\n", maxpos);
 
 	queue_delete(nqueue);
 	return(retqueue);
@@ -1371,15 +1381,15 @@ int pre_and_post_source_DFS(DagForest *dag, short mask, DagNode *source, graph_a
 	int skip = 0;
 	int retval = 0;
 	/*
-	 *fprintf(stderr,"starting DFS \n ------------\n");
+	 *fprintf(stderr,"starting DFS\n ------------\n");
 	 */	
 	nqueue = queue_create(DAGQUEUEALLOC);
 	
 	/* Init
-		* dagnode.first is alway the root (scene) 
-		*/
+	 * dagnode.first is always the root (scene)
+	 */
 	node = dag->DagNode.first;
-	while(node) {
+	while (node) {
 		node->color = DAG_WHITE;
 		node->DFS_dist = 9999;
 		node->DFS_dvtm = node->DFS_fntm = 9999;
@@ -1399,13 +1409,13 @@ int pre_and_post_source_DFS(DagForest *dag, short mask, DagNode *source, graph_a
 			push_stack(nqueue,node);  
 			pre_func(node->ob,data);
 
-			while(nqueue->count) {
+			while (nqueue->count) {
 				skip = 0;
 				node = get_top_node_queue(nqueue);
 								
 				itA = node->child;
-				while(itA != NULL) {
-					if((itA->node->color == DAG_WHITE) && (itA->type & mask) ) {
+				while (itA != NULL) {
+					if ((itA->node->color == DAG_WHITE) && (itA->type & mask) ) {
 						itA->node->DFS_dvtm = time;
 						itA->node->color = DAG_GRAY;
 						
@@ -1416,12 +1426,14 @@ int pre_and_post_source_DFS(DagForest *dag, short mask, DagNode *source, graph_a
 
 						skip = 1;
 						break;
-					} else {
+					}
+					else {
 						if (itA->node->color == DAG_GRAY) {// back edge
 							retval = 1;
 						}
 //						else if (itA->node->color == DAG_BLACK) { // cross or forward
-//							;
+//
+//						}
 					}
 					itA = itA->next;
 				}			
@@ -1451,20 +1463,21 @@ struct DagNodeQueue *get_obparents(struct DagForest	*dag, void *ob)
 	DagAdjList *itA;
 
 	node = dag_find_node(dag,ob);
-	if(node==NULL) {
+	if (node==NULL) {
 		return NULL;
 	}
 	else if (node->ancestor_count == 1) { // simple case
 		nqueue = queue_create(1);
 		push_queue(nqueue,node);
-	} else {	// need to go over the whole dag for adj list
+	}
+	else { /* need to go over the whole dag for adj list */
 		nqueue = queue_create(node->ancestor_count);
 		
 		node1 = dag->DagNode.first;
 		do {
 			if (node1->DFS_fntm > node->DFS_fntm) { // a parent is finished after child. must check adj list
 				itA = node->child;
-				while(itA != NULL) {
+				while (itA != NULL) {
 					if ((itA->node == node) && (itA->type == DAG_RL_DATA)) {
 						push_queue(nqueue,node);
 					}
@@ -1492,7 +1505,7 @@ struct DagNodeQueue *get_first_ancestors(struct DagForest	*dag, void *ob)
 	do {
 		if (node1->DFS_fntm > node->DFS_fntm) { 
 			itA = node->child;
-			while(itA != NULL) {
+			while (itA != NULL) {
 				if (itA->node == node) {
 					push_queue(nqueue,node);
 				}
@@ -1519,7 +1532,7 @@ struct DagNodeQueue *get_all_childs(struct DagForest	*dag, void *ob)
 	retqueue = queue_create(dag->numNodes); // was MainDag... why? (ton)
 	
 	node = dag->DagNode.first;
-	while(node) {
+	while (node) {
 		node->color = DAG_WHITE;
 		node =  node->next;
 	}
@@ -1527,20 +1540,20 @@ struct 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
+	if (node) { // can be null for newly added objects
 		
 		node->color = DAG_GRAY;
 		time++;
 		push_stack(nqueue,node);  
 		
-		while(nqueue->count) {
+		while (nqueue->count) {
 			
 			skip = 0;
 			node = get_top_node_queue(nqueue);
 					
 			itA = node->child;
-			while(itA != NULL) {
-				if(itA->node->color == DAG_WHITE) {
+			while (itA != NULL) {
+				if (itA->node->color == DAG_WHITE) {
 					itA->node->DFS_dvtm = time;
 					itA->node->color = DAG_GRAY;
 					
@@ -1566,6 +1579,7 @@ struct DagNodeQueue *get_all_childs(struct DagForest	*dag, void *ob)
 }
 
 /* unused */
+#if 0
 short	are_obs_related(struct DagForest	*dag, void *ob1, void *ob2)
 {
 	DagNode * node;
@@ -1574,14 +1588,15 @@ short	are_obs_related(struct DagForest	*dag, void *ob1, void *ob2)
 	node = dag_find_node(dag, ob1);
 	
 	itA = node->child;
-	while(itA != NULL) {
-		if(itA->node->ob == ob2) {
+	while (itA != NULL) {
+		if (itA->node->ob == ob2) {
 			return itA->node->type;
 		} 
 		itA = itA->next;
 	}
 	return DAG_NO_RELATION;
 }
+#endif
 
 int	is_acyclic( DagForest	*dag)
 {
@@ -1602,7 +1617,7 @@ void graph_print_queue(DagNodeQueue *nqueue)
 	DagNodeQueueElem *queueElem;
 	
 	queueElem = nqueue->first;
-	while(queueElem) {
+	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;		
 	}
@@ -1616,7 +1631,7 @@ void graph_print_queue_dist(DagNodeQueue *nqueue)
 	
 	queueElem = nqueue->first;
 	count = 0;
-	while(queueElem) {
+	while (queueElem) {
 		fprintf(stderr,"** %25s %2.2i-%2.2i ",((ID *) queueElem->node->ob)->name,queueElem->node->DFS_dvtm,queueElem->node->DFS_fntm);
 		while (count < queueElem->node->DFS_dvtm-1) { fputc(' ',stderr); count++;}
 		fputc('|',stderr); 
@@ -1635,7 +1650,7 @@ void graph_print_adj_list(void)
 	DagAdjList *itA;
 	
 	node = (getMainDag())->DagNode.first;
-	while(node) {
+	while (node) {
 		fprintf(stderr,"node : %s col: %i",((ID *) node->ob)->name, node->color);		
 		itA = node->child;
 		while (itA) {
@@ -1651,7 +1666,7 @@ void graph_print_adj_list(void)
 /* ************************ API *********************** */
 
 /* mechanism to allow editors to be informed of depsgraph updates,
-   to do their own updates based on changes... */
+ * to do their own updates based on changes... */
 static void (*EditorsUpdateIDCb)(Main *bmain, ID *id)= NULL;
 static void (*EditorsUpdateSceneCb)(Main *bmain, Scene *scene, int updated)= NULL;
 
@@ -1663,13 +1678,13 @@ void DAG_editors_update_cb(void (*id_func)(Main *bmain, ID *id), void (*scene_fu
 
 static void dag_editors_id_update(Main *bmain, ID *id)
 {
-	if(EditorsUpdateIDCb)
+	if (EditorsUpdateIDCb)
 		EditorsUpdateIDCb(bmain, id);
 }
 
 static void dag_editors_scene_update(Main *bmain, Scene *scene, int updated)
 {
-	if(EditorsUpdateSceneCb)
+	if (EditorsUpdateSceneCb)
 		EditorsUpdateSceneCb(bmain, scene, updated);
 }
 
@@ -1682,29 +1697,29 @@ static void scene_sort_groups(Main *bmain, Scene *sce)
 	Object *ob;
 	
 	/* test; are group objects all in this scene? */
-	for(ob= bmain->object.first; ob; ob= ob->id.next) {
+	for (ob= bmain->object.first; ob; ob= ob->id.next) {
 		ob->id.flag &= ~LIB_DOIT;
 		ob->id.newid= NULL;	/* newid abuse for GroupObject */
 	}
-	for(base = sce->base.first; base; base= base->next)
+	for (base = sce->base.first; base; base= base->next)
 		base->object->id.flag |= LIB_DOIT;
 	
-	for(group= bmain->group.first; group; group= group->id.next) {
-		for(go= group->gobject.first; go; go= go->next) {
-			if((go->ob->id.flag & LIB_DOIT)==0)
+	for (group= bmain->group.first; group; group= group->id.next) {
+		for (go= group->gobject.first; go; go= go->next) {
+			if ((go->ob->id.flag & LIB_DOIT)==0)
 				break;
 		}
 		/* this group is entirely in this scene */
-		if(go==NULL) {
+		if (go==NULL) {
 			ListBase listb= {NULL, NULL};
 			
-			for(go= group->gobject.first; go; go= go->next)
+			for (go= group->gobject.first; go; go= go->next)
 				go->ob->id.newid= (ID *)go;
 			
 			/* in order of sorted bases we reinsert group objects */
-			for(base = sce->base.first; base; base= base->next) {
+			for (base = sce->base.first; base; base= base->next) {
 				
-				if(base->object->id.newid) {
+				if (base->object->id.newid) {
 					go= (GroupObject *)base->object->id.newid;
 					base->object->id.newid= NULL;
 					BLI_remlink( &group->gobject, go);
@@ -1736,7 +1751,7 @@ void DAG_scene_sort(Main *bmain, Scene *sce)
 
 	nqueue = queue_create(DAGQUEUEALLOC);
 	
-	for(node = sce->theDag->DagNode.first; node; node= node->next) {
+	for (node = sce->theDag->DagNode.first; node; node= node->next) {
 		node->color = DAG_WHITE;
 	}
 	
@@ -1747,14 +1762,14 @@ void DAG_scene_sort(Main *bmain, Scene *sce)
 	time++;
 	push_stack(nqueue,rootnode);  
 	
-	while(nqueue->count) {
+	while (nqueue->count) {
 		
 		skip = 0;
 		node = get_top_node_queue(nqueue);
 		
 		itA = node->child;
-		while(itA != NULL) {
-			if(itA->node->color == DAG_WHITE) {
+		while (itA != NULL) {
+			if (itA->node->color == DAG_WHITE) {
 				itA->node->DFS_dvtm = time;
 				itA->node->color = DAG_GRAY;
 				
@@ -1770,14 +1785,14 @@ void DAG_scene_sort(Main *bmain, Scene *sce)
 			if (node) {
 				node = pop_queue(nqueue);
 				if (node->ob == sce)	// we are done
-					break ;
+					break;
 				node->color = DAG_BLACK;
 				
 				time++;
 				base = sce->base.first;
 				while (base && base->object != node->ob)
 					base = base->next;
-				if(base) {
+				if (base) {
 					BLI_remlink(&sce->base,base);
 					BLI_addhead(&tempbase,base);
 				}
@@ -1785,12 +1800,12 @@ void DAG_scene_sort(Main *bmain, Scene *sce)
 		}
 	}
 	
-	// temporal correction for circular dependancies
+	/* temporal correction for circular dependencies */
 	base = sce->base.first;
 	while (base) {
 		BLI_remlink(&sce->base,base);
 		BLI_addhead(&tempbase,base);
-		//if(G.f & G_DEBUG) 
+		//if (G.debug & G_DEBUG)
 			printf("cyclic %s\n", base->object->id.name);
 		base = sce->base.first;
 	}
@@ -1801,9 +1816,9 @@ void DAG_scene_sort(Main *bmain, Scene *sce)
 	/* all groups with objects in this scene gets resorted too */
 	scene_sort_groups(bmain, sce);
 	
-	if(G.f & G_DEBUG) {
+	if (G.debug & G_DEBUG) {
 		printf("\nordered\n");
-		for(base = sce->base.first; base; base= base->next) {
+		for (base = sce->base.first; base; base= base->next) {
 			printf(" %s\n", base->object->id.name);
 		}
 	}
@@ -1835,51 +1850,51 @@ static void flush_update_node(DagNode *node, unsigned int layer, int curtime)
 	node->lasttime= curtime;
 	
 	ob= node->ob;
-	if(ob && (ob->recalc & OB_RECALC_ALL)) {
+	if (ob && (ob->recalc & OB_RECALC_ALL)) {
 		all_layer= node->scelay;
 
 		/* got an object node that changes, now check relations */
-		for(itA = node->child; itA; itA= itA->next) {
+		for (itA = node->child; itA; itA= itA->next) {
 			all_layer |= itA->lay;
 			/* the relationship is visible */
-			if((itA->lay & layer)) { // XXX || (itA->node->ob == obedit)
-				if(itA->node->type==ID_OB) {
+			if ((itA->lay & layer)) { // XXX || (itA->node->ob == obedit)
+				if (itA->node->type==ID_OB) {
 					obc= itA->node->ob;
 					oldflag= obc->recalc;
 					
 					/* got a ob->obc relation, now check if flag needs flush */
-					if(ob->recalc & OB_RECALC_OB) {
-						if(itA->type & DAG_RL_OB_OB) {
+					if (ob->recalc & OB_RECALC_OB) {
+						if (itA->type & DAG_RL_OB_OB) {
 							//printf("ob %s changes ob %s\n", ob->id.name, obc->id.name);
 							obc->recalc |= OB_RECALC_OB;
 							lib_id_recalc_tag(bmain, &obc->id);
 						}
-						if(itA->type & DAG_RL_OB_DATA) {
+						if (itA->type & DAG_RL_OB_DATA) {
 							//printf("ob %s changes obdata %s\n", ob->id.name, obc->id.name);
 							obc->recalc |= OB_RECALC_DATA;
 							lib_id_recalc_data_tag(bmain, &obc->id);
 						}
 					}
-					if(ob->recalc & OB_RECALC_DATA) {
-						if(itA->type & DAG_RL_DATA_OB) {
+					if (ob->recalc & OB_RECALC_DATA) {
+						if (itA->type & DAG_RL_DATA_OB) {
 							//printf("obdata %s changes ob %s\n", ob->id.name, obc->id.name);
 							obc->recalc |= OB_RECALC_OB;
 							lib_id_recalc_tag(bmain, &obc->id);
 						}
-						if(itA->type & DAG_RL_DATA_DATA) {
+						if (itA->type & DAG_RL_DATA_DATA) {
 							//printf("obdata %s changes obdata %s\n", ob->id.name, obc->id.name);
 							obc->recalc |= OB_RECALC_DATA;
 							lib_id_recalc_data_tag(bmain, &obc->id);
 						}
 					}
-					if(oldflag!=obc->recalc) changed= 1;
+					if (oldflag!=obc->recalc) changed= 1;
 				}
 			}
 		}
 		/* even nicer, we can clear recalc flags...  */
-		if((all_layer & layer)==0) { // XXX && (ob != obedit)) {
+		if ((all_layer & layer)==0) { // XXX && (ob != obedit)) {
 			/* but existing displaylists or derivedmesh should be freed */
-			if(ob->recalc & OB_RECALC_DATA)
+			if (ob->recalc & OB_RECALC_DATA)
 				object_free_display(ob);
 			
 			ob->recalc &= ~OB_RECALC_ALL;
@@ -1889,15 +1904,15 @@ static void flush_update_node(DagNode *node, unsigned int layer, int curtime)
 	/* check case where child changes and parent forcing obdata to change */
 	/* should be done regardless if this ob has recalc set */
 	/* could merge this in with loop above...? (ton) */
-	for(itA = node->child; itA; itA= itA->next) {
+	for (itA = node->child; itA; itA= itA->next) {
 		/* the relationship is visible */
-		if((itA->lay & layer)) {		// XXX  || (itA->node->ob == obedit)
-			if(itA->node->type==ID_OB) {
+		if ((itA->lay & layer)) {		// XXX  || (itA->node->ob == obedit)
+			if (itA->node->type==ID_OB) {
 				obc= itA->node->ob;
 				/* child moves */
-				if((obc->recalc & OB_RECALC_ALL)==OB_RECALC_OB) {
+				if ((obc->recalc & OB_RECALC_ALL)==OB_RECALC_OB) {
 					/* parent has deforming info */
-					if(itA->type & (DAG_RL_OB_DATA|DAG_RL_DATA_DATA)) {
+					if (itA->type & (DAG_RL_OB_DATA|DAG_RL_DATA_DATA)) {
 						// printf("parent %s changes ob %s\n", ob->id.name, obc->id.name);
 						obc->recalc |= OB_RECALC_DATA;
 						lib_id_recalc_data_tag(bmain, &obc->id);
@@ -1908,8 +1923,8 @@ static void flush_update_node(DagNode *node, unsigned int layer, int curtime)
 	}
 	
 	/* we only go deeper if node not checked or something changed  */
-	for(itA = node->child; itA; itA= itA->next) {
-		if(changed || itA->node->lasttime!=curtime) 
+	for (itA = node->child; itA; itA= itA->next) {
+		if (changed || itA->node->lasttime!=curtime) 
 			flush_update_node(itA->node, layer, curtime);
 	}
 	
@@ -1923,9 +1938,9 @@ static unsigned int flush_layer_node(Scene *sce, DagNode *node, int curtime)
 	node->lasttime= curtime;
 	node->lay= node->scelay;
 	
-	for(itA = node->child; itA; itA= itA->next) {
-		if(itA->node->type==ID_OB) {
-			if(itA->node->lasttime!=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
 			}
 			else itA->lay= itA->node->lay;
@@ -1946,13 +1961,13 @@ static void flush_pointcache_reset(Scene *scene, DagNode *node, int curtime, int
 	
 	node->lasttime= curtime;
 	
-	for(itA = node->child; itA; itA= itA->next) {
-		if(itA->node->type==ID_OB) {
-			if(itA->node->lasttime!=curtime) {
+	for (itA = node->child; itA; itA= itA->next) {
+		if (itA->node->type==ID_OB) {
+			if (itA->node->lasttime!=curtime) {
 				ob= (Object*)(itA->node->ob);
 
-				if(reset || (ob->recalc & OB_RECALC_ALL)) {
-					if(BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_DEPSGRAPH)) {
+				if (reset || (ob->recalc & OB_RECALC_ALL)) {
+					if (BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_DEPSGRAPH)) {
 						ob->recalc |= OB_RECALC_DATA;
 						lib_id_recalc_data_tag(bmain, &ob->id);
 					}
@@ -1976,14 +1991,14 @@ static void dag_scene_flush_layers(Scene *sce, int lay)
 
 	firstnode= sce->theDag->DagNode.first;  // always scene node
 
-	for(itA = firstnode->child; itA; itA= itA->next)
+	for (itA = firstnode->child; itA; itA= itA->next)
 		itA->lay= 0;
 
 	sce->theDag->time++;	// so we know which nodes were accessed
 	lasttime= sce->theDag->time;
 
 	/* update layer flags in nodes */
-	for(base= sce->base.first; base; base= base->next) {
+	for (base= sce->base.first; base; base= base->next) {
 		node= dag_get_node(sce->theDag, base->object);
 		node->scelay= base->object->lay;
 	}
@@ -1992,7 +2007,7 @@ static void dag_scene_flush_layers(Scene *sce, int lay)
 	 * they ared still used for rendering or setting the camera view
 	 *
 	 * XXX, this wont work for local view / unlocked camera's */
-	if(sce->camera) {
+	if (sce->camera) {
 		node= dag_get_node(sce->theDag, sce->camera);
 		node->scelay |= lay;
 	}
@@ -2001,8 +2016,8 @@ static void dag_scene_flush_layers(Scene *sce, int lay)
 	{
 		TimeMarker *m;
 
-		for(m= sce->markers.first; m; m= m->next) {
-			if(m->camera) {
+		for (m= sce->markers.first; m; m= m->next) {
+			if (m->camera) {
 				node= dag_get_node(sce->theDag, m->camera);
 				node->scelay |= lay;
 			}
@@ -2011,27 +2026,27 @@ static void dag_scene_flush_layers(Scene *sce, int lay)
 #endif
 
 	/* flush layer nodes to dependencies */
-	for(itA = firstnode->child; itA; itA= itA->next)
-		if(itA->node->lasttime!=lasttime && itA->node->type==ID_OB) 
+	for (itA = firstnode->child; itA; itA= itA->next)
+		if (itA->node->lasttime!=lasttime && itA->node->type==ID_OB) 
 			flush_layer_node(sce, itA->node, lasttime);
 }
 
 static void dag_tag_renderlayers(Scene *sce, unsigned int lay)
 {
-	if(sce->nodetree) {
+	if (sce->nodetree) {
 		bNode *node;
 		Base *base;
 		unsigned int lay_changed= 0;
 		
-		for(base= sce->base.first; base; base= base->next)
-			if(base->lay & lay)
-				if(base->object->recalc)
+		for (base= sce->base.first; base; base= base->next)
+			if (base->lay & lay)
+				if (base->object->recalc)
 					lay_changed |= base->lay;
 			
-		for(node= sce->nodetree->nodes.first; node; node= node->next) {
-			if(node->id==(ID *)sce) {
+		for (node= sce->nodetree->nodes.first; node; node= node->next) {
+			if (node->id==(ID *)sce) {
 				SceneRenderLayer *srl= BLI_findlink(&sce->r.layers, node->custom1);
-				if(srl && (srl->lay & lay_changed))
+				if (srl && (srl->lay & lay_changed))
 					nodeUpdate(sce->nodetree, node);
 			}
 		}
@@ -2046,7 +2061,7 @@ void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, const sho
 	Object *ob;
 	int lasttime;
 	
-	if(sce->theDag==NULL) {
+	if (sce->theDag==NULL) {
 		printf("DAG zero... not allowed to happen!\n");
 		DAG_scene_sort(bmain, sce);
 	}
@@ -2059,20 +2074,20 @@ void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, const sho
 	/* then we use the relationships + layer info to flush update events */
 	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)
+	for (itA = firstnode->child; itA; itA= itA->next)
+		if (itA->node->lasttime!=lasttime && itA->node->type==ID_OB)
 			flush_update_node(itA->node, lay, lasttime);
 
 	/* if update is not due to time change, do pointcache clears */
-	if(!time) {
+	if (!time) {
 		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)  {
+		for (itA = firstnode->child; itA; itA= itA->next) {
+			if (itA->node->lasttime!=lasttime && itA->node->type==ID_OB) {
 				ob= (Object*)(itA->node->ob);
 
-				if(ob->recalc & OB_RECALC_ALL) {
-					if(BKE_ptcache_object_reset(sce, ob, PTCACHE_RESET_DEPSGRAPH)) {
+				if (ob->recalc & OB_RECALC_ALL) {
+					if (BKE_ptcache_object_reset(sce, ob, PTCACHE_RESET_DEPSGRAPH)) {
 						ob->recalc |= OB_RECALC_DATA;
 						lib_id_recalc_data_tag(bmain, &ob->id);
 					}
@@ -2132,7 +2147,7 @@ static short animdata_use_time(AnimData *adt)
 {
 	NlaTrack *nlt;
 	
-	if(adt==NULL) return 0;
+	if (adt==NULL) return 0;
 	
 	/* check action - only if assigned, and it has anim curves */
 	if (adt->action && adt->action->curves.first)
@@ -2166,7 +2181,7 @@ static short animdata_use_time(AnimData *adt)
 
 static void dag_object_time_update_flags(Object *ob)
 {
-	if(ob->constraints.first) {
+	if (ob->constraints.first) {
 		bConstraint *con;
 		for (con = ob->constraints.first; con; con=con->next) {
 			bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
@@ -2175,7 +2190,7 @@ static void dag_object_time_update_flags(Object *ob)
 			
 			if (cti) {
 				/* special case for camera tracking -- it doesn't use targets to define relations */
-				if(ELEM3(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_CAMERASOLVER, CONSTRAINT_TYPE_OBJECTSOLVER)) {
+				if (ELEM3(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_CAMERASOLVER, CONSTRAINT_TYPE_OBJECTSOLVER)) {
 					ob->recalc |= OB_RECALC_OB;
 				}
 				else if (cti->get_constraint_targets) {
@@ -2196,33 +2211,33 @@ static void dag_object_time_update_flags(Object *ob)
 		}
 	}
 	
-	if(ob->parent) {
+	if (ob->parent) {
 		/* motion path or bone child */
-		if(ob->parent->type==OB_CURVE || ob->parent->type==OB_ARMATURE) ob->recalc |= OB_RECALC_OB;
+		if (ob->parent->type==OB_CURVE || ob->parent->type==OB_ARMATURE) ob->recalc |= OB_RECALC_OB;
 	}
 	
 #if 0 // XXX old animation system
-	if(ob->nlastrips.first) {
-		if(ob->dup_group) {
+	if (ob->nlastrips.first) {
+		if (ob->dup_group) {
 			bActionStrip *strip;
 			/* this case is for groups with nla, whilst nla target has no action or nla */
-			for(strip= ob->nlastrips.first; strip; strip= strip->next) {
-				if(strip->object)
+			for (strip= ob->nlastrips.first; strip; strip= strip->next) {
+				if (strip->object)
 					strip->object->recalc |= OB_RECALC_ALL;
 			}
 		}
 	}
 #endif // XXX old animation system
 	
-	if(animdata_use_time(ob->adt)) {
+	if (animdata_use_time(ob->adt)) {
 		ob->recalc |= OB_RECALC_OB;
 		ob->adt->recalc |= ADT_RECALC_ANIM;
 	}
 	
-	if((ob->adt) && (ob->type==OB_ARMATURE)) ob->recalc |= OB_RECALC_DATA;
+	if ((ob->adt) && (ob->type==OB_ARMATURE)) ob->recalc |= OB_RECALC_DATA;
 	
-	if(object_modifiers_use_time(ob)) ob->recalc |= OB_RECALC_DATA;
-	if((ob->pose) && (ob->pose->flag & POSE_CONSTRAINTS_TIMEDEPEND)) ob->recalc |= OB_RECALC_DATA;
+	if (object_modifiers_use_time(ob)) ob->recalc |= OB_RECALC_DATA;
+	if ((ob->pose) && (ob->pose->flag & POSE_CONSTRAINTS_TIMEDEPEND)) ob->recalc |= OB_RECALC_DATA;
 	
 	{
 		AnimData *adt= BKE_animdata_from_id((ID *)ob->data);
@@ -2233,51 +2248,51 @@ static void dag_object_time_update_flags(Object *ob)
 		switch(ob->type) {
 			case OB_MESH:
 				me= ob->data;
-				if(me->key) {
-					if(!(ob->shapeflag & OB_SHAPE_LOCK)) {
+				if (me->key) {
+					if (!(ob->shapeflag & OB_SHAPE_LOCK)) {
 						ob->recalc |= OB_RECALC_DATA;
 					}
 				}
-				if(ob->particlesystem.first)
+				if (ob->particlesystem.first)
 					ob->recalc |= OB_RECALC_DATA;
 				break;
 			case OB_CURVE:
 			case OB_SURF:
 				cu= ob->data;
-				if(cu->key) {
-					if(!(ob->shapeflag & OB_SHAPE_LOCK)) {
+				if (cu->key) {
+					if (!(ob->shapeflag & OB_SHAPE_LOCK)) {
 						ob->recalc |= OB_RECALC_DATA;
 					}
 				}
 				break;
 			case OB_FONT:
 				cu= ob->data;
-				if(cu->nurb.first==NULL && cu->str && cu->vfont)
+				if (cu->nurb.first==NULL && cu->str && cu->vfont)
 					ob->recalc |= OB_RECALC_DATA;
 				break;
 			case OB_LATTICE:
 				lt= ob->data;
-				if(lt->key) {
-					if(!(ob->shapeflag & OB_SHAPE_LOCK)) {
+				if (lt->key) {
+					if (!(ob->shapeflag & OB_SHAPE_LOCK)) {
 						ob->recalc |= OB_RECALC_DATA;
 					}
 				}
 					break;
 			case OB_MBALL:
-				if(ob->transflag & OB_DUPLI) ob->recalc |= OB_RECALC_DATA;
+				if (ob->transflag & OB_DUPLI) ob->recalc |= OB_RECALC_DATA;
 				break;
 		}
 		
-		if(animdata_use_time(adt)) {
+		if (animdata_use_time(adt)) {
 			ob->recalc |= OB_RECALC_DATA;
 			adt->recalc |= ADT_RECALC_ANIM;
 		}
 
-		if(ob->particlesystem.first) {
+		if (ob->particlesystem.first) {
 			ParticleSystem *psys= ob->particlesystem.first;
 
-			for(; psys; psys=psys->next) {
-				if(psys_check_enabled(ob, psys)) {
+			for (; psys; psys=psys->next) {
+				if (psys_check_enabled(ob, psys)) {
 					ob->recalc |= OB_RECALC_DATA;
 					break;
 				}
@@ -2285,9 +2300,9 @@ static void dag_object_time_update_flags(Object *ob)
 		}
 	}		
 
-	if(ob->recalc & OB_RECALC_OB)
+	if (ob->recalc & OB_RECALC_OB)
 		lib_id_recalc_tag(G.main, &ob->id);
-	if(ob->recalc & OB_RECALC_DATA)
+	if (ob->recalc & OB_RECALC_DATA)
 		lib_id_recalc_data_tag(G.main, &ob->id);
 
 }
@@ -2302,51 +2317,51 @@ void DAG_scene_update_flags(Main *bmain, Scene *scene, unsigned int lay, const s
 	Scene *sce_iter;
 
 	/* set ob flags where animated systems are */
-	for(SETLOOPER(scene, sce_iter, base)) {
+	for (SETLOOPER(scene, sce_iter, base)) {
 		ob= base->object;
 
-		if(do_time) {
+		if (do_time) {
 			/* now if DagNode were part of base, the node->lay could be checked... */
 			/* we do all now, since the scene_flush checks layers and clears recalc flags even */
 			dag_object_time_update_flags(ob);
 		}
 
 		/* handled in next loop */
-		if(ob->dup_group)
+		if (ob->dup_group)
 			ob->dup_group->id.flag |= LIB_DOIT;
 	}
 
-	if(do_time) {
+	if (do_time) {
 		/* we do groups each once */
-		for(group= bmain->group.first; group; group= group->id.next) {
-			if(group->id.flag & LIB_DOIT) {
-				for(go= group->gobject.first; go; go= go->next) {
+		for (group= bmain->group.first; group; group= group->id.next) {
+			if (group->id.flag & LIB_DOIT) {
+				for (go= group->gobject.first; go; go= go->next) {
 					dag_object_time_update_flags(go->ob);
 				}
 			}
 		}
 	}
 
-	for(sce_iter= scene; sce_iter; sce_iter= sce_iter->set)
+	for (sce_iter= scene; sce_iter; sce_iter= sce_iter->set)
 		DAG_scene_flush_update(bmain, sce_iter, lay, 1);
 	
-	if(do_time) {
+	if (do_time) {
 		/* test: set time flag, to disable baked systems to update */
-		for(SETLOOPER(scene, sce_iter, base)) {
+		for (SETLOOPER(scene, sce_iter, base)) {
 			ob= base->object;
-			if(ob->recalc)
+			if (ob->recalc)
 				ob->recalc |= OB_RECALC_TIME;
 		}
 
 		/* hrmf... an exception to look at once, for invisible camera object we do it over */
-		if(scene->camera)
+		if (scene->camera)
 			dag_object_time_update_flags(scene->camera);
 	}
 
 	/* and store the info in groupobject */
-	for(group= bmain->group.first; group; group= group->id.next) {
-		if(group->id.flag & LIB_DOIT) {
-			for(go= group->gobject.first; go; go= go->next) {
+	for (group= bmain->group.first; group; group= group->id.next) {
+		if (group->id.flag & LIB_DOIT) {
+			for (go= group->gobject.first; go; go= go->next) {
 				go->recalc= go->ob->recalc;
 				// printf("ob %s recalc %d\n", go->ob->id.name, go->recalc);
 			}
@@ -2362,16 +2377,16 @@ static void dag_current_scene_layers(Main *bmain, Scene **sce, unsigned int *lay
 	wmWindow *win;
 
 	/* only one scene supported currently, making more scenes work
-	   correctly requires changes beyond just the dependency graph */
+	 * correctly requires changes beyond just the dependency graph */
 
 	*sce= NULL;
 	*lay= 0;
 
-	if((wm= bmain->wm.first)) {
+	if ((wm= bmain->wm.first)) {
 		/* if we have a windowmanager, look into windows */
-		for(win=wm->windows.first; win; win=win->next) {
-			if(win->screen) {
-				if(!*sce) *sce= win->screen->scene;
+		for (win=wm->windows.first; win; win=win->next) {
+			if (win->screen) {
+				if (!*sce) *sce= win->screen->scene;
 				*lay |= BKE_screen_visible_layers(win->screen, win->screen->scene);
 			}
 		}
@@ -2379,11 +2394,11 @@ static void dag_current_scene_layers(Main *bmain, Scene **sce, unsigned int *lay
 	else {
 		/* if not, use the first sce */
 		*sce= bmain->scene.first;
-		if(*sce) *lay= (*sce)->lay;
+		if (*sce) *lay= (*sce)->lay;
 
 		/* XXX for background mode, we should get the scene
-		   from somewhere, for the -S option, but it's in
-		   the context, how to get it here? */
+		 * from somewhere, for the -S option, but it's in
+		 * the context, how to get it here? */
 	}
 }
 
@@ -2394,7 +2409,7 @@ void DAG_ids_flush_update(Main *bmain, int time)
 
 	dag_current_scene_layers(bmain, &sce, &lay);
 
-	if(sce)
+	if (sce)
 		DAG_scene_flush_update(bmain, sce, lay, time);
 }
 
@@ -2410,33 +2425,33 @@ void DAG_on_visible_update(Main *bmain, const short do_time)
 
 	dag_current_scene_layers(bmain, &scene, &lay);
 
-	if(scene && scene->theDag) {
+	if (scene && scene->theDag) {
 		Scene *sce_iter;
 		/* derivedmeshes and displists are not saved to file so need to be
-		   remade, tag them so they get remade in the scene update loop,
-		   note armature poses or object matrices are preserved and do not
-		   require updates, so we skip those */
+		 * remade, tag them so they get remade in the scene update loop,
+		 * note armature poses or object matrices are preserved and do not
+		 * require updates, so we skip those */
 		dag_scene_flush_layers(scene, lay);
 
-		for(SETLOOPER(scene, sce_iter, base)) {
+		for (SETLOOPER(scene, sce_iter, base)) {
 			ob= base->object;
 			node= (sce_iter->theDag)? dag_get_node(sce_iter->theDag, ob): NULL;
 			oblay= (node)? node->lay: ob->lay;
 
-			if((oblay & lay) & ~scene->lay_updated) {
-				if(ELEM6(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL, OB_LATTICE))
+			if ((oblay & lay) & ~scene->lay_updated) {
+				if (ELEM6(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL, OB_LATTICE))
 					ob->recalc |= OB_RECALC_DATA;
-				if(ob->dup_group) 
+				if (ob->dup_group) 
 					ob->dup_group->id.flag |= LIB_DOIT;
 			}
 		}
 
-		for(group= bmain->group.first; group; group= group->id.next) {
-			if(group->id.flag & LIB_DOIT) {
-				for(go= group->gobject.first; go; go= go->next) {
-					if(ELEM6(go->ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL, OB_LATTICE))
+		for (group= bmain->group.first; group; group= group->id.next) {
+			if (group->id.flag & LIB_DOIT) {
+				for (go= group->gobject.first; go; go= go->next) {
+					if (ELEM6(go->ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL, OB_LATTICE))
 						go->ob->recalc |= OB_RECALC_DATA;
-					if(go->ob->proxy_from)
+					if (go->ob->proxy_from)
 						go->ob->recalc |= OB_RECALC_OB;
 				}
 				
@@ -2457,7 +2472,7 @@ static void dag_id_flush_update__isDependentTexture(void *userData, Object *UNUS
 {
 	struct { ID *id; int is_dependent; } *data = userData;
 	
-	if(*idpoin && GS((*idpoin)->name)==ID_TE) {
+	if (*idpoin && GS((*idpoin)->name)==ID_TE) {
 		if (data->id == (*idpoin))
 			data->is_dependent = 1;
 	}
@@ -2470,19 +2485,19 @@ static void dag_id_flush_update(Scene *sce, ID *id)
 	short idtype;
 
 	/* here we flush a few things before actual scene wide flush, mostly
-	   due to only objects and not other datablocks being in the depsgraph */
+	 * due to only objects and not other datablocks being in the depsgraph */
 
 	/* set flags & pointcache for object */
-	if(GS(id->name) == ID_OB) {
+	if (GS(id->name) == ID_OB) {
 		ob= (Object*)id;
 		BKE_ptcache_object_reset(sce, ob, PTCACHE_RESET_DEPSGRAPH);
 
-		if(ob->recalc & OB_RECALC_DATA) {
+		if (ob->recalc & OB_RECALC_DATA) {
 			/* all users of this ob->data should be checked */
 			id= ob->data;
 
 			/* no point in trying in this cases */
-			if(id && id->us <= 1) {
+			if (id && id->us <= 1) {
 				dag_editors_id_update(bmain, id);
 				id= NULL;
 			}
@@ -2490,12 +2505,12 @@ static void dag_id_flush_update(Scene *sce, ID *id)
 	}
 
 	/* set flags & pointcache for object data */
-	if(id) {
+	if (id) {
 		idtype= GS(id->name);
 
-		if(ELEM8(idtype, ID_ME, ID_CU, ID_MB, ID_LA, ID_LT, ID_CA, ID_AR, ID_SPK)) {
-			for(obt=bmain->object.first; obt; obt= obt->id.next) {
-				if(!(ob && obt == ob) && obt->data == id) {
+		if (ELEM8(idtype, ID_ME, ID_CU, ID_MB, ID_LA, ID_LT, ID_CA, ID_AR, ID_SPK)) {
+			for (obt=bmain->object.first; obt; obt= obt->id.next) {
+				if (!(ob && obt == ob) && obt->data == id) {
 					obt->recalc |= OB_RECALC_DATA;
 					lib_id_recalc_data_tag(bmain, &obt->id);
 					BKE_ptcache_object_reset(sce, obt, PTCACHE_RESET_DEPSGRAPH);
@@ -2504,8 +2519,8 @@ static void dag_id_flush_update(Scene *sce, ID *id)
 		}
 		
 		/* set flags based on textures - can influence depgraph via modifiers */
-		if(idtype == ID_TE) {
-			for(obt=bmain->object.first; obt; obt= obt->id.next) {
+		if (idtype == ID_TE) {
+			for (obt=bmain->object.first; obt; obt= obt->id.next) {
 				struct { ID *id; int is_dependent; } data;
 				data.id= id;
 				data.is_dependent= 0;
@@ -2517,21 +2532,21 @@ static void dag_id_flush_update(Scene *sce, ID *id)
 				}
 
 				/* particle settings can use the texture as well */
-				if(obt->particlesystem.first) {
+				if (obt->particlesystem.first) {
 					ParticleSystem *psys = obt->particlesystem.first;
 					MTex **mtexp, *mtex;
 					int a;
-					for(; psys; psys=psys->next) {
+					for (; psys; psys=psys->next) {
 						mtexp = psys->part->mtex;
-						for(a=0; a<MAX_MTEX; a++, mtexp++) {
+						for (a=0; a<MAX_MTEX; a++, mtexp++) {
 							mtex = *mtexp;
-							if(mtex && mtex->tex == (Tex*)id) {
+							if (mtex && mtex->tex == (Tex*)id) {
 								obt->recalc |= OB_RECALC_DATA;
 								lib_id_recalc_data_tag(bmain, &obt->id);
 
-								if(mtex->mapto & PAMAP_INIT)
+								if (mtex->mapto & PAMAP_INIT)
 									psys->recalc |= PSYS_RECALC_RESET;
-								if(mtex->mapto & PAMAP_CHILD)
+								if (mtex->mapto & PAMAP_CHILD)
 									psys->recalc |= PSYS_RECALC_CHILD;
 
 								BKE_ptcache_object_reset(sce, obt, PTCACHE_RESET_DEPSGRAPH);
@@ -2543,10 +2558,10 @@ static void dag_id_flush_update(Scene *sce, ID *id)
 		}
 		
 		/* set flags based on ShapeKey */
-		if(idtype == ID_KE) {
-			for(obt=bmain->object.first; obt; obt= obt->id.next) {
+		if (idtype == ID_KE) {
+			for (obt=bmain->object.first; obt; obt= obt->id.next) {
 				Key *key= ob_get_key(obt);
-				if(!(ob && obt == ob) && ((ID *)key == id)) {
+				if (!(ob && obt == ob) && ((ID *)key == id)) {
 					obt->flag |= (OB_RECALC_OB|OB_RECALC_DATA);
 					lib_id_recalc_tag(bmain, &obt->id);
 					lib_id_recalc_data_tag(bmain, &obt->id);
@@ -2556,20 +2571,20 @@ static void dag_id_flush_update(Scene *sce, ID *id)
 		}
 		
 		/* set flags based on particle settings */
-		if(idtype == ID_PA) {
+		if (idtype == ID_PA) {
 			ParticleSystem *psys;
-			for(obt=bmain->object.first; obt; obt= obt->id.next)
-				for(psys=obt->particlesystem.first; psys; psys=psys->next)
-					if(&psys->part->id == id)
+			for (obt=bmain->object.first; obt; obt= obt->id.next)
+				for (psys=obt->particlesystem.first; psys; psys=psys->next)
+					if (&psys->part->id == id)
 						BKE_ptcache_object_reset(sce, obt, PTCACHE_RESET_DEPSGRAPH);
 		}
 
-		if(idtype == ID_MC) {
-			for(obt=bmain->object.first; obt; obt= obt->id.next){
+		if (idtype == ID_MC) {
+			for (obt=bmain->object.first; obt; obt= obt->id.next) {
 				bConstraint *con;
 				for (con = obt->constraints.first; con; con=con->next) {
 					bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
-					if(ELEM3(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_CAMERASOLVER,
+					if (ELEM3(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_CAMERASOLVER,
 					         CONSTRAINT_TYPE_OBJECTSOLVER))
 					{
 						obt->recalc |= OB_RECALC_OB;
@@ -2578,11 +2593,11 @@ static void dag_id_flush_update(Scene *sce, ID *id)
 				}
 			}
 
-			if(sce->nodetree) {
+			if (sce->nodetree) {
 				bNode *node;
 
-				for(node= sce->nodetree->nodes.first; node; node= node->next) {
-					if(node->id==id) {
+				for (node= sce->nodetree->nodes.first; node; node= node->next) {
+					if (node->id==id) {
 						nodeUpdate(sce->nodetree, node);
 					}
 				}
@@ -2590,10 +2605,13 @@ static void dag_id_flush_update(Scene *sce, ID *id)
 		}
 
 		/* camera's matrix is used to orient reconstructed stuff,
-		   so it should happen tracking-related constraints recalculation
-		   when camera is changing (sergey) */
-		if(sce->camera && &sce->camera->id == id && object_get_movieclip(sce, sce->camera, 1)) {
-			dag_id_flush_update(sce, &sce->clip->id);
+		 * so it should happen tracking-related constraints recalculation
+		 * when camera is changing (sergey) */
+		if (sce->camera && &sce->camera->id == id) {
+			MovieClip *clip = object_get_movieclip(sce, sce->camera, 1);
+
+			if (clip)
+				dag_id_flush_update(sce, &clip->id);
 		}
 
 		/* update editors */
@@ -2610,21 +2628,21 @@ void DAG_ids_flush_tagged(Main *bmain)
 
 	dag_current_scene_layers(bmain, &sce, &lay);
 
-	if(!sce || !sce->theDag)
+	if (!sce || !sce->theDag)
 		return;
 
 	/* loop over all ID types */
 	a  = set_listbasepointers(bmain, lbarray);
 
-	while(a--) {
+	while (a--) {
 		ListBase *lb = lbarray[a];
 		ID *id = lb->first;
 
 		/* 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) {
-				if(id->flag & (LIB_ID_RECALC|LIB_ID_RECALC_DATA)) {
+		 * 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) {
+				if (id->flag & (LIB_ID_RECALC|LIB_ID_RECALC_DATA)) {
 					dag_id_flush_update(sce, id);
 					do_flush = 1;
 				}
@@ -2633,7 +2651,7 @@ void DAG_ids_flush_tagged(Main *bmain)
 	}
 
 	/* flush changes to other objects */
-	if(do_flush)
+	if (do_flush)
 		DAG_scene_flush_update(bmain, sce, lay, 0);
 }
 
@@ -2645,13 +2663,13 @@ void DAG_ids_check_recalc(Main *bmain, Scene *scene, int time)
 	/* loop over all ID types */
 	a  = set_listbasepointers(bmain, lbarray);
 
-	while(a--) {
+	while (a--) {
 		ListBase *lb = lbarray[a];
 		ID *id = lb->first;
 
 		/* 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]]) {
+		 * looping over all ID's in case there are no tags */
+		if (id && bmain->id_tag_update[id->name[0]]) {
 			updated= 1;
 			break;
 		}
@@ -2668,15 +2686,15 @@ void DAG_ids_clear_recalc(Main *bmain)
 	/* loop over all ID types */
 	a  = set_listbasepointers(bmain, lbarray);
 
-	while(a--) {
+	while (a--) {
 		ListBase *lb = lbarray[a];
 		ID *id = lb->first;
 
 		/* 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)
-				if(id->flag & (LIB_ID_RECALC|LIB_ID_RECALC_DATA))
+		 * 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)
+				if (id->flag & (LIB_ID_RECALC|LIB_ID_RECALC_DATA))
 					id->flag &= ~(LIB_ID_RECALC|LIB_ID_RECALC_DATA);
 		}
 	}
@@ -2688,36 +2706,38 @@ void DAG_id_tag_update(ID *id, short flag)
 {
 	Main *bmain= G.main;
 
-	if(id==NULL) return;
+	if (id==NULL) return;
 	
 	/* tag ID for update */
-	if(flag) {
-		if(flag & OB_RECALC_OB)
+	if (flag) {
+		if (flag & OB_RECALC_OB)
 			lib_id_recalc_tag(bmain, id);
-		if(flag & (OB_RECALC_DATA|PSYS_RECALC))
+		if (flag & (OB_RECALC_DATA|PSYS_RECALC))
 			lib_id_recalc_data_tag(bmain, id);
 	}
 	else
 		lib_id_recalc_tag(bmain, id);
 
 	/* flag is for objects and particle systems */
-	if(flag) {
+	if (flag) {
 		Object *ob;
-		ParticleSystem *psys;
 		short idtype = GS(id->name);
 
-		if(idtype == ID_OB) {
+		if (idtype == ID_OB) {
 			/* only quick tag */
 			ob = (Object*)id;
 			ob->recalc |= (flag & OB_RECALC_ALL);
 		}
-		else if(idtype == ID_PA) {
+		else if (idtype == ID_PA) {
+			ParticleSystem *psys;
 			/* this is weak still, should be done delayed as well */
-			for(ob=bmain->object.first; ob; ob=ob->id.next) {
-				for(psys=ob->particlesystem.first; psys; psys=psys->next) {
-					if(&psys->part->id == id) {
+			for (ob=bmain->object.first; ob; ob=ob->id.next) {
+				for (psys=ob->particlesystem.first; psys; psys=psys->next) {
+					if (&psys->part->id == id) {
 						ob->recalc |= (flag & OB_RECALC_ALL);
 						psys->recalc |= (flag & PSYS_RECALC);
+						lib_id_recalc_tag(bmain, &ob->id);
+						lib_id_recalc_data_tag(bmain, &ob->id);
 					}
 				}
 			}
@@ -2749,20 +2769,20 @@ static int parent_check_node(DagNode *node, int curtime)
 	
 	node->lasttime= curtime;
 	
-	if(node->color==DAG_GRAY)
+	if (node->color==DAG_GRAY)
 		return DAG_GRAY;
 	
-	for(itA = node->child; itA; itA= itA->next) {
-		if(itA->node->type==ID_OB) {
+	for (itA = node->child; itA; itA= itA->next) {
+		if (itA->node->type==ID_OB) {
 			
-			if(itA->node->color==DAG_GRAY)
+			if (itA->node->color==DAG_GRAY)
 				return DAG_GRAY;
 
 			/* descend if not done */
-			if(itA->node->lasttime!=curtime) {
+			if (itA->node->lasttime!=curtime) {
 				itA->node->color= parent_check_node(itA->node, curtime);
 			
-				if(itA->node->color==DAG_GRAY)
+				if (itA->node->color==DAG_GRAY)
 					return DAG_GRAY;
 			}
 		}
@@ -2795,12 +2815,12 @@ void DAG_pose_sort(Object *ob)
 	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) {
+	for (pchan = pose->chanbase.first; pchan; pchan= pchan->next) {
 		int addtoroot = 1;
 		
 		node = dag_get_node(dag, pchan);
 		
-		if(pchan->parent) {
+		if (pchan->parent) {
 			node2 = dag_get_node(dag, pchan->parent);
 			dag_add_relation(dag, node2, node, 0, "Parent Relation");
 			addtoroot = 0;
@@ -2826,7 +2846,7 @@ void DAG_pose_sort(Object *ob)
 								int segcount= 0;
 								
 								/* exclude tip from chain? */
-								if(!(data->flag & CONSTRAINT_IK_TIP))
+								if (!(data->flag & CONSTRAINT_IK_TIP))
 									parchan= pchan->parent;
 								else
 									parchan= pchan;
@@ -2862,20 +2882,20 @@ void DAG_pose_sort(Object *ob)
 	nqueue = queue_create(DAGQUEUEALLOC);
 	
 	/* tag nodes unchecked */
-	for(node = dag->DagNode.first; node; node= node->next) 
+	for (node = dag->DagNode.first; node; node= node->next) 
 		node->color = DAG_WHITE;
 	
 	rootnode->color = DAG_GRAY;
 	push_stack(nqueue, rootnode);  
 	
-	while(nqueue->count) {
+	while (nqueue->count) {
 		
 		skip = 0;
 		node = get_top_node_queue(nqueue);
 		
 		itA = node->child;
-		while(itA != NULL) {
-			if(itA->node->color == DAG_WHITE) {
+		while (itA != NULL) {
+			if (itA->node->color == DAG_WHITE) {
 				itA->node->color = DAG_GRAY;
 				push_stack(nqueue,itA->node);
 				skip = 1;
@@ -2888,7 +2908,7 @@ void DAG_pose_sort(Object *ob)
 			if (node) {
 				node = pop_queue(nqueue);
 				if (node->ob == NULL)	// we are done
-					break ;
+					break;
 				node->color = DAG_BLACK;
 				
 				/* put node in new list */
@@ -2898,8 +2918,8 @@ void DAG_pose_sort(Object *ob)
 		}
 	}
 	
-	// temporal correction for circular dependancies
-	while(pose->chanbase.first) {
+	/* temporal correction for circular dependencies */
+	while (pose->chanbase.first) {
 		pchan= pose->chanbase.first;
 		BLI_remlink(&pose->chanbase, pchan);
 		BLI_addhead(&tempbase, pchan);
@@ -2911,7 +2931,7 @@ void DAG_pose_sort(Object *ob)
 	queue_delete(nqueue);
 	
 //	printf("\nordered\n");
-//	for(pchan = pose->chanbase.first; pchan; pchan= pchan->next) {
+//	for (pchan = pose->chanbase.first; pchan; pchan= pchan->next) {
 //		printf(" %s\n", pchan->name);
 //	}
 	
@@ -2928,7 +2948,7 @@ void DAG_print_dependencies(Main *bmain, Scene *scene, Object *ob)
 	/* utility for debugging dependencies */
 	dag_print_dependencies= 1;
 
-	if(ob && (ob->mode & OB_MODE_POSE)) {
+	if (ob && (ob->mode & OB_MODE_POSE)) {
 		printf("\nDEPENDENCY RELATIONS for %s\n\n", ob->id.name+2);
 		DAG_pose_sort(ob);
 	}
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index b14b9b4..01d5d6e 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -44,7 +44,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
-#include "BLI_editVert.h"
 #include "BLI_scanfill.h"
 #include "BLI_utildefines.h"
 
@@ -63,19 +62,17 @@
 
 #include "BLO_sys_types.h" // for intptr_t support
 
-extern Material defmaterial;	/* material.c */
-
 static void boundbox_displist(Object *ob);
 
 void free_disp_elem(DispList *dl)
 {
-	if(dl) {
-		if(dl->verts) MEM_freeN(dl->verts);
-		if(dl->nors) MEM_freeN(dl->nors);
-		if(dl->index) MEM_freeN(dl->index);
-		if(dl->col1) MEM_freeN(dl->col1);
-		if(dl->col2) MEM_freeN(dl->col2);
-		if(dl->bevelSplitFlag) MEM_freeN(dl->bevelSplitFlag);
+	if (dl) {
+		if (dl->verts) MEM_freeN(dl->verts);
+		if (dl->nors) MEM_freeN(dl->nors);
+		if (dl->index) MEM_freeN(dl->index);
+		if (dl->col1) MEM_freeN(dl->col1);
+		if (dl->col2) MEM_freeN(dl->col2);
+		if (dl->bevelSplitFlag) MEM_freeN(dl->bevelSplitFlag);
 		MEM_freeN(dl);
 	}
 }
@@ -85,7 +82,7 @@ void freedisplist(ListBase *lb)
 	DispList *dl;
 
 	dl= lb->first;
-	while(dl) {
+	while (dl) {
 		BLI_remlink(lb, dl);
 		free_disp_elem(dl);
 		dl= lb->first;
@@ -97,8 +94,8 @@ DispList *find_displist_create(ListBase *lb, int type)
 	DispList *dl;
 	
 	dl= lb->first;
-	while(dl) {
-		if(dl->type==type) return dl;
+	while (dl) {
+		if (dl->type==type) return dl;
 		dl= dl->next;
 	}
 
@@ -114,8 +111,8 @@ DispList *find_displist(ListBase *lb, int type)
 	DispList *dl;
 	
 	dl= lb->first;
-	while(dl) {
-		if(dl->type==type) return dl;
+	while (dl) {
+		if (dl->type==type) return dl;
 		dl= dl->next;
 	}
 
@@ -125,9 +122,10 @@ DispList *find_displist(ListBase *lb, int type)
 int displist_has_faces(ListBase *lb)
 {
 	DispList *dl;
-	for(dl= lb->first; dl; dl= dl->next) {
-		if ELEM3(dl->type, DL_INDEX3, DL_INDEX4, DL_SURF)
+	for (dl= lb->first; dl; dl= dl->next) {
+		if (ELEM3(dl->type, DL_INDEX3, DL_INDEX4, DL_SURF)) {
 			return 1;
+		}
 	}
 	return 0;
 }
@@ -139,7 +137,7 @@ void copy_displist(ListBase *lbn, ListBase *lb)
 	freedisplist(lbn);
 	
 	dl= lb->first;
-	while(dl) {
+	while (dl) {
 		
 		dln= MEM_dupallocN(dl);
 		BLI_addtail(lbn, dln);
@@ -149,7 +147,7 @@ void copy_displist(ListBase *lbn, ListBase *lb)
 		dln->col1= MEM_dupallocN(dl->col1);
 		dln->col2= MEM_dupallocN(dl->col2);
 
-		if(dl->bevelSplitFlag)
+		if (dl->bevelSplitFlag)
 			dln->bevelSplitFlag= MEM_dupallocN(dl->bevelSplitFlag);
 
 		dl= dl->next;
@@ -167,22 +165,22 @@ void addnormalsDispList(ListBase *lb)
 
 	dl= lb->first;
 	
-	while(dl) {
-		if(dl->type==DL_INDEX3) {
-			if(dl->nors==NULL) {
+	while (dl) {
+		if (dl->type==DL_INDEX3) {
+			if (dl->nors==NULL) {
 				dl->nors= MEM_callocN(sizeof(float)*3, "dlnors");
-				if(dl->verts[2] < 0.0f) dl->nors[2]= -1.0f;
+				if (dl->verts[2] < 0.0f) dl->nors[2]= -1.0f;
 				else dl->nors[2]= 1.0f;
 			}
 		}
-		else if(dl->type==DL_SURF) {
-			if(dl->nors==NULL) {
+		else if (dl->type==DL_SURF) {
+			if (dl->nors==NULL) {
 				dl->nors= MEM_callocN(sizeof(float)*3*dl->nr*dl->parts, "dlnors");
 				
 				vdata= dl->verts;
 				ndata= dl->nors;
 				
-				for(a=0; a<dl->parts; a++) {
+				for (a=0; a<dl->parts; a++) {
 					
 					if (surfindex_displist(dl, a, &b, &p1, &p2, &p3, &p4)==0)
 						break;
@@ -196,7 +194,7 @@ void addnormalsDispList(ListBase *lb)
 					v4= vdata+ 3*p4; 
 					n4= ndata+ 3*p4;
 					
-					for(; b<dl->nr; b++) {
+					for (; b<dl->nr; b++) {
 	
 						normal_quad_v3( nor,v1, v3, v4, v2);
 	
@@ -213,7 +211,7 @@ void addnormalsDispList(ListBase *lb)
 				}
 				a= dl->parts*dl->nr;
 				v1= ndata;
-				while(a--) {
+				while (a--) {
 					normalize_v3(v1);
 					v1+= 3;
 				}
@@ -228,7 +226,7 @@ void count_displist(ListBase *lb, int *totvert, int *totface)
 	DispList *dl;
 	
 	dl= lb->first;
-	while(dl) {
+	while (dl) {
 		
 		switch(dl->type) {
 			case DL_SURF:
@@ -251,17 +249,18 @@ void count_displist(ListBase *lb, int *totvert, int *totface)
 
 int surfindex_displist(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, int *p4)
 {
-	if((dl->flag & DL_CYCL_V)==0 && a==(dl->parts)-1) {
+	if ((dl->flag & DL_CYCL_V)==0 && a==(dl->parts)-1) {
 		return 0;
 	}
 	
-	if(dl->flag & DL_CYCL_U) {
+	if (dl->flag & DL_CYCL_U) {
 		(*p1)= dl->nr*a;
 		(*p2)= (*p1)+ dl->nr-1;
 		(*p3)= (*p1)+ dl->nr;
 		(*p4)= (*p2)+ dl->nr;
 		(*b)= 0;
-	} else {
+	}
+	else {
 		(*p2)= dl->nr*a;
 		(*p1)= (*p2)+1;
 		(*p4)= (*p2)+ dl->nr;
@@ -269,7 +268,7 @@ int surfindex_displist(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, i
 		(*b)= 1;
 	}
 	
-	if( (dl->flag & DL_CYCL_V) && a==dl->parts-1) {
+	if ( (dl->flag & DL_CYCL_V) && a==dl->parts-1) {
 		(*p3)-= dl->nr*dl->parts;
 		(*p4)-= dl->nr*dl->parts;
 	}
@@ -289,31 +288,31 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
 	int a, len, resolu;
 	
 	nu= nubase->first;
-	while(nu) {
-		if(nu->hide==0) {
+	while (nu) {
+		if (nu->hide==0) {
 			
-			if(forRender && cu->resolu_ren!=0)
+			if (forRender && cu->resolu_ren!=0)
 				resolu= cu->resolu_ren;
 			else
 				resolu= nu->resolu;
 			
-			if(!check_valid_nurb_u(nu));
-			else if(nu->type == CU_BEZIER) {
+			if (!check_valid_nurb_u(nu));
+			else if (nu->type == CU_BEZIER) {
 				
 				/* count */
 				len= 0;
 				a= nu->pntsu-1;
-				if(nu->flagu & CU_NURB_CYCLIC) a++;
+				if (nu->flagu & CU_NURB_CYCLIC) a++;
 
 				prevbezt= nu->bezt;
 				bezt= prevbezt+1;
-				while(a--) {
-					if(a==0 && (nu->flagu & CU_NURB_CYCLIC)) bezt= nu->bezt;
+				while (a--) {
+					if (a==0 && (nu->flagu & CU_NURB_CYCLIC)) bezt= nu->bezt;
 					
-					if(prevbezt->h2==HD_VECT && bezt->h1==HD_VECT) len++;
+					if (prevbezt->h2==HD_VECT && bezt->h1==HD_VECT) len++;
 					else len+= resolu;
 					
-					if(a==0 && (nu->flagu & CU_NURB_CYCLIC)==0) len++;
+					if (a==0 && (nu->flagu & CU_NURB_CYCLIC)==0) len++;
 					
 					prevbezt= bezt;
 					bezt++;
@@ -330,7 +329,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
 
 				data= dl->verts;
 
-				if(nu->flagu & CU_NURB_CYCLIC) {
+				if (nu->flagu & CU_NURB_CYCLIC) {
 					dl->type= DL_POLY;
 					a= nu->pntsu;
 				}
@@ -342,16 +341,16 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
 				prevbezt= nu->bezt;
 				bezt= prevbezt+1;
 				
-				while(a--) {
-					if(a==0 && dl->type== DL_POLY) bezt= nu->bezt;
+				while (a--) {
+					if (a==0 && dl->type== DL_POLY) bezt= nu->bezt;
 					
-					if(prevbezt->h2==HD_VECT && bezt->h1==HD_VECT) {
+					if (prevbezt->h2==HD_VECT && bezt->h1==HD_VECT) {
 						copy_v3_v3(data, prevbezt->vec[1]);
 						data+= 3;
 					}
 					else {
 						int j;
-						for(j=0; j<3; j++) {
+						for (j=0; j<3; j++) {
 							forward_diff_bezier(	prevbezt->vec[1][j],
 													prevbezt->vec[2][j],
 													bezt->vec[0][j],
@@ -362,7 +361,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
 						data+= 3*resolu;
 					}
 					
-					if(a==0 && dl->type==DL_SEGM) {
+					if (a==0 && dl->type==DL_SEGM) {
 						copy_v3_v3(data, bezt->vec[1]);
 					}
 					
@@ -370,7 +369,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
 					bezt++;
 				}
 			}
-			else if(nu->type == CU_NURBS) {
+			else if (nu->type == CU_NURBS) {
 				len= (resolu*SEGMENTSU(nu));
 				
 				dl= MEM_callocN(sizeof(DispList), "makeDispListsurf");
@@ -383,11 +382,11 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
 				dl->charidx = nu->charidx;
 
 				data= dl->verts;
-				if(nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY;
+				if (nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY;
 				else dl->type= DL_SEGM;
 				makeNurbcurve(nu, data, NULL, NULL, NULL, resolu, 3*sizeof(float));
 			}
-			else if(nu->type == CU_POLY) {
+			else if (nu->type == CU_POLY) {
 				len= nu->pntsu;
 				dl= MEM_callocN(sizeof(DispList), "makeDispListpoly");
 				dl->verts= MEM_callocN(len*3*sizeof(float), "dlverts");
@@ -398,12 +397,12 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
 				dl->charidx = nu->charidx;
 
 				data= dl->verts;
-				if(nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY;
+				if (nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY;
 				else dl->type= DL_SEGM;
 				
 				a= len;
 				bp= nu->bp;
-				while(a--) {
+				while (a--) {
 					copy_v3_v3(data, bp->vec);
 					bp++;
 					data+= 3;
@@ -417,50 +416,54 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
 
 void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
 {
-	EditVert *eve, *v1, *vlast;
-	EditFace *efa;
+	ScanFillContext sf_ctx;
+	ScanFillVert *eve, *v1, *vlast;
+	ScanFillFace *efa;
 	DispList *dlnew=NULL, *dl;
 	float *f1;
 	int colnr=0, charidx=0, cont=1, tot, a, *index, nextcol= 0;
 	intptr_t totvert;
 	
-	if(dispbase==NULL) return;
-	if(dispbase->first==NULL) return;
+	if (dispbase==NULL) return;
+	if (dispbase->first==NULL) return;
 
-	while(cont) {
+	while (cont) {
 		cont= 0;
 		totvert= 0;
 		nextcol= 0;
 		
+		BLI_begin_edgefill(&sf_ctx);
+		
 		dl= dispbase->first;
-		while(dl) {
+		while (dl) {
 	
-			if(dl->type==DL_POLY) {
-				if(charidx<dl->charidx) cont= 1;
-				else if(charidx==dl->charidx) { /* character with needed index */
-					if(colnr==dl->col) {
+			if (dl->type==DL_POLY) {
+				if (charidx<dl->charidx) cont= 1;
+				else if (charidx==dl->charidx) { /* character with needed index */
+					if (colnr==dl->col) {
 						/* make editverts and edges */
 						f1= dl->verts;
 						a= dl->nr;
 						eve= v1= NULL;
 						
-						while(a--) {
+						while (a--) {
 							vlast= eve;
 
-							eve= BLI_addfillvert(f1);
+							eve = BLI_addfillvert(&sf_ctx, f1);
 							totvert++;
 
-							if(vlast==NULL) v1= eve;
+							if (vlast==NULL) v1= eve;
 							else {
-								BLI_addfilledge(vlast, eve);
+								BLI_addfilledge(&sf_ctx, vlast, eve);
 							}
 							f1+=3;
 						}
 
-						if(eve!=NULL && v1!=NULL) {
-							BLI_addfilledge(eve, v1);
+						if (eve!=NULL && v1!=NULL) {
+							BLI_addfilledge(&sf_ctx, eve, v1);
 						}
-					} else if (colnr<dl->col) {
+					}
+					else if (colnr<dl->col) {
 						/* got poly with next material at current char */
 						cont= 1;
 						nextcol= 1;
@@ -470,8 +473,8 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
 			dl= dl->next;
 		}
 		
-		if(totvert && (tot= BLI_edgefill(0))) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) {
-			if(tot) {
+		if (totvert && (tot= BLI_edgefill(&sf_ctx, FALSE))) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) {
+			if (tot) {
 				dlnew= MEM_callocN(sizeof(DispList), "filldisplist");
 				dlnew->type= DL_INDEX3;
 				dlnew->col= colnr;
@@ -484,8 +487,8 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
 				/* vert data */
 				f1= dlnew->verts;
 				totvert= 0;
-				eve= fillvertbase.first;
-				while(eve) {
+				eve= sf_ctx.fillvertbase.first;
+				while (eve) {
 					copy_v3_v3(f1, eve->co);
 					f1+= 3;
 	
@@ -497,14 +500,14 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
 				}
 				
 				/* index data */
-				efa= fillfacebase.first;
+				efa = sf_ctx.fillfacebase.first;
 				index= dlnew->index;
-				while(efa) {
+				while (efa) {
 					index[0]= (intptr_t)efa->v1->tmp.l;
 					index[1]= (intptr_t)efa->v2->tmp.l;
 					index[2]= (intptr_t)efa->v3->tmp.l;
 
-					if(flipnormal)
+					if (flipnormal)
 						SWAP(int, index[0], index[2]);
 					
 					index+= 3;
@@ -515,12 +518,13 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
 			BLI_addhead(to, dlnew);
 			
 		}
-		BLI_end_edgefill();
+		BLI_end_edgefill(&sf_ctx);
 
-		if(nextcol) {
+		if (nextcol) {
 			/* stay at current char but fill polys with next material */
 			colnr++;
-		} else {
+		}
+		else {
 			/* switch to next char and start filling from first material */
 			charidx++;
 			colnr= 0;
@@ -541,10 +545,10 @@ static void bevels_to_filledpoly(Curve *cu, ListBase *dispbase)
 	front.first= front.last= back.first= back.last= NULL;
 	
 	dl= dispbase->first;
-	while(dl) {
-		if(dl->type==DL_SURF) {
-			if( (dl->flag & DL_CYCL_V) && (dl->flag & DL_CYCL_U)==0 ) {
-				if( (cu->flag & CU_BACK) && (dl->flag & DL_BACK_CURVE) ) {
+	while (dl) {
+		if (dl->type==DL_SURF) {
+			if ( (dl->flag & DL_CYCL_V) && (dl->flag & DL_CYCL_U)==0 ) {
+				if ( (cu->flag & CU_BACK) && (dl->flag & DL_BACK_CURVE) ) {
 					dlnew= MEM_callocN(sizeof(DispList), "filldisp");
 					BLI_addtail(&front, dlnew);
 					dlnew->verts= fp1= MEM_mallocN(sizeof(float)*3*dl->parts, "filldisp1");
@@ -558,13 +562,13 @@ static void bevels_to_filledpoly(Curve *cu, ListBase *dispbase)
 					dpoly= 3*dl->nr;
 					
 					a= dl->parts;
-					while(a--) {
+					while (a--) {
 						copy_v3_v3(fp1, fp);
 						fp1+= 3;
 						fp+= dpoly;
 					}
 				}
-				if( (cu->flag & CU_FRONT) && (dl->flag & DL_FRONT_CURVE) ) {
+				if ( (cu->flag & CU_FRONT) && (dl->flag & DL_FRONT_CURVE) ) {
 					dlnew= MEM_callocN(sizeof(DispList), "filldisp");
 					BLI_addtail(&back, dlnew);
 					dlnew->verts= fp1= MEM_mallocN(sizeof(float)*3*dl->parts, "filldisp1");
@@ -578,7 +582,7 @@ static void bevels_to_filledpoly(Curve *cu, ListBase *dispbase)
 					dpoly= 3*dl->nr;
 					
 					a= dl->parts;
-					while(a--) {
+					while (a--) {
 						copy_v3_v3(fp1, fp);
 						fp1+= 3;
 						fp+= dpoly;
@@ -601,9 +605,9 @@ static void bevels_to_filledpoly(Curve *cu, ListBase *dispbase)
 
 static void curve_to_filledpoly(Curve *cu, ListBase *UNUSED(nurb), ListBase *dispbase)
 {
-	if(cu->flag & CU_3D) return;
+	if (cu->flag & CU_3D) return;
 
-	if(dispbase->first && ((DispList*) dispbase->first)->type==DL_SURF) {
+	if (dispbase->first && ((DispList*) dispbase->first)->type==DL_SURF) {
 		bevels_to_filledpoly(cu, dispbase);
 	}
 	else {
@@ -612,22 +616,22 @@ static void curve_to_filledpoly(Curve *cu, ListBase *UNUSED(nurb), ListBase *dis
 }
 
 /* taper rules:
-  - only 1 curve
-  - first point left, last point right
-  - based on subdivided points in original curve, not on points in taper curve (still)
-*/
+ * - only 1 curve
+ * - first point left, last point right
+ * - based on subdivided points in original curve, not on points in taper curve (still)
+ */
 float calc_taper(Scene *scene, Object *taperobj, int cur, int tot)
 {
 	DispList *dl;
 	
-	if(taperobj==NULL || taperobj->type!=OB_CURVE) return 1.0;
+	if (taperobj==NULL || taperobj->type!=OB_CURVE) return 1.0;
 	
 	dl= taperobj->disp.first;
-	if(dl==NULL) {
+	if (dl==NULL) {
 		makeDispListCurveTypes(scene, taperobj, 0);
 		dl= taperobj->disp.first;
 	}
-	if(dl) {
+	if (dl) {
 		float fac= ((float)cur)/(float)(tot-1);
 		float minx, dx, *fp;
 		int a;
@@ -635,16 +639,16 @@ float calc_taper(Scene *scene, Object *taperobj, int cur, int tot)
 		/* horizontal size */
 		minx= dl->verts[0];
 		dx= dl->verts[3*(dl->nr-1)] - minx;
-		if(dx > 0.0f) {
+		if (dx > 0.0f) {
 		
 			fp= dl->verts;
-			for(a=0; a<dl->nr; a++, fp+=3) {
-				if( (fp[0]-minx)/dx >= fac) {
+			for (a=0; a<dl->nr; a++, fp+=3) {
+				if ( (fp[0]-minx)/dx >= fac) {
 					/* interpolate with prev */
-					if(a>0) {
+					if (a>0) {
 						float fac1= (fp[-3]-minx)/dx;
 						float fac2= (fp[0]-minx)/dx;
-						if(fac1!=fac2)
+						if (fac1!=fac2)
 							return fp[1]*(fac1-fac)/(fac1-fac2) + fp[-2]*(fac-fac2)/(fac1-fac2);
 					}
 					return fp[1];
@@ -659,16 +663,16 @@ float calc_taper(Scene *scene, Object *taperobj, int cur, int tot)
 
 void makeDispListMBall(Scene *scene, Object *ob)
 {
-	if(!ob || ob->type!=OB_MBALL) return;
+	if (!ob || ob->type!=OB_MBALL) return;
 
 	// XXX: mball stuff uses plenty of global variables
 	//      while this is unchanged updating during render is unsafe
-	if(G.rendering) return;
+	if (G.rendering) return;
 
 	freedisplist(&(ob->disp));
 
-	if(ob->type==OB_MBALL) {
-		if(ob==find_basis_mball(scene, ob)) {
+	if (ob->type==OB_MBALL) {
+		if (ob==find_basis_mball(scene, ob)) {
 			metaball_polygonize(scene, ob, &ob->disp);
 			tex_space_mball(ob);
 
@@ -687,43 +691,44 @@ void makeDispListMBall_forRender(Scene *scene, Object *ob, ListBase *dispbase)
 	object_deform_mball(ob, dispbase);
 }
 
-static ModifierData *curve_get_tesselate_point(Scene *scene, Object *ob, int forRender, int editmode)
+static ModifierData *curve_get_tessellate_point(Scene *scene, Object *ob, int forRender, int editmode)
 {
 	ModifierData *md = modifiers_getVirtualModifierList(ob);
-	ModifierData *preTesselatePoint;
+	ModifierData *pretessellatePoint;
 	int required_mode;
 
-	if(forRender) required_mode = eModifierMode_Render;
+	if (forRender) required_mode = eModifierMode_Render;
 	else required_mode = eModifierMode_Realtime;
 
-	if(editmode) required_mode |= eModifierMode_Editmode;
+	if (editmode) required_mode |= eModifierMode_Editmode;
 
-	preTesselatePoint = NULL;
+	pretessellatePoint = NULL;
 	for (; md; md=md->next) {
 		ModifierTypeInfo *mti = modifierType_getInfo(md->type);
 
 		if (!modifier_isEnabled(scene, md, required_mode)) continue;
-		if (mti->type == eModifierTypeType_Constructive) return preTesselatePoint;
+		if (mti->type == eModifierTypeType_Constructive) return pretessellatePoint;
 
 		if (ELEM3(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) {
-			preTesselatePoint = md;
+			pretessellatePoint = md;
 
-			/* this modifiers are moving point of tesselation automatically
-			   (some of them even can't be applied on tesselated curve), set flag
-			   for incformation button in modifier's header */
+			/* this modifiers are moving point of tessellation automatically
+			 * (some of them even can't be applied on tessellated curve), set flag
+			 * for incformation button in modifier's header */
 			md->mode |= eModifierMode_ApplyOnSpline;
-		} else if(md->mode&eModifierMode_ApplyOnSpline) {
-			preTesselatePoint = md;
+		}
+		else if (md->mode&eModifierMode_ApplyOnSpline) {
+			pretessellatePoint = md;
 		}
 	}
 
-	return preTesselatePoint;
+	return pretessellatePoint;
 }
 
 static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, float (**originalVerts_r)[3], float (**deformedVerts_r)[3], int *numVerts_r)
 {
 	ModifierData *md = modifiers_getVirtualModifierList(ob);
-	ModifierData *preTesselatePoint;
+	ModifierData *pretessellatePoint;
 	Curve *cu= ob->data;
 	ListBase *nurb= BKE_curve_nurbs(cu);
 	int numVerts = 0;
@@ -733,27 +738,28 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl
 	float *keyVerts= NULL;
 	int required_mode;
 
-	if(forRender) required_mode = eModifierMode_Render;
+	if (forRender) required_mode = eModifierMode_Render;
 	else required_mode = eModifierMode_Realtime;
 
-	preTesselatePoint = curve_get_tesselate_point(scene, ob, forRender, editmode);
+	pretessellatePoint = curve_get_tessellate_point(scene, ob, forRender, editmode);
 	
-	if(editmode) required_mode |= eModifierMode_Editmode;
+	if (editmode) required_mode |= eModifierMode_Editmode;
 
-	if(cu->editnurb==NULL) {
+	if (cu->editnurb==NULL) {
 		keyVerts= do_ob_key(scene, ob);
 
-		if(keyVerts) {
+		if (keyVerts) {
 			/* split coords from key data, the latter also includes
-			   tilts, which is passed through in the modifier stack.
-			   this is also the reason curves do not use a virtual
-			   shape key modifier yet. */
+			 * tilts, which is passed through in the modifier stack.
+			 * this is also the reason curves do not use a virtual
+			 * shape key modifier yet. */
 			deformedVerts= curve_getKeyVertexCos(cu, nurb, keyVerts);
 			originalVerts= MEM_dupallocN(deformedVerts);
+			numVerts = count_curveverts_without_handles(nurb);
 		}
 	}
 	
-	if (preTesselatePoint) {
+	if (pretessellatePoint) {
 		for (; md; md=md->next) {
 			ModifierTypeInfo *mti = modifierType_getInfo(md->type);
 
@@ -770,7 +776,7 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl
 
 			mti->deformVerts(md, ob, NULL, deformedVerts, numVerts, forRender, editmode);
 
-			if (md==preTesselatePoint)
+			if (md==pretessellatePoint)
 				break;
 		}
 	}
@@ -780,7 +786,7 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl
 	if (keyVerts) /* these are not passed through modifier stack */
 		curve_applyKeyVertexTilts(cu, nurb, keyVerts);
 
-	if(keyVerts)
+	if (keyVerts)
 		MEM_freeN(keyVerts);
 
 	*originalVerts_r = originalVerts;
@@ -826,7 +832,7 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
 	DerivedMesh **derivedFinal, int forRender, float (*originalVerts)[3], float (*deformedVerts)[3])
 {
 	ModifierData *md = modifiers_getVirtualModifierList(ob);
-	ModifierData *preTesselatePoint;
+	ModifierData *pretessellatePoint;
 	Curve *cu= ob->data;
 	ListBase *nurb= BKE_curve_nurbs(cu);
 	int required_mode = 0, totvert = 0;
@@ -835,15 +841,15 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
 	float (*vertCos)[3] = NULL;
 	int useCache = !forRender;
 
-	if(forRender) required_mode = eModifierMode_Render;
+	if (forRender) required_mode = eModifierMode_Render;
 	else required_mode = eModifierMode_Realtime;
 
-	preTesselatePoint = curve_get_tesselate_point(scene, ob, forRender, editmode);
+	pretessellatePoint = curve_get_tessellate_point(scene, ob, forRender, editmode);
 	
-	if(editmode) required_mode |= eModifierMode_Editmode;
+	if (editmode) required_mode |= eModifierMode_Editmode;
 
-	if (preTesselatePoint) {
-		md = preTesselatePoint->next;
+	if (pretessellatePoint) {
+		md = pretessellatePoint->next;
 	}
 
 	if (derivedFinal && *derivedFinal) {
@@ -868,14 +874,16 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
 				}
 
 				mti->deformVerts(md, ob, dm, vertCos, totvert, forRender, editmode);
-			} else {
+			}
+			else {
 				if (!vertCos) {
 					vertCos= displist_get_allverts(dispbase, &totvert);
 				}
 
 				mti->deformVerts(md, ob, NULL, vertCos, totvert, forRender, editmode);
 			}
-		} else {
+		}
+		else {
 			if (!derivedFinal) {
 				/* makeDisplistCurveTypes could be used for beveling, where derived mesh */
 				/* is totally unnecessary, so we could stop modifiers applying */
@@ -890,9 +898,10 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
 					dm = tdm;
 
 					CDDM_apply_vert_coords(dm, vertCos);
-					CDDM_calc_normals(dm);
+					CDDM_calc_normals_mapping(dm);
 				}
-			} else {
+			}
+			else {
 				if (vertCos) {
 					displist_apply_allverts(dispbase, vertCos);
 				}
@@ -903,7 +912,7 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
 
 				dm= CDDM_from_curve_customDB(ob, dispbase);
 
-				CDDM_calc_normals(dm);
+				CDDM_calc_normals_mapping(dm);
 			}
 
 			if (vertCos) {
@@ -931,9 +940,10 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
 			dm = tdm;
 
 			CDDM_apply_vert_coords(dm, vertCos);
-			CDDM_calc_normals(dm);
+			CDDM_calc_normals_mapping(dm);
 			MEM_freeN(vertCos);
-		} else {
+		}
+		else {
 			displist_apply_allverts(dispbase, vertCos);
 			MEM_freeN(vertCos);
 			vertCos= NULL;
@@ -941,6 +951,7 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
 	}
 
 	if (derivedFinal) {
+		if (dm) DM_ensure_tessface(dm); /* needed for drawing */
 		(*derivedFinal) = dm;
 	}
 
@@ -960,12 +971,12 @@ static void displist_surf_indices(DispList *dl)
 	
 	index=dl->index= MEM_mallocN( 4*sizeof(int)*(dl->parts+1)*(dl->nr+1), "index array nurbs");
 	
-	for(a=0; a<dl->parts; a++) {
+	for (a=0; a<dl->parts; a++) {
 		
 		if (surfindex_displist(dl, a, &b, &p1, &p2, &p3, &p4)==0)
 			break;
 		
-		for(; b<dl->nr; b++, index+=4) {	
+		for (; b<dl->nr; b++, index+=4) {	
 			index[0]= p1;
 			index[1]= p2;
 			index[2]= p4;
@@ -1003,10 +1014,10 @@ static void add_orco_dm(Scene *scene, Object *ob, DerivedMesh *dm, DerivedMesh *
 
 	totvert= dm->getNumVerts(dm);
 
-	if(orcodm) {
+	if (orcodm) {
 		orco= MEM_callocN(sizeof(float)*3*totvert, "dm orco");
 
-		if(orcodm->getNumVerts(orcodm) == totvert)
+		if (orcodm->getNumVerts(orcodm) == totvert)
 			orcodm->getVertCos(orcodm, orco);
 		else
 			dm->getVertCos(dm, orco);
@@ -1015,14 +1026,14 @@ static void add_orco_dm(Scene *scene, Object *ob, DerivedMesh *dm, DerivedMesh *
 		orco= (float(*)[3])make_orco_curve(scene, ob);
 	}
 
-	for(a=0; a<totvert; a++) {
+	for (a=0; a<totvert; a++) {
 		float *co = orco[a];
 		co[0] = (co[0]-cu->loc[0])/cu->size[0];
 		co[1] = (co[1]-cu->loc[1])/cu->size[1];
 		co[2] = (co[2]-cu->loc[2])/cu->size[2];
 	}
 
-	if((layerorco = DM_get_vert_data_layer(dm, CD_ORCO))) {
+	if ((layerorco = DM_get_vert_data_layer(dm, CD_ORCO))) {
 		memcpy(layerorco, orco, sizeof(float)*totvert);
 		MEM_freeN(orco);
 	}
@@ -1036,21 +1047,21 @@ static void curve_calc_orcodm(Scene *scene, Object *ob, DerivedMesh *derivedFina
 	/* for displist-based objects */
 
 	ModifierData *md = modifiers_getVirtualModifierList(ob);
-	ModifierData *preTesselatePoint;
+	ModifierData *pretessellatePoint;
 	Curve *cu= ob->data;
 	int required_mode;
 	int editmode = (!forRender && cu->editnurb);
 	DerivedMesh *ndm, *orcodm= NULL;
 
-	if(forRender) required_mode = eModifierMode_Render;
+	if (forRender) required_mode = eModifierMode_Render;
 	else required_mode = eModifierMode_Realtime;
 
-	preTesselatePoint = curve_get_tesselate_point(scene, ob, forRender, editmode);
+	pretessellatePoint = curve_get_tessellate_point(scene, ob, forRender, editmode);
 
-	if(editmode) required_mode |= eModifierMode_Editmode;
+	if (editmode) required_mode |= eModifierMode_Editmode;
 
-	if (preTesselatePoint) {
-		md = preTesselatePoint->next;
+	if (pretessellatePoint) {
+		md = pretessellatePoint->next;
 	}
 
 	for (; md; md=md->next) {
@@ -1062,14 +1073,14 @@ static void curve_calc_orcodm(Scene *scene, Object *ob, DerivedMesh *derivedFina
 		if (mti->isDisabled && mti->isDisabled(md, forRender)) continue;
 		if (mti->type!=eModifierTypeType_Constructive) continue;
 
-		if(!orcodm)
+		if (!orcodm)
 			orcodm= create_orco_dm(scene, ob);
 
 		ndm = mti->applyModifier(md, ob, orcodm, forRender, 0);
 
-		if(ndm) {
+		if (ndm) {
 			/* if the modifier returned a new dm, release the old one */
-			if(orcodm && orcodm != ndm) {
+			if (orcodm && orcodm != ndm) {
 				orcodm->release(orcodm);
 			}
 			orcodm = ndm;
@@ -1079,7 +1090,7 @@ static void curve_calc_orcodm(Scene *scene, Object *ob, DerivedMesh *derivedFina
 	/* add an orco layer if needed */
 	add_orco_dm(scene, ob, derivedFinal, orcodm);
 
-	if(orcodm)
+	if (orcodm)
 		orcodm->release(orcodm);
 }
 
@@ -1096,24 +1107,24 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
 	float (*originalVerts)[3];
 	float (*deformedVerts)[3];
 
-	if(!forRender && cu->editnurb)
+	if (!forRender && cu->editnurb)
 		nubase= curve_editnurbs(cu);
 	else
 		nubase= &cu->nurb;
 
-	if(!forOrco)
+	if (!forOrco)
 		curve_calc_modifiers_pre(scene, ob, forRender, &originalVerts, &deformedVerts, &numVerts);
 
 	for (nu=nubase->first; nu; nu=nu->next) {
-		if(forRender || nu->hide==0) {
+		if (forRender || nu->hide==0) {
 			int resolu= nu->resolu, resolv= nu->resolv;
 
-			if(forRender){
-				if(cu->resolu_ren) resolu= cu->resolu_ren;
-				if(cu->resolv_ren) resolv= cu->resolv_ren;
+			if (forRender) {
+				if (cu->resolu_ren) resolu= cu->resolu_ren;
+				if (cu->resolv_ren) resolv= cu->resolv_ren;
 			}
 
-			if(nu->pntsv==1) {
+			if (nu->pntsv==1) {
 				len= SEGMENTSU(nu)*resolu;
 
 				dl= MEM_callocN(sizeof(DispList), "makeDispListsurf");
@@ -1130,7 +1141,7 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
 				dl->rt= nu->flag & ~CU_2D;
 
 				data= dl->verts;
-				if(nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY;
+				if (nu->flagu & CU_NURB_CYCLIC) dl->type= DL_POLY;
 				else dl->type= DL_SEGM;
 
 				makeNurbcurve(nu, data, NULL, NULL, NULL, resolu, 3*sizeof(float));
@@ -1154,8 +1165,8 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
 
 				dl->parts= (nu->pntsu*resolu);	/* in reverse, because makeNurbfaces works that way */
 				dl->nr= (nu->pntsv*resolv);
-				if(nu->flagv & CU_NURB_CYCLIC) dl->flag|= DL_CYCL_U;	/* reverse too! */
-				if(nu->flagu & CU_NURB_CYCLIC) dl->flag|= DL_CYCL_V;
+				if (nu->flagv & CU_NURB_CYCLIC) dl->flag|= DL_CYCL_U;	/* reverse too! */
+				if (nu->flagu & CU_NURB_CYCLIC) dl->flag|= DL_CYCL_V;
 
 				makeNurbfaces(nu, data, 0, resolu, resolv);
 				
@@ -1166,15 +1177,15 @@ void makeDispListSurf(Scene *scene, Object *ob, ListBase *dispbase,
 	}
 
 	/* make copy of 'undeformed" displist for texture space calculation
-	   actually, it's not totally undeformed -- pre-tesselation modifiers are
-	   already applied, thats how it worked for years, so keep for compatibility (sergey) */
+	 * actually, it's not totally undeformed -- pre-tessellation modifiers are
+	 * already applied, thats how it worked for years, so keep for compatibility (sergey) */
 	copy_displist(&cu->disp, dispbase);
 
 	if (!forRender) {
 		tex_space_curve(cu);
 	}
 
-	if(!forOrco)
+	if (!forOrco)
 		curve_calc_modifiers_post(scene, ob, dispbase, derivedFinal,
 			forRender, originalVerts, deformedVerts);
 }
@@ -1186,7 +1197,7 @@ 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) {
+		if (cu->flag & CU_3D) {
 			float vec[3];
 
 			vec[0] = fp[1]+widfac;
@@ -1239,9 +1250,9 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
 	Curve *cu = ob->data;
 
 	/* we do allow duplis... this is only displist on curve level */
-	if(!ELEM3(ob->type, OB_SURF, OB_CURVE, OB_FONT)) return;
+	if (!ELEM3(ob->type, OB_SURF, OB_CURVE, OB_FONT)) return;
 
-	if(ob->type==OB_SURF) {
+	if (ob->type==OB_SURF) {
 		makeDispListSurf(scene, ob, dispbase, derivedFinal, forRender, forOrco);
 	}
 	else if (ELEM(ob->type, OB_CURVE, OB_FONT)) {
@@ -1255,12 +1266,12 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
 
 		BLI_freelistN(&(cu->bev));
 
-		if(cu->path) free_path(cu->path);
+		if (cu->path) free_path(cu->path);
 		cu->path= NULL;
 
-		if(ob->type==OB_FONT) BKE_text_to_curve(G.main, scene, ob, 0);
+		if (ob->type==OB_FONT) BKE_text_to_curve(G.main, scene, ob, 0);
 
-		if(!forOrco) curve_calc_modifiers_pre(scene, ob, forRender, &originalVerts, &deformedVerts, &numVerts);
+		if (!forOrco) curve_calc_modifiers_pre(scene, ob, forRender, &originalVerts, &deformedVerts, &numVerts);
 
 		makeBevelList(ob);
 
@@ -1270,7 +1281,8 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
 		/* no bevel or extrude, and no width correction? */
 		if (!dlbev.first && cu->width==1.0f) {
 			curve_to_displist(cu, nubase, dispbase, forRender);
-		} else {
+		}
+		else {
 			float widfac= cu->width - 1.0f;
 			BevList *bl= cu->bev.first;
 			Nurb *nu= nubase->first;
@@ -1284,15 +1296,15 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
 				if (bl->nr) { /* blank bevel lists can happen */
 
 					/* exception handling; curve without bevel or extrude, with width correction */
-					if(dlbev.first==NULL) {
+					if (dlbev.first==NULL) {
 						dl= MEM_callocN(sizeof(DispList), "makeDispListbev");
 						dl->verts= MEM_callocN(3*sizeof(float)*bl->nr, "dlverts");
 						BLI_addtail(dispbase, dl);
 
-						if(bl->poly!= -1) dl->type= DL_POLY;
+						if (bl->poly!= -1) dl->type= DL_POLY;
 						else dl->type= DL_SEGM;
 
-						if(dl->type==DL_SEGM) dl->flag = (DL_FRONT_CURVE|DL_BACK_CURVE);
+						if (dl->type==DL_SEGM) dl->flag = (DL_FRONT_CURVE|DL_BACK_CURVE);
 
 						dl->parts= 1;
 						dl->nr= bl->nr;
@@ -1306,7 +1318,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
 						a= dl->nr;
 						bevp= (BevPoint *)(bl+1);
 						data= dl->verts;
-						while(a--) {
+						while (a--) {
 							data[0]= bevp->vec[0]+widfac*bevp->sina;
 							data[1]= bevp->vec[1]+widfac*bevp->cosa;
 							data[2]= bevp->vec[2];
@@ -1328,8 +1340,8 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
 							dl->type= DL_SURF;
 							
 							dl->flag= dlb->flag & (DL_FRONT_CURVE|DL_BACK_CURVE);
-							if(dlb->type==DL_POLY) dl->flag |= DL_CYCL_U;
-							if(bl->poly>=0) dl->flag |= DL_CYCL_V;
+							if (dlb->type==DL_POLY) dl->flag |= DL_CYCL_U;
+							if (bl->poly>=0) dl->flag |= DL_CYCL_V;
 							
 							dl->parts= bl->nr;
 							dl->nr= dlb->nr;
@@ -1344,12 +1356,13 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
 	
 							/* for each point of poly make a bevel piece */
 							bevp= (BevPoint *)(bl+1);
-							for(a=0; a<bl->nr; a++,bevp++) {
+							for (a=0; a<bl->nr; a++,bevp++) {
 								float fac=1.0;
 								if (cu->taperobj==NULL) {
 									if ( (cu->bevobj!=NULL) || !((cu->flag & CU_FRONT) || (cu->flag & CU_BACK)) )
 										fac = bevp->radius;
-								} else {
+								}
+								else {
 									fac = calc_taper(scene, cu->taperobj, a, bl->nr);
 								}
 
@@ -1372,7 +1385,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
 							displist_surf_indices(dl);
 						}
 
-						if(bottom_capbase.first) {
+						if (bottom_capbase.first) {
 							filldisplist(&bottom_capbase, dispbase, 1);
 							filldisplist(&top_capbase, dispbase, 0);
 							freedisplist(&bottom_capbase);
@@ -1389,18 +1402,18 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
 			curve_to_filledpoly(cu, nubase, dispbase);
 		}
 
-		if(cu->flag & CU_PATH) calc_curvepath(ob);
+		if ((cu->flag & CU_PATH) && !forOrco) calc_curvepath(ob);
 
 		/* make copy of 'undeformed" displist for texture space calculation
-		   actually, it's not totally undeformed -- pre-tesselation modifiers are
-		   already applied, thats how it worked for years, so keep for compatibility (sergey) */
+		 * actually, it's not totally undeformed -- pre-tessellation modifiers are
+		 * already applied, thats how it worked for years, so keep for compatibility (sergey) */
 		copy_displist(&cu->disp, dispbase);
 
 		if (!forRender) {
 			tex_space_curve(cu);
 		}
 
-		if(!forOrco) curve_calc_modifiers_post(scene, ob, dispbase, derivedFinal, forRender, originalVerts, deformedVerts);
+		if (!forOrco) curve_calc_modifiers_post(scene, ob, dispbase, derivedFinal, forRender, originalVerts, deformedVerts);
 
 		if (cu->flag & CU_DEFORM_FILL && !ob->derivedFinal) {
 			curve_to_filledpoly(cu, nubase, dispbase);
@@ -1414,9 +1427,9 @@ void makeDispListCurveTypes(Scene *scene, Object *ob, int forOrco)
 	ListBase *dispbase;
 
 	/* The same check for duplis as in do_makeDispListCurveTypes.
-	   Happens when curve used for constraint/bevel was converted to mesh.
-	   check there is still needed for render displist and orco displists. */
-	if(!ELEM3(ob->type, OB_SURF, OB_CURVE, OB_FONT)) return;
+	 * Happens when curve used for constraint/bevel was converted to mesh.
+	 * check there is still needed for render displist and orco displists. */
+	if (!ELEM3(ob->type, OB_SURF, OB_CURVE, OB_FONT)) return;
 
 	freedisplist(&(ob->disp));
 	dispbase= &(ob->disp);
@@ -1429,7 +1442,8 @@ void makeDispListCurveTypes(Scene *scene, Object *ob, int forOrco)
 
 	if (ob->derivedFinal) {
 		DM_set_object_boundbox (ob, ob->derivedFinal);
-	} else {
+	}
+	else {
 		boundbox_displist (ob);
 
 		/* if there is no derivedMesh, object's boundbox is unneeded */
@@ -1465,7 +1479,7 @@ float *makeOrcoDispList(Scene *scene, Object *ob, DerivedMesh *derivedFinal, int
 
 	orco= derivedFinal->getVertDataArray(derivedFinal, CD_ORCO);
 
-	if(orco) {
+	if (orco) {
 		orco= MEM_dupallocN(orco);
 	}
 
@@ -1483,21 +1497,21 @@ static void boundbox_displist(Object *ob)
 	
 	INIT_MINMAX(min, max);
 
-	if(ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
+	if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
 		Curve *cu= ob->data;
 		int doit= 0;
 
-		if(cu->bb==NULL) cu->bb= MEM_callocN(sizeof(BoundBox), "boundbox");
+		if (cu->bb==NULL) cu->bb= MEM_callocN(sizeof(BoundBox), "boundbox");
 		bb= cu->bb;
 		
 		dl= ob->disp.first;
 
 		while (dl) {
-			if(dl->type==DL_INDEX3) tot= dl->nr;
+			if (dl->type==DL_INDEX3) tot= dl->nr;
 			else tot= dl->nr*dl->parts;
 			
 			vert= dl->verts;
-			for(a=0; a<tot; a++, vert+=3) {
+			for (a=0; a<tot; a++, vert+=3) {
 				doit= 1;
 				DO_MINMAX(vert, min, max);
 			}
@@ -1505,7 +1519,7 @@ static void boundbox_displist(Object *ob)
 			dl= dl->next;
 		}
 		
-		if(!doit) {
+		if (!doit) {
 			/* there's no geometry in displist, use zero-sized boundbox */
 			zero_v3(min);
 			zero_v3(max);
@@ -1513,7 +1527,7 @@ static void boundbox_displist(Object *ob)
 		
 	}
 	
-	if(bb) {
+	if (bb) {
 		boundbox_set_from_min_max(bb, min, max);
 	}
 }
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index cdfd5d3..9ce4d68 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -84,7 +84,7 @@ static float gaussianFactors[5] = {	0.996849f,
 								0.524141f};
 static float gaussianTotal = 3.309425f;
 
-/* UV Image neighbouring pixel table x and y list */
+/* UV Image neighboring pixel table x and y list */
 static int neighX[8] = {1,1,0,-1,-1,-1, 0, 1};
 static int neighY[8] = {0,1,1, 1, 0,-1,-1,-1};
 
@@ -139,7 +139,7 @@ typedef struct Vec3f {
 } Vec3f;
 
 typedef struct BakeAdjPoint {
-	float dir[3];	/* vector pointing towards this neighbour */
+	float dir[3];	/* vector pointing towards this neighbor */
 	float dist;		/* distance to */
 } BakeAdjPoint;
 
@@ -156,11 +156,11 @@ typedef struct PaintBakeData {
 	int *s_pos;	/* index to start reading point sample realCoord */
 	int *s_num;	/* num of realCoord samples */
 	Vec3f *realCoord;  /* current pixel center world-space coordinates for each sample
-					   *  ordered as (s_pos+s_num)*/
+	                    *  ordered as (s_pos+s_num)*/
 	Bounds3D mesh_bounds;
 
 	/* adjacency info */
-	BakeAdjPoint *bNeighs; /* current global neighbour distances and directions, if required */
+	BakeAdjPoint *bNeighs; /* current global neighbor distances and directions, if required */
 	double average_dist;
 	/* space partitioning */
 	VolumeGrid *grid;		/* space partitioning grid to optimize brush checks */
@@ -183,7 +183,7 @@ typedef struct PaintUVPoint {
 	unsigned int v1, v2, v3;				/* vertex indexes */
 
 	unsigned int neighbour_pixel;	/* If this pixel isn't uv mapped to any face,
-									   but it's neighbouring pixel is */
+									   but it's neighboring pixel is */
 	short quad;
 } PaintUVPoint;
 
@@ -196,7 +196,7 @@ typedef struct ImgSeqFormatData {
 #define ADJ_ON_MESH_EDGE (1<<0)
 
 typedef struct PaintAdjData {
-	int *n_target;		/* array of neighbouring point indexes,
+	int *n_target;		/* array of neighboring point indexes,
 							       for single sample use (n_index+neigh_num) */
 	int *n_index;		/* index to start reading n_target for each point */
 	int *n_num;		/* num of neighs for each point */
@@ -246,8 +246,8 @@ struct DynamicPaintSurface *get_activeSurface(DynamicPaintCanvasSettings *canvas
 	DynamicPaintSurface *surface = canvas->surfaces.first;
 	int i;
 
-	for(i=0; surface; surface=surface->next) {
-		if(i == canvas->active_sur)
+	for (i=0; surface; surface=surface->next) {
+		if (i == canvas->active_sur)
 			return surface;
 		i++;
 	}
@@ -260,7 +260,7 @@ void dynamicPaint_resetPreview(DynamicPaintCanvasSettings *canvas)
 	DynamicPaintSurface *surface = canvas->surfaces.first;
 	int done=0;
 
-	for(; surface; surface=surface->next) {
+	for (; surface; surface=surface->next) {
 		if (!done && dynamicPaint_surfaceHasColorPreview(surface)) {
 			surface->flags |= MOD_DPAINT_PREVIEW;
 			done=1;
@@ -274,7 +274,7 @@ void dynamicPaint_resetPreview(DynamicPaintCanvasSettings *canvas)
 static void dynamicPaint_setPreview(DynamicPaintSurface *t_surface)
 {
 	DynamicPaintSurface *surface = t_surface->canvas->surfaces.first;
-	for(; surface; surface=surface->next) {
+	for (; surface; surface=surface->next) {
 		if (surface == t_surface)
 			surface->flags |= MOD_DPAINT_PREVIEW;
 		else
@@ -310,11 +310,11 @@ static int surface_duplicateOutputExists(void *arg, const char *name)
 	DynamicPaintSurface *t_surface = (DynamicPaintSurface*)arg;
 	DynamicPaintSurface *surface = t_surface->canvas->surfaces.first;
 
-	for(; surface; surface=surface->next) {
+	for (; surface; surface=surface->next) {
 		if (surface!=t_surface && surface->type==t_surface->type &&
 			surface->format==t_surface->format) {
-			if (surface->output_name[0]!='\0' && !strcmp(name, surface->output_name)) return 1;
-			if (surface->output_name2[0]!='\0' && !strcmp(name, surface->output_name2)) return 1;
+			if (surface->output_name[0]!='\0' && !BLI_path_cmp(name, surface->output_name)) return 1;
+			if (surface->output_name2[0]!='\0' && !BLI_path_cmp(name, surface->output_name2)) return 1;
 		}
 	}
 	return 0;
@@ -336,7 +336,7 @@ static int surface_duplicateNameExists(void *arg, const char *name)
 	DynamicPaintSurface *t_surface = (DynamicPaintSurface*)arg;
 	DynamicPaintSurface *surface = t_surface->canvas->surfaces.first;
 
-	for(; surface; surface=surface->next) {
+	for (; surface; surface=surface->next) {
 		if (surface!=t_surface && !strcmp(name, surface->name)) return 1;
 	}
 	return 0;
@@ -455,8 +455,8 @@ static void object_cacheIgnoreClear(Object *ob, int state)
 	PTCacheID *pid;
 	BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
 
-	for(pid=pidlist.first; pid; pid=pid->next) {
-		if(pid->cache) {
+	for (pid=pidlist.first; pid; pid=pid->next) {
+		if (pid->cache) {
 			if (state)
 				pid->cache->flag |= PTCACHE_IGNORE_CLEAR;
 			else
@@ -472,7 +472,7 @@ static int subframe_updateObject(Scene *scene, Object *ob, int flags, float fram
 	DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)modifiers_findByType(ob, eModifierType_DynamicPaint);
 	bConstraint *con;
 
-	/* if other is dynamic paint canvas, dont update */
+	/* if other is dynamic paint canvas, don't update */
 	if (pmd && pmd->canvas)
 		return 1;
 
@@ -506,12 +506,13 @@ static int subframe_updateObject(Scene *scene, Object *ob, int flags, float fram
 		}
 	}
 	/* for curve following objects, parented curve has to be updated too */
-	if(ob->type==OB_CURVE) {
+	if (ob->type==OB_CURVE) {
 		Curve *cu= ob->data;
 		BKE_animsys_evaluate_animdata(scene, &cu->id, cu->adt, frame, ADT_RECALC_ANIM);
 	}
 
-	ob->recalc |= OB_RECALC_ALL;
+	/* was originally OB_RECALC_ALL - TODO - which flags are really needed??? */
+	ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME;
 	BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, frame, ADT_RECALC_ANIM);
 	if (flags & UPDATE_MESH) {
 		/* ignore cache clear during subframe updates
@@ -542,7 +543,7 @@ static int surface_getBrushFlags(DynamicPaintSurface *surface, Scene *scene)
 
 	int flags = 0;
 
-	if(surface->brush_group)
+	if (surface->brush_group)
 		go = surface->brush_group->gobject.first;
 	else
 		base = scene->base.first;
@@ -552,26 +553,26 @@ static int surface_getBrushFlags(DynamicPaintSurface *surface, Scene *scene)
 		brushObj = NULL;
 
 		/* select object */
-		if(surface->brush_group) {						
-			if(go->ob)	brushObj = go->ob;					
+		if (surface->brush_group) {						
+			if (go->ob)	brushObj = go->ob;					
 		}					
 		else						
 			brushObj = base->object;
 
-		if(!brushObj)					
+		if (!brushObj)					
 		{
-			if(surface->brush_group) go = go->next;
+			if (surface->brush_group) go = go->next;
 			else base= base->next;					
 			continue;			
 		}
 
-		if(surface->brush_group)
+		if (surface->brush_group)
 			go = go->next;
 		else
 			base= base->next;
 
 		md = modifiers_findByType(brushObj, eModifierType_DynamicPaint);
-		if(md && md->mode & (eModifierMode_Realtime | eModifierMode_Render))					
+		if (md && md->mode & (eModifierMode_Realtime | eModifierMode_Render))					
 		{
 			DynamicPaintModifierData *pmd2 = (DynamicPaintModifierData *)md;
 
@@ -745,7 +746,7 @@ static void surfaceGenerateGrid(struct DynamicPaintSurface *surface)
 		grid->t_index = MEM_callocN(sizeof(int) * sData->total_points, "Surface Grid Target Ids");
 		temp_t_index = MEM_callocN(sizeof(int) * sData->total_points, "Temp Surface Grid Target Ids");
 
-		/* in case of an allocation failture abort here */
+		/* in case of an allocation failure abort here */
 		if (!grid->bounds || !grid->s_pos || !grid->s_num || !grid->t_index || !temp_s_num || !temp_t_index)
 			error = 1;
 
@@ -832,15 +833,15 @@ static void surfaceGenerateGrid(struct DynamicPaintSurface *surface)
 /* Free brush data */
 void dynamicPaint_freeBrush(struct DynamicPaintModifierData *pmd)
 {
-	if(pmd->brush) {
-		if(pmd->brush->dm)
+	if (pmd->brush) {
+		if (pmd->brush->dm)
 			pmd->brush->dm->release(pmd->brush->dm);
 		pmd->brush->dm = NULL;
 
-		if(pmd->brush->paint_ramp)
+		if (pmd->brush->paint_ramp)
 			 MEM_freeN(pmd->brush->paint_ramp);
 		pmd->brush->paint_ramp = NULL;
-		if(pmd->brush->vel_ramp)
+		if (pmd->brush->vel_ramp)
 			 MEM_freeN(pmd->brush->vel_ramp);
 		pmd->brush->vel_ramp = NULL;
 
@@ -922,7 +923,7 @@ void dynamicPaint_freeSurface(DynamicPaintSurface *surface)
 	BKE_ptcache_free_list(&(surface->ptcaches));
 	surface->pointcache = NULL;
 
-	if(surface->effector_weights)
+	if (surface->effector_weights)
 		MEM_freeN(surface->effector_weights);
 	surface->effector_weights = NULL;
 
@@ -934,7 +935,7 @@ void dynamicPaint_freeSurface(DynamicPaintSurface *surface)
 /* Free canvas data */
 void dynamicPaint_freeCanvas(DynamicPaintModifierData *pmd)
 {
-	if(pmd->canvas) {
+	if (pmd->canvas) {
 		/* Free surface data */
 		DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
 		DynamicPaintSurface *next_surface = NULL;
@@ -958,7 +959,7 @@ void dynamicPaint_freeCanvas(DynamicPaintModifierData *pmd)
 /* Free whole dp modifier */
 void dynamicPaint_Modifier_free(struct DynamicPaintModifierData *pmd)
 {
-	if(pmd) {
+	if (pmd) {
 		dynamicPaint_freeCanvas(pmd);
 		dynamicPaint_freeBrush(pmd);
 	}
@@ -1047,10 +1048,10 @@ struct DynamicPaintSurface *dynamicPaint_createNewSurface(DynamicPaintCanvasSett
 */
 int dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, struct Scene *scene)
 {
-	if(pmd) {
-		if(type == MOD_DYNAMICPAINT_TYPE_CANVAS) {
+	if (pmd) {
+		if (type == MOD_DYNAMICPAINT_TYPE_CANVAS) {
 			DynamicPaintCanvasSettings *canvas;
-			if(pmd->canvas)
+			if (pmd->canvas)
 				dynamicPaint_freeCanvas(pmd);
 
 			canvas = pmd->canvas = MEM_callocN(sizeof(DynamicPaintCanvasSettings), "DynamicPaint Canvas");
@@ -1064,9 +1065,9 @@ int dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, stru
 				return 0;
 
 		}
-		else if(type == MOD_DYNAMICPAINT_TYPE_BRUSH) {
+		else if (type == MOD_DYNAMICPAINT_TYPE_BRUSH) {
 			DynamicPaintBrushSettings *brush;
-			if(pmd->brush)
+			if (pmd->brush)
 				dynamicPaint_freeBrush(pmd);
 
 			brush = pmd->brush = MEM_callocN(sizeof(DynamicPaintBrushSettings), "DynamicPaint Paint");
@@ -1148,8 +1149,8 @@ void dynamicPaint_Modifier_copy(struct DynamicPaintModifierData *pmd, struct Dyn
 	/* Copy data	*/
 	if (tpmd->canvas) {
 		tpmd->canvas->pmd = tpmd;
-
-	} else if (tpmd->brush) {
+	}
+	else if (tpmd->brush) {
 		DynamicPaintBrushSettings *brush = pmd->brush, *t_brush = tpmd->brush;
 		t_brush->pmd = tpmd;
 
@@ -1227,6 +1228,7 @@ static int surface_usesAdjData(DynamicPaintSurface *surface)
 static void dynamicPaint_initAdjacencyData(DynamicPaintSurface *surface, int force_init)
 {
 	PaintSurfaceData *sData = surface->data;
+	DerivedMesh *dm = surface->canvas->dm;
 	PaintAdjData *ad;
 	int *temp_data;
 	int neigh_points = 0;
@@ -1234,8 +1236,8 @@ static void dynamicPaint_initAdjacencyData(DynamicPaintSurface *surface, int for
 	if (!surface_usesAdjData(surface) && !force_init) return;
 
 	if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) {
-		/* For vertex format, neighbours are connected by edges */
-		neigh_points = 2*surface->canvas->dm->getNumEdges(surface->canvas->dm);
+		/* For vertex format, neighbors are connected by edges */
+		neigh_points = 2*dm->getNumEdges(dm);
 	}
 	else if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ)
 		neigh_points = sData->total_points*8;
@@ -1265,10 +1267,11 @@ static void dynamicPaint_initAdjacencyData(DynamicPaintSurface *surface, int for
 		int n_pos;
 
 		/* For vertex format, count every vertex that is connected by an edge */
-		int numOfEdges = surface->canvas->dm->getNumEdges(surface->canvas->dm);
-		int numOfFaces = surface->canvas->dm->getNumFaces(surface->canvas->dm);
-		struct MEdge *edge =  surface->canvas->dm->getEdgeArray(surface->canvas->dm);
-		struct MFace *face =  surface->canvas->dm->getFaceArray(surface->canvas->dm);
+		int numOfEdges = dm->getNumEdges(dm);
+		int numOfPolys = dm->getNumPolys(dm);
+		struct MEdge *edge =  dm->getEdgeArray(dm);
+		struct MPoly *mpoly = dm->getPolyArray(dm);
+		struct MLoop *mloop = dm->getLoopArray(dm);
 
 		/* count number of edges per vertex */
 		for (i=0; i<numOfEdges; i++) {
@@ -1281,12 +1284,11 @@ static void dynamicPaint_initAdjacencyData(DynamicPaintSurface *surface, int for
 
 		/* also add number of vertices to temp_data
 		*  to locate points on "mesh edge" */
-		for (i=0; i<numOfFaces; i++) {
-			temp_data[face[i].v1]++;
-			temp_data[face[i].v2]++;
-			temp_data[face[i].v3]++;
-			if (face[i].v4)
-				temp_data[face[i].v4]++;
+		for (i=0; i<numOfPolys; i++) {
+			int j=0;
+			for (; j<mpoly[i].totloop; j++) {
+				temp_data[mloop[mpoly[i].loopstart + j].v]++;
+			}
 		}
 
 		/* now check if total number of edges+faces for
@@ -1307,7 +1309,7 @@ static void dynamicPaint_initAdjacencyData(DynamicPaintSurface *surface, int for
 			n_pos += ad->n_num[i];
 		}
 
-		/* and now add neighbour data using that info */
+		/* and now add neighbor data using that info */
 		for (i=0; i<numOfEdges; i++) {
 			/* first vertex */
 			int index = edge[i].v1;
@@ -1355,8 +1357,8 @@ void dynamicPaint_setInitialColor(DynamicPaintSurface *surface)
 	else if (surface->init_color_type == MOD_DPAINT_INITIAL_TEXTURE) {
 		Tex *tex = surface->init_texture;
 		MTFace *tface;
-		MFace *mface = dm->getFaceArray(dm);
-		int numOfFaces = dm->getNumFaces(dm);
+		MFace *mface = dm->getTessFaceArray(dm);
+		int numOfFaces = dm->getNumTessFaces(dm);
 		char uvname[MAX_CUSTOMDATA_LAYER_NAME];
 
 		if (!tex) return;
@@ -1425,31 +1427,27 @@ void dynamicPaint_setInitialColor(DynamicPaintSurface *surface)
 	}
 	/* vertex color layer */
 	else if (surface->init_color_type == MOD_DPAINT_INITIAL_VERTEXCOLOR) {
-		MCol *col = CustomData_get_layer_named(&dm->faceData, CD_MCOL, surface->init_layername);
-		if (!col) return;
 
 		/* for vertex surface, just copy colors from mcol */
 		if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) {
-			MFace *mface = dm->getFaceArray(dm);
-			int numOfFaces = dm->getNumFaces(dm);
+			MLoop *mloop = dm->getLoopArray(dm);
+			int numOfLoops = dm->getNumLoops(dm);
+			MCol *col = CustomData_get_layer_named(&dm->loopData, CD_MLOOPCOL, surface->init_layername);
+			if (!col) return;
 
 			#pragma omp parallel for schedule(static)
-			for (i=0; i<numOfFaces; i++) {
-				int numOfVert = (mface[i].v4) ? 4 : 3;
-				int j;
-				for (j=0; j<numOfVert; j++) {
-					unsigned int *vert = ((&mface[i].v1)+j);
-
-					pPoint[*vert].color[0] = 1.0f/255.f*(float)col[i*4+j].b;
-					pPoint[*vert].color[1] = 1.0f/255.f*(float)col[i*4+j].g;
-					pPoint[*vert].color[2] = 1.0f/255.f*(float)col[i*4+j].r;
-					pPoint[*vert].alpha = 1.0f/255.f*(float)col[i*4+j].a;
-				}
+			for (i=0; i<numOfLoops; i++) {
+				pPoint[mloop[i].v].color[0] = 1.0f/255.f*(float)col[i].b;
+				pPoint[mloop[i].v].color[1] = 1.0f/255.f*(float)col[i].g;
+				pPoint[mloop[i].v].color[2] = 1.0f/255.f*(float)col[i].r;
+				pPoint[mloop[i].v].alpha = 1.0f/255.f*(float)col[i].a;
 			}
 		}
 		else if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) {
 			ImgSeqFormatData *f_data = (ImgSeqFormatData*)sData->format_data;
 			int samples = (surface->flags & MOD_DPAINT_ANTIALIAS) ? 5 : 1;
+			MCol *col = CustomData_get_layer_named(&dm->faceData, CD_MCOL, surface->init_layername);
+			if (!col) return;
 
 			#pragma omp parallel for schedule(static)
 			for (i=0; i<sData->total_points; i++) {
@@ -1509,7 +1507,7 @@ int dynamicPaint_resetSurface(DynamicPaintSurface *surface)
 	/* free existing data */
 	if (surface->data) dynamicPaint_freeSurfaceData(surface);
 
-	/* dont reallocate for image sequence types. they get handled only on bake */
+	/* don't reallocate for image sequence types. they get handled only on bake */
 	if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) return 1;
 	if (numOfPoints < 1) return 0;
 
@@ -1577,16 +1575,16 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
 {	
 	DerivedMesh *result = CDDM_copy(dm);
 
-	if(pmd->canvas && !(pmd->canvas->flags & MOD_DPAINT_BAKING)) {
+	if (pmd->canvas && !(pmd->canvas->flags & MOD_DPAINT_BAKING)) {
 
-		DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
+		DynamicPaintSurface *surface;
 		int update_normals = 0;
 
 		/* loop through surfaces */
-		for (; surface; surface=surface->next) {
+		for (surface = pmd->canvas->surfaces.first; surface; surface=surface->next) {
 			PaintSurfaceData *sData = surface->data;
 
-			if (surface && surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ && sData) {
+			if (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ && sData) {
 				if (!(surface->flags & (MOD_DPAINT_ACTIVE))) continue;
 
 				/* process vertex surface previews */
@@ -1595,11 +1593,11 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
 					/* vertex color paint */
 					if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) {
 
-						MFace *mface = result->getFaceArray(result);
-						int numOfFaces = result->getNumFaces(result);
 						int i;
 						PaintPoint* pPoint = (PaintPoint*)sData->type_data;
-						MCol *col;
+						MLoopCol *col = NULL;
+						MLoop *mloop = CDDM_get_loops(result);
+						int totloop = result->numLoopData;
 
 						/* paint is stored on dry and wet layers, so mix final color first */
 						float *fcolor = MEM_callocN(sizeof(float)*sData->total_points*4, "Temp paint color");
@@ -1612,26 +1610,41 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
 
 						/* viewport preview */
 						if (surface->flags & MOD_DPAINT_PREVIEW) {
-							/* Save preview results to weight layer, to be
+							MPoly *mp = CDDM_get_polys(result);
+							int totpoly = result->numPolyData;
+
+#if 0
+							/* XXX We have to create a CD_PREVIEW_MCOL, else it might sigsev
+							 *     (after a SubSurf mod, eg)... */
+							if (!result->getTessFaceDataArray(result, CD_PREVIEW_MCOL)) {
+								int numFaces = result->getNumTessFaces(result);
+								CustomData_add_layer(&result->faceData, CD_PREVIEW_MCOL, CD_CALLOC, NULL, numFaces);
+							}
+#endif
+
+							/* Save preview results to weight layer to be
 							*   able to share same drawing methods */
-							col = result->getFaceDataArray(result, CD_WEIGHT_MCOL);
-							if (!col) col = CustomData_add_layer(&result->faceData, CD_WEIGHT_MCOL, CD_CALLOC, NULL, numOfFaces);
+							col = CustomData_get_layer(&result->loopData, CD_PREVIEW_MLOOPCOL);
+							if (!col)
+								col = CustomData_add_layer(&result->loopData, CD_PREVIEW_MLOOPCOL, CD_CALLOC,
+								                           NULL, totloop);
 
 							if (col) {
 								#pragma omp parallel for schedule(static)
-								for (i=0; i<numOfFaces; i++) {
-									int j = (mface[i].v4) ? 4 : 3;
-									Material *material = give_current_material(ob, mface[i].mat_nr+1);
+								for (i=0; i<totpoly; i++) {
+									int j=0;
+									Material *material = give_current_material(ob, mp[i].mat_nr + 1);
 
-									while (j--) {
-										int index = *((&mface[i].v1)+j);
+									for (; j<mp[i].totloop; j++) {
+										int l_index = mp[i].loopstart + j;
+										int v_index = mloop[l_index].v;
 
 										if (surface->preview_id == MOD_DPAINT_SURFACE_PREV_PAINT) {
 											float c[3];
-											index *= 4;
+											v_index *= 4;
 
 											/* Apply material color as base vertex color for preview */
-											col[i*4+j].a = 255;
+											col[l_index].a = 255;
 											if (material) {
 												c[0] = material->r;
 												c[1] = material->g;
@@ -1643,17 +1656,15 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
 												c[2] = 0.65f;
 											}
 											/* mix surface color */
-											interp_v3_v3v3(c, c, &fcolor[index], fcolor[index+3]);
+											interp_v3_v3v3(c, c, &fcolor[v_index], fcolor[v_index+3]);
 
-											col[i*4+j].r = FTOCHAR(c[2]);
-											col[i*4+j].g = FTOCHAR(c[1]);
-											col[i*4+j].b = FTOCHAR(c[0]);
+											rgb_float_to_uchar((unsigned char *)&col[l_index].r, c);
 										}
 										else {
-											col[i*4+j].a = 255;
-											col[i*4+j].r =
-											col[i*4+j].g =
-											col[i*4+j].b = FTOCHAR(pPoint[index].wetness);
+											col[l_index].r =
+											col[l_index].g =
+											col[l_index].b = FTOCHAR(pPoint[v_index].wetness);
+											col[l_index].a = 255;
 										}
 									}
 								}
@@ -1664,58 +1675,53 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
 						/* save layer data to output layer */
 
 						/* paint layer */
-						col = CustomData_get_layer_named(&result->faceData, CD_MCOL, surface->output_name);
+						col = CustomData_get_layer_named(&result->loopData, CD_MLOOPCOL, surface->output_name);
 						/* if output layer is lost from a constructive modifier, re-add it */
 						if (!col && dynamicPaint_outputLayerExists(surface, ob, 0))
-							col = CustomData_add_layer_named(&result->faceData, CD_MCOL, CD_CALLOC, NULL, numOfFaces, surface->output_name);
+							col = CustomData_add_layer_named(&result->loopData, CD_MLOOPCOL, CD_CALLOC, NULL, totloop, surface->output_name);
 						/* apply color */
 						if (col) {
 							#pragma omp parallel for schedule(static)
-							for (i=0; i<numOfFaces; i++) {
-								int j = (mface[i].v4) ? 4 : 3;
-								while (j--) {
-									int index = *((&mface[i].v1)+j);
-									index *= 4;
-
-									col[i*4+j].a = FTOCHAR(fcolor[index+3]);
-									col[i*4+j].r = FTOCHAR(fcolor[index+2]);
-									col[i*4+j].g = FTOCHAR(fcolor[index+1]);
-									col[i*4+j].b = FTOCHAR(fcolor[index]);
-								}
+							for (i=0; i<totloop; i++) {
+								int index = mloop[i].v*4;
+								rgb_float_to_uchar((unsigned char *)&col[i].r, &fcolor[index]);
+								col[i].a = FTOCHAR(fcolor[index+3]); /* IS THIS NEEDED? */
 							}
 						}
 						
 						MEM_freeN(fcolor);
 
 						/* wet layer */
-						col = CustomData_get_layer_named(&result->faceData, CD_MCOL, surface->output_name2);
+						col = CustomData_get_layer_named(&result->loopData, CD_MLOOPCOL, surface->output_name2);
 						/* if output layer is lost from a constructive modifier, re-add it */
 						if (!col && dynamicPaint_outputLayerExists(surface, ob, 1))
-							col = CustomData_add_layer_named(&result->faceData, CD_MCOL, CD_CALLOC, NULL, numOfFaces, surface->output_name2);
+							col = CustomData_add_layer_named(&result->loopData, CD_MLOOPCOL, CD_CALLOC, NULL, totloop, surface->output_name2);
 						/* apply color */
 						if (col) {
 							#pragma omp parallel for schedule(static)
-							for (i=0; i<numOfFaces; i++) {
-								int j = (mface[i].v4) ? 4 : 3;
-								while (j--) {
-									int index = *((&mface[i].v1)+j);
-									col[i*4+j].a = 255;
-									col[i*4+j].r =
-									col[i*4+j].g =
-									col[i*4+j].b = FTOCHAR(pPoint[index].wetness);
-								}
+							for (i=0; i<totloop; i++) {
+								int index = mloop[i].v;
+								col[i].r =
+								col[i].g =
+								col[i].b = FTOCHAR(pPoint[index].wetness);
+								col[i].a = 255;
 							}
 						}
+
+						/* Mark tessellated CD layers as dirty. */
+						result->dirty |= DM_DIRTY_TESS_CDLAYERS;
 					}
 					/* vertex group paint */
 					else if (surface->type == MOD_DPAINT_SURFACE_T_WEIGHT) {
 						int defgrp_index = defgroup_name_index(ob, surface->output_name);
 						MDeformVert *dvert = result->getVertDataArray(result, CD_MDEFORMVERT);
 						float *weight = (float*)sData->type_data;
+
 						/* viewport preview */
 						if (surface->flags & MOD_DPAINT_PREVIEW) {
-							/* Save preview results to weight layer, to be
-							*   able to share same drawing methods */
+							/* Save preview results to weight layer to be
+							 * able to share same drawing methods.
+							 * Note this func also sets DM_DIRTY_TESS_CDLAYERS flag! */
 							DM_update_weight_mcol(ob, result, 0, weight, 0, NULL);
 						}
 
@@ -1725,7 +1731,7 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
 																NULL, sData->total_points, surface->output_name);
 						if (defgrp_index >= 0 && dvert) {
 							int i;
-							for(i=0; i<sData->total_points; i++) {
+							for (i=0; i<sData->total_points; i++) {
 								MDeformVert *dv= &dvert[i];
 								MDeformWeight *def_weight = defvert_find_index(dv, defgrp_index);
 
@@ -1799,7 +1805,7 @@ void canvas_copyDerivedMesh(DynamicPaintCanvasSettings *canvas, DerivedMesh *dm)
 */
 static void dynamicPaint_frameUpdate(DynamicPaintModifierData *pmd, Scene *scene, Object *ob, DerivedMesh *dm)
 {
-	if(pmd->canvas) {
+	if (pmd->canvas) {
 		DynamicPaintCanvasSettings *canvas = pmd->canvas;
 		DynamicPaintSurface *surface = canvas->surfaces.first;
 
@@ -1838,20 +1844,18 @@ static void dynamicPaint_frameUpdate(DynamicPaintModifierData *pmd, Scene *scene
 				BKE_ptcache_id_time(&pid, scene, (float)scene->r.cfra, NULL, NULL, NULL);
 
 				/* reset non-baked cache at first frame */
-				if((int)scene->r.cfra == surface->start_frame && !(cache->flag & PTCACHE_BAKED))
-				{
+				if ((int)scene->r.cfra == surface->start_frame && !(cache->flag & PTCACHE_BAKED)) {
 					cache->flag |= PTCACHE_REDO_NEEDED;
 					BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED);
 					cache->flag &= ~PTCACHE_REDO_NEEDED;
 				}
 
 				/* try to read from cache */
-				if(BKE_ptcache_read(&pid, (float)scene->r.cfra)) {
+				if (BKE_ptcache_read(&pid, (float)scene->r.cfra)) {
 					BKE_ptcache_validate(cache, (int)scene->r.cfra);
 				}
 				/* if read failed and we're on surface range do recalculate */
-				else if ((int)scene->r.cfra == current_frame
-					&& !(cache->flag & PTCACHE_BAKED)) {
+				else if ((int)scene->r.cfra == current_frame && !(cache->flag & PTCACHE_BAKED)) {
 					/* calculate surface frame */
 					canvas->flags |= MOD_DPAINT_BAKING;
 					dynamicPaint_calculateFrame(surface, scene, ob, current_frame);
@@ -1873,6 +1877,10 @@ static void dynamicPaint_frameUpdate(DynamicPaintModifierData *pmd, Scene *scene
 /* Modifier call. Processes dynamic paint modifier step. */
 struct DerivedMesh *dynamicPaint_Modifier_do(DynamicPaintModifierData *pmd, Scene *scene, Object *ob, DerivedMesh *dm)
 {	
+	/* For now generate tessfaces in every case
+	*  XXX - move/remove when most of dpaint functions are converted to use bmesh types */
+	DM_ensure_tessface(dm);
+
 	/* Update canvas data for a new frame */
 	dynamicPaint_frameUpdate(pmd, scene, ob, dm);
 
@@ -1884,7 +1892,7 @@ struct DerivedMesh *dynamicPaint_Modifier_do(DynamicPaintModifierData *pmd, Scen
 /***************************** Image Sequence / UV Image Surface Calls ******************************/
 
 /*
-*	Tries to find the neighbouring pixel in given (uv space) direction.
+*	Tries to find the neighboring pixel in given (uv space) direction.
 *	Result is used by effect system to move paint on the surface.
 *
 *   px,py : origin pixel x and y
@@ -1893,7 +1901,7 @@ struct DerivedMesh *dynamicPaint_Modifier_do(DynamicPaintModifierData *pmd, Scen
 static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh *dm,
                                            const char *uvname, int w, int h, int px, int py, int n_index)
 {
-	/* Note: Current method only uses polygon edges to detect neighbouring pixels.
+	/* Note: Current method only uses polygon edges to detect neighboring pixels.
 	*  -> It doesn't always lead to the optimum pixel but is accurate enough
 	*  and faster/simplier than including possible face tip point links)
 	*/
@@ -1909,11 +1917,11 @@ static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh
 	if (x<0 || x>=w) return OUT_OF_TEXTURE;
 	if (y<0 || y>=h) return OUT_OF_TEXTURE;
 
-	tPoint = &tempPoints[x+w*y];		/* UV neighbour */
+	tPoint = &tempPoints[x+w*y];		/* UV neighbor */
 	cPoint = &tempPoints[px+w*py];		/* Origin point */
 
 	/*
-	*	Check if shifted point is on same face -> it's a correct neighbour
+	*	Check if shifted point is on same face -> it's a correct neighbor
 	*   (and if it isn't marked as an "edge pixel")
 	*/
 	if ((tPoint->face_index == cPoint->face_index) && (tPoint->neighbour_pixel == -1))
@@ -1932,11 +1940,11 @@ static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh
 	}
 
 	/*
-	*	If we get here, the actual neighbouring pixel
+	*	If we get here, the actual neighboring pixel
 	*	is located on a non-linked uv face, and we have to find
 	*	it's "real" position.
 	*
-	*	Simple neighbouring face finding algorithm:
+	*	Simple neighboring face finding algorithm:
 	*	- find closest uv edge to shifted pixel and get
 	*	  the another face that shares that edge
 	*	- find corresponding position of that new face edge
@@ -1945,8 +1953,8 @@ static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh
 	*	TODO: Implement something more accurate / optimized?
 	*/
 	{
-		int numOfFaces = dm->getNumFaces(dm);
-		MFace *mface = dm->getFaceArray(dm);
+		int numOfFaces = dm->getNumTessFaces(dm);
+		MFace *mface = dm->getTessFaceArray(dm);
 		MTFace *tface =  CustomData_get_layer_named(&dm->faceData, CD_MTFACE, uvname);
 
 		/* Get closest edge to that subpixel on UV map	*/
@@ -2070,7 +2078,7 @@ static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh
 			if (tempPoints[final_index].face_index != target_face) return NOT_FOUND;
 
 			/*
-			*	If final point is an "edge pixel", use it's "real" neighbour instead
+			*	If final point is an "edge pixel", use it's "real" neighbor instead
 			*/
 			if (tempPoints[final_index].neighbour_pixel != -1) final_index = cPoint->neighbour_pixel;
 
@@ -2112,8 +2120,8 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
 	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.");
 
-	numOfFaces = dm->getNumFaces(dm);
-	mface = dm->getFaceArray(dm);
+	numOfFaces = dm->getNumTessFaces(dm);
+	mface = dm->getTessFaceArray(dm);
 
 	/* get uv map */
 	CustomData_validate_layer_name(&dm->faceData, CD_MTFACE, surface->uvlayer_name, uvname);
@@ -2317,7 +2325,7 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
 
 		/*
 		*	Now loop through every pixel that was left without index
-		*	and find if they have neighbouring pixels that have an index.
+		*	and find if they have neighboring pixels that have an index.
 		*	If so use that polygon as pixel surface.
 		*	(To avoid seams on uv island edges)
 		*/
@@ -2330,7 +2338,7 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
 				int index = tx+w*ty;
 				PaintUVPoint *tPoint = (&tempPoints[index]);
 
-				/* If point isnt't on canvas mesh	*/
+				/* If point isn't't on canvas mesh	*/
 				if (tPoint->face_index == -1) {
 					int u_min, u_max, v_min, v_max;
 					int u,v, ind;
@@ -2345,14 +2353,14 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
 					point[0] = ((float)tx + 0.5f) / w;
 					point[1] = ((float)ty + 0.5f) / h;
 
-					/* search through defined area for neighbour	*/
+					/* search through defined area for neighbor	*/
 					for (u=u_min; u<=u_max; u++)
 						for (v=v_min; v<=v_max; v++) {
 							/* if not this pixel itself	*/
 							if (u!=0 || v!=0) {
 								ind = (tx+u)+w*(ty+v);
 
-								/* if neighbour has index	*/
+								/* if neighbor has index	*/
 								if (tempPoints[ind].face_index != -1) {
 
 									float uv1co[2], uv2co[2], uv3co[2], uv[2];
@@ -2397,7 +2405,7 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
 		}
 
 		/*
-		*	When base loop is over convert found neighbour indexes to real ones
+		*	When base loop is over convert found neighbor indexes to real ones
 		*	Also count the final number of active surface points
 		*/
 		for (ty = 0; ty < h; ty++)
@@ -2445,7 +2453,7 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
 
 							for (i=0; i<8; i++) {
 
-								/* Try to find a neighbouring pixel in defined direction
+								/* Try to find a neighboring pixel in defined direction
 								*  If not found, -1 is returned */
 								int n_target = dynamicPaint_findNeighbourPixel(tempPoints, dm, uvname, w, h, tx, ty, i);
 
@@ -2490,7 +2498,7 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
 				sData->total_points = active_points;
 				sData->format_data = f_data;
 
-				for(index = 0; index < (w*h); index++) {
+				for (index = 0; index < (w*h); index++) {
 					if (tempPoints[index].face_index != -1) {
 						memcpy(&f_data->uv_p[cursor], &tempPoints[index], sizeof(PaintUVPoint));
 						memcpy(&f_data->barycentricWeights[cursor*aa_samples], &tempWeights[index*aa_samples], sizeof(Vec3f)*aa_samples);
@@ -2634,7 +2642,7 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char* filenam
 		}
 	}
 
-	/* Set output format, png in case exr isnt supported */
+	/* Set output format, png in case exr isn't supported */
 	ibuf->ftype= PNG|95;
 #ifdef WITH_OPENEXR
 	if (format == R_IMF_IMTYPE_OPENEXR) {	/* OpenEXR 32-bit float */
@@ -2708,7 +2716,7 @@ static void dynamicPaint_freeBrushMaterials(BrushMaterials *bMats)
 void dynamicPaint_doMaterialTex(BrushMaterials *bMats, float color[3], float *alpha, Object *brushOb, const float volume_co[3], const float surface_co[3], int faceIndex, short isQuad, DerivedMesh *orcoDm)
 {
 	Material *mat = bMats->mat;
-	MFace *mface = orcoDm->getFaceArray(orcoDm);
+	MFace *mface = orcoDm->getTessFaceArray(orcoDm);
 
 	/* If no material defined, use the one assigned to the mesh face */
 	if (mat == NULL) {
@@ -2751,7 +2759,7 @@ static void mesh_faces_spherecast_dp(void *userdata, int index, const BVHTreeRay
 	{	
 		float dist = bvhtree_ray_tri_intersection(ray, hit->dist, t0, t1, t2);
 
-		if(dist >= 0 && dist < hit->dist)
+		if (dist >= 0 && dist < hit->dist)
 		{
 			hit->index = index;
 			hit->dist = dist;
@@ -2763,7 +2771,7 @@ static void mesh_faces_spherecast_dp(void *userdata, int index, const BVHTreeRay
 		t3 = NULL;
 		quad = 1;
 
-	} while(t2);
+	} while (t2);
 }
 
 /* A modified callback to bvh tree nearest point. The tree must bust have been built using bvhtree_from_mesh_faces.
@@ -2791,7 +2799,7 @@ static void mesh_faces_nearest_point_dp(void *userdata, int index, const float *
 		int vertex, edge;
 		
 		dist = nearest_point_in_tri_surface(t0, t1, t2, co, &vertex, &edge, nearest_tmp);
-		if(dist < nearest->dist)
+		if (dist < nearest->dist)
 		{
 			nearest->index = index;
 			nearest->dist = dist;
@@ -2804,7 +2812,7 @@ static void mesh_faces_nearest_point_dp(void *userdata, int index, const float *
 		t3 = NULL;
 		quad = 1;
 
-	} while(t2);
+	} while (t2);
 }
 
 
@@ -3147,7 +3155,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
 
 		dm = CDDM_copy(brush->dm);
 		mvert = dm->getVertArray(dm);
-		mface = dm->getFaceArray(dm);
+		mface = dm->getTessFaceArray(dm);
 		numOfVerts = dm->getNumVerts(dm);
 
 		/*	Transform collider vertices to global space
@@ -3178,7 +3186,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
 		}
 
 		/* check bounding box collision */
-		if(grid && meshBrush_boundsIntersect(&grid->grid_bounds, &mesh_bb, brush, brush_radius))
+		if (grid && meshBrush_boundsIntersect(&grid->grid_bounds, &mesh_bb, brush, brush_radius))
 		/* Build a bvh tree from transformed vertices	*/
 		if (bvhtree_from_mesh_faces(&treeData, dm, 0.0f, 4, 8))
 		{
@@ -3255,7 +3263,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
 
 						/* Check volume collision	*/
 						if (brush->collision == MOD_DPAINT_COL_VOLUME || brush->collision == MOD_DPAINT_COL_VOLDIST)
-						if(BLI_bvhtree_ray_cast(treeData.tree, ray_start, ray_dir, 0.0f, &hit, mesh_faces_spherecast_dp, &treeData) != -1)
+						if (BLI_bvhtree_ray_cast(treeData.tree, ray_start, ray_dir, 0.0f, &hit, mesh_faces_spherecast_dp, &treeData) != -1)
 						{
 							/* We hit a triangle, now check if collision point normal is facing the point	*/
 
@@ -3282,7 +3290,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
 
 								BLI_bvhtree_ray_cast(treeData.tree, ray_start, ray_dir, 0.0f, &hit, mesh_faces_spherecast_dp, &treeData);
 
-								if(hit.index != -1) {
+								if (hit.index != -1) {
 									/* Add factor on supersample filter	*/
 									volume_factor = 1.0f;
 									hit_found = HIT_VOLUME;
@@ -3327,14 +3335,14 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
 								else if (brush->ray_dir == MOD_DPAINT_RAY_BRUSH_AVG) {
 									copy_v3_v3(proj_ray, avg_brushNor);
 								}
-								else  { /* MOD_DPAINT_RAY_ZPLUS */
+								else { /* MOD_DPAINT_RAY_ZPLUS */
 									proj_ray[2] = 1.0f;
 								}
 								hit.index = -1;
 								hit.dist = brush_radius;
 
 								/* Do a face normal directional raycast, and use that distance	*/
-								if(BLI_bvhtree_ray_cast(treeData.tree, ray_start, proj_ray, 0.0f, &hit, mesh_faces_spherecast_dp, &treeData) != -1)
+								if (BLI_bvhtree_ray_cast(treeData.tree, ray_start, proj_ray, 0.0f, &hit, mesh_faces_spherecast_dp, &treeData) != -1)
 								{
 									proxDist = hit.dist;
 									madd_v3_v3v3fl(hitCo, ray_start, proj_ray, hit.dist);	/* Calculate final hit coordinates */
@@ -3547,12 +3555,12 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
 	tree= BLI_kdtree_new(psys->totpart);
 
 	/* loop through particles and insert valid ones	to the tree	*/
-	for(p=0, pa=psys->particles; p<psys->totpart; p++, pa++)	{
+	for (p=0, pa=psys->particles; p<psys->totpart; p++, pa++)	{
 
 		/* Proceed only if particle is active	*/
-		if(pa->alive == PARS_UNBORN && (part->flag & PART_UNBORN)==0) continue;									
-		else if(pa->alive == PARS_DEAD && (part->flag & PART_DIED)==0) continue;									
-		else if(pa->flag & PARS_UNEXIST) continue;
+		if (pa->alive == PARS_UNBORN && (part->flag & PART_UNBORN)==0) continue;									
+		else if (pa->alive == PARS_DEAD && (part->flag & PART_DIED)==0) continue;									
+		else if (pa->flag & PARS_UNEXIST) continue;
 
 		/*	for debug purposes check if any NAN particle proceeds
 		*	For some reason they get past activity check, this should rule most of them out	*/
@@ -3659,7 +3667,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
 					particles = BLI_kdtree_range_search(tree, max_range, bData->realCoord[bData->s_pos[index]].v, NULL, &nearest);
 
 					/* Find particle that produces highest influence */
-					for(n=0; n<particles; n++) {
+					for (n=0; n<particles; n++) {
 						ParticleData *pa = psys->particles + nearest[n].index;
 						float s_range;
 
@@ -3943,7 +3951,7 @@ void surface_determineForceTargetPoints(PaintSurfaceData *sData, int index, floa
 
 		if (n_index == closest_id[0]) continue;
 
-		/* only accept neighbour at "other side" of the first one in relation to force dir
+		/* only accept neighbor at "other side" of the first one in relation to force dir
 		*  so make sure angle between this and closest neigh is greater than first angle */
 		if (dir_dot>closest_d[1] && closest_dot<closest_d[0] && dir_dot>0.0f) {closest_d[1]=dir_dot; closest_id[1]=n_index;}
 	}
@@ -3965,7 +3973,7 @@ void surface_determineForceTargetPoints(PaintSurfaceData *sData, int index, floa
 		madd_v3_v3v3fl(force_proj, force, tangent, (-1.0f)*force_intersect);
 		normalize_v3(force_proj);
 
-		/* get drip factor based on force dir in relation to angle between those neighbours */
+		/* get drip factor based on force dir in relation to angle between those neighbors */
 		temp = dot_v3v3(bNeighs[closest_id[0]].dir, force_proj);
 		CLAMP(temp, -1.0f, 1.0f); /* float precision might cause values > 1.0f that return infinite */
 		closest_d[1] = acosf(temp)/neigh_diff;
@@ -3978,7 +3986,7 @@ void surface_determineForceTargetPoints(PaintSurfaceData *sData, int index, floa
 		closest_d[1] *= acosf(temp)/1.57079633f;
 	}
 	else {
-		/* if only single neighbour, still linearize force intersection effect */
+		/* if only single neighbor, still linearize force intersection effect */
 		closest_d[0] = 1.0f - acosf(closest_d[0])/1.57079633f;
 	}
 }
@@ -4140,9 +4148,9 @@ static int dynamicPaint_prepareEffectStep(DynamicPaintSurface *surface, Scene *s
 	return steps;
 }
 
-/*
-*	Processes active effect step.
-*/
+/**
+ *	Processes active effect step.
+ */
 static void dynamicPaint_doEffectStep(DynamicPaintSurface *surface, float *force, PaintPoint *prevPoint, float timescale, float steps)
 {
 	PaintSurfaceData *sData = surface->data;
@@ -4154,9 +4162,9 @@ static void dynamicPaint_doEffectStep(DynamicPaintSurface *surface, float *force
 	if (!sData->adj_data) return;
 
 	/*
-	*	Spread Effect
-	*/
-	if (surface->effect & MOD_DPAINT_EFFECT_DO_SPREAD)  {
+	 *	Spread Effect
+	 */
+	if (surface->effect & MOD_DPAINT_EFFECT_DO_SPREAD) {
 		float eff_scale = distance_scale*EFF_MOVEMENT_PER_FRAME*surface->spread_speed*timescale;
 
 		/* Copy current surface to the previous points array to read unmodified values	*/
@@ -4170,9 +4178,9 @@ static void dynamicPaint_doEffectStep(DynamicPaintSurface *surface, float *force
 			PaintPoint *pPoint = &((PaintPoint*)sData->type_data)[index];
 
 			/*  Only reads values from the surface copy (prevPoint[]),
-			*	so this one is thread safe */
+			 *	so this one is thread safe */
 
-			/*	Loop through neighbouring points	*/
+			/*	Loop through neighboring points	*/
 			for (i=0; i<numOfNeighs; i++) {
 				int n_index = sData->adj_data->n_index[index]+i;
 				float w_factor;
@@ -4197,9 +4205,9 @@ static void dynamicPaint_doEffectStep(DynamicPaintSurface *surface, float *force
 	}
 
 	/*
-	*	Shrink Effect
-	*/
-	if (surface->effect & MOD_DPAINT_EFFECT_DO_SHRINK)  {
+	 *	Shrink Effect
+	 */
+	if (surface->effect & MOD_DPAINT_EFFECT_DO_SHRINK) {
 		float eff_scale = distance_scale*EFF_MOVEMENT_PER_FRAME*surface->shrink_speed*timescale;
 
 		/* Copy current surface to the previous points array to read unmodified values	*/
@@ -4221,8 +4229,8 @@ static void dynamicPaint_doEffectStep(DynamicPaintSurface *surface, float *force
 
 				totalAlpha += ePoint->e_alpha;
 
-				/* Check if neighbouring point has lower alpha,
-				*  if so, decrease this point's alpha as well*/
+				/* Check if neighboring point has lower alpha,
+				 *  if so, decrease this point's alpha as well*/
 				if (pPoint->alpha <= 0.0f && pPoint->e_alpha <= 0.0f && pPoint->wetness <= 0.0f) continue;
 
 				/* decrease factor for dry paint alpha */
@@ -4246,8 +4254,8 @@ static void dynamicPaint_doEffectStep(DynamicPaintSurface *surface, float *force
 	}
 
 	/*
-	*	Drip Effect
-	*/
+	 *	Drip Effect
+	 */
 	if (surface->effect & MOD_DPAINT_EFFECT_DO_DRIP && force) 
 	{
 		float eff_scale = distance_scale*EFF_MOVEMENT_PER_FRAME*timescale/2.0f;
@@ -4445,8 +4453,8 @@ static void dynamicPaint_surfacePreStep(DynamicPaintSurface *surface, float time
 						dry_ratio = pPoint->wetness/p_wetness;
 
 						/*
-						*	Slowly "shift" paint from wet layer to dry layer as it drys:
-						*/
+						 *	Slowly "shift" paint from wet layer to dry layer as it drys:
+						 */
 						/* make sure alpha values are within proper range */
 						CLAMP(pPoint->alpha, 0.0f, 1.0f);
 						CLAMP(pPoint->e_alpha, 0.0f, 1.0f);
@@ -4459,7 +4467,7 @@ static void dynamicPaint_surfacePreStep(DynamicPaintSurface *surface, float time
 						/* now calculate new alpha for dry layer that keeps final blended color unchanged */
 						pPoint->alpha = (f_color[3] - pPoint->e_alpha)/(1.0f-pPoint->e_alpha);
 						/* for each rgb component, calculate a new dry layer color that keeps the final blend color
-						*  with these new alpha values. (wet layer color doesnt change)*/
+						 *  with these new alpha values. (wet layer color doesnt change)*/
 						if (pPoint->alpha) {
 							for (i=0; i<3; i++) {
 								pPoint->color[i] = (f_color[i]*f_color[3] - pPoint->e_color[i]*pPoint->e_alpha)/(pPoint->alpha*(1.0f-pPoint->e_alpha));
@@ -4630,8 +4638,8 @@ static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, Scene *sc
 	}
 
 	/*
-	*	Make a transformed copy of canvas derived mesh vertices to avoid recalculation.
-	*/
+	 *	Make a transformed copy of canvas derived mesh vertices to avoid recalculation.
+	 */
 	bData->mesh_bounds.valid = 0;
 	for (index=0; index<canvasNumOfVerts; index++) {
 		copy_v3_v3(canvas_verts[index].v, mvert[index].co);
@@ -4640,8 +4648,8 @@ static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, Scene *sc
 	}
 
 	/*
-	*	Prepare each surface point for a new step
-	*/
+	 *	Prepare each surface point for a new step
+	 */
 	#pragma omp parallel for schedule(static)
 	for (index=0; index<sData->total_points; index++)
 	{
@@ -4650,8 +4658,8 @@ static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, Scene *sc
 			copy_v3_v3(prev_point, bData->realCoord[bData->s_pos[index]].v);
 		}
 		/*
-		*	Calculate current 3D-position and normal of each surface point
-		*/
+		 *	Calculate current 3D-position and normal of each surface point
+		 */
 		if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) {
 			float n1[3], n2[3], n3[3];
 			ImgSeqFormatData *f_data = (ImgSeqFormatData*)sData->format_data;
@@ -4711,7 +4719,7 @@ static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, Scene *sc
 		}
 
 		/* Prepare surface normal directional scale to easily convert
-		*  brush intersection amount between global and local space */
+		 *  brush intersection amount between global and local space */
 		if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE ||
 			surface->type == MOD_DPAINT_SURFACE_T_WAVE) {
 			float temp_nor[3];
@@ -4758,8 +4766,8 @@ static int dynamicPaint_generateBakeData(DynamicPaintSurface *surface, Scene *sc
 }
 
 /*
-*	Do Dynamic Paint step. Paints scene brush objects of current state/frame to the surface.
-*/
+ * Do Dynamic Paint step. Paints scene brush objects of current state/frame to the surface.
+ */
 static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *surface, float timescale, float subframe)
 {
 	PaintSurfaceData *sData = surface->data;
@@ -4770,8 +4778,8 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su
 
 	dynamicPaint_surfacePreStep(surface, timescale);
 	/*
-	*	Loop through surface's target paint objects and do painting
-	*/
+	 * Loop through surface's target paint objects and do painting
+	 */
 	{
 		Base *base = NULL;
 		GroupObject *go = NULL;	
@@ -4783,7 +4791,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su
 		float scene_subframe = scene->r.subframe;
 
 		/* either from group or from all objects */
-		if(surface->brush_group)
+		if (surface->brush_group)
 			go = surface->brush_group->gobject.first;
 		else
 			base = scene->base.first;
@@ -4792,28 +4800,28 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su
 		{
 			brushObj = NULL;
 			/* select object */
-			if(surface->brush_group) {						
-				if(go->ob)	brushObj = go->ob;					
+			if (surface->brush_group) {						
+				if (go->ob)	brushObj = go->ob;					
 			}					
 			else						
 				brushObj = base->object;
 
-			if(!brushObj) {			
+			if (!brushObj) {			
 				/* skip item */
-				if(surface->brush_group) go = go->next;
+				if (surface->brush_group) go = go->next;
 				else base= base->next;					
 				continue;			
 			}
 
 			/* next item */
-			if(surface->brush_group)
+			if (surface->brush_group)
 				go = go->next;
 			else
 				base= base->next;
 
 			/* check if target has an active dp modifier	*/
 			md = modifiers_findByType(brushObj, eModifierType_DynamicPaint);
-			if(md && md->mode & (eModifierMode_Realtime | eModifierMode_Render))					
+			if (md && md->mode & (eModifierMode_Realtime | eModifierMode_Render))					
 			{
 				DynamicPaintModifierData *pmd2 = (DynamicPaintModifierData *)md;
 				/* make sure we're dealing with a brush	*/
@@ -4884,16 +4892,14 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su
 	}
 
 	/* surfaces operations that use adjacency data */
-	if (sData->adj_data && bData->bNeighs)
-	{
+	if (sData->adj_data && bData->bNeighs) {
 		/* wave type surface simulation step */
 		if (surface->type == MOD_DPAINT_SURFACE_T_WAVE) {
 			dynamicPaint_doWaveStep(surface, timescale);
 		}
 
 		/* paint surface effects */
-		if (surface->effect && surface->type == MOD_DPAINT_SURFACE_T_PAINT)
-		{
+		if (surface->effect && surface->type == MOD_DPAINT_SURFACE_T_PAINT) {
 			int steps = 1, s;
 			PaintPoint *prevPoint;
 			float *force = NULL;
@@ -4919,8 +4925,8 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su
 }
 
 /*
-*	Calculate a single frame and included subframes for surface
-*/
+ * Calculate a single frame and included subframes for surface
+ */
 int dynamicPaint_calculateFrame(DynamicPaintSurface *surface, Scene *scene, Object *cObject, int frame)
 {
 	float timescale = 1.0f;
@@ -4932,7 +4938,7 @@ int dynamicPaint_calculateFrame(DynamicPaintSurface *surface, Scene *scene, Obje
 	/* update bake data */
 	dynamicPaint_generateBakeData(surface, scene, cObject); 
 	
-	/* dont do substeps for first frame */
+	/* don't do substeps for first frame */
 	if (surface->substeps && (frame != surface->start_frame)) {
 		int st;
 		timescale = 1.0f / (surface->substeps+1);
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index bb1d20f..857f6e7 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -29,12 +29,15 @@
  *  \ingroup bke
  */
 
+#include <string.h>
+#include <limits.h>
+#include <math.h>
+
 #include "GL/glew.h"
 
 #include "BLI_utildefines.h"
 #include "BLI_blenlib.h"
 #include "BLI_edgehash.h"
-#include "BLI_editVert.h"
 #include "BLI_math.h"
 #include "BLI_pbvh.h"
 
@@ -44,9 +47,9 @@
 #include "BKE_paint.h"
 
 
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_object_types.h"
-#include "DNA_curve_types.h" /* for Curve */
 
 #include "MEM_guardedalloc.h"
 
@@ -55,24 +58,314 @@
 #include "GPU_extensions.h"
 #include "GPU_material.h"
 
-#include <string.h>
-#include <limits.h>
-#include <math.h>
+/* bmesh */
+#include "BKE_tessmesh.h"
+#include "BLI_array.h"
+#include "BLI_scanfill.h"
+
+#include "bmesh.h"
+/* end bmesh */
 
 extern GLubyte stipple_quarttone[128]; /* glutil.c, bad level data */
 
+
+BMEditMesh *BMEdit_Create(BMesh *bm, int do_tessellate)
+{
+	BMEditMesh *tm = MEM_callocN(sizeof(BMEditMesh), __func__);
+
+	tm->bm = bm;
+	if (do_tessellate) {
+		BMEdit_RecalcTessellation(tm);
+	}
+
+	return tm;
+}
+
+BMEditMesh *BMEdit_Copy(BMEditMesh *tm)
+{
+	BMEditMesh *tm2 = MEM_callocN(sizeof(BMEditMesh), __func__);
+	*tm2 = *tm;
+
+	tm2->derivedCage = tm2->derivedFinal = NULL;
+
+	tm2->bm = BM_mesh_copy(tm->bm);
+
+	/* The tessellation is NOT calculated on the copy here,
+	 * because currently all the callers of this function use
+	 * it to make a backup copy of the BMEditMesh to restore
+	 * it in the case of errors in an operation. For perf
+	 * reasons, in that case it makes more sense to do the
+	 * tessellation only when/if that copy ends up getting
+	 * used.*/
+	tm2->looptris = NULL;
+
+	tm2->vert_index = NULL;
+	tm2->edge_index = NULL;
+	tm2->face_index = NULL;
+
+	return tm2;
+}
+
+static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm)
+{
+	/* use this to avoid locking pthread for _every_ polygon
+	 * and calling the fill function */
+#define USE_TESSFACE_SPEEDUP
+
+	BMesh *bm = tm->bm;
+	BMLoop *(*looptris)[3]= NULL;
+	BLI_array_declare(looptris);
+	BMIter iter, liter;
+	BMFace *f;
+	BMLoop *l;
+	int i = 0, j;
+
+	ScanFillContext sf_ctx;
+
+#if 0
+	/* note, we could be clever and re-use this array but would need to ensure
+	 * its realloced at some point, for now just free it */
+	if (tm->looptris) MEM_freeN(tm->looptris);
+
+	/* Use tm->tottri when set, this means no reallocs while transforming,
+	 * (unless scanfill fails), otherwise... */
+	/* allocate the length of totfaces, avoid many small reallocs,
+	 * if all faces are tri's it will be correct, quads == 2x allocs */
+	BLI_array_reserve(looptris, (tm->tottri && tm->tottri < bm->totface * 3) ? tm->tottri : bm->totface);
+#else
+
+	/* this means no reallocs for quad dominant models, for */
+	if ( (tm->looptris != NULL) &&
+	     (tm->tottri != 0) &&
+	     /* (totrti <= bm->totface * 2) would be fine for all quads,
+	      * but in case there are some ngons, still re-use the array */
+	     (tm->tottri <= bm->totface * 3))
+	{
+		looptris = tm->looptris;
+	}
+	else {
+		if (tm->looptris) MEM_freeN(tm->looptris);
+		BLI_array_reserve(looptris, bm->totface);
+	}
+
+#endif
+
+	f = BM_iter_new(&iter, bm, BM_FACES_OF_MESH, NULL);
+	for ( ; f; f=BM_iter_step(&iter)) {
+		/*don't consider two-edged faces*/
+		if (f->len < 3) {
+			/* do nothing */
+		}
+
+#ifdef USE_TESSFACE_SPEEDUP
+
+		/* no need to ensure the loop order, we know its ok */
+
+		else if (f->len == 3) {
+			BLI_array_growone(looptris);
+			l = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, f);
+			for (j=0; l; l=BM_iter_step(&liter), j++) {
+				looptris[i][j] = l;
+			}
+			i += 1;
+		}
+		else if (f->len == 4) {
+			BMLoop *ltmp[4];
+			BLI_array_growitems(looptris, 2);
+
+			l = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, f);
+			for (j=0; l; l=BM_iter_step(&liter), j++) {
+				ltmp[j] = l;
+			}
+
+			looptris[i][0] = ltmp[0];
+			looptris[i][1] = ltmp[1];
+			looptris[i][2] = ltmp[2];
+			i += 1;
+
+			looptris[i][0] = ltmp[0];
+			looptris[i][1] = ltmp[2];
+			looptris[i][2] = ltmp[3];
+			i += 1;
+		}
+
+#endif /* USE_TESSFACE_SPEEDUP */
+
+		else {
+			ScanFillVert *v, *lastv=NULL, *firstv=NULL;
+			/* ScanFillEdge *e; */ /* UNUSED */
+			ScanFillFace *efa;
+			int totfilltri;
+
+			BLI_begin_edgefill(&sf_ctx);
+			/*scanfill time*/
+			l = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, f);
+			for (j=0; l; l=BM_iter_step(&liter), j++) {
+				/*mark order*/
+				BM_elem_index_set(l, j); /* set_loop */
+
+				v = BLI_addfillvert(&sf_ctx, l->v->co);
+				v->tmp.p = l;
+
+				if (lastv) {
+					/* e = */ BLI_addfilledge(&sf_ctx, lastv, v);
+				}
+
+				lastv = v;
+				if (firstv==NULL) firstv = v;
+			}
+
+			/*complete the loop*/
+			BLI_addfilledge(&sf_ctx, firstv, v);
+
+			totfilltri = BLI_edgefill_ex(&sf_ctx, FALSE, f->no);
+			BLI_array_growitems(looptris, totfilltri);
+
+			for (efa = sf_ctx.fillfacebase.first; efa; efa=efa->next) {
+				BMLoop *l1= efa->v1->tmp.p;
+				BMLoop *l2= efa->v2->tmp.p;
+				BMLoop *l3= efa->v3->tmp.p;
+
+				if (BM_elem_index_get(l1) > BM_elem_index_get(l2)) { SWAP(BMLoop*, l1, l2); }
+				if (BM_elem_index_get(l2) > BM_elem_index_get(l3)) { SWAP(BMLoop*, l2, l3); }
+				if (BM_elem_index_get(l1) > BM_elem_index_get(l2)) { SWAP(BMLoop*, l1, l2); }
+
+				looptris[i][0] = l1;
+				looptris[i][1] = l2;
+				looptris[i][2] = l3;
+				i += 1;
+			}
+
+			BLI_end_edgefill(&sf_ctx);
+		}
+	}
+
+	tm->tottri = i;
+	tm->looptris = looptris;
+
+#undef USE_TESSFACE_SPEEDUP
+
+}
+
+void BMEdit_RecalcTessellation(BMEditMesh *em)
+{
+	BMEdit_RecalcTessellation_intern(em);
+
+	/* commented because editbmesh_build_data() ensures we get tessfaces */
+#if 0
+	if (em->derivedFinal && em->derivedFinal == em->derivedCage) {
+		if (em->derivedFinal->recalcTessellation)
+			em->derivedFinal->recalcTessellation(em->derivedFinal);
+	}
+	else if (em->derivedFinal) {
+		if (em->derivedCage->recalcTessellation)
+			em->derivedCage->recalcTessellation(em->derivedCage);
+		if (em->derivedFinal->recalcTessellation)
+			em->derivedFinal->recalcTessellation(em->derivedFinal);
+	}
+#endif
+}
+
+void BMEdit_UpdateLinkedCustomData(BMEditMesh *em)
+{
+	BMesh *bm = em->bm;
+	int act;
+
+	if (CustomData_has_layer(&bm->pdata, CD_MTEXPOLY)) {
+		act = CustomData_get_active_layer(&bm->pdata, CD_MTEXPOLY);
+		CustomData_set_layer_active(&bm->ldata, CD_MLOOPUV, act);
+
+		act = CustomData_get_render_layer(&bm->pdata, CD_MTEXPOLY);
+		CustomData_set_layer_render(&bm->ldata, CD_MLOOPUV, act);
+
+		act = CustomData_get_clone_layer(&bm->pdata, CD_MTEXPOLY);
+		CustomData_set_layer_clone(&bm->ldata, CD_MLOOPUV, act);
+
+		act = CustomData_get_stencil_layer(&bm->pdata, CD_MTEXPOLY);
+		CustomData_set_layer_stencil(&bm->ldata, CD_MLOOPUV, act);
+	}
+}
+
+/*does not free the BMEditMesh struct itself*/
+void BMEdit_Free(BMEditMesh *em)
+{
+	if (em->derivedFinal) {
+		if (em->derivedFinal!=em->derivedCage) {
+			em->derivedFinal->needsFree= 1;
+			em->derivedFinal->release(em->derivedFinal);
+		}
+		em->derivedFinal= NULL;
+	}
+	if (em->derivedCage) {
+		em->derivedCage->needsFree= 1;
+		em->derivedCage->release(em->derivedCage);
+		em->derivedCage= NULL;
+	}
+
+	if (em->looptris) MEM_freeN(em->looptris);
+
+	if (em->vert_index) MEM_freeN(em->vert_index);
+	if (em->edge_index) MEM_freeN(em->edge_index);
+	if (em->face_index) MEM_freeN(em->face_index);
+
+	if (em->bm)
+		BM_mesh_free(em->bm);
+}
+
+/*
+ * ok, basic design:
+ *
+ * the bmesh derivedmesh exposes the mesh as triangles.  it stores pointers
+ * to three loops per triangle.  the derivedmesh stores a cache of tessellations
+ * for each face.  this cache will smartly update as needed (though at first
+ * it'll simply be more brute force).  keeping track of face/edge counts may
+ * be a small problbm.
+ *
+ * this won't be the most efficient thing, considering that internal edges and
+ * faces of tessellations are exposed.  looking up an edge by index in particular
+ * is likely to be a little slow.
+ */
+
+typedef struct EditDerivedBMesh {
+	DerivedMesh dm;
+
+	Object *ob;
+	BMEditMesh *tc;
+
+	float (*vertexCos)[3];
+	float (*vertexNos)[3];
+	float (*polyNos)[3];
+
+	/* private variables, for number of verts/edges/faces
+	 * within the above hash/table members*/
+	int tv, te, tf;
+} EditDerivedBMesh;
+
+static void emDM_calcNormals(DerivedMesh *UNUSED(dm))
+{
+	/* Nothing to do: normals are already calculated and stored on the
+	 * BMVerts and BMFaces */
+}
+
+static void emDM_recalcTessellation(DerivedMesh *UNUSED(dm))
+{
+	/* do nothing */
+}
+
 static void emDM_foreachMappedVert(
-		DerivedMesh *dm,
-		void (*func)(void *userData, int index, float *co, float *no_f, short *no_s),
-		void *userData)
+        DerivedMesh *dm,
+        void (*func)(void *userData, int index, const float co[3], const float no_f[3], const short no_s[3]),
+        void *userData)
 {
-	EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
-	EditVert *eve;
+	EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
+	BMVert *eve;
+	BMIter iter;
 	int i;
 
-	for (i=0,eve= emdm->em->verts.first; eve; i++,eve=eve->next) {
-		if (emdm->vertexCos) {
-			func(userData, i, emdm->vertexCos[i], emdm->vertexNos[i], NULL);
+	eve = BM_iter_new(&iter, bmdm->tc->bm, BM_VERTS_OF_MESH, NULL);
+	for (i=0; eve; i++, eve=BM_iter_step(&iter)) {
+		if (bmdm->vertexCos) {
+			func(userData, i, bmdm->vertexCos[i], bmdm->vertexNos[i], NULL);
 		}
 		else {
 			func(userData, i, eve->co, eve->no, NULL);
@@ -80,56 +373,61 @@ static void emDM_foreachMappedVert(
 	}
 }
 static void emDM_foreachMappedEdge(
-		DerivedMesh *dm,
-		void (*func)(void *userData, int index, float *v0co, float *v1co),
-		void *userData)
+        DerivedMesh *dm,
+        void (*func)(void *userData, int index, const float v0co[3], const float v1co[3]),
+        void *userData)
 {
-	EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
-	EditEdge *eed;
+	EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
+	BMEdge *eed;
+	BMIter iter;
 	int i;
 
-	if (emdm->vertexCos) {
-		EditVert *eve;
+	if (bmdm->vertexCos) {
 
-		for (i=0,eve=emdm->em->verts.first; eve; eve= eve->next)
-			eve->tmp.l = (intptr_t) i++;
-		for (i=0,eed= emdm->em->edges.first; eed; i++,eed= eed->next)
-			func(userData, i, emdm->vertexCos[(int) eed->v1->tmp.l], emdm->vertexCos[(int) eed->v2->tmp.l]);
+		BM_mesh_elem_index_ensure(bmdm->tc->bm, BM_VERT);
+
+		eed = BM_iter_new(&iter, bmdm->tc->bm, BM_EDGES_OF_MESH, NULL);
+		for (i=0; eed; i++,eed=BM_iter_step(&iter))
+			func(userData, i,
+				 bmdm->vertexCos[BM_elem_index_get(eed->v1)],
+				 bmdm->vertexCos[BM_elem_index_get(eed->v2)]);
 	}
 	else {
-		for (i=0,eed= emdm->em->edges.first; eed; i++,eed= eed->next)
+		eed = BM_iter_new(&iter, bmdm->tc->bm, BM_EDGES_OF_MESH, NULL);
+		for (i=0; eed; i++,eed=BM_iter_step(&iter))
 			func(userData, i, eed->v1->co, eed->v2->co);
 	}
 }
 
 static void emDM_drawMappedEdges(
 		DerivedMesh *dm,
-		int (*setDrawOptions)(void *userData, int index),
+		DMSetDrawOptions setDrawOptions,
 		void *userData)
 {
-	EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
-	EditEdge *eed;
+	EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
+	BMEdge *eed;
+	BMIter iter;
 	int i;
 
-	if (emdm->vertexCos) {
-		EditVert *eve;
+	if (bmdm->vertexCos) {
 
-		for (i=0,eve=emdm->em->verts.first; eve; eve= eve->next)
-			eve->tmp.l = (intptr_t) i++;
+		BM_mesh_elem_index_ensure(bmdm->tc->bm, BM_VERT);
 
 		glBegin(GL_LINES);
-		for (i=0,eed= emdm->em->edges.first; eed; i++,eed= eed->next) {
-			if (!setDrawOptions || setDrawOptions(userData, i)) {
-				glVertex3fv(emdm->vertexCos[(int) eed->v1->tmp.l]);
-				glVertex3fv(emdm->vertexCos[(int) eed->v2->tmp.l]);
+		eed = BM_iter_new(&iter, bmdm->tc->bm, BM_EDGES_OF_MESH, NULL);
+		for (i=0; eed; i++,eed=BM_iter_step(&iter)) {
+			if (!setDrawOptions || (setDrawOptions(userData, i) != DM_DRAW_OPTION_SKIP)) {
+				glVertex3fv(bmdm->vertexCos[BM_elem_index_get(eed->v1)]);
+				glVertex3fv(bmdm->vertexCos[BM_elem_index_get(eed->v2)]);
 			}
 		}
 		glEnd();
 	}
 	else {
 		glBegin(GL_LINES);
-		for (i=0,eed= emdm->em->edges.first; eed; i++,eed= eed->next) {
-			if (!setDrawOptions || setDrawOptions(userData, i)) {
+		eed = BM_iter_new(&iter, bmdm->tc->bm, BM_EDGES_OF_MESH, NULL);
+		for (i=0; eed; i++,eed=BM_iter_step(&iter)) {
+			if (!setDrawOptions || (setDrawOptions(userData, i) != DM_DRAW_OPTION_SKIP)) {
 				glVertex3fv(eed->v1->co);
 				glVertex3fv(eed->v2->co);
 			}
@@ -147,35 +445,36 @@ static void emDM_drawEdges(
 
 static void emDM_drawMappedEdgesInterp(
 		DerivedMesh *dm,
-		int (*setDrawOptions)(void *userData, int index),
-		void (*setDrawInterpOptions)(void *userData, int index, float t),
+		DMSetDrawOptions setDrawOptions,
+		DMSetDrawInterpOptions setDrawInterpOptions,
 		void *userData)
 {
-	EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
-	EditEdge *eed;
+	EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
+	BMEdge *eed;
+	BMIter iter;
 	int i;
 
-	if (emdm->vertexCos) {
-		EditVert *eve;
+	if (bmdm->vertexCos) {
 
-		for (i=0,eve=emdm->em->verts.first; eve; eve= eve->next)
-			eve->tmp.l = (intptr_t) i++;
+		BM_mesh_elem_index_ensure(bmdm->tc->bm, BM_VERT);
 
 		glBegin(GL_LINES);
-		for (i=0,eed= emdm->em->edges.first; eed; i++,eed= eed->next) {
-			if (!setDrawOptions || setDrawOptions(userData, i)) {
+		eed = BM_iter_new(&iter, bmdm->tc->bm, BM_EDGES_OF_MESH, NULL);
+		for (i=0; eed; i++,eed=BM_iter_step(&iter)) {
+			if (!setDrawOptions || (setDrawOptions(userData, i) != DM_DRAW_OPTION_SKIP)) {
 				setDrawInterpOptions(userData, i, 0.0);
-				glVertex3fv(emdm->vertexCos[(int) eed->v1->tmp.l]);
+				glVertex3fv(bmdm->vertexCos[BM_elem_index_get(eed->v1)]);
 				setDrawInterpOptions(userData, i, 1.0);
-				glVertex3fv(emdm->vertexCos[(int) eed->v2->tmp.l]);
+				glVertex3fv(bmdm->vertexCos[BM_elem_index_get(eed->v2)]);
 			}
 		}
 		glEnd();
 	}
 	else {
 		glBegin(GL_LINES);
-		for (i=0,eed= emdm->em->edges.first; eed; i++,eed= eed->next) {
-			if (!setDrawOptions || setDrawOptions(userData, i)) {
+		eed = BM_iter_new(&iter, bmdm->tc->bm, BM_EDGES_OF_MESH, NULL);
+		for (i=0; eed; i++,eed=BM_iter_step(&iter)) {
+			if (!setDrawOptions || (setDrawOptions(userData, i) != DM_DRAW_OPTION_SKIP)) {
 				setDrawInterpOptions(userData, i, 0.0);
 				glVertex3fv(eed->v1->co);
 				setDrawInterpOptions(userData, i, 1.0);
@@ -188,92 +487,113 @@ static void emDM_drawMappedEdgesInterp(
 
 static void emDM_drawUVEdges(DerivedMesh *dm)
 {
-	EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
-	EditFace *efa;
-	MTFace *tf;
+	EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
+	BMEditMesh *em = bmdm->tc;
+	BMFace *efa;
+	BMIter iter;
 
 	glBegin(GL_LINES);
-	for (efa= emdm->em->faces.first; efa; efa= efa->next) {
-		tf = CustomData_em_get(&emdm->em->fdata, efa->data, CD_MTFACE);
+	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+		BMIter liter;
+		BMLoop *l;
+		MLoopUV *lastluv = NULL, *firstluv = NULL;
 
-		if (tf && !(efa->h)) {
-			glVertex2fv(tf->uv[0]);
-			glVertex2fv(tf->uv[1]);
+		if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN))
+			continue;
 
-			glVertex2fv(tf->uv[1]);
-			glVertex2fv(tf->uv[2]);
+		BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+			MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
 
-			if (!efa->v4) {
-				glVertex2fv(tf->uv[2]);
-				glVertex2fv(tf->uv[0]);
-			}
-			else {
-				glVertex2fv(tf->uv[2]);
-				glVertex2fv(tf->uv[3]);
-				glVertex2fv(tf->uv[3]);
-				glVertex2fv(tf->uv[0]);
+			if (luv) {
+				if (lastluv)
+					glVertex2fv(luv->uv);
+				glVertex2fv(luv->uv);
+
+				lastluv = luv;
+				if (!firstluv)
+					firstluv = luv;
 			}
 		}
+
+		if (lastluv) {
+			glVertex2fv(lastluv->uv);
+			glVertex2fv(firstluv->uv);
+		}
 	}
 	glEnd();
 }
 
-static void emDM__calcFaceCent(EditFace *efa, float cent[3], float (*vertexCos)[3])
+static void emDM__calcFaceCent(BMesh *bm, BMFace *efa, float cent[3], float (*vertexCos)[3])
 {
+	BMIter iter;
+	BMLoop *l;
+	int tot = 0;
+
+	zero_v3(cent);
+
+	/*simple (and stupid) median (average) based method :/ */
+
 	if (vertexCos) {
-		copy_v3_v3(cent, vertexCos[(int) efa->v1->tmp.l]);
-		add_v3_v3(cent, vertexCos[(int) efa->v2->tmp.l]);
-		add_v3_v3(cent, vertexCos[(int) efa->v3->tmp.l]);
-		if (efa->v4) add_v3_v3(cent, vertexCos[(int) efa->v4->tmp.l]);
+		l = BM_iter_new(&iter, bm, BM_LOOPS_OF_FACE, efa);
+		for (; l; l=BM_iter_step(&iter)) {
+			add_v3_v3(cent, vertexCos[BM_elem_index_get(l->v)]);
+			tot++;
+		}
 	}
 	else {
-		copy_v3_v3(cent, efa->v1->co);
-		add_v3_v3(cent, efa->v2->co);
-		add_v3_v3(cent, efa->v3->co);
-		if (efa->v4) add_v3_v3(cent, efa->v4->co);
+		l = BM_iter_new(&iter, bm, BM_LOOPS_OF_FACE, efa);
+		for (; l; l=BM_iter_step(&iter)) {
+			add_v3_v3(cent, l->v->co);
+			tot++;
+		}
 	}
 
-	if (efa->v4) {
-		mul_v3_fl(cent, 0.25f);
-	}
-	else {
-		mul_v3_fl(cent, 0.33333333333f);
-	}
+	if (tot==0) return;
+	mul_v3_fl(cent, 1.0f/(float)tot);
 }
 
 static void emDM_foreachMappedFaceCenter(
-		DerivedMesh *dm,
-		void (*func)(void *userData, int index, float *co, float *no),
-		void *userData)
+        DerivedMesh *dm,
+        void (*func)(void *userData, int index, const float co[3], const float no[3]),
+        void *userData)
 {
-	EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
-	EditVert *eve;
-	EditFace *efa;
+	EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
+	float (*polyNos)[3] = NULL;
+	BMFace *efa;
+	BMIter iter;
 	float cent[3];
 	int i;
 
-	if (emdm->vertexCos) {
-		for (i=0,eve=emdm->em->verts.first; eve; eve= eve->next)
-			eve->tmp.l = (intptr_t) i++;
+	/* ensure for face center calculation */
+	if (bmdm->vertexCos) {
+		BM_mesh_elem_index_ensure(bmdm->tc->bm, BM_VERT);
+		polyNos = bmdm->polyNos;
+
+		BLI_assert(polyNos != NULL);
 	}
 
-	for (i=0,efa= emdm->em->faces.first; efa; i++,efa= efa->next) {
-		emDM__calcFaceCent(efa, cent, emdm->vertexCos);
-		func(userData, i, cent, emdm->vertexCos?emdm->faceNos[i]:efa->n);
+	efa = BM_iter_new(&iter, bmdm->tc->bm, BM_FACES_OF_MESH, NULL);
+	for (i=0; efa; efa=BM_iter_step(&iter), i++) {
+		emDM__calcFaceCent(bmdm->tc->bm, efa, cent, bmdm->vertexCos);
+		func(userData, i, cent, polyNos ? polyNos[i] : efa->no);
 	}
 }
 
-/* note, material function is ignored for now. */
 static void emDM_drawMappedFaces(
 		DerivedMesh *dm,
-		int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r),
-		int (*setMaterial)(int, void *attribs),
-		int (*compareDrawOptions)(void *userData, int cur_index, int next_index),
-		void *userData, int UNUSED(useColors))
+		DMSetDrawOptions setDrawOptions,
+		DMSetMaterial setMaterial,
+		DMCompareDrawOptions compareDrawOptions,
+		void *userData,
+		DMDrawFlag flag)
 {
-	EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
-	EditFace *efa;
-	int i, draw, flush;
+	EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
+	BMFace *efa;
+	struct BMLoop *(*looptris)[3]= bmdm->tc->looptris;
+	const int tottri= bmdm->tc->tottri;
+	const int lasttri= tottri - 1; /* compare agasint this a lot */
+	DMDrawOption draw_option;
+	int i, flush;
 	const int skip_normals= !glIsEnabled(GL_LIGHTING); /* could be passed as an arg */
 
 	/* GL_ZERO is used to detect if drawing has started or not */
@@ -285,22 +605,28 @@ static void emDM_drawMappedFaces(
 	/* currently unused -- each original face is handled separately */
 	(void)compareDrawOptions;
 
-	if (emdm->vertexCos) {
+	if (bmdm->vertexCos) {
 		/* add direct access */
-		float (*vertexCos)[3]= emdm->vertexCos;
-		float (*vertexNos)[3]= emdm->vertexNos;
-		float (*faceNos)[3]=   emdm->faceNos;
-		EditVert *eve;
+		float (*vertexCos)[3]= bmdm->vertexCos;
+		float (*vertexNos)[3]= bmdm->vertexNos;
+		float (*polyNos)[3]=   bmdm->polyNos;
+		// int *triPolyMap= bmdm->triPolyMap;
+
+		BM_mesh_elem_index_ensure(bmdm->tc->bm, BM_VERT | BM_FACE);
 
-		for (i=0,eve=emdm->em->verts.first; eve; eve= eve->next)
-			eve->tmp.l = (intptr_t) i++;
+		for (i=0; i < tottri; i++) {
+			BMLoop **l = looptris[i];
+			int drawSmooth;
 
-		for (i=0,efa= emdm->em->faces.first; efa; i++,efa= efa->next) {
-			int drawSmooth = (efa->flag & ME_SMOOTH);
-			draw = setDrawOptions==NULL ? 1 : setDrawOptions(userData, i, &drawSmooth);
-			if (draw) {
-				const GLenum poly_type= efa->v4 ? GL_QUADS:GL_TRIANGLES;
-				if (draw==2) { /* enabled with stipple */
+			efa = l[0]->f;
+			drawSmooth= (flag & DM_DRAW_ALWAYS_SMOOTH) ? 1 : BM_elem_flag_test(efa, BM_ELEM_SMOOTH);
+
+			draw_option = (!setDrawOptions ?
+						   DM_DRAW_OPTION_NORMAL :
+						   setDrawOptions(userData, BM_elem_index_get(efa)));
+			if (draw_option != DM_DRAW_OPTION_SKIP) {
+				const GLenum poly_type= GL_TRIANGLES; /* BMESH NOTE, this is odd but keep it for now to match trunk */
+				if (draw_option == DM_DRAW_OPTION_STIPPLE) { /* enabled with stipple */
 
 					if (poly_prev != GL_ZERO) glEnd();
 					poly_prev= GL_ZERO; /* force glBegin */
@@ -312,49 +638,43 @@ static void emDM_drawMappedFaces(
 				if (skip_normals) {
 					if (poly_type != poly_prev) {
 						if (poly_prev != GL_ZERO) glEnd();
-						glBegin((poly_prev= poly_type));
+						glBegin((poly_prev= poly_type)); /* BMesh: will always be GL_TRIANGLES */
 					}
-					glVertex3fv(vertexCos[(int) efa->v1->tmp.l]);
-					glVertex3fv(vertexCos[(int) efa->v2->tmp.l]);
-					glVertex3fv(vertexCos[(int) efa->v3->tmp.l]);
-					if (poly_type == GL_QUADS) glVertex3fv(vertexCos[(int) efa->v4->tmp.l]);
+					glVertex3fv(vertexCos[BM_elem_index_get(l[0]->v)]);
+					glVertex3fv(vertexCos[BM_elem_index_get(l[1]->v)]);
+					glVertex3fv(vertexCos[BM_elem_index_get(l[2]->v)]);
 				}
 				else {
 					const GLenum shade_type= drawSmooth ? GL_SMOOTH : GL_FLAT;
 					if (shade_type != shade_prev) {
 						if (poly_prev != GL_ZERO) glEnd();
 						glShadeModel((shade_prev= shade_type)); /* same as below but switch shading */
-						glBegin((poly_prev= poly_type));
+						glBegin((poly_prev= poly_type)); /* BMesh: will always be GL_TRIANGLES */
 					}
-					else if (poly_type != poly_prev) {
+					if (poly_type != poly_prev) {
 						if (poly_prev != GL_ZERO) glEnd();
-						glBegin((poly_prev= poly_type));
+						glBegin((poly_prev= poly_type)); /* BMesh: will always be GL_TRIANGLES */
 					}
 
 					if (!drawSmooth) {
-						glNormal3fv(faceNos[i]);
-						glVertex3fv(vertexCos[(int) efa->v1->tmp.l]);
-						glVertex3fv(vertexCos[(int) efa->v2->tmp.l]);
-						glVertex3fv(vertexCos[(int) efa->v3->tmp.l]);
-						if (poly_type == GL_QUADS) glVertex3fv(vertexCos[(int) efa->v4->tmp.l]);
+						glNormal3fv(polyNos[BM_elem_index_get(efa)]);
+						glVertex3fv(vertexCos[BM_elem_index_get(l[0]->v)]);
+						glVertex3fv(vertexCos[BM_elem_index_get(l[1]->v)]);
+						glVertex3fv(vertexCos[BM_elem_index_get(l[2]->v)]);
 					}
 					else {
-						glNormal3fv(vertexNos[(int) efa->v1->tmp.l]);
-						glVertex3fv(vertexCos[(int) efa->v1->tmp.l]);
-						glNormal3fv(vertexNos[(int) efa->v2->tmp.l]);
-						glVertex3fv(vertexCos[(int) efa->v2->tmp.l]);
-						glNormal3fv(vertexNos[(int) efa->v3->tmp.l]);
-						glVertex3fv(vertexCos[(int) efa->v3->tmp.l]);
-						if (poly_type == GL_QUADS) {
-							glNormal3fv(vertexNos[(int) efa->v4->tmp.l]);
-							glVertex3fv(vertexCos[(int) efa->v4->tmp.l]);
-						}
+						glNormal3fv(vertexNos[BM_elem_index_get(l[0]->v)]);
+						glVertex3fv(vertexCos[BM_elem_index_get(l[0]->v)]);
+						glNormal3fv(vertexNos[BM_elem_index_get(l[1]->v)]);
+						glVertex3fv(vertexCos[BM_elem_index_get(l[1]->v)]);
+						glNormal3fv(vertexNos[BM_elem_index_get(l[2]->v)]);
+						glVertex3fv(vertexCos[BM_elem_index_get(l[2]->v)]);
 					}
 				}
 
-				flush= (draw==2);
-				if (!skip_normals && !flush && efa->next)
-					flush|= efa->mat_nr != efa->next->mat_nr;
+				flush= (draw_option == DM_DRAW_OPTION_STIPPLE);
+				if (!skip_normals && !flush && (i != lasttri))
+					flush|= efa->mat_nr != looptris[i + 1][0]->f->mat_nr; /* TODO, make this neater */
 
 				if (flush) {
 					glEnd();
@@ -366,12 +686,21 @@ static void emDM_drawMappedFaces(
 		}
 	}
 	else {
-		for (i=0,efa= emdm->em->faces.first; efa; i++,efa= efa->next) {
-			int drawSmooth = (efa->flag & ME_SMOOTH);
-			draw = setDrawOptions==NULL ? 1 : setDrawOptions(userData, i, &drawSmooth);
-			if (draw) {
-				const GLenum poly_type= efa->v4 ? GL_QUADS:GL_TRIANGLES;
-				if (draw==2) { /* enabled with stipple */
+		BM_mesh_elem_index_ensure(bmdm->tc->bm, BM_FACE);
+
+		for (i=0; i < tottri; i++) {
+			BMLoop **l = looptris[i];
+			int drawSmooth;
+
+			efa = l[0]->f;
+			drawSmooth= (flag & DM_DRAW_ALWAYS_SMOOTH) ? 1 : BM_elem_flag_test(efa, BM_ELEM_SMOOTH);
+
+			draw_option = (!setDrawOptions ?
+						   DM_DRAW_OPTION_NORMAL :
+						   setDrawOptions(userData, BM_elem_index_get(efa)));
+			if (draw_option != DM_DRAW_OPTION_SKIP) {
+				const GLenum poly_type= GL_TRIANGLES; /* BMESH NOTE, this is odd but keep it for now to match trunk */
+				if (draw_option == DM_DRAW_OPTION_STIPPLE) { /* enabled with stipple */
 
 					if (poly_prev != GL_ZERO) glEnd();
 					poly_prev= GL_ZERO; /* force glBegin */
@@ -383,49 +712,44 @@ static void emDM_drawMappedFaces(
 				if (skip_normals) {
 					if (poly_type != poly_prev) {
 						if (poly_prev != GL_ZERO) glEnd();
-						glBegin((poly_prev= poly_type));
+						glBegin((poly_prev= poly_type)); /* BMesh: will always be GL_TRIANGLES */
 					}
-					glVertex3fv(efa->v1->co);
-					glVertex3fv(efa->v2->co);
-					glVertex3fv(efa->v3->co);
-					if (poly_type == GL_QUADS) glVertex3fv(efa->v4->co);
+					glVertex3fv(l[0]->v->co);
+					glVertex3fv(l[1]->v->co);
+					glVertex3fv(l[2]->v->co);
 				}
 				else {
 					const GLenum shade_type= drawSmooth ? GL_SMOOTH : GL_FLAT;
 					if (shade_type != shade_prev) {
 						if (poly_prev != GL_ZERO) glEnd();
 						glShadeModel((shade_prev= shade_type)); /* same as below but switch shading */
-						glBegin((poly_prev= poly_type));
+						glBegin((poly_prev= poly_type)); /* BMesh: will always be GL_TRIANGLES */
 					}
-					else if (poly_type != poly_prev) {
+					if (poly_type != poly_prev) {
 						if (poly_prev != GL_ZERO) glEnd();
-						glBegin((poly_prev= poly_type));
+						glBegin((poly_prev= poly_type)); /* BMesh: will always be GL_TRIANGLES */
 					}
 
 					if (!drawSmooth) {
-						glNormal3fv(efa->n);
-						glVertex3fv(efa->v1->co);
-						glVertex3fv(efa->v2->co);
-						glVertex3fv(efa->v3->co);
-						if (poly_type == GL_QUADS) glVertex3fv(efa->v4->co);
+						glNormal3fv(efa->no);
+						glVertex3fv(l[0]->v->co);
+						glVertex3fv(l[1]->v->co);
+						glVertex3fv(l[2]->v->co);
 					}
 					else {
-						glNormal3fv(efa->v1->no);
-						glVertex3fv(efa->v1->co);
-						glNormal3fv(efa->v2->no);
-						glVertex3fv(efa->v2->co);
-						glNormal3fv(efa->v3->no);
-						glVertex3fv(efa->v3->co);
-						if (poly_type == GL_QUADS) {
-							glNormal3fv(efa->v4->no);
-							glVertex3fv(efa->v4->co);
-						}
+						glNormal3fv(l[0]->v->no);
+						glVertex3fv(l[0]->v->co);
+						glNormal3fv(l[1]->v->no);
+						glVertex3fv(l[1]->v->co);
+						glNormal3fv(l[2]->v->no);
+						glVertex3fv(l[2]->v->co);
 					}
 				}
 
-				flush= (draw==2);
-				if (!skip_normals && !flush && efa->next)
-					flush|= efa->mat_nr != efa->next->mat_nr;
+				flush= (draw_option == DM_DRAW_OPTION_STIPPLE);
+				if (!skip_normals && !flush && (i != lasttri)) {
+					flush|= efa->mat_nr != looptris[i + 1][0]->f->mat_nr; /* TODO, make this neater */
+				}
 
 				if (flush) {
 					glEnd();
@@ -441,188 +765,211 @@ static void emDM_drawMappedFaces(
 	if (poly_prev != GL_ZERO) glEnd();
 }
 
+static void bmdm_get_tri_tex(BMesh *bm, BMLoop **ls, MLoopUV *luv[3], MLoopCol *lcol[3],
+				 int has_uv, int has_col)
+{
+	if (has_uv) {
+		luv[0] = CustomData_bmesh_get(&bm->ldata, ls[0]->head.data, CD_MLOOPUV);
+		luv[1] = CustomData_bmesh_get(&bm->ldata, ls[1]->head.data, CD_MLOOPUV);
+		luv[2] = CustomData_bmesh_get(&bm->ldata, ls[2]->head.data, CD_MLOOPUV);
+	}
+
+	if (has_col) {
+		lcol[0] = CustomData_bmesh_get(&bm->ldata, ls[0]->head.data, CD_MLOOPCOL);
+		lcol[1] = CustomData_bmesh_get(&bm->ldata, ls[1]->head.data, CD_MLOOPCOL);
+		lcol[2] = CustomData_bmesh_get(&bm->ldata, ls[2]->head.data, CD_MLOOPCOL);
+	}
+
+
+}
+
 static void emDM_drawFacesTex_common(
 		DerivedMesh *dm,
-		int (*drawParams)(MTFace *tface, int has_mcol, int matnr),
-		int (*drawParamsMapped)(void *userData, int index),
-		int (*compareDrawOptions)(void *userData, int cur_index, int next_index),
+		DMSetDrawOptionsTex drawParams,
+		DMSetDrawOptions drawParamsMapped,
+		DMCompareDrawOptions compareDrawOptions,
 		void *userData)
 {
-	EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
-	EditMesh *em= emdm->em;
-	float (*vertexCos)[3]= emdm->vertexCos;
-	float (*vertexNos)[3]= emdm->vertexNos;
-	EditFace *efa;
-	int i;
+	EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
+	BMEditMesh *em = bmdm->tc;
+	BMesh *bm= bmdm->tc->bm;
+	float (*vertexCos)[3]= bmdm->vertexCos;
+	float (*vertexNos)[3]= bmdm->vertexNos;
+	BMFace *efa;
+	MLoopUV *luv[3], dummyluv = {{0}};
+	MLoopCol *lcol[3] = {NULL}, dummylcol = {0};
+	int i, has_vcol = CustomData_has_layer(&bm->ldata, CD_MLOOPCOL);
+	int has_uv = CustomData_has_layer(&bm->pdata, CD_MTEXPOLY);
 
 	(void) compareDrawOptions;
 
+	luv[0] = luv[1] = luv[2] = &dummyluv;
+
+	dummylcol.r = dummylcol.g = dummylcol.b = dummylcol.a = 255;
+
 	/* always use smooth shading even for flat faces, else vertex colors wont interpolate */
 	glShadeModel(GL_SMOOTH);
 
+	BM_mesh_elem_index_ensure(bm, BM_FACE);
+
 	if (vertexCos) {
-		EditVert *eve;
+		BM_mesh_elem_index_ensure(bm, BM_VERT);
 
-		for (i=0,eve=em->verts.first; eve; eve= eve->next)
-			eve->tmp.l = (intptr_t) i++;
+		glBegin(GL_TRIANGLES);
+		for (i=0; i<em->tottri; i++) {
+			BMLoop **ls = em->looptris[i];
+			MTexPoly *tp= has_uv ? CustomData_bmesh_get(&bm->pdata, ls[0]->f->head.data, CD_MTEXPOLY) : NULL;
+			MTFace mtf = {{{0}}};
+			/*unsigned char *cp= NULL;*/ /*UNUSED*/
+			int drawSmooth= BM_elem_flag_test(ls[0]->f, BM_ELEM_SMOOTH);
+			DMDrawOption draw_option;
 
-		for (i=0,efa= em->faces.first; efa; i++,efa= efa->next) {
-			MTFace *tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-			MCol *mcol= CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
-			unsigned char *cp= NULL;
-			int drawSmooth= (efa->flag & ME_SMOOTH);
-			int flag;
+			efa = ls[0]->f;
+
+			if (has_uv) {
+				ME_MTEXFACE_CPY(&mtf, tp);
+			}
 
 			if (drawParams)
-				flag= drawParams(tf, (mcol != NULL), efa->mat_nr);
+				draw_option= drawParams(&mtf, has_vcol, efa->mat_nr);
 			else if (drawParamsMapped)
-				flag= drawParamsMapped(userData, i);
+				draw_option= drawParamsMapped(userData, BM_elem_index_get(efa));
 			else
-				flag= 1;
+				draw_option= DM_DRAW_OPTION_NORMAL;
 
-			if (flag != 0) { /* flag 0 == the face is hidden or invisible */
-
-				/* we always want smooth here since otherwise vertex colors dont interpolate */
-				if (mcol) {
-					if (flag==1) {
-						cp= (unsigned char*)mcol;
-					}
-				}
-				else {
-					glShadeModel(drawSmooth?GL_SMOOTH:GL_FLAT);
-				}
+			if (draw_option != DM_DRAW_OPTION_SKIP) {
 
-				glBegin(efa->v4?GL_QUADS:GL_TRIANGLES);
 				if (!drawSmooth) {
-					glNormal3fv(emdm->faceNos[i]);
+					glNormal3fv(bmdm->polyNos[BM_elem_index_get(efa)]);
 
-					if (tf) glTexCoord2fv(tf->uv[0]);
-					if (cp) glColor3ub(cp[3], cp[2], cp[1]);
-					glVertex3fv(vertexCos[(int) efa->v1->tmp.l]);
+					bmdm_get_tri_tex(bm, ls, luv, lcol, has_uv, has_vcol);
 
-					if (tf) glTexCoord2fv(tf->uv[1]);
-					if (cp) glColor3ub(cp[7], cp[6], cp[5]);
-					glVertex3fv(vertexCos[(int) efa->v2->tmp.l]);
+					glTexCoord2fv(luv[0]->uv);
+					if (lcol[0])
+						glColor3ubv((const GLubyte *)&(lcol[0]->r));
+					glVertex3fv(vertexCos[BM_elem_index_get(ls[0]->v)]);
 
-					if (tf) glTexCoord2fv(tf->uv[2]);
-					if (cp) glColor3ub(cp[11], cp[10], cp[9]);
-					glVertex3fv(vertexCos[(int) efa->v3->tmp.l]);
+					glTexCoord2fv(luv[1]->uv);
+					if (lcol[1])
+						glColor3ubv((const GLubyte *)&(lcol[1]->r));
+					glVertex3fv(vertexCos[BM_elem_index_get(ls[1]->v)]);
 
-					if (efa->v4) {
-						if (tf) glTexCoord2fv(tf->uv[3]);
-						if (cp) glColor3ub(cp[15], cp[14], cp[13]);
-						glVertex3fv(vertexCos[(int) efa->v4->tmp.l]);
-					}
+					glTexCoord2fv(luv[2]->uv);
+					if (lcol[2])
+						glColor3ubv((const GLubyte *)&(lcol[2]->r));
+					glVertex3fv(vertexCos[BM_elem_index_get(ls[2]->v)]);
 				}
 				else {
-					if (tf) glTexCoord2fv(tf->uv[0]);
-					if (cp) glColor3ub(cp[3], cp[2], cp[1]);
-					glNormal3fv(vertexNos[(int) efa->v1->tmp.l]);
-					glVertex3fv(vertexCos[(int) efa->v1->tmp.l]);
-
-					if (tf) glTexCoord2fv(tf->uv[1]);
-					if (cp) glColor3ub(cp[7], cp[6], cp[5]);
-					glNormal3fv(vertexNos[(int) efa->v2->tmp.l]);
-					glVertex3fv(vertexCos[(int) efa->v2->tmp.l]);
-
-					if (tf) glTexCoord2fv(tf->uv[2]);
-					if (cp) glColor3ub(cp[11], cp[10], cp[9]);
-					glNormal3fv(vertexNos[(int) efa->v3->tmp.l]);
-					glVertex3fv(vertexCos[(int) efa->v3->tmp.l]);
-
-					if (efa->v4) {
-						if (tf) glTexCoord2fv(tf->uv[3]);
-						if (cp) glColor3ub(cp[15], cp[14], cp[13]);
-						glNormal3fv(vertexNos[(int) efa->v4->tmp.l]);
-						glVertex3fv(vertexCos[(int) efa->v4->tmp.l]);
-					}
+					bmdm_get_tri_tex(bm, ls, luv, lcol, has_uv, has_vcol);
+
+					glTexCoord2fv(luv[0]->uv);
+					if (lcol[0])
+						glColor3ubv((const GLubyte *)&(lcol[0]->r));
+					glNormal3fv(vertexNos[BM_elem_index_get(ls[0]->v)]);
+					glVertex3fv(vertexCos[BM_elem_index_get(ls[0]->v)]);
+
+					glTexCoord2fv(luv[1]->uv);
+					if (lcol[1])
+						glColor3ubv((const GLubyte *)&(lcol[1]->r));
+					glNormal3fv(vertexNos[BM_elem_index_get(ls[1]->v)]);
+					glVertex3fv(vertexCos[BM_elem_index_get(ls[1]->v)]);
+
+					glTexCoord2fv(luv[2]->uv);
+					if (lcol[2])
+						glColor3ubv((const GLubyte *)&(lcol[2]->r));
+					glNormal3fv(vertexNos[BM_elem_index_get(ls[2]->v)]);
+					glVertex3fv(vertexCos[BM_elem_index_get(ls[2]->v)]);
 				}
-				glEnd();
 			}
 		}
+		glEnd();
 	}
 	else {
-		for (i=0,efa= em->faces.first; efa; i++,efa= efa->next) {
-			MTFace *tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-			MCol *mcol= CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
-			unsigned char *cp= NULL;
-			int drawSmooth= (efa->flag & ME_SMOOTH);
-			int flag;
+		BM_mesh_elem_index_ensure(bm, BM_VERT);
+
+		for (i=0; i<em->tottri; i++) {
+			BMLoop **ls = em->looptris[i];
+			MTexPoly *tp= has_uv ? CustomData_bmesh_get(&bm->pdata, ls[0]->f->head.data, CD_MTEXPOLY) : NULL;
+			MTFace mtf = {{{0}}};
+			/*unsigned char *cp= NULL;*/ /*UNUSED*/
+			int drawSmooth= BM_elem_flag_test(ls[0]->f, BM_ELEM_SMOOTH);
+			DMDrawOption draw_option;
+
+			efa = ls[0]->f;
+
+			if (has_uv) {
+				ME_MTEXFACE_CPY(&mtf, tp);
+			}
 
 			if (drawParams)
-				flag= drawParams(tf, (mcol != NULL), efa->mat_nr);
+				draw_option= drawParams(&mtf, has_vcol, efa->mat_nr);
 			else if (drawParamsMapped)
-				flag= drawParamsMapped(userData, i);
+				draw_option= drawParamsMapped(userData, BM_elem_index_get(efa));
 			else
-				flag= 1;
-
-			if (flag != 0) { /* flag 0 == the face is hidden or invisible */
+				draw_option= DM_DRAW_OPTION_NORMAL;
 
-				/* we always want smooth here since otherwise vertex colors dont interpolate */
-				if (mcol) {
-					if (flag==1) {
-						cp= (unsigned char*)mcol;
-					}
-				}
-				else {
-					glShadeModel(drawSmooth?GL_SMOOTH:GL_FLAT);
-				}
+			if (draw_option != DM_DRAW_OPTION_SKIP) {
 
-				glBegin(efa->v4?GL_QUADS:GL_TRIANGLES);
+				glBegin(GL_TRIANGLES);
 				if (!drawSmooth) {
-					glNormal3fv(efa->n);
-
-					if (tf) glTexCoord2fv(tf->uv[0]);
-					if (cp) glColor3ub(cp[3], cp[2], cp[1]);
-					glVertex3fv(efa->v1->co);
-
-					if (tf) glTexCoord2fv(tf->uv[1]);
-					if (cp) glColor3ub(cp[7], cp[6], cp[5]);
-					glVertex3fv(efa->v2->co);
-
-					if (tf) glTexCoord2fv(tf->uv[2]);
-					if (cp) glColor3ub(cp[11], cp[10], cp[9]);
-					glVertex3fv(efa->v3->co);
-
-					if (efa->v4) {
-						if (tf) glTexCoord2fv(tf->uv[3]);
-						if (cp) glColor3ub(cp[15], cp[14], cp[13]);
-						glVertex3fv(efa->v4->co);
-					}
+					glNormal3fv(efa->no);
+
+					bmdm_get_tri_tex(bm, ls, luv, lcol, has_uv, has_vcol);
+
+					if (luv[0])
+						glTexCoord2fv(luv[0]->uv);
+					if (lcol[0])
+						glColor3ubv((const GLubyte *)&(lcol[0]->r));
+					glVertex3fv(ls[0]->v->co);
+
+					if (luv[1])
+						glTexCoord2fv(luv[1]->uv);
+					if (lcol[1])
+						glColor3ubv((const GLubyte *)&(lcol[1]->r));
+					glVertex3fv(ls[1]->v->co);
+
+					if (luv[2])
+						glTexCoord2fv(luv[2]->uv);
+					if (lcol[2])
+						glColor3ubv((const GLubyte *)&(lcol[2]->r));
+					glVertex3fv(ls[2]->v->co);
 				}
 				else {
-					if (tf) glTexCoord2fv(tf->uv[0]);
-					if (cp) glColor3ub(cp[3], cp[2], cp[1]);
-					glNormal3fv(efa->v1->no);
-					glVertex3fv(efa->v1->co);
-
-					if (tf) glTexCoord2fv(tf->uv[1]);
-					if (cp) glColor3ub(cp[7], cp[6], cp[5]);
-					glNormal3fv(efa->v2->no);
-					glVertex3fv(efa->v2->co);
-
-					if (tf) glTexCoord2fv(tf->uv[2]);
-					if (cp) glColor3ub(cp[11], cp[10], cp[9]);
-					glNormal3fv(efa->v3->no);
-					glVertex3fv(efa->v3->co);
-
-					if (efa->v4) {
-						if (tf) glTexCoord2fv(tf->uv[3]);
-						if (cp) glColor3ub(cp[15], cp[14], cp[13]);
-						glNormal3fv(efa->v4->no);
-						glVertex3fv(efa->v4->co);
-					}
+					bmdm_get_tri_tex(bm, ls, luv, lcol, has_uv, has_vcol);
+
+					if (luv[0])
+						glTexCoord2fv(luv[0]->uv);
+					if (lcol[0])
+						glColor3ubv((const GLubyte *)&(lcol[0]->r));
+					glNormal3fv(ls[0]->v->no);
+					glVertex3fv(ls[0]->v->co);
+
+					if (luv[1])
+						glTexCoord2fv(luv[1]->uv);
+					if (lcol[1])
+						glColor3ubv((const GLubyte *)&(lcol[1]->r));
+					glNormal3fv(ls[1]->v->no);
+					glVertex3fv(ls[1]->v->co);
+
+					if (luv[2])
+						glTexCoord2fv(luv[2]->uv);
+					if (lcol[2])
+						glColor3ubv((const GLubyte *)&(lcol[2]->r));
+					glNormal3fv(ls[2]->v->no);
+					glVertex3fv(ls[2]->v->co);
 				}
 				glEnd();
 			}
 		}
 	}
+
+	glShadeModel(GL_FLAT);
 }
 
 static void emDM_drawFacesTex(
 		DerivedMesh *dm,
-		int (*setDrawOptions)(MTFace *tface, int has_mcol, int matnr),
-		int (*compareDrawOptions)(void *userData, int cur_index, int next_index),
+		DMSetDrawOptionsTex setDrawOptions,
+		DMCompareDrawOptions compareDrawOptions,
 		void *userData)
 {
 	emDM_drawFacesTex_common(dm, setDrawOptions, NULL, compareDrawOptions, userData);
@@ -630,8 +977,8 @@ static void emDM_drawFacesTex(
 
 static void emDM_drawMappedFacesTex(
 		DerivedMesh *dm,
-		int (*setDrawOptions)(void *userData, int index),
-		int (*compareDrawOptions)(void *userData, int cur_index, int next_index),
+		DMSetDrawOptions setDrawOptions,
+		DMCompareDrawOptions compareDrawOptions,
 		void *userData)
 {
 	emDM_drawFacesTex_common(dm, NULL, setDrawOptions, compareDrawOptions, userData);
@@ -639,58 +986,60 @@ static void emDM_drawMappedFacesTex(
 
 static void emDM_drawMappedFacesGLSL(
 		DerivedMesh *dm,
-		int (*setMaterial)(int, void *attribs),
-		int (*setDrawOptions)(void *userData, int index),
+		DMSetMaterial setMaterial,
+		DMSetDrawOptions setDrawOptions,
 		void *userData)
 {
-	EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
-	EditMesh *em= emdm->em;
-	float (*vertexCos)[3]= emdm->vertexCos;
-	float (*vertexNos)[3]= emdm->vertexNos;
-	EditVert *eve;
-	EditFace *efa;
-	DMVertexAttribs attribs= {{{0}}};
+	EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
+	BMesh *bm= bmdm->tc->bm;
+	BMEditMesh *em = bmdm->tc;
+	float (*vertexCos)[3]= bmdm->vertexCos;
+	float (*vertexNos)[3]= bmdm->vertexNos;
+	BMFace *efa;
+	BMLoop **ltri;
+	DMVertexAttribs attribs;
 	GPUVertexAttribs gattribs;
-	/* int tfoffset; */ /* UNUSED */
-	int i, b, matnr, new_matnr, dodraw /* , layer */ /* UNUSED */;
+
+	int i, b, matnr, new_matnr, dodraw;
 
 	dodraw = 0;
 	matnr = -1;
 
-	/* layer = CustomData_get_layer_index(&em->fdata, CD_MTFACE); */ /* UNUSED */
-	/* tfoffset = (layer == -1)? -1: em->fdata.layers[layer].offset; */ /* UNUSED */
+	memset(&attribs, 0, sizeof(attribs));
 
 	/* always use smooth shading even for flat faces, else vertex colors wont interpolate */
 	glShadeModel(GL_SMOOTH);
+	BM_mesh_elem_index_ensure(bm, BM_VERT | BM_FACE);
 
-	for (i=0,eve=em->verts.first; eve; eve= eve->next)
-		eve->tmp.l = (intptr_t) i++;
-
-#define PASSATTRIB(efa, eve, vert) {											\
+#define PASSATTRIB(loop, eve, vert) {											\
 	if (attribs.totorco) {														\
-		float *orco = attribs.orco.array[eve->tmp.l];							\
+		float *orco = attribs.orco.array[BM_elem_index_get(eve)];						\
 		glVertexAttrib3fvARB(attribs.orco.glIndex, orco);						\
 	}																			\
 	for (b = 0; b < attribs.tottface; b++) {									\
-		MTFace *_tf = (MTFace*)((char*)efa->data + attribs.tface[b].emOffset);	\
-		glVertexAttrib2fvARB(attribs.tface[b].glIndex, _tf->uv[vert]);			\
+		MLoopUV *_luv = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, CD_MLOOPUV, b);\
+		glVertexAttrib2fvARB(attribs.tface[b].glIndex, _luv->uv);				\
 	}																			\
 	for (b = 0; b < attribs.totmcol; b++) {										\
-		MCol *cp = (MCol*)((char*)efa->data + attribs.mcol[b].emOffset);		\
-		GLubyte col[4];															\
-		col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a;				\
-		glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, col);					\
+		MLoopCol *_cp = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, CD_MLOOPCOL, b);\
+		GLubyte _col[4];														\
+		_col[0]= _cp->b; _col[1]= _cp->g; _col[2]= _cp->r; _col[3]= _cp->a;		\
+		glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, _col);					\
 	}																			\
 	if (attribs.tottang) {														\
 		float *tang = attribs.tang.array[i*4 + vert];							\
-		glVertexAttrib4fvARB(attribs.tang.glIndex, tang);						\
+		glVertexAttrib3fvARB(attribs.tang.glIndex, tang);						\
 	}																			\
-}
+	}
+
 
-	for (i=0,efa= em->faces.first; efa; i++,efa= efa->next) {
-		int drawSmooth= (efa->flag & ME_SMOOTH);
+	for (i=0, ltri=em->looptris[0]; i<em->tottri; i++, ltri += 3) {
+		int drawSmooth;
 
-		if (setDrawOptions && !setDrawOptions(userData, i))
+		efa = ltri[0]->f;
+		drawSmooth= BM_elem_flag_test(efa, BM_ELEM_SMOOTH);
+
+		if (setDrawOptions && (setDrawOptions(userData, BM_elem_index_get(efa)) == DM_DRAW_OPTION_SKIP))
 			continue;
 
 		new_matnr = efa->mat_nr + 1;
@@ -701,70 +1050,52 @@ static void emDM_drawMappedFacesGLSL(
 		}
 
 		if (dodraw) {
-			glBegin(efa->v4?GL_QUADS:GL_TRIANGLES);
+			glBegin(GL_TRIANGLES);
 			if (!drawSmooth) {
-				if (vertexCos) glNormal3fv(emdm->faceNos[i]);
-				else glNormal3fv(efa->n);
-
-				PASSATTRIB(efa, efa->v1, 0);
-				if (vertexCos) glVertex3fv(vertexCos[(int) efa->v1->tmp.l]);
-				else glVertex3fv(efa->v1->co);
+				if (vertexCos) glNormal3fv(bmdm->polyNos[BM_elem_index_get(efa)]);
+				else glNormal3fv(efa->no);
 
-				PASSATTRIB(efa, efa->v2, 1);
-				if (vertexCos) glVertex3fv(vertexCos[(int) efa->v2->tmp.l]);
-				else glVertex3fv(efa->v2->co);
+				PASSATTRIB(ltri[0], ltri[0]->v, 0);
+				if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]);
+				else glVertex3fv(ltri[0]->v->co);
 
-				PASSATTRIB(efa, efa->v3, 2);
-				if (vertexCos) glVertex3fv(vertexCos[(int) efa->v3->tmp.l]);
-				else glVertex3fv(efa->v3->co);
+				PASSATTRIB(ltri[1], ltri[1]->v, 1);
+				if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[1]->v)]);
+				else glVertex3fv(ltri[1]->v->co);
 
-				if (efa->v4) {
-					PASSATTRIB(efa, efa->v4, 3);
-					if (vertexCos) glVertex3fv(vertexCos[(int) efa->v4->tmp.l]);
-					else glVertex3fv(efa->v4->co);
-				}
+				PASSATTRIB(ltri[2], ltri[2]->v, 2);
+				if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]);
+				else glVertex3fv(ltri[2]->v->co);
 			}
 			else {
-				PASSATTRIB(efa, efa->v1, 0);
+				PASSATTRIB(ltri[0], ltri[0]->v, 0);
 				if (vertexCos) {
-					glNormal3fv(vertexNos[(int) efa->v1->tmp.l]);
-					glVertex3fv(vertexCos[(int) efa->v1->tmp.l]);
+					glNormal3fv(vertexNos[BM_elem_index_get(ltri[0]->v)]);
+					glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]);
 				}
 				else {
-					glNormal3fv(efa->v1->no);
-					glVertex3fv(efa->v1->co);
+					glNormal3fv(ltri[0]->v->no);
+					glVertex3fv(ltri[0]->v->co);
 				}
 
-				PASSATTRIB(efa, efa->v2, 1);
+				PASSATTRIB(ltri[1], ltri[1]->v, 1);
 				if (vertexCos) {
-					glNormal3fv(vertexNos[(int) efa->v2->tmp.l]);
-					glVertex3fv(vertexCos[(int) efa->v2->tmp.l]);
+					glNormal3fv(vertexNos[BM_elem_index_get(ltri[1]->v)]);
+					glVertex3fv(vertexCos[BM_elem_index_get(ltri[1]->v)]);
 				}
 				else {
-					glNormal3fv(efa->v2->no);
-					glVertex3fv(efa->v2->co);
+					glNormal3fv(ltri[1]->v->no);
+					glVertex3fv(ltri[1]->v->co);
 				}
 
-				PASSATTRIB(efa, efa->v3, 2);
+				PASSATTRIB(ltri[2], ltri[2]->v, 2);
 				if (vertexCos) {
-					glNormal3fv(vertexNos[(int) efa->v3->tmp.l]);
-					glVertex3fv(vertexCos[(int) efa->v3->tmp.l]);
+					glNormal3fv(vertexNos[BM_elem_index_get(ltri[2]->v)]);
+					glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]);
 				}
 				else {
-					glNormal3fv(efa->v3->no);
-					glVertex3fv(efa->v3->co);
-				}
-
-				if (efa->v4) {
-					PASSATTRIB(efa, efa->v4, 3);
-					if (vertexCos) {
-						glNormal3fv(vertexNos[(int) efa->v4->tmp.l]);
-						glVertex3fv(vertexCos[(int) efa->v4->tmp.l]);
-					}
-					else {
-						glNormal3fv(efa->v4->no);
-						glVertex3fv(efa->v4->co);
-					}
+					glNormal3fv(ltri[2]->v->no);
+					glVertex3fv(ltri[2]->v->co);
 				}
 			}
 			glEnd();
@@ -785,12 +1116,13 @@ static void emDM_drawMappedFacesMat(
 		void (*setMaterial)(void *userData, int, void *attribs),
 		int (*setFace)(void *userData, int index), void *userData)
 {
-	EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
-	EditMesh *em= emdm->em;
-	float (*vertexCos)[3]= emdm->vertexCos;
-	float (*vertexNos)[3]= emdm->vertexNos;
-	EditVert *eve;
-	EditFace *efa;
+	EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
+	BMesh *bm= bmdm->tc->bm;
+	BMEditMesh *em = bmdm->tc;
+	float (*vertexCos)[3]= bmdm->vertexCos;
+	float (*vertexNos)[3]= bmdm->vertexNos;
+	BMFace *efa;
+	BMLoop **ltri;
 	DMVertexAttribs attribs= {{{0}}};
 	GPUVertexAttribs gattribs;
 	int i, b, matnr, new_matnr;
@@ -800,29 +1132,28 @@ static void emDM_drawMappedFacesMat(
 	/* always use smooth shading even for flat faces, else vertex colors wont interpolate */
 	glShadeModel(GL_SMOOTH);
 
-	for (i=0,eve=em->verts.first; eve; eve= eve->next)
-		eve->tmp.l = (intptr_t) i++;
+	BM_mesh_elem_index_ensure(bm, BM_VERT|BM_FACE);
 
-#define PASSATTRIB(efa, eve, vert) {											\
+#define PASSATTRIB(loop, eve, vert) {											\
 	if (attribs.totorco) {														\
-		float *orco = attribs.orco.array[eve->tmp.l];							\
+		float *orco = attribs.orco.array[BM_elem_index_get(eve)];				\
 		if (attribs.orco.glTexco)												\
 			glTexCoord3fv(orco);												\
 		else																	\
 			glVertexAttrib3fvARB(attribs.orco.glIndex, orco);					\
 	}																			\
 	for (b = 0; b < attribs.tottface; b++) {									\
-		MTFace *_tf = (MTFace*)((char*)efa->data + attribs.tface[b].emOffset);	\
+		MLoopUV *_luv = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, CD_MLOOPUV, b);\
 		if (attribs.tface[b].glTexco)											\
-			glTexCoord2fv(_tf->uv[vert]);										\
+			glTexCoord2fv(_luv->uv);											\
 		else																	\
-			glVertexAttrib2fvARB(attribs.tface[b].glIndex, _tf->uv[vert]);		\
+			glVertexAttrib2fvARB(attribs.tface[b].glIndex, _luv->uv);			\
 	}																			\
 	for (b = 0; b < attribs.totmcol; b++) {										\
-		MCol *cp = (MCol*)((char*)efa->data + attribs.mcol[b].emOffset);		\
-		GLubyte col[4];															\
-		col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a;				\
-		glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, col);					\
+		MLoopCol *_cp = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, CD_MLOOPCOL, b);\
+		GLubyte _col[4];														\
+		_col[0]= _cp->b; _col[1]= _cp->g; _col[2]= _cp->r; _col[3]= _cp->a;		\
+		glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, _col);					\
 	}																			\
 	if (attribs.tottang) {														\
 		float *tang = attribs.tang.array[i*4 + vert];							\
@@ -830,11 +1161,14 @@ static void emDM_drawMappedFacesMat(
 	}																			\
 }
 
-	for (i=0,efa= em->faces.first; efa; i++,efa= efa->next) {
-		int drawSmooth= (efa->flag & ME_SMOOTH);
+	for (i=0, ltri=em->looptris[0]; i<em->tottri; i++, ltri += 3) {
+		int drawSmooth;
+
+		efa = ltri[0]->f;
+		drawSmooth = BM_elem_flag_test(efa, BM_ELEM_SMOOTH);
 
 		/* face hiding */
-		if (setFace && !setFace(userData, i))
+		if (setFace && !setFace(userData, BM_elem_index_get(efa)))
 			continue;
 
 		/* material */
@@ -845,70 +1179,53 @@ static void emDM_drawMappedFacesMat(
 		}
 
 		/* face */
-		glBegin(efa->v4?GL_QUADS:GL_TRIANGLES);
+		glBegin(GL_TRIANGLES);
 		if (!drawSmooth) {
-			if (vertexCos) glNormal3fv(emdm->faceNos[i]);
-			else glNormal3fv(efa->n);
+			if (vertexCos) glNormal3fv(bmdm->polyNos[BM_elem_index_get(efa)]);
+			else glNormal3fv(efa->no);
 
-			PASSATTRIB(efa, efa->v1, 0);
-			if (vertexCos) glVertex3fv(vertexCos[(int) efa->v1->tmp.l]);
-			else glVertex3fv(efa->v1->co);
+			PASSATTRIB(ltri[0], ltri[0]->v, 0);
+			if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]);
+			else glVertex3fv(ltri[0]->v->co);
 
-			PASSATTRIB(efa, efa->v2, 1);
-			if (vertexCos) glVertex3fv(vertexCos[(int) efa->v2->tmp.l]);
-			else glVertex3fv(efa->v2->co);
+			PASSATTRIB(ltri[1], ltri[1]->v, 1);
+			if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[1]->v)]);
+			else glVertex3fv(ltri[1]->v->co);
 
-			PASSATTRIB(efa, efa->v3, 2);
-			if (vertexCos) glVertex3fv(vertexCos[(int) efa->v3->tmp.l]);
-			else glVertex3fv(efa->v3->co);
+			PASSATTRIB(ltri[2], ltri[2]->v, 2);
+			if (vertexCos) glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]);
+			else glVertex3fv(ltri[2]->v->co);
 
-			if (efa->v4) {
-				PASSATTRIB(efa, efa->v4, 3);
-				if (vertexCos) glVertex3fv(vertexCos[(int) efa->v4->tmp.l]);
-				else glVertex3fv(efa->v4->co);
-			}
 		}
 		else {
-			PASSATTRIB(efa, efa->v1, 0);
+			PASSATTRIB(ltri[0], ltri[0]->v, 0);
 			if (vertexCos) {
-				glNormal3fv(vertexNos[(int) efa->v1->tmp.l]);
-				glVertex3fv(vertexCos[(int) efa->v1->tmp.l]);
+				glNormal3fv(vertexNos[BM_elem_index_get(ltri[0]->v)]);
+				glVertex3fv(vertexCos[BM_elem_index_get(ltri[0]->v)]);
 			}
 			else {
-				glNormal3fv(efa->v1->no);
-				glVertex3fv(efa->v1->co);
+				glNormal3fv(ltri[0]->v->no);
+				glVertex3fv(ltri[0]->v->co);
 			}
 
-			PASSATTRIB(efa, efa->v2, 1);
+			PASSATTRIB(ltri[1], ltri[1]->v, 1);
 			if (vertexCos) {
-				glNormal3fv(vertexNos[(int) efa->v2->tmp.l]);
-				glVertex3fv(vertexCos[(int) efa->v2->tmp.l]);
+				glNormal3fv(vertexNos[BM_elem_index_get(ltri[1]->v)]);
+				glVertex3fv(vertexCos[BM_elem_index_get(ltri[1]->v)]);
 			}
 			else {
-				glNormal3fv(efa->v2->no);
-				glVertex3fv(efa->v2->co);
+				glNormal3fv(ltri[1]->v->no);
+				glVertex3fv(ltri[1]->v->co);
 			}
 
-			PASSATTRIB(efa, efa->v3, 2);
+			PASSATTRIB(ltri[2], ltri[2]->v, 2);
 			if (vertexCos) {
-				glNormal3fv(vertexNos[(int) efa->v3->tmp.l]);
-				glVertex3fv(vertexCos[(int) efa->v3->tmp.l]);
+				glNormal3fv(vertexNos[BM_elem_index_get(ltri[2]->v)]);
+				glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]);
 			}
 			else {
-				glNormal3fv(efa->v3->no);
-				glVertex3fv(efa->v3->co);
-			}
-
-			if (efa->v4) {
-				PASSATTRIB(efa, efa->v4, 3);
-				if (vertexCos) {
-					glNormal3fv(vertexNos[(int) efa->v4->tmp.l]);
-					glVertex3fv(vertexCos[(int) efa->v4->tmp.l]);
-				}
-				else {
-					glNormal3fv(efa->v4->no);
-					glVertex3fv(efa->v4->co);
-				}
+				glNormal3fv(ltri[2]->v->no);
+				glVertex3fv(ltri[2]->v->co);
 			}
 		}
 		glEnd();
@@ -918,14 +1235,16 @@ static void emDM_drawMappedFacesMat(
 
 static void emDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3])
 {
-	EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
-	EditVert *eve;
+	EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
+	BMVert *eve;
+	BMIter iter;
 	int i;
 
-	if (emdm->em->verts.first) {
-		for (i=0,eve= emdm->em->verts.first; eve; i++,eve= eve->next) {
-			if (emdm->vertexCos) {
-				DO_MINMAX(emdm->vertexCos[i], min_r, max_r);
+	if (bmdm->tc->bm->totvert) {
+		eve = BM_iter_new(&iter, bmdm->tc->bm, BM_VERTS_OF_MESH, NULL);
+		for (i=0; eve; eve=BM_iter_step(&iter), i++) {
+			if (bmdm->vertexCos) {
+				DO_MINMAX(bmdm->vertexCos[i], min_r, max_r);
 			}
 			else {
 				DO_MINMAX(eve->co, min_r, max_r);
@@ -933,241 +1252,298 @@ static void emDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3])
 		}
 	}
 	else {
-		min_r[0] = min_r[1] = min_r[2] = max_r[0] = max_r[1] = max_r[2] = 0.0;
+		zero_v3(min_r);
+		zero_v3(max_r);
 	}
 }
 static int emDM_getNumVerts(DerivedMesh *dm)
 {
-	EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
+	EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
 
-	return BLI_countlist(&emdm->em->verts);
+	return bmdm->tc->bm->totvert;
 }
 
 static int emDM_getNumEdges(DerivedMesh *dm)
 {
-	EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
+	EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
 
-	return BLI_countlist(&emdm->em->edges);
+	return bmdm->tc->bm->totedge;
 }
 
-static int emDM_getNumFaces(DerivedMesh *dm)
+static int emDM_getNumTessFaces(DerivedMesh *dm)
 {
-	EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
+	EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
 
-	return BLI_countlist(&emdm->em->faces);
+	return bmdm->tc->tottri;
 }
 
-static void emDM_getVertCos(DerivedMesh *dm, float (*cos_r)[3])
+static int emDM_getNumLoops(DerivedMesh *dm)
 {
-	EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
-	EditVert *eve;
-	int i;
+	EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
 
-	for (i=0,eve= emdm->em->verts.first; eve; i++,eve=eve->next) {
-		if (emdm->vertexCos) {
-			copy_v3_v3(cos_r[i], emdm->vertexCos[i]);
-		}
-		else {
-			copy_v3_v3(cos_r[i], eve->co);
-		}
-	}
+	return bmdm->tc->bm->totloop;
 }
 
-static void emDM_getVert(DerivedMesh *dm, int index, MVert *vert_r)
+static int emDM_getNumPolys(DerivedMesh *dm)
 {
-	EditVert *ev = ((EditMeshDerivedMesh *)dm)->em->verts.first;
-	int i;
+	EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
 
-	for (i = 0; i < index; ++i) ev = ev->next;
+	return bmdm->tc->bm->totface;
+}
 
+static int bmvert_to_mvert(BMesh *bm, BMVert *ev, MVert *vert_r)
+{
 	copy_v3_v3(vert_r->co, ev->co);
 
 	normal_float_to_short_v3(vert_r->no, ev->no);
 
-	/* TODO what to do with vert_r->flag? */
-	vert_r->bweight = (unsigned char) (ev->bweight*255.0f);
+	vert_r->flag = BM_vert_flag_to_mflag(ev);
+
+	if (CustomData_has_layer(&bm->vdata, CD_BWEIGHT)) {
+		vert_r->bweight = (unsigned char) (BM_elem_float_data_get(&bm->vdata, ev, CD_BWEIGHT)*255.0f);
+	}
+
+	return 1;
+}
+
+static void emDM_getVert(DerivedMesh *dm, int index, MVert *vert_r)
+{
+	EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
+	BMVert *ev;
+
+	if (index < 0 || index >= bmdm->tv) {
+		printf("error in emDM_getVert.\n");
+		return;
+	}
+
+	// ev = EDBM_vert_at_index(bmdm->tc, index);
+	ev = BM_vert_at_index(bmdm->tc->bm, index); /* warning, does list loop, _not_ ideal */
+
+	bmvert_to_mvert(bmdm->tc->bm, ev, vert_r);
+	if (bmdm->vertexCos)
+		copy_v3_v3(vert_r->co, bmdm->vertexCos[index]);
 }
 
 static void emDM_getEdge(DerivedMesh *dm, int index, MEdge *edge_r)
 {
-	EditMesh *em = ((EditMeshDerivedMesh *)dm)->em;
-	EditEdge *ee = em->edges.first;
-	EditVert *ev, *v1, *v2;
-	int i;
+	EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
+	BMesh *bm = bmdm->tc->bm;
+	BMEdge *e;
 
-	for (i = 0; i < index; ++i) ee = ee->next;
+	if (index < 0 || index >= bmdm->te) {
+		printf("error in emDM_getEdge.\n");
+		return;
+	}
 
-	edge_r->crease = (unsigned char) (ee->crease*255.0f);
-	edge_r->bweight = (unsigned char) (ee->bweight*255.0f);
-	/* TODO what to do with edge_r->flag? */
-	edge_r->flag = ME_EDGEDRAW|ME_EDGERENDER;
-	if (ee->seam) edge_r->flag |= ME_SEAM;
-	if (ee->sharp) edge_r->flag |= ME_SHARP;
-#if 0
-	/* this needs setup of f2 field */
-	if (!ee->f2) edge_r->flag |= ME_LOOSEEDGE;
-#endif
+	// e = EDBM_edge_at_index(bmdm->tc, index);
+	e = BM_edge_at_index(bmdm->tc->bm, index); /* warning, does list loop, _not_ ideal */
 
-	/* goddamn, we have to search all verts to find indices */
-	v1 = ee->v1;
-	v2 = ee->v2;
-	for (i = 0, ev = em->verts.first; v1 || v2; i++, ev = ev->next) {
-		if (ev == v1) {
-			edge_r->v1 = i;
-			v1 = NULL;
-		}
-		if (ev == v2) {
-			edge_r->v2 = i;
-			v2 = NULL;
-		}
+	if (CustomData_has_layer(&bm->edata, CD_BWEIGHT)) {
+		edge_r->bweight = (unsigned char) (BM_elem_float_data_get(&bm->edata, e, CD_BWEIGHT)*255.0f);
+	}
+
+	if (CustomData_has_layer(&bm->edata, CD_CREASE)) {
+		edge_r->crease = (unsigned char) (BM_elem_float_data_get(&bm->edata, e, CD_CREASE)*255.0f);
 	}
+
+	edge_r->flag = BM_edge_flag_to_mflag(e);
+
+	edge_r->v1 = BM_elem_index_get(e->v1);
+	edge_r->v2 = BM_elem_index_get(e->v2);
 }
 
-static void emDM_getFace(DerivedMesh *dm, int index, MFace *face_r)
+static void emDM_getTessFace(DerivedMesh *dm, int index, MFace *face_r)
 {
-	EditMesh *em = ((EditMeshDerivedMesh *)dm)->em;
-	EditFace *ef = em->faces.first;
-	EditVert *ev, *v1, *v2, *v3, *v4;
-	int i;
+	EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
+	BMFace *ef;
+	BMLoop **l;
 
-	for (i = 0; i < index; ++i) ef = ef->next;
+	if (index < 0 || index >= bmdm->tf) {
+		printf("error in emDM_getTessFace.\n");
+		return;
+	}
 
-	face_r->mat_nr = ef->mat_nr;
-	face_r->flag = ef->flag;
+	l = bmdm->tc->looptris[index];
 
-	/* goddamn, we have to search all verts to find indices */
-	v1 = ef->v1;
-	v2 = ef->v2;
-	v3 = ef->v3;
-	v4 = ef->v4;
-	if (!v4) face_r->v4 = 0;
+	ef = l[0]->f;
 
-	for (i = 0, ev = em->verts.first; v1 || v2 || v3 || v4;
-		i++, ev = ev->next) {
-		if (ev == v1) {
-			face_r->v1 = i;
-			v1 = NULL;
-		}
-		if (ev == v2) {
-			face_r->v2 = i;
-			v2 = NULL;
-		}
-		if (ev == v3) {
-			face_r->v3 = i;
-			v3 = NULL;
-		}
-		if (ev == v4) {
-			face_r->v4 = i;
-			v4 = NULL;
-		}
-	}
+	face_r->mat_nr = (unsigned char) ef->mat_nr;
+	face_r->flag = BM_face_flag_to_mflag(ef);
 
-	test_index_face(face_r, NULL, 0, ef->v4?4:3);
+	face_r->v1 = BM_elem_index_get(l[0]->v);
+	face_r->v2 = BM_elem_index_get(l[1]->v);
+	face_r->v3 = BM_elem_index_get(l[2]->v);
+	face_r->v4 = 0;
+
+	test_index_face(face_r, NULL, 0, 3);
 }
 
 static void emDM_copyVertArray(DerivedMesh *dm, MVert *vert_r)
 {
-	EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
-	EditVert *ev = emdm->em->verts.first;
+	EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
+	BMesh *bm = bmdm->tc->bm;
+	BMVert *ev;
+	BMIter iter;
 	int i;
 
-	for (i=0; ev; ev = ev->next, ++vert_r, ++i) {
-		if (emdm->vertexCos)
-			copy_v3_v3(vert_r->co, emdm->vertexCos[i]);
+	ev = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL);
+	for (i = 0 ; ev; ev = BM_iter_step(&iter), ++vert_r, ++i) {
+		if (bmdm->vertexCos)
+			copy_v3_v3(vert_r->co, bmdm->vertexCos[i]);
 		else
 			copy_v3_v3(vert_r->co, ev->co);
 
 		normal_float_to_short_v3(vert_r->no, ev->no);
 
-		/* TODO what to do with vert_r->flag? */
-		vert_r->flag = 0;
-		vert_r->bweight = (unsigned char) (ev->bweight*255.0f);
+		vert_r->flag = BM_vert_flag_to_mflag(ev);
+
+		if (CustomData_has_layer(&bm->vdata, CD_BWEIGHT)) {
+			vert_r->bweight = (unsigned char) (BM_elem_float_data_get(&bm->vdata, ev, CD_BWEIGHT)*255.0f);
+		}
 	}
 }
 
 static void emDM_copyEdgeArray(DerivedMesh *dm, MEdge *edge_r)
 {
-	EditMesh *em = ((EditMeshDerivedMesh *)dm)->em;
-	EditEdge *ee = em->edges.first;
-	EditVert *ev;
-	int i;
+	BMesh *bm = ((EditDerivedBMesh *)dm)->tc->bm;
+	BMEdge *ee;
+	BMIter iter;
+	int has_bweight = CustomData_has_layer(&bm->edata, CD_BWEIGHT);
+	int has_crease = CustomData_has_layer(&bm->edata, CD_CREASE);
+
+	BM_mesh_elem_index_ensure(bm, BM_VERT);
+
+	ee = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, NULL);
+	for ( ; ee; ee=BM_iter_step(&iter), edge_r++) {
+		if (has_bweight) {
+			edge_r->bweight = (unsigned char) (BM_elem_float_data_get(&bm->edata, ee, CD_BWEIGHT)*255.0f);
+		}
 
-	/* store vertex indices in tmp union */
-	for (ev = em->verts.first, i = 0; ev; ev = ev->next, ++i)
-		ev->tmp.l = (intptr_t) i;
-
-	for ( ; ee; ee = ee->next, ++edge_r) {
-		edge_r->crease = (unsigned char) (ee->crease*255.0f);
-		edge_r->bweight = (unsigned char) (ee->bweight*255.0f);
-		/* TODO what to do with edge_r->flag? */
-		edge_r->flag = ME_EDGEDRAW|ME_EDGERENDER;
-		if (ee->seam) edge_r->flag |= ME_SEAM;
-		if (ee->sharp) edge_r->flag |= ME_SHARP;
-#if 0
-		/* this needs setup of f2 field */
-		if (!ee->f2) edge_r->flag |= ME_LOOSEEDGE;
-#endif
+		if (has_crease) {
+			edge_r->crease = (unsigned char) (BM_elem_float_data_get(&bm->edata, ee, CD_CREASE)*255.0f);
+		}
+
+		edge_r->flag = BM_edge_flag_to_mflag(ee);
 
-		edge_r->v1 = (int)ee->v1->tmp.l;
-		edge_r->v2 = (int)ee->v2->tmp.l;
+		edge_r->v1 = BM_elem_index_get(ee->v1);
+		edge_r->v2 = BM_elem_index_get(ee->v2);
 	}
 }
 
-static void emDM_copyFaceArray(DerivedMesh *dm, MFace *face_r)
+static void emDM_copyTessFaceArray(DerivedMesh *dm, MFace *face_r)
 {
-	EditMesh *em = ((EditMeshDerivedMesh *)dm)->em;
-	EditFace *ef = em->faces.first;
-	EditVert *ev;
+	EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
+	BMesh *bm = bmdm->tc->bm;
+	BMFace *ef;
+	BMLoop **l;
 	int i;
 
-	/* store vertexes indices in tmp union */
-	for (ev = em->verts.first, i = 0; ev; ev = ev->next, ++i)
-		ev->tmp.l = (intptr_t) i;
+	BM_mesh_elem_index_ensure(bm, BM_VERT);
+
+	for (i=0; i<bmdm->tc->tottri; i++, face_r++) {
+		l = bmdm->tc->looptris[i];
+		ef = l[0]->f;
 
-	for ( ; ef; ef = ef->next, ++face_r) {
-		face_r->mat_nr = ef->mat_nr;
-		face_r->flag = ef->flag;
+		face_r->mat_nr = (unsigned char) ef->mat_nr;
 
-		face_r->v1 = (int)ef->v1->tmp.l;
-		face_r->v2 = (int)ef->v2->tmp.l;
-		face_r->v3 = (int)ef->v3->tmp.l;
-		if (ef->v4) face_r->v4 = (int)ef->v4->tmp.l;
-		else face_r->v4 = 0;
+		face_r->flag = BM_face_flag_to_mflag(ef);
 
-		test_index_face(face_r, NULL, 0, ef->v4?4:3);
+		face_r->v1 = BM_elem_index_get(l[0]->v);
+		face_r->v2 = BM_elem_index_get(l[1]->v);
+		face_r->v3 = BM_elem_index_get(l[2]->v);
+		face_r->v4 = 0;
+
+		test_index_face(face_r, NULL, 0, 3);
 	}
 }
 
-static void *emDM_getFaceDataArray(DerivedMesh *dm, int type)
+
+static void emDM_copyLoopArray(DerivedMesh *dm, MLoop *loop_r)
 {
-	EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
-	EditMesh *em= emdm->em;
-	EditFace *efa;
-	char *data, *emdata;
+	EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
+	BMesh *bm = bmdm->tc->bm;
+	BMIter iter, liter;
+	BMFace *f;
+	BMLoop *l;
+
+	BM_mesh_elem_index_ensure(bm, BM_VERT | BM_EDGE);
+
+	BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+		BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+			loop_r->v = BM_elem_index_get(l->v);
+			loop_r->e = BM_elem_index_get(l->e);
+			loop_r++;
+		}
+	}
+}
+
+static void emDM_copyPolyArray(DerivedMesh *dm, MPoly *poly_r)
+{
+	EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
+	BMesh *bm = bmdm->tc->bm;
+	BMIter iter;
+	BMFace *f;
+	int i;
+
+	i = 0;
+	BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+		poly_r->flag = BM_face_flag_to_mflag(f);
+		poly_r->loopstart = i;
+		poly_r->totloop = f->len;
+		poly_r->mat_nr = f->mat_nr;
+
+		poly_r++;
+		i += f->len;
+	}
+}
+
+static void *emDM_getTessFaceDataArray(DerivedMesh *dm, int type)
+{
+	EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
+	BMesh *bm= bmdm->tc->bm;
 	void *datalayer;
-	int index, size;
 
-	datalayer = DM_get_face_data_layer(dm, type);
+	datalayer = DM_get_tessface_data_layer(dm, type);
 	if (datalayer)
 		return datalayer;
 
 	/* layers are store per face for editmesh, we convert to a temporary
 	 * data layer array in the derivedmesh when these are requested */
 	if (type == CD_MTFACE || type == CD_MCOL) {
-		index = CustomData_get_layer_index(&em->fdata, type);
+		const int type_from = (type == CD_MTFACE) ? CD_MTEXPOLY : CD_MLOOPCOL;
+		int index;
+		char *data, *bmdata;
+		index = CustomData_get_layer_index(&bm->pdata, type_from);
 
 		if (index != -1) {
-			/* int offset = em->fdata.layers[index].offset; */ /* UNUSED */
-			size = CustomData_sizeof(type);
+			/* offset = bm->pdata.layers[index].offset; */ /* UNUSED */
+			const int size = CustomData_sizeof(type);
+			int i, j;
 
-			DM_add_face_layer(dm, type, CD_CALLOC, NULL);
+			DM_add_tessface_layer(dm, type, CD_CALLOC, NULL);
 			index = CustomData_get_layer_index(&dm->faceData, type);
 			dm->faceData.layers[index].flag |= CD_FLAG_TEMPORARY;
 
-			data = datalayer = DM_get_face_data_layer(dm, type);
-			for (efa=em->faces.first; efa; efa=efa->next, data+=size) {
-				emdata = CustomData_em_get(&em->fdata, efa->data, type);
-				memcpy(data, emdata, size);
+			data = datalayer = DM_get_tessface_data_layer(dm, type);
+
+			if (type == CD_MTFACE) {
+				for (i = 0; i < bmdm->tc->tottri; i++, data += size) {
+					BMFace *efa = bmdm->tc->looptris[i][0]->f;
+					bmdata = CustomData_bmesh_get(&bm->pdata, efa->head.data, CD_MTEXPOLY);
+					ME_MTEXFACE_CPY(((MTFace *)data), ((MTexPoly *)bmdata));
+					for (j = 0; j < 3; j++) {
+						bmdata = CustomData_bmesh_get(&bm->ldata, bmdm->tc->looptris[i][j]->head.data, CD_MLOOPUV);
+						copy_v2_v2(((MTFace *)data)->uv[j], ((MLoopUV *)bmdata)->uv);
+					}
+				}
+			}
+			else {
+				for (i = 0; i < bmdm->tc->tottri; i++, data += size) {
+					for (j = 0; j < 3; j++) {
+						bmdata = CustomData_bmesh_get(&bm->ldata, bmdm->tc->looptris[i][j]->head.data, CD_MLOOPCOL);
+						MESH_MLOOPCOL_TO_MCOL(((MLoopCol *)bmdata), (((MCol *)data) + j));
+					}
+				}
 			}
 		}
 	}
@@ -1175,120 +1551,198 @@ static void *emDM_getFaceDataArray(DerivedMesh *dm, int type)
 	return datalayer;
 }
 
+static void emDM_getVertCos(DerivedMesh *dm, float (*cos_r)[3])
+{
+	EditDerivedBMesh *emdm= (EditDerivedBMesh*) dm;
+	BMVert *eve;
+	BMIter iter;
+	int i;
+
+	i= 0;
+	BM_ITER_MESH (eve, &iter, emdm->tc->bm, BM_VERTS_OF_MESH) {
+		if (emdm->vertexCos) {
+			copy_v3_v3(cos_r[i], emdm->vertexCos[i]);
+		}
+		else {
+			copy_v3_v3(cos_r[i], eve->co);
+		}
+
+		i++;
+	}
+}
+
 static void emDM_release(DerivedMesh *dm)
 {
-	EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
+	EditDerivedBMesh *bmdm= (EditDerivedBMesh *)dm;
 
 	if (DM_release(dm)) {
-		if (emdm->vertexCos) {
-			MEM_freeN(emdm->vertexCos);
-			MEM_freeN(emdm->vertexNos);
-			MEM_freeN(emdm->faceNos);
+		if (bmdm->vertexCos) {
+			MEM_freeN(bmdm->vertexCos);
+			MEM_freeN(bmdm->vertexNos);
+			MEM_freeN(bmdm->polyNos);
 		}
 
-		MEM_freeN(emdm);
+		MEM_freeN(bmdm);
 	}
 }
 
-DerivedMesh *editmesh_get_derived(
-		EditMesh *em,
-		float (*vertexCos)[3])
+static CustomData *bmDm_getVertDataLayout(DerivedMesh *dm)
 {
-	EditMeshDerivedMesh *emdm = MEM_callocN(sizeof(*emdm), "emdm");
+	EditDerivedBMesh *bmdm = (EditDerivedBMesh*)dm;
+
+	return &bmdm->tc->bm->vdata;
+}
 
-	DM_init(&emdm->dm, DM_TYPE_EDITMESH, BLI_countlist(&em->verts),
-					 BLI_countlist(&em->edges), BLI_countlist(&em->faces));
+static CustomData *bmDm_getEdgeDataLayout(DerivedMesh *dm)
+{
+	EditDerivedBMesh *bmdm = (EditDerivedBMesh*)dm;
 
-	emdm->dm.getMinMax = emDM_getMinMax;
+	return &bmdm->tc->bm->edata;
+}
 
-	emdm->dm.getNumVerts = emDM_getNumVerts;
-	emdm->dm.getNumEdges = emDM_getNumEdges;
-	emdm->dm.getNumFaces = emDM_getNumFaces;
+static CustomData *bmDm_getTessFaceDataLayout(DerivedMesh *dm)
+{
+	EditDerivedBMesh *bmdm = (EditDerivedBMesh*)dm;
 
-	emdm->dm.getVertCos = emDM_getVertCos;
+	return &bmdm->dm.faceData;
+}
 
-	emdm->dm.getVert = emDM_getVert;
-	emdm->dm.getEdge = emDM_getEdge;
-	emdm->dm.getFace = emDM_getFace;
-	emdm->dm.copyVertArray = emDM_copyVertArray;
-	emdm->dm.copyEdgeArray = emDM_copyEdgeArray;
-	emdm->dm.copyFaceArray = emDM_copyFaceArray;
-	emdm->dm.getFaceDataArray = emDM_getFaceDataArray;
+static CustomData *bmDm_getLoopDataLayout(DerivedMesh *dm)
+{
+	EditDerivedBMesh *bmdm = (EditDerivedBMesh*)dm;
 
-	emdm->dm.foreachMappedVert = emDM_foreachMappedVert;
-	emdm->dm.foreachMappedEdge = emDM_foreachMappedEdge;
-	emdm->dm.foreachMappedFaceCenter = emDM_foreachMappedFaceCenter;
+	return &bmdm->tc->bm->ldata;
+}
 
-	emdm->dm.drawEdges = emDM_drawEdges;
-	emdm->dm.drawMappedEdges = emDM_drawMappedEdges;
-	emdm->dm.drawMappedEdgesInterp = emDM_drawMappedEdgesInterp;
-	emdm->dm.drawMappedFaces = emDM_drawMappedFaces;
-	emdm->dm.drawMappedFacesTex = emDM_drawMappedFacesTex;
-	emdm->dm.drawMappedFacesGLSL = emDM_drawMappedFacesGLSL;
-	emdm->dm.drawFacesTex = emDM_drawFacesTex;
-	emdm->dm.drawFacesGLSL = emDM_drawFacesGLSL;
-	emdm->dm.drawMappedFacesMat = emDM_drawMappedFacesMat;
-	emdm->dm.drawUVEdges = emDM_drawUVEdges;
+static CustomData *bmDm_getPolyDataLayout(DerivedMesh *dm)
+{
+	EditDerivedBMesh *bmdm = (EditDerivedBMesh*)dm;
 
-	emdm->dm.release = emDM_release;
+	return &bmdm->tc->bm->pdata;
+}
 
-	emdm->em = em;
-	emdm->vertexCos = vertexCos;
 
-	if (CustomData_has_layer(&em->vdata, CD_MDEFORMVERT)) {
-		EditVert *eve;
+DerivedMesh *getEditDerivedBMesh(
+		BMEditMesh *em,
+		Object *UNUSED(ob),
+		float (*vertexCos)[3])
+{
+	EditDerivedBMesh *bmdm = MEM_callocN(sizeof(*bmdm), __func__);
+	BMesh *bm = em->bm;
+
+	bmdm->tc = em;
+
+	DM_init((DerivedMesh*)bmdm, DM_TYPE_EDITBMESH, em->bm->totvert,
+		 em->bm->totedge, em->tottri, em->bm->totloop, em->bm->totface);
+
+	bmdm->dm.getVertCos = emDM_getVertCos;
+	bmdm->dm.getMinMax = emDM_getMinMax;
+
+	bmdm->dm.getVertDataLayout = bmDm_getVertDataLayout;
+	bmdm->dm.getEdgeDataLayout = bmDm_getEdgeDataLayout;
+	bmdm->dm.getTessFaceDataLayout = bmDm_getTessFaceDataLayout;
+	bmdm->dm.getLoopDataLayout = bmDm_getLoopDataLayout;
+	bmdm->dm.getPolyDataLayout = bmDm_getPolyDataLayout;
+
+	bmdm->dm.getNumVerts = emDM_getNumVerts;
+	bmdm->dm.getNumEdges = emDM_getNumEdges;
+	bmdm->dm.getNumTessFaces = emDM_getNumTessFaces;
+	bmdm->dm.getNumLoops = emDM_getNumLoops;
+	bmdm->dm.getNumPolys = emDM_getNumPolys;
+
+	bmdm->dm.getVert = emDM_getVert;
+	bmdm->dm.getEdge = emDM_getEdge;
+	bmdm->dm.getTessFace = emDM_getTessFace;
+	bmdm->dm.copyVertArray = emDM_copyVertArray;
+	bmdm->dm.copyEdgeArray = emDM_copyEdgeArray;
+	bmdm->dm.copyTessFaceArray = emDM_copyTessFaceArray;
+	bmdm->dm.copyLoopArray = emDM_copyLoopArray;
+	bmdm->dm.copyPolyArray = emDM_copyPolyArray;
+
+	bmdm->dm.getTessFaceDataArray = emDM_getTessFaceDataArray;
+
+	bmdm->dm.calcNormals = emDM_calcNormals;
+	bmdm->dm.recalcTessellation = emDM_recalcTessellation;
+
+	bmdm->dm.foreachMappedVert = emDM_foreachMappedVert;
+	bmdm->dm.foreachMappedEdge = emDM_foreachMappedEdge;
+	bmdm->dm.foreachMappedFaceCenter = emDM_foreachMappedFaceCenter;
+
+	bmdm->dm.drawEdges = emDM_drawEdges;
+	bmdm->dm.drawMappedEdges = emDM_drawMappedEdges;
+	bmdm->dm.drawMappedEdgesInterp = emDM_drawMappedEdgesInterp;
+	bmdm->dm.drawMappedFaces = emDM_drawMappedFaces;
+	bmdm->dm.drawMappedFacesTex = emDM_drawMappedFacesTex;
+	bmdm->dm.drawMappedFacesGLSL = emDM_drawMappedFacesGLSL;
+	bmdm->dm.drawMappedFacesMat = emDM_drawMappedFacesMat;
+	bmdm->dm.drawFacesTex = emDM_drawFacesTex;
+	bmdm->dm.drawFacesGLSL = emDM_drawFacesGLSL;
+	bmdm->dm.drawUVEdges = emDM_drawUVEdges;
+
+	bmdm->dm.release = emDM_release;
+
+	bmdm->vertexCos = vertexCos;
+
+	if (CustomData_has_layer(&bm->vdata, CD_MDEFORMVERT)) {
+		BMIter iter;
+		BMVert *eve;
 		int i;
 
-		DM_add_vert_layer(&emdm->dm, CD_MDEFORMVERT, CD_CALLOC, NULL);
+		DM_add_vert_layer(&bmdm->dm, CD_MDEFORMVERT, CD_CALLOC, NULL);
 
-		for (eve = em->verts.first, i = 0; eve; eve = eve->next, ++i)
-			DM_set_vert_data(&emdm->dm, i, CD_MDEFORMVERT,
-							 CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT));
+		eve = BM_iter_new(&iter, bmdm->tc->bm, BM_VERTS_OF_MESH, NULL);
+		for (i=0; eve; eve=BM_iter_step(&iter), i++)
+			DM_set_vert_data(&bmdm->dm, i, CD_MDEFORMVERT,
+							 CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_MDEFORMVERT));
 	}
 
 	if (vertexCos) {
-		EditVert *eve;
-		EditFace *efa;
-		int totface = BLI_countlist(&em->faces);
+		BMFace *efa;
+		BMVert *eve;
+		BMIter fiter;
+		BMIter viter;
 		int i;
 
-		for (i=0,eve=em->verts.first; eve; eve= eve->next)
-			eve->tmp.l = (intptr_t) i++;
-
-		emdm->vertexNos = MEM_callocN(sizeof(*emdm->vertexNos)*i, "emdm_vno");
-		emdm->faceNos = MEM_mallocN(sizeof(*emdm->faceNos)*totface, "emdm_vno");
+		BM_mesh_elem_index_ensure(bm, BM_VERT);
 
-		for (i=0, efa= em->faces.first; efa; i++, efa=efa->next) {
-			float *v1 = vertexCos[(int) efa->v1->tmp.l];
-			float *v2 = vertexCos[(int) efa->v2->tmp.l];
-			float *v3 = vertexCos[(int) efa->v3->tmp.l];
-			float *no = emdm->faceNos[i];
+		bmdm->vertexNos = MEM_callocN(sizeof(*bmdm->vertexNos) * bm->totvert, "bmdm_vno");
+		bmdm->polyNos = MEM_mallocN(sizeof(*bmdm->polyNos)*bm->totface, "bmdm_pno");
 
-			if (efa->v4) {
-				float *v4 = vertexCos[(int) efa->v4->tmp.l];
+		i = 0;
+		BM_ITER_MESH (efa, &fiter, bm, BM_FACES_OF_MESH) {
+			BM_elem_index_set(efa, i); /* set_inline */
+			BM_face_normal_update_vcos(bm, efa, bmdm->polyNos[i], (float const (*)[3])vertexCos);
+			i++;
+		}
+		bm->elem_index_dirty &= ~BM_FACE;
 
-				normal_quad_v3( no,v1, v2, v3, v4);
-				add_v3_v3(emdm->vertexNos[(int) efa->v4->tmp.l], no);
-			}
-			else {
-				normal_tri_v3( no,v1, v2, v3);
+		eve=BM_iter_new(&viter, bm, BM_VERTS_OF_MESH, NULL);
+		for (i=0; eve; eve=BM_iter_step(&viter), i++) {
+			float *no = bmdm->vertexNos[i];
+			BM_ITER_ELEM (efa, &fiter, eve, BM_FACES_OF_VERT) {
+				add_v3_v3(no, bmdm->polyNos[BM_elem_index_get(efa)]);
 			}
 
-			add_v3_v3(emdm->vertexNos[(int) efa->v1->tmp.l], no);
-			add_v3_v3(emdm->vertexNos[(int) efa->v2->tmp.l], no);
-			add_v3_v3(emdm->vertexNos[(int) efa->v3->tmp.l], no);
-		}
-
-		for (i=0, eve= em->verts.first; eve; i++, eve=eve->next) {
-			float *no = emdm->vertexNos[i];
 			/* following Mesh convention; we use vertex coordinate itself
 			 * for normal in this case */
-			if (normalize_v3(no) == 0.0f) {
-				normalize_v3_v3(no, vertexCos[i]);
+			if (normalize_v3(no)==0.0) {
+				copy_v3_v3(no, vertexCos[i]);
+				normalize_v3(no);
 			}
 		}
 	}
 
-	return (DerivedMesh*) emdm;
+	return (DerivedMesh*) bmdm;
 }
 
+/**
+ * \brief Return the BMEditMesh for a given object
+ *
+ * \note this function assumes this is a mesh object,
+ * don't add NULL data check here. caller must do that
+ */
+BMEditMesh *BMEdit_FromObject(Object *ob)
+{
+	BLI_assert(ob->type == OB_MESH);
+	return ((Mesh *)ob->data)->edit_btmesh;
+}
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index dcb8533..4f320b4 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -105,7 +105,7 @@ EffectorWeights *BKE_add_effector_weights(Group *group)
 	EffectorWeights *weights = MEM_callocN(sizeof(EffectorWeights), "EffectorWeights");
 	int i;
 
-	for(i=0; i<NUM_PFIELD_TYPES; i++)
+	for (i=0; i<NUM_PFIELD_TYPES; i++)
 		weights->weight[i] = 1.0f;
 
 	weights->global_gravity = 1.0f;
@@ -157,13 +157,13 @@ typedef struct VeNoCo {
 /* -------------------------- Effectors ------------------ */
 void free_partdeflect(PartDeflect *pd)
 {
-	if(!pd)
+	if (!pd)
 		return;
 
-	if(pd->tex)
+	if (pd->tex)
 		pd->tex->id.us--;
 
-	if(pd->rng)
+	if (pd->rng)
 		rng_free(pd->rng);
 
 	MEM_freeN(pd);
@@ -172,34 +172,34 @@ void free_partdeflect(PartDeflect *pd)
 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)
+	if (!eff->pd->rng)
 		eff->pd->rng = rng_new(eff->pd->seed + cfra);
 	else
 		rng_srandom(eff->pd->rng, eff->pd->seed + cfra);
 
-	if(eff->pd->forcefield == PFIELD_GUIDE && eff->ob->type==OB_CURVE) {
+	if (eff->pd->forcefield == PFIELD_GUIDE && eff->ob->type==OB_CURVE) {
 		Curve *cu= eff->ob->data;
-		if(cu->flag & CU_PATH) {
-			if(cu->path==NULL || cu->path->data==NULL)
+		if (cu->flag & CU_PATH) {
+			if (cu->path==NULL || cu->path->data==NULL)
 				makeDispListCurveTypes(eff->scene, eff->ob, 0);
 
-			if(cu->path && cu->path->data) {
+			if (cu->path && cu->path->data) {
 				where_on_path(eff->ob, 0.0, eff->guide_loc, eff->guide_dir, NULL, &eff->guide_radius, NULL);
 				mul_m4_v3(eff->ob->obmat, eff->guide_loc);
 				mul_mat3_m4_v3(eff->ob->obmat, eff->guide_dir);
 			}
 		}
 	}
-	else if(eff->pd->shape == PFIELD_SHAPE_SURFACE) {
+	else if (eff->pd->shape == PFIELD_SHAPE_SURFACE) {
 		eff->surmd = (SurfaceModifierData *)modifiers_findByType ( eff->ob, eModifierType_Surface );
-		if(eff->ob->type == OB_CURVE)
+		if (eff->ob->type == OB_CURVE)
 			eff->flag |= PE_USE_NORMAL_DATA;
 	}
-	else if(eff->psys)
+	else if (eff->psys)
 		psys_update_particle_tree(eff->psys, eff->scene->r.cfra);
 
 	/* Store object velocity */
-	if(eff->ob) {
+	if (eff->ob) {
 		float old_vel[3];
 
 		where_is_object_time(eff->scene, eff->ob, cfra - 1.0f);
@@ -225,13 +225,13 @@ static void add_object_to_effectors(ListBase **effectors, Scene *scene, Effector
 {
 	EffectorCache *eff = NULL;
 
-	if( ob == ob_src || weights->weight[ob->pd->forcefield] == 0.0f )
+	if ( ob == ob_src || weights->weight[ob->pd->forcefield] == 0.0f )
 		return;
 
 	if (ob->pd->shape == PFIELD_SHAPE_POINTS && !ob->derivedFinal )
 		return;
 
-	if(*effectors == NULL)
+	if (*effectors == NULL)
 		*effectors = MEM_callocN(sizeof(ListBase), "effectors list");
 
 	eff = new_effector_cache(scene, ob, NULL, ob->pd);
@@ -245,21 +245,21 @@ static void add_particles_to_effectors(ListBase **effectors, Scene *scene, Effec
 {
 	ParticleSettings *part= psys->part;
 
-	if( !psys_check_enabled(ob, psys) )
+	if ( !psys_check_enabled(ob, psys) )
 		return;
 
-	if( psys == psys_src && (part->flag & PART_SELF_EFFECT) == 0)
+	if ( psys == psys_src && (part->flag & PART_SELF_EFFECT) == 0)
 		return;
 
-	if( part->pd && part->pd->forcefield && weights->weight[part->pd->forcefield] != 0.0f) {
-		if(*effectors == NULL)
+	if ( part->pd && part->pd->forcefield && weights->weight[part->pd->forcefield] != 0.0f) {
+		if (*effectors == NULL)
 			*effectors = MEM_callocN(sizeof(ListBase), "effectors list");
 
 		BLI_addtail(*effectors, new_effector_cache(scene, ob, psys, part->pd));
 	}
 
 	if (part->pd2 && part->pd2->forcefield && weights->weight[part->pd2->forcefield] != 0.0f) {
-		if(*effectors == NULL)
+		if (*effectors == NULL)
 			*effectors = MEM_callocN(sizeof(ListBase), "effectors list");
 
 		BLI_addtail(*effectors, new_effector_cache(scene, ob, psys, part->pd2));
@@ -273,33 +273,33 @@ ListBase *pdInitEffectors(Scene *scene, Object *ob_src, ParticleSystem *psys_src
 	unsigned int layer= ob_src->lay;
 	ListBase *effectors = NULL;
 	
-	if(weights->group) {
+	if (weights->group) {
 		GroupObject *go;
 		
-		for(go= weights->group->gobject.first; go; go= go->next) {
-			if( (go->ob->lay & layer) ) {
-				if( go->ob->pd && go->ob->pd->forcefield )
+		for (go= weights->group->gobject.first; go; go= go->next) {
+			if ( (go->ob->lay & layer) ) {
+				if ( go->ob->pd && go->ob->pd->forcefield )
 					add_object_to_effectors(&effectors, scene, weights, go->ob, ob_src);
 
-				if( go->ob->particlesystem.first ) {
+				if ( go->ob->particlesystem.first ) {
 					ParticleSystem *psys= go->ob->particlesystem.first;
 
-					for( ; psys; psys=psys->next )
+					for ( ; psys; psys=psys->next )
 						add_particles_to_effectors(&effectors, scene, weights, go->ob, psys, psys_src);
 				}
 			}
 		}
 	}
 	else {
-		for(base = scene->base.first; base; base= base->next) {
-			if( (base->lay & layer) ) {
-				if( base->object->pd && base->object->pd->forcefield )
+		for (base = scene->base.first; base; base= base->next) {
+			if ( (base->lay & layer) ) {
+				if ( base->object->pd && base->object->pd->forcefield )
 				add_object_to_effectors(&effectors, scene, weights, base->object, ob_src);
 
-				if( base->object->particlesystem.first ) {
+				if ( base->object->particlesystem.first ) {
 					ParticleSystem *psys= base->object->particlesystem.first;
 
-					for( ; psys; psys=psys->next )
+					for ( ; psys; psys=psys->next )
 						add_particles_to_effectors(&effectors, scene, weights, base->object, psys, psys_src);
 				}
 			}
@@ -310,11 +310,11 @@ ListBase *pdInitEffectors(Scene *scene, Object *ob_src, ParticleSystem *psys_src
 
 void pdEndEffectors(ListBase **effectors)
 {
-	if(*effectors) {
+	if (*effectors) {
 		EffectorCache *eff = (*effectors)->first;
 
-		for(; eff; eff=eff->next) {
-			if(eff->guide_data)
+		for (; eff; eff=eff->next) {
+			if (eff->guide_data)
 				MEM_freeN(eff->guide_data);
 		}
 
@@ -334,10 +334,10 @@ void pd_point_from_particle(ParticleSimulationData *sim, ParticleData *pa, Parti
 	point->size = pa->size;
 	point->charge = 0.0f;
 	
-	if(part->pd && part->pd->forcefield == PFIELD_CHARGE)
+	if (part->pd && part->pd->forcefield == PFIELD_CHARGE)
 		point->charge += part->pd->f_strength;
 
-	if(part->pd2 && part->pd2->forcefield == PFIELD_CHARGE)
+	if (part->pd2 && part->pd2->forcefield == PFIELD_CHARGE)
 		point->charge += part->pd2->f_strength;
 
 	point->vel_to_sec = 1.0f;
@@ -345,7 +345,7 @@ void pd_point_from_particle(ParticleSimulationData *sim, ParticleData *pa, Parti
 
 	point->flag = 0;
 
-	if(sim->psys->part->flag & PART_ROT_DYN) {
+	if (sim->psys->part->flag & PART_ROT_DYN) {
 		point->ave = state->ave;
 		point->rot = state->rot;
 	}
@@ -406,48 +406,46 @@ static float eff_calc_visibility(ListBase *colliders, EffectorCache *eff, Effect
 	float norm[3], len = 0.0;
 	float visibility = 1.0, absorption = 0.0;
 	
-	if(!(eff->pd->flag & PFIELD_VISIBILITY))
+	if (!(eff->pd->flag & PFIELD_VISIBILITY))
 		return visibility;
 
-	if(!colls)
+	if (!colls)
 		colls = get_collider_cache(eff->scene, eff->ob, NULL);
 
-	if(!colls)
+	if (!colls)
 		return visibility;
 
 	negate_v3_v3(norm, efd->vec_to_point);
 	len = normalize_v3(norm);
 	
 	// check all collision objects
-	for(col = colls->first; col; col = col->next)
+	for (col = colls->first; col; col = col->next)
 	{
 		CollisionModifierData *collmd = col->collmd;
 
-		if(col->ob == eff->ob)
+		if (col->ob == eff->ob)
 			continue;
 		
-		if(collmd->bvhtree)
-		{
+		if (collmd->bvhtree) {
 			BVHTreeRayHit hit;
 			
 			hit.index = -1;
 			hit.dist = len + FLT_EPSILON;
 			
 			// check if the way is blocked
-			if(BLI_bvhtree_ray_cast(collmd->bvhtree, point->loc, norm, 0.0f, &hit, eff_tri_ray_hit, NULL)>=0)
-			{
+			if (BLI_bvhtree_ray_cast(collmd->bvhtree, point->loc, norm, 0.0f, &hit, eff_tri_ray_hit, NULL)>=0) {
 				absorption= col->ob->pd->absorption;
 
 				// visibility is only between 0 and 1, calculated from 1-absorption
 				visibility *= CLAMPIS(1.0f-absorption, 0.0f, 1.0f);
 				
-				if(visibility <= 0.0f)
+				if (visibility <= 0.0f)
 					break;
 			}
 		}
 	}
 
-	if(!colliders)
+	if (!colliders)
 		free_collider_cache(&colls);
 	
 	return visibility;
@@ -474,13 +472,13 @@ static float wind_func(struct RNG *rng, float strength)
 static float falloff_func(float fac, int usemin, float mindist, int usemax, float maxdist, float power)
 {
 	/* first quick checks */
-	if(usemax && fac > maxdist)
+	if (usemax && fac > maxdist)
 		return 0.0f;
 
-	if(usemin && fac < mindist)
+	if (usemin && fac < mindist)
 		return 1.0f;
 
-	if(!usemin)
+	if (!usemin)
 		mindist = 0.0;
 
 	return pow((double)(1.0f+fac-mindist), (double)(-power));
@@ -504,18 +502,18 @@ float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNU
 
 	fac = dot_v3v3(efd->nor, efd->vec_to_point2);
 
-	if(eff->pd->zdir == PFIELD_Z_POS && fac < 0.0f)
+	if (eff->pd->zdir == PFIELD_Z_POS && fac < 0.0f)
 		falloff=0.0f;
-	else if(eff->pd->zdir == PFIELD_Z_NEG && fac > 0.0f)
+	else if (eff->pd->zdir == PFIELD_Z_NEG && fac > 0.0f)
 		falloff=0.0f;
-	else switch(eff->pd->falloff){
+	else switch(eff->pd->falloff) {
 		case PFIELD_FALL_SPHERE:
 			falloff*= falloff_func_dist(eff->pd, efd->distance);
 			break;
 
 		case PFIELD_FALL_TUBE:
 			falloff*= falloff_func_dist(eff->pd, ABS(fac));
-			if(falloff == 0.0f)
+			if (falloff == 0.0f)
 				break;
 
 			madd_v3_v3v3fl(temp, efd->vec_to_point, efd->nor, -fac);
@@ -524,7 +522,7 @@ float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNU
 			break;
 		case PFIELD_FALL_CONE:
 			falloff*= falloff_func_dist(eff->pd, ABS(fac));
-			if(falloff == 0.0f)
+			if (falloff == 0.0f)
 				break;
 
 			r_fac= RAD2DEGF(saacos(fac/len_v3(efd->vec_to_point)));
@@ -545,20 +543,20 @@ int closest_point_on_surface(SurfaceModifierData *surmd, const float co[3], floa
 
 	BLI_bvhtree_find_nearest(surmd->bvhtree->tree, co, &nearest, surmd->bvhtree->nearest_callback, surmd->bvhtree);
 
-	if(nearest.index != -1) {
+	if (nearest.index != -1) {
 		copy_v3_v3(surface_co, nearest.co);
 
-		if(surface_nor) {
+		if (surface_nor) {
 			copy_v3_v3(surface_nor, nearest.no);
 		}
 
-		if(surface_vel) {
-			MFace *mface = CDDM_get_face(surmd->dm, nearest.index);
+		if (surface_vel) {
+			MFace *mface = CDDM_get_tessface(surmd->dm, nearest.index);
 			
 			copy_v3_v3(surface_vel, surmd->v[mface->v1].co);
 			add_v3_v3(surface_vel, surmd->v[mface->v2].co);
 			add_v3_v3(surface_vel, surmd->v[mface->v3].co);
-			if(mface->v4)
+			if (mface->v4)
 				add_v3_v3(surface_vel, surmd->v[mface->v4].co);
 
 			mul_v3_fl(surface_vel, mface->v4 ? 0.25f : 0.333f);
@@ -573,7 +571,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
 	float cfra = eff->scene->r.cfra;
 	int ret = 0;
 
-	if(eff->pd && eff->pd->shape==PFIELD_SHAPE_SURFACE && eff->surmd) {
+	if (eff->pd && eff->pd->shape==PFIELD_SHAPE_SURFACE && eff->surmd) {
 		/* closest point in the object surface is an effector */
 		float vec[3];
 
@@ -586,9 +584,9 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
 
 		efd->size = 0.0f;
 	}
-	else if(eff->pd && eff->pd->shape==PFIELD_SHAPE_POINTS) {
+	else if (eff->pd && eff->pd->shape==PFIELD_SHAPE_POINTS) {
 
-		if(eff->ob->derivedFinal) {
+		if (eff->ob->derivedFinal) {
 			DerivedMesh *dm = eff->ob->derivedFinal;
 
 			dm->getVertCo(dm, *efd->index, efd->loc);
@@ -605,13 +603,14 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
 			ret = 1;
 		}
 	}
-	else if(eff->psys) {
+	else if (eff->psys) {
 		ParticleData *pa = eff->psys->particles + *efd->index;
 		ParticleKey state;
 
 		/* exclude the particle itself for self effecting particles */
-		if(eff->psys == point->psys && *efd->index == point->index)
-			;
+		if (eff->psys == point->psys && *efd->index == point->index) {
+			/* pass */
+		}
 		else {
 			ParticleSimulationData sim= {NULL};
 			sim.scene= eff->scene;
@@ -623,8 +622,8 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
 			ret = psys_get_particle_state(&sim, *efd->index, &state, 0);
 
 			/* TODO */
-			//if(eff->pd->forcefiled == PFIELD_HARMONIC && ret==0) {
-			//	if(pa->dietime < eff->psys->cfra)
+			//if (eff->pd->forcefiled == PFIELD_HARMONIC && ret==0) {
+			//	if (pa->dietime < eff->psys->cfra)
 			//		eff->flag |= PE_VELOCITY_TO_IMPULSE;
 			//}
 
@@ -635,7 +634,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
 			efd->nor[1] = efd->nor[2] = 0.f;
 			mul_qt_v3(state.rot, efd->nor);
 		
-			if(real_velocity)
+			if (real_velocity)
 				copy_v3_v3(efd->vel, state.vel);
 
 			efd->size = pa->size;
@@ -649,13 +648,13 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
 		/* use z-axis as normal*/
 		normalize_v3_v3(efd->nor, ob->obmat[2]);
 
-		if(eff->pd && eff->pd->shape == PFIELD_SHAPE_PLANE) {
+		if (eff->pd && eff->pd->shape == PFIELD_SHAPE_PLANE) {
 			float temp[3], translate[3];
 			sub_v3_v3v3(temp, point->loc, ob->obmat[3]);
 			project_v3_v3v3(translate, temp, efd->nor);
 
 			/* for vortex the shape chooses between old / new force */
-			if(eff->pd->forcefield == PFIELD_VORTEX)
+			if (eff->pd->forcefield == PFIELD_VORTEX)
 				add_v3_v3v3(efd->loc, ob->obmat[3], translate);
 			else /* normally efd->loc is closest point on effector xy-plane */
 				sub_v3_v3v3(efd->loc, point->loc, translate);
@@ -664,7 +663,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
 			copy_v3_v3(efd->loc, ob->obmat[3]);
 		}
 
-		if(real_velocity)
+		if (real_velocity)
 			copy_v3_v3(efd->vel, eff->velocity);
 
 		*eff->ob = obcopy;
@@ -674,15 +673,15 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
 		ret = 1;
 	}
 
-	if(ret) {
+	if (ret) {
 		sub_v3_v3v3(efd->vec_to_point, point->loc, efd->loc);
 		efd->distance = len_v3(efd->vec_to_point);
 
 		/* rest length for harmonic effector, will have to see later if this could be extended to other effectors */
-		if(eff->pd && eff->pd->forcefield == PFIELD_HARMONIC && eff->pd->f_size)
+		if (eff->pd && eff->pd->forcefield == PFIELD_HARMONIC && eff->pd->f_size)
 			mul_v3_fl(efd->vec_to_point, (efd->distance-eff->pd->f_size)/efd->distance);
 
-		if(eff->flag & PE_USE_NORMAL_DATA) {
+		if (eff->flag & PE_USE_NORMAL_DATA) {
 			copy_v3_v3(efd->vec_to_point2, efd->vec_to_point);
 			copy_v3_v3(efd->nor2, efd->nor);
 		}
@@ -697,39 +696,39 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
 }
 static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, int *tot, int *p, int *step)
 {
-	if(eff->pd->shape == PFIELD_SHAPE_POINTS) {
+	if (eff->pd->shape == PFIELD_SHAPE_POINTS) {
 		efd->index = p;
 
 		*p = 0;
 		*tot = eff->ob->derivedFinal ? eff->ob->derivedFinal->numVertData : 1;
 
-		if(*tot && eff->pd->forcefield == PFIELD_HARMONIC && point->index >= 0) {
+		if (*tot && eff->pd->forcefield == PFIELD_HARMONIC && point->index >= 0) {
 			*p = point->index % *tot;
 			*tot = *p+1;
 		}
 	}
-	else if(eff->psys) {
+	else if (eff->psys) {
 		efd->index = p;
 
 		*p = 0;
 		*tot = eff->psys->totpart;
 		
-		if(eff->pd->forcefield == PFIELD_CHARGE) {
+		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		
-			could be the wanted behavior. If you want physical
-			correctness the fall-off should be spherical 2.0 anyways.
-			*/
+			 * 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.
+			 */
 			efd->charge = eff->pd->f_strength;
 		}
-		else if(eff->pd->forcefield == PFIELD_HARMONIC && (eff->pd->flag & PFIELD_MULTIPLE_SPRINGS)==0) {
+		else if (eff->pd->forcefield == PFIELD_HARMONIC && (eff->pd->flag & PFIELD_MULTIPLE_SPRINGS)==0) {
 			/* every particle is mapped to only one harmonic effector particle */
 			*p= point->index % eff->psys->totpart;
 			*tot= *p + 1;
 		}
 
-		if(eff->psys->part->effector_amount) {
+		if (eff->psys->part->effector_amount) {
 			int totpart = eff->psys->totpart;
 			int amount = eff->psys->part->effector_amount;
 
@@ -749,7 +748,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
 	int hasrgb;
 	short mode = eff->pd->tex_mode;
 
-	if(!eff->pd->tex)
+	if (!eff->pd->tex)
 		return;
 
 	result[0].nor = result[1].nor = result[2].nor = result[3].nor = NULL;
@@ -758,18 +757,18 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
 
 	copy_v3_v3(tex_co,point->loc);
 
-	if(eff->pd->flag & PFIELD_TEX_2D) {
+	if (eff->pd->flag & PFIELD_TEX_2D) {
 		float fac=-dot_v3v3(tex_co, efd->nor);
 		madd_v3_v3fl(tex_co, efd->nor, fac);
 	}
 
-	if(eff->pd->flag & PFIELD_TEX_OBJECT) {
+	if (eff->pd->flag & PFIELD_TEX_OBJECT) {
 		mul_m4_v3(eff->ob->imat, tex_co);
 	}
 
 	hasrgb = multitex_ext(eff->pd->tex, tex_co, NULL,NULL, 0, result);
 
-	if(hasrgb && mode==PFIELD_TEX_RGB) {
+	if (hasrgb && mode==PFIELD_TEX_RGB) {
 		force[0] = (0.5f - result->tr) * strength;
 		force[1] = (0.5f - result->tg) * strength;
 		force[2] = (0.5f - result->tb) * strength;
@@ -788,7 +787,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
 		tex_co[2] += nabla;
 		multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+3);
 
-		if(mode == PFIELD_TEX_GRAD || !hasrgb) { /* if we dont have rgb fall back to grad */
+		if (mode == PFIELD_TEX_GRAD || !hasrgb) { /* if we don't have rgb fall back to grad */
 			force[0] = (result[0].tin - result[1].tin) * strength;
 			force[1] = (result[0].tin - result[2].tin) * strength;
 			force[2] = (result[0].tin - result[3].tin) * strength;
@@ -809,7 +808,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
 		}
 	}
 
-	if(eff->pd->flag & PFIELD_TEX_2D){
+	if (eff->pd->flag & PFIELD_TEX_2D) {
 		float fac = -dot_v3v3(force, efd->nor);
 		madd_v3_v3fl(force, efd->nor, fac);
 	}
@@ -827,16 +826,16 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
 	float damp = pd->f_damp;
 	float noise_factor = pd->f_noise;
 
-	if(noise_factor > 0.0f) {
+	if (noise_factor > 0.0f) {
 		strength += wind_func(rng, noise_factor);
 
-		if(ELEM(pd->forcefield, PFIELD_HARMONIC, PFIELD_DRAG))
+		if (ELEM(pd->forcefield, PFIELD_HARMONIC, PFIELD_DRAG))
 			damp += wind_func(rng, noise_factor);
 	}
 
 	copy_v3_v3(force, efd->vec_to_point);
 
-	switch(pd->forcefield){
+	switch(pd->forcefield) {
 		case PFIELD_WIND:
 			copy_v3_v3(force, efd->nor);
 			mul_v3_fl(force, strength * efd->falloff);
@@ -847,7 +846,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
 			break;
 		case PFIELD_VORTEX:
 			/* old vortex force */
-			if(pd->shape == PFIELD_SHAPE_POINT) {
+			if (pd->shape == PFIELD_SHAPE_POINT) {
 				cross_v3_v3v3(force, efd->nor, efd->vec_to_point);
 				normalize_v3(force);
 				mul_v3_fl(force, strength * efd->distance * efd->falloff);
@@ -865,7 +864,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
 			}
 			break;
 		case PFIELD_MAGNET:
-			if(eff->pd->shape == PFIELD_SHAPE_POINT)
+			if (eff->pd->shape == PFIELD_SHAPE_POINT)
 				/* magnetic field of a moving charge */
 				cross_v3_v3v3(temp, efd->nor, efd->vec_to_point);
 			else
@@ -899,7 +898,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
 			/* Boid field is handled completely in boids code. */
 			return;
 		case PFIELD_TURBULENCE:
-			if(pd->flag & PFIELD_GLOBAL_CO) {
+			if (pd->flag & PFIELD_GLOBAL_CO) {
 				copy_v3_v3(temp, point->loc);
 			}
 			else {
@@ -921,20 +920,20 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
 			break;
 	}
 
-	if(pd->flag & PFIELD_DO_LOCATION) {
+	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 (ELEM(pd->forcefield, PFIELD_HARMONIC, PFIELD_DRAG)==0 && pd->f_flow != 0.0f) {
 			madd_v3_v3fl(total_force, point->vel, -pd->f_flow * efd->falloff);
 		}
 	}
 
-	if(pd->flag & PFIELD_DO_ROTATION && point->ave && point->rot) {
+	if (pd->flag & PFIELD_DO_ROTATION && point->ave && point->rot) {
 		float xvec[3] = {1.0f, 0.0f, 0.0f};
 		float dave[3];
 		mul_qt_v3(point->rot, xvec);
 		cross_v3_v3v3(dave, xvec, force);
-		if(pd->f_flow != 0.0f) {
+		if (pd->f_flow != 0.0f) {
 			madd_v3_v3fl(dave, point->ave, -pd->f_flow * efd->falloff);
 		}
 		add_v3_v3(point->ave, dave);
@@ -942,34 +941,33 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
 }
 
 /*  -------- pdDoEffectors() --------
-	generic force/speed system, now used for particles and softbodies
-	scene       = scene where it runs in, for time and stuff
-	lb			= listbase with objects that take part in effecting
-	opco		= global coord, as input
-	force		= force accumulator
-	speed		= actual current speed which can be altered
-	cur_time	= "external" time in frames, is constant for static particles
-	loc_time	= "local" time in frames, range <0-1> for the lifetime of particle
-	par_layer	= layer the caller is in
-	flags		= only used for softbody wind now
-	guide		= old speed of particle
-
-*/
+ * generic force/speed system, now used for particles and softbodies
+ * scene       = scene where it runs in, for time and stuff
+ * lb			= listbase with objects that take part in effecting
+ * opco		= global coord, as input
+ * force		= force accumulator
+ * speed		= actual current speed which can be altered
+ * cur_time	= "external" time in frames, is constant for static particles
+ * loc_time	= "local" time in frames, range <0-1> for the lifetime of particle
+ * par_layer	= layer the caller is in
+ * flags		= only used for softbody wind now
+ * guide		= old speed of particle
+ */
 void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *weights, EffectedPoint *point, float *force, float *impulse)
 {
 /*
-	Modifies the force on a particle according to its
-	relation with the effector object
-	Different kind of effectors include:
-		Forcefields: Gravity-like attractor
-		(force power is related to the inverse of distance to the power of a falloff value)
-		Vortex fields: swirling effectors
-		(particles rotate around Z-axis of the object. otherwise, same relation as)
-		(Forcefields, but this is not done through a force/acceleration)
-		Guide: particles on a path
-		(particles are guided along a curve bezier or old nurbs)
-		(is independent of other effectors)
-*/
+ * Modifies the force on a particle according to its
+ * relation with the effector object
+ * Different kind of effectors include:
+ *     Forcefields: Gravity-like attractor
+ *     (force power is related to the inverse of distance to the power of a falloff value)
+ *     Vortex fields: swirling effectors
+ *     (particles rotate around Z-axis of the object. otherwise, same relation as)
+ *     (Forcefields, but this is not done through a force/acceleration)
+ *     Guide: particles on a path
+ *     (particles are guided along a curve bezier or old nurbs)
+ *     (is independent of other effectors)
+ */
 	EffectorCache *eff;
 	EffectorData efd;
 	int p=0, tot = 1, step = 1;
@@ -977,21 +975,21 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we
 	/* Cycle through collected objects, get total of (1/(gravity_strength * dist^gravity_power)) */
 	/* Check for min distance here? (yes would be cool to add that, ton) */
 	
-	if(effectors) for(eff = effectors->first; eff; eff=eff->next) {
+	if (effectors) for (eff = effectors->first; eff; eff=eff->next) {
 		/* object effectors were fully checked to be OK to evaluate! */
 
 		get_effector_tot(eff, &efd, point, &tot, &p, &step);
 
-		for(; p<tot; p+=step) {
-			if(get_effector_data(eff, &efd, point, 0)) {
+		for (; p<tot; p+=step) {
+			if (get_effector_data(eff, &efd, point, 0)) {
 				efd.falloff= effector_falloff(eff, &efd, point, weights);
 				
-				if(efd.falloff > 0.0f)
+				if (efd.falloff > 0.0f)
 					efd.falloff *= eff_calc_visibility(colliders, eff, &efd, point);
 
-				if(efd.falloff <= 0.0f)
+				if (efd.falloff <= 0.0f)
 					;	/* don't do anything */
-				else if(eff->pd->forcefield == PFIELD_TEXTURE)
+				else if (eff->pd->forcefield == PFIELD_TEXTURE)
 					do_texture_effector(eff, &efd, point, force);
 				else {
 					float temp1[3]={0,0,0}, temp2[3];
@@ -1000,13 +998,13 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we
 					do_physical_effector(eff, &efd, point, force);
 					
 					// for softbody backward compatibility
-					if(point->flag & PE_WIND_AS_SPEED && impulse){
+					if (point->flag & PE_WIND_AS_SPEED && impulse) {
 						sub_v3_v3v3(temp2, force, temp1);
 						sub_v3_v3v3(impulse, impulse, temp2);
 					}
 				}
 			}
-			else if(eff->flag & PE_VELOCITY_TO_IMPULSE && impulse) {
+			else if (eff->flag & PE_VELOCITY_TO_IMPULSE && impulse) {
 				/* special case for harmonic effector */
 				add_v3_v3v3(impulse, impulse, efd.vel);
 			}
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 5feeb4c..bb8cfe3 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -156,7 +156,7 @@ void copy_fcurves (ListBase *dst, ListBase *src)
 	FCurve *dfcu, *sfcu;
 	
 	/* sanity checks */
-	if ELEM(NULL, dst, src)
+	if (ELEM(NULL, dst, src))
 		return;
 	
 	/* clear destination list first */
@@ -183,7 +183,7 @@ FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *pro
 	PropertyRNA *prop;
 	char *path;
 
-	if(driven)
+	if (driven)
 		*driven = FALSE;
 	
 	/* only use the current action ??? */
@@ -204,7 +204,7 @@ FCurve *id_data_find_fcurve(ID *id, void *data, StructRNA *type, const char *pro
 			/* if not animated, check if driven */
 			if ((fcu == NULL) && (adt->drivers.first)) {
 				fcu= list_find_fcurve(&adt->drivers, path, index);
-				if(fcu && driven)
+				if (fcu && driven)
 					*driven = TRUE;
 				fcu = NULL;
 			}
@@ -362,7 +362,7 @@ int binarysearch_bezt_index (BezTriple array[], float frame, int arraylen, short
 	int start=0, end=arraylen;
 	int loopbreaker= 0, maxloop= arraylen * 2;
 	
-	/* initialise replace-flag first */
+	/* initialize replace-flag first */
 	*replace= 0;
 	
 	/* sneaky optimisations (don't go through searching process if...):
@@ -370,7 +370,7 @@ int binarysearch_bezt_index (BezTriple array[], float frame, int arraylen, short
 	 *	- keyframe to be added would replace one of the existing ones on bounds
 	 */
 	if ((arraylen <= 0) || (array == NULL)) {
-		printf("Warning: binarysearch_bezt_index() encountered invalid array \n");
+		printf("Warning: binarysearch_bezt_index() encountered invalid array\n");
 		return 0;
 	}
 	else {
@@ -420,10 +420,10 @@ int binarysearch_bezt_index (BezTriple array[], float frame, int arraylen, short
 	
 	/* print error if loop-limit exceeded */
 	if (loopbreaker == (maxloop-1)) {
-		printf("Error: binarysearch_bezt_index() was taking too long \n");
+		printf("Error: binarysearch_bezt_index() was taking too long\n");
 		
 		// include debug info 
-		printf("\tround = %d: start = %d, end = %d, arraylen = %d \n", loopbreaker, start, end, arraylen);
+		printf("\tround = %d: start = %d, end = %d, arraylen = %d\n", loopbreaker, start, end, arraylen);
 	}
 	
 	/* not found, so return where to place it */
@@ -546,7 +546,7 @@ void calc_fcurve_bounds (FCurve *fcu, float *xmin, float *xmax, float *ymin, flo
 		if (ymax) *ymax= ymaxv;
 	}
 	else {
-		if (G.f & G_DEBUG)
+		if (G.debug & G_DEBUG)
 			printf("F-Curve calc bounds didn't find anything, so assuming minimum bounds of 1.0\n");
 			
 		if (xmin) *xmin= 0.0f;
@@ -738,12 +738,12 @@ void fcurve_store_samples (FCurve *fcu, void *data, int start, int end, FcuSampl
 	
 	/* sanity checks */
 	// TODO: make these tests report errors using reports not printf's
-	if ELEM(NULL, fcu, sample_cb) {
+	if (ELEM(NULL, fcu, sample_cb)) {
 		printf("Error: No F-Curve with F-Curve Modifiers to Bake\n");
 		return;
 	}
 	if (start >= end) {
-		printf("Error: Frame range for Sampled F-Curve creation is inappropriate \n");
+		printf("Error: Frame range for Sampled F-Curve creation is inappropriate\n");
 		return;
 	}
 	
@@ -827,26 +827,26 @@ void calchandles_fcurve (FCurve *fcu)
  * 		-> Auto handles: become aligned when selection status is NOT(000 || 111)
  * 		-> Vector handles: become 'nothing' when (one half selected AND other not)
  *  - PHASE 2: recalculate handles
-*/
+ */
 void testhandles_fcurve (FCurve *fcu, const short use_handle)
 {
 	BezTriple *bezt;
 	unsigned int a;
 
 	/* only beztriples have handles (bpoints don't though) */
-	if ELEM(NULL, fcu, fcu->bezt)
+	if (ELEM(NULL, fcu, fcu->bezt))
 		return;
 	
 	/* loop over beztriples */
 	for (a=0, bezt=fcu->bezt; a < fcu->totvert; a++, bezt++) {
 		short flag= 0;
 		
-		/* flag is initialised as selection status
+		/* flag is initialized as selection status
 		 * of beztriple control-points (labelled 0,1,2)
 		 */
 		if (bezt->f2 & SELECT) flag |= (1<<1); // == 2
-		if(use_handle == FALSE) {
-			if(flag & 2) {
+		if (use_handle == FALSE) {
+			if (flag & 2) {
 				flag |= (1<<0) | (1<<2);
 			}
 		}
@@ -1001,7 +1001,7 @@ static float dtar_get_prop_val (ChannelDriver *driver, DriverTarget *dtar)
 	float value= 0.0f;
 	
 	/* sanity check */
-	if ELEM(NULL, driver, dtar)
+	if (ELEM(NULL, driver, dtar))
 		return 0.0f;
 	
 	id= dtar_id_ensure_proxy_from(dtar->id);
@@ -1009,8 +1009,8 @@ static float dtar_get_prop_val (ChannelDriver *driver, DriverTarget *dtar)
 	/* error check for missing pointer... */
 	// TODO: tag the specific target too as having issues
 	if (id == NULL) {
-		printf("Error: driver has an invalid target to use \n");
-		if (G.f & G_DEBUG) printf("\tpath = %s\n", dtar->rna_path);
+		printf("Error: driver has an invalid target to use\n");
+		if (G.debug & G_DEBUG) printf("\tpath = %s\n", dtar->rna_path);
 		driver->flag |= DRIVER_FLAG_INVALID;
 		return 0.0f;
 	}
@@ -1020,7 +1020,7 @@ static float dtar_get_prop_val (ChannelDriver *driver, DriverTarget *dtar)
 	
 	/* get property to read from, and get value as appropriate */
 	if (RNA_path_resolve_full(&id_ptr, dtar->rna_path, &ptr, &prop, &index)) {
-		if(RNA_property_array_check(prop)) {
+		if (RNA_property_array_check(prop)) {
 			/* array */
 			if (index < RNA_property_array_length(&ptr, prop)) {	
 				switch (RNA_property_type(prop)) {
@@ -1060,8 +1060,8 @@ static float dtar_get_prop_val (ChannelDriver *driver, DriverTarget *dtar)
 
 	}
 	else {
-		if (G.f & G_DEBUG)
-			printf("Driver Evaluation Error: cannot resolve target for %s -> %s \n", id->name, dtar->rna_path);
+		if (G.debug & G_DEBUG)
+			printf("Driver Evaluation Error: cannot resolve target for %s -> %s\n", id->name, dtar->rna_path);
 		
 		driver->flag |= DRIVER_FLAG_INVALID;
 		return 0.0f;
@@ -1075,7 +1075,7 @@ static bPoseChannel *dtar_get_pchan_ptr (ChannelDriver *driver, DriverTarget *dt
 {
 	ID *id;
 	/* sanity check */
-	if ELEM(NULL, driver, dtar)
+	if (ELEM(NULL, driver, dtar))
 		return NULL;
 
 	id= dtar_id_ensure_proxy_from(dtar->id);
@@ -1118,11 +1118,11 @@ static float dvar_eval_rotDiff (ChannelDriver *driver, DriverVar *dvar)
 		
 		/* check what the error was */
 		if ((pchan == NULL) && (pchan2 == NULL))
-			printf("Driver Evaluation Error: Rotational difference failed - first 2 targets invalid \n");
+			printf("Driver Evaluation Error: Rotational difference failed - first 2 targets invalid\n");
 		else if (pchan == NULL)
-			printf("Driver Evaluation Error: Rotational difference failed - first target not valid PoseChannel \n");
+			printf("Driver Evaluation Error: Rotational difference failed - first target not valid PoseChannel\n");
 		else if (pchan2 == NULL)
-			printf("Driver Evaluation Error: Rotational difference failed - second target not valid PoseChannel \n");
+			printf("Driver Evaluation Error: Rotational difference failed - second target not valid PoseChannel\n");
 			
 		/* stop here... */
 		return 0.0f;
@@ -1418,7 +1418,7 @@ void driver_free_variable (ChannelDriver *driver, DriverVar *dvar)
 
 #ifdef WITH_PYTHON
 	/* since driver variables are cached, the expression needs re-compiling too */
-	if(driver->type==DRIVER_TYPE_PYTHON)
+	if (driver->type==DRIVER_TYPE_PYTHON)
 		driver->flag |= DRIVER_FLAG_RENAMEVAR;
 #endif
 }
@@ -1446,7 +1446,7 @@ void driver_change_variable_type (DriverVar *dvar, int type)
 		/* store the flags */
 		dtar->flag = flags;
 		
-		/* object ID types only, or idtype not yet initialised*/
+		/* object ID types only, or idtype not yet initialized*/
 		if ((flags & DTAR_FLAG_ID_OB_ONLY) || (dtar->idtype == 0))
 			dtar->idtype= ID_OB;
 	}
@@ -1490,7 +1490,7 @@ void fcurve_free_driver(FCurve *fcu)
 	DriverVar *dvar, *dvarn;
 	
 	/* sanity checks */
-	if ELEM(NULL, fcu, fcu->driver)
+	if (ELEM(NULL, fcu, fcu->driver))
 		return;
 	driver= fcu->driver;
 	
@@ -1686,8 +1686,8 @@ static float evaluate_driver (ChannelDriver *driver, const float evaltime)
 /* The total length of the handles is not allowed to be more
  * than the horizontal distance between (v1-v4).
  * This is to prevent curve loops.
-*/
-void correct_bezpart (float *v1, float *v2, float *v3, float *v4)
+ */
+void correct_bezpart(float v1[2], float v2[2], float v3[2], float v4[2])
 {
 	float h1[2], h2[2], len1, len2, len, fac;
 	
@@ -1873,22 +1873,20 @@ static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltim
 	lastbezt= prevbezt + a;
 	
 	/* evaluation time at or past endpoints? */
-	if (prevbezt->vec[1][0] >= evaltime) 
-	{
+	if (prevbezt->vec[1][0] >= evaltime) {
 		/* before or on first keyframe */
 		if ( (fcu->extend == FCURVE_EXTRAPOLATE_LINEAR) && (prevbezt->ipo != BEZT_IPO_CONST) &&
-			!(fcu->flag & FCURVE_DISCRETE_VALUES) ) 
+			!(fcu->flag & FCURVE_DISCRETE_VALUES) )
 		{
 			/* linear or bezier interpolation */
-			if (prevbezt->ipo==BEZT_IPO_LIN) 
-			{
+			if (prevbezt->ipo==BEZT_IPO_LIN) {
 				/* Use the next center point instead of our own handle for
 				 * linear interpolated extrapolate 
 				 */
-				if (fcu->totvert == 1) 
+				if (fcu->totvert == 1) {
 					cvalue= prevbezt->vec[1][1];
-				else 
-				{
+				}
+				else {
 					bezt = prevbezt+1;
 					dx= prevbezt->vec[1][0] - evaltime;
 					fac= bezt->vec[1][0] - prevbezt->vec[1][0];
@@ -1898,12 +1896,12 @@ static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltim
 						fac= (bezt->vec[1][1] - prevbezt->vec[1][1]) / fac;
 						cvalue= prevbezt->vec[1][1] - (fac * dx);
 					}
-					else 
+					else {
 						cvalue= prevbezt->vec[1][1];
+					}
 				}
 			} 
-			else 
-			{
+			else {
 				/* Use the first handle (earlier) of first BezTriple to calculate the
 				 * gradient and thus the value of the curve at evaltime
 				 */
@@ -1915,34 +1913,32 @@ static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltim
 					fac= (prevbezt->vec[1][1] - prevbezt->vec[0][1]) / fac;
 					cvalue= prevbezt->vec[1][1] - (fac * dx);
 				}
-				else 
+				else {
 					cvalue= prevbezt->vec[1][1];
+				}
 			}
 		}
-		else 
-		{
+		else {
 			/* constant (BEZT_IPO_HORIZ) extrapolation or constant interpolation, 
 			 * so just extend first keyframe's value 
 			 */
 			cvalue= prevbezt->vec[1][1];
 		}
 	}
-	else if (lastbezt->vec[1][0] <= evaltime) 
-	{
+	else if (lastbezt->vec[1][0] <= evaltime) {
 		/* after or on last keyframe */
 		if ( (fcu->extend == FCURVE_EXTRAPOLATE_LINEAR) && (lastbezt->ipo != BEZT_IPO_CONST) &&
 			!(fcu->flag & FCURVE_DISCRETE_VALUES) ) 
 		{
 			/* linear or bezier interpolation */
-			if (lastbezt->ipo==BEZT_IPO_LIN) 
-			{
+			if (lastbezt->ipo==BEZT_IPO_LIN) {
 				/* Use the next center point instead of our own handle for
 				 * linear interpolated extrapolate 
 				 */
-				if (fcu->totvert == 1) 
+				if (fcu->totvert == 1) {
 					cvalue= lastbezt->vec[1][1];
-				else 
-				{
+				}
+				else {
 					prevbezt = lastbezt - 1;
 					dx= evaltime - lastbezt->vec[1][0];
 					fac= lastbezt->vec[1][0] - prevbezt->vec[1][0];
@@ -1952,12 +1948,12 @@ static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltim
 						fac= (lastbezt->vec[1][1] - prevbezt->vec[1][1]) / fac;
 						cvalue= lastbezt->vec[1][1] + (fac * dx);
 					}
-					else 
+					else {
 						cvalue= lastbezt->vec[1][1];
+					}
 				}
 			} 
-			else 
-			{
+			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
 				 */
@@ -1969,38 +1965,33 @@ static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltim
 					fac= (lastbezt->vec[2][1] - lastbezt->vec[1][1]) / fac;
 					cvalue= lastbezt->vec[1][1] + (fac * dx);
 				}
-				else 
+				else {
 					cvalue= lastbezt->vec[1][1];
+				}
 			}
 		}
-		else 
-		{
+		else {
 			/* constant (BEZT_IPO_HORIZ) extrapolation or constant interpolation, 
 			 * so just extend last keyframe's value 
 			 */
 			cvalue= lastbezt->vec[1][1];
 		}
 	}
-	else 
-	{
+	else {
 		/* evaltime occurs somewhere in the middle of the curve */
-		for (a=0; prevbezt && bezt && (a < fcu->totvert-1); a++, prevbezt=bezt, bezt++) 
-		{
+		for (a=0; prevbezt && bezt && (a < fcu->totvert-1); a++, prevbezt=bezt, bezt++) {
 			/* use if the key is directly on the frame, rare cases this is needed else we get 0.0 instead. */
-			if(fabsf(bezt->vec[1][0] - evaltime) < SMALL_NUMBER) {
+			if (fabsf(bezt->vec[1][0] - evaltime) < SMALL_NUMBER) {
 				cvalue= bezt->vec[1][1];
 			}
 			/* evaltime occurs within the interval defined by these two keyframes */
-			else if ((prevbezt->vec[1][0] <= evaltime) && (bezt->vec[1][0] >= evaltime))
-			{
+			else if ((prevbezt->vec[1][0] <= evaltime) && (bezt->vec[1][0] >= evaltime)) {
 				/* value depends on interpolation mode */
-				if ((prevbezt->ipo == BEZT_IPO_CONST) || (fcu->flag & FCURVE_DISCRETE_VALUES))
-				{
+				if ((prevbezt->ipo == BEZT_IPO_CONST) || (fcu->flag & FCURVE_DISCRETE_VALUES)) {
 					/* constant (evaltime not relevant, so no interpolation needed) */
 					cvalue= prevbezt->vec[1][1];
 				}
-				else if (prevbezt->ipo == BEZT_IPO_LIN) 
-				{
+				else if (prevbezt->ipo == BEZT_IPO_LIN) {
 					/* linear - interpolate between values of the two keyframes */
 					fac= bezt->vec[1][0] - prevbezt->vec[1][0];
 					
@@ -2009,11 +2000,11 @@ static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltim
 						fac= (evaltime - prevbezt->vec[1][0]) / fac;
 						cvalue= prevbezt->vec[1][1] + (fac * (bezt->vec[1][1] - prevbezt->vec[1][1]));
 					}
-					else
+					else {
 						cvalue= prevbezt->vec[1][1];
+					}
 				}
-				else 
-				{
+				else {
 					/* bezier interpolation */
 						/* v1,v2 are the first keyframe and its 2nd handle */
 					v1[0]= prevbezt->vec[1][0];
diff --git a/source/blender/blenkernel/intern/fluidsim.c b/source/blender/blenkernel/intern/fluidsim.c
index cdb2b19..a930818 100644
--- a/source/blender/blenkernel/intern/fluidsim.c
+++ b/source/blender/blenkernel/intern/fluidsim.c
@@ -30,7 +30,11 @@
  */
 
 
-#include <stddef.h>
+// headers for fluidsim bobj meshes
+#include <stdlib.h>
+#include <zlib.h>
+#include <string.h>
+#include <stdio.h>
 
 #include "MEM_guardedalloc.h"
 
@@ -54,14 +58,6 @@
 #include "BKE_modifier.h"
 #include "BKE_mesh.h"
 
-
-// headers for fluidsim bobj meshes
-#include <stdlib.h>
-#include "LBM_fluidsim.h"
-#include <zlib.h>
-#include <string.h>
-#include <stdio.h>
-
 /* ************************* fluidsim bobj file handling **************************** */
 
 
@@ -85,26 +81,26 @@ void initElbeemMesh(struct Scene *scene, struct Object *ob,
 	//dm = mesh_create_derived_no_deform(ob,NULL);
 
 	mvert = dm->getVertArray(dm);
-	mface = dm->getFaceArray(dm);
+	mface = dm->getTessFaceArray(dm);
 	totvert = dm->getNumVerts(dm);
-	totface = dm->getNumFaces(dm);
+	totface = dm->getNumTessFaces(dm);
 
 	*numVertices = totvert;
 	verts = MEM_callocN( totvert*3*sizeof(float), "elbeemmesh_vertices");
-	for(i=0; i<totvert; i++) {
+	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]); }
+		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++; }
+		if (mface[i].v4) { countTris++; }
 	}
 	*numTriangles = countTris;
 	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;
@@ -115,7 +111,7 @@ void initElbeemMesh(struct Scene *scene, struct Object *ob,
 		tris[countTris*3+1] = face[1];
 		tris[countTris*3+2] = face[2];
 		countTris++;
-		if(face[3]) {
+		if (face[3]) {
 			tris[countTris*3+0] = face[0];
 			tris[countTris*3+1] = face[2];
 			tris[countTris*3+2] = face[3];
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index 95c0aa6..ed5cf5e 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -39,6 +39,8 @@
 
 #include "DNA_anim_types.h"
 
+#include "BLF_translation.h"
+
 #include "BLI_blenlib.h"
 #include "BLI_math.h" /* windows needs for M_PI */
 #include "BLI_utildefines.h"
@@ -99,7 +101,7 @@ static FModifierTypeInfo FMI_MODNAME = {
 /* Generators available:
  * 	1) simple polynomial generator:
  *		- Exanded form - (y = C[0]*(x^(n)) + C[1]*(x^(n-1)) + ... + C[n])  
- *		- Factorised form - (y = (C[0][0]*x + C[0][1]) * (C[1][0]*x + C[1][1]) * ... * (C[n][0]*x + C[n][1]))
+ *		- Factorized form - (y = (C[0][0]*x + C[0][1]) * (C[1][0]*x + C[1][1]) * ... * (C[n][0]*x + C[n][1]))
  */
 
 static void fcm_generator_free (FModifier *fcm)
@@ -198,7 +200,7 @@ static void fcm_generator_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, float *
 {
 	FMod_Generator *data= (FMod_Generator *)fcm->data;
 	
-	/* behaviour depends on mode 
+	/* behavior depends on mode 
 	 * NOTE: the data in its default state is fine too
 	 */
 	switch (data->mode) {
@@ -238,7 +240,7 @@ static void fcm_generator_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, float *
 		}
 			break;
 			
-		case FCM_GENERATOR_POLYNOMIAL_FACTORISED: /* factorised polynomial */
+		case FCM_GENERATOR_POLYNOMIAL_FACTORISED: /* Factorized polynomial */
 		{
 			float value= 1.0f, *cp=NULL;
 			unsigned int i;
@@ -264,7 +266,7 @@ static FModifierTypeInfo FMI_GENERATOR = {
 	sizeof(FMod_Generator), /* size */
 	FMI_TYPE_GENERATE_CURVE, /* action type */
 	FMI_REQUIRES_NOTHING, /* requirements */
-	"Generator", /* name */
+	N_("Generator"), /* name */
 	"FMod_Generator", /* struct name */
 	fcm_generator_free, /* free data */
 	fcm_generator_copy, /* copy data */
@@ -333,7 +335,7 @@ static void fcm_fn_generator_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, floa
 		case FCM_GENERATOR_FN_TAN: /* tangent wave */
 		{
 			/* check that argument is not on one of the discontinuities (i.e. 90deg, 270 deg, etc) */
-			if IS_EQ(fmod((arg - M_PI_2), M_PI), 0.0) {
+			if (IS_EQ(fmod((arg - M_PI_2), M_PI), 0.0)) {
 				if ((data->flag & FCM_GENERATOR_ADDITIVE) == 0)
 					*cvalue = 0.0f; /* no value possible here */
 			}
@@ -367,7 +369,7 @@ static void fcm_fn_generator_evaluate (FCurve *UNUSED(fcu), FModifier *fcm, floa
 			break;
 		
 		default:
-			printf("Invalid Function-Generator for F-Modifier - %d \n", data->type);
+			printf("Invalid Function-Generator for F-Modifier - %d\n", data->type);
 	}
 	
 	/* execute function callback to set value if appropriate */
@@ -386,7 +388,7 @@ static FModifierTypeInfo FMI_FN_GENERATOR = {
 	sizeof(FMod_FunctionGenerator), /* size */
 	FMI_TYPE_GENERATE_CURVE, /* action type */
 	FMI_REQUIRES_NOTHING, /* requirements */
-	"Built-In Function", /* name */
+	N_("Built-In Function"), /* name */
 	"FMod_FunctionGenerator", /* struct name */
 	NULL, /* free data */
 	NULL, /* copy data */
@@ -493,7 +495,7 @@ static FModifierTypeInfo FMI_ENVELOPE = {
 	sizeof(FMod_Envelope), /* size */
 	FMI_TYPE_REPLACE_VALUES, /* action type */
 	0, /* requirements */
-	"Envelope", /* name */
+	N_("Envelope"), /* name */
 	"FMod_Envelope", /* struct name */
 	fcm_envelope_free, /* free data */
 	fcm_envelope_copy, /* copy data */
@@ -506,13 +508,15 @@ static FModifierTypeInfo FMI_ENVELOPE = {
 /* Cycles F-Curve Modifier  --------------------------- */
 
 /* This modifier changes evaltime to something that exists within the curve's frame-range, 
- * then re-evaluates modifier stack up to this point using the new time. This re-entrant behaviour
- * is very likely to be more time-consuming than the original approach... (which was tighly integrated into 
+ * then re-evaluates modifier stack up to this point using the new time. This re-entrant behavior
+ * is very likely to be more time-consuming than the original approach... (which was tightly integrated into
  * the calculation code...).
  *
- * NOTE: this needs to be at the start of the stack to be of use, as it needs to know the extents of the keyframes/sample-data
- * Possible TODO - store length of cycle information that can be initialised from the extents of the keyframes/sample-data, and adjusted
- * 				as appropriate
+ * NOTE: this needs to be at the start of the stack to be of use, as it needs to know the extents of the
+ * keyframes/sample-data.
+ *
+ * Possible TODO - store length of cycle information that can be initialized from the extents of the
+ * keyframes/sample-data, and adjusted as appropriate.
  */
 
 /* temp data used during evaluation */
@@ -571,7 +575,7 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float UNUSED(cvalue),
 	 *	2) if before first frame or after last frame, make sure some cycling is in use
 	 */
 	if (evaltime < prevkey[0]) {
-		if (data->before_mode)  {
+		if (data->before_mode) {
 			side= -1;
 			mode= data->before_mode;
 			cycles= data->before_cycles;
@@ -586,7 +590,7 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float UNUSED(cvalue),
 			ofs= lastkey[0];
 		}
 	}
-	if ELEM(0, side, mode)
+	if ((ELEM(0, side, mode)))
 		return evaltime;
 		
 	/* find relative place within a cycle */
@@ -623,7 +627,7 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float UNUSED(cvalue),
 		
 		/* check if 'cyclic extrapolation', and thus calculate y-offset for this cycle */
 		if (mode == FCM_EXTRAPOLATE_CYCLIC_OFFSET) {
-			if(side < 0)
+			if (side < 0)
 				cycyofs = (float)floor((evaltime - ofs) / cycdx);
 			else
 				cycyofs = (float)ceil((evaltime - ofs) / cycdx);
@@ -631,10 +635,10 @@ static float fcm_cycles_time (FCurve *fcu, FModifier *fcm, float UNUSED(cvalue),
 		}
 		
 		/* special case for cycle start/end */
-		if(cyct == 0.0f) {
+		if (cyct == 0.0f) {
 			evaltime = (side == 1 ? lastkey[0] : prevkey[0]);
 			
-			if((mode == FCM_EXTRAPOLATE_MIRROR) && ((int)cycle % 2))
+			if ((mode == FCM_EXTRAPOLATE_MIRROR) && ((int)cycle % 2))
 				evaltime = (side == 1 ? prevkey[0] : lastkey[0]);
 		}
 		/* calculate where in the cycle we are (overwrite evaltime to reflect this) */
@@ -688,7 +692,7 @@ static FModifierTypeInfo FMI_CYCLES = {
 	sizeof(FMod_Cycles), /* size */
 	FMI_TYPE_EXTRAPOLATION, /* action type */
 	FMI_REQUIRES_ORIGINAL_DATA, /* requirements */
-	"Cycles", /* name */
+	N_("Cycles"), /* name */
 	"FMod_Cycles", /* struct name */
 	NULL, /* free data */
 	NULL, /* copy data */
@@ -746,7 +750,7 @@ static FModifierTypeInfo FMI_NOISE = {
 	sizeof(FMod_Noise), /* size */
 	FMI_TYPE_REPLACE_VALUES, /* action type */
 	0, /* requirements */
-	"Noise", /* name */
+	N_("Noise"), /* name */
 	"FMod_Noise", /* struct name */
 	NULL, /* free data */
 	NULL, /* copy data */
@@ -764,7 +768,7 @@ static FModifierTypeInfo FMI_FILTER = {
 	sizeof(FMod_Filter), /* size */
 	FMI_TYPE_REPLACE_VALUES, /* action type */
 	0, /* requirements */
-	"Filter", /* name */
+	N_("Filter"), /* name */
 	"FMod_Filter", /* struct name */
 	NULL, /* free data */
 	NULL, /* copy data */
@@ -820,7 +824,7 @@ static FModifierTypeInfo FMI_PYTHON = {
 	sizeof(FMod_Python), /* size */
 	FMI_TYPE_GENERATE_CURVE, /* action type */
 	FMI_REQUIRES_RUNTIME_CHECK, /* requirements */
-	"Python", /* name */
+	N_("Python"), /* name */
 	"FMod_Python", /* struct name */
 	fcm_python_free, /* free data */
 	fcm_python_copy, /* copy data */
@@ -863,7 +867,7 @@ static FModifierTypeInfo FMI_LIMITS = {
 	sizeof(FMod_Limits), /* size */
 	FMI_TYPE_GENERATE_CURVE, /* action type */  /* XXX... err... */   
 	FMI_REQUIRES_RUNTIME_CHECK, /* requirements */
-	"Limits", /* name */
+	N_("Limits"), /* name */
 	"FMod_Limits", /* struct name */
 	NULL, /* free data */
 	NULL, /* copy data */
@@ -916,7 +920,7 @@ static FModifierTypeInfo FMI_STEPPED = {
 	sizeof(FMod_Limits), /* size */
 	FMI_TYPE_GENERATE_CURVE, /* action type */  /* XXX... err... */   
 	FMI_REQUIRES_RUNTIME_CHECK, /* requirements */
-	"Stepped", /* name */
+	N_("Stepped"), /* name */
 	"FMod_Stepped", /* struct name */
 	NULL, /* free data */
 	NULL, /* copy data */
@@ -955,7 +959,7 @@ static void fmods_init_typeinfo (void)
  */
 FModifierTypeInfo *get_fmodifier_typeinfo (int type)
 {
-	/* initialise the type-info list? */
+	/* initialize the type-info list? */
 	if (FMI_INIT) {
 		fmods_init_typeinfo();
 		FMI_INIT = 0;
@@ -969,7 +973,7 @@ FModifierTypeInfo *get_fmodifier_typeinfo (int type)
 		return fmodifiersTypeInfo[type];
 	}
 	else {
-		printf("No valid F-Curve Modifier type-info data available. Type = %i \n", type);
+		printf("No valid F-Curve Modifier type-info data available. Type = %i\n", type);
 	}
 	
 	return NULL;
@@ -996,14 +1000,14 @@ FModifier *add_fmodifier (ListBase *modifiers, int type)
 	FModifier *fcm;
 	
 	/* sanity checks */
-	if ELEM(NULL, modifiers, fmi)
+	if (ELEM(NULL, modifiers, fmi))
 		return NULL;
 	
 	/* special checks for whether modifier can be added */
 	if ((modifiers->first) && (type == FMODIFIER_TYPE_CYCLES)) {
 		/* cycles modifier must be first in stack, so for now, don't add if it can't be */
 		// TODO: perhaps there is some better way, but for now, 
-		printf("Error: Cannot add 'Cycles' modifier to F-Curve, as 'Cycles' modifier can only be first in stack. \n");
+		printf("Error: Cannot add 'Cycles' modifier to F-Curve, as 'Cycles' modifier can only be first in stack.\n");
 		return NULL;
 	}
 	
@@ -1059,7 +1063,7 @@ void copy_fmodifiers (ListBase *dst, ListBase *src)
 {
 	FModifier *fcm, *srcfcm;
 	
-	if ELEM(NULL, dst, src)
+	if (ELEM(NULL, dst, src))
 		return;
 	
 	dst->first= dst->last= NULL;
@@ -1102,7 +1106,7 @@ int remove_fmodifier (ListBase *modifiers, FModifier *fcm)
 	} 
 	else {
 		// XXX this case can probably be removed some day, as it shouldn't happen...
-		printf("remove_fmodifier() - no modifier stack given \n");
+		printf("remove_fmodifier() - no modifier stack given\n");
 		MEM_freeN(fcm);
 		return 0;
 	}
@@ -1130,7 +1134,7 @@ FModifier *find_active_fmodifier (ListBase *modifiers)
 	FModifier *fcm;
 	
 	/* sanity checks */
-	if ELEM(NULL, modifiers, modifiers->first)
+	if (ELEM(NULL, modifiers, modifiers->first))
 		return NULL;
 	
 	/* loop over modifiers until 'active' one is found */
@@ -1149,7 +1153,7 @@ void set_active_fmodifier (ListBase *modifiers, FModifier *fcm)
 	FModifier *fm;
 	
 	/* sanity checks */
-	if ELEM(NULL, modifiers, modifiers->first)
+	if (ELEM(NULL, modifiers, modifiers->first))
 		return;
 	
 	/* deactivate all, and set current one active */
@@ -1174,7 +1178,7 @@ short list_has_suitable_fmodifier (ListBase *modifiers, int mtype, short acttype
 		return (modifiers && modifiers->first);
 		
 	/* sanity checks */
-	if ELEM(NULL, modifiers, modifiers->first)
+	if (ELEM(NULL, modifiers, modifiers->first))
 		return 0;
 		
 	/* find the first mdifier fitting these criteria */
@@ -1241,7 +1245,7 @@ static float eval_fmodifier_influence (FModifier *fcm, float evaltime)
 }
 
 /* evaluate time modifications imposed by some F-Curve Modifiers
- *	- this step acts as an optimisation to prevent the F-Curve stack being evaluated 
+ *	- this step acts as an optimization to prevent the F-Curve stack being evaluated 
  *	  several times by modifiers requesting the time be modified, as the final result
  *	  would have required using the modified time
  *	- modifiers only ever receive the unmodified time, as subsequent modifiers should be
@@ -1254,7 +1258,7 @@ float evaluate_time_fmodifiers (ListBase *modifiers, FCurve *fcu, float cvalue,
 	FModifier *fcm;
 	
 	/* sanity checks */
-	if ELEM(NULL, modifiers, modifiers->last)
+	if (ELEM(NULL, modifiers, modifiers->last))
 		return evaltime;
 		
 	/* Starting from the end of the stack, calculate the time effects of various stacked modifiers 
@@ -1303,7 +1307,7 @@ void evaluate_value_fmodifiers (ListBase *modifiers, FCurve *fcu, float *cvalue,
 	FModifier *fcm;
 	
 	/* sanity checks */
-	if ELEM(NULL, modifiers, modifiers->first)
+	if (ELEM(NULL, modifiers, modifiers->first))
 		return;
 	
 	/* evaluate modifiers */
@@ -1341,7 +1345,7 @@ void fcurve_bake_modifiers (FCurve *fcu, int start, int end)
 	
 	/* sanity checks */
 	// TODO: make these tests report errors using reports not printf's
-	if ELEM(NULL, fcu, fcu->modifiers.first) {
+	if (ELEM(NULL, fcu, fcu->modifiers.first)) {
 		printf("Error: No F-Curve with F-Curve Modifiers to Bake\n");
 		return;
 	}
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 0761b8f..b2759f1 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -68,7 +68,7 @@ void free_vfont(struct VFont *vf)
 	if (vf == NULL) return;
 
 	if (vf->data) {
-		while(vf->data->characters.first)
+		while (vf->data->characters.first)
 		{
 			VChar *che = vf->data->characters.first;
 			
@@ -106,7 +106,8 @@ static PackedFile *get_builtin_packedfile(void)
 		printf("Internal error, builtin font not loaded\n");
 
 		return NULL;
-	} else {
+	}
+	else {
 		void *mem= MEM_mallocN(builtin_font_size, "vfd_builtin");
 
 		memcpy(mem, builtin_font_data, builtin_font_size);
@@ -119,8 +120,8 @@ void free_ttfont(void)
 {
 	struct TmpFont *tf;
 
-	for(tf= ttfdata.first; tf; tf= tf->next) {
-		if(tf->pf) freePackedFile(tf->pf); /* NULL when the font file can't be found on disk */
+	for (tf= ttfdata.first; tf; tf= tf->next) {
+		if (tf->pf) freePackedFile(tf->pf); /* NULL when the font file can't be found on disk */
 		tf->pf= NULL;
 		tf->vfont= NULL;
 	}
@@ -131,13 +132,13 @@ struct TmpFont *vfont_find_tmpfont(VFont *vfont)
 {
 	struct TmpFont *tmpfnt = NULL;
 	
-	if(vfont==NULL) return NULL;
+	if (vfont==NULL) return NULL;
 	
 	// Try finding the font from font list
 	tmpfnt = ttfdata.first;
-	while(tmpfnt)
+	while (tmpfnt)
 	{
-		if(tmpfnt->vfont == vfont)
+		if (tmpfnt->vfont == vfont)
 			break;
 		tmpfnt = tmpfnt->next;
 	}
@@ -149,7 +150,7 @@ static VFontData *vfont_get_data(Main *bmain, VFont *vfont)
 	struct TmpFont *tmpfnt = NULL;
 	PackedFile *tpf;
 	
-	if(vfont==NULL) return NULL;
+	if (vfont==NULL) return NULL;
 	
 	// Try finding the font from font list
 	tmpfnt = vfont_find_tmpfont(vfont);
@@ -160,13 +161,13 @@ static VFontData *vfont_get_data(Main *bmain, VFont *vfont)
 		
 		if (strcmp(vfont->name, FO_BUILTIN_NAME)==0) {
 			pf= get_builtin_packedfile();
-		} else {
+		}
+		else {
 			if (vfont->packedfile) {
 				pf= vfont->packedfile;
 				
 				// We need to copy a tmp font to memory unless it is already there
-				if(!tmpfnt)
-				{
+				if (!tmpfnt) {
 					tpf= MEM_callocN(sizeof(*tpf), "PackedFile");
 					tpf->data= MEM_mallocN(pf->size, "packFile");
 					tpf->size= pf->size;
@@ -178,11 +179,11 @@ static VFontData *vfont_get_data(Main *bmain, VFont *vfont)
 					tmpfnt->vfont= vfont;
 					BLI_addtail(&ttfdata, tmpfnt);
 				}
-			} else {
+			}
+			else {
 				pf= newPackedFile(NULL, vfont->name, ID_BLEND_PATH(bmain, &vfont->id));
-				
-				if(!tmpfnt)
-				{
+
+				if (!tmpfnt) {
 					tpf= newPackedFile(NULL, vfont->name, ID_BLEND_PATH(bmain, &vfont->id));
 					
 					// Add temporary packed file to globals
@@ -192,7 +193,7 @@ static VFontData *vfont_get_data(Main *bmain, VFont *vfont)
 					BLI_addtail(&ttfdata, tmpfnt);
 				}
 			}
-			if(!pf) {
+			if (!pf) {
 				printf("Font file doesn't exist: %s\n", vfont->name);
 
 				strcpy(vfont->name, FO_BUILTIN_NAME);
@@ -225,7 +226,8 @@ VFont *load_vfont(Main *bmain, const char *name)
 		
 		pf= get_builtin_packedfile();
 		is_builtin= 1;
-	} else {
+	}
+	else {
 		char dir[FILE_MAXDIR];
 		
 		BLI_strncpy(dir, name, sizeof(dir));
@@ -257,8 +259,7 @@ VFont *load_vfont(Main *bmain, const char *name)
 			}
 			
 			// Do not add FO_BUILTIN_NAME to temporary listbase
-			if(strcmp(filename, FO_BUILTIN_NAME))
-			{
+			if (strcmp(filename, FO_BUILTIN_NAME)) {
 				tmpfnt= (struct TmpFont *) MEM_callocN(sizeof(struct TmpFont), "temp_font");
 				tmpfnt->pf= tpf;
 				tmpfnt->vfont= vfont;
@@ -306,8 +307,8 @@ static VChar *find_vfont_char(VFontData *vfd, intptr_t character)
 {
 	VChar *che= NULL;
 
-	for(che = vfd->characters.first; che; che = che->next) {
-		if(che->index == character)
+	for (che = vfd->characters.first; che; che = che->next) {
+		if (che->index == character)
 			break;
 	}
 	return che; /* NULL if not found */
@@ -333,7 +334,7 @@ static void build_underline(Curve *cu, float x1, float y1, float x2, float y2, i
 	nu2->flagu = CU_NURB_CYCLIC;
 
 	bp = (BPoint*)MEM_callocN(4 * sizeof(BPoint),"underline_bp"); 
-	if (bp == NULL){
+	if (bp == NULL) {
 		MEM_freeN(nu2);
 		return;
 	}
@@ -372,7 +373,7 @@ static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo
 	vfd= vfont_get_data(bmain, which_vfont(cu, info));
 	if (!vfd) return;
 
-	/*
+#if 0
 	if (cu->selend < cu->selstart) {
 		if ((charidx >= (cu->selend)) && (charidx <= (cu->selstart-2)))
 			sel= 1;
@@ -381,7 +382,7 @@ static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo
 		if ((charidx >= (cu->selstart-1)) && (charidx <= (cu->selend-1)))
 			sel= 1;
 	}
-	*/
+#endif
 
 	/* make a copy at distance ofsx,ofsy with shear*/
 	fsize= cu->fsize;
@@ -392,14 +393,14 @@ static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo
 	che= find_vfont_char(vfd, character);
 	
 	// Select the glyph data
-	if(che)
+	if (che)
 		nu1 = che->nurbsbase.first;
 
 	// Create the character
-	while(nu1)
+	while (nu1)
 	{
 		bezt1 = nu1->bezt;
-		if (bezt1){
+		if (bezt1) {
 			nu2 =(Nurb*) MEM_mallocN(sizeof(Nurb),"duplichar_nurb");
 			if (nu2 == NULL) break;
 			memcpy(nu2, nu1, sizeof(struct Nurb));
@@ -419,7 +420,7 @@ static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo
 			i = nu2->pntsu;
 
 			bezt2 = (BezTriple*)MEM_mallocN(i * sizeof(BezTriple),"duplichar_bezt2"); 
-			if (bezt2 == NULL){
+			if (bezt2 == NULL) {
 				MEM_freeN(nu2);
 				break;
 			}
@@ -436,7 +437,7 @@ static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo
 					bezt2++;
 				}
 			}
-			if(rot != 0.0f) {
+			if (rot != 0.0f) {
 				bezt2= nu2->bezt;
 				for (i=nu2->pntsu; i > 0; i--) {
 					fp= bezt2->vec[0];
@@ -456,7 +457,7 @@ static void buildchar(Main *bmain, Curve *cu, unsigned long character, CharInfo
 			}
 			bezt2 = nu2->bezt;
 
-			if(info->flag & CU_CHINFO_SMALLCAPS_CHECK) {
+			if (info->flag & CU_CHINFO_SMALLCAPS_CHECK) {
 				const float sca= cu->smallcaps_scale;
 				for (i= nu2->pntsu; i > 0; i--) {
 					fp= bezt2->vec[0];
@@ -511,10 +512,10 @@ int BKE_font_getselection(Object *ob, int *start, int *end)
 static float char_width(Curve *cu, VChar *che, CharInfo *info)
 {
 	// The character wasn't found, propably ascii = 0, then the width shall be 0 as well
-	if(che == NULL) {
+	if (che == NULL) {
 		return 0.0f;
 	}
-	else if(info->flag & CU_CHINFO_SMALLCAPS_CHECK) {
+	else if (info->flag & CU_CHINFO_SMALLCAPS_CHECK) {
 		return che->width * cu->smallcaps_scale;
 	}
 	else {
@@ -541,16 +542,16 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
 	wchar_t *mem, *tmp, ascii;
 
 	/* renark: do calculations including the trailing '\0' of a string
-	   because the cursor can be at that location */
+	 * because the cursor can be at that location */
 
-	if(ob->type!=OB_FONT) return NULL;
+	if (ob->type!=OB_FONT) return NULL;
 
 	// Set font data
 	cu= (Curve *) ob->data;
 	vfont= cu->vfont;
 	
-	if(cu->str == NULL) return NULL;
-	if(vfont == NULL) return NULL;
+	if (cu->str == NULL) return NULL;
+	if (vfont == NULL) return NULL;
 
 	// Create unicode string
 	utf8len = BLI_strlen_utf8(cu->str);
@@ -577,8 +578,8 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
 	vfd= vfont_get_data(bmain, vfont);
 
 	/* The VFont Data can not be found */
-	if(!vfd) {
-		if(mem)
+	if (!vfd) {
+		if (mem)
 			MEM_freeN(mem);	
 		return NULL;
 	}
@@ -617,9 +618,9 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
 		// Characters in the list
 		info = &(custrinfo[i]);
 		ascii = mem[i];
-		if(info->flag & CU_CHINFO_SMALLCAPS) {
+		if (info->flag & CU_CHINFO_SMALLCAPS) {
 			ascii = towupper(ascii);
-			if(mem[i] != ascii) {
+			if (mem[i] != ascii) {
 				mem[i]= ascii;
 				info->flag |= CU_CHINFO_SMALLCAPS_CHECK;
 			}
@@ -627,7 +628,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
 
 		vfont = which_vfont(cu, info);
 		
-		if(vfont==NULL) break;
+		if (vfont==NULL) break;
 
 		che= find_vfont_char(vfd, ascii);
 
@@ -636,7 +637,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
 		 * But if the font is FO_BUILTIN_NAME then do not try loading since
 		 * whole font is in the memory already
 		 */
-		if(che == NULL && strcmp(vfont->name, FO_BUILTIN_NAME))	{
+		if (che == NULL && strcmp(vfont->name, FO_BUILTIN_NAME))	{
 			BLI_vfontchar_from_freetypefont(vfont, ascii);
 		}
 
@@ -645,7 +646,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
 
 		/* No VFont found */
 		if (vfont==NULL) {
-			if(mem)
+			if (mem)
 				MEM_freeN(mem);
 			MEM_freeN(chartransdata);
 			return NULL;
@@ -658,7 +659,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
 
 		/* VFont Data for VFont couldn't be found */
 		if (!vfd) {
-			if(mem)
+			if (mem)
 				MEM_freeN(mem);
 			MEM_freeN(chartransdata);
 			return NULL;
@@ -667,7 +668,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
 		twidth = char_width(cu, che, info);
 
 		// Calculate positions
-		if((tb->w != 0.0f) && (ct->dobreak==0) && ((xof-(tb->x/cu->fsize)+twidth)*cu->fsize) > tb->w + cu->xof*cu->fsize) {
+		if ((tb->w != 0.0f) && (ct->dobreak==0) && ((xof-(tb->x/cu->fsize)+twidth)*cu->fsize) > tb->w + cu->xof*cu->fsize) {
 	//		fprintf(stderr, "linewidth exceeded: %c%c%c...\n", mem[i], mem[i+1], mem[i+2]);
 			for (j=i; j && (mem[j] != '\n') && (mem[j] != '\r') && (chartransdata[j].dobreak==0); j--) {
 				if (mem[j]==' ' || mem[j]=='-') {
@@ -693,7 +694,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
 				}
 			}
 		}
-		if(ascii== '\n' || ascii== '\r' || ascii==0 || ct->dobreak) {
+		if (ascii== '\n' || ascii== '\r' || ascii==0 || ct->dobreak) {
 			ct->xof= xof;
 			ct->yof= yof;
 			ct->linenr= lnr;
@@ -718,7 +719,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
 
 			/* XXX, has been unused for years, need to check if this is useful, r4613 r5282 - campbell */
 #if 0
-			if(ascii == '\n' || ascii == '\r')
+			if (ascii == '\n' || ascii == '\r')
 				xof = cu->xof;
 			else
 				xof= cu->xof + (tb->x/cu->fsize);
@@ -729,7 +730,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
 			cnr= 0;
 			wsnr= 0;
 		}
-		else if(ascii==9) {	/* TAB */
+		else if (ascii==9) {	/* TAB */
 			float tabfac;
 			
 			ct->xof= xof;
@@ -779,7 +780,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
 	tmp = mem;
 	for (i= 0; i<=slen; i++, tmp++, ct++) {
 		ascii = *tmp;
-		if(ascii== '\n' || ascii== '\r' || ct->dobreak) cu->lines++;
+		if (ascii== '\n' || ascii== '\r' || ct->dobreak) cu->lines++;
 	}	
 
 	// linedata is now: width of line
@@ -787,36 +788,40 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
 	// linedata3 is now: maxlen of that line
 	// linedata4 is now: number of whitespaces of line
 
-	if(cu->spacemode!=CU_LEFT) {
+	if (cu->spacemode!=CU_LEFT) {
 		ct= chartransdata;
 
-		if(cu->spacemode==CU_RIGHT) {
-			for(i=0;i<lnr;i++) linedata[i]= linedata3[i]-linedata[i];
+		if (cu->spacemode==CU_RIGHT) {
+			for (i=0;i<lnr;i++) linedata[i]= linedata3[i]-linedata[i];
 			for (i=0; i<=slen; i++) {
 				ct->xof+= linedata[ct->linenr];
 				ct++;
 			}
-		} else if(cu->spacemode==CU_MIDDLE) {
-			for(i=0;i<lnr;i++) linedata[i]= (linedata3[i]-linedata[i])/2;
+		}
+		else if (cu->spacemode==CU_MIDDLE) {
+			for (i=0;i<lnr;i++) linedata[i]= (linedata3[i]-linedata[i])/2;
 			for (i=0; i<=slen; i++) {
 				ct->xof+= linedata[ct->linenr];
 				ct++;
 			}
-		} else if((cu->spacemode==CU_FLUSH) &&
+		}
+		else if ((cu->spacemode==CU_FLUSH) &&
 				  (cu->tb[0].w != 0.0f)) {
-			for(i=0;i<lnr;i++)
-				if(linedata2[i]>1)
+			for (i=0;i<lnr;i++)
+				if (linedata2[i]>1)
 					linedata[i]= (linedata3[i]-linedata[i])/(linedata2[i]-1);
 			for (i=0; i<=slen; i++) {
-				for (j=i; (mem[j]) && (mem[j]!='\n') && 
-						  (mem[j]!='\r') && (chartransdata[j].dobreak==0) && (j<slen); j++);
+				for (j=i; (!ELEM3(mem[j], '\0', '\n', '\r')) && (chartransdata[j].dobreak == 0) && (j < slen); j++) {
+					/* do nothing */
+				}
+
 //				if ((mem[j]!='\r') && (mem[j]!='\n') && (mem[j])) {
 					ct->xof+= ct->charnr*linedata[ct->linenr];
 //				}
 				ct++;
 			}
 		} 
-		else if((cu->spacemode==CU_JUSTIFY) && (cu->tb[0].w != 0.0f)) {
+		else if ((cu->spacemode==CU_JUSTIFY) && (cu->tb[0].w != 0.0f)) {
 			float curofs= 0.0f;
 			for (i=0; i<=slen; i++) {
 				for (j=i; (mem[j]) && (mem[j]!='\n') && 
@@ -834,14 +839,14 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
 	
 	/* TEXT ON CURVE */
 	/* Note: Only OB_CURVE objects could have a path  */
-	if(cu->textoncurve && cu->textoncurve->type==OB_CURVE) {
+	if (cu->textoncurve && cu->textoncurve->type==OB_CURVE) {
 		Curve *cucu= cu->textoncurve->data;
 		int oldflag= cucu->flag;
 		
 		cucu->flag |= (CU_PATH+CU_FOLLOW);
 		
-		if(cucu->path==NULL) makeDispListCurveTypes(scene, cu->textoncurve, 0);
-		if(cucu->path) {
+		if (cucu->path==NULL) makeDispListCurveTypes(scene, cu->textoncurve, 0);
+		if (cucu->path) {
 			float distfac, imat[4][4], imat3[3][3], cmat[3][3];
 			float minx, maxx, miny, maxy;
 			float timeofs, sizefac;
@@ -857,10 +862,10 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
 			maxx=maxy= -1.0e20f;
 			ct= chartransdata;
 			for (i=0; i<=slen; i++, ct++) {
-				if(minx>ct->xof) minx= ct->xof;
-				if(maxx<ct->xof) maxx= ct->xof;
-				if(miny>ct->yof) miny= ct->yof;
-				if(maxy<ct->yof) maxy= ct->yof;
+				if (minx>ct->xof) minx= ct->xof;
+				if (maxx<ct->xof) maxx= ct->xof;
+				if (miny>ct->yof) miny= ct->yof;
+				if (maxy<ct->yof) maxy= ct->yof;
 			}
 			
 			/* we put the x-coordinaat exact at the curve, the y is rotated */
@@ -869,17 +874,17 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
 			distfac= sizefac*cucu->path->totdist/(maxx-minx);
 			timeofs= 0.0f;
 			
-			if(distfac > 1.0f) {
+			if (distfac > 1.0f) {
 				/* path longer than text: spacemode involves */
 				distfac= 1.0f/distfac;
 				
-				if(cu->spacemode==CU_RIGHT) {
+				if (cu->spacemode==CU_RIGHT) {
 					timeofs= 1.0f-distfac;
 				}
-				else if(cu->spacemode==CU_MIDDLE) {
+				else if (cu->spacemode==CU_MIDDLE) {
 					timeofs= (1.0f-distfac)/2.0f;
 				}
-				else if(cu->spacemode==CU_FLUSH) distfac= 1.0f;
+				else if (cu->spacemode==CU_FLUSH) distfac= 1.0f;
 				
 			}
 			else distfac= 1.0;
@@ -937,13 +942,13 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
 		}
 	}
 
-	if(mode==FO_CURSUP || mode==FO_CURSDOWN || mode==FO_PAGEUP || mode==FO_PAGEDOWN) {
+	if (mode==FO_CURSUP || mode==FO_CURSDOWN || mode==FO_PAGEUP || mode==FO_PAGEDOWN) {
 		/* 2: curs up
-		   3: curs down */
+		 * 3: curs down */
 		ct= chartransdata+cu->pos;
 		
-		if((mode==FO_CURSUP || mode==FO_PAGEUP) && ct->linenr==0);
-		else if((mode==FO_CURSDOWN || mode==FO_PAGEDOWN) && ct->linenr==lnr);
+		if ((mode==FO_CURSUP || mode==FO_PAGEUP) && ct->linenr==0);
+		else if ((mode==FO_CURSDOWN || mode==FO_PAGEDOWN) && ct->linenr==lnr);
 		else {
 			switch(mode) {
 				case FO_CURSUP:		lnr= ct->linenr-1; break;
@@ -956,11 +961,11 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
 			cu->pos= 0;
 			ct= chartransdata;
 			for (i= 0; i<slen; i++) {
-				if(ct->linenr==lnr) {
-					if(ct->charnr==cnr) break;
-					if( (ct+1)->charnr==0) break;
+				if (ct->linenr==lnr) {
+					if (ct->charnr==cnr) break;
+					if ( (ct+1)->charnr==0) break;
 				}
-				else if(ct->linenr>lnr) break;
+				else if (ct->linenr>lnr) break;
 				cu->pos++;
 				ct++;
 			}
@@ -968,7 +973,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
 	}
 	
 	/* cursor first */
-	if(cu->editfont) {
+	if (cu->editfont) {
 		float si, co;
 		
 		ct= chartransdata+cu->pos;
@@ -1002,7 +1007,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
 		return NULL;
 	}
 
-	if(mode == FO_EDIT) {
+	if (mode == FO_EDIT) {
 		/* make nurbdata */
 		freeNurblist(&cu->nurb);
 		
@@ -1016,7 +1021,7 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
 					info->mat_nr = 0;
 				}
 				// We do not want to see any character for \n or \r
-				if(cha != '\n' && cha != '\r')
+				if (cha != '\n' && cha != '\r')
 					buildchar(bmain, cu, cha, info, ct->xof, ct->yof, ct->rot, i);
 				
 				if ((info->flag & CU_CHINFO_UNDERLINE) && (cu->textoncurve == NULL) && (cha != '\n') && (cha != '\r')) {
@@ -1067,12 +1072,12 @@ struct chartrans *BKE_text_to_curve(Main *bmain, Scene *scene, Object *ob, int m
 		}
 	}
 
-	if(mode==FO_DUPLI) {
+	if (mode==FO_DUPLI) {
 		MEM_freeN(mem);
 		return chartransdata;
 	}
 
-	if(mem)
+	if (mem)
 		MEM_freeN(mem);
 
 	MEM_freeN(chartransdata);
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index adbc0f0..811cb88 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -151,7 +151,7 @@ bGPDframe *gpencil_frame_addnew (bGPDlayer *gpl, int cframe)
 	/* check whether frame was added successfully */
 	if (state == -1) {
 		MEM_freeN(gpf);
-		printf("Error: frame (%d) existed already for this layer \n", cframe);
+		printf("Error: frame (%d) existed already for this layer\n", cframe);
 	}
 	else if (state == 0) {
 		/* add to end then! */
@@ -428,7 +428,7 @@ bGPDframe *gpencil_layer_getframe (bGPDlayer *gpl, int cframe, short addnew)
 			gpl->actframe= gpf;
 		else {
 			/* unresolved errogenous situation! */
-			printf("Error: cannot find appropriate gp-frame \n");
+			printf("Error: cannot find appropriate gp-frame\n");
 			/* gpl->actframe should still be NULL */
 		}
 	}
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c
index 7ac3952..b20a59e 100644
--- a/source/blender/blenkernel/intern/group.c
+++ b/source/blender/blenkernel/intern/group.c
@@ -66,7 +66,7 @@ void free_group_objects(Group *group)
 	/* don't free group itself */
 	GroupObject *go;
 	
-	while(group->gobject.first) {
+	while (group->gobject.first) {
 		go= group->gobject.first;
 		BLI_remlink(&group->gobject, go);
 		free_group_object(go);
@@ -82,52 +82,52 @@ void unlink_group(Group *group)
 	SceneRenderLayer *srl;
 	ParticleSystem *psys;
 	
-	for(ma= bmain->mat.first; ma; ma= ma->id.next) {
-		if(ma->group==group)
+	for (ma= bmain->mat.first; ma; ma= ma->id.next) {
+		if (ma->group==group)
 			ma->group= NULL;
 	}
-	for(ma= bmain->mat.first; ma; ma= ma->id.next) {
-		if(ma->group==group)
+	for (ma= bmain->mat.first; ma; ma= ma->id.next) {
+		if (ma->group==group)
 			ma->group= NULL;
 	}
 	for (sce= bmain->scene.first; sce; sce= sce->id.next) {
 		Base *base= sce->base.first;
 		
 		/* ensure objects are not in this group */
-		for(; base; base= base->next) {
-			if(rem_from_group(group, base->object, sce, base) && find_group(base->object, NULL)==NULL) {
+		for (; base; base= base->next) {
+			if (rem_from_group(group, base->object, sce, base) && find_group(base->object, NULL)==NULL) {
 				base->object->flag &= ~OB_FROMGROUP;
 				base->flag &= ~OB_FROMGROUP;
 			}
 		}			
 		
-		for(srl= sce->r.layers.first; srl; srl= srl->next) {
+		for (srl= sce->r.layers.first; srl; srl= srl->next) {
 			if (srl->light_override==group)
 				srl->light_override= NULL;
 		}
 	}
 	
-	for(ob= bmain->object.first; ob; ob= ob->id.next) {
+	for (ob= bmain->object.first; ob; ob= ob->id.next) {
 		
-		if(ob->dup_group==group) {
+		if (ob->dup_group==group) {
 			ob->dup_group= NULL;
 #if 0		/* XXX OLD ANIMSYS, NLASTRIPS ARE NO LONGER USED */
 			{
 				bActionStrip *strip;
 				/* duplicator strips use a group object, we remove it */
-				for(strip= ob->nlastrips.first; strip; strip= strip->next) {
-					if(strip->object)
+				for (strip= ob->nlastrips.first; strip; strip= strip->next) {
+					if (strip->object)
 						strip->object= NULL;
 				}
 			}
 #endif
 		}
 		
-		for(psys=ob->particlesystem.first; psys; psys=psys->next){
-			if(psys->part->dup_group==group)
+		for (psys=ob->particlesystem.first; psys; psys=psys->next) {
+			if (psys->part->dup_group==group)
 				psys->part->dup_group= NULL;
 #if 0		/* not used anymore, only keps for readfile.c, no need to account for this */
-			if(psys->part->eff_group==group)
+			if (psys->part->eff_group==group)
 				psys->part->eff_group= NULL;
 #endif
 		}
@@ -162,11 +162,11 @@ static int add_to_group_internal(Group *group, Object *ob)
 {
 	GroupObject *go;
 	
-	if(group==NULL || ob==NULL) return 0;
+	if (group==NULL || ob==NULL) return 0;
 	
 	/* check if the object has been added already */
-	for(go= group->gobject.first; go; go= go->next) {
-		if(go->ob==ob) return 0;
+	for (go= group->gobject.first; go; go= go->next) {
+		if (go->ob==ob) return 0;
 	}
 	
 	go= MEM_callocN(sizeof(GroupObject), "groupobject");
@@ -179,15 +179,15 @@ static int add_to_group_internal(Group *group, Object *ob)
 
 int add_to_group(Group *group, Object *object, Scene *scene, Base *base)
 {
-	if(add_to_group_internal(group, object)) {
-		if((object->flag & OB_FROMGROUP)==0) {
+	if (add_to_group_internal(group, object)) {
+		if ((object->flag & OB_FROMGROUP)==0) {
 
-			if(scene && base==NULL)
+			if (scene && base==NULL)
 				base= object_in_scene(object, scene);
 
 			object->flag |= OB_FROMGROUP;
 
-			if(base)
+			if (base)
 				base->flag |= OB_FROMGROUP;
 		}
 		return 1;
@@ -202,12 +202,12 @@ static int rem_from_group_internal(Group *group, Object *ob)
 {
 	GroupObject *go, *gon;
 	int removed = 0;
-	if(group==NULL) return 0;
+	if (group==NULL) return 0;
 	
 	go= group->gobject.first;
-	while(go) {
+	while (go) {
 		gon= go->next;
-		if(go->ob==ob) {
+		if (go->ob==ob) {
 			BLI_remlink(&group->gobject, go);
 			free_group_object(go);
 			removed = 1;
@@ -220,15 +220,15 @@ static int rem_from_group_internal(Group *group, Object *ob)
 
 int rem_from_group(Group *group, Object *object, Scene *scene, Base *base)
 {
-	if(rem_from_group_internal(group, object)) {
+	if (rem_from_group_internal(group, object)) {
 		/* object can be NULL */
-		if(object && find_group(object, NULL) == NULL) {
-			if(scene && base==NULL)
+		if (object && find_group(object, NULL) == NULL) {
+			if (scene && base==NULL)
 				base= object_in_scene(object, scene);
 
 			object->flag &= ~OB_FROMGROUP;
 
-			if(base)
+			if (base)
 				base->flag &= ~OB_FROMGROUP;
 		}
 		return 1;
@@ -242,10 +242,10 @@ int object_in_group(Object *ob, Group *group)
 {
 	GroupObject *go;
 	
-	if(group==NULL || ob==NULL) return 0;
+	if (group==NULL || ob==NULL) return 0;
 	
-	for(go= group->gobject.first; go; go= go->next) {
-		if(go->ob==ob) 
+	for (go= group->gobject.first; go; go= go->next) {
+		if (go->ob==ob) 
 			return 1;
 	}
 	return 0;
@@ -258,8 +258,8 @@ Group *find_group(Object *ob, Group *group)
 	else
 		group= G.main->group.first;
 	
-	while(group) {
-		if(object_in_group(ob, group))
+	while (group) {
+		if (object_in_group(ob, group))
 			return group;
 		group= group->id.next;
 	}
@@ -270,10 +270,10 @@ void group_tag_recalc(Group *group)
 {
 	GroupObject *go;
 	
-	if(group==NULL) return;
+	if (group==NULL) return;
 	
-	for(go= group->gobject.first; go; go= go->next) {
-		if(go->ob) 
+	for (go= group->gobject.first; go; go= go->next) {
+		if (go->ob) 
 			go->ob->recalc= go->recalc;
 	}
 }
@@ -283,12 +283,12 @@ int group_is_animated(Object *UNUSED(parent), Group *group)
 	GroupObject *go;
 
 #if 0 /* XXX OLD ANIMSYS, NLASTRIPS ARE NO LONGER USED */
-	if(parent->nlastrips.first)
+	if (parent->nlastrips.first)
 		return 1;
 #endif
 
-	for(go= group->gobject.first; go; go= go->next)
-		if(go->ob && go->ob->proxy)
+	for (go= group->gobject.first; go; go= go->next)
+		if (go->ob && go->ob->proxy)
 			return 1;
 
 	return 0;
@@ -304,11 +304,11 @@ static void group_replaces_nla(Object *parent, Object *target, char mode)
 	static int done= 0;
 	bActionStrip *strip, *nstrip;
 	
-	if(mode=='s') {
+	if (mode=='s') {
 		
-		for(strip= parent->nlastrips.first; strip; strip= strip->next) {
-			if(strip->object==target) {
-				if(done==0) {
+		for (strip= parent->nlastrips.first; strip; strip= strip->next) {
+			if (strip->object==target) {
+				if (done==0) {
 					/* clear nla & action from object */
 					nlastrips= target->nlastrips;
 					target->nlastrips.first= target->nlastrips.last= NULL;
@@ -322,8 +322,8 @@ static void group_replaces_nla(Object *parent, Object *target, char mode)
 			}
 		}
 	}
-	else if(mode=='e') {
-		if(done) {
+	else if (mode=='e') {
+		if (done) {
 			BLI_freelistN(&target->nlastrips);
 			target->nlastrips= nlastrips;
 			target->action= action;
@@ -337,28 +337,28 @@ static void group_replaces_nla(Object *parent, Object *target, char mode)
 #endif
 
 /* puts all group members in local timing system, after this call
-you can draw everything, leaves tags in objects to signal it needs further updating */
+ * you can draw everything, leaves tags in objects to signal it needs further updating */
 
 /* note: does not work for derivedmesh and render... it recreates all again in convertblender.c */
 void group_handle_recalc_and_update(Scene *scene, Object *UNUSED(parent), Group *group)
 {
 	GroupObject *go;
 	
-#if 0 /* warning, isnt clearing the recalc flag on the object which causes it to run all the time,
+#if 0 /* warning, isn't clearing the recalc flag on the object which causes it to run all the time,
 	   * not just on frame change.
-	   * This isnt working because the animation data is only re-evalyated on frame change so commenting for now
+	   * This isn't working because the animation data is only re-evalyated on frame change so commenting for now
 	   * but when its enabled at some point it will need to be changed so as not to update so much - campbell */
 
 	/* if animated group... */
-	if(parent->nlastrips.first) {
+	if (parent->nlastrips.first) {
 		int cfrao;
 		
 		/* switch to local time */
 		cfrao= scene->r.cfra;
 		
 		/* we need a DAG per group... */
-		for(go= group->gobject.first; go; go= go->next) {
-			if(go->ob && go->recalc) {
+		for (go= group->gobject.first; go; go= go->next) {
+			if (go->ob && go->recalc) {
 				go->ob->recalc= go->recalc;
 				
 				group_replaces_nla(parent, go->ob, 's');
@@ -377,9 +377,9 @@ void group_handle_recalc_and_update(Scene *scene, Object *UNUSED(parent), Group
 #endif
 	{
 		/* only do existing tags, as set by regular depsgraph */
-		for(go= group->gobject.first; go; go= go->next) {
-			if(go->ob) {
-				if(go->ob->recalc) {
+		for (go= group->gobject.first; go; go= go->next) {
+			if (go->ob) {
+				if (go->ob->recalc) {
 					object_handle_update(scene, go->ob);
 				}
 			}
@@ -392,17 +392,17 @@ Object *group_get_member_with_action(Group *group, bAction *act)
 {
 	GroupObject *go;
 	
-	if(group==NULL || act==NULL) return NULL;
+	if (group==NULL || act==NULL) return NULL;
 	
-	for(go= group->gobject.first; go; go= go->next) {
-		if(go->ob) {
-			if(go->ob->action==act)
+	for (go= group->gobject.first; go; go= go->next) {
+		if (go->ob) {
+			if (go->ob->action==act)
 				return go->ob;
-			if(go->ob->nlastrips.first) {
+			if (go->ob->nlastrips.first) {
 				bActionStrip *strip;
 				
-				for(strip= go->ob->nlastrips.first; strip; strip= strip->next) {
-					if(strip->act==act)
+				for (strip= go->ob->nlastrips.first; strip; strip= strip->next) {
+					if (strip->act==act)
 						return go->ob;
 				}
 			}
@@ -419,18 +419,18 @@ void group_relink_nla_objects(Object *ob)
 	GroupObject *go;
 	bActionStrip *strip;
 	
-	if(ob==NULL || ob->dup_group==NULL) return;
+	if (ob==NULL || ob->dup_group==NULL) return;
 	group= ob->dup_group;
 	
-	for(strip= ob->nlastrips.first; strip; strip= strip->next) {
-		if(strip->object) {
-			for(go= group->gobject.first; go; go= go->next) {
-				if(go->ob) {
-					if(strcmp(go->ob->id.name, strip->object->id.name)==0)
+	for (strip= ob->nlastrips.first; strip; strip= strip->next) {
+		if (strip->object) {
+			for (go= group->gobject.first; go; go= go->next) {
+				if (go->ob) {
+					if (strcmp(go->ob->id.name, strip->object->id.name)==0)
 						break;
 				}
 			}
-			if(go)
+			if (go)
 				strip->object= go->ob;
 			else
 				strip->object= NULL;
diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c
index bcbce2b..edde21e 100644
--- a/source/blender/blenkernel/intern/icons.c
+++ b/source/blender/blenkernel/intern/icons.c
@@ -66,8 +66,7 @@ static void icon_free(void *val)
 {
 	Icon* icon = val;
 
-	if (icon)
-	{
+	if (icon) {
 		if (icon->drawinfo_free) {		
 			icon->drawinfo_free(icon->drawinfo);
 		}
@@ -79,7 +78,7 @@ static void icon_free(void *val)
 }
 
 /* create an id for a new icon and make sure that ids from deleted icons get reused
-   after the integer number range is used up */
+ * after the integer number range is used up */
 static int get_next_free_id(void)
 {
 	int startId = gFirstIconId;
@@ -92,7 +91,7 @@ static int get_next_free_id(void)
 	while (BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(startId)) && startId>=gFirstIconId) 
 		startId++;
 
-	/* if we found a suitable one that isnt used yet, return it */
+	/* if we found a suitable one that isn't used yet, return it */
 	if (startId>=gFirstIconId)
 		return startId;
 
@@ -111,7 +110,7 @@ void BKE_icons_init(int first_dyn_id)
 
 void BKE_icons_free(void)
 {
-	if(gIcons)
+	if (gIcons)
 		BLI_ghash_free(gIcons, NULL, icon_free);
 	gIcons = NULL;
 }
@@ -148,7 +147,7 @@ void BKE_previewimg_freefunc(void *link)
 
 void BKE_previewimg_free(PreviewImage **prv)
 {
-	if(prv && (*prv)) {
+	if (prv && (*prv)) {
 		BKE_previewimg_freefunc(*prv);
 		*prv = NULL;
 	}
@@ -164,7 +163,8 @@ struct PreviewImage* BKE_previewimg_copy(PreviewImage *prv)
 		for (i=0; i < NUM_ICON_SIZES; ++i) {
 			if (prv->rect[i]) {
 				prv_img->rect[i] = MEM_dupallocN(prv->rect[i]);
-			} else {
+			}
+			else {
 				prv_img->rect[i] = NULL;
 			}
 		}
@@ -177,19 +177,24 @@ void BKE_previewimg_free_id(ID *id)
 	if (GS(id->name) == ID_MA) {
 		Material *mat = (Material*)id;	
 		BKE_previewimg_free(&mat->preview);
-	} else if (GS(id->name) == ID_TE) {
+	}
+	else if (GS(id->name) == ID_TE) {
 		Tex *tex = (Tex*)id;
 		BKE_previewimg_free(&tex->preview);
-	} else if (GS(id->name) == ID_WO) {
+	}
+	else if (GS(id->name) == ID_WO) {
 		World *wo = (World*)id;
 		BKE_previewimg_free(&wo->preview);
-	} else if (GS(id->name) == ID_LA) {
+	}
+	else if (GS(id->name) == ID_LA) {
 		Lamp *la  = (Lamp*)id;
 		BKE_previewimg_free(&la->preview);
-	} else if (GS(id->name) == ID_IM) {
+	}
+	else if (GS(id->name) == ID_IM) {
 		Image *img  = (Image*)id;
 		BKE_previewimg_free(&img->preview);
-	} else if (GS(id->name) == ID_BR) {
+	}
+	else if (GS(id->name) == ID_BR) {
 		Brush *br  = (Brush*)id;
 		BKE_previewimg_free(&br->preview);
 	}
@@ -203,23 +208,28 @@ PreviewImage* BKE_previewimg_get(ID *id)
 		Material *mat = (Material*)id;	
 		if (!mat->preview) mat->preview = BKE_previewimg_create();
 		prv_img = mat->preview;
-	} else if (GS(id->name) == ID_TE) {
+	}
+	else if (GS(id->name) == ID_TE) {
 		Tex *tex = (Tex*)id;
 		if (!tex->preview) tex->preview = BKE_previewimg_create();
 		prv_img = tex->preview;
-	} else if (GS(id->name) == ID_WO) {
+	}
+	else if (GS(id->name) == ID_WO) {
 		World *wo = (World*)id;
 		if (!wo->preview) wo->preview = BKE_previewimg_create();
 		prv_img = wo->preview;
-	} else if (GS(id->name) == ID_LA) {
+	}
+	else if (GS(id->name) == ID_LA) {
 		Lamp *la  = (Lamp*)id;
 		if (!la->preview) la->preview = BKE_previewimg_create();
 		prv_img = la->preview;
-	} else if (GS(id->name) == ID_IM) {
+	}
+	else if (GS(id->name) == ID_IM) {
 		Image *img  = (Image*)id;
 		if (!img->preview) img->preview = BKE_previewimg_create();
 		prv_img = img->preview;
-	} else if (GS(id->name) == ID_BR) {
+	}
+	else if (GS(id->name) == ID_BR) {
 		Brush *br  = (Brush*)id;
 		if (!br->preview) br->preview = BKE_previewimg_create();
 		prv_img = br->preview;
@@ -236,8 +246,7 @@ void BKE_icon_changed(int id)
 
 	icon = BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(id));
 	
-	if (icon)
-	{
+	if (icon) {
 		PreviewImage *prv = BKE_previewimg_get((ID*)icon->obj);
 
 		/* all previews changed */
@@ -263,7 +272,7 @@ int BKE_icon_getid(struct ID* id)
 
 	id->icon_id = get_next_free_id();
 
-	if (!id->icon_id){
+	if (!id->icon_id) {
 		printf("BKE_icon_getid: Internal error - not enough IDs\n");
 		return 0;
 	}
@@ -302,8 +311,7 @@ void BKE_icon_set(int icon_id, struct Icon* icon)
 
 	old_icon = BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(icon_id));
 
-	if (old_icon)
-	{
+	if (old_icon) {
 		printf("BKE_icon_set: Internal error, icon already set: %d\n", icon_id);
 		return;
 	}
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index d9fe013..bb51325 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -60,8 +60,8 @@ static char idp_size_table[] = {
 
 /* --------- property array type -------------*/
 
-/*note: as a start to move away from the stupid IDP_New function, this type
-  has it's own allocation function.*/
+/* note: as a start to move away from the stupid IDP_New function, this type
+ * has it's own allocation function.*/
 IDProperty *IDP_NewIDPArray(const char *name)
 {
 	IDProperty *prop = MEM_callocN(sizeof(IDProperty), "IDProperty prop array");
@@ -74,7 +74,7 @@ IDProperty *IDP_NewIDPArray(const char *name)
 
 IDProperty *IDP_CopyIDPArray(IDProperty *array)
 {
-	/* dont use MEM_dupallocN because this may be part of an array */
+	/* don't use MEM_dupallocN because this may be part of an array */
 	IDProperty *narray = MEM_mallocN(sizeof(IDProperty), "IDP_CopyIDPArray"), *tmp;
 	int i;
 
@@ -82,12 +82,12 @@ IDProperty *IDP_CopyIDPArray(IDProperty *array)
 
 	narray->data.pointer = MEM_dupallocN(array->data.pointer);
 	for (i=0; i<narray->len; i++) {
-		/*ok, the copy functions always allocate a new structure,
-		  which doesn't work here.  instead, simply copy the
-		  contents of the new structure into the array cell,
-		  then free it.  this makes for more maintainable
-		  code than simply reimplementing the copy functions
-		  in this loop.*/
+		/* ok, the copy functions always allocate a new structure,
+		 * which doesn't work here.  instead, simply copy the
+		 * contents of the new structure into the array cell,
+		 * then free it.  this makes for more maintainable
+		 * code than simply reimplementing the copy functions
+		 * in this loop.*/
 		tmp = IDP_CopyProperty(GETPROP(narray, i));
 		memcpy(GETPROP(narray, i), tmp, sizeof(IDProperty));
 		MEM_freeN(tmp);
@@ -103,7 +103,7 @@ void IDP_FreeIDPArray(IDProperty *prop)
 	for (i=0; i<prop->len; i++)
 		IDP_FreeProperty(GETPROP(prop, i));
 
-	if(prop->data.pointer)
+	if (prop->data.pointer)
 		MEM_freeN(prop->data.pointer);
 }
 
@@ -139,14 +139,14 @@ void IDP_ResizeIDPArray(IDProperty *prop, int newlen)
 	if (newlen <= prop->totallen && prop->totallen - newlen < 200) {
 		int i;
 
-		for(i=newlen; i<prop->len; i++)
+		for (i=newlen; i<prop->len; i++)
 			IDP_FreeProperty(GETPROP(prop, i));
 
 		prop->len = newlen;
 		return;
 	}
 
-	/* - Note: This code comes from python, here's the corrusponding comment. - */
+	/* - Note: This code comes from python, here's the corresponding comment. - */
 	/* This over-allocates proportional to the list size, making room
 	 * for additional growth.  The over-allocation is mild, but is
 	 * enough to give linear-time amortized behavior over a long
@@ -170,7 +170,7 @@ void IDP_ResizeIDPArray(IDProperty *prop, int newlen)
 		memcpy(newarr, prop->data.pointer, newlen*sizeof(IDProperty));
 	}
 
-	if(prop->data.pointer)
+	if (prop->data.pointer)
 		MEM_freeN(prop->data.pointer);
 	prop->data.pointer = newarr;
 	prop->len = newlen;
@@ -180,16 +180,16 @@ void IDP_ResizeIDPArray(IDProperty *prop, int newlen)
 /* ----------- Numerical Array Type ----------- */
 static void idp_resize_group_array(IDProperty *prop, int newlen, void *newarr)
 {
-	if(prop->subtype != IDP_GROUP)
+	if (prop->subtype != IDP_GROUP)
 		return;
 
-	if(newlen >= prop->len) {
+	if (newlen >= prop->len) {
 		/* bigger */
 		IDProperty **array= newarr;
 		IDPropertyTemplate val;
 		int a;
 
-		for(a=prop->len; a<newlen; a++) {
+		for (a=prop->len; a<newlen; a++) {
 			val.i = 0; /* silence MSVC warning about uninitialized var when debugging */
 			array[a]= IDP_New(IDP_GROUP, &val, "IDP_ResizeArray group");
 		}
@@ -199,7 +199,7 @@ static void idp_resize_group_array(IDProperty *prop, int newlen, void *newarr)
 		IDProperty **array= prop->data.pointer;
 		int a;
 
-		for(a=newlen; a<prop->len; a++) {
+		for (a=newlen; a<prop->len; a++) {
 			IDP_FreeProperty(array[a]);
 			MEM_freeN(array[a]);
 		}
@@ -220,7 +220,7 @@ void IDP_ResizeArray(IDProperty *prop, int newlen)
 		return;
 	}
 
-	/* - Note: This code comes from python, here's the corrusponding comment. - */
+	/* - Note: This code comes from python, here's the corresponding comment. - */
 	/* This over-allocates proportional to the list size, making room
 	 * for additional growth.  The over-allocation is mild, but is
 	 * enough to give linear-time amortized behavior over a long
@@ -277,11 +277,11 @@ static IDProperty *IDP_CopyArray(IDProperty *prop)
 	if (prop->data.pointer) {
 		newp->data.pointer = MEM_dupallocN(prop->data.pointer);
 
-		if(prop->type == IDP_GROUP) {
+		if (prop->type == IDP_GROUP) {
 			IDProperty **array= newp->data.pointer;
 			int a;
 
-			for(a=0; a<prop->len; a++)
+			for (a=0; a<prop->len; a++)
 				array[a]= IDP_CopyProperty(array[a]);
 		}
 	}
@@ -316,7 +316,7 @@ IDProperty *IDP_NewString(const char *st, const char *name, int maxlen)
 	else {
 		int stlen = strlen(st);
 
-		if(maxlen > 0 && maxlen < stlen)
+		if (maxlen > 0 && maxlen < stlen)
 			stlen = maxlen;
 
 		stlen++; /* null terminator '\0' */
@@ -349,7 +349,7 @@ void IDP_AssignString(IDProperty *prop, const char *st, int maxlen)
 {
 	int stlen = strlen(st);
 
-	if(maxlen > 0 && maxlen < stlen)
+	if (maxlen > 0 && maxlen < stlen)
 		stlen= maxlen;
 
 	if (prop->subtype == IDP_STRING_SUB_BYTE) {
@@ -368,8 +368,8 @@ void IDP_ConcatStringC(IDProperty *prop, const char *st)
 	int newlen;
 
 	newlen = prop->len + strlen(st);
-	/*we have to remember that prop->len includes the null byte for strings.
-	 so there's no need to add +1 to the resize function.*/
+	/* we have to remember that prop->len includes the null byte for strings.
+	 * so there's no need to add +1 to the resize function.*/
 	IDP_ResizeArray(prop, newlen);
 	strcat(prop->data.pointer, st);
 }
@@ -378,8 +378,8 @@ void IDP_ConcatString(IDProperty *str1, IDProperty *append)
 {
 	int newlen;
 
-	/*since ->len for strings includes the NULL byte, we have to subtract one or
-	 we'll get an extra null byte after each concatination operation.*/
+	/* since ->len for strings includes the NULL byte, we have to subtract one or
+	 * we'll get an extra null byte after each concatenation operation.*/
 	newlen = str1->len + append->len - 1;
 	IDP_ResizeArray(str1, newlen);
 	strcat(str1->data.pointer, append->data.pointer);
@@ -387,7 +387,7 @@ void IDP_ConcatString(IDProperty *str1, IDProperty *append)
 
 void IDP_FreeString(IDProperty *prop)
 {
-	if(prop->data.pointer)
+	if (prop->data.pointer)
 		MEM_freeN(prop->data.pointer);
 }
 
@@ -455,8 +455,8 @@ void IDP_SyncGroupValues(IDProperty *dest, IDProperty *src)
 }
 
 /*
- replaces all properties with the same name in a destination group from a source group.
-*/
+ * replaces all properties with the same name in a destination group from a source group.
+ */
 void IDP_ReplaceGroupInGroup(IDProperty *dest, IDProperty *src)
 {
 	IDProperty *loop, *prop;
@@ -483,13 +483,13 @@ void IDP_ReplaceGroupInGroup(IDProperty *dest, IDProperty *src)
 	}
 }
 /*
- replaces a property with the same name in a group, or adds 
- it if the propery doesn't exist.
-*/
+ * replaces a property with the same name in a group, or adds 
+ * it if the properly doesn't exist.
+ */
 void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop)
 {
 	IDProperty *loop;
-	if((loop= IDP_GetPropertyFromGroup(group, prop->name)))  {
+	if ((loop= IDP_GetPropertyFromGroup(group, prop->name))) {
 		BLI_insertlink(&group->data.group, loop, prop);
 		
 		BLI_remlink(&group->data.group, loop);
@@ -502,11 +502,11 @@ void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop)
 	}
 }
 
-/*returns 0 if an id property with the same name exists and it failed,
-  or 1 if it succeeded in adding to the group.*/
+/* 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)
 {
-	if(IDP_GetPropertyFromGroup(group, prop->name) == NULL)  {
+	if (IDP_GetPropertyFromGroup(group, prop->name) == NULL) {
 		group->len++;
 		BLI_addtail(&group->data.group, prop);
 		return 1;
@@ -517,7 +517,7 @@ int IDP_AddToGroup(IDProperty *group, IDProperty *prop)
 
 int IDP_InsertToGroup(IDProperty *group, IDProperty *previous, IDProperty *pnew)
 {
-	if(IDP_GetPropertyFromGroup(group, pnew->name) == NULL)  {
+	if (IDP_GetPropertyFromGroup(group, pnew->name) == NULL) {
 		group->len++;
 		BLI_insertlink(&group->data.group, previous, pnew);
 		return 1;
@@ -574,10 +574,10 @@ void IDP_FreeIterBeforeEnd(void *vself)
 	MEM_freeN(vself);
 }
 
-/*Ok, the way things work, Groups free the ID Property structs of their children.
-  This is because all ID Property freeing functions free only direct data (not the ID Property
-  struct itself), but for Groups the child properties *are* considered
-  direct data.*/
+/* Ok, the way things work, Groups free the ID Property structs of their children.
+ * This is because all ID Property freeing functions free only direct data (not the ID Property
+ * struct itself), but for Groups the child properties *are* considered
+ * direct data. */
 static void IDP_FreeGroup(IDProperty *prop)
 {
 	IDProperty *loop;
@@ -608,9 +608,9 @@ IDProperty *IDP_GetProperties(ID *id, int create_if_needed)
 		if (create_if_needed) {
 			id->properties = MEM_callocN(sizeof(IDProperty), "IDProperty");
 			id->properties->type = IDP_GROUP;
-			/* dont overwite the data's name and type
+			/* don't overwrite the data's name and type
 			 * some functions might need this if they
-			 * dont have a real ID, should be named elsewhere - Campbell */
+			 * don't have a real ID, should be named elsewhere - Campbell */
 			/* strcpy(id->name, "top_level_group");*/
 		}
 		return id->properties;
@@ -619,59 +619,59 @@ IDProperty *IDP_GetProperties(ID *id, int create_if_needed)
 
 int IDP_EqualsProperties(IDProperty *prop1, IDProperty *prop2)
 {
-	if(prop1 == NULL && prop2 == NULL)
+	if (prop1 == NULL && prop2 == NULL)
 		return 1;
-	else if(prop1 == NULL || prop2 == NULL)
+	else if (prop1 == NULL || prop2 == NULL)
 		return 0;
-	else if(prop1->type != prop2->type)
+	else if (prop1->type != prop2->type)
 		return 0;
 
-	if(prop1->type == IDP_INT)
+	if (prop1->type == IDP_INT)
 		return (IDP_Int(prop1) == IDP_Int(prop2));
-	else if(prop1->type == IDP_FLOAT)
+	else if (prop1->type == IDP_FLOAT)
 		return (IDP_Float(prop1) == IDP_Float(prop2));
-	else if(prop1->type == IDP_DOUBLE)
+	else if (prop1->type == IDP_DOUBLE)
 		return (IDP_Double(prop1) == IDP_Double(prop2));
-	else if(prop1->type == IDP_STRING)
+	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)
+	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) {
+	else if (prop1->type == IDP_GROUP) {
 		IDProperty *link1, *link2;
 
-		if(BLI_countlist(&prop1->data.group) != BLI_countlist(&prop2->data.group))
+		if (BLI_countlist(&prop1->data.group) != BLI_countlist(&prop2->data.group))
 			return 0;
 
-		for(link1=prop1->data.group.first; link1; link1=link1->next) {
+		for (link1=prop1->data.group.first; link1; link1=link1->next) {
 			link2= IDP_GetPropertyFromGroup(prop2, link1->name);
 
-			if(!IDP_EqualsProperties(link1, link2))
+			if (!IDP_EqualsProperties(link1, link2))
 				return 0;
 		}
 
 		return 1;
 	}
-	else if(prop1->type == IDP_IDPARRAY) {
+	else if (prop1->type == IDP_IDPARRAY) {
 		IDProperty *array1= IDP_IDPArray(prop1);
 		IDProperty *array2= IDP_IDPArray(prop2);
 		int i;
 
-		if(prop1->len != prop2->len)
+		if (prop1->len != prop2->len)
 			return 0;
 		
-		for(i=0; i<prop1->len; i++)
-			if(!IDP_EqualsProperties(&array1[i], &array2[i]))
+		for (i=0; i<prop1->len; i++)
+			if (!IDP_EqualsProperties(&array1[i], &array2[i]))
 				return 0;
 	}
 	
 	return 1;
 }
 
-/* 'val' is never NULL, dont check */
+/* 'val' is never NULL, don't check */
 IDProperty *IDP_New(const int type, const IDPropertyTemplate *val, const char *name)
 {
 	IDProperty *prop=NULL;
@@ -703,7 +703,8 @@ IDProperty *IDP_New(const int type, const IDPropertyTemplate *val, const char *n
 					prop->data.pointer = MEM_callocN(idp_size_table[val->array.type]*val->array.len, "id property array");
 				prop->len = prop->totallen = val->array.len;
 				break;
-			} else {
+			}
+			else {
 				return NULL;
 			}
 		}
@@ -761,9 +762,9 @@ IDProperty *IDP_New(const int type, const IDPropertyTemplate *val, const char *n
 	return prop;
 }
 
-/*NOTE: this will free all child properties including list arrays and groups!
-  Also, note that this does NOT unlink anything!  Plus it doesn't free
-  the actual IDProperty struct either.*/
+/* NOTE: this will free all child properties including list arrays and groups!
+ * Also, note that this does NOT unlink anything!  Plus it doesn't free
+ * the actual IDProperty struct either.*/
 void IDP_FreeProperty(IDProperty *prop)
 {
 	switch (prop->type) {
@@ -782,8 +783,8 @@ void IDP_FreeProperty(IDProperty *prop)
 	}
 }
 
-/*Unlinks any IDProperty<->ID linkage that might be going on.
-  note: currently unused.*/
+/* Unlinks any IDProperty<->ID linkage that might be going on.
+ * note: currently unused.*/
 void IDP_UnlinkProperty(IDProperty *prop)
 {
 	switch (prop->type) {
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 0a80e8a..6e0330f 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -160,8 +160,8 @@ static void de_interlace_st(struct ImBuf *ibuf)	/* standard fields */
 void image_de_interlace(Image *ima, int odd)
 {
 	ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
-	if(ibuf) {
-		if(odd)
+	if (ibuf) {
+		if (odd)
 			de_interlace_st(ibuf);
 		else
 			de_interlace_ng(ibuf);
@@ -174,7 +174,7 @@ static void image_free_buffers(Image *ima)
 {
 	ImBuf *ibuf;
 	
-	while((ibuf = ima->ibufs.first)) {
+	while ((ibuf = ima->ibufs.first)) {
 		BLI_remlink(&ima->ibufs, ibuf);
 		
 		if (ibuf->userdata) {
@@ -184,10 +184,10 @@ static void image_free_buffers(Image *ima)
 		IMB_freeImBuf(ibuf);
 	}
 	
-	if(ima->anim) IMB_free_anim(ima->anim);
+	if (ima->anim) IMB_free_anim(ima->anim);
 	ima->anim= NULL;
 
-	if(ima->rr) {
+	if (ima->rr) {
 		RE_FreeRenderResult(ima->rr);
 		ima->rr= NULL;
 	}	
@@ -212,8 +212,8 @@ void free_image(Image *ima)
 
 	BKE_previewimg_free(&ima->preview);
 
-	for(a=0; a<IMA_MAX_RENDER_SLOT; a++) {
-		if(ima->renders[a]) {
+	for (a=0; a<IMA_MAX_RENDER_SLOT; a++) {
+		if (ima->renders[a]) {
 			RE_FreeRenderResult(ima->renders[a]);
 			ima->renders[a]= NULL;
 		}
@@ -226,7 +226,7 @@ static Image *image_alloc(const char *name, short source, short type)
 	Image *ima;
 	
 	ima= alloc_libblock(&G.main->image, ID_IM, name);
-	if(ima) {
+	if (ima) {
 		ima->ok= IMA_OK;
 		
 		ima->xrep= ima->yrep= 1;
@@ -246,14 +246,14 @@ 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;
 
 		index= IMA_MAKE_INDEX(frame, index);
-		for(ibuf= ima->ibufs.first; ibuf; ibuf= ibuf->next)
-			if(ibuf->index==index)
+		for (ibuf= ima->ibufs.first; ibuf; ibuf= ibuf->next)
+			if (ibuf->index==index)
 				return ibuf;
 
 		return NULL;
@@ -263,7 +263,7 @@ static ImBuf *image_get_ibuf(Image *ima, int index, int frame)
 /* no ima->ibuf anymore, but listbase */
 static void image_remove_ibuf(Image *ima, ImBuf *ibuf)
 {
-	if(ibuf) {
+	if (ibuf) {
 		BLI_remlink(&ima->ibufs, ibuf);
 		IMB_freeImBuf(ibuf);
 	}
@@ -273,19 +273,19 @@ static void image_remove_ibuf(Image *ima, ImBuf *ibuf)
 /* no ima->ibuf anymore, but listbase */
 static void image_assign_ibuf(Image *ima, ImBuf *ibuf, int index, int frame)
 {
-	if(ibuf) {
+	if (ibuf) {
 		ImBuf *link;
 		
-		if(index!=IMA_NO_INDEX)
+		if (index!=IMA_NO_INDEX)
 			index= IMA_MAKE_INDEX(frame, index);
 		
 		/* insert based on index */
-		for(link= ima->ibufs.first; link; link= link->next)
-			if(link->index>=index)
+		for (link= ima->ibufs.first; link; link= link->next)
+			if (link->index>=index)
 				break;
 
 		ibuf->index= index;
-		if(ima->flag & IMA_CM_PREDIVIDE)
+		if (ima->flag & IMA_CM_PREDIVIDE)
 			ibuf->flags |= IB_cm_predivide;
 		else
 			ibuf->flags &= ~IB_cm_predivide;
@@ -294,7 +294,7 @@ static void image_assign_ibuf(Image *ima, ImBuf *ibuf, int index, int frame)
 		BLI_insertlinkbefore(&ima->ibufs, link, ibuf);
 
 		/* now we don't want copies? */
-		if(link && ibuf->index==link->index)
+		if (link && ibuf->index==link->index)
 			image_remove_ibuf(ima, link);
 	}
 }
@@ -324,7 +324,7 @@ Image *copy_image(Image *ima)
 static void extern_local_image(Image *UNUSED(ima))
 {
 	/* Nothing to do: images don't link to other IDs. This function exists to
-	   match id_make_local pattern. */
+	 * match id_make_local pattern. */
 }
 
 void make_local_image(struct Image *ima)
@@ -340,55 +340,74 @@ void make_local_image(struct Image *ima)
 	 * - mixed: make copy
 	 */
 
-	if(ima->id.lib==NULL) return;
+	if (ima->id.lib==NULL) return;
 
 	/* Can't take short cut here: must check meshes at least because of bogus
-	   texface ID refs. - z0r */
+	 * texface ID refs. - z0r */
 #if 0
-	if(ima->id.us==1) {
+	if (ima->id.us==1) {
 		id_clear_lib_data(bmain, &ima->id);
 		extern_local_image(ima);
 		return;
 	}
 #endif
 
-	for(tex= bmain->tex.first; tex; tex= tex->id.next) {
-		if(tex->ima == ima) {
-			if(tex->id.lib) is_lib= TRUE;
+	for (tex= bmain->tex.first; tex; tex= tex->id.next) {
+		if (tex->ima == ima) {
+			if (tex->id.lib) is_lib= TRUE;
 			else is_local= TRUE;
 		}
 	}
-	for(brush= bmain->brush.first; brush; brush= brush->id.next) {
-		if(brush->clone.image == ima) {
-			if(brush->id.lib) is_lib= TRUE;
+	for (brush= bmain->brush.first; brush; brush= brush->id.next) {
+		if (brush->clone.image == ima) {
+			if (brush->id.lib) is_lib= TRUE;
 			else is_local= TRUE;
 		}
 	}
-	for(me= bmain->mesh.first; me; me= me->id.next) {
-		if(me->mtface) {
+	for (me= bmain->mesh.first; me; me= me->id.next) {
+		if (me->mtface) {
 			MTFace *tface;
 			int a, i;
 
-			for(i=0; i<me->fdata.totlayer; i++) {
-				if(me->fdata.layers[i].type == CD_MTFACE) {
+			for (i=0; i<me->fdata.totlayer; i++) {
+				if (me->fdata.layers[i].type == CD_MTFACE) {
 					tface= (MTFace*)me->fdata.layers[i].data;
 
-					for(a=0; a<me->totface; a++, tface++) {
-						if(tface->tpage == ima) {
-							if(me->id.lib) is_lib= TRUE;
+					for (a=0; a<me->totface; a++, tface++) {
+						if (tface->tpage == ima) {
+							if (me->id.lib) is_lib= TRUE;
+							else is_local= TRUE;
+						}
+					}
+				}
+			}
+		}
+
+		if (me->mtpoly) {
+			MTexPoly *mtpoly;
+			int a, i;
+
+			for (i=0; i<me->pdata.totlayer; i++) {
+				if (me->pdata.layers[i].type == CD_MTEXPOLY) {
+					mtpoly= (MTexPoly*)me->pdata.layers[i].data;
+
+					for (a=0; a<me->totpoly; a++, mtpoly++) {
+						if (mtpoly->tpage == ima) {
+							if (me->id.lib) is_lib= TRUE;
 							else is_local= TRUE;
 						}
 					}
 				}
 			}
 		}
+
 	}
 
-	if(is_local && is_lib == FALSE) {
+	if (is_local && is_lib == FALSE) {
 		id_clear_lib_data(bmain, &ima->id);
 		extern_local_image(ima);
 	}
-	else if(is_local && is_lib) {
+	else if (is_local && is_lib) {
 		Image *ima_new= copy_image(ima);
 
 		ima_new->id.us= 0;
@@ -397,9 +416,9 @@ void make_local_image(struct Image *ima)
 		BKE_id_lib_local_paths(bmain, ima->id.lib, &ima_new->id);
 
 		tex= bmain->tex.first;
-		while(tex) {
-			if(tex->id.lib==NULL) {
-				if(tex->ima==ima) {
+		while (tex) {
+			if (tex->id.lib==NULL) {
+				if (tex->ima==ima) {
 					tex->ima = ima_new;
 					ima_new->id.us++;
 					ima->id.us--;
@@ -408,9 +427,9 @@ void make_local_image(struct Image *ima)
 			tex= tex->id.next;
 		}
 		brush= bmain->brush.first;
-		while(brush) {
-			if(brush->id.lib==NULL) {
-				if(brush->clone.image==ima) {
+		while (brush) {
+			if (brush->id.lib==NULL) {
+				if (brush->clone.image==ima) {
 					brush->clone.image = ima_new;
 					ima_new->id.us++;
 					ima->id.us--;
@@ -419,22 +438,22 @@ void make_local_image(struct Image *ima)
 			brush= brush->id.next;
 		}
 		/* Transfer references in texfaces. Texfaces don't add to image ID
-		   user count *unless* there are no other users. See
-		   readfile.c:lib_link_mtface. */
+		 * user count *unless* there are no other users. See
+		 * readfile.c:lib_link_mtface. */
 		me= bmain->mesh.first;
-		while(me) {
-			if(me->mtface) {
+		while (me) {
+			if (me->mtface) {
 				MTFace *tface;
 				int a, i;
 
-				for(i=0; i<me->fdata.totlayer; i++) {
-					if(me->fdata.layers[i].type == CD_MTFACE) {
+				for (i=0; i<me->fdata.totlayer; i++) {
+					if (me->fdata.layers[i].type == CD_MTFACE) {
 						tface= (MTFace*)me->fdata.layers[i].data;
 
-						for(a=0; a<me->totface; a++, tface++) {	
-							if(tface->tpage == ima) {
+						for (a=0; a<me->totface; a++, tface++) {	
+							if (tface->tpage == ima) {
 								tface->tpage = ima_new;
-								if(ima_new->id.us == 0) {
+								if (ima_new->id.us == 0) {
 									tface->tpage->id.us= 1;
 								}
 								id_lib_extern((ID*)ima_new);
@@ -443,6 +462,28 @@ void make_local_image(struct Image *ima)
 					}
 				}
 			}
+
+			if (me->mtpoly) {
+				MTexPoly *mtpoly;
+				int a, i;
+
+				for (i=0; i<me->pdata.totlayer; i++) {
+					if (me->pdata.layers[i].type == CD_MTEXPOLY) {
+						mtpoly= (MTexPoly*)me->pdata.layers[i].data;
+
+						for (a=0; a<me->totpoly; a++, mtpoly++) {
+							if (mtpoly->tpage == ima) {
+								mtpoly->tpage = ima_new;
+								if (ima_new->id.us == 0) {
+									mtpoly->tpage->id.us= 1;
+								}
+								id_lib_extern((ID*)ima_new);
+							}
+						}
+					}
+				}
+			}
+
 			me= me->id.next;
 		}
 	}
@@ -453,9 +494,9 @@ void BKE_image_merge(Image *dest, Image *source)
 	ImBuf *ibuf;
 	
 	/* sanity check */
-	if(dest && source && dest!=source) {
+	if (dest && source && dest!=source) {
 	
-		while((ibuf= source->ibufs.first)) {
+		while ((ibuf= source->ibufs.first)) {
 			BLI_remlink(&source->ibufs, ibuf);
 			image_assign_ibuf(dest, ibuf, IMA_INDEX_PASS(ibuf->index), IMA_INDEX_FRAME(ibuf->index));
 		}
@@ -480,23 +521,23 @@ Image *BKE_add_image_file(const char *name)
 	BLI_path_abs(str, G.main->name);
 	
 	/* exists? */
-	file= open(str, O_BINARY|O_RDONLY);
-	if(file== -1) return NULL;
+	file= BLI_open(str, O_BINARY|O_RDONLY, 0);
+	if (file== -1) return NULL;
 	close(file);
 	
 	/* first search an identical image */
-	for(ima= G.main->image.first; ima; ima= ima->id.next) {
-		if(ima->source!=IMA_SRC_VIEWER && ima->source!=IMA_SRC_GENERATED) {
+	for (ima= G.main->image.first; ima; ima= ima->id.next) {
+		if (ima->source!=IMA_SRC_VIEWER && ima->source!=IMA_SRC_GENERATED) {
 			BLI_strncpy(strtest, ima->name, sizeof(ima->name));
 			BLI_path_abs(strtest, G.main->name);
 			
-			if( strcmp(strtest, str)==0 ) {
-				if(ima->anim==NULL || ima->id.us==0) {
+			if (BLI_path_cmp(strtest, str)==0) {
+				if (ima->anim==NULL || ima->id.us==0) {
 					BLI_strncpy(ima->name, name, sizeof(ima->name));	/* for stringcode */
 					ima->id.us++;										/* officially should not, it doesn't link here! */
-					if(ima->ok==0)
+					if (ima->ok==0)
 						ima->ok= IMA_OK;
-			/* RETURN! */
+					/* RETURN! */
 					return ima;
 				}
 			}
@@ -513,7 +554,7 @@ Image *BKE_add_image_file(const char *name)
 	ima= image_alloc(libname, IMA_SRC_FILE, IMA_TYPE_IMAGE);
 	BLI_strncpy(ima->name, name, sizeof(ima->name));
 	
-	if(BLI_testextensie_array(name, imb_ext_movie))
+	if (BLI_testextensie_array(name, imb_ext_movie))
 		ima->source= IMA_SRC_MOVIE;
 	
 	return ima;
@@ -560,7 +601,7 @@ Image *BKE_add_image_size(unsigned int width, unsigned int height, const char *n
 	if (ima) {
 		ImBuf *ibuf;
 		
-		/* BLI_strncpy(ima->name, name, FILE_MAX); */ /* dont do this, this writes in ain invalid filepath! */
+		/* BLI_strncpy(ima->name, name, FILE_MAX); */ /* don't do this, this writes in ain invalid filepath! */
 		ima->gen_x= width;
 		ima->gen_y= height;
 		ima->gen_type= uvtestgrid;
@@ -597,7 +638,7 @@ void BKE_image_memorypack(Image *ima)
 {
 	ImBuf *ibuf= image_get_ibuf(ima, IMA_NO_INDEX, 0);
 	
-	if(ibuf==NULL)
+	if (ibuf==NULL)
 		return;
 	if (ima->packedfile) {
 		freePackedFile(ima->packedfile);
@@ -608,7 +649,7 @@ void BKE_image_memorypack(Image *ima)
 	ibuf->planes= R_IMF_PLANES_RGBA;
 	
 	IMB_saveiff(ibuf, ibuf->name, IB_rect | IB_mem);
-	if(ibuf->encodedbuffer==NULL) {
+	if (ibuf->encodedbuffer==NULL) {
 		printf("memory save for pack error\n");
 	}
 	else {
@@ -621,7 +662,7 @@ void BKE_image_memorypack(Image *ima)
 		ibuf->encodedsize= 0;
 		ibuf->userflags &= ~IB_BITMAPDIRTY;
 		
-		if(ima->source==IMA_SRC_GENERATED) {
+		if (ima->source==IMA_SRC_GENERATED) {
 			ima->source= IMA_SRC_FILE;
 			ima->type= IMA_TYPE_IMAGE;
 		}
@@ -641,8 +682,8 @@ static void tag_all_images_time()
 	int ctime = (int)PIL_check_seconds_timer();
 
 	ima= G.main->image.first;
-	while(ima) {
-		if(ima->bindcode || ima->repbind || ima->ibufs.first) {
+	while (ima) {
+		if (ima->bindcode || ima->repbind || ima->ibufs.first) {
 			ima->lastused = ctime;
 		}
 	}
@@ -656,9 +697,9 @@ void free_old_images(void)
 	int ctime = (int)PIL_check_seconds_timer();
 	
 	/* 
-	   Run garbage collector once for every collecting period of time 
-	   if textimeout is 0, that's the option to NOT run the collector
-	*/
+	 * Run garbage collector once for every collecting period of time 
+	 * if textimeout is 0, that's the option to NOT run the collector
+	 */
 	if (U.textimeout == 0 || ctime % U.texcollectrate || ctime == lasttime)
 		return;
 
@@ -669,13 +710,11 @@ void free_old_images(void)
 	lasttime = ctime;
 
 	ima= G.main->image.first;
-	while(ima) {
-		if((ima->flag & IMA_NOCOLLECT)==0 && ctime - ima->lastused > U.textimeout) {
-			/*
-			   If it's in GL memory, deallocate and set time tag to current time
-			   This gives textures a "second chance" to be used before dying.
-			*/
-			if(ima->bindcode || ima->repbind) {
+	while (ima) {
+		if ((ima->flag & IMA_NOCOLLECT)==0 && ctime - ima->lastused > U.textimeout) {
+			/* If it's in GL memory, deallocate and set time tag to current time
+			 * This gives textures a "second chance" to be used before dying. */
+			if (ima->bindcode || ima->repbind) {
 				GPU_free_image(ima);
 				ima->lastused = ctime;
 			}
@@ -697,18 +736,18 @@ static uintptr_t image_mem_size(Image *ima)
 	size= 0;
 	
 	/* viewers have memory depending on other rules, has no valid rect pointer */
-	if(ima->source==IMA_SRC_VIEWER)
+	if (ima->source==IMA_SRC_VIEWER)
 		return 0;
 	
-	for(ibuf= ima->ibufs.first; ibuf; ibuf= ibuf->next) {
-		if(ibuf->rect) size += MEM_allocN_len(ibuf->rect);
-		else if(ibuf->rect_float) size += MEM_allocN_len(ibuf->rect_float);
+	for (ibuf= ima->ibufs.first; ibuf; ibuf= ibuf->next) {
+		if (ibuf->rect) size += MEM_allocN_len(ibuf->rect);
+		else if (ibuf->rect_float) size += MEM_allocN_len(ibuf->rect_float);
 
-		for(level=0; level<IB_MIPMAP_LEVELS; level++) {
+		for (level=0; level<IB_MIPMAP_LEVELS; level++) {
 			ibufm= ibuf->mipmap[level];
-			if(ibufm) {
-				if(ibufm->rect) size += MEM_allocN_len(ibufm->rect);
-				else if(ibufm->rect_float) size += MEM_allocN_len(ibufm->rect_float);
+			if (ibufm) {
+				if (ibufm->rect) size += MEM_allocN_len(ibufm->rect);
+				else if (ibufm->rect_float) size += MEM_allocN_len(ibufm->rect_float);
 			}
 		}
 	}
@@ -721,15 +760,15 @@ void BKE_image_print_memlist(void)
 	Image *ima;
 	uintptr_t size, totsize= 0;
 
-	for(ima= G.main->image.first; ima; ima= ima->id.next)
+	for (ima= G.main->image.first; ima; ima= ima->id.next)
 		totsize += image_mem_size(ima);
 
 	printf("\ntotal image memory len: %.3f MB\n", (double)totsize/(double)(1024*1024));
 
-	for(ima= G.main->image.first; ima; ima= ima->id.next) {
+	for (ima= G.main->image.first; ima; ima= ima->id.next) {
 		size= image_mem_size(ima);
 
-		if(size)
+		if (size)
 			printf("%s len: %.3f MB\n", ima->id.name+2, (double)size/(double)(1024*1024));
 	}
 }
@@ -740,29 +779,30 @@ void BKE_image_free_all_textures(void)
 	Image *ima;
 	/* unsigned int totsize= 0; */
 	
-	for(ima= G.main->image.first; ima; ima= ima->id.next)
+	for (ima= G.main->image.first; ima; ima= ima->id.next)
 		ima->id.flag &= ~LIB_DOIT;
 	
-	for(tex= G.main->tex.first; tex; tex= tex->id.next)
-		if(tex->ima)
+	for (tex= G.main->tex.first; tex; tex= tex->id.next)
+		if (tex->ima)
 			tex->ima->id.flag |= LIB_DOIT;
 	
-	for(ima= G.main->image.first; ima; ima= ima->id.next) {
-		if(ima->ibufs.first && (ima->id.flag & LIB_DOIT)) {
+	for (ima= G.main->image.first; ima; ima= ima->id.next) {
+		if (ima->ibufs.first && (ima->id.flag & LIB_DOIT)) {
 			ImBuf *ibuf;
 			
-			for(ibuf= ima->ibufs.first; ibuf; ibuf= ibuf->next) {
+			for (ibuf= ima->ibufs.first; ibuf; ibuf= ibuf->next) {
 				/* escape when image is painted on */
-				if(ibuf->userflags & IB_BITMAPDIRTY)
+				if (ibuf->userflags & IB_BITMAPDIRTY)
 					break;
 				
-				/* if(ibuf->mipmap[0]) 
+#if 0
+				if (ibuf->mipmap[0]) 
 					totsize+= 1.33*ibuf->x*ibuf->y*4;
 				else
-					totsize+= ibuf->x*ibuf->y*4;*/
-				
+					totsize+= ibuf->x*ibuf->y*4;
+#endif
 			}
-			if(ibuf==NULL)
+			if (ibuf==NULL)
 				image_free_buffers(ima);
 		}
 	}
@@ -774,13 +814,13 @@ void BKE_image_free_anim_ibufs(Image *ima, int except_frame)
 {
 	ImBuf *ibuf, *nbuf;
 
-	for(ibuf= ima->ibufs.first; ibuf; ibuf= nbuf) {
+	for (ibuf= ima->ibufs.first; ibuf; ibuf= nbuf) {
 		nbuf= ibuf->next;
-		if(ibuf->userflags & IB_BITMAPDIRTY)
+		if (ibuf->userflags & IB_BITMAPDIRTY)
 			continue;
-		if(ibuf->index==IMA_NO_INDEX)
+		if (ibuf->index==IMA_NO_INDEX)
 			continue;
-		if(except_frame!=IMA_INDEX_FRAME(ibuf->index)) {
+		if (except_frame!=IMA_INDEX_FRAME(ibuf->index)) {
 			BLI_remlink(&ima->ibufs, ibuf);
 			
 			if (ibuf->userdata) {
@@ -796,8 +836,8 @@ void BKE_image_all_free_anim_ibufs(int cfra)
 {
 	Image *ima;
 	
-	for(ima= G.main->image.first; ima; ima= ima->id.next)
-		if(ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE))
+	for (ima= G.main->image.first; ima; ima= ima->id.next)
+		if (ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE))
 			BKE_image_free_anim_ibufs(ima, cfra);
 }
 
@@ -806,11 +846,11 @@ void BKE_image_all_free_anim_ibufs(int cfra)
 
 int BKE_imtype_to_ftype(const char imtype)
 {
-	if(imtype==R_IMF_IMTYPE_TARGA)
+	if (imtype==R_IMF_IMTYPE_TARGA)
 		return TGA;
-	else if(imtype==R_IMF_IMTYPE_RAWTGA)
+	else if (imtype==R_IMF_IMTYPE_RAWTGA)
 		return RAWTGA;
-	else if(imtype== R_IMF_IMTYPE_IRIS) 
+	else if (imtype== R_IMF_IMTYPE_IRIS) 
 		return IMAGIC;
 #ifdef WITH_HDR
 	else if (imtype==R_IMF_IMTYPE_RADHDR)
@@ -837,7 +877,7 @@ int BKE_imtype_to_ftype(const char imtype)
 		return DPX;
 #endif
 #ifdef WITH_OPENJPEG
-	else if(imtype==R_IMF_IMTYPE_JP2)
+	else if (imtype==R_IMF_IMTYPE_JP2)
 		return JP2;
 #endif
 	else
@@ -846,9 +886,9 @@ int BKE_imtype_to_ftype(const char imtype)
 
 char BKE_ftype_to_imtype(const int ftype)
 {
-	if(ftype==0)
+	if (ftype==0)
 		return R_IMF_IMTYPE_TARGA;
-	else if(ftype == IMAGIC) 
+	else if (ftype == IMAGIC) 
 		return R_IMF_IMTYPE_IRIS;
 #ifdef WITH_HDR
 	else if (ftype & RADHDR)
@@ -876,10 +916,10 @@ char BKE_ftype_to_imtype(const int ftype)
 #endif
 	else if (ftype & TGA)
 		return R_IMF_IMTYPE_TARGA;
-	else if(ftype & RAWTGA)
+	else if (ftype & RAWTGA)
 		return R_IMF_IMTYPE_RAWTGA;
 #ifdef WITH_OPENJPEG
-	else if(ftype & JP2)
+	else if (ftype & JP2)
 		return R_IMF_IMTYPE_JP2;
 #endif
 	else
@@ -1036,80 +1076,81 @@ int BKE_add_image_extension(char *string, const char imtype)
 {
 	const char *extension= NULL;
 	
-	if(imtype== R_IMF_IMTYPE_IRIS) {
-		if(!BLI_testextensie(string, ".rgb"))
+	if (imtype== R_IMF_IMTYPE_IRIS) {
+		if (!BLI_testextensie(string, ".rgb"))
 			extension= ".rgb";
 	}
-	else if(imtype==R_IMF_IMTYPE_IRIZ) {
-		if(!BLI_testextensie(string, ".rgb"))
+	else if (imtype==R_IMF_IMTYPE_IRIZ) {
+		if (!BLI_testextensie(string, ".rgb"))
 			extension= ".rgb";
 	}
 #ifdef WITH_HDR
-	else if(imtype==R_IMF_IMTYPE_RADHDR) {
-		if(!BLI_testextensie(string, ".hdr"))
+	else if (imtype==R_IMF_IMTYPE_RADHDR) {
+		if (!BLI_testextensie(string, ".hdr"))
 			extension= ".hdr";
 	}
 #endif
 	else if (ELEM5(imtype, R_IMF_IMTYPE_PNG, R_IMF_IMTYPE_FFMPEG, R_IMF_IMTYPE_H264, R_IMF_IMTYPE_THEORA, R_IMF_IMTYPE_XVID)) {
-		if(!BLI_testextensie(string, ".png"))
+		if (!BLI_testextensie(string, ".png"))
 			extension= ".png";
 	}
 #ifdef WITH_DDS
-	else if(imtype==R_IMF_IMTYPE_DDS) {
-		if(!BLI_testextensie(string, ".dds"))
+	else if (imtype==R_IMF_IMTYPE_DDS) {
+		if (!BLI_testextensie(string, ".dds"))
 			extension= ".dds";
 	}
 #endif
-	else if(imtype==R_IMF_IMTYPE_RAWTGA) {
-		if(!BLI_testextensie(string, ".tga"))
+	else if (imtype==R_IMF_IMTYPE_RAWTGA) {
+		if (!BLI_testextensie(string, ".tga"))
 			extension= ".tga";
 	}
-	else if(imtype==R_IMF_IMTYPE_BMP) {
-		if(!BLI_testextensie(string, ".bmp"))
+	else if (imtype==R_IMF_IMTYPE_BMP) {
+		if (!BLI_testextensie(string, ".bmp"))
 			extension= ".bmp";
 	}
 #ifdef WITH_TIFF
-	else if(imtype==R_IMF_IMTYPE_TIFF) {
-		if(!BLI_testextensie(string, ".tif") && 
+	else if (imtype==R_IMF_IMTYPE_TIFF) {
+		if (!BLI_testextensie(string, ".tif") && 
 			!BLI_testextensie(string, ".tiff")) extension= ".tif";
 	}
 #endif
 #ifdef WITH_OPENEXR
-	else if( ELEM(imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER)) {
-		if(!BLI_testextensie(string, ".exr"))
+	else if ( ELEM(imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER)) {
+		if (!BLI_testextensie(string, ".exr"))
 			extension= ".exr";
 	}
 #endif
 #ifdef WITH_CINEON
-	else if(imtype==R_IMF_IMTYPE_CINEON){
+	else if (imtype==R_IMF_IMTYPE_CINEON) {
 		if (!BLI_testextensie(string, ".cin"))
 			extension= ".cin";
 	}
-	else if(imtype==R_IMF_IMTYPE_DPX){
+	else if (imtype==R_IMF_IMTYPE_DPX) {
 		if (!BLI_testextensie(string, ".dpx"))
 			extension= ".dpx";
 	}
 #endif
-	else if(imtype==R_IMF_IMTYPE_TARGA) {
-		if(!BLI_testextensie(string, ".tga"))
+	else if (imtype==R_IMF_IMTYPE_TARGA) {
+		if (!BLI_testextensie(string, ".tga"))
 			extension= ".tga";
 	}
 #ifdef WITH_OPENJPEG
-	else if(imtype==R_IMF_IMTYPE_JP2) {
-		if(!BLI_testextensie(string, ".jp2"))
+	else if (imtype==R_IMF_IMTYPE_JP2) {
+		if (!BLI_testextensie(string, ".jp2"))
 			extension= ".jp2";
 	}
 #endif
 	else { //   R_IMF_IMTYPE_AVICODEC, R_IMF_IMTYPE_AVIRAW, R_IMF_IMTYPE_AVIJPEG, R_IMF_IMTYPE_JPEG90, R_IMF_IMTYPE_QUICKTIME etc
-		if(!( BLI_testextensie(string, ".jpg") || BLI_testextensie(string, ".jpeg")))
+		if (!( BLI_testextensie(string, ".jpg") || BLI_testextensie(string, ".jpeg")))
 			extension= ".jpg";
 	}
 
-	if(extension) {
+	if (extension) {
 		/* prefer this in many cases to avoid .png.tga, but in certain cases it breaks */
 		/* remove any other known image extension */
-		if(BLI_testextensie_array(string, imb_ext_image)
-				  || (G.have_quicktime && BLI_testextensie_array(string, imb_ext_image_qt))) {
+		if (BLI_testextensie_array(string, imb_ext_image) ||
+		    (G.have_quicktime && BLI_testextensie_array(string, imb_ext_image_qt)))
+		{
 			return BLI_replace_extension(string, FILE_MAX, extension);
 		}
 		else {
@@ -1122,6 +1163,15 @@ int BKE_add_image_extension(char *string, const char imtype)
 	}
 }
 
+void BKE_imformat_defaults(ImageFormatData *im_format)
+{
+	memset(im_format, 0, sizeof(*im_format));
+	im_format->planes = R_IMF_PLANES_RGB;
+	im_format->imtype = R_IMF_IMTYPE_PNG;
+	im_format->quality = 90;
+	im_format->compress = 90;
+}
+
 /* could allow access externally - 512 is for long names, 64 is for id names */
 typedef struct StampData {
 	char 	file[512];
@@ -1145,14 +1195,16 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
 
 	if (scene->r.stamp & R_STAMP_FILENAME) {
 		BLI_snprintf(stamp_data->file, sizeof(stamp_data->file), do_prefix ? "File %s":"%s", G.relbase_valid ? G.main->name:"<untitled>");
-	} else {
+	}
+	else {
 		stamp_data->file[0] = '\0';
 	}
 	
 	if (scene->r.stamp & R_STAMP_NOTE) {
 		/* Never do prefix for Note */
 		BLI_snprintf(stamp_data->note, sizeof(stamp_data->note), "%s", scene->r.stamp_udata);
-	} else {
+	}
+	else {
 		stamp_data->note[0] = '\0';
 	}
 	
@@ -1161,7 +1213,8 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
 		tl = localtime(&t);
 		BLI_snprintf(text, sizeof(text), "%04d/%02d/%02d %02d:%02d:%02d", tl->tm_year+1900, tl->tm_mon+1, tl->tm_mday, tl->tm_hour, tl->tm_min, tl->tm_sec);
 		BLI_snprintf(stamp_data->date, sizeof(stamp_data->date), do_prefix ? "Date %s":"%s", text);
-	} else {
+	}
+	else {
 		stamp_data->date[0] = '\0';
 	}
 	
@@ -1172,7 +1225,8 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
 		else 		BLI_strncpy(text, "<none>", sizeof(text));
 
 		BLI_snprintf(stamp_data->marker, sizeof(stamp_data->marker), do_prefix ? "Marker %s":"%s", text);
-	} else {
+	}
+	else {
 		stamp_data->marker[0] = '\0';
 	}
 	
@@ -1198,7 +1252,8 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
 			BLI_snprintf(text, sizeof(text), "%02d:%02d:%02d.%03d", h, m, s, f);
 
 		BLI_snprintf(stamp_data->time, sizeof(stamp_data->time), do_prefix ? "Time %s":"%s", text);
-	} else {
+	}
+	else {
 		stamp_data->time[0] = '\0';
 	}
 	
@@ -1206,18 +1261,20 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
 		char fmtstr[32];
 		int digits= 1;
 		
-		if(scene->r.efra>9)
+		if (scene->r.efra>9)
 			digits= 1 + (int) log10(scene->r.efra);
 
 		BLI_snprintf(fmtstr, sizeof(fmtstr), do_prefix ? "Frame %%0%di":"%%0%di", digits);
 		BLI_snprintf (stamp_data->frame, sizeof(stamp_data->frame), fmtstr, scene->r.cfra);
-	} else {
+	}
+	else {
 		stamp_data->frame[0] = '\0';
 	}
 
 	if (scene->r.stamp & R_STAMP_CAMERA) {
 		BLI_snprintf(stamp_data->camera, sizeof(stamp_data->camera), do_prefix ? "Camera %s":"%s", camera ? camera->id.name+2 : "<none>");
-	} else {
+	}
+	else {
 		stamp_data->camera[0] = '\0';
 	}
 
@@ -1228,13 +1285,15 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
 		else 		BLI_strncpy(text, "<none>", sizeof(text));
 
 		BLI_snprintf(stamp_data->cameralens, sizeof(stamp_data->cameralens), do_prefix ? "Lens %s":"%s", text);
-	} else {
+	}
+	else {
 		stamp_data->cameralens[0] = '\0';
 	}
 
 	if (scene->r.stamp & R_STAMP_SCENE) {
 		BLI_snprintf(stamp_data->scene, sizeof(stamp_data->scene), do_prefix ? "Scene %s":"%s", scene->id.name+2);
-	} else {
+	}
+	else {
 		stamp_data->scene[0] = '\0';
 	}
 	
@@ -1245,7 +1304,8 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
 		else 		BLI_strncpy(text, "<none>", sizeof(text));
 
 		BLI_snprintf(stamp_data->strip, sizeof(stamp_data->strip), do_prefix ? "Strip %s":"%s", text);
-	} else {
+	}
+	else {
 		stamp_data->strip[0] = '\0';
 	}
 
@@ -1257,7 +1317,8 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
 			BLI_timestr(stats->lastframetime, text);
 
 			BLI_snprintf(stamp_data->rendertime, sizeof(stamp_data->rendertime), do_prefix ? "RenderTime %s":"%s", text);
-		} else {
+		}
+		else {
 			stamp_data->rendertime[0] = '\0';
 		}
 	}
@@ -1280,7 +1341,7 @@ void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rec
 	stampdata(scene, camera, &stamp_data, 1);
 
 	/* TODO, do_versions */
-	if(scene->r.stamp_font_id < 8)
+	if (scene->r.stamp_font_id < 8)
 		scene->r.stamp_font_id= 12;
 
 	/* set before return */
@@ -1483,18 +1544,18 @@ void BKE_stamp_info(Scene *scene, Object *camera, struct ImBuf *ibuf)
 int BKE_alphatest_ibuf(ImBuf *ibuf)
 {
 	int tot;
-	if(ibuf->rect_float) {
+	if (ibuf->rect_float) {
 		float *buf= ibuf->rect_float;
-		for(tot= ibuf->x * ibuf->y; tot--; buf+=4) {
-			if(buf[3] < 1.0f) {
+		for (tot= ibuf->x * ibuf->y; tot--; buf+=4) {
+			if (buf[3] < 1.0f) {
 				return TRUE;
 			}
 		}
 	}
 	else if (ibuf->rect) {
 		unsigned char *buf= (unsigned char *)ibuf->rect;
-		for(tot= ibuf->x * ibuf->y; tot--; buf+=4) {
-			if(buf[3] != 255) {
+		for (tot= ibuf->x * ibuf->y; tot--; buf+=4) {
+			if (buf[3] != 255) {
 				return TRUE;
 			}
 		}
@@ -1513,7 +1574,7 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, ImageFormatData *imf)
 
 	int ok;
 
-	if(imtype== R_IMF_IMTYPE_IRIS) {
+	if (imtype== R_IMF_IMTYPE_IRIS) {
 		ibuf->ftype= IMAGIC;
 	}
 #ifdef WITH_HDR
@@ -1524,7 +1585,7 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, ImageFormatData *imf)
 	else if (ELEM5(imtype, R_IMF_IMTYPE_PNG, R_IMF_IMTYPE_FFMPEG, R_IMF_IMTYPE_H264, R_IMF_IMTYPE_THEORA, R_IMF_IMTYPE_XVID)) {
 		ibuf->ftype= PNG;
 
-		if(imtype==R_IMF_IMTYPE_PNG)
+		if (imtype==R_IMF_IMTYPE_PNG)
 			ibuf->ftype |= compress;
 
 	}
@@ -1540,18 +1601,18 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, ImageFormatData *imf)
 	else if (imtype==R_IMF_IMTYPE_TIFF) {
 		ibuf->ftype= TIF;
 
-		if(imf->depth == R_IMF_CHAN_DEPTH_16)
+		if (imf->depth == R_IMF_CHAN_DEPTH_16)
 			ibuf->ftype |= TIF_16BIT;
 	}
 #endif
 #ifdef WITH_OPENEXR
 	else if (imtype==R_IMF_IMTYPE_OPENEXR || imtype==R_IMF_IMTYPE_MULTILAYER) {
 		ibuf->ftype= OPENEXR;
-		if(imf->depth == R_IMF_CHAN_DEPTH_16)
+		if (imf->depth == R_IMF_CHAN_DEPTH_16)
 			ibuf->ftype |= OPENEXR_HALF;
 		ibuf->ftype |= (imf->exr_codec & OPENEXR_COMPRESS);
 		
-		if(!(imf->flag & R_IMF_FLAG_ZBUF))
+		if (!(imf->flag & R_IMF_FLAG_ZBUF))
 			ibuf->zbuf_float = NULL;	/* signal for exr saving */
 		
 	}
@@ -1567,17 +1628,18 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, ImageFormatData *imf)
 	else if (imtype==R_IMF_IMTYPE_TARGA) {
 		ibuf->ftype= TGA;
 	}
-	else if(imtype==R_IMF_IMTYPE_RAWTGA) {
+	else if (imtype==R_IMF_IMTYPE_RAWTGA) {
 		ibuf->ftype= RAWTGA;
 	}
 #ifdef WITH_OPENJPEG
-	else if(imtype==R_IMF_IMTYPE_JP2) {
-		if(quality < 10) quality= 90;
+	else if (imtype==R_IMF_IMTYPE_JP2) {
+		if (quality < 10) quality= 90;
 		ibuf->ftype= JP2|quality;
 		
 		if (imf->depth == R_IMF_CHAN_DEPTH_16) {
 			ibuf->ftype |= JP2_16BIT;
-		} else if (imf->depth == R_IMF_CHAN_DEPTH_12) {
+		}
+		else if (imf->depth == R_IMF_CHAN_DEPTH_12) {
 			ibuf->ftype |= JP2_12BIT;
 		}
 		
@@ -1594,7 +1656,7 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, ImageFormatData *imf)
 #endif
 	else {
 		/* R_IMF_IMTYPE_JPEG90, etc. default we save jpegs */
-		if(quality < 10) quality= 90;
+		if (quality < 10) quality= 90;
 		ibuf->ftype= JPG|quality;
 	}
 	
@@ -1633,7 +1695,7 @@ int BKE_write_ibuf_as(ImBuf *ibuf, const char *name, ImageFormatData *imf,
 
 int BKE_write_ibuf_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, const char *name, struct ImageFormatData *imf)
 {
-	if(scene && scene->r.stamp & R_STAMP_ALL)
+	if (scene && scene->r.stamp & R_STAMP_ALL)
 		BKE_stamp_info(scene, camera, ibuf);
 
 	return BKE_write_ibuf(ibuf, name, imf);
@@ -1646,10 +1708,10 @@ void BKE_makepicstring(char *string, const char *base, const char *relbase, int
 	BLI_strncpy(string, base, FILE_MAX - 10);	/* weak assumption */
 	BLI_path_abs(string, relbase);
 
-	if(use_frames)
+	if (use_frames)
 		BLI_path_frame(string, frame, 4);
 
-	if(use_ext)
+	if (use_ext)
 		BKE_add_image_extension(string, imtype);
 		
 }
@@ -1665,7 +1727,7 @@ struct anim *openanim(const char *name, int flags, int streamindex)
 
 	ibuf = IMB_anim_absolute(anim, 0, IMB_TC_NONE, IMB_PROXY_NONE);
 	if (ibuf == NULL) {
-		if(BLI_exists(name))
+		if (BLI_exists(name))
 			printf("not an anim: %s\n", name);
 		else
 			printf("anim file doesn't exist: %s\n", name);
@@ -1681,22 +1743,21 @@ struct anim *openanim(const char *name, int flags, int streamindex)
 
 
 /* Notes about Image storage 
-- packedfile
-  -> written in .blend
-- filename
-  -> written in .blend
-- movie
-  -> comes from packedfile or filename
-- renderresult
-  -> comes from packedfile or filename
-- listbase
-  -> ibufs from exrhandle
-- flipbook array
-  -> ibufs come from movie, temporary renderresult or sequence
-- ibuf
-  -> comes from packedfile or filename or generated
-
-*/
+ * - packedfile
+ *   -> written in .blend
+ * - filename
+ *   -> written in .blend
+ * - movie
+ *   -> comes from packedfile or filename
+ * - renderresult
+ *   -> comes from packedfile or filename
+ * - listbase
+ *   -> ibufs from exrhandle
+ * - flipbook array
+ *   -> ibufs come from movie, temporary renderresult or sequence
+ * - ibuf
+ *   -> comes from packedfile or filename or generated
+ */
 
 
 /* forces existence of 1 Image for renderout or nodes, returns Image */
@@ -1705,16 +1766,16 @@ Image *BKE_image_verify_viewer(int type, const char *name)
 {
 	Image *ima;
 	
-	for(ima=G.main->image.first; ima; ima= ima->id.next)
-		if(ima->source==IMA_SRC_VIEWER)
-			if(ima->type==type)
+	for (ima=G.main->image.first; ima; ima= ima->id.next)
+		if (ima->source==IMA_SRC_VIEWER)
+			if (ima->type==type)
 				break;
 	
-	if(ima==NULL)
+	if (ima==NULL)
 		ima= image_alloc(name, IMA_SRC_VIEWER, type);
 	
 	/* happens on reload, imagewindow cannot be image user when hidden*/
-	if(ima->id.us==0)
+	if (ima->id.us==0)
 		id_us_plus(&ima->id);
 
 	return ima;
@@ -1727,24 +1788,24 @@ void BKE_image_assign_ibuf(Image *ima, ImBuf *ibuf)
 
 void BKE_image_signal(Image *ima, ImageUser *iuser, int signal)
 {
-	if(ima==NULL)
+	if (ima==NULL)
 		return;
 	
 	switch(signal) {
 	case IMA_SIGNAL_FREE:
 		image_free_buffers(ima);
-		if(iuser)
+		if (iuser)
 			iuser->ok= 1;
 		break;
 	case IMA_SIGNAL_SRC_CHANGE:
-		if(ima->type == IMA_TYPE_UV_TEST)
-			if(ima->source != IMA_SRC_GENERATED)
+		if (ima->type == IMA_TYPE_UV_TEST)
+			if (ima->source != IMA_SRC_GENERATED)
 				ima->type= IMA_TYPE_IMAGE;
 
-		if(ima->source==IMA_SRC_GENERATED) {
-			if(ima->gen_x==0 || ima->gen_y==0) {
+		if (ima->source==IMA_SRC_GENERATED) {
+			if (ima->gen_x==0 || ima->gen_y==0) {
 				ImBuf *ibuf= image_get_ibuf(ima, IMA_NO_INDEX, 0);
-				if(ibuf) {
+				if (ibuf) {
 					ima->gen_x= ibuf->x;
 					ima->gen_y= ibuf->y;
 				}
@@ -1752,39 +1813,40 @@ void BKE_image_signal(Image *ima, ImageUser *iuser, int signal)
 		}
 
 		/* force reload on first use, but not for multilayer, that makes nodes and buttons in ui drawing fail */
-		if(ima->type!=IMA_TYPE_MULTILAYER)
+		if (ima->type!=IMA_TYPE_MULTILAYER)
 			image_free_buffers(ima);
 
 		ima->ok= 1;
-		if(iuser)
+		if (iuser)
 			iuser->ok= 1;
 		break;
 			
 	case IMA_SIGNAL_RELOAD:
 		/* try to repack file */
-		if(ima->packedfile) {
+		if (ima->packedfile) {
 			PackedFile *pf;
 			pf = newPackedFile(NULL, ima->name, ID_BLEND_PATH(G.main, &ima->id));
 			if (pf) {
 				freePackedFile(ima->packedfile);
 				ima->packedfile = pf;
 				image_free_buffers(ima);
-			} else {
+			}
+			else {
 				printf("ERROR: Image not available. Keeping packed image\n");
 			}
 		}
 		else
 			image_free_buffers(ima);
 		
-		if(iuser)
+		if (iuser)
 			iuser->ok= 1;
 		
 		break;
 	case IMA_SIGNAL_USER_NEW_IMAGE:
-		if(iuser) {
+		if (iuser) {
 			iuser->ok= 1;
-			if(ima->source==IMA_SRC_FILE || ima->source==IMA_SRC_SEQUENCE) {
-				if(ima->type==IMA_TYPE_MULTILAYER) {
+			if (ima->source==IMA_SRC_FILE || ima->source==IMA_SRC_SEQUENCE) {
+				if (ima->type==IMA_TYPE_MULTILAYER) {
 					iuser->multi_index= 0;
 					iuser->layer= iuser->pass= 0;
 				}
@@ -1793,12 +1855,12 @@ void BKE_image_signal(Image *ima, ImageUser *iuser, int signal)
 		break;
 	}
 	
-	/* dont use notifiers because they are not 100% sure to succseed
+	/* don't use notifiers because they are not 100% sure to succeeded
 	 * this also makes sure all scenes are accounted for. */
 	{
 		Scene *scene;
-		for(scene= G.main->scene.first; scene; scene= scene->id.next) {
-			if(scene->nodetree) {
+		for (scene= G.main->scene.first; scene; scene= scene->id.next) {
+			if (scene->nodetree) {
 				nodeUpdateID(scene->nodetree, &ima->id);
 			}
 		}
@@ -1813,29 +1875,29 @@ RenderPass *BKE_image_multilayer_index(RenderResult *rr, ImageUser *iuser)
 	RenderLayer *rl;
 	RenderPass *rpass= NULL;
 	
-	if(rr==NULL) 
+	if (rr==NULL) 
 		return NULL;
 	
-	if(iuser) {
+	if (iuser) {
 		short index= 0, rl_index= 0, rp_index;
 		
-		for(rl= rr->layers.first; rl; rl= rl->next, rl_index++) {
+		for (rl= rr->layers.first; rl; rl= rl->next, rl_index++) {
 			rp_index= 0;
-			for(rpass= rl->passes.first; rpass; rpass= rpass->next, index++, rp_index++)
-				if(iuser->layer==rl_index && iuser->pass==rp_index)
+			for (rpass= rl->passes.first; rpass; rpass= rpass->next, index++, rp_index++)
+				if (iuser->layer==rl_index && iuser->pass==rp_index)
 					break;
-			if(rpass)
+			if (rpass)
 				break;
 		}
 		
-		if(rpass)
+		if (rpass)
 			iuser->multi_index= index;
 		else 
 			iuser->multi_index= 0;
 	}
-	if(rpass==NULL) {
+	if (rpass==NULL) {
 		rl= rr->layers.first;
-		if(rl)
+		if (rl)
 			rpass= rl->passes.first;
 	}
 	
@@ -1844,11 +1906,11 @@ RenderPass *BKE_image_multilayer_index(RenderResult *rr, ImageUser *iuser)
 
 RenderResult *BKE_image_acquire_renderresult(Scene *scene, Image *ima)
 {
-	if(ima->rr) {
+	if (ima->rr) {
 		return ima->rr;
 	}
-	else if(ima->type==IMA_TYPE_R_RESULT) {
-		if(ima->render_slot == ima->last_render_slot)
+	else if (ima->type==IMA_TYPE_R_RESULT) {
+		if (ima->render_slot == ima->last_render_slot)
 			return RE_AcquireResultRead(RE_GetRender(scene->id.name));
 		else
 			return ima->renders[ima->render_slot];
@@ -1859,9 +1921,9 @@ RenderResult *BKE_image_acquire_renderresult(Scene *scene, Image *ima)
 
 void BKE_image_release_renderresult(Scene *scene, Image *ima)
 {
-	if(ima->rr);
-	else if(ima->type==IMA_TYPE_R_RESULT) {
-		if(ima->render_slot == ima->last_render_slot)
+	if (ima->rr);
+	else if (ima->type==IMA_TYPE_R_RESULT) {
+		if (ima->render_slot == ima->last_render_slot)
 			RE_ReleaseResult(RE_GetRender(scene->id.name));
 	}
 }
@@ -1869,12 +1931,12 @@ void BKE_image_release_renderresult(Scene *scene, Image *ima)
 void BKE_image_backup_render(Scene *scene, Image *ima)
 {
 	/* called right before rendering, ima->renders contains render
-	   result pointers for everything but the current render */
+	 * result pointers for everything but the current render */
 	Render *re= RE_GetRender(scene->id.name);
 	int slot= ima->render_slot, last= ima->last_render_slot;
 
-	if(slot != last) {
-		if(ima->renders[slot]) {
+	if (slot != last) {
+		if (ima->renders[slot]) {
 			RE_FreeRenderResult(ima->renders[slot]);
 			ima->renders[slot]= NULL;
 		}
@@ -1898,7 +1960,7 @@ static void image_create_multilayer(Image *ima, ImBuf *ibuf, int framenr)
 #endif
 
 	ibuf->userdata= NULL;
-	if(ima->rr)
+	if (ima->rr)
 		ima->rr->framenr= framenr;
 }
 
@@ -1906,12 +1968,12 @@ static void image_create_multilayer(Image *ima, ImBuf *ibuf, int framenr)
 static void image_initialize_after_load(Image *ima, ImBuf *ibuf)
 {
 	/* preview is NULL when it has never been used as an icon before */
-	if(G.background==0 && ima->preview==NULL)
+	if (G.background==0 && ima->preview==NULL)
 		BKE_icon_changed(BKE_icon_getid(&ima->id));
 
 	/* fields */
 	if (ima->flag & IMA_FIELDS) {
-		if(ima->flag & IMA_STD_FIELD) de_interlace_st(ibuf);
+		if (ima->flag & IMA_STD_FIELD) de_interlace_st(ibuf);
 		else de_interlace_ng(ibuf);
 	}
 	/* timer */
@@ -1929,7 +1991,7 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame)
 	int flag;
 	
 	/* XXX temp stuff? */
-	if(ima->lastframe != frame)
+	if (ima->lastframe != frame)
 		ima->tpageflag |= IMA_TPAGE_REFRESH;
 
 	ima->lastframe= frame;
@@ -1940,16 +2002,17 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame)
 	BLI_path_abs(name, ID_BLEND_PATH(G.main, &ima->id));
 	
 	flag= IB_rect|IB_multilayer;
-	if(ima->flag & IMA_DO_PREMUL)
+	if (ima->flag & IMA_DO_PREMUL)
 		flag |= IB_premul;
 
 	/* read ibuf */
 	ibuf = IMB_loadiffname(name, flag);
 
 #if 0
-	if(ibuf) {
+	if (ibuf) {
 		printf(AT" loaded %s\n", name);
-	} else {
+	}
+	else {
 		printf(AT" missed %s\n", name);
 	}
 #endif
@@ -1975,7 +2038,7 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame)
 	else
 		ima->ok= 0;
 	
-	if(iuser)
+	if (iuser)
 		iuser->ok= ima->ok;
 	
 	return ibuf;
@@ -1988,32 +2051,32 @@ static ImBuf *image_load_sequence_multilayer(Image *ima, ImageUser *iuser, int f
 	/* either we load from RenderResult, or we have to load a new one */
 	
 	/* check for new RenderResult */
-	if(ima->rr==NULL || frame!=ima->rr->framenr) {
+	if (ima->rr==NULL || frame!=ima->rr->framenr) {
 		/* copy to survive not found multilayer image */
 		RenderResult *oldrr= ima->rr;
 	
 		ima->rr= NULL;
 		ibuf = image_load_sequence_file(ima, iuser, frame);
 		
-		if(ibuf) { /* actually an error */
+		if (ibuf) { /* actually an error */
 			ima->type= IMA_TYPE_IMAGE;
 			printf("error, multi is normal image\n");
 		}
 		// printf("loaded new result %p\n", ima->rr);
 		/* free result if new one found */
-		if(ima->rr) {
-			// if(oldrr) printf("freed previous result %p\n", oldrr);
-			if(oldrr) RE_FreeRenderResult(oldrr);
+		if (ima->rr) {
+			// if (oldrr) printf("freed previous result %p\n", oldrr);
+			if (oldrr) RE_FreeRenderResult(oldrr);
 		}
 		else {
 			ima->rr= oldrr;
 		}
 
 	}
-	if(ima->rr) {
+	if (ima->rr) {
 		RenderPass *rpass= BKE_image_multilayer_index(ima->rr, iuser);
 		
-		if(rpass) {
+		if (rpass) {
 			// printf("load from pass %s\n", rpass->name);
 			/* since we free  render results, we copy the rect */
 			ibuf= IMB_allocImBuf(ima->rr->rectx, ima->rr->recty, 32, 0);
@@ -2032,7 +2095,7 @@ static ImBuf *image_load_sequence_multilayer(Image *ima, ImageUser *iuser, int f
 	else
 		ima->ok= 0;
 	
-	if(iuser)
+	if (iuser)
 		iuser->ok= ima->ok;
 	
 	return ibuf;
@@ -2045,7 +2108,7 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
 	
 	ima->lastframe= frame;
 	
-	if(ima->anim==NULL) {
+	if (ima->anim==NULL) {
 		char str[FILE_MAX];
 		
 		BLI_strncpy(str, ima->name, FILE_MAX);
@@ -2055,24 +2118,24 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
 		ima->anim = openanim(str, IB_rect, 0);
 		
 		/* let's initialize this user */
-		if(ima->anim && iuser && iuser->frames==0)
+		if (ima->anim && iuser && iuser->frames==0)
 			iuser->frames= IMB_anim_get_duration(ima->anim,
 							     IMB_TC_RECORD_RUN);
 	}
 	
-	if(ima->anim) {
+	if (ima->anim) {
 		int dur = IMB_anim_get_duration(ima->anim,
 						IMB_TC_RECORD_RUN);
 		int fra= frame-1;
 		
-		if(fra<0) fra = 0;
-		if(fra>(dur-1)) fra= dur-1;
+		if (fra<0) fra = 0;
+		if (fra>(dur-1)) fra= dur-1;
 		ibuf = IMB_makeSingleUser(
 			IMB_anim_absolute(ima->anim, fra,
 					  IMB_TC_RECORD_RUN,
 					  IMB_PROXY_NONE));
 		
-		if(ibuf) {
+		if (ibuf) {
 			image_initialize_after_load(ima, ibuf);
 			image_assign_ibuf(ima, ibuf, 0, frame);
 		}
@@ -2082,7 +2145,7 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
 	else
 		ima->ok= 0;
 	
-	if(iuser)
+	if (iuser)
 		iuser->ok= ima->ok;
 	
 	return ibuf;
@@ -2101,13 +2164,13 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
 	/* is there a PackedFile with this image ? */
 	if (ima->packedfile) {
 		flag = IB_rect|IB_multilayer;
-		if(ima->flag & IMA_DO_PREMUL) flag |= IB_premul;
+		if (ima->flag & IMA_DO_PREMUL) flag |= IB_premul;
 		
 		ibuf = IMB_ibImageFromMemory((unsigned char*)ima->packedfile->data, ima->packedfile->size, flag, "<packed data>");
 	} 
 	else {
 		flag= IB_rect|IB_multilayer|IB_metadata;
-		if(ima->flag & IMA_DO_PREMUL)
+		if (ima->flag & IMA_DO_PREMUL)
 			flag |= IB_premul;
 			
 		/* get the right string */
@@ -2141,10 +2204,10 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
 	else
 		ima->ok= 0;
 	
-	if(assign)
+	if (assign)
 		image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
 
-	if(iuser)
+	if (iuser)
 		iuser->ok= ima->ok;
 	
 	return ibuf;
@@ -2154,17 +2217,17 @@ static ImBuf *image_get_ibuf_multilayer(Image *ima, ImageUser *iuser)
 {
 	ImBuf *ibuf= NULL;
 	
-	if(ima->rr==NULL) {
+	if (ima->rr==NULL) {
 		ibuf = image_load_image_file(ima, iuser, 0);
-		if(ibuf) { /* actually an error */
+		if (ibuf) { /* actually an error */
 			ima->type= IMA_TYPE_IMAGE;
 			return ibuf;
 		}
 	}
-	if(ima->rr) {
+	if (ima->rr) {
 		RenderPass *rpass= BKE_image_multilayer_index(ima->rr, iuser);
 
-		if(rpass) {
+		if (rpass) {
 			ibuf= IMB_allocImBuf(ima->rr->rectx, ima->rr->recty, 32, 0);
 			
 			image_initialize_after_load(ima, ibuf);
@@ -2178,9 +2241,9 @@ static ImBuf *image_get_ibuf_multilayer(Image *ima, ImageUser *iuser)
 		}
 	}
 	
-	if(ibuf==NULL) 
+	if (ibuf==NULL) 
 		ima->ok= 0;
-	if(iuser)
+	if (iuser)
 		iuser->ok= ima->ok;
 	
 	return ibuf;
@@ -2188,7 +2251,7 @@ static ImBuf *image_get_ibuf_multilayer(Image *ima, ImageUser *iuser)
 
 
 /* showing RGBA result itself (from compo/sequence) or
-   like exr, using layers etc */
+ * like exr, using layers etc */
 /* always returns a single ibuf, also during render progress */
 static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_r)
 {
@@ -2201,11 +2264,11 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
 	ImBuf *ibuf;
 	int from_render= (ima->render_slot == ima->last_render_slot);
 
-	if(!(iuser && iuser->scene))
+	if (!(iuser && iuser->scene))
 		return NULL;
 
 	/* if we the caller is not going to release the lock, don't give the image */
-	if(!lock_r)
+	if (!lock_r)
 		return NULL;
 
 	re= RE_GetRender(iuser->scene->id.name);
@@ -2214,24 +2277,24 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
 	layer= (iuser)? iuser->layer: 0;
 	pass= (iuser)? iuser->pass: 0;
 
-	if(from_render) {
+	if (from_render) {
 		RE_AcquireResultImage(re, &rres);
 	}
-	else if(ima->renders[ima->render_slot]) {
+	else if (ima->renders[ima->render_slot]) {
 		rres= *(ima->renders[ima->render_slot]);
 		rres.have_combined= rres.rectf != NULL;
 	}
 	else
 		memset(&rres, 0, sizeof(RenderResult));
 	
-	if(!(rres.rectx > 0 && rres.recty > 0)) {
-		if(from_render)
+	if (!(rres.rectx > 0 && rres.recty > 0)) {
+		if (from_render)
 			RE_ReleaseResultImage(re);
 		return NULL;
 	}
 
 	/* release is done in BKE_image_release_ibuf using lock_r */
-	if(from_render) {
+	if (from_render) {
 		BLI_lock_thread(LOCK_VIEWER);
 		*lock_r= re;
 	}
@@ -2243,27 +2306,27 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
 	dither= iuser->scene->r.dither_intensity;
 
 	/* combined layer gets added as first layer */
-	if(rres.have_combined && layer==0);
-	else if(rres.layers.first) {
+	if (rres.have_combined && layer==0);
+	else if (rres.layers.first) {
 		RenderLayer *rl= BLI_findlink(&rres.layers, layer-(rres.have_combined?1:0));
-		if(rl) {
+		if (rl) {
 			RenderPass *rpass;
 
 			/* there's no combined pass, is in renderlayer itself */
-			if(pass==0) {
+			if (pass==0) {
 				rectf= rl->rectf;
 			}
 			else {
 				rpass= BLI_findlink(&rl->passes, pass-1);
-				if(rpass) {
+				if (rpass) {
 					channels= rpass->channels;
 					rectf= rpass->rect;
 					dither= 0.0f; /* don't dither passes */
 				}
 			}
 
-			for(rpass= rl->passes.first; rpass; rpass= rpass->next)
-				if(rpass->passtype == SCE_PASS_Z)
+			for (rpass= rl->passes.first; rpass; rpass= rpass->next)
+				if (rpass->passtype == SCE_PASS_Z)
 					rectz= rpass->rect;
 		}
 	}
@@ -2271,7 +2334,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
 	ibuf= image_get_ibuf(ima, IMA_NO_INDEX, 0);
 
 	/* make ibuf if needed, and initialize it */
-	if(ibuf==NULL) {
+	if (ibuf==NULL) {
 		ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, 0);
 		image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
 	}
@@ -2280,15 +2343,15 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
 	ibuf->y= rres.recty;
 	
 	/* 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)
+	 * 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)
 		imb_freerectImBuf(ibuf);
 
-	if(rect)
+	if (rect)
 		ibuf->rect= rect;
 	
-	if(rectf) {
+	if (rectf) {
 		ibuf->rect_float= rectf;
 		ibuf->flags |= IB_rectfloat;
 		ibuf->channels= channels;
@@ -2298,7 +2361,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
 		ibuf->flags &= ~IB_rectfloat;
 	}
 
-	if(rectz) {
+	if (rectz) {
 		ibuf->zbuf_float= rectz;
 		ibuf->flags |= IB_zbuffloat;
 	}
@@ -2311,7 +2374,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
 	ibuf->profile= (iuser->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) ? IB_PROFILE_LINEAR_RGB : IB_PROFILE_NONE;
 	ibuf->dither= dither;
 
-	if(iuser->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT_PREDIVIDE) {
+	if (iuser->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT_PREDIVIDE) {
 		ibuf->flags |= IB_cm_predivide;
 		ima->flag |= IMA_CM_PREDIVIDE;
 	}
@@ -2331,41 +2394,41 @@ static ImBuf *image_get_ibuf_threadsafe(Image *ima, ImageUser *iuser, int *frame
 	int frame = 0, index = 0;
 
 	/* see if we already have an appropriate ibuf, with image source and type */
-	if(ima->source==IMA_SRC_MOVIE) {
+	if (ima->source==IMA_SRC_MOVIE) {
 		frame= iuser?iuser->framenr:ima->lastframe;
 		ibuf= image_get_ibuf(ima, 0, frame);
 		/* XXX temp stuff? */
-		if(ima->lastframe != frame)
+		if (ima->lastframe != frame)
 			ima->tpageflag |= IMA_TPAGE_REFRESH;
 		ima->lastframe = frame;
 	}
-	else if(ima->source==IMA_SRC_SEQUENCE) {
-		if(ima->type==IMA_TYPE_IMAGE) {
+	else if (ima->source==IMA_SRC_SEQUENCE) {
+		if (ima->type==IMA_TYPE_IMAGE) {
 			frame= iuser?iuser->framenr:ima->lastframe;
 			ibuf= image_get_ibuf(ima, 0, frame);
 			
 			/* XXX temp stuff? */
-			if(ima->lastframe != frame) {
+			if (ima->lastframe != frame) {
 				ima->tpageflag |= IMA_TPAGE_REFRESH;
 			}
 			ima->lastframe = frame;
 		}	
-		else if(ima->type==IMA_TYPE_MULTILAYER) {
+		else if (ima->type==IMA_TYPE_MULTILAYER) {
 			frame= iuser?iuser->framenr:ima->lastframe;
 			index= iuser?iuser->multi_index:IMA_NO_INDEX;
 			ibuf= image_get_ibuf(ima, index, frame);
 		}
 	}
-	else if(ima->source==IMA_SRC_FILE) {
-		if(ima->type==IMA_TYPE_IMAGE)
+	else if (ima->source==IMA_SRC_FILE) {
+		if (ima->type==IMA_TYPE_IMAGE)
 			ibuf= image_get_ibuf(ima, IMA_NO_INDEX, 0);
-		else if(ima->type==IMA_TYPE_MULTILAYER)
+		else if (ima->type==IMA_TYPE_MULTILAYER)
 			ibuf= image_get_ibuf(ima, iuser?iuser->multi_index:IMA_NO_INDEX, 0);
 	}
-	else if(ima->source == IMA_SRC_GENERATED) {
+	else if (ima->source == IMA_SRC_GENERATED) {
 		ibuf= image_get_ibuf(ima, IMA_NO_INDEX, 0);
 	}
-	else if(ima->source == IMA_SRC_VIEWER) {
+	else if (ima->source == IMA_SRC_VIEWER) {
 		/* always verify entirely, not that this shouldn't happen
 		 * as part of texture sampling in rendering anyway, so not
 		 * a big bottleneck */
@@ -2397,87 +2460,87 @@ ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r)
 	 * 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)
+	if (lock_r)
 		*lock_r= NULL;
 
 	/* quick reject tests */
-	if(ima==NULL) 
+	if (ima==NULL) 
 		return NULL;
-	if(iuser) {
-		if(iuser->ok==0)
+	if (iuser) {
+		if (iuser->ok==0)
 			return NULL;
 	}
-	else if(ima->ok==0)
+	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) {
+	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) {
+		if (iuser) {
+			if (iuser->ok==0) {
 				BLI_unlock_thread(LOCK_IMAGE);
 				return NULL;
 			}
 		}
-		else if(ima->ok==0) {
+		else if (ima->ok==0) {
 			BLI_unlock_thread(LOCK_IMAGE);
 			return NULL;
 		}
 
 		ibuf= image_get_ibuf_threadsafe(ima, iuser, &frame, &index);
 
-		if(ibuf == NULL) {
+		if (ibuf == NULL) {
 			/* we are sure we have to load the ibuf, using source and type */
-			if(ima->source==IMA_SRC_MOVIE) {
+			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) {
+			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) {
+				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)
+				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)
+				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) {
+			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;
+				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);
 				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) {
+			else if (ima->source == IMA_SRC_VIEWER) {
+				if (ima->type==IMA_TYPE_R_RESULT) {
 					/* always verify entirely, and potentially
-					   returns pointer to release later */
+					 * returns pointer to release later */
 					ibuf= image_get_render_result(ima, iuser, lock_r);
 				}
-				else if(ima->type==IMA_TYPE_COMPOSITE) {
+				else if (ima->type==IMA_TYPE_COMPOSITE) {
 					/* requires lock/unlock, otherwise don't return image */
-					if(lock_r) {
+					if (lock_r) {
 						/* unlock in BKE_image_release_ibuf */
 						BLI_lock_thread(LOCK_VIEWER);
 						*lock_r= ima;
@@ -2486,7 +2549,7 @@ ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r)
 						frame= 0; // XXX iuser?iuser->framenr:0;
 						ibuf= image_get_ibuf(ima, 0, frame);
 
-						if(!ibuf) {
+						if (!ibuf) {
 							/* Composite Viewer, all handled in compositor */
 							/* fake ibuf, will be filled in compositor */
 							ibuf= IMB_allocImBuf(256, 256, 32, IB_rect);
@@ -2508,10 +2571,10 @@ ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r)
 void BKE_image_release_ibuf(Image *ima, void *lock)
 {
 	/* for getting image during threaded render / compositing, need to release */
-	if(lock == ima) {
+	if (lock == ima) {
 		BLI_unlock_thread(LOCK_VIEWER); /* viewer image */
 	}
-	else if(lock) {
+	else if (lock) {
 		RE_ReleaseResultImage(lock); /* render result */
 		BLI_unlock_thread(LOCK_VIEWER); /* view image imbuf */
 	}
@@ -2528,7 +2591,7 @@ int BKE_image_user_get_frame(const ImageUser *iuser, int cfra, int fieldnr)
 {
 	const int len= (iuser->fie_ima*iuser->frames)/2;
 
-	if(len==0) {
+	if (len==0) {
 		return 0;
 	}
 	else {
@@ -2536,28 +2599,28 @@ int BKE_image_user_get_frame(const ImageUser *iuser, int cfra, int fieldnr)
 		cfra= cfra - iuser->sfra+1;
 
 		/* cyclic */
-		if(iuser->cycl) {
+		if (iuser->cycl) {
 			cfra= ( (cfra) % len );
-			if(cfra < 0) cfra+= len;
-			if(cfra==0) cfra= len;
+			if (cfra < 0) cfra+= len;
+			if (cfra==0) cfra= len;
 		}
 
-		if(cfra<0) cfra= 0;
-		else if(cfra>len) cfra= len;
+		if (cfra<0) cfra= 0;
+		else if (cfra>len) cfra= len;
 
 		/* convert current frame to current field */
 		cfra= 2*(cfra);
-		if(fieldnr) cfra++;
+		if (fieldnr) cfra++;
 
 		/* transform to images space */
 		framenr= (cfra+iuser->fie_ima-2)/iuser->fie_ima;
-		if(framenr>iuser->frames) framenr= iuser->frames;
+		if (framenr>iuser->frames) framenr= iuser->frames;
 		framenr+= iuser->offset;
 
-		if(iuser->cycl) {
+		if (iuser->cycl) {
 			framenr= ( (framenr) % len );
-			while(framenr < 0) framenr+= len;
-			if(framenr==0) framenr= len;
+			while (framenr < 0) framenr+= len;
+			if (framenr==0) framenr= len;
 		}
 
 		return framenr;
@@ -2569,12 +2632,12 @@ void BKE_image_user_calc_frame(ImageUser *iuser, int cfra, int fieldnr)
 	const int framenr= BKE_image_user_get_frame(iuser, cfra, fieldnr);
 
 	/* allows image users to handle redraws */
-	if(iuser->flag & IMA_ANIM_ALWAYS)
-		if(framenr!=iuser->framenr)
+	if (iuser->flag & IMA_ANIM_ALWAYS)
+		if (framenr!=iuser->framenr)
 			iuser->flag |= IMA_ANIM_REFRESHED;
 
 	iuser->framenr= framenr;
-	if(iuser->ok==0) iuser->ok= 1;
+	if (iuser->ok==0) iuser->ok= 1;
 }
 
 int BKE_image_has_alpha(struct Image *image)
diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c
index c6cb8c9..675c077 100644
--- a/source/blender/blenkernel/intern/image_gen.c
+++ b/source/blender/blenkernel/intern/image_gen.c
@@ -38,22 +38,22 @@ void BKE_image_buf_fill_color(unsigned char *rect, float *rect_float, int width,
 	int x, y;
 
 	/* blank image */
-	if(rect_float) {
-		for(y= 0; y<height; y++) {
-			for(x= 0; x<width; x++) {
+	if (rect_float) {
+		for (y= 0; y<height; y++) {
+			for (x= 0; x<width; x++) {
 				copy_v4_v4(rect_float, color);
 				rect_float+= 4;
 			}
 		}
 	}
 	
-	if(rect) {
+	if (rect) {
 		unsigned char ccol[4];
 
 		rgba_float_to_uchar(ccol, color);
 
-		for(y= 0; y<height; y++) {
-			for(x= 0; x<width; x++) {
+		for (y= 0; y<height; y++) {
+			for (x= 0; x<width; x++) {
 				
 				rect[0]= ccol[0];
 				rect[1]= ccol[1];
@@ -69,7 +69,7 @@ void BKE_image_buf_fill_color(unsigned char *rect, float *rect_float, int width,
 void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int width, int height)
 {
 	/* these two passes could be combined into one, but it's more readable and 
-	* easy to tweak like this, speed isn't really that much of an issue in this situation... */
+	 * easy to tweak like this, speed isn't really that much of an issue in this situation... */
  
 	int checkerwidth= 32, dark= 1;
 	int x, y;
@@ -81,17 +81,18 @@ void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int widt
 	float h=0.0, hoffs=0.0, hue=0.0, s=0.9, v=0.9, r, g, b;
 
 	/* checkers */
-	for(y= 0; y<height; y++) {
+	for (y= 0; y<height; y++) {
 		dark= powf(-1.0f, floorf(y / checkerwidth));
 		
-		for(x= 0; x<width; x++) {
+		for (x= 0; x<width; x++) {
 			if (x % checkerwidth == 0) dark= -dark;
 			
 			if (rect_float) {
 				if (dark > 0) {
 					rect_float[0]= rect_float[1]= rect_float[2]= 0.25f;
 					rect_float[3]= 1.0f;
-				} else {
+				}
+				else {
 					rect_float[0]= rect_float[1]= rect_float[2]= 0.58f;
 					rect_float[3]= 1.0f;
 				}
@@ -101,7 +102,8 @@ void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int widt
 				if (dark > 0) {
 					rect[0]= rect[1]= rect[2]= 64;
 					rect[3]= 255;
-				} else {
+				}
+				else {
 					rect[0]= rect[1]= rect[2]= 150;
 					rect[3]= 255;
 				}
@@ -114,10 +116,10 @@ void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int widt
 	rect_float= rect_float_orig;
 
 	/* 2nd pass, colored + */
-	for(y= 0; y<height; y++) {
+	for (y= 0; y<height; y++) {
 		hoffs= 0.125f * floorf(y / checkerwidth);
 		
-		for(x= 0; x<width; x++) {
+		for (x= 0; x<width; x++) {
 			h= 0.125f * floorf(x / checkerwidth);
 			
 			if ((fabs((x % checkerwidth) - (checkerwidth / 2)) < 4) &&
@@ -165,13 +167,13 @@ static void checker_board_color_fill(unsigned char *rect, float *rect_float, int
 	sat= 1.0;
 
 	hue_step= power_of_2_max_i(width / 8);
-	if(hue_step < 8) hue_step= 8;
+	if (hue_step < 8) hue_step= 8;
 
-	for(y= 0; y < height; y++)
+	for (y= 0; y < height; y++)
 	{
 
 		val= 0.1 + (y * (0.4 / height)); /* use a number lower then 1.0 else its too bright */
-		for(x= 0; x < width; x++)
+		for (x= 0; x < width; x++)
 		{
 			hue= (float)((double)(x/hue_step) * 1.0 / width * hue_step);
 			hsv_to_rgb(hue, sat, val, &r, &g, &b);
@@ -202,12 +204,9 @@ static void checker_board_color_tint(unsigned char *rect, float *rect_float, int
 	int x, y;
 	float blend_half= blend * 0.5f;
 
-	for(y= 0; y < height; y++)
-	{
-		for(x= 0; x < width; x++)
-		{
-			if( ( (y/size)%2 == 1 && (x/size)%2 == 1 ) || ( (y/size)%2 == 0 && (x/size)%2 == 0 ) )
-			{
+	for (y= 0; y < height; y++) {
+		for (x= 0; x < width; x++) {
+			if (((y / size) % 2 == 1 && (x / size) % 2 == 1 ) || ( (y / size) % 2 == 0 && (x / size) % 2 == 0 )) {
 				if (rect) {
 					rect[0]= (char)BLEND_CHAR(rect[0], blend);
 					rect[1]= (char)BLEND_CHAR(rect[1], blend);
@@ -251,12 +250,9 @@ 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)
 {
 	int x, y;
-	for(y= 0; y < height; y++)
-	{
-		for(x= 0; x < width; x++)
-		{
-			if( ((y % 32) == 0) || ((x % 32) == 0)  || x == 0 )
-			{
+	for (y= 0; y < height; y++) {
+		for (x= 0; x < width; x++) {
+			if (((y % 32) == 0) || ((x % 32) == 0)  || x == 0) {
 				if (rect) {
 					rect[0]= BLEND_CHAR(rect[0], blend);
 					rect[1]= BLEND_CHAR(rect[1], blend);
@@ -275,8 +271,8 @@ static void checker_board_grid_fill(unsigned char *rect, float *rect_float, int
 				}
 			}
 			else {
-				if(rect_float) rect_float += 4;
-				if(rect) rect += 4;
+				if (rect_float) rect_float += 4;
+				if (rect) rect += 4;
 			}
 		}
 	}
@@ -295,11 +291,11 @@ static void checker_board_text(unsigned char *rect, float *rect_float, int width
 
 	BLF_buffer(mono, rect_float, rect, width, height, 4);
 
-	for(y= 0; y < height; y+=step)
+	for (y= 0; y < height; y+=step)
 	{
 		text[1]= '1';
 
-		for(x= 0; x < width; x+=step)
+		for (x= 0; x < width; x+=step)
 		{
 			/* hard coded offset */
 			pen_x = x + 33;
diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c
index 757d3dd..a4edc1e 100644
--- a/source/blender/blenkernel/intern/implicit.c
+++ b/source/blender/blenkernel/intern/implicit.c
@@ -57,7 +57,7 @@ static LARGE_INTEGER ifreq;
 static void itstart(void)
 {
 	static int first = 1;
-	if(first) {
+	if (first) {
 		QueryPerformanceFrequency(&ifreq);
 		first = 0;
 	}
@@ -178,7 +178,7 @@ static void print_fvector(float m3[3])
 DO_INLINE void print_lfvector(float (*fLongVector)[3], unsigned int verts)
 {
 	unsigned int i = 0;
-	for(i = 0; i < verts; i++)
+	for (i = 0; i < verts; i++)
 	{
 		print_fvector(fLongVector[i]);
 	}
@@ -208,9 +208,9 @@ DO_INLINE void cp_lfvector(float (*to)[3], float (*from)[3], unsigned int verts)
 DO_INLINE void init_lfvector(float (*fLongVector)[3], float vector[3], unsigned int verts)
 {
 	unsigned int i = 0;
-	for(i = 0; i < verts; i++)
+	for (i = 0; i < verts; i++)
 	{
-		VECCOPY(fLongVector[i], vector);
+		copy_v3_v3(fLongVector[i], vector);
 	}
 }
 /* zero long vector with float[3] */
@@ -223,7 +223,7 @@ DO_INLINE void mul_lfvectorS(float (*to)[3], float (*fLongVector)[3], float scal
 {
 	unsigned int i = 0;
 
-	for(i = 0; i < verts; i++)
+	for (i = 0; i < verts; i++)
 	{
 		mul_fvector_S(to[i], fLongVector[i], scalar);
 	}
@@ -233,7 +233,7 @@ DO_INLINE void mul_lfvectorS(float (*to)[3], float (*fLongVector)[3], float scal
 DO_INLINE void submul_lfvectorS(float (*to)[3], float (*fLongVector)[3], float scalar, unsigned int verts)
 {
 	unsigned int i = 0;
-	for(i = 0; i < verts; i++)
+	for (i = 0; i < verts; i++)
 	{
 		VECSUBMUL(to[i], fLongVector[i], scalar);
 	}
@@ -247,10 +247,9 @@ DO_INLINE float dot_lfvector(float (*fLongVectorA)[3], float (*fLongVectorB)[3],
 // due to non-commutative nature of floating point ops this makes the sim give
 // different results each time you run it!
 // schedule(guided, 2)
-//#pragma omp parallel for reduction(+: temp) if(verts > CLOTH_OPENMP_LIMIT)
-	for(i = 0; i < (long)verts; i++)
-	{
-		temp += INPR(fLongVectorA[i], fLongVectorB[i]);
+//#pragma omp parallel for reduction(+: temp) if (verts > CLOTH_OPENMP_LIMIT)
+	for (i = 0; i < (long)verts; i++) {
+		temp += dot_v3v3(fLongVectorA[i], fLongVectorB[i]);
 	}
 	return temp;
 }
@@ -259,7 +258,7 @@ DO_INLINE void add_lfvector_lfvector(float (*to)[3], float (*fLongVectorA)[3], f
 {
 	unsigned int i = 0;
 
-	for(i = 0; i < verts; i++)
+	for (i = 0; i < verts; i++)
 	{
 		VECADD(to[i], fLongVectorA[i], fLongVectorB[i]);
 	}
@@ -270,7 +269,7 @@ DO_INLINE void add_lfvector_lfvectorS(float (*to)[3], float (*fLongVectorA)[3],
 {
 	unsigned int i = 0;
 
-	for(i = 0; i < verts; i++)
+	for (i = 0; i < verts; i++)
 	{
 		VECADDS(to[i], fLongVectorA[i], fLongVectorB[i], bS);
 
@@ -281,7 +280,7 @@ DO_INLINE void add_lfvectorS_lfvectorS(float (*to)[3], float (*fLongVectorA)[3],
 {
 	unsigned int i = 0;
 
-	for(i = 0; i < verts; i++)
+	for (i = 0; i < verts; i++)
 	{
 		VECADDSS(to[i], fLongVectorA[i], aS, fLongVectorB[i], bS);
 	}
@@ -290,7 +289,7 @@ DO_INLINE void add_lfvectorS_lfvectorS(float (*to)[3], float (*fLongVectorA)[3],
 DO_INLINE void sub_lfvector_lfvectorS(float (*to)[3], float (*fLongVectorA)[3], float (*fLongVectorB)[3], float bS, unsigned int verts)
 {
 	unsigned int i = 0;
-	for(i = 0; i < verts; i++)
+	for (i = 0; i < verts; i++)
 	{
 		VECSUBS(to[i], fLongVectorA[i], fLongVectorB[i], bS);
 	}
@@ -301,9 +300,9 @@ DO_INLINE void sub_lfvector_lfvector(float (*to)[3], float (*fLongVectorA)[3], f
 {
 	unsigned int i = 0;
 
-	for(i = 0; i < verts; i++)
+	for (i = 0; i < verts; i++)
 	{
-		VECSUB(to[i], fLongVectorA[i], fLongVectorB[i]);
+		sub_v3_v3v3(to[i], fLongVectorA[i], fLongVectorB[i]);
 	}
 
 }
@@ -324,9 +323,9 @@ static void print_fmatrix(float m3[3][3])
 DO_INLINE void cp_fmatrix(float to[3][3], float from[3][3])
 {
 	// memcpy(to, from, sizeof (float) * 9);
-	VECCOPY(to[0], from[0]);
-	VECCOPY(to[1], from[1]);
-	VECCOPY(to[2], from[2]);
+	copy_v3_v3(to[0], from[0]);
+	copy_v3_v3(to[1], from[1]);
+	copy_v3_v3(to[2], from[2]);
 }
 
 /* copy 3x3 matrix */
@@ -351,14 +350,14 @@ DO_INLINE void inverse_fmatrix(float to[3][3], float from[3][3])
 	unsigned int i, j;
 	float d;
 
-	if((d=det_fmatrix(from))==0)
+	if ((d=det_fmatrix(from))==0)
 	{
 		printf("can't build inverse");
 		exit(0);
 	}
-	for(i=0;i<3;i++) 
+	for (i=0;i<3;i++) 
 	{
-		for(j=0;j<3;j++) 
+		for (j=0;j<3;j++) 
 		{
 			int i1=(i+1)%3;
 			int i2=(i+2)%3;
@@ -367,7 +366,7 @@ DO_INLINE void inverse_fmatrix(float to[3][3], float from[3][3])
 			// reverse indexs i&j to take transpose
 			to[j][i] = (from[i1][j1]*from[i2][j2]-from[i1][j2]*from[i2][j1])/d;
 			/*
-			if(i==j)
+			if (i==j)
 			to[i][j] = 1.0f / from[i][j];
 			else
 			to[i][j] = 0;
@@ -397,11 +396,11 @@ DO_INLINE void mul_fvector_fmatrix(float *to, float *from, float matrix[3][3])
 
 /* 3x3 matrix multiplied by a vector */
 /* STATUS: verified */
-DO_INLINE void mul_fmatrix_fvector(float *to, float matrix[3][3], float *from)
+DO_INLINE void mul_fmatrix_fvector(float *to, float matrix[3][3], float from[3])
 {
-	to[0] = INPR(matrix[0],from);
-	to[1] = INPR(matrix[1],from);
-	to[2] = INPR(matrix[2],from);
+	to[0] = dot_v3v3(matrix[0],from);
+	to[1] = dot_v3v3(matrix[1],from);
+	to[2] = dot_v3v3(matrix[2],from);
 }
 /* 3x3 matrix multiplied by a 3x3 matrix */
 /* STATUS: verified */
@@ -449,9 +448,9 @@ DO_INLINE void subadd_fmatrixS_fmatrixS(float to[3][3], float matrixA[3][3], flo
 /* A = B - C (3x3 matrix subtraction with 3x3 matrix) */
 DO_INLINE void sub_fmatrix_fmatrix(float to[3][3], float matrixA[3][3], float matrixB[3][3])
 {
-	VECSUB(to[0], matrixA[0], matrixB[0]);
-	VECSUB(to[1], matrixA[1], matrixB[1]);
-	VECSUB(to[2], matrixA[2], matrixB[2]);
+	sub_v3_v3v3(to[0], matrixA[0], matrixB[0]);
+	sub_v3_v3v3(to[1], matrixA[1], matrixB[1]);
+	sub_v3_v3v3(to[2], matrixA[2], matrixB[2]);
 }
 /* A += B - C (3x3 matrix add-subtraction with 3x3 matrix) */
 DO_INLINE void addsub_fmatrix_fmatrix(float to[3][3], float matrixA[3][3], float matrixB[3][3])
@@ -495,16 +494,16 @@ DO_INLINE void mulsub_fmatrix_fmatrix(float to[3][3], float matrixA[3][3], float
 /* STATUS: verified */
 DO_INLINE void muladd_fmatrix_fvector(float to[3], float matrix[3][3], float from[3])
 {
-	to[0] += INPR(matrix[0],from);
-	to[1] += INPR(matrix[1],from);
-	to[2] += INPR(matrix[2],from);	
+	to[0] += dot_v3v3(matrix[0], from);
+	to[1] += dot_v3v3(matrix[1], from);
+	to[2] += dot_v3v3(matrix[2], from);
 }
 /* 3x3 matrix multiplied+sub'ed by a vector */
 DO_INLINE void mulsub_fmatrix_fvector(float to[3], float matrix[3][3], float from[3])
 {
-	to[0] -= INPR(matrix[0],from);
-	to[1] -= INPR(matrix[1],from);
-	to[2] -= INPR(matrix[2],from);
+	to[0] -= dot_v3v3(matrix[0], from);
+	to[1] -= dot_v3v3(matrix[1], from);
+	to[2] -= dot_v3v3(matrix[2], from);
 }
 /////////////////////////////////////////////////////////////////
 
@@ -517,7 +516,7 @@ static void print_bfmatrix(fmatrix3x3 *m3)
 {
 	unsigned int i = 0;
 
-	for(i = 0; i < m3[0].vcount + m3[0].scount; i++)
+	for (i = 0; i < m3[0].vcount + m3[0].scount; i++)
 	{
 		print_fmatrix(m3[i].m);
 	}
@@ -555,7 +554,7 @@ DO_INLINE void init_bfmatrix(fmatrix3x3 *matrix, float m3[3][3])
 {
 	unsigned int i;
 
-	for(i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
+	for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
 	{		
 		cp_fmatrix(matrix[i].m, m3); 
 	}
@@ -568,11 +567,11 @@ DO_INLINE void initdiag_bfmatrix(fmatrix3x3 *matrix, float m3[3][3])
 	unsigned int i,j;
 	float tmatrix[3][3] = {{0,0,0},{0,0,0},{0,0,0}};
 
-	for(i = 0; i < matrix[0].vcount; i++)
+	for (i = 0; i < matrix[0].vcount; i++)
 	{		
 		cp_fmatrix(matrix[i].m, m3); 
 	}
-	for(j = matrix[0].vcount; j < matrix[0].vcount+matrix[0].scount; j++)
+	for (j = matrix[0].vcount; j < matrix[0].vcount+matrix[0].scount; j++)
 	{
 		cp_fmatrix(matrix[j].m, tmatrix); 
 	}
@@ -582,7 +581,7 @@ DO_INLINE void initdiag_bfmatrix(fmatrix3x3 *matrix, float m3[3][3])
 DO_INLINE void mul_bfmatrix_S(fmatrix3x3 *matrix, float scalar)
 {
 	unsigned int i = 0;
-	for(i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
+	for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
 	{
 		mul_fmatrix_S(matrix[i].m, scalar);
 	}
@@ -598,18 +597,18 @@ DO_INLINE void mul_bfmatrix_lfvector( float (*to)[3], fmatrix3x3 *from, lfVector
 	
 	zero_lfvector(to, vcount);
 
-#pragma omp parallel sections private(i) if(vcount > CLOTH_OPENMP_LIMIT)
+#pragma omp parallel sections private(i) if (vcount > CLOTH_OPENMP_LIMIT)
 	{
 #pragma omp section
 		{
-			for(i = from[0].vcount; i < from[0].vcount+from[0].scount; i++)
+			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++)
+			for (i = 0; i < from[0].vcount+from[0].scount; i++)
 			{
 				muladd_fmatrix_fvector(temp[from[i].r], from[i].m, fLongVector[from[i].c]);
 			}
@@ -628,7 +627,7 @@ DO_INLINE void mul_prevfmatrix_lfvector( float (*to)[3], fmatrix3x3 *from, lfVec
 {
 	unsigned int i = 0;
 	
-	for(i = 0; i < from[0].vcount; i++)
+	for (i = 0; i < from[0].vcount; i++)
 	{
 		mul_fmatrix_fvector(to[from[i].r], from[i].m, fLongVector[from[i].c]);
 	}
@@ -640,7 +639,7 @@ DO_INLINE void add_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from,  fmatrix
 	unsigned int i = 0;
 
 	/* process diagonal elements */
-	for(i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
+	for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
 	{
 		add_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);	
 	}
@@ -652,7 +651,7 @@ DO_INLINE void addadd_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from,  fmat
 	unsigned int i = 0;
 
 	/* process diagonal elements */
-	for(i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
+	for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
 	{
 		addadd_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);	
 	}
@@ -664,7 +663,7 @@ DO_INLINE void subadd_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from,  fmat
 	unsigned int i = 0;
 
 	/* process diagonal elements */
-	for(i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
+	for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
 	{
 		subadd_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);	
 	}
@@ -676,7 +675,7 @@ DO_INLINE void sub_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from,  fmatrix
 	unsigned int i = 0;
 
 	/* process diagonal elements */
-	for(i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
+	for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
 	{
 		sub_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);	
 	}
@@ -688,7 +687,7 @@ DO_INLINE void sub_bfmatrix_Smatrix( fmatrix3x3 *to, fmatrix3x3 *from,  fmatrix3
 	unsigned int i = 0;
 
 	/* process diagonal elements */
-	for(i = 0; i < matrix[0].vcount; i++)
+	for (i = 0; i < matrix[0].vcount; i++)
 	{
 		sub_fmatrix_fmatrix(to[matrix[i].c].m, from[matrix[i].c].m, matrix[i].m);	
 	}
@@ -700,7 +699,7 @@ DO_INLINE void addsub_bfmatrix_bfmatrix( fmatrix3x3 *to, fmatrix3x3 *from,  fmat
 	unsigned int i = 0;
 
 	/* process diagonal elements */
-	for(i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
+	for (i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
 	{
 		addsub_fmatrix_fmatrix(to[i].m, from[i].m, matrix[i].m);	
 	}
@@ -714,7 +713,7 @@ DO_INLINE void subadd_bfmatrixS_bfmatrixS( fmatrix3x3 *to, fmatrix3x3 *from, flo
 	unsigned int i = 0;
 
 	/* process diagonal elements */
-	for(i = 0; i < matrix[0].vcount+matrix[0].scount; i++)
+	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);	
 	}
@@ -740,7 +739,7 @@ int implicit_init (Object *UNUSED(ob), ClothModifierData *clmd)
 	Implicit_Data *id = NULL;
 	LinkNode *search = NULL;
 	
-	if(G.rt > 0)
+	if (G.rt > 0)
 		printf("implicit_init\n");
 
 	// init memory guard
@@ -773,11 +772,11 @@ int implicit_init (Object *UNUSED(ob), ClothModifierData *clmd)
 	id->dV = create_lfvector(cloth->numverts);
 	id->z = create_lfvector(cloth->numverts);
 	
-	for(i=0;i<cloth->numverts;i++) 
+	for (i=0;i<cloth->numverts;i++) 
 	{
 		id->A[i].r = id->A[i].c = id->dFdV[i].r = id->dFdV[i].c = id->dFdX[i].r = id->dFdX[i].c = id->P[i].c = id->P[i].r = id->Pinv[i].c = id->Pinv[i].r = id->bigI[i].c = id->bigI[i].r = id->M[i].r = id->M[i].c = i;
 
-		if(verts [i].flags & CLOTH_VERT_FLAG_PINNED)
+		if (verts [i].flags & CLOTH_VERT_FLAG_PINNED)
 		{
 			id->S[pinned].pinned = 1;
 			id->S[pinned].c = id->S[pinned].r = i;
@@ -792,7 +791,7 @@ int implicit_init (Object *UNUSED(ob), ClothModifierData *clmd)
 
 	// init springs 
 	search = cloth->springs;
-	for(i=0;i<cloth->numsprings;i++) 
+	for (i=0;i<cloth->numsprings;i++) 
 	{
 		spring = search->link;
 		
@@ -811,9 +810,9 @@ int implicit_init (Object *UNUSED(ob), ClothModifierData *clmd)
 	
 	initdiag_bfmatrix(id->bigI, I);
 
-	for(i = 0; i < cloth->numverts; i++)
+	for (i = 0; i < cloth->numverts; i++)
 	{		
-		VECCOPY(id->X[i], verts[i].x);
+		copy_v3_v3(id->X[i], verts[i].x);
 	}
 
 	return 1;
@@ -824,11 +823,11 @@ int	implicit_free (ClothModifierData *clmd)
 	Cloth *cloth;
 	cloth = (Cloth *)clmd->clothObject;
 
-	if(cloth)
+	if (cloth)
 	{
 		id = cloth->implicit;
 
-		if(id)
+		if (id)
 		{
 			del_bfmatrix(id->A);
 			del_bfmatrix(id->dFdV);
@@ -875,7 +874,7 @@ DO_INLINE float fbstar(float length, float L, float kb, float cb)
 
 	float fbstar = cb * (length - L);
 	
-	if(tempfb < fbstar)
+	if (tempfb < fbstar)
 		return fbstar;
 	else
 		return tempfb;		
@@ -887,7 +886,7 @@ DO_INLINE float fbstar_jacobi(float length, float L, float kb, float cb)
 	float tempfb = kb * fb(length, L);
 	float fbstar = cb * (length - L);
 
-	if(tempfb < fbstar)
+	if (tempfb < fbstar)
 	{		
 		return cb;
 	}
@@ -901,7 +900,7 @@ DO_INLINE void filter(lfVector *V, fmatrix3x3 *S)
 {
 	unsigned int i=0;
 
-	for(i=0;i<S[0].vcount;i++)
+	for (i=0;i<S[0].vcount;i++)
 	{
 		mul_fvector_fmatrix(V[S[i].r], V[S[i].r], S[i].m);
 	}
@@ -937,7 +936,7 @@ static int  cg_filtered(lfVector *ldV, fmatrix3x3 *lA, lfVector *lB, lfVector *z
 	s = dot_lfvector(r, r, numverts);
 	starget = s * sqrt(conjgrad_epsilon);
 
-	while(s>starget && conjgrad_loopcount < conjgrad_looplimit)
+	while (s>starget && conjgrad_loopcount < conjgrad_looplimit)
 	{	
 		// Mul(q,A,d); // q = A*d;
 		mul_bfmatrix_lfvector(q, lA, d);
@@ -979,8 +978,8 @@ DO_INLINE void BuildPPinv(fmatrix3x3 *lA, fmatrix3x3 *P, fmatrix3x3 *Pinv)
 	unsigned int i = 0;
 	
 	// Take only the diagonal blocks of A
-// #pragma omp parallel for private(i) if(lA[0].vcount > CLOTH_OPENMP_LIMIT)
-	for(i = 0; i<lA[0].vcount; i++)
+// #pragma omp parallel for private(i) if (lA[0].vcount > CLOTH_OPENMP_LIMIT)
+	for (i = 0; i<lA[0].vcount; i++)
 	{
 		// block diagonalizer
 		cp_fmatrix(P[i].m, lA[i].m);
@@ -1218,7 +1217,7 @@ DO_INLINE void dfdx_damp(float to[3][3],  float dir[3],float length,const float
 	// 	return (I-outerprod(dir,dir)) * (-damping * -(dot(dir,vel)/Max(length,rest)));
 	mul_fvectorT_fvector(to, dir, dir);
 	sub_fmatrix_fmatrix(to, I, to);
-	mul_fmatrix_S(to,  (-damping * -(INPR(dir,vel)/MAX2(length,rest)))); 
+	mul_fmatrix_S(to,  (-damping * -(dot_v3v3(dir,vel)/MAX2(length,rest))));
 
 }
 
@@ -1244,25 +1243,25 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
 
 	int no_compress = clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_NO_SPRING_COMPRESS;
 	
-	VECCOPY(s->f, nullf);
+	copy_v3_v3(s->f, nullf);
 	cp_fmatrix(s->dfdx, nulldfdx);
 	cp_fmatrix(s->dfdv, nulldfdx);
 
 	// calculate elonglation
-	VECSUB(extent, X[s->kl], X[s->ij]);
-	VECSUB(vel, V[s->kl], V[s->ij]);
-	dot = INPR(extent, extent);
+	sub_v3_v3v3(extent, X[s->kl], X[s->ij]);
+	sub_v3_v3v3(vel, V[s->kl], V[s->ij]);
+	dot = dot_v3v3(extent, extent);
 	length = sqrt(dot);
 	
 	s->flags &= ~CLOTH_SPRING_FLAG_NEEDED;
 	
-	if(length > ALMOST_ZERO)
+	if (length > ALMOST_ZERO)
 	{
 		/*
-		if(length>L)
+		if (length>L)
 		{
-		if((clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED) 
-		&& ((((length-L)*100.0f/L) > clmd->sim_parms->maxspringlen))) // cut spring!
+		if ((clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED) &&
+		    ((((length-L)*100.0f/L) > clmd->sim_parms->maxspringlen))) // cut spring!
 		{
 		s->flags |= CSPRING_FLAG_DEACTIVATE;
 		return;
@@ -1277,9 +1276,9 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
 	}
 	
 	// calculate force of structural + shear springs
-	if((s->type & CLOTH_SPRING_TYPE_STRUCTURAL) || (s->type & CLOTH_SPRING_TYPE_SHEAR))
+	if ((s->type & CLOTH_SPRING_TYPE_STRUCTURAL) || (s->type & CLOTH_SPRING_TYPE_SHEAR))
 	{
-		if(length > L || no_compress)
+		if (length > L || no_compress)
 		{
 			s->flags |= CLOTH_SPRING_FLAG_NEEDED;
 			
@@ -1296,7 +1295,7 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
 
 			// Ascher & Boxman, p.21: Damping only during elonglation
 			// something wrong with it...
-			mul_fvector_S(damping_force, dir, clmd->sim_parms->Cdis * INPR(vel,dir));
+			mul_fvector_S(damping_force, dir, clmd->sim_parms->Cdis * dot_v3v3(vel, dir));
 			VECADD(s->f, s->f, damping_force);
 			
 			/* VERIFIED */
@@ -1307,21 +1306,20 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
 			
 		}
 	}
-	else if(s->type & CLOTH_SPRING_TYPE_GOAL)
-	{
+	else if (s->type & CLOTH_SPRING_TYPE_GOAL) {
 		float tvect[3];
 		
 		s->flags |= CLOTH_SPRING_FLAG_NEEDED;
 		
 		// current_position = xold + t * (newposition - xold)
-		VECSUB(tvect, verts[s->ij].xconst, verts[s->ij].xold);
+		sub_v3_v3v3(tvect, verts[s->ij].xconst, verts[s->ij].xold);
 		mul_fvector_S(tvect, tvect, time);
 		VECADD(tvect, tvect, verts[s->ij].xold);
 
-		VECSUB(extent, X[s->ij], tvect);
+		sub_v3_v3v3(extent, X[s->ij], tvect);
 		
 		// SEE MSG BELOW (these are UNUSED)
-		// dot = INPR(extent, extent);
+		// dot = dot_v3v3(extent, extent);
 		// length = sqrt(dot);
 		
 		k = clmd->sim_parms->goalspring;
@@ -1332,7 +1330,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 * INPR(vel,dir));
+		mul_fvector_S(damping_force, dir, clmd->sim_parms->goalfrict * 0.01 * dot_v3v3(vel, dir));
 		VECADD(s->f, s->f, damping_force);
 		
 		// HERE IS THE PROBLEM!!!!
@@ -1341,7 +1339,7 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
 	}
 	else // calculate force of bending springs
 	{
-		if(length < L)
+		if (length < L)
 		{
 			s->flags |= CLOTH_SPRING_FLAG_NEEDED;
 			
@@ -1360,9 +1358,9 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
 
 DO_INLINE void cloth_apply_spring_force(ClothModifierData *UNUSED(clmd), ClothSpring *s, lfVector *lF, lfVector *UNUSED(X), lfVector *UNUSED(V), fmatrix3x3 *dFdV, fmatrix3x3 *dFdX)
 {
-	if(s->flags & CLOTH_SPRING_FLAG_NEEDED)
+	if (s->flags & CLOTH_SPRING_FLAG_NEEDED)
 	{
-		if(!(s->type & CLOTH_SPRING_TYPE_BENDING))
+		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);
@@ -1371,8 +1369,8 @@ DO_INLINE void cloth_apply_spring_force(ClothModifierData *UNUSED(clmd), ClothSp
 
 		VECADD(lF[s->ij], lF[s->ij], s->f);
 		
-		if(!(s->type & CLOTH_SPRING_TYPE_GOAL))
-			VECSUB(lF[s->kl], lF[s->kl], s->f);
+		if (!(s->type & CLOTH_SPRING_TYPE_GOAL))
+			sub_v3_v3v3(lF[s->kl], lF[s->kl], s->f);
 		
 		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);
@@ -1416,19 +1414,19 @@ static void CalcFloat4( float *v1, float *v2, float *v3, float *v4, float *n)
 
 static float calculateVertexWindForce(float wind[3], float vertexnormal[3])  
 {
-	return (INPR(wind, vertexnormal));
+	return dot_v3v3(wind, vertexnormal);
 }
 
 typedef struct HairGridVert {
 	float velocity[3];
 	float density;
 } HairGridVert;
-#define HAIR_GRID_INDEX(vec, min, max, axis) (int)( (vec[axis] - min[axis]) / (max[axis] - min[axis]) * 9.99f );
+#define HAIR_GRID_INDEX(vec, min, max, axis) (int)((vec[axis] - min[axis]) / (max[axis] - min[axis]) * 9.99f)
 /* Smoothing of hair velocities:
  * adapted from
-		Volumetric Methods for Simulation and Rendering of Hair
-		by Lena Petrovic, Mark Henne and John Anderson
- *		Pixar Technical Memo #06-08, Pixar Animation Studios
+ *      Volumetric Methods for Simulation and Rendering of Hair
+ *      by Lena Petrovic, Mark Henne and John Anderson
+ *      Pixar Technical Memo #06-08, Pixar Animation Studios
  */
 static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVector *lX, lfVector *lV, unsigned int numverts)
 {
@@ -1453,13 +1451,13 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec
 
 	INIT_MINMAX(gmin, gmax);
 
-	for(i = 0; i < numverts; i++)
+	for (i = 0; i < numverts; i++)
 		DO_MINMAX(lX[i], gmin, gmax);
 
 	/* initialize grid */
-	for(i = 0; i < 10; i++) {
-		for(j = 0; j < 10; j++) {
-			for(k = 0; k < 10; k++) {
+	for (i = 0; i < 10; i++) {
+		for (j = 0; j < 10; j++) {
+			for (k = 0; k < 10; k++) {
 				grid[i][j][k].velocity[0] = 0.0f;
 				grid[i][j][k].velocity[1] = 0.0f;
 				grid[i][j][k].velocity[2] = 0.0f;
@@ -1474,7 +1472,7 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec
 	}
 
 	/* gather velocities & density */
-	if(smoothfac > 0.0f) for(v = 0; v < numverts; v++) {
+	if (smoothfac > 0.0f) for (v = 0; v < numverts; v++) {
 		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);
@@ -1488,23 +1486,23 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec
 	}
 
 	/* gather colliders */
-	if(colliders && collfac > 0.0f) for(col = colliders->first; col; col = col->next)
+	if (colliders && collfac > 0.0f) for (col = colliders->first; col; col = col->next)
 	{
 		MVert *loc0 = col->collmd->x;
 		MVert *loc1 = col->collmd->xnew;
 		float vel[3];
 
-		for(v=0; v<col->collmd->numverts; v++, loc0++, loc1++) {
+		for (v=0; v<col->collmd->numverts; v++, loc0++, loc1++) {
 			i = HAIR_GRID_INDEX(loc1->co, gmin, gmax, 0);
 
-			if(i>=0 && i<10) {
+			if (i>=0 && i<10) {
 				j = HAIR_GRID_INDEX(loc1->co, gmin, gmax, 1);
 
-				if(j>=0 && j<10) {
+				if (j>=0 && j<10) {
 					k = HAIR_GRID_INDEX(loc1->co, gmin, gmax, 2);
 
-					if(k>=0 && k<10) {
-						VECSUB(vel, loc1->co, loc0->co);
+					if (k>=0 && k<10) {
+						sub_v3_v3v3(vel, loc1->co, loc0->co);
 
 						colg[i][j][k].velocity[0] += vel[0];
 						colg[i][j][k].velocity[1] += vel[1];
@@ -1518,18 +1516,18 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec
 	
 
 	/* divide velocity with density */
-	for(i = 0; i < 10; i++) {
-		for(j = 0; j < 10; j++) {
-			for(k = 0; k < 10; k++) {
+	for (i = 0; i < 10; i++) {
+		for (j = 0; j < 10; j++) {
+			for (k = 0; k < 10; k++) {
 				density = grid[i][j][k].density;
-				if(density > 0.0f) {
+				if (density > 0.0f) {
 					grid[i][j][k].velocity[0] /= density;
 					grid[i][j][k].velocity[1] /= density;
 					grid[i][j][k].velocity[2] /= density;
 				}
 
 				density = colg[i][j][k].density;
-				if(density > 0.0f) {
+				if (density > 0.0f) {
 					colg[i][j][k].velocity[0] /= density;
 					colg[i][j][k].velocity[1] /= density;
 					colg[i][j][k].velocity[2] /= density;
@@ -1539,7 +1537,7 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec
 	}
 
 	/* calculate forces */
-	for(v = 0; v < numverts; v++) {
+	for (v = 0; v < numverts; v++) {
 		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);
@@ -1550,7 +1548,7 @@ static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVec
 		lF[v][1] += smoothfac * (grid[i][j][k].velocity[1] - lV[v][1]);
 		lF[v][2] += smoothfac * (grid[i][j][k].velocity[2] - lV[v][2]);
 
-		if(colg[i][j][k].density > 0.0f) {
+		if (colg[i][j][k].density > 0.0f) {
 			lF[v][0] += collfac * (colg[i][j][k].velocity[0] - lV[v][0]);
 			lF[v][1] += collfac * (colg[i][j][k].velocity[1] - lV[v][1]);
 			lF[v][2] += collfac * (colg[i][j][k].velocity[2] - lV[v][2]);
@@ -1577,8 +1575,8 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
 	tm2[0][0]= tm2[1][1]= tm2[2][2]= -spring_air;
 	
 	/* global acceleration (gravitation) */
-	if(clmd->scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) {
-		VECCOPY(gravity, clmd->scene->physics_settings.gravity);
+	if (clmd->scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) {
+		copy_v3_v3(gravity, clmd->scene->physics_settings.gravity);
 		mul_fvector_S(gravity, gravity, 0.001f * clmd->sim_parms->effector_weights->global_gravity); /* scale gravity force */
 	}
 
@@ -1589,38 +1587,38 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
 
 	init_lfvector(lF, gravity, numverts);
 	
-	if(clmd->sim_parms->velocity_smooth > 0.0f || clmd->sim_parms->collider_friction > 0.0f)
+	if (clmd->sim_parms->velocity_smooth > 0.0f || clmd->sim_parms->collider_friction > 0.0f)
 		hair_velocity_smoothing(clmd, lF, lX, lV, numverts);
 
 	/* multiply lF with mass matrix
-	// force = mass * acceleration (in this case: gravity)
-	*/
-	for(i = 0; i < numverts; i++)
+	 * force = mass * acceleration (in this case: gravity)
+	 */
+	for (i = 0; i < numverts; i++)
 	{
 		float temp[3];
-		VECCOPY(temp, lF[i]);
+		copy_v3_v3(temp, lF[i]);
 		mul_fmatrix_fvector(lF[i], M[i].m, temp);
 	}
 
 	submul_lfvectorS(lF, lV, spring_air, numverts);
 	
 	/* handle external forces like wind */
-	if(effectors)
+	if (effectors)
 	{	
 		// 0 = force, 1 = normalized force
 		winvec = create_lfvector(cloth->numverts);
 		
-		if(!winvec)
+		if (!winvec)
 			printf("winvec: out of memory in implicit.c\n");
 		
 		// precalculate wind forces
-		for(i = 0; i < cloth->numverts; i++)
+		for (i = 0; i < cloth->numverts; i++)
 		{	
 			pd_point_from_loc(clmd->scene, (float*)lX[i], (float*)lV[i], i, &epoint);
 			pdDoEffectors(effectors, NULL, clmd->sim_parms->effector_weights, &epoint, winvec[i], NULL);
 		}
 		
-		for(i = 0; i < cloth->numfaces; i++)
+		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
@@ -1629,7 +1627,7 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
 			factor *= 0.02;
 			
 			// calculate face normal
-			if(mfaces[i].v4)
+			if (mfaces[i].v4)
 				CalcFloat4(lX[mfaces[i].v1],lX[mfaces[i].v2],lX[mfaces[i].v3],lX[mfaces[i].v4],triunnormal);
 			else
 				CalcFloat(lX[mfaces[i].v1],lX[mfaces[i].v2],lX[mfaces[i].v3],triunnormal);
@@ -1637,31 +1635,31 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
 			normalize_v3_v3(trinormal, triunnormal);
 			
 			// add wind from v1
-			VECCOPY(tmp, trinormal);
+			copy_v3_v3(tmp, trinormal);
 			mul_v3_fl(tmp, calculateVertexWindForce(winvec[mfaces[i].v1], triunnormal));
 			VECADDS(lF[mfaces[i].v1], lF[mfaces[i].v1], tmp, factor);
 			
 			// add wind from v2
-			VECCOPY(tmp, trinormal);
+			copy_v3_v3(tmp, trinormal);
 			mul_v3_fl(tmp, calculateVertexWindForce(winvec[mfaces[i].v2], triunnormal));
 			VECADDS(lF[mfaces[i].v2], lF[mfaces[i].v2], tmp, factor);
 			
 			// add wind from v3
-			VECCOPY(tmp, trinormal);
+			copy_v3_v3(tmp, trinormal);
 			mul_v3_fl(tmp, calculateVertexWindForce(winvec[mfaces[i].v3], triunnormal));
 			VECADDS(lF[mfaces[i].v3], lF[mfaces[i].v3], tmp, factor);
 			
 			// add wind from v4
-			if(mfaces[i].v4)
+			if (mfaces[i].v4)
 			{
-				VECCOPY(tmp, trinormal);
+				copy_v3_v3(tmp, trinormal);
 				mul_v3_fl(tmp, calculateVertexWindForce(winvec[mfaces[i].v4], triunnormal));
 				VECADDS(lF[mfaces[i].v4], lF[mfaces[i].v4], tmp, factor);
 			}
 		}
 
 		/* Hair has only edges */
-		if(cloth->numfaces == 0) {
+		if (cloth->numfaces == 0) {
 			ClothSpring *spring;
 			float edgevec[3]={0,0,0}; //edge vector
 			float edgeunnormal[3]={0,0,0}; // not-normalized-edge normal
@@ -1669,19 +1667,19 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
 			float factor = 0.01;
 
 			search = cloth->springs;
-			while(search) {
+			while (search) {
 				spring = search->link;
 				
-				if(spring->type == CLOTH_SPRING_TYPE_STRUCTURAL) {
-					VECSUB(edgevec, (float*)lX[spring->ij], (float*)lX[spring->kl]);
+				if (spring->type == CLOTH_SPRING_TYPE_STRUCTURAL) {
+					sub_v3_v3v3(edgevec, (float*)lX[spring->ij], (float*)lX[spring->kl]);
 
 					project_v3_v3v3(tmp, winvec[spring->ij], edgevec);
-					VECSUB(edgeunnormal, winvec[spring->ij], tmp);
+					sub_v3_v3v3(edgeunnormal, winvec[spring->ij], tmp);
 					/* hair doesn't stretch too much so we can use restlen pretty safely */
 					VECADDS(lF[spring->ij], lF[spring->ij], edgeunnormal, spring->restlen * factor);
 
 					project_v3_v3v3(tmp, winvec[spring->kl], edgevec);
-					VECSUB(edgeunnormal, winvec[spring->kl], tmp);
+					sub_v3_v3v3(edgeunnormal, winvec[spring->kl], tmp);
 					VECADDS(lF[spring->kl], lF[spring->kl], edgeunnormal, spring->restlen * factor);
 				}
 
@@ -1694,10 +1692,10 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
 		
 	// calculate spring forces
 	search = cloth->springs;
-	while(search)
+	while (search)
 	{
 		// only handle active springs
-		// if(((clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED) && !(springs[i].flags & CSPRING_FLAG_DEACTIVATE))|| !(clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED)){}
+		// if (((clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED) && !(springs[i].flags & CSPRING_FLAG_DEACTIVATE))|| !(clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED)) {}
 		cloth_calc_spring_force(clmd, search->link, lF, lX, lV, dFdV, dFdX, time);
 
 		search = search->next;
@@ -1705,10 +1703,10 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
 	
 	// apply spring forces
 	search = cloth->springs;
-	while(search)
+	while (search)
 	{
 		// only handle active springs
-		// if(((clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED) && !(springs[i].flags & CSPRING_FLAG_DEACTIVATE))|| !(clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED))	
+		// if (((clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED) && !(springs[i].flags & CSPRING_FLAG_DEACTIVATE))|| !(clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED))	
 		cloth_apply_spring_force(clmd, search->link, lF, lX, lV, dFdV, dFdX);
 		search = search->next;
 	}
@@ -1747,10 +1745,10 @@ static void simulate_implicit_euler(lfVector *Vnew, lfVector *UNUSED(lX), lfVect
 	del_lfvector(dFdXmV);
 }
 
-/*computes where the cloth would be if it were subject to perfectly stiff edges
-  (edge distance constraints) in a lagrangian solver.  then add forces to help
-  guide the implicit solver to that state.  this function is called after
-  collisions*/
+/* computes where the cloth would be if it were subject to perfectly stiff edges
+ * (edge distance constraints) in a lagrangian solver.  then add forces to help
+ * guide the implicit solver to that state.  this function is called after
+ * collisions*/
 int cloth_calc_helper_forces(Object *UNUSED(ob), ClothModifierData * clmd, float (*initial_cos)[3], float UNUSED(step), float dt)
 {
 	Cloth *cloth= clmd->clothObject;
@@ -1767,7 +1765,8 @@ int cloth_calc_helper_forces(Object *UNUSED(ob), ClothModifierData * clmd, float
 		
 		if (cv->goal == 1.0f || len_v3v3(initial_cos[i], cv->tx) != 0.0) {
 			masses[i] = 1e+10;	
-		} else {
+		}
+		else {
 			masses[i] = cv->mass;
 		}
 	}
@@ -1837,20 +1836,20 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
 	Implicit_Data *id = cloth->implicit;
 	int do_extra_solve;
 
-	if(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) /* do goal stuff */
+	if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) /* do goal stuff */
 	{
-		for(i = 0; i < numverts; i++)
+		for (i = 0; i < numverts; i++)
 		{			
 			// update velocities with constrained velocities from pinned verts
-			if(verts [i].flags & CLOTH_VERT_FLAG_PINNED)
+			if (verts [i].flags & CLOTH_VERT_FLAG_PINNED)
 			{			
-				VECSUB(id->V[i], verts[i].xconst, verts[i].xold);
+				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)
+	while (step < tf)
 	{	
 		// damping velocity for artistic reasons
 		mul_lfvectorS(id->V, id->V, clmd->sim_parms->vel_damping, numverts);
@@ -1865,35 +1864,35 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
 		add_lfvector_lfvectorS(id->Xnew, id->X, id->Vnew, dt, numverts);
 		
 		/* move pinned verts to correct position */
-		for(i = 0; i < numverts; i++)
+		for (i = 0; i < numverts; i++)
 		{	
-			if(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) 
+			if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) 
 			{			
-				if(verts [i].flags & CLOTH_VERT_FLAG_PINNED)
+				if (verts [i].flags & CLOTH_VERT_FLAG_PINNED)
 				{			
 					float tvect[3] = {.0,.0,.0};
-					VECSUB(tvect, verts[i].xconst, verts[i].xold);
+					sub_v3_v3v3(tvect, verts[i].xconst, verts[i].xold);
 					mul_fvector_S(tvect, tvect, step+dt);
 					VECADD(tvect, tvect, verts[i].xold);
-					VECCOPY(id->Xnew[i], tvect);
+					copy_v3_v3(id->Xnew[i], tvect);
 				}	
 			}
 			
-			VECCOPY(verts[i].txold, id->X[i]);
+			copy_v3_v3(verts[i].txold, id->X[i]);
 		}
 
-		if(clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_ENABLED && clmd->clothObject->bvhtree)
+		if (clmd->coll_parms->flags & CLOTH_COLLSETTINGS_FLAG_ENABLED && clmd->clothObject->bvhtree)
 		{
 			// collisions 
 			// itstart();
 			
 			// update verts to current positions
-			for(i = 0; i < numverts; i++)
+			for (i = 0; i < numverts; i++)
 			{
-				VECCOPY(verts[i].tx, id->Xnew[i]);
+				copy_v3_v3(verts[i].tx, id->Xnew[i]);
 
-				VECSUB(verts[i].tv, verts[i].tx, verts[i].txold);
-				VECCOPY(verts[i].v, verts[i].tv);
+				sub_v3_v3v3(verts[i].tv, verts[i].tx, verts[i].txold);
+				copy_v3_v3(verts[i].v, verts[i].tv);
 			}
 
 			for (i=0, cv=cloth->verts; i<cloth->numverts; i++, cv++) {
@@ -1905,26 +1904,26 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
 			do_extra_solve = cloth_bvh_objcollision(ob, clmd, step/clmd->sim_parms->timescale, dt/clmd->sim_parms->timescale);
 						
 			// copy corrected positions back to simulation
-			for(i = 0; i < numverts; i++)
+			for (i = 0; i < numverts; i++)
 			{		
 				// correct velocity again, just to be sure we had to change it due to adaptive collisions
-				VECSUB(verts[i].tv, verts[i].tx, id->X[i]);
+				sub_v3_v3v3(verts[i].tv, verts[i].tx, id->X[i]);
 			}
 
 			//if (do_extra_solve)
 			//	cloth_calc_helper_forces(ob, clmd, initial_cos, step/clmd->sim_parms->timescale, dt/clmd->sim_parms->timescale);
 			
-			for(i = 0; i < numverts; i++)
+			for (i = 0; i < numverts; i++)
 			{		
 
-				if(do_extra_solve)
+				if (do_extra_solve)
 				{
 					
-					if((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) && (verts [i].flags & CLOTH_VERT_FLAG_PINNED))
+					if ((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) && (verts [i].flags & CLOTH_VERT_FLAG_PINNED))
 						continue;
 
-					VECCOPY(id->Xnew[i], verts[i].tx);
-					VECCOPY(id->Vnew[i], verts[i].tv);
+					copy_v3_v3(id->Xnew[i], verts[i].tx);
+					copy_v3_v3(id->Vnew[i], verts[i].tv);
 					mul_v3_fl(id->Vnew[i], spf);
 				}
 			}
@@ -1934,7 +1933,7 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
 
 			// if there were collisions, advance the velocity from v_n+1/2 to v_n+1
 			
-			if(do_extra_solve)
+			if (do_extra_solve)
 			{
 				// V = Vnew;
 				cp_lfvector(id->V, id->Vnew, numverts);
@@ -1960,19 +1959,19 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
 		step += dt;
 	}
 
-	for(i = 0; i < numverts; i++)
+	for (i = 0; i < numverts; i++)
 	{				
-		if((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) && (verts [i].flags & CLOTH_VERT_FLAG_PINNED))
+		if ((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) && (verts [i].flags & CLOTH_VERT_FLAG_PINNED))
 		{
-			VECCOPY(verts[i].txold, verts[i].xconst); // TODO: test --> should be .x 
-			VECCOPY(verts[i].x, verts[i].xconst);
-			VECCOPY(verts[i].v, id->V[i]);
+			copy_v3_v3(verts[i].txold, verts[i].xconst); // TODO: test --> should be .x
+			copy_v3_v3(verts[i].x, verts[i].xconst);
+			copy_v3_v3(verts[i].v, id->V[i]);
 		}
 		else
 		{
-			VECCOPY(verts[i].txold, id->X[i]);
-			VECCOPY(verts[i].x, id->X[i]);
-			VECCOPY(verts[i].v, id->V[i]);
+			copy_v3_v3(verts[i].txold, id->X[i]);
+			copy_v3_v3(verts[i].x, id->X[i]);
+			copy_v3_v3(verts[i].v, id->V[i]);
 		}
 	}
 	
@@ -1988,12 +1987,12 @@ void implicit_set_positions (ClothModifierData *clmd)
 	unsigned int numverts = cloth->numverts, i;
 	Implicit_Data *id = cloth->implicit;
 	
-	for(i = 0; i < numverts; i++)
+	for (i = 0; i < numverts; i++)
 	{				
-		VECCOPY(id->X[i], verts[i].x);
-		VECCOPY(id->V[i], verts[i].v);
+		copy_v3_v3(id->X[i], verts[i].x);
+		copy_v3_v3(id->V[i], verts[i].v);
 	}
-	if(G.rt > 0)
+	if (G.rt > 0)
 		printf("implicit_set_positions\n");	
 }
 
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 40fe362..2fd1d29 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -97,8 +97,8 @@ void free_ipo (Ipo *ipo)
 		BLI_freelinkN(&ipo->curve, icu);
 	}
 	
-	if (G.f & G_DEBUG)
-		printf("Freed %d (Unconverted) Ipo-Curves from IPO '%s' \n", n, ipo->id.name+2);
+	if (G.debug & G_DEBUG)
+		printf("Freed %d (Unconverted) Ipo-Curves from IPO '%s'\n", n, ipo->id.name+2);
 }
 
 /* *************************************************** */
@@ -296,7 +296,7 @@ static const char *pchan_adrcodes_to_paths (int adrcode, int *array_index)
 	}
 	
 	/* for debugging only */
-	printf("ERROR: unmatched PoseChannel setting (code %d) \n", adrcode);
+	printf("ERROR: unmatched PoseChannel setting (code %d)\n", adrcode);
 	return NULL;
 }
 
@@ -325,12 +325,15 @@ static char *shapekey_adrcodes_to_paths (int adrcode, int *UNUSED(array_index))
 {
 	static char buf[128];
 	
-	/* block will be attached to ID_KE block, and setting that we alter is the 'value' (which sets keyblock.curval) */
-	// XXX adrcode 0 was dummy 'speed' curve 
-	if (adrcode == 0) 
-		strcpy(buf, "speed");
-	else
+	/* block will be attached to ID_KE block... */
+	if (adrcode == 0) {
+		/* adrcode=0 was the misnamed "speed" curve (now "evaluation time") */
+		BLI_strncpy(buf, "eval_time", sizeof(buf));
+	}
+	else {
+		/* setting that we alter is the "value" (i.e. keyblock.curval) */
 		BLI_snprintf(buf, sizeof(buf), "key_blocks[%d].value", adrcode);
+	}
 	return buf;
 }
 
@@ -663,8 +666,10 @@ static const char *sound_adrcodes_to_paths (int adrcode, int *array_index)
 		case SND_PITCH:
 			return "pitch";
 	/* XXX Joshua -- I had wrapped panning in rna, but someone commented out, calling it "unused" */
-	/*	case SND_PANNING:
-			return "panning"; */
+#if 0
+		case SND_PANNING:
+			return "panning";
+#endif
 		case SND_ATTEN:
 			return "attenuation";
 	}
@@ -762,11 +767,12 @@ static const char *particle_adrcodes_to_paths (int adrcode, int *array_index)
 			return "settings.billboard_tilt";
 		
 		/* PartDeflect needs to be sorted out properly in rna_object_force;
-		   If anyone else works on this, but is unfamiliar, these particular
-			settings reference the particles of the system themselves
-			being used as forces -- it will use the same rna structure
-			as the similar object forces				*/
-		/*case PART_PD_FSTR:
+		 * If anyone else works on this, but is unfamiliar, these particular
+		 * settings reference the particles of the system themselves
+		 * being used as forces -- it will use the same rna structure
+		 * as the similar object forces */
+#if 0
+		case PART_PD_FSTR:
 			if (part->pd) poin= &(part->pd->f_strength);
 			break;
 		case PART_PD_FFALL:
@@ -783,11 +789,12 @@ static const char *particle_adrcodes_to_paths (int adrcode, int *array_index)
 			break;
 		case PART_PD2_FMAXD:
 			if (part->pd2) poin= &(part->pd2->maxdist);
-			break;*/
+			break;
+#endif
 
-		}
-		
-	return NULL;	
+	}
+
+	return NULL;
 }
 
 /* ------- */
@@ -889,7 +896,7 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co
 			
 		// TODO... add other blocktypes...
 		default:
-			printf("IPO2ANIMATO WARNING: No path for blocktype %d, adrcode %d yet \n", blocktype, adrcode);
+			printf("IPO2ANIMATO WARNING: No path for blocktype %d, adrcode %d yet\n", blocktype, adrcode);
 			break;
 	}
 	
@@ -1098,24 +1105,22 @@ static void fcurve_add_to_list (ListBase *groups, ListBase *list, FCurve *fcu, c
 		
 		/* get the group to use */
 		agrp= action_groups_find_named(&tmp_act, grpname);
+		/* no matching group, so add one */
 		if (agrp == NULL) {
-			/* no matching group, so add one */
-			if (agrp == NULL) {
-				/* Add a new group, and make it active */
-				agrp= MEM_callocN(sizeof(bActionGroup), "bActionGroup");
-				
-				agrp->flag = AGRP_SELECTED;
-				if (muteipo) agrp->flag |= AGRP_MUTED;
-				
-				BLI_strncpy(agrp->name, grpname, sizeof(agrp->name));
-				
-				BLI_addtail(&tmp_act.groups, agrp);
-				BLI_uniquename(&tmp_act.groups, agrp, "Group", '.', offsetof(bActionGroup, name), sizeof(agrp->name));
-			}
+			/* Add a new group, and make it active */
+			agrp= MEM_callocN(sizeof(bActionGroup), "bActionGroup");
+
+			agrp->flag = AGRP_SELECTED;
+			if (muteipo) agrp->flag |= AGRP_MUTED;
+
+			BLI_strncpy(agrp->name, grpname, sizeof(agrp->name));
+
+			BLI_addtail(&tmp_act.groups, agrp);
+			BLI_uniquename(&tmp_act.groups, agrp, "Group", '.', offsetof(bActionGroup, name), sizeof(agrp->name));
 		}
 		
 		/* add F-Curve to group */
-		/* WARNING: this func should only need to look at the stuff we initialised, if not, things may crash */
+		/* WARNING: this func should only need to look at the stuff we initialized, if not, things may crash */
 		action_groups_add_channel(&tmp_act, agrp, fcu);
 		
 		if (agrp->flag & AGRP_MUTED) /* flush down */
@@ -1173,7 +1178,7 @@ static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve *
 		case IPO_CYCLX: /* cyclic extrapolation + offset */
 		{
 			/* Add a new FModifier (Cyclic) instead of setting extend value 
-			 * as that's the new equivilant of that option. 
+			 * as that's the new equivalent of that option.
 			 */
 			FModifier *fcm= add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_CYCLES);
 			FMod_Cycles *data= (FMod_Cycles *)fcm->data;
@@ -1195,7 +1200,7 @@ static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve *
 		FCurve *fcurve;
 		int b;
 		
-		if (G.f & G_DEBUG) printf("\tconvert bitflag ipocurve, totbits = %d \n", totbits);
+		if (G.debug & G_DEBUG) printf("\tconvert bitflag ipocurve, totbits = %d\n", totbits);
 		
 		/* add the 'only int values' flag */
 		fcu->flag |= (FCURVE_INT_VALUES|FCURVE_DISCRETE_VALUES);		
@@ -1392,7 +1397,7 @@ static void ipo_to_animato (ID *id, Ipo *ipo, char actname[], char constname[],
 	if (ELEM3(NULL, ipo, anim, drivers))
 		return;
 		
-	if (G.f & G_DEBUG) printf("ipo_to_animato \n");
+	if (G.debug & G_DEBUG) printf("ipo_to_animato\n");
 		
 	/* validate actname and constname 
 	 *	- clear actname if it was one of the generic <builtin> ones (i.e. 'Object', or 'Shapes')
@@ -1514,15 +1519,15 @@ static void ipo_to_animdata (ID *id, Ipo *ipo, char actname[], char constname[],
 	ListBase drivers = {NULL, NULL};
 	
 	/* sanity check */
-	if ELEM(NULL, id, ipo)
+	if (ELEM(NULL, id, ipo))
 		return;
 	if (adt == NULL) {
-		printf("ERROR ipo_to_animdata(): adt invalid \n");
+		printf("ERROR ipo_to_animdata(): adt invalid\n");
 		return;
 	}
 	
-	if (G.f & G_DEBUG) {
-		printf("ipo to animdata - ID:%s, IPO:%s, actname:%s constname:%s seqname:%s  curves:%d \n", 
+	if (G.debug & G_DEBUG) {
+		printf("ipo to animdata - ID:%s, IPO:%s, actname:%s constname:%s seqname:%s  curves:%d\n",
 		       id->name+2, ipo->id.name+2, (actname)?actname:"<None>", (constname)?constname:"<None>", (seq)?(seq->name+2):"<None>",
 			BLI_countlist(&ipo->curve));
 	}
@@ -1535,7 +1540,7 @@ static void ipo_to_animdata (ID *id, Ipo *ipo, char actname[], char constname[],
 	
 	/* deal with animation first */
 	if (anim.first) {
-		if (G.f & G_DEBUG) printf("\thas anim \n");
+		if (G.debug & G_DEBUG) printf("\thas anim\n");
 		/* try to get action */
 		if (adt->action == NULL) {
 			char nameBuf[MAX_ID_NAME];
@@ -1543,7 +1548,7 @@ static void ipo_to_animdata (ID *id, Ipo *ipo, char actname[], char constname[],
 			BLI_snprintf(nameBuf, sizeof(nameBuf), "CDA:%s", ipo->id.name+2);
 			
 			adt->action= add_empty_action(nameBuf);
-			if (G.f & G_DEBUG) printf("\t\tadded new action - '%s' \n", nameBuf);
+			if (G.debug & G_DEBUG) printf("\t\tadded new action - '%s'\n", nameBuf);
 		}
 		
 		/* add F-Curves to action */
@@ -1552,7 +1557,7 @@ static void ipo_to_animdata (ID *id, Ipo *ipo, char actname[], char constname[],
 	
 	/* deal with drivers */
 	if (drivers.first) {
-		if (G.f & G_DEBUG) printf("\thas drivers \n");
+		if (G.debug & G_DEBUG) printf("\thas drivers\n");
 		/* add drivers to end of driver stack */
 		BLI_movelisttolist(&adt->drivers, &drivers);
 	}
@@ -1572,7 +1577,7 @@ static void action_to_animdata (ID *id, bAction *act)
 	/* check if we need to set this Action as the AnimData's action */
 	if (adt->action == NULL) {
 		/* set this Action as AnimData's Action */
-		if (G.f & G_DEBUG) printf("act_to_adt - set adt action to act \n");
+		if (G.debug & G_DEBUG) printf("act_to_adt - set adt action to act\n");
 		adt->action= act;
 	}
 	
@@ -1681,17 +1686,17 @@ void do_versions_ipos_to_animato(Main *main)
 	ID *id;
 	
 	if (main == NULL) {
-		printf("Argh! Main is NULL in do_versions_ipos_to_animato() \n");
+		printf("Argh! Main is NULL in do_versions_ipos_to_animato()\n");
 		return;
 	}
 		
 	/* only convert if version is right */
 	if (main->versionfile >= 250) {
-		printf("WARNING: Animation data too new to convert (Version %d) \n", main->versionfile);
+		printf("WARNING: Animation data too new to convert (Version %d)\n", main->versionfile);
 		return;
 	}
-	else if (G.f & G_DEBUG)
-		printf("INFO: Converting to Animato... \n");
+	else if (G.debug & G_DEBUG)
+		printf("INFO: Converting to Animato...\n");
 		
 	/* ----------- Animation Attached to Data -------------- */
 	
@@ -1702,7 +1707,7 @@ void do_versions_ipos_to_animato(Main *main)
 		bConstraint *con;
 		bConstraintChannel *conchan, *conchann;
 		
-		if (G.f & G_DEBUG) printf("\tconverting ob %s \n", id->name+2);
+		if (G.debug & G_DEBUG) printf("\tconverting ob %s\n", id->name+2);
 		
 		/* check if object has any animation data */
 		if (ob->nlastrips.first) {
@@ -1827,7 +1832,7 @@ void do_versions_ipos_to_animato(Main *main)
 	for (id= main->key.first; id; id= id->next) {
 		Key *key= (Key *)id;
 		
-		if (G.f & G_DEBUG) printf("\tconverting key %s \n", id->name+2);
+		if (G.debug & G_DEBUG) printf("\tconverting key %s\n", id->name+2);
 		
 		/* we're only interested in the IPO 
 		 * NOTE: for later, it might be good to port these over to Object instead, as many of these
@@ -1852,7 +1857,7 @@ void do_versions_ipos_to_animato(Main *main)
 	for (id= main->mat.first; id; id= id->next) {
 		Material *ma= (Material *)id;
 		
-		if (G.f & G_DEBUG) printf("\tconverting material %s \n", id->name+2);
+		if (G.debug & G_DEBUG) printf("\tconverting material %s\n", id->name+2);
 		
 		/* we're only interested in the IPO */
 		if (ma->ipo) {
@@ -1874,7 +1879,7 @@ void do_versions_ipos_to_animato(Main *main)
 	for (id= main->world.first; id; id= id->next) {
 		World *wo= (World *)id;
 		
-		if (G.f & G_DEBUG) printf("\tconverting world %s \n", id->name+2);
+		if (G.debug & G_DEBUG) printf("\tconverting world %s\n", id->name+2);
 		
 		/* we're only interested in the IPO */
 		if (wo->ipo) {
@@ -1905,8 +1910,8 @@ void do_versions_ipos_to_animato(Main *main)
 				IpoCurve *icu = (seq->ipo) ? seq->ipo->curve.first : NULL;
 				short adrcode = SEQ_FAC1;
 				
-				if (G.f & G_DEBUG) 
-					printf("\tconverting sequence strip %s \n", seq->name+2);
+				if (G.debug & G_DEBUG)
+					printf("\tconverting sequence strip %s\n", seq->name+2);
 				
 				if (ELEM(NULL, seq->ipo, icu)) {
 					seq->flag |= SEQ_USE_EFFECT_DEFAULT_FADE;
@@ -1914,9 +1919,9 @@ void do_versions_ipos_to_animato(Main *main)
 				}
 				
 				/* patch adrcode, so that we can map
-				   to different DNA variables later 
-				   (semi-hack (tm) )
-				*/
+				 * to different DNA variables later 
+				 * (semi-hack (tm) )
+				 */
 				switch (seq->type) {
 					case SEQ_IMAGE:
 					case SEQ_META:
@@ -1949,7 +1954,7 @@ void do_versions_ipos_to_animato(Main *main)
 	for (id= main->tex.first; id; id= id->next) {
 		Tex *te= (Tex *)id;
 		
-		if (G.f & G_DEBUG) printf("\tconverting texture %s \n", id->name+2);
+		if (G.debug & G_DEBUG) printf("\tconverting texture %s\n", id->name+2);
 		
 		/* we're only interested in the IPO */
 		if (te->ipo) {
@@ -1971,7 +1976,7 @@ void do_versions_ipos_to_animato(Main *main)
 	for (id= main->camera.first; id; id= id->next) {
 		Camera *ca= (Camera *)id;
 		
-		if (G.f & G_DEBUG) printf("\tconverting camera %s \n", id->name+2);
+		if (G.debug & G_DEBUG) printf("\tconverting camera %s\n", id->name+2);
 		
 		/* we're only interested in the IPO */
 		if (ca->ipo) {
@@ -1993,7 +1998,7 @@ void do_versions_ipos_to_animato(Main *main)
 	for (id= main->lamp.first; id; id= id->next) {
 		Lamp *la= (Lamp *)id;
 		
-		if (G.f & G_DEBUG) printf("\tconverting lamp %s \n", id->name+2);
+		if (G.debug & G_DEBUG) printf("\tconverting lamp %s\n", id->name+2);
 		
 		/* we're only interested in the IPO */
 		if (la->ipo) {
@@ -2015,7 +2020,7 @@ void do_versions_ipos_to_animato(Main *main)
 	for (id= main->curve.first; id; id= id->next) {
 		Curve *cu= (Curve *)id;
 		
-		if (G.f & G_DEBUG) printf("\tconverting curve %s \n", id->name+2);
+		if (G.debug & G_DEBUG) printf("\tconverting curve %s\n", id->name+2);
 		
 		/* we're only interested in the IPO */
 		if (cu->ipo) {
@@ -2048,7 +2053,7 @@ void do_versions_ipos_to_animato(Main *main)
 	for (id= main->action.first; id; id= id->next) {
 		bAction *act= (bAction *)id;
 		
-		if (G.f & G_DEBUG) printf("\tconverting action %s \n", id->name+2);
+		if (G.debug & G_DEBUG) printf("\tconverting action %s\n", id->name+2);
 		
 		/* if old action, it will be object-only... */
 		if (act->chanbase.first)
@@ -2062,7 +2067,7 @@ void do_versions_ipos_to_animato(Main *main)
 	for (id= main->ipo.first; id; id= id->next) {
 		Ipo *ipo= (Ipo *)id;
 		
-		if (G.f & G_DEBUG) printf("\tconverting ipo %s \n", id->name+2);
+		if (G.debug & G_DEBUG) printf("\tconverting ipo %s\n", id->name+2);
 		
 		/* most likely this IPO has already been processed, so check if any curves left to convert */
 		if (ipo->curve.first) {
@@ -2082,7 +2087,7 @@ void do_versions_ipos_to_animato(Main *main)
 	/* free unused drivers from actions + ipos */
 	free_fcurves(&drivers);
 	
-	if (G.f & G_DEBUG)
-		printf("INFO: Animato convert done \n");
+	if (G.debug & G_DEBUG)
+		printf("INFO: Animato convert done\n");
 }
 
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index b2385a5..0a1c046 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -37,13 +37,13 @@
 #include "MEM_guardedalloc.h"
 
 #include "BLI_blenlib.h"
-#include "BLI_editVert.h"
 #include "BLI_math_vector.h"
 #include "BLI_utildefines.h"
 
 #include "DNA_anim_types.h"
 #include "DNA_key_types.h"
 #include "DNA_lattice_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
@@ -56,6 +56,7 @@
 #include "BKE_key.h"
 #include "BKE_lattice.h"
 #include "BKE_library.h"
+#include "BKE_tessmesh.h"
 #include "BKE_main.h"
 #include "BKE_object.h"
 #include "BKE_deform.h"
@@ -64,16 +65,17 @@
 
 #include "RNA_access.h"
 
-#define KEY_MODE_DUMMY		0 /* use where mode isn't checked for */
-#define KEY_MODE_BPOINT		1
-#define KEY_MODE_BEZTRIPLE	2
+#define KEY_MODE_DUMMY      0 /* use where mode isn't checked for */
+#define KEY_MODE_BPOINT     1
+#define KEY_MODE_BEZTRIPLE  2
 
-	// old defines from DNA_ipo_types.h for data-type
-#define IPO_FLOAT		4
-#define IPO_BEZTRIPLE	100
-#define IPO_BPOINT		101
+/* old defines from DNA_ipo_types.h for data-type, stored in DNA - don't modify! */
+#define IPO_FLOAT       4
+#define IPO_BEZTRIPLE   100
+#define IPO_BPOINT      101
 
-int slurph_opt= 1;
+/* extern, not threadsafe */
+int slurph_opt = 1;
 
 
 void free_key(Key *key)
@@ -82,9 +84,23 @@ void free_key(Key *key)
 	
 	BKE_free_animdata((ID *)key);
 	
-	while( (kb= key->block.first) ) {
+	while ( (kb = key->block.first) ) {
 		
-		if(kb->data) MEM_freeN(kb->data);
+		if (kb->data) MEM_freeN(kb->data);
+		
+		BLI_remlink(&key->block, kb);
+		MEM_freeN(kb);
+	}
+	
+}
+
+void free_key_nolib(Key *key)
+{
+	KeyBlock *kb;
+	
+	while ( (kb = key->block.first) ) {
+		
+		if (kb->data) MEM_freeN(kb->data);
 		
 		BLI_remlink(&key->block, kb);
 		MEM_freeN(kb);
@@ -100,48 +116,55 @@ void free_key(Key *key)
  * well. I expect we'll sort it out soon... */
 
 /* from blendef: */
-#define GS(a)	(*((short *)(a)))
+#define GS(a)   (*((short *)(a)))
 
 /* from misc_util: flip the bytes from x  */
 /*  #define GS(x) (((unsigned char *)(x))[0] << 8 | ((unsigned char *)(x))[1]) */
 
-Key *add_key(ID *id)	/* common function */
+Key *add_key(ID *id)    /* common function */
 {
 	Key *key;
 	char *el;
 	
-	key= alloc_libblock(&G.main->key, ID_KE, "Key");
+	key = alloc_libblock(&G.main->key, ID_KE, "Key");
 	
-	key->type= KEY_NORMAL;
-	key->from= id;
+	key->type = KEY_NORMAL;
+	key->from = id;
+
+	key->uidgen = 1;
 	
-	// XXX the code here uses some defines which will soon be depreceated...
-	if( GS(id->name)==ID_ME) {
-		el= key->elemstr;
-		
-		el[0]= 3;
-		el[1]= IPO_FLOAT;
-		el[2]= 0;
-		
-		key->elemsize= 12;
-	}
-	else if( GS(id->name)==ID_LT) {
-		el= key->elemstr;
-		
-		el[0]= 3;
-		el[1]= IPO_FLOAT;
-		el[2]= 0;
-		
-		key->elemsize= 12;
-	}
-	else if( GS(id->name)==ID_CU) {
-		el= key->elemstr;
-		
-		el[0]= 4;
-		el[1]= IPO_BPOINT;
-		el[2]= 0;
-		
-		key->elemsize= 16;
+	/* XXX the code here uses some defines which will soon be depreceated... */
+	switch (GS(id->name)) {
+		case ID_ME:
+			el = key->elemstr;
+
+			el[0] = 3;
+			el[1] = IPO_FLOAT;
+			el[2] = 0;
+
+			key->elemsize = 12;
+
+			break;
+		case ID_LT:
+			el = key->elemstr;
+
+			el[0] = 3;
+			el[1] = IPO_FLOAT;
+			el[2] = 0;
+
+			key->elemsize = 12;
+
+			break;
+		case ID_CU:
+			el = key->elemstr;
+
+			el[0] = 4;
+			el[1] = IPO_BPOINT;
+			el[2] = 0;
+
+			key->elemsize = 16;
+
+			break;
 	}
 	
 	return key;
@@ -152,21 +175,49 @@ Key *copy_key(Key *key)
 	Key *keyn;
 	KeyBlock *kbn, *kb;
 	
-	if(key==NULL) return NULL;
+	if (key == NULL) return NULL;
 	
-	keyn= copy_libblock(&key->id);
+	keyn = copy_libblock(&key->id);
 	
 	BLI_duplicatelist(&keyn->block, &key->block);
 	
-	kb= key->block.first;
-	kbn= keyn->block.first;
-	while(kbn) {
+	kb = key->block.first;
+	kbn = keyn->block.first;
+	while (kbn) {
 		
-		if(kbn->data) kbn->data= MEM_dupallocN(kbn->data);
-		if(kb==key->refkey) keyn->refkey= kbn;
+		if (kbn->data) kbn->data = MEM_dupallocN(kbn->data);
+		if (kb == key->refkey) keyn->refkey = kbn;
 		
-		kbn= kbn->next;
-		kb= kb->next;
+		kbn = kbn->next;
+		kb = kb->next;
+	}
+	
+	return keyn;
+}
+
+
+Key *copy_key_nolib(Key *key)
+{
+	Key *keyn;
+	KeyBlock *kbn, *kb;
+	
+	if (key == 0) return 0;
+	
+	keyn = MEM_dupallocN(key);
+
+	keyn->adt = NULL;
+
+	BLI_duplicatelist(&keyn->block, &key->block);
+	
+	kb = key->block.first;
+	kbn = keyn->block.first;
+	while (kbn) {
+		
+		if (kbn->data) kbn->data = MEM_dupallocN(kbn->data);
+		if (kb == key->refkey) keyn->refkey = kbn;
+		
+		kbn = kbn->next;
+		kb = kb->next;
 	}
 	
 	return keyn;
@@ -176,12 +227,12 @@ void make_local_key(Key *key)
 {
 
 	/* - only lib users: do nothing
-	* - only local users: set flag
-	* - mixed: make copy
-	*/
-	if(key==NULL) return;
+	 * - only local users: set flag
+	 * - mixed: make copy
+	 */
+	if (key == NULL) return;
 	
-	key->id.lib= NULL;
+	key->id.lib = NULL;
 	new_id(NULL, &key->id, NULL);
 }
 
@@ -193,12 +244,10 @@ void make_local_key(Key *key)
 void sort_keys(Key *key)
 {
 	KeyBlock *kb;
-	//short i, adrcode;
-	//IpoCurve *icu = NULL;
 	KeyBlock *kb2;
 
 	/* locate the key which is out of position */ 
-	for (kb= key->block.first; kb; kb= kb->next)
+	for (kb = key->block.first; kb; kb = kb->next)
 		if ((kb->next) && (kb->pos > kb->next->pos))
 			break;
 
@@ -208,53 +257,16 @@ void sort_keys(Key *key)
 		BLI_remlink(&key->block, kb);
 		
 		/* find the right location and insert before */
-		for (kb2=key->block.first; kb2; kb2= kb2->next) {
+		for (kb2 = key->block.first; kb2; kb2 = kb2->next) {
 			if (kb2->pos > kb->pos) {
 				BLI_insertlink(&key->block, kb2->prev, kb);
 				break;
 			}
 		}
-		
-		/* if more than one Ipo curve, see if this key had a curve */
-#if 0 // XXX old animation system
-		if(key->ipo && key->ipo->curve.first != key->ipo->curve.last ) {
-			for(icu= key->ipo->curve.first; icu; icu= icu->next) {
-				/* if we find the curve, remove it and reinsert in the 
-				 right place */
-				if(icu->adrcode==kb->adrcode) {
-					IpoCurve *icu2;
-					BLI_remlink(&key->ipo->curve, icu);
-					for(icu2= key->ipo->curve.first; icu2; icu2= icu2->next) {
-						if(icu2->adrcode >= kb2->adrcode) {
-							BLI_insertlink(&key->ipo->curve, icu2->prev, icu);
-							break;
-						}
-					}
-					break;
-				}
-			}
-		}
-		
-		/* kb points at the moved key, icu at the moved ipo (if it exists).
-		 * go back now and renumber adrcodes */
-
-		/* first new code */
-		adrcode = kb2->adrcode;
-		for (i = kb->adrcode - adrcode; i >= 0; i--, adrcode++) {
-			/* if the next ipo curve matches the current key, renumber it */
-			if(icu && icu->adrcode == kb->adrcode ) {
-				icu->adrcode = adrcode;
-				icu = icu->next;
-			}
-			/* renumber the shape key */
-			kb->adrcode = adrcode;
-			kb = kb->next;
-		}
-#endif // XXX old animation system
 	}
 
 	/* new rule; first key is refkey, this to match drawing channels... */
-	key->refkey= key->block.first;
+	key->refkey = key->block.first;
 }
 
 /**************** do the key ****************/
@@ -263,30 +275,30 @@ void key_curve_position_weights(float t, float *data, int type)
 {
 	float t2, t3, fc;
 	
-	if(type==KEY_LINEAR) {
-		data[0]=		  0.0f;
-		data[1]= -t		+ 1.0f;
-		data[2]= t;
-		data[3]= 		  0.0f;
-	}
-	else if(type==KEY_CARDINAL) {
-		t2= t*t;
-		t3= t2*t;
-		fc= 0.71f;
-		
-		data[0]= -fc*t3			+ 2.0f*fc*t2		- fc*t;
-		data[1]= (2.0f-fc)*t3	+ (fc-3.0f)*t2					+ 1.0f;
-		data[2]= (fc-2.0f)*t3	+ (3.0f-2.0f*fc)*t2	+ fc*t;
-		data[3]= fc*t3			- fc*t2;
-	}
-	else if(type==KEY_BSPLINE) {
-		t2= t*t;
-		t3= t2*t;
-
-		data[0]= -0.16666666f*t3	+ 0.5f*t2	- 0.5f*t	+ 0.16666666f;
-		data[1]= 0.5f*t3			- t2					+ 0.6666666f;
-		data[2]= -0.5f*t3			+ 0.5f*t2	+ 0.5f*t	+ 0.16666666f;
-		data[3]= 0.16666666f*t3;
+	if (type == KEY_LINEAR) {
+		data[0] =          0.0f;
+		data[1] = -t     + 1.0f;
+		data[2] =  t;
+		data[3] =          0.0f;
+	}
+	else if (type == KEY_CARDINAL) {
+		t2 = t * t;
+		t3 = t2 * t;
+		fc = 0.71f;
+
+		data[0] = -fc          * t3  + 2.0f * fc          * t2 - fc * t;
+		data[1] =  (2.0f - fc) * t3  + (fc - 3.0f)        * t2 + 1.0f;
+		data[2] =  (fc - 2.0f) * t3  + (3.0f - 2.0f * fc) * t2 + fc * t;
+		data[3] =  fc          * t3  - fc * t2;
+	}
+	else if (type == KEY_BSPLINE) {
+		t2 = t * t;
+		t3 = t2 * t;
+
+		data[0] = -0.16666666f * t3  + 0.5f * t2   - 0.5f * t    + 0.16666666f;
+		data[1] =  0.5f        * t3  - t2                        + 0.66666666f;
+		data[2] = -0.5f        * t3  + 0.5f * t2   + 0.5f * t    + 0.16666666f;
+		data[3] =  0.16666666f * t3;
 	}
 }
 
@@ -295,28 +307,28 @@ void key_curve_tangent_weights(float t, float *data, int type)
 {
 	float t2, fc;
 	
-	if(type==KEY_LINEAR) {
-		data[0]= 0.0f;
-		data[1]= -1.0f;
-		data[2]= 1.0f;
-		data[3]= 0.0f;
-	}
-	else if(type==KEY_CARDINAL) {
-		t2= t*t;
-		fc= 0.71f;
-		
-		data[0]= -3.0f*fc*t2		+4.0f*fc*t				- fc;
-		data[1]= 3.0f*(2.0f-fc)*t2	+2.0f*(fc-3.0f)*t;
-		data[2]= 3.0f*(fc-2.0f)*t2	+2.0f*(3.0f-2.0f*fc)*t	+ fc;
-		data[3]= 3.0f*fc*t2			-2.0f*fc*t;
+	if (type == KEY_LINEAR) {
+		data[0] = 0.0f;
+		data[1] = -1.0f;
+		data[2] = 1.0f;
+		data[3] = 0.0f;
+	}
+	else if (type == KEY_CARDINAL) {
+		t2 = t * t;
+		fc = 0.71f;
+
+		data[0] = -3.0f * fc          * t2  + 4.0f * fc * t                  - fc;
+		data[1] =  3.0f * (2.0f - fc) * t2  + 2.0f * (fc - 3.0f) * t;
+		data[2] =  3.0f * (fc - 2.0f) * t2  + 2.0f * (3.0f - 2.0f * fc) * t  + fc;
+		data[3] =  3.0f * fc          * t2  - 2.0f * fc * t;
 	}
-	else if(type==KEY_BSPLINE) {
-		t2= t*t;
+	else if (type == KEY_BSPLINE) {
+		t2 = t * t;
 
-		data[0]= -0.5f*t2	+ t			- 0.5f;
-		data[1]= 1.5f*t2	- 2.0f*t;
-		data[2]= -1.5f*t2	+ t			+ 0.5f;
-		data[3]= 0.5f*t2;
+		data[0] = -0.5f * t2  + t         - 0.5f;
+		data[1] =  1.5f * t2  - t * 2.0f;
+		data[2] = -1.5f * t2  + t         + 0.5f;
+		data[3] =  0.5f * t2;
 	}
 }
 
@@ -325,25 +337,25 @@ void key_curve_normal_weights(float t, float *data, int type)
 {
 	float fc;
 	
-	if(type==KEY_LINEAR) {
-		data[0]= 0.0f;
-		data[1]= 0.0f;
-		data[2]= 0.0f;
-		data[3]= 0.0f;
-	}
-	else if(type==KEY_CARDINAL) {
-		fc= 0.71f;
-		
-		data[0]= -6.0f*fc*t			+ 4.0f*fc;
-		data[1]= 6.0f*(2.0f-fc)*t	+ 2.0f*(fc-3.0f);
-		data[2]= 6.0f*(fc-2.0f)*t	+ 2.0f*(3.0f-2.0f*fc);
-		data[3]= 6.0f*fc*t			- 2.0f*fc;
-	}
-	else if(type==KEY_BSPLINE) {
-		data[0]= -1.0f*t	+ 1.0f;
-		data[1]= 3.0f*t		- 2.0f;
-		data[2]= -3.0f*t	+ 1.0f;
-		data[3]= 1.0f*t;
+	if (type == KEY_LINEAR) {
+		data[0] = 0.0f;
+		data[1] = 0.0f;
+		data[2] = 0.0f;
+		data[3] = 0.0f;
+	}
+	else if (type == KEY_CARDINAL) {
+		fc = 0.71f;
+
+		data[0] = -6.0f * fc          * t  + 4.0f * fc;
+		data[1] =  6.0f * (2.0f - fc) * t  + 2.0f * (fc - 3.0f);
+		data[2] =  6.0f * (fc - 2.0f) * t  + 2.0f * (3.0f - 2.0f * fc);
+		data[3] =  6.0f * fc          * t  - 2.0f * fc;
+	}
+	else if (type == KEY_BSPLINE) {
+		data[0] = -1.0f * t  + 1.0f;
+		data[1] =  3.0f * t  - 2.0f;
+		data[2] = -3.0f * t  + 1.0f;
+		data[3] =  1.0f * t;
 	}
 }
 
@@ -351,119 +363,121 @@ static int setkeys(float fac, ListBase *lb, KeyBlock *k[], float *t, int cycl)
 {
 	/* return 1 means k[2] is the position, return 0 means interpolate */
 	KeyBlock *k1, *firstkey;
-	float d, dpos, ofs=0, lastpos, temp, fval[4];
+	float d, dpos, ofs = 0, lastpos, temp, fval[4];
 	short bsplinetype;
 
-	firstkey= lb->first;
-	k1= lb->last;
-	lastpos= k1->pos;
-	dpos= lastpos - firstkey->pos;
+	firstkey = lb->first;
+	k1 = lb->last;
+	lastpos = k1->pos;
+	dpos = lastpos - firstkey->pos;
 
-	if(fac < firstkey->pos) fac= firstkey->pos;
-	else if(fac > k1->pos) fac= k1->pos;
+	if (fac < firstkey->pos) fac = firstkey->pos;
+	else if (fac > k1->pos) fac = k1->pos;
 
-	k1=k[0]=k[1]=k[2]=k[3]= firstkey;
-	t[0]=t[1]=t[2]=t[3]= k1->pos;
+	k1 = k[0] = k[1] = k[2] = k[3] = firstkey;
+	t[0] = t[1] = t[2] = t[3] = k1->pos;
 
-	/* if(fac<0.0 || fac>1.0) return 1; */
+	/* if (fac<0.0 || fac>1.0) return 1; */
 
-	if(k1->next==NULL) return 1;
+	if (k1->next == NULL) return 1;
 
-	if(cycl) {	/* pre-sort */
-		k[2]= k1->next;
-		k[3]= k[2]->next;
-		if(k[3]==NULL) k[3]=k1;
-		while(k1) {
-			if(k1->next==NULL) k[0]=k1;
-			k1=k1->next;
+	if (cycl) { /* pre-sort */
+		k[2] = k1->next;
+		k[3] = k[2]->next;
+		if (k[3] == NULL) k[3] = k1;
+		while (k1) {
+			if (k1->next == NULL) k[0] = k1;
+			k1 = k1->next;
 		}
 		/* k1= k[1]; */ /* UNUSED */
-		t[0]= k[0]->pos;
-		t[1]+= dpos;
-		t[2]= k[2]->pos + dpos;
-		t[3]= k[3]->pos + dpos;
-		fac+= dpos;
-		ofs= dpos;
-		if(k[3]==k[1]) { 
-			t[3]+= dpos; 
-			ofs= 2.0f*dpos;
-		}
-		if(fac<t[1]) fac+= dpos;
-		k1= k[3];
-	}
-	else {		/* pre-sort */
-		k[2]= k1->next;
-		t[2]= k[2]->pos;
-		k[3]= k[2]->next;
-		if(k[3]==NULL) k[3]= k[2];
-		t[3]= k[3]->pos;
-		k1= k[3];
+		t[0] = k[0]->pos;
+		t[1] += dpos;
+		t[2] = k[2]->pos + dpos;
+		t[3] = k[3]->pos + dpos;
+		fac += dpos;
+		ofs = dpos;
+		if (k[3] == k[1]) {
+			t[3] += dpos;
+			ofs = 2.0f * dpos;
+		}
+		if (fac < t[1]) fac += dpos;
+		k1 = k[3];
+	}
+	else {  /* pre-sort */
+		k[2] = k1->next;
+		t[2] = k[2]->pos;
+		k[3] = k[2]->next;
+		if (k[3] == NULL) k[3] = k[2];
+		t[3] = k[3]->pos;
+		k1 = k[3];
 	}
 	
-	while( t[2]<fac ) {	/* find correct location */
-		if(k1->next==NULL) {
-			if(cycl) {
-				k1= firstkey;
-				ofs+= dpos;
+	while (t[2] < fac) {    /* find correct location */
+		if (k1->next == NULL) {
+			if (cycl) {
+				k1 = firstkey;
+				ofs += dpos;
 			}
-			else if(t[2]==t[3]) break;
+			else if (t[2] == t[3]) break;
 		}
-		else k1= k1->next;
+		else k1 = k1->next;
 
-		t[0]= t[1]; 
-		k[0]= k[1];
-		t[1]= t[2]; 
-		k[1]= k[2];
-		t[2]= t[3]; 
-		k[2]= k[3];
-		t[3]= k1->pos+ofs; 
-		k[3]= k1;
+		t[0] = t[1];
+		k[0] = k[1];
+		t[1] = t[2];
+		k[1] = k[2];
+		t[2] = t[3];
+		k[2] = k[3];
+		t[3] = k1->pos + ofs;
+		k[3] = k1;
 
-		if(ofs > 2.1f + lastpos) break;
+		if (ofs > 2.1f + lastpos) break;
 	}
 	
-	bsplinetype= 0;
-	if(k[1]->type==KEY_BSPLINE || k[2]->type==KEY_BSPLINE) bsplinetype= 1;
+	bsplinetype = 0;
+	if (k[1]->type == KEY_BSPLINE || k[2]->type == KEY_BSPLINE) bsplinetype = 1;
 
 
-	if(cycl==0) {
-		if(bsplinetype==0) {	/* B spline doesn't go through the control points */
-			if(fac<=t[1]) {		/* fac for 1st key */
-				t[2]= t[1];
-				k[2]= k[1];
+	if (cycl == 0) {
+		if (bsplinetype == 0) {   /* B spline doesn't go through the control points */
+			if (fac <= t[1]) {  /* fac for 1st key */
+				t[2] = t[1];
+				k[2] = k[1];
 				return 1;
 			}
-			if(fac>=t[2] ) {	/* fac after 2nd key */
+			if (fac >= t[2]) {  /* fac after 2nd key */
 				return 1;
 			}
 		}
-		else if(fac>t[2]) {	/* last key */
-			fac= t[2];
-			k[3]= k[2];
-			t[3]= t[2];
+		else if (fac > t[2]) {  /* last key */
+			fac = t[2];
+			k[3] = k[2];
+			t[3] = t[2];
 		}
 	}
 
-	d= t[2]-t[1];
-	if(d == 0.0f) {
-		if(bsplinetype==0) {
-			return 1;	/* both keys equal */
+	d = t[2] - t[1];
+	if (d == 0.0f) {
+		if (bsplinetype == 0) {
+			return 1;  /* both keys equal */
 		}
 	}
-	else d= (fac-t[1])/d;
+	else {
+		d = (fac - t[1]) / d;
+	}
 
 	/* interpolation */
 	
 	key_curve_position_weights(d, t, k[1]->type);
 
-	if(k[1]->type != k[2]->type) {
+	if (k[1]->type != k[2]->type) {
 		key_curve_position_weights(d, fval, k[2]->type);
 		
-		temp= 1.0f-d;
-		t[0]= temp*t[0]+ d*fval[0];
-		t[1]= temp*t[1]+ d*fval[1];
-		t[2]= temp*t[2]+ d*fval[2];
-		t[3]= temp*t[3]+ d*fval[3];
+		temp = 1.0f - d;
+		t[0] = temp * t[0] + d * fval[0];
+		t[1] = temp * t[1] + d * fval[1];
+		t[2] = temp * t[2] + d * fval[2];
+		t[3] = temp * t[3] + d * fval[3];
 	}
 
 	return 0;
@@ -474,8 +488,8 @@ static void flerp(int tot, float *in, float *f0, float *f1, float *f2, float *f3
 {
 	int a;
 
-	for(a=0; a<tot; a++) {
-		in[a]= t[0]*f0[a]+t[1]*f1[a]+t[2]*f2[a]+t[3]*f3[a];
+	for (a = 0; a < tot; a++) {
+		in[a] = t[0] * f0[a] + t[1] * f1[a] + t[2] * f2[a] + t[3] * f3[a];
 	}
 }
 
@@ -483,38 +497,41 @@ static void rel_flerp(int tot, float *in, float *ref, float *out, float fac)
 {
 	int a;
 	
-	for(a=0; a<tot; a++) {
-		in[a]-= fac*(ref[a]-out[a]);
+	for (a = 0; a < tot; a++) {
+		in[a] -= fac * (ref[a] - out[a]);
 	}
 }
 
 static char *key_block_get_data(Key *key, KeyBlock *actkb, KeyBlock *kb, char **freedata)
 {
-	if(kb == actkb) {
+	if (kb == actkb) {
 		/* this hack makes it possible to edit shape keys in
-		   edit mode with shape keys blending applied */
-		if(GS(key->from->name) == ID_ME) {
+		 * edit mode with shape keys blending applied */
+		if (GS(key->from->name) == ID_ME) {
 			Mesh *me;
-			EditVert *eve;
+			BMVert *eve;
+			BMIter iter;
 			float (*co)[3];
 			int a;
 
-			me= (Mesh*)key->from;
+			me = (Mesh *)key->from;
 
-			if(me->edit_mesh && me->edit_mesh->totvert == kb->totelem) {
-				a= 0;
-				co= MEM_callocN(sizeof(float)*3*me->edit_mesh->totvert, "key_block_get_data");
+			if (me->edit_btmesh && me->edit_btmesh->bm->totvert == kb->totelem) {
+				a = 0;
+				co = MEM_callocN(sizeof(float) * 3 * me->edit_btmesh->bm->totvert, "key_block_get_data");
 
-				for(eve=me->edit_mesh->verts.first; eve; eve=eve->next, a++)
+				BM_ITER_MESH (eve, &iter, me->edit_btmesh->bm, BM_VERTS_OF_MESH) {
 					copy_v3_v3(co[a], eve->co);
+					a++;
+				}
 
-				*freedata= (char*)co;
-				return (char*)co;
+				*freedata = (char *)co;
+				return (char *)co;
 			}
 		}
 	}
 
-	*freedata= NULL;
+	*freedata = NULL;
 	return kb->data;
 }
 
@@ -522,32 +539,33 @@ static char *key_block_get_data(Key *key, KeyBlock *actkb, KeyBlock *kb, char **
 /* currently only the first value of 'ofs' may be set. */
 static short key_pointer_size(const Key *key, const int mode, int *poinsize, int *ofs)
 {
-	if(key->from==NULL) {
+	if (key->from == NULL) {
 		return FALSE;
 	}
 
-	switch(GS(key->from->name)) {
-	case ID_ME:
-		*ofs= sizeof(float)*3;
-		*poinsize= *ofs;
-		break;
-	case ID_LT:
-		*ofs= sizeof(float)*3;
-		*poinsize= *ofs;
-		break;
-	case ID_CU:
-		if(mode == KEY_MODE_BPOINT) {
-			*ofs= sizeof(float)*4;
-			*poinsize= *ofs;
-		} else {
-			ofs[0]= sizeof(float)*12;
-			*poinsize= (*ofs) / 3;
-		}
-
-		break;
-	default:
-		BLI_assert(!"invalid 'key->from' ID type");
-		return FALSE;
+	switch (GS(key->from->name)) {
+		case ID_ME:
+			*ofs = sizeof(float) * 3;
+			*poinsize = *ofs;
+			break;
+		case ID_LT:
+			*ofs = sizeof(float) * 3;
+			*poinsize = *ofs;
+			break;
+		case ID_CU:
+			if (mode == KEY_MODE_BPOINT) {
+				*ofs = sizeof(float) * 4;
+				*poinsize = *ofs;
+			}
+			else {
+				ofs[0] = sizeof(float) * 12;
+				*poinsize = (*ofs) / 3;
+			}
+
+			break;
+		default:
+			BLI_assert(!"invalid 'key->from' ID type");
+			return FALSE;
 	}
 
 	return TRUE;
@@ -556,112 +574,117 @@ static short key_pointer_size(const Key *key, const int mode, int *poinsize, int
 static void cp_key(const int start, int end, const int tot, char *poin, Key *key, KeyBlock *actkb, KeyBlock *kb, float *weights, const int mode)
 {
 	float ktot = 0.0, kd = 0.0;
-	int elemsize, poinsize = 0, a, *ofsp, ofs[32], flagflo=0;
+	int elemsize, poinsize = 0, a, *ofsp, ofs[32], flagflo = 0;
 	char *k1, *kref, *freek1, *freekref;
 	char *cp, elemstr[8];
 
 	/* currently always 0, in future key_pointer_size may assign */
-	ofs[1]= 0;
+	ofs[1] = 0;
 
-	if(!key_pointer_size(key, mode, &poinsize, &ofs[0]))
+	if (!key_pointer_size(key, mode, &poinsize, &ofs[0]))
 		return;
 
-	if(end>tot) end= tot;
+	if (end > tot) end = tot;
 	
-	if(tot != kb->totelem) {
-		ktot= 0.0;
-		flagflo= 1;
-		if(kb->totelem) {
-			kd= kb->totelem/(float)tot;
+	if (tot != kb->totelem) {
+		ktot = 0.0;
+		flagflo = 1;
+		if (kb->totelem) {
+			kd = kb->totelem / (float)tot;
+		}
+		else {
+			return;
 		}
-		else return;
 	}
 
-	k1= key_block_get_data(key, actkb, kb, &freek1);
-	kref= key_block_get_data(key, actkb, key->refkey, &freekref);
+	k1 = key_block_get_data(key, actkb, kb, &freek1);
+	kref = key_block_get_data(key, actkb, key->refkey, &freekref);
 
 	/* this exception is needed for slurphing */
-	if(start!=0) {
+	if (start != 0) {
 		
-		poin+= poinsize*start;
+		poin += poinsize * start;
 		
-		if(flagflo) {
-			ktot+= start*kd;
-			a= (int)floor(ktot);
-			if(a) {
-				ktot-= a;
-				k1+= a*key->elemsize;
+		if (flagflo) {
+			ktot += start * kd;
+			a = (int)floor(ktot);
+			if (a) {
+				ktot -= a;
+				k1 += a * key->elemsize;
 			}
 		}
-		else k1+= start*key->elemsize;
+		else k1 += start * key->elemsize;
 	}	
 	
-	if(mode == KEY_MODE_BEZTRIPLE) {
-		elemstr[0]= 1;
-		elemstr[1]= IPO_BEZTRIPLE;
-		elemstr[2]= 0;
+	if (mode == KEY_MODE_BEZTRIPLE) {
+		elemstr[0] = 1;
+		elemstr[1] = IPO_BEZTRIPLE;
+		elemstr[2] = 0;
 	}
 	
 	/* just do it here, not above! */
-	elemsize= key->elemsize;
-	if(mode == KEY_MODE_BEZTRIPLE) elemsize*= 3;
+	elemsize = key->elemsize;
+	if (mode == KEY_MODE_BEZTRIPLE) elemsize *= 3;
 
-	for(a=start; a<end; a++) {
-		cp= key->elemstr;
-		if(mode == KEY_MODE_BEZTRIPLE) cp= elemstr;
+	for (a = start; a < end; a++) {
+		cp = key->elemstr;
+		if (mode == KEY_MODE_BEZTRIPLE) cp = elemstr;
 
-		ofsp= ofs;
-		
-		while( cp[0] ) {
-			
-			switch(cp[1]) {
-			case IPO_FLOAT:
-				if(weights) {
-					memcpy(poin, kref, sizeof(float)*3);
-					if(*weights!=0.0f)
-						rel_flerp(cp[0], (float *)poin, (float *)kref, (float *)k1, *weights);
-					weights++;
-				}
-				else 
-					memcpy(poin, k1, sizeof(float)*3);
-				break;
-			case IPO_BPOINT:
-				memcpy(poin, k1, sizeof(float)*4);
-				break;
-			case IPO_BEZTRIPLE:
-				memcpy(poin, k1, sizeof(float)*12);
-				break;
-			default:
-				/* should never happen */
-				if(freek1) MEM_freeN(freek1);
-				if(freekref) MEM_freeN(freekref);
-				BLI_assert(!"invalid 'cp[1]'");
-				return;
+		ofsp = ofs;
+
+		while (cp[0]) {
+
+			switch (cp[1]) {
+				case IPO_FLOAT:
+					if (weights) {
+						memcpy(poin, kref, sizeof(float) * 3);
+						if (*weights != 0.0f)
+							rel_flerp(cp[0], (float *)poin, (float *)kref, (float *)k1, *weights);
+						weights++;
+					}
+					else {
+						memcpy(poin, k1, sizeof(float) * 3);
+					}
+					break;
+				case IPO_BPOINT:
+					memcpy(poin, k1, sizeof(float) * 4);
+					break;
+				case IPO_BEZTRIPLE:
+					memcpy(poin, k1, sizeof(float) * 12);
+					break;
+				default:
+					/* should never happen */
+					if (freek1) MEM_freeN(freek1);
+					if (freekref) MEM_freeN(freekref);
+					BLI_assert(!"invalid 'cp[1]'");
+					return;
 			}
 
-			poin+= ofsp[0];	
-			cp+= 2; ofsp++;
+			poin += *ofsp;
+			cp += 2; ofsp++;
 		}
 		
 		/* are we going to be nasty? */
-		if(flagflo) {
-			ktot+= kd;
-			while(ktot >= 1.0f) {
+		if (flagflo) {
+			ktot += kd;
+			while (ktot >= 1.0f) {
 				ktot -= 1.0f;
-				k1+= elemsize;
-				kref+= elemsize;
+				k1 += elemsize;
+				kref += elemsize;
 			}
 		}
 		else {
-			k1+= elemsize;
-			kref+= elemsize;
+			k1 += elemsize;
+			kref += elemsize;
 		}
 		
-		if(mode == KEY_MODE_BEZTRIPLE) a+=2;
+		if (mode == KEY_MODE_BEZTRIPLE) {
+			a += 2;
+		}
 	}
 
-	if(freek1) MEM_freeN(freek1);
-	if(freekref) MEM_freeN(freekref);
+	if (freek1) MEM_freeN(freek1);
+	if (freekref) MEM_freeN(freekref);
 }
 
 static void cp_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock *kb, const int start, int end, char *out, const int tot)
@@ -669,26 +692,27 @@ static void cp_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock *kb, const
 	Nurb *nu;
 	int a, step, a1, a2;
 
-	for(a=0, nu=cu->nurb.first; nu; nu=nu->next, a+=step) {
-		if(nu->bp) {
-			step= nu->pntsu*nu->pntsv;
+	for (a = 0, nu = cu->nurb.first; nu; nu = nu->next, a += step) {
+		if (nu->bp) {
+			step = nu->pntsu * nu->pntsv;
 
-			a1= MAX2(a, start);
-			a2= MIN2(a+step, end);
+			a1 = MAX2(a, start);
+			a2 = MIN2(a + step, end);
 
-			if(a1<a2) cp_key(a1, a2, tot, out, key, actkb, kb, NULL, KEY_MODE_BPOINT);
+			if (a1 < a2) cp_key(a1, a2, tot, out, key, actkb, kb, NULL, KEY_MODE_BPOINT);
 		}
-		else if(nu->bezt) {
-			step= 3*nu->pntsu;
+		else if (nu->bezt) {
+			step = 3 * nu->pntsu;
 
 			/* exception because keys prefer to work with complete blocks */
-			a1= MAX2(a, start);
-			a2= MIN2(a+step, end);
+			a1 = MAX2(a, start);
+			a2 = MIN2(a + step, end);
 
-			if(a1<a2) cp_key(a1, a2, tot, out, key, actkb, kb, NULL, KEY_MODE_BEZTRIPLE);
+			if (a1 < a2) cp_key(a1, a2, tot, out, key, actkb, kb, NULL, KEY_MODE_BEZTRIPLE);
+		}
+		else {
+			step = 0;
 		}
-		else
-			step= 0;
 	}
 }
 
@@ -701,95 +725,92 @@ void do_rel_key(const int start, int end, const int tot, char *basispoin, Key *k
 	int poinsize;
 
 	/* currently always 0, in future key_pointer_size may assign */
-	ofs[1]= 0;
+	ofs[1] = 0;
 
-	if(!key_pointer_size(key, mode, &poinsize, &ofs[0]))
+	if (!key_pointer_size(key, mode, &poinsize, &ofs[0]))
 		return;
 
-	if(end>tot) end= tot;
+	if (end > tot) end = tot;
 
 	/* in case of beztriple */
-	elemstr[0]= 1;				/* nr of ipofloats */
-	elemstr[1]= IPO_BEZTRIPLE;
-	elemstr[2]= 0;
+	elemstr[0] = 1;              /* nr of ipofloats */
+	elemstr[1] = IPO_BEZTRIPLE;
+	elemstr[2] = 0;
 
 	/* just here, not above! */
-	elemsize= key->elemsize;
-	if(mode == KEY_MODE_BEZTRIPLE) elemsize*= 3;
+	elemsize = key->elemsize;
+	if (mode == KEY_MODE_BEZTRIPLE) elemsize *= 3;
 
 	/* step 1 init */
 	cp_key(start, end, tot, basispoin, key, actkb, key->refkey, NULL, mode);
 	
 	/* step 2: do it */
 	
-	for(kb=key->block.first; kb; kb=kb->next) {
-		if(kb!=key->refkey) {
-			float icuval= kb->curval;
+	for (kb = key->block.first; kb; kb = kb->next) {
+		if (kb != key->refkey) {
+			float icuval = kb->curval;
 			
 			/* only with value, and no difference allowed */
-			if(!(kb->flag & KEYBLOCK_MUTE) && icuval!=0.0f && kb->totelem==tot) {
+			if (!(kb->flag & KEYBLOCK_MUTE) && icuval != 0.0f && kb->totelem == tot) {
 				KeyBlock *refb;
-				float weight, *weights= kb->weights;
+				float weight, *weights = kb->weights;
 
 				/* reference now can be any block */
-				refb= BLI_findlink(&key->block, kb->relative);
-				if(refb==NULL) continue;
-				
-				poin= basispoin;
-				from= key_block_get_data(key, actkb, kb, &freefrom);
-				reffrom= key_block_get_data(key, actkb, refb, &freereffrom);
+				refb = BLI_findlink(&key->block, kb->relative);
+				if (refb == NULL) continue;
 				
-				poin+= start*poinsize;
-				reffrom+= key->elemsize*start;	// key elemsize yes!
-				from+= key->elemsize*start;
+				poin = basispoin;
+				from = key_block_get_data(key, actkb, kb, &freefrom);
+				reffrom = key_block_get_data(key, actkb, refb, &freereffrom);
+
+				poin += start * poinsize;
+				reffrom += key->elemsize * start;  // key elemsize yes!
+				from += key->elemsize * start;
 				
-				for(b=start; b<end; b++) {
+				for (b = start; b < end; b++) {
 				
-					if(weights) 
-						weight= *weights * icuval;
-					else
-						weight= icuval;
+					weight = weights ? (*weights * icuval) : icuval;
 					
-					cp= key->elemstr;	
-					if(mode == KEY_MODE_BEZTRIPLE) cp= elemstr;
+					cp = key->elemstr;
+					if (mode == KEY_MODE_BEZTRIPLE) cp = elemstr;
 					
-					ofsp= ofs;
+					ofsp = ofs;
 					
-					while( cp[0] ) {	/* cp[0]==amount */
+					while (cp[0]) {     /* cp[0]==amount */
 						
-						switch(cp[1]) {
-						case IPO_FLOAT:
-							rel_flerp(3, (float *)poin, (float *)reffrom, (float *)from, weight);
-							break;
-						case IPO_BPOINT:
-							rel_flerp(4, (float *)poin, (float *)reffrom, (float *)from, weight);
-							break;
-						case IPO_BEZTRIPLE:
-							rel_flerp(12, (float *)poin, (float *)reffrom, (float *)from, weight);
-							break;
-						default:
-							/* should never happen */
-							if(freefrom) MEM_freeN(freefrom);
-							if(freereffrom) MEM_freeN(freereffrom);
-							BLI_assert(!"invalid 'cp[1]'");
-							return;
+						switch (cp[1]) {
+							case IPO_FLOAT:
+								rel_flerp(3, (float *)poin, (float *)reffrom, (float *)from, weight);
+								break;
+							case IPO_BPOINT:
+								rel_flerp(4, (float *)poin, (float *)reffrom, (float *)from, weight);
+								break;
+							case IPO_BEZTRIPLE:
+								rel_flerp(12, (float *)poin, (float *)reffrom, (float *)from, weight);
+								break;
+							default:
+								/* should never happen */
+								if (freefrom) MEM_freeN(freefrom);
+								if (freereffrom) MEM_freeN(freereffrom);
+								BLI_assert(!"invalid 'cp[1]'");
+								return;
 						}
 
-						poin+= ofsp[0];				
+						poin += *ofsp;
 						
-						cp+= 2;
+						cp += 2;
 						ofsp++;
 					}
 					
-					reffrom+= elemsize;
-					from+= elemsize;
+					reffrom += elemsize;
+					from += elemsize;
 					
-					if(mode == KEY_MODE_BEZTRIPLE) b+= 2;
-					if(weights) weights++;
+					if (mode == KEY_MODE_BEZTRIPLE) b += 2;
+					if (weights) weights++;
 				}
 
-				if(freefrom) MEM_freeN(freefrom);
-				if(freereffrom) MEM_freeN(freereffrom);
+				if (freefrom) MEM_freeN(freefrom);
+				if (freereffrom) MEM_freeN(freereffrom);
 			}
 		}
 	}
@@ -801,249 +822,251 @@ static void do_key(const int start, int end, const int tot, char *poin, Key *key
 	float k1tot = 0.0, k2tot = 0.0, k3tot = 0.0, k4tot = 0.0;
 	float k1d = 0.0, k2d = 0.0, k3d = 0.0, k4d = 0.0;
 	int a, ofs[32], *ofsp;
-	int flagdo= 15, flagflo=0, elemsize, poinsize=0;
+	int flagdo = 15, flagflo = 0, elemsize, poinsize = 0;
 	char *k1, *k2, *k3, *k4, *freek1, *freek2, *freek3, *freek4;
 	char *cp, elemstr[8];
 
 	/* currently always 0, in future key_pointer_size may assign */
-	ofs[1]= 0;
+	ofs[1] = 0;
 
-	if(!key_pointer_size(key, mode, &poinsize, &ofs[0]))
+	if (!key_pointer_size(key, mode, &poinsize, &ofs[0]))
 		return;
 	
-	if(end>tot) end= tot;
+	if (end > tot) end = tot;
 
-	k1= key_block_get_data(key, actkb, k[0], &freek1);
-	k2= key_block_get_data(key, actkb, k[1], &freek2);
-	k3= key_block_get_data(key, actkb, k[2], &freek3);
-	k4= key_block_get_data(key, actkb, k[3], &freek4);
+	k1 = key_block_get_data(key, actkb, k[0], &freek1);
+	k2 = key_block_get_data(key, actkb, k[1], &freek2);
+	k3 = key_block_get_data(key, actkb, k[2], &freek3);
+	k4 = key_block_get_data(key, actkb, k[3], &freek4);
 
 	/*  test for more or less points (per key!) */
-	if(tot != k[0]->totelem) {
-		k1tot= 0.0;
+	if (tot != k[0]->totelem) {
+		k1tot = 0.0;
 		flagflo |= 1;
-		if(k[0]->totelem) {
-			k1d= k[0]->totelem/(float)tot;
+		if (k[0]->totelem) {
+			k1d = k[0]->totelem / (float)tot;
 		}
 		else flagdo -= 1;
 	}
-	if(tot != k[1]->totelem) {
-		k2tot= 0.0;
+	if (tot != k[1]->totelem) {
+		k2tot = 0.0;
 		flagflo |= 2;
-		if(k[0]->totelem) {
-			k2d= k[1]->totelem/(float)tot;
+		if (k[0]->totelem) {
+			k2d = k[1]->totelem / (float)tot;
 		}
 		else flagdo -= 2;
 	}
-	if(tot != k[2]->totelem) {
-		k3tot= 0.0;
+	if (tot != k[2]->totelem) {
+		k3tot = 0.0;
 		flagflo |= 4;
-		if(k[0]->totelem) {
-			k3d= k[2]->totelem/(float)tot;
+		if (k[0]->totelem) {
+			k3d = k[2]->totelem / (float)tot;
 		}
 		else flagdo -= 4;
 	}
-	if(tot != k[3]->totelem) {
-		k4tot= 0.0;
+	if (tot != k[3]->totelem) {
+		k4tot = 0.0;
 		flagflo |= 8;
-		if(k[0]->totelem) {
-			k4d= k[3]->totelem/(float)tot;
+		if (k[0]->totelem) {
+			k4d = k[3]->totelem / (float)tot;
 		}
 		else flagdo -= 8;
 	}
 
-		/* this exception needed for slurphing */
-	if(start!=0) {
+	/* this exception needed for slurphing */
+	if (start != 0) {
 
-		poin+= poinsize*start;
+		poin += poinsize * start;
 		
-		if(flagdo & 1) {
-			if(flagflo & 1) {
-				k1tot+= start*k1d;
-				a= (int)floor(k1tot);
-				if(a) {
-					k1tot-= a;
-					k1+= a*key->elemsize;
+		if (flagdo & 1) {
+			if (flagflo & 1) {
+				k1tot += start * k1d;
+				a = (int)floor(k1tot);
+				if (a) {
+					k1tot -= a;
+					k1 += a * key->elemsize;
 				}
 			}
-			else k1+= start*key->elemsize;
-		}
-		if(flagdo & 2) {
-			if(flagflo & 2) {
-				k2tot+= start*k2d;
-				a= (int)floor(k2tot);
-				if(a) {
-					k2tot-= a;
-					k2+= a*key->elemsize;
+			else k1 += start * key->elemsize;
+		}
+		if (flagdo & 2) {
+			if (flagflo & 2) {
+				k2tot += start * k2d;
+				a = (int)floor(k2tot);
+				if (a) {
+					k2tot -= a;
+					k2 += a * key->elemsize;
 				}
 			}
-			else k2+= start*key->elemsize;
-		}
-		if(flagdo & 4) {
-			if(flagflo & 4) {
-				k3tot+= start*k3d;
-				a= (int)floor(k3tot);
-				if(a) {
-					k3tot-= a;
-					k3+= a*key->elemsize;
+			else k2 += start * key->elemsize;
+		}
+		if (flagdo & 4) {
+			if (flagflo & 4) {
+				k3tot += start * k3d;
+				a = (int)floor(k3tot);
+				if (a) {
+					k3tot -= a;
+					k3 += a * key->elemsize;
 				}
 			}
-			else k3+= start*key->elemsize;
-		}
-		if(flagdo & 8) {
-			if(flagflo & 8) {
-				k4tot+= start*k4d;
-				a= (int)floor(k4tot);
-				if(a) {
-					k4tot-= a;
-					k4+= a*key->elemsize;
+			else k3 += start * key->elemsize;
+		}
+		if (flagdo & 8) {
+			if (flagflo & 8) {
+				k4tot += start * k4d;
+				a = (int)floor(k4tot);
+				if (a) {
+					k4tot -= a;
+					k4 += a * key->elemsize;
 				}
 			}
-			else k4+= start*key->elemsize;
+			else k4 += start * key->elemsize;
 		}
 
 	}
 
 	/* in case of beztriple */
-	elemstr[0]= 1;				/* nr of ipofloats */
-	elemstr[1]= IPO_BEZTRIPLE;
-	elemstr[2]= 0;
+	elemstr[0] = 1;              /* nr of ipofloats */
+	elemstr[1] = IPO_BEZTRIPLE;
+	elemstr[2] = 0;
 
 	/* only here, not above! */
-	elemsize= key->elemsize;
-	if(mode == KEY_MODE_BEZTRIPLE) elemsize*= 3;
+	elemsize = key->elemsize;
+	if (mode == KEY_MODE_BEZTRIPLE) elemsize *= 3;
 
-	for(a=start; a<end; a++) {
+	for (a = start; a < end; a++) {
 	
-		cp= key->elemstr;	
-		if(mode == KEY_MODE_BEZTRIPLE) cp= elemstr;
+		cp = key->elemstr;
+		if (mode == KEY_MODE_BEZTRIPLE) cp = elemstr;
 		
-		ofsp= ofs;
-		
-		while( cp[0] ) {	/* cp[0]==amount */
-			
-			switch(cp[1]) {
-			case IPO_FLOAT:
-				flerp(3, (float *)poin, (float *)k1, (float *)k2, (float *)k3, (float *)k4, t);
-				break;
-			case IPO_BPOINT:
-				flerp(4, (float *)poin, (float *)k1, (float *)k2, (float *)k3, (float *)k4, t);
-				break;
-			case IPO_BEZTRIPLE:
-				flerp(12, (void *)poin, (void *)k1, (void *)k2, (void *)k3, (void *)k4, t);
-				break;
-			default:
-				/* should never happen */
-				if(freek1) MEM_freeN(freek1);
-				if(freek2) MEM_freeN(freek2);
-				if(freek3) MEM_freeN(freek3);
-				if(freek4) MEM_freeN(freek4);
-				BLI_assert(!"invalid 'cp[1]'");
-				return;
+		ofsp = ofs;
+
+		while (cp[0]) {     /* cp[0]==amount */
+
+			switch (cp[1]) {
+				case IPO_FLOAT:
+					flerp(3, (float *)poin, (float *)k1, (float *)k2, (float *)k3, (float *)k4, t);
+					break;
+				case IPO_BPOINT:
+					flerp(4, (float *)poin, (float *)k1, (float *)k2, (float *)k3, (float *)k4, t);
+					break;
+				case IPO_BEZTRIPLE:
+					flerp(12, (void *)poin, (void *)k1, (void *)k2, (void *)k3, (void *)k4, t);
+					break;
+				default:
+					/* should never happen */
+					if (freek1) MEM_freeN(freek1);
+					if (freek2) MEM_freeN(freek2);
+					if (freek3) MEM_freeN(freek3);
+					if (freek4) MEM_freeN(freek4);
+					BLI_assert(!"invalid 'cp[1]'");
+					return;
 			}
 			
-			poin+= ofsp[0];				
-			cp+= 2;
+			poin += *ofsp;
+			cp += 2;
 			ofsp++;
 		}
 		/* lets do it the difficult way: when keys have a different size */
-		if(flagdo & 1) {
-			if(flagflo & 1) {
-				k1tot+= k1d;
-				while(k1tot >= 1.0f) {
+		if (flagdo & 1) {
+			if (flagflo & 1) {
+				k1tot += k1d;
+				while (k1tot >= 1.0f) {
 					k1tot -= 1.0f;
-					k1+= elemsize;
+					k1 += elemsize;
 				}
 			}
-			else k1+= elemsize;
+			else k1 += elemsize;
 		}
-		if(flagdo & 2) {
-			if(flagflo & 2) {
-				k2tot+= k2d;
-				while(k2tot >= 1.0f) {
+		if (flagdo & 2) {
+			if (flagflo & 2) {
+				k2tot += k2d;
+				while (k2tot >= 1.0f) {
 					k2tot -= 1.0f;
-					k2+= elemsize;
+					k2 += elemsize;
 				}
 			}
-			else k2+= elemsize;
+			else k2 += elemsize;
 		}
-		if(flagdo & 4) {
-			if(flagflo & 4) {
-				k3tot+= k3d;
-				while(k3tot >= 1.0f) {
+		if (flagdo & 4) {
+			if (flagflo & 4) {
+				k3tot += k3d;
+				while (k3tot >= 1.0f) {
 					k3tot -= 1.0f;
-					k3+= elemsize;
+					k3 += elemsize;
 				}
 			}
-			else k3+= elemsize;
+			else k3 += elemsize;
 		}
-		if(flagdo & 8) {
-			if(flagflo & 8) {
-				k4tot+= k4d;
-				while(k4tot >= 1.0f) {
+		if (flagdo & 8) {
+			if (flagflo & 8) {
+				k4tot += k4d;
+				while (k4tot >= 1.0f) {
 					k4tot -= 1.0f;
-					k4+= elemsize;
+					k4 += elemsize;
 				}
 			}
-			else k4+= elemsize;
+			else k4 += elemsize;
 		}
 		
-		if(mode == KEY_MODE_BEZTRIPLE) a+= 2;
+		if (mode == KEY_MODE_BEZTRIPLE) a += 2;
 	}
 
-	if(freek1) MEM_freeN(freek1);
-	if(freek2) MEM_freeN(freek2);
-	if(freek3) MEM_freeN(freek3);
-	if(freek4) MEM_freeN(freek4);
+	if (freek1) MEM_freeN(freek1);
+	if (freek2) MEM_freeN(freek2);
+	if (freek3) MEM_freeN(freek3);
+	if (freek4) MEM_freeN(freek4);
 }
 
 static float *get_weights_array(Object *ob, char *vgroup)
 {
-	MDeformVert *dvert= NULL;
-	EditMesh *em= NULL;
-	EditVert *eve;
-	int totvert= 0, defgrp_index= 0;
+	MDeformVert *dvert = NULL;
+	BMEditMesh *em = NULL;
+	BMIter iter;
+	BMVert *eve;
+	int totvert = 0, defgrp_index = 0;
 	
 	/* no vgroup string set? */
-	if(vgroup[0]==0) return NULL;
+	if (vgroup[0] == 0) return NULL;
 	
 	/* gather dvert and totvert */
-	if(ob->type==OB_MESH) {
-		Mesh *me= ob->data;
-		dvert= me->dvert;
-		totvert= me->totvert;
+	if (ob->type == OB_MESH) {
+		Mesh *me = ob->data;
+		dvert = me->dvert;
+		totvert = me->totvert;
 
-		if(me->edit_mesh && me->edit_mesh->totvert == totvert)
-			em= me->edit_mesh;
+		if (me->edit_btmesh && me->edit_btmesh->bm->totvert == totvert)
+			em = me->edit_btmesh;
 	}
-	else if(ob->type==OB_LATTICE) {
-		Lattice *lt= ob->data;
-		dvert= lt->dvert;
-		totvert= lt->pntsu*lt->pntsv*lt->pntsw;
+	else if (ob->type == OB_LATTICE) {
+		Lattice *lt = ob->data;
+		dvert = lt->dvert;
+		totvert = lt->pntsu * lt->pntsv * lt->pntsw;
 	}
 	
-	if(dvert==NULL) return NULL;
+	if (dvert == NULL) return NULL;
 	
 	/* find the group (weak loop-in-loop) */
-	defgrp_index= defgroup_name_index(ob, vgroup);
-	if(defgrp_index >= 0) {
+	defgrp_index = defgroup_name_index(ob, vgroup);
+	if (defgrp_index >= 0) {
 		float *weights;
 		int i;
 		
-		weights= MEM_callocN(totvert*sizeof(float), "weights");
+		weights = MEM_callocN(totvert * sizeof(float), "weights");
 
-		if(em) {
-			for(i=0, eve=em->verts.first; eve; eve=eve->next, i++) {
-				dvert= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
+		if (em) {
+			eve = BM_iter_new(&iter, em->bm, BM_VERTS_OF_MESH, NULL);
+			for (i = 0; eve; eve = BM_iter_step(&iter), i++) {
+				dvert = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
 
-				if(dvert) {
-					weights[i]= defvert_find_weight(dvert, defgrp_index);
+				if (dvert) {
+					weights[i] = defvert_find_weight(dvert, defgrp_index);
 				}
 			}
 		}
 		else {
-			for(i=0; i < totvert; i++, dvert++) {
-				weights[i]= defvert_find_weight(dvert, defgrp_index);
+			for (i = 0; i < totvert; i++, dvert++) {
+				weights[i] = defvert_find_weight(dvert, defgrp_index);
 			}
 		}
 
@@ -1054,74 +1077,54 @@ static float *get_weights_array(Object *ob, char *vgroup)
 
 static void do_mesh_key(Scene *scene, Object *ob, Key *key, char *out, const int tot)
 {
-	KeyBlock *k[4], *actkb= ob_get_keyblock(ob);
-	float cfra, ctime, t[4], delta;
-	int a, flag = 0, step;
-	
-	if(key->slurph && key->type!=KEY_RELATIVE ) {
-		delta= key->slurph;
-		delta/= tot;
-		
-		step= 1;
-		if(tot>100 && slurph_opt) {
-			step= tot/50;
-			delta*= step;
+	KeyBlock *k[4], *actkb = ob_get_keyblock(ob);
+	float t[4];
+	int flag = 0;
+
+	if (key->slurph && key->type != KEY_RELATIVE) {
+		const float ctime_scaled = key->ctime / 100.0f;
+		float delta = (float)key->slurph / tot;
+		float cfra = (float)scene->r.cfra;
+		int step, a;
+
+		if (tot > 100 && slurph_opt) {
+			step = tot / 50;
+			delta *= step;
 			/* in do_key and cp_key the case a>tot is handled */
 		}
-		
-		cfra= (float)scene->r.cfra;
-		
-		for(a=0; a<tot; a+=step, cfra+= delta) {
-			
-			ctime= BKE_curframe(scene);
-#if 0 // XXX old animation system
-			if(calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) {
-				ctime /= 100.0;
-				CLAMP(ctime, 0.0, 1.0);
-			}
-#endif // XXX old animation system
-			// XXX for now... since speed curve cannot be directly ported yet
-			ctime /= 100.0f;
-			CLAMP(ctime, 0.0f, 1.0f); // XXX for compat, we use this, but this clamping was confusing
-		
-			flag= setkeys(ctime, &key->block, k, t, 0);
+		else {
+			step = 1;
+		}
+
+		for (a = 0; a < tot; a += step, cfra += delta) {
+			flag = setkeys(ctime_scaled, &key->block, k, t, 0);
 
-			if(flag==0)
-				do_key(a, a+step, tot, (char *)out, key, actkb, k, t, KEY_MODE_DUMMY);
+			if (flag == 0)
+				do_key(a, a + step, tot, (char *)out, key, actkb, k, t, KEY_MODE_DUMMY);
 			else
-				cp_key(a, a+step, tot, (char *)out, key, actkb, k[2], NULL, KEY_MODE_DUMMY);
+				cp_key(a, a + step, tot, (char *)out, key, actkb, k[2], NULL, KEY_MODE_DUMMY);
 		}
 	}
 	else {
-		if(key->type==KEY_RELATIVE) {
+		if (key->type == KEY_RELATIVE) {
 			KeyBlock *kb;
-			
-			for(kb= key->block.first; kb; kb= kb->next)
-				kb->weights= get_weights_array(ob, kb->vgroup);
+			for (kb = key->block.first; kb; kb = kb->next) {
+				kb->weights = get_weights_array(ob, kb->vgroup);
+			}
 
 			do_rel_key(0, tot, tot, (char *)out, key, actkb, KEY_MODE_DUMMY);
 			
-			for(kb= key->block.first; kb; kb= kb->next) {
-				if(kb->weights) MEM_freeN(kb->weights);
-				kb->weights= NULL;
+			for (kb = key->block.first; kb; kb = kb->next) {
+				if (kb->weights) MEM_freeN(kb->weights);
+				kb->weights = NULL;
 			}
 		}
 		else {
-			ctime= BKE_curframe(scene);
-			
-#if 0 // XXX old animation system
-			if(calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) {
-				ctime /= 100.0;
-				CLAMP(ctime, 0.0, 1.0);
-			}
-#endif // XXX old animation system
-			// XXX for now... since speed curve cannot be directly ported yet
-			ctime /= 100.0f;
-			CLAMP(ctime, 0.0f, 1.0f); // XXX for compat, we use this, but this clamping was confusing
-			
-			flag= setkeys(ctime, &key->block, k, t, 0);
+			const float ctime_scaled = key->ctime / 100.0f;
+
+			flag = setkeys(ctime_scaled, &key->block, k, t, 0);
 
-			if(flag==0)
+			if (flag == 0)
 				do_key(0, tot, tot, (char *)out, key, actkb, k, t, KEY_MODE_DUMMY);
 			else
 				cp_key(0, tot, tot, (char *)out, key, actkb, k[2], NULL, KEY_MODE_DUMMY);
@@ -1134,95 +1137,101 @@ static void do_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock **k, float
 	Nurb *nu;
 	int a, step;
 	
-	for(a=0, nu=cu->nurb.first; nu; nu=nu->next, a+=step) {
-		if(nu->bp) {
-			step= nu->pntsu*nu->pntsv;
-			do_key(a, a+step, tot, out, key, actkb, k, t, KEY_MODE_BPOINT);
+	for (a = 0, nu = cu->nurb.first; nu; nu = nu->next, a += step) {
+		if (nu->bp) {
+			step = nu->pntsu * nu->pntsv;
+			do_key(a, a + step, tot, out, key, actkb, k, t, KEY_MODE_BPOINT);
 		}
-		else if(nu->bezt) {
-			step= 3*nu->pntsu;
-			do_key(a, a+step, tot, out, key, actkb, k, t, KEY_MODE_BEZTRIPLE);
+		else if (nu->bezt) {
+			step = 3 * nu->pntsu;
+			do_key(a, a + step, tot, out, key, actkb, k, t, KEY_MODE_BEZTRIPLE);
+		}
+		else {
+			step = 0;
 		}
-		else
-			step= 0;
 	}
 }
 
-static void do_rel_cu_key(Curve *cu, Key *key, KeyBlock *actkb, float UNUSED(ctime), char *out, const int tot)
+static void do_rel_cu_key(Curve *cu, Key *key, KeyBlock *actkb, char *out, const int tot)
 {
 	Nurb *nu;
 	int a, step;
 	
-	for(a=0, nu=cu->nurb.first; nu; nu=nu->next, a+=step) {
-		if(nu->bp) {
-			step= nu->pntsu*nu->pntsv;
-			do_rel_key(a, a+step, tot, out, key, actkb, KEY_MODE_BPOINT);
+	for (a = 0, nu = cu->nurb.first; nu; nu = nu->next, a += step) {
+		if (nu->bp) {
+			step = nu->pntsu * nu->pntsv;
+			do_rel_key(a, a + step, tot, out, key, actkb, KEY_MODE_BPOINT);
+		}
+		else if (nu->bezt) {
+			step = 3 * nu->pntsu;
+			do_rel_key(a, a + step, tot, out, key, actkb, KEY_MODE_BEZTRIPLE);
 		}
-		else if(nu->bezt) {
-			step= 3*nu->pntsu;
-			do_rel_key(a, a+step, tot, out, key, actkb, KEY_MODE_BEZTRIPLE);
+		else {
+			step = 0;
 		}
-		else
-			step= 0;
 	}
 }
 
 static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const int tot)
 {
-	Curve *cu= ob->data;
-	KeyBlock *k[4], *actkb= ob_get_keyblock(ob);
-	float cfra, ctime, t[4], delta;
-	int a, flag = 0, step = 0;
-
-	if(key->slurph  && key->type!=KEY_RELATIVE) {
+	Curve *cu = ob->data;
+	KeyBlock *k[4], *actkb = ob_get_keyblock(ob);
+	float t[4];
+	int flag = 0;
+
+	if (key->slurph && key->type != KEY_RELATIVE) {
+		const float ctime_scaled = key->ctime / 100.0f;
+		float delta = (float)key->slurph / tot;
+		float cfra = (float)scene->r.cfra;
 		Nurb *nu;
-		int mode=0, i= 0, remain= 0, estep=0, count=0;
-
-		delta= (float)key->slurph / tot;
+		int i = 0, remain = 0;
+		int step, a;
 
-		step= 1;
-		if(tot>100 && slurph_opt) {
-			step= tot/50;
-			delta*= step;
+		if (tot > 100 && slurph_opt) {
+			step = tot / 50;
+			delta *= step;
 			/* in do_key and cp_key the case a>tot has been handled */
 		}
+		else {
+			step = 1;
+		}
 
-		cfra= (float)scene->r.cfra;
+		for (nu = cu->nurb.first; nu; nu = nu->next) {
+			int estep, mode;
 
-		for(nu=cu->nurb.first; nu; nu=nu->next) {
-			if(nu->bp) {
-				mode= KEY_MODE_BPOINT;
-				estep= nu->pntsu*nu->pntsv;
+			if (nu->bp) {
+				mode = KEY_MODE_BPOINT;
+				estep = nu->pntsu * nu->pntsv;
 			}
-			else if(nu->bezt) {
-				mode= KEY_MODE_BEZTRIPLE;
-				estep= 3*nu->pntsu;
+			else if (nu->bezt) {
+				mode = KEY_MODE_BEZTRIPLE;
+				estep = 3 * nu->pntsu;
+			}
+			else {
+				mode = 0;
+				estep = 0;
 			}
-			else
-				step= 0;
 
-			a= 0;
+			a = 0;
 			while (a < estep) {
-				if (remain <= 0) {
-					cfra+= delta;
-					ctime= BKE_curframe(scene);
+				int count;
 
-					ctime /= 100.0f;
-					CLAMP(ctime, 0.0f, 1.0f); // XXX for compat, we use this, but this clamping was confusing
-					flag= setkeys(ctime, &key->block, k, t, 0);
+				if (remain <= 0) {
+					cfra += delta;
+					flag = setkeys(ctime_scaled, &key->block, k, t, 0);
 
-					remain= step;
+					remain = step;
 				}
 
-				count= MIN2(remain, estep);
+				count = MIN2(remain, estep);
 				if (mode == KEY_MODE_BEZTRIPLE) {
 					count += 3 - count % 3;
 				}
 
-				if(flag==0)
-					do_key(i, i+count, tot, (char *)out, key, actkb, k, t, mode);
+				if (flag == 0)
+					do_key(i, i + count, tot, (char *)out, key, actkb, k, t, mode);
 				else
-					cp_key(i, i+count, tot, (char *)out, key, actkb, k[2], NULL, mode);
+					cp_key(i, i + count, tot, (char *)out, key, actkb, k[2], NULL, mode);
 
 				a += count;
 				i += count;
@@ -1231,23 +1240,15 @@ static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const in
 		}
 	}
 	else {
-		
-		ctime= BKE_curframe(scene);
-		
-		if(key->type==KEY_RELATIVE) {
-			do_rel_cu_key(cu, cu->key, actkb, ctime, out, tot);
+		if (key->type == KEY_RELATIVE) {
+			do_rel_cu_key(cu, cu->key, actkb, out, tot);
 		}
 		else {
-#if 0 // XXX old animation system
-			if(calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) {
-				ctime /= 100.0;
-				CLAMP(ctime, 0.0, 1.0);
-			}
-#endif // XXX old animation system
-			
-			flag= setkeys(ctime, &key->block, k, t, 0);
-			
-			if(flag==0) do_cu_key(cu, key, actkb, k, t, out, tot);
+			const float ctime_scaled = key->ctime / 100.0f;
+
+			flag = setkeys(ctime_scaled, &key->block, k, t, 0);
+
+			if (flag == 0) do_cu_key(cu, key, actkb, k, t, out, tot);
 			else cp_cu_key(cu, key, actkb, k[2], 0, tot, out, tot);
 		}
 	}
@@ -1255,172 +1256,156 @@ static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const in
 
 static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int tot)
 {
-	Lattice *lt= ob->data;
-	KeyBlock *k[4], *actkb= ob_get_keyblock(ob);
-	float delta, cfra, ctime, t[4];
-	int a, flag;
+	Lattice *lt = ob->data;
+	KeyBlock *k[4], *actkb = ob_get_keyblock(ob);
+	float t[4];
+	int flag;
 	
-	if(key->slurph) {
-		delta= key->slurph;
-		delta/= (float)tot;
-		
-		cfra= (float)scene->r.cfra;
-		
-		for(a=0; a<tot; a++, cfra+= delta) {
-			
-			ctime= BKE_curframe(scene);
-#if 0 // XXX old animation system
-			if(calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) {
-				ctime /= 100.0;
-				CLAMP(ctime, 0.0, 1.0);
-			}
-#endif // XXX old animation system
-		
-			flag= setkeys(ctime, &key->block, k, t, 0);
+	if (key->slurph  && key->type != KEY_RELATIVE) {
+		const float ctime_scaled = key->ctime / 100.0f;
+		float delta = (float)key->slurph / tot;
+		float cfra = (float)scene->r.cfra;
+		int a;
+
+		for (a = 0; a < tot; a++, cfra += delta) {
+			flag = setkeys(ctime_scaled, &key->block, k, t, 0);
 
-			if(flag==0)
-				do_key(a, a+1, tot, out, key, actkb, k, t, KEY_MODE_DUMMY);
+			if (flag == 0)
+				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);
+				cp_key(a, a + 1, tot, out, key, actkb, k[2], NULL, KEY_MODE_DUMMY);
 		}		
 	}
 	else {
-		if(key->type==KEY_RELATIVE) {
+		if (key->type == KEY_RELATIVE) {
 			KeyBlock *kb;
 			
-			for(kb= key->block.first; kb; kb= kb->next)
-				kb->weights= get_weights_array(ob, kb->vgroup);
+			for (kb = key->block.first; kb; kb = kb->next)
+				kb->weights = get_weights_array(ob, kb->vgroup);
 			
 			do_rel_key(0, tot, tot, out, key, actkb, KEY_MODE_DUMMY);
 			
-			for(kb= key->block.first; kb; kb= kb->next) {
-				if(kb->weights) MEM_freeN(kb->weights);
-				kb->weights= NULL;
+			for (kb = key->block.first; kb; kb = kb->next) {
+				if (kb->weights) MEM_freeN(kb->weights);
+				kb->weights = NULL;
 			}
 		}
 		else {
-			ctime= BKE_curframe(scene);
-
-#if 0 // XXX old animation system
-			if(calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) {
-				ctime /= 100.0;
-				CLAMP(ctime, 0.0, 1.0);
-			}
-#endif // XXX old animation system
+			const float ctime_scaled = key->ctime / 100.0f;
 			
-			flag= setkeys(ctime, &key->block, k, t, 0);
+			flag = setkeys(ctime_scaled, &key->block, k, t, 0);
 
-			if(flag==0)
+			if (flag == 0)
 				do_key(0, tot, tot, (char *)out, key, actkb, k, t, KEY_MODE_DUMMY);
 			else
 				cp_key(0, tot, tot, (char *)out, key, actkb, k[2], NULL, KEY_MODE_DUMMY);
 		}
 	}
 	
-	if(lt->flag & LT_OUTSIDE) outside_lattice(lt);
+	if (lt->flag & LT_OUTSIDE) outside_lattice(lt);
 }
 
 /* returns key coordinates (+ tilt) when key applied, NULL otherwise */
 float *do_ob_key(Scene *scene, Object *ob)
 {
-	Key *key= ob_get_key(ob);
-	KeyBlock *actkb= ob_get_keyblock(ob);
+	Key *key = ob_get_key(ob);
+	KeyBlock *actkb = ob_get_keyblock(ob);
 	char *out;
-	int tot= 0, size= 0;
+	int tot = 0, size = 0;
 	
-	if(key==NULL || key->block.first==NULL)
+	if (key == NULL || key->block.first == NULL)
 		return NULL;
 
 	/* compute size of output array */
-	if(ob->type == OB_MESH) {
-		Mesh *me= ob->data;
+	if (ob->type == OB_MESH) {
+		Mesh *me = ob->data;
 
-		tot= me->totvert;
-		size= tot*3*sizeof(float);
+		tot = me->totvert;
+		size = tot * 3 * sizeof(float);
 	}
-	else if(ob->type == OB_LATTICE) {
-		Lattice *lt= ob->data;
+	else if (ob->type == OB_LATTICE) {
+		Lattice *lt = ob->data;
 
-		tot= lt->pntsu*lt->pntsv*lt->pntsw;
-		size= tot*3*sizeof(float);
+		tot = lt->pntsu * lt->pntsv * lt->pntsw;
+		size = tot * 3 * sizeof(float);
 	}
-	else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
-		Curve *cu= ob->data;
+	else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
+		Curve *cu = ob->data;
 		Nurb *nu;
 
-		for(nu=cu->nurb.first; nu; nu=nu->next) {
-			if(nu->bezt) {
-				tot += 3*nu->pntsu;
-				size += nu->pntsu*12*sizeof(float);
+		for (nu = cu->nurb.first; nu; nu = nu->next) {
+			if (nu->bezt) {
+				tot += 3 * nu->pntsu;
+				size += nu->pntsu * 12 * sizeof(float);
 			}
-			else if(nu->bp) {
-				tot += nu->pntsu*nu->pntsv;
-				size += nu->pntsu*nu->pntsv*12*sizeof(float);
+			else if (nu->bp) {
+				tot += nu->pntsu * nu->pntsv;
+				size += nu->pntsu * nu->pntsv * 12 * sizeof(float);
 			}
 		}
 	}
 
 	/* if nothing to interpolate, cancel */
-	if(tot == 0 || size == 0)
+	if (tot == 0 || size == 0)
 		return NULL;
 	
 	/* allocate array */
-	out= MEM_callocN(size, "do_ob_key out");
+	out = MEM_callocN(size, "do_ob_key out");
 
 	/* prevent python from screwing this up? anyhoo, the from pointer could be dropped */
-	key->from= (ID *)ob->data;
+	key->from = (ID *)ob->data;
 		
-	if(ob->shapeflag & OB_SHAPE_LOCK) {
+	if (ob->shapeflag & OB_SHAPE_LOCK) {
 		/* shape locked, copy the locked shape instead of blending */
-		KeyBlock *kb= BLI_findlink(&key->block, ob->shapenr-1);
+		KeyBlock *kb = BLI_findlink(&key->block, ob->shapenr - 1);
 		
-		if(kb && (kb->flag & KEYBLOCK_MUTE))
-			kb= key->refkey;
+		if (kb && (kb->flag & KEYBLOCK_MUTE))
+			kb = key->refkey;
 
-		if(kb==NULL) {
-			kb= key->block.first;
-			ob->shapenr= 1;
+		if (kb == NULL) {
+			kb = key->block.first;
+			ob->shapenr = 1;
 		}
 		
 		if (OB_TYPE_SUPPORT_VGROUP(ob->type)) {
-			float *weights= get_weights_array(ob, kb->vgroup);
+			float *weights = get_weights_array(ob, kb->vgroup);
 
 			cp_key(0, tot, tot, out, key, actkb, kb, weights, 0);
 
-			if(weights) MEM_freeN(weights);
+			if (weights) MEM_freeN(weights);
 		}
-		else if(ELEM(ob->type, OB_CURVE, OB_SURF))
+		else if (ELEM(ob->type, OB_CURVE, OB_SURF))
 			cp_cu_key(ob->data, key, actkb, kb, 0, tot, out, tot);
 	}
 	else {
 		/* do shapekey local drivers */
-		float ctime= (float)scene->r.cfra; // XXX this needs to be checked
-		
+		float ctime = (float)scene->r.cfra; // XXX this needs to be checked
+
 		BKE_animsys_evaluate_animdata(scene, &key->id, key->adt, ctime, ADT_RECALC_DRIVERS);
 		
-		if(ob->type==OB_MESH) do_mesh_key(scene, ob, key, out, tot);
-		else if(ob->type==OB_LATTICE) do_latt_key(scene, ob, key, out, tot);
-		else if(ob->type==OB_CURVE) do_curve_key(scene, ob, key, out, tot);
-		else if(ob->type==OB_SURF) do_curve_key(scene, ob, key, out, tot);
+		if (ob->type == OB_MESH) do_mesh_key(scene, ob, key, out, tot);
+		else if (ob->type == OB_LATTICE) do_latt_key(scene, ob, key, out, tot);
+		else if (ob->type == OB_CURVE) do_curve_key(scene, ob, key, out, tot);
+		else if (ob->type == OB_SURF) do_curve_key(scene, ob, key, out, tot);
 	}
 	
-	return (float*)out;
+	return (float *)out;
 }
 
 Key *ob_get_key(Object *ob)
 {
-	if(ob==NULL) return NULL;
+	if (ob == NULL) return NULL;
 	
-	if(ob->type==OB_MESH) {
-		Mesh *me= ob->data;
+	if (ob->type == OB_MESH) {
+		Mesh *me = ob->data;
 		return me->key;
 	}
-	else if ELEM(ob->type, OB_CURVE, OB_SURF) {
-		Curve *cu= ob->data;
+	else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
+		Curve *cu = ob->data;
 		return cu->key;
 	}
-	else if(ob->type==OB_LATTICE) {
-		Lattice *lt= ob->data;
+	else if (ob->type == OB_LATTICE) {
+		Lattice *lt = ob->data;
 		return lt->key;
 	}
 	return NULL;
@@ -1429,59 +1414,68 @@ Key *ob_get_key(Object *ob)
 KeyBlock *add_keyblock(Key *key, const char *name)
 {
 	KeyBlock *kb;
-	float curpos= -0.1;
+	float curpos = -0.1;
 	int tot;
 	
-	kb= key->block.last;
-	if(kb) curpos= kb->pos;
+	kb = key->block.last;
+	if (kb) curpos = kb->pos;
 	
-	kb= MEM_callocN(sizeof(KeyBlock), "Keyblock");
+	kb = MEM_callocN(sizeof(KeyBlock), "Keyblock");
 	BLI_addtail(&key->block, kb);
-	kb->type= KEY_CARDINAL;
+	kb->type = KEY_CARDINAL;
 	
-	tot= BLI_countlist(&key->block);
-	if(name) {
+	tot = BLI_countlist(&key->block);
+	if (name) {
 		BLI_strncpy(kb->name, name, sizeof(kb->name));
-	} else {
-		if(tot==1) BLI_strncpy(kb->name, "Basis", sizeof(kb->name));
-		else BLI_snprintf(kb->name, sizeof(kb->name), "Key %d", tot-1);
+	}
+	else {
+		if (tot == 1) BLI_strncpy(kb->name, "Basis", sizeof(kb->name));
+		else BLI_snprintf(kb->name, sizeof(kb->name), "Key %d", tot - 1);
 	}
 
 	BLI_uniquename(&key->block, kb, "Key", '.', offsetof(KeyBlock, name), sizeof(kb->name));
 
-	// XXX this is old anim system stuff? (i.e. the 'index' of the shapekey)
-	kb->adrcode= tot-1;
-	
+	kb->uid = key->uidgen++;
+
 	key->totkey++;
-	if(key->totkey==1) key->refkey= kb;
-	
-	kb->slidermin= 0.0f;
-	kb->slidermax= 1.0f;
+	if (key->totkey == 1) key->refkey = kb;
 	
-	// XXX kb->pos is the confusing old horizontal-line RVK crap in old IPO Editor...
-	if(key->type == KEY_RELATIVE) 
-		kb->pos= curpos + 0.1f;
-	else {
-#if 0 // XXX old animation system
-		curpos= BKE_curframe(scene);
-		if(calc_ipo_spec(key->ipo, KEY_SPEED, &curpos)==0) {
-			curpos /= 100.0;
-		}
-		kb->pos= curpos;
-		
+	kb->slidermin = 0.0f;
+	kb->slidermax = 1.0f;
+
+	/**
+	 * \note caller may want to set this to current time, but don't do it here since we need to sort
+	 * which could cause problems in some cases, see #add_keyblock_ctime */
+	kb->pos = curpos + 0.1f; /* only used for absolute shape keys */
+
+	return kb;
+}
+
+/**
+ * \note sorting is a problematic side effect in some cases,
+ * better only do this explicitly by having its own function,
+ *
+ * \param do_force always use ctime even for relative keys.
+ */
+KeyBlock *add_keyblock_ctime(Key *key, const char *name, const short do_force)
+{
+	KeyBlock *kb = add_keyblock(key, name);
+
+	if (do_force || (key->type != KEY_RELATIVE)) {
+		kb->pos = key->ctime / 100.0f;
 		sort_keys(key);
-#endif // XXX old animation system
 	}
+
 	return kb;
 }
 
 /* only the active keyblock */
 KeyBlock *ob_get_keyblock(Object *ob) 
 {
-	Key *key= ob_get_key(ob);
+	Key *key = ob_get_key(ob);
 	
 	if (key) {
-		KeyBlock *kb= BLI_findlink(&key->block, ob->shapenr-1);
+		KeyBlock *kb = BLI_findlink(&key->block, ob->shapenr - 1);
 		return kb;
 	}
 
@@ -1490,7 +1484,7 @@ KeyBlock *ob_get_keyblock(Object *ob)
 
 KeyBlock *ob_get_reference_keyblock(Object *ob)
 {
-	Key *key= ob_get_key(ob);
+	Key *key = ob_get_key(ob);
 	
 	if (key)
 		return key->refkey;
@@ -1505,12 +1499,12 @@ KeyBlock *key_get_keyblock(Key *key, int index)
 	int i;
 	
 	if (key) {
-		kb= key->block.first;
+		kb = key->block.first;
 		
-		for (i= 1; i < key->totkey; i++) {
-			kb= kb->next;
+		for (i = 1; i < key->totkey; i++) {
+			kb = kb->next;
 			
-			if (index==i)
+			if (index == i)
 				return kb;
 		}
 	}
@@ -1528,7 +1522,7 @@ KeyBlock *key_get_named_keyblock(Key *key, const char name[])
 }
 
 /* Get RNA-Path for 'value' setting of the given ShapeKey 
- * NOTE: the user needs to free the returned string once they're finishe with it
+ * NOTE: the user needs to free the returned string once they're finish with it
  */
 char *key_get_curValue_rnaPath(Key *key, KeyBlock *kb)
 {
@@ -1536,13 +1530,13 @@ char *key_get_curValue_rnaPath(Key *key, KeyBlock *kb)
 	PropertyRNA *prop;
 	
 	/* sanity checks */
-	if ELEM(NULL, key, kb)
+	if (ELEM(NULL, key, kb))
 		return NULL;
 	
 	/* create the RNA pointer */
 	RNA_pointer_create(&key->id, &RNA_ShapeKey, kb, &ptr);
 	/* get pointer to the property too */
-	prop= RNA_struct_find_property(&ptr, "value");
+	prop = RNA_struct_find_property(&ptr, "value");
 	
 	/* return the path */
 	return RNA_path_from_ID_to_property(&ptr, prop);
@@ -1558,17 +1552,17 @@ void latt_to_key(Lattice *lt, KeyBlock *kb)
 	float *fp;
 	int a, tot;
 
-	tot= lt->pntsu*lt->pntsv*lt->pntsw;
-	if(tot==0) return;
+	tot = lt->pntsu * lt->pntsv * lt->pntsw;
+	if (tot == 0) return;
 
-	if(kb->data) MEM_freeN(kb->data);
+	if (kb->data) MEM_freeN(kb->data);
 
-	kb->data= MEM_callocN(lt->key->elemsize*tot, "kb->data");
-	kb->totelem= tot;
+	kb->data = MEM_callocN(lt->key->elemsize * tot, "kb->data");
+	kb->totelem = tot;
 
-	bp= lt->def;
-	fp= kb->data;
-	for(a=0; a<kb->totelem; a++, fp+=3, bp++) {
+	bp = lt->def;
+	fp = kb->data;
+	for (a = 0; a < kb->totelem; a++, fp += 3, bp++) {
 		copy_v3_v3(fp, bp->vec);
 	}
 }
@@ -1579,13 +1573,13 @@ void key_to_latt(KeyBlock *kb, Lattice *lt)
 	float *fp;
 	int a, tot;
 
-	bp= lt->def;
-	fp= kb->data;
+	bp = lt->def;
+	fp = kb->data;
 
-	tot= lt->pntsu*lt->pntsv*lt->pntsw;
-	tot= MIN2(kb->totelem, tot);
+	tot = lt->pntsu * lt->pntsv * lt->pntsw;
+	tot = MIN2(kb->totelem, tot);
 
-	for(a=0; a<tot; a++, fp+=3, bp++) {
+	for (a = 0; a < tot; a++, fp += 3, bp++) {
 		copy_v3_v3(bp->vec, fp);
 	}
 }
@@ -1600,45 +1594,45 @@ void curve_to_key(Curve *cu, KeyBlock *kb, ListBase *nurb)
 	int a, tot;
 
 	/* count */
-	tot= count_curveverts(nurb);
-	if(tot==0) return;
+	tot = count_curveverts(nurb);
+	if (tot == 0) return;
 
-	if(kb->data) MEM_freeN(kb->data);
+	if (kb->data) MEM_freeN(kb->data);
 
-	kb->data= MEM_callocN(cu->key->elemsize*tot, "kb->data");
-	kb->totelem= tot;
+	kb->data = MEM_callocN(cu->key->elemsize * tot, "kb->data");
+	kb->totelem = tot;
 
-	nu= nurb->first;
-	fp= kb->data;
-	while(nu) {
+	nu = nurb->first;
+	fp = kb->data;
+	while (nu) {
 
-		if(nu->bezt) {
-			bezt= nu->bezt;
-			a= nu->pntsu;
-			while(a--) {
+		if (nu->bezt) {
+			bezt = nu->bezt;
+			a = nu->pntsu;
+			while (a--) {
 				copy_v3_v3(fp, bezt->vec[0]);
-				fp+= 3;
+				fp += 3;
 				copy_v3_v3(fp, bezt->vec[1]);
-				fp+= 3;
+				fp += 3;
 				copy_v3_v3(fp, bezt->vec[2]);
-				fp+= 3;
-				fp[0]= bezt->alfa;
-				fp+= 3;	/* alphas */
+				fp += 3;
+				fp[0] = bezt->alfa;
+				fp += 3; /* alphas */
 				bezt++;
 			}
 		}
 		else {
-			bp= nu->bp;
-			a= nu->pntsu*nu->pntsv;
-			while(a--) {
+			bp = nu->bp;
+			a = nu->pntsu * nu->pntsv;
+			while (a--) {
 				copy_v3_v3(fp, bp->vec);
-				fp[3]= bp->alfa;
+				fp[3] = bp->alfa;
 
-				fp+= 4;
+				fp += 4;
 				bp++;
 			}
 		}
-		nu= nu->next;
+		nu = nu->next;
 	}
 }
 
@@ -1650,45 +1644,45 @@ void key_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb)
 	float *fp;
 	int a, tot;
 
-	nu= nurb->first;
-	fp= kb->data;
+	nu = nurb->first;
+	fp = kb->data;
 
-	tot= count_curveverts(nurb);
+	tot = count_curveverts(nurb);
 
-	tot= MIN2(kb->totelem, tot);
+	tot = MIN2(kb->totelem, tot);
 
-	while(nu && tot>0) {
+	while (nu && tot > 0) {
 
-		if(nu->bezt) {
-			bezt= nu->bezt;
-			a= nu->pntsu;
-			while(a-- && tot>0) {
+		if (nu->bezt) {
+			bezt = nu->bezt;
+			a = nu->pntsu;
+			while (a-- && tot > 0) {
 				copy_v3_v3(bezt->vec[0], fp);
-				fp+= 3;
+				fp += 3;
 				copy_v3_v3(bezt->vec[1], fp);
-				fp+= 3;
+				fp += 3;
 				copy_v3_v3(bezt->vec[2], fp);
-				fp+= 3;
-				bezt->alfa= fp[0];
-				fp+= 3;	/* alphas */
+				fp += 3;
+				bezt->alfa = fp[0];
+				fp += 3; /* alphas */
 
-				tot-= 3;
+				tot -= 3;
 				bezt++;
 			}
 		}
 		else {
-			bp= nu->bp;
-			a= nu->pntsu*nu->pntsv;
-			while(a-- && tot>0) {
+			bp = nu->bp;
+			a = nu->pntsu * nu->pntsv;
+			while (a-- && tot > 0) {
 				copy_v3_v3(bp->vec, fp);
-				bp->alfa= fp[3];
+				bp->alfa = fp[3];
 
-				fp+= 4;
+				fp += 4;
 				tot--;
 				bp++;
 			}
 		}
-		nu= nu->next;
+		nu = nu->next;
 	}
 }
 
@@ -1699,16 +1693,16 @@ void mesh_to_key(Mesh *me, KeyBlock *kb)
 	float *fp;
 	int a;
 
-	if(me->totvert==0) return;
+	if (me->totvert == 0) return;
 
-	if(kb->data) MEM_freeN(kb->data);
+	if (kb->data) MEM_freeN(kb->data);
 
-	kb->data= MEM_callocN(me->key->elemsize*me->totvert, "kb->data");
-	kb->totelem= me->totvert;
+	kb->data = MEM_callocN(me->key->elemsize * me->totvert, "kb->data");
+	kb->totelem = me->totvert;
 
-	mvert= me->mvert;
-	fp= kb->data;
-	for(a=0; a<kb->totelem; a++, fp+=3, mvert++) {
+	mvert = me->mvert;
+	fp = kb->data;
+	for (a = 0; a < kb->totelem; a++, fp += 3, mvert++) {
 		copy_v3_v3(fp, mvert->co);
 
 	}
@@ -1720,84 +1714,87 @@ void key_to_mesh(KeyBlock *kb, Mesh *me)
 	float *fp;
 	int a, tot;
 
-	mvert= me->mvert;
-	fp= kb->data;
+	mvert = me->mvert;
+	fp = kb->data;
 
-	tot= MIN2(kb->totelem, me->totvert);
+	tot = MIN2(kb->totelem, me->totvert);
 
-	for(a=0; a<tot; a++, fp+=3, mvert++) {
+	for (a = 0; a < tot; a++, fp += 3, mvert++) {
 		copy_v3_v3(mvert->co, fp);
 	}
 }
 
 /************************* vert coords ************************/
-float (*key_to_vertcos(Object *ob, KeyBlock *kb))[3]
+float (*key_to_vertcos(Object * ob, KeyBlock * kb))[3]
 {
 	float (*vertCos)[3], *co;
-	float *fp= kb->data;
-	int tot= 0, a;
+	float *fp = kb->data;
+	int tot = 0, a;
 
 	/* Count of vertex coords in array */
-	if(ob->type == OB_MESH) {
-		Mesh *me= (Mesh*)ob->data;
-		tot= me->totvert;
-	} else if(ob->type == OB_LATTICE) {
-		Lattice *lt= (Lattice*)ob->data;
-		tot= lt->pntsu*lt->pntsv*lt->pntsw;
-	} else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
-		Curve *cu= (Curve*)ob->data;
-		tot= count_curveverts(&cu->nurb);
+	if (ob->type == OB_MESH) {
+		Mesh *me = (Mesh *)ob->data;
+		tot = me->totvert;
+	}
+	else if (ob->type == OB_LATTICE) {
+		Lattice *lt = (Lattice *)ob->data;
+		tot = lt->pntsu * lt->pntsv * lt->pntsw;
+	}
+	else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
+		Curve *cu = (Curve *)ob->data;
+		tot = count_curveverts(&cu->nurb);
 	}
 
 	if (tot == 0) return NULL;
 
-	vertCos= MEM_callocN(tot*sizeof(*vertCos), "key_to_vertcos vertCos");
+	vertCos = MEM_callocN(tot * sizeof(*vertCos), "key_to_vertcos vertCos");
 
 	/* Copy coords to array */
-	co= (float*)vertCos;
+	co = (float *)vertCos;
 
-	if(ELEM(ob->type, OB_MESH, OB_LATTICE)) {
-		for (a= 0; a<tot; a++, fp+=3, co+=3) {
+	if (ELEM(ob->type, OB_MESH, OB_LATTICE)) {
+		for (a = 0; a < tot; a++, fp += 3, co += 3) {
 			copy_v3_v3(co, fp);
 		}
-	} else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
-		Curve *cu= (Curve*)ob->data;
-		Nurb *nu= cu->nurb.first;
+	}
+	else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
+		Curve *cu = (Curve *)ob->data;
+		Nurb *nu = cu->nurb.first;
 		BezTriple *bezt;
 		BPoint *bp;
 
 		while (nu) {
-			if(nu->bezt) {
+			if (nu->bezt) {
 				int i;
-				bezt= nu->bezt;
-				a= nu->pntsu;
+				bezt = nu->bezt;
+				a = nu->pntsu;
 
 				while (a--) {
-					for (i= 0; i<3; i++) {
+					for (i = 0; i < 3; i++) {
 						copy_v3_v3(co, fp);
-						fp+= 3; co+= 3;
+						fp += 3; co += 3;
 					}
 
-					fp+= 3; /* skip alphas */
+					fp += 3; /* skip alphas */
 
 					bezt++;
 				}
 			}
 			else {
-				bp= nu->bp;
-				a= nu->pntsu*nu->pntsv;
+				bp = nu->bp;
+				a = nu->pntsu * nu->pntsv;
 
 				while (a--) {
 					copy_v3_v3(co, fp);
 
-					fp+= 4;
-					co+= 3;
+					fp += 4;
+					co += 3;
 
 					bp++;
 				}
 			}
 
-			nu= nu->next;
+			nu = nu->next;
 		}
 	}
 
@@ -1806,77 +1803,80 @@ float (*key_to_vertcos(Object *ob, KeyBlock *kb))[3]
 
 void vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
 {
-	float *co= (float*)vertCos, *fp;
-	int tot= 0, a, elemsize;
+	float *co = (float *)vertCos, *fp;
+	int tot = 0, a, elemsize;
 
 	if (kb->data) MEM_freeN(kb->data);
 
 	/* Count of vertex coords in array */
-	if(ob->type == OB_MESH) {
-		Mesh *me= (Mesh*)ob->data;
-		tot= me->totvert;
-		elemsize= me->key->elemsize;
-	} else if(ob->type == OB_LATTICE) {
-		Lattice *lt= (Lattice*)ob->data;
-		tot= lt->pntsu*lt->pntsv*lt->pntsw;
-		elemsize= lt->key->elemsize;
-	} else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
-		Curve *cu= (Curve*)ob->data;
-		elemsize= cu->key->elemsize;
-		tot= count_curveverts(&cu->nurb);
+	if (ob->type == OB_MESH) {
+		Mesh *me = (Mesh *)ob->data;
+		tot = me->totvert;
+		elemsize = me->key->elemsize;
+	}
+	else if (ob->type == OB_LATTICE) {
+		Lattice *lt = (Lattice *)ob->data;
+		tot = lt->pntsu * lt->pntsv * lt->pntsw;
+		elemsize = lt->key->elemsize;
+	}
+	else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
+		Curve *cu = (Curve *)ob->data;
+		elemsize = cu->key->elemsize;
+		tot = count_curveverts(&cu->nurb);
 	}
 
 	if (tot == 0) {
-		kb->data= NULL;
+		kb->data = NULL;
 		return;
 	}
 
-	fp= kb->data= MEM_callocN(tot*elemsize, "key_to_vertcos vertCos");
+	fp = kb->data = MEM_callocN(tot * elemsize, "key_to_vertcos vertCos");
 
 	/* Copy coords to keyblock */
 
-	if(ELEM(ob->type, OB_MESH, OB_LATTICE)) {
-		for (a= 0; a<tot; a++, fp+=3, co+=3) {
+	if (ELEM(ob->type, OB_MESH, OB_LATTICE)) {
+		for (a = 0; a < tot; a++, fp += 3, co += 3) {
 			copy_v3_v3(fp, co);
 		}
-	} else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
-		Curve *cu= (Curve*)ob->data;
-		Nurb *nu= cu->nurb.first;
+	}
+	else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
+		Curve *cu = (Curve *)ob->data;
+		Nurb *nu = cu->nurb.first;
 		BezTriple *bezt;
 		BPoint *bp;
 
 		while (nu) {
-			if(nu->bezt) {
+			if (nu->bezt) {
 				int i;
-				bezt= nu->bezt;
-				a= nu->pntsu;
+				bezt = nu->bezt;
+				a = nu->pntsu;
 
 				while (a--) {
-					for (i= 0; i<3; i++) {
+					for (i = 0; i < 3; i++) {
 						copy_v3_v3(fp, co);
-						fp+= 3; co+= 3;
+						fp += 3; co += 3;
 					}
 
-					fp+= 3; /* skip alphas */
+					fp += 3; /* skip alphas */
 
 					bezt++;
 				}
 			}
 			else {
-				bp= nu->bp;
-				a= nu->pntsu*nu->pntsv;
+				bp = nu->bp;
+				a = nu->pntsu * nu->pntsv;
 
 				while (a--) {
 					copy_v3_v3(fp, co);
 
-					fp+= 4;
-					co+= 3;
+					fp += 4;
+					co += 3;
 
 					bp++;
 				}
 			}
 
-			nu= nu->next;
+			nu = nu->next;
 		}
 	}
 }
@@ -1884,50 +1884,51 @@ void vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
 void offset_to_key(Object *ob, KeyBlock *kb, float (*ofs)[3])
 {
 	int a;
-	float *co= (float*)ofs, *fp= kb->data;
+	float *co = (float *)ofs, *fp = kb->data;
 
-	if(ELEM(ob->type, OB_MESH, OB_LATTICE)) {
-		for (a= 0; a<kb->totelem; a++, fp+=3, co+=3) {
+	if (ELEM(ob->type, OB_MESH, OB_LATTICE)) {
+		for (a = 0; a < kb->totelem; a++, fp += 3, co += 3) {
 			add_v3_v3(fp, co);
 		}
-	} else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
-		Curve *cu= (Curve*)ob->data;
-		Nurb *nu= cu->nurb.first;
+	}
+	else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
+		Curve *cu = (Curve *)ob->data;
+		Nurb *nu = cu->nurb.first;
 		BezTriple *bezt;
 		BPoint *bp;
 
 		while (nu) {
-			if(nu->bezt) {
+			if (nu->bezt) {
 				int i;
-				bezt= nu->bezt;
-				a= nu->pntsu;
+				bezt = nu->bezt;
+				a = nu->pntsu;
 
 				while (a--) {
-					for (i= 0; i<3; i++) {
+					for (i = 0; i < 3; i++) {
 						add_v3_v3(fp, co);
-						fp+= 3; co+= 3;
+						fp += 3; co += 3;
 					}
 
-					fp+= 3; /* skip alphas */
+					fp += 3; /* skip alphas */
 
 					bezt++;
 				}
 			}
 			else {
-				bp= nu->bp;
-				a= nu->pntsu*nu->pntsv;
+				bp = nu->bp;
+				a = nu->pntsu * nu->pntsv;
 
 				while (a--) {
 					add_v3_v3(fp, co);
 
-					fp+= 4;
-					co+= 3;
+					fp += 4;
+					co += 3;
 
 					bp++;
 				}
 			}
 
-			nu= nu->next;
+			nu = nu->next;
 		}
 	}
 }
diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c
index 6b4cdc7..e981d77 100644
--- a/source/blender/blenkernel/intern/lamp.c
+++ b/source/blender/blenkernel/intern/lamp.c
@@ -108,8 +108,8 @@ Lamp *copy_lamp(Lamp *la)
 	
 	lan= copy_libblock(&la->id);
 
-	for(a=0; a<MAX_MTEX; a++) {
-		if(lan->mtex[a]) {
+	for (a=0; a<MAX_MTEX; a++) {
+		if (lan->mtex[a]) {
 			lan->mtex[a]= MEM_mallocN(sizeof(MTex), "copylamptex");
 			memcpy(lan->mtex[a], la->mtex[a], sizeof(MTex));
 			id_us_plus((ID *)lan->mtex[a]->tex);
@@ -118,10 +118,10 @@ Lamp *copy_lamp(Lamp *la)
 	
 	lan->curfalloff = curvemapping_copy(la->curfalloff);
 
-	if(la->nodetree)
+	if (la->nodetree)
 		lan->nodetree= ntreeCopyTree(la->nodetree);
 	
-	if(la->preview)
+	if (la->preview)
 		lan->preview = BKE_previewimg_copy(la->preview);
 	
 	return lan;
@@ -135,8 +135,8 @@ Lamp *localize_lamp(Lamp *la)
 	lan= copy_libblock(&la->id);
 	BLI_remlink(&G.main->lamp, lan);
 
-	for(a=0; a<MAX_MTEX; a++) {
-		if(lan->mtex[a]) {
+	for (a=0; a<MAX_MTEX; a++) {
+		if (lan->mtex[a]) {
 			lan->mtex[a]= MEM_mallocN(sizeof(MTex), "localize_lamp");
 			memcpy(lan->mtex[a], la->mtex[a], sizeof(MTex));
 			/* free lamp decrements */
@@ -146,7 +146,7 @@ Lamp *localize_lamp(Lamp *la)
 	
 	lan->curfalloff = curvemapping_copy(la->curfalloff);
 
-	if(la->nodetree)
+	if (la->nodetree)
 		lan->nodetree= ntreeLocalize(la->nodetree);
 	
 	lan->preview= NULL;
@@ -161,29 +161,29 @@ void make_local_lamp(Lamp *la)
 	int is_local= FALSE, is_lib= FALSE;
 
 	/* - only lib users: do nothing
-		* - only local users: set flag
-		* - mixed: make copy
-		*/
+	 * - only local users: set flag
+	 * - mixed: make copy
+	 */
 	
-	if(la->id.lib==NULL) return;
-	if(la->id.us==1) {
+	if (la->id.lib==NULL) return;
+	if (la->id.us==1) {
 		id_clear_lib_data(bmain, &la->id);
 		return;
 	}
 	
 	ob= bmain->object.first;
-	while(ob) {
-		if(ob->data==la) {
-			if(ob->id.lib) is_lib= TRUE;
+	while (ob) {
+		if (ob->data==la) {
+			if (ob->id.lib) is_lib= TRUE;
 			else is_local= TRUE;
 		}
 		ob= ob->id.next;
 	}
 	
-	if(is_local && is_lib == FALSE) {
+	if (is_local && is_lib == FALSE) {
 		id_clear_lib_data(bmain, &la->id);
 	}
-	else if(is_local && is_lib) {
+	else if (is_local && is_lib) {
 		Lamp *la_new= copy_lamp(la);
 		la_new->id.us= 0;
 
@@ -191,10 +191,10 @@ void make_local_lamp(Lamp *la)
 		BKE_id_lib_local_paths(bmain, la->id.lib, &la_new->id);
 
 		ob= bmain->object.first;
-		while(ob) {
-			if(ob->data==la) {
+		while (ob) {
+			if (ob->data==la) {
 				
-				if(ob->id.lib==NULL) {
+				if (ob->id.lib==NULL) {
 					ob->data= la_new;
 					la_new->id.us++;
 					la->id.us--;
@@ -210,10 +210,10 @@ void free_lamp(Lamp *la)
 	MTex *mtex;
 	int a;
 
-	for(a=0; a<MAX_MTEX; a++) {
+	for (a=0; a<MAX_MTEX; a++) {
 		mtex= la->mtex[a];
-		if(mtex && mtex->tex) mtex->tex->id.us--;
-		if(mtex) MEM_freeN(mtex);
+		if (mtex && mtex->tex) mtex->tex->id.us--;
+		if (mtex) MEM_freeN(mtex);
 	}
 	
 	BKE_free_animdata((ID *)la);
@@ -221,7 +221,7 @@ void free_lamp(Lamp *la)
 	curvemapping_free(la->curfalloff);
 
 	/* is no lib link block, but lamp extension */
-	if(la->nodetree) {
+	if (la->nodetree) {
 		ntreeFreeTree(la->nodetree);
 		MEM_freeN(la->nodetree);
 	}
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index 5e4d8d2..f182d7b 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -69,11 +69,11 @@
 
 void calc_lat_fudu(int flag, int res, float *fu, float *du)
 {
-	if(res==1) {
+	if (res==1) {
 		*fu= 0.0;
 		*du= 0.0;
 	}
-	else if(flag & LT_GRID) {
+	else if (flag & LT_GRID) {
 		*fu= -0.5f*(res-1);
 		*du= 1.0f;
 	}
@@ -91,14 +91,14 @@ void resizelattice(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb)
 	float *co, (*vertexCos)[3] = NULL;
 	
 	/* vertex weight groups are just freed all for now */
-	if(lt->dvert) {
+	if (lt->dvert) {
 		free_dverts(lt->dvert, lt->pntsu*lt->pntsv*lt->pntsw);
 		lt->dvert= NULL;
 	}
 	
-	while(uNew*vNew*wNew > 32000) {
-		if( uNew>=vNew && uNew>=wNew) uNew--;
-		else if( vNew>=uNew && vNew>=wNew) vNew--;
+	while (uNew*vNew*wNew > 32000) {
+		if ( uNew>=vNew && uNew>=wNew) uNew--;
+		else if ( vNew>=uNew && vNew>=wNew) vNew--;
 		else wNew--;
 	}
 
@@ -131,9 +131,9 @@ void resizelattice(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb)
 	}
 
 	co = vertexCos[0];
-	for(w=0,wc=fw; w<wNew; w++,wc+=dw) {
-		for(v=0,vc=fv; v<vNew; v++,vc+=dv) {
-			for(u=0,uc=fu; u<uNew; u++,co+=3,uc+=du) {
+	for (w=0,wc=fw; w<wNew; w++,wc+=dw) {
+		for (v=0,vc=fv; v<vNew; v++,vc+=dv) {
+			for (u=0,uc=fu; u<uNew; u++,co+=3,uc+=du) {
 				co[0] = uc;
 				co[1] = vc;
 				co[2] = wc;
@@ -153,7 +153,7 @@ void resizelattice(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb)
 
 		copy_m4_m4(mat, ltOb->obmat);
 		unit_m4(ltOb->obmat);
-		lattice_deform_verts(ltOb, NULL, NULL, vertexCos, uNew*vNew*wNew, NULL);
+		lattice_deform_verts(ltOb, NULL, NULL, vertexCos, uNew*vNew*wNew, NULL, 1.0f);
 		copy_m4_m4(ltOb->obmat, mat);
 
 		lt->typeu = typeu;
@@ -208,9 +208,9 @@ Lattice *copy_lattice(Lattice *lt)
 	ltn->def= MEM_dupallocN(lt->def);
 
 	ltn->key= copy_key(ltn->key);
-	if(ltn->key) ltn->key->from= (ID *)ltn;
+	if (ltn->key) ltn->key->from= (ID *)ltn;
 	
-	if(lt->dvert) {
+	if (lt->dvert) {
 		int tot= lt->pntsu*lt->pntsv*lt->pntsw;
 		ltn->dvert = MEM_mallocN (sizeof (MDeformVert)*tot, "Lattice MDeformVert");
 		copy_dverts(ltn->dvert, lt->dvert, tot);
@@ -223,13 +223,13 @@ Lattice *copy_lattice(Lattice *lt)
 
 void free_lattice(Lattice *lt)
 {
-	if(lt->def) MEM_freeN(lt->def);
-	if(lt->dvert) free_dverts(lt->dvert, lt->pntsu*lt->pntsv*lt->pntsw);
-	if(lt->editlatt) {
+	if (lt->def) MEM_freeN(lt->def);
+	if (lt->dvert) free_dverts(lt->dvert, lt->pntsu*lt->pntsv*lt->pntsw);
+	if (lt->editlatt) {
 		Lattice *editlt= lt->editlatt->latt;
 
-		if(editlt->def) MEM_freeN(editlt->def);
-		if(editlt->dvert) free_dverts(editlt->dvert, lt->pntsu*lt->pntsv*lt->pntsw);
+		if (editlt->def) MEM_freeN(editlt->def);
+		if (editlt->dvert) free_dverts(editlt->dvert, lt->pntsu*lt->pntsv*lt->pntsw);
 
 		MEM_freeN(editlt);
 		MEM_freeN(lt->editlatt);
@@ -254,32 +254,32 @@ void make_local_lattice(Lattice *lt)
 	 * - mixed: make copy
 	 */
 	
-	if(lt->id.lib==NULL) return;
-	if(lt->id.us==1) {
+	if (lt->id.lib==NULL) return;
+	if (lt->id.us==1) {
 		id_clear_lib_data(bmain, &lt->id);
 		return;
 	}
 	
-	for(ob= bmain->object.first; ob && ELEM(FALSE, is_lib, is_local); ob= ob->id.next) {
-		if(ob->data==lt) {
-			if(ob->id.lib) is_lib= TRUE;
+	for (ob= bmain->object.first; ob && ELEM(FALSE, is_lib, is_local); ob= ob->id.next) {
+		if (ob->data==lt) {
+			if (ob->id.lib) is_lib= TRUE;
 			else is_local= TRUE;
 		}
 	}
 	
-	if(is_local && is_lib==FALSE) {
+	if (is_local && is_lib==FALSE) {
 		id_clear_lib_data(bmain, &lt->id);
 	}
-	else if(is_local && is_lib) {
+	else if (is_local && is_lib) {
 		Lattice *lt_new= copy_lattice(lt);
 		lt_new->id.us= 0;
 
 		/* Remap paths of new ID using old library as base. */
 		BKE_id_lib_local_paths(bmain, lt->id.lib, &lt_new->id);
 
-		for(ob= bmain->object.first; ob; ob= ob->id.next) {
-			if(ob->data==lt) {
-				if(ob->id.lib==NULL) {
+		for (ob= bmain->object.first; ob; ob= ob->id.next) {
+			if (ob->data==lt) {
+				if (ob->id.lib==NULL) {
 					ob->data= lt_new;
 					lt_new->id.us++;
 					lt->id.us--;
@@ -300,13 +300,13 @@ void init_latt_deform(Object *oblatt, Object *ob)
 	float fu, fv, fw;
 	int u, v, w;
 
-	if(lt->editlatt) lt= lt->editlatt->latt;
+	if (lt->editlatt) lt= lt->editlatt->latt;
 	bp = lt->def;
 	
 	fp= lt->latticedata= MEM_mallocN(sizeof(float)*3*lt->pntsu*lt->pntsv*lt->pntsw, "latticedata");
 	
 		/* for example with a particle system: ob==0 */
-	if(ob==NULL) {
+	if (ob==NULL) {
 		/* in deformspace, calc matrix  */
 		invert_m4_m4(lt->latmat, oblatt->obmat);
 	
@@ -322,14 +322,15 @@ void init_latt_deform(Object *oblatt, Object *ob)
 		invert_m4_m4(imat, lt->latmat);
 	}
 	
-	for(w=0,fw=lt->fw; w<lt->pntsw; w++,fw+=lt->dw) {
-		for(v=0,fv=lt->fv; v<lt->pntsv; v++, fv+=lt->dv) {
-			for(u=0,fu=lt->fu; u<lt->pntsu; u++, bp++, co+=3, fp+=3, fu+=lt->du) {
+	for (w=0,fw=lt->fw; w<lt->pntsw; w++,fw+=lt->dw) {
+		for (v=0,fv=lt->fv; v<lt->pntsv; v++, fv+=lt->dv) {
+			for (u=0,fu=lt->fu; u<lt->pntsu; u++, bp++, co+=3, fp+=3, fu+=lt->du) {
 				if (dl) {
 					fp[0] = co[0] - fu;
 					fp[1] = co[1] - fv;
 					fp[2] = co[2] - fw;
-				} else {
+				}
+				else {
 					fp[0] = bp->vec[0] - fu;
 					fp[1] = bp->vec[1] - fv;
 					fp[2] = bp->vec[2] - fw;
@@ -355,10 +356,10 @@ void calc_latt_deform(Object *ob, float *co, float weight)
 	MDeformVert *dvert= lattice_get_deform_verts(ob);
 
 
-	if(lt->editlatt) lt= lt->editlatt->latt;
-	if(lt->latticedata==NULL) return;
+	if (lt->editlatt) lt= lt->editlatt->latt;
+	if (lt->latticedata==NULL) return;
 
-	if(lt->vgroup[0] && dvert) {
+	if (lt->vgroup[0] && dvert) {
 		defgroup_nr= defgroup_name_index(ob, lt->vgroup);
 		copy_v3_v3(co_prev, co);
 	}
@@ -368,7 +369,7 @@ void calc_latt_deform(Object *ob, float *co, float weight)
 
 	/* u v w coords */
 
-	if(lt->pntsu>1) {
+	if (lt->pntsu>1) {
 		u= (vec[0]-lt->fu)/lt->du;
 		ui= (int)floor(u);
 		u -= ui;
@@ -379,7 +380,7 @@ void calc_latt_deform(Object *ob, float *co, float weight)
 		ui= 0;
 	}
 
-	if(lt->pntsv>1) {
+	if (lt->pntsv>1) {
 		v= (vec[1]-lt->fv)/lt->dv;
 		vi= (int)floor(v);
 		v -= vi;
@@ -390,7 +391,7 @@ void calc_latt_deform(Object *ob, float *co, float weight)
 		vi= 0;
 	}
 
-	if(lt->pntsw>1) {
+	if (lt->pntsw>1) {
 		w= (vec[2]-lt->fw)/lt->dw;
 		wi= (int)floor(w);
 		w -= wi;
@@ -401,39 +402,39 @@ void calc_latt_deform(Object *ob, float *co, float weight)
 		wi= 0;
 	}
 
-	for(ww= wi-1; ww<=wi+2; ww++) {
+	for (ww= wi-1; ww<=wi+2; ww++) {
 		w= tw[ww-wi+1];
 
-		if(w != 0.0f) {
-			if(ww>0) {
-				if(ww<lt->pntsw) idx_w= ww*lt->pntsu*lt->pntsv;
+		if (w != 0.0f) {
+			if (ww>0) {
+				if (ww<lt->pntsw) idx_w= ww*lt->pntsu*lt->pntsv;
 				else idx_w= (lt->pntsw-1)*lt->pntsu*lt->pntsv;
 			}
 			else idx_w= 0;
 
-			for(vv= vi-1; vv<=vi+2; vv++) {
+			for (vv= vi-1; vv<=vi+2; vv++) {
 				v= w*tv[vv-vi+1];
 
-				if(v != 0.0f) {
-					if(vv>0) {
-						if(vv<lt->pntsv) idx_v= idx_w + vv*lt->pntsu;
+				if (v != 0.0f) {
+					if (vv>0) {
+						if (vv<lt->pntsv) idx_v= idx_w + vv*lt->pntsu;
 						else idx_v= idx_w + (lt->pntsv-1)*lt->pntsu;
 					}
 					else idx_v= idx_w;
 
-					for(uu= ui-1; uu<=ui+2; uu++) {
+					for (uu= ui-1; uu<=ui+2; uu++) {
 						u= weight*v*tu[uu-ui+1];
 
-						if(u != 0.0f) {
-							if(uu>0) {
-								if(uu<lt->pntsu) idx_u= idx_v + uu;
+						if (u != 0.0f) {
+							if (uu>0) {
+								if (uu<lt->pntsu) idx_u= idx_v + uu;
 								else idx_u= idx_v + (lt->pntsu-1);
 							}
 							else idx_u= idx_v;
 
 							madd_v3_v3fl(co, &lt->latticedata[idx_u * 3], u);
 
-							if(defgroup_nr != -1)
+							if (defgroup_nr != -1)
 								weight_blend += (u * defvert_find_weight(dvert + idx_u, defgroup_nr));
 						}
 					}
@@ -442,7 +443,7 @@ void calc_latt_deform(Object *ob, float *co, float weight)
 		}
 	}
 
-	if(defgroup_nr != -1)
+	if (defgroup_nr != -1)
 		interp_v3_v3v3(co, co_prev, co, weight_blend);
 
 }
@@ -451,15 +452,15 @@ void end_latt_deform(Object *ob)
 {
 	Lattice *lt= ob->data;
 	
-	if(lt->editlatt) lt= lt->editlatt->latt;
+	if (lt->editlatt) lt= lt->editlatt->latt;
 	
-	if(lt->latticedata)
+	if (lt->latticedata)
 		MEM_freeN(lt->latticedata);
 	lt->latticedata= NULL;
 }
 
 	/* calculations is in local space of deformed object
-	   so we store in latmat transform from path coord inside object 
+	 * so we store in latmat transform from path coord inside object 
 	 */
 typedef struct {
 	float dmin[3], dmax[3];
@@ -490,33 +491,33 @@ static int where_on_path_deform(Object *ob, float ctime, float vec[4], float dir
 	/* test for cyclic */
 	bl= cu->bev.first;
 	if (!bl->nr) return 0;
-	if(bl && bl->poly> -1) cycl= 1;
+	if (bl && bl->poly> -1) cycl= 1;
 
-	if(cycl==0) {
+	if (cycl==0) {
 		ctime1= CLAMPIS(ctime, 0.0f, 1.0f);
 	}
 	else ctime1= ctime;
 	
 	/* vec needs 4 items */
-	if(where_on_path(ob, ctime1, vec, dir, quat, radius, NULL)) {
+	if (where_on_path(ob, ctime1, vec, dir, quat, radius, NULL)) {
 		
-		if(cycl==0) {
+		if (cycl==0) {
 			Path *path= cu->path;
 			float dvec[3];
 			
-			if(ctime < 0.0f) {
+			if (ctime < 0.0f) {
 				sub_v3_v3v3(dvec, path->data[1].vec, path->data[0].vec);
 				mul_v3_fl(dvec, ctime*(float)path->len);
 				add_v3_v3(vec, dvec);
-				if(quat) copy_qt_qt(quat, path->data[0].quat);
-				if(radius) *radius= path->data[0].radius;
+				if (quat) copy_qt_qt(quat, path->data[0].quat);
+				if (radius) *radius= path->data[0].radius;
 			}
-			else if(ctime > 1.0f) {
+			else if (ctime > 1.0f) {
 				sub_v3_v3v3(dvec, path->data[path->len-1].vec, path->data[path->len-2].vec);
 				mul_v3_fl(dvec, (ctime-1.0f)*(float)path->len);
 				add_v3_v3(vec, dvec);
-				if(quat) copy_qt_qt(quat, path->data[path->len-1].quat);
-				if(radius) *radius= path->data[path->len-1].radius;
+				if (quat) copy_qt_qt(quat, path->data[path->len-1].quat);
+				if (radius) *radius= path->data[path->len-1].radius;
 				/* weight - not used but could be added */
 			}
 		}
@@ -539,31 +540,31 @@ static int calc_curve_deform(Scene *scene, Object *par, float co[3],
 	const int is_neg_axis = (axis > 2);
 
 	/* to be sure, mostly after file load */
-	if(cu->path==NULL) {
+	if (cu->path==NULL) {
 		makeDispListCurveTypes(scene, par, 0);
-		if(cu->path==NULL) return 0;	// happens on append...
+		if (cu->path==NULL) return 0;	// happens on append...
 	}
 	
 	/* options */
 	if (is_neg_axis) {
 		index = axis - 3;
-		if(cu->flag & CU_STRETCH)
+		if (cu->flag & CU_STRETCH)
 			fac= (-co[index]-cd->dmax[index])/(cd->dmax[index] - cd->dmin[index]);
 		else
 			fac= - (co[index]-cd->dmax[index])/(cu->path->totdist);
 	}
 	else {
 		index = axis;
-		if(cu->flag & CU_STRETCH)
+		if (cu->flag & CU_STRETCH)
 			fac= (co[index]-cd->dmin[index])/(cd->dmax[index] - cd->dmin[index]);
 		else
 			fac= + (co[index]-cd->dmin[index])/(cu->path->totdist);
 	}
 	
-	if( where_on_path_deform(par, fac, loc, dir, new_quat, &radius)) {	/* returns OK */
+	if ( where_on_path_deform(par, fac, loc, dir, new_quat, &radius)) {	/* returns OK */
 		float quat[4], cent[3];
 
-		if(cd->no_rot_axis) {	/* set by caller */
+		if (cd->no_rot_axis) {	/* set by caller */
 
 			/* this is not exactly the same as 2.4x, since the axis is having rotation removed rather than
 			 * changing the axis before calculating the tilt but serves much the same purpose */
@@ -603,7 +604,7 @@ static int calc_curve_deform(Scene *scene, Object *par, float co[3],
 
 
 		/* scale if enabled */
-		if(cu->flag & CU_PATH_RADIUS)
+		if (cu->flag & CU_PATH_RADIUS)
 			mul_v3_fl(cent, radius);
 		
 		/* local rotation */
@@ -613,7 +614,7 @@ static int calc_curve_deform(Scene *scene, Object *par, float co[3],
 		/* translation */
 		add_v3_v3v3(co, cent, loc);
 
-		if(quat_r)
+		if (quat_r)
 			copy_qt_qt(quat_r, quat);
 
 		return 1;
@@ -631,7 +632,7 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target,
 	int use_vgroups;
 	const int is_neg_axis = (defaxis > 2);
 
-	if(cuOb->type != OB_CURVE)
+	if (cuOb->type != OB_CURVE)
 		return;
 
 	cu = cuOb->data;
@@ -641,7 +642,7 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target,
 	init_curve_deform(cuOb, target, &cd);
 
 	/* dummy bounds, keep if CU_DEFORM_BOUNDS_OFF is set */
-	if(is_neg_axis == FALSE) {
+	if (is_neg_axis == FALSE) {
 		cd.dmin[0]= cd.dmin[1]= cd.dmin[2]= 0.0f;
 		cd.dmax[0]= cd.dmax[1]= cd.dmax[2]= 1.0f;
 	}
@@ -655,32 +656,34 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target,
 	 * we want either a Mesh with no derived data, or derived data with
 	 * deformverts
 	 */
-	if(target && target->type==OB_MESH) {
+	if (target && target->type==OB_MESH) {
 		/* if there's derived data without deformverts, don't use vgroups */
-		if(dm && !dm->getVertData(dm, 0, CD_MDEFORMVERT))
+		if (dm && !dm->getVertData(dm, 0, CD_MDEFORMVERT))
 			use_vgroups = 0;
 		else
 			use_vgroups = 1;
-	} else
+	}
+	else {
 		use_vgroups = 0;
+	}
 	
-	if(vgroup && vgroup[0] && use_vgroups) {
+	if (vgroup && vgroup[0] && use_vgroups) {
 		Mesh *me= target->data;
 		int index= defgroup_name_index(target, vgroup);
 
-		if(index != -1 && (me->dvert || dm)) {
+		if (index != -1 && (me->dvert || dm)) {
 			MDeformVert *dvert = me->dvert;
 			float vec[3];
 			float weight;
 	
 
-			if(cu->flag & CU_DEFORM_BOUNDS_OFF) {
+			if (cu->flag & CU_DEFORM_BOUNDS_OFF) {
 				dvert = me->dvert;
-				for(a = 0; a < numVerts; a++, dvert++) {
-					if(dm) dvert = dm->getVertData(dm, a, CD_MDEFORMVERT);
+				for (a = 0; a < numVerts; a++, dvert++) {
+					if (dm) dvert = dm->getVertData(dm, a, CD_MDEFORMVERT);
 					weight= defvert_find_weight(dvert, index);
 	
-					if(weight > 0.0f) {
+					if (weight > 0.0f) {
 						mul_m4_v3(cd.curvespace, vertexCos[a]);
 						copy_v3_v3(vec, vertexCos[a]);
 						calc_curve_deform(scene, cuOb, vec, defaxis, &cd, NULL);
@@ -693,22 +696,22 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target,
 				/* set mesh min/max bounds */
 				INIT_MINMAX(cd.dmin, cd.dmax);
 	
-				for(a = 0; a < numVerts; a++, dvert++) {
-					if(dm) dvert = dm->getVertData(dm, a, CD_MDEFORMVERT);
+				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, index) > 0.0f) {
 						mul_m4_v3(cd.curvespace, vertexCos[a]);
 						DO_MINMAX(vertexCos[a], cd.dmin, cd.dmax);
 					}
 				}
 	
 				dvert = me->dvert;
-				for(a = 0; a < numVerts; a++, dvert++) {
-					if(dm) dvert = dm->getVertData(dm, a, CD_MDEFORMVERT);
+				for (a = 0; a < numVerts; a++, dvert++) {
+					if (dm) dvert = dm->getVertData(dm, a, CD_MDEFORMVERT);
 					
 					weight= defvert_find_weight(dvert, index);
 	
-					if(weight > 0.0f) {
+					if (weight > 0.0f) {
 						/* already in 'cd.curvespace', prev for loop */
 						copy_v3_v3(vec, vertexCos[a]);
 						calc_curve_deform(scene, cuOb, vec, defaxis, &cd, NULL);
@@ -720,8 +723,8 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target,
 		}
 	}
 	else {
-		if(cu->flag & CU_DEFORM_BOUNDS_OFF) {
-			for(a = 0; a < numVerts; a++) {
+		if (cu->flag & CU_DEFORM_BOUNDS_OFF) {
+			for (a = 0; a < numVerts; a++) {
 				mul_m4_v3(cd.curvespace, vertexCos[a]);
 				calc_curve_deform(scene, cuOb, vertexCos[a], defaxis, &cd, NULL);
 				mul_m4_v3(cd.objectspace, vertexCos[a]);
@@ -731,12 +734,12 @@ void curve_deform_verts(Scene *scene, Object *cuOb, Object *target,
 			/* set mesh min max bounds */
 			INIT_MINMAX(cd.dmin, cd.dmax);
 				
-			for(a = 0; a < numVerts; a++) {
+			for (a = 0; a < numVerts; a++) {
 				mul_m4_v3(cd.curvespace, vertexCos[a]);
 				DO_MINMAX(vertexCos[a], cd.dmin, cd.dmax);
 			}
 	
-			for(a = 0; a < numVerts; a++) {
+			for (a = 0; a < numVerts; a++) {
 				/* already in 'cd.curvespace', prev for loop */
 				calc_curve_deform(scene, cuOb, vertexCos[a], defaxis, &cd, NULL);
 				mul_m4_v3(cd.objectspace, vertexCos[a]);
@@ -755,7 +758,7 @@ void curve_deform_vector(Scene *scene, Object *cuOb, Object *target,
 	CurveDeform cd;
 	float quat[4];
 	
-	if(cuOb->type != OB_CURVE) {
+	if (cuOb->type != OB_CURVE) {
 		unit_m3(mat);
 		return;
 	}
@@ -768,7 +771,7 @@ void curve_deform_vector(Scene *scene, Object *cuOb, Object *target,
 
 	mul_m4_v3(cd.curvespace, vec);
 	
-	if(calc_curve_deform(scene, cuOb, vec, target->trackflag, &cd, quat)) {
+	if (calc_curve_deform(scene, cuOb, vec, target->trackflag, &cd, quat)) {
 		float qmat[3][3];
 		
 		quat_to_mat3( qmat,quat);
@@ -782,12 +785,12 @@ void curve_deform_vector(Scene *scene, Object *cuOb, Object *target,
 }
 
 void lattice_deform_verts(Object *laOb, Object *target, DerivedMesh *dm,
-                          float (*vertexCos)[3], int numVerts, const char *vgroup)
+                          float (*vertexCos)[3], int numVerts, const char *vgroup, float fac)
 {
 	int a;
 	int use_vgroups;
 
-	if(laOb->type != OB_LATTICE)
+	if (laOb->type != OB_LATTICE)
 		return;
 
 	init_latt_deform(laOb, target);
@@ -796,35 +799,38 @@ void lattice_deform_verts(Object *laOb, Object *target, DerivedMesh *dm,
 	 * we want either a Mesh with no derived data, or derived data with
 	 * deformverts
 	 */
-	if(target && target->type==OB_MESH) {
+	if (target && target->type==OB_MESH) {
 		/* if there's derived data without deformverts, don't use vgroups */
-		if(dm && !dm->getVertData(dm, 0, CD_MDEFORMVERT))
+		if (dm && !dm->getVertData(dm, 0, CD_MDEFORMVERT))
 			use_vgroups = 0;
 		else
 			use_vgroups = 1;
-	} else
+	}
+	else {
 		use_vgroups = 0;
+	}
 	
-	if(vgroup && vgroup[0] && use_vgroups) {
+	if (vgroup && vgroup[0] && use_vgroups) {
 		Mesh *me = target->data;
 		int index = defgroup_name_index(target, vgroup);
 		float weight;
 
-		if(index >= 0 && (me->dvert || dm)) {
+		if (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);
+			for (a = 0; a < numVerts; a++, dvert++) {
+				if (dm) dvert = dm->getVertData(dm, a, CD_MDEFORMVERT);
 
 				weight= defvert_find_weight(dvert, index);
 
-				if(weight > 0.0f)
-					calc_latt_deform(laOb, vertexCos[a], weight);
+				if (weight > 0.0f)
+					calc_latt_deform(laOb, vertexCos[a], weight * fac);
 			}
 		}
-	} else {
-		for(a = 0; a < numVerts; a++) {
-			calc_latt_deform(laOb, vertexCos[a], 1.0f);
+	}
+	else {
+		for (a = 0; a < numVerts; a++) {
+			calc_latt_deform(laOb, vertexCos[a], fac);
 		}
 	}
 	end_latt_deform(laOb);
@@ -832,16 +838,17 @@ void lattice_deform_verts(Object *laOb, Object *target, DerivedMesh *dm,
 
 int object_deform_mball(Object *ob, ListBase *dispbase)
 {
-	if(ob->parent && ob->parent->type==OB_LATTICE && ob->partype==PARSKEL) {
+	if (ob->parent && ob->parent->type==OB_LATTICE && ob->partype==PARSKEL) {
 		DispList *dl;
 
 		for (dl=dispbase->first; dl; dl=dl->next) {
 			lattice_deform_verts(ob->parent, ob, NULL,
-								 (float(*)[3]) dl->verts, dl->nr, NULL);
+								 (float(*)[3]) dl->verts, dl->nr, NULL, 1.0f);
 		}
 
 		return 1;
-	} else {
+	}
+	else {
 		return 0;
 	}
 }
@@ -857,19 +864,19 @@ void outside_lattice(Lattice *lt)
 	int u, v, w;
 	float fac1, du=0.0, dv=0.0, dw=0.0;
 
-	if(lt->flag & LT_OUTSIDE) {
+	if (lt->flag & LT_OUTSIDE) {
 		bp= lt->def;
 
-		if(lt->pntsu>1) du= 1.0f/((float)lt->pntsu-1);
-		if(lt->pntsv>1) dv= 1.0f/((float)lt->pntsv-1);
-		if(lt->pntsw>1) dw= 1.0f/((float)lt->pntsw-1);
+		if (lt->pntsu>1) du= 1.0f/((float)lt->pntsu-1);
+		if (lt->pntsv>1) dv= 1.0f/((float)lt->pntsv-1);
+		if (lt->pntsw>1) dw= 1.0f/((float)lt->pntsw-1);
 			
-		for(w=0; w<lt->pntsw; w++) {
+		for (w=0; w<lt->pntsw; w++) {
 			
-			for(v=0; v<lt->pntsv; v++) {
+			for (v=0; v<lt->pntsv; v++) {
 			
-				for(u=0; u<lt->pntsu; u++, bp++) {
-					if(u==0 || v==0 || w==0 || u==lt->pntsu-1 || v==lt->pntsv-1 || w==lt->pntsw-1);
+				for (u=0; u<lt->pntsu; u++, bp++) {
+					if (u==0 || v==0 || w==0 || u==lt->pntsu-1 || v==lt->pntsv-1 || w==lt->pntsw-1);
 					else {
 					
 						bp->hide= 1;
@@ -914,9 +921,9 @@ void outside_lattice(Lattice *lt)
 	else {
 		bp= lt->def;
 
-		for(w=0; w<lt->pntsw; w++)
-			for(v=0; v<lt->pntsv; v++)
-				for(u=0; u<lt->pntsu; u++, bp++)
+		for (w=0; w<lt->pntsw; w++)
+			for (v=0; v<lt->pntsv; v++)
+				for (u=0; u<lt->pntsu; u++, bp++)
 					bp->hide= 0;
 	}
 }
@@ -927,7 +934,7 @@ float (*lattice_getVertexCos(struct Object *ob, int *numVerts_r))[3]
 	int i, numVerts;
 	float (*vertexCos)[3];
 
-	if(lt->editlatt) lt= lt->editlatt->latt;
+	if (lt->editlatt) lt= lt->editlatt->latt;
 	numVerts = *numVerts_r = lt->pntsu*lt->pntsv*lt->pntsw;
 	
 	vertexCos = MEM_mallocN(sizeof(*vertexCos)*numVerts,"lt_vcos");
@@ -990,6 +997,6 @@ struct MDeformVert* lattice_get_deform_verts(struct Object *oblatt)
 {
 	Lattice *lt = (Lattice*)oblatt->data;
 	BLI_assert(oblatt->type == OB_LATTICE);
-	if(lt->editlatt) lt= lt->editlatt->latt;
+	if (lt->editlatt) lt= lt->editlatt->latt;
 	return lt->dvert;
 }
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 795cf75..7e756e8 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -27,16 +27,11 @@
 
 /** \file blender/blenkernel/intern/library.c
  *  \ingroup bke
+ *
+ * Contains management of ID's and libraries
+ * allocate and free of all library data
  */
 
-
-/*
- *  Contains management of ID's and libraries
- *  allocate and free of all library data
- * 
- */
-
-
 #include <stdio.h>
 #include <ctype.h>
 #include <string.h>
@@ -123,8 +118,8 @@
 #define MAX_IDPUP		60	/* was 24 */
 
 /* GS reads the memory pointed at in a specific ordering. 
-   only use this definition, makes little and big endian systems
-   work fine, in conjunction with MAKE_ID */
+ * only use this definition, makes little and big endian systems
+ * work fine, in conjunction with MAKE_ID */
 
 /* from blendef: */
 #define GS(a)	(*((short *)(a)))
@@ -148,8 +143,8 @@ void BKE_id_lib_local_paths(Main *bmain, Library *lib, ID *id)
 
 void id_lib_extern(ID *id)
 {
-	if(id) {
-		if(id->flag & LIB_INDIRECT) {
+	if (id) {
+		if (id->flag & LIB_INDIRECT) {
 			id->flag -= LIB_INDIRECT;
 			id->flag |= LIB_EXTERN;
 		}
@@ -158,9 +153,9 @@ void id_lib_extern(ID *id)
 
 void id_us_plus(ID *id)
 {
-	if(id) {
+	if (id) {
 		id->us++;
-		if(id->flag & LIB_INDIRECT) {
+		if (id->flag & LIB_INDIRECT) {
 			id->flag -= LIB_INDIRECT;
 			id->flag |= LIB_EXTERN;
 		}
@@ -169,19 +164,22 @@ void id_us_plus(ID *id)
 
 void id_us_min(ID *id)
 {
-	if(id) {
-		if(id->us<2 && (id->flag & LIB_FAKEUSER))
-		   id->us= 1;
-		else if(id->us<=0)
-			printf("ID user decrement error: %s \n", id->name);
-		else
+	if (id) {
+		if (id->us < 2 && (id->flag & LIB_FAKEUSER)) {
+			id->us= 1;
+		}
+		else if (id->us <= 0) {
+			printf("ID user decrement error: %s\n", id->name);
+		}
+		else {
 			id->us--;
+		}
 	}
 }
 
 int id_make_local(ID *id, int test)
 {
-	if(id->flag & LIB_INDIRECT)
+	if (id->flag & LIB_INDIRECT)
 		return 0;
 
 	switch(GS(id->name)) {
@@ -190,54 +188,54 @@ int id_make_local(ID *id, int test)
 		case ID_LI:
 			return 0; /* can't be linked */
 		case ID_OB:
-			if(!test) make_local_object((Object*)id);
+			if (!test) make_local_object((Object*)id);
 			return 1;
 		case ID_ME:
-			if(!test) {
+			if (!test) {
 				make_local_mesh((Mesh*)id);
 				make_local_key(((Mesh*)id)->key);
 			}
 			return 1;
 		case ID_CU:
-			if(!test) {
+			if (!test) {
 				make_local_curve((Curve*)id);
 				make_local_key(((Curve*)id)->key);
 			}
 			return 1;
 		case ID_MB:
-			if(!test) make_local_mball((MetaBall*)id);
+			if (!test) make_local_mball((MetaBall*)id);
 			return 1;
 		case ID_MA:
-			if(!test) make_local_material((Material*)id);
+			if (!test) make_local_material((Material*)id);
 			return 1;
 		case ID_TE:
-			if(!test) make_local_texture((Tex*)id);
+			if (!test) make_local_texture((Tex*)id);
 			return 1;
 		case ID_IM:
-			if(!test) make_local_image((Image*)id);
+			if (!test) make_local_image((Image*)id);
 			return 1;
 		case ID_LT:
-			if(!test) {
+			if (!test) {
 				make_local_lattice((Lattice*)id);
 				make_local_key(((Lattice*)id)->key);
 			}
 			return 1;
 		case ID_LA:
-			if(!test) make_local_lamp((Lamp*)id);
+			if (!test) make_local_lamp((Lamp*)id);
 			return 1;
 		case ID_CA:
-			if(!test) make_local_camera((Camera*)id);
+			if (!test) make_local_camera((Camera*)id);
 			return 1;
 		case ID_SPK:
-			if(!test) make_local_speaker((Speaker*)id);
+			if (!test) make_local_speaker((Speaker*)id);
 			return 1;
 		case ID_IP:
 			return 0; /* deprecated */
 		case ID_KE:
-			if(!test) make_local_key((Key*)id);
+			if (!test) make_local_key((Key*)id);
 			return 1;
 		case ID_WO:
-			if(!test) make_local_world((World*)id);
+			if (!test) make_local_world((World*)id);
 			return 1;
 		case ID_SCR:
 			return 0; /* can't be linked */
@@ -252,18 +250,18 @@ int id_make_local(ID *id, int test)
 		case ID_GR:
 			return 0; /* not implemented */
 		case ID_AR:
-			if(!test) make_local_armature((bArmature*)id);
+			if (!test) make_local_armature((bArmature*)id);
 			return 1;
 		case ID_AC:
-			if(!test) make_local_action((bAction*)id);
+			if (!test) make_local_action((bAction*)id);
 			return 1;
 		case ID_NT:
 			return 0; /* not implemented */
 		case ID_BR:
-			if(!test) make_local_brush((Brush*)id);
+			if (!test) make_local_brush((Brush*)id);
 			return 1;
 		case ID_PA:
-			if(!test) make_local_particlesettings((ParticleSettings*)id);
+			if (!test) make_local_particlesettings((ParticleSettings*)id);
 			return 1;
 		case ID_WM:
 			return 0; /* can't be linked */
@@ -276,7 +274,7 @@ int id_make_local(ID *id, int test)
 
 int id_copy(ID *id, ID **newid, int test)
 {
-	if(!test) *newid= NULL;
+	if (!test) *newid= NULL;
 
 	/* conventions:
 	 * - make shallow copy, only this ID block
@@ -287,74 +285,74 @@ int id_copy(ID *id, ID **newid, int test)
 		case ID_LI:
 			return 0; /* can't be copied from here */
 		case ID_OB:
-			if(!test) *newid= (ID*)copy_object((Object*)id);
+			if (!test) *newid= (ID*)copy_object((Object*)id);
 			return 1;
 		case ID_ME:
-			if(!test) *newid= (ID*)copy_mesh((Mesh*)id);
+			if (!test) *newid= (ID*)copy_mesh((Mesh*)id);
 			return 1;
 		case ID_CU:
-			if(!test) *newid= (ID*)copy_curve((Curve*)id);
+			if (!test) *newid= (ID*)copy_curve((Curve*)id);
 			return 1;
 		case ID_MB:
-			if(!test) *newid= (ID*)copy_mball((MetaBall*)id);
+			if (!test) *newid= (ID*)copy_mball((MetaBall*)id);
 			return 1;
 		case ID_MA:
-			if(!test) *newid= (ID*)copy_material((Material*)id);
+			if (!test) *newid= (ID*)copy_material((Material*)id);
 			return 1;
 		case ID_TE:
-			if(!test) *newid= (ID*)copy_texture((Tex*)id);
+			if (!test) *newid= (ID*)copy_texture((Tex*)id);
 			return 1;
 		case ID_IM:
-			if(!test) *newid= (ID*)copy_image((Image*)id);
+			if (!test) *newid= (ID*)copy_image((Image*)id);
 			return 1;
 		case ID_LT:
-			if(!test) *newid= (ID*)copy_lattice((Lattice*)id);
+			if (!test) *newid= (ID*)copy_lattice((Lattice*)id);
 			return 1;
 		case ID_LA:
-			if(!test) *newid= (ID*)copy_lamp((Lamp*)id);
+			if (!test) *newid= (ID*)copy_lamp((Lamp*)id);
 			return 1;
 		case ID_SPK:
-			if(!test) *newid= (ID*)copy_speaker((Speaker*)id);
+			if (!test) *newid= (ID*)copy_speaker((Speaker*)id);
 			return 1;
 		case ID_CA:
-			if(!test) *newid= (ID*)copy_camera((Camera*)id);
+			if (!test) *newid= (ID*)copy_camera((Camera*)id);
 			return 1;
 		case ID_IP:
 			return 0; /* deprecated */
 		case ID_KE:
-			if(!test) *newid= (ID*)copy_key((Key*)id);
+			if (!test) *newid= (ID*)copy_key((Key*)id);
 			return 1;
 		case ID_WO:
-			if(!test) *newid= (ID*)copy_world((World*)id);
+			if (!test) *newid= (ID*)copy_world((World*)id);
 			return 1;
 		case ID_SCR:
 			return 0; /* can't be copied from here */
 		case ID_VF:
 			return 0; /* not implemented */
 		case ID_TXT:
-			if(!test) *newid= (ID*)copy_text((Text*)id);
+			if (!test) *newid= (ID*)copy_text((Text*)id);
 			return 1;
 		case ID_SCRIPT:
 			return 0; /* deprecated */
 		case ID_SO:
 			return 0; /* not implemented */
 		case ID_GR:
-			if(!test) *newid= (ID*)copy_group((Group*)id);
+			if (!test) *newid= (ID*)copy_group((Group*)id);
 			return 1;
 		case ID_AR:
-			if(!test) *newid= (ID*)copy_armature((bArmature*)id);
+			if (!test) *newid= (ID*)copy_armature((bArmature*)id);
 			return 1;
 		case ID_AC:
-			if(!test) *newid= (ID*)copy_action((bAction*)id);
+			if (!test) *newid= (ID*)copy_action((bAction*)id);
 			return 1;
 		case ID_NT:
-			if(!test) *newid= (ID*)ntreeCopyTree((bNodeTree*)id);
+			if (!test) *newid= (ID*)ntreeCopyTree((bNodeTree*)id);
 			return 1;
 		case ID_BR:
-			if(!test) *newid= (ID*)copy_brush((Brush*)id);
+			if (!test) *newid= (ID*)copy_brush((Brush*)id);
 			return 1;
 		case ID_PA:
-			if(!test) *newid= (ID*)psys_copy_settings((ParticleSettings*)id);
+			if (!test) *newid= (ID*)psys_copy_settings((ParticleSettings*)id);
 			return 1;
 		case ID_WM:
 			return 0; /* can't be copied from here */
@@ -372,21 +370,21 @@ int id_unlink(ID *id, int test)
 
 	switch(GS(id->name)) {
 		case ID_TXT:
-			if(test) return 1;
+			if (test) return 1;
 			unlink_text(mainlib, (Text*)id);
 			break;
 		case ID_GR:
-			if(test) return 1;
+			if (test) return 1;
 			unlink_group((Group*)id);
 			break;
 		case ID_OB:
-			if(test) return 1;
+			if (test) return 1;
 			unlink_object((Object*)id);
 			break;
 	}
 
-	if(id->us == 0) {
-		if(test) return 1;
+	if (id->us == 0) {
+		if (test) return 1;
 
 		lb= which_libbase(mainlib, GS(id->name));
 		free_libblock(lb, id);
@@ -409,8 +407,8 @@ int id_single_user(bContext *C, ID *id, PointerRNA *ptr, PropertyRNA *prop)
 				/* copy animation actions too */
 				BKE_copy_animdata_id_action(id);
 				/* us is 1 by convention, but RNA_property_pointer_set
-				   will also incremement it, so set it to zero */
-				newid->us= 0;
+				 * will also increment it, so set it to zero */
+				newid->us = 0;
 				
 				/* assign copy */
 				RNA_id_pointer_create(newid, &idptr);
@@ -497,10 +495,11 @@ void flag_listbase_ids(ListBase *lb, short flag, short value)
 {
 	ID *id;
 	if (value) {
-		for(id= lb->first; id; id= id->next) id->flag |= flag;
-	} else {
+		for (id= lb->first; id; id= id->next) id->flag |= flag;
+	}
+	else {
 		flag = ~flag;
-		for(id= lb->first; id; id= id->next) id->flag &= flag;
+		for (id= lb->first; id; id= id->next) id->flag &= flag;
 	}
 }
 
@@ -510,7 +509,7 @@ void flag_all_listbases_ids(short flag, short value)
 	ListBase *lbarray[MAX_LIBARRAY];
 	int a;
 	a= set_listbasepointers(G.main, lbarray);
-	while(a--)	flag_listbase_ids(lbarray[a], flag, value);
+	while (a--)	flag_listbase_ids(lbarray[a], flag, value);
 }
 
 void recalc_all_library_objects(Main *main)
@@ -518,8 +517,8 @@ void recalc_all_library_objects(Main *main)
 	Object *ob;
 
 	/* flag for full recalc */
-	for(ob=main->object.first; ob; ob=ob->id.next)
-		if(ob->id.lib)
+	for (ob=main->object.first; ob; ob=ob->id.next)
+		if (ob->id.lib)
 			ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
 }
 
@@ -577,14 +576,14 @@ int set_listbasepointers(Main *main, ListBase **lb)
 }
 
 /* *********** ALLOC AND FREE *****************
-  
-free_libblock(ListBase *lb, ID *id )
-	provide a list-basis and datablock, but only ID is read
-
-void *alloc_libblock(ListBase *lb, type, name)
-	inserts in list and returns a new ID
-
- ***************************** */
+ *
+ * free_libblock(ListBase *lb, ID *id )
+ * provide a list-basis and datablock, but only ID is read
+ *
+ * void *alloc_libblock(ListBase *lb, type, name)
+ * inserts in list and returns a new ID
+ *
+ * **************************** */
 
 static ID *alloc_libblock_notest(short type)
 {
@@ -691,7 +690,7 @@ void *alloc_libblock(ListBase *lb, short type, const char *name)
 	ID *id= NULL;
 	
 	id= alloc_libblock_notest(type);
-	if(id) {
+	if (id) {
 		BLI_addtail(lb, id);
 		id->us= 1;
 		id->icon_id = 0;
@@ -737,7 +736,7 @@ void *copy_libblock(ID *id)
 	assert(idn != NULL);
 
 	idn_len= MEM_allocN_len(idn);
-	if((int)idn_len - (int)sizeof(ID) > 0) { /* signed to allow neg result */
+	if ((int)idn_len - (int)sizeof(ID) > 0) { /* signed to allow neg result */
 		const char *cp= (const char *)id;
 		char *cpn= (char *)idn;
 
@@ -808,7 +807,7 @@ void free_libblock(ListBase *lb, void *idv)
 			free_object((Object *)id);
 			break;
 		case ID_ME:
-			free_mesh((Mesh *)id);
+			free_mesh((Mesh *)id, 1);
 			break;
 		case ID_CU:
 			free_curve((Curve *)id);
@@ -880,7 +879,7 @@ void free_libblock(ListBase *lb, void *idv)
 			psys_free_settings((ParticleSettings *)id);
 			break;
 		case ID_WM:
-			if(free_windowmanager_cb)
+			if (free_windowmanager_cb)
 				free_windowmanager_cb(NULL, (wmWindowManager *)id);
 			break;
 		case ID_GD:
@@ -910,12 +909,12 @@ void free_libblock_us(ListBase *lb, void *idv)		/* test users */
 	
 	id->us--;
 
-	if(id->us<0) {
-		if(id->lib) printf("ERROR block %s %s users %d\n", id->lib->name, id->name, id->us);
+	if (id->us<0) {
+		if (id->lib) printf("ERROR block %s %s users %d\n", id->lib->name, id->name, id->us);
 		else printf("ERROR block %s users %d\n", id->name, id->us);
 	}
-	if(id->us==0) {
-		if( GS(id->name)==ID_OB ) unlink_object((Object *)id);
+	if (id->us==0) {
+		if ( GS(id->name)==ID_OB ) unlink_object((Object *)id);
 		
 		free_libblock(lb, id);
 	}
@@ -929,7 +928,7 @@ void free_main(Main *mainvar)
 	int a;
 
 	a= set_listbasepointers(mainvar, lbarray);
-	while(a--) {
+	while (a--) {
 		ListBase *lb= lbarray[a];
 		ID *id;
 		
@@ -961,16 +960,16 @@ static void get_flags_for_id(ID *id, char *buf)
 		 * to have that explicit, oh well - zr
 		 */
 
-	if(GS(id->name)==ID_MA)
+	if (GS(id->name)==ID_MA)
 		isnode= ((Material *)id)->use_nodes;
-	if(GS(id->name)==ID_TE)
+	if (GS(id->name)==ID_TE)
 		isnode= ((Tex *)id)->use_nodes;
 	
 	if (id->us<0)
 		strcpy(buf, "-1W ");
 	else if (!id->lib && !isfake && id->us && !isnode)
 		strcpy(buf, "     ");
-	else if(isnode)
+	else if (isnode)
 		sprintf(buf, "%c%cN%c ", id->lib?'L':' ', isfake?'F':' ', (id->us==0)?'O':' ');
 	else
 		sprintf(buf, "%c%c%c ", id->lib?'L':' ', isfake?'F':' ', (id->us==0)?'O':' ');
@@ -987,7 +986,8 @@ static void IDnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, shor
 	if (nr && nids>MAX_IDPUP) {
 		BLI_dynstr_append(pupds, "DataBrowse %x-2");
 		*nr= -2;
-	} else {
+	}
+	else {
 		ID *id;
 		
 		for (i=0, id= lb->first; id; id= id->next, i++) {
@@ -1024,7 +1024,7 @@ static void IDnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, shor
 				break;
 			}
 			
-			if(id->next)
+			if (id->next)
 				BLI_dynstr_append(pupds, "|");
 		}
 	}
@@ -1055,6 +1055,7 @@ void IDnames_to_pupstring(const char **str, const char *title, const char *extra
 }
 
 /* skips viewer images */
+#if 0 /* unused */
 void IMAnames_to_pupstring(const char **str, const char *title, const char *extraops, ListBase *lb, ID *link, short *nr)
 {
 	DynStr *pupds= BLI_dynstr_new();
@@ -1075,25 +1076,26 @@ void IMAnames_to_pupstring(const char **str, const char *title, const char *extr
 	*str= BLI_dynstr_get_cstring(pupds);
 	BLI_dynstr_free(pupds);
 }
+#endif
 
-static void sort_alpha_id(ListBase *lb, ID *id)
+void id_sort_by_name(ListBase *lb, ID *id)
 {
 	ID *idtest;
 	
 	/* insert alphabetically */
-	if(lb->first!=lb->last) {
+	if (lb->first!=lb->last) {
 		BLI_remlink(lb, id);
 		
 		idtest= lb->first;
-		while(idtest) {
-			if(BLI_strcasecmp(idtest->name, id->name)>0 || idtest->lib) {
+		while (idtest) {
+			if (BLI_strcasecmp(idtest->name, id->name)>0 || (idtest->lib && !id->lib)) {
 				BLI_insertlinkbefore(lb, idtest, id);
 				break;
 			}
 			idtest= idtest->next;
 		}
 		/* as last */
-		if(idtest==NULL) {
+		if (idtest==NULL) {
 			BLI_addtail(lb, id);
 		}
 	}
@@ -1108,13 +1110,13 @@ static ID *is_dupid(ListBase *lb, ID *id, const char *name)
 {
 	ID *idtest=NULL;
 	
-	for( idtest = lb->first; idtest; idtest = idtest->next ) {
+	for ( idtest = lb->first; idtest; idtest = idtest->next ) {
 		/* if idtest is not a lib */ 
-		if( id != idtest && idtest->lib == NULL ) {
+		if ( id != idtest && idtest->lib == NULL ) {
 			/* do not test alphabetic! */
 			/* optimized */
-			if( idtest->name[2] == name[0] ) {
-				if(strcmp(name, idtest->name+2)==0) break;
+			if ( idtest->name[2] == name[0] ) {
+				if (strcmp(name, idtest->name+2)==0) break;
 			}
 		}
 	}
@@ -1141,7 +1143,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) {
@@ -1150,7 +1152,7 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
 		idtest = is_dupid(lb, id, name);
 
 		/* if there is no double, done */
-		if( idtest == NULL ) return 0;
+		if ( idtest == NULL ) return 0;
 
 		/* we have a dup; need to make a new name */
 		/* quick check so we can reuse one of first 64 ids if vacant */
@@ -1160,33 +1162,33 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
 		left_len= BLI_split_name_num(left, &nr, name, '.');
 
 		/* if new name will be too long, truncate it */
-		if(nr > 999 && left_len > (MAX_ID_NAME - 8)) {
+		if (nr > 999 && left_len > (MAX_ID_NAME - 8)) {
 			left[MAX_ID_NAME - 8]= 0;
 			left_len= MAX_ID_NAME - 8;
 		}
-		else if(left_len > (MAX_ID_NAME - 7)) {
+		else if (left_len > (MAX_ID_NAME - 7)) {
 			left[MAX_ID_NAME - 7]= 0;
 			left_len= MAX_ID_NAME - 7;
 		}
 
-		for(idtest= lb->first; idtest; idtest= idtest->next) {
-			if(		(id != idtest) &&
+		for (idtest= lb->first; idtest; idtest= idtest->next) {
+			if (		(id != idtest) &&
 					(idtest->lib == NULL) &&
 					(*name == *(idtest->name+2)) &&
 					(strncmp(name, idtest->name+2, left_len)==0) &&
 					(BLI_split_name_num(leftest, &nrtest, idtest->name+2, '.') == left_len)
 			) {
-				if(nrtest < sizeof(in_use))
+				if (nrtest < sizeof(in_use))
 					in_use[nrtest]= 1;	/* mark as used */
-				if(nr <= nrtest)
+				if (nr <= nrtest)
 					nr= nrtest+1;		/* track largest unused */
 			}
 		}
 
 		/* decide which value of nr to use */
-		for(a=0; a < sizeof(in_use); a++) {
-			if(a>=nr) break;	/* stop when we've check up to biggest */
-			if( in_use[a]==0 ) { /* found an unused value */
+		for (a=0; a < sizeof(in_use); a++) {
+			if (a>=nr) break;	/* stop when we've check up to biggest */
+			if ( in_use[a]==0 ) { /* found an unused value */
 				nr = a;
 				break;
 			}
@@ -1195,7 +1197,7 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
 		/* If the original name has no numeric suffix, 
 		 * rather than just chopping and adding numbers, 
 		 * shave off the end chars until we have a unique name.
-		 * Check the null terminators match as well so we dont get Cube.000 -> Cube.00 */
+		 * Check the null terminators match as well so we don't get Cube.000 -> Cube.00 */
 		if (nr==0 && name[left_len]== '\0') {
 			int len = left_len-1;
 			idtest= is_dupid(lb, id, name);
@@ -1208,10 +1210,10 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
 			/* otherwise just continue and use a number suffix */
 		}
 		
-		if(nr > 999 && left_len > (MAX_ID_NAME - 8)) {
+		if (nr > 999 && left_len > (MAX_ID_NAME - 8)) {
 			/* this would overflow name buffer */
 			left[MAX_ID_NAME - 8] = 0;
-			/* left_len = MAX_ID_NAME - 8; */ /* for now this isnt used again */
+			/* left_len = MAX_ID_NAME - 8; */ /* for now this isn't used again */
 			memcpy(name, left, sizeof(char) * (MAX_ID_NAME - 7));
 			continue;
 		}
@@ -1235,14 +1237,14 @@ int new_id(ListBase *lb, ID *id, const char *tname)
 	char name[MAX_ID_NAME-2];
 
 	/* if library, don't rename */
-	if(id->lib) return 0;
+	if (id->lib) return 0;
 
 	/* if no libdata given, look up based on ID */
-	if(lb==NULL) lb= which_libbase(G.main, GS(id->name));
+	if (lb==NULL) lb= which_libbase(G.main, GS(id->name));
 
 	/* if no name given, use name of current ID
 	 * else make a copy (tname args can be const) */
-	if(tname==NULL)
+	if (tname==NULL)
 		tname= id->name+2;
 
 	strncpy(name, tname, sizeof(name)-1);
@@ -1251,13 +1253,13 @@ int new_id(ListBase *lb, ID *id, const char *tname)
 	 * easier to assign each time then to check if its needed */
 	name[sizeof(name)-1]= 0;
 
-	if(name[0] == '\0') {
+	if (name[0] == '\0') {
 		/* disallow empty names */
 		strcpy(name, ID_FALLBACK_NAME);
 	}
 	else {
 		/* disallow non utf8 chars,
-		 * the interface checks for this but new ID's based on file names dont */
+		 * the interface checks for this but new ID's based on file names don't */
 		BLI_utf8_invalid_strip(name, strlen(name));
 	}
 
@@ -1268,16 +1270,18 @@ int new_id(ListBase *lb, ID *id, const char *tname)
 	 * however all data in blender should be sorted, not just duplicate names
 	 * sorting should not hurt, but noting just incause it alters the way other
 	 * functions work, so sort every time */
-	/* if( result )
-		sort_alpha_id(lb, id);*/
-	
-	sort_alpha_id(lb, id);
+#if 0
+	if ( result )
+		id_sort_by_name(lb, id);
+#endif
+
+	id_sort_by_name(lb, id);
 	
 	return result;
 }
 
 /* Pull an ID out of a library (make it local). Only call this for IDs that
-   don't have other library users. */
+ * don't have other library users. */
 void id_clear_lib_data(Main *bmain, ID *id)
 {
 	BKE_id_lib_local_paths(bmain, id->lib, id);
@@ -1295,9 +1299,9 @@ void clear_id_newpoins(void)
 	int a;
 
 	a= set_listbasepointers(G.main, lbarray);
-	while(a--) {
+	while (a--) {
 		id= lbarray[a]->first;
-		while(id) {
+		while (id) {
 			id->newid= NULL;
 			id->flag &= ~LIB_NEW;
 			id= id->next;
@@ -1305,21 +1309,21 @@ void clear_id_newpoins(void)
 	}
 }
 
-#define LIBTAG(a)	if(a && a->id.lib) {a->id.flag &=~LIB_INDIRECT; a->id.flag |= LIB_EXTERN;}
+#define LIBTAG(a)	if (a && a->id.lib) {a->id.flag &=~LIB_INDIRECT; a->id.flag |= LIB_EXTERN;}
 
 static void lib_indirect_test_id(ID *id, Library *lib)
 {
 	
-	if(id->lib) {
+	if (id->lib) {
 		/* datablocks that were indirectly related are now direct links
 		 * without this, appending data that has a link to other data will fail to write */
-		if(lib && id->lib->parent == lib) {
+		if (lib && id->lib->parent == lib) {
 			id_lib_extern(id);
 		}
 		return;
 	}
 	
-	if(GS(id->name)==ID_OB) {		
+	if (GS(id->name)==ID_OB) {		
 		Object *ob= (Object *)id;
 		Mesh *me;
 
@@ -1329,7 +1333,7 @@ static void lib_indirect_test_id(ID *id, Library *lib)
 		// XXX old animation system! --------------------------------------
 		{
 			bActionStrip *strip;
-			for (strip=ob->nlastrips.first; strip; strip=strip->next){
+			for (strip=ob->nlastrips.first; strip; strip=strip->next) {
 				LIBTAG(strip->object);
 				LIBTAG(strip->act);
 				LIBTAG(strip->ipo);
@@ -1338,7 +1342,7 @@ static void lib_indirect_test_id(ID *id, Library *lib)
 		// XXX: new animation system needs something like this?
 #endif
 
-		for(a=0; a<ob->totcol; a++) {
+		for (a=0; a<ob->totcol; a++) {
 			LIBTAG(ob->mat[a]);
 		}
 	
@@ -1353,13 +1357,13 @@ static void lib_indirect_test_id(ID *id, Library *lib)
 void tag_main_lb(ListBase *lb, const short tag)
 {
 	ID *id;
-	if(tag) {
-		for(id= lb->first; id; id= id->next) {
+	if (tag) {
+		for (id= lb->first; id; id= id->next) {
 			id->flag |= LIB_DOIT;
 		}
 	}
 	else {
-		for(id= lb->first; id; id= id->next) {
+		for (id= lb->first; id; id= id->next) {
 			id->flag &= ~LIB_DOIT;
 		}
 	}
@@ -1378,7 +1382,7 @@ void tag_main(struct Main *mainvar, const short tag)
 	int a;
 
 	a= set_listbasepointers(mainvar, lbarray);
-	while(a--) {
+	while (a--) {
 		tag_main_lb(lbarray[a], tag);
 	}
 }
@@ -1392,28 +1396,28 @@ void BKE_library_make_local(Main *bmain, Library *lib, int untagged_only)
 	int a;
 
 	a= set_listbasepointers(bmain, lbarray);
-	while(a--) {
+	while (a--) {
 		id= lbarray[a]->first;
 		
-		while(id) {
+		while (id) {
 			id->newid= NULL;
 			idn= id->next;		/* id is possibly being inserted again */
 			
 			/* The check on the second line (LIB_PRE_EXISTING) is done so its
-			 * possible to tag data you dont want to be made local, used for
+			 * possible to tag data you don't want to be made local, used for
 			 * appending data, so any libdata already linked wont become local
 			 * (very nasty to discover all your links are lost after appending)  
 			 * */
-			if(id->flag & (LIB_EXTERN|LIB_INDIRECT|LIB_NEW) &&
+			if (id->flag & (LIB_EXTERN|LIB_INDIRECT|LIB_NEW) &&
 			  (untagged_only==0 || !(id->flag & LIB_PRE_EXISTING)))
 			{
-				if(lib==NULL || id->lib==lib) {
-					if(id->lib) {
+				if (lib==NULL || id->lib==lib) {
+					if (id->lib) {
 						id_clear_lib_data(bmain, id); /* sets 'id->flag' */
 
 						/* why sort alphabetically here but not in
 						 * id_clear_lib_data() ? - campbell */
-						sort_alpha_id(lbarray[a], id);
+						id_sort_by_name(lbarray[a], id);
 					}
 					else {
 						id->flag &= ~(LIB_EXTERN|LIB_INDIRECT|LIB_NEW);
@@ -1424,7 +1428,7 @@ void BKE_library_make_local(Main *bmain, Library *lib, int untagged_only)
 		}
 		
 		/* patch2: make it aphabetically */
-		while( (id=tempbase.first) ) {
+		while ( (id=tempbase.first) ) {
 			BLI_remlink(&tempbase, id);
 			BLI_addtail(lbarray[a], id);
 			new_id(lbarray[a], id, NULL);
@@ -1433,8 +1437,8 @@ void BKE_library_make_local(Main *bmain, Library *lib, int untagged_only)
 
 	/* patch 3: make sure library data isn't indirect falsely... */
 	a= set_listbasepointers(bmain, lbarray);
-	while(a--) {
-		for(id= lbarray[a]->first; id; id=id->next)
+	while (a--) {
+		for (id= lbarray[a]->first; id; id=id->next)
 			lib_indirect_test_id(id, lib);
 	}
 }
@@ -1448,22 +1452,22 @@ void test_idbutton(char *name)
 	
 
 	lb= which_libbase(G.main, GS(name-2) );
-	if(lb==NULL) return;
+	if (lb==NULL) return;
 	
 	/* search for id */
 	idtest= BLI_findstring(lb, name, offsetof(ID, name) + 2);
 
-	if(idtest) if( new_id(lb, idtest, name)==0 ) sort_alpha_id(lb, idtest);
+	if (idtest) if ( new_id(lb, idtest, name)==0 ) id_sort_by_name(lb, idtest);
 }
 
 void text_idbutton(struct ID *id, char *text)
 {
-	if(id) {
-		if(GS(id->name)==ID_SCE)
+	if (id) {
+		if (GS(id->name)==ID_SCE)
 			strcpy(text, "SCE: ");
-		else if(GS(id->name)==ID_SCR)
+		else if (GS(id->name)==ID_SCR)
 			strcpy(text, "SCR: ");
-		else if(GS(id->name)==ID_MA && ((Material*)id)->use_nodes)
+		else if (GS(id->name)==ID_MA && ((Material*)id)->use_nodes)
 			strcpy(text, "NT: ");
 		else {
 			text[0]= id->name[0];
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index f685d0e..6d44282 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -82,29 +82,29 @@ void free_material(Material *ma)
 	MTex *mtex;
 	int a;
 	
-	for(a=0; a<MAX_MTEX; a++) {
+	for (a=0; a<MAX_MTEX; a++) {
 		mtex= ma->mtex[a];
-		if(mtex && mtex->tex) mtex->tex->id.us--;
-		if(mtex) MEM_freeN(mtex);
+		if (mtex && mtex->tex) mtex->tex->id.us--;
+		if (mtex) MEM_freeN(mtex);
 	}
 	
-	if(ma->ramp_col) MEM_freeN(ma->ramp_col);
-	if(ma->ramp_spec) MEM_freeN(ma->ramp_spec);
+	if (ma->ramp_col) MEM_freeN(ma->ramp_col);
+	if (ma->ramp_spec) MEM_freeN(ma->ramp_spec);
 	
 	BKE_free_animdata((ID *)ma);
 	
-	if(ma->preview)
+	if (ma->preview)
 		BKE_previewimg_free(&ma->preview);
 	BKE_icon_delete((struct ID*)ma);
 	ma->id.icon_id = 0;
 	
 	/* is no lib link block, but material extension */
-	if(ma->nodetree) {
+	if (ma->nodetree) {
 		ntreeFreeTree(ma->nodetree);
 		MEM_freeN(ma->nodetree);
 	}
 
-	if(ma->gpumaterial.first)
+	if (ma->gpumaterial.first)
 		GPU_material_free(ma);
 }
 
@@ -220,20 +220,20 @@ Material *copy_material(Material *ma)
 	
 	id_lib_extern((ID *)man->group);
 	
-	for(a=0; a<MAX_MTEX; a++) {
-		if(ma->mtex[a]) {
+	for (a=0; a<MAX_MTEX; a++) {
+		if (ma->mtex[a]) {
 			man->mtex[a]= MEM_mallocN(sizeof(MTex), "copymaterial");
 			memcpy(man->mtex[a], ma->mtex[a], sizeof(MTex));
 			id_us_plus((ID *)man->mtex[a]->tex);
 		}
 	}
 	
-	if(ma->ramp_col) man->ramp_col= MEM_dupallocN(ma->ramp_col);
-	if(ma->ramp_spec) man->ramp_spec= MEM_dupallocN(ma->ramp_spec);
+	if (ma->ramp_col) man->ramp_col= MEM_dupallocN(ma->ramp_col);
+	if (ma->ramp_spec) man->ramp_spec= MEM_dupallocN(ma->ramp_spec);
 	
 	if (ma->preview) man->preview = BKE_previewimg_copy(ma->preview);
 
-	if(ma->nodetree) {
+	if (ma->nodetree) {
 		man->nodetree= ntreeCopyTree(ma->nodetree);	/* 0 == full new tree */
 	}
 
@@ -252,19 +252,19 @@ Material *localize_material(Material *ma)
 	BLI_remlink(&G.main->mat, man);
 
 	/* no increment for texture ID users, in previewrender.c it prevents decrement */
-	for(a=0; a<MAX_MTEX; a++) {
-		if(ma->mtex[a]) {
+	for (a=0; a<MAX_MTEX; a++) {
+		if (ma->mtex[a]) {
 			man->mtex[a]= MEM_mallocN(sizeof(MTex), "copymaterial");
 			memcpy(man->mtex[a], ma->mtex[a], sizeof(MTex));
 		}
 	}
 	
-	if(ma->ramp_col) man->ramp_col= MEM_dupallocN(ma->ramp_col);
-	if(ma->ramp_spec) man->ramp_spec= MEM_dupallocN(ma->ramp_spec);
+	if (ma->ramp_col) man->ramp_col= MEM_dupallocN(ma->ramp_col);
+	if (ma->ramp_spec) man->ramp_spec= MEM_dupallocN(ma->ramp_spec);
 	
 	man->preview = NULL;
 	
-	if(ma->nodetree)
+	if (ma->nodetree)
 		man->nodetree= ntreeLocalize(ma->nodetree);
 	
 	man->gpumaterial.first= man->gpumaterial.last= NULL;
@@ -275,8 +275,8 @@ Material *localize_material(Material *ma)
 static void extern_local_material(Material *ma)
 {
 	int i;
-	for(i=0; i < MAX_MTEX; i++) {
-		if(ma->mtex[i]) id_lib_extern((ID *)ma->mtex[i]->tex);
+	for (i=0; i < MAX_MTEX; i++) {
+		if (ma->mtex[i]) id_lib_extern((ID *)ma->mtex[i]->tex);
 	}
 }
 
@@ -290,28 +290,28 @@ void make_local_material(Material *ma)
 	int a, is_local= FALSE, is_lib= FALSE;
 
 	/* - only lib users: do nothing
-		* - only local users: set flag
-		* - mixed: make copy
-		*/
+	 * - only local users: set flag
+	 * - mixed: make copy
+	 */
 	
-	if(ma->id.lib==NULL) return;
+	if (ma->id.lib==NULL) return;
 
 	/* One local user; set flag and return. */
-	if(ma->id.us==1) {
+	if (ma->id.us==1) {
 		id_clear_lib_data(bmain, &ma->id);
 		extern_local_material(ma);
 		return;
 	}
 
 	/* Check which other IDs reference this one to determine if it's used by
-	   lib or local */
+	 * lib or local */
 	/* test objects */
 	ob= bmain->object.first;
-	while(ob) {
-		if(ob->mat) {
-			for(a=0; a<ob->totcol; a++) {
-				if(ob->mat[a]==ma) {
-					if(ob->id.lib) is_lib= TRUE;
+	while (ob) {
+		if (ob->mat) {
+			for (a=0; a<ob->totcol; a++) {
+				if (ob->mat[a]==ma) {
+					if (ob->id.lib) is_lib= TRUE;
 					else is_local= TRUE;
 				}
 			}
@@ -320,11 +320,11 @@ void make_local_material(Material *ma)
 	}
 	/* test meshes */
 	me= bmain->mesh.first;
-	while(me) {
-		if(me->mat) {
-			for(a=0; a<me->totcol; a++) {
-				if(me->mat[a]==ma) {
-					if(me->id.lib) is_lib= TRUE;
+	while (me) {
+		if (me->mat) {
+			for (a=0; a<me->totcol; a++) {
+				if (me->mat[a]==ma) {
+					if (me->id.lib) is_lib= TRUE;
 					else is_local= TRUE;
 				}
 			}
@@ -333,11 +333,11 @@ void make_local_material(Material *ma)
 	}
 	/* test curves */
 	cu= bmain->curve.first;
-	while(cu) {
-		if(cu->mat) {
-			for(a=0; a<cu->totcol; a++) {
-				if(cu->mat[a]==ma) {
-					if(cu->id.lib) is_lib= TRUE;
+	while (cu) {
+		if (cu->mat) {
+			for (a=0; a<cu->totcol; a++) {
+				if (cu->mat[a]==ma) {
+					if (cu->id.lib) is_lib= TRUE;
 					else is_local= TRUE;
 				}
 			}
@@ -346,11 +346,11 @@ void make_local_material(Material *ma)
 	}
 	/* test mballs */
 	mb= bmain->mball.first;
-	while(mb) {
-		if(mb->mat) {
-			for(a=0; a<mb->totcol; a++) {
-				if(mb->mat[a]==ma) {
-					if(mb->id.lib) is_lib= TRUE;
+	while (mb) {
+		if (mb->mat) {
+			for (a=0; a<mb->totcol; a++) {
+				if (mb->mat[a]==ma) {
+					if (mb->id.lib) is_lib= TRUE;
 					else is_local= TRUE;
 				}
 			}
@@ -359,12 +359,12 @@ void make_local_material(Material *ma)
 	}
 
 	/* Only local users. */
-	if(is_local && is_lib == FALSE) {
+	if (is_local && is_lib == FALSE) {
 		id_clear_lib_data(bmain, &ma->id);
 		extern_local_material(ma);
 	}
 	/* Both user and local, so copy. */
-	else if(is_local && is_lib) {
+	else if (is_local && is_lib) {
 		Material *ma_new= copy_material(ma);
 
 		ma_new->id.us= 0;
@@ -374,11 +374,11 @@ void make_local_material(Material *ma)
 
 		/* do objects */
 		ob= bmain->object.first;
-		while(ob) {
-			if(ob->mat) {
-				for(a=0; a<ob->totcol; a++) {
-					if(ob->mat[a]==ma) {
-						if(ob->id.lib==NULL) {
+		while (ob) {
+			if (ob->mat) {
+				for (a=0; a<ob->totcol; a++) {
+					if (ob->mat[a]==ma) {
+						if (ob->id.lib==NULL) {
 							ob->mat[a]= ma_new;
 							ma_new->id.us++;
 							ma->id.us--;
@@ -390,11 +390,11 @@ void make_local_material(Material *ma)
 		}
 		/* do meshes */
 		me= bmain->mesh.first;
-		while(me) {
-			if(me->mat) {
-				for(a=0; a<me->totcol; a++) {
-					if(me->mat[a]==ma) {
-						if(me->id.lib==NULL) {
+		while (me) {
+			if (me->mat) {
+				for (a=0; a<me->totcol; a++) {
+					if (me->mat[a]==ma) {
+						if (me->id.lib==NULL) {
 							me->mat[a]= ma_new;
 							ma_new->id.us++;
 							ma->id.us--;
@@ -406,11 +406,11 @@ void make_local_material(Material *ma)
 		}
 		/* do curves */
 		cu= bmain->curve.first;
-		while(cu) {
-			if(cu->mat) {
-				for(a=0; a<cu->totcol; a++) {
-					if(cu->mat[a]==ma) {
-						if(cu->id.lib==NULL) {
+		while (cu) {
+			if (cu->mat) {
+				for (a=0; a<cu->totcol; a++) {
+					if (cu->mat[a]==ma) {
+						if (cu->id.lib==NULL) {
 							cu->mat[a]= ma_new;
 							ma_new->id.us++;
 							ma->id.us--;
@@ -422,11 +422,11 @@ void make_local_material(Material *ma)
 		}
 		/* do mballs */
 		mb= bmain->mball.first;
-		while(mb) {
-			if(mb->mat) {
-				for(a=0; a<mb->totcol; a++) {
-					if(mb->mat[a]==ma) {
-						if(mb->id.lib==NULL) {
+		while (mb) {
+			if (mb->mat) {
+				for (a=0; a<mb->totcol; a++) {
+					if (mb->mat[a]==ma) {
+						if (mb->id.lib==NULL) {
 							mb->mat[a]= ma_new;
 							ma_new->id.us++;
 							ma->id.us--;
@@ -443,7 +443,7 @@ void make_local_material(Material *ma)
 void extern_local_matarar(struct Material **matar, short totcol)
 {
 	short i;
-	for(i= 0; i < totcol; i++) {
+	for (i= 0; i < totcol; i++) {
 		id_lib_extern((ID *)matar[i]);
 	}
 }
@@ -454,15 +454,15 @@ Material ***give_matarar(Object *ob)
 	Curve *cu;
 	MetaBall *mb;
 	
-	if(ob->type==OB_MESH) {
+	if (ob->type==OB_MESH) {
 		me= ob->data;
 		return &(me->mat);
 	}
-	else if ELEM3(ob->type, OB_CURVE, OB_FONT, OB_SURF) {
+	else if (ELEM3(ob->type, OB_CURVE, OB_FONT, OB_SURF)) {
 		cu= ob->data;
 		return &(cu->mat);
 	}
-	else if(ob->type==OB_MBALL) {
+	else if (ob->type==OB_MBALL) {
 		mb= ob->data;
 		return &(mb->mat);
 	}
@@ -475,15 +475,15 @@ short *give_totcolp(Object *ob)
 	Curve *cu;
 	MetaBall *mb;
 	
-	if(ob->type==OB_MESH) {
+	if (ob->type==OB_MESH) {
 		me= ob->data;
 		return &(me->totcol);
 	}
-	else if ELEM3(ob->type, OB_CURVE, OB_FONT, OB_SURF) {
+	else if (ELEM3(ob->type, OB_CURVE, OB_FONT, OB_SURF)) {
 		cu= ob->data;
 		return &(cu->totcol);
 	}
-	else if(ob->type==OB_MBALL) {
+	else if (ob->type==OB_MBALL) {
 		mb= ob->data;
 		return &(mb->totcol);
 	}
@@ -533,7 +533,7 @@ static void data_delete_material_index_id(ID *id, short index)
 		curve_delete_material_index((Curve *)id, index);
 		break;
 	case ID_MB:
-		/* meta-elems dont have materials atm */
+		/* meta-elems don't have materials atm */
 		break;
 	}
 }
@@ -541,11 +541,11 @@ static void data_delete_material_index_id(ID *id, short index)
 void material_append_id(ID *id, Material *ma)
 {
 	Material ***matar;
-	if((matar= give_matarar_id(id))) {
+	if ((matar= give_matarar_id(id))) {
 		short *totcol= give_totcolp_id(id);
 		Material **mat= MEM_callocN(sizeof(void *) * ((*totcol) + 1), "newmatar");
-		if(*totcol) memcpy(mat, *matar, sizeof(void *) * (*totcol));
-		if(*matar) MEM_freeN(*matar);
+		if (*totcol) memcpy(mat, *matar, sizeof(void *) * (*totcol));
+		if (*matar) MEM_freeN(*matar);
 
 		*matar= mat;
 		(*matar)[(*totcol)++]= ma;
@@ -560,21 +560,21 @@ Material *material_pop_id(ID *id, int index_i, int remove_material_slot)
 	short index= (short)index_i;
 	Material *ret= NULL;
 	Material ***matar;
-	if((matar= give_matarar_id(id))) {
+	if ((matar= give_matarar_id(id))) {
 		short *totcol= give_totcolp_id(id);
-		if(index >= 0 && index < (*totcol)) {
+		if (index >= 0 && index < (*totcol)) {
 			ret= (*matar)[index];
 			id_us_min((ID *)ret);
 
 			if (remove_material_slot) {
-				if(*totcol <= 1) {
+				if (*totcol <= 1) {
 					*totcol= 0;
 					MEM_freeN(*matar);
 					*matar= NULL;
 				}
 				else {
 					Material **mat;
-					if(index + 1 != (*totcol))
+					if (index + 1 != (*totcol))
 						memmove((*matar)+index, (*matar)+(index+1), sizeof(void *) * ((*totcol) - (index + 1)));
 
 					(*totcol)--;
@@ -605,32 +605,32 @@ Material *give_current_material(Object *ob, short act)
 	Material ***matarar, *ma;
 	short *totcolp;
 	
-	if(ob==NULL) return NULL;
+	if (ob==NULL) return NULL;
 	
 	/* if object cannot have material, totcolp==NULL */
 	totcolp= give_totcolp(ob);
-	if(totcolp==NULL || ob->totcol==0) return NULL;
+	if (totcolp==NULL || ob->totcol==0) return NULL;
 	
-	if(act<0) {
+	if (act<0) {
 		printf("no!\n");
 	}
 	
-	if(act>ob->totcol) act= ob->totcol;
-	else if(act<=0) act= 1;
+	if (act>ob->totcol) act= ob->totcol;
+	else if (act<=0) act= 1;
 
-	if(ob->matbits && ob->matbits[act-1]) {	/* in object */
+	if (ob->matbits && ob->matbits[act-1]) {	/* in object */
 		ma= ob->mat[act-1];
 	}
 	else {								/* in data */
 
 		/* check for inconsistency */
-		if(*totcolp < ob->totcol)
+		if (*totcolp < ob->totcol)
 			ob->totcol= *totcolp;
-		if(act>ob->totcol) act= ob->totcol;
+		if (act>ob->totcol) act= ob->totcol;
 
 		matarar= give_matarar(ob);
 		
-		if(matarar && *matarar) ma= (*matarar)[act-1];
+		if (matarar && *matarar) ma= (*matarar)[act-1];
 		else ma= NULL;
 		
 	}
@@ -641,21 +641,21 @@ Material *give_current_material(Object *ob, short act)
 ID *material_from(Object *ob, short act)
 {
 
-	if(ob==NULL) return NULL;
+	if (ob==NULL) return NULL;
 
-	if(ob->totcol==0) return ob->data;
-	if(act==0) act= 1;
+	if (ob->totcol==0) return ob->data;
+	if (act==0) act= 1;
 
-	if(ob->matbits[act-1]) return (ID *)ob;
+	if (ob->matbits[act-1]) return (ID *)ob;
 	else return ob->data;
 }
 
 Material *give_node_material(Material *ma)
 {
-	if(ma && ma->use_nodes && ma->nodetree) {
+	if (ma && ma->use_nodes && ma->nodetree) {
 		bNode *node= nodeGetActiveID(ma->nodetree, ID_MA);
 
-		if(node)
+		if (node)
 			return (Material *)node->id;
 	}
 
@@ -680,18 +680,18 @@ void resize_object_material(Object *ob, const short totcol)
 	Material **newmatar;
 	char *newmatbits;
 
-	if(totcol==0) {
-		if(ob->totcol) {
+	if (totcol==0) {
+		if (ob->totcol) {
 			MEM_freeN(ob->mat);
 			MEM_freeN(ob->matbits);
 			ob->mat= NULL;
 			ob->matbits= NULL;
 		}
 	}
-	else if(ob->totcol<totcol) {
+	else if (ob->totcol<totcol) {
 		newmatar= MEM_callocN(sizeof(void *)*totcol, "newmatar");
 		newmatbits= MEM_callocN(sizeof(char)*totcol, "newmatbits");
-		if(ob->totcol) {
+		if (ob->totcol) {
 			memcpy(newmatar, ob->mat, sizeof(void *)*ob->totcol);
 			memcpy(newmatbits, ob->matbits, sizeof(char)*ob->totcol);
 			MEM_freeN(ob->mat);
@@ -701,8 +701,8 @@ void resize_object_material(Object *ob, const short totcol)
 		ob->matbits= newmatbits;
 	}
 	ob->totcol= totcol;
-	if(ob->totcol && ob->actcol==0) ob->actcol= 1;
-	if(ob->actcol>ob->totcol) ob->actcol= ob->totcol;
+	if (ob->totcol && ob->actcol==0) ob->actcol= 1;
+	if (ob->actcol>ob->totcol) ob->actcol= ob->totcol;
 }
 
 void test_object_materials(ID *id)
@@ -711,12 +711,12 @@ void test_object_materials(ID *id)
 	Object *ob;
 	short *totcol;
 
-	if(id==NULL || (totcol=give_totcolp_id(id))==NULL) {
+	if (id==NULL || (totcol=give_totcolp_id(id))==NULL) {
 		return;
 	}
 
-	for(ob= G.main->object.first; ob; ob= ob->id.next) {
-		if(ob->data==id) {
+	for (ob= G.main->object.first; ob; ob= ob->id.next) {
+		if (ob->data==id) {
 			resize_object_material(ob, *totcol);
 		}
 	}
@@ -727,24 +727,24 @@ void assign_material_id(ID *id, Material *ma, short act)
 	Material *mao, **matar, ***matarar;
 	short *totcolp;
 
-	if(act>MAXMAT) return;
-	if(act<1) act= 1;
+	if (act>MAXMAT) return;
+	if (act<1) act= 1;
 
 	/* prevent crashing when using accidentally */
 	BLI_assert(id->lib == NULL);
-	if(id->lib) return;
+	if (id->lib) return;
 
 	/* test arraylens */
 
 	totcolp= give_totcolp_id(id);
 	matarar= give_matarar_id(id);
 
-	if(totcolp==NULL || matarar==NULL) return;
+	if (totcolp==NULL || matarar==NULL) return;
 
-	if(act > *totcolp) {
+	if (act > *totcolp) {
 		matar= MEM_callocN(sizeof(void *)*act, "matarray1");
 
-		if(*totcolp) {
+		if (*totcolp) {
 			memcpy(matar, *matarar, sizeof(void *)*(*totcolp));
 			MEM_freeN(*matarar);
 		}
@@ -755,10 +755,10 @@ void assign_material_id(ID *id, Material *ma, short act)
 
 	/* in data */
 	mao= (*matarar)[act-1];
-	if(mao) mao->id.us--;
+	if (mao) mao->id.us--;
 	(*matarar)[act-1]= ma;
 
-	if(ma)
+	if (ma)
 		id_us_plus((ID *)ma);
 
 	test_object_materials(id);
@@ -770,24 +770,24 @@ void assign_material(Object *ob, Material *ma, short act)
 	char *matbits;
 	short *totcolp;
 
-	if(act>MAXMAT) return;
-	if(act<1) act= 1;
+	if (act>MAXMAT) return;
+	if (act<1) act= 1;
 	
 	/* prevent crashing when using accidentally */
 	BLI_assert(ob->id.lib == NULL);
-	if(ob->id.lib) return;
+	if (ob->id.lib) return;
 	
 	/* test arraylens */
 	
 	totcolp= give_totcolp(ob);
 	matarar= give_matarar(ob);
 	
-	if(totcolp==NULL || matarar==NULL) return;
+	if (totcolp==NULL || matarar==NULL) return;
 	
-	if(act > *totcolp) {
+	if (act > *totcolp) {
 		matar= MEM_callocN(sizeof(void *)*act, "matarray1");
 
-		if(*totcolp) {
+		if (*totcolp) {
 			memcpy(matar, *matarar, sizeof(void *)*(*totcolp));
 			MEM_freeN(*matarar);
 		}
@@ -796,10 +796,10 @@ void assign_material(Object *ob, Material *ma, short act)
 		*totcolp= act;
 	}
 	
-	if(act > ob->totcol) {
+	if (act > ob->totcol) {
 		matar= MEM_callocN(sizeof(void *)*act, "matarray2");
 		matbits= MEM_callocN(sizeof(char)*act, "matbits1");
-		if( ob->totcol) {
+		if ( ob->totcol) {
 			memcpy(matar, ob->mat, sizeof(void *)*( ob->totcol ));
 			memcpy(matbits, ob->matbits, sizeof(char)*(*totcolp));
 			MEM_freeN(ob->mat);
@@ -810,7 +810,7 @@ void assign_material(Object *ob, Material *ma, short act)
 		ob->totcol= act;
 
 		/* copy object/mesh linking, or assign based on userpref */
-		if(ob->actcol)
+		if (ob->actcol)
 			ob->matbits[act-1]= ob->matbits[ob->actcol-1];
 		else
 			ob->matbits[act-1]= (U.flag & USER_MAT_ON_OB)? 1: 0;
@@ -818,18 +818,18 @@ void assign_material(Object *ob, Material *ma, short act)
 	
 	/* do it */
 
-	if(ob->matbits[act-1]) {	/* in object */
+	if (ob->matbits[act-1]) {	/* in object */
 		mao= ob->mat[act-1];
-		if(mao) mao->id.us--;
+		if (mao) mao->id.us--;
 		ob->mat[act-1]= ma;
 	}
 	else {	/* in data */
 		mao= (*matarar)[act-1];
-		if(mao) mao->id.us--;
+		if (mao) mao->id.us--;
 		(*matarar)[act-1]= ma;
 	}
 
-	if(ma)
+	if (ma)
 		id_us_plus((ID *)ma);
 	test_object_materials(ob->data);
 }
@@ -840,13 +840,13 @@ void assign_matarar(struct Object *ob, struct Material ***matar, short totcol)
 	int actcol_orig= ob->actcol;
 	short i;
 
-	while(object_remove_material_slot(ob)) {};
+	while (object_remove_material_slot(ob)) {};
 
 	/* now we have the right number of slots */
-	for(i=0; i<totcol; i++)
+	for (i=0; i<totcol; i++)
 		assign_material(ob, (*matar)[i], i+1);
 
-	if(actcol_orig > ob->totcol)
+	if (actcol_orig > ob->totcol)
 		actcol_orig= ob->totcol;
 
 	ob->actcol= actcol_orig;
@@ -858,25 +858,25 @@ short find_material_index(Object *ob, Material *ma)
 	Material ***matarar;
 	short a, *totcolp;
 	
-	if(ma==NULL) return 0;
+	if (ma==NULL) return 0;
 	
 	totcolp= give_totcolp(ob);
 	matarar= give_matarar(ob);
 	
-	if(totcolp==NULL || matarar==NULL) return 0;
+	if (totcolp==NULL || matarar==NULL) return 0;
 	
-	for(a=0; a<*totcolp; a++)
-		if((*matarar)[a]==ma)
+	for (a=0; a<*totcolp; a++)
+		if ((*matarar)[a]==ma)
 		   break;
-	if(a<*totcolp)
+	if (a<*totcolp)
 		return a+1;
 	return 0;	   
 }
 
 int object_add_material_slot(Object *ob)
 {
-	if(ob==NULL) return FALSE;
-	if(ob->totcol>=MAXMAT) return FALSE;
+	if (ob==NULL) return FALSE;
+	if (ob->totcol>=MAXMAT) return FALSE;
 	
 	assign_material(ob, NULL, ob->totcol+1);
 	ob->actcol= ob->totcol;
@@ -888,51 +888,51 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb)
 	MTex *mtex;
 	int a, needuv=0, needtang=0;
 	
-	if(ma->flarec==0) ma->flarec= 1;
+	if (ma->flarec==0) ma->flarec= 1;
 
 	/* add all texcoflags from mtex, texco and mapto were cleared in advance */
-	for(a=0; a<MAX_MTEX; a++) {
+	for (a=0; a<MAX_MTEX; a++) {
 		
 		/* separate tex switching */
-		if(ma->septex & (1<<a)) continue;
+		if (ma->septex & (1<<a)) continue;
 
 		mtex= ma->mtex[a];
-		if(mtex && mtex->tex && (mtex->tex->type | (mtex->tex->use_nodes && mtex->tex->nodetree) )) {
+		if (mtex && mtex->tex && (mtex->tex->type | (mtex->tex->use_nodes && mtex->tex->nodetree) )) {
 			
 			ma->texco |= mtex->texco;
 			ma->mapto |= mtex->mapto;
 
 			/* always get derivatives for these textures */
-			if ELEM3(mtex->tex->type, TEX_IMAGE, TEX_PLUGIN, TEX_ENVMAP) ma->texco |= TEXCO_OSA;
-			else if(mtex->texflag & (MTEX_COMPAT_BUMP|MTEX_3TAP_BUMP|MTEX_5TAP_BUMP|MTEX_BICUBIC_BUMP)) ma->texco |= TEXCO_OSA;
+			if (ELEM3(mtex->tex->type, TEX_IMAGE, TEX_PLUGIN, TEX_ENVMAP)) ma->texco |= TEXCO_OSA;
+			else if (mtex->texflag & (MTEX_COMPAT_BUMP|MTEX_3TAP_BUMP|MTEX_5TAP_BUMP|MTEX_BICUBIC_BUMP)) ma->texco |= TEXCO_OSA;
 			
-			if(ma->texco & (TEXCO_ORCO|TEXCO_REFL|TEXCO_NORM|TEXCO_STRAND|TEXCO_STRESS)) needuv= 1;
-			else if(ma->texco & (TEXCO_GLOB|TEXCO_UV|TEXCO_OBJECT|TEXCO_SPEED)) needuv= 1;
-			else if(ma->texco & (TEXCO_LAVECTOR|TEXCO_VIEW|TEXCO_STICKY)) needuv= 1;
+			if (ma->texco & (TEXCO_ORCO|TEXCO_REFL|TEXCO_NORM|TEXCO_STRAND|TEXCO_STRESS)) needuv= 1;
+			else if (ma->texco & (TEXCO_GLOB|TEXCO_UV|TEXCO_OBJECT|TEXCO_SPEED)) needuv= 1;
+			else if (ma->texco & (TEXCO_LAVECTOR|TEXCO_VIEW|TEXCO_STICKY)) needuv= 1;
 
-			if((ma->mapto & MAP_NORM) && (mtex->normapspace == MTEX_NSPACE_TANGENT))
+			if ((ma->mapto & MAP_NORM) && (mtex->normapspace == MTEX_NSPACE_TANGENT))
 				needtang= 1;
 		}
 	}
 
-	if(needtang) ma->mode |= MA_NORMAP_TANG;
+	if (needtang) ma->mode |= MA_NORMAP_TANG;
 	else ma->mode &= ~MA_NORMAP_TANG;
 	
-	if(ma->mode & (MA_VERTEXCOL|MA_VERTEXCOLP|MA_FACETEXTURE)) {
+	if (ma->mode & (MA_VERTEXCOL|MA_VERTEXCOLP|MA_FACETEXTURE)) {
 		needuv= 1;
-		if(r_mode & R_OSA) ma->texco |= TEXCO_OSA;		/* for texfaces */
+		if (r_mode & R_OSA) ma->texco |= TEXCO_OSA;		/* for texfaces */
 	}
-	if(needuv) ma->texco |= NEED_UV;
+	if (needuv) ma->texco |= NEED_UV;
 	
 	/* since the raytracer doesnt recalc O structs for each ray, we have to preset them all */
-	if(r_mode & R_RAYTRACE) {
-		if((ma->mode & (MA_RAYMIRROR|MA_SHADOW_TRA)) || ((ma->mode & MA_TRANSP) && (ma->mode & MA_RAYTRANSP))) {
+	if (r_mode & R_RAYTRACE) {
+		if ((ma->mode & (MA_RAYMIRROR|MA_SHADOW_TRA)) || ((ma->mode & MA_TRANSP) && (ma->mode & MA_RAYTRANSP))) {
 			ma->texco |= NEED_UV|TEXCO_ORCO|TEXCO_REFL|TEXCO_NORM;
-			if(r_mode & R_OSA) ma->texco |= TEXCO_OSA;
+			if (r_mode & R_OSA) ma->texco |= TEXCO_OSA;
 		}
 	}
 	
-	if(amb) {
+	if (amb) {
 		ma->ambr= ma->amb*amb[0];
 		ma->ambg= ma->amb*amb[1];
 		ma->ambb= ma->amb*amb[2];
@@ -941,11 +941,11 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb)
 	ma->mode_l= ma->mode;
 	ma->mode_l &= ~MA_SHLESS;
 
-	if(ma->strand_surfnor > 0.0f)
+	if (ma->strand_surfnor > 0.0f)
 		ma->mode_l |= MA_STR_SURFDIFF;
 
 	/* parses the geom+tex nodes */
-	if(ma->nodetree && ma->use_nodes)
+	if (ma->nodetree && ma->use_nodes)
 		ntreeShaderGetTexcoMode(ma->nodetree, r_mode, &ma->texco, &ma->mode_l);
 }
 
@@ -953,17 +953,17 @@ static void init_render_nodetree(bNodeTree *ntree, Material *basemat, int r_mode
 {
 	bNode *node;
 	
-	for(node=ntree->nodes.first; node; node= node->next) {
-		if(node->id) {
-			if(GS(node->id->name)==ID_MA) {
+	for (node=ntree->nodes.first; node; node= node->next) {
+		if (node->id) {
+			if (GS(node->id->name)==ID_MA) {
 				Material *ma= (Material *)node->id;
-				if(ma!=basemat) {
+				if (ma!=basemat) {
 					do_init_render_material(ma, r_mode, amb);
 					basemat->texco |= ma->texco;
 					basemat->mode_l |= ma->mode_l & ~(MA_TRANSP|MA_ZTRANSP|MA_RAYTRANSP); 
 				}
 			}
-			else if(node->type==NODE_GROUP)
+			else if (node->type==NODE_GROUP)
 				init_render_nodetree((bNodeTree *)node->id, basemat, r_mode, amb);
 		}
 	}
@@ -974,7 +974,7 @@ void init_render_material(Material *mat, int r_mode, float *amb)
 	
 	do_init_render_material(mat, r_mode, amb);
 	
-	if(mat->nodetree && mat->use_nodes) {
+	if (mat->nodetree && mat->use_nodes) {
 		init_render_nodetree(mat->nodetree, mat, r_mode, amb);
 		
 		if (!mat->nodetree->execdata)
@@ -989,18 +989,18 @@ void init_render_materials(Main *bmain, int r_mode, float *amb)
 	/* clear these flags before going over materials, to make sure they
 	 * are cleared only once, otherwise node materials contained in other
 	 * node materials can go wrong */
-	for(ma= bmain->mat.first; ma; ma= ma->id.next) {
-		if(ma->id.us) {
+	for (ma= bmain->mat.first; ma; ma= ma->id.next) {
+		if (ma->id.us) {
 			ma->texco= 0;
 			ma->mapto= 0;
 		}
 	}
 
 	/* two steps, first initialize, then or the flags for layers */
-	for(ma= bmain->mat.first; ma; ma= ma->id.next) {
+	for (ma= bmain->mat.first; ma; ma= ma->id.next) {
 		/* is_used flag comes back in convertblender.c */
 		ma->flag &= ~MA_IS_USED;
-		if(ma->id.us) 
+		if (ma->id.us) 
 			init_render_material(ma, r_mode, amb);
 	}
 	
@@ -1010,7 +1010,7 @@ void init_render_materials(Main *bmain, int r_mode, float *amb)
 /* only needed for nodes now */
 void end_render_material(Material *mat)
 {
-	if(mat && mat->nodetree && mat->use_nodes) {
+	if (mat && mat->nodetree && mat->use_nodes) {
 		if (mat->nodetree->execdata)
 			ntreeShaderEndExecTree(mat->nodetree->execdata, 1);
 	}
@@ -1019,8 +1019,8 @@ void end_render_material(Material *mat)
 void end_render_materials(Main *bmain)
 {
 	Material *ma;
-	for(ma= bmain->mat.first; ma; ma= ma->id.next)
-		if(ma->id.us) 
+	for (ma= bmain->mat.first; ma; ma= ma->id.next)
+		if (ma->id.us) 
 			end_render_material(ma);
 }
 
@@ -1028,13 +1028,13 @@ static int material_in_nodetree(bNodeTree *ntree, Material *mat)
 {
 	bNode *node;
 
-	for(node=ntree->nodes.first; node; node= node->next) {
-		if(node->id && GS(node->id->name)==ID_MA) {
-			if(node->id==(ID*)mat)
+	for (node=ntree->nodes.first; node; node= node->next) {
+		if (node->id && GS(node->id->name)==ID_MA) {
+			if (node->id==(ID*)mat)
 				return 1;
 		}
-		else if(node->type==NODE_GROUP)
-			if(material_in_nodetree((bNodeTree*)node->id, mat))
+		else if (node->type==NODE_GROUP)
+			if (material_in_nodetree((bNodeTree*)node->id, mat))
 				return 1;
 	}
 
@@ -1043,16 +1043,16 @@ static int material_in_nodetree(bNodeTree *ntree, Material *mat)
 
 int material_in_material(Material *parmat, Material *mat)
 {
-	if(parmat==mat)
+	if (parmat==mat)
 		return 1;
-	else if(parmat->nodetree && parmat->use_nodes)
+	else if (parmat->nodetree && parmat->use_nodes)
 		return material_in_nodetree(parmat->nodetree, mat);
 	else
 		return 0;
 }
 	
 /* ****************** */
-
+#if 0 /* UNUSED */
 static char colname_array[125][20]= {
 "Black","DarkRed","HalfRed","Red","Red",
 "DarkGreen","DarkOlive","Brown","Chocolate","OrangeRed",
@@ -1086,19 +1086,19 @@ void automatname(Material *ma)
 	int nr, r, g, b;
 	float ref;
 	
-	if(ma==NULL) return;
-	if(ma->mode & MA_SHLESS) ref= 1.0;
+	if (ma==NULL) return;
+	if (ma->mode & MA_SHLESS) ref= 1.0;
 	else ref= ma->ref;
 	
 	r= (int)(4.99f*(ref*ma->r));
 	g= (int)(4.99f*(ref*ma->g));
 	b= (int)(4.99f*(ref*ma->b));
 	nr= r + 5*g + 25*b;
-	if(nr>124) nr= 124;
+	if (nr>124) nr= 124;
 	new_id(&G.main->mat, (ID *)ma, colname_array[nr]);
 	
 }
-
+#endif
 
 int object_remove_material_slot(Object *ob)
 {
@@ -1127,39 +1127,39 @@ int object_remove_material_slot(Object *ob)
 	totcolp= give_totcolp(ob);
 	matarar= give_matarar(ob);
 
-	if(*matarar==NULL) return FALSE;
+	if (*matarar==NULL) return FALSE;
 
 	/* we delete the actcol */
 	mao= (*matarar)[ob->actcol-1];
-	if(mao) mao->id.us--;
+	if (mao) mao->id.us--;
 	
-	for(a=ob->actcol; a<ob->totcol; a++)
+	for (a=ob->actcol; a<ob->totcol; a++)
 		(*matarar)[a-1]= (*matarar)[a];
 	(*totcolp)--;
 	
-	if(*totcolp==0) {
+	if (*totcolp==0) {
 		MEM_freeN(*matarar);
 		*matarar= NULL;
 	}
 	
 	actcol= ob->actcol;
 	obt= G.main->object.first;
-	while(obt) {
+	while (obt) {
 	
-		if(obt->data==ob->data) {
+		if (obt->data==ob->data) {
 			
 			/* WATCH IT: do not use actcol from ob or from obt (can become zero) */
 			mao= obt->mat[actcol-1];
-			if(mao) mao->id.us--;
+			if (mao) mao->id.us--;
 		
-			for(a=actcol; a<obt->totcol; a++) {
+			for (a=actcol; a<obt->totcol; a++) {
 				obt->mat[a-1]= obt->mat[a];
 				obt->matbits[a-1]= obt->matbits[a];
 			}
 			obt->totcol--;
-			if(obt->actcol > obt->totcol) obt->actcol= obt->totcol;
+			if (obt->actcol > obt->totcol) obt->actcol= obt->totcol;
 			
-			if(obt->totcol==0) {
+			if (obt->totcol==0) {
 				MEM_freeN(obt->mat);
 				MEM_freeN(obt->matbits);
 				obt->mat= NULL;
@@ -1206,15 +1206,15 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
 			r_col[2] = 1.0f - (facm + fac*(1.0f - col[2])) * (1.0f - r_col[2]);
 			break;
 		case MA_RAMP_OVERLAY:
-			if(r_col[0] < 0.5f)
+			if (r_col[0] < 0.5f)
 				r_col[0] *= (facm + 2.0f*fac*col[0]);
 			else
 				r_col[0] = 1.0f - (facm + 2.0f*fac*(1.0f - col[0])) * (1.0f - r_col[0]);
-			if(r_col[1] < 0.5f)
+			if (r_col[1] < 0.5f)
 				r_col[1] *= (facm + 2.0f*fac*col[1]);
 			else
 				r_col[1] = 1.0f - (facm + 2.0f*fac*(1.0f - col[1])) * (1.0f - r_col[1]);
-			if(r_col[2] < 0.5f)
+			if (r_col[2] < 0.5f)
 				r_col[2] *= (facm + 2.0f*fac*col[2]);
 			else
 				r_col[2] = 1.0f - (facm + 2.0f*fac*(1.0f - col[2])) * (1.0f - r_col[2]);
@@ -1225,11 +1225,11 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
 			r_col[2] -= fac*col[2];
 			break;
 		case MA_RAMP_DIV:
-			if(col[0]!=0.0f)
+			if (col[0]!=0.0f)
 				r_col[0] = facm*(r_col[0]) + fac*(r_col[0])/col[0];
-			if(col[1]!=0.0f)
+			if (col[1]!=0.0f)
 				r_col[1] = facm*(r_col[1]) + fac*(r_col[1])/col[1];
-			if(col[2]!=0.0f)
+			if (col[2]!=0.0f)
 				r_col[2] = facm*(r_col[2]) + fac*(r_col[2])/col[2];
 			break;
 		case MA_RAMP_DIFF:
@@ -1239,42 +1239,42 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
 			break;
 		case MA_RAMP_DARK:
 			tmp=col[0]+((1-col[0])*facm);
-			if(tmp < r_col[0]) r_col[0]= tmp;
+			if (tmp < r_col[0]) r_col[0]= tmp;
 			tmp=col[1]+((1-col[1])*facm);
-			if(tmp < r_col[1]) r_col[1]= tmp;
+			if (tmp < r_col[1]) r_col[1]= tmp;
 			tmp=col[2]+((1-col[2])*facm);
-			if(tmp < r_col[2]) r_col[2]= tmp;
+			if (tmp < r_col[2]) r_col[2]= tmp;
 			break;
 		case MA_RAMP_LIGHT:
 			tmp= fac*col[0];
-			if(tmp > r_col[0]) r_col[0]= tmp;
+			if (tmp > r_col[0]) r_col[0]= tmp;
 				tmp= fac*col[1];
-				if(tmp > r_col[1]) r_col[1]= tmp;
+				if (tmp > r_col[1]) r_col[1]= tmp;
 				tmp= fac*col[2];
-				if(tmp > r_col[2]) r_col[2]= tmp;
+				if (tmp > r_col[2]) r_col[2]= tmp;
 				break;
 		case MA_RAMP_DODGE:
-			if(r_col[0] !=0.0f){
+			if (r_col[0] != 0.0f) {
 				tmp = 1.0f - fac*col[0];
-				if(tmp <= 0.0f)
+				if (tmp <= 0.0f)
 					r_col[0] = 1.0f;
 				else if ((tmp = (r_col[0]) / tmp)> 1.0f)
 					r_col[0] = 1.0f;
 				else
 					r_col[0] = tmp;
 			}
-			if(r_col[1] !=0.0f){
+			if (r_col[1] != 0.0f) {
 				tmp = 1.0f - fac*col[1];
-				if(tmp <= 0.0f )
+				if (tmp <= 0.0f )
 					r_col[1] = 1.0f;
 				else if ((tmp = (r_col[1]) / tmp) > 1.0f )
 					r_col[1] = 1.0f;
 				else
 					r_col[1] = tmp;
 			}
-			if(r_col[2] !=0.0f){
+			if (r_col[2] != 0.0f) {
 				tmp = 1.0f - fac*col[2];
-				if(tmp <= 0.0f)
+				if (tmp <= 0.0f)
 					r_col[2] = 1.0f;
 				else if ((tmp = (r_col[2]) / tmp) > 1.0f )
 					r_col[2] = 1.0f;
@@ -1285,7 +1285,7 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
 		case MA_RAMP_BURN:
 			tmp = facm + fac*col[0];
 
-			if(tmp <= 0.0f)
+			if (tmp <= 0.0f)
 				r_col[0] = 0.0f;
 			else if (( tmp = (1.0f - (1.0f - (r_col[0])) / tmp )) < 0.0f)
 					r_col[0] = 0.0f;
@@ -1295,21 +1295,21 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
 				r_col[0] = tmp;
 
 			tmp = facm + fac*col[1];
-			if(tmp <= 0.0f)
+			if (tmp <= 0.0f)
 				r_col[1] = 0.0f;
 			else if (( tmp = (1.0f - (1.0f - (r_col[1])) / tmp )) < 0.0f )
 					r_col[1] = 0.0f;
-			else if(tmp >1.0f)
+			else if (tmp >1.0f)
 				r_col[1]=1.0f;
 			else
 				r_col[1] = tmp;
 
 				tmp = facm + fac*col[2];
-				if(tmp <= 0.0f)
+				if (tmp <= 0.0f)
 				r_col[2] = 0.0f;
 			else if (( tmp = (1.0f - (1.0f - (r_col[2])) / tmp )) < 0.0f  )
 					r_col[2] = 0.0f;
-			else if(tmp >1.0f)
+			else if (tmp >1.0f)
 				r_col[2]= 1.0f;
 			else
 				r_col[2] = tmp;
@@ -1320,7 +1320,7 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
 				float colH,colS,colV;
 				float tmpr,tmpg,tmpb;
 				rgb_to_hsv(col[0],col[1],col[2],&colH,&colS,&colV);
-				if(colS!=0 ){
+				if (colS != 0) {
 					rgb_to_hsv(r_col[0],r_col[1],r_col[2],&rH,&rS,&rV);
 					hsv_to_rgb( colH , rS, rV, &tmpr, &tmpg, &tmpb);
 					r_col[0] = facm*(r_col[0]) + fac*tmpr;
@@ -1334,7 +1334,7 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
 				float rH,rS,rV;
 				float colH,colS,colV;
 				rgb_to_hsv(r_col[0],r_col[1],r_col[2],&rH,&rS,&rV);
-				if(rS!=0){
+				if (rS != 0) {
 					rgb_to_hsv(col[0],col[1],col[2],&colH,&colS,&colV);
 					hsv_to_rgb( rH, (facm*rS +fac*colS), rV, r_col+0, r_col+1, r_col+2);
 				}
@@ -1355,7 +1355,7 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3])
 				float colH,colS,colV;
 				float tmpr,tmpg,tmpb;
 				rgb_to_hsv(col[0],col[1],col[2],&colH,&colS,&colV);
-				if(colS!=0){
+				if (colS != 0) {
 					rgb_to_hsv(r_col[0],r_col[1],r_col[2],&rH,&rS,&rV);
 					hsv_to_rgb( colH, colS, rV, &tmpr, &tmpg, &tmpb);
 					r_col[0] = facm*(r_col[0]) + fac*tmpr;
@@ -1409,20 +1409,20 @@ void free_matcopybuf(void)
 {
 	int a;
 
-	for(a=0; a<MAX_MTEX; a++) {
-		if(matcopybuf.mtex[a]) {
+	for (a=0; a<MAX_MTEX; a++) {
+		if (matcopybuf.mtex[a]) {
 			MEM_freeN(matcopybuf.mtex[a]);
 			matcopybuf.mtex[a]= NULL;
 		}
 	}
 
-	if(matcopybuf.ramp_col) MEM_freeN(matcopybuf.ramp_col);
-	if(matcopybuf.ramp_spec) MEM_freeN(matcopybuf.ramp_spec);
+	if (matcopybuf.ramp_col) MEM_freeN(matcopybuf.ramp_col);
+	if (matcopybuf.ramp_spec) MEM_freeN(matcopybuf.ramp_spec);
 
 	matcopybuf.ramp_col= NULL;
 	matcopybuf.ramp_spec= NULL;
 
-	if(matcopybuf.nodetree) {
+	if (matcopybuf.nodetree) {
 		ntreeFreeTree(matcopybuf.nodetree);
 		MEM_freeN(matcopybuf.nodetree);
 		matcopybuf.nodetree= NULL;
@@ -1436,16 +1436,16 @@ void copy_matcopybuf(Material *ma)
 	int a;
 	MTex *mtex;
 
-	if(matcopied)
+	if (matcopied)
 		free_matcopybuf();
 
 	memcpy(&matcopybuf, ma, sizeof(Material));
-	if(matcopybuf.ramp_col) matcopybuf.ramp_col= MEM_dupallocN(matcopybuf.ramp_col);
-	if(matcopybuf.ramp_spec) matcopybuf.ramp_spec= MEM_dupallocN(matcopybuf.ramp_spec);
+	if (matcopybuf.ramp_col) matcopybuf.ramp_col= MEM_dupallocN(matcopybuf.ramp_col);
+	if (matcopybuf.ramp_spec) matcopybuf.ramp_spec= MEM_dupallocN(matcopybuf.ramp_spec);
 
-	for(a=0; a<MAX_MTEX; a++) {
+	for (a=0; a<MAX_MTEX; a++) {
 		mtex= matcopybuf.mtex[a];
-		if(mtex) {
+		if (mtex) {
 			matcopybuf.mtex[a]= MEM_dupallocN(mtex);
 		}
 	}
@@ -1461,18 +1461,18 @@ void paste_matcopybuf(Material *ma)
 	MTex *mtex;
 	ID id;
 
-	if(matcopied==0)
+	if (matcopied==0)
 		return;
 	/* free current mat */
-	if(ma->ramp_col) MEM_freeN(ma->ramp_col);
-	if(ma->ramp_spec) MEM_freeN(ma->ramp_spec);
-	for(a=0; a<MAX_MTEX; a++) {
+	if (ma->ramp_col) MEM_freeN(ma->ramp_col);
+	if (ma->ramp_spec) MEM_freeN(ma->ramp_spec);
+	for (a=0; a<MAX_MTEX; a++) {
 		mtex= ma->mtex[a];
-		if(mtex && mtex->tex) mtex->tex->id.us--;
-		if(mtex) MEM_freeN(mtex);
+		if (mtex && mtex->tex) mtex->tex->id.us--;
+		if (mtex) MEM_freeN(mtex);
 	}
 
-	if(ma->nodetree) {
+	if (ma->nodetree) {
 		ntreeFreeTree(ma->nodetree);
 		MEM_freeN(ma->nodetree);
 	}
@@ -1483,14 +1483,14 @@ void paste_matcopybuf(Material *ma)
 	memcpy(ma, &matcopybuf, sizeof(Material));
 	(ma->id)= id;
 
-	if(matcopybuf.ramp_col) ma->ramp_col= MEM_dupallocN(matcopybuf.ramp_col);
-	if(matcopybuf.ramp_spec) ma->ramp_spec= MEM_dupallocN(matcopybuf.ramp_spec);
+	if (matcopybuf.ramp_col) ma->ramp_col= MEM_dupallocN(matcopybuf.ramp_col);
+	if (matcopybuf.ramp_spec) ma->ramp_spec= MEM_dupallocN(matcopybuf.ramp_spec);
 
-	for(a=0; a<MAX_MTEX; a++) {
+	for (a=0; a<MAX_MTEX; a++) {
 		mtex= ma->mtex[a];
-		if(mtex) {
+		if (mtex) {
 			ma->mtex[a]= MEM_dupallocN(mtex);
-			if(mtex->tex) id_us_plus((ID *)mtex->tex);
+			if (mtex->tex) id_us_plus((ID *)mtex->tex);
 		}
 	}
 
@@ -1600,7 +1600,7 @@ static int integer_getdigits(int number)
 	int i=0;
 	if (number == 0) return 1;
 
-	while (number != 0){
+	while (number != 0) {
 		number = (int)(number/10);
 		i++;
 	}
@@ -1614,7 +1614,7 @@ static void calculate_tface_materialname(char *matname, char *newname, int flag)
 	// otherwise do:
 	int digits = integer_getdigits(flag);
 	/* clamp the old name, remove the MA prefix and add the .TF.flag suffix
-	e.g. matname = "MALoooooooooooooongName"; newname = "Loooooooooooooon.TF.2" */
+	 * e.g. matname = "MALoooooooooooooongName"; newname = "Loooooooooooooon.TF.2" */
 	BLI_snprintf(newname, MAX_ID_NAME, "%.*s.TF.%0*d", MAX_ID_NAME-(digits+5), matname, digits, flag);
 }
 
@@ -1645,11 +1645,11 @@ static short mesh_addmaterial(Mesh *me, Material *ma)
 
 static void set_facetexture_flags(Material *ma, Image *image)
 {
-	if(image) {
+	if (image) {
 		ma->mode |= MA_FACETEXTURE;
 		/* we could check if the texture has alpha, but then more meshes sharing the same
 		 * material may need it. Let's make it simple. */
-		if(BKE_image_has_alpha(image))
+		if (BKE_image_has_alpha(image))
 			ma->mode |= MA_FACETEXTURE_ALPHA;
 	}
 }
@@ -1667,7 +1667,7 @@ static short convert_tfacenomaterial(Main *main, Mesh *me, MTFace *tf, int flag)
 	if ((ma= BLI_findstring(&main->mat, idname+2, offsetof(ID, name)+2))) {
 		mat_nr= mesh_getmaterialnumber(me, ma);
 		/* assign the material to the mesh */
-		if(mat_nr == -1) mat_nr= mesh_addmaterial(me, ma);
+		if (mat_nr == -1) mat_nr= mesh_addmaterial(me, ma);
 
 		/* if needed set "Face Textures [Alpha]" Material options */
 		set_facetexture_flags(ma, tf->tpage);
@@ -1676,7 +1676,7 @@ static short convert_tfacenomaterial(Main *main, Mesh *me, MTFace *tf, int flag)
 	else {
 		ma= add_material(idname+2);
 
-		if(ma){
+		if (ma) {
 			printf("TexFace Convert: Material \"%s\" created.\n", idname+2);
 			mat_nr= mesh_addmaterial(me, ma);
 			
@@ -1711,10 +1711,10 @@ static void convert_tfacematerial(Main *main, Material *ma)
 	CustomDataLayer *cdl;
 	char idname[MAX_ID_NAME];
 
-	for(me=main->mesh.first; me; me=me->id.next){
+	for (me=main->mesh.first; me; me=me->id.next) {
 		/* check if this mesh uses this material */
-		for(a=0;a<me->totcol;a++)
-			if(me->mat[a] == ma) break;
+		for (a=0;a<me->totcol;a++)
+			if (me->mat[a] == ma) break;
 			
 		/* no material found */
 		if (a == me->totcol) continue;
@@ -1725,8 +1725,8 @@ static void convert_tfacematerial(Main *main, Material *ma)
 		if (!cdl) continue;
 
 		/* loop over all the faces and stop at the ones that use the material*/
-		for(a=0, mf=me->mface; a<me->totface; a++, mf++) {
-			if(me->mat[mf->mat_nr] != ma) continue;
+		for (a=0, mf=me->mface; a<me->totface; a++, mf++) {
+			if (me->mat[mf->mat_nr] != ma) continue;
 
 			/* texface data for this face */
 			tf = ((MTFace*)cdl->data) + a;
@@ -1739,12 +1739,12 @@ static void convert_tfacematerial(Main *main, Material *ma)
 				/* material already existent, see if the mesh has it */
 				mat_nr = mesh_getmaterialnumber(me, mat_new);
 				/* material is not in the mesh, add it */
-				if(mat_nr == -1) mat_nr= mesh_addmaterial(me, mat_new);
+				if (mat_nr == -1) mat_nr= mesh_addmaterial(me, mat_new);
 			}
 			/* create a new material */
 			else {
 				mat_new=copy_material(ma);
-				if(mat_new){
+				if (mat_new) {
 					/* rename the material*/
 					strcpy(mat_new->id.name, idname);
 					id_us_min((ID *)mat_new);	
@@ -1763,15 +1763,15 @@ static void convert_tfacematerial(Main *main, Material *ma)
 			 * set "Face Textures [Alpha]" Material options 
 			 * actually we need to run it always, because of old behavior
 			 * of using face texture if any texture channel was present (multitex) */
-			//if((!mat_new->mtex[0]) && (!mat_new->mtex[0]->tex))
+			//if ((!mat_new->mtex[0]) && (!mat_new->mtex[0]->tex))
 			set_facetexture_flags(mat_new, tf->tpage);
 
 			/* set the material number to the face*/
 			mf->mat_nr = mat_nr;
 		}
 		/* remove material from mesh */
-		for(a=0;a<me->totcol;)
-			if(me->mat[a] == ma) material_pop_id(&me->id, a, 1);else a++;
+		for (a=0;a<me->totcol;)
+			if (me->mat[a] == ma) material_pop_id(&me->id, a, 1);else a++;
 	}
 }
 
@@ -1805,7 +1805,7 @@ int do_version_tface(Main *main, int fileload)
 	 */
 	
 	/* 1st part: marking mesh materials to update */
-	for(me=main->mesh.first; me; me=me->id.next){
+	for (me=main->mesh.first; me; me=me->id.next) {
 		if (me->id.lib) continue;
 
 		/* get the active tface layer */
@@ -1816,7 +1816,7 @@ int do_version_tface(Main *main, int fileload)
 		nomaterialslots = (me->totcol==0?1:0);
 		
 		/* loop over all the faces*/
-		for(a=0, mf=me->mface; a<me->totface; a++, mf++) {
+		for (a=0, mf=me->mface; a<me->totface; a++, mf++) {
 			/* texface data for this face */
 			tf = ((MTFace*)cdl->data) + a;
 
@@ -1824,12 +1824,12 @@ int do_version_tface(Main *main, int fileload)
 			if (fileload)
 				tf->mode &= ~TF_CONVERTED;
 			else {
-				if((tf->mode & TF_CONVERTED)) continue;
+				if ((tf->mode & TF_CONVERTED)) continue;
 				else tf->mode |= TF_CONVERTED;
 			}
 			
 			/* no material slots */
-			if(nomaterialslots) {
+			if (nomaterialslots) {
 				flag = encode_tfaceflag(tf, 1);
 				
 				/* create/find a new material and assign to the face */
@@ -1841,11 +1841,11 @@ int do_version_tface(Main *main, int fileload)
 					mf->mat_nr = -1;
 				}
 			}
-			else if(mf->mat_nr < me->totcol) {
+			else if (mf->mat_nr < me->totcol) {
 				ma= me->mat[mf->mat_nr];
 				
 				/* no material create one if necessary */
-				if(!ma) {
+				if (!ma) {
 					/* find a new material and assign to the face */
 					flag = encode_tfaceflag(tf, 1);
 
@@ -1860,11 +1860,11 @@ int do_version_tface(Main *main, int fileload)
 				 * at doversion time: direct_link might not have happened on it,
 				 * so ma->mtex is not pointing to valid memory yet.
 				 * later we could, but it's better not */
-				else if(ma->id.lib)
+				else if (ma->id.lib)
 					continue;
 				
 				/* material already marked as disputed */
-				else if(ma->game.flag == MAT_BGE_DISPUTED)
+				else if (ma->game.flag == MAT_BGE_DISPUTED)
 					continue;
 
 				/* found a material */
@@ -1886,23 +1886,24 @@ int do_version_tface(Main *main, int fileload)
 						ma->game.flag = -flag;
 						
 						/* some people uses multitexture with TexFace by creating a texture
-						 * channel which not neccessarly the tf->tpage image. But the game engine
+						 * channel which not necessarily the tf->tpage image. But the game engine
 						 * was enabling it. Now it's required to set "Face Texture [Alpha] in the
 						 * material settings. */
-						if(!fileload)
+						if (!fileload)
 							set_facetexture_flags(ma, tf->tpage);
 					}
 				}
 			}
-			else
+			else {
 				continue;
+			}
 		}
 
 		/* if we didn't have material slot and now we do, we need to
 		 * make sure the materials are correct */
-		if(nomaterialslots) {
+		if (nomaterialslots) {
 			if (me->totcol>0) {
-				for(a=0, mf=me->mface; a<me->totface; a++, mf++) {
+				for (a=0, mf=me->mface; a<me->totface; a++, mf++) {
 					if (mf->mat_nr == -1) {
 						/* texface data for this face */
 						tf = ((MTFace*)cdl->data) + a;
@@ -1911,7 +1912,7 @@ int do_version_tface(Main *main, int fileload)
 				}
 			}
 			else {
-				for(a=0, mf=me->mface; a<me->totface; a++, mf++) {
+				for (a=0, mf=me->mface; a<me->totface; a++, mf++) {
 					mf->mat_nr=0;
 				}
 			}
@@ -1946,10 +1947,10 @@ int do_version_tface(Main *main, int fileload)
 			/* material is good make sure all faces using
 			 * this material are set to converted */
 			if (fileload) {
-				for(me=main->mesh.first; me; me=me->id.next){
+				for (me=main->mesh.first; me; me=me->id.next) {
 					/* check if this mesh uses this material */
-					for(a=0;a<me->totcol;a++)
-						if(me->mat[a] == ma) break;
+					for (a=0;a<me->totcol;a++)
+						if (me->mat[a] == ma) break;
 						
 					/* no material found */
 					if (a == me->totcol) continue;
@@ -1972,9 +1973,11 @@ int do_version_tface(Main *main, int fileload)
 		}
 		/* material is not used by faces with texface
 		 * set the default flag - do it only once */
-		else
-			 if (fileload)
-					ma->game.flag = GEMAT_BACKCULL;
+		else {
+			if (fileload) {
+				ma->game.flag = GEMAT_BACKCULL;
+			}
+		}
 	}
 
 	return nowarning;
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index fe2c10d..c06d796 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -77,8 +77,8 @@ void unlink_mball(MetaBall *mb)
 {
 	int a;
 	
-	for(a=0; a<mb->totcol; a++) {
-		if(mb->mat[a]) mb->mat[a]->id.us--;
+	for (a=0; a<mb->totcol; a++) {
+		if (mb->mat[a]) mb->mat[a]->id.us--;
 		mb->mat[a]= NULL;
 	}
 }
@@ -89,14 +89,14 @@ void free_mball(MetaBall *mb)
 {
 	unlink_mball(mb);	
 	
-	if(mb->adt) {
+	if (mb->adt) {
 		BKE_free_animdata((ID *)mb);
 		mb->adt = NULL;
 	}
-	if(mb->mat) MEM_freeN(mb->mat);
-	if(mb->bb) MEM_freeN(mb->bb);
+	if (mb->mat) MEM_freeN(mb->mat);
+	if (mb->bb) MEM_freeN(mb->bb);
 	BLI_freelistN(&mb->elems);
-	if(mb->disp.first) freedisplist(&mb->disp);
+	if (mb->disp.first) freedisplist(&mb->disp);
 }
 
 MetaBall *add_mball(const char *name)
@@ -125,7 +125,7 @@ MetaBall *copy_mball(MetaBall *mb)
 	BLI_duplicatelist(&mbn->elems, &mb->elems);
 	
 	mbn->mat= MEM_dupallocN(mb->mat);
-	for(a=0; a<mbn->totcol; a++) {
+	for (a=0; a<mbn->totcol; a++) {
 		id_us_plus((ID *)mbn->mat[a]);
 	}
 	mbn->bb= MEM_dupallocN(mb->bb);
@@ -138,7 +138,7 @@ MetaBall *copy_mball(MetaBall *mb)
 
 static void extern_local_mball(MetaBall *mb)
 {
-	if(mb->mat) {
+	if (mb->mat) {
 		extern_local_matarar(mb->mat, mb->totcol);
 	}
 }
@@ -154,35 +154,35 @@ void make_local_mball(MetaBall *mb)
 	 * - mixed: make copy
 	 */
 	
-	if(mb->id.lib==NULL) return;
-	if(mb->id.us==1) {
+	if (mb->id.lib==NULL) return;
+	if (mb->id.us==1) {
 		id_clear_lib_data(bmain, &mb->id);
 		extern_local_mball(mb);
 		
 		return;
 	}
 
-	for(ob= G.main->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) {
-		if(ob->data == mb) {
-			if(ob->id.lib) is_lib= TRUE;
+	for (ob= G.main->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) {
+		if (ob->data == mb) {
+			if (ob->id.lib) is_lib= TRUE;
 			else is_local= TRUE;
 		}
 	}
 	
-	if(is_local && is_lib == FALSE) {
+	if (is_local && is_lib == FALSE) {
 		id_clear_lib_data(bmain, &mb->id);
 		extern_local_mball(mb);
 	}
-	else if(is_local && is_lib) {
+	else if (is_local && is_lib) {
 		MetaBall *mb_new= copy_mball(mb);
 		mb_new->id.us= 0;
 
 		/* Remap paths of new ID using old library as base. */
 		BKE_id_lib_local_paths(bmain, mb->id.lib, &mb_new->id);
 
-		for(ob= G.main->object.first; ob; ob= ob->id.next) {
-			if(ob->data == mb) {
-				if(ob->id.lib==NULL) {
+		for (ob= G.main->object.first; ob; ob= ob->id.next) {
+			if (ob->data == mb) {
+				if (ob->id.lib==NULL) {
 					ob->data= mb_new;
 					mb_new->id.us++;
 					mb->id.us--;
@@ -253,7 +253,7 @@ void tex_space_mball(Object *ob)
 	float *data, min[3], max[3] /*, loc[3], size[3] */;
 	int tot, doit=0;
 
-	if(ob->bb==NULL) ob->bb= MEM_callocN(sizeof(BoundBox), "mb boundbox");
+	if (ob->bb==NULL) ob->bb= MEM_callocN(sizeof(BoundBox), "mb boundbox");
 	bb= ob->bb;
 	
 	/* Weird one, this. */
@@ -262,11 +262,11 @@ void tex_space_mball(Object *ob)
 	(max)[0]= (max)[1]= (max)[2]= -1.0e30f;
 
 	dl= ob->disp.first;
-	while(dl) {
+	while (dl) {
 		tot= dl->nr;
-		if(tot) doit= 1;
+		if (tot) doit= 1;
 		data= dl->verts;
-		while(tot--) {
+		while (tot--) {
 			/* Also weird... but longer. From utildefines. */
 			DO_MINMAX(data, min, max);
 			data+= 3;
@@ -274,11 +274,11 @@ void tex_space_mball(Object *ob)
 		dl= dl->next;
 	}
 
-	if(!doit) {
+	if (!doit) {
 		min[0] = min[1] = min[2] = -1.0f;
 		max[0] = max[1] = max[2] = 1.0f;
 	}
-	/*
+#if 0
 	loc[0]= (min[0]+max[0])/2.0f;
 	loc[1]= (min[1]+max[1])/2.0f;
 	loc[2]= (min[2]+max[2])/2.0f;
@@ -286,7 +286,7 @@ void tex_space_mball(Object *ob)
 	size[0]= (max[0]-min[0])/2.0f;
 	size[1]= (max[1]-min[1])/2.0f;
 	size[2]= (max[2]-min[2])/2.0f;
-	*/
+#endif
 	boundbox_set_from_min_max(bb, min, max);
 }
 
@@ -313,7 +313,7 @@ float *make_orco_mball(Object *ob, ListBase *dispbase)
 	data= dl->verts;
 	orco= orcodata;
 	a= dl->nr;
-	while(a--) {
+	while (a--) {
 		orco[0]= (data[0]-loc[0])/size[0];
 		orco[1]= (data[1]-loc[1])/size[1];
 		orco[2]= (data[2]-loc[2])/size[2];
@@ -348,12 +348,12 @@ int is_basis_mball(Object *ob)
 	
 	/* just a quick test */
 	len= strlen(ob->id.name);
-	if( isdigit(ob->id.name[len-1]) ) return 0;
+	if ( isdigit(ob->id.name[len-1]) ) return 0;
 	return 1;
 }
 
 /* return nonzero if ob1 is a basis mball for ob */
-int is_mball_basis_for(Object *ob1, Object *ob2)
+int is_mball_basis_for (Object *ob1, Object *ob2)
 {
 	int basis1nr, basis2nr;
 	char basis1name[MAX_ID_NAME], basis2name[MAX_ID_NAME];
@@ -361,7 +361,7 @@ int is_mball_basis_for(Object *ob1, Object *ob2)
 	BLI_split_name_num(basis1name, &basis1nr, ob1->id.name+2, '.');
 	BLI_split_name_num(basis2name, &basis2nr, ob2->id.name+2, '.');
 
-	if(!strcmp(basis1name, basis2name)) return is_basis_mball(ob1);
+	if (!strcmp(basis1name, basis2name)) return is_basis_mball(ob1);
 	else return 0;
 }
 
@@ -383,17 +383,17 @@ void copy_mball_properties(Scene *scene, Object *active_object)
 	BLI_split_name_num(basisname, &basisnr, active_object->id.name+2, '.');
 
 	/* XXX recursion check, see scene.c, just too simple code this next_object() */
-	if(F_ERROR==next_object(&sce_iter, 0, NULL, NULL))
+	if (F_ERROR==next_object(&sce_iter, 0, NULL, NULL))
 		return;
 	
-	while(next_object(&sce_iter, 1, &base, &ob)) {
+	while (next_object(&sce_iter, 1, &base, &ob)) {
 		if (ob->type==OB_MBALL) {
-			if(ob!=active_object){
+			if (ob != active_object) {
 				BLI_split_name_num(obname, &obnr, ob->id.name+2, '.');
 
 				/* Object ob has to be in same "group" ... it means, that it has to have
 				 * same base of its name */
-				if(strcmp(obname, basisname)==0){
+				if (strcmp(obname, basisname)==0) {
 					MetaBall *mb= ob->data;
 
 					/* Copy properties from selected/edited metaball */
@@ -429,37 +429,37 @@ Object *find_basis_mball(Scene *scene, Object *basis)
 	totelem= 0;
 
 	/* XXX recursion check, see scene.c, just too simple code this next_object() */
-	if(F_ERROR==next_object(&sce_iter, 0, NULL, NULL))
+	if (F_ERROR==next_object(&sce_iter, 0, NULL, NULL))
 		return NULL;
 	
-	while(next_object(&sce_iter, 1, &base, &ob)) {
+	while (next_object(&sce_iter, 1, &base, &ob)) {
 		
 		if (ob->type==OB_MBALL) {
-			if(ob==bob){
+			if (ob==bob) {
 				MetaBall *mb= ob->data;
 				
 				/* if bob object is in edit mode, then dynamic list of all MetaElems
 				 * is stored in editelems */
-				if(mb->editelems) ml= mb->editelems->first;
+				if (mb->editelems) ml= mb->editelems->first;
 				/* if bob object is in object mode */
 				else ml= mb->elems.first;
 			}
-			else{
+			else {
 				BLI_split_name_num(obname, &obnr, ob->id.name+2, '.');
 
 				/* object ob has to be in same "group" ... it means, that it has to have
 				 * same base of its name */
-				if(strcmp(obname, basisname)==0){
+				if (strcmp(obname, basisname)==0) {
 					MetaBall *mb= ob->data;
 					
 					/* if object is in edit mode, then dynamic list of all MetaElems
 					 * is stored in editelems */
-					if(mb->editelems) ml= mb->editelems->first;
+					if (mb->editelems) ml= mb->editelems->first;
 					/* if bob object is in object mode */
 					else ml= mb->elems.first;
 					
-					if(obnr<basisnr){
-						if(!(ob->flag & OB_FROMDUPLI)){
+					if (obnr < basisnr) {
+						if (!(ob->flag & OB_FROMDUPLI)) {
 							basis= ob;
 							basisnr= obnr;
 						}
@@ -467,8 +467,8 @@ Object *find_basis_mball(Scene *scene, Object *basis)
 				}
 			}
 			
-			while(ml){
-				if(!(ml->flag & MB_HIDE)) totelem++;
+			while (ml) {
+				if (!(ml->flag & MB_HIDE)) totelem++;
 				ml= ml->next;
 			}
 		}
@@ -485,7 +485,7 @@ Object *find_basis_mball(Scene *scene, Object *basis)
  * "An Implicit Surface Polygonizer"
  * by Jules Bloomenthal, jbloom at beauty.gmu.edu
  * in "Graphics Gems IV", Academic Press, 1994
-
+ *
  * Authored by Jules Bloomenthal, Xerox PARC.
  * Copyright (c) Xerox Corporation, 1991.  All rights reserved.
  * Permission is granted to reproduce, use and distribute this code for
@@ -522,10 +522,10 @@ Object *find_basis_mball(Scene *scene, Object *basis)
 
 /* **************** POLYGONIZATION ************************ */
 
-void calc_mballco(MetaElem *ml, float *vec)
+void calc_mballco(MetaElem *ml, float vec[3])
 {
-	if(ml->mat) {
-		mul_m4_v3((float ( * )[4])ml->mat, vec);
+	if (ml->mat) {
+		mul_m4_v3((float (*)[4])ml->mat, vec);
 	}
 }
 
@@ -537,69 +537,69 @@ float densfunc(MetaElem *ball, float x, float y, float z)
 	vec[0]= x;
 	vec[1]= y;
 	vec[2]= z;
-	mul_m4_v3((float ( * )[4])ball->imat, vec);
+	mul_m4_v3((float (*)[4])ball->imat, vec);
 	dx= vec[0];
 	dy= vec[1];
 	dz= vec[2];
 	
-	if(ball->type==MB_BALL) {
+	if (ball->type==MB_BALL) {
 	}
-	else if(ball->type==MB_TUBEX) {
-		if( dx > ball->len) dx-= ball->len;
-		else if(dx< -ball->len) dx+= ball->len;
+	else if (ball->type==MB_TUBEX) {
+		if ( dx > ball->len) dx-= ball->len;
+		else if (dx< -ball->len) dx+= ball->len;
 		else dx= 0.0;
 	}
-	else if(ball->type==MB_TUBEY) {
-		if( dy > ball->len) dy-= ball->len;
-		else if(dy< -ball->len) dy+= ball->len;
+	else if (ball->type==MB_TUBEY) {
+		if ( dy > ball->len) dy-= ball->len;
+		else if (dy< -ball->len) dy+= ball->len;
 		else dy= 0.0;
 	}
-	else if(ball->type==MB_TUBEZ) {
-		if( dz > ball->len) dz-= ball->len;
-		else if(dz< -ball->len) dz+= ball->len;
+	else if (ball->type==MB_TUBEZ) {
+		if ( dz > ball->len) dz-= ball->len;
+		else if (dz< -ball->len) dz+= ball->len;
 		else dz= 0.0;
 	}
-	else if(ball->type==MB_TUBE) {
-		if( dx > ball->expx) dx-= ball->expx;
-		else if(dx< -ball->expx) dx+= ball->expx;
+	else if (ball->type==MB_TUBE) {
+		if ( dx > ball->expx) dx-= ball->expx;
+		else if (dx< -ball->expx) dx+= ball->expx;
 		else dx= 0.0;
 	}
-	else if(ball->type==MB_PLANE) {
-		if( dx > ball->expx) dx-= ball->expx;
-		else if(dx< -ball->expx) dx+= ball->expx;
+	else if (ball->type==MB_PLANE) {
+		if ( dx > ball->expx) dx-= ball->expx;
+		else if (dx< -ball->expx) dx+= ball->expx;
 		else dx= 0.0;
-		if( dy > ball->expy) dy-= ball->expy;
-		else if(dy< -ball->expy) dy+= ball->expy;
+		if ( dy > ball->expy) dy-= ball->expy;
+		else if (dy< -ball->expy) dy+= ball->expy;
 		else dy= 0.0;
 	}
-	else if(ball->type==MB_ELIPSOID) {
+	else if (ball->type==MB_ELIPSOID) {
 		dx *= 1/ball->expx;
 		dy *= 1/ball->expy;
 		dz *= 1/ball->expz;
 	}
-	else if(ball->type==MB_CUBE) {
-		if( dx > ball->expx) dx-= ball->expx;
-		else if(dx< -ball->expx) dx+= ball->expx;
+	else if (ball->type==MB_CUBE) {
+		if ( dx > ball->expx) dx-= ball->expx;
+		else if (dx< -ball->expx) dx+= ball->expx;
 		else dx= 0.0;
-		if( dy > ball->expy) dy-= ball->expy;
-		else if(dy< -ball->expy) dy+= ball->expy;
+		if ( dy > ball->expy) dy-= ball->expy;
+		else if (dy< -ball->expy) dy+= ball->expy;
 		else dy= 0.0;
-		if( dz > ball->expz) dz-= ball->expz;
-		else if(dz< -ball->expz) dz+= ball->expz;
+		if ( dz > ball->expz) dz-= ball->expz;
+		else if (dz< -ball->expz) dz+= ball->expz;
 		else dz= 0.0;
 	}
 
 	dist2= (dx*dx + dy*dy + dz*dz);
 
-	if(ball->flag & MB_NEGATIVE) {
+	if (ball->flag & MB_NEGATIVE) {
 		dist2= 1.0f-(dist2/ball->rad2);
-		if(dist2 < 0.0f) return 0.5f;
+		if (dist2 < 0.0f) return 0.5f;
 
 		return 0.5f-ball->s*dist2*dist2*dist2;
 	}
 	else {
 		dist2= 1.0f-(dist2/ball->rad2);
-		if(dist2 < 0.0f) return -0.5f;
+		if (dist2 < 0.0f) return -0.5f;
 
 		return ball->s*dist2*dist2*dist2 -0.5f;
 	}
@@ -607,62 +607,62 @@ float densfunc(MetaElem *ball, float x, float y, float z)
 
 octal_node* find_metaball_octal_node(octal_node *node, float x, float y, float z, short depth)
 {
-	if(!depth) return node;
+	if (!depth) return node;
 	
-	if(z < node->z){
-		if(y < node->y){
-			if(x < node->x){
-				if(node->nodes[0])
+	if (z < node->z) {
+		if (y < node->y) {
+			if (x < node->x) {
+				if (node->nodes[0])
 					return find_metaball_octal_node(node->nodes[0],x,y,z,depth--);
 				else
 					return node;
 			}
-			else{
-				if(node->nodes[1])
+			else {
+				if (node->nodes[1])
 					return find_metaball_octal_node(node->nodes[1],x,y,z,depth--);
 				else
 					return node;
 			}
 		}
-		else{
-			if(x < node->x){
-				if(node->nodes[3])
+		else {
+			if (x < node->x) {
+				if (node->nodes[3])
 					return find_metaball_octal_node(node->nodes[3],x,y,z,depth--);
 				else
 					return node;
 			}
-			else{
-				if(node->nodes[2])
+			else {
+				if (node->nodes[2])
 					return find_metaball_octal_node(node->nodes[2],x,y,z,depth--);
 				else
 					return node;
 			}		
 		}
 	}
-	else{
-		if(y < node->y){
-			if(x < node->x){
-				if(node->nodes[4])
+	else {
+		if (y < node->y) {
+			if (x < node->x) {
+				if (node->nodes[4])
 					return find_metaball_octal_node(node->nodes[4],x,y,z,depth--);
 				else
 					return node;
 			}
-			else{
-				if(node->nodes[5])
+			else {
+				if (node->nodes[5])
 					return find_metaball_octal_node(node->nodes[5],x,y,z,depth--);
 				else
 					return node;
 			}
 		}
-		else{
-			if(x < node->x){
-				if(node->nodes[7])
+		else {
+			if (x < node->x) {
+				if (node->nodes[7])
 					return find_metaball_octal_node(node->nodes[7],x,y,z,depth--);
 				else
 					return node;
 			}
-			else{
-				if(node->nodes[6])
+			else {
+				if (node->nodes[6])
 					return find_metaball_octal_node(node->nodes[6],x,y,z,depth--);
 				else
 					return node;
@@ -681,12 +681,12 @@ float metaball(float x, float y, float z)
 	float dens=0;
 	int a;
 	
-	if(totelem > 1){
+	if (totelem > 1) {
 		node= find_metaball_octal_node(metaball_tree->first, x, y, z, metaball_tree->depth);
-		if(node){
+		if (node) {
 			ml_p= node->elems.first;
 
-			while(ml_p){
+			while (ml_p) {
 				dens+=densfunc(ml_p->ml, x, y, z);
 				ml_p= ml_p->next;
 			}
@@ -694,14 +694,14 @@ float metaball(float x, float y, float z)
 			dens+= -0.5f*(metaball_tree->pos - node->pos);
 			dens+= 0.5f*(metaball_tree->neg - node->neg);
 		}
-		else{
-			for(a=0; a<totelem; a++) {
-				dens+= densfunc( mainb[a], x, y, z);
+		else {
+			for (a=0; a<totelem; a++) {
+				dens += densfunc(mainb[a], x, y, z);
 			}
 		}
 	}
-	else{
-		dens+= densfunc( mainb[0], x, y, z);
+	else {
+		dens += densfunc(mainb[0], x, y, z);
 	}
 
 	return thresh - dens;
@@ -718,11 +718,11 @@ void accum_mballfaces(int i1, int i2, int i3, int i4)
 	int *newi, *cur;
 	/* static int i=0; I would like to delete altogether, but I don't dare to, yet */
 
-	if(totindex==curindex) {
+	if (totindex==curindex) {
 		totindex+= 256;
 		newi= MEM_mallocN(4*sizeof(int)*totindex, "vertindex");
 		
-		if(indices) {
+		if (indices) {
 			memcpy(newi, indices, 4*sizeof(int)*(totindex-256));
 			MEM_freeN(indices);
 		}
@@ -736,7 +736,7 @@ void accum_mballfaces(int i1, int i2, int i3, int i4)
 	cur[0]= i1;
 	cur[1]= i2;
 	cur[2]= i3;
-	if(i4==0)
+	if (i4==0)
 		cur[3]= i3;
 	else 
 		cur[3]= i4;
@@ -757,12 +757,12 @@ void *new_pgn_element(int size)
 	static ListBase lb= {NULL, NULL};
 	void *adr;
 	
-	if(size>10000 || size==0) {
+	if (size>10000 || size==0) {
 		printf("incorrect use of new_pgn_element\n");
 	}
-	else if(size== -1) {
+	else if (size== -1) {
 		cur= lb.first;
-		while(cur) {
+		while (cur) {
 			MEM_freeN(cur->data);
 			cur= cur->next;
 		}
@@ -773,8 +773,8 @@ void *new_pgn_element(int size)
 	
 	size= 4*( (size+3)/4 );
 	
-	if(cur) {
-		if(size+offs < blocksize) {
+	if (cur) {
+		if (size+offs < blocksize) {
 			adr= (void *) (cur->data+offs);
 			offs+= size;
 			return adr;
@@ -797,7 +797,7 @@ void freepolygonize(PROCESS *p)
 
 	new_pgn_element(-1);
 	
-	if(p->vertices.ptr) MEM_freeN(p->vertices.ptr);
+	if (p->vertices.ptr) MEM_freeN(p->vertices.ptr);
 }
 
 /**** Cubical Polygonization (optional) ****/
@@ -852,23 +852,23 @@ void docube(CUBE *cube, PROCESS *p, MetaBall *mb)
 			indexar[count] = vertid(c1, c2, p, mb);
 			count++;
 		}
-		if(count>2) {
+		if (count>2) {
 			switch(count) {
 			case 3:
 				accum_mballfaces(indexar[2], indexar[1], indexar[0], 0);
 				break;
 			case 4:
-				if(indexar[0]==0) accum_mballfaces(indexar[0], indexar[3], indexar[2], indexar[1]);
+				if (indexar[0]==0) accum_mballfaces(indexar[0], indexar[3], indexar[2], indexar[1]);
 				else accum_mballfaces(indexar[3], indexar[2], indexar[1], indexar[0]);
 				break;
 			case 5:
-				if(indexar[0]==0) accum_mballfaces(indexar[0], indexar[3], indexar[2], indexar[1]);
+				if (indexar[0]==0) accum_mballfaces(indexar[0], indexar[3], indexar[2], indexar[1]);
 				else accum_mballfaces(indexar[3], indexar[2], indexar[1], indexar[0]);
 
 				accum_mballfaces(indexar[4], indexar[3], indexar[0], 0);
 				break;
 			case 6:
-				if(indexar[0]==0) {
+				if (indexar[0]==0) {
 					accum_mballfaces(indexar[0], indexar[3], indexar[2], indexar[1]);
 					accum_mballfaces(indexar[0], indexar[5], indexar[4], indexar[3]);
 				}
@@ -878,7 +878,7 @@ void docube(CUBE *cube, PROCESS *p, MetaBall *mb)
 				}
 				break;
 			case 7:
-				if(indexar[0]==0) {
+				if (indexar[0]==0) {
 					accum_mballfaces(indexar[0], indexar[3], indexar[2], indexar[1]);
 					accum_mballfaces(indexar[0], indexar[5], indexar[4], indexar[3]);
 				}
@@ -915,7 +915,7 @@ void testface(int i, int j, int k, CUBE* old, int bit, int c1, int c2, int c3, i
 	pos = corn1->value > 0.0f ? 1 : 0;
 
 	/* test if no surface crossing */
-	if( (corn2->value > 0) == pos && (corn3->value > 0) == pos && (corn4->value > 0) == pos) return;
+	if ( (corn2->value > 0) == pos && (corn3->value > 0) == pos && (corn4->value > 0) == pos) return;
 	/* test if cube out of bounds */
 	/*if ( abs(i) > p->bounds || abs(j) > p->bounds || abs(k) > p->bounds) return;*/
 	/* test if already visited (always as last) */
@@ -936,20 +936,20 @@ void testface(int i, int j, int k, CUBE* old, int bit, int c1, int c2, int c3, i
 	newc.corners[FLIP(c3, bit)] = corn3;
 	newc.corners[FLIP(c4, bit)] = corn4;
 
-	if(newc.corners[0]==NULL) newc.corners[0] = setcorner(p, i, j, k);
-	if(newc.corners[1]==NULL) newc.corners[1] = setcorner(p, i, j, k+1);
-	if(newc.corners[2]==NULL) newc.corners[2] = setcorner(p, i, j+1, k);
-	if(newc.corners[3]==NULL) newc.corners[3] = setcorner(p, i, j+1, k+1);
-	if(newc.corners[4]==NULL) newc.corners[4] = setcorner(p, i+1, j, k);
-	if(newc.corners[5]==NULL) newc.corners[5] = setcorner(p, i+1, j, k+1);
-	if(newc.corners[6]==NULL) newc.corners[6] = setcorner(p, i+1, j+1, k);
-	if(newc.corners[7]==NULL) newc.corners[7] = setcorner(p, i+1, j+1, k+1);
+	if (newc.corners[0]==NULL) newc.corners[0] = setcorner(p, i, j, k);
+	if (newc.corners[1]==NULL) newc.corners[1] = setcorner(p, i, j, k+1);
+	if (newc.corners[2]==NULL) newc.corners[2] = setcorner(p, i, j+1, k);
+	if (newc.corners[3]==NULL) newc.corners[3] = setcorner(p, i, j+1, k+1);
+	if (newc.corners[4]==NULL) newc.corners[4] = setcorner(p, i+1, j, k);
+	if (newc.corners[5]==NULL) newc.corners[5] = setcorner(p, i+1, j, k+1);
+	if (newc.corners[6]==NULL) newc.corners[6] = setcorner(p, i+1, j+1, k);
+	if (newc.corners[7]==NULL) newc.corners[7] = setcorner(p, i+1, j+1, k+1);
 
 	p->cubes->cube= newc;	
 }
 
 /* setcorner: return corner with the given lattice location
-   set (and cache) its function value */
+ * set (and cache) its function value */
 
 CORNER *setcorner (PROCESS* p, int i, int j, int k)
 {
@@ -1034,7 +1034,7 @@ void makecubetable (void)
 	static int isdone= 0;
 	int i, e, c, done[12], pos[8];
 
-	if(isdone) return;
+	if (isdone) return;
 	isdone= 1;
 
 	for (i = 0; i < 256; i++) {
@@ -1078,11 +1078,11 @@ void BKE_freecubetable(void)
 
 	for (i = 0; i < 256; i++) {
 		lists= cubetable[i];
-		while(lists) {
+		while (lists) {
 			nlists= lists->next;
 			
 			ints= lists->list;
-			while(ints) {
+			while (ints) {
 				nints= ints->next;
 				MEM_freeN(ints);
 				ints= nints;
@@ -1233,7 +1233,7 @@ void vnormal (MB_POINT *point, PROCESS *p, MB_POINT *v)
 		v->z /= f;
 	}
 	
-	if(FALSE) {
+	if (FALSE) {
 		MB_POINT temp;
 		
 		delta *= 2.0f;
@@ -1323,20 +1323,20 @@ void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2,
 
 /* Approximation by linear interpolation is faster then binary subdivision,
  * but it results sometimes (mb->thresh < 0.2) into the strange results */
-	if((mb->thresh > 0.2f) && (f==1)){
-	if((dy == 0.0f) && (dz == 0.0f)){
+	if ((mb->thresh > 0.2f) && (f==1)) {
+	if ((dy == 0.0f) && (dz == 0.0f)) {
 		p->x = neg.x - negative*dx/(positive-negative);
 		p->y = neg.y;
 		p->z = neg.z;
 		return;
 	}
-	  if((dx == 0.0f) && (dz == 0.0f)){
+	  if ((dx == 0.0f) && (dz == 0.0f)) {
 		p->x = neg.x;
 		p->y = neg.y - negative*dy/(positive-negative);
 		p->z = neg.z;
 		return;
 	}
-	if((dx == 0.0f) && (dy == 0.0f)){
+	if ((dx == 0.0f) && (dy == 0.0f)) {
 		p->x = neg.x;
 		p->y = neg.y;
 		p->z = neg.z - negative*dz/(positive-negative);
@@ -1344,7 +1344,7 @@ void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2,
 	}
 	}
 
-	if((dy == 0.0f) && (dz == 0.0f)){
+	if ((dy == 0.0f) && (dz == 0.0f)) {
 		p->y = neg.y;
 		p->z = neg.z;
 		while (1) {
@@ -1354,7 +1354,7 @@ void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2,
 		}
 	}
 
-	if((dx == 0.0f) && (dz == 0.0f)){
+	if ((dx == 0.0f) && (dz == 0.0f)) {
 		p->x = neg.x;
 		p->z = neg.z;
 		while (1) {
@@ -1364,7 +1364,7 @@ void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2,
 		}
 	  }
    
-	if((dx == 0.0f) && (dy == 0.0f)){
+	if ((dx == 0.0f) && (dy == 0.0f)) {
 		p->x = neg.x;
 		p->y = neg.y;
 		while (1) {
@@ -1382,12 +1382,12 @@ void converge (MB_POINT *p1, MB_POINT *p2, float v1, float v2,
 
 		if (i++ == RES) return;
    
-		if ((function(p->x, p->y, p->z)) > 0.0f){
+		if ((function(p->x, p->y, p->z)) > 0.0f) {
 			pos.x = p->x;
 			pos.y = p->y;
 			pos.z = p->z;
 		}
-		else{
+		else {
 			neg.x = p->x;
 			neg.y = p->y;
 			neg.z = p->z;
@@ -1404,11 +1404,11 @@ void add_cube(PROCESS *mbproc, int i, int j, int k, int count)
 
 	/* hmmm, not only one, but eight cube will be added on the stack 
 	 * ... */
-	for(a=i-1; a<i+count; a++)
-		for(b=j-1; b<j+count; b++)
-			for(c=k-1; c<k+count; c++) {
+	for (a=i-1; a<i+count; a++)
+		for (b=j-1; b<j+count; b++)
+			for (c=k-1; c<k+count; c++) {
 				/* test if cube has been found before */
-				if( setcenter(mbproc->centers, a, b, c)==0 ) {
+				if ( setcenter(mbproc->centers, a, b, c)==0 ) {
 					/* push cube on stack: */
 					ncube= (CUBES *) new_pgn_element(sizeof(CUBES));
 					ncube->next= mbproc->cubes;
@@ -1443,7 +1443,7 @@ void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
 
 	/* Skip, when Stiffness of MetaElement is too small ... MetaElement can't be
 	 * visible alone ... but still can influence others MetaElements :-) */
-	if(f > 0.0f) {
+	if (f > 0.0f) {
 		OUT.x = IN.x = in.x= 0.0;
 		OUT.y = IN.y = in.y= 0.0;
 		OUT.z = IN.z = in.z= 0.0;
@@ -1451,7 +1451,7 @@ void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
 		calc_mballco(ml, (float *)&in);
 		in_v = mbproc->function(in.x, in.y, in.z);
 
-		for(i=0;i<3;i++){
+		for (i=0;i<3;i++) {
 			switch (ml->type) {
 				case MB_BALL:
 					OUT.x = out.x= IN.x + index[i]*ml->rad;
@@ -1464,7 +1464,7 @@ void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
 					break;
 			}
 
-			for(j=0;j<3;j++) {
+			for (j=0;j<3;j++) {
 				switch (ml->type) {
 					case MB_BALL:
 						OUT.y = out.y= IN.y + index[j]*ml->rad;
@@ -1477,7 +1477,7 @@ void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
 						break;
 				}
 			
-				for(k=0;k<3;k++) {
+				for (k=0;k<3;k++) {
 					out.x = OUT.x;
 					out.y = OUT.y;
 					switch (ml->type) {
@@ -1508,20 +1508,20 @@ void find_first_points(PROCESS *mbproc, MetaBall *mb, int a)
 					nz = abs((out.z - in.z)/mbproc->size);
 					
 					MAXN = MAX3(nx,ny,nz);
-					if(MAXN!=0.0f) {
+					if (MAXN!=0.0f) {
 						dx = (out.x - in.x)/MAXN;
 						dy = (out.y - in.y)/MAXN;
 						dz = (out.z - in.z)/MAXN;
 
 						len = 0.0;
-						while(len<=max_len) {
+						while (len<=max_len) {
 							workp.x += dx;
 							workp.y += dy;
 							workp.z += dz;
 							/* compute value of implicite function */
 							tmp_v = mbproc->function(workp.x, workp.y, workp.z);
 							/* add cube to the stack, when value of implicite function crosses zero value */
-							if((tmp_v<0.0f && workp_v>=0.0f)||(tmp_v>0.0f && workp_v<=0.0f)) {
+							if ((tmp_v<0.0f && workp_v>=0.0f)||(tmp_v>0.0f && workp_v<=0.0f)) {
 
 								/* indexes of CUBE, which includes "first point" */
 								c_i= (int)floor(workp.x/mbproc->size);
@@ -1560,7 +1560,7 @@ void polygonize(PROCESS *mbproc, MetaBall *mb)
 	mbproc->edges =	MEM_callocN(2*HASHSIZE * sizeof(EDGELIST *), "mbproc->edges");
 	makecubetable();
 
-	for(a=0; a<totelem; a++) {
+	for (a=0; a<totelem; a++) {
 
 		/* try to find 8 points on the surface for each MetaElem */
 		find_first_points(mbproc, mb, a);	
@@ -1606,16 +1606,16 @@ float init_meta(Scene *scene, Object *ob)	/* return totsize */
 	
 	/* make main array */
 	next_object(&sce_iter, 0, NULL, NULL);
-	while(next_object(&sce_iter, 1, &base, &bob)) {
+	while (next_object(&sce_iter, 1, &base, &bob)) {
 
-		if(bob->type==OB_MBALL) {
+		if (bob->type==OB_MBALL) {
 			zero_size= 0;
 			ml= NULL;
 
-			if(bob==ob && (base->flag & OB_FROMDUPLI)==0) {
+			if (bob==ob && (base->flag & OB_FROMDUPLI)==0) {
 				mb= ob->data;
 	
-				if(mb->editelems) ml= mb->editelems->first;
+				if (mb->editelems) ml= mb->editelems->first;
 				else ml= mb->elems.first;
 			}
 			else {
@@ -1623,23 +1623,23 @@ float init_meta(Scene *scene, Object *ob)	/* return totsize */
 				int nr;
 				
 				BLI_split_name_num(name, &nr, bob->id.name+2, '.');
-				if( strcmp(obname, name)==0 ) {
+				if ( strcmp(obname, name)==0 ) {
 					mb= bob->data;
 					
-					if(mb->editelems) ml= mb->editelems->first;
+					if (mb->editelems) ml= mb->editelems->first;
 					else ml= mb->elems.first;
 				}
 			}
 
 			/* when metaball object has zero scale, then MetaElem to this MetaBall
 			 * will not be put to mainb array */
-			if(bob->size[0]==0.0f || bob->size[1]==0.0f || bob->size[2]==0.0f) {
+			if (bob->size[0]==0.0f || bob->size[1]==0.0f || bob->size[2]==0.0f) {
 				zero_size= 1;
 			}
-			else if(bob->parent) {
+			else if (bob->parent) {
 				struct Object *pob=bob->parent;
-				while(pob) {
-					if(pob->size[0]==0.0f || pob->size[1]==0.0f || pob->size[2]==0.0f) {
+				while (pob) {
+					if (pob->size[0]==0.0f || pob->size[1]==0.0f || pob->size[2]==0.0f) {
 						zero_size= 1;
 						break;
 					}
@@ -1649,15 +1649,15 @@ float init_meta(Scene *scene, Object *ob)	/* return totsize */
 
 			if (zero_size) {
 				unsigned int ml_count=0;
-				while(ml) {
+				while (ml) {
 					ml_count++;
 					ml= ml->next;
 				}
 				totelem -= ml_count;
 			}
 			else {
-			while(ml) {
-				if(!(ml->flag & MB_HIDE)) {
+			while (ml) {
+				if (!(ml->flag & MB_HIDE)) {
 					int i;
 					float temp1[4][4], temp2[4][4], temp3[4][4];
 					float (*mat)[4] = NULL, (*imat)[4] = NULL;
@@ -1668,7 +1668,7 @@ float init_meta(Scene *scene, Object *ob)	/* return totsize */
 
 					/* too big stiffness seems only ugly due to linear interpolation
 					 * no need to have possibility for too big stiffness */
-					if(ml->s > 10.0f) ml->s = 10.0f;
+					if (ml->s > 10.0f) ml->s = 10.0f;
 					
 					/* Rotation of MetaElem is stored in quat */
 					 quat_to_mat4( temp3,ml->quat);
@@ -1737,23 +1737,23 @@ float init_meta(Scene *scene, Object *ob)	/* return totsize */
 					mainb[a]->bb->vec[7][2]=  ml->expz;
 
 					/* transformation of Metalem bb */
-					for(i=0; i<8; i++)
-						mul_m4_v3((float ( * )[4])mat, mainb[a]->bb->vec[i]);
+					for (i=0; i<8; i++)
+						mul_m4_v3((float (*)[4])mat, mainb[a]->bb->vec[i]);
 
 					/* find max and min of transformed bb */
-					for(i=0; i<8; i++){
+					for (i=0; i<8; i++) {
 						/* find maximums */
-						if(mainb[a]->bb->vec[i][0] > max_x) max_x = mainb[a]->bb->vec[i][0];
-						if(mainb[a]->bb->vec[i][1] > max_y) max_y = mainb[a]->bb->vec[i][1];
-						if(mainb[a]->bb->vec[i][2] > max_z) max_z = mainb[a]->bb->vec[i][2];
+						if (mainb[a]->bb->vec[i][0] > max_x) max_x = mainb[a]->bb->vec[i][0];
+						if (mainb[a]->bb->vec[i][1] > max_y) max_y = mainb[a]->bb->vec[i][1];
+						if (mainb[a]->bb->vec[i][2] > max_z) max_z = mainb[a]->bb->vec[i][2];
 						/* find  minimums */
-						if(mainb[a]->bb->vec[i][0] < min_x) min_x = mainb[a]->bb->vec[i][0];
-						if(mainb[a]->bb->vec[i][1] < min_y) min_y = mainb[a]->bb->vec[i][1];
-						if(mainb[a]->bb->vec[i][2] < min_z) min_z = mainb[a]->bb->vec[i][2];
+						if (mainb[a]->bb->vec[i][0] < min_x) min_x = mainb[a]->bb->vec[i][0];
+						if (mainb[a]->bb->vec[i][1] < min_y) min_y = mainb[a]->bb->vec[i][1];
+						if (mainb[a]->bb->vec[i][2] < min_z) min_z = mainb[a]->bb->vec[i][2];
 					}
 
 					/* create "new" bb, only point 0 and 6, which are
-					 * neccesary for octal tree filling */
+					 * necessary for octal tree filling */
 					mainb[a]->bb->vec[0][0] = min_x - ml->rad;
 					mainb[a]->bb->vec[0][1] = min_y - ml->rad;
 					mainb[a]->bb->vec[0][2] = min_z - ml->rad;
@@ -1773,7 +1773,7 @@ float init_meta(Scene *scene, Object *ob)	/* return totsize */
 	
 	/* totsize (= 'manhattan' radius) */
 	totsize= 0.0;
-	for(a=0; a<totelem; a++) {
+	for (a=0; a<totelem; a++) {
 		
 		vec[0]= mainb[a]->x + mainb[a]->rad + mainb[a]->expx;
 		vec[1]= mainb[a]->y + mainb[a]->rad + mainb[a]->expy;
@@ -1782,11 +1782,11 @@ float init_meta(Scene *scene, Object *ob)	/* return totsize */
 		calc_mballco(mainb[a], vec);
 	
 		size= fabsf( vec[0] );
-		if( size > totsize ) totsize= size;
+		if ( size > totsize ) totsize= size;
 		size= fabsf( vec[1] );
-		if( size > totsize ) totsize= size;
+		if ( size > totsize ) totsize= size;
 		size= fabsf( vec[2] );
-		if( size > totsize ) totsize= size;
+		if ( size > totsize ) totsize= size;
 
 		vec[0]= mainb[a]->x - mainb[a]->rad;
 		vec[1]= mainb[a]->y - mainb[a]->rad;
@@ -1795,15 +1795,15 @@ float init_meta(Scene *scene, Object *ob)	/* return totsize */
 		calc_mballco(mainb[a], vec);
 	
 		size= fabsf( vec[0] );
-		if( size > totsize ) totsize= size;
+		if ( size > totsize ) totsize= size;
 		size= fabsf( vec[1] );
-		if( size > totsize ) totsize= size;
+		if ( size > totsize ) totsize= size;
 		size= fabsf( vec[2] );
-		if( size > totsize ) totsize= size;
+		if ( size > totsize ) totsize= size;
 	}
 
-	for(a=0; a<totelem; a++) {
-		thresh+= densfunc( mainb[a], 2.0f*totsize, 2.0f*totsize, 2.0f*totsize);
+	for (a=0; a<totelem; a++) {
+		thresh += densfunc(mainb[a], 2.0f * totsize, 2.0f * totsize, 2.0f * totsize);
 	}
 
 	return totsize;
@@ -1821,15 +1821,15 @@ void fill_metaball_octal_node(octal_node *node, MetaElem *ml, short i)
 	BLI_addtail(&(node->nodes[i]->elems), ml_p);
 	node->count++;
 	
-	if(ml->flag & MB_NEGATIVE) {
+	if (ml->flag & MB_NEGATIVE) {
 		node->nodes[i]->neg++;
 	}
-	else{
+	else {
 		node->nodes[i]->pos++;
 	}
 }
 
-/* Node is subdivided as is ilustrated on the following figure:
+/* Node is subdivided as is illustrated on the following figure:
  * 
  *      +------+------+
  *     /      /      /|
@@ -1852,9 +1852,9 @@ void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y,
 	int a,i;
 
 	/* create new nodes */
-	for(a=0;a<8;a++){
+	for (a=0;a<8;a++) {
 		node->nodes[a]= MEM_mallocN(sizeof(octal_node),"octal_node");
-		for(i=0;i<8;i++)
+		for (i=0;i<8;i++)
 			node->nodes[a]->nodes[i]= NULL;
 		node->nodes[a]->parent= node;
 		node->nodes[a]->elems.first= NULL;
@@ -1933,48 +1933,48 @@ void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y,
 	ml_p= node->elems.first;
 	
 	/* setting up references of MetaElems for new nodes */
-	while(ml_p){
+	while (ml_p) {
 		ml= ml_p->ml;
-		if(ml->bb->vec[0][2] < z){
-			if(ml->bb->vec[0][1] < y){
+		if (ml->bb->vec[0][2] < z) {
+			if (ml->bb->vec[0][1] < y) {
 				/* vec[0][0] lies in first octant */
-				if(ml->bb->vec[0][0] < x){
+				if (ml->bb->vec[0][0] < x) {
 					/* ml belongs to the (0)1st node */
 					fill_metaball_octal_node(node, ml, 0);
 
 					/* ml belongs to the (3)4th node */
-					if(ml->bb->vec[6][1] >= y){
+					if (ml->bb->vec[6][1] >= y) {
 						fill_metaball_octal_node(node, ml, 3);
 
 						/* ml belongs to the (7)8th node */
-						if(ml->bb->vec[6][2] >= z){
+						if (ml->bb->vec[6][2] >= z) {
 							fill_metaball_octal_node(node, ml, 7);
 						}
 					}
 	
 					/* ml belongs to the (1)2nd node */
-					if(ml->bb->vec[6][0] >= x){
+					if (ml->bb->vec[6][0] >= x) {
 						fill_metaball_octal_node(node, ml, 1);
 
 						/* ml belongs to the (5)6th node */
-						if(ml->bb->vec[6][2] >= z){
+						if (ml->bb->vec[6][2] >= z) {
 							fill_metaball_octal_node(node, ml, 5);
 						}
 					}
 
 					/* ml belongs to the (2)3th node */
-					if((ml->bb->vec[6][0] >= x) && (ml->bb->vec[6][1] >= y)){
+					if ((ml->bb->vec[6][0] >= x) && (ml->bb->vec[6][1] >= y)) {
 						fill_metaball_octal_node(node, ml, 2);
 						
 						/* ml belong to the (6)7th node */
-						if(ml->bb->vec[6][2] >= z){
+						if (ml->bb->vec[6][2] >= z) {
 							fill_metaball_octal_node(node, ml, 6);
 						}
 						
 					}
 			
 					/* ml belongs to the (4)5th node too */	
-					if(ml->bb->vec[6][2] >= z){
+					if (ml->bb->vec[6][2] >= z) {
 						fill_metaball_octal_node(node, ml, 4);
 					}
 
@@ -1982,45 +1982,45 @@ void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y,
 					
 				}
 				/* vec[0][0] is in the (1)second octant */
-				else{
+				else {
 					/* ml belong to the (1)2nd node */
 					fill_metaball_octal_node(node, ml, 1);
 
 					/* ml belongs to the (2)3th node */
-					if(ml->bb->vec[6][1] >= y){
+					if (ml->bb->vec[6][1] >= y) {
 						fill_metaball_octal_node(node, ml, 2);
 
 						/* ml belongs to the (6)7th node */
-						if(ml->bb->vec[6][2] >= z){
+						if (ml->bb->vec[6][2] >= z) {
 							fill_metaball_octal_node(node, ml, 6);
 						}
 						
 					}
 					
 					/* ml belongs to the (5)6th node */
-					if(ml->bb->vec[6][2] >= z){
+					if (ml->bb->vec[6][2] >= z) {
 						fill_metaball_octal_node(node, ml, 5);
 					}
 				}
 			}
-			else{
+			else {
 				/* vec[0][0] is in the (3)4th octant */
-				if(ml->bb->vec[0][0] < x){
+				if (ml->bb->vec[0][0] < x) {
 					/* ml belongs to the (3)4nd node */
 					fill_metaball_octal_node(node, ml, 3);
 					
 					/* ml belongs to the (7)8th node */
-					if(ml->bb->vec[6][2] >= z){
+					if (ml->bb->vec[6][2] >= z) {
 						fill_metaball_octal_node(node, ml, 7);
 					}
 				
 
 					/* ml belongs to the (2)3th node */
-					if(ml->bb->vec[6][0] >= x){
+					if (ml->bb->vec[6][0] >= x) {
 						fill_metaball_octal_node(node, ml, 2);
 					
 						/* ml belongs to the (6)7th node */
-						if(ml->bb->vec[6][2] >= z){
+						if (ml->bb->vec[6][2] >= z) {
 							fill_metaball_octal_node(node, ml, 6);
 						}
 					}
@@ -2029,50 +2029,50 @@ void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y,
 			}
 
 			/* vec[0][0] is in the (2)3th octant */
-			if((ml->bb->vec[0][0] >= x) && (ml->bb->vec[0][1] >= y)){
+			if ((ml->bb->vec[0][0] >= x) && (ml->bb->vec[0][1] >= y)) {
 				/* ml belongs to the (2)3th node */
 				fill_metaball_octal_node(node, ml, 2);
 				
 				/* ml belongs to the (6)7th node */
-				if(ml->bb->vec[6][2] >= z){
+				if (ml->bb->vec[6][2] >= z) {
 					fill_metaball_octal_node(node, ml, 6);
 				}
 			}
 		}
-		else{
-			if(ml->bb->vec[0][1] < y){
+		else {
+			if (ml->bb->vec[0][1] < y) {
 				/* vec[0][0] lies in (4)5th octant */
-				if(ml->bb->vec[0][0] < x){
+				if (ml->bb->vec[0][0] < x) {
 					/* ml belongs to the (4)5th node */
 					fill_metaball_octal_node(node, ml, 4);
 
-					if(ml->bb->vec[6][0] >= x){
+					if (ml->bb->vec[6][0] >= x) {
 						fill_metaball_octal_node(node, ml, 5);
 					}
 
-					if(ml->bb->vec[6][1] >= y){
+					if (ml->bb->vec[6][1] >= y) {
 						fill_metaball_octal_node(node, ml, 7);
 					}
 					
-					if((ml->bb->vec[6][0] >= x) && (ml->bb->vec[6][1] >= y)){
+					if ((ml->bb->vec[6][0] >= x) && (ml->bb->vec[6][1] >= y)) {
 						fill_metaball_octal_node(node, ml, 6);
 					}
 				}
 				/* vec[0][0] lies in (5)6th octant */
-				else{
+				else {
 					fill_metaball_octal_node(node, ml, 5);
 
-					if(ml->bb->vec[6][1] >= y){
+					if (ml->bb->vec[6][1] >= y) {
 						fill_metaball_octal_node(node, ml, 6);
 					}
 				}
 			}
-			else{
+			else {
 				/* vec[0][0] lies in (7)8th octant */
-				if(ml->bb->vec[0][0] < x){
+				if (ml->bb->vec[0][0] < x) {
 					fill_metaball_octal_node(node, ml, 7);
 
-					if(ml->bb->vec[6][0] >= x){
+					if (ml->bb->vec[6][0] >= x) {
 						fill_metaball_octal_node(node, ml, 6);
 					}
 				}
@@ -2080,7 +2080,7 @@ void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y,
 			}
 			
 			/* vec[0][0] lies in (6)7th octant */
-			if((ml->bb->vec[0][0] >= x) && (ml->bb->vec[0][1] >= y)){
+			if ((ml->bb->vec[0][0] >= x) && (ml->bb->vec[0][1] >= y)) {
 				fill_metaball_octal_node(node, ml, 6);
 			}
 		}
@@ -2092,9 +2092,9 @@ void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y,
 
 	depth--;
 	
-	if(depth>0){
-		for(a=0;a<8;a++){
-			if(node->nodes[a]->count > 0) /* if node is not empty, then it is subdivided */
+	if (depth>0) {
+		for (a=0;a<8;a++) {
+			if (node->nodes[a]->count > 0) /* if node is not empty, then it is subdivided */
 				subdivide_metaball_octal_node(node->nodes[a], size_x, size_y, size_z, depth);
 		}
 	}
@@ -2104,8 +2104,8 @@ void subdivide_metaball_octal_node(octal_node *node, float size_x, float size_y,
 void free_metaball_octal_node(octal_node *node)
 {
 	int a;
-	for(a=0;a<8;a++){
-		if(node->nodes[a]!=NULL) free_metaball_octal_node(node->nodes[a]);
+	for (a=0;a<8;a++) {
+		if (node->nodes[a]!=NULL) free_metaball_octal_node(node->nodes[a]);
 	}
 	BLI_freelistN(&node->elems);
 	MEM_freeN(node);
@@ -2131,31 +2131,31 @@ void init_metaball_octal_tree(int depth)
 	node->elems.last= NULL;
 	node->count=0;
 
-	for(a=0;a<8;a++)
+	for (a=0;a<8;a++)
 		node->nodes[a]=NULL;
 
 	node->x_min= node->y_min= node->z_min= FLT_MAX;
 	node->x_max= node->y_max= node->z_max= -FLT_MAX;
 
 	/* size of octal tree scene */
-	for(a=0;a<totelem;a++) {
-		if(mainb[a]->bb->vec[0][0] < node->x_min) node->x_min= mainb[a]->bb->vec[0][0];
-		if(mainb[a]->bb->vec[0][1] < node->y_min) node->y_min= mainb[a]->bb->vec[0][1];
-		if(mainb[a]->bb->vec[0][2] < node->z_min) node->z_min= mainb[a]->bb->vec[0][2];
+	for (a=0;a<totelem;a++) {
+		if (mainb[a]->bb->vec[0][0] < node->x_min) node->x_min= mainb[a]->bb->vec[0][0];
+		if (mainb[a]->bb->vec[0][1] < node->y_min) node->y_min= mainb[a]->bb->vec[0][1];
+		if (mainb[a]->bb->vec[0][2] < node->z_min) node->z_min= mainb[a]->bb->vec[0][2];
 		
-		if(mainb[a]->bb->vec[6][0] > node->x_max) node->x_max= mainb[a]->bb->vec[6][0];
-		if(mainb[a]->bb->vec[6][1] > node->y_max) node->y_max= mainb[a]->bb->vec[6][1];
-		if(mainb[a]->bb->vec[6][2] > node->z_max) node->z_max= mainb[a]->bb->vec[6][2];
+		if (mainb[a]->bb->vec[6][0] > node->x_max) node->x_max= mainb[a]->bb->vec[6][0];
+		if (mainb[a]->bb->vec[6][1] > node->y_max) node->y_max= mainb[a]->bb->vec[6][1];
+		if (mainb[a]->bb->vec[6][2] > node->z_max) node->z_max= mainb[a]->bb->vec[6][2];
 
 		ml_p= MEM_mallocN(sizeof(ml_pointer), "ml_pointer");
 		ml_p->ml= mainb[a];
 		BLI_addtail(&node->elems, ml_p);
 
-		if(mainb[a]->flag & MB_NEGATIVE) {
+		if (mainb[a]->flag & MB_NEGATIVE) {
 			/* number of negative MetaElem in scene */
 			metaball_tree->neg++;
 		}
-		else{
+		else {
 			/* number of positive MetaElem in scene */
 			metaball_tree->pos++;
 		}
@@ -2180,9 +2180,9 @@ void metaball_polygonize(Scene *scene, Object *ob, ListBase *dispbase)
 
 	mb= ob->data;
 
-	if(totelem==0) return;
-	if(!(G.rendering) && (mb->flag==MB_UPDATE_NEVER)) return;
-	if(G.moving && mb->flag==MB_UPDATE_FAST) return;
+	if (totelem==0) return;
+	if (!(G.rendering) && (mb->flag==MB_UPDATE_NEVER)) return;
+	if (G.moving && mb->flag==MB_UPDATE_FAST) return;
 
 	curindex= totindex= 0;
 	indices= NULL;
@@ -2194,23 +2194,23 @@ void metaball_polygonize(Scene *scene, Object *ob, ListBase *dispbase)
 	/* initialize all mainb (MetaElems) */
 	totsize= init_meta(scene, ob);
 
-	if(metaball_tree){
+	if (metaball_tree) {
 		free_metaball_octal_node(metaball_tree->first);
 		MEM_freeN(metaball_tree);
 		metaball_tree= NULL;
 	}
 
 	/* if scene includes more then one MetaElem, then octal tree optimalisation is used */	
-	if((totelem > 1) && (totelem <= 64)) init_metaball_octal_tree(1);
-	if((totelem > 64) && (totelem <= 128)) init_metaball_octal_tree(2);
-	if((totelem > 128) && (totelem <= 512))	init_metaball_octal_tree(3);
-	if((totelem > 512) && (totelem <= 1024)) init_metaball_octal_tree(4);
-	if(totelem > 1024) init_metaball_octal_tree(5);
+	if ((totelem > 1) && (totelem <= 64)) init_metaball_octal_tree(1);
+	if ((totelem > 64) && (totelem <= 128)) init_metaball_octal_tree(2);
+	if ((totelem > 128) && (totelem <= 512))	init_metaball_octal_tree(3);
+	if ((totelem > 512) && (totelem <= 1024)) init_metaball_octal_tree(4);
+	if (totelem > 1024) init_metaball_octal_tree(5);
 
 	/* don't polygonize metaballs with too high resolution (base mball to small)
 	 * note: Eps was 0.0001f but this was giving problems for blood animation for durian, using 0.00001f */
-	if(metaball_tree) {
-		if(	ob->size[0] <= 0.00001f * (metaball_tree->first->x_max - metaball_tree->first->x_min) ||
+	if (metaball_tree) {
+		if (	ob->size[0] <= 0.00001f * (metaball_tree->first->x_max - metaball_tree->first->x_min) ||
 			ob->size[1] <= 0.00001f * (metaball_tree->first->y_max - metaball_tree->first->y_min) ||
 			ob->size[2] <= 0.00001f * (metaball_tree->first->z_max - metaball_tree->first->z_min))
 		{
@@ -2228,10 +2228,10 @@ void metaball_polygonize(Scene *scene, Object *ob, ListBase *dispbase)
 	}
 
 	/* width is size per polygonize cube */
-	if(G.rendering) width= mb->rendersize;
+	if (G.rendering) width= mb->rendersize;
 	else {
 		width= mb->wiresize;
-		if(G.moving && mb->flag==MB_UPDATE_HALFRES) width*= 2;
+		if (G.moving && mb->flag==MB_UPDATE_HALFRES) width*= 2;
 	}
 	/* nr_cubes is just for safety, minimum is totsize */
 	nr_cubes= (int)(0.5f+totsize/width);
@@ -2248,13 +2248,13 @@ void metaball_polygonize(Scene *scene, Object *ob, ListBase *dispbase)
 	MEM_freeN(mainb);
 
 	/* free octal tree */
-	if(totelem > 1){
+	if (totelem > 1) {
 		free_metaball_octal_node(metaball_tree->first);
 		MEM_freeN(metaball_tree);
 		metaball_tree= NULL;
 	}
 
-	if(curindex) {
+	if (curindex) {
 		dl= MEM_callocN(sizeof(DispList), "mbaldisp");
 		BLI_addtail(dispbase, dl);
 		dl->type= DL_INDEX4;
@@ -2268,7 +2268,7 @@ void metaball_polygonize(Scene *scene, Object *ob, ListBase *dispbase)
 		dl->verts= ve= MEM_mallocN(sizeof(float)*3*a, "mballverts");
 		dl->nors= no= MEM_mallocN(sizeof(float)*3*a, "mballnors");
 
-		for(a=0; a<mbproc.vertices.count; a++, no+=3, ve+=3) {
+		for (a=0; a<mbproc.vertices.count; a++, no+=3, ve+=3) {
 			ve[0]= mbproc.vertices.ptr[a].position.x;
 			ve[1]= mbproc.vertices.ptr[a].position.y;
 			ve[2]= mbproc.vertices.ptr[a].position.z;
@@ -2282,3 +2282,54 @@ void metaball_polygonize(Scene *scene, Object *ob, ListBase *dispbase)
 	freepolygonize(&mbproc);
 }
 
+/* basic vertex data functions */
+int BKE_metaball_minmax(MetaBall *mb, float min[3], float max[3])
+{
+	MetaElem *ml;
+
+	INIT_MINMAX(min, max);
+
+	for (ml = mb->elems.first; ml; ml = ml->next) {
+		DO_MINMAX(&ml->x, min, max);
+	}
+
+	return (mb->elems.first != NULL);
+}
+
+int BKE_metaball_center_median(MetaBall *mb, float cent[3])
+{
+	MetaElem *ml;
+	int total= 0;
+
+	zero_v3(cent);
+
+	for (ml = mb->elems.first; ml; ml = ml->next) {
+		add_v3_v3(cent, &ml->x);
+	}
+
+	if (total)
+		mul_v3_fl(cent, 1.0f/(float)total);
+
+	return (total != 0);
+}
+
+int BKE_metaball_center_bounds(MetaBall *mb, float cent[3])
+{
+	float min[3], max[3];
+
+	if (BKE_metaball_minmax(mb, min, max)) {
+		mid_v3_v3v3(cent, min, max);
+		return 1;
+	}
+
+	return 0;
+}
+
+void BKE_metaball_translate(MetaBall *mb, float offset[3])
+{
+	MetaElem *ml;
+
+	for (ml = mb->elems.first; ml; ml = ml->next) {
+		add_v3_v3(&ml->x, offset);
+	}
+}
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index f9f0275..59dd7db 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -39,18 +39,21 @@
 #include "DNA_material_types.h"
 #include "DNA_object_types.h"
 #include "DNA_key_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_ipo_types.h"
+#include "DNA_customdata_types.h"
 
 #include "BLI_utildefines.h"
 #include "BLI_blenlib.h"
 #include "BLI_bpath.h"
-#include "BLI_editVert.h"
 #include "BLI_math.h"
 #include "BLI_edgehash.h"
+#include "BLI_scanfill.h"
 
 #include "BKE_animsys.h"
 #include "BKE_main.h"
+#include "BKE_customdata.h"
 #include "BKE_DerivedMesh.h"
 #include "BKE_global.h"
 #include "BKE_mesh.h"
@@ -64,24 +67,300 @@
 #include "BKE_curve.h"
 /* -- */
 #include "BKE_object.h"
+#include "BKE_tessmesh.h"
+#include "BLI_edgehash.h"
 
-#ifdef USE_BMESH_FORWARD_COMPAT
+#include "BLI_blenlib.h"
+#include "BLI_math.h"
 #include "BLI_array.h"
-#endif
+#include "BLI_edgehash.h"
+
+#include "bmesh.h"
+
+enum {
+	MESHCMP_DVERT_WEIGHTMISMATCH = 1,
+	MESHCMP_DVERT_GROUPMISMATCH,
+	MESHCMP_DVERT_TOTGROUPMISMATCH,
+	MESHCMP_LOOPCOLMISMATCH,
+	MESHCMP_LOOPUVMISMATCH,
+	MESHCMP_LOOPMISMATCH,
+	MESHCMP_POLYVERTMISMATCH,
+	MESHCMP_POLYMISMATCH,
+	MESHCMP_EDGEUNKNOWN,
+	MESHCMP_VERTCOMISMATCH,
+	MESHCMP_CDLAYERS_MISMATCH,
+};
+
+static const char *cmpcode_to_str(int code)
+{
+	switch (code) {
+		case MESHCMP_DVERT_WEIGHTMISMATCH:
+			return "Vertex Weight Mismatch";
+		case MESHCMP_DVERT_GROUPMISMATCH:
+					return "Vertex Group Mismatch";
+		case MESHCMP_DVERT_TOTGROUPMISMATCH:
+					return "Vertex Doesn't Belong To Same Number Of Groups";
+		case MESHCMP_LOOPCOLMISMATCH:
+					return "Vertex Color Mismatch";
+		case MESHCMP_LOOPUVMISMATCH:
+					return "UV Mismatch";
+		case MESHCMP_LOOPMISMATCH:
+					return "Loop Mismatch";
+		case MESHCMP_POLYVERTMISMATCH:
+					return "Loop Vert Mismatch In Poly Test";
+		case MESHCMP_POLYMISMATCH:
+					return "Loop Vert Mismatch";
+		case MESHCMP_EDGEUNKNOWN:
+					return "Edge Mismatch";
+		case MESHCMP_VERTCOMISMATCH:
+					return "Vertex Coordinate Mismatch";
+		case MESHCMP_CDLAYERS_MISMATCH:
+					return "CustomData Layer Count Mismatch";
+		default:
+				return "Mesh Comparison Code Unknown";
+		}
+}
+
+/* thresh is threshold for comparing vertices, uvs, vertex colors,
+ * weights, etc.*/
+static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2, float thresh)
+{
+	CustomDataLayer *l1, *l2;
+	int i, i1=0, i2=0, tot, j;
+	
+	for (i=0; i<c1->totlayer; i++) {
+		if (ELEM7(c1->layers[i].type, CD_MVERT, CD_MEDGE, CD_MPOLY, 
+				  CD_MLOOPUV, CD_MLOOPCOL, CD_MTEXPOLY, CD_MDEFORMVERT)) 		
+			i1++;
+	}
+	
+	for (i=0; i<c2->totlayer; i++) {
+		if (ELEM7(c2->layers[i].type, CD_MVERT, CD_MEDGE, CD_MPOLY, 
+				  CD_MLOOPUV, CD_MLOOPCOL, CD_MTEXPOLY, CD_MDEFORMVERT)) 		
+			i2++;
+	}
+	
+	if (i1 != i2)
+		return MESHCMP_CDLAYERS_MISMATCH;
+	
+	l1 = c1->layers; l2 = c2->layers;
+	tot = i1;
+	i1 = 0; i2 = 0; 
+	for (i=0; i < tot; i++) {
+		while (i1 < c1->totlayer && !ELEM7(l1->type, CD_MVERT, CD_MEDGE, CD_MPOLY, 
+				  CD_MLOOPUV, CD_MLOOPCOL, CD_MTEXPOLY, CD_MDEFORMVERT))
+			i1++, l1++;
+
+		while (i2 < c2->totlayer && !ELEM7(l2->type, CD_MVERT, CD_MEDGE, CD_MPOLY, 
+				  CD_MLOOPUV, CD_MLOOPCOL, CD_MTEXPOLY, CD_MDEFORMVERT))
+			i2++, l2++;
+		
+		if (l1->type == CD_MVERT) {
+			MVert *v1 = l1->data;
+			MVert *v2 = l2->data;
+			int vtot = m1->totvert;
+			
+			for (j=0; j<vtot; j++, v1++, v2++) {
+				if (len_v3v3(v1->co, v2->co) > thresh)
+					return MESHCMP_VERTCOMISMATCH;
+				/*I don't care about normals, let's just do coodinates*/
+			}
+		}
+		
+		/*we're order-agnostic for edges here*/
+		if (l1->type == CD_MEDGE) {
+			MEdge *e1 = l1->data;
+			MEdge *e2 = l2->data;
+			EdgeHash *eh = BLI_edgehash_new();
+			int etot = m1->totedge;
+		
+			for (j=0; j<etot; j++, e1++) {
+				BLI_edgehash_insert(eh, e1->v1, e1->v2, e1);
+			}
+			
+			for (j=0; j<etot; j++, e2++) {
+				if (!BLI_edgehash_lookup(eh, e2->v1, e2->v2))
+					return MESHCMP_EDGEUNKNOWN;
+			}
+			BLI_edgehash_free(eh, NULL);
+		}
+		
+		if (l1->type == CD_MPOLY) {
+			MPoly *p1 = l1->data;
+			MPoly *p2 = l2->data;
+			int ptot = m1->totpoly;
+		
+			for (j=0; j<ptot; j++, p1++, p2++) {
+				MLoop *lp1, *lp2;
+				int k;
+				
+				if (p1->totloop != p2->totloop)
+					return MESHCMP_POLYMISMATCH;
+				
+				lp1 = m1->mloop + p1->loopstart;
+				lp2 = m2->mloop + p2->loopstart;
+				
+				for (k=0; k<p1->totloop; k++, lp1++, lp2++) {
+					if (lp1->v != lp2->v)
+						return MESHCMP_POLYVERTMISMATCH;
+				}
+			}
+		}
+		if (l1->type == CD_MLOOP) {
+			MLoop *lp1 = l1->data;
+			MLoop *lp2 = l2->data;
+			int ltot = m1->totloop;
+		
+			for (j=0; j<ltot; j++, lp1++, lp2++) {
+				if (lp1->v != lp2->v)
+					return MESHCMP_LOOPMISMATCH;
+			}
+		}
+		if (l1->type == CD_MLOOPUV) {
+			MLoopUV *lp1 = l1->data;
+			MLoopUV *lp2 = l2->data;
+			int ltot = m1->totloop;
+		
+			for (j=0; j<ltot; j++, lp1++, lp2++) {
+				if (len_v2v2(lp1->uv, lp2->uv) > thresh)
+					return MESHCMP_LOOPUVMISMATCH;
+			}
+		}
+		
+		if (l1->type == CD_MLOOPCOL) {
+			MLoopCol *lp1 = l1->data;
+			MLoopCol *lp2 = l2->data;
+			int ltot = m1->totloop;
+		
+			for (j=0; j<ltot; j++, lp1++, lp2++) {
+				if (ABS(lp1->r - lp2->r) > thresh || 
+				    ABS(lp1->g - lp2->g) > thresh || 
+				    ABS(lp1->b - lp2->b) > thresh || 
+				    ABS(lp1->a - lp2->a) > thresh)
+				{
+					return MESHCMP_LOOPCOLMISMATCH;
+				}
+			}
+		}
 
+		if (l1->type == CD_MDEFORMVERT) {
+			MDeformVert *dv1 = l1->data;
+			MDeformVert *dv2 = l2->data;
+			int dvtot = m1->totvert;
+		
+			for (j=0; j<dvtot; j++, dv1++, dv2++) {
+				int k;
+				MDeformWeight *dw1 = dv1->dw, *dw2=dv2->dw;
+				
+				if (dv1->totweight != dv2->totweight)
+					return MESHCMP_DVERT_TOTGROUPMISMATCH;
+				
+				for (k=0; k<dv1->totweight; k++, dw1++, dw2++) {
+					if (dw1->def_nr != dw2->def_nr)
+						return MESHCMP_DVERT_GROUPMISMATCH;
+					if (ABS(dw1->weight - dw2->weight) > thresh)
+						return MESHCMP_DVERT_WEIGHTMISMATCH;
+				}
+			}
+		}
+	}
+	
+	return 0;
+}
 
-EditMesh *BKE_mesh_get_editmesh(Mesh *me)
+/*used for testing.  returns an error string the two meshes don't match*/
+const char *mesh_cmp(Mesh *me1, Mesh *me2, float thresh)
 {
-	return me->edit_mesh;
+	int c;
+	
+	if (!me1 || !me2)
+		return "Requires two input meshes";
+	
+	if (me1->totvert != me2->totvert) 
+		return "Number of verts don't match";
+	
+	if (me1->totedge != me2->totedge)
+		return "Number of edges don't match";
+	
+	if (me1->totpoly != me2->totpoly)
+		return "Number of faces don't match";
+				
+	if (me1->totloop !=me2->totloop)
+		return "Number of loops don't match";
+	
+	if ((c = customdata_compare(&me1->vdata, &me2->vdata, me1, me2, thresh)))
+		return cmpcode_to_str(c);
+
+	if ((c = customdata_compare(&me1->edata, &me2->edata, me1, me2, thresh)))
+		return cmpcode_to_str(c);
+
+	if ((c = customdata_compare(&me1->ldata, &me2->ldata, me1, me2, thresh)))
+		return cmpcode_to_str(c);
+
+	if ((c = customdata_compare(&me1->pdata, &me2->pdata, me1, me2, thresh)))
+		return cmpcode_to_str(c);
+	
+	return NULL;
 }
 
-void BKE_mesh_end_editmesh(Mesh *UNUSED(me), EditMesh *UNUSED(em))
+static void mesh_ensure_tessellation_customdata(Mesh *me)
 {
+	if (UNLIKELY((me->totface != 0) && (me->totpoly == 0))) {
+		/* Pass, otherwise this function  clears 'mface' before
+		 * versioning 'mface -> mpoly' code kicks in [#30583]
+		 *
+		 * Callers could also check but safer to do here - campbell */
+	}
+	else {
+		const int tottex_original = CustomData_number_of_layers(&me->pdata, CD_MTEXPOLY);
+		const int totcol_original = CustomData_number_of_layers(&me->ldata, CD_MLOOPCOL);
+
+		const int tottex_tessface = CustomData_number_of_layers(&me->fdata, CD_MTFACE);
+		const int totcol_tessface = CustomData_number_of_layers(&me->fdata, CD_MCOL);
+
+		if (tottex_tessface != tottex_original ||
+		    totcol_tessface != totcol_original )
+		{
+			BKE_mesh_tessface_clear(me);
+
+			CustomData_from_bmeshpoly(&me->fdata, &me->pdata, &me->ldata, me->totface);
+
+			/* TODO - add some --debug-mesh option */
+			if (G.debug & G_DEBUG) {
+				/* note: this warning may be un-called for if we are initializing the mesh for the
+				 * first time from bmesh, rather then giving a warning about this we could be smarter
+				 * and check if there was any data to begin with, for now just print the warning with
+				 * some info to help troubleshoot whats going on - campbell */
+				printf("%s: warning! Tessellation uvs or vcol data got out of sync, "
+					   "had to reset!\n    CD_MTFACE: %d != CD_MTEXPOLY: %d || CD_MCOL: %d != CD_MLOOPCOL: %d\n",
+					   __func__, tottex_tessface, tottex_original, totcol_tessface, totcol_original);
+			}
+		}
+	}
 }
 
+/* this ensures grouped customdata (e.g. mtexpoly and mloopuv and mtface, or
+ * mloopcol and mcol) have the same relative active/render/clone/mask indices.
+ *
+ * note that for undo mesh data we want to skip 'ensure_tess_cd' call since
+ * we don't want to store memory for tessface when its only used for older
+ * versions of the mesh. - campbell*/
+static void mesh_update_linked_customdata(Mesh *me, const short do_ensure_tess_cd)
+{
+	if (me->edit_btmesh)
+		BMEdit_UpdateLinkedCustomData(me->edit_btmesh);
+
+	if (do_ensure_tess_cd) {
+		mesh_ensure_tessellation_customdata(me);
+	}
+
+	CustomData_bmesh_update_active_layers(&me->fdata, &me->pdata, &me->ldata);
+}
 
-void mesh_update_customdata_pointers(Mesh *me)
+void mesh_update_customdata_pointers(Mesh *me, const short do_ensure_tess_cd)
 {
+	mesh_update_linked_customdata(me, do_ensure_tess_cd);
+
 	me->mvert = CustomData_get_layer(&me->vdata, CD_MVERT);
 	me->dvert = CustomData_get_layer(&me->vdata, CD_MDEFORMVERT);
 	me->msticky = CustomData_get_layer(&me->vdata, CD_MSTICKY);
@@ -91,6 +370,13 @@ void mesh_update_customdata_pointers(Mesh *me)
 	me->mface = CustomData_get_layer(&me->fdata, CD_MFACE);
 	me->mcol = CustomData_get_layer(&me->fdata, CD_MCOL);
 	me->mtface = CustomData_get_layer(&me->fdata, CD_MTFACE);
+	
+	me->mpoly = CustomData_get_layer(&me->pdata, CD_MPOLY);
+	me->mloop = CustomData_get_layer(&me->ldata, CD_MLOOP);
+
+	me->mtpoly = CustomData_get_layer(&me->pdata, CD_MTEXPOLY);
+	me->mloopcol = CustomData_get_layer(&me->ldata, CD_MLOOPCOL);
+	me->mloopuv = CustomData_get_layer(&me->ldata, CD_MLOOPUV);
 }
 
 /* Note: unlinking is called when me->id.us is 0, question remains how
@@ -102,40 +388,43 @@ void unlink_mesh(Mesh *me)
 {
 	int a;
 	
-	if(me==NULL) return;
+	if (me==NULL) return;
 	
-	for(a=0; a<me->totcol; a++) {
-		if(me->mat[a]) me->mat[a]->id.us--;
+	for (a=0; a<me->totcol; a++) {
+		if (me->mat[a]) me->mat[a]->id.us--;
 		me->mat[a]= NULL;
 	}
 
-	if(me->key) {
+	if (me->key) {
 		me->key->id.us--;
 	}
 	me->key= NULL;
 	
-	if(me->texcomesh) me->texcomesh= NULL;
+	if (me->texcomesh) me->texcomesh= NULL;
 }
 
 /* do not free mesh itself */
-void free_mesh(Mesh *me)
+void free_mesh(Mesh *me, int unlink)
 {
-	unlink_mesh(me);
+	if (unlink)
+		unlink_mesh(me);
 
 	CustomData_free(&me->vdata, me->totvert);
 	CustomData_free(&me->edata, me->totedge);
 	CustomData_free(&me->fdata, me->totface);
-	
-	if(me->adt) {
+	CustomData_free(&me->ldata, me->totloop);
+	CustomData_free(&me->pdata, me->totpoly);
+
+	if (me->adt) {
 		BKE_free_animdata(&me->id);
 		me->adt= NULL;
 	}
 	
-	if(me->mat) MEM_freeN(me->mat);
+	if (me->mat) MEM_freeN(me->mat);
 	
-	if(me->bb) MEM_freeN(me->bb);
-	if(me->mselect) MEM_freeN(me->mselect);
-	if(me->edit_mesh) MEM_freeN(me->edit_mesh);
+	if (me->bb) MEM_freeN(me->bb);
+	if (me->mselect) MEM_freeN(me->mselect);
+	if (me->edit_btmesh) MEM_freeN(me->edit_btmesh);
 }
 
 void copy_dverts(MDeformVert *dst, MDeformVert *src, int copycount)
@@ -148,8 +437,8 @@ void copy_dverts(MDeformVert *dst, MDeformVert *src, int copycount)
 
 	memcpy (dst, src, copycount * sizeof(MDeformVert));
 	
-	for (i=0; i<copycount; i++){
-		if (src[i].dw){
+	for (i=0; i<copycount; i++) {
+		if (src[i].dw) {
 			dst[i].dw = MEM_callocN (sizeof(MDeformWeight)*src[i].totweight, "copy_deformWeight");
 			memcpy (dst[i].dw, src[i].dw, sizeof (MDeformWeight)*src[i].totweight);
 		}
@@ -160,20 +449,33 @@ void copy_dverts(MDeformVert *dst, MDeformVert *src, int copycount)
 void free_dverts(MDeformVert *dvert, int totvert)
 {
 	/* Instead of freeing the verts directly,
-	call this function to delete any special
-	vert data */
+	 * call this function to delete any special
+	 * vert data */
 	int	i;
 
 	if (!dvert)
 		return;
 
 	/* Free any special data from the verts */
-	for (i=0; i<totvert; i++){
+	for (i=0; i<totvert; i++) {
 		if (dvert[i].dw) MEM_freeN (dvert[i].dw);
 	}
 	MEM_freeN (dvert);
 }
 
+static void mesh_tessface_clear_intern(Mesh *mesh, int free_customdata)
+{
+	if (free_customdata)
+		CustomData_free(&mesh->fdata, mesh->totface);
+
+	mesh->mface = NULL;
+	mesh->mtface = NULL;
+	mesh->mcol = NULL;
+	mesh->totface = 0;
+
+	memset(&mesh->fdata, 0, sizeof(mesh->fdata));
+}
+
 Mesh *add_mesh(const char *name)
 {
 	Mesh *me;
@@ -182,7 +484,7 @@ Mesh *add_mesh(const char *name)
 	
 	me->size[0]= me->size[1]= me->size[2]= 1.0;
 	me->smoothresh= 30;
-	me->texflag= AUTOSPACE;
+	me->texflag= ME_AUTOSPACE;
 	me->flag= ME_TWOSIDED;
 	me->bb= unit_boundbox();
 	me->drawflag= ME_DRAWEDGES|ME_DRAWFACES|ME_DRAWCREASES;
@@ -194,57 +496,101 @@ Mesh *copy_mesh(Mesh *me)
 {
 	Mesh *men;
 	MTFace *tface;
+	MTexPoly *txface;
 	int a, i;
+	const int do_tessface = ((me->totface != 0) && (me->totpoly == 0)); /* only do tessface if we have no polys */
 	
 	men= copy_libblock(&me->id);
 	
 	men->mat= MEM_dupallocN(me->mat);
-	for(a=0; a<men->totcol; a++) {
+	for (a=0; a<men->totcol; a++) {
 		id_us_plus((ID *)men->mat[a]);
 	}
 	id_us_plus((ID *)men->texcomesh);
 
 	CustomData_copy(&me->vdata, &men->vdata, CD_MASK_MESH, CD_DUPLICATE, men->totvert);
 	CustomData_copy(&me->edata, &men->edata, CD_MASK_MESH, CD_DUPLICATE, men->totedge);
-	CustomData_copy(&me->fdata, &men->fdata, CD_MASK_MESH, CD_DUPLICATE, men->totface);
-	mesh_update_customdata_pointers(men);
+	CustomData_copy(&me->ldata, &men->ldata, CD_MASK_MESH, CD_DUPLICATE, men->totloop);
+	CustomData_copy(&me->pdata, &men->pdata, CD_MASK_MESH, CD_DUPLICATE, men->totpoly);
+	if (do_tessface) {
+		CustomData_copy(&me->fdata, &men->fdata, CD_MASK_MESH, CD_DUPLICATE, men->totface);
+	}
+	else {
+		mesh_tessface_clear_intern(men, FALSE);
+	}
+
+	mesh_update_customdata_pointers(men, do_tessface);
 
 	/* ensure indirect linked data becomes lib-extern */
-	for(i=0; i<me->fdata.totlayer; i++) {
-		if(me->fdata.layers[i].type == CD_MTFACE) {
+	for (i=0; i<me->fdata.totlayer; i++) {
+		if (me->fdata.layers[i].type == CD_MTFACE) {
 			tface= (MTFace*)me->fdata.layers[i].data;
 
-			for(a=0; a<me->totface; a++, tface++)
-				if(tface->tpage)
+			for (a=0; a<me->totface; a++, tface++)
+				if (tface->tpage)
 					id_lib_extern((ID*)tface->tpage);
 		}
 	}
 	
+	for (i=0; i<me->pdata.totlayer; i++) {
+		if (me->pdata.layers[i].type == CD_MTEXPOLY) {
+			txface= (MTexPoly*)me->pdata.layers[i].data;
+
+			for (a=0; a<me->totpoly; a++, txface++)
+				if (txface->tpage)
+					id_lib_extern((ID*)txface->tpage);
+		}
+	}
+
 	men->mselect= NULL;
-	men->edit_mesh= NULL;
+	men->edit_btmesh= NULL;
 
 	men->bb= MEM_dupallocN(men->bb);
 	
 	men->key= copy_key(me->key);
-	if(men->key) men->key->from= (ID *)men;
+	if (men->key) men->key->from= (ID *)men;
 
 	return men;
 }
 
+BMesh *BKE_mesh_to_bmesh(Mesh *me, Object *ob)
+{
+	BMesh *bm;
+
+	bm = BM_mesh_create(&bm_mesh_allocsize_default);
+
+	BM_mesh_bm_from_me(bm, me, TRUE, ob->shapenr);
+
+	return bm;
+}
+
 static void expand_local_mesh(Mesh *me)
 {
 	id_lib_extern((ID *)me->texcomesh);
 
-	if(me->mtface) {
-		MTFace *tface;
+	if (me->mtface || me->mtpoly) {
 		int a, i;
 
-		for(i=0; i<me->fdata.totlayer; i++) {
-			if(me->fdata.layers[i].type == CD_MTFACE) {
-				tface= (MTFace*)me->fdata.layers[i].data;
+		for (i=0; i<me->pdata.totlayer; i++) {
+			if (me->pdata.layers[i].type == CD_MTEXPOLY) {
+				MTexPoly *txface= (MTexPoly*)me->fdata.layers[i].data;
+
+				for (a=0; a<me->totpoly; a++, txface++) {
+					/* special case: ima always local immediately */
+					if (txface->tpage) {
+						id_lib_extern((ID *)txface->tpage);
+					}
+				}
+			}
+		}
 
-				for(a=0; a<me->totface; a++, tface++) {
-					if(tface->tpage) {
+		for (i=0; i<me->fdata.totlayer; i++) {
+			if (me->fdata.layers[i].type == CD_MTFACE) {
+				MTFace *tface= (MTFace*)me->fdata.layers[i].data;
+
+				for (a=0; a<me->totface; a++, tface++) {
+					/* special case: ima always local immediately */
+					if (tface->tpage) {
 						id_lib_extern((ID *)tface->tpage);
 					}
 				}
@@ -252,7 +598,7 @@ static void expand_local_mesh(Mesh *me)
 		}
 	}
 
-	if(me->mat) {
+	if (me->mat) {
 		extern_local_matarar(me->mat, me->totcol);
 	}
 }
@@ -268,25 +614,25 @@ void make_local_mesh(Mesh *me)
 	 * - mixed: make copy
 	 */
 
-	if(me->id.lib==NULL) return;
-	if(me->id.us==1) {
+	if (me->id.lib==NULL) return;
+	if (me->id.us==1) {
 		id_clear_lib_data(bmain, &me->id);
 		expand_local_mesh(me);
 		return;
 	}
 
-	for(ob= bmain->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) {
-		if(me == ob->data) {
-			if(ob->id.lib) is_lib= TRUE;
+	for (ob= bmain->object.first; ob && ELEM(0, is_lib, is_local); ob= ob->id.next) {
+		if (me == ob->data) {
+			if (ob->id.lib) is_lib= TRUE;
 			else is_local= TRUE;
 		}
 	}
 
-	if(is_local && is_lib == FALSE) {
+	if (is_local && is_lib == FALSE) {
 		id_clear_lib_data(bmain, &me->id);
 		expand_local_mesh(me);
 	}
-	else if(is_local && is_lib) {
+	else if (is_local && is_lib) {
 		Mesh *me_new= copy_mesh(me);
 		me_new->id.us= 0;
 
@@ -294,9 +640,9 @@ void make_local_mesh(Mesh *me)
 		/* Remap paths of new ID using old library as base. */
 		BKE_id_lib_local_paths(bmain, me->id.lib, &me_new->id);
 
-		for(ob= bmain->object.first; ob; ob= ob->id.next) {
-			if(me == ob->data) {
-				if(ob->id.lib==NULL) {
+		for (ob= bmain->object.first; ob; ob= ob->id.next) {
+			if (me == ob->data) {
+				if (ob->id.lib==NULL) {
 					set_mesh(ob, me_new);
 				}
 			}
@@ -310,14 +656,14 @@ void boundbox_mesh(Mesh *me, float *loc, float *size)
 	float min[3], max[3];
 	float mloc[3], msize[3];
 	
-	if(me->bb==NULL) me->bb= MEM_callocN(sizeof(BoundBox), "boundbox");
+	if (me->bb==NULL) me->bb= MEM_callocN(sizeof(BoundBox), "boundbox");
 	bb= me->bb;
 
 	if (!loc) loc= mloc;
 	if (!size) size= msize;
 	
 	INIT_MINMAX(min, max);
-	if(!minmax_mesh(me, min, max)) {
+	if (!minmax_mesh(me, min, max)) {
 		min[0] = min[1] = min[2] = -1.0f;
 		max[0] = max[1] = max[2] = 1.0f;
 	}
@@ -338,11 +684,11 @@ void tex_space_mesh(Mesh *me)
 
 	boundbox_mesh(me, loc, size);
 
-	if(me->texflag & AUTOSPACE) {
+	if (me->texflag & ME_AUTOSPACE) {
 		for (a=0; a<3; a++) {
-			if(size[a]==0.0f) size[a]= 1.0f;
-			else if(size[a]>0.0f && size[a]<0.00001f) size[a]= 0.00001f;
-			else if(size[a]<0.0f && size[a]> -0.00001f) size[a]= -0.00001f;
+			if (size[a]==0.0f) size[a]= 1.0f;
+			else if (size[a]>0.0f && size[a]<0.00001f) size[a]= 0.00001f;
+			else if (size[a]<0.0f && size[a]> -0.00001f) size[a]= -0.00001f;
 		}
 
 		copy_v3_v3(me->loc, loc);
@@ -355,7 +701,7 @@ BoundBox *mesh_get_bb(Object *ob)
 {
 	Mesh *me= ob->data;
 
-	if(ob->bb)
+	if (ob->bb)
 		return ob->bb;
 
 	if (!me->bb)
@@ -364,15 +710,15 @@ BoundBox *mesh_get_bb(Object *ob)
 	return me->bb;
 }
 
-void mesh_get_texspace(Mesh *me, float *loc_r, float *rot_r, float *size_r)
+void mesh_get_texspace(Mesh *me, float r_loc[3], float r_rot[3], float r_size[3])
 {
 	if (!me->bb) {
 		tex_space_mesh(me);
 	}
 
-	if (loc_r) copy_v3_v3(loc_r, me->loc);
-	if (rot_r) copy_v3_v3(rot_r, me->rot);
-	if (size_r) copy_v3_v3(size_r, me->size);
+	if (r_loc)  copy_v3_v3(r_loc,  me->loc);
+	if (r_rot)  copy_v3_v3(r_rot,  me->rot);
+	if (r_size) copy_v3_v3(r_size, me->size);
 }
 
 float *get_mesh_orco_verts(Object *ob)
@@ -388,7 +734,7 @@ float *get_mesh_orco_verts(Object *ob)
 	mvert = tme->mvert;
 	totvert = MIN2(tme->totvert, me->totvert);
 
-	for(a=0; a<totvert; a++, mvert++) {
+	for (a=0; a<totvert; a++, mvert++) {
 		copy_v3_v3(vcos[a], mvert->co);
 	}
 
@@ -402,14 +748,14 @@ void transform_mesh_orco_verts(Mesh *me, float (*orco)[3], int totvert, int inve
 
 	mesh_get_texspace(me->texcomesh?me->texcomesh:me, loc, NULL, size);
 
-	if(invert) {
-		for(a=0; a<totvert; a++) {
+	if (invert) {
+		for (a=0; a<totvert; a++) {
 			float *co = orco[a];
 			madd_v3_v3v3v3(co, loc, co, size);
 		}
 	}
 	else {
-		for(a=0; a<totvert; a++) {
+		for (a=0; a<totvert; a++) {
 			float *co = orco[a];
 			co[0] = (co[0]-loc[0])/size[0];
 			co[1] = (co[1]-loc[1])/size[1];
@@ -419,20 +765,20 @@ void transform_mesh_orco_verts(Mesh *me, float (*orco)[3], int totvert, int inve
 }
 
 /* rotates the vertices of a face in case v[2] or v[3] (vertex index) is = 0.
-   this is necessary to make the if(mface->v4) check for quads work */
+ * this is necessary to make the if (mface->v4) check for quads work */
 int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr)
 {
 	/* first test if the face is legal */
-	if((mface->v3 || nr==4) && mface->v3==mface->v4) {
+	if ((mface->v3 || nr==4) && mface->v3==mface->v4) {
 		mface->v4= 0;
 		nr--;
 	}
-	if((mface->v2 || mface->v4) && mface->v2==mface->v3) {
+	if ((mface->v2 || mface->v4) && mface->v2==mface->v3) {
 		mface->v3= mface->v4;
 		mface->v4= 0;
 		nr--;
 	}
-	if(mface->v1==mface->v2) {
+	if (mface->v1==mface->v2) {
 		mface->v2= mface->v3;
 		mface->v3= mface->v4;
 		mface->v4= 0;
@@ -440,8 +786,8 @@ int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr)
 	}
 
 	/* check corrupt cases, bowtie geometry, cant handle these because edge data wont exist so just return 0 */
-	if(nr==3) {
-		if(
+	if (nr==3) {
+		if (
 		/* real edges */
 			mface->v1==mface->v2 ||
 			mface->v2==mface->v3 ||
@@ -450,8 +796,8 @@ int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr)
 			return 0;
 		}
 	}
-	else if(nr==4) {
-		if(
+	else if (nr==4) {
+		if (
 		/* real edges */
 			mface->v1==mface->v2 ||
 			mface->v2==mface->v3 ||
@@ -466,25 +812,25 @@ int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr)
 	}
 
 	/* prevent a zero at wrong index location */
-	if(nr==3) {
-		if(mface->v3==0) {
+	if (nr==3) {
+		if (mface->v3==0) {
 			static int corner_indices[4] = {1, 2, 0, 3};
 
 			SWAP(unsigned int, mface->v1, mface->v2);
 			SWAP(unsigned int, mface->v2, mface->v3);
 
-			if(fdata)
+			if (fdata)
 				CustomData_swap(fdata, mfindex, corner_indices);
 		}
 	}
-	else if(nr==4) {
-		if(mface->v3==0 || mface->v4==0) {
+	else if (nr==4) {
+		if (mface->v3==0 || mface->v4==0) {
 			static int corner_indices[4] = {2, 3, 0, 1};
 
 			SWAP(unsigned int, mface->v1, mface->v3);
 			SWAP(unsigned int, mface->v2, mface->v4);
 
-			if(fdata)
+			if (fdata)
 				CustomData_swap(fdata, mfindex, corner_indices);
 		}
 	}
@@ -495,8 +841,8 @@ int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr)
 Mesh *get_mesh(Object *ob)
 {
 	
-	if(ob==NULL) return NULL;
-	if(ob->type==OB_MESH) return ob->data;
+	if (ob==NULL) return NULL;
+	if (ob->type==OB_MESH) return ob->data;
 	else return NULL;
 }
 
@@ -506,9 +852,9 @@ void set_mesh(Object *ob, Mesh *me)
 
 	multires_force_update(ob);
 	
-	if(ob==NULL) return;
+	if (ob==NULL) return;
 	
-	if(ob->type==OB_MESH) {
+	if (ob->type==OB_MESH) {
 		old= ob->data;
 		if (old)
 			old->id.us--;
@@ -533,7 +879,7 @@ static void to_edgesort(struct edgesort *ed,
                         unsigned int v1, unsigned int v2,
                         short is_loose, short is_draw)
 {
-	if(v1<v2) {
+	if (v1<v2) {
 		ed->v1= v1; ed->v2= v2;
 	}
 	else {
@@ -547,48 +893,37 @@ static int vergedgesort(const void *v1, const void *v2)
 {
 	const struct edgesort *x1=v1, *x2=v2;
 
-	if( x1->v1 > x2->v1) return 1;
-	else if( x1->v1 < x2->v1) return -1;
-	else if( x1->v2 > x2->v2) return 1;
-	else if( x1->v2 < x2->v2) return -1;
+	if ( x1->v1 > x2->v1) return 1;
+	else if ( x1->v1 < x2->v1) return -1;
+	else if ( x1->v2 > x2->v2) return 1;
+	else if ( x1->v2 < x2->v2) return -1;
 	
 	return 0;
 }
 
-static void mfaces_strip_loose(MFace *mface, int *totface)
-{
-	int a,b;
-
-	for (a=b=0; a<*totface; a++) {
-		if (mface[a].v3) {
-			if (a!=b) {
-				memcpy(&mface[b],&mface[a],sizeof(mface[b]));
-			}
-			b++;
-		}
-	}
-
-	*totface= b;
-}
 
 /* Create edges based on known verts and faces */
-static void make_edges_mdata(MVert *UNUSED(allvert), MFace *allface, int UNUSED(totvert), int totface,
+static void make_edges_mdata(MVert *UNUSED(allvert), MFace *allface, MLoop *allloop,
+	MPoly *allpoly, int UNUSED(totvert), int totface, int UNUSED(totloop), int totpoly,
 	int old, MEdge **alledge, int *_totedge)
 {
+	MPoly *mpoly;
+	MLoop *mloop;
 	MFace *mface;
 	MEdge *medge;
+	EdgeHash *hash = BLI_edgehash_new();
 	struct edgesort *edsort, *ed;
-	int a, totedge=0, final=0;
+	int a, b, totedge=0, final=0;
 
 	/* we put all edges in array, sort them, and detect doubles that way */
 
-	for(a= totface, mface= allface; a>0; a--, mface++) {
-		if(mface->v4) totedge+=4;
-		else if(mface->v3) totedge+=3;
+	for (a= totface, mface= allface; a>0; a--, mface++) {
+		if (mface->v4) totedge+=4;
+		else if (mface->v3) totedge+=3;
 		else totedge+=1;
 	}
 
-	if(totedge==0) {
+	if (totedge==0) {
 		/* flag that mesh has edges */
 		(*alledge)= MEM_callocN(0, "make mesh edges");
 		(*_totedge) = 0;
@@ -597,14 +932,14 @@ static void make_edges_mdata(MVert *UNUSED(allvert), MFace *allface, int UNUSED(
 
 	ed= edsort= MEM_mallocN(totedge*sizeof(struct edgesort), "edgesort");
 
-	for(a= totface, mface= allface; a>0; a--, mface++) {
+	for (a= totface, mface= allface; a>0; a--, mface++) {
 		to_edgesort(ed++, mface->v1, mface->v2, !mface->v3, mface->edcode & ME_V1V2);
-		if(mface->v4) {
+		if (mface->v4) {
 			to_edgesort(ed++, mface->v2, mface->v3, 0, mface->edcode & ME_V2V3);
 			to_edgesort(ed++, mface->v3, mface->v4, 0, mface->edcode & ME_V3V4);
 			to_edgesort(ed++, mface->v4, mface->v1, 0, mface->edcode & ME_V4V1);
 		}
-		else if(mface->v3) {
+		else if (mface->v3) {
 			to_edgesort(ed++, mface->v2, mface->v3, 0, mface->edcode & ME_V2V3);
 			to_edgesort(ed++, mface->v3, mface->v1, 0, mface->edcode & ME_V3V1);
 		}
@@ -613,26 +948,26 @@ static void make_edges_mdata(MVert *UNUSED(allvert), MFace *allface, int UNUSED(
 	qsort(edsort, totedge, sizeof(struct edgesort), vergedgesort);
 
 	/* count final amount */
-	for(a=totedge, ed=edsort; a>1; a--, ed++) {
+	for (a=totedge, ed=edsort; a>1; a--, ed++) {
 		/* edge is unique when it differs from next edge, or is last */
-		if(ed->v1 != (ed+1)->v1 || ed->v2 != (ed+1)->v2) final++;
+		if (ed->v1 != (ed+1)->v1 || ed->v2 != (ed+1)->v2) final++;
 	}
 	final++;
 
 	(*alledge)= medge= MEM_callocN(sizeof (MEdge) * final, "make_edges mdge");
 	(*_totedge)= final;
 
-	for(a=totedge, ed=edsort; a>1; a--, ed++) {
+	for (a=totedge, ed=edsort; a>1; a--, ed++) {
 		/* edge is unique when it differs from next edge, or is last */
-		if(ed->v1 != (ed+1)->v1 || ed->v2 != (ed+1)->v2) {
+		if (ed->v1 != (ed+1)->v1 || ed->v2 != (ed+1)->v2) {
 			medge->v1= ed->v1;
 			medge->v2= ed->v2;
-			if(old==0 || ed->is_draw) medge->flag= ME_EDGEDRAW|ME_EDGERENDER;
-			if(ed->is_loose) medge->flag|= ME_LOOSEEDGE;
+			if (old==0 || ed->is_draw) medge->flag= ME_EDGEDRAW|ME_EDGERENDER;
+			if (ed->is_loose) medge->flag|= ME_LOOSEEDGE;
 
 			/* order is swapped so extruding this edge as a surface wont flip face normals
 			 * with cyclic curves */
-			if(ed->v1+1 != ed->v2) {
+			if (ed->v1+1 != ed->v2) {
 				SWAP(unsigned int, medge->v1, medge->v2);
 			}
 			medge++;
@@ -646,10 +981,30 @@ static void make_edges_mdata(MVert *UNUSED(allvert), MFace *allface, int UNUSED(
 	medge->v1= ed->v1;
 	medge->v2= ed->v2;
 	medge->flag= ME_EDGEDRAW;
-	if(ed->is_loose) medge->flag|= ME_LOOSEEDGE;
+	if (ed->is_loose) medge->flag|= ME_LOOSEEDGE;
 	medge->flag |= ME_EDGERENDER;
 
 	MEM_freeN(edsort);
+	
+	/*set edge members of mloops*/
+	medge= *alledge;
+	for (a=0; a<*_totedge; a++, medge++) {
+		BLI_edgehash_insert(hash, medge->v1, medge->v2, SET_INT_IN_POINTER(a));
+	}
+	
+	mpoly = allpoly;
+	for (a=0; a<totpoly; a++, mpoly++) {
+		mloop = allloop + mpoly->loopstart;
+		for (b=0; b<mpoly->totloop; b++) {
+			int v1, v2;
+			
+			v1 = mloop[b].v;
+			v2 = ME_POLY_LOOP_NEXT(mloop, mpoly, b)->v;
+			mloop[b].e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(hash, v1, v2));
+		}
+	}
+	
+	BLI_edgehash_free(hash, NULL);
 }
 
 void make_edges(Mesh *me, int old)
@@ -657,8 +1012,8 @@ void make_edges(Mesh *me, int old)
 	MEdge *medge;
 	int totedge=0;
 
-	make_edges_mdata(me->mvert, me->mface, me->totvert, me->totface, old, &medge, &totedge);
-	if(totedge==0) {
+	make_edges_mdata(me->mvert, me->mface, me->mloop, me->mpoly, me->totvert, me->totface, me->totloop, me->totpoly, old, &medge, &totedge);
+	if (totedge==0) {
 		/* flag that mesh has edges */
 		me->medge = medge;
 		me->totedge = 0;
@@ -672,64 +1027,163 @@ void make_edges(Mesh *me, int old)
 	mesh_strip_loose_faces(me);
 }
 
+/* We need to keep this for edge creation (for now?), and some old readfile code... */
 void mesh_strip_loose_faces(Mesh *me)
 {
-	int a,b;
+	MFace *f;
+	int a, b;
 
-	for (a=b=0; a<me->totface; a++) {
-		if (me->mface[a].v3) {
-			if (a!=b) {
-				memcpy(&me->mface[b],&me->mface[a],sizeof(me->mface[b]));
+	for (a = b = 0, f = me->mface; a < me->totface; a++, f++) {
+		if (f->v3) {
+			if (a != b) {
+				memcpy(&me->mface[b], f, sizeof(me->mface[b]));
 				CustomData_copy_data(&me->fdata, &me->fdata, a, b, 1);
-				CustomData_free_elem(&me->fdata, a, 1);
 			}
 			b++;
 		}
 	}
-	me->totface = b;
+	if (a != b) {
+		CustomData_free_elem(&me->fdata, b, a - b);
+		me->totface = b;
+	}
 }
 
-void mesh_strip_loose_edges(Mesh *me)
+/* Works on both loops and polys! */
+/* Note: It won't try to guess which loops of an invalid poly to remove!
+ *       this is the work of the caller, to mark those loops...
+ *       See e.g. BKE_mesh_validate_arrays(). */
+void mesh_strip_loose_polysloops(Mesh *me)
 {
-	int a,b;
+	MPoly *p;
+	MLoop *l;
+	int a, b;
+	/* New loops idx! */
+	int *new_idx = MEM_mallocN(sizeof(int) * me->totloop, __func__);
+
+	for (a = b = 0, p = me->mpoly; a < me->totpoly; a++, p++) {
+		int invalid = FALSE;
+		int i = p->loopstart;
+		int stop = i + p->totloop;
+
+		if (stop > me->totloop || stop < i) {
+			invalid = TRUE;
+		}
+		else {
+			l = &me->mloop[i];
+			i = stop - i;
+			/* If one of the poly's loops is invalid, the whole poly is invalid! */
+			for (; i--; l++) {
+				if (l->e == INVALID_LOOP_EDGE_MARKER) {
+					invalid = TRUE;
+					break;
+				}
+			}
+		}
+
+		if (p->totloop >= 3 && !invalid) {
+			if (a != b) {
+				memcpy(&me->mpoly[b], p, sizeof(me->mpoly[b]));
+				CustomData_copy_data(&me->pdata, &me->pdata, a, b, 1);
+			}
+			b++;
+		}
+	}
+	if (a != b) {
+		CustomData_free_elem(&me->pdata, b, a - b);
+		me->totpoly = b;
+	}
+
+	/* And now, get rid of invalid loops. */
+	for (a = b = 0, l = me->mloop; a < me->totloop; a++, l++) {
+		if (l->e != INVALID_LOOP_EDGE_MARKER) {
+			if (a != b) {
+				memcpy(&me->mloop[b], l, sizeof(me->mloop[b]));
+				CustomData_copy_data(&me->ldata, &me->ldata, a, b, 1);
+			}
+			new_idx[a] = b;
+			b++;
+		}
+		else {
+			/* XXX Theoretically, we should be able to not do this, as no remaining poly
+			 *     should use any stripped loop. But for security's sake... */
+			new_idx[a] = -a;
+		}
+	}
+	if (a != b) {
+		CustomData_free_elem(&me->ldata, b, a - b);
+		me->totloop = b;
+	}
+
+	/* And now, update polys' start loop index. */
+	/* Note: At this point, there should never be any poly using a striped loop! */
+	for (a = 0, p = me->mpoly; a < me->totpoly; a++, p++) {
+		p->loopstart = new_idx[p->loopstart];
+	}
+
+	MEM_freeN(new_idx);
+}
 
-	for (a=b=0; a<me->totedge; a++) {
-		if (me->medge[a].v1!=me->medge[a].v2) {
-			if (a!=b) {
-				memcpy(&me->medge[b],&me->medge[a],sizeof(me->medge[b]));
+void mesh_strip_loose_edges(Mesh *me)
+{
+	MEdge *e;
+	MLoop *l;
+	int a, b;
+	unsigned int *new_idx = MEM_mallocN(sizeof(int) * me->totedge, __func__);
+
+	for (a = b = 0, e = me->medge; a < me->totedge; a++, e++) {
+		if (e->v1 != e->v2) {
+			if (a != b) {
+				memcpy(&me->medge[b], e, sizeof(me->medge[b]));
 				CustomData_copy_data(&me->edata, &me->edata, a, b, 1);
-				CustomData_free_elem(&me->edata, a, 1);
 			}
+			new_idx[a] = b;
 			b++;
 		}
+		else {
+			new_idx[a] = INVALID_LOOP_EDGE_MARKER;
+		}
+	}
+	if (a != b) {
+		CustomData_free_elem(&me->edata, b, a - b);
+		me->totedge = b;
+	}
+
+	/* And now, update loops' edge indices. */
+	/* XXX We hope no loop was pointing to a striped edge!
+	 *     Else, its e will be set to INVALID_LOOP_EDGE_MARKER :/ */
+	for (a = 0, l = me->mloop; a < me->totloop; a++, l++) {
+		l->e = new_idx[l->e];
 	}
-	me->totedge = b;
+
+	MEM_freeN(new_idx);
 }
 
 void mball_to_mesh(ListBase *lb, Mesh *me)
 {
 	DispList *dl;
 	MVert *mvert;
-	MFace *mface;
+	MLoop *mloop, *allloop;
+	MPoly *mpoly;
 	float *nors, *verts;
 	int a, *index;
 	
 	dl= lb->first;
-	if(dl==NULL) return;
+	if (dl==NULL) return;
 
-	if(dl->type==DL_INDEX4) {
-		me->totvert= dl->nr;
-		me->totface= dl->parts;
-		
+	if (dl->type==DL_INDEX4) {
 		mvert= CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, dl->nr);
-		mface= CustomData_add_layer(&me->fdata, CD_MFACE, CD_CALLOC, NULL, dl->parts);
+		allloop= mloop= CustomData_add_layer(&me->ldata, CD_MLOOP, CD_CALLOC, NULL, dl->parts * 4);
+		mpoly= CustomData_add_layer(&me->pdata, CD_MPOLY, CD_CALLOC, NULL, dl->parts);
 		me->mvert= mvert;
-		me->mface= mface;
+		me->mloop= mloop;
+		me->mpoly= mpoly;
+		me->totvert= dl->nr;
+		me->totpoly= dl->parts;
 
 		a= dl->nr;
 		nors= dl->nors;
 		verts= dl->verts;
-		while(a--) {
+		while (a--) {
 			copy_v3_v3(mvert->co, verts);
 			normal_float_to_short_v3(mvert->no, nors);
 			mvert++;
@@ -739,43 +1193,66 @@ void mball_to_mesh(ListBase *lb, Mesh *me)
 		
 		a= dl->parts;
 		index= dl->index;
-		while(a--) {
-			mface->v1= index[0];
-			mface->v2= index[1];
-			mface->v3= index[2];
-			mface->v4= index[3];
-			mface->flag= ME_SMOOTH;
+		while (a--) {
+			int count= index[2] != index[3] ? 4 : 3;
+
+			mloop[0].v= index[0];
+			mloop[1].v= index[1];
+			mloop[2].v= index[2];
+			if (count == 4)
+				mloop[3].v= index[3];
 
-			test_index_face(mface, NULL, 0, (mface->v3==mface->v4)? 3: 4);
+			mpoly->totloop= count;
+			mpoly->loopstart= (int)(mloop - allloop);
+			mpoly->flag= ME_SMOOTH;
 
-			mface++;
+
+			mpoly++;
+			mloop+= count;
+			me->totloop+= count;
 			index+= 4;
 		}
 
-		make_edges(me, 0);	// all edges
-	}	
+		mesh_update_customdata_pointers(me, TRUE);
+
+		mesh_calc_normals(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL);
+
+		BKE_mesh_calc_edges(me, TRUE);
+	}
 }
 
 /* Initialize mverts, medges and, faces for converting nurbs to mesh and derived mesh */
 /* return non-zero on error */
 int nurbs_to_mdata(Object *ob, MVert **allvert, int *totvert,
-	MEdge **alledge, int *totedge, MFace **allface, int *totface)
+	MEdge **alledge, int *totedge, MLoop **allloop, MPoly **allpoly,
+	int *totloop, int *totpoly)
 {
 	return nurbs_to_mdata_customdb(ob, &ob->disp,
-		allvert, totvert, alledge, totedge, allface, totface);
+	                               allvert, totvert,
+	                               alledge, totedge,
+	                               allloop, allpoly,
+	                               totloop, totpoly);
 }
 
+/* BMESH: this doesn't calculate all edges from polygons,
+ * only free standing edges are calculated */
+
 /* Initialize mverts, medges and, faces for converting nurbs to mesh and derived mesh */
 /* use specified dispbase  */
-int nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase, MVert **allvert, int *_totvert,
-	MEdge **alledge, int *_totedge, MFace **allface, int *_totface)
+int nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase,
+                            MVert **allvert, int *_totvert,
+                            MEdge **alledge, int *_totedge,
+                            MLoop **allloop, MPoly **allpoly,
+                            int *_totloop, int *_totpoly)
 {
 	DispList *dl;
 	Curve *cu;
 	MVert *mvert;
-	MFace *mface;
+	MPoly *mpoly;
+	MLoop *mloop;
+	MEdge *medge;
 	float *data;
-	int a, b, ofs, vertcount, startvert, totvert=0, totvlak=0;
+	int a, b, ofs, vertcount, startvert, totvert=0, totedge=0, totloop=0, totvlak=0;
 	int p1, p2, p3, p4, *index;
 	int conv_polys= 0;
 
@@ -786,95 +1263,104 @@ int nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase, MVert **allvert, int
 
 	/* count */
 	dl= dispbase->first;
-	while(dl) {
-		if(dl->type==DL_SEGM) {
+	while (dl) {
+		if (dl->type==DL_SEGM) {
 			totvert+= dl->parts*dl->nr;
-			totvlak+= dl->parts*(dl->nr-1);
+			totedge+= dl->parts*(dl->nr-1);
 		}
-		else if(dl->type==DL_POLY) {
-			if(conv_polys) {
+		else if (dl->type==DL_POLY) {
+			if (conv_polys) {
 				totvert+= dl->parts*dl->nr;
-				totvlak+= dl->parts*dl->nr;
+				totedge+= dl->parts*dl->nr;
 			}
 		}
-		else if(dl->type==DL_SURF) {
+		else if (dl->type==DL_SURF) {
+			int tot;
 			totvert+= dl->parts*dl->nr;
-			totvlak+= (dl->parts-1+((dl->flag & DL_CYCL_V)==2))*(dl->nr-1+(dl->flag & DL_CYCL_U));
+			tot = (dl->parts-1+((dl->flag & DL_CYCL_V)==2))*(dl->nr-1+(dl->flag & DL_CYCL_U));
+			totvlak += tot;
+			totloop += tot * 4;
 		}
-		else if(dl->type==DL_INDEX3) {
+		else if (dl->type==DL_INDEX3) {
+			int tot;
 			totvert+= dl->nr;
-			totvlak+= dl->parts;
+			tot = dl->parts;
+			totvlak+= tot;
+			totloop += tot * 3;
 		}
 		dl= dl->next;
 	}
 
-	if(totvert==0) {
+	if (totvert==0) {
 		/* error("can't convert"); */
 		/* Make Sure you check ob->data is a curve */
 		return -1;
 	}
 
-	*allvert= mvert= MEM_callocN(sizeof (MVert) * totvert, "nurbs_init mvert");
-	*allface= mface= MEM_callocN(sizeof (MFace) * totvlak, "nurbs_init mface");
-
+	*allvert = mvert = MEM_callocN(sizeof(MVert) * totvert, "nurbs_init mvert");
+	*alledge = medge = MEM_callocN(sizeof(MEdge) * totedge, "nurbs_init medge");
+	*allloop = mloop = MEM_callocN(sizeof(MLoop) * totvlak * 4, "nurbs_init mloop"); // totloop
+	*allpoly = mpoly = MEM_callocN(sizeof(MPoly) * totvlak, "nurbs_init mloop");
+	
 	/* verts and faces */
 	vertcount= 0;
 
 	dl= dispbase->first;
-	while(dl) {
+	while (dl) {
 		int smooth= dl->rt & CU_SMOOTH ? 1 : 0;
 
-		if(dl->type==DL_SEGM) {
+		if (dl->type==DL_SEGM) {
 			startvert= vertcount;
 			a= dl->parts*dl->nr;
 			data= dl->verts;
-			while(a--) {
+			while (a--) {
 				copy_v3_v3(mvert->co, data);
 				data+=3;
 				vertcount++;
 				mvert++;
 			}
 
-			for(a=0; a<dl->parts; a++) {
+			for (a=0; a<dl->parts; a++) {
 				ofs= a*dl->nr;
-				for(b=1; b<dl->nr; b++) {
-					mface->v1= startvert+ofs+b-1;
-					mface->v2= startvert+ofs+b;
-					if(smooth) mface->flag |= ME_SMOOTH;
-					mface++;
+				for (b=1; b<dl->nr; b++) {
+					medge->v1= startvert+ofs+b-1;
+					medge->v2= startvert+ofs+b;
+					medge->flag = ME_LOOSEEDGE | ME_EDGERENDER | ME_EDGEDRAW;
+
+					medge++;
 				}
 			}
 
 		}
-		else if(dl->type==DL_POLY) {
-			if(conv_polys) {
+		else if (dl->type==DL_POLY) {
+			if (conv_polys) {
 				startvert= vertcount;
 				a= dl->parts*dl->nr;
 				data= dl->verts;
-				while(a--) {
+				while (a--) {
 					copy_v3_v3(mvert->co, data);
 					data+=3;
 					vertcount++;
 					mvert++;
 				}
 
-				for(a=0; a<dl->parts; a++) {
+				for (a=0; a<dl->parts; a++) {
 					ofs= a*dl->nr;
-					for(b=0; b<dl->nr; b++) {
-						mface->v1= startvert+ofs+b;
-						if(b==dl->nr-1) mface->v2= startvert+ofs;
-						else mface->v2= startvert+ofs+b+1;
-						if(smooth) mface->flag |= ME_SMOOTH;
-						mface++;
+					for (b=0; b<dl->nr; b++) {
+						medge->v1= startvert+ofs+b;
+						if (b==dl->nr-1) medge->v2= startvert+ofs;
+						else medge->v2= startvert+ofs+b+1;
+						medge->flag = ME_LOOSEEDGE | ME_EDGERENDER | ME_EDGEDRAW;
+						medge++;
 					}
 				}
 			}
 		}
-		else if(dl->type==DL_INDEX3) {
+		else if (dl->type==DL_INDEX3) {
 			startvert= vertcount;
 			a= dl->nr;
 			data= dl->verts;
-			while(a--) {
+			while (a--) {
 				copy_v3_v3(mvert->co, data);
 				data+=3;
 				vertcount++;
@@ -883,37 +1369,38 @@ int nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase, MVert **allvert, int
 
 			a= dl->parts;
 			index= dl->index;
-			while(a--) {
-				mface->v1= startvert+index[0];
-				mface->v2= startvert+index[2];
-				mface->v3= startvert+index[1];
-				mface->v4= 0;
-				mface->mat_nr= dl->col;
-				test_index_face(mface, NULL, 0, 3);
-
-				if(smooth) mface->flag |= ME_SMOOTH;
-				mface++;
+			while (a--) {
+				mloop[0].v = startvert+index[0];
+				mloop[1].v = startvert+index[2];
+				mloop[2].v = startvert+index[1];
+				mpoly->loopstart = (int)(mloop - (*allloop));
+				mpoly->totloop = 3;
+				mpoly->mat_nr = dl->col;
+
+				if (smooth) mpoly->flag |= ME_SMOOTH;
+				mpoly++;
+				mloop+= 3;
 				index+= 3;
 			}
 
 
 		}
-		else if(dl->type==DL_SURF) {
+		else if (dl->type==DL_SURF) {
 			startvert= vertcount;
 			a= dl->parts*dl->nr;
 			data= dl->verts;
-			while(a--) {
+			while (a--) {
 				copy_v3_v3(mvert->co, data);
 				data+=3;
 				vertcount++;
 				mvert++;
 			}
 
-			for(a=0; a<dl->parts; a++) {
+			for (a=0; a<dl->parts; a++) {
 
-				if( (dl->flag & DL_CYCL_V)==0 && a==dl->parts-1) break;
+				if ( (dl->flag & DL_CYCL_V)==0 && a==dl->parts-1) break;
 
-				if(dl->flag & DL_CYCL_U) {			/* p2 -> p1 -> */
+				if (dl->flag & DL_CYCL_U) {			/* p2 -> p1 -> */
 					p1= startvert+ dl->nr*a;	/* p4 -> p3 -> */
 					p2= p1+ dl->nr-1;		/* -----> next row */
 					p3= p1+ dl->nr;
@@ -927,21 +1414,23 @@ int nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase, MVert **allvert, int
 					p3= p1+ dl->nr;
 					b= 1;
 				}
-				if( (dl->flag & DL_CYCL_V) && a==dl->parts-1) {
+				if ( (dl->flag & DL_CYCL_V) && a==dl->parts-1) {
 					p3-= dl->parts*dl->nr;
 					p4-= dl->parts*dl->nr;
 				}
 
-				for(; b<dl->nr; b++) {
-					mface->v1= p1;
-					mface->v2= p3;
-					mface->v3= p4;
-					mface->v4= p2;
-					mface->mat_nr= dl->col;
-					test_index_face(mface, NULL, 0, 4);
+				for (; b<dl->nr; b++) {
+					mloop[0].v= p1;
+					mloop[1].v= p3;
+					mloop[2].v= p4;
+					mloop[3].v= p2;
+					mpoly->loopstart = (int)(mloop - (*allloop));
+					mpoly->totloop = 4;
+					mpoly->mat_nr = dl->col;
 
-					if(smooth) mface->flag |= ME_SMOOTH;
-					mface++;
+					if (smooth) mpoly->flag |= ME_SMOOTH;
+					mpoly++;
+					mloop+= 4;
 
 					p4= p3;
 					p3++;
@@ -954,12 +1443,17 @@ int nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase, MVert **allvert, int
 
 		dl= dl->next;
 	}
-
+	
+	*_totpoly= totvlak;
+	*_totloop= totloop;
+	*_totedge= totedge;
 	*_totvert= totvert;
-	*_totface= totvlak;
 
-	make_edges_mdata(*allvert, *allface, totvert, totvlak, 0, alledge, _totedge);
+	/* not uded for bmesh */
+#if 0
+	make_edges_mdata(*allvert, *allface, *allloop, *allpoly, totvert, totvlak, *_totloop, *_totpoly, 0, alledge, _totedge);
 	mfaces_strip_loose(*allface, _totface);
+#endif
 
 	return 0;
 }
@@ -974,13 +1468,14 @@ void nurbs_to_mesh(Object *ob)
 	Curve *cu;
 	MVert *allvert= NULL;
 	MEdge *alledge= NULL;
-	MFace *allface= NULL;
-	int totvert, totedge, totface;
+	MLoop *allloop = NULL;
+	MPoly *allpoly = NULL;
+	int totvert, totedge, totloop, totpoly;
 
 	cu= ob->data;
 
 	if (dm == NULL) {
-		if (nurbs_to_mdata (ob, &allvert, &totvert, &alledge, &totedge, &allface, &totface) != 0) {
+		if (nurbs_to_mdata(ob, &allvert, &totvert, &alledge, &totedge, &allloop, &allpoly, &totloop, &totpoly) != 0) {
 			/* Error initializing */
 			return;
 		}
@@ -988,17 +1483,22 @@ void nurbs_to_mesh(Object *ob)
 		/* make mesh */
 		me= add_mesh("Mesh");
 		me->totvert= totvert;
-		me->totface= totface;
 		me->totedge= totedge;
+		me->totloop = totloop;
+		me->totpoly = totpoly;
 
 		me->mvert= CustomData_add_layer(&me->vdata, CD_MVERT, CD_ASSIGN, allvert, me->totvert);
 		me->medge= CustomData_add_layer(&me->edata, CD_MEDGE, CD_ASSIGN, alledge, me->totedge);
-		me->mface= CustomData_add_layer(&me->fdata, CD_MFACE, CD_ASSIGN, allface, me->totface);
+		me->mloop= CustomData_add_layer(&me->ldata, CD_MLOOP, CD_ASSIGN, allloop, me->totloop);
+		me->mpoly= CustomData_add_layer(&me->pdata, CD_MPOLY, CD_ASSIGN, allpoly, me->totpoly);
 
-		mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
-	} else {
+		mesh_calc_normals(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL);
+
+		BKE_mesh_calc_edges(me, TRUE);
+	}
+	else {
 		me= add_mesh("Mesh");
-		DM_to_mesh(dm, me);
+		DM_to_mesh(dm, me, ob);
 	}
 
 	me->totcol= cu->totcol;
@@ -1009,7 +1509,7 @@ void nurbs_to_mesh(Object *ob)
 	cu->mat= NULL;
 	cu->totcol= 0;
 
-	if(ob->data) {
+	if (ob->data) {
 		free_libblock(&bmain->curve, ob->data);
 	}
 	ob->data= me;
@@ -1017,8 +1517,8 @@ void nurbs_to_mesh(Object *ob)
 
 	/* other users */
 	ob1= bmain->object.first;
-	while(ob1) {
-		if(ob1->data==cu) {
+	while (ob1) {
+		if (ob1->data==cu) {
 			ob1->type= OB_MESH;
 		
 			ob1->data= ob->data;
@@ -1059,10 +1559,10 @@ void mesh_to_curve(Scene *scene, Object *ob)
 
 	MVert *mverts= dm->getVertArray(dm);
 	MEdge *med, *medge= dm->getEdgeArray(dm);
-	MFace *mf,  *mface= dm->getFaceArray(dm);
+	MFace *mf,  *mface= dm->getTessFaceArray(dm);
 
 	int totedge = dm->getNumEdges(dm);
-	int totface = dm->getNumFaces(dm);
+	int totface = dm->getNumTessFaces(dm);
 	int totedges = 0;
 	int i, needsFree = 0;
 
@@ -1086,14 +1586,15 @@ void mesh_to_curve(Scene *scene, Object *ob)
 				BLI_edgehash_insert(eh, mf->v3, mf->v4, NULL);
 			if (!BLI_edgehash_haskey(eh, mf->v4, mf->v1))
 				BLI_edgehash_insert(eh, mf->v4, mf->v1, NULL);
-		} else {
+		}
+		else {
 			if (!BLI_edgehash_haskey(eh, mf->v3, mf->v1))
 				BLI_edgehash_insert(eh, mf->v3, mf->v1, NULL);
 		}
 	}
 
 	med= medge;
-	for(i=0; i<totedge; i++, med++) {
+	for (i=0; i<totedge; i++, med++) {
 		if (!BLI_edgehash_haskey(eh, med->v1, med->v2)) {
 			EdgeLink *edl= MEM_callocN(sizeof(EdgeLink), "EdgeLink");
 
@@ -1106,11 +1607,11 @@ void mesh_to_curve(Scene *scene, Object *ob)
 	BLI_edgehash_free(eh_edge, NULL);
 	BLI_edgehash_free(eh, NULL);
 
-	if(edges.first) {
+	if (edges.first) {
 		Curve *cu = add_curve(ob->id.name+2, OB_CURVE);
 		cu->flag |= CU_3D;
 
-		while(edges.first) {
+		while (edges.first) {
 			/* each iteration find a polyline and add this as a nurbs poly spline */
 
 			ListBase polyline = {NULL, NULL}; /* store a list of VertLink's */
@@ -1125,35 +1626,35 @@ void mesh_to_curve(Scene *scene, Object *ob)
 			appendPolyLineVert(&polyline, endVert);		totpoly++;
 			BLI_freelinkN(&edges, edges.last);			totedges--;
 
-			while(ok) { /* while connected edges are found... */
+			while (ok) { /* while connected edges are found... */
 				ok = FALSE;
 				i= totedges;
-				while(i) {
+				while (i) {
 					EdgeLink *edl;
 
 					i-=1;
 					edl= BLI_findlink(&edges, i);
 					med= edl->edge;
 
-					if(med->v1==endVert) {
+					if (med->v1==endVert) {
 						endVert = med->v2;
 						appendPolyLineVert(&polyline, med->v2);	totpoly++;
 						BLI_freelinkN(&edges, edl);				totedges--;
 						ok= TRUE;
 					}
-					else if(med->v2==endVert) {
+					else if (med->v2==endVert) {
 						endVert = med->v1;
 						appendPolyLineVert(&polyline, endVert);	totpoly++;
 						BLI_freelinkN(&edges, edl);				totedges--;
 						ok= TRUE;
 					}
-					else if(med->v1==startVert) {
+					else if (med->v1==startVert) {
 						startVert = med->v2;
 						prependPolyLineVert(&polyline, startVert);	totpoly++;
 						BLI_freelinkN(&edges, edl);					totedges--;
 						ok= TRUE;
 					}
-					else if(med->v2==startVert) {
+					else if (med->v2==startVert) {
 						startVert = med->v1;
 						prependPolyLineVert(&polyline, startVert);	totpoly++;
 						BLI_freelinkN(&edges, edl);					totedges--;
@@ -1163,7 +1664,7 @@ void mesh_to_curve(Scene *scene, Object *ob)
 			}
 
 			/* Now we have a polyline, make into a curve */
-			if(startVert==endVert) {
+			if (startVert==endVert) {
 				BLI_freelinkN(&polyline, polyline.last);
 				totpoly--;
 				closed = TRUE;
@@ -1216,7 +1717,7 @@ void mesh_to_curve(Scene *scene, Object *ob)
 		ob->derivedFinal = NULL;
 
 		/* curve object could have got bounding box only in special cases */
-		if(ob->bb) {
+		if (ob->bb) {
 			MEM_freeN(ob->bb);
 			ob->bb= NULL;
 		}
@@ -1225,10 +1726,16 @@ void mesh_to_curve(Scene *scene, Object *ob)
 
 void mesh_delete_material_index(Mesh *me, short index)
 {
-	MFace *mf;
 	int i;
 
-	for (i=0, mf=me->mface; i<me->totface; i++, mf++) {
+	for (i=0; i<me->totpoly; i++) {
+		MPoly *mp = &((MPoly*) me->mpoly)[i];
+		if (mp->mat_nr && mp->mat_nr>=index) 
+			mp->mat_nr--;
+	}
+	
+	for (i=0; i<me->totface; i++) {
+		MFace *mf = &((MFace*) me->mface)[i];
 		if (mf->mat_nr && mf->mat_nr>=index) 
 			mf->mat_nr--;
 	}
@@ -1239,30 +1746,175 @@ void mesh_set_smooth_flag(Object *meshOb, int enableSmooth)
 	Mesh *me = meshOb->data;
 	int i;
 
+	for (i=0; i<me->totpoly; i++) {
+		MPoly *mp = &((MPoly*) me->mpoly)[i];
+
+		if (enableSmooth) {
+			mp->flag |= ME_SMOOTH;
+		}
+		else {
+			mp->flag &= ~ME_SMOOTH;
+		}
+	}
+	
 	for (i=0; i<me->totface; i++) {
 		MFace *mf = &((MFace*) me->mface)[i];
 
 		if (enableSmooth) {
 			mf->flag |= ME_SMOOTH;
-		} else {
+		}
+		else {
 			mf->flag &= ~ME_SMOOTH;
 		}
 	}
 }
 
-void mesh_calc_normals(MVert *mverts, int numVerts, MFace *mfaces, int numFaces, float (*faceNors_r)[3]) 
+void mesh_calc_normals_mapping(MVert *mverts, int numVerts,
+                                MLoop *mloop, MPoly *mpolys, int numLoops, int numPolys, float (*polyNors_r)[3],
+                                MFace *mfaces, int numFaces, int *origIndexFace, float (*faceNors_r)[3])
+{
+	mesh_calc_normals_mapping_ex(mverts, numVerts, mloop, mpolys,
+	                              numLoops, numPolys, polyNors_r, mfaces, numFaces,
+	                              origIndexFace, faceNors_r, TRUE);
+}
+
+void mesh_calc_normals_mapping_ex(MVert *mverts, int numVerts,
+                                   MLoop *mloop, MPoly *mpolys,
+                                   int numLoops, int numPolys, float (*polyNors_r)[3],
+                                   MFace *mfaces, int numFaces, int *origIndexFace, float (*faceNors_r)[3],
+                                   const short only_face_normals)
+{
+	float (*pnors)[3] = polyNors_r, (*fnors)[3] = faceNors_r;
+	int i;
+	MFace *mf;
+	MPoly *mp;
+
+	if (numPolys == 0) {
+		return;
+	}
+
+	/* if we are not calculating verts and no verts were passes thene we have nothign to do */
+	if ((only_face_normals == TRUE) && (polyNors_r == NULL) && (faceNors_r == NULL)) {
+		printf("%s: called with nothing to do\n", __func__);
+		return;
+	}
+
+	if (!pnors) pnors = MEM_callocN(sizeof(float) * 3 * numPolys, "poly_nors mesh.c");
+	/* if (!fnors) fnors = MEM_callocN(sizeof(float) * 3 * numFaces, "face nors mesh.c"); */ /* NO NEED TO ALLOC YET */
+
+
+	if (only_face_normals == FALSE) {
+		/* vertex normals are optional, they require some extra calculations,
+		 * so make them optional */
+		mesh_calc_normals(mverts, numVerts, mloop, mpolys, numLoops, numPolys, pnors);
+	}
+	else {
+		/* only calc poly normals */
+		mp = mpolys;
+		for (i=0; i<numPolys; i++, mp++) {
+			mesh_calc_poly_normal(mp, mloop+mp->loopstart, mverts, pnors[i]);
+		}
+	}
+
+	if ( origIndexFace &&
+	     /* fnors==faceNors_r */ /* NO NEED TO ALLOC YET */
+	     fnors != NULL &&
+	     numFaces)
+	{
+		mf = mfaces;
+		for (i=0; i<numFaces; i++, mf++, origIndexFace++) {
+			if (*origIndexFace < numPolys) {
+				copy_v3_v3(fnors[i], pnors[*origIndexFace]);
+			}
+			else {
+				/* eek, we're not corresponding to polys */
+				printf("error in mesh_calc_normals; tessellation face indices are incorrect.  normals may look bad.\n");
+			}
+		}
+	}
+
+	if (pnors != polyNors_r) MEM_freeN(pnors);
+	/* if (fnors != faceNors_r) MEM_freeN(fnors); */ /* NO NEED TO ALLOC YET */
+
+	fnors = pnors = NULL;
+	
+}
+
+void mesh_calc_normals(MVert *mverts, int numVerts, MLoop *mloop, MPoly *mpolys,
+                       int UNUSED(numLoops), int numPolys, float (*polyNors_r)[3])
+{
+	float (*pnors)[3] = polyNors_r;
+
+	float (*tnorms)[3], (*edgevecbuf)[3]= NULL;
+	float **vertcos = NULL, **vertnos = NULL;
+	BLI_array_declare(vertcos);
+	BLI_array_declare(vertnos);
+	BLI_array_declare(edgevecbuf);
+
+	int i, j;
+	MPoly *mp;
+	MLoop *ml;
+
+	if (!pnors) pnors = MEM_callocN(sizeof(float) * 3 * numPolys, "poly_nors mesh.c");
+
+	/*first go through and calculate normals for all the polys*/
+	tnorms = MEM_callocN(sizeof(float)*3*numVerts, "tnorms mesh.c");
+
+	mp = mpolys;
+	for (i=0; i<numPolys; i++, mp++) {
+		mesh_calc_poly_normal(mp, mloop+mp->loopstart, mverts, pnors[i]);
+		ml = mloop + mp->loopstart;
+
+		BLI_array_empty(vertcos);
+		BLI_array_empty(vertnos);
+		BLI_array_growitems(vertcos, mp->totloop);
+		BLI_array_growitems(vertnos, mp->totloop);
+
+		for (j=0; j < mp->totloop; j++) {
+			int vindex = ml[j].v;
+			vertcos[j] = mverts[vindex].co;
+			vertnos[j] = tnorms[vindex];
+		}
+
+		BLI_array_empty(edgevecbuf);
+		BLI_array_growitems(edgevecbuf, mp->totloop);
+
+		accumulate_vertex_normals_poly(vertnos, pnors[i], vertcos, edgevecbuf, mp->totloop);
+	}
+
+	BLI_array_free(vertcos);
+	BLI_array_free(vertnos);
+	BLI_array_free(edgevecbuf);
+
+	/* following Mesh convention; we use vertex coordinate itself for normal in this case */
+	for (i=0; i<numVerts; i++) {
+		MVert *mv= &mverts[i];
+		float *no= tnorms[i];
+
+		if (normalize_v3(no) == 0.0f)
+			normalize_v3_v3(no, mv->co);
+
+		normal_float_to_short_v3(mv->no, no);
+	}
+
+	MEM_freeN(tnorms);
+
+	if (pnors != polyNors_r) MEM_freeN(pnors);
+}
+
+void mesh_calc_normals_tessface(MVert *mverts, int numVerts, MFace *mfaces, int numFaces, float (*faceNors_r)[3])
 {
 	float (*tnorms)[3]= MEM_callocN(numVerts*sizeof(*tnorms), "tnorms");
 	float (*fnors)[3]= (faceNors_r)? faceNors_r: MEM_callocN(sizeof(*fnors)*numFaces, "meshnormals");
 	int i;
 
-	for(i=0; i<numFaces; i++) {
+	for (i=0; i<numFaces; i++) {
 		MFace *mf= &mfaces[i];
 		float *f_no= fnors[i];
 		float *n4 = (mf->v4)? tnorms[mf->v4]: NULL;
 		float *c4 = (mf->v4)? mverts[mf->v4].co: NULL;
 
-		if(mf->v4)
+		if (mf->v4)
 			normal_quad_v3(f_no, mverts[mf->v1].co, mverts[mf->v2].co, mverts[mf->v3].co, mverts[mf->v4].co);
 		else
 			normal_tri_v3(f_no, mverts[mf->v1].co, mverts[mf->v2].co, mverts[mf->v3].co);
@@ -1272,11 +1924,11 @@ void mesh_calc_normals(MVert *mverts, int numVerts, MFace *mfaces, int numFaces,
 	}
 
 	/* following Mesh convention; we use vertex coordinate itself for normal in this case */
-	for(i=0; i<numVerts; i++) {
+	for (i=0; i<numVerts; i++) {
 		MVert *mv= &mverts[i];
 		float *no= tnorms[i];
 		
-		if(normalize_v3(no) == 0.0f)
+		if (normalize_v3(no) == 0.0f)
 			normalize_v3_v3(no, mv->co);
 
 		normal_float_to_short_v3(mv->no, no);
@@ -1284,39 +1936,211 @@ void mesh_calc_normals(MVert *mverts, int numVerts, MFace *mfaces, int numFaces,
 	
 	MEM_freeN(tnorms);
 
-	if(fnors != faceNors_r)
+	if (fnors != faceNors_r)
 		MEM_freeN(fnors);
 }
 
-float (*mesh_getVertexCos(Mesh *me, int *numVerts_r))[3]
-{
-	int i, numVerts = me->totvert;
-	float (*cos)[3] = MEM_mallocN(sizeof(*cos)*numVerts, "vertexcos1");
-
-	if (numVerts_r) *numVerts_r = numVerts;
-	for (i=0; i<numVerts; i++)
-		copy_v3_v3(cos[i], me->mvert[i].co);
-
-	return cos;
-}
 
-UvVertMap *make_uv_vert_map(struct MFace *mface, struct MTFace *tface, unsigned int totface, unsigned int totvert, int selected, float *limit)
+static void bm_corners_to_loops(Mesh *me, int findex, int loopstart, int numTex, int numCol)
+{
+	MTFace *texface;
+	MTexPoly *texpoly;
+	MCol *mcol;
+	MLoopCol *mloopcol;
+	MLoopUV *mloopuv;
+	MFace *mf;
+	int i;
+
+	mf = me->mface + findex;
+
+	for (i=0; i < numTex; i++) {
+		texface = CustomData_get_n(&me->fdata, CD_MTFACE, findex, i);
+		texpoly = CustomData_get_n(&me->pdata, CD_MTEXPOLY, findex, i); 
+		
+		ME_MTEXFACE_CPY(texpoly, texface);
+	
+		mloopuv = CustomData_get_n(&me->ldata, CD_MLOOPUV, loopstart, i);
+		copy_v2_v2(mloopuv->uv, texface->uv[0]); mloopuv++;
+		copy_v2_v2(mloopuv->uv, texface->uv[1]); mloopuv++;
+		copy_v2_v2(mloopuv->uv, texface->uv[2]); mloopuv++;
+
+		if (mf->v4) {
+			copy_v2_v2(mloopuv->uv, texface->uv[3]); mloopuv++;
+		}
+	}
+
+	for (i=0; i < numCol; i++) {
+		mloopcol = CustomData_get_n(&me->ldata, CD_MLOOPCOL, loopstart, i);
+		mcol = CustomData_get_n(&me->fdata, CD_MCOL, findex, i);
+
+		MESH_MLOOPCOL_FROM_MCOL(mloopcol, &mcol[0]); mloopcol++;
+		MESH_MLOOPCOL_FROM_MCOL(mloopcol, &mcol[1]); mloopcol++;
+		MESH_MLOOPCOL_FROM_MCOL(mloopcol, &mcol[2]); mloopcol++;
+		if (mf->v4) {
+			MESH_MLOOPCOL_FROM_MCOL(mloopcol, &mcol[3]); mloopcol++;
+		}
+	}
+	
+	if (CustomData_has_layer(&me->fdata, CD_MDISPS)) {
+		MDisps *ld = CustomData_get(&me->ldata, loopstart, CD_MDISPS);
+		MDisps *fd = CustomData_get(&me->fdata, findex, CD_MDISPS);
+		float (*disps)[3] = fd->disps;
+		int i, tot = mf->v4 ? 4 : 3;
+		int side, corners;
+
+		if (CustomData_external_test(&me->fdata, CD_MDISPS)) {
+			CustomData_external_add(&me->ldata, &me->id, CD_MDISPS,
+									me->totloop, me->fdata.external->filename);
+		}
+		
+		corners = multires_mdisp_corners(fd);
+		
+		if (corners == 0) {
+			/* Empty MDisp layers appear in at least one of the sintel.blend files.
+			 * Not sure why this happens, but it seems fine to just ignore them here.
+			 * If corners==0 for a non-empty layer though, something went wrong. */
+			BLI_assert(fd->totdisp == 0);
+		}
+		else {
+			side = sqrt(fd->totdisp / corners);
+		
+			for (i=0; i<tot; i++, disps += side*side, ld++) {
+				ld->totdisp = side*side;
+				ld->level = (int)(logf(side - 1.0f) / M_LN2) + 1;
+			
+				if (ld->disps)
+					MEM_freeN(ld->disps);
+			
+				ld->disps = MEM_callocN(sizeof(float)*3*side*side, "converted loop mdisps");
+				if (fd->disps) {
+					memcpy(ld->disps, disps, sizeof(float)*3*side*side);
+				}
+			}
+		}
+	}
+}
+
+void BKE_mesh_convert_mfaces_to_mpolys(Mesh *mesh)
+{
+	MFace *mf;
+	MLoop *ml;
+	MPoly *mp;
+	MEdge *me;
+	EdgeHash *eh;
+	int numTex, numCol;
+	int i, j, totloop;
+
+	/* just in case some of these layers are filled in (can happen with python created meshes) */
+	CustomData_free(&mesh->ldata, mesh->totloop);
+	CustomData_free(&mesh->pdata, mesh->totpoly);
+	memset(&mesh->ldata, 0, sizeof(mesh->ldata));
+	memset(&mesh->pdata, 0, sizeof(mesh->pdata));
+
+	mesh->totpoly = mesh->totface;
+	mesh->mpoly = MEM_callocN(sizeof(MPoly)*mesh->totpoly, "mpoly converted");
+	CustomData_add_layer(&mesh->pdata, CD_MPOLY, CD_ASSIGN, mesh->mpoly, mesh->totpoly);
+
+	numTex = CustomData_number_of_layers(&mesh->fdata, CD_MTFACE);
+	numCol = CustomData_number_of_layers(&mesh->fdata, CD_MCOL);
+	
+	totloop = 0;
+	mf = mesh->mface;
+	for (i=0; i<mesh->totface; i++, mf++) {
+		totloop += mf->v4 ? 4 : 3;
+	}
+	
+	mesh->totloop = totloop;
+	mesh->mloop = MEM_callocN(sizeof(MLoop)*mesh->totloop, "mloop converted");
+
+	CustomData_add_layer(&mesh->ldata, CD_MLOOP, CD_ASSIGN, mesh->mloop, totloop);
+	CustomData_to_bmeshpoly(&mesh->fdata, &mesh->pdata, &mesh->ldata,
+		mesh->totloop, mesh->totpoly);
+
+	/* ensure external data is transferred */
+	CustomData_external_read(&mesh->fdata, &mesh->id, CD_MASK_MDISPS, mesh->totface);
+
+	eh = BLI_edgehash_new();
+
+	/*build edge hash*/
+	me = mesh->medge;
+	for (i = 0; i < mesh->totedge; i++, me++) {
+		BLI_edgehash_insert(eh, me->v1, me->v2, SET_INT_IN_POINTER(i));
+
+		/* unrelated but avoid having the FGON flag enabled, so we can reuse it later for something else */
+		me->flag &= ~ME_FGON;
+	}
+
+	j = 0; /*current loop index*/
+	ml = mesh->mloop;
+	mf = mesh->mface;
+	mp = mesh->mpoly;
+	for (i=0; i<mesh->totface; i++, mf++, mp++) {
+		mp->loopstart = j;
+		
+		mp->totloop = mf->v4 ? 4 : 3;
+
+		mp->mat_nr = mf->mat_nr;
+		mp->flag = mf->flag;
+		
+#		define ML(v1, v2) {ml->v = mf->v1; ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(eh, mf->v1, mf->v2)); ml++; j++;}
+		
+		ML(v1, v2);
+		ML(v2, v3);
+		if (mf->v4) {
+			ML(v3, v4);
+			ML(v4, v1);
+		}
+		else {
+			ML(v3, v1);
+		}
+		
+#		undef ML
+
+		bm_corners_to_loops(mesh, i, mp->loopstart, numTex, numCol);
+	}
+
+	/* note, we don't convert FGons at all, these are not even real ngons,
+	 * they have their own UV's, colors etc - its more an editing feature. */
+
+	mesh_update_customdata_pointers(mesh, TRUE);
+
+	BLI_edgehash_free(eh, NULL);
+}
+
+float (*mesh_getVertexCos(Mesh *me, int *numVerts_r))[3]
+{
+	int i, numVerts = me->totvert;
+	float (*cos)[3] = MEM_mallocN(sizeof(*cos)*numVerts, "vertexcos1");
+
+	if (numVerts_r) *numVerts_r = numVerts;
+	for (i=0; i<numVerts; i++)
+		copy_v3_v3(cos[i], me->mvert[i].co);
+
+	return cos;
+}
+
+
+/* ngon version wip, based on EDBM_uv_vert_map_create */
+/* this replaces the non bmesh function (in trunk) which takes MTFace's, if we ever need it back we could
+ * but for now this replaces it because its unused. */
+
+UvVertMap *make_uv_vert_map(struct MPoly *mpoly, struct MLoop *mloop, struct MLoopUV *mloopuv, unsigned int totpoly, unsigned int totvert, int selected, float *limit)
 {
 	UvVertMap *vmap;
 	UvMapVert *buf;
-	MFace *mf;
+	MPoly *mp;
 	unsigned int a;
 	int	i, totuv, nverts;
 
 	totuv = 0;
 
 	/* generate UvMapVert array */
-	mf= mface;
-	for(a=0; a<totface; a++, mf++)
-		if(!selected || (!(mf->flag & ME_HIDE) && (mf->flag & ME_FACE_SEL)))
-			totuv += (mf->v4)? 4: 3;
+	mp= mpoly;
+	for (a=0; a<totpoly; a++, mp++)
+		if (!selected || (!(mp->flag & ME_HIDE) && (mp->flag & ME_FACE_SEL)))
+			totuv += mp->totloop;
 
-	if(totuv==0)
+	if (totuv==0)
 		return NULL;
 	
 	vmap= (UvVertMap*)MEM_callocN(sizeof(*vmap), "UvVertMap");
@@ -1331,47 +2155,47 @@ UvVertMap *make_uv_vert_map(struct MFace *mface, struct MTFace *tface, unsigned
 		return NULL;
 	}
 
-	mf= mface;
-	for(a=0; a<totface; a++, mf++) {
-		if(!selected || (!(mf->flag & ME_HIDE) && (mf->flag & ME_FACE_SEL))) {
-			nverts= (mf->v4)? 4: 3;
+	mp= mpoly;
+	for (a=0; a<totpoly; a++, mp++) {
+		if (!selected || (!(mp->flag & ME_HIDE) && (mp->flag & ME_FACE_SEL))) {
+			nverts= mp->totloop;
 
-			for(i=0; i<nverts; i++) {
+			for (i=0; i<nverts; i++) {
 				buf->tfindex= i;
 				buf->f= a;
 				buf->separate = 0;
-				buf->next= vmap->vert[*(&mf->v1 + i)];
-				vmap->vert[*(&mf->v1 + i)]= buf;
+				buf->next= vmap->vert[mloop[mp->loopstart + i].v];
+				vmap->vert[mloop[mp->loopstart + i].v]= buf;
 				buf++;
 			}
 		}
 	}
 	
 	/* sort individual uvs for each vert */
-	for(a=0; a<totvert; a++) {
+	for (a=0; a<totvert; a++) {
 		UvMapVert *newvlist= NULL, *vlist=vmap->vert[a];
 		UvMapVert *iterv, *v, *lastv, *next;
 		float *uv, *uv2, uvdiff[2];
 
-		while(vlist) {
+		while (vlist) {
 			v= vlist;
 			vlist= vlist->next;
 			v->next= newvlist;
 			newvlist= v;
 
-			uv= tface[v->f].uv[v->tfindex];
+			uv= mloopuv[mpoly[v->f].loopstart + v->tfindex].uv;
 			lastv= NULL;
 			iterv= vlist;
 
-			while(iterv) {
+			while (iterv) {
 				next= iterv->next;
 
-				uv2= tface[iterv->f].uv[iterv->tfindex];
+				uv2= mloopuv[mpoly[iterv->f].loopstart + iterv->tfindex].uv;
 				sub_v2_v2v2(uvdiff, uv2, uv);
 
 
-				if(fabsf(uv[0]-uv2[0]) < limit[0] && fabsf(uv[1]-uv2[1]) < limit[1]) {
-					if(lastv) lastv->next= next;
+				if (fabsf(uv[0]-uv2[0]) < limit[0] && fabsf(uv[1]-uv2[1]) < limit[1]) {
+					if (lastv) lastv->next= next;
 					else vlist= next;
 					iterv->next= newvlist;
 					newvlist= iterv;
@@ -1406,29 +2230,52 @@ void free_uv_vert_map(UvVertMap *vmap)
 }
 
 /* Generates a map where the key is the vertex and the value is a list
-   of faces that use that vertex as a corner. The lists are allocated
-   from one memory pool. */
-void create_vert_face_map(ListBase **map, IndexNode **mem, const MFace *mface, const int totvert, const int totface)
+ * of polys that use that vertex as a corner. The lists are allocated
+ * from one memory pool. */
+void create_vert_poly_map(MeshElemMap **map, int **mem,
+                          const MPoly *mpoly, const MLoop *mloop,
+                          int totvert, int totpoly, int totloop)
 {
-	int i,j;
-	IndexNode *node = NULL;
-	
-	(*map) = MEM_callocN(sizeof(ListBase) * totvert, "vert face map");
-	(*mem) = MEM_callocN(sizeof(IndexNode) * totface*4, "vert face map mem");
-	node = *mem;
-	
+	int i, j;
+	int *indices;
+
+	(*map) = MEM_callocN(sizeof(MeshElemMap) * totvert, "vert poly map");
+	(*mem) = MEM_mallocN(sizeof(int) * totloop, "vert poly map mem");
+
+	/* Count number of polys for each vertex */
+	for (i = 0; i < totpoly; i++) {
+		const MPoly *p = &mpoly[i];
+		
+		for (j = 0; j < p->totloop; j++)
+			(*map)[mloop[p->loopstart + j].v].count++;
+	}
+
+	/* Assign indices mem */
+	indices = (*mem);
+	for (i = 0; i < totvert; i++) {
+		(*map)[i].indices = indices;
+		indices += (*map)[i].count;
+
+		/* Reset 'count' for use as index in last loop */
+		(*map)[i].count = 0;
+	}
+		
 	/* Find the users */
-	for(i = 0; i < totface; ++i){
-		for(j = 0; j < (mface[i].v4?4:3); ++j, ++node) {
-			node->index = i;
-			BLI_addtail(&(*map)[((unsigned int*)(&mface[i]))[j]], node);
+	for (i = 0; i < totpoly; i++) {
+		const MPoly *p = &mpoly[i];
+		
+		for (j = 0; j < p->totloop; j++) {
+			int v = mloop[p->loopstart + j].v;
+			
+			(*map)[v].indices[(*map)[v].count] = i;
+			(*map)[v].count++;
 		}
 	}
 }
 
 /* Generates a map where the key is the vertex and the value is a list
-   of edges that use that vertex as an endpoint. The lists are allocated
-   from one memory pool. */
+ * of edges that use that vertex as an endpoint. The lists are allocated
+ * from one memory pool. */
 void create_vert_edge_map(ListBase **map, IndexNode **mem, const MEdge *medge, const int totvert, const int totedge)
 {
 	int i, j;
@@ -1439,16 +2286,14 @@ void create_vert_edge_map(ListBase **map, IndexNode **mem, const MEdge *medge, c
 	node = *mem;
 
 	/* Find the users */
-	for(i = 0; i < totedge; ++i){
-		for(j = 0; j < 2; ++j, ++node) {
+	for (i = 0; i < totedge; ++i) {
+		for (j = 0; j < 2; ++j, ++node) {
 			node->index = i;
 			BLI_addtail(&(*map)[((unsigned int*)(&medge[i].v1))[j]], node);
 		}
 	}
 }
 
-#ifdef USE_BMESH_FORWARD_COMPAT
-
 void mesh_loops_to_mface_corners(CustomData *fdata, CustomData *ldata,
                                  CustomData *pdata, int lindex[4], int findex,
                                  const int polyindex,
@@ -1457,7 +2302,8 @@ void mesh_loops_to_mface_corners(CustomData *fdata, CustomData *ldata,
                                  /* cache values to avoid lookups every time */
                                  const int numTex, /* CustomData_number_of_layers(pdata, CD_MTEXPOLY) */
                                  const int numCol, /* CustomData_number_of_layers(ldata, CD_MLOOPCOL) */
-                                 const int hasWCol /* CustomData_has_layer(ldata, CD_WEIGHT_MLOOPCOL) */
+                                 const int hasPCol, /* CustomData_has_layer(ldata, CD_PREVIEW_MLOOPCOL) */
+                                 const int hasOrigSpace /* CustomData_has_layer(ldata, CD_ORIGSPACE_MLOOP) */
                                  )
 {
 	MTFace *texface;
@@ -1467,53 +2313,331 @@ void mesh_loops_to_mface_corners(CustomData *fdata, CustomData *ldata,
 	MLoopUV *mloopuv;
 	int i, j;
 	
-	for(i=0; i < numTex; i++){
+	for (i=0; i < numTex; i++) {
 		texface = CustomData_get_n(fdata, CD_MTFACE, findex, i);
 		texpoly = CustomData_get_n(pdata, CD_MTEXPOLY, polyindex, i);
-		
-		texface->tpage = texpoly->tpage;
-		texface->flag = texpoly->flag;
-		texface->transp = texpoly->transp;
-		texface->mode = texpoly->mode;
-		texface->tile = texpoly->tile;
-		texface->unwrap = texpoly->unwrap;
+
+		ME_MTEXFACE_CPY(texface, texpoly);
 
 		for (j=0; j < mf_len; j++) {
 			mloopuv = CustomData_get_n(ldata, CD_MLOOPUV, lindex[j], i);
-			texface->uv[j][0] = mloopuv->uv[0];
-			texface->uv[j][1] = mloopuv->uv[1];
+			copy_v2_v2(texface->uv[j], mloopuv->uv);
 		}
 	}
 
-	for(i=0; i < numCol; i++){
+	for (i=0; i < numCol; i++) {
 		mcol = CustomData_get_n(fdata, CD_MCOL, findex, i);
 
 		for (j=0; j < mf_len; j++) {
 			mloopcol = CustomData_get_n(ldata, CD_MLOOPCOL, lindex[j], i);
-			mcol[j].r = mloopcol->r;
-			mcol[j].g = mloopcol->g;
-			mcol[j].b = mloopcol->b;
-			mcol[j].a = mloopcol->a;
+			MESH_MLOOPCOL_TO_MCOL(mloopcol, &mcol[j]);
+		}
+	}
+
+	if (hasPCol) {
+		mcol = CustomData_get(fdata,  findex, CD_PREVIEW_MCOL);
+
+		for (j=0; j < mf_len; j++) {
+			mloopcol = CustomData_get(ldata, lindex[j], CD_PREVIEW_MLOOPCOL);
+			MESH_MLOOPCOL_TO_MCOL(mloopcol, &mcol[j]);
 		}
 	}
 
-	if (hasWCol) {
-		mcol = CustomData_get(fdata,  findex, CD_WEIGHT_MCOL);
+	if (hasOrigSpace) {
+		OrigSpaceFace *of = CustomData_get(fdata, findex, CD_ORIGSPACE);
+		OrigSpaceLoop *lof;
 
 		for (j=0; j < mf_len; j++) {
-			mloopcol = CustomData_get(ldata, lindex[j], CD_WEIGHT_MLOOPCOL);
-			mcol[j].r = mloopcol->r;
-			mcol[j].g = mloopcol->g;
-			mcol[j].b = mloopcol->b;
-			mcol[j].a = mloopcol->a;
+			lof = CustomData_get(ldata, lindex[j], CD_ORIGSPACE_MLOOP);
+			copy_v2_v2(of->uv[j], lof->uv);
 		}
 	}
 }
 
+/*
+ * this function recreates a tessellation.
+ * returns number of tessellation faces.
+ */
+int mesh_recalcTessellation(CustomData *fdata,
+                           CustomData *ldata, CustomData *pdata,
+                           MVert *mvert, int totface, int UNUSED(totloop),
+                           int totpoly,
+                           /* when tessellating to recalculate normals after
+                            * we can skip copying here */
+                           const int do_face_nor_cpy)
+{
+	/* use this to avoid locking pthread for _every_ polygon
+	 * and calling the fill function */
+
+#define USE_TESSFACE_SPEEDUP
+#define USE_TESSFACE_QUADS // NEEDS FURTHER TESTING
+
+#define TESSFACE_SCANFILL (1<<0)
+#define TESSFACE_IS_QUAD  (1<<1)
+
+	MPoly *mp, *mpoly;
+	MLoop *ml, *mloop;
+	MFace *mface = NULL, *mf;
+	BLI_array_declare(mface);
+	ScanFillContext sf_ctx;
+	ScanFillVert *v, *lastv, *firstv;
+	ScanFillFace *f;
+	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);
+	const int numCol = CustomData_number_of_layers(ldata, CD_MLOOPCOL);
+	const int hasPCol = CustomData_has_layer(ldata, CD_PREVIEW_MLOOPCOL);
+	const int hasOrigSpace = CustomData_has_layer(ldata, CD_ORIGSPACE_MLOOP);
+
+	mpoly = CustomData_get_layer(pdata, CD_MPOLY);
+	mloop = CustomData_get_layer(ldata, CD_MLOOP);
+
+	/* allocate the length of totfaces, avoid many small reallocs,
+	 * if all faces are tri's it will be correct, quads == 2x allocs */
+	BLI_array_reserve(mface_to_poly_map, totpoly);
+	BLI_array_reserve(mface, totpoly);
+
+	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 */
+		}
+
+#ifdef USE_TESSFACE_SPEEDUP
+
+#define ML_TO_MF(i1, i2, i3)                                                  \
+		BLI_array_growone(mface_to_poly_map);                                 \
+		BLI_array_growone(mface);                                             \
+		mface_to_poly_map[mface_index] = poly_index;                          \
+		mf= &mface[mface_index];                                              \
+		/* set loop indices, transformed to vert indices later */             \
+		mf->v1 = mp->loopstart + i1;                                          \
+		mf->v2 = mp->loopstart + i2;                                          \
+		mf->v3 = mp->loopstart + i3;                                          \
+		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) */
+#define ML_TO_MF_QUAD()                                                       \
+		BLI_array_growone(mface_to_poly_map);                                 \
+		BLI_array_growone(mface);                                             \
+		mface_to_poly_map[mface_index] = poly_index;                          \
+		mf= &mface[mface_index];                                              \
+		/* set loop indices, transformed to vert indices later */             \
+		mf->v1 = mp->loopstart + 0; /* EXCEPTION */                           \
+		mf->v2 = mp->loopstart + 1; /* EXCEPTION */                           \
+		mf->v3 = mp->loopstart + 2; /* EXCEPTION */                           \
+		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
+
+
+		else if (mp->totloop == 3) {
+			ML_TO_MF(0, 1, 2);
+			mface_index++;
+		}
+		else if (mp->totloop == 4) {
+#ifdef USE_TESSFACE_QUADS
+			ML_TO_MF_QUAD();
+			mface_index++;
+#else
+			ML_TO_MF(0, 1, 2);
+			mface_index++;
+			ML_TO_MF(0, 2, 3);
+			mface_index++;
+#endif
+		}
+#endif /* USE_TESSFACE_SPEEDUP */
+		else {
+			int totfilltri;
+
+			ml = mloop + mp->loopstart;
+			
+			BLI_begin_edgefill(&sf_ctx);
+			firstv = NULL;
+			lastv = NULL;
+			for (j=0; j<mp->totloop; j++, ml++) {
+				v = BLI_addfillvert(&sf_ctx, mvert[ml->v].co);
+	
+				v->keyindex = mp->loopstart + j;
+	
+				if (lastv)
+					BLI_addfilledge(&sf_ctx, lastv, v);
+	
+				if (!firstv)
+					firstv = v;
+				lastv = v;
+			}
+			BLI_addfilledge(&sf_ctx, lastv, firstv);
+			
+			totfilltri = BLI_edgefill(&sf_ctx, FALSE);
+			if (totfilltri) {
+				BLI_array_growitems(mface_to_poly_map, totfilltri);
+				BLI_array_growitems(mface, totfilltri);
+				if (poly_orig_index) {
+					BLI_array_growitems(mface_orig_index, totfilltri);
+				}
+
+				for (f = sf_ctx.fillfacebase.first; f; f = f->next, mf++) {
+					mface_to_poly_map[mface_index] = poly_index;
+					mf= &mface[mface_index];
+
+					/* set loop indices, transformed to vert indices later */
+					mf->v1 = f->v1->keyindex;
+					mf->v2 = f->v2->keyindex;
+					mf->v3 = f->v3->keyindex;
+					mf->v4 = 0;
+
+					mf->mat_nr = mp->mat_nr;
+					mf->flag = mp->flag;
+
+#ifdef USE_TESSFACE_SPEEDUP
+					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++;
+				}
+			}
+	
+			BLI_end_edgefill(&sf_ctx);
+		}
+	}
+
+	CustomData_free(fdata, totface);
+	memset(fdata, 0, sizeof(CustomData));
+	totface = mface_index;
+
+
+	/* not essential but without this we store over-alloc'd memory in the CustomData layers */
+	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
+	 * 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_from_bmeshpoly(fdata, pdata, ldata, totface);
+
+	if (do_face_nor_cpy) {
+		/* If polys have a normals layer, copying that to faces can help
+		 * avoid the need to recalculate normals later */
+		if (CustomData_has_layer(pdata, CD_NORMAL)) {
+			float (*pnors)[3] = CustomData_get_layer(pdata, CD_NORMAL);
+			float (*fnors)[3] = CustomData_add_layer(fdata, CD_NORMAL, CD_CALLOC, NULL, totface);
+			for (mface_index = 0; mface_index < totface; mface_index++) {
+				copy_v3_v3(fnors[mface_index], pnors[mface_to_poly_map[mface_index]]);
+			}
+		}
+	}
+
+	mf = mface;
+	for (mface_index=0; mface_index < totface; mface_index++, mf++) {
+
+#ifdef USE_TESSFACE_QUADS
+		const int mf_len = mf->edcode & TESSFACE_IS_QUAD ? 4 : 3;
+#endif
+
+#ifdef USE_TESSFACE_SPEEDUP
+		/* skip sorting when not using ngons */
+		if (UNLIKELY(mf->edcode & TESSFACE_SCANFILL))
+#endif
+		{
+			/* sort loop indices to ensure winding is correct */
+			if (mf->v1 > mf->v2) SWAP(int, mf->v1, mf->v2);
+			if (mf->v2 > mf->v3) SWAP(int, mf->v2, mf->v3);
+			if (mf->v1 > mf->v2) SWAP(int, mf->v1, mf->v2);
+
+			if (mf->v1 > mf->v2) SWAP(int, mf->v1, mf->v2);
+			if (mf->v2 > mf->v3) SWAP(int, mf->v2, mf->v3);
+			if (mf->v1 > mf->v2) SWAP(int, mf->v1, mf->v2);
+		}
+
+		/* end abusing the edcode */
+#if defined(USE_TESSFACE_QUADS) || defined(USE_TESSFACE_SPEEDUP)
+		mf->edcode = 0;
+#endif
+
+
+		lindex[0] = mf->v1;
+		lindex[1] = mf->v2;
+		lindex[2] = mf->v3;
+#ifdef USE_TESSFACE_QUADS
+		if (mf_len == 4) lindex[3] = mf->v4;
+#endif
+
+		/*transform loop indices to vert indices*/
+		mf->v1 = mloop[mf->v1].v;
+		mf->v2 = mloop[mf->v2].v;
+		mf->v3 = mloop[mf->v3].v;
+#ifdef USE_TESSFACE_QUADS
+		if (mf_len == 4) mf->v4 = mloop[mf->v4].v;
+#endif
+
+		mesh_loops_to_mface_corners(fdata, ldata, pdata,
+		                            lindex, mface_index, mface_to_poly_map[mface_index],
+#ifdef USE_TESSFACE_QUADS
+		                            mf_len,
+#else
+		                            3,
+#endif
+		                            numTex, numCol, hasPCol, hasOrigSpace);
+
+
+#ifdef USE_TESSFACE_QUADS
+		test_index_face(mf, fdata, mface_index, mf_len);
+#endif
+
+	}
+
+	return totface;
+
+#undef USE_TESSFACE_SPEEDUP
+
+}
+
+
+#ifdef USE_BMESH_SAVE_AS_COMPAT
 
 /*
- * this function recreates a tesselation.
- * returns number of tesselation faces.
+ * this function recreates a tessellation.
+ * returns number of tessellation faces.
  */
 int mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata,
 	struct CustomData *pdata, int totface, int UNUSED(totloop), int totpoly)
@@ -1530,7 +2654,8 @@ int mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata,
 
 	const int numTex = CustomData_number_of_layers(pdata, CD_MTEXPOLY);
 	const int numCol = CustomData_number_of_layers(ldata, CD_MLOOPCOL);
-	const int hasWCol = CustomData_has_layer(ldata, CD_WEIGHT_MLOOPCOL);
+	const int hasPCol = CustomData_has_layer(ldata, CD_PREVIEW_MLOOPCOL);
+	const int hasOrigSpace = CustomData_has_layer(ldata, CD_ORIGSPACE_MLOOP);
 
 	mpoly = CustomData_get_layer(pdata, CD_MPOLY);
 	mloop = CustomData_get_layer(ldata, CD_MLOOP);
@@ -1588,7 +2713,7 @@ int mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata,
 
 				mesh_loops_to_mface_corners(fdata, ldata, pdata,
 				                            lindex, k, i, 3,
-				                            numTex, numCol, hasWCol);
+				                            numTex, numCol, hasPCol, hasOrigSpace);
 				test_index_face(mf, fdata, k, 3);
 			}
 			else {
@@ -1608,7 +2733,7 @@ int mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata,
 
 				mesh_loops_to_mface_corners(fdata, ldata, pdata,
 				                            lindex, k, i, 4,
-				                            numTex, numCol, hasWCol);
+				                            numTex, numCol, hasPCol, hasOrigSpace);
 				test_index_face(mf, fdata, k, 4);
 			}
 
@@ -1620,17 +2745,336 @@ int mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata,
 
 	return k;
 }
+#endif /* USE_BMESH_SAVE_AS_COMPAT */
+
+/*
+ * COMPUTE POLY NORMAL
+ *
+ * Computes the normal of a planar 
+ * polygon See Graphics Gems for 
+ * computing newell normal.
+ *
+ */
+static void mesh_calc_ngon_normal(MPoly *mpoly, MLoop *loopstart, 
+                                  MVert *mvert, float normal[3])
+{
+
+	MVert *v1, *v2, *v3;
+	double u[3], v[3], w[3];
+	double n[3] = {0.0, 0.0, 0.0}, l;
+	int i;
+
+	for (i = 0; i < mpoly->totloop; i++) {
+		v1 = mvert + loopstart[i].v;
+		v2 = mvert + loopstart[(i+1)%mpoly->totloop].v;
+		v3 = mvert + loopstart[(i+2)%mpoly->totloop].v;
+		
+		copy_v3db_v3fl(u, v1->co);
+		copy_v3db_v3fl(v, v2->co);
+		copy_v3db_v3fl(w, v3->co);
+
+		/*this fixes some weird numerical error*/
+		if (i==0) {
+			u[0] += 0.0001f;
+			u[1] += 0.0001f;
+			u[2] += 0.0001f;
+		}
+		
+		/* newell's method
+		 * 
+		 * so thats?:
+		 * (a[1] - b[1]) * (a[2] + b[2]);
+		 * a[1]*b[2] - b[1]*a[2] - b[1]*b[2] + a[1]*a[2]
+		 * 
+		 * odd.  half of that is the cross product. . .what's the
+		 * other half?
+		 * 
+		 * also could be like a[1]*(b[2] + a[2]) - b[1]*(a[2] - b[2])
+		 */
+
+		n[0] += (u[1] - v[1]) * (u[2] + v[2]);
+		n[1] += (u[2] - v[2]) * (u[0] + v[0]);
+		n[2] += (u[0] - v[0]) * (u[1] + v[1]);
+	}
+	
+	l = n[0]*n[0]+n[1]*n[1]+n[2]*n[2];
+	l = sqrt(l);
+
+	if (l == 0.0) {
+		normal[0] = 0.0f;
+		normal[1] = 0.0f;
+		normal[2] = 1.0f;
+
+		return;
+	}
+	else l = 1.0f / l;
+
+	n[0] *= l;
+	n[1] *= l;
+	n[2] *= l;
+	
+	normal[0] = (float) n[0];
+	normal[1] = (float) n[1];
+	normal[2] = (float) n[2];
+}
+
+void mesh_calc_poly_normal(MPoly *mpoly, MLoop *loopstart, 
+                           MVert *mvarray, float no[3])
+{
+	if (mpoly->totloop > 4) {
+		mesh_calc_ngon_normal(mpoly, loopstart, mvarray, no);
+	}
+	else if (mpoly->totloop == 3) {
+		normal_tri_v3(no,
+		              mvarray[loopstart[0].v].co,
+		              mvarray[loopstart[1].v].co,
+		              mvarray[loopstart[2].v].co
+		              );
+	}
+	else if (mpoly->totloop == 4) {
+		normal_quad_v3(no,
+		               mvarray[loopstart[0].v].co,
+		               mvarray[loopstart[1].v].co,
+		               mvarray[loopstart[2].v].co,
+		               mvarray[loopstart[3].v].co
+		               );
+	}
+	else { /* horrible, two sided face! */
+		no[0] = 0.0;
+		no[1] = 0.0;
+		no[2] = 1.0;
+	}
+}
+/* duplicate of function above _but_ takes coords rather then mverts */
+static void mesh_calc_ngon_normal_coords(MPoly *mpoly, MLoop *loopstart,
+                                         const float (*vertex_coords)[3], float normal[3])
+{
 
-#endif /* USE_BMESH_FORWARD_COMPAT */
+	const float *v1, *v2, *v3;
+	double u[3], v[3], w[3];
+	double n[3] = {0.0, 0.0, 0.0}, l;
+	int i;
 
+	for (i = 0; i < mpoly->totloop; i++) {
+		v1 = (const float *)(vertex_coords + loopstart[i].v);
+		v2 = (const float *)(vertex_coords + loopstart[(i+1)%mpoly->totloop].v);
+		v3 = (const float *)(vertex_coords + loopstart[(i+2)%mpoly->totloop].v);
 
+		copy_v3db_v3fl(u, v1);
+		copy_v3db_v3fl(v, v2);
+		copy_v3db_v3fl(w, v3);
+
+		/*this fixes some weird numerical error*/
+		if (i==0) {
+			u[0] += 0.0001f;
+			u[1] += 0.0001f;
+			u[2] += 0.0001f;
+		}
+
+		n[0] += (u[1] - v[1]) * (u[2] + v[2]);
+		n[1] += (u[2] - v[2]) * (u[0] + v[0]);
+		n[2] += (u[0] - v[0]) * (u[1] + v[1]);
+	}
+
+	l = n[0]*n[0]+n[1]*n[1]+n[2]*n[2];
+	l = sqrt(l);
+
+	if (l == 0.0) {
+		normal[0] = 0.0f;
+		normal[1] = 0.0f;
+		normal[2] = 1.0f;
+
+		return;
+	}
+	else {
+		l = 1.0f / l;
+	}
+
+	n[0] *= l;
+	n[1] *= l;
+	n[2] *= l;
+
+	normal[0] = (float) n[0];
+	normal[1] = (float) n[1];
+	normal[2] = (float) n[2];
+}
+
+void mesh_calc_poly_normal_coords(MPoly *mpoly, MLoop *loopstart,
+                           const float (*vertex_coords)[3], float no[3])
+{
+	if (mpoly->totloop > 4) {
+		mesh_calc_ngon_normal_coords(mpoly, loopstart, vertex_coords, no);
+	}
+	else if (mpoly->totloop == 3) {
+		normal_tri_v3(no,
+		              vertex_coords[loopstart[0].v],
+		              vertex_coords[loopstart[1].v],
+		              vertex_coords[loopstart[2].v]
+		              );
+	}
+	else if (mpoly->totloop == 4) {
+		normal_quad_v3(no,
+		               vertex_coords[loopstart[0].v],
+		               vertex_coords[loopstart[1].v],
+		               vertex_coords[loopstart[2].v],
+		               vertex_coords[loopstart[3].v]
+		               );
+	}
+	else { /* horrible, two sided face! */
+		no[0] = 0.0;
+		no[1] = 0.0;
+		no[2] = 1.0;
+	}
+}
+
+static void mesh_calc_ngon_center(MPoly *mpoly, MLoop *loopstart,
+                                  MVert *mvert, float cent[3])
+{
+	const float w= 1.0f / (float)mpoly->totloop;
+	int i;
+
+	zero_v3(cent);
+
+	for (i = 0; i < mpoly->totloop; i++) {
+		madd_v3_v3fl(cent, mvert[(loopstart++)->v].co, w);
+	}
+}
+
+void mesh_calc_poly_center(MPoly *mpoly, MLoop *loopstart,
+                           MVert *mvarray, float cent[3])
+{
+	if (mpoly->totloop == 3) {
+		cent_tri_v3(cent,
+		            mvarray[loopstart[0].v].co,
+		            mvarray[loopstart[1].v].co,
+		            mvarray[loopstart[2].v].co
+		            );
+	}
+	else if (mpoly->totloop == 4) {
+		cent_quad_v3(cent,
+		             mvarray[loopstart[0].v].co,
+		             mvarray[loopstart[1].v].co,
+		             mvarray[loopstart[2].v].co,
+		             mvarray[loopstart[3].v].co
+		             );
+	}
+	else {
+		mesh_calc_ngon_center(mpoly, loopstart, mvarray, cent);
+	}
+}
+
+/* note, passing polynormal is only a speedup so we can skip calculating it */
+float mesh_calc_poly_area(MPoly *mpoly, MLoop *loopstart,
+                          MVert *mvarray, float polynormal[3])
+{
+	if (mpoly->totloop == 3) {
+		return area_tri_v3(mvarray[loopstart[0].v].co,
+		                   mvarray[loopstart[1].v].co,
+		                   mvarray[loopstart[2].v].co
+		                   );
+	}
+	else if (mpoly->totloop == 4) {
+		return area_quad_v3(mvarray[loopstart[0].v].co,
+		                    mvarray[loopstart[1].v].co,
+		                    mvarray[loopstart[2].v].co,
+		                    mvarray[loopstart[3].v].co
+		                    );
+	}
+	else {
+		int i;
+		MLoop *l_iter = loopstart;
+		float area, polynorm_local[3], (*vertexcos)[3];
+		float *no= polynormal ? polynormal : polynorm_local;
+		BLI_array_fixedstack_declare(vertexcos, BM_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++) {
+			copy_v3_v3(vertexcos[i], mvarray[l_iter->v].co);
+		}
+
+		/* need normal for area_poly_v3 as well */
+		if (polynormal == NULL) {
+			mesh_calc_poly_normal(mpoly, loopstart, mvarray, no);
+		}
+
+		/* finally calculate the area */
+		area = area_poly_v3(mpoly->totloop, vertexcos, no);
+
+		BLI_array_fixedstack_free(vertexcos);
+
+		return area;
+	}
+}
+
+/* Find the index of the loop in 'poly' which references vertex,
+ * returns -1 if not found */
+int poly_find_loop_from_vert(const MPoly *poly, const MLoop *loopstart,
+							 unsigned vert)
+{
+	int j;
+	for (j = 0; j < poly->totloop; j++, loopstart++) {
+		if (loopstart->v == vert)
+			return j;
+	}
+	
+	return -1;
+}
+
+/* Fill 'adj_r' with the loop indices in 'poly' adjacent to the
+ * vertex. Returns the index of the loop matching vertex, or -1 if the
+ * vertex is not in 'poly' */
+int poly_get_adj_loops_from_vert(unsigned adj_r[3], const MPoly *poly,
+								 const MLoop *mloop, unsigned vert)
+{
+	int corner = poly_find_loop_from_vert(poly,
+										  &mloop[poly->loopstart],
+										  vert);
+		
+	if (corner != -1) {
+		const MLoop *ml = &mloop[poly->loopstart + corner];
+
+		/* vertex was found */
+		adj_r[0] = ME_POLY_LOOP_PREV(mloop, poly, corner)->v;
+		adj_r[1] = ml->v;
+		adj_r[2] = ME_POLY_LOOP_NEXT(mloop, poly, corner)->v;
+	}
+
+	return corner;
+}
+
+/* update the hide flag for edges and faces from the corresponding
+ * flag in verts */
+void mesh_flush_hidden_from_verts(const MVert *mvert,
+								  const MLoop *mloop,
+								  MEdge *medge, int totedge,
+								  MPoly *mpoly, int totpoly)
+{
+	int i, j;
+	
+	for (i = 0; i < totedge; i++) {
+		MEdge *e = &medge[i];
+		if (mvert[e->v1].flag & ME_HIDE ||
+		   mvert[e->v2].flag & ME_HIDE)
+			e->flag |= ME_HIDE;
+		else
+			e->flag &= ~ME_HIDE;
+	}
+	for (i = 0; i < totpoly; i++) {
+		MPoly *p = &mpoly[i];
+		p->flag &= ~ME_HIDE;
+		for (j = 0; j < p->totloop; j++) {
+			if (mvert[mloop[p->loopstart + j].v].flag & ME_HIDE)
+				p->flag |= ME_HIDE;
+		}
+	}
+}
 
 /* basic vertex data functions */
 int minmax_mesh(Mesh *me, float min[3], float max[3])
 {
 	int i= me->totvert;
 	MVert *mvert;
-	for(mvert= me->mvert; i--; mvert++) {
+	for (mvert= me->mvert; i--; mvert++) {
 		DO_MINMAX(mvert->co, min, max);
 	}
 	
@@ -1642,11 +3086,11 @@ int mesh_center_median(Mesh *me, float cent[3])
 	int i= me->totvert;
 	MVert *mvert;
 	zero_v3(cent);
-	for(mvert= me->mvert; i--; mvert++) {
+	for (mvert= me->mvert; i--; mvert++) {
 		add_v3_v3(cent, mvert->co);
 	}
 	/* otherwise we get NAN for 0 verts */
-	if(me->totvert) {
+	if (me->totvert) {
 		mul_v3_fl(cent, 1.0f/(float)me->totvert);
 	}
 
@@ -1657,7 +3101,7 @@ int mesh_center_bounds(Mesh *me, float cent[3])
 {
 	float min[3], max[3];
 	INIT_MINMAX(min, max);
-	if(minmax_mesh(me, min, max)) {
+	if (minmax_mesh(me, min, max)) {
 		mid_v3_v3v3(cent, min, max);
 		return 1;
 	}
@@ -1669,7 +3113,7 @@ void mesh_translate(Mesh *me, float offset[3], int do_keys)
 {
 	int i= me->totvert;
 	MVert *mvert;
-	for(mvert= me->mvert; i--; mvert++) {
+	for (mvert= me->mvert; i--; mvert++) {
 		add_v3_v3(mvert->co, offset);
 	}
 	
@@ -1687,15 +3131,38 @@ void mesh_translate(Mesh *me, float offset[3], int do_keys)
 
 void BKE_mesh_ensure_navmesh(Mesh *me)
 {
-	if (!CustomData_has_layer(&me->fdata, CD_RECAST)) {
+	if (!CustomData_has_layer(&me->pdata, CD_RECAST)) {
 		int i;
-		int numFaces = me->totface;
-		int* recastData;
-		CustomData_add_layer_named(&me->fdata, CD_RECAST, CD_CALLOC, NULL, numFaces, "recastData");
-		recastData = (int*)CustomData_get_layer(&me->fdata, CD_RECAST);
+		int numFaces = me->totpoly;
+		int *recastData;
+		CustomData_add_layer_named(&me->pdata, CD_RECAST, CD_CALLOC, NULL, numFaces, "recastData");
+		recastData = (int*)CustomData_get_layer(&me->pdata, CD_RECAST);
 		for (i=0; i<numFaces; i++) {
 			recastData[i] = i+1;
 		}
-		CustomData_add_layer_named(&me->fdata, CD_RECAST, CD_REFERENCE, recastData, numFaces, "recastData");
+		CustomData_add_layer_named(&me->pdata, CD_RECAST, CD_REFERENCE, recastData, numFaces, "recastData");
+	}
+}
+
+void BKE_mesh_tessface_calc(Mesh *mesh)
+{
+	mesh->totface = mesh_recalcTessellation(&mesh->fdata, &mesh->ldata, &mesh->pdata,
+	                                       mesh->mvert,
+	                                       mesh->totface, mesh->totloop, mesh->totpoly,
+	                                       /* calc normals right after, don't copy from polys here */
+	                                       FALSE);
+
+	mesh_update_customdata_pointers(mesh, TRUE);
+}
+
+void BKE_mesh_tessface_ensure(Mesh *mesh)
+{
+	if (mesh->totpoly && mesh->totface == 0) {
+		BKE_mesh_tessface_calc(mesh);
 	}
 }
+
+void BKE_mesh_tessface_clear(Mesh *mesh)
+{
+	mesh_tessface_clear_intern(mesh, TRUE);
+}
diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c
index ed9b63f..446ad39 100644
--- a/source/blender/blenkernel/intern/mesh_validate.c
+++ b/source/blender/blenkernel/intern/mesh_validate.c
@@ -33,315 +33,476 @@
 
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
+#include "DNA_object_types.h"
 
 #include "BLO_sys_types.h"
 
-#include "BLI_utildefines.h"
 #include "BLI_edgehash.h"
 #include "BLI_math_base.h"
+#include "BLI_utildefines.h"
 
+#include "BKE_deform.h"
+#include "BKE_depsgraph.h"
 #include "BKE_DerivedMesh.h"
+#include "BKE_mesh.h"
 
 #include "MEM_guardedalloc.h"
 
-#include "BKE_mesh.h"
-#include "BKE_deform.h"
-
 #define SELECT 1
 
-typedef union {
-	uint32_t verts[2];
-	int64_t edval;
-} EdgeUUID;
-
-typedef struct SortFace {
-//	unsigned int	v[4];
-	EdgeUUID		es[4];
-	unsigned int	index;
-} SortFace;
-
-static void edge_store_assign(uint32_t verts[2],  const uint32_t v1, const uint32_t v2)
-{
-	if(v1 < v2) {
-		verts[0]= v1;
-		verts[1]= v2;
-	}
-	else {
-		verts[0]= v2;
-		verts[1]= v1;
-	}
-}
-
-static void edge_store_from_mface_quad(EdgeUUID es[4], MFace *mf)
+/* Used to detect polys (faces) using exactly the same vertices. */
+/* Used to detect loops used by no (disjoint) or more than one (intersect) polys. */
+typedef struct SortPoly {
+	int *verts;
+	int numverts;
+	int loopstart;
+	unsigned int index;
+	int invalid; /* Poly index. */
+} SortPoly;
+
+/* TODO check there is not some standard define of this somewhere! */
+static int int_cmp(const void *v1, const void *v2)
 {
-	edge_store_assign(es[0].verts, mf->v1, mf->v2);
-	edge_store_assign(es[1].verts, mf->v2, mf->v3);
-	edge_store_assign(es[2].verts, mf->v3, mf->v4);
-	edge_store_assign(es[3].verts, mf->v4, mf->v1);
+	return *(int *)v1 > *(int *)v2 ? 1 : *(int *)v1 < *(int *)v2 ? -1 : 0;
 }
 
-static void edge_store_from_mface_tri(EdgeUUID es[4], MFace *mf)
+static int search_poly_cmp(const void *v1, const void *v2)
 {
-	edge_store_assign(es[0].verts, mf->v1, mf->v2);
-	edge_store_assign(es[1].verts, mf->v2, mf->v3);
-	edge_store_assign(es[2].verts, mf->v3, mf->v1);
-	es[3].verts[0] = es[3].verts[1] = UINT_MAX;
+	const SortPoly *sp1 = v1, *sp2 = v2;
+	const int max_idx = sp1->numverts > sp2->numverts ? sp2->numverts : sp1->numverts;
+	int idx = 0;
+
+	/* Reject all invalid polys at end of list! */
+	if (sp1->invalid || sp2->invalid)
+		return sp1->invalid && sp2->invalid ? 0 : sp1->invalid ? 1 : -1;
+	/* Else, sort on first non-egal verts (remember verts of valid polys are sorted). */
+	while (idx < max_idx && sp1->verts[idx] == sp2->verts[idx])
+		idx++;
+	return sp1->verts[idx] > sp2->verts[idx] ? 1 : sp1->verts[idx] < sp2->verts[idx] ? -1 :
+	       sp1->numverts > sp2->numverts ? 1 : sp1->numverts < sp2->numverts ? -1 : 0;
 }
 
-static int int64_cmp(const void *v1, const void *v2)
+static int search_polyloop_cmp(const void *v1, const void *v2)
 {
-	const int64_t x1= *(const int64_t *)v1;
-	const int64_t x2= *(const int64_t *)v2;
-
-	if( x1 > x2 ) return 1;
-	else if( x1 < x2 ) return -1;
-	return 0;
-}
-
-static int search_face_cmp(const void *v1, const void *v2)
-{
-	const SortFace *sfa= v1, *sfb= v2;
-
-	if	(sfa->es[0].edval > sfb->es[0].edval) return 1;
-	else if	(sfa->es[0].edval < sfb->es[0].edval) return -1;
-
-	else if	(sfa->es[1].edval > sfb->es[1].edval) return 1;
-	else if	(sfa->es[1].edval < sfb->es[1].edval) return -1;
-
-	else if	(sfa->es[2].edval > sfb->es[2].edval) return 1;
-	else if	(sfa->es[2].edval < sfb->es[2].edval) return -1;
-
-	else if	(sfa->es[3].edval > sfb->es[3].edval) return 1;
-	else if	(sfa->es[3].edval < sfb->es[3].edval) return -1;
-	else										  return 0;
+	const SortPoly *sp1 = v1, *sp2 = v2;
 
+	/* Reject all invalid polys at end of list! */
+	if (sp1->invalid || sp2->invalid)
+		return sp1->invalid && sp2->invalid ? 0 : sp1->invalid ? 1 : -1;
+	/* Else, sort on loopstart. */
+	return sp1->loopstart > sp2->loopstart ? 1 : sp1->loopstart < sp2->loopstart ? -1 : 0;
 }
 
-#define PRINT if(do_verbose) printf
+#define PRINT if (do_verbose) printf
 
-int BKE_mesh_validate_arrays( Mesh *me,
-                              MVert *mverts, unsigned int totvert,
-                              MEdge *medges, unsigned int totedge,
-                              MFace *mfaces, unsigned int totface,
-                              MDeformVert *dverts, /* assume totvert length */
-                              const short do_verbose, const short do_fixes)
+int BKE_mesh_validate_arrays(Mesh *mesh,
+                             MVert *mverts, unsigned int totvert,
+                             MEdge *medges, unsigned int totedge,
+                             MLoop *mloops, unsigned int totloop,
+                             MPoly *mpolys, unsigned int totpoly,
+                             MDeformVert *dverts, /* assume totvert length */
+                             const short do_verbose, const short do_fixes)
 {
-#	define REMOVE_EDGE_TAG(_med) { _med->v2= _med->v1; do_edge_free= 1; }
-#	define REMOVE_FACE_TAG(_mf) { _mf->v3=0; do_face_free= 1; }
+#   define REMOVE_EDGE_TAG(_me) { _me->v2 = _me->v1; do_edge_free = TRUE; }
+#   define IS_REMOVED_EDGE(_me) (_me->v2 == _me->v1)
 
-//	MVert *mv;
-	MEdge *med;
-	MFace *mf;
-	MFace *mf_prev;
-	MVert *mvert= mverts;
-	unsigned int i;
+#   define REMOVE_LOOP_TAG(_ml) { _ml->e = INVALID_LOOP_EDGE_MARKER; do_polyloop_free = TRUE; }
+#   define REMOVE_POLY_TAG(_mp) { _mp->totloop *= -1; do_polyloop_free = TRUE; }
 
-	short do_face_free= FALSE;
-	short do_edge_free= FALSE;
+	MVert *mv = mverts;
+	MEdge *me;
+	MLoop *ml;
+	MPoly *mp;
+	unsigned int i, j;
+	int *v;
 
-	short verts_fixed= FALSE;
-	short vert_weights_fixed= FALSE;
+	short do_edge_free = FALSE;
+	short do_polyloop_free = FALSE; /* This regroups loops and polys! */
 
-	int do_edge_recalc= FALSE;
+	short verts_fixed = FALSE;
+	short vert_weights_fixed = FALSE;
 
-	EdgeHash *edge_hash = BLI_edgehash_new();
+	int do_edge_recalc = FALSE;
 
-	SortFace *sort_faces= MEM_callocN(sizeof(SortFace) * totface, "search faces");
-	SortFace *sf;
-	SortFace *sf_prev;
-	unsigned int totsortface= 0;
+	EdgeHash *edge_hash = BLI_edgehash_new();
 
-	BLI_assert(!(do_fixes && me == NULL));
+	BLI_assert(!(do_fixes && mesh == NULL));
 
-	PRINT("%s: verts(%u), edges(%u), faces(%u)\n", __func__, totvert, totedge, totface);
+	PRINT("%s: verts(%u), edges(%u), loops(%u), polygons(%u)\n",
+	      __func__, totvert, totedge, totloop, totpoly);
 
-	if(totedge == 0 && totface != 0) {
-		PRINT("    locical error, %u faces and 0 edges\n", totface);
-		do_edge_recalc= TRUE;
+	if (totedge == 0 && totpoly != 0) {
+		PRINT("    logical error, %u polygons and 0 edges\n", totpoly);
+		do_edge_recalc = do_fixes;
 	}
 
-	for(i=1; i<totvert; i++, mvert++) {
+	for (i = 1; i < totvert; i++, mv++) {
 		int j;
-		int fix_normal= TRUE;
+		int fix_normal = TRUE;
 
-		for(j=0; j<3; j++) {
-			if(!finite(mvert->co[j])) {
+		for (j = 0; j < 3; j++) {
+			if (!finite(mv->co[j])) {
 				PRINT("    vertex %u: has invalid coordinate\n", i);
 
 				if (do_fixes) {
-					zero_v3(mvert->co);
+					zero_v3(mv->co);
 
-					verts_fixed= TRUE;
+					verts_fixed = TRUE;
 				}
 			}
 
-			if(mvert->no[j]!=0)
-				fix_normal= FALSE;
+			if (mv->no[j] != 0)
+				fix_normal = FALSE;
 		}
 
-		if(fix_normal) {
+		if (fix_normal) {
 			PRINT("    vertex %u: has zero normal, assuming Z-up normal\n", i);
 			if (do_fixes) {
-				mvert->no[2]= SHRT_MAX;
-				verts_fixed= TRUE;
+				mv->no[2] = SHRT_MAX;
+				verts_fixed = TRUE;
 			}
 		}
 	}
 
-	for(i=0, med= medges; i<totedge; i++, med++) {
-		int remove= FALSE;
-		if(med->v1 == med->v2) {
-			PRINT("    edge %u: has matching verts, both %u\n", i, med->v1);
-			remove= do_fixes;
+	for (i = 0, me = medges; i < totedge; i++, me++) {
+		int remove = FALSE;
+		if (me->v1 == me->v2) {
+			PRINT("    edge %u: has matching verts, both %u\n", i, me->v1);
+			remove = do_fixes;
 		}
-		if(med->v1 >= totvert) {
-			PRINT("    edge %u: v1 index out of range, %u\n", i, med->v1);
-			remove= do_fixes;
+		if (me->v1 >= totvert) {
+			PRINT("    edge %u: v1 index out of range, %u\n", i, me->v1);
+			remove = do_fixes;
 		}
-		if(med->v2 >= totvert) {
-			PRINT("    edge %u: v2 index out of range, %u\n", i, med->v2);
-			remove= do_fixes;
+		if (me->v2 >= totvert) {
+			PRINT("    edge %u: v2 index out of range, %u\n", i, me->v2);
+			remove = do_fixes;
 		}
 
-		if(BLI_edgehash_haskey(edge_hash, med->v1, med->v2)) {
-			PRINT("    edge %u: is a duplicate of, %d\n", i, GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, med->v1, med->v2)));
-			remove= do_fixes;
+		if (BLI_edgehash_haskey(edge_hash, me->v1, me->v2)) {
+			PRINT("    edge %u: is a duplicate of %d\n", i,
+			      GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, me->v1, me->v2)));
+			remove = do_fixes;
 		}
 
-		if(remove == FALSE){
-			BLI_edgehash_insert(edge_hash, med->v1, med->v2, SET_INT_IN_POINTER(i));
+		if (remove == FALSE) {
+			BLI_edgehash_insert(edge_hash, me->v1, me->v2, SET_INT_IN_POINTER(i));
 		}
 		else {
-			REMOVE_EDGE_TAG(med);
+			REMOVE_EDGE_TAG(me);
 		}
 	}
 
-	for(i=0, mf=mfaces, sf=sort_faces; i<totface; i++, mf++) {
-		int remove= FALSE;
-		int fidx;
-		unsigned int fv[4];
-
-		fidx = mf->v4 ? 3:2;
-		do {
-			fv[fidx]= *(&(mf->v1) + fidx);
-			if(fv[fidx] >= totvert) {
-				PRINT("    face %u: 'v%d' index out of range, %u\n", i, fidx + 1, fv[fidx]);
-				remove= do_fixes;
+	/* Checking loops and polys is a bit tricky, as they are quite intricated...
+	 *
+	 * Polys must have:
+	 * - a valid loopstart value.
+	 * - a valid totloop value (>= 3 and loopstart+totloop < me.totloop).
+	 *
+	 * Loops must have:
+	 * - a valid v value.
+	 * - a valid e value (corresponding to the edge it defines with the next loop in poly).
+	 *
+	 * Also, loops not used by polys can be discarded.
+	 * And "intersecting" loops (i.e. loops used by more than one poly) are invalid,
+	 * so be sure to leave at most one poly/loop!
+	 */
+	{
+		SortPoly *sort_polys = MEM_callocN(sizeof(SortPoly) * totpoly, "mesh validate's sort_polys");
+		SortPoly *prev_sp, *sp = sort_polys;
+		int prev_end;
+		for (i = 0, mp = mpolys; i < totpoly; i++, mp++, sp++) {
+			sp->index = i;
+
+			if (mp->loopstart < 0 || mp->totloop < 3) {
+				/* Invalid loop data. */
+				PRINT("    poly %u is invalid (loopstart: %u, totloop: %u)\n", sp->index, mp->loopstart, mp->totloop);
+				sp->invalid = TRUE;
 			}
-		} while (fidx--);
-
-		if(remove == FALSE) {
-			if(mf->v4) {
-				if(mf->v1 == mf->v2) { PRINT("    face %u: verts invalid, v1/v2 both %u\n", i, mf->v1); remove= do_fixes; }
-				if(mf->v1 == mf->v3) { PRINT("    face %u: verts invalid, v1/v3 both %u\n", i, mf->v1); remove= do_fixes;  }
-				if(mf->v1 == mf->v4) { PRINT("    face %u: verts invalid, v1/v4 both %u\n", i, mf->v1); remove= do_fixes;  }
-
-				if(mf->v2 == mf->v3) { PRINT("    face %u: verts invalid, v2/v3 both %u\n", i, mf->v2); remove= do_fixes;  }
-				if(mf->v2 == mf->v4) { PRINT("    face %u: verts invalid, v2/v4 both %u\n", i, mf->v2); remove= do_fixes;  }
-
-				if(mf->v3 == mf->v4) { PRINT("    face %u: verts invalid, v3/v4 both %u\n", i, mf->v3); remove= do_fixes;  }
+			else if (mp->loopstart + mp->totloop > totloop) {
+				/* Invalid loop data. */
+				PRINT("    poly %u uses loops out of range (loopstart: %u, loopend: %u, max nbr of loops: %u)\n",
+				      sp->index, mp->loopstart, mp->loopstart + mp->totloop - 1, totloop - 1);
+				sp->invalid = TRUE;
 			}
 			else {
-				if(mf->v1 == mf->v2) { PRINT("    faceT %u: verts invalid, v1/v2 both %u\n", i, mf->v1); remove= do_fixes; }
-				if(mf->v1 == mf->v3) { PRINT("    faceT %u: verts invalid, v1/v3 both %u\n", i, mf->v1); remove= do_fixes; }
+				/* Poly itself is valid, for now. */
+				int v1, v2; /* v1 is prev loop vert idx, v2 is current loop one. */
+				sp->invalid = FALSE;
+				sp->verts = v = MEM_mallocN(sizeof(int) * mp->totloop, "Vert idx of SortPoly");
+				sp->numverts = mp->totloop;
+				sp->loopstart = mp->loopstart;
+
+				/* Test all poly's loops' vert idx. */
+				for (j = 0, ml = &mloops[sp->loopstart]; j < mp->totloop; j++, ml++, v++) {
+					if (ml->v >= totvert) {
+						/* Invalid vert idx. */
+						PRINT("    loop %u has invalid vert reference (%u)\n", sp->loopstart + j, ml->v);
+						sp->invalid = TRUE;
+					}
 
-				if(mf->v2 == mf->v3) { PRINT("    faceT %u: verts invalid, v2/v3 both %u\n", i, mf->v2); remove= do_fixes; }
-			}
+					mverts[ml->v].flag |= ME_VERT_TMP_TAG;
+					*v = ml->v;
+				}
 
-			if(remove == FALSE) {
-				if(totedge) {
-					if(mf->v4) {
-						if(!BLI_edgehash_haskey(edge_hash, mf->v1, mf->v2)) { PRINT("    face %u: edge v1/v2 (%u,%u) is missing egde data\n", i, mf->v1, mf->v2); do_edge_recalc= TRUE; }
-						if(!BLI_edgehash_haskey(edge_hash, mf->v2, mf->v3)) { PRINT("    face %u: edge v2/v3 (%u,%u) is missing egde data\n", i, mf->v2, mf->v3); do_edge_recalc= TRUE; }
-						if(!BLI_edgehash_haskey(edge_hash, mf->v3, mf->v4)) { PRINT("    face %u: edge v3/v4 (%u,%u) is missing egde data\n", i, mf->v3, mf->v4); do_edge_recalc= TRUE; }
-						if(!BLI_edgehash_haskey(edge_hash, mf->v4, mf->v1)) { PRINT("    face %u: edge v4/v1 (%u,%u) is missing egde data\n", i, mf->v4, mf->v1); do_edge_recalc= TRUE; }
+				/* is the same vertex used more then once */
+				if (!sp->invalid) {
+					v = sp->verts;
+					for (j = 0; j < mp->totloop; j++, v++) {
+						if ((mverts[*v].flag & ME_VERT_TMP_TAG) == 0) {
+							PRINT("    poly %u has duplicate vert reference at corner (%u)\n", i, j);
+							sp->invalid = TRUE;
+						}
+						mverts[*v].flag &= ~ME_VERT_TMP_TAG;
+					}
+				}
+
+				if (sp->invalid)
+					continue;
+
+				/* Test all poly's loops. */
+				for (j = 0, ml = &mloops[sp->loopstart]; j < mp->totloop; j++, ml++) {
+					v1 = ml->v;
+					v2 = mloops[sp->loopstart + (j + 1) % mp->totloop].v;
+					if (!BLI_edgehash_haskey(edge_hash, v1, v2)) {
+						/* Edge not existing. */
+						PRINT("    poly %u needs missing edge (%u, %u)\n", sp->index, v1, v2);
+						if (do_fixes)
+							do_edge_recalc = TRUE;
+						else
+							sp->invalid = TRUE;
+					}
+					else if (ml->e >= totedge) {
+						/* Invalid edge idx.
+						 * We already know from previous text that a valid edge exists, use it (if allowed)! */
+						if (do_fixes) {
+							int prev_e = ml->e;
+							ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, v1, v2));
+							PRINT("    loop %u has invalid edge reference (%u), fixed using edge %u\n",
+							      sp->loopstart + j, prev_e, ml->e);
+						}
+						else {
+							PRINT("    loop %u has invalid edge reference (%u)\n", sp->loopstart + j, ml->e);
+							sp->invalid = TRUE;
+						}
 					}
 					else {
-						if(!BLI_edgehash_haskey(edge_hash, mf->v1, mf->v2)) { PRINT("    face %u: edge v1/v2 (%u,%u) is missing egde data\n", i, mf->v1, mf->v2); do_edge_recalc= TRUE; }
-						if(!BLI_edgehash_haskey(edge_hash, mf->v2, mf->v3)) { PRINT("    face %u: edge v2/v3 (%u,%u) is missing egde data\n", i, mf->v2, mf->v3); do_edge_recalc= TRUE; }
-						if(!BLI_edgehash_haskey(edge_hash, mf->v3, mf->v1)) { PRINT("    face %u: edge v3/v1 (%u,%u) is missing egde data\n", i, mf->v3, mf->v1); do_edge_recalc= TRUE; }
+						me = &medges[ml->e];
+						if (IS_REMOVED_EDGE(me) || !((me->v1 == v1 && me->v2 == v2) || (me->v1 == v2 && me->v2 == v1))) {
+							/* The pointed edge is invalid (tagged as removed, or vert idx mismatch),
+							 * and we already know from previous test that a valid one exists, use it (if allowed)! */
+							if (do_fixes) {
+								int prev_e = ml->e;
+								ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(edge_hash, v1, v2));
+								PRINT("    poly %u has invalid edge reference (%u), fixed using edge %u\n",
+								      sp->index, prev_e, ml->e);
+							}
+							else {
+								PRINT("    poly %u has invalid edge reference (%u)\n", sp->index, ml->e);
+								sp->invalid = TRUE;
+							}
+						}
 					}
 				}
 
-				sf->index = i;
-
-				if(mf->v4) {
-					edge_store_from_mface_quad(sf->es, mf);
+				/* Now check that that poly does not use a same vertex more than once! */
+				if (!sp->invalid) {
+					int *prev_v = v = sp->verts;
+					j = sp->numverts;
+
+					qsort(sp->verts, j, sizeof(int), int_cmp);
+
+					for (j--, v++; j; j--, v++) {
+						if (*v != *prev_v) {
+							int dlt = v - prev_v;
+							if (dlt > 1) {
+								PRINT("    poly %u is invalid, it multi-uses vertex %u (%u times)\n",
+								      sp->index, *prev_v, dlt);
+								sp->invalid = TRUE;
+							}
+							prev_v = v;
+						}
+					}
+					if (v - prev_v > 1) { /* Don't forget final verts! */
+						PRINT("    poly %u is invalid, it multi-uses vertex %u (%u times)\n",
+						      sp->index, *prev_v, (int)(v - prev_v));
+						sp->invalid = TRUE;
+					}
+				}
+			
+			}
+		}
 
-					qsort(sf->es, 4, sizeof(int64_t), int64_cmp);
+		/* Second check pass, testing polys using the same verts. */
+		qsort(sort_polys, totpoly, sizeof(SortPoly), search_poly_cmp);
+		sp = prev_sp = sort_polys;
+		sp++;
+
+		for (i = 1; i < totpoly; i++, sp++) {
+			int p1_nv = sp->numverts, p2_nv = prev_sp->numverts;
+			int *p1_v = sp->verts, *p2_v = prev_sp->verts;
+			short p1_sub = TRUE, p2_sub = TRUE;
+			if (sp->invalid)
+				break;
+			/* Test same polys. */
+#if 0
+			/* NOTE: This performs a sub-set test. */
+			/* XXX This (and the sort of verts list) is better than systematic
+			 *     search of all verts of one list into the other if lists have
+			 *     a fair amount of elements.
+			 *     Not sure however it's worth it in this case?
+			 *     But as we also need sorted vert list to check verts multi-used
+			 *     (in first pass of checks)... */
+			/* XXX If we consider only "equal" polys (i.e. using exactly same set of verts)
+			 *     as invalid, better to replace this by a simple memory cmp... */
+			while ((p1_nv && p2_nv) && (p1_sub || p2_sub)) {
+				if (*p1_v < *p2_v) {
+					if (p1_sub)
+						p1_sub = FALSE;
+					p1_nv--;
+					p1_v++;
+				}
+				else if (*p2_v < *p1_v) {
+					if (p2_sub)
+						p2_sub = FALSE;
+					p2_nv--;
+					p2_v++;
 				}
 				else {
-					edge_store_from_mface_tri(sf->es, mf);
-					qsort(sf->es, 3, sizeof(int64_t), int64_cmp);
+					/* Equality, both next verts. */
+					p1_nv--;
+					p2_nv--;
+					p1_v++;
+					p2_v++;
 				}
-
-				totsortface++;
-				sf++;
+			}
+			if (p1_nv && p1_sub)
+				p1_sub = FALSE;
+			else if (p2_nv && p2_sub)
+				p2_sub = FALSE;
+
+			if (p1_sub && p2_sub) {
+				PRINT("    polys %u and %u use same vertices, considering poly %u as invalid.\n",
+				      prev_sp->index, sp->index, sp->index);
+				sp->invalid = TRUE;
+			}
+			/* XXX In fact, these might be valid? :/ */
+			else if (p1_sub) {
+				PRINT("    %u is a sub-poly of %u, considering it as invalid.\n", sp->index, prev_sp->index);
+				sp->invalid = TRUE;
+			}
+			else if (p2_sub) {
+				PRINT("    %u is a sub-poly of %u, considering it as invalid.\n", prev_sp->index, sp->index);
+				prev_sp->invalid = TRUE;
+				prev_sp = sp; /* sp is new reference poly. */
+			}
+#else
+			if (0) {
+				p1_sub += 0;
+				p2_sub += 0;
+			}
+			if ((p1_nv == p2_nv) && (memcmp(p1_v, p2_v, p1_nv * sizeof(*p1_v)) == 0)) {
+				if (do_verbose) {
+					PRINT("    polys %u and %u use same vertices (%u",
+					      prev_sp->index, sp->index, *p1_v);
+					for (j = 1; j < p1_nv; j++)
+						PRINT(", %u", p1_v[j]);
+					PRINT("), considering poly %u as invalid.\n", sp->index);
+				}
+				sp->invalid = TRUE;
+			}
+#endif
+			else {
+				prev_sp = sp;
 			}
 		}
-		if(remove) {
-			REMOVE_FACE_TAG(mf);
-		}
-	}
-
-	qsort(sort_faces, totsortface, sizeof(SortFace), search_face_cmp);
-
-	sf= sort_faces;
-	sf_prev= sf;
-	sf++;
 
-	for(i=1; i<totsortface; i++, sf++) {
-		int remove= FALSE;
-		/* on a valid mesh, code below will never run */
-		if(memcmp(sf->es, sf_prev->es, sizeof(sf_prev->es)) == 0) {
-			mf= mfaces + sf->index;
-
-			if(do_verbose) {
-				mf_prev= mfaces + sf_prev->index;
-				if(mf->v4) {
-					PRINT("    face %u & %u: are duplicates (%u,%u,%u,%u) (%u,%u,%u,%u)\n", sf->index, sf_prev->index, mf->v1, mf->v2, mf->v3, mf->v4, mf_prev->v1, mf_prev->v2, mf_prev->v3, mf_prev->v4);
+		/* Third check pass, testing loops used by none or more than one poly. */
+		qsort(sort_polys, totpoly, sizeof(SortPoly), search_polyloop_cmp);
+		sp = sort_polys;
+		prev_sp = NULL;
+		prev_end = 0;
+		for (i = 0; i < totpoly; i++, sp++) {
+			/* Free this now, we don't need it anymore, and avoid us another loop! */
+			if (sp->verts)
+				MEM_freeN(sp->verts);
+
+			/* Note above prev_sp: in following code, we make sure it is always valid poly (or NULL). */
+			if (sp->invalid) {
+				if (do_fixes) {
+					REMOVE_POLY_TAG((&mpolys[sp->index]));
+					/* DO NOT REMOVE ITS LOOPS!!!
+					 * As already invalid polys are at the end of the SortPoly list, the loops they
+					 * were the only users have already been tagged as "to remove" during previous
+					 * iterations, and we don't want to remove some loops that may be used by
+					 * another valid poly! */
+				}
+			}
+			/* Test loops users. */
+			else {
+				/* Unused loops. */
+				if (prev_end < sp->loopstart) {
+					for (j = prev_end, ml = &mloops[prev_end]; j < sp->loopstart; j++, ml++) {
+						PRINT("    loop %u is unused.\n", j);
+						if (do_fixes)
+							REMOVE_LOOP_TAG(ml);
+					}
+					prev_end = sp->loopstart + sp->numverts;
+					prev_sp = sp;
+				}
+				/* Multi-used loops. */
+				else if (prev_end > sp->loopstart) {
+					PRINT("    polys %u and %u share loops from %u to %u, considering poly %u as invalid.\n",
+					      prev_sp->index, sp->index, sp->loopstart, prev_end, sp->index);
+					if (do_fixes) {
+						REMOVE_POLY_TAG((&mpolys[sp->index]));
+						/* DO NOT REMOVE ITS LOOPS!!!
+						 * They might be used by some next, valid poly!
+						 * Just not updating prev_end/prev_sp vars is enough to ensure the loops
+						 * effectively no more needed will be marked as "to be removed"! */
+					}
 				}
 				else {
-					PRINT("    face %u & %u: are duplicates (%u,%u,%u) (%u,%u,%u)\n", sf->index, sf_prev->index, mf->v1, mf->v2, mf->v3, mf_prev->v1, mf_prev->v2, mf_prev->v3);
+					prev_end = sp->loopstart + sp->numverts;
+					prev_sp = sp;
 				}
 			}
-
-			remove= do_fixes;
 		}
-		else {
-			sf_prev= sf;
+		/* We may have some remaining unused loops to get rid of! */
+		if (prev_end < totloop) {
+			for (j = prev_end, ml = &mloops[prev_end]; j < totloop; j++, ml++) {
+				PRINT("    loop %u is unused.\n", j);
+				if (do_fixes)
+					REMOVE_LOOP_TAG(ml);
+			}
 		}
 
-		if(remove) {
-			REMOVE_FACE_TAG(mf);
-		}
+		MEM_freeN(sort_polys);
 	}
 
 	BLI_edgehash_free(edge_hash, NULL);
-	MEM_freeN(sort_faces);
-
 
 	/* fix deform verts */
 	if (dverts) {
 		MDeformVert *dv;
-		for(i=0, dv= dverts; i<totvert; i++, 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++) {
+			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 */
 				if (!finite(dw->weight)) {
 					PRINT("    vertex deform %u, group %d has weight: %f\n", i, dw->def_nr, dw->weight);
 					if (do_fixes) {
-						dw->weight= 0.0f;
-						vert_weights_fixed= TRUE;
+						dw->weight = 0.0f;
+						vert_weights_fixed = TRUE;
 					}
 				}
 				else if (dw->weight < 0.0f || dw->weight > 1.0f) {
 					PRINT("    vertex deform %u, group %d has weight: %f\n", i, dw->def_nr, dw->weight);
 					if (do_fixes) {
 						CLAMP(dw->weight, 0.0f, 1.0f);
-						vert_weights_fixed= TRUE;
+						vert_weights_fixed = TRUE;
 					}
 				}
 
@@ -353,9 +514,9 @@ int BKE_mesh_validate_arrays( Mesh *me,
 							/* re-allocated, the new values compensate for stepping
 							 * within the for loop and may not be valid */
 							j--;
-							dw= dv->dw + j;
+							dw = dv->dw + j;
 
-							vert_weights_fixed= TRUE;
+							vert_weights_fixed = TRUE;
 						}
 						else { /* all freed */
 							break;
@@ -366,49 +527,50 @@ int BKE_mesh_validate_arrays( Mesh *me,
 		}
 	}
 
-
 	PRINT("BKE_mesh_validate: finished\n\n");
 
-#	 undef REMOVE_EDGE_TAG
-#	 undef REMOVE_FACE_TAG
+#   undef REMOVE_EDGE_TAG
+#   undef IS_REMOVED_EDGE
+#   undef REMOVE_LOOP_TAG
+#   undef REMOVE_POLY_TAG
 
-	if(me) {
-		if(do_face_free) {
-			mesh_strip_loose_faces(me);
+	if (mesh) {
+		if (do_polyloop_free) {
+			mesh_strip_loose_polysloops(mesh);
 		}
 
 		if (do_edge_free) {
-			mesh_strip_loose_edges(me);
+			mesh_strip_loose_edges(mesh);
 		}
 
-		if(do_fixes && do_edge_recalc) {
-			BKE_mesh_calc_edges(me, TRUE);
+		if (do_edge_recalc) {
+			BKE_mesh_calc_edges(mesh, TRUE);
 		}
 	}
 
-	return (verts_fixed || vert_weights_fixed || do_face_free || do_edge_free || do_edge_recalc);
+	return (verts_fixed || vert_weights_fixed || do_polyloop_free || do_edge_free || do_edge_recalc);
 }
 
 static int mesh_validate_customdata(CustomData *data, short do_verbose, const short do_fixes)
 {
-	int i= 0, has_fixes= 0;
+	int i = 0, has_fixes = 0;
 
-	while(i<data->totlayer) {
-		CustomDataLayer *layer= &data->layers[i];
-		CustomDataMask mask= CD_TYPE_AS_MASK(layer->type);
-		int ok= 1;
+	while (i < data->totlayer) {
+		CustomDataLayer *layer = &data->layers[i];
+		CustomDataMask mask = CD_TYPE_AS_MASK(layer->type);
+		int ok = 1;
 
-		if((mask&CD_MASK_MESH)==0) {
+		if ((mask & CD_MASK_MESH) == 0) {
 			PRINT("CustomDataLayer type %d which isn't in CD_MASK_MESH is stored in Mehs structure\n", layer->type);
 
-			if(do_fixes) {
+			if (do_fixes) {
 				CustomData_free_layer(data, layer->type, 0, i);
-				ok= 0;
-				has_fixes= 1;
+				ok = 0;
+				has_fixes = 1;
 			}
 		}
 
-		if(ok)
+		if (ok)
 			i++;
 	}
 
@@ -417,35 +579,42 @@ static int mesh_validate_customdata(CustomData *data, short do_verbose, const sh
 
 #undef PRINT
 
-static int BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata, CustomData *fdata,
+static int BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata,
+                                            CustomData *ldata, CustomData *pdata,
                                             short do_verbose, const short do_fixes)
 {
-	int vfixed= 0, efixed= 0, ffixed= 0;
+	int vfixed = 0, efixed = 0, lfixed = 0, pfixed = 0;
 
-	vfixed= mesh_validate_customdata(vdata, do_verbose, do_fixes);
-	efixed= mesh_validate_customdata(edata, do_verbose, do_fixes);
-	ffixed= mesh_validate_customdata(fdata, do_verbose, do_fixes);
+	vfixed = mesh_validate_customdata(vdata, do_verbose, do_fixes);
+	efixed = mesh_validate_customdata(edata, do_verbose, do_fixes);
+	lfixed = mesh_validate_customdata(ldata, do_verbose, do_fixes);
+	pfixed = mesh_validate_customdata(pdata, do_verbose, do_fixes);
 
-	return vfixed || efixed || ffixed;
+	return vfixed || efixed || lfixed || pfixed;
 }
 
 int BKE_mesh_validate(Mesh *me, int do_verbose)
 {
-	int layers_fixed= 0, arrays_fixed= 0;
+	int layers_fixed = 0, arrays_fixed = 0;
 
-	if(do_verbose) {
-		printf("MESH: %s\n", me->id.name+2);
+	if (do_verbose) {
+		printf("MESH: %s\n", me->id.name + 2);
 	}
 
-	layers_fixed= BKE_mesh_validate_all_customdata(&me->vdata, &me->edata, &me->fdata, do_verbose, TRUE);
-	arrays_fixed= BKE_mesh_validate_arrays(me,
-	                                       me->mvert, me->totvert,
-	                                       me->medge, me->totedge,
-	                                       me->mface, me->totface,
-	                                       me->dvert,
-	                                       do_verbose, TRUE);
-
-	return layers_fixed || arrays_fixed;
+	layers_fixed = BKE_mesh_validate_all_customdata(&me->vdata, &me->edata, &me->ldata, &me->pdata, do_verbose, TRUE);
+	arrays_fixed = BKE_mesh_validate_arrays(me,
+	                                        me->mvert, me->totvert,
+	                                        me->medge, me->totedge,
+	                                        me->mloop, me->totloop,
+	                                        me->mpoly, me->totpoly,
+	                                        me->dvert,
+	                                        do_verbose, TRUE);
+
+	if (layers_fixed || arrays_fixed) {
+		DAG_id_tag_update(&me->id, OB_RECALC_DATA);
+		return TRUE;
+	}
+	return FALSE;
 }
 
 int BKE_mesh_validate_dm(DerivedMesh *dm)
@@ -453,7 +622,8 @@ int BKE_mesh_validate_dm(DerivedMesh *dm)
 	return BKE_mesh_validate_arrays(NULL,
 	                                dm->getVertArray(dm), dm->getNumVerts(dm),
 	                                dm->getEdgeArray(dm), dm->getNumEdges(dm),
-	                                dm->getFaceArray(dm), dm->getNumFaces(dm),
+	                                dm->getLoopArray(dm), dm->getNumLoops(dm),
+	                                dm->getPolyArray(dm), dm->getNumPolys(dm),
 	                                dm->getVertDataArray(dm, CD_MDEFORMVERT),
 	                                TRUE, FALSE);
 }
@@ -462,36 +632,32 @@ void BKE_mesh_calc_edges(Mesh *mesh, int update)
 {
 	CustomData edata;
 	EdgeHashIterator *ehi;
-	MFace *mf = mesh->mface;
+	MPoly *mp = mesh->mpoly;
 	MEdge *med, *med_orig;
 	EdgeHash *eh = BLI_edgehash_new();
-	int i, totedge, totface = mesh->totface;
+	int i, totedge, totpoly = mesh->totpoly;
+	int med_index;
 
-	if(mesh->totedge==0)
-		update= 0;
+	if (mesh->totedge == 0)
+		update = FALSE;
 
-	if(update) {
+	if (update) {
 		/* assume existing edges are valid
 		 * useful when adding more faces and generating edges from them */
-		med= mesh->medge;
-		for(i= 0; i<mesh->totedge; i++, med++)
+		med = mesh->medge;
+		for (i = 0; i < mesh->totedge; i++, med++)
 			BLI_edgehash_insert(eh, med->v1, med->v2, med);
 	}
 
-	for (i = 0; i < totface; i++, mf++) {
-		if (!BLI_edgehash_haskey(eh, mf->v1, mf->v2))
-			BLI_edgehash_insert(eh, mf->v1, mf->v2, NULL);
-		if (!BLI_edgehash_haskey(eh, mf->v2, mf->v3))
-			BLI_edgehash_insert(eh, mf->v2, mf->v3, NULL);
-
-		if (mf->v4) {
-			if (!BLI_edgehash_haskey(eh, mf->v3, mf->v4))
-				BLI_edgehash_insert(eh, mf->v3, mf->v4, NULL);
-			if (!BLI_edgehash_haskey(eh, mf->v4, mf->v1))
-				BLI_edgehash_insert(eh, mf->v4, mf->v1, NULL);
-		} else {
-			if (!BLI_edgehash_haskey(eh, mf->v3, mf->v1))
-				BLI_edgehash_insert(eh, mf->v3, mf->v1, NULL);
+	/* mesh loops (bmesh only) */
+	for (i = 0; i < totpoly; i++, mp++) {
+		MLoop *l = &mesh->mloop[mp->loopstart];
+		int j, l_prev = (l + (mp->totloop - 1))->v;
+		for (j = 0; j < mp->totloop; j++, l++) {
+			if (!BLI_edgehash_haskey(eh, l_prev, l->v)) {
+				BLI_edgehash_insert(eh, l_prev, l->v, NULL);
+			}
+			l_prev = l->v;
 		}
 	}
 
@@ -503,18 +669,39 @@ void BKE_mesh_calc_edges(Mesh *mesh, int update)
 
 	ehi = BLI_edgehashIterator_new(eh);
 	med = CustomData_get_layer(&edata, CD_MEDGE);
-	for(i = 0; !BLI_edgehashIterator_isDone(ehi);
-		BLI_edgehashIterator_step(ehi), ++i, ++med) {
+	for (i = 0; !BLI_edgehashIterator_isDone(ehi);
+	     BLI_edgehashIterator_step(ehi), ++i, ++med) {
 
-		if(update && (med_orig=BLI_edgehashIterator_getValue(ehi))) {
-			*med= *med_orig; /* copy from the original */
-		} else {
+		if (update && (med_orig = BLI_edgehashIterator_getValue(ehi))) {
+			*med = *med_orig; /* copy from the original */
+		}
+		else {
 			BLI_edgehashIterator_getKey(ehi, &med->v1, &med->v2);
-			med->flag = ME_EDGEDRAW|ME_EDGERENDER|SELECT; /* select for newly created meshes which are selected [#25595] */
+			med->flag = ME_EDGEDRAW | ME_EDGERENDER | SELECT; /* select for newly created meshes which are selected [#25595] */
 		}
+
+		/* store the new edge index in the hash value */
+		BLI_edgehashIterator_setValue(ehi, SET_INT_IN_POINTER(i));
 	}
 	BLI_edgehashIterator_free(ehi);
 
+	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++) {
+			MLoop *l = &mesh->mloop[mp->loopstart];
+			MLoop *l_prev = (l + (mp->totloop - 1));
+			int j;
+			for (j = 0; j < mp->totloop; j++, l++) {
+				/* lookup hashed edge index */
+				med_index = GET_INT_FROM_POINTER(BLI_edgehash_lookup(eh, l_prev->v, l->v));
+				l_prev->e = med_index;
+				l_prev = l;
+			}
+		}
+	}
+
 	/* free old CustomData and assign new one */
 	CustomData_free(&mesh->edata, mesh->totedge);
 	mesh->edata = edata;
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index 911d303..12aa623 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -55,7 +55,6 @@
 #include "BLI_linklist.h"
 #include "BLI_string.h"
 
-#include "BKE_bmesh.h"
 #include "BKE_cloth.h"
 #include "BKE_key.h"
 #include "BKE_multires.h"
@@ -77,8 +76,8 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type)
 		types_init= 0;
 	}
 
-	/* type unsigned, no need to chech < 0 */
-	if(type < NUM_MODIFIER_TYPES && types[type]->name[0] != '\0') {
+	/* type unsigned, no need to check < 0 */
+	if (type < NUM_MODIFIER_TYPES && types[type]->name[0] != '\0') {
 		return types[type];
 	}
 	else {
@@ -206,8 +205,8 @@ void modifiers_foreachIDLink(Object *ob, IDWalkFunc walk, void *userData)
 	for (; md; md=md->next) {
 		ModifierTypeInfo *mti = modifierType_getInfo(md->type);
 
-		if(mti->foreachIDLink) mti->foreachIDLink(md, ob, walk, userData);
-		else if(mti->foreachObjectLink) {
+		if (mti->foreachIDLink) mti->foreachIDLink(md, ob, walk, userData);
+		else if (mti->foreachObjectLink) {
 			/* each Object can masquerade as an ID, so this should be OK */
 			ObjectWalkFunc fp = (ObjectWalkFunc)walk;
 			mti->foreachObjectLink(md, ob, fp, userData);
@@ -222,7 +221,7 @@ void modifiers_foreachTexLink(Object *ob, TexWalkFunc walk, void *userData)
 	for (; md; md=md->next) {
 		ModifierTypeInfo *mti = modifierType_getInfo(md->type);
 
-		if(mti->foreachTexLink)
+		if (mti->foreachTexLink)
 			mti->foreachTexLink(md, ob, walk, userData);
 	}
 }
@@ -291,7 +290,7 @@ int modifiers_getCageIndex(struct Scene *scene, Object *ob, int *lastPossibleCag
 	ModifierData *md = (virtual_)? modifiers_getVirtualModifierList(ob): ob->modifiers.first;
 	int i, cageIndex = -1;
 
-	if(lastPossibleCageIndex_r) {
+	if (lastPossibleCageIndex_r) {
 		/* ensure the value is initialized */
 		*lastPossibleCageIndex_r= -1;
 	}
@@ -347,53 +346,57 @@ int modifier_isEnabled(struct Scene *scene, ModifierData *md, int required_mode)
 
 	md->scene= scene;
 
-	if((md->mode & required_mode) != required_mode) return 0;
-	if(mti->isDisabled && mti->isDisabled(md, required_mode == eModifierMode_Render)) return 0;
-	if(md->mode & eModifierMode_DisableTemporary) return 0;
-	if(required_mode & eModifierMode_Editmode)
-		if(!(mti->flags & eModifierTypeFlag_SupportsEditmode)) return 0;
+	if ((md->mode & required_mode) != required_mode) return 0;
+	if (mti->isDisabled && mti->isDisabled(md, required_mode == eModifierMode_Render)) return 0;
+	if (md->mode & eModifierMode_DisableTemporary) return 0;
+	if (required_mode & eModifierMode_Editmode)
+		if (!(mti->flags & eModifierTypeFlag_SupportsEditmode)) return 0;
 	
 	return 1;
 }
 
-LinkNode *modifiers_calcDataMasks(struct Scene *scene, Object *ob, ModifierData *md, CustomDataMask dataMask, int required_mode)
+CDMaskLink *modifiers_calcDataMasks(struct Scene *scene, Object *ob, ModifierData *md, CustomDataMask dataMask, int required_mode)
 {
-	LinkNode *dataMasks = NULL;
-	LinkNode *curr, *prev;
+	CDMaskLink *dataMasks = NULL;
+	CDMaskLink *curr, *prev;
 
 	/* build a list of modifier data requirements in reverse order */
-	for(; md; md = md->next) {
+	for (; md; md = md->next) {
 		ModifierTypeInfo *mti = modifierType_getInfo(md->type);
-		CustomDataMask mask = 0;
 
-		if(modifier_isEnabled(scene, md, required_mode))
-			if(mti->requiredDataMask)
-				mask = mti->requiredDataMask(ob, md);
+		curr = MEM_callocN(sizeof(CDMaskLink), "CDMaskLink");
+		
+		if (modifier_isEnabled(scene, md, required_mode))
+			if (mti->requiredDataMask)
+				curr->mask = mti->requiredDataMask(ob, md);
 
-		BLI_linklist_prepend(&dataMasks, SET_INT_IN_POINTER(mask));
+		/* prepend new datamask */
+		curr->next = dataMasks;
+		dataMasks = curr;
 	}
 
 	/* build the list of required data masks - each mask in the list must
-	* include all elements of the masks that follow it
-	*
-	* note the list is currently in reverse order, so "masks that follow it"
-	* actually means "masks that precede it" at the moment
-	*/
-	for(curr = dataMasks, prev = NULL; curr; prev = curr, curr = curr->next) {
-		if(prev) {
-			CustomDataMask prev_mask = (CustomDataMask)GET_INT_FROM_POINTER(prev->link);
-			CustomDataMask curr_mask = (CustomDataMask)GET_INT_FROM_POINTER(curr->link);
-
-			curr->link = SET_INT_IN_POINTER(curr_mask | prev_mask);
-		} else {
-			CustomDataMask curr_mask = (CustomDataMask)GET_INT_FROM_POINTER(curr->link);
-
-			curr->link = SET_INT_IN_POINTER(curr_mask | dataMask);
+	 * include all elements of the masks that follow it
+	 *
+	 * note the list is currently in reverse order, so "masks that follow it"
+	 * actually means "masks that precede it" at the moment
+	 */
+	for (curr = dataMasks, prev = NULL; curr; prev = curr, curr = curr->next) {
+		if (prev) {
+			CustomDataMask prev_mask = prev->mask;
+			CustomDataMask curr_mask = curr->mask;
+
+			curr->mask = curr_mask | prev_mask;
+		}
+		else {
+			CustomDataMask curr_mask = curr->mask;
+
+			curr->mask = curr_mask | dataMask;
 		}
 	}
 
 	/* reverse the list so it's in the correct order */
-	BLI_linklist_reverse(&dataMasks);
+	BLI_linklist_reverse((LinkNode**)&dataMasks);
 
 	return dataMasks;
 }
@@ -406,8 +409,8 @@ ModifierData *modifiers_getLastPreview(struct Scene *scene, ModifierData *md, in
 		return tmp_md;
 
 	/* Find the latest modifier in stack generating preview. */
-	for(; md; md = md->next) {
-		if(modifier_isEnabled(scene, md, required_mode) && modifier_isPreview(md))
+	for (; md; md = md->next) {
+		if (modifier_isEnabled(scene, md, required_mode) && modifier_isPreview(md))
 			tmp_md = md;
 	}
 	return tmp_md;
@@ -415,9 +418,9 @@ ModifierData *modifiers_getLastPreview(struct Scene *scene, ModifierData *md, in
 
 ModifierData *modifiers_getVirtualModifierList(Object *ob)
 {
-		/* Kinda hacky, but should be fine since we are never
-	* reentrant and avoid free hassles.
-		*/
+	/* Kinda hacky, but should be fine since we are never
+	 * re-entrant and avoid free hassles.
+	 */
 	static ArmatureModifierData amd;
 	static CurveModifierData cmd;
 	static LatticeModifierData lmd;
@@ -452,18 +455,20 @@ ModifierData *modifiers_getVirtualModifierList(Object *ob)
 
 	md = ob->modifiers.first;
 
-	if(ob->parent) {
-		if(ob->parent->type==OB_ARMATURE && ob->partype==PARSKEL) {
+	if (ob->parent) {
+		if (ob->parent->type==OB_ARMATURE && ob->partype==PARSKEL) {
 			amd.object = ob->parent;
 			amd.modifier.next = md;
 			amd.deformflag= ((bArmature *)(ob->parent->data))->deformflag;
 			md = &amd.modifier;
-		} else if(ob->parent->type==OB_CURVE && ob->partype==PARSKEL) {
+		}
+		else if (ob->parent->type==OB_CURVE && ob->partype==PARSKEL) {
 			cmd.object = ob->parent;
 			cmd.defaxis = ob->trackflag + 1;
 			cmd.modifier.next = md;
 			md = &cmd.modifier;
-		} else if(ob->parent->type==OB_LATTICE && ob->partype==PARSKEL) {
+		}
+		else if (ob->parent->type==OB_LATTICE && ob->partype==PARSKEL) {
 			lmd.object = ob->parent;
 			lmd.modifier.next = md;
 			md = &lmd.modifier;
@@ -471,8 +476,8 @@ ModifierData *modifiers_getVirtualModifierList(Object *ob)
 	}
 
 	/* shape key modifier, not yet for curves */
-	if(ELEM(ob->type, OB_MESH, OB_LATTICE) && ob_get_key(ob)) {
-		if(ob->type == OB_MESH && (ob->shapeflag & OB_SHAPE_EDIT_MODE))
+	if (ELEM(ob->type, OB_MESH, OB_LATTICE) && ob_get_key(ob)) {
+		if (ob->type == OB_MESH && (ob->shapeflag & OB_SHAPE_EDIT_MODE))
 			smd.modifier.mode |= eModifierMode_Editmode|eModifierMode_OnCage;
 		else
 			smd.modifier.mode &= ~eModifierMode_Editmode|eModifierMode_OnCage;
@@ -492,8 +497,7 @@ Object *modifiers_isDeformedByArmature(Object *ob)
 	ModifierData *md = modifiers_getVirtualModifierList(ob);
 	ArmatureModifierData *amd= NULL;
 	
-	/* return the first selected armature, this lets us use multiple armatures
-	*/
+	/* return the first selected armature, this lets us use multiple armatures */
 	for (; md; md=md->next) {
 		if (md->type==eModifierType_Armature) {
 			amd = (ArmatureModifierData*) md;
@@ -509,16 +513,15 @@ Object *modifiers_isDeformedByArmature(Object *ob)
 }
 
 /* Takes an object and returns its first selected lattice, else just its
-* lattice
-* This should work for multiple lattics per object
-*/
+ * lattice
+ * This should work for multiple lattics per object
+ */
 Object *modifiers_isDeformedByLattice(Object *ob)
 {
 	ModifierData *md = modifiers_getVirtualModifierList(ob);
 	LatticeModifierData *lmd= NULL;
 	
-	/* return the first selected lattice, this lets us use multiple lattices
-	*/
+	/* return the first selected lattice, this lets us use multiple lattices */
 	for (; md; md=md->next) {
 		if (md->type==eModifierType_Lattice) {
 			lmd = (LatticeModifierData*) md;
@@ -565,9 +568,9 @@ int modifiers_isCorrectableDeformed(Object *ob)
 	ModifierData *md = modifiers_getVirtualModifierList(ob);
 	
 	for (; md; md=md->next) {
-		if(ob->mode==OB_MODE_EDIT && (md->mode & eModifierMode_Editmode)==0);
+		if (ob->mode==OB_MODE_EDIT && (md->mode & eModifierMode_Editmode)==0);
 		else 
-			if(modifier_isCorrectableDeformed(md))
+			if (modifier_isCorrectableDeformed(md))
 				return 1;
 	}
 	return 0;
@@ -593,16 +596,16 @@ int modifiers_indexInObject(Object *ob, ModifierData *md_seek)
 	ModifierData *md;
 	
 	for (md=ob->modifiers.first; (md && md_seek!=md); md=md->next, i++);
-	if (!md) return -1; /* modifier isnt in the object */
+	if (!md) return -1; /* modifier isn't in the object */
 	return i;
 }
 
 void modifier_freeTemporaryData(ModifierData *md)
 {
-	if(md->type == eModifierType_Armature) {
+	if (md->type == eModifierType_Armature) {
 		ArmatureModifierData *amd= (ArmatureModifierData*)md;
 
-		if(amd->prevCos) {
+		if (amd->prevCos) {
 			MEM_freeN(amd->prevCos);
 			amd->prevCos= NULL;
 		}
@@ -615,12 +618,12 @@ void test_object_modifiers(Object *ob)
 	ModifierData *md;
 
 	/* just multires checked for now, since only multires
-	   modifies mesh data */
+	 * modifies mesh data */
 
-	if(ob->type != OB_MESH) return;
+	if (ob->type != OB_MESH) return;
 
-	for(md = ob->modifiers.first; md; md = md->next) {
-		if(md->type == eModifierType_Multires) {
+	for (md = ob->modifiers.first; md; md = md->next) {
+		if (md->type == eModifierType_Multires) {
 			MultiresModifierData *mmd = (MultiresModifierData*)md;
 
 			multiresModifier_set_levels_from_disps(mmd, ob);
@@ -637,7 +640,7 @@ void test_object_modifiers(Object *ob)
  *
  * - if the ID is from a library, return library path
  * - else if the file has been saved return the blend file path.
- * - else if the file isn't saved and the ID isnt from a library, return the temp dir.
+ * - else if the file isn't saved and the ID isn't from a library, return the temp dir.
  */
 const char *modifier_path_relbase(Object *ob)
 {
diff --git a/source/blender/blenkernel/intern/modifiers_bmesh.c b/source/blender/blenkernel/intern/modifiers_bmesh.c
new file mode 100644
index 0000000..573b8a7
--- /dev/null
+++ b/source/blender/blenkernel/intern/modifiers_bmesh.c
@@ -0,0 +1,198 @@
+/*
+ * ***** 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): Joseph Eagar
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ */
+
+/** \file blender/blenkernel/intern/modifiers_bmesh.c
+ *  \ingroup bke
+ */
+
+#include "BLI_math.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_object_types.h"
+
+#include "BLI_array.h"
+
+#include "BKE_DerivedMesh.h"
+#include "BKE_bmesh.h"
+#include "BKE_tessmesh.h"
+
+/* main function for copying DerivedMesh data into BMesh */
+void DM_to_bmesh_ex(DerivedMesh *dm, BMesh *bm)
+{
+	MVert *mv, *mvert;
+	MEdge *me, *medge;
+	MPoly /* *mpoly, */ /* UNUSED */ *mp;
+	MLoop *mloop, *ml;
+	BMVert *v, **vtable, **verts = NULL;
+	BMEdge *e, **etable, **edges = NULL;
+	float has_face_normals;
+	BMFace *f;
+	BMIter liter;
+	BLI_array_declare(verts);
+	BLI_array_declare(edges);
+	int i, j, k, totvert, totedge /* , totface */ /* UNUSED */ ;
+
+	/*merge custom data layout*/
+	CustomData_bmesh_merge(&dm->vertData, &bm->vdata, CD_MASK_DERIVEDMESH, CD_CALLOC, bm, BM_VERT);
+	CustomData_bmesh_merge(&dm->edgeData, &bm->edata, CD_MASK_DERIVEDMESH, CD_CALLOC, bm, BM_EDGE);
+	CustomData_bmesh_merge(&dm->loopData, &bm->ldata, CD_MASK_DERIVEDMESH, CD_CALLOC, bm, BM_LOOP);
+	CustomData_bmesh_merge(&dm->polyData, &bm->pdata, CD_MASK_DERIVEDMESH, CD_CALLOC, bm, BM_FACE);
+
+	totvert = dm->getNumVerts(dm);
+	totedge = dm->getNumEdges(dm);
+	/* totface = dm->getNumPolys(dm); */ /* UNUSED */
+
+	/* add crease layer */
+	BM_data_layer_add(bm, &bm->edata, CD_CREASE);
+	/* add bevel weight layers */
+	BM_data_layer_add(bm, &bm->edata, CD_BWEIGHT);
+	BM_data_layer_add(bm, &bm->vdata, CD_BWEIGHT);
+
+	vtable = MEM_callocN(sizeof(void**) * totvert, "vert table in BMDM_Copy");
+	etable = MEM_callocN(sizeof(void**) * totedge, "edge table in BMDM_Copy");
+
+	/*do verts*/
+	mv = mvert = dm->dupVertArray(dm);
+	for (i = 0; i < totvert; i++, mv++) {
+		v = BM_vert_create(bm, mv->co, NULL);
+		normal_short_to_float_v3(v->no, mv->no);
+		v->head.hflag = BM_vert_flag_from_mflag(mv->flag);
+
+		CustomData_to_bmesh_block(&dm->vertData, &bm->vdata, i, &v->head.data);
+
+		/* add bevel weight */
+		BM_elem_float_data_set(&bm->vdata, v, CD_BWEIGHT, (float)mv->bweight / 255.0f);
+		vtable[i] = v;
+	}
+	MEM_freeN(mvert);
+
+	/*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);
+
+		e->head.hflag = BM_edge_flag_from_mflag(me->flag);
+
+		CustomData_to_bmesh_block(&dm->edgeData, &bm->edata, i, &e->head.data);
+		etable[i] = e;
+
+		/* add crease */
+		BM_elem_float_data_set(&bm->edata, e, CD_CREASE, (float)me->crease / 255.0f);
+		/* add bevel weight */
+		BM_elem_float_data_set(&bm->edata, e, CD_BWEIGHT, (float)me->bweight / 255.0f);
+	}
+	MEM_freeN(medge);
+
+	/*do faces*/
+	mp = dm->getPolyArray(dm);
+	mloop = dm->getLoopArray(dm);
+	has_face_normals = CustomData_has_layer(&dm->polyData, CD_NORMAL);
+	for (i = 0; i < dm->numPolyData; i++, mp++) {
+		BMLoop *l;
+
+		BLI_array_empty(verts);
+		BLI_array_empty(edges);
+
+		BLI_array_growitems(verts, mp->totloop);
+		BLI_array_growitems(edges, mp->totloop);
+
+		ml = mloop + mp->loopstart;
+		for (j = 0; j < mp->totloop; j++, ml++) {
+
+			verts[j] = vtable[ml->v];
+			edges[j] = etable[ml->e];
+		}
+
+		f = BM_face_create_ngon(bm, verts[0], verts[1], edges, mp->totloop, FALSE);
+
+		if (!f)
+			continue;
+
+		f->head.hflag = BM_face_flag_from_mflag(mp->flag);
+		f->mat_nr = mp->mat_nr;
+
+		l = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, f);
+
+		for (k = mp->loopstart; l; l = BM_iter_step(&liter), k++) {
+			CustomData_to_bmesh_block(&dm->loopData, &bm->ldata, k, &l->head.data);
+		}
+
+		CustomData_to_bmesh_block(&dm->polyData, &bm->pdata, i, &f->head.data);
+
+		if (has_face_normals) {
+			float *fno;
+
+			fno = CustomData_bmesh_get(&bm->pdata, &f->head.data, CD_NORMAL);
+			copy_v3_v3(f->no, fno);
+		}
+	}
+
+	MEM_freeN(vtable);
+	MEM_freeN(etable);
+
+	BLI_array_free(verts);
+	BLI_array_free(edges);
+}
+
+/* converts a cddm to a BMEditMesh.  if existing is non-NULL, the
+ * new geometry will be put in there.*/
+BMEditMesh *DM_to_editbmesh(DerivedMesh *dm, BMEditMesh *existing, int do_tessellate)
+{
+	BMEditMesh *em = existing;
+	BMesh *bm;
+
+	if (em) {
+		bm = em->bm;
+	}
+	else {
+		bm = BM_mesh_create(&bm_mesh_allocsize_default);
+	}
+
+	DM_to_bmesh_ex(dm, bm);
+
+	if (!em) {
+		em = BMEdit_Create(bm, do_tessellate);
+	}
+	else {
+		if (do_tessellate) {
+			BMEdit_RecalcTessellation(em);
+		}
+	}
+
+	return em;
+}
+
+BMesh *DM_to_bmesh(DerivedMesh *dm)
+{
+	BMesh *bm;
+
+	bm = BM_mesh_create(&bm_mesh_allocsize_default);
+
+	DM_to_bmesh_ex(dm, bm);
+
+	return bm;
+}
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index c90faa7..9a640bc 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -64,6 +64,7 @@
 #include "BLI_mempool.h"
 #include "BLI_threads.h"
 
+#include "BKE_animsys.h"
 #include "BKE_constraint.h"
 #include "BKE_library.h"
 #include "BKE_global.h"
@@ -79,21 +80,21 @@
 
 /*********************** movieclip buffer loaders *************************/
 
-static int sequence_guess_offset(const char *full_name, int head_len, int numlen)
+static int sequence_guess_offset(const char *full_name, int head_len, unsigned short numlen)
 {
-	char num[FILE_MAX]= {0};
+	char num[FILE_MAX] = {0};
 
-	BLI_strncpy(num, full_name+head_len, numlen+1);
+	BLI_strncpy(num, full_name + head_len, numlen + 1);
 
 	return atoi(num);
 }
 
 static int rendersize_to_proxy(MovieClipUser *user, int flag)
 {
-	if((flag&MCLIP_USE_PROXY)==0)
+	if ((flag & MCLIP_USE_PROXY) == 0)
 		return IMB_PROXY_NONE;
 
-	switch(user->render_size) {
+	switch (user->render_size) {
 		case MCLIP_PROXY_RENDER_SIZE_25:
 			return IMB_PROXY_25;
 
@@ -115,7 +116,7 @@ static int rendersize_to_proxy(MovieClipUser *user, int flag)
 
 static int rendersize_to_number(int render_size)
 {
-	switch(render_size) {
+	switch (render_size) {
 		case MCLIP_PROXY_RENDER_SIZE_25:
 			return 25;
 
@@ -137,7 +138,7 @@ static int rendersize_to_number(int render_size)
 
 static int get_timecode(MovieClip *clip, int flag)
 {
-	if((flag&MCLIP_USE_PROXY)==0)
+	if ((flag & MCLIP_USE_PROXY) == 0)
 		return IMB_TC_NONE;
 
 	return clip->proxy.tc;
@@ -153,11 +154,13 @@ static void get_sequence_fname(MovieClip *clip, int framenr, char *name)
 	BLI_stringdec(name, head, tail, &numlen);
 
 	/* movieclips always points to first image from sequence,
-	   autoguess offset for now. could be something smarter in the future */
+	 * autoguess offset for now. could be something smarter in the future */
 	offset= sequence_guess_offset(clip->name, strlen(head), numlen);
 
-	if (numlen) BLI_stringenc(name, head, tail, numlen, offset+framenr-1);
-	else        BLI_strncpy(name, clip->name, sizeof(clip->name));
+	if (numlen)
+		BLI_stringenc(name, head, tail, numlen, offset + framenr - 1);
+	else
+		BLI_strncpy(name, clip->name, sizeof(clip->name));
 
 	BLI_path_abs(name, ID_BLEND_PATH(G.main, &clip->id));
 }
@@ -165,18 +168,19 @@ static void get_sequence_fname(MovieClip *clip, int framenr, char *name)
 /* supposed to work with sequences only */
 static void get_proxy_fname(MovieClip *clip, int proxy_render_size, int undistorted, int framenr, char *name)
 {
-	int size= rendersize_to_number(proxy_render_size);
+	int size = rendersize_to_number(proxy_render_size);
 	char dir[FILE_MAX], clipdir[FILE_MAX], clipfile[FILE_MAX];
 
 	BLI_split_dirfile(clip->name, clipdir, clipfile, FILE_MAX, FILE_MAX);
 
-	if(clip->flag&MCLIP_USE_PROXY_CUSTOM_DIR) {
+	if (clip->flag & MCLIP_USE_PROXY_CUSTOM_DIR) {
 		BLI_strncpy(dir, clip->proxy.dir, sizeof(dir));
-	} else {
+	}
+	else {
 		BLI_snprintf(dir, FILE_MAX, "%s/BL_proxy", clipdir);
 	}
 
-	if(undistorted)
+	if (undistorted)
 		BLI_snprintf(name, FILE_MAX, "%s/%s/proxy_%d_undistorted/%08d", dir, clipfile, size, framenr);
 	else
 		BLI_snprintf(name, FILE_MAX, "%s/%s/proxy_%d/%08d", dir, clipfile, size, framenr);
@@ -193,37 +197,35 @@ static ImBuf *movieclip_load_sequence_file(MovieClip *clip, MovieClipUser *user,
 	char name[FILE_MAX];
 	int loadflag, use_proxy= 0;
 
-	use_proxy= (flag&MCLIP_USE_PROXY) && user->render_size != MCLIP_PROXY_RENDER_SIZE_FULL;
-	if(use_proxy) {
-		int undistort= user->render_flag&MCLIP_PROXY_RENDER_UNDISTORT;
+	use_proxy = (flag & MCLIP_USE_PROXY) && user->render_size != MCLIP_PROXY_RENDER_SIZE_FULL;
+	if (use_proxy) {
+		int undistort = user->render_flag & MCLIP_PROXY_RENDER_UNDISTORT;
 		get_proxy_fname(clip, user->render_size, undistort, framenr, name);
-	} else
+	}
+	else
 		get_sequence_fname(clip, framenr, name);
 
-	loadflag= IB_rect|IB_multilayer;
+	loadflag = IB_rect|IB_multilayer;
 
 	/* read ibuf */
-	ibuf= IMB_loadiffname(name, loadflag);
+	ibuf = IMB_loadiffname(name, loadflag);
 
 	return ibuf;
 }
 
-static ImBuf *movieclip_load_movie_file(MovieClip *clip, MovieClipUser *user, int framenr, int flag)
+static void movieclip_open_anim_file(MovieClip *clip)
 {
-	ImBuf *ibuf= NULL;
-	int tc= get_timecode(clip, flag);
-	int proxy= rendersize_to_proxy(user, flag);
 	char str[FILE_MAX];
 
-	if(!clip->anim) {
+	if (!clip->anim) {
 		BLI_strncpy(str, clip->name, FILE_MAX);
 		BLI_path_abs(str, ID_BLEND_PATH(G.main, &clip->id));
 
 		/* FIXME: make several stream accessible in image editor, too */
-		clip->anim= openanim(str, IB_rect, 0);
+		clip->anim = openanim(str, IB_rect, 0);
 
-		if(clip->anim) {
-			if(clip->flag&MCLIP_USE_PROXY_CUSTOM_DIR) {
+		if (clip->anim) {
+			if (clip->flag & MCLIP_USE_PROXY_CUSTOM_DIR) {
 				char dir[FILE_MAX];
 				BLI_strncpy(dir, clip->proxy.dir, sizeof(dir));
 				BLI_path_abs(dir, G.main->name);
@@ -231,26 +233,70 @@ static ImBuf *movieclip_load_movie_file(MovieClip *clip, MovieClipUser *user, in
 			}
 		}
 	}
+}
+
+static ImBuf *movieclip_load_movie_file(MovieClip *clip, MovieClipUser *user, int framenr, int flag)
+{
+	ImBuf *ibuf = NULL;
+	int tc = get_timecode(clip, flag);
+	int proxy = rendersize_to_proxy(user, flag);
 
-	if(clip->anim) {
+	movieclip_open_anim_file(clip);
+
+	if (clip->anim) {
 		int dur;
 		int fra;
 
-		dur= IMB_anim_get_duration(clip->anim, tc);
-		fra= framenr-1;
+		dur = IMB_anim_get_duration(clip->anim, tc);
+		fra = framenr - 1;
 
-		if(fra<0)
-			fra= 0;
+		if (fra<0)
+			fra = 0;
 
-		if(fra>(dur-1))
-			fra= dur-1;
+		if (fra > (dur - 1))
+			fra = dur - 1;
 
-		ibuf= IMB_anim_absolute(clip->anim, fra, tc, proxy);
+		ibuf = IMB_anim_absolute(clip->anim, fra, tc, proxy);
 	}
 
 	return ibuf;
 }
 
+static void movieclip_calc_length(MovieClip *clip)
+{
+	if (clip->source == MCLIP_SRC_MOVIE) {
+		movieclip_open_anim_file(clip);
+
+		if (clip->anim) {
+			clip->len = IMB_anim_get_duration(clip->anim, clip->proxy.tc);
+		}
+	}
+	else if (clip->source == MCLIP_SRC_SEQUENCE) {
+		int framenr = 1;
+		unsigned short numlen;
+		char name[FILE_MAX], head[FILE_MAX], tail[FILE_MAX];
+
+		BLI_stringdec(clip->name, head, tail, &numlen);
+
+		if (numlen == 0) {
+			/* there's no number group in file name, assume it's single framed sequence */
+			clip->len = framenr + 1;
+		}
+		else {
+			for (;;) {
+				get_sequence_fname(clip, framenr, name);
+
+				if (!BLI_exists(name)) {
+					clip->len = framenr + 1;
+					break;
+				}
+
+				framenr++;
+			}
+		}
+	}
+}
+
 /*********************** image buffer cache *************************/
 
 typedef struct MovieClipCache {
@@ -276,9 +322,10 @@ typedef struct MovieClipCache {
 	struct {
 		ImBuf *ibuf;
 		int framenr;
+		int postprocess_flag;
 
-		float loc[2], scale, angle;
-		int proxy;
+		float loc[2], scale, angle, aspect;
+		int proxy, filter;
 		short render_flag;
 	} stabilized;
 } MovieClipCache;
@@ -291,52 +338,58 @@ typedef struct MovieClipImBufCacheKey {
 
 static void moviecache_keydata(void *userkey, int *framenr, int *proxy, int *render_flags)
 {
-	MovieClipImBufCacheKey *key= (MovieClipImBufCacheKey*)userkey;
+	MovieClipImBufCacheKey *key = (MovieClipImBufCacheKey*)userkey;
 
-	*framenr= key->framenr;
-	*proxy= key->proxy;
-	*render_flags= key->render_flag;
+	*framenr = key->framenr;
+	*proxy = key->proxy;
+	*render_flags = key->render_flag;
 }
 
 static unsigned int moviecache_hashhash(const void *keyv)
 {
-	MovieClipImBufCacheKey *key= (MovieClipImBufCacheKey*)keyv;
-	int rval= key->framenr;
+	MovieClipImBufCacheKey *key = (MovieClipImBufCacheKey*)keyv;
+	int rval = key->framenr;
 
 	return rval;
 }
 
 static int moviecache_hashcmp(const void *av, const void *bv)
 {
-	const MovieClipImBufCacheKey *a= (MovieClipImBufCacheKey*)av;
-	const MovieClipImBufCacheKey *b= (MovieClipImBufCacheKey*)bv;
+	const MovieClipImBufCacheKey *a = (MovieClipImBufCacheKey*)av;
+	const MovieClipImBufCacheKey *b = (MovieClipImBufCacheKey*)bv;
 
-	if(a->framenr<b->framenr) return -1;
-	else if(a->framenr>b->framenr) return 1;
+	if (a->framenr < b->framenr)
+		return -1;
+	else if (a->framenr > b->framenr)
+		return 1;
 
-	if(a->proxy<b->proxy) return -1;
-	else if(a->proxy>b->proxy) return 1;
+	if (a->proxy < b->proxy)
+		return -1;
+	else if (a->proxy > b->proxy)
+		return 1;
 
-	if(a->render_flag<b->render_flag) return -1;
-	else if(a->render_flag>b->render_flag) return 1;
+	if (a->render_flag < b->render_flag)
+		return -1;
+	else if (a->render_flag > b->render_flag)
+		return 1;
 
 	return 0;
 }
 
 static ImBuf *get_imbuf_cache(MovieClip *clip, MovieClipUser *user, int flag)
 {
-	if(clip->cache) {
+	if (clip->cache) {
 		MovieClipImBufCacheKey key;
 
-		key.framenr= user->framenr;
+		key.framenr = user->framenr;
 
-		if(flag&MCLIP_USE_PROXY) {
-			key.proxy= rendersize_to_proxy(user, flag);
-			key.render_flag= user->render_flag;
+		if (flag & MCLIP_USE_PROXY) {
+			key.proxy = rendersize_to_proxy(user, flag);
+			key.render_flag = user->render_flag;
 		}
 		else {
-			key.proxy= IMB_PROXY_NONE;
-			key.render_flag= 0;
+			key.proxy = IMB_PROXY_NONE;
+			key.render_flag = 0;
 		}
 
 		return IMB_moviecache_get(clip->cache->moviecache, &key);
@@ -349,22 +402,22 @@ static void put_imbuf_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, i
 {
 	MovieClipImBufCacheKey key;
 
-	if(!clip->cache) {
-		clip->cache= MEM_callocN(sizeof(MovieClipCache), "movieClipCache");
+	if (!clip->cache) {
+		clip->cache = MEM_callocN(sizeof(MovieClipCache), "movieClipCache");
 
-		clip->cache->moviecache= IMB_moviecache_create(sizeof(MovieClipImBufCacheKey), moviecache_hashhash,
+		clip->cache->moviecache = IMB_moviecache_create(sizeof(MovieClipImBufCacheKey), moviecache_hashhash,
 				moviecache_hashcmp, moviecache_keydata);
 	}
 
-	key.framenr= user->framenr;
+	key.framenr = user->framenr;
 
-	if(flag&MCLIP_USE_PROXY) {
-		key.proxy= rendersize_to_proxy(user, flag);
-		key.render_flag= user->render_flag;
+	if (flag & MCLIP_USE_PROXY) {
+		key.proxy = rendersize_to_proxy(user, flag);
+		key.render_flag = user->render_flag;
 	}
 	else {
-		key.proxy= IMB_PROXY_NONE;
-		key.render_flag= 0;
+		key.proxy = IMB_PROXY_NONE;
+		key.render_flag = 0;
 	}
 
 	IMB_moviecache_put(clip->cache->moviecache, &key, ibuf);
@@ -377,26 +430,26 @@ static MovieClip *movieclip_alloc(const char *name)
 {
 	MovieClip *clip;
 
-	clip= alloc_libblock(&G.main->movieclip, ID_MC, name);
+	clip = alloc_libblock(&G.main->movieclip, ID_MC, name);
 
-	clip->aspx= clip->aspy= 1.0f;
+	clip->aspx = clip->aspy= 1.0f;
 
 	BKE_tracking_init_settings(&clip->tracking);
 
-	clip->proxy.build_size_flag= IMB_PROXY_25;
-	clip->proxy.build_tc_flag= IMB_TC_RECORD_RUN |
-	                           IMB_TC_FREE_RUN |
-	                           IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN |
-	                           IMB_TC_RECORD_RUN_NO_GAPS;
-	clip->proxy.quality= 90;
+	clip->proxy.build_size_flag = IMB_PROXY_25;
+	clip->proxy.build_tc_flag = IMB_TC_RECORD_RUN |
+	                            IMB_TC_FREE_RUN |
+	                            IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN |
+	                            IMB_TC_RECORD_RUN_NO_GAPS;
+	clip->proxy.quality = 90;
 
 	return clip;
 }
 
 /* checks if image was already loaded, then returns same image
-   otherwise creates new.
-   does not load ibuf itself
-   pass on optional frame for #name images */
+ * otherwise creates new.
+ * does not load ibuf itself
+ * pass on optional frame for #name images */
 MovieClip *BKE_add_movieclip_file(const char *name)
 {
 	MovieClip *clip;
@@ -409,16 +462,17 @@ MovieClip *BKE_add_movieclip_file(const char *name)
 	BLI_path_abs(str, G.main->name);
 
 	/* exists? */
-	file= open(str, O_BINARY|O_RDONLY);
-	if(file== -1) return NULL;
+	file = BLI_open(str, O_BINARY|O_RDONLY,0);
+	if (file == -1)
+		return NULL;
 	close(file);
 
 	/* ** first search an identical clip ** */
-	for(clip= G.main->movieclip.first; clip; clip= clip->id.next) {
+	for (clip = G.main->movieclip.first; clip; clip = clip->id.next) {
 		BLI_strncpy(strtest, clip->name, sizeof(clip->name));
 		BLI_path_abs(strtest, G.main->name);
 
-		if(strcmp(strtest, str)==0) {
+		if (strcmp(strtest, str) == 0) {
 			BLI_strncpy(clip->name, name, sizeof(clip->name));  /* for stringcode */
 			clip->id.us++;  /* officially should not, it doesn't link here! */
 
@@ -429,49 +483,54 @@ MovieClip *BKE_add_movieclip_file(const char *name)
 	/* ** add new movieclip ** */
 
 	/* create a short library name */
-	len= strlen(name);
+	len = strlen(name);
 
-	while (len > 0 && name[len - 1] != '/' && name[len - 1] != '\\') len--;
-	libname= name+len;
+	while (len > 0 && name[len - 1] != '/' && name[len - 1] != '\\')
+		len--;
+	libname = name + len;
 
-	clip= movieclip_alloc(libname);
+	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;
+	if (BLI_testextensie_array(name, imb_ext_movie))
+		clip->source = MCLIP_SRC_MOVIE;
+	else
+		clip->source = MCLIP_SRC_SEQUENCE;
 
-	user.framenr= 1;
+	user.framenr = 1;
 	BKE_movieclip_get_size(clip, &user, &width, &height);
-	if(width && height) {
-		clip->tracking.camera.principal[0]= ((float)width)/2;
-		clip->tracking.camera.principal[1]= ((float)height)/2;
+	if (width && height) {
+		clip->tracking.camera.principal[0] = ((float)width) / 2.0f;
+		clip->tracking.camera.principal[1] = ((float)height) / 2.0f;
 
-		clip->tracking.camera.focal= 24.0f*width/clip->tracking.camera.sensor_width;
+		clip->tracking.camera.focal = 24.0f * width / clip->tracking.camera.sensor_width;
 	}
 
+	movieclip_calc_length(clip);
+
 	return clip;
 }
 
 static void real_ibuf_size(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, int *width, int *height)
 {
-	*width= ibuf->x;
-	*height= ibuf->y;
+	*width = ibuf->x;
+	*height = ibuf->y;
 
-	if(clip->flag&MCLIP_USE_PROXY) {
+	if (clip->flag & MCLIP_USE_PROXY) {
 		switch(user->render_size) {
 			case MCLIP_PROXY_RENDER_SIZE_25:
-				(*width)*= 4;
-				(*height)*= 4;
+				(*width) *= 4;
+				(*height) *= 4;
 				break;
 
 			case MCLIP_PROXY_RENDER_SIZE_50:
-				(*width)*= 2.0f;
-				(*height)*= 2.0f;
+				(*width) *= 2.0f;
+				(*height) *= 2.0f;
 				break;
 
 			case MCLIP_PROXY_RENDER_SIZE_75:
-				*width= ((float)*width)*4.0f/3.0f;
-				*height= ((float)*height)*4.0f/3.0f;
+				*width = ((float)*width)*4.0f/3.0f;
+				*height = ((float)*height)*4.0f/3.0f;
 				break;
 		}
 	}
@@ -482,16 +541,16 @@ static ImBuf *get_undistorted_ibuf(MovieClip *clip, struct MovieDistortion *dist
 	ImBuf *undistibuf;
 
 	/* XXX: because of #27997 do not use float buffers to undistort,
-	        otherwise, undistorted proxy can be darker than it should */
+	 *      otherwise, undistorted proxy can be darker than it should */
 	imb_freerectfloatImBuf(ibuf);
 
-	if(distortion)
-		undistibuf= BKE_tracking_distortion_exec(distortion, &clip->tracking, ibuf, ibuf->x, ibuf->y, 0.0f, 1);
+	if (distortion)
+		undistibuf = BKE_tracking_distortion_exec(distortion, &clip->tracking, ibuf, ibuf->x, ibuf->y, 0.0f, 1);
 	else
-		undistibuf= BKE_tracking_undistort(&clip->tracking, ibuf, ibuf->x, ibuf->y, 0.0f);
+		undistibuf = BKE_tracking_undistort(&clip->tracking, ibuf, ibuf->x, ibuf->y, 0.0f);
 
-	if(undistibuf->userflags&IB_RECT_INVALID) {
-		ibuf->userflags&= ~IB_RECT_INVALID;
+	if (undistibuf->userflags & IB_RECT_INVALID) {
+		ibuf->userflags &= ~IB_RECT_INVALID;
 		IMB_rect_from_float(undistibuf);
 	}
 
@@ -505,7 +564,7 @@ static int need_undistortion_postprocess(MovieClipUser *user, int flag)
 	int result = 0;
 
 	/* only full undistorted render can be used as on-fly undistorting image */
-	if(flag & MCLIP_USE_PROXY) {
+	if (flag & MCLIP_USE_PROXY) {
 		result |= (user->render_size == MCLIP_PROXY_RENDER_SIZE_FULL) &&
 		          (user->render_flag & MCLIP_PROXY_RENDER_UNDISTORT) != 0;
 	}
@@ -524,51 +583,51 @@ static int need_postprocessed_frame(MovieClipUser *user, int flag, int postproce
 
 static int check_undistortion_cache_flags(MovieClip *clip)
 {
-	MovieClipCache *cache= clip->cache;
-	MovieTrackingCamera *camera= &clip->tracking.camera;
+	MovieClipCache *cache = clip->cache;
+	MovieTrackingCamera *camera = &clip->tracking.camera;
 
 	/* check for distortion model changes */
-	if(!equals_v2v2(camera->principal, cache->postprocessed.principal))
-		return 0;
+	if (!equals_v2v2(camera->principal, cache->postprocessed.principal))
+		return FALSE;
 
-	if(!equals_v3v3(&camera->k1, &cache->postprocessed.k1))
-		return 0;
+	if (!equals_v3v3(&camera->k1, &cache->postprocessed.k1))
+		return FALSE;
 
-	return 1;
+	return TRUE;
 }
 
 static ImBuf *get_postprocessed_cached_frame(MovieClip *clip, MovieClipUser *user, int flag, int postprocess_flag)
 {
-	MovieClipCache *cache= clip->cache;
-	int framenr= user->framenr;
-	short proxy= IMB_PROXY_NONE;
-	int render_flag= 0;
-
-	if(flag&MCLIP_USE_PROXY) {
-		proxy= rendersize_to_proxy(user, flag);
-		render_flag= user->render_flag;
+	MovieClipCache *cache = clip->cache;
+	int framenr = user->framenr;
+	short proxy = IMB_PROXY_NONE;
+	int render_flag = 0;
+
+	if (flag & MCLIP_USE_PROXY) {
+		proxy = rendersize_to_proxy(user, flag);
+		render_flag = user->render_flag;
 	}
 
 	/* no cache or no cached postprocessed image */
-	if(!clip->cache || !clip->cache->postprocessed.ibuf)
+	if (!clip->cache || !clip->cache->postprocessed.ibuf)
 		return NULL;
 
 	/* postprocessing happened for other frame */
-	if(cache->postprocessed.framenr != framenr)
+	if (cache->postprocessed.framenr != framenr)
 		return NULL;
 
 	/* cached ibuf used different proxy settings */
-	if(cache->postprocessed.render_flag != render_flag || cache->postprocessed.proxy != proxy)
+	if (cache->postprocessed.render_flag != render_flag || cache->postprocessed.proxy != proxy)
 		return NULL;
 
-	if(cache->postprocessed.flag != postprocess_flag)
+	if (cache->postprocessed.flag != postprocess_flag)
 		return NULL;
 
-	if(need_undistortion_postprocess(user, flag)) {
-		if(!check_undistortion_cache_flags(clip))
+	if (need_undistortion_postprocess(user, flag)) {
+		if (!check_undistortion_cache_flags(clip))
 			return NULL;
 	}
-	else if(cache->postprocessed.undistoriton_used)
+	else if (cache->postprocessed.undistoriton_used)
 		return NULL;
 
 	IMB_refImBuf(cache->postprocessed.ibuf);
@@ -578,54 +637,56 @@ static ImBuf *get_postprocessed_cached_frame(MovieClip *clip, MovieClipUser *use
 
 static ImBuf *put_postprocessed_frame_to_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, int flag, int postprocess_flag)
 {
-	MovieClipCache *cache= clip->cache;
-	MovieTrackingCamera *camera= &clip->tracking.camera;
+	MovieClipCache *cache = clip->cache;
+	MovieTrackingCamera *camera = &clip->tracking.camera;
 	ImBuf *postproc_ibuf = NULL;
 
-	if(cache->postprocessed.ibuf)
+	if (cache->postprocessed.ibuf)
 		IMB_freeImBuf(cache->postprocessed.ibuf);
 
-	cache->postprocessed.framenr= user->framenr;
+	cache->postprocessed.framenr = user->framenr;
 	cache->postprocessed.flag = postprocess_flag;
 
-	if(flag&MCLIP_USE_PROXY) {
-		cache->postprocessed.proxy= rendersize_to_proxy(user, flag);
-		cache->postprocessed.render_flag= user->render_flag;
+	if (flag & MCLIP_USE_PROXY) {
+		cache->postprocessed.proxy = rendersize_to_proxy(user, flag);
+		cache->postprocessed.render_flag = user->render_flag;
 	}
 	else {
 		cache->postprocessed.proxy = IMB_PROXY_NONE;
 		cache->postprocessed.render_flag = 0;
 	}
 
-	if(need_undistortion_postprocess(user, flag)) {
+	if (need_undistortion_postprocess(user, flag)) {
 		copy_v2_v2(cache->postprocessed.principal, camera->principal);
 		copy_v3_v3(&cache->postprocessed.k1, &camera->k1);
-		cache->postprocessed.undistoriton_used = 1;
+		cache->postprocessed.undistoriton_used = TRUE;
 		postproc_ibuf= get_undistorted_ibuf(clip, NULL, ibuf);
 	}
-	else cache->postprocessed.undistoriton_used = 0;
+	else {
+		cache->postprocessed.undistoriton_used = FALSE;
+	}
 
-	if(postprocess_flag) {
+	if (postprocess_flag) {
 		int disable_red   = postprocess_flag & MOVIECLIP_DISABLE_RED,
 		    disable_green = postprocess_flag & MOVIECLIP_DISABLE_GREEN,
 			disable_blue  = postprocess_flag & MOVIECLIP_DISABLE_BLUE,
 			grayscale     = postprocess_flag & MOVIECLIP_PREVIEW_GRAYSCALE;
 
-		if(!postproc_ibuf)
+		if (!postproc_ibuf)
 			postproc_ibuf = IMB_dupImBuf(ibuf);
 
-		if(disable_red || disable_green || disable_blue || grayscale)
+		if (disable_red || disable_green || disable_blue || grayscale)
 			BKE_tracking_disable_imbuf_channels(postproc_ibuf, disable_red, disable_green, disable_blue, 1);
 	}
 
 	IMB_refImBuf(postproc_ibuf);
 
-	cache->postprocessed.ibuf= postproc_ibuf;
+	cache->postprocessed.ibuf = postproc_ibuf;
 
-	if(cache->stabilized.ibuf) {
+	if (cache->stabilized.ibuf) {
 		/* force stable buffer be re-calculated */
 		IMB_freeImBuf(cache->stabilized.ibuf);
-		cache->stabilized.ibuf= NULL;
+		cache->stabilized.ibuf = NULL;
 	}
 
 	return postproc_ibuf;
@@ -634,49 +695,50 @@ static ImBuf *put_postprocessed_frame_to_cache(MovieClip *clip, MovieClipUser *u
 static ImBuf *movieclip_get_postprocessed_ibuf(MovieClip *clip, MovieClipUser *user, int flag,
                                                int postprocess_flag, int cache_flag)
 {
-	ImBuf *ibuf= NULL;
-	int framenr= user->framenr, need_postprocess= 0;
+	ImBuf *ibuf = NULL;
+	int framenr = user->framenr, need_postprocess = FALSE;
 
 	/* cache isn't threadsafe itself and also loading of movies
-	   can't happen from concurent threads that's why we use lock here */
+	 * can't happen from concurent threads that's why we use lock here */
 	BLI_lock_thread(LOCK_MOVIECLIP);
 
 	/* try to obtain cached postprocessed frame first */
-	if(need_postprocessed_frame(user, flag, postprocess_flag)) {
+	if (need_postprocessed_frame(user, flag, postprocess_flag)) {
 		ibuf= get_postprocessed_cached_frame(clip, user, flag, postprocess_flag);
 
-		if(!ibuf)
-			need_postprocess= 1;
+		if (!ibuf)
+			need_postprocess = TRUE;
 	}
 
-	if(!ibuf)
+	if (!ibuf)
 		ibuf= get_imbuf_cache(clip, user, flag);
 
-	if(!ibuf) {
-		int use_sequence= 0;
+	if (!ibuf) {
+		int use_sequence = FALSE;
 
 		/* undistorted proxies for movies should be read as image sequence */
-		use_sequence= (user->render_flag&MCLIP_PROXY_RENDER_UNDISTORT) &&
-			(user->render_size!=MCLIP_PROXY_RENDER_SIZE_FULL);
+		use_sequence = (user->render_flag & MCLIP_PROXY_RENDER_UNDISTORT) &&
+		               (user->render_size != MCLIP_PROXY_RENDER_SIZE_FULL);
 
-		if(clip->source==MCLIP_SRC_SEQUENCE || use_sequence)
-			ibuf= movieclip_load_sequence_file(clip, user, framenr, flag);
+		if (clip->source == MCLIP_SRC_SEQUENCE || use_sequence) {
+			ibuf = movieclip_load_sequence_file(clip, user, framenr, flag);
+		}
 		else {
-			ibuf= movieclip_load_movie_file(clip, user, framenr, flag);
+			ibuf = movieclip_load_movie_file(clip, user, framenr, flag);
 		}
 
-		if(ibuf && (cache_flag & MOVIECLIP_CACHE_SKIP) == 0)
+		if (ibuf && (cache_flag & MOVIECLIP_CACHE_SKIP) == 0)
 			put_imbuf_cache(clip, user, ibuf, flag);
 	}
 
-	if(ibuf) {
-		clip->lastframe= framenr;
+	if (ibuf) {
+		clip->lastframe = framenr;
 		real_ibuf_size(clip, user, ibuf, &clip->lastsize[0], &clip->lastsize[1]);
 
 		/* postprocess frame and put to cache */
-		if(need_postprocess) {
-			ImBuf *tmpibuf= ibuf;
-			ibuf= put_postprocessed_frame_to_cache(clip, user, tmpibuf, flag, postprocess_flag);
+		if (need_postprocess) {
+			ImBuf *tmpibuf = ibuf;
+			ibuf = put_postprocessed_frame_to_cache(clip, user, tmpibuf, flag, postprocess_flag);
 			IMB_freeImBuf(tmpibuf);
 		}
 	}
@@ -701,25 +763,36 @@ ImBuf *BKE_movieclip_get_postprocessed_ibuf(MovieClip *clip, MovieClipUser *user
 	return movieclip_get_postprocessed_ibuf(clip, user, clip->flag, postprocess_flag, 0);
 }
 
-static ImBuf *get_stable_cached_frame(MovieClip *clip, MovieClipUser *user, int framenr)
+static ImBuf *get_stable_cached_frame(MovieClip *clip, MovieClipUser *user, int framenr, int postprocess_flag)
 {
 	MovieClipCache *cache = clip->cache;
+	MovieTracking *tracking = &clip->tracking;
 	ImBuf *stableibuf;
 	float tloc[2], tscale, tangle;
 	short proxy = IMB_PROXY_NONE;
 	int render_flag = 0;
 
-	if(clip->flag&MCLIP_USE_PROXY) {
+	if (clip->flag & MCLIP_USE_PROXY) {
 		proxy = rendersize_to_proxy(user, clip->flag);
 		render_flag = user->render_flag;
 	}
 
 	/* there's no cached frame or it was calculated for another frame */
-	if(!cache->stabilized.ibuf || cache->stabilized.framenr != framenr)
+	if (!cache->stabilized.ibuf || cache->stabilized.framenr != framenr)
 		return NULL;
 
 	/* cached ibuf used different proxy settings */
-	if(cache->stabilized.render_flag!=render_flag || cache->stabilized.proxy!=proxy)
+	if (cache->stabilized.render_flag != render_flag || cache->stabilized.proxy != proxy)
+		return NULL;
+
+	if (cache->stabilized.postprocess_flag != postprocess_flag)
+		return NULL;
+
+	/* stabilization also depends on pixel aspect ratio */
+	if (cache->stabilized.aspect != tracking->camera.pixel_aspect)
+		return NULL;
+
+	if (cache->stabilized.filter != tracking->stabilization.filter)
 		return NULL;
 
 	stableibuf = cache->stabilized.ibuf;
@@ -727,7 +800,7 @@ static ImBuf *get_stable_cached_frame(MovieClip *clip, MovieClipUser *user, int
 	BKE_tracking_stabilization_data(&clip->tracking, framenr, stableibuf->x, stableibuf->y, tloc, &tscale, &tangle);
 
 	/* check for stabilization parameters */
-	if(tscale != cache->stabilized.scale ||
+	if (tscale != cache->stabilized.scale ||
 	   tangle != cache->stabilized.angle ||
 	   !equals_v2v2(tloc, cache->stabilized.loc))
 	{
@@ -739,13 +812,15 @@ static ImBuf *get_stable_cached_frame(MovieClip *clip, MovieClipUser *user, int
 	return stableibuf;
 }
 
-static ImBuf *put_stabilized_frame_to_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf, int framenr)
+static ImBuf *put_stabilized_frame_to_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf,
+                                            int framenr, int postprocess_flag)
 {
 	MovieClipCache *cache = clip->cache;
+	MovieTracking *tracking = &clip->tracking;
 	ImBuf *stableibuf;
 	float tloc[2], tscale, tangle;
 
-	if(cache->stabilized.ibuf)
+	if (cache->stabilized.ibuf)
 		IMB_freeImBuf(cache->stabilized.ibuf);
 
 	stableibuf = BKE_tracking_stabilize(&clip->tracking, framenr, ibuf, tloc, &tscale, &tangle);
@@ -757,16 +832,20 @@ static ImBuf *put_stabilized_frame_to_cache(MovieClip *clip, MovieClipUser *user
 	cache->stabilized.scale = tscale;
 	cache->stabilized.angle = tangle;
 	cache->stabilized.framenr = framenr;
+	cache->stabilized.aspect = tracking->camera.pixel_aspect;
+	cache->stabilized.filter = tracking->stabilization.filter;
 
-	if(clip->flag&MCLIP_USE_PROXY) {
-		cache->stabilized.proxy= rendersize_to_proxy(user, clip->flag);
-		cache->stabilized.render_flag= user->render_flag;
+	if (clip->flag & MCLIP_USE_PROXY) {
+		cache->stabilized.proxy = rendersize_to_proxy(user, clip->flag);
+		cache->stabilized.render_flag = user->render_flag;
 	}
 	else {
 		cache->stabilized.proxy = IMB_PROXY_NONE;
 		cache->stabilized.render_flag = 0;
 	}
 
+	cache->stabilized.postprocess_flag = postprocess_flag;
+
 	IMB_refImBuf(stableibuf);
 
 	return stableibuf;
@@ -774,36 +853,47 @@ static ImBuf *put_stabilized_frame_to_cache(MovieClip *clip, MovieClipUser *user
 
 ImBuf *BKE_movieclip_get_stable_ibuf(MovieClip *clip, MovieClipUser *user, float loc[2], float *scale, float *angle, int postprocess_flag)
 {
-	ImBuf *ibuf, *stableibuf= NULL;
-	int framenr= user->framenr;
+	ImBuf *ibuf, *stableibuf = NULL;
+	int framenr = user->framenr;
 
-	ibuf= BKE_movieclip_get_postprocessed_ibuf(clip, user, postprocess_flag);
+	ibuf = BKE_movieclip_get_postprocessed_ibuf(clip, user, postprocess_flag);
 
-	if(!ibuf)
+	if (!ibuf)
 		return NULL;
 
-	if(clip->tracking.stabilization.flag&TRACKING_2D_STABILIZATION) {
+	if (clip->tracking.stabilization.flag & TRACKING_2D_STABILIZATION) {
 		MovieClipCache *cache= clip->cache;
 
-		stableibuf= get_stable_cached_frame(clip, user, framenr);
+		stableibuf = get_stable_cached_frame(clip, user, framenr, postprocess_flag);
+
+		if (!stableibuf)
+			stableibuf = put_stabilized_frame_to_cache(clip, user, ibuf, framenr, postprocess_flag);
 
-		if(!stableibuf)
-			stableibuf= put_stabilized_frame_to_cache(clip, user, ibuf, framenr);
+		if (loc)
+			copy_v2_v2(loc, cache->stabilized.loc);
 
-		if(loc)		copy_v2_v2(loc, cache->stabilized.loc);
-		if(scale)	*scale= cache->stabilized.scale;
-		if(angle)	*angle= cache->stabilized.angle;
-	} else {
-		if(loc)		zero_v2(loc);
-		if(scale)	*scale= 1.0f;
-		if(angle)	*angle= 0.0f;
+		if (scale)
+			*scale= cache->stabilized.scale;
 
-		stableibuf= ibuf;
+		if (angle)
+			*angle= cache->stabilized.angle;
 	}
+	else {
+		if (loc)
+			zero_v2(loc);
+
+		if (scale)
+			*scale= 1.0f;
 
-	if(stableibuf!=ibuf) {
+		if (angle)
+			*angle= 0.0f;
+
+		stableibuf = ibuf;
+	}
+
+	if (stableibuf != ibuf) {
 		IMB_freeImBuf(ibuf);
-		ibuf= stableibuf;
+		ibuf = stableibuf;
 	}
 
 	return ibuf;
@@ -812,52 +902,63 @@ ImBuf *BKE_movieclip_get_stable_ibuf(MovieClip *clip, MovieClipUser *user, float
 
 int BKE_movieclip_has_frame(MovieClip *clip, MovieClipUser *user)
 {
-	ImBuf *ibuf= BKE_movieclip_get_ibuf(clip, user);
+	ImBuf *ibuf = BKE_movieclip_get_ibuf(clip, user);
 
-	if(ibuf) {
+	if (ibuf) {
 		IMB_freeImBuf(ibuf);
-		return 1;
+		return TRUE;
 	}
 
-	return 0;
+	return FALSE;
 }
 
 void BKE_movieclip_get_size(MovieClip *clip, MovieClipUser *user, int *width, int *height)
 {
-	if(user->framenr==clip->lastframe) {
-		*width= clip->lastsize[0];
-		*height= clip->lastsize[1];
-	} else {
-		ImBuf *ibuf= BKE_movieclip_get_ibuf(clip, user);
+	if (user->framenr == clip->lastframe) {
+		*width = clip->lastsize[0];
+		*height = clip->lastsize[1];
+	}
+	else {
+		ImBuf *ibuf = BKE_movieclip_get_ibuf(clip, user);
 
-		if(ibuf && ibuf->x && ibuf->y) {
+		if (ibuf && ibuf->x && ibuf->y) {
 			real_ibuf_size(clip, user, ibuf, width, height);
-		} else {
-			*width= 0;
-			*height= 0;
+		}
+		else {
+			*width = 0;
+			*height = 0;
 		}
 
-		if(ibuf)
+		if (ibuf)
 			IMB_freeImBuf(ibuf);
 	}
 }
 
+int BKE_movieclip_get_duration(MovieClip *clip)
+{
+	if (!clip->len) {
+		movieclip_calc_length(clip);
+	}
+
+	return clip->len;
+}
+
 void BKE_movieclip_aspect(MovieClip *clip, float *aspx, float *aspy)
 {
-	*aspx= *aspy= 1.0;
+	*aspx = *aspy = 1.0;
 
 	/* x is always 1 */
-	*aspy = clip->aspy/clip->aspx/clip->tracking.camera.pixel_aspect;
+	*aspy = clip->aspy / clip->aspx / clip->tracking.camera.pixel_aspect;
 }
 
 /* get segments of cached frames. useful for debugging cache policies */
 void BKE_movieclip_get_cache_segments(MovieClip *clip, MovieClipUser *user, int *totseg_r, int **points_r)
 {
-	*totseg_r= 0;
-	*points_r= NULL;
+	*totseg_r = 0;
+	*points_r = NULL;
 
-	if(clip->cache) {
-		int proxy= rendersize_to_proxy(user, clip->flag);
+	if (clip->cache) {
+		int proxy = rendersize_to_proxy(user, clip->flag);
 
 		IMB_moviecache_get_cache_segments(clip->cache->moviecache, proxy, user->render_flag, totseg_r, points_r);
 	}
@@ -867,28 +968,30 @@ void BKE_movieclip_user_set_frame(MovieClipUser *iuser, int framenr)
 {
 	/* TODO: clamp framenr here? */
 
-	iuser->framenr= framenr;
+	iuser->framenr = framenr;
 }
 
 static void free_buffers(MovieClip *clip)
 {
-	if(clip->cache) {
+	if (clip->cache) {
 		IMB_moviecache_free(clip->cache->moviecache);
 
-		if(clip->cache->postprocessed.ibuf)
+		if (clip->cache->postprocessed.ibuf)
 			IMB_freeImBuf(clip->cache->postprocessed.ibuf);
 
-		if(clip->cache->stabilized.ibuf)
+		if (clip->cache->stabilized.ibuf)
 			IMB_freeImBuf(clip->cache->stabilized.ibuf);
 
 		MEM_freeN(clip->cache);
-		clip->cache= NULL;
+		clip->cache = NULL;
 	}
 
-	if(clip->anim) {
+	if (clip->anim) {
 		IMB_free_anim(clip->anim);
-		clip->anim= FALSE;
+		clip->anim = NULL;
 	}
+
+	BKE_free_animdata((ID *) clip);
 }
 
 void BKE_movieclip_reload(MovieClip *clip)
@@ -896,67 +999,72 @@ void BKE_movieclip_reload(MovieClip *clip)
 	/* clear cache */
 	free_buffers(clip);
 
-	clip->tracking.stabilization.ok= 0;
+	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;
+	if (BLI_testextensie_array(clip->name, imb_ext_movie))
+		clip->source = MCLIP_SRC_MOVIE;
+	else
+		clip->source = MCLIP_SRC_SEQUENCE;
+
+	movieclip_calc_length(clip);
 }
 
 void BKE_movieclip_update_scopes(MovieClip *clip, MovieClipUser *user, MovieClipScopes *scopes)
 {
-	if(scopes->ok)
+	if (scopes->ok)
 		return;
 
-	if(scopes->track_preview) {
+	if (scopes->track_preview) {
 		IMB_freeImBuf(scopes->track_preview);
-		scopes->track_preview= NULL;
+		scopes->track_preview = NULL;
 	}
 
-	scopes->marker= NULL;
-	scopes->track= NULL;
+	scopes->marker = NULL;
+	scopes->track = NULL;
 
-	if(clip) {
-		MovieTrackingTrack *act_track= BKE_tracking_active_track(&clip->tracking);
+	if (clip) {
+		MovieTrackingTrack *act_track = BKE_tracking_active_track(&clip->tracking);
 
-		if(act_track) {
-			MovieTrackingTrack *track= act_track;
-			MovieTrackingMarker *marker= BKE_tracking_get_marker(track, user->framenr);
+		if (act_track) {
+			MovieTrackingTrack *track = act_track;
+			MovieTrackingMarker *marker = BKE_tracking_get_marker(track, user->framenr);
 
-			if(marker->flag&MARKER_DISABLED) {
-				scopes->track_disabled= 1;
-			} else {
-				ImBuf *ibuf= BKE_movieclip_get_ibuf(clip, user);
+			if (marker->flag & MARKER_DISABLED) {
+				scopes->track_disabled = TRUE;
+			}
+			else {
+				ImBuf *ibuf = BKE_movieclip_get_ibuf(clip, user);
 
-				scopes->track_disabled= 0;
+				scopes->track_disabled = FALSE;
 
-				if(ibuf && ibuf->rect) {
+				if (ibuf && ibuf->rect) {
 					ImBuf *tmpibuf;
-					MovieTrackingMarker undist_marker= *marker;
+					MovieTrackingMarker undist_marker = *marker;
 
-					if(user->render_flag&MCLIP_PROXY_RENDER_UNDISTORT) {
+					if (user->render_flag & MCLIP_PROXY_RENDER_UNDISTORT) {
 						int width, height;
-						float aspy= 1.0f/clip->tracking.camera.pixel_aspect;;
+						float aspy= 1.0f / clip->tracking.camera.pixel_aspect;
 
 						BKE_movieclip_get_size(clip, user, &width, &height);
 
-						undist_marker.pos[0]*= width;
-						undist_marker.pos[1]*= height*aspy;
+						undist_marker.pos[0] *= width;
+						undist_marker.pos[1] *= height*aspy;
 
 						BKE_tracking_invert_intrinsics(&clip->tracking, undist_marker.pos, undist_marker.pos);
 
-						undist_marker.pos[0]/= width;
-						undist_marker.pos[1]/= height*aspy;
+						undist_marker.pos[0] /= width;
+						undist_marker.pos[1] /= height*aspy;
 					}
 
 					/* NOTE: margin should be kept in sync with value from ui_draw_but_TRACKPREVIEW */
 					tmpibuf= BKE_tracking_get_pattern_imbuf(ibuf, track, &undist_marker, 3 /* margin */,
 							1 /* anchor */, scopes->track_pos, NULL);
 
-					if(tmpibuf->rect_float)
+					if (tmpibuf->rect_float)
 						IMB_rect_from_float(tmpibuf);
 
-					if(tmpibuf->rect)
+					if (tmpibuf->rect)
 						scopes->track_preview= tmpibuf;
 					else
 						IMB_freeImBuf(tmpibuf);
@@ -965,46 +1073,46 @@ void BKE_movieclip_update_scopes(MovieClip *clip, MovieClipUser *user, MovieClip
 				IMB_freeImBuf(ibuf);
 			}
 
-			if((track->flag&TRACK_LOCKED)==0) {
-				scopes->marker= marker;
-				scopes->track= track;
-				scopes->slide_scale[0]= track->pat_max[0]-track->pat_min[0];
-				scopes->slide_scale[1]= track->pat_max[1]-track->pat_min[1];
+			if ((track->flag & TRACK_LOCKED)==0) {
+				scopes->marker = marker;
+				scopes->track = track;
+				scopes->slide_scale[0] = track->pat_max[0]-track->pat_min[0];
+				scopes->slide_scale[1] = track->pat_max[1]-track->pat_min[1];
 			}
 		}
 	}
 
-	scopes->framenr= user->framenr;
-	scopes->ok= 1;
+	scopes->framenr = user->framenr;
+	scopes->ok = TRUE;
 }
 
 static void movieclip_build_proxy_ibuf(MovieClip *clip, ImBuf *ibuf, int cfra, int proxy_render_size, int undistorted)
 {
 	char name[FILE_MAX];
 	int quality, rectx, recty;
-	int size= rendersize_to_number(proxy_render_size);
+	int size = rendersize_to_number(proxy_render_size);
 	ImBuf *scaleibuf;
 
 	get_proxy_fname(clip, proxy_render_size, undistorted, cfra, name);
 
-	rectx= ibuf->x*size/100.0f;
-	recty= ibuf->y*size/100.0f;
+	rectx = ibuf->x * size / 100.0f;
+	recty = ibuf->y * size / 100.0f;
 
-	scaleibuf= IMB_dupImBuf(ibuf);
+	scaleibuf = IMB_dupImBuf(ibuf);
 
 	IMB_scaleImBuf(scaleibuf, (short)rectx, (short)recty);
 
-	quality= clip->proxy.quality;
-	scaleibuf->ftype= JPG | quality;
+	quality = clip->proxy.quality;
+	scaleibuf->ftype = JPG | quality;
 
 	/* unsupported feature only confuses other s/w */
-	if(scaleibuf->planes==32)
-		scaleibuf->planes= 24;
+	if (scaleibuf->planes == 32)
+		scaleibuf->planes = 24;
 
 	BLI_lock_thread(LOCK_MOVIECLIP);
 
 	BLI_make_existing_file(name);
-	if(IMB_saveiff(scaleibuf, name, IB_rect)==0)
+	if (IMB_saveiff(scaleibuf, name, IB_rect) == 0)
 		perror(name);
 
 	BLI_unlock_thread(LOCK_MOVIECLIP);
@@ -1013,30 +1121,30 @@ static void movieclip_build_proxy_ibuf(MovieClip *clip, ImBuf *ibuf, int cfra, i
 }
 
 void BKE_movieclip_build_proxy_frame(MovieClip *clip, int clip_flag, struct MovieDistortion *distortion,
-			int cfra, int *build_sizes, int build_count, int undistorted)
+                                     int cfra, int *build_sizes, int build_count, int undistorted)
 {
 	ImBuf *ibuf;
 	MovieClipUser user;
 
-	user.framenr= cfra;
-	user.render_flag= 0;
-	user.render_size= MCLIP_PROXY_RENDER_SIZE_FULL;
+	user.framenr = cfra;
+	user.render_flag = 0;
+	user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL;
 
-	ibuf= BKE_movieclip_get_ibuf_flag(clip, &user, clip_flag, MOVIECLIP_CACHE_SKIP);
+	ibuf = BKE_movieclip_get_ibuf_flag(clip, &user, clip_flag, MOVIECLIP_CACHE_SKIP);
 
-	if(ibuf) {
-		ImBuf *tmpibuf= ibuf;
+	if (ibuf) {
+		ImBuf *tmpibuf = ibuf;
 		int i;
 
-		if(undistorted)
-			tmpibuf= get_undistorted_ibuf(clip, distortion, ibuf);
+		if (undistorted)
+			tmpibuf = get_undistorted_ibuf(clip, distortion, ibuf);
 
-		for(i= 0; i<build_count; i++)
+		for (i = 0; i < build_count; i++)
 			movieclip_build_proxy_ibuf(clip, tmpibuf, cfra, build_sizes[i], undistorted);
 
 		IMB_freeImBuf(ibuf);
 
-		if(tmpibuf!=ibuf)
+		if (tmpibuf != ibuf)
 			IMB_freeImBuf(tmpibuf);
 	}
 }
@@ -1056,53 +1164,59 @@ void unlink_movieclip(Main *bmain, MovieClip *clip)
 	Scene *sce;
 	Object *ob;
 
-	for(scr= bmain->screen.first; scr; scr= scr->id.next) {
-		for(area= scr->areabase.first; area; area= area->next) {
-			for(sl= area->spacedata.first; sl; sl= sl->next) {
-				if(sl->spacetype==SPACE_CLIP) {
-					SpaceClip *sc= (SpaceClip *) sl;
+	for (scr = bmain->screen.first; scr; scr = scr->id.next) {
+		for (area = scr->areabase.first; area; area = area->next) {
+			for (sl = area->spacedata.first; sl; sl = sl->next) {
+				if (sl->spacetype == SPACE_CLIP) {
+					SpaceClip *sc = (SpaceClip *) sl;
 
-					if(sc->clip==clip)
-						sc->clip= NULL;
+					if (sc->clip == clip)
+						sc->clip = NULL;
 				}
-				else if(sl->spacetype==SPACE_VIEW3D) {
-					View3D *v3d= (View3D *) sl;
+				else if (sl->spacetype == SPACE_VIEW3D) {
+					View3D *v3d = (View3D *) sl;
 					BGpic *bgpic;
 
-					for(bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next) {
-						if(bgpic->clip==clip)
-							bgpic->clip= NULL;
+					for (bgpic = v3d->bgpicbase.first; bgpic; bgpic = bgpic->next) {
+						if (bgpic->clip == clip)
+							bgpic->clip = NULL;
 					}
 				}
 			}
 		}
 	}
 
-	for(sce= bmain->scene.first; sce; sce= sce->id.next) {
-		if(sce->clip==clip)
-			sce->clip= NULL;
+	for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+		if (sce->clip == clip)
+			sce->clip = NULL;
 	}
 
-	for(ob= bmain->object.first; ob; ob= ob->id.next) {
+	for (ob = bmain->object.first; ob; ob = ob->id.next) {
 		bConstraint *con;
 
-		for(con= ob->constraints.first; con; con= con->next) {
-			bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
+		for (con = ob->constraints.first; con; con = con->next) {
+			bConstraintTypeInfo *cti = constraint_get_typeinfo(con);
 
-			if(cti->type==CONSTRAINT_TYPE_FOLLOWTRACK) {
-				bFollowTrackConstraint *data= (bFollowTrackConstraint *) con->data;
+			if (cti->type == CONSTRAINT_TYPE_FOLLOWTRACK) {
+				bFollowTrackConstraint *data = (bFollowTrackConstraint *) con->data;
+
+				if (data->clip == clip)
+					data->clip = NULL;
+			}
+			else if (cti->type == CONSTRAINT_TYPE_CAMERASOLVER) {
+				bCameraSolverConstraint *data = (bCameraSolverConstraint *) con->data;
 
-				if(data->clip==clip)
-					data->clip= NULL;
+				if (data->clip == clip)
+					data->clip = NULL;
 			}
-			else if(cti->type==CONSTRAINT_TYPE_CAMERASOLVER) {
-				bCameraSolverConstraint *data= (bCameraSolverConstraint *) con->data;
+			else if (cti->type == CONSTRAINT_TYPE_OBJECTSOLVER) {
+				bObjectSolverConstraint *data = (bObjectSolverConstraint *) con->data;
 
-				if(data->clip==clip)
-					data->clip= NULL;
+				if (data->clip == clip)
+					data->clip = NULL;
 			}
 		}
 	}
 
-	clip->id.us= 0;
+	clip->id.us = 0;
 }
diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c
index 3fb49d5..7580f2e 100644
--- a/source/blender/blenkernel/intern/multires.c
+++ b/source/blender/blenkernel/intern/multires.c
@@ -40,10 +40,10 @@
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 
+#include "BLI_bitmap.h"
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
 #include "BLI_pbvh.h"
-#include "BLI_editVert.h"
 #include "BLI_utildefines.h"
 
 #include "BKE_cdderivedmesh.h"
@@ -53,6 +53,7 @@
 #include "BKE_paint.h"
 #include "BKE_scene.h"
 #include "BKE_subsurf.h"
+#include "BKE_tessmesh.h"
 
 #include "BKE_object.h"
 
@@ -66,8 +67,210 @@ static const int multires_max_levels = 13;
 static const int multires_grid_tot[] = {0, 4, 9, 25, 81, 289, 1089, 4225, 16641, 66049, 263169, 1050625, 4198401, 16785409};
 static const int multires_side_tot[] = {0, 2, 3, 5,  9,  17,  33,   65,   129,   257,   513,    1025,    2049,    4097};
 
+/* See multiresModifier_disp_run for description of each operation */
+typedef enum {
+	APPLY_DISPLACEMENTS,
+	CALC_DISPLACEMENTS,
+	ADD_DISPLACEMENTS,
+} DispOp;
+
 static void multires_mvert_to_ss(DerivedMesh *dm, MVert *mvert);
-static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, int invert, int add, DMGridData **oldGridData, int totlvl);
+static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm2, DispOp op, DMGridData **oldGridData, int totlvl);
+
+/** Customdata **/
+
+void multires_customdata_delete(Mesh *me)
+{
+	if (me->edit_btmesh) {
+		BMEditMesh *em= me->edit_btmesh;
+		/* CustomData_external_remove is used here only to mark layer
+		 * as non-external for further free-ing, so zero element count
+		 * looks safer than em->totface */
+		CustomData_external_remove(&em->bm->ldata, &me->id,
+								   CD_MDISPS, 0);
+		BM_data_layer_free(em->bm, &em->bm->ldata, CD_MDISPS);
+	}
+	else {
+		CustomData_external_remove(&me->ldata, &me->id,
+								   CD_MDISPS, me->totloop);
+		CustomData_free_layer_active(&me->ldata, CD_MDISPS,
+									 me->totloop);
+	}
+}
+
+/** Grid hiding **/
+static BLI_bitmap multires_mdisps_upsample_hidden(BLI_bitmap lo_hidden,
+												  int lo_level,
+												  int hi_level,
+									 
+												  /* assumed to be at hi_level (or
+												   *  null) */
+												  BLI_bitmap prev_hidden)
+{
+	BLI_bitmap subd;
+	int hi_gridsize = ccg_gridsize(hi_level);
+	int lo_gridsize = ccg_gridsize(lo_level);
+	int yh, xh, xl, yl, xo, yo, hi_ndx;
+	int offset, factor;
+
+	BLI_assert(lo_level <= hi_level);
+
+	/* fast case */
+	if (lo_level == hi_level)
+		return MEM_dupallocN(lo_hidden);
+
+	subd = BLI_BITMAP_NEW(hi_gridsize * hi_gridsize, "MDisps.hidden upsample");
+
+	factor = ccg_factor(lo_level, hi_level);
+	offset = 1 << (hi_level - lo_level - 1);
+
+	/* low-res blocks */
+	for (yl = 0; yl < lo_gridsize; yl++) {
+		for (xl = 0; xl < lo_gridsize; xl++) {
+			int lo_val = BLI_BITMAP_GET(lo_hidden, yl * lo_gridsize + xl);
+
+			/* high-res blocks */
+			for (yo = -offset; yo <= offset; yo++) {
+				yh = yl * factor + yo;
+				if (yh < 0 || yh >= hi_gridsize)
+					continue;
+
+				for (xo = -offset; xo <= offset; xo++) {
+					xh = xl * factor + xo;
+					if (xh < 0 || xh >= hi_gridsize)
+						continue;
+
+					hi_ndx = yh * hi_gridsize + xh;
+
+					if (prev_hidden) {
+						/* If prev_hidden is available, copy it to
+						 * subd, except when the equivalent element in
+						 * lo_hidden is different */
+						if (lo_val != prev_hidden[hi_ndx])
+							BLI_BITMAP_MODIFY(subd, hi_ndx, lo_val);
+						else
+							BLI_BITMAP_MODIFY(subd, hi_ndx, prev_hidden[hi_ndx]);
+					}
+					else {
+						BLI_BITMAP_MODIFY(subd, hi_ndx, lo_val);
+					}
+				}
+			}
+		}
+	}
+
+	return subd;
+}
+
+static BLI_bitmap multires_mdisps_downsample_hidden(BLI_bitmap old_hidden,
+													int old_level,
+													int new_level)
+{
+	BLI_bitmap new_hidden;
+	int new_gridsize = ccg_gridsize(new_level);
+	int old_gridsize = ccg_gridsize(old_level);
+	int x, y, factor, old_value;
+
+	BLI_assert(new_level <= old_level);
+	factor = ccg_factor(new_level, old_level);
+	new_hidden = BLI_BITMAP_NEW(new_gridsize * new_gridsize,
+								"downsample hidden");
+
+
+
+	for (y = 0; y < new_gridsize; y++) {
+		for (x = 0; x < new_gridsize; x++) {
+			old_value = BLI_BITMAP_GET(old_hidden,
+									   factor*y*old_gridsize + x*factor);
+			
+			BLI_BITMAP_MODIFY(new_hidden, y*new_gridsize + x, old_value);
+		}
+	}
+
+	return new_hidden;
+}
+
+static void multires_output_hidden_to_ccgdm(CCGDerivedMesh *ccgdm,
+											Mesh *me, int level)
+{
+	const MDisps *mdisps = CustomData_get_layer(&me->ldata, CD_MDISPS);
+	BLI_bitmap *grid_hidden = ccgdm->gridHidden;
+	int *gridOffset;
+	int i, j;
+	
+	gridOffset = ccgdm->dm.getGridOffset(&ccgdm->dm);
+
+	for (i = 0; i < me->totpoly; i++) {
+		for (j = 0; j < me->mpoly[i].totloop; j++) {
+			int g = gridOffset[i] + j;
+			const MDisps *md = &mdisps[g];
+			BLI_bitmap gh = md->hidden;
+			
+			if (gh) {
+				grid_hidden[g] =
+					multires_mdisps_downsample_hidden(gh, md->level, level);
+			}
+		}
+	}
+}
+
+/* subdivide mdisps.hidden if needed (assumes that md.level reflects
+ * the current level of md.hidden) */
+static void multires_mdisps_subdivide_hidden(MDisps *md, int new_level)
+{
+	BLI_bitmap subd;
+	
+	BLI_assert(md->hidden);
+
+	/* nothing to do if already subdivided enough */
+	if (md->level >= new_level)
+		return;
+
+	subd = multires_mdisps_upsample_hidden(md->hidden,
+										   md->level,
+										   new_level,
+										   NULL);
+	
+	/* swap in the subdivided data */
+	MEM_freeN(md->hidden);
+	md->hidden = subd;
+}
+
+static MDisps *multires_mdisps_initialize_hidden(Mesh *me, int level)
+{
+	MDisps *mdisps = CustomData_add_layer(&me->ldata, CD_MDISPS,
+										  CD_CALLOC, 0, me->totloop);
+	int gridsize = ccg_gridsize(level);
+	int gridarea = gridsize * gridsize;
+	int i, j, k;
+	
+	for (i = 0; i < me->totpoly; i++) {
+		int hide = 0;
+
+		for (j = 0; j < me->mpoly[i].totloop; j++) {
+			if (me->mvert[me->mloop[me->mpoly[i].loopstart + j].v].flag & ME_HIDE) {
+				hide = 1;
+				break;
+			}
+		}
+
+		if (!hide)
+			continue;
+
+		for (j = 0; j < me->mpoly[i].totloop; j++) {
+			MDisps *md = &mdisps[me->mpoly[i].loopstart + j];
+
+			BLI_assert(!md->hidden);
+
+			md->hidden = BLI_BITMAP_NEW(gridarea, "MDisps.hidden initialize");
+
+			for (k = 0; k < gridarea; k++)
+				BLI_BITMAP_SET(md->hidden, k);
+		}
+	}
+
+	return mdisps;
+}
 
 DerivedMesh *get_multires_dm(Scene *scene, MultiresModifierData *mmd, Object *ob)
 {
@@ -88,8 +291,8 @@ MultiresModifierData *find_multires_modifier_before(Scene *scene, ModifierData *
 {
 	ModifierData *md;
 
-	for(md = lastmd; md; md = md->prev) {
-		if(md->type == eModifierType_Multires) {
+	for (md = lastmd; md; md = md->prev) {
+		if (md->type == eModifierType_Multires) {
 			if (modifier_isEnabled(scene, md, eModifierMode_Realtime))
 				return (MultiresModifierData*)md;
 		}
@@ -99,17 +302,17 @@ MultiresModifierData *find_multires_modifier_before(Scene *scene, ModifierData *
 }
 
 /* used for applying scale on mdisps layer and syncing subdivide levels when joining objects
-   use_first - return first multires modifier if all multires'es are disabled
-*/
+ * use_first - return first multires modifier if all multires'es are disabled
+ */
 MultiresModifierData *get_multires_modifier(Scene *scene, Object *ob, int use_first)
 {
 	ModifierData *md;
 	MultiresModifierData *mmd= NULL, *firstmmd= NULL;
 
 	/* find first active multires modifier */
-	for(md = ob->modifiers.first; md; md = md->next) {
-		if(md->type == eModifierType_Multires) {
-			if(!firstmmd)
+	for (md = ob->modifiers.first; md; md = md->next) {
+		if (md->type == eModifierType_Multires) {
+			if (!firstmmd)
 				firstmmd= (MultiresModifierData*)md;
 
 			if (modifier_isEnabled(scene, md, eModifierMode_Realtime)) {
@@ -119,9 +322,9 @@ MultiresModifierData *get_multires_modifier(Scene *scene, Object *ob, int use_fi
 		}
 	}
 
-	if(!mmd && use_first) {
+	if (!mmd && use_first) {
 		/* active multires have not been found
-		   try to use first one */
+		 * try to use first one */
 		return firstmmd;
 	}
 
@@ -130,9 +333,9 @@ MultiresModifierData *get_multires_modifier(Scene *scene, Object *ob, int use_fi
 
 static int multires_get_level(Object *ob, MultiresModifierData *mmd, int render)
 {
-	if(render)
+	if (render)
 		return (mmd->modifier.scene)? get_render_subsurf_level(&mmd->modifier.scene->r, mmd->renderlvl): mmd->renderlvl;
-	else if(ob->mode == OB_MODE_SCULPT)
+	else if (ob->mode == OB_MODE_SCULPT)
 		return mmd->sculptlvl;
 	else
 		return (mmd->modifier.scene)? get_render_subsurf_level(&mmd->modifier.scene->r, mmd->lvl): mmd->lvl;
@@ -142,34 +345,34 @@ static void multires_set_tot_level(Object *ob, MultiresModifierData *mmd, int lv
 {
 	mmd->totlvl = lvl;
 
-	if(ob->mode != OB_MODE_SCULPT)
+	if (ob->mode != OB_MODE_SCULPT)
 		mmd->lvl = CLAMPIS(MAX2(mmd->lvl, lvl), 0, mmd->totlvl);
 
 	mmd->sculptlvl = CLAMPIS(MAX2(mmd->sculptlvl, lvl), 0, mmd->totlvl);
 	mmd->renderlvl = CLAMPIS(MAX2(mmd->renderlvl, lvl), 0, mmd->totlvl);
 }
 
-static void multires_dm_mark_as_modified(DerivedMesh *dm)
+static void multires_dm_mark_as_modified(DerivedMesh *dm, MultiresModifiedFlags flags)
 {
 	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*)dm;
-	ccgdm->multires.modified = 1;
+	ccgdm->multires.modified_flags |= flags;
 }
 
-void multires_mark_as_modified(Object *ob)
+void multires_mark_as_modified(Object *ob, MultiresModifiedFlags flags)
 {
-	if(ob && ob->derivedFinal)
-		multires_dm_mark_as_modified(ob->derivedFinal);
+	if (ob && ob->derivedFinal)
+		multires_dm_mark_as_modified(ob->derivedFinal, flags);
 }
 
 void multires_force_update(Object *ob)
 {
-	if(ob) {
-		if(ob->derivedFinal) {
+	if (ob) {
+		if (ob->derivedFinal) {
 			ob->derivedFinal->needsFree =1;
 			ob->derivedFinal->release(ob->derivedFinal);
 			ob->derivedFinal = NULL;
 		}
-		if(ob->sculpt && ob->sculpt->pbvh) {
+		if (ob->sculpt && ob->sculpt->pbvh) {
 			BLI_pbvh_free(ob->sculpt->pbvh);
 			ob->sculpt->pbvh= NULL;
 		}
@@ -180,13 +383,13 @@ void multires_force_external_reload(Object *ob)
 {
 	Mesh *me = get_mesh(ob);
 
-	CustomData_external_reload(&me->fdata, &me->id, CD_MASK_MDISPS, me->totface);
+	CustomData_external_reload(&me->ldata, &me->id, CD_MASK_MDISPS, me->totloop);
 	multires_force_update(ob);
 }
 
 void multires_force_render_update(Object *ob)
 {
-	if(ob && (ob->mode & OB_MODE_SCULPT) && modifiers_findByType(ob, eModifierType_Multires))
+	if (ob && (ob->mode & OB_MODE_SCULPT) && modifiers_findByType(ob, eModifierType_Multires))
 		multires_force_update(ob);
 }
 
@@ -195,10 +398,10 @@ int multiresModifier_reshapeFromDM(Scene *scene, MultiresModifierData *mmd,
 {
 	DerivedMesh *mrdm = get_multires_dm (scene, mmd, ob);
 
-	if(mrdm && srcdm && mrdm->getNumVerts(mrdm) == srcdm->getNumVerts(srcdm)) {
+	if (mrdm && srcdm && mrdm->getNumVerts(mrdm) == srcdm->getNumVerts(srcdm)) {
 		multires_mvert_to_ss(mrdm, srcdm->getVertArray(srcdm));
 
-		multires_dm_mark_as_modified(mrdm);
+		multires_dm_mark_as_modified(mrdm, MULTIRES_COORDS_MODIFIED);
 		multires_force_update(ob);
 
 		mrdm->release(mrdm);
@@ -206,7 +409,7 @@ int multiresModifier_reshapeFromDM(Scene *scene, MultiresModifierData *mmd,
 		return 1;
 	}
 
-	if(mrdm) mrdm->release(mrdm);
+	if (mrdm) mrdm->release(mrdm);
 
 	return 0;
 }
@@ -226,7 +429,7 @@ int multiresModifier_reshapeFromDeformMod(Scene *scene, MultiresModifierData *mm
 	int numVerts, result;
 	float (*deformedVerts)[3];
 
-	if(multires_get_level(ob, mmd, 0) == 0)
+	if (multires_get_level(ob, mmd, 0) == 0)
 		return 0;
 
 	/* Create DerivedMesh for deformation modifier */
@@ -256,26 +459,30 @@ int multiresModifier_reshapeFromDeformMod(Scene *scene, MultiresModifierData *mm
 static int get_levels_from_disps(Object *ob)
 {
 	Mesh *me = ob->data;
-	MDisps *mdisp;
-	int i, totlvl= 0;
-
-	mdisp = CustomData_get_layer(&me->fdata, CD_MDISPS);
-
-	for(i = 0; i < me->totface; ++i, ++mdisp) {
-		int S = me->mface[i].v4 ? 4 : 3;
+	MDisps *mdisp, *md;
+	int i, j, totlvl= 0;
 
-		if(mdisp->totdisp == 0) continue;
+	mdisp = CustomData_get_layer(&me->ldata, CD_MDISPS);
 
-		while(1) {
-			int side = (1 << (totlvl-1)) + 1;
-			int lvl_totdisp = side*side*S;
-			if(mdisp->totdisp == lvl_totdisp)
-				break;
-			else if(mdisp->totdisp < lvl_totdisp)
-				--totlvl;
-			else
-				++totlvl;
+	for (i = 0; i < me->totpoly; ++i) {
+		md = mdisp + me->mpoly[i].loopstart;
 
+		for (j=0; j<me->mpoly[i].totloop; j++, md++) {
+			if (md->totdisp == 0) continue;
+	
+			while (1) {
+				int side = (1 << (totlvl-1)) + 1;
+				int lvl_totdisp = side*side;
+				if (md->totdisp == lvl_totdisp)
+					break;
+				else if (md->totdisp < lvl_totdisp)
+					--totlvl;
+				else
+					++totlvl;
+	
+			}
+			
+			break;
 		}
 	}
 
@@ -288,12 +495,12 @@ void multiresModifier_set_levels_from_disps(MultiresModifierData *mmd, Object *o
 	Mesh *me = ob->data;
 	MDisps *mdisp;
 
-	if(me->edit_mesh)
-		mdisp = CustomData_get_layer(&me->edit_mesh->fdata, CD_MDISPS);
+	if (me->edit_btmesh)
+		mdisp = CustomData_get_layer(&me->edit_btmesh->bm->ldata, CD_MDISPS);
 	else
-		mdisp = CustomData_get_layer(&me->fdata, CD_MDISPS);
+		mdisp = CustomData_get_layer(&me->ldata, CD_MDISPS);
 
-	if(mdisp) {
+	if (mdisp) {
 		mmd->totlvl = get_levels_from_disps(ob);
 		mmd->lvl = MIN2(mmd->sculptlvl, mmd->totlvl);
 		mmd->sculptlvl = MIN2(mmd->sculptlvl, mmd->totlvl);
@@ -303,34 +510,35 @@ void multiresModifier_set_levels_from_disps(MultiresModifierData *mmd, Object *o
 
 static void multires_set_tot_mdisps(Mesh *me, int lvl)
 {
-	MDisps *mdisps= CustomData_get_layer(&me->fdata, CD_MDISPS);
+	MDisps *mdisps= CustomData_get_layer(&me->ldata, CD_MDISPS);
 	int i;
 
-	if(mdisps) {
-		for(i = 0; i < me->totface; i++) {
-			if(mdisps[i].totdisp == 0) {
-				int nvert = (me->mface[i].v4)? 4: 3;
-				mdisps[i].totdisp = multires_grid_tot[lvl]*nvert;
-			}
+	if (mdisps) {
+		for (i = 0; i < me->totloop; i++, mdisps++) {
+			mdisps->totdisp = multires_grid_tot[lvl];
+			mdisps->level = lvl;
 		}
 	}
 }
 
-static void multires_reallocate_mdisps(Mesh *me, MDisps *mdisps, int lvl)
+static void multires_reallocate_mdisps(int totloop, MDisps *mdisps, int lvl)
 {
 	int i;
 
 	/* reallocate displacements to be filled in */
-	for(i = 0; i < me->totface; ++i) {
-		int nvert = (me->mface[i].v4)? 4: 3;
-		int totdisp = multires_grid_tot[lvl]*nvert;
+	for (i = 0; i < totloop; ++i) {
+		int totdisp = multires_grid_tot[lvl];
 		float (*disps)[3] = MEM_callocN(sizeof(float) * 3 * totdisp, "multires disps");
 
-		if(mdisps[i].disps)
+		if (mdisps[i].disps)
 			MEM_freeN(mdisps[i].disps);
+		
+		if (mdisps[i].level && mdisps[i].hidden)
+			multires_mdisps_subdivide_hidden(&mdisps[i], lvl);
 
 		mdisps[i].disps = disps;
 		mdisps[i].totdisp = totdisp;
+		mdisps[i].level = lvl;
 	}
 }
 
@@ -345,18 +553,18 @@ static void multires_copy_grid(float (*gridA)[3], float (*gridB)[3], int sizeA,
 {
 	int x, y, j, skip;
 
-	if(sizeA > sizeB) {
+	if (sizeA > sizeB) {
 		skip = (sizeA-1)/(sizeB-1);
 
-		for(j = 0, y = 0; y < sizeB; y++)
-			for(x = 0; x < sizeB; x++, j++)
+		for (j = 0, y = 0; y < sizeB; y++)
+			for (x = 0; x < sizeB; x++, j++)
 				copy_v3_v3(gridA[y*skip*sizeA + x*skip], gridB[j]);
 	}
 	else {
 		skip = (sizeB-1)/(sizeA-1);
 
-		for(j = 0, y = 0; y < sizeA; y++)
-			for(x = 0; x < sizeA; x++, j++)
+		for (j = 0, y = 0; y < sizeA; y++)
+			for (x = 0; x < sizeA; x++, j++)
 				copy_v3_v3(gridA[j], gridB[y*skip*sizeB + x*skip]);
 	}
 }
@@ -365,18 +573,18 @@ static void multires_copy_dm_grid(DMGridData *gridA, DMGridData *gridB, int size
 {
 	int x, y, j, skip;
 
-	if(sizeA > sizeB) {
+	if (sizeA > sizeB) {
 		skip = (sizeA-1)/(sizeB-1);
 
-		for(j = 0, y = 0; y < sizeB; y++)
-			for(x = 0; x < sizeB; x++, j++)
+		for (j = 0, y = 0; y < sizeB; y++)
+			for (x = 0; x < sizeB; x++, j++)
 				copy_v3_v3(gridA[y*skip*sizeA + x*skip].co, gridB[j].co);
 	}
 	else {
 		skip = (sizeB-1)/(sizeA-1);
 
-		for(j = 0, y = 0; y < sizeA; y++)
-			for(x = 0; x < sizeA; x++, j++)
+		for (j = 0, y = 0; y < sizeA; y++)
+			for (x = 0; x < sizeA; x++, j++)
 				copy_v3_v3(gridA[j].co, gridB[y*skip*sizeB + x*skip].co);
 	}
 }
@@ -388,44 +596,51 @@ static void multires_del_higher(MultiresModifierData *mmd, Object *ob, int lvl)
 	MDisps *mdisps;
 
 	multires_set_tot_mdisps(me, mmd->totlvl);
-	CustomData_external_read(&me->fdata, &me->id, CD_MASK_MDISPS, me->totface);
-	mdisps= CustomData_get_layer(&me->fdata, CD_MDISPS);
+	CustomData_external_read(&me->ldata, &me->id, CD_MASK_MDISPS, me->totloop);
+	mdisps= CustomData_get_layer(&me->ldata, CD_MDISPS);
 
 	multires_force_update(ob);
 
-	if(mdisps && levels > 0) {
-		if(lvl > 0) {
+	if (mdisps && levels > 0) {
+		if (lvl > 0) {
+			/* MLoop *ml = me->mloop; */ /*UNUSED*/
 			int nsize = multires_side_tot[lvl];
 			int hsize = multires_side_tot[mmd->totlvl];
-			int i;
+			int i, j;
 
-			for(i = 0; i < me->totface; ++i) {
-				MDisps *mdisp= &mdisps[i];
-				float (*disps)[3], (*ndisps)[3], (*hdisps)[3];
-				int nvert = (me->mface[i].v4)? 4: 3;
-				int totdisp = multires_grid_tot[lvl]*nvert;
-				int S;
+			for (i = 0; i < me->totpoly; ++i) {
+				for (j=0; j<me->mpoly[i].totloop; j++) {
+					MDisps *mdisp= &mdisps[me->mpoly[i].loopstart+j];
+					float (*disps)[3], (*ndisps)[3], (*hdisps)[3];
+					int totdisp = multires_grid_tot[lvl];
 
-				disps = MEM_callocN(sizeof(float) * 3 * totdisp, "multires disps");
+					disps = MEM_callocN(sizeof(float) * 3 * totdisp, "multires disps");
 
-				ndisps = disps;
-				hdisps = mdisp->disps;
+					ndisps = disps;
+					hdisps = mdisp->disps;
 
-				for(S = 0; S < nvert; S++) {
 					multires_copy_grid(ndisps, hdisps, nsize, hsize);
+					if (mdisp->hidden) {
+						BLI_bitmap gh =
+							multires_mdisps_downsample_hidden(mdisp->hidden,
+															  mdisp->level,
+															  lvl);
+						MEM_freeN(mdisp->hidden);
+						mdisp->hidden = gh;
+					}
 
 					ndisps += nsize*nsize;
 					hdisps += hsize*hsize;
-				}
 
-				MEM_freeN(mdisp->disps);
-				mdisp->disps = disps;
-				mdisp->totdisp = totdisp;
+					MEM_freeN(mdisp->disps);
+					mdisp->disps = disps;
+					mdisp->totdisp = totdisp;
+					mdisp->level = lvl;
+				}
 			}
 		}
 		else {
-			CustomData_external_remove(&me->fdata, &me->id, CD_MDISPS, me->totface);
-			CustomData_free_layer_active(&me->fdata, CD_MDISPS, me->totface);
+			multires_customdata_delete(me);
 		}
 	}
 
@@ -441,12 +656,12 @@ void multiresModifier_del_levels(MultiresModifierData *mmd, Object *ob, int dire
 	MDisps *mdisps;
 
 	multires_set_tot_mdisps(me, mmd->totlvl);
-	CustomData_external_read(&me->fdata, &me->id, CD_MASK_MDISPS, me->totface);
-	mdisps= CustomData_get_layer(&me->fdata, CD_MDISPS);
+	CustomData_external_read(&me->ldata, &me->id, CD_MASK_MDISPS, me->totloop);
+	mdisps= CustomData_get_layer(&me->ldata, CD_MDISPS);
 
 	multires_force_update(ob);
 
-	if(mdisps && levels > 0 && direction == 1) {
+	if (mdisps && levels > 0 && direction == 1) {
 		multires_del_higher(mmd, ob, lvl);
 	}
 
@@ -463,7 +678,7 @@ static DerivedMesh *multires_dm_create_local(Object *ob, DerivedMesh *dm, int lv
 	mmd.totlvl = totlvl;
 	mmd.simple = simple;
 
-	return multires_dm_create_from_derived(&mmd, 1, dm, ob, 0, 0);
+	return multires_dm_create_from_derived(&mmd, 1, dm, ob, 0);
 }
 
 static DerivedMesh *subsurf_dm_create_local(Object *ob, DerivedMesh *dm, int lvl, int simple, int optimal, int plain_uv)
@@ -471,11 +686,11 @@ static DerivedMesh *subsurf_dm_create_local(Object *ob, DerivedMesh *dm, int lvl
 	SubsurfModifierData smd= {{NULL}};
 
 	smd.levels = smd.renderLevels = lvl;
-	if(!plain_uv)
+	if (!plain_uv)
 		smd.flags |= eSubsurfModifierFlag_SubsurfUv;
-	if(simple)
+	if (simple)
 		smd.subdivType = ME_SIMPLE_SUBSURF;
-	if(optimal)
+	if (optimal)
 		smd.flags |= eSubsurfModifierFlag_ControlEdges;
 
 	return subsurf_make_derived_from_derived(dm, &smd, 0, NULL, 0, 0, (ob->mode & OB_MODE_EDIT));
@@ -484,7 +699,7 @@ static DerivedMesh *subsurf_dm_create_local(Object *ob, DerivedMesh *dm, int lvl
 
 
 /* assumes no is normalized; return value's sign is negative if v is on
-   the other side of the plane */
+ * the other side of the plane */
 static float v3_dist_from_plane(float v[3], float center[3], float no[3])
 {
 	float s[3];
@@ -496,9 +711,9 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob)
 {
 	DerivedMesh *cddm, *dispdm, *origdm;
 	Mesh *me;
-	ListBase *fmap;
+	const MeshElemMap *pmap;
 	float (*origco)[3];
-	int i, j, offset, totlvl;
+	int i, j, k, offset, totlvl;
 
 	multires_force_update(ob);
 
@@ -506,7 +721,7 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob)
 	totlvl = mmd->totlvl;
 
 	/* nothing to do */
-	if(!totlvl)
+	if (!totlvl)
 		return;
 
 	/* XXX - probably not necessary to regenerate the cddm so much? */
@@ -519,37 +734,35 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob)
 
 	/* copy the new locations of the base verts into the mesh */
 	offset = dispdm->getNumVerts(dispdm) - me->totvert;
-	for(i = 0; i < me->totvert; ++i) {
+	for (i = 0; i < me->totvert; ++i) {
 		dispdm->getVertCo(dispdm, offset + i, me->mvert[i].co);
 	}
 
 	/* heuristic to produce a better-fitting base mesh */
 
 	cddm = CDDM_from_mesh(me, NULL);
-	fmap = cddm->getFaceMap(ob, cddm);
+	pmap = cddm->getPolyMap(ob, cddm);
 	origco = MEM_callocN(sizeof(float)*3*me->totvert, "multires apply base origco");
-	for(i = 0; i < me->totvert ;++i)
+	for (i = 0; i < me->totvert ;++i)
 		copy_v3_v3(origco[i], me->mvert[i].co);
 
-	for(i = 0; i < me->totvert; ++i) {
-		IndexNode *n;
+	for (i = 0; i < me->totvert; ++i) {
 		float avg_no[3] = {0,0,0}, center[3] = {0,0,0}, push[3];
 		float dist;
-		int tot;
+		int tot = 0;
 
-		/* don't adjust verts not used by at least one face */
-		if(!fmap[i].first)
+		/* don't adjust verts not used by at least one poly */
+		if (!pmap[i].count)
 			continue;
 
 		/* find center */
-		for(n = fmap[i].first, tot = 0; n; n = n->next) {
-			MFace *f = &me->mface[n->index];
-			int S = f->v4 ? 4 : 3;
+		for (j = 0; j < pmap[i].count; j++) {
+			const MPoly *p = &me->mpoly[pmap[i].indices[j]];
 			
 			/* this double counts, not sure if that's bad or good */
-			for(j = 0; j < S; ++j) {
-				int vndx = (&f->v1)[j];
-				if(vndx != i) {
+			for (k = 0; k < p->totloop; ++k) {
+				int vndx = me->mloop[p->loopstart + k].v;
+				if (vndx != i) {
 					add_v3_v3(center, origco[vndx]);
 					++tot;
 				}
@@ -558,23 +771,36 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob)
 		mul_v3_fl(center, 1.0f / tot);
 
 		/* find normal */
-		for(n = fmap[i].first; n; n = n->next) {
-			MFace *f = &me->mface[n->index];
-			int S = f->v4 ? 4 : 3;
-			float v[4][3], no[3];
+		for (j = 0; j < pmap[i].count; j++) {
+			const MPoly *p = &me->mpoly[pmap[i].indices[j]];
+			MPoly fake_poly;
+			MLoop *fake_loops;
+			float (*fake_co)[3];
+			float no[3];
+
+			/* set up poly, loops, and coords in order to call
+			 * mesh_calc_poly_normal_coords() */
+			fake_poly.totloop = p->totloop;
+			fake_poly.loopstart = 0;
+			fake_loops = MEM_mallocN(sizeof(MLoop) * p->totloop, "fake_loops");
+			fake_co = MEM_mallocN(sizeof(float) * 3 * p->totloop, "fake_co");
 			
-			for(j = 0; j < S; ++j) {
-				int vndx = (&f->v1)[j];
-				if(vndx == i)
-					copy_v3_v3(v[j], center);
+			for (k = 0; k < p->totloop; ++k) {
+				int vndx = me->mloop[p->loopstart + k].v;
+				
+				fake_loops[k].v = k;
+				
+				if (vndx == i)
+					copy_v3_v3(fake_co[k], center);
 				else
-					copy_v3_v3(v[j], origco[vndx]);
+					copy_v3_v3(fake_co[k], origco[vndx]);
 			}
 			
-			if(S == 4)
-				normal_quad_v3(no, v[0], v[1], v[2], v[3]);
-			else
-				normal_tri_v3(no, v[0], v[1], v[2]);
+			mesh_calc_poly_normal_coords(&fake_poly, fake_loops,
+										 (const float(*)[3])fake_co, no);
+			MEM_freeN(fake_loops);
+			MEM_freeN(fake_co);
+
 			add_v3_v3(avg_no, no);
 		}
 		normalize_v3(avg_no);
@@ -597,7 +823,7 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob)
 	cddm->release(cddm);
 
 	/* calc disps */
-	multiresModifier_disp_run(dispdm, me, 1, 0, origdm->getGridData(origdm), totlvl);
+	multiresModifier_disp_run(dispdm, me, NULL, CALC_DISPLACEMENTS, origdm->getGridData(origdm), totlvl);
 
 	origdm->release(origdm);
 	dispdm->release(dispdm);
@@ -609,16 +835,16 @@ static void multires_subdivide(MultiresModifierData *mmd, Object *ob, int totlvl
 	MDisps *mdisps;
 	int lvl= mmd->totlvl;
 
-	if(totlvl > multires_max_levels)
+	if (totlvl > multires_max_levels)
 		return;
 
 	multires_force_update(ob);
 
-	mdisps = CustomData_get_layer(&me->fdata, CD_MDISPS);
-	if(!mdisps)
-		mdisps = CustomData_add_layer(&me->fdata, CD_MDISPS, CD_DEFAULT, NULL, me->totface);
+	mdisps = CustomData_get_layer(&me->ldata, CD_MDISPS);
+	if (!mdisps)
+		mdisps = multires_mdisps_initialize_hidden(me, totlvl);
 
-	if(mdisps->disps && !updateblock && totlvl > 1) {
+	if (mdisps->disps && !updateblock && totlvl > 1) {
 		/* upsample */
 		DerivedMesh *lowdm, *cddm, *highdm;
 		DMGridData **highGridData, **lowGridData, **subGridData;
@@ -643,7 +869,7 @@ static void multires_subdivide(MultiresModifierData *mmd, Object *ob, int totlvl
 
 		subGridData = MEM_callocN(sizeof(float*)*numGrids, "subGridData*");
 
-		for(i = 0; i < numGrids; ++i) {
+		for (i = 0; i < numGrids; ++i) {
 			/* backup subsurf grids */
 			subGridData[i] = MEM_callocN(sizeof(DMGridData)*highGridSize*highGridSize, "subGridData");
 			memcpy(subGridData[i], highGridData[i], sizeof(DMGridData)*highGridSize*highGridSize);
@@ -661,20 +887,20 @@ static void multires_subdivide(MultiresModifierData *mmd, Object *ob, int totlvl
 		ccgSubSurf_updateLevels(ss, lvl, NULL, 0);
 
 		/* reallocate displacements */
-		multires_reallocate_mdisps(me, mdisps, totlvl); 
+		multires_reallocate_mdisps(me->totloop, mdisps, totlvl); 
 
 		/* compute displacements */
-		multiresModifier_disp_run(highdm, me, 1, 0, subGridData, totlvl);
+		multiresModifier_disp_run(highdm, me, NULL, CALC_DISPLACEMENTS, subGridData, totlvl);
 
 		/* free */
 		highdm->release(highdm);
-		for(i = 0; i < numGrids; ++i)
+		for (i = 0; i < numGrids; ++i)
 			MEM_freeN(subGridData[i]);
 		MEM_freeN(subGridData);
 	}
 	else {
 		/* only reallocate, nothing to upsample */
-		multires_reallocate_mdisps(me, mdisps, totlvl); 
+		multires_reallocate_mdisps(me->totloop, mdisps, totlvl); 
 	}
 
 	multires_set_tot_level(ob, mmd, totlvl);
@@ -685,11 +911,11 @@ void multiresModifier_subdivide(MultiresModifierData *mmd, Object *ob, int updat
 	multires_subdivide(mmd, ob, mmd->totlvl+1, updateblock, simple);
 }
 
-static void grid_tangent(int gridSize, int index, int x, int y, int axis, DMGridData **gridData, float t[3])
+void grid_tangent(int gridSize, int index, int x, int y, int axis, DMGridData **gridData, float t[3])
 {
-	if(axis == 0) {
-		if(x == gridSize - 1) {
-			if(y == gridSize - 1)
+	if (axis == 0) {
+		if (x == gridSize - 1) {
+			if (y == gridSize - 1)
 				sub_v3_v3v3(t, gridData[index][x + gridSize*(y - 1)].co, gridData[index][x - 1 + gridSize*(y - 1)].co);
 			else
 				sub_v3_v3v3(t, gridData[index][x + gridSize*y].co, gridData[index][x - 1 + gridSize*y].co);
@@ -697,9 +923,9 @@ static void grid_tangent(int gridSize, int index, int x, int y, int axis, DMGrid
 		else
 			sub_v3_v3v3(t, gridData[index][x + 1 + gridSize*y].co, gridData[index][x + gridSize*y].co);
 	}
-	else if(axis == 1) {
-		if(y == gridSize - 1) {
-			if(x == gridSize - 1)
+	else if (axis == 1) {
+		if (y == gridSize - 1) {
+			if (x == gridSize - 1)
 				sub_v3_v3v3(t, gridData[index][x - 1 + gridSize*y].co, gridData[index][x - 1 + gridSize*(y - 1)].co);
 			else
 				sub_v3_v3v3(t, gridData[index][x + gridSize*y].co, gridData[index][x + gridSize*(y - 1)].co);
@@ -709,18 +935,31 @@ static void grid_tangent(int gridSize, int index, int x, int y, int axis, DMGrid
 	}
 }
 
-static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, int invert, int add, DMGridData **oldGridData, int totlvl)
+static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, DerivedMesh *dm2, DispOp op, DMGridData **oldGridData, int totlvl)
 {
 	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*)dm;
 	DMGridData **gridData, **subGridData;
-	MFace *mface = me->mface;
-	MDisps *mdisps = CustomData_get_layer(&me->fdata, CD_MDISPS);
+	MPoly *mpoly = me->mpoly;
+	MDisps *mdisps = CustomData_get_layer(&me->ldata, CD_MDISPS);
 	int *gridOffset;
-	int i, /*numGrids,*/ gridSize, dGridSize, dSkip;
-
-	if(!mdisps) {
-		if(invert)
-			mdisps = CustomData_add_layer(&me->fdata, CD_MDISPS, CD_DEFAULT, NULL, me->totface);
+	int i, k, /*numGrids,*/ gridSize, dGridSize, dSkip;
+	int totloop, totpoly;
+	
+	/* this happens in the dm made by bmesh_mdisps_space_set */
+	if (dm2 && CustomData_has_layer(&dm2->loopData, CD_MDISPS)) {
+		mpoly = CustomData_get_layer(&dm2->polyData, CD_MPOLY);
+		mdisps = CustomData_get_layer(&dm2->loopData, CD_MDISPS);
+		totloop = dm2->numLoopData;
+		totpoly = dm2->numPolyData;
+	}
+	else {
+		totloop = me->totloop;
+		totpoly = me->totpoly;
+	}
+	
+	if (!mdisps) {
+		if (op == CALC_DISPLACEMENTS)
+			mdisps = CustomData_add_layer(&me->ldata, CD_MDISPS, CD_DEFAULT, NULL, me->totloop);
 		else
 			return;
 	}
@@ -734,26 +973,31 @@ static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, int invert, int
 	dGridSize = multires_side_tot[totlvl];
 	dSkip = (dGridSize-1)/(gridSize-1);
 
-	#pragma omp parallel for private(i) if(me->totface*gridSize*gridSize*4 >= CCG_OMP_LIMIT)
-	for(i = 0; i < me->totface; ++i) {
-		const int numVerts = mface[i].v4 ? 4 : 3;
-		MDisps *mdisp = &mdisps[i];
-		int S, x, y, gIndex = gridOffset[i];
+	k = 0; /*current loop/mdisp index within the mloop array*/
 
-		/* when adding new faces in edit mode, need to allocate disps */
-		if(!mdisp->disps)
-		#pragma omp critical
-		{
-			multires_reallocate_mdisps(me, mdisps, totlvl);
-		}
+	#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;
+		int S, x, y, gIndex = gridOffset[i];
 
-		for(S = 0; S < numVerts; ++S, ++gIndex) {
+		for (S = 0; S < numVerts; ++S, ++gIndex, ++k) {
+			MDisps *mdisp = &mdisps[mpoly[i].loopstart+S];
 			DMGridData *grid = gridData[gIndex];
 			DMGridData *subgrid = subGridData[gIndex];
-			float (*dispgrid)[3] = &mdisp->disps[S*dGridSize*dGridSize];
+			float (*dispgrid)[3] = NULL;
 
-			for(y = 0; y < gridSize; y++) {
-				for(x = 0; x < gridSize; x++) {
+			/* when adding new faces in edit mode, need to allocate disps */
+			if (!mdisp->disps)
+			#pragma omp critical
+			{
+				multires_reallocate_mdisps(totloop, mdisps, totlvl);
+			}
+
+			dispgrid = mdisp->disps;
+
+			for (y = 0; y < gridSize; y++) {
+				for (x = 0; x < gridSize; x++) {
 					float *co = grid[x + y*gridSize].co;
 					float *sco = subgrid[x + y*gridSize].co;
 					float *no = subgrid[x + y*gridSize].no;
@@ -773,35 +1017,40 @@ static void multiresModifier_disp_run(DerivedMesh *dm, Mesh *me, int invert, int
 
 					column_vectors_to_mat3(mat, tx, ty, no);
 
-					if(!invert) {
-						/* convert to object space and add */
+					switch(op) {
+					case APPLY_DISPLACEMENTS:
+						/* Convert displacement to object space
+						 * and add to grid points */
 						mul_v3_m3v3(disp, mat, data);
 						add_v3_v3v3(co, sco, disp);
-					}
-					else if(!add) {
-						/* convert difference to tangent space */
+						break;
+					case CALC_DISPLACEMENTS:
+						/* Calculate displacement between new and old
+						 * grid points and convert to tangent space */
 						sub_v3_v3v3(disp, co, sco);
 						invert_m3(mat);
 						mul_v3_m3v3(data, mat, disp);
-					}
-					else {
-						/* convert difference to tangent space */
+						break;
+					case ADD_DISPLACEMENTS:
+						/* Convert subdivided displacements to tangent
+						 * space and add to the original displacements */
 						invert_m3(mat);
 						mul_v3_m3v3(d, mat, co);
 						add_v3_v3(data, d);
+						break;
 					}
 				}
 			}
 		}
 	}
 
-	if(!invert) {
+	if (op == APPLY_DISPLACEMENTS) {
 		ccgSubSurf_stitchFaces(ccgdm->ss, 0, NULL, 0);
 		ccgSubSurf_updateNormals(ccgdm->ss, NULL, 0);
 	}
 }
 
-static void multiresModifier_update(DerivedMesh *dm)
+void multires_modifier_update_mdisps(struct DerivedMesh *dm)
 {
 	CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm;
 	Object *ob;
@@ -813,14 +1062,14 @@ static void multiresModifier_update(DerivedMesh *dm)
 	me = ccgdm->multires.ob->data;
 	mmd = ccgdm->multires.mmd;
 	multires_set_tot_mdisps(me, mmd->totlvl);
-	CustomData_external_read(&me->fdata, &me->id, CD_MASK_MDISPS, me->totface);
-	mdisps = CustomData_get_layer(&me->fdata, CD_MDISPS);
+	CustomData_external_read(&me->ldata, &me->id, CD_MASK_MDISPS, me->totloop);
+	mdisps = CustomData_get_layer(&me->ldata, CD_MDISPS);
 
-	if(mdisps) {
+	if (mdisps) {
 		int lvl = ccgdm->multires.lvl;
 		int totlvl = ccgdm->multires.totlvl;
 		
-		if(lvl < totlvl) {
+		if (lvl < totlvl) {
 			Mesh *me = ob->data;
 			DerivedMesh *lowdm, *cddm, *highdm;
 			DMGridData **highGridData, **lowGridData, **subGridData, **gridData, *diffGrid;
@@ -849,13 +1098,13 @@ static void multiresModifier_update(DerivedMesh *dm)
 			subGridData = MEM_callocN(sizeof(DMGridData*)*numGrids, "subGridData*");
 			diffGrid = MEM_callocN(sizeof(DMGridData)*lowGridSize*lowGridSize, "diff");
 
-			for(i = 0; i < numGrids; ++i) {
+			for (i = 0; i < numGrids; ++i) {
 				/* backup subsurf grids */
 				subGridData[i] = MEM_callocN(sizeof(DMGridData)*highGridSize*highGridSize, "subGridData");
 				memcpy(subGridData[i], highGridData[i], sizeof(DMGridData)*highGridSize*highGridSize);
 
 				/* write difference of subsurf and displaced low level into high subsurf */
-				for(j = 0; j < lowGridSize*lowGridSize; ++j)
+				for (j = 0; j < lowGridSize*lowGridSize; ++j)
 					sub_v3_v3v3(diffGrid[j].co, gridData[i][j].co, lowGridData[i][j].co);
 
 				multires_copy_dm_grid(highGridData[i], diffGrid, highGridSize, lowGridSize);
@@ -871,11 +1120,11 @@ static void multiresModifier_update(DerivedMesh *dm)
 			ccgSubSurf_updateLevels(ss, lvl, NULL, 0);
 
 			/* add to displacements */
-			multiresModifier_disp_run(highdm, me, 1, 1, subGridData, mmd->totlvl);
+			multiresModifier_disp_run(highdm, me, NULL, ADD_DISPLACEMENTS, subGridData, mmd->totlvl);
 
 			/* free */
 			highdm->release(highdm);
-			for(i = 0; i < numGrids; ++i)
+			for (i = 0; i < numGrids; ++i)
 				MEM_freeN(subGridData[i]);
 			MEM_freeN(subGridData);
 		}
@@ -889,25 +1138,184 @@ static void multiresModifier_update(DerivedMesh *dm)
 			subdm = subsurf_dm_create_local(ob, cddm, mmd->totlvl, mmd->simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv);
 			cddm->release(cddm);
 
-			multiresModifier_disp_run(dm, me, 1, 0, subdm->getGridData(subdm), mmd->totlvl);
+			multiresModifier_disp_run(dm, me, NULL, CALC_DISPLACEMENTS, subdm->getGridData(subdm), mmd->totlvl);
 
 			subdm->release(subdm);
 		}
 	}
 }
 
+void multires_modifier_update_hidden(DerivedMesh *dm)
+{
+	CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm;
+	BLI_bitmap *grid_hidden= ccgdm->gridHidden;
+	Mesh *me = ccgdm->multires.ob->data;
+	MDisps *mdisps = CustomData_get_layer(&me->ldata, CD_MDISPS);
+	int totlvl = ccgdm->multires.totlvl;
+	int lvl = ccgdm->multires.lvl;
+
+	if (mdisps) {
+		int i;
+		
+		for (i = 0; i < me->totloop; i++) {
+			MDisps *md = &mdisps[i];
+			BLI_bitmap gh = grid_hidden[i];
+
+			if (!gh && md->hidden) {
+				MEM_freeN(md->hidden);
+				md->hidden = NULL;
+			}
+			else if (gh) {
+				gh = multires_mdisps_upsample_hidden(gh, lvl, totlvl,
+															 md->hidden);
+				if (md->hidden)
+					MEM_freeN(md->hidden);
+				
+				md->hidden = gh;
+			}
+		}
+	}
+}
+
+void multires_set_space(DerivedMesh *dm, Object *ob, int from, int to)
+{
+	DerivedMesh *ccgdm = NULL, *subsurf = NULL;
+	DMGridData **gridData, **subGridData=NULL;
+	MPoly *mpoly = CustomData_get_layer(&dm->polyData, CD_MPOLY);
+	MDisps *mdisps;
+	MultiresModifierData *mmd = get_multires_modifier(NULL, ob, 1);
+	int *gridOffset, totlvl;
+	int i, k, numGrids, gridSize, dGridSize, dSkip;
+	
+	if (!mmd)
+		return;
+	
+	mdisps = CustomData_get_layer(&dm->loopData, CD_MDISPS);
+
+	if (!mdisps) {
+		goto cleanup;
+	}
+
+	totlvl = mmd->totlvl;
+	ccgdm = multires_dm_create_local(ob, dm, totlvl, totlvl, mmd->simple);
+	
+	subsurf = subsurf_dm_create_local(ob, dm, totlvl,
+		mmd->simple, mmd->flags & eMultiresModifierFlag_ControlEdges, mmd->flags & eMultiresModifierFlag_PlainUv);
+
+	numGrids = subsurf->getNumGrids(subsurf);
+	gridSize = subsurf->getGridSize(subsurf);
+	gridData = subsurf->getGridData(subsurf);
+
+	subGridData = MEM_callocN(sizeof(DMGridData*)*numGrids, "subGridData*");
+
+	for (i = 0; i < numGrids; i++) {
+		subGridData[i] = MEM_callocN(sizeof(DMGridData)*gridSize*gridSize, "subGridData");
+		memcpy(subGridData[i], gridData[i], sizeof(DMGridData)*gridSize*gridSize);
+	}
+	
+	/*numGrids = ccgdm->dm->getNumGrids((DerivedMesh*)ccgdm);*/ /*UNUSED*/
+	gridSize = ccgdm->getGridSize((DerivedMesh*)ccgdm);
+	gridData = ccgdm->getGridData((DerivedMesh*)ccgdm);
+	gridOffset = ccgdm->getGridOffset((DerivedMesh*)ccgdm);
+
+	dGridSize = multires_side_tot[totlvl];
+	dSkip = (dGridSize-1)/(gridSize-1);
+
+	k = 0; /*current loop/mdisp index within the mloop array*/
+
+	//#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;
+		int S, x, y, gIndex = gridOffset[i];
+						
+		for (S = 0; S < numVerts; ++S, ++gIndex, ++k) {
+			MDisps *mdisp = &mdisps[mpoly[i].loopstart+S];
+			/* DMGridData *grid = gridData[gIndex]; */ /* UNUSED */
+			DMGridData *subgrid = subGridData[gIndex];
+			float (*dispgrid)[3] = NULL;
+
+			/* when adding new faces in edit mode, need to allocate disps */
+			if (!mdisp->disps) {
+				mdisp->totdisp = gridSize*gridSize;
+				mdisp->level = totlvl;
+				mdisp->disps = MEM_callocN(sizeof(float)*3*mdisp->totdisp, "disp in multires_set_space");
+			}
+
+			dispgrid = mdisp->disps;
+
+			for (y = 0; y < gridSize; y++) {
+				for (x = 0; x < gridSize; x++) {
+					float *data = dispgrid[dGridSize*y*dSkip + x*dSkip];
+					float *no = subgrid[x + y*gridSize].no;
+					float *co = subgrid[x + y*gridSize].co;
+					float mat[3][3], tx[3], ty[3], dco[3];
+					
+					/* construct tangent space matrix */
+					grid_tangent(gridSize, gIndex, x, y, 0, subGridData, tx);
+					normalize_v3(tx);
+
+					grid_tangent(gridSize, gIndex, x, y, 1, subGridData, ty);
+					normalize_v3(ty);
+					column_vectors_to_mat3(mat, tx, ty, no);
+
+					/* convert to absolute coordinates in space */
+					if (from == MULTIRES_SPACE_TANGENT) {
+						mul_v3_m3v3(dco, mat, data);
+						add_v3_v3(dco, co);
+					}
+					else if (from == MULTIRES_SPACE_OBJECT) {
+						add_v3_v3v3(dco, co, data);
+					}
+					else if (from == MULTIRES_SPACE_ABSOLUTE) {
+						copy_v3_v3(dco, data);
+					}
+					
+					column_vectors_to_mat3(mat, tx, ty, no);
+
+					/*now, convert to desired displacement type*/
+					if (to == MULTIRES_SPACE_TANGENT) {
+						invert_m3(mat);
+
+						sub_v3_v3(dco, co);
+						mul_v3_m3v3(data, mat, dco);
+					}
+					else if (to == MULTIRES_SPACE_OBJECT) {
+						sub_v3_v3(dco, co);
+						mul_v3_m3v3(data, mat, dco);
+					}
+					else if (to == MULTIRES_SPACE_ABSOLUTE) {
+						copy_v3_v3(data, dco);
+					}
+				}
+			}
+		}
+	}
+
+cleanup:
+	if (subsurf) {
+		subsurf->needsFree = 1;
+		subsurf->release(subsurf);
+	}
+
+	if (ccgdm) {
+		ccgdm->needsFree = 1;
+		ccgdm->release(ccgdm);
+	}
+}
+
 void multires_stitch_grids(Object *ob)
 {
 	/* utility for smooth brush */
-	if(ob && ob->derivedFinal) {
+	if (ob && ob->derivedFinal) {
 		CCGDerivedMesh *ccgdm = (CCGDerivedMesh*)ob->derivedFinal;
 		CCGFace **faces;
 		int totface;
 
-		if(ccgdm->pbvh) {
+		if (ccgdm->pbvh) {
 			BLI_pbvh_get_grid_updates(ccgdm->pbvh, 0, (void***)&faces, &totface);
 
-			if(totface) {
+			if (totface) {
 				ccgSubSurf_stitchFaces(ccgdm->ss, 0, faces, totface);
 				MEM_freeN(faces);
 			}
@@ -915,24 +1323,25 @@ void multires_stitch_grids(Object *ob)
 	}
 }
 
-DerivedMesh *multires_dm_create_from_derived(MultiresModifierData *mmd, int local_mmd, DerivedMesh *dm, Object *ob,
-							int useRenderParams, int UNUSED(isFinalCalc))
+DerivedMesh *multires_dm_create_from_derived(MultiresModifierData *mmd,
+											 int local_mmd, DerivedMesh *dm,
+											 Object *ob, int useRenderParams)
 {
 	Mesh *me= ob->data;
 	DerivedMesh *result;
-	CCGDerivedMesh *ccgdm;
+	CCGDerivedMesh *ccgdm = NULL;
 	DMGridData **gridData, **subGridData;
 	int lvl= multires_get_level(ob, mmd, useRenderParams);
 	int i, gridSize, numGrids;
 
-	if(lvl == 0)
+	if (lvl == 0)
 		return dm;
 
 	result = subsurf_dm_create_local(ob, dm, lvl,
 		mmd->simple, mmd->flags & eMultiresModifierFlag_ControlEdges,
 		mmd->flags & eMultiresModifierFlag_PlainUv);
 
-	if(!local_mmd) {
+	if (!local_mmd) {
 		ccgdm = (CCGDerivedMesh*)result;
 
 		ccgdm->multires.ob = ob;
@@ -940,8 +1349,7 @@ DerivedMesh *multires_dm_create_from_derived(MultiresModifierData *mmd, int loca
 		ccgdm->multires.local_mmd = local_mmd;
 		ccgdm->multires.lvl = lvl;
 		ccgdm->multires.totlvl = mmd->totlvl;
-		ccgdm->multires.modified = 0;
-		ccgdm->multires.update = multiresModifier_update;
+		ccgdm->multires.modified_flags = 0;
 	}
 
 	numGrids = result->getNumGrids(result);
@@ -950,16 +1358,22 @@ DerivedMesh *multires_dm_create_from_derived(MultiresModifierData *mmd, int loca
 
 	subGridData = MEM_callocN(sizeof(DMGridData*)*numGrids, "subGridData*");
 
-	for(i = 0; i < numGrids; i++) {
+	for (i = 0; i < numGrids; i++) {
 		subGridData[i] = MEM_callocN(sizeof(DMGridData)*gridSize*gridSize, "subGridData");
 		memcpy(subGridData[i], gridData[i], sizeof(DMGridData)*gridSize*gridSize);
 	}
 
 	multires_set_tot_mdisps(me, mmd->totlvl);
-	CustomData_external_read(&me->fdata, &me->id, CD_MASK_MDISPS, me->totface);
-	multiresModifier_disp_run(result, ob->data, 0, 0, subGridData, mmd->totlvl);
+	CustomData_external_read(&me->ldata, &me->id, CD_MASK_MDISPS, me->totloop);
 
-	for(i = 0; i < numGrids; i++)
+	/*run displacement*/
+	multiresModifier_disp_run(result, ob->data, dm, APPLY_DISPLACEMENTS, subGridData, mmd->totlvl);
+
+	/* copy hidden elements for this level */
+	if (ccgdm)
+		multires_output_hidden_to_ccgdm(ccgdm, me, lvl);
+
+	for (i = 0; i < numGrids; i++)
 		MEM_freeN(subGridData[i]);
 	MEM_freeN(subGridData);
 
@@ -967,7 +1381,7 @@ DerivedMesh *multires_dm_create_from_derived(MultiresModifierData *mmd, int loca
 }
 
 /**** Old Multires code ****
-***************************/
+ ***************************/
 
 /* Adapted from sculptmode.c */
 void old_mdisps_bilinear(float out[3], float (*disps)[3], const int st, float u, float v)
@@ -976,14 +1390,17 @@ void old_mdisps_bilinear(float out[3], float (*disps)[3], const int st, float u,
 	const int st_max = st - 1;
 	float urat, vrat, uopp;
 	float d[4][3], d2[2][3];
-
-	if(u < 0)
+	
+	if (!disps || isnan(u) || isnan(v))
+		return;
+			
+	if (u < 0)
 		u = 0;
-	else if(u >= st)
+	else if (u >= st)
 		u = st_max;
-	if(v < 0)
+	if (v < 0)
 		v = 0;
-	else if(v >= st)
+	else if (v >= st)
 		v = st_max;
 
 	x = floor(u);
@@ -991,8 +1408,8 @@ void old_mdisps_bilinear(float out[3], float (*disps)[3], const int st, float u,
 	x2 = x + 1;
 	y2 = y + 1;
 
-	if(x2 >= st) x2 = st_max;
-	if(y2 >= st) y2 = st_max;
+	if (x2 >= st) x2 = st_max;
+	if (y2 >= st) y2 = st_max;
 	
 	urat = u - x;
 	vrat = v - y;
@@ -1015,10 +1432,10 @@ static void old_mdisps_rotate(int S, int UNUSED(newside), int oldside, int x, in
 {
 	float offset = oldside*0.5f - 0.5f;
 
-	if(S == 1) { *u= offset + x; *v = offset - y; }
-	if(S == 2) { *u= offset + y; *v = offset + x; }
-	if(S == 3) { *u= offset - x; *v = offset + y; }
-	if(S == 0) { *u= offset - y; *v = offset - x; }
+	if (S == 1) { *u= offset + x; *v = offset - y; }
+	if (S == 2) { *u= offset + y; *v = offset + x; }
+	if (S == 3) { *u= offset - x; *v = offset + y; }
+	if (S == 0) { *u= offset - y; *v = offset - x; }
 }
 
 static void old_mdisps_convert(MFace *mface, MDisps *mdisp)
@@ -1035,16 +1452,16 @@ static void old_mdisps_convert(MFace *mface, MDisps *mdisp)
 	disps = MEM_callocN(sizeof(float) * 3 * newtotdisp, "multires disps");
 
 	out = disps;
-	for(S = 0; S < nvert; S++) {
-		for(y = 0; y < newside; ++y) {
-			for(x = 0; x < newside; ++x, ++out) {
+	for (S = 0; S < nvert; S++) {
+		for (y = 0; y < newside; ++y) {
+			for (x = 0; x < newside; ++x, ++out) {
 				old_mdisps_rotate(S, newside, oldside, x, y, &u, &v);
 				old_mdisps_bilinear(*out, mdisp->disps, oldside, u, v);
 
-				if(S == 1) { (*out)[1]= -(*out)[1]; }
-				else if(S == 2) { SWAP(float, (*out)[0], (*out)[1]); }
-				else if(S == 3) { (*out)[0]= -(*out)[0]; }
-				else if(S == 0) { SWAP(float, (*out)[0], (*out)[1]); (*out)[0]= -(*out)[0]; (*out)[1]= -(*out)[1]; };
+				if (S == 1) { (*out)[1]= -(*out)[1]; }
+				else if (S == 2) { SWAP(float, (*out)[0], (*out)[1]); }
+				else if (S == 3) { (*out)[0]= -(*out)[0]; }
+				else if (S == 0) { SWAP(float, (*out)[0], (*out)[1]); (*out)[0]= -(*out)[0]; (*out)[1]= -(*out)[1]; };
 			}
 		}
 	}
@@ -1052,49 +1469,69 @@ static void old_mdisps_convert(MFace *mface, MDisps *mdisp)
 	MEM_freeN(mdisp->disps);
 
 	mdisp->totdisp= newtotdisp;
+	mdisp->level= newlvl;
 	mdisp->disps= disps;
 }
 
 void multires_load_old_250(Mesh *me)
 {
-	MDisps *mdisps;
-	int a;
+	MDisps *mdisps, *mdisps2;
+	MFace *mf;
+	int i, j, k;
 
 	mdisps= CustomData_get_layer(&me->fdata, CD_MDISPS);
 
-	if(mdisps) {
-		for(a=0; a<me->totface; a++)
-			if(mdisps[a].totdisp)
-				old_mdisps_convert(&me->mface[a], &mdisps[a]);
+	if (mdisps) {
+		for (i=0; i<me->totface; i++)
+			if (mdisps[i].totdisp)
+				old_mdisps_convert(&me->mface[i], &mdisps[i]);
+		
+		CustomData_add_layer(&me->ldata, CD_MDISPS, CD_CALLOC, NULL, me->totloop);
+		mdisps2 = CustomData_get_layer(&me->ldata, CD_MDISPS);
+
+		k = 0;
+		mf = me->mface;
+		for (i=0; i<me->totface; i++, mf++) {
+			int nvert = mf->v4 ? 4 : 3;
+			int totdisp = mdisps[i].totdisp / nvert;
+			
+			for (j=0; j < mf->v4 ? 4 : 3; j++, k++) {
+				mdisps2[k].disps = MEM_callocN(sizeof(float)*3*totdisp, "multires disp in conversion");			
+				mdisps2[k].totdisp = totdisp;
+				mdisps2[k].level = mdisps[i].level;
+				memcpy(mdisps2[k].disps, mdisps[i].disps + totdisp*j, totdisp);
+			}
+
+		}
 	}
 }
 
 /* Does not actually free lvl itself */
 static void multires_free_level(MultiresLevel *lvl)
 {
-	if(lvl) {
-		if(lvl->faces) MEM_freeN(lvl->faces);
-		if(lvl->edges) MEM_freeN(lvl->edges);
-		if(lvl->colfaces) MEM_freeN(lvl->colfaces);
+	if (lvl) {
+		if (lvl->faces) MEM_freeN(lvl->faces);
+		if (lvl->edges) MEM_freeN(lvl->edges);
+		if (lvl->colfaces) MEM_freeN(lvl->colfaces);
 	}
 }
 
 void multires_free(Multires *mr)
 {
-	if(mr) {
+	if (mr) {
 		MultiresLevel* lvl= mr->levels.first;
 
 		/* Free the first-level data */
-		if(lvl) {
+		if (lvl) {
 			CustomData_free(&mr->vdata, lvl->totvert);
 			CustomData_free(&mr->fdata, lvl->totface);
-			if(mr->edge_flags)
+			if (mr->edge_flags)
 				MEM_freeN(mr->edge_flags);
-			if(mr->edge_creases)
+			if (mr->edge_creases)
 				MEM_freeN(mr->edge_creases);
 		}
 
-		while(lvl) {
+		while (lvl) {
 			multires_free_level(lvl);			
 			lvl= lvl->next;
 		}
@@ -1118,8 +1555,8 @@ static void create_old_vert_face_map(ListBase **map, IndexNode **mem, const Mult
 	node = *mem;
 	
 	/* Find the users */
-	for(i = 0; i < totface; ++i){
-		for(j = 0; j < (mface[i].v[3]?4:3); ++j, ++node) {
+	for (i = 0; i < totface; ++i) {
+		for (j = 0; j < (mface[i].v[3]?4:3); ++j, ++node) {
 			node->index = i;
 			BLI_addtail(&(*map)[mface[i].v[j]], node);
 		}
@@ -1137,8 +1574,8 @@ static void create_old_vert_edge_map(ListBase **map, IndexNode **mem, const Mult
 	node = *mem;
 	
 	/* Find the users */
-	for(i = 0; i < totedge; ++i){
-		for(j = 0; j < 2; ++j, ++node) {
+	for (i = 0; i < totedge; ++i) {
+		for (j = 0; j < 2; ++j, ++node) {
 			node->index = i;
 			BLI_addtail(&(*map)[medge[i].v[j]], node);
 		}
@@ -1155,17 +1592,17 @@ static MultiresFace *find_old_face(ListBase *map, MultiresFace *faces, int v1, i
 	v[2]= v3;
 	v[3]= v4;
 
-	for(n1 = map[v1].first; n1; n1 = n1->next) {
+	for (n1 = map[v1].first; n1; n1 = n1->next) {
 		int fnd[4] = {0, 0, 0, 0};
 
-		for(i = 0; i < 4; ++i) {
-			for(j = 0; j < 4; ++j) {
-				if(v[i] == faces[n1->index].v[j])
+		for (i = 0; i < 4; ++i) {
+			for (j = 0; j < 4; ++j) {
+				if (v[i] == faces[n1->index].v[j])
 					fnd[i] = 1;
 			}
 		}
 
-		if(fnd[0] && fnd[1] && fnd[2] && fnd[3])
+		if (fnd[0] && fnd[1] && fnd[2] && fnd[3])
 			return &faces[n1->index];
 	}
 
@@ -1176,9 +1613,9 @@ static MultiresEdge *find_old_edge(ListBase *map, MultiresEdge *edges, int v1, i
 {
 	IndexNode *n1, *n2;
 
-	for(n1 = map[v1].first; n1; n1 = n1->next) {
-		for(n2 = map[v2].first; n2; n2 = n2->next) {
-			if(n1->index == n2->index)
+	for (n1 = map[v1].first; n1; n1 = n1->next) {
+		for (n2 = map[v2].first; n2; n2 = n2->next) {
+			if (n1->index == n2->index)
 				return &edges[n1->index];
 		}
 	}
@@ -1191,7 +1628,7 @@ static void multires_load_old_edges(ListBase **emap, MultiresLevel *lvl, int *vv
 	int emid = find_old_edge(emap[2], lvl->edges, v1, v2)->mid;
 	vvmap[dst + mov] = emid;
 
-	if(lvl->next->next) {
+	if (lvl->next->next) {
 		multires_load_old_edges(emap + 1, lvl->next, vvmap, dst + mov, v1, emid, mov / 2);
 		multires_load_old_edges(emap + 1, lvl->next, vvmap, dst + mov, v2, emid, -mov / 2);
 	}
@@ -1203,7 +1640,7 @@ static void multires_load_old_faces(ListBase **fmap, ListBase **emap, MultiresLe
 	int fmid;
 	int emid13, emid14, emid23, emid24;
 
-	if(lvl && lvl->next) {
+	if (lvl && lvl->next) {
 		fmid = find_old_face(fmap[1], lvl->faces, v1, v2, v3, v4)->mid;
 		vvmap[dst] = fmid;
 
@@ -1225,7 +1662,7 @@ static void multires_load_old_faces(ListBase **fmap, ListBase **emap, MultiresLe
 		multires_load_old_faces(fmap + 1, emap + 1, lvl->next, vvmap, dst - st2 * st3 - st3,
 					v1, fmid, emid13, emid14, st2, st3 / 2);
 
-		if(lvl->next->next) {
+		if (lvl->next->next) {
 			multires_load_old_edges(emap, lvl->next, vvmap, dst, emid24, fmid, st3);
 			multires_load_old_edges(emap, lvl->next, vvmap, dst, emid13, fmid, -st3);
 			multires_load_old_edges(emap, lvl->next, vvmap, dst, emid14, fmid, -st2 * st3);
@@ -1246,7 +1683,7 @@ static void multires_mvert_to_ss(DerivedMesh *dm, MVert *mvert)
 	int i = 0;
 
 	totface = ccgSubSurf_getNumFaces(ss);
-	for(index = 0; index < totface; index++) {
+	for (index = 0; index < totface; index++) {
 		CCGFace *f = ccgdm->faceMap[index].face;
 		int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f);
 
@@ -1254,16 +1691,16 @@ static void multires_mvert_to_ss(DerivedMesh *dm, MVert *mvert)
 		copy_v3_v3(vd->co, mvert[i].co);
 		i++;
 		
-		for(S = 0; S < numVerts; S++) {
-			for(x = 1; x < gridSize - 1; x++, i++) {
+		for (S = 0; S < numVerts; S++) {
+			for (x = 1; x < gridSize - 1; x++, i++) {
 				vd= ccgSubSurf_getFaceGridEdgeData(ss, f, S, x);
 				copy_v3_v3(vd->co, mvert[i].co);
 			}
 		}
 
-		for(S = 0; S < numVerts; S++) {
-			for(y = 1; y < gridSize - 1; y++) {
-				for(x = 1; x < gridSize - 1; x++, i++) {
+		for (S = 0; S < numVerts; S++) {
+			for (y = 1; y < gridSize - 1; y++) {
+				for (x = 1; x < gridSize - 1; x++, i++) {
 					vd= ccgSubSurf_getFaceGridData(ss, f, S, x, y);
 					copy_v3_v3(vd->co, mvert[i].co);
 				}
@@ -1272,18 +1709,18 @@ static void multires_mvert_to_ss(DerivedMesh *dm, MVert *mvert)
 	}
 
 	totedge = ccgSubSurf_getNumEdges(ss);
-	for(index = 0; index < totedge; index++) {
+	for (index = 0; index < totedge; index++) {
 		CCGEdge *e = ccgdm->edgeMap[index].edge;
 		int x;
 
-		for(x = 1; x < edgeSize - 1; x++, i++) {
+		for (x = 1; x < edgeSize - 1; x++, i++) {
 			vd= ccgSubSurf_getEdgeData(ss, e, x);
 			copy_v3_v3(vd->co, mvert[i].co);
 		}
 	}
 
 	totvert = ccgSubSurf_getNumVerts(ss);
-	for(index = 0; index < totvert; index++) {
+	for (index = 0; index < totvert; index++) {
 		CCGVert *v = ccgdm->vertMap[index].vert;
 
 		vd= ccgSubSurf_getVertData(ss, v);
@@ -1316,24 +1753,24 @@ static void multires_load_old_dm(DerivedMesh *dm, Mesh *me, int totlvl)
 
 	lvl1 = mr->levels.first;
 	/* Load base verts */
-	for(i = 0; i < lvl1->totvert; ++i) {
+	for (i = 0; i < lvl1->totvert; ++i) {
 		vvmap[totvert - lvl1->totvert + i] = src;
 		++src;
 	}
 
 	/* Original edges */
 	dst = totvert - lvl1->totvert - extedgelen * lvl1->totedge;
-	for(i = 0; i < lvl1->totedge; ++i) {
+	for (i = 0; i < lvl1->totedge; ++i) {
 		int ldst = dst + extedgelen * i;
 		int lsrc = src;
 		lvl = lvl1->next;
 
-		for(j = 2; j <= mr->level_count; ++j) {
+		for (j = 2; j <= mr->level_count; ++j) {
 			int base = multires_side_tot[totlvl - j + 1] - 2;
 			int skip = multires_side_tot[totlvl - j + 2] - 1;
 			int st = multires_side_tot[j - 1] - 1;
 
-			for(x = 0; x < st; ++x)
+			for (x = 0; x < st; ++x)
 				vvmap[ldst + base + x * skip] = lsrc + st * i + x;
 
 			lsrc += lvl->totvert - lvl->prev->totvert;
@@ -1343,7 +1780,7 @@ static void multires_load_old_dm(DerivedMesh *dm, Mesh *me, int totlvl)
 
 	/* Center points */
 	dst = 0;
-	for(i = 0; i < lvl1->totface; ++i) {
+	for (i = 0; i < lvl1->totface; ++i) {
 		int sides = lvl1->faces[i].v[3] ? 4 : 3;
 
 		vvmap[dst] = src + lvl1->totedge + i;
@@ -1352,7 +1789,7 @@ static void multires_load_old_dm(DerivedMesh *dm, Mesh *me, int totlvl)
 
 
 	/* The rest is only for level 3 and up */
-	if(lvl1->next && lvl1->next->next) {
+	if (lvl1->next && lvl1->next->next) {
 		ListBase **fmap, **emap;
 		IndexNode **fmem, **emem;
 
@@ -1360,13 +1797,13 @@ static void multires_load_old_dm(DerivedMesh *dm, Mesh *me, int totlvl)
 		tottri = totquad = 0;
 		crossedgelen = multires_side_tot[totlvl - 1] - 2;
 		dst = 0;
-		for(i = 0; i < lvl1->totface; ++i) {
+		for (i = 0; i < lvl1->totface; ++i) {
 			int sides = lvl1->faces[i].v[3] ? 4 : 3;
 
 			lvl = lvl1->next->next;
 			++dst;
 
-			for(j = 3; j <= mr->level_count; ++j) {
+			for (j = 3; j <= mr->level_count; ++j) {
 				int base = multires_side_tot[totlvl - j + 1] - 2;
 				int skip = multires_side_tot[totlvl - j + 2] - 1;
 				int st = pow(2, j - 2);
@@ -1379,8 +1816,8 @@ static void multires_load_old_dm(DerivedMesh *dm, Mesh *me, int totlvl)
 				/* Skip earlier face edge crosses */
 				lsrc += st2 * (tottri * 3 + totquad * 4);
 
-				for(s = 0; s < sides; ++s) {
-					for(x = 0; x < st2; ++x) {
+				for (s = 0; s < sides; ++s) {
+					for (x = 0; x < st2; ++x) {
 						vvmap[dst + crossedgelen * (s + 1) - base - x * skip - 1] = lsrc;
 						++lsrc;
 					}
@@ -1391,7 +1828,7 @@ static void multires_load_old_dm(DerivedMesh *dm, Mesh *me, int totlvl)
 
 			dst += sides * (st - 1) * st;
 
-			if(sides == 4) ++totquad;
+			if (sides == 4) ++totquad;
 			else ++tottri;
 
 		}
@@ -1402,7 +1839,7 @@ static void multires_load_old_dm(DerivedMesh *dm, Mesh *me, int totlvl)
 		fmem = MEM_callocN(sizeof(IndexNode*) * (mr->level_count-1), "multires fmem");
 		emem = MEM_callocN(sizeof(IndexNode*) * (mr->level_count-1), "multires emem");
 		lvl = lvl1;
-		for(i = 0; i < (unsigned int)mr->level_count - 1; ++i) {
+		for (i = 0; i < (unsigned int)mr->level_count - 1; ++i) {
 			create_old_vert_face_map(fmap + i, fmem + i, lvl->faces, lvl->totvert, lvl->totface);
 			create_old_vert_edge_map(emap + i, emem + i, lvl->edges, lvl->totvert, lvl->totedge);
 			lvl = lvl->next;
@@ -1411,11 +1848,11 @@ static void multires_load_old_dm(DerivedMesh *dm, Mesh *me, int totlvl)
 		/* Interior face verts */
 		/* lvl = lvl1->next->next; */ /* UNUSED */
 		dst = 0;
-		for(j = 0; j < lvl1->totface; ++j) {
+		for (j = 0; j < lvl1->totface; ++j) {
 			int sides = lvl1->faces[j].v[3] ? 4 : 3;
 			int ldst = dst + 1 + sides * (st - 1);
 
-			for(s = 0; s < sides; ++s) {
+			for (s = 0; s < sides; ++s) {
 				int st2 = multires_side_tot[totlvl - 1] - 2;
 				int st3 = multires_side_tot[totlvl - 2] - 2;
 				int st4 = st3 == 0 ? 1 : (st3 + 1) / 2;
@@ -1439,7 +1876,7 @@ static void multires_load_old_dm(DerivedMesh *dm, Mesh *me, int totlvl)
 
 		/*lvl = lvl->next;*/ /*UNUSED*/
 
-		for(i = 0; i < (unsigned int)(mr->level_count - 1); ++i) {
+		for (i = 0; i < (unsigned int)(mr->level_count - 1); ++i) {
 			MEM_freeN(fmap[i]);
 			MEM_freeN(fmem[i]);
 			MEM_freeN(emap[i]);
@@ -1453,7 +1890,7 @@ static void multires_load_old_dm(DerivedMesh *dm, Mesh *me, int totlvl)
 	}
 
 	/* Transfer verts */
-	for(i = 0; i < totvert; ++i)
+	for (i = 0; i < totvert; ++i)
 		copy_v3_v3(vdst[i].co, vsrc[vvmap[i]].co);
 
 	MEM_freeN(vvmap);
@@ -1470,19 +1907,19 @@ static void multires_load_old_vcols(Mesh *me)
 	MCol *mcol;
 	int i, j;
 
-	if(!(lvl = me->mr->levels.first))
+	if (!(lvl = me->mr->levels.first))
 		return;
 
-	if(!(colface = lvl->colfaces))
+	if (!(colface = lvl->colfaces))
 		return;
 
 	/* older multires format never supported multiple vcol layers,
-	   so we can assume the active vcol layer is the correct one */
-	if(!(mcol = CustomData_get_layer(&me->fdata, CD_MCOL)))
+	 * so we can assume the active vcol layer is the correct one */
+	if (!(mcol = CustomData_get_layer(&me->fdata, CD_MCOL)))
 		return;
 	
-	for(i = 0; i < me->totface; ++i) {
-		for(j = 0; j < 4; ++j) {
+	for (i = 0; i < me->totface; ++i) {
+		for (j = 0; j < 4; ++j) {
 			mcol[i*4 + j].a = colface[i].col[j].a;
 			mcol[i*4 + j].r = colface[i].col[j].r;
 			mcol[i*4 + j].g = colface[i].col[j].g;
@@ -1498,13 +1935,13 @@ static void multires_load_old_face_flags(Mesh *me)
 	MultiresFace *faces;
 	int i;
 
-	if(!(lvl = me->mr->levels.first))
+	if (!(lvl = me->mr->levels.first))
 		return;
 
-	if(!(faces = lvl->faces))
+	if (!(faces = lvl->faces))
 		return;
 
-	for(i = 0; i < me->totface; ++i)
+	for (i = 0; i < me->totface; ++i)
 		me->mface[i].flag = faces[i].flag;
 }
 
@@ -1529,11 +1966,11 @@ void multires_load_old(Object *ob, Mesh *me)
 	me->medge = CustomData_add_layer(&me->edata, CD_MEDGE, CD_CALLOC, NULL, me->totedge);
 	me->mface = CustomData_add_layer(&me->fdata, CD_MFACE, CD_CALLOC, NULL, me->totface);
 	memcpy(me->mvert, me->mr->verts, sizeof(MVert) * me->totvert);
-	for(i = 0; i < me->totedge; ++i) {
+	for (i = 0; i < me->totedge; ++i) {
 		me->medge[i].v1 = lvl->edges[i].v[0];
 		me->medge[i].v2 = lvl->edges[i].v[1];
 	}
-	for(i = 0; i < me->totface; ++i) {
+	for (i = 0; i < me->totface; ++i) {
 		me->mface[i].v1 = lvl->faces[i].v[0];
 		me->mface[i].v2 = lvl->faces[i].v[1];
 		me->mface[i].v3 = lvl->faces[i].v[2];
@@ -1543,28 +1980,28 @@ void multires_load_old(Object *ob, Mesh *me)
 
 	/* Add a multires modifier to the object */
 	md = ob->modifiers.first;
-	while(md && modifierType_getInfo(md->type)->type == eModifierTypeType_OnlyDeform)
+	while (md && modifierType_getInfo(md->type)->type == eModifierTypeType_OnlyDeform)
 		md = md->next;                          
 	mmd = (MultiresModifierData*)modifier_new(eModifierType_Multires);
 	BLI_insertlinkbefore(&ob->modifiers, md, mmd);
 
-	for(i = 0; i < me->mr->level_count - 1; ++i)
+	for (i = 0; i < me->mr->level_count - 1; ++i)
 		multiresModifier_subdivide(mmd, ob, 1, 0);
 
 	mmd->lvl = mmd->totlvl;
 	orig = CDDM_from_mesh(me, NULL);
-	dm = multires_dm_create_from_derived(mmd, 0, orig, ob, 0, 0);
+	dm = multires_dm_create_from_derived(mmd, 0, orig, ob, 0);
 					   
 	multires_load_old_dm(dm, me, mmd->totlvl+1);
 
-	multires_dm_mark_as_modified(dm);
+	multires_dm_mark_as_modified(dm, MULTIRES_COORDS_MODIFIED);
 	dm->release(dm);
 	orig->release(orig);
 
 	/* Copy the first-level data to the mesh */
-	for(i = 0, l = me->mr->vdata.layers; i < me->mr->vdata.totlayer; ++i, ++l)
+	for (i = 0, l = me->mr->vdata.layers; i < me->mr->vdata.totlayer; ++i, ++l)
 		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)
+	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));
@@ -1582,21 +2019,18 @@ static void multires_sync_levels(Scene *scene, Object *ob, Object *to_ob)
 	MultiresModifierData *mmd= get_multires_modifier(scene, ob, 1);
 	MultiresModifierData *to_mmd= get_multires_modifier(scene, to_ob, 1);
 
-	if(!mmd) {
+	if (!mmd) {
 		/* object could have MDISP even when there is no multires modifier
-		   this could lead to troubles due to i've got no idea how mdisp could be
-		   upsampled correct without modifier data.
-		   just remove mdisps if no multires present (nazgul) */
-
-		Mesh *me= (Mesh*)ob->data;
+		 * this could lead to troubles due to i've got no idea how mdisp could be
+		 * upsampled correct without modifier data.
+		 * just remove mdisps if no multires present (nazgul) */
 
-		CustomData_external_remove(&me->fdata, &me->id, CD_MDISPS, me->totface);
-		CustomData_free_layer_active(&me->fdata, CD_MDISPS, me->totface);
+		multires_customdata_delete(ob->data);
 	}
 
-	if(!mmd || !to_mmd) return;
+	if (!mmd || !to_mmd) return;
 
-	if(mmd->totlvl>to_mmd->totlvl) multires_del_higher(mmd, ob, to_mmd->totlvl);
+	if (mmd->totlvl>to_mmd->totlvl) multires_del_higher(mmd, ob, to_mmd->totlvl);
 	else multires_subdivide(mmd, ob, to_mmd->totlvl, 0, mmd->simple);
 }
 
@@ -1605,7 +2039,8 @@ static void multires_apply_smat(Scene *scene, Object *ob, float smat[3][3])
 	DerivedMesh *dm= NULL, *cddm= NULL, *subdm= NULL;
 	DMGridData **gridData, **subGridData;
 	Mesh *me= (Mesh*)ob->data;
-	MFace *mface= me->mface;
+	MPoly *mpoly= me->mpoly;
+	/* MLoop *mloop = me->mloop; */ /* UNUSED */
 	MDisps *mdisps;
 	int *gridOffset;
 	int i, /*numGrids,*/ gridSize, dGridSize, dSkip, totvert;
@@ -1613,10 +2048,10 @@ static void multires_apply_smat(Scene *scene, Object *ob, float smat[3][3])
 	MultiresModifierData *mmd= get_multires_modifier(scene, ob, 1);
 	MultiresModifierData high_mmd;
 
-	CustomData_external_read(&me->fdata, &me->id, CD_MASK_MDISPS, me->totface);
-	mdisps= CustomData_get_layer(&me->fdata, CD_MDISPS);
+	CustomData_external_read(&me->ldata, &me->id, CD_MASK_MDISPS, me->totloop);
+	mdisps= CustomData_get_layer(&me->ldata, CD_MDISPS);
 
-	if(!mdisps || !mmd || !mmd->totlvl) return;
+	if (!mdisps || !mmd || !mmd->totlvl) return;
 
 	/* we need derived mesh created from highest resolution */
 	high_mmd= *mmd;
@@ -1631,7 +2066,7 @@ static void multires_apply_smat(Scene *scene, Object *ob, float smat[3][3])
 	totvert= cddm->getNumVerts(cddm);
 	vertCos= MEM_mallocN(sizeof(*vertCos) * totvert, "multiresScale vertCos");
 	cddm->getVertCos(cddm, vertCos);
-	for(i=0; i<totvert; i++)
+	for (i=0; i<totvert; i++)
 		mul_m3_v3(smat, vertCos[i]);
 	CDDM_apply_vert_coords(cddm, vertCos);
 	MEM_freeN(vertCos);
@@ -1649,19 +2084,19 @@ 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)
-	for(i = 0; i < me->totface; ++i) {
-		const int numVerts= mface[i].v4 ? 4 : 3;
-		MDisps *mdisp= &mdisps[i];
+	#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];
 		int S, x, y, gIndex = gridOffset[i];
 
-		for(S = 0; S < numVerts; ++S, ++gIndex) {
+		for (S = 0; S < numVerts; ++S, ++gIndex, mdisp++) {
 			DMGridData *grid= gridData[gIndex];
 			DMGridData *subgrid= subGridData[gIndex];
-			float (*dispgrid)[3]= &mdisp->disps[S*dGridSize*dGridSize];
+			float (*dispgrid)[3]= mdisp->disps;
 
-			for(y = 0; y < gridSize; y++) {
-				for(x = 0; x < gridSize; x++) {
+			for (y = 0; y < gridSize; y++) {
+				for (x = 0; x < gridSize; x++) {
 					float *co= grid[x + y*gridSize].co;
 					float *sco= subgrid[x + y*gridSize].co;
 					float *no= grid[x + y*gridSize].no;
@@ -1697,7 +2132,7 @@ int multires_mdisp_corners(MDisps *s)
 {
 	int lvl= 13;
 
-	while(lvl > 0) {
+	while (lvl > 0) {
 		int side = (1 << (lvl-1)) + 1;
 		if ((s->totdisp % (side*side)) == 0) return s->totdisp / (side*side);
 		lvl--;
@@ -1731,276 +2166,41 @@ void multiresModifier_prepare_join(Scene *scene, Object *ob, Object *to_ob)
 }
 
 /* update multires data after topology changing */
-void multires_topology_changed(Scene *scene, Object *ob)
+void multires_topology_changed(Mesh *me)
 {
-	Mesh *me= (Mesh*)ob->data;
-	MDisps *mdisp= NULL, *cur= NULL;
-	int i, grid= 0, corners;
-	MultiresModifierData *mmd= get_multires_modifier(scene, ob, 1);
-
-	if(mmd)
-		multires_set_tot_mdisps(me, mmd->totlvl);
+	MDisps *mdisp = NULL, *cur = NULL;
+	int i, grid = 0;
 
-	CustomData_external_read(&me->fdata, &me->id, CD_MASK_MDISPS, me->totface);
-	mdisp= CustomData_get_layer(&me->fdata, CD_MDISPS);
+	CustomData_external_read(&me->ldata, &me->id, CD_MASK_MDISPS, me->totface);
+	mdisp = CustomData_get_layer(&me->ldata, CD_MDISPS);
 
-	if(!mdisp) return;
+	if (!mdisp)
+		return;
 
-	cur= mdisp;
-	for(i = 0; i < me->totface; i++, cur++) {
-		if(mdisp->totdisp) {
-			corners= multires_mdisp_corners(mdisp);
-			grid= mdisp->totdisp / corners;
+	cur = mdisp;
+	for (i = 0; i < me->totloop; i++, cur++) {
+		if (cur->totdisp) {
+			grid = mdisp->totdisp;
 
 			break;
 		}
 	}
 
-	for(i = 0; i < me->totface; i++, mdisp++) {
-		int nvert= me->mface[i].v4 ? 4 : 3;
-
+	for (i = 0; i < me->totloop; i++, mdisp++) {
 		/* allocate memory for mdisp, the whole disp layer would be erased otherwise */
-		if(!mdisp->totdisp || !mdisp->disps) {
-			if(grid) {
-				mdisp->totdisp= nvert*grid;
-				mdisp->disps= MEM_callocN(mdisp->totdisp*sizeof(float)*3, "mdisp topology");
+		if (!mdisp->totdisp || !mdisp->disps) {
+			if (grid) {
+				mdisp->totdisp = grid;
+				mdisp->disps = MEM_callocN(3 * mdisp->totdisp * sizeof(float), "mdisp topology");
 			}
 
 			continue;
 		}
-
-		corners= multires_mdisp_corners(mdisp);
-
-		if(corners!=nvert) {
-			mdisp->totdisp= (mdisp->totdisp/corners)*nvert;
-
-			if(mdisp->disps)
-				MEM_freeN(mdisp->disps);
-
-			mdisp->disps= MEM_callocN(mdisp->totdisp*sizeof(float)*3, "mdisp topology");
-		}
-	}
-}
-
-/* makes displacement along grid boundary symmetrical */
-void multires_mdisp_smooth_bounds(MDisps *disps)
-{
-	int x, y, side, S, corners;
-	float (*out)[3];
-
-	corners = multires_mdisp_corners(disps);
-	side = sqrt(disps->totdisp / corners);
-
-	out = disps->disps;
-	for(S = 0; S < corners; S++) {
-		for(y = 0; y < side; ++y) {
-			for(x = 0; x < side; ++x, ++out) {
-				float (*dispgrid)[3];
-				float *data;
-
-				if(x != 0 && y != 0) continue;
-
-				if(corners == 4) {
-					if(S == 0) {
-						if(y == 0) {
-							dispgrid = &disps->disps[1*side*side];
-							data = dispgrid[side * x + 0];
-
-							(*out)[0] = (*out)[0] + data[1];
-							(*out)[1] = (*out)[1] - data[0];
-							(*out)[2] = (*out)[2] + data[2];
-
-							mul_v3_fl(*out, 0.5);
-
-							data[0] = -(*out)[1];
-							data[1] = (*out)[0];
-							data[2] = (*out)[2];
-						} else if (x == 0) {
-							dispgrid = &disps->disps[3 * side * side];
-							data = dispgrid[side * 0 + y];
-
-							(*out)[0] = (*out)[0] - data[1];
-							(*out)[1] = (*out)[1] + data[0];
-							(*out)[2] = (*out)[2] + data[2];
-
-							mul_v3_fl(*out, 0.5);
-
-							data[0] = (*out)[1];
-							data[1] = -(*out)[0];
-							data[2] = (*out)[2];
-						}
-					} else if (S == 2) {
-						if(y == 0) {
-							dispgrid = &disps->disps[3 * side * side];
-							data = dispgrid[side * x + 0];
-
-							(*out)[0] = (*out)[0] + data[1];
-							(*out)[1] = (*out)[1] - data[0];
-							(*out)[2] = (*out)[2] + data[2];
-
-							mul_v3_fl(*out, 0.5);
-
-							data[0] = -(*out)[1];
-							data[1] = (*out)[0];
-							data[2] = (*out)[2];
-						} else if(x == 0) {
-							dispgrid = &disps->disps[1 * side * side];
-							data = dispgrid[side * 0 + y];
-
-							(*out)[0] = (*out)[0] - data[1];
-							(*out)[1] = (*out)[1] + data[0];
-							(*out)[2] = (*out)[2] + data[2];
-
-							mul_v3_fl(*out, 0.5);
-
-							data[0] = (*out)[1];
-							data[1] = -(*out)[0];
-							data[2] = (*out)[2];
-						}
-					}
-				} else if (corners == 3) {
-					if(S == 0) {
-						if(y == 0) {
-							dispgrid = &disps->disps[1*side*side];
-							data = dispgrid[side * x + 0];
-
-							(*out)[0] = (*out)[0] + data[1];
-							(*out)[1] = (*out)[1] - data[0];
-							(*out)[2] = (*out)[2] + data[2];
-
-							mul_v3_fl(*out, 0.5);
-
-							data[0] = -(*out)[1];
-							data[1] = (*out)[0];
-							data[2] = (*out)[2];
-						} else if (x == 0) {
-							dispgrid = &disps->disps[2 * side * side];
-							data = dispgrid[side * 0 + y];
-
-							(*out)[0] = (*out)[0] - data[1];
-							(*out)[1] = (*out)[1] + data[0];
-							(*out)[2] = (*out)[2] + data[2];
-
-							mul_v3_fl(*out, 0.5);
-
-							data[0] = (*out)[1];
-							data[1] = -(*out)[0];
-							data[2] = (*out)[2];
-						}
-					} else if (S == 2) {
-						if(x == 0) {
-							dispgrid = &disps->disps[1 * side * side];
-							data = dispgrid[side * 0 + y];
-
-							(*out)[0] = (*out)[0] - data[1];
-							(*out)[1] = (*out)[1] + data[0];
-							(*out)[2] = (*out)[2] + data[2];
-
-							mul_v3_fl(*out, 0.5);
-
-							data[0] = (*out)[1];
-							data[1] = -(*out)[0];
-							data[2] = (*out)[2];
-						}
-					}
-				}
-			}
-		}
 	}
 }
 
 /***************** Multires interpolation stuff *****************/
 
-static void mdisp_get_crn_rect(int face_side, float crn[3][4][2])
-{
-	float offset = face_side*0.5f - 0.5f;
-	float mid[2];
-
-	mid[0] = offset * 4 / 3;
-	mid[1] = offset * 2 / 3;
-
-	crn[0][0][0] = mid[0]; crn[0][0][1] = mid[1];
-	crn[0][1][0] = offset; crn[0][1][1] = 0;
-	crn[0][2][0] = 0; crn[0][2][1] = 0;
-	crn[0][3][0] = offset; crn[0][3][1] = offset;
-
-	crn[1][0][0] = mid[0]; crn[1][0][1] = mid[1];
-	crn[1][1][0] = offset * 2; crn[1][1][1] = offset;
-	crn[1][2][0] = offset * 2; crn[1][2][1] = 0;
-	crn[1][3][0] = offset; crn[1][3][1] = 0;
-
-	crn[2][0][0] = mid[0]; crn[2][0][1] = mid[1];
-	crn[2][1][0] = offset; crn[2][1][1] = offset;
-	crn[2][2][0] = offset * 2; crn[2][2][1] = offset * 2;
-	crn[2][3][0] = offset * 2; crn[2][3][1] = offset;
-}
-
-static int mdisp_pt_in_crn(float p[2], float crn[4][2])
-{
-	float v[2][2];
-	float a[2][2];
-
-	sub_v2_v2v2(v[0], crn[1], crn[0]);
-	sub_v2_v2v2(v[1], crn[3], crn[0]);
-
-	sub_v2_v2v2(a[0], p, crn[0]);
-	sub_v2_v2v2(a[1], crn[2], crn[0]);
-
-	if(cross_v2v2(a[0], v[0]) * cross_v2v2(a[1], v[0]) < 0)
-		return 0;
-
-	if(cross_v2v2(a[0], v[1]) * cross_v2v2(a[1], v[1]) < 0)
-		return 0;
-
-	return 1;
-}
-
-static void face_to_crn_interp(float u, float v, float v1[2], float v2[2], float v3[2], float v4[2], float *x)
-{
-	float a = (v4[1]-v3[1])*v2[0]+(-v4[1]+v3[1])*v1[0]+(-v2[1]+v1[1])*v4[0]+(v2[1]-v1[1])*v3[0];
-	float b = (v3[1]-v)*v2[0]+(v4[1]-2*v3[1]+v)*v1[0]+(-v4[1]+v3[1]+v2[1]-v1[1])*u+(v4[0]-v3[0])*v-v1[1]*v4[0]+(-v2[1]+2*v1[1])*v3[0];
-	float c = (v3[1]-v)*v1[0]+(-v3[1]+v1[1])*u+v3[0]*v-v1[1]*v3[0];
-	float d = b * b - 4 * a * c;
-	float x1, x2;
-
-	if(a == 0) {
-		*x = -c / b;
-		return;
-	}
-
-	x1 = (-b - sqrtf(d)) / (2 * a);
-	x2 = (-b + sqrtf(d)) / (2 * a);
-
-	*x = maxf(x1, x2);
-}
-
-void mdisp_rot_crn_to_face(const int S, const int corners, const int face_side, const float x, const float y, float *u, float *v)
-{
-	float offset = face_side*0.5f - 0.5f;
-
-	if(corners == 4) {
-		if(S == 1) { *u= offset + x; *v = offset - y; }
-		if(S == 2) { *u= offset + y; *v = offset + x; }
-		if(S == 3) { *u= offset - x; *v = offset + y; }
-		if(S == 0) { *u= offset - y; *v = offset - x; }
-	} else {
-		float crn[3][4][2], vec[4][2];
-		float p[2];
-
-		mdisp_get_crn_rect(face_side, crn);
-
-		interp_v2_v2v2(vec[0], crn[S][0], crn[S][1], x / offset);
-		interp_v2_v2v2(vec[1], crn[S][3], crn[S][2], x / offset);
-		interp_v2_v2v2(vec[2], crn[S][0], crn[S][3], y / offset);
-		interp_v2_v2v2(vec[3], crn[S][1], crn[S][2], y / offset);
-
-		isect_seg_seg_v2_point(vec[0], vec[1], vec[2], vec[3], p);
-
-		(*u) = p[0];
-		(*v) = p[1];
-	}
-}
-
 /* Find per-corner coordinate with given per-face UV coord */
 int mdisp_rot_face_to_crn(const int corners, const int face_side, const float u, const float v, float *x, float *y)
 {
@@ -2008,25 +2208,29 @@ int mdisp_rot_face_to_crn(const int corners, const int face_side, const float u,
 	int S = 0;
 
 	if (corners == 4) {
-		if(u <= offset && v <= offset) S = 0;
-		else if(u > offset  && v <= offset) S = 1;
-		else if(u > offset  && v > offset) S = 2;
-		else if(u <= offset && v >= offset)  S = 3;
+		if (u <= offset && v <= offset) S = 0;
+		else if (u > offset  && v <= offset) S = 1;
+		else if (u > offset  && v > offset) S = 2;
+		else if (u <= offset && v >= offset)  S = 3;
 
-		if(S == 0) {
+		if (S == 0) {
 			*y = offset - u;
 			*x = offset - v;
-		} else if(S == 1) {
+		}
+		else if (S == 1) {
 			*x = u - offset;
 			*y = offset - v;
-		} else if(S == 2) {
+		}
+		else if (S == 2) {
 			*y = u - offset;
 			*x = v - offset;
-		} else if(S == 3) {
+		}
+		else if (S == 3) {
 			*x= offset - u;
 			*y = v - offset;
 		}
-	} else {
+	}
+	else {
 		int grid_size = offset;
 		float w = (face_side - 1) - u - v;
 		float W1, W2;
@@ -2044,174 +2248,3 @@ int mdisp_rot_face_to_crn(const int corners, const int face_side, const float u,
 
 	return S;
 }
-
-/* Find per-corner coordinate with given per-face UV coord
-   Practically as the previous funciton but it assumes a bit different coordinate system for triangles
-   which is optimized for MDISP layer interpolation:
-
-   v
-   ^
-   |      /|
-   |    /  |
-   |  /    |
-   |/______|___> u
-
- */
-int mdisp_rot_face_to_quad_crn(const int corners, const int face_side, const float u, const float v, float *x, float *y)
-{
-	const float offset = face_side*0.5f - 0.5f;
-	int S = 0;
-
-	if (corners == 4) {
-		if(u <= offset && v <= offset) S = 0;
-		else if(u > offset  && v <= offset) S = 1;
-		else if(u > offset  && v > offset) S = 2;
-		else if(u <= offset && v >= offset)  S = 3;
-
-		if(S == 0) {
-			*y = offset - u;
-			*x = offset - v;
-		} else if(S == 1) {
-			*x = u - offset;
-			*y = offset - v;
-		} else if(S == 2) {
-			*y = u - offset;
-			*x = v - offset;
-		} else if(S == 3) {
-			*x= offset - u;
-			*y = v - offset;
-		}
-	} else {
-		float crn[3][4][2];
-		float p[2] = {u, v};
-
-		mdisp_get_crn_rect(face_side, crn);
-
-		for (S = 0; S < 3; ++S) {
-			if (mdisp_pt_in_crn(p, crn[S]))
-				break;
-		}
-
-		face_to_crn_interp(u, v, crn[S][0], crn[S][1], crn[S][3], crn[S][2], &p[0]);
-		face_to_crn_interp(u, v, crn[S][0], crn[S][3], crn[S][1], crn[S][2], &p[1]);
-
-		*x = p[0] * offset;
-		*y = p[1] * offset;
-	}
-
-	return S;
-}
-
-void mdisp_apply_weight(const int S, const int corners, int x, int y, const int face_side,
-	float crn_weight[4][2], float *u_r, float *v_r)
-{
-	float u, v, xl, yl;
-	float mid1[2], mid2[2], mid3[2];
-
-	mdisp_rot_crn_to_face(S, corners, face_side, x, y, &u, &v);
-
-	if(corners == 4) {
-		xl = u / (face_side - 1);
-		yl = v / (face_side - 1);
-
-		mid1[0] = crn_weight[0][0] * (1 - xl) + crn_weight[1][0] * xl;
-		mid1[1] = crn_weight[0][1] * (1 - xl) + crn_weight[1][1] * xl;
-		mid2[0] = crn_weight[3][0] * (1 - xl) + crn_weight[2][0] * xl;
-		mid2[1] = crn_weight[3][1] * (1 - xl) + crn_weight[2][1] * xl;
-		mid3[0] = mid1[0] * (1 - yl) + mid2[0] * yl;
-		mid3[1] = mid1[1] * (1 - yl) + mid2[1] * yl;
-	} else {
-		yl = v / (face_side - 1);
-
-		if(v == face_side - 1) xl = 1;
-		else xl = 1 - (face_side - 1 - u) / (face_side - 1 - v);
-
-		mid1[0] = crn_weight[0][0] * (1 - xl) + crn_weight[1][0] * xl;
-		mid1[1] = crn_weight[0][1] * (1 - xl) + crn_weight[1][1] * xl;
-		mid3[0] = mid1[0] * (1 - yl) + crn_weight[2][0] * yl;
-		mid3[1] = mid1[1] * (1 - yl) + crn_weight[2][1] * yl;
-	}
-
-	*u_r = mid3[0];
-	*v_r = mid3[1];
-}
-
-void mdisp_flip_disp(const int S, const int corners, const float axis_x[2], const float axis_y[2], float disp[3])
-{
-	float crn_x[2], crn_y[2];
-	float vx[2], vy[2], coord[2];
-
-	if (corners == 4) {
-		float x[4][2] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}};
-		float y[4][2] = {{-1, 0}, {0, -1}, {1, 0}, {0, 1}};
-
-		copy_v2_v2(crn_x, x[S]);
-		copy_v2_v2(crn_y, y[S]);
-
-		mul_v2_v2fl(vx, crn_x, disp[0]);
-		mul_v2_v2fl(vy, crn_y, disp[1]);
-		add_v2_v2v2(coord, vx, vy);
-
-		project_v2_v2v2(vx, coord, axis_x);
-		project_v2_v2v2(vy, coord, axis_y);
-
-		disp[0] = len_v2(vx);
-		disp[1] = len_v2(vy);
-
-		if(dot_v2v2(vx, axis_x) < 0)
-			disp[0] = -disp[0];
-
-		if(dot_v2v2(vy, axis_y) < 0)
-			disp[1] = -disp[1];
-	} else {
-		/* XXX: it was very overhead code to support displacement flipping
-		        for case of tris without visible profit.
-		        Maybe its not really big limitation? for now? (nazgul) */
-		disp[0] = 0;
-		disp[1] = 0;
-	}
-}
-
-/* Join two triangular displacements into one quad
-	 Corners mapping:
-	 2 -------- 3
-	 | \   tri2 |
-	 |    \     |
-	 | tri1  \  |
-	 0 -------- 1 */
-void mdisp_join_tris(MDisps *dst, MDisps *tri1, MDisps *tri2)
-{
-	int side, st;
-	int S, x, y, crn;
-	float face_u, face_v, crn_u, crn_v;
-	float (*out)[3];
-	MDisps *src;
-
-	if(dst->disps)
-		MEM_freeN(dst->disps);
-
-	side = sqrt(tri1->totdisp / 3);
-	st = (side<<1)-1;
-
-	dst->totdisp = 4 * side * side;
-	out = dst->disps = MEM_callocN(3*dst->totdisp*sizeof(float), "join disps");
-
-	for(S = 0; S < 4; S++)
-		for(y = 0; y < side; ++y)
-			for(x = 0; x < side; ++x, ++out) {
-				mdisp_rot_crn_to_face(S, 4, st, x, y, &face_u, &face_v);
-				face_u = st - 1 - face_u;
-
-				if(face_v > face_u) {
-					src = tri2;
-					face_u = st - 1 - face_u;
-					face_v = st - 1 - face_v;
-				} else src = tri1;
-
-				crn = mdisp_rot_face_to_quad_crn(3, st, face_u, face_v, &crn_u, &crn_v);
-
-				old_mdisps_bilinear((*out), &src->disps[crn*side*side], side, crn_u, crn_v);
-				(*out)[0] = 0;
-				(*out)[1] = 0;
-			}
-}
diff --git a/source/blender/blenkernel/intern/navmesh_conversion.c b/source/blender/blenkernel/intern/navmesh_conversion.c
index e674973..34e0be1 100644
--- a/source/blender/blenkernel/intern/navmesh_conversion.c
+++ b/source/blender/blenkernel/intern/navmesh_conversion.c
@@ -44,12 +44,12 @@
 
 #include "recast-capi.h"
 
-BM_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]);
 }
 
-BM_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;
 }
@@ -134,8 +134,8 @@ int buildRawVertIndicesData(DerivedMesh* dm, int *nverts_r, float **verts_r,
 	}
 
 	//calculate number of tris
-	nfaces = dm->getNumFaces(dm);
-	faces = dm->getFaceArray(dm);
+	nfaces = dm->getNumTessFaces(dm);
+	faces = dm->getTessFaceArray(dm);
 	ntris = nfaces;
 	for (fi=0; fi<nfaces; fi++)
 	{
@@ -166,7 +166,7 @@ int buildRawVertIndicesData(DerivedMesh* dm, int *nverts_r, float **verts_r,
 	}
 
 	//carefully, recast data is just reference to data in derived mesh
-	*recastData = (int*)CustomData_get_layer(&dm->faceData, CD_RECAST);
+	*recastData = (int*)CustomData_get_layer(&dm->polyData, CD_RECAST);
 
 	*nverts_r = nverts;
 	*verts_r = verts;
@@ -248,8 +248,7 @@ int buildPolygonsByDetailedMeshes(const int vertsPerPoly, const int npolys,
 				//move to next edge					
 				edge = (edge+1)%3;
 			}
-			else
-			{
+			else {
 				//move to next tri
 				int twinedge = -1;
 				for (k=0; k<3; k++)
@@ -502,7 +501,7 @@ exit:
 int polyFindVertex(const unsigned short* p, const int vertsPerPoly, unsigned short vertexIdx)
 {
 	int i, res = -1;
-	for(i=0; i<vertsPerPoly; i++)
+	for (i=0; i<vertsPerPoly; i++)
 	{
 		if (p[i]==0xffff)
 			break;
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index 12f403d..56fec11 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -140,7 +140,7 @@ void free_nladata (ListBase *tracks)
 	NlaTrack *nlt, *nltn;
 	
 	/* sanity checks */
-	if ELEM(NULL, tracks, tracks->first)
+	if (ELEM(NULL, tracks, tracks->first))
 		return;
 		
 	/* free tracks one by one */
@@ -221,7 +221,7 @@ void copy_nladata (ListBase *dst, ListBase *src)
 	NlaTrack *nlt, *nlt_d;
 	
 	/* sanity checks */
-	if ELEM(NULL, dst, src)
+	if (ELEM(NULL, dst, src))
 		return;
 		
 	/* clear out the destination list first for precautions... */
@@ -286,7 +286,7 @@ NlaStrip *add_nlastrip (bAction *act)
 	 *	- selected flag to highlight this to the user
 	 *	- auto-blends to ensure that blend in/out values are automatically 
 	 *	  determined by overlaps of strips
-	 *	- (XXX) synchronisation of strip-length in accordance with changes to action-length
+	 *	- (XXX) synchronization of strip-length in accordance with changes to action-length
 	 *	  is not done though, since this should only really happens in editmode for strips now
 	 *	  though this decision is still subject to further review...
 	 */
@@ -319,7 +319,7 @@ NlaStrip *add_nlastrip_to_stack (AnimData *adt, bAction *act)
 	NlaTrack *nlt;
 	
 	/* sanity checks */
-	if ELEM(NULL, adt, act)
+	if (ELEM(NULL, adt, act))
 		return NULL;
 	
 	/* create a new NLA strip */
@@ -352,8 +352,7 @@ NlaStrip *add_nla_soundstrip (Scene *scene, Speaker *speaker)
 	 * otherwise default to length of 10 frames
 	 */
 #ifdef WITH_AUDASPACE
-	if (speaker->sound) 
-	{
+	if (speaker->sound) {
 		AUD_SoundInfo info = AUD_getInfo(speaker->sound->playback_handle);
 		
 		strip->end = (float)ceil((double)info.length * FPS);
@@ -587,7 +586,7 @@ void BKE_nlastrips_sort_strips (ListBase *strips)
 	NlaStrip *strip, *sstrip, *stripn;
 	
 	/* sanity checks */
-	if ELEM(NULL, strips, strips->first)
+	if (ELEM(NULL, strips, strips->first))
 		return;
 	
 	/* we simply perform insertion sort on this list, since it is assumed that per track,
@@ -631,7 +630,7 @@ short BKE_nlastrips_add_strip (ListBase *strips, NlaStrip *strip)
 	short not_added = 1;
 	
 	/* sanity checks */
-	if ELEM(NULL, strips, strip)
+	if (ELEM(NULL, strips, strip))
 		return 0;
 		
 	/* check if any space to add */
@@ -669,7 +668,7 @@ void BKE_nlastrips_make_metas (ListBase *strips, short temp)
 	NlaStrip *strip, *stripn;
 	
 	/* sanity checks */
-	if ELEM(NULL, strips, strips->first)
+	if (ELEM(NULL, strips, strips->first))
 		return;
 	
 	/* group all continuous chains of selected strips into meta-strips */
@@ -720,7 +719,7 @@ void BKE_nlastrips_clear_metastrip (ListBase *strips, NlaStrip *strip)
 	NlaStrip *cs, *csn;
 	
 	/* sanity check */
-	if ELEM(NULL, strips, strip)
+	if (ELEM(NULL, strips, strip))
 		return;
 	
 	/* move each one of the meta-strip's children before the meta-strip
@@ -745,7 +744,7 @@ void BKE_nlastrips_clear_metas (ListBase *strips, short onlySel, short onlyTemp)
 	NlaStrip *strip, *stripn;
 	
 	/* sanity checks */
-	if ELEM(NULL, strips, strips->first)
+	if (ELEM(NULL, strips, strips->first))
 		return;
 	
 	/* remove meta-strips fitting the criteria of the arguments */
@@ -770,7 +769,7 @@ void BKE_nlastrips_clear_metas (ListBase *strips, short onlySel, short onlyTemp)
 short BKE_nlameta_add_strip (NlaStrip *mstrip, NlaStrip *strip)
 {
 	/* sanity checks */
-	if ELEM(NULL, mstrip, strip)
+	if (ELEM(NULL, mstrip, strip))
 		return 0;
 		
 	/* firstly, check if the meta-strip has space for this */
@@ -778,7 +777,7 @@ short BKE_nlameta_add_strip (NlaStrip *mstrip, NlaStrip *strip)
 		return 0;
 		
 	/* check if this would need to be added to the ends of the meta,
-	 * and subsequently, if the neighbouring strips allow us enough room
+	 * and subsequently, if the neighboring strips allow us enough room
 	 */
 	if (strip->start < mstrip->start) {
 		/* check if strip to the left (if it exists) ends before the 
@@ -828,7 +827,7 @@ void BKE_nlameta_flush_transforms (NlaStrip *mstrip)
 	 *	- strip must exist
 	 *	- strip must be a meta-strip with some contents
 	 */
-	if ELEM(NULL, mstrip, mstrip->strips.first)
+	if (ELEM(NULL, mstrip, mstrip->strips.first))
 		return;
 	if (mstrip->type != NLASTRIP_TYPE_META)
 		return;
@@ -841,7 +840,7 @@ void BKE_nlameta_flush_transforms (NlaStrip *mstrip)
 	oEnd= ((NlaStrip *)mstrip->strips.last)->end;
 	offset= mstrip->start - oStart;
 	
-	/* optimisation:
+	/* optimization:
 	 * don't flush if nothing changed yet
 	 *	TODO: maybe we need a flag to say always flush?
 	 */
@@ -900,7 +899,7 @@ NlaTrack *BKE_nlatrack_find_active (ListBase *tracks)
 	NlaTrack *nlt;
 	
 	/* sanity check */
-	if ELEM(NULL, tracks, tracks->first)
+	if (ELEM(NULL, tracks, tracks->first))
 		return NULL;
 		
 	/* try to find the first active track */
@@ -921,7 +920,7 @@ void BKE_nlatrack_solo_toggle (AnimData *adt, NlaTrack *nlt)
 	NlaTrack *nt;
 	
 	/* sanity check */
-	if ELEM(NULL, adt, adt->nla_tracks.first)
+	if (ELEM(NULL, adt, adt->nla_tracks.first))
 		return;
 		
 	/* firstly, make sure 'solo' flag for all tracks is disabled */
@@ -953,7 +952,7 @@ void BKE_nlatrack_set_active (ListBase *tracks, NlaTrack *nlt_a)
 	NlaTrack *nlt;
 	
 	/* sanity check */
-	if ELEM(NULL, tracks, tracks->first)
+	if (ELEM(NULL, tracks, tracks->first))
 		return;
 	
 	/* deactive all the rest */
@@ -991,7 +990,7 @@ short BKE_nlatrack_has_space (NlaTrack *nlt, float start, float end)
 void BKE_nlatrack_sort_strips (NlaTrack *nlt)
 {
 	/* sanity checks */
-	if ELEM(NULL, nlt, nlt->strips.first)
+	if (ELEM(NULL, nlt, nlt->strips.first))
 		return;
 	
 	/* sort the strips with a more generic function */
@@ -1004,7 +1003,7 @@ void BKE_nlatrack_sort_strips (NlaTrack *nlt)
 short BKE_nlatrack_add_strip (NlaTrack *nlt, NlaStrip *strip)
 {
 	/* sanity checks */
-	if ELEM(NULL, nlt, strip)
+	if (ELEM(NULL, nlt, strip))
 		return 0;
 		
 	/* try to add the strip to the track using a more generic function */
@@ -1018,14 +1017,14 @@ short BKE_nlatrack_get_bounds (NlaTrack *nlt, float bounds[2])
 {
 	NlaStrip *strip;
 	
-	/* initialise bounds */
+	/* initialize bounds */
 	if (bounds)
 		bounds[0] = bounds[1] = 0.0f;
 	else
 		return 0;
 	
 	/* sanity checks */
-	if ELEM(NULL, nlt, nlt->strips.first)
+	if (ELEM(NULL, nlt, nlt->strips.first))
 		return 0;
 		
 	/* lower bound is first strip's start frame */
@@ -1048,7 +1047,7 @@ NlaStrip *BKE_nlastrip_find_active (NlaTrack *nlt)
 	NlaStrip *strip;
 	
 	/* sanity check */
-	if ELEM(NULL, nlt, nlt->strips.first)
+	if (ELEM(NULL, nlt, nlt->strips.first))
 		return NULL;
 		
 	/* try to find the first active strip */
@@ -1073,7 +1072,7 @@ void BKE_nlastrip_set_active (AnimData *adt, NlaStrip *strip)
 	
 	/* loop over tracks, deactivating*/
 	for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next) {
-		for (nls= nlt->strips.first; nls; nls= nls->next)  {
+		for (nls= nlt->strips.first; nls; nls= nls->next) {
 			if (nls != strip)
 				nls->flag &= ~NLASTRIP_FLAG_ACTIVE;
 			else
@@ -1147,7 +1146,7 @@ static short nlastrip_is_first (AnimData *adt, NlaStrip *strip)
 	NlaStrip *ns;
 	
 	/* sanity checks */
-	if ELEM(NULL, adt, strip)
+	if (ELEM(NULL, adt, strip))
 		return 0;
 		
 	/* check if strip has any strips before it */
@@ -1177,7 +1176,7 @@ short BKE_nlatrack_has_animated_strips (NlaTrack *nlt)
 	NlaStrip *strip;
 	
 	/* sanity checks */
-	if ELEM(NULL, nlt, nlt->strips.first)
+	if (ELEM(NULL, nlt, nlt->strips.first))
 		return 0;
 		
 	/* check each strip for F-Curves only (don't care about whether the flags are set) */
@@ -1196,7 +1195,7 @@ short BKE_nlatracks_have_animated_strips (ListBase *tracks)
 	NlaTrack *nlt;
 	
 	/* sanity checks */
-	if ELEM(NULL, tracks, tracks->first)
+	if (ELEM(NULL, tracks, tracks->first))
 		return 0;
 		
 	/* check each track, stopping on the first hit */
@@ -1235,7 +1234,7 @@ void BKE_nlastrip_validate_fcurves (NlaStrip *strip)
 			/* store path - make copy, and store that */
 			fcu->rna_path= BLI_strdupn("influence", 9);
 			
-			// TODO: insert a few keyframes to ensure default behaviour?
+			// TODO: insert a few keyframes to ensure default behavior?
 		}
 	}
 	
@@ -1256,7 +1255,7 @@ void BKE_nlastrip_validate_fcurves (NlaStrip *strip)
 			/* store path - make copy, and store that */
 			fcu->rna_path= BLI_strdupn("strip_time", 10);
 			
-			// TODO: insert a few keyframes to ensure default behaviour?
+			// TODO: insert a few keyframes to ensure default behavior?
 		}
 	}
 }
@@ -1280,7 +1279,7 @@ void BKE_nlastrip_validate_name (AnimData *adt, NlaStrip *strip)
 	NlaTrack *nlt;
 	
 	/* sanity checks */
-	if ELEM(NULL, adt, strip)
+	if (ELEM(NULL, adt, strip))
 		return;
 		
 	/* give strip a default name if none already */
@@ -1377,7 +1376,7 @@ static void BKE_nlastrip_validate_autoblends (NlaTrack *nlt, NlaStrip *nls)
 	float *ns=NULL, *ne=NULL;
 	
 	/* sanity checks */
-	if ELEM(NULL, nls, nlt)
+	if (ELEM(NULL, nls, nlt))
 		return;
 	if ((nlt->prev == NULL) && (nlt->next == NULL))
 		return;
@@ -1395,8 +1394,7 @@ static void BKE_nlastrip_validate_autoblends (NlaTrack *nlt, NlaStrip *nls)
 	 *	  is directly followed/preceeded by another strip, forming an 
 	 *	  'island' of continuous strips
 	 */
-	if ( (ps || ns) && ((nls->prev == NULL) || IS_EQF(nls->prev->end, nls->start)==0) )
-	{
+	if ((ps || ns) && ((nls->prev == NULL) || IS_EQF(nls->prev->end, nls->start)==0)) {
 		/* start overlaps - pick the largest overlap */
 		if ( ((ps && ns) && (*ps > *ns)) || (ps) )
 			nls->blendin= *ps - nls->start;
@@ -1406,8 +1404,7 @@ static void BKE_nlastrip_validate_autoblends (NlaTrack *nlt, NlaStrip *nls)
 	else /* no overlap allowed/needed */
 		nls->blendin= 0.0f;
 		
-	if ( (pe || ne) && ((nls->next == NULL) || IS_EQF(nls->next->start, nls->end)==0) )
-	{
+	if ((pe || ne) && ((nls->next == NULL) || IS_EQF(nls->next->start, nls->end)==0)) {
 		/* end overlaps - pick the largest overlap */
 		if ( ((pe && ne) && (*pe > *ne)) || (pe) )
 			nls->blendout= nls->end - *pe;
@@ -1425,7 +1422,7 @@ void BKE_nla_validate_state (AnimData *adt)
 	NlaTrack *nlt;
 	
 	/* sanity checks */
-	if ELEM(NULL, adt, adt->nla_tracks.first)
+	if (ELEM(NULL, adt, adt->nla_tracks.first))
 		return;
 		
 	/* adjust blending values for auto-blending, and also do an initial pass to find the earliest strip */
@@ -1479,7 +1476,7 @@ void BKE_nla_action_pushdown (AnimData *adt)
 	
 	/* sanity checks */
 	// TODO: need to report the error for this
-	if ELEM(NULL, adt, adt->action) 
+	if (ELEM(NULL, adt, adt->action))
 		return;
 		
 	/* if the action is empty, we also shouldn't try to add to stack, 
@@ -1487,7 +1484,7 @@ void BKE_nla_action_pushdown (AnimData *adt)
 	 */
 	// TODO: what about modifiers?
 	if (action_has_motion(adt->action) == 0) {
-		printf("BKE_nla_action_pushdown(): action has no data \n");
+		printf("BKE_nla_action_pushdown(): action has no data\n");
 		return;
 	}
 	
@@ -1527,7 +1524,7 @@ short BKE_nla_tweakmode_enter (AnimData *adt)
 	NlaStrip *strip, *activeStrip=NULL;
 	
 	/* verify that data is valid */
-	if ELEM(NULL, adt, adt->nla_tracks.first)
+	if (ELEM(NULL, adt, adt->nla_tracks.first))
 		return 0;
 		
 	/* if block is already in tweakmode, just leave, but we should report 
@@ -1578,10 +1575,10 @@ short BKE_nla_tweakmode_enter (AnimData *adt)
 		}
 	}
 	
-	if ELEM3(NULL, activeTrack, activeStrip, activeStrip->act) {
-		if (G.f & G_DEBUG) {
-			printf("NLA tweakmode enter - neither active requirement found \n");
-			printf("\tactiveTrack = %p, activeStrip = %p \n", (void *)activeTrack, (void *)activeStrip);
+	if (ELEM3(NULL, activeTrack, activeStrip, activeStrip->act)) {
+		if (G.debug & G_DEBUG) {
+			printf("NLA tweakmode enter - neither active requirement found\n");
+			printf("\tactiveTrack = %p, activeStrip = %p\n", (void *)activeTrack, (void *)activeStrip);
 		}
 		return 0;
 	}
@@ -1628,7 +1625,7 @@ void BKE_nla_tweakmode_exit (AnimData *adt)
 	NlaTrack *nlt;
 	
 	/* verify that data is valid */
-	if ELEM(NULL, adt, adt->nla_tracks.first)
+	if (ELEM(NULL, adt, adt->nla_tracks.first))
 		return;
 		
 	/* hopefully the flag is correct - skip if not on */
@@ -1670,7 +1667,7 @@ static void UNUSED_FUNCTION(BKE_nla_bake) (Scene *scene, ID *UNUSED(id), AnimDat
 	 *	1) Scene and AnimData must be provided 
 	 *	2) there must be tracks to merge...
 	 */
-	if ELEM3(NULL, scene, adt, adt->nla_tracks.first)
+	if (ELEM3(NULL, scene, adt, adt->nla_tracks.first))
 		return;
 	
 	/* if animdata currently has an action, 'push down' this onto the stack first */
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index b72abcd..2fb3f81 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -55,6 +55,8 @@
 #include "BLI_path_util.h"
 #include "BLI_utildefines.h"
 
+#include "BLF_translation.h"
+
 #include "BKE_animsys.h"
 #include "BKE_action.h"
 #include "BKE_fcurve.h"
@@ -66,8 +68,6 @@
 #include "BKE_utildefines.h"
 #include "BKE_utildefines.h"
 
-#include "BLI_listbase.h"
-
 #include "RNA_access.h"
 
 #include "NOD_socket.h"
@@ -87,7 +87,7 @@ bNodeTreeType *ntreeGetType(int type)
 		types_init = 0;
 	}
 	
-	if(type >= 0 && type < NUM_NTREE_TYPES) {
+	if (type >= 0 && type < NUM_NTREE_TYPES) {
 		return types[type];
 	}
 	else {
@@ -98,8 +98,8 @@ bNodeTreeType *ntreeGetType(int type)
 static bNodeType *node_get_type(bNodeTree *ntree, int type)
 {
 	bNodeType *ntype = ntreeGetType(ntree->type)->node_types.first;
-	for(; ntype; ntype= ntype->next)
-		if(ntype->type==type)
+	for (; ntype; ntype= ntype->next)
+		if (ntype->type==type)
 			return ntype;
 	
 	return NULL;
@@ -120,7 +120,7 @@ bNodeSocketType *ntreeGetSocketType(int type)
 		types_init= 0;
 	}
 
-	if(type < NUM_SOCKET_TYPES) {
+	if (type < NUM_SOCKET_TYPES) {
 		return types[type];
 	}
 	else {
@@ -132,23 +132,23 @@ void ntreeInitTypes(bNodeTree *ntree)
 {
 	bNode *node, *next;
 	
-	for(node= ntree->nodes.first; node; node= next) {
+	for (node= ntree->nodes.first; node; node= next) {
 		next= node->next;
 		
 		node->typeinfo= node_get_type(ntree, node->type);
 		
-		if(node->type==NODE_DYNAMIC) {
+		if (node->type==NODE_DYNAMIC) {
 			/* needed info if the pynode script fails now: */
 			node->storage= ntree;
-			if(node->id!=NULL) { /* not an empty script node */
+			if (node->id!=NULL) { /* not an empty script node */
 				node->custom1= 0;
 				node->custom1= BSET(node->custom1,NODE_DYNAMIC_ADDEXIST);
 			}
-//			if(node->typeinfo)
+//			if (node->typeinfo)
 //				node->typeinfo->initfunc(node);
 		}
 
-		if(node->typeinfo==NULL) {
+		if (node->typeinfo==NULL) {
 			printf("Error: Node type %s doesn't exist anymore, removed\n", node->name);
 			nodeFreeNode(ntree, node);
 		}
@@ -204,9 +204,9 @@ void nodeRemoveSocket(bNodeTree *ntree, bNode *node, bNodeSocket *sock)
 {
 	bNodeLink *link, *next;
 	
-	for(link= ntree->links.first; link; link= next) {
+	for (link= ntree->links.first; link; link= next) {
 		next= link->next;
-		if(link->fromsock==sock || link->tosock==sock) {
+		if (link->fromsock==sock || link->tosock==sock) {
 			nodeRemLink(ntree, link);
 		}
 	}
@@ -226,9 +226,9 @@ void nodeRemoveAllSockets(bNodeTree *ntree, bNode *node)
 	bNodeSocket *sock;
 	bNodeLink *link, *next;
 	
-	for(link= ntree->links.first; link; link= next) {
+	for (link= ntree->links.first; link; link= next) {
 		next= link->next;
-		if(link->fromnode==node || link->tonode==node) {
+		if (link->fromnode==node || link->tonode==node) {
 			nodeRemLink(ntree, link);
 		}
 	}
@@ -256,28 +256,28 @@ int nodeFindNode(bNodeTree *ntree, bNodeSocket *sock, bNode **nodep, int *sockin
 	bNodeSocket *tsock;
 	int index= 0;
 	
-	for(node= ntree->nodes.first; node; node= node->next) {
-		for(index=0, tsock= node->inputs.first; tsock; tsock= tsock->next, index++) {
-			if(tsock==sock) {
+	for (node= ntree->nodes.first; node; node= node->next) {
+		for (index=0, tsock= node->inputs.first; tsock; tsock= tsock->next, index++) {
+			if (tsock==sock) {
 				if (in_out) *in_out= SOCK_IN;
 				break;
 			}
 		}
-		if(tsock)
+		if (tsock)
 			break;
-		for(index=0, tsock= node->outputs.first; tsock; tsock= tsock->next, index++) {
-			if(tsock==sock) {
+		for (index=0, tsock= node->outputs.first; tsock; tsock= tsock->next, index++) {
+			if (tsock==sock) {
 				if (in_out) *in_out= SOCK_OUT;
 				break;
 			}
 		}
-		if(tsock)
+		if (tsock)
 			break;
 	}
 
-	if(node) {
+	if (node) {
 		*nodep= node;
-		if(sockindex) *sockindex= index;
+		if (sockindex) *sockindex= index;
 		return 1;
 	}
 	
@@ -291,17 +291,17 @@ static void node_add_sockets_from_type(bNodeTree *ntree, bNode *node, bNodeType
 	bNodeSocketTemplate *sockdef;
 	/* bNodeSocket *sock; */ /* UNUSED */
 
-	if(ntype->inputs) {
+	if (ntype->inputs) {
 		sockdef= ntype->inputs;
-		while(sockdef->type != -1) {
+		while (sockdef->type != -1) {
 			/* sock = */ node_add_input_from_template(ntree, node, sockdef);
 			
 			sockdef++;
 		}
 	}
-	if(ntype->outputs) {
+	if (ntype->outputs) {
 		sockdef= ntype->outputs;
-		while(sockdef->type != -1) {
+		while (sockdef->type != -1) {
 			/* sock = */ node_add_output_from_template(ntree, node, sockdef);
 			
 			sockdef++;
@@ -321,7 +321,7 @@ bNode *nodeAddNode(bNodeTree *ntree, struct bNodeTemplate *ntemp)
 	bNodeType *ntype;
 	
 	ntype= node_get_type(ntree, ntemp->type);
-	if(ntype == NULL) {
+	if (ntype == NULL) {
 		printf("nodeAddNodeType() error: '%d' type invalid\n", ntemp->type);
 		return NULL;
 	}
@@ -339,7 +339,7 @@ bNode *nodeAddNode(bNodeTree *ntree, struct bNodeTemplate *ntemp)
 	
 	node_add_sockets_from_type(ntree, node, ntype);
 	
-	if(ntype->initfunc!=NULL)
+	if (ntype->initfunc!=NULL)
 		ntype->initfunc(ntree, node, ntemp);
 	
 	/* initialize the node name with the node label */
@@ -357,14 +357,14 @@ void nodeMakeDynamicType(bNode *node)
 {
 	/* find SH_DYNAMIC_NODE ntype */
 	bNodeType *ntype= ntreeGetType(NTREE_SHADER)->node_types.first;
-	while(ntype) {
-		if(ntype->type==NODE_DYNAMIC)
+	while (ntype) {
+		if (ntype->type==NODE_DYNAMIC)
 			break;
 		ntype= ntype->next;
 	}
 
 	/* make own type struct to fill */
-	if(ntype) {
+	if (ntype) {
 		/*node->typeinfo= MEM_dupallocN(ntype);*/
 		bNodeType *newtype= MEM_callocN(sizeof(bNodeType), "dynamic bNodeType");
 		*newtype= *ntype;
@@ -387,7 +387,7 @@ bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node)
 
 	BLI_duplicatelist(&nnode->inputs, &node->inputs);
 	oldsock= node->inputs.first;
-	for(sock= nnode->inputs.first; sock; sock= sock->next, oldsock= oldsock->next) {
+	for (sock= nnode->inputs.first; sock; sock= sock->next, oldsock= oldsock->next) {
 		oldsock->new_sock= sock;
 		sock->stack_index= 0;
 		
@@ -402,7 +402,7 @@ bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node)
 	
 	BLI_duplicatelist(&nnode->outputs, &node->outputs);
 	oldsock= node->outputs.first;
-	for(sock= nnode->outputs.first; sock; sock= sock->next, oldsock= oldsock->next) {
+	for (sock= nnode->outputs.first; sock; sock= sock->next, oldsock= oldsock->next) {
 		oldsock->new_sock= sock;
 		sock->stack_index= 0;
 		
@@ -417,7 +417,7 @@ bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node)
 	
 	/* don't increase node->id users, freenode doesn't decrement either */
 	
-	if(node->typeinfo->copystoragefunc)
+	if (node->typeinfo->copystoragefunc)
 		node->typeinfo->copystoragefunc(node, nnode);
 	
 	node->new_node= nnode;
@@ -436,67 +436,67 @@ bNodeLink *nodeAddLink(bNodeTree *ntree, bNode *fromnode, bNodeSocket *fromsock,
 	bNodeLink *link= NULL; 
 	int from= 0, to= 0;
 	
-	if(fromnode) {
+	if (fromnode) {
 		/* test valid input */
-		for(sock= fromnode->outputs.first; sock; sock= sock->next)
-			if(sock==fromsock)
+		for (sock= fromnode->outputs.first; sock; sock= sock->next)
+			if (sock==fromsock)
 				break;
-		if(sock)
+		if (sock)
 			from= 1; /* OK */
 		else {
-			for(sock= fromnode->inputs.first; sock; sock= sock->next)
-				if(sock==fromsock)
+			for (sock= fromnode->inputs.first; sock; sock= sock->next)
+				if (sock==fromsock)
 					break;
-			if(sock)
+			if (sock)
 				from= -1; /* OK but flip */
 		}
 	}
 	else {
 		/* check tree sockets */
-		for(sock= ntree->inputs.first; sock; sock= sock->next)
-			if(sock==fromsock)
+		for (sock= ntree->inputs.first; sock; sock= sock->next)
+			if (sock==fromsock)
 				break;
-		if(sock)
+		if (sock)
 			from= 1; /* OK */
 		else {
-			for(sock= ntree->outputs.first; sock; sock= sock->next)
-				if(sock==fromsock)
+			for (sock= ntree->outputs.first; sock; sock= sock->next)
+				if (sock==fromsock)
 					break;
-			if(sock)
+			if (sock)
 				from= -1; /* OK but flip */
 		}
 	}
-	if(tonode) {
-		for(sock= tonode->inputs.first; sock; sock= sock->next)
-			if(sock==tosock)
+	if (tonode) {
+		for (sock= tonode->inputs.first; sock; sock= sock->next)
+			if (sock==tosock)
 				break;
-		if(sock)
+		if (sock)
 			to= 1; /* OK */
 		else {
-			for(sock= tonode->outputs.first; sock; sock= sock->next)
-				if(sock==tosock)
+			for (sock= tonode->outputs.first; sock; sock= sock->next)
+				if (sock==tosock)
 					break;
-			if(sock)
+			if (sock)
 				to= -1; /* OK but flip */
 		}
 	}
 	else {
 		/* check tree sockets */
-		for(sock= ntree->outputs.first; sock; sock= sock->next)
-			if(sock==tosock)
+		for (sock= ntree->outputs.first; sock; sock= sock->next)
+			if (sock==tosock)
 				break;
-		if(sock)
+		if (sock)
 			to= 1; /* OK */
 		else {
-			for(sock= ntree->inputs.first; sock; sock= sock->next)
-				if(sock==tosock)
+			for (sock= ntree->inputs.first; sock; sock= sock->next)
+				if (sock==tosock)
 					break;
-			if(sock)
+			if (sock)
 				to= -1; /* OK but flip */
 		}
 	}
 	
-	if(from >= 0 && to >= 0) {
+	if (from >= 0 && to >= 0) {
 		link= MEM_callocN(sizeof(bNodeLink), "link");
 		BLI_addtail(&ntree->links, link);
 		link->fromnode= fromnode;
@@ -504,7 +504,7 @@ bNodeLink *nodeAddLink(bNodeTree *ntree, bNode *fromnode, bNodeSocket *fromsock,
 		link->tonode= tonode;
 		link->tosock= tosock;
 	}
-	else if(from <= 0 && to <= 0) {
+	else if (from <= 0 && to <= 0) {
 		link= MEM_callocN(sizeof(bNodeLink), "link");
 		BLI_addtail(&ntree->links, link);
 		link->fromnode= tonode;
@@ -521,7 +521,7 @@ bNodeLink *nodeAddLink(bNodeTree *ntree, bNode *fromnode, bNodeSocket *fromsock,
 void nodeRemLink(bNodeTree *ntree, bNodeLink *link)
 {
 	BLI_remlink(&ntree->links, link);
-	if(link->tosock)
+	if (link->tosock)
 		link->tosock->link= NULL;
 	MEM_freeN(link);
 	
@@ -532,9 +532,9 @@ void nodeRemSocketLinks(bNodeTree *ntree, bNodeSocket *sock)
 {
 	bNodeLink *link, *next;
 	
-	for(link= ntree->links.first; link; link= next) {
+	for (link= ntree->links.first; link; link= next) {
 		next= link->next;
-		if(link->fromsock==sock || link->tosock==sock) {
+		if (link->fromsock==sock || link->tosock==sock) {
 			nodeRemLink(ntree, link);
 		}
 	}
@@ -542,6 +542,55 @@ void nodeRemSocketLinks(bNodeTree *ntree, bNodeSocket *sock)
 	ntree->update |= NTREE_UPDATE_LINKS;
 }
 
+void nodeInternalRelink(bNodeTree *ntree, bNode *node)
+{
+	bNodeLink *link, *link_next;
+	ListBase intlinks;
+	
+	if (!node->typeinfo->internal_connect)
+		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)
+		link->tosock->link = link;
+	
+	/* redirect downstream links */
+	for (link=ntree->links.first; link; link=link_next) {
+		link_next = link->next;
+		
+		/* do we have internal link? */
+		if (link->fromnode==node) {
+			if (link->fromsock->link) {
+				/* get the upstream input link */
+				bNodeLink *fromlink = link->fromsock->link->fromsock->link;
+				/* skip the node */
+				if (fromlink) {
+					link->fromnode = fromlink->fromnode;
+					link->fromsock = fromlink->fromsock;
+					
+					ntree->update |= NTREE_UPDATE_LINKS;
+				}
+				else
+					nodeRemLink(ntree, link);
+			}
+			else
+				nodeRemLink(ntree, link);
+		}
+	}
+	
+	/* remove remaining upstream links */
+	for (link=ntree->links.first; link; link=link_next) {
+		link_next = link->next;
+		
+		if (link->tonode==node)
+			nodeRemLink(ntree, link);
+	}
+	
+	BLI_freelistN(&intlinks);
+}
+
 /* transforms node location to area coords */
 void nodeSpaceCoords(bNode *node, float *locx, float *locy)
 {
@@ -611,7 +660,7 @@ bNodeTree *ntreeAddTree(const char *name, int type, int nodetype)
 /* Warning: this function gets called during some rather unexpected times
  *	- this gets called when executing compositing updates (for threaded previews)
  *	- when the nodetree datablock needs to be copied (i.e. when users get copied)
- *	- for scene duplication use ntreeSwapID() after so we dont have stale pointers.
+ *	- for scene duplication use ntreeSwapID() after so we don't have stale pointers.
  */
 bNodeTree *ntreeCopyTree(bNodeTree *ntree)
 {
@@ -620,14 +669,15 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree)
 	bNodeLink *link;
 	bNodeSocket *gsock, *oldgsock;
 	
-	if(ntree==NULL) return NULL;
+	if (ntree==NULL) return NULL;
 	
 	/* is ntree part of library? */
-	for(newtree=G.main->nodetree.first; newtree; newtree= newtree->id.next)
-		if(newtree==ntree) break;
-	if(newtree) {
+	for (newtree=G.main->nodetree.first; newtree; newtree= newtree->id.next)
+		if (newtree==ntree) break;
+	if (newtree) {
 		newtree= copy_libblock(&ntree->id);
-	} else {
+	}
+	else {
 		newtree= MEM_dupallocN(ntree);
 		copy_libblock_data(&newtree->id, &ntree->id, TRUE); /* copy animdata and ID props */
 	}
@@ -641,7 +691,7 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree)
 	newtree->links.first= newtree->links.last= NULL;
 	
 	last = ntree->nodes.last;
-	for(node= ntree->nodes.first; node; node= node->next) {
+	for (node= ntree->nodes.first; node; node= node->next) {
 		node->new_node= NULL;
 		/* nnode= */ nodeCopyNode(newtree, node);	/* sets node->new */
 		
@@ -652,14 +702,14 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree)
 	
 	/* socket definition for group usage */
 	BLI_duplicatelist(&newtree->inputs, &ntree->inputs);
-	for(gsock= newtree->inputs.first, oldgsock= ntree->inputs.first; gsock; gsock=gsock->next, oldgsock=oldgsock->next) {
+	for (gsock= newtree->inputs.first, oldgsock= ntree->inputs.first; gsock; gsock=gsock->next, oldgsock=oldgsock->next) {
 		oldgsock->new_sock= gsock;
 		gsock->groupsock = (oldgsock->groupsock ? oldgsock->groupsock->new_sock : NULL);
 		gsock->default_value = node_socket_make_default_value(oldgsock->type);
 		node_socket_copy_default_value(oldgsock->type, gsock->default_value, oldgsock->default_value);
 	}
 	BLI_duplicatelist(&newtree->outputs, &ntree->outputs);
-	for(gsock= newtree->outputs.first, oldgsock= ntree->outputs.first; gsock; gsock=gsock->next, oldgsock=oldgsock->next) {
+	for (gsock= newtree->outputs.first, oldgsock= ntree->outputs.first; gsock; gsock=gsock->next, oldgsock=oldgsock->next) {
 		oldgsock->new_sock= gsock;
 		gsock->groupsock = (oldgsock->groupsock ? oldgsock->groupsock->new_sock : NULL);
 		gsock->default_value = node_socket_make_default_value(oldgsock->type);
@@ -668,7 +718,7 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree)
 	
 	/* copy links */
 	BLI_duplicatelist(&newtree->links, &ntree->links);
-	for(link= newtree->links.first; link; link= link->next) {
+	for (link= newtree->links.first; link; link= link->next) {
 		link->fromnode = (link->fromnode ? link->fromnode->new_node : NULL);
 		link->fromsock = (link->fromsock ? link->fromsock->new_sock : NULL);
 		link->tonode = (link->tonode ? link->tonode->new_node : NULL);
@@ -692,8 +742,8 @@ void ntreeSwitchID(bNodeTree *ntree, ID *id_from, ID *id_to)
 {
 	bNode *node;
 	/* for scene duplication only */
-	for(node= ntree->nodes.first; node; node= node->next) {
-		if(node->id==id_from) {
+	for (node= ntree->nodes.first; node; node= node->next) {
+		if (node->id==id_from) {
 			node->id= id_to;
 		}
 	}
@@ -704,8 +754,8 @@ void ntreeSwitchID(bNodeTree *ntree, ID *id_from, ID *id_to)
 
 void nodeFreePreview(bNode *node)
 {
-	if(node->preview) {
-		if(node->preview->rect)
+	if (node->preview) {
+		if (node->preview->rect)
 			MEM_freeN(node->preview->rect);
 		MEM_freeN(node->preview);
 		node->preview= NULL;
@@ -715,24 +765,24 @@ void nodeFreePreview(bNode *node)
 static void node_init_preview(bNode *node, int xsize, int ysize)
 {
 	
-	if(node->preview==NULL) {
+	if (node->preview==NULL) {
 		node->preview= MEM_callocN(sizeof(bNodePreview), "node preview");
 		//		printf("added preview %s\n", node->name);
 	}
 	
 	/* node previews can get added with variable size this way */
-	if(xsize==0 || ysize==0)
+	if (xsize==0 || ysize==0)
 		return;
 	
 	/* sanity checks & initialize */
-	if(node->preview->rect) {
-		if(node->preview->xsize!=xsize && node->preview->ysize!=ysize) {
+	if (node->preview->rect) {
+		if (node->preview->xsize!=xsize && node->preview->ysize!=ysize) {
 			MEM_freeN(node->preview->rect);
 			node->preview->rect= NULL;
 		}
 	}
 	
-	if(node->preview->rect==NULL) {
+	if (node->preview->rect==NULL) {
 		node->preview->rect= MEM_callocN(4*xsize + xsize*ysize*sizeof(char)*4, "node preview rect");
 		node->preview->xsize= xsize;
 		node->preview->ysize= ysize;
@@ -744,20 +794,20 @@ void ntreeInitPreview(bNodeTree *ntree, int xsize, int ysize)
 {
 	bNode *node;
 	
-	if(ntree==NULL)
+	if (ntree==NULL)
 		return;
 	
-	for(node= ntree->nodes.first; node; node= node->next) {
-		if(node->typeinfo->flag & NODE_PREVIEW)	/* hrms, check for closed nodes? */
+	for (node= ntree->nodes.first; node; node= node->next) {
+		if (node->typeinfo->flag & NODE_PREVIEW)	/* hrms, check for closed nodes? */
 			node_init_preview(node, xsize, ysize);
-		if(node->type==NODE_GROUP && (node->flag & NODE_GROUP_EDIT))
+		if (node->type==NODE_GROUP && (node->flag & NODE_GROUP_EDIT))
 			ntreeInitPreview((bNodeTree *)node->id, xsize, ysize);
 	}		
 }
 
 static void nodeClearPreview(bNode *node)
 {
-	if(node->preview && node->preview->rect)
+	if (node->preview && node->preview->rect)
 		memset(node->preview->rect, 0, MEM_allocN_len(node->preview->rect));
 }
 
@@ -766,29 +816,29 @@ void ntreeClearPreview(bNodeTree *ntree)
 {
 	bNode *node;
 	
-	if(ntree==NULL)
+	if (ntree==NULL)
 		return;
 	
-	for(node= ntree->nodes.first; node; node= node->next) {
-		if(node->typeinfo->flag & NODE_PREVIEW)
+	for (node= ntree->nodes.first; node; node= node->next) {
+		if (node->typeinfo->flag & NODE_PREVIEW)
 			nodeClearPreview(node);
-		if(node->type==NODE_GROUP && (node->flag & NODE_GROUP_EDIT))
+		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 */
+ * 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, int x, int y, int do_manage)
 {
 	bNodePreview *preview= node->preview;
-	if(preview) {
-		if(x>=0 && y>=0) {
-			if(x<preview->xsize && y<preview->ysize) {
+	if (preview) {
+		if (x>=0 && y>=0) {
+			if (x<preview->xsize && y<preview->ysize) {
 				unsigned char *tar= preview->rect+ 4*((preview->xsize*y) + x);
 				
-				if(do_manage) {
+				if (do_manage) {
 					linearrgb_to_srgb_uchar4(tar, col);
 				}
 				else {
@@ -810,25 +860,25 @@ void nodeUnlinkNode(bNodeTree *ntree, bNode *node)
 	bNodeSocket *sock;
 	ListBase *lb;
 	
-	for(link= ntree->links.first; link; link= next) {
+	for (link= ntree->links.first; link; link= next) {
 		next= link->next;
 		
-		if(link->fromnode==node) {
+		if (link->fromnode==node) {
 			lb= &node->outputs;
 			if (link->tonode)
 				link->tonode->update |= NODE_UPDATE;
 		}
-		else if(link->tonode==node)
+		else if (link->tonode==node)
 			lb= &node->inputs;
 		else
 			lb= NULL;
 
-		if(lb) {
-			for(sock= lb->first; sock; sock= sock->next) {
-				if(link->fromsock==sock || link->tosock==sock)
+		if (lb) {
+			for (sock= lb->first; sock; sock= sock->next) {
+				if (link->fromsock==sock || link->tosock==sock)
 					break;
 			}
-			if(sock) {
+			if (sock) {
 				nodeRemLink(ntree, link);
 			}
 		}
@@ -854,12 +904,15 @@ void nodeFreeNode(bNodeTree *ntree, bNode *node)
 	node_unlink_attached(ntree, node);
 	
 	BLI_remlink(&ntree->nodes, node);
-
+	
 	/* since it is called while free database, node->id is undefined */
 	
 	if (treetype->free_node_cache)
 		treetype->free_node_cache(ntree, node);
 	
+	if (node->typeinfo && node->typeinfo->freestoragefunc)
+		node->typeinfo->freestoragefunc(node);
+	
 	for (sock=node->inputs.first; sock; sock = nextsock) {
 		nextsock = sock->next;
 		node_socket_free_default_value(sock->type, sock->default_value);
@@ -873,10 +926,6 @@ void nodeFreeNode(bNodeTree *ntree, bNode *node)
 
 	nodeFreePreview(node);
 
-	if(node->typeinfo && node->typeinfo->freestoragefunc) {
-		node->typeinfo->freestoragefunc(node);
-	}
-
 	MEM_freeN(node);
 	
 	ntree->update |= NTREE_UPDATE_NODES;
@@ -888,7 +937,7 @@ void ntreeFreeTree(bNodeTree *ntree)
 	bNode *node, *next;
 	bNodeSocket *sock;
 	
-	if(ntree==NULL) return;
+	if (ntree==NULL) return;
 	
 	/* XXX hack! node trees should not store execution graphs at all.
 	 * This should be removed when old tree types no longer require it.
@@ -915,7 +964,7 @@ void ntreeFreeTree(bNodeTree *ntree)
 
 	BLI_freelistN(&ntree->links);	/* do first, then unlink_node goes fast */
 	
-	for(node= ntree->nodes.first; node; node= next) {
+	for (node= ntree->nodes.first; node; node= next) {
 		next= node->next;
 		nodeFreeNode(ntree, node);
 	}
@@ -932,7 +981,7 @@ void ntreeFreeCache(bNodeTree *ntree)
 {
 	bNodeTreeType *treetype;
 	
-	if(ntree==NULL) return;
+	if (ntree==NULL) return;
 	
 	treetype= ntreeGetType(ntree->type);
 	if (treetype->free_cache)
@@ -943,52 +992,52 @@ void ntreeSetOutput(bNodeTree *ntree)
 {
 	bNode *node;
 
-	/* find the active outputs, might become tree type dependant handler */
-	for(node= ntree->nodes.first; node; node= node->next) {
-		if(node->typeinfo->nclass==NODE_CLASS_OUTPUT) {
+	/* find the active outputs, might become tree type dependent handler */
+	for (node= ntree->nodes.first; node; node= node->next) {
+		if (node->typeinfo->nclass==NODE_CLASS_OUTPUT) {
 			bNode *tnode;
 			int output= 0;
 			
 			/* we need a check for which output node should be tagged like this, below an exception */
-			if(node->type==CMP_NODE_OUTPUT_FILE)
+			if (node->type==CMP_NODE_OUTPUT_FILE)
 				continue;
 
 			/* there is more types having output class, each one is checked */
-			for(tnode= ntree->nodes.first; tnode; tnode= tnode->next) {
-				if(tnode->typeinfo->nclass==NODE_CLASS_OUTPUT) {
+			for (tnode= ntree->nodes.first; tnode; tnode= tnode->next) {
+				if (tnode->typeinfo->nclass==NODE_CLASS_OUTPUT) {
 					
-					if(ntree->type==NTREE_COMPOSIT) {
+					if (ntree->type==NTREE_COMPOSIT) {
 							
 						/* same type, exception for viewer */
-						if(tnode->type==node->type ||
+						if (tnode->type==node->type ||
 						   (ELEM(tnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER) &&
 							ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))) {
-							if(tnode->flag & NODE_DO_OUTPUT) {
+							if (tnode->flag & NODE_DO_OUTPUT) {
 								output++;
-								if(output>1)
+								if (output>1)
 									tnode->flag &= ~NODE_DO_OUTPUT;
 							}
 						}
 					}
 					else {
 						/* same type */
-						if(tnode->type==node->type) {
-							if(tnode->flag & NODE_DO_OUTPUT) {
+						if (tnode->type==node->type) {
+							if (tnode->flag & NODE_DO_OUTPUT) {
 								output++;
-								if(output>1)
+								if (output>1)
 									tnode->flag &= ~NODE_DO_OUTPUT;
 							}
 						}
 					}
 				}
 			}
-			if(output==0)
+			if (output==0)
 				node->flag |= NODE_DO_OUTPUT;
 		}
 	}
 	
 	/* here we could recursively set which nodes have to be done,
-		might be different for editor or for "real" use... */
+	 * might be different for editor or for "real" use... */
 }
 
 typedef struct MakeLocalCallData {
@@ -1003,9 +1052,9 @@ static void ntreeMakeLocal_CheckLocal(void *calldata, ID *owner_id, bNodeTree *n
 	bNode *node;
 	
 	/* find if group is in tree */
-	for(node= ntree->nodes.first; node; node= node->next) {
-		if(node->id == cd->group_id) {
-			if(owner_id->lib) cd->lib= 1;
+	for (node= ntree->nodes.first; node; node= node->next) {
+		if (node->id == cd->group_id) {
+			if (owner_id->lib) cd->lib= 1;
 			else cd->local= 1;
 		}
 	}
@@ -1017,9 +1066,9 @@ static void ntreeMakeLocal_LinkNew(void *calldata, ID *owner_id, bNodeTree *ntre
 	bNode *node;
 	
 	/* find if group is in tree */
-	for(node= ntree->nodes.first; node; node= node->next) {
-		if(node->id == cd->group_id) {
-			if(owner_id->lib==NULL) {
+	for (node= ntree->nodes.first; node; node= node->next) {
+		if (node->id == cd->group_id) {
+			if (owner_id->lib==NULL) {
 				node->id= cd->new_id;
 				cd->new_id->us++;
 				cd->group_id->us--;
@@ -1035,12 +1084,12 @@ void ntreeMakeLocal(bNodeTree *ntree)
 	MakeLocalCallData cd;
 	
 	/* - only lib users: do nothing
-		* - only local users: set flag
-		* - mixed: make copy
-		*/
+	 * - only local users: set flag
+	 * - mixed: make copy
+	 */
 	
-	if(ntree->id.lib==NULL) return;
-	if(ntree->id.us==1) {
+	if (ntree->id.lib==NULL) return;
+	if (ntree->id.us==1) {
 		id_clear_lib_data(bmain, (ID *)ntree);
 		return;
 	}
@@ -1054,10 +1103,10 @@ void ntreeMakeLocal(bNodeTree *ntree)
 	treetype->foreach_nodetree(G.main, &cd, &ntreeMakeLocal_CheckLocal);
 	
 	/* if all users are local, we simply make tree local */
-	if(cd.local && cd.lib==0) {
+	if (cd.local && cd.lib==0) {
 		id_clear_lib_data(bmain, (ID *)ntree);
 	}
-	else if(cd.local && cd.lib) {
+	else if (cd.local && cd.lib) {
 		/* this is the mixed case, we copy the tree and assign it to local users */
 		bNodeTree *newtree= ntreeCopyTree(ntree);
 		
@@ -1072,8 +1121,8 @@ void ntreeMakeLocal(bNodeTree *ntree)
 int ntreeNodeExists(bNodeTree *ntree, bNode *testnode)
 {
 	bNode *node= ntree->nodes.first;
-	for(; node; node= node->next)
-		if(node==testnode)
+	for (; node; node= node->next)
+		if (node==testnode)
 			return 1;
 	return 0;
 }
@@ -1081,8 +1130,8 @@ int ntreeNodeExists(bNodeTree *ntree, bNode *testnode)
 int ntreeOutputExists(bNode *node, bNodeSocket *testsock)
 {
 	bNodeSocket *sock= node->outputs.first;
-	for(; sock; sock= sock->next)
-		if(sock==testsock)
+	for (; sock; sock= sock->next)
+		if (sock==testsock)
 			return 1;
 	return 0;
 }
@@ -1098,10 +1147,10 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree)
 	bAction *action_backup= NULL, *tmpact_backup= NULL;
 	
 	/* Workaround for copying an action on each render!
-	 * set action to NULL so animdata actions dont get copied */
+	 * set action to NULL so animdata actions don't get copied */
 	AnimData *adt= BKE_animdata_from_id(&ntree->id);
 
-	if(adt) {
+	if (adt) {
 		action_backup= adt->action;
 		tmpact_backup= adt->tmpact;
 
@@ -1112,14 +1161,14 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree)
 	/* node copy func */
 	ltree= ntreeCopyTree(ntree);
 
-	if(adt) {
+	if (adt) {
 		AnimData *ladt= BKE_animdata_from_id(&ltree->id);
 
 		adt->action= ladt->action= action_backup;
 		adt->tmpact= ladt->tmpact= tmpact_backup;
 
-		if(action_backup) action_backup->id.us++;
-		if(tmpact_backup) tmpact_backup->id.us++;
+		if (action_backup) action_backup->id.us++;
+		if (tmpact_backup) tmpact_backup->id.us++;
 		
 	}
 	/* end animdata uglyness */
@@ -1127,7 +1176,7 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree)
 	/* ensures only a single output node is enabled */
 	ntreeSetOutput(ntree);
 
-	for(node= ntree->nodes.first; node; node= node->next) {
+	for (node= ntree->nodes.first; node; node= node->next) {
 		/* store new_node pointer to original */
 		node->new_node->new_node= node;
 	}
@@ -1157,9 +1206,9 @@ void ntreeLocalMerge(bNodeTree *localtree, bNodeTree *ntree)
 	bNode *lnode;
 	
 	/* move over the compbufs and previews */
-	for(lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
-		if(ntreeNodeExists(ntree, lnode->new_node)) {
-			if(lnode->preview && lnode->preview->rect) {
+	for (lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
+		if (ntreeNodeExists(ntree, lnode->new_node)) {
+			if (lnode->preview && lnode->preview->rect) {
 				nodeFreePreview(lnode->new_node);
 				lnode->new_node->preview= lnode->preview;
 				lnode->preview= NULL;
@@ -1180,9 +1229,9 @@ int ntreeHasType(bNodeTree *ntree, int type)
 {
 	bNode *node;
 	
-	if(ntree)
-		for(node= ntree->nodes.first; node; node= node->next)
-			if(node->type == type)
+	if (ntree)
+		for (node= ntree->nodes.first; node; node= node->next)
+			if (node->type == type)
 				return 1;
 	return 0;
 }
@@ -1191,10 +1240,10 @@ bNodeLink *nodeFindLink(bNodeTree *ntree, bNodeSocket *from, bNodeSocket *to)
 {
 	bNodeLink *link;
 	
-	for(link= ntree->links.first; link; link= link->next) {
-		if(link->fromsock==from && link->tosock==to)
+	for (link= ntree->links.first; link; link= link->next) {
+		if (link->fromsock==from && link->tosock==to)
 			return link;
-		if(link->fromsock==to && link->tosock==from)	/* hrms? */
+		if (link->fromsock==to && link->tosock==from)	/* hrms? */
 			return link;
 	}
 	return NULL;
@@ -1205,8 +1254,8 @@ int nodeCountSocketLinks(bNodeTree *ntree, bNodeSocket *sock)
 	bNodeLink *link;
 	int tot= 0;
 	
-	for(link= ntree->links.first; link; link= link->next) {
-		if(link->fromsock==sock || link->tosock==sock)
+	for (link= ntree->links.first; link; link= link->next) {
+		if (link->fromsock==sock || link->tosock==sock)
 			tot++;
 	}
 	return tot;
@@ -1216,10 +1265,10 @@ bNode *nodeGetActive(bNodeTree *ntree)
 {
 	bNode *node;
 	
-	if(ntree==NULL) return NULL;
+	if (ntree==NULL) return NULL;
 	
-	for(node= ntree->nodes.first; node; node= node->next)
-		if(node->flag & NODE_ACTIVE)
+	for (node= ntree->nodes.first; node; node= node->next)
+		if (node->flag & NODE_ACTIVE)
 			break;
 	return node;
 }
@@ -1229,20 +1278,20 @@ bNode *nodeGetActiveID(bNodeTree *ntree, short idtype)
 {
 	bNode *node;
 	
-	if(ntree==NULL) return NULL;
+	if (ntree==NULL) return NULL;
 
 	/* check for group edit */
-	for(node= ntree->nodes.first; node; node= node->next)
-		if(node->flag & NODE_GROUP_EDIT)
+	for (node= ntree->nodes.first; node; node= node->next)
+		if (node->flag & NODE_GROUP_EDIT)
 			break;
 
-	if(node)
+	if (node)
 		ntree= (bNodeTree*)node->id;
 	
 	/* now find active node with this id */
-	for(node= ntree->nodes.first; node; node= node->next)
-		if(node->id && GS(node->id->name)==idtype)
-			if(node->flag & NODE_ACTIVE_ID)
+	for (node= ntree->nodes.first; node; node= node->next)
+		if (node->id && GS(node->id->name)==idtype)
+			if (node->flag & NODE_ACTIVE_ID)
 				break;
 
 	return node;
@@ -1253,23 +1302,24 @@ int nodeSetActiveID(bNodeTree *ntree, short idtype, ID *id)
 	bNode *node;
 	int ok= FALSE;
 
-	if(ntree==NULL) return ok;
+	if (ntree==NULL) return ok;
 
 	/* check for group edit */
-	for(node= ntree->nodes.first; node; node= node->next)
-		if(node->flag & NODE_GROUP_EDIT)
+	for (node= ntree->nodes.first; node; node= node->next)
+		if (node->flag & NODE_GROUP_EDIT)
 			break;
 
-	if(node)
+	if (node)
 		ntree= (bNodeTree*)node->id;
 
 	/* now find active node with this id */
-	for(node= ntree->nodes.first; node; node= node->next) {
-		if(node->id && GS(node->id->name)==idtype) {
-			if(id && ok==FALSE && node->id==id) {
+	for (node= ntree->nodes.first; node; node= node->next) {
+		if (node->id && GS(node->id->name)==idtype) {
+			if (id && ok==FALSE && node->id==id) {
 				node->flag |= NODE_ACTIVE_ID;
 				ok= TRUE;
-			} else {
+			}
+			else {
 				node->flag &= ~NODE_ACTIVE_ID;
 			}
 		}
@@ -1284,10 +1334,10 @@ void nodeClearActiveID(bNodeTree *ntree, short idtype)
 {
 	bNode *node;
 	
-	if(ntree==NULL) return;
+	if (ntree==NULL) return;
 	
-	for(node= ntree->nodes.first; node; node= node->next)
-		if(node->id && GS(node->id->name)==idtype)
+	for (node= ntree->nodes.first; node; node= node->next)
+		if (node->id && GS(node->id->name)==idtype)
 			node->flag &= ~NODE_ACTIVE_ID;
 }
 
@@ -1297,27 +1347,40 @@ void nodeSetActive(bNodeTree *ntree, bNode *node)
 	bNode *tnode;
 	
 	/* make sure only one node is active, and only one per ID type */
-	for(tnode= ntree->nodes.first; tnode; tnode= tnode->next) {
+	for (tnode= ntree->nodes.first; tnode; tnode= tnode->next) {
 		tnode->flag &= ~NODE_ACTIVE;
 		
-		if(node->id && tnode->id) {
-			if(GS(node->id->name) == GS(tnode->id->name))
+		if (node->id && tnode->id) {
+			if (GS(node->id->name) == GS(tnode->id->name))
 				tnode->flag &= ~NODE_ACTIVE_ID;
 		}
-		if(node->typeinfo->nclass == NODE_CLASS_TEXTURE)
+		if (node->typeinfo->nclass == NODE_CLASS_TEXTURE)
 			tnode->flag &= ~NODE_ACTIVE_TEXTURE;
 	}
 	
 	node->flag |= NODE_ACTIVE;
-	if(node->id)
+	if (node->id)
 		node->flag |= NODE_ACTIVE_ID;
-	if(node->typeinfo->nclass == NODE_CLASS_TEXTURE)
+	if (node->typeinfo->nclass == NODE_CLASS_TEXTURE)
 		node->flag |= NODE_ACTIVE_TEXTURE;
 }
 
 int nodeSocketIsHidden(bNodeSocket *sock)
 {
-	return ((sock->flag & (SOCK_HIDDEN | SOCK_AUTO_HIDDEN | SOCK_UNAVAIL)) != 0);
+	return ((sock->flag & (SOCK_HIDDEN | SOCK_UNAVAIL)) != 0);
+}
+
+void nodeSocketSetType(bNodeSocket *sock, int type)
+{
+	int old_type = sock->type;
+	void *old_default_value = sock->default_value;
+	
+	sock->type = type;
+	
+	sock->default_value = node_socket_make_default_value(sock->type);
+	node_socket_init_default_value(type, sock->default_value);
+	node_socket_convert_default_value(sock->type, sock->default_value, old_type, old_default_value);
+	node_socket_free_default_value(old_type, old_default_value);
 }
 
 /* ************** dependency stuff *********** */
@@ -1332,10 +1395,10 @@ static int node_get_deplist_recurs(bNode *node, bNode ***nsort)
 	node->done= 1;
 	
 	/* check linked nodes */
-	for(sock= node->inputs.first; sock; sock= sock->next) {
-		if(sock->link) {
+	for (sock= node->inputs.first; sock; sock= sock->next) {
+		if (sock->link) {
 			fromnode= sock->link->fromnode;
-			if(fromnode) {
+			if (fromnode) {
 				if (fromnode->done==0)
 					fromnode->level= node_get_deplist_recurs(fromnode, nsort);
 				if (fromnode->level <= level)
@@ -1367,11 +1430,11 @@ void ntreeGetDependencyList(struct bNodeTree *ntree, struct bNode ***deplist, in
 	*totnodes=0;
 	
 	/* first clear data */
-	for(node= ntree->nodes.first; node; node= node->next) {
+	for (node= ntree->nodes.first; node; node= node->next) {
 		node->done= 0;
 		(*totnodes)++;
 	}
-	if(*totnodes==0) {
+	if (*totnodes==0) {
 		*deplist = NULL;
 		return;
 	}
@@ -1379,13 +1442,31 @@ void ntreeGetDependencyList(struct bNodeTree *ntree, struct bNode ***deplist, in
 	nsort= *deplist= MEM_callocN((*totnodes)*sizeof(bNode*), "sorted node array");
 	
 	/* recursive check */
-	for(node= ntree->nodes.first; node; node= node->next) {
-		if(node->done==0) {
+	for (node= ntree->nodes.first; node; node= node->next) {
+		if (node->done==0) {
 			node->level= node_get_deplist_recurs(node, &nsort);
 		}
 	}
 }
 
+/* only updates node->level for detecting cycles links */
+static void ntree_update_node_level(bNodeTree *ntree)
+{
+	bNode *node;
+	
+	/* first clear tag */
+	for (node= ntree->nodes.first; node; node= node->next) {
+		node->done= 0;
+	}
+	
+	/* recursive check */
+	for (node= ntree->nodes.first; node; node= node->next) {
+		if (node->done==0) {
+			node->level= node_get_deplist_recurs(node, NULL);
+		}
+	}
+}
+
 static void ntree_update_link_pointers(bNodeTree *ntree)
 {
 	bNode *node;
@@ -1393,24 +1474,24 @@ static void ntree_update_link_pointers(bNodeTree *ntree)
 	bNodeLink *link;
 	
 	/* first clear data */
-	for(node= ntree->nodes.first; node; node= node->next) {
-		for(sock= node->inputs.first; sock; sock= sock->next) {
+	for (node= ntree->nodes.first; node; node= node->next) {
+		for (sock= node->inputs.first; sock; sock= sock->next) {
 			sock->link= NULL;
 			sock->flag &= ~SOCK_IN_USE;
 		}
-		for(sock= node->outputs.first; sock; sock= sock->next) {
+		for (sock= node->outputs.first; sock; sock= sock->next) {
 			sock->flag &= ~SOCK_IN_USE;
 		}
 	}
-	for(sock= ntree->inputs.first; sock; sock= sock->next) {
+	for (sock= ntree->inputs.first; sock; sock= sock->next) {
 		sock->flag &= ~SOCK_IN_USE;
 	}
-	for(sock= ntree->outputs.first; sock; sock= sock->next) {
+	for (sock= ntree->outputs.first; sock; sock= sock->next) {
 		sock->link= NULL;
 		sock->flag &= ~SOCK_IN_USE;
 	}
 
-	for(link= ntree->links.first; link; link= link->next) {
+	for (link= ntree->links.first; link; link= link->next) {
 		link->tosock->link= link;
 		
 		link->fromsock->flag |= SOCK_IN_USE;
@@ -1463,39 +1544,33 @@ void ntreeUpdateTree(bNodeTree *ntree)
 {
 	bNodeTreeType *ntreetype= ntreeGetType(ntree->type);
 	bNode *node;
-	bNode **deplist;
-	int totnodes, n;
-	
-	ntree_update_link_pointers(ntree);
 	
-	/* also updates the node level! */
-	ntreeGetDependencyList(ntree, &deplist, &totnodes);
+	if (ntree->update & (NTREE_UPDATE_LINKS|NTREE_UPDATE_NODES)) {
+		/* set the bNodeSocket->link pointers */
+		ntree_update_link_pointers(ntree);
+		
+		/* update the node level from link dependencies */
+		ntree_update_node_level(ntree);
+	}
 	
-	if (deplist) {
-		/* update individual nodes */
-		for (n=0; n < totnodes; ++n) {
-			node = deplist[n];
-			
-			/* node tree update tags override individual node update flags */
-			if ((node->update & NODE_UPDATE) || (ntree->update & NTREE_UPDATE)) {
-				if (ntreetype->update_node)
-					ntreetype->update_node(ntree, node);
-				else if (node->typeinfo->updatefunc)
-					node->typeinfo->updatefunc(ntree, node);
-			}
-			/* clear update flag */
-			node->update = 0;
+	/* update individual nodes */
+	for (node=ntree->nodes.first; node; node=node->next) {
+		/* node tree update tags override individual node update flags */
+		if ((node->update & NODE_UPDATE) || (ntree->update & NTREE_UPDATE)) {
+			if (ntreetype->update_node)
+				ntreetype->update_node(ntree, node);
+			else if (node->typeinfo->updatefunc)
+				node->typeinfo->updatefunc(ntree, node);
 		}
-		
-		MEM_freeN(deplist);
+		/* clear update flag */
+		node->update = 0;
 	}
 	
-	/* general tree updates */
-	if (ntree->update & (NTREE_UPDATE_LINKS|NTREE_UPDATE_NODES)) {
+	/* check link validity */
+	if (ntree->update & (NTREE_UPDATE_LINKS|NTREE_UPDATE_NODES))
 		ntree_validate_links(ntree);
-	}
 	
-	/* update tree */
+	/* generic tree update callback */
 	if (ntreetype->update)
 		ntreetype->update(ntree);
 	else {
@@ -1532,15 +1607,16 @@ int nodeUpdateID(bNodeTree *ntree, ID *id)
 	bNode *node;
 	int change = FALSE;
 	
-	if(ELEM(NULL, id, ntree))
+	if (ELEM(NULL, id, ntree))
 		return change;
 	
 	ntreetype = ntreeGetType(ntree->type);
 	
 	if (ntreetype->update_node) {
-		for(node= ntree->nodes.first; node; node= node->next) {
-			if(node->id==id) {
+		for (node= ntree->nodes.first; node; node= node->next) {
+			if (node->id==id) {
 				change = TRUE;
+				node->update |= NODE_UPDATE_ID;
 				ntreetype->update_node(ntree, node);
 				/* clear update flag */
 				node->update = 0;
@@ -1548,9 +1624,10 @@ int nodeUpdateID(bNodeTree *ntree, ID *id)
 		}
 	}
 	else {
-		for(node= ntree->nodes.first; node; node= node->next) {
-			if(node->id==id) {
+		for (node= ntree->nodes.first; node; node= node->next) {
+			if (node->id==id) {
 				change = TRUE;
+				node->update |= NODE_UPDATE_ID;
 				if (node->typeinfo->updatefunc)
 					node->typeinfo->updatefunc(ntree, node);
 				/* clear update flag */
@@ -1585,7 +1662,7 @@ const char* nodeLabel(bNode *node)
 	else if (node->typeinfo->labelfunc)
 		return node->typeinfo->labelfunc(node);
 	else
-		return node->typeinfo->name;
+		return IFACE_(node->typeinfo->name);
 }
 
 struct bNodeTree *nodeGroupEditGet(struct bNode *node)
@@ -1633,11 +1710,8 @@ void node_type_base(bNodeTreeType *ttype, bNodeType *ntype, int type, const char
 	ntype->flag = flag;
 
 	/* Default muting stuff. */
-	if(ttype) {
-		ntype->mutefunc      = ttype->mutefunc;
-		ntype->mutelinksfunc = ttype->mutelinksfunc;
-		ntype->gpumutefunc   = ttype->gpumutefunc;
-	}
+	if (ttype)
+		ntype->internal_connect = ttype->internal_connect;
 
 	/* default size values */
 	ntype->width = 140;
@@ -1733,14 +1807,9 @@ void node_type_exec_new(struct bNodeType *ntype,
 	ntype->newexecfunc = newexecfunc;
 }
 
-void node_type_mute(struct bNodeType *ntype,
-                    void (*mutefunc)(void *data, int thread, struct bNode *, void *nodedata,
-                                     struct bNodeStack **, struct bNodeStack **),
-                    ListBase (*mutelinksfunc)(struct bNodeTree *, struct bNode *, struct bNodeStack **, struct bNodeStack **,
-                                              struct GPUNodeStack *, struct GPUNodeStack *))
+void node_type_internal_connect(bNodeType *ntype, ListBase (*internal_connect)(bNodeTree *, bNode *))
 {
-	ntype->mutefunc = mutefunc;
-	ntype->mutelinksfunc = mutelinksfunc;
+	ntype->internal_connect = internal_connect;
 }
 
 void node_type_gpu(struct bNodeType *ntype, int (*gpufunc)(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *in, struct GPUNodeStack *out))
@@ -1753,12 +1822,6 @@ void node_type_gpu_ext(struct bNodeType *ntype, int (*gpuextfunc)(struct GPUMate
 	ntype->gpuextfunc = gpuextfunc;
 }
 
-void node_type_gpu_mute(struct bNodeType *ntype, int (*gpumutefunc)(struct GPUMaterial *, struct bNode *, void *,
-                                                                    struct GPUNodeStack *, struct GPUNodeStack *))
-{
-	ntype->gpumutefunc = gpumutefunc;
-}
-
 void node_type_compatibility(struct bNodeType *ntype, short compatibility)
 {
 	ntype->compatibility = compatibility;
@@ -1768,8 +1831,8 @@ static bNodeType *is_nodetype_registered(ListBase *typelist, int type)
 {
 	bNodeType *ntype= typelist->first;
 	
-	for(;ntype; ntype= ntype->next )
-		if(ntype->type==type)
+	for (;ntype; ntype= ntype->next )
+		if (ntype->type==type)
 			return ntype;
 	
 	return NULL;
@@ -1780,7 +1843,7 @@ void nodeRegisterType(bNodeTreeType *ttype, bNodeType *ntype)
 	ListBase *typelist = &(ttype->node_types);
 	bNodeType *found= is_nodetype_registered(typelist, ntype->type);
 	
-	if(found==NULL)
+	if (found==NULL)
 		BLI_addtail(typelist, ntype);
 }
 
@@ -1852,7 +1915,7 @@ static void registerCompositNodes(bNodeTreeType *ttype)
 	register_node_type_cmp_channel_matte(ttype);
 	register_node_type_cmp_color_spill(ttype);
 	register_node_type_cmp_luma_matte(ttype);
-    register_node_type_cmp_doubleedgemask(ttype);
+	register_node_type_cmp_doubleedgemask(ttype);
 
 	register_node_type_cmp_translate(ttype);
 	register_node_type_cmp_rotate(ttype);
@@ -1989,14 +2052,14 @@ static void registerTextureNodes(bNodeTreeType *ttype)
 
 static void free_dynamic_typeinfo(bNodeType *ntype)
 {
-	if(ntype->type==NODE_DYNAMIC) {
-		if(ntype->inputs) {
+	if (ntype->type==NODE_DYNAMIC) {
+		if (ntype->inputs) {
 			MEM_freeN(ntype->inputs);
 		}
-		if(ntype->outputs) {
+		if (ntype->outputs) {
 			MEM_freeN(ntype->outputs);
 		}
-		if(ntype->name) {
+		if (ntype->name) {
 			MEM_freeN((void *)ntype->name);
 		}
 	}
@@ -2005,13 +2068,13 @@ static void free_dynamic_typeinfo(bNodeType *ntype)
 static void free_typeinfos(ListBase *list)
 {
 	bNodeType *ntype, *next;
-	for(ntype=list->first; ntype; ntype=next) {
+	for (ntype=list->first; ntype; ntype=next) {
 		next = ntype->next;
 		
-		if(ntype->type==NODE_DYNAMIC)
+		if (ntype->type==NODE_DYNAMIC)
 			free_dynamic_typeinfo(ntype);
 		
-		if(ntype->needs_free)
+		if (ntype->needs_free)
 			MEM_freeN(ntype);
 	}
 }
@@ -2040,11 +2103,11 @@ void clear_scene_in_nodes(Main *bmain, Scene *sce)
 	Scene *sce1;
 	bNode *node;
 
-	for(sce1= bmain->scene.first; sce1; sce1=sce1->id.next) {
-		if(sce1!=sce) {
-			if(sce1->nodetree) {
-				for(node= sce1->nodetree->nodes.first; node; node= node->next) {
-					if(node->type==CMP_NODE_R_LAYERS) {
+	for (sce1= bmain->scene.first; sce1; sce1=sce1->id.next) {
+		if (sce1!=sce) {
+			if (sce1->nodetree) {
+				for (node= sce1->nodetree->nodes.first; node; node= node->next) {
+					if (node->type==CMP_NODE_R_LAYERS) {
 						Scene *nodesce= (Scene *)node->id;
 						
 						if (nodesce==sce) node->id = NULL;
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index d2b81a3..bc9411b 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -45,6 +45,7 @@
 #include "DNA_lattice_types.h"
 #include "DNA_material_types.h"
 #include "DNA_meta_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_movieclip_types.h"
 #include "DNA_scene_types.h"
@@ -58,7 +59,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_bpath.h"
-#include "BLI_editVert.h"
 #include "BLI_math.h"
 #include "BLI_pbvh.h"
 #include "BLI_utildefines.h"
@@ -86,6 +86,7 @@
 #include "BKE_lattice.h"
 #include "BKE_library.h"
 #include "BKE_mesh.h"
+#include "BKE_tessmesh.h"
 #include "BKE_mball.h"
 #include "BKE_modifier.h"
 #include "BKE_node.h"
@@ -102,7 +103,9 @@
 #include "BKE_material.h"
 #include "BKE_camera.h"
 
+#ifdef WITH_MOD_FLUID
 #include "LBM_fluidsim.h"
+#endif
 
 #ifdef WITH_PYTHON
 #include "BPY_extern.h"
@@ -128,7 +131,7 @@ void copy_baseflags(struct Scene *scene)
 {
 	Base *base= scene->base.first;
 	
-	while(base) {
+	while (base) {
 		base->object->flag= base->flag;
 		base= base->next;
 	}
@@ -138,7 +141,7 @@ void copy_objectflags(struct Scene *scene)
 {
 	Base *base= scene->base.first;
 	
-	while(base) {
+	while (base) {
 		base->flag= base->object->flag;
 		base= base->next;
 	}
@@ -156,7 +159,7 @@ void update_base_layer(struct Scene *scene, Object *ob)
 
 void object_free_particlesystems(Object *ob)
 {
-	while(ob->particlesystem.first){
+	while (ob->particlesystem.first) {
 		ParticleSystem *psys = ob->particlesystem.first;
 		
 		BLI_remlink(&ob->particlesystem,psys);
@@ -167,7 +170,7 @@ void object_free_particlesystems(Object *ob)
 
 void object_free_softbody(Object *ob)
 {
-	if(ob->soft) {
+	if (ob->soft) {
 		sbFree(ob->soft);
 		ob->soft= NULL;
 	}
@@ -175,7 +178,7 @@ void object_free_softbody(Object *ob)
 
 void object_free_bulletsoftbody(Object *ob)
 {
-	if(ob->bsoft) {
+	if (ob->bsoft) {
 		bsbFree(ob->bsoft);
 		ob->bsoft= NULL;
 	}
@@ -198,15 +201,39 @@ void object_free_modifiers(Object *ob)
 	object_free_softbody(ob);
 }
 
+int object_support_modifier_type(Object *ob, int modifier_type)
+{
+	ModifierTypeInfo *mti;
+
+	mti = modifierType_getInfo(modifier_type);
+
+	if (!((mti->flags & eModifierTypeFlag_AcceptsCVs) ||
+	     (ob->type==OB_MESH && (mti->flags & eModifierTypeFlag_AcceptsMesh))))
+	{
+			return FALSE;
+	}
+
+	return TRUE;
+}
+
 void object_link_modifiers(struct Object *ob, struct Object *from)
 {
 	ModifierData *md;
 	object_free_modifiers(ob);
 
+	if (!ELEM5(ob->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) {
 		ModifierData *nmd = NULL;
 
-		if(ELEM4(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_ParticleInstance, eModifierType_Collision)) continue;
+		if (ELEM4(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_ParticleInstance, eModifierType_Collision)) continue;
+
+		if (!object_support_modifier_type(ob, md->type))
+			continue;
 
 		nmd = modifier_new(md->type);
 		modifier_copyData(md, nmd);
@@ -223,12 +250,12 @@ void object_link_modifiers(struct Object *ob, struct Object *from)
 /* also (ab)used in depsgraph */
 void object_free_display(Object *ob)
 {
-	if(ob->derivedDeform) {
+	if (ob->derivedDeform) {
 		ob->derivedDeform->needsFree = 1;
 		ob->derivedDeform->release(ob->derivedDeform);
 		ob->derivedDeform= NULL;
 	}
-	if(ob->derivedFinal) {
+	if (ob->derivedFinal) {
 		ob->derivedFinal->needsFree = 1;
 		ob->derivedFinal->release(ob->derivedFinal);
 		ob->derivedFinal= NULL;
@@ -239,9 +266,9 @@ void object_free_display(Object *ob)
 
 void free_sculptsession_deformMats(SculptSession *ss)
 {
-	if(ss->orig_cos) MEM_freeN(ss->orig_cos);
-	if(ss->deform_cos) MEM_freeN(ss->deform_cos);
-	if(ss->deform_imats) MEM_freeN(ss->deform_imats);
+	if (ss->orig_cos) MEM_freeN(ss->orig_cos);
+	if (ss->deform_cos) MEM_freeN(ss->deform_cos);
+	if (ss->deform_imats) MEM_freeN(ss->deform_imats);
 
 	ss->orig_cos = NULL;
 	ss->deform_cos = NULL;
@@ -250,26 +277,26 @@ void free_sculptsession_deformMats(SculptSession *ss)
 
 void free_sculptsession(Object *ob)
 {
-	if(ob && ob->sculpt) {
+	if (ob && ob->sculpt) {
 		SculptSession *ss = ob->sculpt;
 		DerivedMesh *dm= ob->derivedFinal;
 
-		if(ss->pbvh)
+		if (ss->pbvh)
 			BLI_pbvh_free(ss->pbvh);
-		if(dm && dm->getPBVH)
+		if (dm && dm->getPBVH)
 			dm->getPBVH(NULL, dm); /* signal to clear */
 
-		if(ss->texcache)
+		if (ss->texcache)
 			MEM_freeN(ss->texcache);
 
-		if(ss->layer_co)
+		if (ss->layer_co)
 			MEM_freeN(ss->layer_co);
 
-		if(ss->orig_cos)
+		if (ss->orig_cos)
 			MEM_freeN(ss->orig_cos);
-		if(ss->deform_cos)
+		if (ss->deform_cos)
 			MEM_freeN(ss->deform_cos);
-		if(ss->deform_imats)
+		if (ss->deform_imats)
 			MEM_freeN(ss->deform_imats);
 
 		MEM_freeN(ss);
@@ -287,34 +314,34 @@ void free_object(Object *ob)
 	object_free_display(ob);
 	
 	/* disconnect specific data */
-	if(ob->data) {
+	if (ob->data) {
 		ID *id= ob->data;
 		id->us--;
-		if(id->us==0) {
-			if(ob->type==OB_MESH) unlink_mesh(ob->data);
-			else if(ob->type==OB_CURVE) unlink_curve(ob->data);
-			else if(ob->type==OB_MBALL) unlink_mball(ob->data);
+		if (id->us==0) {
+			if (ob->type==OB_MESH) unlink_mesh(ob->data);
+			else if (ob->type==OB_CURVE) unlink_curve(ob->data);
+			else if (ob->type==OB_MBALL) unlink_mball(ob->data);
 		}
 		ob->data= NULL;
 	}
 	
-	for(a=0; a<ob->totcol; a++) {
-		if(ob->mat[a]) ob->mat[a]->id.us--;
+	for (a=0; a<ob->totcol; a++) {
+		if (ob->mat[a]) ob->mat[a]->id.us--;
 	}
-	if(ob->mat) MEM_freeN(ob->mat);
-	if(ob->matbits) MEM_freeN(ob->matbits);
+	if (ob->mat) MEM_freeN(ob->mat);
+	if (ob->matbits) MEM_freeN(ob->matbits);
 	ob->mat= NULL;
 	ob->matbits= NULL;
-	if(ob->bb) MEM_freeN(ob->bb); 
+	if (ob->bb) MEM_freeN(ob->bb); 
 	ob->bb= NULL;
-	if(ob->adt) BKE_free_animdata((ID *)ob);
-	if(ob->poselib) ob->poselib->id.us--;
-	if(ob->gpd) ((ID *)ob->gpd)->us--;
-	if(ob->defbase.first)
+	if (ob->adt) BKE_free_animdata((ID *)ob);
+	if (ob->poselib) ob->poselib->id.us--;
+	if (ob->gpd) ((ID *)ob->gpd)->us--;
+	if (ob->defbase.first)
 		BLI_freelistN(&ob->defbase);
-	if(ob->pose)
+	if (ob->pose)
 		free_pose(ob->pose);
-	if(ob->mpath)
+	if (ob->mpath)
 		animviz_free_motionpath(ob->mpath);
 	free_properties(&ob->prop);
 	object_free_modifiers(ob);
@@ -327,13 +354,13 @@ void free_object(Object *ob)
 	
 	free_partdeflect(ob->pd);
 
-	if(ob->soft) sbFree(ob->soft);
-	if(ob->bsoft) bsbFree(ob->bsoft);
-	if(ob->gpulamp.first) GPU_lamp_free(ob);
+	if (ob->soft) sbFree(ob->soft);
+	if (ob->bsoft) bsbFree(ob->bsoft);
+	if (ob->gpulamp.first) GPU_lamp_free(ob);
 
 	free_sculptsession(ob);
 
-	if(ob->pc_ids.first) BLI_freelistN(&ob->pc_ids);
+	if (ob->pc_ids.first) BLI_freelistN(&ob->pc_ids);
 }
 
 static void unlink_object__unlinkModifierLinks(void *userData, Object *ob, Object **obpoin)
@@ -371,42 +398,42 @@ void unlink_object(Object *ob)
 	/* check all objects: parents en bevels and fields, also from libraries */
 	// FIXME: need to check all animation blocks (drivers)
 	obt= bmain->object.first;
-	while(obt) {
-		if(obt->proxy==ob)
+	while (obt) {
+		if (obt->proxy==ob)
 			obt->proxy= NULL;
-		if(obt->proxy_from==ob) {
+		if (obt->proxy_from==ob) {
 			obt->proxy_from= NULL;
 			obt->recalc |= OB_RECALC_OB;
 		}
-		if(obt->proxy_group==ob)
+		if (obt->proxy_group==ob)
 			obt->proxy_group= NULL;
 		
-		if(obt->parent==ob) {
+		if (obt->parent==ob) {
 			obt->parent= NULL;
 			obt->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
 		}
 		
 		modifiers_foreachObjectLink(obt, unlink_object__unlinkModifierLinks, ob);
 		
-		if ELEM(obt->type, OB_CURVE, OB_FONT) {
+		if (ELEM(obt->type, OB_CURVE, OB_FONT)) {
 			cu= obt->data;
 
-			if(cu->bevobj==ob) {
+			if (cu->bevobj==ob) {
 				cu->bevobj= NULL;
 				obt->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
 			}
-			if(cu->taperobj==ob) {
+			if (cu->taperobj==ob) {
 				cu->taperobj= NULL;
 				obt->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
 			}
-			if(cu->textoncurve==ob) {
+			if (cu->textoncurve==ob) {
 				cu->textoncurve= NULL;
 				obt->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
 			}
 		}
-		else if(obt->type==OB_ARMATURE && obt->pose) {
+		else if (obt->type==OB_ARMATURE && obt->pose) {
 			bPoseChannel *pchan;
-			for(pchan= obt->pose->chanbase.first; pchan; pchan= pchan->next) {
+			for (pchan= obt->pose->chanbase.first; pchan; pchan= pchan->next) {
 				for (con = pchan->constraints.first; con; con=con->next) {
 					bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
 					ListBase targets = {NULL, NULL};
@@ -427,12 +454,12 @@ void unlink_object(Object *ob)
 							cti->flush_constraint_targets(con, &targets, 0);
 					}
 				}
-				if(pchan->custom==ob)
+				if (pchan->custom==ob)
 					pchan->custom= NULL;
 			}
 		} 
-		else if(ELEM(OB_MBALL, ob->type, obt->type)) {
-			if(is_mball_basis_for(obt, ob))
+		else if (ELEM(OB_MBALL, ob->type, obt->type)) {
+			if (is_mball_basis_for (obt, ob))
 				obt->recalc|= OB_RECALC_DATA;
 		}
 		
@@ -460,84 +487,84 @@ void unlink_object(Object *ob)
 		}
 		
 		/* object is deflector or field */
-		if(ob->pd) {
-			if(obt->soft)
+		if (ob->pd) {
+			if (obt->soft)
 				obt->recalc |= OB_RECALC_DATA;
 
 			/* cloth */
-			for(md=obt->modifiers.first; md; md=md->next)
-				if(md->type == eModifierType_Cloth)
+			for (md=obt->modifiers.first; md; md=md->next)
+				if (md->type == eModifierType_Cloth)
 					obt->recalc |= OB_RECALC_DATA;
 		}
 		
 		/* strips */
 #if 0 // XXX old animation system
-		for(strip= obt->nlastrips.first; strip; strip= strip->next) {
-			if(strip->object==ob)
+		for (strip= obt->nlastrips.first; strip; strip= strip->next) {
+			if (strip->object==ob)
 				strip->object= NULL;
 			
-			if(strip->modifiers.first) {
+			if (strip->modifiers.first) {
 				bActionModifier *amod;
-				for(amod= strip->modifiers.first; amod; amod= amod->next)
-					if(amod->ob==ob)
+				for (amod= strip->modifiers.first; amod; amod= amod->next)
+					if (amod->ob==ob)
 						amod->ob= NULL;
 			}
 		}
 #endif // XXX old animation system
 
 		/* particle systems */
-		if(obt->particlesystem.first) {
+		if (obt->particlesystem.first) {
 			ParticleSystem *tpsys= obt->particlesystem.first;
-			for(; tpsys; tpsys=tpsys->next) {
+			for (; tpsys; tpsys=tpsys->next) {
 				BoidState *state = NULL;
 				BoidRule *rule = NULL;
 
 				ParticleTarget *pt = tpsys->targets.first;
-				for(; pt; pt=pt->next) {
-					if(pt->ob==ob) {
+				for (; pt; pt=pt->next) {
+					if (pt->ob==ob) {
 						pt->ob = NULL;
 						obt->recalc |= OB_RECALC_DATA;
 						break;
 					}
 				}
 
-				if(tpsys->target_ob==ob) {
+				if (tpsys->target_ob==ob) {
 					tpsys->target_ob= NULL;
 					obt->recalc |= OB_RECALC_DATA;
 				}
 
-				if(tpsys->part->dup_ob==ob)
+				if (tpsys->part->dup_ob==ob)
 					tpsys->part->dup_ob= NULL;
 
-				if(tpsys->part->phystype==PART_PHYS_BOIDS) {
+				if (tpsys->part->phystype==PART_PHYS_BOIDS) {
 					ParticleData *pa;
 					BoidParticle *bpa;
 					int p;
 
-					for(p=0,pa=tpsys->particles; p<tpsys->totpart; p++,pa++) {
+					for (p=0,pa=tpsys->particles; p<tpsys->totpart; p++,pa++) {
 						bpa = pa->boid;
-						if(bpa->ground == ob)
+						if (bpa->ground == ob)
 							bpa->ground = NULL;
 					}
 				}
-				if(tpsys->part->boids) {
-					for(state = tpsys->part->boids->states.first; state; state=state->next) {
-						for(rule = state->rules.first; rule; rule=rule->next) {
-							if(rule->type==eBoidRuleType_Avoid) {
+				if (tpsys->part->boids) {
+					for (state = tpsys->part->boids->states.first; state; state=state->next) {
+						for (rule = state->rules.first; rule; rule=rule->next) {
+							if (rule->type==eBoidRuleType_Avoid) {
 								BoidRuleGoalAvoid *gabr = (BoidRuleGoalAvoid*)rule;
-								if(gabr->ob==ob)
+								if (gabr->ob==ob)
 									gabr->ob= NULL;
 							}
-							else if(rule->type==eBoidRuleType_FollowLeader) {
+							else if (rule->type==eBoidRuleType_FollowLeader) {
 								BoidRuleFollowLeader *flbr = (BoidRuleFollowLeader*)rule;
-								if(flbr->ob==ob)
+								if (flbr->ob==ob)
 									flbr->ob= NULL;
 							}
 						}
 					}
 				}
 			}
-			if(ob->pd)
+			if (ob->pd)
 				obt->recalc |= OB_RECALC_DATA;
 		}
 
@@ -546,10 +573,10 @@ void unlink_object(Object *ob)
 	
 	/* materials */
 	mat= bmain->mat.first;
-	while(mat) {
+	while (mat) {
 	
-		for(a=0; a<MAX_MTEX; a++) {
-			if(mat->mtex[a] && ob==mat->mtex[a]->object) {
+		for (a=0; a<MAX_MTEX; a++) {
+			if (mat->mtex[a] && ob==mat->mtex[a]->object) {
 				/* actually, test for lib here... to do */
 				mat->mtex[a]->object= NULL;
 			}
@@ -559,18 +586,18 @@ void unlink_object(Object *ob)
 	}
 	
 	/* textures */
-	for(tex= bmain->tex.first; tex; tex= tex->id.next) {
-		if(tex->env && (ob==tex->env->object)) tex->env->object= NULL;
-		if(tex->pd  && (ob==tex->pd->object))  tex->pd->object= NULL;
-		if(tex->vd  && (ob==tex->vd->object))  tex->vd->object= NULL;
+	for (tex= bmain->tex.first; tex; tex= tex->id.next) {
+		if (tex->env && (ob==tex->env->object)) tex->env->object= NULL;
+		if (tex->pd  && (ob==tex->pd->object))  tex->pd->object= NULL;
+		if (tex->vd  && (ob==tex->vd->object))  tex->vd->object= NULL;
 	}
 
 	/* worlds */
 	wrld= bmain->world.first;
-	while(wrld) {
-		if(wrld->id.lib==NULL) {
-			for(a=0; a<MAX_MTEX; a++) {
-				if(wrld->mtex[a] && ob==wrld->mtex[a]->object)
+	while (wrld) {
+		if (wrld->id.lib==NULL) {
+			for (a=0; a<MAX_MTEX; a++) {
+				if (wrld->mtex[a] && ob==wrld->mtex[a]->object)
 					wrld->mtex[a]->object= NULL;
 			}
 		}
@@ -580,26 +607,26 @@ void unlink_object(Object *ob)
 		
 	/* scenes */
 	sce= bmain->scene.first;
-	while(sce) {
-		if(sce->id.lib==NULL) {
-			if(sce->camera==ob) sce->camera= NULL;
-			if(sce->toolsettings->skgen_template==ob) sce->toolsettings->skgen_template = NULL;
-			if(sce->toolsettings->particle.object==ob) sce->toolsettings->particle.object= NULL;
+	while (sce) {
+		if (sce->id.lib==NULL) {
+			if (sce->camera==ob) sce->camera= NULL;
+			if (sce->toolsettings->skgen_template==ob) sce->toolsettings->skgen_template = NULL;
+			if (sce->toolsettings->particle.object==ob) sce->toolsettings->particle.object= NULL;
 
 #ifdef DURIAN_CAMERA_SWITCH
 			{
 				TimeMarker *m;
 
 				for (m= sce->markers.first; m; m= m->next) {
-					if(m->camera==ob)
+					if (m->camera==ob)
 						m->camera= NULL;
 				}
 			}
 #endif
-			if(sce->ed) {
+			if (sce->ed) {
 				Sequence *seq;
 				SEQ_BEGIN(sce->ed, seq)
-					if(seq->scene_camera==ob) {
+					if (seq->scene_camera==ob) {
 						seq->scene_camera= NULL;
 					}
 				SEQ_END
@@ -611,21 +638,31 @@ void unlink_object(Object *ob)
 	
 	/* screens */
 	sc= bmain->screen.first;
-	while(sc) {
+	while (sc) {
 		ScrArea *sa= sc->areabase.first;
-		while(sa) {
+		while (sa) {
 			SpaceLink *sl;
 
 			for (sl= sa->spacedata.first; sl; sl= sl->next) {
-				if(sl->spacetype==SPACE_VIEW3D) {
+				if (sl->spacetype==SPACE_VIEW3D) {
 					View3D *v3d= (View3D*) sl;
 
+					/* found doesn't need to be set here */
+					if (v3d->ob_centre == ob) {
+						v3d->ob_centre = NULL;
+						v3d->ob_centre_bone[0] = '\0';
+					}
+					if (v3d->localvd && v3d->localvd->ob_centre == ob) {
+						v3d->localvd->ob_centre = NULL;
+						v3d->localvd->ob_centre_bone[0] = '\0';
+					}
+
 					found= 0;
-					if(v3d->camera==ob) {
+					if (v3d->camera==ob) {
 						v3d->camera= NULL;
 						found= 1;
 					}
-					if(v3d->localvd && v3d->localvd->camera==ob ) {
+					if (v3d->localvd && v3d->localvd->camera==ob ) {
 						v3d->localvd->camera= NULL;
 						found += 2;
 					}
@@ -648,21 +685,21 @@ void unlink_object(Object *ob)
 						}
 					}
 				}
-				else if(sl->spacetype==SPACE_OUTLINER) {
+				else if (sl->spacetype==SPACE_OUTLINER) {
 					SpaceOops *so= (SpaceOops *)sl;
 
-					if(so->treestore) {
+					if (so->treestore) {
 						TreeStoreElem *tselem= so->treestore->data;
 						int a;
-						for(a=0; a<so->treestore->usedelem; a++, tselem++) {
-							if(tselem->id==(ID *)ob) tselem->id= NULL;
+						for (a=0; a<so->treestore->usedelem; a++, tselem++) {
+							if (tselem->id==(ID *)ob) tselem->id= NULL;
 						}
 					}
 				}
-				else if(sl->spacetype==SPACE_BUTS) {
+				else if (sl->spacetype==SPACE_BUTS) {
 					SpaceButs *sbuts= (SpaceButs *)sl;
 
-					if(sbuts->pinid==(ID *)ob) {
+					if (sbuts->pinid==(ID *)ob) {
 						sbuts->flag&= ~SB_PIN_CONTEXT;
 						sbuts->pinid= NULL;
 					}
@@ -676,14 +713,14 @@ void unlink_object(Object *ob)
 
 	/* groups */
 	group= bmain->group.first;
-	while(group) {
+	while (group) {
 		rem_from_group(group, ob, NULL, NULL);
 		group= group->id.next;
 	}
 	
 	/* cameras */
 	camera= bmain->camera.first;
-	while(camera) {
+	while (camera) {
 		if (camera->dof_ob==ob) {
 			camera->dof_ob = NULL;
 		}
@@ -695,11 +732,11 @@ int exist_object(Object *obtest)
 {
 	Object *ob;
 	
-	if(obtest==NULL) return 0;
+	if (obtest==NULL) return 0;
 	
 	ob= G.main->object.first;
-	while(ob) {
-		if(ob==obtest) return 1;
+	while (ob) {
+		if (ob==obtest) return 1;
 		ob= ob->id.next;
 	}
 	return 0;
@@ -784,7 +821,7 @@ Object *add_only_object(int type, const char *name)
 	ob->empty_drawtype= OB_PLAINAXES;
 	ob->empty_drawsize= 1.0;
 
-	if(type==OB_CAMERA || type==OB_LAMP || type==OB_SPEAKER) {
+	if (type==OB_CAMERA || type==OB_LAMP || type==OB_SPEAKER) {
 		ob->trackflag= OB_NEGZ;
 		ob->upflag= OB_POSY;
 	}
@@ -810,8 +847,8 @@ Object *add_only_object(int type, const char *name)
 	ob->init_state=1;
 	ob->state=1;
 	/* ob->pad3 == Contact Processing Threshold */
-	ob->m_contactProcessingThreshold = 1.;
-	ob->obstacleRad = 1.;
+	ob->m_contactProcessingThreshold = 1.0f;
+	ob->obstacleRad = 1.0f;
 	
 	/* NT fluid sim defaults */
 	ob->fluidsimSettings = NULL;
@@ -864,7 +901,7 @@ SoftBody *copy_softbody(SoftBody *sb)
 
 	sbn->pointcache= BKE_ptcache_copy_list(&sbn->ptcaches, &sb->ptcaches);
 
-	if(sb->effector_weights)
+	if (sb->effector_weights)
 		sbn->effector_weights = MEM_dupallocN(sb->effector_weights);
 
 	return sbn;
@@ -891,32 +928,32 @@ static ParticleSystem *copy_particlesystem(ParticleSystem *psys)
 	psysn->particles= MEM_dupallocN(psys->particles);
 	psysn->child= MEM_dupallocN(psys->child);
 
-	if(psys->part->type == PART_HAIR) {
-		for(p=0, pa=psysn->particles; p<psysn->totpart; p++, pa++)
+	if (psys->part->type == PART_HAIR) {
+		for (p=0, pa=psysn->particles; p<psysn->totpart; p++, pa++)
 			pa->hair = MEM_dupallocN(pa->hair);
 	}
 
-	if(psysn->particles && (psysn->particles->keys || psysn->particles->boid)) {
+	if (psysn->particles && (psysn->particles->keys || psysn->particles->boid)) {
 		ParticleKey *key = psysn->particles->keys;
 		BoidParticle *boid = psysn->particles->boid;
 
-		if(key)
+		if (key)
 			key = MEM_dupallocN(key);
 		
-		if(boid)
+		if (boid)
 			boid = MEM_dupallocN(boid);
 		
-		for(p=0, pa=psysn->particles; p<psysn->totpart; p++, pa++) {
-			if(boid)
+		for (p=0, pa=psysn->particles; p<psysn->totpart; p++, pa++) {
+			if (boid)
 				pa->boid = boid++;
-			if(key) {
+			if (key) {
 				pa->keys = key;
 				key += pa->totkey;
 			}
 		}
 	}
 
-	if(psys->clmd) {
+	if (psys->clmd) {
 		psysn->clmd = (ClothModifierData *)modifier_new(eModifierType_Cloth);
 		modifier_copyData((ModifierData*)psys->clmd, (ModifierData*)psysn->clmd);
 		psys->hair_in_dm = psys->hair_out_dm = NULL;
@@ -939,7 +976,7 @@ static ParticleSystem *copy_particlesystem(ParticleSystem *psys)
 
 	/* XXX - from reading existing code this seems correct but intended usage of
 	 * pointcache should /w cloth should be added in 'ParticleSystem' - campbell */
-	if(psysn->clmd) {
+	if (psysn->clmd) {
 		psysn->clmd->point_cache= psysn->pointcache;
 	}
 
@@ -953,23 +990,28 @@ void copy_object_particlesystems(Object *obn, Object *ob)
 	ParticleSystem *psys, *npsys;
 	ModifierData *md;
 
+	if (obn->type != OB_MESH) {
+		/* currently only mesh objects can have soft body */
+		return;
+	}
+
 	obn->particlesystem.first= obn->particlesystem.last= NULL;
-	for(psys=ob->particlesystem.first; psys; psys=psys->next) {
+	for (psys=ob->particlesystem.first; psys; psys=psys->next) {
 		npsys= copy_particlesystem(psys);
 
 		BLI_addtail(&obn->particlesystem, npsys);
 
 		/* need to update particle modifiers too */
-		for(md=obn->modifiers.first; md; md=md->next) {
-			if(md->type==eModifierType_ParticleSystem) {
+		for (md=obn->modifiers.first; md; md=md->next) {
+			if (md->type==eModifierType_ParticleSystem) {
 				ParticleSystemModifierData *psmd= (ParticleSystemModifierData*)md;
-				if(psmd->psys==psys)
+				if (psmd->psys==psys)
 					psmd->psys= npsys;
 			}
-			else if(md->type==eModifierType_DynamicPaint) {
+			else if (md->type==eModifierType_DynamicPaint) {
 				DynamicPaintModifierData *pmd= (DynamicPaintModifierData*)md;
 				if (pmd->brush) {
-					if(pmd->brush->psys==psys) {
+					if (pmd->brush->psys==psys) {
 						pmd->brush->psys= npsys;
 					}
 				}
@@ -977,7 +1019,7 @@ void copy_object_particlesystems(Object *obn, Object *ob)
 			else if (md->type==eModifierType_Smoke) {
 				SmokeModifierData *smd = (SmokeModifierData*) md;
 				
-				if(smd->type==MOD_SMOKE_TYPE_FLOW) {
+				if (smd->type==MOD_SMOKE_TYPE_FLOW) {
 					if (smd->flow) {
 						if (smd->flow->psys == psys)
 							smd->flow->psys= npsys;
@@ -990,7 +1032,7 @@ void copy_object_particlesystems(Object *obn, Object *ob)
 
 void copy_object_softbody(Object *obn, Object *ob)
 {
-	if(ob->soft)
+	if (ob->soft)
 		obn->soft= copy_softbody(ob->soft);
 }
 
@@ -1002,7 +1044,7 @@ static void copy_object_pose(Object *obn, Object *ob)
 	obn->pose= NULL;
 	copy_pose(&obn->pose, ob->pose, 1);	/* 1 = copy constraints */
 
-	for (chan = obn->pose->chanbase.first; chan; chan=chan->next){
+	for (chan = obn->pose->chanbase.first; chan; chan=chan->next) {
 		bConstraint *con;
 		
 		chan->flag &= ~(POSE_LOC|POSE_ROT|POSE_SIZE);
@@ -1029,7 +1071,7 @@ static void copy_object_pose(Object *obn, Object *ob)
 
 static int object_pose_context(Object *ob)
 {
-	if(	(ob) &&
+	if (	(ob) &&
 		(ob->type == OB_ARMATURE) &&
 		(ob->pose) &&
 		(ob->mode & OB_MODE_POSE)
@@ -1043,15 +1085,15 @@ static int object_pose_context(Object *ob)
 
 Object *object_pose_armature_get(Object *ob)
 {
-	if(ob==NULL)
+	if (ob==NULL)
 		return NULL;
 
-	if(object_pose_context(ob))
+	if (object_pose_context(ob))
 		return ob;
 
 	ob= modifiers_isDeformedByArmature(ob);
 
-	if(object_pose_context(ob))
+	if (object_pose_context(ob))
 		return ob;
 
 	return NULL;
@@ -1076,13 +1118,13 @@ Object *copy_object(Object *ob)
 
 	obn= copy_libblock(&ob->id);
 	
-	if(ob->totcol) {
+	if (ob->totcol) {
 		obn->mat= MEM_dupallocN(ob->mat);
 		obn->matbits= MEM_dupallocN(ob->matbits);
 		obn->totcol= ob->totcol;
 	}
 	
-	if(ob->bb) obn->bb= MEM_dupallocN(ob->bb);
+	if (ob->bb) obn->bb= MEM_dupallocN(ob->bb);
 	obn->flag &= ~OB_FROMGROUP;
 	
 	obn->modifiers.first = obn->modifiers.last= NULL;
@@ -1101,10 +1143,10 @@ Object *copy_object(Object *ob)
 	copy_controllers(&obn->controllers, &ob->controllers);
 	copy_actuators(&obn->actuators, &ob->actuators);
 	
-	if(ob->pose) {
+	if (ob->pose) {
 		copy_object_pose(obn, ob);
 		/* backwards compat... non-armatures can get poses in older files? */
-		if(ob->type==OB_ARMATURE)
+		if (ob->type==OB_ARMATURE)
 			armature_rebuild_pose(obn, obn->data);
 	}
 	defgroup_copy_list(&obn->defbase, &ob->defbase);
@@ -1118,15 +1160,15 @@ Object *copy_object(Object *ob)
 	id_us_plus((ID *)obn->gpd);
 	id_lib_extern((ID *)obn->dup_group);
 
-	for(a=0; a<obn->totcol; a++) id_us_plus((ID *)obn->mat[a]);
+	for (a=0; a<obn->totcol; a++) id_us_plus((ID *)obn->mat[a]);
 	
 	obn->disp.first= obn->disp.last= NULL;
 	
-	if(ob->pd){
+	if (ob->pd) {
 		obn->pd= MEM_dupallocN(ob->pd);
-		if(obn->pd->tex)
+		if (obn->pd->tex)
 			id_us_plus(&(obn->pd->tex->id));
-		if(obn->pd->rng)
+		if (obn->pd->rng)
 			obn->pd->rng = MEM_dupallocN(ob->pd->rng);
 	}
 	obn->soft= copy_softbody(ob->soft);
@@ -1156,7 +1198,7 @@ static void extern_local_object(Object *ob)
 
 	extern_local_matarar(ob->mat, ob->totcol);
 
-	for(psys=ob->particlesystem.first; psys; psys=psys->next)
+	for (psys=ob->particlesystem.first; psys; psys=psys->next)
 		id_lib_extern((ID *)psys->part);
 }
 
@@ -1172,27 +1214,27 @@ void make_local_object(Object *ob)
 	 * - mixed: make copy
 	 */
 
-	if(ob->id.lib==NULL) return;
+	if (ob->id.lib==NULL) return;
 	
 	ob->proxy= ob->proxy_from= NULL;
 	
-	if(ob->id.us==1) {
+	if (ob->id.us==1) {
 		id_clear_lib_data(bmain, &ob->id);
 		extern_local_object(ob);
 	}
 	else {
-		for(sce= bmain->scene.first; sce && ELEM(0, is_lib, is_local); sce= sce->id.next) {
-			if(object_in_scene(ob, sce)) {
-				if(sce->id.lib) is_lib= TRUE;
+		for (sce= bmain->scene.first; sce && ELEM(0, is_lib, is_local); sce= sce->id.next) {
+			if (object_in_scene(ob, sce)) {
+				if (sce->id.lib) is_lib= TRUE;
 				else is_local= TRUE;
 			}
 		}
 
-		if(is_local && is_lib == FALSE) {
+		if (is_local && is_lib == FALSE) {
 			id_clear_lib_data(bmain, &ob->id);
 			extern_local_object(ob);
 		}
-		else if(is_local && is_lib) {
+		else if (is_local && is_lib) {
 			Object *ob_new= copy_object(ob);
 
 			ob_new->id.us= 0;
@@ -1201,11 +1243,11 @@ void make_local_object(Object *ob)
 			BKE_id_lib_local_paths(bmain, ob->id.lib, &ob_new->id);
 
 			sce= bmain->scene.first;
-			while(sce) {
-				if(sce->id.lib==NULL) {
+			while (sce) {
+				if (sce->id.lib==NULL) {
 					base= sce->base.first;
-					while(base) {
-						if(base->object==ob) {
+					while (base) {
+						if (base->object==ob) {
 							base->object= ob_new;
 							ob_new->id.us++;
 							ob->id.us--;
@@ -1233,11 +1275,11 @@ int object_is_libdata(Object *ob)
 /* Returns true if the Object data is a from an external blend file (libdata) */
 int object_data_is_libdata(Object *ob)
 {
-	if(!ob) return 0;
-	if(ob->proxy && (ob->data==NULL || ((ID *)ob->data)->lib==NULL)) return 0;
-	if(ob->id.lib) return 1;
-	if(ob->data==NULL) return 0;
-	if(((ID *)ob->data)->lib) return 1;
+	if (!ob) return 0;
+	if (ob->proxy && (ob->data==NULL || ((ID *)ob->data)->lib==NULL)) return 0;
+	if (ob->id.lib) return 1;
+	if (ob->data==NULL) return 0;
+	if (((ID *)ob->data)->lib) return 1;
 
 	return 0;
 }
@@ -1252,7 +1294,7 @@ static void armature_set_id_extern(Object *ob)
 	unsigned int lay= arm->layer_protected;
 	
 	for (pchan = ob->pose->chanbase.first; pchan; pchan=pchan->next) {
-		if(!(pchan->bone->layer & lay))
+		if (!(pchan->bone->layer & lay))
 			id_lib_extern((ID *)pchan->custom);
 	}
 			
@@ -1264,7 +1306,7 @@ void object_copy_proxy_drivers(Object *ob, Object *target)
 		FCurve *fcu;
 		
 		/* add new animdata block */
-		if(!ob->adt)
+		if (!ob->adt)
 			ob->adt= BKE_id_add_animdata(&ob->id);
 		
 		/* make a copy of all the drivers (for now), then correct any links that need fixing */
@@ -1279,13 +1321,13 @@ void object_copy_proxy_drivers(Object *ob, Object *target)
 				/* all drivers */
 				DRIVER_TARGETS_LOOPER(dvar) 
 				{
-					if(dtar->id) {
+					if (dtar->id) {
 						if ((Object *)dtar->id == target)
 							dtar->id= (ID *)ob;
 						else {
 							/* only on local objects because this causes indirect links a -> b -> c,blend to point directly to a.blend
 							 * when a.blend has a proxy thats linked into c.blend  */
-							if(ob->id.lib==NULL)
+							if (ob->id.lib==NULL)
 								id_lib_extern((ID *)dtar->id);
 						}
 					}
@@ -1303,7 +1345,7 @@ void object_copy_proxy_drivers(Object *ob, Object *target)
 void object_make_proxy(Object *ob, Object *target, Object *gob)
 {
 	/* paranoia checks */
-	if(ob->id.lib || target->id.lib==NULL) {
+	if (ob->id.lib || target->id.lib==NULL) {
 		printf("cannot make proxy\n");
 		return;
 	}
@@ -1320,10 +1362,10 @@ void object_make_proxy(Object *ob, Object *target, Object *gob)
 	 *
 	 * - no gob means this is being made from a linked object,
 	 *   this is closer to making a copy of the object - in-place. */
-	if(gob) {
+	if (gob) {
 		ob->rotmode= target->rotmode;
 		mult_m4_m4m4(ob->obmat, gob->obmat, target->obmat);
-		if(gob->dup_group) { /* should always be true */
+		if (gob->dup_group) { /* should always be true */
 			float tvec[3];
 			copy_v3_v3(tvec, gob->dup_group->dupli_ofs);
 			mul_mat3_m4_v3(ob->obmat, tvec);
@@ -1350,8 +1392,8 @@ void object_make_proxy(Object *ob, Object *target, Object *gob)
 	
 	/* copy material and index information */
 	ob->actcol= ob->totcol= 0;
-	if(ob->mat) MEM_freeN(ob->mat);
-	if(ob->matbits) MEM_freeN(ob->matbits);
+	if (ob->mat) MEM_freeN(ob->mat);
+	if (ob->matbits) MEM_freeN(ob->matbits);
 	ob->mat = NULL;
 	ob->matbits= NULL;
 	if ((target->totcol) && (target->mat) && OB_TYPE_SUPPORT_MATERIAL(ob->type)) {
@@ -1362,14 +1404,14 @@ void object_make_proxy(Object *ob, Object *target, Object *gob)
 		
 		ob->mat = MEM_dupallocN(target->mat);
 		ob->matbits = MEM_dupallocN(target->matbits);
-		for(i=0; i<target->totcol; i++) {
-			/* dont need to run test_object_materials since we know this object is new and not used elsewhere */
+		for (i=0; i<target->totcol; i++) {
+			/* don't need to run test_object_materials since we know this object is new and not used elsewhere */
 			id_us_plus((ID *)ob->mat[i]); 
 		}
 	}
 	
 	/* type conversions */
-	if(target->type == OB_ARMATURE) {
+	if (target->type == OB_ARMATURE) {
 		copy_object_pose(ob, target);	/* data copy, object pointers in constraints */
 		rest_pose(ob->pose);			/* clear all transforms in channels */
 		armature_rebuild_pose(ob, ob->data);	/* set all internal links */
@@ -1382,12 +1424,12 @@ void object_make_proxy(Object *ob, Object *target, Object *gob)
 	}
 
 	/* copy IDProperties */
-	if(ob->id.properties) {
+	if (ob->id.properties) {
 		IDP_FreeProperty(ob->id.properties);
 		MEM_freeN(ob->id.properties);
 		ob->id.properties= NULL;
 	}
-	if(target->id.properties) {
+	if (target->id.properties) {
 		ob->id.properties= IDP_CopyProperty(target->id.properties);
 	}
 
@@ -1470,7 +1512,7 @@ void object_mat3_to_rot(Object *ob, float mat[][3], short use_compat)
 			quat_to_mat3(tmat, quat);
 			/* end drot correction */
 
-			if(use_compat)	mat3_to_compatible_eulO(ob->rot, ob->rot, ob->rotmode, tmat);
+			if (use_compat)	mat3_to_compatible_eulO(ob->rot, ob->rot, ob->rotmode, tmat);
 			else			mat3_to_eulO(ob->rot, ob->rotmode, tmat);
 		}
 	}
@@ -1546,7 +1588,7 @@ void object_apply_mat4(Object *ob, float mat[][4], const short use_compat, const
 {
 	float rot[3][3];
 
-	if(use_parent && ob->parent) {
+	if (use_parent && ob->parent) {
 		float rmat[4][4], diff_mat[4][4], imat[4][4];
 		mult_m4_m4m4(diff_mat, ob->parent->obmat, ob->parentinv);
 		invert_m4_m4(imat, diff_mat);
@@ -1608,16 +1650,16 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4])
 	unit_m4(mat);
 	
 	cu= par->data;
-	if(cu->path==NULL || cu->path->data==NULL) /* only happens on reload file, but violates depsgraph still... fix! */
+	if (cu->path==NULL || cu->path->data==NULL) /* only happens on reload file, but violates depsgraph still... fix! */
 		makeDispListCurveTypes(scene, par, 0);
-	if(cu->path==NULL) return;
+	if (cu->path==NULL) return;
 	
 	/* catch exceptions: feature for nla stride editing */
-	if(ob->ipoflag & OB_DISABLE_PATH) {
+	if (ob->ipoflag & OB_DISABLE_PATH) {
 		ctime= 0.0f;
 	}
 	/* catch exceptions: curve paths used as a duplicator */
-	else if(enable_cu_speed) {
+	else if (enable_cu_speed) {
 		/* ctime is now a proper var setting of Curve which gets set by Animato like any other var that's animated,
 		 * but this will only work if it actually is animated... 
 		 *
@@ -1640,7 +1682,7 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4])
 	}
 	
 	/* time calculus is correct, now apply distance offset */
-	if(cu->flag & CU_OFFS_PATHDIST) {
+	if (cu->flag & CU_OFFS_PATHDIST) {
 		ctime += timeoffs/cu->path->totdist;
 
 		/* restore */
@@ -1649,9 +1691,9 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4])
 	
 	
 	/* vec: 4 items! */
-	if( where_on_path(par, ctime, vec, dir, cu->flag & CU_FOLLOW ? quat:NULL, &radius, NULL) ) {
+	if ( where_on_path(par, ctime, vec, dir, cu->flag & CU_FOLLOW ? quat:NULL, &radius, NULL) ) {
 
-		if(cu->flag & CU_FOLLOW) {
+		if (cu->flag & CU_FOLLOW) {
 #if 0
 			float x1, q[4];
 			vec_to_quat( quat,dir, ob->trackflag, ob->upflag);
@@ -1671,7 +1713,7 @@ static void ob_parcurve(Scene *scene, Object *ob, Object *par, float mat[][4])
 			quat_to_mat4(mat, quat);
 		}
 		
-		if(cu->flag & CU_PATH_RADIUS) {
+		if (cu->flag & CU_PATH_RADIUS) {
 			float tmat[4][4], rmat[4][4];
 			scale_m4_fl(tmat, radius);
 			mult_m4_m4m4(rmat, tmat, mat);
@@ -1695,7 +1737,7 @@ static void ob_parbone(Object *ob, Object *par, float mat[][4])
 	
 	/* Make sure the bone is still valid */
 	pchan= get_pose_channel(par->pose, ob->parsubstr);
-	if (!pchan){
+	if (!pchan) {
 		printf ("Object %s with Bone parent: bone %s doesn't exist\n", ob->id.name+2, ob->parsubstr);
 		unit_m4(mat);
 		return;
@@ -1710,31 +1752,48 @@ static void ob_parbone(Object *ob, Object *par, float mat[][4])
 	add_v3_v3(mat[3], vec);
 }
 
-static void give_parvert(Object *par, int nr, float *vec)
+static void give_parvert(Object *par, int nr, float vec[3])
 {
-	EditMesh *em;
+	BMEditMesh *em;
 	int a, count;
 	
 	vec[0]=vec[1]=vec[2]= 0.0f;
 	
-	if(par->type==OB_MESH) {
+	if (par->type==OB_MESH) {
 		Mesh *me= par->data;
 		DerivedMesh *dm;
 
-		em = BKE_mesh_get_editmesh(me);
+		em = me->edit_btmesh;
+
+#if 0	/* this was bmesh only, better, evaluate why this was needed - campbell*/
+		if (em) {
+			BMVert *eve;
+			BMIter iter;
+
+			BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+				int *keyindex = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_SHAPE_KEYINDEX);
+				
+				if (keyindex && *keyindex==nr) {
+					copy_v3_v3(vec, eve->co);
+					break;
+				}
+			}
+		}
+#endif
+
 		dm = (em)? em->derivedFinal: par->derivedFinal;
 			
-		if(dm) {
+		if (dm) {
 			MVert *mvert= dm->getVertArray(dm);
 			int *index = (int *)dm->getVertDataArray(dm, CD_ORIGINDEX);
 			int i, vindex, numVerts = dm->getNumVerts(dm);
 
 			/* get the average of all verts with (original index == nr) */
 			count= 0;
-			for(i = 0; i < numVerts; i++) {
+			for (i = 0; i < numVerts; i++) {
 				vindex= (index)? index[i]: i;
 
-				if(vindex == nr) {
+				if (vindex == nr) {
 					add_v3_v3(vec, mvert[i].co);
 					count++;
 				}
@@ -1742,17 +1801,16 @@ static void give_parvert(Object *par, int nr, float *vec)
 
 			if (count==0) {
 				/* keep as 0,0,0 */
-			} else if(count > 0) {
+			}
+			else if (count > 0) {
 				mul_v3_fl(vec, 1.0f / count);
-			} else {
+			}
+			else {
 				/* use first index if its out of range */
 				dm->getVertCo(dm, 0, vec);
 			}
 		}
 		else fprintf(stderr, "%s: DerivedMesh is needed to solve parenting, object position can be wrong now\n", __func__);
-
-		if(em)
-			BKE_mesh_end_editmesh(me, em);
 	}
 	else if (ELEM(par->type, OB_CURVE, OB_SURF)) {
 		Nurb *nu;
@@ -1767,12 +1825,12 @@ static void give_parvert(Object *par, int nr, float *vec)
 		nu= nurbs->first;
 
 		count= 0;
-		while(nu && !found) {
-			if(nu->type == CU_BEZIER) {
+		while (nu && !found) {
+			if (nu->type == CU_BEZIER) {
 				bezt= nu->bezt;
 				a= nu->pntsu;
-				while(a--) {
-					if(count==nr) {
+				while (a--) {
+					if (count==nr) {
 						found= 1;
 						copy_v3_v3(vec, bezt->vec[1]);
 						break;
@@ -1784,8 +1842,8 @@ static void give_parvert(Object *par, int nr, float *vec)
 			else {
 				bp= nu->bp;
 				a= nu->pntsu*nu->pntsv;
-				while(a--) {
-					if(count==nr) {
+				while (a--) {
+					if (count==nr) {
 						found= 1;
 						memcpy(vec, bp->vec, sizeof(float)*3);
 						break;
@@ -1798,27 +1856,27 @@ static void give_parvert(Object *par, int nr, float *vec)
 		}
 
 	}
-	else if(par->type==OB_LATTICE) {
+	else if (par->type==OB_LATTICE) {
 		Lattice *latt= par->data;
 		BPoint *bp;
 		DispList *dl = find_displist(&par->disp, DL_VERTS);
 		float *co = dl?dl->verts:NULL;
 		
-		if(latt->editlatt) latt= latt->editlatt->latt;
+		if (latt->editlatt) latt= latt->editlatt->latt;
 		
 		a= latt->pntsu*latt->pntsv*latt->pntsw;
 		count= 0;
 		bp= latt->def;
-		while(a--) {
-			if(count==nr) {
-				if(co)
+		while (a--) {
+			if (count==nr) {
+				if (co)
 					memcpy(vec, co, 3*sizeof(float));
 				else
 					memcpy(vec, bp->vec, 3*sizeof(float));
 				break;
 			}
 			count++;
-			if(co) co+= 3;
+			if (co) co+= 3;
 			else bp++;
 		}
 	}
@@ -1841,7 +1899,7 @@ static void ob_parvert3(Object *ob, Object *par, float mat[][4])
 		quat_to_mat3( cmat,q);
 		copy_m4_m3(mat, cmat);
 		
-		if(ob->type==OB_CURVE) {
+		if (ob->type==OB_CURVE) {
 			copy_v3_v3(mat[3], v1);
 		}
 		else {
@@ -1860,12 +1918,12 @@ static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[
 
 	// include framerate
 	fac1= ( 1.0f / (1.0f + fabsf(ob->sf)) );
-	if(fac1 >= 1.0f) return 0;
+	if (fac1 >= 1.0f) return 0;
 	fac2= 1.0f-fac1;
 
 	fp1= obmat[0];
 	fp2= slowmat[0];
-	for(a=0; a<16; a++, fp1++, fp2++) {
+	for (a=0; a<16; a++, fp1++, fp2++) {
 		fp1[0]= fac1*fp1[0] + fac2*fp2[0];
 	}
 
@@ -1881,21 +1939,21 @@ void where_is_object_time(Scene *scene, Object *ob, float ctime)
 	/* this one only calculates direct attached parent and track */
 	/* is faster, but should keep track of timeoffs */
 	
-	if(ob==NULL) return;
+	if (ob==NULL) return;
 	
 	/* execute drivers only, as animation has already been done */
 	BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, ctime, ADT_RECALC_DRIVERS);
 	
-	if(ob->parent) {
+	if (ob->parent) {
 		Object *par= ob->parent;
 		
 		/* hurms, code below conflicts with depgraph... (ton) */
 		/* and even worse, it gives bad effects for NLA stride too (try ctime != par->ctime, with MBlur) */
-		if(stime != par->ctime) {
+		if (stime != par->ctime) {
 			// only for ipo systems? 
 			Object tmp= *par;
 			
-			if(par->proxy_from);	// was a copied matrix, no where_is! bad...
+			if (par->proxy_from);	// was a copied matrix, no where_is! bad...
 			else where_is_object_time(scene, par, ctime);
 			
 			solve_parenting(scene, ob, par, ob->obmat, slowmat, 0);
@@ -1908,8 +1966,8 @@ void where_is_object_time(Scene *scene, Object *ob, float ctime)
 		/* "slow parent" is definitely not threadsafe, and may also give bad results jumping around 
 		 * An old-fashioned hack which probably doesn't really cut it anymore
 		 */
-		if(ob->partype & PARSLOW) {
-			if(!where_is_object_parslow(ob, ob->obmat, slowmat))
+		if (ob->partype & PARSLOW) {
+			if (!where_is_object_parslow(ob, ob->obmat, slowmat))
 				return;
 		}
 	}
@@ -1930,24 +1988,24 @@ void where_is_object_time(Scene *scene, Object *ob, float ctime)
 	}
 	
 	/* set negative scale flag in object */
-	if(is_negative_m4(ob->obmat))	ob->transflag |= OB_NEG_SCALE;
+	if (is_negative_m4(ob->obmat))	ob->transflag |= OB_NEG_SCALE;
 	else							ob->transflag &= ~OB_NEG_SCALE;
 }
 
 /* get object transformation matrix without recalculating dependencies and
-   constraints -- assume dependencies are already solved by depsgraph.
-   no changes to object and it's parent would be done.
-   used for bundles orientation in 3d space relative to parented blender camera */
+ * constraints -- assume dependencies are already solved by depsgraph.
+ * no changes to object and it's parent would be done.
+ * used for bundles orientation in 3d space relative to parented blender camera */
 void where_is_object_mat(Scene *scene, Object *ob, float obmat[4][4])
 {
 	float slowmat[4][4] = MAT4_UNITY;
 
-	if(ob->parent) {
+	if (ob->parent) {
 		Object *par= ob->parent;
 
 		solve_parenting(scene, ob, par, obmat, slowmat, 1);
 
-		if(ob->partype & PARSLOW)
+		if (ob->partype & PARSLOW)
 			where_is_object_parslow(ob, obmat, slowmat);
 	}
 	else {
@@ -1965,19 +2023,19 @@ static void solve_parenting (Scene *scene, Object *ob, Object *par, float obmat[
 	
 	object_to_mat4(ob, locmat);
 	
-	if(ob->partype & PARSLOW) copy_m4_m4(slowmat, obmat);
+	if (ob->partype & PARSLOW) copy_m4_m4(slowmat, obmat);
 
 	switch(ob->partype & PARTYPE) {
 	case PAROBJECT:
 		ok= 0;
-		if(par->type==OB_CURVE) {
-			if( ((Curve *)par->data)->flag & CU_PATH ) {
+		if (par->type==OB_CURVE) {
+			if ( ((Curve *)par->data)->flag & CU_PATH ) {
 				ob_parcurve(scene, ob, par, tmat);
 				ok= 1;
 			}
 		}
 		
-		if(ok) mul_serie_m4(totmat, par->obmat, tmat, 
+		if (ok) mul_serie_m4(totmat, par->obmat, tmat, 
 			NULL, NULL, NULL, NULL, NULL, NULL);
 		else copy_m4_m4(totmat, par->obmat);
 		
@@ -1990,10 +2048,10 @@ static void solve_parenting (Scene *scene, Object *ob, Object *par, float obmat[
 		
 	case PARVERT1:
 		unit_m4(totmat);
-		if (simul){
+		if (simul) {
 			copy_v3_v3(totmat[3], par->obmat[3]);
 		}
-		else{
+		else {
 			give_parvert(par, ob->par1, vec);
 			mul_v3_m4v3(totmat[3], par->obmat, vec);
 		}
@@ -2019,12 +2077,12 @@ static void solve_parenting (Scene *scene, Object *ob, Object *par, float obmat[
 	if (simul) {
 
 	}
-	else{
+	else {
 		// external usable originmat 
 		copy_m3_m4(originmat, tmat);
 		
 		// origin, voor help line
-		if( (ob->partype & PARTYPE)==PARSKEL ) {
+		if ( (ob->partype & PARTYPE)==PARSKEL ) {
 			copy_v3_v3(ob->orig, par->obmat[3]);
 		}
 		else {
@@ -2043,7 +2101,7 @@ void where_is_object(struct Scene *scene, Object *ob)
 void where_is_object_simul(Scene *scene, Object *ob)
 /* was written for the old game engine (until 2.04) */
 /* It seems that this function is only called
-for a lamp that is the child of another object */
+ * for a lamp that is the child of another object */
 {
 	Object *par;
 	float *fp1, *fp2;
@@ -2052,17 +2110,17 @@ for a lamp that is the child of another object */
 	int a;
 	
 	/* NO TIMEOFFS */
-	if(ob->parent) {
+	if (ob->parent) {
 		par= ob->parent;
 		
 		solve_parenting(scene, ob, par, ob->obmat, slowmat, 1);
 		
-		if(ob->partype & PARSLOW) {
+		if (ob->partype & PARSLOW) {
 			fac1= (float)(1.0/(1.0+ fabs(ob->sf)));
 			fac2= 1.0f-fac1;
 			fp1= ob->obmat[0];
 			fp2= slowmat[0];
-			for(a=0; a<16; a++, fp1++, fp2++) {
+			for (a=0; a<16; a++, fp1++, fp2++) {
 				fp1[0]= fac1*fp1[0] + fac2*fp2[0];
 			}
 		}
@@ -2134,13 +2192,13 @@ BoundBox *object_get_boundbox(Object *ob)
 {
 	BoundBox *bb= NULL;
 	
-	if(ob->type==OB_MESH) {
+	if (ob->type==OB_MESH) {
 		bb = mesh_get_bb(ob);
 	}
 	else if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
 		bb= ob->bb ? ob->bb : ( (Curve *)ob->data )->bb;
 	}
-	else if(ob->type==OB_MBALL) {
+	else if (ob->type==OB_MBALL) {
 		bb= ob->bb;
 	}
 	return bb;
@@ -2150,13 +2208,13 @@ BoundBox *object_get_boundbox(Object *ob)
 void object_boundbox_flag(Object *ob, int flag, int set)
 {
 	BoundBox *bb= object_get_boundbox(ob);
-	if(bb) {
-		if(set) bb->flag |= flag;
+	if (bb) {
+		if (set) bb->flag |= flag;
 		else bb->flag &= ~flag;
 	}
 }
 
-void object_get_dimensions(Object *ob, float *value)
+void object_get_dimensions(Object *ob, float vec[3])
 {
 	BoundBox *bb = NULL;
 	
@@ -2166,11 +2224,12 @@ void object_get_dimensions(Object *ob, float *value)
 		
 		mat4_to_size( scale,ob->obmat);
 		
-		value[0] = fabsf(scale[0]) * (bb->vec[4][0] - bb->vec[0][0]);
-		value[1] = fabsf(scale[1]) * (bb->vec[2][1] - bb->vec[0][1]);
-		value[2] = fabsf(scale[2]) * (bb->vec[1][2] - bb->vec[0][2]);
-	} else {
-		value[0] = value[1] = value[2] = 0.f;
+		vec[0] = fabsf(scale[0]) * (bb->vec[4][0] - bb->vec[0][0]);
+		vec[1] = fabsf(scale[1]) * (bb->vec[2][1] - bb->vec[0][1]);
+		vec[2] = fabsf(scale[2]) * (bb->vec[1][2] - bb->vec[0][2]);
+	}
+	else {
+		zero_v3(vec);
 	}
 }
 
@@ -2208,10 +2267,10 @@ void minmax_object(Object *ob, float min[3], float max[3])
 		{
 			Curve *cu= ob->data;
 
-			if(cu->bb==NULL) tex_space_curve(cu);
+			if (cu->bb==NULL) tex_space_curve(cu);
 			bb= *(cu->bb);
 
-			for(a=0; a<8; a++) {
+			for (a=0; a<8; a++) {
 				mul_m4_v3(ob->obmat, bb.vec[a]);
 				DO_MINMAX(bb.vec[a], min, max);
 			}
@@ -2224,9 +2283,9 @@ void minmax_object(Object *ob, float min[3], float max[3])
 			BPoint *bp= lt->def;
 			int u, v, w;
 
-			for(w=0; w<lt->pntsw; w++) {
-				for(v=0; v<lt->pntsv; v++) {
-					for(u=0; u<lt->pntsu; u++, bp++) {
+			for (w=0; w<lt->pntsw; w++) {
+				for (v=0; v<lt->pntsv; v++) {
+					for (u=0; u<lt->pntsu; u++, bp++) {
 						mul_v3_m4v3(vec, ob->obmat, bp->vec);
 						DO_MINMAX(vec, min, max);
 					}
@@ -2236,9 +2295,9 @@ void minmax_object(Object *ob, float min[3], float max[3])
 		}
 		break;
 	case OB_ARMATURE:
-		if(ob->pose) {
+		if (ob->pose) {
 			bPoseChannel *pchan;
-			for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+			for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
 				mul_v3_m4v3(vec, ob->obmat, pchan->pose_head);
 				DO_MINMAX(vec, min, max);
 				mul_v3_m4v3(vec, ob->obmat, pchan->pose_tail);
@@ -2251,10 +2310,10 @@ void minmax_object(Object *ob, float min[3], float max[3])
 		{
 			Mesh *me= get_mesh(ob);
 
-			if(me) {
+			if (me) {
 				bb = *mesh_get_bb(ob);
 
-				for(a=0; a<8; a++) {
+				for (a=0; a<8; a++) {
 					mul_m4_v3(ob->obmat, bb.vec[a]);
 					DO_MINMAX(bb.vec[a], min, max);
 				}
@@ -2264,7 +2323,7 @@ void minmax_object(Object *ob, float min[3], float max[3])
 		break;
 	}
 
-	if(change == FALSE) {
+	if (change == FALSE) {
 		DO_MINMAX(ob->obmat[3], min, max);
 
 		copy_v3_v3(vec, ob->obmat[3]);
@@ -2277,23 +2336,24 @@ void minmax_object(Object *ob, float min[3], float max[3])
 	}
 }
 
-int minmax_object_duplis(Scene *scene, Object *ob, float *min, float *max)
+int minmax_object_duplis(Scene *scene, Object *ob, float min[3], float max[3])
 {
 	int ok= 0;
 	if ((ob->transflag & OB_DUPLI)==0) {
 		return ok;
-	} else {
+	}
+	else {
 		ListBase *lb;
 		DupliObject *dob;
 		
 		lb= object_duplilist(scene, ob);
-		for(dob= lb->first; dob; dob= dob->next) {
-			if(dob->no_draw == 0) {
+		for (dob= lb->first; dob; dob= dob->next) {
+			if (dob->no_draw == 0) {
 				BoundBox *bb= object_get_boundbox(dob->ob);
 
-				if(bb) {
+				if (bb) {
 					int i;
-					for(i=0; i<8; i++) {
+					for (i=0; i<8; i++) {
 						float vec[3];
 						mul_v3_m4v3(vec, dob->mat, bb->vec[i]);
 						DO_MINMAX(vec, min, max);
@@ -2349,8 +2409,8 @@ void BKE_scene_foreach_display_point(
 	Base *base;
 	Object *ob;
 
-	for(base= FIRSTBASE; base; base = base->next) {
-		if(BASE_VISIBLE(v3d, base) && (base->flag & flag) == flag) {
+	for (base= FIRSTBASE; base; base = base->next) {
+		if (BASE_VISIBLE(v3d, base) && (base->flag & flag) == flag) {
 			ob= base->object;
 
 			if ((ob->transflag & OB_DUPLI)==0) {
@@ -2361,8 +2421,8 @@ void BKE_scene_foreach_display_point(
 				DupliObject *dob;
 
 				lb= object_duplilist(scene, ob);
-				for(dob= lb->first; dob; dob= dob->next) {
-					if(dob->no_draw == 0) {
+				for (dob= lb->first; dob; dob= dob->next) {
+					if (dob->no_draw == 0) {
 						BKE_object_foreach_display_point(dob->ob, dob->mat, func_cb, user_data);
 					}
 				}
@@ -2435,8 +2495,8 @@ void object_tfm_restore(Object *ob, void *obtfm_pt)
 int BKE_object_parent_loop_check(const Object *par, const Object *ob)
 {
 	/* test if 'ob' is a parent somewhere in par's parents */
-	if(par == NULL) return 0;
-	if(ob == par) return 1;
+	if (par == NULL) return 0;
+	if (ob == par) return 1;
 	return BKE_object_parent_loop_check(par->parent, ob);
 }
 
@@ -2449,38 +2509,38 @@ int BKE_object_parent_loop_check(const Object *par, const Object *ob)
 /* requires flags to be set! */
 void object_handle_update(Scene *scene, Object *ob)
 {
-	if(ob->recalc & OB_RECALC_ALL) {
+	if (ob->recalc & OB_RECALC_ALL) {
 		/* speed optimization for animation lookups */
-		if(ob->pose)
+		if (ob->pose)
 			make_pose_channels_hash(ob->pose);
 
-		if(ob->recalc & OB_RECALC_DATA) {
-			if(ob->type==OB_ARMATURE) {
+		if (ob->recalc & OB_RECALC_DATA) {
+			if (ob->type==OB_ARMATURE) {
 				/* this happens for reading old files and to match library armatures
-				   with poses we do it ahead of where_is_object to ensure animation
-				   is evaluated on the rebuilt pose, otherwise we get incorrect poses
-				   on file load */
-				if(ob->pose==NULL || (ob->pose->flag & POSE_RECALC))
+				 * with poses we do it ahead of where_is_object to ensure animation
+				 * is evaluated on the rebuilt pose, otherwise we get incorrect poses
+				 * on file load */
+				if (ob->pose==NULL || (ob->pose->flag & POSE_RECALC))
 					armature_rebuild_pose(ob, ob->data);
 			}
 		}
 
 		/* XXX new animsys warning: depsgraph tag OB_RECALC_DATA should not skip drivers, 
-		   which is only in where_is_object now */
+		 * which is only in where_is_object now */
 		// XXX: should this case be OB_RECALC_OB instead?
-		if(ob->recalc & OB_RECALC_ALL) {
+		if (ob->recalc & OB_RECALC_ALL) {
 			
-			if (G.f & G_DEBUG)
+			if (G.debug & G_DEBUG)
 				printf("recalcob %s\n", ob->id.name+2);
 			
 			/* handle proxy copy for target */
-			if(ob->id.lib && ob->proxy_from) {
+			if (ob->id.lib && ob->proxy_from) {
 				// printf("ob proxy copy, lib ob %s proxy %s\n", ob->id.name, ob->proxy_from->id.name);
-				if(ob->proxy_from->proxy_group) {/* transform proxy into group space */
+				if (ob->proxy_from->proxy_group) {/* transform proxy into group space */
 					Object *obg= ob->proxy_from->proxy_group;
 					invert_m4_m4(obg->imat, obg->obmat);
 					mult_m4_m4m4(ob->obmat, obg->imat, ob->proxy_from->obmat);
-					if(obg->dup_group) { /* should always be true */
+					if (obg->dup_group) { /* should always be true */
 						add_v3_v3(ob->obmat[3], obg->dup_group->dupli_ofs);
 					}
 				}
@@ -2491,17 +2551,17 @@ void object_handle_update(Scene *scene, Object *ob)
 				where_is_object(scene, ob);
 		}
 		
-		if(ob->recalc & OB_RECALC_DATA) {
+		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;
 			
-			if (G.f & G_DEBUG)
+			if (G.debug & G_DEBUG)
 				printf("recalcdata %s\n", ob->id.name+2);
 
-			if(adt) {
+			if (adt) {
 				/* evaluate drivers */
 				// XXX: for mesh types, should we push this to derivedmesh instead?
 				BKE_animsys_evaluate_animdata(scene, data_id, adt, ctime, ADT_RECALC_DRIVERS);
@@ -2512,29 +2572,31 @@ void object_handle_update(Scene *scene, Object *ob)
 			case OB_MESH:
 				{
 #if 0				// XXX, comment for 2.56a release, background wont set 'scene->customdata_mask'
-					EditMesh *em = (ob == scene->obedit)? BKE_mesh_get_editmesh(ob->data): NULL;
+					BMEditMesh *em = (ob == scene->obedit) ? BMEdit_FromObject(ob) : NULL;
 					BLI_assert((scene->customdata_mask & CD_MASK_BAREMESH) == CD_MASK_BAREMESH);
-					if(em) {
-						makeDerivedMesh(scene, ob, em,  scene->customdata_mask); /* was CD_MASK_BAREMESH */
-						BKE_mesh_end_editmesh(ob->data, em);
-					} else
-						makeDerivedMesh(scene, ob, NULL, scene->customdata_mask);
+					if (em) {
+						makeDerivedMesh(scene, ob, em,  scene->customdata_mask, 0); /* was CD_MASK_BAREMESH */
+					}
+					else {
+						makeDerivedMesh(scene, ob, NULL, scene->customdata_mask, 0);
+					}
 
 #else				/* ensure CD_MASK_BAREMESH for now */
-					EditMesh *em = (ob == scene->obedit)? BKE_mesh_get_editmesh(ob->data): NULL;
+					BMEditMesh *em = (ob == scene->obedit) ? BMEdit_FromObject(ob) : NULL;
 					uint64_t data_mask= scene->customdata_mask | ob->customdata_mask | CD_MASK_BAREMESH;
-					if(em) {
-						makeDerivedMesh(scene, ob, em,  data_mask); /* was CD_MASK_BAREMESH */
-						BKE_mesh_end_editmesh(ob->data, em);
-					} else
-						makeDerivedMesh(scene, ob, NULL, data_mask);
+					if (em) {
+						makeDerivedMesh(scene, ob, em,  data_mask, 0); /* was CD_MASK_BAREMESH */
+					}
+					else {
+						makeDerivedMesh(scene, ob, NULL, data_mask, 0);
+					}
 #endif
 
 				}
 				break;
 
 			case OB_ARMATURE:
-				if(ob->id.lib && ob->proxy_from) {
+				if (ob->id.lib && ob->proxy_from) {
 					// printf("pose proxy copy, lib ob %s proxy %s\n", ob->id.name, ob->proxy_from->id.name);
 					copy_pose_result(ob->pose, ob->proxy_from->pose);
 				}
@@ -2559,24 +2621,26 @@ void object_handle_update(Scene *scene, Object *ob)
 			}
 
 
-			if(ob->particlesystem.first) {
+			if (ob->particlesystem.first) {
 				ParticleSystem *tpsys, *psys;
 				DerivedMesh *dm;
 				ob->transflag &= ~OB_DUPLIPARTS;
 				
 				psys= ob->particlesystem.first;
-				while(psys) {
-					if(psys_check_enabled(ob, psys)) {
+				while (psys) {
+					if (psys_check_enabled(ob, psys)) {
 						/* check use of dupli objects here */
-						if(psys->part && (psys->part->draw_as == PART_DRAW_REND || G.rendering) &&
-							((psys->part->ren_as == PART_DRAW_OB && psys->part->dup_ob)
-							|| (psys->part->ren_as == PART_DRAW_GR && psys->part->dup_group)))
+						if (psys->part && (psys->part->draw_as == PART_DRAW_REND || G.rendering) &&
+						    ((psys->part->ren_as == PART_DRAW_OB && psys->part->dup_ob) ||
+						     (psys->part->ren_as == PART_DRAW_GR && psys->part->dup_group)))
+						{
 							ob->transflag |= OB_DUPLIPARTS;
+						}
 
 						particle_system_update(scene, ob, psys);
 						psys= psys->next;
 					}
-					else if(psys->flag & PSYS_DELETE) {
+					else if (psys->flag & PSYS_DELETE) {
 						tpsys=psys->next;
 						BLI_remlink(&ob->particlesystem, psys);
 						psys_free(ob,psys);
@@ -2586,14 +2650,14 @@ void object_handle_update(Scene *scene, Object *ob)
 						psys= psys->next;
 				}
 
-				if(G.rendering && ob->transflag & OB_DUPLIPARTS) {
+				if (G.rendering && ob->transflag & OB_DUPLIPARTS) {
 					/* 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 */
 					dm = mesh_create_derived_render(scene, ob, CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL);
 					dm->release(dm);
 
-					for(psys=ob->particlesystem.first; psys; psys=psys->next)
+					for (psys=ob->particlesystem.first; psys; psys=psys->next)
 						psys_get_modifier(ob, psys)->flag &= ~eParticleSystemFlag_psys_updated;
 				}
 			}
@@ -2601,12 +2665,14 @@ void object_handle_update(Scene *scene, Object *ob)
 			/* 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)
+			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) {
+				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 ?
 						MIN2(scene->physics_settings.quick_cache_step, pid->cache->step) :
@@ -2618,7 +2684,7 @@ void object_handle_update(Scene *scene, Object *ob)
 		}
 
 		/* the no-group proxy case, we call update */
-		if(ob->proxy && ob->proxy_group==NULL) {
+		if (ob->proxy && ob->proxy_group==NULL) {
 			/* set pointer in library proxy target, for copying, but restore it */
 			ob->proxy->proxy_from= ob;
 			// printf("call update, lib ob %s proxy %s\n", ob->proxy->id.name, ob->id.name);
@@ -2629,7 +2695,7 @@ void object_handle_update(Scene *scene, Object *ob)
 	}
 
 	/* the case when this is a group proxy, object_update is called in group.c */
-	if(ob->proxy) {
+	if (ob->proxy) {
 		ob->proxy->proxy_from= ob;
 		// printf("set proxy pointer for later group stuff %s\n", ob->id.name);
 	}
@@ -2639,23 +2705,24 @@ void object_sculpt_modifiers_changed(Object *ob)
 {
 	SculptSession *ss= ob->sculpt;
 
-	if(!ss->cache) {
+	if (!ss->cache) {
 		/* we free pbvh on changes, except during sculpt since it can't deal with
-		   changing PVBH node organization, we hope topology does not change in
-		   the meantime .. weak */
-		if(ss->pbvh) {
+		 * changing PVBH node organization, we hope topology does not change in
+		 * the meantime .. weak */
+		if (ss->pbvh) {
 				BLI_pbvh_free(ss->pbvh);
 				ss->pbvh= NULL;
 		}
 
 		free_sculptsession_deformMats(ob->sculpt);
-	} else {
+	}
+	else {
 		PBVHNode **nodes;
 		int n, totnode;
 
 		BLI_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
 
-		for(n = 0; n < totnode; n++)
+		for (n = 0; n < totnode; n++)
 			BLI_pbvh_node_mark_update(nodes[n]);
 
 		MEM_freeN(nodes);
@@ -2733,7 +2800,7 @@ int ray_hit_boundbox(struct BoundBox *bb, float ray_start[3], float ray_normal[3
 static int pc_cmp(void *a, void *b)
 {
 	LinkData *ad = a, *bd = b;
-	if(GET_INT_FROM_POINTER(ad->data) > GET_INT_FROM_POINTER(bd->data))
+	if (GET_INT_FROM_POINTER(ad->data) > GET_INT_FROM_POINTER(bd->data))
 		return 1;
 	else return 0;
 }
@@ -2745,11 +2812,11 @@ int object_insert_ptcache(Object *ob)
 
 	BLI_sortlist(&ob->pc_ids, pc_cmp);
 
-	for(link=ob->pc_ids.first, i = 0; link; link=link->next, i++) 
+	for (link=ob->pc_ids.first, i = 0; link; link=link->next, i++) 
 	{
 		int index = GET_INT_FROM_POINTER(link->data);
 
-		if(i < index)
+		if (i < index)
 			break;
 	}
 
@@ -2798,15 +2865,15 @@ static KeyBlock *insert_meshkey(Scene *scene, Object *ob, const char *name, int
 	KeyBlock *kb;
 	int newkey= 0;
 
-	if(key == NULL) {
+	if (key == NULL) {
 		key= me->key= add_key((ID *)me);
 		key->type= KEY_RELATIVE;
 		newkey= 1;
 	}
 
-	if(newkey || from_mix==FALSE) {
+	if (newkey || from_mix==FALSE) {
 		/* create from mesh */
-		kb= add_keyblock(key, name);
+		kb = add_keyblock_ctime(key, name, FALSE);
 		mesh_to_key(me, kb);
 	}
 	else {
@@ -2814,7 +2881,7 @@ static KeyBlock *insert_meshkey(Scene *scene, Object *ob, const char *name, int
 		float *data= do_ob_key(scene, ob);
 
 		/* create new block with prepared data */
-		kb= add_keyblock(key, name);
+		kb = add_keyblock_ctime(key, name, FALSE);
 		kb->data= data;
 		kb->totelem= me->totvert;
 	}
@@ -2829,14 +2896,14 @@ static KeyBlock *insert_lattkey(Scene *scene, Object *ob, const char *name, int
 	KeyBlock *kb;
 	int newkey= 0;
 
-	if(key==NULL) {
+	if (key==NULL) {
 		key= lt->key= add_key( (ID *)lt);
 		key->type= KEY_RELATIVE;
 		newkey= 1;
 	}
 
-	if(newkey || from_mix==FALSE) {
-		kb= add_keyblock(key, name);
+	if (newkey || from_mix==FALSE) {
+		kb = add_keyblock_ctime(key, name, FALSE);
 		if (!newkey) {
 			KeyBlock *basekb= (KeyBlock *)key->block.first;
 			kb->data= MEM_dupallocN(basekb->data);
@@ -2851,7 +2918,7 @@ static KeyBlock *insert_lattkey(Scene *scene, Object *ob, const char *name, int
 		float *data= do_ob_key(scene, ob);
 
 		/* create new block with prepared data */
-		kb= add_keyblock(key, name);
+		kb = add_keyblock_ctime(key, name, FALSE);
 		kb->totelem= lt->pntsu*lt->pntsv*lt->pntsw;
 		kb->data= data;
 	}
@@ -2867,15 +2934,15 @@ static KeyBlock *insert_curvekey(Scene *scene, Object *ob, const char *name, int
 	ListBase *lb= BKE_curve_nurbs(cu);
 	int newkey= 0;
 
-	if(key==NULL) {
+	if (key==NULL) {
 		key= cu->key= add_key( (ID *)cu);
 		key->type = KEY_RELATIVE;
 		newkey= 1;
 	}
 
-	if(newkey || from_mix==FALSE) {
+	if (newkey || from_mix==FALSE) {
 		/* create from curve */
-		kb= add_keyblock(key, name);
+		kb = add_keyblock_ctime(key, name, FALSE);
 		if (!newkey) {
 			KeyBlock *basekb= (KeyBlock *)key->block.first;
 			kb->data= MEM_dupallocN(basekb->data);
@@ -2890,7 +2957,7 @@ static KeyBlock *insert_curvekey(Scene *scene, Object *ob, const char *name, int
 		float *data= do_ob_key(scene, ob);
 
 		/* create new block with prepared data */
-		kb= add_keyblock(key, name);
+		kb = add_keyblock_ctime(key, name, FALSE);
 		kb->totelem= count_curveverts(lb);
 		kb->data= data;
 	}
@@ -2899,11 +2966,19 @@ static KeyBlock *insert_curvekey(Scene *scene, Object *ob, const char *name, int
 }
 
 KeyBlock *object_insert_shape_key(Scene *scene, Object *ob, const char *name, int from_mix)
-{
-	if(ob->type==OB_MESH)					 return insert_meshkey(scene, ob, name, from_mix);
-	else if ELEM(ob->type, OB_CURVE, OB_SURF)return insert_curvekey(scene, ob, name, from_mix);
-	else if(ob->type==OB_LATTICE)			 return insert_lattkey(scene, ob, name, from_mix);
-	else									 return NULL;
+{	
+	switch (ob->type) {
+		case OB_MESH:
+			return insert_meshkey(scene, ob, name, from_mix);
+		case OB_CURVE:
+		case OB_SURF:
+			return insert_curvekey(scene, ob, name, from_mix);
+		case OB_LATTICE:
+			return insert_lattkey(scene, ob, name, from_mix);
+		default:
+			return NULL;
+	}
+
 }
 
 /* most important if this is modified it should _always_ return True, in certain
@@ -2913,15 +2988,23 @@ int object_is_modified(Scene *scene, Object *ob)
 {
 	int flag= 0;
 
-	if(ob_get_key(ob)) {
+	if (ob_get_key(ob)) {
 		flag |= eModifierMode_Render;
 	}
 	else {
 		ModifierData *md;
 		/* cloth */
-		for(md=modifiers_getVirtualModifierList(ob); md && (flag != (eModifierMode_Render | eModifierMode_Realtime)); md=md->next) {
-			if((flag & eModifierMode_Render) == 0	&& modifier_isEnabled(scene, md, eModifierMode_Render))		flag |= eModifierMode_Render;
-			if((flag & eModifierMode_Realtime) == 0	&& modifier_isEnabled(scene, md, eModifierMode_Realtime))	flag |= eModifierMode_Realtime;
+		for (md=modifiers_getVirtualModifierList(ob);
+		     md && (flag != (eModifierMode_Render | eModifierMode_Realtime));
+		     md=md->next)
+		{
+			if ((flag & eModifierMode_Render) == 0	&& modifier_isEnabled(scene, md, eModifierMode_Render)) {
+				flag |= eModifierMode_Render;
+			}
+
+			if ((flag & eModifierMode_Realtime) == 0	&& modifier_isEnabled(scene, md, eModifierMode_Realtime)) {
+				flag |= eModifierMode_Realtime;
+			}
 		}
 	}
 
@@ -2931,24 +3014,24 @@ int object_is_modified(Scene *scene, Object *ob)
 static void copy_object__forwardModifierLinks(void *UNUSED(userData), Object *UNUSED(ob), ID **idpoin)
 {
 	/* this is copied from ID_NEW; it might be better to have a macro */
-	if(*idpoin && (*idpoin)->newid) *idpoin = (*idpoin)->newid;
+	if (*idpoin && (*idpoin)->newid) *idpoin = (*idpoin)->newid;
 }
 
 void object_relink(Object *ob)
 {
-	if(ob->id.lib)
+	if (ob->id.lib)
 		return;
 
 	relink_constraints(&ob->constraints);
-	if (ob->pose){
+	if (ob->pose) {
 		bPoseChannel *chan;
-		for (chan = ob->pose->chanbase.first; chan; chan=chan->next){
+		for (chan = ob->pose->chanbase.first; chan; chan=chan->next) {
 			relink_constraints(&chan->constraints);
 		}
 	}
 	modifiers_foreachIDLink(ob, copy_object__forwardModifierLinks, NULL);
 
-	if(ob->adt)
+	if (ob->adt)
 		BKE_relink_animdata(ob->adt);
 
 	ID_NEW(ob->parent);
@@ -2962,18 +3045,18 @@ MovieClip *object_get_movieclip(Scene *scene, Object *ob, int use_default)
 	MovieClip *clip= use_default ? scene->clip : NULL;
 	bConstraint *con= ob->constraints.first, *scon= NULL;
 
-	while(con){
-		if(con->type==CONSTRAINT_TYPE_CAMERASOLVER){
-			if(scon==NULL || (scon->flag&CONSTRAINT_OFF))
+	while (con) {
+		if (con->type==CONSTRAINT_TYPE_CAMERASOLVER) {
+			if (scon==NULL || (scon->flag&CONSTRAINT_OFF))
 				scon= con;
 		}
 
 		con= con->next;
 	}
 
-	if(scon) {
+	if (scon) {
 		bCameraSolverConstraint *solver= scon->data;
-		if((solver->flag&CAMERASOLVER_ACTIVECLIP)==0)
+		if ((solver->flag&CAMERASOLVER_ACTIVECLIP)==0)
 			clip= solver->clip;
 		else
 			clip= scene->clip;
diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c
index 15ce2e3..907de78 100644
--- a/source/blender/blenkernel/intern/ocean.c
+++ b/source/blender/blenkernel/intern/ocean.c
@@ -170,7 +170,7 @@ static float gaussRand (void)
 }
 
 /**
- * Som usefull functions
+ * Some useful functions
  * */
 MINLINE float lerp(float a,float b,float f)
 {
@@ -355,7 +355,8 @@ void BKE_ocean_eval_uv(struct Ocean *oc, struct OceanResult *ocr, float u,float
 		if (oc->_do_chop) {
 			ocr->disp[0] = BILERP(oc->_disp_x);
 			ocr->disp[2] = BILERP(oc->_disp_z);
-		} else {
+		}
+		else {
 			ocr->disp[0] = 0.0;
 			ocr->disp[2] = 0.0;
 		}
@@ -422,7 +423,7 @@ void BKE_ocean_eval_uv_catrom(struct Ocean *oc, struct OceanResult *ocr, float u
 	{
 		if (oc->_do_disp_y)
 		{
-			ocr->disp[1] = INTERP(oc->_disp_y) ;
+			ocr->disp[1] = INTERP(oc->_disp_y);
 		}
 		if (oc->_do_normals)
 		{
@@ -435,8 +436,7 @@ void BKE_ocean_eval_uv_catrom(struct Ocean *oc, struct OceanResult *ocr, float u
 			ocr->disp[0] = INTERP(oc->_disp_x);
 			ocr->disp[2] = INTERP(oc->_disp_z);
 		}
-		else
-		{
+		else {
 			ocr->disp[0] = 0.0;
 			ocr->disp[2] = 0.0;
 		}
@@ -479,8 +479,7 @@ void BKE_ocean_eval_ij(struct Ocean *oc, struct OceanResult *ocr, int i,int j)
 		ocr->disp[0] = oc->_disp_x[i*oc->_N+j];
 		ocr->disp[2] = oc->_disp_z[i*oc->_N+j];
 	}
-	else
-	{
+	else {
 		ocr->disp[0] = 0.0f;
 		ocr->disp[2] = 0.0f;
 	}
@@ -726,14 +725,14 @@ void BKE_simulate_ocean(struct Ocean *o, float t, float scale, float chop_amount
 				}
 				fftw_execute(o->_N_z_plan);
 
-			/*for ( i = 0 ; i  < o->_M ; ++i)
-			 {
-			 for ( j  = 0 ; j  < o->_N ; ++j)
-			 {
-			 o->_N_y[i*o->_N+j] = 1.0f/scale;
-			 }
-			 }
-			 (MEM01)*/
+#if 0
+				for ( i = 0 ; i  < o->_M ; ++i) {
+					for ( j  = 0 ; j  < o->_N ; ++j) {
+						o->_N_y[i*o->_N+j] = 1.0f/scale;
+					}
+				}
+				(MEM01)
+#endif
 			o->_N_y = 1.0f/scale;
 			}
 		} // section 8
@@ -762,7 +761,7 @@ static void set_height_normalize_factor(struct Ocean *oc)
 	{
 		for (j = 0; j < oc->_N; ++j)
 		{
-			if( max_h < fabsf(oc->_disp_y[i*oc->_N+j]))
+			if ( max_h < fabsf(oc->_disp_y[i*oc->_N+j]))
 			{
 				max_h = fabsf(oc->_disp_y[i*oc->_N+j]);
 			}
@@ -869,12 +868,12 @@ void BKE_init_ocean(struct Ocean* o, int M,int N, float Lx, float Lz, float V, f
 	o->_fft_in = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in");
 	o->_htilda = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_htilda");
 
-	if (o->_do_disp_y){
+	if (o->_do_disp_y) {
 		o->_disp_y = (double*) MEM_mallocN(o->_M * o->_N * sizeof(double), "ocean_disp_y");
 		o->_disp_y_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in, o->_disp_y, FFTW_ESTIMATE);
 	}
 
-	if (o->_do_normals){
+	if (o->_do_normals) {
 		o->_fft_in_nx = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in_nx");
 		o->_fft_in_nz = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in_nz");
 
@@ -886,7 +885,7 @@ void BKE_init_ocean(struct Ocean* o, int M,int N, float Lx, float Lz, float V, f
 		o->_N_z_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_nz, o->_N_z, FFTW_ESTIMATE);
 	}
 
-	if (o->_do_chop){
+	if (o->_do_chop) {
 		o->_fft_in_x = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in_x");
 		o->_fft_in_z = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in_z");
 
@@ -896,7 +895,7 @@ void BKE_init_ocean(struct Ocean* o, int M,int N, float Lx, float Lz, float V, f
 		o->_disp_x_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_x, o->_disp_x, FFTW_ESTIMATE);
 		o->_disp_z_plan = fftw_plan_dft_c2r_2d(o->_M,o->_N, o->_fft_in_z, o->_disp_z, FFTW_ESTIMATE);
 	}
-	if (o->_do_jacobian){
+	if (o->_do_jacobian) {
 		o->_fft_in_jxx = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in_jxx");
 		o->_fft_in_jzz = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in_jzz");
 		o->_fft_in_jxz = (fftw_complex*) MEM_mallocN(o->_M * (1+o->_N/2) * sizeof(fftw_complex), "ocean_fft_in_jxz");
@@ -918,7 +917,7 @@ void BKE_init_ocean(struct Ocean* o, int M,int N, float Lx, float Lz, float V, f
 
 void BKE_free_ocean_data(struct Ocean *oc)
 {
-	if(!oc) return;
+	if (!oc) return;
 
 	BLI_rw_mutex_lock(&oc->oceanmutex, THREAD_LOCK_WRITE);
 
@@ -965,7 +964,7 @@ void BKE_free_ocean_data(struct Ocean *oc)
 	if (oc->_fft_in)
 		MEM_freeN(oc->_fft_in);
 
-	/* check that ocean data has been initialised */
+	/* check that ocean data has been initialized */
 	if (oc->_htilda) {
 		MEM_freeN(oc->_htilda);
 		MEM_freeN(oc->_k);
@@ -980,7 +979,7 @@ void BKE_free_ocean_data(struct Ocean *oc)
 
 void BKE_free_ocean(struct Ocean *oc)
 {
-	if(!oc) return;
+	if (!oc) return;
 
 	BKE_free_ocean_data(oc);
 	BLI_rw_mutex_end(&oc->oceanmutex);
@@ -1174,18 +1173,18 @@ void BKE_simulate_ocean_cache(struct OceanCache *och, int frame)
 
 	cache_filename(string, och->bakepath, och->relbase, frame, CACHE_TYPE_DISPLACE);
 	och->ibufs_disp[f] = IMB_loadiffname(string, 0);
-	//if (och->ibufs_disp[f] == NULL) printf("error loading %s \n", string);
-	//else printf("loaded cache %s \n", string);
+	//if (och->ibufs_disp[f] == NULL) printf("error loading %s\n", string);
+	//else printf("loaded cache %s\n", string);
 
 	cache_filename(string, och->bakepath, och->relbase, frame, CACHE_TYPE_FOAM);
 	och->ibufs_foam[f] = IMB_loadiffname(string, 0);
-	//if (och->ibufs_foam[f] == NULL) printf("error loading %s \n", string);
-	//else printf("loaded cache %s \n", string);
+	//if (och->ibufs_foam[f] == NULL) printf("error loading %s\n", string);
+	//else printf("loaded cache %s\n", string);
 
 	cache_filename(string, och->bakepath, och->relbase, frame, CACHE_TYPE_NORMAL);
 	och->ibufs_norm[f] = IMB_loadiffname(string, 0);
-	//if (och->ibufs_norm[f] == NULL) printf("error loading %s \n", string);
-	//else printf("loaded cache %s \n", string);
+	//if (och->ibufs_norm[f] == NULL) printf("error loading %s\n", string);
+	//else printf("loaded cache %s\n", string);
 }
 
 
@@ -1260,12 +1259,12 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v
 					// break up the foam where height (Y) is low (wave valley),
 					// and X and Z displacement is greatest
 
-					/*
+#if 0
 					vec[0] = ocr.disp[0];
 					vec[1] = ocr.disp[2];
 					hor_stretch = len_v2(vec);
 					CLAMP(hor_stretch, 0.0, 1.0);
-					*/
+#endif
 
 					neg_disp = ocr.disp[1] < 0.0f ? 1.0f+ocr.disp[1] : 1.0f;
 					neg_disp = neg_disp < 0.0f ? 0.0f : neg_disp;
@@ -1301,18 +1300,18 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v
 
 		/* write the images */
 		cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_DISPLACE);
-		if(0 == BKE_write_ibuf(ibuf_disp, string, &imf))
+		if (0 == BKE_write_ibuf(ibuf_disp, string, &imf))
 			printf("Cannot save Displacement File Output to %s\n", string);
 
 		if (o->_do_jacobian) {
 			cache_filename(string, och->bakepath, och->relbase,  f, CACHE_TYPE_FOAM);
-			if(0 == BKE_write_ibuf(ibuf_foam, string, &imf))
+			if (0 == BKE_write_ibuf(ibuf_foam, string, &imf))
 				printf("Cannot save Foam File Output to %s\n", string);
 		}
 
 		if (o->_do_normals) {
 			cache_filename(string, och->bakepath,  och->relbase, f, CACHE_TYPE_NORMAL);
-			if(0 == BKE_write_ibuf(ibuf_normal, string, &imf))
+			if (0 == BKE_write_ibuf(ibuf_normal, string, &imf))
 				printf("Cannot save Normal File Output to %s\n", string);
 		}
 
@@ -1391,7 +1390,7 @@ void BKE_free_ocean_data(struct Ocean *UNUSED(oc))
 
 void BKE_free_ocean(struct Ocean *oc)
 {
-	if(!oc) return;
+	if (!oc) return;
 	MEM_freeN(oc);
 }
 
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index 2decc40..b55033b 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -87,7 +87,8 @@ int seekPackedFile(PackedFile *pf, int offset, int whence)
 		}
 		if (seek < 0) {
 			seek = 0;
-		} else if (seek > pf->size) {
+		}
+		else if (seek > pf->size) {
 			seek = pf->size;
 		}
 		pf->seek = seek;
@@ -110,12 +111,14 @@ int readPackedFile(PackedFile *pf, void *data, int size)
 
 		if (size > 0) {
 			memcpy(data, ((char *) pf->data) + pf->seek, size);
-		} else {
+		}
+		else {
 			size = 0;
 		}
 
 		pf->seek += size;
-	} else {
+	}
+	else {
 		size = -1;
 	}
 
@@ -130,16 +133,16 @@ int countPackedFiles(Main *bmain)
 	int count = 0;
 	
 	// let's check if there are packed files...
-	for(ima=bmain->image.first; ima; ima=ima->id.next)
-		if(ima->packedfile)
+	for (ima=bmain->image.first; ima; ima=ima->id.next)
+		if (ima->packedfile)
 			count++;
 
-	for(vf=bmain->vfont.first; vf; vf=vf->id.next)
-		if(vf->packedfile)
+	for (vf=bmain->vfont.first; vf; vf=vf->id.next)
+		if (vf->packedfile)
 			count++;
 
-	for(sound=bmain->sound.first; sound; sound=sound->id.next)
-		if(sound->packedfile)
+	for (sound=bmain->sound.first; sound; sound=sound->id.next)
+		if (sound->packedfile)
 			count++;
 
 	return count;
@@ -147,7 +150,7 @@ int countPackedFiles(Main *bmain)
 
 void freePackedFile(PackedFile *pf)
 {
-	if(pf) {
+	if (pf) {
 		MEM_freeN(pf->data);
 		MEM_freeN(pf);
 	}
@@ -173,7 +176,7 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename, const char
 	
 	/* render result has no filename and can be ignored
 	 * any other files with no name can be ignored too */
-	if(filename[0]=='\0')
+	if (filename[0]=='\0')
 		return NULL;
 
 	//XXX waitcursor(1);
@@ -186,17 +189,19 @@ PackedFile *newPackedFile(ReportList *reports, const char *filename, const char
 	// open the file
 	// and create a PackedFile structure
 
-	file= open(name, O_BINARY|O_RDONLY);
+	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);
-	} else {
+	}
+	else {
 		filelen = BLI_file_descriptor_size(file);
 
 		if (filelen == 0) {
 			// MEM_mallocN complains about MEM_mallocN(0, "bla");
 			// we don't care....
 			data = MEM_mallocN(1, "packFile");
-		} else {
+		}
+		else {
 			data = MEM_mallocN(filelen, "packFile");
 		}
 		if (read(file, data, filelen) == filelen) {
@@ -217,23 +222,23 @@ void packAll(Main *bmain, ReportList *reports)
 	VFont *vf;
 	bSound *sound;
 	
-	for(ima=bmain->image.first; ima; ima=ima->id.next) {
-		if(ima->packedfile == NULL && ima->id.lib==NULL) { 
-			if(ima->source==IMA_SRC_FILE) {
+	for (ima=bmain->image.first; ima; ima=ima->id.next) {
+		if (ima->packedfile == NULL && ima->id.lib==NULL) { 
+			if (ima->source==IMA_SRC_FILE) {
 				ima->packedfile = newPackedFile(reports, ima->name, ID_BLEND_PATH(bmain, &ima->id));
 			}
-			else if(ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) {
+			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);
 			}
 		}
 	}
 
-	for(vf=bmain->vfont.first; vf; vf=vf->id.next)
-		if(vf->packedfile == NULL && vf->id.lib==NULL && strcmp(vf->name, FO_BUILTIN_NAME) != 0)
+	for (vf=bmain->vfont.first; vf; vf=vf->id.next)
+		if (vf->packedfile == NULL && vf->id.lib==NULL && strcmp(vf->name, FO_BUILTIN_NAME) != 0)
 			vf->packedfile = newPackedFile(reports, vf->name, bmain->name);
 
-	for(sound=bmain->sound.first; sound; sound=sound->id.next)
-		if(sound->packedfile == NULL && sound->id.lib==NULL)
+	for (sound=bmain->sound.first; sound; sound=sound->id.next)
+		if (sound->packedfile == NULL && sound->id.lib==NULL)
 			sound->packedfile = newPackedFile(reports, sound->name, bmain->name);
 }
 
@@ -292,14 +297,15 @@ int writePackedFile(ReportList *reports, const char *filename, PackedFile *pf, i
 	// make sure the path to the file exists...
 	BLI_make_existing_file(name);
 	
-	file = open(name, O_BINARY + O_WRONLY + O_CREAT + O_TRUNC, 0666);
+	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);
 			ret_value = RET_ERROR;
 		}
 		close(file);
-	} else {
+	}
+	else {
 		BKE_reportf(reports, RPT_ERROR, "Error creating file: %s", name);
 		ret_value = RET_ERROR;
 	}
@@ -309,28 +315,27 @@ int writePackedFile(ReportList *reports, const char *filename, PackedFile *pf, i
 			if (BLI_rename(tempname, name) != 0) {
 				BKE_reportf(reports, RPT_ERROR, "Error restoring tempfile. Check files: '%s' '%s'", tempname, name);
 			}
-		} else {
+		}
+		else {
 			if (BLI_delete(tempname, 0, 0) != 0) {
 				BKE_reportf(reports, RPT_ERROR, "Error deleting '%s' (ignored)", tempname);
 			}
 		}
 	}
 	
-	if(guimode) {} //XXX waitcursor(0);
+	if (guimode) {} //XXX waitcursor(0);
 
 	return (ret_value);
 }
 	
-/* 
-
-This function compares a packed file to a 'real' file.
-It returns an integer indicating if:
-
-PF_EQUAL		- the packed file and original file are identical
-PF_DIFFERENT	- the packed file and original file differ
-PF_NOFILE		- the original file doens't exist
-
-*/
+/*
+ * This function compares a packed file to a 'real' file.
+ * It returns an integer indicating if:
+ *
+ * PF_EQUAL		- the packed file and original file are identical
+ * PF_DIFFERENT	- the packed file and original file differ
+ * PF_NOFILE	- the original file doens't exist
+ */
 
 int checkPackedFile(const char *filename, PackedFile *pf)
 {
@@ -344,15 +349,18 @@ int checkPackedFile(const char *filename, PackedFile *pf)
 	
 	if (stat(name, &st)) {
 		ret_val = PF_NOFILE;
-	} else if (st.st_size != pf->size) {
+	}
+	else if (st.st_size != pf->size) {
 		ret_val = PF_DIFFERS;
-	} else {
+	}
+	else {
 		// we'll have to compare the two...
 		
-		file = open(name, O_BINARY | O_RDONLY);
+		file = BLI_open(name, O_BINARY | O_RDONLY, 0);
 		if (file < 0) {
 			ret_val = PF_NOFILE;
-		} else {
+		}
+		else {
 			ret_val = PF_EQUAL;
 			
 			for (i = 0; i < pf->size; i += sizeof(buf)) {
@@ -365,7 +373,8 @@ int checkPackedFile(const char *filename, PackedFile *pf)
 					// read error ...
 					ret_val = PF_DIFFERS;
 					break;
-				} else {
+				}
+				else {
 					if (memcmp(buf, ((char *)pf->data) + i, len)) {
 						ret_val = PF_DIFFERS;
 						break;
@@ -380,14 +389,11 @@ int checkPackedFile(const char *filename, PackedFile *pf)
 	return(ret_val);
 }
 
-/*
-
-   unpackFile() looks at the existing files (abs_name, local_name) and a packed file.
-
-It returns a char *to the existing file name / new file name or NULL when
-there was an error or when the user desides to cancel the operation.
-
-*/
+/* unpackFile() looks at the existing files (abs_name, local_name) and a packed file.
+ *
+ * It returns a char *to the existing file name / new file name or NULL when
+ * there was an error or when the user decides to cancel the operation.
+ */
 
 char *unpackFile(ReportList *reports, const char *abs_name, const char *local_name, PackedFile *pf, int how)
 {
@@ -502,7 +508,7 @@ int unpackImage(ReportList *reports, Image *ima, int how)
 	char *newname;
 	int ret_value = RET_ERROR;
 	
-	if (ima != NULL) {
+	if (ima != NULL && ima->name[0]) {
 		BLI_strncpy(localname, ima->name, sizeof(localname));
 		BLI_splitdirstring(localname, fi);
 		BLI_snprintf(localname, sizeof(localname), "//textures/%s", fi);
@@ -527,16 +533,16 @@ void unpackAll(Main *bmain, ReportList *reports, int how)
 	VFont *vf;
 	bSound *sound;
 
-	for(ima=bmain->image.first; ima; ima=ima->id.next)
-		if(ima->packedfile)
+	for (ima=bmain->image.first; ima; ima=ima->id.next)
+		if (ima->packedfile)
 			unpackImage(reports, ima, how);
 
-	for(vf=bmain->vfont.first; vf; vf=vf->id.next)
-		if(vf->packedfile)
+	for (vf=bmain->vfont.first; vf; vf=vf->id.next)
+		if (vf->packedfile)
 			unpackVFont(reports, vf, how);
 
-	for(sound=bmain->sound.first; sound; sound=sound->id.next)
-		if(sound->packedfile)
+	for (sound=bmain->sound.first; sound; sound=sound->id.next)
+		if (sound->packedfile)
 			unpackSound(bmain, reports, sound, how);
 }
 
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 2b3f792..27f5f7d 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -33,15 +33,17 @@
 
 #include "DNA_object_types.h"
 #include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_brush_types.h"
 
+#include "BLI_bitmap.h"
 #include "BLI_utildefines.h"
 
-
 #include "BKE_brush.h"
 #include "BKE_library.h"
 #include "BKE_paint.h"
+#include "BKE_subsurf.h"
 
 #include <stdlib.h>
 #include <string.h>
@@ -53,10 +55,10 @@ const char PAINT_CURSOR_TEXTURE_PAINT[3] = {255, 255, 255};
 
 Paint *paint_get_active(Scene *sce)
 {
-	if(sce) {
+	if (sce) {
 		ToolSettings *ts = sce->toolsettings;
 		
-		if(sce->basact && sce->basact->object) {
+		if (sce->basact && sce->basact->object) {
 			switch(sce->basact->object->mode) {
 			case OB_MODE_SCULPT:
 				return &ts->sculpt->paint;
@@ -67,7 +69,7 @@ Paint *paint_get_active(Scene *sce)
 			case OB_MODE_TEXTURE_PAINT:
 				return &ts->imapaint.paint;
 			case OB_MODE_EDIT:
-				if(ts->use_uv_sculpt)
+				if (ts->use_uv_sculpt)
 					return &ts->uvsculpt->paint;
 				else
 					return &ts->imapaint.paint;
@@ -88,7 +90,7 @@ Brush *paint_brush(Paint *p)
 
 void paint_brush_set(Paint *p, Brush *br)
 {
-	if(p) {
+	if (p) {
 		id_us_min((ID *)p->brush);
 		id_us_plus((ID *)br);
 		p->brush= br;
@@ -123,7 +125,7 @@ void paint_init(Paint *p, const char col[3])
 
 	/* If there's no brush, create one */
 	brush = paint_brush(p);
-	if(brush == NULL)
+	if (brush == NULL)
 		brush= add_brush("Brush");
 	paint_brush_set(p, brush);
 
@@ -147,3 +149,26 @@ void copy_paint(Paint *src, Paint *tar)
 	tar->brush= src->brush;
 	id_us_plus((ID *)tar->brush);
 }
+
+/* returns non-zero if any of the face's vertices
+ * are hidden, zero otherwise */
+int paint_is_face_hidden(const MFace *f, const MVert *mvert)
+{
+	return ((mvert[f->v1].flag & ME_HIDE) ||
+			(mvert[f->v2].flag & ME_HIDE) ||
+			(mvert[f->v3].flag & ME_HIDE) ||
+			(f->v4 && (mvert[f->v4].flag & ME_HIDE)));
+}
+
+/* returns non-zero if any of the corners of the grid
+ * face whose inner corner is at (x,y) are hidden,
+ * zero otherwise */
+int paint_is_grid_face_hidden(const unsigned int *grid_hidden,
+							  int gridsize, int x, int y)
+{
+	/* skip face if any of its corners are hidden */
+	return (BLI_BITMAP_GET(grid_hidden, y * gridsize + x) ||
+			BLI_BITMAP_GET(grid_hidden, y * gridsize + x+1) ||
+			BLI_BITMAP_GET(grid_hidden, (y+1) * gridsize + x+1) ||
+			BLI_BITMAP_GET(grid_hidden, (y+1) * gridsize + x));
+}
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index f0b0584..a154a1f 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -97,8 +97,8 @@ int count_particles(ParticleSystem *psys)
 	int tot=0;
 
 	LOOP_SHOWN_PARTICLES {
-		if(pa->alive == PARS_UNBORN && (part->flag & PART_UNBORN)==0);
-		else if(pa->alive == PARS_DEAD && (part->flag & PART_DIED)==0);
+		if (pa->alive == PARS_UNBORN && (part->flag & PART_UNBORN)==0);
+		else if (pa->alive == PARS_DEAD && (part->flag & PART_DIED)==0);
 		else tot++;
 	}
 	return tot;
@@ -110,9 +110,9 @@ int count_particles_mod(ParticleSystem *psys, int totgr, int cur)
 	int tot=0;
 
 	LOOP_SHOWN_PARTICLES {
-		if(pa->alive == PARS_UNBORN && (part->flag & PART_UNBORN)==0);
-		else if(pa->alive == PARS_DEAD && (part->flag & PART_DIED)==0);
-		else if(p%totgr==cur) tot++;
+		if (pa->alive == PARS_UNBORN && (part->flag & PART_UNBORN)==0);
+		else if (pa->alive == PARS_DEAD && (part->flag & PART_DIED)==0);
+		else if (p%totgr==cur) tot++;
 	}
 	return tot;
 }
@@ -131,12 +131,12 @@ static ParticleCacheKey **psys_alloc_path_cache_buffers(ListBase *bufs, int tot,
 	totkey = 0;
 	cache = MEM_callocN(tot*sizeof(void*), "PathCacheArray");
 
-	while(totkey < tot) {
+	while (totkey < tot) {
 		totbufkey= MIN2(tot-totkey, PATH_CACHE_BUF_SIZE);
 		buf= MEM_callocN(sizeof(LinkData), "PathCacheLinkData");
 		buf->data= MEM_callocN(sizeof(ParticleCacheKey)*totbufkey*steps, "ParticleCacheKey");
 
-		for(i=0; i<totbufkey; i++)
+		for (i=0; i<totbufkey; i++)
 			cache[totkey+i] = ((ParticleCacheKey*)buf->data) + i*steps;
 
 		totkey += totbufkey;
@@ -150,10 +150,10 @@ static void psys_free_path_cache_buffers(ParticleCacheKey **cache, ListBase *buf
 {
 	LinkData *buf;
 
-	if(cache)
+	if (cache)
 		MEM_freeN(cache);
 
-	for(buf= bufs->first; buf; buf=buf->next)
+	for (buf= bufs->first; buf; buf=buf->next)
 		MEM_freeN(buf->data);
 	BLI_freelistN(bufs);
 }
@@ -165,10 +165,10 @@ static void psys_free_path_cache_buffers(ParticleCacheKey **cache, ListBase *buf
 ParticleSystem *psys_get_current(Object *ob)
 {
 	ParticleSystem *psys;
-	if(ob==NULL) return NULL;
+	if (ob==NULL) return NULL;
 
-	for(psys=ob->particlesystem.first; psys; psys=psys->next){
-		if(psys->flag & PSYS_CURRENT)
+	for (psys=ob->particlesystem.first; psys; psys=psys->next) {
+		if (psys->flag & PSYS_CURRENT)
 			return psys;
 	}
 	
@@ -179,10 +179,10 @@ short psys_get_current_num(Object *ob)
 	ParticleSystem *psys;
 	short i;
 
-	if(ob==NULL) return 0;
+	if (ob==NULL) return 0;
 
-	for(psys=ob->particlesystem.first, i=0; psys; psys=psys->next, i++)
-		if(psys->flag & PSYS_CURRENT)
+	for (psys=ob->particlesystem.first, i=0; psys; psys=psys->next, i++)
+		if (psys->flag & PSYS_CURRENT)
 			return i;
 	
 	return i;
@@ -192,45 +192,49 @@ void psys_set_current_num(Object *ob, int index)
 	ParticleSystem *psys;
 	short i;
 
-	if(ob==NULL) return;
+	if (ob==NULL) return;
 
-	for(psys=ob->particlesystem.first, i=0; psys; psys=psys->next, i++) {
-		if(i == index)
+	for (psys=ob->particlesystem.first, i=0; psys; psys=psys->next, i++) {
+		if (i == index)
 			psys->flag |= PSYS_CURRENT;
 		else
 			psys->flag &= ~PSYS_CURRENT;
 	}
 }
+
+#if 0 /* UNUSED */
 Object *psys_find_object(Scene *scene, ParticleSystem *psys)
 {
 	Base *base;
 	ParticleSystem *tpsys;
 
-	for(base = scene->base.first; base; base = base->next) {
-		for(tpsys = base->object->particlesystem.first; psys; psys=psys->next) {
-			if(tpsys == psys)
+	for (base = scene->base.first; base; base = base->next) {
+		for (tpsys = base->object->particlesystem.first; psys; psys=psys->next) {
+			if (tpsys == psys)
 				return base->object;
 		}
 	}
 
 	return NULL;
 }
+#endif
+
 Object *psys_get_lattice(ParticleSimulationData *sim)
 {
 	Object *lattice=NULL;
 	
-	if(psys_in_edit_mode(sim->scene, sim->psys)==0){
+	if (psys_in_edit_mode(sim->scene, sim->psys)==0) {
 
 		ModifierData *md = (ModifierData*)psys_get_modifier(sim->ob, sim->psys);
 
-		for(; md; md=md->next){
-			if(md->type==eModifierType_Lattice){
+		for (; md; md=md->next) {
+			if (md->type==eModifierType_Lattice) {
 				LatticeModifierData *lmd = (LatticeModifierData *)md;
 				lattice=lmd->object;
 				break;
 			}
 		}
-		if(lattice)
+		if (lattice)
 			init_latt_deform(lattice, NULL);
 	}
 
@@ -240,14 +244,14 @@ void psys_disable_all(Object *ob)
 {
 	ParticleSystem *psys=ob->particlesystem.first;
 
-	for(; psys; psys=psys->next)
+	for (; psys; psys=psys->next)
 		psys->flag |= PSYS_DISABLED;
 }
 void psys_enable_all(Object *ob)
 {
 	ParticleSystem *psys=ob->particlesystem.first;
 
-	for(; psys; psys=psys->next)
+	for (; psys; psys=psys->next)
 		psys->flag &= ~PSYS_DISABLED;
 }
 int psys_in_edit_mode(Scene *scene, ParticleSystem *psys)
@@ -261,28 +265,28 @@ static void psys_create_frand(ParticleSystem *psys)
 
 	BLI_srandom(psys->seed);
 
-	for(i=0; i<1024; i++, rand++)
+	for (i=0; i<1024; i++, rand++)
 		*rand = BLI_frand();
 }
 int psys_check_enabled(Object *ob, ParticleSystem *psys)
 {
 	ParticleSystemModifierData *psmd;
 
-	if(psys->flag & PSYS_DISABLED || psys->flag & PSYS_DELETE || !psys->part)
+	if (psys->flag & PSYS_DISABLED || psys->flag & PSYS_DELETE || !psys->part)
 		return 0;
 
 	psmd= psys_get_modifier(ob, psys);
-	if(psys->renderdata || G.rendering) {
-		if(!(psmd->modifier.mode & eModifierMode_Render))
+	if (psys->renderdata || G.rendering) {
+		if (!(psmd->modifier.mode & eModifierMode_Render))
 			return 0;
 	}
-	else if(!(psmd->modifier.mode & eModifierMode_Realtime))
+	else if (!(psmd->modifier.mode & eModifierMode_Realtime))
 		return 0;
 
 	/* perhaps not the perfect place, but we have to be sure the rands are there before usage */
-	if(!psys->frand)
+	if (!psys->frand)
 		psys_create_frand(psys);
-	else if(psys->recalc & PSYS_RECALC_RESET) {
+	else if (psys->recalc & PSYS_RECALC_RESET) {
 		MEM_freeN(psys->frand);
 		psys_create_frand(psys);
 	}
@@ -292,7 +296,7 @@ int psys_check_enabled(Object *ob, ParticleSystem *psys)
 
 int psys_check_edited(ParticleSystem *psys)
 {
-	if(psys->part && psys->part->type==PART_HAIR)
+	if (psys->part && psys->part->type==PART_HAIR)
 		return (psys->flag & PSYS_EDITED || (psys->edit && psys->edit->edited));
 	else
 		return (psys->pointcache->edit && psys->pointcache->edit->edited);
@@ -304,11 +308,11 @@ void psys_check_group_weights(ParticleSettings *part)
 	GroupObject *go;
 	int current = 0;
 
-	if(part->ren_as == PART_DRAW_GR && part->dup_group && part->dup_group->gobject.first) {
+	if (part->ren_as == PART_DRAW_GR && part->dup_group && part->dup_group->gobject.first) {
 		/* first remove all weights that don't have an object in the group */
 		dw = part->dupliweights.first;
-		while(dw) {
-			if(!object_in_group(dw->ob, part->dup_group)) {
+		while (dw) {
+			if (!object_in_group(dw->ob, part->dup_group)) {
 				tdw = dw->next;
 				BLI_freelinkN(&part->dupliweights, dw);
 				dw = tdw;
@@ -319,12 +323,12 @@ void psys_check_group_weights(ParticleSettings *part)
 
 		/* then add objects in the group to new list */
 		go = part->dup_group->gobject.first;
-		while(go) {
+		while (go) {
 			dw = part->dupliweights.first;
-			while(dw && dw->ob != go->ob)
+			while (dw && dw->ob != go->ob)
 				dw = dw->next;
 			
-			if(!dw) {
+			if (!dw) {
 				dw = MEM_callocN(sizeof(ParticleDupliWeight), "ParticleDupliWeight");
 				dw->ob = go->ob;
 				dw->count = 1;
@@ -335,16 +339,16 @@ void psys_check_group_weights(ParticleSettings *part)
 		}
 
 		dw = part->dupliweights.first;
-		for(; dw; dw=dw->next) {
-			if(dw->flag & PART_DUPLIW_CURRENT) {
+		for (; dw; dw=dw->next) {
+			if (dw->flag & PART_DUPLIW_CURRENT) {
 				current = 1;
 				break;
 			}
 		}
 
-		if(!current) {
+		if (!current) {
 			dw = part->dupliweights.first;
-			if(dw)
+			if (dw)
 				dw->flag |= PART_DUPLIW_CURRENT;
 		}
 	}
@@ -361,7 +365,7 @@ int psys_uses_gravity(ParticleSimulationData *sim)
 /************************************************/
 static void fluid_free_settings(SPHFluidSettings *fluid)
 {
-	if(fluid)
+	if (fluid)
 		MEM_freeN(fluid); 
 }
 
@@ -373,7 +377,7 @@ void psys_free_settings(ParticleSettings *part)
 	free_partdeflect(part->pd);
 	free_partdeflect(part->pd2);
 
-	if(part->effector_weights)
+	if (part->effector_weights)
 		MEM_freeN(part->effector_weights);
 
 	BLI_freelistN(&part->dupliweights);
@@ -381,10 +385,10 @@ void psys_free_settings(ParticleSettings *part)
 	boid_free_settings(part->boids);
 	fluid_free_settings(part->fluid);
 
-	for(a=0; a<MAX_MTEX; a++) {
+	for (a=0; a<MAX_MTEX; a++) {
 		mtex= part->mtex[a];
-		if(mtex && mtex->tex) mtex->tex->id.us--;
-		if(mtex) MEM_freeN(mtex);
+		if (mtex && mtex->tex) mtex->tex->id.us--;
+		if (mtex) MEM_freeN(mtex);
 	}
 }
 
@@ -393,7 +397,7 @@ void free_hair(Object *UNUSED(ob), ParticleSystem *psys, int dynamics)
 	PARTICLE_P;
 
 	LOOP_PARTICLES {
-		if(pa->hair)
+		if (pa->hair)
 			MEM_freeN(pa->hair);
 		pa->hair = NULL;
 		pa->totkey = 0;
@@ -401,8 +405,8 @@ void free_hair(Object *UNUSED(ob), ParticleSystem *psys, int dynamics)
 
 	psys->flag &= ~PSYS_HAIR_DONE;
 
-	if(psys->clmd) {
-		if(dynamics) {
+	if (psys->clmd) {
+		if (dynamics) {
 			BKE_ptcache_free_list(&psys->ptcaches);
 			psys->clmd->point_cache = psys->pointcache = NULL;
 			psys->clmd->ptcaches.first = psys->clmd->ptcaches.last = NULL;
@@ -417,11 +421,11 @@ void free_hair(Object *UNUSED(ob), ParticleSystem *psys, int dynamics)
 		}
 	}
 
-	if(psys->hair_in_dm)
+	if (psys->hair_in_dm)
 		psys->hair_in_dm->release(psys->hair_in_dm);
 	psys->hair_in_dm = NULL;
 
-	if(psys->hair_out_dm)
+	if (psys->hair_out_dm)
 		psys->hair_out_dm->release(psys->hair_out_dm);
 	psys->hair_out_dm = NULL;
 }
@@ -429,14 +433,14 @@ void free_keyed_keys(ParticleSystem *psys)
 {
 	PARTICLE_P;
 
-	if(psys->part->type == PART_HAIR)
+	if (psys->part->type == PART_HAIR)
 		return;
 
-	if(psys->particles && psys->particles->keys) {
+	if (psys->particles && psys->particles->keys) {
 		MEM_freeN(psys->particles->keys);
 
 		LOOP_PARTICLES {
-			if(pa->keys) {
+			if (pa->keys) {
 				pa->keys= NULL;
 				pa->totkey= 0;
 			}
@@ -451,12 +455,12 @@ static void free_child_path_cache(ParticleSystem *psys)
 }
 void psys_free_path_cache(ParticleSystem *psys, PTCacheEdit *edit)
 {
-	if(edit) {
+	if (edit) {
 		psys_free_path_cache_buffers(edit->pathcache, &edit->pathcachebufs);
 		edit->pathcache= NULL;
 		edit->totcached= 0;
 	}
-	if(psys) {
+	if (psys) {
 		psys_free_path_cache_buffers(psys->pathcache, &psys->pathcachebufs);
 		psys->pathcache= NULL;
 		psys->totcached= 0;
@@ -466,7 +470,7 @@ void psys_free_path_cache(ParticleSystem *psys, PTCacheEdit *edit)
 }
 void psys_free_children(ParticleSystem *psys)
 {
-	if(psys->child) {
+	if (psys->child) {
 		MEM_freeN(psys->child);
 		psys->child= NULL;
 		psys->totchild=0;
@@ -478,18 +482,18 @@ void psys_free_particles(ParticleSystem *psys)
 {
 	PARTICLE_P;
 
-	if(psys->particles) {
-		if(psys->part->type==PART_HAIR) {
+	if (psys->particles) {
+		if (psys->part->type==PART_HAIR) {
 			LOOP_PARTICLES {
-				if(pa->hair)
+				if (pa->hair)
 					MEM_freeN(pa->hair);
 			}
 		}
 		
-		if(psys->particles->keys)
+		if (psys->particles->keys)
 			MEM_freeN(psys->particles->keys);
 		
-		if(psys->particles->boid)
+		if (psys->particles->boid)
 			MEM_freeN(psys->particles->boid);
 
 		MEM_freeN(psys->particles);
@@ -499,20 +503,20 @@ void psys_free_particles(ParticleSystem *psys)
 }
 void psys_free_pdd(ParticleSystem *psys)
 {
-	if(psys->pdd) {
-		if(psys->pdd->cdata)
+	if (psys->pdd) {
+		if (psys->pdd->cdata)
 			MEM_freeN(psys->pdd->cdata);
 		psys->pdd->cdata = NULL;
 
-		if(psys->pdd->vdata)
+		if (psys->pdd->vdata)
 			MEM_freeN(psys->pdd->vdata);
 		psys->pdd->vdata = NULL;
 
-		if(psys->pdd->ndata)
+		if (psys->pdd->ndata)
 			MEM_freeN(psys->pdd->ndata);
 		psys->pdd->ndata = NULL;
 
-		if(psys->pdd->vedata)
+		if (psys->pdd->vedata)
 			MEM_freeN(psys->pdd->vedata);
 		psys->pdd->vedata = NULL;
 
@@ -523,7 +527,7 @@ void psys_free_pdd(ParticleSystem *psys)
 /* free everything */
 void psys_free(Object *ob, ParticleSystem * psys)
 {	
-	if(psys){
+	if (psys) {
 		int nr = 0;
 		ParticleSystem * tpsys;
 		
@@ -533,31 +537,29 @@ void psys_free(Object *ob, ParticleSystem * psys)
 
 		psys_free_particles(psys);
 
-		if(psys->edit && psys->free_edit)
+		if (psys->edit && psys->free_edit)
 			psys->free_edit(psys->edit);
 
-		if(psys->child){
+		if (psys->child) {
 			MEM_freeN(psys->child);
 			psys->child = NULL;
 			psys->totchild = 0;
 		}
 		
 		// check if we are last non-visible particle system
-		for(tpsys=ob->particlesystem.first; tpsys; tpsys=tpsys->next){
-			if(tpsys->part)
-			{
-				if(ELEM(tpsys->part->ren_as,PART_DRAW_OB,PART_DRAW_GR))
-				{
+		for (tpsys=ob->particlesystem.first; tpsys; tpsys=tpsys->next) {
+			if (tpsys->part) {
+				if (ELEM(tpsys->part->ren_as,PART_DRAW_OB,PART_DRAW_GR)) {
 					nr++;
 					break;
 				}
 			}
 		}
 		// clear do-not-draw-flag
-		if(!nr)
+		if (!nr)
 			ob->transflag &= ~OB_DUPLIPARTS;
 
-		if(psys->part){
+		if (psys->part) {
 			psys->part->id.us--;		
 			psys->part=NULL;
 		}
@@ -570,15 +572,15 @@ void psys_free(Object *ob, ParticleSystem * psys)
 		BLI_bvhtree_free(psys->bvhtree);
 		BLI_kdtree_free(psys->tree);
  
-		if(psys->fluid_springs)
+		if (psys->fluid_springs)
 			MEM_freeN(psys->fluid_springs);
 
 		pdEndEffectors(&psys->effectors);
 
-		if(psys->frand)
+		if (psys->frand)
 			MEM_freeN(psys->frand);
 
-		if(psys->pdd) {
+		if (psys->pdd) {
 			psys_free_pdd(psys);
 			MEM_freeN(psys->pdd);
 		}
@@ -650,7 +652,7 @@ static float psys_render_projected_area(ParticleSystem *psys, const float center
 
 	/* project point on screen */
 	mul_m4_v4(data->winmat, co);
-	if(co[3] != 0.0f) {
+	if (co[3] != 0.0f) {
 		co[0]= 0.5f*data->winx*(1.0f + co[0]/co[3]);
 		co[1]= 0.5f*data->winy*(1.0f + co[1]/co[3]);
 	}
@@ -661,14 +663,14 @@ static float psys_render_projected_area(ParticleSystem *psys, const float center
 	/* make smaller using fallof once over screen edge */
 	*viewport= 1.0f;
 
-	if(co[0]+radius < 0.0f)
+	if (co[0]+radius < 0.0f)
 		*viewport *= psys_render_viewport_falloff(vprate, -(co[0]+radius), data->winx);
-	else if(co[0]-radius > data->winx)
+	else if (co[0]-radius > data->winx)
 		*viewport *= psys_render_viewport_falloff(vprate, (co[0]-radius) - data->winx, data->winx);
 
-	if(co[1]+radius < 0.0f)
+	if (co[1]+radius < 0.0f)
 		*viewport *= psys_render_viewport_falloff(vprate, -(co[1]+radius), data->winy);
-	else if(co[1]-radius > data->winy)
+	else if (co[1]-radius > data->winy)
 		*viewport *= psys_render_viewport_falloff(vprate, (co[1]-radius) - data->winy, data->winy);
 	
 	return area;
@@ -679,9 +681,9 @@ void psys_render_set(Object *ob, ParticleSystem *psys, float viewmat[][4], float
 	ParticleRenderData*data;
 	ParticleSystemModifierData *psmd= psys_get_modifier(ob, psys);
 
-	if(!G.rendering)
+	if (!G.rendering)
 		return;
-	if(psys->renderdata)
+	if (psys->renderdata)
 		return;
 
 	data= MEM_callocN(sizeof(ParticleRenderData), "ParticleRenderData");
@@ -697,7 +699,7 @@ void psys_render_set(Object *ob, ParticleSystem *psys, float viewmat[][4], float
 	data->childcachebufs.last = psys->childcachebufs.last;
 	data->totchildcache= psys->totchildcache;
 
-	if(psmd->dm)
+	if (psmd->dm)
 		data->dm= CDDM_copy(psmd->dm);
 	data->totdmvert= psmd->totdmvert;
 	data->totdmedge= psmd->totdmedge;
@@ -721,7 +723,7 @@ void psys_render_set(Object *ob, ParticleSystem *psys, float viewmat[][4], float
 	psys->renderdata= data;
 
 	/* Hair can and has to be recalculated if everything isn't displayed. */
-	if(psys->part->disp != 100 && psys->part->type == PART_HAIR)
+	if (psys->part->disp != 100 && psys->part->type == PART_HAIR)
 		psys->recalc |= PSYS_RECALC_RESET;
 }
 
@@ -731,20 +733,20 @@ void psys_render_restore(Object *ob, ParticleSystem *psys)
 	ParticleSystemModifierData *psmd= psys_get_modifier(ob, psys);
 
 	data= psys->renderdata;
-	if(!data)
+	if (!data)
 		return;
 	
-	if(data->elems)
+	if (data->elems)
 		MEM_freeN(data->elems);
 
-	if(psmd->dm) {
+	if (psmd->dm) {
 		psmd->dm->needsFree= 1;
 		psmd->dm->release(psmd->dm);
 	}
 
 	psys_free_path_cache(psys, NULL);
 
-	if(psys->child){
+	if (psys->child) {
 		MEM_freeN(psys->child);
 		psys->child= 0;
 		psys->totchild= 0;
@@ -767,13 +769,15 @@ void psys_render_restore(Object *ob, ParticleSystem *psys)
 	psmd->totdmface= data->totdmface;
 	psmd->flag &= ~eParticleSystemFlag_psys_updated;
 
-	if(psmd->dm)
+	if (psmd->dm)
 		psys_calc_dmcache(ob, psmd->dm, psys);
 
 	MEM_freeN(data);
 	psys->renderdata= NULL;
 }
 
+/* BMESH_TODO, for orig face data, we need to use MPoly */
+
 int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
 {
 	DerivedMesh *dm= ctx->dm;
@@ -789,24 +793,24 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
 	int *origindex, *facetotvert;
 	int a, b, totorigface, totface, newtot, skipped;
 
-	if(part->ren_as!=PART_DRAW_PATH || !(part->draw & PART_DRAW_REN_STRAND))
+	if (part->ren_as!=PART_DRAW_PATH || !(part->draw & PART_DRAW_REN_STRAND))
 		return tot;
-	if(!ctx->sim.psys->renderdata)
+	if (!ctx->sim.psys->renderdata)
 		return tot;
 
 	data= ctx->sim.psys->renderdata;
-	if(data->timeoffset)
+	if (data->timeoffset)
 		return 0;
-	if(!(part->simplify_flag & PART_SIMPLIFY_ENABLE))
+	if (!(part->simplify_flag & PART_SIMPLIFY_ENABLE))
 		return tot;
 
 	mvert= dm->getVertArray(dm);
-	mface= dm->getFaceArray(dm);
-	origindex= dm->getFaceDataArray(dm, CD_ORIGINDEX);
-	totface= dm->getNumFaces(dm);
-	totorigface= me->totface;
+	mface= dm->getTessFaceArray(dm);
+	origindex= dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
+	totface= dm->getNumTessFaces(dm);
+	totorigface= me->totpoly;
 
-	if(totface == 0 || totorigface == 0)
+	if (totface == 0 || totorigface == 0)
 		return tot;
 
 	facearea= MEM_callocN(sizeof(float)*totorigface, "SimplifyFaceArea");
@@ -814,7 +818,7 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
 	facetotvert= MEM_callocN(sizeof(int)*totorigface, "SimplifyFaceArea");
 	elems= MEM_callocN(sizeof(ParticleRenderElem)*totorigface, "SimplifyFaceElem");
 
-	if(data->elems)
+	if (data->elems)
 		MEM_freeN(data->elems);
 
 	data->dosimplify= 1;
@@ -822,17 +826,17 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
 	data->origindex= origindex;
 
 	/* compute number of children per original face */
-	for(a=0; a<tot; a++) {
+	for (a=0; a<tot; a++) {
 		b= (origindex)? origindex[ctx->index[a]]: ctx->index[a];
-		if(b != -1)
+		if (b != -1)
 			elems[b].totchild++;
 	}
 
 	/* compute areas and centers of original faces */
-	for(mf=mface, a=0; a<totface; a++, mf++) {
+	for (mf=mface, a=0; a<totface; a++, mf++) {
 		b= (origindex)? origindex[a]: a;
 
-		if(b != -1) {
+		if (b != -1) {
 			copy_v3_v3(co1, mvert[mf->v1].co);
 			copy_v3_v3(co2, mvert[mf->v2].co);
 			copy_v3_v3(co3, mvert[mf->v3].co);
@@ -841,7 +845,7 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
 			add_v3_v3(facecenter[b], co2);
 			add_v3_v3(facecenter[b], co3);
 
-			if(mf->v4) {
+			if (mf->v4) {
 				copy_v3_v3(co4, mvert[mf->v4].co);
 				add_v3_v3(facecenter[b], co4);
 				facearea[b] += area_quad_v3(co1, co2, co3, co4);
@@ -854,8 +858,8 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
 		}
 	}
 
-	for(a=0; a<totorigface; a++)
-		if(facetotvert[a] > 0)
+	for (a=0; a<totorigface; a++)
+		if (facetotvert[a] > 0)
 			mul_v3_fl(facecenter[a], 1.0f/facetotvert[a]);
 
 	/* for conversion from BU area / pixel area to reference screen size */
@@ -864,17 +868,17 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
 	fac= fac*fac;
 
 	powrate= log(0.5f)/log(part->simplify_rate*0.5f);
-	if(part->simplify_flag & PART_SIMPLIFY_VIEWPORT)
+	if (part->simplify_flag & PART_SIMPLIFY_VIEWPORT)
 		vprate= pow(1.0f - part->simplify_viewport, 5.0);
 	else
 		vprate= 1.0;
 
 	/* set simplification parameters per original face */
-	for(a=0, elem=elems; a<totorigface; a++, elem++) {
+	for (a=0, elem=elems; a<totorigface; a++, elem++) {
 		area = psys_render_projected_area(ctx->sim.psys, facecenter[a], facearea[a], vprate, &viewport);
 		arearatio= fac*area/facearea[a];
 
-		if((arearatio < 1.0f || viewport < 1.0f) && elem->totchild) {
+		if ((arearatio < 1.0f || viewport < 1.0f) && elem->totchild) {
 			/* lambda is percentage of elements to keep */
 			lambda= (arearatio < 1.0f)? powf(arearatio, powrate): 1.0f;
 			lambda *= viewport;
@@ -900,7 +904,7 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
 
 			/* extend lambda to include transition */
 			lambda= lambda + elem->t;
-			if(lambda > 1.0f)
+			if (lambda > 1.0f)
 				lambda= 1.0f;
 		}
 		else {
@@ -925,10 +929,10 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
 	ctx->skip= MEM_callocN(sizeof(int)*tot, "SimplificationSkip");
 
 	skipped= 0;
-	for(a=0, newtot=0; a<tot; a++) {
+	for (a=0, newtot=0; a<tot; a++) {
 		b= (origindex)? origindex[ctx->index[a]]: ctx->index[a];
-		if(b != -1) {
-			if(elems[b].curchild++ < ceil(elems[b].lambda*elems[b].totchild)) {
+		if (b != -1) {
+			if (elems[b].curchild++ < ceil(elems[b].lambda*elems[b].totchild)) {
 				ctx->index[newtot]= ctx->index[a];
 				ctx->skip[newtot]= skipped;
 				skipped= 0;
@@ -939,7 +943,7 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot)
 		else skipped++;
 	}
 
-	for(a=0, elem=elems; a<totorigface; a++, elem++)
+	for (a=0, elem=elems; a<totorigface; a++, elem++)
 		elem->curchild= 0;
 
 	return newtot;
@@ -952,15 +956,15 @@ int psys_render_simplify_params(ParticleSystem *psys, ChildParticle *cpa, float
 	float x, w, scale, alpha, lambda, t, scalemin, scalemax;
 	int b;
 
-	if(!(psys->renderdata && (psys->part->simplify_flag & PART_SIMPLIFY_ENABLE)))
+	if (!(psys->renderdata && (psys->part->simplify_flag & PART_SIMPLIFY_ENABLE)))
 		return 0;
 	
 	data= psys->renderdata;
-	if(!data->dosimplify)
+	if (!data->dosimplify)
 		return 0;
 	
 	b= (data->origindex)? data->origindex[cpa->num]: cpa->num;
-	if(b == -1)
+	if (b == -1)
 		return 0;
 
 	elem= &data->elems[b];
@@ -970,17 +974,17 @@ int psys_render_simplify_params(ParticleSystem *psys, ChildParticle *cpa, float
 	scalemin= elem->scalemin;
 	scalemax= elem->scalemax;
 
-	if(!elem->reduce) {
+	if (!elem->reduce) {
 		scale= scalemin;
 		alpha= 1.0f;
 	}
 	else {
 		x= (elem->curchild+0.5f)/elem->totchild;
-		if(x < lambda-t) {
+		if (x < lambda-t) {
 			scale= scalemax;
 			alpha= 1.0f;
 		}
-		else if(x >= lambda+t) {
+		else if (x >= lambda+t) {
 			scale= scalemin;
 			alpha= 0.0f;
 		}
@@ -1007,7 +1011,7 @@ static float interpolate_particle_value(float v1, float v2, float v3, float v4,
 	float value;
 
 	value= w[0]*v1 + w[1]*v2 + w[2]*v3;
-	if(four)
+	if (four)
 		value += w[3]*v4;
 
 	CLAMP(value, 0.f, 1.f);
@@ -1019,7 +1023,7 @@ void psys_interpolate_particle(short type, ParticleKey keys[4], float dt, Partic
 {
 	float t[4];
 
-	if(type<0) {
+	if (type<0) {
 		interp_cubic_v3( result->co, result->vel,keys[1].co, keys[1].vel, keys[2].co, keys[2].vel, dt);
 	}
 	else {
@@ -1027,15 +1031,15 @@ void psys_interpolate_particle(short type, ParticleKey keys[4], float dt, Partic
 
 		interp_v3_v3v3v3v3(result->co, keys[0].co, keys[1].co, keys[2].co, keys[3].co, t);
 
-		if(velocity){
+		if (velocity) {
 			float temp[3];
 
-			if(dt>0.999f){
+			if (dt>0.999f) {
 				key_curve_position_weights(dt-0.001f, t, type);
 				interp_v3_v3v3v3v3(temp, keys[0].co, keys[1].co, keys[2].co, keys[3].co, t);
 				sub_v3_v3v3(result->vel, result->co, temp);
 			}
-			else{
+			else {
 				key_curve_position_weights(dt+0.001f, t, type);
 				interp_v3_v3v3v3v3(temp, keys[0].co, keys[1].co, keys[2].co, keys[3].co, t);
 				sub_v3_v3v3(result->vel, temp, result->co);
@@ -1071,15 +1075,15 @@ static void get_pointcache_keys_for_time(Object *UNUSED(ob), PointCache *cache,
 	static PTCacheMem *pm = NULL;
 	int index1, index2;
 
-	if(index < 0) { /* initialize */
+	if (index < 0) { /* initialize */
 		*cur = cache->mem_cache.first;
 
-		if(*cur)
+		if (*cur)
 			*cur = (*cur)->next;
 	}
 	else {
-		if(*cur) {
-			while(*cur && (*cur)->next && (float)(*cur)->frame < t)
+		if (*cur) {
+			while (*cur && (*cur)->next && (float)(*cur)->frame < t)
 				*cur = (*cur)->next;
 
 			pm = *cur;
@@ -1088,12 +1092,12 @@ static void get_pointcache_keys_for_time(Object *UNUSED(ob), PointCache *cache,
 			index1 = BKE_ptcache_mem_index_find(pm->prev, index);
 
 			BKE_ptcache_make_particle_key(key2, index2, pm->data, (float)pm->frame);
-			if(index1 < 0)
+			if (index1 < 0)
 				copy_particle_key(key1, key2, 1);
 			else
 				BKE_ptcache_make_particle_key(key1, index1, pm->prev->data, (float)pm->prev->frame);
 		}
-		else if(cache->mem_cache.first) {
+		else if (cache->mem_cache.first) {
 			pm = cache->mem_cache.first;
 			index2 = BKE_ptcache_mem_index_find(pm, index);
 			BKE_ptcache_make_particle_key(key2, index2, pm->data, (float)pm->frame);
@@ -1106,16 +1110,16 @@ static int get_pointcache_times_for_particle(PointCache *cache, int index, float
 	PTCacheMem *pm;
 	int ret = 0;
 
-	for(pm=cache->mem_cache.first; pm; pm=pm->next) {
-		if(BKE_ptcache_mem_index_find(pm, index) >= 0) {
+	for (pm=cache->mem_cache.first; pm; pm=pm->next) {
+		if (BKE_ptcache_mem_index_find(pm, index) >= 0) {
 			*start = pm->frame;
 			ret++;
 			break;
 		}
 	}
 
-	for(pm=cache->mem_cache.last; pm; pm=pm->prev) {
-		if(BKE_ptcache_mem_index_find(pm, index) >= 0) {
+	for (pm=cache->mem_cache.last; pm; pm=pm->prev) {
+		if (BKE_ptcache_mem_index_find(pm, index) >= 0) {
 			*end = pm->frame;
 			ret++;
 			break;
@@ -1130,8 +1134,8 @@ float psys_get_dietime_from_cache(PointCache *cache, int index)
 	PTCacheMem *pm;
 	int dietime = 10000000; /* some max value so that we can default to pa->time+lifetime */
 
-	for(pm=cache->mem_cache.last; pm; pm=pm->prev) {
-		if(BKE_ptcache_mem_index_find(pm, index) >= 0)
+	for (pm=cache->mem_cache.last; pm; pm=pm->prev) {
+		if (BKE_ptcache_mem_index_find(pm, index) >= 0)
 			return (float)pm->frame;
 	}
 
@@ -1141,7 +1145,7 @@ float psys_get_dietime_from_cache(PointCache *cache, int index)
 static void init_particle_interpolation(Object *ob, ParticleSystem *psys, ParticleData *pa, ParticleInterpolationData *pind)
 {
 
-	if(pind->epoint) {
+	if (pind->epoint) {
 		PTCacheEditPoint *point = pind->epoint;
 
 		pind->ekey[0] = point->keys;
@@ -1150,7 +1154,7 @@ static void init_particle_interpolation(Object *ob, ParticleSystem *psys, Partic
 		pind->birthtime = *(point->keys->time);
 		pind->dietime = *((point->keys + point->totkey - 1)->time);
 	}
-	else if(pind->keyed) {
+	else if (pind->keyed) {
 		ParticleKey *key = pa->keys;
 		pind->kkey[0] = key;
 		pind->kkey[1] = pa->totkey > 1 ? key + 1 : NULL;
@@ -1158,13 +1162,13 @@ static void init_particle_interpolation(Object *ob, ParticleSystem *psys, Partic
 		pind->birthtime = key->time;
 		pind->dietime = (key + pa->totkey - 1)->time;
 	}
-	else if(pind->cache) {
+	else if (pind->cache) {
 		float start=0.0f, end=0.0f;
 		get_pointcache_keys_for_time(ob, pind->cache, &pind->pm, -1, 0.0f, NULL, NULL);
 		pind->birthtime = pa ? pa->time : pind->cache->startframe;
 		pind->dietime = pa ? pa->dietime : pind->cache->endframe;
 
-		if(get_pointcache_times_for_particle(pind->cache, pa - psys->particles, &start, &end)) {
+		if (get_pointcache_times_for_particle(pind->cache, pa - psys->particles, &start, &end)) {
 			pind->birthtime = MAX2(pind->birthtime, start);
 			pind->dietime = MIN2(pind->dietime, end);
 		}
@@ -1177,7 +1181,7 @@ static void init_particle_interpolation(Object *ob, ParticleSystem *psys, Partic
 		pind->birthtime = key->time;
 		pind->dietime = (key + pa->totkey - 1)->time;
 
-		if(pind->dm) {
+		if (pind->dm) {
 			pind->mvert[0] = CDDM_get_vert(pind->dm, pa->hair_index);
 			pind->mvert[1] = pind->mvert[0] + 1;
 		}
@@ -1186,7 +1190,7 @@ static void init_particle_interpolation(Object *ob, ParticleSystem *psys, Partic
 static void edit_to_particle(ParticleKey *key, PTCacheEditKey *ekey)
 {
 	copy_v3_v3(key->co, ekey->co);
-	if(ekey->vel) {
+	if (ekey->vel) {
 		copy_v3_v3(key->vel, ekey->vel);
 	}
 	key->time = *(ekey->time);
@@ -1214,41 +1218,41 @@ static void do_particle_interpolation(ParticleSystem *psys, int p, ParticleData
 	memset(keys, 0, sizeof(keys));
 
 	/* interpret timing and find keys */
-	if(point) {
-		if(result->time < 0.0f)
+	if (point) {
+		if (result->time < 0.0f)
 			real_t = -result->time;
 		else
 			real_t = *(pind->ekey[0]->time) + t * (*(pind->ekey[0][point->totkey-1].time) - *(pind->ekey[0]->time));
 
-		while(*(pind->ekey[1]->time) < real_t)
+		while (*(pind->ekey[1]->time) < real_t)
 			pind->ekey[1]++;
 
 		pind->ekey[0] = pind->ekey[1] - 1;
 	}
-	else if(pind->keyed) {
+	else if (pind->keyed) {
 		/* we have only one key, so let's use that */
-		if(pind->kkey[1]==NULL) {
+		if (pind->kkey[1]==NULL) {
 			copy_particle_key(result, pind->kkey[0], 1);
 			return;
 		}
 
-		if(result->time < 0.0f)
+		if (result->time < 0.0f)
 			real_t = -result->time;
 		else
 			real_t = pind->kkey[0]->time + t * (pind->kkey[0][pa->totkey-1].time - pind->kkey[0]->time);
 
-		if(psys->part->phystype==PART_PHYS_KEYED && psys->flag & PSYS_KEYED_TIMING) {
+		if (psys->part->phystype==PART_PHYS_KEYED && psys->flag & PSYS_KEYED_TIMING) {
 			ParticleTarget *pt = psys->targets.first;
 
 			pt=pt->next;
 
-			while(pt && pa->time + pt->time < real_t)
+			while (pt && pa->time + pt->time < real_t)
 				pt= pt->next;
 
-			if(pt) {
+			if (pt) {
 				pt=pt->prev;
 
-				if(pa->time + pt->time + pt->duration > real_t)
+				if (pa->time + pt->time + pt->duration > real_t)
 					real_t = pa->time + pt->time;
 			}
 			else
@@ -1257,24 +1261,24 @@ static void do_particle_interpolation(ParticleSystem *psys, int p, ParticleData
 
 		CLAMP(real_t, pa->time, pa->dietime);
 
-		while(pind->kkey[1]->time < real_t)
+		while (pind->kkey[1]->time < real_t)
 			pind->kkey[1]++;
 		
 		pind->kkey[0] = pind->kkey[1] - 1;
 	}
-	else if(pind->cache) {
-		if(result->time < 0.0f) /* flag for time in frames */
+	else if (pind->cache) {
+		if (result->time < 0.0f) /* flag for time in frames */
 			real_t = -result->time;
 		else
 			real_t = pa->time + t * (pa->dietime - pa->time);
 	}
 	else {
-		if(result->time < 0.0f)
+		if (result->time < 0.0f)
 			real_t = -result->time;
 		else
 			real_t = pind->hkey[0]->time + t * (pind->hkey[0][pa->totkey-1].time - pind->hkey[0]->time);
 
-		while(pind->hkey[1]->time < real_t) {
+		while (pind->hkey[1]->time < real_t) {
 			pind->hkey[1]++;
 			pind->mvert[1]++;
 		}
@@ -1283,20 +1287,20 @@ static void do_particle_interpolation(ParticleSystem *psys, int p, ParticleData
 	}
 
 	/* set actual interpolation keys */
-	if(point) {
+	if (point) {
 		edit_to_particle(keys + 1, pind->ekey[0]);
 		edit_to_particle(keys + 2, pind->ekey[1]);
 	}
-	else if(pind->dm) {
+	else if (pind->dm) {
 		pind->mvert[0] = pind->mvert[1] - 1;
 		mvert_to_particle(keys + 1, pind->mvert[0], pind->hkey[0]);
 		mvert_to_particle(keys + 2, pind->mvert[1], pind->hkey[1]);
 	}
-	else if(pind->keyed) {
+	else if (pind->keyed) {
 		memcpy(keys + 1, pind->kkey[0], sizeof(ParticleKey));
 		memcpy(keys + 2, pind->kkey[1], sizeof(ParticleKey));
 	}
-	else if(pind->cache) {
+	else if (pind->cache) {
 		get_pointcache_keys_for_time(NULL, pind->cache, &pind->pm, p, real_t, keys+1, keys+2);
 	}
 	else {
@@ -1305,40 +1309,40 @@ static void do_particle_interpolation(ParticleSystem *psys, int p, ParticleData
 	}
 
 	/* set secondary interpolation keys for hair */
-	if(!pind->keyed && !pind->cache && !point_vel) {
-		if(point) {
-			if(pind->ekey[0] != point->keys)
+	if (!pind->keyed && !pind->cache && !point_vel) {
+		if (point) {
+			if (pind->ekey[0] != point->keys)
 				edit_to_particle(keys, pind->ekey[0] - 1);
 			else
 				edit_to_particle(keys, pind->ekey[0]);
 		}
-		else if(pind->dm) {
-			if(pind->hkey[0] != pa->hair)
+		else if (pind->dm) {
+			if (pind->hkey[0] != pa->hair)
 				mvert_to_particle(keys, pind->mvert[0] - 1, pind->hkey[0] - 1);
 			else
 				mvert_to_particle(keys, pind->mvert[0], pind->hkey[0]);
 		}
 		else {
-			if(pind->hkey[0] != pa->hair)
+			if (pind->hkey[0] != pa->hair)
 				hair_to_particle(keys, pind->hkey[0] - 1);
 			else
 				hair_to_particle(keys, pind->hkey[0]);
 		}
 
-		if(point) {
-			if(pind->ekey[1] != point->keys + point->totkey - 1)
+		if (point) {
+			if (pind->ekey[1] != point->keys + point->totkey - 1)
 				edit_to_particle(keys + 3, pind->ekey[1] + 1);
 			else
 				edit_to_particle(keys + 3, pind->ekey[1]);
 		}
-		else if(pind->dm) {
-			if(pind->hkey[1] != pa->hair + pa->totkey - 1)
+		else if (pind->dm) {
+			if (pind->hkey[1] != pa->hair + pa->totkey - 1)
 				mvert_to_particle(keys + 3, pind->mvert[1] + 1, pind->hkey[1] + 1);
 			else
 				mvert_to_particle(keys + 3, pind->mvert[1], pind->hkey[1]);
 		}
 		else {
-			if(pind->hkey[1] != pa->hair + pa->totkey - 1)
+			if (pind->hkey[1] != pa->hair + pa->totkey - 1)
 				hair_to_particle(keys + 3, pind->hkey[1] + 1);
 			else
 				hair_to_particle(keys + 3, pind->hkey[1]);
@@ -1349,7 +1353,7 @@ static void do_particle_interpolation(ParticleSystem *psys, int p, ParticleData
 	keytime = (real_t - keys[1].time) / dfra;
 
 	/* convert velocity to timestep size */
-	if(pind->keyed || pind->cache || point_vel){
+	if (pind->keyed || pind->cache || point_vel) {
 		invdt = dfra * 0.04f * (psys ? psys->part->timetweak : 1.f);
 		mul_v3_fl(keys[1].vel, invdt);
 		mul_v3_fl(keys[2].vel, invdt);
@@ -1362,7 +1366,7 @@ static void do_particle_interpolation(ParticleSystem *psys, int p, ParticleData
 		,keys, keytime, result, 1);
 
 	/* the velocity needs to be converted back from cubic interpolation */
-	if(pind->keyed || pind->cache || point_vel)
+	if (pind->keyed || pind->cache || point_vel)
 		mul_v3_fl(result->vel, 1.f/invdt);
 }
 
@@ -1374,10 +1378,10 @@ static void interpolate_pathcache(ParticleCacheKey *first, float t, ParticleCach
 	/* scale the requested time to fit the entire path even if the path is cut early */
 	t *= (first+first->steps)->time;
 
-	while(i<first->steps && cur->time < t)
+	while (i<first->steps && cur->time < t)
 		cur++;
 
-	if(cur->time == t)
+	if (cur->time == t)
 		*result = *cur;
 	else {
 		float dt = (t-(cur-1)->time)/(cur->time-(cur-1)->time);
@@ -1388,7 +1392,7 @@ static void interpolate_pathcache(ParticleCacheKey *first, float t, ParticleCach
 	}
 
 	/* first is actual base rotation, others are incremental from first */
-	if(cur==first || cur-1==first)
+	if (cur==first || cur-1==first)
 		copy_qt_qt(result->rot, first->rot);
 	else
 		mul_qt_qtqt(result->rot, first->rot, result->rot);
@@ -1416,14 +1420,14 @@ void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*or
 	normal_short_to_float_v3(n2, mvert[mface->v2].no);
 	normal_short_to_float_v3(n3, mvert[mface->v3].no);
 
-	if(mface->v4) {
+	if (mface->v4) {
 		v4= mvert[mface->v4].co;
 		normal_short_to_float_v3(n4, mvert[mface->v4].no);
 		
 		interp_v3_v3v3v3v3(vec, v1, v2, v3, v4, w);
 
-		if(nor){
-			if(mface->flag & ME_SMOOTH)
+		if (nor) {
+			if (mface->flag & ME_SMOOTH)
 				interp_v3_v3v3v3v3(nor, n1, n2, n3, n4, w);
 			else
 				normal_quad_v3(nor,v1,v2,v3,v4);
@@ -1432,8 +1436,8 @@ void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*or
 	else {
 		interp_v3_v3v3v3(vec, v1, v2, v3, w);
 
-		if(nor){
-			if(mface->flag & ME_SMOOTH)
+		if (nor) {
+			if (mface->flag & ME_SMOOTH)
 				interp_v3_v3v3v3(nor, n1, n2, n3, w);
 			else
 				normal_tri_v3(nor,v1,v2,v3);
@@ -1441,23 +1445,23 @@ void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*or
 	}
 	
 	/* calculate tangent vectors */
-	if(utan && vtan){
-		if(tface){
+	if (utan && vtan) {
+		if (tface) {
 			uv1= tface->uv[0];
 			uv2= tface->uv[1];
 			uv3= tface->uv[2];
 			uv4= tface->uv[3];
 		}
-		else{
+		else {
 			uv1= tuv[0]; uv2= tuv[1]; uv3= tuv[2]; uv4= tuv[3];
 			map_to_sphere( uv1, uv1+1,v1[0], v1[1], v1[2]);
 			map_to_sphere( uv2, uv2+1,v2[0], v2[1], v2[2]);
 			map_to_sphere( uv3, uv3+1,v3[0], v3[1], v3[2]);
-			if(v4)
+			if (v4)
 				map_to_sphere( uv4, uv4+1,v4[0], v4[1], v4[2]);
 		}
 
-		if(v4){
+		if (v4) {
 			s1= uv3[0] - uv1[0];
 			s2= uv4[0] - uv1[0];
 
@@ -1467,7 +1471,7 @@ void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*or
 			sub_v3_v3v3(e1, v3, v1);
 			sub_v3_v3v3(e2, v4, v1);
 		}
-		else{
+		else {
 			s1= uv2[0] - uv1[0];
 			s2= uv3[0] - uv1[0];
 
@@ -1487,30 +1491,30 @@ void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*or
 		utan[2] = (t1*e2[2] - t2*e1[2]);
 	}
 
-	if(orco) {
-		if(orcodata) {
+	if (orco) {
+		if (orcodata) {
 			o1= orcodata[mface->v1];
 			o2= orcodata[mface->v2];
 			o3= orcodata[mface->v3];
 
-			if(mface->v4) {
+			if (mface->v4) {
 				o4= orcodata[mface->v4];
 
 				interp_v3_v3v3v3v3(orco, o1, o2, o3, o4, w);
 
-				if(ornor)
+				if (ornor)
 					normal_quad_v3( ornor,o1, o2, o3, o4);
 			}
 			else {
 				interp_v3_v3v3v3(orco, o1, o2, o3, w);
 
-				if(ornor)
+				if (ornor)
 					normal_tri_v3( ornor,o1, o2, o3);
 			}
 		}
 		else {
 			copy_v3_v3(orco, vec);
-			if(ornor && nor)
+			if (ornor && nor)
 				copy_v3_v3(ornor, nor);
 		}
 	}
@@ -1525,7 +1529,7 @@ void psys_interpolate_uvs(const MTFace *tface, int quad, const float w[4], float
 	float v31= tface->uv[2][1];
 	float v40,v41;
 
-	if(quad) {
+	if (quad) {
 		v40= tface->uv[3][0];
 		v41= tface->uv[3][1];
 
@@ -1547,7 +1551,7 @@ void psys_interpolate_mcol(const MCol *mcol, int quad, const float w[4], MCol *m
 	cp2= (char *)&mcol[1];
 	cp3= (char *)&mcol[2];
 	
-	if(quad) {
+	if (quad) {
 		cp4= (char *)&mcol[3];
 
 		cp[0]= (int)(w[0]*cp1[0] + w[1]*cp2[0] + w[2]*cp3[0] + w[3]*cp4[0]);
@@ -1565,16 +1569,16 @@ void psys_interpolate_mcol(const MCol *mcol, int quad, const float w[4], MCol *m
 
 static float psys_interpolate_value_from_verts(DerivedMesh *dm, short from, int index, const float fw[4], const float *values)
 {
-	if(values==0 || index==-1)
+	if (values==0 || index==-1)
 		return 0.0;
 
-	switch(from){
+	switch(from) {
 		case PART_FROM_VERT:
 			return values[index];
 		case PART_FROM_FACE:
 		case PART_FROM_VOLUME:
 		{
-			MFace *mf=dm->getFaceData(dm,index,CD_MFACE);
+			MFace *mf=dm->getTessFaceData(dm,index,CD_MFACE);
 			return interpolate_particle_value(values[mf->v1],values[mf->v2],values[mf->v3],values[mf->v4],fw,mf->v4);
 		}
 			
@@ -1601,7 +1605,7 @@ static void psys_origspace_to_w(OrigSpaceFace *osface, int quad, const float w[4
 	psys_w_to_origspace(w, co);
 	co[2]= 0.0f;
 	
-	if(quad) {
+	if (quad) {
 		v[3][0]= osface->uv[3][0]; v[3][1]= osface->uv[3][1]; v[3][2]= 0.0f;
 		interp_weights_poly_v3(neww, v, 4, co);
 	}
@@ -1616,62 +1620,63 @@ static void psys_origspace_to_w(OrigSpaceFace *osface, int quad, const float w[4
 int psys_particle_dm_face_lookup(Object *ob, DerivedMesh *dm, int index, const float fw[4], struct LinkNode *node)
 {
 	Mesh *me= (Mesh*)ob->data;
-	MFace *mface;
+	MPoly *mpoly;
 	OrigSpaceFace *osface;
 	int *origindex;
 	int quad, findex, totface;
 	float uv[2], (*faceuv)[2];
 
-	mface = dm->getFaceDataArray(dm, CD_MFACE);
-	origindex = dm->getFaceDataArray(dm, CD_ORIGINDEX);
-	osface = dm->getFaceDataArray(dm, CD_ORIGSPACE);
+	mpoly = dm->getPolyArray(dm);
+	origindex = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
+	osface = dm->getTessFaceDataArray(dm, CD_ORIGSPACE);
 
-	totface = dm->getNumFaces(dm);
+	totface = dm->getNumTessFaces(dm);
 	
-	if(osface==NULL || origindex==NULL) {
-		/* Assume we dont need osface data */
+	if (osface==NULL || origindex==NULL) {
+		/* Assume we don't need osface data */
 		if (index <totface) {
 			//printf("\tNO CD_ORIGSPACE, assuming not needed\n");
 			return index;
-		} else {
+		}
+		else {
 			printf("\tNO CD_ORIGSPACE, error out of range\n");
 			return DMCACHE_NOTFOUND;
 		}
 	}
-	else if(index >= me->totface)
+	else if (index >= me->totpoly)
 		return DMCACHE_NOTFOUND; /* index not in the original mesh */
 
 	psys_w_to_origspace(fw, uv);
 	
-	if(node) { /* we have a linked list of faces that we use, faster! */
-		for(;node; node=node->next) {
+	if (node) { /* we have a linked list of faces that we use, faster! */
+		for (;node; node=node->next) {
 			findex= GET_INT_FROM_POINTER(node->link);
 			faceuv= osface[findex].uv;
-			quad= mface[findex].v4;
+			quad = (mpoly[findex].totloop == 4);
 
 			/* check that this intersects - Its possible this misses :/ -
 			 * could also check its not between */
-			if(quad) {
-				if(isect_point_quad_v2(uv, faceuv[0], faceuv[1], faceuv[2], faceuv[3]))
+			if (quad) {
+				if (isect_point_quad_v2(uv, faceuv[0], faceuv[1], faceuv[2], faceuv[3]))
 					return findex;
 			}
-			else if(isect_point_tri_v2(uv, faceuv[0], faceuv[1], faceuv[2]))
+			else if (isect_point_tri_v2(uv, faceuv[0], faceuv[1], faceuv[2]))
 				return findex;
 		}
 	}
 	else { /* if we have no node, try every face */
-		for(findex=0; findex<totface; findex++) {
-			if(origindex[findex] == index) {
+		for (findex=0; findex<totface; findex++) {
+			if (origindex[findex] == index) {
 				faceuv= osface[findex].uv;
-				quad= mface[findex].v4;
+				quad = (mpoly[findex].totloop == 4);
 
 				/* check that this intersects - Its possible this misses :/ -
 				 * could also check its not between */
-				if(quad) {
-					if(isect_point_quad_v2(uv, faceuv[0], faceuv[1], faceuv[2], faceuv[3]))
+				if (quad) {
+					if (isect_point_quad_v2(uv, faceuv[0], faceuv[1], faceuv[2], faceuv[3]))
 						return findex;
 				}
-				else if(isect_point_tri_v2(uv, faceuv[0], faceuv[1], faceuv[2]))
+				else if (isect_point_tri_v2(uv, faceuv[0], faceuv[1], faceuv[2]))
 					return findex;
 			}
 		}
@@ -1682,36 +1687,37 @@ int psys_particle_dm_face_lookup(Object *ob, DerivedMesh *dm, int index, const f
 
 static int psys_map_index_on_dm(DerivedMesh *dm, int from, int index, int index_dmcache, const float fw[4], float UNUSED(foffset), int *mapindex, float mapfw[4])
 {
-	if(index < 0)
+	if (index < 0)
 		return 0;
 
 	if (dm->deformedOnly || index_dmcache == DMCACHE_ISCHILD) {
 		/* for meshes that are either only defined or for child particles, the
 		 * index and fw do not require any mapping, so we can directly use it */
-		if(from == PART_FROM_VERT) {
-			if(index >= dm->getNumVerts(dm))
+		if (from == PART_FROM_VERT) {
+			if (index >= dm->getNumVerts(dm))
 				return 0;
 
 			*mapindex = index;
 		}
-		else  { /* FROM_FACE/FROM_VOLUME */
-			if(index >= dm->getNumFaces(dm))
+		else { /* FROM_FACE/FROM_VOLUME */
+			if (index >= dm->getNumTessFaces(dm))
 				return 0;
 
 			*mapindex = index;
 			copy_v4_v4(mapfw, fw);
 		}
-	} else {
+	}
+	else {
 		/* for other meshes that have been modified, we try to map the particle
 		 * to their new location, which means a different index, and for faces
 		 * also a new face interpolation weights */
-		if(from == PART_FROM_VERT) {
+		if (from == PART_FROM_VERT) {
 			if (index_dmcache == DMCACHE_NOTFOUND || index_dmcache > dm->getNumVerts(dm))
 				return 0;
 
 			*mapindex = index_dmcache;
 		}
-		else  { /* FROM_FACE/FROM_VOLUME */
+		else { /* FROM_FACE/FROM_VOLUME */
 			/* find a face on the derived mesh that uses this face */
 			MFace *mface;
 			OrigSpaceFace *osface;
@@ -1719,17 +1725,17 @@ static int psys_map_index_on_dm(DerivedMesh *dm, int from, int index, int index_
 
 			i = index_dmcache;
 
-			if(i== DMCACHE_NOTFOUND || i >= dm->getNumFaces(dm))
+			if (i== DMCACHE_NOTFOUND || i >= dm->getNumTessFaces(dm))
 				return 0;
 
 			*mapindex = i;
 
 			/* modify the original weights to become
 			 * weights for the derived mesh face */
-			osface= dm->getFaceDataArray(dm, CD_ORIGSPACE);
-			mface= dm->getFaceData(dm, i, CD_MFACE);
+			osface= dm->getTessFaceDataArray(dm, CD_ORIGSPACE);
+			mface= dm->getTessFaceData(dm, i, CD_MFACE);
 
-			if(osface == NULL)
+			if (osface == NULL)
 				mapfw[0]= mapfw[1]= mapfw[2]= mapfw[3]= 0.0f;
 			else
 				psys_origspace_to_w(&osface[i], mface->v4, fw, mapfw);
@@ -1746,36 +1752,36 @@ void psys_particle_on_dm(DerivedMesh *dm, int from, int index, int index_dmcache
 	float (*orcodata)[3];
 	int mapindex;
 
-	if(!psys_map_index_on_dm(dm, from, index, index_dmcache, fw, foffset, &mapindex, mapfw)) {
-		if(vec) { vec[0]=vec[1]=vec[2]=0.0; }
-		if(nor) { nor[0]=nor[1]=0.0; nor[2]=1.0; }
-		if(orco) { orco[0]=orco[1]=orco[2]=0.0; }
-		if(ornor) { ornor[0]=ornor[1]=0.0; ornor[2]=1.0; }
-		if(utan) { utan[0]=utan[1]=utan[2]=0.0; }
-		if(vtan) { vtan[0]=vtan[1]=vtan[2]=0.0; }
+	if (!psys_map_index_on_dm(dm, from, index, index_dmcache, fw, foffset, &mapindex, mapfw)) {
+		if (vec) { vec[0]=vec[1]=vec[2]=0.0; }
+		if (nor) { nor[0]=nor[1]=0.0; nor[2]=1.0; }
+		if (orco) { orco[0]=orco[1]=orco[2]=0.0; }
+		if (ornor) { ornor[0]=ornor[1]=0.0; ornor[2]=1.0; }
+		if (utan) { utan[0]=utan[1]=utan[2]=0.0; }
+		if (vtan) { vtan[0]=vtan[1]=vtan[2]=0.0; }
 
 		return;
 	}
 
 	orcodata= dm->getVertDataArray(dm, CD_ORCO);
 
-	if(from == PART_FROM_VERT) {
+	if (from == PART_FROM_VERT) {
 		dm->getVertCo(dm,mapindex,vec);
 
-		if(nor) {
+		if (nor) {
 			dm->getVertNo(dm,mapindex,nor);
 			normalize_v3(nor);
 		}
 
-		if(orco)
+		if (orco)
 			copy_v3_v3(orco, orcodata[mapindex]);
 
-		if(ornor) {
+		if (ornor) {
 			dm->getVertNo(dm,mapindex,nor);
 			normalize_v3(nor);
 		}
 
-		if(utan && vtan) {
+		if (utan && vtan) {
 			utan[0]= utan[1]= utan[2]= 0.0f;
 			vtan[0]= vtan[1]= vtan[2]= 0.0f;
 		}
@@ -1785,16 +1791,16 @@ void psys_particle_on_dm(DerivedMesh *dm, int from, int index, int index_dmcache
 		MTFace *mtface;
 		MVert *mvert;
 
-		mface=dm->getFaceData(dm,mapindex,CD_MFACE);
+		mface=dm->getTessFaceData(dm,mapindex,CD_MFACE);
 		mvert=dm->getVertDataArray(dm,CD_MVERT);
 		mtface=CustomData_get_layer(&dm->faceData,CD_MTFACE);
 
-		if(mtface)
+		if (mtface)
 			mtface += mapindex;
 
-		if(from==PART_FROM_VOLUME) {
+		if (from==PART_FROM_VOLUME) {
 			psys_interpolate_face(mvert,mface,mtface,orcodata,mapfw,vec,tmpnor,utan,vtan,orco,ornor);
-			if(nor)
+			if (nor)
 				copy_v3_v3(nor,tmpnor);
 
 			normalize_v3(tmpnor);
@@ -1811,7 +1817,7 @@ float psys_particle_value_from_verts(DerivedMesh *dm, short from, ParticleData *
 	float mapfw[4];
 	int mapindex;
 
-	if(!psys_map_index_on_dm(dm, from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, &mapindex, mapfw))
+	if (!psys_map_index_on_dm(dm, from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, &mapindex, mapfw))
 		return 0.0f;
 	
 	return psys_interpolate_value_from_verts(dm, from, mapindex, mapfw, values);
@@ -1822,10 +1828,10 @@ ParticleSystemModifierData *psys_get_modifier(Object *ob, ParticleSystem *psys)
 	ModifierData *md;
 	ParticleSystemModifierData *psmd;
 
-	for(md=ob->modifiers.first; md; md=md->next){
-		if(md->type==eModifierType_ParticleSystem){
+	for (md=ob->modifiers.first; md; md=md->next) {
+		if (md->type==eModifierType_ParticleSystem) {
 			psmd= (ParticleSystemModifierData*) md;
-			if(psmd->psys==psys){
+			if (psmd->psys==psys) {
 				return psmd;
 			}
 		}
@@ -1840,22 +1846,22 @@ static void psys_particle_on_shape(int UNUSED(distr), int UNUSED(index), float *
 {
 	/* TODO */
 	float zerovec[3]={0.0f,0.0f,0.0f};
-	if(vec){
+	if (vec) {
 		copy_v3_v3(vec,zerovec);
 	}
-	if(nor){
+	if (nor) {
 		copy_v3_v3(nor,zerovec);
 	}
-	if(utan){
+	if (utan) {
 		copy_v3_v3(utan,zerovec);
 	}
-	if(vtan){
+	if (vtan) {
 		copy_v3_v3(vtan,zerovec);
 	}
-	if(orco){
+	if (orco) {
 		copy_v3_v3(orco,zerovec);
 	}
-	if(ornor){
+	if (ornor) {
 		copy_v3_v3(ornor,zerovec);
 	}
 }
@@ -1864,12 +1870,12 @@ static void psys_particle_on_shape(int UNUSED(distr), int UNUSED(index), float *
 /************************************************/
 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)
 {
-	if(psmd){
-		if(psmd->psys->part->distr==PART_DISTR_GRID && psmd->psys->part->from != PART_FROM_VERT){
-			if(vec)
+	if (psmd) {
+		if (psmd->psys->part->distr==PART_DISTR_GRID && psmd->psys->part->from != PART_FROM_VERT) {
+			if (vec)
 				copy_v3_v3(vec,fuv);
 
-			if(orco)
+			if (orco)
 				copy_v3_v3(orco, fuv);
 			return;
 		}
@@ -1889,13 +1895,13 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
 	float kink[3]={1.f,0.f,0.f}, par_vec[3], q1[4]={1.f,0.f,0.f,0.f};
 	float t, dt=1.f, result[3];
 
-	if(par == NULL || type == PART_KINK_NO)
+	if (par == NULL || type == PART_KINK_NO)
 		return;
 
 	CLAMP(time, 0.f, 1.f);
 
-	if(shape!=0.0f && type!=PART_KINK_BRAID) {
-		if(shape<0.0f)
+	if (shape!=0.0f && type!=PART_KINK_BRAID) {
+		if (shape<0.0f)
 			time= (float)pow(time, 1.f+shape);
 		else
 			time= (float)pow(time, 1.f/(1.f-shape));
@@ -1903,22 +1909,22 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
 
 	t = time * freq *(float)M_PI;
 	
-	if(smooth_start) {
+	if (smooth_start) {
 		dt = fabs(t);
 		/* smooth the beginning of kink */
 		CLAMP(dt, 0.f, (float)M_PI);
 		dt = sin(dt/2.f);
 	}
 
-	if(type != PART_KINK_RADIAL) {
+	if (type != PART_KINK_RADIAL) {
 		float temp[3];
 
 		kink[axis]=1.f;
 
-		if(obmat)
+		if (obmat)
 			mul_mat3_m4_v3(obmat, kink);
 		
-		if(par_rot)
+		if (par_rot)
 			mul_qt_v3(par_rot, kink);
 
 		/* make sure kink is normal to strand */
@@ -1935,7 +1941,7 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
 	{
 		negate_v3(par_vec);
 
-		if(flat > 0.f) {
+		if (flat > 0.f) {
 			float proj[3];
 			project_v3_v3v3(proj, par_vec, par->vel);
 			madd_v3_v3fl(par_vec, proj, -flat);
@@ -1951,7 +1957,7 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
 		madd_v3_v3fl(par_vec, kink, amplitude);
 
 		/* rotate kink vector around strand tangent */
-		if(t!=0.f) {
+		if (t!=0.f) {
 			axis_angle_to_quat(q1, par->vel, t);
 			mul_qt_v3(q1, par_vec);
 		}
@@ -1961,7 +1967,7 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
 	}
 	case PART_KINK_RADIAL:
 	{
-		if(flat > 0.f) {
+		if (flat > 0.f) {
 			float proj[3];
 			/* flatten along strand */
 			project_v3_v3v3(proj, par_vec, par->vel);
@@ -1975,7 +1981,7 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
 	{
 		madd_v3_v3fl(result, kink, amplitude*(float)sin(t));
 
-		if(flat > 0.f) {
+		if (flat > 0.f) {
 			float proj[3];
 			/* flatten along wave */
 			project_v3_v3v3(proj, par_vec, kink);
@@ -1994,7 +2000,7 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
 		float vec_one[3], state_co[3];
 		float inp_y, inp_z, length;
 
-		if(par_rot) {
+		if (par_rot) {
 			mul_qt_v3(par_rot, y_vec);
 			mul_qt_v3(par_rot, z_vec);
 		}
@@ -2005,20 +2011,20 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
 		inp_y=dot_v3v3(y_vec, vec_one);
 		inp_z=dot_v3v3(z_vec, vec_one);
 
-		if(inp_y > 0.5f){
+		if (inp_y > 0.5f) {
 			copy_v3_v3(state_co, y_vec);
 
 			mul_v3_fl(y_vec, amplitude*(float)cos(t));
 			mul_v3_fl(z_vec, amplitude/2.f*(float)sin(2.f*t));
 		}
-		else if(inp_z > 0.0f){
+		else if (inp_z > 0.0f) {
 			mul_v3_v3fl(state_co, z_vec, (float)sin((float)M_PI/3.f));
 			madd_v3_v3fl(state_co, y_vec, -0.5f);
 
 			mul_v3_fl(y_vec, -amplitude * (float)cos(t + (float)M_PI/3.f));
 			mul_v3_fl(z_vec, amplitude/2.f * (float)cos(2.f*t + (float)M_PI/6.f));
 		}
-		else{
+		else {
 			mul_v3_v3fl(state_co, z_vec, -(float)sin((float)M_PI/3.f));
 			madd_v3_v3fl(state_co, y_vec, -0.5f);
 
@@ -2039,12 +2045,12 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
 
 		shape = 2.f*(float)M_PI * (1.f+shape);
 
-		if(t<shape){
+		if (t<shape) {
 			shape = t/shape;
 			shape = (float)sqrt((double)shape);
 			interp_v3_v3v3(result, result, state_co, shape);
 		}
-		else{
+		else {
 			copy_v3_v3(result, state_co);
 		}
 		break;
@@ -2052,7 +2058,7 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float
 	}
 
 	/* blend the start of the kink */
-	if(dt < 1.f)
+	if (dt < 1.f)
 		interp_v3_v3v3(state->co, state->co, result, dt);
 	else
 		copy_v3_v3(state->co, result);
@@ -2062,15 +2068,15 @@ static float do_clump(ParticleKey *state, ParticleKey *par, float time, float cl
 {
 	float clump = 0.f;
 
-	if(par && clumpfac!=0.0f){
+	if (par && clumpfac!=0.0f) {
 		float cpow;
 
-		if(clumppow < 0.0f)
+		if (clumppow < 0.0f)
 			cpow=1.0f+clumppow;
 		else
 			cpow=1.0f+9.0f*clumppow;
 
-		if(clumpfac < 0.0f) /* clump roots instead of tips */
+		if (clumpfac < 0.0f) /* clump roots instead of tips */
 			clump = -clumpfac*pa_clump*(float)pow(1.0-(double)time,(double)cpow);
 		else
 			clump = clumpfac*pa_clump*(float)pow((double)time,(double)cpow);
@@ -2091,7 +2097,7 @@ void precalc_guides(ParticleSimulationData *sim, ListBase *effectors)
 	GuideEffectorData *data;
 	PARTICLE_P;
 
-	if(!effectors)
+	if (!effectors)
 		return;
 
 	LOOP_PARTICLES {
@@ -2102,11 +2108,11 @@ void precalc_guides(ParticleSimulationData *sim, ListBase *effectors)
 		
 		pd_point_from_particle(sim, pa, &state, &point);
 
-		for(eff = effectors->first; eff; eff=eff->next) {
-			if(eff->pd->forcefield != PFIELD_GUIDE)
+		for (eff = effectors->first; eff; eff=eff->next) {
+			if (eff->pd->forcefield != PFIELD_GUIDE)
 				continue;
 
-			if(!eff->guide_data)
+			if (!eff->guide_data)
 				eff->guide_data = MEM_callocN(sizeof(GuideEffectorData)*psys->totpart, "GuideEffectorData");
 
 			data = eff->guide_data + p;
@@ -2133,30 +2139,30 @@ int do_guides(ListBase *effectors, ParticleKey *state, int index, float time)
 	float guidetime, radius, weight, angle, totstrength = 0.0f;
 	float vec_to_point[3];
 
-	if(effectors) for(eff = effectors->first; eff; eff=eff->next) {
+	if (effectors) for (eff = effectors->first; eff; eff=eff->next) {
 		pd = eff->pd;
 
-		if(pd->forcefield != PFIELD_GUIDE)
+		if (pd->forcefield != PFIELD_GUIDE)
 			continue;
 
 		data = eff->guide_data + index;
 
-		if(data->strength <= 0.0f)
+		if (data->strength <= 0.0f)
 			continue;
 
 		guidetime = time / (1.0f - pd->free_end);
 
-		if(guidetime>1.0f)
+		if (guidetime>1.0f)
 			continue;
 
 		cu = (Curve*)eff->ob->data;
 
-		if(pd->flag & PFIELD_GUIDE_PATH_ADD) {
-			if(where_on_path(eff->ob, data->strength * guidetime, guidevec, guidedir, NULL, &radius, &weight)==0)
+		if (pd->flag & PFIELD_GUIDE_PATH_ADD) {
+			if (where_on_path(eff->ob, data->strength * guidetime, guidevec, guidedir, NULL, &radius, &weight)==0)
 				return 0;
 		}
 		else {
-			if(where_on_path(eff->ob, guidetime, guidevec, guidedir, NULL, &radius, &weight)==0)
+			if (where_on_path(eff->ob, guidetime, guidevec, guidedir, NULL, &radius, &weight)==0)
 				return 0;
 		}
 
@@ -2167,7 +2173,7 @@ int do_guides(ListBase *effectors, ParticleKey *state, int index, float time)
 
 		copy_v3_v3(vec_to_point, data->vec_to_point);
 
-		if(guidetime != 0.0f) {
+		if (guidetime != 0.0f) {
 			/* curve direction */
 			cross_v3_v3v3(temp, eff->guide_dir, guidedir);
 			angle = dot_v3v3(eff->guide_dir, guidedir)/(len_v3(eff->guide_dir));
@@ -2181,11 +2187,11 @@ int do_guides(ListBase *effectors, ParticleKey *state, int index, float time)
 		}
 
 		/* curve taper */
-		if(cu->taperobj)
+		if (cu->taperobj)
 			mul_v3_fl(vec_to_point, calc_taper(eff->scene, cu->taperobj, (int)(data->strength*guidetime*100.0f), 100));
 
-		else{ /* curve size*/
-			if(cu->flag & CU_PATH_RADIUS) {
+		else { /* curve size*/
+			if (cu->flag & CU_PATH_RADIUS) {
 				mul_v3_fl(vec_to_point, radius);
 			}
 		}
@@ -2202,12 +2208,12 @@ int do_guides(ListBase *effectors, ParticleKey *state, int index, float time)
 		madd_v3_v3fl(veffect, guidedir, data->strength);
 		totstrength += data->strength;
 
-		if(pd->flag & PFIELD_GUIDE_PATH_WEIGHT)
+		if (pd->flag & PFIELD_GUIDE_PATH_WEIGHT)
 			totstrength *= weight;
 	}
 
-	if(totstrength != 0.0f){
-		if(totstrength > 1.0f)
+	if (totstrength != 0.0f) {
+		if (totstrength > 1.0f)
 			mul_v3_fl(effect, 1.0f / totstrength);
 		CLAMP(totstrength, 0.0f, 1.0f);
 		//add_v3_v3(effect,pa_zero);
@@ -2225,8 +2231,8 @@ static void do_rough(float *loc, float mat[4][4], float t, float fac, float size
 	float rough[3];
 	float rco[3];
 
-	if(thres != 0.0f)
-		if((float)fabs((float)(-1.5f+loc[0]+loc[1]+loc[2]))<1.5f*thres) return;
+	if (thres != 0.0f)
+		if ((float)fabs((float)(-1.5f+loc[0]+loc[1]+loc[2]))<1.5f*thres) return;
 
 	copy_v3_v3(rco,loc);
 	mul_v3_fl(rco,t);
@@ -2259,7 +2265,7 @@ static void do_path_effectors(ParticleSimulationData *sim, int i, ParticleCacheK
 	EffectedPoint epoint;
 
 	/* Don't apply effectors for dynamic hair, otherwise the effectors don't get applied twice. */
-	if(sim->psys->flag & PSYS_HAIR_DYNAMICS)
+	if (sim->psys->flag & PSYS_HAIR_DYNAMICS)
 		return;
 
 	copy_v3_v3(eff_key.co,(ca-1)->co);
@@ -2275,17 +2281,17 @@ static void do_path_effectors(ParticleSimulationData *sim, int i, ParticleCacheK
 
 	normalize_v3(force);
 
-	if(k < steps)
+	if (k < steps)
 		sub_v3_v3v3(vec, (ca+1)->co, ca->co);
 
 	madd_v3_v3v3fl(ca->co, (ca-1)->co, force, *length);
 
-	if(k < steps)
+	if (k < steps)
 		*length = len_v3(vec);
 }
 static int check_path_length(int k, ParticleCacheKey *keys, ParticleCacheKey *state, float max_length, float *cur_length, float length, float *dvec)
 {
-	if(*cur_length + length > max_length){
+	if (*cur_length + length > max_length) {
 		mul_v3_fl(dvec, (max_length - *cur_length) / length);
 		add_v3_v3v3(state->co, (state - 1)->co, dvec);
 		keys->steps = k;
@@ -2306,7 +2312,7 @@ static void offset_child(ChildParticle *cpa, ParticleKey *par, float *par_rot, P
 
 	copy_v3_v3(child->vel, par->vel);
 
-	if(par_rot) {
+	if (par_rot) {
 		mul_qt_v3(par_rot, child->co);
 		copy_qt_qt(child->rot, par_rot);
 	}
@@ -2319,21 +2325,21 @@ float *psys_cache_vgroup(DerivedMesh *dm, ParticleSystem *psys, int vgroup)
 {
 	float *vg=0;
 
-	if(vgroup < 0) {
+	if (vgroup < 0) {
 		/* hair dynamics pinning vgroup */
 
 	}
-	else if(psys->vgroup[vgroup]){
+	else if (psys->vgroup[vgroup]) {
 		MDeformVert *dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
-		if(dvert){
+		if (dvert) {
 			int totvert=dm->getNumVerts(dm), i;
 			vg=MEM_callocN(sizeof(float)*totvert, "vg_cache");
-			if(psys->vg_neg&(1<<vgroup)){
-				for(i=0; i<totvert; i++)
+			if (psys->vg_neg&(1<<vgroup)) {
+				for (i=0; i<totvert; i++)
 					vg[i]= 1.0f - defvert_find_weight(&dvert[i], psys->vgroup[vgroup] - 1);
 			}
-			else{
-				for(i=0; i<totvert; i++)
+			else {
+				for (i=0; i<totvert; i++)
 					vg[i]=  defvert_find_weight(&dvert[i], psys->vgroup[vgroup] - 1);
 			}
 		}
@@ -2350,19 +2356,19 @@ void psys_find_parents(ParticleSimulationData *sim)
 	int from=PART_FROM_FACE;
 	totparent=(int)(totchild*part->parents*0.3f);
 
-	if(G.rendering && part->child_nbr && part->ren_child_nbr)
+	if (G.rendering && part->child_nbr && part->ren_child_nbr)
 		totparent*=(float)part->child_nbr/(float)part->ren_child_nbr;
 
 	tree=BLI_kdtree_new(totparent);
 
-	for(p=0,cpa=sim->psys->child; p<totparent; p++,cpa++){
+	for (p=0,cpa=sim->psys->child; p<totparent; p++,cpa++) {
 		psys_particle_on_emitter(sim->psmd,from,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,co,0,0,0,orco,0);
 		BLI_kdtree_insert(tree, p, orco, NULL);
 	}
 
 	BLI_kdtree_balance(tree);
 
-	for(; p<totchild; p++,cpa++){
+	for (; p<totchild; p++,cpa++) {
 		psys_particle_on_emitter(sim->psmd,from,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,co,0,0,0,orco,0);
 		cpa->parent=BLI_kdtree_find_nearest(tree, orco, NULL, NULL);
 	}
@@ -2370,18 +2376,18 @@ void psys_find_parents(ParticleSimulationData *sim)
 	BLI_kdtree_free(tree);
 }
 
-static void get_strand_normal(Material *ma, float *surfnor, float surfdist, float *nor)
+static void get_strand_normal(Material *ma, const float surfnor[3], float surfdist, float nor[3])
 {
 	float cross[3], nstrand[3], vnor[3], blend;
 
-	if(!((ma->mode & MA_STR_SURFDIFF) || (ma->strand_surfnor > 0.0f)))
+	if (!((ma->mode & MA_STR_SURFDIFF) || (ma->strand_surfnor > 0.0f)))
 		return;
 
-	if(ma->mode & MA_STR_SURFDIFF) {
+	if (ma->mode & MA_STR_SURFDIFF) {
 		cross_v3_v3v3(cross, surfnor, nor);
 		cross_v3_v3v3(nstrand, nor, cross);
 
-		blend= INPR(nstrand, surfnor);
+		blend = dot_v3v3(nstrand, surfnor);
 		CLAMP(blend, 0.0f, 1.0f);
 
 		interp_v3_v3v3(vnor, nstrand, surfnor, blend);
@@ -2391,8 +2397,8 @@ static void get_strand_normal(Material *ma, float *surfnor, float surfdist, floa
 		copy_v3_v3(vnor, nor);
 	}
 	
-	if(ma->strand_surfnor > 0.0f) {
-		if(ma->strand_surfnor > surfdist) {
+	if (ma->strand_surfnor > 0.0f) {
+		if (ma->strand_surfnor > surfdist) {
 			blend= (ma->strand_surfnor - surfdist)/ma->strand_surfnor;
 			interp_v3_v3v3(vnor, vnor, surfnor, blend);
 			normalize_v3(vnor);
@@ -2415,41 +2421,41 @@ static int psys_threads_init_path(ParticleThread *threads, Scene *scene, float c
 	int i, seed, totthread= threads[0].tot;
 
 	/*---start figuring out what is actually wanted---*/
-	if(psys_in_edit_mode(scene, psys)) {
+	if (psys_in_edit_mode(scene, psys)) {
 		ParticleEditSettings *pset = &scene->toolsettings->particle;
 
-		if(psys->renderdata==0 && (psys->edit==NULL || pset->flag & PE_DRAW_PART)==0)
+		if (psys->renderdata==0 && (psys->edit==NULL || pset->flag & PE_DRAW_PART)==0)
 			totchild=0;
 
 		steps = (int)pow(2.0, (double)pset->draw_step);
 	}
 
-	if(totchild && part->childtype==PART_CHILD_FACES){
+	if (totchild && part->childtype==PART_CHILD_FACES) {
 		totparent=(int)(totchild*part->parents*0.3f);
 		
-		if(G.rendering && part->child_nbr && part->ren_child_nbr)
+		if (G.rendering && part->child_nbr && part->ren_child_nbr)
 			totparent*=(float)part->child_nbr/(float)part->ren_child_nbr;
 
 		/* part->parents could still be 0 so we can't test with totparent */
 		between=1;
 	}
 
-	if(psys->renderdata)
+	if (psys->renderdata)
 		steps=(int)pow(2.0,(double)part->ren_step);
-	else{
+	else {
 		totchild=(int)((float)totchild*(float)part->disp/100.0f);
 		totparent=MIN2(totparent,totchild);
 	}
 
-	if(totchild==0) return 0;
+	if (totchild==0) return 0;
 
 	/* init random number generator */
 	seed= 31415926 + ctx->sim.psys->seed;
 	
-	if(ctx->editupdate || totchild < 10000)
+	if (ctx->editupdate || totchild < 10000)
 		totthread= 1;
 	
-	for(i=0; i<totthread; i++) {
+	for (i=0; i<totthread; i++) {
 		threads[i].rng_path= rng_new(seed);
 		threads[i].tot= totthread;
 	}
@@ -2472,12 +2478,12 @@ static int psys_threads_init_path(ParticleThread *threads, Scene *scene, float c
 	ctx->vg_rough1 = psys_cache_vgroup(ctx->dm,psys,PSYS_VG_ROUGH1);
 	ctx->vg_rough2 = psys_cache_vgroup(ctx->dm,psys,PSYS_VG_ROUGH2);
 	ctx->vg_roughe = psys_cache_vgroup(ctx->dm,psys,PSYS_VG_ROUGHE);
-	if(psys->part->flag & PART_CHILD_EFFECT)
+	if (psys->part->flag & PART_CHILD_EFFECT)
 		ctx->vg_effector = psys_cache_vgroup(ctx->dm,psys,PSYS_VG_EFFECTOR);
 
 	/* set correct ipo timing */
 #if 0 // XXX old animation system
-	if(part->flag&PART_ABS_TIME && part->ipo){
+	if (part->flag&PART_ABS_TIME && part->ipo) {
 		calc_ipo(part->ipo, cfra);
 		execute_ipo((ID *)part, part->ipo);
 	}
@@ -2504,10 +2510,10 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
 	int k, cpa_num;
 	short cpa_from;
 
-	if(!pcache)
+	if (!pcache)
 		return;
 
-	if(ctx->between){
+	if (ctx->between) {
 		ParticleData *pa = psys->particles + cpa->pa[0];
 		int w, needupdate;
 		float foffset, wsum=0.f;
@@ -2517,26 +2523,26 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
 		/* Virtual parents don't work nicely with parting. */
 		float p_fac = part->parents > 0.f ? 0.f : part->parting_fac;
 
-		if(ctx->editupdate) {
+		if (ctx->editupdate) {
 			needupdate= 0;
 			w= 0;
-			while(w<4 && cpa->pa[w]>=0) {
-				if(psys->edit->points[cpa->pa[w]].flag & PEP_EDIT_RECALC) {
+			while (w<4 && cpa->pa[w]>=0) {
+				if (psys->edit->points[cpa->pa[w]].flag & PEP_EDIT_RECALC) {
 					needupdate= 1;
 					break;
 				}
 				w++;
 			}
 
-			if(!needupdate)
+			if (!needupdate)
 				return;
 			else
 				memset(child_keys, 0, sizeof(*child_keys)*(ctx->steps+1));
 		}
 
 		/* get parent paths */
-		for(w=0; w<4; w++) {
-			if(cpa->pa[w] >= 0) {
+		for (w=0; w<4; w++) {
+			if (cpa->pa[w] >= 0) {
 				key[w] = pcache[cpa->pa[w]];
 				weight[w] = cpa->w[w];
 			}
@@ -2547,11 +2553,11 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
 		}
 
 		/* modify weights to create parting */
-		if(p_fac > 0.f) {
-			for(w=0; w<4; w++) {
-				if(w && weight[w] > 0.f) {
+		if (p_fac > 0.f) {
+			for (w=0; w<4; w++) {
+				if (w && weight[w] > 0.f) {
 					float d;
-					if(part->flag & PART_CHILD_LONG_HAIR) {
+					if (part->flag & PART_CHILD_LONG_HAIR) {
 						/* For long hair use tip distance/root distance as parting factor instead of root to tip angle. */
 						float d1 = len_v3v3(key[0]->co, key[w]->co);
 						float d2 = len_v3v3((key[0]+key[0]->steps-1)->co, (key[w]+key[w]->steps-1)->co);
@@ -2568,19 +2574,19 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
 						d = RAD2DEGF(saacos(dot_v3v3(v1, v2)));
 					}
 
-					if(p_max > p_min)
+					if (p_max > p_min)
 						d = (d - p_min)/(p_max - p_min);
 					else
 						d = (d - p_min) <= 0.f ? 0.f : 1.f;
 
 					CLAMP(d, 0.f, 1.f);
 
-					if(d > 0.f)
+					if (d > 0.f)
 						weight[w] *= (1.f - d);
 				}
 				wsum += weight[w];
 			}
-			for(w=0; w<4; w++)
+			for (w=0; w<4; w++)
 				weight[w] /= wsum;
 
 			interp_v4_v4v4(weight, cpa->w, weight, p_fac);
@@ -2597,16 +2603,16 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
 
 		mul_m4_v3(ob->obmat, co);
 
-		for(w=0; w<4; w++)
+		for (w=0; w<4; w++)
 			sub_v3_v3v3(off1[w], co, key[w]->co);
 
 		psys_mat_hair_to_global(ob, ctx->sim.psmd->dm, psys->part->from, pa, hairmat);
 	}
-	else{
+	else {
 		ParticleData *pa = psys->particles + cpa->parent;
 		float co[3];
-		if(ctx->editupdate) {
-			if(!(psys->edit->points[cpa->parent].flag & PEP_EDIT_RECALC))
+		if (ctx->editupdate) {
+			if (!(psys->edit->points[cpa->parent].flag & PEP_EDIT_RECALC))
 				return;
 
 			memset(child_keys, 0, sizeof(*child_keys)*(ctx->steps+1));
@@ -2630,26 +2636,26 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
 	/* get different child parameters from textures & vgroups */
 	get_child_modifier_parameters(part, ctx, cpa, cpa_from, cpa_num, cpa_fuv, orco, &ptex);
 
-	if(ptex.exist < PSYS_FRAND(i + 24)) {
+	if (ptex.exist < PSYS_FRAND(i + 24)) {
 		child_keys->steps = -1;
 		return;
 	}
 
 	/* create the child path */
-	for(k=0,child=child_keys; k<=ctx->steps; k++,child++){
-		if(ctx->between){
+	for (k=0,child=child_keys; k<=ctx->steps; k++,child++) {
+		if (ctx->between) {
 			int w=0;
 
 			zero_v3(child->co);
 			zero_v3(child->vel);
 			unit_qt(child->rot);
 
-			for(w=0; w<4; w++) {
+			for (w=0; w<4; w++) {
 				copy_v3_v3(off2[w], off1[w]);
 
-				if(part->flag & PART_CHILD_LONG_HAIR) {
+				if (part->flag & PART_CHILD_LONG_HAIR) {
 					/* Use parent rotation (in addition to emission location) to determine child offset. */
-					if(k)
+					if (k)
 						mul_qt_v3((key[w]+k)->rot, off2[w]);
 
 					/* Fade the effect of rotation for even lengths in the end */
@@ -2666,8 +2672,8 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
 
 			copy_qt_qt(child->rot, (key[0]+k)->rot);
 		}
-		else{
-			if(k) {
+		else {
+			if (k) {
 				mul_qt_qtqt(rot, (key[0]+k)->rot, key[0]->rot);
 				par_rot = rot;
 			}
@@ -2682,9 +2688,9 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
 	}
 
 	/* apply effectors */
-	if(part->flag & PART_CHILD_EFFECT) {
-		for(k=0,child=child_keys; k<=ctx->steps; k++,child++) {
-			if(k) {
+	if (part->flag & PART_CHILD_EFFECT) {
+		for (k=0,child=child_keys; k<=ctx->steps; k++,child++) {
+			if (k) {
 				do_path_effectors(&ctx->sim, cpa->pa[0], child, k, ctx->steps, child_keys->co, ptex.effector, 0.0f, ctx->cfra, &eff_length, eff_vec);
 			}
 			else {
@@ -2694,17 +2700,17 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
 		}
 	}
 
-	for(k=0,child=child_keys; k<=ctx->steps; k++,child++){
+	for (k=0,child=child_keys; k<=ctx->steps; k++,child++) {
 		t = (float)k/(float)ctx->steps;
 
-		if(ctx->totparent)
+		if (ctx->totparent)
 			/* this is now threadsafe, virtual parents are calculated before rest of children */
 			par = (i >= ctx->totparent) ? cache[cpa->parent] : NULL;
-		else if(cpa->parent >= 0)
+		else if (cpa->parent >= 0)
 			par = pcache[cpa->parent];
 
-		if(par) {
-			if(k) {
+		if (par) {
+			if (k) {
 				mul_qt_qtqt(rot, (par+k)->rot, par->rot);
 				par_rot = rot;
 			}
@@ -2718,37 +2724,37 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
 		do_child_modifiers(&ctx->sim, &ptex, (ParticleKey *)par, par_rot, cpa, orco, hairmat, (ParticleKey *)child, t);
 
 		/* we have to correct velocity because of kink & clump */
-		if(k>1){
+		if (k>1) {
 			sub_v3_v3v3((child-1)->vel, child->co, (child-2)->co);
 			mul_v3_fl((child-1)->vel, 0.5);
 
-			if(ctx->ma && (part->draw_col == PART_DRAW_COL_MAT))
+			if (ctx->ma && (part->draw_col == PART_DRAW_COL_MAT))
 				get_strand_normal(ctx->ma, ornor, cur_length, (child-1)->vel);
 		}
 
-		if(k == ctx->steps)
+		if (k == ctx->steps)
 			sub_v3_v3v3(child->vel, child->co, (child-1)->co);
 
 		/* check if path needs to be cut before actual end of data points */
-		if(k){
+		if (k) {
 			sub_v3_v3v3(dvec, child->co, (child-1)->co);
 			length = 1.0f/(float)ctx->steps;
 			k = check_path_length(k, child_keys, child, max_length, &cur_length, length, dvec);
 		}
-		else{
+		else {
 			/* initialize length calculation */
 			max_length = ptex.length;
 			cur_length = 0.0f;
 		}
 
-		if(ctx->ma && (part->draw_col == PART_DRAW_COL_MAT)) {
+		if (ctx->ma && (part->draw_col == PART_DRAW_COL_MAT)) {
 			copy_v3_v3(child->col, &ctx->ma->r);
 			get_strand_normal(ctx->ma, ornor, cur_length, child->vel);
 		}
 	}
 
 	/* Hide virtual parents */
-	if(i < ctx->totparent)
+	if (i < ctx->totparent)
 		child_keys->steps = -1;
 }
 
@@ -2761,13 +2767,13 @@ static void *exec_child_path_cache(void *data)
 	ChildParticle *cpa;
 	int i, totchild= ctx->totchild, first= 0;
 
-	if(thread->tot > 1){
+	if (thread->tot > 1) {
 		first= ctx->parent_pass? 0 : ctx->totparent;
 		totchild= ctx->parent_pass? ctx->totparent : ctx->totchild;
 	}
 	
 	cpa= psys->child + first + thread->num;
-	for(i=first+thread->num; i<totchild; i+=thread->tot, cpa+=thread->tot)
+	for (i=first+thread->num; i<totchild; i+=thread->tot, cpa+=thread->tot)
 		psys_thread_create_path(thread, cpa, cache[i], i);
 
 	return 0;
@@ -2780,12 +2786,12 @@ void psys_cache_child_paths(ParticleSimulationData *sim, float cfra, int editupd
 	ListBase threads;
 	int i, totchild, totparent, totthread;
 
-	if(sim->psys->flag & PSYS_GLOBAL_HAIR)
+	if (sim->psys->flag & PSYS_GLOBAL_HAIR)
 		return;
 
 	pthreads= psys_threads_create(sim);
 
-	if(!psys_threads_init_path(pthreads, sim->scene, cfra, editupdate)) {
+	if (!psys_threads_init_path(pthreads, sim->scene, cfra, editupdate)) {
 		psys_threads_free(pthreads);
 		return;
 	}
@@ -2794,7 +2800,7 @@ void psys_cache_child_paths(ParticleSimulationData *sim, float cfra, int editupd
 	totchild= ctx->totchild;
 	totparent= ctx->totparent;
 
-	if(editupdate && sim->psys->childcache && totchild == sim->psys->totchildcache) {
+	if (editupdate && sim->psys->childcache && totchild == sim->psys->totchildcache) {
 		; /* just overwrite the existing cache */
 	}
 	else {
@@ -2806,26 +2812,26 @@ void psys_cache_child_paths(ParticleSimulationData *sim, float cfra, int editupd
 
 	totthread= pthreads[0].tot;
 
-	if(totthread > 1) {
+	if (totthread > 1) {
 
 		/* make virtual child parents thread safe by calculating them first */
-		if(totparent) {
+		if (totparent) {
 			BLI_init_threads(&threads, exec_child_path_cache, totthread);
 			
-			for(i=0; i<totthread; i++) {
+			for (i=0; i<totthread; i++) {
 				pthreads[i].ctx->parent_pass = 1;
 				BLI_insert_thread(&threads, &pthreads[i]);
 			}
 
 			BLI_end_threads(&threads);
 
-			for(i=0; i<totthread; i++)
+			for (i=0; i<totthread; i++)
 				pthreads[i].ctx->parent_pass = 0;
 		}
 
 		BLI_init_threads(&threads, exec_child_path_cache, totthread);
 
-		for(i=0; i<totthread; i++)
+		for (i=0; i<totthread; i++)
 			BLI_insert_thread(&threads, &pthreads[i]);
 
 		BLI_end_threads(&threads);
@@ -2857,9 +2863,9 @@ static void cache_key_incremental_rotation(ParticleCacheKey *key0, ParticleCache
 		cosangle= dot_v3v3(tangent, prev_tangent);
 
 		/* note we do the comparison on cosangle instead of
-		* angle, since floating point accuracy makes it give
-		* different results across platforms */
-		if(cosangle > 0.999999f) {
+		 * angle, since floating point accuracy makes it give
+		 * different results across platforms */
+		if (cosangle > 0.999999f) {
 			copy_v4_v4(key1->rot, key2->rot);
 		}
 		else {
@@ -2872,10 +2878,12 @@ static void cache_key_incremental_rotation(ParticleCacheKey *key0, ParticleCache
 		copy_v3_v3(prev_tangent, tangent);
 	}
 }
-/* Calculates paths ready for drawing/rendering.									*/
-/* -Usefull for making use of opengl vertex arrays for super fast strand drawing.	*/
-/* -Makes child strands possible and creates them too into the cache.				*/
-/* -Cached path data is also used to determine cut position for the editmode tool.	*/
+
+/**
+ * Calculates paths ready for drawing/rendering
+ * - Useful for making use of opengl vertex arrays for super fast strand drawing.
+ * - Makes child strands possible and creates them too into the cache.
+ * - Cached path data is also used to determine cut position for the editmode tool. */
 void psys_cache_paths(ParticleSimulationData *sim, float cfra)
 {
 	PARTICLE_PSMD;
@@ -2908,11 +2916,11 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
 	int keyed, baked;
 
 	/* we don't have anything valid to create paths from so let's quit here */
-	if((psys->flag & PSYS_HAIR_DONE || psys->flag & PSYS_KEYED || psys->pointcache)==0)
+	if ((psys->flag & PSYS_HAIR_DONE || psys->flag & PSYS_KEYED || psys->pointcache)==0)
 		return;
 
-	if(psys_in_edit_mode(sim->scene, psys))
-		if(psys->renderdata==0 && (psys->edit==NULL || pset->flag & PE_DRAW_PART)==0)
+	if (psys_in_edit_mode(sim->scene, psys))
+		if (psys->renderdata==0 && (psys->edit==NULL || pset->flag & PE_DRAW_PART)==0)
 			return;
 
 	keyed = psys->flag & PSYS_KEYED;
@@ -2924,23 +2932,28 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
 
 	psys->lattice = psys_get_lattice(sim);
 	ma= give_current_material(sim->ob, psys->part->omat);
-	if(ma && (psys->part->draw_col == PART_DRAW_COL_MAT))
+	if (ma && (psys->part->draw_col == PART_DRAW_COL_MAT))
 		copy_v3_v3(col, &ma->r);
 
-	if((psys->flag & PSYS_GLOBAL_HAIR)==0) {
-		if((psys->part->flag & PART_CHILD_EFFECT)==0)
+	if ((psys->flag & PSYS_GLOBAL_HAIR)==0) {
+		if ((psys->part->flag & PART_CHILD_EFFECT)==0)
 			vg_effector = psys_cache_vgroup(psmd->dm, psys, PSYS_VG_EFFECTOR);
 		
-		if(!psys->totchild)
+		if (!psys->totchild)
 			vg_length = psys_cache_vgroup(psmd->dm, psys, PSYS_VG_LENGTH);
 	}
 
+	/* ensure we have tessfaces to be used for mapping */
+	if (part->from != PART_FROM_VERT) {
+		DM_ensure_tessface(psmd->dm);
+	}
+
 	/*---first main loop: create all actual particles' paths---*/
 	LOOP_SHOWN_PARTICLES {
-		if(!psys->totchild) {
+		if (!psys->totchild) {
 			psys_get_texture(sim, pa, &ptex, PAMAP_LENGTH, 0.f);
 			pa_length = ptex.length * (1.0f - part->randlength * PSYS_FRAND(psys->seed + p));
-			if(vg_length)
+			if (vg_length)
 				pa_length *= psys_particle_value_from_verts(psmd->dm,part->from,pa,vg_length);
 		}
 
@@ -2963,7 +2976,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
 		copy_v3_v3(rotmat[1], hairmat[1]);
 		copy_v3_v3(rotmat[2], hairmat[0]);
 
-		if(part->draw & PART_ABS_PATH_TIME) {
+		if (part->draw & PART_ABS_PATH_TIME) {
 			birthtime = MAX2(pind.birthtime, part->path_start);
 			dietime = MIN2(pind.dietime, part->path_end);
 		}
@@ -2973,7 +2986,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
 			dietime = tb + part->path_end * (pind.dietime - tb);
 		}
 
-		if(birthtime >= dietime) {
+		if (birthtime >= dietime) {
 			cache[p]->steps = -1;
 			continue;
 		}
@@ -2981,7 +2994,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
 		dietime = birthtime + pa_length * (dietime - birthtime);
 
 		/*--interpolate actual path from data points--*/
-		for(k=0, ca=cache[p]; k<=steps; k++, ca++){
+		for (k=0, ca=cache[p]; k<=steps; k++, ca++) {
 			time = (float)k / (float)steps;
 			t = birthtime + time * (dietime - birthtime);
 			result.time = -t;
@@ -2990,9 +3003,9 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
 
 			/* dynamic hair is in object space */
 			/* keyed and baked are already in global space */
-			if(hair_dm)
+			if (hair_dm)
 				mul_m4_v3(sim->ob->obmat, ca->co);
-			else if(!keyed && !baked && !(psys->flag & PSYS_GLOBAL_HAIR))
+			else if (!keyed && !baked && !(psys->flag & PSYS_GLOBAL_HAIR))
 				mul_m4_v3(hairmat, ca->co);
 
 			copy_v3_v3(ca->col, col);
@@ -3000,45 +3013,45 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
 		
 		/*--modify paths and calculate rotation & velocity--*/
 
-		if(!(psys->flag & PSYS_GLOBAL_HAIR)) {
+		if (!(psys->flag & PSYS_GLOBAL_HAIR)) {
 			/* apply effectors */
-			if((psys->part->flag & PART_CHILD_EFFECT) == 0) {
+			if ((psys->part->flag & PART_CHILD_EFFECT) == 0) {
 				float effector= 1.0f;
-				if(vg_effector)
+				if (vg_effector)
 					effector*= psys_particle_value_from_verts(psmd->dm,psys->part->from,pa,vg_effector);
 
 				sub_v3_v3v3(vec,(cache[p]+1)->co,cache[p]->co);
 				length = len_v3(vec);
 
-				for(k=1, ca=cache[p]+1; k<=steps; k++, ca++)
+				for (k=1, ca=cache[p]+1; k<=steps; k++, ca++)
 					do_path_effectors(sim, p, ca, k, steps, cache[p]->co, effector, dfra, cfra, &length, vec);
 			}
 
 			/* apply guide curves to path data */
-			if(sim->psys->effectors && (psys->part->flag & PART_CHILD_EFFECT)==0) {
-				for(k=0, ca=cache[p]; k<=steps; k++, ca++)
+			if (sim->psys->effectors && (psys->part->flag & PART_CHILD_EFFECT)==0) {
+				for (k=0, ca=cache[p]; k<=steps; k++, ca++)
 					/* ca is safe to cast, since only co and vel are used */
 					do_guides(sim->psys->effectors, (ParticleKey*)ca, p, (float)k/(float)steps);
 			}
 
 			/* lattices have to be calculated separately to avoid mixups between effector calculations */
-			if(psys->lattice) {
-				for(k=0, ca=cache[p]; k<=steps; k++, ca++)
+			if (psys->lattice) {
+				for (k=0, ca=cache[p]; k<=steps; k++, ca++)
 					calc_latt_deform(psys->lattice, ca->co, 1.0f);
 			}
 		}
 
 		/* finally do rotation & velocity */
-		for(k=1, ca=cache[p]+1; k<=steps; k++, ca++) {
+		for (k=1, ca=cache[p]+1; k<=steps; k++, ca++) {
 			cache_key_incremental_rotation(ca, ca - 1, ca - 2, prev_tangent, k);
 
-			if(k == steps)
+			if (k == steps)
 				copy_qt_qt(ca->rot, (ca - 1)->rot);
 
 			/* set velocity */
 			sub_v3_v3v3(ca->vel, ca->co, (ca-1)->co);
 
-			if(k==1)
+			if (k==1)
 				copy_v3_v3((ca-1)->vel, ca->vel);
 
 			ca->time = (float)k/(float)steps;
@@ -3055,15 +3068,15 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
 
 	psys->totcached = totpart;
 
-	if(psys->lattice){
+	if (psys->lattice) {
 		end_latt_deform(psys->lattice);
 		psys->lattice= NULL;
 	}
 
-	if(vg_effector)
+	if (vg_effector)
 		MEM_freeN(vg_effector);
 
-	if(vg_length)
+	if (vg_length)
 		MEM_freeN(vg_length);
 }
 void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cfra)
@@ -3092,23 +3105,23 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
 
 	steps = MAX2(steps, 4);
 
-	if(!cache || edit->totpoint != edit->totcached) {
+	if (!cache || edit->totpoint != edit->totcached) {
 		/* clear out old and create new empty path cache */
 		psys_free_path_cache(edit->psys, edit);
 		cache= edit->pathcache= psys_alloc_path_cache_buffers(&edit->pathcachebufs, totpart, steps+1);
 
 		/* set flag for update (child particles check this too) */
-		for(i=0, point=edit->points; i<totpart; i++, point++)
+		for (i=0, point=edit->points; i<totpart; i++, point++)
 			point->flag |= PEP_EDIT_RECALC;
 		recalc_set = 1;
 	}
 
 	/* frs_sec = (psys || edit->pid.flag & PTCACHE_VEL_PER_SEC) ? 25.0f : 1.0f; */ /* UNUSED */
 
-	if(pset->brushtype == PE_BRUSH_WEIGHT) {
+	if (pset->brushtype == PE_BRUSH_WEIGHT) {
 		;/* use weight painting colors now... */
 	}
-	else{
+	else {
 		sel_col[0] = (float)edit->sel_col[0] / 255.0f;
 		sel_col[1] = (float)edit->sel_col[1] / 255.0f;
 		sel_col[2] = (float)edit->sel_col[2] / 255.0f;
@@ -3118,11 +3131,11 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
 	}
 
 	/*---first main loop: create all actual particles' paths---*/
-	for(i=0, point=edit->points; i<totpart; i++, pa+=pa?1:0, point++){
-		if(edit->totcached && !(point->flag & PEP_EDIT_RECALC))
+	for (i=0, point=edit->points; i<totpart; i++, pa+=pa?1:0, point++) {
+		if (edit->totcached && !(point->flag & PEP_EDIT_RECALC))
 			continue;
 
-		if(point->totkey == 0)
+		if (point->totkey == 0)
 			continue;
 
 		ekey = point->keys;
@@ -3135,7 +3148,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
 
 
 		/* should init_particle_interpolation set this ? */
-		if(pset->brushtype==PE_BRUSH_WEIGHT){
+		if (pset->brushtype==PE_BRUSH_WEIGHT) {
 			pind.hkey[0] = NULL;
 			/* pa != NULL since the weight brush is only available for hair */
 			pind.hkey[1] = pa->hair;
@@ -3149,7 +3162,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
 		/*--get the first data points--*/
 		init_particle_interpolation(ob, psys, pa, &pind);
 
-		if(psys) {
+		if (psys) {
 			psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, hairmat);
 			copy_v3_v3(rotmat[0], hairmat[2]);
 			copy_v3_v3(rotmat[1], hairmat[1]);
@@ -3159,13 +3172,13 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
 		birthtime = pind.birthtime;
 		dietime = pind.dietime;
 
-		if(birthtime >= dietime) {
+		if (birthtime >= dietime) {
 			cache[i]->steps = -1;
 			continue;
 		}
 
 		/*--interpolate actual path from data points--*/
-		for(k=0, ca=cache[i]; k<=steps; k++, ca++){
+		for (k=0, ca=cache[i]; k<=steps; k++, ca++) {
 			time = (float)k / (float)steps;
 			t = birthtime + time * (dietime - birthtime);
 			result.time = -t;
@@ -3173,19 +3186,19 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
 			copy_v3_v3(ca->co, result.co);
 
 			 /* non-hair points are already in global space */
-			if(psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
+			if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
 				mul_m4_v3(hairmat, ca->co);
 
-				if(k) {
+				if (k) {
 					cache_key_incremental_rotation(ca, ca - 1, ca - 2, prev_tangent, k);
 
-					if(k == steps)
+					if (k == steps)
 						copy_qt_qt(ca->rot, (ca - 1)->rot);
 
 					/* set velocity */
 					sub_v3_v3v3(ca->vel, ca->co, (ca - 1)->co);
 
-					if(k==1)
+					if (k==1)
 						copy_v3_v3((ca - 1)->vel, ca->vel);
 				}
 			}
@@ -3195,12 +3208,13 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
 			}
 
 			/* selection coloring in edit mode */
-			if(pset->brushtype==PE_BRUSH_WEIGHT){
+			if (pset->brushtype==PE_BRUSH_WEIGHT) {
 				float t2;
 
-				if(k==0) {
+				if (k==0) {
 					weight_to_rgb(ca->col, pind.hkey[1]->weight);
-				} else {
+				}
+				else {
 					float w1[3], w2[3];
 					keytime = (t - (*pind.ekey[0]->time))/((*pind.ekey[1]->time) - (*pind.ekey[0]->time));
 
@@ -3218,21 +3232,21 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
 				pind.hkey[0] = pind.hkey[1] - 1;
 			}
 			else {
-				if((ekey + (pind.ekey[0] - point->keys))->flag & PEK_SELECT){
-					if((ekey + (pind.ekey[1] - point->keys))->flag & PEK_SELECT){
+				if ((ekey + (pind.ekey[0] - point->keys))->flag & PEK_SELECT) {
+					if ((ekey + (pind.ekey[1] - point->keys))->flag & PEK_SELECT) {
 						copy_v3_v3(ca->col, sel_col);
 					}
-					else{
+					else {
 						keytime = (t - (*pind.ekey[0]->time))/((*pind.ekey[1]->time) - (*pind.ekey[0]->time));
 						interp_v3_v3v3(ca->col, sel_col, nosel_col, keytime);
 					}
 				}
-				else{
-					if((ekey + (pind.ekey[1] - point->keys))->flag & PEK_SELECT){
+				else {
+					if ((ekey + (pind.ekey[1] - point->keys))->flag & PEK_SELECT) {
 						keytime = (t - (*pind.ekey[0]->time))/((*pind.ekey[1]->time) - (*pind.ekey[0]->time));
 						interp_v3_v3v3(ca->col, nosel_col, sel_col, keytime);
 					}
-					else{
+					else {
 						copy_v3_v3(ca->col, nosel_col);
 					}
 				}
@@ -3240,7 +3254,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
 
 			ca->time = t;
 		}
-		if(psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
+		if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
 			/* First rotation is based on emitting face orientation.
 			 * This is way better than having flipping rotations resulting
 			 * from using a global axis as a rotation pole (vec_to_quat()).
@@ -3254,7 +3268,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
 
 	edit->totcached = totpart;
 
-	if(psys) {
+	if (psys) {
 		ParticleSimulationData sim= {0};
 		sim.scene= scene;
 		sim.ob= ob;
@@ -3265,8 +3279,8 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
 	}
 
 	/* clear recalc flag if set here */
-	if(recalc_set) {
-		for(i=0, point=edit->points; i<totpart; i++, point++)
+	if (recalc_set) {
+		for (i=0, point=edit->points; i<totpart; i++, point++)
 			point->flag &= ~PEP_EDIT_RECALC;
 	}
 }
@@ -3275,10 +3289,10 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
 /************************************************/
 void copy_particle_key(ParticleKey *to, ParticleKey *from, int time)
 {
-	if(time){
+	if (time) {
 		memcpy(to,from,sizeof(ParticleKey));
 	}
-	else{
+	else {
 		float to_time=to->time;
 		memcpy(to,from,sizeof(ParticleKey));
 		to->time=to_time;
@@ -3286,10 +3300,10 @@ void copy_particle_key(ParticleKey *to, ParticleKey *from, int time)
 }
 void psys_get_from_key(ParticleKey *key, float *loc, float *vel, float *rot, float *time)
 {
-	if(loc) copy_v3_v3(loc,key->co);
-	if(vel) copy_v3_v3(vel,key->vel);
-	if(rot) copy_qt_qt(rot,key->rot);
-	if(time) *time=key->time;
+	if (loc) copy_v3_v3(loc,key->co);
+	if (vel) copy_v3_v3(vel,key->vel);
+	if (rot) copy_qt_qt(rot,key->rot);
+	if (time) *time=key->time;
 }
 /*-------changing particle keys from space to another-------*/
 #if 0
@@ -3319,7 +3333,7 @@ static void triatomat(float *v1, float *v2, float *v3, float (*uv)[2], float mat
 	normal_tri_v3( mat[2],v1, v2, v3);
 
 	/* second axis along (1, 0) in uv space */
-	if(uv) {
+	if (uv) {
 		d1[0]= uv[1][0] - uv[0][0];
 		d1[1]= uv[1][1] - uv[0][1];
 		d2[0]= uv[2][0] - uv[0][0];
@@ -3327,7 +3341,7 @@ static void triatomat(float *v1, float *v2, float *v3, float (*uv)[2], float mat
 
 		det = d2[0]*d1[1] - d2[1]*d1[0];
 
-		if(det != 0.0f) {
+		if (det != 0.0f) {
 			det= 1.0f/det;
 			w1= -d2[1]*det;
 			w2= d1[1]*det;
@@ -3358,19 +3372,19 @@ static void psys_face_mat(Object *ob, DerivedMesh *dm, ParticleData *pa, float m
 
 	int i = pa->num_dmcache==DMCACHE_NOTFOUND ? pa->num : pa->num_dmcache;
 	
-	if (i==-1 || i >= dm->getNumFaces(dm)) { unit_m4(mat); return; }
+	if (i==-1 || i >= dm->getNumTessFaces(dm)) { unit_m4(mat); return; }
 
-	mface=dm->getFaceData(dm,i,CD_MFACE);
-	osface=dm->getFaceData(dm,i,CD_ORIGSPACE);
+	mface=dm->getTessFaceData(dm,i,CD_MFACE);
+	osface=dm->getTessFaceData(dm,i,CD_ORIGSPACE);
 	
-	if(orco && (orcodata=dm->getVertDataArray(dm, CD_ORCO))) {
+	if (orco && (orcodata=dm->getVertDataArray(dm, CD_ORCO))) {
 		copy_v3_v3(v[0], orcodata[mface->v1]);
 		copy_v3_v3(v[1], orcodata[mface->v2]);
 		copy_v3_v3(v[2], orcodata[mface->v3]);
 
 		/* ugly hack to use non-transformed orcos, since only those
 		 * give symmetric results for mirroring in particle mode */
-		if(DM_get_vert_data_layer(dm, CD_ORIGINDEX))
+		if (DM_get_vert_data_layer(dm, CD_ORIGINDEX))
 			transform_mesh_orco_verts(ob->data, v, 3, 1);
 	}
 	else {
@@ -3399,12 +3413,12 @@ void psys_mat_hair_to_orco(Object *ob, DerivedMesh *dm, short from, ParticleData
 	psys_particle_on_dm(dm, from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, vec, 0, 0, 0, orco, 0);
 
 	/* see psys_face_mat for why this function is called */
-	if(DM_get_vert_data_layer(dm, CD_ORIGINDEX))
+	if (DM_get_vert_data_layer(dm, CD_ORIGINDEX))
 		transform_mesh_orco_verts(ob->data, &orco, 1, 1);
 	copy_v3_v3(hairmat[3],orco);
 }
 
-void psys_vec_rot_to_face(DerivedMesh *dm, ParticleData *pa, float *vec)
+void psys_vec_rot_to_face(DerivedMesh *dm, ParticleData *pa, float vec[3])
 {
 	float mat[4][4];
 
@@ -3431,11 +3445,11 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n
 	ModifierData *md;
 	ParticleSystemModifierData *psmd;
 
-	if(!ob || ob->type != OB_MESH)
+	if (!ob || ob->type != OB_MESH)
 		return NULL;
 
 	psys = ob->particlesystem.first;
-	for(; psys; psys=psys->next)
+	for (; psys; psys=psys->next)
 		psys->flag &= ~PSYS_CURRENT;
 
 	psys = MEM_callocN(sizeof(ParticleSystem), "particle_system");
@@ -3444,14 +3458,14 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n
 
 	psys->part = psys_new_settings("ParticleSettings", NULL);
 
-	if(BLI_countlist(&ob->particlesystem)>1)
+	if (BLI_countlist(&ob->particlesystem)>1)
 		BLI_snprintf(psys->name, sizeof(psys->name), "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
 	else
 		strcpy(psys->name, "ParticleSystem");
 
 	md= modifier_new(eModifierType_ParticleSystem);
 
-	if(name)	BLI_strncpy(md->name, name, sizeof(md->name));
+	if (name)	BLI_strncpy(md->name, name, sizeof(md->name));
 	else		BLI_snprintf(md->name, sizeof(md->name), "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
 	modifier_unique_name(&ob->modifiers, md);
 
@@ -3474,23 +3488,21 @@ void object_remove_particle_system(Scene *scene, Object *ob)
 	ParticleSystemModifierData *psmd;
 	ModifierData *md;
 
-	if(!psys)
+	if (!psys)
 		return;
 
 	/* clear all other appearances of this pointer (like on smoke flow modifier) */
-	if((md = modifiers_findByType(ob, eModifierType_Smoke)))
-	{
+	if ((md = modifiers_findByType(ob, eModifierType_Smoke))) {
 		SmokeModifierData *smd = (SmokeModifierData *)md;
-		if((smd->type == MOD_SMOKE_TYPE_FLOW) && smd->flow && smd->flow->psys)
-			if(smd->flow->psys == psys)
+		if ((smd->type == MOD_SMOKE_TYPE_FLOW) && smd->flow && smd->flow->psys)
+			if (smd->flow->psys == psys)
 				smd->flow->psys = NULL;
 	}
 
-	if((md = modifiers_findByType(ob, eModifierType_DynamicPaint)))
-	{
+	if ((md = modifiers_findByType(ob, eModifierType_DynamicPaint))) {
 		DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
-		if(pmd->brush && pmd->brush->psys)
-			if(pmd->brush->psys == psys)
+		if (pmd->brush && pmd->brush->psys)
+			if (pmd->brush->psys == psys)
 				pmd->brush->psys = NULL;
 	}
 
@@ -3503,7 +3515,7 @@ void object_remove_particle_system(Scene *scene, Object *ob)
 	BLI_remlink(&ob->particlesystem, psys);
 	psys_free(ob,psys);
 
-	if(ob->particlesystem.first)
+	if (ob->particlesystem.first)
 		((ParticleSystem *) ob->particlesystem.first)->flag |= PSYS_CURRENT;
 	else
 		ob->mode &= ~OB_MODE_PARTICLE_EDIT;
@@ -3552,7 +3564,7 @@ static void default_particle_settings(ParticleSettings *part)
 	part->childsize=1.0;
 
 	part->rotmode = PART_ROT_VEL;
-	part->avemode = PART_AVE_SPIN;
+	part->avemode = PART_AVE_VELOCITY;
 
 	part->child_nbr=10;
 	part->ren_child_nbr=100;
@@ -3586,7 +3598,7 @@ static void default_particle_settings(ParticleSettings *part)
 	part->simplify_transition= 0.1f;
 	part->simplify_viewport= 0.8;
 
-	if(!part->effector_weights)
+	if (!part->effector_weights)
 		part->effector_weights = BKE_add_effector_weights(NULL);
 }
 
@@ -3595,7 +3607,7 @@ ParticleSettings *psys_new_settings(const char *name, Main *main)
 {
 	ParticleSettings *part;
 
-	if(main==NULL)
+	if (main==NULL)
 		main = G.main;
 
 	part= alloc_libblock(&main->particle, ID_PA, name);
@@ -3618,8 +3630,8 @@ ParticleSettings *psys_copy_settings(ParticleSettings *part)
 
 	partn->boids = boid_copy_settings(part->boids);
 
-	for(a=0; a<MAX_MTEX; a++) {
-		if(part->mtex[a]) {
+	for (a=0; a<MAX_MTEX; a++) {
+		if (part->mtex[a]) {
 			partn->mtex[a]= MEM_mallocN(sizeof(MTex), "psys_copy_tex");
 			memcpy(partn->mtex[a], part->mtex[a], sizeof(MTex));
 			id_us_plus((ID *)partn->mtex[a]->tex);
@@ -3636,8 +3648,8 @@ static void expand_local_particlesettings(ParticleSettings *part)
 	int i;
 	id_lib_extern((ID *)part->dup_group);
 
-	for(i=0; i<MAX_MTEX; i++) {
-		if(part->mtex[i]) id_lib_extern((ID *)part->mtex[i]->tex);
+	for (i=0; i<MAX_MTEX; i++) {
+		if (part->mtex[i]) id_lib_extern((ID *)part->mtex[i]->tex);
 	}
 }
 
@@ -3652,41 +3664,40 @@ void make_local_particlesettings(ParticleSettings *part)
 	 * - mixed: make copy
 	 */
 	
-	if(part->id.lib==0) return;
-	if(part->id.us==1) {
+	if (part->id.lib==0) return;
+	if (part->id.us==1) {
 		id_clear_lib_data(bmain, &part->id);
 		expand_local_particlesettings(part);
 		return;
 	}
 
 	/* test objects */
-	for(ob= bmain->object.first; ob && ELEM(FALSE, is_lib, is_local); ob= ob->id.next) {
+	for (ob= bmain->object.first; ob && ELEM(FALSE, is_lib, is_local); ob= ob->id.next) {
 		ParticleSystem *psys=ob->particlesystem.first;
-		for(; psys; psys=psys->next){
-			if(psys->part==part) {
-				if(ob->id.lib) is_lib= TRUE;
+		for (; psys; psys=psys->next) {
+			if (psys->part==part) {
+				if (ob->id.lib) is_lib= TRUE;
 				else is_local= TRUE;
 			}
 		}
 	}
 	
-	if(is_local && is_lib==FALSE) {
+	if (is_local && is_lib==FALSE) {
 		id_clear_lib_data(bmain, &part->id);
 		expand_local_particlesettings(part);
 	}
-	else if(is_local && is_lib) {
+	else if (is_local && is_lib) {
 		ParticleSettings *part_new= psys_copy_settings(part);
-
 		part_new->id.us= 0;
 
 		/* Remap paths of new ID using old library as base. */
 		BKE_id_lib_local_paths(bmain, part->id.lib, &part_new->id);
 
 		/* do objects */
-		for(ob= bmain->object.first; ob; ob= ob->id.next) {
+		for (ob= bmain->object.first; ob; ob= ob->id.next) {
 			ParticleSystem *psys;
-			for(psys= ob->particlesystem.first; psys; psys=psys->next){
-				if(psys->part==part && ob->id.lib==0) {
+			for (psys= ob->particlesystem.first; psys; psys=psys->next) {
+				if (psys->part==part && ob->id.lib==0) {
 					psys->part= part_new;
 					part_new->id.us++;
 					part->id.us--;
@@ -3708,15 +3719,15 @@ static int get_particle_uv(DerivedMesh *dm, ParticleData *pa, int face_index, co
 	
 	tf= CustomData_get_layer_named(&dm->faceData, CD_MTFACE, name);
 
-	if(tf == NULL)
+	if (tf == NULL)
 		tf= CustomData_get_layer(&dm->faceData, CD_MTFACE);
 
-	if(tf == NULL)
+	if (tf == NULL)
 		return 0;
 
-	if(pa) {
+	if (pa) {
 		i= (pa->num_dmcache==DMCACHE_NOTFOUND)? pa->num: pa->num_dmcache;
-		if(i >= dm->getNumFaces(dm))
+		if (i >= dm->getNumTessFaces(dm))
 			i = -1;
 	}
 	else
@@ -3728,7 +3739,7 @@ static int get_particle_uv(DerivedMesh *dm, ParticleData *pa, int face_index, co
 		texco[2]= 0.0f;
 	}
 	else {
-		mf= dm->getFaceData(dm, i, CD_MFACE);
+		mf= dm->getTessFaceData(dm, i, CD_MFACE);
 
 		psys_interpolate_uvs(&tf[i], mf->v4, fuv, texco);
 
@@ -3740,9 +3751,9 @@ 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);}
-#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) if(event & type) { if(pvalue < 0.f) pvalue = 1.f+pvalue; CLAMP(pvalue, 0.0f, 1.0f); }
-#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) if(event & type) { CLAMP(pvalue, -1.0f, 1.0f); }
+#define SET_PARTICLE_TEXTURE(type, pvalue, texfac) if ((event & mtex->mapto) & type) {pvalue = texture_value_blend(def, pvalue, value, texfac, blend);}
+#define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) if (event & type) { if (pvalue < 0.f) pvalue = 1.f+pvalue; CLAMP(pvalue, 0.0f, 1.0f); }
+#define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) if (event & type) { CLAMP(pvalue, -1.0f, 1.0f); }
 
 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)
 {
@@ -3757,14 +3768,14 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti
 	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;
 
-	for(m=0; m<MAX_MTEX; m++, mtexp++){
+	for (m=0; m<MAX_MTEX; m++, mtexp++) {
 		mtex = *mtexp;
-		if(mtex && mtex->mapto){
+		if (mtex && mtex->mapto) {
 			float def=mtex->def_var;
 			short blend=mtex->blendtype;
 			short texco = mtex->texco;
 
-			if(ELEM(texco, TEXCO_UV, TEXCO_ORCO) && (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME) == 0 || part->distr == PART_DISTR_GRID))
+			if (ELEM(texco, TEXCO_UV, TEXCO_ORCO) && (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME) == 0 || part->distr == PART_DISTR_GRID))
 				texco = TEXCO_GLOB;
 
 			switch(texco) {
@@ -3773,11 +3784,11 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti
 				break;
 			case TEXCO_OBJECT:
 				copy_v3_v3(texvec, par->state.co);
-				if(mtex->object)
+				if (mtex->object)
 					mul_m4_v3(mtex->object->imat, texvec);
 				break;
 			case TEXCO_UV:
-				if(fw && get_particle_uv(dm, NULL, face_index, fw, mtex->uvname, texvec))
+				if (fw && get_particle_uv(dm, NULL, face_index, fw, mtex->uvname, texvec))
 					break;
 				/* no break, failed to get uv's, so let's try orco's */
 			case TEXCO_ORCO:
@@ -3793,7 +3804,7 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti
 
 			externtex(mtex, texvec, &value, rgba, rgba+1, rgba+2, rgba+3, 0);
 
-			if((event & mtex->mapto) & PAMAP_ROUGH)
+			if ((event & mtex->mapto) & PAMAP_ROUGH)
 				ptex->rough1= ptex->rough2= ptex->roughe= texture_value_blend(def,ptex->rough1,value,mtex->roughfac,blend);
 
 			SET_PARTICLE_TEXTURE(PAMAP_LENGTH, ptex->length, mtex->lengthfac);
@@ -3825,14 +3836,14 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex
 
 	ptex->time = (float)(pa - sim->psys->particles)/(float)sim->psys->totpart;
 
-	for(m=0; m<MAX_MTEX; m++, mtexp++){
+	for (m=0; m<MAX_MTEX; m++, mtexp++) {
 		mtex = *mtexp;
-		if(mtex && mtex->mapto){
+		if (mtex && mtex->mapto) {
 			float def=mtex->def_var;
 			short blend=mtex->blendtype;
 			short texco = mtex->texco;
 
-			if(texco == TEXCO_UV && (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME) == 0 || part->distr == PART_DISTR_GRID))
+			if (texco == TEXCO_UV && (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME) == 0 || part->distr == PART_DISTR_GRID))
 				texco = TEXCO_GLOB;
 
 			switch(texco) {
@@ -3841,11 +3852,11 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex
 				break;
 			case TEXCO_OBJECT:
 				copy_v3_v3(texvec, pa->state.co);
-				if(mtex->object)
+				if (mtex->object)
 					mul_m4_v3(mtex->object->imat, texvec);
 				break;
 			case TEXCO_UV:
-				if(get_particle_uv(sim->psmd->dm, pa, 0, pa->fuv, mtex->uvname, texvec))
+				if (get_particle_uv(sim->psmd->dm, pa, 0, pa->fuv, mtex->uvname, texvec))
 					break;
 				/* no break, failed to get uv's, so let's try orco's */
 			case TEXCO_ORCO:
@@ -3861,9 +3872,9 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex
 
 			externtex(mtex, texvec, &value, rgba, rgba+1, rgba+2, rgba+3, 0);
 
-			if((event & mtex->mapto) & PAMAP_TIME) {
+			if ((event & mtex->mapto) & PAMAP_TIME) {
 				/* the first time has to set the base value for time regardless of blend mode */
-				if((setvars&MAP_PA_TIME)==0){
+				if ((setvars&MAP_PA_TIME)==0) {
 					int flip= (mtex->timefac < 0.0f);
 					float timefac= fabsf(mtex->timefac);
 					ptex->time *= 1.0f - timefac;
@@ -3906,26 +3917,26 @@ float psys_get_child_time(ParticleSystem *psys, ChildParticle *cpa, float cfra,
 	ParticleSettings *part = psys->part;
 	float time, life;
 
-	if(part->childtype==PART_CHILD_FACES){
+	if (part->childtype==PART_CHILD_FACES) {
 		int w=0;
 		time=0.0;
-		while(w<4 && cpa->pa[w]>=0){
+		while (w<4 && cpa->pa[w]>=0) {
 			time+=cpa->w[w]*(psys->particles+cpa->pa[w])->time;
 			w++;
 		}
 
 		life = part->lifetime * (1.0f - part->randlife * PSYS_FRAND(cpa - psys->child + 25));
 	}
-	else{
+	else {
 		ParticleData *pa = psys->particles + cpa->parent;
 
 		time = pa->time;
 		life = pa->lifetime;
 	}
 
-	if(birthtime)
+	if (birthtime)
 		*birthtime = time;
-	if(dietime)
+	if (dietime)
 		*dietime = time+life;
 
 	return (cfra-time)/life;
@@ -3935,14 +3946,14 @@ float psys_get_child_size(ParticleSystem *psys, ChildParticle *cpa, float UNUSED
 	ParticleSettings *part = psys->part;
 	float size; // time XXX
 	
-	if(part->childtype==PART_CHILD_FACES)
+	if (part->childtype==PART_CHILD_FACES)
 		size=part->size;
 	else
 		size=psys->particles[cpa->parent].size;
 
 	size*=part->childsize;
 
-	if(part->childrandsize != 0.0f)
+	if (part->childrandsize != 0.0f)
 		size *= 1.0f - part->childrandsize * PSYS_FRAND(cpa - psys->child + 26);
 
 	return size;
@@ -3955,22 +3966,22 @@ static void get_child_modifier_parameters(ParticleSettings *part, ParticleThread
 	get_cpa_texture(ctx->dm, psys, part, psys->particles + cpa->pa[0], i, cpa_num, cpa_fuv, orco, ptex, PAMAP_DENS|PAMAP_CHILD, psys->cfra);
 
 
-	if(ptex->exist < PSYS_FRAND(i + 24))
+	if (ptex->exist < PSYS_FRAND(i + 24))
 		return;
 
-	if(ctx->vg_length)
+	if (ctx->vg_length)
 		ptex->length*=psys_interpolate_value_from_verts(ctx->dm,cpa_from,cpa_num,cpa_fuv,ctx->vg_length);
-	if(ctx->vg_clump)
+	if (ctx->vg_clump)
 		ptex->clump*=psys_interpolate_value_from_verts(ctx->dm,cpa_from,cpa_num,cpa_fuv,ctx->vg_clump);
-	if(ctx->vg_kink)
+	if (ctx->vg_kink)
 		ptex->kink*=psys_interpolate_value_from_verts(ctx->dm,cpa_from,cpa_num,cpa_fuv,ctx->vg_kink);
-	if(ctx->vg_rough1)
+	if (ctx->vg_rough1)
 		ptex->rough1*=psys_interpolate_value_from_verts(ctx->dm,cpa_from,cpa_num,cpa_fuv,ctx->vg_rough1);
-	if(ctx->vg_rough2)
+	if (ctx->vg_rough2)
 		ptex->rough2*=psys_interpolate_value_from_verts(ctx->dm,cpa_from,cpa_num,cpa_fuv,ctx->vg_rough2);
-	if(ctx->vg_roughe)
+	if (ctx->vg_roughe)
 		ptex->roughe*=psys_interpolate_value_from_verts(ctx->dm,cpa_from,cpa_num,cpa_fuv,ctx->vg_roughe);
-	if(ctx->vg_effector)
+	if (ctx->vg_effector)
 		ptex->effector*=psys_interpolate_value_from_verts(ctx->dm,cpa_from,cpa_num,cpa_fuv,ctx->vg_effector);
 }
 static void do_child_modifiers(ParticleSimulationData *sim, ParticleTexture *ptex, ParticleKey *par, float *par_rot, ChildParticle *cpa, float *orco, float mat[4][4], ParticleKey *state, float t)
@@ -3984,21 +3995,21 @@ static void do_child_modifiers(ParticleSimulationData *sim, ParticleTexture *pte
 	float rough2 = part->rough2;
 	float rough_end = part->rough_end;
 
-	if(ptex) {
+	if (ptex) {
 		kink_freq *= ptex->kink;
 		rough1 *= ptex->rough1;
 		rough2 *= ptex->rough2;
 		rough_end *= ptex->roughe;
 	}
 
-	if(part->flag & PART_CHILD_EFFECT)
+	if (part->flag & PART_CHILD_EFFECT)
 		/* state is safe to cast, since only co and vel are used */
 		guided = do_guides(sim->psys->effectors, (ParticleKey*)state, cpa->parent, t);
 
-	if(guided==0){
+	if (guided==0) {
 		float clump = do_clump(state, par, t, part->clumpfac, part->clumppow, ptex ? ptex->clump : 1.f);
 
-		if(kink_freq != 0.f) {
+		if (kink_freq != 0.f) {
 			float kink_amp = part->kink_amp * (1.f - part->kink_amp_clump * clump);
 
 			do_kink(state, par, par_rot, t, kink_freq, part->kink_shape,
@@ -4007,13 +4018,13 @@ static void do_child_modifiers(ParticleSimulationData *sim, ParticleTexture *pte
 		}
 	}
 
-	if(rough1 > 0.f)
+	if (rough1 > 0.f)
 		do_rough(orco, mat, t, rough1, part->rough1_size, 0.0, state);
 
-	if(rough2 > 0.f)
+	if (rough2 > 0.f)
 		do_rough(sim->psys->frand + ((i + 27) % (PSYS_FRAND_COUNT - 3)), mat, t, rough2, part->rough2_size, part->rough2_thres, state);
 
-	if(rough_end > 0.f)
+	if (rough_end > 0.f)
 		do_rough_end(sim->psys->frand + ((i + 27) % (PSYS_FRAND_COUNT - 3)), mat, t, rough_end, part->rough_end_shape, state);
 }
 /* get's hair (or keyed) particles state at the "path time" specified in state->time */
@@ -4048,9 +4059,9 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
 	t=state->time;
 	CLAMP(t, 0.0f, 1.0f);
 
-	if(p<totpart){
+	if (p<totpart) {
 		/* interpolate pathcache directly if it exist */
-		if(psys->pathcache) {
+		if (psys->pathcache) {
 			ParticleCacheKey result;
 			interpolate_pathcache(psys->pathcache[p], t, &result);
 			copy_v3_v3(state->co, result.co);
@@ -4065,38 +4076,38 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
 			pind.cache = cached ? psys->pointcache : NULL;
 			pind.epoint = NULL;
 			pind.bspline = (psys->part->flag & PART_HAIR_BSPLINE);
-			/* pind.dm disabled in editmode means we dont get effectors taken into
+			/* pind.dm disabled in editmode means we don't get effectors taken into
 			 * account when subdividing for instance */
 			pind.dm = psys_in_edit_mode(sim->scene, psys) ? NULL : psys->hair_out_dm;
 			init_particle_interpolation(sim->ob, psys, pa, &pind);
 			do_particle_interpolation(psys, p, pa, t, &pind, state);
 
-			if(pind.dm) {
+			if (pind.dm) {
 				mul_m4_v3(sim->ob->obmat, state->co);
 				mul_mat3_m4_v3(sim->ob->obmat, state->vel);
 			}
-			else if(!keyed && !cached && !(psys->flag & PSYS_GLOBAL_HAIR)) {
-				if((pa->flag & PARS_REKEY)==0) {
+			else if (!keyed && !cached && !(psys->flag & PSYS_GLOBAL_HAIR)) {
+				if ((pa->flag & PARS_REKEY)==0) {
 					psys_mat_hair_to_global(sim->ob, sim->psmd->dm, part->from, pa, hairmat);
 					mul_m4_v3(hairmat, state->co);
 					mul_mat3_m4_v3(hairmat, state->vel);
 
-					if(sim->psys->effectors && (part->flag & PART_CHILD_GUIDE)==0) {
+					if (sim->psys->effectors && (part->flag & PART_CHILD_GUIDE)==0) {
 						do_guides(sim->psys->effectors, state, p, state->time);
 						/* TODO: proper velocity handling */
 					}
 
-					if(psys->lattice && edit==0)
+					if (psys->lattice && edit==0)
 						calc_latt_deform(psys->lattice, state->co,1.0f);
 				}
 			}
 		}
 	}
-	else if(totchild){
+	else if (totchild) {
 		//invert_m4_m4(imat,ob->obmat);
 
 		/* interpolate childcache directly if it exists */
-		if(psys->childcache) {
+		if (psys->childcache) {
 			ParticleCacheKey result;
 			interpolate_pathcache(psys->childcache[p-totpart], t, &result);
 			copy_v3_v3(state->co, result.co);
@@ -4106,19 +4117,19 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
 		else {
 			cpa=psys->child+p-totpart;
 
-			if(state->time < 0.0f)
+			if (state->time < 0.0f)
 				t = psys_get_child_time(psys, cpa, -state->time, NULL, NULL);
 		
-			if(totchild && part->childtype==PART_CHILD_FACES){
+			if (totchild && part->childtype==PART_CHILD_FACES) {
 				/* part->parents could still be 0 so we can't test with totparent */
 				between=1;
 			}
-			if(between){
+			if (between) {
 				int w = 0;
 				float foffset;
 
 				/* get parent states */
-				while(w<4 && cpa->pa[w]>=0){
+				while (w<4 && cpa->pa[w]>=0) {
 					keys[w].time = state->time;
 					psys_get_particle_on_path(sim, cpa->pa[w], keys+w, 1);
 					w++;
@@ -4140,14 +4151,14 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
 
 				pa = psys->particles + cpa->parent;
 
-				if(part->type == PART_HAIR)
+				if (part->type == PART_HAIR)
 					psys_mat_hair_to_global(sim->ob, sim->psmd->dm, psys->part->from, pa, hairmat);
 				else
 					unit_m4(hairmat);
 
 				pa=0;
 			}
-																					else{
+																					else {
 			/* get the parent state */
 			keys->time = state->time;
 			psys_get_particle_on_path(sim, cpa->parent, keys,1);
@@ -4161,7 +4172,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
 
 			
 
-			if(part->type == PART_HAIR) {
+			if (part->type == PART_HAIR) {
 				psys_particle_on_emitter(psmd,cpa_from,cpa_num,DMCACHE_ISCHILD,cpa_fuv,pa->foffset,co,0,0,0,orco,0);
 				psys_mat_hair_to_global(sim->ob, sim->psmd->dm, psys->part->from, pa, hairmat);
 			}
@@ -4173,7 +4184,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
 
 			/* correct child ipo timing */
 	#if 0 // XXX old animation system
-			if((part->flag&PART_ABS_TIME)==0 && part->ipo){
+			if ((part->flag&PART_ABS_TIME)==0 && part->ipo) {
 				calc_ipo(part->ipo, 100.0f*t);
 				execute_ipo((ID *)part, part->ipo);
 			}
@@ -4187,14 +4198,14 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
 			/* TODO: assign vertex groups */
 			get_child_modifier_parameters(part, &ctx, cpa, cpa_from, cpa_num, cpa_fuv, orco, &ptex);
 
-			if(between){
+			if (between) {
 				int w=0;
 
 				state->co[0] = state->co[1] = state->co[2] = 0.0f;
 				state->vel[0] = state->vel[1] = state->vel[2] = 0.0f;
 
 				/* child position is the weighted sum of parent positions */
-				while(w<4 && cpa->pa[w]>=0){
+				while (w<4 && cpa->pa[w]>=0) {
 					state->co[0] += cpa->w[w] * keys[w].co[0];
 					state->co[1] += cpa->w[w] * keys[w].co[1];
 					state->co[2] += cpa->w[w] * keys[w].co[2];
@@ -4207,31 +4218,31 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
 				/* apply offset for correct positioning */
 				//add_v3_v3(state->co, cpa_1st);
 			}
-			else{
+			else {
 				/* offset the child from the parent position */
 				offset_child(cpa, keys, keys->rot, state, part->childflat, part->childrad);
 			}
 
 			par = keys;
 
-			if(vel)
+			if (vel)
 				copy_particle_key(&tstate, state, 1);
 
 			/* apply different deformations to the child path */
 			do_child_modifiers(sim, &ptex, par, par->rot, cpa, orco, hairmat, state, t);
 
 			/* try to estimate correct velocity */
-			if(vel){
+			if (vel) {
 				ParticleKey tstate;
 				float length = len_v3(state->vel);
 
-				if(t>=0.001f){
+				if (t>=0.001f) {
 					tstate.time=t-0.001f;
 					psys_get_particle_on_path(sim,p,&tstate,0);
 					sub_v3_v3v3(state->vel,state->co,tstate.co);
 					normalize_v3(state->vel);
 				}
-				else{
+				else {
 					tstate.time=t+0.001f;
 					psys_get_particle_on_path(sim,p,&tstate,0);
 					sub_v3_v3v3(state->vel,tstate.co,state->co);
@@ -4257,22 +4268,25 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
 	/* negative time means "use current time" */
 	cfra = state->time > 0 ? state->time : BKE_curframe(sim->scene);
 
-	if(p>=totpart){
-		if(!psys->totchild)
+	if (p>=totpart) {
+		if (!psys->totchild)
 			return 0;
 
-		if(part->childtype == PART_CHILD_FACES){
-			if(!(psys->flag & PSYS_KEYED))
+		if (part->childtype == PART_CHILD_FACES) {
+			if (!(psys->flag & PSYS_KEYED))
 				return 0;
 
 			cpa = psys->child + p - totpart;
 
 			state->time = psys_get_child_time(psys, cpa, cfra, NULL, NULL);
 
-			if(!always)
-				if((state->time < 0.0f && !(part->flag & PART_UNBORN))
-					|| (state->time > 1.0f && !(part->flag & PART_DIED)))
+			if (!always) {
+				if ((state->time < 0.0f && !(part->flag & PART_UNBORN)) ||
+				    (state->time > 1.0f && !(part->flag & PART_DIED)))
+				{
 					return 0;
+				}
+			}
 
 			state->time= (cfra - (part->sta + (part->end - part->sta) * PSYS_FRAND(p + 23))) / (part->lifetime * PSYS_FRAND(p + 24));
 
@@ -4288,22 +4302,25 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
 		pa = sim->psys->particles + p;
 	}
 
-	if(pa) {
-		if(!always)
-			if((cfra < pa->time && (part->flag & PART_UNBORN)==0)
-				|| (cfra > pa->dietime && (part->flag & PART_DIED)==0))
+	if (pa) {
+		if (!always) {
+			if ((cfra < pa->time    && (part->flag & PART_UNBORN) == 0) ||
+			    (cfra > pa->dietime && (part->flag & PART_DIED)   == 0))
+			{
 				return 0;
+			}
+		}
 
 		cfra = MIN2(cfra, pa->dietime);
 	}
 
-	if(sim->psys->flag & PSYS_KEYED){
+	if (sim->psys->flag & PSYS_KEYED) {
 		state->time= -cfra;
 		psys_get_particle_on_path(sim, p, state,1);
 		return 1;
 	}
-	else{
-		if(cpa){
+	else {
+		if (cpa) {
 			float mat[4][4];
 			ParticleKey *key1;
 			float t = (cfra - pa->time) / pa->lifetime;
@@ -4316,19 +4333,19 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
 			unit_m4(mat);
 			do_child_modifiers(sim, NULL, key1, key1->rot, cpa, cpa->fuv, mat, state, t);
 
-			if(psys->lattice)
+			if (psys->lattice)
 				calc_latt_deform(sim->psys->lattice, state->co,1.0f);
 		}
-		else{
-			if(pa->state.time==cfra || ELEM(part->phystype,PART_PHYS_NO,PART_PHYS_KEYED))
+		else {
+			if (pa->state.time==cfra || ELEM(part->phystype,PART_PHYS_NO,PART_PHYS_KEYED))
 				copy_particle_key(state, &pa->state, 1);
-			else if(pa->prev_state.time==cfra)
+			else if (pa->prev_state.time==cfra)
 				copy_particle_key(state, &pa->prev_state, 1);
 			else {
 				float dfra, frs_sec = sim->scene->r.frs_sec;
 				/* let's interpolate to try to be as accurate as possible */
-				if(pa->state.time + 2.f >= state->time && pa->prev_state.time - 2.f <= state->time) {
-					if(pa->prev_state.time >= pa->state.time || pa->prev_state.time < 0.f) {
+				if (pa->state.time + 2.f >= state->time && pa->prev_state.time - 2.f <= state->time) {
+					if (pa->prev_state.time >= pa->state.time || pa->prev_state.time < 0.f) {
 						/* prev_state is wrong so let's not use it, this can happen at frames 1, 0 or particle birth */
 						dfra = state->time - pa->state.time;
 
@@ -4360,7 +4377,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
 						interp_qt_qtqt(state->rot, keys[1].rot, keys[2].rot, keytime);
 					}
 				}
-				else if(pa->state.time + 1.f >= state->time && pa->state.time - 1.f <= state->time) {
+				else if (pa->state.time + 1.f >= state->time && pa->state.time - 1.f <= state->time) {
 					/* linear interpolation using only pa->state */
 
 					dfra = state->time - pa->state.time;
@@ -4375,7 +4392,7 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
 				}
 			}
 
-			if(sim->psys->lattice)
+			if (sim->psys->lattice)
 				calc_latt_deform(sim->psys->lattice, state->co,1.0f);
 		}
 		
@@ -4392,11 +4409,11 @@ void psys_get_dupli_texture(ParticleSystem *psys, ParticleSettings *part, Partic
 
 	uv[0] = uv[1] = 0.f;
 
-	if(cpa) {
-		if(part->childtype == PART_CHILD_FACES) {
+	if (cpa) {
+		if (part->childtype == PART_CHILD_FACES) {
 			mtface= CustomData_get_layer(&psmd->dm->faceData, CD_MTFACE);
-			if(mtface) {
-				mface= psmd->dm->getFaceData(psmd->dm, cpa->num, CD_MFACE);
+			if (mtface) {
+				mface= psmd->dm->getTessFaceData(psmd->dm, cpa->num, CD_MFACE);
 				mtface += cpa->num;
 				psys_interpolate_uvs(mtface, mface->v4, cpa->fuv, uv);
 			}
@@ -4409,21 +4426,21 @@ void psys_get_dupli_texture(ParticleSystem *psys, ParticleSettings *part, Partic
 		}
 	}
 
-	if(part->from == PART_FROM_FACE) {
+	if (part->from == PART_FROM_FACE) {
 		mtface= CustomData_get_layer(&psmd->dm->faceData, CD_MTFACE);
 		num= pa->num_dmcache;
 
-		if(num == DMCACHE_NOTFOUND)
+		if (num == DMCACHE_NOTFOUND)
 			num= pa->num;
 
-		if (num >= psmd->dm->getNumFaces(psmd->dm)) {
+		if (num >= psmd->dm->getNumTessFaces(psmd->dm)) {
 			/* happens when simplify is enabled
-				* gives invalid coords but would crash otherwise */
+			 * gives invalid coords but would crash otherwise */
 			num= DMCACHE_NOTFOUND;
 		}
 
-		if(mtface && num != DMCACHE_NOTFOUND) {
-			mface= psmd->dm->getFaceData(psmd->dm, num, CD_MFACE);
+		if (mtface && num != DMCACHE_NOTFOUND) {
+			mface= psmd->dm->getTessFaceData(psmd->dm, num, CD_MFACE);
 			mtface += num;
 			psys_interpolate_uvs(mtface, mface->v4, pa->fuv, uv);
 		}
@@ -4443,23 +4460,23 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa
 	sub_v3_v3v3(vec, (cache+cache->steps)->co, cache->co);
 	len= normalize_v3(vec);
 
-	if(pa == NULL && psys->part->childflat != PART_CHILD_FACES)
+	if (pa == NULL && psys->part->childflat != PART_CHILD_FACES)
 		pa = psys->particles + cpa->pa[0];
 
-	if(pa)
+	if (pa)
 		psys_particle_on_emitter(psmd,sim->psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,loc,nor,0,0,0,0);
 	else
 		psys_particle_on_emitter(psmd,PART_FROM_FACE,cpa->num,DMCACHE_ISCHILD,cpa->fuv,cpa->foffset,loc,nor,0,0,0,0);
 
-	if(psys->part->rotmode == PART_ROT_VEL) {
+	if (psys->part->rotmode == PART_ROT_VEL) {
 		copy_m3_m4(nmat, ob->imat);
 		transpose_m3(nmat);
 		mul_m3_v3(nmat, nor);
 		normalize_v3(nor);
 
 		/* make sure that we get a proper side vector */
-		if(fabs(dot_v3v3(nor,vec))>0.999999) {
-			if(fabs(dot_v3v3(nor,xvec))>0.999999) {
+		if (fabs(dot_v3v3(nor,vec))>0.999999) {
+			if (fabs(dot_v3v3(nor,xvec))>0.999999) {
 				nor[0] = 0.0f;
 				nor[1] = 1.0f;
 				nor[2] = 0.0f;
@@ -4474,10 +4491,10 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa
 		normalize_v3(side);
 
 		/* rotate side vector around vec */
-		if(psys->part->phasefac != 0) {
+		if (psys->part->phasefac != 0) {
 			float q_phase[4];
 			float phasefac = psys->part->phasefac;
-			if(psys->part->randphasefac != 0.0f)
+			if (psys->part->randphasefac != 0.0f)
 				phasefac += psys->part->randphasefac * PSYS_FRAND((pa-psys->particles) + 20);
 			axis_angle_to_quat( q_phase, vec, phasefac*(float)M_PI);
 
@@ -4508,7 +4525,7 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3]
 	/* can happen with bad pointcache or physics calculation
 	 * since this becomes geometry, nan's and inf's crash raytrace code.
 	 * better not allow this. */
-	if( !finite(bb->vec[0]) || !finite(bb->vec[1]) || !finite(bb->vec[2]) ||
+	if ( !finite(bb->vec[0]) || !finite(bb->vec[1]) || !finite(bb->vec[2]) ||
 	    !finite(bb->vel[0]) || !finite(bb->vel[1]) || !finite(bb->vel[2]) )
 	{
 		zero_v3(bb->vec);
@@ -4522,22 +4539,22 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3]
 		return;
 	}
 
-	if(bb->align < PART_BB_VIEW)
+	if (bb->align < PART_BB_VIEW)
 		onevec[bb->align]=1.0f;
 
-	if(bb->lock && (bb->align == PART_BB_VIEW)) {
+	if (bb->lock && (bb->align == PART_BB_VIEW)) {
 		normalize_v3_v3(xvec, bb->ob->obmat[0]);
 		normalize_v3_v3(yvec, bb->ob->obmat[1]);
 		normalize_v3_v3(zvec, bb->ob->obmat[2]);
 	}
-	else if(bb->align == PART_BB_VEL) {
+	else if (bb->align == PART_BB_VEL) {
 		float temp[3];
 
 		normalize_v3_v3(temp, bb->vel);
 
 		sub_v3_v3v3(zvec, bb->ob->obmat[3], bb->vec);
 
-		if(bb->lock) {
+		if (bb->lock) {
 			float fac = -dot_v3v3(zvec, temp);
 
 			madd_v3_v3fl(zvec, temp, fac);
@@ -4551,11 +4568,11 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3]
 	}
 	else {
 		sub_v3_v3v3(zvec, bb->ob->obmat[3], bb->vec);
-		if(bb->lock)
+		if (bb->lock)
 			zvec[bb->align] = 0.0f;
 		normalize_v3(zvec);
 
-		if(bb->align < PART_BB_VIEW)
+		if (bb->align < PART_BB_VIEW)
 			cross_v3_v3v3(xvec, onevec, zvec);
 		else
 			cross_v3_v3v3(xvec, bb->ob->obmat[1], zvec);
@@ -4592,18 +4609,18 @@ void psys_apply_hair_lattice(Scene *scene, Object *ob, ParticleSystem *psys)
 
 	psys->lattice = psys_get_lattice(&sim);
 
-	if(psys->lattice) {
+	if (psys->lattice) {
 		ParticleData *pa = psys->particles;
 		HairKey *hkey;
 		int p, h;
 		float hairmat[4][4], imat[4][4];
 
-		for(p=0; p<psys->totpart; p++, pa++) {
+		for (p=0; p<psys->totpart; p++, pa++) {
 			psys_mat_hair_to_global(sim.ob, sim.psmd->dm, psys->part->from, pa, hairmat);
 			invert_m4_m4(imat, hairmat);
 
 			hkey = pa->hair;
-			for(h=0; h<pa->totkey; h++, hkey++) {
+			for (h=0; h<pa->totkey; h++, hkey++) {
 				mul_m4_v3(hairmat, hkey->co);
 				calc_latt_deform(psys->lattice, hkey->co, 1.0f);
 				mul_m4_v3(imat, hkey->co);
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index c00101c..4ce2495 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -113,10 +113,10 @@
 
 static int particles_are_dynamic(ParticleSystem *psys)
 {
-	if(psys->pointcache->flag & PTCACHE_BAKED)
+	if (psys->pointcache->flag & PTCACHE_BAKED)
 		return 0;
 
-	if(psys->part->type == PART_HAIR)
+	if (psys->part->type == PART_HAIR)
 		return psys->flag & PSYS_HAIR_DYNAMICS;
 	else
 		return ELEM3(psys->part->phystype, PART_PHYS_NEWTON, PART_PHYS_BOIDS, PART_PHYS_FLUID);
@@ -126,19 +126,21 @@ static int psys_get_current_display_percentage(ParticleSystem *psys)
 {
 	ParticleSettings *part=psys->part;
 
-	if((psys->renderdata && !particles_are_dynamic(psys)) /* non-dynamic particles can be rendered fully */
-		|| (part->child_nbr && part->childtype)	/* display percentage applies to children */
-		|| (psys->pointcache->flag & PTCACHE_BAKING)) /* baking is always done with full amount */
+	if ((psys->renderdata && !particles_are_dynamic(psys)) ||  /* non-dynamic particles can be rendered fully */
+	    (part->child_nbr && part->childtype)  ||    /* display percentage applies to children */
+	    (psys->pointcache->flag & PTCACHE_BAKING))  /* baking is always done with full amount */
+	{
 		return 100;
+	}
 
 	return psys->part->disp;
 }
 
 static int tot_particles(ParticleSystem *psys, PTCacheID *pid)
 {
-	if(pid && psys->pointcache->flag & PTCACHE_EXTERNAL)
+	if (pid && psys->pointcache->flag & PTCACHE_EXTERNAL)
 		return pid->cache->totpoint;
-	else if(psys->part->distr == PART_DISTR_GRID && psys->part->from != PART_FROM_VERT)
+	else if (psys->part->distr == PART_DISTR_GRID && psys->part->from != PART_FROM_VERT)
 		return psys->part->grid_res * psys->part->grid_res * psys->part->grid_res - psys->totunexist;
 	else
 		return psys->part->totpart - psys->totunexist;
@@ -148,10 +150,10 @@ void psys_reset(ParticleSystem *psys, int mode)
 {
 	PARTICLE_P;
 
-	if(ELEM(mode, PSYS_RESET_ALL, PSYS_RESET_DEPSGRAPH)) {
-		if(mode == PSYS_RESET_ALL || !(psys->flag & PSYS_EDITED)) {
+	if (ELEM(mode, PSYS_RESET_ALL, PSYS_RESET_DEPSGRAPH)) {
+		if (mode == PSYS_RESET_ALL || !(psys->flag & PSYS_EDITED)) {
 			/* don't free if not absolutely necessary */
-			if(psys->totpart != tot_particles(psys, NULL)) {
+			if (psys->totpart != tot_particles(psys, NULL)) {
 				psys_free_particles(psys);
 				psys->totpart= 0;
 			}
@@ -159,21 +161,21 @@ void psys_reset(ParticleSystem *psys, int mode)
 			psys->totkeyed= 0;
 			psys->flag &= ~(PSYS_HAIR_DONE|PSYS_KEYED);
 
-			if(psys->edit && psys->free_edit) {
+			if (psys->edit && psys->free_edit) {
 				psys->free_edit(psys->edit);
 				psys->edit = NULL;
 				psys->free_edit = NULL;
 			}
 		}
 	}
-	else if(mode == PSYS_RESET_CACHE_MISS) {
+	else if (mode == PSYS_RESET_CACHE_MISS) {
 		/* set all particles to be skipped */
 		LOOP_PARTICLES
 			pa->flag |= PARS_NO_DISP;
 	}
 
 	/* reset children */
-	if(psys->child) {
+	if (psys->child) {
 		MEM_freeN(psys->child);
 		psys->child= NULL;
 	}
@@ -186,7 +188,7 @@ void psys_reset(ParticleSystem *psys, int mode)
 	/* reset point cache */
 	BKE_ptcache_invalidate(psys->pointcache);
 
-	if(psys->fluid_springs) {
+	if (psys->fluid_springs) {
 		MEM_freeN(psys->fluid_springs);
 		psys->fluid_springs = NULL;
 	}
@@ -203,8 +205,8 @@ static void realloc_particles(ParticleSimulationData *sim, int new_totpart)
 	PARTICLE_P;
 	int totpart, totsaved = 0;
 
-	if(new_totpart<0) {
-		if(part->distr==PART_DISTR_GRID  && part->from != PART_FROM_VERT) {
+	if (new_totpart<0) {
+		if (part->distr==PART_DISTR_GRID  && part->from != PART_FROM_VERT) {
 			totpart= part->grid_res;
 			totpart*=totpart*totpart;
 		}
@@ -214,55 +216,55 @@ static void realloc_particles(ParticleSimulationData *sim, int new_totpart)
 	else
 		totpart=new_totpart;
 
-	if(totpart != psys->totpart) {
-		if(psys->edit && psys->free_edit) {
+	if (totpart != psys->totpart) {
+		if (psys->edit && psys->free_edit) {
 			psys->free_edit(psys->edit);
 			psys->edit = NULL;
 			psys->free_edit = NULL;
 		}
 
-		if(totpart) {
+		if (totpart) {
 			newpars= MEM_callocN(totpart*sizeof(ParticleData), "particles");
-			if(newpars == NULL)
+			if (newpars == NULL)
 				return;
 
-			if(psys->part->phystype == PART_PHYS_BOIDS) {
+			if (psys->part->phystype == PART_PHYS_BOIDS) {
 				newboids= MEM_callocN(totpart*sizeof(BoidParticle), "boid particles");
 
-				if(newboids == NULL) {
+				if (newboids == NULL) {
 					 /* allocation error! */
-					if(newpars)
+					if (newpars)
 						MEM_freeN(newpars);
 					return;
 				}
 			}
 		}
 	
-		if(psys->particles) {
+		if (psys->particles) {
 			totsaved=MIN2(psys->totpart,totpart);
 			/*save old pars*/
-			if(totsaved) {
+			if (totsaved) {
 				memcpy(newpars,psys->particles,totsaved*sizeof(ParticleData));
 
-				if(psys->particles->boid)
+				if (psys->particles->boid)
 					memcpy(newboids, psys->particles->boid, totsaved*sizeof(BoidParticle));
 			}
 
-			if(psys->particles->keys)
+			if (psys->particles->keys)
 				MEM_freeN(psys->particles->keys);
 
-			if(psys->particles->boid)
+			if (psys->particles->boid)
 				MEM_freeN(psys->particles->boid);
 
-			for(p=0, pa=newpars; p<totsaved; p++, pa++) {
-				if(pa->keys) {
+			for (p=0, pa=newpars; p<totsaved; p++, pa++) {
+				if (pa->keys) {
 					pa->keys= NULL;
 					pa->totkey= 0;
 				}
 			}
 
-			for(p=totsaved, pa=psys->particles+totsaved; p<psys->totpart; p++, pa++)
-				if(pa->hair) MEM_freeN(pa->hair);
+			for (p=totsaved, pa=psys->particles+totsaved; p<psys->totpart; p++, pa++)
+				if (pa->hair) MEM_freeN(pa->hair);
 
 			MEM_freeN(psys->particles);
 			psys_free_pdd(psys);
@@ -271,13 +273,13 @@ static void realloc_particles(ParticleSimulationData *sim, int new_totpart)
 		psys->particles=newpars;
 		psys->totpart=totpart;
 
-		if(newboids) {
+		if (newboids) {
 			LOOP_PARTICLES
 				pa->boid = newboids++;
 		}
 	}
 
-	if(psys->child) {
+	if (psys->child) {
 		MEM_freeN(psys->child);
 		psys->child=NULL;
 		psys->totchild=0;
@@ -288,10 +290,10 @@ static int get_psys_child_number(struct Scene *scene, ParticleSystem *psys)
 {
 	int nbr;
 
-	if(!psys->part->childtype)
+	if (!psys->part->childtype)
 		return 0;
 
-	if(psys->renderdata)
+	if (psys->renderdata)
 		nbr= psys->part->ren_child_nbr;
 	else
 		nbr= psys->part->child_nbr;
@@ -306,9 +308,9 @@ static int get_psys_tot_child(struct Scene *scene, ParticleSystem *psys)
 
 static void alloc_child_particles(ParticleSystem *psys, int tot)
 {
-	if(psys->child){
+	if (psys->child) {
 		/* only re-allocate if we have to */
-		if(psys->part->childtype && psys->totchild == tot) {
+		if (psys->part->childtype && psys->totchild == tot) {
 			memset(psys->child, 0, tot*sizeof(ChildParticle));
 			return;
 		}
@@ -318,9 +320,9 @@ static void alloc_child_particles(ParticleSystem *psys, int tot)
 		psys->totchild=0;
 	}
 
-	if(psys->part->childtype) {
+	if (psys->part->childtype) {
 		psys->totchild= tot;
-		if(psys->totchild)
+		if (psys->totchild)
 			psys->child= MEM_callocN(psys->totchild*sizeof(ChildParticle), "child_particles");
 	}
 }
@@ -332,39 +334,39 @@ static void alloc_child_particles(ParticleSystem *psys, int tot)
 void psys_calc_dmcache(Object *ob, DerivedMesh *dm, ParticleSystem *psys)
 {
 	/* use for building derived mesh mapping info:
-
-	   node: the allocated links - total derived mesh element count 
-	   nodearray: the array of nodes aligned with the base mesh's elements, so
-				  each original elements can reference its derived elements
-	*/
+	 *
+	 * node: the allocated links - total derived mesh element count 
+	 * nodearray: the array of nodes aligned with the base mesh's elements, so
+	 *            each original elements can reference its derived elements
+	 */
 	Mesh *me= (Mesh*)ob->data;
 	PARTICLE_P;
 	
 	/* CACHE LOCATIONS */
-	if(!dm->deformedOnly) {
+	if (!dm->deformedOnly) {
 		/* Will use later to speed up subsurf/derivedmesh */
 		LinkNode *node, *nodedmelem, **nodearray;
 		int totdmelem, totelem, i, *origindex;
 
-		if(psys->part->from == PART_FROM_VERT) {
+		if (psys->part->from == PART_FROM_VERT) {
 			totdmelem= dm->getNumVerts(dm);
 			totelem= me->totvert;
 			origindex= dm->getVertDataArray(dm, CD_ORIGINDEX);
 		}
 		else { /* FROM_FACE/FROM_VOLUME */
-			totdmelem= dm->getNumFaces(dm);
-			totelem= me->totface;
-			origindex= dm->getFaceDataArray(dm, CD_ORIGINDEX);
+			totdmelem= dm->getNumTessFaces(dm);
+			totelem= me->totpoly;
+			origindex= dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
 		}
 	
 		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++) {
+		for (i=0, node=nodedmelem; i<totdmelem; i++, origindex++, node++) {
 			node->link= SET_INT_IN_POINTER(i);
 
-			if(*origindex != -1) {
-				if(nodearray[*origindex]) {
+			if (*origindex != -1) {
+				if (nodearray[*origindex]) {
 					/* prepend */
 					node->next = nodearray[*origindex];
 					nodearray[*origindex]= node;
@@ -376,13 +378,13 @@ void psys_calc_dmcache(Object *ob, DerivedMesh *dm, ParticleSystem *psys)
 		
 		/* cache the verts/faces! */
 		LOOP_PARTICLES {
-			if(pa->num < 0) {
+			if (pa->num < 0) {
 				pa->num_dmcache = -1;
 				continue;
 			}
 
-			if(psys->part->from == PART_FROM_VERT) {
-				if(nodearray[pa->num])
+			if (psys->part->from == PART_FROM_VERT) {
+				if (nodearray[pa->num])
 					pa->num_dmcache= GET_INT_FROM_POINTER(nodearray[pa->num]->link);
 			}
 			else { /* FROM_FACE/FROM_VOLUME */
@@ -398,7 +400,7 @@ void psys_calc_dmcache(Object *ob, DerivedMesh *dm, ParticleSystem *psys)
 	else {
 		/* TODO PARTICLE, make the following line unnecessary, each function
 		 * should know to use the num or num_dmcache, set the num_dmcache to
-		 * an invalid value, just incase */
+		 * an invalid value, just in case */
 		
 		LOOP_PARTICLES
 			pa->num_dmcache = -1;
@@ -415,13 +417,13 @@ static void distribute_simple_children(Scene *scene, Object *ob, DerivedMesh *fi
 	alloc_child_particles(psys, totpart);
 
 	cpa = psys->child;
-	for(i=0; i<child_nbr; i++){
-		for(p=0; p<psys->totpart; p++,cpa++){
+	for (i=0; i<child_nbr; i++) {
+		for (p=0; p<psys->totpart; p++,cpa++) {
 			float length=2.0;
 			cpa->parent=p;
 					
 			/* create even spherical distribution inside unit sphere */
-			while(length>=1.0f){
+			while (length>=1.0f) {
 				cpa->fuv[0]=2.0f*BLI_frand()-1.0f;
 				cpa->fuv[1]=2.0f*BLI_frand()-1.0f;
 				cpa->fuv[2]=2.0f*BLI_frand()-1.0f;
@@ -449,7 +451,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
 	copy_v3_v3(max, mv->co);
 	mv++;
 
-	for(i=1; i<totvert; i++, 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]);
@@ -483,9 +485,9 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
 	min[1]+= d < delta[1] ? d/2.f : delta[1]/2.f;
 	min[2]+= d < delta[2] ? d/2.f : delta[2]/2.f;
 
-	for(i=0,p=0,pa=psys->particles; i<res; i++){
-		for(j=0; j<res; j++){
-			for(k=0; k<res; k++,p++,pa++){
+	for (i=0,p=0,pa=psys->particles; i<res; i++) {
+		for (j=0; j<res; j++) {
+			for (k=0; k<res; k++,p++,pa++) {
 				pa->fuv[0] = min[0] + (float)i*d;
 				pa->fuv[1] = min[1] + (float)j*d;
 				pa->fuv[2] = min[2] + (float)k*d;
@@ -496,7 +498,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
 	}
 
 	/* enable particles near verts/edges/faces/inside surface */
-	if(from==PART_FROM_VERT){
+	if (from==PART_FROM_VERT) {
 		float vec[3];
 
 		pa=psys->particles;
@@ -505,7 +507,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
 		min[1] -= d/2.0f;
 		min[2] -= d/2.0f;
 
-		for(i=0,mv=mvert; i<totvert; i++,mv++){
+		for (i=0,mv=mvert; i<totvert; i++,mv++) {
 			sub_v3_v3v3(vec,mv->co,min);
 			vec[0]/=delta[0];
 			vec[1]/=delta[1];
@@ -515,7 +517,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
 				+(int)(vec[2]*(size[2]-1)))->flag &= ~PARS_UNEXIST;
 		}
 	}
-	else if(ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)){
+	else if (ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)) {
 		float co1[3], co2[3];
 
 		MFace *mface= NULL, *mface_array;
@@ -523,16 +525,16 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
 		int a, a1, a2, a0mul, a1mul, a2mul, totface;
 		int amax= from==PART_FROM_FACE ? 3 : 1;
 
-		totface=dm->getNumFaces(dm);
-		mface_array= dm->getFaceDataArray(dm,CD_MFACE);
+		totface=dm->getNumTessFaces(dm);
+		mface=mface_array=dm->getTessFaceDataArray(dm,CD_MFACE);
 		
-		for(a=0; a<amax; a++){
-			if(a==0){ a0mul=res*res; a1mul=res; a2mul=1; }
-			else if(a==1){ a0mul=res; a1mul=1; a2mul=res*res; }
-			else{ a0mul=1; a1mul=res*res; a2mul=res; }
+		for (a=0; a<amax; a++) {
+			if (a==0) { a0mul=res*res; a1mul=res; a2mul=1; }
+			else if (a==1) { a0mul=res; a1mul=1; a2mul=res*res; }
+			else { a0mul=1; a1mul=res*res; a2mul=res; }
 
-			for(a1=0; a1<size[(a+1)%3]; a1++){
-				for(a2=0; a2<size[(a+2)%3]; a2++){
+			for (a1=0; a1<size[(a+1)%3]; a1++) {
+				for (a2=0; a2<size[(a+2)%3]; a2++) {
 					mface= mface_array;
 
 					pa = psys->particles + a1*a1mul + a2*a2mul;
@@ -543,23 +545,23 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
 					co1[a] -= 0.001f*d;
 					
 					/* lets intersect the faces */
-					for(i=0; i<totface; i++,mface++){
+					for (i=0; i<totface; i++,mface++) {
 						copy_v3_v3(v1, mvert[mface->v1].co);
 						copy_v3_v3(v2, mvert[mface->v2].co);
 						copy_v3_v3(v3, mvert[mface->v3].co);
 
-						if(isect_axial_line_tri_v3(a, co1, co2, v2, v3, v1, &lambda)){
-							if(from==PART_FROM_FACE)
+						if (isect_axial_line_tri_v3(a, co1, co2, v2, v3, v1, &lambda)) {
+							if (from==PART_FROM_FACE)
 								(pa+(int)(lambda*size[a])*a0mul)->flag &= ~PARS_UNEXIST;
 							else /* store number of intersections */
 								(pa+(int)(lambda*size[a])*a0mul)->hair_index++;
 						}
 						
-						if(mface->v4){
+						if (mface->v4) {
 							copy_v3_v3(v4, mvert[mface->v4].co);
 
-							if(isect_axial_line_tri_v3(a, co1, co2, v4, v1, v3, &lambda)){
-								if(from==PART_FROM_FACE)
+							if (isect_axial_line_tri_v3(a, co1, co2, v4, v1, v3, &lambda)) {
+								if (from==PART_FROM_FACE)
 									(pa+(int)(lambda*size[a])*a0mul)->flag &= ~PARS_UNEXIST;
 								else
 									(pa+(int)(lambda*size[a])*a0mul)->hair_index++;
@@ -567,11 +569,11 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
 						}
 					}
 
-					if(from==PART_FROM_VOLUME){
+					if (from==PART_FROM_VOLUME) {
 						int in=pa->hair_index%2;
-						if(in) pa->hair_index++;
-						for(i=0; i<size[0]; i++){
-							if(in || (pa+i*a0mul)->hair_index%2)
+						if (in) pa->hair_index++;
+						for (i=0; i<size[0]; i++) {
+							if (in || (pa+i*a0mul)->hair_index%2)
 								(pa+i*a0mul)->flag &= ~PARS_UNEXIST;
 							/* odd intersections == in->out / out->in */
 							/* even intersections -> in stays same */
@@ -583,14 +585,14 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
 		}
 	}
 
-	if(psys->part->flag & PART_GRID_HEXAGONAL) {
-		for(i=0,p=0,pa=psys->particles; i<res; i++){
-			for(j=0; j<res; j++){
-				for(k=0; k<res; k++,p++,pa++){
-					if(j%2)
+	if (psys->part->flag & PART_GRID_HEXAGONAL) {
+		for (i=0,p=0,pa=psys->particles; i<res; i++) {
+			for (j=0; j<res; j++) {
+				for (k=0; k<res; k++,p++,pa++) {
+					if (j%2)
 						pa->fuv[0] += d/2.f;
 
-					if(k%2) {
+					if (k%2) {
 						pa->fuv[0] += d/2.f;
 						pa->fuv[1] += d/2.f;
 					}
@@ -599,21 +601,21 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
 		}
 	}
 
-	if(psys->part->flag & PART_GRID_INVERT){
-		for(i=0; i<size[0]; i++){
-			for(j=0; j<size[1]; j++){
+	if (psys->part->flag & PART_GRID_INVERT) {
+		for (i=0; i<size[0]; i++) {
+			for (j=0; j<size[1]; j++) {
 				pa=psys->particles + res*(i*res + j);
-				for(k=0; k<size[2]; k++, pa++){
+				for (k=0; k<size[2]; k++, pa++) {
 					pa->flag ^= PARS_UNEXIST;
 				}
 			}
 		}
 	}
 
-	if(psys->part->grid_rand > 0.f) {
+	if (psys->part->grid_rand > 0.f) {
 		float rfac = d * psys->part->grid_rand;
-		for(p=0,pa=psys->particles; p<psys->totpart; p++,pa++){
-			if(pa->flag & PARS_UNEXIST)
+		for (p=0,pa=psys->particles; p<psys->totpart; p++,pa++) {
+			if (pa->flag & PARS_UNEXIST)
 				continue;
 
 			pa->fuv[0] += rfac * (PSYS_FRAND(p + 31) - 0.5f);
@@ -653,7 +655,7 @@ static void init_mv_jit(float *jit, int num, int seed2, float amount)
 	float *jit2, x, rad1, rad2, rad3;
 	int i, num2;
 
-	if(num==0) return;
+	if (num==0) return;
 
 	rad1= (float)(1.0f/sqrtf((float)num));
 	rad2= (float)(1.0f/((float)num));
@@ -662,7 +664,7 @@ static void init_mv_jit(float *jit, int num, int seed2, float amount)
 	rng = rng_new(31415926 + num + seed2);
 	x= 0;
 		num2 = 2 * num;
-	for(i=0; i<num2; i+=2) {
+	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));
@@ -689,8 +691,8 @@ static void psys_uv_to_w(float u, float v, int quad, float *w)
 {
 	float vert[4][3], co[3];
 
-	if(!quad) {
-		if(u+v > 1.0f)
+	if (!quad) {
+		if (u+v > 1.0f)
 			v= 1.0f-v;
 		else
 			u= 1.0f-u;
@@ -704,7 +706,7 @@ static void psys_uv_to_w(float u, float v, int quad, float *w)
 	co[1]= v;
 	co[2]= 0.0f;
 
-	if(quad) {
+	if (quad) {
 		vert[3][0]= 0.0f; vert[3][1]= 1.0f; vert[3][2]= 0.0f;
 		interp_weights_poly_v3( w,vert, 4, co);
 	}
@@ -719,18 +721,18 @@ static int distribute_binary_search(float *sum, int n, float value)
 {
 	int mid, low=0, high=n;
 
-	if(value == 0.f)
+	if (value == 0.f)
 		return 0;
 
-	while(low <= high) {
+	while (low <= high) {
 		mid= (low + high)/2;
 		
-		if(sum[mid] < value && value <= sum[mid+1])
+		if (sum[mid] < value && value <= sum[mid+1])
 			return mid;
 		
-		if(sum[mid] >= value)
+		if (sum[mid] >= value)
 			high= mid - 1;
-		else if(sum[mid] < value)
+		else if (sum[mid] < value)
 			low= mid + 1;
 		else
 			return mid;
@@ -758,14 +760,14 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
 	int i, intersect, tot;
 	int rng_skip_tot= PSYS_RND_DIST_SKIP; /* count how many rng_* calls wont need skipping */
 
-	if(from == PART_FROM_VERT) {
+	if (from == PART_FROM_VERT) {
 		/* TODO_PARTICLE - use original index */
 		pa->num= ctx->index[p];
 		pa->fuv[0] = 1.0f;
 		pa->fuv[1] = pa->fuv[2] = pa->fuv[3] = 0.0;
 
 #if ONLY_WORKING_WITH_PA_VERTS
-		if(ctx->tree){
+		if (ctx->tree) {
 			KDTreeNearest ptn[3];
 			int w, maxw;
 
@@ -773,22 +775,22 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
 			transform_mesh_orco_verts((Mesh*)ob->data, &orco1, 1, 1);
 			maxw = BLI_kdtree_find_n_nearest(ctx->tree,3,orco1,NULL,ptn);
 
-			for(w=0; w<maxw; w++){
+			for (w=0; w<maxw; w++) {
 				pa->verts[w]=ptn->num;
 			}
 		}
 #endif
 	}
-	else if(from == PART_FROM_FACE || from == PART_FROM_VOLUME) {
+	else if (from == PART_FROM_FACE || from == PART_FROM_VOLUME) {
 		MFace *mface;
 
 		pa->num = i = ctx->index[p];
-		mface = dm->getFaceData(dm,i,CD_MFACE);
+		mface = dm->getTessFaceData(dm,i,CD_MFACE);
 		
-		switch(distr){
+		switch(distr) {
 		case PART_DISTR_JIT:
-			if(ctx->jitlevel == 1) {
-				if(mface->v4)
+			if (ctx->jitlevel == 1) {
+				if (mface->v4)
 					psys_uv_to_w(0.5f, 0.5f, mface->v4, pa->fuv);
 				else
 					psys_uv_to_w(0.33333f, 0.33333f, mface->v4, pa->fuv);
@@ -810,10 +812,10 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
 		pa->foffset= 0.0f;
 		
 		/* experimental */
-		if(from==PART_FROM_VOLUME){
+		if (from==PART_FROM_VOLUME) {
 			MVert *mvert=dm->getVertDataArray(dm,CD_MVERT);
 
-			tot=dm->getNumFaces(dm);
+			tot=dm->getNumTessFaces(dm);
 
 			psys_interpolate_face(mvert,mface,0,0,pa->fuv,co1,nor,0,0,0,0);
 
@@ -825,25 +827,25 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
 			min_d=2.0;
 			intersect=0;
 
-			for(i=0,mface=dm->getFaceDataArray(dm,CD_MFACE); i<tot; i++,mface++){
-				if(i==pa->num) continue;
+			for (i=0,mface=dm->getTessFaceDataArray(dm,CD_MFACE); i<tot; i++,mface++) {
+				if (i==pa->num) continue;
 
 				v1=mvert[mface->v1].co;
 				v2=mvert[mface->v2].co;
 				v3=mvert[mface->v3].co;
 
-				if(isect_line_tri_v3(co1, co2, v2, v3, v1, &cur_d, 0)){
-					if(cur_d<min_d){
+				if (isect_line_tri_v3(co1, co2, v2, v3, v1, &cur_d, 0)) {
+					if (cur_d<min_d) {
 						min_d=cur_d;
 						pa->foffset=cur_d*50.0f; /* to the middle of volume */
 						intersect=1;
 					}
 				}
-				if(mface->v4){
+				if (mface->v4) {
 					v4=mvert[mface->v4].co;
 
-					if(isect_line_tri_v3(co1, co2, v4, v1, v3, &cur_d, 0)){
-						if(cur_d<min_d){
+					if (isect_line_tri_v3(co1, co2, v4, v1, v3, &cur_d, 0)) {
+						if (cur_d<min_d) {
 							min_d=cur_d;
 							pa->foffset=cur_d*50.0f; /* to the middle of volume */
 							intersect=1;
@@ -851,9 +853,9 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
 					}
 				}
 			}
-			if(intersect==0)
+			if (intersect==0)
 				pa->foffset=0.0;
-			else switch(distr){
+			else switch(distr) {
 				case PART_DISTR_JIT:
 					pa->foffset*= ctx->jit[p%(2*ctx->jitlevel)];
 					break;
@@ -863,17 +865,17 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
 			}
 		}
 	}
-	else if(from == PART_FROM_CHILD) {
+	else if (from == PART_FROM_CHILD) {
 		MFace *mf;
 
-		if(ctx->index[p] < 0) {
+		if (ctx->index[p] < 0) {
 			cpa->num=0;
 			cpa->fuv[0]=cpa->fuv[1]=cpa->fuv[2]=cpa->fuv[3]=0.0f;
 			cpa->pa[0]=cpa->pa[1]=cpa->pa[2]=cpa->pa[3]=0;
 			return;
 		}
 
-		mf= dm->getFaceData(dm, ctx->index[p], CD_MFACE);
+		mf= dm->getTessFaceData(dm, ctx->index[p], CD_MFACE);
 
 		randu= rng_getFloat(thread->rng);
 		randv= rng_getFloat(thread->rng);
@@ -883,7 +885,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
 
 		cpa->num = ctx->index[p];
 
-		if(ctx->tree){
+		if (ctx->tree) {
 			KDTreeNearest ptn[10];
 			int w,maxw;//, do_seams;
 			float maxd /*, mind,dd */, totw= 0.0f;
@@ -898,36 +900,36 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
 			/* mind=ptn[0].dist; */ /* UNUSED */
 			
 			/* the weights here could be done better */
-			for(w=0; w<maxw; w++){
+			for (w=0; w<maxw; w++) {
 				parent[w]=ptn[w].index;
 				pweight[w]=(float)pow(2.0,(double)(-6.0f*ptn[w].dist/maxd));
 			}
-			for(;w<10; w++){
+			for (;w<10; w++) {
 				parent[w]=-1;
 				pweight[w]=0.0f;
 			}
 
-			for(w=0,i=0; w<maxw && i<4; w++){
-				if(parent[w]>=0){
+			for (w=0,i=0; w<maxw && i<4; w++) {
+				if (parent[w]>=0) {
 					cpa->pa[i]=parent[w];
 					cpa->w[i]=pweight[w];
 					totw+=pweight[w];
 					i++;
 				}
 			}
-			for(;i<4; i++){
+			for (;i<4; i++) {
 				cpa->pa[i]=-1;
 				cpa->w[i]=0.0f;
 			}
 
-			if(totw>0.0f) for(w=0; w<4; w++)
+			if (totw>0.0f) for (w=0; w<4; w++)
 				cpa->w[w]/=totw;
 
 			cpa->parent=cpa->pa[0];
 		}
 	}
 
-	if(rng_skip_tot > 0) /* should never be below zero */
+	if (rng_skip_tot > 0) /* should never be below zero */
 		rng_skip(thread->rng, rng_skip_tot);
 }
 
@@ -939,15 +941,15 @@ static void *distribute_threads_exec_cb(void *data)
 	ChildParticle *cpa;
 	int p, totpart;
 
-	if(thread->ctx->from == PART_FROM_CHILD) {
+	if (thread->ctx->from == PART_FROM_CHILD) {
 		totpart= psys->totchild;
 		cpa= psys->child;
 
-		for(p=0; p<totpart; p++, cpa++) {
-			if(thread->ctx->skip) /* simplification skip */
+		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]);
 
-			if((p+thread->num) % thread->tot == 0)
+			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);
@@ -956,7 +958,7 @@ static void *distribute_threads_exec_cb(void *data)
 	else {
 		totpart= psys->totpart;
 		pa= psys->particles + thread->num;
-		for(p=thread->num; p<totpart; p+=thread->tot, pa+=thread->tot)
+		for (p=thread->num; p<totpart; p+=thread->tot, pa+=thread->tot)
 			distribute_threads_exec(thread, pa, NULL, p);
 	}
 
@@ -970,14 +972,14 @@ 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];
 
-	if(index1 < index2)
+	if (index1 < index2)
 		return -1;
-	else if(index1 == index2) {
+	else if (index1 == index2) {
 		/* this pointer comparison appears to make qsort stable for glibc,
-		 * and apparently on solaris too, makes the renders reproducable */
-		if(p1 < p2)
+		 * and apparently on solaris too, makes the renders reproducible */
+		if (p1 < p2)
 			return -1;
-		else if(p1 == p2)
+		else if (p1 == p2)
 			return 0;
 		else
 			return 1;
@@ -988,12 +990,12 @@ static int distribute_compare_orig_index(const void *p1, const void *p2)
 
 static void distribute_invalid(Scene *scene, ParticleSystem *psys, int from)
 {
-	if(from == PART_FROM_CHILD) {
+	if (from == PART_FROM_CHILD) {
 		ChildParticle *cpa;
 		int p, totchild = get_psys_tot_child(scene, psys);
 
-		if(psys->child && totchild) {
-			for(p=0,cpa=psys->child; p<totchild; p++,cpa++){
+		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->foffset= 0.0f;
 				cpa->parent=0;
@@ -1032,24 +1034,24 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
 	float *element_weight=NULL,*element_sum=NULL,*jitter_offset=NULL, *vweight=NULL;
 	float cur, maxweight=0.0, tweight, totweight, inv_totweight, co[3], nor[3], orco[3], ornor[3];
 	
-	if(ELEM3(NULL, ob, psys, psys->part))
+	if (ELEM3(NULL, ob, psys, psys->part))
 		return 0;
 
 	part=psys->part;
 	totpart=psys->totpart;
-	if(totpart==0)
+	if (totpart==0)
 		return 0;
 
-	if (!finaldm->deformedOnly && !finaldm->getFaceDataArray(finaldm, CD_ORIGINDEX)) {
+	if (!finaldm->deformedOnly && !finaldm->getTessFaceDataArray(finaldm, CD_ORIGINDEX)) {
 		printf("Can't create particles with the current modifier stack, disable destructive modifiers\n");
 // XXX		error("Can't paint with the current modifier stack, disable destructive modifiers");
 		return 0;
 	}
 
 	/* First handle special cases */
-	if(from == PART_FROM_CHILD) {
+	if (from == PART_FROM_CHILD) {
 		/* Simple children */
-		if(part->childtype != PART_CHILD_FACES) {
+		if (part->childtype != PART_CHILD_FACES) {
 			BLI_srandom(31415926 + psys->seed + psys->child_seed);
 			distribute_simple_children(scene, ob, finaldm, psys);
 			return 0;
@@ -1057,7 +1059,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
 	}
 	else {
 		/* Grid distribution */
-		if(part->distr==PART_DISTR_GRID && from != PART_FROM_VERT){
+		if (part->distr==PART_DISTR_GRID && from != PART_FROM_VERT) {
 			BLI_srandom(31415926 + psys->seed);
 			dm= CDDM_from_mesh((Mesh*)ob->data, ob);
 			distribute_grid(dm,psys);
@@ -1067,15 +1069,19 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
 	}
 	
 	/* Create trees and original coordinates if needed */
-	if(from == PART_FROM_CHILD) {
+	if (from == PART_FROM_CHILD) {
 		distr=PART_DISTR_RAND;
 		BLI_srandom(31415926 + psys->seed + psys->child_seed);
 		dm= finaldm;
+
+		/* BMESH ONLY */
+		DM_ensure_tessface(dm);
+
 		children=1;
 
 		tree=BLI_kdtree_new(totpart);
 
-		for(p=0,pa=psys->particles; p<totpart; p++,pa++){
+		for (p=0,pa=psys->particles; p<totpart; p++,pa++) {
 			psys_particle_on_dm(dm,part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,nor,0,0,orco,ornor);
 			transform_mesh_orco_verts((Mesh*)ob->data, &orco, 1, 1);
 			BLI_kdtree_insert(tree, p, orco, ornor);
@@ -1092,18 +1098,23 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
 		
 		dm= CDDM_from_mesh((Mesh*)ob->data, ob);
 
+		/* BMESH ONLY, for verts we don't care about tessfaces */
+		if (from != PART_FROM_VERT) {
+			DM_ensure_tessface(dm);
+		}
+
 		/* we need orco for consistent distributions */
 		DM_add_vert_layer(dm, CD_ORCO, CD_ASSIGN, get_mesh_orco_verts(ob));
 
-		if(from == PART_FROM_VERT) {
+		if (from == PART_FROM_VERT) {
 			MVert *mv= dm->getVertDataArray(dm, CD_MVERT);
 			float (*orcodata)[3]= dm->getVertDataArray(dm, CD_ORCO);
 			int totvert = dm->getNumVerts(dm);
 
 			tree=BLI_kdtree_new(totvert);
 
-			for(p=0; p<totvert; p++) {
-				if(orcodata) {
+			for (p=0; p<totvert; p++) {
+				if (orcodata) {
 					copy_v3_v3(co,orcodata[p]);
 					transform_mesh_orco_verts((Mesh*)ob->data, &co, 1, 1);
 				}
@@ -1117,15 +1128,15 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
 	}
 
 	/* Get total number of emission elements and allocate needed arrays */
-	totelem = (from == PART_FROM_VERT) ? dm->getNumVerts(dm) : dm->getNumFaces(dm);
+	totelem = (from == PART_FROM_VERT) ? dm->getNumVerts(dm) : dm->getNumTessFaces(dm);
 
-	if(totelem == 0){
+	if (totelem == 0) {
 		distribute_invalid(scene, psys, children ? PART_FROM_CHILD : 0);
 
-		if(G.f & G_DEBUG)
+		if (G.debug & G_DEBUG)
 			fprintf(stderr,"Particle distribution error: Nothing to emit from!\n");
 
-		if(dm != finaldm) dm->release(dm);
+		if (dm != finaldm) dm->release(dm);
 
 		BLI_kdtree_free(tree);
 
@@ -1138,24 +1149,24 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
 	jitter_offset	= MEM_callocN(sizeof(float)*totelem, "particle_distribution_jitoff");
 
 	/* Calculate weights from face areas */
-	if((part->flag&PART_EDISTR || children) && from != PART_FROM_VERT){
+	if ((part->flag&PART_EDISTR || children) && from != PART_FROM_VERT) {
 		MVert *v1, *v2, *v3, *v4;
 		float totarea=0.f, co1[3], co2[3], co3[3], co4[3];
 		float (*orcodata)[3];
 		
 		orcodata= dm->getVertDataArray(dm, CD_ORCO);
 
-		for(i=0; i<totelem; i++){
-			MFace *mf=dm->getFaceData(dm,i,CD_MFACE);
+		for (i=0; i<totelem; i++) {
+			MFace *mf=dm->getTessFaceData(dm,i,CD_MFACE);
 
-			if(orcodata) {
+			if (orcodata) {
 				copy_v3_v3(co1, orcodata[mf->v1]);
 				copy_v3_v3(co2, orcodata[mf->v2]);
 				copy_v3_v3(co3, orcodata[mf->v3]);
 				transform_mesh_orco_verts((Mesh*)ob->data, &co1, 1, 1);
 				transform_mesh_orco_verts((Mesh*)ob->data, &co2, 1, 1);
 				transform_mesh_orco_verts((Mesh*)ob->data, &co3, 1, 1);
-				if(mf->v4) {
+				if (mf->v4) {
 					copy_v3_v3(co4, orcodata[mf->v4]);
 					transform_mesh_orco_verts((Mesh*)ob->data, &co4, 1, 1);
 				}
@@ -1167,7 +1178,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
 				copy_v3_v3(co1, v1->co);
 				copy_v3_v3(co2, v2->co);
 				copy_v3_v3(co3, v3->co);
-				if(mf->v4) {
+				if (mf->v4) {
 					v4= (MVert*)dm->getVertData(dm,mf->v4,CD_MVERT);
 					copy_v3_v3(co4, v4->co);
 				}
@@ -1175,21 +1186,21 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
 
 			cur = mf->v4 ? area_quad_v3(co1, co2, co3, co4) : area_tri_v3(co1, co2, co3);
 			
-			if(cur > maxweight)
+			if (cur > maxweight)
 				maxweight = cur;
 
 			element_weight[i] = cur;
 			totarea += cur;
 		}
 
-		for(i=0; i<totelem; i++)
+		for (i=0; i<totelem; i++)
 			element_weight[i] /= totarea;
 
 		maxweight /= totarea;
 	}
-	else{
+	else {
 		float min=1.0f/(float)(MIN2(totelem,totpart));
-		for(i=0; i<totelem; i++)
+		for (i=0; i<totelem; i++)
 			element_weight[i]=min;
 		maxweight=min;
 	}
@@ -1197,17 +1208,17 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
 	/* Calculate weights from vgroup */
 	vweight = psys_cache_vgroup(dm,psys,PSYS_VG_DENSITY);
 
-	if(vweight){
-		if(from==PART_FROM_VERT) {
-			for(i=0;i<totelem; i++)
+	if (vweight) {
+		if (from==PART_FROM_VERT) {
+			for (i=0;i<totelem; i++)
 				element_weight[i]*=vweight[i];
 		}
 		else { /* PART_FROM_FACE / PART_FROM_VOLUME */
-			for(i=0;i<totelem; i++){
-				MFace *mf=dm->getFaceData(dm,i,CD_MFACE);
+			for (i=0;i<totelem; i++) {
+				MFace *mf=dm->getTessFaceData(dm,i,CD_MFACE);
 				tweight = vweight[mf->v1] + vweight[mf->v2] + vweight[mf->v3];
 				
-				if(mf->v4) {
+				if (mf->v4) {
 					tweight += vweight[mf->v4];
 					tweight /= 4.0f;
 				}
@@ -1223,21 +1234,21 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
 
 	/* Calculate total weight of all elements */
 	totweight= 0.0f;
-	for(i=0;i<totelem; i++)
+	for (i=0;i<totelem; i++)
 		totweight += element_weight[i];
 
 	inv_totweight = (totweight > 0.f ? 1.f/totweight : 0.f);
 
 	/* Calculate cumulative weights */
 	element_sum[0]= 0.0f;
-	for(i=0; i<totelem; i++)
+	for (i=0; i<totelem; i++)
 		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)) {
+	if ((part->flag&PART_TRAND) || (part->simplify_flag&PART_SIMPLIFY_ENABLE)) {
 		float pos;
 
-		for(p=0; p<totpart; p++) {
+		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);
@@ -1252,14 +1263,14 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
 		pos= 1e-6; /* tiny offset to avoid zero weight face */
 		i= 0;
 
-		for(p=0; p<totpart; p++, pos+=step) {
-			while((i < totelem) && (pos > element_sum[i+1]))
+		for (p=0; p<totpart; p++, pos+=step) {
+			while ((i < totelem) && (pos > element_sum[i+1]))
 				i++;
 
 			particle_element[p]= MIN2(totelem-1, i);
 
 			/* avoid zero weight face */
-			if(p == totpart-1 && element_weight[particle_element[p]] == 0.0f)
+			if (p == totpart-1 && element_weight[particle_element[p]] == 0.0f)
 				particle_element[p]= particle_element[p-1];
 
 			jitter_offset[particle_element[p]]= pos;
@@ -1268,34 +1279,34 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
 
 	MEM_freeN(element_sum);
 
-	/* For hair, sort by origindex (allows optimizations in rendering), */
+	/* For hair, sort by origindex (allows optimization's in rendering), */
 	/* however with virtual parents the children need to be in random order. */
-	if(part->type == PART_HAIR && !(part->childtype==PART_CHILD_FACES && part->parents!=0.0f)) {
+	if (part->type == PART_HAIR && !(part->childtype==PART_CHILD_FACES && part->parents!=0.0f)) {
 		COMPARE_ORIG_INDEX = NULL;
 
-		if(from == PART_FROM_VERT) {
-			if(dm->numVertData)
+		if (from == PART_FROM_VERT) {
+			if (dm->numVertData)
 				COMPARE_ORIG_INDEX= dm->getVertDataArray(dm, CD_ORIGINDEX);
 		}
 		else {
-			if(dm->numFaceData)
-				COMPARE_ORIG_INDEX= dm->getFaceDataArray(dm, CD_ORIGINDEX);
+			if (dm->numTessFaceData)
+				COMPARE_ORIG_INDEX= dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
 		}
 
-		if(COMPARE_ORIG_INDEX) {
+		if (COMPARE_ORIG_INDEX) {
 			qsort(particle_element, totpart, sizeof(int), distribute_compare_orig_index);
 			COMPARE_ORIG_INDEX = NULL;
 		}
 	}
 
 	/* Create jittering if needed */
-	if(distr==PART_DISTR_JIT && ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)) {
+	if (distr==PART_DISTR_JIT && ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)) {
 		jitlevel= part->userjit;
 		
-		if(jitlevel == 0) {
+		if (jitlevel == 0) {
 			jitlevel= totpart/totelem;
-			if(part->flag & PART_EDISTR) jitlevel*= 2;	/* looks better in general, not very scietific */
-			if(jitlevel<3) jitlevel= 3;
+			if (part->flag & PART_EDISTR) jitlevel*= 2;	/* looks better in general, not very scietific */
+			if (jitlevel<3) jitlevel= 3;
 		}
 		
 		jit= MEM_callocN((2+ jitlevel*2)*sizeof(float), "jit");
@@ -1303,7 +1314,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
 		/* for small amounts of particles we use regular jitter since it looks
 		 * a bit better, for larger amounts we switch to hammersley sequence 
 		 * because it is much faster */
-		if(jitlevel < 25)
+		if (jitlevel < 25)
 			init_mv_jit(jit, jitlevel, psys->seed, part->jitfac);
 		else
 			hammersley_create(jit, jitlevel+1, psys->seed, part->jitfac);
@@ -1327,16 +1338,16 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
 	ctx->dm= dm;
 	ctx->tpars= tpars;
 
-	if(children) {
+	if (children) {
 		totpart= psys_render_simplify_distribution(ctx, totpart);
 		alloc_child_particles(psys, totpart);
 	}
 
-	if(!children || psys->totchild < 10000)
+	if (!children || psys->totchild < 10000)
 		totthread= 1;
 	
 	seed= 31415926 + ctx->sim.psys->seed;
-	for(i=0; i<totthread; i++) {
+	for (i=0; i<totthread; i++) {
 		threads[i].rng= rng_new(seed);
 		threads[i].tot= totthread;
 	}
@@ -1354,16 +1365,16 @@ static void distribute_particles_on_dm(ParticleSimulationData *sim, int from)
 
 	pthreads= psys_threads_create(sim);
 
-	if(!distribute_threads_init_data(pthreads, sim->scene, finaldm, from)) {
+	if (!distribute_threads_init_data(pthreads, sim->scene, finaldm, from)) {
 		psys_threads_free(pthreads);
 		return;
 	}
 
 	totthread= pthreads[0].tot;
-	if(totthread > 1) {
+	if (totthread > 1) {
 		BLI_init_threads(&threads, distribute_threads_exec_cb, totthread);
 
-		for(i=0; i<totthread; i++)
+		for (i=0; i<totthread; i++)
 			BLI_insert_thread(&threads, &pthreads[i]);
 
 		BLI_end_threads(&threads);
@@ -1374,7 +1385,7 @@ static void distribute_particles_on_dm(ParticleSimulationData *sim, int from)
 	psys_calc_dmcache(sim->ob, finaldm, sim->psys);
 
 	ctx= pthreads[0].ctx;
-	if(ctx->dm != finaldm)
+	if (ctx->dm != finaldm)
 		ctx->dm->release(ctx->dm);
 
 	psys_threads_free(pthreads);
@@ -1393,8 +1404,8 @@ static void distribute_particles(ParticleSimulationData *sim, int from)
 	PARTICLE_PSMD;
 	int distr_error=0;
 
-	if(psmd){
-		if(psmd->dm)
+	if (psmd) {
+		if (psmd->dm)
 			distribute_particles_on_dm(sim, from);
 		else
 			distr_error=1;
@@ -1402,7 +1413,7 @@ static void distribute_particles(ParticleSimulationData *sim, int from)
 	else
 		distribute_particles_on_shape(sim, from);
 
-	if(distr_error){
+	if (distr_error) {
 		distribute_invalid(sim->scene, sim->psys, from);
 
 		fprintf(stderr,"Particle distribution error!\n");
@@ -1416,7 +1427,7 @@ ParticleThread *psys_threads_create(ParticleSimulationData *sim)
 	ParticleThreadContext *ctx;
 	int i, totthread;
 
-	if(sim->scene->r.mode & R_FIXED_THREADS)
+	if (sim->scene->r.mode & R_FIXED_THREADS)
 		totthread= sim->scene->r.threads;
 	else
 		totthread= BLI_system_thread_count();
@@ -1430,7 +1441,7 @@ ParticleThread *psys_threads_create(ParticleSimulationData *sim)
 
 	memset(threads, 0, sizeof(ParticleThread)*totthread);
 
-	for(i=0; i<totthread; i++) {
+	for (i=0; i<totthread; i++) {
 		threads[i].ctx= ctx;
 		threads[i].num= i;
 		threads[i].tot= totthread;
@@ -1445,39 +1456,39 @@ void psys_threads_free(ParticleThread *threads)
 	int i, totthread= threads[0].tot;
 
 	/* path caching */
-	if(ctx->vg_length)
+	if (ctx->vg_length)
 		MEM_freeN(ctx->vg_length);
-	if(ctx->vg_clump)
+	if (ctx->vg_clump)
 		MEM_freeN(ctx->vg_clump);
-	if(ctx->vg_kink)
+	if (ctx->vg_kink)
 		MEM_freeN(ctx->vg_kink);
-	if(ctx->vg_rough1)
+	if (ctx->vg_rough1)
 		MEM_freeN(ctx->vg_rough1);
-	if(ctx->vg_rough2)
+	if (ctx->vg_rough2)
 		MEM_freeN(ctx->vg_rough2);
-	if(ctx->vg_roughe)
+	if (ctx->vg_roughe)
 		MEM_freeN(ctx->vg_roughe);
 
-	if(ctx->sim.psys->lattice){
+	if (ctx->sim.psys->lattice) {
 		end_latt_deform(ctx->sim.psys->lattice);
 		ctx->sim.psys->lattice= NULL;
 	}
 
 	/* distribution */
-	if(ctx->jit) MEM_freeN(ctx->jit);
-	if(ctx->jitoff) MEM_freeN(ctx->jitoff);
-	if(ctx->weight) MEM_freeN(ctx->weight);
-	if(ctx->index) MEM_freeN(ctx->index);
-	if(ctx->skip) MEM_freeN(ctx->skip);
-	if(ctx->seams) MEM_freeN(ctx->seams);
-	//if(ctx->vertpart) MEM_freeN(ctx->vertpart);
+	if (ctx->jit) MEM_freeN(ctx->jit);
+	if (ctx->jitoff) MEM_freeN(ctx->jitoff);
+	if (ctx->weight) MEM_freeN(ctx->weight);
+	if (ctx->index) MEM_freeN(ctx->index);
+	if (ctx->skip) MEM_freeN(ctx->skip);
+	if (ctx->seams) MEM_freeN(ctx->seams);
+	//if (ctx->vertpart) MEM_freeN(ctx->vertpart);
 	BLI_kdtree_free(ctx->tree);
 
 	/* threads */
-	for(i=0; i<totthread; i++) {
-		if(threads[i].rng)
+	for (i=0; i<totthread; i++) {
+		if (threads[i].rng)
 			rng_free(threads[i].rng);
-		if(threads[i].rng_path)
+		if (threads[i].rng_path)
 			rng_free(threads[i].rng_path);
 	}
 
@@ -1494,10 +1505,10 @@ void initialize_particle(ParticleSimulationData *sim, ParticleData *pa, int p)
 
 	pa->flag &= ~PARS_UNEXIST;
 
-	if(part->type != PART_FLUID) {
+	if (part->type != PART_FLUID) {
 		psys_get_texture(sim, pa, &ptex, PAMAP_INIT, 0.f);
 		
-		if(ptex.exist < PSYS_FRAND(p+125))
+		if (ptex.exist < PSYS_FRAND(p+125))
 			pa->flag |= PARS_UNEXIST;
 
 		pa->time = (part->type == PART_HAIR) ? 0.f : part->sta + (part->end - part->sta)*ptex.time;
@@ -1506,7 +1517,7 @@ void initialize_particle(ParticleSimulationData *sim, ParticleData *pa, int p)
 	pa->hair_index = 0;
 	/* we can't reset to -1 anymore since we've figured out correct index in distribute_particles */
 	/* usage other than straight after distribute has to handle this index by itself - jahka*/
-	//pa->num_dmcache = DMCACHE_NOTFOUND; /* assume we dont have a derived mesh face */
+	//pa->num_dmcache = DMCACHE_NOTFOUND; /* assume we don't have a derived mesh face */
 }
 static void initialize_all_particles(ParticleSimulationData *sim)
 {
@@ -1516,16 +1527,16 @@ static void initialize_all_particles(ParticleSimulationData *sim)
 	psys->totunexist = 0;
 
 	LOOP_PARTICLES {
-		if((pa->flag & PARS_UNEXIST)==0)
+		if ((pa->flag & PARS_UNEXIST)==0)
 			initialize_particle(sim, pa, p);
 
-		if(pa->flag & PARS_UNEXIST)
+		if (pa->flag & PARS_UNEXIST)
 			psys->totunexist++;
 	}
 
 	/* Free unexisting particles. */
-	if(psys->totpart && psys->totunexist == psys->totpart) {
-		if(psys->particles->boid)
+	if (psys->totpart && psys->totunexist == psys->totpart) {
+		if (psys->particles->boid)
 			MEM_freeN(psys->particles->boid);
 
 		MEM_freeN(psys->particles);
@@ -1533,26 +1544,26 @@ static void initialize_all_particles(ParticleSimulationData *sim)
 		psys->totpart = psys->totunexist = 0;
 	}
 
-	if(psys->totunexist) {
+	if (psys->totunexist) {
 		int newtotpart = psys->totpart - psys->totunexist;
 		ParticleData *npa, *newpars;
 		
 		npa = newpars = MEM_callocN(newtotpart * sizeof(ParticleData), "particles");
 
-		for(p=0, pa=psys->particles; p<newtotpart; p++, pa++, npa++) {
-			while(pa->flag & PARS_UNEXIST)
+		for (p=0, pa=psys->particles; p<newtotpart; p++, pa++, npa++) {
+			while (pa->flag & PARS_UNEXIST)
 				pa++;
 
 			memcpy(npa, pa, sizeof(ParticleData));
 		}
 
-		if(psys->particles->boid)
+		if (psys->particles->boid)
 			MEM_freeN(psys->particles->boid);
 		MEM_freeN(psys->particles);
 		psys->particles = newpars;
 		psys->totpart -= psys->totunexist;
 
-		if(psys->particles->boid) {
+		if (psys->particles->boid) {
 			BoidParticle *newboids = MEM_callocN(psys->totpart * sizeof(BoidParticle), "boid particles");
 
 			LOOP_PARTICLES
@@ -1561,6 +1572,45 @@ static void initialize_all_particles(ParticleSimulationData *sim)
 		}
 	}
 }
+
+static void get_angular_velocity_vector(short avemode, ParticleKey *state, float *vec)
+{
+	switch(avemode) {
+		case PART_AVE_VELOCITY:
+			copy_v3_v3(vec, state->vel);
+			break;	
+		case PART_AVE_HORIZONTAL:
+		{
+			float zvec[3];
+			zvec[0] = zvec[1] = 0;
+			zvec[2] = 1.f;
+			cross_v3_v3v3(vec, state->vel, zvec);
+			break;
+		}
+		case PART_AVE_VERTICAL:
+		{
+			float zvec[3], temp[3];
+			zvec[0] = zvec[1] = 0;
+			zvec[2] = 1.f;
+			cross_v3_v3v3(temp, state->vel, zvec);
+			cross_v3_v3v3(vec, temp, state->vel);
+			break;
+		}
+		case PART_AVE_GLOBAL_X:
+			vec[0] = 1.f;
+			vec[1] = vec[2] = 0;
+			break;
+		case PART_AVE_GLOBAL_Y:
+			vec[1] = 1.f;
+			vec[0] = vec[2] = 0;
+			break;
+		case PART_AVE_GLOBAL_Z:
+			vec[2] = 1.f;
+			vec[0] = vec[1] = 0;
+			break;
+	}
+}
+
 void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, ParticleKey *state, float dtime, float cfra)
 {
 	Object *ob = sim->ob;
@@ -1575,7 +1625,7 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
 	part=psys->part;
 
 	/* get birth location from object		*/
-	if(part->tanfac != 0.f)
+	if (part->tanfac != 0.f)
 		psys_particle_on_emitter(sim->psmd, part->from,pa->num, pa->num_dmcache, pa->fuv,pa->foffset,loc,nor,utan,vtan,0,0);
 	else
 		psys_particle_on_emitter(sim->psmd, part->from,pa->num, pa->num_dmcache, pa->fuv,pa->foffset,loc,nor,0,0,0,0);
@@ -1593,7 +1643,7 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
 	normalize_v3(nor);
 
 	/* -tangent								*/
-	if(part->tanfac!=0.0f){
+	if (part->tanfac!=0.0f) {
 		//float phase=vg_rot?2.0f*(psys_particle_value_from_verts(sim->psmd->dm,part->from,pa,vg_rot)-0.5f):0.0f;
 		float phase=0.0f;
 		mul_v3_fl(vtan,-cosf((float)M_PI*(part->tanphase+phase)));
@@ -1611,7 +1661,7 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
 		
 
 	/* -velocity (boids need this even if there's no random velocity) */
-	if(part->randfac != 0.0f || (part->phystype==PART_PHYS_BOIDS && pa->boid)){
+	if (part->randfac != 0.0f || (part->phystype==PART_PHYS_BOIDS && pa->boid)) {
 		r_vel[0] = 2.0f * (PSYS_FRAND(p + 10) - 0.5f);
 		r_vel[1] = 2.0f * (PSYS_FRAND(p + 11) - 0.5f);
 		r_vel[2] = 2.0f * (PSYS_FRAND(p + 12) - 0.5f);
@@ -1621,7 +1671,7 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
 	}
 
 	/* -angular velocity					*/
-	if(part->avemode==PART_AVE_RAND){
+	if (part->avemode==PART_AVE_RAND) {
 		r_ave[0] = 2.0f * (PSYS_FRAND(p + 13) - 0.5f);
 		r_ave[1] = 2.0f * (PSYS_FRAND(p + 14) - 0.5f);
 		r_ave[2] = 2.0f * (PSYS_FRAND(p + 15) - 0.5f);
@@ -1631,7 +1681,7 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
 	}
 		
 	/* -rotation							*/
-	if(part->randrotfac != 0.0f){
+	if (part->randrotfac != 0.0f) {
 		r_rot[0] = 2.0f * (PSYS_FRAND(p + 16) - 0.5f);
 		r_rot[1] = 2.0f * (PSYS_FRAND(p + 17) - 0.5f);
 		r_rot[2] = 2.0f * (PSYS_FRAND(p + 18) - 0.5f);
@@ -1642,7 +1692,7 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
 		mul_qt_qtqt(r_rot,r_rot,rot);
 	}
 
-	if(part->phystype==PART_PHYS_BOIDS && pa->boid) {
+	if (part->phystype==PART_PHYS_BOIDS && pa->boid) {
 		float dvec[3], q[4], mat[3][3];
 
 		copy_v3_v3(state->co,loc);
@@ -1651,7 +1701,7 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
 		zero_v3(state->vel);
 
 		/* boids store direction in ave */
-		if(fabsf(nor[2])==1.0f) {
+		if (fabsf(nor[2])==1.0f) {
 			sub_v3_v3v3(state->ave, loc, ob->obmat[3]);
 			normalize_v3(state->ave);
 		}
@@ -1676,34 +1726,34 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
 		/* -velocity from:						*/
 
 		/*		*reactions						*/
-		if(dtime > 0.f){
+		if (dtime > 0.f) {
 			sub_v3_v3v3(vel, pa->state.vel, pa->prev_state.vel);
 		}
 
 		/*		*emitter velocity				*/
-		if(dtime != 0.f && part->obfac != 0.f){
+		if (dtime != 0.f && part->obfac != 0.f) {
 			sub_v3_v3v3(vel, loc, state->co);
 			mul_v3_fl(vel, part->obfac/dtime);
 		}
 		
 		/*		*emitter normal					*/
-		if(part->normfac != 0.f)
+		if (part->normfac != 0.f)
 			madd_v3_v3fl(vel, nor, part->normfac);
 		
 		/*		*emitter tangent				*/
-		if(sim->psmd && part->tanfac != 0.f)
+		if (sim->psmd && part->tanfac != 0.f)
 			madd_v3_v3fl(vel, vtan, part->tanfac);
 
 		/*		*emitter object orientation		*/
-		if(part->ob_vel[0] != 0.f) {
+		if (part->ob_vel[0] != 0.f) {
 			normalize_v3_v3(vec, ob->obmat[0]);
 			madd_v3_v3fl(vel, vec, part->ob_vel[0]);
 		}
-		if(part->ob_vel[1] != 0.f) {
+		if (part->ob_vel[1] != 0.f) {
 			normalize_v3_v3(vec, ob->obmat[1]);
 			madd_v3_v3fl(vel, vec, part->ob_vel[1]);
 		}
-		if(part->ob_vel[2] != 0.f) {
+		if (part->ob_vel[2] != 0.f) {
 			normalize_v3_v3(vec, ob->obmat[2]);
 			madd_v3_v3fl(vel, vec, part->ob_vel[2]);
 		}
@@ -1712,11 +1762,11 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
 		/* TODO	*/
 
 		/*		*random							*/
-		if(part->randfac != 0.f)
+		if (part->randfac != 0.f)
 			madd_v3_v3fl(vel, r_vel, part->randfac);
 
 		/*		*particle						*/
-		if(part->partfac != 0.f)
+		if (part->partfac != 0.f)
 			madd_v3_v3fl(vel, p_vel, part->partfac);
 		
 		mul_v3_v3fl(state->vel, vel, ptex.ivel);
@@ -1727,9 +1777,9 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
 		/* -rotation							*/
 		unit_qt(state->rot);
 
-		if(part->rotmode){
+		if (part->rotmode) {
 			/* create vector into which rotation is aligned */
-			switch(part->rotmode){
+			switch(part->rotmode) {
 				case PART_ROT_NOR:
 					copy_v3_v3(rot_vec, nor);
 					break;
@@ -1753,14 +1803,14 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
 			vec_to_quat( q2,rot_vec, OB_POSX, OB_POSZ);
 
 			/* randomize rotation quat */
-			if(part->randrotfac!=0.0f)
+			if (part->randrotfac!=0.0f)
 				interp_qt_qtqt(rot, q2, r_rot, part->randrotfac);
 			else
 				copy_qt_qt(rot,q2);
 
 			/* rotation phase */
 			phasefac = part->phasefac;
-			if(part->randphasefac != 0.0f)
+			if (part->randphasefac != 0.0f)
 				phasefac += part->randphasefac * PSYS_FRAND(p + 20);
 			axis_angle_to_quat( q_phase,x_vec, phasefac*(float)M_PI);
 
@@ -1772,15 +1822,12 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
 
 		zero_v3(state->ave);
 
-		if(part->avemode){
-			switch(part->avemode){
-				case PART_AVE_SPIN:
-					copy_v3_v3(state->ave, vel);
-					break;
-				case PART_AVE_RAND:
-					copy_v3_v3(state->ave, r_ave);
-					break;
-			}
+		if (part->avemode) {
+			if (part->avemode == PART_AVE_RAND)
+				copy_v3_v3(state->ave, r_ave);
+			else
+				get_angular_velocity_vector(part->avemode, state, state->ave);
+
 			normalize_v3(state->ave);
 			mul_v3_fl(state->ave, part->avefac);
 		}
@@ -1797,27 +1844,31 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime,
 	part=psys->part;
 	
 	/* get precise emitter matrix if particle is born */
-	if(part->type!=PART_HAIR && dtime > 0.f && pa->time < cfra && pa->time >= sim->psys->cfra) {
+	if (part->type!=PART_HAIR && dtime > 0.f && pa->time < cfra && pa->time >= sim->psys->cfra) {
 		/* we have to force RECALC_ANIM here since where_is_objec_time only does drivers */
-		while(ob) {
+		while (ob) {
 			BKE_animsys_evaluate_animdata(sim->scene, &ob->id, ob->adt, pa->time, ADT_RECALC_ANIM);
 			ob = ob->parent;
 		}
 		ob = sim->ob;
 		where_is_object_time(sim->scene, ob, pa->time);
+
+		psys->flag |= PSYS_OB_ANIM_RESTORE;
 	}
 
 	psys_get_birth_coordinates(sim, pa, &pa->state, dtime, cfra);
 
-	if(part->phystype==PART_PHYS_BOIDS && pa->boid) {
+	if (part->phystype==PART_PHYS_BOIDS && pa->boid) {
 		BoidParticle *bpa = pa->boid;
 
 		/* and gravity in r_ve */
 		bpa->gravity[0] = bpa->gravity[1] = 0.0f;
 		bpa->gravity[2] = -1.0f;
-		if((sim->scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY)
-			&& sim->scene->physics_settings.gravity[2]!=0.0f)
+		if ((sim->scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) &&
+		    (sim->scene->physics_settings.gravity[2] != 0.0f))
+		{
 			bpa->gravity[2] = sim->scene->physics_settings.gravity[2];
+		}
 
 		bpa->data.health = part->boids->health;
 		bpa->data.mode = eBoidMode_InAir;
@@ -1826,30 +1877,30 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime,
 	}
 
 
-	if(part->type == PART_HAIR){
+	if (part->type == PART_HAIR) {
 		pa->lifetime = 100.0f;
 	}
-	else{
+	else {
 		/* get possible textural influence */
 		psys_get_texture(sim, pa, &ptex, PAMAP_LIFE, cfra);
 
 		pa->lifetime = part->lifetime * ptex.life;
 
-		if(part->randlife != 0.0f)
+		if (part->randlife != 0.0f)
 			pa->lifetime *= 1.0f - part->randlife * PSYS_FRAND(p + 21);
 	}
 
 	pa->dietime = pa->time + pa->lifetime;
 
-	if(sim->psys->pointcache && sim->psys->pointcache->flag & PTCACHE_BAKED &&
+	if (sim->psys->pointcache && sim->psys->pointcache->flag & PTCACHE_BAKED &&
 		sim->psys->pointcache->mem_cache.first) {
 		float dietime = psys_get_dietime_from_cache(sim->psys->pointcache, p);
 		pa->dietime = MIN2(pa->dietime, dietime);
 	}
 
-	if(pa->time > cfra)
+	if (pa->time > cfra)
 		pa->alive = PARS_UNBORN;
-	else if(pa->dietime <= cfra)
+	else if (pa->dietime <= cfra)
 		pa->alive = PARS_DEAD;
 	else
 		pa->alive = PARS_ALIVE;
@@ -1861,7 +1912,7 @@ static void reset_all_particles(ParticleSimulationData *sim, float dtime, float
 	ParticleData *pa;
 	int p, totpart=sim->psys->totpart;
 	
-	for(p=from, pa=sim->psys->particles+from; p<totpart; p++, pa++)
+	for (p=from, pa=sim->psys->particles+from; p<totpart; p++, pa++)
 		reset_particle(sim, pa, dtime, cfra);
 }
 /************************************************/
@@ -1871,12 +1922,12 @@ ParticleSystem *psys_get_target_system(Object *ob, ParticleTarget *pt)
 {
 	ParticleSystem *psys = NULL;
 
-	if(pt->ob == NULL || pt->ob == ob)
+	if (pt->ob == NULL || pt->ob == ob)
 		psys = BLI_findlink(&ob->particlesystem, pt->psys-1);
 	else
 		psys = BLI_findlink(&pt->ob->particlesystem, pt->psys-1);
 
-	if(psys)
+	if (psys)
 		pt->flag |= PTARGET_VALID;
 	else
 		pt->flag &= ~PTARGET_VALID;
@@ -1894,12 +1945,12 @@ void psys_count_keyed_targets(ParticleSimulationData *sim)
 	int keys_valid = 1;
 	psys->totkeyed = 0;
 
-	for(; pt; pt=pt->next) {
+	for (; pt; pt=pt->next) {
 		kpsys = psys_get_target_system(sim->ob, pt);
 
-		if(kpsys && kpsys->totpart) {
+		if (kpsys && kpsys->totpart) {
 			psys->totkeyed += keys_valid;
-			if(psys->flag & PSYS_KEYED_TIMING && pt->duration != 0.0f)
+			if (psys->flag & PSYS_KEYED_TIMING && pt->duration != 0.0f)
 				psys->totkeyed += 1;
 		}
 		else {
@@ -1923,13 +1974,13 @@ static void set_keyed_keys(ParticleSimulationData *sim)
 	ksim.scene= sim->scene;
 	
 	/* no proper targets so let's clear and bail out */
-	if(psys->totkeyed==0) {
+	if (psys->totkeyed==0) {
 		free_keyed_keys(psys);
 		psys->flag &= ~PSYS_KEYED;
 		return;
 	}
 
-	if(totpart && psys->particles->totkey != totkeys) {
+	if (totpart && psys->particles->totkey != totkeys) {
 		free_keyed_keys(psys);
 		
 		key = MEM_callocN(totpart*totkeys*sizeof(ParticleKey), "Keyed keys");
@@ -1945,7 +1996,7 @@ static void set_keyed_keys(ParticleSimulationData *sim)
 
 
 	pt = psys->targets.first;
-	for(k=0; k<totkeys; k++) {
+	for (k=0; k<totkeys; k++) {
 		ksim.ob = pt->ob ? pt->ob : sim->ob;
 		ksim.psys = BLI_findlink(&ksim.ob->particlesystem, pt->psys - 1);
 		keyed_flag = (ksim.psys->flag & PSYS_KEYED);
@@ -1957,20 +2008,20 @@ static void set_keyed_keys(ParticleSimulationData *sim)
 
 			psys_get_particle_state(&ksim, p%ksim.psys->totpart, key, 1);
 
-			if(psys->flag & PSYS_KEYED_TIMING){
+			if (psys->flag & PSYS_KEYED_TIMING) {
 				key->time = pa->time + pt->time;
-				if(pt->duration != 0.0f && k+1 < totkeys) {
+				if (pt->duration != 0.0f && k+1 < totkeys) {
 					copy_particle_key(key+1, key, 1);
 					(key+1)->time = pa->time + pt->time + pt->duration;
 				}
 			}
-			else if(totkeys > 1)
+			else if (totkeys > 1)
 				key->time = pa->time + (float)k / (float)(totkeys - 1) * pa->lifetime;
 			else
 				key->time = pa->time;
 		}
 
-		if(psys->flag & PSYS_KEYED_TIMING && pt->duration!=0.0f)
+		if (psys->flag & PSYS_KEYED_TIMING && pt->duration!=0.0f)
 			k++;
 
 		ksim.psys->flag |= keyed_flag;
@@ -1988,7 +2039,7 @@ void psys_make_temp_pointcache(Object *ob, ParticleSystem *psys)
 {
 	PointCache *cache = psys->pointcache;
 
-	if(cache->flag & PTCACHE_DISK_CACHE && cache->mem_cache.first == NULL) {
+	if (cache->flag & PTCACHE_DISK_CACHE && cache->mem_cache.first == NULL) {
 		PTCacheID pid;
 		BKE_ptcache_id_from_particles(&pid, ob, psys);
 		cache->flag &= ~PTCACHE_DISK_CACHE;
@@ -1998,7 +2049,7 @@ void psys_make_temp_pointcache(Object *ob, ParticleSystem *psys)
 }
 static void psys_clear_temp_pointcache(ParticleSystem *psys)
 {
-	if(psys->pointcache->flag & PTCACHE_DISK_CACHE)
+	if (psys->pointcache->flag & PTCACHE_DISK_CACHE)
 		BKE_ptcache_free_mem(&psys->pointcache->mem_cache);
 }
 void psys_get_pointcache_start_end(Scene *scene, ParticleSystem *psys, int *sfra, int *efra)
@@ -2014,11 +2065,11 @@ void psys_get_pointcache_start_end(Scene *scene, ParticleSystem *psys, int *sfra
 /************************************************/
 static void psys_update_particle_bvhtree(ParticleSystem *psys, float cfra)
 {
-	if(psys) {
+	if (psys) {
 		PARTICLE_P;
 		int totpart = 0;
 
-		if(!psys->bvhtree || psys->bvhtree_frame != cfra) {
+		if (!psys->bvhtree || psys->bvhtree_frame != cfra) {
 			LOOP_SHOWN_PARTICLES {
 				totpart++;
 			}
@@ -2027,8 +2078,8 @@ static void psys_update_particle_bvhtree(ParticleSystem *psys, float cfra)
 			psys->bvhtree = BLI_bvhtree_new(totpart, 0.0, 4, 6);
 
 			LOOP_SHOWN_PARTICLES {
-				if(pa->alive == PARS_ALIVE) {
-					if(pa->state.time == cfra)
+				if (pa->alive == PARS_ALIVE) {
+					if (pa->state.time == cfra)
 						BLI_bvhtree_insert(psys->bvhtree, p, pa->prev_state.co, 1);
 					else
 						BLI_bvhtree_insert(psys->bvhtree, p, pa->state.co, 1);
@@ -2042,11 +2093,11 @@ static void psys_update_particle_bvhtree(ParticleSystem *psys, float cfra)
 }
 void psys_update_particle_tree(ParticleSystem *psys, float cfra)
 {
-	if(psys) {
+	if (psys) {
 		PARTICLE_P;
 		int totpart = 0;
 
-		if(!psys->tree || psys->tree_frame != cfra) {
+		if (!psys->tree || psys->tree_frame != cfra) {
 			LOOP_SHOWN_PARTICLES {
 				totpart++;
 			}
@@ -2055,8 +2106,8 @@ void psys_update_particle_tree(ParticleSystem *psys, float cfra)
 			psys->tree = BLI_kdtree_new(psys->totpart);
 
 			LOOP_SHOWN_PARTICLES {
-				if(pa->alive == PARS_ALIVE) {
-					if(pa->state.time == cfra)
+				if (pa->alive == PARS_ALIVE) {
+					if (pa->state.time == cfra)
 						BLI_kdtree_insert(psys->tree, p, pa->prev_state.co, NULL);
 					else
 						BLI_kdtree_insert(psys->tree, p, pa->state.co, NULL);
@@ -2087,10 +2138,10 @@ static void integrate_particle(ParticleSettings *part, ParticleData *pa, float d
 	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)
+	if (pa->prev_state.time < 0.f && integrator == PART_INT_VERLET)
 		integrator = PART_INT_EULER;
 
-	switch(integrator){
+	switch(integrator) {
 		case PART_INT_EULER:
 			steps=1;
 			break;
@@ -2109,7 +2160,7 @@ static void integrate_particle(ParticleSettings *part, ParticleData *pa, float d
 
 	states->time = 0.f;
 
-	for(i=0; i<steps; i++){
+	for (i=0; i<steps; i++) {
 		zero_v3(force);
 		zero_v3(impulse);
 
@@ -2118,31 +2169,31 @@ static void integrate_particle(ParticleSettings *part, ParticleData *pa, float d
 		/* force to acceleration*/
 		mul_v3_v3fl(acceleration, force, 1.0f/pa_mass);
 
-		if(external_acceleration)
+		if (external_acceleration)
 			add_v3_v3(acceleration, external_acceleration);
 		
 		/* calculate next state */
 		add_v3_v3(states[i].vel, impulse);
 
-		switch(integrator){
+		switch(integrator) {
 			case PART_INT_EULER:
 				madd_v3_v3v3fl(pa->state.co, states->co, states->vel, dtime);
 				madd_v3_v3v3fl(pa->state.vel, states->vel, acceleration, dtime);
 				break;
 			case PART_INT_MIDPOINT:
-				if(i==0){
+				if (i==0) {
 					madd_v3_v3v3fl(states[1].co, states->co, states->vel, dtime*0.5f);
 					madd_v3_v3v3fl(states[1].vel, states->vel, acceleration, dtime*0.5f);
 					states[1].time = dtime*0.5f;
 					/*fra=sim->psys->cfra+0.5f*dfra;*/
 				}
-				else{
+				else {
 					madd_v3_v3v3fl(pa->state.co, states->co, states[1].vel, dtime);
 					madd_v3_v3v3fl(pa->state.vel, states->vel, acceleration, dtime);
 				}
 				break;
 			case PART_INT_RK4:
-				switch(i){
+				switch(i) {
 					case 0:
 						copy_v3_v3(dx[0], states->vel);
 						mul_v3_fl(dx[0], dtime);
@@ -2204,28 +2255,28 @@ static void integrate_particle(ParticleSettings *part, ParticleData *pa, float d
 }
 
 /*********************************************************************************************************
-                    SPH fluid physics 
-
- In theory, there could be unlimited implementation of SPH simulators
-
- This code uses in some parts adapted algorithms from the pseudo code as outlined in the Research paper:
-
- Titled: Particle-based Viscoelastic Fluid Simulation.
- Authors: Simon Clavet, Philippe Beaudoin and Pierre Poulin
- Website: http://www.iro.umontreal.ca/labs/infographie/papers/Clavet-2005-PVFS/
-
- Presented at Siggraph, (2005)
-
-***********************************************************************************************************/
+ *                    SPH fluid physics 
+ *
+ * In theory, there could be unlimited implementation of SPH simulators
+ *
+ * This code uses in some parts adapted algorithms from the pseudo code as outlined in the Research paper:
+ *
+ * Titled: Particle-based Viscoelastic Fluid Simulation.
+ * Authors: Simon Clavet, Philippe Beaudoin and Pierre Poulin
+ * Website: http://www.iro.umontreal.ca/labs/infographie/papers/Clavet-2005-PVFS/
+ *
+ * Presented at Siggraph, (2005)
+ *
+ * ********************************************************************************************************/
 #define PSYS_FLUID_SPRINGS_INITIAL_SIZE 256
 static ParticleSpring *sph_spring_add(ParticleSystem *psys, ParticleSpring *spring)
 {
 	/* Are more refs required? */
-	if(psys->alloc_fluidsprings == 0 || psys->fluid_springs == NULL) {
+	if (psys->alloc_fluidsprings == 0 || psys->fluid_springs == NULL) {
 		psys->alloc_fluidsprings = PSYS_FLUID_SPRINGS_INITIAL_SIZE;
 		psys->fluid_springs = (ParticleSpring*)MEM_callocN(psys->alloc_fluidsprings * sizeof(ParticleSpring), "Particle Fluid Springs");
 	}
-	else if(psys->tot_fluidsprings == psys->alloc_fluidsprings) {
+	else if (psys->tot_fluidsprings == psys->alloc_fluidsprings) {
 		/* Double the number of refs allocated */
 		psys->alloc_fluidsprings *= 2;
 		psys->fluid_springs = (ParticleSpring*)MEM_reallocN(psys->fluid_springs, psys->alloc_fluidsprings * sizeof(ParticleSpring));
@@ -2243,7 +2294,7 @@ static void sph_spring_delete(ParticleSystem *psys, int j)
 
 	psys->tot_fluidsprings--;
 
-	if (psys->tot_fluidsprings < psys->alloc_fluidsprings/2 && psys->alloc_fluidsprings > PSYS_FLUID_SPRINGS_INITIAL_SIZE){
+	if (psys->tot_fluidsprings < psys->alloc_fluidsprings/2 && psys->alloc_fluidsprings > PSYS_FLUID_SPRINGS_INITIAL_SIZE) {
 		psys->alloc_fluidsprings /= 2;
 		psys->fluid_springs = (ParticleSpring*)MEM_reallocN(psys->fluid_springs,  psys->alloc_fluidsprings * sizeof(ParticleSpring));
 	}
@@ -2262,11 +2313,11 @@ static void sph_springs_modify(ParticleSystem *psys, float dtime)
 	/* scale things according to dtime */
 	float timefix = 25.f * dtime;
 
-	if((fluid->flag & SPH_VISCOELASTIC_SPRINGS)==0 || fluid->spring_k == 0.f)
+	if ((fluid->flag & SPH_VISCOELASTIC_SPRINGS)==0 || fluid->spring_k == 0.f)
 		return;
 
 	/* Loop through the springs */
-	for(i=0; i<psys->tot_fluidsprings; i++, spring++) {
+	for (i=0; i<psys->tot_fluidsprings; i++, spring++) {
 		pa1 = psys->particles + spring->particle_index[0];
 		pa2 = psys->particles + spring->particle_index[1];
 
@@ -2279,18 +2330,18 @@ static void sph_springs_modify(ParticleSystem *psys, float dtime)
 
 		if (rij > Lij + d) // Stretch
 			spring->rest_length += plasticity * (rij - Lij - d) * timefix;
-		else if(rij < Lij - d) // Compress
+		else if (rij < Lij - d) // Compress
 			spring->rest_length -= plasticity * (Lij - d - rij) * timefix;
 
 		h = 4.f*pa1->size;
 
-		if(spring->rest_length > h)
+		if (spring->rest_length > h)
 			spring->delete_flag = 1;
 	}
 
 	/* Loop through springs backwaqrds - for efficient delete function */
 	for (i=psys->tot_fluidsprings-1; i >= 0; i--) {
-		if(psys->fluid_springs[i].delete_flag)
+		if (psys->fluid_springs[i].delete_flag)
 			sph_spring_delete(psys, i);
 	}
 }
@@ -2302,7 +2353,7 @@ static EdgeHash *sph_springhash_build(ParticleSystem *psys)
 
 	springhash = BLI_edgehash_new();
 
-	for(i=0, spring=psys->fluid_springs; i<psys->tot_fluidsprings; i++, spring++)
+	for (i=0, spring=psys->fluid_springs; i<psys->tot_fluidsprings; i++, spring++)
 		BLI_edgehash_insert(springhash, spring->particle_index[0], spring->particle_index[1], SET_INT_IN_POINTER(i+1));
 
 	return springhash;
@@ -2328,14 +2379,15 @@ typedef struct SPHRangeData
 	float massfac;
 	int use_size;
 } SPHRangeData;
+
 typedef struct SPHData {
 	ParticleSystem *psys[10];
 	ParticleData *pa;
 	float mass;
 	EdgeHash *eh;
 	float *gravity;
-	/* Average distance to neighbours (other particles in the support domain),
-	   for calculating the Courant number (adaptive time step). */
+	/* Average distance to neighbors (other particles in the support domain),
+	 * for calculating the Courant number (adaptive time step). */
 	int pass;
 	float element_size;
 	float flow[3];
@@ -2343,7 +2395,7 @@ typedef struct SPHData {
 	/* Integrator callbacks. This allows different SPH implementations. */
 	void (*force_cb) (void *sphdata_v, ParticleKey *state, float *force, float *impulse);
 	void (*density_cb) (void *rangedata_v, int index, float squared_dist);
-}SPHData;
+} SPHData;
 
 static void sph_density_accum_cb(void *userdata, int index, float squared_dist)
 {
@@ -2352,7 +2404,7 @@ static void sph_density_accum_cb(void *userdata, int index, float squared_dist)
 	float q;
 	float dist;
 
-	if(npa == pfr->pa || squared_dist < FLT_EPSILON)
+	if (npa == pfr->pa || squared_dist < FLT_EPSILON)
 		return;
 
 	/* Ugh! One particle has too many neighbors! If some aren't taken into
@@ -2361,7 +2413,7 @@ static void sph_density_accum_cb(void *userdata, int index, float squared_dist)
 	 * But, we have to stop somewhere, and it's not the end of the world.
 	 *  - jahka and z0r
 	 */
-	if(pfr->tot_neighbors >= SPH_NEIGHBORS)
+	if (pfr->tot_neighbors >= SPH_NEIGHBORS)
 		return;
 
 	pfr->neighbors[pfr->tot_neighbors].index = index;
@@ -2371,16 +2423,18 @@ static void sph_density_accum_cb(void *userdata, int index, float squared_dist)
 	dist = sqrtf(squared_dist);
 	q = (1.f - dist/pfr->h) * pfr->massfac;
 
-	if(pfr->use_size)
+	if (pfr->use_size)
 		q *= npa->size;
 
 	pfr->density += q*q;
 	pfr->near_density += q*q*q;
 }
+
 /*
  * Find the Courant number for an SPH particle (used for adaptive time step).
  */
-static void sph_particle_courant(SPHData *sphdata, SPHRangeData *pfr) {
+static void sph_particle_courant(SPHData *sphdata, SPHRangeData *pfr)
+{
 	ParticleData *pa, *npa;
 	int i;
 	float flow[3], offset[3], dist;
@@ -2398,9 +2452,10 @@ static void sph_particle_courant(SPHData *sphdata, SPHRangeData *pfr) {
 		dist += sphdata->psys[0]->part->fluid->radius; // TODO: remove this? - z0r
 		sphdata->element_size = dist / pfr->tot_neighbors;
 		mul_v3_v3fl(sphdata->flow, flow, 1.0f / pfr->tot_neighbors);
-	} else {
+	}
+	else {
 		sphdata->element_size = MAXFLOAT;
-		VECCOPY(sphdata->flow, flow);
+		copy_v3_v3(sphdata->flow, flow);
 	}
 }
 static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, float *UNUSED(impulse))
@@ -2444,7 +2499,7 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa
 	pfr.h = h;
 	pfr.pa = pa;
 
-	for(i=0; i<10 && psys[i]; i++) {
+	for (i=0; i<10 && psys[i]; i++) {
 		pfr.npsys = psys[i];
 		pfr.massfac = psys[i]->part->mass*inv_mass;
 		pfr.use_size = psys[i]->part->flag & PART_SIZEMASS;
@@ -2456,7 +2511,7 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa
 	near_pressure = stiffness_near_fac * pfr.near_density;
 
 	pfn = pfr.neighbors;
-	for(i=0; i<pfr.tot_neighbors; i++, pfn++) {
+	for (i=0; i<pfr.tot_neighbors; i++, pfn++) {
 		npa = pfn->psys->particles + pfn->index;
 
 		madd_v3_v3v3fl(co, npa->prev_state.co, npa->prev_state.vel, state->time);
@@ -2466,7 +2521,7 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa
 
 		q = (1.f - rij/h) * pfn->psys->part->mass * inv_mass;
 
-		if(pfn->psys->part->flag & PART_SIZEMASS)
+		if (pfn->psys->part->flag & PART_SIZEMASS)
 			q *= npa->size;
 
 		copy_v3_v3(vel, npa->prev_state.vel);
@@ -2475,29 +2530,29 @@ 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);
 
-			if(u < 0.f && visc > 0.f)
+			if (u < 0.f && visc > 0.f)
 				madd_v3_v3fl(force, vec, 0.5f * q * visc * u );
 
-			if(u > 0.f && stiff_visc > 0.f)
+			if (u > 0.f && stiff_visc > 0.f)
 				madd_v3_v3fl(force, vec, 0.5f * q * stiff_visc * u );
 		}
 
-		if(spring_constant > 0.f) {
+		if (spring_constant > 0.f) {
 			/* Viscoelastic spring force */
 			if (pfn->psys == psys[0] && fluid->flag & SPH_VISCOELASTIC_SPRINGS && springhash) {
 				/* BLI_edgehash_lookup appears to be thread-safe. - z0r */
 				spring_index = GET_INT_FROM_POINTER(BLI_edgehash_lookup(springhash, index, pfn->index));
 
-				if(spring_index) {
+				if (spring_index) {
 					spring = psys[0]->fluid_springs + spring_index - 1;
 
 					madd_v3_v3fl(force, vec, -10.f * spring_constant * (1.f - rij/h) * (spring->rest_length - rij));
 				}
-				else if(fluid->spring_frames == 0 || (pa->prev_state.time-pa->time) <= fluid->spring_frames){
+				else if (fluid->spring_frames == 0 || (pa->prev_state.time-pa->time) <= fluid->spring_frames) {
 					ParticleSpring temp_spring;
 					temp_spring.particle_index[0] = index;
 					temp_spring.particle_index[1] = pfn->index;
@@ -2524,13 +2579,14 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa
 	sphdata->pass++;
 }
 
-static void sph_solver_init(ParticleSimulationData *sim, SPHData *sphdata) {
+static void sph_solver_init(ParticleSimulationData *sim, SPHData *sphdata)
+{
 	ParticleTarget *pt;
 	int i;
 
 	// Add other coupled particle systems.
 	sphdata->psys[0] = sim->psys;
-	for(i=1, pt=sim->psys->targets.first; i<10; i++, pt=(pt?pt->next:NULL))
+	for (i=1, pt=sim->psys->targets.first; i<10; i++, pt=(pt?pt->next:NULL))
 		sphdata->psys[i] = pt ? psys_get_target_system(sim->ob, pt) : NULL;
 
 	if (psys_uses_gravity(sim))
@@ -2547,13 +2603,17 @@ static void sph_solver_init(ParticleSimulationData *sim, SPHData *sphdata) {
 	sphdata->force_cb = sph_force_cb;
 	sphdata->density_cb = sph_density_accum_cb;
 }
-static void sph_solver_finalise(SPHData *sphdata) {
+
+static void sph_solver_finalise(SPHData *sphdata)
+{
 	if (sphdata->eh) {
 		BLI_edgehash_free(sphdata->eh, NULL);
 		sphdata->eh = NULL;
 	}
 }
-static void sph_integrate(ParticleSimulationData *sim, ParticleData *pa, float dfra, SPHData *sphdata){
+
+static void sph_integrate(ParticleSimulationData *sim, ParticleData *pa, float dfra, SPHData *sphdata)
+{
 	ParticleSettings *part = sim->psys->part;
 	// float timestep = psys_get_timestep(sim); // UNUSED
 	float pa_mass = part->mass * (part->flag & PART_SIZEMASS ? pa->size : 1.f);
@@ -2594,18 +2654,18 @@ static void basic_force_cb(void *efdata_v, ParticleKey *state, float *force, flo
 
 	/* add effectors */
 	pd_point_from_particle(efdata->sim, efdata->pa, state, &epoint);
-	if(part->type != PART_HAIR || part->effector_weights->flag & EFF_WEIGHT_DO_HAIR)
+	if (part->type != PART_HAIR || part->effector_weights->flag & EFF_WEIGHT_DO_HAIR)
 		pdDoEffectors(sim->psys->effectors, sim->colliders, part->effector_weights, &epoint, force, impulse);
 
 	mul_v3_fl(force, efdata->ptex.field);
 	mul_v3_fl(impulse, efdata->ptex.field);
 
 	/* calculate air-particle interaction */
-	if(part->dragfac != 0.0f)
+	if (part->dragfac != 0.0f)
 		madd_v3_v3fl(force, state->vel, -part->dragfac * pa->size * pa->size * len_v3(state->vel));
 
 	/* brownian force */
-	if(part->brownfac != 0.0f){
+	if (part->brownfac != 0.0f) {
 		force[0] += (BLI_frand()-0.5f) * part->brownfac;
 		force[1] += (BLI_frand()-0.5f) * part->brownfac;
 		force[2] += (BLI_frand()-0.5f) * part->brownfac;
@@ -2627,9 +2687,10 @@ static void basic_integrate(ParticleSimulationData *sim, int p, float dfra, floa
 	efdata.sim = sim;
 
 	/* add global acceleration (gravitation) */
-	if(psys_uses_gravity(sim)
+	if (psys_uses_gravity(sim) &&
 		/* normal gravity is too strong for hair so it's disabled by default */
-		&& (part->type != PART_HAIR || part->effector_weights->flag & EFF_WEIGHT_DO_HAIR)) {
+		(part->type != PART_HAIR || part->effector_weights->flag & EFF_WEIGHT_DO_HAIR))
+	{
 		zero_v3(gr);
 		madd_v3_v3fl(gr, sim->scene->physics_settings.gravity, part->effector_weights->global_gravity * efdata.ptex.gravity);
 		gravity = gr;
@@ -2641,7 +2702,7 @@ static void basic_integrate(ParticleSimulationData *sim, int p, float dfra, floa
 	integrate_particle(part, pa, dtime, gravity, basic_force_cb, &efdata);
 
 	/* damp affects final velocity */
-	if(part->dampfac != 0.f)
+	if (part->dampfac != 0.f)
 		mul_v3_fl(pa->state.vel, 1.f - part->dampfac * efdata.ptex.damp * 25.f * dtime);
 
 	//copy_v3_v3(pa->state.ave, states->ave);
@@ -2654,8 +2715,8 @@ static void basic_integrate(ParticleSimulationData *sim, int p, float dfra, floa
 	copy_v3_v3(tkey.vel,pa->state.vel);
 	tkey.time=pa->state.time;
 
-	if(part->type != PART_HAIR) {
-		if(do_guides(sim->psys->effectors, &tkey, p, time)) {
+	if (part->type != PART_HAIR) {
+		if (do_guides(sim->psys->effectors, &tkey, p, time)) {
 			copy_v3_v3(pa->state.co,tkey.co);
 			/* guides don't produce valid velocity */
 			sub_v3_v3v3(pa->state.vel, tkey.co, pa->prev_state.co);
@@ -2668,31 +2729,37 @@ static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, f
 {
 	float rotfac, rot1[4], rot2[4]={1.0,0.0,0.0,0.0}, dtime=dfra*timestep;
 
-	if((part->flag & PART_ROT_DYN)==0){
-		if(part->avemode==PART_AVE_SPIN){
-			float angle;
-			float len1 = len_v3(pa->prev_state.vel);
-			float len2 = len_v3(pa->state.vel);
-
-			if(len1==0.0f || len2==0.0f)
-				pa->state.ave[0]=pa->state.ave[1]=pa->state.ave[2]=0.0f;
-			else{
-				cross_v3_v3v3(pa->state.ave,pa->prev_state.vel,pa->state.vel);
-				normalize_v3(pa->state.ave);
-				angle=dot_v3v3(pa->prev_state.vel,pa->state.vel)/(len1*len2);
-				mul_v3_fl(pa->state.ave,saacos(angle)/dtime);
-			}
+	if ((part->flag & PART_ROTATIONS)==0) {
+		pa->state.rot[0]=1.0f;
+		pa->state.rot[1]=pa->state.rot[2]=pa->state.rot[3]=0;
+		return;
+	}
+
+	if ((part->flag & PART_ROT_DYN)==0 && ELEM3(part->avemode, PART_AVE_VELOCITY, PART_AVE_HORIZONTAL, PART_AVE_VERTICAL)) {
+		float angle;
+		float len1 = len_v3(pa->prev_state.vel);
+		float len2 = len_v3(pa->state.vel);
+		float vec[3];
 
-			axis_angle_to_quat(rot2,pa->state.vel,dtime*part->avefac);
+		if (len1==0.0f || len2==0.0f)
+			pa->state.ave[0] = pa->state.ave[1] = pa->state.ave[2] = 0.0f;
+		else {
+			cross_v3_v3v3(pa->state.ave, pa->prev_state.vel, pa->state.vel);
+			normalize_v3(pa->state.ave);
+			angle = dot_v3v3(pa->prev_state.vel, pa->state.vel) / (len1 * len2);
+			mul_v3_fl(pa->state.ave, saacos(angle) / dtime);
 		}
+
+		get_angular_velocity_vector(part->avemode, &pa->state, vec);
+		axis_angle_to_quat(rot2, vec, dtime*part->avefac);
 	}
 
-	rotfac=len_v3(pa->state.ave);
-	if(rotfac == 0.0f){ /* unit_qt(in VecRotToQuat) doesn't give unit quat [1,0,0,0]?? */
+	rotfac = len_v3(pa->state.ave);
+	if (rotfac == 0.0f) { /* unit_qt(in VecRotToQuat) doesn't give unit quat [1,0,0,0]?? */
 		rot1[0]=1.0f;
 		rot1[1]=rot1[2]=rot1[3]=0;
 	}
-	else{
+	else {
 		axis_angle_to_quat(rot1,pa->state.ave,rotfac*dtime);
 	}
 	mul_qt_qtqt(pa->state.rot,rot1,pa->prev_state.rot);
@@ -2723,14 +2790,14 @@ static float nr_signed_distance_to_plane(float *p, float radius, ParticleCollisi
 
 	d = dot_v3v3(p0, nor);
 
-	if(pce->inv_nor == -1) {
-		if(d < 0.f)
+	if (pce->inv_nor == -1) {
+		if (d < 0.f)
 			pce->inv_nor = 1;
 		else
 			pce->inv_nor = 0;
 	}
 
-	if(pce->inv_nor == 1) {
+	if (pce->inv_nor == 1) {
 		negate_v3(nor);
 		d = -d;
 	}
@@ -2760,13 +2827,13 @@ static void collision_interpolate_element(ParticleCollisionElement *pce, float t
 	/* the col->fac's are factors for the particle subframe step start and end during collision modifier step */
 	float f = fac + t*(1.f-fac);
 	float mul = col->fac1 + f * (col->fac2-col->fac1);
-	if(pce->tot > 0) {
+	if (pce->tot > 0) {
 		madd_v3_v3v3fl(pce->x0, pce->x[0], pce->v[0], mul);
 
-		if(pce->tot > 1) {
+		if (pce->tot > 1) {
 			madd_v3_v3v3fl(pce->x1, pce->x[1], pce->v[1], mul);
 
-			if(pce->tot > 2)
+			if (pce->tot > 2)
 				madd_v3_v3v3fl(pce->x2, pce->x[2], pce->v[2], mul);
 		}
 	}
@@ -2777,11 +2844,11 @@ static void collision_point_velocity(ParticleCollisionElement *pce)
 
 	copy_v3_v3(pce->vel, pce->v[0]);
 
-	if(pce->tot > 1) {
+	if (pce->tot > 1) {
 		sub_v3_v3v3(v, pce->v[1], pce->v[0]);
 		madd_v3_v3fl(pce->vel, v, pce->uv[0]);
 
-		if(pce->tot > 2) {
+		if (pce->tot > 2) {
 			sub_v3_v3v3(v, pce->v[2], pce->v[0]);
 			madd_v3_v3fl(pce->vel, v, pce->uv[1]);
 		}
@@ -2789,7 +2856,7 @@ static void collision_point_velocity(ParticleCollisionElement *pce)
 }
 static float collision_point_distance_with_normal(float p[3], ParticleCollisionElement *pce, float fac, ParticleCollision *col, float *nor)
 {
-	if(fac >= 0.f)
+	if (fac >= 0.f)
 		collision_interpolate_element(pce, 0.f, fac, col);
 
 	switch(pce->tot) {
@@ -2850,7 +2917,7 @@ static void collision_point_on_surface(float p[3], ParticleCollisionElement *pce
 				cross_v3_v3v3(nor, e1, e2);
 				normalize_v3(nor);
 
-				if(pce->inv_nor == 1)
+				if (pce->inv_nor == 1)
 					negate_v3(nor);
 
 				madd_v3_v3v3fl(co, pce->x0, nor, col->radius);
@@ -2875,7 +2942,7 @@ static float collision_newton_rhapson(ParticleCollision *col, float radius, Part
 	t1 = 0.001f;
 	d1 = 0.f;
 
-	for(iter=0; iter<10; iter++) {//, itersum++) {
+	for (iter=0; iter<10; iter++) {//, itersum++) {
 		/* get current location */
 		collision_interpolate_element(pce, t1, col->f, col);
 		interp_v3_v3v3(pce->p, col->co1, col->co2, t1);
@@ -2883,12 +2950,12 @@ static float collision_newton_rhapson(ParticleCollision *col, float radius, Part
 		d1 = distance_func(pce->p, radius, pce, n);
 
 		/* no movement, so no collision */
-		if(d1 == d0) {
+		if (d1 == d0) {
 			return -1.f;
 		}
 
 		/* particle already inside face, so report collision */
-		if(iter == 0 && d0 < 0.f && d0 > -radius) {
+		if (iter == 0 && d0 < 0.f && d0 > -radius) {
 			copy_v3_v3(pce->p, col->co1);
 			copy_v3_v3(pce->nor, n);
 			pce->inside = 1;
@@ -2903,7 +2970,7 @@ static float collision_newton_rhapson(ParticleCollision *col, float radius, Part
 		t1 -= d1*dd;
 
 		/* particle movin away from plane could also mean a strangely rotating face, so check from end */
-		if(iter == 0 && t1 < 0.f) {
+		if (iter == 0 && t1 < 0.f) {
 			t0 = 1.f;
 			collision_interpolate_element(pce, t0, col->f, col);
 			d0 = distance_func(col->co2, radius, pce, n);
@@ -2912,12 +2979,12 @@ static float collision_newton_rhapson(ParticleCollision *col, float radius, Part
 
 			continue;
 		}
-		else if(iter == 1 && (t1 < -COLLISION_ZERO || t1 > 1.f))
+		else if (iter == 1 && (t1 < -COLLISION_ZERO || t1 > 1.f))
 			return -1.f;
 
-		if(d1 <= COLLISION_ZERO && d1 >= -COLLISION_ZERO) {
-			if(t1 >= -COLLISION_ZERO && t1 <= 1.f) {
-				if(distance_func == nr_signed_distance_to_plane)
+		if (d1 <= COLLISION_ZERO && d1 >= -COLLISION_ZERO) {
+			if (t1 >= -COLLISION_ZERO && t1 <= 1.f) {
+				if (distance_func == nr_signed_distance_to_plane)
 					copy_v3_v3(pce->nor, n);
 
 				CLAMP(t1, 0.f, 1.f);
@@ -2940,7 +3007,7 @@ static int collision_sphere_to_tri(ParticleCollision *col, float radius, Particl
 
 	ct = collision_newton_rhapson(col, radius, pce, nr_signed_distance_to_plane);
 
-	if(ct >= 0.f && ct < *t && (result->inside==0 || pce->inside==1) ) {
+	if (ct >= 0.f && ct < *t && (result->inside==0 || pce->inside==1) ) {
 		float e1[3], e2[3], p0[3];
 		float e1e1, e1e2, e1p0, e2e2, e2p0, inv;
 
@@ -2959,7 +3026,7 @@ static int collision_sphere_to_tri(ParticleCollision *col, float radius, Particl
 		u = (e2e2 * e1p0 - e1e2 * e2p0) * inv;
 		v = (e1e1 * e2p0 - e1e2 * e1p0) * inv;
 
-		if(u>=0.f && u<=1.f && v>=0.f && u+v<=1.f) {
+		if (u>=0.f && u<=1.f && v>=0.f && u+v<=1.f) {
 			*result = *pce;
 
 			/* normal already calculated in pce */
@@ -2981,9 +3048,9 @@ static int collision_sphere_to_edges(ParticleCollision *col, float radius, Parti
 	float ct;
 	int i;
 
-	for(i=0; i<3; i++) {
+	for (i=0; i<3; i++) {
 		/* in case of a quad, no need to check "edge" that goes through face twice */
-		if((pce->x[3] && i==2))
+		if ((pce->x[3] && i==2))
 			continue;
 
 		cur = edge+i;
@@ -2994,14 +3061,14 @@ static int collision_sphere_to_edges(ParticleCollision *col, float radius, Parti
 
 		ct = collision_newton_rhapson(col, radius, cur, nr_distance_to_edge);
 
-		if(ct >= 0.f && ct < *t) {
+		if (ct >= 0.f && ct < *t) {
 			float u, e[3], vec[3];
 
 			sub_v3_v3v3(e, cur->x1, cur->x0);
 			sub_v3_v3v3(vec, cur->p, cur->x0);
 			u = dot_v3v3(vec, e) / dot_v3v3(e, e);
 
-			if(u < 0.f || u > 1.f)
+			if (u < 0.f || u > 1.f)
 				break;
 
 			*result = *cur;
@@ -3028,9 +3095,9 @@ static int collision_sphere_to_verts(ParticleCollision *col, float radius, Parti
 	float ct;
 	int i;
 
-	for(i=0; i<3; i++) {
+	for (i=0; i<3; i++) {
 		/* in case of quad, only check one vert the first time */
-		if(pce->x[3] && i != 1)
+		if (pce->x[3] && i != 1)
 			continue;
 
 		cur = vert+i;
@@ -3041,7 +3108,7 @@ static int collision_sphere_to_verts(ParticleCollision *col, float radius, Parti
 
 		ct = collision_newton_rhapson(col, radius, cur, nr_distance_to_vert);
 		
-		if(ct >= 0.f && ct < *t) {
+		if (ct >= 0.f && ct < *t) {
 			*result = *cur;
 
 			sub_v3_v3v3(result->nor, cur->p, cur->x0);
@@ -3081,18 +3148,18 @@ void BKE_psys_collision_neartest_cb(void *userdata, int index, const BVHTreeRay
 	pce.index = index;
 
 	/* don't collide with same face again */
-	if(col->hit == col->current && col->pce.index == index && col->pce.tot == 3)
+	if (col->hit == col->current && col->pce.index == index && col->pce.tot == 3)
 		return;
 
 	do
 	{	
 		collision = collision_sphere_to_tri(col, ray->radius, &pce, &t);
-		if(col->pce.inside == 0) {
+		if (col->pce.inside == 0) {
 			collision += collision_sphere_to_edges(col, ray->radius, &pce, &t);
 			collision += collision_sphere_to_verts(col, ray->radius, &pce, &t);
 		}
 
-		if(collision) {
+		if (collision) {
 			hit->dist = col->original_ray_length * t;
 			hit->index = index;
 				
@@ -3109,14 +3176,14 @@ void BKE_psys_collision_neartest_cb(void *userdata, int index, const BVHTreeRay
 		pce.v[2] = pce.v[3];
 		pce.v[3] = NULL;
 
-	} while(pce.x[2]);
+	} while (pce.x[2]);
 }
 static int collision_detect(ParticleData *pa, ParticleCollision *col, BVHTreeRayHit *hit, ListBase *colliders)
 {
 	ColliderCache *coll;
 	float ray_dir[3];
 
-	if(colliders->first == NULL)
+	if (colliders->first == NULL)
 		return 0;
 
 	sub_v3_v3v3(ray_dir, col->co2, col->co1);
@@ -3126,16 +3193,16 @@ static int collision_detect(ParticleData *pa, ParticleCollision *col, BVHTreeRay
 
 	/* even if particle is stationary we want to check for moving colliders */
 	/* if hit.dist is zero the bvhtree_ray_cast will just ignore everything */
-	if(hit->dist == 0.0f)
+	if (hit->dist == 0.0f)
 		hit->dist = col->original_ray_length = 0.000001f;
 
-	for(coll = colliders->first; coll; coll=coll->next){
+	for (coll = colliders->first; coll; coll=coll->next) {
 		/* for boids: don't check with current ground object */
-		if(coll->ob == col->skip)
+		if (coll->ob == col->skip)
 			continue;
 
 		/* particles should not collide with emitter at birth */
-		if(coll->ob == col->emitter && pa->time < col->cfra && pa->time >= col->old_cfra)
+		if (coll->ob == col->emitter && pa->time < col->cfra && pa->time >= col->old_cfra)
 			continue;
 
 		col->current = coll->ob;
@@ -3143,7 +3210,7 @@ static int collision_detect(ParticleData *pa, ParticleCollision *col, BVHTreeRay
 		col->fac1 = (col->old_cfra - coll->collmd->time_x) / (coll->collmd->time_xnew - coll->collmd->time_x);
 		col->fac2 = (col->cfra - coll->collmd->time_x) / (coll->collmd->time_xnew - coll->collmd->time_x);
 
-		if(col->md && col->md->bvhtree)
+		if (col->md && col->md->bvhtree)
 			BLI_bvhtree_ray_cast(col->md->bvhtree, col->co1, ray_dir, col->radius, hit, BKE_psys_collision_neartest_cb, col);
 	}
 
@@ -3164,7 +3231,7 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR
 	interp_v3_v3v3(co, col->co1, col->co2, x);
 
 	/* particle dies in collision */
-	if(through == 0 && (kill || pd->flag & PDEFLE_KILL_PART)) {
+	if (through == 0 && (kill || pd->flag & PDEFLE_KILL_PART)) {
 		pa->alive = PARS_DYING;
 		pa->dietime = col->old_cfra + (col->cfra - col->old_cfra) * f;
 
@@ -3205,9 +3272,9 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR
 		madd_v3_v3v3fl(vc_tan, pce->vel, pce->nor, -vc_dot);
 
 		/* handle friction effects (tangential and angular velocity) */
-		if(frict > 0.0f) {
+		if (frict > 0.0f) {
 			/* angular <-> linear velocity */
-			if(dynamic_rotation) {
+			if (dynamic_rotation) {
 				float vr_tan[3], v1_tan[3], ave[3];
 					
 				/* linear velocity of particle surface */
@@ -3218,9 +3285,9 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR
 				sub_v3_v3v3(v1_tan, v0_tan, vc_tan);
 						
 				/* The resulting velocity is a weighted average of particle cm & surface
-					* velocity. This weight (related to particle's moment of inertia) could
-					* be made a parameter for angular <-> linear conversion.
-					*/
+				 * velocity. This weight (related to particle's moment of inertia) could
+				 * be made a parameter for angular <-> linear conversion.
+				 */
 				madd_v3_v3fl(v1_tan, vr_tan, -0.4);
 				mul_v3_fl(v1_tan, 1.0f/1.4f); /* 1/(1+0.4) */
 
@@ -3249,9 +3316,9 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR
 
 		/* stickness was possibly added before, so cancel that before calculating new normal velocity */
 		/* otherwise particles go flying out of the surface because of high reversed sticky velocity */
-		if(v0_dot < 0.0f) {
+		if (v0_dot < 0.0f) {
 			v0_dot += pd->pdef_stickness;
-			if(v0_dot > 0.0f)
+			if (v0_dot > 0.0f)
 				v0_dot = 0.0f;
 		}
 
@@ -3261,9 +3328,9 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR
 
 		/* calculate normal particle velocity */
 		/* special case for object hitting the particle from behind */
-		if(through==0 && ((vc_dot>0.0f && v0_dot>0.0f && vc_dot>v0_dot) || (vc_dot<0.0f && v0_dot<0.0f && vc_dot<v0_dot)))
+		if (through==0 && ((vc_dot>0.0f && v0_dot>0.0f && vc_dot>v0_dot) || (vc_dot<0.0f && v0_dot<0.0f && vc_dot<v0_dot)))
 			mul_v3_v3fl(v0_nor, pce->nor, vc_dot);
-		else if(v0_dot > 0.f)
+		else if (v0_dot > 0.f)
 			mul_v3_v3fl(v0_nor, pce->nor, vc_dot + (through ? -1.0f : 1.0f) * v0_dot);
 		else
 			mul_v3_v3fl(v0_nor, pce->nor, vc_dot + (through ? 1.0f : -1.0f) * v0_dot);
@@ -3271,10 +3338,10 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR
 		/* combine components together again */
 		add_v3_v3v3(v0, v0_nor, v0_tan);
 
-		if(col->boid) {
+		if (col->boid) {
 			/* keep boids above ground */
 			BoidParticle *bpa = pa->boid;
-			if(bpa->data.mode == eBoidMode_OnLand || co[2] <= col->boid_z) {
+			if (bpa->data.mode == eBoidMode_OnLand || co[2] <= col->boid_z) {
 				co[2] = col->boid_z;
 				v0[2] = 0.0f;
 			}
@@ -3286,23 +3353,23 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR
 		madd_v3_v3v3fl(pa->state.vel, v0, col->acc, dt2);
 
 		/* make sure particle stays on the right side of the surface */
-		if(!through) {
+		if (!through) {
 			distance = collision_point_distance_with_normal(co, pce, -1.f, col, nor);
 			
-			if(distance < col->radius + COLLISION_MIN_DISTANCE)
+			if (distance < col->radius + COLLISION_MIN_DISTANCE)
 				madd_v3_v3fl(co, nor, col->radius + COLLISION_MIN_DISTANCE - distance);
 
 			dot = dot_v3v3(nor, v0);
-			if(dot < 0.f)
+			if (dot < 0.f)
 				madd_v3_v3fl(v0, nor, -dot);
 
 			distance = collision_point_distance_with_normal(pa->state.co, pce, 1.f, col, nor);
 
-			if(distance < col->radius + COLLISION_MIN_DISTANCE)
+			if (distance < col->radius + COLLISION_MIN_DISTANCE)
 				madd_v3_v3fl(pa->state.co, nor, col->radius + COLLISION_MIN_DISTANCE - distance);
 
 			dot = dot_v3v3(nor, pa->state.vel);
-			if(dot < 0.f)
+			if (dot < 0.f)
 				madd_v3_v3fl(pa->state.vel, nor, -dot);
 		}
 
@@ -3377,21 +3444,21 @@ static void collision_check(ParticleSimulationData *sim, int p, float dfra, floa
 	col.radius = ((part->flag & PART_SIZE_DEFL) || (part->phystype == PART_PHYS_BOIDS)) ? pa->size : COLLISION_MIN_RADIUS;
 
 	/* override for boids */
-	if(part->phystype == PART_PHYS_BOIDS && part->boids->options & BOID_ALLOW_LAND) {
+	if (part->phystype == PART_PHYS_BOIDS && part->boids->options & BOID_ALLOW_LAND) {
 		col.boid = 1;
 		col.boid_z = pa->state.co[2];
 		col.skip = pa->boid->ground;
 	}
 
 	/* 10 iterations to catch multiple collisions */
-	while(collision_count < COLLISION_MAX_COLLISIONS){
-		if(collision_detect(pa, &col, &hit, sim->colliders)) {
+	while (collision_count < COLLISION_MAX_COLLISIONS) {
+		if (collision_detect(pa, &col, &hit, sim->colliders)) {
 			
 			collision_count++;
 
-			if(collision_count == COLLISION_MAX_COLLISIONS)
+			if (collision_count == COLLISION_MAX_COLLISIONS)
 				collision_fail(pa, &col);
-			else if(collision_response(pa, &col, &hit, part->flag & PART_DIE_ON_COL, part->flag & PART_ROT_DYN)==0)
+			else if (collision_response(pa, &col, &hit, part->flag & PART_DIE_ON_COL, part->flag & PART_ROT_DYN)==0)
 				return;
 		}
 		else
@@ -3410,22 +3477,22 @@ static void psys_update_path_cache(ParticleSimulationData *sim, float cfra)
 	Base *base;
 	int distr=0, alloc=0, skip=0;
 
-	if((psys->part->childtype && psys->totchild != get_psys_tot_child(sim->scene, psys)) || psys->recalc&PSYS_RECALC_RESET)
+	if ((psys->part->childtype && psys->totchild != get_psys_tot_child(sim->scene, psys)) || psys->recalc&PSYS_RECALC_RESET)
 		alloc=1;
 
-	if(alloc || psys->recalc&PSYS_RECALC_CHILD || (psys->vgroup[PSYS_VG_DENSITY] && (sim->ob && sim->ob->mode & OB_MODE_WEIGHT_PAINT)))
+	if (alloc || psys->recalc&PSYS_RECALC_CHILD || (psys->vgroup[PSYS_VG_DENSITY] && (sim->ob && sim->ob->mode & OB_MODE_WEIGHT_PAINT)))
 		distr=1;
 
-	if(distr){
-		if(alloc)
+	if (distr) {
+		if (alloc)
 			realloc_particles(sim, sim->psys->totpart);
 
-		if(get_psys_tot_child(sim->scene, psys)) {
+		if (get_psys_tot_child(sim->scene, psys)) {
 			/* don't generate children while computing the hair keys */
-			if(!(psys->part->type == PART_HAIR) || (psys->flag & PSYS_HAIR_DONE)) {
+			if (!(psys->part->type == PART_HAIR) || (psys->flag & PSYS_HAIR_DONE)) {
 				distribute_particles(sim, PART_FROM_CHILD);
 
-				if(part->childtype==PART_CHILD_FACES && part->parents != 0.0f)
+				if (part->childtype==PART_CHILD_FACES && part->parents != 0.0f)
 					psys_find_parents(sim);
 			}
 		}
@@ -3433,19 +3500,19 @@ static void psys_update_path_cache(ParticleSimulationData *sim, float cfra)
 			psys_free_children(psys);
 	}
 
-	if((part->type==PART_HAIR || psys->flag&PSYS_KEYED || psys->pointcache->flag & PTCACHE_BAKED)==0)
+	if ((part->type==PART_HAIR || psys->flag&PSYS_KEYED || psys->pointcache->flag & PTCACHE_BAKED)==0)
 		skip = 1; /* only hair, keyed and baked stuff can have paths */
-	else if(part->ren_as != PART_DRAW_PATH && !(part->type==PART_HAIR && ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)))
+	else if (part->ren_as != PART_DRAW_PATH && !(part->type==PART_HAIR && ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)))
 		skip = 1; /* particle visualization must be set as path */
-	else if(!psys->renderdata) {
-		if(part->draw_as != PART_DRAW_REND)
+	else if (!psys->renderdata) {
+		if (part->draw_as != PART_DRAW_REND)
 			skip = 1; /* draw visualization */
-		else if(psys->pointcache->flag & PTCACHE_BAKING)
+		else if (psys->pointcache->flag & PTCACHE_BAKING)
 			skip = 1; /* no need to cache paths while baking dynamics */
-		else if(psys_in_edit_mode(sim->scene, psys)) {
-			if((pset->flag & PE_DRAW_PART)==0)
+		else if (psys_in_edit_mode(sim->scene, psys)) {
+			if ((pset->flag & PE_DRAW_PART)==0)
 				skip = 1;
-			else if(part->childtype==0 && (psys->flag & PSYS_HAIR_DYNAMICS && psys->pointcache->flag & PTCACHE_BAKED)==0)
+			else if (part->childtype==0 && (psys->flag & PSYS_HAIR_DYNAMICS && psys->pointcache->flag & PTCACHE_BAKED)==0)
 				skip = 1; /* in edit mode paths are needed for child particles and dynamic hair */
 		}
 	}
@@ -3454,30 +3521,30 @@ static void psys_update_path_cache(ParticleSimulationData *sim, float cfra)
 	/* particle instance modifier with "path" option need cached paths even if particle system doesn't */
 	for (base = sim->scene->base.first; base; base= base->next) {
 		ModifierData *md = modifiers_findByType(base->object, eModifierType_ParticleInstance);
-		if(md) {
+		if (md) {
 			ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData *)md;
-			if(pimd->flag & eParticleInstanceFlag_Path && pimd->ob == sim->ob && pimd->psys == (psys - (ParticleSystem*)sim->ob->particlesystem.first)) {
+			if (pimd->flag & eParticleInstanceFlag_Path && pimd->ob == sim->ob && pimd->psys == (psys - (ParticleSystem*)sim->ob->particlesystem.first)) {
 				skip = 0;
 				break;
 			}
 		}
 	}
 
-	if(!skip) {
+	if (!skip) {
 		psys_cache_paths(sim, cfra);
 
 		/* for render, child particle paths are computed on the fly */
-		if(part->childtype) {
-			if(!psys->totchild)
+		if (part->childtype) {
+			if (!psys->totchild)
 				skip = 1;
-			else if(psys->part->type == PART_HAIR && (psys->flag & PSYS_HAIR_DONE)==0)
+			else if (psys->part->type == PART_HAIR && (psys->flag & PSYS_HAIR_DONE)==0)
 				skip = 1;
 
-			if(!skip)
+			if (!skip)
 				psys_cache_child_paths(sim, cfra, 0);
 		}
 	}
-	else if(psys->pathcache)
+	else if (psys->pathcache)
 		psys_free_path_cache(psys, NULL);
 }
 
@@ -3496,7 +3563,7 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
 	float hairmat[4][4];
 	float (*deformedVerts)[3];
 
-	if(!psys->clmd) {
+	if (!psys->clmd) {
 		psys->clmd = (ClothModifierData*)modifier_new(eModifierType_Cloth);
 		psys->clmd->sim_parms->goalspring = 0.0f;
 		psys->clmd->sim_parms->flags |= CLOTH_SIMSETTINGS_FLAG_GOAL|CLOTH_SIMSETTINGS_FLAG_NO_SPRING_COMPRESS;
@@ -3510,13 +3577,13 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
 	totedge = totpoint;
 	totpoint += psys->totpart;
 
-	if(dm && (totpoint != dm->getNumVerts(dm) || totedge != dm->getNumEdges(dm))) {
+	if (dm && (totpoint != dm->getNumVerts(dm) || totedge != dm->getNumEdges(dm))) {
 		dm->release(dm);
 		dm = psys->hair_in_dm = NULL;
 	}
 
-	if(!dm) {
-		dm = psys->hair_in_dm = CDDM_new(totpoint, totedge, 0);
+	if (!dm) {
+		dm = psys->hair_in_dm = CDDM_new(totpoint, totedge, 0, 0, 0);
 		DM_add_vert_layer(dm, CD_MDEFORMVERT, CD_CALLOC, NULL);
 	}
 
@@ -3529,15 +3596,15 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
 	/* make vgroup for pin roots etc.. */
 	psys->particles->hair_index = 1;
 	LOOP_PARTICLES {
-		if(p)
+		if (p)
 			pa->hair_index = (pa-1)->hair_index + (pa-1)->totkey + 1;
 
 		psys_mat_hair_to_object(sim->ob, sim->psmd->dm, psys->part->from, pa, hairmat);
 
-		for(k=0, key=pa->hair; k<pa->totkey; k++,key++) {
+		for (k=0, key=pa->hair; k<pa->totkey; k++,key++) {
 			
 			/* create fake root before actual root to resist bending */
-			if(k==0) {
+			if (k==0) {
 				float temp[3];
 				sub_v3_v3v3(temp, key->co, (key+1)->co);
 				copy_v3_v3(mvert->co, key->co);
@@ -3549,9 +3616,9 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
 				medge->v2 = pa->hair_index;
 				medge++;
 
-				if(dvert) {
-					if(!dvert->totweight) {
-						dvert->dw = MEM_callocN (sizeof(MDeformWeight), "deformWeight");
+				if (dvert) {
+					if (!dvert->totweight) {
+						dvert->dw = MEM_callocN(sizeof(MDeformWeight), "deformWeight");
 						dvert->totweight = 1;
 					}
 
@@ -3564,15 +3631,15 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
 			mul_m4_v3(hairmat, mvert->co);
 			mvert++;
 			
-			if(k) {
+			if (k) {
 				medge->v1 = pa->hair_index + k - 1;
 				medge->v2 = pa->hair_index + k;
 				medge++;
 			}
 
-			if(dvert) {
-				if(!dvert->totweight) {
-					dvert->dw = MEM_callocN (sizeof(MDeformWeight), "deformWeight");
+			if (dvert) {
+				if (!dvert->totweight) {
+					dvert->dw = MEM_callocN(sizeof(MDeformWeight), "deformWeight");
 					dvert->totweight = 1;
 				}
 				/* roots should be 1.0, the rest can be anything from 0.0 to 1.0 */
@@ -3582,7 +3649,7 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
 		}
 	}
 
-	if(psys->hair_out_dm)
+	if (psys->hair_out_dm)
 		psys->hair_out_dm->release(psys->hair_out_dm);
 
 	psys->clmd->point_cache = psys->pointcache;
@@ -3609,25 +3676,25 @@ static void hair_step(ParticleSimulationData *sim, float cfra)
 
 	LOOP_PARTICLES {
 		pa->size = part->size;
-		if(part->randsize > 0.0f)
+		if (part->randsize > 0.0f)
 			pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1);
 
-		if(PSYS_FRAND(p) > disp)
+		if (PSYS_FRAND(p) > disp)
 			pa->flag |= PARS_NO_DISP;
 		else
 			pa->flag &= ~PARS_NO_DISP;
 	}
 
-	if(psys->recalc & PSYS_RECALC_RESET) {
+	if (psys->recalc & PSYS_RECALC_RESET) {
 		/* need this for changing subsurf levels */
 		psys_calc_dmcache(sim->ob, sim->psmd->dm, psys);
 
-		if(psys->clmd)
+		if (psys->clmd)
 			cloth_free_modifier(psys->clmd);
 	}
 
 	/* dynamics with cloth simulation, psys->particles can be NULL with 0 particles [#25519] */
-	if(psys->part->type==PART_HAIR && psys->flag & PSYS_HAIR_DYNAMICS && psys->particles)
+	if (psys->part->type==PART_HAIR && psys->flag & PSYS_HAIR_DYNAMICS && psys->particles)
 		do_hair_dynamics(sim);
 
 	/* following lines were removed r29079 but cause bug [#22811], see report for details */
@@ -3648,12 +3715,12 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra))
 	
 	psys->lattice= psys_get_lattice(sim);
 
-	if(psys->totpart==0) return;
+	if (psys->totpart==0) return;
 	
 	/* save new keys for elements if needed */
 	LOOP_PARTICLES {
 		/* first time alloc */
-		if(pa->totkey==0 || pa->hair==NULL) {
+		if (pa->totkey==0 || pa->hair==NULL) {
 			pa->hair = MEM_callocN((psys->part->hair_step + 1) * sizeof(HairKey), "HairKeys");
 			pa->totkey = 0;
 		}
@@ -3665,7 +3732,7 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra))
 		copy_v3_v3(key->co, pa->state.co);
 		mul_m4_v3(ob->imat, key->co);
 
-		if(pa->totkey) {
+		if (pa->totkey) {
 			sub_v3_v3(key->co, root->co);
 			psys_vec_rot_to_face(sim->psmd->dm, pa, key->co);
 		}
@@ -3677,23 +3744,23 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra))
 		pa->totkey++;
 
 		/* root is always in the origin of hair space so we set it to be so after the last key is saved*/
-		if(pa->totkey == psys->part->hair_step + 1)
+		if (pa->totkey == psys->part->hair_step + 1)
 			root->co[0] = root->co[1] = root->co[2] = 0.0f;
 	}
 }
 
 /* Code for an adaptive time step based on the Courant-Friedrichs-Lewy
-   condition. */
+ * condition. */
 #define MIN_TIMESTEP 1.0f / 101.0f
-/* Tolerance of 1.5 means the last subframe neither favours growing nor
-   shrinking (e.g if it were 1.3, the last subframe would tend to be too
-   small). */
+/* Tolerance of 1.5 means the last subframe neither favors growing nor
+ * shrinking (e.g if it were 1.3, the last subframe would tend to be too
+ * small). */
 #define TIMESTEP_EXPANSION_TOLERANCE 1.5f
 
 /* Calculate the speed of the particle relative to the local scale of the
-   simulation. This should be called once per particle during a simulation
-   step, after the velocity has been updated. element_size defines the scale of
-   the simulation, and is typically the distance to neighbourning particles. */
+ * simulation. This should be called once per particle during a simulation
+ * step, after the velocity has been updated. element_size defines the scale of
+ * the simulation, and is typically the distance to neighbourning particles. */
 void update_courant_num(ParticleSimulationData *sim, ParticleData *pa,
 	float dtime, SPHData *sphdata)
 {
@@ -3746,11 +3813,11 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
 	timestep = psys_get_timestep(sim);
 	dtime= dfra*timestep;
 
-	if(dfra < 0.0f) {
+	if (dfra < 0.0f) {
 		LOOP_EXISTING_PARTICLES {
 			psys_get_texture(sim, pa, &ptex, PAMAP_SIZE, cfra);
 			pa->size = part->size*ptex.size;
-			if(part->randsize > 0.0f)
+			if (part->randsize > 0.0f)
 				pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1);
 
 			reset_particle(sim, pa, dtime, cfra);
@@ -3762,7 +3829,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
 
 	psys_update_effectors(sim);
 
-	if(part->type != PART_HAIR)
+	if (part->type != PART_HAIR)
 		sim->colliders = get_collider_cache(sim->scene, sim->ob, NULL);
 
 	/* initialize physics type specific stuff */
@@ -3780,8 +3847,8 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
 
 			boids_precalc_rules(part, cfra);
 
-			for(; pt; pt=pt->next) {
-				if(pt->ob)
+			for (; pt; pt=pt->next) {
+				if (pt->ob)
 					psys_update_particle_tree(BLI_findlink(&pt->ob->particlesystem, pt->psys-1), cfra);
 			}
 			break;
@@ -3791,8 +3858,8 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
 			ParticleTarget *pt = psys->targets.first;
 			psys_update_particle_bvhtree(psys, cfra);
 			
-			for(; pt; pt=pt->next) {  /* Updating others systems particle tree for fluid-fluid interaction */
-				if(pt->ob)
+			for (; pt; pt=pt->next) {  /* Updating others systems particle tree for fluid-fluid interaction */
+				if (pt->ob)
 					psys_update_particle_bvhtree(BLI_findlink(&pt->ob->particlesystem, pt->psys-1), cfra);
 			}
 			break;
@@ -3805,7 +3872,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
 		psys_get_texture(sim, pa, &ptex, PAMAP_SIZE, cfra);
 
 		pa->size = part->size*ptex.size;
-		if(part->randsize > 0.0f)
+		if (part->randsize > 0.0f)
 			pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1);
 
 		birthtime = pa->time;
@@ -3814,29 +3881,30 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
 		/* store this, so we can do multiple loops over particles */
 		pa->state.time = dfra;
 
-		if(dietime <= cfra && psys->cfra < dietime){
+		if (dietime <= cfra && psys->cfra < dietime) {
 			/* particle dies some time between this and last step */
 			pa->state.time = dietime - ((birthtime > psys->cfra) ? birthtime : psys->cfra);
 			pa->alive = PARS_DYING;
 		}
-		else if(birthtime <= cfra && birthtime >= psys->cfra){
+		else if (birthtime <= cfra && birthtime >= psys->cfra) {
 			/* particle is born some time between this and last step*/
 			reset_particle(sim, pa, dfra*timestep, cfra);
 			pa->alive = PARS_ALIVE;
 			pa->state.time = cfra - birthtime;
 		}
-		else if(dietime < cfra){
+		else if (dietime < cfra) {
 			/* nothing to be done when particle is dead */
 		}
 
 		/* only reset unborn particles if they're shown or if the particle is born soon*/
-		if(pa->alive==PARS_UNBORN
-			&& (part->flag & PART_UNBORN || cfra + psys->pointcache->step > pa->time))
+		if (pa->alive==PARS_UNBORN && (part->flag & PART_UNBORN || (cfra + psys->pointcache->step > pa->time))) {
 			reset_particle(sim, pa, dtime, cfra);
-		else if(part->phystype == PART_PHYS_NO)
+		}
+		else if (part->phystype == PART_PHYS_NO) {
 			reset_particle(sim, pa, dtime, cfra);
+		}
 
-		if(ELEM(pa->alive, PARS_ALIVE, PARS_DYING)==0 || (pa->flag & (PARS_UNEXIST|PARS_NO_DISP)))
+		if (ELEM(pa->alive, PARS_ALIVE, PARS_DYING)==0 || (pa->flag & (PARS_UNEXIST|PARS_NO_DISP)))
 			pa->state.time = -1.f;
 	}
 
@@ -3848,7 +3916,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
 				basic_integrate(sim, p, pa->state.time, cfra);
 	
 				/* deflection */
-				if(sim->colliders)
+				if (sim->colliders)
 					collision_check(sim, p, pa->state.time, cfra);
 
 				/* rotations */
@@ -3863,11 +3931,11 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
 				
 				boid_brain(&bbd, p, pa);
 
-				if(pa->alive != PARS_DYING) {
+				if (pa->alive != PARS_DYING) {
 					boid_body(&bbd, pa);
 
 					/* deflection */
-					if(sim->colliders)
+					if (sim->colliders)
 						collision_check(sim, p, pa->state.time, cfra);
 				}
 			}
@@ -3886,7 +3954,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
 				/* actual fluids calculations */
 				sph_integrate(sim, pa, pa->state.time, &sphdata);
 
-				if(sim->colliders)
+				if (sim->colliders)
 					collision_check(sim, p, pa->state.time, cfra);
 				
 				/* SPH particles are not physical particles, just interpolation
@@ -3907,7 +3975,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
 
 	/* finalize particle state and time after dynamics */
 	LOOP_DYNAMIC_PARTICLES {
-		if(pa->alive == PARS_DYING){
+		if (pa->alive == PARS_DYING) {
 			pa->alive=PARS_DEAD;
 			pa->state.time=pa->dietime;
 		}
@@ -3919,11 +3987,11 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
 }
 static void update_children(ParticleSimulationData *sim)
 {
-	if((sim->psys->part->type == PART_HAIR) && (sim->psys->flag & PSYS_HAIR_DONE)==0)
+	if ((sim->psys->part->type == PART_HAIR) && (sim->psys->flag & PSYS_HAIR_DONE)==0)
 	/* don't generate children while growing hair - waste of time */
 		psys_free_children(sim->psys);
-	else if(sim->psys->part->childtype) {
-		if(sim->psys->totchild != get_psys_tot_child(sim->scene, sim->psys))
+	else if (sim->psys->part->childtype) {
+		if (sim->psys->totchild != get_psys_tot_child(sim->scene, sim->psys))
 			distribute_particles(sim, PART_FROM_CHILD);
 		else {
 			/* Children are up to date, nothing to do. */
@@ -3948,7 +4016,7 @@ static void cached_step(ParticleSimulationData *sim, float cfra)
 	LOOP_PARTICLES {
 		psys_get_texture(sim, pa, &ptex, PAMAP_SIZE, cfra);
 		pa->size = part->size*ptex.size;
-		if(part->randsize > 0.0f)
+		if (part->randsize > 0.0f)
 			pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1);
 
 		psys->lattice= psys_get_lattice(sim);
@@ -3956,22 +4024,22 @@ static void cached_step(ParticleSimulationData *sim, float cfra)
 		dietime = pa->dietime;
 
 		/* update alive status and push events */
-		if(pa->time > cfra) {
+		if (pa->time > cfra) {
 			pa->alive = PARS_UNBORN;
-			if(part->flag & PART_UNBORN && (psys->pointcache->flag & PTCACHE_EXTERNAL) == 0)
+			if (part->flag & PART_UNBORN && (psys->pointcache->flag & PTCACHE_EXTERNAL) == 0)
 				reset_particle(sim, pa, 0.0f, cfra);
 		}
-		else if(dietime <= cfra)
+		else if (dietime <= cfra)
 			pa->alive = PARS_DEAD;
 		else
 			pa->alive = PARS_ALIVE;
 
-		if(psys->lattice){
+		if (psys->lattice) {
 			end_latt_deform(psys->lattice);
 			psys->lattice= NULL;
 		}
 
-		if(PSYS_FRAND(p) > disp)
+		if (PSYS_FRAND(p) > disp)
 			pa->flag |= PARS_NO_DISP;
 		else
 			pa->flag &= ~PARS_NO_DISP;
@@ -3981,7 +4049,7 @@ static void cached_step(ParticleSimulationData *sim, float cfra)
 static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
 {	
 	ParticleSystem *psys = sim->psys;
-	if(psys->particles){
+	if (psys->particles) {
 		MEM_freeN(psys->particles);
 		psys->particles = 0;
 		psys->totpart = 0;
@@ -3992,7 +4060,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;
@@ -4003,7 +4071,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
 			int readMask, activeParts = 0, fileParts = 0;
 			gzFile gzf;
 	
-// XXX			if(ob==G.obedit) // off...
+// XXX			if (ob==G.obedit) // off...
 //				return;
 
 			// ok, start loading
@@ -4013,9 +4081,9 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
 
 			BLI_path_frame(filename, curFrame, 0); // fixed #frame-no 
 
-			gzf = gzopen(filename, "rb");
+			gzf = BLI_gzopen(filename, "rb");
 			if (!gzf) {
-				BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer),"readFsPartData::error - Unable to open file for reading '%s' \n", filename); 
+				BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer),"readFsPartData::error - Unable to open file for reading '%s'\n", filename);
 				// XXX bad level call elbeemDebugOut(debugStrBuffer);
 				return;
 			}
@@ -4033,24 +4101,24 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
 			// set up reading mask
 			readMask = fss->typeFlags;
 			
-			for(p=0, pa=psys->particles; p<totpart; p++, pa++) {
+			for (p=0, pa=psys->particles; p<totpart; p++, pa++) {
 				int ptype=0;
 	
 				gzread(gzf, &ptype, sizeof( ptype )); 
-				if(ptype&readMask) {
+				if (ptype&readMask) {
 					activeParts++;
 	
 					gzread(gzf, &(pa->size), sizeof( float )); 
 	
 					pa->size /= 10.0f;
 	
-					for(j=0; j<3; j++) {
+					for (j=0; j<3; j++) {
 						float wrf;
 						gzread(gzf, &wrf, sizeof( wrf )); 
 						pa->state.co[j] = wrf;
 						//fprintf(stderr,"Rj%d ",j);
 					}
-					for(j=0; j<3; j++) {
+					for (j=0; j<3; j++) {
 						float wrf;
 						gzread(gzf, &wrf, sizeof( wrf )); 
 						pa->state.vel[j] = wrf;
@@ -4064,19 +4132,20 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
 					pa->dietime = sim->scene->r.efra + 1;
 					pa->lifetime = sim->scene->r.efra;
 					pa->alive = PARS_ALIVE;
-					//if(a<25) fprintf(stderr,"FSPARTICLE debug set %s , a%d = %f,%f,%f , life=%f \n", filename, a, pa->co[0],pa->co[1],pa->co[2], pa->lifetime );
-				} else {
+					//if (a < 25) fprintf(stderr,"FSPARTICLE debug set %s , a%d = %f,%f,%f , life=%f\n", filename, a, pa->co[0],pa->co[1],pa->co[2], pa->lifetime );
+				}
+				else {
 					// skip...
-					for(j=0; j<2*3+1; j++) {
+					for (j=0; j<2*3+1; j++) {
 						float wrf; gzread(gzf, &wrf, sizeof( wrf )); 
 					}
 				}
 				fileParts++;
 			}
-			gzclose( gzf );
+			gzclose(gzf);
 	
 			totpart = psys->totpart = activeParts;
-			BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"readFsPartData::done - particles:%d, active:%d, file:%d, mask:%d  \n", psys->totpart,activeParts,fileParts,readMask);
+			BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"readFsPartData::done - particles:%d, active:%d, file:%d, mask:%d\n", psys->totpart,activeParts,fileParts,readMask);
 			// bad level call
 			// XXX elbeemDebugOut(debugStrBuffer);
 			
@@ -4091,7 +4160,7 @@ static int emit_particles(ParticleSimulationData *sim, PTCacheID *pid, float UNU
 	int oldtotpart = psys->totpart;
 	int totpart = tot_particles(psys, pid);
 
-	if(totpart != oldtotpart)
+	if (totpart != oldtotpart)
 		realloc_particles(sim, totpart);
 
 	return totpart - oldtotpart;
@@ -4114,11 +4183,11 @@ static void system_step(ParticleSimulationData *sim, float cfra)
 	int startframe = 0, endframe = 100, oldtotpart = 0;
 
 	/* cache shouldn't be used for hair or "continue physics" */
-	if(part->type != PART_HAIR && BKE_ptcache_get_continue_physics() == 0) {
+	if (part->type != PART_HAIR && BKE_ptcache_get_continue_physics() == 0) {
 		psys_clear_temp_pointcache(psys);
 
 		/* set suitable cache range automatically */
-		if((cache->flag & (PTCACHE_BAKING|PTCACHE_BAKED))==0)
+		if ((cache->flag & (PTCACHE_BAKING|PTCACHE_BAKED))==0)
 			psys_get_pointcache_start_end(sim->scene, psys, &cache->startframe, &cache->endframe);
 
 		pid = &ptcacheid;
@@ -4127,7 +4196,7 @@ static void system_step(ParticleSimulationData *sim, float cfra)
 		BKE_ptcache_id_time(pid, sim->scene, 0.0f, &startframe, &endframe, NULL);
 
 		/* clear everythin on start frame */
-		if(cfra == startframe) {
+		if (cfra == startframe) {
 			BKE_ptcache_id_reset(sim->scene, pid, PTCACHE_RESET_OUTDATED);
 			BKE_ptcache_validate(cache, startframe);
 			cache->flag &= ~PTCACHE_REDO_NEEDED;
@@ -4138,7 +4207,7 @@ static void system_step(ParticleSimulationData *sim, float cfra)
 
 /* 1. emit particles and redo particles if needed */
 	oldtotpart = psys->totpart;
-	if(emit_particles(sim, pid, cfra) || psys->recalc & PSYS_RECALC_RESET) {
+	if (emit_particles(sim, pid, cfra) || psys->recalc & PSYS_RECALC_RESET) {
 		distribute_particles(sim, part->from);
 		initialize_all_particles(sim);
 		/* reset only just created particles (on startframe all particles are recreated) */
@@ -4158,33 +4227,33 @@ static void system_step(ParticleSimulationData *sim, float cfra)
 	}
 
 /* 2. try to read from the cache */
-	if(pid) {
+	if (pid) {
 		int cache_result = BKE_ptcache_read(pid, cache_cfra);
 
-		if(ELEM(cache_result, PTCACHE_READ_EXACT, PTCACHE_READ_INTERPOLATED)) {
+		if (ELEM(cache_result, PTCACHE_READ_EXACT, PTCACHE_READ_INTERPOLATED)) {
 			cached_step(sim, cfra);
 			update_children(sim);
 			psys_update_path_cache(sim, cfra);
 
 			BKE_ptcache_validate(cache, (int)cache_cfra);
 
-			if(cache_result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED)
+			if (cache_result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED)
 				BKE_ptcache_write(pid, (int)cache_cfra);
 
 			return;
 		}
 		/* Cache is supposed to be baked, but no data was found so bail out */
-		else if(cache->flag & PTCACHE_BAKED) {
+		else if (cache->flag & PTCACHE_BAKED) {
 			psys_reset(psys, PSYS_RESET_CACHE_MISS);
 			return;
 		}
-		else if(cache_result == PTCACHE_READ_OLD) {
+		else if (cache_result == PTCACHE_READ_OLD) {
 			psys->cfra = (float)cache->simframe;
 			cached_step(sim, psys->cfra);
 		}
 
 		/* if on second frame, write cache for first frame */
-		if(psys->cfra == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0))
+		if (psys->cfra == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0))
 			BKE_ptcache_write(pid, startframe);
 	}
 	else
@@ -4195,33 +4264,35 @@ static void system_step(ParticleSimulationData *sim, float cfra)
 	disp= (float)psys_get_current_display_percentage(psys)/100.0f;
 
 	LOOP_PARTICLES {
-		if(PSYS_FRAND(p) > disp)
+		if (PSYS_FRAND(p) > disp)
 			pa->flag |= PARS_NO_DISP;
 		else
 			pa->flag &= ~PARS_NO_DISP;
 	}
 
-	if(psys->totpart) {
+	if (psys->totpart) {
 		int dframe, totframesback = 0;
 		float t_frac, dt_frac;
 
 		/* handle negative frame start at the first frame by doing
 		 * all the steps before the first frame */
-		if((int)cfra == startframe && part->sta < startframe)
+		if ((int)cfra == startframe && part->sta < startframe)
 			totframesback = (startframe - (int)part->sta);
 
 		if (!(part->time_flag & PART_TIME_AUTOSF)) {
 			/* Constant time step */
 			psys->dt_frac = 1.0f / (float) (part->subframes + 1);
-		} else if ((int)cfra == startframe) {
+		}
+		else if ((int)cfra == startframe) {
 			/* Variable time step; use a very conservative value at the start.
 			 * If it doesn't need to be so small, it will quickly grow. */
 			psys->dt_frac = 1.0;
-		} else if (psys->dt_frac < MIN_TIMESTEP) {
+		}
+		else if (psys->dt_frac < MIN_TIMESTEP) {
 			psys->dt_frac = MIN_TIMESTEP;
 		}
 
-		for(dframe=-totframesback; dframe<=0; dframe++) {
+		for (dframe=-totframesback; dframe<=0; dframe++) {
 			/* simulate each subframe */
 			dt_frac = psys->dt_frac;
 			for (t_frac = dt_frac; t_frac <= 1.0f; t_frac += dt_frac) {
@@ -4238,16 +4309,16 @@ static void system_step(ParticleSimulationData *sim, float cfra)
 	}
 	
 /* 4. only write cache starting from second frame */
-	if(pid) {
+	if (pid) {
 		BKE_ptcache_validate(cache, (int)cache_cfra);
-		if((int)cache_cfra != startframe)
+		if ((int)cache_cfra != startframe)
 			BKE_ptcache_write(pid, (int)cache_cfra);
 	}
 
 	update_children(sim);
 
 /* cleanup */
-	if(psys->lattice){
+	if (psys->lattice) {
 		end_latt_deform(psys->lattice);
 		psys->lattice= NULL;
 	}
@@ -4261,17 +4332,17 @@ static void psys_changed_type(ParticleSimulationData *sim)
 
 	BKE_ptcache_id_from_particles(&pid, sim->ob, sim->psys);
 
-	if(part->phystype != PART_PHYS_KEYED)
+	if (part->phystype != PART_PHYS_KEYED)
 		sim->psys->flag &= ~PSYS_KEYED;
 
-	if(part->type == PART_HAIR) {
-		if(ELEM4(part->ren_as, PART_DRAW_NOT, PART_DRAW_PATH, PART_DRAW_OB, PART_DRAW_GR)==0)
+	if (part->type == PART_HAIR) {
+		if (ELEM4(part->ren_as, PART_DRAW_NOT, PART_DRAW_PATH, PART_DRAW_OB, PART_DRAW_GR)==0)
 			part->ren_as = PART_DRAW_PATH;
 
-		if(part->distr == PART_DISTR_GRID)
+		if (part->distr == PART_DISTR_GRID)
 			part->distr = PART_DISTR_JIT;
 
-		if(ELEM3(part->draw_as, PART_DRAW_NOT, PART_DRAW_REND, PART_DRAW_PATH)==0)
+		if (ELEM3(part->draw_as, PART_DRAW_NOT, PART_DRAW_REND, PART_DRAW_PATH)==0)
 			part->draw_as = PART_DRAW_REND;
 
 		CLAMP(part->path_start, 0.0f, 100.0f);
@@ -4295,18 +4366,18 @@ void psys_check_boid_data(ParticleSystem *psys)
 
 		pa = psys->particles;
 
-		if(!pa)
+		if (!pa)
 			return;
 
-		if(psys->part && psys->part->phystype==PART_PHYS_BOIDS) {
-			if(!pa->boid) {
+		if (psys->part && psys->part->phystype==PART_PHYS_BOIDS) {
+			if (!pa->boid) {
 				bpa = MEM_callocN(psys->totpart * sizeof(BoidParticle), "Boid Data");
 
 				LOOP_PARTICLES
 					pa->boid = bpa++;
 			}
 		}
-		else if(pa->boid){
+		else if (pa->boid) {
 			MEM_freeN(pa->boid);
 			LOOP_PARTICLES
 				pa->boid = NULL;
@@ -4335,7 +4406,7 @@ static void psys_prepare_physics(ParticleSimulationData *sim)
 {
 	ParticleSettings *part = sim->psys->part;
 
-	if(ELEM(part->phystype, PART_PHYS_NO, PART_PHYS_KEYED)) {
+	if (ELEM(part->phystype, PART_PHYS_NO, PART_PHYS_KEYED)) {
 		PTCacheID pid;
 		BKE_ptcache_id_from_particles(&pid, sim->ob, sim->psys);
 		BKE_ptcache_id_clear(&pid, PTCACHE_CLEAR_ALL, 0);
@@ -4345,7 +4416,7 @@ static void psys_prepare_physics(ParticleSimulationData *sim)
 		sim->psys->flag &= ~PSYS_KEYED;
 	}
 
-	if(part->phystype == PART_PHYS_BOIDS && part->boids == NULL) {
+	if (part->phystype == PART_PHYS_BOIDS && part->boids == NULL) {
 		BoidState *state;
 
 		part->boids = MEM_callocN(sizeof(BoidSettings), "Boid Settings");
@@ -4360,7 +4431,7 @@ static void psys_prepare_physics(ParticleSimulationData *sim)
 		state->flag |= BOIDSTATE_CURRENT;
 		BLI_addtail(&part->boids->states, state);
 	}
-	else if(part->phystype == PART_PHYS_FLUID && part->fluid == NULL) {
+	else if (part->phystype == PART_PHYS_FLUID && part->fluid == NULL) {
 		part->fluid = MEM_callocN(sizeof(SPHFluidSettings), "SPH Fluid Settings");
 		fluid_default_settings(part);
 	}
@@ -4369,7 +4440,7 @@ static void psys_prepare_physics(ParticleSimulationData *sim)
 }
 static int hair_needs_recalc(ParticleSystem *psys)
 {
-	if(!(psys->flag & PSYS_EDITED) && (!psys->edit || !psys->edit->edited) &&
+	if (!(psys->flag & PSYS_EDITED) && (!psys->edit || !psys->edit->edited) &&
 		((psys->flag & PSYS_HAIR_DONE)==0 || psys->recalc & PSYS_RECALC_RESET || (psys->part->flag & PART_HAIR_REGROW && !psys->edit))) {
 		return 1;
 	}
@@ -4386,9 +4457,9 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
 	float cfra;
 
 	/* drawdata is outdated after ANY change */
-	if(psys->pdd) psys->pdd->flag &= ~PARTICLE_DRAW_DATA_UPDATED;
+	if (psys->pdd) psys->pdd->flag &= ~PARTICLE_DRAW_DATA_UPDATED;
 
-	if(!psys_check_enabled(ob, psys))
+	if (!psys_check_enabled(ob, psys))
 		return;
 
 	cfra= BKE_curframe(scene);
@@ -4399,23 +4470,30 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
 	sim.psmd= psys_get_modifier(ob, psys);
 
 	/* system was already updated from modifier stack */
-	if(sim.psmd->flag & eParticleSystemFlag_psys_updated) {
+	if (sim.psmd->flag & eParticleSystemFlag_psys_updated) {
 		sim.psmd->flag &= ~eParticleSystemFlag_psys_updated;
 		/* make sure it really was updated to cfra */
-		if(psys->cfra == cfra)
+		if (psys->cfra == cfra)
 			return;
 	}
 
-	if(!sim.psmd->dm)
+	if (!sim.psmd->dm)
 		return;
 
+	if (part->from != PART_FROM_VERT) {
+		DM_ensure_tessface(sim.psmd->dm);
+	}
+
 	/* execute drivers only, as animation has already been done */
 	BKE_animsys_evaluate_animdata(scene, &part->id, part->adt, cfra, ADT_RECALC_DRIVERS);
 
-	if(psys->recalc & PSYS_RECALC_TYPE)
+	/* to verify if we need to restore object afterwards */
+	psys->flag &= ~PSYS_OB_ANIM_RESTORE;
+
+	if (psys->recalc & PSYS_RECALC_TYPE)
 		psys_changed_type(&sim);
 
-	if(psys->recalc & PSYS_RECALC_RESET)
+	if (psys->recalc & PSYS_RECALC_RESET)
 		psys->totunexist = 0;
 
 	/* setup necessary physics type dependent additional data if it doesn't yet exist */
@@ -4425,19 +4503,19 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
 		case PART_HAIR:
 		{
 			/* nothing to do so bail out early */
-			if(psys->totpart == 0 && part->totpart == 0) {
+			if (psys->totpart == 0 && part->totpart == 0) {
 				psys_free_path_cache(psys, NULL);
 				free_hair(ob, psys, 0);
 				psys->flag |= PSYS_HAIR_DONE;
 			}
 			/* (re-)create hair */
-			else if(hair_needs_recalc(psys)) {
+			else if (hair_needs_recalc(psys)) {
 				float hcfra=0.0f;
 				int i, recalc = psys->recalc;
 
 				free_hair(ob, psys, 0);
 
-				if(psys->edit && psys->free_edit) {
+				if (psys->edit && psys->free_edit) {
 					psys->free_edit(psys->edit);
 					psys->edit = NULL;
 					psys->free_edit = NULL;
@@ -4446,9 +4524,9 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
 				/* first step is negative so particles get killed and reset */
 				psys->cfra= 1.0f;
 
-				for(i=0; i<=part->hair_step; i++){
+				for (i=0; i<=part->hair_step; i++) {
 					hcfra=100.0f*(float)i/(float)psys->part->hair_step;
-					if((part->flag & PART_HAIR_REGROW)==0)
+					if ((part->flag & PART_HAIR_REGROW)==0)
 						BKE_animsys_evaluate_animdata(scene, &part->id, part->adt, hcfra, ADT_RECALC_ANIM);
 					system_step(&sim, hcfra);
 					psys->cfra = hcfra;
@@ -4459,10 +4537,10 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
 				psys->flag |= PSYS_HAIR_DONE;
 				psys->recalc = recalc;
 			}
-			else if(psys->flag & PSYS_EDITED)
+			else if (psys->flag & PSYS_EDITED)
 				psys->flag |= PSYS_HAIR_DONE;
 
-			if(psys->flag & PSYS_HAIR_DONE)
+			if (psys->flag & PSYS_HAIR_DONE)
 				hair_step(&sim, cfra);
 			break;
 		}
@@ -4481,10 +4559,10 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
 					float disp = (float)psys_get_current_display_percentage(psys)/100.0f;
 
 					/* Particles without dynamics haven't been reset yet because they don't use pointcache */
-					if(psys->recalc & PSYS_RECALC_RESET)
+					if (psys->recalc & PSYS_RECALC_RESET)
 						psys_reset(psys, PSYS_RESET_ALL);
 
-					if(emit_particles(&sim, NULL, cfra) || (psys->recalc & PSYS_RECALC_RESET)) {
+					if (emit_particles(&sim, NULL, cfra) || (psys->recalc & PSYS_RECALC_RESET)) {
 						free_keyed_keys(psys);
 						distribute_particles(&sim, part->from);
 						initialize_all_particles(&sim);
@@ -4495,18 +4573,18 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
 
 					LOOP_EXISTING_PARTICLES {
 						pa->size = part->size;
-						if(part->randsize > 0.0f)
+						if (part->randsize > 0.0f)
 							pa->size *= 1.0f - part->randsize * PSYS_FRAND(p + 1);
 
 						reset_particle(&sim, pa, 0.0, cfra);
 
-						if(PSYS_FRAND(p) > disp)
+						if (PSYS_FRAND(p) > disp)
 							pa->flag |= PARS_NO_DISP;
 						else
 							pa->flag &= ~PARS_NO_DISP;
 					}
 
-					if(part->phystype == PART_PHYS_KEYED) {
+					if (part->phystype == PART_PHYS_KEYED) {
 						psys_count_keyed_targets(&sim);
 						set_keyed_keys(&sim);
 						psys_update_path_cache(&sim,(int)cfra);
@@ -4524,21 +4602,23 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
 		}
 	}
 
-	if(psys->cfra < cfra) {
-		/* make sure emitter is left at correct time (particle emission can change this) */
-		while(ob) {
+	/* make sure emitter is left at correct time (particle emission can change this) */
+	if (psys->flag & PSYS_OB_ANIM_RESTORE) {
+		while (ob) {
 			BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, cfra, ADT_RECALC_ANIM);
 			ob = ob->parent;
 		}
 		ob = sim.ob;
 		where_is_object_time(scene, ob, cfra);
+
+		psys->flag &= ~PSYS_OB_ANIM_RESTORE;
 	}
 
 	psys->cfra = cfra;
 	psys->recalc = 0;
 
 	/* save matrix for duplicators, at rendertime the actual dupliobject's matrix is used so don't update! */
-	if(psys->renderdata==0)
+	if (psys->renderdata==0)
 		invert_m4_m4(psys->imat, ob->obmat);
 }
 
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 6fd89db..dbcef9a 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -74,7 +74,9 @@
 #include "BIK_api.h"
 
 /* both in intern */
+#ifdef WITH_SMOKE
 #include "smoke_API.h"
+#endif
 
 #ifdef WITH_LZO
 #include "minilzo.h"
@@ -90,15 +92,15 @@
 /* needed for directory lookup */
 /* untitled blend's need getpid for a unique name */
 #ifndef WIN32
-  #include <dirent.h>
-#include <unistd.h>
+#  include <dirent.h>
+#  include <unistd.h>
 #else
-#include <process.h>
-  #include "BLI_winstuff.h"
+#  include <process.h>
+#  include "BLI_winstuff.h"
 #endif
 
-#define PTCACHE_DATA_FROM(data, type, from)		if(data[type]) { memcpy(data[type], from, ptcache_data_size[type]); }
-#define PTCACHE_DATA_TO(data, type, index, to)	if(data[type]) { memcpy(to, (char*)data[type] + (index ? index * ptcache_data_size[type] : 0), ptcache_data_size[type]); }
+#define PTCACHE_DATA_FROM(data, type, from)		if (data[type]) { memcpy(data[type], from, ptcache_data_size[type]); }
+#define PTCACHE_DATA_TO(data, type, index, to)	if (data[type]) { memcpy(to, (char*)data[type] + (index ? index * ptcache_data_size[type] : 0), ptcache_data_size[type]); }
 
 /* could be made into a pointcache option */
 #define DURIAN_POINTCACHE_LIB_OK 1
@@ -131,10 +133,10 @@ static int ptcache_basic_header_read(PTCacheFile *pf)
 	int error=0;
 
 	/* Custom functions should read these basic elements too! */
-	if(!error && !fread(&pf->totpoint, sizeof(unsigned int), 1, pf->fp))
+	if (!error && !fread(&pf->totpoint, sizeof(unsigned int), 1, pf->fp))
 		error = 1;
 	
-	if(!error && !fread(&pf->data_types, sizeof(unsigned int), 1, pf->fp))
+	if (!error && !fread(&pf->data_types, sizeof(unsigned int), 1, pf->fp))
 		error = 1;
 
 	return !error;
@@ -142,10 +144,10 @@ static int ptcache_basic_header_read(PTCacheFile *pf)
 static int ptcache_basic_header_write(PTCacheFile *pf)
 {
 	/* Custom functions should write these basic elements too! */
-	if(!fwrite(&pf->totpoint, sizeof(unsigned int), 1, pf->fp))
+	if (!fwrite(&pf->totpoint, sizeof(unsigned int), 1, pf->fp))
 		return 0;
 	
-	if(!fwrite(&pf->data_types, sizeof(unsigned int), 1, pf->fp))
+	if (!fwrite(&pf->data_types, sizeof(unsigned int), 1, pf->fp))
 		return 0;
 
 	return 1;
@@ -166,7 +168,7 @@ static void ptcache_softbody_read(int index, void *soft_v, void **data, float UN
 	SoftBody *soft= soft_v;
 	BodyPoint *bp = soft->bpoint + index;
 
-	if(old_data) {
+	if (old_data) {
 		memcpy(bp->pos, data, 3 * sizeof(float));
 		memcpy(bp->vec, data + 3, 3 * sizeof(float));
 	}
@@ -182,13 +184,13 @@ static void ptcache_softbody_interpolate(int index, void *soft_v, void **data, f
 	ParticleKey keys[4];
 	float dfra;
 
-	if(cfra1 == cfra2)
+	if (cfra1 == cfra2)
 		return;
 
 	copy_v3_v3(keys[1].co, bp->pos);
 	copy_v3_v3(keys[1].vel, bp->vec);
 
-	if(old_data) {
+	if (old_data) {
 		memcpy(keys[2].co, old_data, 3 * sizeof(float));
 		memcpy(keys[2].vel, old_data + 3, 3 * sizeof(float));
 	}
@@ -219,7 +221,7 @@ void BKE_ptcache_make_particle_key(ParticleKey *key, int index, void **data, flo
 	PTCACHE_DATA_TO(data, BPHYS_DATA_VELOCITY, index, key->vel);
 	
 	/* no rotation info, so make something nice up */
-	if(data[BPHYS_DATA_ROTATION]==NULL) {
+	if (data[BPHYS_DATA_ROTATION]==NULL) {
 		vec_to_quat( key->rot, key->vel, OB_NEGX, OB_POSZ);
 	}
 	else {
@@ -238,7 +240,7 @@ static int  ptcache_particle_write(int index, void *psys_v, void **data, int cfr
 	int step = psys->pointcache->step;
 
 	/* No need to store unborn or died particles outside cache step bounds */
-	if(data[BPHYS_DATA_INDEX] && (cfra < pa->time - step || cfra > pa->dietime + step))
+	if (data[BPHYS_DATA_INDEX] && (cfra < pa->time - step || cfra > pa->dietime + step))
 		return 0;
 
 	times[0]= pa->time;
@@ -253,7 +255,7 @@ static int  ptcache_particle_write(int index, void *psys_v, void **data, int cfr
 	PTCACHE_DATA_FROM(data, BPHYS_DATA_SIZE, &pa->size);
 	PTCACHE_DATA_FROM(data, BPHYS_DATA_TIMES, times);
 
-	if(boid)
+	if (boid)
 		PTCACHE_DATA_FROM(data, BPHYS_DATA_BOIDS, &boid->data);
 
 	/* return flag 1+1=2 for newly born particles to copy exact birth location to previously cached frame */
@@ -266,16 +268,16 @@ static void ptcache_particle_read(int index, void *psys_v, void **data, float cf
 	BoidParticle *boid;
 	float timestep = 0.04f*psys->part->timetweak;
 
-	if(index >= psys->totpart)
+	if (index >= psys->totpart)
 		return;
 
 	pa = psys->particles + index;
 	boid = (psys->part->phystype == PART_PHYS_BOIDS) ? pa->boid : NULL;
 
-	if(cfra > pa->state.time)
+	if (cfra > pa->state.time)
 		memcpy(&pa->prev_state, &pa->state, sizeof(ParticleKey));
 
-	if(old_data){
+	if (old_data) {
 		/* old format cache */
 		memcpy(&pa->state, old_data, sizeof(ParticleKey));
 		return;
@@ -284,15 +286,15 @@ static void ptcache_particle_read(int index, void *psys_v, void **data, float cf
 	BKE_ptcache_make_particle_key(&pa->state, 0, data, cfra);
 
 	/* set frames cached before birth to birth time */
-	if(cfra < pa->time)
+	if (cfra < pa->time)
 		pa->state.time = pa->time;
-	else if(cfra > pa->dietime)
+	else if (cfra > pa->dietime)
 		pa->state.time = pa->dietime;
 
-	if(data[BPHYS_DATA_SIZE])
+	if (data[BPHYS_DATA_SIZE])
 		PTCACHE_DATA_TO(data, BPHYS_DATA_SIZE, 0, &pa->size);
 	
-	if(data[BPHYS_DATA_TIMES]) {
+	if (data[BPHYS_DATA_TIMES]) {
 		float times[3];
 		PTCACHE_DATA_TO(data, BPHYS_DATA_TIMES, 0, &times);
 		pa->time = times[0];
@@ -300,12 +302,12 @@ static void ptcache_particle_read(int index, void *psys_v, void **data, float cf
 		pa->lifetime = times[2];
 	}
 
-	if(boid)
+	if (boid)
 		PTCACHE_DATA_TO(data, BPHYS_DATA_BOIDS, 0, &boid->data);
 
 	/* determine velocity from previous location */
-	if(data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_VELOCITY]) {
-		if(cfra > pa->prev_state.time) {
+	if (data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_VELOCITY]) {
+		if (cfra > pa->prev_state.time) {
 			sub_v3_v3v3(pa->state.vel, pa->state.co, pa->prev_state.co);
 			mul_v3_fl(pa->state.vel, (cfra - pa->prev_state.time) * timestep);
 		}
@@ -315,9 +317,10 @@ static void ptcache_particle_read(int index, void *psys_v, void **data, float cf
 		}
 	}
 
-	/* determine rotation from velocity */
-	if(data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_ROTATION]) {
-		vec_to_quat( pa->state.rot,pa->state.vel, OB_NEGX, OB_POSZ);
+	/* default to no rotation */
+	if (data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_ROTATION]) {
+		pa->state.rot[0]=1.0f;
+		pa->state.rot[1]=pa->state.rot[2]=pa->state.rot[3]=0;
 	}
 }
 static void ptcache_particle_interpolate(int index, void *psys_v, void **data, float cfra, float cfra1, float cfra2, float *old_data)
@@ -327,31 +330,31 @@ static void ptcache_particle_interpolate(int index, void *psys_v, void **data, f
 	ParticleKey keys[4];
 	float dfra, timestep = 0.04f*psys->part->timetweak;
 
-	if(index >= psys->totpart)
+	if (index >= psys->totpart)
 		return;
 
 	pa = psys->particles + index;
 
 	/* particle wasn't read from first cache so can't interpolate */
-	if((int)cfra1 < pa->time - psys->pointcache->step || (int)cfra1 > pa->dietime + psys->pointcache->step)
+	if ((int)cfra1 < pa->time - psys->pointcache->step || (int)cfra1 > pa->dietime + psys->pointcache->step)
 		return;
 
 	cfra = MIN2(cfra, pa->dietime);
 	cfra1 = MIN2(cfra1, pa->dietime);
 	cfra2 = MIN2(cfra2, pa->dietime);
 
-	if(cfra1 == cfra2)
+	if (cfra1 == cfra2)
 		return;
 
 	memcpy(keys+1, &pa->state, sizeof(ParticleKey));
-	if(old_data)
+	if (old_data)
 		memcpy(keys+2, old_data, sizeof(ParticleKey));
 	else
 		BKE_ptcache_make_particle_key(keys+2, 0, data, cfra2);
 
 	/* determine velocity from previous location */
-	if(data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_VELOCITY]) {
-		if(keys[1].time > keys[2].time) {
+	if (data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_VELOCITY]) {
+		if (keys[1].time > keys[2].time) {
 			sub_v3_v3v3(keys[2].vel, keys[1].co, keys[2].co);
 			mul_v3_fl(keys[2].vel, (keys[1].time - keys[2].time) * timestep);
 		}
@@ -362,11 +365,11 @@ static void ptcache_particle_interpolate(int index, void *psys_v, void **data, f
 	}
 
 	/* determine rotation from velocity */
-	if(data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_ROTATION]) {
+	if (data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_ROTATION]) {
 		vec_to_quat( keys[2].rot,keys[2].vel, OB_NEGX, OB_POSZ);
 	}
 
-	if(cfra > pa->time)
+	if (cfra > pa->time)
 		cfra1 = MAX2(cfra1, pa->time);
 
 	dfra = cfra2 - cfra1;
@@ -394,10 +397,10 @@ static int  ptcache_particle_totwrite(void *psys_v, int cfra)
 	int p, step = psys->pointcache->step;
 	int totwrite = 0;
 
-	if(cfra == 0)
+	if (cfra == 0)
 		return psys->totpart;
 
-	for(p=0; p<psys->totpart; p++,pa++)
+	for (p=0; p<psys->totpart; p++,pa++)
 		totwrite += (cfra >= pa->time - step && cfra <= pa->dietime + step);
 
 	return totwrite;
@@ -408,7 +411,7 @@ static void ptcache_particle_extra_write(void *psys_v, PTCacheMem *pm, int UNUSE
 	ParticleSystem *psys = psys_v;
 	PTCacheExtra *extra = NULL;
 
-	if(psys->part->phystype == PART_PHYS_FLUID &&
+	if (psys->part->phystype == PART_PHYS_FLUID &&
 		psys->part->fluid && psys->part->fluid->flag & SPH_VISCOELASTIC_SPRINGS &&
 		psys->tot_fluidsprings && psys->fluid_springs) {
 
@@ -429,11 +432,11 @@ static void ptcache_particle_extra_read(void *psys_v, PTCacheMem *pm, float UNUS
 	ParticleSystem *psys = psys_v;
 	PTCacheExtra *extra = pm->extradata.first;
 
-	for(; extra; extra=extra->next) {
+	for (; extra; extra=extra->next) {
 		switch(extra->type) {
 			case BPHYS_EXTRA_FLUID_SPRINGS:
 			{
-				if(psys->fluid_springs)
+				if (psys->fluid_springs)
 					MEM_freeN(psys->fluid_springs);
 
 				psys->fluid_springs = MEM_dupallocN(extra->data);
@@ -463,7 +466,7 @@ static void ptcache_cloth_read(int index, void *cloth_v, void **data, float UNUS
 	Cloth *cloth= clmd->clothObject;
 	ClothVertex *vert = cloth->verts + index;
 	
-	if(old_data) {
+	if (old_data) {
 		memcpy(vert->x, data, 3 * sizeof(float));
 		memcpy(vert->xconst, data + 3, 3 * sizeof(float));
 		memcpy(vert->v, data + 6, 3 * sizeof(float));
@@ -482,13 +485,13 @@ static void ptcache_cloth_interpolate(int index, void *cloth_v, void **data, flo
 	ParticleKey keys[4];
 	float dfra;
 
-	if(cfra1 == cfra2)
+	if (cfra1 == cfra2)
 		return;
 
 	copy_v3_v3(keys[1].co, vert->x);
 	copy_v3_v3(keys[1].vel, vert->v);
 
-	if(old_data) {
+	if (old_data) {
 		memcpy(keys[2].co, old_data, 3 * sizeof(float));
 		memcpy(keys[2].vel, old_data + 6, 3 * sizeof(float));
 	}
@@ -523,7 +526,7 @@ static int  ptcache_smoke_totpoint(void *smoke_v, int UNUSED(cfra))
 	SmokeModifierData *smd= (SmokeModifierData *)smoke_v;
 	SmokeDomainSettings *sds = smd->domain;
 	
-	if(sds->fluid) {
+	if (sds->fluid) {
 		return sds->res[0]*sds->res[1]*sds->res[2];
 	}
 	else
@@ -535,7 +538,7 @@ static int  ptcache_smoke_write(PTCacheFile *pf, void *smoke_v)
 	SmokeDomainSettings *sds = smd->domain;
 	int ret = 0;
 	
-	if(sds->fluid) {
+	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;
 		unsigned char *obstacles;
@@ -567,7 +570,7 @@ static int  ptcache_smoke_write(PTCacheFile *pf, void *smoke_v)
 		ret = 1;
 	}
 
-	if(sds->wt) {
+	if (sds->wt) {
 		int res_big_array[3];
 		int res_big;
 		int res = sds->res[0]*sds->res[1]*sds->res[2];
@@ -608,7 +611,7 @@ static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v)
 	SmokeModifierData *smd= (SmokeModifierData *)smoke_v;
 	SmokeDomainSettings *sds = smd->domain;
 	
-	if(sds->fluid) {
+	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;
 		unsigned char *obstacles;
@@ -631,7 +634,7 @@ static int ptcache_smoke_read(PTCacheFile *pf, void *smoke_v)
 		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) {
+		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;
@@ -679,7 +682,7 @@ static int  ptcache_dynamicpaint_write(PTCacheFile *pf, void *dp_v)
 	/* version header */
 	ptcache_file_write(pf, DPAINT_CACHE_VERSION, 1, sizeof(char)*4);
 
-	if(surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ && surface->data) {
+	if (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ && surface->data) {
 		int total_points=surface->data->total_points;
 		unsigned int in_len;
 		unsigned char *out;
@@ -713,7 +716,7 @@ static int ptcache_dynamicpaint_read(PTCacheFile *pf, void *dp_v)
 	ptcache_file_read(pf, version, 1, sizeof(char)*4);
 	if (strncmp(version, DPAINT_CACHE_VERSION,4)) {printf("Dynamic Paint: Invalid cache version: %s!\n",version); return 0;}
 
-	if(surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ && surface->data) {
+	if (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ && surface->data) {
 		unsigned int data_len;
 		int surface_type;
 
@@ -786,7 +789,7 @@ void BKE_ptcache_id_from_particles(PTCacheID *pid, Object *ob, ParticleSystem *p
 	pid->cache_ptr= &psys->pointcache;
 	pid->ptcaches= &psys->ptcaches;
 
-	if(psys->part->type != PART_HAIR)
+	if (psys->part->type != PART_HAIR)
 		pid->flag |= PTCACHE_VEL_PER_SEC;
 
 	pid->totpoint				= ptcache_particle_totpoint;
@@ -808,20 +811,24 @@ void BKE_ptcache_id_from_particles(PTCacheID *pid, Object *ob, ParticleSystem *p
 
 	pid->data_types = (1<<BPHYS_DATA_LOCATION) | (1<<BPHYS_DATA_VELOCITY) | (1<<BPHYS_DATA_INDEX);
 
-	if(psys->part->phystype == PART_PHYS_BOIDS)
+	if (psys->part->phystype == PART_PHYS_BOIDS)
 		pid->data_types|= (1<<BPHYS_DATA_AVELOCITY) | (1<<BPHYS_DATA_ROTATION) | (1<<BPHYS_DATA_BOIDS);
-	else if(psys->part->phystype == PART_PHYS_FLUID && psys->part->fluid && psys->part->fluid->flag & SPH_VISCOELASTIC_SPRINGS) {
+	else if (psys->part->phystype == PART_PHYS_FLUID && psys->part->fluid && psys->part->fluid->flag & SPH_VISCOELASTIC_SPRINGS) {
 		pid->write_extra_data = ptcache_particle_extra_write;
 		pid->read_extra_data = ptcache_particle_extra_read;
 	}
 
-	if(psys->part->rotmode!=PART_ROT_VEL
-		|| psys->part->avemode!=PART_AVE_SPIN || psys->part->avefac!=0.0f)
-		pid->data_types|= (1<<BPHYS_DATA_AVELOCITY) | (1<<BPHYS_DATA_ROTATION);
-
-	if(psys->part->flag & PART_ROT_DYN)
+	if (psys->part->flag & PART_ROTATIONS) {
 		pid->data_types|= (1<<BPHYS_DATA_ROTATION);
 
+		if (psys->part->rotmode != PART_ROT_VEL  ||
+		    psys->part->avemode == PART_AVE_RAND ||
+		    psys->part->avefac  != 0.0f)
+		{
+			pid->data_types |= (1 << BPHYS_DATA_AVELOCITY);
+		}
+	}
+
 	pid->info_types= (1<<BPHYS_DATA_TIMES);
 
 	pid->default_step = 10;
@@ -895,9 +902,9 @@ void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct Object *ob, struct SmokeMo
 	pid->data_types= 0;
 	pid->info_types= 0;
 
-	if(sds->fluid)
+	if (sds->fluid)
 		pid->data_types |= (1<<BPHYS_DATA_SMOKE_LOW);
-	if(sds->wt)
+	if (sds->wt)
 		pid->data_types |= (1<<BPHYS_DATA_SMOKE_HIGH);
 
 	pid->default_step = 1;
@@ -948,25 +955,25 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup
 
 	lb->first= lb->last= NULL;
 
-	if(ob->soft) {
+	if (ob->soft) {
 		pid= MEM_callocN(sizeof(PTCacheID), "PTCacheID");
 		BKE_ptcache_id_from_softbody(pid, ob, ob->soft);
 		BLI_addtail(lb, pid);
 	}
 
-	for(psys=ob->particlesystem.first; psys; psys=psys->next) {
-		if(psys->part==NULL)
+	for (psys=ob->particlesystem.first; psys; psys=psys->next) {
+		if (psys->part==NULL)
 			continue;
 		
 		/* check to make sure point cache is actually used by the particles */
-		if(ELEM(psys->part->phystype, PART_PHYS_NO, PART_PHYS_KEYED))
+		if (ELEM(psys->part->phystype, PART_PHYS_NO, PART_PHYS_KEYED))
 			continue;
 
 		/* hair needs to be included in id-list for cache edit mode to work */
-		/* if(psys->part->type == PART_HAIR && (psys->flag & PSYS_HAIR_DYNAMICS)==0) */
+		/* if (psys->part->type == PART_HAIR && (psys->flag & PSYS_HAIR_DYNAMICS)==0) */
 		/*	continue; */
 			
-		if(psys->part->type == PART_FLUID)
+		if (psys->part->type == PART_FLUID)
 			continue;
 
 		pid= MEM_callocN(sizeof(PTCacheID), "PTCacheID");
@@ -974,24 +981,24 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup
 		BLI_addtail(lb, pid);
 	}
 
-	for(md=ob->modifiers.first; md; md=md->next) {
-		if(md->type == eModifierType_Cloth) {
+	for (md=ob->modifiers.first; md; md=md->next) {
+		if (md->type == eModifierType_Cloth) {
 			pid= MEM_callocN(sizeof(PTCacheID), "PTCacheID");
 			BKE_ptcache_id_from_cloth(pid, ob, (ClothModifierData*)md);
 			BLI_addtail(lb, pid);
 		}
-		else if(md->type == eModifierType_Smoke) {
+		else if (md->type == eModifierType_Smoke) {
 			SmokeModifierData *smd = (SmokeModifierData *)md;
-			if(smd->type & MOD_SMOKE_TYPE_DOMAIN)
+			if (smd->type & MOD_SMOKE_TYPE_DOMAIN)
 			{
 				pid= MEM_callocN(sizeof(PTCacheID), "PTCacheID");
 				BKE_ptcache_id_from_smoke(pid, ob, (SmokeModifierData*)md);
 				BLI_addtail(lb, pid);
 			}
 		}
-		else if(md->type == eModifierType_DynamicPaint) {
+		else if (md->type == eModifierType_DynamicPaint) {
 			DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
-			if(pmd->canvas)
+			if (pmd->canvas)
 			{
 				DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
 
@@ -1004,17 +1011,17 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup
 		}
 	}
 
-	if(scene && (duplis-- > 0) && (ob->transflag & OB_DUPLI)) {
+	if (scene && (duplis-- > 0) && (ob->transflag & OB_DUPLI)) {
 		ListBase *lb_dupli_ob;
 
-		if((lb_dupli_ob=object_duplilist(scene, ob))) {
+		if ((lb_dupli_ob=object_duplilist(scene, ob))) {
 			DupliObject *dob;
-			for(dob= lb_dupli_ob->first; dob; dob= dob->next) {
-				if(dob->ob != ob) { /* avoids recursive loops with dupliframes: bug 22988 */
+			for (dob= lb_dupli_ob->first; dob; dob= dob->next) {
+				if (dob->ob != ob) { /* avoids recursive loops with dupliframes: bug 22988 */
 					ListBase lb_dupli_pid;
 					BKE_ptcache_ids_from_object(&lb_dupli_pid, dob->ob, scene, duplis);
 					BLI_movelisttolist(lb, &lb_dupli_pid);
-					if(lb_dupli_pid.first)
+					if (lb_dupli_pid.first)
 						printf("Adding Dupli\n");
 				}
 			}
@@ -1026,11 +1033,11 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup
 
 /* File handling */
 
-/*	Takes an Object ID and returns a unique name
-	- id: object id
-	- cfra: frame for the cache, can be negative
-	- stack_index: index in the modifier stack. we can have cache for more then one stack_index
-*/
+/* Takes an Object ID and returns a unique name
+ * - id: object id
+ * - cfra: frame for the cache, can be negative
+ * - stack_index: index in the modifier stack. we can have cache for more then one stack_index
+ */
 
 #define MAX_PTCACHE_PATH FILE_MAX
 #define MAX_PTCACHE_FILE ((FILE_MAX)*2)
@@ -1041,16 +1048,16 @@ static int ptcache_path(PTCacheID *pid, char *filename)
 	const char *blendfilename= (lib && (pid->cache->flag & PTCACHE_IGNORE_LIBPATH)==0) ? lib->filepath: G.main->name;
 	size_t i;
 
-	if(pid->cache->flag & PTCACHE_EXTERNAL) {
+	if (pid->cache->flag & PTCACHE_EXTERNAL) {
 		strcpy(filename, pid->cache->path);
 
-		if(strncmp(filename, "//", 2)==0)
+		if (strncmp(filename, "//", 2)==0)
 			BLI_path_abs(filename, blendfilename);
 
 		return BLI_add_slash(filename); /* new strlen() */
 	}
 	else if (G.relbase_valid || lib) {
-		char file[MAX_PTCACHE_PATH]; /* we dont want the dir, only the file */
+		char file[MAX_PTCACHE_PATH]; /* we don't want the dir, only the file */
 
 		BLI_split_file_part(blendfilename, file, sizeof(file));
 		i = strlen(file);
@@ -1086,10 +1093,10 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p
 		len = ptcache_path(pid, filename);
 		newname += len;
 	}
-	if(pid->cache->name[0] == '\0' && (pid->cache->flag & PTCACHE_EXTERNAL)==0) {
+	if (pid->cache->name[0] == '\0' && (pid->cache->flag & PTCACHE_EXTERNAL)==0) {
 		idname = (pid->ob->id.name+2);
 		/* convert chars to hex so they are always a valid filename */
-		while('\0' != *idname) {
+		while ('\0' != *idname) {
 			BLI_snprintf(newname, MAX_PTCACHE_FILE, "%02X", (char)(*idname++));
 			newname+=2;
 			len += 2;
@@ -1104,11 +1111,11 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p
 
 	if (do_ext) {
 
-		if(pid->cache->index < 0)
+		if (pid->cache->index < 0)
 			pid->cache->index =  pid->stack_index = object_insert_ptcache(pid->ob);
 
-		if(pid->cache->flag & PTCACHE_EXTERNAL) {
-			if(pid->cache->index >= 0)
+		if (pid->cache->flag & PTCACHE_EXTERNAL) {
+			if (pid->cache->index >= 0)
 				BLI_snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02u"PTCACHE_EXT, cfra, pid->stack_index); /* always 6 chars */
 			else
 				BLI_snprintf(newname, MAX_PTCACHE_FILE, "_%06d"PTCACHE_EXT, cfra); /* always 6 chars */
@@ -1131,7 +1138,7 @@ static PTCacheFile *ptcache_file_open(PTCacheID *pid, int mode, int cfra)
 
 #ifndef DURIAN_POINTCACHE_LIB_OK
 	/* don't allow writing for linked objects */
-	if(pid->ob->id.lib && mode == PTCACHE_FILE_WRITE)
+	if (pid->ob->id.lib && mode == PTCACHE_FILE_WRITE)
 		return NULL;
 #endif
 	if (!G.relbase_valid && (pid->cache->flag & PTCACHE_EXTERNAL)==0) return NULL; /* save blend file before using disk pointcache */
@@ -1142,13 +1149,15 @@ static PTCacheFile *ptcache_file_open(PTCacheID *pid, int mode, int cfra)
 		if (!BLI_exists(filename)) {
 			return NULL;
 		}
-		fp = fopen(filename, "rb");
-	} else if (mode==PTCACHE_FILE_WRITE) {
+		fp = BLI_fopen(filename, "rb");
+	}
+	else if (mode==PTCACHE_FILE_WRITE) {
 		BLI_make_existing_file(filename); /* will create the dir if needs be, same as //textures is created */
-		fp = fopen(filename, "wb");
-	} else if (mode==PTCACHE_FILE_UPDATE) {
+		fp = BLI_fopen(filename, "wb");
+	}
+	else if (mode==PTCACHE_FILE_UPDATE) {
 		BLI_make_existing_file(filename);
-		fp = fopen(filename, "rb+");
+		fp = BLI_fopen(filename, "rb+");
 	}
 
 	if (!fp)
@@ -1163,7 +1172,7 @@ static PTCacheFile *ptcache_file_open(PTCacheID *pid, int mode, int cfra)
 }
 static void ptcache_file_close(PTCacheFile *pf)
 {
-	if(pf) {
+	if (pf) {
 		fclose(pf->fp);
 		MEM_freeN(pf);
 	}
@@ -1181,25 +1190,25 @@ static int ptcache_file_compressed_read(PTCacheFile *pf, unsigned char *result,
 	unsigned char *props = MEM_callocN(16*sizeof(char), "tmp");
 
 	ptcache_file_read(pf, &compressed, 1, sizeof(unsigned char));
-	if(compressed) {
+	if (compressed) {
 		unsigned int size;
 		ptcache_file_read(pf, &size, 1, sizeof(unsigned int));
 		in_len = (size_t)size;
-		if(in_len==0) {
+		if (in_len==0) {
 			/* do nothing */
 		}
 		else {
 			in = (unsigned char *)MEM_callocN(sizeof(unsigned char)*in_len, "pointcache_compressed_buffer");
 			ptcache_file_read(pf, in, in_len, sizeof(unsigned char));
 #ifdef WITH_LZO
-			if(compressed == 1)
+			if (compressed == 1)
 				r = lzo1x_decompress_safe(in, (lzo_uint)in_len, result, (lzo_uint *)&out_len, NULL);
 #endif
 #ifdef WITH_LZMA
-			if(compressed == 2)
+			if (compressed == 2)
 			{
 				size_t sizeOfIt;
-				size_t leni = in_len, leno = out_len;
+				size_t leni = in_len, leno = len;
 				ptcache_file_read(pf, &size, 1, sizeof(unsigned int));
 				sizeOfIt = (size_t)size;
 				ptcache_file_read(pf, props, sizeOfIt, sizeof(unsigned char));
@@ -1229,7 +1238,7 @@ static int ptcache_file_compressed_write(PTCacheFile *pf, unsigned char *in, uns
 
 #ifdef WITH_LZO
 	out_len= LZO_OUT_LEN(in_len);
-	if(mode == 1) {
+	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);	
@@ -1240,12 +1249,12 @@ static int ptcache_file_compressed_write(PTCacheFile *pf, unsigned char *in, uns
 	}
 #endif
 #ifdef WITH_LZMA
-	if(mode == 2) {
+	if (mode == 2) {
 		
 		r = LzmaCompress(out, &out_len, in, in_len,//assume sizeof(char)==1....
 						props, &sizeOfIt, 5, 1 << 24, 3, 0, 2, 32, 2);
 
-		if(!(r == SZ_OK) || (out_len >= in_len))
+		if (!(r == SZ_OK) || (out_len >= in_len))
 			compressed = 0;
 		else
 			compressed = 2;
@@ -1253,7 +1262,7 @@ static int ptcache_file_compressed_write(PTCacheFile *pf, unsigned char *in, uns
 #endif
 	
 	ptcache_file_write(pf, &compressed, 1, sizeof(unsigned char));
-	if(compressed) {
+	if (compressed) {
 		unsigned int size = out_len;
 		ptcache_file_write(pf, &size, 1, sizeof(unsigned int));
 		ptcache_file_write(pf, out, out_len, sizeof(unsigned char));
@@ -1261,7 +1270,7 @@ static int ptcache_file_compressed_write(PTCacheFile *pf, unsigned char *in, uns
 	else
 		ptcache_file_write(pf, in, in_len, sizeof(unsigned char));
 
-	if(compressed == 2)
+	if (compressed == 2)
 	{
 		unsigned int size = sizeOfIt;
 		ptcache_file_write(pf, &sizeOfIt, 1, sizeof(unsigned int));
@@ -1284,8 +1293,8 @@ static int ptcache_file_data_read(PTCacheFile *pf)
 {
 	int i;
 
-	for(i=0; i<BPHYS_TOT_DATA; i++) {
-		if((pf->data_types & (1<<i)) && !ptcache_file_read(pf, pf->cur[i], 1, ptcache_data_size[i]))
+	for (i=0; i<BPHYS_TOT_DATA; i++) {
+		if ((pf->data_types & (1<<i)) && !ptcache_file_read(pf, pf->cur[i], 1, ptcache_data_size[i]))
 			return 0;
 	}
 	
@@ -1295,8 +1304,8 @@ static int ptcache_file_data_write(PTCacheFile *pf)
 {		
 	int i;
 
-	for(i=0; i<BPHYS_TOT_DATA; i++) {
-		if((pf->data_types & (1<<i)) && !ptcache_file_write(pf, pf->cur[i], 1, ptcache_data_size[i]))
+	for (i=0; i<BPHYS_TOT_DATA; i++) {
+		if ((pf->data_types & (1<<i)) && !ptcache_file_write(pf, pf->cur[i], 1, ptcache_data_size[i]))
 			return 0;
 	}
 	
@@ -1310,20 +1319,20 @@ static int ptcache_file_header_begin_read(PTCacheFile *pf)
 	
 	pf->data_types = 0;
 	
-	if(fread(bphysics, sizeof(char), 8, pf->fp) != 8)
+	if (fread(bphysics, sizeof(char), 8, pf->fp) != 8)
 		error = 1;
 	
-	if(!error && strncmp(bphysics, "BPHYSICS", 8))
+	if (!error && strncmp(bphysics, "BPHYSICS", 8))
 		error = 1;
 
-	if(!error && !fread(&typeflag, sizeof(unsigned int), 1, pf->fp))
+	if (!error && !fread(&typeflag, sizeof(unsigned int), 1, pf->fp))
 		error = 1;
 
 	pf->type = (typeflag & PTCACHE_TYPEFLAG_TYPEMASK);
 	pf->flag = (typeflag & PTCACHE_TYPEFLAG_FLAGMASK);
 	
 	/* if there was an error set file as it was */
-	if(error)
+	if (error)
 		fseek(pf->fp, 0, SEEK_SET);
 
 	return !error;
@@ -1333,10 +1342,10 @@ static int ptcache_file_header_begin_write(PTCacheFile *pf)
 	const char *bphysics = "BPHYSICS";
 	unsigned int typeflag = pf->type + pf->flag;
 	
-	if(fwrite(bphysics, sizeof(char), 8, pf->fp) != 8)
+	if (fwrite(bphysics, sizeof(char), 8, pf->fp) != 8)
 		return 0;
 
-	if(!fwrite(&typeflag, sizeof(unsigned int), 1, pf->fp))
+	if (!fwrite(&typeflag, sizeof(unsigned int), 1, pf->fp))
 		return 0;
 	
 	return 1;
@@ -1365,23 +1374,23 @@ static void ptcache_file_pointers_init(PTCacheFile *pf)
 /* Check to see if point number "index" is in pm, uses binary search for index data. */
 int BKE_ptcache_mem_index_find(PTCacheMem *pm, unsigned int index)
 {
-	if(pm->data[BPHYS_DATA_INDEX]) {
+	if (pm->data[BPHYS_DATA_INDEX]) {
 		unsigned int *data = pm->data[BPHYS_DATA_INDEX];
 		unsigned int mid, low = 0, high = pm->totpoint - 1;
 
-		if(index < *data || index > *(data+high))
+		if (index < *data || index > *(data+high))
 			return -1;
 
 		/* check simple case for continuous indexes first */
-		if(index-*data < high && data[index-*data] == index)
+		if (index-*data < high && data[index-*data] == index)
 			return index-*data;
 
-		while(low <= high) {
+		while (low <= high) {
 			mid= (low + high)/2;
 
-			if(data[mid] > index)
+			if (data[mid] > index)
 				high = mid - 1;
-			else if(data[mid] < index)
+			else if (data[mid] < index)
 				low = mid + 1;
 			else
 				return mid;
@@ -1399,7 +1408,7 @@ void BKE_ptcache_mem_pointers_init(PTCacheMem *pm)
 	int data_types = pm->data_types;
 	int i;
 
-	for(i=0; i<BPHYS_TOT_DATA; i++)
+	for (i=0; i<BPHYS_TOT_DATA; i++)
 		pm->cur[i] = ((data_types & (1<<i)) ? pm->data[i] : NULL);
 }
 
@@ -1407,8 +1416,8 @@ void BKE_ptcache_mem_pointers_incr(PTCacheMem *pm)
 {
 	int i;
 
-	for(i=0; i<BPHYS_TOT_DATA; i++) {
-		if(pm->cur[i])
+	for (i=0; i<BPHYS_TOT_DATA; i++) {
+		if (pm->cur[i])
 			pm->cur[i] = (char*)pm->cur[i] + ptcache_data_size[i];
 	}
 }
@@ -1417,7 +1426,7 @@ int  BKE_ptcache_mem_pointers_seek(int point_index, PTCacheMem *pm)
 	int data_types = pm->data_types;
 	int i, index = BKE_ptcache_mem_index_find(pm, point_index);
 
-	if(index < 0) {
+	if (index < 0) {
 		/* Can't give proper location without reallocation, so don't give any location.
 		 * Some points will be cached improperly, but this only happens with simulation
 		 * steps bigger than cache->step, so the cache has to be recalculated anyways
@@ -1426,7 +1435,7 @@ int  BKE_ptcache_mem_pointers_seek(int point_index, PTCacheMem *pm)
 		return 0;
 	}
 
-	for(i=0; i<BPHYS_TOT_DATA; i++)
+	for (i=0; i<BPHYS_TOT_DATA; i++)
 		pm->cur[i] = data_types & (1<<i) ? (char*)pm->data[i] + index * ptcache_data_size[i] : NULL;
 
 	return 1;
@@ -1437,8 +1446,8 @@ static void ptcache_data_alloc(PTCacheMem *pm)
 	int totpoint = pm->totpoint;
 	int i;
 
-	for(i=0; i<BPHYS_TOT_DATA; i++) {
-		if(data_types & (1<<i))
+	for (i=0; i<BPHYS_TOT_DATA; i++) {
+		if (data_types & (1<<i))
 			pm->data[i] = MEM_callocN(totpoint * ptcache_data_size[i], "PTCache Data");
 	}
 }
@@ -1447,18 +1456,18 @@ static void ptcache_data_free(PTCacheMem *pm)
 	void **data = pm->data;
 	int i;
 
-	for(i=0; i<BPHYS_TOT_DATA; i++) {
-		if(data[i])
+	for (i=0; i<BPHYS_TOT_DATA; i++) {
+		if (data[i])
 			MEM_freeN(data[i]);
 	}
 }
 static void ptcache_data_copy(void *from[], void *to[])
 {
 	int i;
-	for(i=0; i<BPHYS_TOT_DATA; i++) {
+	for (i=0; i<BPHYS_TOT_DATA; i++) {
 	/* note, durian file 03.4b_comp crashes if to[i] is not tested
 	 * its NULL, not sure if this should be fixed elsewhere but for now its needed */
-		if(from[i] && to[i])
+		if (from[i] && to[i])
 			memcpy(to[i], from[i], ptcache_data_size[i]);
 	}
 }
@@ -1467,9 +1476,9 @@ static void ptcache_extra_free(PTCacheMem *pm)
 {
 	PTCacheExtra *extra = pm->extradata.first;
 
-	if(extra) {
-		for(; extra; extra=extra->next) {
-			if(extra->data)
+	if (extra) {
+		for (; extra; extra=extra->next) {
+			if (extra->data)
 				MEM_freeN(extra->data);
 		}
 
@@ -1478,11 +1487,11 @@ static void ptcache_extra_free(PTCacheMem *pm)
 }
 static int ptcache_old_elemsize(PTCacheID *pid)
 {
-	if(pid->type==PTCACHE_TYPE_SOFTBODY)
+	if (pid->type==PTCACHE_TYPE_SOFTBODY)
 		return 6 * sizeof(float);
-	else if(pid->type==PTCACHE_TYPE_PARTICLES)
+	else if (pid->type==PTCACHE_TYPE_PARTICLES)
 		return sizeof(ParticleKey);
-	else if(pid->type==PTCACHE_TYPE_CLOTH)
+	else if (pid->type==PTCACHE_TYPE_CLOTH)
 		return 9 * sizeof(float);
 
 	return 0;
@@ -1490,22 +1499,22 @@ static int ptcache_old_elemsize(PTCacheID *pid)
 
 static void ptcache_find_frames_around(PTCacheID *pid, unsigned int frame, int *fra1, int *fra2)
 {
-	if(pid->cache->flag & PTCACHE_DISK_CACHE) {
+	if (pid->cache->flag & PTCACHE_DISK_CACHE) {
 		int cfra1=frame, cfra2=frame+1;
 
-		while(cfra1 >= pid->cache->startframe && !BKE_ptcache_id_exist(pid, cfra1))
+		while (cfra1 >= pid->cache->startframe && !BKE_ptcache_id_exist(pid, cfra1))
 			cfra1--;
 
-		if(cfra1 < pid->cache->startframe)
+		if (cfra1 < pid->cache->startframe)
 			cfra1 = 0;
 
-		while(cfra2 <= pid->cache->endframe && !BKE_ptcache_id_exist(pid, cfra2))
+		while (cfra2 <= pid->cache->endframe && !BKE_ptcache_id_exist(pid, cfra2))
 			cfra2++;
 
-		if(cfra2 > pid->cache->endframe)
+		if (cfra2 > pid->cache->endframe)
 			cfra2 = 0;
 
-		if(cfra1 && !cfra2) {
+		if (cfra1 && !cfra2) {
 			*fra1 = 0;
 			*fra2 = cfra1;
 		}
@@ -1514,23 +1523,23 @@ static void ptcache_find_frames_around(PTCacheID *pid, unsigned int frame, int *
 			*fra2 = cfra2;
 		}
 	}
-	else if(pid->cache->mem_cache.first) {
+	else if (pid->cache->mem_cache.first) {
 		PTCacheMem *pm = pid->cache->mem_cache.first;
 		PTCacheMem *pm2 = pid->cache->mem_cache.last;
 
-		while(pm->next && pm->next->frame <= frame)
+		while (pm->next && pm->next->frame <= frame)
 			pm= pm->next;
 
-		if(pm2->frame < frame) {
+		if (pm2->frame < frame) {
 			pm2 = NULL;
 		}
 		else {
-			while(pm2->prev && pm2->prev->frame > frame) {
+			while (pm2->prev && pm2->prev->frame > frame) {
 				pm2= pm2->prev;
 			}
 		}
 
-		if(!pm2) {
+		if (!pm2) {
 			*fra1 = 0;
 			*fra2 = pm->frame;
 		}
@@ -1547,16 +1556,16 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra)
 	PTCacheMem *pm = NULL;
 	unsigned int i, error = 0;
 
-	if(pf == NULL)
+	if (pf == NULL)
 		return NULL;
 
-	if(!ptcache_file_header_begin_read(pf))
+	if (!ptcache_file_header_begin_read(pf))
 		error = 1;
 
-	if(!error && (pf->type != pid->type || !pid->read_header(pf)))
+	if (!error && (pf->type != pid->type || !pid->read_header(pf)))
 		error = 1;
 
-	if(!error) {
+	if (!error) {
 		pm = MEM_callocN(sizeof(PTCacheMem), "Pointcache mem");
 
 		pm->totpoint = pf->totpoint;
@@ -1565,10 +1574,10 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra)
 
 		ptcache_data_alloc(pm);
 
-		if(pf->flag & PTCACHE_TYPEFLAG_COMPRESS) {
-			for(i=0; i<BPHYS_TOT_DATA; i++) {
+		if (pf->flag & PTCACHE_TYPEFLAG_COMPRESS) {
+			for (i=0; i<BPHYS_TOT_DATA; i++) {
 				unsigned int out_len = pm->totpoint*ptcache_data_size[i];
-				if(pf->data_types & (1<<i))
+				if (pf->data_types & (1<<i))
 					ptcache_file_compressed_read(pf, (unsigned char*)(pm->data[i]), out_len);
 			}
 		}
@@ -1576,8 +1585,8 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra)
 			BKE_ptcache_mem_pointers_init(pm);
 			ptcache_file_pointers_init(pf);
 
-			for(i=0; i<pm->totpoint; i++) {
-				if(!ptcache_file_data_read(pf)) {
+			for (i=0; i<pm->totpoint; i++) {
+				if (!ptcache_file_data_read(pf)) {
 					error = 1;
 					break;
 				}
@@ -1587,10 +1596,10 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra)
 		}
 	}
 
-	if(!error && pf->flag & PTCACHE_TYPEFLAG_EXTRADATA) {
+	if (!error && pf->flag & PTCACHE_TYPEFLAG_EXTRADATA) {
 		unsigned int extratype = 0;
 
-		while(ptcache_file_read(pf, &extratype, 1, sizeof(unsigned int))) {
+		while (ptcache_file_read(pf, &extratype, 1, sizeof(unsigned int))) {
 			PTCacheExtra *extra = MEM_callocN(sizeof(PTCacheExtra), "Pointcache extradata");
 
 			extra->type = extratype;
@@ -1599,7 +1608,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)
+			if (pf->flag & PTCACHE_TYPEFLAG_COMPRESS)
 				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]);
@@ -1608,7 +1617,7 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra)
 		}
 	}
 
-	if(error && pm) {
+	if (error && pm) {
 		ptcache_data_free(pm);
 		ptcache_extra_free(pm);
 		MEM_freeN(pm);
@@ -1617,7 +1626,7 @@ static PTCacheMem *ptcache_disk_frame_to_mem(PTCacheID *pid, int cfra)
 
 	ptcache_file_close(pf);
 
-	if (error && G.f & G_DEBUG) 
+	if (error && G.debug & G_DEBUG)
 		printf("Error reading from disk cache\n");
 	
 	return pm;
@@ -1631,8 +1640,8 @@ static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm)
 
 	pf = ptcache_file_open(pid, PTCACHE_FILE_WRITE, pm->frame);
 
-	if(pf==NULL) {
-		if (G.f & G_DEBUG) 
+	if (pf==NULL) {
+		if (G.debug & G_DEBUG)
 			printf("Error opening disk cache file for writing\n");
 		return 0;
 	}
@@ -1642,19 +1651,19 @@ static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm)
 	pf->type = pid->type;
 	pf->flag = 0;
 	
-	if(pm->extradata.first)
+	if (pm->extradata.first)
 		pf->flag |= PTCACHE_TYPEFLAG_EXTRADATA;
 	
-	if(pid->cache->compression)
+	if (pid->cache->compression)
 		pf->flag |= PTCACHE_TYPEFLAG_COMPRESS;
 
-	if(!ptcache_file_header_begin_write(pf) || !pid->write_header(pf))
+	if (!ptcache_file_header_begin_write(pf) || !pid->write_header(pf))
 		error = 1;
 
-	if(!error) {
-		if(pid->cache->compression) {
-			for(i=0; i<BPHYS_TOT_DATA; i++) {
-				if(pm->data[i]) {
+	if (!error) {
+		if (pid->cache->compression) {
+			for (i=0; i<BPHYS_TOT_DATA; i++) {
+				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);
@@ -1666,9 +1675,9 @@ static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm)
 			BKE_ptcache_mem_pointers_init(pm);
 			ptcache_file_pointers_init(pf);
 
-			for(i=0; i<pm->totpoint; i++) {
+			for (i=0; i<pm->totpoint; i++) {
 				ptcache_data_copy(pm->cur, pf->cur);
-				if(!ptcache_file_data_write(pf)) {
+				if (!ptcache_file_data_write(pf)) {
 					error = 1;
 					break;
 				}
@@ -1677,17 +1686,17 @@ static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm)
 		}
 	}
 
-	if(!error && pm->extradata.first) {
+	if (!error && pm->extradata.first) {
 		PTCacheExtra *extra = pm->extradata.first;
 
-		for(; extra; extra=extra->next) {
-			if(extra->data == NULL || extra->totdata == 0)
+		for (; extra; extra=extra->next) {
+			if (extra->data == NULL || extra->totdata == 0)
 				continue;
 
 			ptcache_file_write(pf, &extra->type, 1, sizeof(unsigned int));
 			ptcache_file_write(pf, &extra->totdata, 1, sizeof(unsigned int));
 
-			if(pid->cache->compression) {
+			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);
@@ -1701,7 +1710,7 @@ static int ptcache_mem_frame_to_disk(PTCacheID *pid, PTCacheMem *pm)
 
 	ptcache_file_close(pf);
 	
-	if (error && G.f & G_DEBUG) 
+	if (error && G.debug & G_DEBUG)
 		printf("Error writing to disk cache\n");
 
 	return error==0;
@@ -1712,25 +1721,25 @@ static int ptcache_read_stream(PTCacheID *pid, int cfra)
 	PTCacheFile *pf = ptcache_file_open(pid, PTCACHE_FILE_READ, cfra);
 	int error = 0;
 
-	if(pid->read_stream == NULL)
+	if (pid->read_stream == NULL)
 		return 0;
 
-	if(pf == NULL) {
-		if (G.f & G_DEBUG) 
+	if (pf == NULL) {
+		if (G.debug & G_DEBUG)
 			printf("Error opening disk cache file for reading\n");
 		return 0;
 	}
 
-	if(!ptcache_file_header_begin_read(pf))
+	if (!ptcache_file_header_begin_read(pf))
 		error = 1;
 
-	if(!error && (pf->type != pid->type || !pid->read_header(pf)))
+	if (!error && (pf->type != pid->type || !pid->read_header(pf)))
 		error = 1;
 
-	if(!error && pf->totpoint != pid->totpoint(pid->calldata, cfra))
+	if (!error && pf->totpoint != pid->totpoint(pid->calldata, cfra))
 		error = 1;
 
-	if(!error) {
+	if (!error) {
 		ptcache_file_pointers_init(pf);
 
 		// we have stream reading here
@@ -1749,27 +1758,27 @@ static int ptcache_read(PTCacheID *pid, int cfra)
 	int *index = &i;
 
 	/* get a memory cache to read from */
-	if(pid->cache->flag & PTCACHE_DISK_CACHE) {
+	if (pid->cache->flag & PTCACHE_DISK_CACHE) {
 		pm = ptcache_disk_frame_to_mem(pid, cfra);
 	}
 	else {
 		pm = pid->cache->mem_cache.first;
 		
-		while(pm && pm->frame != cfra)
+		while (pm && pm->frame != cfra)
 			pm = pm->next;
 	}
 
 	/* read the cache */
-	if(pm) {
+	if (pm) {
 		int totpoint = pm->totpoint;
 
-		if((pid->data_types & (1<<BPHYS_DATA_INDEX)) == 0)
+		if ((pid->data_types & (1<<BPHYS_DATA_INDEX)) == 0)
 			totpoint = MIN2(totpoint, pid->totpoint(pid->calldata, cfra));
 
 		BKE_ptcache_mem_pointers_init(pm);
 
-		for(i=0; i<totpoint; i++) {
-			if(pm->data_types & (1<<BPHYS_DATA_INDEX))
+		for (i=0; i<totpoint; i++) {
+			if (pm->data_types & (1<<BPHYS_DATA_INDEX))
 				index = pm->cur[BPHYS_DATA_INDEX];
 
 			pid->read_point(*index, pid->calldata, pm->cur, (float)pm->frame, NULL);
@@ -1777,11 +1786,11 @@ static int ptcache_read(PTCacheID *pid, int cfra)
 			BKE_ptcache_mem_pointers_incr(pm);
 		}
 
-		if(pid->read_extra_data && pm->extradata.first)
+		if (pid->read_extra_data && pm->extradata.first)
 			pid->read_extra_data(pid->calldata, pm, (float)pm->frame);
 
 		/* clean up temporary memory cache */
-		if(pid->cache->flag & PTCACHE_DISK_CACHE) {
+		if (pid->cache->flag & PTCACHE_DISK_CACHE) {
 			ptcache_data_free(pm);
 			ptcache_extra_free(pm);
 			MEM_freeN(pm);
@@ -1797,38 +1806,38 @@ static int ptcache_interpolate(PTCacheID *pid, float cfra, int cfra1, int cfra2)
 	int *index = &i;
 
 	/* get a memory cache to read from */
-	if(pid->cache->flag & PTCACHE_DISK_CACHE) {
+	if (pid->cache->flag & PTCACHE_DISK_CACHE) {
 		pm = ptcache_disk_frame_to_mem(pid, cfra2);
 	}
 	else {
 		pm = pid->cache->mem_cache.first;
 		
-		while(pm && pm->frame != cfra2)
+		while (pm && pm->frame != cfra2)
 			pm = pm->next;
 	}
 
 	/* read the cache */
-	if(pm) {
+	if (pm) {
 		int totpoint = pm->totpoint;
 
-		if((pid->data_types & (1<<BPHYS_DATA_INDEX)) == 0)
+		if ((pid->data_types & (1<<BPHYS_DATA_INDEX)) == 0)
 			totpoint = MIN2(totpoint, pid->totpoint(pid->calldata, (int)cfra));
 
 		BKE_ptcache_mem_pointers_init(pm);
 
-		for(i=0; i<totpoint; i++) {
-			if(pm->data_types & (1<<BPHYS_DATA_INDEX))
+		for (i=0; i<totpoint; i++) {
+			if (pm->data_types & (1<<BPHYS_DATA_INDEX))
 				index = pm->cur[BPHYS_DATA_INDEX];
 
 			pid->interpolate_point(*index, pid->calldata, pm->cur, cfra, (float)cfra1, (float)cfra2, NULL);
 			BKE_ptcache_mem_pointers_incr(pm);
 		}
 
-		if(pid->interpolate_extra_data && pm->extradata.first)
+		if (pid->interpolate_extra_data && pm->extradata.first)
 			pid->interpolate_extra_data(pid->calldata, pm, cfra, (float)cfra1, (float)cfra2);
 
 		/* clean up temporary memory cache */
-		if(pid->cache->flag & PTCACHE_DISK_CACHE) {
+		if (pid->cache->flag & PTCACHE_DISK_CACHE) {
 			ptcache_data_free(pm);
 			ptcache_extra_free(pm);
 			MEM_freeN(pm);
@@ -1845,70 +1854,70 @@ int BKE_ptcache_read(PTCacheID *pid, float cfra)
 	int ret = 0;
 
 	/* nothing to read to */
-	if(pid->totpoint(pid->calldata, cfrai) == 0)
+	if (pid->totpoint(pid->calldata, cfrai) == 0)
 		return 0;
 
-	if(pid->cache->flag & PTCACHE_READ_INFO) {
+	if (pid->cache->flag & PTCACHE_READ_INFO) {
 		pid->cache->flag &= ~PTCACHE_READ_INFO;
 		ptcache_read(pid, 0);
 	}
 
 	/* first check if we have the actual frame cached */
-	if(cfra == (float)cfrai && BKE_ptcache_id_exist(pid, cfrai))
+	if (cfra == (float)cfrai && BKE_ptcache_id_exist(pid, cfrai))
 		cfra1 = cfrai;
 
 	/* no exact cache frame found so try to find cached frames around cfra */
-	if(cfra1 == 0)
+	if (cfra1 == 0)
 		ptcache_find_frames_around(pid, cfrai, &cfra1, &cfra2);
 
-	if(cfra1 == 0 && cfra2 == 0)
+	if (cfra1 == 0 && cfra2 == 0)
 		return 0;
 
 	/* don't read old cache if already simulated past cached frame */
-	if(cfra1 == 0 && cfra2 && cfra2 <= pid->cache->simframe)
+	if (cfra1 == 0 && cfra2 && cfra2 <= pid->cache->simframe)
 		return 0;
-	if(cfra1 && cfra1 == cfra2)
+	if (cfra1 && cfra1 == cfra2)
 		return 0;
 
-	if(cfra1) {
+	if (cfra1) {
 		
-		if(pid->read_stream) {
+		if (pid->read_stream) {
 			if (!ptcache_read_stream(pid, cfra1))
 				return 0;
 		}
-		else if(pid->read_point)
+		else if (pid->read_point)
 			ptcache_read(pid, cfra1);
 	}
 
-	if(cfra2) {
+	if (cfra2) {
 		
-		if(pid->read_stream) {
+		if (pid->read_stream) {
 			if (!ptcache_read_stream(pid, cfra2))
 				return 0;
 		}
-		else if(pid->read_point) {
-			if(cfra1 && cfra2 && pid->interpolate_point)
+		else if (pid->read_point) {
+			if (cfra1 && cfra2 && pid->interpolate_point)
 				ptcache_interpolate(pid, cfra, cfra1, cfra2);
 			else
 				ptcache_read(pid, cfra2);
 		}
 	}
 
-	if(cfra1)
+	if (cfra1)
 		ret = (cfra2 ? PTCACHE_READ_INTERPOLATED : PTCACHE_READ_EXACT);
-	else if(cfra2) {
+	else if (cfra2) {
 		ret = PTCACHE_READ_OLD;
 		pid->cache->simframe = cfra2;
 	}
 
-	if((pid->cache->flag & PTCACHE_QUICK_CACHE)==0) {
+	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) {
+		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)
+		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));
@@ -1926,8 +1935,8 @@ static int ptcache_write_stream(PTCacheID *pid, int cfra, int totpoint)
 
 	pf = ptcache_file_open(pid, PTCACHE_FILE_WRITE, cfra);
 
-	if(pf==NULL) {
-		if (G.f & G_DEBUG) 
+	if (pf==NULL) {
+		if (G.debug & G_DEBUG)
 			printf("Error opening disk cache file for writing\n");
 		return 0;
 	}
@@ -1937,15 +1946,15 @@ static int ptcache_write_stream(PTCacheID *pid, int cfra, int totpoint)
 	pf->type = pid->type;
 	pf->flag = 0;
 
-	if(!error && (!ptcache_file_header_begin_write(pf) || !pid->write_header(pf)))
+	if (!error && (!ptcache_file_header_begin_write(pf) || !pid->write_header(pf)))
 		error = 1;
 
-	if(!error && pid->write_stream)
+	if (!error && pid->write_stream)
 		pid->write_stream(pf, pid->calldata);
 
 	ptcache_file_close(pf);
 
-	if (error && G.f & G_DEBUG) 
+	if (error && G.debug & G_DEBUG)
 		printf("Error writing to disk cache\n");
 
 	return error == 0;
@@ -1965,11 +1974,11 @@ static int ptcache_write(PTCacheID *pid, int cfra, int overwrite)
 	ptcache_data_alloc(pm);
 	BKE_ptcache_mem_pointers_init(pm);
 
-	if(overwrite) {
-		if(cache->flag & PTCACHE_DISK_CACHE) {
+	if (overwrite) {
+		if (cache->flag & PTCACHE_DISK_CACHE) {
 			int fra = cfra-1;
 
-			while(fra >= cache->startframe && !BKE_ptcache_id_exist(pid, fra))
+			while (fra >= cache->startframe && !BKE_ptcache_id_exist(pid, fra))
 				fra--;
 			
 			pm2 = ptcache_disk_frame_to_mem(pid, fra);
@@ -1978,35 +1987,35 @@ static int ptcache_write(PTCacheID *pid, int cfra, int overwrite)
 			pm2 = cache->mem_cache.last;
 	}
 
-	if(pid->write_point) {
-		for(i=0; i<totpoint; i++) {
+	if (pid->write_point) {
+		for (i=0; i<totpoint; i++) {
 			int write = pid->write_point(i, pid->calldata, pm->cur, cfra);
-			if(write) {
+			if (write) {
 				BKE_ptcache_mem_pointers_incr(pm);
 
 				/* newly born particles have to be copied to previous cached frame */
-				if(overwrite && write == 2 && pm2 && BKE_ptcache_mem_pointers_seek(i, pm2))
+				if (overwrite && write == 2 && pm2 && BKE_ptcache_mem_pointers_seek(i, pm2))
 					pid->write_point(i, pid->calldata, pm2->cur, cfra);
 			}
 		}
 	}
 
-	if(pid->write_extra_data)
+	if (pid->write_extra_data)
 		pid->write_extra_data(pid->calldata, pm, cfra);
 
 	pm->frame = cfra;
 
-	if(cache->flag & PTCACHE_DISK_CACHE) {
+	if (cache->flag & PTCACHE_DISK_CACHE) {
 		error += !ptcache_mem_frame_to_disk(pid, pm);
 
-		// if(pm) /* pm is always set */
+		// if (pm) /* pm is always set */
 		{
 			ptcache_data_free(pm);
 			ptcache_extra_free(pm);
 			MEM_freeN(pm);
 		}
 
-		if(pm2) {
+		if (pm2) {
 			error += !ptcache_mem_frame_to_disk(pid, pm2);
 			ptcache_data_free(pm2);
 			ptcache_extra_free(pm2);
@@ -2025,40 +2034,40 @@ static int ptcache_write_needed(PTCacheID *pid, int cfra, int *overwrite)
 	int ofra = 0, efra = cache->endframe;
 
 	/* allways start from scratch on the first frame */
-	if(cfra && cfra == cache->startframe) {
+	if (cfra && cfra == cache->startframe) {
 		BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, cfra);
 		cache->flag &= ~PTCACHE_REDO_NEEDED;
 		return 1;
 	}
 
-	if(pid->cache->flag & PTCACHE_DISK_CACHE) {
-		if(cfra==0 && cache->startframe > 0)
+	if (pid->cache->flag & PTCACHE_DISK_CACHE) {
+		if (cfra==0 && cache->startframe > 0)
 			return 1;
 
 				/* find last cached frame */
-		while(efra > cache->startframe && !BKE_ptcache_id_exist(pid, efra))
+		while (efra > cache->startframe && !BKE_ptcache_id_exist(pid, efra))
 			efra--;
 
 		/* find second last cached frame */
 		ofra = efra-1;
-		while(ofra > cache->startframe && !BKE_ptcache_id_exist(pid, ofra))
+		while (ofra > cache->startframe && !BKE_ptcache_id_exist(pid, ofra))
 			ofra--;
 	}
 	else {
 		PTCacheMem *pm = cache->mem_cache.last;
 		/* don't write info file in memory */
-		if(cfra == 0)
+		if (cfra == 0)
 			return 0;
 
-		if(pm == NULL)
+		if (pm == NULL)
 			return 1;
 
 		efra = pm->frame;
 		ofra = (pm->prev ? pm->prev->frame : efra - cache->step);
 	}
 
-	if(efra >= cache->startframe && cfra > efra) {
-		if(ofra >= cache->startframe && efra - ofra < cache->step) {
+	if (efra >= cache->startframe && cfra > efra) {
+		if (ofra >= cache->startframe && efra - ofra < cache->step) {
 			/* overwrite previous frame */
 			BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_FRAME, efra);
 			*overwrite = 1;
@@ -2075,30 +2084,30 @@ int BKE_ptcache_write(PTCacheID *pid, unsigned int cfra)
 	int totpoint = pid->totpoint(pid->calldata, cfra);
 	int overwrite = 0, error = 0;
 
-	if(totpoint == 0 || (cfra ? pid->data_types == 0 : pid->info_types == 0))
+	if (totpoint == 0 || (cfra ? pid->data_types == 0 : pid->info_types == 0))
 		return 0;
 
-	if(ptcache_write_needed(pid, cfra, &overwrite)==0)
+	if (ptcache_write_needed(pid, cfra, &overwrite)==0)
 		return 0;
 
-	if(pid->write_stream) {
+	if (pid->write_stream) {
 		ptcache_write_stream(pid, cfra, totpoint);
 	}
-	else if(pid->write_point) {
+	else if (pid->write_point) {
 		error += ptcache_write(pid, cfra, overwrite);
 	}
 
 	/* Mark frames skipped if more than 1 frame forwards since last non-skipped frame. */
-	if(cfra - cache->last_exact == 1 || cfra == cache->startframe) {
+	if (cfra - cache->last_exact == 1 || cfra == cache->startframe) {
 		cache->last_exact = cfra;
 		cache->flag &= ~PTCACHE_FRAMES_SKIPPED;
 	}
 	/* Don't mark skipped when writing info file (frame 0) */
-	else if(cfra)
+	else if (cfra)
 		cache->flag |= PTCACHE_FRAMES_SKIPPED;
 
 	/* Update timeline cache display */
-	if(cfra && cache->cached_frames)
+	if (cfra && cache->cached_frames)
 		cache->cached_frames[cfra-cache->startframe] = 1;
 
 	BKE_ptcache_update_info(pid);
@@ -2107,8 +2116,8 @@ int BKE_ptcache_write(PTCacheID *pid, unsigned int cfra)
 }
 /* youll need to close yourself after!
  * mode - PTCACHE_CLEAR_ALL, 
+ */
 
-*/
 /* Clears & resets */
 void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
 {
@@ -2123,7 +2132,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
 	char path_full[MAX_PTCACHE_FILE];
 	char ext[MAX_PTCACHE_PATH];
 
-	if(!pid || !pid->cache || pid->cache->flag & PTCACHE_BAKED)
+	if (!pid || !pid->cache || pid->cache->flag & PTCACHE_BAKED)
 		return;
 
 	if (pid->cache->flag & PTCACHE_IGNORE_CLEAR)
@@ -2134,7 +2143,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
 
 #ifndef DURIAN_POINTCACHE_LIB_OK
 	/* don't allow clearing for linked objects */
-	if(pid->ob->id.lib)
+	if (pid->ob->id.lib)
 		return;
 #endif
 
@@ -2145,7 +2154,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
 	case PTCACHE_CLEAR_ALL:
 	case PTCACHE_CLEAR_BEFORE:	
 	case PTCACHE_CLEAR_AFTER:
-		if(pid->cache->flag & PTCACHE_DISK_CACHE) {
+		if (pid->cache->flag & PTCACHE_DISK_CACHE) {
 			ptcache_path(pid, path);
 			
 			len = ptcache_filename(pid, filename, cfra, 0, 0); /* no path */
@@ -2163,7 +2172,8 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
 							pid->cache->last_exact = MIN2(pid->cache->startframe, 0);
 							BLI_join_dirfile(path_full, sizeof(path_full), path, de->d_name);
 							BLI_delete(path_full, 0, 0);
-						} else {
+						}
+						else {
 							/* read the number of the file */
 							unsigned int frame, len2 = (int)strlen(de->d_name);
 							char num[7];
@@ -2172,12 +2182,12 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
 								BLI_strncpy(num, de->d_name + (strlen(de->d_name) - 15), sizeof(num));
 								frame = atoi(num);
 								
-								if((mode==PTCACHE_CLEAR_BEFORE && frame < cfra)	|| 
+								if ((mode==PTCACHE_CLEAR_BEFORE && frame < cfra)	|| 
 								(mode==PTCACHE_CLEAR_AFTER && frame > cfra)	) {
 									
 									BLI_join_dirfile(path_full, sizeof(path_full), path, de->d_name);
 									BLI_delete(path_full, 0, 0);
-									if(pid->cache->cached_frames && frame >=sta && frame <= end)
+									if (pid->cache->cached_frames && frame >=sta && frame <= end)
 										pid->cache->cached_frames[frame-sta] = 0;
 								}
 							}
@@ -2187,30 +2197,31 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
 			}
 			closedir(dir);
 
-			if(mode == PTCACHE_CLEAR_ALL && pid->cache->cached_frames)
+			if (mode == PTCACHE_CLEAR_ALL && pid->cache->cached_frames)
 				memset(pid->cache->cached_frames, 0, MEM_allocN_len(pid->cache->cached_frames));
 		}
 		else {
 			PTCacheMem *pm= pid->cache->mem_cache.first;
 			PTCacheMem *link= NULL;
 
-			if(mode == PTCACHE_CLEAR_ALL) {
+			if (mode == PTCACHE_CLEAR_ALL) {
 				/*we want startframe if the cache starts before zero*/
 				pid->cache->last_exact = MIN2(pid->cache->startframe, 0);
-				for(; pm; pm=pm->next) {
+				for (; pm; pm=pm->next) {
 					ptcache_data_free(pm);
 					ptcache_extra_free(pm);
 				}
 				BLI_freelistN(&pid->cache->mem_cache);
 
-				if(pid->cache->cached_frames) 
+				if (pid->cache->cached_frames) 
 					memset(pid->cache->cached_frames, 0, MEM_allocN_len(pid->cache->cached_frames));
-			} else {
-				while(pm) {
-					if((mode==PTCACHE_CLEAR_BEFORE && pm->frame < cfra)	|| 
+			}
+			else {
+				while (pm) {
+					if ((mode==PTCACHE_CLEAR_BEFORE && pm->frame < cfra)	|| 
 					(mode==PTCACHE_CLEAR_AFTER && pm->frame > cfra)	) {
 						link = pm;
-						if(pid->cache->cached_frames && pm->frame >=sta && pm->frame <= end)
+						if (pid->cache->cached_frames && pm->frame >=sta && pm->frame <= end)
 							pid->cache->cached_frames[pm->frame-sta] = 0;
 						ptcache_data_free(pm);
 						ptcache_extra_free(pm);
@@ -2225,8 +2236,8 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
 		break;
 		
 	case PTCACHE_CLEAR_FRAME:
-		if(pid->cache->flag & PTCACHE_DISK_CACHE) {
-			if(BKE_ptcache_id_exist(pid, cfra)) {
+		if (pid->cache->flag & PTCACHE_DISK_CACHE) {
+			if (BKE_ptcache_id_exist(pid, cfra)) {
 				ptcache_filename(pid, filename, cfra, 1, 1); /* no path */
 				BLI_delete(filename, 0, 0);
 			}
@@ -2234,8 +2245,8 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
 		else {
 			PTCacheMem *pm = pid->cache->mem_cache.first;
 
-			for(; pm; pm=pm->next) {
-				if(pm->frame == cfra) {
+			for (; pm; pm=pm->next) {
+				if (pm->frame == cfra) {
 					ptcache_data_free(pm);
 					ptcache_extra_free(pm);
 					BLI_freelinkN(&pid->cache->mem_cache, pm);
@@ -2243,7 +2254,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;
 	}
@@ -2252,16 +2263,16 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
 }
 int  BKE_ptcache_id_exist(PTCacheID *pid, int cfra)
 {
-	if(!pid->cache)
+	if (!pid->cache)
 		return 0;
 
-	if(cfra<pid->cache->startframe || cfra > pid->cache->endframe)
+	if (cfra<pid->cache->startframe || cfra > pid->cache->endframe)
 		return 0;
 
-	if(pid->cache->cached_frames &&	pid->cache->cached_frames[cfra-pid->cache->startframe]==0)
+	if (pid->cache->cached_frames &&	pid->cache->cached_frames[cfra-pid->cache->startframe]==0)
 		return 0;
 	
-	if(pid->cache->flag & PTCACHE_DISK_CACHE) {
+	if (pid->cache->flag & PTCACHE_DISK_CACHE) {
 		char filename[MAX_PTCACHE_FILE];
 		
 		ptcache_filename(pid, filename, cfra, 1, 1);
@@ -2271,8 +2282,8 @@ int  BKE_ptcache_id_exist(PTCacheID *pid, int cfra)
 	else {
 		PTCacheMem *pm = pid->cache->mem_cache.first;
 
-		for(; pm; pm=pm->next) {
-			if(pm->frame==cfra)
+		for (; pm; pm=pm->next) {
+			if (pm->frame==cfra)
 				return 1;
 		}
 		return 0;
@@ -2285,7 +2296,7 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra
 	/* float offset; unused for now */
 	float time, nexttime;
 
-	/* TODO: this has to be sorter out once bsystem_time gets redone, */
+	/* TODO: this has to be sorted out once bsystem_time gets redone, */
 	/*       now caches can handle interpolating etc. too - jahka */
 
 	/* time handling for point cache:
@@ -2300,14 +2311,14 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra
 	/* ob= pid->ob; */ /* UNUSED */
 	cache= pid->cache;
 
-	if(timescale) {
+	if (timescale) {
 		time= BKE_curframe(scene);
 		nexttime= BKE_frame_to_ctime(scene, CFRA+1);
 		
 		*timescale= MAX2(nexttime - time, 0.0f);
 	}
 
-	if(startframe && endframe) {
+	if (startframe && endframe) {
 		*startframe= cache->startframe;
 		*endframe= cache->endframe;
 
@@ -2326,20 +2337,20 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra
 	}
 
 	/* verify cached_frames array is up to date */
-	if(cache->cached_frames) {
-		if(MEM_allocN_len(cache->cached_frames) != sizeof(char) * (cache->endframe-cache->startframe+1)) {
+	if (cache->cached_frames) {
+		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) {
+	if (cache->cached_frames==NULL && cache->endframe > cache->startframe) {
 		unsigned int sta=cache->startframe;
 		unsigned int end=cache->endframe;
 
 		cache->cached_frames = MEM_callocN(sizeof(char) * (cache->endframe-cache->startframe+1), "cached frames array");
 
-		if(pid->cache->flag & PTCACHE_DISK_CACHE) {
+		if (pid->cache->flag & PTCACHE_DISK_CACHE) {
 			/* mode is same as fopen's modes */
 			DIR *dir; 
 			struct dirent *de;
@@ -2369,7 +2380,7 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra
 							BLI_strncpy(num, de->d_name + (strlen(de->d_name) - 15), sizeof(num));
 							frame = atoi(num);
 							
-							if(frame >= sta && frame <= end)
+							if (frame >= sta && frame <= end)
 								cache->cached_frames[frame-sta] = 1;
 						}
 					}
@@ -2380,8 +2391,8 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra
 		else {
 			PTCacheMem *pm= pid->cache->mem_cache.first;
 
-			while(pm) {
-				if(pm->frame >= sta && pm->frame <= end)
+			while (pm) {
+				if (pm->frame >= sta && pm->frame <= end)
 					cache->cached_frames[pm->frame-sta] = 1;
 				pm = pm->next;
 			}
@@ -2393,7 +2404,7 @@ int  BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode)
 	PointCache *cache;
 	int reset, clear, after;
 
-	if(!pid->cache)
+	if (!pid->cache)
 		return 0;
 
 	cache= pid->cache;
@@ -2401,9 +2412,9 @@ int  BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode)
 	clear= 0;
 	after= 0;
 
-	if(mode == PTCACHE_RESET_DEPSGRAPH) {
-		if(!(cache->flag & PTCACHE_BAKED) && !BKE_ptcache_get_continue_physics()) {
-			if(cache->flag & PTCACHE_QUICK_CACHE)
+	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;
@@ -2411,43 +2422,43 @@ int  BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode)
 
 		cache->flag |= PTCACHE_OUTDATED;
 	}
-	else if(mode == PTCACHE_RESET_BAKED) {
-		if(!BKE_ptcache_get_continue_physics()) {
+	else if (mode == PTCACHE_RESET_BAKED) {
+		if (!BKE_ptcache_get_continue_physics()) {
 			reset= 1;
 			clear= 1;
 		}
 		else
 			cache->flag |= PTCACHE_OUTDATED;
 	}
-	else if(mode == PTCACHE_RESET_OUTDATED) {
+	else if (mode == PTCACHE_RESET_OUTDATED) {
 		reset = 1;
 
-		if(cache->flag & PTCACHE_OUTDATED && !(cache->flag & PTCACHE_BAKED)) {
+		if (cache->flag & PTCACHE_OUTDATED && !(cache->flag & PTCACHE_BAKED)) {
 			clear= 1;
 			cache->flag &= ~PTCACHE_OUTDATED;
 		}
 	}
 
-	if(reset) {
+	if (reset) {
 		BKE_ptcache_invalidate(cache);
 		cache->flag &= ~PTCACHE_REDO_NEEDED;
 
-		if(pid->type == PTCACHE_TYPE_CLOTH)
+		if (pid->type == PTCACHE_TYPE_CLOTH)
 			cloth_free_modifier(pid->calldata);
-		else if(pid->type == PTCACHE_TYPE_SOFTBODY)
+		else if (pid->type == PTCACHE_TYPE_SOFTBODY)
 			sbFreeSimulation(pid->calldata);
-		else if(pid->type == PTCACHE_TYPE_PARTICLES)
+		else if (pid->type == PTCACHE_TYPE_PARTICLES)
 			psys_reset(pid->calldata, PSYS_RESET_DEPSGRAPH);
-		else if(pid->type == PTCACHE_TYPE_SMOKE_DOMAIN)
+		else if (pid->type == PTCACHE_TYPE_SMOKE_DOMAIN)
 			smokeModifier_reset(pid->calldata);
-		else if(pid->type == PTCACHE_TYPE_SMOKE_HIGHRES)
+		else if (pid->type == PTCACHE_TYPE_SMOKE_HIGHRES)
 			smokeModifier_reset_turbulence(pid->calldata);
-		else if(pid->type == PTCACHE_TYPE_DYNAMICPAINT)
+		else if (pid->type == PTCACHE_TYPE_DYNAMICPAINT)
 			dynamicPaint_clearSurface((DynamicPaintSurface*)pid->calldata);
 	}
-	if(clear)
+	if (clear)
 		BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0);
-	else if(after)
+	else if (after)
 		BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_AFTER, CFRA);
 
 	return (reset || clear || after);
@@ -2462,47 +2473,47 @@ int  BKE_ptcache_object_reset(Scene *scene, Object *ob, int mode)
 	reset= 0;
 	skip= 0;
 
-	if(ob->soft) {
+	if (ob->soft) {
 		BKE_ptcache_id_from_softbody(&pid, ob, ob->soft);
 		reset |= BKE_ptcache_id_reset(scene, &pid, mode);
 	}
 
-	for(psys=ob->particlesystem.first; psys; psys=psys->next) {
+	for (psys=ob->particlesystem.first; psys; psys=psys->next) {
 		/* children or just redo can be calculated without reseting anything */
-		if(psys->recalc & PSYS_RECALC_REDO || psys->recalc & PSYS_RECALC_CHILD)
+		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 */
 		/* particles or cloth in that case -jahka */
-		else if(psys->clmd) {
+		else if (psys->clmd) {
 			BKE_ptcache_id_from_cloth(&pid, ob, psys->clmd);
-			if(mode == PSYS_RESET_ALL || !(psys->part->type == PART_HAIR && (pid.cache->flag & PTCACHE_BAKED))) 
+			if (mode == PSYS_RESET_ALL || !(psys->part->type == PART_HAIR && (pid.cache->flag & PTCACHE_BAKED))) 
 				reset |= BKE_ptcache_id_reset(scene, &pid, mode);
 			else
 				skip = 1;
 		}
 
-		if(skip == 0 && psys->part) {
+		if (skip == 0 && psys->part) {
 			BKE_ptcache_id_from_particles(&pid, ob, psys);
 			reset |= BKE_ptcache_id_reset(scene, &pid, mode);
 		}
 	}
 
-	for(md=ob->modifiers.first; md; md=md->next) {
-		if(md->type == eModifierType_Cloth) {
+	for (md=ob->modifiers.first; md; md=md->next) {
+		if (md->type == eModifierType_Cloth) {
 			BKE_ptcache_id_from_cloth(&pid, ob, (ClothModifierData*)md);
 			reset |= BKE_ptcache_id_reset(scene, &pid, mode);
 		}
-		if(md->type == eModifierType_Smoke) {
+		if (md->type == eModifierType_Smoke) {
 			SmokeModifierData *smd = (SmokeModifierData *)md;
-			if(smd->type & MOD_SMOKE_TYPE_DOMAIN)
+			if (smd->type & MOD_SMOKE_TYPE_DOMAIN)
 			{
 				BKE_ptcache_id_from_smoke(&pid, ob, (SmokeModifierData*)md);
 				reset |= BKE_ptcache_id_reset(scene, &pid, mode);
 			}
 		}
-		if(md->type == eModifierType_DynamicPaint) {
+		if (md->type == eModifierType_DynamicPaint) {
 			DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
-			if(pmd->canvas)
+			if (pmd->canvas)
 			{
 				DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
 
@@ -2540,18 +2551,21 @@ void BKE_ptcache_remove(void)
 			return;
 		
 		while ((de = readdir(dir)) != NULL) {
-			if( strcmp(de->d_name, ".")==0 || strcmp(de->d_name, "..")==0) {
+			if ( strcmp(de->d_name, ".")==0 || strcmp(de->d_name, "..")==0) {
 				/* do nothing */
-			} else if (strstr(de->d_name, PTCACHE_EXT)) { /* do we have the right extension?*/
+			}
+			else if (strstr(de->d_name, PTCACHE_EXT)) { /* do we have the right extension?*/
 				BLI_join_dirfile(path_full, sizeof(path_full), path, de->d_name);
 				BLI_delete(path_full, 0, 0);
-			} else {
-				rmdir = 0; /* unknown file, dont remove the dir */
+			}
+			else {
+				rmdir = 0; /* unknown file, don't remove the dir */
 			}
 		}
 
 		closedir(dir);
-	} else { 
+	}
+	else {
 		rmdir = 0; /* path dosnt exist  */
 	}
 	
@@ -2568,12 +2582,12 @@ void BKE_ptcache_set_continue_physics(Main *bmain, Scene *scene, int enable)
 {
 	Object *ob;
 
-	if(CONTINUE_PHYSICS != enable) {
+	if (CONTINUE_PHYSICS != enable) {
 		CONTINUE_PHYSICS = enable;
 
-		if(CONTINUE_PHYSICS == 0) {
-			for(ob=bmain->object.first; ob; ob=ob->id.next)
-				if(BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_OUTDATED))
+		if (CONTINUE_PHYSICS == 0) {
+			for (ob=bmain->object.first; ob; ob=ob->id.next)
+				if (BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_OUTDATED))
 					DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 		}
 	}
@@ -2605,8 +2619,8 @@ void BKE_ptcache_free_mem(ListBase *mem_cache)
 {
 	PTCacheMem *pm = mem_cache->first;
 
-	if(pm) {
-		for(; pm; pm=pm->next) {
+	if (pm) {
+		for (; pm; pm=pm->next) {
 			ptcache_data_free(pm);
 			ptcache_extra_free(pm);
 		}
@@ -2617,9 +2631,9 @@ void BKE_ptcache_free_mem(ListBase *mem_cache)
 void BKE_ptcache_free(PointCache *cache)
 {
 	BKE_ptcache_free_mem(&cache->mem_cache);
-	if(cache->edit && cache->free_edit)
+	if (cache->edit && cache->free_edit)
 		cache->free_edit(cache->edit);
-	if(cache->cached_frames)
+	if (cache->cached_frames)
 		MEM_freeN(cache->cached_frames);
 	MEM_freeN(cache);
 }
@@ -2627,7 +2641,7 @@ void BKE_ptcache_free_list(ListBase *ptcaches)
 {
 	PointCache *cache = ptcaches->first;
 
-	while(cache) {
+	while (cache) {
 		BLI_remlink(ptcaches, cache);
 		BKE_ptcache_free(cache);
 		cache = ptcaches->first;
@@ -2658,7 +2672,7 @@ PointCache *BKE_ptcache_copy_list(ListBase *ptcaches_new, ListBase *ptcaches_old
 
 	ptcaches_new->first = ptcaches_new->last = NULL;
 
-	for(; cache; cache=cache->next)
+	for (; cache; cache=cache->next)
 		BLI_addtail(ptcaches_new, ptcache_copy(cache));
 
 	return ptcaches_new->first;
@@ -2687,7 +2701,7 @@ void BKE_ptcache_quick_cache_all(Main *bmain, Scene *scene)
 }
 
 /* Simulation thread, no need for interlocks as data written in both threads
- are only unitary integers (I/O assumed to be atomic for them) */
+ * are only unitary integers (I/O assumed to be atomic for them) */
 typedef struct {
 	int break_operation;
 	int thread_ended;
@@ -2700,8 +2714,8 @@ typedef struct {
 
 static void ptcache_dt_to_str(char *str, double dtime)
 {
-	if(dtime > 60.0) {
-		if(dtime > 3600.0)
+	if (dtime > 60.0) {
+		if (dtime > 3600.0)
 			sprintf(str, "%ih %im %is", (int)(dtime/3600), ((int)(dtime/60))%60, ((int)dtime) % 60);
 		else
 			sprintf(str, "%im %is", ((int)(dtime/60))%60, ((int)dtime) % 60);
@@ -2722,9 +2736,9 @@ static void *ptcache_bake_thread(void *ptr)
 	sfra = *data->cfra_ptr;
 	efra = data->endframe;
 
-	for(; (*data->cfra_ptr <= data->endframe) && !data->break_operation; *data->cfra_ptr+=data->step) {
+	for (; (*data->cfra_ptr <= data->endframe) && !data->break_operation; *data->cfra_ptr+=data->step) {
 		scene_update_for_newframe(data->main, data->scene, data->scene->lay);
-		if(G.background) {
+		if (G.background) {
 			printf("bake: frame %d :: %d\n", (int)*data->cfra_ptr, data->endframe);
 		}
 		else {
@@ -2732,22 +2746,22 @@ static void *ptcache_bake_thread(void *ptr)
 
 			fetd = (ctime-ptime)*(efra-*data->cfra_ptr)/data->step;
 
-			if(usetimer || fetd > 60.0) {
+			if (usetimer || fetd > 60.0) {
 				usetimer = 1;
 
 				ptcache_dt_to_str(cur, ctime-ptime);
 				ptcache_dt_to_str(run, ctime-stime);
 				ptcache_dt_to_str(etd, fetd);
 
-				printf("Baked for %s, current frame: %i/%i (%.3fs), ETC: %s          \r", run, *data->cfra_ptr-sfra+1, efra-sfra+1, ctime-ptime, etd);
+				printf("Baked for %s, current frame: %i/%i (%.3fs), ETC: %s\r", run, *data->cfra_ptr-sfra+1, efra-sfra+1, ctime-ptime, etd);
 			}
 			ptime = ctime;
 		}
 	}
 
-	if(usetimer) {
+	if (usetimer) {
 		ptcache_dt_to_str(run, PIL_check_seconds_timer()-stime);
-		printf("Bake %s %s (%i frames simulated).                       \n", (data->break_operation ? "canceled after" : "finished in"), run, *data->cfra_ptr-sfra);
+		printf("Bake %s %s (%i frames simulated).\n", (data->break_operation ? "canceled after" : "finished in"), run, *data->cfra_ptr-sfra);
 	}
 
 	data->thread_ended = TRUE;
@@ -2782,29 +2796,29 @@ void BKE_ptcache_bake(PTCacheBaker* baker)
 	G.afbreek = 0;
 
 	/* set caches to baking mode and figure out start frame */
-	if(pid) {
+	if (pid) {
 		/* cache/bake a single object */
 		cache = pid->cache;
-		if((cache->flag & PTCACHE_BAKED)==0) {
-			if(pid->type==PTCACHE_TYPE_PARTICLES) {
+		if ((cache->flag & PTCACHE_BAKED)==0) {
+			if (pid->type==PTCACHE_TYPE_PARTICLES) {
 				ParticleSystem *psys= pid->calldata;
 
 				/* a bit confusing, could make this work better in the UI */
-				if(psys->part->type == PART_EMITTER)
+				if (psys->part->type == PART_EMITTER)
 					psys_get_pointcache_start_end(scene, pid->calldata, &cache->startframe, &cache->endframe);
 			}
-			else if(pid->type == PTCACHE_TYPE_SMOKE_HIGHRES) {
+			else if (pid->type == PTCACHE_TYPE_SMOKE_HIGHRES) {
 				/* get all pids from the object and search for smoke low res */
 				ListBase pidlist2;
 				PTCacheID *pid2;
 				BKE_ptcache_ids_from_object(&pidlist2, pid->ob, scene, MAX_DUPLI_RECUR);
-				for(pid2=pidlist2.first; pid2; pid2=pid2->next) {
-					if(pid2->type == PTCACHE_TYPE_SMOKE_DOMAIN) 
+				for (pid2=pidlist2.first; pid2; pid2=pid2->next) {
+					if (pid2->type == PTCACHE_TYPE_SMOKE_DOMAIN) 
 					{
-						if(pid2->cache && !(pid2->cache->flag & PTCACHE_BAKED)) {
-							if(bake || pid2->cache->flag & PTCACHE_REDO_NEEDED)
+						if (pid2->cache && !(pid2->cache->flag & PTCACHE_BAKED)) {
+							if (bake || pid2->cache->flag & PTCACHE_REDO_NEEDED)
 								BKE_ptcache_id_clear(pid2, PTCACHE_CLEAR_ALL, 0);
-							if(bake) {
+							if (bake) {
 								pid2->cache->flag |= PTCACHE_BAKING;
 								pid2->cache->flag &= ~PTCACHE_BAKED;
 							}
@@ -2814,12 +2828,12 @@ void BKE_ptcache_bake(PTCacheBaker* baker)
 				BLI_freelistN(&pidlist2);
 			}
 
-			if(bake || cache->flag & PTCACHE_REDO_NEEDED)
+			if (bake || cache->flag & PTCACHE_REDO_NEEDED)
 				BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0);
 
 			startframe = MAX2(cache->last_exact, cache->startframe);
 
-			if(bake) {
+			if (bake) {
 				thread_data.endframe = cache->endframe;
 				cache->flag |= PTCACHE_BAKING;
 			}
@@ -2830,40 +2844,44 @@ void BKE_ptcache_bake(PTCacheBaker* baker)
 			cache->flag &= ~PTCACHE_BAKED;
 		}
 	}
-	else for(SETLOOPER(scene, sce_iter, base)) {
-		/* cache/bake everything in the scene */
-		BKE_ptcache_ids_from_object(&pidlist, base->object, scene, MAX_DUPLI_RECUR);
+	else {
+		for (SETLOOPER(scene, sce_iter, base)) {
+			/* cache/bake everything in the scene */
+			BKE_ptcache_ids_from_object(&pidlist, base->object, scene, MAX_DUPLI_RECUR);
+
+			for (pid=pidlist.first; pid; pid=pid->next) {
+				cache = pid->cache;
+				if ((cache->flag & PTCACHE_BAKED)==0) {
+					if (pid->type==PTCACHE_TYPE_PARTICLES) {
+						ParticleSystem *psys = (ParticleSystem*)pid->calldata;
+						/* skip hair & keyed particles */
+						if (psys->part->type == PART_HAIR || psys->part->phystype == PART_PHYS_KEYED)
+							continue;
+
+						psys_get_pointcache_start_end(scene, pid->calldata, &cache->startframe, &cache->endframe);
+					}
 
-		for(pid=pidlist.first; pid; pid=pid->next) {
-			cache = pid->cache;
-			if((cache->flag & PTCACHE_BAKED)==0) {
-				if(pid->type==PTCACHE_TYPE_PARTICLES) {
-					ParticleSystem *psys = (ParticleSystem*)pid->calldata;
-					/* skip hair & keyed particles */
-					if(psys->part->type == PART_HAIR || psys->part->phystype == PART_PHYS_KEYED)
-						continue;
+					if ((cache->flag & PTCACHE_REDO_NEEDED || (cache->flag & PTCACHE_SIMULATION_VALID)==0) &&
+					    ((cache->flag & PTCACHE_QUICK_CACHE)==0 || render || bake))
+					{
+						BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0);
+					}
 
-					psys_get_pointcache_start_end(scene, pid->calldata, &cache->startframe, &cache->endframe);
-				}
+					startframe = MIN2(startframe, cache->startframe);
 
-				if((cache->flag & PTCACHE_REDO_NEEDED || (cache->flag & PTCACHE_SIMULATION_VALID)==0)
-					&& ((cache->flag & PTCACHE_QUICK_CACHE)==0 || render || bake))
-					BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0);
+					if (bake || render) {
+						cache->flag |= PTCACHE_BAKING;
 
-				startframe = MIN2(startframe, cache->startframe);
+						if (bake)
+							thread_data.endframe = MAX2(thread_data.endframe, cache->endframe);
+					}
 
-				if(bake || render) {
-					cache->flag |= PTCACHE_BAKING;
+					cache->flag &= ~PTCACHE_BAKED;
 
-					if(bake)
-						thread_data.endframe = MAX2(thread_data.endframe, cache->endframe);
 				}
-
-				cache->flag &= ~PTCACHE_BAKED;
-
 			}
+			BLI_freelistN(&pidlist);
 		}
-		BLI_freelistN(&pidlist);
 	}
 
 	CFRA = startframe;
@@ -2874,7 +2892,7 @@ void BKE_ptcache_bake(PTCacheBaker* baker)
 
 	WM_cursor_wait(1);
 	
-	if(G.background) {
+	if (G.background) {
 		ptcache_bake_thread((void*)&thread_data);
 	}
 	else {
@@ -2883,7 +2901,7 @@ void BKE_ptcache_bake(PTCacheBaker* baker)
 
 		while (thread_data.thread_ended == FALSE) {
 
-			if(bake)
+			if (bake)
 				progress = (int)(100.0f * (float)(CFRA - startframe)/(float)(thread_data.endframe-startframe));
 			else
 				progress = CFRA;
@@ -2898,7 +2916,7 @@ void BKE_ptcache_bake(PTCacheBaker* baker)
 			PIL_sleep_ms(200);
 
 			/* NOTE: breaking baking should leave calculated frames in cache, not clear it */
-			if(blender_test_break() && !thread_data.break_operation) {
+			if (blender_test_break() && !thread_data.break_operation) {
 				thread_data.break_operation = TRUE;
 				if (baker->progressend)
 					baker->progressend(baker->progresscontext);
@@ -2909,46 +2927,48 @@ void BKE_ptcache_bake(PTCacheBaker* baker)
 	BLI_end_threads(&threads);
 	}
 	/* clear baking flag */
-	if(pid) {
+	if (pid) {
 		cache->flag &= ~(PTCACHE_BAKING|PTCACHE_REDO_NEEDED);
 		cache->flag |= PTCACHE_SIMULATION_VALID;
-		if(bake) {
+		if (bake) {
 			cache->flag |= PTCACHE_BAKED;
 			/* write info file */
-			if(cache->flag & PTCACHE_DISK_CACHE)
+			if (cache->flag & PTCACHE_DISK_CACHE)
 				BKE_ptcache_write(pid, 0);
 		}
 	}
-	else for(SETLOOPER(scene, sce_iter, base)) {
-		BKE_ptcache_ids_from_object(&pidlist, base->object, scene, MAX_DUPLI_RECUR);
+	else {
+		for (SETLOOPER(scene, sce_iter, base)) {
+			BKE_ptcache_ids_from_object(&pidlist, base->object, scene, MAX_DUPLI_RECUR);
 
-		for(pid=pidlist.first; pid; pid=pid->next) {
-			/* skip hair particles */
-			if(pid->type==PTCACHE_TYPE_PARTICLES && ((ParticleSystem*)pid->calldata)->part->type == PART_HAIR)
-				continue;
-		
-			cache = pid->cache;
+			for (pid=pidlist.first; pid; pid=pid->next) {
+				/* skip hair particles */
+				if (pid->type==PTCACHE_TYPE_PARTICLES && ((ParticleSystem*)pid->calldata)->part->type == PART_HAIR)
+					continue;
 
-			if(thread_data.step > 1)
-				cache->flag &= ~(PTCACHE_BAKING|PTCACHE_OUTDATED);
-			else
-				cache->flag &= ~(PTCACHE_BAKING|PTCACHE_REDO_NEEDED);
+				cache = pid->cache;
 
-			cache->flag |= PTCACHE_SIMULATION_VALID;
+				if (thread_data.step > 1)
+					cache->flag &= ~(PTCACHE_BAKING|PTCACHE_OUTDATED);
+				else
+					cache->flag &= ~(PTCACHE_BAKING|PTCACHE_REDO_NEEDED);
 
-			if(bake) {
-				cache->flag |= PTCACHE_BAKED;
-				if(cache->flag & PTCACHE_DISK_CACHE)
-					BKE_ptcache_write(pid, 0);
+				cache->flag |= PTCACHE_SIMULATION_VALID;
+
+				if (bake) {
+					cache->flag |= PTCACHE_BAKED;
+					if (cache->flag & PTCACHE_DISK_CACHE)
+						BKE_ptcache_write(pid, 0);
+				}
 			}
+			BLI_freelistN(&pidlist);
 		}
-		BLI_freelistN(&pidlist);
 	}
 
 	scene->r.framelen = frameleno;
 	CFRA = cfrao;
 	
-	if(bake) /* already on cfra unless baking */
+	if (bake) /* already on cfra unless baking */
 		scene_update_for_newframe(bmain, scene, scene->lay);
 
 	if (thread_data.break_operation)
@@ -2977,10 +2997,10 @@ void BKE_ptcache_disk_to_mem(PTCacheID *pid)
 	/* restore possible bake flag */
 	cache->flag |= baked;
 
-	for(cfra=sfra; cfra <= efra; cfra++) {
+	for (cfra=sfra; cfra <= efra; cfra++) {
 		pm = ptcache_disk_frame_to_mem(pid, cfra);
 
-		if(pm)
+		if (pm)
 			BLI_addtail(&pid->cache->mem_cache, pm);
 	}
 }
@@ -2999,15 +3019,15 @@ void BKE_ptcache_mem_to_disk(PTCacheID *pid)
 	/* restore possible bake flag */
 	cache->flag |= baked;
 
-	for(; pm; pm=pm->next) {
-		if(ptcache_mem_frame_to_disk(pid, pm)==0) {
+	for (; pm; pm=pm->next) {
+		if (ptcache_mem_frame_to_disk(pid, pm)==0) {
 			cache->flag &= ~PTCACHE_DISK_CACHE;
 			break;
 		}
 	}
 
 	/* write info file */
-	if(cache->flag & PTCACHE_BAKED)
+	if (cache->flag & PTCACHE_BAKED)
 		BKE_ptcache_write(pid, 0);
 }
 void BKE_ptcache_toggle_disk_cache(PTCacheID *pid)
@@ -3015,19 +3035,19 @@ void BKE_ptcache_toggle_disk_cache(PTCacheID *pid)
 	PointCache *cache = pid->cache;
 	int last_exact = cache->last_exact;
 
-	if (!G.relbase_valid){
+	if (!G.relbase_valid) {
 		cache->flag &= ~PTCACHE_DISK_CACHE;
-		if (G.f & G_DEBUG) 
+		if (G.debug & G_DEBUG)
 			printf("File must be saved before using disk cache!\n");
 		return;
 	}
 
-	if(cache->cached_frames) {
+	if (cache->cached_frames) {
 		MEM_freeN(cache->cached_frames);
 		cache->cached_frames=NULL;
 	}
 
-	if(cache->flag & PTCACHE_DISK_CACHE)
+	if (cache->flag & PTCACHE_DISK_CACHE)
 		BKE_ptcache_mem_to_disk(pid);
 	else
 		BKE_ptcache_disk_to_mem(pid);
@@ -3066,7 +3086,7 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, const char *name_src, const c
 
 	ptcache_path(pid, path);
 	dir = opendir(path);
-	if(dir==NULL) {
+	if (dir==NULL) {
 		BLI_strncpy(pid->cache->name, old_name, sizeof(pid->cache->name));
 		return;
 	}
@@ -3115,7 +3135,7 @@ void BKE_ptcache_load_external(PTCacheID *pid)
 	char filename[MAX_PTCACHE_FILE];
 	char ext[MAX_PTCACHE_PATH];
 
-	if(!cache)
+	if (!cache)
 		return;
 
 	ptcache_path(pid, path);
@@ -3126,7 +3146,7 @@ void BKE_ptcache_load_external(PTCacheID *pid)
 	if (dir==NULL)
 		return;
 
-	if(cache->index >= 0)
+	if (cache->index >= 0)
 		BLI_snprintf(ext, sizeof(ext), "_%02d"PTCACHE_EXT, cache->index);
 	else
 		BLI_strncpy(ext, PTCACHE_EXT, sizeof(ext));
@@ -3142,7 +3162,7 @@ void BKE_ptcache_load_external(PTCacheID *pid)
 					BLI_strncpy(num, de->d_name + (strlen(de->d_name) - 15), sizeof(num));
 					frame = atoi(num);
 
-					if(frame) {
+					if (frame) {
 						start = MIN2(start, frame);
 						end = MAX2(end, frame);
 					}
@@ -3154,22 +3174,22 @@ void BKE_ptcache_load_external(PTCacheID *pid)
 	}
 	closedir(dir);
 
-	if(start != MAXFRAME) {
+	if (start != MAXFRAME) {
 		PTCacheFile *pf;
 
 		cache->startframe = start;
 		cache->endframe = end;
 		cache->totpoint = 0;
 
-		if(pid->type == PTCACHE_TYPE_SMOKE_DOMAIN)
+		if (pid->type == PTCACHE_TYPE_SMOKE_DOMAIN)
 			; /*necessary info in every file*/
 		/* read totpoint from info file (frame 0) */
-		else if(info) {
+		else if (info) {
 			pf= ptcache_file_open(pid, PTCACHE_FILE_READ, 0);
 
-			if(pf) {
-				if(ptcache_file_header_begin_read(pf)) {
-					if(pf->type == pid->type && pid->read_header(pf)) {
+			if (pf) {
+				if (ptcache_file_header_begin_read(pf)) {
+					if (pf->type == pid->type && pid->read_header(pf)) {
 						cache->totpoint = pf->totpoint;
 						cache->flag |= PTCACHE_READ_INFO;
 					}
@@ -3186,8 +3206,8 @@ void BKE_ptcache_load_external(PTCacheID *pid)
 			int elemsize = ptcache_old_elemsize(pid);
 			pf= ptcache_file_open(pid, PTCACHE_FILE_READ, cache->startframe);
 
-			if(pf) {
-				while(ptcache_file_read(pf, old_data, 1, elemsize))
+			if (pf) {
+				while (ptcache_file_read(pf, old_data, 1, elemsize))
 					cache->totpoint++;
 				
 				ptcache_file_close(pf);
@@ -3207,30 +3227,30 @@ void BKE_ptcache_update_info(PTCacheID *pid)
 	int totframes = 0;
 	char mem_info[64];
 
-	if(cache->flag & PTCACHE_EXTERNAL) {
+	if (cache->flag & PTCACHE_EXTERNAL) {
 		int cfra = cache->startframe;
 
-		for(; cfra<=cache->endframe; cfra++) {
-			if(BKE_ptcache_id_exist(pid, cfra))
+		for (; cfra<=cache->endframe; cfra++) {
+			if (BKE_ptcache_id_exist(pid, cfra))
 				totframes++;
 		}
 
 		/* smoke doesn't use frame 0 as info frame so can't check based on totpoint */
-		if(pid->type == PTCACHE_TYPE_SMOKE_DOMAIN && totframes)
+		if (pid->type == PTCACHE_TYPE_SMOKE_DOMAIN && totframes)
 			BLI_snprintf(cache->info, sizeof(cache->info), "%i frames found!", totframes);
-		else if(totframes && cache->totpoint)
+		else if (totframes && cache->totpoint)
 			BLI_snprintf(cache->info, sizeof(cache->info), "%i points found!", cache->totpoint);
 		else
 			BLI_snprintf(cache->info, sizeof(cache->info), "No valid data to read!");
 		return;
 	}
 
-	if(cache->flag & PTCACHE_DISK_CACHE) {
-		if(pid->type == PTCACHE_TYPE_SMOKE_DOMAIN)
+	if (cache->flag & PTCACHE_DISK_CACHE) {
+		if (pid->type == PTCACHE_TYPE_SMOKE_DOMAIN)
 		{
 			int totpoint = pid->totpoint(pid->calldata, 0);
 
-			if(cache->totpoint > totpoint)
+			if (cache->totpoint > totpoint)
 				BLI_snprintf(mem_info, sizeof(mem_info), "%i cells + High Resolution cached", totpoint);
 			else
 				BLI_snprintf(mem_info, sizeof(mem_info), "%i cells cached", totpoint);
@@ -3238,8 +3258,8 @@ void BKE_ptcache_update_info(PTCacheID *pid)
 		else {
 			int cfra = cache->startframe;
 
-			for(; cfra<=cache->endframe; cfra++) {
-				if(BKE_ptcache_id_exist(pid, cfra))
+			for (; cfra<=cache->endframe; cfra++) {
+				if (BKE_ptcache_id_exist(pid, cfra))
 					totframes++;
 			}
 
@@ -3251,11 +3271,11 @@ void BKE_ptcache_update_info(PTCacheID *pid)
 		float bytes = 0.0f;
 		int i, mb;
 		
-		for(; pm; pm=pm->next) {
-			for(i=0; i<BPHYS_TOT_DATA; i++)
+		for (; pm; pm=pm->next) {
+			for (i=0; i<BPHYS_TOT_DATA; i++)
 				bytes += MEM_allocN_len(pm->data[i]);
 
-			for(extra=pm->extradata.first; extra; extra=extra->next) {
+			for (extra=pm->extradata.first; extra; extra=extra->next) {
 				bytes += MEM_allocN_len(extra->data);
 				bytes += sizeof(PTCacheExtra);
 			}
@@ -3273,10 +3293,10 @@ void BKE_ptcache_update_info(PTCacheID *pid)
 			mb ? "Mb" : "kb");
 	}
 
-	if(cache->flag & PTCACHE_OUTDATED) {
+	if (cache->flag & PTCACHE_OUTDATED) {
 		BLI_snprintf(cache->info, sizeof(cache->info), "%s, cache is outdated!", mem_info);
 	}
-	else if(cache->flag & PTCACHE_FRAMES_SKIPPED) {
+	else if (cache->flag & PTCACHE_FRAMES_SKIPPED) {
 		BLI_snprintf(cache->info, sizeof(cache->info), "%s, not exact since frame %i.", mem_info, cache->last_exact);
 	}
 	else {
@@ -3286,14 +3306,14 @@ void BKE_ptcache_update_info(PTCacheID *pid)
 
 void BKE_ptcache_validate(PointCache *cache, int framenr)
 {
-	if(cache) {
+	if (cache) {
 		cache->flag |= PTCACHE_SIMULATION_VALID;
 		cache->simframe = framenr;
 	}
 }
 void BKE_ptcache_invalidate(PointCache *cache)
 {
-	if(cache) {
+	if (cache) {
 		cache->flag &= ~PTCACHE_SIMULATION_VALID;
 		cache->simframe = 0;
 		cache->last_exact = MIN2(cache->startframe, 0);
diff --git a/source/blender/blenkernel/intern/property.c b/source/blender/blenkernel/intern/property.c
index 5668907..066de61 100644
--- a/source/blender/blenkernel/intern/property.c
+++ b/source/blender/blenkernel/intern/property.c
@@ -48,7 +48,7 @@
 void free_property(bProperty *prop)
 {
 	
-	if(prop->poin && prop->poin != &prop->data) MEM_freeN(prop->poin);
+	if (prop->poin && prop->poin != &prop->data) MEM_freeN(prop->poin);
 	MEM_freeN(prop);
 	
 }
@@ -57,7 +57,7 @@ void free_properties(ListBase *lb)
 {
 	bProperty *prop;
 	
-	while( (prop= lb->first) ) {
+	while ( (prop= lb->first) ) {
 		BLI_remlink(lb, prop);
 		free_property(prop);
 	}
@@ -68,7 +68,7 @@ bProperty *copy_property(bProperty *prop)
 	bProperty *propn;
 	
 	propn= MEM_dupallocN(prop);
-	if(prop->poin && prop->poin != &prop->data) {
+	if (prop->poin && prop->poin != &prop->data) {
 		propn->poin= MEM_dupallocN(prop->poin);
 	}
 	else propn->poin= &propn->data;
@@ -79,9 +79,9 @@ bProperty *copy_property(bProperty *prop)
 void copy_properties(ListBase *lbn, ListBase *lbo)
 {
 	bProperty *prop, *propn;
-	free_properties( lbn ); /* incase we are copying to an object with props */
+	free_properties(lbn); /* in case we are copying to an object with props */
 	prop= lbo->first;
-	while(prop) {
+	while (prop) {
 		propn= copy_property(prop);
 		BLI_addtail(lbn, propn);
 		prop= prop->next;
@@ -94,7 +94,7 @@ void init_property(bProperty *prop)
 {
 	/* also use when property changes type */
 	
-	if(prop->poin && prop->poin != &prop->data) MEM_freeN(prop->poin);
+	if (prop->poin && prop->poin != &prop->data) MEM_freeN(prop->poin);
 	prop->poin= NULL;
 	
 	prop->data= 0;
@@ -131,7 +131,7 @@ bProperty *new_property(int type)
 static bProperty *get_property__internal(bProperty *first, bProperty *self, const char *name)
 {
 	bProperty *p;
-	for(p= first; p; p= p->next) {
+	for (p= first; p; p= p->next) {
 		if (p!=self && (strcmp(p->name, name)==0))
 			return p;
 	}
@@ -142,21 +142,22 @@ void unique_property(bProperty *first, bProperty *prop, int force)
 	bProperty *p;
 
 	/* set the first if its not set */
-	if(first==NULL) {
+	if (first==NULL) {
 		first= prop;
-		while(first->prev) {
+		while (first->prev) {
 			first= first->prev;
 		}
 	}
 
-	if(force) {
+	if (force) {
 		/* change other names to make them unique */
-		while((p = get_property__internal(first, prop, prop->name))) {
+		while ((p = get_property__internal(first, prop, prop->name))) {
 			unique_property(first, p, 0);
 		}
-	}else {
+	}
+	else {
 		/* change our own name until its unique */
-		if(get_property__internal(first, prop, prop->name)) {
+		if (get_property__internal(first, prop, prop->name)) {
 			/* there is a collision */
 			char new_name[sizeof(prop->name)];
 			char base_name[sizeof(prop->name)];
@@ -165,7 +166,7 @@ void unique_property(bProperty *first, bProperty *prop, int force)
 
 			/* strip numbers */
 			BLI_strncpy(base_name, prop->name, sizeof(base_name));
-			for(i= strlen(base_name)-1; (i>=0 && isdigit(base_name[i])); i--) {
+			for (i= strlen(base_name)-1; (i>=0 && isdigit(base_name[i])); i--) {
 				base_name[i]= '\0';
 			}
 			i= 0;
@@ -174,7 +175,7 @@ void unique_property(bProperty *first, bProperty *prop, int force)
 				BLI_snprintf(num, sizeof(num), "%d", i++);
 				BLI_strncpy(new_name, base_name, sizeof(prop->name) - strlen(num));
 				strcat(new_name, num);
-			} while(get_property__internal(first, prop, new_name));
+			} while (get_property__internal(first, prop, new_name));
 
 			BLI_strncpy(prop->name, new_name, sizeof(prop->name));
 		}
@@ -190,7 +191,7 @@ void set_ob_property(Object *ob, bProperty *propc)
 {
 	bProperty *prop;
 	prop= get_ob_property(ob, propc->name);
-	if(prop) {
+	if (prop) {
 		free_property(prop);
 		BLI_remlink(&ob->prop, prop);
 	}
@@ -207,12 +208,12 @@ int compare_property(bProperty *prop, const char *str)
 	
 	switch(prop->type) {
 	case GPROP_BOOL:
-		if(BLI_strcasecmp(str, "true")==0) {
-			if(prop->data==1) return 0;
+		if (BLI_strcasecmp(str, "true")==0) {
+			if (prop->data==1) return 0;
 			else return 1;
 		}
-		else if(BLI_strcasecmp(str, "false")==0) {
-			if(prop->data==0) return 0;
+		else if (BLI_strcasecmp(str, "false")==0) {
+			if (prop->data==0) return 0;
 			else return 1;
 		}
 		/* no break, do GPROP_int too! */
@@ -226,8 +227,8 @@ int compare_property(bProperty *prop, const char *str)
 		// function isn't used currently
 		fvalue= *((float *)&prop->data);
 		ftest= (float)atof(str);
-		if( fvalue > ftest) return 1;
-		else if( fvalue < ftest) return -1;
+		if ( fvalue > ftest) return 1;
+		else if ( fvalue < ftest) return -1;
 		return 0;
 
 	case GPROP_STRING:
@@ -243,8 +244,8 @@ void set_property(bProperty *prop, const char *str)
 
 	switch(prop->type) {
 	case GPROP_BOOL:
-		if(BLI_strcasecmp(str, "true")==0) prop->data= 1;
-		else if(BLI_strcasecmp(str, "false")==0) prop->data= 0;
+		if (BLI_strcasecmp(str, "true")==0) prop->data= 1;
+		else if (BLI_strcasecmp(str, "false")==0) prop->data= 0;
 		else prop->data= (atoi(str)!=0);
 		break;
 	case GPROP_INT:
@@ -285,7 +286,7 @@ void set_property_valstr(bProperty *prop, char *str)
 {
 //	extern int Gdfra;		/* sector.c */
 
-	if(str == NULL) return;
+	if (str == NULL) return;
 
 	switch(prop->type) {
 	case GPROP_BOOL:
diff --git a/source/blender/blenkernel/intern/report.c b/source/blender/blenkernel/intern/report.c
index ffa9e02..b3e288d 100644
--- a/source/blender/blenkernel/intern/report.c
+++ b/source/blender/blenkernel/intern/report.c
@@ -37,7 +37,6 @@
 #include "BKE_report.h"
 #include "BKE_global.h" /* G.background only */
 
-
 #include <stdarg.h>
 #include <stdio.h>
 #include <string.h>
@@ -59,7 +58,7 @@ static const char *report_type_str(int type)
 
 void BKE_reports_init(ReportList *reports, int flag)
 {
-	if(!reports)
+	if (!reports)
 		return;
 
 	memset(reports, 0, sizeof(ReportList));
@@ -73,7 +72,7 @@ void BKE_reports_clear(ReportList *reports)
 {
 	Report *report, *report_next;
 
-	if(!reports)
+	if (!reports)
 		return;
 
 	report= reports->list.first;
@@ -95,12 +94,12 @@ void BKE_report(ReportList *reports, ReportType type, const char *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 */
-	if(G.background || !reports || ((reports->flag & RPT_PRINT) && (type >= reports->printlevel))) {
+	if (G.background || !reports || ((reports->flag & RPT_PRINT) && (type >= reports->printlevel))) {
 		printf("%s: %s\n", report_type_str(type), message);
 		fflush(stdout); /* this ensures the message is printed before a crash */
 	}
 
-	if(reports && (reports->flag & RPT_STORE) && (type >= reports->storelevel)) {
+	if (reports && (reports->flag & RPT_STORE) && (type >= reports->storelevel)) {
 		char *message_alloc;
 		report= MEM_callocN(sizeof(Report), "Report");
 		report->type= type;
@@ -121,7 +120,7 @@ void BKE_reportf(ReportList *reports, ReportType type, const char *format, ...)
 	Report *report;
 	va_list args;
 
-	if(G.background || !reports || ((reports->flag & RPT_PRINT) && (type >= reports->printlevel))) {
+	if (G.background || !reports || ((reports->flag & RPT_PRINT) && (type >= reports->printlevel))) {
 		va_start(args, format);
 		vprintf(format, args);
 		va_end(args);
@@ -129,7 +128,7 @@ void BKE_reportf(ReportList *reports, ReportType type, const char *format, ...)
 		fflush(stdout); /* this ensures the message is printed before a crash */
 	}
 
-	if(reports && (reports->flag & RPT_STORE) && (type >= reports->storelevel)) {
+	if (reports && (reports->flag & RPT_STORE) && (type >= reports->storelevel)) {
 		report= MEM_callocN(sizeof(Report), "Report");
 
 		ds= BLI_dynstr_new();
@@ -153,10 +152,10 @@ void BKE_reports_prepend(ReportList *reports, const char *prepend)
 	Report *report;
 	DynStr *ds;
 
-	if(!reports)
+	if (!reports)
 		return;
 
-	for(report=reports->list.first; report; report=report->next) {
+	for (report=reports->list.first; report; report=report->next) {
 		ds= BLI_dynstr_new();
 
 		BLI_dynstr_append(ds, prepend);
@@ -176,10 +175,10 @@ void BKE_reports_prependf(ReportList *reports, const char *prepend, ...)
 	DynStr *ds;
 	va_list args;
 
-	if(!reports)
+	if (!reports)
 		return;
 
-	for(report=reports->list.first; report; report=report->next) {
+	for (report=reports->list.first; report; report=report->next) {
 		ds= BLI_dynstr_new();
 		va_start(args, prepend);
 		BLI_dynstr_vappendf(ds, prepend, args);
@@ -197,7 +196,7 @@ void BKE_reports_prependf(ReportList *reports, const char *prepend, ...)
 
 ReportType BKE_report_print_level(ReportList *reports)
 {
-	if(!reports)
+	if (!reports)
 		return RPT_ERROR;
 
 	return reports->printlevel;
@@ -205,7 +204,7 @@ ReportType BKE_report_print_level(ReportList *reports)
 
 void BKE_report_print_level_set(ReportList *reports, ReportType level)
 {
-	if(!reports)
+	if (!reports)
 		return;
 
 	reports->printlevel= level;
@@ -213,7 +212,7 @@ void BKE_report_print_level_set(ReportList *reports, ReportType level)
 
 ReportType BKE_report_store_level(ReportList *reports)
 {
-	if(!reports)
+	if (!reports)
 		return RPT_ERROR;
 
 	return reports->storelevel;
@@ -221,7 +220,7 @@ ReportType BKE_report_store_level(ReportList *reports)
 
 void BKE_report_store_level_set(ReportList *reports, ReportType level)
 {
-	if(!reports)
+	if (!reports)
 		return;
 
 	reports->storelevel= level;
@@ -233,12 +232,12 @@ char *BKE_reports_string(ReportList *reports, ReportType level)
 	DynStr *ds;
 	char *cstring;
 
-	if(!reports || !reports->list.first)
+	if (!reports || !reports->list.first)
 		return NULL;
 
 	ds= BLI_dynstr_new();
-	for(report=reports->list.first; report; report=report->next)
-		if(report->type >= level)
+	for (report=reports->list.first; report; report=report->next)
+		if (report->type >= level)
 			BLI_dynstr_appendf(ds, "%s: %s\n", report->typestr, report->message);
 
 	if (BLI_dynstr_get_len(ds))
@@ -257,19 +256,31 @@ void BKE_reports_print(ReportList *reports, ReportType level)
 	if (cstring == NULL)
 		return;
 	
-	printf("%s", cstring);
+	puts(cstring);
 	fflush(stdout);
 	MEM_freeN(cstring);
 }
 
 Report *BKE_reports_last_displayable(ReportList *reports)
 {
-	Report *report=NULL;
+	Report *report;
 	
-	for (report= (Report *)reports->list.last; report; report=report->prev) {
+	for (report= reports->list.last; report; report=report->prev) {
 		if (ELEM3(report->type, RPT_ERROR, RPT_WARNING, RPT_INFO))
 			return report;
 	}
 	
 	return NULL;
 }
+
+int BKE_reports_contain(ReportList *reports, ReportType level)
+{
+	Report *report;
+	if (reports != NULL) {
+		for (report=reports->list.first; report; report=report->next)
+			if (report->type >= level)
+				return TRUE;
+	}
+	return FALSE;
+}
+
diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c
index 92dfe90..8123cbf 100644
--- a/source/blender/blenkernel/intern/sca.c
+++ b/source/blender/blenkernel/intern/sca.c
@@ -54,8 +54,8 @@
 
 void free_sensor(bSensor *sens)
 {
-	if(sens->links) MEM_freeN(sens->links);
-	if(sens->data) MEM_freeN(sens->data);
+	if (sens->links) MEM_freeN(sens->links);
+	if (sens->data) MEM_freeN(sens->data);
 	MEM_freeN(sens);
 	
 }
@@ -64,7 +64,7 @@ void free_sensors(ListBase *lb)
 {
 	bSensor *sens;
 	
-	while((sens= lb->first)) {
+	while ((sens= lb->first)) {
 		BLI_remlink(lb, sens);
 		free_sensor(sens);
 	}
@@ -76,11 +76,11 @@ bSensor *copy_sensor(bSensor *sens)
 	
 	sensn= MEM_dupallocN(sens);
 	sensn->flag |= SENS_NEW;
-	if(sens->data) {
+	if (sens->data) {
 		sensn->data= MEM_dupallocN(sens->data);
 	}
 
-	if(sens->links) sensn->links= MEM_dupallocN(sens->links);
+	if (sens->links) sensn->links= MEM_dupallocN(sens->links);
 	
 	return sensn;
 }
@@ -91,7 +91,7 @@ void copy_sensors(ListBase *lbn, ListBase *lbo)
 	
 	lbn->first= lbn->last= NULL;
 	sens= lbo->first;
-	while(sens) {
+	while (sens) {
 		sensn= copy_sensor(sens);
 		BLI_addtail(lbn, sensn);
 		sens= sens->next;
@@ -106,7 +106,7 @@ void init_sensor(bSensor *sens)
 	bJoystickSensor *js;
 	bRaySensor *rs;
 	
-	if(sens->data) MEM_freeN(sens->data);
+	if (sens->data) MEM_freeN(sens->data);
 	sens->data= NULL;
 	sens->pulse = 0;
 	
@@ -196,9 +196,9 @@ void unlink_controller(bController *cont)
 	
 	/* check for controller pointers in sensors */
 	ob= G.main->object.first;
-	while(ob) {
+	while (ob) {
 		sens= ob->sensors.first;
-		while(sens) {
+		while (sens) {
 			unlink_logicbricks((void **)&cont, (void ***)&(sens->links), &sens->totlinks);
 			sens= sens->next;
 		}
@@ -216,10 +216,10 @@ void unlink_controllers(ListBase *lb)
 
 void free_controller(bController *cont)
 {
-	if(cont->links) MEM_freeN(cont->links);
+	if (cont->links) MEM_freeN(cont->links);
 
 	/* the controller itself */
-	if(cont->data) MEM_freeN(cont->data);
+	if (cont->data) MEM_freeN(cont->data);
 	MEM_freeN(cont);
 	
 }
@@ -228,9 +228,9 @@ void free_controllers(ListBase *lb)
 {
 	bController *cont;
 	
-	while((cont= lb->first)) {
+	while ((cont= lb->first)) {
 		BLI_remlink(lb, cont);
-		if(cont->slinks) MEM_freeN(cont->slinks);
+		if (cont->slinks) MEM_freeN(cont->slinks);
 		free_controller(cont);
 	}
 }
@@ -241,11 +241,11 @@ bController *copy_controller(bController *cont)
 	
 	cont->mynew=contn= MEM_dupallocN(cont);
 	contn->flag |= CONT_NEW;
-	if(cont->data) {
+	if (cont->data) {
 		contn->data= MEM_dupallocN(cont->data);
 	}
 
-	if(cont->links) contn->links= MEM_dupallocN(cont->links);
+	if (cont->links) contn->links= MEM_dupallocN(cont->links);
 	contn->slinks= NULL;
 	contn->totslinks= 0;
 	
@@ -258,7 +258,7 @@ void copy_controllers(ListBase *lbn, ListBase *lbo)
 	
 	lbn->first= lbn->last= NULL;
 	cont= lbo->first;
-	while(cont) {
+	while (cont) {
 		contn= copy_controller(cont);
 		BLI_addtail(lbn, contn);
 		cont= cont->next;
@@ -269,7 +269,7 @@ void init_controller(bController *cont)
 {
 	/* also use when controller changes type, leave actuators... */
 	
-	if(cont->data) MEM_freeN(cont->data);
+	if (cont->data) MEM_freeN(cont->data);
 	cont->data= NULL;
 	
 	switch(cont->type) {
@@ -307,9 +307,9 @@ void unlink_actuator(bActuator *act)
 	
 	/* check for actuator pointers in controllers */
 	ob= G.main->object.first;
-	while(ob) {
+	while (ob) {
 		cont= ob->controllers.first;
-		while(cont) {
+		while (cont) {
 			unlink_logicbricks((void **)&act, (void ***)&(cont->links), &cont->totlinks);
 			cont= cont->next;
 		}
@@ -329,11 +329,11 @@ void free_actuator(bActuator *act)
 {
 	bSoundActuator *sa;
 
-	if(act->data) {
+	if (act->data) {
 		switch (act->type) {
 		case ACT_SOUND:
 			sa = (bSoundActuator *) act->data;
-			if(sa->sound)
+			if (sa->sound)
 				id_us_min((ID *) sa->sound);
 			break;
 		}
@@ -347,7 +347,7 @@ void free_actuators(ListBase *lb)
 {
 	bActuator *act;
 	
-	while((act= lb->first)) {
+	while ((act= lb->first)) {
 		BLI_remlink(lb, act);
 		free_actuator(act);
 	}
@@ -360,14 +360,14 @@ bActuator *copy_actuator(bActuator *act)
 	
 	act->mynew=actn= MEM_dupallocN(act);
 	actn->flag |= ACT_NEW;
-	if(act->data) {
+	if (act->data) {
 		actn->data= MEM_dupallocN(act->data);
 	}
 	
 	switch (act->type) {
 		case ACT_SOUND:
 			sa= (bSoundActuator *)act->data;
-			if(sa->sound)
+			if (sa->sound)
 				id_us_plus((ID *) sa->sound);
 			break;
 	}
@@ -380,7 +380,7 @@ void copy_actuators(ListBase *lbn, ListBase *lbo)
 	
 	lbn->first= lbn->last= NULL;
 	act= lbo->first;
-	while(act) {
+	while (act) {
 		actn= copy_actuator(act);
 		BLI_addtail(lbn, actn);
 		act= act->next;
@@ -395,8 +395,9 @@ void init_actuator(bActuator *act)
 	bRandomActuator *ra;
 	bSoundActuator *sa;
 	bSteeringActuator *sta;
+	bArmatureActuator *arma;
 	
-	if(act->data) MEM_freeN(act->data);
+	if (act->data) MEM_freeN(act->data);
 	act->data= NULL;
 	
 	switch(act->type) {
@@ -468,6 +469,8 @@ void init_actuator(bActuator *act)
 		break;
 	case ACT_ARMATURE:
 		act->data = MEM_callocN(sizeof( bArmatureActuator ), "armature act");
+		arma = act->data;
+		arma->influence = 1.f;
 		break;
 	case ACT_STEERING:
 		act->data = MEM_callocN(sizeof( bSteeringActuator), "steering act");
@@ -509,18 +512,18 @@ void clear_sca_new_poins_ob(Object *ob)
 	bActuator *act;
 	
 	sens= ob->sensors.first;
-	while(sens) {
+	while (sens) {
 		sens->flag &= ~SENS_NEW;
 		sens= sens->next;
 	}
 	cont= ob->controllers.first;
-	while(cont) {
+	while (cont) {
 		cont->mynew= NULL;
 		cont->flag &= ~CONT_NEW;
 		cont= cont->next;
 	}
 	act= ob->actuators.first;
-	while(act) {
+	while (act) {
 		act->mynew= NULL;
 		act->flag &= ~ACT_NEW;
 		act= act->next;
@@ -532,7 +535,7 @@ void clear_sca_new_poins(void)
 	Object *ob;
 	
 	ob= G.main->object.first;
-	while(ob) {
+	while (ob) {
 		clear_sca_new_poins_ob(ob);
 		ob= ob->id.next;	
 	}
@@ -546,10 +549,10 @@ void set_sca_new_poins_ob(Object *ob)
 	int a;
 	
 	sens= ob->sensors.first;
-	while(sens) {
-		if(sens->flag & SENS_NEW) {
-			for(a=0; a<sens->totlinks; a++) {
-				if(sens->links[a] && sens->links[a]->mynew)
+	while (sens) {
+		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;
 			}
 		}
@@ -557,10 +560,10 @@ void set_sca_new_poins_ob(Object *ob)
 	}
 
 	cont= ob->controllers.first;
-	while(cont) {
-		if(cont->flag & CONT_NEW) {
-			for(a=0; a<cont->totlinks; a++) {
-				if( cont->links[a] && cont->links[a]->mynew)
+	while (cont) {
+		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;
 			}
 		}
@@ -569,42 +572,42 @@ void set_sca_new_poins_ob(Object *ob)
 	
 	
 	act= ob->actuators.first;
-	while(act) {
-		if(act->flag & ACT_NEW) {
-			if(act->type==ACT_EDIT_OBJECT) {
+	while (act) {
+		if (act->flag & ACT_NEW) {
+			if (act->type==ACT_EDIT_OBJECT) {
 				bEditObjectActuator *eoa= act->data;
 				ID_NEW(eoa->ob);
 			}
-			else if(act->type==ACT_SCENE) {
+			else if (act->type==ACT_SCENE) {
 				bSceneActuator *sca= act->data;
 				ID_NEW(sca->camera);
 			}
-			else if(act->type==ACT_CAMERA) {
+			else if (act->type==ACT_CAMERA) {
 				bCameraActuator *ca= act->data;
 				ID_NEW(ca->ob);
 			}
-			else if(act->type==ACT_OBJECT) {
+			else if (act->type==ACT_OBJECT) {
 				bObjectActuator *oa= act->data;
 				ID_NEW(oa->reference);
 			}
-			else if(act->type==ACT_MESSAGE) {
+			else if (act->type==ACT_MESSAGE) {
 				bMessageActuator *ma= act->data;
 				ID_NEW(ma->toObject);
 			}
-			else if(act->type==ACT_PARENT) {
+			else if (act->type==ACT_PARENT) {
 				bParentActuator *para = act->data;
 				ID_NEW(para->ob);
 			}
-			else if(act->type==ACT_ARMATURE) {
+			else if (act->type==ACT_ARMATURE) {
 				bArmatureActuator *aa = act->data;
 				ID_NEW(aa->target);
 				ID_NEW(aa->subtarget);
 			}
-			else if(act->type==ACT_PROPERTY) {
+			else if (act->type==ACT_PROPERTY) {
 				bPropertyActuator *pa= act->data;
 				ID_NEW(pa->ob);
 			}
-			else if(act->type==ACT_STEERING) {
+			else if (act->type==ACT_STEERING) {
 				bSteeringActuator *sta = act->data;
 				ID_NEW(sta->navmesh);
 				ID_NEW(sta->target);
@@ -620,7 +623,7 @@ void set_sca_new_poins(void)
 	Object *ob;
 	
 	ob= G.main->object.first;
-	while(ob) {
+	while (ob) {
 		set_sca_new_poins_ob(ob);
 		ob= ob->id.next;	
 	}
@@ -643,41 +646,41 @@ void sca_remove_ob_poin(Object *obt, Object *ob)
 
 
 	sens= obt->sensors.first;
-	while(sens) {
+	while (sens) {
 		switch(sens->type) {
 		case SENS_MESSAGE:
 			ms= sens->data;
-			if(ms->fromObject==ob) ms->fromObject= NULL;
+			if (ms->fromObject==ob) ms->fromObject= NULL;
 		}
 		sens= sens->next;
 	}
 
 	act= obt->actuators.first;
-	while(act) {
+	while (act) {
 		switch(act->type) {
 		case ACT_CAMERA:
 			ca= act->data;
-			if(ca->ob==ob) ca->ob= NULL;
+			if (ca->ob==ob) ca->ob= NULL;
 			break;
 		case ACT_OBJECT:
 			oa= act->data;
-			if(oa->reference==ob) oa->reference= NULL;
+			if (oa->reference==ob) oa->reference= NULL;
 			break;
 		case ACT_PROPERTY:
 			pa= act->data;
-			if(pa->ob==ob) pa->ob= NULL;
+			if (pa->ob==ob) pa->ob= NULL;
 			break;
 		case ACT_SCENE:
 			sa= act->data;
-			if(sa->camera==ob) sa->camera= NULL;
+			if (sa->camera==ob) sa->camera= NULL;
 			break;
 		case ACT_EDIT_OBJECT:
 			eoa= act->data;
-			if(eoa->ob==ob) eoa->ob= NULL;
+			if (eoa->ob==ob) eoa->ob= NULL;
 			break;
 		case ACT_MESSAGE:
 			ma= act->data;
-			if(ma->toObject==ob) ma->toObject= NULL;
+			if (ma->toObject==ob) ma->toObject= NULL;
 			break;
 		case ACT_PARENT:
 			para = act->data;
@@ -707,14 +710,14 @@ void sca_move_sensor(bSensor *sens_to_move, Object *ob, int move_up)
 
 	/* make sure this sensor belongs to this object */
 	sens= ob->sensors.first;
-	while(sens) {
-		if(sens == sens_to_move) break;
+	while (sens) {
+		if (sens == sens_to_move) break;
 		sens= sens->next;
 	}
-	if(!sens) return;
+	if (!sens) return;
 
 	/* move up */
-	if( val==1 && sens->prev) {
+	if ( val==1 && sens->prev) {
 		for (tmp=sens->prev; tmp; tmp=tmp->prev) {
 			if (tmp->flag & SENS_VISIBLE)
 				break;
@@ -725,7 +728,7 @@ void sca_move_sensor(bSensor *sens_to_move, Object *ob, int move_up)
 		}
 	}
 	/* move down */
-	else if( val==2 && sens->next) {
+	else if ( val==2 && sens->next) {
 		for (tmp=sens->next; tmp; tmp=tmp->next) {
 			if (tmp->flag & SENS_VISIBLE)
 				break;
@@ -746,18 +749,18 @@ void sca_move_controller(bController *cont_to_move, Object *ob, int move_up)
 
 	/* make sure this controller belongs to this object */
 	cont= ob->controllers.first;
-	while(cont) {
-		if(cont == cont_to_move) break;
+	while (cont) {
+		if (cont == cont_to_move) break;
 		cont= cont->next;
 	}
-	if(!cont) return;
+	if (!cont) return;
 
 	/* move up */
-	if( val==1 && cont->prev) {
+	if ( val==1 && cont->prev) {
 		/* locate the controller that has the same state mask but is earlier in the list */
 		tmp = cont->prev;
-		while(tmp) {
-			if(tmp->state_mask & cont->state_mask) 
+		while (tmp) {
+			if (tmp->state_mask & cont->state_mask) 
 				break;
 			tmp = tmp->prev;
 		}
@@ -768,10 +771,10 @@ void sca_move_controller(bController *cont_to_move, Object *ob, int move_up)
 	}
 
 	/* move down */
-	else if( val==2 && cont->next) {
+	else if ( val==2 && cont->next) {
 		tmp = cont->next;
-		while(tmp) {
-			if(tmp->state_mask & cont->state_mask) 
+		while (tmp) {
+			if (tmp->state_mask & cont->state_mask) 
 				break;
 			tmp = tmp->next;
 		}
@@ -789,14 +792,14 @@ void sca_move_actuator(bActuator *act_to_move, Object *ob, int move_up)
 
 	/* make sure this actuator belongs to this object */
 	act= ob->actuators.first;
-	while(act) {
-		if(act == act_to_move) break;
+	while (act) {
+		if (act == act_to_move) break;
 		act= act->next;
 	}
-	if(!act) return;
+	if (!act) return;
 
 	/* move up */
-	if( val==1 && act->prev) {
+	if ( val==1 && act->prev) {
 		/* locate the first visible actuators before this one */
 		for (tmp = act->prev; tmp; tmp=tmp->prev) {
 			if (tmp->flag & ACT_VISIBLE)
@@ -808,7 +811,7 @@ void sca_move_actuator(bActuator *act_to_move, Object *ob, int move_up)
 		}
 	}
 	/* move down */
-	else if( val==2 && act->next) {
+	else if ( val==2 && act->next) {
 		/* locate the first visible actuators after this one */
 		for (tmp=act->next; tmp; tmp=tmp->next) {
 			if (tmp->flag & ACT_VISIBLE)
@@ -844,7 +847,7 @@ void link_logicbricks(void **poin, void ***ppoin, short *tot, short size)
 		}
 		(*ppoin)[ibrick] = *poin;
 
-		if(old_links) MEM_freeN(old_links);
+		if (old_links) MEM_freeN(old_links);
 	}
 	else {
 		(*tot) = 1;
@@ -859,14 +862,14 @@ void unlink_logicbricks(void **poin, void ***ppoin, short *tot)
 
 	removed= 0;
 	for (ibrick=0; ibrick < *tot; ibrick++) {
-		if(removed) (*ppoin)[ibrick - removed] = (*ppoin)[ibrick];
-		else if((*ppoin)[ibrick] == *poin) removed = 1;
+		if (removed) (*ppoin)[ibrick - removed] = (*ppoin)[ibrick];
+		else if ((*ppoin)[ibrick] == *poin) removed = 1;
 	}
 
 	if (removed) {
 		(*tot) --;
 
-		if(*tot == 0) {
+		if (*tot == 0) {
 			MEM_freeN(*ppoin);
 			(*ppoin)= NULL;
 		}
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index c8ec71d..01ab574 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -86,12 +86,12 @@
 void free_avicodecdata(AviCodecData *acd)
 {
 	if (acd) {
-		if (acd->lpFormat){
+		if (acd->lpFormat) {
 			MEM_freeN(acd->lpFormat);
 			acd->lpFormat = NULL;
 			acd->cbFormat = 0;
 		}
-		if (acd->lpParms){
+		if (acd->lpParms) {
 			MEM_freeN(acd->lpParms);
 			acd->lpParms = NULL;
 			acd->cbParms = 0;
@@ -102,7 +102,7 @@ void free_avicodecdata(AviCodecData *acd)
 void free_qtcodecdata(QuicktimeCodecData *qcd)
 {
 	if (qcd) {
-		if (qcd->cdParms){
+		if (qcd->cdParms) {
 			MEM_freeN(qcd->cdParms);
 			qcd->cdParms = NULL;
 			qcd->cdSize = 0;
@@ -116,13 +116,19 @@ Scene *copy_scene(Scene *sce, int type)
 	ToolSettings *ts;
 	Base *base, *obase;
 	
-	if(type == SCE_COPY_EMPTY) {
+	if (type == SCE_COPY_EMPTY) {
 		ListBase lb;
 		scen= add_scene(sce->id.name+2);
 		
 		lb= scen->r.layers;
 		scen->r= sce->r;
 		scen->r.layers= lb;
+		scen->unit= sce->unit;
+		scen->physics_settings= sce->physics_settings;
+		scen->gm= sce->gm;
+		scen->audio= sce->audio;
+
+		MEM_freeN(scen->toolsettings);
 	}
 	else {
 		scen= copy_libblock(&sce->id);
@@ -137,72 +143,73 @@ Scene *copy_scene(Scene *sce, int type)
 		scen->ed= NULL;
 		scen->theDag= NULL;
 		scen->obedit= NULL;
-		scen->toolsettings= MEM_dupallocN(sce->toolsettings);
 		scen->stats= NULL;
 		scen->fps_info= NULL;
 
-		ts= scen->toolsettings;
-		if(ts) {
-			if(ts->vpaint) {
-				ts->vpaint= MEM_dupallocN(ts->vpaint);
-				ts->vpaint->paintcursor= NULL;
-				ts->vpaint->vpaint_prev= NULL;
-				ts->vpaint->wpaint_prev= NULL;
-				copy_paint(&ts->vpaint->paint, &ts->vpaint->paint);
-			}
-			if(ts->wpaint) {
-				ts->wpaint= MEM_dupallocN(ts->wpaint);
-				ts->wpaint->paintcursor= NULL;
-				ts->wpaint->vpaint_prev= NULL;
-				ts->wpaint->wpaint_prev= NULL;
-				copy_paint(&ts->wpaint->paint, &ts->wpaint->paint);
-			}
-			if(ts->sculpt) {
-				ts->sculpt= MEM_dupallocN(ts->sculpt);
-				copy_paint(&ts->sculpt->paint, &ts->sculpt->paint);
-			}
-
-			copy_paint(&ts->imapaint.paint, &ts->imapaint.paint);
-			ts->imapaint.paintcursor= NULL;
-
-			ts->particle.paintcursor= NULL;
-		}
-		
 		BLI_duplicatelist(&(scen->markers), &(sce->markers));
 		BLI_duplicatelist(&(scen->transform_spaces), &(sce->transform_spaces));
 		BLI_duplicatelist(&(scen->r.layers), &(sce->r.layers));
 		BKE_keyingsets_copy(&(scen->keyingsets), &(sce->keyingsets));
 
-		if(sce->nodetree) {
+		if (sce->nodetree) {
 			scen->nodetree= ntreeCopyTree(sce->nodetree); /* copies actions */
 			ntreeSwitchID(scen->nodetree, &sce->id, &scen->id);
 		}
 
 		obase= sce->base.first;
 		base= scen->base.first;
-		while(base) {
+		while (base) {
 			id_us_plus(&base->object->id);
-			if(obase==sce->basact) scen->basact= base;
+			if (obase==sce->basact) scen->basact= base;
 	
 			obase= obase->next;
 			base= base->next;
 		}
 	}
+
+	/* tool settings */
+	scen->toolsettings= MEM_dupallocN(sce->toolsettings);
+
+	ts= scen->toolsettings;
+	if (ts) {
+		if (ts->vpaint) {
+			ts->vpaint= MEM_dupallocN(ts->vpaint);
+			ts->vpaint->paintcursor= NULL;
+			ts->vpaint->vpaint_prev= NULL;
+			ts->vpaint->wpaint_prev= NULL;
+			copy_paint(&ts->vpaint->paint, &ts->vpaint->paint);
+		}
+		if (ts->wpaint) {
+			ts->wpaint= MEM_dupallocN(ts->wpaint);
+			ts->wpaint->paintcursor= NULL;
+			ts->wpaint->vpaint_prev= NULL;
+			ts->wpaint->wpaint_prev= NULL;
+			copy_paint(&ts->wpaint->paint, &ts->wpaint->paint);
+		}
+		if (ts->sculpt) {
+			ts->sculpt= MEM_dupallocN(ts->sculpt);
+			copy_paint(&ts->sculpt->paint, &ts->sculpt->paint);
+		}
+
+		copy_paint(&ts->imapaint.paint, &ts->imapaint.paint);
+		ts->imapaint.paintcursor= NULL;
+		ts->particle.paintcursor= NULL;
+	}
 	
 	/* make a private copy of the avicodecdata */
-	if(sce->r.avicodecdata) {
+	if (sce->r.avicodecdata) {
 		scen->r.avicodecdata = MEM_dupallocN(sce->r.avicodecdata);
 		scen->r.avicodecdata->lpFormat = MEM_dupallocN(scen->r.avicodecdata->lpFormat);
 		scen->r.avicodecdata->lpParms = MEM_dupallocN(scen->r.avicodecdata->lpParms);
 	}
 	
 	/* make a private copy of the qtcodecdata */
-	if(sce->r.qtcodecdata) {
+	if (sce->r.qtcodecdata) {
 		scen->r.qtcodecdata = MEM_dupallocN(sce->r.qtcodecdata);
 		scen->r.qtcodecdata->cdParms = MEM_dupallocN(scen->r.qtcodecdata->cdParms);
 	}
 	
-	if(sce->r.ffcodecdata.properties) { /* intentionally check scen not sce. */
+	if (sce->r.ffcodecdata.properties) { /* intentionally check scen not sce. */
 		scen->r.ffcodecdata.properties= IDP_CopyProperty(sce->r.ffcodecdata.properties);
 	}
 
@@ -210,7 +217,7 @@ Scene *copy_scene(Scene *sce, int type)
 	 * are done outside of blenkernel with ED_objects_single_users! */
 
 	/*  camera */
-	if(type == SCE_COPY_LINK_DATA || type == SCE_COPY_FULL) {
+	if (type == SCE_COPY_LINK_DATA || type == SCE_COPY_FULL) {
 		ID_NEW(scen->camera);
 	}
 	
@@ -218,15 +225,15 @@ Scene *copy_scene(Scene *sce, int type)
 	sound_create_scene(scen);
 
 	/* world */
-	if(type == SCE_COPY_FULL) {
+	if (type == SCE_COPY_FULL) {
 		BKE_copy_animdata_id_action((ID *)scen);
-		if(scen->world) {
+		if (scen->world) {
 			id_us_plus((ID *)scen->world);
 			scen->world= copy_world(scen->world);
 			BKE_copy_animdata_id_action((ID *)scen->world);
 		}
 
-		if(sce->ed) {
+		if (sce->ed) {
 			scen->ed= MEM_callocN( sizeof(Editing), "addseq");
 			scen->ed->seqbasep= &scen->ed->seqbase;
 			seqbase_dupli_recursive(sce, scen, &scen->ed->seqbase, &sce->ed->seqbase, SEQ_DUPE_ALL);
@@ -242,15 +249,15 @@ void free_scene(Scene *sce)
 	Base *base;
 
 	base= sce->base.first;
-	while(base) {
+	while (base) {
 		base->object->id.us--;
 		base= base->next;
 	}
 	/* do not free objects! */
 	
-	if(sce->gpd) {
+	if (sce->gpd) {
 #if 0   // removed since this can be invalid memory when freeing everything
-		// since the grease pencil data is free'd before the scene.
+		// since the grease pencil data is freed before the scene.
 		// since grease pencil data is not (yet?), shared between objects
 		// its probably safe not to do this, some save and reload will free this.
 		sce->gpd->id.us--;
@@ -284,20 +291,20 @@ void free_scene(Scene *sce)
 	BLI_freelistN(&sce->transform_spaces);
 	BLI_freelistN(&sce->r.layers);
 	
-	if(sce->toolsettings) {
-		if(sce->toolsettings->vpaint) {
+	if (sce->toolsettings) {
+		if (sce->toolsettings->vpaint) {
 			free_paint(&sce->toolsettings->vpaint->paint);
 			MEM_freeN(sce->toolsettings->vpaint);
 		}
-		if(sce->toolsettings->wpaint) {
+		if (sce->toolsettings->wpaint) {
 			free_paint(&sce->toolsettings->wpaint->paint);
 			MEM_freeN(sce->toolsettings->wpaint);
 		}
-		if(sce->toolsettings->sculpt) {
+		if (sce->toolsettings->sculpt) {
 			free_paint(&sce->toolsettings->sculpt->paint);
 			MEM_freeN(sce->toolsettings->sculpt);
 		}
-		if(sce->toolsettings->uvsculpt) {
+		if (sce->toolsettings->uvsculpt) {
 			free_paint(&sce->toolsettings->uvsculpt->paint);
 			MEM_freeN(sce->toolsettings->uvsculpt);
 		}
@@ -312,14 +319,14 @@ void free_scene(Scene *sce)
 		MEM_freeN(sce->theDag);
 	}
 	
-	if(sce->nodetree) {
+	if (sce->nodetree) {
 		ntreeFreeTree(sce->nodetree);
 		MEM_freeN(sce->nodetree);
 	}
 
-	if(sce->stats)
+	if (sce->stats)
 		MEM_freeN(sce->stats);
-	if(sce->fps_info)
+	if (sce->fps_info)
 		MEM_freeN(sce->fps_info);
 
 	sound_destroy_scene(sce);
@@ -396,10 +403,10 @@ Scene *add_scene(const char *name)
 	sce->r.simplify_shadowsamples= 16;
 	sce->r.simplify_aosss= 1.0f;
 
-	sce->r.border.xmin= 0.0f;
-	sce->r.border.ymin= 0.0f;
-	sce->r.border.xmax= 1.0f;
-	sce->r.border.ymax= 1.0f;
+	sce->r.border.xmin = 0.0f;
+	sce->r.border.ymin = 0.0f;
+	sce->r.border.xmax = 1.0f;
+	sce->r.border.ymax = 1.0f;
 	
 	sce->toolsettings = MEM_callocN(sizeof(struct ToolSettings),"Tool Settings Struct");
 	sce->toolsettings->cornertype=1;
@@ -411,7 +418,6 @@ Scene *add_scene(const char *name)
 	sce->toolsettings->segments = 32;
 	sce->toolsettings->rings = 32;
 	sce->toolsettings->vertices = 32;
-	sce->toolsettings->editbutflag = 1;
 	sce->toolsettings->uvcalc_radius = 1.0f;
 	sce->toolsettings->uvcalc_cubesize = 1.0f;
 	sce->toolsettings->uvcalc_mapdir = 1;
@@ -458,7 +464,7 @@ Scene *add_scene(const char *name)
 	pset->draw_step= 2;
 	pset->fade_frames= 2;
 	pset->selectmode= SCE_SELECT_PATH;
-	for(a=0; a<PE_TOT_BRUSH; a++) {
+	for (a=0; a<PE_TOT_BRUSH; a++) {
 		pset->brush[a].strength= 0.5;
 		pset->brush[a].size= 50;
 		pset->brush[a].step= 10;
@@ -543,8 +549,8 @@ Base *object_in_scene(Object *ob, Scene *sce)
 	Base *base;
 	
 	base= sce->base.first;
-	while(base) {
-		if(base->object == ob) return base;
+	while (base) {
+		if (base->object == ob) return base;
 		base= base->next;
 	}
 	return NULL;
@@ -563,18 +569,18 @@ void set_scene_bg(Main *bmain, Scene *scene)
 	scene_check_setscene(bmain, scene);
 	
 	/* can happen when switching modes in other scenes */
-	if(scene->obedit && !(scene->obedit->mode & OB_MODE_EDIT))
+	if (scene->obedit && !(scene->obedit->mode & OB_MODE_EDIT))
 		scene->obedit= NULL;
 
 	/* deselect objects (for dataselect) */
-	for(ob= bmain->object.first; ob; ob= ob->id.next)
+	for (ob= bmain->object.first; ob; ob= ob->id.next)
 		ob->flag &= ~(SELECT|OB_FROMGROUP);
 
 	/* group flags again */
-	for(group= bmain->group.first; group; group= group->id.next) {
+	for (group= bmain->group.first; group; group= group->id.next) {
 		go= group->gobject.first;
-		while(go) {
-			if(go->ob) go->ob->flag |= OB_FROMGROUP;
+		while (go) {
+			if (go->ob) go->ob->flag |= OB_FROMGROUP;
 			go= go->next;
 		}
 	}
@@ -583,12 +589,12 @@ void set_scene_bg(Main *bmain, Scene *scene)
 	DAG_scene_sort(bmain, scene);
 	
 	/* ensure dags are built for sets */
-	for(sce= scene->set; sce; sce= sce->set)
-		if(sce->theDag==NULL)
+	for (sce= scene->set; sce; sce= sce->set)
+		if (sce->theDag==NULL)
 			DAG_scene_sort(bmain, sce);
 
 	/* copy layers and flags from bases to objects */
-	for(base= scene->base.first; base; base= base->next) {
+	for (base= scene->base.first; base; base= base->next) {
 		ob= base->object;
 		ob->lay= base->lay;
 		
@@ -598,7 +604,7 @@ void set_scene_bg(Main *bmain, Scene *scene)
 		base->flag |= flag;
 		
 		/* not too nice... for recovering objects with lost data */
-		//if(ob->pose==NULL) base->flag &= ~OB_POSEMODE;
+		//if (ob->pose==NULL) base->flag &= ~OB_POSEMODE;
 		ob->flag= base->flag;
 		
 		ob->ctime= -1234567.0;	/* force ipo to be calculated later */
@@ -610,7 +616,7 @@ void set_scene_bg(Main *bmain, Scene *scene)
 Scene *set_scene_name(Main *bmain, const char *name)
 {
 	Scene *sce= (Scene *)find_id("SC", name);
-	if(sce) {
+	if (sce) {
 		set_scene_bg(bmain, sce);
 		printf("Scene switch: '%s' in file: '%s'\n", name, G.main->name);
 		return sce;
@@ -626,8 +632,8 @@ void unlink_scene(Main *bmain, Scene *sce, Scene *newsce)
 	bScreen *sc;
 
 	/* check all sets */
-	for(sce1= bmain->scene.first; sce1; sce1= sce1->id.next)
-		if(sce1->set == sce)
+	for (sce1= bmain->scene.first; sce1; sce1= sce1->id.next)
+		if (sce1->set == sce)
 			sce1->set= NULL;
 	
 	/* check all sequences */
@@ -637,8 +643,8 @@ void unlink_scene(Main *bmain, Scene *sce, Scene *newsce)
 	clear_scene_in_nodes(bmain, sce);
 	
 	/* al screens */
-	for(sc= bmain->screen.first; sc; sc= sc->id.next)
-		if(sc->scene == sce)
+	for (sc= bmain->screen.first; sc; sc= sc->id.next)
+		if (sc->scene == sce)
 			sc->scene= newsce;
 
 	free_libblock(&bmain->scene, sce);
@@ -655,14 +661,14 @@ int next_object(Scene **scene, int val, Base **base, Object **ob)
 	int run_again=1;
 	
 	/* init */
-	if(val==0) {
+	if (val==0) {
 		fase= F_START;
 		dupob= NULL;
 		
 		/* XXX particle systems with metas+dupligroups call this recursively */
 		/* see bug #18725 */
-		if(in_next_object) {
-			printf("ERROR: MetaBall generation called recursively, not supported\n");
+		if (in_next_object) {
+			printf("ERROR: Metaball generation called recursively, not supported\n");
 			
 			return F_ERROR;
 		}
@@ -671,21 +677,21 @@ int next_object(Scene **scene, int val, Base **base, Object **ob)
 		in_next_object= 1;
 		
 		/* run_again is set when a duplilist has been ended */
-		while(run_again) {
+		while (run_again) {
 			run_again= 0;
 
 			/* the first base */
-			if(fase==F_START) {
+			if (fase==F_START) {
 				*base= (*scene)->base.first;
-				if(*base) {
+				if (*base) {
 					*ob= (*base)->object;
 					fase= F_SCENE;
 				}
 				else {
 					/* exception: empty scene */
-					while((*scene)->set) {
+					while ((*scene)->set) {
 						(*scene)= (*scene)->set;
-						if((*scene)->base.first) {
+						if ((*scene)->base.first) {
 							*base= (*scene)->base.first;
 							*ob= (*base)->object;
 							fase= F_SCENE;
@@ -695,15 +701,15 @@ int next_object(Scene **scene, int val, Base **base, Object **ob)
 				}
 			}
 			else {
-				if(*base && fase!=F_DUPLI) {
+				if (*base && fase!=F_DUPLI) {
 					*base= (*base)->next;
-					if(*base) *ob= (*base)->object;
+					if (*base) *ob= (*base)->object;
 					else {
-						if(fase==F_SCENE) {
+						if (fase==F_SCENE) {
 							/* (*scene) is finished, now do the set */
-							while((*scene)->set) {
+							while ((*scene)->set) {
 								(*scene)= (*scene)->set;
-								if((*scene)->base.first) {
+								if ((*scene)->base.first) {
 									*base= (*scene)->base.first;
 									*ob= (*base)->object;
 									break;
@@ -714,25 +720,25 @@ int next_object(Scene **scene, int val, Base **base, Object **ob)
 				}
 			}
 			
-			if(*base == NULL) fase= F_START;
+			if (*base == NULL) fase= F_START;
 			else {
-				if(fase!=F_DUPLI) {
-					if( (*base)->object->transflag & OB_DUPLI) {
+				if (fase!=F_DUPLI) {
+					if ( (*base)->object->transflag & OB_DUPLI) {
 						/* groups cannot be duplicated for mballs yet, 
-						this enters eternal loop because of 
-						makeDispListMBall getting called inside of group_duplilist */
-						if((*base)->object->dup_group == NULL) {
+						 * this enters eternal loop because of 
+						 * makeDispListMBall getting called inside of group_duplilist */
+						if ((*base)->object->dup_group == NULL) {
 							duplilist= object_duplilist((*scene), (*base)->object);
 							
 							dupob= duplilist->first;
 
-							if(!dupob)
+							if (!dupob)
 								free_object_duplilist(duplilist);
 						}
 					}
 				}
 				/* handle dupli's */
-				if(dupob) {
+				if (dupob) {
 					
 					copy_m4_m4(dupob->ob->obmat, dupob->mat);
 					
@@ -742,11 +748,11 @@ int next_object(Scene **scene, int val, Base **base, Object **ob)
 					
 					dupob= dupob->next;
 				}
-				else if(fase==F_DUPLI) {
+				else if (fase==F_DUPLI) {
 					fase= F_SCENE;
 					(*base)->flag &= ~OB_FROMDUPLI;
 					
-					for(dupob= duplilist->first; dupob; dupob= dupob->next) {
+					for (dupob= duplilist->first; dupob; dupob= dupob->next) {
 						copy_m4_m4(dupob->ob->obmat, dupob->omat);
 					}
 					
@@ -757,10 +763,12 @@ int next_object(Scene **scene, int val, Base **base, Object **ob)
 			}
 		}
 	}
-	
-	/* if(ob && *ob) {
+
+#if 0
+	if (ob && *ob) {
 		printf("Scene: '%s', '%s'\n", (*scene)->id.name+2, (*ob)->id.name+2);
-	} */
+	}
+#endif
 
 	/* reset recursion test */
 	in_next_object= 0;
@@ -788,11 +796,11 @@ Object *scene_camera_switch_find(Scene *scene)
 	Object *camera= NULL;
 
 	for (m= scene->markers.first; m; m= m->next) {
-		if(m->camera && (m->camera->restrictflag & OB_RESTRICT_RENDER)==0 && (m->frame <= cfra) && (m->frame > frame)) {
+		if (m->camera && (m->camera->restrictflag & OB_RESTRICT_RENDER)==0 && (m->frame <= cfra) && (m->frame > frame)) {
 			camera= m->camera;
 			frame= m->frame;
 
-			if(frame == cfra)
+			if (frame == cfra)
 				break;
 
 		}
@@ -805,7 +813,7 @@ int scene_camera_switch_update(Scene *scene)
 {
 #ifdef DURIAN_CAMERA_SWITCH
 	Object *camera= scene_camera_switch_find(scene);
-	if(camera) {
+	if (camera) {
 		scene->camera= camera;
 		return 1;
 	}
@@ -836,7 +844,7 @@ char *scene_find_marker_name(Scene *scene, int frame)
 }
 
 /* return the current marker for this frame,
-we can have more then 1 marker per frame, this just returns the first :/ */
+ * we can have more then 1 marker per frame, this just returns the first :/ */
 char *scene_find_last_marker_name(Scene *scene, int frame)
 {
 	TimeMarker *marker, *best_marker = NULL;
@@ -894,15 +902,15 @@ int scene_check_setscene(Main *bmain, Scene *sce)
 	Scene *scene;
 	int a, totscene;
 	
-	if(sce->set==NULL) return 1;
+	if (sce->set==NULL) return 1;
 	
 	totscene= 0;
-	for(scene= bmain->scene.first; scene; scene= scene->id.next)
+	for (scene= bmain->scene.first; scene; scene= scene->id.next)
 		totscene++;
 	
-	for(a=0, scene=sce; scene->set; scene=scene->set, a++) {
+	for (a=0, scene=sce; scene->set; scene=scene->set, a++) {
 		/* more iterations than scenes means we have a cycle */
-		if(a > totscene) {
+		if (a > totscene) {
 			/* the tested scene gets zero'ed, that's typically current scene */
 			sce->set= NULL;
 			return 0;
@@ -973,7 +981,7 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen
 	scene->customdata_mask= scene_parent->customdata_mask;
 
 	/* sets first, we allow per definition current scene to have
-	   dependencies on sets, but not the other way around. */
+	 * dependencies on sets, but not the other way around. */
 	if (scene->set)
 		scene_update_tagged_recursive(bmain, scene->set, scene_parent);
 	
@@ -983,7 +991,7 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen
 		
 		object_handle_update(scene_parent, ob);
 		
-		if(ob->dup_group && (ob->transflag & OB_DUPLIGROUP))
+		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 */
@@ -1009,10 +1017,10 @@ void scene_update_tagged(Main *bmain, Scene *scene)
 	scene->physics_settings.quick_cache_step= 0;
 
 	/* update all objects: drivers, matrices, displists, etc. flags set
-	   by depgraph or manual, no layer check here, gets correct flushed
-
-	   in the future this should handle updates for all datablocks, not
-	   only objects and scenes. - brecht */
+	 * by depgraph or manual, no layer check here, gets correct flushed
+	 *
+	 * in the future this should handle updates for all datablocks, not
+	 * only objects and scenes. - brecht */
 	scene_update_tagged_recursive(bmain, scene, scene);
 
 	/* extra call here to recalc scene animation (for sequencer) */
@@ -1051,18 +1059,18 @@ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay)
 	/* clear animation overrides */
 	// XXX TODO...
 
-	for(sce_iter= sce; sce_iter; sce_iter= sce_iter->set) {
-		if(sce_iter->theDag==NULL)
+	for (sce_iter= sce; sce_iter; sce_iter= sce_iter->set) {
+		if (sce_iter->theDag==NULL)
 			DAG_scene_sort(bmain, sce_iter);
 	}
 
 	/* flush recalc flags to dependencies, if we were only changing a frame
-	   this would not be necessary, but if a user or a script has modified
-	   some datablock before scene_update_tagged was called, we need the flush */
+	 * this would not be necessary, but if a user or a script has modified
+	 * some datablock before scene_update_tagged was called, we need the flush */
 	DAG_ids_flush_tagged(bmain);
 
 	/* Following 2 functions are recursive
-	 * so dont call within 'scene_update_tagged_recursive' */
+	 * so don't call within 'scene_update_tagged_recursive' */
 	DAG_scene_update_flags(bmain, sce, lay, TRUE);   // only stuff that moves or needs display still
 
 	/* All 'standard' (i.e. without any dependencies) animation is handled here,
@@ -1092,7 +1100,7 @@ SceneRenderLayer *scene_add_render_layer(Scene *sce, const char *name)
 {
 	SceneRenderLayer *srl;
 
-	if(!name)
+	if (!name)
 		name= "RenderLayer";
 
 	srl= MEM_callocN(sizeof(SceneRenderLayer), "new render layer");
@@ -1128,14 +1136,14 @@ int scene_remove_render_layer(Main *bmain, Scene *scene, SceneRenderLayer *srl)
 
 	scene->r.actlay= 0;
 
-	for(sce = bmain->scene.first; sce; sce = sce->id.next) {
-		if(sce->nodetree) {
+	for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+		if (sce->nodetree) {
 			bNode *node;
-			for(node = sce->nodetree->nodes.first; node; node = node->next) {
-				if(node->type==CMP_NODE_R_LAYERS && (Scene*)node->id==scene) {
-					if(node->custom1==act)
+			for (node = sce->nodetree->nodes.first; node; node = node->next) {
+				if (node->type==CMP_NODE_R_LAYERS && (Scene*)node->id==scene) {
+					if (node->custom1==act)
 						node->custom1= 0;
-					else if(node->custom1>act)
+					else if (node->custom1>act)
 						node->custom1--;
 				}
 			}
@@ -1149,7 +1157,7 @@ int scene_remove_render_layer(Main *bmain, Scene *scene, SceneRenderLayer *srl)
 
 int get_render_subsurf_level(RenderData *r, int lvl)
 {
-	if(r->mode & R_SIMPLIFY)
+	if (r->mode & R_SIMPLIFY)
 		return MIN2(r->simplify_subsurf, lvl);
 	else
 		return lvl;
@@ -1157,7 +1165,7 @@ int get_render_subsurf_level(RenderData *r, int lvl)
 
 int get_render_child_particle_number(RenderData *r, int num)
 {
-	if(r->mode & R_SIMPLIFY)
+	if (r->mode & R_SIMPLIFY)
 		return (int)(r->simplify_particles*num);
 	else
 		return num;
@@ -1165,7 +1173,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)
+	if ((r->mode & R_SIMPLIFY) && samples > 0)
 		return MIN2(r->simplify_shadowsamples, samples);
 	else
 		return samples;
@@ -1173,7 +1181,7 @@ int get_render_shadow_samples(RenderData *r, int samples)
 
 float get_render_aosss_error(RenderData *r, float error)
 {
-	if(r->mode & R_SIMPLIFY)
+	if (r->mode & R_SIMPLIFY)
 		return ((1.0f-r->simplify_aosss)*10.0f + 1.0f)*error;
 	else
 		return error;
@@ -1182,19 +1190,19 @@ float get_render_aosss_error(RenderData *r, float error)
 /* helper function for the SETLOOPER macro */
 Base *_setlooper_base_step(Scene **sce_iter, Base *base)
 {
-	if(base && base->next) {
+	if (base && base->next) {
 		/* common case, step to the next */
 		return base->next;
 	}
-	else if(base==NULL && (*sce_iter)->base.first) {
+	else if (base==NULL && (*sce_iter)->base.first) {
 		/* first time looping, return the scenes first base */
 		return (Base *)(*sce_iter)->base.first;
 	}
 	else {
 		/* reached the end, get the next base in the set */
-		while((*sce_iter= (*sce_iter)->set)) {
+		while ((*sce_iter= (*sce_iter)->set)) {
 			base= (Base *)(*sce_iter)->base.first;
-			if(base) {
+			if (base) {
 				return base;
 			}
 		}
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index 3d28e45..af0c5ea 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -30,7 +30,9 @@
  *  \ingroup bke
  */
 
-#include "BLI_winstuff.h"
+#ifdef WIN32
+#  include "BLI_winstuff.h"
+#endif
 
 #include <string.h>
 #include <stdio.h>
@@ -59,15 +61,15 @@ static void spacetype_free(SpaceType *st)
 	PanelType *pt;
 	HeaderType *ht;
 	
-	for(art= st->regiontypes.first; art; art= art->next) {
+	for (art= st->regiontypes.first; art; art= art->next) {
 		BLI_freelistN(&art->drawcalls);
 
-		for(pt= art->paneltypes.first; pt; pt= pt->next)
-			if(pt->ext.free)
+		for (pt= art->paneltypes.first; pt; pt= pt->next)
+			if (pt->ext.free)
 				pt->ext.free(pt->ext.data);
 
-		for(ht= art->headertypes.first; ht; ht= ht->next)
-			if(ht->ext.free)
+		for (ht= art->headertypes.first; ht; ht= ht->next)
+			if (ht->ext.free)
 				ht->ext.free(ht->ext.data);
 
 		BLI_freelistN(&art->paneltypes);
@@ -83,7 +85,7 @@ void BKE_spacetypes_free(void)
 {
 	SpaceType *st;
 	
-	for(st= spacetypes.first; st; st= st->next) {
+	for (st= spacetypes.first; st; st= st->next) {
 		spacetype_free(st);
 	}
 	
@@ -94,8 +96,8 @@ SpaceType *BKE_spacetype_from_id(int spaceid)
 {
 	SpaceType *st;
 	
-	for(st= spacetypes.first; st; st= st->next) {
-		if(st->spaceid==spaceid)
+	for (st= spacetypes.first; st; st= st->next) {
+		if (st->spaceid==spaceid)
 			return st;
 	}
 	return NULL;
@@ -105,8 +107,8 @@ ARegionType *BKE_regiontype_from_id(SpaceType *st, int regionid)
 {
 	ARegionType *art;
 	
-	for(art= st->regiontypes.first; art; art= art->next)
-		if(art->regionid==regionid)
+	for (art= st->regiontypes.first; art; art= art->next)
+		if (art->regionid==regionid)
 			return art;
 	
 	printf("Error, region type missing in - name:\"%s\", id:%d\n", st->name, st->spaceid);
@@ -125,7 +127,7 @@ void BKE_spacetype_register(SpaceType *st)
 	
 	/* sanity check */
 	stype= BKE_spacetype_from_id(st->spaceid);
-	if(stype) {
+	if (stype) {
 		printf("error: redefinition of spacetype %s\n", stype->name);
 		spacetype_free(stype);
 		MEM_freeN(stype);
@@ -145,12 +147,12 @@ void BKE_spacedata_freelist(ListBase *lb)
 		SpaceType *st= BKE_spacetype_from_id(sl->spacetype);
 		
 		/* free regions for pushed spaces */
-		for(ar=sl->regionbase.first; ar; ar=ar->next)
+		for (ar=sl->regionbase.first; ar; ar=ar->next)
 			BKE_area_region_free(st, ar);
 
 		BLI_freelistN(&sl->regionbase);
 		
-		if(st && st->free) 
+		if (st && st->free) 
 			st->free(sl);
 	}
 	
@@ -168,27 +170,27 @@ ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar)
 	newar->swinid= 0;
 	
 	/* use optional regiondata callback */
-	if(ar->regiondata) {
+	if (ar->regiondata) {
 		ARegionType *art= BKE_regiontype_from_id(st, ar->regiontype);
 
-		if(art && art->duplicate)
+		if (art && art->duplicate)
 			newar->regiondata= art->duplicate(ar->regiondata);
 		else
 			newar->regiondata= MEM_dupallocN(ar->regiondata);
 	}
 
-	if(ar->v2d.tab_offset)
+	if (ar->v2d.tab_offset)
 		newar->v2d.tab_offset= MEM_dupallocN(ar->v2d.tab_offset);
 	
 	newar->panels.first= newar->panels.last= NULL;
 	BLI_duplicatelist(&newar->panels, &ar->panels);
 	
 	/* copy panel pointers */
-	for(newpa= newar->panels.first; newpa; newpa= newpa->next) {
+	for (newpa= newar->panels.first; newpa; newpa= newpa->next) {
 		patab= newar->panels.first;
 		pa= ar->panels.first;
-		while(patab) {
-			if(newpa->paneltab == pa) {
+		while (patab) {
+			if (newpa->paneltab == pa) {
 				newpa->paneltab = patab;
 				break;
 			}
@@ -201,7 +203,7 @@ ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar)
 }
 
 
-/* from lb2 to lb1, lb1 is supposed to be free'd */
+/* from lb2 to lb1, lb1 is supposed to be freed */
 static void region_copylist(SpaceType *st, ListBase *lb1, ListBase *lb2)
 {
 	ARegion *ar;
@@ -209,7 +211,7 @@ static void region_copylist(SpaceType *st, ListBase *lb1, ListBase *lb2)
 	/* to be sure */
 	lb1->first= lb1->last= NULL;
 	
-	for(ar= lb2->first; ar; ar= ar->next) {
+	for (ar= lb2->first; ar; ar= ar->next) {
 		ARegion *arnew= BKE_area_region_copy(st, ar);
 		BLI_addtail(lb1, arnew);
 	}
@@ -226,7 +228,7 @@ void BKE_spacedata_copylist(ListBase *lb1, ListBase *lb2)
 	for (sl= lb2->first; sl; sl= sl->next) {
 		SpaceType *st= BKE_spacetype_from_id(sl->spacetype);
 		
-		if(st && st->duplicate) {
+		if (st && st->duplicate) {
 			SpaceLink *slnew= st->duplicate(sl);
 			
 			BLI_addtail(lb1, slnew);
@@ -243,11 +245,11 @@ void BKE_spacedata_draw_locks(int set)
 {
 	SpaceType *st;
 	
-	for(st= spacetypes.first; st; st= st->next) {
+	for (st= spacetypes.first; st; st= st->next) {
 		ARegionType *art;
 	
-		for(art= st->regiontypes.first; art; art= art->next) {
-			if(set) 
+		for (art= st->regiontypes.first; art; art= art->next) {
+			if (set) 
 				art->do_lock= art->lock;
 			else 
 				art->do_lock= 0;
@@ -259,19 +261,19 @@ void BKE_spacedata_draw_locks(int set)
 /* not region itself */
 void BKE_area_region_free(SpaceType *st, ARegion *ar)
 {
-	if(st) {
+	if (st) {
 		ARegionType *art= BKE_regiontype_from_id(st, ar->regiontype);
 		
-		if(art && art->free)
+		if (art && art->free)
 			art->free(ar);
 		
-		if(ar->regiondata)
+		if (ar->regiondata)
 			printf("regiondata free error\n");
 	}
-	else if(ar->type && ar->type->free)
+	else if (ar->type && ar->type->free)
 		ar->type->free(ar);
 	
-	if(ar->v2d.tab_offset) {
+	if (ar->v2d.tab_offset) {
 		MEM_freeN(ar->v2d.tab_offset);
 		ar->v2d.tab_offset= NULL;
 	}
@@ -285,7 +287,7 @@ void BKE_screen_area_free(ScrArea *sa)
 	SpaceType *st= BKE_spacetype_from_id(sa->spacetype);
 	ARegion *ar;
 	
-	for(ar=sa->regionbase.first; ar; ar=ar->next)
+	for (ar=sa->regionbase.first; ar; ar=ar->next)
 		BKE_area_region_free(st, ar);
 
 	BLI_freelistN(&sa->regionbase);
@@ -301,12 +303,12 @@ void free_screen(bScreen *sc)
 	ScrArea *sa, *san;
 	ARegion *ar;
 	
-	for(ar=sc->regionbase.first; ar; ar=ar->next)
+	for (ar=sc->regionbase.first; ar; ar=ar->next)
 		BKE_area_region_free(NULL, ar);
 
 	BLI_freelistN(&sc->regionbase);
 	
-	for(sa= sc->areabase.first; sa; sa= san) {
+	for (sa= sc->areabase.first; sa; sa= san) {
 		san= sa->next;
 		BKE_screen_area_free(sa);
 	}
@@ -322,14 +324,14 @@ unsigned int BKE_screen_visible_layers(bScreen *screen, Scene *scene)
 	ScrArea *sa;
 	unsigned int layer= 0;
 
-	if(screen) {
+	if (screen) {
 		/* get all used view3d layers */
-		for(sa= screen->areabase.first; sa; sa= sa->next)
-			if(sa->spacetype==SPACE_VIEW3D)
+		for (sa= screen->areabase.first; sa; sa= sa->next)
+			if (sa->spacetype==SPACE_VIEW3D)
 				layer |= ((View3D *)sa->spacedata.first)->lay;
 	}
 
-	if(!layer)
+	if (!layer)
 		return scene->lay;
 
 	return layer;
@@ -359,7 +361,7 @@ struct ScrArea *BKE_screen_find_big_area(struct bScreen *sc, const int spacetype
 	ScrArea *sa, *big= NULL;
 	int size, maxsize= 0;
 
-	for(sa= sc->areabase.first; sa; sa= sa->next) {
+	for (sa= sc->areabase.first; sa; sa= sa->next) {
 		if ((spacetype == -1) || sa->spacetype == spacetype) {
 			if (min <= sa->winx && min <= sa->winy) {
 				size= sa->winx*sa->winy;
@@ -378,25 +380,25 @@ void BKE_screen_view3d_sync(struct View3D *v3d, struct Scene *scene)
 {
 	int bit;
 
-	if(v3d->scenelock && v3d->localvd==NULL) {
+	if (v3d->scenelock && v3d->localvd==NULL) {
 		v3d->lay= scene->lay;
 		v3d->camera= scene->camera;
 
-		if(v3d->camera==NULL) {
+		if (v3d->camera==NULL) {
 			ARegion *ar;
 
-			for(ar=v3d->regionbase.first; ar; ar= ar->next) {
-				if(ar->regiontype == RGN_TYPE_WINDOW) {
+			for (ar=v3d->regionbase.first; ar; ar= ar->next) {
+				if (ar->regiontype == RGN_TYPE_WINDOW) {
 					RegionView3D *rv3d= ar->regiondata;
-					if(rv3d->persp==RV3D_CAMOB)
+					if (rv3d->persp==RV3D_CAMOB)
 						rv3d->persp= RV3D_PERSP;
 				}
 			}
 		}
 
-		if((v3d->lay & v3d->layact) == 0) {
-			for(bit= 0; bit<32; bit++) {
-				if(v3d->lay & (1<<bit)) {
+		if ((v3d->lay & v3d->layact) == 0) {
+			for (bit= 0; bit<32; bit++) {
+				if (v3d->lay & (1<<bit)) {
 					v3d->layact= 1<<bit;
 					break;
 				}
@@ -409,10 +411,10 @@ void BKE_screen_view3d_scene_sync(bScreen *sc)
 {
 	/* are there cameras in the views that are not in the scene? */
 	ScrArea *sa;
-	for(sa= sc->areabase.first; sa; sa= sa->next) {
+	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) {
+		for (sl= sa->spacedata.first; sl; sl= sl->next) {
+			if (sl->spacetype==SPACE_VIEW3D) {
 				View3D *v3d= (View3D*) sl;
 				BKE_screen_view3d_sync(v3d, sc->scene);
 			}
@@ -427,13 +429,13 @@ void BKE_screen_view3d_main_sync(ListBase *screen_lb, Scene *scene)
 	SpaceLink *sl;
 
 	/* from scene copy to the other views */
-	for(sc=screen_lb->first; sc; sc=sc->id.next) {
-		if(sc->scene!=scene)
+	for (sc=screen_lb->first; sc; sc=sc->id.next) {
+		if (sc->scene!=scene)
 			continue;
 
-		for(sa=sc->areabase.first; sa; sa=sa->next)
-			for(sl=sa->spacedata.first; sl; sl=sl->next)
-				if(sl->spacetype==SPACE_VIEW3D)
+		for (sa=sc->areabase.first; sa; sa=sa->next)
+			for (sl=sa->spacedata.first; sl; sl=sl->next)
+				if (sl->spacetype==SPACE_VIEW3D)
 					BKE_screen_view3d_sync((View3D*)sl, scene);
 	}
 }
diff --git a/source/blender/blenkernel/intern/script.c b/source/blender/blenkernel/intern/script.c
index 5fadebc..2d1577a 100644
--- a/source/blender/blenkernel/intern/script.c
+++ b/source/blender/blenkernel/intern/script.c
@@ -33,12 +33,11 @@
 
 #include "MEM_guardedalloc.h"
 
-/*
-
+#if 0
 #ifdef WITH_PYTHON
 #include "BPY_extern.h" // Blender Python library
 #endif
-*/
+#endif
 
 /* XXX this function and so also the file should not be needed anymore,
  * since we have to force clearing all Python related data before freeing
diff --git a/source/blender/blenkernel/intern/seqcache.c b/source/blender/blenkernel/intern/seqcache.c
index c5761dc..f1f3dd4 100644
--- a/source/blender/blenkernel/intern/seqcache.c
+++ b/source/blender/blenkernel/intern/seqcache.c
@@ -91,13 +91,13 @@ static int seqcache_hashcmp(const void *a_, const void *b_)
 
 void seq_stripelem_cache_destruct(void)
 {
-	if(moviecache)
+	if (moviecache)
 		IMB_moviecache_free(moviecache);
 }
 
 void seq_stripelem_cache_cleanup(void)
 {
-	if(moviecache) {
+	if (moviecache) {
 		IMB_moviecache_free(moviecache);
 		moviecache = IMB_moviecache_create(sizeof(seqCacheKey), seqcache_hashhash,
 				seqcache_hashcmp, NULL);
@@ -109,7 +109,7 @@ struct ImBuf * seq_stripelem_cache_get(
 	float cfra, seq_stripelem_ibuf_t type)
 {
 
-	if(moviecache && seq) {
+	if (moviecache && seq) {
 		seqCacheKey key;
 
 		key.seq = seq;
@@ -133,7 +133,7 @@ void seq_stripelem_cache_put(
 		return;
 	}
 
-	if(!moviecache) {
+	if (!moviecache) {
 		moviecache = IMB_moviecache_create(sizeof(seqCacheKey), seqcache_hashhash,
 				seqcache_hashcmp, NULL);
 	}
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index 9edcc7a..8015e53 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -85,13 +85,15 @@ static struct ImBuf * prepare_effect_imbufs(
 	if (!ibuf1 && !ibuf2 && !ibuf3) {
 		/* hmmm, global float option ? */
 		out = IMB_allocImBuf((short)x, (short)y, 32, IB_rect);
-	} else if ((ibuf1 && ibuf1->rect_float) || 
+	}
+	else if ((ibuf1 && ibuf1->rect_float) ||
 		   (ibuf2 && ibuf2->rect_float) || 
 		   (ibuf3 && ibuf3->rect_float)) {
 		/* if any inputs are rectfloat, output is float too */
 
 		out = IMB_allocImBuf((short)x, (short)y, 32, IB_rectfloat);
-	} else {
+	}
+	else {
 		out = IMB_allocImBuf((short)x, (short)y, 32, IB_rect);
 	}
 	
@@ -119,8 +121,8 @@ static struct ImBuf * prepare_effect_imbufs(
 }
 
 /* **********************************************************************
-   PLUGINS
-   ********************************************************************** */
+ * PLUGINS
+ * ********************************************************************** */
 
 static void open_plugin_seq(PluginSeq *pis, const char *seqname)
 {
@@ -139,12 +141,12 @@ static void open_plugin_seq(PluginSeq *pis, const char *seqname)
 	/* clear the error list */
 	BLI_dynlib_get_error_as_string(NULL);
 
-	/* if(pis->handle) BLI_dynlib_close(pis->handle); */
+	/* if (pis->handle) BLI_dynlib_close(pis->handle); */
 	/* pis->handle= 0; */
 
 	/* open the needed object */
 	pis->handle= BLI_dynlib_open(pis->name);
-	if(test_dlerr(pis->name, pis->name)) return;
+	if (test_dlerr(pis->name, pis->name)) return;
 
 	if (pis->handle != NULL) {
 		/* find the address of the version function */
@@ -159,7 +161,7 @@ static void open_plugin_seq(PluginSeq *pis, const char *seqname)
 
 				info_func= (int (*)(PluginInfo *))BLI_dynlib_find_symbol(pis->handle, "plugin_getinfo");
 
-				if(info_func == NULL) error("No info func");
+				if (info_func == NULL) error("No info func");
 				else {
 					info_func(info);
 
@@ -176,8 +178,9 @@ static void open_plugin_seq(PluginSeq *pis, const char *seqname)
 				MEM_freeN(info);
 
 				cp= BLI_dynlib_find_symbol(pis->handle, "seqname");
-				if(cp) BLI_strncpy(cp, seqname, SEQ_NAME_MAXSTR);
-			} else {
+				if (cp) BLI_strncpy(cp, seqname, SEQ_NAME_MAXSTR);
+			}
+			else {
 				printf ("Plugin returned unrecognized version number\n");
 				return;
 			}
@@ -205,8 +208,8 @@ static PluginSeq *add_plugin_seq(const char *str, const char *seqname)
 	BLI_strncpy(pis->name, str, FILE_MAX);
 	open_plugin_seq(pis, seqname);
 
-	if(pis->doit==NULL) {
-		if(pis->handle==NULL) error("no plugin: %s", str);
+	if (pis->doit==NULL) {
+		if (pis->handle==NULL) error("no plugin: %s", str);
 		else error("in plugin: %s", str);
 		MEM_freeN(pis);
 		return NULL;
@@ -214,10 +217,10 @@ static PluginSeq *add_plugin_seq(const char *str, const char *seqname)
 
 	/* default values */
 	varstr= pis->varstr;
-	for(a=0; a<pis->vars; a++, varstr++) {
-		if( (varstr->type & FLO)==FLO)
+	for (a=0; a<pis->vars; a++, varstr++) {
+		if ( (varstr->type & FLO)==FLO)
 			pis->data[a]= varstr->def;
-		else if( (varstr->type & INT)==INT)
+		else if ( (varstr->type & INT)==INT)
 			*((int *)(pis->data+a))= (int) varstr->def;
 	}
 
@@ -226,7 +229,7 @@ static PluginSeq *add_plugin_seq(const char *str, const char *seqname)
 
 static void free_plugin_seq(PluginSeq *pis)
 {
-	if(pis==NULL) return;
+	if (pis==NULL) return;
 
 	/* no BLI_dynlib_close: same plugin can be opened multiple times with 1 handle */
 
@@ -265,7 +268,7 @@ static void load_plugin(Sequence * seq)
 
 static void copy_plugin(Sequence * dst, Sequence * src)
 {
-	if(src->plugin) {
+	if (src->plugin) {
 		dst->plugin= MEM_dupallocN(src->plugin);
 		open_plugin_seq(dst->plugin, dst->name+2);
 	}
@@ -288,16 +291,16 @@ static struct ImBuf * do_plugin_effect(
 	char *cp;
 	int float_rendering;
 	int use_temp_bufs = 0; /* Are needed since blur.c (and maybe some other
-				  old plugins) do very bad stuff
-				  with imbuf-internals */
+	                        * old plugins) do very bad stuff
+	                        * with imbuf-internals */
 
 	struct ImBuf * out = prepare_effect_imbufs(context,ibuf1, ibuf2, ibuf3);
 	int x = context.rectx;
 	int y = context.recty;
 
-	if(seq->plugin && seq->plugin->doit) {
+	if (seq->plugin && seq->plugin->doit) {
 		
-		if(seq->plugin->cfra) 
+		if (seq->plugin->cfra) 
 			*(seq->plugin->cfra)= cfra;
 		
 		cp = BLI_dynlib_find_symbol(
@@ -306,7 +309,7 @@ static struct ImBuf * do_plugin_effect(
 		/* XXX: it's crappy to limit copying buffer by it's lemgth,
 		 *      but assuming plugin stuff is using correct buffer size
 		 *      it should be fine */
-		if(cp) strncpy(cp, seq->name+2, sizeof(seq->name)-2);
+		if (cp) strncpy(cp, seq->name+2, sizeof(seq->name)-2);
 
 		if (seq->plugin->current_private_data) {
 			*seq->plugin->current_private_data 
@@ -342,9 +345,9 @@ static struct ImBuf * do_plugin_effect(
 		}
 
 		if (seq->plugin->version<=2) {
-			if(ibuf1) IMB_convert_rgba_to_abgr(ibuf1);
-			if(ibuf2) IMB_convert_rgba_to_abgr(ibuf2);
-			if(ibuf3) IMB_convert_rgba_to_abgr(ibuf3);
+			if (ibuf1) IMB_convert_rgba_to_abgr(ibuf1);
+			if (ibuf2) IMB_convert_rgba_to_abgr(ibuf2);
+			if (ibuf3) IMB_convert_rgba_to_abgr(ibuf3);
 		}
 
 		if (seq->plugin->version<=4) {
@@ -354,7 +357,8 @@ static struct ImBuf * do_plugin_effect(
 				IMB_cast_away_list(ibuf2), 
 				IMB_cast_away_list(out), 
 				IMB_cast_away_list(ibuf3));
-		} else {
+		}
+		else {
 			((SeqDoit)seq->plugin->doit)(
 				seq->plugin->data, facf0, facf1, x, y,
 				ibuf1, ibuf2, out, ibuf3);
@@ -362,9 +366,9 @@ static struct ImBuf * do_plugin_effect(
 
 		if (seq->plugin->version<=2) {
 			if (!use_temp_bufs) {
-				if(ibuf1) IMB_convert_rgba_to_abgr(ibuf1);
-				if(ibuf2) IMB_convert_rgba_to_abgr(ibuf2);
-				if(ibuf3) IMB_convert_rgba_to_abgr(ibuf3);
+				if (ibuf1) IMB_convert_rgba_to_abgr(ibuf1);
+				if (ibuf2) IMB_convert_rgba_to_abgr(ibuf2);
+				if (ibuf3) IMB_convert_rgba_to_abgr(ibuf3);
 			}
 			IMB_convert_rgba_to_abgr(out);
 		}
@@ -394,8 +398,8 @@ static void free_plugin(struct Sequence * seq)
 }
 
 /* **********************************************************************
-   ALPHA OVER
-   ********************************************************************** */
+ * ALPHA OVER
+ * ********************************************************************** */
 
 static void init_alpha_over_or_under(Sequence * seq)
 {
@@ -421,51 +425,51 @@ static void do_alphaover_effect_byte(float facf0, float facf1, int x, int y,
 	fac2= (int)(256.0f*facf0);
 	fac4= (int)(256.0f*facf1);
 
-	while(y--) {
+	while (y--) {
 
 		x= xo;
-		while(x--) {
+		while (x--) {
 
 			/* rt = rt1 over rt2  (alpha from rt1) */
 
 			fac= fac2;
 			mfac= 256 - ( (fac2*rt1[3])>>8 );
 
-			if(fac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
-			else if(mfac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt1);
+			if (fac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
+			else if (mfac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt1);
 			else {
 				tempc= ( fac*rt1[0] + mfac*rt2[0])>>8;
-				if(tempc>255) rt[0]= 255; else rt[0]= tempc;
+				if (tempc>255) rt[0]= 255; else rt[0]= tempc;
 				tempc= ( fac*rt1[1] + mfac*rt2[1])>>8;
-				if(tempc>255) rt[1]= 255; else rt[1]= tempc;
+				if (tempc>255) rt[1]= 255; else rt[1]= tempc;
 				tempc= ( fac*rt1[2] + mfac*rt2[2])>>8;
-				if(tempc>255) rt[2]= 255; else rt[2]= tempc;
+				if (tempc>255) rt[2]= 255; else rt[2]= tempc;
 				tempc= ( fac*rt1[3] + mfac*rt2[3])>>8;
-				if(tempc>255) rt[3]= 255; else rt[3]= tempc;
+				if (tempc>255) rt[3]= 255; else rt[3]= tempc;
 			}
 			rt1+= 4; rt2+= 4; rt+= 4;
 		}
 
-		if(y==0) break;
+		if (y==0) break;
 		y--;
 
 		x= xo;
-		while(x--) {
+		while (x--) {
 
 			fac= fac4;
 			mfac= 256 - ( (fac4*rt1[3])>>8 );
 
-			if(fac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
-			else if(mfac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt1);
+			if (fac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
+			else if (mfac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt1);
 			else {
 				tempc= ( fac*rt1[0] + mfac*rt2[0])>>8;
-				if(tempc>255) rt[0]= 255; else rt[0]= tempc;
+				if (tempc>255) rt[0]= 255; else rt[0]= tempc;
 				tempc= ( fac*rt1[1] + mfac*rt2[1])>>8;
-				if(tempc>255) rt[1]= 255; else rt[1]= tempc;
+				if (tempc>255) rt[1]= 255; else rt[1]= tempc;
 				tempc= ( fac*rt1[2] + mfac*rt2[2])>>8;
-				if(tempc>255) rt[2]= 255; else rt[2]= tempc;
+				if (tempc>255) rt[2]= 255; else rt[2]= tempc;
 				tempc= ( fac*rt1[3] + mfac*rt2[3])>>8;
-				if(tempc>255) rt[3]= 255; else rt[3]= tempc;
+				if (tempc>255) rt[3]= 255; else rt[3]= tempc;
 			}
 			rt1+= 4; rt2+= 4; rt+= 4;
 		}
@@ -487,21 +491,23 @@ static void do_alphaover_effect_float(float facf0, float facf1, int x, int y,
 	fac2= facf0;
 	fac4= facf1;
 
-	while(y--) {
+	while (y--) {
 
 		x= xo;
-		while(x--) {
+		while (x--) {
 
 			/* rt = rt1 over rt2  (alpha from rt1) */
 
 			fac= fac2;
-			mfac= 1.0f - (fac2*rt1[3]) ;
+			mfac= 1.0f - (fac2 * rt1[3]);
 
-			if(fac <= 0.0f) {
+			if (fac <= 0.0f) {
 				memcpy(rt, rt2, 4 * sizeof(float));
-			} else if(mfac <=0) {
+			}
+			else if (mfac <=0) {
 				memcpy(rt, rt1, 4 * sizeof(float));
-			} else {
+			}
+			else {
 				rt[0] = fac*rt1[0] + mfac*rt2[0];
 				rt[1] = fac*rt1[1] + mfac*rt2[1];
 				rt[2] = fac*rt1[2] + mfac*rt2[2];
@@ -510,20 +516,22 @@ static void do_alphaover_effect_float(float facf0, float facf1, int x, int y,
 			rt1+= 4; rt2+= 4; rt+= 4;
 		}
 
-		if(y==0) break;
+		if (y==0) break;
 		y--;
 
 		x= xo;
-		while(x--) {
+		while (x--) {
 
 			fac= fac4;
 			mfac= 1.0f - (fac4*rt1[3]);
 
-			if(fac <= 0.0f) {
+			if (fac <= 0.0f) {
 				memcpy(rt, rt2, 4 * sizeof(float));
-			} else if(mfac <= 0.0f) {
+			}
+			else if (mfac <= 0.0f) {
 				memcpy(rt, rt1, 4 * sizeof(float));
-			} else {
+			}
+			else {
 				rt[0] = fac*rt1[0] + mfac*rt2[0];
 				rt[1] = fac*rt1[1] + mfac*rt2[1];
 				rt[2] = fac*rt1[2] + mfac*rt2[2];
@@ -547,7 +555,8 @@ static struct ImBuf * do_alphaover_effect(
 			facf0, facf1, context.rectx, context.recty,
 			ibuf1->rect_float, ibuf2->rect_float,
 			out->rect_float);
-	} else {
+	}
+	else {
 		do_alphaover_effect_byte(
 			facf0, facf1, context.rectx, context.recty,
 			(char*) ibuf1->rect, (char*) ibuf2->rect,
@@ -558,8 +567,8 @@ static struct ImBuf * do_alphaover_effect(
 
 
 /* **********************************************************************
-   ALPHA UNDER
-   ********************************************************************** */
+ * ALPHA UNDER
+ * ********************************************************************** */
 
 static void do_alphaunder_effect_byte(
 	float facf0, float facf1, int x, int y, char *rect1, 
@@ -577,23 +586,23 @@ static void do_alphaunder_effect_byte(
 	fac2= (int)(256.0f*facf0);
 	fac4= (int)(256.0f*facf1);
 
-	while(y--) {
+	while (y--) {
 
 		x= xo;
-		while(x--) {
+		while (x--) {
 
 			/* rt = rt1 under rt2  (alpha from rt2) */
 
 			/* this complex optimalisation is because the
 			 * 'skybuf' can be crossed in
 			 */
-			if(rt2[3]==0 && fac2==256) *( (unsigned int *)rt) = *( (unsigned int *)rt1);
-			else if(rt2[3]==255) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
+			if (rt2[3]==0 && fac2==256) *( (unsigned int *)rt) = *( (unsigned int *)rt1);
+			else if (rt2[3]==255) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
 			else {
 				mfac= rt2[3];
 				fac= (fac2*(256-mfac))>>8;
 
-				if(fac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
+				if (fac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
 				else {
 					rt[0]= ( fac*rt1[0] + mfac*rt2[0])>>8;
 					rt[1]= ( fac*rt1[1] + mfac*rt2[1])>>8;
@@ -604,19 +613,19 @@ static void do_alphaunder_effect_byte(
 			rt1+= 4; rt2+= 4; rt+= 4;
 		}
 
-		if(y==0) break;
+		if (y==0) break;
 		y--;
 
 		x= xo;
-		while(x--) {
+		while (x--) {
 
-			if(rt2[3]==0 && fac4==256) *( (unsigned int *)rt) = *( (unsigned int *)rt1);
-			else if(rt2[3]==255) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
+			if (rt2[3]==0 && fac4==256) *( (unsigned int *)rt) = *( (unsigned int *)rt1);
+			else if (rt2[3]==255) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
 			else {
 				mfac= rt2[3];
 				fac= (fac4*(256-mfac))>>8;
 
-				if(fac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
+				if (fac==0) *( (unsigned int *)rt) = *( (unsigned int *)rt2);
 				else {
 					rt[0]= ( fac*rt1[0] + mfac*rt2[0])>>8;
 					rt[1]= ( fac*rt1[1] + mfac*rt2[1])>>8;
@@ -646,27 +655,30 @@ static void do_alphaunder_effect_float(float facf0, float facf1, int x, int y,
 	fac2= facf0;
 	fac4= facf1;
 
-	while(y--) {
+	while (y--) {
 
 		x= xo;
-		while(x--) {
+		while (x--) {
 
 			/* rt = rt1 under rt2  (alpha from rt2) */
 
 			/* this complex optimalisation is because the
 			 * 'skybuf' can be crossed in
 			 */
-			if( rt2[3]<=0 && fac2 >= 1.0f) {
+			if ( rt2[3]<=0 && fac2 >= 1.0f) {
 				memcpy(rt, rt1, 4 * sizeof(float));
-			} else if(rt2[3] >= 1.0f) {
+			}
+			else if (rt2[3] >= 1.0f) {
 				memcpy(rt, rt2, 4 * sizeof(float));
-			} else {
+			}
+			else {
 				mfac = rt2[3];
 				fac = fac2 * (1.0f - mfac);
 
-				if(fac == 0) {
+				if (fac == 0) {
 					memcpy(rt, rt2, 4 * sizeof(float));
-				} else {
+				}
+				else {
 					rt[0]= fac*rt1[0] + mfac*rt2[0];
 					rt[1]= fac*rt1[1] + mfac*rt2[1];
 					rt[2]= fac*rt1[2] + mfac*rt2[2];
@@ -676,24 +688,27 @@ static void do_alphaunder_effect_float(float facf0, float facf1, int x, int y,
 			rt1+= 4; rt2+= 4; rt+= 4;
 		}
 
-		if(y==0) break;
+		if (y==0) break;
 		y--;
 
 		x= xo;
-		while(x--) {
+		while (x--) {
 
-			if(rt2[3]<=0 && fac4 >= 1.0f) {
+			if (rt2[3]<=0 && fac4 >= 1.0f) {
 				memcpy(rt, rt1, 4 * sizeof(float));
  
-			} else if(rt2[3]>=1.0f) {
+			}
+			else if (rt2[3]>=1.0f) {
 				memcpy(rt, rt2, 4 * sizeof(float));
-			} else {
+			}
+			else {
 				mfac= rt2[3];
 				fac= fac4*(1.0f-mfac);
 
-				if(fac == 0) {
+				if (fac == 0) {
 					memcpy(rt, rt2, 4 * sizeof(float));
-				} else {
+				}
+				else {
 					rt[0]= fac * rt1[0] + mfac * rt2[0];
 					rt[1]= fac * rt1[1] + mfac * rt2[1];
 					rt[2]= fac * rt1[2] + mfac * rt2[2];
@@ -719,7 +734,8 @@ static struct ImBuf* do_alphaunder_effect(
 			facf0, facf1, context.rectx, context.recty,
 			ibuf1->rect_float, ibuf2->rect_float,
 			out->rect_float);
-	} else {
+	}
+	else {
 		do_alphaunder_effect_byte(
 			facf0, facf1, context.rectx, context.recty,
 			(char*) ibuf1->rect, (char*) ibuf2->rect,
@@ -730,8 +746,8 @@ static struct ImBuf* do_alphaunder_effect(
 
 
 /* **********************************************************************
-   CROSS
-   ********************************************************************** */
+ * CROSS
+ * ********************************************************************** */
 
 static void do_cross_effect_byte(float facf0, float facf1, int x, int y, 
 			  char *rect1, char *rect2, 
@@ -751,10 +767,10 @@ static void do_cross_effect_byte(float facf0, float facf1, int x, int y,
 	fac4= (int)(256.0f*facf1);
 	fac3= 256-fac4;
 
-	while(y--) {
+	while (y--) {
 
 		x= xo;
-		while(x--) {
+		while (x--) {
 
 			rt[0]= (fac1*rt1[0] + fac2*rt2[0])>>8;
 			rt[1]= (fac1*rt1[1] + fac2*rt2[1])>>8;
@@ -764,11 +780,11 @@ static void do_cross_effect_byte(float facf0, float facf1, int x, int y,
 			rt1+= 4; rt2+= 4; rt+= 4;
 		}
 
-		if(y==0) break;
+		if (y==0) break;
 		y--;
 
 		x= xo;
-		while(x--) {
+		while (x--) {
 
 			rt[0]= (fac3*rt1[0] + fac4*rt2[0])>>8;
 			rt[1]= (fac3*rt1[1] + fac4*rt2[1])>>8;
@@ -798,10 +814,10 @@ static void do_cross_effect_float(float facf0, float facf1, int x, int y,
 	fac4= facf1;
 	fac3= 1.0f - fac4;
 
-	while(y--) {
+	while (y--) {
 
 		x= xo;
-		while(x--) {
+		while (x--) {
 
 			rt[0]= fac1*rt1[0] + fac2*rt2[0];
 			rt[1]= fac1*rt1[1] + fac2*rt2[1];
@@ -811,11 +827,11 @@ static void do_cross_effect_float(float facf0, float facf1, int x, int y,
 			rt1+= 4; rt2+= 4; rt+= 4;
 		}
 
-		if(y==0) break;
+		if (y==0) break;
 		y--;
 
 		x= xo;
-		while(x--) {
+		while (x--) {
 
 			rt[0]= fac3*rt1[0] + fac4*rt2[0];
 			rt[1]= fac3*rt1[1] + fac4*rt2[1];
@@ -844,7 +860,8 @@ static struct ImBuf* do_cross_effect(
 			facf0, facf1, context.rectx, context.recty,
 			ibuf1->rect_float, ibuf2->rect_float,
 			out->rect_float);
-	} else {
+	}
+	else {
 		do_cross_effect_byte(
 			facf0, facf1, context.rectx, context.recty,
 			(char*) ibuf1->rect, (char*) ibuf2->rect,
@@ -855,8 +872,8 @@ static struct ImBuf* do_cross_effect(
 
 
 /* **********************************************************************
-   GAMMA CROSS
-   ********************************************************************** */
+ * GAMMA CROSS
+ * ********************************************************************** */
 
 /* copied code from initrender.c */
 static unsigned short gamtab[65536];
@@ -906,9 +923,9 @@ static void makeGammaTables(float gamma)
 	/* multiplication factors used in scaling the interpolation.             */
 	for (i = 0; i < RE_GAMMA_TABLE_SIZE; i++ ) {
 		gamfactor_table[i] = inv_color_step
-			* (gamma_range_table[i + 1] - gamma_range_table[i]) ;
+			* (gamma_range_table[i + 1] - gamma_range_table[i]);
 		inv_gamfactor_table[i] = inv_color_step
-			* (inv_gamma_range_table[i + 1] - inv_gamma_range_table[i]) ;
+			* (inv_gamma_range_table[i + 1] - inv_gamma_range_table[i]);
 	}
 
 } /* end of void makeGammaTables(float gamma) */
@@ -956,22 +973,22 @@ static void gamtabs(float gamma)
 	int a;
 	
 	/* gamtab: in short, out short */
-	for(a=0; a<65536; a++) {
+	for (a=0; a<65536; a++) {
 		val= a;
 		val/= 65535.0f;
 		
-		if(gamma==2.0f) val= sqrt(val);
-		else if(gamma!=1.0f) val= pow(val, igamma);
+		if (gamma==2.0f) val= sqrt(val);
+		else if (gamma!=1.0f) val= pow(val, igamma);
 		
 		gamtab[a]= (65535.99f*val);
 	}
 	/* inverse gamtab1 : in byte, out short */
-	for(a=1; a<=256; a++) {
-		if(gamma==2.0f) igamtab1[a-1]= a*a-1;
-		else if(gamma==1.0f) igamtab1[a-1]= 256*a-1;
+	for (a=1; a<=256; a++) {
+		if (gamma==2.0f) igamtab1[a-1]= a*a-1;
+		else if (gamma==1.0f) igamtab1[a-1]= 256*a-1;
 		else {
 			val= a/256.0f;
-			igamtab1[a-1]= (65535.0*pow(val, gamma)) -1 ;
+			igamtab1[a - 1]= (65535.0 * pow(val, gamma)) - 1;
 		}
 	}
 
@@ -1016,37 +1033,37 @@ static void do_gammacross_effect_byte(float facf0, float UNUSED(facf1),
 	fac2= (int)(256.0f*facf0);
 	fac1= 256-fac2;
 
-	while(y--) {
+	while (y--) {
 
 		x= xo;
-		while(x--) {
+		while (x--) {
 
 			col= (fac1*igamtab1[rt1[0]] + fac2*igamtab1[rt2[0]])>>8;
-			if(col>65535) rt[0]= 255; else rt[0]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
+			if (col>65535) rt[0]= 255; else rt[0]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
 			col=(fac1*igamtab1[rt1[1]] + fac2*igamtab1[rt2[1]])>>8;
-			if(col>65535) rt[1]= 255; else rt[1]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
+			if (col>65535) rt[1]= 255; else rt[1]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
 			col= (fac1*igamtab1[rt1[2]] + fac2*igamtab1[rt2[2]])>>8;
-			if(col>65535) rt[2]= 255; else rt[2]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
+			if (col>65535) rt[2]= 255; else rt[2]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
 			col= (fac1*igamtab1[rt1[3]] + fac2*igamtab1[rt2[3]])>>8;
-			if(col>65535) rt[3]= 255; else rt[3]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
+			if (col>65535) rt[3]= 255; else rt[3]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
 
 			rt1+= 4; rt2+= 4; rt+= 4;
 		}
 
-		if(y==0) break;
+		if (y==0) break;
 		y--;
 
 		x= xo;
-		while(x--) {
+		while (x--) {
 
 			col= (fac1*igamtab1[rt1[0]] + fac2*igamtab1[rt2[0]])>>8;
-			if(col>65535) rt[0]= 255; else rt[0]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
+			if (col>65535) rt[0]= 255; else rt[0]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
 			col= (fac1*igamtab1[rt1[1]] + fac2*igamtab1[rt2[1]])>>8;
-			if(col>65535) rt[1]= 255; else rt[1]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
+			if (col>65535) rt[1]= 255; else rt[1]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
 			col= (fac1*igamtab1[rt1[2]] + fac2*igamtab1[rt2[2]])>>8;
-			if(col>65535) rt[2]= 255; else rt[2]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
+			if (col>65535) rt[2]= 255; else rt[2]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
 			col= (fac1*igamtab1[rt1[3]] + fac2*igamtab1[rt2[3]])>>8;
-			if(col>65535) rt[3]= 255; else rt[3]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
+			if (col>65535) rt[3]= 255; else rt[3]= ( (char *)(gamtab+col))[MOST_SIG_BYTE];
 
 			rt1+= 4; rt2+= 4; rt+= 4;
 		}
@@ -1071,10 +1088,10 @@ static void do_gammacross_effect_float(float facf0, float UNUSED(facf1),
 	fac2= facf0;
 	fac1= 1.0f - fac2;
 
-	while(y--) {
+	while (y--) {
 
 		x= xo * 4;
-		while(x--) {
+		while (x--) {
 
 			*rt= gammaCorrect(
 				fac1 * invGammaCorrect(*rt1) 
@@ -1082,11 +1099,11 @@ static void do_gammacross_effect_float(float facf0, float UNUSED(facf1),
 			rt1++; rt2++; rt++;
 		}
 
-		if(y==0) break;
+		if (y==0) break;
 		y--;
 
 		x= xo * 4;
-		while(x--) {
+		while (x--) {
 
 			*rt= gammaCorrect(
 				fac1*invGammaCorrect(*rt1) 
@@ -1113,7 +1130,8 @@ static struct ImBuf * do_gammacross_effect(
 			facf0, facf1, context.rectx, context.recty,
 			ibuf1->rect_float, ibuf2->rect_float,
 			out->rect_float);
-	} else {
+	}
+	else {
 		do_gammacross_effect_byte(
 			facf0, facf1, context.rectx, context.recty,
 			(unsigned char*) ibuf1->rect, (unsigned char*) ibuf2->rect,
@@ -1124,8 +1142,8 @@ static struct ImBuf * do_gammacross_effect(
 
 
 /* **********************************************************************
-   ADD
-   ********************************************************************** */
+ * ADD
+ * ********************************************************************** */
 
 static void do_add_effect_byte(float facf0, float facf1, int x, int y, 
 				   unsigned char *rect1, unsigned char *rect2, 
@@ -1142,37 +1160,37 @@ static void do_add_effect_byte(float facf0, float facf1, int x, int y,
 	fac1= (int)(256.0f*facf0);
 	fac3= (int)(256.0f*facf1);
 
-	while(y--) {
+	while (y--) {
 
 		x= xo;
-		while(x--) {
+		while (x--) {
 
 			col= rt1[0]+ ((fac1*rt2[0])>>8);
-			if(col>255) rt[0]= 255; else rt[0]= col;
+			if (col>255) rt[0]= 255; else rt[0]= col;
 			col= rt1[1]+ ((fac1*rt2[1])>>8);
-			if(col>255) rt[1]= 255; else rt[1]= col;
+			if (col>255) rt[1]= 255; else rt[1]= col;
 			col= rt1[2]+ ((fac1*rt2[2])>>8);
-			if(col>255) rt[2]= 255; else rt[2]= col;
+			if (col>255) rt[2]= 255; else rt[2]= col;
 			col= rt1[3]+ ((fac1*rt2[3])>>8);
-			if(col>255) rt[3]= 255; else rt[3]= col;
+			if (col>255) rt[3]= 255; else rt[3]= col;
 
 			rt1+= 4; rt2+= 4; rt+= 4;
 		}
 
-		if(y==0) break;
+		if (y==0) break;
 		y--;
 
 		x= xo;
-		while(x--) {
+		while (x--) {
 
 			col= rt1[0]+ ((fac3*rt2[0])>>8);
-			if(col>255) rt[0]= 255; else rt[0]= col;
+			if (col>255) rt[0]= 255; else rt[0]= col;
 			col= rt1[1]+ ((fac3*rt2[1])>>8);
-			if(col>255) rt[1]= 255; else rt[1]= col;
+			if (col>255) rt[1]= 255; else rt[1]= col;
 			col= rt1[2]+ ((fac3*rt2[2])>>8);
-			if(col>255) rt[2]= 255; else rt[2]= col;
+			if (col>255) rt[2]= 255; else rt[2]= col;
 			col= rt1[3]+ ((fac3*rt2[3])>>8);
-			if(col>255) rt[3]= 255; else rt[3]= col;
+			if (col>255) rt[3]= 255; else rt[3]= col;
 
 			rt1+= 4; rt2+= 4; rt+= 4;
 		}
@@ -1195,20 +1213,20 @@ static void do_add_effect_float(float facf0, float facf1, int x, int y,
 	fac1= facf0;
 	fac3= facf1;
 
-	while(y--) {
+	while (y--) {
 
 		x= xo * 4;
-		while(x--) {
+		while (x--) {
 			*rt = *rt1 + fac1 * (*rt2);
 
 			rt1++; rt2++; rt++;
 		}
 
-		if(y==0) break;
+		if (y==0) break;
 		y--;
 
 		x= xo * 4;
-		while(x--) {
+		while (x--) {
 			*rt = *rt1 + fac3 * (*rt2);
 
 			rt1++; rt2++; rt++;
@@ -1229,7 +1247,8 @@ static struct ImBuf * do_add_effect(SeqRenderData context,
 			facf0, facf1, context.rectx, context.recty,
 			ibuf1->rect_float, ibuf2->rect_float,
 			out->rect_float);
-	} else {
+	}
+	else {
 		do_add_effect_byte(
 			facf0, facf1, context.rectx, context.recty,
 			(unsigned char*) ibuf1->rect, (unsigned char*) ibuf2->rect,
@@ -1240,8 +1259,8 @@ static struct ImBuf * do_add_effect(SeqRenderData context,
 
 
 /* **********************************************************************
-   SUB
-   ********************************************************************** */
+ * SUB
+ * ********************************************************************** */
 
 static void do_sub_effect_byte(float facf0, float facf1, 
 				   int x, int y, 
@@ -1258,37 +1277,37 @@ static void do_sub_effect_byte(float facf0, float facf1,
 	fac1= (int)(256.0f*facf0);
 	fac3= (int)(256.0f*facf1);
 
-	while(y--) {
+	while (y--) {
 
 		x= xo;
-		while(x--) {
+		while (x--) {
 
 			col= rt1[0]- ((fac1*rt2[0])>>8);
-			if(col<0) rt[0]= 0; else rt[0]= col;
+			if (col<0) rt[0]= 0; else rt[0]= col;
 			col= rt1[1]- ((fac1*rt2[1])>>8);
-			if(col<0) rt[1]= 0; else rt[1]= col;
+			if (col<0) rt[1]= 0; else rt[1]= col;
 			col= rt1[2]- ((fac1*rt2[2])>>8);
-			if(col<0) rt[2]= 0; else rt[2]= col;
+			if (col<0) rt[2]= 0; else rt[2]= col;
 			col= rt1[3]- ((fac1*rt2[3])>>8);
-			if(col<0) rt[3]= 0; else rt[3]= col;
+			if (col<0) rt[3]= 0; else rt[3]= col;
 
 			rt1+= 4; rt2+= 4; rt+= 4;
 		}
 
-		if(y==0) break;
+		if (y==0) break;
 		y--;
 
 		x= xo;
-		while(x--) {
+		while (x--) {
 
 			col= rt1[0]- ((fac3*rt2[0])>>8);
-			if(col<0) rt[0]= 0; else rt[0]= col;
+			if (col<0) rt[0]= 0; else rt[0]= col;
 			col= rt1[1]- ((fac3*rt2[1])>>8);
-			if(col<0) rt[1]= 0; else rt[1]= col;
+			if (col<0) rt[1]= 0; else rt[1]= col;
 			col= rt1[2]- ((fac3*rt2[2])>>8);
-			if(col<0) rt[2]= 0; else rt[2]= col;
+			if (col<0) rt[2]= 0; else rt[2]= col;
 			col= rt1[3]- ((fac3*rt2[3])>>8);
-			if(col<0) rt[3]= 0; else rt[3]= col;
+			if (col<0) rt[3]= 0; else rt[3]= col;
 
 			rt1+= 4; rt2+= 4; rt+= 4;
 		}
@@ -1311,20 +1330,20 @@ static void do_sub_effect_float(float facf0, float facf1, int x, int y,
 	fac1= facf0;
 	fac3= facf1;
 
-	while(y--) {
+	while (y--) {
 
 		x= xo * 4;
-		while(x--) {
+		while (x--) {
 			*rt = *rt1 - fac1 * (*rt2);
 
 			rt1++; rt2++; rt++;
 		}
 
-		if(y==0) break;
+		if (y==0) break;
 		y--;
 
 		x= xo * 4;
-		while(x--) {
+		while (x--) {
 			*rt = *rt1 - fac3 * (*rt2);
 
 			rt1++; rt2++; rt++;
@@ -1345,7 +1364,8 @@ static struct ImBuf * do_sub_effect(
 			facf0, facf1, context.rectx, context.recty,
 			ibuf1->rect_float, ibuf2->rect_float,
 			out->rect_float);
-	} else {
+	}
+	else {
 		do_sub_effect_byte(
 			facf0, facf1, context.rectx, context.recty,
 			(char*) ibuf1->rect, (char*) ibuf2->rect,
@@ -1355,8 +1375,8 @@ static struct ImBuf * do_sub_effect(
 }
 
 /* **********************************************************************
-   DROP
-   ********************************************************************** */
+ * DROP
+ * ********************************************************************** */
 
 /* Must be > 0 or add precopy, etc to the function */
 #define XOFF	8
@@ -1380,7 +1400,7 @@ static void do_drop_effect_byte(float facf0, float facf1, int x, int y,
 	rt1= (char*) rect1i;
 	out= (char*) outi;
 	for (y=0; y<height-YOFF; y++) {
-		if(field) fac= fac1;
+		if (field) fac= fac1;
 		else fac= fac2;
 		field= !field;
 
@@ -1421,7 +1441,7 @@ static void do_drop_effect_float(float facf0, float facf1, int x, int y,
 	rt1=  rect1i;
 	out=  outi;
 	for (y=0; y<height-YOFF; y++) {
-		if(field) fac= fac1;
+		if (field) fac= fac1;
 		else fac= fac2;
 		field= !field;
 
@@ -1444,8 +1464,8 @@ static void do_drop_effect_float(float facf0, float facf1, int x, int y,
 }
 
 /* **********************************************************************
-   MUL
-   ********************************************************************** */
+ * MUL
+ * ********************************************************************** */
 
 static void do_mul_effect_byte(float facf0, float facf1, int x, int y, 
 				   unsigned char *rect1, unsigned char *rect2, 
@@ -1464,13 +1484,13 @@ static void do_mul_effect_byte(float facf0, float facf1, int x, int y,
 
 	/* formula:
 	 *		fac*(a*b) + (1-fac)*a  => fac*a*(b-1)+axaux= c*px + py*s ;//+centx
-			yaux= -s*px + c*py;//+centy
+	 *		yaux= -s*px + c*py;//+centy
 	 */
 
-	while(y--) {
+	while (y--) {
 
 		x= xo;
-		while(x--) {
+		while (x--) {
 
 			rt[0]= rt1[0] + ((fac1*rt1[0]*(rt2[0]-256))>>16);
 			rt[1]= rt1[1] + ((fac1*rt1[1]*(rt2[1]-256))>>16);
@@ -1480,11 +1500,11 @@ static void do_mul_effect_byte(float facf0, float facf1, int x, int y,
 			rt1+= 4; rt2+= 4; rt+= 4;
 		}
 
-		if(y==0) break;
+		if (y==0) break;
 		y--;
 
 		x= xo;
-		while(x--) {
+		while (x--) {
 
 			rt[0]= rt1[0] + ((fac3*rt1[0]*(rt2[0]-256))>>16);
 			rt[1]= rt1[1] + ((fac3*rt1[1]*(rt2[1]-256))>>16);
@@ -1516,10 +1536,10 @@ static void do_mul_effect_float(float facf0, float facf1, int x, int y,
 	 *		fac*(a*b) + (1-fac)*a  => fac*a*(b-1)+a
 	 */
 
-	while(y--) {
+	while (y--) {
 
 		x= xo;
-		while(x--) {
+		while (x--) {
 
 			rt[0]= rt1[0] + fac1*rt1[0]*(rt2[0]-1.0f);
 			rt[1]= rt1[1] + fac1*rt1[1]*(rt2[1]-1.0f);
@@ -1529,11 +1549,11 @@ static void do_mul_effect_float(float facf0, float facf1, int x, int y,
 			rt1+= 4; rt2+= 4; rt+= 4;
 		}
 
-		if(y==0) break;
+		if (y==0) break;
 		y--;
 
 		x= xo;
-		while(x--) {
+		while (x--) {
 
 			rt[0]= rt1[0] + fac3*rt1[0]*(rt2[0]-1.0f);
 			rt[1]= rt1[1] + fac3*rt1[1]*(rt2[1]-1.0f);
@@ -1558,7 +1578,8 @@ static struct ImBuf * do_mul_effect(
 			facf0, facf1, context.rectx, context.recty,
 			ibuf1->rect_float, ibuf2->rect_float,
 			out->rect_float);
-	} else {
+	}
+	else {
 		do_mul_effect_byte(
 			facf0, facf1, context.rectx, context.recty,
 			(unsigned char*) ibuf1->rect, (unsigned char*) ibuf2->rect,
@@ -1569,8 +1590,8 @@ static struct ImBuf * do_mul_effect(
 }
 
 /* **********************************************************************
-   WIPE
-   ********************************************************************** */
+ * WIPE
+ * ********************************************************************** */
 
 typedef struct WipeZone {
 	float angle;
@@ -1595,18 +1616,18 @@ static float in_band(float width,float dist,int side,int dir)
 {
 	float alpha;
 
-	if(width == 0)
+	if (width == 0)
 		return (float)side;
 
-	if(width < dist)
+	if (width < dist)
 		return (float)side;
 
-	if(side == 1)
+	if (side == 1)
 		alpha = (dist+0.5f*width) / (width);
 	else
 		alpha = (0.5f*width-dist) / (width);
 
-	if(dir == 0)
+	if (dir == 0)
 		alpha = 1-alpha;
 
 	return alpha;
@@ -1616,9 +1637,8 @@ static float check_zone(WipeZone *wipezone, int x, int y,
 	Sequence *seq, float facf0) 
 {
 	float posx, posy,hyp,hyp2,angle,hwidth,b1,b2,b3,pointdist;
-/*some future stuff
-float hyp3,hyp4,b4,b5	   
-*/
+	/* some future stuff */
+	// float hyp3,hyp4,b4,b5
 	float temp1,temp2,temp3,temp4; //some placeholder variables
 	int xo = wipezone->xo;
 	int yo = wipezone->yo;
@@ -1628,13 +1648,14 @@ float hyp3,hyp4,b4,b5
 	WipeVars *wipe = (WipeVars *)seq->effectdata;
 	int width;
 
-	if(wipezone->flip) x = xo - x;
+	if (wipezone->flip) x = xo - x;
 	angle = wipezone->angle;
 
-	if(wipe->forward){
+	if (wipe->forward) {
 		posx = facf0 * xo;
 		posy = facf0 * yo;
-	} else{
+	}
+	else {
 		posx = xo - facf0 * xo;
 		posy = yo - facf0 * yo;
 	}
@@ -1643,7 +1664,7 @@ float hyp3,hyp4,b4,b5
 		case DO_SINGLE_WIPE:
 			width = wipezone->width;
 
-			if(angle == 0.0f) {
+			if (angle == 0.0f) {
 				b1 = posy;
 				b2 = y;
 				hyp = fabs(y - posy);
@@ -1654,20 +1675,20 @@ float hyp3,hyp4,b4,b5
 				hyp = fabsf(angle*x+y+(-posy-angle*posx))*wipezone->pythangle;
 			}
 
-			if(angle < 0) {
+			if (angle < 0) {
 				temp1 = b1;
 				b1 = b2;
 				b2 = temp1;
 			}
 
-			if(wipe->forward) {
-				if(b1 < b2)
+			if (wipe->forward) {
+				if (b1 < b2)
 					output = in_band(width,hyp,1,1);
 				else
 					output = in_band(width,hyp,0,1);
 			}
 			else {
-				if(b1 < b2)
+				if (b1 < b2)
 					output = in_band(width,hyp,0,1);
 				else
 					output = in_band(width,hyp,1,1);
@@ -1675,7 +1696,7 @@ float hyp3,hyp4,b4,b5
 		break;
 
 		case DO_DOUBLE_WIPE:
-			if(!wipe->forward)
+			if (!wipe->forward)
 				facf0 = 1.0f-facf0;   // Go the other direction
 
 			width = wipezone->width;  // calculate the blur width
@@ -1697,34 +1718,36 @@ float hyp3,hyp4,b4,b5
 				hyp2 = fabsf(angle*x+y+(-(yo-posy*0.5f)-angle*(xo-posx*0.5f)))*wipezone->pythangle;
 			}
 
-			hwidth= MIN2(hwidth, fabsf(b3-b1)/2.0f);
+			hwidth = minf(hwidth, fabsf(b3-b1)/2.0f);
 
-			if(b2 < b1 && b2 < b3 ){
+			if (b2 < b1 && b2 < b3 ) {
 				output = in_band(hwidth,hyp,0,1);
-			} else if(b2 > b1 && b2 > b3 ){
+			}
+			else if (b2 > b1 && b2 > b3 ) {
 				output = in_band(hwidth,hyp2,0,1);
-			} else {
-				if(  hyp < hwidth && hyp2 > hwidth )
+			}
+			else {
+				if (  hyp < hwidth && hyp2 > hwidth )
 					output = in_band(hwidth,hyp,1,1);
-				else if( hyp > hwidth && hyp2 < hwidth )
+				else if ( hyp > hwidth && hyp2 < hwidth )
 					  output = in_band(hwidth,hyp2,1,1);
 				else
 					  output = in_band(hwidth,hyp2,1,1) * in_band(hwidth,hyp,1,1);
 			}
-			if(!wipe->forward)output = 1-output;
+			if (!wipe->forward)output = 1-output;
 		break;
 		case DO_CLOCK_WIPE:
-			  /*
-				  temp1: angle of effect center in rads
-				  temp2: angle of line through (halfx,halfy) and (x,y) in rads
-				  temp3: angle of low side of blur
-				  temp4: angle of high side of blur
-			  */
+			/*
+			 *  temp1: angle of effect center in rads
+			 *  temp2: angle of line through (halfx,halfy) and (x,y) in rads
+			 *  temp3: angle of low side of blur
+			 *  temp4: angle of high side of blur
+			 */
 			output = 1.0f - facf0;
 			widthf = wipe->edgeWidth*2.0f*(float)M_PI;
 			temp1 = 2.0f * (float)M_PI * facf0;
 
-			if(wipe->forward){
+			if (wipe->forward) {
 				temp1 = 2.0f*(float)M_PI - temp1;
 			}
 
@@ -1732,14 +1755,15 @@ float hyp3,hyp4,b4,b5
 			y = y - halfy;
 
 			temp2 = asin(abs(y)/sqrt(x*x + y*y));
-			if(x <= 0 && y >= 0) temp2 = (float)M_PI - temp2;
-			else if(x<=0 && y <= 0) temp2 += (float)M_PI;
-			else if(x >= 0 && y <= 0) temp2 = 2.0f*(float)M_PI - temp2;
+			if (x <= 0 && y >= 0) temp2 = (float)M_PI - temp2;
+			else if (x<=0 && y <= 0) temp2 += (float)M_PI;
+			else if (x >= 0 && y <= 0) temp2 = 2.0f*(float)M_PI - temp2;
 
-			if(wipe->forward){
+			if (wipe->forward) {
 				temp3 = temp1-(widthf*0.5f)*facf0;
 				temp4 = temp1+(widthf*0.5f)*(1-facf0);
-			} else{
+			}
+			else {
 				temp3 = temp1-(widthf*0.5f)*(1-facf0);
 				temp4 = temp1+(widthf*0.5f)*facf0;
 			}
@@ -1747,19 +1771,19 @@ float hyp3,hyp4,b4,b5
 			if (temp4 > 2.0f*(float)M_PI) temp4 = 2.0f*(float)M_PI;
 
 
-			if(temp2 < temp3) output = 0;
+			if (temp2 < temp3) output = 0;
 			else if (temp2 > temp4) output = 1;
 			else output = (temp2-temp3)/(temp4-temp3);
-			if(x == 0 && y == 0) output = 1;
-			if(output != output) output = 1;
-			if(wipe->forward) output = 1 - output;
+			if (x == 0 && y == 0) output = 1;
+			if (output != output) output = 1;
+			if (wipe->forward) output = 1 - output;
 		break;
 	/* BOX WIPE IS NOT WORKING YET */
 	/* case DO_CROSS_WIPE: */
 	/* BOX WIPE IS NOT WORKING YET */
-	/* 
+#if 0
 		case DO_BOX_WIPE: 
-			if(invert)facf0 = 1-facf0;
+			if (invert)facf0 = 1-facf0;
 
 			width = (int)(wipe->edgeWidth*((xo+yo)/2.0));
 			hwidth = (float)width/2.0;
@@ -1775,22 +1799,24 @@ float hyp3,hyp4,b4,b5
 			temp2 = yo*(1-facf0/2)-yo*facf0/2;
 			pointdist = sqrt(temp1*temp1 + temp2*temp2);
 
-			if(b2 < b1 && b2 < b3 ){
-				if(hwidth < pointdist)
+			if (b2 < b1 && b2 < b3 ) {
+				if (hwidth < pointdist)
 					output = in_band(wipezone,hwidth,hyp,facf0,0,1);
-			} else if(b2 > b1 && b2 > b3 ){
-				if(hwidth < pointdist)
+		}
+		else if (b2 > b1 && b2 > b3 ) {
+				if (hwidth < pointdist)
 					output = in_band(wipezone,hwidth,hyp2,facf0,0,1);	
-			} else {
-				if( hyp < hwidth && hyp2 > hwidth )
+		}
+		else {
+				if ( hyp < hwidth && hyp2 > hwidth )
 					output = in_band(wipezone,hwidth,hyp,facf0,1,1);
-				else if( hyp > hwidth && hyp2 < hwidth )
+				else if ( hyp > hwidth && hyp2 < hwidth )
 					 output = in_band(wipezone,hwidth,hyp2,facf0,1,1);
 				else
 					 output = in_band(wipezone,hwidth,hyp2,facf0,1,1) * in_band(wipezone,hwidth,hyp,facf0,1,1);
 			}
 
-			if(invert)facf0 = 1-facf0;
+			if (invert)facf0 = 1-facf0;
 			angle = -1/angle;
 			b1 = posy/2 - (-angle)*posx/2;
 			b3 = (yo-posy/2) - (-angle)*(xo-posx/2);
@@ -1799,28 +1825,30 @@ float hyp3,hyp4,b4,b5
 			hyp = abs(angle*x+y+(-posy/2-angle*posx/2))*wipezone->pythangle;
 			hyp2 = abs(angle*x+y+(-(yo-posy/2)-angle*(xo-posx/2)))*wipezone->pythangle;
 
-			if(b2 < b1 && b2 < b3 ){
-				if(hwidth < pointdist)
+			if (b2 < b1 && b2 < b3 ) {
+				if (hwidth < pointdist)
 					output *= in_band(wipezone,hwidth,hyp,facf0,0,1);
-			} else if(b2 > b1 && b2 > b3 ){
-				if(hwidth < pointdist)
+		}
+		else if (b2 > b1 && b2 > b3 ) {
+				if (hwidth < pointdist)
 					output *= in_band(wipezone,hwidth,hyp2,facf0,0,1);	
-			} else {
-				if( hyp < hwidth && hyp2 > hwidth )
+		}
+		else {
+				if ( hyp < hwidth && hyp2 > hwidth )
 					output *= in_band(wipezone,hwidth,hyp,facf0,1,1);
-				else if( hyp > hwidth && hyp2 < hwidth )
+				else if ( hyp > hwidth && hyp2 < hwidth )
 					output *= in_band(wipezone,hwidth,hyp2,facf0,1,1);
 				else
 					output *= in_band(wipezone,hwidth,hyp2,facf0,1,1) * in_band(wipezone,hwidth,hyp,facf0,1,1);
 			}
 
 		break;
-*/
+#endif
 		case DO_IRIS_WIPE:
-			if(xo > yo) yo = xo;
+			if (xo > yo) yo = xo;
 			else xo = yo;
 
-			if(!wipe->forward) facf0 = 1-facf0;
+			if (!wipe->forward) facf0 = 1-facf0;
 
 			width = wipezone->width;
 			hwidth = width*0.5f;
@@ -1829,21 +1857,21 @@ float hyp3,hyp4,b4,b5
 			pointdist = sqrt(temp1*temp1 + temp1*temp1);
 
 			temp2 = sqrt((halfx-x)*(halfx-x) + (halfy-y)*(halfy-y));
-			if(temp2 > pointdist) output = in_band(hwidth,fabs(temp2-pointdist),0,1);
+			if (temp2 > pointdist) output = in_band(hwidth,fabs(temp2-pointdist),0,1);
 			else output = in_band(hwidth,fabs(temp2-pointdist),1,1);
 
-			if(!wipe->forward) output = 1-output;
+			if (!wipe->forward) output = 1-output;
 			
 		break;
 	}
 	if (output < 0) output = 0;
-	else if(output > 1) output = 1;
+	else if (output > 1) output = 1;
 	return output;
 }
 
 static void init_wipe_effect(Sequence *seq)
 {
-	if(seq->effectdata)MEM_freeN(seq->effectdata);
+	if (seq->effectdata)MEM_freeN(seq->effectdata);
 	seq->effectdata = MEM_callocN(sizeof(struct WipeVars), "wipevars");
 }
 
@@ -1854,7 +1882,7 @@ static int num_inputs_wipe(void)
 
 static void free_wipe_effect(Sequence *seq)
 {
-	if(seq->effectdata)MEM_freeN(seq->effectdata);
+	if (seq->effectdata)MEM_freeN(seq->effectdata);
 	seq->effectdata = NULL;
 }
 
@@ -1881,8 +1909,8 @@ static void do_wipe_effect_byte(Sequence *seq, float facf0, float UNUSED(facf1),
 
 	xo = x;
 	yo = y;
-	for(y=0;y<yo;y++) {
-		for(x=0;x<xo;x++) {
+	for (y=0;y<yo;y++) {
+		for (x=0;x<xo;x++) {
 			float check = check_zone(&wipezone,x,y,seq,facf0);
 			if (check) {
 				if (rt1) {
@@ -1890,19 +1918,22 @@ static void do_wipe_effect_byte(Sequence *seq, float facf0, float UNUSED(facf1),
 					rt[1] = (int)(rt1[1]*check)+ (int)(rt2[1]*(1-check));
 					rt[2] = (int)(rt1[2]*check)+ (int)(rt2[2]*(1-check));
 					rt[3] = (int)(rt1[3]*check)+ (int)(rt2[3]*(1-check));
-				} else {
+				}
+				else {
 					rt[0] = 0;
 					rt[1] = 0;
 					rt[2] = 0;
 					rt[3] = 255;
 				}
-			} else {
+			}
+			else {
 				if (rt2) {
 					rt[0] = rt2[0];
 					rt[1] = rt2[1];
 					rt[2] = rt2[2];
 					rt[3] = rt2[3];
-				} else {
+				}
+				else {
 					rt[0] = 0;
 					rt[1] = 0;
 					rt[2] = 0;
@@ -1911,10 +1942,10 @@ static void do_wipe_effect_byte(Sequence *seq, float facf0, float UNUSED(facf1),
 			}
 
 			rt+=4;
-			if(rt1 !=NULL){
+			if (rt1 !=NULL) {
 				rt1+=4;
 			}
-			if(rt2 !=NULL){
+			if (rt2 !=NULL) {
 				rt2+=4;
 			}
 		}
@@ -1939,8 +1970,8 @@ static void do_wipe_effect_float(Sequence *seq, float facf0, float UNUSED(facf1)
 
 	xo = x;
 	yo = y;
-	for(y=0;y<yo;y++) {
-		for(x=0;x<xo;x++) {
+	for (y=0;y<yo;y++) {
+		for (x=0;x<xo;x++) {
 			float check = check_zone(&wipezone,x,y,seq,facf0);
 			if (check) {
 				if (rt1) {
@@ -1948,19 +1979,22 @@ static void do_wipe_effect_float(Sequence *seq, float facf0, float UNUSED(facf1)
 					rt[1] = rt1[1]*check+ rt2[1]*(1-check);
 					rt[2] = rt1[2]*check+ rt2[2]*(1-check);
 					rt[3] = rt1[3]*check+ rt2[3]*(1-check);
-				} else {
+				}
+				else {
 					rt[0] = 0;
 					rt[1] = 0;
 					rt[2] = 0;
 					rt[3] = 1.0;
 				}
-			} else {
+			}
+			else {
 				if (rt2) {
 					rt[0] = rt2[0];
 					rt[1] = rt2[1];
 					rt[2] = rt2[2];
 					rt[3] = rt2[3];
-				} else {
+				}
+				else {
 					rt[0] = 0;
 					rt[1] = 0;
 					rt[2] = 0;
@@ -1969,10 +2003,10 @@ static void do_wipe_effect_float(Sequence *seq, float facf0, float UNUSED(facf1)
 			}
 
 			rt+=4;
-			if(rt1 !=NULL){
+			if (rt1 !=NULL) {
 				rt1+=4;
 			}
-			if(rt2 !=NULL){
+			if (rt2 !=NULL) {
 				rt2+=4;
 			}
 		}
@@ -1992,7 +2026,8 @@ static struct ImBuf * do_wipe_effect(
 				     facf0, facf1, context.rectx, context.recty,
 				     ibuf1->rect_float, ibuf2->rect_float,
 				     out->rect_float);
-	} else {
+	}
+	else {
 		do_wipe_effect_byte(seq,
 				    facf0, facf1, context.rectx, context.recty,
 				    (unsigned char*) ibuf1->rect, (unsigned char*) ibuf2->rect,
@@ -2002,13 +2037,13 @@ static struct ImBuf * do_wipe_effect(
 	return out;
 }
 /* **********************************************************************
-   TRANSFORM
-   ********************************************************************** */
+ * TRANSFORM
+ * ********************************************************************** */
 static void init_transform_effect(Sequence *seq)
 {
 	TransformVars *transform;
 
-	if(seq->effectdata)MEM_freeN(seq->effectdata);
+	if (seq->effectdata)MEM_freeN(seq->effectdata);
 	seq->effectdata = MEM_callocN(sizeof(struct TransformVars), "transformvars");
 
 	transform = (TransformVars *)seq->effectdata;
@@ -2033,7 +2068,7 @@ static int num_inputs_transform(void)
 
 static void free_transform_effect(Sequence *seq)
 {
-	if(seq->effectdata)MEM_freeN(seq->effectdata);
+	if (seq->effectdata)MEM_freeN(seq->effectdata);
 	seq->effectdata = NULL;
 }
 
@@ -2101,18 +2136,20 @@ static void do_transform(Scene *scene, Sequence *seq, float UNUSED(facf0), int x
 	// Scale
 	if (transform->uniform_scale) {
 		scale_x = scale_y = transform->ScalexIni;
-	} else {
+	}
+	else {
 		scale_x = transform->ScalexIni;
 		scale_y = transform->ScaleyIni;
 	}
 
 	// Translate
-	if(!transform->percent){
+	if (!transform->percent) {
 		float rd_s = (scene->r.size/100.0f);
 
 		translate_x = transform->xIni*rd_s+(x/2.0f);
 		translate_y = transform->yIni*rd_s+(y/2.0f);
-	}else{
+	}
+	else {
 		translate_x = x*(transform->xIni/100.0f)+(x/2.0f);
 		translate_y = y*(transform->yIni/100.0f)+(y/2.0f);
 	}
@@ -2140,8 +2177,8 @@ static struct ImBuf * do_transform_effect(
 
 
 /* **********************************************************************
-   GLOW
-   ********************************************************************** */
+ * GLOW
+ * ********************************************************************** */
 
 static void RVBlurBitmap2_byte ( unsigned char* map, int width,int height,
 				 float blur,
@@ -2173,7 +2210,7 @@ static void RVBlurBitmap2_byte ( unsigned char* map, int width,int height,
 	/*	Allocate memory for the filter elements */
 	halfWidth = ((quality+1)*blur);
 	filter = (float *)MEM_mallocN(sizeof(float)*halfWidth*2, "blurbitmapfilter");
-	if (!filter){
+	if (!filter) {
 		MEM_freeN (temp);
 		return;
 	}
@@ -2185,7 +2222,7 @@ static void RVBlurBitmap2_byte ( unsigned char* map, int width,int height,
 	/*	Blancmange (bmange at airdmhor.gen.nz) */
 
 	k = -1.0f/(2.0f*(float)M_PI*blur*blur);
-	for (ix = 0;ix< halfWidth;ix++){
+	for (ix = 0;ix< halfWidth;ix++) {
 		weight = (float)exp(k*(ix*ix));
 		filter[halfWidth - ix] = weight;
 		filter[halfWidth + ix] = weight;
@@ -2201,16 +2238,16 @@ static void RVBlurBitmap2_byte ( unsigned char* map, int width,int height,
 		filter[ix]/=fval;
 
 	/*	Blur the rows */
-	for (y=0;y<height;y++){
+	for (y=0;y<height;y++) {
 		/*	Do the left & right strips */
-		for (x=0;x<halfWidth;x++){
+		for (x=0;x<halfWidth;x++) {
 			index=(x+y*width)*4;
 			fx=0;
-			curColor[0]=curColor[1]=curColor[2]=0;
-			curColor2[0]=curColor2[1]=curColor2[2]=0;
+			zero_v3(curColor);
+			zero_v3(curColor2);
 
-			for (i=x-halfWidth;i<x+halfWidth;i++){
-				if ((i>=0)&&(i<width)){
+			for (i=x-halfWidth;i<x+halfWidth;i++) {
+				if ((i>=0)&&(i<width)) {
 					curColor[0]+=map[(i+y*width)*4+GlowR]*filter[fx];
 					curColor[1]+=map[(i+y*width)*4+GlowG]*filter[fx];
 					curColor[2]+=map[(i+y*width)*4+GlowB]*filter[fx];
@@ -2234,11 +2271,11 @@ static void RVBlurBitmap2_byte ( unsigned char* map, int width,int height,
 
 		}
 		/*	Do the main body */
-		for (x=halfWidth;x<width-halfWidth;x++){
+		for (x=halfWidth;x<width-halfWidth;x++) {
 			index=(x+y*width)*4;
 			fx=0;
-			curColor[0]=curColor[1]=curColor[2]=0;
-			for (i=x-halfWidth;i<x+halfWidth;i++){
+			zero_v3(curColor);
+			for (i=x-halfWidth;i<x+halfWidth;i++) {
 				curColor[0]+=map[(i+y*width)*4+GlowR]*filter[fx];
 				curColor[1]+=map[(i+y*width)*4+GlowG]*filter[fx];
 				curColor[2]+=map[(i+y*width)*4+GlowB]*filter[fx];
@@ -2255,15 +2292,15 @@ static void RVBlurBitmap2_byte ( unsigned char* map, int width,int height,
 
 
 	/*	Blur the columns */
-	for (x=0;x<width;x++){
+	for (x=0;x<width;x++) {
 		/*	Do the top & bottom strips */
-		for (y=0;y<halfWidth;y++){
+		for (y=0;y<halfWidth;y++) {
 			index=(x+y*width)*4;
 			fy=0;
-			curColor[0]=curColor[1]=curColor[2]=0;
-			curColor2[0]=curColor2[1]=curColor2[2]=0;
-			for (i=y-halfWidth;i<y+halfWidth;i++){
-				if ((i>=0)&&(i<height)){
+			zero_v3(curColor);
+			zero_v3(curColor2);
+			for (i=y-halfWidth;i<y+halfWidth;i++) {
+				if ((i>=0)&&(i<height)) {
 					/*	Bottom */
 					curColor[0]+=map[(x+i*width)*4+GlowR]*filter[fy];
 					curColor[1]+=map[(x+i*width)*4+GlowG]*filter[fy];
@@ -2287,11 +2324,11 @@ static void RVBlurBitmap2_byte ( unsigned char* map, int width,int height,
 			temp[((x+(height-1-y)*width)*4)+GlowB]=curColor2[2];
 		}
 		/*	Do the main body */
-		for (y=halfWidth;y<height-halfWidth;y++){
+		for (y=halfWidth;y<height-halfWidth;y++) {
 			index=(x+y*width)*4;
 			fy=0;
-			curColor[0]=curColor[1]=curColor[2]=0;
-			for (i=y-halfWidth;i<y+halfWidth;i++){
+			zero_v3(curColor);
+			for (i=y-halfWidth;i<y+halfWidth;i++) {
 				curColor[0]+=map[(x+i*width)*4+GlowR]*filter[fy];
 				curColor[1]+=map[(x+i*width)*4+GlowG]*filter[fy];
 				curColor[2]+=map[(x+i*width)*4+GlowB]*filter[fy];
@@ -2342,7 +2379,7 @@ static void RVBlurBitmap2_float ( float* map, int width,int height,
 	/*	Allocate memory for the filter elements */
 	halfWidth = ((quality+1)*blur);
 	filter = (float *)MEM_mallocN(sizeof(float)*halfWidth*2, "blurbitmapfilter");
-	if (!filter){
+	if (!filter) {
 		MEM_freeN (temp);
 		return;
 	}
@@ -2355,7 +2392,7 @@ static void RVBlurBitmap2_float ( float* map, int width,int height,
 
 	k = -1.0f/(2.0f*(float)M_PI*blur*blur);
 
-	for (ix = 0;ix< halfWidth;ix++){
+	for (ix = 0;ix< halfWidth;ix++) {
 		weight = (float)exp(k*(ix*ix));
 		filter[halfWidth - ix] = weight;
 		filter[halfWidth + ix] = weight;
@@ -2371,16 +2408,16 @@ static void RVBlurBitmap2_float ( float* map, int width,int height,
 		filter[ix]/=fval;
 
 	/*	Blur the rows */
-	for (y=0;y<height;y++){
+	for (y=0;y<height;y++) {
 		/*	Do the left & right strips */
-		for (x=0;x<halfWidth;x++){
+		for (x=0;x<halfWidth;x++) {
 			index=(x+y*width)*4;
 			fx=0;
 			curColor[0]=curColor[1]=curColor[2]=0.0f;
 			curColor2[0]=curColor2[1]=curColor2[2]=0.0f;
 
-			for (i=x-halfWidth;i<x+halfWidth;i++){
-				if ((i>=0)&&(i<width)){
+			for (i=x-halfWidth;i<x+halfWidth;i++) {
+				if ((i>=0)&&(i<width)) {
 					curColor[0]+=map[(i+y*width)*4+GlowR]*filter[fx];
 					curColor[1]+=map[(i+y*width)*4+GlowG]*filter[fx];
 					curColor[2]+=map[(i+y*width)*4+GlowB]*filter[fx];
@@ -2404,11 +2441,11 @@ static void RVBlurBitmap2_float ( float* map, int width,int height,
 
 		}
 		/*	Do the main body */
-		for (x=halfWidth;x<width-halfWidth;x++){
+		for (x=halfWidth;x<width-halfWidth;x++) {
 			index=(x+y*width)*4;
 			fx=0;
-			curColor[0]=curColor[1]=curColor[2]=0;
-			for (i=x-halfWidth;i<x+halfWidth;i++){
+			zero_v3(curColor);
+			for (i=x-halfWidth;i<x+halfWidth;i++) {
 				curColor[0]+=map[(i+y*width)*4+GlowR]*filter[fx];
 				curColor[1]+=map[(i+y*width)*4+GlowG]*filter[fx];
 				curColor[2]+=map[(i+y*width)*4+GlowB]*filter[fx];
@@ -2425,15 +2462,15 @@ static void RVBlurBitmap2_float ( float* map, int width,int height,
 
 
 	/*	Blur the columns */
-	for (x=0;x<width;x++){
+	for (x=0;x<width;x++) {
 		/*	Do the top & bottom strips */
-		for (y=0;y<halfWidth;y++){
+		for (y=0;y<halfWidth;y++) {
 			index=(x+y*width)*4;
 			fy=0;
-			curColor[0]=curColor[1]=curColor[2]=0;
-			curColor2[0]=curColor2[1]=curColor2[2]=0;
-			for (i=y-halfWidth;i<y+halfWidth;i++){
-				if ((i>=0)&&(i<height)){
+			zero_v3(curColor);
+			zero_v3(curColor2);
+			for (i=y-halfWidth;i<y+halfWidth;i++) {
+				if ((i>=0)&&(i<height)) {
 					/*	Bottom */
 					curColor[0]+=map[(x+i*width)*4+GlowR]*filter[fy];
 					curColor[1]+=map[(x+i*width)*4+GlowG]*filter[fy];
@@ -2457,11 +2494,11 @@ static void RVBlurBitmap2_float ( float* map, int width,int height,
 			temp[((x+(height-1-y)*width)*4)+GlowB]=curColor2[2];
 		}
 		/*	Do the main body */
-		for (y=halfWidth;y<height-halfWidth;y++){
+		for (y=halfWidth;y<height-halfWidth;y++) {
 			index=(x+y*width)*4;
 			fy=0;
-			curColor[0]=curColor[1]=curColor[2]=0;
-			for (i=y-halfWidth;i<y+halfWidth;i++){
+			zero_v3(curColor);
+			for (i=y-halfWidth;i<y+halfWidth;i++) {
 				curColor[0]+=map[(x+i*width)*4+GlowR]*filter[fy];
 				curColor[1]+=map[(x+i*width)*4+GlowG]*filter[fy];
 				curColor[2]+=map[(x+i*width)*4+GlowB]*filter[fy];
@@ -2491,8 +2528,8 @@ static void RVAddBitmaps_byte (unsigned char* a, unsigned char* b, unsigned char
 {
 	int	x,y,index;
 
-	for (y=0;y<height;y++){
-		for (x=0;x<width;x++){
+	for (y=0;y<height;y++) {
+		for (x=0;x<width;x++) {
 			index=(x+y*width)*4;
 			c[index+GlowR]=MIN2(255,a[index+GlowR]+b[index+GlowR]);
 			c[index+GlowG]=MIN2(255,a[index+GlowG]+b[index+GlowG]);
@@ -2507,8 +2544,8 @@ static void RVAddBitmaps_float (float* a, float* b, float* c,
 {
 	int	x,y,index;
 
-	for (y=0;y<height;y++){
-		for (x=0;x<width;x++){
+	for (y=0;y<height;y++) {
+		for (x=0;x<width;x++) {
 			index=(x+y*width)*4;
 			c[index+GlowR]= MIN2(1.0f, a[index+GlowR]+b[index+GlowR]);
 			c[index+GlowG]= MIN2(1.0f, a[index+GlowG]+b[index+GlowG]);
@@ -2528,18 +2565,19 @@ static void RVIsolateHighlights_byte (unsigned char* in, unsigned char* out,
 	int	intensity;
 
 
-	for(y=0;y< height;y++) {
+	for (y=0;y< height;y++) {
 		for (x=0;x< width;x++) {
 			index= (x+y*width)*4;
 
 			/*	Isolate the intensity */
 			intensity=(in[index+GlowR]+in[index+GlowG]+in[index+GlowB]-threshold);
-			if (intensity>0){
+			if (intensity>0) {
 				out[index+GlowR]=MIN2(255*clamp, (in[index+GlowR]*boost*intensity)/255);
 				out[index+GlowG]=MIN2(255*clamp, (in[index+GlowG]*boost*intensity)/255);
 				out[index+GlowB]=MIN2(255*clamp, (in[index+GlowB]*boost*intensity)/255);
 				out[index+GlowA]=MIN2(255*clamp, (in[index+GlowA]*boost*intensity)/255);
-			} else{
+			}
+			else {
 				out[index+GlowR]=0;
 				out[index+GlowG]=0;
 				out[index+GlowB]=0;
@@ -2557,18 +2595,19 @@ static void RVIsolateHighlights_float (float* in, float* out,
 	float	intensity;
 
 
-	for(y=0;y< height;y++) {
+	for (y=0;y< height;y++) {
 		for (x=0;x< width;x++) {
 			index= (x+y*width)*4;
 
 			/*	Isolate the intensity */
 			intensity=(in[index+GlowR]+in[index+GlowG]+in[index+GlowB]-threshold);
-			if (intensity>0){
+			if (intensity>0) {
 				out[index+GlowR]=MIN2(clamp, (in[index+GlowR]*boost*intensity));
 				out[index+GlowG]=MIN2(clamp, (in[index+GlowG]*boost*intensity));
 				out[index+GlowB]=MIN2(clamp, (in[index+GlowB]*boost*intensity));
 				out[index+GlowA]=MIN2(clamp, (in[index+GlowA]*boost*intensity));
-			} else{
+			}
+			else {
 				out[index+GlowR]=0;
 				out[index+GlowG]=0;
 				out[index+GlowB]=0;
@@ -2582,7 +2621,7 @@ static void init_glow_effect(Sequence *seq)
 {
 	GlowVars *glow;
 
-	if(seq->effectdata)MEM_freeN(seq->effectdata);
+	if (seq->effectdata)MEM_freeN(seq->effectdata);
 	seq->effectdata = MEM_callocN(sizeof(struct GlowVars), "glowvars");
 
 	glow = (GlowVars *)seq->effectdata;
@@ -2601,7 +2640,7 @@ static int num_inputs_glow(void)
 
 static void free_glow_effect(Sequence *seq)
 {
-	if(seq->effectdata)MEM_freeN(seq->effectdata);
+	if (seq->effectdata)MEM_freeN(seq->effectdata);
 	seq->effectdata = NULL;
 }
 
@@ -2655,7 +2694,8 @@ static struct ImBuf * do_glow_effect(
 				     context.rectx, context.recty,
 				     ibuf1->rect_float, ibuf2->rect_float,
 				     out->rect_float);
-	} else {
+	}
+	else {
 		do_glow_effect_byte(seq, render_size,
 				    facf0, facf1, 
 				    context.rectx, context.recty,
@@ -2667,14 +2707,14 @@ static struct ImBuf * do_glow_effect(
 }
 
 /* **********************************************************************
-   SOLID COLOR
-   ********************************************************************** */
+ * SOLID COLOR
+ * ********************************************************************** */
 
 static void init_solid_color(Sequence *seq)
 {
 	SolidColorVars *cv;
 	
-	if(seq->effectdata)MEM_freeN(seq->effectdata);
+	if (seq->effectdata)MEM_freeN(seq->effectdata);
 	seq->effectdata = MEM_callocN(sizeof(struct SolidColorVars), "solidcolor");
 	
 	cv = (SolidColorVars *)seq->effectdata;
@@ -2688,7 +2728,7 @@ static int num_inputs_color(void)
 
 static void free_solid_color(Sequence *seq)
 {
-	if(seq->effectdata)MEM_freeN(seq->effectdata);
+	if (seq->effectdata)MEM_freeN(seq->effectdata);
 	seq->effectdata = NULL;
 }
 
@@ -2732,8 +2772,8 @@ static struct ImBuf * do_solid_color(
 
 		rect = (unsigned char *)out->rect;
 		
-		for(y=0; y<out->y; y++) {	
-			for(x=0; x<out->x; x++, rect+=4) {
+		for (y=0; y<out->y; y++) {	
+			for (x=0; x<out->x; x++, rect+=4) {
 				rect[0]= col0[0];
 				rect[1]= col0[1];
 				rect[2]= col0[2];
@@ -2741,7 +2781,7 @@ static struct ImBuf * do_solid_color(
 			}
 			y++;
 			if (y<out->y) {
-				for(x=0; x<out->x; x++, rect+=4) {
+				for (x=0; x<out->x; x++, rect+=4) {
 					rect[0]= col1[0];
 					rect[1]= col1[1];
 					rect[2]= col1[2];
@@ -2750,7 +2790,8 @@ static struct ImBuf * do_solid_color(
 			}
 		}
 
-	} else if (out->rect_float) {
+	}
+	else if (out->rect_float) {
 		float col0[3];
 		float col1[3];
 
@@ -2764,8 +2805,8 @@ static struct ImBuf * do_solid_color(
 
 		rect_float = out->rect_float;
 		
-		for(y=0; y<out->y; y++) {	
-			for(x=0; x<out->x; x++, rect_float+=4) {
+		for (y=0; y<out->y; y++) {	
+			for (x=0; x<out->x; x++, rect_float+=4) {
 				rect_float[0]= col0[0];
 				rect_float[1]= col0[1];
 				rect_float[2]= col0[2];
@@ -2773,7 +2814,7 @@ static struct ImBuf * do_solid_color(
 			}
 			y++;
 			if (y<out->y) {
-				for(x=0; x<out->x; x++, rect_float+=4) {
+				for (x=0; x<out->x; x++, rect_float+=4) {
 					rect_float[0]= col1[0];
 					rect_float[1]= col1[1];
 					rect_float[2]= col1[2];
@@ -2786,8 +2827,8 @@ static struct ImBuf * do_solid_color(
 }
 
 /* **********************************************************************
-   MULTICAM
-   ********************************************************************** */
+ * MULTICAM
+ * ********************************************************************** */
 
 /* no effect inputs for multicam, we use give_ibuf_seq */
 static int num_inputs_multicam(void)
@@ -2832,7 +2873,8 @@ static struct ImBuf * do_multicam(
 	if (input_have_to_preprocess(context, seq, cfra)) {
 		out = IMB_dupImBuf(i);
 		IMB_freeImBuf(i);
-	} else {
+	}
+	else {
 		out = i;
 	}
 	
@@ -2840,8 +2882,8 @@ static struct ImBuf * do_multicam(
 }
 
 /* **********************************************************************
-   ADJUSTMENT
-   ********************************************************************** */
+ * ADJUSTMENT
+ * ********************************************************************** */
 
 /* no effect inputs for adjustment, we use give_ibuf_seq */
 static int num_inputs_adjustment(void)
@@ -2871,10 +2913,10 @@ static struct ImBuf * do_adjustment_impl(SeqRenderData context, Sequence * seq,
 	}
 
 	/* found nothing? so let's work the way up the metastrip stack, so
-	   that it is possible to group a bunch of adjustment strips into
-	   a metastrip and have that work on everything below the metastrip
-	*/
-	   
+	 *  that it is possible to group a bunch of adjustment strips into
+	 *  a metastrip and have that work on everything below the metastrip
+	 */
+
 	if (!i) {
 		Sequence * meta;
 
@@ -2909,7 +2951,8 @@ static struct ImBuf * do_adjustment(
 	if (input_have_to_preprocess(context, seq, cfra)) {
 		out = IMB_dupImBuf(i);
 		IMB_freeImBuf(i);
-	} else {
+	}
+	else {
 		out = i;
 	}
 	
@@ -2917,13 +2960,13 @@ static struct ImBuf * do_adjustment(
 }
 
 /* **********************************************************************
-   SPEED
-   ********************************************************************** */
+ * SPEED
+ * ********************************************************************** */
 static void init_speed_effect(Sequence *seq)
 {
 	SpeedControlVars * v;
 
-	if(seq->effectdata) MEM_freeN(seq->effectdata);
+	if (seq->effectdata) MEM_freeN(seq->effectdata);
 	seq->effectdata = MEM_callocN(sizeof(struct SpeedControlVars), 
 					  "speedcontrolvars");
 
@@ -2950,8 +2993,8 @@ static int num_inputs_speed(void)
 static void free_speed_effect(Sequence *seq)
 {
 	SpeedControlVars * v = (SpeedControlVars *)seq->effectdata;
-	if(v->frameMap) MEM_freeN(v->frameMap);
-	if(seq->effectdata) MEM_freeN(seq->effectdata);
+	if (v->frameMap) MEM_freeN(v->frameMap);
+	if (seq->effectdata) MEM_freeN(seq->effectdata);
 	seq->effectdata = NULL;
 }
 
@@ -2981,11 +3024,13 @@ static void store_icu_yrange_speed(struct Sequence * seq,
 	if ((v->flags & SEQ_SPEED_INTEGRATE) != 0) {
 		*ymin = -100.0;
 		*ymax = 100.0;
-	} else {
+	}
+	else {
 		if (v->flags & SEQ_SPEED_COMPRESS_IPO_Y) {
 			*ymin = 0.0;
 			*ymax = 1.0;
-		} else {
+		}
+		else {
 			*ymin = 0.0;
 			*ymax = seq->len;
 		}
@@ -3010,8 +3055,7 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force)
 	}
 	if (	(seq->seq1 == NULL) ||
 	        (seq->len < 1)
-	) { /* make coverity happy and check for (CID 598)
-						 input strip ... */
+	) { /* make coverity happy and check for (CID 598) input strip ... */
 		return;
 	}
 
@@ -3032,14 +3076,16 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force)
 	fallback_fac = 1.0;
 
 	if (seq->flag & SEQ_USE_EFFECT_DEFAULT_FADE) {
-		if (seq->seq1->enddisp != seq->seq1->start
-		    && seq->seq1->len != 0) {
+		if ((seq->seq1->enddisp != seq->seq1->start) &&
+		    (seq->seq1->len != 0))
+		{
 			fallback_fac = (float) seq->seq1->len / 
 				(float) (seq->seq1->enddisp - seq->seq1->start);
 			flags = SEQ_SPEED_INTEGRATE;
 			fcu = NULL;
 		}
-	} else {
+	}
+	else {
 		/* if there is no fcurve, use value as simple multiplier */
 		if (!fcu) {
 			fallback_fac = seq->speed_fader; /* same as speed_factor in rna*/
@@ -3054,9 +3100,10 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force)
 		v->lastValidFrame = 0;
 
 		for (cfra = 1; cfra < v->length; cfra++) {
-			if(fcu) {
+			if (fcu) {
 				facf = evaluate_fcurve(fcu, seq->startdisp + cfra);
-			} else {
+			}
+			else {
 				facf = fallback_fac;
 			}
 			facf *= v->globalSpeed;
@@ -3065,20 +3112,23 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force)
 
 			if (cursor >= seq->seq1->len) {
 				v->frameMap[cfra] = seq->seq1->len - 1;
-			} else {
+			}
+			else {
 				v->frameMap[cfra] = cursor;
 				v->lastValidFrame = cfra;
 			}
 		}
-	} else {
+	}
+	else {
 		float facf;
 
 		v->lastValidFrame = 0;
 		for (cfra = 0; cfra < v->length; cfra++) {
 
-			if(fcu) {
+			if (fcu) {
 				facf = evaluate_fcurve(fcu, seq->startdisp + cfra);
-			} else {
+			}
+			else {
 				facf = fallback_fac;
 			}
 
@@ -3089,7 +3139,8 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force)
 			
 			if (facf >= seq->seq1->len) {
 				facf = seq->seq1->len - 1;
-			} else {
+			}
+			else {
 				v->lastValidFrame = cfra;
 			}
 			v->frameMap[cfra] = facf;
@@ -3098,8 +3149,8 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force)
 }
 
 /* **********************************************************************
-   sequence effect factory
-   ********************************************************************** */
+ * sequence effect factory
+ * ********************************************************************** */
 
 
 static void init_noop(struct Sequence *UNUSED(seq))
@@ -3138,7 +3189,8 @@ static int early_out_fade(struct Sequence *UNUSED(seq),
 {
 	if (facf0 == 0.0f && facf1 == 0.0f) {
 		return 1;
-	} else if (facf0 == 1.0f && facf1 == 1.0f) {
+	}
+	else if (facf0 == 1.0f && facf1 == 1.0f) {
 		return 2;
 	}
 	return 0;
@@ -3195,7 +3247,8 @@ static struct ImBuf * do_overdrop_effect(SeqRenderData context,
 			facf0, facf1, x, y,
 			ibuf1->rect_float, ibuf2->rect_float,
 			out->rect_float);
-	} else {
+	}
+	else {
 		do_drop_effect_byte(
 			facf0, facf1, x, y,
 			(char*) ibuf1->rect, 
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 0790896..2d4397d 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -39,6 +39,7 @@
 #include "MEM_CacheLimiterC-Api.h"
 
 #include "DNA_sequence_types.h"
+#include "DNA_movieclip_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_anim_types.h"
 #include "DNA_object_types.h"
@@ -57,6 +58,7 @@
 #include "BKE_image.h"
 #include "BKE_main.h"
 #include "BKE_sequencer.h"
+#include "BKE_movieclip.h"
 #include "BKE_fcurve.h"
 #include "BKE_scene.h"
 #include "BKE_utildefines.h"
@@ -77,11 +79,11 @@
 #  include "AUD_C-API.h"
 #endif
 
-static ImBuf* seq_render_strip_stack( 
-	SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown);
+static ImBuf *seq_render_strip_stack(
+        SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown);
 
-static ImBuf * seq_render_strip(
-	SeqRenderData context, Sequence * seq, float cfra);
+static ImBuf *seq_render_strip(
+        SeqRenderData context, Sequence *seq, float cfra);
 
 static void seq_free_animdata(Scene *scene, Sequence *seq);
 
@@ -90,52 +92,42 @@ static void seq_free_animdata(Scene *scene, Sequence *seq);
 #define SELECT 1
 ListBase seqbase_clipboard;
 int seqbase_clipboard_frame;
-SequencerDrawView sequencer_view3d_cb= NULL; /* NULL in background mode */
+SequencerDrawView sequencer_view3d_cb = NULL; /* NULL in background mode */
 
 
 void printf_strip(Sequence *seq)
 {
 	fprintf(stderr, "name: '%s', len:%d, start:%d, (startofs:%d, endofs:%d), (startstill:%d, endstill:%d), machine:%d, (startdisp:%d, enddisp:%d)\n",
-			seq->name, seq->len, seq->start, seq->startofs, seq->endofs, seq->startstill, seq->endstill, seq->machine, seq->startdisp, seq->enddisp);
+	        seq->name, seq->len, seq->start, seq->startofs, seq->endofs, seq->startstill, seq->endstill, seq->machine, seq->startdisp, seq->enddisp);
 	fprintf(stderr, "\tseq_tx_set_final_left: %d %d\n\n", seq_tx_get_final_left(seq, 0), seq_tx_get_final_right(seq, 0));
 }
 
 int seqbase_recursive_apply(ListBase *seqbase, int (*apply_func)(Sequence *seq, void *), void *arg)
 {
 	Sequence *iseq;
-	for(iseq= seqbase->first; iseq; iseq= iseq->next) {
-		if(seq_recursive_apply(iseq, apply_func, arg) == -1)
-			return -1; /* bail out */
+	for (iseq = seqbase->first; iseq; iseq = iseq->next) {
+		if (seq_recursive_apply(iseq, apply_func, arg) == -1)
+			return -1;  /* bail out */
 	}
 	return 1;
 }
 
 int seq_recursive_apply(Sequence *seq, int (*apply_func)(Sequence *, void *), void *arg)
 {
-	int ret= apply_func(seq, arg);
+	int ret = apply_func(seq, arg);
 
-	if(ret == -1)
+	if (ret == -1)
 		return -1;  /* bail out */
 
-	if(ret && seq->seqbase.first)
+	if (ret && seq->seqbase.first)
 		ret = seqbase_recursive_apply(&seq->seqbase, apply_func, arg);
 
 	return ret;
 }
 
 /* **********************************************************************
-   alloc / free functions
-   ********************************************************************** */
-
-
-
-void new_tstripdata(Sequence *seq)
-{
-	if(seq->strip) {
-		seq->strip->len= seq->len;
-	}
-}
-
+ * alloc / free functions
+ * ********************************************************************** */
 
 /* free */
 
@@ -150,8 +142,8 @@ static void free_proxy_seq(Sequence *seq)
 void seq_free_strip(Strip *strip)
 {
 	strip->us--;
-	if(strip->us>0) return;
-	if(strip->us<0) {
+	if (strip->us > 0) return;
+	if (strip->us < 0) {
 		printf("error: negative users in strip\n");
 		return;
 	}
@@ -182,9 +174,9 @@ void seq_free_strip(Strip *strip)
 
 void seq_free_sequence(Scene *scene, Sequence *seq)
 {
-	if(seq->strip) seq_free_strip(seq->strip);
+	if (seq->strip) seq_free_strip(seq->strip);
 
-	if(seq->anim) IMB_free_anim(seq->anim);
+	if (seq->anim) IMB_free_anim(seq->anim);
 
 	if (seq->type & SEQ_EFFECT) {
 		struct SeqEffectHandle sh = get_sequence_effect(seq);
@@ -192,18 +184,18 @@ void seq_free_sequence(Scene *scene, Sequence *seq)
 		sh.free(seq);
 	}
 
-	if(seq->sound) {
+	if (seq->sound) {
 		((ID *)seq->sound)->us--; 
 	}
 
 	/* clipboard has no scene and will never have a sound handle or be active */
-	if(scene) {
+	if (scene) {
 		Editing *ed = scene->ed;
 
-		if (ed->act_seq==seq)
-			ed->act_seq= NULL;
+		if (ed->act_seq == seq)
+			ed->act_seq = NULL;
 
-		if(seq->scene_sound && ELEM(seq->type, SEQ_SOUND, SEQ_SCENE))
+		if (seq->scene_sound && ELEM(seq->type, SEQ_SOUND, SEQ_SCENE))
 			sound_remove_scene_sound(scene, seq->scene_sound);
 
 		seq_free_animdata(scene, seq);
@@ -216,7 +208,7 @@ void seq_free_sequence_recurse(Scene *scene, Sequence *seq)
 {
 	Sequence *iseq;
 
-	for(iseq= seq->seqbase.first; iseq; iseq= iseq->next) {
+	for (iseq = seq->seqbase.first; iseq; iseq = iseq->next) {
 		seq_free_sequence_recurse(scene, iseq);
 	}
 
@@ -229,8 +221,8 @@ Editing *seq_give_editing(Scene *scene, int alloc)
 	if (scene->ed == NULL && alloc) {
 		Editing *ed;
 
-		ed= scene->ed= MEM_callocN( sizeof(Editing), "addseq");
-		ed->seqbasep= &ed->seqbase;
+		ed = scene->ed = MEM_callocN(sizeof(Editing), "addseq");
+		ed->seqbasep = &ed->seqbase;
 	}
 	return scene->ed;
 }
@@ -239,8 +231,8 @@ static void seq_free_clipboard_recursive(Sequence *seq_parent)
 {
 	Sequence *seq, *nseq;
 
-	for(seq= seq_parent->seqbase.first; seq; seq= nseq) {
-		nseq= seq->next;
+	for (seq = seq_parent->seqbase.first; seq; seq = nseq) {
+		nseq = seq->next;
 		seq_free_clipboard_recursive(seq);
 	}
 
@@ -251,11 +243,11 @@ void seq_free_clipboard(void)
 {
 	Sequence *seq, *nseq;
 
-	for(seq= seqbase_clipboard.first; seq; seq= nseq) {
-		nseq= seq->next;
+	for (seq = seqbase_clipboard.first; seq; seq = nseq) {
+		nseq = seq->next;
 		seq_free_clipboard_recursive(seq);
 	}
-	seqbase_clipboard.first= seqbase_clipboard.last= NULL;
+	seqbase_clipboard.first = seqbase_clipboard.last = NULL;
 }
 
 void seq_free_editing(Scene *scene)
@@ -264,15 +256,16 @@ void seq_free_editing(Scene *scene)
 	MetaStack *ms;
 	Sequence *seq;
 
-	if(ed==NULL)
+	if (ed == NULL)
 		return;
 
-	SEQ_BEGIN(ed, seq) {
+	SEQ_BEGIN(ed, seq)
+	{
 		seq_free_sequence(scene, seq);
 	}
 	SEQ_END
 
-	while((ms= ed->metastack.first)) {
+	while ((ms = ed->metastack.first)) {
 		BLI_remlink(&ed->metastack, ms);
 		MEM_freeN(ms);
 	}
@@ -281,12 +274,12 @@ void seq_free_editing(Scene *scene)
 }
 
 /* **********************************************************************
-   * sequencer pipeline functions
-   ********************************************************************** */
+ * sequencer pipeline functions
+ * ********************************************************************** */
 
 SeqRenderData seq_new_render_data(
-	struct Main * bmain, struct Scene * scene,
-	int rectx, int recty, int preview_render_size)
+        struct Main *bmain, struct Scene *scene,
+        int rectx, int recty, int preview_render_size)
 {
 	SeqRenderData rval;
 
@@ -301,7 +294,7 @@ SeqRenderData seq_new_render_data(
 	return rval;
 }
 
-int seq_cmp_render_data(const SeqRenderData * a, const SeqRenderData * b)
+int seq_cmp_render_data(const SeqRenderData *a, const SeqRenderData *b)
 {
 	if (a->preview_render_size < b->preview_render_size) {
 		return -1;
@@ -355,14 +348,14 @@ int seq_cmp_render_data(const SeqRenderData * a, const SeqRenderData * b)
 	return 0;
 }
 
-unsigned int seq_hash_render_data(const SeqRenderData * a)
+unsigned int seq_hash_render_data(const SeqRenderData *a)
 {
 	unsigned int rval = a->rectx + a->recty;
 
 	rval ^= a->preview_render_size;
 	rval ^= ((intptr_t) a->bmain) << 6;
 	rval ^= ((intptr_t) a->scene) << 6;
-	rval ^= (int) (a->motion_blur_shutter * 100.0f) << 10;
+	rval ^= (int)(a->motion_blur_shutter * 100.0f) << 10;
 	rval ^= a->motion_blur_samples << 24;
 	
 	return rval;
@@ -379,10 +372,10 @@ static void seq_count(ListBase *seqbase, int *tot)
 {
 	Sequence *seq;
 
-	for(seq=seqbase->first; seq; seq=seq->next) {
+	for (seq = seqbase->first; seq; seq = seq->next) {
 		(*tot)++;
 
-		if(seq->seqbase.first)
+		if (seq->seqbase.first)
 			seq_count(&seq->seqbase, tot);
 	}
 }
@@ -391,13 +384,13 @@ static void seq_build_array(ListBase *seqbase, Sequence ***array, int depth)
 {
 	Sequence *seq;
 
-	for(seq=seqbase->first; seq; seq=seq->next) {
-		seq->depth= depth;
+	for (seq = seqbase->first; seq; seq = seq->next) {
+		seq->depth = depth;
 
-		if(seq->seqbase.first)
-			seq_build_array(&seq->seqbase, array, depth+1);
+		if (seq->seqbase.first)
+			seq_build_array(&seq->seqbase, array, depth + 1);
 
-		**array= seq;
+		**array = seq;
 		(*array)++;
 	}
 }
@@ -406,22 +399,22 @@ void seq_array(Editing *ed, Sequence ***seqarray, int *tot, int use_pointer)
 {
 	Sequence **array;
 
-	*seqarray= NULL;
-	*tot= 0;
+	*seqarray = NULL;
+	*tot = 0;
 
-	if(ed == NULL)
+	if (ed == NULL)
 		return;
 
-	if(use_pointer)
+	if (use_pointer)
 		seq_count(ed->seqbasep, tot);
 	else
 		seq_count(&ed->seqbase, tot);
 
-	if(*tot == 0)
+	if (*tot == 0)
 		return;
 
-	*seqarray= array= MEM_mallocN(sizeof(Sequence *)*(*tot), "SeqArray");
-	if(use_pointer)
+	*seqarray = array = MEM_mallocN(sizeof(Sequence *) * (*tot), "SeqArray");
+	if (use_pointer)
 		seq_build_array(ed->seqbasep, &array, 0);
 	else
 		seq_build_array(&ed->seqbase, &array, 0);
@@ -432,94 +425,94 @@ void seq_begin(Editing *ed, SeqIterator *iter, int use_pointer)
 	memset(iter, 0, sizeof(*iter));
 	seq_array(ed, &iter->array, &iter->tot, use_pointer);
 
-	if(iter->tot) {
-		iter->cur= 0;
-		iter->seq= iter->array[iter->cur];
-		iter->valid= 1;
+	if (iter->tot) {
+		iter->cur = 0;
+		iter->seq = iter->array[iter->cur];
+		iter->valid = 1;
 	}
 }
 
 void seq_next(SeqIterator *iter)
 {
-	if(++iter->cur < iter->tot)
-		iter->seq= iter->array[iter->cur];
+	if (++iter->cur < iter->tot)
+		iter->seq = iter->array[iter->cur];
 	else
-		iter->valid= 0;
+		iter->valid = 0;
 }
 
 void seq_end(SeqIterator *iter)
 {
-	if(iter->array)
+	if (iter->array)
 		MEM_freeN(iter->array);
 
-	iter->valid= 0;
+	iter->valid = 0;
 }
 
 /*
-  **********************************************************************
-  * build_seqar
-  **********************************************************************
-  * Build a complete array of _all_ sequencies (including those
-  * in metastrips!)
-  **********************************************************************
-*/
+ * **********************************************************************
+ * build_seqar
+ * *********************************************************************
+ * Build a complete array of _all_ sequencies (including those
+ * in metastrips!)
+ * *********************************************************************
+ */
 
 static void do_seq_count_cb(ListBase *seqbase, int *totseq,
-				int (*test_func)(Sequence * seq))
+                            int (*test_func)(Sequence *seq))
 {
 	Sequence *seq;
 
-	seq= seqbase->first;
-	while(seq) {
+	seq = seqbase->first;
+	while (seq) {
 		int test = test_func(seq);
 		if (test & BUILD_SEQAR_COUNT_CURRENT) {
 			(*totseq)++;
 		}
-		if(seq->seqbase.first && (test & BUILD_SEQAR_COUNT_CHILDREN)) {
+		if (seq->seqbase.first && (test & BUILD_SEQAR_COUNT_CHILDREN)) {
 			do_seq_count_cb(&seq->seqbase, totseq, test_func);
 		}
-		seq= seq->next;
+		seq = seq->next;
 	}
 }
 
 static void do_build_seqar_cb(ListBase *seqbase, Sequence ***seqar, int depth,
-				  int (*test_func)(Sequence * seq))
+                              int (*test_func)(Sequence *seq))
 {
 	Sequence *seq;
 
-	seq= seqbase->first;
-	while(seq) {
+	seq = seqbase->first;
+	while (seq) {
 		int test = test_func(seq);
-		seq->depth= depth;
+		seq->depth = depth;
 
-		if(seq->seqbase.first && (test & BUILD_SEQAR_COUNT_CHILDREN)) {
-			do_build_seqar_cb(&seq->seqbase, seqar, depth+1, test_func);
+		if (seq->seqbase.first && (test & BUILD_SEQAR_COUNT_CHILDREN)) {
+			do_build_seqar_cb(&seq->seqbase, seqar, depth + 1, test_func);
 		}
 		if (test & BUILD_SEQAR_COUNT_CURRENT) {
-			**seqar= seq;
+			**seqar = seq;
 			(*seqar)++;
 		}
-		seq= seq->next;
+		seq = seq->next;
 	}
 }
 
 void build_seqar_cb(ListBase *seqbase, Sequence  ***seqar, int *totseq,
-			int (*test_func)(Sequence * seq))
+                    int (*test_func)(Sequence *seq))
 {
 	Sequence **tseqar;
 
-	*totseq= 0;
+	*totseq = 0;
 	do_seq_count_cb(seqbase, totseq, test_func);
 
-	if(*totseq==0) {
-		*seqar= NULL;
+	if (*totseq == 0) {
+		*seqar = NULL;
 		return;
 	}
-	*seqar= MEM_mallocN(sizeof(void *)* *totseq, "seqar");
-	tseqar= *seqar;
+	*seqar = MEM_mallocN(sizeof(void *) * *totseq, "seqar");
+	tseqar = *seqar;
 
 	do_build_seqar_cb(seqbase, seqar, 0, test_func);
-	*seqar= tseqar;
+	*seqar = tseqar;
 }
 
 
@@ -529,20 +522,20 @@ static void seq_update_sound_bounds_recursive(Scene *scene, Sequence *metaseq)
 
 	/* for sound we go over full meta tree to update bounds of the sound strips,
 	 * since sound is played outside of evaluating the imbufs, */
-	for(seq=metaseq->seqbase.first; seq; seq=seq->next) {
-		if(seq->type == SEQ_META) {
+	for (seq = metaseq->seqbase.first; seq; seq = seq->next) {
+		if (seq->type == SEQ_META) {
 			seq_update_sound_bounds_recursive(scene, seq);
 		}
-		else if(ELEM(seq->type, SEQ_SOUND, SEQ_SCENE)) {
-			if(seq->scene_sound) {
+		else if (ELEM(seq->type, SEQ_SOUND, SEQ_SCENE)) {
+			if (seq->scene_sound) {
 				int startofs = seq->startofs;
 				int endofs = seq->endofs;
-				if(seq->startofs + seq->start < metaseq->start + metaseq->startofs)
+				if (seq->startofs + seq->start < metaseq->start + metaseq->startofs)
 					startofs = metaseq->start + metaseq->startofs - seq->start;
 
-				if(seq->start + seq->len - seq->endofs > metaseq->start + metaseq->len - metaseq->endofs)
+				if (seq->start + seq->len - seq->endofs > metaseq->start + metaseq->len - metaseq->endofs)
 					endofs = seq->start + seq->len - metaseq->start - metaseq->len + metaseq->endofs;
-				sound_move_scene_sound(scene, seq->scene_sound, seq->start + startofs, seq->start+seq->len - endofs, startofs);
+				sound_move_scene_sound(scene, seq->scene_sound, seq->start + startofs, seq->start + seq->len - endofs, startofs);
 			}
 		}
 	}
@@ -550,24 +543,24 @@ static void seq_update_sound_bounds_recursive(Scene *scene, Sequence *metaseq)
 
 void calc_sequence_disp(Scene *scene, Sequence *seq)
 {
-	if(seq->startofs && seq->startstill) seq->startstill= 0;
-	if(seq->endofs && seq->endstill) seq->endstill= 0;
+	if (seq->startofs && seq->startstill) seq->startstill = 0;
+	if (seq->endofs && seq->endstill) seq->endstill = 0;
 	
-	seq->startdisp= seq->start + seq->startofs - seq->startstill;
-	seq->enddisp= seq->start+seq->len - seq->endofs + seq->endstill;
+	seq->startdisp = seq->start + seq->startofs - seq->startstill;
+	seq->enddisp = seq->start + seq->len - seq->endofs + seq->endstill;
 	
-	seq->handsize= 10.0;	/* 10 frames */
-	if( seq->enddisp-seq->startdisp < 10 ) {
-		seq->handsize= (float)(0.5*(seq->enddisp-seq->startdisp));
+	seq->handsize = 10.0;  /* 10 frames */
+	if (seq->enddisp - seq->startdisp < 10) {
+		seq->handsize = (float)(0.5 * (seq->enddisp - seq->startdisp));
 	}
-	else if(seq->enddisp-seq->startdisp > 250) {
-		seq->handsize= (float)((seq->enddisp-seq->startdisp)/25);
+	else if (seq->enddisp - seq->startdisp > 250) {
+		seq->handsize = (float)((seq->enddisp - seq->startdisp) / 25);
 	}
 
-	if(ELEM(seq->type, SEQ_SOUND, SEQ_SCENE)) {
+	if (ELEM(seq->type, SEQ_SOUND, SEQ_SCENE)) {
 		seq_update_sound_bounds(scene, seq);
 	}
-	else if(seq->type == SEQ_META)
+	else if (seq->type == SEQ_META)
 		seq_update_sound_bounds_recursive(scene, seq);
 }
 
@@ -577,18 +570,18 @@ void calc_sequence(Scene *scene, Sequence *seq)
 	int min, max;
 
 	/* check all metas recursively */
-	seqm= seq->seqbase.first;
-	while(seqm) {
-		if(seqm->seqbase.first) calc_sequence(scene, seqm);
-		seqm= seqm->next;
+	seqm = seq->seqbase.first;
+	while (seqm) {
+		if (seqm->seqbase.first) calc_sequence(scene, seqm);
+		seqm = seqm->next;
 	}
 
 	/* effects and meta: automatic start and end */
 
-	if(seq->type & SEQ_EFFECT) {
+	if (seq->type & SEQ_EFFECT) {
 		/* pointers */
-		if(seq->seq2==NULL) seq->seq2= seq->seq1;
-		if(seq->seq3==NULL) seq->seq3= seq->seq1;
+		if (seq->seq2 == NULL) seq->seq2 = seq->seq1;
+		if (seq->seq3 == NULL) seq->seq3 = seq->seq1;
 
 		/* effecten go from seq1 -> seq2: test */
 
@@ -599,53 +592,44 @@ void calc_sequence(Scene *scene, Sequence *seq)
 
 		if (seq->seq1) {
 			/* XXX These resets should not be necessary, but users used to be able to
-			 *     edit effect's length, leading to strange results. See #29190. */
+			 *     edit effect's length, leading to strange results. See [#29190] */
 			seq->startofs = seq->endofs = seq->startstill = seq->endstill = 0;
-			seq->start= seq->startdisp= MAX3(seq->seq1->startdisp, seq->seq2->startdisp, seq->seq3->startdisp);
-			seq->enddisp= MIN3(seq->seq1->enddisp, seq->seq2->enddisp, seq->seq3->enddisp);
+			seq->start = seq->startdisp = MAX3(seq->seq1->startdisp, seq->seq2->startdisp, seq->seq3->startdisp);
+			seq->enddisp = MIN3(seq->seq1->enddisp, seq->seq2->enddisp, seq->seq3->enddisp);
 			/* we cant help if strips don't overlap, it wont give useful results.
 			 * but at least ensure 'len' is never negative which causes bad bugs elsewhere. */
-			if(seq->enddisp < seq->startdisp) {
+			if (seq->enddisp < seq->startdisp) {
 				/* simple start/end swap */
-				seq->start= seq->enddisp;
+				seq->start = seq->enddisp;
 				seq->enddisp = seq->startdisp;
-				seq->startdisp= seq->start;
+				seq->startdisp = seq->start;
 				seq->flag |= SEQ_INVALID_EFFECT;
 			}
 			else {
 				seq->flag &= ~SEQ_INVALID_EFFECT;
 			}
 
-			seq->len= seq->enddisp - seq->startdisp;
+			seq->len = seq->enddisp - seq->startdisp;
 		}
 		else {
 			calc_sequence_disp(scene, seq);
 		}
-
-		if(seq->strip && seq->len!=seq->strip->len) {
-			new_tstripdata(seq);
-		}
-
 	}
 	else {
-		if(seq->type==SEQ_META) {
-			seqm= seq->seqbase.first;
-			if(seqm) {
-				min=  MAXFRAME * 2;
-				max= -MAXFRAME * 2;
-				while(seqm) {
-					if(seqm->startdisp < min) min= seqm->startdisp;
-					if(seqm->enddisp > max) max= seqm->enddisp;
-					seqm= seqm->next;
+		if (seq->type == SEQ_META) {
+			seqm = seq->seqbase.first;
+			if (seqm) {
+				min =  MAXFRAME * 2;
+				max = -MAXFRAME * 2;
+				while (seqm) {
+					if (seqm->startdisp < min) min = seqm->startdisp;
+					if (seqm->enddisp > max) max = seqm->enddisp;
+					seqm = seqm->next;
 				}
-				seq->start= min + seq->anim_startofs;
-				seq->len = max-min;
+				seq->start = min + seq->anim_startofs;
+				seq->len = max - min;
 				seq->len -= seq->anim_startofs;
 				seq->len -= seq->anim_endofs;
-
-				if(seq->strip && seq->len!=seq->strip->len) {
-					new_tstripdata(seq);
-				}
 			}
 			seq_update_sound_bounds_recursive(scene, seq);
 		}
@@ -654,115 +638,100 @@ void calc_sequence(Scene *scene, Sequence *seq)
 }
 
 /* note: caller should run calc_sequence(scene, seq) after */
-void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range)
+void reload_sequence_new_file(Scene *scene, Sequence *seq, int lock_range)
 {
 	char str[FILE_MAX];
-	int prev_startdisp=0, prev_enddisp=0;
-	/* note: dont rename the strip, will break animation curves */
+	int prev_startdisp = 0, prev_enddisp = 0;
+	/* note: don't rename the strip, will break animation curves */
 
-	if (ELEM5(seq->type, SEQ_MOVIE, SEQ_IMAGE, SEQ_SOUND, SEQ_SCENE, SEQ_META)==0) {
+	if (ELEM6(seq->type, SEQ_MOVIE, SEQ_IMAGE, SEQ_SOUND, SEQ_SCENE, SEQ_META, SEQ_MOVIECLIP) == 0) {
 		return;
 	}
 
-	if(lock_range) {
-		/* keep so we dont have to move the actual start and end points (only the data) */
+	if (lock_range) {
+		/* keep so we don't have to move the actual start and end points (only the data) */
 		calc_sequence_disp(scene, seq);
-		prev_startdisp= seq->startdisp;
-		prev_enddisp= seq->enddisp;
+		prev_startdisp = seq->startdisp;
+		prev_enddisp = seq->enddisp;
 	}
 
+	switch (seq->type) {
+		case SEQ_IMAGE:
+		{
+			/* Hack? */
+			size_t olen = MEM_allocN_len(seq->strip->stripdata) / sizeof(struct StripElem);
+
+			seq->len = olen;
+			seq->len -= seq->anim_startofs;
+			seq->len -= seq->anim_endofs;
+			if (seq->len < 0) {
+				seq->len = 0;
+			}
+			break;
+		}
+		case SEQ_MOVIE:
+			BLI_join_dirfile(str, sizeof(str), seq->strip->dir,
+			                 seq->strip->stripdata->name);
+			BLI_path_abs(str, G.main->name);
 
-	new_tstripdata(seq);
-
-	if (ELEM3(seq->type, SEQ_SCENE, SEQ_META, SEQ_IMAGE)==0) {
-		BLI_join_dirfile(str, sizeof(str), seq->strip->dir, seq->strip->stripdata->name);
-		BLI_path_abs(str, G.main->name);
-	}
-
-	switch(seq->type) {
-	case SEQ_IMAGE:
-	{
-		/* Hack? */
-		size_t olen = MEM_allocN_len(seq->strip->stripdata)/sizeof(struct StripElem);
+			if (seq->anim) IMB_free_anim(seq->anim);
+			seq->anim = openanim(str, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), seq->streamindex);
 
-		seq->len = olen;
-		seq->len -= seq->anim_startofs;
-		seq->len -= seq->anim_endofs;
-		if (seq->len < 0) {
-			seq->len = 0;
-		}
-		seq->strip->len = seq->len;
-		break;
-	}
-	case SEQ_MOVIE:
-		if(seq->anim) IMB_free_anim(seq->anim);
-		seq->anim = openanim(str, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), seq->streamindex);
+			if (!seq->anim) {
+				return;
+			}
 
-		if (!seq->anim) {
-			return;
-		}
+			seq->len = IMB_anim_get_duration(seq->anim,
+			                                 seq->strip->proxy ?
+			                                 seq->strip->proxy->tc :
+			                                 IMB_TC_RECORD_RUN);
 	
-		seq->len = IMB_anim_get_duration(seq->anim,
-						 seq->strip->proxy ?
-						 seq->strip->proxy->tc :
-						 IMB_TC_RECORD_RUN);
-		
-		seq->anim_preseek = IMB_anim_get_preseek(seq->anim);
+			seq->anim_preseek = IMB_anim_get_preseek(seq->anim);
 
-		seq->len -= seq->anim_startofs;
-		seq->len -= seq->anim_endofs;
-		if (seq->len < 0) {
-			seq->len = 0;
-		}
-		seq->strip->len = seq->len;
-		break;
-	case SEQ_SOUND:
+			seq->len -= seq->anim_startofs;
+			seq->len -= seq->anim_endofs;
+			if (seq->len < 0) {
+				seq->len = 0;
+			}
+			break;
+		case SEQ_MOVIECLIP:
+			seq->len = BKE_movieclip_get_duration(seq->clip);
+
+			seq->len -= seq->anim_startofs;
+			seq->len -= seq->anim_endofs;
+			if (seq->len < 0) {
+				seq->len = 0;
+			}
+			break;
+		case SEQ_SOUND:
 #ifdef WITH_AUDASPACE
-		if(!seq->sound)
-			return;
-		seq->len = ceil(AUD_getInfo(seq->sound->playback_handle).length * FPS);
-		seq->len -= seq->anim_startofs;
-		seq->len -= seq->anim_endofs;
-		if (seq->len < 0) {
-			seq->len = 0;
-		}
-		seq->strip->len = seq->len;
+			if (!seq->sound)
+				return;
+			seq->len = ceil(AUD_getInfo(seq->sound->playback_handle).length * FPS);
+			seq->len -= seq->anim_startofs;
+			seq->len -= seq->anim_endofs;
+			if (seq->len < 0) {
+				seq->len = 0;
+			}
 #else
-		return;
+			return;
 #endif
-		break;
-	case SEQ_SCENE:
-	{
-		/* 'seq->scenenr' should be replaced with something more reliable */
-		Scene * sce = G.main->scene.first;
-		int nr = 1;
-		
-		while(sce) {
-			if(nr == seq->scenenr) {
-				break;
+			break;
+		case SEQ_SCENE:
+		{
+			seq->len = (seq->scene) ? seq->scene->r.efra - seq->scene->r.sfra + 1 : 0;
+			seq->len -= seq->anim_startofs;
+			seq->len -= seq->anim_endofs;
+			if (seq->len < 0) {
+				seq->len = 0;
 			}
-			nr++;
-			sce= sce->id.next;
-		}
-
-		if (sce) {
-			seq->scene = sce;
-		}
-
-		seq->len= (seq->scene)? seq->scene->r.efra - seq->scene->r.sfra + 1: 0;
-		seq->len -= seq->anim_startofs;
-		seq->len -= seq->anim_endofs;
-		if (seq->len < 0) {
-			seq->len = 0;
+			break;
 		}
-		seq->strip->len = seq->len;
-		break;
-	}
 	}
 
 	free_proxy_seq(seq);
 
-	if(lock_range) {
+	if (lock_range) {
 		seq_tx_set_final_left(seq, prev_startdisp);
 		seq_tx_set_final_right(seq, prev_enddisp);
 		seq_single_fix(seq);
@@ -775,51 +744,51 @@ void sort_seq(Scene *scene)
 {
 	/* all strips together per kind, and in order of y location ("machine") */
 	ListBase seqbase, effbase;
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	Sequence *seq, *seqt;
 
 	
-	if(ed==NULL) return;
+	if (ed == NULL) return;
 
-	seqbase.first= seqbase.last= NULL;
-	effbase.first= effbase.last= NULL;
+	seqbase.first = seqbase.last = NULL;
+	effbase.first = effbase.last = NULL;
 
-	while( (seq= ed->seqbasep->first) ) {
+	while ( (seq = ed->seqbasep->first) ) {
 		BLI_remlink(ed->seqbasep, seq);
 
-		if(seq->type & SEQ_EFFECT) {
-			seqt= effbase.first;
-			while(seqt) {
-				if(seqt->machine>=seq->machine) {
+		if (seq->type & SEQ_EFFECT) {
+			seqt = effbase.first;
+			while (seqt) {
+				if (seqt->machine >= seq->machine) {
 					BLI_insertlinkbefore(&effbase, seqt, seq);
 					break;
 				}
-				seqt= seqt->next;
+				seqt = seqt->next;
 			}
-			if(seqt==NULL) BLI_addtail(&effbase, seq);
+			if (seqt == NULL) BLI_addtail(&effbase, seq);
 		}
 		else {
-			seqt= seqbase.first;
-			while(seqt) {
-				if(seqt->machine>=seq->machine) {
+			seqt = seqbase.first;
+			while (seqt) {
+				if (seqt->machine >= seq->machine) {
 					BLI_insertlinkbefore(&seqbase, seqt, seq);
 					break;
 				}
-				seqt= seqt->next;
+				seqt = seqt->next;
 			}
-			if(seqt==NULL) BLI_addtail(&seqbase, seq);
+			if (seqt == NULL) BLI_addtail(&seqbase, seq);
 		}
 	}
 
 	BLI_movelisttolist(&seqbase, &effbase);
-	*(ed->seqbasep)= seqbase;
+	*(ed->seqbasep) = seqbase;
 }
 
 
 static int clear_scene_in_allseqs_cb(Sequence *seq, void *arg_pt)
 {
-	if(seq->scene==(Scene *)arg_pt)
-		seq->scene= NULL;
+	if (seq->scene == (Scene *)arg_pt)
+		seq->scene = NULL;
 	return 1;
 }
 
@@ -828,8 +797,8 @@ void clear_scene_in_allseqs(Main *bmain, Scene *scene)
 	Scene *scene_iter;
 
 	/* when a scene is deleted: test all seqs */
-	for(scene_iter= bmain->scene.first; scene_iter; scene_iter= scene_iter->id.next) {
-		if(scene_iter != scene && scene_iter->ed) {
+	for (scene_iter = bmain->scene.first; scene_iter; scene_iter = scene_iter->id.next) {
+		if (scene_iter != scene && scene_iter->ed) {
 			seqbase_recursive_apply(&scene_iter->ed->seqbase, clear_scene_in_allseqs_cb, scene);
 		}
 	}
@@ -843,27 +812,28 @@ typedef struct SeqUniqueInfo {
 	int match;
 } SeqUniqueInfo;
 
-/*
+#if 0
 static void seqbase_unique_name(ListBase *seqbasep, Sequence *seq)
 {
 	BLI_uniquename(seqbasep, seq, "Sequence", '.', offsetof(Sequence, name), SEQ_NAME_MAXSTR);
-}*/
+}
+#endif
 
 static void seqbase_unique_name(ListBase *seqbasep, SeqUniqueInfo *sui)
 {
 	Sequence *seq;
-	for(seq=seqbasep->first; seq; seq= seq->next) {
-		if (sui->seq != seq && strcmp(sui->name_dest, seq->name+2)==0) {
+	for (seq = seqbasep->first; seq; seq = seq->next) {
+		if (sui->seq != seq && strcmp(sui->name_dest, seq->name + 2) == 0) {
 			/* SEQ_NAME_MAXSTR - 2 for prefix, -1 for \0, -4 for the number */
 			BLI_snprintf(sui->name_dest, sizeof(sui->name_dest), "%.59s.%03d",  sui->name_src, sui->count++);
-			sui->match= 1; /* be sure to re-scan */
+			sui->match = 1; /* be sure to re-scan */
 		}
 	}
 }
 
 static int seqbase_unique_name_recursive_cb(Sequence *seq, void *arg_pt)
 {
-	if(seq->seqbase.first)
+	if (seq->seqbase.first)
 		seqbase_unique_name(&seq->seqbase, (SeqUniqueInfo *)arg_pt);
 	return 1;
 }
@@ -872,56 +842,57 @@ void seqbase_unique_name_recursive(ListBase *seqbasep, struct Sequence *seq)
 {
 	SeqUniqueInfo sui;
 	char *dot;
-	sui.seq= seq;
-	BLI_strncpy(sui.name_src, seq->name+2, sizeof(sui.name_src));
-	BLI_strncpy(sui.name_dest, seq->name+2, sizeof(sui.name_dest));
+	sui.seq = seq;
+	BLI_strncpy(sui.name_src, seq->name + 2, sizeof(sui.name_src));
+	BLI_strncpy(sui.name_dest, seq->name + 2, sizeof(sui.name_dest));
 
-	sui.count= 1;
-	sui.match= 1; /* assume the worst to start the loop */
+	sui.count = 1;
+	sui.match = 1; /* assume the worst to start the loop */
 
 	/* Strip off the suffix */
-	if ((dot=strrchr(sui.name_src, '.'))) {
-		*dot= '\0';
+	if ((dot = strrchr(sui.name_src, '.'))) {
+		*dot = '\0';
 		dot++;
 
-		if(*dot)
-			sui.count= atoi(dot) + 1;
+		if (*dot)
+			sui.count = atoi(dot) + 1;
 	}
 
-	while(sui.match) {
-		sui.match= 0;
+	while (sui.match) {
+		sui.match = 0;
 		seqbase_unique_name(seqbasep, &sui);
 		seqbase_recursive_apply(seqbasep, seqbase_unique_name_recursive_cb, &sui);
 	}
 
-	BLI_strncpy(seq->name+2, sui.name_dest, sizeof(seq->name)-2);
+	BLI_strncpy(seq->name + 2, sui.name_dest, sizeof(seq->name) - 2);
 }
 
 static const char *give_seqname_by_type(int type)
 {
-	switch(type) {
-	case SEQ_META:	     return "Meta";
-	case SEQ_IMAGE:      return "Image";
-	case SEQ_SCENE:      return "Scene";
-	case SEQ_MOVIE:      return "Movie";
-	case SEQ_SOUND:      return "Audio";
-	case SEQ_CROSS:      return "Cross";
-	case SEQ_GAMCROSS:   return "Gamma Cross";
-	case SEQ_ADD:        return "Add";
-	case SEQ_SUB:        return "Sub";
-	case SEQ_MUL:        return "Mul";
-	case SEQ_ALPHAOVER:  return "Alpha Over";
-	case SEQ_ALPHAUNDER: return "Alpha Under";
-	case SEQ_OVERDROP:   return "Over Drop";
-	case SEQ_WIPE:       return "Wipe";
-	case SEQ_GLOW:       return "Glow";
-	case SEQ_TRANSFORM:  return "Transform";
-	case SEQ_COLOR:      return "Color";
-	case SEQ_MULTICAM:   return "Multicam";
-	case SEQ_ADJUSTMENT: return "Adjustment";
-	case SEQ_SPEED:      return "Speed";
-	default:
-		return NULL;
+	switch (type) {
+		case SEQ_META:       return "Meta";
+		case SEQ_IMAGE:      return "Image";
+		case SEQ_SCENE:      return "Scene";
+		case SEQ_MOVIE:      return "Movie";
+		case SEQ_MOVIECLIP:  return "Clip";
+		case SEQ_SOUND:      return "Audio";
+		case SEQ_CROSS:      return "Cross";
+		case SEQ_GAMCROSS:   return "Gamma Cross";
+		case SEQ_ADD:        return "Add";
+		case SEQ_SUB:        return "Sub";
+		case SEQ_MUL:        return "Mul";
+		case SEQ_ALPHAOVER:  return "Alpha Over";
+		case SEQ_ALPHAUNDER: return "Alpha Under";
+		case SEQ_OVERDROP:   return "Over Drop";
+		case SEQ_WIPE:       return "Wipe";
+		case SEQ_GLOW:       return "Glow";
+		case SEQ_TRANSFORM:  return "Transform";
+		case SEQ_COLOR:      return "Color";
+		case SEQ_MULTICAM:   return "Multicam";
+		case SEQ_ADJUSTMENT: return "Adjustment";
+		case SEQ_SPEED:      return "Speed";
+		default:
+			return NULL;
 	}
 }
 
@@ -930,16 +901,20 @@ const char *give_seqname(Sequence *seq)
 	const char *name = give_seqname_by_type(seq->type);
 
 	if (!name) {
-		if(seq->type<SEQ_EFFECT) {
+		if (seq->type < SEQ_EFFECT) {
 			return seq->strip->dir;
-		} else if(seq->type==SEQ_PLUGIN) {
-			if(!(seq->flag & SEQ_EFFECT_NOT_LOADED) &&
-			   seq->plugin && seq->plugin->doit) {
+		}
+		else if (seq->type == SEQ_PLUGIN) {
+			if (!(seq->flag & SEQ_EFFECT_NOT_LOADED) &&
+			    seq->plugin && seq->plugin->doit)
+			{
 				return seq->plugin->pname;
-			} else {
+			}
+			else {
 				return "Plugin";
 			}
-		} else {
+		}
+		else {
 			return "Effect";
 		}
 	}
@@ -954,11 +929,13 @@ static void make_black_ibuf(ImBuf *ibuf)
 	float *rect_float;
 	int tot;
 
-	if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) return;
+	if (ibuf == NULL || (ibuf->rect == NULL && ibuf->rect_float == NULL)) {
+		return;
+	}
 
-	tot= ibuf->x*ibuf->y;
+	tot = ibuf->x * ibuf->y;
 
-	rect= ibuf->rect;
+	rect = ibuf->rect;
 	rect_float = ibuf->rect_float;
 
 	if (rect) {
@@ -977,29 +954,29 @@ static void multibuf(ImBuf *ibuf, float fmul)
 
 	int a, mul, icol;
 
-	mul= (int)(256.0f * fmul);
-	rt= (char *)ibuf->rect;
+	mul = (int)(256.0f * fmul);
+	rt = (char *)ibuf->rect;
 	rt_float = ibuf->rect_float;
 
 	if (rt) {
-		a= ibuf->x*ibuf->y;
-		while(a--) {
-
-			icol= (mul*rt[0])>>8;
-			if(icol>254) rt[0]= 255; else rt[0]= icol;
-			icol= (mul*rt[1])>>8;
-			if(icol>254) rt[1]= 255; else rt[1]= icol;
-			icol= (mul*rt[2])>>8;
-			if(icol>254) rt[2]= 255; else rt[2]= icol;
-			icol= (mul*rt[3])>>8;
-			if(icol>254) rt[3]= 255; else rt[3]= icol;
+		a = ibuf->x * ibuf->y;
+		while (a--) {
+
+			icol = (mul * rt[0]) >> 8;
+			if (icol > 254) rt[0] = 255; else rt[0] = icol;
+			icol = (mul * rt[1]) >> 8;
+			if (icol > 254) rt[1] = 255; else rt[1] = icol;
+			icol = (mul * rt[2]) >> 8;
+			if (icol > 254) rt[2] = 255; else rt[2] = icol;
+			icol = (mul * rt[3]) >> 8;
+			if (icol > 254) rt[3] = 255; else rt[3] = icol;
 			
-			rt+= 4;
+			rt += 4;
 		}
 	}
 	if (rt_float) {
-		a= ibuf->x*ibuf->y;
-		while(a--) {
+		a = ibuf->x * ibuf->y;
+		while (a--) {
 			rt_float[0] *= fmul;
 			rt_float[1] *= fmul;
 			rt_float[2] *= fmul;
@@ -1014,25 +991,26 @@ static float give_stripelem_index(Sequence *seq, float cfra)
 {
 	float nr;
 	int sta = seq->start;
-	int end = seq->start+seq->len-1;
+	int end = seq->start + seq->len - 1;
 
 	if (seq->type & SEQ_EFFECT) {
 		end = seq->enddisp;
 	} 
 
-	if(end < sta) {
+	if (end < sta) {
 		return -1;
 	}
 
-	if(seq->flag&SEQ_REVERSE_FRAMES) {	
+	if (seq->flag & SEQ_REVERSE_FRAMES) {
 		/*reverse frame in this sequence */
-		if(cfra <= sta) nr= end - sta;
-		else if(cfra >= end) nr= 0;
-		else nr= end - cfra;
-	} else {
-		if(cfra <= sta) nr= 0;
-		else if(cfra >= end) nr= end - sta;
-		else nr= cfra - sta;
+		if (cfra <= sta) nr = end - sta;
+		else if (cfra >= end) nr = 0;
+		else nr = end - cfra;
+	}
+	else {
+		if (cfra <= sta) nr = 0;
+		else if (cfra >= end) nr = end - sta;
+		else nr = cfra - sta;
 	}
 	
 	if (seq->strobe < 1.0f) seq->strobe = 1.0f;
@@ -1046,14 +1024,14 @@ static float give_stripelem_index(Sequence *seq, float cfra)
 
 StripElem *give_stripelem(Sequence *seq, int cfra)
 {
-	StripElem *se= seq->strip->stripdata;
+	StripElem *se = seq->strip->stripdata;
 
-	if(seq->type == SEQ_IMAGE) { /* only 
-					IMAGE strips use the whole array,
-					MOVIE strips use only 
-					the first element, all other strips
-					don't use this... */
-		int nr = (int) give_stripelem_index(seq, cfra);
+	if (seq->type == SEQ_IMAGE) { /* only
+		                           * IMAGE strips use the whole array,
+		                           * MOVIE strips use only
+		                           * the first element, all other strips
+		                           * don't use this... */
+		int nr = (int)give_stripelem_index(seq, cfra);
 
 		if (nr == -1 || se == NULL) return NULL;
 	
@@ -1062,20 +1040,20 @@ StripElem *give_stripelem(Sequence *seq, int cfra)
 	return se;
 }
 
-static int evaluate_seq_frame_gen(Sequence ** seq_arr, ListBase *seqbase, int cfra)
+static int evaluate_seq_frame_gen(Sequence **seq_arr, ListBase *seqbase, int cfra)
 {
 	Sequence *seq;
-	int totseq=0;
+	int totseq = 0;
 
-	memset(seq_arr, 0, sizeof(Sequence*) * (MAXSEQ+1));
+	memset(seq_arr, 0, sizeof(Sequence *) * (MAXSEQ + 1));
 
-	seq= seqbase->first;
-	while(seq) {
-		if(seq->startdisp <=cfra && seq->enddisp > cfra) {
-			seq_arr[seq->machine]= seq;
+	seq = seqbase->first;
+	while (seq) {
+		if (seq->startdisp <= cfra && seq->enddisp > cfra) {
+			seq_arr[seq->machine] = seq;
 			totseq++;
 		}
-		seq= seq->next;
+		seq = seq->next;
 	}
 
 	return totseq;
@@ -1083,21 +1061,21 @@ static int evaluate_seq_frame_gen(Sequence ** seq_arr, ListBase *seqbase, int cf
 
 int evaluate_seq_frame(Scene *scene, int cfra)
 {
-	Editing *ed= seq_give_editing(scene, FALSE);
-	Sequence *seq_arr[MAXSEQ+1];
+	Editing *ed = seq_give_editing(scene, FALSE);
+	Sequence *seq_arr[MAXSEQ + 1];
 
-	if(ed==NULL) return 0;
+	if (ed == NULL) return 0;
 	return evaluate_seq_frame_gen(seq_arr, ed->seqbasep, cfra);
 }
 
-static int video_seq_is_rendered(Sequence * seq)
+static int video_seq_is_rendered(Sequence *seq)
 {
 	return (seq && !(seq->flag & SEQ_MUTE) && seq->type != SEQ_SOUND);
 }
 
-static int get_shown_sequences(	ListBase * seqbasep, int cfra, int chanshown, Sequence ** seq_arr_out)
+static int get_shown_sequences(ListBase *seqbasep, int cfra, int chanshown, Sequence **seq_arr_out)
 {
-	Sequence *seq_arr[MAXSEQ+1];
+	Sequence *seq_arr[MAXSEQ + 1];
 	int b = chanshown;
 	int cnt = 0;
 
@@ -1105,7 +1083,7 @@ static int get_shown_sequences(	ListBase * seqbasep, int cfra, int chanshown, Se
 		return 0;
 	}
 
-	if(evaluate_seq_frame_gen(seq_arr, seqbasep, cfra)) {
+	if (evaluate_seq_frame_gen(seq_arr, seqbasep, cfra)) {
 		if (b == 0) {
 			b = MAXSEQ;
 		}
@@ -1118,7 +1096,7 @@ static int get_shown_sequences(	ListBase * seqbasep, int cfra, int chanshown, Se
 	
 	chanshown = b;
 
-	for (;b > 0; b--) {
+	for (; b > 0; b--) {
 		if (video_seq_is_rendered(seq_arr[b])) {
 			if (seq_arr[b]->blend_mode == SEQ_BLEND_REPLACE) {
 				break;
@@ -1126,7 +1104,7 @@ static int get_shown_sequences(	ListBase * seqbasep, int cfra, int chanshown, Se
 		}
 	}
 
-	for (;b <= chanshown && b >= 0; b++) {
+	for (; b <= chanshown && b >= 0; b++) {
 		if (video_seq_is_rendered(seq_arr[b])) {
 			seq_arr_out[cnt++] = seq_arr[b];
 		}
@@ -1137,10 +1115,22 @@ static int get_shown_sequences(	ListBase * seqbasep, int cfra, int chanshown, Se
 
 
 /* **********************************************************************
-   proxy management
-   ********************************************************************** */
+ * proxy management
+ * ********************************************************************** */
+
+typedef struct SeqIndexBuildContext {
+	struct IndexBuildContext *index_context;
 
-#define PROXY_MAXFILE (2*FILE_MAXDIR+FILE_MAXFILE)
+	int tc_flags;
+	int size_flags;
+	int quality;
+
+	Main *bmain;
+	Scene *scene;
+	Sequence *seq, *orig_seq;
+} SeqIndexBuildContext;
+
+#define PROXY_MAXFILE (2 * FILE_MAXDIR + FILE_MAXFILE)
 
 static IMB_Proxy_Size seq_rendersize_to_proxysize(int size)
 {
@@ -1159,12 +1149,26 @@ static IMB_Proxy_Size seq_rendersize_to_proxysize(int size)
 	return IMB_PROXY_25;
 }
 
-static void seq_open_anim_file(Sequence * seq)
+static double seq_rendersize_to_scale_factor(int size)
+{
+	if (size >= 99) {
+		return 1.0;
+	}
+	if (size >= 75) {
+		return 0.75;
+	}
+	if (size >= 50) {
+		return 0.50;
+	}
+	return 0.25;
+}
+
+static void seq_open_anim_file(Sequence *seq)
 {
 	char name[FILE_MAX];
-	StripProxy * proxy;
+	StripProxy *proxy;
 
-	if(seq->anim != NULL) {
+	if (seq->anim != NULL) {
 		return;
 	}
 
@@ -1174,7 +1178,7 @@ static void seq_open_anim_file(Sequence * seq)
 	
 	seq->anim = openanim(name, IB_rect |
 	                     ((seq->flag & SEQ_FILTERY) ?
-	                          IB_animdeinterlace : 0), seq->streamindex);
+	                      IB_animdeinterlace : 0), seq->streamindex);
 
 	if (seq->anim == NULL) {
 		return;
@@ -1192,29 +1196,30 @@ static void seq_open_anim_file(Sequence * seq)
 }
 
 
-static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra, char * name)
+static int seq_proxy_get_fname(Sequence *seq, int cfra, int render_size, char *name)
 {
 	int frameno;
 	char dir[PROXY_MAXFILE];
-	int render_size = context.preview_render_size;
 
 	if (!seq->strip->proxy) {
 		return FALSE;
 	}
 
 	/* MOVIE tracks (only exception: custom files) are now handled 
-	   internally by ImBuf module for various reasons: proper time code 
-	   support, quicker index build, using one file instead 
-	   of a full directory of jpeg files, etc. Trying to support old
-	   and new method at once could lead to funny effects, if people
-	   have both, a directory full of jpeg files and proxy avis, so
-	   sorry folks, please rebuild your proxies... */
-
-	if (seq->flag & (SEQ_USE_PROXY_CUSTOM_DIR|SEQ_USE_PROXY_CUSTOM_FILE)) {
+	 * internally by ImBuf module for various reasons: proper time code
+	 * support, quicker index build, using one file instead
+	 * of a full directory of jpeg files, etc. Trying to support old
+	 * and new method at once could lead to funny effects, if people
+	 * have both, a directory full of jpeg files and proxy avis, so
+	 * sorry folks, please rebuild your proxies... */
+
+	if (seq->flag & (SEQ_USE_PROXY_CUSTOM_DIR | SEQ_USE_PROXY_CUSTOM_FILE)) {
 		BLI_strncpy(dir, seq->strip->proxy->dir, sizeof(dir));
-	} else if (seq->type == SEQ_IMAGE) {
+	}
+	else if (seq->type == SEQ_IMAGE) {
 		BLI_snprintf(dir, PROXY_MAXFILE, "%s/BL_proxy", seq->strip->dir);
-	} else {
+	}
+	else {
 		return FALSE;
 	}
 
@@ -1226,22 +1231,18 @@ static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra,
 		return TRUE;
 	}
 
-	/* dirty hack to distinguish 100% render size from PROXY_100 */
-	if (render_size == 99) {
-		render_size = 100;
-	}
-
 	/* generate a separate proxy directory for each preview size */
 
 	if (seq->type == SEQ_IMAGE) {
 		BLI_snprintf(name, PROXY_MAXFILE, "%s/images/%d/%s_proxy", dir,
-		             context.preview_render_size,
+		             render_size,
 		             give_stripelem(seq, cfra)->name);
 		frameno = 1;
-	} else {
-		frameno = (int) give_stripelem_index(seq, cfra) + seq->anim_startofs;
+	}
+	else {
+		frameno = (int)give_stripelem_index(seq, cfra) + seq->anim_startofs;
 		BLI_snprintf(name, PROXY_MAXFILE, "%s/proxy_misc/%d/####", dir, 
-		             context.preview_render_size);
+		             render_size);
 	}
 
 	BLI_path_abs(name, G.main->name);
@@ -1252,12 +1253,17 @@ static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra,
 	return TRUE;
 }
 
-static struct ImBuf * seq_proxy_fetch(SeqRenderData context, Sequence * seq, int cfra)
+static ImBuf *seq_proxy_fetch(SeqRenderData context, Sequence *seq, int cfra)
 {
 	char name[PROXY_MAXFILE];
-	IMB_Proxy_Size psize = seq_rendersize_to_proxysize(
-		context.preview_render_size);
+	IMB_Proxy_Size psize = seq_rendersize_to_proxysize(context.preview_render_size);
 	int size_flags;
+	int render_size = context.preview_render_size;
+
+	/* dirty hack to distinguish 100% render size from PROXY_100 */
+	if (render_size == 99) {
+		render_size = 100;
+	}
 
 	if (!(seq->flag & SEQ_USE_PROXY)) {
 		return NULL;
@@ -1271,49 +1277,50 @@ static struct ImBuf * seq_proxy_fetch(SeqRenderData context, Sequence * seq, int
 	}
 
 	if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) {
-		int frameno = (int) give_stripelem_index(seq, cfra) + seq->anim_startofs;
+		int frameno = (int)give_stripelem_index(seq, cfra) + seq->anim_startofs;
 		if (seq->strip->proxy->anim == NULL) {
-			if (seq_proxy_get_fname(context, seq, cfra, name)==0) {
+			if (seq_proxy_get_fname(seq, cfra, render_size, name) == 0) {
 				return NULL;
 			}
  
 			seq->strip->proxy->anim = openanim(name, IB_rect, 0);
 		}
-		if (seq->strip->proxy->anim==NULL) {
+		if (seq->strip->proxy->anim == NULL) {
 			return NULL;
 		}
  
 		seq_open_anim_file(seq);
 
-		frameno = IMB_anim_index_get_frame_index(
-			seq->anim, seq->strip->proxy->tc, frameno);
+		frameno = IMB_anim_index_get_frame_index(seq->anim, seq->strip->proxy->tc,
+		                                         frameno);
 
 		return IMB_anim_absolute(seq->strip->proxy->anim, frameno,
-					 IMB_TC_NONE, IMB_PROXY_NONE);
+		                         IMB_TC_NONE, IMB_PROXY_NONE);
 	}
  
-	if (seq_proxy_get_fname(context, seq, cfra, name) == 0) {
+	if (seq_proxy_get_fname(seq, cfra, render_size, name) == 0) {
 		return NULL;
 	}
 
 	if (BLI_exists(name)) {
 		return IMB_loadiffname(name, IB_rect);
-	} else {
+	}
+	else {
 		return NULL;
 	}
 }
 
 static void seq_proxy_build_frame(SeqRenderData context,
-				  Sequence* seq, int cfra,
-				  int proxy_render_size)
+                                  Sequence *seq, int cfra,
+                                  int proxy_render_size)
 {
 	char name[PROXY_MAXFILE];
 	int quality;
 	int rectx, recty;
 	int ok;
-	struct ImBuf * ibuf;
+	ImBuf *ibuf;
 
-	if (!seq_proxy_get_fname(context, seq, cfra, name)) {
+	if (!seq_proxy_get_fname(seq, cfra, proxy_render_size, name)) {
 		return;
 	}
 
@@ -1327,13 +1334,13 @@ static void seq_proxy_build_frame(SeqRenderData context,
 	}
 
 	/* depth = 32 is intentionally left in, otherwise ALPHA channels
-	   won't work... */
+	 * won't work... */
 	quality = seq->strip->proxy->quality;
-	ibuf->ftype= JPG | quality;
+	ibuf->ftype = JPG | quality;
 
 	/* unsupported feature only confuses other s/w */
-	if(ibuf->planes==32)
-		ibuf->planes= 24;
+	if (ibuf->planes == 32)
+		ibuf->planes = 24;
 
 	BLI_make_existing_file(name);
 	
@@ -1345,35 +1352,56 @@ static void seq_proxy_build_frame(SeqRenderData context,
 	IMB_freeImBuf(ibuf);
 }
 
-void seq_proxy_rebuild(struct Main * bmain, Scene *scene, Sequence * seq,
-		       short *stop, short *do_update, float *progress)
+struct SeqIndexBuildContext *seq_proxy_rebuild_context(Main *bmain, Scene *scene, Sequence *seq)
 {
-	SeqRenderData context;
-	int cfra;
-	int tc_flags;
-	int size_flags;
-	int quality;
+	SeqIndexBuildContext *context;
+	Sequence *nseq;
 
 	if (!seq->strip || !seq->strip->proxy) {
-		return;
+		return NULL;
 	}
 
 	if (!(seq->flag & SEQ_USE_PROXY)) {
-		return;
+		return NULL;
 	}
 
-	tc_flags   = seq->strip->proxy->build_tc_flags;
-	size_flags = seq->strip->proxy->build_size_flags;
-	quality    = seq->strip->proxy->quality;
+	context = MEM_callocN(sizeof(SeqIndexBuildContext), "seq proxy rebuild context");
 
-	if (seq->type == SEQ_MOVIE) {
-		seq_open_anim_file(seq);
+	nseq = seq_dupli_recursive(scene, scene, seq, 0);
+
+	context->tc_flags   = nseq->strip->proxy->build_tc_flags;
+	context->size_flags = nseq->strip->proxy->build_size_flags;
+	context->quality    = nseq->strip->proxy->quality;
+
+	context->bmain = bmain;
+	context->scene = scene;
+	context->orig_seq = seq;
+	context->seq = nseq;
+
+	if (nseq->type == SEQ_MOVIE) {
+		seq_open_anim_file(nseq);
+
+		if (nseq->anim) {
+			context->index_context = IMB_anim_index_rebuild_context(nseq->anim,
+			        context->tc_flags, context->size_flags, context->quality);
+		}
+	}
+
+	return context;
+}
+
+void seq_proxy_rebuild(SeqIndexBuildContext *context, short *stop, short *do_update, float *progress)
+{
+	SeqRenderData render_context;
+	Sequence *seq = context->seq;
+	Scene *scene = context->scene;
+	int cfra;
 
-		if (seq->anim) {
-			IMB_anim_index_rebuild(
-				seq->anim, tc_flags, size_flags, quality,
-				stop, do_update, progress);
+	if (seq->type == SEQ_MOVIE) {
+		if (context->index_context) {
+			IMB_anim_index_rebuild(context->index_context, stop, do_update, progress);
 		}
+
 		return;
 	}
 
@@ -1388,42 +1416,54 @@ void seq_proxy_rebuild(struct Main * bmain, Scene *scene, Sequence * seq,
 
 	/* fail safe code */
 
-	context = seq_new_render_data(
-		bmain, scene, 
-		(scene->r.size * (float) scene->r.xsch) / 100.0f + 0.5f, 
-		(scene->r.size * (float) scene->r.ysch) / 100.0f + 0.5f, 
-		100);
+	render_context = seq_new_render_data(
+	        context->bmain, context->scene,
+	        (scene->r.size * (float)scene->r.xsch) / 100.0f + 0.5f,
+	        (scene->r.size * (float)scene->r.ysch) / 100.0f + 0.5f,
+	        100);
 
 	for (cfra = seq->startdisp + seq->startstill; 
 	     cfra < seq->enddisp - seq->endstill; cfra++) {
-		if (size_flags & IMB_PROXY_25) {
-			seq_proxy_build_frame(context, seq, cfra, 25);
+		if (context->size_flags & IMB_PROXY_25) {
+			seq_proxy_build_frame(render_context, seq, cfra, 25);
 		}
-		if (size_flags & IMB_PROXY_50) {
-			seq_proxy_build_frame(context, seq, cfra, 50);
+		if (context->size_flags & IMB_PROXY_50) {
+			seq_proxy_build_frame(render_context, seq, cfra, 50);
 		}
-		if (size_flags & IMB_PROXY_75) {
-			seq_proxy_build_frame(context, seq, cfra, 75);
+		if (context->size_flags & IMB_PROXY_75) {
+			seq_proxy_build_frame(render_context, seq, cfra, 75);
 		}
-		if (size_flags & IMB_PROXY_100) {
-			seq_proxy_build_frame(context, seq, cfra, 100);
+		if (context->size_flags & IMB_PROXY_100) {
+			seq_proxy_build_frame(render_context, seq, cfra, 100);
 		}
 
-		*progress= (float)cfra/(seq->enddisp - seq->endstill 
-					- seq->startdisp + seq->startstill);
-		*do_update= 1;
+		*progress = (float)cfra / (seq->enddisp - seq->endstill -
+		                           seq->startdisp + seq->startstill);
+		*do_update = 1;
 
-		if(*stop || G.afbreek)
+		if (*stop || G.afbreek)
 			break;
 	}
 }
 
+void seq_proxy_rebuild_finish(SeqIndexBuildContext *context, short stop)
+{
+	if (context->index_context) {
+		IMB_close_anim_proxies(context->seq->anim);
+		IMB_close_anim_proxies(context->orig_seq->anim);
+		IMB_anim_index_rebuild_finish(context->index_context, stop);
+	}
+
+	seq_free_sequence_recurse(context->scene, context->seq);
+
+	MEM_freeN(context);
+}
 
 /* **********************************************************************
-   color balance 
-   ********************************************************************** */
+ * color balance
+ * ********************************************************************** */
 
-static StripColorBalance calc_cb(StripColorBalance * cb_)
+static StripColorBalance calc_cb(StripColorBalance *cb_)
 {
 	StripColorBalance cb = *cb_;
 	int c;
@@ -1432,11 +1472,11 @@ static StripColorBalance calc_cb(StripColorBalance * cb_)
 		cb.lift[c] = 2.0f - cb.lift[c];
 	}
 
-	if(cb.flag & SEQ_COLOR_BALANCE_INVERSE_LIFT) {
+	if (cb.flag & SEQ_COLOR_BALANCE_INVERSE_LIFT) {
 		for (c = 0; c < 3; c++) {
 			/* tweak to give more subtle results
 			 * values above 1.0 are scaled */
-			if(cb.lift[c] > 1.0f)
+			if (cb.lift[c] > 1.0f)
 				cb.lift[c] = pow(cb.lift[c] - 1.0f, 2.0) + 1.0;
 
 			cb.lift[c] = 2.0f - cb.lift[c];
@@ -1447,7 +1487,8 @@ static StripColorBalance calc_cb(StripColorBalance * cb_)
 		for (c = 0; c < 3; c++) {
 			if (cb.gain[c] != 0.0f) {
 				cb.gain[c] = 1.0f / cb.gain[c];
-			} else {
+			}
+			else {
 				cb.gain[c] = 1000000; /* should be enough :) */
 			}
 		}
@@ -1456,8 +1497,9 @@ static StripColorBalance calc_cb(StripColorBalance * cb_)
 	if (!(cb.flag & SEQ_COLOR_BALANCE_INVERSE_GAMMA)) {
 		for (c = 0; c < 3; c++) {
 			if (cb.gamma[c] != 0.0f) {
-				cb.gamma[c] = 1.0f/cb.gamma[c];
-			} else {
+				cb.gamma[c] = 1.0f / cb.gamma[c];
+			}
+			else {
 				cb.gamma[c] = 1000000; /* should be enough :) */
 			}
 		}
@@ -1469,7 +1511,7 @@ static StripColorBalance calc_cb(StripColorBalance * cb_)
 /* note: lift is actually 2-lift */
 MINLINE float color_balance_fl(float in, const float lift, const float gain, const float gamma, const float mul)
 {
-	float x= (((in - 1.0f) * lift) + 1.0f) * gain;
+	float x = (((in - 1.0f) * lift) + 1.0f) * gain;
 
 	/* prevent NaN */
 	if (x < 0.f) x = 0.f;
@@ -1478,34 +1520,34 @@ MINLINE float color_balance_fl(float in, const float lift, const float gain, con
 }
 
 static void make_cb_table_byte(float lift, float gain, float gamma,
-				   unsigned char * table, float mul)
+                               unsigned char *table, float mul)
 {
 	int y;
 
 	for (y = 0; y < 256; y++) {
-		float v= color_balance_fl((float)y * (1.0f / 255.0f), lift, gain, gamma, mul);
+		float v = color_balance_fl((float)y * (1.0f / 255.0f), lift, gain, gamma, mul);
 		CLAMP(v, 0.0f, 1.0f);
 		table[y] = v * 255;
 	}
 }
 
 static void make_cb_table_float(float lift, float gain, float gamma,
-				float * table, float mul)
+                                float *table, float mul)
 {
 	int y;
 
 	for (y = 0; y < 256; y++) {
-		float v= color_balance_fl((float)y * (1.0f / 255.0f), lift, gain, gamma, mul);
+		float v = color_balance_fl((float)y * (1.0f / 255.0f), lift, gain, gamma, mul);
 		table[y] = v;
 	}
 }
 
-static void color_balance_byte_byte(Sequence * seq, ImBuf* ibuf, float mul)
+static void color_balance_byte_byte(Sequence *seq, ImBuf *ibuf, float mul)
 {
 	unsigned char cb_tab[3][256];
 	int c;
-	unsigned char * p = (unsigned char*) ibuf->rect;
-	unsigned char * e = p + ibuf->x * 4 * ibuf->y;
+	unsigned char *p = (unsigned char *) ibuf->rect;
+	unsigned char *e = p + ibuf->x * 4 * ibuf->y;
 
 	StripColorBalance cb = calc_cb(seq->strip->color_balance);
 
@@ -1523,13 +1565,13 @@ static void color_balance_byte_byte(Sequence * seq, ImBuf* ibuf, float mul)
 	}
 }
 
-static void color_balance_byte_float(Sequence * seq, ImBuf* ibuf, float mul)
+static void color_balance_byte_float(Sequence *seq, ImBuf *ibuf, float mul)
 {
 	float cb_tab[4][256];
-	int c,i;
-	unsigned char * p = (unsigned char*) ibuf->rect;
-	unsigned char * e = p + ibuf->x * 4 * ibuf->y;
-	float * o;
+	int c, i;
+	unsigned char *p = (unsigned char *) ibuf->rect;
+	unsigned char *e = p + ibuf->x * 4 * ibuf->y;
+	float *o;
 	StripColorBalance cb;
 
 	imb_addrectfloatImBuf(ibuf);
@@ -1543,7 +1585,7 @@ static void color_balance_byte_float(Sequence * seq, ImBuf* ibuf, float mul)
 	}
 
 	for (i = 0; i < 256; i++) {
-		cb_tab[3][i] = ((float)i)*(1.0f/255.0f);
+		cb_tab[3][i] = ((float)i) * (1.0f / 255.0f);
 	}
 
 	while (p < e) {
@@ -1556,64 +1598,65 @@ static void color_balance_byte_float(Sequence * seq, ImBuf* ibuf, float mul)
 	}
 }
 
-static void color_balance_float_float(Sequence * seq, ImBuf* ibuf, float mul)
+static void color_balance_float_float(Sequence *seq, ImBuf *ibuf, float mul)
 {
-	float * p = ibuf->rect_float;
-	float * e = ibuf->rect_float + ibuf->x * 4* ibuf->y;
+	float *p = ibuf->rect_float;
+	float *e = ibuf->rect_float + ibuf->x * 4 * ibuf->y;
 	StripColorBalance cb = calc_cb(seq->strip->color_balance);
 
 	while (p < e) {
 		int c;
 		for (c = 0; c < 3; c++) {
-			p[c]= color_balance_fl(p[c], cb.lift[c], cb.gain[c], cb.gamma[c], mul);
+			p[c] = color_balance_fl(p[c], cb.lift[c], cb.gain[c], cb.gamma[c], mul);
 		}
 		p += 4;
 	}
 }
 
-static void color_balance(Sequence * seq, ImBuf* ibuf, float mul)
+static void color_balance(Sequence *seq, ImBuf *ibuf, float mul)
 {
 	if (ibuf->rect_float) {
 		color_balance_float_float(seq, ibuf, mul);
-	} else if(seq->flag & SEQ_MAKE_FLOAT) {
+	}
+	else if (seq->flag & SEQ_MAKE_FLOAT) {
 		color_balance_byte_float(seq, ibuf, mul);
-	} else {
+	}
+	else {
 		color_balance_byte_byte(seq, ibuf, mul);
 	}
 }
 
 /*
-  input preprocessing for SEQ_IMAGE, SEQ_MOVIE and SEQ_SCENE
-
-  Do all the things you can't really do afterwards using sequence effects
-  (read: before rescaling to render resolution has been done)
-
-  Order is important!
-
-  - Deinterlace
-  - Crop and transform in image source coordinate space
-  - Flip X + Flip Y (could be done afterwards, backward compatibility)
-  - Promote image to float data (affects pipeline operations afterwards)
-  - Color balance (is most efficient in the byte -> float 
-	(future: half -> float should also work fine!)
-	case, if done on load, since we can use lookup tables)
-  - Premultiply
-
-*/
+ *  input preprocessing for SEQ_IMAGE, SEQ_MOVIE, SEQ_MOVIECLIP and SEQ_SCENE
+ *
+ *  Do all the things you can't really do afterwards using sequence effects
+ *  (read: before rescaling to render resolution has been done)
+ *
+ *  Order is important!
+ *
+ *  - Deinterlace
+ *  - Crop and transform in image source coordinate space
+ *  - Flip X + Flip Y (could be done afterwards, backward compatibility)
+ *  - Promote image to float data (affects pipeline operations afterwards)
+ *  - Color balance (is most efficient in the byte -> float
+ *    (future: half -> float should also work fine!)
+ *    case, if done on load, since we can use lookup tables)
+ *  - Premultiply
+ */
 
 int input_have_to_preprocess(
-	SeqRenderData UNUSED(context), Sequence * seq, float UNUSED(cfra))
+        SeqRenderData UNUSED(context), Sequence *seq, float UNUSED(cfra))
 {
 	float mul;
 
-	if (seq->flag & (SEQ_FILTERY|SEQ_USE_CROP|SEQ_USE_TRANSFORM|SEQ_FLIPX|
-			 SEQ_FLIPY|SEQ_USE_COLOR_BALANCE|SEQ_MAKE_PREMUL)) {
+	if (seq->flag & (SEQ_FILTERY | SEQ_USE_CROP | SEQ_USE_TRANSFORM | SEQ_FLIPX |
+	                 SEQ_FLIPY | SEQ_USE_COLOR_BALANCE | SEQ_MAKE_PREMUL)) {
 		return TRUE;
 	}
 
 	mul = seq->mul;
 
-	if(seq->blend_mode == SEQ_BLEND_REPLACE) {
+	if (seq->blend_mode == SEQ_BLEND_REPLACE) {
 		mul *= seq->blend_opacity / 100.0f;
 	}
 
@@ -1628,46 +1671,83 @@ int input_have_to_preprocess(
 	return FALSE;
 }
 
-static ImBuf * input_preprocess(
-	SeqRenderData context, Sequence *seq, float UNUSED(cfra), ImBuf * ibuf)
+static ImBuf *input_preprocess(
+        SeqRenderData context, Sequence *seq, float UNUSED(cfra), ImBuf *ibuf,
+        int is_proxy_image, int is_preprocessed)
 {
 	float mul;
 
 	ibuf = IMB_makeSingleUser(ibuf);
 
-	if((seq->flag & SEQ_FILTERY) && seq->type != SEQ_MOVIE) {
+	if ((seq->flag & SEQ_FILTERY) &&
+	    !ELEM(seq->type, SEQ_MOVIE, SEQ_MOVIECLIP))
+	{
 		IMB_filtery(ibuf);
 	}
 
-	if(seq->flag & (SEQ_USE_CROP|SEQ_USE_TRANSFORM)) {
-		StripCrop c= {0};
-		StripTransform t= {0};
-		int sx,sy,dx,dy;
+	if (seq->flag & (SEQ_USE_CROP | SEQ_USE_TRANSFORM)) {
+		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);
 
-		if(seq->flag & SEQ_USE_CROP && seq->strip->crop) {
+			if (f != 1.0) {
+				IMB_scalefastImBuf(
+				        ibuf, ibuf->x / f, ibuf->y / f);
+			}
+		}
+
+		if (seq->flag & SEQ_USE_CROP && seq->strip->crop) {
 			c = *seq->strip->crop;
 		}
-		if(seq->flag & SEQ_USE_TRANSFORM && seq->strip->transform) {
+		if (seq->flag & SEQ_USE_TRANSFORM && seq->strip->transform) {
 			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;
+
+		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;
 		dy = sy;
 
 		if (seq->flag & SEQ_USE_TRANSFORM) {
-			dx = context.scene->r.xsch;
-			dy = context.scene->r.ysch;
+			if (is_preprocessed) {
+				dx = context.rectx;
+				dy = context.recty;
+			}
+			else {
+				dx = context.scene->r.xsch;
+				dy = context.scene->r.ysch;
+			}
 		}
 
 		if (c.top + c.bottom >= ibuf->y || c.left + c.right >= ibuf->x ||
-				t.xofs >= dx || t.yofs >= dy) {
+		    t.xofs >= dx || t.yofs >= dy) {
 			make_black_ibuf(ibuf);
-		} else {
-			ImBuf * i = IMB_allocImBuf(dx, dy,32, ibuf->rect_float ? IB_rectfloat : IB_rect);
+		}
+		else {
+			ImBuf *i = IMB_allocImBuf(
+			        dx, dy, 32,
+			        ibuf->rect_float ? IB_rectfloat : IB_rect);
 
-			IMB_rectcpy(i, ibuf, t.xofs, t.yofs, c.left, c.bottom, sx, sy);
+			IMB_rectcpy(i, ibuf, 
+			            t.xofs, t.yofs, c.left, c.bottom, sx, sy);
 			
 			IMB_freeImBuf(ibuf);
 
@@ -1675,52 +1755,30 @@ static ImBuf * input_preprocess(
 		}
 	} 
 
-	if(seq->flag & SEQ_FLIPX) {
+	if (seq->flag & SEQ_FLIPX) {
 		IMB_flipx(ibuf);
 	}
 	
-	if(seq->flag & SEQ_FLIPY) {
+	if (seq->flag & SEQ_FLIPY) {
 		IMB_flipy(ibuf);
 	}
 
-	if(seq->sat != 1.0f) {
-		/* inline for now, could become an imbuf function */
-		int i;
-		unsigned char *rct= (unsigned char *)ibuf->rect;
-		float *rctf= ibuf->rect_float;
-		const float sat= seq->sat;
-		float hsv[3];
-
-		if(rct) {
-			float rgb[3];
-			for (i = ibuf->x * ibuf->y; i > 0; i--, rct+=4) {
-				rgb_uchar_to_float(rgb, rct);
-				rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
-				hsv_to_rgb(hsv[0], hsv[1] * sat, hsv[2], rgb, rgb+1, rgb+2);
-				rgb_float_to_uchar(rct, rgb);
-			}
-		}
-
-		if(rctf) {
-			for (i = ibuf->x * ibuf->y; i > 0; i--, rctf+=4) {
-				rgb_to_hsv(rctf[0], rctf[1], rctf[2], hsv, hsv+1, hsv+2);
-				hsv_to_rgb(hsv[0], hsv[1] * sat, hsv[2], rctf, rctf+1, rctf+2);
-			}
-		}
+	if (seq->sat != 1.0f) {
+		IMB_saturation(ibuf, seq->sat);
 	}
 
 	mul = seq->mul;
 
-	if(seq->blend_mode == SEQ_BLEND_REPLACE) {
+	if (seq->blend_mode == SEQ_BLEND_REPLACE) {
 		mul *= seq->blend_opacity / 100.0f;
 	}
 
-	if(seq->flag & SEQ_USE_COLOR_BALANCE && seq->strip->color_balance) {
+	if (seq->flag & SEQ_USE_COLOR_BALANCE && seq->strip->color_balance) {
 		color_balance(seq, ibuf, mul);
 		mul = 1.0;
 	}
 
-	if(seq->flag & SEQ_MAKE_FLOAT) {
+	if (seq->flag & SEQ_MAKE_FLOAT) {
 		if (!ibuf->rect_float)
 			IMB_float_from_rect_simple(ibuf);
 
@@ -1729,41 +1787,43 @@ static ImBuf * input_preprocess(
 		}
 	}
 
-	if(mul != 1.0f) {
+	if (mul != 1.0f) {
 		multibuf(ibuf, mul);
 	}
 
-	if(seq->flag & SEQ_MAKE_PREMUL) {
-		if(ibuf->planes == 32 && ibuf->zbuf == NULL) {
+	if (seq->flag & SEQ_MAKE_PREMUL) {
+		if (ibuf->planes == 32 && ibuf->zbuf == NULL) {
 			IMB_premultiply_alpha(ibuf);
 		}
 	}
 
 
-	if(ibuf->x != context.rectx || ibuf->y != context.recty ) {
-		if(context.scene->r.mode & R_OSA) {
+	if (ibuf->x != context.rectx || ibuf->y != context.recty) {
+		if (context.scene->r.mode & R_OSA) {
 			IMB_scaleImBuf(ibuf, (short)context.rectx, (short)context.recty);
-		} else {
+		}
+		else {
 			IMB_scalefastImBuf(ibuf, (short)context.rectx, (short)context.recty);
 		}
 	}
 	return ibuf;
 }
 
-static ImBuf * copy_from_ibuf_still(SeqRenderData context, Sequence * seq, 
-				    float nr)
+static ImBuf *copy_from_ibuf_still(SeqRenderData context, Sequence *seq,
+                                   float nr)
 {
-	ImBuf * rval = NULL;
-	ImBuf * ibuf = NULL;
+	ImBuf *rval = NULL;
+	ImBuf *ibuf = NULL;
 
 	if (nr == 0) {
 		ibuf = seq_stripelem_cache_get(
-			context, seq, seq->start, 
-			SEQ_STRIPELEM_IBUF_STARTSTILL);
-	} else if (nr == seq->len - 1) {
+		        context, seq, seq->start,
+		        SEQ_STRIPELEM_IBUF_STARTSTILL);
+	}
+	else if (nr == seq->len - 1) {
 		ibuf = seq_stripelem_cache_get(
-			context, seq, seq->start, 
-			SEQ_STRIPELEM_IBUF_ENDSTILL);
+		        context, seq, seq->start,
+		        SEQ_STRIPELEM_IBUF_ENDSTILL);
 	}
 
 	if (ibuf) {
@@ -1774,25 +1834,25 @@ static ImBuf * copy_from_ibuf_still(SeqRenderData context, Sequence * seq,
 	return rval;
 }
 
-static void copy_to_ibuf_still(SeqRenderData context, Sequence * seq, float nr,
-			       ImBuf * ibuf)
+static void copy_to_ibuf_still(SeqRenderData context, Sequence *seq, float nr,
+                               ImBuf *ibuf)
 {
 	if (nr == 0 || nr == seq->len - 1) {
 		/* we have to store a copy, since the passed ibuf
-		   could be preprocessed afterwards (thereby silently
-		   changing the cached image... */
+		 * could be preprocessed afterwards (thereby silently
+		 * changing the cached image... */
 		ibuf = IMB_dupImBuf(ibuf);
 
 		if (nr == 0) {
 			seq_stripelem_cache_put(
-				context, seq, seq->start, 
-				SEQ_STRIPELEM_IBUF_STARTSTILL, ibuf);
+			        context, seq, seq->start,
+			        SEQ_STRIPELEM_IBUF_STARTSTILL, ibuf);
 		} 
 
 		if (nr == seq->len - 1) {
 			seq_stripelem_cache_put(
-				context, seq, seq->start, 
-				SEQ_STRIPELEM_IBUF_ENDSTILL, ibuf);
+			        context, seq, seq->start,
+			        SEQ_STRIPELEM_IBUF_ENDSTILL, ibuf);
 		}
 
 		IMB_freeImBuf(ibuf);
@@ -1800,27 +1860,27 @@ static void copy_to_ibuf_still(SeqRenderData context, Sequence * seq, float nr,
 }
 
 /* **********************************************************************
-   strip rendering functions
-   ********************************************************************** */
+ * strip rendering functions
+ * ********************************************************************** */
 
-static ImBuf* seq_render_strip_stack( 
-	SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown);
+static ImBuf *seq_render_strip_stack(
+        SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown);
 
-static ImBuf * seq_render_strip(
-	SeqRenderData context, Sequence * seq, float cfra);
+static ImBuf *seq_render_strip(
+        SeqRenderData context, Sequence *seq, float cfra);
 
 
-static ImBuf* seq_render_effect_strip_impl(
-	SeqRenderData context, Sequence *seq, float cfra)
+static ImBuf *seq_render_effect_strip_impl(
+        SeqRenderData context, Sequence *seq, float cfra)
 {
 	float fac, facf;
 	int early_out;
 	int i;
 	struct SeqEffectHandle sh = get_sequence_effect(seq);
-	FCurve *fcu= NULL;
-	ImBuf * ibuf[3];
+	FCurve *fcu = NULL;
+	ImBuf *ibuf[3];
 	Sequence *input[3];
-	ImBuf * out = NULL;
+	ImBuf *out = NULL;
 
 	ibuf[0] = ibuf[1] = ibuf[2] = NULL;
 
@@ -1828,24 +1888,25 @@ static ImBuf* seq_render_effect_strip_impl(
 
 	if (!sh.execute) { /* effect not supported in this version... */
 		out = IMB_allocImBuf((short)context.rectx, 
-				     (short)context.recty, 32, IB_rect);
+		                     (short)context.recty, 32, IB_rect);
 		return out;
 	}
 
 	if (seq->flag & SEQ_USE_EFFECT_DEFAULT_FADE) {
 		sh.get_default_fac(seq, cfra, &fac, &facf);
 		
-		if ((context.scene->r.mode & R_FIELDS)==0)
-			facf= fac;
+		if ((context.scene->r.mode & R_FIELDS) == 0)
+			facf = fac;
 	}
 	else {
 		fcu = id_data_find_fcurve(&context.scene->id, seq, &RNA_Sequence, "effect_fader", 0, NULL);
 		if (fcu) {
 			fac = facf = evaluate_fcurve(fcu, cfra);
-			if( context.scene->r.mode & R_FIELDS ) {
+			if (context.scene->r.mode & R_FIELDS) {
 				facf = evaluate_fcurve(fcu, cfra + 0.5f);
 			}
-		} else {
+		}
+		else {
 			fac = facf = seq->effect_fader;
 		}
 	}
@@ -1853,48 +1914,50 @@ static ImBuf* seq_render_effect_strip_impl(
 	early_out = sh.early_out(seq, fac, facf);
 
 	switch (early_out) {
-	case EARLY_NO_INPUT:
-		out = sh.execute(context, seq, cfra, fac, facf,
-		                 NULL, NULL, NULL);
-		break;
-	case EARLY_DO_EFFECT:
-		for(i=0; i<3; i++) {
-			if(input[i])
-				ibuf[i] = seq_render_strip(
-				            context, input[i], cfra);
-		}
-
-		if (ibuf[0] && ibuf[1]) {
+		case EARLY_NO_INPUT:
 			out = sh.execute(context, seq, cfra, fac, facf,  
-					 ibuf[0], ibuf[1], ibuf[2]);
-		}
-		break;
-	case EARLY_USE_INPUT_1:
-		if (input[0]) {
-			ibuf[0] = seq_render_strip(context, input[0], cfra);
-		}
-		if (ibuf[0]) {
-			if (input_have_to_preprocess(context, seq, cfra)) {
-				out = IMB_dupImBuf(ibuf[0]);
-			} else {
-				out = ibuf[0];
-				IMB_refImBuf(out);
+			                 NULL, NULL, NULL);
+			break;
+		case EARLY_DO_EFFECT:
+			for (i = 0; i < 3; i++) {
+				if (input[i])
+					ibuf[i] = seq_render_strip(
+					        context, input[i], cfra);
 			}
-		}
-		break;
-	case EARLY_USE_INPUT_2:
-		if (input[1]) {
-			ibuf[1] = seq_render_strip(context, input[1], cfra);
-		}
-		if (ibuf[1]) {
-			if (input_have_to_preprocess(context, seq, cfra)) {
-				out = IMB_dupImBuf(ibuf[1]);
-			} else {
-				out = ibuf[1];
-				IMB_refImBuf(out);
+
+			if (ibuf[0] && ibuf[1]) {
+				out = sh.execute(context, seq, cfra, fac, facf,
+				                 ibuf[0], ibuf[1], ibuf[2]);
 			}
-		}
-		break;
+			break;
+		case EARLY_USE_INPUT_1:
+			if (input[0]) {
+				ibuf[0] = seq_render_strip(context, input[0], cfra);
+			}
+			if (ibuf[0]) {
+				if (input_have_to_preprocess(context, seq, cfra)) {
+					out = IMB_dupImBuf(ibuf[0]);
+				}
+				else {
+					out = ibuf[0];
+					IMB_refImBuf(out);
+				}
+			}
+			break;
+		case EARLY_USE_INPUT_2:
+			if (input[1]) {
+				ibuf[1] = seq_render_strip(context, input[1], cfra);
+			}
+			if (ibuf[1]) {
+				if (input_have_to_preprocess(context, seq, cfra)) {
+					out = IMB_dupImBuf(ibuf[1]);
+				}
+				else {
+					out = ibuf[1];
+					IMB_refImBuf(out);
+				}
+			}
+			break;
 	}
 
 	for (i = 0; i < 3; i++) {
@@ -1908,100 +1971,153 @@ static ImBuf* seq_render_effect_strip_impl(
 	return out;
 }
 
+static ImBuf *seq_render_movieclip_strip(
+        SeqRenderData context, Sequence *seq, float nr)
+{
+	ImBuf *ibuf = NULL;
+	MovieClipUser user;
+	float tloc[2], tscale, tangle;
+
+	if (!seq->clip) {
+		return NULL;
+	}
+
+	memset(&user, 0, sizeof(MovieClipUser));
+	
+	BKE_movieclip_user_set_frame(&user, nr + seq->anim_startofs);
+
+	user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL;
+
+	switch (seq_rendersize_to_proxysize(context.preview_render_size)) {
+		case IMB_PROXY_NONE:
+			user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL;
+			break;
+		case IMB_PROXY_100:
+			user.render_size = MCLIP_PROXY_RENDER_SIZE_100;
+			break;
+		case IMB_PROXY_75:
+			user.render_size = MCLIP_PROXY_RENDER_SIZE_75;
+			break;
+		case IMB_PROXY_50:
+			user.render_size = MCLIP_PROXY_RENDER_SIZE_50;
+			break;
+		case IMB_PROXY_25:
+			user.render_size = MCLIP_PROXY_RENDER_SIZE_25;
+			break;
+	}
+
+	if (seq->clip_flag & SEQ_MOVIECLIP_RENDER_UNDISTORTED) {
+		user.render_flag = MCLIP_PROXY_RENDER_UNDISTORT;
+	}
 
-static ImBuf * seq_render_scene_strip_impl(
-	SeqRenderData context, Sequence * seq, float nr)
+	if (seq->clip_flag & SEQ_MOVIECLIP_RENDER_STABILIZED) {
+		ibuf = BKE_movieclip_get_stable_ibuf(
+		        seq->clip, &user, tloc, &tscale, &tangle,
+		        0);
+	}
+	else {
+		ibuf = BKE_movieclip_get_ibuf_flag(
+		        seq->clip, &user, 0, MOVIECLIP_CACHE_SKIP);
+	}
+
+	return ibuf;
+}
+
+static ImBuf *seq_render_scene_strip(
+        SeqRenderData context, Sequence *seq, float nr)
 {
-	ImBuf * ibuf = NULL;
-	float frame= seq->sfra + nr + seq->anim_startofs;
+	ImBuf *ibuf = NULL;
+	float frame;
 	float oldcfra;
 	Object *camera;
 	ListBase oldmarkers;
 	
 	/* Old info:
-	   Hack! This function can be called from do_render_seq(), in that case
-	   the seq->scene can already have a Render initialized with same name,
-	   so we have to use a default name. (compositor uses scene name to
-	   find render).
-	   However, when called from within the UI (image preview in sequencer)
-	   we do want to use scene Render, that way the render result is defined
-	   for display in render/imagewindow
-	   
-	   Hmm, don't see, why we can't do that all the time,
-	   and since G.rendering is uhm, gone... (Peter)
-	*/
+	 * Hack! This function can be called from do_render_seq(), in that case
+	 * the seq->scene can already have a Render initialized with same name,
+	 * so we have to use a default name. (compositor uses scene name to
+	 * find render).
+	 * However, when called from within the UI (image preview in sequencer)
+	 * we do want to use scene Render, that way the render result is defined
+	 * for display in render/imagewindow
+	 *
+	 * Hmm, don't see, why we can't do that all the time,
+	 * and since G.rendering is uhm, gone... (Peter)
+	 */
 
 	/* New info:
-	   Using the same name for the renders works just fine as the do_render_seq()
-	   render is not used while the scene strips are rendered.
-	   
-	   However rendering from UI (through sequencer_preview_area_draw) can crash in
-	   very many cases since other renders (material preview, an actual render etc.)
-	   can be started while this sequence preview render is running. The only proper
-	   solution is to make the sequencer preview render a proper job, which can be
-	   stopped when needed. This would also give a nice progress bar for the preview
-	   space so that users know there's something happening.
-
-	   As a result the active scene now only uses OpenGL rendering for the sequencer
-	   preview. This is far from nice, but is the only way to prevent crashes at this
-	   time. 
-
-	   -jahka
-	*/
+	 * Using the same name for the renders works just fine as the do_render_seq()
+	 * render is not used while the scene strips are rendered.
+	 *
+	 * However rendering from UI (through sequencer_preview_area_draw) can crash in
+	 * very many cases since other renders (material preview, an actual render etc.)
+	 * can be started while this sequence preview render is running. The only proper
+	 * solution is to make the sequencer preview render a proper job, which can be
+	 * stopped when needed. This would also give a nice progress bar for the preview
+	 * space so that users know there's something happening.
+	 *
+	 * As a result the active scene now only uses OpenGL rendering for the sequencer
+	 * preview. This is far from nice, but is the only way to prevent crashes at this
+	 * time.
+	 *
+	 * -jahka
+	 */
 
 	int rendering = G.rendering;
 	int doseq;
-	int doseq_gl= G.rendering ? /*(scene->r.seq_flag & R_SEQ_GL_REND)*/ 0 : /*(scene->r.seq_flag & R_SEQ_GL_PREV)*/ 1;
-	int have_seq= FALSE;
+	int doseq_gl = G.rendering ? /*(scene->r.seq_flag & R_SEQ_GL_REND)*/ 0 : /*(scene->r.seq_flag & R_SEQ_GL_PREV)*/ 1;
+	int have_seq = FALSE;
 	Scene *scene;
 
-	/* dont refer to seq->scene above this point!, it can be NULL */
-	if(seq->scene == NULL) {
+	/* don't refer to seq->scene above this point!, it can be NULL */
+	if (seq->scene == NULL) {
 		return NULL;
 	}
 
-	scene= seq->scene;
+	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;
 
-	oldcfra= scene->r.cfra;	
-	scene->r.cfra= frame;
+	oldcfra = scene->r.cfra;
+	scene->r.cfra = frame;
 
-	if(seq->scene_camera)	
-		camera= seq->scene_camera;
+	if (seq->scene_camera)	
+		camera = seq->scene_camera;
 	else {	
 		scene_camera_switch_update(scene);
-		camera= scene->camera;
+		camera = scene->camera;
 	}
 
-	if(have_seq==FALSE && camera==NULL) {
-		scene->r.cfra= oldcfra;
+	if (have_seq == FALSE && camera == NULL) {
+		scene->r.cfra = oldcfra;
 		return NULL;
 	}
 
 	/* prevent eternal loop */
-	doseq= context.scene->r.scemode & R_DOSEQ;
+	doseq = context.scene->r.scemode & R_DOSEQ;
 	context.scene->r.scemode &= ~R_DOSEQ;
 	
 #ifdef DURIAN_CAMERA_SWITCH
 	/* stooping to new low's in hackyness :( */
-	oldmarkers= scene->markers;
-	scene->markers.first= scene->markers.last= NULL;
+	oldmarkers = scene->markers;
+	scene->markers.first = scene->markers.last = NULL;
 #else
 	(void)oldmarkers;
 #endif
 	
-	if(sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (scene == context.scene || have_seq==0) && camera) {
-		char err_out[256]= "unknown";
+	if (sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (scene == context.scene || have_seq == 0) && camera) {
+		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 */
-		if(context.scene->r.seq_prev_type==0)
+		if (context.scene->r.seq_prev_type == 0)
 			context.scene->r.seq_prev_type = 3 /* ==OB_SOLID */; 
 
 		/* opengl offscreen render */
 		scene_update_for_newframe(context.bmain, scene, scene->lay);
-		ibuf= sequencer_view3d_cb(scene, camera, context.rectx, context.recty, IB_rect, context.scene->r.seq_prev_type, err_out);
-		if(ibuf == NULL) {
-			fprintf(stderr, "seq_render_scene_strip_impl failed to get opengl buffer: %s\n", err_out);
+		ibuf = sequencer_view3d_cb(scene, camera, context.rectx, context.recty,
+		                           IB_rect, context.scene->r.seq_prev_type, TRUE, err_out);
+		if (ibuf == NULL) {
+			fprintf(stderr, "seq_render_scene_strip failed to get opengl buffer: %s\n", err_out);
 		}
 	}
 	else {
@@ -2009,9 +2125,9 @@ static ImBuf * seq_render_scene_strip_impl(
 		RenderResult rres;
 
 		/* XXX: this if can be removed when sequence preview rendering uses the job system */
-		if(rendering || context.scene != scene) {
-			if(re==NULL)
-				re= RE_NewRender(scene->id.name);
+		if (rendering || context.scene != scene) {
+			if (re == NULL)
+				re = RE_NewRender(scene->id.name);
 			
 			RE_BlenderFrame(re, context.bmain, scene, NULL, camera, scene->lay, frame, FALSE);
 
@@ -2021,24 +2137,24 @@ static ImBuf * seq_render_scene_strip_impl(
 		
 		RE_AcquireResultImage(re, &rres);
 		
-		if(rres.rectf) {
-			ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rectfloat);
-			memcpy(ibuf->rect_float, rres.rectf, 4*sizeof(float)*rres.rectx*rres.recty);
-			if(rres.rectz) {
+		if (rres.rectf) {
+			ibuf = IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rectfloat);
+			memcpy(ibuf->rect_float, rres.rectf, 4 * sizeof(float) * rres.rectx * rres.recty);
+			if (rres.rectz) {
 				addzbuffloatImBuf(ibuf);
-				memcpy(ibuf->zbuf_float, rres.rectz, sizeof(float)*rres.rectx*rres.recty);
+				memcpy(ibuf->zbuf_float, rres.rectz, sizeof(float) * rres.rectx * rres.recty);
 			}
 
 			/* float buffers in the sequencer are not linear */
-			if(scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
-				ibuf->profile= IB_PROFILE_LINEAR_RGB;
+			if (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
+				ibuf->profile = IB_PROFILE_LINEAR_RGB;
 			else
-				ibuf->profile= IB_PROFILE_NONE;
+				ibuf->profile = IB_PROFILE_NONE;
 			IMB_convert_profile(ibuf, IB_PROFILE_SRGB);			
 		}
 		else if (rres.rect32) {
-			ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rect);
-			memcpy(ibuf->rect, rres.rect32, 4*rres.rectx*rres.recty);
+			ibuf = IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rect);
+			memcpy(ibuf->rect, rres.rect32, 4 * rres.rectx * rres.recty);
 		}
 		
 		RE_ReleaseResultImage(re);
@@ -2051,156 +2167,177 @@ static ImBuf * seq_render_scene_strip_impl(
 	
 	scene->r.cfra = oldcfra;
 
-	if(frame != oldcfra)
+	if (frame != oldcfra)
 		scene_update_for_newframe(context.bmain, scene, scene->lay);
 	
 #ifdef DURIAN_CAMERA_SWITCH
 	/* stooping to new low's in hackyness :( */
-	scene->markers= oldmarkers;
+	scene->markers = oldmarkers;
 #endif
 
 	return ibuf;
 }
 
-static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfra)
+static ImBuf *seq_render_strip(SeqRenderData context, Sequence *seq, float cfra)
 {
-	ImBuf * ibuf = NULL;
+	ImBuf *ibuf = NULL;
 	char name[FILE_MAX];
 	int use_preprocess = input_have_to_preprocess(context, seq, cfra);
+	int is_proxy_image = FALSE;
 	float nr = give_stripelem_index(seq, cfra);
 	/* all effects are handled similarly with the exception of speed effect */
 	int type = (seq->type & SEQ_EFFECT && seq->type != SEQ_SPEED) ? SEQ_EFFECT : seq->type;
+	int is_preprocessed = !ELEM3(type, SEQ_IMAGE, SEQ_MOVIE, SEQ_SCENE);
 
 	ibuf = seq_stripelem_cache_get(context, seq, cfra, SEQ_STRIPELEM_IBUF);
 
 	/* currently, we cache preprocessed images in SEQ_STRIPELEM_IBUF,
-	   but not(!) on SEQ_STRIPELEM_IBUF_ENDSTILL and ..._STARTSTILL */
+	 * but not(!) on SEQ_STRIPELEM_IBUF_ENDSTILL and ..._STARTSTILL */
 	if (ibuf)
 		use_preprocess = FALSE;
 
 	if (ibuf == NULL)
 		ibuf = copy_from_ibuf_still(context, seq, nr);
 	
-	if (ibuf == NULL)
+	/* MOVIECLIPs have their own proxy management */
+	if (ibuf == NULL && seq->type != SEQ_MOVIECLIP) {
 		ibuf = seq_proxy_fetch(context, seq, cfra);
+		is_proxy_image = (ibuf != NULL);
+	}
 
-	if(ibuf == NULL) switch(type) {
-		case SEQ_META:
-		{
-			ImBuf * meta_ibuf = NULL;
+	if (ibuf == NULL) switch (type) {
+			case SEQ_META:
+			{
+				ImBuf *meta_ibuf = NULL;
 
-			if(seq->seqbase.first)
-				meta_ibuf = seq_render_strip_stack(
-					context, &seq->seqbase,
-					seq->start + nr, 0);
+				if (seq->seqbase.first)
+					meta_ibuf = seq_render_strip_stack(
+					        context, &seq->seqbase,
+					        seq->start + nr, 0);
 
-			if(meta_ibuf) {
-				ibuf = meta_ibuf;
-				if(ibuf && use_preprocess) {
-					struct ImBuf * i = IMB_dupImBuf(ibuf);
+				if (meta_ibuf) {
+					ibuf = meta_ibuf;
+					if (ibuf && use_preprocess) {
+						ImBuf *i = IMB_dupImBuf(ibuf);
 
-					IMB_freeImBuf(ibuf);
+						IMB_freeImBuf(ibuf);
 
-					ibuf = i;
+						ibuf = i;
+					}
 				}
+
+				break;
 			}
-			break;
-		}
-		case SEQ_SPEED:
-		{
-			ImBuf * child_ibuf = NULL;
+			case SEQ_SPEED:
+			{
+				ImBuf *child_ibuf = NULL;
 
-			float f_cfra;
-			SpeedControlVars * s = (SpeedControlVars *)seq->effectdata;
+				float f_cfra;
+				SpeedControlVars *s = (SpeedControlVars *)seq->effectdata;
 
-			sequence_effect_speed_rebuild_map(context.scene,seq, 0);
+				sequence_effect_speed_rebuild_map(context.scene, seq, 0);
 
-			/* weeek! */
-			f_cfra = seq->start + s->frameMap[(int) nr];
+				/* weeek! */
+				f_cfra = seq->start + s->frameMap[(int)nr];
 
-			child_ibuf = seq_render_strip(context,seq->seq1,f_cfra);
+				child_ibuf = seq_render_strip(context, seq->seq1, f_cfra);
 
-			if (child_ibuf) {
-				ibuf = child_ibuf;
-				if(ibuf && use_preprocess) {
-					struct ImBuf * i = IMB_dupImBuf(ibuf);
+				if (child_ibuf) {
+					ibuf = child_ibuf;
+					if (ibuf && use_preprocess) {
+						ImBuf *i = IMB_dupImBuf(ibuf);
 
-					IMB_freeImBuf(ibuf);
+						IMB_freeImBuf(ibuf);
 
-					ibuf = i;
+						ibuf = i;
+					}
 				}
+				break;
 			}
-			break;
-		}
-		case SEQ_EFFECT:
-		{
-			ibuf = seq_render_effect_strip_impl(
-				context, seq, seq->start + nr);
-			break;
-		}
-		case SEQ_IMAGE:
-		{
-			StripElem * s_elem = give_stripelem(seq, cfra);
-
-			if (s_elem) {
-				BLI_join_dirfile(name, sizeof(name), seq->strip->dir, s_elem->name);
-				BLI_path_abs(name, G.main->name);
+			case SEQ_EFFECT:
+			{
+				ibuf = seq_render_effect_strip_impl(
+				        context, seq, seq->start + nr);
+				break;
 			}
+			case SEQ_IMAGE:
+			{
+				StripElem *s_elem = give_stripelem(seq, cfra);
 
-			if (s_elem && (ibuf = IMB_loadiffname(name, IB_rect))) {
-				/* we don't need both (speed reasons)! */
-				if (ibuf->rect_float && ibuf->rect)
-					imb_freerectImBuf(ibuf);
+				if (s_elem) {
+					BLI_join_dirfile(name, sizeof(name), seq->strip->dir, s_elem->name);
+					BLI_path_abs(name, G.main->name);
+				}
 
-				/* all sequencer color is done in SRGB space, linear gives odd crossfades */
-				if(ibuf->profile == IB_PROFILE_LINEAR_RGB)
-					IMB_convert_profile(ibuf, IB_PROFILE_NONE);
+				if (s_elem && (ibuf = IMB_loadiffname(name, IB_rect))) {
+					/* we don't need both (speed reasons)! */
+					if (ibuf->rect_float && ibuf->rect)
+						imb_freerectImBuf(ibuf);
 
-				copy_to_ibuf_still(context, seq, nr, ibuf);
+					/* all sequencer color is done in SRGB space, linear gives odd crossfades */
+					if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
+						IMB_convert_profile(ibuf, IB_PROFILE_NONE);
+
+					copy_to_ibuf_still(context, seq, nr, ibuf);
 
-				s_elem->orig_width  = ibuf->x;
-				s_elem->orig_height = ibuf->y;
+					s_elem->orig_width  = ibuf->x;
+					s_elem->orig_height = ibuf->y;
+				}
+				break;
 			}
-			break;
-		}
-		case SEQ_MOVIE:
-		{
-			seq_open_anim_file(seq);
-
-			if(seq->anim) {
-				IMB_anim_set_preseek(seq->anim,
-						     seq->anim_preseek);
-
-				ibuf = IMB_anim_absolute(
-					seq->anim, nr + seq->anim_startofs, 
-					seq->strip->proxy ? 
-					seq->strip->proxy->tc
-					: IMB_TC_RECORD_RUN, 
-					seq_rendersize_to_proxysize(
-						context.preview_render_size));
-
-				/* we don't need both (speed reasons)! */
-				if (ibuf && ibuf->rect_float && ibuf->rect)
-					imb_freerectImBuf(ibuf);
-				if (ibuf) {
-					seq->strip->stripdata->orig_width = ibuf->x;
-					seq->strip->stripdata->orig_height = ibuf->y;
+			case SEQ_MOVIE:
+			{
+				seq_open_anim_file(seq);
+
+				if (seq->anim) {
+					IMB_anim_set_preseek(seq->anim,
+					                     seq->anim_preseek);
+
+					ibuf = IMB_anim_absolute(
+					        seq->anim, nr + seq->anim_startofs,
+					        seq->strip->proxy ?
+					            seq->strip->proxy->tc :
+					            IMB_TC_RECORD_RUN,
+					        seq_rendersize_to_proxysize(
+					            context.preview_render_size));
+
+					/* we don't need both (speed reasons)! */
+					if (ibuf && ibuf->rect_float && ibuf->rect)
+						imb_freerectImBuf(ibuf);
+					if (ibuf) {
+						seq->strip->stripdata->orig_width = ibuf->x;
+						seq->strip->stripdata->orig_height = ibuf->y;
+					}
 				}
+				copy_to_ibuf_still(context, seq, nr, ibuf);
+				break;
 			}
-			copy_to_ibuf_still(context, seq, nr, ibuf);
-			break;
-		}
-		case SEQ_SCENE:
-		{	// scene can be NULL after deletions
-			ibuf = seq_render_scene_strip_impl(context, seq, nr);
+			case SEQ_SCENE:
+			{ // scene can be NULL after deletions
+				ibuf = seq_render_scene_strip(context, seq, nr);
 
-			/* Scene strips update all animation, so we need to restore original state.*/
-			BKE_animsys_evaluate_all_animation(context.bmain, context.scene, cfra);
+				/* Scene strips update all animation, so we need to restore original state.*/
+				BKE_animsys_evaluate_all_animation(context.bmain, context.scene, cfra);
 
-			copy_to_ibuf_still(context, seq, nr, ibuf);
-			break;
+				copy_to_ibuf_still(context, seq, nr, ibuf);
+				break;
+			}
+			case SEQ_MOVIECLIP:
+			{
+				ibuf = seq_render_movieclip_strip(context, seq, nr);
+
+				if (ibuf && use_preprocess) {
+					ImBuf *i = IMB_dupImBuf(ibuf);
+
+					IMB_freeImBuf(ibuf);
+
+					ibuf = i;
+				}
+
+				copy_to_ibuf_still(context, seq, nr, ibuf);
+				break;
+			}
 		}
-	}
 
 	if (ibuf == NULL)
 		ibuf = IMB_allocImBuf((short)context.rectx, (short)context.recty, 32, IB_rect);
@@ -2209,7 +2346,8 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr
 		use_preprocess = TRUE;
 
 	if (use_preprocess)
-		ibuf = input_preprocess(context, seq, cfra, ibuf);
+		ibuf = input_preprocess(context, seq, cfra, ibuf, 
+		                        is_proxy_image, is_preprocessed);
 
 	seq_stripelem_cache_put(context, seq, cfra, SEQ_STRIPELEM_IBUF, ibuf);
 
@@ -2217,15 +2355,15 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr
 }
 
 /* **********************************************************************
-   strip stack rendering functions
-   ********************************************************************** */
+ * strip stack rendering functions
+ * ********************************************************************** */
 
-static int seq_must_swap_input_in_blend_mode(Sequence * seq)
+static int seq_must_swap_input_in_blend_mode(Sequence *seq)
 {
 	int swap_input = FALSE;
 
 	/* bad hack, to fix crazy input ordering of 
-	   those two effects */
+	 * those two effects */
 
 	if (ELEM3(seq->blend_mode, SEQ_ALPHAOVER, SEQ_ALPHAUNDER, SEQ_OVERDROP)) {
 		swap_input = TRUE;
@@ -2234,7 +2372,7 @@ static int seq_must_swap_input_in_blend_mode(Sequence * seq)
 	return swap_input;
 }
 
-static int seq_get_early_out_for_blend_mode(Sequence * seq)
+static int seq_get_early_out_for_blend_mode(Sequence *seq)
 {
 	struct SeqEffectHandle sh = get_sequence_blend(seq);
 	float facf = seq->blend_opacity / 100.0f;
@@ -2247,20 +2385,21 @@ static int seq_get_early_out_for_blend_mode(Sequence * seq)
 	if (seq_must_swap_input_in_blend_mode(seq)) {
 		if (early_out == EARLY_USE_INPUT_2) {
 			return EARLY_USE_INPUT_1;
-		} else if (early_out == EARLY_USE_INPUT_1) {
+		}
+		else if (early_out == EARLY_USE_INPUT_1) {
 			return EARLY_USE_INPUT_2;
 		}
 	}
 	return early_out;
 }
 
-static ImBuf* seq_render_strip_stack(
-	SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown)
+static ImBuf *seq_render_strip_stack(
+        SeqRenderData context, ListBase *seqbasep, float cfra, int chanshown)
 {
-	Sequence* seq_arr[MAXSEQ+1];
+	Sequence *seq_arr[MAXSEQ + 1];
 	int count;
 	int i;
-	ImBuf* out = NULL;
+	ImBuf *out = NULL;
 
 	count = get_shown_sequences(seqbasep, cfra, chanshown, (Sequence **)&seq_arr);
 
@@ -2269,24 +2408,24 @@ static ImBuf* seq_render_strip_stack(
 	}
 
 #if 0 /* commentind since this breaks keyframing, since it resets the value on draw */
-	if(scene->r.cfra != cfra) {
+	if (scene->r.cfra != cfra) {
 		// XXX for prefetch and overlay offset!..., very bad!!!
-		AnimData *adt= BKE_animdata_from_id(&scene->id);
+		AnimData *adt = BKE_animdata_from_id(&scene->id);
 		BKE_animsys_evaluate_animdata(scene, &scene->id, adt, cfra, ADT_RECALC_ANIM);
 	}
 #endif
 
 	out = seq_stripelem_cache_get(context, seq_arr[count - 1], 
-				      cfra, SEQ_STRIPELEM_IBUF_COMP);
+	                              cfra, SEQ_STRIPELEM_IBUF_COMP);
 
 	if (out) {
 		return out;
 	}
 	
-	if(count == 1) {
+	if (count == 1) {
 		out = seq_render_strip(context, seq_arr[0], cfra);
 		seq_stripelem_cache_put(context, seq_arr[0], cfra, 
-					SEQ_STRIPELEM_IBUF_COMP, out);
+		                        SEQ_STRIPELEM_IBUF_COMP, out);
 
 		return out;
 	}
@@ -2297,7 +2436,7 @@ static ImBuf* seq_render_strip_stack(
 		Sequence *seq = seq_arr[i];
 
 		out = seq_stripelem_cache_get(
-			context, seq, cfra, SEQ_STRIPELEM_IBUF_COMP);
+		        context, seq, cfra, SEQ_STRIPELEM_IBUF_COMP);
 
 		if (out) {
 			break;
@@ -2310,21 +2449,21 @@ static ImBuf* seq_render_strip_stack(
 		early_out = seq_get_early_out_for_blend_mode(seq);
 
 		switch (early_out) {
-		case EARLY_NO_INPUT:
-		case EARLY_USE_INPUT_2:
-			out = seq_render_strip(context, seq, cfra);
-			break;
-		case EARLY_USE_INPUT_1:
-			if (i == 0) {
-				out = IMB_allocImBuf((short)context.rectx, (short)context.recty, 32, IB_rect);
-			}
-			break;
-		case EARLY_DO_EFFECT:
-			if (i == 0) {
+			case EARLY_NO_INPUT:
+			case EARLY_USE_INPUT_2:
 				out = seq_render_strip(context, seq, cfra);
-			}
+				break;
+			case EARLY_USE_INPUT_1:
+				if (i == 0) {
+					out = IMB_allocImBuf((short)context.rectx, (short)context.recty, 32, IB_rect);
+				}
+				break;
+			case EARLY_DO_EFFECT:
+				if (i == 0) {
+					out = seq_render_strip(context, seq, cfra);
+				}
 
-			break;
+				break;
 		}
 		if (out) {
 			break;
@@ -2332,30 +2471,31 @@ static ImBuf* seq_render_strip_stack(
 	}
 
 	seq_stripelem_cache_put(context, seq_arr[i], cfra, 
-				SEQ_STRIPELEM_IBUF_COMP, out);
+	                        SEQ_STRIPELEM_IBUF_COMP, out);
 
 
 	i++;
 
 	for (; i < count; i++) {
-		Sequence * seq = seq_arr[i];
+		Sequence *seq = seq_arr[i];
 
 		if (seq_get_early_out_for_blend_mode(seq) == EARLY_DO_EFFECT) {
 			struct SeqEffectHandle sh = get_sequence_blend(seq);
-			ImBuf * ibuf1 = out;
-			ImBuf * ibuf2 = seq_render_strip(context, seq, cfra);
+			ImBuf *ibuf1 = out;
+			ImBuf *ibuf2 = seq_render_strip(context, seq, cfra);
 
 			float facf = seq->blend_opacity / 100.0f;
 			int swap_input = seq_must_swap_input_in_blend_mode(seq);
 
 			if (swap_input) {
 				out = sh.execute(context, seq, cfra, 
-						 facf, facf, 
-						 ibuf2, ibuf1, NULL);
-			} else {
+				                 facf, facf,
+				                 ibuf2, ibuf1, NULL);
+			}
+			else {
 				out = sh.execute(context, seq, cfra, 
-						 facf, facf, 
-						 ibuf1, ibuf2, NULL);
+				                 facf, facf,
+				                 ibuf1, ibuf2, NULL);
 			}
 		
 			IMB_freeImBuf(ibuf1);
@@ -2363,7 +2503,7 @@ static ImBuf* seq_render_strip_stack(
 		}
 
 		seq_stripelem_cache_put(context, seq_arr[i], cfra,
-					SEQ_STRIPELEM_IBUF_COMP, out);
+		                        SEQ_STRIPELEM_IBUF_COMP, out);
 	}
 
 	return out;
@@ -2376,18 +2516,19 @@ static ImBuf* seq_render_strip_stack(
 
 ImBuf *give_ibuf_seq(SeqRenderData context, float cfra, int chanshown)
 {
-	Editing *ed= seq_give_editing(context.scene, FALSE);
+	Editing *ed = seq_give_editing(context.scene, FALSE);
 	int count;
 	ListBase *seqbasep;
 	
-	if(ed==NULL) return NULL;
+	if (ed == NULL) return NULL;
 
 	count = BLI_countlist(&ed->metastack);
-	if((chanshown < 0) && (count > 0)) {
+	if ((chanshown < 0) && (count > 0)) {
 		count = MAX2(count + chanshown, 0);
-		seqbasep= ((MetaStack*)BLI_findlink(&ed->metastack, count))->oldbasep;
-	} else {
-		seqbasep= ed->seqbasep;
+		seqbasep = ((MetaStack *)BLI_findlink(&ed->metastack, count))->oldbasep;
+	}
+	else {
+		seqbasep = ed->seqbasep;
 	}
 
 	return seq_render_strip_stack(context, seqbasep, cfra, chanshown);
@@ -2410,7 +2551,8 @@ static int seq_can_blend(Sequence *seq)
 {
 	if (ELEM4(seq->type, SEQ_IMAGE, SEQ_META, SEQ_SCENE, SEQ_MOVIE)) {
 		return 1;
-	} else {
+	}
+	else {
 		return 0;
 	}
 }
@@ -2424,13 +2566,13 @@ static ListBase prefetch_done;
 
 static pthread_mutex_t queue_lock          = PTHREAD_MUTEX_INITIALIZER;
 static pthread_mutex_t wakeup_lock         = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t  wakeup_cond         = PTHREAD_COND_INITIALIZER;
+static pthread_cond_t wakeup_cond          = PTHREAD_COND_INITIALIZER;
 
 //static pthread_mutex_t prefetch_ready_lock = PTHREAD_MUTEX_INITIALIZER;
 //static pthread_cond_t  prefetch_ready_cond = PTHREAD_COND_INITIALIZER;
 
 static pthread_mutex_t frame_done_lock     = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t  frame_done_cond     = PTHREAD_COND_INITIALIZER;
+static pthread_cond_t frame_done_cond      = PTHREAD_COND_INITIALIZER;
 
 static volatile int seq_thread_shutdown = TRUE; 
 static volatile int seq_last_given_monoton_cfra = 0;
@@ -2457,13 +2599,13 @@ typedef struct PrefetchQueueElem {
 
 	int monoton_cfra;
 
-	struct ImBuf * ibuf;
+	ImBuf *ibuf;
 } PrefetchQueueElem;
 
 #if 0
-static void *seq_prefetch_thread(void * This_)
+static void *seq_prefetch_thread(void *This_)
 {
-	PrefetchThread * This = This_;
+	PrefetchThread *This = This_;
 
 	while (!seq_thread_shutdown) {
 		PrefetchQueueElem *e;
@@ -2500,8 +2642,8 @@ static void *seq_prefetch_thread(void * This_)
 		
 		if (e->cfra >= s_last) { 
 			e->ibuf = give_ibuf_seq_impl(This->scene, 
-				e->rectx, e->recty, e->cfra, e->chanshown,
-				e->preview_render_size);
+			                             e->rectx, e->recty, e->cfra, e->chanshown,
+			                             e->preview_render_size);
 		}
 
 		pthread_mutex_lock(&queue_lock);
@@ -2543,17 +2685,17 @@ static void seq_start_threads(Scene *scene)
 	seq_last_given_monoton_cfra = monoton_cfra = 0;
 
 	/* since global structures are modified during the processing
-	   of one frame, only one render thread is currently possible... 
-
-	   (but we code, in the hope, that we can remove this restriction
-	   soon...)
-	*/
+	 * of one frame, only one render thread is currently possible...
+	 *
+	 * (but we code, in the hope, that we can remove this restriction
+	 * soon...)
+	 */
 
 	fprintf(stderr, "SEQ-THREAD: seq_start_threads\n");
 
 	for (i = 0; i < 1; i++) {
 		PrefetchThread *t = MEM_callocN(sizeof(PrefetchThread), "prefetch_thread");
-		t->scene= scene;
+		t->scene = scene;
 		t->running = TRUE;
 		BLI_addtail(&running_threads, t);
 
@@ -2583,7 +2725,7 @@ static void seq_stop_threads()
 	pthread_cond_broadcast(&wakeup_cond);
 	pthread_mutex_unlock(&wakeup_lock);
 
-	for(tslot = running_threads.first; tslot; tslot= tslot->next) {
+	for (tslot = running_threads.first; tslot; tslot = tslot->next) {
 		pthread_join(tslot->pthread, NULL);
 	}
 
@@ -2642,8 +2784,8 @@ static void seq_wait_for_prefetch_ready()
 
 	pthread_mutex_lock(&prefetch_ready_lock);
 
-	for(;;) {
-		for(tslot = running_threads.first; tslot; tslot= tslot->next) {
+	for (;; ) {
+		for (tslot = running_threads.first; tslot; tslot = tslot->next) {
 			if (tslot->running) {
 				break;
 			}
@@ -2675,10 +2817,11 @@ ImBuf *give_ibuf_seq_threaded(SeqRenderData context, float cfra, int chanshown)
 
 		for (e = prefetch_done.first; e; e = e->next) {
 			if (cfra == e->cfra &&
-				chanshown == e->chanshown &&
-				context.rectx == e->rectx && 
-				context.recty == e->recty &&
-				context.preview_render_size == e->preview_render_size) {
+			    chanshown == e->chanshown &&
+			    context.rectx == e->rectx &&
+			    context.recty == e->recty &&
+			    context.preview_render_size == e->preview_render_size)
+			{
 				success = TRUE;
 				found_something = TRUE;
 				break;
@@ -2688,10 +2831,11 @@ ImBuf *give_ibuf_seq_threaded(SeqRenderData context, float cfra, int chanshown)
 		if (!e) {
 			for (e = prefetch_wait.first; e; e = e->next) {
 				if (cfra == e->cfra &&
-					chanshown == e->chanshown &&
-					context.rectx == e->rectx && 
-					context.recty == e->recty &&
-					context.preview_render_size == e->preview_render_size) {
+				    chanshown == e->chanshown &&
+				    context.rectx == e->rectx &&
+				    context.recty == e->recty &&
+				    context.preview_render_size == e->preview_render_size)
+				{
 					found_something = TRUE;
 					break;
 				}
@@ -2701,14 +2845,17 @@ ImBuf *give_ibuf_seq_threaded(SeqRenderData context, float cfra, int chanshown)
 		if (!e) {
 			PrefetchThread *tslot;
 
-			for(tslot = running_threads.first; 
-				tslot; tslot= tslot->next) {
+			for (tslot = running_threads.first;
+			     tslot;
+			     tslot = tslot->next)
+			{
 				if (tslot->current &&
-					cfra == tslot->current->cfra &&
-					chanshown == tslot->current->chanshown &&
-					context.rectx == tslot->current->rectx && 
-					context.recty == tslot->current->recty &&
-					context.preview_render_size== tslot->current->preview_render_size){
+				    cfra == tslot->current->cfra &&
+				    chanshown == tslot->current->chanshown &&
+				    context.rectx == tslot->current->rectx &&
+				    context.recty == tslot->current->recty &&
+				    context.preview_render_size == tslot->current->preview_render_size)
+				{
 					found_something = TRUE;
 					break;
 				}
@@ -2728,8 +2875,8 @@ ImBuf *give_ibuf_seq_threaded(SeqRenderData context, float cfra, int chanshown)
 
 			if (!found_something) {
 				fprintf(stderr, 
-					"SEQ-THREAD: Requested frame "
-					"not in queue ???\n");
+				        "SEQ-THREAD: Requested frame "
+				        "not in queue ???\n");
 				break;
 			}
 			pthread_mutex_lock(&frame_done_lock);
@@ -2745,34 +2892,34 @@ ImBuf *give_ibuf_seq_threaded(SeqRenderData context, float cfra, int chanshown)
 
 static void free_anim_seq(Sequence *seq)
 {
-	if(seq->anim) {
+	if (seq->anim) {
 		IMB_free_anim(seq->anim);
 		seq->anim = NULL;
 	}
 }
 
-void free_imbuf_seq(Scene *scene, ListBase * seqbase, int check_mem_usage,
-		    int keep_file_handles)
+void free_imbuf_seq(Scene *scene, ListBase *seqbase, int check_mem_usage,
+                    int keep_file_handles)
 {
 	Sequence *seq;
 
 	if (check_mem_usage) {
 		/* Let the cache limitor take care of this (schlaile) */
 		/* While render let's keep all memory available for render 
-		   (ton)
-		   At least if free memory is tight...
-		   This can make a big difference in encoding speed
-		   (it is around 4 times(!) faster, if we do not waste time
-		   on freeing _all_ buffers every time on long timelines...)
-		   (schlaile)
-		*/
+		 * (ton)
+		 * At least if free memory is tight...
+		 * This can make a big difference in encoding speed
+		 * (it is around 4 times(!) faster, if we do not waste time
+		 * on freeing _all_ buffers every time on long timelines...)
+		 * (schlaile)
+		 */
 	
 		uintptr_t mem_in_use;
 		uintptr_t mmap_in_use;
 		uintptr_t max;
 	
-		mem_in_use= MEM_get_memory_in_use();
-		mmap_in_use= MEM_get_mapped_memory_in_use();
+		mem_in_use = MEM_get_memory_in_use();
+		mmap_in_use = MEM_get_mapped_memory_in_use();
 		max = MEM_CacheLimiter_get_maximum();
 	
 		if (max == 0 || mem_in_use + mmap_in_use <= max) {
@@ -2782,20 +2929,20 @@ void free_imbuf_seq(Scene *scene, ListBase * seqbase, int check_mem_usage,
 
 	seq_stripelem_cache_cleanup();
 	
-	for(seq= seqbase->first; seq; seq= seq->next) {
-		if(seq->strip) {
-			if(seq->type==SEQ_MOVIE && !keep_file_handles)
+	for (seq = seqbase->first; seq; seq = seq->next) {
+		if (seq->strip) {
+			if (seq->type == SEQ_MOVIE && !keep_file_handles)
 				free_anim_seq(seq);
-			if(seq->type==SEQ_SPEED) {
+			if (seq->type == SEQ_SPEED) {
 				sequence_effect_speed_rebuild_map(scene, seq, 1);
 			}
 		}
-		if(seq->type==SEQ_META) {
+		if (seq->type == SEQ_META) {
 			free_imbuf_seq(scene, &seq->seqbase, FALSE, keep_file_handles);
 		}
-		if(seq->type==SEQ_SCENE) {
+		if (seq->type == SEQ_SCENE) {
 			/* FIXME: recurs downwards, 
-			   but do recurs protection somehow! */
+			 * but do recurs protection somehow! */
 		}
 	}
 	
@@ -2808,36 +2955,36 @@ static int update_changed_seq_recurs(Scene *scene, Sequence *seq, Sequence *chan
 	
 	/* recurs downwards to see if this seq depends on the changed seq */
 	
-	if(seq == NULL)
+	if (seq == NULL)
 		return 0;
 	
-	if(seq == changed_seq)
+	if (seq == changed_seq)
 		free_imbuf = 1;
 	
-	for(subseq=seq->seqbase.first; subseq; subseq=subseq->next)
-		if(update_changed_seq_recurs(scene, subseq, changed_seq, len_change, ibuf_change))
+	for (subseq = seq->seqbase.first; subseq; subseq = subseq->next)
+		if (update_changed_seq_recurs(scene, subseq, changed_seq, len_change, ibuf_change))
 			free_imbuf = TRUE;
 	
-	if(seq->seq1)
-		if(update_changed_seq_recurs(scene, seq->seq1, changed_seq, len_change, ibuf_change))
+	if (seq->seq1)
+		if (update_changed_seq_recurs(scene, seq->seq1, changed_seq, len_change, ibuf_change))
 			free_imbuf = TRUE;
-	if(seq->seq2 && (seq->seq2 != seq->seq1))
-		if(update_changed_seq_recurs(scene, seq->seq2, changed_seq, len_change, ibuf_change))
+	if (seq->seq2 && (seq->seq2 != seq->seq1))
+		if (update_changed_seq_recurs(scene, seq->seq2, changed_seq, len_change, ibuf_change))
 			free_imbuf = TRUE;
-	if(seq->seq3 && (seq->seq3 != seq->seq1) && (seq->seq3 != seq->seq2))
-		if(update_changed_seq_recurs(scene, seq->seq3, changed_seq, len_change, ibuf_change))
+	if (seq->seq3 && (seq->seq3 != seq->seq1) && (seq->seq3 != seq->seq2))
+		if (update_changed_seq_recurs(scene, seq->seq3, changed_seq, len_change, ibuf_change))
 			free_imbuf = TRUE;
 	
-	if(free_imbuf) {
-		if(ibuf_change) {
-			if(seq->type == SEQ_MOVIE)
+	if (free_imbuf) {
+		if (ibuf_change) {
+			if (seq->type == SEQ_MOVIE)
 				free_anim_seq(seq);
-			if(seq->type == SEQ_SPEED) {
+			if (seq->type == SEQ_SPEED) {
 				sequence_effect_speed_rebuild_map(scene, seq, 1);
 			}
 		}
 		
-		if(len_change)
+		if (len_change)
 			calc_sequence(scene, seq);
 	}
 	
@@ -2846,36 +2993,37 @@ static int update_changed_seq_recurs(Scene *scene, Sequence *seq, Sequence *chan
 
 void update_changed_seq_and_deps(Scene *scene, Sequence *changed_seq, int len_change, int ibuf_change)
 {
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	Sequence *seq;
 	
-	if (ed==NULL) return;
+	if (ed == NULL) return;
 	
-	for (seq=ed->seqbase.first; seq; seq=seq->next)
+	for (seq = ed->seqbase.first; seq; seq = seq->next)
 		update_changed_seq_recurs(scene, seq, changed_seq, len_change, ibuf_change);
 }
 
 /* seq funcs's for transforming internally
- notice the difference between start/end and left/right.
-
- left and right are the bounds at which the sequence is rendered,
-start and end are from the start and fixed length of the sequence.
-*/
+ * notice the difference between start/end and left/right.
+ *
+ * left and right are the bounds at which the sequence is rendered,
+ * start and end are from the start and fixed length of the sequence.
+ */
 int seq_tx_get_start(Sequence *seq)
 {
 	return seq->start;
 }
 int seq_tx_get_end(Sequence *seq)
 {
-	return seq->start+seq->len;
+	return seq->start + seq->len;
 }
 
 int seq_tx_get_final_left(Sequence *seq, int metaclip)
 {
 	if (metaclip && seq->tmp) {
 		/* return the range clipped by the parents range */
-		return MAX2( seq_tx_get_final_left(seq, 0), seq_tx_get_final_left((Sequence *)seq->tmp, 1) );
-	} else {
+		return MAX2(seq_tx_get_final_left(seq, 0), seq_tx_get_final_left((Sequence *)seq->tmp, 1) );
+	}
+	else {
 		return (seq->start - seq->startstill) + seq->startofs;
 	}
 
@@ -2884,9 +3032,10 @@ int seq_tx_get_final_right(Sequence *seq, int metaclip)
 {
 	if (metaclip && seq->tmp) {
 		/* return the range clipped by the parents range */
-		return MIN2( seq_tx_get_final_right(seq, 0), seq_tx_get_final_right((Sequence *)seq->tmp, 1) );
-	} else {
-		return ((seq->start+seq->len) + seq->endstill) - seq->endofs;
+		return MIN2(seq_tx_get_final_right(seq, 0), seq_tx_get_final_right((Sequence *)seq->tmp, 1) );
+	}
+	else {
+		return ((seq->start + seq->len) + seq->endstill) - seq->endofs;
 	}
 }
 
@@ -2895,7 +3044,8 @@ void seq_tx_set_final_left(Sequence *seq, int val)
 	if (val < (seq)->start) {
 		seq->startstill = abs(val - (seq)->start);
 		seq->startofs = 0;
-	} else {
+	}
+	else {
 		seq->startofs = abs(val - (seq)->start);
 		seq->startstill = 0;
 	}
@@ -2906,20 +3056,21 @@ void seq_tx_set_final_right(Sequence *seq, int val)
 	if (val > (seq)->start + (seq)->len) {
 		seq->endstill = abs(val - (seq->start + (seq)->len));
 		seq->endofs = 0;
-	} else {
+	}
+	else {
 		seq->endofs = abs(val - ((seq)->start + (seq)->len));
 		seq->endstill = 0;
 	}
 }
 
 /* used so we can do a quick check for single image seq
-   since they work a bit differently to normal image seq's (during transform) */
+ * since they work a bit differently to normal image seq's (during transform) */
 int seq_single_check(Sequence *seq)
 {
-	return (seq->len==1 && (
-			seq->type == SEQ_IMAGE 
-			|| ((seq->type & SEQ_EFFECT) && 
-	            get_sequence_effect_num_inputs(seq->type) == 0)));
+	return ((seq->len == 1) &&
+	        (seq->type == SEQ_IMAGE ||
+	         ((seq->type & SEQ_EFFECT) &&
+	          get_sequence_effect_num_inputs(seq->type) == 0)));
 }
 
 /* check if the selected seq's reference unselected seq's */
@@ -2927,33 +3078,33 @@ int seqbase_isolated_sel_check(ListBase *seqbase)
 {
 	Sequence *seq;
 	/* is there more than 1 select */
-	int ok= FALSE;
+	int ok = FALSE;
 
-	for(seq= seqbase->first; seq; seq= seq->next) {
-		if(seq->flag & SELECT) {
-			ok= TRUE;
+	for (seq = seqbase->first; seq; seq = seq->next) {
+		if (seq->flag & SELECT) {
+			ok = TRUE;
 			break;
 		}
 	}
 
-	if(ok == FALSE)
+	if (ok == FALSE)
 		return FALSE;
 
 	/* test relationships */
-	for(seq= seqbase->first; seq; seq= seq->next) {
-		if((seq->type & SEQ_EFFECT)==0)
+	for (seq = seqbase->first; seq; seq = seq->next) {
+		if ((seq->type & SEQ_EFFECT) == 0)
 			continue;
 
-		if(seq->flag & SELECT) {
-			if( (seq->seq1 && (seq->seq1->flag & SELECT)==0) ||
-				(seq->seq2 && (seq->seq2->flag & SELECT)==0) ||
-				(seq->seq3 && (seq->seq3->flag & SELECT)==0) )
+		if (seq->flag & SELECT) {
+			if ( (seq->seq1 && (seq->seq1->flag & SELECT) == 0) ||
+			     (seq->seq2 && (seq->seq2->flag & SELECT) == 0) ||
+			     (seq->seq3 && (seq->seq3->flag & SELECT) == 0) )
 				return FALSE;
 		}
 		else {
-			if( (seq->seq1 && (seq->seq1->flag & SELECT)) ||
-				(seq->seq2 && (seq->seq2->flag & SELECT)) ||
-				(seq->seq3 && (seq->seq3->flag & SELECT)) )
+			if ( (seq->seq1 && (seq->seq1->flag & SELECT)) ||
+			     (seq->seq2 && (seq->seq2->flag & SELECT)) ||
+			     (seq->seq3 && (seq->seq3->flag & SELECT)) )
 				return FALSE;
 		}
 	}
@@ -2961,48 +3112,48 @@ int seqbase_isolated_sel_check(ListBase *seqbase)
 	return TRUE;
 }
 
-/* use to impose limits when dragging/extending - so impossible situations dont happen
+/* use to impose limits when dragging/extending - so impossible situations don't happen
  * Cant use the SEQ_LEFTSEL and SEQ_LEFTSEL directly because the strip may be in a metastrip */
 void seq_tx_handle_xlimits(Sequence *seq, int leftflag, int rightflag)
 {
-	if(leftflag) {
+	if (leftflag) {
 		if (seq_tx_get_final_left(seq, 0) >= seq_tx_get_final_right(seq, 0)) {
-			seq_tx_set_final_left(seq, seq_tx_get_final_right(seq, 0)-1);
+			seq_tx_set_final_left(seq, seq_tx_get_final_right(seq, 0) - 1);
 		}
 
-		if (seq_single_check(seq)==0) {
+		if (seq_single_check(seq) == 0) {
 			if (seq_tx_get_final_left(seq, 0) >= seq_tx_get_end(seq)) {
-				seq_tx_set_final_left(seq, seq_tx_get_end(seq)-1);
+				seq_tx_set_final_left(seq, seq_tx_get_end(seq) - 1);
 			}
 
 			/* dosnt work now - TODO */
-			/*
+#if 0
 			if (seq_tx_get_start(seq) >= seq_tx_get_final_right(seq, 0)) {
 				int ofs;
 				ofs = seq_tx_get_start(seq) - seq_tx_get_final_right(seq, 0);
 				seq->start -= ofs;
-				seq_tx_set_final_left(seq, seq_tx_get_final_left(seq, 0) + ofs );
-			}*/
-
+				seq_tx_set_final_left(seq, seq_tx_get_final_left(seq, 0) + ofs);
+			}
+#endif
 		}
 	}
 
-	if(rightflag) {
+	if (rightflag) {
 		if (seq_tx_get_final_right(seq, 0) <=  seq_tx_get_final_left(seq, 0)) {
-			seq_tx_set_final_right(seq, seq_tx_get_final_left(seq, 0)+1);
+			seq_tx_set_final_right(seq, seq_tx_get_final_left(seq, 0) + 1);
 		}
 
-		if (seq_single_check(seq)==0) {
+		if (seq_single_check(seq) == 0) {
 			if (seq_tx_get_final_right(seq, 0) <= seq_tx_get_start(seq)) {
-				seq_tx_set_final_right(seq, seq_tx_get_start(seq)+1);
+				seq_tx_set_final_right(seq, seq_tx_get_start(seq) + 1);
 			}
 		}
 	}
 
 	/* sounds cannot be extended past their endpoints */
 	if (seq->type == SEQ_SOUND) {
-		seq->startstill= 0;
-		seq->endstill= 0;
+		seq->startstill = 0;
+		seq->endstill = 0;
 	}
 }
 
@@ -3013,18 +3164,18 @@ void seq_single_fix(Sequence *seq)
 		return;
 
 	/* make sure the image is always at the start since there is only one,
-	   adjusting its start should be ok */
+	 * adjusting its start should be ok */
 	left = seq_tx_get_final_left(seq, 0);
 	start = seq->start;
 	if (start != left) {
 		offset = left - start;
-		seq_tx_set_final_left( seq, seq_tx_get_final_left(seq, 0) - offset );
-		seq_tx_set_final_right( seq, seq_tx_get_final_right(seq, 0) - offset );
+		seq_tx_set_final_left(seq, seq_tx_get_final_left(seq, 0) - offset);
+		seq_tx_set_final_right(seq, seq_tx_get_final_right(seq, 0) - offset);
 		seq->start += offset;
 	}
 }
 
-int seq_tx_test(Sequence * seq)
+int seq_tx_test(Sequence *seq)
 {
 	return (seq->type < SEQ_EFFECT) || (get_sequence_effect_num_inputs(seq->type) == 0);
 }
@@ -3032,19 +3183,19 @@ int seq_tx_test(Sequence * seq)
 static int seq_overlap(Sequence *seq1, Sequence *seq2)
 {
 	return (seq1 != seq2 && seq1->machine == seq2->machine &&
-			((seq1->enddisp <= seq2->startdisp) || (seq1->startdisp >= seq2->enddisp))==0);
+	        ((seq1->enddisp <= seq2->startdisp) || (seq1->startdisp >= seq2->enddisp)) == 0);
 }
 
-int seq_test_overlap(ListBase * seqbasep, Sequence *test)
+int seq_test_overlap(ListBase *seqbasep, Sequence *test)
 {
 	Sequence *seq;
 
-	seq= seqbasep->first;
-	while(seq) {
-		if(seq_overlap(test, seq))
+	seq = seqbasep->first;
+	while (seq) {
+		if (seq_overlap(test, seq))
 			return 1;
 
-		seq= seq->next;
+		seq = seq->next;
 	}
 	return 0;
 }
@@ -3055,9 +3206,9 @@ void seq_translate(Scene *evil_scene, Sequence *seq, int delta)
 	seq_offset_animdata(evil_scene, seq, delta);
 	seq->start += delta;
 
-	if(seq->type==SEQ_META) {
+	if (seq->type == SEQ_META) {
 		Sequence *seq_child;
-		for(seq_child= seq->seqbase.first; seq_child; seq_child= seq_child->next) {
+		for (seq_child = seq->seqbase.first; seq_child; seq_child = seq_child->next) {
 			seq_translate(evil_scene, seq_child, delta);
 		}
 	}
@@ -3067,17 +3218,17 @@ void seq_translate(Scene *evil_scene, Sequence *seq, int delta)
 
 void seq_sound_init(Scene *scene, Sequence *seq)
 {
-	if(seq->type==SEQ_META) {
+	if (seq->type == SEQ_META) {
 		Sequence *seq_child;
-		for(seq_child= seq->seqbase.first; seq_child; seq_child= seq_child->next) {
+		for (seq_child = seq->seqbase.first; seq_child; seq_child = seq_child->next) {
 			seq_sound_init(scene, seq_child);
 		}
 	}
 	else {
-		if(seq->sound) {
+		if (seq->sound) {
 			seq->scene_sound = sound_add_scene_sound_defaults(scene, seq);
 		}
-		if(seq->scene) {
+		if (seq->scene) {
 			sound_scene_add_scene_sound_defaults(scene, seq);
 		}
 	}
@@ -3085,14 +3236,14 @@ void seq_sound_init(Scene *scene, Sequence *seq)
 
 Sequence *seq_foreground_frame_get(Scene *scene, int frame)
 {
-	Editing *ed= seq_give_editing(scene, FALSE);
-	Sequence *seq, *best_seq=NULL;
+	Editing *ed = seq_give_editing(scene, FALSE);
+	Sequence *seq, *best_seq = NULL;
 	int best_machine = -1;
 	
-	if(!ed) return NULL;
+	if (!ed) return NULL;
 	
-	for (seq=ed->seqbasep->first; seq; seq= seq->next) {
-		if(seq->flag & SEQ_MUTE || seq->startdisp > frame || seq->enddisp <= frame)
+	for (seq = ed->seqbasep->first; seq; seq = seq->next) {
+		if (seq->flag & SEQ_MUTE || seq->startdisp > frame || seq->enddisp <= frame)
 			continue;
 		/* only use elements you can see - not */
 		if (ELEM5(seq->type, SEQ_IMAGE, SEQ_META, SEQ_SCENE, SEQ_MOVIE, SEQ_COLOR)) {
@@ -3106,57 +3257,58 @@ Sequence *seq_foreground_frame_get(Scene *scene, int frame)
 }
 
 /* return 0 if there werent enough space */
-int shuffle_seq(ListBase * seqbasep, Sequence *test, Scene *evil_scene)
+int shuffle_seq(ListBase *seqbasep, Sequence *test, Scene *evil_scene)
 {
-	int orig_machine= test->machine;
+	int orig_machine = test->machine;
 	test->machine++;
 	calc_sequence(evil_scene, test);
-	while( seq_test_overlap(seqbasep, test) ) {
-		if(test->machine >= MAXSEQ) {
+	while (seq_test_overlap(seqbasep, test) ) {
+		if (test->machine >= MAXSEQ) {
 			break;
 		}
 		test->machine++;
-		calc_sequence(evil_scene, test); // XXX - I dont think this is needed since were only moving vertically, Campbell.
+		calc_sequence(evil_scene, test); // XXX - I don't think this is needed since were only moving vertically, Campbell.
 	}
 
 	
-	if(test->machine >= MAXSEQ) {
+	if (test->machine >= MAXSEQ) {
 		/* Blender 2.4x would remove the strip.
 		 * nicer to move it to the end */
 
 		Sequence *seq;
-		int new_frame= test->enddisp;
+		int new_frame = test->enddisp;
 
-		for(seq= seqbasep->first; seq; seq= seq->next) {
+		for (seq = seqbasep->first; seq; seq = seq->next) {
 			if (seq->machine == orig_machine)
 				new_frame = MAX2(new_frame, seq->enddisp);
 		}
 
-		test->machine= orig_machine;
-		new_frame = new_frame + (test->start-test->startdisp); /* adjust by the startdisp */
+		test->machine = orig_machine;
+		new_frame = new_frame + (test->start - test->startdisp); /* adjust by the startdisp */
 		seq_translate(evil_scene, test, new_frame - test->start);
 
 		calc_sequence(evil_scene, test);
 		return 0;
-	} else {
+	}
+	else {
 		return 1;
 	}
 }
 
-static int shuffle_seq_time_offset_test(ListBase * seqbasep, char dir)
+static int shuffle_seq_time_offset_test(ListBase *seqbasep, char dir)
 {
-	int offset= 0;
+	int offset = 0;
 	Sequence *seq, *seq_other;
 
-	for(seq= seqbasep->first; seq; seq= seq->next) {
-		if(seq->tmp) {
-			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);
+	for (seq = seqbasep->first; seq; seq = seq->next) {
+		if (seq->tmp) {
+			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);
 					}
 					else {
-						offset= MAX2(offset, seq_other->enddisp - seq->startdisp);
+						offset = MAX2(offset, seq_other->enddisp - seq->startdisp);
 					}
 				}
 			}
@@ -3165,32 +3317,32 @@ static int shuffle_seq_time_offset_test(ListBase * seqbasep, char dir)
 	return offset;
 }
 
-static int shuffle_seq_time_offset(Scene* scene, ListBase * seqbasep, char dir)
+static int shuffle_seq_time_offset(Scene *scene, ListBase *seqbasep, char dir)
 {
-	int ofs= 0;
-	int tot_ofs= 0;
+	int ofs = 0;
+	int tot_ofs = 0;
 	Sequence *seq;
-	while( (ofs= shuffle_seq_time_offset_test(seqbasep, dir)) ) {
-		for(seq= seqbasep->first; seq; seq= seq->next) {
-			if(seq->tmp) {
+	while ( (ofs = shuffle_seq_time_offset_test(seqbasep, dir)) ) {
+		for (seq = seqbasep->first; seq; seq = seq->next) {
+			if (seq->tmp) {
 				/* seq_test_overlap only tests display values */
-				seq->startdisp +=	ofs;
-				seq->enddisp +=		ofs;
+				seq->startdisp +=   ofs;
+				seq->enddisp +=     ofs;
 			}
 		}
 
-		tot_ofs+= ofs;
+		tot_ofs += ofs;
 	}
 
-	for(seq= seqbasep->first; seq; seq= seq->next) {
-		if(seq->tmp)
-			calc_sequence_disp(scene, seq); /* corrects dummy startdisp/enddisp values */
+	for (seq = seqbasep->first; seq; seq = seq->next) {
+		if (seq->tmp)
+			calc_sequence_disp(scene, seq);  /* corrects dummy startdisp/enddisp values */
 	}
 
 	return tot_ofs;
 }
 
-int shuffle_seq_time(ListBase * seqbasep, Scene *evil_scene)
+int shuffle_seq_time(ListBase *seqbasep, Scene *evil_scene)
 {
 	/* note: seq->tmp is used to tag strips to move */
 
@@ -3198,39 +3350,39 @@ int shuffle_seq_time(ListBase * seqbasep, Scene *evil_scene)
 
 	int offset_l = shuffle_seq_time_offset(evil_scene, seqbasep, 'L');
 	int offset_r = shuffle_seq_time_offset(evil_scene, seqbasep, 'R');
-	int offset = (-offset_l < offset_r) ?  offset_l:offset_r;
+	int offset = (-offset_l < offset_r) ?  offset_l : offset_r;
 
-	if(offset) {
-		for(seq= seqbasep->first; seq; seq= seq->next) {
-			if(seq->tmp) {
+	if (offset) {
+		for (seq = seqbasep->first; seq; seq = seq->next) {
+			if (seq->tmp) {
 				seq_translate(evil_scene, seq, offset);
 				seq->flag &= ~SEQ_OVERLAP;
 			}
 		}
 	}
 
-	return offset? 0:1;
+	return offset ? 0 : 1;
 }
 
 void seq_update_sound_bounds_all(Scene *scene)
 {
 	Editing *ed = scene->ed;
 
-	if(ed) {
+	if (ed) {
 		Sequence *seq;
 
-		for(seq = ed->seqbase.first; seq; seq = seq->next) {
-			if(seq->type == SEQ_META) {
+		for (seq = ed->seqbase.first; seq; seq = seq->next) {
+			if (seq->type == SEQ_META) {
 				seq_update_sound_bounds_recursive(scene, seq);
 			}
-			else if(ELEM(seq->type, SEQ_SOUND, SEQ_SCENE)) {
+			else if (ELEM(seq->type, SEQ_SOUND, SEQ_SCENE)) {
 				seq_update_sound_bounds(scene, seq);
 			}
 		}
 	}
 }
 
-void seq_update_sound_bounds(Scene* scene, Sequence *seq)
+void seq_update_sound_bounds(Scene *scene, Sequence *seq)
 {
 	sound_move_scene_sound_defaults(scene, seq);
 	/* mute is set in seq_update_muting_recursive */
@@ -3242,20 +3394,20 @@ static void seq_update_muting_recursive(ListBase *seqbasep, Sequence *metaseq, i
 	int seqmute;
 
 	/* for sound we go over full meta tree to update muted state,
-	   since sound is played outside of evaluating the imbufs, */
-	for(seq=seqbasep->first; seq; seq=seq->next) {
-		seqmute= (mute || (seq->flag & SEQ_MUTE));
+	 * since sound is played outside of evaluating the imbufs, */
+	for (seq = seqbasep->first; seq; seq = seq->next) {
+		seqmute = (mute || (seq->flag & SEQ_MUTE));
 
-		if(seq->type == SEQ_META) {
+		if (seq->type == SEQ_META) {
 			/* if this is the current meta sequence, unmute because
-			   all sequences above this were set to mute */
-			if(seq == metaseq)
-				seqmute= 0;
+			 * all sequences above this were set to mute */
+			if (seq == metaseq)
+				seqmute = 0;
 
 			seq_update_muting_recursive(&seq->seqbase, metaseq, seqmute);
 		}
-		else if(ELEM(seq->type, SEQ_SOUND, SEQ_SCENE)) {
-			if(seq->scene_sound) {
+		else if (ELEM(seq->type, SEQ_SOUND, SEQ_SCENE)) {
+			if (seq->scene_sound) {
 				sound_mute_scene_sound(seq->scene_sound, seqmute);
 			}
 		}
@@ -3264,11 +3416,11 @@ static void seq_update_muting_recursive(ListBase *seqbasep, Sequence *metaseq, i
 
 void seq_update_muting(Editing *ed)
 {
-	if(ed) {
+	if (ed) {
 		/* mute all sounds up to current metastack list */
-		MetaStack *ms= ed->metastack.last;
+		MetaStack *ms = ed->metastack.last;
 
-		if(ms)
+		if (ms)
 			seq_update_muting_recursive(&ed->seqbase, ms->parseq, 1);
 		else
 			seq_update_muting_recursive(&ed->seqbase, NULL, 0);
@@ -3279,12 +3431,12 @@ static void seq_update_sound_recursive(Scene *scene, ListBase *seqbasep, bSound
 {
 	Sequence *seq;
 
-	for(seq=seqbasep->first; seq; seq=seq->next) {
-		if(seq->type == SEQ_META) {
+	for (seq = seqbasep->first; seq; seq = seq->next) {
+		if (seq->type == SEQ_META) {
 			seq_update_sound_recursive(scene, &seq->seqbase, sound);
 		}
-		else if(seq->type == SEQ_SOUND) {
-			if(seq->scene_sound && sound == seq->sound) {
+		else if (seq->type == SEQ_SOUND) {
+			if (seq->scene_sound && sound == seq->sound) {
 				sound_update_scene_sound(seq->scene_sound, sound);
 			}
 		}
@@ -3293,7 +3445,7 @@ static void seq_update_sound_recursive(Scene *scene, ListBase *seqbasep, bSound
 
 void seq_update_sound(struct Scene *scene, struct bSound *sound)
 {
-	if(scene->ed) {
+	if (scene->ed) {
 		seq_update_sound_recursive(scene, &scene->ed->seqbase, sound);
 	}
 }
@@ -3302,13 +3454,13 @@ void seq_update_sound(struct Scene *scene, struct bSound *sound)
 ListBase *seq_seqbase(ListBase *seqbase, Sequence *seq)
 {
 	Sequence *iseq;
-	ListBase *lb= NULL;
+	ListBase *lb = NULL;
 
-	for(iseq= seqbase->first; iseq; iseq= iseq->next) {
-		if(seq==iseq) {
+	for (iseq = seqbase->first; iseq; iseq = iseq->next) {
+		if (seq == iseq) {
 			return seqbase;
 		}
-		else if(iseq->seqbase.first && (lb= seq_seqbase(&iseq->seqbase, seq))) {
+		else if (iseq->seqbase.first && (lb = seq_seqbase(&iseq->seqbase, seq))) {
 			return lb;
 		}
 	}
@@ -3316,17 +3468,18 @@ ListBase *seq_seqbase(ListBase *seqbase, Sequence *seq)
 	return NULL;
 }
 
-Sequence *seq_metastrip(ListBase * seqbase, Sequence * meta, Sequence *seq)
+Sequence *seq_metastrip(ListBase *seqbase, Sequence *meta, Sequence *seq)
 {
-	Sequence * iseq;
+	Sequence *iseq;
 
-	for(iseq = seqbase->first; iseq; iseq = iseq->next) {
-		Sequence * rval;
+	for (iseq = seqbase->first; iseq; iseq = iseq->next) {
+		Sequence *rval;
 
 		if (seq == iseq) {
 			return meta;
-		} else if(iseq->seqbase.first && 
-			(rval = seq_metastrip(&iseq->seqbase, iseq, seq))) {
+		}
+		else if (iseq->seqbase.first &&
+		         (rval = seq_metastrip(&iseq->seqbase, iseq, seq))) {
 			return rval;
 		}
 	}
@@ -3338,27 +3491,27 @@ int seq_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";
+	if (seq_a->len != seq_b->len) {
+		*error_str = "Strips must be the same length";
 		return 0;
 	}
 
 	/* type checking, could be more advanced but disalow sound vs non-sound copy */
-	if(seq_a->type != seq_b->type) {
-		if(seq_a->type == SEQ_SOUND || seq_b->type == SEQ_SOUND) {
-			*error_str= "Strips were not compatible";
+	if (seq_a->type != seq_b->type) {
+		if (seq_a->type == SEQ_SOUND || seq_b->type == SEQ_SOUND) {
+			*error_str = "Strips were not compatible";
 			return 0;
 		}
 
 		/* disallow effects to swap with non-effects strips */
-		if((seq_a->type & SEQ_EFFECT) != (seq_b->type & SEQ_EFFECT)) {
-			*error_str= "Strips were not compatible";
+		if ((seq_a->type & SEQ_EFFECT) != (seq_b->type & SEQ_EFFECT)) {
+			*error_str = "Strips were not compatible";
 			return 0;
 		}
 
-		if((seq_a->type & SEQ_EFFECT) && (seq_b->type & SEQ_EFFECT)) {
-			if(get_sequence_effect_num_inputs(seq_a->type) != get_sequence_effect_num_inputs(seq_b->type)) {
-				*error_str= "Strips must have the same number of inputs";
+		if ((seq_a->type & SEQ_EFFECT) && (seq_b->type & SEQ_EFFECT)) {
+			if (get_sequence_effect_num_inputs(seq_a->type) != get_sequence_effect_num_inputs(seq_b->type)) {
+				*error_str = "Strips must have the same number of inputs";
 				return 0;
 			}
 		}
@@ -3366,10 +3519,10 @@ int seq_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str)
 
 	SWAP(Sequence, *seq_a, *seq_b);
 
-	/* swap back names so animation fcurves dont get swapped */
-	BLI_strncpy(name, seq_a->name+2, sizeof(name));
-	BLI_strncpy(seq_a->name+2, seq_b->name+2, sizeof(seq_b->name)-2);
-	BLI_strncpy(seq_b->name+2, name, sizeof(seq_b->name)-2);
+	/* swap back names so animation fcurves don't get swapped */
+	BLI_strncpy(name, seq_a->name + 2, sizeof(name));
+	BLI_strncpy(seq_a->name + 2, seq_b->name + 2, sizeof(seq_b->name) - 2);
+	BLI_strncpy(seq_b->name + 2, name, sizeof(seq_b->name) - 2);
 
 	/* swap back opacity, and overlay mode */
 	SWAP(int, seq_a->blend_mode, seq_b->blend_mode);
@@ -3393,19 +3546,19 @@ int seq_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str)
 /* XXX - hackish function needed for transforming strips! TODO - have some better solution */
 void seq_offset_animdata(Scene *scene, Sequence *seq, int ofs)
 {
-	char str[SEQ_NAME_MAXSTR+3];
+	char str[SEQ_NAME_MAXSTR + 3];
 	FCurve *fcu;
 
-	if(scene->adt==NULL || ofs==0 || scene->adt->action==NULL)
+	if (scene->adt == NULL || ofs == 0 || scene->adt->action == NULL)
 		return;
 
-	BLI_snprintf(str, sizeof(str), "[\"%s\"]", seq->name+2);
+	BLI_snprintf(str, sizeof(str), "[\"%s\"]", seq->name + 2);
 
-	for (fcu= scene->adt->action->curves.first; fcu; fcu= fcu->next) {
-		if(strstr(fcu->rna_path, "sequence_editor.sequences_all[") && strstr(fcu->rna_path, str)) {
+	for (fcu = scene->adt->action->curves.first; fcu; fcu = fcu->next) {
+		if (strstr(fcu->rna_path, "sequence_editor.sequences_all[") && strstr(fcu->rna_path, str)) {
 			unsigned int i;
 			for (i = 0; i < fcu->totvert; i++) {
-				BezTriple *bezt= &fcu->bezt[i];
+				BezTriple *bezt = &fcu->bezt[i];
 				bezt->vec[0][0] += ofs;
 				bezt->vec[1][0] += ofs;
 				bezt->vec[2][0] += ofs;
@@ -3416,28 +3569,28 @@ void seq_offset_animdata(Scene *scene, Sequence *seq, int ofs)
 
 void seq_dupe_animdata(Scene *scene, const char *name_src, const char *name_dst)
 {
-	char str_from[SEQ_NAME_MAXSTR+3];
+	char str_from[SEQ_NAME_MAXSTR + 3];
 	FCurve *fcu;
 	FCurve *fcu_last;
 	FCurve *fcu_cpy;
-	ListBase lb= {NULL, NULL};
+	ListBase lb = {NULL, NULL};
 
-	if(scene->adt==NULL || scene->adt->action==NULL)
+	if (scene->adt == NULL || scene->adt->action == NULL)
 		return;
 
 	BLI_snprintf(str_from, sizeof(str_from), "[\"%s\"]", name_src);
 
-	fcu_last= scene->adt->action->curves.last;
+	fcu_last = scene->adt->action->curves.last;
 
-	for (fcu= scene->adt->action->curves.first; fcu && fcu->prev != fcu_last; fcu= fcu->next) {
-		if(strstr(fcu->rna_path, "sequence_editor.sequences_all[") && strstr(fcu->rna_path, str_from)) {
-			fcu_cpy= copy_fcurve(fcu);
+	for (fcu = scene->adt->action->curves.first; fcu && fcu->prev != fcu_last; fcu = fcu->next) {
+		if (strstr(fcu->rna_path, "sequence_editor.sequences_all[") && strstr(fcu->rna_path, str_from)) {
+			fcu_cpy = copy_fcurve(fcu);
 			BLI_addtail(&lb, fcu_cpy);
 		}
 	}
 
 	/* notice validate is 0, keep this because the seq may not be added to the scene yet */
-	BKE_animdata_fix_paths_rename(&scene->id, scene->adt, "sequence_editor.sequences_all", name_src, name_dst, 0, 0, 0);
+	BKE_animdata_fix_paths_rename(&scene->id, scene->adt, NULL, "sequence_editor.sequences_all", name_src, name_dst, 0, 0, 0);
 
 	/* add the original fcurves back */
 	BLI_movelisttolist(&scene->adt->action->curves, &lb);
@@ -3446,25 +3599,26 @@ void seq_dupe_animdata(Scene *scene, const char *name_src, const char *name_dst)
 /* XXX - hackish function needed to remove all fcurves belonging to a sequencer strip */
 static void seq_free_animdata(Scene *scene, Sequence *seq)
 {
-	char str[SEQ_NAME_MAXSTR+3];
+	char str[SEQ_NAME_MAXSTR + 3];
 	FCurve *fcu;
 
-	if(scene->adt==NULL || scene->adt->action==NULL)
+	if (scene->adt == NULL || scene->adt->action == NULL)
 		return;
 
-	BLI_snprintf(str, sizeof(str), "[\"%s\"]", seq->name+2);
+	BLI_snprintf(str, sizeof(str), "[\"%s\"]", seq->name + 2);
 
-	fcu= scene->adt->action->curves.first; 
+	fcu = scene->adt->action->curves.first;
 
 	while (fcu) {
-		if(strstr(fcu->rna_path, "sequence_editor.sequences_all[") && strstr(fcu->rna_path, str)) {
+		if (strstr(fcu->rna_path, "sequence_editor.sequences_all[") && strstr(fcu->rna_path, str)) {
 			FCurve *next_fcu = fcu->next;
 			
 			BLI_remlink(&scene->adt->action->curves, fcu);
 			free_fcurve(fcu);
 
 			fcu = next_fcu;
-		} else {
+		}
+		else {
 			fcu = fcu->next;
 		}
 	}
@@ -3473,13 +3627,13 @@ static void seq_free_animdata(Scene *scene, Sequence *seq)
 
 Sequence *get_seq_by_name(ListBase *seqbase, const char *name, int recursive)
 {
-	Sequence *iseq=NULL;
-	Sequence *rseq=NULL;
+	Sequence *iseq = NULL;
+	Sequence *rseq = NULL;
 
-	for (iseq=seqbase->first; iseq; iseq=iseq->next) {
-		if (strcmp(name, iseq->name+2) == 0)
+	for (iseq = seqbase->first; iseq; iseq = iseq->next) {
+		if (strcmp(name, iseq->name + 2) == 0)
 			return iseq;
-		else if(recursive && (iseq->seqbase.first) && (rseq=get_seq_by_name(&iseq->seqbase, name, 1))) {
+		else if (recursive && (iseq->seqbase.first) && (rseq = get_seq_by_name(&iseq->seqbase, name, 1))) {
 			return rseq;
 		}
 	}
@@ -3490,40 +3644,40 @@ Sequence *get_seq_by_name(ListBase *seqbase, const char *name, int recursive)
 
 Sequence *seq_active_get(Scene *scene)
 {
-	Editing *ed= seq_give_editing(scene, FALSE);
-	if(ed==NULL) return NULL;
+	Editing *ed = seq_give_editing(scene, FALSE);
+	if (ed == NULL) return NULL;
 	return ed->act_seq;
 }
 
 void seq_active_set(Scene *scene, Sequence *seq)
 {
-	Editing *ed= seq_give_editing(scene, FALSE);
-	if(ed==NULL) return;
+	Editing *ed = seq_give_editing(scene, FALSE);
+	if (ed == NULL) return;
 
-	ed->act_seq= seq;
+	ed->act_seq = seq;
 }
 
 int seq_active_pair_get(Scene *scene, Sequence **seq_act, Sequence **seq_other)
 {
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Editing *ed = seq_give_editing(scene, FALSE);
 
-	*seq_act= seq_active_get(scene);
+	*seq_act = seq_active_get(scene);
 
-	if(*seq_act == NULL) {
+	if (*seq_act == NULL) {
 		return 0;
 	}
 	else {
 		Sequence *seq;
 
-		*seq_other= NULL;
+		*seq_other = NULL;
 
-		for(seq= ed->seqbasep->first; seq; seq= seq->next) {
-			if(seq->flag & SELECT && (seq != (*seq_act))) {
-				if(*seq_other) {
+		for (seq = ed->seqbasep->first; seq; seq = seq->next) {
+			if (seq->flag & SELECT && (seq != (*seq_act))) {
+				if (*seq_other) {
 					return 0;
 				}
 				else {
-					*seq_other= seq;
+					*seq_other = seq;
 				}
 			}
 		}
@@ -3536,21 +3690,21 @@ int seq_active_pair_get(Scene *scene, Sequence **seq_act, Sequence **seq_other)
 
 void seq_load_apply(Scene *scene, Sequence *seq, SeqLoadInfo *seq_load)
 {
-	if(seq) {
-		BLI_strncpy(seq->name+2, seq_load->name, sizeof(seq->name)-2);
+	if (seq) {
+		BLI_strncpy(seq->name + 2, seq_load->name, sizeof(seq->name) - 2);
 		seqbase_unique_name_recursive(&scene->ed->seqbase, seq);
 
-		if(seq_load->flag & SEQ_LOAD_FRAME_ADVANCE) {
+		if (seq_load->flag & SEQ_LOAD_FRAME_ADVANCE) {
 			seq_load->start_frame += (seq->enddisp - seq->startdisp);
 		}
 
-		if(seq_load->flag & SEQ_LOAD_REPLACE_SEL) {
+		if (seq_load->flag & SEQ_LOAD_REPLACE_SEL) {
 			seq_load->flag |= SELECT;
 			seq_active_set(scene, seq);
 		}
 
-		if(seq_load->flag & SEQ_LOAD_SOUND_CACHE) {
-			if(seq->sound)
+		if (seq_load->flag & SEQ_LOAD_SOUND_CACHE) {
+			if (seq->sound)
 				sound_cache(seq->sound);
 		}
 
@@ -3565,17 +3719,17 @@ Sequence *alloc_sequence(ListBase *lb, int cfra, int machine)
 {
 	Sequence *seq;
 
-	seq= MEM_callocN( sizeof(Sequence), "addseq");
+	seq = MEM_callocN(sizeof(Sequence), "addseq");
 	BLI_addtail(lb, seq);
 
-	*( (short *)seq->name )= ID_SEQ;
-	seq->name[2]= 0;
+	*( (short *)seq->name) = ID_SEQ;
+	seq->name[2] = 0;
 
-	seq->flag= SELECT;
-	seq->start= cfra;
-	seq->machine= machine;
-	seq->sat= 1.0;
-	seq->mul= 1.0;
+	seq->flag = SELECT;
+	seq->start = cfra;
+	seq->machine = machine;
+	seq->sat = 1.0;
+	seq->mul = 1.0;
 	seq->blend_opacity = 100.0;
 	seq->volume = 1.0f;
 	seq->pitch = 1.0f;
@@ -3587,20 +3741,20 @@ Sequence *alloc_sequence(ListBase *lb, int cfra, int machine)
 /* NOTE: this function doesn't fill in image names */
 Sequence *sequencer_add_image_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load)
 {
-	Scene *scene= CTX_data_scene(C); /* only for active seq */
+	Scene *scene = CTX_data_scene(C); /* only for active seq */
 	Sequence *seq;
 	Strip *strip;
 
 	seq = alloc_sequence(seqbasep, seq_load->start_frame, seq_load->channel);
-	seq->type= SEQ_IMAGE;
-	seq->blend_mode= SEQ_CROSS; /* so alpha adjustment fade to the strip below */
+	seq->type = SEQ_IMAGE;
+	seq->blend_mode = SEQ_CROSS; /* so alpha adjustment fade to the strip below */
 	
 	/* basic defaults */
-	seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
+	seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
 
-	strip->len = seq->len = seq_load->len ? seq_load->len : 1;
-	strip->us= 1;
-	strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
+	seq->len = seq_load->len ? seq_load->len : 1;
+	strip->us = 1;
+	strip->stripdata = MEM_callocN(seq->len * sizeof(StripElem), "stripelem");
 	BLI_strncpy(strip->dir, seq_load->path, sizeof(strip->dir));
 
 	seq_load_apply(scene, seq, seq_load);
@@ -3611,12 +3765,12 @@ Sequence *sequencer_add_image_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
 #ifdef WITH_AUDASPACE
 Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load)
 {
-	Main *bmain= CTX_data_main(C);
-	Scene *scene= CTX_data_scene(C); /* only for sound */
-	Editing *ed= seq_give_editing(scene, TRUE);
+	Main *bmain = CTX_data_main(C);
+	Scene *scene = CTX_data_scene(C); /* only for sound */
+	Editing *ed = seq_give_editing(scene, TRUE);
 	bSound *sound;
 
-	Sequence *seq;	/* generic strip vars */
+	Sequence *seq;  /* generic strip vars */
 	Strip *strip;
 	StripElem *se;
 
@@ -3624,8 +3778,8 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
 
 	sound = sound_new_file(CTX_data_main(C), seq_load->path); /* handles relative paths */
 
-	if (sound==NULL || sound->playback_handle == NULL) {
-		//if(op)
+	if (sound == NULL || sound->playback_handle == NULL) {
+		//if (op)
 		//	BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
 		return NULL;
 	}
@@ -3634,29 +3788,29 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
 
 	if (info.specs.channels == AUD_CHANNELS_INVALID) {
 		sound_delete(bmain, sound);
-		//if(op)
+		//if (op)
 		//	BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
 		return NULL;
 	}
 
 	seq = alloc_sequence(seqbasep, seq_load->start_frame, seq_load->channel);
 
-	seq->type= SEQ_SOUND;
-	seq->sound= sound;
-	BLI_strncpy(seq->name+2, "Sound", SEQ_NAME_MAXSTR-2);
+	seq->type = SEQ_SOUND;
+	seq->sound = sound;
+	BLI_strncpy(seq->name + 2, "Sound", SEQ_NAME_MAXSTR - 2);
 	seqbase_unique_name_recursive(&scene->ed->seqbase, seq);
 
 	/* basic defaults */
-	seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
-	strip->len = seq->len = ceil(info.length * FPS);
-	strip->us= 1;
+	seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
+	seq->len = ceil(info.length * FPS);
+	strip->us = 1;
 
 	/* we only need 1 element to store the filename */
-	strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem");
+	strip->stripdata = se = MEM_callocN(sizeof(StripElem), "stripelem");
 
 	BLI_split_dirfile(seq_load->path, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name));
 
-	seq->scene_sound = sound_add_scene_sound(scene, seq, seq_load->start_frame, seq_load->start_frame + strip->len, 0);
+	seq->scene_sound = sound_add_scene_sound(scene, seq, seq_load->start_frame, seq_load->start_frame + seq->len, 0);
 
 	calc_sequence_disp(scene, seq);
 
@@ -3679,10 +3833,10 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
 
 Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo *seq_load)
 {
-	Scene *scene= CTX_data_scene(C); /* only for sound */
+	Scene *scene = CTX_data_scene(C); /* only for sound */
 	char path[sizeof(seq_load->path)];
 
-	Sequence *seq;	/* generic strip vars */
+	Sequence *seq;  /* generic strip vars */
 	Strip *strip;
 	StripElem *se;
 
@@ -3693,42 +3847,42 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
 
 	an = openanim(path, IB_rect, 0);
 
-	if(an==NULL)
+	if (an == NULL)
 		return NULL;
 
 	seq = alloc_sequence(seqbasep, seq_load->start_frame, seq_load->channel);
-	seq->type= SEQ_MOVIE;
-	seq->blend_mode= SEQ_CROSS; /* so alpha adjustment fade to the strip below */
+	seq->type = SEQ_MOVIE;
+	seq->blend_mode = SEQ_CROSS; /* so alpha adjustment fade to the strip below */
 
-	seq->anim= an;
+	seq->anim = an;
 	seq->anim_preseek = IMB_anim_get_preseek(an);
-	BLI_strncpy(seq->name+2, "Movie", SEQ_NAME_MAXSTR-2);
+	BLI_strncpy(seq->name + 2, "Movie", SEQ_NAME_MAXSTR - 2);
 	seqbase_unique_name_recursive(&scene->ed->seqbase, seq);
 
 	/* basic defaults */
-	seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
-	strip->len = seq->len = IMB_anim_get_duration( an, IMB_TC_RECORD_RUN );
-	strip->us= 1;
+	seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
+	seq->len = IMB_anim_get_duration(an, IMB_TC_RECORD_RUN);
+	strip->us = 1;
 
 	/* we only need 1 element for MOVIE strips */
-	strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem");
+	strip->stripdata = se = MEM_callocN(sizeof(StripElem), "stripelem");
 
 	BLI_split_dirfile(seq_load->path, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name));
 
 	calc_sequence_disp(scene, seq);
 
 
-	if(seq_load->flag & SEQ_LOAD_MOVIE_SOUND) {
-		int start_frame_back= seq_load->start_frame;
+	if (seq_load->flag & SEQ_LOAD_MOVIE_SOUND) {
+		int start_frame_back = seq_load->start_frame;
 		seq_load->channel++;
 
 		sequencer_add_sound_strip(C, seqbasep, seq_load);
 
-		seq_load->start_frame= start_frame_back;
+		seq_load->start_frame = start_frame_back;
 		seq_load->channel--;
 	}
 
-	if(seq_load->name[0] == '\0')
+	if (seq_load->name[0] == '\0')
 		BLI_strncpy(seq_load->name, se->name, sizeof(seq_load->name));
 
 	/* can be NULL */
@@ -3740,11 +3894,11 @@ Sequence *sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
 
 static Sequence *seq_dupli(struct Scene *scene, struct Scene *scene_to, Sequence *seq, int dupe_flag)
 {
-	Scene *sce_audio= scene_to ? scene_to : scene;
+	Scene *sce_audio = scene_to ? scene_to : scene;
 	Sequence *seqn = MEM_dupallocN(seq);
 
 	seq->tmp = seqn;
-	seqn->strip= MEM_dupallocN(seq->strip);
+	seqn->strip = MEM_dupallocN(seq->strip);
 
 	// XXX: add F-Curve duplication stuff?
 
@@ -3763,68 +3917,74 @@ static Sequence *seq_dupli(struct Scene *scene, struct Scene *scene_to, Sequence
 
 	if (seq->strip->color_balance) {
 		seqn->strip->color_balance
-			= MEM_dupallocN(seq->strip->color_balance);
+		    = MEM_dupallocN(seq->strip->color_balance);
 	}
 
-	if(seq->type==SEQ_META) {
+	if (seq->type == SEQ_META) {
 		seqn->strip->stripdata = NULL;
 
-		seqn->seqbase.first= seqn->seqbase.last= NULL;
+		seqn->seqbase.first = seqn->seqbase.last = NULL;
 		/* WATCH OUT!!! - This metastrip is not recursively duplicated here - do this after!!! */
 		/* - seq_dupli_recursive(&seq->seqbase,&seqn->seqbase);*/
-	} else if(seq->type == SEQ_SCENE) {
+	}
+	else if (seq->type == SEQ_SCENE) {
 		seqn->strip->stripdata = NULL;
-		if(seq->scene_sound)
+		if (seq->scene_sound)
 			seqn->scene_sound = sound_scene_add_scene_sound_defaults(sce_audio, seqn);
-	} else if(seq->type == SEQ_MOVIE) {
+	}
+	else if (seq->type == SEQ_MOVIE) {
 		seqn->strip->stripdata =
-				MEM_dupallocN(seq->strip->stripdata);
-		seqn->anim= NULL;
-	} else if(seq->type == SEQ_SOUND) {
+		        MEM_dupallocN(seq->strip->stripdata);
+		seqn->anim = NULL;
+	}
+	else if (seq->type == SEQ_SOUND) {
 		seqn->strip->stripdata =
-				MEM_dupallocN(seq->strip->stripdata);
-		if(seq->scene_sound)
+		        MEM_dupallocN(seq->strip->stripdata);
+		if (seq->scene_sound)
 			seqn->scene_sound = sound_add_scene_sound_defaults(sce_audio, seqn);
 
 		seqn->sound->id.us++;
-	} else if(seq->type == SEQ_IMAGE) {
+	}
+	else if (seq->type == SEQ_IMAGE) {
 		seqn->strip->stripdata =
-				MEM_dupallocN(seq->strip->stripdata);
-	} else if(seq->type >= SEQ_EFFECT) {
-		if(seq->seq1 && seq->seq1->tmp) seqn->seq1= seq->seq1->tmp;
-		if(seq->seq2 && seq->seq2->tmp) seqn->seq2= seq->seq2->tmp;
-		if(seq->seq3 && seq->seq3->tmp) seqn->seq3= seq->seq3->tmp;
+		        MEM_dupallocN(seq->strip->stripdata);
+	}
+	else if (seq->type >= SEQ_EFFECT) {
+		if (seq->seq1 && seq->seq1->tmp) seqn->seq1 = seq->seq1->tmp;
+		if (seq->seq2 && seq->seq2->tmp) seqn->seq2 = seq->seq2->tmp;
+		if (seq->seq3 && seq->seq3->tmp) seqn->seq3 = seq->seq3->tmp;
 
 		if (seq->type & SEQ_EFFECT) {
 			struct SeqEffectHandle sh;
 			sh = get_sequence_effect(seq);
-			if(sh.copy)
+			if (sh.copy)
 				sh.copy(seq, seqn);
 		}
 
 		seqn->strip->stripdata = NULL;
 
-	} else {
+	}
+	else {
 		fprintf(stderr, "Aiiiiekkk! sequence type not "
-				"handled in duplicate!\nExpect a crash"
-						" now...\n");
+		        "handled in duplicate!\nExpect a crash"
+		        " now...\n");
 	}
 
-	if(dupe_flag & SEQ_DUPE_UNIQUE_NAME)
+	if (dupe_flag & SEQ_DUPE_UNIQUE_NAME)
 		seqbase_unique_name_recursive(&scene->ed->seqbase, seqn);
 
-	if(dupe_flag & SEQ_DUPE_ANIM)
-		seq_dupe_animdata(scene, seq->name+2, seqn->name+2);
+	if (dupe_flag & SEQ_DUPE_ANIM)
+		seq_dupe_animdata(scene, seq->name + 2, seqn->name + 2);
 
 	return seqn;
 }
 
-Sequence * seq_dupli_recursive(struct Scene *scene, struct Scene *scene_to, Sequence * seq, int dupe_flag)
+Sequence *seq_dupli_recursive(struct Scene *scene, struct Scene *scene_to, Sequence *seq, int dupe_flag)
 {
-	Sequence * seqn = seq_dupli(scene, scene_to, seq, dupe_flag);
+	Sequence *seqn = seq_dupli(scene, scene_to, seq, dupe_flag);
 	if (seq->type == SEQ_META) {
 		Sequence *s;
-		for(s= seq->seqbase.first; s; s = s->next) {
+		for (s = seq->seqbase.first; s; s = s->next) {
 			Sequence *n = seq_dupli_recursive(scene, scene_to, s, dupe_flag);
 			if (n) {
 				BLI_addtail(&seqn->seqbase, n);
@@ -3840,21 +4000,21 @@ void seqbase_dupli_recursive(Scene *scene, Scene *scene_to, ListBase *nseqbase,
 	Sequence *seqn = NULL;
 	Sequence *last_seq = seq_active_get(scene);
 
-	for(seq= seqbase->first; seq; seq= seq->next) {
-		seq->tmp= NULL;
-		if((seq->flag & SELECT) || (dupe_flag & SEQ_DUPE_ALL)) {
+	for (seq = seqbase->first; seq; seq = seq->next) {
+		seq->tmp = NULL;
+		if ((seq->flag & SELECT) || (dupe_flag & SEQ_DUPE_ALL)) {
 			seqn = seq_dupli(scene, scene_to, seq, dupe_flag);
 			if (seqn) { /*should never fail */
-				if(dupe_flag & SEQ_DUPE_CONTEXT) {
+				if (dupe_flag & SEQ_DUPE_CONTEXT) {
 					seq->flag &= ~SEQ_ALLSEL;
-					seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL+SEQ_LOCK);
+					seqn->flag &= ~(SEQ_LEFTSEL + SEQ_RIGHTSEL + SEQ_LOCK);
 				}
 
 				BLI_addtail(nseqbase, seqn);
-				if(seq->type==SEQ_META)
+				if (seq->type == SEQ_META)
 					seqbase_dupli_recursive(scene, scene_to, &seqn->seqbase, &seq->seqbase, dupe_flag);
 
-				if(dupe_flag & SEQ_DUPE_CONTEXT) {
+				if (dupe_flag & SEQ_DUPE_CONTEXT) {
 					if (seq == last_seq) {
 						seq_active_set(scene, seqn);
 					}
diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c
index aed2466..4006837 100644
--- a/source/blender/blenkernel/intern/shrinkwrap.c
+++ b/source/blender/blenkernel/intern/shrinkwrap.c
@@ -43,7 +43,6 @@
 #include "DNA_mesh_types.h"
 #include "DNA_scene_types.h"
 
-#include "BLI_editVert.h"
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
 
@@ -54,6 +53,8 @@
 #include "BKE_deform.h"
 #include "BKE_mesh.h"
 #include "BKE_subsurf.h"
+#include "BKE_mesh.h"
+#include "BKE_tessmesh.h"
 
 /* Util macros */
 #define OUT_OF_MEMORY()	((void)printf("Shrinkwrap: Out of memory\n"))
@@ -74,7 +75,7 @@
 		_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)
+	} while (0)
 
 #else
 
@@ -85,15 +86,14 @@
 typedef void ( *Shrinkwrap_ForeachVertexCallback) (DerivedMesh *target, float *co, float *normal);
 
 /* get derived mesh */
-//TODO is anyfunction that does this? returning the derivedFinal witouth 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;
-	EditMesh *em = BKE_mesh_get_editmesh(me);
+	BMEditMesh *em = me->edit_btmesh;
 
-	if(em) {
+	if (em) {
 		DerivedMesh *dm = em->derivedFinal;
-		BKE_mesh_end_editmesh(me, em);
 		return dm;
 	}
 
@@ -146,7 +146,7 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
 
 
 	BENCH(bvhtree_from_mesh_verts(&treeData, calc->target, 0.0, 2, 6));
-	if(treeData.tree == NULL)
+	if (treeData.tree == NULL)
 	{
 		OUT_OF_MEMORY();
 		return;
@@ -158,16 +158,16 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
 #ifndef __APPLE__
 #pragma omp parallel for default(none) private(i) firstprivate(nearest) shared(treeData,calc) schedule(static)
 #endif
-	for(i = 0; i<calc->numVerts; ++i)
+	for (i = 0; i<calc->numVerts; ++i)
 	{
 		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
-		if(calc->vert) {
+		if (calc->vert) {
 			copy_v3_v3(tmp_co, calc->vert[i].co);
 		}
 		else {
@@ -180,7 +180,7 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
 		//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)
+		if (nearest.index != -1)
 			nearest.dist = len_squared_v3v3(tmp_co, nearest.co);
 		else
 			nearest.dist = FLT_MAX;
@@ -189,11 +189,11 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
 
 
 		//Found the nearest vertex
-		if(nearest.index != -1)
+		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;
+			if (dist > FLT_EPSILON) weight *= (dist - calc->keepDist)/dist;
 
 			//Convert the coordinates back to mesh coordinates
 			copy_v3_v3(tmp_co, nearest.co);
@@ -224,7 +224,7 @@ int normal_projection_project_vertex(char options, const float *vert, const floa
 	memcpy( &hit_tmp, hit, sizeof(hit_tmp) );
 
 	//Apply space transform (TODO readjust dist)
-	if(transf)
+	if (transf)
 	{
 		copy_v3_v3( tmp_co, vert );
 		space_transform_apply( transf, tmp_co );
@@ -236,8 +236,7 @@ int normal_projection_project_vertex(char options, const float *vert, const floa
 
 		hit_tmp.dist *= mat4_to_scale( ((SpaceTransform*)transf)->local2target );
 	}
-	else
-	{
+	else {
 		co = vert;
 		no = dir;
 	}
@@ -246,23 +245,23 @@ int normal_projection_project_vertex(char options, const float *vert, const floa
 
 	BLI_bvhtree_ray_cast(tree, co, no, 0.0f, &hit_tmp, callback, userdata);
 
-	if(hit_tmp.index != -1) {
+	if (hit_tmp.index != -1) {
 		/* invert the normal first so face culling works on rotated objects */
-		if(transf) {
+		if (transf) {
 			space_transform_invert_normal(transf, hit_tmp.no);
 		}
 
 		if (options & (MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE|MOD_SHRINKWRAP_CULL_TARGET_BACKFACE)) {
 			/* apply backface */
 			const float dot= dot_v3v3(dir, hit_tmp.no);
-			if(	((options & MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE) && dot <= 0.0f) ||
+			if (	((options & MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE) && dot <= 0.0f) ||
 				((options & MOD_SHRINKWRAP_CULL_TARGET_BACKFACE) && dot >= 0.0f)
 			) {
 				return FALSE; /* Ignore hit */
 			}
 		}
 
-		if(transf) {
+		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);
@@ -287,108 +286,107 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
 	BVHTreeRayHit hit;
 	BVHTreeFromMesh treeData= NULL_BVHTreeFromMesh;
 
-	//auxiliar 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((use_normal & (MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR | MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR)) == 0)
+	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
-	if(calc->smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL)
+	if (calc->smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL)
 	{
-		if(calc->vert == NULL) return;
+		if (calc->vert == NULL) return;
 	}
-	else
-	{
+	else {
 		//The code supports any axis that is a combination of X,Y,Z
-		//altought currently UI only allows to set the 3 diferent 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;
+		//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)
+		if (dot_v3v3(proj_axis, proj_axis) < FLT_EPSILON)
 			return; 
 	}
 
-	if(calc->smd->auxTarget)
+	if (calc->smd->auxTarget)
 	{
 		auxMesh = object_get_derived_final(calc->smd->auxTarget);
-		if(!auxMesh)
+		if (!auxMesh)
 			return;
 		space_transform_setup( &local2aux, calc->ob, calc->smd->auxTarget);
 	}
 
 	//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)))
+	if (bvhtree_from_mesh_faces(&treeData, calc->target, 0.0, 4, 6) &&
+	    (auxMesh == NULL || bvhtree_from_mesh_faces(&auxData, auxMesh, 0.0, 4, 6)))
 	{
 
 #ifndef __APPLE__
 #pragma omp parallel for private(i,hit) schedule(static)
 #endif
-		for(i = 0; i<calc->numVerts; ++i)
+		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);
 
-			if(weight == 0.0f) continue;
+			if (weight == 0.0f) continue;
 
-			if(calc->vert)
+			if (calc->vert)
 			{
 				/* calc->vert contains verts from derivedMesh  */
 				/* this coordinated are deformed by vertexCos only for normal projection (to get correct normals) */
 				/* for other cases calc->varts contains undeformed coordinates and vertexCos should be used */
-				if(calc->smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL) {
+				if (calc->smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL) {
 					copy_v3_v3(tmp_co, calc->vert[i].co);
 					normal_short_to_float_v3(tmp_no, calc->vert[i].no);
-				} else {
+				}
+				else {
 					copy_v3_v3(tmp_co, co);
 					copy_v3_v3(tmp_no, proj_axis);
 				}
 			}
-			else
-			{
+			else {
 				copy_v3_v3(tmp_co, co);
 				copy_v3_v3(tmp_no, proj_axis);
 			}
 
 
 			hit.index = -1;
-			hit.dist = 10000.0f; //TODO: we should use FLT_MAX here, but sweepsphere code isnt 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
-			if(use_normal & MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR)
+			if (use_normal & MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR)
 			{
 
-				if(auxData.tree)
+				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);
 			}
 
 			//Project over negative direction of axis
-			if(use_normal & MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR && hit.index == -1)
+			if (use_normal & MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR && hit.index == -1)
 			{
 				float inv_no[3];
 				negate_v3_v3(inv_no, tmp_no);
 
-				if(auxData.tree)
+				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);
 			}
 
 
-			if(hit.index != -1)
+			if (hit.index != -1)
 			{
 				madd_v3_v3v3fl(hit.co, hit.co, tmp_no, calc->keepDist);
 				interp_v3_v3v3(co, co, hit.co, weight);
@@ -405,7 +403,7 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
  * Shrinkwrap moving vertexs to the nearest surface point on the target
  *
  * it builds a BVHTree from the target mesh and then performs a
- * NN matchs for each vertex
+ * NN matches for each vertex
  */
 static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
 {
@@ -416,7 +414,7 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
 
 	//Create a bvh-tree of the given target
 	BENCH(bvhtree_from_mesh_faces( &treeData, calc->target, 0.0, 2, 6));
-	if(treeData.tree == NULL)
+	if (treeData.tree == NULL)
 	{
 		OUT_OF_MEMORY();
 		return;
@@ -431,20 +429,18 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
 #ifndef __APPLE__
 #pragma omp parallel for default(none) private(i) firstprivate(nearest) shared(calc,treeData) schedule(static)
 #endif
-	for(i = 0; i<calc->numVerts; ++i)
+	for (i = 0; i<calc->numVerts; ++i)
 	{
 		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
-		if(calc->vert)
-		{
+		if (calc->vert) {
 			copy_v3_v3(tmp_co, calc->vert[i].co);
 		}
-		else
-		{
+		else {
 			copy_v3_v3(tmp_co, co);
 		}
 		space_transform_apply(&calc->local2target, tmp_co);
@@ -454,7 +450,7 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
 		//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)
+		if (nearest.index != -1)
 			nearest.dist = len_squared_v3v3(tmp_co, nearest.co);
 		else
 			nearest.dist = FLT_MAX;
@@ -462,18 +458,17 @@ 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
-		if(nearest.index != -1)
+		if (nearest.index != -1)
 		{
-			if(calc->smd->shrinkOpts & MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE)
+			if (calc->smd->shrinkOpts & MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE)
 			{
 				//Make the vertex stay on the front side of the face
 				madd_v3_v3v3fl(tmp_co, nearest.co, nearest.no, calc->keepDist);
 			}
-			else
-			{
+			else {
 				//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)
+				if (dist > FLT_EPSILON)
 					interp_v3_v3v3(tmp_co, tmp_co, nearest.co, (dist - calc->keepDist)/dist);	//linear interpolation
 				else
 					copy_v3_v3( tmp_co, nearest.co );
@@ -496,8 +491,8 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM
 	ShrinkwrapCalcData calc = NULL_ShrinkwrapCalcData;
 
 	//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;
+	if (smd->target == ob) smd->target = NULL;
+	if (smd->auxTarget == ob) smd->auxTarget = NULL;
 
 
 	//Configure Shrinkwrap calc data
@@ -508,17 +503,15 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM
 
 	//DeformVertex
 	calc.vgroup = defgroup_name_index(calc.ob, calc.smd->vgroup_name);
-	if(dm)
-	{
+	if (dm) {
 		calc.dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
 	}
-	else if(calc.ob->type == OB_LATTICE)
-	{
+	else if (calc.ob->type == OB_LATTICE) {
 		calc.dvert = lattice_get_deform_verts(calc.ob);
 	}
 
 
-	if(smd->target)
+	if (smd->target)
 	{
 		calc.target = object_get_derived_final(smd->target);
 
@@ -535,14 +528,14 @@ 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)
+	if (dm != NULL && smd->shrinkType == MOD_SHRINKWRAP_PROJECT)
 	{
 		//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 
-		if(smd->subsurfLevels)
+		if (smd->subsurfLevels)
 		{
 			SubsurfModifierData ssmd= {{NULL}};
 			ssmd.subdivType	= ME_CC_SUBSURF;		//catmull clark
@@ -550,10 +543,10 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM
 
 			ss_mesh = subsurf_make_derived_from_derived(dm, &ssmd, FALSE, NULL, 0, 0, (ob->mode & OB_MODE_EDIT));
 
-			if(ss_mesh)
+			if (ss_mesh)
 			{
 				calc.vert = ss_mesh->getVertDataArray(ss_mesh, CD_MVERT);
-				if(calc.vert)
+				if (calc.vert)
 				{
 					//TRICKY: this code assumes subsurface will have the transformed original vertices
 					//in their original order at the end of the vert array.
@@ -568,8 +561,7 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM
 	}
 
 	//Projecting target defined - lets work!
-	if(calc.target)
-	{
+	if (calc.target) {
 		switch(smd->shrinkType)
 		{
 			case MOD_SHRINKWRAP_NEAREST_SURFACE:
@@ -587,7 +579,7 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM
 	}
 
 	//free memory
-	if(ss_mesh)
+	if (ss_mesh)
 		ss_mesh->release(ss_mesh);
 }
 
diff --git a/source/blender/blenkernel/intern/sketch.c b/source/blender/blenkernel/intern/sketch.c
index faf382f..71ea85d 100644
--- a/source/blender/blenkernel/intern/sketch.c
+++ b/source/blender/blenkernel/intern/sketch.c
@@ -71,17 +71,15 @@ SK_Sketch* createSketch(void)
 	return sketch;
 }
 
-void sk_initPoint(SK_Point *pt, SK_DrawData *dd, float *no)
+void sk_initPoint(SK_Point *pt, SK_DrawData *dd, const float no[3])
 {
-	if (no)
-	{
+	if (no) {
 		normalize_v3_v3(pt->no, no);
 	}
-	else
-	{
-		pt->no[0] = 0;
-		pt->no[1] = 0;
-		pt->no[2] = 1;
+	else {
+		pt->no[0] = 0.0f;
+		pt->no[1] = 0.0f;
+		pt->no[2] = 1.0f;
 	}
 	pt->p2d[0] = dd->mval[0];
 	pt->p2d[1] = dd->mval[1];
@@ -260,8 +258,7 @@ void sk_straightenStroke(SK_Stroke *stk, int start, int end, float p_start[3], f
 		float delta = (float)i / (float)total;
 		float *p = stk->points[start + 1 + i].p;
 
-		VECCOPY(p, delta_p);
-		mul_v3_fl(p, delta);
+		mul_v3_v3fl(p, delta_p, delta);
 		add_v3_v3(p, p_start);
 	}
 }
@@ -335,7 +332,7 @@ void sk_flattenStroke(SK_Stroke *stk, int start, int end)
 		sub_v3_v3v3(distance, p, stk->points[start].p);
 		project_v3_v3v3(distance, distance, normal);
 
-		VECCOPY(offset, normal);
+		copy_v3_v3(offset, normal);
 		mul_v3_fl(offset, d);
 
 		sub_v3_v3(p, distance);
@@ -417,7 +414,7 @@ void sk_filterStroke(SK_Stroke *stk, int start, int end)
 			float max_dist = 16; /* more than 4 pixels */
 			
 			/* find the next marked point */
-			while(marked[le] == 0)
+			while (marked[le] == 0)
 			{
 				le++;
 			}
@@ -427,7 +424,7 @@ void sk_filterStroke(SK_Stroke *stk, int start, int end)
 			v1[0] = old_points[ls].p2d[1] - old_points[le].p2d[1]; 
 			
 
-			for( i = ls + 1; i < le; i++ )
+			for ( i = ls + 1; i < le; i++ )
 			{
 				float mul;
 				float dist;
@@ -576,15 +573,13 @@ void sk_selectAllSketch(SK_Sketch *sketch, int mode)
 			stk->selected = 0;
 		}
 	}
-	else if (mode == 0)
-	{
+	else if (mode == 0) {
 		for (stk = sketch->strokes.first; stk; stk = stk->next)
 		{
 			stk->selected = 1;
 		}
 	}
-	else if (mode == 1)
-	{
+	else if (mode == 1) {
 		int selected = 1;
 
 		for (stk = sketch->strokes.first; stk; stk = stk->next)
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 424f97f..9d13397 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -73,8 +73,6 @@
 #include "DNA_scene_types.h"
 #include "DNA_smoke_types.h"
 
-#include "smoke_API.h"
-
 #include "BKE_smoke.h"
 
 /* UNUSED so far, may be enabled later */
@@ -82,6 +80,8 @@
 
 #ifdef WITH_SMOKE
 
+#include "smoke_API.h"
+
 #ifdef _WIN32
 #include <time.h>
 #include <stdio.h>
@@ -134,7 +134,7 @@ struct Scene;
 struct DerivedMesh;
 struct SmokeModifierData;
 
-#define TRI_UVOFFSET (1./4.)
+#define TRI_UVOFFSET (1.0 / 4.0)
 
 /* forward declerations */
 static void calcTriangleDivs(Object *ob, MVert *verts, int numverts, MFace *tris, int numfaces, int numtris, int **tridivs, float cell_len);
@@ -159,7 +159,7 @@ void smokeModifier_do(SmokeModifierData *UNUSED(smd), Scene *UNUSED(scene), Obje
 
 static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, DerivedMesh *dm)
 {
-	if((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain && !smd->domain->fluid)
+	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};
@@ -171,7 +171,7 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
 		res = smd->domain->maxres;
 
 		// get BB of domain
-		for(i = 0; i < dm->getNumVerts(dm); i++)
+		for (i = 0; i < dm->getNumVerts(dm); i++)
 		{
 			float tmp[3];
 
@@ -198,12 +198,12 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
 		// printf("size: %f, %f, %f\n", size[0], size[1], size[2]);
 
 		// prevent crash when initializing a plane as domain
-		if((size[0] < FLT_EPSILON) || (size[1] < FLT_EPSILON) || (size[2] < FLT_EPSILON))
+		if ((size[0] < FLT_EPSILON) || (size[1] < FLT_EPSILON) || (size[2] < FLT_EPSILON))
 			return 0;
 
-		if(size[0] > size[1])
+		if (size[0] > size[1])
 		{
-			if(size[0] > size[2])
+			if (size[0] > size[2])
 			{
 				scale = res / size[0];
 				smd->domain->dx = size[0] / res;
@@ -211,8 +211,7 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
 				smd->domain->res[1] = (int)(size[1] * scale + 0.5);
 				smd->domain->res[2] = (int)(size[2] * scale + 0.5);
 			}
-			else
-			{
+			else {
 				scale = res / size[2];
 				smd->domain->dx = size[2] / res;
 				smd->domain->res[2] = res;
@@ -220,9 +219,8 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
 				smd->domain->res[1] = (int)(size[1] * scale + 0.5);
 			}
 		}
-		else
-		{
-			if(size[1] > size[2])
+		else {
+			if (size[1] > size[2])
 			{
 				scale = res / size[1];
 				smd->domain->dx = size[1] / res;
@@ -230,8 +228,7 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
 				smd->domain->res[0] = (int)(size[0] * scale + 0.5);
 				smd->domain->res[2] = (int)(size[2] * scale + 0.5);
 			}
-			else
-			{
+			else {
 				scale = res / size[2];
 				smd->domain->dx = size[2] / res;
 				smd->domain->res[2] = res;
@@ -249,7 +246,7 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
 		smd->domain->fluid = smoke_init(smd->domain->res, smd->domain->p0);
 		smd->time = scene->r.cfra;
 
-		if(smd->domain->flags & MOD_SMOKE_HIGHRES)
+		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);
@@ -260,29 +257,38 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
 			// printf("(smd->domain->flags & MOD_SMOKE_HIGHRES)\n");
 		}
 
-		if(!smd->domain->shadow)
+		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)	
+		if (smd->domain->wt)	
 		{
 			smoke_initWaveletBlenderRNA(smd->domain->wt, &(smd->domain->strength));
 			// printf("smoke_initWaveletBlenderRNA\n");
 		}
 		return 1;
 	}
-	else if((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow)
+	else if ((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow)
 	{
 		// handle flow object here
 		// XXX TODO
 
 		smd->time = scene->r.cfra;
 
-		// update particle lifetime to be one frame
-		// smd->flow->psys->part->lifetime = scene->r.efra + 1;
+		if (smd->flow->psys && smd->flow->psys->part && !(smd->flow->flags & MOD_SMOKE_FLOW_INIT))
+		{
+			// update particle lifetime to be one frame
+			smd->flow->psys->part->lifetime = 1; // scene->r.efra + 1;
+
+			// use "unborn" flag as standard setting
+			smd->flow->psys->part->flag |= PART_UNBORN;
+
+			smd->flow->flags |= MOD_SMOKE_FLOW_INIT;
+		}
+
 /*
-		if(!smd->flow->bvh)
+		if (!smd->flow->bvh)
 		{
 			// smd->flow->bvh = MEM_callocN(sizeof(BVHTreeFromMesh), "smoke_bvhfromfaces");
 			// bvhtree_from_mesh_faces(smd->flow->bvh, dm, 0.0, 2, 6);
@@ -295,15 +301,15 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
 
 		return 1;
 	}
-	else if((smd->type & MOD_SMOKE_TYPE_COLL))
+	else if ((smd->type & MOD_SMOKE_TYPE_COLL))
 	{
 		smd->time = scene->r.cfra;
 
 		// todo: delete this when loading colls work -dg
-		if(!smd->coll)
+		if (!smd->coll)
 			smokeModifier_createType(smd);
 
-		if(!smd->coll->points)
+		if (!smd->coll->points)
 		{
 			// init collision points
 			SmokeCollSettings *scs = smd->coll;
@@ -312,12 +318,13 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
 			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)
+		if (!smd->coll->bvhtree)
 		{
-			smd->coll->bvhtree = NULL; // bvhtree_build_from_smoke ( ob->obmat, dm->getFaceArray(dm), dm->getNumFaces(dm), dm->getVertArray(dm), dm->getNumVerts(dm), 0.0 );
+			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;
 	}
@@ -328,7 +335,7 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
 static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs)
 {
 	MVert *mvert = dm->getVertArray(dm);
-	MFace *mface = dm->getFaceArray(dm);
+	MFace *mface = dm->getTessFaceArray(dm);
 	int i = 0, divs = 0;
 	int *tridivs = NULL;
 	float cell_len = 1.0 / 50.0; // for res = 50
@@ -336,16 +343,16 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs)
 	int quads = 0, facecounter = 0;
 
 	// count quads
-	for(i = 0; i < dm->getNumFaces(dm); i++)
+	for (i = 0; i < dm->getNumTessFaces(dm); i++)
 	{
-		if(mface[i].v4)
+		if (mface[i].v4)
 			quads++;
 	}
 
-	calcTriangleDivs(ob, mvert, dm->getNumVerts(dm), mface,  dm->getNumFaces(dm), dm->getNumFaces(dm) + quads, &tridivs, cell_len);
+	calcTriangleDivs(ob, mvert, dm->getNumVerts(dm), mface,  dm->getNumTessFaces(dm), dm->getNumTessFaces(dm) + quads, &tridivs, cell_len);
 
 	// count triangle divisions
-	for(i = 0; i < dm->getNumFaces(dm) + quads; i++)
+	for (i = 0; i < dm->getNumTessFaces(dm) + quads; i++)
 	{
 		divs += (tridivs[3 * i] + 1) * (tridivs[3 * i + 1] + 1) * (tridivs[3 * i + 2] + 1);
 	}
@@ -354,7 +361,7 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs)
 
 	scs->points = MEM_callocN(sizeof(float) * (dm->getNumVerts(dm) + divs) * 3, "SmokeCollPoints");
 
-	for(i = 0; i < dm->getNumVerts(dm); i++)
+	for (i = 0; i < dm->getNumVerts(dm); i++)
 	{
 		float tmpvec[3];
 		copy_v3_v3(tmpvec, mvert[i].co);
@@ -362,7 +369,7 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs)
 		copy_v3_v3(&scs->points[i * 3], tmpvec);
 	}
 	
-	for(i = 0, facecounter = 0; i < dm->getNumFaces(dm); i++)
+	for (i = 0, facecounter = 0; i < dm->getNumTessFaces(dm); i++)
 	{
 		int again = 0;
 		do
@@ -373,13 +380,12 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs)
 			//int divs3 = tridivs[3 * facecounter + 2];
 			float side1[3], side2[3], trinormorg[3], trinorm[3];
 			
-			if(again == 1 && mface[i].v4)
+			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
-			{
+			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);
 			}
@@ -389,29 +395,28 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs)
 			copy_v3_v3(trinorm, trinormorg);
 			mul_v3_fl(trinorm, 0.25 * cell_len);
 
-			for(j = 0; j <= divs1; j++)
+			for (j = 0; j <= divs1; j++)
 			{
-				for(k = 0; k <= divs2; k++)
+				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) 
+					if (uf+vf > 1.0) 
 					{
 						// printf("bigger - divs1: %d, divs2: %d\n", divs1, divs2);
 						continue;
 					}
 
 					copy_v3_v3(p1, mvert[ mface[i].v1 ].co);
-					if(again == 1 && mface[i].v4)
+					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
-					{
+					else {
 						copy_v3_v3(p2, mvert[ mface[i].v2 ].co);
 						copy_v3_v3(p3, mvert[ mface[i].v3 ].co);
 					}
@@ -423,7 +428,7 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs)
 					add_v3_v3v3(p, p1, p2);
 					add_v3_v3(p, p3);
 
-					if(newdivs > divs)
+					if (newdivs > divs)
 						printf("mem problem\n");
 
 					// mMovPoints.push_back(p + trinorm);
@@ -432,7 +437,7 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs)
 					copy_v3_v3(&scs->points[3 * (dm->getNumVerts(dm) + newdivs)], tmpvec);
 					newdivs++;
 
-					if(newdivs > divs)
+					if (newdivs > divs)
 						printf("mem problem\n");
 
 					// mMovPoints.push_back(p - trinorm);
@@ -444,14 +449,14 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs)
 				}
 			}
 
-			if(again == 0 && mface[i].v4)
+			if (again == 0 && mface[i].v4)
 				again++;
 			else
 				again = 0;
 
 			facecounter++;
 
-		} while(again!=0);
+		} while (again!=0);
 	}
 
 	scs->numpoints = dm->getNumVerts(dm) + newdivs;
@@ -471,18 +476,18 @@ static void calcTriangleDivs(Object *ob, MVert *verts, int UNUSED(numverts), MFa
 	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]);
+	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.5 * scaleFac;
 
-	if(*tridivs)
+	if (*tridivs)
 		MEM_freeN(*tridivs);
 
 	*tridivs = MEM_callocN(sizeof(int) * numtris * 3, "Smoke_Tridivs");
 
-	for(i = 0, facecounter = 0; i < numfaces; i++) 
+	for (i = 0, facecounter = 0; i < numfaces; i++) 
 	{
 		float p0[3], p1[3], p2[3];
 		float side1[3];
@@ -501,19 +506,19 @@ static void calcTriangleDivs(Object *ob, MVert *verts, int UNUSED(numverts), MFa
 		sub_v3_v3v3(side2, p2, p0);
 		sub_v3_v3v3(side3, p1, p2);
 
-		if(dot_v3v3(side1, side1) > fsTri*fsTri)
+		if (dot_v3v3(side1, side1) > fsTri*fsTri)
 		{ 
 			float tmp = normalize_v3(side1);
 			divs1 = (int)ceil(tmp/fsTri); 
 		}
-		if(dot_v3v3(side2, side2) > fsTri*fsTri)
+		if (dot_v3v3(side2, side2) > fsTri*fsTri)
 		{ 
 			float tmp = normalize_v3(side2);
 			divs2 = (int)ceil(tmp/fsTri); 
 			
 			/*
 			// debug
-			if(i==0)
+			if (i==0)
 				printf("b tmp: %f, fsTri: %f, divs2: %d\n", tmp, fsTri, divs2);
 			*/
 		}
@@ -523,7 +528,7 @@ static void calcTriangleDivs(Object *ob, MVert *verts, int UNUSED(numverts), MFa
 		(*tridivs)[3 * facecounter + 2] = divs3;
 
 		// TODO quad case
-		if(faces[i].v4)
+		if (faces[i].v4)
 		{
 			divs1=0, divs2=0, divs3=0;
 
@@ -540,12 +545,12 @@ static void calcTriangleDivs(Object *ob, MVert *verts, int UNUSED(numverts), MFa
 			sub_v3_v3v3(side2, p2, p0);
 			sub_v3_v3v3(side3, p1, p2);
 
-			if(dot_v3v3(side1, side1) > fsTri*fsTri)
+			if (dot_v3v3(side1, side1) > fsTri*fsTri)
 			{ 
 				float tmp = normalize_v3(side1);
 				divs1 = (int)ceil(tmp/fsTri); 
 			}
-			if(dot_v3v3(side2, side2) > fsTri*fsTri)
+			if (dot_v3v3(side2, side2) > fsTri*fsTri)
 			{ 
 				float tmp = normalize_v3(side2);
 				divs2 = (int)ceil(tmp/fsTri); 
@@ -563,19 +568,19 @@ static void calcTriangleDivs(Object *ob, MVert *verts, int UNUSED(numverts), MFa
 
 static void smokeModifier_freeDomain(SmokeModifierData *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);
 
-		if(smd->domain->wt)
+		if (smd->domain->wt)
 			smoke_turbulence_free(smd->domain->wt);
 
-		if(smd->domain->effector_weights)
+		if (smd->domain->effector_weights)
 				MEM_freeN(smd->domain->effector_weights);
 		smd->domain->effector_weights = NULL;
 
@@ -589,10 +594,10 @@ static void smokeModifier_freeDomain(SmokeModifierData *smd)
 
 static void smokeModifier_freeFlow(SmokeModifierData *smd)
 {
-	if(smd->flow)
+	if (smd->flow)
 	{
 /*
-		if(smd->flow->bvh)
+		if (smd->flow->bvh)
 		{
 			free_bvhtree_from_mesh(smd->flow->bvh);
 			MEM_freeN(smd->flow->bvh);
@@ -606,22 +611,22 @@ static void smokeModifier_freeFlow(SmokeModifierData *smd)
 
 static void smokeModifier_freeCollision(SmokeModifierData *smd)
 {
-	if(smd->coll)
+	if (smd->coll)
 	{
-		if(smd->coll->points)
+		if (smd->coll->points)
 		{
 			MEM_freeN(smd->coll->points);
 			smd->coll->points = NULL;
 		}
 
-		if(smd->coll->bvhtree)
+		if (smd->coll->bvhtree)
 		{
 			BLI_bvhtree_free(smd->coll->bvhtree);
 			smd->coll->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
@@ -633,7 +638,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;
@@ -642,15 +647,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;
@@ -662,10 +667,10 @@ void smokeModifier_reset(struct SmokeModifierData *smd)
 
 			// printf("reset domain end\n");
 		}
-		else if(smd->flow)
+		else if (smd->flow)
 		{
 			/*
-			if(smd->flow->bvh)
+			if (smd->flow->bvh)
 			{
 				free_bvhtree_from_mesh(smd->flow->bvh);
 				MEM_freeN(smd->flow->bvh);
@@ -673,22 +678,22 @@ void smokeModifier_reset(struct SmokeModifierData *smd)
 			smd->flow->bvh = NULL;
 			*/
 		}
-		else if(smd->coll)
+		else if (smd->coll)
 		{
-			if(smd->coll->points)
+			if (smd->coll->points)
 			{
 				MEM_freeN(smd->coll->points);
 				smd->coll->points = NULL;
 			}
 
-			if(smd->coll->bvhtree)
+			if (smd->coll->bvhtree)
 			{
 				BLI_bvhtree_free(smd->coll->bvhtree);
 				smd->coll->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
@@ -699,7 +704,7 @@ void smokeModifier_reset(struct SmokeModifierData *smd)
 
 void smokeModifier_free (SmokeModifierData *smd)
 {
-	if(smd)
+	if (smd)
 	{
 		smokeModifier_freeDomain(smd);
 		smokeModifier_freeFlow(smd);
@@ -709,11 +714,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");
@@ -750,9 +755,9 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
 			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");
@@ -768,9 +773,9 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
 			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");
@@ -813,16 +818,18 @@ void smokeModifier_copy(struct SmokeModifierData *smd, struct SmokeModifierData
 		
 		MEM_freeN(tsmd->domain->effector_weights);
 		tsmd->domain->effector_weights = MEM_dupallocN(smd->domain->effector_weights);
-	} else if (tsmd->flow) {
+	}
+	else if (tsmd->flow) {
 		tsmd->flow->density = smd->flow->density;
 		tsmd->flow->temp = smd->flow->temp;
 		tsmd->flow->psys = smd->flow->psys;
 		tsmd->flow->type = smd->flow->type;
 		tsmd->flow->flags = smd->flow->flags;
 		tsmd->flow->vel_multi = smd->flow->vel_multi;
-	} else if (tsmd->coll) {
+	}
+	else if (tsmd->coll) {
 		;
-		/* leave it as initialised, collision settings is mostly caches */
+		/* leave it as initialized, collision settings is mostly caches */
 	}
 }
 
@@ -838,15 +845,15 @@ static int get_lamp(Scene *scene, float *light)
 	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;
 			}
@@ -863,29 +870,29 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
 	Base *base = NULL;	
 
 	// do collisions, needs to be done before emission, so that smoke isn't emitted inside collision cells
-	if(1)
+	if (1)
 	{
 		Object *otherobj = NULL;
 		ModifierData *md = NULL;
 
-		if(sds->coll_group) // we use groups since we have 2 domains
+		if (sds->coll_group) // we use groups since we have 2 domains
 			go = sds->coll_group->gobject.first;
 		else
 			base = scene->base.first;
 
-		while(base || go)
+		while (base || go)
 		{
 			otherobj = NULL;
-			if(sds->coll_group) 
+			if (sds->coll_group) 
 			{						
-				if(go->ob)							
+				if (go->ob)							
 					otherobj = go->ob;					
 			}					
 			else						
 				otherobj = base->object;					
-			if(!otherobj)					
+			if (!otherobj)					
 			{						
-				if(sds->coll_group)							
+				if (sds->coll_group)							
 					go = go->next;						
 				else							
 					base= base->next;						
@@ -894,18 +901,18 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
 			md = modifiers_findByType(otherobj, eModifierType_Smoke);
 			
 			// check for active smoke modifier
-			if(md && md->mode & (eModifierMode_Realtime | eModifierMode_Render))					
+			if (md && md->mode & (eModifierMode_Realtime | eModifierMode_Render))					
 			{
 				SmokeModifierData *smd2 = (SmokeModifierData *)md;
 
-				if((smd2->type & MOD_SMOKE_TYPE_COLL) && smd2->coll && smd2->coll->points)
+				if ((smd2->type & MOD_SMOKE_TYPE_COLL) && smd2->coll && smd2->coll->points)
 				{
 					// we got nice collision object
 					SmokeCollSettings *scs = smd2->coll;
 					size_t i, j;
 					unsigned char *obstacles = smoke_get_obstacle(smd->domain->fluid);
 
-					for(i = 0; i < scs->numpoints; i++)
+					for (i = 0; i < scs->numpoints; i++)
 					{
 						int badcell = 0;
 						size_t index = 0;
@@ -915,14 +922,14 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
 						get_cell(smd->domain->p0, smd->domain->res, smd->domain->dx, &scs->points[3 * i], 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 (j = 0; j < 3; j++)
+							if ((cell[j] > sds->res[j] - 1) || (cell[j] < 0))
 							{
 								badcell = 1;
 								break;
 							}
 																
-							if(badcell)									
+							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]);
@@ -939,11 +946,11 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
 						{ 								
 						const LbmFloat usqr = (objvel[0]*objvel[0]+objvel[1]*objvel[1]+objvel[2]*objvel[2])*1.5; 								
 						USQRMAXCHECK(usqr, objvel[0],objvel[1],objvel[2], mMaxVlen, mMxvx,mMxvy,mMxvz); 								
-						if(usqr>maxusqr) { 									
+						if (usqr>maxusqr) { 									
 						// cutoff at maxVelVal 									
-						for(int jj=0; jj<3; jj++) { 										
-						if(objvel[jj]>0.) objvel[jj] =  maxVelVal;  										
-						if(objvel[jj]<0.) objvel[jj] = -maxVelVal; 									
+						for (int jj=0; jj<3; jj++) { 										
+						if (objvel[jj] > 0.0) objvel[jj] =  maxVelVal;
+						if (objvel[jj] < 0.0) objvel[jj] = -maxVelVal;
 						} 								
 						} 
 						} 								
@@ -955,7 +962,7 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
 				}
 			}
 
-			if(sds->coll_group)
+			if (sds->coll_group)
 				go = go->next;
 			else
 				base= base->next;
@@ -963,27 +970,27 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
 	}
 
 	// do flows and fluids
-	if(1)			
+	if (1)			
 	{
 		Object *otherobj = NULL;				
 		ModifierData *md = NULL;
-		if(sds->fluid_group) // we use groups since we have 2 domains
+		if (sds->fluid_group) // we use groups since we have 2 domains
 			go = sds->fluid_group->gobject.first;				
 		else					
 			base = scene->base.first;
-		while(base || go)
+		while (base || go)
 		{					
 			otherobj = NULL;
-			if(sds->fluid_group) 
+			if (sds->fluid_group) 
 			{
-				if(go->ob)							
+				if (go->ob)							
 					otherobj = go->ob;					
 			}					
 			else						
 				otherobj = base->object;
-			if(!otherobj)
+			if (!otherobj)
 			{
-				if(sds->fluid_group)
+				if (sds->fluid_group)
 					go = go->next;
 				else
 					base= base->next;
@@ -994,20 +1001,21 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
 			md = modifiers_findByType(otherobj, eModifierType_Smoke);
 			
 			// check for active smoke modifier
-			if(md && md->mode & (eModifierMode_Realtime | eModifierMode_Render))
+			if (md && md->mode & (eModifierMode_Realtime | eModifierMode_Render))
 			{
 				SmokeModifierData *smd2 = (SmokeModifierData *)md;
 				
 				// 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;
 					
-					if(sfs && sfs->psys && sfs->psys->part && sfs->psys->part->type==PART_EMITTER) // is particle system selected
+					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);								
@@ -1032,7 +1040,7 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
 						sim.psys = psys;
 
 						// initialize temp emission map
-						if(!(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW))
+						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");
@@ -1043,7 +1051,23 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
 						}
 														
 						// mostly copied from particle code								
-						for(p=0; p<psys->totpart; p++)								
+						if (psys->part->type==PART_HAIR)
+						{
+							/*
+							if (psys->childcache)
+							{
+								totchild = psys->totchildcache;
+							}
+							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;
@@ -1051,32 +1075,41 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
 							int badcell = 0;
 							ParticleKey state;
 
-							if(psys->particles[p].flag & (PARS_NO_DISP|PARS_UNEXIST))
-								continue;
+							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 = smd->time;
-
-							if(psys_get_particle_state(&sim, p, &state, 0) == 0)
+							if (psys_get_particle_state(&sim, p, &state, 0) == 0)
 								continue;
-							
+												
 							// copy_v3_v3(pos, pa->state.co);
-							// mul_m4_v3(ob->imat, pos);																		
-							// 1. get corresponding cell	
+							// mul_m4_v3(ob->imat, pos);
+							// 1. get corresponding cell
 							get_cell(smd->domain->p0, smd->domain->res, smd->domain->dx, state.co, cell, 0);																	
 							// check if cell is valid (in the domain boundary)									
-							for(i = 0; i < 3; i++)									
+							for (i = 0; i < 3; i++)									
 							{										
-								if((cell[i] > sds->res[i] - 1) || (cell[i] < 0))										
+								if ((cell[i] > sds->res[i] - 1) || (cell[i] < 0))										
 								{											
 									badcell = 1;											
 									break;										
 								}									
 							}																			
-							if(badcell)										
+							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
+							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;
@@ -1086,14 +1119,14 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
 								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))
+								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									
+							else if (sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW) // outflow									
 							{										
 								heat[index] = 0.f;										
 								density[index] = 0.f;										
@@ -1101,15 +1134,15 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
 								velocity_y[index] = 0.f;										
 								velocity_z[index] = 0.f;
 								// we need different handling for the high-res feature
-								if(bigdensity)
+								if (bigdensity)
 								{
 									// init all surrounding cells according to amplification, too											
 									int i, j, k;
 									smoke_turbulence_get_res(smd->domain->wt, bigres);
 
-									for(i = 0; i < smd->domain->amplify + 1; i++)
-										for(j = 0; j < smd->domain->amplify + 1; j++)
-											for(k = 0; k < smd->domain->amplify + 1; k++)
+									for (i = 0; i < smd->domain->amplify + 1; i++)
+										for (j = 0; j < smd->domain->amplify + 1; j++)
+											for (k = 0; k < smd->domain->amplify + 1; k++)
 											{														
 												index = smoke_get_index((smd->domain->amplify + 1)* cell[0] + i, bigres[0], (smd->domain->amplify + 1)* cell[1] + j, bigres[1], (smd->domain->amplify + 1)* cell[2] + k);														
 												bigdensity[index] = 0.f;													
@@ -1120,7 +1153,7 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
 
 
 							// apply emission values
-							if(!(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW)) {
+							if (!(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW)) {
 
 								// initialize variables
 								int ii, jj, kk, x, y, z, block_size;
@@ -1131,12 +1164,12 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
 
 
 									// 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++)													
+									for (x = 0; x < sds->res[0]; x++)
+										for (y = 0; y < sds->res[1]; y++)
+											for (z = 0; z < sds->res[2]; z++)													
 											{
 
-												// neighbour cell emission densities (for high resolution smoke smooth interpolation)
+												// 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;
@@ -1169,9 +1202,9 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
 												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++)													
+												for (ii = 0; ii < block_size; ii++)
+													for (jj = 0; jj < block_size; jj++)
+														for (kk = 0; kk < block_size; kk++)													
 														{
 
 														float fx,fy,fz, interpolated_value;
@@ -1245,10 +1278,9 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
 
 										
 				}							
-				else							
-				{								
+				else {								
 					/*								
-					for()								
+					for ()								
 					{									
 						// no psys									
 						BVHTreeNearest nearest;
@@ -1260,7 +1292,7 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
 				}
 			}						
 		}
-			if(sds->fluid_group)
+			if (sds->fluid_group)
 				go = go->next;
 			else
 				base= base->next;
@@ -1271,7 +1303,7 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
 	{
 		ListBase *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);
@@ -1283,15 +1315,15 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
 			int x, y, z;
 
 			// 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++)
+			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)					
+				if (density[index] < FLT_EPSILON)					
 					continue;	
 
 				vel[0] = velocity_x[index];
@@ -1318,12 +1350,12 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd)
 }
 void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedMesh *dm)
 {	
-	if((smd->type & MOD_SMOKE_TYPE_FLOW))
+	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 (scene->r.cfra > smd->time)
 		{
 			// XXX TODO
 			smd->time = scene->r.cfra;
@@ -1334,40 +1366,40 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
 			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)
 	{
-		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 (scene->r.cfra > smd->time)
 		{
 			// XXX TODO
 			smd->time = scene->r.cfra;
 
 #ifdef USE_SMOKE_COLLISION_DM
-			if(smd->coll->dm)
+			if (smd->coll->dm)
 				smd->coll->dm->release(smd->coll->dm);
 
-			smd->coll->dm = CDDM_copy(dm);
+			smd->coll->dm = CDDM_copy_from_tessface(dm);
 #endif
 
 			// rigid movement support
 			copy_m4_m4(smd->coll->mat_old, smd->coll->mat);
 			copy_m4_m4(smd->coll->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_DOMAIN)
+	else if (smd->type & MOD_SMOKE_TYPE_DOMAIN)
 	{
 		SmokeDomainSettings *sds = smd->domain;
 		float light[3];	
@@ -1384,14 +1416,14 @@ 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);
 			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;
@@ -1404,21 +1436,21 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
 
 		// 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 */
@@ -1430,14 +1462,14 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
 		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))
+			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);
 
-			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);
 			}
@@ -1454,26 +1486,26 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
 
 		// 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);
 			smoke_step(sds->fluid, smd->time, scene->r.frs_sec / scene->r.frs_sec_base);
 		}
 
 		// create shadows before writing cache so they get stored
-		if(get_lamp(scene, light))
+		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);
 
-		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();
@@ -1488,7 +1520,7 @@ static float calc_voxel_transp(float *result, float *input, int res[3], int *pix
 	// T_ray *= T_vox
 	*tRay *= exp(input[index]*correct);
 	
-	if(result[index] < 0.0f)	
+	if (result[index] < 0.0f)	
 	{
 #pragma omp critical		
 		result[index] = *tRay;	
@@ -1542,7 +1574,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;
@@ -1556,11 +1588,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)) {
+	}
+	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;
@@ -1574,11 +1607,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 {
+	}
+	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;
@@ -1603,14 +1637,12 @@ static void get_cell(float *p0, int res[3], float dx, float *pos, int *cell, int
 	sub_v3_v3v3(tmp, pos, p0);
 	mul_v3_fl(tmp, 1.0 / dx);
 
-	if(correct)
-	{
+	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
-	{
+	else {
 		cell[0] = (int)floor(tmp[0]);
 		cell[1] = (int)floor(tmp[1]);
 		cell[2] = (int)floor(tmp[2]);
@@ -1622,7 +1654,7 @@ static void smoke_calc_transparency(float *result, float *input, float *p0, floa
 	float bv[6];
 	int a, z, slabsize=res[0]*res[1], size= res[0]*res[1]*res[2];
 
-	for(a=0; a<size; a++)
+	for (a=0; a<size; a++)
 		result[a]= -1.0f;
 
 	bv[0] = p0[0];
@@ -1635,33 +1667,32 @@ static void smoke_calc_transparency(float *result, float *input, float *p0, floa
 	bv[5] = p1[2];
 
 #pragma omp parallel for schedule(static,1)
-	for(z = 0; z < res[2]; z++)
+	for (z = 0; z < res[2]; z++)
 	{
 		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 < res[1]; y++)
+			for (x = 0; x < res[0]; x++, index++)
 			{
 				float voxelCenter[3];
 				float pos[3];
 				int cell[3];
 				float tRay = 1.0;
 
-				if(result[index] >= 0.0f)					
+				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;
 
 				// get starting position (in voxel coords)
-				if(BLI_bvhtree_bb_raycast(bv, light, voxelCenter, pos) > FLT_EPSILON)
+				if (BLI_bvhtree_bb_raycast(bv, light, voxelCenter, pos) > FLT_EPSILON)
 				{
 					// we're ouside
 					get_cell(p0, res, dx, pos, cell, 1);
 				}
-				else
-				{
+				else {
 					// we're inside
 					get_cell(p0, res, dx, light, cell, 1);
 				}
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 46a3f77..01930cc 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -113,7 +113,7 @@ typedef struct ReferenceVert {
 typedef struct ReferenceState {
 	float com[3]; /* center of mass*/
 	ReferenceVert *ivert; /* list of intial values */
-}ReferenceState ;
+} ReferenceState;
 
 
 /*private scratch pad for caching and other data only needed when alive*/
@@ -125,7 +125,7 @@ typedef struct SBScratch {
 	int totface;
 	float aabbmin[3],aabbmax[3];
 	ReferenceState Ref;
-}SBScratch;
+} SBScratch;
 
 typedef struct  SB_thread_context {
 		Scene *scene;
@@ -140,7 +140,7 @@ typedef struct  SB_thread_context {
 		float windfactor;
 		int nr;
 		int tot;
-}SB_thread_context;
+} SB_thread_context;
 
 #define NLF_BUILD  1
 #define NLF_SOLVE  2
@@ -196,7 +196,7 @@ static float sb_time_scale(Object *ob)
 /* defining the frames to *real* time relation */
 {
 	SoftBody *sb= ob->soft;	/* is supposed to be there */
-	if (sb){
+	if (sb) {
 		return(sb->physics_speed);
 		/*hrms .. this could be IPO as well :)
 		 estimated range [0.001 sluggish slug - 100.0 very fast (i hope ODE solver can handle that)]
@@ -226,29 +226,29 @@ static float sb_time_scale(Object *ob)
 static float _final_goal(Object *ob,BodyPoint *bp)/*jow_go_for2_5 */
 {
 	float f = -1999.99f;
-	if (ob){
+	if (ob) {
 		SoftBody *sb= ob->soft;	/* is supposed to be there */
-		if(!(ob->softflag & OB_SB_GOAL)) return (0.0f);
-		if (sb&&bp){
+		if (!(ob->softflag & OB_SB_GOAL)) return (0.0f);
+		if (sb&&bp) {
 			if (bp->goal < 0.0f) return (0.0f);
 			f = sb->mingoal + bp->goal*ABS(sb->maxgoal - sb->mingoal);
 			f = pow(f, 4.0f);
 			return (f);
 		}
 	}
-	printf("_final_goal failed! sb or bp ==NULL \n" );
+	printf("_final_goal failed! sb or bp ==NULL\n" );
 	return f; /*using crude but spot able values some times helps debuggin */
 }
 
 static float _final_mass(Object *ob,BodyPoint *bp)
 {
-	if (ob){
+	if (ob) {
 		SoftBody *sb= ob->soft;	/* is supposed to be there */
-		if (sb&&bp){
+		if (sb&&bp) {
 			return(bp->mass*sb->nodemass);
 		}
 	}
-	printf("_final_mass failed! sb or bp ==NULL \n" );
+	printf("_final_mass failed! sb or bp ==NULL\n" );
 	return 1.0f;
 }
 /* helper functions for everything is animateble jow_go_for2_5 ------*/
@@ -267,9 +267,9 @@ float operations still
 */
 static const int CCD_SAVETY = 190561;
 
-typedef struct ccdf_minmax{
-float minx,miny,minz,maxx,maxy,maxz;
-}ccdf_minmax;
+typedef struct ccdf_minmax {
+	float minx, miny, minz, maxx, maxy, maxz;
+} ccdf_minmax;
 
 
 
@@ -283,7 +283,7 @@ typedef struct ccd_Mesh {
 	/* Axis Aligned Bounding Box AABB */
 	float bbmin[3];
 	float bbmax[3];
-}ccd_Mesh;
+} ccd_Mesh;
 
 
 
@@ -292,7 +292,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob)
 {
 	CollisionModifierData *cmd;
 	ccd_Mesh *pccd_M = NULL;
-	ccdf_minmax *mima =NULL;
+	ccdf_minmax *mima = NULL;
 	MFace *mface=NULL;
 	float v[3],hull;
 	int i;
@@ -319,7 +319,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob)
 	pccd_M->mvert = MEM_dupallocN(cmd->xnew);
 	/* note that xnew coords are already in global space, */
 	/* determine the ortho BB */
-	for(i=0; i < pccd_M->totvert; i++){
+	for (i=0; i < pccd_M->totvert; i++) {
 		/* evaluate limits */
 		copy_v3_v3(v,pccd_M->mvert[i].co);
 		pccd_M->bbmin[0] = MIN2(pccd_M->bbmin[0],v[0]-hull);
@@ -341,7 +341,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob)
 
 
 	/* anyhoo we need to walk the list of faces and find OBB they live in */
-	for(i=0; i < pccd_M->totface; i++){
+	for (i=0; i < pccd_M->totface; i++) {
 		mima->minx=mima->miny=mima->minz=1e30f;
 		mima->maxx=mima->maxy=mima->maxz=-1e30f;
 
@@ -369,7 +369,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob)
 		mima->maxy = MAX2(mima->maxy,v[1]+hull);
 		mima->maxz = MAX2(mima->maxz,v[2]+hull);
 
-		if(mface->v4){
+		if (mface->v4) {
 			copy_v3_v3(v,pccd_M->mvert[mface->v4].co);
 		mima->minx = MIN2(mima->minx,v[0]-hull);
 		mima->miny = MIN2(mima->miny,v[1]-hull);
@@ -389,7 +389,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob)
 static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
 {
 	CollisionModifierData *cmd;
-	ccdf_minmax *mima =NULL;
+	ccdf_minmax *mima = NULL;
 	MFace *mface=NULL;
 	float v[3],hull;
 	int i;
@@ -397,8 +397,8 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
 	cmd =(CollisionModifierData *)modifiers_findByType(ob, eModifierType_Collision);
 
 	/* first some paranoia checks */
-	if (!cmd) return ;
-	if (!cmd->numverts || !cmd->numfaces) return ;
+	if (!cmd) return;
+	if (!cmd->numverts || !cmd->numfaces) return;
 
 	if ((pccd_M->totvert != cmd->numverts) ||
 		(pccd_M->totface != cmd->numfaces)) return;
@@ -411,13 +411,13 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
 	hull = MAX2(ob->pd->pdef_sbift,ob->pd->pdef_sboft);
 
 	/* rotate current to previous */
-	if(pccd_M->mprevvert) MEM_freeN(pccd_M->mprevvert);
+	if (pccd_M->mprevvert) MEM_freeN(pccd_M->mprevvert);
 	pccd_M->mprevvert = pccd_M->mvert;
 	/* alloc and copy verts*/
 	pccd_M->mvert = MEM_dupallocN(cmd->xnew);
 	/* note that xnew coords are already in global space, */
 	/* determine the ortho BB */
-	for(i=0; i < pccd_M->totvert; i++){
+	for (i=0; i < pccd_M->totvert; i++) {
 		/* evaluate limits */
 		copy_v3_v3(v,pccd_M->mvert[i].co);
 		pccd_M->bbmin[0] = MIN2(pccd_M->bbmin[0],v[0]-hull);
@@ -445,7 +445,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
 
 
 	/* anyhoo we need to walk the list of faces and find OBB they live in */
-	for(i=0; i < pccd_M->totface; i++){
+	for (i=0; i < pccd_M->totface; i++) {
 		mima->minx=mima->miny=mima->minz=1e30f;
 		mima->maxx=mima->maxy=mima->maxz=-1e30f;
 
@@ -473,7 +473,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
 		mima->maxy = MAX2(mima->maxy,v[1]+hull);
 		mima->maxz = MAX2(mima->maxz,v[2]+hull);
 
-		if(mface->v4){
+		if (mface->v4) {
 			copy_v3_v3(v,pccd_M->mvert[mface->v4].co);
 		mima->minx = MIN2(mima->minx,v[0]-hull);
 		mima->miny = MIN2(mima->miny,v[1]-hull);
@@ -508,7 +508,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
 		mima->maxy = MAX2(mima->maxy,v[1]+hull);
 		mima->maxz = MAX2(mima->maxz,v[2]+hull);
 
-		if(mface->v4){
+		if (mface->v4) {
 			copy_v3_v3(v,pccd_M->mprevvert[mface->v4].co);
 		mima->minx = MIN2(mima->minx,v[0]-hull);
 		mima->miny = MIN2(mima->miny,v[1]-hull);
@@ -523,12 +523,12 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
 	mface++;
 
 	}
-	return ;
+	return;
 }
 
 static void ccd_mesh_free(ccd_Mesh *ccdm)
 {
-	if(ccdm && (ccdm->savety == CCD_SAVETY )){ /*make sure we're not nuking objects we don't know*/
+	if (ccdm && (ccdm->savety == CCD_SAVETY )) { /*make sure we're not nuking objects we don't know*/
 		MEM_freeN(ccdm->mface);
 		MEM_freeN(ccdm->mvert);
 		if (ccdm->mprevvert) MEM_freeN(ccdm->mprevvert);
@@ -546,16 +546,16 @@ static void ccd_build_deflector_hash(Scene *scene, Object *vertexowner, GHash *h
 	if (!hash) return;
 	while (base) {
 		/*Only proceed for mesh object in same layer */
-		if(base->object->type==OB_MESH && (base->lay & vertexowner->lay)) {
+		if (base->object->type==OB_MESH && (base->lay & vertexowner->lay)) {
 			ob= base->object;
-			if((vertexowner) && (ob == vertexowner)) {
+			if ((vertexowner) && (ob == vertexowner)) {
 				/* if vertexowner is given  we don't want to check collision with owner object */
 				base = base->next;
 				continue;
 			}
 
 			/*+++ only with deflecting set */
-			if(ob->pd && ob->pd->deflect && BLI_ghash_lookup(hash, ob) == NULL) {
+			if (ob->pd && ob->pd->deflect && BLI_ghash_lookup(hash, ob) == NULL) {
 				ccd_Mesh *ccdmesh = ccd_mesh_make(ob);
 				BLI_ghash_insert(hash, ob, ccdmesh);
 			}/*--- only with deflecting set */
@@ -573,16 +573,16 @@ static void ccd_update_deflector_hash(Scene *scene, Object *vertexowner, GHash *
 	if ((!hash) || (!vertexowner)) return;
 	while (base) {
 		/*Only proceed for mesh object in same layer */
-		if(base->object->type==OB_MESH && (base->lay & vertexowner->lay)) {
+		if (base->object->type==OB_MESH && (base->lay & vertexowner->lay)) {
 			ob= base->object;
-			if(ob == vertexowner){
+			if (ob == vertexowner) {
 				/* if vertexowner is given  we don't want to check collision with owner object */
 				base = base->next;
 				continue;
 			}
 
 			/*+++ only with deflecting set */
-			if(ob->pd && ob->pd->deflect) {
+			if (ob->pd && ob->pd->deflect) {
 				ccd_Mesh *ccdmesh = BLI_ghash_lookup(hash,ob);
 				if (ccdmesh)
 					ccd_mesh_update(ob,ccdmesh);
@@ -604,9 +604,9 @@ static int count_mesh_quads(Mesh *me)
 	int a,result = 0;
 	MFace *mface= me->mface;
 
-	if(mface) {
-		for(a=me->totface; a>0; a--, mface++) {
-			if(mface->v4) result++;
+	if (mface) {
+		for (a=me->totface; a>0; a--, mface++) {
+			if (mface->v4) result++;
 		}
 	}
 	return result;
@@ -618,9 +618,9 @@ static void add_mesh_quad_diag_springs(Object *ob)
 	MFace *mface= me->mface;
 	/*BodyPoint *bp;*/ /*UNUSED*/
 	BodySpring *bs, *bs_new;
-	int a ;
+	int a;
 
-	if (ob->soft){
+	if (ob->soft) {
 		int nofquads;
 		//float s_shear = ob->soft->shearstiff*ob->soft->shearstiff;
 
@@ -630,7 +630,7 @@ static void add_mesh_quad_diag_springs(Object *ob)
 			bs_new= MEM_callocN( (ob->soft->totspring + nofquads *2 )*sizeof(BodySpring), "bodyspring");
 			memcpy(bs_new,ob->soft->bspring,(ob->soft->totspring )*sizeof(BodySpring));
 
-			if(ob->soft->bspring)
+			if (ob->soft->bspring)
 				MEM_freeN(ob->soft->bspring); /* do this before reassigning the pointer  or have a 1st class memory leak */
 			ob->soft->bspring = bs_new;
 
@@ -638,16 +638,16 @@ static void add_mesh_quad_diag_springs(Object *ob)
 			a = 0;
 			bs = bs_new+ob->soft->totspring;
 			/*bp= ob->soft->bpoint; */ /*UNUSED*/
-			if(mface ) {
-				for(a=me->totface; a>0; a--, mface++) {
-					if(mface->v4) {
+			if (mface ) {
+				for (a=me->totface; a>0; a--, mface++) {
+					if (mface->v4) {
 						bs->v1= mface->v1;
 						bs->v2= mface->v3;
-						bs->springtype   =SB_STIFFQUAD;
+						bs->springtype   = SB_STIFFQUAD;
 						bs++;
 						bs->v1= mface->v2;
 						bs->v2= mface->v4;
-						bs->springtype   =SB_STIFFQUAD;
+						bs->springtype   = SB_STIFFQUAD;
 						bs++;
 
 					}
@@ -667,47 +667,47 @@ static void add_2nd_order_roller(Object *ob,float UNUSED(stiffness), int *counte
 	BodyPoint *bp,*bpo;
 	BodySpring *bs,*bs2,*bs3= NULL;
 	int a,b,c,notthis= 0,v0;
-	if (!sb->bspring){return;} /* we are 2nd order here so 1rst should have been build :) */
+	if (!sb->bspring) {return;} /* we are 2nd order here so 1rst should have been build :) */
 	/* first run counting  second run adding */
 	*counter = 0;
 	if (addsprings) bs3 = ob->soft->bspring+ob->soft->totspring;
-	for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
+	for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
 		/*scan for neighborhood*/
 		bpo = NULL;
 		v0  = (sb->totpoint-a);
-		for(b=bp->nofsprings;b>0;b--){
+		for (b=bp->nofsprings;b>0;b--) {
 			bs = sb->bspring + bp->springs[b-1];
 			/*nasty thing here that springs have two ends
 			so here we have to make sure we examine the other */
-			if (v0 == bs->v1){
-				bpo =sb->bpoint+bs->v2;
+			if (v0 == bs->v1) {
+				bpo = sb->bpoint+bs->v2;
 				notthis = bs->v2;
 			}
 			else {
-			if (v0 == bs->v2){
-				bpo =sb->bpoint+bs->v1;
+			if (v0 == bs->v2) {
+				bpo = sb->bpoint+bs->v1;
 				notthis = bs->v1;
 			}
 			else {printf("oops we should not get here -  add_2nd_order_springs");}
 			}
-			if (bpo){/* so now we have a 2nd order humpdidump */
-				for(c=bpo->nofsprings;c>0;c--){
+			if (bpo) {/* so now we have a 2nd order humpdidump */
+				for (c=bpo->nofsprings;c>0;c--) {
 					bs2 = sb->bspring + bpo->springs[c-1];
-					if ((bs2->v1 != notthis)  && (bs2->v1 > v0)){
+					if ((bs2->v1 != notthis)  && (bs2->v1 > v0)) {
 						(*counter)++;/*hit */
-						if (addsprings){
+						if (addsprings) {
 							bs3->v1= v0;
 							bs3->v2= bs2->v1;
-							bs3->springtype   =SB_BEND;
+							bs3->springtype   = SB_BEND;
 							bs3++;
 						}
 					}
-					if ((bs2->v2 !=notthis)&&(bs2->v2 > v0)){
+					if ((bs2->v2 !=notthis)&&(bs2->v2 > v0)) {
 					(*counter)++;/*hit */
-						if (addsprings){
+						if (addsprings) {
 							bs3->v1= v0;
 							bs3->v2= bs2->v2;
-							bs3->springtype   =SB_BEND;
+							bs3->springtype   = SB_BEND;
 							bs3++;
 						}
 
@@ -734,12 +734,12 @@ static void add_2nd_order_springs(Object *ob,float stiffness)
 		bs_new= MEM_callocN( (ob->soft->totspring + counter )*sizeof(BodySpring), "bodyspring");
 		memcpy(bs_new,ob->soft->bspring,(ob->soft->totspring )*sizeof(BodySpring));
 
-		if(ob->soft->bspring)
+		if (ob->soft->bspring)
 			MEM_freeN(ob->soft->bspring);
 		ob->soft->bspring = bs_new;
 
 		add_2nd_order_roller(ob,stiffness,&counter,1); /* adding */
-		ob->soft->totspring +=counter ;
+		ob->soft->totspring += counter;
 	}
 }
 
@@ -774,18 +774,18 @@ static void build_bps_springlist(Object *ob)
 
 	if (sb==NULL) return; /* paranoya check */
 
-	for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
+	for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
 		/* throw away old list */
 		if (bp->springs) {
 			MEM_freeN(bp->springs);
 			bp->springs=NULL;
 		}
 		/* scan for attached inner springs */
-		for(b=sb->totspring, bs= sb->bspring; b>0; b--, bs++) {
-			if (( (sb->totpoint-a) == bs->v1) ){
+		for (b=sb->totspring, bs= sb->bspring; b>0; b--, bs++) {
+			if (( (sb->totpoint-a) == bs->v1) ) {
 				add_bp_springlist(bp,sb->totspring -b);
 			}
-			if (( (sb->totpoint-a) == bs->v2) ){
+			if (( (sb->totpoint-a) == bs->v2) ) {
 				add_bp_springlist(bp,sb->totspring -b);
 			}
 		}/*for springs*/
@@ -802,16 +802,16 @@ static void calculate_collision_balls(Object *ob)
 
 	if (sb==NULL) return; /* paranoya check */
 
-	for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
+	for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
 		bp->colball=0;
 		akku =0.0f;
 		akku_count=0;
 		min = 1e22f;
 		max = -1e22f;
 		/* first estimation based on attached */
-		for(b=bp->nofsprings;b>0;b--){
+		for (b=bp->nofsprings;b>0;b--) {
 			bs = sb->bspring + bp->springs[b-1];
-			if (bs->springtype == SB_EDGE){
+			if (bs->springtype == SB_EDGE) {
 			akku += bs->len;
 			akku_count++,
 			min = MIN2(bs->len,min);
@@ -820,19 +820,19 @@ static void calculate_collision_balls(Object *ob)
 		}
 
 		if (akku_count > 0) {
-			if (sb->sbc_mode == SBC_MODE_MANUAL){
+			if (sb->sbc_mode == SBC_MODE_MANUAL) {
 				bp->colball=sb->colball;
 			}
-			if (sb->sbc_mode == SBC_MODE_AVG){
+			if (sb->sbc_mode == SBC_MODE_AVG) {
 				bp->colball = akku/(float)akku_count*sb->colball;
 			}
-			if (sb->sbc_mode == SBC_MODE_MIN){
+			if (sb->sbc_mode == SBC_MODE_MIN) {
 				bp->colball=min*sb->colball;
 			}
-			if (sb->sbc_mode == SBC_MODE_MAX){
+			if (sb->sbc_mode == SBC_MODE_MAX) {
 				bp->colball=max*sb->colball;
 			}
-			if (sb->sbc_mode == SBC_MODE_AVGMINMAX){
+			if (sb->sbc_mode == SBC_MODE_AVGMINMAX) {
 				bp->colball = (min + max)/2.0f*sb->colball;
 			}
 		}
@@ -847,20 +847,20 @@ static void renew_softbody(Scene *scene, Object *ob, int totpoint, int totspring
 	SoftBody *sb;
 	int i;
 	short softflag;
-	if(ob->soft==NULL) ob->soft= sbNew(scene);
+	if (ob->soft==NULL) ob->soft= sbNew(scene);
 	else free_softbody_intern(ob->soft);
 	sb= ob->soft;
 	softflag=ob->softflag;
 
-	if(totpoint) {
+	if (totpoint) {
 		sb->totpoint= totpoint;
 		sb->totspring= totspring;
 
 		sb->bpoint= MEM_mallocN( totpoint*sizeof(BodyPoint), "bodypoint");
-		if(totspring)
+		if (totspring)
 			sb->bspring= MEM_mallocN( totspring*sizeof(BodySpring), "bodyspring");
 
-			/* initialise BodyPoint array */
+			/* initialize BodyPoint array */
 		for (i=0; i<totpoint; i++) {
 			BodyPoint *bp = &sb->bpoint[i];
 
@@ -868,7 +868,7 @@ static void renew_softbody(Scene *scene, Object *ob, int totpoint, int totspring
 			/* hum as far as i see this is overridden by _final_goal() now jow_go_for2_5 */
 			/* sadly breaks compatibility with older versions */
 			/* but makes goals behave the same for meshes, lattices and curves */
-			if(softflag & OB_SB_GOAL) {
+			if (softflag & OB_SB_GOAL) {
 				bp->goal= sb->defgoal;
 			}
 			else {
@@ -894,28 +894,28 @@ static void free_softbody_baked(SoftBody *sb)
 	SBVertex *key;
 	int k;
 
-	for(k=0; k<sb->totkey; k++) {
+	for (k=0; k<sb->totkey; k++) {
 		key= *(sb->keys + k);
-		if(key) MEM_freeN(key);
+		if (key) MEM_freeN(key);
 	}
-	if(sb->keys) MEM_freeN(sb->keys);
+	if (sb->keys) MEM_freeN(sb->keys);
 
 	sb->keys= NULL;
 	sb->totkey= 0;
 }
 static void free_scratch(SoftBody *sb)
 {
-	if(sb->scratch){
+	if (sb->scratch) {
 		/* todo make sure everything is cleaned up nicly */
-		if (sb->scratch->colliderhash){
+		if (sb->scratch->colliderhash) {
 			BLI_ghash_free(sb->scratch->colliderhash, NULL,
 					(GHashValFreeFP) ccd_mesh_free); /*this hoepfully will free all caches*/
 			sb->scratch->colliderhash = NULL;
 		}
-		if (sb->scratch->bodyface){
+		if (sb->scratch->bodyface) {
 			MEM_freeN(sb->scratch->bodyface);
 		}
-		if (sb->scratch->Ref.ivert){
+		if (sb->scratch->Ref.ivert) {
 			MEM_freeN(sb->scratch->Ref.ivert);
 		}
 		MEM_freeN(sb->scratch);
@@ -927,12 +927,12 @@ static void free_scratch(SoftBody *sb)
 /* only frees internal data */
 static void free_softbody_intern(SoftBody *sb)
 {
-	if(sb) {
+	if (sb) {
 		int a;
 		BodyPoint *bp;
 
-		if(sb->bpoint){
-			for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
+		if (sb->bpoint) {
+			for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
 				/* free spring list */
 				if (bp->springs != NULL) {
 					MEM_freeN(bp->springs);
@@ -941,7 +941,7 @@ static void free_softbody_intern(SoftBody *sb)
 			MEM_freeN(sb->bpoint);
 		}
 
-		if(sb->bspring) MEM_freeN(sb->bspring);
+		if (sb->bspring) MEM_freeN(sb->bspring);
 
 		sb->totpoint= sb->totspring= 0;
 		sb->bpoint= NULL;
@@ -974,7 +974,7 @@ static void free_softbody_intern(SoftBody *sb)
 ** Q: why not use 'simple' collision here like bouncing back a particle
 **   --> reverting is velocity on the face normal
 ** A: because our particles are not alone here
-**    and need to tell their neighbours exactly what happens via spring forces
+**    and need to tell their neighbors exactly what happens via spring forces
 ** unless sbObjectStep( .. ) is called on sub frame timing level
 ** BTW that also questions the use of a 'implicit' solvers on softbodies
 ** since that would only valid for 'slow' moving collision targets and dito particles
@@ -988,15 +988,15 @@ static void Vec3PlusStVec(float *v, float s, float *v1)
 	v[2] += s*v1[2];
 }
 
-/* +++ dependancy information functions*/
+/* +++ dependency information functions*/
 
 static int are_there_deflectors(Scene *scene, unsigned int layer)
 {
 	Base *base;
 
-	for(base = scene->base.first; base; base= base->next) {
-		if( (base->lay & layer) && base->object->pd) {
-			if(base->object->pd->deflect)
+	for (base = scene->base.first; base; base= base->next) {
+		if ( (base->lay & layer) && base->object->pd) {
+			if (base->object->pd->deflect)
 				return 1;
 		}
 	}
@@ -1007,7 +1007,7 @@ static int query_external_colliders(Scene *scene, Object *me)
 {
 	return(are_there_deflectors(scene, me->lay));
 }
-/* --- dependancy information functions*/
+/* --- dependency information functions*/
 
 
 /* +++ the aabb "force" section*/
@@ -1034,14 +1034,14 @@ static int sb_detect_aabb_collisionCached(	float UNUSED(force[3]), unsigned int
 		ccd_Mesh *ccdm = BLI_ghashIterator_getValue	(ihash);
 		ob             = BLI_ghashIterator_getKey	(ihash);
 			/* only with deflecting set */
-			if(ob->pd && ob->pd->deflect) {
+			if (ob->pd && ob->pd->deflect) {
 #if 0			/* UNUSED */
 				MFace *mface= NULL;
 				MVert *mvert= NULL;
 				MVert *mprevvert= NULL;
 				ccdf_minmax *mima= NULL;
 #endif
-				if(ccdm){
+				if (ccdm) {
 #if 0				/* UNUSED */
 					mface= ccdm->mface;
 					mvert= ccdm->mvert;
@@ -1055,7 +1055,7 @@ static int sb_detect_aabb_collisionCached(	float UNUSED(force[3]), unsigned int
 						(aabbmin[0] > ccdm->bbmax[0]) ||
 						(aabbmin[1] > ccdm->bbmax[1]) ||
 						(aabbmin[2] > ccdm->bbmax[2]) ) {
-						/* boxes dont intersect */
+						/* boxes don't intersect */
 						BLI_ghashIterator_step(ihash);
 						continue;
 					}
@@ -1065,13 +1065,13 @@ static int sb_detect_aabb_collisionCached(	float UNUSED(force[3]), unsigned int
 					deflected = 2;
 
 				}
-				else{
+				else {
 					/*aye that should be cached*/
-					printf("missing cache error \n");
+					printf("missing cache error\n");
 					BLI_ghashIterator_step(ihash);
 					continue;
 				}
-			} /* if(ob->pd && ob->pd->deflect) */
+			} /* if (ob->pd && ob->pd->deflect) */
 			BLI_ghashIterator_step(ihash);
 	} /* while () */
 	BLI_ghashIterator_free(ihash);
@@ -1112,29 +1112,29 @@ static int sb_detect_face_pointCached(float face_v1[3],float face_v2[3],float fa
 		ccd_Mesh *ccdm = BLI_ghashIterator_getValue	(ihash);
 		ob             = BLI_ghashIterator_getKey	(ihash);
 			/* only with deflecting set */
-			if(ob->pd && ob->pd->deflect) {
+			if (ob->pd && ob->pd->deflect) {
 				MVert *mvert= NULL;
 				MVert *mprevvert= NULL;
-				if(ccdm){
+				if (ccdm) {
 					mvert= ccdm->mvert;
 					a    = ccdm->totvert;
 					mprevvert= ccdm->mprevvert;
-					outerfacethickness =ob->pd->pdef_sboft;
+					outerfacethickness = ob->pd->pdef_sboft;
 					if ((aabbmax[0] < ccdm->bbmin[0]) ||
 						(aabbmax[1] < ccdm->bbmin[1]) ||
 						(aabbmax[2] < ccdm->bbmin[2]) ||
 						(aabbmin[0] > ccdm->bbmax[0]) ||
 						(aabbmin[1] > ccdm->bbmax[1]) ||
 						(aabbmin[2] > ccdm->bbmax[2]) ) {
-						/* boxes dont intersect */
+						/* boxes don't intersect */
 						BLI_ghashIterator_step(ihash);
 						continue;
 					}
 
 				}
-				else{
+				else {
 					/*aye that should be cached*/
-					printf("missing cache error \n");
+					printf("missing cache error\n");
 					BLI_ghashIterator_step(ihash);
 					continue;
 				}
@@ -1142,19 +1142,19 @@ static int sb_detect_face_pointCached(float face_v1[3],float face_v2[3],float fa
 
 				/* use mesh*/
 				if (mvert) {
-					while(a){
+					while (a) {
 						copy_v3_v3(nv1,mvert[a-1].co);
-						if(mprevvert){
+						if (mprevvert) {
 							mul_v3_fl(nv1,time);
 							Vec3PlusStVec(nv1,(1.0f-time),mprevvert[a-1].co);
 						}
 						/* origin to face_v2*/
 						sub_v3_v3(nv1, face_v2);
 						facedist = dot_v3v3(nv1,d_nvect);
-						if (ABS(facedist)<outerfacethickness){
-							if (isect_point_tri_prism_v3(nv1, face_v1,face_v2,face_v3) ){
+						if (ABS(facedist)<outerfacethickness) {
+							if (isect_point_tri_prism_v3(nv1, face_v1,face_v2,face_v3) ) {
 								float df;
-								if (facedist > 0){
+								if (facedist > 0) {
 									df = (outerfacethickness-facedist)/outerfacethickness;
 								}
 								else {
@@ -1169,9 +1169,9 @@ static int sb_detect_face_pointCached(float face_v1[3],float face_v2[3],float fa
 							}
 						}
 						a--;
-					}/* while(a)*/
+					}/* while (a)*/
 				} /* if (mvert) */
-			} /* if(ob->pd && ob->pd->deflect) */
+			} /* if (ob->pd && ob->pd->deflect) */
 			BLI_ghashIterator_step(ihash);
 	} /* while () */
 	BLI_ghashIterator_free(ihash);
@@ -1203,12 +1203,12 @@ static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],floa
 		ccd_Mesh *ccdm = BLI_ghashIterator_getValue	(ihash);
 		ob             = BLI_ghashIterator_getKey	(ihash);
 			/* only with deflecting set */
-			if(ob->pd && ob->pd->deflect) {
+			if (ob->pd && ob->pd->deflect) {
 				MFace *mface= NULL;
 				MVert *mvert= NULL;
 				MVert *mprevvert= NULL;
 				ccdf_minmax *mima= NULL;
-				if(ccdm){
+				if (ccdm) {
 					mface= ccdm->mface;
 					mvert= ccdm->mvert;
 					mprevvert= ccdm->mprevvert;
@@ -1221,15 +1221,15 @@ static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],floa
 						(aabbmin[0] > ccdm->bbmax[0]) ||
 						(aabbmin[1] > ccdm->bbmax[1]) ||
 						(aabbmin[2] > ccdm->bbmax[2]) ) {
-						/* boxes dont intersect */
+						/* boxes don't intersect */
 						BLI_ghashIterator_step(ihash);
 						continue;
 					}
 
 				}
-				else{
+				else {
 					/*aye that should be cached*/
-					printf("missing cache error \n");
+					printf("missing cache error\n");
 					BLI_ghashIterator_step(ihash);
 					continue;
 				}
@@ -1251,15 +1251,15 @@ static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],floa
 					}
 
 
-					if (mvert){
+					if (mvert) {
 
 						copy_v3_v3(nv1,mvert[mface->v1].co);
 						copy_v3_v3(nv2,mvert[mface->v2].co);
 						copy_v3_v3(nv3,mvert[mface->v3].co);
-						if (mface->v4){
+						if (mface->v4) {
 							copy_v3_v3(nv4,mvert[mface->v4].co);
 						}
-						if (mprevvert){
+						if (mprevvert) {
 							mul_v3_fl(nv1,time);
 							Vec3PlusStVec(nv1,(1.0f-time),mprevvert[mface->v1].co);
 
@@ -1269,7 +1269,7 @@ static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],floa
 							mul_v3_fl(nv3,time);
 							Vec3PlusStVec(nv3,(1.0f-time),mprevvert[mface->v3].co);
 
-							if (mface->v4){
+							if (mface->v4) {
 								mul_v3_fl(nv4,time);
 								Vec3PlusStVec(nv4,(1.0f-time),mprevvert[mface->v4].co);
 							}
@@ -1284,12 +1284,12 @@ static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],floa
 					if (
 						isect_line_tri_v3(nv1, nv2, face_v1, face_v2, face_v3, &t, NULL) ||
 						isect_line_tri_v3(nv2, nv3, face_v1, face_v2, face_v3, &t, NULL) ||
-						isect_line_tri_v3(nv3, nv1, face_v1, face_v2, face_v3, &t, NULL) ){
+						isect_line_tri_v3(nv3, nv1, face_v1, face_v2, face_v3, &t, NULL) ) {
 						Vec3PlusStVec(force,-0.5f,d_nvect);
 						*damp=tune*ob->pd->pdef_sbdamp;
 						deflected = 2;
 					}
-					if (mface->v4){ /* quad */
+					if (mface->v4) { /* quad */
 						/* switch origin to be nv4 */
 						sub_v3_v3v3(edge1, nv3, nv4);
 						sub_v3_v3v3(edge2, nv1, nv4);
@@ -1299,7 +1299,7 @@ static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],floa
 							/* isect_line_tri_v3(nv1, nv3, face_v1, face_v2, face_v3, &t, NULL) ||
 							 we did that edge already */
 							isect_line_tri_v3(nv3, nv4, face_v1, face_v2, face_v3, &t, NULL) ||
-							isect_line_tri_v3(nv4, nv1, face_v1, face_v2, face_v3, &t, NULL) ){
+							isect_line_tri_v3(nv4, nv1, face_v1, face_v2, face_v3, &t, NULL) ) {
 							Vec3PlusStVec(force,-0.5f,d_nvect);
 							*damp=tune*ob->pd->pdef_sbdamp;
 							deflected = 2;
@@ -1308,7 +1308,7 @@ static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],floa
 					mface++;
 					mima++;
 				}/* while a */
-			} /* if(ob->pd && ob->pd->deflect) */
+			} /* if (ob->pd && ob->pd->deflect) */
 			BLI_ghashIterator_step(ihash);
 	} /* while () */
 	BLI_ghashIterator_free(ihash);
@@ -1326,17 +1326,17 @@ static void scan_for_ext_face_forces(Object *ob,float timenow)
 	float tune = -10.0f;
 	float feedback[3];
 
-	if (sb && sb->scratch->totface){
+	if (sb && sb->scratch->totface) {
 
 
 		bf = sb->scratch->bodyface;
-		for(a=0; a<sb->scratch->totface; a++, bf++) {
+		for (a=0; a<sb->scratch->totface; a++, bf++) {
 			bf->ext_force[0]=bf->ext_force[1]=bf->ext_force[2]=0.0f;
 /*+++edges intruding*/
 			bf->flag &= ~BFF_INTERSECT;
 			feedback[0]=feedback[1]=feedback[2]=0.0f;
 			if (sb_detect_face_collisionCached(sb->bpoint[bf->v1].pos,sb->bpoint[bf->v2].pos, sb->bpoint[bf->v3].pos,
-				&damp,	feedback, ob->lay ,ob , timenow)){
+				&damp,	feedback, ob->lay ,ob , timenow)) {
 				Vec3PlusStVec(sb->bpoint[bf->v1].force,tune,feedback);
 				Vec3PlusStVec(sb->bpoint[bf->v2].force,tune,feedback);
 				Vec3PlusStVec(sb->bpoint[bf->v3].force,tune,feedback);
@@ -1347,7 +1347,7 @@ static void scan_for_ext_face_forces(Object *ob,float timenow)
 
 			feedback[0]=feedback[1]=feedback[2]=0.0f;
 			if ((bf->v4) && (sb_detect_face_collisionCached(sb->bpoint[bf->v1].pos,sb->bpoint[bf->v3].pos, sb->bpoint[bf->v4].pos,
-				&damp,	feedback, ob->lay ,ob , timenow))){
+				&damp,	feedback, ob->lay ,ob , timenow))) {
 				Vec3PlusStVec(sb->bpoint[bf->v1].force,tune,feedback);
 				Vec3PlusStVec(sb->bpoint[bf->v3].force,tune,feedback);
 				Vec3PlusStVec(sb->bpoint[bf->v4].force,tune,feedback);
@@ -1358,12 +1358,12 @@ static void scan_for_ext_face_forces(Object *ob,float timenow)
 /*---edges intruding*/
 
 /*+++ close vertices*/
-			if  (( bf->flag & BFF_INTERSECT)==0){
+			if (( bf->flag & BFF_INTERSECT)==0) {
 				bf->flag &= ~BFF_CLOSEVERT;
 				tune = -1.0f;
 				feedback[0]=feedback[1]=feedback[2]=0.0f;
 				if (sb_detect_face_pointCached(sb->bpoint[bf->v1].pos,sb->bpoint[bf->v2].pos, sb->bpoint[bf->v3].pos,
-					&damp,	feedback, ob->lay ,ob , timenow)){
+					&damp,	feedback, ob->lay ,ob , timenow)) {
 				Vec3PlusStVec(sb->bpoint[bf->v1].force,tune,feedback);
 				Vec3PlusStVec(sb->bpoint[bf->v2].force,tune,feedback);
 				Vec3PlusStVec(sb->bpoint[bf->v3].force,tune,feedback);
@@ -1374,7 +1374,7 @@ static void scan_for_ext_face_forces(Object *ob,float timenow)
 
 				feedback[0]=feedback[1]=feedback[2]=0.0f;
 				if ((bf->v4) && (sb_detect_face_pointCached(sb->bpoint[bf->v1].pos,sb->bpoint[bf->v3].pos, sb->bpoint[bf->v4].pos,
-					&damp,	feedback, ob->lay ,ob , timenow))){
+					&damp,	feedback, ob->lay ,ob , timenow))) {
 				Vec3PlusStVec(sb->bpoint[bf->v1].force,tune,feedback);
 				Vec3PlusStVec(sb->bpoint[bf->v3].force,tune,feedback);
 				Vec3PlusStVec(sb->bpoint[bf->v4].force,tune,feedback);
@@ -1386,13 +1386,13 @@ static void scan_for_ext_face_forces(Object *ob,float timenow)
 /*--- close vertices*/
 		}
 		bf = sb->scratch->bodyface;
-		for(a=0; a<sb->scratch->totface; a++, bf++) {
+		for (a=0; a<sb->scratch->totface; a++, bf++) {
 			if (( bf->flag & BFF_INTERSECT) || ( bf->flag & BFF_CLOSEVERT))
 			{
 				sb->bpoint[bf->v1].choke2=MAX2(sb->bpoint[bf->v1].choke2,choke);
 				sb->bpoint[bf->v2].choke2=MAX2(sb->bpoint[bf->v2].choke2,choke);
 				sb->bpoint[bf->v3].choke2=MAX2(sb->bpoint[bf->v3].choke2,choke);
-				if (bf->v4){
+				if (bf->v4) {
 				sb->bpoint[bf->v2].choke2=MAX2(sb->bpoint[bf->v2].choke2,choke);
 				}
 			}
@@ -1431,12 +1431,12 @@ static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],floa
 		ccd_Mesh *ccdm = BLI_ghashIterator_getValue	(ihash);
 		ob             = BLI_ghashIterator_getKey	(ihash);
 			/* only with deflecting set */
-			if(ob->pd && ob->pd->deflect) {
+			if (ob->pd && ob->pd->deflect) {
 				MFace *mface= NULL;
 				MVert *mvert= NULL;
 				MVert *mprevvert= NULL;
 				ccdf_minmax *mima= NULL;
-				if(ccdm){
+				if (ccdm) {
 					mface= ccdm->mface;
 					mvert= ccdm->mvert;
 					mprevvert= ccdm->mprevvert;
@@ -1449,15 +1449,15 @@ static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],floa
 						(aabbmin[0] > ccdm->bbmax[0]) ||
 						(aabbmin[1] > ccdm->bbmax[1]) ||
 						(aabbmin[2] > ccdm->bbmax[2]) ) {
-						/* boxes dont intersect */
+						/* boxes don't intersect */
 						BLI_ghashIterator_step(ihash);
 						continue;
 					}
 
 				}
-				else{
+				else {
 					/*aye that should be cached*/
-					printf("missing cache error \n");
+					printf("missing cache error\n");
 					BLI_ghashIterator_step(ihash);
 					continue;
 				}
@@ -1479,15 +1479,15 @@ static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],floa
 					}
 
 
-					if (mvert){
+					if (mvert) {
 
 						copy_v3_v3(nv1,mvert[mface->v1].co);
 						copy_v3_v3(nv2,mvert[mface->v2].co);
 						copy_v3_v3(nv3,mvert[mface->v3].co);
-						if (mface->v4){
+						if (mface->v4) {
 							copy_v3_v3(nv4,mvert[mface->v4].co);
 						}
-						if (mprevvert){
+						if (mprevvert) {
 							mul_v3_fl(nv1,time);
 							Vec3PlusStVec(nv1,(1.0f-time),mprevvert[mface->v1].co);
 
@@ -1497,7 +1497,7 @@ static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],floa
 							mul_v3_fl(nv3,time);
 							Vec3PlusStVec(nv3,(1.0f-time),mprevvert[mface->v3].co);
 
-							if (mface->v4){
+							if (mface->v4) {
 								mul_v3_fl(nv4,time);
 								Vec3PlusStVec(nv4,(1.0f-time),mprevvert[mface->v4].co);
 							}
@@ -1510,7 +1510,7 @@ static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],floa
 
 					cross_v3_v3v3(d_nvect, edge2, edge1);
 					normalize_v3(d_nvect);
-					if ( isect_line_tri_v3(edge_v1, edge_v2, nv1, nv2, nv3, &t, NULL)){
+					if ( isect_line_tri_v3(edge_v1, edge_v2, nv1, nv2, nv3, &t, NULL)) {
 						float v1[3],v2[3];
 						float intrusiondepth,i1,i2;
 						sub_v3_v3v3(v1, edge_v1, nv2);
@@ -1522,14 +1522,14 @@ static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],floa
 						*damp=ob->pd->pdef_sbdamp;
 						deflected = 2;
 					}
-					if (mface->v4){ /* quad */
+					if (mface->v4) { /* quad */
 						/* switch origin to be nv4 */
 						sub_v3_v3v3(edge1, nv3, nv4);
 						sub_v3_v3v3(edge2, nv1, nv4);
 
 						cross_v3_v3v3(d_nvect, edge2, edge1);
 						normalize_v3(d_nvect);
-						if (isect_line_tri_v3( edge_v1, edge_v2,nv1, nv3, nv4, &t, NULL)){
+						if (isect_line_tri_v3( edge_v1, edge_v2,nv1, nv3, nv4, &t, NULL)) {
 							float v1[3],v2[3];
 							float intrusiondepth,i1,i2;
 							sub_v3_v3v3(v1, edge_v1, nv4);
@@ -1547,7 +1547,7 @@ static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],floa
 					mface++;
 					mima++;
 				}/* while a */
-			} /* if(ob->pd && ob->pd->deflect) */
+			} /* if (ob->pd && ob->pd->deflect) */
 			BLI_ghashIterator_step(ihash);
 	} /* while () */
 	BLI_ghashIterator_free(ihash);
@@ -1561,18 +1561,18 @@ static void _scan_for_ext_spring_forces(Scene *scene, Object *ob, float timenow,
 	float damp;
 	float feedback[3];
 
-	if (sb && sb->totspring){
-		for(a=ifirst; a<ilast; a++) {
+	if (sb && sb->totspring) {
+		for (a=ifirst; a<ilast; a++) {
 			BodySpring *bs = &sb->bspring[a];
 			bs->ext_force[0]=bs->ext_force[1]=bs->ext_force[2]=0.0f;
 			feedback[0]=feedback[1]=feedback[2]=0.0f;
 			bs->flag &= ~BSF_INTERSECT;
 
-			if (bs->springtype == SB_EDGE){
+			if (bs->springtype == SB_EDGE) {
 				/* +++ springs colliding */
-				if (ob->softflag & OB_SB_EDGECOLL){
+				if (ob->softflag & OB_SB_EDGECOLL) {
 					if ( sb_detect_edge_collisionCached (sb->bpoint[bs->v1].pos , sb->bpoint[bs->v2].pos,
-						&damp,feedback,ob->lay,ob,timenow)){
+						&damp,feedback,ob->lay,ob,timenow)) {
 							add_v3_v3(bs->ext_force, feedback);
 							bs->flag |= BSF_INTERSECT;
 							//bs->cf=damp;
@@ -1584,11 +1584,11 @@ static void _scan_for_ext_spring_forces(Scene *scene, Object *ob, float timenow,
 
 				/* +++ springs seeing wind ... n stuff depending on their orientation*/
 				/* note we don't use sb->mediafrict but use sb->aeroedge for magnitude of effect*/
-				if(sb->aeroedge){
+				if (sb->aeroedge) {
 					float vel[3],sp[3],pr[3],force[3];
 					float f,windfactor  = 0.25f;
 					/*see if we have wind*/
-					if(do_effector) {
+					if (do_effector) {
 						EffectedPoint epoint;
 						float speed[3]={0.0f,0.0f,0.0f};
 						float pos[3];
@@ -1601,23 +1601,23 @@ static void _scan_for_ext_spring_forces(Scene *scene, Object *ob, float timenow,
 						add_v3_v3(vel, speed);
 					}
 					/* media in rest */
-					else{
+					else {
 						add_v3_v3v3(vel, sb->bpoint[bs->v1].vec , sb->bpoint[bs->v2].vec);
 					}
 					f = normalize_v3(vel);
 					f = -0.0001f*f*f*sb->aeroedge;
-					/* (todo) add a nice angle dependant function done for now BUT */
+					/* (todo) add a nice angle dependent function done for now BUT */
 					/* still there could be some nice drag/lift function, but who needs it */
 
 					sub_v3_v3v3(sp, sb->bpoint[bs->v1].pos , sb->bpoint[bs->v2].pos);
 					project_v3_v3v3(pr,vel,sp);
 					sub_v3_v3(vel, pr);
 					normalize_v3(vel);
-					if (ob->softflag & OB_SB_AERO_ANGLE){
+					if (ob->softflag & OB_SB_AERO_ANGLE) {
 						normalize_v3(sp);
 						Vec3PlusStVec(bs->ext_force,f*(1.0f-ABS(dot_v3v3(vel,sp))),vel);
 					}
-					else{
+					else {
 						Vec3PlusStVec(bs->ext_force,f,vel); // to keep compatible with 2.45 release files
 					}
 				}
@@ -1656,7 +1656,7 @@ static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow,
 	do_effector= pdInitEffectors(scene, ob, NULL, ob->soft->effector_weights);
 
 	/* figure the number of threads while preventing pretty pointless threading overhead */
-	if(scene->r.mode & R_FIXED_THREADS)
+	if (scene->r.mode & R_FIXED_THREADS)
 		totthread= scene->r.threads;
 	else
 		totthread= BLI_system_thread_count();
@@ -1669,14 +1669,14 @@ static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow,
 	memset(sb_threads, 0, sizeof(SB_thread_context)*totthread);
 	left = totsprings;
 	dec = totsprings/totthread +1;
-	for(i=0; i<totthread; i++) {
+	for (i=0; i<totthread; i++) {
 		sb_threads[i].scene = scene;
 		sb_threads[i].ob = ob;
 		sb_threads[i].forcetime = 0.0; // not used here
 		sb_threads[i].timenow = timenow;
 		sb_threads[i].ilast   = left;
 		left = left - dec;
-		if (left >0){
+		if (left >0) {
 			sb_threads[i].ifirst  = left;
 		}
 		else
@@ -1688,10 +1688,10 @@ static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow,
 		sb_threads[i].nr= i;
 		sb_threads[i].tot= totthread;
 	}
-	if(totthread > 1) {
+	if (totthread > 1) {
 		BLI_init_threads(&threads, exec_scan_for_ext_spring_forces, totthread);
 
-		for(i=0; i<totthread; i++)
+		for (i=0; i<totthread; i++)
 			BLI_insert_thread(&threads, &sb_threads[i]);
 
 		BLI_end_threads(&threads);
@@ -1714,17 +1714,17 @@ static int choose_winner(float*w, float* pos,float*a,float*b,float*c,float*ca,fl
 	mindist = ABS(dot_v3v3(pos,a));
 
 	cp = ABS(dot_v3v3(pos,b));
-	if ( mindist < cp ){
+	if ( mindist < cp ) {
 		mindist = cp;
 		winner =2;
 	}
 
 	cp = ABS(dot_v3v3(pos,c));
-	if (mindist < cp ){
+	if (mindist < cp ) {
 		mindist = cp;
 		winner =3;
 	}
-	switch (winner){
+	switch (winner) {
 		case 1: copy_v3_v3(w,ca); break;
 		case 2: copy_v3_v3(w,cb); break;
 		case 3: copy_v3_v3(w,cc);
@@ -1760,26 +1760,26 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
 		ccd_Mesh *ccdm = BLI_ghashIterator_getValue	(ihash);
 		ob             = BLI_ghashIterator_getKey	(ihash);
 			/* only with deflecting set */
-			if(ob->pd && ob->pd->deflect) {
+			if (ob->pd && ob->pd->deflect) {
 				MFace *mface= NULL;
 				MVert *mvert= NULL;
 				MVert *mprevvert= NULL;
 				ccdf_minmax *mima= NULL;
 
-				if(ccdm){
+				if (ccdm) {
 					mface= ccdm->mface;
 					mvert= ccdm->mvert;
 					mprevvert= ccdm->mprevvert;
 					mima= ccdm->mima;
 					a = ccdm->totface;
 
-					minx =ccdm->bbmin[0];
-					miny =ccdm->bbmin[1];
-					minz =ccdm->bbmin[2];
+					minx = ccdm->bbmin[0];
+					miny = ccdm->bbmin[1];
+					minz = ccdm->bbmin[2];
 
-					maxx =ccdm->bbmax[0];
-					maxy =ccdm->bbmax[1];
-					maxz =ccdm->bbmax[2];
+					maxx = ccdm->bbmax[0];
+					maxy = ccdm->bbmax[1];
+					maxz = ccdm->bbmax[2];
 
 					if ((opco[0] < minx) ||
 						(opco[1] < miny) ||
@@ -1792,17 +1792,17 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
 							continue;
 					}
 				}
-				else{
+				else {
 					/*aye that should be cached*/
-					printf("missing cache error \n");
+					printf("missing cache error\n");
 						BLI_ghashIterator_step(ihash);
 					continue;
 				}
 
 				/* do object level stuff */
 				/* need to have user control for that since it depends on model scale */
-				innerfacethickness =-ob->pd->pdef_sbift;
-				outerfacethickness =ob->pd->pdef_sboft;
+				innerfacethickness = -ob->pd->pdef_sbift;
+				outerfacethickness =  ob->pd->pdef_sboft;
 				fa = (ff*outerfacethickness-outerfacethickness);
 				fa *= fa;
 				fa = 1.0f/fa;
@@ -1822,16 +1822,16 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
 							continue;
 					}
 
-					if (mvert){
+					if (mvert) {
 
 						copy_v3_v3(nv1,mvert[mface->v1].co);
 						copy_v3_v3(nv2,mvert[mface->v2].co);
 						copy_v3_v3(nv3,mvert[mface->v3].co);
-						if (mface->v4){
+						if (mface->v4) {
 							copy_v3_v3(nv4,mvert[mface->v4].co);
 						}
 
-						if (mprevvert){
+						if (mprevvert) {
 							/* grab the average speed of the collider vertices
 							before we spoil nvX
 							humm could be done once a SB steps but then we' need to store that too
@@ -1841,7 +1841,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
 							sub_v3_v3v3(vv1,nv1,mprevvert[mface->v1].co);
 							sub_v3_v3v3(vv2,nv2,mprevvert[mface->v2].co);
 							sub_v3_v3v3(vv3,nv3,mprevvert[mface->v3].co);
-							if (mface->v4){
+							if (mface->v4) {
 								sub_v3_v3v3(vv4,nv4,mprevvert[mface->v4].co);
 							}
 
@@ -1854,7 +1854,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
 							mul_v3_fl(nv3,time);
 							Vec3PlusStVec(nv3,(1.0f-time),mprevvert[mface->v3].co);
 
-							if (mface->v4){
+							if (mface->v4) {
 								mul_v3_fl(nv4,time);
 								Vec3PlusStVec(nv4,(1.0f-time),mprevvert[mface->v4].co);
 							}
@@ -1872,13 +1872,13 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
 					// so rules are
 					//
 
-					if ((facedist > innerfacethickness) && (facedist < outerfacethickness)){
-						if (isect_point_tri_prism_v3(opco, nv1, nv2, nv3) ){
+					if ((facedist > innerfacethickness) && (facedist < outerfacethickness)) {
+						if (isect_point_tri_prism_v3(opco, nv1, nv2, nv3) ) {
 							force_mag_norm =(float)exp(-ee*facedist);
 							if (facedist > outerfacethickness*ff)
 								force_mag_norm =(float)force_mag_norm*fa*(facedist - outerfacethickness)*(facedist - outerfacethickness);
 							*damp=ob->pd->pdef_sbdamp;
-							if (facedist > 0.0f){
+							if (facedist > 0.0f) {
 								*damp *= (1.0f - facedist/outerfacethickness);
 								Vec3PlusStVec(outerforceaccu,force_mag_norm,d_nvect);
 								deflected = 3;
@@ -1888,7 +1888,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
 								Vec3PlusStVec(innerforceaccu,force_mag_norm,d_nvect);
 								if (deflected < 2) deflected = 2;
 							}
-							if ((mprevvert) && (*damp > 0.0f)){
+							if ((mprevvert) && (*damp > 0.0f)) {
 								choose_winner(ve,opco,nv1,nv2,nv3,vv1,vv2,vv3);
 								add_v3_v3(avel, ve);
 								cavel ++;
@@ -1897,7 +1897,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
 							ci++;
 						}
 					}
-					if (mface->v4){ /* quad */
+					if (mface->v4) { /* quad */
 						/* switch origin to be nv4 */
 						sub_v3_v3v3(edge1, nv3, nv4);
 						sub_v3_v3v3(edge2, nv1, nv4);
@@ -1907,13 +1907,13 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
 						/* n_mag = */ /* UNUSED */ normalize_v3(d_nvect);
 						facedist = dot_v3v3(dv1,d_nvect);
 
-						if ((facedist > innerfacethickness) && (facedist < outerfacethickness)){
-							if (isect_point_tri_prism_v3(opco, nv1, nv3, nv4) ){
+						if ((facedist > innerfacethickness) && (facedist < outerfacethickness)) {
+							if (isect_point_tri_prism_v3(opco, nv1, nv3, nv4) ) {
 								force_mag_norm =(float)exp(-ee*facedist);
 								if (facedist > outerfacethickness*ff)
 									force_mag_norm =(float)force_mag_norm*fa*(facedist - outerfacethickness)*(facedist - outerfacethickness);
 								*damp=ob->pd->pdef_sbdamp;
-							if (facedist > 0.0f){
+							if (facedist > 0.0f) {
 								*damp *= (1.0f - facedist/outerfacethickness);
 								Vec3PlusStVec(outerforceaccu,force_mag_norm,d_nvect);
 								deflected = 3;
@@ -1924,7 +1924,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
 								if (deflected < 2) deflected = 2;
 							}
 
-								if ((mprevvert) && (*damp > 0.0f)){
+								if ((mprevvert) && (*damp > 0.0f)) {
 									choose_winner(ve,opco,nv1,nv3,nv4,vv1,vv3,vv4);
 									add_v3_v3(avel, ve);
 									cavel ++;
@@ -1941,7 +1941,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
 							closest_to_line_segment_v3(ve, opco, nv1, nv2);
 							 sub_v3_v3v3(ve,opco,ve);
 							dist = normalize_v3(ve);
-							if ((dist < outerfacethickness)&&(dist < mindistedge )){
+							if ((dist < outerfacethickness)&&(dist < mindistedge )) {
 								copy_v3_v3(coledge,ve);
 								mindistedge = dist,
 								deflected=1;
@@ -1950,7 +1950,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
 							closest_to_line_segment_v3(ve, opco, nv2, nv3);
 							 sub_v3_v3v3(ve,opco,ve);
 							dist = normalize_v3(ve);
-							if ((dist < outerfacethickness)&&(dist < mindistedge )){
+							if ((dist < outerfacethickness)&&(dist < mindistedge )) {
 								copy_v3_v3(coledge,ve);
 								mindistedge = dist,
 								deflected=1;
@@ -1959,16 +1959,16 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
 							closest_to_line_segment_v3(ve, opco, nv3, nv1);
 							 sub_v3_v3v3(ve,opco,ve);
 							dist = normalize_v3(ve);
-							if ((dist < outerfacethickness)&&(dist < mindistedge )){
+							if ((dist < outerfacethickness)&&(dist < mindistedge )) {
 								copy_v3_v3(coledge,ve);
 								mindistedge = dist,
 								deflected=1;
 							}
-							if (mface->v4){ /* quad */
+							if (mface->v4) { /* quad */
 								closest_to_line_segment_v3(ve, opco, nv3, nv4);
 								sub_v3_v3v3(ve,opco,ve);
 								dist = normalize_v3(ve);
-								if ((dist < outerfacethickness)&&(dist < mindistedge )){
+								if ((dist < outerfacethickness)&&(dist < mindistedge )) {
 									copy_v3_v3(coledge,ve);
 									mindistedge = dist,
 										deflected=1;
@@ -1977,7 +1977,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
 								closest_to_line_segment_v3(ve, opco, nv1, nv4);
 								sub_v3_v3v3(ve,opco,ve);
 								dist = normalize_v3(ve);
-								if ((dist < outerfacethickness)&&(dist < mindistedge )){
+								if ((dist < outerfacethickness)&&(dist < mindistedge )) {
 									copy_v3_v3(coledge,ve);
 									mindistedge = dist,
 										deflected=1;
@@ -1991,25 +1991,25 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
 					mface++;
 					mima++;
 				}/* while a */
-			} /* if(ob->pd && ob->pd->deflect) */
+			} /* if (ob->pd && ob->pd->deflect) */
 			BLI_ghashIterator_step(ihash);
 	} /* while () */
 
-	if (deflected == 1){ // no face but 'outer' edge cylinder sees vert
+	if (deflected == 1) { // no face but 'outer' edge cylinder sees vert
 		force_mag_norm =(float)exp(-ee*mindistedge);
 		if (mindistedge > outerfacethickness*ff)
 			force_mag_norm =(float)force_mag_norm*fa*(mindistedge - outerfacethickness)*(mindistedge - outerfacethickness);
 		Vec3PlusStVec(force,force_mag_norm,coledge);
 		*damp=ob->pd->pdef_sbdamp;
-		if (mindistedge > 0.0f){
+		if (mindistedge > 0.0f) {
 			*damp *= (1.0f - mindistedge/outerfacethickness);
 		}
 
 	}
-	if (deflected == 2){ //  face inner detected
+	if (deflected == 2) { //  face inner detected
 		add_v3_v3(force, innerforceaccu);
 	}
-	if (deflected == 3){ //  face outer detected
+	if (deflected == 3) { //  face outer detected
 		add_v3_v3(force, outerforceaccu);
 	}
 
@@ -2017,7 +2017,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
 	if (cavel) mul_v3_fl(avel,1.0f/(float)cavel);
 	copy_v3_v3(vel,avel);
 	if (ci) *intrusion /= ci;
-	if (deflected){
+	if (deflected) {
 		normalize_v3_v3(facenormal, force);
 	}
 	return deflected;
@@ -2040,17 +2040,17 @@ static void dfdx_spring(int ia, int ic, int op, float dir[3],float L,float len,f
 {
 	float m,delta_ij;
 	int i ,j;
-	if (L < len){
-		for(i=0;i<3;i++)
-			for(j=0;j<3;j++){
+	if (L < len) {
+		for (i=0;i<3;i++)
+			for (j=0;j<3;j++) {
 				delta_ij = (i==j ? (1.0f): (0.0f));
 				m=factor*(dir[i]*dir[j] + (1-L/len)*(delta_ij - dir[i]*dir[j]));
 				nlMatrixAdd(ia+i,op+ic+j,m);
 			}
 	}
-	else{
-		for(i=0;i<3;i++)
-			for(j=0;j<3;j++){
+	else {
+		for (i=0;i<3;i++)
+			for (j=0;j<3;j++) {
 				m=factor*dir[i]*dir[j];
 				nlMatrixAdd(ia+i,op+ic+j,m);
 			}
@@ -2061,13 +2061,13 @@ static void dfdx_spring(int ia, int ic, int op, float dir[3],float L,float len,f
 static void dfdx_goal(int ia, int ic, int op, float factor)
 {
 	int i;
-	for(i=0;i<3;i++) nlMatrixAdd(ia+i,op+ic+i,factor);
+	for (i=0;i<3;i++) nlMatrixAdd(ia+i,op+ic+i,factor);
 }
 
 static void dfdv_goal(int ia, int ic,float factor)
 {
 	int i;
-	for(i=0;i<3;i++) nlMatrixAdd(ia+i,ic+i,factor);
+	for (i=0;i<3;i++) nlMatrixAdd(ia+i,ic+i,factor);
 }
 */
 static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UNUSED(forcetime), int nl_flags)
@@ -2081,7 +2081,7 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UN
 	int ia,ic;
 #endif
 	/* prepare depending on which side of the spring we are on */
-	if (bpi == bs->v1){
+	if (bpi == bs->v1) {
 		bp1 = &sb->bpoint[bs->v1];
 		bp2 = &sb->bpoint[bs->v2];
 #if 0	/* UNUSED */
@@ -2089,7 +2089,7 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UN
 		ic =3*bs->v2;
 #endif
 	}
-	else if (bpi == bs->v2){
+	else if (bpi == bs->v2) {
 		bp1 = &sb->bpoint[bs->v2];
 		bp2 = &sb->bpoint[bs->v1];
 #if 0	/* UNUSED */
@@ -2097,7 +2097,7 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UN
 		ic =3*bs->v1;
 #endif
 	}
-	else{
+	else {
 		/* TODO make this debug option */
 		/**/
 		printf("bodypoint <bpi> is not attached to spring  <*bs> --> sb_spring_force()\n");
@@ -2112,14 +2112,14 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UN
 	else
 		iks  = 1.0f/(1.0f-sb->inpush)-1.0f ;/* inner spring constants function */
 
-	if(bs->len > 0.0f) /* check for degenerated springs */
+	if (bs->len > 0.0f) /* check for degenerated springs */
 		forcefactor = iks/bs->len;
 	else
 		forcefactor = iks;
 	kw = (bp1->springweight+bp2->springweight)/2.0f;
 	kw = kw * kw;
 	kw = kw * kw;
-	switch (bs->springtype){
+	switch (bs->springtype) {
 		case SB_EDGE:
 		case SB_HANDLE:
 			forcefactor *=  kw;
@@ -2146,7 +2146,7 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UN
 	Vec3PlusStVec(bp1->force,-kd,dir);
 
 	/* do jacobian stuff if needed */
-	if(nl_flags & NLF_BUILD){
+	if (nl_flags & NLF_BUILD) {
 		//int op =3*sb->totpoint;
 		//float mvel = -forcetime*kd;
 		//float mpos = -forcetime*forcefactor;
@@ -2154,7 +2154,7 @@ static void sb_spring_force(Object *ob,int bpi,BodySpring *bs,float iks,float UN
 		// dfdx_spring(ia,ia,op,dir,bs->len,distance,-mpos);
 		/* depending on my vel */
 		// dfdv_goal(ia,ia,mvel); // well that ignores geometie
-		if(bp2->goal < SOFTGOALSNAP){ /* ommit this bp when it snaps */
+		if (bp2->goal < SOFTGOALSNAP) { /* ommit this bp when it snaps */
 			/* depending on other pos */
 			// dfdx_spring(ia,ic,op,dir,bs->len,distance,mpos);
 			/* depending on other vel */
@@ -2185,12 +2185,12 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
 	/* --- could be done on object level to squeeze out the last bits of it */
 	}
 	else {
-		printf("Error expected a SB here \n");
+		printf("Error expected a SB here\n");
 		return (999);
 	}
 
 /* debugerin */
-	if  (sb->totpoint < ifirst) {
+	if (sb->totpoint < ifirst) {
 		printf("Aye 998");
 		return (998);
 	}
@@ -2198,12 +2198,12 @@ 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++) {
+	for (bb=number_of_points_here; bb>0; bb--, bp++) {
 		/* clear forces  accumulator */
 		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){
+		if (do_selfcollision) {
 			int attached;
 			BodyPoint   *obp;
 			BodySpring *bs;
@@ -2213,24 +2213,24 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
 			float compare;
 			float bstune = sb->ballstiff;
 
-			for(c=sb->totpoint, obp= sb->bpoint; c>=ifirst+bb; c--, obp++) {
+			for (c=sb->totpoint, obp= sb->bpoint; c>=ifirst+bb; c--, obp++) {
 				compare = (obp->colball + bp->colball);
 				sub_v3_v3v3(def, bp->pos, obp->pos);
 				/* rather check the AABBoxes before ever calulating the real distance */
-				/* mathematically it is completly nuts, but performace is pretty much (3) times faster */
+				/* mathematically it is completly nuts, but performance is pretty much (3) times faster */
 				if ((ABS(def[0]) > compare) || (ABS(def[1]) > compare) || (ABS(def[2]) > compare)) continue;
 				distance = normalize_v3(def);
-				if (distance < compare ){
+				if (distance < compare ) {
 					/* exclude body points attached with a spring */
 					attached = 0;
-					for(b=obp->nofsprings;b>0;b--){
+					for (b=obp->nofsprings;b>0;b--) {
 						bs = sb->bspring + obp->springs[b-1];
-						if (( ilast-bb == bs->v2)  || ( ilast-bb == bs->v1)){
+						if (( ilast-bb == bs->v2)  || ( ilast-bb == bs->v1)) {
 							attached=1;
 							continue;}
 					}
-					if (!attached){
-						float f = bstune/(distance) + bstune/(compare*compare)*distance - 2.0f*bstune/compare ;
+					if (!attached) {
+						float f = bstune / (distance) + bstune / (compare * compare) * distance - 2.0f * bstune / compare;
 
 						mid_v3_v3v3(velcenter, bp->vec, obp->vec);
 						sub_v3_v3v3(dvel,velcenter,bp->vec);
@@ -2251,23 +2251,23 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
 		}
 		/* naive ball self collision done */
 
-		if(_final_goal(ob,bp) < SOFTGOALSNAP){ /* ommit this bp when it snaps */
+		if (_final_goal(ob,bp) < SOFTGOALSNAP) { /* ommit this bp when it snaps */
 			float auxvect[3];
 			float velgoal[3];
 
 			/* do goal stuff */
-			if(ob->softflag & OB_SB_GOAL) {
+			if (ob->softflag & OB_SB_GOAL) {
 				/* true elastic goal */
 				float ks,kd;
 				sub_v3_v3v3(auxvect,bp->pos,bp->origT);
-				ks  = 1.0f/(1.0f- _final_goal(ob,bp)*sb->goalspring)-1.0f ;
+				ks  = 1.0f / (1.0f - _final_goal(ob, bp) * sb->goalspring) - 1.0f;
 				bp->force[0]+= -ks*(auxvect[0]);
 				bp->force[1]+= -ks*(auxvect[1]);
 				bp->force[2]+= -ks*(auxvect[2]);
 
 				/* calulate damping forces generated by goals*/
 				sub_v3_v3v3(velgoal,bp->origS, bp->origE);
-				kd =  sb->goalfrict * sb_fric_force_scale(ob) ;
+				kd =  sb->goalfrict * sb_fric_force_scale(ob);
 				add_v3_v3v3(auxvect,velgoal,bp->vec);
 
 				if (forcetime > 0.0f) { /* make sure friction does not become rocket motor on time reversal */
@@ -2284,7 +2284,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
 			/* done goal stuff */
 
 			/* gravitation */
-			if (sb && scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY){
+			if (sb && scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) {
 				float gravity[3];
 				copy_v3_v3(gravity, scene->physics_settings.gravity);
 				mul_v3_fl(gravity, sb_grav_force_scale(ob)*_final_mass(ob,bp)*sb->effector_weights->global_gravity); /* individual mass of node here */
@@ -2292,7 +2292,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
 			}
 
 			/* particle field & vortex */
-			if(do_effector) {
+			if (do_effector) {
 				EffectedPoint epoint;
 				float kd;
 				float force[3]= {0.0f, 0.0f, 0.0f};
@@ -2326,12 +2326,12 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
 			bp->choke = 0.0f;
 			bp->choke2 = 0.0f;
 			bp->loc_flag &= ~SBF_DOFUZZY;
-			if(do_deflector && !(bp->loc_flag & SBF_OUTOFCOLLISION) ) {
+			if (do_deflector && !(bp->loc_flag & SBF_OUTOFCOLLISION) ) {
 				float cfforce[3],defforce[3] ={0.0f,0.0f,0.0f}, vel[3] = {0.0f,0.0f,0.0f}, facenormal[3], cf = 1.0f,intrusion;
 				float kd = 1.0f;
 
-				if (sb_deflect_face(ob,bp->pos,facenormal,defforce,&cf,timenow,vel,&intrusion)){
-						if (intrusion < 0.0f){
+				if (sb_deflect_face(ob,bp->pos,facenormal,defforce,&cf,timenow,vel,&intrusion)) {
+						if (intrusion < 0.0f) {
 							sb->scratch->flag |= SBF_DOFUZZY;
 							bp->loc_flag |= SBF_DOFUZZY;
 							bp->choke = sb->choke*0.01f;
@@ -2348,13 +2348,13 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
 
 			/* +++springs */
 			iks  = 1.0f/(1.0f-sb->inspring)-1.0f ;/* inner spring constants function */
-			if(ob->softflag & OB_SB_EDGES) {
-				if (sb->bspring){ /* spring list exists at all ? */
+			if (ob->softflag & OB_SB_EDGES) {
+				if (sb->bspring) { /* spring list exists at all ? */
 					int b;
 					BodySpring *bs;
-					for(b=bp->nofsprings;b>0;b--){
+					for (b=bp->nofsprings;b>0;b--) {
 						bs = sb->bspring + bp->springs[b-1];
-						if (do_springcollision || do_aero){
+						if (do_springcollision || do_aero) {
 							add_v3_v3(bp->force, bs->ext_force);
 							if (bs->flag & BSF_INTERSECT)
 								bp->choke = bs->cf;
@@ -2386,7 +2386,7 @@ static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float t
 	int lowpoints =100; /* wild guess .. may increase with better thread management 'above' or even be UI option sb->spawn_cf_threads_nopts */
 
 	/* figure the number of threads while preventing pretty pointless threading overhead */
-	if(scene->r.mode & R_FIXED_THREADS)
+	if (scene->r.mode & R_FIXED_THREADS)
 		totthread= scene->r.threads;
 	else
 		totthread= BLI_system_thread_count();
@@ -2395,20 +2395,20 @@ static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float t
 		totthread--;
 	}
 
-	/* printf("sb_cf_threads_run spawning %d threads \n",totthread); */
+	/* printf("sb_cf_threads_run spawning %d threads\n",totthread); */
 
 	sb_threads= MEM_callocN(sizeof(SB_thread_context)*totthread, "SBThread");
 	memset(sb_threads, 0, sizeof(SB_thread_context)*totthread);
 	left = totpoint;
 	dec = totpoint/totthread +1;
-	for(i=0; i<totthread; i++) {
+	for (i=0; i<totthread; i++) {
 		sb_threads[i].scene = scene;
 		sb_threads[i].ob = ob;
 		sb_threads[i].forcetime = forcetime;
 		sb_threads[i].timenow = timenow;
 		sb_threads[i].ilast   = left;
 		left = left - dec;
-		if (left >0){
+		if (left >0) {
 			sb_threads[i].ifirst  = left;
 		}
 		else
@@ -2422,10 +2422,10 @@ static void sb_cf_threads_run(Scene *scene, Object *ob, float forcetime, float t
 	}
 
 
-	if(totthread > 1) {
+	if (totthread > 1) {
 		BLI_init_threads(&threads, exec_softbody_calc_forces, totthread);
 
-		for(i=0; i<totthread; i++)
+		for (i=0; i<totthread; i++)
 			BLI_insert_thread(&threads, &sb_threads[i]);
 
 		BLI_end_threads(&threads);
@@ -2486,11 +2486,11 @@ static void softbody_calc_forcesEx(Scene *scene, Object *ob, float forcetime, fl
 static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, float timenow, int nl_flags)
 {
 	/* redirection to the new threaded Version */
-	if (!(G.rt & 0x10)){ // 16
+	if (!(G.rt & 0x10)) { // 16
 		softbody_calc_forcesEx(scene, ob, forcetime, timenow, nl_flags);
 		return;
 	}
-	else{
+	else {
 		/* so the following will die  */
 		/* |||||||||||||||||||||||||| */
 		/* VVVVVVVVVVVVVVVVVVVVVVVVVV */
@@ -2516,14 +2516,14 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
 		/* jacobian
 		NLboolean success;
 
-		if(nl_flags){
+		if (nl_flags) {
 		nlBegin(NL_SYSTEM);
 		nlBegin(NL_MATRIX);
 		}
 		*/
 
 
-		if (scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY){
+		if (scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) {
 			copy_v3_v3(gravity, scene->physics_settings.gravity);
 			mul_v3_fl(gravity, sb_grav_force_scale(ob)*sb->effector_weights->global_gravity);
 		}
@@ -2546,10 +2546,10 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
 			do_deflector = sb_detect_aabb_collisionCached(defforce,ob->lay,ob,timenow);
 		}
 
-		for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
+		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;
-			if(nl_flags & NLF_BUILD){
+			if (nl_flags & NLF_BUILD) {
 				//int ia =3*(sb->totpoint-a);
 				//int op =3*sb->totpoint;
 				/* dF/dV = v */
@@ -2572,7 +2572,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
 
 			/* naive ball self collision */
 			/* needs to be done if goal snaps or not */
-			if(do_selfcollision){
+			if (do_selfcollision) {
 				int attached;
 				BodyPoint   *obp;
 				int c,b;
@@ -2580,7 +2580,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
 				float distance;
 				float compare;
 
-				for(c=sb->totpoint, obp= sb->bpoint; c>=a; c--, obp++) {
+				for (c=sb->totpoint, obp= sb->bpoint; c>=a; c--, obp++) {
 
 					//if ((bp->octantflag & obp->octantflag) == 0) continue;
 
@@ -2588,21 +2588,21 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
 					sub_v3_v3v3(def, bp->pos, obp->pos);
 
 					/* rather check the AABBoxes before ever calulating the real distance */
-					/* mathematically it is completly nuts, but performace is pretty much (3) times faster */
+					/* mathematically it is completly nuts, but performance is pretty much (3) times faster */
 					if ((ABS(def[0]) > compare) || (ABS(def[1]) > compare) || (ABS(def[2]) > compare)) continue;
 
 					distance = normalize_v3(def);
-					if (distance < compare ){
+					if (distance < compare ) {
 						/* exclude body points attached with a spring */
 						attached = 0;
-						for(b=obp->nofsprings;b>0;b--){
+						for (b=obp->nofsprings;b>0;b--) {
 							bs = sb->bspring + obp->springs[b-1];
-							if (( sb->totpoint-a == bs->v2)  || ( sb->totpoint-a == bs->v1)){
+							if (( sb->totpoint-a == bs->v2)  || ( sb->totpoint-a == bs->v1)) {
 								attached=1;
 								continue;}
 						}
-						if (!attached){
-							float f = tune/(distance) + tune/(compare*compare)*distance - 2.0f*tune/compare ;
+						if (!attached) {
+							float f = tune / (distance) + tune / (compare * compare) * distance - 2.0f * tune/compare;
 
 							mid_v3_v3v3(velcenter, bp->vec, obp->vec);
 							sub_v3_v3v3(dvel,velcenter,bp->vec);
@@ -2611,7 +2611,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
 							Vec3PlusStVec(bp->force,f*(1.0f-sb->balldamp),def);
 							Vec3PlusStVec(bp->force,sb->balldamp,dvel);
 
-							if(nl_flags & NLF_BUILD){
+							if (nl_flags & NLF_BUILD) {
 								//int ia =3*(sb->totpoint-a);
 								//int ic =3*(sb->totpoint-c);
 								//int op =3*sb->totpoint;
@@ -2649,20 +2649,20 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
 			}
 			/* naive ball self collision done */
 
-			if(_final_goal(ob,bp) < SOFTGOALSNAP){ /* ommit this bp when it snaps */
+			if (_final_goal(ob,bp) < SOFTGOALSNAP) { /* ommit this bp when it snaps */
 				float auxvect[3];
 				float velgoal[3];
 
 				/* do goal stuff */
-				if(ob->softflag & OB_SB_GOAL) {
+				if (ob->softflag & OB_SB_GOAL) {
 					/* true elastic goal */
 					sub_v3_v3v3(auxvect,bp->pos,bp->origT);
-					ks  = 1.0f/(1.0f- _final_goal(ob,bp)*sb->goalspring)-1.0f ;
+					ks  = 1.0f / (1.0f- _final_goal(ob, bp) * sb->goalspring) - 1.0f;
 					bp->force[0]+= -ks*(auxvect[0]);
 					bp->force[1]+= -ks*(auxvect[1]);
 					bp->force[2]+= -ks*(auxvect[2]);
 
-					if(nl_flags & NLF_BUILD){
+					if (nl_flags & NLF_BUILD) {
 						//int ia =3*(sb->totpoint-a);
 						//int op =3*(sb->totpoint);
 						/* depending on my pos */
@@ -2672,14 +2672,14 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
 
 					/* calulate damping forces generated by goals*/
 					sub_v3_v3v3(velgoal,bp->origS, bp->origE);
-					kd =  sb->goalfrict * sb_fric_force_scale(ob) ;
+					kd = sb->goalfrict * sb_fric_force_scale(ob);
 					add_v3_v3v3(auxvect,velgoal,bp->vec);
 
 					if (forcetime > 0.0f) { /* make sure friction does not become rocket motor on time reversal */
 						bp->force[0]-= kd * (auxvect[0]);
 						bp->force[1]-= kd * (auxvect[1]);
 						bp->force[2]-= kd * (auxvect[2]);
-						if(nl_flags & NLF_BUILD){
+						if (nl_flags & NLF_BUILD) {
 							//int ia =3*(sb->totpoint-a);
 							normalize_v3(auxvect);
 							/* depending on my vel */
@@ -2701,7 +2701,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
 
 
 				/* particle field & vortex */
-				if(do_effector) {
+				if (do_effector) {
 					EffectedPoint epoint;
 					float force[3]= {0.0f, 0.0f, 0.0f};
 					float speed[3]= {0.0f, 0.0f, 0.0f};
@@ -2729,7 +2729,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
 					bp->force[1]-= bp->vec[1]*kd;
 					bp->force[2]-= bp->vec[2]*kd;
 					/* friction in media done */
-					if(nl_flags & NLF_BUILD){
+					if (nl_flags & NLF_BUILD) {
 						//int ia =3*(sb->totpoint-a);
 						/* da/dv =  */
 
@@ -2743,26 +2743,26 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
 				bp->choke = 0.0f;
 				bp->choke2 = 0.0f;
 				bp->loc_flag &= ~SBF_DOFUZZY;
-				if(do_deflector) {
+				if (do_deflector) {
 					float cfforce[3],defforce[3] ={0.0f,0.0f,0.0f}, vel[3] = {0.0f,0.0f,0.0f}, facenormal[3], cf = 1.0f,intrusion;
 					kd = 1.0f;
 
-					if (sb_deflect_face(ob,bp->pos,facenormal,defforce,&cf,timenow,vel,&intrusion)){
-						if ((!nl_flags)&&(intrusion < 0.0f)){
-							if(G.rt & 0x01){ // 17 we did check for bit 0x10 before
+					if (sb_deflect_face(ob,bp->pos,facenormal,defforce,&cf,timenow,vel,&intrusion)) {
+						if ((!nl_flags)&&(intrusion < 0.0f)) {
+							if (G.rt & 0x01) { // 17 we did check for bit 0x10 before
 								/*fixing bug [17428] this forces adaptive step size to tiny steps
 								in some situations .. keeping G.rt==17 option for old files 'needing' the bug
 								*/
 								/*bjornmose:  uugh.. what an evil hack
 								violation of the 'don't touch bp->pos in here' rule
 								but works nice, like this-->
-								we predict the solution beeing out of the collider
+								we predict the solution being out of the collider
 								in heun step No1 and leave the heun step No2 adapt to it
 								so we kind of introduced a implicit solver for this case
 								*/
 								Vec3PlusStVec(bp->pos,-intrusion,facenormal);
 							}
-							else{
+							else {
 
 								sub_v3_v3v3(cfforce,bp->vec,vel);
 								Vec3PlusStVec(bp->force,-cf*50.0f,cfforce);
@@ -2773,12 +2773,12 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
 							bp->loc_flag |= SBF_DOFUZZY;
 							bp->choke = sb->choke*0.01f;
 						}
-						else{
+						else {
 							sub_v3_v3v3(cfforce,bp->vec,vel);
 							Vec3PlusStVec(bp->force,-cf*50.0f,cfforce);
 						}
 						Vec3PlusStVec(bp->force,kd,defforce);
-						if (nl_flags & NLF_BUILD){
+						if (nl_flags & NLF_BUILD) {
 							// int ia =3*(sb->totpoint-a);
 							// int op =3*sb->totpoint;
 							//dfdx_goal(ia,ia,op,mpos); // don't do unless you know
@@ -2792,11 +2792,11 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
 				/* ---cached collision targets */
 
 				/* +++springs */
-				if(ob->softflag & OB_SB_EDGES) {
-					if (sb->bspring){ /* spring list exists at all ? */
-						for(b=bp->nofsprings;b>0;b--){
+				if (ob->softflag & OB_SB_EDGES) {
+					if (sb->bspring) { /* spring list exists at all ? */
+						for (b=bp->nofsprings;b>0;b--) {
 							bs = sb->bspring + bp->springs[b-1];
-							if (do_springcollision || do_aero){
+							if (do_springcollision || do_aero) {
 								add_v3_v3(bp->force, bs->ext_force);
 								if (bs->flag & BSF_INTERSECT)
 									bp->choke = bs->cf;
@@ -2818,9 +2818,9 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
 
 		/* finish matrix and solve */
 #if (0) // remove onl linking for now .. still i am not sure .. the jacobian can be useful .. so keep that BM
-		if(nl_flags & NLF_SOLVE){
+		if (nl_flags & NLF_SOLVE) {
 			//double sct,sst=PIL_check_seconds_timer();
-			for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
+			for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
 				int iv =3*(sb->totpoint-a);
 				int ip =3*(2*sb->totpoint-a);
 				int n;
@@ -2839,12 +2839,12 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
 			success= nlSolveAdvanced(NULL, 1);
 
 			// nlPrintMatrix(); /* for debug purpose .. anyhow cropping B vector looks like working */
-			if(success){
+			if (success) {
 				float f;
 				int index =0;
 				/* for debug purpose .. anyhow cropping B vector looks like working */
 				if (G.rt ==32)
-					for(a=2*sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
+					for (a=2*sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
 						f=nlGetVariable(0,index);
 						printf("(%f ",f);index++;
 						f=nlGetVariable(0,index);
@@ -2854,7 +2854,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
 					}
 
 					index =0;
-					for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
+					for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
 						f=nlGetVariable(0,index);
 						bp->impdv[0] = f; index++;
 						f=nlGetVariable(0,index);
@@ -2863,7 +2863,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
 						bp->impdv[2] = f; index++;
 					}
 					/*
-					for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
+					for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
 					f=nlGetVariable(0,index);
 					bp->impdx[0] = f; index++;
 					f=nlGetVariable(0,index);
@@ -2873,9 +2873,9 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
 					}
 					*/
 			}
-			else{
-				printf("Matrix inversion failed \n");
-				for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
+			else {
+				printf("Matrix inversion failed\n");
+				for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
 					copy_v3_v3(bp->impdv,bp->force);
 				}
 
@@ -2914,16 +2914,16 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
 	else timeovermass = forcetime/0.009999f;
 	*/
 
-	for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
+	for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
 /* now we have individual masses   */
 /* claim a minimum mass for vertex */
 		if (_final_mass(ob,bp) > 0.009999f) timeovermass = forcetime/_final_mass(ob,bp);
 		else timeovermass = forcetime/0.009999f;
 
 
-		if(_final_goal(ob,bp) < SOFTGOALSNAP){
+		if (_final_goal(ob,bp) < SOFTGOALSNAP) {
 			/* this makes t~ = t */
-			if(mid_flags & MID_PRESERVE) copy_v3_v3(dx,bp->vec);
+			if (mid_flags & MID_PRESERVE) copy_v3_v3(dx,bp->vec);
 
 			/* so here is (v)' = a(cceleration) = sum(F_springs)/m + gravitation + some friction forces  + more forces*/
 			/* the ( ... )' operator denotes derivate respective time */
@@ -2933,12 +2933,12 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
 			/* some nasty if's to have heun in here too */
 			copy_v3_v3(dv,bp->force);
 
-			if (mode == 1){
+			if (mode == 1) {
 				copy_v3_v3(bp->prevvec, bp->vec);
 				copy_v3_v3(bp->prevdv, dv);
 			}
 
-			if (mode ==2){
+			if (mode ==2) {
 				/* be optimistic and execute step */
 				bp->vec[0] = bp->prevvec[0] + 0.5f * (dv[0] + bp->prevdv[0]);
 				bp->vec[1] = bp->prevvec[1] + 0.5f * (dv[1] + bp->prevdv[1]);
@@ -2951,7 +2951,7 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
 			else { add_v3_v3(bp->vec, bp->force); }
 
 			/* this makes t~ = t+dt */
-			if(!(mid_flags & MID_PRESERVE)) copy_v3_v3(dx,bp->vec);
+			if (!(mid_flags & MID_PRESERVE)) copy_v3_v3(dx,bp->vec);
 
 			/* so here is (x)'= v(elocity) */
 			/* the euler step for location then becomes */
@@ -2960,21 +2960,21 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
 
 			/* the freezer coming sooner or later */
 			/*
-			if  ((dot_v3v3(dx,dx)<freezeloc )&&(dot_v3v3(bp->force,bp->force)<freezeforce )){
+			if ((dot_v3v3(dx,dx)<freezeloc )&&(dot_v3v3(bp->force,bp->force)<freezeforce )) {
 				bp->frozen /=2;
 			}
-			else{
-				bp->frozen =MIN2(bp->frozen*1.05f,1.0f);
+			else {
+				bp->frozen = MIN2(bp->frozen*1.05f,1.0f);
 			}
 			mul_v3_fl(dx,bp->frozen);
 			*/
 			/* again some nasty if's to have heun in here too */
-			if (mode ==1){
+			if (mode ==1) {
 				copy_v3_v3(bp->prevpos,bp->pos);
 				copy_v3_v3(bp->prevdx ,dx);
 			}
 
-			if (mode ==2){
+			if (mode ==2) {
 				bp->pos[0] = bp->prevpos[0] + 0.5f * ( dx[0] + bp->prevdx[0]);
 				bp->pos[1] = bp->prevpos[1] + 0.5f * ( dx[1] + bp->prevdx[1]);
 				bp->pos[2] = bp->prevpos[2] + 0.5f * ( dx[2] + bp->prevdx[2]);
@@ -2986,10 +2986,10 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
    the collider object signals to get out by pushing hard. on the other hand
    we don't want to end up in deep space so we add some <viscosity>
    to balance that out */
-				if (bp->choke2 > 0.0f){
+				if (bp->choke2 > 0.0f) {
 					mul_v3_fl(bp->vec,(1.0f - bp->choke2));
 				}
-				if (bp->choke > 0.0f){
+				if (bp->choke > 0.0f) {
 					mul_v3_fl(bp->vec,(1.0f - bp->choke));
 				}
 
@@ -3007,18 +3007,18 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
 	} /*for*/
 
 	if (sb->totpoint) mul_v3_fl(cm,1.0f/sb->totpoint);
-	if (sb->scratch){
+	if (sb->scratch) {
 		copy_v3_v3(sb->scratch->aabbmin,aabbmin);
 		copy_v3_v3(sb->scratch->aabbmax,aabbmax);
 	}
 
-	if (err){ /* so step size will be controlled by biggest difference in slope */
+	if (err) { /* so step size will be controlled by biggest difference in slope */
 		if (sb->solverflags & SBSO_OLDERR)
 		*err = MAX2(maxerrpos,maxerrvel);
 		else
 		*err = maxerrpos;
-		//printf("EP %f EV %f \n",maxerrpos,maxerrvel);
-		if (fuzzy){
+		//printf("EP %f EV %f\n",maxerrpos,maxerrvel);
+		if (fuzzy) {
 			*err /= sb->fuzzyness;
 		}
 	}
@@ -3031,7 +3031,7 @@ static void softbody_restore_prev_step(Object *ob)
 	BodyPoint *bp;
 	int a;
 
-	for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
+	for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
 		copy_v3_v3(bp->vec, bp->prevvec);
 		copy_v3_v3(bp->pos, bp->prevpos);
 	}
@@ -3044,7 +3044,7 @@ static void softbody_store_step(Object *ob)
 	BodyPoint *bp;
 	int a;
 
-	for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
+	for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
 		copy_v3_v3(bp->prevvec,bp->vec);
 		copy_v3_v3(bp->prevpos,bp->pos);
 	}
@@ -3059,7 +3059,7 @@ static void softbody_store_state(Object *ob,float *ppos,float *pvel)
 	int a;
 	float *pp=ppos,*pv=pvel;
 
-	for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
+	for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
 
 		copy_v3_v3(pv, bp->vec);
 		pv+=3;
@@ -3077,7 +3077,7 @@ static void softbody_retrieve_state(Object *ob,float *ppos,float *pvel)
 	int a;
 	float *pp=ppos,*pv=pvel;
 
-	for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
+	for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
 
 		copy_v3_v3(bp->vec,pv);
 		pv+=3;
@@ -3096,7 +3096,7 @@ static void softbody_swap_state(Object *ob,float *ppos,float *pvel)
 	float *pp=ppos,*pv=pvel;
 	float temp[3];
 
-	for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
+	for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
 
 		copy_v3_v3(temp, bp->vec);
 		copy_v3_v3(bp->vec,pv);
@@ -3124,8 +3124,8 @@ static void softbody_apply_goalsnap(Object *ob)
 	BodyPoint *bp;
 	int a;
 
-	for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
-		if (_final_goal(ob,bp) >= SOFTGOALSNAP){
+	for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
+		if (_final_goal(ob,bp) >= SOFTGOALSNAP) {
 			copy_v3_v3(bp->prevpos,bp->pos);
 			copy_v3_v3(bp->pos,bp->origT);
 		}
@@ -3141,15 +3141,15 @@ static void apply_spring_memory(Object *ob)
 	int a;
 	float b,l,r;
 
-	if (sb && sb->totspring){
+	if (sb && sb->totspring) {
 		b = sb->plastic;
-		for(a=0; a<sb->totspring; a++) {
+		for (a=0; a<sb->totspring; a++) {
 			bs  = &sb->bspring[a];
 			bp1 =&sb->bpoint[bs->v1];
 			bp2 =&sb->bpoint[bs->v2];
 			l = len_v3v3(bp1->pos,bp2->pos);
 			r = bs->len/l;
-			if (( r > 1.05f) || (r < 0.95f)){
+			if (( r > 1.05f) || (r < 0.95f)) {
 			bs->len = ((100.0f - b) * bs->len  + b*l)/100.0f;
 			}
 		}
@@ -3166,11 +3166,11 @@ static void interpolate_exciter(Object *ob, int timescale, int time)
 
 	f = (float)time/(float)timescale;
 
-	for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
+	for (a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
 		bp->origT[0] = bp->origS[0] + f*(bp->origE[0] - bp->origS[0]);
 		bp->origT[1] = bp->origS[1] + f*(bp->origE[1] - bp->origS[1]);
 		bp->origT[2] = bp->origS[2] + f*(bp->origE[2] - bp->origS[2]);
-		if (_final_goal(ob,bp) >= SOFTGOALSNAP){
+		if (_final_goal(ob,bp) >= SOFTGOALSNAP) {
 			bp->vec[0] = bp->origE[0] - bp->origS[0];
 			bp->vec[1] = bp->origE[1] - bp->origS[1];
 			bp->vec[2] = bp->origE[2] - bp->origS[2];
@@ -3197,20 +3197,20 @@ static void get_scalar_from_vertexgroup(Object *ob, int vertID, short groupindex
 	int i;
 
 	/* spot the vert in deform vert list at mesh */
-	if(ob->type==OB_MESH) {
+	if (ob->type==OB_MESH) {
 		Mesh *me= ob->data;
 		if (me->dvert)
 			dv = me->dvert + vertID;
 	}
-	else if(ob->type==OB_LATTICE) {	/* not yet supported in softbody btw */
+	else if (ob->type==OB_LATTICE) {	/* not yet supported in softbody btw */
 		Lattice *lt= ob->data;
 		if (lt->dvert)
 			dv = lt->dvert + vertID;
 	}
-	if(dv) {
+	if (dv) {
 		/* Lets see if this vert is in the weight group */
-		for (i=0; i<dv->totweight; i++){
-			if (dv->dw[i].def_nr == groupindex){
+		for (i=0; i<dv->totweight; i++) {
+			if (dv->dw[i].def_nr == groupindex) {
 				*target= dv->dw[i].weight; /* got it ! */
 				break;
 			}
@@ -3235,9 +3235,9 @@ static void springs_from_mesh(Object *ob)
 	** will be overwritten sbObjectStep() to receive
 	** actual modifier stack positions
 	*/
-		if(me->totvert) {
+		if (me->totvert) {
 			bp= ob->soft->bpoint;
-			for(a=0; a<me->totvert; a++, bp++) {
+			for (a=0; a<me->totvert; a++, bp++) {
 				copy_v3_v3(bp->origS, me->mvert[a].co);
 				mul_m4_v3(ob->obmat, bp->origS);
 			}
@@ -3245,10 +3245,10 @@ static void springs_from_mesh(Object *ob)
 		}
 		/* recalculate spring length for meshes here */
 		/* public version shrink to fit */
-		if (sb->springpreload != 0 ){
+		if (sb->springpreload != 0 ) {
 			scale = sb->springpreload / 100.0f;
 		}
-		for(a=0; a<sb->totspring; a++) {
+		for (a=0; a<sb->totspring; a++) {
 			BodySpring *bs = &sb->bspring[a];
 			bs->len= scale*len_v3v3(sb->bpoint[bs->v1].origS, sb->bpoint[bs->v2].origS);
 		}
@@ -3277,28 +3277,28 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
 	sb= ob->soft;
 	bp= sb->bpoint;
 
-	for(a=0; a<me->totvert; a++, bp++) {
+	for (a=0; a<me->totvert; a++, bp++) {
 		/* get scalar values needed  *per vertex* from vertex group functions,
 		so we can *paint* them nicly ..
 		they are normalized [0.0..1.0] so may be we need amplitude for scale
 		which can be done by caller but still .. i'd like it to go this way
 		*/
 
-		if((ob->softflag & OB_SB_GOAL) && sb->vertgroup) { /* even this is a deprecated evil hack */
+		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);
 			/* do this always, regardless successfull read from vertex group */
-			/* this is where '2.5 every thing is animateable' goes wrong in the first place jow_go_for2_5 */
+			/* 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 */
 			/* reads: leave the bp->goal as it was read from vertex group / or default .. we will need it at per frame call */
 			/* should be fixed for meshes */
 			// bp->goal= sb->mingoal + bp->goal*goalfac; /* do not do here jow_go_for2_5 */
 		}
-		else{
+		else {
 			/* in consequence if no group was set .. but we want to animate it laters */
 			/* logically attach to goal with default first */
-			if(ob->softflag & OB_SB_GOAL){bp->goal =sb->defgoal;}
+			if (ob->softflag & OB_SB_GOAL) {bp->goal = sb->defgoal;}
 		}
 
 		/* to proove the concept
@@ -3308,11 +3308,11 @@ 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){
+			/* printf("VGN  %s %d\n",sb->namedVG_Mass,grp); */
+			if (grp > -1) {
 				get_scalar_from_vertexgroup(ob, a,(short) (grp), &bp->mass);
 				/* 2.5  bp->mass = bp->mass * sb->nodemass; */
-				/* printf("bp->mass  %f \n",bp->mass); */
+				/* printf("bp->mass  %f\n",bp->mass); */
 
 			}
 		}
@@ -3322,10 +3322,10 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
 		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){
+			//printf("VGN  %s %d\n",sb->namedVG_Spring_K,grp);
+			if (grp > -1) {
 				get_scalar_from_vertexgroup(ob, a,(short) (grp), &bp->springweight);
-				//printf("bp->springweight  %f \n",bp->springweight);
+				//printf("bp->springweight  %f\n",bp->springweight);
 
 			}
 		}
@@ -3335,9 +3335,9 @@ static void mesh_to_softbody(Scene *scene, Object *ob)
 
 	/* but we only optionally add body edge springs */
 	if (ob->softflag & OB_SB_EDGES) {
-		if(medge) {
+		if (medge) {
 			bs= sb->bspring;
-			for(a=me->totedge; a>0; a--, medge++, bs++) {
+			for (a=me->totedge; a>0; a--, medge++, bs++) {
 				bs->v1= medge->v1;
 				bs->v2= medge->v2;
 				bs->springtype=SB_EDGE;
@@ -3376,7 +3376,7 @@ static void mesh_faces_to_scratch(Object *ob)
 	bodyface = sb->scratch->bodyface = MEM_mallocN(sizeof(BodyFace)*me->totface,"SB_body_Faces");
 	//memcpy(sb->scratch->mface,me->mface,sizeof(MFace)*me->totface);
 	mface = me->mface;
-	for(a=0; a<me->totface; a++, mface++, bodyface++) {
+	for (a=0; a<me->totface; a++, mface++, bodyface++) {
 		bodyface->v1 = mface->v1;
 		bodyface->v2 = mface->v2;
 		bodyface->v3 = mface->v3;
@@ -3398,14 +3398,14 @@ static void reference_to_scratch(Object *ob)
 	sb->scratch->Ref.ivert = MEM_mallocN(sizeof(ReferenceVert)*sb->totpoint,"SB_Reference");
 	bp= ob->soft->bpoint;
 	rp= sb->scratch->Ref.ivert;
-	for(a=0; a<sb->totpoint; a++, rp++, bp++) {
+	for (a=0; a<sb->totpoint; a++, rp++, bp++) {
 		copy_v3_v3(rp->pos,bp->pos);
 		add_v3_v3(accu_pos, bp->pos);
 		accu_mass += _final_mass(ob,bp);
 	}
 	mul_v3_fl(accu_pos,1.0f/accu_mass);
 	copy_v3_v3(sb->scratch->Ref.com,accu_pos);
-	/* printf("reference_to_scratch \n"); */
+	/* printf("reference_to_scratch\n"); */
 }
 
 /*
@@ -3430,27 +3430,27 @@ static void makelatticesprings(Lattice *lt,	BodySpring *bs, int dostiff,Object *
 	dv= lt->pntsu;
 	dw= dv*lt->pntsv;
 
-	for(w=0; w<lt->pntsw; w++) {
+	for (w=0; w<lt->pntsw; w++) {
 
-		for(v=0; v<lt->pntsv; v++) {
+		for (v=0; v<lt->pntsv; v++) {
 
-			for(u=0, bpuc=0, bpu=NULL; u<lt->pntsu; u++, bp++, bpc++) {
+			for (u=0, bpuc=0, bpu=NULL; u<lt->pntsu; u++, bp++, bpc++) {
 
-				if(w) {
+				if (w) {
 					bs->v1 = bpc;
 					bs->v2 = bpc-dw;
 					bs->springtype=SB_EDGE;
 					bs->len= globallen((bp-dw)->vec, bp->vec,ob);
 					bs++;
 				}
-				if(v) {
+				if (v) {
 					bs->v1 = bpc;
 					bs->v2 = bpc-dv;
 					bs->springtype=SB_EDGE;
 					bs->len= globallen((bp-dv)->vec, bp->vec,ob);
 					bs++;
 				}
-				if(u) {
+				if (u) {
 					bs->v1 = bpuc;
 					bs->v2 = bpc;
 					bs->springtype=SB_EDGE;
@@ -3460,15 +3460,15 @@ static void makelatticesprings(Lattice *lt,	BodySpring *bs, int dostiff,Object *
 
 				if (dostiff) {
 
-					if(w){
-						if( v && u ) {
+					if (w) {
+						if ( v && u ) {
 							bs->v1 = bpc;
 							bs->v2 = bpc-dw-dv-1;
 							bs->springtype=SB_BEND;
 							bs->len= globallen((bp-dw-dv-1)->vec, bp->vec,ob);
 							bs++;
 						}
-						if( (v < lt->pntsv-1) && (u != 0) ) {
+						if ( (v < lt->pntsv-1) && (u != 0) ) {
 							bs->v1 = bpc;
 							bs->v2 = bpc-dw+dv-1;
 							bs->springtype=SB_BEND;
@@ -3477,15 +3477,15 @@ static void makelatticesprings(Lattice *lt,	BodySpring *bs, int dostiff,Object *
 						}
 					}
 
-					if(w < lt->pntsw -1){
-						if( v && u ) {
+					if (w < lt->pntsw -1) {
+						if ( v && u ) {
 							bs->v1 = bpc;
 							bs->v2 = bpc+dw-dv-1;
 							bs->springtype=SB_BEND;
 							bs->len= globallen((bp+dw-dv-1)->vec, bp->vec,ob);
 							bs++;
 						}
-						if( (v < lt->pntsv-1) && (u != 0) ) {
+						if ( (v < lt->pntsv-1) && (u != 0) ) {
 							bs->v1 = bpc;
 							bs->v2 = bpc+dw+dv-1;
 							bs->springtype=SB_BEND;
@@ -3511,11 +3511,11 @@ static void lattice_to_softbody(Scene *scene, Object *ob)
 
 	totvert= lt->pntsu*lt->pntsv*lt->pntsw;
 
-	if (ob->softflag & OB_SB_EDGES){
+	if (ob->softflag & OB_SB_EDGES) {
 		totspring = ((lt->pntsu -1) * lt->pntsv
 				  + (lt->pntsv -1) * lt->pntsu) * lt->pntsw
 				  +lt->pntsu*lt->pntsv*(lt->pntsw -1);
-		if (ob->softflag & OB_SB_QUADS){
+		if (ob->softflag & OB_SB_QUADS) {
 			totspring += 4*(lt->pntsu -1) *  (lt->pntsv -1)  * (lt->pntsw-1);
 		}
 	}
@@ -3526,21 +3526,21 @@ static void lattice_to_softbody(Scene *scene, Object *ob)
 	sb= ob->soft;	/* can be created in renew_softbody() */
 
 	/* weights from bpoints, same code used as for mesh vertices */
-	/* if((ob->softflag & OB_SB_GOAL) && sb->vertgroup) { 2.4x one*/
+	/* if ((ob->softflag & OB_SB_GOAL) && sb->vertgroup) { 2.4x one*/
 	/* new! take the weights from lattice vertex anyhow */
-	if(ob->softflag & OB_SB_GOAL){
+	if (ob->softflag & OB_SB_GOAL) {
 		BodyPoint *bp= sb->bpoint;
 		BPoint *bpnt= lt->def;
 		/* jow_go_for2_5 */
 		int a;
 
-		for(a=0; a<totvert; a++, bp++, bpnt++) {
+		for (a=0; a<totvert; a++, bp++, bpnt++) {
 			bp->goal= bpnt->weight;
 		}
 	}
 
 	/* create some helper edges to enable SB lattice to be useful at all */
-	if (ob->softflag & OB_SB_EDGES){
+	if (ob->softflag & OB_SB_EDGES) {
 		makelatticesprings(lt,ob->soft->bspring,ob->softflag & OB_SB_QUADS,ob);
 		build_bps_springlist(ob); /* link bps to springs */
 	}
@@ -3561,8 +3561,8 @@ static void curve_surf_to_softbody(Scene *scene, Object *ob)
 
 	totvert= count_curveverts(&cu->nurb);
 
-	if (ob->softflag & OB_SB_EDGES){
-		if(ob->type==OB_CURVE) {
+	if (ob->softflag & OB_SB_EDGES) {
+		if (ob->type==OB_CURVE) {
 			totspring= totvert - BLI_countlist(&cu->nurb);
 		}
 	}
@@ -3576,19 +3576,19 @@ static void curve_surf_to_softbody(Scene *scene, Object *ob)
 	bs= sb->bspring;
 
 	/* weights from bpoints, same code used as for mesh vertices */
-	/* if((ob->softflag & OB_SB_GOAL) && sb->vertgroup) 2.4x hack*/
+	/* if ((ob->softflag & OB_SB_GOAL) && sb->vertgroup) 2.4x hack*/
 	/* new! take the weights from curve vertex anyhow */
-	if(ob->softflag & OB_SB_GOAL)
+	if (ob->softflag & OB_SB_GOAL)
 		setgoal= 1;
 
-	for(nu= cu->nurb.first; nu; nu= nu->next) {
-		if(nu->bezt) {
+	for (nu= cu->nurb.first; nu; nu= nu->next) {
+		if (nu->bezt) {
 			/* bezier case ; this is nicly said naive; who ever wrote this part, it was not me (JOW) :) */
 			/* a: never ever make tangent handles (sub) and or (ob)ject to collision */
-			/* b: rather calculate them using some C2 (C2= continous in second derivate -> no jump in bending ) condition */
+			/* b: rather calculate them using some C2 (C2= continuous in second derivate -> no jump in bending ) condition */
 			/* not too hard to do, but needs some more code to care for;  some one may want look at it  JOW 2010/06/12*/
-			for(bezt=nu->bezt, a=0; a<nu->pntsu; a++, bezt++, bp+=3, curindex+=3) {
-				if(setgoal) {
+			for (bezt=nu->bezt, a=0; a<nu->pntsu; a++, bezt++, bp+=3, curindex+=3) {
+				if (setgoal) {
 					bp->goal= bezt->weight;
 
 					/* all three triples */
@@ -3599,8 +3599,8 @@ static void curve_surf_to_softbody(Scene *scene, Object *ob)
 					(bp+2)->loc_flag |= SBF_OUTOFCOLLISION;
 				}
 
-				if(totspring) {
-					if(a>0) {
+				if (totspring) {
+					if (a>0) {
 						bs->v1= curindex-3;
 						bs->v2= curindex;
 						bs->springtype=SB_HANDLE;
@@ -3610,23 +3610,23 @@ static void curve_surf_to_softbody(Scene *scene, Object *ob)
 					bs->v1= curindex;
 					bs->v2= curindex+1;
 					bs->springtype=SB_HANDLE;
-					bs->len= globallen( bezt->vec[0], bezt->vec[1], ob );
+					bs->len= globallen(bezt->vec[0], bezt->vec[1], ob);
 					bs++;
 
 					bs->v1= curindex+1;
 					bs->v2= curindex+2;
 					bs->springtype=SB_HANDLE;
-					bs->len= globallen( bezt->vec[1], bezt->vec[2], ob );
+					bs->len= globallen(bezt->vec[1], bezt->vec[2], ob);
 					bs++;
 				}
 			}
 		}
 		else {
-			for(bpnt=nu->bp, a=0; a<nu->pntsu*nu->pntsv; a++, bpnt++, bp++, curindex++) {
-				if(setgoal) {
+			for (bpnt=nu->bp, a=0; a<nu->pntsu*nu->pntsv; a++, bpnt++, bp++, curindex++) {
+				if (setgoal) {
 					bp->goal= bpnt->weight;
 				}
-				if(totspring && a>0) {
+				if (totspring && a>0) {
 					bs->v1= curindex-1;
 					bs->v2= curindex;
 					bs->springtype=SB_EDGE;
@@ -3637,7 +3637,7 @@ static void curve_surf_to_softbody(Scene *scene, Object *ob)
 		}
 	}
 
-	if(totspring)
+	if (totspring)
 	{
 		build_bps_springlist(ob); /* link bps to springs */
 		if (ob->softflag & OB_SB_SELF) {calculate_collision_balls(ob);}
@@ -3648,16 +3648,16 @@ static void curve_surf_to_softbody(Scene *scene, Object *ob)
 static void softbody_to_object(Object *ob, float (*vertexCos)[3], int numVerts, int local)
 {
 	SoftBody *sb= ob->soft;
-	if(sb){
+	if (sb) {
 		BodyPoint *bp= sb->bpoint;
 		int a;
-		if(sb->solverflags & SBSO_ESTIMATEIPO){SB_estimate_transform(ob,sb->lcom,sb->lrot,sb->lscale);}
+		if (sb->solverflags & SBSO_ESTIMATEIPO) {SB_estimate_transform(ob,sb->lcom,sb->lrot,sb->lscale);}
 		/* inverse matrix is not uptodate... */
 		invert_m4_m4(ob->imat, ob->obmat);
 
-		for(a=0; a<numVerts; a++, bp++) {
+		for (a=0; a<numVerts; a++, bp++) {
 			copy_v3_v3(vertexCos[a], bp->pos);
-			if(local==0)
+			if (local==0)
 				mul_m4_v3(ob->imat, vertexCos[a]);	/* softbody is in global coords, baked optionally not */
 		}
 	}
@@ -3725,7 +3725,7 @@ SoftBody *sbNew(Scene *scene)
 
 	sb->pointcache = BKE_ptcache_add(&sb->ptcaches);
 
-	if(!sb->effector_weights)
+	if (!sb->effector_weights)
 		sb->effector_weights = BKE_add_effector_weights(NULL);
 
 	sb->last_frame= MINFRAME-1;
@@ -3739,7 +3739,7 @@ void sbFree(SoftBody *sb)
 	free_softbody_intern(sb);
 	BKE_ptcache_free_list(&sb->ptcaches);
 	sb->pointcache = NULL;
-	if(sb->effector_weights)
+	if (sb->effector_weights)
 		MEM_freeN(sb->effector_weights);
 	MEM_freeN(sb);
 }
@@ -3759,10 +3759,10 @@ void sbObjectToSoftbody(Object *ob)
 
 static int object_has_edges(Object *ob)
 {
-	if(ob->type==OB_MESH) {
+	if (ob->type==OB_MESH) {
 		return ((Mesh*) ob->data)->totedge;
 	}
-	else if(ob->type==OB_LATTICE) {
+	else if (ob->type==OB_LATTICE) {
 		return 1;
 	}
 	else {
@@ -3781,10 +3781,10 @@ static void softbody_update_positions(Object *ob, SoftBody *sb, float (*vertexCo
 	BodyPoint *bp;
 	int a;
 
-	if(!sb || !sb->bpoint)
+	if (!sb || !sb->bpoint)
 		return;
 
-	for(a=0,bp=sb->bpoint; a<numVerts; a++, bp++) {
+	for (a=0,bp=sb->bpoint; a<numVerts; a++, bp++) {
 		/* store where goals are now */
 		copy_v3_v3(bp->origS, bp->origE);
 		/* copy the position of the goals at desired end time */
@@ -3800,18 +3800,18 @@ static void softbody_update_positions(Object *ob, SoftBody *sb, float (*vertexCo
 
 /* void SB_estimate_transform */
 /* input   Object *ob out (says any object that can do SB like mesh,lattice,curve )
-   output  float lloc[3],float lrot[3][3],float lscale[3][3]
-   that is:
-   a precise position vector denoting the motion of the center of mass
-   give a rotation/scale matrix using averaging method, that's why estimate and not calculate
-   see: this is kind of reverse engeneering: having to states of a point cloud and recover what happend
-   our advantage here we know the identity of the vertex
-   there are others methods giving other results.
-   lloc,lrot,lscale are allowed to be NULL, just in case you don't need it.
-   should be pretty useful for pythoneers :)
-   not! velocity .. 2nd order stuff
-   vcloud_estimate_transform see
-   */
+ * output  float lloc[3],float lrot[3][3],float lscale[3][3]
+ * that is:
+ * a precise position vector denoting the motion of the center of mass
+ * give a rotation/scale matrix using averaging method, that's why estimate and not calculate
+ * see: this is kind of reverse engeneering: having to states of a point cloud and recover what happend
+ * our advantage here we know the identity of the vertex
+ * there are others methods giving other results.
+ * lloc,lrot,lscale are allowed to be NULL, just in case you don't need it.
+ * should be pretty useful for pythoneers :)
+ * not! velocity .. 2nd order stuff
+ * vcloud_estimate_transform see
+ */
 
 void SB_estimate_transform(Object *ob,float lloc[3],float lrot[3][3],float lscale[3][3])
 {
@@ -3823,13 +3823,13 @@ void SB_estimate_transform(Object *ob,float lloc[3],float lrot[3][3],float lscal
 	float com[3],rcom[3];
 	int a;
 
-	if(!ob ||!ob->soft) return; /* why did we get here ? */
+	if (!ob ||!ob->soft) return; /* why did we get here ? */
 	sb= ob->soft;
-	if(!sb || !sb->bpoint) return;
+	if (!sb || !sb->bpoint) return;
 	opos= MEM_callocN( (sb->totpoint)*3*sizeof(float), "SB_OPOS");
 	rpos= MEM_callocN( (sb->totpoint)*3*sizeof(float), "SB_RPOS");
 	/* might filter vertex selection with a vertex group */
-	for(a=0, bp=sb->bpoint, rp=sb->scratch->Ref.ivert; a<sb->totpoint; a++, bp++, rp++) {
+	for (a=0, bp=sb->bpoint, rp=sb->scratch->Ref.ivert; a<sb->totpoint; a++, bp++, rp++) {
 		copy_v3_v3(rpos[a],rp->pos);
 		copy_v3_v3(opos[a],bp->pos);
 	}
@@ -3851,7 +3851,7 @@ static void softbody_reset(Object *ob, SoftBody *sb, float (*vertexCos)[3], int
 	BodyPoint *bp;
 	int a;
 
-	for(a=0,bp=sb->bpoint; a<numVerts; a++, bp++) {
+	for (a=0,bp=sb->bpoint; a<numVerts; a++, bp++) {
 		copy_v3_v3(bp->pos, vertexCos[a]);
 		mul_m4_v3(ob->obmat, bp->pos);  /* yep, sofbody is global coords*/
 		copy_v3_v3(bp->origS, bp->pos);
@@ -3860,16 +3860,16 @@ static void softbody_reset(Object *ob, SoftBody *sb, float (*vertexCos)[3], int
 		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:
-		1.  set sheduled time step to new dtime
-		2.  try to advance the sheduled time step, beeing optimistic execute it
-		3.  check for success
-		3.a we 're fine continue, may be we can increase sheduled time again ?? if so, do so!
-		3.b we did exceed error limit --> roll back, shorten the sheduled time and try again at 2.
-		4.  check if we did reach dtime
-		4.a nope we need to do some more at 2.
-		4.b yup we're done
-		*/
+		 * adaptive step size algo in a nutshell:
+		 * 1.  set scheduled time step to new dtime
+		 * 2.  try to advance the scheduled time step, being optimistic execute it
+		 * 3.  check for success
+		 * 3.a we 're fine continue, may be we can increase scheduled time again ?? if so, do so!
+		 * 3.b we did exceed error limit --> roll back, shorten the scheduled time and try again at 2.
+		 * 4.  check if we did reach dtime
+		 * 4.a nope we need to do some more at 2.
+		 * 4.b yup we're done
+		 */
 
 		copy_v3_v3(bp->prevpos, bp->pos);
 		copy_v3_v3(bp->prevvec, bp->vec);
@@ -3889,7 +3889,7 @@ static void softbody_reset(Object *ob, SoftBody *sb, float (*vertexCos)[3], int
 
 	/* copy some info to scratch */
 			/* we only need that if we want to reconstruct IPO */
-	if(1) {
+	if (1) {
 		reference_to_scratch(ob);
 		SB_estimate_transform(ob,NULL,NULL,NULL);
 		SB_estimate_transform(ob,NULL,NULL,NULL);
@@ -3917,15 +3917,15 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
 
 	sst=PIL_check_seconds_timer();
 	/* Integration back in time is possible in theory, but pretty useless here.
-	So we refuse to do so. Since we do not know anything about 'outside' canges
-	especially colliders we refuse to go more than 10 frames.
-	*/
-	if(dtime < 0 || dtime > 10.5f) return;
+	 * So we refuse to do so. Since we do not know anything about 'outside' canges
+	 * especially colliders we refuse to go more than 10 frames.
+	 */
+	if (dtime < 0 || dtime > 10.5f) return;
 
 	ccd_update_deflector_hash(scene, ob, sb->scratch->colliderhash);
 
-	if(sb->scratch->needstobuildcollider){
-		if (query_external_colliders(scene, ob)){
+	if (sb->scratch->needstobuildcollider) {
+		if (query_external_colliders(scene, ob)) {
 			ccd_build_deflector_hash(scene, ob, sb->scratch->colliderhash);
 		}
 		sb->scratch->needstobuildcollider=0;
@@ -3938,19 +3938,18 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
 		float forcetimemax = 1.0f; /* set defaults guess we shall do one frame */
 		float forcetimemin = 0.01f; /* set defaults guess 1/100 is tight enough */
 		float timedone =0.0; /* how far did we get without violating error condition */
-							 /* loops = counter for emergency brake
-							 * we don't want to lock up the system if physics fail
-		*/
-		int loops =0 ;
+		                     /* loops = counter for emergency brake
+		                      * we don't want to lock up the system if physics fail */
+		int loops = 0;
 
 		SoftHeunTol = sb->rklimit; /* humm .. this should be calculated from sb parameters and sizes */
 		/* adjust loop limits */
 		if (sb->minloops > 0) forcetimemax = dtime / sb->minloops;
 		if (sb->maxloops > 0) forcetimemin = dtime / sb->maxloops;
 
-		if(sb->solver_ID>0) mid_flags |= MID_PRESERVE;
+		if (sb->solver_ID>0) mid_flags |= MID_PRESERVE;
 
-		forcetime =forcetimemax; /* hope for integrating in one step */
+		forcetime = forcetimemax; /* hope for integrating in one step */
 		while ( (ABS(timedone) < ABS(dtime)) && (loops < 2000) )
 		{
 			/* set goals in time */
@@ -3970,7 +3969,7 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
 
 			if (err > SoftHeunTol) { /* error needs to be scaled to some quantity */
 
-				if (forcetime > forcetimemin){
+				if (forcetime > forcetimemin) {
 					forcetime = MAX2(forcetime / 2.0f,forcetimemin);
 					softbody_restore_prev_step(ob);
 					//printf("down,");
@@ -3982,7 +3981,7 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
 			else {
 				float newtime = forcetime * 1.1f; /* hope for 1.1 times better conditions in next step */
 
-				if (sb->scratch->flag & SBF_DOFUZZY){
+				if (sb->scratch->flag & SBF_DOFUZZY) {
 					//if (err > SoftHeunTol/(2.0f*sb->fuzzyness)) { /* stay with this stepsize unless err really small */
 					newtime = forcetime;
 					//}
@@ -4001,7 +4000,7 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
 					forcetime = MAX2(dtime - timedone,newtime);
 			}
 			loops++;
-			if(sb->solverflags & SBSO_MONITOR ){
+			if (sb->solverflags & SBSO_MONITOR ) {
 				sct=PIL_check_seconds_timer();
 				if (sct-sst > 0.5f) printf("%3.0f%% \r",100.0f*timedone/dtime);
 			}
@@ -4013,8 +4012,8 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
 		interpolate_exciter(ob, 2, 2);
 		softbody_apply_goalsnap(ob);
 
-		//				if(G.f & G_DEBUG){
-		if(sb->solverflags & SBSO_MONITOR ){
+		//				if (G.debug & G_DEBUG) {
+		if (sb->solverflags & SBSO_MONITOR ) {
 			if (loops > HEUNWARNLIMIT) /* monitor high loop counts */
 				printf("\r needed %d steps/frame",loops);
 		}
@@ -4028,19 +4027,19 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime)
 	{
 		/* do semi "fake" implicit euler */
 	}/*SOLVER SELECT*/
-	else if (sb->solver_ID == 3){
+	else if (sb->solver_ID == 3) {
 		/* do "stupid" semi "fake" implicit euler */
 		//removed
 
 	}/*SOLVER SELECT*/
-	else{
+	else {
 		printf("softbody no valid solver ID!");
 	}/*SOLVER SELECT*/
-	if(sb->plastic){ apply_spring_memory(ob);}
+	if (sb->plastic) { apply_spring_memory(ob);}
 
-	if(sb->solverflags & SBSO_MONITOR ){
+	if (sb->solverflags & SBSO_MONITOR ) {
 		sct=PIL_check_seconds_timer();
-		if ((sct-sst > 0.5f) || (G.f & G_DEBUG)) printf(" solver time %f sec %s \n",sct-sst,ob->id.name);
+		if ((sct-sst > 0.5f) || (G.debug & G_DEBUG)) printf(" solver time %f sec %s\n",sct-sst,ob->id.name);
 	}
 }
 
@@ -4064,22 +4063,22 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i
 
 	/* check for changes in mesh, should only happen in case the mesh
 	 * structure changes during an animation */
-	if(sb->bpoint && numVerts != sb->totpoint) {
+	if (sb->bpoint && numVerts != sb->totpoint) {
 		BKE_ptcache_invalidate(cache);
 		return;
 	}
 
 	/* clamp frame ranges */
-	if(framenr < startframe) {
+	if (framenr < startframe) {
 		BKE_ptcache_invalidate(cache);
 		return;
 	}
-	else if(framenr > endframe) {
+	else if (framenr > endframe) {
 		framenr = endframe;
 	}
 
 	/* verify if we need to create the softbody data */
-	if(sb->bpoint == NULL ||
+	if (sb->bpoint == NULL ||
 	   ((ob->softflag & OB_SB_EDGES) && !ob->soft->bspring && object_has_edges(ob))) {
 
 		switch(ob->type) {
@@ -4103,7 +4102,7 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i
 	}
 
 	/* continue physics special case */
-	if(BKE_ptcache_get_continue_physics()) {
+	if (BKE_ptcache_get_continue_physics()) {
 		BKE_ptcache_invalidate(cache);
 		/* do simulation */
 		dtime = timescale;
@@ -4115,10 +4114,10 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i
 	}
 
 	/* still no points? go away */
-	if(sb->totpoint==0) {
+	if (sb->totpoint==0) {
 		return;
 	}
-	if(framenr == startframe) {
+	if (framenr == startframe) {
 		BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED);
 
 		/* first frame, no simulation to do, just set the positions */
@@ -4133,34 +4132,34 @@ void sbObjectStep(Scene *scene, Object *ob, float cfra, float (*vertexCos)[3], i
 	}
 
 	/* try to read from cache */
-	cache_result = BKE_ptcache_read(&pid, framenr);
+	cache_result = BKE_ptcache_read(&pid, (float)framenr+scene->r.subframe);
 
-	if(cache_result == PTCACHE_READ_EXACT || cache_result == PTCACHE_READ_INTERPOLATED) {
+	if (cache_result == PTCACHE_READ_EXACT || cache_result == PTCACHE_READ_INTERPOLATED) {
 		softbody_to_object(ob, vertexCos, numVerts, sb->local);
 
 		BKE_ptcache_validate(cache, framenr);
 
-		if(cache_result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED)
+		if (cache_result == PTCACHE_READ_INTERPOLATED && cache->flag & PTCACHE_REDO_NEEDED)
 			BKE_ptcache_write(&pid, framenr);
 
 		sb->last_frame = framenr;
 
 		return;
 	}
-	else if(cache_result==PTCACHE_READ_OLD) {
+	else if (cache_result==PTCACHE_READ_OLD) {
 		; /* do nothing */
 	}
-	else if(/*ob->id.lib || */(cache->flag & PTCACHE_BAKED)) { /* "library linking & pointcaches" has to be solved properly at some point */
+	else if (/*ob->id.lib || */(cache->flag & PTCACHE_BAKED)) { /* "library linking & pointcaches" has to be solved properly at some point */
 		/* if baked and nothing in cache, do nothing */
 		BKE_ptcache_invalidate(cache);
 		return;
 	}
 
-	if(framenr!=sb->last_frame+1)
+	if (framenr!=sb->last_frame+1)
 		return;
 
 	/* if on second frame, write cache for first frame */
-	if(cache->simframe == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0))
+	if (cache->simframe == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0))
 		BKE_ptcache_write(&pid, startframe);
 
 	softbody_update_positions(ob, sb, vertexCos, numVerts);
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index f5b6772..c2dbb51 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -86,7 +86,7 @@ struct bSound* sound_new_file(struct Main *bmain, const char *filename)
 	BLI_path_abs(str, path);
 
 	len = strlen(filename);
-	while(len > 0 && filename[len-1] != '/' && filename[len-1] != '\\')
+	while (len > 0 && filename[len-1] != '/' && filename[len-1] != '\\')
 		len--;
 
 	sound = alloc_libblock(&bmain->sound, ID_SO, filename+len);
@@ -95,7 +95,7 @@ struct bSound* sound_new_file(struct Main *bmain, const char *filename)
 
 	sound_load(bmain, sound);
 
-	if(!sound->playback_handle)
+	if (!sound->playback_handle)
 	{
 		free_libblock(&bmain->sound, sound);
 		sound = NULL;
@@ -113,14 +113,14 @@ void sound_free(struct bSound* sound)
 	}
 
 #ifdef WITH_AUDASPACE
-	if(sound->handle)
+	if (sound->handle)
 	{
 		AUD_unload(sound->handle);
 		sound->handle = NULL;
 		sound->playback_handle = NULL;
 	}
 
-	if(sound->cache)
+	if (sound->cache)
 	{
 		AUD_unload(sound->cache);
 		sound->cache = NULL;
@@ -141,15 +141,15 @@ static void sound_sync_callback(void* data, int mode, float time)
 	struct Scene* scene;
 
 	scene = bmain->scene.first;
-	while(scene)
+	while (scene)
 	{
-		if(scene->audio.flag & AUDIO_SYNC)
+		if (scene->audio.flag & AUDIO_SYNC)
 		{
-			if(mode)
+			if (mode)
 				sound_play_scene(scene);
 			else
 				sound_stop_scene(scene);
-			if(scene->sound_scene_handle)
+			if (scene->sound_scene_handle)
 				AUD_seek(scene->sound_scene_handle, time);
 		}
 		scene = scene->id.next;
@@ -192,22 +192,22 @@ void sound_init(struct Main *bmain)
 	specs.format = U.audioformat;
 	specs.rate = U.audiorate;
 
-	if(force_device >= 0)
+	if (force_device >= 0)
 		device = force_device;
 
-	if(buffersize < 128)
+	if (buffersize < 128)
 		buffersize = AUD_DEFAULT_BUFFER_SIZE;
 
-	if(specs.rate < AUD_RATE_8000)
+	if (specs.rate < AUD_RATE_8000)
 		specs.rate = AUD_RATE_44100;
 
-	if(specs.format <= AUD_FORMAT_INVALID)
+	if (specs.format <= AUD_FORMAT_INVALID)
 		specs.format = AUD_FORMAT_S16;
 
-	if(specs.channels <= AUD_CHANNELS_INVALID)
+	if (specs.channels <= AUD_CHANNELS_INVALID)
 		specs.channels = AUD_CHANNELS_STEREO;
 
-	if(!AUD_init(device, specs, buffersize))
+	if (!AUD_init(device, specs, buffersize))
 		AUD_init(AUD_NULL_DEVICE, specs, buffersize);
 
 	sound_init_main(bmain);
@@ -244,7 +244,7 @@ struct bSound* sound_new_buffer(struct Main *bmain, struct bSound *source)
 
 	sound_load(bmain, sound);
 
-	if(!sound->playback_handle)
+	if (!sound->playback_handle)
 	{
 		free_libblock(&bmain->sound, sound);
 		sound = NULL;
@@ -270,7 +270,7 @@ struct bSound* sound_new_limiter(struct Main *bmain, struct bSound *source, floa
 
 	sound_load(bmain, sound);
 
-	if(!sound->playback_handle)
+	if (!sound->playback_handle)
 	{
 		free_libblock(&bmain->sound, sound);
 		sound = NULL;
@@ -282,7 +282,7 @@ struct bSound* sound_new_limiter(struct Main *bmain, struct bSound *source, floa
 
 void sound_delete(struct Main *bmain, struct bSound* sound)
 {
-	if(sound)
+	if (sound)
 	{
 		sound_free(sound);
 
@@ -293,11 +293,11 @@ void sound_delete(struct Main *bmain, struct bSound* sound)
 void sound_cache(struct bSound* sound)
 {
 	sound->flags |= SOUND_FLAGS_CACHING;
-	if(sound->cache)
+	if (sound->cache)
 		AUD_unload(sound->cache);
 
 	sound->cache = AUD_bufferSound(sound->handle);
-	if(sound->cache)
+	if (sound->cache)
 		sound->playback_handle = sound->cache;
 	else
 		sound->playback_handle = sound->handle;
@@ -312,7 +312,7 @@ void sound_cache_notifying(struct Main* main, struct bSound* sound)
 void sound_delete_cache(struct bSound* sound)
 {
 	sound->flags &= ~SOUND_FLAGS_CACHING;
-	if(sound->cache)
+	if (sound->cache)
 	{
 		AUD_unload(sound->cache);
 		sound->cache = NULL;
@@ -322,15 +322,15 @@ void sound_delete_cache(struct bSound* sound)
 
 void sound_load(struct Main *bmain, struct bSound* sound)
 {
-	if(sound)
+	if (sound)
 	{
-		if(sound->cache)
+		if (sound->cache)
 		{
 			AUD_unload(sound->cache);
 			sound->cache = NULL;
 		}
 
-		if(sound->handle)
+		if (sound->handle)
 		{
 			AUD_unload(sound->handle);
 			sound->handle = NULL;
@@ -351,7 +351,7 @@ void sound_load(struct Main *bmain, struct bSound* sound)
 			/* load sound */
 			PackedFile* pf = sound->packedfile;
 
-			/* dont modify soundact->sound->name, only change a copy */
+			/* don't modify soundact->sound->name, only change a copy */
 			BLI_strncpy(fullpath, sound->name, sizeof(fullpath));
 			BLI_path_abs(fullpath, ID_BLEND_PATH(bmain, &sound->id));
 
@@ -367,28 +367,28 @@ void sound_load(struct Main *bmain, struct bSound* sound)
 			break;
 		}
 		case SOUND_TYPE_BUFFER:
-			if(sound->child_sound && sound->child_sound->handle)
+			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)
+			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)
+		if (sound->flags & SOUND_FLAGS_MONO)
 		{
 			void* handle = AUD_monoSound(sound->handle);
 			AUD_unload(sound->handle);
 			sound->handle = handle;
 		}
 
-		if(sound->flags & SOUND_FLAGS_CACHING)
+		if (sound->flags & SOUND_FLAGS_CACHING)
 		{
 			sound->cache = AUD_bufferSound(sound->handle);
 		}
 
-		if(sound->cache)
+		if (sound->cache)
 			sound->playback_handle = sound->cache;
 		else
 			sound->playback_handle = sound->handle;
@@ -414,25 +414,25 @@ void sound_create_scene(struct Scene *scene)
 
 void sound_destroy_scene(struct Scene *scene)
 {
-	if(scene->sound_scene_handle)
+	if (scene->sound_scene_handle)
 		AUD_stop(scene->sound_scene_handle);
-	if(scene->sound_scrub_handle)
+	if (scene->sound_scrub_handle)
 		AUD_stop(scene->sound_scrub_handle);
-	if(scene->sound_scene)
+	if (scene->sound_scene)
 		AUD_destroySequencer(scene->sound_scene);
-	if(scene->speaker_handles)
+	if (scene->speaker_handles)
 		AUD_destroySet(scene->speaker_handles);
 }
 
 void sound_mute_scene(struct Scene *scene, int muted)
 {
-	if(scene->sound_scene)
+	if (scene->sound_scene)
 		AUD_setSequencerMuted(scene->sound_scene, muted);
 }
 
 void sound_update_fps(struct Scene *scene)
 {
-	if(scene->sound_scene)
+	if (scene->sound_scene)
 		AUD_setSequencerFPS(scene->sound_scene, FPS);
 }
 
@@ -444,7 +444,7 @@ void sound_update_scene_listener(struct Scene *scene)
 
 void* sound_scene_add_scene_sound(struct Scene *scene, struct Sequence* sequence, int startframe, int endframe, int frameskip)
 {
-	if(scene != sequence->scene)
+	if (scene != sequence->scene)
 		return AUD_addSequence(scene->sound_scene, sequence->scene->sound_scene, startframe / FPS, endframe / FPS, frameskip / FPS);
 	return NULL;
 }
@@ -531,18 +531,19 @@ void sound_update_sequencer(struct Main* main, struct bSound* sound)
 {
 	struct Scene* scene;
 
-	for(scene = main->scene.first; scene; scene = scene->id.next)
+	for (scene = main->scene.first; scene; scene = scene->id.next) {
 		seq_update_sound(scene, sound);
+	}
 }
 
 static void sound_start_play_scene(struct Scene *scene)
 {
-	if(scene->sound_scene_handle)
+	if (scene->sound_scene_handle)
 		AUD_stop(scene->sound_scene_handle);
 
 	AUD_setSequencerDeviceSpecs(scene->sound_scene);
 
-	if((scene->sound_scene_handle = AUD_play(scene->sound_scene, 1)))
+	if ((scene->sound_scene_handle = AUD_play(scene->sound_scene, 1)))
 		AUD_setLoop(scene->sound_scene_handle, -1);
 }
 
@@ -553,22 +554,22 @@ void sound_play_scene(struct Scene *scene)
 
 	status = scene->sound_scene_handle ? AUD_getStatus(scene->sound_scene_handle) : AUD_STATUS_INVALID;
 
-	if(status == AUD_STATUS_INVALID)
+	if (status == AUD_STATUS_INVALID)
 		sound_start_play_scene(scene);
 
-	if(!scene->sound_scene_handle)
+	if (!scene->sound_scene_handle)
 	{
 		AUD_unlock();
 		return;
 	}
 
-	if(status != AUD_STATUS_PLAYING)
+	if (status != AUD_STATUS_PLAYING)
 	{
 		AUD_seek(scene->sound_scene_handle, CFRA / FPS);
 		AUD_resume(scene->sound_scene_handle);
 	}
 
-	if(scene->audio.flag & AUDIO_SYNC)
+	if (scene->audio.flag & AUDIO_SYNC)
 		AUD_startPlayback();
 
 	AUD_unlock();
@@ -576,11 +577,11 @@ void sound_play_scene(struct Scene *scene)
 
 void sound_stop_scene(struct Scene *scene)
 {
-	if(scene->sound_scene_handle)
+	if (scene->sound_scene_handle)
 	{
 		AUD_pause(scene->sound_scene_handle);
 
-		if(scene->audio.flag & AUDIO_SYNC)
+		if (scene->audio.flag & AUDIO_SYNC)
 			AUD_stopPlayback();
 	}
 }
@@ -595,11 +596,11 @@ void sound_seek_scene(struct Main *bmain, struct Scene *scene)
 
 	status = scene->sound_scene_handle ? AUD_getStatus(scene->sound_scene_handle) : AUD_STATUS_INVALID;
 
-	if(status == AUD_STATUS_INVALID)
+	if (status == AUD_STATUS_INVALID)
 	{
 		sound_start_play_scene(scene);
 
-		if(!scene->sound_scene_handle)
+		if (!scene->sound_scene_handle)
 		{
 			AUD_unlock();
 			return;
@@ -609,13 +610,15 @@ void sound_seek_scene(struct Main *bmain, struct Scene *scene)
 	}
 
 	animation_playing = 0;
-	for(screen=bmain->screen.first; screen; screen=screen->id.next)
-		if(screen->animtimer)
+	for (screen=bmain->screen.first; screen; screen=screen->id.next) {
+		if (screen->animtimer) {
 			animation_playing = 1;
+		}
+	}
 
-	if(scene->audio.flag & AUDIO_SCRUB && !animation_playing)
+	if (scene->audio.flag & AUDIO_SCRUB && !animation_playing)
 	{
-		if(scene->audio.flag & AUDIO_SYNC)
+		if (scene->audio.flag & AUDIO_SYNC)
 		{
 			AUD_seek(scene->sound_scene_handle, CFRA / FPS);
 			AUD_seekSequencer(scene->sound_scene_handle, CFRA / FPS);
@@ -623,22 +626,19 @@ void sound_seek_scene(struct Main *bmain, struct Scene *scene)
 		else
 			AUD_seek(scene->sound_scene_handle, CFRA / FPS);
 		AUD_resume(scene->sound_scene_handle);
-		if(scene->sound_scrub_handle && AUD_getStatus(scene->sound_scrub_handle) != AUD_STATUS_INVALID)
+		if (scene->sound_scrub_handle && AUD_getStatus(scene->sound_scrub_handle) != AUD_STATUS_INVALID)
 			AUD_seek(scene->sound_scrub_handle, 0);
-		else
-		{
-			if(scene->sound_scrub_handle)
+		else {
+			if (scene->sound_scrub_handle)
 				AUD_stop(scene->sound_scrub_handle);
 			scene->sound_scrub_handle = AUD_pauseAfter(scene->sound_scene_handle, 1 / FPS);
 		}
 	}
-	else
-	{
-		if(scene->audio.flag & AUDIO_SYNC)
+	else {
+		if (scene->audio.flag & AUDIO_SYNC)
 			AUD_seekSequencer(scene->sound_scene_handle, CFRA / FPS);
-		else
-		{
-			if(status == AUD_STATUS_PLAYING)
+		else {
+			if (status == AUD_STATUS_PLAYING)
 				AUD_seek(scene->sound_scene_handle, CFRA / FPS);
 		}
 	}
@@ -648,9 +648,9 @@ void sound_seek_scene(struct Main *bmain, struct Scene *scene)
 
 float sound_sync_scene(struct Scene *scene)
 {
-	if(scene->sound_scene_handle)
+	if (scene->sound_scene_handle)
 	{
-		if(scene->audio.flag & AUDIO_SYNC)
+		if (scene->audio.flag & AUDIO_SYNC)
 			return AUD_getSequencerPosition(scene->sound_scene_handle);
 		else
 			return AUD_getPosition(scene->sound_scene_handle);
@@ -660,7 +660,7 @@ float sound_sync_scene(struct Scene *scene)
 
 int sound_scene_playing(struct Scene *scene)
 {
-	if(scene->audio.flag & AUDIO_SYNC)
+	if (scene->audio.flag & AUDIO_SYNC)
 		return AUD_doesPlayback();
 	else
 		return -1;
@@ -668,7 +668,7 @@ int sound_scene_playing(struct Scene *scene)
 
 void sound_free_waveform(struct bSound* sound)
 {
-	if(sound->waveform)
+	if (sound->waveform)
 	{
 		MEM_freeN(((SoundWaveform*)sound->waveform)->data);
 		MEM_freeN(sound->waveform);
@@ -683,7 +683,7 @@ void sound_read_waveform(struct bSound* sound)
 
 	info = AUD_getInfo(sound->playback_handle);
 
-	if(info.length > 0)
+	if (info.length > 0)
 	{
 		SoundWaveform* waveform = MEM_mallocN(sizeof(SoundWaveform), "SoundWaveform");
 		int length = info.length * SOUND_WAVE_SAMPLES_PER_SECOND;
@@ -709,41 +709,39 @@ void sound_update_scene(struct Scene* scene)
 	void* handle;
 	float quat[4];
 
-	for(SETLOOPER(scene, sce_it, base))
+	for (SETLOOPER(scene, sce_it, base))
 	{
 		ob = base->object;
-		if(ob->type == OB_SPEAKER)
+		if (ob->type == OB_SPEAKER)
 		{
-			if(ob->adt)
+			if (ob->adt)
 			{
-				for(track = ob->adt->nla_tracks.first; track; track = track->next)
+				for (track = ob->adt->nla_tracks.first; track; track = track->next)
 				{
-					for(strip = track->strips.first; strip; strip = strip->next)
+					for (strip = track->strips.first; strip; strip = strip->next)
 					{
-						if(strip->type == NLASTRIP_TYPE_SOUND)
+						if (strip->type == NLASTRIP_TYPE_SOUND)
 						{
 							speaker = (Speaker*)ob->data;
 
-							if(AUD_removeSet(scene->speaker_handles, strip->speaker_handle))
+							if (AUD_removeSet(scene->speaker_handles, strip->speaker_handle))
 							{
-								if(speaker->sound)
+								if (speaker->sound)
 									AUD_moveSequence(strip->speaker_handle, strip->start / FPS, -1, 0);
-								else
-								{
+								else {
 									AUD_removeSequence(scene->sound_scene, strip->speaker_handle);
 									strip->speaker_handle = NULL;
 								}
 							}
-							else
-							{
-								if(speaker->sound)
+							else {
+								if (speaker->sound)
 								{
 									strip->speaker_handle = AUD_addSequence(scene->sound_scene, speaker->sound->playback_handle, strip->start / FPS, -1, 0);
 									AUD_setRelativeSequence(strip->speaker_handle, 0);
 								}
 							}
 
-							if(strip->speaker_handle)
+							if (strip->speaker_handle)
 							{
 								AUD_addSet(new_set, strip->speaker_handle);
 								AUD_updateSequenceData(strip->speaker_handle, speaker->volume_max,
@@ -767,12 +765,12 @@ void sound_update_scene(struct Scene* scene)
 		}
 	}
 
-	while((handle = AUD_getSet(scene->speaker_handles)))
+	while ((handle = AUD_getSet(scene->speaker_handles)))
 	{
 		AUD_removeSequence(scene->sound_scene, handle);
 	}
 
-	if(scene->camera)
+	if (scene->camera)
 	{
 		mat4_to_quat(quat, scene->camera->obmat);
 		AUD_setSequencerAnimData(scene->sound_scene, AUD_AP_LOCATION, CFRA, scene->camera->obmat[3], 1);
diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c
index d2c8a80..5466630 100644
--- a/source/blender/blenkernel/intern/speaker.c
+++ b/source/blender/blenkernel/intern/speaker.c
@@ -70,7 +70,7 @@ Speaker *copy_speaker(Speaker *spk)
 	Speaker *spkn;
 
 	spkn= copy_libblock(&spk->id);
-	if(spkn->sound)
+	if (spkn->sound)
 		spkn->sound->id.us++;
 
 	return spkn;
@@ -83,29 +83,29 @@ void make_local_speaker(Speaker *spk)
 	int is_local= FALSE, is_lib= FALSE;
 
 	/* - only lib users: do nothing
-		* - only local users: set flag
-		* - mixed: make copy
-		*/
+	 * - only local users: set flag
+	 * - mixed: make copy
+	 */
 
-	if(spk->id.lib==NULL) return;
-	if(spk->id.us==1) {
+	if (spk->id.lib==NULL) return;
+	if (spk->id.us==1) {
 		id_clear_lib_data(bmain, &spk->id);
 		return;
 	}
 
 	ob= bmain->object.first;
-	while(ob) {
-		if(ob->data==spk) {
-			if(ob->id.lib) is_lib= TRUE;
+	while (ob) {
+		if (ob->data==spk) {
+			if (ob->id.lib) is_lib= TRUE;
 			else is_local= TRUE;
 		}
 		ob= ob->id.next;
 	}
 
-	if(is_local && is_lib == FALSE) {
+	if (is_local && is_lib == FALSE) {
 		id_clear_lib_data(bmain, &spk->id);
 	}
-	else if(is_local && is_lib) {
+	else if (is_local && is_lib) {
 		Speaker *spk_new= copy_speaker(spk);
 		spk_new->id.us= 0;
 
@@ -113,10 +113,10 @@ void make_local_speaker(Speaker *spk)
 		BKE_id_lib_local_paths(bmain, spk->id.lib, &spk_new->id);
 
 		ob= bmain->object.first;
-		while(ob) {
-			if(ob->data==spk) {
+		while (ob) {
+			if (ob->data==spk) {
 
-				if(ob->id.lib==NULL) {
+				if (ob->id.lib==NULL) {
 					ob->data= spk_new;
 					spk_new->id.us++;
 					spk->id.us--;
@@ -129,7 +129,7 @@ void make_local_speaker(Speaker *spk)
 
 void free_speaker(Speaker *spk)
 {
-	if(spk->sound)
+	if (spk->sound)
 		spk->sound->id.us--;
 
 	BKE_free_animdata((ID *)spk);
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 4e88a48..83a24f6 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -45,6 +45,7 @@
 #include "DNA_scene_types.h"
 
 #include "BLI_utildefines.h"
+#include "BLI_bitmap.h"
 #include "BLI_blenlib.h"
 #include "BLI_edgehash.h"
 #include "BLI_math.h"
@@ -55,9 +56,14 @@
 #include "BKE_global.h"
 #include "BKE_mesh.h"
 #include "BKE_modifier.h"
+#include "BKE_multires.h"
 #include "BKE_paint.h"
 #include "BKE_scene.h"
 #include "BKE_subsurf.h"
+#include "BKE_tessmesh.h"
+
+#include "PIL_time.h"
+#include "BLI_array.h"
 
 #include "GL/glew.h"
 
@@ -69,42 +75,52 @@
 
 extern GLubyte stipple_quarttone[128]; /* glutil.c, bad level data */
 
-static int ccgDM_getVertMapIndex(CCGSubSurf *ss, CCGVert *v);
-static int ccgDM_getEdgeMapIndex(CCGSubSurf *ss, CCGEdge *e);
-static int ccgDM_getFaceMapIndex(CCGSubSurf *ss, CCGFace *f);
+static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
+                                         int drawInteriorEdges,
+                                         int useSubsurfUv,
+                                         DerivedMesh *dm);
 static int ccgDM_use_grid_pbvh(CCGDerivedMesh *ccgdm);
 
 ///
 
-static void *arena_alloc(CCGAllocatorHDL a, int numBytes) {
+static void *arena_alloc(CCGAllocatorHDL a, int numBytes)
+{
 	return BLI_memarena_alloc(a, numBytes);
 }
-static void *arena_realloc(CCGAllocatorHDL a, void *ptr, int newSize, int oldSize) {
+
+static void *arena_realloc(CCGAllocatorHDL a, void *ptr, int newSize, int oldSize)
+{
 	void *p2 = BLI_memarena_alloc(a, newSize);
 	if (ptr) {
 		memcpy(p2, ptr, oldSize);
 	}
 	return p2;
 }
-static void arena_free(CCGAllocatorHDL UNUSED(a), void *UNUSED(ptr)) {
+
+static void arena_free(CCGAllocatorHDL UNUSED(a), void *UNUSED(ptr))
+{
+	/* do nothing */
 }
-static void arena_release(CCGAllocatorHDL a) {
+
+static void arena_release(CCGAllocatorHDL a)
+{
 	BLI_memarena_free(a);
 }
 
 typedef enum {
 	CCG_USE_AGING = 1,
 	CCG_USE_ARENA = 2,
-	CCG_CALC_NORMALS = 4,
+	CCG_CALC_NORMALS = 4
 } CCGFlags;
 
-static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, CCGFlags flags) {
+static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, CCGFlags flags)
+{
 	CCGMeshIFC ifc;
 	CCGSubSurf *ccgSS;
 	int useAging = !!(flags & CCG_USE_AGING);
 	int useArena = flags & CCG_USE_ARENA;
 
-		/* subdivLevels==0 is not allowed */
+	/* subdivLevels==0 is not allowed */
 	subdivLevels = MAX2(subdivLevels, 1);
 
 	if (prevSS) {
@@ -112,9 +128,10 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, CCGFlags fl
 
 		ccgSubSurf_getUseAgeCounts(prevSS, &oldUseAging, NULL, NULL, NULL);
 
-		if (oldUseAging!=useAging) {
+		if (oldUseAging != useAging) {
 			ccgSubSurf_free(prevSS);
-		} else {
+		}
+		else {
 			ccgSubSurf_setSubdivisionLevels(prevSS, subdivLevels);
 
 			return prevSS;
@@ -123,14 +140,15 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, CCGFlags fl
 
 	if (useAging) {
 		ifc.vertUserSize = ifc.edgeUserSize = ifc.faceUserSize = 12;
-	} else {
+	}
+	else {
 		ifc.vertUserSize = ifc.edgeUserSize = ifc.faceUserSize = 8;
 	}
 	ifc.vertDataSize = sizeof(float) * (flags & CCG_CALC_NORMALS ? 6 : 3);
 
 	if (useArena) {
 		CCGAllocatorIFC allocatorIFC;
-		CCGAllocatorHDL allocator = BLI_memarena_new((1<<16), "subsurf arena");
+		CCGAllocatorHDL allocator = BLI_memarena_new((1 << 16), "subsurf arena");
 
 		allocatorIFC.alloc = arena_alloc;
 		allocatorIFC.realloc = arena_realloc;
@@ -138,7 +156,8 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, CCGFlags fl
 		allocatorIFC.release = arena_release;
 
 		ccgSS = ccgSubSurf_new(&ifc, subdivLevels, &allocatorIFC, allocator);
-	} else {
+	}
+	else {
 		ccgSS = ccgSubSurf_new(&ifc, subdivLevels, NULL, NULL);
 	}
 
@@ -154,113 +173,130 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, CCGFlags fl
 	return ccgSS;
 }
 
-static int getEdgeIndex(CCGSubSurf *ss, CCGEdge *e, int x, int edgeSize) {
+static int getEdgeIndex(CCGSubSurf *ss, CCGEdge *e, int x, int edgeSize)
+{
 	CCGVert *v0 = ccgSubSurf_getEdgeVert0(e);
 	CCGVert *v1 = ccgSubSurf_getEdgeVert1(e);
-	int v0idx = *((int*) ccgSubSurf_getVertUserData(ss, v0));
-	int v1idx = *((int*) ccgSubSurf_getVertUserData(ss, v1));
-	int edgeBase = *((int*) ccgSubSurf_getEdgeUserData(ss, e));
+	int v0idx = *((int *) ccgSubSurf_getVertUserData(ss, v0));
+	int v1idx = *((int *) ccgSubSurf_getVertUserData(ss, v1));
+	int edgeBase = *((int *) ccgSubSurf_getEdgeUserData(ss, e));
 
-	if (x==0) {
+	if (x == 0) {
 		return v0idx;
-	} else if (x==edgeSize-1) {
+	}
+	else if (x == edgeSize - 1) {
 		return v1idx;
-	} else {
-		return edgeBase + x-1;
+	}
+	else {
+		return edgeBase + x - 1;
 	}
 }
-static int getFaceIndex(CCGSubSurf *ss, CCGFace *f, int S, int x, int y, int edgeSize, int gridSize) {
-	int faceBase = *((int*) ccgSubSurf_getFaceUserData(ss, f));
+
+static int getFaceIndex(CCGSubSurf *ss, CCGFace *f, int S, int x, int y, int edgeSize, int gridSize)
+{
+	int faceBase = *((int *) ccgSubSurf_getFaceUserData(ss, f));
 	int numVerts = ccgSubSurf_getFaceNumVerts(f);
 
-	if (x==gridSize-1 && y==gridSize-1) {
-		CCGVert *v = ccgSubSurf_getFaceVert(ss, f, S);
-		return *((int*) ccgSubSurf_getVertUserData(ss, v));
-	} else if (x==gridSize-1) {
-		CCGVert *v = ccgSubSurf_getFaceVert(ss, f, S);
-		CCGEdge *e = ccgSubSurf_getFaceEdge(ss, f, S);
-		int edgeBase = *((int*) ccgSubSurf_getEdgeUserData(ss, e));
-		if (v==ccgSubSurf_getEdgeVert0(e)) {
-			return edgeBase + (gridSize-1-y)-1;
-		} else {
-			return edgeBase + (edgeSize-2-1)-((gridSize-1-y)-1);
-		}
-	} else if (y==gridSize-1) {
-		CCGVert *v = ccgSubSurf_getFaceVert(ss, f, S);
-		CCGEdge *e = ccgSubSurf_getFaceEdge(ss, f, (S+numVerts-1)%numVerts);
-		int edgeBase = *((int*) ccgSubSurf_getEdgeUserData(ss, e));
-		if (v==ccgSubSurf_getEdgeVert0(e)) {
-			return edgeBase + (gridSize-1-x)-1;
-		} else {
-			return edgeBase + (edgeSize-2-1)-((gridSize-1-x)-1);
-		}
-	} else if (x==0 && y==0) {
+	if (x == gridSize - 1 && y == gridSize - 1) {
+		CCGVert *v = ccgSubSurf_getFaceVert(f, S);
+		return *((int *) ccgSubSurf_getVertUserData(ss, v));
+	}
+	else if (x == gridSize - 1) {
+		CCGVert *v = ccgSubSurf_getFaceVert(f, S);
+		CCGEdge *e = ccgSubSurf_getFaceEdge(f, S);
+		int edgeBase = *((int *) ccgSubSurf_getEdgeUserData(ss, e));
+		if (v == ccgSubSurf_getEdgeVert0(e)) {
+			return edgeBase + (gridSize - 1 - y) - 1;
+		}
+		else {
+			return edgeBase + (edgeSize - 2 - 1) - ((gridSize - 1 - y) - 1);
+		}
+	}
+	else if (y == gridSize - 1) {
+		CCGVert *v = ccgSubSurf_getFaceVert(f, S);
+		CCGEdge *e = ccgSubSurf_getFaceEdge(f, (S + numVerts - 1) % numVerts);
+		int edgeBase = *((int *) ccgSubSurf_getEdgeUserData(ss, e));
+		if (v == ccgSubSurf_getEdgeVert0(e)) {
+			return edgeBase + (gridSize - 1 - x) - 1;
+		}
+		else {
+			return edgeBase + (edgeSize - 2 - 1) - ((gridSize - 1 - x) - 1);
+		}
+	}
+	else if (x == 0 && y == 0) {
 		return faceBase;
-	} else if (x==0) {
-		S = (S+numVerts-1)%numVerts;
-		return faceBase + 1 + (gridSize-2)*S + (y-1);
-	} else if (y==0) {
-		return faceBase + 1 + (gridSize-2)*S + (x-1);
-	} else {
-		return faceBase + 1 + (gridSize-2)*numVerts + S*(gridSize-2)*(gridSize-2) + (y-1)*(gridSize-2) + (x-1);
+	}
+	else if (x == 0) {
+		S = (S + numVerts - 1) % numVerts;
+		return faceBase + 1 + (gridSize - 2) * S + (y - 1);
+	}
+	else if (y == 0) {
+		return faceBase + 1 + (gridSize - 2) * S + (x - 1);
+	}
+	else {
+		return faceBase + 1 + (gridSize - 2) * numVerts + S * (gridSize - 2) * (gridSize - 2) + (y - 1) * (gridSize - 2) + (x - 1);
 	}
 }
 
-static void get_face_uv_map_vert(UvVertMap *vmap, struct MFace *mf, int fi, CCGVertHDL *fverts) {
-	unsigned int *fv = &mf->v1;
+static void get_face_uv_map_vert(UvVertMap *vmap, struct MPoly *mpoly, struct MLoop *ml, int fi, CCGVertHDL *fverts)
+{
 	UvMapVert *v, *nv;
-	int j, nverts= mf->v4? 4: 3;
+	int j, nverts = mpoly[fi].totloop;
 
-	for (j=0; j<nverts; j++, fv++) {
-		for (nv=v=get_uv_map_vert(vmap, *fv); v; v=v->next) {
+	for (j = 0; j < nverts; j++) {
+		for (nv = v = get_uv_map_vert(vmap, ml[j].v); v; v = v->next) {
 			if (v->separate)
-				nv= v;
+				nv = v;
 			if (v->f == fi)
 				break;
 		}
 
-		fverts[j]= SET_INT_IN_POINTER(nv->f*4 + nv->tfindex);
+		fverts[j] = SET_INT_IN_POINTER(mpoly[nv->f].loopstart + nv->tfindex);
 	}
 }
 
-static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, MTFace *tface) {
-	MFace *mface = dm->getFaceArray(dm);
+static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, MLoopUV *mloopuv)
+{
+	MPoly *mpoly = dm->getPolyArray(dm);
+	MLoop *mloop = dm->getLoopArray(dm);
 	MVert *mvert = dm->getVertArray(dm);
 	int totvert = dm->getNumVerts(dm);
-	int totface = dm->getNumFaces(dm);
+	int totface = dm->getNumPolys(dm);
 	int i, j, seam;
 	UvMapVert *v;
 	UvVertMap *vmap;
 	float limit[2];
-	CCGVertHDL fverts[4];
+	CCGVertHDL *fverts = NULL;
+	BLI_array_declare(fverts);
 	EdgeHash *ehash;
 	float creaseFactor = (float)ccgSubSurf_getSubdivisionLevels(ss);
-	float uv[3]= {0.0f, 0.0f, 0.0f}; /* only first 2 values are written into */
+	float uv[3] = {0.0f, 0.0f, 0.0f}; /* only first 2 values are written into */
 
-	limit[0]= limit[1]= STD_UV_CONNECT_LIMIT;
-	vmap= make_uv_vert_map(mface, tface, totface, totvert, 0, limit);
+	limit[0] = limit[1] = STD_UV_CONNECT_LIMIT;
+	vmap = make_uv_vert_map(mpoly, mloop, mloopuv, totface, totvert, 0, limit);
 	if (!vmap)
 		return 0;
 	
 	ccgSubSurf_initFullSync(ss);
 
 	/* create vertices */
-	for (i=0; i<totvert; i++) {
+	for (i = 0; i < totvert; i++) {
 		if (!get_uv_map_vert(vmap, i))
 			continue;
 
-		for (v=get_uv_map_vert(vmap, i)->next; v; v=v->next)
+		for (v = get_uv_map_vert(vmap, i)->next; v; v = v->next)
 			if (v->separate)
 				break;
 
-		seam = (v != NULL) || ((mvert+i)->flag & ME_VERT_MERGED);
+		seam = (v != NULL) || ((mvert + i)->flag & ME_VERT_MERGED);
 
-		for (v=get_uv_map_vert(vmap, i); v; v=v->next) {
+		for (v = get_uv_map_vert(vmap, i); v; v = v->next) {
 			if (v->separate) {
 				CCGVert *ssv;
-				CCGVertHDL vhdl = SET_INT_IN_POINTER(v->f*4 + v->tfindex);
+				int loopid = mpoly[v->f].loopstart + v->tfindex;
+				CCGVertHDL vhdl = SET_INT_IN_POINTER(loopid);
 
-				copy_v2_v2(uv, (tface+v->f)->uv[v->tfindex]);
+				copy_v2_v2(uv, mloopuv[loopid].uv);
 
 				ccgSubSurf_syncVert(ss, vhdl, uv, seam, &ssv);
 			}
@@ -270,31 +306,35 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm,
 	/* create edges */
 	ehash = BLI_edgehash_new();
 
-	for (i=0; i<totface; i++) {
-		MFace *mf = &((MFace*) mface)[i];
-		int nverts= mf->v4? 4: 3;
-		CCGFace *origf= ccgSubSurf_getFace(origss, SET_INT_IN_POINTER(i));
-		unsigned int *fv = &mf->v1;
+	for (i = 0; i < totface; i++) {
+		MPoly *mp = &((MPoly *) mpoly)[i];
+		int nverts = mp->totloop;
+		CCGFace *origf = ccgSubSurf_getFace(origss, SET_INT_IN_POINTER(i));
+		/* unsigned int *fv = &mp->v1; */
+		MLoop *ml = mloop + mp->loopstart;
+
+		BLI_array_empty(fverts);
+		BLI_array_growitems(fverts, nverts);
 
-		get_face_uv_map_vert(vmap, mf, i, fverts);
+		get_face_uv_map_vert(vmap, mpoly, ml, i, fverts);
 
-		for (j=0; j<nverts; j++) {
+		for (j = 0; j < nverts; j++) {
 			int v0 = GET_INT_FROM_POINTER(fverts[j]);
-			int v1 = GET_INT_FROM_POINTER(fverts[(j+1)%nverts]);
-			MVert *mv0 = mvert + *(fv+j);
-			MVert *mv1 = mvert + *(fv+((j+1)%nverts));
+			int v1 = GET_INT_FROM_POINTER(fverts[(j + 1) % nverts]);
+			MVert *mv0 = mvert + (ml[j].v);
+			MVert *mv1 = mvert + (ml[((j + 1) % nverts)].v);
 
 			if (!BLI_edgehash_haskey(ehash, v0, v1)) {
-				CCGEdge *e, *orige= ccgSubSurf_getFaceEdge(origss, origf, j);
-				CCGEdgeHDL ehdl= SET_INT_IN_POINTER(i*4 + j);
+				CCGEdge *e, *orige = ccgSubSurf_getFaceEdge(origf, j);
+				CCGEdgeHDL ehdl = SET_INT_IN_POINTER(mp->loopstart + j);
 				float crease;
 
-				if ((mv0->flag&mv1->flag) & ME_VERT_MERGED)
+				if ((mv0->flag & mv1->flag) & ME_VERT_MERGED)
 					crease = creaseFactor;
 				else
 					crease = ccgSubSurf_getEdgeCrease(orige);
 
-				ccgSubSurf_syncEdge(ss, ehdl, fverts[j], fverts[(j+1)%nverts], crease, &e);
+				ccgSubSurf_syncEdge(ss, ehdl, fverts[j], fverts[(j + 1) % nverts], crease, &e);
 				BLI_edgehash_insert(ehash, v0, v1, NULL);
 			}
 		}
@@ -303,15 +343,21 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm,
 	BLI_edgehash_free(ehash, NULL);
 
 	/* create faces */
-	for (i=0; i<totface; i++) {
-		MFace *mf = &((MFace*) mface)[i];
-		int nverts= mf->v4? 4: 3;
+	for (i = 0; i < totface; i++) {
+		MPoly *mp = &mpoly[i];
+		MLoop *ml = &mloop[mp->loopstart];
+		int nverts = mp->totloop;
 		CCGFace *f;
 
-		get_face_uv_map_vert(vmap, mf, i, fverts);
+		BLI_array_empty(fverts);
+		BLI_array_growitems(fverts, nverts);
+
+		get_face_uv_map_vert(vmap, mpoly, ml, i, fverts);
 		ccgSubSurf_syncFace(ss, SET_INT_IN_POINTER(i), nverts, fverts, &f);
 	}
 
+	BLI_array_free(fverts);
+
 	free_uv_vert_map(vmap);
 	ccgSubSurf_processSync(ss);
 
@@ -323,18 +369,22 @@ static void set_subsurf_uv(CCGSubSurf *ss, DerivedMesh *dm, DerivedMesh *result,
 	CCGSubSurf *uvss;
 	CCGFace **faceMap;
 	MTFace *tf;
+	MLoopUV *mluv;
 	CCGFaceIterator *fi;
 	int index, gridSize, gridFaces, /*edgeSize,*/ totface, x, y, S;
-	MTFace *dmtface = CustomData_get_layer_n(&dm->faceData, CD_MTFACE, n);
+	MLoopUV *dmloopuv = CustomData_get_layer_n(&dm->loopData, CD_MLOOPUV, n);
+	/* need to update both CD_MTFACE & CD_MLOOPUV, hrmf, we could get away with
+	 * just tface except applying the modifier then looses subsurf UV */
 	MTFace *tface = CustomData_get_layer_n(&result->faceData, CD_MTFACE, n);
+	MLoopUV *mloopuv = CustomData_get_layer_n(&result->loopData, CD_MLOOPUV, n);
 
-	if(!dmtface || !tface)
+	if (!dmloopuv || (!tface && !mloopuv))
 		return;
 
 	/* create a CCGSubSurf from uv's */
 	uvss = _getSubSurf(NULL, ccgSubSurf_getSubdivisionLevels(ss), CCG_USE_ARENA);
 
-	if(!ss_sync_from_uv(uvss, ss, dm, dmtface)) {
+	if (!ss_sync_from_uv(uvss, ss, dm, dmloopuv)) {
 		ccgSubSurf_free(uvss);
 		return;
 	}
@@ -346,33 +396,49 @@ static void set_subsurf_uv(CCGSubSurf *ss, DerivedMesh *dm, DerivedMesh *result,
 	gridFaces = gridSize - 1;
 
 	/* make a map from original faces to CCGFaces */
-	faceMap = MEM_mallocN(totface*sizeof(*faceMap), "facemapuv");
+	faceMap = MEM_mallocN(totface * sizeof(*faceMap), "facemapuv");
 
 	fi = ccgSubSurf_getFaceIterator(uvss);
-	for(; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
+	for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
 		CCGFace *f = ccgFaceIterator_getCurrent(fi);
-		faceMap[GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(uvss, f))] = f;
+		faceMap[GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f))] = f;
 	}
 	ccgFaceIterator_free(fi);
 
 	/* load coordinates from uvss into tface */
-	tf= tface;
+	tf = tface;
+	mluv = mloopuv;
 
-	for(index = 0; index < totface; index++) {
+	for (index = 0; index < totface; index++) {
 		CCGFace *f = faceMap[index];
 		int numVerts = ccgSubSurf_getFaceNumVerts(f);
 
-		for (S=0; S<numVerts; S++) {
-			float (*faceGridData)[3]= ccgSubSurf_getFaceGridDataArray(uvss, f, S);
+		for (S = 0; S < numVerts; S++) {
+			float (*faceGridData)[3] = ccgSubSurf_getFaceGridDataArray(uvss, f, S);
+
+			for (y = 0; y < gridFaces; y++) {
+				for (x = 0; x < gridFaces; x++) {
+					float *a = faceGridData[(y + 0) * gridSize + x + 0];
+					float *b = faceGridData[(y + 0) * gridSize + x + 1];
+					float *c = faceGridData[(y + 1) * gridSize + x + 1];
+					float *d = faceGridData[(y + 1) * gridSize + x + 0];
+
+					if (tf) {
+						copy_v2_v2(tf->uv[0], a);
+						copy_v2_v2(tf->uv[1], d);
+						copy_v2_v2(tf->uv[2], c);
+						copy_v2_v2(tf->uv[3], b);
+						tf++;
+					}
 
-			for(y = 0; y < gridFaces; y++) {
-				for(x = 0; x < gridFaces; x++) {
-					copy_v2_v2(tf->uv[0], faceGridData[(y + 0)*gridSize + x + 0]);
-					copy_v2_v2(tf->uv[1], faceGridData[(y + 1)*gridSize + x + 0]);
-					copy_v2_v2(tf->uv[2], faceGridData[(y + 1)*gridSize + x + 1]);
-					copy_v2_v2(tf->uv[3], faceGridData[(y + 0)*gridSize + x + 1]);
+					if (mluv) {
+						copy_v2_v2(mluv[0].uv, a);
+						copy_v2_v2(mluv[1].uv, d);
+						copy_v2_v2(mluv[2].uv, c);
+						copy_v2_v2(mluv[3].uv, b);
+						mluv += 4;
+					}
 
-					tf++;
 				}
 			}
 		}
@@ -383,116 +449,156 @@ static void set_subsurf_uv(CCGSubSurf *ss, DerivedMesh *dm, DerivedMesh *result,
 }
 
 /* face weighting */
-static void calc_ss_weights(int gridFaces,
-							FaceVertWeight **qweight, FaceVertWeight **tweight)
-{
-	FaceVertWeight *qw, *tw;
-	int x, y, j;
-	int numWeights = gridFaces * gridFaces;
-
-	*tweight = MEM_mallocN(sizeof(**tweight) * numWeights, "ssTriWeight");
-	*qweight = MEM_mallocN(sizeof(**qweight) * numWeights, "ssQuadWeight");
-
-	qw = *qweight;
-	tw = *tweight;
-
-	for (y = 0; y < gridFaces; y++) {
-		for (x = 0; x < gridFaces; x++) {
-			for (j = 0; j < 4; j++) {
-				int fx = x + (j == 2 || j == 3);
-				int fy = y + (j == 1 || j == 2);
-				float x_v = (float) fx / gridFaces;
-				float y_v = (float) fy / gridFaces;
-				float tx_v = (1.0f - x_v), ty_v = (1.0f - y_v);
-				float center = (1.0f / 3.0f) * tx_v * ty_v;
-
-				(*tw)[j][0] = center + 0.5f * tx_v * y_v;
-				(*tw)[j][2] = center + 0.5f * x_v * ty_v;
-				(*tw)[j][1] = 1.0f - (*tw)[j][0] - (*tw)[j][2];
-				(*tw)[j][3] = 0.0f;
-
-				tx_v *= 0.5f;
-				ty_v *= 0.5f;
-
-				(*qw)[j][3] = tx_v * ty_v;
-				(*qw)[j][0] = (*qw)[j][3] + tx_v * y_v;
-				(*qw)[j][2] = (*qw)[j][3] + x_v * ty_v;
-				(*qw)[j][1] = 1.0f - (*qw)[j][0] - (*qw)[j][2] - (*qw)[j][3];
+typedef struct FaceVertWeightEntry {
+	FaceVertWeight *weight;
+	float *w;
+	int valid;
+} FaceVertWeightEntry;
+
+typedef struct WeightTable {
+	FaceVertWeightEntry *weight_table;
+	int len;
+} WeightTable;
+
+static float *get_ss_weights(WeightTable *wtable, int gridCuts, int faceLen)
+{
+	int x, y, i, j;
+	float *w, w1, w2, w4, fac, fac2, fx, fy;
+
+	if (wtable->len <= faceLen) {
+		void *tmp = MEM_callocN(sizeof(FaceVertWeightEntry) * (faceLen + 1), "weight table alloc 2");
+		
+		if (wtable->len) {
+			memcpy(tmp, wtable->weight_table, sizeof(FaceVertWeightEntry) * wtable->len);
+			MEM_freeN(wtable->weight_table);
+		}
+		
+		wtable->weight_table = tmp;
+		wtable->len = faceLen + 1;
+	}
 
+	if (!wtable->weight_table[faceLen].valid) {
+		wtable->weight_table[faceLen].valid = 1;
+		wtable->weight_table[faceLen].w = w = MEM_callocN(sizeof(float) * faceLen * faceLen * (gridCuts + 2) * (gridCuts + 2), "weight table alloc");
+		fac = 1.0f / (float)faceLen;
+
+		for (i = 0; i < faceLen; i++) {
+			for (x = 0; x < gridCuts + 2; x++) {
+				for (y = 0; y < gridCuts + 2; y++) {
+					fx = 0.5f - (float)x / (float)(gridCuts + 1) / 2.0f;
+					fy = 0.5f - (float)y / (float)(gridCuts + 1) / 2.0f;
+				
+					fac2 = faceLen - 4;
+					w1 = (1.0f - fx) * (1.0f - fy) + (-fac2 * fx * fy * fac);
+					w2 = (1.0f - fx + fac2 * fx * -fac) * (fy);
+					w4 = (fx) * (1.0f - fy + -fac2 * fy * fac);
+
+					fac2 = 1.0f - (w1 + w2 + w4);
+					fac2 = fac2 / (float)(faceLen - 3);
+					for (j = 0; j < faceLen; j++)
+						w[j] = fac2;
+					
+					w[i] = w1;
+					w[(i - 1 + faceLen) % faceLen] = w2;
+					w[(i + 1) % faceLen] = w4;
+
+					w += faceLen;
+				}
 			}
-			tw++;
-			qw++;
 		}
 	}
+
+	return wtable->weight_table[faceLen].w;
+}
+
+static void free_ss_weights(WeightTable *wtable)
+{
+	int i;
+
+	for (i = 0; i < wtable->len; i++) {
+		if (wtable->weight_table[i].valid)
+			MEM_freeN(wtable->weight_table[i].w);
+	}
+	
+	if (wtable->weight_table)
+		MEM_freeN(wtable->weight_table);
 }
 
 static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm,
-									 float (*vertexCos)[3], int useFlatSubdiv)
+                                     float (*vertexCos)[3], int useFlatSubdiv)
 {
 	float creaseFactor = (float) ccgSubSurf_getSubdivisionLevels(ss);
-	CCGVertHDL fVerts[4];
-	int totvert = dm->getNumVerts(dm);
-	int totedge = dm->getNumEdges(dm);
-	int totface = dm->getNumFaces(dm);
-	int i;
-	int *index;
+	CCGVertHDL *fVerts = NULL;
+	BLI_array_declare(fVerts);
 	MVert *mvert = dm->getVertArray(dm);
 	MEdge *medge = dm->getEdgeArray(dm);
-	MFace *mface = dm->getFaceArray(dm);
+	/* MFace *mface = dm->getTessFaceArray(dm); */ /* UNUSED */
 	MVert *mv;
 	MEdge *me;
-	MFace *mf;
+	MLoop *mloop = dm->getLoopArray(dm), *ml;
+	MPoly *mpoly = dm->getPolyArray(dm), *mp;
+	/*MFace *mf;*/ /*UNUSED*/
+	int totvert = dm->getNumVerts(dm);
+	int totedge = dm->getNumEdges(dm);
+	/*int totface = dm->getNumTessFaces(dm);*/ /*UNUSED*/
+	/*int totpoly = dm->getNumFaces(dm);*/ /*UNUSED*/
+	int i, j;
+	int *index;
 
 	ccgSubSurf_initFullSync(ss);
 
 	mv = mvert;
 	index = (int *)dm->getVertDataArray(dm, CD_ORIGINDEX);
-	for(i = 0; i < totvert; i++, mv++) {
+	for (i = 0; i < totvert; i++, mv++) {
 		CCGVert *v;
 
-		if(vertexCos) {
+		if (vertexCos) {
 			ccgSubSurf_syncVert(ss, SET_INT_IN_POINTER(i), vertexCos[i], 0, &v);
-		} else {
+		}
+		else {
 			ccgSubSurf_syncVert(ss, SET_INT_IN_POINTER(i), mv->co, 0, &v);
 		}
 
-		((int*)ccgSubSurf_getVertUserData(ss, v))[1] = (index)? *index++: i;
+		((int *)ccgSubSurf_getVertUserData(ss, v))[1] = (index) ? *index++ : i;
 	}
 
 	me = medge;
 	index = (int *)dm->getEdgeDataArray(dm, CD_ORIGINDEX);
-	for(i = 0; i < totedge; i++, me++) {
+	for (i = 0; i < totedge; i++, me++) {
 		CCGEdge *e;
 		float crease;
 
 		crease = useFlatSubdiv ? creaseFactor :
-								 me->crease * creaseFactor / 255.0f;
+		         me->crease * creaseFactor / 255.0f;
 
 		ccgSubSurf_syncEdge(ss, SET_INT_IN_POINTER(i), SET_INT_IN_POINTER(me->v1),
-							SET_INT_IN_POINTER(me->v2), crease, &e);
+		                    SET_INT_IN_POINTER(me->v2), crease, &e);
 
-		((int*)ccgSubSurf_getEdgeUserData(ss, e))[1] = (index)? *index++: i;
+		((int *)ccgSubSurf_getEdgeUserData(ss, e))[1] = (index) ? *index++ : i;
 	}
 
-	mf = mface;
-	index = (int *)dm->getFaceDataArray(dm, CD_ORIGINDEX);
-	for (i = 0; i < totface; i++, mf++) {
+	mp = mpoly;
+	index = DM_get_poly_data_layer(dm, CD_ORIGINDEX);
+	for (i = 0; i < dm->numPolyData; i++, mp++) {
 		CCGFace *f;
 
-		fVerts[0] = SET_INT_IN_POINTER(mf->v1);
-		fVerts[1] = SET_INT_IN_POINTER(mf->v2);
-		fVerts[2] = SET_INT_IN_POINTER(mf->v3);
-		fVerts[3] = SET_INT_IN_POINTER(mf->v4);
+		BLI_array_empty(fVerts);
+		BLI_array_growitems(fVerts, mp->totloop);
+
+		ml = mloop + mp->loopstart;
+		for (j = 0; j < mp->totloop; j++, ml++) {
+			fVerts[j] = SET_INT_IN_POINTER(ml->v);
+		}
 
 		/* this is very bad, means mesh is internally inconsistent.
 		 * it is not really possible to continue without modifying
 		 * other parts of code significantly to handle missing faces.
 		 * since this really shouldn't even be possible we just bail.*/
-		if(ccgSubSurf_syncFace(ss, SET_INT_IN_POINTER(i), fVerts[3] ? 4 : 3,
-							   fVerts, &f) == eCCGError_InvalidValue) {
+		if (ccgSubSurf_syncFace(ss, SET_INT_IN_POINTER(i), mp->totloop,
+		                        fVerts, &f) == eCCGError_InvalidValue) {
 			static int hasGivenError = 0;
 
-			if(!hasGivenError) {
+			if (!hasGivenError) {
 				//XXX error("Unrecoverable error in SubSurf calculation,"
 				//      " mesh is inconsistent.");
 
@@ -502,28 +608,34 @@ static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm,
 			return;
 		}
 
-		((int*)ccgSubSurf_getFaceUserData(ss, f))[1] = (index)? *index++: i;
+		((int *)ccgSubSurf_getFaceUserData(ss, f))[1] = (index) ? *index++ : i;
 	}
 
 	ccgSubSurf_processSync(ss);
+
+	BLI_array_free(fVerts);
 }
 
 /***/
 
-static int ccgDM_getVertMapIndex(CCGSubSurf *ss, CCGVert *v) {
-	return ((int*) ccgSubSurf_getVertUserData(ss, v))[1];
+static int ccgDM_getVertMapIndex(CCGSubSurf *ss, CCGVert *v)
+{
+	return ((int *) ccgSubSurf_getVertUserData(ss, v))[1];
 }
 
-static int ccgDM_getEdgeMapIndex(CCGSubSurf *ss, CCGEdge *e) {
-	return ((int*) ccgSubSurf_getEdgeUserData(ss, e))[1];
+static int ccgDM_getEdgeMapIndex(CCGSubSurf *ss, CCGEdge *e)
+{
+	return ((int *) ccgSubSurf_getEdgeUserData(ss, e))[1];
 }
 
-static int ccgDM_getFaceMapIndex(CCGSubSurf *ss, CCGFace *f) {
-	return ((int*) ccgSubSurf_getFaceUserData(ss, f))[1];
+static int ccgDM_getFaceMapIndex(CCGSubSurf *ss, CCGFace *f)
+{
+	return ((int *) ccgSubSurf_getFaceUserData(ss, f))[1];
 }
 
-static void ccgDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3]) {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+static void ccgDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3])
+{
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 	CCGSubSurf *ss = ccgdm->ss;
 	CCGVertIterator *vi = ccgSubSurf_getVertIterator(ss);
 	CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss);
@@ -545,7 +657,7 @@ static void ccgDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3]) {
 		CCGEdge *e = ccgEdgeIterator_getCurrent(ei);
 		DMGridData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e);
 
-		for (i=0; i<edgeSize; i++)
+		for (i = 0; i < edgeSize; i++)
 			DO_MINMAX(edgeData[i].co, min_r, max_r);
 	}
 
@@ -553,12 +665,12 @@ static void ccgDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3]) {
 		CCGFace *f = ccgFaceIterator_getCurrent(fi);
 		int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
 
-		for (S=0; S<numVerts; S++) {
+		for (S = 0; S < numVerts; S++) {
 			DMGridData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S);
 
-			for (y=0; y<gridSize; y++)
-				for (x=0; x<gridSize; x++)
-					DO_MINMAX(faceGridData[y*gridSize + x].co, min_r, max_r);
+			for (y = 0; y < gridSize; y++)
+				for (x = 0; x < gridSize; x++)
+					DO_MINMAX(faceGridData[y * gridSize + x].co, min_r, max_r);
 		}
 	}
 
@@ -566,32 +678,46 @@ static void ccgDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3]) {
 	ccgEdgeIterator_free(ei);
 	ccgVertIterator_free(vi);
 }
-static int ccgDM_getNumVerts(DerivedMesh *dm) {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+
+static int ccgDM_getNumVerts(DerivedMesh *dm)
+{
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 
 	return ccgSubSurf_getNumFinalVerts(ccgdm->ss);
 }
-static int ccgDM_getNumEdges(DerivedMesh *dm) {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+
+static int ccgDM_getNumEdges(DerivedMesh *dm)
+{
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 
 	return ccgSubSurf_getNumFinalEdges(ccgdm->ss);
 }
-static int ccgDM_getNumFaces(DerivedMesh *dm) {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+
+static int ccgDM_getNumTessFaces(DerivedMesh *dm)
+{
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 
 	return ccgSubSurf_getNumFinalFaces(ccgdm->ss);
 }
 
+static int ccgDM_getNumLoops(DerivedMesh *dm)
+{
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
+
+	/* All subsurf faces are quads */
+	return 4 * ccgSubSurf_getNumFinalFaces(ccgdm->ss);
+}
+
 static void ccgDM_getFinalVert(DerivedMesh *dm, int vertNum, MVert *mv)
 {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 	CCGSubSurf *ss = ccgdm->ss;
 	DMGridData *vd;
 	int i;
 
 	memset(mv, 0, sizeof(*mv));
 
-	if((vertNum < ccgdm->edgeMap[0].startVert) && (ccgSubSurf_getNumFaces(ss) > 0)) {
+	if ((vertNum < ccgdm->edgeMap[0].startVert) && (ccgSubSurf_getNumFaces(ss) > 0)) {
 		/* this vert comes from face data */
 		int lastface = ccgSubSurf_getNumFaces(ss) - 1;
 		CCGFace *f;
@@ -604,7 +730,7 @@ static void ccgDM_getFinalVert(DerivedMesh *dm, int vertNum, MVert *mv)
 		int gridInternalEnd;
 
 		i = 0;
-		while(i < lastface && vertNum >= ccgdm->faceMap[i + 1].startVert)
+		while (i < lastface && vertNum >= ccgdm->faceMap[i + 1].startVert)
 			++i;
 
 		f = ccgdm->faceMap[i].face;
@@ -617,18 +743,20 @@ static void ccgDM_getFinalVert(DerivedMesh *dm, int vertNum, MVert *mv)
 		gridInternalEnd = gridSideEnd + numVerts * gridInternalVerts;
 
 		offset = vertNum - ccgdm->faceMap[i].startVert;
-		if(offset < 1) {
+		if (offset < 1) {
 			vd = ccgSubSurf_getFaceCenterData(f);
 			copy_v3_v3(mv->co, vd->co);
 			normal_float_to_short_v3(mv->no, vd->no);
-		} else if(offset < gridSideEnd) {
+		}
+		else if (offset < gridSideEnd) {
 			offset -= 1;
 			grid = offset / gridSideVerts;
 			x = offset % gridSideVerts + 1;
 			vd = ccgSubSurf_getFaceGridEdgeData(ss, f, grid, x);
 			copy_v3_v3(mv->co, vd->co);
 			normal_float_to_short_v3(mv->no, vd->no);
-		} else if(offset < gridInternalEnd) {
+		}
+		else if (offset < gridInternalEnd) {
 			offset -= gridSideEnd;
 			grid = offset / gridInternalVerts;
 			offset %= gridInternalVerts;
@@ -638,14 +766,15 @@ static void ccgDM_getFinalVert(DerivedMesh *dm, int vertNum, MVert *mv)
 			copy_v3_v3(mv->co, vd->co);
 			normal_float_to_short_v3(mv->no, vd->no);
 		}
-	} else if((vertNum < ccgdm->vertMap[0].startVert) && (ccgSubSurf_getNumEdges(ss) > 0)) {
+	}
+	else if ((vertNum < ccgdm->vertMap[0].startVert) && (ccgSubSurf_getNumEdges(ss) > 0)) {
 		/* this vert comes from edge data */
 		CCGEdge *e;
 		int lastedge = ccgSubSurf_getNumEdges(ss) - 1;
 		int x;
 
 		i = 0;
-		while(i < lastedge && vertNum >= ccgdm->edgeMap[i + 1].startVert)
+		while (i < lastedge && vertNum >= ccgdm->edgeMap[i + 1].startVert)
 			++i;
 
 		e = ccgdm->edgeMap[i].edge;
@@ -654,7 +783,8 @@ static void ccgDM_getFinalVert(DerivedMesh *dm, int vertNum, MVert *mv)
 		vd = ccgSubSurf_getEdgeData(ss, e, x);
 		copy_v3_v3(mv->co, vd->co);
 		normal_float_to_short_v3(mv->no, vd->no);
-	} else {
+	}
+	else {
 		/* this vert comes from vert data */
 		CCGVert *v;
 		i = vertNum - ccgdm->vertMap[0].startVert;
@@ -684,13 +814,13 @@ static void ccgDM_getFinalVertNo(DerivedMesh *dm, int vertNum, float no_r[3])
 
 static void ccgDM_getFinalEdge(DerivedMesh *dm, int edgeNum, MEdge *med)
 {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 	CCGSubSurf *ss = ccgdm->ss;
 	int i;
 
 	memset(med, 0, sizeof(*med));
 
-	if(edgeNum < ccgdm->edgeMap[0].startEdge) {
+	if (edgeNum < ccgdm->edgeMap[0].startEdge) {
 		/* this edge comes from face data */
 		int lastface = ccgSubSurf_getNumFaces(ss) - 1;
 		CCGFace *f;
@@ -701,8 +831,45 @@ static void ccgDM_getFinalEdge(DerivedMesh *dm, int edgeNum, MEdge *med)
 		int gridSideEdges;
 		int gridInternalEdges;
 
+		/* code added in bmesh but works correctly without, commenting - campbell */
+#if 0
+		int lasti, previ;
+		i = lastface;
+		lasti = 0;
+		while (1) {
+			previ = i;
+			if (ccgdm->faceMap[i].startEdge >= edgeNum) {
+				i -= fabsf(i - lasti) / 2.0f;
+			}
+			else if (ccgdm->faceMap[i].startEdge < edgeNum) {
+				i += fabsf(i - lasti) / 2.0f;
+			}
+			else {
+				break;
+			}
+
+			if (i < 0) {
+				i = 0;
+				break;
+			}
+
+			if (i > lastface) {
+				i = lastface;
+				break;
+
+			}
+
+			if (i == lasti)
+				break;
+
+			lasti = previ;
+		}
+
+		i = i > 0 ? i - 1 : i;
+#endif
+
 		i = 0;
-		while(i < lastface && edgeNum >= ccgdm->faceMap[i + 1].startEdge)
+		while (i < lastface && edgeNum >= ccgdm->faceMap[i + 1].startEdge)
 			++i;
 
 		f = ccgdm->faceMap[i].face;
@@ -715,23 +882,26 @@ static void ccgDM_getFinalEdge(DerivedMesh *dm, int edgeNum, MEdge *med)
 		grid = offset / (gridSideEdges + gridInternalEdges);
 		offset %= (gridSideEdges + gridInternalEdges);
 
-		if(offset < gridSideEdges) {
+		if (offset < gridSideEdges) {
 			x = offset;
 			med->v1 = getFaceIndex(ss, f, grid, x, 0, edgeSize, gridSize);
-			med->v2 = getFaceIndex(ss, f, grid, x+1, 0, edgeSize, gridSize);
-		} else {
+			med->v2 = getFaceIndex(ss, f, grid, x + 1, 0, edgeSize, gridSize);
+		}
+		else {
 			offset -= gridSideEdges;
 			x = (offset / 2) / gridSideEdges + 1;
 			y = (offset / 2) % gridSideEdges;
-			if(offset % 2 == 0) {
+			if (offset % 2 == 0) {
 				med->v1 = getFaceIndex(ss, f, grid, x, y, edgeSize, gridSize);
-				med->v2 = getFaceIndex(ss, f, grid, x, y+1, edgeSize, gridSize);
-			} else {
+				med->v2 = getFaceIndex(ss, f, grid, x, y + 1, edgeSize, gridSize);
+			}
+			else {
 				med->v1 = getFaceIndex(ss, f, grid, y, x, edgeSize, gridSize);
-				med->v2 = getFaceIndex(ss, f, grid, y+1, x, edgeSize, gridSize);
+				med->v2 = getFaceIndex(ss, f, grid, y + 1, x, edgeSize, gridSize);
 			}
 		}
-	} else {
+	}
+	else {
 		/* this vert comes from edge data */
 		CCGEdge *e;
 		int edgeSize = ccgSubSurf_getEdgeSize(ss);
@@ -743,17 +913,16 @@ static void ccgDM_getFinalEdge(DerivedMesh *dm, int edgeNum, MEdge *med)
 
 		e = ccgdm->edgeMap[i].edge;
 
-		if(!ccgSubSurf_getEdgeNumFaces(e)) flags |= ME_LOOSEEDGE;
+		if (!ccgSubSurf_getEdgeNumFaces(e)) flags |= ME_LOOSEEDGE;
 
 		x = edgeNum - ccgdm->edgeMap[i].startEdge;
 
 		med->v1 = getEdgeIndex(ss, e, x, edgeSize);
-		med->v2 = getEdgeIndex(ss, e, x+1, edgeSize);
+		med->v2 = getEdgeIndex(ss, e, x + 1, edgeSize);
 
-		edgeFlag = (ccgdm->edgeFlags)? &ccgdm->edgeFlags[i]: NULL;
-		if(edgeFlag)
-			flags |= (*edgeFlag & (ME_SEAM | ME_SHARP))
-					 | ME_EDGEDRAW | ME_EDGERENDER;
+		edgeFlag = (ccgdm->edgeFlags) ? &ccgdm->edgeFlags[i] : NULL;
+		if (edgeFlag)
+			flags |= (*edgeFlag & (ME_SEAM | ME_SHARP)) | ME_EDGEDRAW | ME_EDGERENDER;
 		else
 			flags |= ME_EDGEDRAW | ME_EDGERENDER;
 
@@ -763,7 +932,7 @@ static void ccgDM_getFinalEdge(DerivedMesh *dm, int edgeNum, MEdge *med)
 
 static void ccgDM_getFinalFace(DerivedMesh *dm, int faceNum, MFace *mf)
 {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 	CCGSubSurf *ss = ccgdm->ss;
 	int gridSize = ccgSubSurf_getGridSize(ss);
 	int edgeSize = ccgSubSurf_getEdgeSize(ss);
@@ -775,14 +944,14 @@ static void ccgDM_getFinalFace(DerivedMesh *dm, int faceNum, MFace *mf)
 	int offset;
 	int grid;
 	int x, y;
-	int lastface = ccgSubSurf_getNumFaces(ss) - 1;
-	char *faceFlags = ccgdm->faceFlags;
+	/*int lastface = ccgSubSurf_getNumFaces(ss) - 1;*/ /*UNUSED*/
+	DMFlagMat *faceFlags = ccgdm->faceFlags;
 
 	memset(mf, 0, sizeof(*mf));
+	if (faceNum >= ccgdm->dm.numTessFaceData)
+		return;
 
-	i = 0;
-	while(i < lastface && faceNum >= ccgdm->faceMap[i + 1].startFace)
-		++i;
+	i = ccgdm->reverseFaceMap[faceNum];
 
 	f = ccgdm->faceMap[i].face;
 	/*numVerts = ccgSubSurf_getFaceNumVerts(f);*/ /*UNUSED*/
@@ -793,21 +962,59 @@ static void ccgDM_getFinalFace(DerivedMesh *dm, int faceNum, MFace *mf)
 	y = offset / gridSideEdges;
 	x = offset % gridSideEdges;
 
-	mf->v1 = getFaceIndex(ss, f, grid, x+0, y+0, edgeSize, gridSize);
-	mf->v2 = getFaceIndex(ss, f, grid, x+0, y+1, edgeSize, gridSize);
-	mf->v3 = getFaceIndex(ss, f, grid, x+1, y+1, edgeSize, gridSize);
-	mf->v4 = getFaceIndex(ss, f, grid, x+1, y+0, edgeSize, gridSize);
+	mf->v1 = getFaceIndex(ss, f, grid, x + 0, y + 0, edgeSize, gridSize);
+	mf->v2 = getFaceIndex(ss, f, grid, x + 0, y + 1, edgeSize, gridSize);
+	mf->v3 = getFaceIndex(ss, f, grid, x + 1, y + 1, edgeSize, gridSize);
+	mf->v4 = getFaceIndex(ss, f, grid, x + 1, y + 0, edgeSize, gridSize);
 
-	if(faceFlags) {
-		mf->flag = faceFlags[i*2];
-		mf->mat_nr = faceFlags[i*2+1];
+	if (faceFlags) {
+		mf->flag = faceFlags[i].flag;
+		mf->mat_nr = faceFlags[i].mat_nr;
 	}
 	else mf->flag = ME_SMOOTH;
 }
 
+/* Translate GridHidden into the ME_HIDE flag for MVerts. Assumes
+ * vertices are in the order output by ccgDM_copyFinalVertArray. */
+void subsurf_copy_grid_hidden(DerivedMesh *dm, const MPoly *mpoly,
+                              MVert *mvert, const MDisps *mdisps)
+{
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;
+	CCGSubSurf *ss = ccgdm->ss;
+	int level = ccgSubSurf_getSubdivisionLevels(ss);
+	int gridSize = ccgSubSurf_getGridSize(ss);
+	int edgeSize = ccgSubSurf_getEdgeSize(ss);
+	int totface = ccgSubSurf_getNumFaces(ss);
+	int i, j, x, y;
+	
+	for (i = 0; i < totface; i++) {
+		CCGFace *f = ccgdm->faceMap[i].face;
+
+		for (j = 0; j < mpoly[i].totloop; j++) {
+			const MDisps *md = &mdisps[mpoly[i].loopstart + j];
+			int hidden_gridsize = ccg_gridsize(md->level);
+			int factor = ccg_factor(level, md->level);
+			
+			if (!md->hidden)
+				continue;
+			
+			for (y = 0; y < gridSize; y++) {
+				for (x = 0; x < gridSize; x++) {
+					int vndx, offset;
+					
+					vndx = getFaceIndex(ss, f, j, x, y, edgeSize, gridSize);
+					offset = (y * factor) * hidden_gridsize + (x * factor);
+					if (BLI_BITMAP_GET(md->hidden, offset))
+						mvert[vndx].flag |= ME_HIDE;
+				}
+			}
+		}
+	}
+}
+
 static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert)
 {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 	CCGSubSurf *ss = ccgdm->ss;
 	DMGridData *vd;
 	int index;
@@ -817,27 +1024,27 @@ static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert)
 	int i = 0;
 
 	totface = ccgSubSurf_getNumFaces(ss);
-	for(index = 0; index < totface; index++) {
+	for (index = 0; index < totface; index++) {
 		CCGFace *f = ccgdm->faceMap[index].face;
 		int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f);
 
-		vd= ccgSubSurf_getFaceCenterData(f);
+		vd = ccgSubSurf_getFaceCenterData(f);
 		copy_v3_v3(mvert[i].co, vd->co);
 		normal_float_to_short_v3(mvert[i].no, vd->no);
 		i++;
 		
-		for(S = 0; S < numVerts; S++) {
-			for(x = 1; x < gridSize - 1; x++, i++) {
-				vd= ccgSubSurf_getFaceGridEdgeData(ss, f, S, x);
+		for (S = 0; S < numVerts; S++) {
+			for (x = 1; x < gridSize - 1; x++, i++) {
+				vd = ccgSubSurf_getFaceGridEdgeData(ss, f, S, x);
 				copy_v3_v3(mvert[i].co, vd->co);
 				normal_float_to_short_v3(mvert[i].no, vd->no);
 			}
 		}
 
-		for(S = 0; S < numVerts; S++) {
-			for(y = 1; y < gridSize - 1; y++) {
-				for(x = 1; x < gridSize - 1; x++, i++) {
-					vd= ccgSubSurf_getFaceGridData(ss, f, S, x, y);
+		for (S = 0; S < numVerts; S++) {
+			for (y = 1; y < gridSize - 1; y++) {
+				for (x = 1; x < gridSize - 1; x++, i++) {
+					vd = ccgSubSurf_getFaceGridData(ss, f, S, x, y);
 					copy_v3_v3(mvert[i].co, vd->co);
 					normal_float_to_short_v3(mvert[i].no, vd->no);
 				}
@@ -846,15 +1053,15 @@ static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert)
 	}
 
 	totedge = ccgSubSurf_getNumEdges(ss);
-	for(index = 0; index < totedge; index++) {
+	for (index = 0; index < totedge; index++) {
 		CCGEdge *e = ccgdm->edgeMap[index].edge;
 		int x;
 
-		for(x = 1; x < edgeSize - 1; x++, i++) {
-			vd= ccgSubSurf_getEdgeData(ss, e, x);
+		for (x = 1; x < edgeSize - 1; x++, i++) {
+			vd = ccgSubSurf_getEdgeData(ss, e, x);
 			copy_v3_v3(mvert[i].co, vd->co);
 			/* This gives errors with -debug-fpe
-			 * the normals dont seem to be unit length.
+			 * the normals don't seem to be unit length.
 			 * this is most likely caused by edges with no
 			 * faces which are now zerod out, see comment in:
 			 * ccgSubSurf__calcVertNormals(), - campbell */
@@ -863,10 +1070,10 @@ static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert)
 	}
 
 	totvert = ccgSubSurf_getNumVerts(ss);
-	for(index = 0; index < totvert; index++) {
+	for (index = 0; index < totvert; index++) {
 		CCGVert *v = ccgdm->vertMap[index].vert;
 
-		vd= ccgSubSurf_getVertData(ss, v);
+		vd = ccgSubSurf_getVertData(ss, v);
 		copy_v3_v3(mvert[i].co, vd->co);
 		normal_float_to_short_v3(mvert[i].no, vd->no);
 		i++;
@@ -875,7 +1082,7 @@ static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert)
 
 static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge)
 {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 	CCGSubSurf *ss = ccgdm->ss;
 	int index;
 	int totedge, totface;
@@ -885,41 +1092,41 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge)
 	short *edgeFlags = ccgdm->edgeFlags;
 
 	totface = ccgSubSurf_getNumFaces(ss);
-	for(index = 0; index < totface; index++) {
+	for (index = 0; index < totface; index++) {
 		CCGFace *f = ccgdm->faceMap[index].face;
 		int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f);
 
-		for(S = 0; S < numVerts; S++) {
-			for(x = 0; x < gridSize - 1; x++) {
+		for (S = 0; S < numVerts; S++) {
+			for (x = 0; x < gridSize - 1; x++) {
 				MEdge *med = &medge[i];
 
-				if(ccgdm->drawInteriorEdges)
+				if (ccgdm->drawInteriorEdges)
 					med->flag = ME_EDGEDRAW | ME_EDGERENDER;
 				med->v1 = getFaceIndex(ss, f, S, x, 0, edgeSize, gridSize);
 				med->v2 = getFaceIndex(ss, f, S, x + 1, 0, edgeSize, gridSize);
 				i++;
 			}
 
-			for(x = 1; x < gridSize - 1; x++) {
-				for(y = 0; y < gridSize - 1; y++) {
+			for (x = 1; x < gridSize - 1; x++) {
+				for (y = 0; y < gridSize - 1; y++) {
 					MEdge *med;
 
 					med = &medge[i];
-					if(ccgdm->drawInteriorEdges)
+					if (ccgdm->drawInteriorEdges)
 						med->flag = ME_EDGEDRAW | ME_EDGERENDER;
 					med->v1 = getFaceIndex(ss, f, S, x, y,
-										   edgeSize, gridSize);
+					                       edgeSize, gridSize);
 					med->v2 = getFaceIndex(ss, f, S, x, y + 1,
-										   edgeSize, gridSize);
+					                       edgeSize, gridSize);
 					i++;
 
 					med = &medge[i];
-					if(ccgdm->drawInteriorEdges)
+					if (ccgdm->drawInteriorEdges)
 						med->flag = ME_EDGEDRAW | ME_EDGERENDER;
 					med->v1 = getFaceIndex(ss, f, S, y, x,
-										   edgeSize, gridSize);
+					                       edgeSize, gridSize);
 					med->v2 = getFaceIndex(ss, f, S, y + 1, x,
-										   edgeSize, gridSize);
+					                       edgeSize, gridSize);
 					i++;
 				}
 			}
@@ -927,24 +1134,25 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge)
 	}
 
 	totedge = ccgSubSurf_getNumEdges(ss);
-	for(index = 0; index < totedge; index++) {
+	for (index = 0; index < totedge; index++) {
 		CCGEdge *e = ccgdm->edgeMap[index].edge;
 		unsigned int flags = 0;
 		int x;
 		int edgeIdx = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e));
 
-		if(!ccgSubSurf_getEdgeNumFaces(e)) flags |= ME_LOOSEEDGE;
+		if (!ccgSubSurf_getEdgeNumFaces(e)) flags |= ME_LOOSEEDGE;
 
-		if(edgeFlags) {
-			if(edgeIdx != -1) {
+		if (edgeFlags) {
+			if (edgeIdx != -1) {
 				flags |= (edgeFlags[index] & (ME_SEAM | ME_SHARP))
-						 | ME_EDGEDRAW | ME_EDGERENDER;
+				         | ME_EDGEDRAW | ME_EDGERENDER;
 			}
-		} else {
+		}
+		else {
 			flags |= ME_EDGEDRAW | ME_EDGERENDER;
 		}
 
-		for(x = 0; x < edgeSize - 1; x++) {
+		for (x = 0; x < edgeSize - 1; x++) {
 			MEdge *med = &medge[i];
 			med->v1 = getEdgeIndex(ss, e, x, edgeSize);
 			med->v2 = getEdgeIndex(ss, e, x + 1, edgeSize);
@@ -956,35 +1164,35 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge)
 
 static void ccgDM_copyFinalFaceArray(DerivedMesh *dm, MFace *mface)
 {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 	CCGSubSurf *ss = ccgdm->ss;
 	int index;
 	int totface;
 	int gridSize = ccgSubSurf_getGridSize(ss);
 	int edgeSize = ccgSubSurf_getEdgeSize(ss);
 	int i = 0;
-	char *faceFlags = ccgdm->faceFlags;
+	DMFlagMat *faceFlags = ccgdm->faceFlags;
 
 	totface = ccgSubSurf_getNumFaces(ss);
-	for(index = 0; index < totface; index++) {
+	for (index = 0; index < totface; index++) {
 		CCGFace *f = ccgdm->faceMap[index].face;
 		int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f);
 		/* keep types in sync with MFace, avoid many conversions */
-		char flag = (faceFlags)? faceFlags[index*2]: ME_SMOOTH;
-		short mat_nr = (faceFlags)? faceFlags[index*2+1]: 0;
+		char flag = (faceFlags) ? faceFlags[index].flag : ME_SMOOTH;
+		short mat_nr = (faceFlags) ? faceFlags[index].mat_nr : 0;
 
-		for(S = 0; S < numVerts; S++) {
-			for(y = 0; y < gridSize - 1; y++) {
-				for(x = 0; x < gridSize - 1; x++) {
+		for (S = 0; S < numVerts; S++) {
+			for (y = 0; y < gridSize - 1; y++) {
+				for (x = 0; x < gridSize - 1; x++) {
 					MFace *mf = &mface[i];
 					mf->v1 = getFaceIndex(ss, f, S, x + 0, y + 0,
-										  edgeSize, gridSize);
+					                      edgeSize, gridSize);
 					mf->v2 = getFaceIndex(ss, f, S, x + 0, y + 1,
-										  edgeSize, gridSize);
+					                      edgeSize, gridSize);
 					mf->v3 = getFaceIndex(ss, f, S, x + 1, y + 1,
-										  edgeSize, gridSize);
+					                      edgeSize, gridSize);
 					mf->v4 = getFaceIndex(ss, f, S, x + 1, y + 0,
-										  edgeSize, gridSize);
+					                      edgeSize, gridSize);
 					mf->mat_nr = mat_nr;
 					mf->flag = flag;
 
@@ -995,8 +1203,112 @@ static void ccgDM_copyFinalFaceArray(DerivedMesh *dm, MFace *mface)
 	}
 }
 
-static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3]) {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+static void ccgDM_copyFinalLoopArray(DerivedMesh *dm, MLoop *mloop)
+{
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
+	CCGSubSurf *ss = ccgdm->ss;
+	int index;
+	int totface;
+	int gridSize = ccgSubSurf_getGridSize(ss);
+	int edgeSize = ccgSubSurf_getEdgeSize(ss);
+	int i = 0;
+	MLoop *mv;
+	/* DMFlagMat *faceFlags = ccgdm->faceFlags; */ /* UNUSED */
+
+	if (!ccgdm->ehash) {
+		MEdge *medge;
+
+		ccgdm->ehash = BLI_edgehash_new();
+		medge = ccgdm->dm.getEdgeArray((DerivedMesh *)ccgdm);
+
+		for (i = 0; i < ccgdm->dm.numEdgeData; i++) {
+			BLI_edgehash_insert(ccgdm->ehash, medge[i].v1, medge[i].v2, SET_INT_IN_POINTER(i));
+		}
+	}
+
+	totface = ccgSubSurf_getNumFaces(ss);
+	mv = mloop;
+	for (index = 0; index < totface; index++) {
+		CCGFace *f = ccgdm->faceMap[index].face;
+		int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f);
+		/* int flag = (faceFlags)? faceFlags[index*2]: ME_SMOOTH; */ /* UNUSED */
+		/* int mat_nr = (faceFlags)? faceFlags[index*2+1]: 0; */ /* UNUSED */
+
+		for (S = 0; S < numVerts; S++) {
+			for (y = 0; y < gridSize - 1; y++) {
+				for (x = 0; x < gridSize - 1; x++) {
+					int v1, v2, v3, v4;
+
+					v1 = getFaceIndex(ss, f, S, x + 0, y + 0,
+					                  edgeSize, gridSize);
+
+					v2 = getFaceIndex(ss, f, S, x + 0, y + 1,
+					                  edgeSize, gridSize);
+					v3 = getFaceIndex(ss, f, S, x + 1, y + 1,
+					                  edgeSize, gridSize);
+					v4 = getFaceIndex(ss, f, S, x + 1, y + 0,
+					                  edgeSize, gridSize);
+
+					mv->v = v1;
+					mv->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v1, v2));
+					mv++, i++;
+
+					mv->v = v2;
+					mv->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v2, v3));
+					mv++, i++;
+
+					mv->v = v3;
+					mv->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v3, v4));
+					mv++, i++;
+
+					mv->v = v4;
+					mv->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(ccgdm->ehash, v4, v1));
+					mv++, i++;
+				}
+			}
+		}
+	}
+}
+
+static void ccgDM_copyFinalPolyArray(DerivedMesh *dm, MPoly *mpoly)
+{
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
+	CCGSubSurf *ss = ccgdm->ss;
+	int index;
+	int totface;
+	int gridSize = ccgSubSurf_getGridSize(ss);
+	/* int edgeSize = ccgSubSurf_getEdgeSize(ss); */ /* UNUSED */
+	int i = 0, k = 0;
+	DMFlagMat *faceFlags = ccgdm->faceFlags;
+
+	totface = ccgSubSurf_getNumFaces(ss);
+	for (index = 0; index < totface; index++) {
+		CCGFace *f = ccgdm->faceMap[index].face;
+		int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f);
+		int flag = (faceFlags) ? faceFlags[index].flag : ME_SMOOTH;
+		int mat_nr = (faceFlags) ? faceFlags[index].mat_nr : 0;
+
+		for (S = 0; S < numVerts; S++) {
+			for (y = 0; y < gridSize - 1; y++) {
+				for (x = 0; x < gridSize - 1; x++) {
+					MPoly *mp = &mpoly[i];
+
+					mp->mat_nr = mat_nr;
+					mp->flag = flag;
+					mp->loopstart = k;
+					mp->totloop = 4;
+
+					k += 4;
+					i++;
+				}
+			}
+		}
+	}
+}
+
+static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3])
+{
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 	CCGSubSurf *ss = ccgdm->ss;
 	int edgeSize = ccgSubSurf_getEdgeSize(ss);
 	int gridSize = ccgSubSurf_getGridSize(ss);
@@ -1010,7 +1322,7 @@ static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3]) {
 	int index, totvert, totedge, totface;
 	
 	totvert = ccgSubSurf_getNumVerts(ss);
-	vertMap2 = MEM_mallocN(totvert*sizeof(*vertMap2), "vertmap");
+	vertMap2 = MEM_mallocN(totvert * sizeof(*vertMap2), "vertmap");
 	vi = ccgSubSurf_getVertIterator(ss);
 	for (; !ccgVertIterator_isStopped(vi); ccgVertIterator_next(vi)) {
 		CCGVert *v = ccgVertIterator_getCurrent(vi);
@@ -1020,56 +1332,56 @@ static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3]) {
 	ccgVertIterator_free(vi);
 
 	totedge = ccgSubSurf_getNumEdges(ss);
-	edgeMap2 = MEM_mallocN(totedge*sizeof(*edgeMap2), "edgemap");
+	edgeMap2 = MEM_mallocN(totedge * sizeof(*edgeMap2), "edgemap");
 	ei = ccgSubSurf_getEdgeIterator(ss);
-	for (i=0; !ccgEdgeIterator_isStopped(ei); i++,ccgEdgeIterator_next(ei)) {
+	for (i = 0; !ccgEdgeIterator_isStopped(ei); i++, ccgEdgeIterator_next(ei)) {
 		CCGEdge *e = ccgEdgeIterator_getCurrent(ei);
 
 		edgeMap2[GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e))] = e;
 	}
 
 	totface = ccgSubSurf_getNumFaces(ss);
-	faceMap2 = MEM_mallocN(totface*sizeof(*faceMap2), "facemap");
+	faceMap2 = MEM_mallocN(totface * sizeof(*faceMap2), "facemap");
 	fi = ccgSubSurf_getFaceIterator(ss);
 	for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
 		CCGFace *f = ccgFaceIterator_getCurrent(fi);
 
-		faceMap2[GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f))] = f;
+		faceMap2[GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f))] = f;
 	}
 	ccgFaceIterator_free(fi);
 
 	i = 0;
-	for (index=0; index<totface; index++) {
+	for (index = 0; index < totface; index++) {
 		CCGFace *f = faceMap2[index];
 		int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f);
 
 		copy_v3_v3(cos[i++], ccgSubSurf_getFaceCenterData(f));
 		
-		for (S=0; S<numVerts; S++) {
-			for (x=1; x<gridSize-1; x++) {
+		for (S = 0; S < numVerts; S++) {
+			for (x = 1; x < gridSize - 1; x++) {
 				copy_v3_v3(cos[i++], ccgSubSurf_getFaceGridEdgeData(ss, f, S, x));
 			}
 		}
 
-		for (S=0; S<numVerts; S++) {
-			for (y=1; y<gridSize-1; y++) {
-				for (x=1; x<gridSize-1; x++) {
+		for (S = 0; S < numVerts; S++) {
+			for (y = 1; y < gridSize - 1; y++) {
+				for (x = 1; x < gridSize - 1; x++) {
 					copy_v3_v3(cos[i++], ccgSubSurf_getFaceGridData(ss, f, S, x, y));
 				}
 			}
 		}
 	}
 
-	for (index=0; index<totedge; index++) {
-		CCGEdge *e= edgeMap2[index];
+	for (index = 0; index < totedge; index++) {
+		CCGEdge *e = edgeMap2[index];
 		int x;
 
-		for (x=1; x<edgeSize-1; x++) {
+		for (x = 1; x < edgeSize - 1; x++) {
 			copy_v3_v3(cos[i++], ccgSubSurf_getEdgeData(ss, e, x));
 		}
 	}
 
-	for (index=0; index<totvert; index++) {
+	for (index = 0; index < totvert; index++) {
 		CCGVert *v = vertMap2[index];
 		copy_v3_v3(cos[i++], ccgSubSurf_getVertData(ss, v));
 	}
@@ -1078,8 +1390,13 @@ static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3]) {
 	MEM_freeN(edgeMap2);
 	MEM_freeN(faceMap2);
 }
-static void ccgDM_foreachMappedVert(DerivedMesh *dm, void (*func)(void *userData, int index, float *co, float *no_f, short *no_s), void *userData) {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+
+static void ccgDM_foreachMappedVert(
+    DerivedMesh *dm,
+    void (*func)(void *userData, int index, const float co[3], const float no_f[3], const short no_s[3]),
+    void *userData)
+{
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 	CCGVertIterator *vi = ccgSubSurf_getVertIterator(ccgdm->ss);
 
 	for (; !ccgVertIterator_isStopped(vi); ccgVertIterator_next(vi)) {
@@ -1087,14 +1404,19 @@ static void ccgDM_foreachMappedVert(DerivedMesh *dm, void (*func)(void *userData
 		DMGridData *vd = ccgSubSurf_getVertData(ccgdm->ss, v);
 		int index = ccgDM_getVertMapIndex(ccgdm->ss, v);
 
-		if (index!=-1)
+		if (index != -1)
 			func(userData, index, vd->co, vd->no, NULL);
 	}
 
 	ccgVertIterator_free(vi);
 }
-static void ccgDM_foreachMappedEdge(DerivedMesh *dm, void (*func)(void *userData, int index, float *v0co, float *v1co), void *userData) {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+
+static void ccgDM_foreachMappedEdge(
+    DerivedMesh *dm,
+    void (*func)(void *userData, int index, const float v0co[3], const float v1co[3]),
+    void *userData)
+{
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 	CCGSubSurf *ss = ccgdm->ss;
 	CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss);
 	int i, edgeSize = ccgSubSurf_getEdgeSize(ss);
@@ -1104,17 +1426,18 @@ static void ccgDM_foreachMappedEdge(DerivedMesh *dm, void (*func)(void *userData
 		DMGridData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e);
 		int index = ccgDM_getEdgeMapIndex(ss, e);
 
-		if (index!=-1) {
-			for (i=0; i<edgeSize-1; i++)
-				func(userData, index, edgeData[i].co, edgeData[i+1].co);
+		if (index != -1) {
+			for (i = 0; i < edgeSize - 1; i++)
+				func(userData, index, edgeData[i].co, edgeData[i + 1].co);
 		}
 	}
 
 	ccgEdgeIterator_free(ei);
 }
 
-static void ccgDM_drawVerts(DerivedMesh *dm) {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+static void ccgDM_drawVerts(DerivedMesh *dm)
+{
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 	CCGSubSurf *ss = ccgdm->ss;
 	int edgeSize = ccgSubSurf_getEdgeSize(ss);
 	int gridSize = ccgSubSurf_getGridSize(ss);
@@ -1135,7 +1458,7 @@ static void ccgDM_drawVerts(DerivedMesh *dm) {
 		CCGEdge *e = ccgEdgeIterator_getCurrent(ei);
 		int x;
 
-		for (x=1; x<edgeSize-1; x++)
+		for (x = 1; x < edgeSize - 1; x++)
 			glVertex3fv(ccgSubSurf_getEdgeData(ss, e, x));
 	}
 	ccgEdgeIterator_free(ei);
@@ -1146,12 +1469,12 @@ static void ccgDM_drawVerts(DerivedMesh *dm) {
 		int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f);
 
 		glVertex3fv(ccgSubSurf_getFaceCenterData(f));
-		for (S=0; S<numVerts; S++)
-			for (x=1; x<gridSize-1; x++)
+		for (S = 0; S < numVerts; S++)
+			for (x = 1; x < gridSize - 1; x++)
 				glVertex3fv(ccgSubSurf_getFaceGridEdgeData(ss, f, S, x));
-		for (S=0; S<numVerts; S++)
-			for (y=1; y<gridSize-1; y++)
-				for (x=1; x<gridSize-1; x++)
+		for (S = 0; S < numVerts; S++)
+			for (y = 1; y < gridSize - 1; y++)
+				for (x = 1; x < gridSize - 1; x++)
 					glVertex3fv(ccgSubSurf_getFaceGridData(ss, f, S, x, y));
 	}
 	ccgFaceIterator_free(fi);
@@ -1160,12 +1483,12 @@ static void ccgDM_drawVerts(DerivedMesh *dm) {
 
 static void ccgdm_pbvh_update(CCGDerivedMesh *ccgdm)
 {
-	if(ccgdm->pbvh && ccgDM_use_grid_pbvh(ccgdm)) {
+	if (ccgdm->pbvh && ccgDM_use_grid_pbvh(ccgdm)) {
 		CCGFace **faces;
 		int totface;
 
-		BLI_pbvh_get_grid_updates(ccgdm->pbvh, 1, (void***)&faces, &totface);
-		if(totface) {
+		BLI_pbvh_get_grid_updates(ccgdm->pbvh, 1, (void ***)&faces, &totface);
+		if (totface) {
 			ccgSubSurf_updateFromFaces(ccgdm->ss, 0, faces, totface);
 			ccgSubSurf_updateNormals(ccgdm->ss, faces, totface);
 			MEM_freeN(faces);
@@ -1173,8 +1496,9 @@ static void ccgdm_pbvh_update(CCGDerivedMesh *ccgdm)
 	}
 }
 
-static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int UNUSED(drawAllEdges)) {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int drawAllEdges)
+{
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 	CCGSubSurf *ss = ccgdm->ss;
 	int i, j, edgeSize = ccgSubSurf_getEdgeSize(ss);
 	int totedge = ccgSubSurf_getNumEdges(ss);
@@ -1185,78 +1509,80 @@ static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int UNUSED(draw
 
 	ccgSubSurf_getUseAgeCounts(ss, &useAging, NULL, NULL, NULL);
 
-	for (j=0; j< totedge; j++) {
+	for (j = 0; j < totedge; j++) {
 		CCGEdge *e = ccgdm->edgeMap[j].edge;
 		DMGridData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e);
 
 		if (!drawLooseEdges && !ccgSubSurf_getEdgeNumFaces(e))
 			continue;
 
-		if(ccgdm->edgeFlags && !(ccgdm->edgeFlags[j] & ME_EDGEDRAW))
+		if (!drawAllEdges && ccgdm->edgeFlags && !(ccgdm->edgeFlags[j] & ME_EDGEDRAW))
 			continue;
 
-		if (useAging && !(G.f&G_BACKBUFSEL)) {
-			int ageCol = 255-ccgSubSurf_getEdgeAge(ss, e)*4;
-			glColor3ub(0, ageCol>0?ageCol:0, 0);
+		if (useAging && !(G.f & G_BACKBUFSEL)) {
+			int ageCol = 255 - ccgSubSurf_getEdgeAge(ss, e) * 4;
+			glColor3ub(0, ageCol > 0 ? ageCol : 0, 0);
 		}
 
 		glBegin(GL_LINE_STRIP);
-		for (i=0; i<edgeSize-1; i++) {
+		for (i = 0; i < edgeSize - 1; i++) {
 			glVertex3fv(edgeData[i].co);
-			glVertex3fv(edgeData[i+1].co);
+			glVertex3fv(edgeData[i + 1].co);
 		}
 		glEnd();
 	}
 
-	if (useAging && !(G.f&G_BACKBUFSEL)) {
+	if (useAging && !(G.f & G_BACKBUFSEL)) {
 		glColor3ub(0, 0, 0);
 	}
 
 	if (ccgdm->drawInteriorEdges) {
 		int totface = ccgSubSurf_getNumFaces(ss);
 
-		for(j = 0; j < totface; j++) {
+		for (j = 0; j < totface; j++) {
 			CCGFace *f = ccgdm->faceMap[j].face;
 			int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
 
-			for (S=0; S<numVerts; S++) {
+			for (S = 0; S < numVerts; S++) {
 				DMGridData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S);
 
 				glBegin(GL_LINE_STRIP);
-				for (x=0; x<gridSize; x++)
+				for (x = 0; x < gridSize; x++)
 					glVertex3fv(faceGridData[x].co);
 				glEnd();
-				for (y=1; y<gridSize-1; y++) {
+				for (y = 1; y < gridSize - 1; y++) {
 					glBegin(GL_LINE_STRIP);
-					for (x=0; x<gridSize; x++)
-						glVertex3fv(faceGridData[y*gridSize + x].co);
+					for (x = 0; x < gridSize; x++)
+						glVertex3fv(faceGridData[y * gridSize + x].co);
 					glEnd();
 				}
-				for (x=1; x<gridSize-1; x++) {
+				for (x = 1; x < gridSize - 1; x++) {
 					glBegin(GL_LINE_STRIP);
-					for (y=0; y<gridSize; y++)
-						glVertex3fv(faceGridData[y*gridSize + x].co);
+					for (y = 0; y < gridSize; y++)
+						glVertex3fv(faceGridData[y * gridSize + x].co);
 					glEnd();
 				}
 			}
 		}
 	}
 }
-static void ccgDM_drawLooseEdges(DerivedMesh *dm) {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+
+static void ccgDM_drawLooseEdges(DerivedMesh *dm)
+{
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 	CCGSubSurf *ss = ccgdm->ss;
 	int totedge = ccgSubSurf_getNumEdges(ss);
 	int i, j, edgeSize = ccgSubSurf_getEdgeSize(ss);
 
-	for (j=0; j< totedge; j++) {
+	for (j = 0; j < totedge; j++) {
 		CCGEdge *e = ccgdm->edgeMap[j].edge;
 		DMGridData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e);
 
 		if (!ccgSubSurf_getEdgeNumFaces(e)) {
 			glBegin(GL_LINE_STRIP);
-			for (i=0; i<edgeSize-1; i++) {
+			for (i = 0; i < edgeSize - 1; i++) {
 				glVertex3fv(edgeData[i].co);
-				glVertex3fv(edgeData[i+1].co);
+				glVertex3fv(edgeData[i + 1].co);
 			}
 			glEnd();
 		}
@@ -1265,80 +1591,76 @@ static void ccgDM_drawLooseEdges(DerivedMesh *dm) {
 
 static void ccgDM_glNormalFast(float *a, float *b, float *c, float *d)
 {
-	float a_cX = c[0]-a[0], a_cY = c[1]-a[1], a_cZ = c[2]-a[2];
-	float b_dX = d[0]-b[0], b_dY = d[1]-b[1], b_dZ = d[2]-b[2];
+	float a_cX = c[0] - a[0], a_cY = c[1] - a[1], a_cZ = c[2] - a[2];
+	float b_dX = d[0] - b[0], b_dY = d[1] - b[1], b_dZ = d[2] - b[2];
 	float no[3];
 
-	no[0] = b_dY*a_cZ - b_dZ*a_cY;
-	no[1] = b_dZ*a_cX - b_dX*a_cZ;
-	no[2] = b_dX*a_cY - b_dY*a_cX;
+	no[0] = b_dY * a_cZ - b_dZ * a_cY;
+	no[1] = b_dZ * a_cX - b_dX * a_cZ;
+	no[2] = b_dX * a_cY - b_dY * a_cX;
 
 	/* don't normalize, GL_NORMALIZE is enabled */
 	glNormal3fv(no);
 }
 
-	/* Only used by non-editmesh types */
-static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)[4], int fast, int (*setMaterial)(int, void *attribs)) {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+/* Only used by non-editmesh types */
+static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)[4], int fast, DMSetMaterial setMaterial)
+{
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 	CCGSubSurf *ss = ccgdm->ss;
 	int gridSize = ccgSubSurf_getGridSize(ss);
-	char *faceFlags = ccgdm->faceFlags;
-	int step = (fast)? gridSize-1: 1;
+	DMFlagMat *faceFlags = ccgdm->faceFlags;
+	int step = (fast) ? gridSize - 1 : 1;
 	int i, totface = ccgSubSurf_getNumFaces(ss);
 	int drawcurrent = 0, matnr = -1, shademodel = -1;
 
 	ccgdm_pbvh_update(ccgdm);
 
-	if(ccgdm->pbvh && ccgdm->multires.mmd && !fast) {
-		if(dm->numFaceData) {
-			/* should be per face */
-			if(!setMaterial(faceFlags[1]+1, NULL))
-				return;
-
-			glShadeModel((faceFlags[0] & ME_SMOOTH)? GL_SMOOTH: GL_FLAT);
-			BLI_pbvh_draw(ccgdm->pbvh, partial_redraw_planes, NULL, (faceFlags[0] & ME_SMOOTH));
+	if (ccgdm->pbvh && ccgdm->multires.mmd && !fast) {
+		if (dm->numTessFaceData) {
+			BLI_pbvh_draw(ccgdm->pbvh, partial_redraw_planes, NULL, setMaterial);
 			glShadeModel(GL_FLAT);
 		}
 
 		return;
 	}
 
-	for(i = 0; i < totface; i++) {
+	for (i = 0; i < totface; i++) {
 		CCGFace *f = ccgdm->faceMap[i].face;
 		int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
-		int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f));
+		int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
 		int new_matnr, new_shademodel;
 
-		if(faceFlags) {
-			new_shademodel = (faceFlags[index*2] & ME_SMOOTH)? GL_SMOOTH: GL_FLAT;
-			new_matnr= faceFlags[index*2 + 1];
+		if (faceFlags) {
+			new_shademodel = (faceFlags[index].flag & ME_SMOOTH) ? GL_SMOOTH : GL_FLAT;
+			new_matnr = faceFlags[index].mat_nr;
 		}
 		else {
 			new_shademodel = GL_SMOOTH;
-			new_matnr= 0;
+			new_matnr = 0;
 		}
 		
-		if(shademodel != new_shademodel || matnr != new_matnr) {
-			matnr= new_matnr;
-			shademodel= new_shademodel;
+		if (shademodel != new_shademodel || matnr != new_matnr) {
+			matnr = new_matnr;
+			shademodel = new_shademodel;
 
-			drawcurrent= setMaterial(matnr+1, NULL);
+			drawcurrent = setMaterial(matnr + 1, NULL);
 
 			glShadeModel(shademodel);
 		}
 
-		if(!drawcurrent)
+		if (!drawcurrent)
 			continue;
 
-		for (S=0; S<numVerts; S++) {
+		for (S = 0; S < numVerts; S++) {
 			DMGridData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S);
 
 			if (shademodel == GL_SMOOTH) {
-				for (y=0; y<gridSize-1; y+=step) {
+				for (y = 0; y < gridSize - 1; y += step) {
 					glBegin(GL_QUAD_STRIP);
-					for (x=0; x<gridSize; x+=step) {
-						DMGridData *a = &faceGridData[(y+0)*gridSize + x];
-						DMGridData *b = &faceGridData[(y+step)*gridSize + x];
+					for (x = 0; x < gridSize; x += step) {
+						DMGridData *a = &faceGridData[(y + 0) * gridSize + x];
+						DMGridData *b = &faceGridData[(y + step) * gridSize + x];
 
 						glNormal3fv(a->no);
 						glVertex3fv(a->co);
@@ -1347,14 +1669,15 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)
 					}
 					glEnd();
 				}
-			} else {
+			}
+			else {
 				glBegin(GL_QUADS);
-				for (y=0; y<gridSize-1; y+=step) {
-					for (x=0; x<gridSize-1; x+=step) {
-						float *a = faceGridData[(y+0)*gridSize + x].co;
-						float *b = faceGridData[(y+0)*gridSize + x + step].co;
-						float *c = faceGridData[(y+step)*gridSize + x + step].co;
-						float *d = faceGridData[(y+step)*gridSize + x].co;
+				for (y = 0; y < gridSize - 1; y += step) {
+					for (x = 0; x < gridSize - 1; x += step) {
+						float *a = faceGridData[(y + 0) * gridSize + x].co;
+						float *b = faceGridData[(y + 0) * gridSize + x + step].co;
+						float *c = faceGridData[(y + step) * gridSize + x + step].co;
+						float *d = faceGridData[(y + step) * gridSize + x].co;
 
 						ccgDM_glNormalFast(a, b, c, d);
 
@@ -1370,21 +1693,21 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)
 	}
 }
 
-	/* Only used by non-editmesh types */
+/* Only used by non-editmesh types */
 static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
-			int (*setMaterial)(int, void *attribs),
-			int (*setDrawOptions)(void *userData, int index),
-			void *userData)
+                                      DMSetMaterial setMaterial,
+                                      DMSetDrawOptions setDrawOptions,
+                                      void *userData)
 {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 	CCGSubSurf *ss = ccgdm->ss;
 	GPUVertexAttribs gattribs;
-	DMVertexAttribs attribs= {{{NULL}}};
-	/* MTFace *tf = dm->getFaceDataArray(dm, CD_MTFACE); */ /* UNUSED */
+	DMVertexAttribs attribs = {{{NULL}}};
+	/* MTFace *tf = dm->getTessFaceDataArray(dm, CD_MTFACE); */ /* UNUSED */
 	int gridSize = ccgSubSurf_getGridSize(ss);
 	int gridFaces = gridSize - 1;
 	int edgeSize = ccgSubSurf_getEdgeSize(ss);
-	char *faceFlags = ccgdm->faceFlags;
+	DMFlagMat *faceFlags = ccgdm->faceFlags;
 	int a, b, i, doDraw, numVerts, matnr, new_matnr, totface;
 
 	ccgdm_pbvh_update(ccgdm);
@@ -1392,67 +1715,69 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
 	doDraw = 0;
 	matnr = -1;
 
-#define PASSATTRIB(dx, dy, vert) {												\
-	if(attribs.totorco) {														\
-		index = getFaceIndex(ss, f, S, x+dx, y+dy, edgeSize, gridSize); 		\
-		glVertexAttrib3fvARB(attribs.orco.glIndex, attribs.orco.array[index]);	\
-	}																			\
-	for(b = 0; b < attribs.tottface; b++) {										\
-		MTFace *tf = &attribs.tface[b].array[a];								\
-		glVertexAttrib2fvARB(attribs.tface[b].glIndex, tf->uv[vert]);			\
-	}																			\
-	for(b = 0; b < attribs.totmcol; b++) {										\
-		MCol *cp = &attribs.mcol[b].array[a*4 + vert];							\
-		GLubyte col[4];															\
-		col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a;				\
-		glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, col);					\
-	}																			\
-	if(attribs.tottang) {														\
-		float *tang = attribs.tang.array[a*4 + vert];							\
-		glVertexAttrib4fvARB(attribs.tang.glIndex, tang);						\
-	}																			\
+#define PASSATTRIB(dx, dy, vert) {                                              \
+	if (attribs.totorco) {                                                      \
+		index = getFaceIndex(ss, f, S, x + dx, y + dy, edgeSize, gridSize);     \
+		glVertexAttrib3fvARB(attribs.orco.glIndex, attribs.orco.array[index]);  \
+	}                                                                           \
+	for (b = 0; b < attribs.tottface; b++) {                                    \
+		MTFace *tf = &attribs.tface[b].array[a];                                \
+		glVertexAttrib2fvARB(attribs.tface[b].glIndex, tf->uv[vert]);           \
+	}                                                                           \
+	for (b = 0; b < attribs.totmcol; b++) {                                     \
+		MCol *cp = &attribs.mcol[b].array[a * 4 + vert];                        \
+		GLubyte col[4];                                                         \
+		col[0] = cp->b; col[1] = cp->g; col[2] = cp->r; col[3] = cp->a;         \
+		glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, col);                    \
+	}                                                                           \
+	if (attribs.tottang) {                                                      \
+		float *tang = attribs.tang.array[a * 4 + vert];                         \
+		glVertexAttrib4fvARB(attribs.tang.glIndex, tang);                       \
+	}                                                                           \
 }
 
 	totface = ccgSubSurf_getNumFaces(ss);
-	for(a = 0, i = 0; i < totface; i++) {
+	for (a = 0, i = 0; i < totface; i++) {
 		CCGFace *f = ccgdm->faceMap[i].face;
 		int S, x, y, drawSmooth;
-		int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f));
+		int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
 		int origIndex = ccgDM_getFaceMapIndex(ss, f);
 		
 		numVerts = ccgSubSurf_getFaceNumVerts(f);
 
-		if(faceFlags) {
-			drawSmooth = (faceFlags[index*2] & ME_SMOOTH);
-			new_matnr= faceFlags[index*2 + 1] + 1;
+		if (faceFlags) {
+			drawSmooth = (faceFlags[index].flag & ME_SMOOTH);
+			new_matnr = faceFlags[index].mat_nr + 1;
 		}
 		else {
 			drawSmooth = 1;
-			new_matnr= 1;
+			new_matnr = 1;
 		}
 
-		if(new_matnr != matnr) {
+		if (new_matnr != matnr) {
 			doDraw = setMaterial(matnr = new_matnr, &gattribs);
-			if(doDraw)
+			if (doDraw)
 				DM_vertex_attributes_from_gpu(dm, &gattribs, &attribs);
 		}
 
-		if(!doDraw || (setDrawOptions && (origIndex != ORIGINDEX_NONE) && !setDrawOptions(userData, origIndex))) {
-			a += gridFaces*gridFaces*numVerts;
+		if (!doDraw || (setDrawOptions && (origIndex != ORIGINDEX_NONE) &&
+		                (setDrawOptions(userData, origIndex) == DM_DRAW_OPTION_SKIP)))
+		{
+			a += gridFaces * gridFaces * numVerts;
 			continue;
 		}
 
-		glShadeModel(drawSmooth? GL_SMOOTH: GL_FLAT);
-		for (S=0; S<numVerts; S++) {
+		glShadeModel(drawSmooth ? GL_SMOOTH : GL_FLAT);
+		for (S = 0; S < numVerts; S++) {
 			DMGridData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S);
 			DMGridData *vda, *vdb;
 
 			if (drawSmooth) {
-				for (y=0; y<gridFaces; y++) {
+				for (y = 0; y < gridFaces; y++) {
 					glBegin(GL_QUAD_STRIP);
-					for (x=0; x<gridFaces; x++) {
-						vda = &faceGridData[(y+0)*gridSize + x];
-						vdb = &faceGridData[(y+1)*gridSize + x];
+					for (x = 0; x < gridFaces; x++) {
+						vda = &faceGridData[(y + 0) * gridSize + x];
+						vdb = &faceGridData[(y + 1) * gridSize + x];
 						
 						PASSATTRIB(0, 0, 0);
 						glNormal3fv(vda->no);
@@ -1462,12 +1787,12 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
 						glNormal3fv(vdb->no);
 						glVertex3fv(vdb->co);
 
-						if(x != gridFaces-1)
+						if (x != gridFaces - 1)
 							a++;
 					}
 
-					vda = &faceGridData[(y+0)*gridSize + x];
-					vdb = &faceGridData[(y+1)*gridSize + x];
+					vda = &faceGridData[(y + 0) * gridSize + x];
+					vdb = &faceGridData[(y + 1) * gridSize + x];
 
 					PASSATTRIB(0, 0, 3);
 					glNormal3fv(vda->no);
@@ -1481,14 +1806,15 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
 
 					a++;
 				}
-			} else {
+			}
+			else {
 				glBegin(GL_QUADS);
-				for (y=0; y<gridFaces; y++) {
-					for (x=0; x<gridFaces; x++) {
-						float *aco = faceGridData[(y+0)*gridSize + x].co;
-						float *bco = faceGridData[(y+0)*gridSize + x + 1].co;
-						float *cco = faceGridData[(y+1)*gridSize + x + 1].co;
-						float *dco = faceGridData[(y+1)*gridSize + x].co;
+				for (y = 0; y < gridFaces; y++) {
+					for (x = 0; x < gridFaces; x++) {
+						float *aco = faceGridData[(y + 0) * gridSize + x].co;
+						float *bco = faceGridData[(y + 0) * gridSize + x + 1].co;
+						float *cco = faceGridData[(y + 1) * gridSize + x + 1].co;
+						float *dco = faceGridData[(y + 1) * gridSize + x].co;
 
 						ccgDM_glNormalFast(aco, bco, cco, dco);
 
@@ -1512,96 +1838,98 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
 #undef PASSATTRIB
 }
 
-static void ccgDM_drawFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, void *attribs)) {
+static void ccgDM_drawFacesGLSL(DerivedMesh *dm, DMSetMaterial setMaterial)
+{
 	dm->drawMappedFacesGLSL(dm, setMaterial, NULL, NULL);
 }
 
-	/* Only used by non-editmesh types */
-static void ccgDM_drawMappedFacesMat(DerivedMesh *dm, void (*setMaterial)(void *userData, int, void *attribs), int (*setFace)(void *userData, int index), void *userData) {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+/* Only used by non-editmesh types */
+static void ccgDM_drawMappedFacesMat(DerivedMesh *dm, void (*setMaterial)(void *userData, int, void *attribs), int (*setFace)(void *userData, int index), void *userData)
+{
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 	CCGSubSurf *ss = ccgdm->ss;
 	GPUVertexAttribs gattribs;
-	DMVertexAttribs attribs= {{{NULL}}};
+	DMVertexAttribs attribs = {{{NULL}}};
 	int gridSize = ccgSubSurf_getGridSize(ss);
 	int gridFaces = gridSize - 1;
 	int edgeSize = ccgSubSurf_getEdgeSize(ss);
-	char *faceFlags = ccgdm->faceFlags;
+	DMFlagMat *faceFlags = ccgdm->faceFlags;
 	int a, b, i, numVerts, matnr, new_matnr, totface;
 
 	ccgdm_pbvh_update(ccgdm);
 
 	matnr = -1;
 
-#define PASSATTRIB(dx, dy, vert) {												\
-	if(attribs.totorco) {														\
-		index = getFaceIndex(ss, f, S, x+dx, y+dy, edgeSize, gridSize); 		\
-		if(attribs.orco.glTexco)												\
-			glTexCoord3fv(attribs.orco.array[index]);							\
-		else																	\
-			glVertexAttrib3fvARB(attribs.orco.glIndex, attribs.orco.array[index]);	\
-	}																			\
-	for(b = 0; b < attribs.tottface; b++) {										\
-		MTFace *tf = &attribs.tface[b].array[a];								\
-		if(attribs.tface[b].glTexco)											\
-			glTexCoord2fv(tf->uv[vert]);										\
-		else																	\
-			glVertexAttrib2fvARB(attribs.tface[b].glIndex, tf->uv[vert]);		\
-	}																			\
-	for(b = 0; b < attribs.totmcol; b++) {										\
-		MCol *cp = &attribs.mcol[b].array[a*4 + vert];							\
-		GLubyte col[4];															\
-		col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a;				\
-		glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, col);					\
-	}																			\
-	if(attribs.tottang) {														\
-		float *tang = attribs.tang.array[a*4 + vert];							\
-		glVertexAttrib4fvARB(attribs.tang.glIndex, tang);						\
-	}																			\
+#define PASSATTRIB(dx, dy, vert) {                                              \
+	if (attribs.totorco) {                                                      \
+		index = getFaceIndex(ss, f, S, x + dx, y + dy, edgeSize, gridSize);     \
+		if (attribs.orco.glTexco)                                               \
+			glTexCoord3fv(attribs.orco.array[index]);                           \
+		else                                                                    \
+			glVertexAttrib3fvARB(attribs.orco.glIndex, attribs.orco.array[index]);  \
+	}                                                                           \
+	for (b = 0; b < attribs.tottface; b++) {                                    \
+		MTFace *tf = &attribs.tface[b].array[a];                                \
+		if (attribs.tface[b].glTexco)                                           \
+			glTexCoord2fv(tf->uv[vert]);                                        \
+		else                                                                    \
+			glVertexAttrib2fvARB(attribs.tface[b].glIndex, tf->uv[vert]);       \
+	}                                                                           \
+	for (b = 0; b < attribs.totmcol; b++) {                                     \
+		MCol *cp = &attribs.mcol[b].array[a * 4 + vert];                        \
+		GLubyte col[4];                                                         \
+		col[0] = cp->b; col[1] = cp->g; col[2] = cp->r; col[3] = cp->a;         \
+		glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, col);                    \
+	}                                                                           \
+	if (attribs.tottang) {                                                      \
+		float *tang = attribs.tang.array[a * 4 + vert];                         \
+		glVertexAttrib4fvARB(attribs.tang.glIndex, tang);                       \
+	}                                                                           \
 }
 
 	totface = ccgSubSurf_getNumFaces(ss);
-	for(a = 0, i = 0; i < totface; i++) {
+	for (a = 0, i = 0; i < totface; i++) {
 		CCGFace *f = ccgdm->faceMap[i].face;
 		int S, x, y, drawSmooth;
-		int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f));
+		int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
 		int origIndex = ccgDM_getFaceMapIndex(ss, f);
 		
 		numVerts = ccgSubSurf_getFaceNumVerts(f);
 
 		/* get flags */
-		if(faceFlags) {
-			drawSmooth = (faceFlags[index*2] & ME_SMOOTH);
-			new_matnr= faceFlags[index*2 + 1] + 1;
+		if (faceFlags) {
+			drawSmooth = (faceFlags[index].flag & ME_SMOOTH);
+			new_matnr = faceFlags[index].mat_nr + 1;
 		}
 		else {
 			drawSmooth = 1;
-			new_matnr= 1;
+			new_matnr = 1;
 		}
 
 		/* material */
-		if(new_matnr != matnr) {
+		if (new_matnr != matnr) {
 			setMaterial(userData, matnr = new_matnr, &gattribs);
 			DM_vertex_attributes_from_gpu(dm, &gattribs, &attribs);
 		}
 
 		/* face hiding */
-		if((setFace && (origIndex != ORIGINDEX_NONE) && !setFace(userData, origIndex))) {
-			a += gridFaces*gridFaces*numVerts;
+		if ((setFace && (origIndex != ORIGINDEX_NONE) && !setFace(userData, origIndex))) {
+			a += gridFaces * gridFaces * numVerts;
 			continue;
 		}
 
 		/* draw face*/
-		glShadeModel(drawSmooth? GL_SMOOTH: GL_FLAT);
-		for (S=0; S<numVerts; S++) {
+		glShadeModel(drawSmooth ? GL_SMOOTH : GL_FLAT);
+		for (S = 0; S < numVerts; S++) {
 			DMGridData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S);
 			DMGridData *vda, *vdb;
 
 			if (drawSmooth) {
-				for (y=0; y<gridFaces; y++) {
+				for (y = 0; y < gridFaces; y++) {
 					glBegin(GL_QUAD_STRIP);
-					for (x=0; x<gridFaces; x++) {
-						vda = &faceGridData[(y+0)*gridSize + x];
-						vdb = &faceGridData[(y+1)*gridSize + x];
+					for (x = 0; x < gridFaces; x++) {
+						vda = &faceGridData[(y + 0) * gridSize + x];
+						vdb = &faceGridData[(y + 1) * gridSize + x];
 						
 						PASSATTRIB(0, 0, 0);
 						glNormal3fv(vda->no);
@@ -1611,12 +1939,12 @@ static void ccgDM_drawMappedFacesMat(DerivedMesh *dm, void (*setMaterial)(void *
 						glNormal3fv(vdb->no);
 						glVertex3fv(vdb->co);
 
-						if(x != gridFaces-1)
+						if (x != gridFaces - 1)
 							a++;
 					}
 
-					vda = &faceGridData[(y+0)*gridSize + x];
-					vdb = &faceGridData[(y+1)*gridSize + x];
+					vda = &faceGridData[(y + 0) * gridSize + x];
+					vdb = &faceGridData[(y + 1) * gridSize + x];
 
 					PASSATTRIB(0, 0, 3);
 					glNormal3fv(vda->no);
@@ -1630,14 +1958,15 @@ static void ccgDM_drawMappedFacesMat(DerivedMesh *dm, void (*setMaterial)(void *
 
 					a++;
 				}
-			} else {
+			}
+			else {
 				glBegin(GL_QUADS);
-				for (y=0; y<gridFaces; y++) {
-					for (x=0; x<gridFaces; x++) {
-						float *aco = faceGridData[(y+0)*gridSize + x].co;
-						float *bco = faceGridData[(y+0)*gridSize + x + 1].co;
-						float *cco = faceGridData[(y+1)*gridSize + x + 1].co;
-						float *dco = faceGridData[(y+1)*gridSize + x].co;
+				for (y = 0; y < gridFaces; y++) {
+					for (x = 0; x < gridFaces; x++) {
+						float *aco = faceGridData[(y + 0) * gridSize + x].co;
+						float *bco = faceGridData[(y + 0) * gridSize + x + 1].co;
+						float *cco = faceGridData[(y + 1) * gridSize + x + 1].co;
+						float *dco = faceGridData[(y + 1) * gridSize + x].co;
 
 						ccgDM_glNormalFast(aco, bco, cco, dco);
 
@@ -1661,212 +1990,147 @@ static void ccgDM_drawMappedFacesMat(DerivedMesh *dm, void (*setMaterial)(void *
 #undef PASSATTRIB
 }
 
-
-static void ccgDM_drawFacesColored(DerivedMesh *dm, int UNUSED(useTwoSided), unsigned char *col1, unsigned char *col2) {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
-	CCGSubSurf *ss = ccgdm->ss;
-	int gridSize = ccgSubSurf_getGridSize(ss);
-	unsigned char *cp1, *cp2;
-	int useTwoSide=1, i, totface;
-
-	ccgdm_pbvh_update(ccgdm);
-
-	cp1= col1;
-	if(col2) {
-		cp2= col2;
-	} else {
-		cp2= NULL;
-		useTwoSide= 0;
-	}
-
-	glShadeModel(GL_SMOOTH);
-
-	if(col2) {
-		glEnable(GL_CULL_FACE);
-	}
-
-	glBegin(GL_QUADS);
-	totface = ccgSubSurf_getNumFaces(ss);
-	for(i = 0; i < totface; i++) {
-		CCGFace *f = ccgdm->faceMap[i].face;
-		int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
-
-		for (S=0; S<numVerts; S++) {
-			DMGridData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S);
-			for (y=0; y<gridSize-1; y++) {
-				for (x=0; x<gridSize-1; x++) {
-					float *a = faceGridData[(y+0)*gridSize + x].co;
-					float *b = faceGridData[(y+0)*gridSize + x + 1].co;
-					float *c = faceGridData[(y+1)*gridSize + x + 1].co;
-					float *d = faceGridData[(y+1)*gridSize + x].co;
-
-					glColor3ub(cp1[3], cp1[2], cp1[1]);
-					glVertex3fv(d);
-					glColor3ub(cp1[7], cp1[6], cp1[5]);
-					glVertex3fv(c);
-					glColor3ub(cp1[11], cp1[10], cp1[9]);
-					glVertex3fv(b);
-					glColor3ub(cp1[15], cp1[14], cp1[13]);
-					glVertex3fv(a);
-
-					if (useTwoSide) {
-						glColor3ub(cp2[15], cp2[14], cp2[13]);
-						glVertex3fv(a);
-						glColor3ub(cp2[11], cp2[10], cp2[9]);
-						glVertex3fv(b);
-						glColor3ub(cp2[7], cp2[6], cp2[5]);
-						glVertex3fv(c);
-						glColor3ub(cp2[3], cp2[2], cp2[1]);
-						glVertex3fv(d);
-					}
-
-					if (cp2) cp2+=16;
-					cp1+=16;
-				}
-			}
-		}
-	}
-	glEnd();
-}
-
 static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
-	int (*drawParams)(MTFace *tface, int has_mcol, int matnr),
-	int (*drawParamsMapped)(void *userData, int index),
-	int (*compareDrawOptions)(void *userData, int cur_index, int next_index),
-	void *userData) 
+                                      DMSetDrawOptionsTex drawParams,
+                                      DMSetDrawOptions drawParamsMapped,
+                                      DMCompareDrawOptions compareDrawOptions,
+                                      void *userData)
 {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 	CCGSubSurf *ss = ccgdm->ss;
-	MCol *mcol = dm->getFaceDataArray(dm, CD_WEIGHT_MCOL);
-	MTFace *tf = DM_get_face_data_layer(dm, CD_MTFACE);
-	char *faceFlags = ccgdm->faceFlags;
-	int i, totface, flag, gridSize = ccgSubSurf_getGridSize(ss);
+	MCol *mcol = dm->getTessFaceDataArray(dm, CD_PREVIEW_MCOL);
+	MTFace *tf = DM_get_tessface_data_layer(dm, CD_MTFACE);
+	DMFlagMat *faceFlags = ccgdm->faceFlags;
+	DMDrawOption draw_option;
+	int i, totface, gridSize = ccgSubSurf_getGridSize(ss);
 	int gridFaces = gridSize - 1;
 
 	(void) compareDrawOptions;
 
 	ccgdm_pbvh_update(ccgdm);
 
-	if(!mcol)
-		mcol = dm->getFaceDataArray(dm, CD_MCOL);
+	if (!mcol)
+		mcol = dm->getTessFaceDataArray(dm, CD_MCOL);
 
-	if(!mcol)
-		mcol = dm->getFaceDataArray(dm, CD_TEXTURE_MCOL);
+	if (!mcol)
+		mcol = dm->getTessFaceDataArray(dm, CD_TEXTURE_MCOL);
 
 	totface = ccgSubSurf_getNumFaces(ss);
-	for(i = 0; i < totface; i++) {
+	for (i = 0; i < totface; i++) {
 		CCGFace *f = ccgdm->faceMap[i].face;
 		int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
 		int drawSmooth, index = ccgDM_getFaceMapIndex(ss, f);
-		int origIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f));
-		unsigned char *cp= NULL;
+		int origIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
+		unsigned char *cp = NULL;
 		int mat_nr;
 
-		if(faceFlags) {
-			drawSmooth = (faceFlags[origIndex*2] & ME_SMOOTH);
-			mat_nr= faceFlags[origIndex*2 + 1];
+		if (faceFlags) {
+			drawSmooth = (faceFlags[origIndex].flag & ME_SMOOTH);
+			mat_nr = faceFlags[origIndex].mat_nr;
 		}
 		else {
 			drawSmooth = 1;
-			mat_nr= 0;
+			mat_nr = 0;
 		}
 
-		if(drawParams)
-			flag = drawParams(tf, (mcol != NULL), mat_nr);
+		if (drawParams)
+			draw_option = drawParams(tf, (mcol != NULL), mat_nr);
 		else if (index != ORIGINDEX_NONE)
-			flag= (drawParamsMapped)? drawParamsMapped(userData, index): 1;
+			draw_option = (drawParamsMapped) ? drawParamsMapped(userData, index) : DM_DRAW_OPTION_NORMAL;
 		else
-			flag= GPU_enable_material(mat_nr, NULL) ? 1:0;
+			draw_option = GPU_enable_material(mat_nr, NULL) ? DM_DRAW_OPTION_NORMAL : DM_DRAW_OPTION_SKIP;
 
 
-		if (flag == 0) { /* flag 0 == the face is hidden or invisible */
-			if(tf) tf += gridFaces*gridFaces*numVerts;
-			if(mcol) mcol += gridFaces*gridFaces*numVerts*4;
+		if (draw_option == DM_DRAW_OPTION_SKIP) {
+			if (tf) tf += gridFaces * gridFaces * numVerts;
+			if (mcol) mcol += gridFaces * gridFaces * numVerts * 4;
 			continue;
 		}
 
 		/* flag 1 == use vertex colors */
-		if(mcol) {
-			if(flag==1) cp= (unsigned char*)mcol;
-			mcol += gridFaces*gridFaces*numVerts*4;
+		if (mcol) {
+			if (draw_option != DM_DRAW_OPTION_NO_MCOL)
+				cp = (unsigned char *)mcol;
+			mcol += gridFaces * gridFaces * numVerts * 4;
 		}
 
-		for (S=0; S<numVerts; S++) {
+		for (S = 0; S < numVerts; S++) {
 			DMGridData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S);
 			DMGridData *a, *b;
 
 			if (drawSmooth) {
 				glShadeModel(GL_SMOOTH);
-				for (y=0; y<gridFaces; y++) {
+				for (y = 0; y < gridFaces; y++) {
 					glBegin(GL_QUAD_STRIP);
-					for (x=0; x<gridFaces; x++) {
-						a = &faceGridData[(y+0)*gridSize + x];
-						b = &faceGridData[(y+1)*gridSize + x];
+					for (x = 0; x < gridFaces; x++) {
+						a = &faceGridData[(y + 0) * gridSize + x];
+						b = &faceGridData[(y + 1) * gridSize + x];
 
-						if(tf) glTexCoord2fv(tf->uv[0]);
-						if(cp) glColor3ub(cp[3], cp[2], cp[1]);
+						if (tf) glTexCoord2fv(tf->uv[0]);
+						if (cp) glColor3ub(cp[3], cp[2], cp[1]);
 						glNormal3fv(a->no);
 						glVertex3fv(a->co);
 
-						if(tf) glTexCoord2fv(tf->uv[1]);
-						if(cp) glColor3ub(cp[7], cp[6], cp[5]);
+						if (tf) glTexCoord2fv(tf->uv[1]);
+						if (cp) glColor3ub(cp[7], cp[6], cp[5]);
 						glNormal3fv(b->no);
 						glVertex3fv(b->co);
 						
-						if(x != gridFaces-1) {
-							if(tf) tf++;
-							if(cp) cp += 16;
+						if (x != gridFaces - 1) {
+							if (tf) tf++;
+							if (cp) cp += 16;
 						}
 					}
 
-					a = &faceGridData[(y+0)*gridSize + x];
-					b = &faceGridData[(y+1)*gridSize + x];
+					a = &faceGridData[(y + 0) * gridSize + x];
+					b = &faceGridData[(y + 1) * gridSize + x];
 
-					if(tf) glTexCoord2fv(tf->uv[3]);
-					if(cp) glColor3ub(cp[15], cp[14], cp[13]);
+					if (tf) glTexCoord2fv(tf->uv[3]);
+					if (cp) glColor3ub(cp[15], cp[14], cp[13]);
 					glNormal3fv(a->no);
 					glVertex3fv(a->co);
 
-					if(tf) glTexCoord2fv(tf->uv[2]);
-					if(cp) glColor3ub(cp[11], cp[10], cp[9]);
+					if (tf) glTexCoord2fv(tf->uv[2]);
+					if (cp) glColor3ub(cp[11], cp[10], cp[9]);
 					glNormal3fv(b->no);
 					glVertex3fv(b->co);
 
-					if(tf) tf++;
-					if(cp) cp += 16;
+					if (tf) tf++;
+					if (cp) cp += 16;
 
 					glEnd();
 				}
-			} else {
+			}
+			else {
 				glShadeModel(GL_FLAT);
 				glBegin(GL_QUADS);
-				for (y=0; y<gridFaces; y++) {
-					for (x=0; x<gridFaces; x++) {
-						float *a_co = faceGridData[(y+0)*gridSize + x].co;
-						float *b_co = faceGridData[(y+0)*gridSize + x + 1].co;
-						float *c_co = faceGridData[(y+1)*gridSize + x + 1].co;
-						float *d_co = faceGridData[(y+1)*gridSize + x].co;
+				for (y = 0; y < gridFaces; y++) {
+					for (x = 0; x < gridFaces; x++) {
+						float *a_co = faceGridData[(y + 0) * gridSize + x].co;
+						float *b_co = faceGridData[(y + 0) * gridSize + x + 1].co;
+						float *c_co = faceGridData[(y + 1) * gridSize + x + 1].co;
+						float *d_co = faceGridData[(y + 1) * gridSize + x].co;
 
 						ccgDM_glNormalFast(a_co, b_co, c_co, d_co);
 
-						if(tf) glTexCoord2fv(tf->uv[1]);
-						if(cp) glColor3ub(cp[7], cp[6], cp[5]);
+						if (tf) glTexCoord2fv(tf->uv[1]);
+						if (cp) glColor3ub(cp[7], cp[6], cp[5]);
 						glVertex3fv(d_co);
 
-						if(tf) glTexCoord2fv(tf->uv[2]);
-						if(cp) glColor3ub(cp[11], cp[10], cp[9]);
+						if (tf) glTexCoord2fv(tf->uv[2]);
+						if (cp) glColor3ub(cp[11], cp[10], cp[9]);
 						glVertex3fv(c_co);
 
-						if(tf) glTexCoord2fv(tf->uv[3]);
-						if(cp) glColor3ub(cp[15], cp[14], cp[13]);
+						if (tf) glTexCoord2fv(tf->uv[3]);
+						if (cp) glColor3ub(cp[15], cp[14], cp[13]);
 						glVertex3fv(b_co);
 
-						if(tf) glTexCoord2fv(tf->uv[0]);
-						if(cp) glColor3ub(cp[3], cp[2], cp[1]);
+						if (tf) glTexCoord2fv(tf->uv[0]);
+						if (cp) glColor3ub(cp[3], cp[2], cp[1]);
 						glVertex3fv(a_co);
 
-						if(tf) tf++;
-						if(cp) cp += 16;
+						if (tf) tf++;
+						if (cp) cp += 16;
 					}
 				}
 				glEnd();
@@ -1876,17 +2140,17 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
 }
 
 static void ccgDM_drawFacesTex(DerivedMesh *dm,
-			   int (*setDrawOptions)(MTFace *tface, int has_mcol, int matnr),
-			   int (*compareDrawOptions)(void *userData, int cur_index, int next_index),
-			   void *userData)
+                               DMSetDrawOptionsTex setDrawOptions,
+                               DMCompareDrawOptions compareDrawOptions,
+                               void *userData)
 {
 	ccgDM_drawFacesTex_common(dm, setDrawOptions, NULL, compareDrawOptions, userData);
 }
 
 static void ccgDM_drawMappedFacesTex(DerivedMesh *dm,
-    int (*setDrawOptions)(void *userData, int index),
-    int (*compareDrawOptions)(void *userData, int cur_index, int next_index),
-    void *userData)
+                                     DMSetDrawOptions setDrawOptions,
+                                     DMCompareDrawOptions compareDrawOptions,
+                                     void *userData)
 {
 	ccgDM_drawFacesTex_common(dm, NULL, setDrawOptions, compareDrawOptions, userData);
 }
@@ -1894,24 +2158,25 @@ static void ccgDM_drawMappedFacesTex(DerivedMesh *dm,
 static void ccgDM_drawUVEdges(DerivedMesh *dm)
 {
 
-	MFace *mf = dm->getFaceArray(dm);
-	MTFace *tf = DM_get_face_data_layer(dm, CD_MTFACE);
+	MFace *mf = dm->getTessFaceArray(dm);
+	MTFace *tf = DM_get_tessface_data_layer(dm, CD_MTFACE);
 	int i;
 	
 	if (tf) {
 		glBegin(GL_LINES);
-		for(i = 0; i < dm->numFaceData; i++, mf++, tf++) {
-			if(!(mf->flag&ME_HIDE)) {
+		for (i = 0; i < dm->numTessFaceData; i++, mf++, tf++) {
+			if (!(mf->flag & ME_HIDE)) {
 				glVertex2fv(tf->uv[0]);
 				glVertex2fv(tf->uv[1]);
 	
 				glVertex2fv(tf->uv[1]);
 				glVertex2fv(tf->uv[2]);
 	
-				if(!mf->v4) {
+				if (!mf->v4) {
 					glVertex2fv(tf->uv[2]);
 					glVertex2fv(tf->uv[0]);
-				} else {
+				}
+				else {
 					glVertex2fv(tf->uv[2]);
 					glVertex2fv(tf->uv[3]);
 	
@@ -1925,133 +2190,140 @@ static void ccgDM_drawUVEdges(DerivedMesh *dm)
 }
 
 static void ccgDM_drawMappedFaces(DerivedMesh *dm,
-			int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r),
-			int (*setMaterial)(int, void *attribs),
-			int (*compareDrawOptions)(void *userData, int cur_index, int next_index),
-			void *userData, int useColors)
+                                  DMSetDrawOptions setDrawOptions,
+                                  DMSetMaterial setMaterial,
+                                  DMCompareDrawOptions compareDrawOptions,
+                                  void *userData, DMDrawFlag flag)
 {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 	CCGSubSurf *ss = ccgdm->ss;
-	MCol *mcol= NULL;
+	MCol *mcol = NULL;
 	int i, gridSize = ccgSubSurf_getGridSize(ss);
-	char *faceFlags = ccgdm->faceFlags;
+	DMFlagMat *faceFlags = ccgdm->faceFlags;
+	int useColors = flag & DM_DRAW_USE_COLORS;
 	int gridFaces = gridSize - 1, totface;
 
 	/* currently unused -- each original face is handled separately */
 	(void)compareDrawOptions;
 
-	if(useColors) {
-		mcol = dm->getFaceDataArray(dm, CD_WEIGHT_MCOL);
-		if(!mcol)
-			mcol = dm->getFaceDataArray(dm, CD_MCOL);
+	if (useColors) {
+		mcol = dm->getTessFaceDataArray(dm, CD_PREVIEW_MCOL);
+		if (!mcol)
+			mcol = dm->getTessFaceDataArray(dm, CD_MCOL);
 	}
 
 	totface = ccgSubSurf_getNumFaces(ss);
-	for(i = 0; i < totface; i++) {
+	for (i = 0; i < totface; i++) {
 		CCGFace *f = ccgdm->faceMap[i].face;
 		int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
 		int drawSmooth, index = ccgDM_getFaceMapIndex(ss, f);
 		int origIndex;
-		unsigned char *cp= NULL;
+		unsigned char *cp = NULL;
 
-		origIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f));
+		origIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
 
-		if(faceFlags) drawSmooth = (faceFlags[origIndex*2] & ME_SMOOTH);
+		if (flag & DM_DRAW_ALWAYS_SMOOTH) drawSmooth = 1;
+		else if (faceFlags) drawSmooth = (faceFlags[origIndex].flag & ME_SMOOTH);
 		else drawSmooth = 1;
 
-		if(mcol) {
-			cp= (unsigned char*)mcol;
-			mcol += gridFaces*gridFaces*numVerts*4;
+		if (mcol) {
+			cp = (unsigned char *)mcol;
+			mcol += gridFaces * gridFaces * numVerts * 4;
 		}
 
 		{
-			int draw= 1;
+			DMDrawOption draw_option = DM_DRAW_OPTION_NORMAL;
 
-			if(index == ORIGINDEX_NONE)
-				draw= setMaterial(faceFlags ? faceFlags[origIndex*2 + 1] + 1: 1, NULL); /* XXX, no faceFlags no material */
+			if (index == ORIGINDEX_NONE)
+				draw_option = setMaterial(faceFlags ? faceFlags[origIndex].mat_nr + 1 : 1, NULL);  /* XXX, no faceFlags no material */
 			else if (setDrawOptions)
-				draw= setDrawOptions(userData, index, &drawSmooth);
+				draw_option = setDrawOptions(userData, index);
 
-			if (draw) {
-				if (draw==2) {
-					  glEnable(GL_POLYGON_STIPPLE);
-					  glPolygonStipple(stipple_quarttone);
+			if (draw_option != DM_DRAW_OPTION_SKIP) {
+				if (draw_option == DM_DRAW_OPTION_STIPPLE) {
+					glEnable(GL_POLYGON_STIPPLE);
+					glPolygonStipple(stipple_quarttone);
 				}
 
 				/* no need to set shading mode to flat because
-				*  normals are already used to change shading */
+				 *  normals are already used to change shading */
 				glShadeModel(GL_SMOOTH);
 				
-				for (S=0; S<numVerts; S++) {
+				for (S = 0; S < numVerts; S++) {
 					DMGridData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S);
 					if (drawSmooth) {
-						for (y=0; y<gridFaces; y++) {
+						for (y = 0; y < gridFaces; y++) {
 							DMGridData *a, *b;
 							glBegin(GL_QUAD_STRIP);
-							for (x=0; x<gridFaces; x++) {
-								a = &faceGridData[(y+0)*gridSize + x];
-								b = &faceGridData[(y+1)*gridSize + x];
+							for (x = 0; x < gridFaces; x++) {
+								a = &faceGridData[(y + 0) * gridSize + x];
+								b = &faceGridData[(y + 1) * gridSize + x];
 	
-								if(cp) glColor3ub(cp[3], cp[2], cp[1]);
+								if (cp) glColor3ub(cp[3], cp[2], cp[1]);
 								glNormal3fv(a->no);
 								glVertex3fv(a->co);
-								if(cp) glColor3ub(cp[7], cp[6], cp[5]);
+								if (cp) glColor3ub(cp[7], cp[6], cp[5]);
 								glNormal3fv(b->no);
 								glVertex3fv(b->co);
 
-								if(x != gridFaces-1) {
-									if(cp) cp += 16;
+								if (x != gridFaces - 1) {
+									if (cp) cp += 16;
 								}
 							}
 
-							a = &faceGridData[(y+0)*gridSize + x];
-							b = &faceGridData[(y+1)*gridSize + x];
+							a = &faceGridData[(y + 0) * gridSize + x];
+							b = &faceGridData[(y + 1) * gridSize + x];
 
-							if(cp) glColor3ub(cp[15], cp[14], cp[13]);
+							if (cp) glColor3ub(cp[15], cp[14], cp[13]);
 							glNormal3fv(a->no);
 							glVertex3fv(a->co);
-							if(cp) glColor3ub(cp[11], cp[10], cp[9]);
+							if (cp) glColor3ub(cp[11], cp[10], cp[9]);
 							glNormal3fv(b->no);
 							glVertex3fv(b->co);
 
-							if(cp) cp += 16;
+							if (cp) cp += 16;
 
 							glEnd();
 						}
-					} else {
+					}
+					else {
 						glBegin(GL_QUADS);
-						for (y=0; y<gridFaces; y++) {
-							for (x=0; x<gridFaces; x++) {
-								float *a = faceGridData[(y+0)*gridSize + x].co;
-								float *b = faceGridData[(y+0)*gridSize + x + 1].co;
-								float *c = faceGridData[(y+1)*gridSize + x + 1].co;
-								float *d = faceGridData[(y+1)*gridSize + x].co;
+						for (y = 0; y < gridFaces; y++) {
+							for (x = 0; x < gridFaces; x++) {
+								float *a = faceGridData[(y + 0) * gridSize + x].co;
+								float *b = faceGridData[(y + 0) * gridSize + x + 1].co;
+								float *c = faceGridData[(y + 1) * gridSize + x + 1].co;
+								float *d = faceGridData[(y + 1) * gridSize + x].co;
 
 								ccgDM_glNormalFast(a, b, c, d);
 	
-								if(cp) glColor3ub(cp[7], cp[6], cp[5]);
+								if (cp) glColor3ub(cp[7], cp[6], cp[5]);
 								glVertex3fv(d);
-								if(cp) glColor3ub(cp[11], cp[10], cp[9]);
+								if (cp) glColor3ub(cp[11], cp[10], cp[9]);
 								glVertex3fv(c);
-								if(cp) glColor3ub(cp[15], cp[14], cp[13]);
+								if (cp) glColor3ub(cp[15], cp[14], cp[13]);
 								glVertex3fv(b);
-								if(cp) glColor3ub(cp[3], cp[2], cp[1]);
+								if (cp) glColor3ub(cp[3], cp[2], cp[1]);
 								glVertex3fv(a);
 
-								if(cp) cp += 16;
+								if (cp) cp += 16;
 							}
 						}
 						glEnd();
 					}
 				}
-				if (draw==2)
+				if (draw_option == DM_DRAW_OPTION_STIPPLE)
 					glDisable(GL_POLYGON_STIPPLE);
 			}
 		}
 	}
 }
-static void ccgDM_drawMappedEdges(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index), void *userData) {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+
+static void ccgDM_drawMappedEdges(DerivedMesh *dm,
+                                  DMSetDrawOptions setDrawOptions,
+                                  void *userData)
+{
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 	CCGSubSurf *ss = ccgdm->ss;
 	CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss);
 	int i, useAging, edgeSize = ccgSubSurf_getEdgeSize(ss);
@@ -2064,15 +2336,15 @@ static void ccgDM_drawMappedEdges(DerivedMesh *dm, int (*setDrawOptions)(void *u
 		int index = ccgDM_getEdgeMapIndex(ss, e);
 
 		glBegin(GL_LINE_STRIP);
-		if (index!=-1 && (!setDrawOptions || setDrawOptions(userData, index))) {
-			if (useAging && !(G.f&G_BACKBUFSEL)) {
-				int ageCol = 255-ccgSubSurf_getEdgeAge(ss, e)*4;
-				glColor3ub(0, ageCol>0?ageCol:0, 0);
+		if (index != -1 && (!setDrawOptions || (setDrawOptions(userData, index) != DM_DRAW_OPTION_SKIP))) {
+			if (useAging && !(G.f & G_BACKBUFSEL)) {
+				int ageCol = 255 - ccgSubSurf_getEdgeAge(ss, e) * 4;
+				glColor3ub(0, ageCol > 0 ? ageCol : 0, 0);
 			}
 
-			for (i=0; i<edgeSize-1; i++) {
+			for (i = 0; i < edgeSize - 1; i++) {
 				glVertex3fv(edgeData[i].co);
-				glVertex3fv(edgeData[i+1].co);
+				glVertex3fv(edgeData[i + 1].co);
 			}
 		}
 		glEnd();
@@ -2080,8 +2352,13 @@ static void ccgDM_drawMappedEdges(DerivedMesh *dm, int (*setDrawOptions)(void *u
 
 	ccgEdgeIterator_free(ei);
 }
-static void ccgDM_drawMappedEdgesInterp(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index), void (*setDrawInterpOptions)(void *userData, int index, float t), void *userData) {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+
+static void ccgDM_drawMappedEdgesInterp(DerivedMesh *dm,
+                                        DMSetDrawOptions setDrawOptions,
+                                        DMSetDrawInterpOptions setDrawInterpOptions,
+                                        void *userData)
+{
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 	CCGSubSurf *ss = ccgdm->ss;
 	CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss);
 	int i, useAging, edgeSize = ccgSubSurf_getEdgeSize(ss);
@@ -2094,13 +2371,13 @@ static void ccgDM_drawMappedEdgesInterp(DerivedMesh *dm, int (*setDrawOptions)(v
 		int index = ccgDM_getEdgeMapIndex(ss, e);
 
 		glBegin(GL_LINE_STRIP);
-		if (index!=-1 && (!setDrawOptions || setDrawOptions(userData, index))) {
-			for (i=0; i<edgeSize; i++) {
-				setDrawInterpOptions(userData, index, (float) i/(edgeSize-1));
+		if (index != -1 && (!setDrawOptions || (setDrawOptions(userData, index) != DM_DRAW_OPTION_SKIP))) {
+			for (i = 0; i < edgeSize; i++) {
+				setDrawInterpOptions(userData, index, (float) i / (edgeSize - 1));
 
-				if (useAging && !(G.f&G_BACKBUFSEL)) {
-					int ageCol = 255-ccgSubSurf_getEdgeAge(ss, e)*4;
-					glColor3ub(0, ageCol>0?ageCol:0, 0);
+				if (useAging && !(G.f & G_BACKBUFSEL)) {
+					int ageCol = 255 - ccgSubSurf_getEdgeAge(ss, e) * 4;
+					glColor3ub(0, ageCol > 0 ? ageCol : 0, 0);
 				}
 
 				glVertex3fv(edgeData[i].co);
@@ -2111,8 +2388,13 @@ static void ccgDM_drawMappedEdgesInterp(DerivedMesh *dm, int (*setDrawOptions)(v
 
 	ccgEdgeIterator_free(ei);
 }
-static void ccgDM_foreachMappedFaceCenter(DerivedMesh *dm, void (*func)(void *userData, int index, float *co, float *no), void *userData) {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+
+static void ccgDM_foreachMappedFaceCenter(
+    DerivedMesh *dm,
+    void (*func)(void *userData, int index, const float co[3], const float no[3]),
+    void *userData)
+{
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 	CCGSubSurf *ss = ccgdm->ss;
 	CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss);
 
@@ -2120,8 +2402,8 @@ static void ccgDM_foreachMappedFaceCenter(DerivedMesh *dm, void (*func)(void *us
 		CCGFace *f = ccgFaceIterator_getCurrent(fi);
 		int index = ccgDM_getFaceMapIndex(ss, f);
 
-		if (index!=-1) {
-				/* Face center data normal isn't updated atm. */
+		if (index != -1) {
+			/* Face center data normal isn't updated atm. */
 			DMGridData *vd = ccgSubSurf_getFaceGridData(ss, f, 0, 0, 0);
 
 			func(userData, index, vd->co, vd->no);
@@ -2131,26 +2413,46 @@ static void ccgDM_foreachMappedFaceCenter(DerivedMesh *dm, void (*func)(void *us
 	ccgFaceIterator_free(fi);
 }
 
-static void ccgDM_release(DerivedMesh *dm) {
-	CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+static void ccgDM_release(DerivedMesh *dm)
+{
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
 
 	if (DM_release(dm)) {
 		/* Before freeing, need to update the displacement map */
-		if(ccgdm->multires.modified) {
+		if (ccgdm->multires.modified_flags) {
 			/* Check that mmd still exists */
-			if(!ccgdm->multires.local_mmd && BLI_findindex(&ccgdm->multires.ob->modifiers, ccgdm->multires.mmd) < 0)
+			if (!ccgdm->multires.local_mmd &&
+			    BLI_findindex(&ccgdm->multires.ob->modifiers, ccgdm->multires.mmd) < 0)
 				ccgdm->multires.mmd = NULL;
-			if(ccgdm->multires.mmd)
-				ccgdm->multires.update(dm);
+			
+			if (ccgdm->multires.mmd) {
+				if (ccgdm->multires.modified_flags & MULTIRES_COORDS_MODIFIED)
+					multires_modifier_update_mdisps(dm);
+				if (ccgdm->multires.modified_flags & MULTIRES_HIDDEN_MODIFIED)
+					multires_modifier_update_hidden(dm);
+			}
 		}
 
-		if(ccgdm->gridFaces) MEM_freeN(ccgdm->gridFaces);
-		if(ccgdm->gridData) MEM_freeN(ccgdm->gridData);
-		if(ccgdm->gridAdjacency) MEM_freeN(ccgdm->gridAdjacency);
-		if(ccgdm->gridOffset) MEM_freeN(ccgdm->gridOffset);
-		if(ccgdm->freeSS) ccgSubSurf_free(ccgdm->ss);
-		if(ccgdm->fmap) MEM_freeN(ccgdm->fmap);
-		if(ccgdm->fmap_mem) MEM_freeN(ccgdm->fmap_mem);
+		if (ccgdm->ehash)
+			BLI_edgehash_free(ccgdm->ehash, NULL);
+
+		if (ccgdm->reverseFaceMap) MEM_freeN(ccgdm->reverseFaceMap);
+		if (ccgdm->gridFaces) MEM_freeN(ccgdm->gridFaces);
+		if (ccgdm->gridData) MEM_freeN(ccgdm->gridData);
+		if (ccgdm->gridAdjacency) MEM_freeN(ccgdm->gridAdjacency);
+		if (ccgdm->gridOffset) MEM_freeN(ccgdm->gridOffset);
+		if (ccgdm->gridFlagMats) MEM_freeN(ccgdm->gridFlagMats);
+		if (ccgdm->gridHidden) {
+			int i, numGrids = dm->getNumGrids(dm);
+			for (i = 0; i < numGrids; i++) {
+				if (ccgdm->gridHidden[i])
+					MEM_freeN(ccgdm->gridHidden[i]);
+			}
+			MEM_freeN(ccgdm->gridHidden);
+		}
+		if (ccgdm->freeSS) ccgSubSurf_free(ccgdm->ss);
+		if (ccgdm->pmap) MEM_freeN(ccgdm->pmap);
+		if (ccgdm->pmap_mem) MEM_freeN(ccgdm->pmap_mem);
 		MEM_freeN(ccgdm->edgeFlags);
 		MEM_freeN(ccgdm->faceFlags);
 		MEM_freeN(ccgdm->vertMap);
@@ -2160,26 +2462,84 @@ static void ccgDM_release(DerivedMesh *dm) {
 	}
 }
 
+static void ccg_loops_to_corners(CustomData *fdata, CustomData *ldata, 
+                                 CustomData *pdata, int loopstart, int findex,  int polyindex,
+                                 const int numTex, const int numCol, const int hasPCol, const int hasOrigSpace)
+{
+	MTFace *texface;
+	MTexPoly *texpoly;
+	MCol *mcol;
+	MLoopCol *mloopcol;
+	MLoopUV *mloopuv;
+	int i, j;
+
+	for (i = 0; i < numTex; i++) {
+		texface = CustomData_get_n(fdata, CD_MTFACE, findex, i);
+		texpoly = CustomData_get_n(pdata, CD_MTEXPOLY, polyindex, i);
+		
+		ME_MTEXFACE_CPY(texface, texpoly);
+
+		mloopuv = CustomData_get_n(ldata, CD_MLOOPUV, loopstart, i);
+		for (j = 0; j < 4; j++, mloopuv++) {
+			copy_v2_v2(texface->uv[j], mloopuv->uv);
+		}
+	}
+
+	for (i = 0; i < numCol; i++) {
+		mloopcol = CustomData_get_n(ldata, CD_MLOOPCOL, loopstart, i);
+		mcol = CustomData_get_n(fdata, CD_MCOL, findex, i);
+
+		for (j = 0; j < 4; j++, mloopcol++) {
+			MESH_MLOOPCOL_TO_MCOL(mloopcol, &mcol[j]);
+		}
+	}
+	
+	if (hasPCol) {
+		mloopcol = CustomData_get(ldata, loopstart, CD_PREVIEW_MLOOPCOL);
+		mcol = CustomData_get(fdata, findex, CD_PREVIEW_MCOL);
+
+		for (j = 0; j < 4; j++, mloopcol++) {
+			MESH_MLOOPCOL_TO_MCOL(mloopcol, &mcol[j]);
+		}
+	}
+
+	if (hasOrigSpace) {
+		OrigSpaceFace *of = CustomData_get(fdata, findex, CD_ORIGSPACE);
+		OrigSpaceLoop *lof;
+
+		lof = CustomData_get(ldata, loopstart, CD_ORIGSPACE_MLOOP);
+		for (j = 0; j < 4; j++, lof++) {
+			copy_v2_v2(of->uv[j], lof->uv);
+		}
+	}
+}
+
 static void *ccgDM_get_vert_data_layer(DerivedMesh *dm, int type)
 {
-	if(type == CD_ORIGINDEX) {
+	if (type == CD_ORIGINDEX) {
 		/* create origindex on demand to save memory */
-		CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm;
-		CCGSubSurf *ss= ccgdm->ss;
+		CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;
+		CCGSubSurf *ss = ccgdm->ss;
 		int *origindex;
 		int a, index, totnone, totorig;
 
+		/* Avoid re-creation if the layer exists already */
+		origindex = DM_get_vert_data_layer(dm, CD_ORIGINDEX);
+		if (origindex) {
+			return origindex;
+		}
+
 		DM_add_vert_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL);
-		origindex= DM_get_vert_data_layer(dm, CD_ORIGINDEX);
+		origindex = DM_get_vert_data_layer(dm, CD_ORIGINDEX);
 
 		totorig = ccgSubSurf_getNumVerts(ss);
-		totnone= dm->numVertData - totorig;
+		totnone = dm->numVertData - totorig;
 
 		/* original vertices are at the end */
-		for(a=0; a<totnone; a++)
-			origindex[a]= ORIGINDEX_NONE;
+		for (a = 0; a < totnone; a++)
+			origindex[a] = ORIGINDEX_NONE;
 
-		for(index=0; index<totorig; index++, a++) {
+		for (index = 0; index < totorig; index++, a++) {
 			CCGVert *v = ccgdm->vertMap[index].vert;
 			origindex[a] = ccgDM_getVertMapIndex(ccgdm->ss, v);
 		}
@@ -2192,31 +2552,37 @@ static void *ccgDM_get_vert_data_layer(DerivedMesh *dm, int type)
 
 static void *ccgDM_get_edge_data_layer(DerivedMesh *dm, int type)
 {
-	if(type == CD_ORIGINDEX) {
+	if (type == CD_ORIGINDEX) {
 		/* create origindex on demand to save memory */
-		CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm;
-		CCGSubSurf *ss= ccgdm->ss;
+		CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;
+		CCGSubSurf *ss = ccgdm->ss;
 		int *origindex;
 		int a, i, index, totnone, totorig, totedge;
-		int edgeSize= ccgSubSurf_getEdgeSize(ss);
+		int edgeSize = ccgSubSurf_getEdgeSize(ss);
+
+		/* Avoid re-creation if the layer exists already */
+		origindex = DM_get_edge_data_layer(dm, CD_ORIGINDEX);
+		if (origindex) {
+			return origindex;
+		}
 
 		DM_add_edge_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL);
-		origindex= DM_get_edge_data_layer(dm, CD_ORIGINDEX);
+		origindex = DM_get_edge_data_layer(dm, CD_ORIGINDEX);
 
-		totedge= ccgSubSurf_getNumEdges(ss);
-		totorig= totedge*(edgeSize - 1);
-		totnone= dm->numEdgeData - totorig;
+		totedge = ccgSubSurf_getNumEdges(ss);
+		totorig = totedge * (edgeSize - 1);
+		totnone = dm->numEdgeData - totorig;
 
 		/* original edges are at the end */
-		for(a=0; a<totnone; a++)
-			origindex[a]= ORIGINDEX_NONE;
+		for (a = 0; a < totnone; a++)
+			origindex[a] = ORIGINDEX_NONE;
 
-		for(index=0; index<totedge; index++) {
-			CCGEdge *e= ccgdm->edgeMap[index].edge;
-			int mapIndex= ccgDM_getEdgeMapIndex(ss, e);
+		for (index = 0; index < totedge; index++) {
+			CCGEdge *e = ccgdm->edgeMap[index].edge;
+			int mapIndex = ccgDM_getEdgeMapIndex(ss, e);
 
-			for(i = 0; i < edgeSize - 1; i++, a++)
-				origindex[a]= mapIndex;
+			for (i = 0; i < edgeSize - 1; i++, a++)
+				origindex[a] = mapIndex;
 		}
 
 		return origindex;
@@ -2225,45 +2591,81 @@ static void *ccgDM_get_edge_data_layer(DerivedMesh *dm, int type)
 	return DM_get_edge_data_layer(dm, type);
 }
 
-static void *ccgDM_get_face_data_layer(DerivedMesh *dm, int type)
+static void *ccgDM_get_tessface_data_layer(DerivedMesh *dm, int type)
 {
-	if(type == CD_ORIGINDEX) {
+	if (type == CD_ORIGINDEX) {
 		/* create origindex on demand to save memory */
-		CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm;
-		CCGSubSurf *ss= ccgdm->ss;
+		CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;
+		CCGSubSurf *ss = ccgdm->ss;
 		int *origindex;
 		int a, i, index, totface;
 		int gridFaces = ccgSubSurf_getGridSize(ss) - 1;
 
-		DM_add_face_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL);
-		origindex= DM_get_face_data_layer(dm, CD_ORIGINDEX);
+		/* Avoid re-creation if the layer exists already */
+		origindex = DM_get_tessface_data_layer(dm, CD_ORIGINDEX);
+		if (origindex) {
+			return origindex;
+		}
 
-		totface= ccgSubSurf_getNumFaces(ss);
+		DM_add_tessface_layer(dm, CD_ORIGINDEX, CD_CALLOC, NULL);
+		origindex = DM_get_tessface_data_layer(dm, CD_ORIGINDEX);
 
-		for(a=0, index=0; index<totface; index++) {
+		totface = ccgSubSurf_getNumFaces(ss);
+
+		for (a = 0, index = 0; index < totface; index++) {
 			CCGFace *f = ccgdm->faceMap[index].face;
 			int numVerts = ccgSubSurf_getFaceNumVerts(f);
 			int mapIndex = ccgDM_getFaceMapIndex(ss, f);
 
-			for(i=0; i<gridFaces*gridFaces*numVerts; i++, a++)
-				origindex[a]= mapIndex;
+			for (i = 0; i < gridFaces * gridFaces * numVerts; i++, a++)
+				origindex[a] = mapIndex;
 		}
 
 		return origindex;
 	}
 
-	return DM_get_face_data_layer(dm, type);
+	return DM_get_tessface_data_layer(dm, type);
+}
+
+static void *ccgDM_get_vert_data(DerivedMesh *dm, int index, int type)
+{
+	if (type == CD_ORIGINDEX) {
+		/* ensure creation of CD_ORIGINDEX layer */
+		ccgDM_get_vert_data_layer(dm, type);
+	}
+
+	return DM_get_vert_data(dm, index, type);
+}
+
+static void *ccgDM_get_edge_data(DerivedMesh *dm, int index, int type)
+{
+	if (type == CD_ORIGINDEX) {
+		/* ensure creation of CD_ORIGINDEX layer */
+		ccgDM_get_edge_data_layer(dm, type);
+	}
+
+	return DM_get_edge_data(dm, index, type);
+}
+
+static void *ccgDM_get_tessface_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_tessface_data(dm, index, type);
 }
 
 static int ccgDM_getNumGrids(DerivedMesh *dm)
 {
-	CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm;
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;
 	int index, numFaces, numGrids;
 
-	numFaces= ccgSubSurf_getNumFaces(ccgdm->ss);
-	numGrids= 0;
+	numFaces = ccgSubSurf_getNumFaces(ccgdm->ss);
+	numGrids = 0;
 
-	for(index=0; index<numFaces; index++) {
+	for (index = 0; index < numFaces; index++) {
 		CCGFace *f = ccgdm->faceMap[index].face;
 		numGrids += ccgSubSurf_getFaceNumVerts(f);
 	}
@@ -2273,55 +2675,56 @@ static int ccgDM_getNumGrids(DerivedMesh *dm)
 
 static int ccgDM_getGridSize(DerivedMesh *dm)
 {
-	CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm;
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;
 	return ccgSubSurf_getGridSize(ccgdm->ss);
 }
 
-static int ccgdm_adjacent_grid(CCGSubSurf *ss, int *gridOffset, CCGFace *f, int S, int offset)
+static int ccgdm_adjacent_grid(int *gridOffset, CCGFace *f, int S, int offset)
 {
 	CCGFace *adjf;
 	CCGEdge *e;
-	int i, j= 0, numFaces, fIndex, numEdges= 0;
+	int i, j = 0, numFaces, fIndex, numEdges = 0;
 
-	e = ccgSubSurf_getFaceEdge(ss, f, S);
+	e = ccgSubSurf_getFaceEdge(f, S);
 	numFaces = ccgSubSurf_getEdgeNumFaces(e);
 
-	if(numFaces != 2)
+	if (numFaces != 2)
 		return -1;
 
-	for(i = 0; i < numFaces; i++) {
+	for (i = 0; i < numFaces; i++) {
 		adjf = ccgSubSurf_getEdgeFace(e, i);
 
-		if(adjf != f) {
+		if (adjf != f) {
 			numEdges = ccgSubSurf_getFaceNumVerts(adjf);
-			for(j = 0; j < numEdges; j++)
-				if(ccgSubSurf_getFaceEdge(ss, adjf, j) == e)
+			for (j = 0; j < numEdges; j++)
+				if (ccgSubSurf_getFaceEdge(adjf, j) == e)
 					break;
 
-			if(j != numEdges)
+			if (j != numEdges)
 				break;
 		}
 	}
 
-	if(numEdges == 0)
+	if (numEdges == 0)
 		return -1;
 	
-	fIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, adjf));
+	fIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(adjf));
 
-	return gridOffset[fIndex] + (j + offset)%numEdges;
+	return gridOffset[fIndex] + (j + offset) % numEdges;
 }
 
 static void ccgdm_create_grids(DerivedMesh *dm)
 {
-	CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm;
-	CCGSubSurf *ss= ccgdm->ss;
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;
+	CCGSubSurf *ss = ccgdm->ss;
 	DMGridData **gridData;
 	DMGridAdjacency *gridAdjacency, *adj;
+	DMFlagMat *gridFlagMats;
 	CCGFace **gridFaces;
 	int *gridOffset;
 	int index, numFaces, numGrids, S, gIndex /*, gridSize*/;
 
-	if(ccgdm->gridData)
+	if (ccgdm->gridData)
 		return;
 	
 	numGrids = ccgDM_getNumGrids(dm);
@@ -2329,9 +2732,9 @@ static void ccgdm_create_grids(DerivedMesh *dm)
 	/*gridSize = ccgDM_getGridSize(dm);*/  /*UNUSED*/
 
 	/* compute offset into grid array for each face */
-	gridOffset = MEM_mallocN(sizeof(int)*numFaces, "ccgdm.gridOffset");
+	gridOffset = MEM_mallocN(sizeof(int) * numFaces, "ccgdm.gridOffset");
 
-	for(gIndex = 0, index = 0; index < numFaces; index++) {
+	for (gIndex = 0, index = 0; index < numFaces; index++) {
 		CCGFace *f = ccgdm->faceMap[index].face;
 		int numVerts = ccgSubSurf_getFaceNumVerts(f);
 
@@ -2340,28 +2743,32 @@ static void ccgdm_create_grids(DerivedMesh *dm)
 	}
 
 	/* compute grid data */
-	gridData = MEM_mallocN(sizeof(DMGridData*)*numGrids, "ccgdm.gridData");
-	gridAdjacency = MEM_mallocN(sizeof(DMGridAdjacency)*numGrids, "ccgdm.gridAdjacency");
-	gridFaces = MEM_mallocN(sizeof(CCGFace*)*numGrids, "ccgdm.gridFaces");
+	gridData = MEM_mallocN(sizeof(DMGridData *) * numGrids, "ccgdm.gridData");
+	gridAdjacency = MEM_mallocN(sizeof(DMGridAdjacency) * numGrids, "ccgdm.gridAdjacency");
+	gridFaces = MEM_mallocN(sizeof(CCGFace *) * numGrids, "ccgdm.gridFaces");
+	gridFlagMats = MEM_mallocN(sizeof(DMFlagMat) * numGrids, "ccgdm.gridFlagMats");
+
+	ccgdm->gridHidden = MEM_callocN(sizeof(BLI_bitmap) * numGrids, "ccgdm.gridHidden");
 
-	for(gIndex = 0, index = 0; index < numFaces; index++) {
+	for (gIndex = 0, index = 0; index < numFaces; index++) {
 		CCGFace *f = ccgdm->faceMap[index].face;
 		int numVerts = ccgSubSurf_getFaceNumVerts(f);
 
-		for(S = 0; S < numVerts; S++, gIndex++) {
+		for (S = 0; S < numVerts; S++, gIndex++) {
 			int prevS = (S - 1 + numVerts) % numVerts;
 			int nextS = (S + 1 + numVerts) % numVerts;
 
 			gridData[gIndex] = ccgSubSurf_getFaceGridDataArray(ss, f, S);
 			gridFaces[gIndex] = f;
+			gridFlagMats[gIndex] = ccgdm->faceFlags[index];
 
 			adj = &gridAdjacency[gIndex];
 
 			adj->index[0] = gIndex - S + nextS;
 			adj->rotation[0] = 3;
-			adj->index[1] = ccgdm_adjacent_grid(ss, gridOffset, f, prevS, 0);
+			adj->index[1] = ccgdm_adjacent_grid(gridOffset, f, prevS, 0);
 			adj->rotation[1] = 1;
-			adj->index[2] = ccgdm_adjacent_grid(ss, gridOffset, f, S, 1);
+			adj->index[2] = ccgdm_adjacent_grid(gridOffset, f, S, 1);
 			adj->rotation[2] = 3;
 			adj->index[3] = gIndex - S + prevS;
 			adj->rotation[3] = 1;
@@ -2372,11 +2779,12 @@ static void ccgdm_create_grids(DerivedMesh *dm)
 	ccgdm->gridFaces = gridFaces;
 	ccgdm->gridAdjacency = gridAdjacency;
 	ccgdm->gridOffset = gridOffset;
+	ccgdm->gridFlagMats = gridFlagMats;
 }
 
 static DMGridData **ccgDM_getGridData(DerivedMesh *dm)
 {
-	CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm;
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;
 
 	ccgdm_create_grids(dm);
 	return ccgdm->gridData;
@@ -2384,7 +2792,7 @@ static DMGridData **ccgDM_getGridData(DerivedMesh *dm)
 
 static DMGridAdjacency *ccgDM_getGridAdjacency(DerivedMesh *dm)
 {
-	CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm;
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;
 
 	ccgdm_create_grids(dm);
 	return ccgdm->gridAdjacency;
@@ -2392,33 +2800,50 @@ static DMGridAdjacency *ccgDM_getGridAdjacency(DerivedMesh *dm)
 
 static int *ccgDM_getGridOffset(DerivedMesh *dm)
 {
-	CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm;
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;
 
 	ccgdm_create_grids(dm);
 	return ccgdm->gridOffset;
 }
 
-static ListBase *ccgDM_getFaceMap(Object *ob, DerivedMesh *dm)
+static DMFlagMat *ccgDM_getGridFlagMats(DerivedMesh *dm)
 {
-	CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm;
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;
+	
+	ccgdm_create_grids(dm);
+	return ccgdm->gridFlagMats;
+}
 
-	if(!ccgdm->multires.mmd && !ccgdm->fmap && ob->type == OB_MESH) {
-		Mesh *me= ob->data;
+static BLI_bitmap *ccgDM_getGridHidden(DerivedMesh *dm)
+{
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;
+	
+	ccgdm_create_grids(dm);
+	return ccgdm->gridHidden;
+}
 
-		create_vert_face_map(&ccgdm->fmap, &ccgdm->fmap_mem, me->mface,
-				     me->totvert, me->totface);
+static const MeshElemMap *ccgDM_getPolyMap(Object *ob, DerivedMesh *dm)
+{
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;
+
+	if (!ccgdm->multires.mmd && !ccgdm->pmap && ob->type == OB_MESH) {
+		Mesh *me = ob->data;
+
+		create_vert_poly_map(&ccgdm->pmap, &ccgdm->pmap_mem,
+		                     me->mpoly, me->mloop,
+		                     me->totvert, me->totpoly, me->totloop);
 	}
 
-	return ccgdm->fmap;
+	return ccgdm->pmap;
 }
 
 static int ccgDM_use_grid_pbvh(CCGDerivedMesh *ccgdm)
 {
-	MultiresModifierData *mmd= ccgdm->multires.mmd;
+	MultiresModifierData *mmd = ccgdm->multires.mmd;
 
-	/* both of multires and subsurm modifiers are CCG, but
-	   grids should only be used when sculpting on multires */
-	if(!mmd)
+	/* both of multires and subsurf modifiers are CCG, but
+	 * grids should only be used when sculpting on multires */
+	if (!mmd)
 		return 0;
 
 	return 1;
@@ -2426,61 +2851,73 @@ static int ccgDM_use_grid_pbvh(CCGDerivedMesh *ccgdm)
 
 static struct PBVH *ccgDM_getPBVH(Object *ob, DerivedMesh *dm)
 {
-	CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm;
+	CCGDerivedMesh *ccgdm = (CCGDerivedMesh *)dm;
 	int gridSize, numGrids, grid_pbvh;
 
-	if(!ob) {
-		ccgdm->pbvh= NULL;
+	if (!ob) {
+		ccgdm->pbvh = NULL;
 		return NULL;
 	}
 
-	if(!ob->sculpt)
+	if (!ob->sculpt)
 		return NULL;
 
-	grid_pbvh= ccgDM_use_grid_pbvh(ccgdm);
+	grid_pbvh = ccgDM_use_grid_pbvh(ccgdm);
 
-	if(ob->sculpt->pbvh) {
-		if(grid_pbvh) {
+	if (ob->sculpt->pbvh) {
+		if (grid_pbvh) {
 			/* pbvh's grids, gridadj and gridfaces points to data inside ccgdm
-			   but this can be freed on ccgdm release, this updates the pointers
-			   when the ccgdm gets remade, the assumption is that the topology
-			   does not change. */
+			 * but this can be freed on ccgdm release, this updates the pointers
+			 * 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->pbvh = ob->sculpt->pbvh;
 	}
 
-	if(ccgdm->pbvh)
+	if (ccgdm->pbvh)
 		return ccgdm->pbvh;
 
 	/* no pbvh exists yet, we need to create one. only in case of multires
-	   we build a pbvh over the modified mesh, in other cases the base mesh
-	   is being sculpted, so we build a pbvh from that. */
-	if(grid_pbvh) {
+	 * we build a pbvh over the modified mesh, in other cases the base mesh
+	 * is being sculpted, so we build a pbvh from that. */
+	if (grid_pbvh) {
 		ccgdm_create_grids(dm);
 
 		gridSize = ccgDM_getGridSize(dm);
 		numGrids = ccgDM_getNumGrids(dm);
 
-		ob->sculpt->pbvh= ccgdm->pbvh = BLI_pbvh_new();
+		ob->sculpt->pbvh = ccgdm->pbvh = BLI_pbvh_new();
 		BLI_pbvh_build_grids(ccgdm->pbvh, ccgdm->gridData, ccgdm->gridAdjacency,
-			numGrids, gridSize, (void**)ccgdm->gridFaces);
-	} else if(ob->type == OB_MESH) {
-		Mesh *me= ob->data;
-		ob->sculpt->pbvh= ccgdm->pbvh = BLI_pbvh_new();
+		                     numGrids, gridSize, (void **)ccgdm->gridFaces, ccgdm->gridFlagMats, ccgdm->gridHidden);
+	}
+	else if (ob->type == OB_MESH) {
+		Mesh *me = ob->data;
+		ob->sculpt->pbvh = ccgdm->pbvh = BLI_pbvh_new();
+		BLI_assert(!(me->mface == NULL && me->mpoly != NULL)); /* BMESH ONLY complain if mpoly is valid but not mface */
 		BLI_pbvh_build_mesh(ccgdm->pbvh, me->mface, me->mvert,
-				   me->totface, me->totvert);
+		                    me->totface, me->totvert);
 	}
 
 	return ccgdm->pbvh;
 }
 
+static void ccgDM_recalcTessellation(DerivedMesh *UNUSED(dm))
+{
+	/* Nothing to do: CCG handles creating its own tessfaces */
+}
+
+static void ccgDM_calcNormals(DerivedMesh *UNUSED(dm))
+{
+	/* Nothing to do: CCG calculates normals during drawing */
+}
+
 static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
-										 int drawInteriorEdges,
-										 int useSubsurfUv,
-										 DerivedMesh *dm)
+                                         int drawInteriorEdges,
+                                         int useSubsurfUv,
+                                         DerivedMesh *dm)
 {
 	CCGDerivedMesh *ccgdm = MEM_callocN(sizeof(*ccgdm), "ccgdm");
 	CCGVertIterator *vi;
@@ -2489,51 +2926,105 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
 	int index, totvert, totedge, totface;
 	int i;
 	int vertNum, edgeNum, faceNum;
+	int *vertOrigIndex, *faceOrigIndex, *polyOrigIndex, *base_polyOrigIndex; /* *edgeOrigIndex - as yet, unused  */
 	short *edgeFlags;
-	char *faceFlags;
-	int edgeSize;
+	DMFlagMat *faceFlags;
+	int *loopidx = NULL, *vertidx = NULL, *polyidx = NULL;
+	BLI_array_declare(loopidx);
+	BLI_array_declare(vertidx);
+	int loopindex, loopindex2;
+	int edgeSize, has_edge_origindex;
 	int gridSize;
-	int gridFaces;
+	int gridFaces, gridCuts;
 	/*int gridSideVerts;*/
 	int gridSideEdges;
+	int numTex, numCol;
+	int hasPCol, hasOrigSpace;
 	int gridInternalEdges;
+	float *w = NULL;
+	WeightTable wtable = {0};
+	/* MCol *mcol; */ /* UNUSED */
 	MEdge *medge = NULL;
-	MFace *mface = NULL;
-	int *orig_indices;
-	FaceVertWeight *qweight, *tweight;
+	/* MFace *mface = NULL; */
+	MPoly *mpoly = NULL;
 
 	DM_from_template(&ccgdm->dm, dm, DM_TYPE_CCGDM,
-					 ccgSubSurf_getNumFinalVerts(ss),
-					 ccgSubSurf_getNumFinalEdges(ss),
-					 ccgSubSurf_getNumFinalFaces(ss));
+	                 ccgSubSurf_getNumFinalVerts(ss),
+	                 ccgSubSurf_getNumFinalEdges(ss),
+	                 ccgSubSurf_getNumFinalFaces(ss),
+	                 ccgSubSurf_getNumFinalFaces(ss) * 4,
+	                 ccgSubSurf_getNumFinalFaces(ss));
+
+	CustomData_free_layer_active(&ccgdm->dm.polyData, CD_NORMAL,
+	                             ccgdm->dm.numPolyData);
+	
+	numTex = CustomData_number_of_layers(&ccgdm->dm.loopData, CD_MLOOPUV);
+	numCol = CustomData_number_of_layers(&ccgdm->dm.loopData, CD_MLOOPCOL);
+	hasPCol = CustomData_has_layer(&ccgdm->dm.loopData, CD_PREVIEW_MLOOPCOL);
+	hasOrigSpace = CustomData_has_layer(&ccgdm->dm.loopData, CD_ORIGSPACE_MLOOP);
+	
+	if (
+	    (numTex && CustomData_number_of_layers(&ccgdm->dm.faceData, CD_MTFACE) != numTex)  ||
+	    (numCol && CustomData_number_of_layers(&ccgdm->dm.faceData, CD_MCOL) != numCol)    ||
+	    (hasPCol && !CustomData_has_layer(&ccgdm->dm.faceData, CD_PREVIEW_MCOL))            ||
+	    (hasOrigSpace && !CustomData_has_layer(&ccgdm->dm.faceData, CD_ORIGSPACE)) )
+	{
+		CustomData_from_bmeshpoly(&ccgdm->dm.faceData,
+		                          &ccgdm->dm.polyData,
+		                          &ccgdm->dm.loopData,
+		                          ccgSubSurf_getNumFinalFaces(ss));
+	}
+
+	/* We absolutely need that layer, else it's no valid tessellated data! */
+	polyidx = CustomData_add_layer(&ccgdm->dm.faceData, CD_POLYINDEX, CD_CALLOC,
+	                               NULL, ccgSubSurf_getNumFinalFaces(ss));
 
 	ccgdm->dm.getMinMax = ccgDM_getMinMax;
 	ccgdm->dm.getNumVerts = ccgDM_getNumVerts;
-	ccgdm->dm.getNumFaces = ccgDM_getNumFaces;
-
 	ccgdm->dm.getNumEdges = ccgDM_getNumEdges;
+	ccgdm->dm.getNumTessFaces = ccgDM_getNumTessFaces;
+	ccgdm->dm.getNumLoops = ccgDM_getNumLoops;
+	/* reuse of ccgDM_getNumTessFaces is intentional here: subsurf polys are just created from tessfaces */
+	ccgdm->dm.getNumPolys = ccgDM_getNumTessFaces;
+
+	ccgdm->dm.getNumGrids = ccgDM_getNumGrids;
+	ccgdm->dm.getPBVH = ccgDM_getPBVH;
+
 	ccgdm->dm.getVert = ccgDM_getFinalVert;
 	ccgdm->dm.getEdge = ccgDM_getFinalEdge;
-	ccgdm->dm.getFace = ccgDM_getFinalFace;
+	ccgdm->dm.getTessFace = ccgDM_getFinalFace;
 	ccgdm->dm.getVertCo = ccgDM_getFinalVertCo;
 	ccgdm->dm.getVertNo = ccgDM_getFinalVertNo;
 	ccgdm->dm.copyVertArray = ccgDM_copyFinalVertArray;
 	ccgdm->dm.copyEdgeArray = ccgDM_copyFinalEdgeArray;
-	ccgdm->dm.copyFaceArray = ccgDM_copyFinalFaceArray;
-	ccgdm->dm.getVertData = DM_get_vert_data;
-	ccgdm->dm.getEdgeData = DM_get_edge_data;
-	ccgdm->dm.getFaceData = DM_get_face_data;
+	ccgdm->dm.copyTessFaceArray = ccgDM_copyFinalFaceArray;
+	ccgdm->dm.copyLoopArray = ccgDM_copyFinalLoopArray;
+	ccgdm->dm.copyPolyArray = ccgDM_copyFinalPolyArray;
+
+	ccgdm->dm.getVertData = ccgDM_get_vert_data;
+	ccgdm->dm.getEdgeData = ccgDM_get_edge_data;
+	ccgdm->dm.getTessFaceData = ccgDM_get_tessface_data;
 	ccgdm->dm.getVertDataArray = ccgDM_get_vert_data_layer;
 	ccgdm->dm.getEdgeDataArray = ccgDM_get_edge_data_layer;
-	ccgdm->dm.getFaceDataArray = ccgDM_get_face_data_layer;
+	ccgdm->dm.getTessFaceDataArray = ccgDM_get_tessface_data_layer;
 	ccgdm->dm.getNumGrids = ccgDM_getNumGrids;
 	ccgdm->dm.getGridSize = ccgDM_getGridSize;
 	ccgdm->dm.getGridData = ccgDM_getGridData;
 	ccgdm->dm.getGridAdjacency = ccgDM_getGridAdjacency;
 	ccgdm->dm.getGridOffset = ccgDM_getGridOffset;
-	ccgdm->dm.getFaceMap = ccgDM_getFaceMap;
+	ccgdm->dm.getGridFlagMats = ccgDM_getGridFlagMats;
+	ccgdm->dm.getGridHidden = ccgDM_getGridHidden;
+	ccgdm->dm.getPolyMap = ccgDM_getPolyMap;
 	ccgdm->dm.getPBVH = ccgDM_getPBVH;
 
+	ccgdm->dm.getTessFace = ccgDM_getFinalFace;
+	ccgdm->dm.copyVertArray = ccgDM_copyFinalVertArray;
+	ccgdm->dm.copyEdgeArray = ccgDM_copyFinalEdgeArray;
+	ccgdm->dm.copyTessFaceArray = ccgDM_copyFinalFaceArray;
+
+	ccgdm->dm.calcNormals = ccgDM_calcNormals;
+	ccgdm->dm.recalcTessellation = ccgDM_recalcTessellation;
+
 	ccgdm->dm.getVertCos = ccgdm_getVertCos;
 	ccgdm->dm.foreachMappedVert = ccgDM_foreachMappedVert;
 	ccgdm->dm.foreachMappedEdge = ccgDM_foreachMappedEdge;
@@ -2543,7 +3034,6 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
 	ccgdm->dm.drawEdges = ccgDM_drawEdges;
 	ccgdm->dm.drawLooseEdges = ccgDM_drawLooseEdges;
 	ccgdm->dm.drawFacesSolid = ccgDM_drawFacesSolid;
-	ccgdm->dm.drawFacesColored = ccgDM_drawFacesColored;
 	ccgdm->dm.drawFacesTex = ccgDM_drawFacesTex;
 	ccgdm->dm.drawFacesGLSL = ccgDM_drawFacesGLSL;
 	ccgdm->dm.drawMappedFaces = ccgDM_drawMappedFaces;
@@ -2564,7 +3054,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
 	totvert = ccgSubSurf_getNumVerts(ss);
 	ccgdm->vertMap = MEM_mallocN(totvert * sizeof(*ccgdm->vertMap), "vertMap");
 	vi = ccgSubSurf_getVertIterator(ss);
-	for(; !ccgVertIterator_isStopped(vi); ccgVertIterator_next(vi)) {
+	for (; !ccgVertIterator_isStopped(vi); ccgVertIterator_next(vi)) {
 		CCGVert *v = ccgVertIterator_getCurrent(vi);
 
 		ccgdm->vertMap[GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v))].vert = v;
@@ -2574,7 +3064,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
 	totedge = ccgSubSurf_getNumEdges(ss);
 	ccgdm->edgeMap = MEM_mallocN(totedge * sizeof(*ccgdm->edgeMap), "edgeMap");
 	ei = ccgSubSurf_getEdgeIterator(ss);
-	for(; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) {
+	for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) {
 		CCGEdge *e = ccgEdgeIterator_getCurrent(ei);
 
 		ccgdm->edgeMap[GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e))].edge = e;
@@ -2583,146 +3073,204 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
 	totface = ccgSubSurf_getNumFaces(ss);
 	ccgdm->faceMap = MEM_mallocN(totface * sizeof(*ccgdm->faceMap), "faceMap");
 	fi = ccgSubSurf_getFaceIterator(ss);
-	for(; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
+	for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
 		CCGFace *f = ccgFaceIterator_getCurrent(fi);
 
-		ccgdm->faceMap[GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f))].face = f;
+		ccgdm->faceMap[GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f))].face = f;
 	}
 	ccgFaceIterator_free(fi);
 
+	ccgdm->reverseFaceMap = MEM_callocN(sizeof(int) * ccgSubSurf_getNumFinalFaces(ss), "reverseFaceMap");
+
 	edgeSize = ccgSubSurf_getEdgeSize(ss);
 	gridSize = ccgSubSurf_getGridSize(ss);
 	gridFaces = gridSize - 1;
-	/*gridSideVerts = gridSize - 2;*/ /*UNUSED*/
-	/*gridInternalVerts = gridSideVerts * gridSideVerts; */ /*UNUSED*/
+	gridCuts = gridSize - 2;
+	/*gridInternalVerts = gridSideVerts * gridSideVerts; - as yet, unused */
 	gridSideEdges = gridSize - 1;
 	gridInternalEdges = (gridSideEdges - 1) * gridSideEdges * 2; 
 
-	calc_ss_weights(gridFaces, &qweight, &tweight);
-
 	vertNum = 0;
 	edgeNum = 0;
 	faceNum = 0;
 
-	/* mvert = dm->getVertArray(dm); - as yet unused */
+	/* mvert = dm->getVertArray(dm); */ /* UNUSED */
 	medge = dm->getEdgeArray(dm);
-	mface = dm->getFaceArray(dm);
+	/* mface = dm->getTessFaceArray(dm); */ /* UNUSED */
+
+	mpoly = CustomData_get_layer(&dm->polyData, CD_MPOLY);
+	base_polyOrigIndex = CustomData_get_layer(&dm->polyData, CD_ORIGINDEX);
+	
+	/*CDDM hack*/
+	edgeFlags = ccgdm->edgeFlags = MEM_callocN(sizeof(short) * totedge, "edgeFlags");
+	faceFlags = ccgdm->faceFlags = MEM_callocN(sizeof(DMFlagMat) * totface, "faceFlags");
+
+	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);
+
+	polyOrigIndex = DM_get_poly_data_layer(&ccgdm->dm, CD_ORIGINDEX);
+
+#if 0
+	/* this is not in trunk, can gives problems because colors initialize
+	 * as black, just don't do it!, it works fine - campbell */
+	if (!CustomData_has_layer(&ccgdm->dm.faceData, CD_MCOL))
+		DM_add_tessface_layer(&ccgdm->dm, CD_MCOL, CD_CALLOC, NULL);
+	mcol = DM_get_tessface_data_layer(&ccgdm->dm, CD_MCOL);
+#endif
+
+	has_edge_origindex = CustomData_has_layer(&ccgdm->dm.edgeData, CD_ORIGINDEX);
 
-	faceFlags = ccgdm->faceFlags = MEM_callocN(sizeof(char)*2*totface, "faceFlags");
 
-	orig_indices = (int*)ccgdm->dm.getFaceDataArray(&ccgdm->dm, CD_ORIGINDEX);
-	for(index = 0; index < totface; ++index) {
+	loopindex = loopindex2 = 0; //current loop index
+	for (index = 0; index < totface; index++) {
 		CCGFace *f = ccgdm->faceMap[index].face;
 		int numVerts = ccgSubSurf_getFaceNumVerts(f);
 		int numFinalEdges = numVerts * (gridSideEdges + gridInternalEdges);
-		int origIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f));
-		FaceVertWeight *weight = (numVerts == 4) ? qweight : tweight;
-		int S, x, y;
-		int vertIdx[4];
+		int origIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(f));
+		int g2_wid = gridCuts + 2;
+		float *w2;
+		int s, x, y;
+		
+		origIndex = base_polyOrigIndex ? base_polyOrigIndex[origIndex] : origIndex;
+		
+		w = get_ss_weights(&wtable, gridCuts, numVerts);
 
 		ccgdm->faceMap[index].startVert = vertNum;
 		ccgdm->faceMap[index].startEdge = edgeNum;
 		ccgdm->faceMap[index].startFace = faceNum;
-
-		if(orig_indices)
-			orig_indices[faceNum] = origIndex;
+		
+		faceFlags->flag = mpoly ?  mpoly[origIndex].flag : 0;
+		faceFlags->mat_nr = mpoly ? mpoly[origIndex].mat_nr : 0;
+		faceFlags++;
 
 		/* set the face base vert */
-		*((int*)ccgSubSurf_getFaceUserData(ss, f)) = vertNum;
+		*((int *)ccgSubSurf_getFaceUserData(ss, f)) = vertNum;
 
-		for(S = 0; S < numVerts; S++) {
-			CCGVert *v = ccgSubSurf_getFaceVert(ss, f, S);
+		BLI_array_empty(loopidx);
+		BLI_array_growitems(loopidx, numVerts);
+		for (s = 0; s < numVerts; s++) {
+			loopidx[s] = loopindex++;
+		}
+		
+		BLI_array_empty(vertidx);
+		BLI_array_growitems(vertidx, numVerts);
+		for (s = 0; s < numVerts; s++) {
+			CCGVert *v = ccgSubSurf_getFaceVert(f, s);
+			vertidx[s] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
+		}
+		
 
-			vertIdx[S] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
+		/*I think this is for interpolating the center vert?*/
+		w2 = w; // + numVerts*(g2_wid-1)*(g2_wid-1); //numVerts*((g2_wid-1)*g2_wid+g2_wid-1);
+		DM_interp_vert_data(dm, &ccgdm->dm, vertidx, w2,
+		                    numVerts, vertNum);
+		if (vertOrigIndex) {
+			*vertOrigIndex = ORIGINDEX_NONE;
+			++vertOrigIndex;
 		}
 
-		DM_interp_vert_data(dm, &ccgdm->dm, vertIdx, weight[0][0],
-							numVerts, vertNum);
 		++vertNum;
 
-		for(S = 0; S < numVerts; S++) {
-			int prevS = (S - 1 + numVerts) % numVerts;
-			int nextS = (S + 1) % numVerts;
-			int otherS = (numVerts == 4) ? (S + 2) % numVerts : 3;
-			for(x = 1; x < gridFaces; x++) {
-				float w[4];
-				w[prevS]  = weight[x][0][0];
-				w[S]      = weight[x][0][1];
-				w[nextS]  = weight[x][0][2];
-				w[otherS] = weight[x][0][3];
-				DM_interp_vert_data(dm, &ccgdm->dm, vertIdx, w,
-									numVerts, vertNum);
+		/*interpolate per-vert data*/
+		for (s = 0; s < numVerts; s++) {
+			for (x = 1; x < gridFaces; x++) {
+				w2 = w + s * numVerts * g2_wid * g2_wid + x * numVerts;
+				DM_interp_vert_data(dm, &ccgdm->dm, vertidx, w2,
+				                    numVerts, vertNum);
+
+				if (vertOrigIndex) {
+					*vertOrigIndex = ORIGINDEX_NONE;
+					++vertOrigIndex;
+				}
+
 				++vertNum;
 			}
 		}
 
-		for(S = 0; S < numVerts; S++) {
-			int prevS = (S - 1 + numVerts) % numVerts;
-			int nextS = (S + 1) % numVerts;
-			int otherS = (numVerts == 4) ? (S + 2) % numVerts : 3;
-			for(y = 1; y < gridFaces; y++) {
-				for(x = 1; x < gridFaces; x++) {
-					float w[4];
-					w[prevS]  = weight[y * gridFaces + x][0][0];
-					w[S]      = weight[y * gridFaces + x][0][1];
-					w[nextS]  = weight[y * gridFaces + x][0][2];
-					w[otherS] = weight[y * gridFaces + x][0][3];
-					DM_interp_vert_data(dm, &ccgdm->dm, vertIdx, w,
-										numVerts, vertNum);
+		/*interpolate per-vert data*/
+		for (s = 0; s < numVerts; s++) {
+			for (y = 1; y < gridFaces; y++) {
+				for (x = 1; x < gridFaces; x++) {
+					w2 = w + s * numVerts * g2_wid * g2_wid + (y * g2_wid + x) * numVerts;
+					DM_interp_vert_data(dm, &ccgdm->dm, vertidx, w2,
+					                    numVerts, vertNum);
+
+					if (vertOrigIndex) {
+						*vertOrigIndex = ORIGINDEX_NONE;
+						++vertOrigIndex;
+					}
+
 					++vertNum;
 				}
 			}
 		}
 
-		for(S = 0; S < numVerts; S++) {
-			int prevS = (S - 1 + numVerts) % numVerts;
-			int nextS = (S + 1) % numVerts;
-			int otherS = (numVerts == 4) ? (S + 2) % numVerts : 3;
-
-			weight = (numVerts == 4) ? qweight : tweight;
-
-			for(y = 0; y < gridFaces; y++) {
-				for(x = 0; x < gridFaces; x++) {
-					FaceVertWeight w;
-					int j;
-
-					for(j = 0; j < 4; ++j) {
-						w[j][prevS]  = (*weight)[j][0];
-						w[j][S]      = (*weight)[j][1];
-						w[j][nextS]  = (*weight)[j][2];
-						w[j][otherS] = (*weight)[j][3];
+		if (has_edge_origindex) {
+			for (i = 0; i < numFinalEdges; ++i)
+				*(int *)DM_get_edge_data(&ccgdm->dm, edgeNum + i,
+				                         CD_ORIGINDEX) = ORIGINDEX_NONE;
+		}
+
+		for (s = 0; s < numVerts; s++) {
+			/*interpolate per-face data*/
+			for (y = 0; y < gridFaces; y++) {
+				for (x = 0; x < gridFaces; x++) {
+					w2 = w + s * numVerts * g2_wid * g2_wid + (y * g2_wid + x) * numVerts;
+					CustomData_interp(&dm->loopData, &ccgdm->dm.loopData,
+					                  loopidx, w2, NULL, numVerts, loopindex2);
+					loopindex2++;
+
+					w2 = w + s * numVerts * g2_wid * g2_wid + ((y + 1) * g2_wid + (x)) * numVerts;
+					CustomData_interp(&dm->loopData, &ccgdm->dm.loopData,
+					                  loopidx, w2, NULL, numVerts, loopindex2);
+					loopindex2++;
+
+					w2 = w + s * numVerts * g2_wid * g2_wid + ((y + 1) * g2_wid + (x + 1)) * numVerts;
+					CustomData_interp(&dm->loopData, &ccgdm->dm.loopData,
+					                  loopidx, w2, NULL, numVerts, loopindex2);
+					loopindex2++;
+					
+					w2 = w + s * numVerts * g2_wid * g2_wid + ((y) * g2_wid + (x + 1)) * numVerts;
+					CustomData_interp(&dm->loopData, &ccgdm->dm.loopData,
+					                  loopidx, w2, NULL, numVerts, loopindex2);
+					loopindex2++;
+
+					/*copy over poly data, e.g. mtexpoly*/
+					CustomData_copy_data(&dm->polyData, &ccgdm->dm.polyData, origIndex, faceNum, 1);
+
+					/*generate tessellated face data used for drawing*/
+					ccg_loops_to_corners(&ccgdm->dm.faceData, &ccgdm->dm.loopData,
+					                     &ccgdm->dm.polyData, loopindex2 - 4, faceNum, faceNum,
+					                     numTex, numCol, hasPCol, hasOrigSpace);
+					
+					/*set original index data*/
+					if (faceOrigIndex) {
+						*faceOrigIndex = origIndex;
+						faceOrigIndex++;
 					}
+					if (polyOrigIndex) {
+						*polyOrigIndex = origIndex;
+						polyOrigIndex++;
+					}
+
+					ccgdm->reverseFaceMap[faceNum] = index;
 
-					DM_interp_face_data(dm, &ccgdm->dm, &origIndex, NULL,
-										&w, 1, faceNum);
-					weight++;
+					/* This is a simple one to one mapping, here... */
+					polyidx[faceNum] = faceNum;
 
-					++faceNum;
+					faceNum++;
 				}
 			}
 		}
 
-		faceFlags[index*2] = mface[origIndex].flag;
-		faceFlags[index*2 + 1] = mface[origIndex].mat_nr;
-
 		edgeNum += numFinalEdges;
 	}
 
-	if(useSubsurfUv) {
-		CustomData *fdata = &ccgdm->dm.faceData;
-		CustomData *dmfdata = &dm->faceData;
-		int numlayer = CustomData_number_of_layers(fdata, CD_MTFACE);
-		int dmnumlayer = CustomData_number_of_layers(dmfdata, CD_MTFACE);
-
-		for (i=0; i<numlayer && i<dmnumlayer; i++)
-			set_subsurf_uv(ss, dm, &ccgdm->dm, i);
-	}
-
-	edgeFlags = ccgdm->edgeFlags = MEM_callocN(sizeof(short)*totedge, "edgeFlags");
-
-	for(index = 0; index < totedge; ++index) {
+	for (index = 0; index < totedge; ++index) {
 		CCGEdge *e = ccgdm->edgeMap[index].edge;
 		int numFinalEdges = edgeSize - 1;
+		int mapIndex = ccgDM_getEdgeMapIndex(ss, e);
 		int x;
 		int vertIdx[2];
 		int edgeIdx = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e));
@@ -2736,24 +3284,46 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
 		ccgdm->edgeMap[index].startVert = vertNum;
 		ccgdm->edgeMap[index].startEdge = edgeNum;
 
+		if (edgeIdx >= 0 && edgeFlags)
+			edgeFlags[edgeIdx] = medge[edgeIdx].flag;
+
 		/* set the edge base vert */
-		*((int*)ccgSubSurf_getEdgeUserData(ss, e)) = vertNum;
+		*((int *)ccgSubSurf_getEdgeUserData(ss, e)) = vertNum;
 
-		for(x = 1; x < edgeSize - 1; x++) {
+		for (x = 1; x < edgeSize - 1; x++) {
 			float w[2];
 			w[1] = (float) x / (edgeSize - 1);
 			w[0] = 1 - w[1];
 			DM_interp_vert_data(dm, &ccgdm->dm, vertIdx, w, 2, vertNum);
+			if (vertOrigIndex) {
+				*vertOrigIndex = ORIGINDEX_NONE;
+				++vertOrigIndex;
+			}
 			++vertNum;
 		}
 
-		edgeFlags[index]= medge[edgeIdx].flag;
+		for (i = 0; i < numFinalEdges; ++i) {
+			if (has_edge_origindex) {
+				*(int *)DM_get_edge_data(&ccgdm->dm, edgeNum + i, CD_ORIGINDEX) = mapIndex;
+			}
+		}
 
 		edgeNum += numFinalEdges;
 	}
 
-	for(index = 0; index < totvert; ++index) {
+	if (useSubsurfUv) {
+		CustomData *ldata = &ccgdm->dm.loopData;
+		CustomData *dmldata = &dm->loopData;
+		int numlayer = CustomData_number_of_layers(ldata, CD_MLOOPUV);
+		int dmnumlayer = CustomData_number_of_layers(dmldata, CD_MLOOPUV);
+
+		for (i = 0; i < numlayer && i < dmnumlayer; i++)
+			set_subsurf_uv(ss, dm, &ccgdm->dm, i);
+	}
+
+	for (index = 0; index < totvert; ++index) {
 		CCGVert *v = ccgdm->vertMap[index].vert;
+		int mapIndex = ccgDM_getVertMapIndex(ccgdm->ss, v);
 		int vertIdx;
 
 		vertIdx = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v));
@@ -2761,15 +3331,29 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
 		ccgdm->vertMap[index].startVert = vertNum;
 
 		/* set the vert base vert */
-		*((int*) ccgSubSurf_getVertUserData(ss, v)) = vertNum;
+		*((int *) ccgSubSurf_getVertUserData(ss, v)) = vertNum;
 
 		DM_copy_vert_data(dm, &ccgdm->dm, vertIdx, vertNum, 1);
 
+		if (vertOrigIndex) {
+			*vertOrigIndex = mapIndex;
+			++vertOrigIndex;
+		}
 		++vertNum;
 	}
 
-	MEM_freeN(qweight);
-	MEM_freeN(tweight);
+	ccgdm->dm.numVertData = vertNum;
+	ccgdm->dm.numEdgeData = edgeNum;
+	ccgdm->dm.numTessFaceData = faceNum;
+	ccgdm->dm.numLoopData = loopindex2;
+	ccgdm->dm.numPolyData = faceNum;
+
+	/* All tessellated CD layers were updated! */
+	ccgdm->dm.dirty &= ~DM_DIRTY_TESS_CDLAYERS;
+
+	BLI_array_free(vertidx);
+	BLI_array_free(loopidx);
+	free_ss_weights(&wtable);
 
 	return ccgdm;
 }
@@ -2777,10 +3361,10 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss,
 /***/
 
 struct DerivedMesh *subsurf_make_derived_from_derived(
-						struct DerivedMesh *dm,
-						struct SubsurfModifierData *smd,
-						int useRenderParams, float (*vertCos)[3],
-						int isFinalCalc, int forEditMode, int inEditMode)
+        struct DerivedMesh *dm,
+        struct SubsurfModifierData *smd,
+        int useRenderParams, float (*vertCos)[3],
+        int isFinalCalc, int forEditMode, int inEditMode)
 {
 	int useSimple = smd->subdivType == ME_SIMPLE_SUBSURF;
 	CCGFlags useAging = smd->flags & eSubsurfModifierFlag_DebugIncr ? CCG_USE_AGING : 0;
@@ -2788,38 +3372,40 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
 	int drawInteriorEdges = !(smd->flags & eSubsurfModifierFlag_ControlEdges);
 	CCGDerivedMesh *result;
 
-	if(forEditMode) {
-		int levels= (smd->modifier.scene)? get_render_subsurf_level(&smd->modifier.scene->r, smd->levels): smd->levels;
+	if (forEditMode) {
+		int levels = (smd->modifier.scene) ? get_render_subsurf_level(&smd->modifier.scene->r, smd->levels) : smd->levels;
 
-		smd->emCache = _getSubSurf(smd->emCache, levels, useAging|CCG_CALC_NORMALS);
+		smd->emCache = _getSubSurf(smd->emCache, levels, useAging | CCG_CALC_NORMALS);
 		ss_sync_from_derivedmesh(smd->emCache, dm, vertCos, useSimple);
 
 		result = getCCGDerivedMesh(smd->emCache,
-								   drawInteriorEdges,
-								   useSubsurfUv, dm);
-	} else if(useRenderParams) {
+		                           drawInteriorEdges,
+		                           useSubsurfUv, dm);
+	}
+	else if (useRenderParams) {
 		/* Do not use cache in render mode. */
 		CCGSubSurf *ss;
-		int levels= (smd->modifier.scene)? get_render_subsurf_level(&smd->modifier.scene->r, smd->renderLevels): smd->renderLevels;
+		int levels = (smd->modifier.scene) ? get_render_subsurf_level(&smd->modifier.scene->r, smd->renderLevels) : smd->renderLevels;
 
-		if(levels == 0)
+		if (levels == 0)
 			return dm;
 		
-		ss = _getSubSurf(NULL, levels, CCG_USE_ARENA|CCG_CALC_NORMALS);
+		ss = _getSubSurf(NULL, levels, CCG_USE_ARENA | CCG_CALC_NORMALS);
 
 		ss_sync_from_derivedmesh(ss, dm, vertCos, useSimple);
 
 		result = getCCGDerivedMesh(ss,
-			drawInteriorEdges, useSubsurfUv, dm);
+		                           drawInteriorEdges, useSubsurfUv, dm);
 
 		result->freeSS = 1;
-	} else {
+	}
+	else {
 		int useIncremental = (smd->flags & eSubsurfModifierFlag_Incremental);
-		int levels= (smd->modifier.scene)? get_render_subsurf_level(&smd->modifier.scene->r, smd->levels): smd->levels;
+		int levels = (smd->modifier.scene) ? get_render_subsurf_level(&smd->modifier.scene->r, smd->levels) : smd->levels;
 		CCGSubSurf *ss;
 
 		/* It is quite possible there is a much better place to do this. It
-		 * depends a bit on how rigourously we expect this function to never
+		 * depends a bit on how rigorously we expect this function to never
 		 * be called in editmode. In semi-theory we could share a single
 		 * cache, but the handles used inside and outside editmode are not
 		 * the same so we would need some way of converting them. Its probably
@@ -2829,38 +3415,39 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
 		 * Addendum: we can't really ensure that this is never called in edit
 		 * mode, so now we have a parameter to verify it. - brecht
 		 */
-		if(!inEditMode && smd->emCache) {
+		if (!inEditMode && smd->emCache) {
 			ccgSubSurf_free(smd->emCache);
 			smd->emCache = NULL;
 		}
 
-		if(useIncremental && isFinalCalc) {
-			smd->mCache = ss = _getSubSurf(smd->mCache, levels, useAging|CCG_CALC_NORMALS);
+		if (useIncremental && isFinalCalc) {
+			smd->mCache = ss = _getSubSurf(smd->mCache, levels, useAging | CCG_CALC_NORMALS);
 
 			ss_sync_from_derivedmesh(ss, dm, vertCos, useSimple);
 
 			result = getCCGDerivedMesh(smd->mCache,
-									   drawInteriorEdges,
-									   useSubsurfUv, dm);
-		} else {
+			                           drawInteriorEdges,
+			                           useSubsurfUv, dm);
+		}
+		else {
 			if (smd->mCache && isFinalCalc) {
 				ccgSubSurf_free(smd->mCache);
 				smd->mCache = NULL;
 			}
 
-			ss = _getSubSurf(NULL, levels, CCG_USE_ARENA|CCG_CALC_NORMALS);
+			ss = _getSubSurf(NULL, levels, CCG_USE_ARENA | CCG_CALC_NORMALS);
 			ss_sync_from_derivedmesh(ss, dm, vertCos, useSimple);
 
 			result = getCCGDerivedMesh(ss, drawInteriorEdges, useSubsurfUv, dm);
 
-			if(isFinalCalc)
+			if (isFinalCalc)
 				smd->mCache = ss;
 			else
 				result->freeSS = 1;
 		}
 	}
 
-	return (DerivedMesh*)result;
+	return (DerivedMesh *)result;
 }
 
 void subsurf_calculate_limit_positions(Mesh *me, float (*positions_r)[3]) 
@@ -2886,27 +3473,27 @@ void subsurf_calculate_limit_positions(Mesh *me, float (*positions_r)[3])
 		float *co;
 		int i;
 
-		edge_sum[0]= edge_sum[1]= edge_sum[2]= 0.0;
-		face_sum[0]= face_sum[1]= face_sum[2]= 0.0;
+		edge_sum[0] = edge_sum[1] = edge_sum[2] = 0.0;
+		face_sum[0] = face_sum[1] = face_sum[2] = 0.0;
 
-		for (i=0; i<N; i++) {
+		for (i = 0; i < N; i++) {
 			CCGEdge *e = ccgSubSurf_getVertEdge(v, i);
 			add_v3_v3v3(edge_sum, edge_sum, ccgSubSurf_getEdgeData(ss, e, 1));
 		}
-		for (i=0; i<numFaces; i++) {
+		for (i = 0; i < numFaces; i++) {
 			CCGFace *f = ccgSubSurf_getVertFace(v, i);
 			add_v3_v3(face_sum, ccgSubSurf_getFaceCenterData(f));
 		}
 
 		/* ad-hoc correction for boundary vertices, to at least avoid them
-		   moving completely out of place (brecht) */
-		if(numFaces && numFaces != N)
-			mul_v3_fl(face_sum, (float)N/(float)numFaces);
+		 * moving completely out of place (brecht) */
+		if (numFaces && numFaces != N)
+			mul_v3_fl(face_sum, (float)N / (float)numFaces);
 
 		co = ccgSubSurf_getVertData(ss, v);
-		positions_r[idx][0] = (co[0]*N*N + edge_sum[0]*4 + face_sum[0])/(N*(N+5));
-		positions_r[idx][1] = (co[1]*N*N + edge_sum[1]*4 + face_sum[1])/(N*(N+5));
-		positions_r[idx][2] = (co[2]*N*N + edge_sum[2]*4 + face_sum[2])/(N*(N+5));
+		positions_r[idx][0] = (co[0] * N * N + edge_sum[0] * 4 + face_sum[0]) / (N * (N + 5));
+		positions_r[idx][1] = (co[1] * N * N + edge_sum[1] * 4 + face_sum[1]) / (N * (N + 5));
+		positions_r[idx][2] = (co[2] * N * N + edge_sum[2] * 4 + face_sum[2]) / (N * (N + 5));
 	}
 	ccgVertIterator_free(vi);
 
@@ -2914,4 +3501,3 @@ void subsurf_calculate_limit_positions(Mesh *me, float (*positions_r)[3])
 
 	dm->release(dm);
 }
-
diff --git a/source/blender/blenkernel/intern/suggestions.c b/source/blender/blenkernel/intern/suggestions.c
index e1e872c..8b31380 100644
--- a/source/blender/blenkernel/intern/suggestions.c
+++ b/source/blender/blenkernel/intern/suggestions.c
@@ -132,7 +132,8 @@ void texttool_suggest_add(const char *name, char type)
 	/* Perform simple linear search for ordered storage */
 	if (!suggestions.first || !suggestions.last) {
 		suggestions.first = suggestions.last = newitem;
-	} else {
+	}
+	else {
 		cmp = -1;
 		for (item=suggestions.last; item; item=item->prev) {
 			cmp = txttl_cmp(name, item->name, len);
@@ -182,7 +183,8 @@ void texttool_suggest_prefix(const char *prefix)
 				first = match;
 				suggestions.top = top;
 			}
-		} else if (cmp<0) {
+		}
+		else if (cmp<0) {
 			if (!last) {
 				last = match->prev;
 				break;
@@ -195,7 +197,8 @@ void texttool_suggest_prefix(const char *prefix)
 		suggestions.firstmatch = first;
 		suggestions.lastmatch = last;
 		suggestions.selected = first;
-	} else {
+	}
+	else {
 		suggestions.firstmatch = NULL;
 		suggestions.lastmatch = NULL;
 		suggestions.selected = NULL;
@@ -255,7 +258,8 @@ void texttool_docs_show(const char *docs)
 		documentation = MEM_mallocN(len+2, "Documentation");
 		strncpy(documentation, docs, len);
 		documentation[len++] = '\n';
-	} else {
+	}
+	else {
 		documentation = MEM_mallocN(len+1, "Documentation");
 		strncpy(documentation, docs, len);
 	}
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index ba48db5..1197ec2 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -29,7 +29,7 @@
  *  \ingroup bke
  */
 
-
+#include <stdlib.h> /* abort */
 #include <string.h> /* strstr */
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -38,8 +38,13 @@
 
 #include "MEM_guardedalloc.h"
 
-#include "BLI_blenlib.h"
+#include "BLI_path_util.h"
+#include "BLI_string.h"
+#include "BLI_string_cursor_utf8.h"
+#include "BLI_string_utf8.h"
+#include "BLI_listbase.h"
 #include "BLI_utildefines.h"
+#include "BLI_fileops.h"
 
 #include "DNA_constraint_types.h"
 #include "DNA_controller_types.h"
@@ -61,68 +66,67 @@
 #include "BPY_extern.h"
 #endif
 
-/***************/ /*
-
-How Texts should work
---
-A text should relate to a file as follows -
-(Text *)->name should be the place where the 
-	file will or has been saved.
-	
-(Text *)->flags has the following bits
-	TXT_ISDIRTY - should always be set if the file in mem. differs from
-					the file on disk, or if there is no file on disk.
-	TXT_ISMEM - should always be set if the Text has not been mapped to
-					a file, in which case (Text *)->name may be NULL or garbage.			
-	TXT_ISEXT - should always be set if the Text is not to be written into
-					the .blend
-	TXT_ISSCRIPT - should be set if the user has designated the text
-					as a script. (NEW: this was unused, but now it is needed by
-					space handler script links (see header_view3d.c, for example)
-
-->>> see also: /makesdna/DNA_text_types.h
-
-Display
---
-The st->top determines at what line the top of the text is displayed.
-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 behaviour 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
-events in a queue, and a pointer
-to the current position in the
-queue...
-
-Events are stored using an
-arbitrary op-code system
-to keep track of
-a) the two cursors (normal and selected)
-b) input (visible and control (ie backspace))
-
-input data is stored as its
-ASCII value, the opcodes are
-then selected to not conflict.
-
-opcodes with data in between are
-written at the beginning and end
-of the data to allow undo and redo
-to simply check the code at the current
-undo position
-
-*/ /***************/
+/*
+ * How Texts should work
+ * --
+ * A text should relate to a file as follows -
+ * (Text *)->name should be the place where the
+ *     file will or has been saved.
+ *
+ * (Text *)->flags has the following bits
+ *     TXT_ISDIRTY - should always be set if the file in mem. differs from
+ *                     the file on disk, or if there is no file on disk.
+ *     TXT_ISMEM - should always be set if the Text has not been mapped to
+ *                     a file, in which case (Text *)->name may be NULL or garbage.
+ *     TXT_ISEXT - should always be set if the Text is not to be written into
+ *                     the .blend
+ *     TXT_ISSCRIPT - should be set if the user has designated the text
+ *                     as a script. (NEW: this was unused, but now it is needed by
+ *                     space handler script links (see header_view3d.c, for example)
+ *
+ * ->>> see also: /makesdna/DNA_text_types.h
+ *
+ * Display
+ * --
+ * The st->top determines at what line the top of the text is displayed.
+ * 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
+ * events in a queue, and a pointer
+ * to the current position in the
+ * queue...
+ *
+ * Events are stored using an
+ * arbitrary op-code system
+ * to keep track of
+ * a) the two cursors (normal and selected)
+ * b) input (visible and control (ie backspace))
+ *
+ * input data is stored as its
+ * ASCII value, the opcodes are
+ * then selected to not conflict.
+ *
+ * opcodes with data in between are
+ * written at the beginning and end
+ * of the data to allow undo and redo
+ * to simply check the code at the current
+ * undo position
+ *
+ */
 
 /***/
 
@@ -169,7 +173,7 @@ void free_text(Text *text)
 	BLI_freelistN(&text->lines);
 	BLI_freelistN(&text->markers);
 
-	if(text->name) MEM_freeN(text->name);
+	if (text->name) MEM_freeN(text->name);
 	MEM_freeN(text->undo_buf);
 #ifdef WITH_PYTHON
 	if (text->compiled) BPY_text_free_code(text);
@@ -191,7 +195,7 @@ Text *add_empty_text(const char *name)
 
 	ta->nlines=1;
 	ta->flags= TXT_ISDIRTY | TXT_ISMEM;
-	if((U.flag & USER_TXT_TABSTOSPACES_DISABLE)==0)
+	if ((U.flag & USER_TXT_TABSTOSPACES_DISABLE)==0)
 		ta->flags |= TXT_TABSTOSPACES;
 
 	ta->lines.first= ta->lines.last= NULL;
@@ -225,7 +229,7 @@ int txt_extended_ascii_as_utf8(char **str)
 	int length = strlen(*str);
 
 	while ((*str)[i]) {
-		if((bad_char= BLI_utf8_invalid_byte(*str+i, length-i)) == -1)
+		if ((bad_char= BLI_utf8_invalid_byte(*str+i, length-i)) == -1)
 			break;
 
 		added++;
@@ -238,7 +242,7 @@ int txt_extended_ascii_as_utf8(char **str)
 		i= 0;
 		
 		while ((*str)[i]) {
-			if((bad_char= BLI_utf8_invalid_byte((*str)+i, length-i)) == -1) {
+			if ((bad_char= BLI_utf8_invalid_byte((*str)+i, length-i)) == -1) {
 				memcpy(newstr+mi, (*str)+i, length - i + 1);
 				break;
 			}
@@ -288,8 +292,8 @@ int reopen_text(Text *text)
 	BLI_strncpy(str, text->name, FILE_MAX);
 	BLI_path_abs(str, G.main->name);
 	
-	fp= fopen(str, "r");
-	if(fp==NULL) return 0;
+	fp= BLI_fopen(str, "r");
+	if (fp==NULL) return 0;
 
 	/* free memory: */
 
@@ -325,13 +329,13 @@ int reopen_text(Text *text)
 	
 	text->nlines=0;
 	llen=0;
-	for(i=0; i<len; i++) {
+	for (i=0; i<len; i++) {
 		if (buffer[i]=='\n') {
 			tmp= (TextLine*) MEM_mallocN(sizeof(TextLine), "textline");
 			tmp->line= (char*) MEM_mallocN(llen+1, "textline_string");
 			tmp->format= NULL;
 			
-			if(llen) memcpy(tmp->line, &buffer[i-llen], llen);
+			if (llen) memcpy(tmp->line, &buffer[i-llen], llen);
 			tmp->line[llen]=0;
 			tmp->len= llen;
 				
@@ -351,7 +355,7 @@ int reopen_text(Text *text)
 		tmp->line= (char*) MEM_mallocN(llen+1, "textline_string");
 		tmp->format= NULL;
 		
-		if(llen) memcpy(tmp->line, &buffer[i-llen], llen);
+		if (llen) memcpy(tmp->line, &buffer[i-llen], llen);
 
 		tmp->line[llen]=0;
 		tmp->len= llen;
@@ -384,8 +388,8 @@ Text *add_text(const char *file, const char *relpath)
 	if (relpath) /* can be NULL (bg mode) */
 		BLI_path_abs(str, relpath);
 	
-	fp= fopen(str, "r");
-	if(fp==NULL) return NULL;
+	fp= BLI_fopen(str, "r");
+	if (fp==NULL) return NULL;
 	
 	ta= alloc_libblock(&bmain->text, ID_TXT, BLI_path_basename(str));
 	ta->id.us= 1;
@@ -394,7 +398,7 @@ Text *add_text(const char *file, const char *relpath)
 	ta->markers.first= ta->markers.last= NULL;
 	ta->curl= ta->sell= NULL;
 
-	if((U.flag & USER_TXT_TABSTOSPACES_DISABLE)==0)
+	if ((U.flag & USER_TXT_TABSTOSPACES_DISABLE)==0)
 		ta->flags= TXT_TABSTOSPACES;
 
 	fseek(fp, 0L, SEEK_END);
@@ -418,13 +422,13 @@ Text *add_text(const char *file, const char *relpath)
 	
 	ta->nlines=0;
 	llen=0;
-	for(i=0; i<len; i++) {
+	for (i=0; i<len; i++) {
 		if (buffer[i]=='\n') {
 			tmp= (TextLine*) MEM_mallocN(sizeof(TextLine), "textline");
 			tmp->line= (char*) MEM_mallocN(llen+1, "textline_string");
 			tmp->format= NULL;
 			
-			if(llen) memcpy(tmp->line, &buffer[i-llen], llen);
+			if (llen) memcpy(tmp->line, &buffer[i-llen], llen);
 			tmp->line[llen]=0;
 			tmp->len= llen;
 			
@@ -440,17 +444,17 @@ Text *add_text(const char *file, const char *relpath)
 	}
 
 	/* create new line in cases:
-	   - rest of line (if last line in file hasn't got \n terminator).
-	     in this case content of such line would be used to fill text line buffer
-	   - file is empty. in this case new line is needed to start editing from.
-	   - last characted in buffer is \n. in this case new line is needed to
-	     deal with newline at end of file. (see [#28087]) (sergey) */
+	 * - rest of line (if last line in file hasn't got \n terminator).
+	 *   in this case content of such line would be used to fill text line buffer
+	 * - file is empty. in this case new line is needed to start editing from.
+	 * - last characted in buffer is \n. in this case new line is needed to
+	 *   deal with newline at end of file. (see [#28087]) (sergey) */
 	if (llen!=0 || ta->nlines==0 || buffer[len-1]=='\n') {
 		tmp= (TextLine*) MEM_mallocN(sizeof(TextLine), "textline");
 		tmp->line= (char*) MEM_mallocN(llen+1, "textline_string");
 		tmp->format= NULL;
 		
-		if(llen) memcpy(tmp->line, &buffer[i-llen], llen);
+		if (llen) memcpy(tmp->line, &buffer[i-llen], llen);
 
 		tmp->line[llen]=0;
 		tmp->len= llen;
@@ -477,7 +481,7 @@ Text *copy_text(Text *ta)
 	tan= copy_libblock(&ta->id);
 	
 	/* file name can be NULL */
-	if(ta->name) {
+	if (ta->name) {
 		tan->name= MEM_mallocN(strlen(ta->name)+1, "text_name");
 		strcpy(tan->name, ta->name);
 	}
@@ -527,25 +531,25 @@ void unlink_text(Main *bmain, Text *text)
 	bConstraint *con;
 	short update;
 
-	for(ob=bmain->object.first; ob; ob=ob->id.next) {
+	for (ob=bmain->object.first; ob; ob=ob->id.next) {
 		/* game controllers */
-		for(cont=ob->controllers.first; cont; cont=cont->next) {
-			if(cont->type==CONT_PYTHON) {
+		for (cont=ob->controllers.first; cont; cont=cont->next) {
+			if (cont->type==CONT_PYTHON) {
 				bPythonCont *pc;
 				
 				pc= cont->data;
-				if(pc->text==text) pc->text= NULL;
+				if (pc->text==text) pc->text= NULL;
 			}
 		}
 
 		/* pyconstraints */
 		update = 0;
 
-		if(ob->type==OB_ARMATURE && ob->pose) {
+		if (ob->type==OB_ARMATURE && ob->pose) {
 			bPoseChannel *pchan;
-			for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
-				for(con = pchan->constraints.first; con; con=con->next) {
-					if(con->type==CONSTRAINT_TYPE_PYTHON) {
+			for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+				for (con = pchan->constraints.first; con; con=con->next) {
+					if (con->type==CONSTRAINT_TYPE_PYTHON) {
 						bPythonConstraint *data = con->data;
 						if (data->text==text) data->text = NULL;
 						update = 1;
@@ -555,15 +559,15 @@ void unlink_text(Main *bmain, Text *text)
 			}
 		}
 
-		for(con = ob->constraints.first; con; con=con->next) {
-			if(con->type==CONSTRAINT_TYPE_PYTHON) {
+		for (con = ob->constraints.first; con; con=con->next) {
+			if (con->type==CONSTRAINT_TYPE_PYTHON) {
 				bPythonConstraint *data = con->data;
 				if (data->text==text) data->text = NULL;
 				update = 1;
 			}
 		}
 		
-		if(update)
+		if (update)
 			DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 	}
 
@@ -571,13 +575,13 @@ void unlink_text(Main *bmain, Text *text)
 	// XXX nodeDynamicUnlinkText(&text->id);
 	
 	/* text space */
-	for(scr= bmain->screen.first; scr; scr= scr->id.next) {
-		for(area= scr->areabase.first; area; area= area->next) {
-			for(sl= area->spacedata.first; sl; sl= sl->next) {
-				if(sl->spacetype==SPACE_TEXT) {
+	for (scr= bmain->screen.first; scr; scr= scr->id.next) {
+		for (area= scr->areabase.first; area; area= area->next) {
+			for (sl= area->spacedata.first; sl; sl= sl->next) {
+				if (sl->spacetype==SPACE_TEXT) {
 					SpaceText *st= (SpaceText*) sl;
 					
-					if(st->text==text) {
+					if (st->text==text) {
 						st->text= NULL;
 						st->top= 0;
 					}
@@ -597,7 +601,7 @@ void clear_text(Text *text) /* called directly from rna */
 	txt_set_undostate( 1 );
 	txt_sel_all( text );
 	txt_delete_sel(text);
-	txt_set_undostate( oldstate );
+	txt_set_undostate(oldstate);
 
 	txt_make_dirty(text);
 }
@@ -606,10 +610,10 @@ void write_text(Text *text, const char *str) /* called directly from rna */
 {
 	int oldstate;
 
-	oldstate = txt_get_undostate(  );
-	txt_insert_buf( text, str );
-	txt_move_eof( text, 0 );
-	txt_set_undostate( oldstate );
+	oldstate = txt_get_undostate();
+	txt_insert_buf(text, str);
+	txt_move_eof(text, 0);
+	txt_set_undostate(oldstate);
 
 	txt_make_dirty(text);
 }
@@ -618,7 +622,7 @@ void write_text(Text *text, const char *str) /* called directly from rna */
 /* Editing utility functions */
 /*****************************/
 
-static void make_new_line (TextLine *line, char *newline) 
+static void make_new_line(TextLine *line, char *newline)
 {
 	if (line->line) MEM_freeN(line->line);
 	if (line->format) MEM_freeN(line->format);
@@ -632,7 +636,7 @@ static TextLine *txt_new_line(const char *str)
 {
 	TextLine *tmp;
 
-	if(!str) str= "";
+	if (!str) str= "";
 	
 	tmp= (TextLine *) MEM_mallocN(sizeof(TextLine), "textline");
 	tmp->line= MEM_mallocN(strlen(str)+1, "textline_string");
@@ -681,13 +685,13 @@ void txt_clean_text (Text *text)
 	while ((*top)->prev) *top= (*top)->prev;
 	while ((*bot)->next) *bot= (*bot)->next;
 
-	if(!text->curl) {
-		if(text->sell) text->curl= text->sell;
+	if (!text->curl) {
+		if (text->sell) text->curl= text->sell;
 		else text->curl= text->lines.first;
 		text->curc= 0;
 	}
 
-	if(!text->sell) {
+	if (!text->sell) {
 		text->sell= text->curl;
 		text->selc= 0;
 	}
@@ -712,12 +716,12 @@ int txt_get_span (TextLine *from, TextLine *to)
 	if (!tmp) {
 		tmp= from;
 		ret=0;
-		while(tmp) {
+		while (tmp) {
 			if (tmp == to) break;
 			ret--;
 			tmp= tmp->prev;
 		}
-		if(!tmp) ret=0;
+		if (!tmp) ret=0;
 	}
 
 	return ret;	
@@ -731,14 +735,6 @@ static void txt_make_dirty (Text *text)
 #endif
 }
 
-/* 0:whitespace, 1:punct, 2:alphanumeric */
-static short txt_char_type(unsigned int ch)
-{
-	if (iswspace(ch)) return 0;
-	if (iswalpha(ch) || iswdigit(ch)) return 2;
-	return 1;
-}
-
 /****************************/
 /* Cursor utility functions */
 /****************************/
@@ -759,10 +755,12 @@ static void txt_curs_first (Text *text, TextLine **linep, int *charp)
 		*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)) {
+	}
+	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 {
+	}
+	else {
 		*linep= text->sell;
 		*charp= text->selc;		
 	}
@@ -772,7 +770,7 @@ static void txt_curs_first (Text *text, TextLine **linep, int *charp)
 /* Cursor movement functions */
 /*****************************/
 
-int txt_utf8_offset_to_index(char *str, int offset)
+int txt_utf8_offset_to_index(const char *str, int offset)
 {
 	int index= 0, pos= 0;
 	while (pos != offset) {
@@ -782,7 +780,7 @@ int txt_utf8_offset_to_index(char *str, int offset)
 	return index;
 }
 
-int txt_utf8_index_to_offset(char *str, int index)
+int txt_utf8_index_to_offset(const char *str, int index)
 {
 	int offset= 0, pos= 0;
 	while (pos != index) {
@@ -812,24 +810,25 @@ void txt_move_up(Text *text, short sel)
 	/* int old; */ /* UNUSED */
 	
 	if (!text) return;
-	if(sel) txt_curs_sel(text, &linep, &charp);
+	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) {
+	if ((*linep)->prev) {
 		int index = txt_utf8_offset_to_index((*linep)->line, *charp);
 		*linep= (*linep)->prev;
 		if (index > txt_utf8_len((*linep)->line)) *charp= (*linep)->len;
 		else *charp= txt_utf8_index_to_offset((*linep)->line, index);
 		
-		if(!undoing)
+		if (!undoing)
 			txt_undo_add_op(text, sel?UNDO_SUP:UNDO_CUP);
-	} else {
+	}
+	else {
 		txt_move_bol(text, sel);
 	}
 
-	if(!sel) txt_pop_sel(text);
+	if (!sel) txt_pop_sel(text);
 }
 
 void txt_move_down(Text *text, short sel) 
@@ -839,24 +838,25 @@ void txt_move_down(Text *text, short sel)
 	/* int old; */ /* UNUSED */
 	
 	if (!text) return;
-	if(sel) txt_curs_sel(text, &linep, &charp);
+	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) {
+	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)
+		if (!undoing)
 			txt_undo_add_op(text, sel?UNDO_SDOWN:UNDO_CDOWN);
-	} else {
+	}
+	else {
 		txt_move_eol(text, sel);
 	}
 
-	if(!sel) txt_pop_sel(text);
+	if (!sel) txt_pop_sel(text);
 }
 
 void txt_move_left(Text *text, short sel) 
@@ -866,7 +866,7 @@ void txt_move_left(Text *text, short sel)
 	int tabsize= 0, i= 0;
 	
 	if (!text) return;
-	if(sel) txt_curs_sel(text, &linep, &charp);
+	if (sel) txt_curs_sel(text, &linep, &charp);
 	else { txt_pop_first(text); txt_curs_cur(text, &linep, &charp); }
 	if (!*linep) return;
 
@@ -904,9 +904,9 @@ void txt_move_left(Text *text, short sel)
 	}
 
 	undoing= oundoing;
-	if(!undoing) txt_undo_add_op(text, sel?UNDO_SLEFT:UNDO_CLEFT);
+	if (!undoing) txt_undo_add_op(text, sel?UNDO_SLEFT:UNDO_CLEFT);
 	
-	if(!sel) txt_pop_sel(text);
+	if (!sel) txt_pop_sel(text);
 }
 
 void txt_move_right(Text *text, short sel) 
@@ -915,7 +915,7 @@ void txt_move_right(Text *text, short sel)
 	int *charp, oundoing= undoing, do_tab= 0, i;
 	
 	if (!text) return;
-	if(sel) txt_curs_sel(text, &linep, &charp);
+	if (sel) txt_curs_sel(text, &linep, &charp);
 	else { txt_pop_last(text); txt_curs_cur(text, &linep, &charp); }
 	if (!*linep) return;
 
@@ -949,77 +949,77 @@ void txt_move_right(Text *text, short sel)
 	}
 	
 	undoing= oundoing;
-	if(!undoing) txt_undo_add_op(text, sel?UNDO_SRIGHT:UNDO_CRIGHT);
+	if (!undoing) txt_undo_add_op(text, sel?UNDO_SRIGHT:UNDO_CRIGHT);
 
-	if(!sel) txt_pop_sel(text);
+	if (!sel) txt_pop_sel(text);
 }
 
 void txt_jump_left(Text *text, short sel)
 {
 	TextLine **linep, *oldl;
-	int *charp, oldc, count, i;
+	int *charp, oldc, oldflags, i;
 	unsigned char oldu;
+	int pos;
 
 	if (!text) return;
-	if(sel) txt_curs_sel(text, &linep, &charp);
+	if (sel) txt_curs_sel(text, &linep, &charp);
 	else { txt_pop_first(text); txt_curs_cur(text, &linep, &charp); }
 	if (!*linep) return;
 
+	oldflags = text->flags;
+	text->flags &= ~TXT_TABSTOSPACES;
+
 	oldl= *linep;
 	oldc= *charp;
 	oldu= undoing;
 	undoing= 1; /* Don't push individual moves to undo stack */
 
-	count= 0;
-	for (i=0; i<3; i++) {
-		if (count < 2) {
-			while (*charp>0) {
-				char *sym= BLI_str_prev_char_utf8((*linep)->line + *charp);
-				if (txt_char_type(BLI_str_utf8_as_unicode(sym))==i) {
-					txt_move_left(text, sel);
-					count++;
-				} else break;
-			}
-		}
+	pos = *charp;
+	BLI_str_cursor_step_utf8((*linep)->line, (*linep)->len,
+	                         &pos, STRCUR_DIR_PREV,
+	                         STRCUR_JUMP_DELIM);
+	for (i = *charp; i > pos; i--) {
+		txt_move_left(text, sel);
 	}
-	if (count==0) txt_move_left(text, sel);
+
+	text->flags = oldflags;
 
 	undoing= oldu;
-	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);
+	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);
 }
 
 void txt_jump_right(Text *text, short sel)
 {
 	TextLine **linep, *oldl;
-	int *charp, oldc, count, i;
+	int *charp, oldc, oldflags, i;
 	unsigned char oldu;
+	int pos;
 
 	if (!text) return;
-	if(sel) txt_curs_sel(text, &linep, &charp);
+	if (sel) txt_curs_sel(text, &linep, &charp);
 	else { txt_pop_last(text); txt_curs_cur(text, &linep, &charp); }
 	if (!*linep) return;
 
+	oldflags = text->flags;
+	text->flags &= ~TXT_TABSTOSPACES;
+
 	oldl= *linep;
 	oldc= *charp;
 	oldu= undoing;
 	undoing= 1; /* Don't push individual moves to undo stack */
 
-	count= 0;
-	for (i=0; i<3; i++) {
-		if (count < 2) {
-			while (*charp<(*linep)->len) {
-				char *sym= (*linep)->line + *charp;
-				if (txt_char_type(BLI_str_utf8_as_unicode(sym))==i) {
-					txt_move_right(text, sel);
-					count++;
-				} else break;
-			}
-		}
+	pos = *charp;
+	BLI_str_cursor_step_utf8((*linep)->line, (*linep)->len,
+	                         &pos, STRCUR_DIR_NEXT,
+	                         STRCUR_JUMP_DELIM);
+	for (i = *charp; i < pos; i++) {
+		txt_move_right(text, sel);
 	}
-	if (count==0) txt_move_right(text, sel);
+
+	text->flags = oldflags;
 
 	undoing= oldu;
-	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);
+	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);
 }
 
 void txt_move_bol (Text *text, short sel) 
@@ -1028,15 +1028,15 @@ void txt_move_bol (Text *text, short sel)
 	int *charp, old;
 	
 	if (!text) return;
-	if(sel) txt_curs_sel(text, &linep, &charp);
+	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);
+	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) 
@@ -1045,15 +1045,15 @@ void txt_move_eol (Text *text, short sel)
 	int *charp, old;
 	
 	if (!text) return;
-	if(sel) txt_curs_sel(text, &linep, &charp);
+	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);
+	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)
@@ -1062,7 +1062,7 @@ void txt_move_bof (Text *text, short sel)
 	int *charp, old;
 	
 	if (!text) return;
-	if(sel) txt_curs_sel(text, &linep, &charp);
+	if (sel) txt_curs_sel(text, &linep, &charp);
 	else txt_curs_cur(text, &linep, &charp);
 	if (!*linep) return;
 	old= *charp;
@@ -1070,8 +1070,8 @@ void txt_move_bof (Text *text, short sel)
 	*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);
+	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)
@@ -1080,7 +1080,7 @@ void txt_move_eof (Text *text, short sel)
 	int *charp, old;
 	
 	if (!text) return;
-	if(sel) txt_curs_sel(text, &linep, &charp);
+	if (sel) txt_curs_sel(text, &linep, &charp);
 	else txt_curs_cur(text, &linep, &charp);
 	if (!*linep) return;
 	old= *charp;
@@ -1088,8 +1088,8 @@ void txt_move_eof (Text *text, short sel)
 	*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);	
+	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)
@@ -1105,7 +1105,7 @@ void txt_move_to (Text *text, unsigned int line, unsigned int ch, short sel)
 	unsigned int i;
 	
 	if (!text) return;
-	if(sel) txt_curs_sel(text, &linep, &charp);
+	if (sel) txt_curs_sel(text, &linep, &charp);
 	else txt_curs_cur(text, &linep, &charp);
 	if (!*linep) return;
 	oldc= *charp;
@@ -1120,8 +1120,8 @@ void txt_move_to (Text *text, unsigned int line, unsigned int ch, short sel)
 		ch= (unsigned int)((*linep)->len);
 	*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);
+	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);
 }
 
 /****************************/
@@ -1141,7 +1141,7 @@ static void txt_curs_swap (Text *text)
 	text->curc= text->selc;
 	text->selc= tmpc;
 	
-	if(!undoing) txt_undo_add_op(text, UNDO_SWAP);
+	if (!undoing) txt_undo_add_op(text, UNDO_SWAP);
 }
 
 static void txt_pop_first (Text *text)
@@ -1152,7 +1152,7 @@ static void txt_pop_first (Text *text)
 		txt_curs_swap(text);
 	}
 
-	if(!undoing) txt_undo_add_toop(text, UNDO_STO,
+	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), 
@@ -1168,7 +1168,7 @@ static void txt_pop_last (Text *text)
 		txt_curs_swap(text);
 	}
 
-	if(!undoing) txt_undo_add_toop(text, UNDO_STO,
+	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), 
@@ -1218,7 +1218,7 @@ static void txt_delete_sel (Text *text)
 	
 	txt_order_cursors(text);
 
-	if(!undoing) {
+	if (!undoing) {
 		buf= txt_sel_to_buf(text);
 		txt_undo_add_block(text, UNDO_DBLOCK, buf);
 		MEM_freeN(buf);
@@ -1229,7 +1229,8 @@ static void txt_delete_sel (Text *text)
 	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 {
+	}
+	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);
@@ -1315,7 +1316,8 @@ char *txt_to_buf (Text *text)
 		
 		BLI_strncpy(buf, linef->line + charf, length+1);
 		buf[length]=0;
-	} else {
+	}
+	else {
 		length= linef->len - charf;
 		length+= charl;
 		length+= 2; /* For the 2 '\n' */
@@ -1364,7 +1366,7 @@ int txt_find_string(Text *text, const char *findstr, int wrap, int match_case)
 
 	tl= startl= text->sell;
 	
-	if(match_case) s= strstr(&tl->line[text->selc], findstr);
+	if (match_case) s= strstr(&tl->line[text->selc], findstr);
 	else s= BLI_strcasestr(&tl->line[text->selc], findstr);
 	while (!s) {
 		tl= tl->next;
@@ -1375,7 +1377,7 @@ int txt_find_string(Text *text, const char *findstr, int wrap, int match_case)
 				break;
 		}
 
-		if(match_case) s= strstr(tl->line, findstr);
+		if (match_case) s= strstr(tl->line, findstr);
 		else s= BLI_strcasestr(tl->line, findstr);
 		if (tl==startl)
 			break;
@@ -1387,7 +1389,8 @@ int txt_find_string(Text *text, const char *findstr, int wrap, int match_case)
 		txt_move_to(text, newl, newc, 0);
 		txt_move_to(text, newl, newc + strlen(findstr), 1);
 		return 1;				
-	} else
+	}
+	else
 		return 0;
 }
 
@@ -1408,17 +1411,20 @@ char *txt_sel_to_buf (Text *text)
 		if (text->curc < text->selc) {
 			charf= text->curc;
 			charl= text->selc;
-		} else{
+		}
+		else {
 			charf= text->selc;
 			charl= text->curc;
 		}
-	} else if (txt_get_span(text->curl, text->sell)<0) {
+	}
+	else if (txt_get_span(text->curl, text->sell)<0) {
 		linef= text->sell;
 		linel= text->curl;
 
 		charf= text->selc;		
 		charl= text->curc;
-	} else {
+	}
+	else {
 		linef= text->curl;
 		linel= text->sell;
 		
@@ -1432,7 +1438,8 @@ char *txt_sel_to_buf (Text *text)
 		buf= MEM_mallocN(length+1, "sel buffer");
 		
 		BLI_strncpy(buf, linef->line + charf, length+1);
-	} else {
+	}
+	else {
 		length+= linef->len - charf;
 		length+= charl;
 		length++; /* For the '\n' */
@@ -1494,7 +1501,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_block(text, UNDO_IBLOCK, buffer);
 
 	u= undoing;
 	undoing= 1;
@@ -1517,13 +1524,14 @@ void txt_insert_buf(Text *text, const char *in_buffer)
 			i++; l++;
 		}
 	
-		if(buffer[i]=='\n') {
+		if (buffer[i]=='\n') {
 			add= txt_new_linen(buffer +(i-l), l);
 			BLI_insertlinkbefore(&text->lines, text->curl, add);
 			i++;
 			count++;
-		} else {
-			if(count) {
+		}
+		else {
+			if (count) {
 				txt_shift_markers(text, lineno, count);
 				count= 0;
 			}
@@ -1536,7 +1544,7 @@ void txt_insert_buf(Text *text, const char *in_buffer)
 	
 	MEM_freeN(buffer);
 
-	if(count) {
+	if (count) {
 		txt_shift_markers(text, lineno, count);
 	}
 
@@ -1550,12 +1558,13 @@ void txt_insert_buf(Text *text, const char *in_buffer)
 static int max_undo_test(Text *text, int x)
 {
 	while (text->undo_pos+x >= text->undo_len) {
-		if(text->undo_len*2 > TXT_MAX_UNDO) {
+		if (text->undo_len*2 > TXT_MAX_UNDO) {
 			/* XXX error("Undo limit reached, buffer cleared\n"); */
 			MEM_freeN(text->undo_buf);
 			init_undo_text(text);
 			return 0;
-		} else {
+		}
+		else {
 			void *tmp= text->undo_buf;
 			text->undo_buf= MEM_callocN(text->undo_len*2, "undo buf");
 			memcpy(text->undo_buf, tmp, text->undo_len);
@@ -1592,63 +1601,92 @@ void txt_print_undo(Text *text)
 		
 		if (op==UNDO_CLEFT) {
 			ops= "Cursor left";
-		} else if (op==UNDO_CRIGHT) {
+		}
+		else if (op==UNDO_CRIGHT) {
 			ops= "Cursor right";
-		} else if (op==UNDO_CUP) {
+		}
+		else if (op==UNDO_CUP) {
 			ops= "Cursor up";
-		} else if (op==UNDO_CDOWN) {
+		}
+		else if (op==UNDO_CDOWN) {
 			ops= "Cursor down";
-		} else if (op==UNDO_SLEFT) {
+		}
+		else if (op==UNDO_SLEFT) {
 			ops= "Selection left";
-		} else if (op==UNDO_SRIGHT) {
+		}
+		else if (op==UNDO_SRIGHT) {
 			ops= "Selection right";
-		} else if (op==UNDO_SUP) {
+		}
+		else if (op==UNDO_SUP) {
 			ops= "Selection up";
-		} else if (op==UNDO_SDOWN) {
+		}
+		else if (op==UNDO_SDOWN) {
 			ops= "Selection down";
-		} else if (op==UNDO_STO) {
+		}
+		else if (op==UNDO_STO) {
 			ops= "Selection ";
-		} else if (op==UNDO_CTO) {
+		}
+		else if (op==UNDO_CTO) {
 			ops= "Cursor ";
-		} else if (op==UNDO_INSERT_1) {
+		}
+		else if (op==UNDO_INSERT_1) {
 			ops= "Insert ascii ";
-		} else if (op==UNDO_INSERT_2) {
+		}
+		else if (op==UNDO_INSERT_2) {
 			ops= "Insert 2 bytes ";
-		} else if (op==UNDO_INSERT_3) {
+		}
+		else if (op==UNDO_INSERT_3) {
 			ops= "Insert 3 bytes ";
-		} else if (op==UNDO_INSERT_4) {
+		}
+		else if (op==UNDO_INSERT_4) {
 			ops= "Insert unicode ";
-		} else if (op==UNDO_BS_1) {
+		}
+		else if (op==UNDO_BS_1) {
 			ops= "Backspace for ascii ";
-		} else if (op==UNDO_BS_2) {
+		}
+		else if (op==UNDO_BS_2) {
 			ops= "Backspace for 2 bytes ";
-		} else if (op==UNDO_BS_3) {
+		}
+		else if (op==UNDO_BS_3) {
 			ops= "Backspace for 3 bytes ";
-		} else if (op==UNDO_BS_4) {
+		}
+		else if (op==UNDO_BS_4) {
 			ops= "Backspace for unicode ";
-		} else if (op==UNDO_DEL_1) {
+		}
+		else if (op==UNDO_DEL_1) {
 			ops= "Delete ascii ";
-		} else if (op==UNDO_DEL_2) {
+		}
+		else if (op==UNDO_DEL_2) {
 			ops= "Delete 2 bytes ";
-		} else if (op==UNDO_DEL_3) {
+		}
+		else if (op==UNDO_DEL_3) {
 			ops= "Delete 3 bytes ";
-		} else if (op==UNDO_DEL_4) {
+		}
+		else if (op==UNDO_DEL_4) {
 			ops= "Delete unicode ";
-		} else if (op==UNDO_SWAP) {
+		}
+		else if (op==UNDO_SWAP) {
 			ops= "Cursor swap";
-		} else if (op==UNDO_DBLOCK) {
+		}
+		else if (op==UNDO_DBLOCK) {
 			ops= "Delete text block";
-		} else if (op==UNDO_IBLOCK) {
+		}
+		else if (op==UNDO_IBLOCK) {
 			ops= "Insert text block";
-		} else if (op==UNDO_INDENT) {
+		}
+		else if (op==UNDO_INDENT) {
 			ops= "Indent ";
-		} else if (op==UNDO_UNINDENT) {
+		}
+		else if (op==UNDO_UNINDENT) {
 			ops= "Unindent ";
-		} else if (op==UNDO_COMMENT) {
+		}
+		else if (op==UNDO_COMMENT) {
 			ops= "Comment ";
-		} else if (op==UNDO_UNCOMMENT) {
+		}
+		else if (op==UNDO_UNCOMMENT) {
 			ops= "Uncomment ";
-		} else {
+		}
+		else {
 			ops= "Unknown";
 		}
 		
@@ -1679,10 +1717,11 @@ void txt_print_undo(Text *text)
 					uc= uc+(text->undo_buf[i]<<24); i++;
 					c_len= BLI_str_utf8_from_unicode(uc, c);
 					c[c_len]= '\0';
-					printf ("%s", c);
+					puts(c);
 				}
 			}
-		} else if (op==UNDO_STO || op==UNDO_CTO) {
+		}
+		else if (op==UNDO_STO || op==UNDO_CTO) {
 			i++;
 
 			charp= text->undo_buf[i]; i++;
@@ -1704,7 +1743,8 @@ void txt_print_undo(Text *text)
 			linep= linep+(text->undo_buf[i]<<24); i++;
 			
 			printf ("from <%d, %d>", linep, charp);
-		} else if (op==UNDO_DBLOCK || op==UNDO_IBLOCK) {
+		}
+		else if (op==UNDO_DBLOCK || op==UNDO_IBLOCK) {
 			i++;
 
 			linep= text->undo_buf[i]; i++;
@@ -1724,7 +1764,8 @@ void txt_print_undo(Text *text)
 			linep= linep+(text->undo_buf[i]<<16); i++;
 			linep= linep+(text->undo_buf[i]<<24); i++;
 			printf ("> (%d)", linep);
-		} else if (op==UNDO_INDENT || op==UNDO_UNINDENT) {
+		}
+		else if (op==UNDO_INDENT || op==UNDO_UNINDENT) {
 			i++;
 
 			charp= text->undo_buf[i]; i++;
@@ -1755,7 +1796,7 @@ void txt_print_undo(Text *text)
 
 static void txt_undo_add_op(Text *text, int op)
 {
-	if(!max_undo_test(text, 2))
+	if (!max_undo_test(text, 2))
 		return;
 	
 	text->undo_pos++;
@@ -1787,7 +1828,7 @@ static void txt_undo_add_block(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))
 		return;
 
 	text->undo_pos++;
@@ -1807,7 +1848,7 @@ static void txt_undo_add_block(Text *text, int op, const char *buf)
 
 void txt_undo_add_toop(Text *text, int op, unsigned int froml, unsigned short fromc, unsigned int tol, unsigned short toc)
 {
-	if(!max_undo_test(text, 15))
+	if (!max_undo_test(text, 15))
 		return;
 
 	if (froml==tol && fromc==toc) return;
@@ -1832,7 +1873,7 @@ 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))
 		return;
 	
 	text->undo_pos++;
@@ -1847,7 +1888,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;
-	} else {
+	}
+	else {
 		text->undo_buf[text->undo_pos]= op_start + 3;
 		text->undo_pos++;
 		txt_undo_store_uint32(text->undo_buf, &text->undo_pos, c);
@@ -2026,7 +2068,8 @@ void txt_do_undo(Text *text)
 				txt_move_toline(text, linep, 0);
 				text->curc= charp;
 				txt_pop_sel(text);
-			} else {
+			}
+			else {
 				txt_move_toline(text, linep, 1);
 				text->selc= charp;
 			}
@@ -2061,7 +2104,7 @@ void txt_do_undo(Text *text)
 			linep= txt_undo_read_uint32(text->undo_buf, &text->undo_pos);
 
 			buf= MEM_mallocN(linep+1, "dblock buffer");
-			for (i=0; i < linep; i++){
+			for (i=0; i < linep; i++) {
 				buf[(linep-1)-i]= text->undo_buf[text->undo_pos]; 
 				text->undo_pos--;
 			}
@@ -2075,7 +2118,7 @@ void txt_do_undo(Text *text)
 
 			text->curl= text->lines.first;
 			while (holdln>0) {
-				if(text->curl->next)
+				if (text->curl->next)
 					text->curl= text->curl->next;
 					
 				holdln--;
@@ -2097,7 +2140,7 @@ void txt_do_undo(Text *text)
 
 			/* txt_backspace_char removes utf8-characters, not bytes */
 			buf= MEM_mallocN(linep+1, "iblock buffer");
-			for (i=0; i < linep; i++){
+			for (i=0; i < linep; i++) {
 				buf[(linep-1)-i]= text->undo_buf[text->undo_pos]; 
 				text->undo_pos--;
 			}
@@ -2149,11 +2192,14 @@ void txt_do_undo(Text *text)
 			
 			if (op==UNDO_INDENT) {
 				txt_unindent(text);
-			} else if (op== UNDO_UNINDENT) {
+			}
+			else if (op== UNDO_UNINDENT) {
 				txt_indent(text);
-			} else if (op == UNDO_COMMENT) {
+			}
+			else if (op == UNDO_COMMENT) {
 				txt_uncomment(text);
-			} else if (op == UNDO_UNCOMMENT) {
+			}
+			else if (op == UNDO_UNCOMMENT) {
 				txt_comment(text);
 			}
 
@@ -2274,7 +2320,8 @@ void txt_do_redo(Text *text)
 				txt_move_toline(text, linep, 0);
 				text->curc= charp;
 				txt_pop_sel(text);
-			} else {
+			}
+			else {
 				txt_move_toline(text, linep, 1);
 				text->selc= charp;
 			}
@@ -2344,11 +2391,14 @@ void txt_do_redo(Text *text)
 
 			if (op==UNDO_INDENT) {
 				txt_indent(text);
-			} else if (op== UNDO_UNINDENT) {
+			}
+			else if (op== UNDO_UNINDENT) {
 				txt_unindent(text);
-			} else if (op == UNDO_COMMENT) {
+			}
+			else if (op == UNDO_COMMENT) {
 				txt_comment(text);
-			} else if (op == UNDO_UNCOMMENT) {
+			}
+			else if (op == UNDO_UNCOMMENT) {
 				txt_uncomment(text);
 			}
 			break;
@@ -2387,7 +2437,8 @@ void txt_split_curline (Text *text)
 			mrk->lineno++;
 			mrk->start -= text->curc;
 			mrk->end -= text->curc;
-		} else if (mrk->lineno > lineno) {
+		}
+		else if (mrk->lineno > lineno) {
 			mrk->lineno++;
 		}
 		mrk= mrk->next;
@@ -2424,7 +2475,7 @@ 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');
+	if (!undoing) txt_undo_add_charop(text, UNDO_INSERT_1, '\n');
 }
 
 static void txt_delete_line (Text *text, TextLine *line) 
@@ -2465,7 +2516,7 @@ static void txt_combine_lines (Text *text, TextLine *linea, TextLine *lineb)
 	
 	if (!text) return;
 	
-	if(!linea || !lineb) return;
+	if (!linea || !lineb) return;
 
 	mrk= txt_find_marker_region(text, lineb, 0, lineb->len, 0, 0);
 	if (mrk) {
@@ -2509,7 +2560,10 @@ void txt_delete_char(Text *text)
 			txt_combine_lines(text, text->curl, text->curl->next);
 			txt_pop_sel(text);
 		}
-	} else { /* Just deleting a char */
+		else
+			return;
+	}
+	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);
@@ -2520,7 +2574,8 @@ void txt_delete_char(Text *text)
 			if (mrk->end==text->curc) {
 				if ((mrk->flags & TMARK_TEMP) && !(mrk->flags & TMARK_EDITALL)) {
 					txt_clear_markers(text, mrk->group, TMARK_TEMP);
-				} else {
+				}
+				else {
 					BLI_freelinkN(&text->markers, mrk);
 				}
 				return;
@@ -2542,7 +2597,7 @@ void txt_delete_char(Text *text)
 	txt_make_dirty(text);
 	txt_clean_text(text);
 	
-	if(!undoing) txt_undo_add_charop(text, UNDO_DEL_1, c);
+	if (!undoing) txt_undo_add_charop(text, UNDO_DEL_1, c);
 }
 
 void txt_delete_word (Text *text) 
@@ -2584,7 +2639,8 @@ void txt_backspace_char (Text *text)
 			if (mrk->start==text->curc) {
 				if ((mrk->flags & TMARK_TEMP) && !(mrk->flags & TMARK_EDITALL)) {
 					txt_clear_markers(text, mrk->group, TMARK_TEMP);
-				} else {
+				}
+				else {
 					BLI_freelinkN(&text->markers, mrk);
 				}
 				return;
@@ -2596,7 +2652,10 @@ void txt_backspace_char (Text *text)
 			} while (mrk && mrk->lineno==lineno);
 		}
 		
-		memcpy(text->curl->line + text->curc - c_len, text->curl->line + text->curc, text->curl->len-text->curc+1);
+		/* source and destination overlap, don't use memcpy() */
+		memmove(text->curl->line + text->curc - c_len,
+		        text->curl->line + text->curc,
+		        text->curl->len  - text->curc + 1);
 
 		text->curl->len-= c_len;
 		text->curc-= c_len;
@@ -2607,7 +2666,7 @@ void txt_backspace_char (Text *text)
 	txt_make_dirty(text);
 	txt_clean_text(text);
 	
-	if(!undoing) txt_undo_add_charop(text, UNDO_BS_1, c);
+	if (!undoing) txt_undo_add_charop(text, UNDO_BS_1, c);
 }
 
 void txt_backspace_word (Text *text) 
@@ -2617,7 +2676,7 @@ void txt_backspace_word (Text *text)
 }
 
 /* Max spaces to replace a tab with, currently hardcoded to TXT_TABSIZE = 4.
- * Used by txt_convert_tab_to_spaces, indent and unintent.
+ * Used by txt_convert_tab_to_spaces, indent and unindent.
  * Remember to change this string according to max tab size */
 static char tab_to_spaces[] = "    ";
 
@@ -2680,7 +2739,7 @@ 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);
+	if (!undoing) txt_undo_add_charop(text, UNDO_INSERT_1, add);
 	return 1;
 }
 
@@ -2726,7 +2785,8 @@ int txt_replace_char (Text *text, unsigned int add)
 		memcpy(tmp+text->curc+add_size, text->curl->line+text->curc+del_size, text->curl->len-text->curc-del_size+1);
 		MEM_freeN(text->curl->line);
 		text->curl->line = tmp;
-	} else if (add_size < del_size) {
+	}
+	else if (add_size < del_size) {
 		char *tmp= text->curl->line;
 		memmove(tmp+text->curc+add_size, tmp+text->curc+del_size, text->curl->len-text->curc-del_size+1);
 	}
@@ -2739,7 +2799,7 @@ int txt_replace_char (Text *text, unsigned int add)
 	txt_clean_text(text);
 
 	/* Should probably create a new op for this */
-	if(!undoing) {
+	if (!undoing) {
 		txt_undo_add_charop(text, UNDO_DEL_1, del);
 		txt_undo_add_charop(text, UNDO_INSERT_1, add);
 	}
@@ -2766,7 +2826,7 @@ void txt_indent(Text *text)
 	if (!text->sell) return;
 
 	/* insert spaces rather than tabs */
-	if (text->flags & TXT_TABSTOSPACES){
+	if (text->flags & TXT_TABSTOSPACES) {
 		add = tab_to_spaces;
 		indentlen = spaceslen;
 	}
@@ -2777,11 +2837,11 @@ void txt_indent(Text *text)
 		tmp= MEM_mallocN(text->curl->len+indentlen+1, "textline_string");
 		
 		text->curc = 0; 
-		if(text->curc) memcpy(tmp, text->curl->line, text->curc); /* XXX never true, check prev line */
+		if (text->curc) memcpy(tmp, text->curl->line, text->curc); /* XXX never true, check prev line */
 		memcpy(tmp+text->curc, add, indentlen);
 		
 		len= text->curl->len - text->curc;
-		if(len>0) memcpy(tmp+text->curc+indentlen, text->curl->line+text->curc, len);
+		if (len>0) memcpy(tmp+text->curc+indentlen, text->curl->line+text->curc, len);
 		tmp[text->curl->len+indentlen]= 0;
 
 		make_new_line(text->curl, tmp);
@@ -2791,23 +2851,24 @@ void txt_indent(Text *text)
 		txt_make_dirty(text);
 		txt_clean_text(text);
 		
-		if(text->curl == text->sell) 
+		if (text->curl == text->sell) 
 		{
 			text->selc = text->sell->len;
 			break;
-		} else {
+		}
+		else {
 			text->curl = text->curl->next;
 			num++;
 		}
 	}
 	text->curc = 0;
-	while( num > 0 )
+	while ( num > 0 )
 	{
 		text->curl = text->curl->prev;
 		num--;
 	}
 	
-	if(!undoing) 
+	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);
 	}
@@ -2827,18 +2888,18 @@ void txt_unindent(Text *text)
 	if (!text->sell) return;
 
 	/* insert spaces rather than tabs */
-	if (text->flags & TXT_TABSTOSPACES){
+	if (text->flags & TXT_TABSTOSPACES) {
 		remove = tab_to_spaces;
 		indent = spaceslen;
 	}
 
-	while(TRUE)
+	while (TRUE)
 	{
 		int i = 0;
 		
 		if (BLI_strncasecmp(text->curl->line, remove, indent) == 0)
 		{
-			while(i< text->curl->len) {
+			while (i< text->curl->len) {
 				text->curl->line[i]= text->curl->line[i+indent];
 				i++;
 			}
@@ -2848,24 +2909,25 @@ void txt_unindent(Text *text)
 		txt_make_dirty(text);
 		txt_clean_text(text);
 		
-		if(text->curl == text->sell) 
+		if (text->curl == text->sell) 
 		{
 			text->selc = text->sell->len;
 			break;
-		} else {
+		}
+		else {
 			text->curl = text->curl->next;
 			num++;
 		}
 		
 	}
 	text->curc = 0;
-	while( num > 0 )
+	while ( num > 0 )
 	{
 		text->curl = text->curl->prev;
 		num--;
 	}
 	
-	if(!undoing) 
+	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);
 	}
@@ -2887,11 +2949,11 @@ void txt_comment(Text *text)
 		tmp= MEM_mallocN(text->curl->len+2, "textline_string");
 		
 		text->curc = 0; 
-		if(text->curc) memcpy(tmp, text->curl->line, text->curc);
+		if (text->curc) memcpy(tmp, text->curl->line, text->curc);
 		tmp[text->curc]= add;
 		
 		len= text->curl->len - text->curc;
-		if(len>0) memcpy(tmp+text->curc+1, text->curl->line+text->curc, len);
+		if (len>0) memcpy(tmp+text->curc+1, text->curl->line+text->curc, len);
 		tmp[text->curl->len+1]=0;
 
 		make_new_line(text->curl, tmp);
@@ -2901,23 +2963,24 @@ void txt_comment(Text *text)
 		txt_make_dirty(text);
 		txt_clean_text(text);
 		
-		if(text->curl == text->sell) 
+		if (text->curl == text->sell) 
 		{
 			text->selc = text->sell->len;
 			break;
-		} else {
+		}
+		else {
 			text->curl = text->curl->next;
 			num++;
 		}
 	}
 	text->curc = 0;
-	while( num > 0 )
+	while ( num > 0 )
 	{
 		text->curl = text->curl->prev;
 		num--;
 	}
 	
-	if(!undoing) 
+	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);
 	}
@@ -2932,13 +2995,13 @@ void txt_uncomment(Text *text)
 	if (!text->curl) return;
 	if (!text->sell) return;
 
-	while(TRUE)
+	while (TRUE)
 	{
 		int i = 0;
 		
 		if (text->curl->line[i] == remove)
 		{
-			while(i< text->curl->len) {
+			while (i< text->curl->len) {
 				text->curl->line[i]= text->curl->line[i+1];
 				i++;
 			}
@@ -2949,24 +3012,25 @@ void txt_uncomment(Text *text)
 		txt_make_dirty(text);
 		txt_clean_text(text);
 		
-		if(text->curl == text->sell) 
+		if (text->curl == text->sell) 
 		{
 			text->selc = text->sell->len;
 			break;
-		} else {
+		}
+		else {
 			text->curl = text->curl->next;
 			num++;
 		}
 		
 	}
 	text->curc = 0;
-	while( num > 0 )
+	while ( num > 0 )
 	{
 		text->curl = text->curl->prev;
 		num--;
 	}
 	
-	if(!undoing) 
+	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);
 	}
@@ -2989,11 +3053,12 @@ int setcurr_tab_spaces (Text *text, int space)
 		if (i == text->curc)
 		{
 			return i;
-		} else {
+		}
+		else {
 			i++;
 		}
 	}
-	if(strstr(text->curl->line, word))
+	if (strstr(text->curl->line, word))
 	{
 		/* if we find a ':' on this line, then add a tab but not if it is:
 		 * 	1) in a comment
@@ -3001,14 +3066,16 @@ int setcurr_tab_spaces (Text *text, int space)
 		 *	3) after the cursor (text->curc), i.e. when creating space before a function def [#25414] 
 		 */
 		int a, is_indent = 0;
-		for(a=0; (a < text->curc) && (text->curl->line[a] != '\0'); a++)
+		for (a=0; (a < text->curc) && (text->curl->line[a] != '\0'); a++)
 		{
 			char ch= text->curl->line[a];
 			if (ch=='#') {
 				break;
-			} else if (ch==':') {
+			}
+			else if (ch==':') {
 				is_indent = 1;
-			} else if (ch!=' ' && ch!='\t') {
+			}
+			else if (ch!=' ' && ch!='\t') {
 				is_indent = 0;
 			}
 		}
@@ -3017,12 +3084,12 @@ int setcurr_tab_spaces (Text *text, int space)
 		}
 	}
 
-	for(test=0; back_words[test]; test++)
+	for (test=0; back_words[test]; test++)
 	{
 		/* if there are these key words then remove a tab because we are done with the block */
-		if(strstr(text->curl->line, back_words[test]) && i > 0)
+		if (strstr(text->curl->line, back_words[test]) && i > 0)
 		{
-			if(strcspn(text->curl->line, back_words[test]) < strcspn(text->curl->line, comm))
+			if (strcspn(text->curl->line, back_words[test]) < strcspn(text->curl->line, comm))
 			{
 				i -= space;
 			}
@@ -3062,8 +3129,8 @@ void txt_add_marker(Text *text, TextLine *line, int start, int end, const unsign
 }
 
 /* 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. */
+ * 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;
@@ -3085,8 +3152,8 @@ TextMarker *txt_find_marker_region(Text *text, TextLine *line, int start, int en
 }
 
 /* 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. */
+ * 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;
@@ -3111,8 +3178,8 @@ short txt_clear_marker_region(Text *text, TextLine *line, int start, int end, in
 }
 
 /* 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) */
+ * 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;
@@ -3131,7 +3198,7 @@ short txt_clear_markers(Text *text, int group, int flags)
 }
 
 /* Finds the marker at the specified line and cursor position with at least the
-   specified flags set in the given group (if non-zero). */
+ * 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;
@@ -3150,7 +3217,7 @@ TextMarker *txt_find_marker(Text *text, TextLine *line, int curs, int group, int
 }
 
 /* Finds the previous marker in the same group. If no other is found, the same
-   marker will be returned */
+ * marker will be returned */
 TextMarker *txt_prev_marker(Text *text, TextMarker *marker)
 {
 	TextMarker *tmp= marker;
@@ -3164,7 +3231,7 @@ TextMarker *txt_prev_marker(Text *text, TextMarker *marker)
 }
 
 /* Finds the next marker in the same group. If no other is found, the same
-   marker will be returned */
+ * marker will be returned */
 TextMarker *txt_next_marker(Text *text, TextMarker *marker)
 {
 	TextMarker *tmp= marker;
@@ -3182,54 +3249,55 @@ TextMarker *txt_next_marker(Text *text, TextMarker *marker)
 /* Character utility functions */
 /*******************************/
 
-int text_check_bracket(char ch)
+int text_check_bracket(const char ch)
 {
 	int a;
 	char opens[] = "([{";
 	char close[] = ")]}";
 
-	for(a=0; a<(sizeof(opens)-1); a++) {
-		if(ch==opens[a])
+	for (a=0; a<(sizeof(opens)-1); a++) {
+		if (ch==opens[a])
 			return a+1;
-		else if(ch==close[a])
+		else if (ch==close[a])
 			return -(a+1);
 	}
 	return 0;
 }
 
-int text_check_delim(char ch)
+/* TODO, have a function for operators - http://docs.python.org/py3k/reference/lexical_analysis.html#operators */
+int text_check_delim(const char ch)
 {
 	int a;
-	char delims[] = "():\"\' ~!%^&*-+=[]{};/<>|.#\t,";
+	char delims[] = "():\"\' ~!%^&*-+=[]{};/<>|.#\t,@";
 
-	for(a=0; a<(sizeof(delims)-1); a++) {
-		if(ch==delims[a])
+	for (a=0; a<(sizeof(delims)-1); a++) {
+		if (ch==delims[a])
 			return 1;
 	}
 	return 0;
 }
 
-int text_check_digit(char ch)
+int text_check_digit(const char ch)
 {
-	if(ch < '0') return 0;
-	if(ch <= '9') return 1;
+	if (ch < '0') return 0;
+	if (ch <= '9') return 1;
 	return 0;
 }
 
-int text_check_identifier(char ch)
+int text_check_identifier(const char ch)
 {
-	if(ch < '0') return 0;
-	if(ch <= '9') return 1;
-	if(ch < 'A') return 0;
-	if(ch <= 'Z' || ch == '_') return 1;
-	if(ch < 'a') return 0;
-	if(ch <= 'z') return 1;
+	if (ch < '0') return 0;
+	if (ch <= '9') return 1;
+	if (ch < 'A') return 0;
+	if (ch <= 'Z' || ch == '_') return 1;
+	if (ch < 'a') return 0;
+	if (ch <= 'z') return 1;
 	return 0;
 }
 
-int text_check_whitespace(char ch)
+int text_check_whitespace(const char ch)
 {
-	if(ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n')
+	if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n')
 		return 1;
 	return 0;
 }
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 4c40dca..23d8183 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -81,7 +81,7 @@ int test_dlerr(const char *name, const char *symbol)
 	char *err;
 	
 	err= BLI_dynlib_get_error_as_string(NULL);
-	if(err) {
+	if (err) {
 		printf("var1: %s, var2: %s, var3: %s\n", name, symbol, err);
 		return 1;
 	}
@@ -109,12 +109,12 @@ void open_plugin_tex(PluginTex *pit)
 	BLI_dynlib_get_error_as_string(NULL);
 
 	/* no BLI_dynlib_close! multiple opened plugins... */
-	/* if(pit->handle) BLI_dynlib_close(pit->handle); */
+	/* if (pit->handle) BLI_dynlib_close(pit->handle); */
 	/* pit->handle= 0; */
 
 	/* open the needed object */
 	pit->handle= BLI_dynlib_open(pit->name);
-	if(test_dlerr(pit->name, pit->name)) return;
+	if (test_dlerr(pit->name, pit->name)) return;
 
 	if (pit->handle != NULL) {
 		/* find the address of the version function */
@@ -123,7 +123,7 @@ void open_plugin_tex(PluginTex *pit)
 		
 		if (version != NULL) {
 			pit->version= version();
-			if( pit->version >= 2 && pit->version <=6) {
+			if ( pit->version >= 2 && pit->version <=6) {
 				int (*info_func)(PluginInfo *);
 				PluginInfo *info= (PluginInfo*) MEM_mallocN(sizeof(PluginInfo), "plugin_info"); 
 
@@ -146,7 +146,8 @@ void open_plugin_tex(PluginTex *pit)
 					if (info->init) info->init();
 				}
 				MEM_freeN(info);
-			} else {
+			}
+			else {
 				printf ("Plugin returned unrecognized version number\n");
 				return;
 			}
@@ -171,18 +172,18 @@ PluginTex *add_plugin_tex(char *str)
 	BLI_strncpy(pit->name, str, sizeof(pit->name));
 	open_plugin_tex(pit);
 	
-	if(pit->doit==NULL) {
-		if(pit->handle==NULL) {;} //XXX error("no plugin: %s", str);
+	if (pit->doit==NULL) {
+		if (pit->handle==NULL) {;} //XXX error("no plugin: %s", str);
 		else {;} //XXX error("in plugin: %s", str);
 		MEM_freeN(pit);
 		return NULL;
 	}
 	
 	varstr= pit->varstr;
-	for(a=0; a<pit->vars; a++, varstr++) {
-		if( (varstr->type & FLO)==FLO)
+	for (a=0; a<pit->vars; a++, varstr++) {
+		if ( (varstr->type & FLO)==FLO)
 			pit->data[a]= varstr->def;
-		else if( (varstr->type & INT)==INT)
+		else if ( (varstr->type & INT)==INT)
 			*((int *)(pit->data+a))= (int) varstr->def;
 	}
 
@@ -196,7 +197,7 @@ PluginTex *add_plugin_tex(char *str)
 
 void free_plugin_tex(PluginTex *pit)
 {
-	if(pit==NULL) return;
+	if (pit==NULL) return;
 		
 	/* no BLI_dynlib_close: same plugin can be opened multiple times, 1 handle */
 	MEM_freeN(pit);	
@@ -231,7 +232,7 @@ void init_tex_mapping(TexMapping *texmap)
 {
 	float smat[3][3], rmat[3][3], mat[3][3], proj[3][3];
 
-	if(texmap->projx == PROJ_X && texmap->projy == PROJ_Y && texmap->projz == PROJ_Z &&
+	if (texmap->projx == PROJ_X && texmap->projy == PROJ_Y && texmap->projz == PROJ_Z &&
 	   is_zero_v3(texmap->loc) && is_zero_v3(texmap->rot) && is_one_v3(texmap->size)) {
 		unit_m4(texmap->mat);
 
@@ -241,11 +242,11 @@ void init_tex_mapping(TexMapping *texmap)
 		/* axis projection */
 		zero_m3(proj);
 
-		if(texmap->projx != PROJ_N)
+		if (texmap->projx != PROJ_N)
 			proj[texmap->projx-1][0]= 1.0f;
-		if(texmap->projy != PROJ_N)
+		if (texmap->projy != PROJ_N)
 			proj[texmap->projy-1][1]= 1.0f;
-		if(texmap->projz != PROJ_N)
+		if (texmap->projz != PROJ_N)
 			proj[texmap->projz-1][2]= 1.0f;
 
 		/* scale */
@@ -302,7 +303,7 @@ void init_colorband(ColorBand *coba, int rangetype)
 	coba->data[0].pos= 0.0;
 	coba->data[1].pos= 1.0;
 	
-	if(rangetype==0) {
+	if (rangetype==0) {
 		coba->data[0].r= 0.0;
 		coba->data[0].g= 0.0;
 		coba->data[0].b= 0.0;
@@ -325,7 +326,7 @@ void init_colorband(ColorBand *coba, int rangetype)
 		coba->data[1].a= 1.0;
 	}
 	
-	for(a=2; a<MAXCOLORBAND; a++) {
+	for (a=2; a<MAXCOLORBAND; a++) {
 		coba->data[a].r= 0.5;
 		coba->data[a].g= 0.5;
 		coba->data[a].b= 0.5;
@@ -355,17 +356,17 @@ int do_colorband(const ColorBand *coba, float in, float out[4])
 	float fac, mfac, t[4];
 	int a;
 	
-	if(coba==NULL || coba->tot==0) return 0;
+	if (coba==NULL || coba->tot==0) return 0;
 	
 	cbd1= coba->data;
-	if(coba->tot==1) {
+	if (coba->tot==1) {
 		out[0]= cbd1->r;
 		out[1]= cbd1->g;
 		out[2]= cbd1->b;
 		out[3]= cbd1->a;
 	}
 	else {
-		if(in <= cbd1->pos && coba->ipotype<2) {
+		if (in <= cbd1->pos && coba->ipotype<2) {
 			out[0]= cbd1->r;
 			out[1]= cbd1->g;
 			out[2]= cbd1->b;
@@ -375,22 +376,22 @@ int do_colorband(const ColorBand *coba, float in, float out[4])
 			CBData left, right;
 			
 			/* we're looking for first pos > in */
-			for(a=0; a<coba->tot; a++, cbd1++) if(cbd1->pos > in) break;
+			for (a=0; a<coba->tot; a++, cbd1++) if (cbd1->pos > in) break;
 				
-			if(a==coba->tot) {
+			if (a==coba->tot) {
 				cbd2= cbd1-1;
 				right= *cbd2;
 				right.pos= 1.0f;
 				cbd1= &right;
 			}
-			else if(a==0) {
+			else if (a==0) {
 				left= *cbd1;
 				left.pos= 0.0f;
 				cbd2= &left;
 			}
 			else cbd2= cbd1-1;
 			
-			if(in >= cbd1->pos && coba->ipotype<2) {
+			if (in >= cbd1->pos && coba->ipotype<2) {
 				out[0]= cbd1->r;
 				out[1]= cbd1->g;
 				out[2]= cbd1->b;
@@ -398,7 +399,7 @@ int do_colorband(const ColorBand *coba, float in, float out[4])
 			}
 			else {
 		
-				if(cbd2->pos!=cbd1->pos)
+				if (cbd2->pos!=cbd1->pos)
 					fac= (in-cbd1->pos)/(cbd2->pos-cbd1->pos);
 				else {
 					/* was setting to 0.0 in 2.56 & previous, but this
@@ -415,17 +416,17 @@ int do_colorband(const ColorBand *coba, float in, float out[4])
 					return 1;
 				}
 				
-				if(coba->ipotype>=2) {
+				if (coba->ipotype>=2) {
 					/* ipo from right to left: 3 2 1 0 */
 					
-					if(a>=coba->tot-1) cbd0= cbd1;
+					if (a>=coba->tot-1) cbd0= cbd1;
 					else cbd0= cbd1+1;
-					if(a<2) cbd3= cbd2;
+					if (a<2) cbd3= cbd2;
 					else cbd3= cbd2-1;
 					
 					CLAMP(fac, 0.0f, 1.0f);
 					
-					if(coba->ipotype==3)
+					if (coba->ipotype==3)
 						key_curve_position_weights(fac, t, KEY_CARDINAL);
 					else
 						key_curve_position_weights(fac, t, KEY_BSPLINE);
@@ -441,7 +442,7 @@ int do_colorband(const ColorBand *coba, float in, float out[4])
 				}
 				else {
 				
-					if(coba->ipotype==1) {	/* EASE */
+					if (coba->ipotype==1) {	/* EASE */
 						mfac= fac*fac;
 						fac= 3.0f*mfac-2.0f*mfac*fac;
 					}
@@ -465,7 +466,7 @@ void colorband_table_RGBA(ColorBand *coba, float **array, int *size)
 	*size = CM_TABLE+1;
 	*array = MEM_callocN(sizeof(float)*(*size)*4, "ColorBand");
 
-	for(a=0; a<*size; a++)
+	for (a=0; a<*size; a++)
 		do_colorband(coba, (float)a/(float)CM_TABLE, &(*array)[a*4]);
 }
 
@@ -473,8 +474,8 @@ int vergcband(const void *a1, const void *a2)
 {
 	const CBData *x1=a1, *x2=a2;
 
-	if( x1->pos > x2->pos ) return 1;
-	else if( x1->pos < x2->pos) return -1;
+	if ( x1->pos > x2->pos ) return 1;
+	else if ( x1->pos < x2->pos) return -1;
 	return 0;
 }
 
@@ -482,16 +483,16 @@ void colorband_update_sort(ColorBand *coba)
 {
 	int a;
 	
-	if(coba->tot<2)
+	if (coba->tot<2)
 		return;
 	
-	for(a=0; a<coba->tot; a++)
+	for (a=0; a<coba->tot; a++)
 		coba->data[a].cur= a;
 
 	qsort(coba->data, coba->tot, sizeof(CBData), vergcband);
 
-	for(a=0; a<coba->tot; a++) {
-		if(coba->data[a].cur==coba->cur) {
+	for (a=0; a<coba->tot; a++) {
+		if (coba->data[a].cur==coba->cur) {
 			coba->cur= a;
 			break;
 		}
@@ -500,10 +501,10 @@ void colorband_update_sort(ColorBand *coba)
 
 CBData *colorband_element_add(struct ColorBand *coba, float position)
 {
-	if(coba->tot==MAXCOLORBAND) {
+	if (coba->tot==MAXCOLORBAND) {
 		return NULL;
 	}
-	else if(coba->tot > 0) {
+	else if (coba->tot > 0) {
 		CBData *xnew;
 		float col[4];
 
@@ -530,16 +531,16 @@ int colorband_element_remove(struct ColorBand *coba, int index)
 {
 	int a;
 
-	if(coba->tot < 2)
+	if (coba->tot < 2)
 		return 0;
 
-	if(index < 0 || index >= coba->tot)
+	if (index < 0 || index >= coba->tot)
 		return 0;
 
-	for(a = index; a < coba->tot; a++) {
+	for (a = index; a < coba->tot; a++) {
 		coba->data[a] = coba->data[a + 1];
 	}
-	if(coba->cur) coba->cur--;
+	if (coba->cur) coba->cur--;
 	coba->tot--;
 	return 1;
 }
@@ -550,18 +551,18 @@ void free_texture(Tex *tex)
 {
 	free_plugin_tex(tex->plugin);
 	
-	if(tex->coba) MEM_freeN(tex->coba);
-	if(tex->env) BKE_free_envmap(tex->env);
-	if(tex->pd) BKE_free_pointdensity(tex->pd);
-	if(tex->vd) BKE_free_voxeldata(tex->vd);
-	if(tex->ot) BKE_free_oceantex(tex->ot);
+	if (tex->coba) MEM_freeN(tex->coba);
+	if (tex->env) BKE_free_envmap(tex->env);
+	if (tex->pd) BKE_free_pointdensity(tex->pd);
+	if (tex->vd) BKE_free_voxeldata(tex->vd);
+	if (tex->ot) BKE_free_oceantex(tex->ot);
 	BKE_free_animdata((struct ID *)tex);
 	
 	BKE_previewimg_free(&tex->preview);
 	BKE_icon_delete((struct ID*)tex);
 	tex->id.icon_id = 0;
 	
-	if(tex->nodetree) {
+	if (tex->nodetree) {
 		ntreeFreeTree(tex->nodetree);
 		MEM_freeN(tex->nodetree);
 	}
@@ -645,8 +646,8 @@ void default_tex(Tex *tex)
 	pit = tex->plugin;
 	if (pit) {
 		varstr= pit->varstr;
-		if(varstr) {
-			for(a=0; a<pit->vars; a++, varstr++) {
+		if (varstr) {
+			for (a=0; a<pit->vars; a++, varstr++) {
 				pit->data[a] = varstr->def;
 			}
 		}
@@ -786,11 +787,11 @@ MTex *add_mtex_id(ID *id, int slot)
 
 	give_active_mtex(id, &mtex_ar, &act);
 
-	if(mtex_ar==NULL) {
+	if (mtex_ar==NULL) {
 		return NULL;
 	}
 	
-	if(slot==-1) {
+	if (slot==-1) {
 		/* find first free */
 		int i;		
 		for (i= 0; i < MAX_MTEX; i++) {
@@ -799,13 +800,13 @@ MTex *add_mtex_id(ID *id, int slot)
 				break;
 			}
 		}
-		if(slot == -1) {
+		if (slot == -1) {
 			return NULL;
 		}
 	}
 	else {
 		/* make sure slot is valid */
-		if(slot < 0 || slot >= MAX_MTEX) {
+		if (slot < 0 || slot >= MAX_MTEX) {
 			return NULL;
 		}
 	}
@@ -828,22 +829,22 @@ Tex *copy_texture(Tex *tex)
 	Tex *texn;
 	
 	texn= copy_libblock(&tex->id);
-	if(texn->type==TEX_IMAGE) id_us_plus((ID *)texn->ima);
+	if (texn->type==TEX_IMAGE) id_us_plus((ID *)texn->ima);
 	else texn->ima= NULL;
 	
-	if(texn->plugin) {
+	if (texn->plugin) {
 		texn->plugin= MEM_dupallocN(texn->plugin);
 		open_plugin_tex(texn->plugin);
 	}
 	
-	if(texn->coba) texn->coba= MEM_dupallocN(texn->coba);
-	if(texn->env) texn->env= BKE_copy_envmap(texn->env);
-	if(texn->pd) texn->pd= BKE_copy_pointdensity(texn->pd);
-	if(texn->vd) texn->vd= MEM_dupallocN(texn->vd);
-	if(texn->ot) texn->ot= BKE_copy_oceantex(texn->ot);
-	if(tex->preview) texn->preview = BKE_previewimg_copy(tex->preview);
+	if (texn->coba) texn->coba= MEM_dupallocN(texn->coba);
+	if (texn->env) texn->env= BKE_copy_envmap(texn->env);
+	if (texn->pd) texn->pd= BKE_copy_pointdensity(texn->pd);
+	if (texn->vd) texn->vd= MEM_dupallocN(texn->vd);
+	if (texn->ot) texn->ot= BKE_copy_oceantex(texn->ot);
+	if (tex->preview) texn->preview = BKE_previewimg_copy(tex->preview);
 
-	if(tex->nodetree) {
+	if (tex->nodetree) {
 		if (tex->nodetree->execdata) {
 			ntreeTexEndExecTree(tex->nodetree->execdata, 1);
 		}
@@ -863,29 +864,29 @@ Tex *localize_texture(Tex *tex)
 	
 	/* image texture: free_texture also doesn't decrease */
 	
-	if(texn->plugin) {
+	if (texn->plugin) {
 		texn->plugin= MEM_dupallocN(texn->plugin);
 		open_plugin_tex(texn->plugin);
 	}
 	
-	if(texn->coba) texn->coba= MEM_dupallocN(texn->coba);
-	if(texn->env) {
+	if (texn->coba) texn->coba= MEM_dupallocN(texn->coba);
+	if (texn->env) {
 		texn->env= BKE_copy_envmap(texn->env);
 		id_us_min(&texn->env->ima->id);
 	}
-	if(texn->pd) texn->pd= BKE_copy_pointdensity(texn->pd);
-	if(texn->vd) {
+	if (texn->pd) texn->pd= BKE_copy_pointdensity(texn->pd);
+	if (texn->vd) {
 		texn->vd= MEM_dupallocN(texn->vd);
-		if(texn->vd->dataset)
+		if (texn->vd->dataset)
 			texn->vd->dataset= MEM_dupallocN(texn->vd->dataset);
 	}
-	if(texn->ot) {
+	if (texn->ot) {
 		texn->ot= BKE_copy_oceantex(tex->ot);
 	}
 	
 	texn->preview = NULL;
 	
-	if(tex->nodetree) {
+	if (tex->nodetree) {
 		texn->nodetree= ntreeLocalize(tex->nodetree);
 	}
 	
@@ -911,72 +912,72 @@ void make_local_texture(Tex *tex)
 	int a, is_local= FALSE, is_lib= FALSE;
 
 	/* - only lib users: do nothing
-		* - only local users: set flag
-		* - mixed: make copy
-		*/
+	 * - only local users: set flag
+	 * - mixed: make copy
+	 */
 	
-	if(tex->id.lib==NULL) return;
+	if (tex->id.lib==NULL) return;
 
-	if(tex->id.us==1) {
+	if (tex->id.us==1) {
 		id_clear_lib_data(bmain, &tex->id);
 		extern_local_texture(tex);
 		return;
 	}
 	
 	ma= bmain->mat.first;
-	while(ma) {
-		for(a=0; a<MAX_MTEX; a++) {
-			if(ma->mtex[a] && ma->mtex[a]->tex==tex) {
-				if(ma->id.lib) is_lib= TRUE;
+	while (ma) {
+		for (a=0; a<MAX_MTEX; a++) {
+			if (ma->mtex[a] && ma->mtex[a]->tex==tex) {
+				if (ma->id.lib) is_lib= TRUE;
 				else is_local= TRUE;
 			}
 		}
 		ma= ma->id.next;
 	}
 	la= bmain->lamp.first;
-	while(la) {
-		for(a=0; a<MAX_MTEX; a++) {
-			if(la->mtex[a] && la->mtex[a]->tex==tex) {
-				if(la->id.lib) is_lib= TRUE;
+	while (la) {
+		for (a=0; a<MAX_MTEX; a++) {
+			if (la->mtex[a] && la->mtex[a]->tex==tex) {
+				if (la->id.lib) is_lib= TRUE;
 				else is_local= TRUE;
 			}
 		}
 		la= la->id.next;
 	}
 	wrld= bmain->world.first;
-	while(wrld) {
-		for(a=0; a<MAX_MTEX; a++) {
-			if(wrld->mtex[a] && wrld->mtex[a]->tex==tex) {
-				if(wrld->id.lib) is_lib= TRUE;
+	while (wrld) {
+		for (a=0; a<MAX_MTEX; a++) {
+			if (wrld->mtex[a] && wrld->mtex[a]->tex==tex) {
+				if (wrld->id.lib) is_lib= TRUE;
 				else is_local= TRUE;
 			}
 		}
 		wrld= wrld->id.next;
 	}
 	br= bmain->brush.first;
-	while(br) {
-		if(br->mtex.tex==tex) {
-			if(br->id.lib) is_lib= TRUE;
+	while (br) {
+		if (br->mtex.tex==tex) {
+			if (br->id.lib) is_lib= TRUE;
 			else is_local= TRUE;
 		}
 		br= br->id.next;
 	}
 	pa= bmain->particle.first;
-	while(pa) {
-		for(a=0; a<MAX_MTEX; a++) {
-			if(pa->mtex[a] && pa->mtex[a]->tex==tex) {
-				if(pa->id.lib) is_lib= TRUE;
+	while (pa) {
+		for (a=0; a<MAX_MTEX; a++) {
+			if (pa->mtex[a] && pa->mtex[a]->tex==tex) {
+				if (pa->id.lib) is_lib= TRUE;
 				else is_local= TRUE;
 			}
 		}
 		pa= pa->id.next;
 	}
 	
-	if(is_local && is_lib == FALSE) {
+	if (is_local && is_lib == FALSE) {
 		id_clear_lib_data(bmain, &tex->id);
 		extern_local_texture(tex);
 	}
-	else if(is_local && is_lib) {
+	else if (is_local && is_lib) {
 		Tex *tex_new= copy_texture(tex);
 
 		tex_new->id.us= 0;
@@ -985,10 +986,10 @@ void make_local_texture(Tex *tex)
 		BKE_id_lib_local_paths(bmain, tex->id.lib, &tex_new->id);
 		
 		ma= bmain->mat.first;
-		while(ma) {
-			for(a=0; a<MAX_MTEX; a++) {
-				if(ma->mtex[a] && ma->mtex[a]->tex==tex) {
-					if(ma->id.lib==NULL) {
+		while (ma) {
+			for (a=0; a<MAX_MTEX; a++) {
+				if (ma->mtex[a] && ma->mtex[a]->tex==tex) {
+					if (ma->id.lib==NULL) {
 						ma->mtex[a]->tex= tex_new;
 						tex_new->id.us++;
 						tex->id.us--;
@@ -998,10 +999,10 @@ void make_local_texture(Tex *tex)
 			ma= ma->id.next;
 		}
 		la= bmain->lamp.first;
-		while(la) {
-			for(a=0; a<MAX_MTEX; a++) {
-				if(la->mtex[a] && la->mtex[a]->tex==tex) {
-					if(la->id.lib==NULL) {
+		while (la) {
+			for (a=0; a<MAX_MTEX; a++) {
+				if (la->mtex[a] && la->mtex[a]->tex==tex) {
+					if (la->id.lib==NULL) {
 						la->mtex[a]->tex= tex_new;
 						tex_new->id.us++;
 						tex->id.us--;
@@ -1011,10 +1012,10 @@ void make_local_texture(Tex *tex)
 			la= la->id.next;
 		}
 		wrld= bmain->world.first;
-		while(wrld) {
-			for(a=0; a<MAX_MTEX; a++) {
-				if(wrld->mtex[a] && wrld->mtex[a]->tex==tex) {
-					if(wrld->id.lib==NULL) {
+		while (wrld) {
+			for (a=0; a<MAX_MTEX; a++) {
+				if (wrld->mtex[a] && wrld->mtex[a]->tex==tex) {
+					if (wrld->id.lib==NULL) {
 						wrld->mtex[a]->tex= tex_new;
 						tex_new->id.us++;
 						tex->id.us--;
@@ -1024,9 +1025,9 @@ void make_local_texture(Tex *tex)
 			wrld= wrld->id.next;
 		}
 		br= bmain->brush.first;
-		while(br) {
-			if(br->mtex.tex==tex) {
-				if(br->id.lib==NULL) {
+		while (br) {
+			if (br->mtex.tex==tex) {
+				if (br->id.lib==NULL) {
 					br->mtex.tex= tex_new;
 					tex_new->id.us++;
 					tex->id.us--;
@@ -1035,10 +1036,10 @@ void make_local_texture(Tex *tex)
 			br= br->id.next;
 		}
 		pa= bmain->particle.first;
-		while(pa) {
-			for(a=0; a<MAX_MTEX; a++) {
-				if(pa->mtex[a] && pa->mtex[a]->tex==tex) {
-					if(pa->id.lib==NULL) {
+		while (pa) {
+			for (a=0; a<MAX_MTEX; a++) {
+				if (pa->mtex[a] && pa->mtex[a]->tex==tex) {
+					if (pa->id.lib==NULL) {
 						pa->mtex[a]->tex= tex_new;
 						tex_new->id.us++;
 						tex->id.us--;
@@ -1051,7 +1052,7 @@ void make_local_texture(Tex *tex)
 }
 
 /* ------------------------------------------------------------------------- */
-
+#if 0 /* UNUSED */
 void autotexname(Tex *tex)
 {
 	Main *bmain= G.main;
@@ -1061,14 +1062,14 @@ void autotexname(Tex *tex)
 	Image *ima;
 	char di[FILE_MAXDIR], fi[FILE_MAXFILE];
 	
-	if(tex) {
-		if(tex->use_nodes) {
+	if (tex) {
+		if (tex->use_nodes) {
 			new_id(&bmain->tex, (ID *)tex, "Noddy");
 		}
 		else
-		if(tex->type==TEX_IMAGE) {
+		if (tex->type==TEX_IMAGE) {
 			ima= tex->ima;
-			if(ima) {
+			if (ima) {
 				BLI_strncpy(di, ima->name, sizeof(di));
 				BLI_splitdirstring(di, fi);
 				strcpy(di, "I.");
@@ -1077,10 +1078,11 @@ void autotexname(Tex *tex)
 			}
 			else new_id(&bmain->tex, (ID *)tex, texstr[tex->type]);
 		}
-		else if(tex->type==TEX_PLUGIN && tex->plugin) new_id(&bmain->tex, (ID *)tex, tex->plugin->pname);
+		else if (tex->type==TEX_PLUGIN && tex->plugin) new_id(&bmain->tex, (ID *)tex, tex->plugin->pname);
 		else new_id(&bmain->tex, (ID *)tex, texstr[tex->type]);
 	}
 }
+#endif
 
 /* ------------------------------------------------------------------------- */
 
@@ -1089,15 +1091,16 @@ Tex *give_current_object_texture(Object *ob)
 	Material *ma, *node_ma;
 	Tex *tex= NULL;
 	
-	if(ob==NULL) return NULL;
-	if(ob->totcol==0 && !(ob->type==OB_LAMP)) return NULL;
+	if (ob==NULL) return NULL;
+	if (ob->totcol==0 && !(ob->type==OB_LAMP)) return NULL;
 	
-	if(ob->type==OB_LAMP) {
+	if (ob->type==OB_LAMP) {
 		tex= give_current_lamp_texture(ob->data);
-	} else {
+	}
+	else {
 		ma= give_current_material(ob, ob->actcol);
 
-		if((node_ma=give_node_material(ma)))
+		if ((node_ma=give_node_material(ma)))
 			ma= node_ma;
 
 		tex= give_current_material_texture(ma);
@@ -1111,9 +1114,9 @@ Tex *give_current_lamp_texture(Lamp *la)
 	MTex *mtex= NULL;
 	Tex *tex= NULL;
 
-	if(la) {
+	if (la) {
 		mtex= la->mtex[(int)(la->texact)];
-		if(mtex) tex= mtex->tex;
+		if (mtex) tex= mtex->tex;
 	}
 
 	return tex;
@@ -1123,11 +1126,11 @@ void set_current_lamp_texture(Lamp *la, Tex *newtex)
 {
 	int act= la->texact;
 
-	if(la->mtex[act] && la->mtex[act]->tex)
+	if (la->mtex[act] && la->mtex[act]->tex)
 		id_us_min(&la->mtex[act]->tex->id);
 
-	if(newtex) {
-		if(!la->mtex[act]) {
+	if (newtex) {
+		if (!la->mtex[act]) {
 			la->mtex[act]= add_mtex();
 			la->mtex[act]->texco= TEXCO_GLOB;
 		}
@@ -1135,7 +1138,7 @@ void set_current_lamp_texture(Lamp *la, Tex *newtex)
 		la->mtex[act]->tex= newtex;
 		id_us_plus(&newtex->id);
 	}
-	else if(la->mtex[act]) {
+	else if (la->mtex[act]) {
 		MEM_freeN(la->mtex[act]);
 		la->mtex[act]= NULL;
 	}
@@ -1143,7 +1146,7 @@ void set_current_lamp_texture(Lamp *la, Tex *newtex)
 
 bNode *give_current_material_texture_node(Material *ma)
 {
-	if(ma && ma->use_nodes && ma->nodetree)
+	if (ma && ma->use_nodes && ma->nodetree)
 		return nodeGetActiveID(ma->nodetree, ID_TE);
 	
 	return NULL;
@@ -1155,21 +1158,21 @@ Tex *give_current_material_texture(Material *ma)
 	Tex *tex= NULL;
 	bNode *node;
 	
-	if(ma && ma->use_nodes && ma->nodetree) {
+	if (ma && ma->use_nodes && ma->nodetree) {
 		/* first check texture, then material, this works together
-		   with a hack that clears the active ID flag for textures on
-		   making a material node active */
+		 * with a hack that clears the active ID flag for textures on
+		 * making a material node active */
 		node= nodeGetActiveID(ma->nodetree, ID_TE);
 
-		if(node) {
+		if (node) {
 			tex= (Tex *)node->id;
 			ma= NULL;
 		}
 	}
 
-	if(ma) {
+	if (ma) {
 		mtex= ma->mtex[(int)(ma->texact)];
-		if(mtex) tex= mtex->tex;
+		if (mtex) tex= mtex->tex;
 	}
 	
 	return tex;
@@ -1180,23 +1183,23 @@ int give_active_mtex(ID *id, MTex ***mtex_ar, short *act)
 	switch(GS(id->name)) {
 	case ID_MA:
 		*mtex_ar=		((Material *)id)->mtex;
-		if(act) *act=	(((Material *)id)->texact);
+		if (act) *act=	(((Material *)id)->texact);
 		break;
 	case ID_WO:
 		*mtex_ar=		((World *)id)->mtex;
-		if(act) *act=	(((World *)id)->texact);
+		if (act) *act=	(((World *)id)->texact);
 		break;
 	case ID_LA:
 		*mtex_ar=		((Lamp *)id)->mtex;
-		if(act) *act=	(((Lamp *)id)->texact);
+		if (act) *act=	(((Lamp *)id)->texact);
 		break;
 	case ID_PA:
 		*mtex_ar=		((ParticleSettings *)id)->mtex;
-		if(act) *act=	(((ParticleSettings *)id)->texact);
+		if (act) *act=	(((ParticleSettings *)id)->texact);
 		break;
 	default:
 		*mtex_ar = NULL;
-		if(act) *act=	0;
+		if (act) *act=	0;
 		return FALSE;
 	}
 
@@ -1205,8 +1208,8 @@ int give_active_mtex(ID *id, MTex ***mtex_ar, short *act)
 
 void set_active_mtex(ID *id, short act)
 {
-	if(act<0)				act= 0;
-	else if(act>=MAX_MTEX)	act= MAX_MTEX-1;
+	if (act<0)				act= 0;
+	else if (act>=MAX_MTEX)	act= MAX_MTEX-1;
 
 	switch(GS(id->name)) {
 	case ID_MA:
@@ -1229,10 +1232,10 @@ void set_current_material_texture(Material *ma, Tex *newtex)
 	Tex *tex= NULL;
 	bNode *node;
 	
-	if(ma && ma->use_nodes && ma->nodetree) {
+	if (ma && ma->use_nodes && ma->nodetree) {
 		node= nodeGetActiveID(ma->nodetree, ID_TE);
 
-		if(node) {
+		if (node) {
 			tex= (Tex *)node->id;
 			id_us_min(&tex->id);
 			node->id= &newtex->id;
@@ -1240,20 +1243,20 @@ void set_current_material_texture(Material *ma, Tex *newtex)
 			ma= NULL;
 		}
 	}
-	if(ma) {
+	if (ma) {
 		int act= (int)ma->texact;
 
 		tex= (ma->mtex[act])? ma->mtex[act]->tex: NULL;
 		id_us_min(&tex->id);
 
-		if(newtex) {
-			if(!ma->mtex[act])
+		if (newtex) {
+			if (!ma->mtex[act])
 				ma->mtex[act]= add_mtex();
 			
 			ma->mtex[act]->tex= newtex;
 			id_us_plus(&newtex->id);
 		}
-		else if(ma->mtex[act]) {
+		else if (ma->mtex[act]) {
 			MEM_freeN(ma->mtex[act]);
 			ma->mtex[act]= NULL;
 		}
@@ -1264,10 +1267,10 @@ int has_current_material_texture(Material *ma)
 {
 	bNode *node;
 
-	if(ma && ma->use_nodes && ma->nodetree) {
+	if (ma && ma->use_nodes && ma->nodetree) {
 		node= nodeGetActiveID(ma->nodetree, ID_TE);
 
-		if(node)
+		if (node)
 			return 1;
 	}
 
@@ -1279,10 +1282,10 @@ Tex *give_current_world_texture(World *world)
 	MTex *mtex= NULL;
 	Tex *tex= NULL;
 	
-	if(!world) return NULL;
+	if (!world) return NULL;
 	
 	mtex= world->mtex[(int)(world->texact)];
-	if(mtex) tex= mtex->tex;
+	if (mtex) tex= mtex->tex;
 	
 	return tex;
 }
@@ -1291,11 +1294,11 @@ void set_current_world_texture(World *wo, Tex *newtex)
 {
 	int act= wo->texact;
 
-	if(wo->mtex[act] && wo->mtex[act]->tex)
+	if (wo->mtex[act] && wo->mtex[act]->tex)
 		id_us_min(&wo->mtex[act]->tex->id);
 
-	if(newtex) {
-		if(!wo->mtex[act]) {
+	if (newtex) {
+		if (!wo->mtex[act]) {
 			wo->mtex[act]= add_mtex();
 			wo->mtex[act]->texco= TEXCO_VIEW;
 		}
@@ -1303,7 +1306,7 @@ void set_current_world_texture(World *wo, Tex *newtex)
 		wo->mtex[act]->tex= newtex;
 		id_us_plus(&newtex->id);
 	}
-	else if(wo->mtex[act]) {
+	else if (wo->mtex[act]) {
 		MEM_freeN(wo->mtex[act]);
 		wo->mtex[act]= NULL;
 	}
@@ -1316,10 +1319,10 @@ Tex *give_current_brush_texture(Brush *br)
 
 void set_current_brush_texture(Brush *br, Tex *newtex)
 {
-	if(br->mtex.tex)
+	if (br->mtex.tex)
 		id_us_min(&br->mtex.tex->id);
 
-	if(newtex) {
+	if (newtex) {
 		br->mtex.tex= newtex;
 		id_us_plus(&newtex->id);
 	}
@@ -1330,10 +1333,10 @@ Tex *give_current_particle_texture(ParticleSettings *part)
 	MTex *mtex= NULL;
 	Tex *tex= NULL;
 	
-	if(!part) return NULL;
+	if (!part) return NULL;
 	
 	mtex= part->mtex[(int)(part->texact)];
-	if(mtex) tex= mtex->tex;
+	if (mtex) tex= mtex->tex;
 	
 	return tex;
 }
@@ -1342,11 +1345,11 @@ void set_current_particle_texture(ParticleSettings *part, Tex *newtex)
 {
 	int act= part->texact;
 
-	if(part->mtex[act] && part->mtex[act]->tex)
+	if (part->mtex[act] && part->mtex[act]->tex)
 		id_us_min(&part->mtex[act]->tex->id);
 
-	if(newtex) {
-		if(!part->mtex[act]) {
+	if (newtex) {
+		if (!part->mtex[act]) {
 			part->mtex[act]= add_mtex();
 			part->mtex[act]->texco= TEXCO_ORCO;
 			part->mtex[act]->blendtype= MTEX_MUL;
@@ -1355,7 +1358,7 @@ void set_current_particle_texture(ParticleSettings *part, Tex *newtex)
 		part->mtex[act]->tex= newtex;
 		id_us_plus(&newtex->id);
 	}
-	else if(part->mtex[act]) {
+	else if (part->mtex[act]) {
 		MEM_freeN(part->mtex[act]);
 		part->mtex[act]= NULL;
 	}
@@ -1387,8 +1390,8 @@ EnvMap *BKE_copy_envmap(EnvMap *env)
 	
 	envn= MEM_dupallocN(env);
 	envn->ok= 0;
-	for(a=0; a<6; a++) envn->cube[a]= NULL;
-	if(envn->ima) id_us_plus((ID *)envn->ima);
+	for (a=0; a<6; a++) envn->cube[a]= NULL;
+	if (envn->ima) id_us_plus((ID *)envn->ima);
 	
 	return envn;
 }
@@ -1399,8 +1402,8 @@ void BKE_free_envmapdata(EnvMap *env)
 {
 	unsigned int part;
 	
-	for(part=0; part<6; part++) {
-		if(env->cube[part])
+	for (part=0; part<6; part++) {
+		if (env->cube[part])
 			IMB_freeImBuf(env->cube[part]);
 		env->cube[part]= NULL;
 	}
@@ -1458,7 +1461,7 @@ PointDensity *BKE_copy_pointdensity(PointDensity *pd)
 	pdn= MEM_dupallocN(pd);
 	pdn->point_tree = NULL;
 	pdn->point_data = NULL;
-	if(pdn->coba) pdn->coba= MEM_dupallocN(pdn->coba);
+	if (pdn->coba) pdn->coba= MEM_dupallocN(pdn->coba);
 	pdn->falloff_curve = curvemapping_copy(pdn->falloff_curve); /* can be NULL */
 	return pdn;
 }
@@ -1473,7 +1476,7 @@ void BKE_free_pointdensitydata(PointDensity *pd)
 		MEM_freeN(pd->point_data);
 		pd->point_data = NULL;
 	}
-	if(pd->coba) {
+	if (pd->coba) {
 		MEM_freeN(pd->coba);
 		pd->coba = NULL;
 	}
@@ -1561,19 +1564,19 @@ void BKE_free_oceantex(struct OceanTex *ot)
 /* ------------------------------------------------------------------------- */
 int BKE_texture_dependsOnTime(const struct Tex *texture)
 {
-	if(texture->plugin) {
+	if (texture->plugin) {
 		// assume all plugins depend on time
 		return 1;
 	} 
-	else if(	texture->ima && 
+	else if (	texture->ima && 
 			ELEM(texture->ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) {
 		return 1;
 	}
-	else if(texture->adt) {
+	else if (texture->adt) {
 		// assume anything in adt means the texture is animated
 		return 1;
 	}
-	else if(texture->type == TEX_NOISE) {
+	else if (texture->type == TEX_NOISE) {
 		// noise always varies with time
 		return 1;
 	}
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 695ea1d..7654c36 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -55,7 +55,6 @@
 #include "BKE_movieclip.h"
 #include "BKE_object.h"
 #include "BKE_scene.h"
-#include "BKE_main.h"	// XXX: ...
 
 #include "IMB_imbuf_types.h"
 #include "IMB_imbuf.h"
@@ -78,24 +77,24 @@ static struct {
 
 void BKE_tracking_init_settings(MovieTracking *tracking)
 {
-	tracking->camera.sensor_width= 35.0f;
-	tracking->camera.pixel_aspect= 1.0f;
-	tracking->camera.units= CAMERA_UNITS_MM;
-
-	tracking->settings.default_tracker= TRACKER_HYBRID;
-	tracking->settings.default_minimum_correlation= 0.75;
-	tracking->settings.default_pattern_size= 11;
-	tracking->settings.default_search_size= 51;
-	tracking->settings.default_pyramid_levels= 2;
-	tracking->settings.keyframe1= 1;
-	tracking->settings.keyframe2= 30;
-	tracking->settings.dist= 1;
-	tracking->settings.object_distance= 1;
-
-	tracking->stabilization.scaleinf= 1.0f;
-	tracking->stabilization.locinf= 1.0f;
-	tracking->stabilization.rotinf= 1.0f;
-	tracking->stabilization.maxscale= 2.0f;
+	tracking->camera.sensor_width = 35.0f;
+	tracking->camera.pixel_aspect = 1.0f;
+	tracking->camera.units = CAMERA_UNITS_MM;
+
+	tracking->settings.default_tracker = TRACKER_HYBRID;
+	tracking->settings.default_minimum_correlation = 0.75;
+	tracking->settings.default_pattern_size = 11;
+	tracking->settings.default_search_size = 61;
+	tracking->settings.default_pyramid_levels = 2;
+	tracking->settings.keyframe1 = 1;
+	tracking->settings.keyframe2 = 30;
+	tracking->settings.dist = 1;
+	tracking->settings.object_distance = 1;
+
+	tracking->stabilization.scaleinf = 1.0f;
+	tracking->stabilization.locinf = 1.0f;
+	tracking->stabilization.rotinf = 1.0f;
+	tracking->stabilization.maxscale = 2.0f;
 
 	BKE_tracking_new_object(tracking, "Camera");
 }
@@ -112,142 +111,152 @@ void BKE_tracking_clamp_track(MovieTrackingTrack *track, int event)
 	}
 
 	/* sort */
-	for(a= 0; a<2; a++) {
-		if(track->pat_min[a]>track->pat_max[a])
+	for (a = 0; a < 2; a++) {
+		if (track->pat_min[a] > track->pat_max[a])
 			SWAP(float, track->pat_min[a], track->pat_max[a]);
 
-		if(track->search_min[a]>track->search_max[a])
+		if (track->search_min[a] > track->search_max[a])
 			SWAP(float, track->search_min[a], track->search_max[a]);
 	}
 
 	/* compute the effective pattern size, which differs from the fine resolution
 	 * pattern size for the pyramid KLT tracker */
-	for(a= 0; a<2; a++) {
+	for (a = 0; a < 2; a++) {
 		pat_min[a] = max_pyramid_level_factor * track->pat_min[a];
 		pat_max[a] = max_pyramid_level_factor * track->pat_max[a];
 	}
 
-	if(event==CLAMP_PAT_DIM) {
-		for(a= 0; a<2; a++) {
+	if (event == CLAMP_PAT_DIM) {
+		for (a = 0; a < 2; a++) {
 			/* search shouldn't be resized smaller than pattern */
-			track->search_min[a]= MIN2(pat_min[a], track->search_min[a]);
-			track->search_max[a]= MAX2(pat_max[a], track->search_max[a]);
+			track->search_min[a] = MIN2(pat_min[a], track->search_min[a]);
+			track->search_max[a] = MAX2(pat_max[a], track->search_max[a]);
 		}
 	}
-	else if(event==CLAMP_PAT_POS) {
+	else if (event == CLAMP_PAT_POS) {
 		float dim[2];
+
 		sub_v2_v2v2(dim, track->pat_max, track->pat_min);
 
-		for(a= 0; a<2; a++) {
+		for (a = 0; a < 2; a++) {
 			/* pattern shouldn't be moved outside of search */
-			if(pat_min[a] < track->search_min[a]) {
-				track->pat_min[a]= track->search_min[a] - (pat_min[a] - track->pat_min[a]);
-				track->pat_max[a]= track->pat_min[a] + dim[a];
+			if (pat_min[a] < track->search_min[a]) {
+				track->pat_min[a] = track->search_min[a] - (pat_min[a] - track->pat_min[a]);
+				track->pat_max[a] = track->pat_min[a] + dim[a];
 			}
-			if(track->pat_max[a] > track->search_max[a]) {
-				track->pat_max[a]= track->search_max[a] - (pat_max[a] - track->pat_max[a]);
-				track->pat_min[a]= track->pat_max[a] - dim[a];
+			if (track->pat_max[a] > track->search_max[a]) {
+				track->pat_max[a] = track->search_max[a] - (pat_max[a] - track->pat_max[a]);
+				track->pat_min[a] = track->pat_max[a] - dim[a];
 			}
 		}
 	}
-	else if(event==CLAMP_SEARCH_DIM) {
-		for(a= 0; a<2; a++) {
+	else if (event == CLAMP_SEARCH_DIM) {
+		for (a = 0; a < 2; a++) {
 			/* search shouldn't be resized smaller than pattern */
-			track->search_min[a]= MIN2(pat_min[a], track->search_min[a]);
-			track->search_max[a]= MAX2(pat_max[a], track->search_max[a]);
+			track->search_min[a] = MIN2(pat_min[a], track->search_min[a]);
+			track->search_max[a] = MAX2(pat_max[a], track->search_max[a]);
 		}
 	}
-	else if(event==CLAMP_SEARCH_POS) {
+	else if (event == CLAMP_SEARCH_POS) {
 		float dim[2];
+
 		sub_v2_v2v2(dim, track->search_max, track->search_min);
 
-		for(a= 0; a<2; a++) {
+		for (a = 0; a < 2; a++) {
 			/* search shouldn't be moved inside pattern */
-			if(track->search_min[a] > pat_min[a]) {
-				track->search_min[a]= pat_min[a];
-				track->search_max[a]= track->search_min[a]+dim[a];
+			if (track->search_min[a] > pat_min[a]) {
+				track->search_min[a] = pat_min[a];
+				track->search_max[a] = track->search_min[a]+dim[a];
 			}
-			if(track->search_max[a] < pat_max[a]) {
-				track->search_max[a]= pat_max[a];
-				track->search_min[a]= track->search_max[a]-dim[a];
+			if (track->search_max[a] < pat_max[a]) {
+				track->search_max[a] = pat_max[a];
+				track->search_min[a] = track->search_max[a]-dim[a];
 			}
 		}
 	}
-	else if(event==CLAMP_PYRAMID_LEVELS || (event==CLAMP_SEARCH_DIM && track->tracker == TRACKER_KLT))  {
+	else if (event == CLAMP_PYRAMID_LEVELS || (event == CLAMP_SEARCH_DIM && track->tracker == TRACKER_KLT)) {
 		float dim[2];
 		sub_v2_v2v2(dim, track->pat_max, track->pat_min);
 		{
-			float search_ratio= 2.3f * max_pyramid_level_factor;
+			float search_ratio = 2.3f * max_pyramid_level_factor;
 
 			/* resize the search area to something sensible based
 			 * on the number of pyramid levels */
-			for(a= 0; a<2; a++) {
-				track->search_min[a]= search_ratio * track->pat_min[a];
-				track->search_max[a]= search_ratio * track->pat_max[a];
+			for (a = 0; a < 2; a++) {
+				track->search_min[a] = search_ratio * track->pat_min[a];
+				track->search_max[a] = search_ratio * track->pat_max[a];
 			}
 		}
 	}
 
 	/* marker's center should be in center of pattern */
-	if(event==CLAMP_PAT_DIM || event==CLAMP_PAT_POS) {
+	if (event == CLAMP_PAT_DIM || event == CLAMP_PAT_POS) {
 		float dim[2];
+
 		sub_v2_v2v2(dim, track->pat_max, track->pat_min);
 
-		for(a= 0; a<2; a++) {
-			track->pat_min[a]= -dim[a]/2.0f;
-			track->pat_max[a]= dim[a]/2.0f;
+		for (a = 0; a < 2; a++) {
+			track->pat_min[a] = -dim[a]/2.0f;
+			track->pat_max[a] = dim[a]/2.0f;
 		}
 	}
 }
 
 void BKE_tracking_track_flag(MovieTrackingTrack *track, int area, int flag, int clear)
 {
-	if(area==TRACK_AREA_NONE)
+	if (area == TRACK_AREA_NONE)
 		return;
 
-	if(clear) {
-		if(area&TRACK_AREA_POINT)	track->flag&= ~flag;
-		if(area&TRACK_AREA_PAT)		track->pat_flag&= ~flag;
-		if(area&TRACK_AREA_SEARCH)	track->search_flag&= ~flag;
-	} else {
-		if(area&TRACK_AREA_POINT)	track->flag|= flag;
-		if(area&TRACK_AREA_PAT)		track->pat_flag|= flag;
-		if(area&TRACK_AREA_SEARCH)	track->search_flag|= flag;
+	if (clear) {
+		if (area & TRACK_AREA_POINT)
+			track->flag &= ~flag;
+		if (area & TRACK_AREA_PAT)
+			track->pat_flag &= ~flag;
+		if (area & TRACK_AREA_SEARCH)
+			track->search_flag &= ~flag;
+	}
+	else {
+		if (area & TRACK_AREA_POINT)
+			track->flag |= flag;
+		if (area & TRACK_AREA_PAT)
+			track->pat_flag |= flag;
+		if (area & TRACK_AREA_SEARCH)
+			track->search_flag |= flag;
 	}
 }
 
 MovieTrackingTrack *BKE_tracking_add_track(MovieTracking *tracking, ListBase *tracksbase, float x, float y,
-			int framenr, int width, int height)
+                                           int framenr, int width, int height)
 {
 	MovieTrackingTrack *track;
 	MovieTrackingMarker marker;
-	MovieTrackingSettings *settings= &tracking->settings;
+	MovieTrackingSettings *settings = &tracking->settings;
 
-	float half_pattern= (float)settings->default_pattern_size/2.0f;
-	float half_search= (float)settings->default_search_size/2.0f;
+	float half_pattern = (float)settings->default_pattern_size / 2.0f;
+	float half_search = (float)settings->default_search_size / 2.0f;
 	float pat[2], search[2];
 
-	pat[0]= half_pattern/(float)width;
-	pat[1]= half_pattern/(float)height;
+	pat[0] = half_pattern / (float)width;
+	pat[1] = half_pattern / (float)height;
 
-	search[0]= half_search/(float)width;
-	search[1]= half_search/(float)height;
+	search[0] = half_search / (float)width;
+	search[1] = half_search / (float)height;
 
-	track= MEM_callocN(sizeof(MovieTrackingTrack), "add_marker_exec track");
+	track = MEM_callocN(sizeof(MovieTrackingTrack), "add_marker_exec track");
 	strcpy(track->name, "Track");
 
-	track->tracker= settings->default_tracker;
-	track->pyramid_levels= settings->default_pyramid_levels;
-	track->minimum_correlation= settings->default_minimum_correlation;
-	track->margin= settings->default_margin;
-	track->pattern_match= settings->default_pattern_match;
-	track->frames_limit= settings->default_frames_limit;
-	track->flag= settings->default_flag;
+	track->tracker = settings->default_tracker;
+	track->pyramid_levels = settings->default_pyramid_levels;
+	track->minimum_correlation = settings->default_minimum_correlation;
+	track->margin = settings->default_margin;
+	track->pattern_match = settings->default_pattern_match;
+	track->frames_limit = settings->default_frames_limit;
+	track->flag = settings->default_flag;
 
 	memset(&marker, 0, sizeof(marker));
-	marker.pos[0]= x;
-	marker.pos[1]= y;
-	marker.framenr= framenr;
+	marker.pos[0] = x;
+	marker.pos[1] = y;
+	marker.framenr = framenr;
 
 	copy_v2_v2(track->pat_max, pat);
 	negate_v2_v2(track->pat_min, pat);
@@ -257,7 +266,7 @@ MovieTrackingTrack *BKE_tracking_add_track(MovieTracking *tracking, ListBase *tr
 
 	BKE_tracking_insert_marker(track, &marker);
 
-	if(track->tracker == TRACKER_KLT)
+	if (track->tracker == TRACKER_KLT)
 		BKE_tracking_clamp_track(track, CLAMP_PYRAMID_LEVELS);
 
 	BLI_addtail(tracksbase, track);
@@ -270,32 +279,35 @@ MovieTrackingMarker *BKE_tracking_insert_marker(MovieTrackingTrack *track, Movie
 {
 	MovieTrackingMarker *old_marker= NULL;
 
-	if(track->markersnr)
-		old_marker= BKE_tracking_exact_marker(track, marker->framenr);
+	if (track->markersnr)
+		old_marker = BKE_tracking_exact_marker(track, marker->framenr);
 
-	if(old_marker) {
-		*old_marker= *marker;
+	if (old_marker) {
+		*old_marker = *marker;
 
 		return old_marker;
-	} else {
-		int a= track->markersnr;
+	}
+	else {
+		int a = track->markersnr;
 
-		while(a--) {
-			if(track->markers[a].framenr<marker->framenr)
+		while (a--) {
+			if (track->markers[a].framenr < marker->framenr)
 				break;
 		}
 
 		track->markersnr++;
 
-		if(track->markers) track->markers= MEM_reallocN(track->markers, sizeof(MovieTrackingMarker)*track->markersnr);
-		else track->markers= MEM_callocN(sizeof(MovieTrackingMarker), "MovieTracking markers");
+		if (track->markers)
+			track->markers = MEM_reallocN(track->markers, sizeof(MovieTrackingMarker)*track->markersnr);
+		else
+			track->markers = MEM_callocN(sizeof(MovieTrackingMarker), "MovieTracking markers");
 
 		memmove(track->markers+a+2, track->markers+a+1, (track->markersnr-a-2)*sizeof(MovieTrackingMarker));
-		track->markers[a+1]= *marker;
+		track->markers[a+1] = *marker;
 
-		track->last_marker= a+1;
+		track->last_marker = a + 1;
 
-		return &track->markers[a+1];
+		return &track->markers[a + 1];
 	}
 }
 
@@ -303,16 +315,17 @@ void BKE_tracking_delete_marker(MovieTrackingTrack *track, int framenr)
 {
 	int a= 0;
 
-	while(a<track->markersnr) {
-		if(track->markers[a].framenr==framenr) {
-			if(track->markersnr>1) {
+	while (a<track->markersnr) {
+		if (track->markers[a].framenr == framenr) {
+			if (track->markersnr > 1) {
 				memmove(track->markers+a, track->markers+a+1, (track->markersnr-a-1)*sizeof(MovieTrackingMarker));
 				track->markersnr--;
-				track->markers= MEM_reallocN(track->markers, sizeof(MovieTrackingMarker)*track->markersnr);
-			} else {
+				track->markers = MEM_reallocN(track->markers, sizeof(MovieTrackingMarker)*track->markersnr);
+			}
+			else {
 				MEM_freeN(track->markers);
-				track->markers= NULL;
-				track->markersnr= 0;
+				track->markers = NULL;
+				track->markersnr = 0;
 			}
 
 			break;
@@ -324,22 +337,23 @@ void BKE_tracking_delete_marker(MovieTrackingTrack *track, int framenr)
 
 MovieTrackingMarker *BKE_tracking_get_marker(MovieTrackingTrack *track, int framenr)
 {
-	int a= track->markersnr-1;
+	int a = track->markersnr-1;
 
-	if(!track->markersnr)
+	if (!track->markersnr)
 		return NULL;
 
 	/* approximate pre-first framenr marker with first marker */
-	if(framenr<track->markers[0].framenr)
+	if (framenr < track->markers[0].framenr)
 		return &track->markers[0];
 
-	if(track->last_marker<track->markersnr)
-		a= track->last_marker;
+	if (track->last_marker < track->markersnr)
+		a = track->last_marker;
+
+	if (track->markers[a].framenr <= framenr) {
+		while (a < track->markersnr && track->markers[a].framenr <= framenr) {
+			if (track->markers[a].framenr == framenr) {
+				track->last_marker = a;
 
-	if(track->markers[a].framenr<=framenr) {
-		while(a<track->markersnr && track->markers[a].framenr<=framenr) {
-			if(track->markers[a].framenr==framenr) {
-				track->last_marker= a;
 				return &track->markers[a];
 			}
 			a++;
@@ -347,10 +361,12 @@ MovieTrackingMarker *BKE_tracking_get_marker(MovieTrackingTrack *track, int fram
 
 		/* if there's no marker for exact position, use nearest marker from left side */
 		return &track->markers[a-1];
-	} else {
-		while(a>=0 && track->markers[a].framenr>=framenr) {
-			if(track->markers[a].framenr==framenr) {
-				track->last_marker= a;
+	}
+	else {
+		while (a >= 0 && track->markers[a].framenr >= framenr) {
+			if (track->markers[a].framenr == framenr) {
+				track->last_marker = a;
+
 				return &track->markers[a];
 			}
 
@@ -366,16 +382,16 @@ MovieTrackingMarker *BKE_tracking_get_marker(MovieTrackingTrack *track, int fram
 
 MovieTrackingMarker *BKE_tracking_ensure_marker(MovieTrackingTrack *track, int framenr)
 {
-	MovieTrackingMarker *marker= BKE_tracking_get_marker(track, framenr);
+	MovieTrackingMarker *marker = BKE_tracking_get_marker(track, framenr);
 
-	if(marker->framenr!=framenr) {
+	if (marker->framenr != framenr) {
 		MovieTrackingMarker marker_new;
 
-		marker_new= *marker;
-		marker_new.framenr= framenr;
+		marker_new = *marker;
+		marker_new.framenr = framenr;
 
 		BKE_tracking_insert_marker(track, &marker_new);
-		marker= BKE_tracking_get_marker(track, framenr);
+		marker = BKE_tracking_get_marker(track, framenr);
 	}
 
 	return marker;
@@ -383,9 +399,9 @@ MovieTrackingMarker *BKE_tracking_ensure_marker(MovieTrackingTrack *track, int f
 
 MovieTrackingMarker *BKE_tracking_exact_marker(MovieTrackingTrack *track, int framenr)
 {
-	MovieTrackingMarker *marker= BKE_tracking_get_marker(track, framenr);
+	MovieTrackingMarker *marker = BKE_tracking_get_marker(track, framenr);
 
-	if(marker->framenr!=framenr)
+	if (marker->framenr != framenr)
 		return NULL;
 
 	return marker;
@@ -405,21 +421,24 @@ int BKE_tracking_has_enabled_marker(MovieTrackingTrack *track, int framenr)
 
 void BKE_tracking_free_track(MovieTrackingTrack *track)
 {
-	if(track->markers) MEM_freeN(track->markers);
+	if (track->markers)
+		MEM_freeN(track->markers);
 }
 
 static void put_disabled_marker(MovieTrackingTrack *track, MovieTrackingMarker *ref_marker, int before, int overwrite)
 {
 	MovieTrackingMarker marker_new;
 
-	marker_new= *ref_marker;
-	marker_new.flag&= ~MARKER_TRACKED;
-	marker_new.flag|= MARKER_DISABLED;
+	marker_new = *ref_marker;
+	marker_new.flag &= ~MARKER_TRACKED;
+	marker_new.flag |= MARKER_DISABLED;
 
-	if(before) marker_new.framenr--;
-	else marker_new.framenr++;
+	if (before)
+		marker_new.framenr--;
+	else
+		marker_new.framenr++;
 
-	if(!BKE_tracking_has_marker(track, marker_new.framenr) || overwrite)
+	if (!BKE_tracking_has_marker(track, marker_new.framenr) || overwrite)
 		BKE_tracking_insert_marker(track, &marker_new);
 }
 
@@ -427,12 +446,13 @@ void BKE_tracking_clear_path(MovieTrackingTrack *track, int ref_frame, int actio
 {
 	int a;
 
-	if(action==TRACK_CLEAR_REMAINED) {
-		a= 1;
-		while(a<track->markersnr) {
-			if(track->markers[a].framenr>ref_frame) {
-				track->markersnr= a;
-				track->markers= MEM_reallocN(track->markers, sizeof(MovieTrackingMarker)*track->markersnr);
+	if (action == TRACK_CLEAR_REMAINED) {
+		a = 1;
+
+		while (a < track->markersnr) {
+			if (track->markers[a].framenr > ref_frame) {
+				track->markersnr = a;
+				track->markers = MEM_reallocN(track->markers, sizeof(MovieTrackingMarker)*track->markersnr);
 
 				break;
 			}
@@ -440,16 +460,18 @@ void BKE_tracking_clear_path(MovieTrackingTrack *track, int ref_frame, int actio
 			a++;
 		}
 
-		if(track->markersnr)
+		if (track->markersnr)
 			put_disabled_marker(track, &track->markers[track->markersnr-1], 0, 1);
-	} else if(action==TRACK_CLEAR_UPTO) {
+	}
+	else if (action == TRACK_CLEAR_UPTO) {
 		a= track->markersnr-1;
-		while(a>=0) {
-			if(track->markers[a].framenr<=ref_frame) {
+
+		while (a >= 0) {
+			if (track->markers[a].framenr <= ref_frame) {
 				memmove(track->markers, track->markers+a, (track->markersnr-a)*sizeof(MovieTrackingMarker));
 
-				track->markersnr= track->markersnr-a;
-				track->markers= MEM_reallocN(track->markers, sizeof(MovieTrackingMarker)*track->markersnr);
+				track->markersnr = track->markersnr-a;
+				track->markers = MEM_reallocN(track->markers, sizeof(MovieTrackingMarker)*track->markersnr);
 
 				break;
 			}
@@ -457,17 +479,18 @@ void BKE_tracking_clear_path(MovieTrackingTrack *track, int ref_frame, int actio
 			a--;
 		}
 
-		if(track->markersnr)
+		if (track->markersnr)
 			put_disabled_marker(track, &track->markers[0], 1, 1);
-	} else if(action==TRACK_CLEAR_ALL) {
+	}
+	else if (action == TRACK_CLEAR_ALL) {
 		MovieTrackingMarker *marker, marker_new;
 
-		marker= BKE_tracking_get_marker(track, ref_frame);
-		marker_new= *marker;
+		marker = BKE_tracking_get_marker(track, ref_frame);
+		marker_new = *marker;
 
 		MEM_freeN(track->markers);
-		track->markers= NULL;
-		track->markersnr= 0;
+		track->markers = NULL;
+		track->markersnr = 0;
 
 		BKE_tracking_insert_marker(track, &marker_new);
 
@@ -476,79 +499,111 @@ void BKE_tracking_clear_path(MovieTrackingTrack *track, int ref_frame, int actio
 	}
 }
 
-int BKE_tracking_test_join_tracks(MovieTrackingTrack *dst_track, MovieTrackingTrack *src_track)
+void BKE_tracking_join_tracks(MovieTrackingTrack *dst_track, MovieTrackingTrack *src_track)
 {
-	int a= 0, b= 0;
-	int count= 0;
+	int i = 0, a = 0, b = 0, tot;
+	MovieTrackingMarker *markers;
 
-	while(a<src_track->markersnr || b<dst_track->markersnr) {
-		if(b>=dst_track->markersnr) {
-			a++;
-			count++;
+	tot = dst_track->markersnr + src_track->markersnr;
+	markers = MEM_callocN(tot * sizeof(MovieTrackingMarker), "tmp tracking joined tracks");
+
+	while (a < src_track->markersnr || b < dst_track->markersnr) {
+		if (b >= dst_track->markersnr) {
+			markers[i] = src_track->markers[a++];
 		}
-		else if(a>=src_track->markersnr) {
-			b++;
-			count++;
+		else if (a >= src_track->markersnr) {
+			markers[i] = dst_track->markers[b++];
 		}
-		else if(src_track->markers[a].framenr<dst_track->markers[b].framenr) {
-			a++;
-			count++;
-		} else if(src_track->markers[a].framenr>dst_track->markers[b].framenr) {
-			b++;
-			count++;
-		} else {
-			if((src_track->markers[a].flag&MARKER_DISABLED)==0 && (dst_track->markers[b].flag&MARKER_DISABLED)==0)
-				return 0;
-
-			a++;
-			b++;
-			count++;
+		else if (src_track->markers[a].framenr < dst_track->markers[b].framenr) {
+			markers[i] = src_track->markers[a++];
 		}
-	}
+		else if (src_track->markers[a].framenr > dst_track->markers[b].framenr) {
+			markers[i] = dst_track->markers[b++];
+		}
+		else {
+			if ((src_track->markers[a].flag & MARKER_DISABLED)==0) {
+				if ((dst_track->markers[b].flag & MARKER_DISABLED)==0) {
+					/* both tracks are enabled on this frame, so find the whole segment
+					 * on which tracks are intersecting and blend tracks using linear
+					 * interpolation to prevent jumps */
+
+					MovieTrackingMarker *marker_a, *marker_b;
+					int start_a = a, start_b = b, len = 0, frame = src_track->markers[a].framenr;
+					int j, inverse = 0;
+
+					inverse = (b == 0) ||
+					          (dst_track->markers[b-1].flag & MARKER_DISABLED) ||
+					          (dst_track->markers[b-1].framenr != frame - 1);
+
+					/* find length of intersection */
+					while (a < src_track->markersnr && b < dst_track->markersnr) {
+						marker_a = &src_track->markers[a];
+						marker_b = &dst_track->markers[b];
+
+						if (marker_a->flag & MARKER_DISABLED || marker_b->flag & MARKER_DISABLED)
+							break;
+
+						if (marker_a->framenr != frame || marker_b->framenr != frame)
+							break;
+
+						frame++;
+						len++;
+						a++;
+						b++;
+					}
 
-	return count;
-}
+					a = start_a;
+					b = start_b;
 
-void BKE_tracking_join_tracks(MovieTrackingTrack *dst_track, MovieTrackingTrack *src_track)
-{
-	int i, a= 0, b= 0, tot;
-	MovieTrackingMarker *markers;
+					/* linear interpolation for intersecting frames */
+					for (j = 0; j < len; j++) {
+						float fac = 0.5f;
 
-	tot= BKE_tracking_test_join_tracks(dst_track, src_track);
+						if (len > 1)
+							fac = 1.0f / (len - 1) * j;
 
-	markers= MEM_callocN(tot*sizeof(MovieTrackingMarker), "tracking joined tracks");
+						if (inverse)
+							fac = 1.0f - fac;
 
-	for(i= 0; i<tot; i++) {
-		if(b>=dst_track->markersnr) {
-			markers[i]= src_track->markers[a++];
-		}
-		else if(a>=src_track->markersnr) {
-			markers[i]= dst_track->markers[b++];
-		}
-		else if(src_track->markers[a].framenr<dst_track->markers[b].framenr) {
-			markers[i]= src_track->markers[a++];
-		} else if(src_track->markers[a].framenr>dst_track->markers[b].framenr) {
-			markers[i]= dst_track->markers[b++];
-		} else {
-			if((src_track->markers[a].flag&MARKER_DISABLED)) markers[i]= dst_track->markers[b];
-			else markers[i]= src_track->markers[a++];
+						marker_a = &src_track->markers[a];
+						marker_b = &dst_track->markers[b];
+
+						markers[i] = dst_track->markers[b];
+						interp_v2_v2v2(markers[i].pos, marker_b->pos, marker_a->pos, fac);
+						a++;
+						b++;
+						i++;
+					}
+
+					/* this values will be incremented at the end of the loop cycle */
+					a--; b--; i--;
+				}
+				else markers[i] = src_track->markers[a];
+			}
+			else markers[i] = dst_track->markers[b];
 
 			a++;
 			b++;
 		}
+
+		i++;
 	}
 
 	MEM_freeN(dst_track->markers);
 
-	dst_track->markers= markers;
-	dst_track->markersnr= tot;
+	dst_track->markers = MEM_callocN(i*sizeof(MovieTrackingMarker), "tracking joined tracks");
+	memcpy(dst_track->markers, markers, i*sizeof(MovieTrackingMarker));
+
+	dst_track->markersnr = i;
+
+	MEM_freeN(markers);
 }
 
 static void tracking_tracks_free(ListBase *tracks)
 {
 	MovieTrackingTrack *track;
 
-	for(track= tracks->first; track; track= track->next) {
+	for (track = tracks->first; track; track = track->next) {
 		BKE_tracking_free_track(track);
 	}
 
@@ -557,7 +612,7 @@ static void tracking_tracks_free(ListBase *tracks)
 
 static void tracking_reconstruction_free(MovieTrackingReconstruction *reconstruction)
 {
-	if(reconstruction->cameras)
+	if (reconstruction->cameras)
 		MEM_freeN(reconstruction->cameras);
 }
 
@@ -571,7 +626,7 @@ static void tracking_objects_free(ListBase *objects)
 {
 	MovieTrackingObject *object;
 
-	for(object= objects->first; object; object= object->next)
+	for (object = objects->first; object; object = object->next)
 		tracking_object_free(object);
 
 	BLI_freelistN(objects);
@@ -583,10 +638,10 @@ void BKE_tracking_free(MovieTracking *tracking)
 	tracking_reconstruction_free(&tracking->reconstruction);
 	tracking_objects_free(&tracking->objects);
 
-	if(tracking->stabilization.scaleibuf)
+	if (tracking->stabilization.scaleibuf)
 		IMB_freeImBuf(tracking->stabilization.scaleibuf);
 
-	if(tracking->camera.intrinsics)
+	if (tracking->camera.intrinsics)
 		BKE_tracking_distortion_destroy(tracking->camera.intrinsics);
 }
 
@@ -596,7 +651,7 @@ static MovieTrackingTrack *duplicate_track(MovieTrackingTrack *track)
 
 	new_track = MEM_callocN(sizeof(MovieTrackingTrack), "tracksMapMerge new_track");
 
-	*new_track= *track;
+	*new_track = *track;
 	new_track->next = new_track->prev = NULL;
 
 	new_track->markers = MEM_dupallocN(new_track->markers);
@@ -626,7 +681,7 @@ void BKE_tracking_clipboard_copy_tracks(MovieTracking *tracking, MovieTrackingOb
 	MovieTrackingTrack *track = tracksbase->first;
 
 	while (track) {
-		if (TRACK_SELECTED(track)) {
+		if (TRACK_SELECTED(track) && (track->flag & TRACK_HIDDEN) == 0) {
 			MovieTrackingTrack *new_track = duplicate_track(track);
 
 			BLI_addtail(&tracking_clipboard.tracks, new_track);
@@ -675,20 +730,20 @@ typedef struct TracksMap {
 
 static TracksMap *tracks_map_new(const char *object_name, int is_camera, int num_tracks, int customdata_size)
 {
-	TracksMap *map= MEM_callocN(sizeof(TracksMap), "TrackingsMap");
+	TracksMap *map = MEM_callocN(sizeof(TracksMap), "TrackingsMap");
 
 	BLI_strncpy(map->object_name, object_name, sizeof(map->object_name));
-	map->is_camera= is_camera;
+	map->is_camera = is_camera;
 
-	map->num_tracks= num_tracks;
-	map->customdata_size= customdata_size;
+	map->num_tracks = num_tracks;
+	map->customdata_size = customdata_size;
 
-	map->tracks= MEM_callocN(sizeof(MovieTrackingTrack)*num_tracks, "TrackingsMap tracks");
+	map->tracks = MEM_callocN(sizeof(MovieTrackingTrack)*num_tracks, "TrackingsMap tracks");
 
-	if(customdata_size)
-		map->customdata= MEM_callocN(customdata_size*num_tracks, "TracksMap customdata");
+	if (customdata_size)
+		map->customdata = MEM_callocN(customdata_size*num_tracks, "TracksMap customdata");
 
-	map->hash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "TracksMap hash");
+	map->hash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "TracksMap hash");
 
 	return map;
 }
@@ -700,21 +755,21 @@ static int tracks_map_size(TracksMap *map)
 
 static void tracks_map_get(TracksMap *map, int index, MovieTrackingTrack **track, void **customdata)
 {
-	*track= &map->tracks[index];
+	*track = &map->tracks[index];
 
-	if(map->customdata)
-		*customdata= &map->customdata[index*map->customdata_size];
+	if (map->customdata)
+		*customdata = &map->customdata[index*map->customdata_size];
 }
 
 static void tracks_map_insert(TracksMap *map, MovieTrackingTrack *track, void *customdata)
 {
 	MovieTrackingTrack new_track= *track;
 
-	new_track.markers= MEM_dupallocN(new_track.markers);
+	new_track.markers = MEM_dupallocN(new_track.markers);
 
-	map->tracks[map->ptr]= new_track;
+	map->tracks[map->ptr] = new_track;
 
-	if(customdata)
+	if (customdata)
 		memcpy(&map->customdata[map->ptr*map->customdata_size], customdata, map->customdata_size);
 
 	BLI_ghash_insert(map->hash, &map->tracks[map->ptr], track);
@@ -725,89 +780,96 @@ static void tracks_map_insert(TracksMap *map, MovieTrackingTrack *track, void *c
 static void tracks_map_merge(TracksMap *map, MovieTracking *tracking)
 {
 	MovieTrackingTrack *track;
-	MovieTrackingTrack *act_track= BKE_tracking_active_track(tracking);
-	ListBase tracks= {NULL, NULL}, new_tracks= {NULL, NULL};
+	MovieTrackingTrack *act_track = BKE_tracking_active_track(tracking);
+	MovieTrackingTrack *rot_track = tracking->stabilization.rot_track;
+	ListBase tracks = {NULL, NULL}, new_tracks = {NULL, NULL};
 	ListBase *old_tracks;
 	int a;
 
-	if(map->is_camera) {
-		old_tracks= &tracking->tracks;
-	} else {
-		MovieTrackingObject *object= BKE_tracking_named_object(tracking, map->object_name);
+	if (map->is_camera) {
+		old_tracks = &tracking->tracks;
+	}
+	else {
+		MovieTrackingObject *object = BKE_tracking_named_object(tracking, map->object_name);
 
-		if(!object) {
+		if (!object) {
 			/* object was deleted by user, create new one */
-			object= BKE_tracking_new_object(tracking, map->object_name);
+			object = BKE_tracking_new_object(tracking, map->object_name);
 		}
 
-		old_tracks= &object->tracks;
+		old_tracks = &object->tracks;
 	}
 
 	/* duplicate currently operating tracks to temporary list.
-	   this is needed to keep names in unique state and it's faster to change names
-	   of currently operating tracks (if needed) */
-	for(a= 0; a<map->num_tracks; a++) {
-		int replace_sel= 0;
+	 * this is needed to keep names in unique state and it's faster to change names
+	 * of currently operating tracks (if needed) */
+	for (a = 0; a < map->num_tracks; a++) {
+		int replace_sel = 0, replace_rot = 0;
 		MovieTrackingTrack *new_track, *old;
 
-		track= &map->tracks[a];
+		track = &map->tracks[a];
 
 		/* find original of operating track in list of previously displayed tracks */
-		old= BLI_ghash_lookup(map->hash, track);
-		if(old) {
-			MovieTrackingTrack *cur= old_tracks->first;
+		old = BLI_ghash_lookup(map->hash, track);
+		if (old) {
+			MovieTrackingTrack *cur = old_tracks->first;
 
-			while(cur) {
-				if(cur==old)
+			while (cur) {
+				if (cur == old)
 					break;
 
-				cur= cur->next;
+				cur = cur->next;
 			}
 
 			/* original track was found, re-use flags and remove this track */
-			if(cur) {
-				if(act_track)
-					replace_sel= 1;
+			if (cur) {
+				if (cur == act_track)
+					replace_sel = 1;
+				if (cur == rot_track)
+					replace_rot = 1;
 
-				track->flag= cur->flag;
-				track->pat_flag= cur->pat_flag;
-				track->search_flag= cur->search_flag;
+				track->flag = cur->flag;
+				track->pat_flag = cur->pat_flag;
+				track->search_flag = cur->search_flag;
 
 				BKE_tracking_free_track(cur);
 				BLI_freelinkN(old_tracks, cur);
 			}
 		}
 
-		new_track= duplicate_track(track);
+		new_track = duplicate_track(track);
 
 		BLI_ghash_remove(map->hash, track, NULL, NULL); /* XXX: are we actually need this */
 		BLI_ghash_insert(map->hash, track, new_track);
 
-		if(replace_sel)		/* update current selection in clip */
+		if (replace_sel)		/* update current selection in clip */
 			tracking->act_track= new_track;
 
+		if (replace_rot)		/* update track used for rotation stabilization */
+			tracking->stabilization.rot_track= new_track;
+
 		BLI_addtail(&tracks, new_track);
 	}
 
 	/* move all tracks, which aren't operating */
-	track= old_tracks->first;
-	while(track) {
-		MovieTrackingTrack *next= track->next;
+	track = old_tracks->first;
+	while (track) {
+		MovieTrackingTrack *next = track->next;
 
-		track->next= track->prev= NULL;
+		track->next = track->prev = NULL;
 		BLI_addtail(&new_tracks, track);
 
 		track= next;
 	}
 
 	/* now move all tracks which are currently operating and keep their names unique */
-	track= tracks.first;
-	while(track) {
-		MovieTrackingTrack *next= track->next;
+	track = tracks.first;
+	while (track) {
+		MovieTrackingTrack *next = track->next;
 
 		BLI_remlink(&tracks, track);
 
-		track->next= track->prev= NULL;
+		track->next = track->prev = NULL;
 		BLI_addtail(&new_tracks, track);
 
 		BLI_uniquename(&new_tracks, track, "Track", '.', offsetof(MovieTrackingTrack, name), sizeof(track->name));
@@ -824,14 +886,14 @@ static void tracks_map_free(TracksMap *map, void (*customdata_free) (void *custo
 
 	BLI_ghash_free(map->hash, NULL, NULL);
 
-	for(i= 0; i<map->num_tracks; i++) {
-		if(map->customdata && customdata_free)
+	for (i = 0; i < map->num_tracks; i++) {
+		if (map->customdata && customdata_free)
 			customdata_free(&map->customdata[i*map->customdata_size]);
 
 		BKE_tracking_free_track(&map->tracks[i]);
 	}
 
-	if(map->customdata)
+	if (map->customdata)
 		MEM_freeN(map->customdata);
 
 	MEM_freeN(map->tracks);
@@ -844,14 +906,8 @@ typedef struct TrackContext {
 #ifdef WITH_LIBMV
 	float keyframed_pos[2];
 
-	/* ** KLT tracker ** */
 	struct libmv_RegionTracker *region_tracker;
 	float *patch;			/* keyframed patch */
-
-	/* ** SAD tracker ** */
-	int pattern_size;		/* size of pattern */
-	unsigned char *pattern;	/* keyframed pattern */
-	unsigned char *warped;	/* warped version of reference */
 #else
 	int pad;
 #endif
@@ -873,83 +929,85 @@ typedef struct MovieTrackingContext {
 
 MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *user, short backwards, short sequence)
 {
-	MovieTrackingContext *context= MEM_callocN(sizeof(MovieTrackingContext), "trackingContext");
-	MovieTracking *tracking= &clip->tracking;
-	MovieTrackingSettings *settings= &tracking->settings;
-	ListBase *tracksbase= BKE_tracking_get_tracks(tracking);
+	MovieTrackingContext *context = MEM_callocN(sizeof(MovieTrackingContext), "trackingContext");
+	MovieTracking *tracking = &clip->tracking;
+	MovieTrackingSettings *settings = &tracking->settings;
+	ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
 	MovieTrackingTrack *track;
-	MovieTrackingObject *object= BKE_tracking_active_object(tracking);
-	int num_tracks= 0;
+	MovieTrackingObject *object = BKE_tracking_active_object(tracking);
+	int num_tracks = 0;
 
-	context->settings= *settings;
-	context->backwards= backwards;
-	context->sync_frame= user->framenr;
-	context->first_time= 1;
-	context->sequence= sequence;
+	context->settings = *settings;
+	context->backwards = backwards;
+	context->sync_frame = user->framenr;
+	context->first_time = TRUE;
+	context->sequence = sequence;
 
 	/* count */
-	track= tracksbase->first;
-	while(track) {
-		if(TRACK_SELECTED(track) && (track->flag&TRACK_LOCKED)==0) {
-			MovieTrackingMarker *marker= BKE_tracking_get_marker(track, user->framenr);
+	track = tracksbase->first;
+	while (track) {
+		if (TRACK_SELECTED(track) && (track->flag & (TRACK_LOCKED | TRACK_HIDDEN))==0) {
+			MovieTrackingMarker *marker = BKE_tracking_get_marker(track, user->framenr);
 
-			if((marker->flag&MARKER_DISABLED)==0)
+			if ((marker->flag & MARKER_DISABLED) == 0)
 				num_tracks++;
 		}
 
-		track= track->next;
+		track = track->next;
 	}
 
-	if(num_tracks) {
+	if (num_tracks) {
 		int width, height;
 
-		context->tracks_map= tracks_map_new(object->name, object->flag & TRACKING_OBJECT_CAMERA,
-					num_tracks, sizeof(TrackContext));
+		context->tracks_map = tracks_map_new(object->name, object->flag & TRACKING_OBJECT_CAMERA,
+		                                     num_tracks, sizeof(TrackContext));
 
 		BKE_movieclip_get_size(clip, user, &width, &height);
 
 		/* create tracking data */
-		track= tracksbase->first;
-		while(track) {
-			if(TRACK_SELECTED(track) && (track->flag&TRACK_LOCKED)==0) {
-				MovieTrackingMarker *marker= BKE_tracking_get_marker(track, user->framenr);
+		track = tracksbase->first;
+		while (track) {
+			if (TRACK_SELECTED(track) && (track->flag & (TRACK_HIDDEN | TRACK_LOCKED)) == 0) {
+				MovieTrackingMarker *marker = BKE_tracking_get_marker(track, user->framenr);
 
-				if((marker->flag&MARKER_DISABLED)==0) {
+				if ((marker->flag & MARKER_DISABLED) == 0) {
 					TrackContext track_context;
 
 					memset(&track_context, 0, sizeof(TrackContext));
 
 #ifdef WITH_LIBMV
 					{
-						float patx, paty;
-						patx= (int)((track->pat_max[0]-track->pat_min[0])*width);
-						paty= (int)((track->pat_max[1]-track->pat_min[1])*height);
+						float patx = (int)((track->pat_max[0]-track->pat_min[0])*width),
+						      paty = (int)((track->pat_max[1]-track->pat_min[1])*height);
 
-						if(ELEM(track->tracker, TRACKER_KLT, TRACKER_HYBRID)) {
-							float search_size_x= (track->search_max[0]-track->search_min[0])*width;
-							float search_size_y= (track->search_max[1]-track->search_min[1])*height;
-							float pattern_size_x= (track->pat_max[0]-track->pat_min[0])*width;
-							float pattern_size_y= (track->pat_max[1]-track->pat_min[1])*height;
-							int wndx= (int)patx/2, wndy= (int)paty/2;
+						float search_size_x = (track->search_max[0]-track->search_min[0])*width;
+						float search_size_y = (track->search_max[1]-track->search_min[1])*height;
+						float pattern_size_x = (track->pat_max[0]-track->pat_min[0])*width;
+						float pattern_size_y = (track->pat_max[1]-track->pat_min[1])*height;
+						int wndx = (int)patx / 2, wndy = (int)paty / 2;
+						int half_wnd = MAX2(wndx, wndy);
 
 							/* compute the maximum pyramid size */
-							float search_to_pattern_ratio= MIN2(search_size_x,  search_size_y)
-								/ MAX2(pattern_size_x, pattern_size_y);
-							float log2_search_to_pattern_ratio = log(floor(search_to_pattern_ratio)) / M_LN2;
-							int max_pyramid_levels= floor(log2_search_to_pattern_ratio + 1);
-
-							/* try to accomodate the user's choice of pyramid level in a way
-							 * that doesn't cause the coarsest pyramid pattern to be larger
-							 * than the search size */
-							int level= MIN2(track->pyramid_levels, max_pyramid_levels);
-
-							if(track->tracker==TRACKER_KLT)
-								track_context.region_tracker= libmv_pyramidRegionTrackerNew(100, level, MAX2(wndx, wndy), track->minimum_correlation);
-							else
-								track_context.region_tracker= libmv_hybridRegionTrackerNew(100, MAX2(wndx, wndy), track->minimum_correlation);
+						float search_to_pattern_ratio = MIN2(search_size_x,  search_size_y)
+							/ MAX2(pattern_size_x, pattern_size_y);
+						float log2_search_to_pattern_ratio = log(floor(search_to_pattern_ratio)) / M_LN2;
+						int max_pyramid_levels = floor(log2_search_to_pattern_ratio + 1);
+
+						/* try to accommodate the user's choice of pyramid level in a way
+						 * that doesn't cause the coarsest pyramid pattern to be larger
+						 * than the search size */
+						int level = MIN2(track->pyramid_levels, max_pyramid_levels);
+
+						if (track->tracker==TRACKER_KLT) {
+							track_context.region_tracker =
+								libmv_pyramidRegionTrackerNew(100, level, half_wnd, track->minimum_correlation);
+						}
+						else if (track->tracker == TRACKER_HYBRID) {
+							track_context.region_tracker =
+								libmv_hybridRegionTrackerNew(100, half_wnd, track->minimum_correlation);
 						}
-						else if(track->tracker==TRACKER_SAD) {
-							track_context.pattern_size= MAX2(patx, paty);
+						else if (track->tracker == TRACKER_SAD) {
+							track_context.region_tracker= libmv_bruteRegionTrackerNew(MAX2(wndx, wndy), track->minimum_correlation);
 						}
 					}
 #endif
@@ -958,11 +1016,11 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u
 				}
 			}
 
-			track= track->next;
+			track = track->next;
 		}
 	}
 
-	context->clip= clip;
+	context->clip = clip;
 
 	/* store needed clip flags passing to get_buffer functions
 	 * - MCLIP_USE_PROXY is needed to because timecode affects on movie clip
@@ -971,14 +1029,14 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u
 	 *   would be used for images
 	 * - MCLIP_USE_PROXY_CUSTOM_DIR is needed because proxy/timecode files might
 	 *   be stored in a different location
-	 * ignore all the rest pssible flags for now */
-	context->clip_flag= clip->flag&MCLIP_TIMECODE_FLAGS;
+	 * ignore all the rest possible flags for now */
+	context->clip_flag = clip->flag&MCLIP_TIMECODE_FLAGS;
 
-	context->user= *user;
-	context->user.render_size= MCLIP_PROXY_RENDER_SIZE_FULL;
-	context->user.render_flag= 0;
+	context->user = *user;
+	context->user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL;
+	context->user.render_flag = 0;
 
-	if(!sequence)
+	if (!sequence)
 		BLI_begin_threaded_malloc();
 
 	return context;
@@ -986,20 +1044,15 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u
 
 static void track_context_free(void *customdata)
 {
-	TrackContext *track_context= (TrackContext *)customdata;
+	TrackContext *track_context = (TrackContext *)customdata;
 
 #if WITH_LIBMV
-	if(track_context->region_tracker)
+	if (track_context->region_tracker)
 		libmv_regionTrackerDestroy(track_context->region_tracker);
 
-	if(track_context->patch)
+	if (track_context->patch)
 		MEM_freeN(track_context->patch);
 
-	if(track_context->pattern)
-		MEM_freeN(track_context->pattern);
-
-	if(track_context->warped)
-		MEM_freeN(track_context->warped);
 #else
 		(void) track_context;
 #endif
@@ -1007,7 +1060,7 @@ static void track_context_free(void *customdata)
 
 void BKE_tracking_context_free(MovieTrackingContext *context)
 {
-	if(!context->sequence)
+	if (!context->sequence)
 		BLI_end_threaded_malloc();
 
 	tracks_map_free(context->tracks_map, track_context_free);
@@ -1023,7 +1076,7 @@ void BKE_tracking_disable_imbuf_channels(ImBuf *ibuf, int disable_red, int disab
 	int x, y;
 	float scale;
 
-	if(!disable_red && !disable_green && !disable_blue && !grayscale)
+	if (!disable_red && !disable_green && !disable_blue && !grayscale)
 		return;
 
 	/* If only some components are selected, it's important to rescale the result
@@ -1032,32 +1085,39 @@ void BKE_tracking_disable_imbuf_channels(ImBuf *ibuf, int disable_red, int disab
 	        (disable_green ? 0.0f : 0.7152f) +
 	        (disable_blue  ? 0.0f : 0.0722f);
 
-	for(y= 0; y<ibuf->y; y++) {
-		for (x= 0; x<ibuf->x; x++) {
-			int pixel= ibuf->x*y + x;
+	for (y = 0; y < ibuf->y; y++) {
+		for (x = 0; x < ibuf->x; x++) {
+			int pixel = ibuf->x*y + x;
 
-			if(ibuf->rect_float) {
-				float *rrgbf= ibuf->rect_float + pixel*4;
+			if (ibuf->rect_float) {
+				float *rrgbf = ibuf->rect_float + pixel*4;
 				float r = disable_red   ? 0.0f : rrgbf[0];
 				float g = disable_green ? 0.0f : rrgbf[1];
 				float b = disable_blue  ? 0.0f : rrgbf[2];
+
 				if (grayscale) {
 					float gray = (0.2126f*r + 0.7152f*g + 0.0722f*b) / scale;
+
 					rrgbf[0] = rrgbf[1] = rrgbf[2] = gray;
-				} else {
+				}
+				else {
 					rrgbf[0] = r;
 					rrgbf[1] = g;
 					rrgbf[2] = b;
 				}
-			} else {
-				char *rrgb= (char*)ibuf->rect + pixel*4;
+			}
+			else {
+				char *rrgb = (char*)ibuf->rect + pixel*4;
 				char r = disable_red   ? 0 : rrgb[0];
 				char g = disable_green ? 0 : rrgb[1];
 				char b = disable_blue  ? 0 : rrgb[2];
+
 				if (grayscale) {
 					float gray = (0.2126f*r + 0.7152f*g + 0.0722f*b) / scale;
+
 					rrgb[0] = rrgb[1] = rrgb[2] = gray;
-				} else {
+				}
+				else {
 					rrgb[0] = r;
 					rrgb[1] = g;
 					rrgb[2] = b;
@@ -1065,16 +1125,19 @@ void BKE_tracking_disable_imbuf_channels(ImBuf *ibuf, int disable_red, int disab
 			}
 		}
 	}
+
+	if (ibuf->rect_float)
+		ibuf->userflags |= IB_RECT_INVALID;
 }
 
 static void disable_imbuf_channels(ImBuf *ibuf, MovieTrackingTrack *track, int grayscale)
 {
-	BKE_tracking_disable_imbuf_channels(ibuf, track->flag&TRACK_DISABLE_RED,
-			track->flag&TRACK_DISABLE_GREEN, track->flag&TRACK_DISABLE_BLUE, grayscale);
+	BKE_tracking_disable_imbuf_channels(ibuf, track->flag & TRACK_DISABLE_RED,
+			track->flag & TRACK_DISABLE_GREEN, track->flag & TRACK_DISABLE_BLUE, grayscale);
 }
 
 static ImBuf *get_area_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, MovieTrackingMarker *marker,
-			float min[2], float max[2], int margin, int anchored, float pos[2], int origin[2])
+                             float min[2], float max[2], int margin, int anchored, float pos[2], int origin[2])
 {
 	ImBuf *tmpibuf;
 	int x, y;
@@ -1082,90 +1145,94 @@ static ImBuf *get_area_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, MovieTracki
 	float mpos[2];
 
 	copy_v2_v2(mpos, marker->pos);
-	if(anchored)
+	if (anchored)
 		add_v2_v2(mpos, track->offset);
 
-	if(pos)
+	if (pos)
 		zero_v2(pos);
 
-	x= mpos[0]*ibuf->x;
-	y= mpos[1]*ibuf->y;
+	x = mpos[0]*ibuf->x;
+	y = mpos[1]*ibuf->y;
 
-	w= (max[0]-min[0])*ibuf->x;
-	h= (max[1]-min[1])*ibuf->y;
+	w = (max[0] - min[0]) * ibuf->x;
+	h = (max[1] - min[1]) * ibuf->y;
 
-	w= w|1;
-	h= h|1;
+	/* dimensions should be odd */
+	w = w|1;
+	h = h|1;
 
-	x1= x-(int)(w/2.0f);
-	y1= y-(int)(h/2.0f);
+	x1 = x-(int)(w * (-min[0] / (max[0] - min[0])));
+	y1 = y-(int)(h * (-min[1] / (max[1] - min[1])));
 
-	/* dimensions should be odd */
-	tmpibuf= IMB_allocImBuf(w+margin*2, h+margin*2, 32, IB_rect);
-	IMB_rectcpy(tmpibuf, ibuf, 0, 0, x1-margin, y1-margin, w+margin*2, h+margin*2);
+	tmpibuf = IMB_allocImBuf(w+margin*2, h+margin*2, 32, IB_rect);
+	IMB_rectcpy(tmpibuf, ibuf, 0, 0, x1 - margin, y1 - margin, w + margin * 2, h + margin * 2);
 
-	if(pos != NULL) {
-		pos[0]= mpos[0]*ibuf->x-x1+margin;
-		pos[1]= mpos[1]*ibuf->y-y1+margin;
+	if (pos != NULL) {
+		pos[0] = mpos[0] * ibuf->x - x1 + margin;
+		pos[1] = mpos[1] * ibuf->y - y1 + margin;
 	}
 
-	if(origin != NULL) {
-		origin[0]= x1-margin;
-		origin[1]= y1-margin;
+	if (origin != NULL) {
+		origin[0] = x1 - margin;
+		origin[1] = y1 - margin;
 	}
 
-	if((track->flag & TRACK_PREVIEW_GRAYSCALE) ||
+	if ((track->flag & TRACK_PREVIEW_GRAYSCALE) ||
 	   (track->flag & TRACK_DISABLE_RED)       ||
 	   (track->flag & TRACK_DISABLE_GREEN)     ||
 	   (track->flag & TRACK_DISABLE_BLUE))
 	{
-		disable_imbuf_channels(tmpibuf, track, 1 /* grayscale */);
+		disable_imbuf_channels(tmpibuf, track, TRUE /* grayscale */);
 	}
 
 	return tmpibuf;
 }
 
 ImBuf *BKE_tracking_get_pattern_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, MovieTrackingMarker *marker,
-			int margin, int anchored, float pos[2], int origin[2])
+                                      int margin, int anchored, float pos[2], int origin[2])
 {
 	return get_area_imbuf(ibuf, track, marker, track->pat_min, track->pat_max, margin, anchored, pos, origin);
 }
 
 ImBuf *BKE_tracking_get_search_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, MovieTrackingMarker *marker,
-			int margin, int anchored, float pos[2], int origin[2])
+                                     int margin, int anchored, float pos[2], int origin[2])
 {
 	return get_area_imbuf(ibuf, track, marker, track->search_min, track->search_max, margin, anchored, pos, origin);
 }
 
 #ifdef WITH_LIBMV
 static float *get_search_floatbuf(ImBuf *ibuf, MovieTrackingTrack *track, MovieTrackingMarker *marker,
-			int *width_r, int *height_r, float pos[2], int origin[2])
+                                  int *width_r, int *height_r, float pos[2], int origin[2])
 {
 	ImBuf *tmpibuf;
 	float *pixels, *fp;
 	int x, y, width, height;
 
-	width= (track->search_max[0]-track->search_min[0])*ibuf->x;
-	height= (track->search_max[1]-track->search_min[1])*ibuf->y;
+	width = (track->search_max[0] - track->search_min[0]) * ibuf->x;
+	height = (track->search_max[1] - track->search_min[1]) * ibuf->y;
 
-	tmpibuf= BKE_tracking_get_search_imbuf(ibuf, track, marker, 0, 0, pos, origin);
-	disable_imbuf_channels(tmpibuf, track, 0 /* don't grayscale */);
+	tmpibuf = BKE_tracking_get_search_imbuf(ibuf, track, marker, 0, 0, pos, origin);
+	disable_imbuf_channels(tmpibuf, track, FALSE /* don't grayscale */);
 
-	*width_r= width;
-	*height_r= height;
+	*width_r = width;
+	*height_r = height;
 
-	fp= pixels= MEM_callocN(width*height*sizeof(float), "tracking floatBuf");
-	for(y= 0; y<(int)height; y++) {
-		for (x= 0; x<(int)width; x++) {
-			int pixel= tmpibuf->x*y + x;
+	fp = pixels = MEM_callocN(width * height * sizeof(float), "tracking floatBuf");
+	for (y = 0; y < (int)height; y++) {
+		for (x = 0; x < (int)width; x++) {
+			int pixel = tmpibuf->x * y + x;
+
+			if (tmpibuf->rect_float) {
+				float *rrgbf = tmpibuf->rect_float + pixel * 4;
+
+				*fp = 0.2126 * rrgbf[0] + 0.7152 * rrgbf[1] + 0.0722 * rrgbf[2];
+			}
+			else {
+				unsigned char *rrgb = (unsigned char*)tmpibuf->rect + pixel * 4;
 
-			if(tmpibuf->rect_float) {
-				float *rrgbf= tmpibuf->rect_float + pixel*4;
-				*fp= 0.2126*rrgbf[0] + 0.7152*rrgbf[1] + 0.0722*rrgbf[2];
-			} else {
-				unsigned char *rrgb= (unsigned char*)tmpibuf->rect + pixel*4;
-				*fp= (0.2126*rrgb[0] + 0.7152*rrgb[1] + 0.0722*rrgb[2])/255.0f;
+				*fp = (0.2126 * rrgb[0] + 0.7152 * rrgb[1] + 0.0722 * rrgb[2]) / 255.0f;
 			}
+
 			fp++;
 		}
 	}
@@ -1180,41 +1247,26 @@ static unsigned char *get_ucharbuf(ImBuf *ibuf)
 	int x, y;
 	unsigned char *pixels, *cp;
 
-	cp= pixels= MEM_callocN(ibuf->x*ibuf->y*sizeof(unsigned char), "tracking ucharBuf");
-	for(y= 0; y<ibuf->y; y++) {
-		for (x= 0; x<ibuf->x; x++) {
-			int pixel= ibuf->x*y + x;
-
-			if(ibuf->rect_float) {
-				const float *rrgbf= ibuf->rect_float + pixel*4;
-				const float grey_f= 0.2126f*rrgbf[0] + 0.7152f*rrgbf[1] + 0.0722f*rrgbf[2];
-				*cp= FTOCHAR(grey_f);
-			} else {
-				const unsigned char *rrgb= (unsigned char*)ibuf->rect + pixel*4;
-				*cp= 0.2126f*rrgb[0] + 0.7152f*rrgb[1] + 0.0722f*rrgb[2];
-			}
-			cp++;
-		}
-	}
-
-	return pixels;
-}
+	cp = pixels = MEM_callocN(ibuf->x * ibuf->y * sizeof(unsigned char), "tracking ucharBuf");
+	for (y = 0; y < ibuf->y; y++) {
+		for (x = 0; x < ibuf->x; x++) {
+			int pixel = ibuf->x * y + x;
 
-static unsigned char *get_search_bytebuf(ImBuf *ibuf, MovieTrackingTrack *track, MovieTrackingMarker *marker,
-			int *width_r, int *height_r, float pos[2], int origin[2])
-{
-	ImBuf *tmpibuf;
-	unsigned char *pixels;
+			if (ibuf->rect_float) {
+				const float *rrgbf = ibuf->rect_float + pixel*4;
+				const float grey_f = 0.2126f * rrgbf[0] + 0.7152f * rrgbf[1] + 0.0722f * rrgbf[2];
 
-	tmpibuf= BKE_tracking_get_search_imbuf(ibuf, track, marker, 0, 0, pos, origin);
-	disable_imbuf_channels(tmpibuf, track, 0 /* don't grayscale */);
-
-	*width_r= tmpibuf->x;
-	*height_r= tmpibuf->y;
+				*cp = FTOCHAR(grey_f);
+			}
+			else {
+				const unsigned char *rrgb = (unsigned char*)ibuf->rect + pixel * 4;
 
-	pixels= get_ucharbuf(tmpibuf);
+				*cp = 0.2126f * rrgb[0] + 0.7152f * rrgb[1] + 0.0722f * rrgb[2];
+			}
 
-	IMB_freeImBuf(tmpibuf);
+			cp++;
+		}
+	}
 
 	return pixels;
 }
@@ -1222,273 +1274,205 @@ static unsigned char *get_search_bytebuf(ImBuf *ibuf, MovieTrackingTrack *track,
 static ImBuf *get_frame_ibuf(MovieTrackingContext *context, int framenr)
 {
 	ImBuf *ibuf;
-	MovieClipUser user= context->user;
+	MovieClipUser user = context->user;
 
-	user.framenr= framenr;
+	user.framenr = framenr;
 
-	ibuf= BKE_movieclip_get_ibuf_flag(context->clip, &user, context->clip_flag, MOVIECLIP_CACHE_SKIP);
+	ibuf = BKE_movieclip_get_ibuf_flag(context->clip, &user, context->clip_flag, MOVIECLIP_CACHE_SKIP);
 
 	return ibuf;
 }
 
 static ImBuf *get_keyframed_ibuf(MovieTrackingContext *context, MovieTrackingTrack *track,
-			MovieTrackingMarker *marker, MovieTrackingMarker **marker_keyed)
+                                 MovieTrackingMarker *marker, MovieTrackingMarker **marker_keyed)
 {
-	int framenr= marker->framenr;
-	int a= marker-track->markers;
+	int framenr = marker->framenr;
+	int a = marker-track->markers;
 
-	*marker_keyed= marker;
+	*marker_keyed = marker;
 
-	while(a>=0 && a<track->markersnr) {
-		int next= (context->backwards) ? a+1 : a-1;
-		int is_keyframed= 0;
-		MovieTrackingMarker *cur_marker= &track->markers[a];
-		MovieTrackingMarker *next_marker= NULL;
+	while (a >= 0 && a < track->markersnr) {
+		int next = (context->backwards) ? a+1 : a-1;
+		int is_keyframed = FALSE;
+		MovieTrackingMarker *cur_marker = &track->markers[a];
+		MovieTrackingMarker *next_marker = NULL;
 
-		if(next>=0 && next<track->markersnr)
+		if (next>=0 && next<track->markersnr)
 			next_marker= &track->markers[next];
 
 		/* if next mrker is disabled, stop searching keyframe and use current frame as keyframe */
-		if(next_marker && next_marker->flag&MARKER_DISABLED)
-			is_keyframed= 1;
+		if (next_marker && next_marker->flag & MARKER_DISABLED)
+			is_keyframed = TRUE;
+
+		is_keyframed |= (cur_marker->flag & MARKER_TRACKED) == 0;
 
-		is_keyframed|= (cur_marker->flag&MARKER_TRACKED)==0;
+		if (is_keyframed) {
+			framenr = cur_marker->framenr;
+			*marker_keyed = cur_marker;
 
-		if(is_keyframed) {
-			framenr= cur_marker->framenr;
-			*marker_keyed= cur_marker;
 			break;
 		}
 
-		a= next;
+		a = next;
 	}
 
 	return get_frame_ibuf(context, framenr);
 }
 
 static ImBuf *get_adjust_ibuf(MovieTrackingContext *context, MovieTrackingTrack *track, MovieTrackingMarker *marker,
-			int curfra, MovieTrackingMarker **marker_keyed)
+                              int curfra, MovieTrackingMarker **marker_keyed)
 {
-	ImBuf *ibuf= NULL;
+	ImBuf *ibuf = NULL;
 
-	if(track->pattern_match == TRACK_MATCH_KEYFRAME) {
-		ibuf= get_keyframed_ibuf(context, track, marker, marker_keyed);
-	} else {
-		ibuf= get_frame_ibuf(context, curfra);
+	if (track->pattern_match == TRACK_MATCH_KEYFRAME) {
+		ibuf = get_keyframed_ibuf(context, track, marker, marker_keyed);
+	}
+	else {
+		ibuf = get_frame_ibuf(context, curfra);
 
 		/* use current marker as keyframed position */
-		*marker_keyed= marker;
+		*marker_keyed = marker;
 	}
 
 	return ibuf;
 }
 
-static void get_warped(TrackContext *track_context, int x, int y, int width, unsigned char *image)
-{
-	int i, j;
-
-	for(i=0; i<track_context->pattern_size; i++) {
-		for(j=0; j<track_context->pattern_size; j++) {
-			track_context->warped[i*track_context->pattern_size+j]=
-					image[(y+i-track_context->pattern_size/2)*width+x+j-track_context->pattern_size/2];
-		}
-	}
-}
-
 #endif
 
 void BKE_tracking_sync(MovieTrackingContext *context)
 {
-	MovieTracking *tracking= &context->clip->tracking;
+	MovieTracking *tracking = &context->clip->tracking;
 	int newframe;
 
 	tracks_map_merge(context->tracks_map, tracking);
 
-	if(context->backwards) newframe= context->user.framenr+1;
-	else newframe= context->user.framenr-1;
+	if (context->backwards)
+		newframe = context->user.framenr + 1;
+	else
+		newframe = context->user.framenr - 1;
 
-	context->sync_frame= newframe;
+	context->sync_frame = newframe;
 }
 
 void BKE_tracking_sync_user(MovieClipUser *user, MovieTrackingContext *context)
 {
-	user->framenr= context->sync_frame;
+	user->framenr = context->sync_frame;
 }
 
 int BKE_tracking_next(MovieTrackingContext *context)
 {
 	ImBuf *ibuf_new;
-	int curfra= context->user.framenr;
-	int a, ok= 0, map_size;
+	int curfra = context->user.framenr;
+	int a, ok = FALSE, map_size;
 
-	map_size= tracks_map_size(context->tracks_map);
+	map_size = tracks_map_size(context->tracks_map);
 
 	/* nothing to track, avoid unneeded frames reading to save time and memory */
-	if(!map_size)
-		return 0;
+	if (!map_size)
+		return FALSE;
 
-	if(context->backwards) context->user.framenr--;
-	else context->user.framenr++;
+	if (context->backwards)
+		context->user.framenr--;
+	else
+		context->user.framenr++;
 
-	ibuf_new= BKE_movieclip_get_ibuf_flag(context->clip, &context->user, context->clip_flag, MOVIECLIP_CACHE_SKIP);
-	if(!ibuf_new)
-		return 0;
+	ibuf_new = BKE_movieclip_get_ibuf_flag(context->clip, &context->user, context->clip_flag, MOVIECLIP_CACHE_SKIP);
+	if (!ibuf_new)
+		return FALSE;
 
-	#pragma omp parallel for private(a) shared(ibuf_new, ok) if(map_size>1)
-	for(a= 0; a<map_size; a++) {
+	#pragma omp parallel for private(a) shared(ibuf_new, ok) if (map_size>1)
+	for (a = 0; a < map_size; a++) {
 		TrackContext *track_context = NULL;
 		MovieTrackingTrack *track;
 		MovieTrackingMarker *marker;
 
 		tracks_map_get(context->tracks_map, a, &track, (void**)&track_context);
 
-		marker= BKE_tracking_exact_marker(track, curfra);
+		marker = BKE_tracking_exact_marker(track, curfra);
 
-		if(marker && (marker->flag&MARKER_DISABLED)==0) {
+		if (marker && (marker->flag & MARKER_DISABLED) == 0) {
 #ifdef WITH_LIBMV
-			int width, height, origin[2], tracked= 0, need_readjust= 0;
+			int width, height, origin[2], tracked = 0, need_readjust = 0;
 			float pos[2], margin[2], dim[2];
 			double x1, y1, x2, y2;
-			ImBuf *ibuf= NULL;
+			ImBuf *ibuf = NULL;
 			MovieTrackingMarker marker_new, *marker_keyed;
-			int onbound= 0, nextfra;
+			int onbound = FALSE, nextfra;
 
-			if(track->pattern_match==TRACK_MATCH_KEYFRAME)
-				need_readjust= context->first_time;
+			if (track->pattern_match == TRACK_MATCH_KEYFRAME)
+				need_readjust = context->first_time;
 			else
-				need_readjust= 1;
+				need_readjust = TRUE;
 
-			if(context->backwards) nextfra= curfra-1;
-			else nextfra= curfra+1;
+			if (context->backwards)
+				nextfra = curfra - 1;
+			else
+				nextfra = curfra + 1;
 
 			/* margin from frame boundaries */
 			sub_v2_v2v2(dim, track->pat_max, track->pat_min);
-			margin[0]= margin[1]= MAX2(dim[0], dim[1]) / 2.0f;
+			margin[0] = margin[1] = MAX2(dim[0], dim[1]) / 2.0f;
 
-			margin[0]= MAX2(margin[0], (float)track->margin / ibuf_new->x);
-			margin[1]= MAX2(margin[1], (float)track->margin / ibuf_new->y);
+			margin[0] = MAX2(margin[0], (float)track->margin / ibuf_new->x);
+			margin[1] = MAX2(margin[1], (float)track->margin / ibuf_new->y);
 
 			/* do not track markers which are too close to boundary */
-			if(marker->pos[0]<margin[0] || marker->pos[0]>1.0f-margin[0] ||
-			   marker->pos[1]<margin[1] || marker->pos[1]>1.0f-margin[1]) {
-				onbound= 1;
+			if (marker->pos[0]<margin[0] || marker->pos[0]>1.0f-margin[0] ||
+			    marker->pos[1]<margin[1] || marker->pos[1]>1.0f-margin[1])
+			{
+				onbound = TRUE;
 			}
-			else if(ELEM(track->tracker, TRACKER_KLT, TRACKER_HYBRID)) {
+			else {
 				float *patch_new;
 
-				if(need_readjust) {
+				if (need_readjust) {
 					/* calculate patch for keyframed position */
-					ibuf= get_adjust_ibuf(context, track, marker, curfra, &marker_keyed);
+					ibuf = get_adjust_ibuf(context, track, marker, curfra, &marker_keyed);
 
-					if(track_context->patch)
+					if (track_context->patch)
 						MEM_freeN(track_context->patch);
 
-					track_context->patch= get_search_floatbuf(ibuf, track, marker_keyed, &width, &height, track_context->keyframed_pos, origin);
+					track_context->patch = get_search_floatbuf(ibuf, track, marker_keyed, &width, &height,
+					                                           track_context->keyframed_pos, origin);
 
 					IMB_freeImBuf(ibuf);
 				}
 
-				patch_new= get_search_floatbuf(ibuf_new, track, marker, &width, &height, pos, origin);
+				patch_new = get_search_floatbuf(ibuf_new, track, marker, &width, &height, pos, origin);
 
-				x1= track_context->keyframed_pos[0];
-				y1= track_context->keyframed_pos[1];
+				x1 = track_context->keyframed_pos[0];
+				y1 = track_context->keyframed_pos[1];
 
-				x2= pos[0];
-				y2= pos[1];
+				x2 = pos[0];
+				y2 = pos[1];
 
-				tracked= libmv_regionTrackerTrack(track_context->region_tracker, track_context->patch, patch_new,
+				tracked = libmv_regionTrackerTrack(track_context->region_tracker, track_context->patch, patch_new,
 							width, height, x1, y1, &x2, &y2);
 
 				MEM_freeN(patch_new);
 			}
-			else if(track->tracker==TRACKER_SAD) {
-				unsigned char *image_new;
-				float correlation;
-				float warp[3][2]={{0}};
-
-				if(need_readjust) {
-					unsigned char *image;
 
-					/* calculate pattern for keyframed position */
-					ibuf= get_adjust_ibuf(context, track, marker, curfra, &marker_keyed);
-
-					image= get_search_bytebuf(ibuf, track, marker_keyed, &width, &height, pos, origin);
-
-					memset(warp, 0, sizeof(warp));
-					warp[0][0]= 1;
-					warp[1][1]= 1;
-					warp[2][0]= pos[0];
-					warp[2][1]= pos[1];
-
-					if(!track_context->pattern) {
-						int square= track_context->pattern_size*track_context->pattern_size;
-						track_context->pattern= MEM_callocN(sizeof(unsigned char)*square, "trackking pattern");
-					}
-
-					libmv_SADSamplePattern(image, width, warp, track_context->pattern, track_context->pattern_size);
-
-					MEM_freeN(image);
-					IMB_freeImBuf(ibuf);
-				}
-
-				image_new= get_search_bytebuf(ibuf_new, track, marker, &width, &height, pos, origin);
-
-				if(track_context->warped==NULL) {
-					unsigned char *image_old;
-
-					ibuf= get_frame_ibuf(context, curfra);
-
-					if(track_context->warped==NULL) {
-						int square= track_context->pattern_size*track_context->pattern_size;
-						track_context->warped= MEM_callocN(sizeof(unsigned char)*square, "trackking warped");
-					}
-
-					image_old= get_search_bytebuf(ibuf, track, marker, &width, &height, pos, origin);
-					get_warped(track_context, pos[0], pos[1], width, image_old);
-					IMB_freeImBuf(ibuf);
-					MEM_freeN(image_old);
-				}
-
-				memset(warp, 0, sizeof(warp));
-				warp[0][0]= 1;
-				warp[1][1]= 1;
-				warp[2][0]= pos[0];
-				warp[2][1]= pos[1];
-
-				correlation= libmv_SADTrackerTrack(track_context->pattern, track_context->warped,
-							track_context->pattern_size, image_new, width, width, height, warp);
-
-				x2= warp[2][0];
-				y2= warp[2][1];
-
-				tracked= track->minimum_correlation < correlation;
-
-				if(tracked)
-					get_warped(track_context, x2, y2, width, image_new);
-
-				MEM_freeN(image_new);
-			}
-
-			if(tracked && !onbound && finite(x2) && finite(y2)) {
-				if(context->first_time) {
+			if (tracked && !onbound && finite(x2) && finite(y2)) {
+				if (context->first_time) {
 					#pragma omp critical
 					{
 						/* check if there's no keyframe/tracked markers before tracking marker.
-						   if so -- create disabled marker before currently tracking "segment" */
+						 * if so -- create disabled marker before currently tracking "segment" */
 						put_disabled_marker(track, marker, !context->backwards, 0);
 					}
 				}
 
 				memset(&marker_new, 0, sizeof(marker_new));
 
-				if(!onbound) {
-					marker_new.pos[0]= (origin[0]+x2)/ibuf_new->x;
-					marker_new.pos[1]= (origin[1]+y2)/ibuf_new->y;
-				} else {
+				if (!onbound) {
+					marker_new.pos[0] = (origin[0] + x2) / ibuf_new->x;
+					marker_new.pos[1] = (origin[1] + y2) / ibuf_new->y;
+				}
+				else {
 					copy_v2_v2(marker_new.pos, marker->pos);
 				}
 
-				marker_new.flag|= MARKER_TRACKED;
+				marker_new.flag |= MARKER_TRACKED;
 				marker_new.framenr= nextfra;
 
 				#pragma omp critical
@@ -1501,11 +1485,12 @@ int BKE_tracking_next(MovieTrackingContext *context)
 				{
 					put_disabled_marker(track, &marker_new, context->backwards, 0);
 				}
-			} else {
-				marker_new= *marker;
+			}
+			else {
+				marker_new = *marker;
 
-				marker_new.framenr= nextfra;
-				marker_new.flag|= MARKER_DISABLED;
+				marker_new.framenr = nextfra;
+				marker_new.flag |= MARKER_DISABLED;
 
 				#pragma omp critical
 				{
@@ -1513,14 +1498,14 @@ int BKE_tracking_next(MovieTrackingContext *context)
 				}
 			}
 
-			ok= 1;
+			ok = TRUE;
 #endif
 		}
 	}
 
 	IMB_freeImBuf(ibuf_new);
 
-	context->first_time= 0;
+	context->first_time = FALSE;
 	context->frames++;
 
 	return ok;
@@ -1561,23 +1546,24 @@ typedef struct ReconstructProgressData {
 #if WITH_LIBMV
 static struct libmv_Tracks *create_libmv_tracks(ListBase *tracksbase, int width, int height)
 {
-	int tracknr= 0;
+	int tracknr = 0;
 	MovieTrackingTrack *track;
-	struct libmv_Tracks *tracks= libmv_tracksNew();
+	struct libmv_Tracks *tracks = libmv_tracksNew();
 
-	track= tracksbase->first;
-	while(track) {
-		int a= 0;
+	track = tracksbase->first;
+	while (track) {
+		int a = 0;
 
-		for(a= 0; a<track->markersnr; a++) {
-			MovieTrackingMarker *marker= &track->markers[a];
+		for (a = 0; a < track->markersnr; a++) {
+			MovieTrackingMarker *marker = &track->markers[a];
 
-			if((marker->flag&MARKER_DISABLED)==0)
+			if ((marker->flag & MARKER_DISABLED) == 0) {
 				libmv_tracksInsert(tracks, marker->framenr, tracknr,
-							marker->pos[0]*width, marker->pos[1]*height);
+							marker->pos[0] * width, marker->pos[1] * height);
+			}
 		}
 
-		track= track->next;
+		track = track->next;
 		tracknr++;
 	}
 
@@ -1586,122 +1572,123 @@ static struct libmv_Tracks *create_libmv_tracks(ListBase *tracksbase, int width,
 
 static void retrieve_libmv_reconstruct_intrinscis(MovieReconstructContext *context, MovieTracking *tracking)
 {
-	struct libmv_Reconstruction *libmv_reconstruction= context->reconstruction;
+	struct libmv_Reconstruction *libmv_reconstruction = context->reconstruction;
 	struct libmv_CameraIntrinsics *libmv_intrinsics = libmv_ReconstructionExtractIntrinsics(libmv_reconstruction);
 
-	float aspy= 1.0f/tracking->camera.pixel_aspect;
+	float aspy = 1.0f / tracking->camera.pixel_aspect;
 
 	double focal_length, principal_x, principal_y, k1, k2, k3;
 	int width, height;
 
 	libmv_CameraIntrinsicsExtract(libmv_intrinsics, &focal_length, &principal_x, &principal_y,
-			&k1, &k2, &k3, &width, &height);
+	                              &k1, &k2, &k3, &width, &height);
 
-	tracking->camera.focal= focal_length;
-	tracking->camera.principal[0]= principal_x;
+	tracking->camera.focal = focal_length;
+	tracking->camera.principal[0] = principal_x;
 
-	/* todo: verify divide by aspy is correct */
-	tracking->camera.principal[1]= principal_y / aspy;
-	tracking->camera.k1= k1;
-	tracking->camera.k2= k2;
+	tracking->camera.principal[1] = principal_y / aspy;
+	tracking->camera.k1 = k1;
+	tracking->camera.k2 = k2;
 }
 
 static int retrieve_libmv_reconstruct_tracks(MovieReconstructContext *context, MovieTracking *tracking)
 {
-	struct libmv_Reconstruction *libmv_reconstruction= context->reconstruction;
-	MovieTrackingReconstruction *reconstruction= NULL;
+	struct libmv_Reconstruction *libmv_reconstruction = context->reconstruction;
+	MovieTrackingReconstruction *reconstruction = NULL;
 	MovieReconstructedCamera *reconstructed;
 	MovieTrackingTrack *track;
-	ListBase *tracksbase=  NULL;
-	int ok= 1, tracknr= 0, a, origin_set= 0;
-	int sfra= context->sfra, efra= context->efra;
+	ListBase *tracksbase =  NULL;
+	int ok = TRUE, tracknr = 0, a, origin_set = FALSE;
+	int sfra = context->sfra, efra = context->efra;
 	float imat[4][4];
 
-	if(context->is_camera) {
-		tracksbase= &tracking->tracks;
-		reconstruction= &tracking->reconstruction;
+	if (context->is_camera) {
+		tracksbase = &tracking->tracks;
+		reconstruction = &tracking->reconstruction;
 	}
 	else {
-		MovieTrackingObject *object= BKE_tracking_named_object(tracking, context->object_name);
+		MovieTrackingObject *object = BKE_tracking_named_object(tracking, context->object_name);
 
-		tracksbase= &object->tracks;
-		reconstruction= &object->reconstruction;
+		tracksbase = &object->tracks;
+		reconstruction = &object->reconstruction;
 	}
 
 	unit_m4(imat);
 
-	track= tracksbase->first;
-	while(track) {
+	track = tracksbase->first;
+	while (track) {
 		double pos[3];
 
-		if(libmv_reporojectionPointForTrack(libmv_reconstruction, tracknr, pos)) {
-			track->bundle_pos[0]= pos[0];
-			track->bundle_pos[1]= pos[1];
-			track->bundle_pos[2]= pos[2];
+		if (libmv_reporojectionPointForTrack(libmv_reconstruction, tracknr, pos)) {
+			track->bundle_pos[0] = pos[0];
+			track->bundle_pos[1] = pos[1];
+			track->bundle_pos[2] = pos[2];
 
-			track->flag|= TRACK_HAS_BUNDLE;
-			track->error= libmv_reporojectionErrorForTrack(libmv_reconstruction, tracknr);
-		} else {
-			track->flag&= ~TRACK_HAS_BUNDLE;
-			ok= 0;
+			track->flag |= TRACK_HAS_BUNDLE;
+			track->error = libmv_reporojectionErrorForTrack(libmv_reconstruction, tracknr);
+		}
+		else {
+			track->flag &= ~TRACK_HAS_BUNDLE;
+			ok = FALSE;
 
 			printf("No bundle for track #%d '%s'\n", tracknr, track->name);
 		}
 
-		track= track->next;
+		track = track->next;
 		tracknr++;
 	}
 
-	if(reconstruction->cameras)
+	if (reconstruction->cameras)
 		MEM_freeN(reconstruction->cameras);
 
-	reconstruction->camnr= 0;
-	reconstruction->cameras= NULL;
-	reconstructed= MEM_callocN((efra-sfra+1)*sizeof(MovieReconstructedCamera), "temp reconstructed camera");
+	reconstruction->camnr = 0;
+	reconstruction->cameras = NULL;
+	reconstructed = MEM_callocN((efra-sfra+1)*sizeof(MovieReconstructedCamera), "temp reconstructed camera");
 
-	for(a= sfra; a<=efra; a++) {
+	for (a = sfra; a <= efra; a++) {
 		double matd[4][4];
 
-		if(libmv_reporojectionCameraForImage(libmv_reconstruction, a, matd)) {
+		if (libmv_reporojectionCameraForImage(libmv_reconstruction, a, matd)) {
 			int i, j;
 			float mat[4][4];
-			float error= libmv_reporojectionErrorForImage(libmv_reconstruction, a);
+			float error = libmv_reporojectionErrorForImage(libmv_reconstruction, a);
 
-			for(i=0; i<4; i++)
-				for(j= 0; j<4; j++)
-					mat[i][j]= matd[i][j];
+			for (i = 0; i < 4; i++)
+				for (j = 0; j < 4; j++)
+					mat[i][j] = matd[i][j];
 
-			if(!origin_set) {
+			if (!origin_set) {
 				copy_m4_m4(imat, mat);
 				invert_m4(imat);
-				origin_set= 1;
+				origin_set = TRUE;
 			}
 
-			if(origin_set)
+			if (origin_set)
 				mult_m4_m4m4(mat, imat, mat);
 
 			copy_m4_m4(reconstructed[reconstruction->camnr].mat, mat);
-			reconstructed[reconstruction->camnr].framenr= a;
-			reconstructed[reconstruction->camnr].error= error;
+			reconstructed[reconstruction->camnr].framenr = a;
+			reconstructed[reconstruction->camnr].error = error;
 			reconstruction->camnr++;
-		} else {
-			ok= 0;
+		}
+		else {
+			ok = FALSE;
 			printf("No camera for frame %d\n", a);
 		}
 	}
 
-	if(reconstruction->camnr) {
-		reconstruction->cameras= MEM_callocN(reconstruction->camnr*sizeof(MovieReconstructedCamera), "reconstructed camera");
-		memcpy(reconstruction->cameras, reconstructed, reconstruction->camnr*sizeof(MovieReconstructedCamera));
+	if (reconstruction->camnr) {
+		reconstruction->cameras = MEM_callocN(reconstruction->camnr * sizeof(MovieReconstructedCamera), "reconstructed camera");
+		memcpy(reconstruction->cameras, reconstructed, reconstruction->camnr * sizeof(MovieReconstructedCamera));
 	}
 
-	if(origin_set) {
-		track= tracksbase->first;
-		while(track) {
-			if(track->flag&TRACK_HAS_BUNDLE)
+	if (origin_set) {
+		track = tracksbase->first;
+		while (track) {
+			if (track->flag & TRACK_HAS_BUNDLE)
 				mul_v3_m4v3(track->bundle_pos, imat, track->bundle_pos);
 
-			track= track->next;
+			track = track->next;
 		}
 	}
 
@@ -1720,40 +1707,40 @@ static int retrieve_libmv_reconstruct(MovieReconstructContext *context, MovieTra
 
 static int get_refine_intrinsics_flags(MovieTracking *tracking, MovieTrackingObject *object)
 {
-	int refine= tracking->settings.refine_camera_intrinsics;
-	int flags= 0;
+	int refine = tracking->settings.refine_camera_intrinsics;
+	int flags = 0;
 
-	if((object->flag&TRACKING_OBJECT_CAMERA)==0)
+	if ((object->flag & TRACKING_OBJECT_CAMERA) == 0)
 		return 0;
 
-	if(refine&REFINE_FOCAL_LENGTH)
-		flags|= LIBMV_REFINE_FOCAL_LENGTH;
+	if (refine & REFINE_FOCAL_LENGTH)
+		flags |= LIBMV_REFINE_FOCAL_LENGTH;
 
-	if(refine&REFINE_PRINCIPAL_POINT)
-		flags|= LIBMV_REFINE_PRINCIPAL_POINT;
+	if (refine & REFINE_PRINCIPAL_POINT)
+		flags |= LIBMV_REFINE_PRINCIPAL_POINT;
 
-	if(refine&REFINE_RADIAL_DISTORTION_K1)
-		flags|= REFINE_RADIAL_DISTORTION_K1;
+	if (refine & REFINE_RADIAL_DISTORTION_K1)
+		flags |= REFINE_RADIAL_DISTORTION_K1;
 
-	if(refine&REFINE_RADIAL_DISTORTION_K2)
-		flags|= REFINE_RADIAL_DISTORTION_K2;
+	if (refine & REFINE_RADIAL_DISTORTION_K2)
+		flags |= REFINE_RADIAL_DISTORTION_K2;
 
 	return flags;
 }
 
 static int count_tracks_on_both_keyframes(MovieTracking *tracking, ListBase *tracksbase)
 {
-	int tot= 0;
-	int frame1= tracking->settings.keyframe1, frame2= tracking->settings.keyframe2;
+	int tot = 0;
+	int frame1 = tracking->settings.keyframe1, frame2= tracking->settings.keyframe2;
 	MovieTrackingTrack *track;
 
-	track= tracksbase->first;
-	while(track) {
-		if(BKE_tracking_has_enabled_marker(track, frame1))
-			if(BKE_tracking_has_enabled_marker(track, frame2))
+	track = tracksbase->first;
+	while (track) {
+		if (BKE_tracking_has_enabled_marker(track, frame1))
+			if (BKE_tracking_has_enabled_marker(track, frame2))
 				tot++;
 
-		track= track->next;
+		track = track->next;
 	}
 
 	return tot;
@@ -1763,76 +1750,78 @@ static int count_tracks_on_both_keyframes(MovieTracking *tracking, ListBase *tra
 int BKE_tracking_can_reconstruct(MovieTracking *tracking, MovieTrackingObject *object, char *error_msg, int error_size)
 {
 #if WITH_LIBMV
-	ListBase *tracksbase= BKE_tracking_object_tracks(tracking, object);
+	ListBase *tracksbase = BKE_tracking_object_tracks(tracking, object);
 
-	if(count_tracks_on_both_keyframes(tracking, tracksbase)<8) {
+	if (count_tracks_on_both_keyframes(tracking, tracksbase)<8) {
 		BLI_strncpy(error_msg, "At least 8 common tracks on both of keyframes are needed for reconstruction", error_size);
-		return 0;
+
+		return FALSE;
 	}
 
-	return 1;
+	return TRUE;
 #else
 	BLI_strncpy(error_msg, "Blender is compiled without motion tracking library", error_size);
-	(void)tracking;
-	(void)object;
+
+	(void) tracking;
+	(void) object;
 
 	return 0;
 #endif
 }
 
-MovieReconstructContext* BKE_tracking_reconstruction_context_new(MovieTracking *tracking,
-			MovieTrackingObject *object, int keyframe1, int keyframe2, int width, int height)
+MovieReconstructContext* BKE_tracking_reconstruction_context_new(MovieTracking *tracking, MovieTrackingObject *object,
+                                                                 int keyframe1, int keyframe2, int width, int height)
 {
-	MovieReconstructContext *context= MEM_callocN(sizeof(MovieReconstructContext), "MovieReconstructContext data");
-	MovieTrackingCamera *camera= &tracking->camera;
-	ListBase *tracksbase= BKE_tracking_object_tracks(tracking, object);
-	float aspy= 1.0f/tracking->camera.pixel_aspect;
-	int num_tracks= BLI_countlist(tracksbase);
-	int sfra= INT_MAX, efra= INT_MIN;
+	MovieReconstructContext *context = MEM_callocN(sizeof(MovieReconstructContext), "MovieReconstructContext data");
+	MovieTrackingCamera *camera = &tracking->camera;
+	ListBase *tracksbase = BKE_tracking_object_tracks(tracking, object);
+	float aspy = 1.0f / tracking->camera.pixel_aspect;
+	int num_tracks = BLI_countlist(tracksbase);
+	int sfra = INT_MAX, efra = INT_MIN;
 	MovieTrackingTrack *track;
 
 	BLI_strncpy(context->object_name, object->name, sizeof(context->object_name));
 	context->is_camera = object->flag&TRACKING_OBJECT_CAMERA;
 
-	context->tracks_map= tracks_map_new(context->object_name, context->is_camera, num_tracks, 0);
+	context->tracks_map = tracks_map_new(context->object_name, context->is_camera, num_tracks, 0);
 
-	track= tracksbase->first;
-	while(track) {
-		int first= 0, last= track->markersnr-1;
-		MovieTrackingMarker *first_marker= &track->markers[0];
-		MovieTrackingMarker *last_marker= &track->markers[track->markersnr-1];
+	track = tracksbase->first;
+	while (track) {
+		int first = 0, last = track->markersnr-1;
+		MovieTrackingMarker *first_marker = &track->markers[0];
+		MovieTrackingMarker *last_marker = &track->markers[track->markersnr - 1];
 
 		/* find first not-disabled marker */
-		while(first<=track->markersnr-1 && first_marker->flag&MARKER_DISABLED) {
+		while (first <= track->markersnr - 1 && first_marker->flag & MARKER_DISABLED) {
 			first++;
 			first_marker++;
 		}
 
 		/* find last not-disabled marker */
-		while(last>=0 && last_marker->flag&MARKER_DISABLED) {
+		while (last >= 0 && last_marker->flag & MARKER_DISABLED) {
 			last--;
 			last_marker--;
 		}
 
-		if(first<track->markersnr-1)
-			sfra= MIN2(sfra, first_marker->framenr);
+		if (first<track->markersnr - 1)
+			sfra = MIN2(sfra, first_marker->framenr);
 
-		if(last>=0)
-			efra= MAX2(efra, last_marker->framenr);
+		if (last >= 0)
+			efra = MAX2(efra, last_marker->framenr);
 
 		tracks_map_insert(context->tracks_map, track, NULL);
 
-		track= track->next;
+		track = track->next;
 	}
 
-	context->sfra= sfra;
-	context->efra= efra;
+	context->sfra = sfra;
+	context->efra = efra;
 
 #ifdef WITH_LIBMV
-	context->tracks= create_libmv_tracks(tracksbase, width, height*aspy);
-	context->keyframe1= keyframe1;
-	context->keyframe2= keyframe2;
-	context->refine_flags= get_refine_intrinsics_flags(tracking, object);
+	context->tracks = create_libmv_tracks(tracksbase, width, height*aspy);
+	context->keyframe1 = keyframe1;
+	context->keyframe2 = keyframe2;
+	context->refine_flags = get_refine_intrinsics_flags(tracking, object);
 #else
 	(void) width;
 	(void) height;
@@ -1840,13 +1829,13 @@ MovieReconstructContext* BKE_tracking_reconstruction_context_new(MovieTracking *
 	(void) keyframe2;
 #endif
 
-	context->focal_length= camera->focal;
-	context->principal_point[0]= camera->principal[0];
-	context->principal_point[1]= camera->principal[1]*aspy;
+	context->focal_length = camera->focal;
+	context->principal_point[0] = camera->principal[0];
+	context->principal_point[1] = camera->principal[1] * aspy;
 
-	context->k1= camera->k1;
-	context->k2= camera->k2;
-	context->k3= camera->k3;
+	context->k1 = camera->k1;
+	context->k2 = camera->k2;
+	context->k3 = camera->k3;
 
 	return context;
 }
@@ -1854,7 +1843,7 @@ MovieReconstructContext* BKE_tracking_reconstruction_context_new(MovieTracking *
 void BKE_tracking_reconstruction_context_free(MovieReconstructContext *context)
 {
 #ifdef WITH_LIBMV
-	if(context->reconstruction)
+	if (context->reconstruction)
 			libmv_destroyReconstruction(context->reconstruction);
 
 	libmv_tracksDestroy(context->tracks);
@@ -1870,41 +1859,40 @@ static void solve_reconstruction_update_cb(void *customdata, double progress, co
 {
 	ReconstructProgressData *progressdata= customdata;
 
-	if(progressdata->progress) {
-		*progressdata->progress= progress;
-		*progressdata->do_update= 1;
+	if (progressdata->progress) {
+		*progressdata->progress = progress;
+		*progressdata->do_update = TRUE;
 	}
 
-	BLI_snprintf(progressdata->stats_message, progressdata->message_size,
-			"Solving camera | %s", message);
+	BLI_snprintf(progressdata->stats_message, progressdata->message_size, "Solving camera | %s", message);
 }
 #endif
 
 #if 0
 static int solve_reconstruction_testbreak_cb(void *customdata)
 {
-	ReconstructProgressData *progressdata= customdata;
+	ReconstructProgressData *progressdata = customdata;
 
-	if(progressdata->stop && *progressdata->stop)
-		return 1;
+	if (progressdata->stop && *progressdata->stop)
+		return TRUE;
 
 	return G.afbreek;
 }
 #endif
 
-void BKE_tracking_solve_reconstruction(MovieReconstructContext *context, short *stop,
-			short *do_update, float *progress, char *stats_message, int message_size)
+void BKE_tracking_solve_reconstruction(MovieReconstructContext *context, short *stop, short *do_update,
+                                       float *progress, char *stats_message, int message_size)
 {
 #ifdef WITH_LIBMV
 	float error;
 
 	ReconstructProgressData progressdata;
 
-	progressdata.stop= stop;
-	progressdata.do_update= do_update;
-	progressdata.progress= progress;
-	progressdata.stats_message= stats_message;
-	progressdata.message_size= message_size;
+	progressdata.stop = stop;
+	progressdata.do_update = do_update;
+	progressdata.progress = progress;
+	progressdata.stats_message = stats_message;
+	progressdata.message_size = message_size;
 
 	context->reconstruction = libmv_solveReconstruction(context->tracks,
 		context->keyframe1, context->keyframe2,
@@ -1914,9 +1902,9 @@ void BKE_tracking_solve_reconstruction(MovieReconstructContext *context, short *
 		context->k1, context->k2, context->k3,
 		solve_reconstruction_update_cb, &progressdata);
 
-	error= libmv_reprojectionError(context->reconstruction);
+	error = libmv_reprojectionError(context->reconstruction);
 
-	context->reprojection_error= error;
+	context->reprojection_error = error;
 #else
 	(void) context;
 	(void) stop;
@@ -1933,25 +1921,25 @@ int BKE_tracking_finish_reconstruction(MovieReconstructContext *context, MovieTr
 
 	tracks_map_merge(context->tracks_map, tracking);
 
-	if(context->is_camera) {
-		reconstruction= &tracking->reconstruction;
+	if (context->is_camera) {
+		reconstruction = &tracking->reconstruction;
 	}
 	else {
 		MovieTrackingObject *object;
 
-		object= BKE_tracking_named_object(tracking, context->object_name);
-		reconstruction= &object->reconstruction;
+		object = BKE_tracking_named_object(tracking, context->object_name);
+		reconstruction = &object->reconstruction;
 	}
 
-	reconstruction->error= context->reprojection_error;
-	reconstruction->flag|= TRACKING_RECONSTRUCTED;
+	reconstruction->error = context->reprojection_error;
+	reconstruction->flag |= TRACKING_RECONSTRUCTED;
 
 #ifdef WITH_LIBMV
-	if(!retrieve_libmv_reconstruct(context, tracking))
-		return 0;
+	if (!retrieve_libmv_reconstruct(context, tracking))
+		return FALSE;
 #endif
 
-	return 1;
+	return TRUE;
 }
 
 void BKE_track_unique_name(ListBase *tracksbase, MovieTrackingTrack *track)
@@ -1961,14 +1949,14 @@ void BKE_track_unique_name(ListBase *tracksbase, MovieTrackingTrack *track)
 
 MovieTrackingTrack *BKE_tracking_named_track(MovieTracking *tracking, MovieTrackingObject *object, const char *name)
 {
-	ListBase *tracksbase= BKE_tracking_object_tracks(tracking, object);
-	MovieTrackingTrack *track= tracksbase->first;
+	ListBase *tracksbase = BKE_tracking_object_tracks(tracking, object);
+	MovieTrackingTrack *track = tracksbase->first;
 
-	while(track) {
-		if(!strcmp(track->name, name))
+	while (track) {
+		if (!strcmp(track->name, name))
 			return track;
 
-		track= track->next;
+		track = track->next;
 	}
 
 	return NULL;
@@ -1977,51 +1965,59 @@ MovieTrackingTrack *BKE_tracking_named_track(MovieTracking *tracking, MovieTrack
 static int reconstruction_camera_index(MovieTrackingReconstruction *reconstruction, int framenr, int nearest)
 {
 	MovieReconstructedCamera *cameras= reconstruction->cameras;
-	int a= 0, d= 1;
+	int a = 0, d = 1;
 
-	if(!reconstruction->camnr)
+	if (!reconstruction->camnr)
 		return -1;
 
-	if(framenr<cameras[0].framenr) {
-		if(nearest) return 0;
-		else return -1;
+	if (framenr<cameras[0].framenr) {
+		if (nearest)
+			return 0;
+		else
+			return -1;
 	}
 
-	if(framenr>cameras[reconstruction->camnr-1].framenr) {
-		if(nearest) return reconstruction->camnr-1;
-		else return -1;
+	if (framenr>cameras[reconstruction->camnr - 1].framenr) {
+		if (nearest)
+			return reconstruction->camnr - 1;
+		else
+			return -1;
 	}
 
-	if(reconstruction->last_camera<reconstruction->camnr)
-		a= reconstruction->last_camera;
+	if (reconstruction->last_camera<reconstruction->camnr)
+		a = reconstruction->last_camera;
 
-	if(cameras[a].framenr>=framenr)
-		d= -1;
+	if (cameras[a].framenr >= framenr)
+		d = -1;
 
-	while(a>=0 && a<reconstruction->camnr) {
-		int cfra= cameras[a].framenr;
+	while (a >= 0 && a < reconstruction->camnr) {
+		int cfra = cameras[a].framenr;
 
 		/* check if needed framenr was "skipped" -- no data for requested frame */
 
-		if(d>0 && cfra>framenr) {
+		if (d > 0 && cfra > framenr) {
 			/* interpolate with previous position */
-			if(nearest) return a-1;
-			else break;
+			if (nearest)
+				return a - 1;
+			else
+				break;
 		}
 
-		if(d<0 && cfra<framenr) {
+		if (d < 0 && cfra < framenr) {
 			/* interpolate with next position */
-			if(nearest) return a;
-			else break;
+			if (nearest)
+				return a;
+			else
+				break;
 		}
 
-		if(cfra==framenr) {
-			reconstruction->last_camera= a;
+		if (cfra == framenr) {
+			reconstruction->last_camera = a;
 
 			return a;
 		}
 
-		a+= d;
+		a += d;
 	}
 
 	return -1;
@@ -2029,50 +2025,52 @@ static int reconstruction_camera_index(MovieTrackingReconstruction *reconstructi
 
 static void scale_reconstructed_camera(MovieTrackingObject *object, float mat[4][4])
 {
-	if((object->flag&TRACKING_OBJECT_CAMERA)==0) {
+	if ((object->flag & TRACKING_OBJECT_CAMERA) == 0) {
 		float smat[4][4];
 
-		scale_m4_fl(smat, 1.0f/object->scale);
+		scale_m4_fl(smat, 1.0f / object->scale);
 		mult_m4_m4m4(mat, mat, smat);
 	}
 }
 
 MovieReconstructedCamera *BKE_tracking_get_reconstructed_camera(MovieTracking *tracking,
-			MovieTrackingObject *object, int framenr)
+                                                                MovieTrackingObject *object, int framenr)
 {
 	MovieTrackingReconstruction *reconstruction;
 	int a;
 
-	reconstruction= BKE_tracking_object_reconstruction(tracking, object);
-	a= reconstruction_camera_index(reconstruction, framenr, 0);
+	reconstruction = BKE_tracking_object_reconstruction(tracking, object);
+	a = reconstruction_camera_index(reconstruction, framenr, FALSE);
 
-	if(a==-1)
+	if (a ==-1)
 		return NULL;
 
 	return &reconstruction->cameras[a];
 }
 
 void BKE_tracking_get_interpolated_camera(MovieTracking *tracking, MovieTrackingObject *object,
-			int framenr, float mat[4][4])
+                                          int framenr, float mat[4][4])
 {
 	MovieTrackingReconstruction *reconstruction;
 	MovieReconstructedCamera *cameras;
 	int a;
 
-	reconstruction= BKE_tracking_object_reconstruction(tracking, object);
-	cameras= reconstruction->cameras;
-	a= reconstruction_camera_index(reconstruction, framenr, 1);
+	reconstruction = BKE_tracking_object_reconstruction(tracking, object);
+	cameras = reconstruction->cameras;
+	a = reconstruction_camera_index(reconstruction, framenr, 1);
 
-	if(a==-1) {
+	if (a == -1) {
 		unit_m4(mat);
+
 		return;
 	}
 
-	if(cameras[a].framenr!=framenr && a>0 && a<reconstruction->camnr-1) {
-		float t= ((float)framenr-cameras[a].framenr) / (cameras[a+1].framenr-cameras[a].framenr);
+	if (cameras[a].framenr != framenr && a > 0 && a < reconstruction->camnr - 1) {
+		float t = ((float)framenr-cameras[a].framenr) / (cameras[a + 1].framenr-cameras[a].framenr);
 
 		blend_m4_m4m4(mat, cameras[a].mat, cameras[a+1].mat, t);
-	} else {
+	}
+	else {
 		copy_m4_m4(mat, cameras[a].mat);
 	}
 
@@ -2081,12 +2079,14 @@ void BKE_tracking_get_interpolated_camera(MovieTracking *tracking, MovieTracking
 
 void BKE_get_tracking_mat(Scene *scene, Object *ob, float mat[4][4])
 {
-	if(!ob) {
-		if(scene->camera) ob= scene->camera;
-		else ob= scene_find_camera(scene);
+	if (!ob) {
+		if (scene->camera)
+			ob = scene->camera;
+		else
+			ob = scene_find_camera(scene);
 	}
 
-	if(ob)
+	if (ob)
 		where_is_object_mat(scene, ob, mat);
 	else
 		unit_m4(mat);
@@ -2094,53 +2094,54 @@ void BKE_get_tracking_mat(Scene *scene, Object *ob, float mat[4][4])
 
 void BKE_tracking_camera_shift(MovieTracking *tracking, int winx, int winy, float *shiftx, float *shifty)
 {
-	*shiftx= (0.5f*winx-tracking->camera.principal[0]) / winx;
-	*shifty= (0.5f*winy-tracking->camera.principal[1]) / winx;
+	/* indeed in both of cases it should be winx -- it's just how camera shift works for blender's camera */
+	*shiftx = (0.5f * winx-tracking->camera.principal[0]) / winx;
+	*shifty = (0.5f * winy-tracking->camera.principal[1]) / winx;
 }
 
 void BKE_tracking_camera_to_blender(MovieTracking *tracking, Scene *scene, Camera *camera, int width, int height)
 {
-	float focal= tracking->camera.focal;
+	float focal = tracking->camera.focal;
 
-	camera->sensor_x= tracking->camera.sensor_width;
-	camera->sensor_fit= CAMERA_SENSOR_FIT_AUTO;
-	camera->lens= focal*camera->sensor_x/width;
+	camera->sensor_x = tracking->camera.sensor_width;
+	camera->sensor_fit = CAMERA_SENSOR_FIT_AUTO;
+	camera->lens = focal*camera->sensor_x/width;
 
-	scene->r.xsch= width*tracking->camera.pixel_aspect;
-	scene->r.ysch= height;
+	scene->r.xsch = width*tracking->camera.pixel_aspect;
+	scene->r.ysch = height;
 
-	scene->r.xasp= 1.0f;
-	scene->r.yasp= 1.0f;
+	scene->r.xasp = 1.0f;
+	scene->r.yasp = 1.0f;
 
 	BKE_tracking_camera_shift(tracking, width, height, &camera->shiftx, &camera->shifty);
 }
 
 void BKE_tracking_projection_matrix(MovieTracking *tracking, MovieTrackingObject *object,
-			int framenr, int winx, int winy, float mat[4][4])
+                                    int framenr, int winx, int winy, float mat[4][4])
 {
 	MovieReconstructedCamera *camera;
-	float lens= tracking->camera.focal*tracking->camera.sensor_width/(float)winx;
+	float lens = tracking->camera.focal*tracking->camera.sensor_width/(float)winx;
 	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 ycor =  1.0f / tracking->camera.pixel_aspect;
+	float shiftx, shifty, winside = MAX2(winx, winy);
 
 	BKE_tracking_camera_shift(tracking, winx, winy, &shiftx, &shifty);
 
-	clipsta= 0.1f;
-	clipend= 1000.0f;
+	clipsta = 0.1f;
+	clipend = 1000.0f;
 
-	if(winx >= winy)
-		viewfac= (lens*winx)/tracking->camera.sensor_width;
+	if (winx >= winy)
+		viewfac = (lens*winx)/tracking->camera.sensor_width;
 	else
-		viewfac= (ycor*lens*winy)/tracking->camera.sensor_width;
+		viewfac = (ycor*lens*winy)/tracking->camera.sensor_width;
 
-	pixsize= clipsta/viewfac;
+	pixsize = clipsta/viewfac;
 
-	left= -0.5f*(float)winx + shiftx*winside;
-	bottom= -0.5f*(ycor)*(float)winy + shifty*winside;
-	right=  0.5f*(float)winx + shiftx*winside;
-	top=  0.5f*(ycor)*(float)winy + shifty*winside;
+	left = -0.5f * (float)winx + shiftx * winside;
+	bottom = -0.5f * (ycor) * (float)winy + shifty * winside;
+	right =  0.5f * (float)winx + shiftx * winside;
+	top =  0.5f * (ycor) * (float)winy + shifty * winside;
 
 	left *= pixsize;
 	right *= pixsize;
@@ -2149,21 +2150,22 @@ void BKE_tracking_projection_matrix(MovieTracking *tracking, MovieTrackingObject
 
 	perspective_m4(winmat, left, right, bottom, top, clipsta, clipend);
 
-	camera= BKE_tracking_get_reconstructed_camera(tracking, object, framenr);
+	camera = BKE_tracking_get_reconstructed_camera(tracking, object, framenr);
 
-	if(camera) {
+	if (camera) {
 		float imat[4][4];
 
 		invert_m4_m4(imat, camera->mat);
 		mult_m4_m4m4(mat, winmat, imat);
-	} else copy_m4_m4(mat, winmat);
+	}
+	else copy_m4_m4(mat, winmat);
 }
 
 ListBase *BKE_tracking_get_tracks(MovieTracking *tracking)
 {
-	MovieTrackingObject *object= BKE_tracking_active_object(tracking);
+	MovieTrackingObject *object = BKE_tracking_active_object(tracking);
 
-	if(object && (object->flag & TRACKING_OBJECT_CAMERA) == 0) {
+	if (object && (object->flag & TRACKING_OBJECT_CAMERA) == 0) {
 		return &object->tracks;
 	}
 
@@ -2174,13 +2176,13 @@ MovieTrackingTrack *BKE_tracking_active_track(MovieTracking *tracking)
 {
 	ListBase *tracksbase;
 
-	if(!tracking->act_track)
+	if (!tracking->act_track)
 		return NULL;
 
-	tracksbase= BKE_tracking_get_tracks(tracking);
+	tracksbase = BKE_tracking_get_tracks(tracking);
 
 	/* check that active track is in current tracks list */
-	if(BLI_findindex(tracksbase, tracking->act_track) >= 0)
+	if (BLI_findindex(tracksbase, tracking->act_track) >= 0)
 		return tracking->act_track;
 
 	return NULL;
@@ -2193,10 +2195,10 @@ MovieTrackingObject *BKE_tracking_active_object(MovieTracking *tracking)
 
 MovieTrackingObject *BKE_tracking_get_camera_object(MovieTracking *tracking)
 {
-	MovieTrackingObject *object= tracking->objects.first;
+	MovieTrackingObject *object = tracking->objects.first;
 
-	while(object) {
-		if(object->flag & TRACKING_OBJECT_CAMERA)
+	while (object) {
+		if (object->flag & TRACKING_OBJECT_CAMERA)
 			return object;
 
 		object= object->next;
@@ -2207,7 +2209,7 @@ MovieTrackingObject *BKE_tracking_get_camera_object(MovieTracking *tracking)
 
 ListBase *BKE_tracking_object_tracks(MovieTracking *tracking, MovieTrackingObject *object)
 {
-	if(object->flag & TRACKING_OBJECT_CAMERA) {
+	if (object->flag & TRACKING_OBJECT_CAMERA) {
 		return &tracking->tracks;
 	}
 
@@ -2216,7 +2218,7 @@ ListBase *BKE_tracking_object_tracks(MovieTracking *tracking, MovieTrackingObjec
 
 MovieTrackingReconstruction *BKE_tracking_object_reconstruction(MovieTracking *tracking, MovieTrackingObject *object)
 {
-	if(object->flag & TRACKING_OBJECT_CAMERA) {
+	if (object->flag & TRACKING_OBJECT_CAMERA) {
 		return &tracking->reconstruction;
 	}
 
@@ -2225,7 +2227,7 @@ MovieTrackingReconstruction *BKE_tracking_object_reconstruction(MovieTracking *t
 
 MovieTrackingReconstruction *BKE_tracking_get_reconstruction(MovieTracking *tracking)
 {
-	MovieTrackingObject *object= BKE_tracking_active_object(tracking);
+	MovieTrackingObject *object = BKE_tracking_active_object(tracking);
 
 	return BKE_tracking_object_reconstruction(tracking, object);
 }
@@ -2236,42 +2238,42 @@ void BKE_tracking_apply_intrinsics(MovieTracking *tracking, float co[2], float n
 
 #ifdef WITH_LIBMV
 	double x, y;
-	float aspy= 1.0f/tracking->camera.pixel_aspect;
+	float aspy = 1.0f/tracking->camera.pixel_aspect;
 
 	/* normalize coords */
-	x= (co[0]-camera->principal[0]) / camera->focal;
-	y= (co[1]-camera->principal[1] * aspy) / camera->focal;
+	x = (co[0] - camera->principal[0]) / camera->focal;
+	y = (co[1] - camera->principal[1] * aspy) / camera->focal;
 
 	libmv_applyCameraIntrinsics(camera->focal, camera->principal[0], camera->principal[1] * aspy,
-				camera->k1, camera->k2, camera->k3, x, y, &x, &y);
+	                            camera->k1, camera->k2, camera->k3, x, y, &x, &y);
 
 	/* result is in image coords already */
-	nco[0]= x;
-	nco[1]= y;
+	nco[0] = x;
+	nco[1] = y;
 #else
-	(void)camera;
-	(void)co;
-	(void)nco;
+	(void) camera;
+	(void) co;
+	(void) nco;
 #endif
 }
 
 void BKE_tracking_invert_intrinsics(MovieTracking *tracking, float co[2], float nco[2])
 {
-	MovieTrackingCamera *camera= &tracking->camera;
+	MovieTrackingCamera *camera = &tracking->camera;
 
 #ifdef WITH_LIBMV
-	double x= co[0], y= co[1];
-	float aspy= 1.0f/tracking->camera.pixel_aspect;
+	double x = co[0], y = co[1];
+	float aspy = 1.0f / tracking->camera.pixel_aspect;
 
 	libmv_InvertIntrinsics(camera->focal, camera->principal[0], camera->principal[1] * aspy,
-				camera->k1, camera->k2, camera->k3, x, y, &x, &y);
+	                       camera->k1, camera->k2, camera->k3, x, y, &x, &y);
 
-	nco[0]= x * camera->focal + camera->principal[0];
-	nco[1]= y * camera->focal + camera->principal[1] * aspy;
+	nco[0] = x * camera->focal + camera->principal[0];
+	nco[1] = y * camera->focal + camera->principal[1] * aspy;
 #else
-	(void)camera;
-	(void)co;
-	(void)nco;
+	(void) camera;
+	(void) co;
+	(void) nco;
 #endif
 }
 
@@ -2279,125 +2281,126 @@ void BKE_tracking_invert_intrinsics(MovieTracking *tracking, float co[2], float
 static int point_in_stroke(bGPDstroke *stroke, float x, float y)
 {
 	int i, prev;
-	int count= 0;
-	bGPDspoint *points= stroke->points;
+	int count = 0;
+	bGPDspoint *points = stroke->points;
 
-	prev= stroke->totpoints-1;
+	prev = stroke->totpoints - 1;
 
-	for(i= 0; i<stroke->totpoints; i++) {
-		if((points[i].y<y && points[prev].y>=y) || (points[prev].y<y && points[i].y>=y)) {
-			float fac= (y-points[i].y)/(points[prev].y-points[i].y);
+	for (i = 0; i<stroke->totpoints; i++) {
+		if ((points[i].y < y && points[prev].y >= y) || (points[prev].y < y && points[i].y >= y)) {
+			float fac = (y - points[i].y) / (points[prev].y - points[i].y);
 
-			if (points[i].x+fac*(points[prev].x-points[i].x)<x)
+			if (points[i].x + fac * (points[prev].x - points[i].x) < x)
 				count++;
 		}
 
 		prev= i;
 	}
 
-	return count%2;
+	return count % 2;
 }
 
 static int point_in_layer(bGPDlayer *layer, float x, float y)
 {
-	bGPDframe *frame= layer->frames.first;
+	bGPDframe *frame = layer->frames.first;
+
+	while (frame) {
+		bGPDstroke *stroke = frame->strokes.first;
 
-	while(frame) {
-		bGPDstroke *stroke= frame->strokes.first;
-		while(stroke) {
-			if(point_in_stroke(stroke, x, y))
-				return 1;
+		while (stroke) {
+			if (point_in_stroke(stroke, x, y))
+				return TRUE;
 
-			stroke= stroke->next;
+			stroke = stroke->next;
 		}
-		frame= frame->next;
+		frame = frame->next;
 	}
 
-	return 0;
+	return FALSE;
 }
 
 static void retrieve_libmv_features(MovieTracking *tracking, ListBase *tracksbase,
-			struct libmv_Features *features, int framenr, int width, int height,
-			bGPDlayer *layer, int place_outside_layer)
+                                    struct libmv_Features *features, int framenr, int width, int height,
+                                    bGPDlayer *layer, int place_outside_layer)
 {
 	int a;
 
-	a= libmv_countFeatures(features);
-	while(a--) {
+	a = libmv_countFeatures(features);
+	while (a--) {
 		MovieTrackingTrack *track;
 		double x, y, size, score;
-		int ok= 1;
+		int ok = TRUE;
 		float xu, yu;
 
 		libmv_getFeature(features, a, &x, &y, &score, &size);
 
-		xu= x/width;
-		yu= y/height;
+		xu = x / width;
+		yu = y / height;
 
-		if(layer)
-			ok= point_in_layer(layer, xu, yu)!=place_outside_layer;
+		if (layer)
+			ok = point_in_layer(layer, xu, yu) != place_outside_layer;
 
-		if(ok) {
-			track= BKE_tracking_add_track(tracking, tracksbase, xu, yu, framenr, width, height);
-			track->flag|= SELECT;
-			track->pat_flag|= SELECT;
-			track->search_flag|= SELECT;
+		if (ok) {
+			track = BKE_tracking_add_track(tracking, tracksbase, xu, yu, framenr, width, height);
+			track->flag |= SELECT;
+			track->pat_flag |= SELECT;
+			track->search_flag |= SELECT;
 		}
 	}
 }
 #endif
 
 void BKE_tracking_detect_fast(MovieTracking *tracking, ListBase *tracksbase, ImBuf *ibuf,
-			int framenr, int margin, int min_trackness, int min_distance, bGPDlayer *layer,
-			int place_outside_layer)
+                              int framenr, int margin, int min_trackness, int min_distance, bGPDlayer *layer,
+                              int place_outside_layer)
 {
 #ifdef WITH_LIBMV
 	struct libmv_Features *features;
-	unsigned char *pixels= get_ucharbuf(ibuf);
+	unsigned char *pixels = get_ucharbuf(ibuf);
 
-	features= libmv_detectFeaturesFAST(pixels, ibuf->x, ibuf->y, ibuf->x,
-			margin, min_trackness, min_distance);
+	features = libmv_detectFeaturesFAST(pixels, ibuf->x, ibuf->y, ibuf->x,
+	                                    margin, min_trackness, min_distance);
 
 	MEM_freeN(pixels);
 
 	retrieve_libmv_features(tracking, tracksbase, features, framenr,
-			ibuf->x, ibuf->y, layer, place_outside_layer);
+	                        ibuf->x, ibuf->y, layer, place_outside_layer);
 
 	libmv_destroyFeatures(features);
 #else
-	(void)tracking;
-	(void)tracksbase;
-	(void)ibuf;
-	(void)framenr;
-	(void)margin;
-	(void)min_trackness;
-	(void)min_distance;
-	(void)layer;
-	(void)place_outside_layer;
+	(void) tracking;
+	(void) tracksbase;
+	(void) ibuf;
+	(void) framenr;
+	(void) margin;
+	(void) min_trackness;
+	(void) min_distance;
+	(void) layer;
+	(void) place_outside_layer;
 #endif
 }
 
 MovieTrackingTrack *BKE_tracking_indexed_track(MovieTracking *tracking, int tracknr, ListBase **tracksbase_r)
 {
 	MovieTrackingObject *object;
-	int cur= 1;
+	int cur = 1;
 
-	object= tracking->objects.first;
-	while(object) {
-		ListBase *tracksbase= BKE_tracking_object_tracks(tracking, object);
-		MovieTrackingTrack *track= tracksbase->first;
+	object = tracking->objects.first;
+	while (object) {
+		ListBase *tracksbase = BKE_tracking_object_tracks(tracking, object);
+		MovieTrackingTrack *track = tracksbase->first;
 
-		while(track) {
-			if(track->flag&TRACK_HAS_BUNDLE) {
-				if(cur==tracknr) {
-					*tracksbase_r= tracksbase;
+		while (track) {
+			if (track->flag & TRACK_HAS_BUNDLE) {
+				if (cur == tracknr) {
+					*tracksbase_r = tracksbase;
 					return track;
 				}
 
 				cur++;
 			}
 
-			track= track->next;
+			track = track->next;
 		}
 
 		object= object->next;
@@ -2410,166 +2413,183 @@ MovieTrackingTrack *BKE_tracking_indexed_track(MovieTracking *tracking, int trac
 
 static int stabilization_median_point(MovieTracking *tracking, int framenr, float median[2])
 {
-	int ok= 0;
+	int ok = FALSE;
 	float min[2], max[2];
 	MovieTrackingTrack *track;
 
 	INIT_MINMAX2(min, max);
 
-	(void) tracking;
-
-	track= tracking->tracks.first;
-	while(track) {
-		if(track->flag&TRACK_USE_2D_STAB) {
-			MovieTrackingMarker *marker= BKE_tracking_get_marker(track, framenr);
+	track = tracking->tracks.first;
+	while (track) {
+		if (track->flag & TRACK_USE_2D_STAB) {
+			MovieTrackingMarker *marker = BKE_tracking_get_marker(track, framenr);
 
 			DO_MINMAX2(marker->pos, min, max);
 
-			ok= 1;
+			ok = TRUE;
 		}
 
-		track= track->next;
+		track = track->next;
 	}
 
-	median[0]= (max[0]+min[0])/2.0f;
-	median[1]= (max[1]+min[1])/2.0f;
+	median[0] = (max[0] + min[0]) / 2.0f;
+	median[1] = (max[1] + min[1]) / 2.0f;
 
 	return ok;
 }
 
 static void calculate_stabdata(MovieTracking *tracking, int framenr, float width, float height,
-			float firstmedian[2], float median[2], float loc[2], float *scale, float *angle)
+                               float firstmedian[2], float median[2], float loc[2], float *scale, float *angle)
 {
-	MovieTrackingStabilization *stab= &tracking->stabilization;
+	MovieTrackingStabilization *stab = &tracking->stabilization;
 
-	*scale= (stab->scale-1.0f)*stab->scaleinf+1.0f;
-	*angle= 0.0f;
+	*scale = (stab->scale - 1.0f) * stab->scaleinf + 1.0f;
+	*angle = 0.0f;
 
-	loc[0]= (firstmedian[0]-median[0])*width*(*scale);
-	loc[1]= (firstmedian[1]-median[1])*height*(*scale);
+	loc[0] = (firstmedian[0] - median[0]) *width * (*scale);
+	loc[1] = (firstmedian[1] - median[1]) *height * (*scale);
 
 	mul_v2_fl(loc, stab->locinf);
 
-	if((stab->flag&TRACKING_STABILIZE_ROTATION) && stab->rot_track && stab->rotinf) {
+	if ((stab->flag & TRACKING_STABILIZE_ROTATION) && stab->rot_track && stab->rotinf) {
 		MovieTrackingMarker *marker;
 		float a[2], b[2];
-		float x0= (float)width/2.0f, y0= (float)height/2.0f;
-		float x= median[0]*width, y= median[1]*height;
+		float x0 = (float)width / 2.0f, y0 = (float)height / 2.0f;
+		float x = median[0] * width, y = median[1] * height;
 
-		marker= BKE_tracking_get_marker(stab->rot_track, 1);
+		marker = BKE_tracking_get_marker(stab->rot_track, 1);
 		sub_v2_v2v2(a, marker->pos, firstmedian);
-		a[0]*= width;
-		a[1]*= height;
+		a[0] *= width;
+		a[1] *= height;
 
-		marker= BKE_tracking_get_marker(stab->rot_track, framenr);
+		marker = BKE_tracking_get_marker(stab->rot_track, framenr);
 		sub_v2_v2v2(b, marker->pos, median);
-		b[0]*= width;
-		b[1]*= height;
+		b[0] *= width;
+		b[1] *= height;
 
-		*angle= -atan2(a[0]*b[1]-a[1]*b[0], a[0]*b[0]+a[1]*b[1]);
-		*angle*= stab->rotinf;
+		*angle = -atan2(a[0]*b[1]-a[1]*b[0], a[0]*b[0]+a[1]*b[1]);
+		*angle *= stab->rotinf;
 
 		/* convert to rotation around image center */
-		loc[0]-= (x0 + (x-x0)*cosf(*angle)-(y-y0)*sinf(*angle) - x)*(*scale);
-		loc[1]-= (y0 + (x-x0)*sinf(*angle)+(y-y0)*cosf(*angle) - y)*(*scale);
+		loc[0] -= (x0 + (x - x0) * cosf(*angle) - (y - y0) * sinf(*angle) - x) * (*scale);
+		loc[1] -= (y0 + (x - x0) * sinf(*angle) + (y - y0) * cosf(*angle) - y) * (*scale);
 	}
 }
 
 static float stabilization_auto_scale_factor(MovieTracking *tracking, int width, int height)
 {
 	float firstmedian[2];
-	MovieTrackingStabilization *stab= &tracking->stabilization;
+	MovieTrackingStabilization *stab = &tracking->stabilization;
+	float aspect = tracking->camera.pixel_aspect;
 
-	if(stab->ok)
+	if (stab->ok)
 		return stab->scale;
 
-	if(stabilization_median_point(tracking, 1, firstmedian)) {
-		int sfra= INT_MAX, efra= INT_MIN, cfra;
-		float delta[2]= {0.0f, 0.0f}, scalex= 1.0f, scaley= 1.0f;
+	if (stabilization_median_point(tracking, 1, firstmedian)) {
+		int sfra = INT_MAX, efra = INT_MIN, cfra;
+		float scale = 1.0f;
 		MovieTrackingTrack *track;
 
-		stab->scale= 1.0f;
+		stab->scale = 1.0f;
 
-		track= tracking->tracks.first;
-		while(track) {
-			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);
+		track = tracking->tracks.first;
+		while (track) {
+			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);
 			}
 
-			track= track->next;
+			track = track->next;
 		}
 
-		for(cfra=sfra; cfra<=efra; cfra++) {
-			float median[2], near[2];
-			float loc[2], scale, angle;
+		for (cfra = sfra; cfra <= efra; cfra++) {
+			float median[2];
+			float loc[2], angle, tmp_scale;
+			int i;
+			float mat[4][4];
+			float points[4][2] = {{0.0f, 0.0f}, {0.0f, height}, {width, height}, {width, 0.0f}};
+			float si, co;
 
 			stabilization_median_point(tracking, cfra, median);
 
-			calculate_stabdata(tracking, cfra, width, height, firstmedian, median,
-						loc, &scale, &angle);
+			calculate_stabdata(tracking, cfra, width, height, firstmedian, median, loc, &tmp_scale, &angle);
+
+			BKE_tracking_stabdata_to_mat4(width, height, aspect, loc, 1.0f, angle, mat);
+
+			si = sin(angle);
+			co = cos(angle);
 
-			if(angle==0.0f) {
-				loc[0]= fabsf(loc[0]);
-				loc[1]= fabsf(loc[1]);
+			for (i = 0; i < 4; i++) {
+				int j;
+				float a[3] = {0.0f, 0.0f, 0.0f}, b[3]= {0.0f, 0.0f, 0.0f};
 
-				delta[0]= MAX2(delta[0], loc[0]);
-				delta[1]= MAX2(delta[1], loc[1]);
+				copy_v3_v3(a, points[i]);
+				copy_v3_v3(b, points[(i+1)%4]);
 
-				near[0]= MIN2(median[0], 1.0f-median[0]);
-				near[1]= MIN2(median[1], 1.0f-median[1]);
-				near[0]= MAX2(near[0], 0.05f);
-				near[1]= MAX2(near[1], 0.05f);
+				mul_m4_v3(mat, a);
+				mul_m4_v3(mat, b);
 
-				scalex= 1.0f+delta[0]/(near[0]*width);
-				scaley= 1.0f+delta[1]/(near[1]*height);
-			} else {
-				int i;
-				float mat[4][4];
-				float points[4][2]={{0.0f, 0.0f}, {0.0f, height}, {width, height}, {width, 0.0f}};
+				for (j = 0; j < 4; j++) {
+					float point[3] = {points[j][0], points[j][1], 0.0f};
+					float v1[3], v2[3];
 
-				BKE_tracking_stabdata_to_mat4(width, height, loc, scale, angle, mat);
+					sub_v3_v3v3(v1, b, a);
+					sub_v3_v3v3(v2, point, a);
 
-				for(i= 0; i<4; i++) {
-					int j;
-					float a[3]= {0.0f, 0.0f, 0.0f}, b[3]= {0.0f, 0.0f, 0.0f};
+					if (cross_v2v2(v1, v2) >= 0.0f) {
+						const float rotDx[4][2] = {{1.0f, 0.0f}, {0.0f, -1.0f}, {-1.0f, 0.0f}, {0.0f, 1.0f}};
+						const float rotDy[4][2] = {{0.0f, 1.0f}, {1.0f, 0.0f}, {0.0f, -1.0f}, {-1.0f, 0.0f}};
 
-					copy_v3_v3(a, points[i]);
-					copy_v3_v3(b, points[(i+1)%4]);
+						float dx = loc[0] * rotDx[j][0] + loc[1] * rotDx[j][1],
+						      dy = loc[0] * rotDy[j][0] + loc[1] * rotDy[j][1];
 
-					mul_m4_v3(mat, a);
-					mul_m4_v3(mat, b);
+						float w, h, E, F, G, H, I, J, K, S;
 
-					for(j= 0; j<4; j++) {
-						float point[3]= {points[j][0], points[j][1], 0.0f};
-						float v1[3], v2[3];
+						if (j % 2) {
+							w = (float)height / 2.0f;
+							h = (float)width / 2.0f;
+						}
+						else {
+							w = (float)width / 2.0f;
+							h = (float)height / 2.0f;
+						}
 
-						sub_v3_v3v3(v1, b, a);
-						sub_v3_v3v3(v2, point, a);
+						E = -w*co + h*si;
+						F = -h*co - w*si;
 
-						if(cross_v2v2(v1, v2) >= 0.0f) {
-							float dist= dist_to_line_v2(point, a, b);
-							if(i%2==0) {
-								scalex= MAX2(scalex, (width+2*dist)/width);
-							} else {
-								scaley= MAX2(scaley, (height+2*dist)/height);
-							}
+						if ((i % 2) == (j % 2)) {
+							G = -w*co - h*si;
+							H = h*co - w*si;
 						}
+						else {
+							G = w*co + h*si;
+							H = -h*co + w*si;
+						}
+
+						I = F - H;
+						J = G - E;
+						K = G*F - E*H;
+
+						S = (-w*I - h*J) / (dx*I + dy*J + K);
+
+						scale = MAX2(scale, S);
 					}
 				}
 			}
 		}
 
-		stab->scale= MAX2(scalex, scaley);
+		stab->scale = scale;
 
-		if(stab->maxscale>0.0f)
-			stab->scale= MIN2(stab->scale, stab->maxscale);
-	} else {
-		stab->scale= 1.0f;
+		if (stab->maxscale>0.0f)
+			stab->scale = MIN2(stab->scale, stab->maxscale);
+	}
+	else {
+		stab->scale = 1.0f;
 	}
 
-	stab->ok= 1;
+	stab->ok = TRUE;
 
 	return stab->scale;
 }
@@ -2578,25 +2598,26 @@ static ImBuf* stabilize_alloc_ibuf(ImBuf *cacheibuf, ImBuf *srcibuf, int fill)
 {
 	int flags;
 
-	if(cacheibuf && (cacheibuf->x != srcibuf->x || cacheibuf->y != srcibuf->y)) {
+	if (cacheibuf && (cacheibuf->x != srcibuf->x || cacheibuf->y != srcibuf->y)) {
 		IMB_freeImBuf(cacheibuf);
-		cacheibuf= NULL;
+		cacheibuf = NULL;
 	}
 
-	flags= IB_rect;
+	flags = IB_rect;
+
+	if (srcibuf->rect_float)
+		flags |= IB_rectfloat;
 
-	if(srcibuf->rect_float)
-		flags|= IB_rectfloat;
+	if (cacheibuf) {
+		if (fill) {
+			float col[4] = {0.0f, 0.0f, 0.0f, 0.0f};
 
-	if(cacheibuf) {
-		if(fill) {
-			float col[4]= {0.0f, 0.0f, 0.0f, 0.0f};
 			IMB_rectfill(cacheibuf, col);
 		}
 	}
 	else {
-		cacheibuf= IMB_allocImBuf(srcibuf->x, srcibuf->y, srcibuf->planes, flags);
-		cacheibuf->profile= srcibuf->profile;
+		cacheibuf = IMB_allocImBuf(srcibuf->x, srcibuf->y, srcibuf->planes, flags);
+		cacheibuf->profile = srcibuf->profile;
 	}
 
 	return cacheibuf;
@@ -2605,9 +2626,9 @@ static ImBuf* stabilize_alloc_ibuf(ImBuf *cacheibuf, ImBuf *srcibuf, int fill)
 void BKE_tracking_stabilization_data(MovieTracking *tracking, int framenr, int width, int height, float loc[2], float *scale, float *angle)
 {
 	float firstmedian[2], median[2];
-	MovieTrackingStabilization *stab= &tracking->stabilization;
+	MovieTrackingStabilization *stab = &tracking->stabilization;
 
-	if((stab->flag&TRACKING_2D_STABILIZATION)==0) {
+	if ((stab->flag & TRACKING_2D_STABILIZATION) == 0) {
 		zero_v2(loc);
 		*scale= 1.0f;
 		*angle= 0.0f;
@@ -2615,128 +2636,161 @@ void BKE_tracking_stabilization_data(MovieTracking *tracking, int framenr, int w
 		return;
 	}
 
-	if(stabilization_median_point(tracking, 1, firstmedian)) {
+	if (stabilization_median_point(tracking, 1, firstmedian)) {
 		stabilization_median_point(tracking, framenr, median);
 
-		if((stab->flag&TRACKING_AUTOSCALE)==0)
-			stab->scale= 1.0f;
+		if ((stab->flag & TRACKING_AUTOSCALE) == 0)
+			stab->scale = 1.0f;
 
-		if(!stab->ok) {
-			if(stab->flag&TRACKING_AUTOSCALE)
+		if (!stab->ok) {
+			if (stab->flag & TRACKING_AUTOSCALE)
 				stabilization_auto_scale_factor(tracking, width, height);
 
 			calculate_stabdata(tracking, framenr, width, height, firstmedian, median, loc, scale, angle);
 
-			stab->ok= 1;
-		} else {
+			stab->ok = TRUE;
+		}
+		else {
 			calculate_stabdata(tracking, framenr, width, height, firstmedian, median, loc, scale, angle);
 		}
-	} else {
+	}
+	else {
 		zero_v2(loc);
-		*scale= 1.0f;
-		*angle= 0.0f;
+		*scale = 1.0f;
+		*angle = 0.0f;
 	}
 }
 
 ImBuf *BKE_tracking_stabilize(MovieTracking *tracking, int framenr, ImBuf *ibuf, float loc[2], float *scale, float *angle)
 {
 	float tloc[2], tscale, tangle;
-	MovieTrackingStabilization *stab= &tracking->stabilization;
+	MovieTrackingStabilization *stab = &tracking->stabilization;
 	ImBuf *tmpibuf;
-	float width= ibuf->x, height= ibuf->y;
+	float width = ibuf->x, height = ibuf->y;
+	float aspect = tracking->camera.pixel_aspect;
 
-	if(loc)		copy_v2_v2(tloc, loc);
-	if(scale)	tscale= *scale;
+	if (loc)
+		copy_v2_v2(tloc, loc);
 
-	if((stab->flag&TRACKING_2D_STABILIZATION)==0) {
-		if(loc)		zero_v2(loc);
-		if(scale) 	*scale= 1.0f;
+	if (scale)
+		tscale = *scale;
+
+	if ((stab->flag & TRACKING_2D_STABILIZATION) == 0) {
+		if (loc)
+			zero_v2(loc);
+
+		if (scale)
+			*scale = 1.0f;
 
 		return ibuf;
 	}
 
 	BKE_tracking_stabilization_data(tracking, framenr, width, height, tloc, &tscale, &tangle);
 
-	tmpibuf= stabilize_alloc_ibuf(NULL, ibuf, 1);
+	tmpibuf = stabilize_alloc_ibuf(NULL, ibuf, TRUE);
 
 	/* scale would be handled by matrix transformation when angle is non-zero */
-	if(tscale!=1.0f && tangle==0.0f) {
+	if (tscale != 1.0f && tangle == 0.0f) {
 		ImBuf *scaleibuf;
 
 		stabilization_auto_scale_factor(tracking, width, height);
 
-		scaleibuf= stabilize_alloc_ibuf(stab->scaleibuf, ibuf, 0);
-		stab->scaleibuf= scaleibuf;
+		scaleibuf = stabilize_alloc_ibuf(stab->scaleibuf, ibuf, 0);
+		stab->scaleibuf = scaleibuf;
 
 		IMB_rectcpy(scaleibuf, ibuf, 0, 0, 0, 0, ibuf->x, ibuf->y);
 		IMB_scalefastImBuf(scaleibuf, ibuf->x*tscale, ibuf->y*tscale);
 
-		ibuf= scaleibuf;
+		ibuf = scaleibuf;
 	}
 
-	if(tangle==0.0f) {
+	if (tangle == 0.0f) {
 		/* if angle is zero, then it's much faster to use rect copy
-		   but could be issues with subpixel precisions */
-		IMB_rectcpy(tmpibuf, ibuf, tloc[0]-(tscale-1.0f)*width/2.0f, tloc[1]-(tscale-1.0f)*height/2.0f, 0, 0, ibuf->x, ibuf->y);
-	} else {
+		 * but could be issues with subpixel precisions */
+		IMB_rectcpy(tmpibuf, ibuf,
+		            tloc[0] - (tscale - 1.0f) * width / 2.0f,
+		            tloc[1] - (tscale - 1.0f) * height / 2.0f,
+		            0, 0, ibuf->x, ibuf->y);
+	}
+	else {
 		float mat[4][4];
-		int i, j;
+		int i, j, filter = tracking->stabilization.filter;
+		void (*interpolation) (struct ImBuf*, struct ImBuf*, float, float, int, int) = NULL;
 
-		BKE_tracking_stabdata_to_mat4(ibuf->x, ibuf->y, tloc, tscale, tangle, mat);
+		BKE_tracking_stabdata_to_mat4(ibuf->x, ibuf->y, aspect, tloc, tscale, tangle, mat);
 		invert_m4(mat);
 
-		for(j=0; j<tmpibuf->y; j++) {
-			for(i=0; i<tmpibuf->x;i++) {
-				float vec[3]= {i, j, 0};
+		if (filter == TRACKING_FILTER_NEAREAST)
+			interpolation = neareast_interpolation;
+		else if (filter == TRACKING_FILTER_BILINEAR)
+			interpolation = bilinear_interpolation;
+		else if (filter == TRACKING_FILTER_BICUBIC)
+			interpolation = bicubic_interpolation;
+		else
+			/* fallback to default interpolation method */
+			interpolation = neareast_interpolation;
+
+		for (j = 0; j < tmpibuf->y; j++) {
+			for (i = 0; i < tmpibuf->x;i++) {
+				float vec[3] = {i, j, 0};
 
 				mul_v3_m4v3(vec, mat, vec);
 
-				/* TODO: add selector for interpolation method */
-				neareast_interpolation(ibuf, tmpibuf, vec[0], vec[1], i, j);
+				interpolation(ibuf, tmpibuf, vec[0], vec[1], i, j);
 			}
 		}
 	}
 
-	tmpibuf->userflags|= IB_MIPMAP_INVALID;
+	tmpibuf->userflags |= IB_MIPMAP_INVALID;
+
+	if (tmpibuf->rect_float)
+		tmpibuf->userflags |= IB_RECT_INVALID;
+
+	if (loc)
+		copy_v2_v2(loc, tloc);
 
-	if(tmpibuf->rect_float)
-		tmpibuf->userflags|= IB_RECT_INVALID;
+	if (scale)
+		*scale= tscale;
 
-	if(loc)		copy_v2_v2(loc, tloc);
-	if(scale)	*scale= tscale;
-	if(angle)	*angle= tangle;
+	if (angle)
+		*angle= tangle;
 
 	return tmpibuf;
 }
 
-void BKE_tracking_stabdata_to_mat4(int width, int height, float loc[2], float scale, float angle, float mat[4][4])
+void BKE_tracking_stabdata_to_mat4(int width, int height, float aspect, float loc[2], float scale, float angle, float mat[4][4])
 {
-	float lmat[4][4], rmat[4][4], smat[4][4], cmat[4][4], icmat[4][4];
+	float lmat[4][4], rmat[4][4], smat[4][4], cmat[4][4], icmat[4][4], amat[4][4], iamat[4][4];
 	float svec[3]= {scale, scale, scale};
 
 	unit_m4(rmat);
 	unit_m4(lmat);
 	unit_m4(smat);
 	unit_m4(cmat);
+	unit_m4(amat);
+
+	/* aspect ratio correction matrix */
+	amat[0][0] = 1.0f / aspect;
+	invert_m4_m4(iamat, amat);
 
 	/* image center as rotation center */
-	cmat[3][0]= (float)width/2.0f;
-	cmat[3][1]= (float)height/2.0f;
+	cmat[3][0] = (float)width / 2.0f;
+	cmat[3][1] = (float)height / 2.0f;
 	invert_m4_m4(icmat, cmat);
 
 	size_to_mat4(smat, svec);		/* scale matrix */
-	add_v2_v2(lmat[3], loc);		/* tranlation matrix */
+	add_v2_v2(lmat[3], loc);		/* translation matrix */
 	rotate_m4(rmat, 'Z', angle);	/* rotation matrix */
 
 	/* compose transformation matrix */
-	mul_serie_m4(mat, lmat, cmat, rmat, smat, icmat, NULL, NULL, NULL);
+	mul_serie_m4(mat, lmat, cmat, amat, rmat, iamat, smat, icmat, NULL);
 }
 
 MovieDistortion *BKE_tracking_distortion_create(void)
 {
 	MovieDistortion *distortion;
 
-	distortion= MEM_callocN(sizeof(MovieDistortion), "BKE_tracking_distortion_create");
+	distortion = MEM_callocN(sizeof(MovieDistortion), "BKE_tracking_distortion_create");
 
 	return distortion;
 }
@@ -2745,12 +2799,12 @@ MovieDistortion *BKE_tracking_distortion_copy(MovieDistortion *distortion)
 {
 	MovieDistortion *new_distortion;
 
-	new_distortion= MEM_callocN(sizeof(MovieDistortion), "BKE_tracking_distortion_create");
+	new_distortion = MEM_callocN(sizeof(MovieDistortion), "BKE_tracking_distortion_create");
 
 #ifdef WITH_LIBMV
-	new_distortion->intrinsics= libmv_CameraIntrinsicsCopy(distortion->intrinsics);
+	new_distortion->intrinsics = libmv_CameraIntrinsicsCopy(distortion->intrinsics);
 #else
-	(void)distortion;
+	(void) distortion;
 #endif
 
 	return new_distortion;
@@ -2758,58 +2812,62 @@ MovieDistortion *BKE_tracking_distortion_copy(MovieDistortion *distortion)
 
 void BKE_tracking_distortion_update(MovieDistortion *distortion, MovieTracking *tracking, int width, int height)
 {
-	MovieTrackingCamera *camera= &tracking->camera;
-	float aspy= 1.0f/tracking->camera.pixel_aspect;
+	MovieTrackingCamera *camera = &tracking->camera;
+	float aspy = 1.0f / tracking->camera.pixel_aspect;
 
 #ifdef WITH_LIBMV
-	if(!distortion->intrinsics) {
-		distortion->intrinsics= libmv_CameraIntrinsicsNew(camera->focal,
+	if (!distortion->intrinsics) {
+		distortion->intrinsics = libmv_CameraIntrinsicsNew(camera->focal,
 				camera->principal[0], camera->principal[1] * aspy,
 				camera->k1, camera->k2, camera->k3, width, height * aspy);
-	} else {
+	}
+	else {
 		libmv_CameraIntrinsicsUpdate(distortion->intrinsics, camera->focal,
 				camera->principal[0], camera->principal[1] * aspy,
 				camera->k1, camera->k2, camera->k3, width, height * aspy);
 	}
 #else
-	(void)distortion;
-	(void)width;
-	(void)height;
-	(void)camera;
-	(void)aspy;
+	(void) distortion;
+	(void) width;
+	(void) height;
+	(void) camera;
+	(void) aspy;
 #endif
 }
 
 ImBuf *BKE_tracking_distortion_exec(MovieDistortion *distortion, MovieTracking *tracking,
-			ImBuf *ibuf, int width, int height, float overscan, int undistort)
+                                    ImBuf *ibuf, int width, int height, float overscan, int undistort)
 {
 	ImBuf *resibuf;
 
 	BKE_tracking_distortion_update(distortion, tracking, width, height);
 
-	resibuf= IMB_dupImBuf(ibuf);
+	resibuf = IMB_dupImBuf(ibuf);
 
-	if(ibuf->rect_float) {
+	if (ibuf->rect_float) {
 #ifdef WITH_LIBMV
-		if(undistort) {
+		if (undistort) {
 			libmv_CameraIntrinsicsUndistortFloat(distortion->intrinsics,
 						ibuf->rect_float, resibuf->rect_float,
 						ibuf->x, ibuf->y, overscan, ibuf->channels);
-		} else {
+		}
+		else {
 			libmv_CameraIntrinsicsDistortFloat(distortion->intrinsics,
 						ibuf->rect_float, resibuf->rect_float,
 						ibuf->x, ibuf->y, overscan, ibuf->channels);
 		}
 #endif
 
-		ibuf->userflags|= IB_RECT_INVALID;
-	} else {
+		ibuf->userflags |= IB_RECT_INVALID;
+	}
+	else {
 #ifdef WITH_LIBMV
-		if(undistort) {
+		if (undistort) {
 				libmv_CameraIntrinsicsUndistortByte(distortion->intrinsics,
 							(unsigned char*)ibuf->rect, (unsigned char*)resibuf->rect,
 							ibuf->x, ibuf->y, overscan, ibuf->channels);
-		} else {
+		}
+		else {
 			libmv_CameraIntrinsicsDistortByte(distortion->intrinsics,
 						(unsigned char*)ibuf->rect, (unsigned char*)resibuf->rect,
 						ibuf->x, ibuf->y, overscan, ibuf->channels);
@@ -2818,8 +2876,8 @@ ImBuf *BKE_tracking_distortion_exec(MovieDistortion *distortion, MovieTracking *
 	}
 
 #ifndef WITH_LIBMV
-	(void)overscan;
-	(void)undistort;
+	(void) overscan;
+	(void) undistort;
 #endif
 
 	return resibuf;
@@ -2836,20 +2894,20 @@ void BKE_tracking_distortion_destroy(MovieDistortion *distortion)
 
 ImBuf *BKE_tracking_undistort(MovieTracking *tracking, ImBuf *ibuf, int width, int height, float overscan)
 {
-	MovieTrackingCamera *camera= &tracking->camera;
+	MovieTrackingCamera *camera = &tracking->camera;
 
-	if(camera->intrinsics == NULL)
-		camera->intrinsics= BKE_tracking_distortion_create();
+	if (camera->intrinsics == NULL)
+		camera->intrinsics = BKE_tracking_distortion_create();
 
 	return BKE_tracking_distortion_exec(camera->intrinsics, tracking, ibuf, width, height, overscan, 1);
 }
 
 ImBuf *BKE_tracking_distort(MovieTracking *tracking, ImBuf *ibuf, int width, int height, float overscan)
 {
-	MovieTrackingCamera *camera= &tracking->camera;
+	MovieTrackingCamera *camera = &tracking->camera;
 
-	if(camera->intrinsics == NULL)
-		camera->intrinsics= BKE_tracking_distortion_create();
+	if (camera->intrinsics == NULL)
+		camera->intrinsics = BKE_tracking_distortion_create();
 
 	return BKE_tracking_distortion_exec(camera->intrinsics, tracking, ibuf, width, height, overscan, 0);
 }
@@ -2857,21 +2915,24 @@ ImBuf *BKE_tracking_distort(MovieTracking *tracking, ImBuf *ibuf, int width, int
 /* area - which part of marker should be selected. see TRACK_AREA_* constants */
 void BKE_tracking_select_track(ListBase *tracksbase, MovieTrackingTrack *track, int area, int extend)
 {
-	if(extend) {
+	if (extend) {
 		BKE_tracking_track_flag(track, area, SELECT, 0);
-	} else {
-		MovieTrackingTrack *cur= tracksbase->first;
+	}
+	else {
+		MovieTrackingTrack *cur = tracksbase->first;
 
-		while(cur) {
-			if(cur==track) {
-				BKE_tracking_track_flag(cur, TRACK_AREA_ALL, SELECT, 1);
-				BKE_tracking_track_flag(cur, area, SELECT, 0);
-			}
-			else {
-				BKE_tracking_track_flag(cur, TRACK_AREA_ALL, SELECT, 1);
+		while (cur) {
+			if ((cur->flag & TRACK_HIDDEN) == 0) {
+				if (cur == track) {
+					BKE_tracking_track_flag(cur, TRACK_AREA_ALL, SELECT, 1);
+					BKE_tracking_track_flag(cur, area, SELECT, 0);
+				}
+				else {
+					BKE_tracking_track_flag(cur, TRACK_AREA_ALL, SELECT, 1);
+				}
 			}
 
-			cur= cur->next;
+			cur = cur->next;
 		}
 	}
 }
@@ -2883,13 +2944,13 @@ void BKE_tracking_deselect_track(MovieTrackingTrack *track, int area)
 
 MovieTrackingObject *BKE_tracking_new_object(MovieTracking *tracking, const char *name)
 {
-	MovieTrackingObject *object= MEM_callocN(sizeof(MovieTrackingObject), "tracking object");
+	MovieTrackingObject *object = MEM_callocN(sizeof(MovieTrackingObject), "tracking object");
 
-	if(tracking->tot_object==0) {
+	if (tracking->tot_object == 0) {
 		/* first object is always camera */
 		BLI_strncpy(object->name, "Camera", sizeof(object->name));
 
-		object->flag|= TRACKING_OBJECT_CAMERA;
+		object->flag |= TRACKING_OBJECT_CAMERA;
 	}
 	else {
 		BLI_strncpy(object->name, name, sizeof(object->name));
@@ -2898,7 +2959,9 @@ MovieTrackingObject *BKE_tracking_new_object(MovieTracking *tracking, const char
 	BLI_addtail(&tracking->objects, object);
 
 	tracking->tot_object++;
-	tracking->objectnr= BLI_countlist(&tracking->objects) - 1;
+	tracking->objectnr = BLI_countlist(&tracking->objects) - 1;
+
+	object->scale = 1.0f;
 
 	BKE_tracking_object_unique_name(tracking, object);
 
@@ -2908,20 +2971,20 @@ MovieTrackingObject *BKE_tracking_new_object(MovieTracking *tracking, const char
 void BKE_tracking_remove_object(MovieTracking *tracking, MovieTrackingObject *object)
 {
 	MovieTrackingTrack *track;
-	int index= BLI_findindex(&tracking->objects, object);
+	int index = BLI_findindex(&tracking->objects, object);
 
-	if(index<0)
+	if (index<0)
 		return;
 
-	if(object->flag & TRACKING_OBJECT_CAMERA) {
+	if (object->flag & TRACKING_OBJECT_CAMERA) {
 		/* object used for camera solving can't be deleted */
 		return;
 	}
 
-	track= object->tracks.first;
-	while(track) {
-		if(track==tracking->act_track)
-			tracking->act_track= NULL;
+	track = object->tracks.first;
+	while (track) {
+		if (track == tracking->act_track)
+			tracking->act_track = NULL;
 
 		track= track->next;
 	}
@@ -2931,10 +2994,10 @@ void BKE_tracking_remove_object(MovieTracking *tracking, MovieTrackingObject *ob
 
 	tracking->tot_object--;
 
-	if(index>0)
-		tracking->objectnr= index-1;
+	if (index>0)
+		tracking->objectnr = index - 1;
 	else
-		tracking->objectnr= 0;
+		tracking->objectnr = 0;
 }
 
 void BKE_tracking_object_unique_name(MovieTracking *tracking, MovieTrackingObject *object)
@@ -2944,13 +3007,13 @@ void BKE_tracking_object_unique_name(MovieTracking *tracking, MovieTrackingObjec
 
 MovieTrackingObject *BKE_tracking_named_object(MovieTracking *tracking, const char *name)
 {
-	MovieTrackingObject *object= tracking->objects.first;
+	MovieTrackingObject *object = tracking->objects.first;
 
-	while(object) {
-		if(!strcmp(object->name, name))
+	while (object) {
+		if (!strcmp(object->name, name))
 			return object;
 
-		object= object->next;
+		object = object->next;
 	}
 
 	return NULL;
diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c
index 81c526e..48e939b 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -33,8 +33,11 @@
 
 #include "BLI_math.h"
 #include "BLI_string.h"
-#include "BLI_winstuff.h"
+#include "BLI_string_utf8.h"
 
+#ifdef WIN32
+#  include "BLI_winstuff.h"
+#endif
 
 #define TEMP_STR_SIZE 256
 
@@ -76,15 +79,15 @@
 /* define a single unit */
 typedef struct bUnitDef {
 	const char *name;
-	const char *name_plural;	/* abused a bit for the display name */
-	const char *name_short;	/* this is used for display*/
-	const char *name_alt;		/* keyboard-friendly ASCII-only version of name_short, can be NULL */
-						/* if name_short has non-ASCII chars, name_alt should be present */
-	
-	const char *name_display;		/* can be NULL */
+	const char *name_plural; /* abused a bit for the display name */
+	const char *name_short; /* this is used for display*/
+	const char *name_alt; /* keyboard-friendly ASCII-only version of name_short, can be NULL */
+	/* if name_short has non-ASCII chars, name_alt should be present */
+
+	const char *name_display; /* can be NULL */
 
 	double scalar;
-	double bias;		/* not used yet, needed for converting temperature */
+	double bias; /* not used yet, needed for converting temperature */
 	int flag;
 } bUnitDef;
 
@@ -94,19 +97,15 @@ typedef struct bUnitDef {
 /* define a single unit */
 typedef struct bUnitCollection {
 	struct bUnitDef *units;
-	int base_unit;				/* basic unit index (when user doesn't specify unit explicitly) */
-	int flag;					/* options for this system */
-	int length;					/* to quickly find the last item */
+	int base_unit; /* basic unit index (when user doesn't specify unit explicitly) */
+	int flag; /* options for this system */
+	int length; /* to quickly find the last item */
 } bUnitCollection;
 
 /* Dummy */
-static struct bUnitDef buDummyDef[] = {
-	{"",	NULL, "",	NULL, NULL, 1.0, 0.0},
-	{NULL,	NULL, NULL,	NULL, NULL, 0.0, 0.0}
-};
+static struct bUnitDef buDummyDef[] = { {"", NULL, "", NULL, NULL, 1.0, 0.0}, {NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}};
 static struct bUnitCollection buDummyCollecton = {buDummyDef, 0, 0, sizeof(buDummyDef)};
 
-
 /* Lengths */
 static struct bUnitDef buMetricLenDef[] = {
 	{"kilometer", "kilometers",		"km", NULL,	"Kilometers", UN_SC_KM, 0.0,	B_UNIT_DEF_NONE},
@@ -120,10 +119,10 @@ static struct bUnitDef buMetricLenDef[] = {
 
 	/* These get displayed because of float precision problems in the transform header,
 	 * could work around, but for now probably people wont use these */
-	/*
+#if 0
 	{"nanometer", "Nanometers",		"nm", NULL,	0.000000001, 0.0,	B_UNIT_DEF_NONE},
 	{"picometer", "Picometers",		"pm", NULL,	0.000000000001, 0.0,B_UNIT_DEF_NONE},
-	*/
+#endif
 	{NULL, NULL, NULL,	NULL, NULL, 0.0, 0.0}
 };
 static struct bUnitCollection buMetricLenCollecton = {buMetricLenDef, 3, 0, sizeof(buMetricLenDef)/sizeof(bUnitDef)};
@@ -132,7 +131,7 @@ static struct bUnitDef buImperialLenDef[] = {
 	{"mile", "miles",		"mi", "m", "Miles",		UN_SC_MI, 0.0,	B_UNIT_DEF_NONE},
 	{"furlong", "furlongs",	"fur", NULL, "Furlongs",UN_SC_FUR, 0.0,	B_UNIT_DEF_SUPPRESS},
 	{"chain", "chains",		"ch", NULL, "Chains",	UN_SC_CH, 0.0,	B_UNIT_DEF_SUPPRESS},
-	{"yard", "yards",		"yd", NULL, "Yards",	UN_SC_YD, 0.0,	B_UNIT_DEF_NONE},
+	{"yard", "yards",		"yd", NULL, "Yards",	UN_SC_YD, 0.0,	B_UNIT_DEF_SUPPRESS},
 	{"foot", "feet",		"'", "ft", "Feet",		UN_SC_FT, 0.0,	B_UNIT_DEF_NONE}, /* base unit */
 	{"inch", "inches",		"\"", "in", "Inches",	UN_SC_IN, 0.0,	B_UNIT_DEF_NONE},
 	{"thou", "thou",		"thou", "mil", "Thou",	UN_SC_MIL, 0.0,	B_UNIT_DEF_NONE}, /* plural for thou has no 's' */
@@ -292,154 +291,159 @@ static bUnitDef *unit_default(bUnitCollection *usys)
 static bUnitDef *unit_best_fit(double value, bUnitCollection *usys, bUnitDef *unit_start, int suppress)
 {
 	bUnitDef *unit;
-	double value_abs= value>0.0?value:-value;
+	double value_abs = value > 0.0 ? value : -value;
 
-	for(unit= unit_start ? unit_start:usys->units; unit->name; unit++) {
+	for (unit = unit_start ? unit_start : usys->units; unit->name; unit++) {
 
-		if(suppress && (unit->flag & B_UNIT_DEF_SUPPRESS))
+		if (suppress && (unit->flag & B_UNIT_DEF_SUPPRESS))
 			continue;
 
 		/* scale down scalar so 1cm doesnt convert to 10mm because of float error */
-		if (value_abs >= unit->scalar*(1.0-EPS))
+		if (value_abs >= unit->scalar * (1.0 - EPS))
 			return unit;
 	}
 
 	return unit_default(usys);
 }
 
-
-
 /* convert into 2 units and 2 values for "2ft, 3inch" syntax */
-static void unit_dual_convert(double value, bUnitCollection *usys,
-		bUnitDef **unit_a, bUnitDef **unit_b, double *value_a, double *value_b)
+static void unit_dual_convert(double value, bUnitCollection *usys, bUnitDef **unit_a, bUnitDef **unit_b,
+                              double *value_a, double *value_b)
 {
-	bUnitDef *unit= unit_best_fit(value, usys, NULL, 1);
+	bUnitDef *unit = unit_best_fit(value, usys, NULL, 1);
 
-	*value_a=  (value < 0.0 ? ceil:floor)(value/unit->scalar) * unit->scalar;
-	*value_b= value - (*value_a);
+	*value_a = (value < 0.0 ? ceil : floor)(value / unit->scalar) * unit->scalar;
+	*value_b = value - (*value_a);
 
-	*unit_a=	unit;
-	*unit_b=	unit_best_fit(*value_b, usys, *unit_a, 1);
+	*unit_a = unit;
+	*unit_b = unit_best_fit(*value_b, usys, *unit_a, 1);
 }
 
 static int unit_as_string(char *str, int len_max, double value, int prec, bUnitCollection *usys,
-		/* non exposed options */
-		bUnitDef *unit, char pad)
+                          /* non exposed options */
+                          bUnitDef *unit, char pad)
 {
 	double value_conv;
 	int len, i;
-	
-	if(unit) {
+
+	if (unit) {
 		/* use unit without finding the best one */
 	}
-	else if(value == 0.0) {
+	else if (value == 0.0) {
 		/* use the default units since there is no way to convert */
-		unit= unit_default(usys);
+		unit = unit_default(usys);
 	}
 	else {
-		unit= unit_best_fit(value, usys, NULL, 1);
+		unit = unit_best_fit(value, usys, NULL, 1);
 	}
 
-	value_conv= value/unit->scalar;
+	value_conv = value / unit->scalar;
 
 	/* Convert to a string */
 	{
-		len= BLI_snprintf(str, len_max, "%.*f", prec, value_conv);
+		len = BLI_snprintf(str, len_max, "%.*f", prec, value_conv);
 
-		if(len >= len_max)
-			len= len_max;
+		if (len >= len_max)
+			len = len_max;
 	}
-	
+
 	/* Add unit prefix and strip zeros */
 
 	/* replace trailing zero's with spaces
 	 * so the number is less complicated but allignment in a button wont
 	 * jump about while dragging */
-	i= len-1;
+	i = len - 1;
 
-	while(i>0 && str[i]=='0') { /* 4.300 -> 4.3 */
-		str[i--]= pad;
+	while (i > 0 && str[i] == '0') { /* 4.300 -> 4.3 */
+		str[i--] = pad;
 	}
 
-	if(i>0 && str[i]=='.') { /* 10. -> 10 */
-		str[i--]= pad;
+	if (i > 0 && str[i] == '.') { /* 10. -> 10 */
+		str[i--] = pad;
 	}
-	
+
 	/* Now add the suffix */
-	if(i<len_max) {
-		int j=0;
+	if (i < len_max) {
+		int j = 0;
 		i++;
-		while(unit->name_short[j] && (i < len_max)) {
-			str[i++]= unit->name_short[j++];
+		while (unit->name_short[j] && (i < len_max)) {
+			str[i++] = unit->name_short[j++];
 		}
 
-		if(pad) {
+		if (pad) {
 			/* this loop only runs if so many zeros were removed that
 			 * the unit name only used padded chars,
 			 * In that case add padding for the name. */
 
-			while(i<=len+j && (i < len_max)) {
-				str[i++]= pad;
+			while (i <= len + j && (i < len_max)) {
+				str[i++] = pad;
 			}
 		}
 	}
 
 	/* terminate no matter whats done with padding above */
-	if(i >= len_max)
-		i= len_max-1;
+	if (i >= len_max)
+		i = len_max - 1;
 
 	str[i] = '\0';
 	return i;
 }
 
-
 /* Used for drawing number buttons, try keep fast */
 void bUnit_AsString(char *str, int len_max, double value, int prec, int system, int type, int split, int pad)
 {
 	bUnitCollection *usys = unit_get_system(system, type);
 
-	if(usys==NULL || usys->units[0].name==NULL)
-		usys= &buDummyCollecton;
-   
+	if (usys == NULL || usys->units[0].name == NULL)
+		usys = &buDummyCollecton;
+
 	/* split output makes sense only for length, mass and time */
-	if(split && (type==B_UNIT_LENGTH || type==B_UNIT_MASS || type==B_UNIT_TIME)) {
+	if (split && (type == B_UNIT_LENGTH || type == B_UNIT_MASS || type == B_UNIT_TIME)) {
 		bUnitDef *unit_a, *unit_b;
 		double value_a, value_b;
 
-		unit_dual_convert(value, usys,		&unit_a, &unit_b, &value_a, &value_b);
+		unit_dual_convert(value, usys, &unit_a, &unit_b, &value_a, &value_b);
 
 		/* check the 2 is a smaller unit */
-		if(unit_b > unit_a) {
-			int i= unit_as_string(str, len_max, value_a, prec, usys,  unit_a, '\0');
+		if (unit_b > unit_a) {
+			int i = unit_as_string(str, len_max, value_a, prec, usys, unit_a, '\0');
 
 			/* is there enough space for at least 1 char of the next unit? */
-			if(i+2 < len_max) {
-				str[i++]= ' ';
+			if (i + 2 < len_max) {
+				str[i++] = ' ';
 
 				/* use low precision since this is a smaller unit */
-				unit_as_string(str+i, len_max-i, value_b, prec?1:0, usys,  unit_b, '\0');
+				unit_as_string(str + i, len_max - i, value_b, prec ? 1 : 0, usys, unit_b, '\0');
 			}
 			return;
 		}
 	}
 
-	unit_as_string(str, len_max, value, prec, usys,    NULL, pad?' ':'\0');
+	unit_as_string(str, len_max, value, prec, usys, NULL, pad ? ' ' : '\0');
 }
 
+BLI_INLINE int isalpha_or_utf8(const int ch)
+{
+	return (ch >= 128 || isalpha(ch));
+}
 
 static const char *unit_find_str(const char *str, const char *substr)
 {
 	const char *str_found;
 
-	if(substr && substr[0] != '\0') {
-		str_found= strstr(str, substr);
-		if(str_found) {
+	if (substr && substr[0] != '\0') {
+		str_found = strstr(str, substr);
+		if (str_found) {
 			/* previous char cannot be a letter */
-			if (str_found == str || isalpha(*(str_found-1))==0) {
+			if (str_found == str ||
+			    /* weak unicode support!, so "µm" won't match up be replaced by "m"
+			     * since non ascii utf8 values will NEVER return TRUE */
+			    isalpha_or_utf8(*BLI_str_prev_char_utf8(str_found)) == 0)
+			{
 				/* next char cannot be alphanum */
 				int len_name = strlen(substr);
 
-				if (!isalpha(*(str_found+len_name))) {
+				if (!isalpha_or_utf8(*(str_found + len_name))) {
 					return str_found;
 				}
 			}
@@ -462,91 +466,91 @@ static const char *unit_find_str(const char *str, const char *substr)
 /* not too strict, (- = * /) are most common  */
 static int ch_is_op(char op)
 {
-	switch(op) {
-	case '+':
-	case '-':
-	case '*':
-	case '/':
-	case '|':
-	case '&':
-	case '~':
-	case '<':
-	case '>':
-	case '^':
-	case '!':
-	case '=':
-	case '%':
-		return 1;
-	default:
-		return 0;
+	switch (op) {
+		case '+':
+		case '-':
+		case '*':
+		case '/':
+		case '|':
+		case '&':
+		case '~':
+		case '<':
+		case '>':
+		case '^':
+		case '!':
+		case '=':
+		case '%':
+			return 1;
+		default:
+			return 0;
 	}
 }
 
-static int unit_scale_str(char *str, int len_max, char *str_tmp,
-                          double scale_pref, bUnitDef *unit, const char *replace_str)
+static int unit_scale_str(char *str, int len_max, char *str_tmp, double scale_pref, bUnitDef *unit,
+                          const char *replace_str)
 {
 	char *str_found;
 
-	if((len_max>0) && (str_found= (char *)unit_find_str(str, replace_str))) {
+	if ((len_max > 0) && (str_found = (char *)unit_find_str(str, replace_str))) {
 		/* XXX - investigate, does not respect len_max properly  */
 
 		int len, len_num, len_name, len_move, found_ofs;
 
-		found_ofs = (int)(str_found-str);
+		found_ofs = (int)(str_found - str);
 
-		len= strlen(str);
+		len = strlen(str);
 
 		len_name = strlen(replace_str);
-		len_move= (len - (found_ofs+len_name)) + 1; /* 1+ to copy the string terminator */
-		len_num= BLI_snprintf(str_tmp, TEMP_STR_SIZE, "*%g"SEP_STR, unit->scalar/scale_pref); /* # removed later */
+		len_move = (len - (found_ofs + len_name)) + 1; /* 1+ to copy the string terminator */
+		len_num = BLI_snprintf(str_tmp, TEMP_STR_SIZE, "*%g"SEP_STR, unit->scalar / scale_pref); /* # removed later */
 
-		if(len_num > len_max)
-			len_num= len_max;
+		if (len_num > len_max)
+			len_num = len_max;
 
-		if(found_ofs+len_num+len_move > len_max) {
+		if (found_ofs + len_num + len_move > len_max) {
 			/* can't move the whole string, move just as much as will fit */
-			len_move -= (found_ofs+len_num+len_move) - len_max;
+			len_move -= (found_ofs + len_num + len_move) - len_max;
 		}
 
-		if(len_move>0) {
+		if (len_move > 0) {
 			/* resize the last part of the string */
-			memmove(str_found+len_num, str_found+len_name, len_move); /* may grow or shrink the string */
+			memmove(str_found + len_num, str_found + len_name, len_move); /* may grow or shrink the string */
 		}
 
-		if(found_ofs+len_num > len_max) {
+		if (found_ofs + len_num > len_max) {
 			/* not even the number will fit into the string, only copy part of it */
-			len_num -= (found_ofs+len_num) - len_max;
+			len_num -= (found_ofs + len_num) - len_max;
 		}
 
-		if(len_num > 0) {
+		if (len_num > 0) {
 			/* its possible none of the number could be copied in */
 			memcpy(str_found, str_tmp, len_num); /* without the string terminator */
 		}
 
 		/* since the null terminator wont be moved if the stringlen_max
 		 * was not long enough to fit everything in it */
-		str[len_max-1]= '\0';
+		str[len_max - 1] = '\0';
 		return found_ofs + len_num;
 	}
 	return 0;
 }
 
 static int unit_replace(char *str, int len_max, char *str_tmp, double scale_pref, bUnitDef *unit)
-{	
-	int ofs= 0;
-	ofs += unit_scale_str(str+ofs, len_max-ofs, str_tmp, scale_pref, unit, unit->name_short);
-	ofs += unit_scale_str(str+ofs, len_max-ofs, str_tmp, scale_pref, unit, unit->name_plural);
-	ofs += unit_scale_str(str+ofs, len_max-ofs, str_tmp, scale_pref, unit, unit->name_alt);
-	ofs += unit_scale_str(str+ofs, len_max-ofs, str_tmp, scale_pref, unit, unit->name);
+{
+	int ofs = 0;
+	ofs += unit_scale_str(str + ofs, len_max - ofs, str_tmp, scale_pref, unit, unit->name_short);
+	ofs += unit_scale_str(str + ofs, len_max - ofs, str_tmp, scale_pref, unit, unit->name_plural);
+	ofs += unit_scale_str(str + ofs, len_max - ofs, str_tmp, scale_pref, unit, unit->name_alt);
+	ofs += unit_scale_str(str + ofs, len_max - ofs, str_tmp, scale_pref, unit, unit->name);
 	return ofs;
 }
 
 static int unit_find(const char *str, bUnitDef *unit)
 {
-	if (unit_find_str(str, unit->name_short))	return 1;
-	if (unit_find_str(str, unit->name_plural))	return 1;
-	if (unit_find_str(str, unit->name_alt))		return 1;
-	if (unit_find_str(str, unit->name))			return 1;
+	if (unit_find_str(str, unit->name_short))   return 1;
+	if (unit_find_str(str, unit->name_plural))  return 1;
+	if (unit_find_str(str, unit->name_alt))     return 1;
+	if (unit_find_str(str, unit->name))         return 1;
 
 	return 0;
 }
@@ -554,11 +558,11 @@ static int unit_find(const char *str, bUnitDef *unit)
 /* make a copy of the string that replaces the units with numbers
  * this is used before parsing
  * This is only used when evaluating user input and can afford to be a bit slower
- * 
+ *
  * This is to be used before python evaluation so..
  * 10.1km -> 10.1*1000.0
  * ...will be resolved by python.
- * 
+ *
  * values will be split by a comma's
  * 5'2" -> 5'0.0254, 2*0.3048
  *
@@ -572,67 +576,64 @@ int bUnit_ReplaceString(char *str, int len_max, const char *str_prev, double sca
 
 	bUnitDef *unit;
 	char str_tmp[TEMP_STR_SIZE];
-	int change= 0;
+	int change = 0;
 
-	if(usys==NULL || usys->units[0].name==NULL) {
+	if (usys == NULL || usys->units[0].name == NULL) {
 		return 0;
 	}
-	
 
-	{	/* make lowercase */
+	{ /* make lowercase */
 		int i;
-		char *ch= str;
+		char *ch = str;
 
-		for(i=0; (i>=len_max || *ch=='\0'); i++, ch++)
-			if((*ch>='A') && (*ch<='Z'))
-				*ch += ('a'-'A');
+		for (i = 0; (i >= len_max || *ch == '\0'); i++, ch++)
+			if ((*ch >= 'A') && (*ch <= 'Z'))
+				*ch += ('a' - 'A');
 	}
 
-
-	for(unit= usys->units; unit->name; unit++) {
-		/* incase there are multiple instances */
-		while(unit_replace(str, len_max, str_tmp, scale_pref, unit))
-			change= 1;
+	for (unit = usys->units; unit->name; unit++) {
+		/* in case there are multiple instances */
+		while (unit_replace(str, len_max, str_tmp, scale_pref, unit))
+			change = 1;
 	}
-	unit= NULL;
+	unit = NULL;
 
 	{
 		/* try other unit systems now, so we can evaluate imperial when metric is set for eg. */
 		bUnitCollection *usys_iter;
 		int system_iter;
 
-		for(system_iter= 0; system_iter<UNIT_SYSTEM_TOT; system_iter++) {
+		for (system_iter = 0; system_iter < UNIT_SYSTEM_TOT; system_iter++) {
 			if (system_iter != system) {
-				usys_iter= unit_get_system(system_iter, type);
+				usys_iter = unit_get_system(system_iter, type);
 				if (usys_iter) {
-					for(unit= usys_iter->units; unit->name; unit++) {
+					for (unit = usys_iter->units; unit->name; unit++) {
 						int ofs = 0;
-						/* incase there are multiple instances */
-						while((ofs=unit_replace(str+ofs, len_max-ofs, str_tmp, scale_pref, unit)))
-							change= 1;
+						/* in case there are multiple instances */
+						while ((ofs = unit_replace(str + ofs, len_max - ofs, str_tmp, scale_pref, unit)))
+							change = 1;
 					}
 				}
 			}
 		}
 	}
-	unit= NULL;
-	
-	if(change==0) {
+	unit = NULL;
+
+	if (change == 0) {
 		/* no units given so infer a unit from the previous string or default */
-		if(str_prev) {
+		if (str_prev) {
 			/* see which units the original value had */
-			for(unit= usys->units; unit->name; unit++) {
+			for (unit = usys->units; unit->name; unit++) {
 				if (unit_find(str_prev, unit))
 					break;
 			}
 		}
 
-		if(unit==NULL || unit->name == NULL)
-			unit= unit_default(usys);
+		if (unit == NULL || unit->name == NULL)
+			unit = unit_default(usys);
 
-
-		/* add the unit prefix and re-run, use brackets incase there was an expression given */
-		if(BLI_snprintf(str_tmp, sizeof(str_tmp), "(%s)%s", str, unit->name) < sizeof(str_tmp)) {
+		/* add the unit prefix and re-run, use brackets in case there was an expression given */
+		if (BLI_snprintf(str_tmp, sizeof(str_tmp), "(%s)%s", str, unit->name) < sizeof(str_tmp)) {
 			strncpy(str, str_tmp, len_max);
 			return bUnit_ReplaceString(str, len_max, NULL, scale_pref, system, type);
 		}
@@ -650,29 +651,29 @@ int bUnit_ReplaceString(char *str, int len_max, const char *str_prev, double sca
 	 *
 	 * */
 	{
-		char *str_found= str;
-		char *ch= str;
+		char *str_found = str;
+		char *ch = str;
 
-		while((str_found= strchr(str_found, SEP_CHR))) {
+		while ((str_found = strchr(str_found, SEP_CHR))) {
 
-			int op_found= 0;
+			int op_found = 0;
 			/* any operators after this?*/
-			for(ch= str_found+1; *ch!='\0'; ch++) {
+			for (ch = str_found + 1; *ch != '\0'; ch++) {
 
-				if(*ch==' ' || *ch=='\t') {
+				if (*ch == ' ' || *ch == '\t') {
 					/* do nothing */
 				}
-				else if (ch_is_op(*ch) || *ch==',') { /* found an op, no need to insert a ,*/
-					op_found= 1;
+				else if (ch_is_op(*ch) || *ch == ',') { /* found an op, no need to insert a ,*/
+					op_found = 1;
 					break;
 				}
 				else { /* found a non-op character */
-					op_found= 0;
+					op_found = 0;
 					break;
 				}
 			}
 
-			*str_found++ = op_found ? ' ':',';
+			*str_found++ = op_found ? ' ' : ',';
 		}
 	}
 
@@ -685,34 +686,33 @@ void bUnit_ToUnitAltName(char *str, int len_max, const char *orig_str, int syste
 	bUnitCollection *usys = unit_get_system(system, type);
 
 	bUnitDef *unit;
-	bUnitDef *unit_def= unit_default(usys);
+	bUnitDef *unit_def = unit_default(usys);
 
 	/* find and substitute all units */
-	for(unit= usys->units; unit->name; unit++) {
-		if(len_max > 0 && (unit->name_alt || unit == unit_def))
-		{
-			const char *found= unit_find_str(orig_str, unit->name_short);
-			if(found) {
-				int offset= (int)(found - orig_str);
-				int len_name= 0;
+	for (unit = usys->units; unit->name; unit++) {
+		if (len_max > 0 && (unit->name_alt || unit == unit_def)) {
+			const char *found = unit_find_str(orig_str, unit->name_short);
+			if (found) {
+				int offset = (int)(found - orig_str);
+				int len_name = 0;
 
 				/* copy everything before the unit */
-				offset= (offset<len_max? offset: len_max);
+				offset = (offset < len_max ? offset : len_max);
 				strncpy(str, orig_str, offset);
 
-				str+= offset;
-				orig_str+= offset + strlen(unit->name_short);
-				len_max-= offset;
+				str += offset;
+				orig_str += offset + strlen(unit->name_short);
+				len_max -= offset;
 
 				/* print the alt_name */
-				if(unit->name_alt)
-					len_name= BLI_snprintf(str, len_max, "%s", unit->name_alt);
+				if (unit->name_alt)
+					len_name = BLI_snprintf(str, len_max, "%s", unit->name_alt);
 				else
-					len_name= 0;
+					len_name = 0;
 
-				len_name= (len_name<len_max? len_name: len_max);
-				str+= len_name;
-				len_max-= len_name;
+				len_name = (len_name < len_max ? len_name : len_max);
+				str += len_name;
+				len_max -= len_name;
 			}
 		}
 	}
@@ -726,11 +726,11 @@ double bUnit_ClosestScalar(double value, int system, int type)
 	bUnitCollection *usys = unit_get_system(system, type);
 	bUnitDef *unit;
 
-	if(usys==NULL)
+	if (usys == NULL)
 		return -1;
 
-	unit= unit_best_fit(value, usys, NULL, 1);
-	if(unit==NULL)
+	unit = unit_best_fit(value, usys, NULL, 1);
+	if (unit == NULL)
 		return -1;
 
 	return unit->scalar;
@@ -748,18 +748,17 @@ int bUnit_IsValid(int system, int type)
 	return !(system < 0 || system > UNIT_SYSTEM_TOT || type < 0 || type > B_UNIT_TYPE_TOT);
 }
 
-
 void bUnit_GetSystem(void **usys_pt, int *len, int system, int type)
 {
 	bUnitCollection *usys = unit_get_system(system, type);
-	*usys_pt= usys;
+	*usys_pt = usys;
 
-	if(usys==NULL) {
-		*len= 0;
+	if (usys == NULL) {
+		*len = 0;
 		return;
 	}
 
-	*len= usys->length;
+	*len = usys->length;
 }
 
 int bUnit_GetBaseUnit(void *usys_pt)
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index b3f1e14..07a83da 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -56,17 +56,17 @@ void free_world(World *wrld)
 	MTex *mtex;
 	int a;
 	
-	for(a=0; a<MAX_MTEX; a++) {
+	for (a=0; a<MAX_MTEX; a++) {
 		mtex= wrld->mtex[a];
-		if(mtex && mtex->tex) mtex->tex->id.us--;
-		if(mtex) MEM_freeN(mtex);
+		if (mtex && mtex->tex) mtex->tex->id.us--;
+		if (mtex) MEM_freeN(mtex);
 	}
 	BKE_previewimg_free(&wrld->preview);
 
 	BKE_free_animdata((ID *)wrld);
 
 	/* is no lib link block, but world extension */
-	if(wrld->nodetree) {
+	if (wrld->nodetree) {
 		ntreeFreeTree(wrld->nodetree);
 		MEM_freeN(wrld->nodetree);
 	}
@@ -120,18 +120,18 @@ World *copy_world(World *wrld)
 	
 	wrldn= copy_libblock(&wrld->id);
 	
-	for(a=0; a<MAX_MTEX; a++) {
-		if(wrld->mtex[a]) {
+	for (a=0; a<MAX_MTEX; a++) {
+		if (wrld->mtex[a]) {
 			wrldn->mtex[a]= MEM_mallocN(sizeof(MTex), "copy_world");
 			memcpy(wrldn->mtex[a], wrld->mtex[a], sizeof(MTex));
 			id_us_plus((ID *)wrldn->mtex[a]->tex);
 		}
 	}
 
-	if(wrld->nodetree)
+	if (wrld->nodetree)
 		wrldn->nodetree= ntreeCopyTree(wrld->nodetree);
 	
-	if(wrld->preview)
+	if (wrld->preview)
 		wrldn->preview = BKE_previewimg_copy(wrld->preview);
 
 	return wrldn;
@@ -145,8 +145,8 @@ World *localize_world(World *wrld)
 	wrldn= copy_libblock(&wrld->id);
 	BLI_remlink(&G.main->world, wrldn);
 	
-	for(a=0; a<MAX_MTEX; a++) {
-		if(wrld->mtex[a]) {
+	for (a=0; a<MAX_MTEX; a++) {
+		if (wrld->mtex[a]) {
 			wrldn->mtex[a]= MEM_mallocN(sizeof(MTex), "localize_world");
 			memcpy(wrldn->mtex[a], wrld->mtex[a], sizeof(MTex));
 			/* free world decrements */
@@ -154,7 +154,7 @@ World *localize_world(World *wrld)
 		}
 	}
 
-	if(wrld->nodetree)
+	if (wrld->nodetree)
 		wrldn->nodetree= ntreeLocalize(wrld->nodetree);
 	
 	wrldn->preview= NULL;
@@ -169,36 +169,36 @@ void make_local_world(World *wrld)
 	int is_local= FALSE, is_lib= FALSE;
 
 	/* - only lib users: do nothing
-		* - only local users: set flag
-		* - mixed: make copy
-		*/
+	 * - only local users: set flag
+	 * - mixed: make copy
+	 */
 	
-	if(wrld->id.lib==NULL) return;
-	if(wrld->id.us==1) {
+	if (wrld->id.lib==NULL) return;
+	if (wrld->id.us==1) {
 		id_clear_lib_data(bmain, &wrld->id);
 		return;
 	}
 	
-	for(sce= bmain->scene.first; sce && ELEM(FALSE, is_lib, is_local); sce= sce->id.next) {
-		if(sce->world == wrld) {
-			if(sce->id.lib) is_lib= TRUE;
+	for (sce= bmain->scene.first; sce && ELEM(FALSE, is_lib, is_local); sce= sce->id.next) {
+		if (sce->world == wrld) {
+			if (sce->id.lib) is_lib= TRUE;
 			else is_local= TRUE;
 		}
 	}
 
-	if(is_local && is_lib==FALSE) {
+	if (is_local && is_lib==FALSE) {
 		id_clear_lib_data(bmain, &wrld->id);
 	}
-	else if(is_local && is_lib) {
+	else if (is_local && is_lib) {
 		World *wrld_new= copy_world(wrld);
 		wrld_new->id.us= 0;
 
 		/* Remap paths of new ID using old library as base. */
 		BKE_id_lib_local_paths(bmain, wrld->id.lib, &wrld_new->id);
 
-		for(sce= bmain->scene.first; sce; sce= sce->id.next) {
-			if(sce->world == wrld) {
-				if(sce->id.lib==NULL) {
+		for (sce= bmain->scene.first; sce; sce= sce->id.next) {
+			if (sce->world == wrld) {
+				if (sce->id.lib==NULL) {
 					sce->world= wrld_new;
 					wrld_new->id.us++;
 					wrld->id.us--;
diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c
index dbb37ad..ba8a462 100644
--- a/source/blender/blenkernel/intern/writeavi.c
+++ b/source/blender/blenkernel/intern/writeavi.c
@@ -112,7 +112,7 @@ bMovieHandle *BKE_get_movie_handle(const char imtype)
 	}
 #endif
 
-	/* incase all above are disabled */
+	/* in case all above are disabled */
 	(void)imtype;
 
 	return &mh;
@@ -201,7 +201,7 @@ static int append_avi(RenderData *UNUSED(rd), int start_frame, int frame, int *p
 		memcpy (rt1, rt2, rectx*sizeof(int));
 		
 		cp= (char *)rt1;
-		for(x= rectx; x>0; x--) {
+		for (x= rectx; x>0; x--) {
 			rt= cp[0];
 			cp[0]= cp[3];
 			cp[3]= rt;
@@ -231,7 +231,7 @@ static void end_avi(void)
 void BKE_makeanimstring(char *string, RenderData *rd)
 {
 	bMovieHandle *mh= BKE_get_movie_handle(rd->im_format.imtype);
-	if(mh->get_movie_path)
+	if (mh->get_movie_path)
 		mh->get_movie_path(string, rd);
 	else
 		string[0]= '\0';
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index c4c3eb4..59c3811 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -123,7 +123,7 @@ static int write_audio_frame(void)
 					audio_outbuf_size,
 					(short*) audio_input_buffer);
 
-	if(pkt.size < 0)
+	if (pkt.size < 0)
 	{
 		// XXX error("Error writing audio packet");
 		return -1;
@@ -131,7 +131,7 @@ static int write_audio_frame(void)
 
 	pkt.data = audio_output_buffer;
 
-	if(c->coded_frame && c->coded_frame->pts != AV_NOPTS_VALUE)
+	if (c->coded_frame && c->coded_frame->pts != AV_NOPTS_VALUE)
 	{
 		pkt.pts = av_rescale_q(c->coded_frame->pts,
 				       c->time_base, audio_stream->time_base);
@@ -172,7 +172,7 @@ static AVFrame* alloc_picture(int pix_fmt, int width, int height)
 }
 
 /* Get the correct file extensions for the requested format,
-   first is always desired guess_format parameter */
+ * first is always desired guess_format parameter */
 static const char** get_file_extensions(int format) 
 {
 	switch(format) {
@@ -262,7 +262,8 @@ static int write_video_frame(RenderData *rd, int cfra, AVFrame* frame, ReportLis
 						  c->time_base,
 						  video_stream->time_base);
 			fprintf(stderr, "Video Frame PTS: %d\n", (int)packet.pts);
-		} else {
+		}
+		else {
 			fprintf(stderr, "Video Frame PTS: not set\n");
 		}
 		if (c->coded_frame->key_frame)
@@ -272,7 +273,8 @@ static int write_video_frame(RenderData *rd, int cfra, AVFrame* frame, ReportLis
 		packet.size = outsize;
 		ret = av_interleaved_write_frame(outfile, &packet);
 		success = (ret == 0);
-	} else if (outsize < 0) {
+	}
+	else if (outsize < 0) {
 		success = 0;
 	}
 
@@ -298,14 +300,15 @@ static AVFrame* generate_video_frame(uint8_t* pixels, ReportList *reports)
 			BKE_report(reports, RPT_ERROR, "Couldn't allocate temporary frame.");
 			return NULL;
 		}
-	} else {
+	}
+	else {
 		rgb_frame = current_frame;
 	}
 
 	rendered_frame = pixels;
 
 	/* Do RGBA-conversion and flipping in one step depending
-	   on CPU-Endianess */
+	 * on CPU-Endianess */
 
 	if (ENDIAN_ORDER == L_ENDIAN) {
 		int y;
@@ -324,7 +327,8 @@ static AVFrame* generate_video_frame(uint8_t* pixels, ReportList *reports)
 				src += 4;
 			}
 		}
-	} else {
+	}
+	else {
 		int y;
 		for (y = 0; y < height; y++) {
 			uint8_t* target = rgb_frame->data[0]
@@ -383,10 +387,12 @@ static void set_ffmpeg_property_option(AVCodecContext* c, IDProperty * prop)
 		if (param) {
 			if (IDP_Int(prop)) {
 				av_set_string3(c, name, param, 1, &rv);
-			} else {
+			}
+			else {
 				return;
 			}
-		} else {
+		}
+		else {
 			rv = av_set_int(c, prop->name, IDP_Int(prop));
 		}
 		break;
@@ -402,8 +408,8 @@ static int ffmpeg_proprty_valid(AVCodecContext *c, const char *prop_name, IDProp
 {
 	int valid= 1;
 
-	if(strcmp(prop_name, "video")==0) {
-		if(strcmp(curr->name, "bf")==0) {
+	if (strcmp(prop_name, "video")==0) {
+		if (strcmp(curr->name, "bf")==0) {
 			/* flash codec doesn't support b frames */
 			valid&= c->codec_id!=CODEC_ID_FLV1;
 		}
@@ -430,7 +436,7 @@ static void set_ffmpeg_properties(RenderData *rd, AVCodecContext *c, const char
 	iter = IDP_GetGroupIterator(prop);
 
 	while ((curr = IDP_GroupIterNext(iter)) != NULL) {
-		if(ffmpeg_proprty_valid(c, prop_name, curr))
+		if (ffmpeg_proprty_valid(c, prop_name, curr))
 			set_ffmpeg_property_option(c, curr);
 	}
 }
@@ -462,11 +468,13 @@ static AVStream* alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
 	if (ffmpeg_type == FFMPEG_DV && rd->frs_sec != 25) {
 		c->time_base.den = 2997;
 		c->time_base.num = 100;
-	} else if ((double) ((int) rd->frs_sec_base) == 
+	}
+	else if ((double) ((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;
-	} else {
+	}
+	else {
 		c->time_base.den = rd->frs_sec * 100000;
 		c->time_base.num = ((double) rd->frs_sec_base) * 100000;
 	}
@@ -488,7 +496,8 @@ static AVStream* alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
 
 	if (codec->pix_fmts) {
 		c->pix_fmt = codec->pix_fmts[0];
-	} else {
+	}
+	else {
 		/* makes HuffYUV happy ... */
 		c->pix_fmt = PIX_FMT_YUV422P;
 	}
@@ -506,12 +515,25 @@ static AVStream* alloc_video_stream(RenderData *rd, int codec_id, AVFormatContex
 	}
 	
 	// Keep lossless encodes in the RGB domain.
-	if (codec_id == CODEC_ID_HUFFYUV || codec_id == CODEC_ID_FFV1) {
+	if (codec_id == CODEC_ID_HUFFYUV) {
 		/* HUFFYUV was PIX_FMT_YUV422P before */
 		c->pix_fmt = PIX_FMT_RGB32;
 	}
 
-	if ( codec_id == CODEC_ID_QTRLE ) {
+	if (codec_id == CODEC_ID_FFV1) {
+#ifdef FFMPEG_FFV1_ALPHA_SUPPORTED
+		if (rd->im_format.planes ==  R_IMF_PLANES_RGBA) {
+			c->pix_fmt = PIX_FMT_RGB32;
+		}
+		else {
+			c->pix_fmt = PIX_FMT_BGR0;
+		}
+#else
+		c->pix_fmt = PIX_FMT_RGB32;
+#endif
+	}
+
+	if (codec_id == CODEC_ID_QTRLE ) {
 		if (rd->im_format.planes ==  R_IMF_PLANES_RGBA) {
 			c->pix_fmt = PIX_FMT_ARGB;
 		}
@@ -606,18 +628,17 @@ static AVStream* alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContex
 	}
 
 	/* need to prevent floating point exception when using vorbis audio codec,
-	   initialize this value in the same way as it's done in FFmpeg iteslf (sergey) */
+	 * initialize this value in the same way as it's done in FFmpeg iteslf (sergey) */
 	st->codec->time_base.num= 1;
 	st->codec->time_base.den= st->codec->sample_rate;
 
 	audio_outbuf_size = FF_MIN_BUFFER_SIZE;
 
-	if((c->codec_id >= CODEC_ID_PCM_S16LE) && (c->codec_id <= CODEC_ID_PCM_DVD))
+	if ((c->codec_id >= CODEC_ID_PCM_S16LE) && (c->codec_id <= CODEC_ID_PCM_DVD))
 		audio_input_samples = audio_outbuf_size * 8 / c->bits_per_coded_sample / c->channels;
-	else
-	{
+	else {
 		audio_input_samples = c->frame_size;
-		if(c->frame_size * c->channels * sizeof(int16_t) * 4 > audio_outbuf_size)
+		if (c->frame_size * c->channels * sizeof(int16_t) * 4 > audio_outbuf_size)
 			audio_outbuf_size = c->frame_size * c->channels * sizeof(int16_t) * 4;
 	}
 
@@ -684,7 +705,8 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report
 	of->packet_size= rd->ffcodecdata.mux_packet_size;
 	if (ffmpeg_audio_codec != CODEC_ID_NONE) {
 		of->mux_rate = rd->ffcodecdata.mux_rate;
-	} else {
+	}
+	else {
 		of->mux_rate = 0;
 	}
 
@@ -834,7 +856,8 @@ void flush_ffmpeg(void)
 						  c->time_base,
 						  video_stream->time_base);
 			fprintf(stderr, "Video Frame PTS: %d\n", (int)packet.pts);
-		} else {
+		}
+		else {
 			fprintf(stderr, "Video Frame PTS: not set\n");
 		}
 		if (c->coded_frame->key_frame) {
@@ -853,8 +876,8 @@ void flush_ffmpeg(void)
 }
 
 /* **********************************************************************
-   * public interface
-   ********************************************************************** */
+ * * public interface
+ * ********************************************************************** */
 
 /* Get the output filename-- similar to the other output formats */
 void filepath_ffmpeg(char* string, RenderData* rd)
@@ -890,7 +913,8 @@ void filepath_ffmpeg(char* string, RenderData* rd)
 
 		BLI_path_frame_range(string, rd->sfra, rd->efra, 4);
 		strcat(string, *exts);
-	} else {
+	}
+	else {
 		*(string + strlen(string) - strlen(*fe)) = 0;
 		strcat(string, autosplit);
 		strcat(string, *fe);
@@ -905,7 +929,7 @@ int start_ffmpeg(struct Scene *scene, RenderData *rd, int rectx, int recty, Repo
 
 	success = start_ffmpeg_impl(rd, rectx, recty, reports);
 #ifdef WITH_AUDASPACE
-	if(audio_stream)
+	if (audio_stream)
 	{
 		AVCodecContext* c = audio_stream->codec;
 		AUD_DeviceSpecs specs;
@@ -930,7 +954,7 @@ static void write_audio_frames(double to_pts)
 	int finished = 0;
 
 	while (audio_stream && !finished) {
-		if((audio_time >= to_pts) ||
+		if ((audio_time >= to_pts) ||
 		   (write_audio_frame())) {
 			finished = 1;
 		}
@@ -950,7 +974,7 @@ int append_ffmpeg(RenderData *rd, int start_frame, int frame, int *pixels, int r
 // 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)
+	if (video_stream)
 	{
 		avframe= generate_video_frame((unsigned char*) pixels, reports);
 		success= (avframe && write_video_frame(rd, frame - start_frame, avframe, reports));
@@ -981,8 +1005,7 @@ void end_ffmpeg(void)
 	}*/
 
 #ifdef WITH_AUDASPACE
-	if(audio_mixdown_device)
-	{
+	if (audio_mixdown_device) {
 		AUD_closeReadDevice(audio_mixdown_device);
 		audio_mixdown_device = 0;
 	}
@@ -1098,7 +1121,8 @@ IDProperty *ffmpeg_property_add(RenderData *rd, const char *type, int opt_index,
 
 	if (parent_index) {
 		BLI_snprintf(name, sizeof(name), "%s:%s", parent->name, o->name);
-	} else {
+	}
+	else {
 		BLI_strncpy(name, o->name, sizeof(name));
 	}
 
@@ -1141,13 +1165,14 @@ IDProperty *ffmpeg_property_add(RenderData *rd, const char *type, int opt_index,
 
 /* not all versions of ffmpeg include that, so here we go ... */
 
-static const AVOption *my_av_find_opt(void *v, const char *name, 
-					  const char *unit, int mask, int flags){
+static const AVOption *my_av_find_opt(void *v, const char *name,
+                                      const char *unit, int mask, int flags)
+{
 	AVClass *c= *(AVClass**)v; 
 	const AVOption *o= c->option;
 
-	for(;o && o->name; o++){
-		if(!strcmp(o->name, name) && 
+	for (;o && o->name; o++) {
+		if (!strcmp(o->name, name) && 
 		   (!unit || (o->unit && !strcmp(o->unit, unit))) && 
 		   (o->flags & mask) == flags )
 			return o;
@@ -1194,7 +1219,8 @@ int ffmpeg_property_add_string(RenderData *rd, const char * type, const char * s
 		prop = ffmpeg_property_add(rd,
 			(char*) type, p - c.av_class->option, 
 			o - c.av_class->option);
-	} else {
+	}
+	else {
 		prop = ffmpeg_property_add(rd,
 			(char*) type, o - c.av_class->option, 0);
 	}
@@ -1224,10 +1250,10 @@ static void ffmpeg_set_expert_options(RenderData *rd)
 {
 	int codec_id = rd->ffcodecdata.codec;
 
-	if(rd->ffcodecdata.properties)
+	if (rd->ffcodecdata.properties)
 		IDP_FreeProperty(rd->ffcodecdata.properties);
 
-	if(codec_id == CODEC_ID_H264) {
+	if (codec_id == CODEC_ID_H264) {
 		/*
 		 * All options here are for x264, but must be set via ffmpeg.
 		 * The names are therefore different - Search for "x264 to FFmpeg option mapping"
@@ -1244,7 +1270,7 @@ static void ffmpeg_set_expert_options(RenderData *rd)
 		 * The other options were taken from the libx264-default.preset
 		 * included in the ffmpeg distribution.
 		 */
-//		ffmpeg_property_add_string(rd, "video", "flags:loop"); // this breakes compatibility for QT
+//		ffmpeg_property_add_string(rd, "video", "flags:loop"); // this breaks compatibility for QT
 		ffmpeg_property_add_string(rd, "video", "cmp:chroma");
 		ffmpeg_property_add_string(rd, "video", "partitions:parti4x4");
 		ffmpeg_property_add_string(rd, "video", "partitions:partp8x8");
@@ -1267,12 +1293,12 @@ static void ffmpeg_set_expert_options(RenderData *rd)
 		ffmpeg_property_add_string(rd, "video", "flags2:fastpskip");
 		ffmpeg_property_add_string(rd, "video", "wpredp:2");
 
-		if(rd->ffcodecdata.flags & FFMPEG_LOSSLESS_OUTPUT)
+		if (rd->ffcodecdata.flags & FFMPEG_LOSSLESS_OUTPUT)
 			ffmpeg_property_add_string(rd, "video", "cqp:0");
 	}
 #if 0	/* disabled for after release */
-	else if(codec_id == CODEC_ID_DNXHD) {
-		if(rd->ffcodecdata.flags & FFMPEG_LOSSLESS_OUTPUT)
+	else if (codec_id == CODEC_ID_DNXHD) {
+		if (rd->ffcodecdata.flags & FFMPEG_LOSSLESS_OUTPUT)
 			ffmpeg_property_add_string(rd, "video", "mbd:rd");
 	}
 #endif
@@ -1282,7 +1308,7 @@ void ffmpeg_set_preset(RenderData *rd, int preset)
 {
 	int isntsc = (rd->frs_sec != 25);
 
-	if(rd->ffcodecdata.properties)
+	if (rd->ffcodecdata.properties)
 		IDP_FreeProperty(rd->ffcodecdata.properties);
 
 	switch (preset) {
@@ -1349,11 +1375,11 @@ void ffmpeg_set_preset(RenderData *rd, int preset)
 
 	case FFMPEG_PRESET_THEORA:
 	case FFMPEG_PRESET_XVID:
-		if(preset == FFMPEG_PRESET_XVID) {
+		if (preset == FFMPEG_PRESET_XVID) {
 			rd->ffcodecdata.type = FFMPEG_AVI;
 			rd->ffcodecdata.codec = CODEC_ID_MPEG4;
 		}
-		else if(preset == FFMPEG_PRESET_THEORA) {
+		else if (preset == FFMPEG_PRESET_THEORA) {
 			rd->ffcodecdata.type = FFMPEG_OGG; // XXX broken
 			rd->ffcodecdata.codec = CODEC_ID_THEORA;
 		}
@@ -1376,8 +1402,8 @@ void ffmpeg_verify_image_type(RenderData *rd, ImageFormatData *imf)
 {
 	int audio= 0;
 
-	if(imf->imtype == R_IMF_IMTYPE_FFMPEG) {
-		if(rd->ffcodecdata.type <= 0 ||
+	if (imf->imtype == R_IMF_IMTYPE_FFMPEG) {
+		if (rd->ffcodecdata.type <= 0 ||
 		   rd->ffcodecdata.codec <= 0 ||
 		   rd->ffcodecdata.audio_codec <= 0 ||
 		   rd->ffcodecdata.video_bitrate <= 1) {
@@ -1386,32 +1412,32 @@ void ffmpeg_verify_image_type(RenderData *rd, ImageFormatData *imf)
 
 			ffmpeg_set_preset(rd, FFMPEG_PRESET_DVD);
 		}
-		if(rd->ffcodecdata.type == FFMPEG_OGG) {
+		if (rd->ffcodecdata.type == FFMPEG_OGG) {
 			rd->ffcodecdata.type = FFMPEG_MPEG2;
 		}
 
 		audio= 1;
 	}
-	else if(imf->imtype == R_IMF_IMTYPE_H264) {
-		if(rd->ffcodecdata.codec != CODEC_ID_H264) {
+	else if (imf->imtype == R_IMF_IMTYPE_H264) {
+		if (rd->ffcodecdata.codec != CODEC_ID_H264) {
 			ffmpeg_set_preset(rd, FFMPEG_PRESET_H264);
 			audio= 1;
 		}
 	}
-	else if(imf->imtype == R_IMF_IMTYPE_XVID) {
-		if(rd->ffcodecdata.codec != CODEC_ID_MPEG4) {
+	else if (imf->imtype == R_IMF_IMTYPE_XVID) {
+		if (rd->ffcodecdata.codec != CODEC_ID_MPEG4) {
 			ffmpeg_set_preset(rd, FFMPEG_PRESET_XVID);
 			audio= 1;
 		}
 	}
-	else if(imf->imtype == R_IMF_IMTYPE_THEORA) {
-		if(rd->ffcodecdata.codec != CODEC_ID_THEORA) {
+	else if (imf->imtype == R_IMF_IMTYPE_THEORA) {
+		if (rd->ffcodecdata.codec != CODEC_ID_THEORA) {
 			ffmpeg_set_preset(rd, FFMPEG_PRESET_THEORA);
 			audio= 1;
 		}
 	}
 
-	if(audio && rd->ffcodecdata.audio_codec < 0) {
+	if (audio && rd->ffcodecdata.audio_codec < 0) {
 		rd->ffcodecdata.audio_codec = CODEC_ID_NONE;
 		rd->ffcodecdata.audio_bitrate = 128;
 	}
@@ -1422,4 +1448,19 @@ void ffmpeg_verify_codec_settings(RenderData *rd)
 	ffmpeg_set_expert_options(rd);
 }
 
+int ffmpeg_alpha_channel_supported(RenderData *rd)
+{
+	int codec = rd->ffcodecdata.codec;
+
+	if (codec == CODEC_ID_QTRLE)
+		return TRUE;
+
+#ifdef FFMPEG_FFV1_ALPHA_SUPPORTED
+	if (codec == CODEC_ID_FFV1)
+		return TRUE;
+#endif
+
+	return FALSE;
+}
+
 #endif
diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c
index c163155..62e921f 100644
--- a/source/blender/blenkernel/intern/writeframeserver.c
+++ b/source/blender/blenkernel/intern/writeframeserver.c
@@ -206,8 +206,7 @@ static int handle_request(RenderData *rd, char * req)
 
 	*p = 0;
 
-	if (strcmp(path, "/index.html") == 0
-		|| strcmp(path, "/") == 0) {
+	if (strcmp(path, "/index.html") == 0 || strcmp(path, "/") == 0) {
 		safe_puts(index_page);
 		return -1;
 	}
@@ -301,9 +300,11 @@ int frameserver_loop(RenderData *rd, ReportList *UNUSED(reports))
 			rval = select(connsock + 1, &readfds, NULL, NULL, &tv);
 		if (rval > 0) {
 			break;
-		} else if (rval == 0) {
+		}
+		else if (rval == 0) {
 			return -1;
-		} else if (rval < 0) {
+		}
+		else if (rval < 0) {
 			if (!select_was_interrupted_by_signal()) {
 				return -1;
 			}
diff --git a/source/blender/blenkernel/nla_private.h b/source/blender/blenkernel/nla_private.h
index e287606..51a7ac7 100644
--- a/source/blender/blenkernel/nla_private.h
+++ b/source/blender/blenkernel/nla_private.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NLA_PRIVATE
-#define NLA_PRIVATE
+#ifndef __NLA_PRIVATE_H__
+#define __NLA_PRIVATE_H__
 
 /* --------------- NLA Evaluation DataTypes ----------------------- */
 
@@ -85,4 +85,4 @@ NlaEvalStrip *nlastrips_ctime_get_strip(ListBase *list, ListBase *strips, short
 void nlastrip_evaluate(PointerRNA *ptr, ListBase *channels, ListBase *modifiers, NlaEvalStrip *nes);
 void nladata_flush_channels(ListBase *channels);
 
-#endif // NLA_PRIVATE
+#endif // __NLA_PRIVATE_H__
diff --git a/source/blender/blenlib/BLI_args.h b/source/blender/blenlib/BLI_args.h
index 3b8b60b..7a7529f 100644
--- a/source/blender/blenlib/BLI_args.h
+++ b/source/blender/blenlib/BLI_args.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BLI_ARGS_H
-#define BLI_ARGS_H
+#ifndef __BLI_ARGS_H__
+#define __BLI_ARGS_H__
 
 /** \file BLI_args.h
  *  \ingroup bli
diff --git a/source/blender/blenlib/BLI_array.h b/source/blender/blenlib/BLI_array.h
index a5453f1..dac0143 100644
--- a/source/blender/blenlib/BLI_array.h
+++ b/source/blender/blenlib/BLI_array.h
@@ -51,7 +51,7 @@
  *
  * arrays are buffered, using double-buffering (so on each reallocation,
  * the array size is doubled).  supposedly this should give good Big Oh
- * behaviour, though it may not be the best in practice.
+ * behavior, though it may not be the best in practice.
  */
 
 #define BLI_array_declare(arr)                                                \
@@ -64,12 +64,12 @@
 #define BLI_array_staticdeclare(arr, maxstatic)                               \
 	int   _##arr##_count = 0;                                                 \
 	void *_##arr##_tmp;                                                       \
-	char _##arr##_static[maxstatic*sizeof(arr)]
+	char  _##arr##_static[maxstatic * sizeof(arr)]
 
 
 /* this returns the entire size of the array, including any buffering. */
 #define BLI_array_totalsize_dyn(arr)  (                                       \
-	((arr)==NULL) ?                                                           \
+	((arr) == NULL) ?                                                         \
 	    0 :                                                                   \
 	    MEM_allocN_len(arr) / sizeof(*arr)                                    \
 )
@@ -117,8 +117,8 @@
 
 /* grow an array by a specified number of items */
 #define BLI_array_growitems(arr, num)  (                                      \
-	((void *)(arr)==NULL && (void *)(_##arr##_static) != NULL) ?              \
-	    ((arr= (void*)_##arr##_static), (_##arr##_count += num)) :            \
+	((void *)(arr) == NULL && (void *)(_##arr##_static) != NULL) ?            \
+	    ((arr = (void*)_##arr##_static), (_##arr##_count += num)) :           \
 	    _bli_array_grow_items(arr, num)                                       \
 )
 
@@ -141,7 +141,7 @@
 )
 
 #define BLI_array_reserve(arr, num)                                           \
-	BLI_array_growitems(arr, num), (void)(_##arr##_count -= num)
+	BLI_array_growitems(arr, num), (void)(_##arr##_count -= (num))
 
 
 #define BLI_array_free(arr)                                                   \
@@ -151,15 +151,15 @@
 	}
 
 #define BLI_array_pop(arr)  (                                                 \
-	(arr&&_##arr##_count) ?                                                   \
+	(arr && _##arr##_count) ?                                                 \
 	    arr[--_##arr##_count] :                                               \
-	    0                                                                     \
+	    NULL                                                                  \
 )
 
 /* resets the logical size of an array to zero, but doesn't
  * free the memory. */
 #define BLI_array_empty(arr)                                                  \
-	_##arr##_count=0
+	_##arr##_count = 0
 
 /* set the count of the array, doesn't actually increase the allocated array
  * size.  don't use this unless you know what you're doing. */
@@ -177,11 +177,11 @@
  * same purpose as BLI_array_staticdeclare()
  * but use when the max size is known ahead of time */
 #define BLI_array_fixedstack_declare(arr, maxstatic, realsize, allocstr)      \
-	char _##arr##_static[maxstatic*sizeof(*arr)];                             \
-	const int _##arr##_is_static= ((void *)_##arr##_static) != (              \
-	    arr= (realsize <= maxstatic) ?                                        \
+	char _##arr##_static[maxstatic * sizeof(*(arr))];                         \
+	const int _##arr##_is_static = ((void *)_##arr##_static) != (             \
+	    arr = ((realsize) <= maxstatic) ?                                     \
 	        (void *)_##arr##_static :                                         \
-	        MEM_mallocN(sizeof(*arr)*realsize, allocstr)                      \
+	        MEM_mallocN(sizeof(*(arr)) * (realsize), allocstr)                \
 	    )                                                                     \
 
 #define BLI_array_fixedstack_free(arr)                                        \
diff --git a/source/blender/blenlib/BLI_bitmap.h b/source/blender/blenlib/BLI_bitmap.h
new file mode 100644
index 0000000..2aed71a
--- /dev/null
+++ b/source/blender/blenlib/BLI_bitmap.h
@@ -0,0 +1,82 @@
+/*
+ * ***** 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 Nicholas Bishop
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BLI_BITMAP_H__
+#define __BLI_BITMAP_H__
+
+typedef unsigned int* BLI_bitmap;
+
+/* warning: the bitmap does not keep track of its own size or check
+ * for out-of-bounds access */
+
+/* internal use */
+/* 2^5 = 32 (bits) */
+#define BLI_BITMAP_POWER 5
+/* 0b11111 */
+#define BLI_BITMAP_MASK 31
+
+/* number of blocks needed to hold '_tot' bits */
+#define BLI_BITMAP_NUM_BLOCKS(_tot) \
+	(((_tot) >> BLI_BITMAP_POWER) + 1)
+
+/* size (in bytes) used to hold '_tot' bits */
+#define BLI_BITMAP_SIZE(_tot) \
+	(BLI_BITMAP_NUM_BLOCKS(_tot) * sizeof(unsigned int))
+
+/* allocate memory for a bitmap with '_tot' bits; free
+ *  with MEM_freeN() */
+#define BLI_BITMAP_NEW(_tot, _alloc_string) \
+	((BLI_bitmap)MEM_callocN(BLI_BITMAP_SIZE(_tot), \
+							 _alloc_string))
+
+/* get the value of a single bit at '_index' */
+#define BLI_BITMAP_GET(_bitmap, _index) \
+	((_bitmap)[(_index) >> BLI_BITMAP_POWER] & \
+	 (1 << ((_index) & BLI_BITMAP_MASK)))
+
+/* set the value of a single bit at '_index' */
+#define BLI_BITMAP_SET(_bitmap, _index) \
+	((_bitmap)[(_index) >> BLI_BITMAP_POWER] |= \
+	 (1 << ((_index) & BLI_BITMAP_MASK)))
+
+/* clear the value of a single bit at '_index' */
+#define BLI_BITMAP_CLEAR(_bitmap, _index) \
+	((_bitmap)[(_index) >> BLI_BITMAP_POWER] &= \
+	 ~(1 << ((_index) & BLI_BITMAP_MASK)))
+
+/* set or clear the value of a single bit at '_index' */
+#define BLI_BITMAP_MODIFY(_bitmap, _index, _set) \
+	do { \
+		if(_set) \
+			BLI_BITMAP_SET(_bitmap, _index); \
+		else \
+			BLI_BITMAP_CLEAR(_bitmap, _index); \
+	} while(0)
+
+/* resize bitmap to have space for '_tot' bits */
+#define BLI_BITMAP_RESIZE(_bitmap, _tot) \
+	(_bitmap) = MEM_reallocN(_bitmap, BLI_BITMAP_SIZE(_tot))
+
+#endif
diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h
index 515c244..74b477b 100644
--- a/source/blender/blenlib/BLI_blenlib.h
+++ b/source/blender/blenlib/BLI_blenlib.h
@@ -44,7 +44,7 @@
  * \subsection issues Known issues with BLI
  *
  * - blenlib is written in C.
- * - The posix-compliancy may move to a separate lib that deals with 
+ * - The posix-compliance may move to a separate lib that deals with
  *   platform dependencies. (There are other platform-dependent 
  *   fixes as well.)
  * - The file i/o has some redundant code. It should be cleaned.
@@ -55,8 +55,8 @@
  * standard libraries.
  */
 
-#ifndef BLI_BLENLIB_H
-#define BLI_BLENLIB_H
+#ifndef __BLI_BLENLIB_H__
+#define __BLI_BLENLIB_H__
 
 struct ListBase;
 
diff --git a/source/blender/blenlib/BLI_boxpack2d.h b/source/blender/blenlib/BLI_boxpack2d.h
index 886965f..7f92047 100644
--- a/source/blender/blenlib/BLI_boxpack2d.h
+++ b/source/blender/blenlib/BLI_boxpack2d.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef _BLI_BOXPACK2D_H_
-#define _BLI_BOXPACK2D_H_
+#ifndef __BLI_BOXPACK2D_H__
+#define __BLI_BOXPACK2D_H__
 
 /** \file BLI_boxpack2d.h
  *  \ingroup bli
diff --git a/source/blender/blenlib/BLI_bpath.h b/source/blender/blenlib/BLI_bpath.h
index e850db5..91252d3 100644
--- a/source/blender/blenlib/BLI_bpath.h
+++ b/source/blender/blenlib/BLI_bpath.h
@@ -28,11 +28,11 @@
 /** \file BLI_bpath.h
  *  \ingroup bli
  *  \attention Based on ghash, difference is ghash is not a fixed size,
- *   so for BPath we dont need to malloc
+ *   so for BPath we don't need to malloc
  */
 
-#ifndef BLI_BPATH_H
-#define BLI_BPATH_H
+#ifndef __BLI_BPATH_H__
+#define __BLI_BPATH_H__
 
 struct ID;
 struct ListBase;
@@ -40,7 +40,7 @@ struct Main;
 struct ReportList;
 
 /* Function that does something with an ID's file path. Should return 1 if the
-   path has changed, and in that case, should write the result to pathOut. */
+ * path has changed, and in that case, should write the result to pathOut. */
 typedef int (*BPathVisitor)(void *userdata, char *path_dst, const char *path_src);
 /* Executes 'visit' for each path associated with 'id'. */
 void bpath_traverse_id(struct Main *bmain, struct ID *id, BPathVisitor visit_cb, const int flag, void *userdata);
@@ -64,4 +64,4 @@ void makeFilesRelative(struct Main *bmain, const char *basedir, struct ReportLis
 void makeFilesAbsolute(struct Main *bmain, const char *basedir, struct ReportList *reports);
 void findMissingFiles(struct Main *bmain, const char *searchpath, struct ReportList *reports);
 
-#endif // BLI_BPATH_H
+#endif // __BLI_BPATH_H__
diff --git a/source/blender/blenlib/BLI_callbacks.h b/source/blender/blenlib/BLI_callbacks.h
index 201ada4..b32a1e2 100644
--- a/source/blender/blenlib/BLI_callbacks.h
+++ b/source/blender/blenlib/BLI_callbacks.h
@@ -29,8 +29,8 @@
  *  \ingroup bli
  */
 
-#ifndef BLI_CALLBACKS_H
-#define BLI_CALLBACKS_H
+#ifndef __BLI_CALLBACKS_H__
+#define __BLI_CALLBACKS_H__
 
 struct bContext;
 struct Main;
@@ -42,6 +42,8 @@ typedef enum {
 	BLI_CB_EVT_RENDER_PRE,
 	BLI_CB_EVT_RENDER_POST,
 	BLI_CB_EVT_RENDER_STATS,
+	BLI_CB_EVT_RENDER_COMPLETE,
+	BLI_CB_EVT_RENDER_CANCEL,
 	BLI_CB_EVT_LOAD_PRE,
 	BLI_CB_EVT_LOAD_POST,
 	BLI_CB_EVT_SAVE_PRE,
@@ -70,4 +72,4 @@ void BLI_cb_finalize(void);
 /* This is blenlib internal only, unrelated to above */
 void callLocalErrorCallBack(const char* msg);
 
-#endif /* BLI_CALLBACKS_H */
+#endif /* __BLI_CALLBACKS_H__ */
diff --git a/source/blender/blenlib/BLI_cpu.h b/source/blender/blenlib/BLI_cpu.h
index de04a2a..fa29162 100644
--- a/source/blender/blenlib/BLI_cpu.h
+++ b/source/blender/blenlib/BLI_cpu.h
@@ -18,8 +18,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BLI_CPU_H
-#define BLI_CPU_H 
+#ifndef __BLI_CPU_H__
+#define __BLI_CPU_H__ 
 
 /** \file BLI_cpu.h
  *  \ingroup bli
diff --git a/source/blender/blenlib/BLI_dlrbTree.h b/source/blender/blenlib/BLI_dlrbTree.h
index cde2058..7443d7a 100644
--- a/source/blender/blenlib/BLI_dlrbTree.h
+++ b/source/blender/blenlib/BLI_dlrbTree.h
@@ -23,8 +23,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BLI_DLRB_TREE_H
-#define BLI_DLRB_TREE_H
+#ifndef __BLI_DLRBTREE_H__
+#define __BLI_DLRBTREE_H__
 
 /** \file BLI_dlrbTree.h
  *  \ingroup bli
@@ -77,7 +77,7 @@ typedef struct DLRBT_Tree {
 
 /* return -1, 0, 1 for whether the given data is less than, equal to, or greater than the given node 
  *	- node: <DLRBT_Node> the node to compare to
- *	- data: pointer to the relevant data or values stored in the bitpattern dependant on the function
+ *	- data: pointer to the relevant data or values stored in the bitpattern dependent on the function
  */
 typedef short (*DLRBT_Comparator_FP)(void *node, void *data);
 
@@ -88,7 +88,7 @@ typedef DLRBT_Node *(*DLRBT_NAlloc_FP)(void *data);
 
 /* update an existing node instance accordingly to be in sync with the given data *	
  * 	- node: <DLRBT_Node> the node to update
- *	- data: pointer to the relevant data or values stored in the bitpattern dependant on the function
+ *	- data: pointer to the relevant data or values stored in the bitpattern dependent on the function
  */
 typedef void (*DLRBT_NUpdate_FP)(void *node, void *data);
 
@@ -97,10 +97,10 @@ typedef void (*DLRBT_NUpdate_FP)(void *node, void *data);
 
 /* ADT Management ------------------------------- */
 
-/* Create a new tree, and initialise as necessary */
+/* Create a new tree, and initialize as necessary */
 DLRBT_Tree *BLI_dlrbTree_new(void);
 
-/* Initialises some given trees */
+/* Initializes some given trees */
 void BLI_dlrbTree_init(DLRBT_Tree *tree);
 
 /* Free some tree */
@@ -142,7 +142,7 @@ DLRBT_Node *BLI_dlrbTree_add(DLRBT_Tree *tree, DLRBT_Comparator_FP cmp_cb,
 
 /* Remove the given element from the tree and balance again */
 // FIXME: this is not implemented yet... 
-void BLI_dlrbTree_remove(DLRBT_Tree *tree, DLRBT_Node *node);
+// void BLI_dlrbTree_remove(DLRBT_Tree *tree, DLRBT_Node *node);
 
 /* Node Operations (Manual) --------------------- */
 /* These methods require custom code for creating BST nodes and adding them to the 
@@ -158,4 +158,4 @@ void BLI_dlrbTree_insert(DLRBT_Tree *tree, DLRBT_Node *node);
 
 /* ********************************************** */
 
-#endif // BLI_DLRB_TREE_H
+#endif // __BLI_DLRBTREE_H__
diff --git a/source/blender/blenlib/BLI_dynstr.h b/source/blender/blenlib/BLI_dynstr.h
index 32c4e01..f2e62d6 100644
--- a/source/blender/blenlib/BLI_dynstr.h
+++ b/source/blender/blenlib/BLI_dynstr.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
  
-#ifndef BLI_DYNSTR_H
-#define BLI_DYNSTR_H
+#ifndef __BLI_DYNSTR_H__
+#define __BLI_DYNSTR_H__
 
 /** \file BLI_dynstr.h
  *  \ingroup bli
@@ -48,32 +48,32 @@ typedef struct DynStr DynStr;
 	/**
 	 * Create a new DynStr.
 	 * 
-	 * @return Pointer to a new DynStr.
+	 * \return Pointer to a new DynStr.
 	 */
 DynStr*	BLI_dynstr_new					(void);
 
 	/**
 	 * Append a c-string to a DynStr.
 	 * 
-	 * @param ds The DynStr to append to.
-	 * @param cstr The c-string to append.
+	 * \param ds The DynStr to append to.
+	 * \param cstr The c-string to append.
 	 */
 void	BLI_dynstr_append				(DynStr *ds, const char *cstr);
 
 /**
  * Append a length clamped c-string to a DynStr.
  *
- * @param ds The DynStr to append to.
- * @param cstr The c-string to append.
- * @param len The maximum length of the c-string to copy.
+ * \param ds The DynStr to append to.
+ * \param cstr The c-string to append.
+ * \param len The maximum length of the c-string to copy.
  */
 void	BLI_dynstr_nappend				(DynStr *ds, const char *cstr, int len);
 
 	/**
 	 * Append a c-string to a DynStr, but with formatting like printf.
 	 * 
-	 * @param ds The DynStr to append to.
-	 * @param format The printf format string to use.
+	 * \param ds The DynStr to append to.
+	 * \param format The printf format string to use.
 	 */
 void	BLI_dynstr_appendf				(DynStr *ds, const char *format, ...)
 #ifdef __GNUC__
@@ -85,18 +85,18 @@ void	BLI_dynstr_vappendf				(DynStr *ds, const char *format, va_list args);
 	/**
 	 * Find the length of a DynStr.
 	 * 
-	 * @param ds The DynStr of interest.
-	 * @return The length of @a ds.
+	 * \param ds The DynStr of interest.
+	 * \return The length of \a ds.
 	 */
 int		BLI_dynstr_get_len				(DynStr *ds);
 
 	/**
 	 * Get a DynStr's contents as a c-string.
-	 * <i> The returned c-string should be free'd
+	 * <i> The returned c-string should be freed
 	 * using MEM_freeN. </i>
 	 * 
-	 * @param ds The DynStr of interest.
-	 * @return The contents of @a ds as a c-string.
+	 * \param ds The DynStr of interest.
+	 * \return The contents of \a ds as a c-string.
 	 */
 char*	BLI_dynstr_get_cstring			(DynStr *ds);
 
@@ -105,16 +105,16 @@ char*	BLI_dynstr_get_cstring			(DynStr *ds);
  * <i> The str argument must be allocated to be at
  * least the size of BLI_dynstr_get_len(ds) + 1. </i>
  *
- * @param ds The DynStr of interest.
- * @param str The string to fill.
- * @return The contents of @a ds as a c-string.
+ * \param ds The DynStr of interest.
+ * \param str The string to fill.
+ * \return The contents of \a ds as a c-string.
  */
 void	BLI_dynstr_get_cstring_ex		(DynStr *ds, char *str);
 
 	/**
 	 * Free the DynStr
 	 * 
-	 * @param ds The DynStr to free.
+	 * \param ds The DynStr to free.
 	 */
 void	BLI_dynstr_free					(DynStr *ds);
 
diff --git a/source/blender/blenlib/BLI_edgehash.h b/source/blender/blenlib/BLI_edgehash.h
index 9153155..b00ac68 100644
--- a/source/blender/blenlib/BLI_edgehash.h
+++ b/source/blender/blenlib/BLI_edgehash.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
  
-#ifndef BLI_EDGEHASH_H
-#define BLI_EDGEHASH_H
+#ifndef __BLI_EDGEHASH_H__
+#define __BLI_EDGEHASH_H__
 
 /** \file BLI_edgehash.h
  *  \ingroup bli
diff --git a/source/blender/blenlib/BLI_editVert.h b/source/blender/blenlib/BLI_editVert.h
index 0ddea23..0f754d5 100644
--- a/source/blender/blenlib/BLI_editVert.h
+++ b/source/blender/blenlib/BLI_editVert.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BLI_EDITVERT_H
-#define BLI_EDITVERT_H
+#ifndef __BLI_EDITVERT_H__
+#define __BLI_EDITVERT_H__
 
 /** \file BLI_editVert.h
  *  \ingroup bli
@@ -64,8 +64,8 @@ typedef struct EditVert
 	short xs, ys; /* used to store a screenspace 2d projection of the verts */
 	
 	/* f stores selection eg. if (eve->f & SELECT) {...
-	h for hidden. if (!eve->h) {...
-	f1 and f2 can be used for temp data, clear them first*/
+	 * h for hidden. if (!eve->h) {...
+	 * f1 and f2 can be used for temp data, clear them first*/
 	unsigned char f, h, f1, f2; 
 	float bweight;
 	short fast;	/* only 0 or 1, for editmesh_fastmalloc, do not store temp data here! */
diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h
index 2e8f1a5..73220cb 100644
--- a/source/blender/blenlib/BLI_fileops.h
+++ b/source/blender/blenlib/BLI_fileops.h
@@ -30,8 +30,11 @@
  *  \brief File and directory operations.
  * */
 
-#ifndef BLI_FILEOPS_H
-#define BLI_FILEOPS_H
+#ifndef __BLI_FILEOPS_H__
+#define __BLI_FILEOPS_H__
+
+#include <stdio.h>
+
 
 #ifdef __cplusplus
 extern "C" {
@@ -42,6 +45,8 @@ extern "C" {
 /* for size_t (needed on windows) */
 #include <stddef.h>
 
+struct gzFile;
+
 /* Common */
 
 int    BLI_exists(const char *path);
@@ -65,6 +70,10 @@ unsigned int BLI_dir_contents(const char *dir, struct direntry **filelist);
 
 /* Files */
 
+FILE  *BLI_fopen(const char *filename, const char *mode);
+void  *BLI_gzopen(const char *filename, const char *mode);
+int    BLI_open(const char *filename, int oflag, int pmode);
+
 int    BLI_file_is_writable(const char *file);
 int    BLI_file_touch(const char *file);
 
diff --git a/source/blender/blenlib/BLI_fileops_types.h b/source/blender/blenlib/BLI_fileops_types.h
index 443ba65..8e4b5b3 100644
--- a/source/blender/blenlib/BLI_fileops_types.h
+++ b/source/blender/blenlib/BLI_fileops_types.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BLI_FILEOPS_TYPES_H
-#define BLI_FILEOPS_TYPES_H
+#ifndef __BLI_FILEOPS_TYPES_H__
+#define __BLI_FILEOPS_TYPES_H__
 
 /** \file BLI_fileops_types.h
  *  \ingroup bli
@@ -74,5 +74,5 @@ struct dirlink
 	char *name;
 };
 
-#endif /* BLI_FILEOPS_TYPES_H */
+#endif /* __BLI_FILEOPS_TYPES_H__ */
 
diff --git a/source/blender/blenlib/BLI_fnmatch.h b/source/blender/blenlib/BLI_fnmatch.h
index ac8960f..5914d15 100644
--- a/source/blender/blenlib/BLI_fnmatch.h
+++ b/source/blender/blenlib/BLI_fnmatch.h
@@ -1,24 +1,24 @@
 /* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
+ *
+ * NOTE: The canonical source of this file is maintained with the GNU C Library.
+ * Bugs can be reported to bug-glibc at prep.ai.mit.edu.
+ * 
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2, or (at your option) any
+ * later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 
-NOTE: The canonical source of this file is maintained with the GNU C Library.
-Bugs can be reported to bug-glibc at prep.ai.mit.edu.
-
-This program is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 2, or (at your option) any
-later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public 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	_FNMATCH_H
-#define	_FNMATCH_H	1
+#ifndef	__BLI_FNMATCH_H__
+#define	__BLI_FNMATCH_H__
 
 /** \file BLI_fnmatch.h
  *  \ingroup bli
@@ -35,13 +35,13 @@ extern "C" {
 #undef	__P
 #define	__P(protos)	()
 /* We can get away without defining `const' here only because in this file
-   it is used only inside the prototype for `fnmatch', which is elided in
-   non-ANSI C where `const' is problematical.  */
+ * it is used only inside the prototype for `fnmatch', which is elided in
+ * non-ANSI C where `const' is problematical.  */
 #endif /* C++ or ANSI C.  */
 
 
 /* We #undef these before defining them because some losing systems
-   (HP-UX A.08.07 for example) define these in <unistd.h>.  */
+ * (HP-UX A.08.07 for example) define these in <unistd.h>.  */
 #undef	FNM_PATHNAME
 #undef	FNM_NOESCAPE
 #undef	FNM_PERIOD
@@ -61,7 +61,7 @@ extern "C" {
 #define	FNM_NOMATCH	1
 
 /* Match STRING against the filename pattern PATTERN,
-   returning zero if it matches, FNM_NOMATCH if not.  */
+ * returning zero if it matches, FNM_NOMATCH if not.  */
 extern int fnmatch __P ((const char *__pattern, const char *__string,
                          int __flags));
 
@@ -69,4 +69,4 @@ extern int fnmatch __P ((const char *__pattern, const char *__string,
 }
 #endif
 
-#endif /* fnmatch.h */
+#endif /* __BLI_FNMATCH_H__ */
diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h
index f2a7e73..457f098 100644
--- a/source/blender/blenlib/BLI_ghash.h
+++ b/source/blender/blenlib/BLI_ghash.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
  
-#ifndef BLI_GHASH_H
-#define BLI_GHASH_H
+#ifndef __BLI_GHASH_H__
+#define __BLI_GHASH_H__
 
 /** \file BLI_ghash.h
  *  \ingroup bli
@@ -80,8 +80,8 @@ int	   BLI_ghash_size  (GHash *gh);
 	 * while the iterator is in use, and the iterator will step exactly
 	 * BLI_ghash_size(gh) times before becoming done.
 	 * 
-	 * @param gh The GHash to iterate over.
-	 * @return Pointer to a new DynStr.
+	 * \param gh The GHash to iterate over.
+	 * \return Pointer to a new DynStr.
 	 */
 GHashIterator*	BLI_ghashIterator_new		(GHash *gh);
 	/**
@@ -89,45 +89,45 @@ GHashIterator*	BLI_ghashIterator_new		(GHash *gh);
 	 * be mutated while the iterator is in use, and the iterator will
 	 * step exactly BLI_ghash_size(gh) times before becoming done.
 	 * 
-	 * @param ghi The GHashIterator to initialize.
-	 * @param gh The GHash to iterate over.
+	 * \param ghi The GHashIterator to initialize.
+	 * \param gh The GHash to iterate over.
 	 */
 void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh);
 	/**
 	 * Free a GHashIterator.
 	 *
-	 * @param ghi The iterator to free.
+	 * \param ghi The iterator to free.
 	 */
 void			BLI_ghashIterator_free		(GHashIterator *ghi);
 
 	/**
 	 * Retrieve the key from an iterator.
 	 *
-	 * @param ghi The iterator.
-	 * @return The key at the current index, or NULL if the 
+	 * \param ghi The iterator.
+	 * \return The key at the current index, or NULL if the 
 	 * iterator is done.
 	 */
 void*			BLI_ghashIterator_getKey	(GHashIterator *ghi);
 	/**
 	 * Retrieve the value from an iterator.
 	 *
-	 * @param ghi The iterator.
-	 * @return The value at the current index, or NULL if the 
+	 * \param ghi The iterator.
+	 * \return The value at the current index, or NULL if the 
 	 * iterator is done.
 	 */
 void*			BLI_ghashIterator_getValue	(GHashIterator *ghi);
 	/**
 	 * Steps the iterator to the next index.
 	 *
-	 * @param ghi The iterator.
+	 * \param ghi The iterator.
 	 */
 void			BLI_ghashIterator_step		(GHashIterator *ghi);
 	/**
 	 * Determine if an iterator is done (has reached the end of
 	 * the hash table).
 	 *
-	 * @param ghi The iterator.
-	 * @return True if done, False otherwise.
+	 * \param ghi The iterator.
+	 * \return True if done, False otherwise.
 	 */
 int				BLI_ghashIterator_isDone	(GHashIterator *ghi);
 
@@ -156,4 +156,4 @@ void			BLI_ghashutil_pairfree	(void *ptr);
 }
 #endif
 
-#endif /* BLI_GHASH_H */
+#endif /* __BLI_GHASH_H__ */
diff --git a/source/blender/blenlib/BLI_graph.h b/source/blender/blenlib/BLI_graph.h
index 056bba7..52613f9 100644
--- a/source/blender/blenlib/BLI_graph.h
+++ b/source/blender/blenlib/BLI_graph.h
@@ -22,8 +22,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BLI_GRAPH_H_
-#define BLI_GRAPH_H_
+#ifndef __BLI_GRAPH_H__
+#define __BLI_GRAPH_H__
 
 /** \file BLI_graph.h
  *  \ingroup bli
@@ -141,7 +141,6 @@ void BLI_flagArcs(BGraph *graph, int flag);
 
 int BLI_hasAdjacencyList(BGraph *rg);
 void BLI_buildAdjacencyList(BGraph *rg);
-void BLI_rebuildAdjacencyList(BGraph* rg);
 void BLI_rebuildAdjacencyListForNode(BGraph* rg, BNode *node);
 void BLI_freeAdjacencyList(BGraph *rg);
 
@@ -178,10 +177,10 @@ void BLI_mirrorAlongAxis(float v[3], float center[3], float axis[3]);
 
 /* BArc symmetry flags
  * 
- * axial symetry sides */
+ * axial symmetry sides */
 #define SYM_SIDE_POSITIVE		1
 #define SYM_SIDE_NEGATIVE		2
 /* Anything higher is the order in radial symmetry */
 #define SYM_SIDE_RADIAL			3
 
-#endif /*BLI_GRAPH_H_*/
+#endif /*__BLI_GRAPH_H__*/
diff --git a/source/blender/blenlib/BLI_gsqueue.h b/source/blender/blenlib/BLI_gsqueue.h
index 425ecb7..29c31c1 100644
--- a/source/blender/blenlib/BLI_gsqueue.h
+++ b/source/blender/blenlib/BLI_gsqueue.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BLI_GSQUEUE_H
-#define BLI_GSQUEUE_H
+#ifndef __BLI_GSQUEUE_H__
+#define __BLI_GSQUEUE_H__
 
 /** \file BLI_gsqueue.h
  *  \ingroup bli
@@ -39,8 +39,8 @@ typedef struct _GSQueue GSQueue;
 	/**
 	 * Create a new GSQueue.
 	 * 
-	 * @param elem_size The size of the structures in the queue.
-	 * @retval The new queue
+	 * \param elem_size The size of the structures in the queue.
+	 * \retval The new queue
 	 */
 GSQueue*	BLI_gsqueue_new		(int elem_size);
 
@@ -58,7 +58,7 @@ int			BLI_gsqueue_size(GSQueue *gq);
 	 * Access the item at the head of the queue
 	 * without removing it.
 	 * 
-	 * @param item_r A pointer to an appropriatly
+	 * \param item_r A pointer to an appropriately
 	 * sized structure (the size passed to BLI_gsqueue_new)
 	 */
 void		BLI_gsqueue_peek	(GSQueue *gq, void *item_r);
@@ -67,7 +67,7 @@ void		BLI_gsqueue_peek	(GSQueue *gq, void *item_r);
 	 * Access the item at the head of the queue
 	 * and remove it.
 	 * 
-	 * @param item_r A pointer to an appropriatly
+	 * \param item_r A pointer to an appropriately
 	 * sized structure (the size passed to BLI_gsqueue_new).
 	 * Can be NULL if desired.
 	 */
@@ -76,7 +76,7 @@ void		BLI_gsqueue_pop		(GSQueue *gq, void *item_r);
 	/**
 	 * Push an element onto the tail of the queue.
 	 * 
-	 * @param item A pointer to an appropriatly
+	 * \param item A pointer to an appropriately
 	 * sized structure (the size passed to BLI_gsqueue_new).
 	 */
 void		BLI_gsqueue_push	(GSQueue *gq, void *item);
@@ -85,7 +85,7 @@ void		BLI_gsqueue_push	(GSQueue *gq, void *item);
 	 * Push an element back onto the head of the queue (so
 	 * it would be returned from the next call to BLI_gsqueue_pop).
 	 * 
-	 * @param item A pointer to an appropriatly
+	 * \param item A pointer to an appropriately
 	 * sized structure (the size passed to BLI_gsqueue_new).
 	 */
 void		BLI_gsqueue_pushback	(GSQueue *gq, void *item);
@@ -95,5 +95,5 @@ void		BLI_gsqueue_pushback	(GSQueue *gq, void *item);
 	 */
 void		BLI_gsqueue_free	(GSQueue *gq);
 
-#endif /* BLI_GSQUEUE_H */
+#endif /* __BLI_GSQUEUE_H__ */
 
diff --git a/source/blender/blenlib/BLI_heap.h b/source/blender/blenlib/BLI_heap.h
index 0124c99..5ceccda 100644
--- a/source/blender/blenlib/BLI_heap.h
+++ b/source/blender/blenlib/BLI_heap.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
  
-#ifndef BLI_HEAP_H
-#define BLI_HEAP_H
+#ifndef __BLI_HEAP_H__
+#define __BLI_HEAP_H__
 
 /** \file BLI_heap.h
  *  \ingroup bli
@@ -41,12 +41,12 @@ typedef struct HeapNode HeapNode;
 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. */
+ * are recycled, so memory usage will not shrink. */
 Heap*			BLI_heap_new	(void);
 void			BLI_heap_free	(Heap *heap, HeapFreeFP ptrfreefp);
 
 /* Insert heap node with a value (often a 'cost') and pointer into the heap,
-   duplicate values are allowed. */
+ * duplicate values are allowed. */
 HeapNode*		BLI_heap_insert		(Heap *heap, float value, void *ptr);
 
 /* Remove a heap node. */
diff --git a/source/blender/blenlib/BLI_jitter.h b/source/blender/blenlib/BLI_jitter.h
index f432a51..9aa21a8 100644
--- a/source/blender/blenlib/BLI_jitter.h
+++ b/source/blender/blenlib/BLI_jitter.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BLI_JITTER_H
-#define BLI_JITTER_H 
+#ifndef __BLI_JITTER_H__
+#define __BLI_JITTER_H__ 
 
 /** \file BLI_jitter.h
  *  \ingroup bli
diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h
index 8ead7bf..ff3017f 100644
--- a/source/blender/blenlib/BLI_kdopbvh.h
+++ b/source/blender/blenlib/BLI_kdopbvh.h
@@ -26,8 +26,8 @@
  */
 
 
-#ifndef BLI_KDOPBVH_H
-#define BLI_KDOPBVH_H
+#ifndef __BLI_KDOPBVH_H__
+#define __BLI_KDOPBVH_H__
 
 /** \file BLI_kdopbvh.h
  *  \ingroup bli
@@ -111,5 +111,5 @@ int BLI_bvhtree_range_query(BVHTree *tree, const float co[3], float radius, BVHT
 }
 #endif
 
-#endif // BLI_KDOPBVH_H
+#endif // __BLI_KDOPBVH_H__
 
diff --git a/source/blender/blenlib/BLI_kdtree.h b/source/blender/blenlib/BLI_kdtree.h
index 9ffc64e..a58f580 100644
--- a/source/blender/blenlib/BLI_kdtree.h
+++ b/source/blender/blenlib/BLI_kdtree.h
@@ -26,12 +26,12 @@
  * ***** END GPL LICENSE BLOCK *****
  */
  
-#ifndef BLI_KDTREE_H
-#define BLI_KDTREE_H
+#ifndef __BLI_KDTREE_H__
+#define __BLI_KDTREE_H__
 
 /** \file BLI_kdtree.h
  *  \ingroup bli
- *  \brief A kd-tree for nearest neighbour search.
+ *  \brief A kd-tree for nearest neighbor search.
  *  \author Janne Karhu
  *  \author Brecht van Lommel
  */
diff --git a/source/blender/blenlib/BLI_linklist.h b/source/blender/blenlib/BLI_linklist.h
index 6886dff..664beb4 100644
--- a/source/blender/blenlib/BLI_linklist.h
+++ b/source/blender/blenlib/BLI_linklist.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
  
-#ifndef BLI_LINKLIST_H
-#define BLI_LINKLIST_H
+#ifndef __BLI_LINKLIST_H__
+#define __BLI_LINKLIST_H__
 
 /** \file BLI_linklist.h
  *  \ingroup bli
diff --git a/source/blender/blenlib/BLI_listbase.h b/source/blender/blenlib/BLI_listbase.h
index 88ee79d..abe7eac 100644
--- a/source/blender/blenlib/BLI_listbase.h
+++ b/source/blender/blenlib/BLI_listbase.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BLI_LISTBASE_H
-#define BLI_LISTBASE_H
+#ifndef __BLI_LISTBASE_H__
+#define __BLI_LISTBASE_H__
 
 /** \file BLI_listbase.h
  *  \ingroup bli
@@ -41,15 +41,16 @@ extern "C" {
 #endif
 
 void BLI_insertlink(struct ListBase *listbase, void *vprevlink, void *vnewlink);
-void *BLI_findlink(const struct ListBase *listbase, int number);
 int BLI_findindex(const struct ListBase *listbase, void *vlink);
 int BLI_findstringindex(const struct ListBase *listbase, const char *id, const int offset);
 
 /* find forwards */
+void *BLI_findlink(const struct ListBase *listbase, int number);
 void *BLI_findstring(const struct ListBase *listbase, const char *id, const int offset);
 void *BLI_findstring_ptr(const struct ListBase *listbase, const char *id, const int offset);
 
 /* find backwards */
+void *BLI_rfindlink(const struct ListBase *listbase, int number);
 void *BLI_rfindstring(const struct ListBase *listbase, const char *id, const int offset);
 void *BLI_rfindstring_ptr(const struct ListBase *listbase, const char *id, const int offset);
 
diff --git a/source/blender/blenlib/BLI_math.h b/source/blender/blenlib/BLI_math.h
index 1fe7004..89c37da 100644
--- a/source/blender/blenlib/BLI_math.h
+++ b/source/blender/blenlib/BLI_math.h
@@ -23,8 +23,8 @@
  * ***** END GPL LICENSE BLOCK *****
  * */
 
-#ifndef BLI_MATH_H
-#define BLI_MATH_H
+#ifndef __BLI_MATH_H__
+#define __BLI_MATH_H__
 
 /** \file BLI_math.h
  *  \ingroup bli
@@ -59,5 +59,5 @@
 #include "BLI_math_vector.h"
 #include "BLI_math_geom.h"
 
-#endif /* BLI_MATH_H */
+#endif /* __BLI_MATH_H__ */
 
diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h
index 53db77d..7e5f1f2 100644
--- a/source/blender/blenlib/BLI_math_base.h
+++ b/source/blender/blenlib/BLI_math_base.h
@@ -23,8 +23,8 @@
  * ***** END GPL LICENSE BLOCK *****
  * */
 
-#ifndef BLI_MATH_BASE_H
-#define BLI_MATH_BASE_H
+#ifndef __BLI_MATH_BASE_H__
+#define __BLI_MATH_BASE_H__
 
 /** \file BLI_math_base.h
  *  \ingroup bli
@@ -142,7 +142,7 @@
 #define CLAMP(a, b, c)		if((a)<(b)) (a)=(b); else if((a)>(c)) (a)=(c)
 #endif
 
-#ifdef BLI_MATH_INLINE_H
+#ifdef __BLI_MATH_INLINE_H__
 #include "intern/math_base_inline.c"
 #endif
 
@@ -167,7 +167,7 @@ MINLINE float signf(float f);
 
 MINLINE float power_of_2(float f);
 
-/* these dont really fit anywhere but were being copied about a lot */
+/* these don't really fit anywhere but were being copied about a lot */
 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);
@@ -181,5 +181,5 @@ extern double round(double x);
 
 double double_round(double x, int ndigits);
 
-#endif /* BLI_MATH_BASE_H */
+#endif /* __BLI_MATH_BASE_H__ */
 
diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h
index f4d6882..4771fdb 100644
--- a/source/blender/blenlib/BLI_math_color.h
+++ b/source/blender/blenlib/BLI_math_color.h
@@ -23,8 +23,8 @@
  * ***** END GPL LICENSE BLOCK *****
  * */
 
-#ifndef BLI_MATH_COLOR_H
-#define BLI_MATH_COLOR_H
+#ifndef __BLI_MATH_COLOR_H__
+#define __BLI_MATH_COLOR_H__
 
 /** \file BLI_math_color.h
  *  \ingroup bli
@@ -113,7 +113,7 @@ void rgba_float_to_uchar(unsigned char col_r[4], const float col_f[4]);
 
 void lift_gamma_gain_to_asc_cdl(float *lift, float *gamma, float *gain, float *offset, float *slope, float *power);
 
-#ifdef BLI_MATH_INLINE_H
+#ifdef __BLI_MATH_INLINE_H__
 #include "intern/math_color_inline.c"
 #endif
 
@@ -121,5 +121,5 @@ void lift_gamma_gain_to_asc_cdl(float *lift, float *gamma, float *gain, float *o
 }
 #endif
 
-#endif /* BLI_MATH_COLOR_H */
+#endif /* __BLI_MATH_COLOR_H__ */
 
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h
index 8d18f52..9b5e363 100644
--- a/source/blender/blenlib/BLI_math_geom.h
+++ b/source/blender/blenlib/BLI_math_geom.h
@@ -23,8 +23,8 @@
  * ***** END GPL LICENSE BLOCK *****
  * */
 
-#ifndef BLI_MATH_GEOM_H
-#define BLI_MATH_GEOM_H
+#ifndef __BLI_MATH_GEOM_H__
+#define __BLI_MATH_GEOM_H__
 
 /** \file BLI_math_geom.h
  *  \ingroup bli
@@ -36,7 +36,7 @@ extern "C" {
 
 #include "BLI_math_inline.h"
 
-#ifdef BLI_MATH_INLINE_H
+#ifdef __BLI_MATH_INLINE_H__
 #include "intern/math_geom_inline.c"
 #endif
 
@@ -54,7 +54,7 @@ float area_tri_v3(const float a[3], const float b[3], const float c[3]);
 float area_quad_v3(const float a[3], const float b[3], const float c[3], const float d[3]);
 float area_poly_v3(int nr, float verts[][3], const float normal[3]);
 
-int is_quad_convex_v3(const float *v1, const float *v2, const float *v3, const float *v4);
+int is_quad_convex_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3]);
 
 /********************************* Distance **********************************/
 
@@ -73,6 +73,7 @@ void  closest_to_plane_v3(float r[3], const float plane_co[3], const float plane
 
 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]);
+void  limit_dist_v3(float v1[3], float v2[3], const float dist);
 
 /******************************* Intersection ********************************/
 
@@ -103,20 +104,20 @@ 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)*/
+/* 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.
+ * \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);
@@ -125,12 +126,12 @@ int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3],
  * 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.
+ * \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],
@@ -214,8 +215,8 @@ void box_minmax_bounds_m4(float min[3], float max[3],
 
 /********************************** Mapping **********************************/
 
-void map_to_tube(float *u, float *v, const float x, const float y, const float z);
-void map_to_sphere(float *u, float *v, const float x, const float y, const float z);
+void map_to_tube(float *r_u, float *r_v, const float x, const float y, const float z);
+void map_to_sphere(float *r_u, float *r_v, const float x, const float y, const float z);
 
 /********************************** Normals **********************************/
 
@@ -248,9 +249,9 @@ void vcloud_estimate_transform(int list_size, float (*pos)[3], float *weight,
 /****************************** Spherical Harmonics *************************/
 
 /* Uses 2nd order SH => 9 coefficients, stored in this order:
-   0 = (0,0),
-   1 = (1,-1), 2 = (1,0), 3 = (1,1),
-   4 = (2,-2), 5 = (2,-1), 6 = (2,0), 7 = (2,1), 8 = (2,2) */
+ * 0 = (0,0),
+ * 1 = (1,-1), 2 = (1,0), 3 = (1,1),
+ * 4 = (2,-2), 5 = (2,-1), 6 = (2,0), 7 = (2,1), 8 = (2,2) */
 
 MINLINE void zero_sh(float r[9]);
 MINLINE void copy_sh_sh(float r[9], const float a[9]);
@@ -273,5 +274,5 @@ void axis_dominant_v3(int *axis_a, int *axis_b, const float axis[3]);
 }
 #endif
 
-#endif /* BLI_MATH_GEOM_H */
+#endif /* __BLI_MATH_GEOM_H__ */
 
diff --git a/source/blender/blenlib/BLI_math_inline.h b/source/blender/blenlib/BLI_math_inline.h
index 83aeb6c..ce43d5f 100644
--- a/source/blender/blenlib/BLI_math_inline.h
+++ b/source/blender/blenlib/BLI_math_inline.h
@@ -23,8 +23,8 @@
  * ***** END GPL LICENSE BLOCK *****
  * */
 
-#ifndef BLI_MATH_INLINE_H
-#define BLI_MATH_INLINE_H
+#ifndef __BLI_MATH_INLINE_H__
+#define __BLI_MATH_INLINE_H__
 
 /** \file BLI_math_inline.h
  *  \ingroup bli
@@ -35,29 +35,28 @@ extern "C" {
 #endif
 
 /* add platform/compiler checks here if it is not supported */
-#define BLI_MATH_INLINE_H
-
-#ifdef BLI_MATH_INLINE_H
-#ifdef _MSC_VER
-#define MINLINE static __forceinline
-#define MALWAYS_INLINE MINLINE
-#else
-#define MINLINE static inline
-#if (defined(__APPLE__) && defined(__ppc__))
-/* static inline __attribute__ here breaks osx ppc gcc42 build */
-#define MALWAYS_INLINE static __attribute__((always_inline))
-#else
-#define MALWAYS_INLINE static inline __attribute__((always_inline))
-#endif
-#endif
+#define __BLI_MATH_INLINE_H__
+
+#ifdef __BLI_MATH_INLINE_H__
+#  ifdef _MSC_VER
+#    define MINLINE static __forceinline
+#    define MALWAYS_INLINE MINLINE
+#  else
+#    define MINLINE static inline
+#    if (defined(__APPLE__) && defined(__ppc__))
+       /* static inline __attribute__ here breaks osx ppc gcc42 build */
+#      define MALWAYS_INLINE static __attribute__((always_inline))
+#    else
+#      define MALWAYS_INLINE static inline __attribute__((always_inline))
+#    endif
+#  endif
 #else
-#define MINLINE
-#define MALWAYS_INLINE
+#  define MINLINE
+#  define MALWAYS_INLINE
 #endif
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* BLI_MATH_INLINE_H */
-
+#endif /* __BLI_MATH_INLINE_H__ */
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h
index 4d3a4df..00a751f 100644
--- a/source/blender/blenlib/BLI_math_matrix.h
+++ b/source/blender/blenlib/BLI_math_matrix.h
@@ -23,8 +23,8 @@
  * ***** END GPL LICENSE BLOCK *****
  * */
 
-#ifndef BLI_MATH_MATRIX_H
-#define BLI_MATH_MATRIX_H
+#ifndef __BLI_MATH_MATRIX_H__
+#define __BLI_MATH_MATRIX_H__
 
 /** \file BLI_math_matrix.h
  *  \ingroup bli
@@ -71,7 +71,7 @@ void mul_m3_m3m3(float R[3][3], float A[3][3], float B[3][3]);
 void mul_m4_m3m4(float R[4][4], float A[3][3], float B[4][4]);
 void mul_m4_m4m3(float R[4][4], float A[4][4], float B[3][3]);
 /* note: the A,B arguments are reversed compared to previous mul_m4_m4m4
-   function, for consistency with above functions & math notation. */
+ * function, for consistency with above functions & math notation. */
 void mult_m4_m4m4(float R[4][4], float A[4][4], float B[4][4]);
 void mult_m3_m3m4(float R[3][3], float A[4][4], float B[3][3]);
 
@@ -103,6 +103,11 @@ int invert_m3_m3(float R[3][3], float A[3][3]);
 int invert_m4(float R[4][4]);
 int invert_m4_m4(float R[4][4], float A[4][4]);
 
+/* double ariphmetics */
+void mul_m4_v4d(float M[4][4], double r[4]);
+void mul_v4d_m4v4d(double r[4], float M[4][4], double v[4]);
+
+
 /****************************** Linear Algebra *******************************/
 
 void transpose_m3(float R[3][3]);
@@ -118,6 +123,8 @@ void orthogonalize_m4(float R[4][4], int axis);
 
 int is_orthogonal_m3(float mat[3][3]);
 int is_orthogonal_m4(float mat[4][4]);
+int is_orthonormal_m3(float mat[3][3]);
+int is_orthonormal_m4(float mat[4][4]);
 
 void adjoint_m3_m3(float R[3][3], float A[3][3]);
 void adjoint_m4_m4(float R[4][4], float A[4][4]);
@@ -179,5 +186,5 @@ void print_m4(const char *str, float M[3][4]);
 }
 #endif
 
-#endif /* BLI_MATH_MATRIX_H */
+#endif /* __BLI_MATH_MATRIX_H__ */
 
diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h
index fca7c34..62b81530 100644
--- a/source/blender/blenlib/BLI_math_rotation.h
+++ b/source/blender/blenlib/BLI_math_rotation.h
@@ -23,8 +23,8 @@
  * ***** END GPL LICENSE BLOCK *****
  * */
 
-#ifndef BLI_MATH_ROTATION_H
-#define BLI_MATH_ROTATION_H
+#ifndef __BLI_MATH_ROTATION_H__
+#define __BLI_MATH_ROTATION_H__
 
 /** \file BLI_math_rotation.h
  *  \ingroup bli
@@ -189,5 +189,5 @@ float angle_wrap_deg(float angle);
 }
 #endif
 
-#endif /* BLI_MATH_ROTATION_H */
+#endif /* __BLI_MATH_ROTATION_H__ */
 
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index 12a0b18..af3df9c 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -23,8 +23,8 @@
  * ***** END GPL LICENSE BLOCK *****
  * */
 
-#ifndef BLI_MATH_VECTOR_H
-#define BLI_MATH_VECTOR_H
+#ifndef __BLI_MATH_VECTOR_H__
+#define __BLI_MATH_VECTOR_H__
 
 /** \file BLI_math_vector.h
  *  \ingroup bli
@@ -36,7 +36,7 @@ extern "C" {
 
 #include "BLI_math_inline.h"
 
-#ifdef BLI_MATH_INLINE_H
+#ifdef __BLI_MATH_INLINE_H__
 #include "intern/math_vector_inline.c"
 #endif
 
@@ -50,6 +50,10 @@ MINLINE void copy_v2_v2(float r[2], const float a[2]);
 MINLINE void copy_v3_v3(float r[3], const float a[3]);
 MINLINE void copy_v4_v4(float r[4], const float a[4]);
 
+MINLINE void copy_v2_fl(float r[2], float f);
+MINLINE void copy_v3_fl(float r[3], float f);
+MINLINE void copy_v4_fl(float r[4], float f);
+
 MINLINE void swap_v2_v2(float a[2], float b[2]);
 MINLINE void swap_v3_v3(float a[3], float b[3]);
 MINLINE void swap_v4_v4(float a[4], float b[4]);
@@ -66,6 +70,14 @@ MINLINE void copy_v4_v4_short(short r[4], const short a[4]);
 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]);
+/* double -> float */
+MINLINE void copy_v2fl_v2db(float r[2], const double a[2]);
+MINLINE void copy_v3fl_v3db(float r[3], const double a[3]);
+MINLINE void copy_v4fl_v4db(float r[4], const double a[4]);
+/* float -> double */
+MINLINE void copy_v2db_v2fl(double r[2], const float a[2]);
+MINLINE void copy_v3db_v3fl(double r[3], const float a[3]);
+MINLINE void copy_v4db_v4fl(double r[4], const float a[4]);
 
 /********************************* Arithmetic ********************************/
 
@@ -112,11 +124,14 @@ MINLINE float dot_v3v3(const float a[3], const float b[3]);
 MINLINE float cross_v2v2(const float a[2], const float b[2]);
 MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3]);
 
+MINLINE void add_newell_cross_v3_v3v3(float n[3], const float v_prev[3], const float v_curr[3]);
+
 MINLINE void star_m3_v3(float rmat[3][3],float a[3]);
 
 /*********************************** Length **********************************/
 
 MINLINE float len_squared_v2(const float v[2]);
+MINLINE float len_squared_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]);
@@ -141,6 +156,7 @@ void interp_v4_v4v4v4(float p[4], const float v1[4], const float v2[4], const fl
 void interp_v4_v4v4v4v4(float p[4], const float v1[4], const float v2[4], const float v3[4], const float v4[4], const float w[4]);
 
 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]);
 
 /********************************* Comparison ********************************/
 
@@ -164,6 +180,7 @@ MINLINE float line_point_side_v2(const float l1[2], const float l2[2], const flo
 /* - angle_normalized_* is faster equivalent if vectors are normalized       */
 
 float angle_v2v2(const float a[2], const float b[2]);
+float angle_signed_v2v2(const float v1[2], const float v2[2]);
 float angle_v2v2v2(const float a[2], const float b[2], const float c[2]);
 float angle_normalized_v2v2(const float a[2], const float b[2]);
 float angle_v3v3(const float a[3], const float b[3]);
@@ -177,6 +194,7 @@ void angle_poly_v3(float* angles, const float* verts[3], int len);
 
 void project_v2_v2v2(float c[2], const float v1[2], const float v2[2]);
 void project_v3_v3v3(float r[3], const float p[3], const float n[3]);
+void project_v3_plane(float v[3], const float n[3], const float p[3]);
 void reflect_v3_v3v3(float r[3], const float v[3], const float n[3]);
 void ortho_basis_v3v3_v3(float r1[3], float r2[3], const float a[3]);
 void bisect_v3_v3v3v3(float r[3], const float a[3], const float b[3], const float c[3]);
@@ -210,11 +228,12 @@ void add_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_
 void sub_vn_vn(float *array_tar, const float *array_src, const int size);
 void sub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size);
 void fill_vn_i(int *array_tar, const int size, const int val);
+void fill_vn_ushort(unsigned short *array_tar, const int size, const unsigned short val);
 void fill_vn_fl(float *array_tar, const int size, const float val);
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* BLI_MATH_VECTOR_H */
+#endif /* __BLI_MATH_VECTOR_H__ */
 
diff --git a/source/blender/blenlib/BLI_md5.h b/source/blender/blenlib/BLI_md5.h
index afcc3cd..8ce479b 100644
--- a/source/blender/blenlib/BLI_md5.h
+++ b/source/blender/blenlib/BLI_md5.h
@@ -18,8 +18,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BLI_MD5_H
-#define BLI_MD5_H 
+#ifndef __BLI_MD5_H__
+#define __BLI_MD5_H__ 
 
 /** \file BLI_md5.h
  *  \ingroup bli
@@ -29,15 +29,15 @@
 #include <stdlib.h>
 
 /* Compute MD5 message digest for LEN bytes beginning at BUFFER.  The
-   result is always in little endian byte order, so that a byte-wise
-   output yields to the wanted ASCII representation of the message
-   digest.  */
+ * result is always in little endian byte order, so that a byte-wise
+ * output yields to the wanted ASCII representation of the message
+ * digest.  */
 
 void *md5_buffer(const char *buffer, size_t len, void *resblock);
 
 /* Compute MD5 message digest for bytes read from STREAM.  The
-   resulting message digest number will be written into the 16 bytes
-   beginning at RESBLOCK.  */
+ * resulting message digest number will be written into the 16 bytes
+ * beginning at RESBLOCK.  */
 
 int md5_stream(FILE *stream, void *resblock);
 
diff --git a/source/blender/blenlib/BLI_memarena.h b/source/blender/blenlib/BLI_memarena.h
index ceb7b17..8306a69 100644
--- a/source/blender/blenlib/BLI_memarena.h
+++ b/source/blender/blenlib/BLI_memarena.h
@@ -35,8 +35,8 @@
  * data, which are all freed at the same moment.
  */
 
-#ifndef BLI_MEMARENA_H
-#define BLI_MEMARENA_H
+#ifndef __BLI_MEMARENA_H__
+#define __BLI_MEMARENA_H__
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/source/blender/blenlib/BLI_mempool.h b/source/blender/blenlib/BLI_mempool.h
index 7789670..9d7c7d4 100644
--- a/source/blender/blenlib/BLI_mempool.h
+++ b/source/blender/blenlib/BLI_mempool.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
  
-#ifndef BLI_MEMPOOL_H
-#define BLI_MEMPOOL_H
+#ifndef __BLI_MEMPOOL_H__
+#define __BLI_MEMPOOL_H__
 
 /** \file BLI_mempool.h
  *  \ingroup bli
@@ -44,17 +44,16 @@ struct BLI_mempool_chunk;
 
 typedef struct BLI_mempool BLI_mempool;
 
-/*allow_iter allows iteration on this mempool.  note: this requires that the
-  first four bytes of the elements never contain the character string
-  'free'.  use with care.*/
+/* allow_iter allows iteration on this mempool.  note: this requires that the
+ * first four bytes of the elements never contain the character string
+ * 'free'.  use with care.*/
 
-BLI_mempool *BLI_mempool_create(int esize, int tote, int pchunk,
-                                short use_sysmalloc, short allow_iter);
+BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag);
 void *BLI_mempool_alloc(BLI_mempool *pool);
 void *BLI_mempool_calloc(BLI_mempool *pool);
-void BLI_mempool_free(BLI_mempool *pool, void *addr);
-void BLI_mempool_destroy(BLI_mempool *pool);
-int BLI_mempool_count(BLI_mempool *pool);
+void  BLI_mempool_free(BLI_mempool *pool, void *addr);
+void  BLI_mempool_destroy(BLI_mempool *pool);
+int   BLI_mempool_count(BLI_mempool *pool);
 void *BLI_mempool_findelem(BLI_mempool *pool, int index);
 
 /** iteration stuff.  note: this may easy to produce bugs with **/
@@ -65,11 +64,13 @@ typedef struct BLI_mempool_iter {
 	int curindex;
 } BLI_mempool_iter;
 
-/*allow iteration on this mempool.  note: this requires that the
-  first four bytes of the elements never contain the character string
-  'free'.  use with care.*/
-void BLI_mempool_allow_iter(BLI_mempool *pool);
-void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter);
+/* flag */
+enum {
+	BLI_MEMPOOL_SYSMALLOC  = (1 << 0),
+	BLI_MEMPOOL_ALLOW_ITER = (1 << 1)
+};
+
+void  BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter);
 void *BLI_mempool_iterstep(BLI_mempool_iter *iter);
 
 #ifdef __cplusplus
diff --git a/source/blender/blenlib/BLI_noise.h b/source/blender/blenlib/BLI_noise.h
index de2efb1..9f5475c 100644
--- a/source/blender/blenlib/BLI_noise.h
+++ b/source/blender/blenlib/BLI_noise.h
@@ -26,8 +26,8 @@
  * 
  */
 
-#ifndef BLI_NOISE_H
-#define BLI_NOISE_H
+#ifndef __BLI_NOISE_H__
+#define __BLI_NOISE_H__
 
 /** \file BLI_noise.h
  *  \ingroup bli
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h
index 68bb1a7..e02b48f 100644
--- a/source/blender/blenlib/BLI_path_util.h
+++ b/source/blender/blenlib/BLI_path_util.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BLI_PATH_UTIL_H
-#define BLI_PATH_UTIL_H
+#ifndef __BLI_PATH_UTIL_H__
+#define __BLI_PATH_UTIL_H__
 
 /** \file BLI_path_util.h
  *  \ingroup bli
@@ -115,10 +115,10 @@ void BLI_splitdirstring(char *di,char *fi);
 void BLI_clean(char *path);
 
 /**
-	 * dir can be any input, like from buttons, and this function
-	 * converts it to a regular full path.
-	 * Also removes garbage from directory paths, like /../ or double slashes etc 
-	 */
+ * dir can be any input, like from buttons, and this function
+ * converts it to a regular full path.
+ * Also removes garbage from directory paths, like /../ or double slashes etc 
+ */
 void BLI_cleanup_file(const char *relabase, char *dir); /* removes trailing slash */
 void BLI_cleanup_dir(const char *relabase, char *dir); /* same as above but adds a trailing slash */
 void BLI_cleanup_path(const char *relabase, char *dir); /* doesn't touch trailing slash */
@@ -129,18 +129,18 @@ int BLI_parent_dir(char *path);
 /* return whether directory is root and thus has no parent dir */
 int BLI_has_parent(char *path);
 
-	/**
-	 * Blender's path code replacement function.
-	 * Bases @a path strings leading with "//" by the
-	 * directory @a basepath, and replaces instances of
-	 * '#' with the @a framenum. Results are written
-	 * back into @a path.
-	 * 
-	 * @a path The path to convert
-	 * @a basepath The directory to base relative paths with.
-	 * @a framenum The framenumber to replace the frame code with.
-	 * @retval Returns true if the path was relative (started with "//").
-	 */
+/**
+ * Blender's path code replacement function.
+ * Bases \a path strings leading with "//" by the
+ * directory \a basepath, and replaces instances of
+ * '#' with the \a framenum. Results are written
+ * back into \a path.
+ * 
+ * \a path The path to convert
+ * \a basepath The directory to base relative paths with.
+ * \a framenum The framenumber to replace the frame code with.
+ * \retval Returns true if the path was relative (started with "//").
+ */
 int BLI_path_abs(char *path, const char *basepath);
 int BLI_path_frame(char *path, int frame, int digits);
 int BLI_path_frame_range(char *path, int sta, int end, int digits);
@@ -155,14 +155,14 @@ void BLI_path_rel(char *file, const char *relfile);
 #  define BLI_path_ncmp strncmp
 #endif
 
-	/**
-	 * Change every @a from in @a string into @a to. The
-	 * result will be in @a string
-	 *
-	 * @a string The string to work on
-	 * @a from The character to replace
-	 * @a to The character to replace with
-	 */
+/**
+ * Change every \a from in \a string into \a to. The
+ * result will be in \a string
+ *
+ * \a string The string to work on
+ * \a from The character to replace
+ * \a to The character to replace with
+ */
 void BLI_char_switch(char *string, char from, char to);
 
 	/* Initialize path to program executable */
diff --git a/source/blender/blenlib/BLI_pbvh.h b/source/blender/blenlib/BLI_pbvh.h
index e17a37c..e657839 100644
--- a/source/blender/blenlib/BLI_pbvh.h
+++ b/source/blender/blenlib/BLI_pbvh.h
@@ -18,21 +18,24 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BLI_PBVH_H
-#define BLI_PBVH_H
+#ifndef __BLI_PBVH_H__
+#define __BLI_PBVH_H__
 
 /** \file BLI_pbvh.h
  *  \ingroup bli
  *  \brief A BVH for high poly meshes.
  */
 
-struct MFace;
-struct MVert;
+#include "BLI_bitmap.h"
+
+struct DMFlagMat;
 struct DMGridAdjacency;
 struct DMGridData;
+struct ListBase;
+struct MFace;
+struct MVert;
 struct PBVH;
 struct PBVHNode;
-struct ListBase;
 
 typedef struct PBVH PBVH;
 typedef struct PBVHNode PBVHNode;
@@ -56,12 +59,13 @@ void BLI_pbvh_build_mesh(PBVH *bvh, struct MFace *faces, struct MVert *verts,
 			int totface, int totvert);
 void BLI_pbvh_build_grids(PBVH *bvh, struct DMGridData **grids,
 	struct DMGridAdjacency *gridadj, int totgrid,
-	int gridsize, void **gridfaces);
+	int gridsize, void **gridfaces, struct DMFlagMat *flagmats,
+	unsigned int **grid_hidden);
 void BLI_pbvh_free(PBVH *bvh);
 
 /* Hierarchical Search in the BVH, two methods:
-   * for each hit calling a callback
-   * gather nodes in an array (easy to multithread) */
+ * - for each hit calling a callback
+ * - gather nodes in an array (easy to multithread) */
 
 void BLI_pbvh_search_callback(PBVH *bvh,
 	BLI_pbvh_SearchCallback scb, void *search_data,
@@ -72,9 +76,9 @@ void BLI_pbvh_search_gather(PBVH *bvh,
 	PBVHNode ***array, int *tot);
 
 /* Raycast
-   the hit callback is called for all leaf nodes intersecting the ray;
-   it's up to the callback to find the primitive within the leaves that is
-   hit first */
+ * the hit callback is called for all leaf nodes intersecting the ray;
+ * it's up to the callback to find the primitive within the leaves that is
+ * hit first */
 
 void BLI_pbvh_raycast(PBVH *bvh, BLI_pbvh_HitOccludedCallback cb, void *data,
                       float ray_start[3], float ray_normal[3], int original);
@@ -84,8 +88,19 @@ int BLI_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3],
 /* Drawing */
 
 void BLI_pbvh_node_draw(PBVHNode *node, void *data);
-int BLI_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data);
-void BLI_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3], int smooth);
+void BLI_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3],
+				   int (*setMaterial)(int, void *attribs));
+
+/* PBVH Access */
+typedef enum {
+	PBVH_FACES,
+	PBVH_GRIDS,
+} PBVHType;
+
+PBVHType BLI_pbvh_type(const PBVH *bvh);
+
+/* multires hidden data, only valid for type == PBVH_GRIDS */
+unsigned int **BLI_pbvh_grid_hidden(const PBVH *bvh);
 
 /* Node Access */
 
@@ -96,10 +111,15 @@ typedef enum {
 	PBVH_UpdateBB = 4,
 	PBVH_UpdateOriginalBB = 8,
 	PBVH_UpdateDrawBuffers = 16,
-	PBVH_UpdateRedraw = 32
+	PBVH_UpdateRedraw = 32,
+
+	PBVH_RebuildDrawBuffers = 64,
+	PBVH_FullyHidden = 128
 } PBVHNodeFlags;
 
 void BLI_pbvh_node_mark_update(PBVHNode *node);
+void BLI_pbvh_node_mark_rebuild_draw(PBVHNode *node);
+void BLI_pbvh_node_fully_hidden_set(PBVHNode *node, int fully_hidden);
 
 void BLI_pbvh_node_get_grids(PBVH *bvh, PBVHNode *node,
 	int **grid_indices, int *totgrid, int *maxgrid, int *gridsize,
@@ -114,6 +134,11 @@ void BLI_pbvh_node_get_original_BB(PBVHNode *node, float bb_min[3], float bb_max
 
 float BLI_pbvh_node_get_tmin(PBVHNode* node);
 
+/* test if AABB is at least partially inside the planes' volume */
+int BLI_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data);
+/* test if AABB is at least partially outside the planes' volume */
+int BLI_pbvh_node_planes_exclude_AABB(PBVHNode *node, void *data);
+
 /* Update Normals/Bounding Box/Draw Buffers/Redraw and clear flags */
 
 void BLI_pbvh_update(PBVH *bvh, int flags, float (*face_nors)[3]);
@@ -131,9 +156,11 @@ int BLI_pbvh_isDeformed(struct PBVH *pbvh);
 /* Vertex Iterator */
 
 /* this iterator has quite a lot of code, but it's designed to:
-   - allow the compiler to eliminate dead code and variables
-   - spend most of the time in the relatively simple inner loop */
+ * - allow the compiler to eliminate dead code and variables
+ * - spend most of the time in the relatively simple inner loop */
 
+/* note: PBVH_ITER_ALL does not skip hidden vertices,
+ * PBVH_ITER_UNIQUE does */
 #define PBVH_ITER_ALL		0
 #define PBVH_ITER_UNIQUE	1
 
@@ -142,7 +169,6 @@ typedef struct PBVHVertexIter {
 	int g;
 	int width;
 	int height;
-	int skip;
 	int gx;
 	int gy;
 	int i;
@@ -150,6 +176,7 @@ typedef struct PBVHVertexIter {
 	/* grid */
 	struct DMGridData **grids;
 	struct DMGridData *grid;
+	BLI_bitmap *grid_hidden, gh;
 	int *grid_indices;
 	int totgrid;
 	int gridsize;
@@ -160,7 +187,7 @@ typedef struct PBVHVertexIter {
 	int *vert_indices;
 
 	/* result: these are all computed in the macro, but we assume
-	   that compiler optimizations will skip the ones we don't use */
+	 * that compiler optimization's will skip the ones we don't use */
 	struct MVert *mvert;
 	float *co;
 	short *no;
@@ -171,47 +198,19 @@ typedef struct PBVHVertexIter {
 #pragma warning (disable:4127) // conditional expression is constant
 #endif
 
+void pbvh_vertex_iter_init(PBVH *bvh, PBVHNode *node,
+						   PBVHVertexIter *vi, int mode);
+
 #define BLI_pbvh_vertex_iter_begin(bvh, node, vi, mode) \
-	{ \
-		struct DMGridData **grids; \
-		struct MVert *verts; \
-		int *grid_indices, totgrid, gridsize, *vert_indices, uniq_verts, totvert; \
-		\
-		vi.grid= 0; \
-		vi.no= 0; \
-		vi.fno= 0; \
-		vi.mvert= 0; \
-		vi.skip= 0; \
-		\
-		BLI_pbvh_node_get_grids(bvh, node, &grid_indices, &totgrid, NULL, &gridsize, &grids, NULL); \
-		BLI_pbvh_node_num_verts(bvh, node, &uniq_verts, &totvert); \
-		BLI_pbvh_node_get_verts(bvh, node, &vert_indices, &verts); \
-		\
-		vi.grids= grids; \
-		vi.grid_indices= grid_indices; \
-		vi.totgrid= (grids)? totgrid: 1; \
-		vi.gridsize= gridsize; \
-		\
-		if(mode == PBVH_ITER_ALL) \
-			vi.totvert = totvert; \
-		else \
-			vi.totvert= uniq_verts; \
-		vi.vert_indices= vert_indices; \
-		vi.mverts= verts; \
-	}\
+	pbvh_vertex_iter_init(bvh, node, &vi, mode); \
 	\
 	for(vi.i=0, vi.g=0; vi.g<vi.totgrid; vi.g++) { \
 		if(vi.grids) { \
 			vi.width= vi.gridsize; \
 			vi.height= vi.gridsize; \
 			vi.grid= vi.grids[vi.grid_indices[vi.g]]; \
-			vi.skip= 0; \
-			 \
-			/*if(mode == PVBH_ITER_UNIQUE) { \
-				vi.grid += subm->grid.offset; \
-				vi.skip= subm->grid.skip; \
-				vi.grid -= skip; \
-			}*/ \
+			if(mode == PBVH_ITER_UNIQUE) \
+				vi.gh= vi.grid_hidden[vi.grid_indices[vi.g]];	\
 		} \
 		else { \
 			vi.width= vi.totvert; \
@@ -219,16 +218,20 @@ typedef struct PBVHVertexIter {
 		} \
 		 \
 		for(vi.gy=0; vi.gy<vi.height; vi.gy++) { \
-			if(vi.grid) vi.grid += vi.skip; \
-			\
 			for(vi.gx=0; vi.gx<vi.width; vi.gx++, vi.i++) { \
 				if(vi.grid) { \
 					vi.co= vi.grid->co; \
 					vi.fno= vi.grid->no; \
 					vi.grid++; \
+					if(vi.gh) { \
+						if(BLI_BITMAP_GET(vi.gh, vi.gy * vi.gridsize + vi.gx)) \
+							continue; \
+					} \
 				} \
 				else { \
 					vi.mvert= &vi.mverts[vi.vert_indices[vi.gx]]; \
+					if(mode == PBVH_ITER_UNIQUE && vi.mvert->flag & ME_HIDE) \
+						continue; \
 					vi.co= vi.mvert->co; \
 					vi.no= vi.mvert->no; \
 				} \
@@ -246,5 +249,5 @@ 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]);
 
-#endif /* BLI_PBVH_H */
+#endif /* __BLI_PBVH_H__ */
 
diff --git a/source/blender/blenlib/BLI_rand.h b/source/blender/blenlib/BLI_rand.h
index 7ce0031..d4d6563 100644
--- a/source/blender/blenlib/BLI_rand.h
+++ b/source/blender/blenlib/BLI_rand.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
  
-#ifndef BLI_RAND_H
-#define BLI_RAND_H
+#ifndef __BLI_RAND_H__
+#define __BLI_RAND_H__
 
 /** \file BLI_rand.h
  *  \ingroup bli
@@ -68,8 +68,8 @@ double	BLI_drand		(void);
 	/** Return a pseudo-random number N where 0.0f<=N<1.0f */
 float	BLI_frand		(void);
 
-	/** Fills a block of memory starting at @a addr
-	 * and extending @a len bytes with pseudo-random
+	/** Fills a block of memory starting at \a addr
+	 * and extending \a len bytes with pseudo-random
 	 * contents. This routine does not use nor modify
 	 * the state of the BLI random number generator.
 	 */
diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h
index 25b7f19..7ce19ce 100644
--- a/source/blender/blenlib/BLI_rect.h
+++ b/source/blender/blenlib/BLI_rect.h
@@ -26,8 +26,8 @@
  *
  */
 
-#ifndef BLI_RECT_H
-#define BLI_RECT_H
+#ifndef __BLI_RECT_H__
+#define __BLI_RECT_H__
 
 /** \file BLI_rect.h
  *  \ingroup bli
@@ -46,7 +46,7 @@ extern "C" {
  * rect is one with a zero (or negative)
  * width or height.
  *
- * @return True if @a rect is empty.
+ * \return True if \a rect is empty.
  */
 int  BLI_rcti_is_empty(struct rcti *rect);
 int  BLI_rctf_is_empty(struct rctf *rect);
@@ -58,6 +58,8 @@ void BLI_resize_rcti(struct rcti *rect, int x, int y);
 void BLI_resize_rctf(struct rctf *rect, float x, float y);
 int  BLI_in_rcti(struct rcti *rect, int x, int y);
 int  BLI_in_rctf(struct rctf *rect, float x, float y);
+int  BLI_segment_in_rcti(struct rcti *rect, int s1[2], int s2[2]);
+// int  BLI_segment_in_rctf(struct rcti *rect, int s1[2], int s2[2]); // NOT NEEDED YET
 int  BLI_isect_rctf(struct rctf *src1, struct rctf *src2, struct rctf *dest);
 int  BLI_isect_rcti(struct rcti *src1, struct rcti *src2, struct rcti *dest);
 void BLI_union_rctf(struct rctf *rcta, struct rctf *rctb);
diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h
index 8af98b2..26bcd50 100644
--- a/source/blender/blenlib/BLI_scanfill.h
+++ b/source/blender/blenlib/BLI_scanfill.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BLI_SCANFILL_H
-#define BLI_SCANFILL_H
+#ifndef __BLI_SCANFILL_H__
+#define __BLI_SCANFILL_H__
 
 /** \file BLI_scanfill.h
  *  \ingroup bli
@@ -35,32 +35,78 @@
  *  \brief Filling meshes.
  */
 
-/**
- * @attention Defined in scanfill.c
- */
-extern struct ListBase fillvertbase;
-extern struct ListBase filledgebase;
-extern struct ListBase fillfacebase;
-
-struct EditVert;
+struct ScanFillVert;
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+typedef struct ScanFillContext
+{
+	ListBase fillvertbase;
+	ListBase filledgebase;
+	ListBase fillfacebase;
+
+	/* simple optimization for allocating thousands of small memory blocks
+	 * only to be used within loops, and not by one function at a time
+	 * free in the end, with argument '-1'
+	 */
+#define MEM_ELEM_BLOCKSIZE 16384
+	struct mem_elements *melem__cur;
+	int melem__offs;                   /* the current free address */
+	ListBase melem__lb;
+
+	/* private */
+	struct ScanFillVertLink *_scdata;
+} ScanFillContext;
+
+/* note; changing this also might affect the undo copy in editmesh.c */
+typedef struct ScanFillVert
+{
+	struct ScanFillVert *next, *prev;
+	union {
+		struct ScanFillVert *v;
+		void                *p;
+		intptr_t             l;
+	} tmp;
+	float co[3]; /* vertex location */
+	float xy[2]; /* 2D copy of vertex location (using dominant axis) */
+	int keyindex; /* original index #, for restoring  key information */
+	short poly_nr;
+	unsigned char f, h;
+} ScanFillVert;
+
+typedef struct ScanFillEdge
+{
+	struct ScanFillEdge *next, *prev;
+	struct ScanFillVert *v1, *v2;
+	short poly_nr;
+	unsigned char f;
+} ScanFillEdge;
+
+typedef struct ScanFillFace
+{
+	struct ScanFillFace *next, *prev;
+	struct ScanFillVert *v1, *v2, *v3;
+} ScanFillFace;
+
 /* scanfill.c: used in displist only... */
-struct EditVert *BLI_addfillvert(float *vec);
-struct EditEdge *BLI_addfilledge(struct EditVert *v1, struct EditVert *v2);
-int BLI_edgefill(short mat_nr);
-void BLI_end_edgefill(void);
+struct ScanFillVert *BLI_addfillvert(ScanFillContext *sf_ctx, const float vec[3]);
+struct ScanFillEdge *BLI_addfilledge(ScanFillContext *sf_ctx, struct ScanFillVert *v1, struct ScanFillVert *v2);
+
+int BLI_begin_edgefill(ScanFillContext *sf_ctx);
+int BLI_edgefill(ScanFillContext *sf_ctx, const short do_quad_tri_speedup);
+int BLI_edgefill_ex(ScanFillContext *sf_ctx, const short do_quad_tri_speedup,
+                    const float nor_proj[3]);
+void BLI_end_edgefill(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
  * callback is not set, the error is discarded.
- * @param f The function to use as callback
- * @attention used in creator.c
+ * \param f The function to use as callback
+ * \attention used in creator.c
  */
 void BLI_setErrorCallBack(void (*f)(const char*));
 
@@ -69,8 +115,8 @@ void BLI_setErrorCallBack(void (*f)(const char*));
  * in this module. If the function returns true, the execution will
  * terminate gracefully. If the callback is not set, interruption is
  * not possible.
- * @param f The function to use as callback
- * @attention used in creator.c
+ * \param f The function to use as callback
+ * \attention used in creator.c
  */
 void BLI_setInterruptCallBack(int (*f)(void));
 
diff --git a/source/blender/blenlib/BLI_smallhash.h b/source/blender/blenlib/BLI_smallhash.h
new file mode 100644
index 0000000..5063176
--- /dev/null
+++ b/source/blender/blenlib/BLI_smallhash.h
@@ -0,0 +1,73 @@
+/*
+ * ***** 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.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Joseph Eagar.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+ 
+#ifndef __BLI_SMALLHASH_H__
+#define __BLI_SMALLHASH_H__
+
+/** \file BLI_smallhash.h
+ *  \ingroup bli
+ */
+
+/* a light stack-friendly hash library,
+ * (it uses stack space for smallish hash tables) */
+
+/* based on a doubling non-chaining approach */
+
+typedef struct {
+	uintptr_t key;
+	void *val;
+} SmallHashEntry;
+
+/*how much stack space to use before dynamically allocating memory*/
+#define SMSTACKSIZE	521
+typedef struct SmallHash {
+	SmallHashEntry *table;
+	SmallHashEntry _stacktable[SMSTACKSIZE];
+	SmallHashEntry _copytable[SMSTACKSIZE];
+	SmallHashEntry *stacktable, *copytable;
+	int used;
+	int curhash;
+	int size;
+} SmallHash;
+
+typedef struct {
+	SmallHash *hash;
+	int i;
+} SmallHashIter;
+
+void	BLI_smallhash_init(SmallHash *hash);
+void	BLI_smallhash_release(SmallHash *hash);
+void	BLI_smallhash_insert(SmallHash *hash, uintptr_t key, void *item);
+void	BLI_smallhash_remove(SmallHash *hash, uintptr_t key);
+void *	BLI_smallhash_lookup(SmallHash *hash, uintptr_t key);
+int		BLI_smallhash_haskey(SmallHash *hash, uintptr_t key);
+int		BLI_smallhash_count(SmallHash *hash);
+void *	BLI_smallhash_iternext(SmallHashIter *iter, uintptr_t *key);
+void *	BLI_smallhash_iternew(SmallHash *hash, SmallHashIter *iter, uintptr_t *key);
+/* void BLI_smallhash_print(SmallHash *hash); */ /* UNUSED */
+
+#endif /* __BLI_SMALLHASH_H__ */
diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h
index 46389a9..ec36d58 100644
--- a/source/blender/blenlib/BLI_string.h
+++ b/source/blender/blenlib/BLI_string.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BLI_STRING_H
-#define BLI_STRING_H
+#ifndef __BLI_STRING_H__
+#define __BLI_STRING_H__
 
 /** \file BLI_string.h
  *  \ingroup bli
@@ -37,30 +37,30 @@ extern "C" {
 #endif
 
 	/**
-	 * Duplicates the cstring @a str into a newly mallocN'd
+	 * Duplicates the cstring \a str into a newly mallocN'd
 	 * string and returns it.
 	 * 
-	 * @param str The string to be duplicated
-	 * @retval Returns the duplicated string
+	 * \param str The string to be duplicated
+	 * \retval Returns the duplicated string
 	 */
 char *BLI_strdup(const char *str);
 
 	/**
-	 * Duplicates the first @a len bytes of cstring @a str 
-	 * into a newly mallocN'd string and returns it. @a str
+	 * Duplicates the first \a len bytes of cstring \a str 
+	 * into a newly mallocN'd string and returns it. \a str
 	 * is assumed to be at least len bytes long.
 	 * 
-	 * @param str The string to be duplicated
-	 * @param len The number of bytes to duplicate
-	 * @retval Returns the duplicated string
+	 * \param str The string to be duplicated
+	 * \param len The number of bytes to duplicate
+	 * \retval Returns the duplicated string
 	 */
 char *BLI_strdupn(const char *str, const size_t len);
 
 	/**
 	 * Appends the two strings, and returns new mallocN'ed string
-	 * @param str1 first string for copy
-	 * @param str2 second string for append
-	 * @retval Returns dst
+	 * \param str1 first string for copy
+	 * \param str2 second string for append
+	 * \retval Returns dst
 	 */
 char *BLI_strdupcat(const char *str1, const char *str2);
 
@@ -68,11 +68,11 @@ char *BLI_strdupcat(const char *str1, const char *str2);
 	 * Like strncpy but ensures dst is always
 	 * '\0' terminated.
 	 * 
-	 * @param dst Destination for copy
-	 * @param src Source string to copy
-	 * @param maxncpy Maximum number of characters to copy (generally
+	 * \param dst Destination for copy
+	 * \param src Source string to copy
+	 * \param maxncpy Maximum number of characters to copy (generally
 	 *   the size of dst)
-	 * @retval Returns dst
+	 * \retval Returns dst
 	 */
 char *BLI_strncpy(char *dst, const char *src, const size_t maxncpy);
 
@@ -88,14 +88,14 @@ char *BLI_strncpy(char *dst, const char *src, const size_t maxncpy);
 char *BLI_getQuotedStr(const char *str, const char *prefix);
 
 	/**
-	 * Returns a copy of the cstring @a str into a newly mallocN'd
+	 * Returns a copy of the cstring \a str into a newly mallocN'd
 	 * string with all instances of oldText replaced with newText,
 	 * and returns it.
 	 * 
-	 * @param str The string to replace occurances of oldText in
-	 * @param oldText The text in the string to find and replace
-	 * @param newText The text in the string to find and replace
-	 * @retval Returns the duplicated string
+	 * \param str The string to replace occurrences of oldText in
+	 * \param oldText The text in the string to find and replace
+	 * \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);
 
@@ -123,7 +123,7 @@ size_t BLI_strescape(char *dst, const char *src, const size_t maxlen);
 	/**
 	 * Compare two strings without regard to case.
 	 * 
-	 * @retval True if the strings are equal, false otherwise.
+	 * \retval True if the strings are equal, false otherwise.
 	 */
 int BLI_strcaseeq(const char *a, const char *b);
 
diff --git a/source/blender/blenlib/BLI_string_cursor_utf8.h b/source/blender/blenlib/BLI_string_cursor_utf8.h
new file mode 100644
index 0000000..11c91aa
--- /dev/null
+++ b/source/blender/blenlib/BLI_string_cursor_utf8.h
@@ -0,0 +1,51 @@
+/*
+ * ***** 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) 2011 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BLI_STRING_CURSOR_UTF8_H__
+#define __BLI_STRING_CURSOR_UTF8_H__
+
+/** \file BLI_string_utf8.h
+ *  \ingroup bli
+ */
+
+typedef enum strCursorJumpType {
+	STRCUR_JUMP_NONE,
+	STRCUR_JUMP_DELIM,
+	STRCUR_JUMP_ALL
+} strCursorJumpType;
+
+typedef enum strCursorJumpDirection {
+	STRCUR_DIR_PREV,
+	STRCUR_DIR_NEXT
+} strCursorJumpDirection;
+
+int BLI_str_cursor_step_next_utf8(const char *str, size_t maxlen, int *pos);
+int BLI_str_cursor_step_prev_utf8(const char *str, size_t maxlen, int *pos);
+
+void BLI_str_cursor_step_utf8(const char *str, size_t maxlen,
+                              int *pos, strCursorJumpDirection direction,
+                              strCursorJumpType jump);
+
+#endif /* __BLI_STRING_CURSOR_UTF8_H__ */
diff --git a/source/blender/blenlib/BLI_string_utf8.h b/source/blender/blenlib/BLI_string_utf8.h
index 6eba7d5..7799c32 100644
--- a/source/blender/blenlib/BLI_string_utf8.h
+++ b/source/blender/blenlib/BLI_string_utf8.h
@@ -20,8 +20,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BLI_STRING_UTF8_H
-#define BLI_STRING_UTF8_H
+#ifndef __BLI_STRING_UTF8_H__
+#define __BLI_STRING_UTF8_H__
 
 /** \file BLI_string_utf8.h
  *  \ingroup bli
diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h
index a513b9f..8e75a2d 100644
--- a/source/blender/blenlib/BLI_threads.h
+++ b/source/blender/blenlib/BLI_threads.h
@@ -27,8 +27,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BLI_THREADS_H
-#define BLI_THREADS_H 
+#ifndef __BLI_THREADS_H__
+#define __BLI_THREADS_H__ 
 
 /** \file BLI_threads.h
  *  \ingroup bli
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index 6d9188c..3a533f7 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BLI_UTILDEFINES_H
-#define BLI_UTILDEFINES_H
+#ifndef __BLI_UTILDEFINES_H__
+#define __BLI_UTILDEFINES_H__
 
 /** \file BLI_utildefines.h
  *  \ingroup bli
@@ -53,8 +53,21 @@
 #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; }
-#define SHIFT4(type, a, b, c, d) { type tmp; tmp = a; a = d; d = c; c = b; b = tmp; }
+#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
 
 /* min/max */
 #define MIN2(x,y)               ( (x)<(y) ? (x) : (y) )
@@ -72,17 +85,17 @@
 #define INIT_MINMAX2(min, max) {                                              \
 		(min)[0]= (min)[1]= 1.0e30f;                                          \
 		(max)[0]= (max)[1]= -1.0e30f;                                         \
-	}
+	} (void)0
 #define DO_MIN(vec, min) {                                                    \
 		if( (min)[0]>(vec)[0] ) (min)[0]= (vec)[0];                           \
 		if( (min)[1]>(vec)[1] ) (min)[1]= (vec)[1];                           \
 		if( (min)[2]>(vec)[2] ) (min)[2]= (vec)[2];                           \
-	}
+	} (void)0
 #define DO_MAX(vec, max) {                                                    \
 		if( (max)[0]<(vec)[0] ) (max)[0]= (vec)[0];                           \
 		if( (max)[1]<(vec)[1] ) (max)[1]= (vec)[1];                           \
 		if( (max)[2]<(vec)[2] ) (max)[2]= (vec)[2];                           \
-	}
+	} (void)0
 #define DO_MINMAX(vec, min, max) {                                            \
 		if( (min)[0]>(vec)[0] ) (min)[0]= (vec)[0];                           \
 		if( (min)[1]>(vec)[1] ) (min)[1]= (vec)[1];                           \
@@ -90,13 +103,13 @@
 		if( (max)[0]<(vec)[0] ) (max)[0]= (vec)[0];                           \
 		if( (max)[1]<(vec)[1] ) (max)[1]= (vec)[1];                           \
 		if( (max)[2]<(vec)[2] ) (max)[2]= (vec)[2];                           \
-	}
+	} (void)0
 #define DO_MINMAX2(vec, min, max) {                                           \
 		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];                           \
-	}
+	} (void)0
 
 /* some math and copy defines */
 
@@ -113,71 +126,65 @@
 		(v1)[0]= FTOCHAR((v2[0]));                                            \
 		(v1)[1]= FTOCHAR((v2[1]));                                            \
 		(v1)[2]= FTOCHAR((v2[2]));                                            \
-	}
+	} (void)0
 #define F3TOCHAR4(v2, v1) {                                                   \
 		(v1)[0]= FTOCHAR((v2[0]));                                            \
 		(v1)[1]= FTOCHAR((v2[1]));                                            \
 		(v1)[2]= FTOCHAR((v2[2]));                                            \
 		(v1)[3]= 255;                                                         \
-	}
+	} (void)0
 #define F4TOCHAR4(v2, v1) {                                                   \
 		(v1)[0]= FTOCHAR((v2[0]));                                            \
 		(v1)[1]= FTOCHAR((v2[1]));                                            \
 		(v1)[2]= FTOCHAR((v2[2]));                                            \
 		(v1)[3]= FTOCHAR((v2[3]));                                            \
-	}
+	} (void)0
 #define VECCOPY(v1, v2) {                                                     \
 		*(v1)=   *(v2);                                                       \
 		*(v1+1)= *(v2+1);                                                     \
 		*(v1+2)= *(v2+2);                                                     \
-	}
+	} (void)0
 #define VECCOPY2D(v1, v2) {                                                   \
 		*(v1)=   *(v2);                                                       \
 		*(v1+1)= *(v2+1);                                                     \
-	}
-#define QUATCOPY(v1, v2) {                                                    \
-		*(v1)=   *(v2);                                                       \
-		*(v1+1)= *(v2+1);                                                     \
-		*(v1+2)= *(v2+2);                                                     \
-		*(v1+3)= *(v2+3);                                                     \
-	}
+	} (void)0
 #define VECADD(v1,v2,v3) {                                                    \
 		*(v1)=   *(v2)   + *(v3);                                             \
 		*(v1+1)= *(v2+1) + *(v3+1);                                           \
 		*(v1+2)= *(v2+2) + *(v3+2);                                           \
-	}
+	} (void)0
 #define VECSUB(v1,v2,v3) {                                                    \
 		*(v1)=   *(v2)   - *(v3);                                             \
 		*(v1+1)= *(v2+1) - *(v3+1);                                           \
 		*(v1+2)= *(v2+2) - *(v3+2);                                           \
-	}
+	} (void)0
 #define VECSUB2D(v1,v2,v3)     {                                              \
 		*(v1)=   *(v2)   - *(v3);                                             \
 		*(v1+1)= *(v2+1) - *(v3+1);                                           \
-	}
+	} (void)0
 #define VECADDFAC(v1,v2,v3,fac) {                                             \
 		*(v1)=   *(v2)   + *(v3)*(fac);                                       \
 		*(v1+1)= *(v2+1) + *(v3+1)*(fac);                                     \
 		*(v1+2)= *(v2+2) + *(v3+2)*(fac);                                     \
-	}
+	} (void)0
 #define VECSUBFAC(v1,v2,v3,fac) {                                             \
 		*(v1)=   *(v2)   - *(v3)*(fac);                                       \
 		*(v1+1)= *(v2+1) - *(v3+1)*(fac);                                     \
 		*(v1+2)= *(v2+2) - *(v3+2)*(fac);                                     \
-	}
-#define QUATADDFAC(v1,v2,v3,fac) {                                            \
-		*(v1)=   *(v2)   + *(v3)*(fac);                                       \
-		*(v1+1)= *(v2+1) + *(v3+1)*(fac);                                     \
-		*(v1+2)= *(v2+2) + *(v3+2)*(fac);                                     \
-		*(v1+3)= *(v2+3) + *(v3+3)*(fac);                                     \
-	}
+	} (void)0
 
 #define INPR(v1, v2) ( (v1)[0]*(v2)[0] + (v1)[1]*(v2)[1] + (v1)[2]*(v2)[2] )
 
 /* some misc stuff.... */
 #define CLAMP(a, b, c)		if((a)<(b)) (a)=(b); else if((a)>(c)) (a)=(c)
 #define CLAMPIS(a, b, c) ((a)<(b) ? (b) : (a)>(c) ? (c) : (a))
-#define CLAMPTEST(a, b, c)	if((b)<(c)) {CLAMP(a, b, c);} else {CLAMP(a, c, b);}
+#define CLAMPTEST(a, b, c)                                                    \
+	if ((b) < (c)) {                                                          \
+		CLAMP(a, b, c);                                                       \
+	}                                                                         \
+	else {                                                                    \
+		CLAMP(a, c, b);                                                       \
+	} (void)
 
 #define IS_EQ(a,b) ((fabs((double)(a)-(b)) >= (double) FLT_EPSILON) ? 0 : 1)
 #define IS_EQF(a,b) ((fabsf((float)(a)-(b)) >= (float) FLT_EPSILON) ? 0 : 1)
@@ -203,32 +210,35 @@
 		s_i= p_i[1]; p_i[1]= p_i[6]; p_i[6]= s_i;                             \
 		s_i= p_i[2]; p_i[2]= p_i[5]; p_i[5]= s_i;                             \
 		s_i= p_i[3]; p_i[3]= p_i[4]; p_i[4]= s_i;                             \
-	}
+	} (void)0
 
 #define SWITCH_INT(a) {                                                       \
 		char s_i, *p_i;                                                       \
 		p_i= (char *)&(a);                                                    \
 		s_i= p_i[0]; p_i[0]= p_i[3]; p_i[3]= s_i;                             \
 		s_i= p_i[1]; p_i[1]= p_i[2]; p_i[2]= s_i;                             \
-	}
+	} (void)0
 
 #define SWITCH_SHORT(a) {                                                     \
 		char s_i, *p_i;                                                       \
 		p_i= (char *)&(a);                                                    \
 		s_i=p_i[0]; p_i[0]=p_i[1]; p_i[1]=s_i;                                \
-	}
+	} (void)0
 
 
 /* Warning-free macros for storing ints in pointers. Use these _only_
  * for storing an int in a pointer, not a pointer in an int (64bit)! */
-#define SET_INT_IN_POINTER(i) ((void*)(intptr_t)(i))
-#define GET_INT_FROM_POINTER(i) ((int)(intptr_t)(i))
+#define SET_INT_IN_POINTER(i)    ((void *)(intptr_t)(i))
+#define GET_INT_FROM_POINTER(i)  ((int)(intptr_t)(i))
 
 /* Macro to convert a value to string in the preprocessor
- * STRINGIFY_ARG: gives the defined name in the string
- * STRINGIFY: gives the defined value. */
-#define STRINGIFY_ARG(x) #x
-#define STRINGIFY(x) STRINGIFY_ARG(x)
+ * STRINGIFY_ARG: gives the argument as a string
+ * STRINGIFY_APPEND: appends any argument 'b' onto the string argument 'a',
+ *   used by STRINGIFY because some preprocessors warn about zero arguments
+ * STRINGIFY: gives the argument's value as a string */
+#define STRINGIFY_ARG(x) "" #x
+#define STRINGIFY_APPEND(a, b) "" a #b
+#define STRINGIFY(x) STRINGIFY_APPEND("", x)
 
 /* useful for debugging */
 #define AT __FILE__ ":" STRINGIFY(__LINE__)
@@ -260,41 +270,41 @@
 
 /*little macro so inline keyword works*/
 #if defined(_MSC_VER)
-#  define BM_INLINE static __forceinline
+#  define BLI_INLINE static __forceinline
 #elif defined(__GNUC__)
-#  define BM_INLINE static inline __attribute((always_inline))
+#  define BLI_INLINE static inline __attribute((always_inline))
 #else
 /* #warning "MSC/GNUC defines not found, inline non-functional" */
-#  define BM_INLINE static
+#  define BLI_INLINE static
 #endif
 
 
 /* BLI_assert(), default only to print
  * for aborting need to define WITH_ASSERT_ABORT
  */
-#if !defined NDEBUG
+#ifndef NDEBUG
 #  ifdef WITH_ASSERT_ABORT
-#    define _dummy_abort abort
+#    define _BLI_DUMMY_ABORT abort
 #  else
-#    define _dummy_abort() (void)0
+#    define _BLI_DUMMY_ABORT() (void)0
 #  endif
 #  if defined(__GNUC__) || defined(_MSC_VER) /* check __func__ is available */
 #    define BLI_assert(a)                                                     \
 	(void)((!(a)) ?  (                                                        \
 		(                                                                     \
 		fprintf(stderr,                                                       \
-			"BLI_assert failed: %s, %s(), %d at \'%s\'\n",                    \
-			__FILE__, __func__, __LINE__, STRINGIFY(a)),                      \
-		_dummy_abort(),                                                       \
+			"BLI_assert failed: %s:%d, %s(), at \'%s\'\n",                    \
+			__FILE__, __LINE__, __func__, STRINGIFY(a)),                      \
+		_BLI_DUMMY_ABORT(),                                                   \
 		NULL)) : NULL)
 #  else
 #    define BLI_assert(a)                                                     \
 	(void)((!(a)) ?  (                                                        \
 		(                                                                     \
 		fprintf(stderr,                                                       \
-			"BLI_assert failed: %s, %d at \'%s\'\n",                          \
+			"BLI_assert failed: %s:%d, at \'%s\'\n",                          \
 			__FILE__, __LINE__, STRINGIFY(a)),                                \
-		_dummy_abort(),                                                       \
+		_BLI_DUMMY_ABORT(),                                                   \
 		NULL)) : NULL)
 #  endif
 #else
@@ -310,4 +320,4 @@
 #  define UNLIKELY(x)     (x)
 #endif
 
-#endif // BLI_UTILDEFINES_H
+#endif // __BLI_UTILDEFINES_H__
diff --git a/source/blender/blenlib/BLI_uvproject.h b/source/blender/blenlib/BLI_uvproject.h
index d4a34a9..5abad87 100644
--- a/source/blender/blenlib/BLI_uvproject.h
+++ b/source/blender/blenlib/BLI_uvproject.h
@@ -17,8 +17,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BKE_UVPROJECT_H
-#define BKE_UVPROJECT_H
+#ifndef __BLI_UVPROJECT_H__
+#define __BLI_UVPROJECT_H__
 
 /** \file BLI_uvproject.h
  *  \ingroup bli
diff --git a/source/blender/blenlib/BLI_vfontdata.h b/source/blender/blenlib/BLI_vfontdata.h
index e858e78..0020ba3 100644
--- a/source/blender/blenlib/BLI_vfontdata.h
+++ b/source/blender/blenlib/BLI_vfontdata.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BLI_VFONTDATA_H
-#define BLI_VFONTDATA_H
+#ifndef __BLI_VFONTDATA_H__
+#define __BLI_VFONTDATA_H__
 
 /** \file BLI_vfontdata.h
  *  \ingroup bli
@@ -70,8 +70,8 @@ struct TmpFont
  * Construct a new VFontData structure from 
  * Freetype font data in a PackedFile.
  * 
- * @param pf The font data.
- * @retval A new VFontData structure, or NULL
+ * \param pf The font data.
+ * \retval A new VFontData structure, or NULL
  * if unable to load.
  */
 	VFontData*
diff --git a/source/blender/blenlib/BLI_voxel.h b/source/blender/blenlib/BLI_voxel.h
index 8dd95a8..4a13810 100644
--- a/source/blender/blenlib/BLI_voxel.h
+++ b/source/blender/blenlib/BLI_voxel.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BLI_VOXEL_H
-#define BLI_VOXEL_H
+#ifndef __BLI_VOXEL_H__
+#define __BLI_VOXEL_H__
 
 /** \file BLI_voxel.h
  *  \ingroup bli
@@ -41,4 +41,4 @@ float voxel_sample_trilinear(float *data, const int res[3], const float co[3]);
 float voxel_sample_triquadratic(float *data, const int res[3], const float co[3]);
 float voxel_sample_tricubic(float *data, const int res[3], const float co[3], int bspline);
 
-#endif /* BLI_VOXEL_H */
+#endif /* __BLI_VOXEL_H__ */
diff --git a/source/blender/blenlib/BLI_winstuff.h b/source/blender/blenlib/BLI_winstuff.h
index 0eb2f86..a0ab88e 100644
--- a/source/blender/blenlib/BLI_winstuff.h
+++ b/source/blender/blenlib/BLI_winstuff.h
@@ -25,36 +25,38 @@
  * ***** END GPL LICENSE BLOCK *****
  */
  
-#ifndef __WINSTUFF_H__
-#define __WINSTUFF_H__
+#ifndef __BLI_WINSTUFF_H__
+#define __BLI_WINSTUFF_H__
 
 /** \file BLI_winstuff.h
  *  \ingroup bli
  *  \brief Compatibility-like things for windows.
  */
 
-#ifdef _WIN32
+#ifndef _WIN32
+#  error "This include is for Windows only!"
+#endif
 
 #ifndef FREE_WINDOWS
-#pragma warning(once: 4761 4305 4244 4018)
+#  pragma warning(once: 4761 4305 4244 4018)
 #else
-#ifdef WINVER
-#undef WINVER
-#endif
+#  ifdef WINVER
+#    undef WINVER
+#  endif
 
 /* Some stuff requires WINVER 0x500, but mingw's default is 0x400 */
-#define WINVER 0x0501
+#  define WINVER 0x0501
 #endif
 
 #define WIN32_LEAN_AND_MEAN
 
 #ifndef WIN32_SKIP_HKEY_PROTECTION
-#undef HKEY
-#define HKEY WIN32_HKEY				// prevent competing definitions
-#include <windows.h>
-#undef HKEY
+#  undef HKEY
+#  define HKEY WIN32_HKEY				// prevent competing definitions
+#  include <windows.h>
+#  undef HKEY
 #else
-#include <windows.h>
+#  include <windows.h>
 #endif
 
 #undef near
@@ -83,10 +85,10 @@ extern "C" {
 #define MAXPATHLEN MAX_PATH
 
 #ifndef S_ISREG
-#define S_ISREG(x) (((x)&_S_IFREG) == _S_IFREG)
+#  define S_ISREG(x) (((x)&_S_IFREG) == _S_IFREG)
 #endif
 #ifndef S_ISDIR
-#define S_ISDIR(x) (((x)&_S_IFDIR) == _S_IFDIR)
+#  define S_ISDIR(x) (((x)&_S_IFDIR) == _S_IFDIR)
 #endif
 
 /* defines for using ISO C++ conformant names */
@@ -98,21 +100,23 @@ typedef unsigned int mode_t;
 
 /* use functions that take a 64 bit offset for files larger than 4GB */
 #ifndef FREE_WINDOWS
-#include <stdio.h>
-#define fseek(stream, offset, origin) _fseeki64(stream, offset, origin)
-#define ftell(stream) _ftelli64(stream)
-#define lseek(fd, offset, origin) _lseeki64(fd, offset, origin)
-#define tell(fd) _telli64(fd)
+#  include <stdio.h>
+#  define fseek(stream, offset, origin) _fseeki64(stream, offset, origin)
+#  define ftell(stream) _ftelli64(stream)
+#  define lseek(fd, offset, origin) _lseeki64(fd, offset, origin)
+#  define tell(fd) _telli64(fd)
 #endif
 
 /* mingw using _SSIZE_T_ to declare ssize_t type */
 #ifndef _SSIZE_T_
-#define _SSIZE_T_
+#  define _SSIZE_T_
 /* python uses HAVE_SSIZE_T */
-#ifndef HAVE_SSIZE_T
-#define HAVE_SSIZE_T 1
+#  ifndef HAVE_SSIZE_T
+#    define HAVE_SSIZE_T 1
+#    ifndef FREE_WINDOWS64
 typedef long ssize_t;
-#endif
+#    endif
+#  endif
 #endif
 
 struct dirent {
@@ -124,7 +128,7 @@ struct dirent {
 
 typedef struct _DIR {
 	HANDLE handle;
-	WIN32_FIND_DATA data;
+	WIN32_FIND_DATAW data;
 	char path[MAX_PATH];
 	long dd_loc;
 	long dd_size;
@@ -140,7 +144,7 @@ struct dirent *readdir(DIR *dp);
 int closedir (DIR *dp);
 void get_default_root(char *root);
 int check_file_chars(char *filename);
-char *dirname(char *path);
+const char *dirname(char *path);
 
 int BLI_getInstallationDir(char *str);
 
@@ -148,7 +152,5 @@ int BLI_getInstallationDir(char *str);
 }
 #endif
 
-#endif /* _WIN32 */
-
-#endif /* __WINSTUFF_H__ */
+#endif /* __BLI_WINSTUFF_H__ */
 
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index 03e3b82..c06a124 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -79,8 +79,10 @@ set(SRC
 	intern/rand.c
 	intern/rct.c
 	intern/scanfill.c
+	intern/smallhash.c
 	intern/storage.c
 	intern/string.c
+	intern/string_cursor_utf8.c
 	intern/string_utf8.c
 	intern/threads.c
 	intern/time.c
@@ -89,6 +91,8 @@ set(SRC
 	intern/winstuff.c
 
 	BLI_array.h
+	BLI_bitmap.h
+	BLI_smallhash.h
 	BLI_args.h
 	BLI_blenlib.h
 	BLI_boxpack2d.h
@@ -130,6 +134,7 @@ set(SRC
 	BLI_rect.h
 	BLI_scanfill.h
 	BLI_string.h
+	BLI_string_cursor_utf8.h
 	BLI_string_utf8.h
 	BLI_threads.h
 	BLI_utildefines.h
@@ -138,7 +143,6 @@ set(SRC
 	BLI_voxel.h
 	BLI_winstuff.h
 	PIL_time.h
-	intern/dynamiclist.h
 )
 
 if(WITH_BINRELOC)
@@ -156,4 +160,10 @@ if(WITH_XDG_USER_DIRS)
 	add_definitions(-DWITH_XDG_USER_DIRS)
 endif()
 
+if(WIN32)
+	list(APPEND INC
+		../../../intern/utfconv
+	)
+endif()
+
 blender_add_lib(bf_blenlib "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/blenlib/PIL_time.h b/source/blender/blenlib/PIL_time.h
index 0a777a8..7d34d33 100644
--- a/source/blender/blenlib/PIL_time.h
+++ b/source/blender/blenlib/PIL_time.h
@@ -32,8 +32,8 @@
  */
 
  
-#ifndef PIL_TIME_H
-#define PIL_TIME_H
+#ifndef __PIL_TIME_H__
+#define __PIL_TIME_H__
 
 #ifdef __cplusplus
 extern "C" { 
@@ -42,14 +42,14 @@ extern "C" {
 extern 
 	/** Return an indication of time, expressed	as
 	 * seconds since some fixed point. Successive calls
-	 * are guarenteed to generate values greator than or 
+	 * are guaranteed to generate values greater than or
 	 * equal to the last call.
 	 */
 double	PIL_check_seconds_timer		(void);
 
 	/**
 	 * Platform-independent sleep function.
-	 * @param ms Number of milliseconds to sleep
+	 * \param ms Number of milliseconds to sleep
 	 */
 void	PIL_sleep_ms				(int ms);
 
@@ -78,4 +78,4 @@ void	PIL_sleep_ms				(int ms);
 }
 #endif
 
-#endif /* !PIL_TIME_H */
+#endif /* !__PIL_TIME_H__ */
diff --git a/source/blender/blenlib/SConscript b/source/blender/blenlib/SConscript
index 00caf8c..e53f622 100644
--- a/source/blender/blenlib/SConscript
+++ b/source/blender/blenlib/SConscript
@@ -5,6 +5,8 @@ sources = env.Glob('intern/*.c')
 
 cflags=''
 incs = '. ../makesdna ../blenkernel #/intern/guardedalloc #/intern/ghost ../editors/include ../gpu ../blenloader'
+incs += ' ../windowmanager ../bmesh #/extern/glew/include'
+
 incs += ' ' + env['BF_FREETYPE_INC']
 incs += ' ' + env['BF_ZLIB_INC']
 defs = []
@@ -14,8 +16,9 @@ if env['WITH_BF_BINRELOC']:
     incs += ' ../../../extern/binreloc/include'
     defs.append('WITH_BINRELOC')
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
+    incs += ' ../../../intern/utfconv'
 
 if env['OURPLATFORM'] == 'linuxcross':
     if env['WITH_BF_OPENMP']:
@@ -25,4 +28,4 @@ if env['OURPLATFORM'] == 'darwin':
     if env['WITH_BF_OPENMP']:
        env.Append(CFLAGS=['-DPARALLEL=1'])
 
-env.BlenderLib ( 'bf_blenlib', sources, Split(incs), Split(defs), libtype=['core','player'], priority = [363,170], compileflags =cflags )
+env.BlenderLib ( 'bf_blenlib', sources, Split(incs), Split(defs), libtype=['core','player'], priority = [370,230], compileflags =cflags )
diff --git a/source/blender/blenlib/intern/BLI_args.c b/source/blender/blenlib/intern/BLI_args.c
index 04d5d57..cd90403 100644
--- a/source/blender/blenlib/intern/BLI_args.c
+++ b/source/blender/blenlib/intern/BLI_args.c
@@ -103,7 +103,8 @@ static int keycmp(const void *a, const void *b)
 			return BLI_strcasecmp(ka->arg, kb->arg);
 		else
 			return strcmp(ka->arg, kb->arg);
-	} else {
+	}
+	else {
 		return BLI_ghashutil_intcmp((const void*)ka->pass, (const void*)kb->pass);
 	}
 }
@@ -237,8 +238,7 @@ void BLI_argsPrintArgDoc(struct bArgs *ba, const char *arg)
 {
 	bArgument *a = lookUp(ba, arg, -1, -1);
 
-	if (a)
-	{
+	if (a) {
 		bArgDoc *d = a->doc;
 
 		internalDocPrint(d);
@@ -251,10 +251,8 @@ void BLI_argsPrintOtherDoc(struct bArgs *ba)
 {
 	bArgDoc *d;
 
-	for( d = ba->docs.first; d; d = d->next)
-	{
-		if (d->done == 0)
-		{
+	for (d = ba->docs.first; d; d = d->next) {
+		if (d->done == 0) {
 			internalDocPrint(d);
 		}
 	}
@@ -264,7 +262,7 @@ void BLI_argsParse(struct bArgs *ba, int pass, BA_ArgCallback default_cb, void *
 {
 	int i = 0;
 
-	for( i = 1; i < ba->argc; i++) { /* skip argv[0] */
+	for ( i = 1; i < ba->argc; i++) { /* skip argv[0] */
 		if (ba->passes[i] == 0) {
 			 /* -1 signal what side of the comparison it is */
 			bArgument *a = lookUp(ba, ba->argv[i], pass, -1);
@@ -274,7 +272,8 @@ void BLI_argsParse(struct bArgs *ba, int pass, BA_ArgCallback default_cb, void *
 			if (a) {
 				func = a->func;
 				data = a->data;
-			} else {
+			}
+			else {
 				func = default_cb;
 				data = default_data;
 			}
@@ -290,7 +289,8 @@ void BLI_argsParse(struct bArgs *ba, int pass, BA_ArgCallback default_cb, void *
 						ba->passes[i + j] = pass;
 					}
 					i += retval;
-				} else if (retval == -1){
+				}
+				else if (retval == -1) {
 					if (a) {
 						if (a->key->pass != -1)
 							ba->passes[i] = pass;
diff --git a/source/blender/blenlib/intern/BLI_dynstr.c b/source/blender/blenlib/intern/BLI_dynstr.c
index ad52de1..54d9bc5 100644
--- a/source/blender/blenlib/intern/BLI_dynstr.c
+++ b/source/blender/blenlib/intern/BLI_dynstr.c
@@ -119,9 +119,9 @@ void BLI_dynstr_vappendf(DynStr *ds, const char *format, va_list args)
 	const int maxlen= 65536;
 	int retval;
 
-	while(1) {
+	while (1) {
 		va_list args_cpy;
-		if(len == sizeof(fixedmessage))
+		if (len == sizeof(fixedmessage))
 			message= fixedmessage;
 		else
 			message= MEM_callocN(sizeof(char) * len, "BLI_dynstr_appendf");
@@ -131,36 +131,36 @@ void BLI_dynstr_vappendf(DynStr *ds, const char *format, va_list args)
 		retval= vsnprintf(message, len, format, args_cpy);
 		va_end(args_cpy);
 
-		if(retval == -1) {
+		if (retval == -1) {
 			/* -1 means not enough space, but on windows it may also mean
 			 * there is a formatting error, so we impose a maximum length */
-			if(message != fixedmessage)
+			if (message != fixedmessage)
 				MEM_freeN(message);
 			message= NULL;
 
 			len *= 2;
-			if(len > maxlen) {
+			if (len > maxlen) {
 				fprintf(stderr, "BLI_dynstr_append text too long or format error.\n");
 				break;
 			}
 		}
-		else if(retval >= len) {
+		else if (retval >= len) {
 			/* in C99 the actual length required is returned */
-			if(message != fixedmessage)
+			if (message != fixedmessage)
 				MEM_freeN(message);
 			message= NULL;
 
-			/* retval doesnt include \0 terminator */
+			/* retval doesn't include \0 terminator */
 			len= retval + 1;
 		}
 		else
 			break;
 	}
 
-	if(message) {
+	if (message) {
 		BLI_dynstr_append(ds, message);
 
-		if(message != fixedmessage)
+		if (message != fixedmessage)
 			MEM_freeN(message);
 	}
 }
@@ -177,8 +177,8 @@ void BLI_dynstr_appendf(DynStr *ds, const char *format, ...)
 	 * and avoid code duplication, that crashes on some system because
 	 * va_start/va_end have to be called for each vsnprintf call */
 
-	while(1) {
-		if(len == sizeof(fixedmessage))
+	while (1) {
+		if (len == sizeof(fixedmessage))
 			message= fixedmessage;
 		else
 			message= MEM_callocN(sizeof(char)*(len), "BLI_dynstr_appendf");
@@ -187,36 +187,36 @@ void BLI_dynstr_appendf(DynStr *ds, const char *format, ...)
 		retval= vsnprintf(message, len, format, args);
 		va_end(args);
 
-		if(retval == -1) {
+		if (retval == -1) {
 			/* -1 means not enough space, but on windows it may also mean
 			 * there is a formatting error, so we impose a maximum length */
-			if(message != fixedmessage)
+			if (message != fixedmessage)
 				MEM_freeN(message);
 			message= NULL;
 
 			len *= 2;
-			if(len > maxlen) {
+			if (len > maxlen) {
 				fprintf(stderr, "BLI_dynstr_append text too long or format error.\n");
 				break;
 			}
 		}
-		else if(retval >= len) {
+		else if (retval >= len) {
 			/* in C99 the actual length required is returned */
-			if(message != fixedmessage)
+			if (message != fixedmessage)
 				MEM_freeN(message);
 			message= NULL;
 
-			/* retval doesnt include \0 terminator */
+			/* retval doesn't include \0 terminator */
 			len= retval + 1;
 		}
 		else
 			break;
 	}
 
-	if(message) {
+	if (message) {
 		BLI_dynstr_append(ds, message);
 
-		if(message != fixedmessage)
+		if (message != fixedmessage)
 			MEM_freeN(message);
 	}
 }
diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c
index e100823..28b4794 100644
--- a/source/blender/blenlib/intern/BLI_ghash.c
+++ b/source/blender/blenlib/intern/BLI_ghash.c
@@ -33,11 +33,8 @@
 #include <string.h>
 #include <stdlib.h>
 
-
 #include "MEM_guardedalloc.h"
 
-
-
 // #include "BLI_blenlib.h"
 
 #include "BLI_utildefines.h"
@@ -47,7 +44,7 @@
 #include "BLO_sys_types.h" // for intptr_t support
 /***/
 
-static unsigned int hashsizes[]= {
+unsigned int hashsizes[] = {
 	5, 11, 17, 37, 67, 131, 257, 521, 1031, 2053, 4099, 8209, 
 	16411, 32771, 65537, 131101, 262147, 524309, 1048583, 2097169, 
 	4194319, 8388617, 16777259, 33554467, 67108879, 134217757, 
@@ -58,18 +55,18 @@ static unsigned int hashsizes[]= {
 
 GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info)
 {
-	GHash *gh= MEM_mallocN(sizeof(*gh), info);
-	gh->hashfp= hashfp;
-	gh->cmpfp= cmpfp;
-	gh->entrypool = BLI_mempool_create(sizeof(Entry), 64, 64, FALSE, FALSE);
-
-	gh->cursize= 0;
-	gh->nentries= 0;
-	gh->nbuckets= hashsizes[gh->cursize];
-	
-	gh->buckets= MEM_mallocN(gh->nbuckets*sizeof(*gh->buckets), "buckets");
-	memset(gh->buckets, 0, gh->nbuckets*sizeof(*gh->buckets));
-	
+	GHash *gh = MEM_mallocN(sizeof(*gh), info);
+	gh->hashfp = hashfp;
+	gh->cmpfp = cmpfp;
+	gh->entrypool = BLI_mempool_create(sizeof(Entry), 64, 64, 0);
+
+	gh->cursize = 0;
+	gh->nentries = 0;
+	gh->nbuckets = hashsizes[gh->cursize];
+
+	gh->buckets = MEM_mallocN(gh->nbuckets * sizeof(*gh->buckets), "buckets");
+	memset(gh->buckets, 0, gh->nbuckets * sizeof(*gh->buckets));
+
 	return gh;
 }
 
@@ -80,31 +77,31 @@ int BLI_ghash_size(GHash *gh)
 
 void BLI_ghash_insert(GHash *gh, void *key, void *val)
 {
-	unsigned int hash= gh->hashfp(key)%gh->nbuckets;
-	Entry *e= (Entry*) BLI_mempool_alloc(gh->entrypool);
+	unsigned int hash = gh->hashfp(key) % gh->nbuckets;
+	Entry *e = (Entry*)BLI_mempool_alloc(gh->entrypool);
 
-	e->key= key;
-	e->val= val;
-	e->next= gh->buckets[hash];
-	gh->buckets[hash]= e;
+	e->key = key;
+	e->val = val;
+	e->next = gh->buckets[hash];
+	gh->buckets[hash] = e;
 
-	if (++gh->nentries>(float)gh->nbuckets/2) {
-		Entry **old= gh->buckets;
-		int i, nold= gh->nbuckets;
+	if (++gh->nentries > (float)gh->nbuckets / 2) {
+		Entry **old = gh->buckets;
+		int i, nold = gh->nbuckets;
 
-		gh->nbuckets= hashsizes[++gh->cursize];
-		gh->buckets= (Entry**)MEM_mallocN(gh->nbuckets*sizeof(*gh->buckets), "buckets");
-		memset(gh->buckets, 0, gh->nbuckets*sizeof(*gh->buckets));
+		gh->nbuckets = hashsizes[++gh->cursize];
+		gh->buckets = (Entry**)MEM_mallocN(gh->nbuckets * sizeof(*gh->buckets), "buckets");
+		memset(gh->buckets, 0, gh->nbuckets * sizeof(*gh->buckets));
 
-		for (i=0; i<nold; i++) {
-			for (e= old[i]; e;) {
-				Entry *n= e->next;
+		for (i = 0; i < nold; i++) {
+			for (e = old[i]; e;) {
+				Entry *n = e->next;
 
-				hash= gh->hashfp(e->key)%gh->nbuckets;
-				e->next= gh->buckets[hash];
-				gh->buckets[hash]= e;
+				hash = gh->hashfp(e->key) % gh->nbuckets;
+				e->next = gh->buckets[hash];
+				gh->buckets[hash] = e;
 
-				e= n;
+				e = n;
 			}
 		}
 
@@ -114,33 +111,35 @@ void BLI_ghash_insert(GHash *gh, void *key, void *val)
 
 void *BLI_ghash_lookup(GHash *gh, const void *key)
 {
-	if(gh) {
-		unsigned int hash= gh->hashfp(key)%gh->nbuckets;
+	if (gh) {
+		unsigned int hash = gh->hashfp(key) % gh->nbuckets;
 		Entry *e;
 
-		for (e= gh->buckets[hash]; e; e= e->next)
-			if (gh->cmpfp(key, e->key)==0)
+		for (e = gh->buckets[hash]; e; e = e->next)
+			if (gh->cmpfp(key, e->key) == 0)
 				return e->val;
 	}
 	return NULL;
 }
 
-int BLI_ghash_remove (GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
+int BLI_ghash_remove(GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
 {
-	unsigned int hash= gh->hashfp(key)%gh->nbuckets;
+	unsigned int hash = gh->hashfp(key) % gh->nbuckets;
 	Entry *e;
 	Entry *p = NULL;
 
-	for (e= gh->buckets[hash]; e; e= e->next) {
-		if (gh->cmpfp(key, e->key)==0) {
-			Entry *n= e->next;
+	for (e = gh->buckets[hash]; e; e = e->next) {
+		if (gh->cmpfp(key, e->key) == 0) {
+			Entry *n = e->next;
 
-			if (keyfreefp) keyfreefp(e->key);
-			if (valfreefp) valfreefp(e->val);
+			if (keyfreefp)
+				keyfreefp(e->key);
+			if (valfreefp)
+				valfreefp(e->val);
 			BLI_mempool_free(gh->entrypool, e);
 
-			/* correct but 'e' isnt used before return */
-			/* e= n; */ /*UNUSED*/
+			/* correct but 'e' isn't used before return */
+			/* e= n; *//*UNUSED*/
 			if (p)
 				p->next = n;
 			else
@@ -157,11 +156,11 @@ int BLI_ghash_remove (GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFr
 
 int BLI_ghash_haskey(GHash *gh, void *key)
 {
-	unsigned int hash= gh->hashfp(key)%gh->nbuckets;
+	unsigned int hash = gh->hashfp(key) % gh->nbuckets;
 	Entry *e;
 
-	for (e= gh->buckets[hash]; e; e= e->next)
-		if (gh->cmpfp(key, e->key)==0)
+	for (e = gh->buckets[hash]; e; e = e->next)
+		if (gh->cmpfp(key, e->key) == 0)
 			return 1;
 
 	return 0;
@@ -170,22 +169,22 @@ int BLI_ghash_haskey(GHash *gh, void *key)
 void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
 {
 	int i;
-	
+
 	if (keyfreefp || valfreefp) {
-		for (i=0; i<gh->nbuckets; i++) {
+		for (i = 0; i < gh->nbuckets; i++) {
 			Entry *e;
-			
-			for (e= gh->buckets[i]; e; ) {
-				Entry *n= e->next;
-				
+
+			for (e = gh->buckets[i]; e;) {
+				Entry *n = e->next;
+
 				if (keyfreefp) keyfreefp(e->key);
 				if (valfreefp) valfreefp(e->val);
 
-				e= n;
+				e = n;
 			}
 		}
 	}
-	
+
 	MEM_freeN(gh->buckets);
 	BLI_mempool_destroy(gh->entrypool);
 	gh->buckets = NULL;
@@ -198,28 +197,28 @@ void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreef
 
 GHashIterator *BLI_ghashIterator_new(GHash *gh)
 {
-	GHashIterator *ghi= MEM_mallocN(sizeof(*ghi), "ghash iterator");
-	ghi->gh= gh;
-	ghi->curEntry= NULL;
-	ghi->curBucket= -1;
+	GHashIterator *ghi = MEM_mallocN(sizeof(*ghi), "ghash iterator");
+	ghi->gh = gh;
+	ghi->curEntry = NULL;
+	ghi->curBucket = -1;
 	while (!ghi->curEntry) {
 		ghi->curBucket++;
-		if (ghi->curBucket==ghi->gh->nbuckets)
+		if (ghi->curBucket == ghi->gh->nbuckets)
 			break;
-		ghi->curEntry= ghi->gh->buckets[ghi->curBucket];
+		ghi->curEntry = ghi->gh->buckets[ghi->curBucket];
 	}
 	return ghi;
 }
 void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh)
 {
-	ghi->gh= gh;
-	ghi->curEntry= NULL;
-	ghi->curBucket= -1;
+	ghi->gh = gh;
+	ghi->curEntry = NULL;
+	ghi->curBucket = -1;
 	while (!ghi->curEntry) {
 		ghi->curBucket++;
-		if (ghi->curBucket==ghi->gh->nbuckets)
+		if (ghi->curBucket == ghi->gh->nbuckets)
 			break;
-		ghi->curEntry= ghi->gh->buckets[ghi->curBucket];
+		ghi->curEntry = ghi->gh->buckets[ghi->curBucket];
 	}
 }
 void BLI_ghashIterator_free(GHashIterator *ghi)
@@ -229,22 +228,22 @@ void BLI_ghashIterator_free(GHashIterator *ghi)
 
 void *BLI_ghashIterator_getKey(GHashIterator *ghi)
 {
-	return ghi->curEntry?ghi->curEntry->key:NULL;
+	return ghi->curEntry ? ghi->curEntry->key : NULL;
 }
 void *BLI_ghashIterator_getValue(GHashIterator *ghi)
 {
-	return ghi->curEntry?ghi->curEntry->val:NULL;
+	return ghi->curEntry ? ghi->curEntry->val : NULL;
 }
 
 void BLI_ghashIterator_step(GHashIterator *ghi)
 {
 	if (ghi->curEntry) {
-		ghi->curEntry= ghi->curEntry->next;
+		ghi->curEntry = ghi->curEntry->next;
 		while (!ghi->curEntry) {
 			ghi->curBucket++;
-			if (ghi->curBucket==ghi->gh->nbuckets)
+			if (ghi->curBucket == ghi->gh->nbuckets)
 				break;
-			ghi->curEntry= ghi->gh->buckets[ghi->curBucket];
+			ghi->curEntry = ghi->gh->buckets[ghi->curBucket];
 		}
 	}
 }
@@ -261,10 +260,10 @@ unsigned int BLI_ghashutil_ptrhash(const void *key)
 }
 int BLI_ghashutil_ptrcmp(const void *a, const void *b)
 {
-	if (a==b)
+	if (a == b)
 		return 0;
 	else
-		return (a<b)?-1:1;
+		return (a < b) ? -1 : 1;
 }
 
 unsigned int BLI_ghashutil_inthash(const void *ptr)
@@ -283,21 +282,22 @@ unsigned int BLI_ghashutil_inthash(const void *ptr)
 
 int BLI_ghashutil_intcmp(const void *a, const void *b)
 {
-	if (a==b)
+	if (a == b)
 		return 0;
 	else
-		return (a<b)?-1:1;
+		return (a < b) ? -1 : 1;
 }
 
 unsigned int BLI_ghashutil_strhash(const void *ptr)
 {
-	const char *s= ptr;
-	unsigned int i= 0;
+	const char *s = ptr;
+	unsigned int i = 0;
 	unsigned char c;
-	
-	while ( (c= *s++) )
-		i= i*37 + c;
-		
+
+	while ((c = *s++)) {
+		i = i * 37 + c;
+	}
+
 	return i;
 }
 int BLI_ghashutil_strcmp(const void *a, const void *b)
@@ -326,7 +326,7 @@ int BLI_ghashutil_paircmp(const void *a, const void *b)
 	const GHashPair *B = b;
 
 	int cmp = BLI_ghashutil_ptrcmp(A->first, B->first);
-	if(cmp == 0)
+	if (cmp == 0)
 		return BLI_ghashutil_intcmp(SET_INT_IN_POINTER(A->second), SET_INT_IN_POINTER(B->second));
 	return cmp;
 }
diff --git a/source/blender/blenlib/intern/BLI_heap.c b/source/blender/blenlib/intern/BLI_heap.c
index 62a38e7..fa7b91b 100644
--- a/source/blender/blenlib/intern/BLI_heap.c
+++ b/source/blender/blenlib/intern/BLI_heap.c
@@ -30,12 +30,12 @@
  *  \ingroup bli
  */
 
-
 #include <string.h>
 
 #include "MEM_guardedalloc.h"
 #include "BLI_memarena.h"
 #include "BLI_heap.h"
+#include "BLI_utildefines.h"
 
 /***/
 
@@ -54,27 +54,25 @@ struct Heap {
 	HeapNode **tree;
 };
 
-#define SWAP(type, a, b) \
-	{ type sw_ap; sw_ap=(a); (a)=(b); (b)=sw_ap; }
-#define HEAP_PARENT(i) ((i-1)>>1)
-#define HEAP_LEFT(i)   ((i<<1)+1)
-#define HEAP_RIGHT(i)  ((i<<1)+2)
+#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)
 #define HEAP_SWAP(heap, i, j) \
 {                                                                             \
 	SWAP(int, heap->tree[i]->index, heap->tree[j]->index);                    \
-	SWAP(HeapNode*, heap->tree[i], heap->tree[j]);                            \
+	SWAP(HeapNode *, heap->tree[i], heap->tree[j]);                           \
 }
 
 /***/
 
 Heap *BLI_heap_new(void)
 {
-	Heap *heap = (Heap*)MEM_callocN(sizeof(Heap), "BLIHeap");
+	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");
+	heap->tree = (HeapNode **)MEM_mallocN(sizeof(HeapNode *), "BLIHeapTree");
+	heap->arena = BLI_memarena_new(1 << 16, "heap arena");
 
 	return heap;
 }
@@ -86,7 +84,7 @@ void BLI_heap_free(Heap *heap, HeapFreeFP ptrfreefp)
 	if (ptrfreefp)
 		for (i = 0; i < heap->size; i++)
 			ptrfreefp(heap->tree[i]->ptr);
-	
+
 	MEM_freeN(heap->tree);
 	BLI_memarena_free(heap->arena);
 	MEM_freeN(heap);
@@ -99,11 +97,11 @@ static void BLI_heap_down(Heap *heap, int i)
 		int l = HEAP_LEFT(i);
 		int r = HEAP_RIGHT(i);
 
-		smallest = ((l < size) && HEAP_COMPARE(heap->tree[l], heap->tree[i]))? l: i;
+		smallest = ((l < size) && HEAP_COMPARE(heap->tree[l], heap->tree[i])) ? l : i;
 
 		if ((r < size) && HEAP_COMPARE(heap->tree[r], heap->tree[smallest]))
 			smallest = r;
-		
+
 		if (smallest == i)
 			break;
 
@@ -130,11 +128,11 @@ HeapNode *BLI_heap_insert(Heap *heap, float value, void *ptr)
 	HeapNode *node;
 
 	if ((heap->size + 1) > heap->bufsize) {
-		int newsize = heap->bufsize*2;
+		int newsize = heap->bufsize * 2;
 		HeapNode **newtree;
 
-		newtree = (HeapNode**)MEM_mallocN(newsize*sizeof(*newtree), "BLIHeapTree");
-		memcpy(newtree, heap->tree, sizeof(HeapNode*)*heap->size);
+		newtree = (HeapNode **)MEM_mallocN(newsize * sizeof(*newtree), __func__);
+		memcpy(newtree, heap->tree, sizeof(HeapNode *) * heap->size);
 		MEM_freeN(heap->tree);
 
 		heap->tree = newtree;
@@ -143,10 +141,10 @@ HeapNode *BLI_heap_insert(Heap *heap, float value, void *ptr)
 
 	if (heap->freenodes) {
 		node = heap->freenodes;
-		heap->freenodes = (HeapNode*)(((HeapNode*)heap->freenodes)->ptr);
+		heap->freenodes = (HeapNode *)(((HeapNode *)heap->freenodes)->ptr);
 	}
 	else
-		node = (HeapNode*)BLI_memarena_alloc(heap->arena, sizeof *node);
+		node = (HeapNode *)BLI_memarena_alloc(heap->arena, sizeof *node);
 
 	node->value = value;
 	node->ptr = ptr;
@@ -156,7 +154,7 @@ HeapNode *BLI_heap_insert(Heap *heap, float value, void *ptr)
 
 	heap->size++;
 
-	BLI_heap_up(heap, heap->size-1);
+	BLI_heap_up(heap, heap->size - 1);
 
 	return node;
 }
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index f01777b..2cc67b3 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -133,10 +133,10 @@ static float KDOP_AXES[13][3] =
 {													\
 	HEAP_TYPE element = heap[heap_size-1];			\
 	int child = heap_size-1;						\
-	while(child != 0)								\
+	while (child != 0)								\
 	{												\
 		int parent = (child-1) / 2;					\
-		if(PRIORITY(element, heap[parent]))			\
+		if (PRIORITY(element, heap[parent]))			\
 		{											\
 			heap[child] = heap[parent];				\
 			child = parent;							\
@@ -150,13 +150,13 @@ static float KDOP_AXES[13][3] =
 {													\
 	HEAP_TYPE element = heap[heap_size-1];			\
 	int parent = 0;									\
-	while(parent < (heap_size-1)/2 )				\
+	while (parent < (heap_size-1)/2 )				\
 	{												\
 		int child2 = (parent+1)*2;					\
-		if(PRIORITY(heap[child2-1], heap[child2]))	\
+		if (PRIORITY(heap[child2-1], heap[child2]))	\
 			--child2;								\
 													\
-		if(PRIORITY(element, heap[child2]))			\
+		if (PRIORITY(element, heap[child2]))			\
 			break;									\
 													\
 		heap[parent] = heap[child2];				\
@@ -171,10 +171,10 @@ static int ADJUST_MEMORY(void *local_memblock, void **memblock, int new_size, in
 	int   new_max_size = *max_size * 2;
 	void *new_memblock = NULL;
 
-	if(new_size <= *max_size)
+	if (new_size <= *max_size)
 		return TRUE;
 
-	if(*memblock == local_memblock)
+	if (*memblock == local_memblock)
 	{
 		new_memblock = malloc( size_per_item * new_max_size );
 		memcpy( new_memblock, *memblock, size_per_item * *max_size );
@@ -182,7 +182,7 @@ static int ADJUST_MEMORY(void *local_memblock, void **memblock, int new_size, in
 	else
 		new_memblock = realloc(*memblock, size_per_item * new_max_size );
 
-	if(new_memblock)
+	if (new_memblock)
 	{
 		*memblock = new_memblock;
 		*max_size = new_max_size;
@@ -201,16 +201,18 @@ static int ADJUST_MEMORY(void *local_memblock, void **memblock, int new_size, in
 //////////////////////////////////////////////////////////////////////////////////////////////////////
 //static int size_threshold = 16;
 /*
-* Common methods for all algorithms
-*/
-/*static int floor_lg(int a)
+ * Common methods for all algorithms
+ */
+#if 0
+static int floor_lg(int a)
 {
 	return (int)(floor(log(a)/log(2)));
-}*/
+}
+#endif
 
 /*
-* Insertion sort algorithm
-*/
+ * Insertion sort algorithm
+ */
 static void bvh_insertionsort(BVHNode **a, int lo, int hi, int axis)
 {
 	int i,j;
@@ -219,7 +221,7 @@ static void bvh_insertionsort(BVHNode **a, int lo, int hi, int axis)
 	{
 		j=i;
 		t = a[i];
-		while((j!=lo) && (t->bv[axis] < (a[j-1])->bv[axis]))
+		while ((j!=lo) && (t->bv[axis] < (a[j-1])->bv[axis]))
 		{
 			a[j] = a[j-1];
 			j--;
@@ -236,7 +238,7 @@ static int bvh_partition(BVHNode **a, int lo, int hi, BVHNode * x, int axis)
 		while ((a[i])->bv[axis] < x->bv[axis]) i++;
 		j--;
 		while (x->bv[axis] < (a[j])->bv[axis]) j--;
-		if(!(i < j))
+		if (!(i < j))
 			return i;
 		SWAP( BVHNode* , a[i], a[j]);
 		i++;
@@ -244,8 +246,8 @@ static int bvh_partition(BVHNode **a, int lo, int hi, BVHNode * x, int axis)
 }
 
 /*
-* Heapsort algorithm
-*/
+ * Heapsort algorithm
+ */
 #if 0
 static void bvh_downheap(BVHNode **a, int i, int n, int lo, int axis)
 {
@@ -310,8 +312,8 @@ static BVHNode *bvh_medianof3(BVHNode **a, int lo, int mid, int hi, int axis) //
 
 #if 0
 /*
-* Quicksort algorithm modified for Introsort
-*/
+ * Quicksort algorithm modified for Introsort
+ */
 static void bvh_introsort_loop (BVHNode **a, int lo, int hi, int depth_limit, int axis)
 {
 	int p;
@@ -352,10 +354,10 @@ static void sort_along_axis(BVHTree *tree, int start, int end, int axis)
 static int partition_nth_element(BVHNode **a, int _begin, int _end, int n, int axis)
 {
 	int begin = _begin, end = _end, cut;
-	while(end-begin > 3)
+	while (end-begin > 3)
 	{
 		cut = bvh_partition(a, begin, end, bvh_medianof3(a, begin, (begin+end)/2, end-1, axis), axis );
-		if(cut <= n)
+		if (cut <= n)
 			begin = cut;
 		else
 			end = cut;
@@ -375,7 +377,7 @@ static void build_skip_links(BVHTree *tree, BVHNode *node, BVHNode *left, BVHNod
 	
 	for (i = 0; i < node->totnode; i++)
 	{
-		if(i+1 < node->totnode)
+		if (i+1 < node->totnode)
 			build_skip_links(tree, node->children[i], left, node->children[i+1] );
 		else
 			build_skip_links(tree, node->children[i], left, right );
@@ -394,7 +396,7 @@ static void create_kdop_hull(BVHTree *tree, BVHNode *node, const float *co, int
 	int i, k;
 	
 	// don't init boudings for the moving case
-	if(!moving)
+	if (!moving)
 	{
 		for (i = tree->start_axis; i < tree->stop_axis; i++)
 		{
@@ -403,7 +405,7 @@ static void create_kdop_hull(BVHTree *tree, BVHNode *node, const float *co, int
 		}
 	}
 	
-	for(k = 0; k < numpoints; k++)
+	for (k = 0; k < numpoints; k++)
 	{
 		// for all Axes.
 		for (i = tree->start_axis; i < tree->stop_axis; i++)
@@ -512,14 +514,14 @@ static void node_join(BVHTree *tree, BVHNode *node)
 static void bvhtree_print_tree(BVHTree *tree, BVHNode *node, int depth)
 {
 	int i;
-	for(i=0; i<depth; i++) printf(" ");
+	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++)
+	for (i=2*tree->start_axis; i<2*tree->stop_axis; i++)
 		printf("%.3f ", node->bv[i]);
 	printf("\n");
 
-	for(i=0; i<tree->tree_type; i++)
-		if(node->children[i])
+	for (i=0; i<tree->tree_type; i++)
+		if (node->children[i])
 			bvhtree_print_tree(tree, node->children[i], depth+1);
 }
 
@@ -550,18 +552,18 @@ static void verify_tree(BVHTree *tree)
 	int i, j, check = 0;
 	
 	// check the pointer list
-	for(i = 0; i < tree->totleaf; i++)
+	for (i = 0; i < tree->totleaf; i++)
 	{
-		if(tree->nodes[i]->parent == NULL)
+		if (tree->nodes[i]->parent == NULL)
 			printf("Leaf has no parent: %d\n", i);
 		else
 		{
-			for(j = 0; j < tree->tree_type; j++)
+			for (j = 0; j < tree->tree_type; j++)
 			{
-				if(tree->nodes[i]->parent->children[j] == tree->nodes[i])
+				if (tree->nodes[i]->parent->children[j] == tree->nodes[i])
 					check = 1;
 			}
-			if(!check)
+			if (!check)
 			{
 				printf("Parent child relationship doesn't match: %d\n", i);
 			}
@@ -570,18 +572,18 @@ static void verify_tree(BVHTree *tree)
 	}
 	
 	// check the leaf list
-	for(i = 0; i < tree->totleaf; i++)
+	for (i = 0; i < tree->totleaf; i++)
 	{
-		if(tree->nodearray[i].parent == NULL)
+		if (tree->nodearray[i].parent == NULL)
 			printf("Leaf has no parent: %d\n", i);
 		else
 		{
-			for(j = 0; j < tree->tree_type; j++)
+			for (j = 0; j < tree->tree_type; j++)
 			{
-				if(tree->nodearray[i].parent->children[j] == &tree->nodearray[i])
+				if (tree->nodearray[i].parent->children[j] == &tree->nodearray[i])
 					check = 1;
 			}
-			if(!check)
+			if (!check)
 			{
 				printf("Parent child relationship doesn't match: %d\n", i);
 			}
@@ -597,13 +599,13 @@ static void verify_tree(BVHTree *tree)
 //This code can be easily reduced (basicly this is only method to calculate pow(k, n) in O(1).. and stuff like that)
 typedef struct BVHBuildHelper
 {
-	int tree_type;				//
-	int totleafs;				//
+	int tree_type;				/* */
+	int totleafs;				/* */
 
-	int leafs_per_child  [32];	//Min number of leafs that are archievable from a node at depth N
-	int branches_on_level[32];	//Number of nodes at depth N (tree_type^N)
+	int leafs_per_child[32];	/* Min number of leafs that are archievable from a node at depth N */
+	int branches_on_level[32];	/* Number of nodes at depth N (tree_type^N) */
 
-	int remain_leafs;			//Number of leafs that are placed on the level that is not 100% filled
+	int remain_leafs;			/* Number of leafs that are placed on the level that is not 100% filled */
 
 } BVHBuildHelper;
 
@@ -617,7 +619,7 @@ static void build_implicit_tree_helper(BVHTree *tree, BVHBuildHelper *data)
 	data->tree_type= tree->tree_type;
 
 	//Calculate the smallest tree_type^n such that tree_type^n >= num_leafs
-	for(
+	for (
 		data->leafs_per_child[0] = 1;
 		data->leafs_per_child[0] <  data->totleafs;
 		data->leafs_per_child[0] *= data->tree_type
@@ -626,7 +628,7 @@ static void build_implicit_tree_helper(BVHTree *tree, BVHBuildHelper *data)
 	data->branches_on_level[0] = 1;
 
 	//We could stop the loop first (but I am lazy to find out when)
-	for(depth = 1; depth < 32; depth++)
+	for (depth = 1; depth < 32; depth++)
 	{
 		data->branches_on_level[depth] = data->branches_on_level[depth-1] * data->tree_type;
 		data->leafs_per_child  [depth] = data->leafs_per_child  [depth-1] / data->tree_type;
@@ -641,9 +643,9 @@ static void build_implicit_tree_helper(BVHTree *tree, BVHBuildHelper *data)
 static int implicit_leafs_index(BVHBuildHelper *data, int depth, int child_index)
 {
 	int min_leaf_index = child_index * data->leafs_per_child[depth-1];
-	if(min_leaf_index <= data->remain_leafs)
+	if (min_leaf_index <= data->remain_leafs)
 		return min_leaf_index;
-	else if(data->leafs_per_child[depth])
+	else if (data->leafs_per_child[depth])
 		return data->totleafs - (data->branches_on_level[depth-1] - child_index) * data->leafs_per_child[depth];
 	else
 		return data->remain_leafs;
@@ -656,14 +658,14 @@ static int implicit_leafs_index(BVHBuildHelper *data, int depth, int child_index
  * Its possible to find the position of the child or the parent with simple maths (multiplication and adittion). This type
  * of tree is for example used on heaps.. where node N has its childs at indexs N*2 and N*2+1.
  *
- * Altought in this case the tree type is general.. and not know until runtime.
+ * Although in this case the tree type is general.. and not know until runtime.
  * tree_type stands for the maximum number of childs that a tree node can have.
  * All tree types >= 2 are supported.
  *
  * Advantages of the used trees include:
  *  - No need to store child/parent relations (they are implicit);
  *  - Any node child always has an index greater than the parent;
- *  - Brother nodes are sequencial in memory;
+ *  - Brother nodes are sequential in memory;
  *
  *
  * Some math relations derived for general implicit trees:
@@ -688,7 +690,7 @@ static int implicit_needed_branches(int tree_type, int leafs)
  *
  * It arranges the elements in the given partitions such that:
  *  - any element in partition N is less or equal to any element in partition N+1.
- *  - if all elements are diferent all partition will get the same subset of elements
+ *  - if all elements are different all partition will get the same subset of elements
  *    as if the array was sorted.
  *
  * partition P is described as the elements in the range ( nth[P] , nth[P+1] ]
@@ -698,9 +700,9 @@ static int implicit_needed_branches(int tree_type, int leafs)
 static void split_leafs(BVHNode **leafs_array, int *nth, int partitions, int split_axis)
 {
 	int i;
-	for(i=0; i < partitions-1; i++)
+	for (i=0; i < partitions-1; i++)
 	{
-		if(nth[i] >= nth[partitions])
+		if (nth[i] >= nth[partitions])
 			break;
 
 		partition_nth_element(leafs_array, nth[i], nth[partitions], nth[i+1], split_axis);
@@ -716,12 +718,12 @@ static void split_leafs(BVHNode **leafs_array, int *nth, int partitions, int spl
  *
  * This function creates an implicit tree on branches_array, the leafs are given on the leafs_array.
  *
- * The tree is built per depth levels. First branchs at depth 1.. then branches at depth 2.. etc..
- * The reason is that we can build level N+1 from level N witouth any data dependencies.. thus it allows
+ * The tree is built per depth levels. First branches at depth 1.. then branches at depth 2.. etc..
+ * The reason is that we can build level N+1 from level N without any data dependencies.. thus it allows
  * to use multithread building.
  *
  * To archieve this is necessary to find how much leafs are accessible from a certain branch, BVHBuildHelper
- * implicit_needed_branches and implicit_leafs_index are auxiliar functions to solve that "optimal-split".
+ * implicit_needed_branches and implicit_leafs_index are auxiliary functions to solve that "optimal-split".
  */
 static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array, BVHNode **leafs_array, int num_leafs)
 {
@@ -740,7 +742,7 @@ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array,
 
 	//Most of bvhtree code relies on 1-leaf trees having at least one branch
 	//We handle that special case here
-	if(num_leafs == 1)
+	if (num_leafs == 1)
 	{
 		BVHNode *root = branches_array+0;
 		refit_kdop_hull(tree, root, 0, num_leafs);
@@ -756,7 +758,7 @@ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array,
 	build_implicit_tree_helper(tree, &data);
 
 	//Loop tree levels (log N) loops
-	for(i=1, depth = 1; i <= num_branches; i = i*tree_type + tree_offset, depth++)
+	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
@@ -764,8 +766,7 @@ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array,
 
 		//Loop all branches on this level
 #pragma omp parallel for private(j) schedule(static)
-		for(j = i; j < end_j; j++)
-		{
+		for (j = i; j < end_j; j++) {
 			int k;
 			const int parent_level_index= j-i;
 			BVHNode* parent = branches_array + j;
@@ -789,8 +790,7 @@ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array,
 			//Split_leafs takes care of that "sort" problem.
 			nth_positions[        0] = parent_leafs_begin;
 			nth_positions[tree_type] = parent_leafs_end;
-			for(k = 1; k < tree_type; k++)
-			{
+			for (k = 1; k < tree_type; k++) {
 				int child_index = j * tree_type + tree_offset + k;
 				int child_level_index = child_index - first_of_next_level; //child level index
 				nth_positions[k] = implicit_leafs_index(&data, depth+1, child_level_index);
@@ -801,26 +801,24 @@ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array,
 
 			//Setup children and totnode counters
 			//Not really needed but currently most of BVH code relies on having an explicit children structure
-			for(k = 0; k < tree_type; k++)
-			{
+			for (k = 0; k < tree_type; k++) {
 				int child_index = j * tree_type + tree_offset + k;
 				int child_level_index = child_index - first_of_next_level; //child level index
 
 				int child_leafs_begin = implicit_leafs_index(&data, depth+1, child_level_index);
 				int child_leafs_end   = implicit_leafs_index(&data, depth+1, child_level_index+1);
 
-				if(child_leafs_end - child_leafs_begin > 1)
-				{
+				if (child_leafs_end - child_leafs_begin > 1) {
 					parent->children[k] = branches_array + child_index;
 					parent->children[k]->parent = parent;
 				}
-				else if(child_leafs_end - child_leafs_begin == 1)
-				{
+				else if (child_leafs_end - child_leafs_begin == 1) {
 					parent->children[k] = leafs_array[ child_leafs_begin ];
 					parent->children[k]->parent = parent;
 				}
-				else
+				else {
 					break;
+				}
 
 				parent->totnode = k+1;
 			}
@@ -838,10 +836,10 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
 	int numnodes, i;
 	
 	// theres not support for trees below binary-trees :P
-	if(tree_type < 2)
+	if (tree_type < 2)
 		return NULL;
 	
-	if(tree_type > MAX_TREETYPE)
+	if (tree_type > MAX_TREETYPE)
 		return NULL;
 
 	tree = (BVHTree *)MEM_callocN(sizeof(BVHTree), "BVHTree");
@@ -851,39 +849,32 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
 	//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);
 	
-	if(tree)
-	{
+	if (tree) {
 		tree->epsilon = epsilon;
 		tree->tree_type = tree_type; 
 		tree->axis = axis;
 		
-		if(axis == 26)
-		{
+		if (axis == 26) {
 			tree->start_axis = 0;
 			tree->stop_axis = 13;
 		}
-		else if(axis == 18)
-		{
+		else if (axis == 18) {
 			tree->start_axis = 7;
 			tree->stop_axis = 13;
 		}
-		else if(axis == 14)
-		{
+		else if (axis == 14) {
 			tree->start_axis = 0;
 			tree->stop_axis = 7;
 		}
-		else if(axis == 8) // AABB
-		{
+		else if (axis == 8) { /* AABB */
 			tree->start_axis = 0;
 			tree->stop_axis = 4;
 		}
-		else if(axis == 6) // OBB
-		{
+		else if (axis == 6) { /* OBB */
 			tree->start_axis = 0;
 			tree->stop_axis = 3;
 		}
-		else
-		{
+		else {
 			MEM_freeN(tree);
 			return NULL;
 		}
@@ -894,21 +885,21 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
 
 		tree->nodes = (BVHNode **)MEM_callocN(sizeof(BVHNode *)*numnodes, "BVHNodes");
 		
-		if(!tree->nodes)
+		if (!tree->nodes)
 		{
 			MEM_freeN(tree);
 			return NULL;
 		}
 		
 		tree->nodebv = (float*)MEM_callocN(sizeof(float)* axis * numnodes, "BVHNodeBV");
-		if(!tree->nodebv)
+		if (!tree->nodebv)
 		{
 			MEM_freeN(tree->nodes);
 			MEM_freeN(tree);
 		}
 
 		tree->nodechild = (BVHNode**)MEM_callocN(sizeof(BVHNode*) * tree_type * numnodes, "BVHNodeBV");
-		if(!tree->nodechild)
+		if (!tree->nodechild)
 		{
 			MEM_freeN(tree->nodebv);
 			MEM_freeN(tree->nodes);
@@ -917,7 +908,7 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
 
 		tree->nodearray = (BVHNode *)MEM_callocN(sizeof(BVHNode)* numnodes, "BVHNodeArray");
 		
-		if(!tree->nodearray)
+		if (!tree->nodearray)
 		{
 			MEM_freeN(tree->nodechild);
 			MEM_freeN(tree->nodebv);
@@ -927,7 +918,7 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
 		}
 
 		//link the dynamic bv and child links
-		for(i=0; i< numnodes; i++)
+		for (i=0; i< numnodes; i++)
 		{
 			tree->nodearray[i].bv = tree->nodebv + i * axis;
 			tree->nodearray[i].children = tree->nodechild + i * tree_type;
@@ -940,7 +931,7 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
 
 void BLI_bvhtree_free(BVHTree *tree)
 {	
-	if(tree)
+	if (tree)
 	{
 		MEM_freeN(tree->nodes);
 		MEM_freeN(tree->nodearray);
@@ -966,7 +957,7 @@ void BLI_bvhtree_balance(BVHTree *tree)
 	//current code expects the branches to be linked to the nodes array
 	//we perform that linkage here
 	tree->totbranch = implicit_needed_branches(tree->tree_type, tree->totleaf);
-	for(i = 0; i < tree->totbranch; i++)
+	for (i = 0; i < tree->totbranch; i++)
 		tree->nodes[tree->totleaf + i] = branches_array + i;
 
 	build_skip_links(tree, tree->nodes[tree->totleaf], NULL, NULL);
@@ -979,10 +970,10 @@ int BLI_bvhtree_insert(BVHTree *tree, int index, const float *co, int numpoints)
 	BVHNode *node = NULL;
 	
 	// insert should only possible as long as tree->totbranch is 0
-	if(tree->totbranch > 0)
+	if (tree->totbranch > 0)
 		return 0;
 	
-	if(tree->totleaf+1 >= MEM_allocN_len(tree->nodes)/sizeof(*(tree->nodes)))
+	if (tree->totleaf+1 >= MEM_allocN_len(tree->nodes)/sizeof(*(tree->nodes)))
 		return 0;
 	
 	// TODO check if have enough nodes in array
@@ -1011,14 +1002,14 @@ int BLI_bvhtree_update_node(BVHTree *tree, int index, const float *co, const flo
 	BVHNode *node= NULL;
 	
 	// check if index exists
-	if(index > tree->totleaf)
+	if (index > tree->totleaf)
 		return 0;
 	
 	node = tree->nodearray + index;
 	
 	create_kdop_hull(tree, node, co, numpoints, 0);
 	
-	if(co_moving)
+	if (co_moving)
 		create_kdop_hull(tree, node, co_moving, numpoints, 1);
 	
 	// inflate the bv with some epsilon
@@ -1079,26 +1070,26 @@ static void traverse(BVHOverlapData *data, BVHNode *node1, BVHNode *node2)
 {
 	int j;
 	
-	if(tree_overlap(node1, node2, data->start_axis, data->stop_axis))
+	if (tree_overlap(node1, node2, data->start_axis, data->stop_axis))
 	{
 		// check if node1 is a leaf
-		if(!node1->totnode)
+		if (!node1->totnode)
 		{
 			// check if node2 is a leaf
-			if(!node2->totnode)
+			if (!node2->totnode)
 			{
 				
-				if(node1 == node2)
+				if (node1 == node2)
 				{
 					return;
 				}
 					
-				if(data->i >= data->max_overlap)
+				if (data->i >= data->max_overlap)
 				{	
 					// try to make alloc'ed memory bigger
 					data->overlap = realloc(data->overlap, sizeof(BVHTreeOverlap)*data->max_overlap*2);
 					
-					if(!data->overlap)
+					if (!data->overlap)
 					{
 						printf("Out of Memory in traverse\n");
 						return;
@@ -1114,9 +1105,9 @@ static void traverse(BVHOverlapData *data, BVHNode *node1, BVHNode *node2)
 			}
 			else
 			{
-				for(j = 0; j < data->tree2->tree_type; j++)
+				for (j = 0; j < data->tree2->tree_type; j++)
 				{
-					if(node2->children[j])
+					if (node2->children[j])
 						traverse(data, node1, node2->children[j]);
 				}
 			}
@@ -1124,9 +1115,9 @@ static void traverse(BVHOverlapData *data, BVHNode *node1, BVHNode *node2)
 		else
 		{
 			
-			for(j = 0; j < data->tree2->tree_type; j++)
+			for (j = 0; j < data->tree2->tree_type; j++)
 			{
-				if(node1->children[j])
+				if (node1->children[j])
 					traverse(data, node1->children[j], node2);
 			}
 		}
@@ -1142,16 +1133,16 @@ BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, unsigned int
 	BVHOverlapData **data;
 	
 	// 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))
+	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)))
+	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)))
 		return NULL;
 
 	data = MEM_callocN(sizeof(BVHOverlapData *)* tree1->tree_type, "BVHOverlapData_star");
 	
-	for(j = 0; j < tree1->tree_type; j++)
+	for (j = 0; j < tree1->tree_type; j++)
 	{
 		data[j] = (BVHOverlapData *)MEM_callocN(sizeof(BVHOverlapData), "BVHOverlapData");
 		
@@ -1166,23 +1157,23 @@ BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, unsigned int
 	}
 
 #pragma omp parallel for private(j) schedule(static)
-	for(j = 0; j < MIN2(tree1->tree_type, tree1->nodes[tree1->totleaf]->totnode); j++)
+	for (j = 0; j < MIN2(tree1->tree_type, tree1->nodes[tree1->totleaf]->totnode); j++)
 	{
 		traverse(data[j], tree1->nodes[tree1->totleaf]->children[j], tree2->nodes[tree2->totleaf]);
 	}
 	
-	for(j = 0; j < tree1->tree_type; j++)
+	for (j = 0; j < tree1->tree_type; j++)
 		total += data[j]->i;
 	
 	to = overlap = (BVHTreeOverlap *)MEM_callocN(sizeof(BVHTreeOverlap)*total, "BVHTreeOverlap");
 	
-	for(j = 0; j < tree1->tree_type; j++)
+	for (j = 0; j < tree1->tree_type; j++)
 	{
 		memcpy(to, data[j]->overlap, data[j]->i*sizeof(BVHTreeOverlap));
 		to+=data[j]->i;
 	}
 	
-	for(j = 0; j < tree1->tree_type; j++)
+	for (j = 0; j < tree1->tree_type; j++)
 	{
 		free(data[j]->overlap);
 		MEM_freeN(data[j]);
@@ -1200,35 +1191,34 @@ static float calc_nearest_point(const float proj[3], BVHNode *node, float *neare
 	const float *bv = node->bv;
 
 	//nearest on AABB hull
-	for(i=0; i != 3; i++, bv += 2)
+	for (i=0; i != 3; i++, bv += 2)
 	{
-		if(bv[0] > proj[i])
+		if (bv[0] > proj[i])
 			nearest[i] = bv[0];
-		else if(bv[1] < proj[i])
+		else if (bv[1] < proj[i])
 			nearest[i] = bv[1];
 		else
 			nearest[i] = proj[i]; 
 	}
 
-/*
+#if 0
 	//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)
+	for (i = data->tree->start_axis; i != data->tree->stop_axis; i++, bv+=2)
 	{
 		float proj = dot_v3v3( nearest, KDOP_AXES[i]);
 		float dl = bv[0] - proj;
 		float du = bv[1] - proj;
 
-		if(dl > 0)
-		{
+		if (dl > 0) {
 			madd_v3_v3fl(nearest, KDOP_AXES[i], dl);
 		}
-		else if(du < 0)
-		{
+		else if (du < 0) {
 			madd_v3_v3fl(nearest, KDOP_AXES[i], du);
 		}
 	}
-*/
+#endif
+
 	return len_squared_v3v3(proj, nearest);
 }
 
@@ -1245,9 +1235,9 @@ typedef struct NodeDistance
 // 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)
+	if (node->totnode == 0)
 	{
-		if(data->callback)
+		if (data->callback)
 			data->callback(data->userdata , node->index, data->co, &data->nearest);
 		else
 		{
@@ -1261,20 +1251,20 @@ static void dfs_find_nearest_dfs(BVHNearestData *data, BVHNode *node)
 		int i;
 		float nearest[3];
 
-		if(data->proj[ node->main_axis ] <= node->children[0]->bv[node->main_axis*2+1])
+		if (data->proj[ node->main_axis ] <= node->children[0]->bv[node->main_axis*2+1])
 		{
 
-			for(i=0; i != node->totnode; i++)
+			for (i=0; i != node->totnode; i++)
 			{
-				if( calc_nearest_point(data->proj, node->children[i], nearest) >= data->nearest.dist) continue;
+				if ( calc_nearest_point(data->proj, node->children[i], nearest) >= data->nearest.dist) continue;
 				dfs_find_nearest_dfs(data, node->children[i]);
 			}
 		}
 		else
 		{
-			for(i=node->totnode-1; i >= 0 ; i--)
+			for (i=node->totnode-1; i >= 0 ; i--)
 			{
-				if( calc_nearest_point(data->proj, node->children[i], nearest) >= data->nearest.dist) continue;
+				if ( calc_nearest_point(data->proj, node->children[i], nearest) >= data->nearest.dist) continue;
 				dfs_find_nearest_dfs(data, node->children[i]);
 			}
 		}
@@ -1285,7 +1275,7 @@ static void dfs_find_nearest_begin(BVHNearestData *data, BVHNode *node)
 {
 	float nearest[3], sdist;
 	sdist = calc_nearest_point(data->proj, node, nearest);
-	if(sdist >= data->nearest.dist) return;
+	if (sdist >= data->nearest.dist) return;
 	dfs_find_nearest_dfs(data, node);
 }
 
@@ -1315,7 +1305,7 @@ static void bfs_find_nearest(BVHNearestData *data, BVHNode *node)
 
 	int callbacks = 0, push_heaps = 0;
 
-	if(node->totnode == 0)
+	if (node->totnode == 0)
 	{
 		dfs_find_nearest_dfs(data, node);
 		return;
@@ -1324,13 +1314,13 @@ static void bfs_find_nearest(BVHNearestData *data, BVHNode *node)
 	current.node = node;
 	current.dist = calc_nearest_point(data->proj, node, nearest);
 
-	while(current.dist < data->nearest.dist)
+	while (current.dist < data->nearest.dist)
 	{
 //		printf("%f : %f\n", current.dist, data->nearest.dist);
-		for(i=0; i< current.node->totnode; i++)
+		for (i=0; i< current.node->totnode; i++)
 		{
 			BVHNode *child = current.node->children[i];
-			if(child->totnode == 0)
+			if (child->totnode == 0)
 			{
 				callbacks++;
 				dfs_find_nearest_dfs(data, child);
@@ -1338,12 +1328,12 @@ static void bfs_find_nearest(BVHNearestData *data, BVHNode *node)
 			else
 			{
 				//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)
+				if ((heap_size >= max_heap_size) &&
+				    ADJUST_MEMORY(default_heap, (void**)&heap, heap_size+1, &max_heap_size, sizeof(heap[0])) == FALSE)
 				{
 					printf("WARNING: bvh_find_nearest got out of memory\n");
 
-					if(heap != default_heap)
+					if (heap != default_heap)
 						free(heap);
 
 					return;
@@ -1352,7 +1342,7 @@ static void bfs_find_nearest(BVHNearestData *data, BVHNode *node)
 				heap[heap_size].node = current.node->children[i];
 				heap[heap_size].dist = calc_nearest_point(data->proj, current.node->children[i], nearest);
 
-				if(heap[heap_size].dist >= data->nearest.dist) continue;
+				if (heap[heap_size].dist >= data->nearest.dist) continue;
 				heap_size++;
 
 				NodeDistance_push_heap(heap, heap_size);
@@ -1361,7 +1351,7 @@ static void bfs_find_nearest(BVHNearestData *data, BVHNode *node)
 			}
 		}
 		
-		if(heap_size == 0) break;
+		if (heap_size == 0) break;
 
 		current = heap[0];
 		NodeDistance_pop_heap(heap, heap_size);
@@ -1371,7 +1361,7 @@ static void bfs_find_nearest(BVHNearestData *data, BVHNode *node)
 
 //	printf("hsize=%d, callbacks=%d, pushs=%d\n", heap_size, callbacks, push_heaps);
 
-	if(heap != default_heap)
+	if (heap != default_heap)
 		free(heap);
 }
 #endif
@@ -1391,12 +1381,12 @@ int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *n
 	data.callback = callback;
 	data.userdata = userdata;
 
-	for(i = data.tree->start_axis; i != data.tree->stop_axis; i++)
+	for (i = data.tree->start_axis; i != data.tree->stop_axis; i++)
 	{
 		data.proj[i] = dot_v3v3(data.co, KDOP_AXES[i]);
 	}
 
-	if(nearest)
+	if (nearest)
 	{
 		memcpy( &data.nearest , nearest, sizeof(*nearest) );
 	}
@@ -1407,11 +1397,11 @@ int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *n
 	}
 
 	//dfs search
-	if(root)
+	if (root)
 		dfs_find_nearest_begin(&data, root);
 
 	//copy back results
-	if(nearest)
+	if (nearest)
 	{
 		memcpy(nearest, &data.nearest, sizeof(*nearest));
 	}
@@ -1434,32 +1424,34 @@ static float ray_nearest_hit(BVHRayCastData *data, float *bv)
 
 	float low = 0, upper = data->hit.dist;
 
-	for(i=0; i != 3; i++, bv += 2)
+	for (i=0; i != 3; i++, bv += 2)
 	{
-		if(data->ray_dot_axis[i] == 0.0f)
+		if (data->ray_dot_axis[i] == 0.0f)
 		{
 			//axis aligned ray
-			if(data->ray.origin[i] < bv[0] - data->ray.radius
-			|| data->ray.origin[i] > bv[1] + data->ray.radius)
+			if (data->ray.origin[i] < bv[0] - data->ray.radius ||
+			    data->ray.origin[i] > bv[1] + data->ray.radius)
+			{
 				return FLT_MAX;
+			}
 		}
 		else
 		{
 			float ll = (bv[0] - data->ray.radius - data->ray.origin[i]) / data->ray_dot_axis[i];
 			float lu = (bv[1] + data->ray.radius - data->ray.origin[i]) / data->ray_dot_axis[i];
 
-			if(data->ray_dot_axis[i] > 0.0f)
+			if (data->ray_dot_axis[i] > 0.0f)
 			{
-				if(ll > low)   low = ll;
-				if(lu < upper) upper = lu;
+				if (ll > low)   low = ll;
+				if (lu < upper) upper = lu;
 			}
 			else
 			{
-				if(lu > low)   low = lu;
-				if(ll < upper) upper = ll;
+				if (lu > low)   low = lu;
+				if (ll < upper) upper = ll;
 			}
 	
-			if(low > upper) return FLT_MAX;
+			if (low > upper) return FLT_MAX;
 		}
 	}
 	return low;
@@ -1482,9 +1474,9 @@ static float fast_ray_nearest_hit(const BVHRayCastData *data, const BVHNode *nod
 	float t1z = (bv[data->index[4]] - data->ray.origin[2]) * data->idot_axis[2];
 	float t2z = (bv[data->index[5]] - data->ray.origin[2]) * data->idot_axis[2];
 
-	if(t1x > t2y || t2x < t1y || t1x > t2z || t2x < t1z || t1y > t2z || t2y < t1z) return FLT_MAX;
-	if(t2x < 0.0f || t2y < 0.0f || t2z < 0.0f) return FLT_MAX;
-	if(t1x > data->hit.dist || t1y > data->hit.dist || t1z > data->hit.dist) return FLT_MAX;
+	if (t1x > t2y || t2x < t1y || t1x > t2z || t2x < t1z || t1y > t2z || t2y < t1z) return FLT_MAX;
+	if (t2x < 0.0f || t2y < 0.0f || t2z < 0.0f) return FLT_MAX;
+	if (t1x > data->hit.dist || t1y > data->hit.dist || t1z > data->hit.dist) return FLT_MAX;
 
 	dist = t1x;
 	if (t1y > dist) dist = t1y;
@@ -1498,13 +1490,13 @@ static void dfs_raycast(BVHRayCastData *data, BVHNode *node)
 
 	//ray-bv is really fast.. and simple tests revealed its worth to test it
 	//before calling the ray-primitive functions
-	/* XXX: temporary solution for particles untill fast_ray_nearest_hit supports ray.radius */
+	/* XXX: temporary solution for particles until fast_ray_nearest_hit supports ray.radius */
 	float dist = (data->ray.radius > 0.0f) ? ray_nearest_hit(data, node->bv) : fast_ray_nearest_hit(data, node);
-	if(dist >= data->hit.dist) return;
+	if (dist >= data->hit.dist) return;
 
-	if(node->totnode == 0)
+	if (node->totnode == 0)
 	{
-		if(data->callback)
+		if (data->callback)
 			data->callback(data->userdata, node->index, &data->ray, &data->hit);
 		else
 		{
@@ -1516,16 +1508,16 @@ static void dfs_raycast(BVHRayCastData *data, BVHNode *node)
 	else
 	{
 		//pick loop direction to dive into the tree (based on ray direction and split axis)
-		if(data->ray_dot_axis[ (int)node->main_axis ] > 0.0f)
+		if (data->ray_dot_axis[ (int)node->main_axis ] > 0.0f)
 		{
-			for(i=0; i != node->totnode; i++)
+			for (i=0; i != node->totnode; i++)
 			{
 				dfs_raycast(data, node->children[i]);
 			}
 		}
 		else
 		{
-			for(i=node->totnode-1; i >= 0; i--)
+			for (i=node->totnode-1; i >= 0; i--)
 			{
 				dfs_raycast(data, node->children[i]);
 			}
@@ -1536,18 +1528,18 @@ static void dfs_raycast(BVHRayCastData *data, BVHNode *node)
 #if 0
 static void iterative_raycast(BVHRayCastData *data, BVHNode *node)
 {
-	while(node)
+	while (node)
 	{
 		float dist = fast_ray_nearest_hit(data, node);
-		if(dist >= data->hit.dist)
+		if (dist >= data->hit.dist)
 		{
 			node = node->skip[1];
 			continue;
 		}
 
-		if(node->totnode == 0)
+		if (node->totnode == 0)
 		{
-			if(data->callback)
+			if (data->callback)
 				data->callback(data->userdata, node->index, &data->ray, &data->hit);
 			else
 			{
@@ -1583,12 +1575,12 @@ int BLI_bvhtree_ray_cast(BVHTree *tree, const float co[3], const float dir[3], f
 
 	normalize_v3(data.ray.direction);
 
-	for(i=0; i<3; i++)
+	for (i=0; i<3; i++)
 	{
 		data.ray_dot_axis[i] = dot_v3v3(data.ray.direction, KDOP_AXES[i]);
 		data.idot_axis[i] = 1.0f / data.ray_dot_axis[i];
 
-		if(fabsf(data.ray_dot_axis[i]) < FLT_EPSILON)
+		if (fabsf(data.ray_dot_axis[i]) < FLT_EPSILON)
 		{
 			data.ray_dot_axis[i] = 0.0;
 		}
@@ -1599,7 +1591,7 @@ int BLI_bvhtree_ray_cast(BVHTree *tree, const float co[3], const float dir[3], f
 	}
 
 
-	if(hit)
+	if (hit)
 		memcpy( &data.hit, hit, sizeof(*hit) );
 	else
 	{
@@ -1607,14 +1599,14 @@ int BLI_bvhtree_ray_cast(BVHTree *tree, const float co[3], const float dir[3], f
 		data.hit.dist = FLT_MAX;
 	}
 
-	if(root)
+	if (root)
 	{
 		dfs_raycast(&data, root);
 //		iterative_raycast(&data, root);
 	 }
 
 
-	if(hit)
+	if (hit)
 		memcpy( hit, &data.hit, sizeof(*hit) );
 
 	return data.hit.index;
@@ -1643,7 +1635,7 @@ float BLI_bvhtree_bb_raycast(float *bv, const float light_start[3], const float
 	
 	dist = ray_nearest_hit(&data, bv);
 	
-	if(dist > 0.0f)
+	if (dist > 0.0f)
 	{
 		madd_v3_v3v3fl(pos, light_start, data.ray.direction, dist);
 	}
@@ -1674,7 +1666,7 @@ typedef struct RangeQueryData
 
 static void dfs_range_query(RangeQueryData *data, BVHNode *node)
 {
-	if(node->totnode == 0)
+	if (node->totnode == 0)
 	{
 #if 0	/*UNUSED*/
 		//Calculate the node min-coords (if the node was a point then this is the point coordinates)
@@ -1687,17 +1679,17 @@ static void dfs_range_query(RangeQueryData *data, BVHNode *node)
 	else
 	{
 		int i;
-		for(i=0; i != node->totnode; i++)
+		for (i=0; i != node->totnode; i++)
 		{
 			float nearest[3];
 			float dist = calc_nearest_point(data->center, node->children[i], nearest);
-			if(dist < data->radius)
+			if (dist < data->radius)
 			{
 				//Its a leaf.. call the callback
-				if(node->children[i]->totnode == 0)
+				if (node->children[i]->totnode == 0)
 				{
 					data->hits++;
-					data->callback( data->userdata, node->children[i]->index, dist );
+					data->callback(data->userdata, node->children[i]->index, dist);
 				}
 				else
 					dfs_range_query( data, node->children[i] );
@@ -1719,17 +1711,17 @@ int BLI_bvhtree_range_query(BVHTree *tree, const float co[3], float radius, BVHT
 	data.callback = callback;
 	data.userdata = userdata;
 
-	if(root != NULL)
+	if (root != NULL)
 	{
 		float nearest[3];
 		float dist = calc_nearest_point(data.center, root, nearest);
-		if(dist < data.radius)
+		if (dist < data.radius)
 		{
 			//Its a leaf.. call the callback
-			if(root->totnode == 0)
+			if (root->totnode == 0)
 			{
 				data.hits++;
-				data.callback( data.userdata, root->index, dist );
+				data.callback(data.userdata, root->index, dist);
 			}
 			else
 				dfs_range_query( &data, root );
diff --git a/source/blender/blenlib/intern/BLI_kdtree.c b/source/blender/blenlib/intern/BLI_kdtree.c
index d5f66c0..ee06f32 100644
--- a/source/blender/blenlib/intern/BLI_kdtree.c
+++ b/source/blender/blenlib/intern/BLI_kdtree.c
@@ -67,7 +67,7 @@ KDTree *BLI_kdtree_new(int maxsize)
 
 void BLI_kdtree_free(KDTree *tree)
 {
-	if(tree) {
+	if (tree) {
 		MEM_freeN(tree->nodes);
 		MEM_freeN(tree);
 	}
@@ -79,7 +79,7 @@ void BLI_kdtree_insert(KDTree *tree, int index, float *co, float *nor)
 
 	node->index= index;
 	copy_v3_v3(node->co, co);
-	if(nor) copy_v3_v3(node->nor, nor);
+	if (nor) copy_v3_v3(node->nor, nor);
 }
 
 static KDTreeNode *kdtree_balance(KDTreeNode *nodes, int totnode, int axis)
@@ -88,9 +88,9 @@ static KDTreeNode *kdtree_balance(KDTreeNode *nodes, int totnode, int axis)
 	float co;
 	int left, right, median, i, j;
 
-	if(totnode <= 0)
+	if (totnode <= 0)
 		return NULL;
-	else if(totnode == 1)
+	else if (totnode == 1)
 		return nodes;
 	
 	/* quicksort style sorting around median */
@@ -98,23 +98,23 @@ static KDTreeNode *kdtree_balance(KDTreeNode *nodes, int totnode, int axis)
 	right= totnode-1;
 	median= totnode/2;
 
-	while(right > left) {
+	while (right > left) {
 		co= nodes[right].co[axis];
 		i= left-1;
 		j= right;
 
-		while(1) {
-			while(nodes[++i].co[axis] < co);
-			while(nodes[--j].co[axis] > co && j>left);
+		while (1) {
+			while (nodes[++i].co[axis] < co);
+			while (nodes[--j].co[axis] > co && j>left);
 
-			if(i >= j) break;
+			if (i >= j) break;
 			SWAP(KDTreeNode, nodes[i], nodes[j]);
 		}
 
 		SWAP(KDTreeNode, nodes[i], nodes[right]);
-		if(i >= median)
+		if (i >= median)
 			right= i-1;
-		if(i <= median)
+		if (i <= median)
 			left= i+1;
 	}
 
@@ -132,7 +132,7 @@ void BLI_kdtree_balance(KDTree *tree)
 	tree->root= kdtree_balance(tree->nodes, tree->totnode, 0);
 }
 
-static float squared_distance(float *v2, float *v1, float *UNUSED(n1), float *n2)
+static float squared_distance(const float v2[3], const float v1[3], float *UNUSED(n1), float *n2)
 {
 	float d[3], dist;
 
@@ -142,9 +142,12 @@ static float squared_distance(float *v2, float *v1, float *UNUSED(n1), float *n2
 
 	dist = dot_v3v3(d, d);
 
-	//if(n1 && n2 && (dot_v3v3(n1, n2) < 0.0f))
-	if(n2 && (dot_v3v3(d, n2) < 0.0f))
+	//if (n1 && n2 && (dot_v3v3(n1, n2) < 0.0f))
+
+	/* can someone explain why this is done?*/
+	if (n2 && (dot_v3v3(d, n2) < 0.0f)) {
 		dist *= 10.0f;
+	}
 
 	return dist;
 }
@@ -156,7 +159,7 @@ int	BLI_kdtree_find_nearest(KDTree *tree, float *co, float *nor, KDTreeNearest *
 	float min_dist, cur_dist;
 	int totstack, cur=0;
 
-	if(!tree->root)
+	if (!tree->root)
 		return -1;
 
 	stack= defaultstack;
@@ -166,71 +169,71 @@ int	BLI_kdtree_find_nearest(KDTree *tree, float *co, float *nor, KDTreeNearest *
 	min_node= root;
 	min_dist= squared_distance(root->co,co,root->nor,nor);
 
-	if(co[root->d] < root->co[root->d]) {
-		if(root->right)
+	if (co[root->d] < root->co[root->d]) {
+		if (root->right)
 			stack[cur++]=root->right;
-		if(root->left)
+		if (root->left)
 			stack[cur++]=root->left;
 	}
 	else {
-		if(root->left)
+		if (root->left)
 			stack[cur++]=root->left;
-		if(root->right)
+		if (root->right)
 			stack[cur++]=root->right;
 	}
 	
-	while(cur--){
+	while (cur--) {
 		node=stack[cur];
 
 		cur_dist = node->co[node->d] - co[node->d];
 
-		if(cur_dist<0.0f){
+		if (cur_dist<0.0f) {
 			cur_dist= -cur_dist*cur_dist;
 
-			if(-cur_dist<min_dist){
+			if (-cur_dist<min_dist) {
 				cur_dist=squared_distance(node->co,co,node->nor,nor);
-				if(cur_dist<min_dist){
+				if (cur_dist<min_dist) {
 					min_dist=cur_dist;
 					min_node=node;
 				}
-				if(node->left)
+				if (node->left)
 					stack[cur++]=node->left;
 			}
-			if(node->right)
+			if (node->right)
 				stack[cur++]=node->right;
 		}
-		else{
+		else {
 			cur_dist= cur_dist*cur_dist;
 
-			if(cur_dist<min_dist){
+			if (cur_dist<min_dist) {
 				cur_dist=squared_distance(node->co,co,node->nor,nor);
-				if(cur_dist<min_dist){
+				if (cur_dist<min_dist) {
 					min_dist=cur_dist;
 					min_node=node;
 				}
-				if(node->right)
+				if (node->right)
 					stack[cur++]=node->right;
 			}
-			if(node->left)
+			if (node->left)
 				stack[cur++]=node->left;
 		}
-		if(cur+3 > totstack){
+		if (cur+3 > totstack) {
 			KDTreeNode **temp=MEM_callocN((totstack+100)*sizeof(KDTreeNode*), "psys_treestack");
 			memcpy(temp,stack,totstack*sizeof(KDTreeNode*));
-			if(stack != defaultstack)
+			if (stack != defaultstack)
 				MEM_freeN(stack);
 			stack=temp;
 			totstack+=100;
 		}
 	}
 
-	if(nearest) {
+	if (nearest) {
 		nearest->index= min_node->index;
 		nearest->dist= sqrt(min_dist);
 		copy_v3_v3(nearest->co, min_node->co);
 	}
 
-	if(stack != defaultstack)
+	if (stack != defaultstack)
 		MEM_freeN(stack);
 
 	return min_node->index;
@@ -240,10 +243,10 @@ static void add_nearest(KDTreeNearest *ptn, int *found, int n, int index, float
 {
 	int i;
 
-	if(*found<n) (*found)++;
+	if (*found<n) (*found)++;
 
-	for(i=*found-1; i>0; i--) {
-		if(dist >= ptn[i-1].dist)
+	for (i=*found-1; i>0; i--) {
+		if (dist >= ptn[i-1].dist)
 			break;
 		else
 			ptn[i]= ptn[i-1];
@@ -262,7 +265,7 @@ int	BLI_kdtree_find_n_nearest(KDTree *tree, int n, float *co, float *nor, KDTree
 	float cur_dist;
 	int i, totstack, cur=0, found=0;
 
-	if(!tree->root)
+	if (!tree->root)
 		return 0;
 
 	stack= defaultstack;
@@ -273,67 +276,67 @@ int	BLI_kdtree_find_n_nearest(KDTree *tree, int n, float *co, float *nor, KDTree
 	cur_dist= squared_distance(root->co,co,root->nor,nor);
 	add_nearest(nearest,&found,n,root->index,cur_dist,root->co);
 	
-	if(co[root->d] < root->co[root->d]) {
-		if(root->right)
+	if (co[root->d] < root->co[root->d]) {
+		if (root->right)
 			stack[cur++]=root->right;
-		if(root->left)
+		if (root->left)
 			stack[cur++]=root->left;
 	}
 	else {
-		if(root->left)
+		if (root->left)
 			stack[cur++]=root->left;
-		if(root->right)
+		if (root->right)
 			stack[cur++]=root->right;
 	}
 
-	while(cur--){
+	while (cur--) {
 		node=stack[cur];
 
 		cur_dist = node->co[node->d] - co[node->d];
 
-		if(cur_dist<0.0f){
+		if (cur_dist<0.0f) {
 			cur_dist= -cur_dist*cur_dist;
 
-			if(found<n || -cur_dist<nearest[found-1].dist){
+			if (found<n || -cur_dist<nearest[found-1].dist) {
 				cur_dist=squared_distance(node->co,co,node->nor,nor);
 
-				if(found<n || cur_dist<nearest[found-1].dist)
+				if (found<n || cur_dist<nearest[found-1].dist)
 					add_nearest(nearest,&found,n,node->index,cur_dist,node->co);
 
-				if(node->left)
+				if (node->left)
 					stack[cur++]=node->left;
 			}
-			if(node->right)
+			if (node->right)
 				stack[cur++]=node->right;
 		}
-		else{
+		else {
 			cur_dist= cur_dist*cur_dist;
 
-			if(found<n || cur_dist<nearest[found-1].dist){
+			if (found<n || cur_dist<nearest[found-1].dist) {
 				cur_dist=squared_distance(node->co,co,node->nor,nor);
-				if(found<n || cur_dist<nearest[found-1].dist)
+				if (found<n || cur_dist<nearest[found-1].dist)
 					add_nearest(nearest,&found,n,node->index,cur_dist,node->co);
 
-				if(node->right)
+				if (node->right)
 					stack[cur++]=node->right;
 			}
-			if(node->left)
+			if (node->left)
 				stack[cur++]=node->left;
 		}
-		if(cur+3 > totstack){
+		if (cur+3 > totstack) {
 			KDTreeNode **temp=MEM_callocN((totstack+100)*sizeof(KDTreeNode*), "psys_treestack");
 			memcpy(temp,stack,totstack*sizeof(KDTreeNode*));
-			if(stack != defaultstack)
+			if (stack != defaultstack)
 				MEM_freeN(stack);
 			stack=temp;
 			totstack+=100;
 		}
 	}
 
-	for(i=0; i<found; i++)
+	for (i=0; i<found; i++)
 		nearest[i].dist= sqrt(nearest[i].dist);
 
-	if(stack != defaultstack)
+	if (stack != defaultstack)
 		MEM_freeN(stack);
 
 	return found;
@@ -344,9 +347,9 @@ static int range_compare(const void * a, const void * b)
 	const KDTreeNearest *kda = a;
 	const KDTreeNearest *kdb = b;
 
-	if(kda->dist < kdb->dist)
+	if (kda->dist < kdb->dist)
 		return -1;
-	else if(kda->dist > kdb->dist)
+	else if (kda->dist > kdb->dist)
 		return 1;
 	else
 		return 0;
@@ -355,10 +358,10 @@ static void add_in_range(KDTreeNearest **ptn, int found, int *totfoundstack, int
 {
 	KDTreeNearest *to;
 
-	if(found+1 > *totfoundstack) {
+	if (found+1 > *totfoundstack) {
 		KDTreeNearest *temp=MEM_callocN((*totfoundstack+50)*sizeof(KDTreeNode), "psys_treefoundstack");
 		memcpy(temp, *ptn, *totfoundstack * sizeof(KDTreeNearest));
-		if(*ptn)
+		if (*ptn)
 			MEM_freeN(*ptn);
 		*ptn = temp;
 		*totfoundstack+=50;
@@ -378,7 +381,7 @@ int BLI_kdtree_range_search(KDTree *tree, float range, float *co, float *nor, KD
 	float range2 = range*range, dist2;
 	int totstack, cur=0, found=0, totfoundstack=0;
 
-	if(!tree || !tree->root)
+	if (!tree || !tree->root)
 		return 0;
 
 	stack= defaultstack;
@@ -386,61 +389,61 @@ int BLI_kdtree_range_search(KDTree *tree, float range, float *co, float *nor, KD
 
 	root= tree->root;
 
-	if(co[root->d] + range < root->co[root->d]) {
-		if(root->left)
+	if (co[root->d] + range < root->co[root->d]) {
+		if (root->left)
 			stack[cur++]=root->left;
 	}
-	else if(co[root->d] - range > root->co[root->d]) {
-		if(root->right)
+	else if (co[root->d] - range > root->co[root->d]) {
+		if (root->right)
 			stack[cur++]=root->right;
 	}
 	else {
 		dist2 = squared_distance(root->co, co, root->nor, nor);
-		if(dist2  <= range2)
+		if (dist2  <= range2)
 			add_in_range(&foundstack, found++, &totfoundstack, root->index, dist2, root->co);
 
-		if(root->left)
+		if (root->left)
 			stack[cur++]=root->left;
-		if(root->right)
+		if (root->right)
 			stack[cur++]=root->right;
 	}
 
-	while(cur--) {
+	while (cur--) {
 		node=stack[cur];
 
-		if(co[node->d] + range < node->co[node->d]) {
-			if(node->left)
+		if (co[node->d] + range < node->co[node->d]) {
+			if (node->left)
 				stack[cur++]=node->left;
 		}
-		else if(co[node->d] - range > node->co[node->d]) {
-			if(node->right)
+		else if (co[node->d] - range > node->co[node->d]) {
+			if (node->right)
 				stack[cur++]=node->right;
 		}
 		else {
 			dist2 = squared_distance(node->co, co, node->nor, nor);
-			if(dist2 <= range2)
+			if (dist2 <= range2)
 				add_in_range(&foundstack, found++, &totfoundstack, node->index, dist2, node->co);
 
-			if(node->left)
+			if (node->left)
 				stack[cur++]=node->left;
-			if(node->right)
+			if (node->right)
 				stack[cur++]=node->right;
 		}
 
-		if(cur+3 > totstack){
+		if (cur+3 > totstack) {
 			KDTreeNode **temp=MEM_callocN((totstack+100)*sizeof(KDTreeNode*), "psys_treestack");
 			memcpy(temp,stack,totstack*sizeof(KDTreeNode*));
-			if(stack != defaultstack)
+			if (stack != defaultstack)
 				MEM_freeN(stack);
 			stack=temp;
 			totstack+=100;
 		}
 	}
 
-	if(stack != defaultstack)
+	if (stack != defaultstack)
 		MEM_freeN(stack);
 
-	if(found)
+	if (found)
 		qsort(foundstack, found, sizeof(KDTreeNearest), range_compare);
 
 	*nearest = foundstack;
diff --git a/source/blender/blenlib/intern/BLI_linklist.c b/source/blender/blenlib/intern/BLI_linklist.c
index 6300817..5c7d708 100644
--- a/source/blender/blenlib/intern/BLI_linklist.c
+++ b/source/blender/blenlib/intern/BLI_linklist.c
@@ -39,7 +39,8 @@ int BLI_linklist_length(LinkNode *list)
 {
 	if (0) {
 		return list?(1+BLI_linklist_length(list->next)):0;
-	} else {
+	}
+	else {
 		int len;
 
 		for (len=0; list; list= list->next)
@@ -104,10 +105,11 @@ void BLI_linklist_append(LinkNode **listp, void *ptr)
 	nlink->link = ptr;
 	nlink->next = NULL;
 	
-	if(node == NULL){
+	if (node == NULL) {
 		*listp = nlink;
-	} else {
-		while(node->next != NULL){
+	}
+	else {
+		while (node->next != NULL) {
 			node = node->next;   
 		}
 		node->next = nlink;
@@ -130,7 +132,7 @@ void BLI_linklist_insert_after(LinkNode **listp, void *ptr)
 
 	nlink->link = ptr;
 
-	if(node) {
+	if (node) {
 		nlink->next = node->next;
 		node->next = nlink;
 	}
diff --git a/source/blender/blenlib/intern/BLI_memarena.c b/source/blender/blenlib/intern/BLI_memarena.c
index 4debe1a..95a007d 100644
--- a/source/blender/blenlib/intern/BLI_memarena.c
+++ b/source/blender/blenlib/intern/BLI_memarena.c
@@ -30,8 +30,6 @@
  *  \ingroup bli
  */
 
-
-
 #include "MEM_guardedalloc.h"
 
 #include "BLI_memarena.h"
@@ -41,31 +39,31 @@ struct MemArena {
 	unsigned char *curbuf;
 	int bufsize, cursize;
 	const char *name;
-	
-	int use_calloc;	
+
+	int use_calloc;
 	int align;
-	
+
 	LinkNode *bufs;
 };
 
 MemArena *BLI_memarena_new(int bufsize, const char *name)
 {
-	MemArena *ma= MEM_callocN(sizeof(*ma), "memarena");
-	ma->bufsize= bufsize;
+	MemArena *ma = MEM_callocN(sizeof(*ma), "memarena");
+	ma->bufsize = bufsize;
 	ma->align = 8;
-	ma->name= name;
-	
+	ma->name = name;
+
 	return ma;
 }
 
 void BLI_memarena_use_calloc(MemArena *ma)
 {
-	ma->use_calloc= 1;
+	ma->use_calloc = 1;
 }
 
 void BLI_memarena_use_malloc(MemArena *ma)
 {
-	ma->use_calloc= 0;
+	ma->use_calloc = 0;
 }
 
 void BLI_memarena_use_align(struct MemArena *ma, int align)
@@ -76,47 +74,47 @@ void BLI_memarena_use_align(struct MemArena *ma, int align)
 
 void BLI_memarena_free(MemArena *ma)
 {
-	BLI_linklist_free(ma->bufs, (void(*)(void*)) MEM_freeN);
+	BLI_linklist_free(ma->bufs, (void(*)(void *))MEM_freeN);
 	MEM_freeN(ma);
 }
 
-	/* amt must be power of two */
-#define PADUP(num, amt)	((num+(amt-1))&~(amt-1))
+/* amt must be power of two */
+#define PADUP(num, amt)	((num + (amt - 1)) &~ (amt-1))
 
 void *BLI_memarena_alloc(MemArena *ma, int size)
 {
 	void *ptr;
 
-		/* ensure proper alignment by rounding
-		 * size up to multiple of 8 */	
-	size= PADUP(size, ma->align);
-	
-	if (size>ma->cursize) {
+	/* ensure proper alignment by rounding
+	 * size up to multiple of 8 */
+	size = PADUP(size, ma->align);
+
+	if (size > ma->cursize) {
 		unsigned char *tmp;
-		
-		if(size > ma->bufsize - (ma->align - 1))
-		{
+
+		if (size > ma->bufsize - (ma->align - 1)) {
 			ma->cursize = PADUP(size+1, ma->align);
 		}
-		else ma->cursize = ma->bufsize;
+		else
+			ma->cursize = ma->bufsize;
 
-		if(ma->use_calloc)
-			ma->curbuf= MEM_callocN(ma->cursize, ma->name);
+		if (ma->use_calloc)
+			ma->curbuf = MEM_callocN(ma->cursize, ma->name);
 		else
-			ma->curbuf= MEM_mallocN(ma->cursize, ma->name);
-		
+			ma->curbuf = MEM_mallocN(ma->cursize, ma->name);
+
 		BLI_linklist_prepend(&ma->bufs, ma->curbuf);
 
 		/* align alloc'ed memory (needed if align > 8) */
 		tmp = (unsigned char*)PADUP( (intptr_t) ma->curbuf, ma->align);
 		ma->cursize -= (tmp - ma->curbuf);
-		ma->curbuf = tmp;		
+		ma->curbuf = tmp;
 	}
-	
-	ptr= ma->curbuf;
-	ma->curbuf+= size;
-	ma->cursize-= size;
-	
+
+	ptr = ma->curbuf;
+	ma->curbuf += size;
+	ma->cursize -= size;
+
 	return ptr;
 }
 
diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c
index 5e64ed2..3d16b3a 100644
--- a/source/blender/blenlib/intern/BLI_mempool.c
+++ b/source/blender/blenlib/intern/BLI_mempool.c
@@ -45,7 +45,7 @@
 #include <string.h>
 #include <stdlib.h>
 
-/* note: copied from BKE_utildefines.h, dont use here because we're in BLI */
+/* note: copied from BKE_utildefines.h, don't use here because we're in BLI */
 #ifdef __BIG_ENDIAN__
 /* Big Endian */
 #  define MAKE_ID(a,b,c,d) ( (int)(a)<<24 | (int)(b)<<16 | (c)<<8 | (d) )
@@ -71,120 +71,159 @@ struct BLI_mempool {
 	int esize;         /* element size in bytes */
 	int csize;         /* chunk size in bytes */
 	int pchunk;        /* number of elements per chunk */
-	short use_sysmalloc, allow_iter;
+	int flag;
 	/* keeps aligned to 16 bits */
 
-	BLI_freenode *free;	             /* free element list. Interleaved into chunk datas.*/
-	int totalloc, totused;           /* total number of elements allocated in total,
-	                                  * and currently in use*/
+	BLI_freenode *free;    /* free element list. Interleaved into chunk datas. */
+	int totalloc, totused; /* total number of elements allocated in total,
+	                        * and currently in use */
 };
 
 #define MEMPOOL_ELEM_SIZE_MIN (sizeof(void *) * 2)
 
-BLI_mempool *BLI_mempool_create(int esize, int tote, int pchunk,
-                                short use_sysmalloc, short allow_iter)
+BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag)
 {
-	BLI_mempool  *pool = NULL;
+	BLI_mempool *pool = NULL;
 	BLI_freenode *lasttail = NULL, *curnode = NULL;
-	int i,j, maxchunks;
+	int i, j, maxchunks;
 	char *addr;
 
-	if (esize < MEMPOOL_ELEM_SIZE_MIN)
+	/* allocate the pool structure */
+	if (flag & BLI_MEMPOOL_SYSMALLOC) {
+		pool = malloc(sizeof(BLI_mempool));
+	}
+	else {
+		pool = MEM_mallocN(sizeof(BLI_mempool), "memory pool");
+	}
+
+	/* set the elem size */
+	if (esize < MEMPOOL_ELEM_SIZE_MIN) {
 		esize = MEMPOOL_ELEM_SIZE_MIN;
+	}
 
-	/*allocate the pool structure*/
-	pool = use_sysmalloc ? malloc(sizeof(BLI_mempool)) : MEM_mallocN(sizeof(BLI_mempool), "memory pool");
-	pool->esize = allow_iter ? MAX2(esize, sizeof(BLI_freenode)) : esize;
-	pool->use_sysmalloc = use_sysmalloc;
+	if (flag & BLI_MEMPOOL_ALLOW_ITER) {
+		pool->esize = MAX2(esize, sizeof(BLI_freenode));
+	}
+	else {
+		pool->esize = esize;
+	}
+
+	pool->flag = flag;
 	pool->pchunk = pchunk;
 	pool->csize = esize * pchunk;
 	pool->chunks.first = pool->chunks.last = NULL;
-	pool->totused= 0;
-	pool->allow_iter= allow_iter;
-	
-	maxchunks = tote / pchunk + 1;
-	if (maxchunks==0) maxchunks = 1;
-
-	/*allocate the actual chunks*/
-	for (i=0; i < maxchunks; i++) {
-		BLI_mempool_chunk *mpchunk = use_sysmalloc ? malloc(sizeof(BLI_mempool_chunk)) : MEM_mallocN(sizeof(BLI_mempool_chunk), "BLI_Mempool Chunk");
+	pool->totused = 0;
+
+	maxchunks = totelem / pchunk + 1;
+	if (maxchunks == 0) {
+		maxchunks = 1;
+	}
+
+	/* allocate the actual chunks */
+	for (i = 0; i < maxchunks; i++) {
+		BLI_mempool_chunk *mpchunk;
+
+		if (flag & BLI_MEMPOOL_SYSMALLOC) {
+			mpchunk = malloc(sizeof(BLI_mempool_chunk));
+			mpchunk->data = malloc(pool->csize);
+		}
+		else {
+			mpchunk = MEM_mallocN(sizeof(BLI_mempool_chunk), "BLI_Mempool Chunk");
+			mpchunk->data = MEM_mallocN(pool->csize, "BLI Mempool Chunk Data");
+		}
+
 		mpchunk->next = mpchunk->prev = NULL;
-		mpchunk->data = use_sysmalloc ? malloc(pool->csize) : MEM_mallocN(pool->csize, "BLI Mempool Chunk Data");
 		BLI_addtail(&(pool->chunks), mpchunk);
-		
-		if (i==0) {
-			pool->free = mpchunk->data; /*start of the list*/
-			if (pool->allow_iter)
+
+		if (i == 0) {
+			pool->free = mpchunk->data; /* start of the list */
+			if (pool->flag & BLI_MEMPOOL_ALLOW_ITER) {
 				pool->free->freeword = FREEWORD;
+			}
 		}
 
-		/*loop through the allocated data, building the pointer structures*/
-		for (addr = mpchunk->data, j=0; j < pool->pchunk; j++) {
-			curnode = ((BLI_freenode*)addr);
+		/* loop through the allocated data, building the pointer structures */
+		for (addr = mpchunk->data, j = 0; j < pool->pchunk; j++) {
+			curnode = ((BLI_freenode *)addr);
 			addr += pool->esize;
-			curnode->next = (BLI_freenode*)addr;
-			if (pool->allow_iter) {
-				if (j != pool->pchunk-1)
+			curnode->next = (BLI_freenode *)addr;
+			if (pool->flag & BLI_MEMPOOL_ALLOW_ITER) {
+				if (j != pool->pchunk - 1)
 					curnode->next->freeword = FREEWORD;
 				curnode->freeword = FREEWORD;
 			}
 		}
-		/*final pointer in the previously allocated chunk is wrong.*/
+		/* final pointer in the previously allocated chunk is wrong */
 		if (lasttail) {
 			lasttail->next = mpchunk->data;
-			if (pool->allow_iter)
+			if (pool->flag & BLI_MEMPOOL_ALLOW_ITER) {
 				lasttail->freeword = FREEWORD;
+			}
 		}
 
-		/*set the end of this chunks memoryy to the new tail for next iteration*/
+		/* set the end of this chunks memoryy to the new tail for next iteration */
 		lasttail = curnode;
 
 		pool->totalloc += pool->pchunk;
 	}
-	/*terminate the list*/
+	/* terminate the list */
 	curnode->next = NULL;
 	return pool;
 }
 
 void *BLI_mempool_alloc(BLI_mempool *pool)
 {
-	void *retval=NULL;
+	void *retval = NULL;
 
 	pool->totused++;
 
 	if (!(pool->free)) {
-		BLI_freenode *curnode=NULL;
+		BLI_freenode *curnode = NULL;
 		char *addr;
 		int j;
 
-		/*need to allocate a new chunk*/
-		BLI_mempool_chunk *mpchunk = pool->use_sysmalloc ? malloc(sizeof(BLI_mempool_chunk)) :  MEM_mallocN(sizeof(BLI_mempool_chunk), "BLI_Mempool Chunk");
+		/* need to allocate a new chunk */
+		BLI_mempool_chunk *mpchunk;
+
+		if (pool->flag & BLI_MEMPOOL_SYSMALLOC) {
+			mpchunk       = malloc(sizeof(BLI_mempool_chunk));
+			mpchunk->data = malloc(pool->csize);
+		}
+		else {
+			mpchunk       = MEM_mallocN(sizeof(BLI_mempool_chunk), "BLI_Mempool Chunk");
+			mpchunk->data = MEM_mallocN(pool->csize, "BLI_Mempool Chunk Data");
+		}
+
 		mpchunk->next = mpchunk->prev = NULL;
-		mpchunk->data = pool->use_sysmalloc ? malloc(pool->csize) : MEM_mallocN(pool->csize, "BLI_Mempool Chunk Data");
 		BLI_addtail(&(pool->chunks), mpchunk);
 
-		pool->free = mpchunk->data; /*start of the list*/
-		if (pool->allow_iter)
+		pool->free = mpchunk->data; /* start of the list */
+
+		if (pool->flag & BLI_MEMPOOL_ALLOW_ITER) {
 			pool->free->freeword = FREEWORD;
-		for(addr = mpchunk->data, j=0; j < pool->pchunk; j++){
-			curnode = ((BLI_freenode*)addr);
+		}
+
+		for (addr = mpchunk->data, j = 0; j < pool->pchunk; j++) {
+			curnode = ((BLI_freenode *)addr);
 			addr += pool->esize;
-			curnode->next = (BLI_freenode*)addr;
+			curnode->next = (BLI_freenode *)addr;
 
-			if (pool->allow_iter) {
+			if (pool->flag & BLI_MEMPOOL_ALLOW_ITER) {
 				curnode->freeword = FREEWORD;
-				if (j != pool->pchunk-1)
+				if (j != pool->pchunk - 1)
 					curnode->next->freeword = FREEWORD;
 			}
 		}
-		curnode->next = NULL; /*terminate the list*/
+		curnode->next = NULL; /* terminate the list */
 
 		pool->totalloc += pool->pchunk;
 	}
 
 	retval = pool->free;
-	if (pool->allow_iter)
+
+	if (pool->flag & BLI_MEMPOOL_ALLOW_ITER) {
 		pool->free->freeword = 0x7FFFFFFF;
+	}
 
 	pool->free = pool->free->next;
 	//memset(retval, 0, pool->esize);
@@ -193,57 +232,70 @@ void *BLI_mempool_alloc(BLI_mempool *pool)
 
 void *BLI_mempool_calloc(BLI_mempool *pool)
 {
-	void *retval= BLI_mempool_alloc(pool);
+	void *retval = BLI_mempool_alloc(pool);
 	memset(retval, 0, pool->esize);
 	return retval;
 }
 
-/* doesnt protect against double frees, dont be stupid! */
+/* doesnt protect against double frees, don't be stupid! */
 void BLI_mempool_free(BLI_mempool *pool, void *addr)
 {
 	BLI_freenode *newhead = addr;
 
-	if (pool->allow_iter)
+	if (pool->flag & BLI_MEMPOOL_ALLOW_ITER) {
 		newhead->freeword = FREEWORD;
+	}
+
 	newhead->next = pool->free;
 	pool->free = newhead;
 
 	pool->totused--;
 
-	/*nothing is in use; free all the chunks except the first*/
+	/* nothing is in use; free all the chunks except the first */
 	if (pool->totused == 0) {
-		BLI_freenode *curnode=NULL;
-		char *tmpaddr=NULL;
+		BLI_freenode *curnode = NULL;
+		char *tmpaddr = NULL;
 		int i;
 
-		BLI_mempool_chunk *mpchunk=NULL;
-		BLI_mempool_chunk *first= pool->chunks.first;
+		BLI_mempool_chunk *mpchunk = NULL;
+		BLI_mempool_chunk *first = pool->chunks.first;
 
 		BLI_remlink(&pool->chunks, first);
 
-		for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) {
-			if (pool->use_sysmalloc) free(mpchunk->data);
-			else                     MEM_freeN(mpchunk->data);
+		if (pool->flag & BLI_MEMPOOL_SYSMALLOC) {
+			for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) {
+				free(mpchunk->data);
+			}
+			BLI_freelist(&(pool->chunks));
+		}
+		else {
+			for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) {
+				MEM_freeN(mpchunk->data);
+			}
+			BLI_freelistN(&(pool->chunks));
 		}
 
-		pool->use_sysmalloc ? BLI_freelist(&(pool->chunks)) : BLI_freelistN(&(pool->chunks));
-		
 		BLI_addtail(&pool->chunks, first);
 		pool->totalloc = pool->pchunk;
 
-		pool->free = first->data; /*start of the list*/
-		for (tmpaddr = first->data, i=0; i < pool->pchunk; i++) {
-			curnode = ((BLI_freenode*)tmpaddr);
+		pool->free = first->data; /* start of the list */
+		for (tmpaddr = first->data, i = 0; i < pool->pchunk; i++) {
+			curnode = ((BLI_freenode *)tmpaddr);
 			tmpaddr += pool->esize;
-			curnode->next = (BLI_freenode*)tmpaddr;
+			curnode->next = (BLI_freenode *)tmpaddr;
 		}
-		curnode->next = NULL; /*terminate the list*/
+		curnode->next = NULL; /* terminate the list */
 	}
 }
 
+int BLI_mempool_count(BLI_mempool *pool)
+{
+	return pool->totused;
+}
+
 void *BLI_mempool_findelem(BLI_mempool *pool, int index)
 {
-	if (!pool->allow_iter) {
+	if (!(pool->flag & BLI_MEMPOOL_ALLOW_ITER)) {
 		fprintf(stderr, "%s: Error! you can't iterate over this mempool!\n", __func__);
 		return NULL;
 	}
@@ -252,7 +304,9 @@ void *BLI_mempool_findelem(BLI_mempool *pool, int index)
 		BLI_mempool_iter iter;
 		void *elem;
 		BLI_mempool_iternew(pool, &iter);
-		for (elem= BLI_mempool_iterstep(&iter); index-- != 0; elem= BLI_mempool_iterstep(&iter)) { };
+		for (elem = BLI_mempool_iterstep(&iter); index-- != 0; elem = BLI_mempool_iterstep(&iter)) {
+			/* do nothing */
+		};
 		return elem;
 	}
 
@@ -261,14 +315,14 @@ void *BLI_mempool_findelem(BLI_mempool *pool, int index)
 
 void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter)
 {
-	if (!pool->allow_iter) {
+	if (!(pool->flag & BLI_MEMPOOL_ALLOW_ITER)) {
 		fprintf(stderr, "%s: Error! you can't iterate over this mempool!\n", __func__);
 		iter->curchunk = NULL;
 		iter->curindex = 0;
-		
+
 		return;
 	}
-	
+
 	iter->pool = pool;
 	iter->curchunk = pool->chunks.first;
 	iter->curindex = 0;
@@ -280,29 +334,29 @@ void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter)
 static void *bli_mempool_iternext(BLI_mempool_iter *iter)
 {
 	void *ret = NULL;
-	
+
 	if (!iter->curchunk || !iter->pool->totused) return NULL;
-	
-	ret = ((char*)iter->curchunk->data) + iter->pool->esize*iter->curindex;
-	
+
+	ret = ((char *)iter->curchunk->data) + iter->pool->esize * iter->curindex;
+
 	iter->curindex++;
-	
+
 	if (iter->curindex >= iter->pool->pchunk) {
 		iter->curchunk = iter->curchunk->next;
 		iter->curindex = 0;
 	}
-	
+
 	return ret;
 }
 
 void *BLI_mempool_iterstep(BLI_mempool_iter *iter)
 {
 	BLI_freenode *ret;
-	
+
 	do {
 		ret = bli_mempool_iternext(iter);
 	} while (ret && ret->freeword == FREEWORD);
-	
+
 	return ret;
 }
 
@@ -320,7 +374,7 @@ void *BLI_mempool_iterstep(BLI_mempool_iter *iter)
 
 	do {
 		if (LIKELY(iter->curchunk)) {
-			ret = (BLI_freenode *)(((char*)iter->curchunk->data) + iter->pool->esize*iter->curindex);
+			ret = (BLI_freenode *)(((char *)iter->curchunk->data) + iter->pool->esize * iter->curindex);
 		}
 		else {
 			return NULL;
@@ -331,7 +385,7 @@ void *BLI_mempool_iterstep(BLI_mempool_iter *iter)
 			iter->curchunk = iter->curchunk->next;
 		}
 	} while (ret->freeword == FREEWORD);
-	
+
 	return ret;
 }
 
@@ -339,9 +393,9 @@ void *BLI_mempool_iterstep(BLI_mempool_iter *iter)
 
 void BLI_mempool_destroy(BLI_mempool *pool)
 {
-	BLI_mempool_chunk *mpchunk=NULL;
+	BLI_mempool_chunk *mpchunk = NULL;
 
-	if (pool->use_sysmalloc) {
+	if (pool->flag & BLI_MEMPOOL_SYSMALLOC) {
 		for (mpchunk = pool->chunks.first; mpchunk; mpchunk = mpchunk->next) {
 			free(mpchunk->data);
 		}
diff --git a/source/blender/blenlib/intern/DLRB_tree.c b/source/blender/blenlib/intern/DLRB_tree.c
index b7df06b..0e90042 100644
--- a/source/blender/blenlib/intern/DLRB_tree.c
+++ b/source/blender/blenlib/intern/DLRB_tree.c
@@ -36,7 +36,7 @@
 /* *********************************************** */
 /* Tree API */
 
-/* Create a new tree, and initialise as necessary */
+/* Create a new tree, and initialize as necessary */
 DLRBT_Tree *BLI_dlrbTree_new (void)
 {
 	/* just allocate for now */
diff --git a/source/blender/blenlib/intern/boxpack2d.c b/source/blender/blenlib/intern/boxpack2d.c
index cf18fbd..6631e36 100644
--- a/source/blender/blenlib/intern/boxpack2d.c
+++ b/source/blender/blenlib/intern/boxpack2d.c
@@ -24,12 +24,11 @@
  *  \ingroup bli
  */
 
-
 #include <stdlib.h> /* for qsort */
 
 #include "MEM_guardedalloc.h"
 #include "BLI_boxpack2d.h"
- 
+
 /* BoxPacker for backing 2D rectangles into a square
  * 
  * The defined Below are for internal use only */
@@ -52,7 +51,7 @@ typedef struct boxVert {
 } boxVert;
 
 /* free vert flags */
-#define eps 0.0000001f
+#define EPSILON 0.0000001f
 #define BLF 1
 #define TRF 2
 #define TLF 4
@@ -64,52 +63,54 @@ typedef struct boxVert {
 #define TL 2
 #define BR 3
 
-#define BOXLEFT(b)		b->v[BL]->x
-#define BOXRIGHT(b)		b->v[TR]->x
-#define BOXBOTTOM(b)	b->v[BL]->y
-#define BOXTOP(b)		b->v[TR]->y
-#define BOXAREA(b)		(b->w * b->h)
+#define BOXLEFT(b)		((b)->v[BL]->x)
+#define BOXRIGHT(b)		((b)->v[TR]->x)
+#define BOXBOTTOM(b)	((b)->v[BL]->y)
+#define BOXTOP(b)		((b)->v[TR]->y)
+#define BOXAREA(b)		((b)->w * (b)->h)
 
-#define UPDATE_V34X(b)	b->v[TL]->x = b->v[BL]->x;\
-						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
-#define UPDATE_V34(b) UPDATE_V34X(b); UPDATE_V34Y(b)  
+#define UPDATE_V34X(b)	((b)->v[TL]->x = (b)->v[BL]->x); \
+						((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)
+#define UPDATE_V34(b) UPDATE_V34X(b); UPDATE_V34Y(b)
 
-#define SET_BOXLEFT(b, f)	b->v[TR]->x = f + b->w;\
-							b->v[BL]->x = f;\
+#define SET_BOXLEFT(b, f)	(b)->v[TR]->x = f + (b)->w; \
+							(b)->v[BL]->x = f;          \
 							UPDATE_V34X(b)
-#define SET_BOXRIGHT(b, f)	b->v[BL]->x = f - b->w;\
-							b->v[TR]->x = f;\
+#define SET_BOXRIGHT(b, f)	(b)->v[BL]->x = f - (b)->w; \
+							(b)->v[TR]->x = f;          \
 							UPDATE_V34X(b)
-#define SET_BOXBOTTOM(b, f)	b->v[TR]->y = f + b->h;\
-							b->v[BL]->y = f;\
+#define SET_BOXBOTTOM(b, f)	(b)->v[TR]->y = f + (b)->h; \
+							(b)->v[BL]->y = f;          \
 							UPDATE_V34Y(b)
-#define SET_BOXTOP(b, f)	b->v[BL]->y = f - b->h;\
-							b->v[TR]->y = f;\
+#define SET_BOXTOP(b, f)	(b)->v[BL]->y = f - (b)->h; \
+							(b)->v[TR]->y = f;          \
 							UPDATE_V34Y(b)
-#define BOXINTERSECT(b1, b2)\
-	(!( BOXLEFT(b1)+eps>=BOXRIGHT(b2) ||\
-		BOXBOTTOM(b1)+eps>=BOXTOP(b2) ||\
-		BOXRIGHT(b1)-eps<=BOXLEFT(b2) ||\
-		BOXTOP(b1)-eps<=BOXBOTTOM(b2) ))
+#define BOXINTERSECT(b1, b2)                 \
+	!(BOXLEFT(b1)   + EPSILON >= BOXRIGHT(b2) || \
+	  BOXBOTTOM(b1) + EPSILON >= BOXTOP(b2)   || \
+	  BOXRIGHT(b1)  - EPSILON <= BOXLEFT(b2)  || \
+	  BOXTOP(b1)    - EPSILON <= BOXBOTTOM(b2))
 
-#define MIN2(x,y)               ( (x)<(y) ? (x) : (y) )
-#define MAX2(x,y)               ( (x)>(y) ? (x) : (y) )
+#define MIN2(x,y)               ((x) < (y) ? (x) : (y))
+#define MAX2(x,y)               ((x) > (y) ? (x) : (y))
 
-/* #define BOXDEBUG(b)\
- * 		printf("\tBox Debug i %i, w:%.3f h:%.3f x:%.3f y:%.3f\n",\
- * 		b->index, b->w, b->h, b->x, b->y) */
+#if 0
+#define BOXDEBUG(b) \
+	printf("\tBox Debug i %i, w:%.3f h:%.3f x:%.3f y:%.3f\n", \
+	b->index, b->w, b->h, b->x, b->y)
+#endif
 
 /* qsort function - sort largest to smallest */
 static int box_areasort(const void *p1, const void *p2)
 {
-	const boxPack *b1= p1, *b2= p2;
-	const float a1= BOXAREA(b1);
-	const float a2= BOXAREA(b2);
+	const boxPack *b1 = p1, *b2 = p2;
+	const float a1 = BOXAREA(b1);
+	const float a2 = BOXAREA(b2);
 
-	if		( a1 < a2 ) return  1;
-	else if	( a1 > a2 ) return -1;
+	if      (a1 < a2) return  1;
+	else if (a1 > a2) return -1;
 	return 0;
 }
 
@@ -126,16 +127,16 @@ static int vertex_sort(const void *p1, const void *p2)
 {
 	boxVert *v1, *v2;
 	float a1, a2;
-	
-	v1 = vertarray + ((int *) p1)[0];
-	v2 = vertarray + ((int *) p2)[0];
-	
+
+	v1 = vertarray + ((int *)p1)[0];
+	v2 = vertarray + ((int *)p2)[0];
+
 	a1 = MAX2(v1->x+box_width, v1->y+box_height);
 	a2 = MAX2(v2->x+box_width, v2->y+box_height);
-	
+
 	/* sort largest to smallest */
-	if		( a1 > a2 ) return  1;
-	else if	( a1 < a2 ) return -1;
+	if      (a1 > a2) return  1;
+	else if (a1 < a2) return -1;
 	return 0;
 }
 /* Main boxpacking function accessed from other functions
@@ -155,24 +156,24 @@ void boxPack2D(boxPack *boxarray, const int len, float *tot_width, float *tot_he
 {
 	boxVert *vert; /* the current vert */
 	int box_index, verts_pack_len, i, j, k, isect;
-	int quad_flags[4]= {BLF,TRF,TLF,BRF}; /* use for looping */
+	int quad_flags[4] = {BLF, TRF, TLF, BRF}; /* use for looping */
 	boxPack *box, *box_test; /*current box and another for intersection tests*/
 	int *vertex_pack_indices; /*an array of indices used for sorting verts*/
-	
+
 	if (!len) {
-		*tot_width =  0.0f;
+		*tot_width = 0.0f;
 		*tot_height = 0.0f;
 		return;
 	}
-	
+
 	/* Sort boxes, biggest first */
 	qsort(boxarray, len, sizeof(boxPack), box_areasort);
-	
+
 	/* add verts to the boxes, these are only used internally  */
-	vert = vertarray = MEM_mallocN( len*4*sizeof(boxVert), "boxPack Verts");
-	vertex_pack_indices = MEM_mallocN( len*3*sizeof(int), "boxPack Indices");
-	
-	for (box=boxarray, box_index=0, i=0; box_index < len; box_index++, box++) {
+	vert = vertarray = MEM_mallocN(len * 4 * sizeof(boxVert), "boxPack Verts");
+	vertex_pack_indices = MEM_mallocN(len * 3 * sizeof(int), "boxPack Indices");
+
+	for (box = boxarray, box_index = 0, i = 0; box_index < len; box_index++, box++) {
 
 		vert->blb = vert->brb = vert->tlb =
 		        vert->isect_cache[0] = vert->isect_cache[1] =
@@ -207,98 +208,98 @@ void boxPack2D(boxPack *boxarray, const int len, float *tot_width, float *tot_he
 		box->v[BR] = vert; vert++;
 	}
 	vert = NULL;
-	
-	
+
 	/* Pack the First box!
 	 * then enter the main box-packing loop */
-	
+
 	box = boxarray; /* get the first box  */
 	/* First time, no boxes packed */
 	box->v[BL]->free = 0; /* Can't use any if these */
-	box->v[BR]->free &= ~(BLF|BRF);
-	box->v[TL]->free &= ~(BLF|TLF);
-	
+	box->v[BR]->free &= ~(BLF | BRF);
+	box->v[TL]->free &= ~(BLF | TLF);
+
 	*tot_width = box->w;
-	*tot_height = box->h; 
-	
+	*tot_height = box->h;
+
 	/* This sets all the vertex locations */
 	SET_BOXLEFT(box, 0.0f);
 	SET_BOXBOTTOM(box, 0.0f);
 	box->x = box->y = 0.0f;
-	
-	for (i=0; i<3; i++)
-		vertex_pack_indices[i] = box->v[i+1]->index; 
+
+	for (i = 0; i < 3; i++)
+		vertex_pack_indices[i] = box->v[i + 1]->index;
 	verts_pack_len = 3;
 	box++; /* next box, needed for the loop below */
 	/* ...done packing the first box */
 
 	/* Main boxpacking loop */
-	for (box_index=1; box_index < len; box_index++, box++) {
-		
+	for (box_index = 1; box_index < len; box_index++, box++) {
+
 		/* These static floatds are used for sorting */
 		box_width = box->w;
 		box_height = box->h;
-		
+
 		qsort(vertex_pack_indices, verts_pack_len, sizeof(int), vertex_sort);
-		
+
 		/* Pack the box in with the others */
 		/* sort the verts */
 		isect = 1;
-		
-		for (i=0; i<verts_pack_len && isect; i++) {
+
+		for (i = 0; i < verts_pack_len && isect; i++) {
 			vert = vertarray + vertex_pack_indices[i];
 			/* printf("\ttesting vert %i %i %i %f %f\n", i,
 			 * 		vert->free, verts_pack_len, vert->x, vert->y); */
-			
+
 			/* This vert has a free quadrant
 			 * Test if we can place the box here
 			 * vert->free & quad_flags[j] - Checks 
 			 * */
-						
-			for (j=0; (j<4) && isect; j++) {
+
+			for (j = 0; (j < 4) && isect; j++) {
 				if (vert->free & quad_flags[j]) {
 					switch (j) {
-					case BL:
-						SET_BOXRIGHT(box, vert->x);
-						SET_BOXTOP(box, vert->y);
-						break;
-					case TR:
-						SET_BOXLEFT(box, vert->x);
-						SET_BOXBOTTOM(box, vert->y);
-						break;
-					case TL:
-						SET_BOXRIGHT(box, vert->x);
-						SET_BOXBOTTOM(box, vert->y);
-						break;
-					case BR:
-						SET_BOXLEFT(box, vert->x);
-						SET_BOXTOP(box, vert->y);
-						break;
+						case BL:
+							SET_BOXRIGHT(box, vert->x);
+							SET_BOXTOP(box, vert->y);
+							break;
+						case TR:
+							SET_BOXLEFT(box, vert->x);
+							SET_BOXBOTTOM(box, vert->y);
+							break;
+						case TL:
+							SET_BOXRIGHT(box, vert->x);
+							SET_BOXBOTTOM(box, vert->y);
+							break;
+						case BR:
+							SET_BOXLEFT(box, vert->x);
+							SET_BOXTOP(box, vert->y);
+							break;
 					}
-					
+
 					/* Now we need to check that the box intersects
-					  * with any other boxes
-					  * Assume no intersection... */
+					 * with any other boxes
+					 * Assume no intersection... */
 					isect = 0;
 					
 					if (/* Constrain boxes to positive X/Y values */
-						BOXLEFT(box)<0.0f || BOXBOTTOM(box) < 0.0f ||
+						BOXLEFT(box) < 0.0f || BOXBOTTOM(box) < 0.0f ||
 						/* check for last intersected */
 						(	vert->isect_cache[j] &&
-							BOXINTERSECT(box, vert->isect_cache[j])	)
-					   ) {
+							BOXINTERSECT(box, vert->isect_cache[j])))
+					{
 						/* Here we check that the last intersected
 						 * box will intersect with this one using
 						 * isect_cache that can store a pointer to a
 						 * box for each quadrant
 						 * big speedup */
 						isect = 1;
-					} else {
+					}
+					else {
 						/* do a full search for colliding box
-						 * this is really slow, some spacialy divided
+						 * this is really slow, some spatially divided
 						 * data-structure would be better */
-						for (box_test=boxarray; box_test != box; box_test++) {
-							if BOXINTERSECT(box, box_test) {
+						for (box_test = boxarray; box_test != box; box_test++) {
+							if (BOXINTERSECT(box, box_test)) {
 								/* Store the last intersecting here as cache
 								 * for faster checking next time around */
 								vert->isect_cache[j] = box_test;
@@ -307,35 +308,35 @@ void boxPack2D(boxPack *boxarray, const int len, float *tot_width, float *tot_he
 							}
 						}
 					}
-					
+
 					if (!isect) {
-						
+
 						/* maintain the total width and height */
 						(*tot_width) = MAX2(BOXRIGHT(box), (*tot_width));
 						(*tot_height) = MAX2(BOXTOP(box), (*tot_height));
-						
+
 						/* Place the box */
 						vert->free &= ~quad_flags[j];
-						
+
 						switch (j) {
-						case TR:
-							box->v[BL]= vert;
-							vert->trb = box;
-							 break;
-						case TL:
-							box->v[BR]= vert;
-							vert->tlb = box;
-							 break;
-						case BR:
-							box->v[TL]= vert;
-							vert->brb = box;
-							break;
-						case BL:
-							box->v[TR]= vert;
-							vert->blb = box;
-							 break;
+							case TR:
+								box->v[BL] = vert;
+								vert->trb = box;
+								break;
+							case TL:
+								box->v[BR] = vert;
+								vert->tlb = box;
+								break;
+							case BR:
+								box->v[TL] = vert;
+								vert->brb = box;
+								break;
+							case BL:
+								box->v[TR] = vert;
+								vert->blb = box;
+								break;
 						}
-						
+
 						/* Mask free flags for verts that are
 						 * on the bottom or side so we don't get
 						 * boxes outside the given rectangle ares
@@ -343,68 +344,73 @@ void boxPack2D(boxPack *boxarray, const int len, float *tot_width, float *tot_he
 						 * We can do an else/if here because only the first 
 						 * box can be at the very bottom left corner */
 						if (BOXLEFT(box) <= 0) {
-							box->v[TL]->free &= ~(TLF|BLF);
-							box->v[BL]->free &= ~(TLF|BLF);				
-						} else if (BOXBOTTOM(box) <= 0) {
-							box->v[BL]->free &= ~(BRF|BLF);
-							box->v[BR]->free &= ~(BRF|BLF);
+							box->v[TL]->free &= ~(TLF | BLF);
+							box->v[BL]->free &= ~(TLF | BLF);
 						}
-						
+						else if (BOXBOTTOM(box) <= 0) {
+							box->v[BL]->free &= ~(BRF | BLF);
+							box->v[BR]->free &= ~(BRF | BLF);
+						}
+
 						/* The following block of code does a logical
 						 * check with 2 adjacent boxes, its possible to
 						 * flag verts on one or both of the boxes 
 						 * as being used by checking the width or
 						 * height of both boxes */
-						if (vert->tlb && vert->trb &&
-									(box == vert->tlb || box == vert->trb)) {
+						if (vert->tlb && vert->trb && (box == vert->tlb || box == vert->trb)) {
 							if (vert->tlb->h > vert->trb->h) {
-								vert->trb->v[TL]->free &= ~(TLF|BLF);
-							} else if (vert->tlb->h < vert->trb->h) {
-								vert->tlb->v[TR]->free &= ~(TRF|BRF);
-							} else { /*same*/
+								vert->trb->v[TL]->free &= ~(TLF | BLF);
+							}
+							else if (vert->tlb->h < vert->trb->h) {
+								vert->tlb->v[TR]->free &= ~(TRF | BRF);
+							}
+							else { /*same*/
 								vert->tlb->v[TR]->free &= ~BLF;
 								vert->trb->v[TL]->free &= ~BRF;
 							}
-						} else if (vert->blb && vert->brb &&
-									(box == vert->blb || box == vert->brb)) {
+						}
+						else if (vert->blb && vert->brb && (box == vert->blb || box == vert->brb)) {
 							if (vert->blb->h > vert->brb->h) {
-								vert->brb->v[BL]->free &= ~(TLF|BLF);
-							} else if (vert->blb->h < vert->brb->h) {
-								vert->blb->v[BR]->free &= ~(TRF|BRF);
-							} else { /*same*/
+								vert->brb->v[BL]->free &= ~(TLF | BLF);
+							}
+							else if (vert->blb->h < vert->brb->h) {
+								vert->blb->v[BR]->free &= ~(TRF | BRF);
+							}
+							else { /*same*/
 								vert->blb->v[BR]->free &= ~TRF;
 								vert->brb->v[BL]->free &= ~TLF;
 							}
 						}
 						/* Horizontal */
-						if (vert->tlb && vert->blb &&
-									(box == vert->tlb || box == vert->blb) ) {
+						if (vert->tlb && vert->blb && (box == vert->tlb || box == vert->blb)) {
 							if (vert->tlb->w > vert->blb->w) {
-								vert->blb->v[TL]->free &= ~(TLF|TRF);
-							} else if (vert->tlb->w < vert->blb->w) {
-								vert->tlb->v[BL]->free &= ~(BLF|BRF);
-							} else { /*same*/
+								vert->blb->v[TL]->free &= ~(TLF | TRF);
+							}
+							else if (vert->tlb->w < vert->blb->w) {
+								vert->tlb->v[BL]->free &= ~(BLF | BRF);
+							}
+							else { /*same*/
 								vert->blb->v[TL]->free &= ~TRF;
 								vert->tlb->v[BL]->free &= ~BRF;
 							}
-						} else if (	vert->trb && vert->brb &&
-									(box == vert->trb || box == vert->brb) ) {
+						}
+						else if (vert->trb && vert->brb && (box == vert->trb || box == vert->brb)) {
 							if (vert->trb->w > vert->brb->w) {
-								vert->brb->v[TR]->free &= ~(TLF|TRF);
-							} else if (vert->trb->w < vert->brb->w) {
-								vert->trb->v[BR]->free &= ~(BLF|BRF);
-							} else { /*same*/
+								vert->brb->v[TR]->free &= ~(TLF | TRF);
+							}
+							else if (vert->trb->w < vert->brb->w) {
+								vert->trb->v[BR]->free &= ~(BLF | BRF);
+							}
+							else { /*same*/
 								vert->brb->v[TR]->free &= ~TLF;
 								vert->trb->v[BR]->free &= ~BLF;
 							}
 						}
 						/* End logical check */
-						
-						
-						for (k=0; k<4; k++) {
+
+						for (k = 0; k < 4; k++) {
 							if (box->v[k] != vert) {
-								vertex_pack_indices[verts_pack_len] =
-											box->v[k]->index; 
+								vertex_pack_indices[verts_pack_len] = box->v[k]->index;
 								verts_pack_len++;
 							}
 						}
@@ -414,16 +420,16 @@ void boxPack2D(boxPack *boxarray, const int len, float *tot_width, float *tot_he
 						box->x = BOXLEFT(box);
 						box->y = BOXBOTTOM(box);
 					}
-				}	
+				}
 			}
 		}
 	}
 
 	/* free all the verts, not really needed because they shouldn't be
 	 * touched anymore but accessing the pointers would crash blender */
-	for (box_index=0; box_index < len; box_index++) {
-		box = boxarray+box_index; 
-		box->v[0] = box->v[1] = box->v[2] = box->v[3] = NULL; 
+	for (box_index = 0; box_index < len; box_index++) {
+		box = boxarray + box_index;
+		box->v[0] = box->v[1] = box->v[2] = box->v[3] = NULL;
 	}
 	MEM_freeN(vertex_pack_indices);
 	MEM_freeN(vertarray);
diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c
index fdda916..0504ac5 100644
--- a/source/blender/blenlib/intern/bpath.c
+++ b/source/blender/blenlib/intern/bpath.c
@@ -30,10 +30,10 @@
  */
 
 /* TODO,
- * currently there are some cases we dont support.
+ * currently there are some cases we don't support.
  * - passing output paths to the visitor?, like render out.
  * - passing sequence strips with many images.
- * - passing directory paths - visitors dont know which path is a dir or a file.
+ * - passing directory paths - visitors don't know which path is a dir or a file.
  * */
 
 #include <sys/stat.h>
@@ -41,13 +41,13 @@
 #include <string.h>
 #include <assert.h>
 
-/* path/file handeling stuff */
+/* path/file handling stuff */
 #ifndef WIN32
-  #include <dirent.h>
-  #include <unistd.h>
+#  include <dirent.h>
+#  include <unistd.h>
 #else
-  #include <io.h>
-  #include "BLI_winstuff.h"
+#  include <io.h>
+#  include "BLI_winstuff.h"
 #endif
 
 #include "MEM_guardedalloc.h"
@@ -82,7 +82,7 @@
 
 static int checkMissingFiles_visit_cb(void *userdata, char *UNUSED(path_dst), const char *path_src)
 {
-	ReportList *reports= (ReportList *)userdata;
+	ReportList *reports = (ReportList *)userdata;
 
 	if (!BLI_exists(path_src)) {
 		BKE_reportf(reports, RPT_WARNING, "Path Not Found \"%s\"", path_src);
@@ -97,8 +97,7 @@ void checkMissingFiles(Main *bmain, ReportList *reports)
 	bpath_traverse_main(bmain, checkMissingFiles_visit_cb, BPATH_TRAVERSE_ABS, reports);
 }
 
-typedef struct BPathRemap_Data
-{
+typedef struct BPathRemap_Data {
 	const char *basedir;
 	ReportList *reports;
 
@@ -109,17 +108,17 @@ typedef struct BPathRemap_Data
 
 static int makeFilesRelative_visit_cb(void *userdata, char *path_dst, const char *path_src)
 {
-	BPathRemap_Data *data= (BPathRemap_Data *)userdata;
+	BPathRemap_Data *data = (BPathRemap_Data *)userdata;
 
 	data->count_tot++;
 
-	if(strncmp(path_src, "//", 2)==0) {
+	if (strncmp(path_src, "//", 2) == 0) {
 		return FALSE; /* already relative */
 	}
 	else {
 		strcpy(path_dst, path_src);
 		BLI_path_rel(path_dst, data->basedir);
-		if (strncmp(path_dst, "//", 2)==0) {
+		if (strncmp(path_dst, "//", 2) == 0) {
 			data->count_changed++;
 		}
 		else {
@@ -132,15 +131,15 @@ static int makeFilesRelative_visit_cb(void *userdata, char *path_dst, const char
 
 void makeFilesRelative(Main *bmain, const char *basedir, ReportList *reports)
 {
-	BPathRemap_Data data= {NULL};
+	BPathRemap_Data data = {NULL};
 
-	if(basedir[0] == '\0') {
+	if (basedir[0] == '\0') {
 		printf("%s: basedir='', this is a bug\n", __func__);
 		return;
 	}
 
-	data.basedir= basedir;
-	data.reports= reports;
+	data.basedir = basedir;
+	data.reports = reports;
 
 	bpath_traverse_main(bmain, makeFilesRelative_visit_cb, 0, (void *)&data);
 
@@ -151,17 +150,17 @@ void makeFilesRelative(Main *bmain, const char *basedir, ReportList *reports)
 
 static int makeFilesAbsolute_visit_cb(void *userdata, char *path_dst, const char *path_src)
 {
-	BPathRemap_Data *data= (BPathRemap_Data *)userdata;
+	BPathRemap_Data *data = (BPathRemap_Data *)userdata;
 
 	data->count_tot++;
 
-	if(strncmp(path_src, "//", 2)!=0) {
+	if (strncmp(path_src, "//", 2) != 0) {
 		return FALSE; /* already absolute */
 	}
 	else {
 		strcpy(path_dst, path_src);
 		BLI_path_abs(path_dst, data->basedir);
-		if (strncmp(path_dst, "//", 2)!=0) {
+		if (strncmp(path_dst, "//", 2) != 0) {
 			data->count_changed++;
 		}
 		else {
@@ -175,15 +174,15 @@ static int makeFilesAbsolute_visit_cb(void *userdata, char *path_dst, const char
 /* similar to makeFilesRelative - keep in sync! */
 void makeFilesAbsolute(Main *bmain, const char *basedir, ReportList *reports)
 {
-	BPathRemap_Data data= {NULL};
+	BPathRemap_Data data = {NULL};
 
-	if(basedir[0] == '\0') {
+	if (basedir[0] == '\0') {
 		printf("%s: basedir='', this is a bug\n", __func__);
 		return;
 	}
 
-	data.basedir= basedir;
-	data.reports= reports;
+	data.basedir = basedir;
+	data.reports = reports;
 
 	bpath_traverse_main(bmain, makeFilesAbsolute_visit_cb, 0, (void *)&data);
 
@@ -192,8 +191,7 @@ void makeFilesAbsolute(Main *bmain, const char *basedir, ReportList *reports)
 	            data.count_tot, data.count_changed, data.count_failed);
 }
 
-
-/* find this file recursively, use the biggest file so thumbnails dont get used by mistake
+/* find this file recursively, use the biggest file so thumbnails don't get used by mistake
  * - dir: subdir to search
  * - filename: set this filename
  * - filesize: filesize for the file
@@ -217,30 +215,30 @@ static int findFileRecursive(char *filename_new,
 
 	filename_new[0] = '\0';
 
-	dir= opendir(dirname);
+	dir = opendir(dirname);
 
-	if (dir==NULL)
+	if (dir == NULL)
 		return found;
 
 	if (*filesize == -1)
-		*filesize= 0; /* dir opened fine */
+		*filesize = 0; /* dir opened fine */
 
-	while ((de= readdir(dir)) != NULL) {
+	while ((de = readdir(dir)) != NULL) {
 
-		if (strcmp(".", de->d_name)==0 || strcmp("..", de->d_name)==0)
+		if (strcmp(".", de->d_name) == 0 || strcmp("..", de->d_name) == 0)
 			continue;
 
 		BLI_join_dirfile(path, sizeof(path), dirname, de->d_name);
 
 		if (stat(path, &status) != 0)
-			continue; /* cant stat, dont bother with this file, could print debug info here */
+			continue; /* cant stat, don't bother with this file, could print debug info here */
 
 		if (S_ISREG(status.st_mode)) { /* is file */
-			if (strncmp(filename, de->d_name, FILE_MAX)==0) { /* name matches */
+			if (strncmp(filename, de->d_name, FILE_MAX) == 0) { /* name matches */
 				/* open the file to read its size */
-				size= status.st_size;
+				size = status.st_size;
 				if ((size > 0) && (size > *filesize)) { /* find the biggest file */
-					*filesize= size;
+					*filesize = size;
 					BLI_strncpy(filename_new, path, FILE_MAX);
 					found = TRUE;
 				}
@@ -258,8 +256,7 @@ static int findFileRecursive(char *filename_new,
 	return found;
 }
 
-typedef struct BPathFind_Data
-{
+typedef struct BPathFind_Data {
 	const char *basedir;
 	char searchdir[FILE_MAX];
 	ReportList *reports;
@@ -267,11 +264,11 @@ typedef struct BPathFind_Data
 
 static int findMissingFiles_visit_cb(void *userdata, char *path_dst, const char *path_src)
 {
-	BPathFind_Data *data= (BPathFind_Data *)userdata;
+	BPathFind_Data *data = (BPathFind_Data *)userdata;
 	char filename_new[FILE_MAX];
 
-	int filesize= -1;
-	int recur_depth= 0;
+	int filesize = -1;
+	int recur_depth = 0;
 	int found;
 
 	found = findFileRecursive(filename_new,
@@ -298,9 +295,9 @@ static int findMissingFiles_visit_cb(void *userdata, char *path_dst, const char
 
 void findMissingFiles(Main *bmain, const char *searchpath, ReportList *reports)
 {
-	struct BPathFind_Data data= {NULL};
+	struct BPathFind_Data data = {NULL};
 
-	data.reports= reports;
+	data.reports = reports;
 	BLI_split_dir_part(searchpath, data.searchdir, sizeof(data.searchdir));
 
 	bpath_traverse_main(bmain, findMissingFiles_visit_cb, 0, (void *)&data);
@@ -316,10 +313,10 @@ static int rewrite_path_fixed(char *path, BPathVisitor visit_cb, const char *abs
 	if (absbase) {
 		BLI_strncpy(path_src_buf, path, sizeof(path_src_buf));
 		BLI_path_abs(path_src_buf, absbase);
-		path_src= path_src_buf;
+		path_src = path_src_buf;
 	}
 	else {
-		path_src= path;
+		path_src = path;
 	}
 
 	if (visit_cb(userdata, path_dst, path_src)) {
@@ -364,15 +361,15 @@ static int rewrite_path_alloc(char **path, BPathVisitor visit_cb, const char *ab
 	if (absbase) {
 		BLI_strncpy(path_src_buf, *path, sizeof(path_src_buf));
 		BLI_path_abs(path_src_buf, absbase);
-		path_src= path_src_buf;
+		path_src = path_src_buf;
 	}
 	else {
-		path_src= *path;
+		path_src = *path;
 	}
 
 	if (visit_cb(userdata, path_dst, path_src)) {
 		MEM_freeN((*path));
-		(*path)= BLI_strdup(path_dst);
+		(*path) = BLI_strdup(path_dst);
 		return TRUE;
 	}
 	else {
@@ -384,7 +381,7 @@ static int rewrite_path_alloc(char **path, BPathVisitor visit_cb, const char *ab
 void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
 {
 	Image *ima;
-	const char *absbase= (flag & BPATH_TRAVERSE_ABS) ? ID_BLEND_PATH(bmain, id) : NULL;
+	const char *absbase = (flag & BPATH_TRAVERSE_ABS) ? ID_BLEND_PATH(bmain, id) : NULL;
 
 	if ((flag & BPATH_TRAVERSE_SKIP_LIBRARY) && id->lib) {
 		return;
@@ -412,8 +409,8 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
 #define BPATH_TRAVERSE_POINTCACHE(ptcaches)                                    \
 	{                                                                          \
 		PointCache *cache;                                                     \
-		for(cache= (ptcaches).first; cache; cache= cache->next) {              \
-			if(cache->flag & PTCACHE_DISK_CACHE) {                             \
+		for (cache= (ptcaches).first; cache; cache= cache->next) {              \
+			if (cache->flag & PTCACHE_DISK_CACHE) {                             \
 				rewrite_path_fixed(cache->path,                                \
 				                   visit_cb,                                   \
 				                   absbase,                                    \
@@ -428,7 +425,6 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
 			ModifierData *md;
 			ParticleSystem *psys;
 
-
 			/* do via modifiers instead */
 #if 0
 			if (ob->fluidsimSettings) {
@@ -445,7 +441,7 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
 				}
 				else if (md->type == eModifierType_Smoke) {
 					SmokeModifierData *smd= (SmokeModifierData *)md;
-					if(smd->type & MOD_SMOKE_TYPE_DOMAIN) {
+					if (smd->type & MOD_SMOKE_TYPE_DOMAIN) {
 						BPATH_TRAVERSE_POINTCACHE(smd->domain->ptcaches[0]);
 					}
 				}
@@ -499,7 +495,7 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
 			Tex *tex = (Tex *)id;
 			if (tex->plugin) {
 				/* FIXME: rewrite_path assumes path length of FILE_MAX, but
-					   tex->plugin->name is 160. ... is this field even a path? */
+				 * tex->plugin->name is 160. ... is this field even a path? */
 				//rewrite_path(tex->plugin->name, visit_cb, bpath_user_data);
 			}
 			if (tex->type == TEX_VOXELDATA && TEX_VD_IS_SOURCE_PATH(tex->vd->file_format)) {
@@ -531,7 +527,7 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
 								len= MIN2(1, len);
 							}
 
-							for(i= 0; i < len; i++, se++) {
+							for (i= 0; i < len; i++, se++) {
 								rewrite_path_fixed_dirfile(seq->strip->dir, se->name,
 								                           visit_cb, absbase, bpath_user_data);
 							}
@@ -561,7 +557,7 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
 	case ID_LI:
 		{
 			Library *lib= (Library *)id;
-			if(rewrite_path_fixed(lib->name, visit_cb, absbase, bpath_user_data)) {
+			if (rewrite_path_fixed(lib->name, visit_cb, absbase, bpath_user_data)) {
 				BKE_library_filepath_set(lib, lib->name);
 			}
 		}
@@ -581,7 +577,7 @@ void bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int fla
 void bpath_traverse_id_list(Main *bmain, ListBase *lb, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
 {
 	ID *id;
-	for(id= lb->first; id; id= id->next) {
+	for (id = lb->first; id; id = id->next) {
 		bpath_traverse_id(bmain, id, visit_cb, flag, bpath_user_data);
 	}
 }
@@ -589,18 +585,20 @@ void bpath_traverse_id_list(Main *bmain, ListBase *lb, BPathVisitor visit_cb, co
 void bpath_traverse_main(Main *bmain, BPathVisitor visit_cb, const int flag, void *bpath_user_data)
 {
 	ListBase *lbarray[MAX_LIBARRAY];
-	int a= set_listbasepointers(bmain, lbarray);
-	while(a--) bpath_traverse_id_list(bmain, lbarray[a], visit_cb, flag, bpath_user_data);
+	int a = set_listbasepointers(bmain, lbarray);
+	while (a--) {
+		bpath_traverse_id_list(bmain, lbarray[a], visit_cb, flag, bpath_user_data);
+	}
 }
 
 /* Rewrites a relative path to be relative to the main file - unless the path is
-   absolute, in which case it is not altered. */
+ * absolute, in which case it is not altered. */
 int bpath_relocate_visitor(void *pathbase_v, char *path_dst, const char *path_src)
 {
 	/* be sure there is low chance of the path being too short */
 	char filepath[(FILE_MAXDIR * 2) + FILE_MAXFILE];
-	const char *base_new= ((char **)pathbase_v)[0];
-	const char *base_old= ((char **)pathbase_v)[1];
+	const char *base_new = ((char **)pathbase_v)[0];
+	const char *base_old = ((char **)pathbase_v)[1];
 
 	if (strncmp(base_old, "//", 2) == 0) {
 		printf("%s: error, old base path '%s' is not absolute.\n",
@@ -609,7 +607,7 @@ int bpath_relocate_visitor(void *pathbase_v, char *path_dst, const char *path_sr
 	}
 
 	/* Make referenced file absolute. This would be a side-effect of
-	   BLI_cleanup_file, but we do it explicitely so we know if it changed. */
+	 * BLI_cleanup_file, but we do it explicitly so we know if it changed. */
 	BLI_strncpy(filepath, path_src, FILE_MAX);
 	if (BLI_path_abs(filepath, base_old)) {
 		/* Path was relative and is now absolute. Remap.
diff --git a/source/blender/blenlib/intern/callbacks.c b/source/blender/blenlib/intern/callbacks.c
index 7e063bc..0cb986d 100644
--- a/source/blender/blenlib/intern/callbacks.c
+++ b/source/blender/blenlib/intern/callbacks.c
@@ -33,7 +33,7 @@ void BLI_exec_cb(struct Main *main, struct ID *self, eCbEvent evt)
 	ListBase *lb= &callback_slots[evt];
 	bCallbackFuncStore *funcstore;
 
-	for(funcstore= (bCallbackFuncStore *)lb->first; funcstore; funcstore= (bCallbackFuncStore *)funcstore->next) {
+	for (funcstore= (bCallbackFuncStore *)lb->first; funcstore; funcstore= (bCallbackFuncStore *)funcstore->next) {
 		funcstore->func(main, self, funcstore->arg);
 	}
 }
@@ -53,14 +53,14 @@ void BLI_cb_init(void)
 void BLI_cb_finalize(void)
 {
 	eCbEvent evt;
-	for(evt= 0; evt < BLI_CB_EVT_TOT; evt++) {
+	for (evt= 0; evt < BLI_CB_EVT_TOT; evt++) {
 		ListBase *lb= &callback_slots[evt];
 		bCallbackFuncStore *funcstore;
 		bCallbackFuncStore *funcstore_next;
-		for(funcstore= (bCallbackFuncStore *)lb->first; funcstore; funcstore= funcstore_next) {
+		for (funcstore= (bCallbackFuncStore *)lb->first; funcstore; funcstore= funcstore_next) {
 			funcstore_next= (bCallbackFuncStore *)funcstore->next;
 			BLI_remlink(lb, funcstore);
-			if(funcstore->alloc) {
+			if (funcstore->alloc) {
 				MEM_freeN(funcstore);
 			}
 		}
diff --git a/source/blender/blenlib/intern/dynamiclist.h b/source/blender/blenlib/intern/dynamiclist.h
deleted file mode 100644
index 83b5aac..0000000
--- a/source/blender/blenlib/intern/dynamiclist.h
+++ /dev/null
@@ -1,58 +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.
- *
- * Contributor(s): Jiri Hnidek.
- *
- * Documentation of Two way dynamic list with access array can be found at:
- *
- * http://wiki.blender.org/bin/view.pl/Blenderwiki/DynamicListWithAccessArray
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/blenlib/intern/dynamiclist.h
- *  \ingroup bli
- */
-
-
-#ifndef B_DYNAMIC_LIST_H
-#define B_DYNAMIC_LIST_H
-
-#define PAGE_SIZE 4
-
-struct ListBase;
-
-/*
- * Access array using realloc 
- */
-typedef struct DynamicArray{
-	unsigned int count;		/* count of items in list */
-	unsigned int max_item_index;	/* max available index */
-	unsigned int last_item_index;	/* max used index */
-	void **items;			/* dynamicaly allocated array of pointers
-					   pointing at items in list */
-} DynamicArray;
-
-/*
- * Two way dynamic list with access array
- */
-typedef struct DynamicList {
-	struct DynamicArray da;		/* access array */
-	struct ListBase lb;		/* two way linked dynamic list */
-} DynamicList;
-
-#endif
diff --git a/source/blender/blenlib/intern/dynlib.c b/source/blender/blenlib/intern/dynlib.c
index 0bfa5e7..e300d09 100644
--- a/source/blender/blenlib/intern/dynlib.c
+++ b/source/blender/blenlib/intern/dynlib.c
@@ -44,13 +44,19 @@ struct DynamicLibrary {
 #ifdef WIN32
 
 #include <windows.h>
+#include "utf_winfunc.h"
+#include "utfconv.h"
 
 DynamicLibrary *BLI_dynlib_open(char *name)
 {
 	DynamicLibrary *lib;
-	void *handle= LoadLibrary(name);
+	void *handle;
+
+	UTF16_ENCODE(name);
+	handle= LoadLibraryW(name_16);
+	UTF16_UN_ENCODE(name);
 
-	if(!handle)
+	if (!handle)
 		return NULL;
 
 	lib= MEM_callocN(sizeof(*lib), "Dynamic Library");
@@ -70,13 +76,13 @@ char *BLI_dynlib_get_error_as_string(DynamicLibrary *lib)
 
 	/* if lib is NULL reset the last error code */
 	err= GetLastError();
-	if(!lib)
+	if (!lib)
 		SetLastError(ERROR_SUCCESS);
 
-	if(err) {
+	if (err) {
 		static char buf[1024];
 
-		if(FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, 
+		if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, 
 			NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
 			buf, sizeof(buf), NULL))
 			return buf;
@@ -100,7 +106,7 @@ DynamicLibrary *BLI_dynlib_open(char *name)
 	DynamicLibrary *lib;
 	void *handle= dlopen(name, RTLD_LAZY);
 
-	if(!handle)
+	if (!handle)
 		return NULL;
 
 	lib= MEM_callocN(sizeof(*lib), "Dynamic Library");
diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c
index 97eb66e..531a4de 100644
--- a/source/blender/blenlib/intern/edgehash.c
+++ b/source/blender/blenlib/intern/edgehash.c
@@ -83,7 +83,7 @@ EdgeHash *BLI_edgehash_new(void)
 	eh->nbuckets = _ehash_hashsizes[eh->cursize];
 	
 	eh->buckets = MEM_callocN(eh->nbuckets * sizeof(*eh->buckets), "eh buckets 2");
-	eh->epool = BLI_mempool_create(sizeof(EdgeEntry), 512, 512, TRUE, FALSE);
+	eh->epool = BLI_mempool_create(sizeof(EdgeEntry), 512, 512, BLI_MEMPOOL_SYSMALLOC);
 
 	return eh;
 }
@@ -94,6 +94,9 @@ void BLI_edgehash_insert(EdgeHash *eh, unsigned int v0, unsigned int v1, void *v
 	unsigned int hash;
 	EdgeEntry *e = BLI_mempool_alloc(eh->epool);
 
+	/* this helps to track down errors with bad edge data */
+	BLI_assert(v0 != v1);
+
 	EDGE_ORD(v0, v1); /* ensure v0 is smaller */
 
 	hash = EDGE_HASH(v0, v1) % eh->nbuckets;
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c
index ad04780..4b5ea44 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -43,16 +43,22 @@
 
 #ifdef WIN32
 #include <io.h>
-#include "BLI_winstuff.h"
-#include "BLI_callbacks.h"
+#  include "BLI_winstuff.h"
+#  include "BLI_callbacks.h"
+#  include "utf_winfunc.h"
+#  include "utfconv.h"
 #else
-#include <unistd.h> // for read close
-#include <sys/param.h>
+#  include <unistd.h> // for read close
+#  include <sys/param.h>
+#  include <dirent.h>
+#  include <unistd.h>
+#  include <sys/stat.h>
 #endif
 
 #include "MEM_guardedalloc.h"
 
 #include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
 
 #include "BKE_utildefines.h"
 
@@ -60,9 +66,9 @@
 
 
 /* gzip the file in from and write it to "to". 
- return -1 if zlib fails, -2 if the originating file does not exist
- note: will remove the "from" file
-  */
+ * return -1 if zlib fails, -2 if the originating file does not exist
+ * note: will remove the "from" file
+ */
 int BLI_file_gzip(const char *from, const char *to)
 {
 	char buffer[10240];
@@ -73,26 +79,25 @@ int BLI_file_gzip(const char *from, const char *to)
 
 	/* level 1 is very close to 3 (the default) in terms of file size,
 	 * but about twice as fast, best use for speedy saving - campbell */
-	gzfile = gzopen(to, "wb1");
-	if(gzfile == NULL)
+	gzfile = BLI_gzopen(to, "wb1");
+	if (gzfile == NULL)
 		return -1;
-	
-	file = open(from, O_BINARY|O_RDONLY);
-	if(file < 0)
+	file = BLI_open(from, O_BINARY|O_RDONLY,0);
+	if (file < 0)
 		return -2;
 
-	while(1) {
+	while (1) {
 		readsize = read(file, buffer, sizeof(buffer));
 
-		if(readsize < 0) {
+		if (readsize < 0) {
 			rval= -2; /* error happened in reading */
 			fprintf(stderr, "Error reading file %s: %s.\n", from, strerror(errno));
 			break;
 		}
-		else if(readsize == 0)
+		else if (readsize == 0)
 			break; /* done reading */
 		
-		if(gzwrite(gzfile, buffer, readsize) <= 0) {
+		if (gzwrite(gzfile, buffer, readsize) <= 0) {
 			rval= -1; /* error happened in writing */
 			fprintf(stderr, "Error writing gz file %s: %s.\n", to, gzerror(gzfile, &err));
 			break;
@@ -106,8 +111,8 @@ int BLI_file_gzip(const char *from, const char *to)
 }
 
 /* gzip the file in from_file and write it to memery to_mem, at most size bytes.
-   return the unziped size
-  */
+ * return the unziped size
+ */
 char *BLI_file_ungzip_to_mem(const char *from_file, int *size_r)
 {
 	gzFile gzfile;
@@ -117,29 +122,29 @@ char *BLI_file_ungzip_to_mem(const char *from_file, int *size_r)
 
 	size= 0;
 
-	gzfile = gzopen( from_file, "rb" );
-
-	for(;;) {
-		if(mem==NULL) {
+	gzfile = BLI_gzopen( from_file, "rb" );
+	for (;;) {
+		if (mem==NULL) {
 			mem= MEM_callocN(chunk_size, "BLI_ungzip_to_mem");
 			alloc_size= chunk_size;
-		} else {
+		}
+		else {
 			mem= MEM_reallocN(mem, size+chunk_size);
 			alloc_size+= chunk_size;
 		}
 
 		readsize= gzread(gzfile, mem+size, chunk_size);
-		if(readsize>0) {
+		if (readsize>0) {
 			size+= readsize;
 		}
 		else break;
 	}
 
-	if(size==0) {
+	if (size==0) {
 		MEM_freeN(mem);
 		mem= NULL;
 	}
-	else if(alloc_size!=size)
+	else if (alloc_size!=size)
 		mem= MEM_reallocN(mem, size);
 
 	*size_r= size;
@@ -154,14 +159,14 @@ int BLI_file_is_writable(const char *filename)
 	int file;
 	
 	/* first try to open without creating */
-	file = open(filename, O_BINARY | O_RDWR, 0666);
+	file = BLI_open(filename, O_BINARY | O_RDWR, 0666);
 	
 	if (file < 0) {
 		/* now try to open and create. a test without actually
 		 * creating a file would be nice, but how? */
-		file = open(filename, O_BINARY | O_RDWR | O_CREAT, 0666);
+		file = BLI_open(filename, O_BINARY | O_RDWR | O_CREAT, 0666);
 		
-		if(file < 0) {
+		if (file < 0) {
 			return 0;
 		}
 		else {
@@ -179,13 +184,14 @@ int BLI_file_is_writable(const char *filename)
 
 int BLI_file_touch(const char *file)
 {
-	FILE *f = fopen(file,"r+b");
+	FILE *f = BLI_fopen(file, "r+b");
 	if (f != NULL) {
 		char c = getc(f);
 		rewind(f);
-		putc(c,f);
-	} else {
-		f = fopen(file,"wb");
+		putc(c, f);
+	}
+	else {
+		f = BLI_fopen(file, "wb");
 	}
 	if (f) {
 		fclose(f);
@@ -196,23 +202,71 @@ int BLI_file_touch(const char *file)
 
 #ifdef WIN32
 
-static char str[MAXPATHLEN+12];
+static char str[MAXPATHLEN + 12];
+
+FILE *BLI_fopen(const char *filename, const char *mode)
+{
+	return ufopen(filename, mode);
+}
+
+void *BLI_gzopen(const char *filename, const char *mode)
+{
+	gzFile gzfile;
+
+	if (!filename || !mode) {
+		return 0;
+	}
+	else {
+		wchar_t short_name_16[256];
+		char short_name[256];
+		int i = 0;
+
+		/* xxx Creates file before transcribing the path */
+		if (mode[0] == 'w')
+			fclose(ufopen(filename,"a"));
+
+		UTF16_ENCODE(filename);
+
+		GetShortPathNameW(filename_16,short_name_16, 256);
+
+		for (i = 0; i < 256; i++) {
+			short_name[i] = short_name_16[i];
+		}
+
+		gzfile = gzopen(short_name,mode);
+
+		UTF16_UN_ENCODE(filename);
+	}
+
+	return gzfile;
+}
+
+int   BLI_open(const char *filename, int oflag, int pmode)
+{
+	return uopen(filename, oflag, pmode);
+}
 
 int BLI_delete(const char *file, int dir, int recursive)
 {
 	int err;
+	
+	UTF16_ENCODE(file);
 
 	if (recursive) {
 		callLocalErrorCallBack("Recursive delete is unsupported on Windows");
 		err= 1;
-	} else if (dir) {
-		err= !RemoveDirectory(file);
+	}
+	else if (dir) {
+		err= !RemoveDirectoryW(file_16);
 		if (err) printf ("Unable to remove directory");
-	} else {
-		err= !DeleteFile(file);
+	}
+	else {
+		err= !DeleteFileW(file_16);
 		if (err) callLocalErrorCallBack("Unable to delete file");
 	}
 
+	UTF16_UN_ENCODE(file);
+
 	return err;
 }
 
@@ -231,8 +285,13 @@ int BLI_move(const char *file, const char *to)
 			strcat(str, BLI_last_slash(file) + 1);
 		}
 	}
+	
+	UTF16_ENCODE(file);
+	UTF16_ENCODE(str);
+	err= !MoveFileW(file_16, str_16);
+	UTF16_UN_ENCODE(str);
+	UTF16_UN_ENCODE(file);
 
-	err= !MoveFile(file, str);
 	if (err) {
 		callLocalErrorCallBack("Unable to move file");
 		printf(" Move from '%s' to '%s' failed\n", file, str);
@@ -258,8 +317,12 @@ int BLI_copy(const char *file, const char *to)
 		}
 	}
 
-	err= !CopyFile(file,str,FALSE);
-	
+	UTF16_ENCODE(file);
+	UTF16_ENCODE(str);
+	err = !CopyFileW(file_16, str_16, FALSE);
+	UTF16_UN_ENCODE(str);
+	UTF16_UN_ENCODE(file);
+
 	if (err) {
 		callLocalErrorCallBack("Unable to copy file!");
 		printf(" Copy from '%s' to '%s' failed\n", file, str);
@@ -281,30 +344,30 @@ void BLI_dir_create_recursive(const char *dirname)
 	char *lslash;
 	char tmp[MAXPATHLEN];
 	
-	// First remove possible slash at the end of the dirname.
-	// This routine otherwise tries to create
-	// blah1/blah2/ (with slash) after creating
-	// blah1/blah2 (without slash)
+	/* First remove possible slash at the end of the dirname.
+	 * This routine otherwise tries to create
+	 * blah1/blah2/ (with slash) after creating
+	 * blah1/blah2 (without slash) */
 
 	BLI_strncpy(tmp, dirname, sizeof(tmp));
 	lslash= BLI_last_slash(tmp);
-
+	
 	if (lslash == tmp + strlen(tmp) - 1) {
 		*lslash = 0;
 	}
 	
 	if (BLI_exists(tmp)) return;
-		
+
 	lslash= BLI_last_slash(tmp);
 	if (lslash) {
-			/* Split about the last slash and recurse */	
+		/* Split about the last slash and recurse */
 		*lslash = 0;
 		BLI_dir_create_recursive(tmp);
 	}
 	
-	if(dirname[0]) /* patch, this recursive loop tries to create a nameless directory */
-		if (!CreateDirectory(dirname, NULL))
-			callLocalErrorCallBack("Unable to create directory\n");
+	if (dirname[0]) /* patch, this recursive loop tries to create a nameless directory */
+		if (umkdir(dirname)==-1)
+			printf("Unable to create directory %s\n",dirname);
 }
 
 int BLI_rename(const char *from, const char *to)
@@ -313,33 +376,214 @@ int BLI_rename(const char *from, const char *to)
 
 	/* make sure the filenames are different (case insensitive) before removing */
 	if (BLI_exists(to) && BLI_strcasecmp(from, to))
-		if(BLI_delete(to, 0, 0)) return 1;
-
-	return rename(from, to);
+		if (BLI_delete(to, 0, 0)) return 1;
+	
+	return urename(from, to);
 }
 
 #else /* The UNIX world */
 
-/*
- * but the UNIX world is tied to the interface, and the system
- * timer, and... We implement a callback mechanism. The system will
- * have to initialise the callback before the functions will work!
- * */
-static char str[12 + (MAXPATHLEN * 2)];
+enum {
+	/* operation succeeded succeeded */
+	recursiveOp_Callback_OK = 0,
+
+	/* operation requested not to perform recursive digging for current path */
+	recursiveOp_Callback_StopRecurs = 1,
+
+	/* error occured in callback and recursive walking should stop immediately */
+	recursiveOp_Callback_Error = 2
+} recuresiveOp_Callback_Result;
+
+typedef int (*recursiveOp_Callback) (const char *from, const char *to);
+
+/* appending of filename to dir (ensures for buffer size before appending) */
+static void join_dirfile_alloc(char **dst, size_t *alloc_len, const char *dir, const char *file)
+{
+	size_t len = strlen(dir) + strlen(file) + 1;
+
+	if (!*dst)
+		*dst = MEM_callocN(len + 1, "join_dirfile_alloc path");
+	else if (*alloc_len < len)
+		*dst = MEM_reallocN(*dst, len + 1);
+
+	*alloc_len = len;
+
+	BLI_join_dirfile(*dst, len + 1, dir, file);
+}
+
+static char *strip_last_slash(const char *dir)
+{
+	char *result = BLI_strdup(dir);
+	BLI_del_slash(result);
+
+	return result;
+}
+
+static int recursive_operation(const char *startfrom, const char *startto, recursiveOp_Callback callback_dir_pre,
+                               recursiveOp_Callback callback_file, recursiveOp_Callback callback_dir_post)
+{
+	struct dirent **dirlist;
+	struct stat st;
+	char *from = NULL, *to = NULL;
+	char *from_path = NULL, *to_path = NULL;
+	size_t from_alloc_len = -1, to_alloc_len = -1;
+	int i, n, ret = 0;
+
+	/* ensure there's no trailing slash in file path */
+	from = strip_last_slash(startfrom);
+	if (startto)
+		to = strip_last_slash(startto);
+
+	ret = lstat(from, &st);
+	if (ret < 0) {
+		/* source wasn't found, nothing to operate with */
+		return ret;
+	}
+
+	if (!S_ISDIR(st.st_mode)) {
+		/* source isn't a directory, can't do recursive walking for it,
+		 * so just call file callback and leave */
+		if (callback_file) {
+			ret = callback_file(from, to);
+
+			if (ret != recursiveOp_Callback_OK)
+				ret = -1;
+		}
+
+		MEM_freeN(from);
+		if (to) MEM_freeN(to);
+
+		return ret;
+	}
+
+
+	n = scandir(startfrom, &dirlist, 0, alphasort);
+	if (n < 0) {
+		/* error opening directory for listing */
+		perror("scandir");
+
+		MEM_freeN(from);
+		if (to) MEM_freeN(to);
+
+		return -1;
+	}
+
+	if (callback_dir_pre) {
+		/* call pre-recursive walking directory callback */
+		ret = callback_dir_pre(from, to);
+
+		if (ret != recursiveOp_Callback_OK) {
+			MEM_freeN(from);
+			if (to) free(to);
+
+			if (ret == recursiveOp_Callback_StopRecurs) {
+				/* callback requested not to perform recursive walking, not an error */
+				return 0;
+			}
+
+			return -1;
+		}
+	}
+
+	for (i = 0; i < n; i++) {
+		struct dirent *dirent = dirlist[i];
+
+		if (!strcmp(dirent->d_name, ".") || !strcmp(dirent->d_name, "..")) {
+			free(dirent);
+			continue;
+		}
+
+		join_dirfile_alloc(&from_path, &from_alloc_len, from, dirent->d_name);
+
+		if (to)
+			join_dirfile_alloc(&to_path, &to_alloc_len, to, dirent->d_name);
+
+		if (dirent->d_type == DT_DIR) {
+			/* recursively dig into a folder */
+			ret = recursive_operation(from_path, to_path, callback_dir_pre, callback_file, callback_dir_post);
+		}
+		else if (callback_file) {
+			/* call file callback for current path */
+			ret = callback_file(from_path, to_path);
+			if (ret != recursiveOp_Callback_OK)
+				ret = -1;
+		}
+
+		if (ret != 0) {
+			while (i < n)
+				free(dirlist[i]);
+			break;
+		}
+	}
+
+	free(dirlist);
+
+	if (ret == 0) {
+		if (callback_dir_post) {
+			/* call post-recursive directory callback */
+			ret = callback_dir_post(from, to);
+			if (ret != recursiveOp_Callback_OK)
+				ret = -1;
+		}
+	}
+
+	if (from_path) MEM_freeN(from_path);
+	if (to_path) MEM_freeN(to_path);
+
+	MEM_freeN(from);
+	if (to) MEM_freeN(to);
+
+	return ret;
+}
+
+static int delete_callback_post(const char *from, const char *UNUSED(to))
+{
+	if (rmdir(from)) {
+		perror("rmdir");
+
+		return recursiveOp_Callback_Error;
+	}
+
+	return recursiveOp_Callback_OK;
+}
+
+static int delete_single_file(const char *from, const char *UNUSED(to))
+{
+	if (unlink(from)) {
+		perror("unlink");
+
+		return recursiveOp_Callback_Error;
+	}
+
+	return recursiveOp_Callback_OK;
+}
+
+FILE *BLI_fopen(const char *filename, const char *mode)
+{
+	return fopen(filename, mode);
+}
+
+void *BLI_gzopen(const char *filename, const char *mode)
+{
+	return gzopen(filename, mode);
+}
+
+int BLI_open(const char *filename, int oflag, int pmode)
+{
+	return open(filename, oflag, pmode);
+}
 
 int BLI_delete(const char *file, int dir, int recursive) 
 {
-	if(strchr(file, '"')) {
+	if (strchr(file, '"')) {
 		printf("Error: not deleted file %s because of quote!\n", file);
 	}
 	else {
 		if (recursive) {
-			BLI_snprintf(str, sizeof(str), "/bin/rm -rf \"%s\"", file);
-			return system(str);
+			return recursive_operation(file, NULL, NULL, delete_single_file, delete_callback_post);
 		}
 		else if (dir) {
-			BLI_snprintf(str, sizeof(str), "/bin/rmdir \"%s\"", file);
-			return system(str);
+			return rmdir(file);
 		}
 		else {
 			return remove(file); //BLI_snprintf(str, sizeof(str), "/bin/rm -f \"%s\"", file);
@@ -348,35 +592,272 @@ int BLI_delete(const char *file, int dir, int recursive)
 	return -1;
 }
 
+static int check_the_same(const char *path_a, const char *path_b)
+{
+	struct stat st_a, st_b;
+
+	if (lstat(path_a, &st_a))
+		return 0;
+
+	if (lstat(path_b, &st_b))
+		return 0;
+
+	return st_a.st_dev == st_b.st_dev && st_a.st_ino == st_b.st_ino;
+}
+
+static int set_permissions(const char *file, struct stat *st)
+{
+	if (chown(file, st->st_uid, st->st_gid)) {
+		perror("chown");
+		return -1;
+	}
+
+	if (chmod(file, st->st_mode)) {
+		perror("chmod");
+		return -1;
+	}
+
+	return 0;
+}
+
+/* pre-recursive callback for copying operation
+ * creates a destination directory where all source content fill be copied to */
+static int copy_callback_pre(const char *from, const char *to)
+{
+	struct stat st;
+
+	if (check_the_same(from, to)) {
+		fprintf(stderr, "%s: '%s' is the same as '%s'\n", __func__, from, to);
+		return recursiveOp_Callback_Error;
+	}
+
+	if (lstat(from, &st)) {
+		perror("stat");
+		return recursiveOp_Callback_Error;
+	}
+
+	/* create a directory */
+	if (mkdir(to, st.st_mode)) {
+		perror("mkdir");
+		return recursiveOp_Callback_Error;
+	}
+
+	/* set proper owner and group on new directory */
+	if (chown(to, st.st_uid, st.st_gid)) {
+		perror("chown");
+		return recursiveOp_Callback_Error;
+	}
+
+	return recursiveOp_Callback_OK;
+}
+
+static int copy_single_file(const char *from, const char *to)
+{
+	FILE *from_stream, *to_stream;
+	struct stat st;
+	char buf[4096];
+	size_t len;
+
+	if (check_the_same(from, to)) {
+		fprintf(stderr, "%s: '%s' is the same as '%s'\n", __func__, from, to);
+		return recursiveOp_Callback_Error;
+	}
+
+	if (lstat(from, &st)) {
+		perror("lstat");
+		return recursiveOp_Callback_Error;
+	}
+
+	if (S_ISLNK(st.st_mode)) {
+		/* symbolic links should be copied in special way */
+		char *link_buffer;
+		int need_free;
+		ssize_t link_len;
+
+		/* get large enough buffer to read link content */
+		if (st.st_size < sizeof(buf)) {
+			link_buffer = buf;
+			need_free = 0;
+		}
+		else {
+			link_buffer = MEM_callocN(st.st_size+2, "copy_single_file link_buffer");
+			need_free = 1;
+		}
+
+		link_len = readlink(from, link_buffer, st.st_size+1);
+		if (link_len < 0) {
+			perror("readlink");
+
+			if (need_free) MEM_freeN(link_buffer);
+
+			return recursiveOp_Callback_Error;
+		}
+
+		link_buffer[link_len] = 0;
+
+		if (symlink(link_buffer, to)) {
+			perror("symlink");
+			if (need_free) MEM_freeN(link_buffer);
+			return recursiveOp_Callback_Error;
+		}
+
+		if (need_free)
+			MEM_freeN(link_buffer);
+
+		return recursiveOp_Callback_OK;
+	}
+	else if (S_ISCHR (st.st_mode) ||
+	        S_ISBLK (st.st_mode) ||
+	        S_ISFIFO (st.st_mode) ||
+	        S_ISSOCK (st.st_mode))
+	{
+		/* copy special type of file */
+		if (mknod(to, st.st_mode, st.st_rdev)) {
+			perror("mknod");
+			return recursiveOp_Callback_Error;
+		}
+
+		if (set_permissions(to, &st))
+			return recursiveOp_Callback_Error;
+
+		return recursiveOp_Callback_OK;
+	}
+	else if (!S_ISREG(st.st_mode)) {
+		fprintf(stderr, "Copying of this kind of files isn't supported yet\n");
+		return recursiveOp_Callback_Error;
+	}
+
+	from_stream = fopen(from, "rb");
+	if (!from_stream) {
+		perror("fopen");
+		return recursiveOp_Callback_Error;
+	}
+
+	to_stream = fopen(to, "wb");
+	if (!to_stream) {
+		perror("fopen");
+		fclose(from_stream);
+		return recursiveOp_Callback_Error;
+	}
+
+	while ((len = fread(buf, 1, sizeof(buf), from_stream)) > 0) {
+		fwrite(buf, 1, len, to_stream);
+	}
+
+	fclose(to_stream);
+	fclose(from_stream);
+
+	if (set_permissions(to, &st))
+		return recursiveOp_Callback_Error;
+
+	return recursiveOp_Callback_OK;
+}
+
+static int move_callback_pre(const char *from, const char *to)
+{
+	int ret = rename(from, to);
+
+	if (ret)
+		return copy_callback_pre(from, to);
+
+	return recursiveOp_Callback_StopRecurs;
+}
+
+static int move_single_file(const char *from, const char *to)
+{
+	int ret = rename(from, to);
+
+	if (ret)
+		return copy_single_file(from, to);
+
+	return recursiveOp_Callback_OK;
+}
+
 int BLI_move(const char *file, const char *to)
 {
-	BLI_snprintf(str, sizeof(str), "/bin/mv -f \"%s\" \"%s\"", file, to);
+	int ret = recursive_operation(file, to, move_callback_pre, move_single_file, NULL);
 
-	return system(str);
+	if (ret) {
+		return recursive_operation(file, NULL, NULL, delete_single_file, delete_callback_post);
+	}
+
+	return ret;
+}
+
+static char *check_destination(const char *file, const char *to)
+{
+	struct stat st;
+
+	if (!stat(to, &st)) {
+		if (S_ISDIR(st.st_mode)) {
+			char *str, *filename, *path;
+			size_t len = 0;
+
+			str = strip_last_slash(file);
+			filename = BLI_last_slash(str);
+
+			if (!filename) {
+				MEM_freeN(str);
+				return (char*)to;
+			}
+
+			/* skip slash */
+			filename += 1;
+
+			len = strlen(to) + strlen(filename) + 1;
+			path = MEM_callocN(len + 1, "check_destination path");
+			BLI_join_dirfile(path, len + 1, to, filename);
+
+			MEM_freeN(str);
+
+			return path;
+		}
+	}
+
+	return (char*)to;
 }
 
 int BLI_copy(const char *file, const char *to)
 {
-	BLI_snprintf(str, sizeof(str), "/bin/cp -rf \"%s\" \"%s\"", file, to);
+	char *actual_to = check_destination(file, to);
+	int ret;
+
+	ret = recursive_operation(file, actual_to, copy_callback_pre, copy_single_file, NULL);
 
-	return system(str);
+	if (actual_to!=to)
+		MEM_freeN(actual_to);
+
+	return ret;
 }
 
 int BLI_create_symlink(const char *file, const char *to)
 {
-	BLI_snprintf(str, sizeof(str), "/bin/ln -f \"%s\" \"%s\"", file, to);
-	
-	return system(str);
+	return symlink(to, file);
 }
 
 void BLI_dir_create_recursive(const char *dirname)
 {
 	char *lslash;
-	char tmp[MAXPATHLEN];
-		
+	size_t size;
+#ifdef MAXPATHLEN
+	char static_buf[MAXPATHLEN];
+#endif
+	char *tmp;
+	int needs_free;
+
 	if (BLI_exists(dirname)) return;
 
-	BLI_strncpy(tmp, dirname, sizeof(tmp));
+#ifdef MAXPATHLEN
+	size = MAXPATHLEN;
+	tmp = static_buf;
+	needs_free = 0;
+#else
+	size = strlen(dirname)+1;
+	tmp = MEM_callocN(size, "BLI_dir_create_recursive tmp");
+	needs_free = 1;
+#endif
+
+	BLI_strncpy(tmp, dirname, size);
 		
 	lslash= BLI_last_slash(tmp);
 	if (lslash) {
@@ -385,6 +866,9 @@ void BLI_dir_create_recursive(const char *dirname)
 		BLI_dir_create_recursive(tmp);
 	}
 
+	if (needs_free)
+		MEM_freeN(tmp);
+
 	mkdir(dirname, 0777);
 }
 
@@ -392,7 +876,8 @@ int BLI_rename(const char *from, const char *to)
 {
 	if (!BLI_exists(from)) return 0;
 	
-	if (BLI_exists(to))	if(BLI_delete(to, 0, 0)) return 1;
+	if (BLI_exists(to))
+		if (BLI_delete(to, 0, 0)) return 1;
 
 	return rename(from, to);
 }
diff --git a/source/blender/blenlib/intern/fnmatch.c b/source/blender/blenlib/intern/fnmatch.c
index ae04075..5317295 100644
--- a/source/blender/blenlib/intern/fnmatch.c
+++ b/source/blender/blenlib/intern/fnmatch.c
@@ -30,12 +30,12 @@
 
 
 /* Comment out all this code if we are using the GNU C Library, and are not
-   actually compiling the library itself.  This code is part of the GNU C
-   Library, but also included in many other GNU distributions.  Compiling
-   and linking in this code is a waste when using the GNU C library
-   (especially if it is a shared library).  Rather than having every GNU
-   program understand `configure --with-gnu-libc' and omit the object files,
-   it is simpler to just do this in the source for each such file.  */
+ * actually compiling the library itself.  This code is part of the GNU C
+ * Library, but also included in many other GNU distributions.  Compiling
+ * and linking in this code is a waste when using the GNU C library
+ * (especially if it is a shared library).  Rather than having every GNU
+ * program understand `configure --with-gnu-libc' and omit the object files,
+ * it is simpler to just do this in the source for each such file. */
 
 #if defined _LIBC || !defined __GNU_LIBRARY__
 
diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c
index 8f6100f..a9a1f2b 100644
--- a/source/blender/blenlib/intern/freetypefont.c
+++ b/source/blender/blenlib/intern/freetypefont.c
@@ -86,7 +86,7 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
 	
 	// adjust font size
 	height= ((double) face->bbox.yMax - (double) face->bbox.yMin);
-	if(height != 0.0f)
+	if (height != 0.0f)
 		scale = 1.0f / height;
 	else
 		scale = 1.0f / 1000.0f;
@@ -99,8 +99,7 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
 	err= FT_Load_Glyph(face, glyph_index, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP);
 	
 	// If loading succeeded, convert the FT glyph to the internal format
-	if(!err)
-	{
+	if (!err) {
 		int *npoints;
 		int *onpoints;
 		
@@ -117,36 +116,36 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
 		che->width= glyph->advance.x * scale;
 		
 		// Start converting the FT data
-		npoints = (int *)MEM_callocN((ftoutline.n_contours)* sizeof(int),"endpoints") ;
-		onpoints = (int *)MEM_callocN((ftoutline.n_contours)* sizeof(int),"onpoints") ;
+		npoints = (int *)MEM_callocN((ftoutline.n_contours) * sizeof(int),"endpoints");
+		onpoints = (int *)MEM_callocN((ftoutline.n_contours) * sizeof(int),"onpoints");
 
 		// calculate total points of each contour
-		for(j = 0; j < ftoutline.n_contours; j++) {
-			if(j == 0)
+		for (j = 0; j < ftoutline.n_contours; j++) {
+			if (j == 0)
 				npoints[j] = ftoutline.contours[j] + 1;
 			else
 				npoints[j] = ftoutline.contours[j] - ftoutline.contours[j - 1];
 		}
 
 		// get number of on-curve points for beziertriples (including conic virtual on-points) 
-		for(j = 0; j < ftoutline.n_contours; j++) {
-			for(k = 0; k < npoints[j]; k++) {
-				if(j > 0) l = k + ftoutline.contours[j - 1] + 1; else l = k;
-					if(ftoutline.tags[l] == FT_Curve_Tag_On)
+		for (j = 0; j < ftoutline.n_contours; j++) {
+			for (k = 0; k < npoints[j]; k++) {
+				if (j > 0) l = k + ftoutline.contours[j - 1] + 1; else l = k;
+					if (ftoutline.tags[l] == FT_Curve_Tag_On)
 						onpoints[j]++;
 
-				if(k < npoints[j] - 1 )
-					if( ftoutline.tags[l]   == FT_Curve_Tag_Conic &&
+				if (k < npoints[j] - 1 )
+					if ( ftoutline.tags[l]   == FT_Curve_Tag_Conic &&
 						ftoutline.tags[l+1] == FT_Curve_Tag_Conic)
 						onpoints[j]++;
 			}
 		}
 
 		//contour loop, bezier & conic styles merged
-		for(j = 0; j < ftoutline.n_contours; j++) {
+		for (j = 0; j < ftoutline.n_contours; j++) {
 			// add new curve
-			nu  =  (Nurb*)MEM_callocN(sizeof(struct Nurb),"objfnt_nurb");
-			bezt = (BezTriple*)MEM_callocN((onpoints[j])* sizeof(BezTriple),"objfnt_bezt") ;
+			nu  =  (Nurb *)MEM_callocN(sizeof(struct Nurb), "objfnt_nurb");
+			bezt = (BezTriple *)MEM_callocN((onpoints[j]) * sizeof(BezTriple), "objfnt_bezt");
 			BLI_addtail(&che->nurbsbase, nu);
 
 			nu->type= CU_BEZIER;
@@ -157,14 +156,13 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
 			nu->bezt = bezt;
 
 			//individual curve loop, start-end
-			for(k = 0; k < npoints[j]; k++) {
-				if(j > 0) l = k + ftoutline.contours[j - 1] + 1; else l = k;
-				if(k == 0) m = l;
+			for (k = 0; k < npoints[j]; k++) {
+				if (j > 0) l = k + ftoutline.contours[j - 1] + 1; else l = k;
+				if (k == 0) m = l;
 					
 				//virtual conic on-curve points
-				if(k < npoints[j] - 1 )
-				{
-					if( ftoutline.tags[l] == FT_Curve_Tag_Conic && ftoutline.tags[l+1] == FT_Curve_Tag_Conic) {
+				if (k < npoints[j] - 1) {
+					if (ftoutline.tags[l] == FT_Curve_Tag_Conic && ftoutline.tags[l+1] == FT_Curve_Tag_Conic) {
 						dx = (ftoutline.points[l].x + ftoutline.points[l+1].x)* scale / 2.0f;
 						dy = (ftoutline.points[l].y + ftoutline.points[l+1].y)* scale / 2.0f;
 
@@ -187,32 +185,37 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
 				}
 
 				//on-curve points
-				if(ftoutline.tags[l] == FT_Curve_Tag_On) {
+				if (ftoutline.tags[l] == FT_Curve_Tag_On) {
 					//left handle
-					if(k > 0) {
-						if(ftoutline.tags[l - 1] == FT_Curve_Tag_Cubic) {
+					if (k > 0) {
+						if (ftoutline.tags[l - 1] == FT_Curve_Tag_Cubic) {
 							bezt->vec[0][0] = ftoutline.points[l-1].x* scale;
 							bezt->vec[0][1] = ftoutline.points[l-1].y* scale;
 							bezt->h1= HD_FREE;
-						} else if(ftoutline.tags[l - 1] == FT_Curve_Tag_Conic) {
+						}
+						else if (ftoutline.tags[l - 1] == FT_Curve_Tag_Conic) {
 							bezt->vec[0][0] = (ftoutline.points[l].x + (2 * ftoutline.points[l - 1].x))* scale / 3.0f;
 							bezt->vec[0][1] = (ftoutline.points[l].y + (2 * ftoutline.points[l - 1].y))* scale / 3.0f;
 							bezt->h1= HD_FREE;
-						} else {
+						}
+						else {
 							bezt->vec[0][0] = ftoutline.points[l].x* scale - (ftoutline.points[l].x - ftoutline.points[l-1].x)* scale / 3.0f;
 							bezt->vec[0][1] = ftoutline.points[l].y* scale - (ftoutline.points[l].y - ftoutline.points[l-1].y)* scale / 3.0f;
 							bezt->h1= HD_VECT;
 						}
-					} else { //first point on curve
-						if(ftoutline.tags[ftoutline.contours[j]] == FT_Curve_Tag_Cubic) {
+					}
+					else { //first point on curve
+						if (ftoutline.tags[ftoutline.contours[j]] == FT_Curve_Tag_Cubic) {
 							bezt->vec[0][0] = ftoutline.points[ftoutline.contours[j]].x * scale;
 							bezt->vec[0][1] = ftoutline.points[ftoutline.contours[j]].y * scale;
 							bezt->h1= HD_FREE;
-						} else if(ftoutline.tags[ftoutline.contours[j]] == FT_Curve_Tag_Conic) {
+						}
+						else if (ftoutline.tags[ftoutline.contours[j]] == FT_Curve_Tag_Conic) {
 							bezt->vec[0][0] = (ftoutline.points[l].x + (2 * ftoutline.points[ftoutline.contours[j]].x))* scale / 3.0f;
 							bezt->vec[0][1] = (ftoutline.points[l].y + (2 * ftoutline.points[ftoutline.contours[j]].y))* scale / 3.0f;
 							bezt->h1= HD_FREE;
-						} else {
+						}
+						else {
 							bezt->vec[0][0] = ftoutline.points[l].x* scale - (ftoutline.points[l].x - ftoutline.points[ftoutline.contours[j]].x)* scale / 3.0f;
 							bezt->vec[0][1] = ftoutline.points[l].y* scale - (ftoutline.points[l].y - ftoutline.points[ftoutline.contours[j]].y)* scale / 3.0f;
 							bezt->h1= HD_VECT;
@@ -224,30 +227,35 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
 					bezt->vec[1][1] = ftoutline.points[l].y* scale;
 
 					//right handle
-					if(k < (npoints[j] - 1)) {
-						if(ftoutline.tags[l+1] == FT_Curve_Tag_Cubic) {
+					if (k < (npoints[j] - 1)) {
+						if (ftoutline.tags[l+1] == FT_Curve_Tag_Cubic) {
 							bezt->vec[2][0] = ftoutline.points[l+1].x* scale;
 							bezt->vec[2][1] = ftoutline.points[l+1].y* scale;
 							bezt->h2= HD_FREE;
-						} else if(ftoutline.tags[l+1] == FT_Curve_Tag_Conic) {
+						}
+						else if (ftoutline.tags[l+1] == FT_Curve_Tag_Conic) {
 							bezt->vec[2][0] = (ftoutline.points[l].x + (2 * ftoutline.points[l+1].x))* scale / 3.0f;
 							bezt->vec[2][1] = (ftoutline.points[l].y + (2 * ftoutline.points[l+1].y))* scale / 3.0f;
 							bezt->h2= HD_FREE;
-						} else {
+						}
+						else {
 							bezt->vec[2][0] = ftoutline.points[l].x* scale - (ftoutline.points[l].x - ftoutline.points[l+1].x)* scale / 3.0f;
 							bezt->vec[2][1] = ftoutline.points[l].y* scale - (ftoutline.points[l].y - ftoutline.points[l+1].y)* scale / 3.0f;
 							bezt->h2= HD_VECT;
 						}
-					} else { //last point on curve
-						if(ftoutline.tags[m] == FT_Curve_Tag_Cubic) {
+					}
+					else { //last point on curve
+						if (ftoutline.tags[m] == FT_Curve_Tag_Cubic) {
 							bezt->vec[2][0] = ftoutline.points[m].x* scale;
 							bezt->vec[2][1] = ftoutline.points[m].y* scale;
 							bezt->h2= HD_FREE;
-						} else if(ftoutline.tags[m] == FT_Curve_Tag_Conic) {
+						}
+						else if (ftoutline.tags[m] == FT_Curve_Tag_Conic) {
 							bezt->vec[2][0] = (ftoutline.points[l].x + (2 * ftoutline.points[m].x))* scale / 3.0f;
 							bezt->vec[2][1] = (ftoutline.points[l].y + (2 * ftoutline.points[m].y))* scale / 3.0f;
 							bezt->h2= HD_FREE;
-						} else {
+						}
+						else {
 							bezt->vec[2][0] = ftoutline.points[l].x* scale - (ftoutline.points[l].x - ftoutline.points[m].x)* scale / 3.0f;
 							bezt->vec[2][1] = ftoutline.points[l].y* scale - (ftoutline.points[l].y - ftoutline.points[m].y)* scale / 3.0f;
 							bezt->h2= HD_VECT;
@@ -259,7 +267,7 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
 					// len_squared_v2v2, see if there's a distance between the three points
 					// len_squared_v2v2 again, to check the angle between the handles 
 					// finally, check if one of them is a vector handle 
-					if((dist_to_line_v2(bezt->vec[0],bezt->vec[1],bezt->vec[2]) < 0.001f) &&
+					if ((dist_to_line_v2(bezt->vec[0],bezt->vec[1],bezt->vec[2]) < 0.001f) &&
 						(len_squared_v2v2(bezt->vec[0], bezt->vec[1]) > 0.0001f*0.0001f) &&
 						(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) &&
@@ -273,8 +281,8 @@ static void freetypechar_to_vchar(FT_Face face, FT_ULong charcode, VFontData *vf
 				}
 			}
 		}
-		if(npoints) MEM_freeN(npoints);
-		if(onpoints) MEM_freeN(onpoints);	
+		if (npoints) MEM_freeN(npoints);
+		if (onpoints) MEM_freeN(onpoints);	
 	}
 }
 
@@ -288,11 +296,10 @@ static int objchr_to_ftvfontdata(VFont *vfont, FT_ULong charcode)
 	tf= vfont_find_tmpfont(vfont);
 	
 	// What, no font found. Something strange here
-	if(!tf) return FALSE;
+	if (!tf) return FALSE;
 	
 	// Load the font to memory
-	if(tf->pf)
-	{
+	if (tf->pf) {
 		err= FT_New_Memory_Face( library,
 			tf->pf->data,
 			tf->pf->size,
@@ -322,13 +329,13 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf)
 	const char *fontname;
 	VFontData *vfd;
 
-/*
+#if 0
 	FT_CharMap  found = 0;
 	FT_CharMap  charmap;
 	FT_UShort my_platform_id = TT_PLATFORM_MICROSOFT;
 	FT_UShort my_encoding_id = TT_MS_ID_UNICODE_CS;
 	int         n;
-*/
+#endif
 
 	// load the freetype font
 	err = FT_New_Memory_Face( library,
@@ -337,8 +344,9 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf)
 						0,
 						&face );
 
-	if(err) return NULL;
-/*
+	if (err) return NULL;
+
+#if 0
 	for ( n = 0; n < face->num_charmaps; n++ )
 	{
 		charmap = face->charmaps[n];
@@ -355,7 +363,7 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf)
 	// now, select the charmap for the face object
 	err = FT_Set_Charmap( face, found );
 	if ( err ) { return NULL; }
-*/
+#endif
 
 	// allocate blender font
 	vfd= MEM_callocN(sizeof(*vfd), "FTVFontData");
@@ -368,17 +376,14 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf)
 	lcode= charcode= FT_Get_First_Char(face, &glyph_index);
 
 	// No charmap found from the ttf so we need to figure it out
-	if(glyph_index == 0)
-	{
+	if (glyph_index == 0) {
 		FT_CharMap  found = NULL;
 		FT_CharMap  charmap;
 		int n;
 
-		for ( n = 0; n < face->num_charmaps; n++ )
-		{
+		for (n = 0; n < face->num_charmaps; n++) {
 			charmap = face->charmaps[n];
-			if (charmap->encoding == FT_ENCODING_APPLE_ROMAN)
-			{
+			if (charmap->encoding == FT_ENCODING_APPLE_ROMAN) {
 				found = charmap;
 				break;
 			}
@@ -386,14 +391,14 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf)
 
 		err = FT_Set_Charmap( face, found );
 
-		if( err ) 
+		if ( err ) 
 			return NULL;
 
 		lcode= charcode= FT_Get_First_Char(face, &glyph_index);
 	}
 
 	// Load characters
-	while(charcode < 256)
+	while (charcode < 256)
 	{
 		// Generate the font data
 		freetypechar_to_vchar(face, charcode, vfd);
@@ -402,7 +407,7 @@ static VFontData *objfnt_to_ftvfontdata(PackedFile * pf)
 		charcode = FT_Get_Next_Char(face, charcode, &glyph_index);
 
 		// Check that we won't start infinite loop
-		if(charcode <= lcode)
+		if (charcode <= lcode)
 			break;
 		lcode = charcode;
 	}
@@ -416,13 +421,13 @@ static int check_freetypefont(PackedFile * pf)
 	FT_Face			face;
 	FT_GlyphSlot	glyph;
 	FT_UInt			glyph_index;
-/*
+#if 0
 	FT_CharMap  charmap;
 	FT_CharMap  found;
 	FT_UShort my_platform_id = TT_PLATFORM_MICROSOFT;
 	FT_UShort my_encoding_id = TT_MS_ID_UNICODE_CS;
 	int         n;
-*/
+#endif
 	int success = 0;
 
 	err = FT_New_Memory_Face( library,
@@ -430,37 +435,37 @@ static int check_freetypefont(PackedFile * pf)
 							pf->size,
 							0,
 							&face );
-	if(err) {
+	if (err) {
 		success = 0;
 		//XXX error("This is not a valid font");
 	}
 	else {
-/*
-		for ( n = 0; n < face->num_charmaps; n++ )
-		{
-		  charmap = face->charmaps[n];
-		  if ( charmap->platform_id == my_platform_id &&
-			   charmap->encoding_id == my_encoding_id )
-		  {
-			found = charmap;
-			break;
-		  }
+
+#if 0
+		for ( n = 0; n < face->num_charmaps; n++) {
+			charmap = face->charmaps[n];
+			if (charmap->platform_id == my_platform_id && charmap->encoding_id == my_encoding_id) {
+				found = charmap;
+				break;
+			}
 		}
 
-		if ( !found ) { return 0; }
+		if (!found ) { return 0; }
 
 		// now, select the charmap for the face object 
 		err = FT_Set_Charmap( face, found );
 		if ( err ) { return 0; }
-*/
+#endif
+
 		glyph_index = FT_Get_Char_Index( face, 'A' );
 		err = FT_Load_Glyph(face, glyph_index, FT_LOAD_NO_SCALE | FT_LOAD_NO_BITMAP);
-		if(err) success = 0;
+		if (err) success = 0;
 		else {
 			glyph = face->glyph;
 			if (glyph->format == ft_glyph_format_outline ) {
 				success = 1;
-			} else {
+			}
+			else {
 				//XXX error("Selected Font has no outline data");
 				success = 0;
 			}
@@ -478,7 +483,7 @@ VFontData *BLI_vfontdata_from_freetypefont(PackedFile *pf)
 
 	//init Freetype	
 	err = FT_Init_FreeType( &library);
-	if(err) {
+	if (err) {
 		//XXX error("Failed to load the Freetype font library");
 		return NULL;
 	}
@@ -499,18 +504,18 @@ int BLI_vfontchar_from_freetypefont(VFont *vfont, unsigned long character)
 {
 	int success = FALSE;
 
-	if(!vfont) return FALSE;
+	if (!vfont) return FALSE;
 
 	// Init Freetype
 	err = FT_Init_FreeType(&library);
-	if(err) {
+	if (err) {
 		//XXX error("Failed to load the Freetype font library");
 		return 0;
 	}
 
 	// Load the character
 	success = objchr_to_ftvfontdata(vfont, character);
-	if(success == FALSE) return FALSE;
+	if (success == FALSE) return FALSE;
 
 	// Free Freetype
 	FT_Done_FreeType(library);
@@ -533,8 +538,7 @@ typedef struct  FT_Outline_
 	short*      contours;        /* the contour end points             */
 
 	int         flags;           /* outline masks                      */
-
-  } FT_Outline;
+} FT_Outline;
 
 #endif
 
diff --git a/source/blender/blenlib/intern/graph.c b/source/blender/blenlib/intern/graph.c
index d0d3d0e..75131f8 100644
--- a/source/blender/blenlib/intern/graph.c
+++ b/source/blender/blenlib/intern/graph.c
@@ -82,7 +82,7 @@ void BLI_flagNodes(BGraph *graph, int flag)
 {
 	BNode *node;
 	
-	for(node = graph->nodes.first; node; node = node->next)
+	for (node = graph->nodes.first; node; node = node->next)
 	{
 		node->flag = flag;
 	}
@@ -92,7 +92,7 @@ void BLI_flagArcs(BGraph *graph, int flag)
 {
 	BArc *arc;
 	
-	for(arc = graph->arcs.first; arc; arc = arc->next)
+	for (arc = graph->arcs.first; arc; arc = arc->next)
 	{
 		arc->flag = flag;
 	}
@@ -109,7 +109,7 @@ void BLI_buildAdjacencyList(BGraph *graph)
 	BNode *node;
 	BArc *arc;
 
-	for(node = graph->nodes.first; node; node = node->next)
+	for (node = graph->nodes.first; node; node = node->next)
 	{
 		if (node->arcs != NULL)
 		{
@@ -122,13 +122,13 @@ void BLI_buildAdjacencyList(BGraph *graph)
 		node->flag = 0;
 	}
 
-	for(arc = graph->arcs.first; arc; arc= arc->next)
+	for (arc = graph->arcs.first; arc; arc= arc->next)
 	{
 		addArcToNodeAdjacencyList(arc->head, arc);
 		addArcToNodeAdjacencyList(arc->tail, arc);
 	}
 
-	for(node = graph->nodes.first; node; node = node->next)
+	for (node = graph->nodes.first; node; node = node->next)
 	{
 		if (node->degree != node->flag)
 		{
@@ -151,7 +151,7 @@ void BLI_rebuildAdjacencyListForNode(BGraph* graph, BNode *node)
 	/* temporary use to indicate the first index available in the lists */
 	node->flag = 0;
 
-	for(arc = graph->arcs.first; arc; arc= arc->next)
+	for (arc = graph->arcs.first; arc; arc= arc->next)
 	{
 		if (arc->head == node)
 		{
@@ -173,7 +173,7 @@ void BLI_freeAdjacencyList(BGraph *graph)
 {
 	BNode *node;
 
-	for(node = graph->nodes.first; node; node = node->next)
+	for (node = graph->nodes.first; node; node = node->next)
 	{
 		if (node->arcs != NULL)
 		{
@@ -187,7 +187,7 @@ int BLI_hasAdjacencyList(BGraph *graph)
 {
 	BNode *node;
 	
-	for(node = graph->nodes.first; node; node = node->next)
+	for (node = graph->nodes.first; node; node = node->next)
 	{
 		if (node->arcs == NULL)
 		{
@@ -267,9 +267,9 @@ void BLI_removeDoubleNodes(BGraph *graph, float limit)
 {
 	BNode *node_src, *node_replaced;
 	
-	for(node_src = graph->nodes.first; node_src; node_src = node_src->next)
+	for (node_src = graph->nodes.first; node_src; node_src = node_src->next)
 	{
-		for(node_replaced = graph->nodes.first; node_replaced; node_replaced = node_replaced->next)
+		for (node_replaced = graph->nodes.first; node_replaced; node_replaced = node_replaced->next)
 		{
 			if (node_replaced != node_src && len_v3v3(node_replaced->p, node_src->p) <= limit)
 			{
@@ -285,7 +285,7 @@ BNode * BLI_FindNodeByPosition(BGraph *graph, float *p, float limit)
 	BNode *closest_node = NULL, *node;
 	float min_distance = 0.0f;
 	
-	for(node = graph->nodes.first; node; node = node->next)
+	for (node = graph->nodes.first; node; node = node->next)
 	{
 		float distance = len_v3v3(p, node->p); 
 		if (distance <= limit && (closest_node == NULL || distance < min_distance))
@@ -308,7 +308,7 @@ static void flagSubgraph(BNode *node, int subgraph)
 		
 		node->subgraph_index = subgraph;
 		
-		for(i = 0; i < node->degree; i++)
+		for (i = 0; i < node->degree; i++)
 		{
 			arc = node->arcs[i];
 			flagSubgraph(BLI_otherNode(arc, node), subgraph);
@@ -326,7 +326,7 @@ int BLI_FlagSubgraphs(BGraph *graph)
 		BLI_buildAdjacencyList(graph);
 	}
 	
-	for(node = graph->nodes.first; node; node = node->next)
+	for (node = graph->nodes.first; node; node = node->next)
 	{
 		node->subgraph_index = 0;
 	}
@@ -369,7 +369,7 @@ static int detectCycle(BNode *node, BArc *src_arc)
 		/* mark node as visited */
 		node->flag = 1;
 
-		for(i = 0; i < node->degree && value == 0; i++)
+		for (i = 0; i < node->degree && value == 0; i++)
 		{
 			BArc *arc = node->arcs[i];
 			
@@ -399,7 +399,7 @@ int	BLI_isGraphCyclic(BGraph *graph)
 	BLI_flagNodes(graph, 0);
 
 	/* detectCycles in subgraphs */	
-	for(node = graph->nodes.first; node && value == 0; node = node->next)
+	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)
@@ -415,7 +415,7 @@ BArc * BLI_findConnectedArc(BGraph *graph, BArc *arc, BNode *v)
 {
 	BArc *nextArc;
 	
-	for(nextArc = graph->arcs.first; nextArc; nextArc = nextArc->next)
+	for (nextArc = graph->arcs.first; nextArc; nextArc = nextArc->next)
 	{
 		if (arc != nextArc && (nextArc->head == v || nextArc->tail == v))
 		{
@@ -450,7 +450,7 @@ static int subtreeShape(BNode *node, BArc *rootArc, int include_root)
 		{
 			int i;
 	
-			for(i = 0; i < node->degree; i++)
+			for (i = 0; i < node->degree; i++)
 			{
 				BArc *arc = node->arcs[i];
 				BNode *newNode = BLI_otherNode(arc, node);
@@ -480,7 +480,7 @@ float BLI_subtreeLength(BNode *node)
 
 	node->flag = 0; /* flag node as visited */
 
-	for(i = 0; i < node->degree; i++)
+	for (i = 0; i < node->degree; i++)
 	{
 		BArc *arc = node->arcs[i];
 		BNode *other_node = BLI_otherNode(arc, node);
@@ -895,7 +895,7 @@ static void markdownSecondarySymmetry(BGraph *graph, BNode *node, int depth, int
 	int i;
 	
 	/* count the number of branches in this symmetry group
-	 * and determinte the axis of symmetry
+	 * and determinate the axis of symmetry
 	 *  */	
 	for (i = 0; i < node->degree; i++)
 	{
diff --git a/source/blender/blenlib/intern/gsqueue.c b/source/blender/blenlib/intern/gsqueue.c
index c0fa814..2aa5138 100644
--- a/source/blender/blenlib/intern/gsqueue.c
+++ b/source/blender/blenlib/intern/gsqueue.c
@@ -64,7 +64,7 @@ int BLI_gsqueue_size(GSQueue *gq)
 	GSQueueElem *elem;
 	int size= 0;
 
-	for(elem=gq->head; elem; elem=elem->next)
+	for (elem=gq->head; elem; elem=elem->next)
 		size++;
 	
 	return size;
@@ -79,7 +79,8 @@ void BLI_gsqueue_pop(GSQueue *gq, void *item_r)
 	GSQueueElem *elem= gq->head;
 	if (elem==gq->tail) {
 		gq->head= gq->tail= NULL;
-	} else {
+	}
+	else {
 		gq->head= gq->head->next;
 	}
 	
@@ -92,7 +93,7 @@ void BLI_gsqueue_push(GSQueue *gq, void *item)
 	
 	/* compare: prevent events added double in row */
 	if (!BLI_gsqueue_is_empty(gq)) {
-		if(0==memcmp(item, &gq->head[1], gq->elem_size))
+		if (0==memcmp(item, &gq->head[1], gq->elem_size))
 			return;
 	}
 	elem= MEM_mallocN(sizeof(*elem)+gq->elem_size, "gqueue_push");
@@ -101,7 +102,8 @@ void BLI_gsqueue_push(GSQueue *gq, void *item)
 	
 	if (BLI_gsqueue_is_empty(gq)) {
 		gq->tail= gq->head= elem;
-	} else {
+	}
+	else {
 		gq->tail= gq->tail->next= elem;
 	}
 }
@@ -113,7 +115,8 @@ void BLI_gsqueue_pushback(GSQueue *gq, void *item)
 
 	if (BLI_gsqueue_is_empty(gq)) {
 		gq->head= gq->tail= elem;
-	} else {
+	}
+	else {
 		gq->head= elem;
 	}
 }
diff --git a/source/blender/blenlib/intern/jitter.c b/source/blender/blenlib/intern/jitter.c
index ab33187..fbdf698 100644
--- a/source/blender/blenlib/intern/jitter.c
+++ b/source/blender/blenlib/intern/jitter.c
@@ -51,13 +51,13 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1)
 		x = jit1[i];
 		y = jit1[i+1];
 		for (j = 2*num-2; j>=0 ; j-=2) {
-			if (i != j){
+			if (i != j) {
 				vecx = jit1[j] - x - 1.0f;
 				vecy = jit1[j+1] - y - 1.0f;
-				for (k = 3; k>0 ; k--){
-					if( fabsf(vecx)<rad1 && fabsf(vecy)<rad1) {
+				for (k = 3; k>0 ; k--) {
+					if ( fabsf(vecx)<rad1 && fabsf(vecy)<rad1) {
 						len=  sqrt(vecx*vecx + vecy*vecy);
-						if(len>0 && len<rad1) {
+						if (len>0 && len<rad1) {
 							len= len/rad1;
 							dvecx += vecx/len;
 							dvecy += vecy/len;
@@ -65,9 +65,9 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1)
 					}
 					vecx += 1.0f;
 
-					if( fabsf(vecx)<rad1 && fabsf(vecy)<rad1) {
+					if ( fabsf(vecx)<rad1 && fabsf(vecy)<rad1) {
 						len=  sqrt(vecx*vecx + vecy*vecy);
-						if(len>0 && len<rad1) {
+						if (len>0 && len<rad1) {
 							len= len/rad1;
 							dvecx += vecx/len;
 							dvecy += vecy/len;
@@ -75,9 +75,9 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1)
 					}
 					vecx += 1.0f;
 
-					if( fabsf(vecx)<rad1 && fabsf(vecy)<rad1) {
+					if ( fabsf(vecx)<rad1 && fabsf(vecy)<rad1) {
 						len=  sqrt(vecx*vecx + vecy*vecy);
-						if(len>0 && len<rad1) {
+						if (len>0 && len<rad1) {
 							len= len/rad1;
 							dvecx += vecx/len;
 							dvecy += vecy/len;
@@ -91,7 +91,7 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1)
 
 		x -= dvecx/18.0f;
 		y -= dvecy/18.0f;
-		x -= floorf(x) ;
+		x -= floorf(x);
 		y -= floorf(y);
 		jit2[i] = x;
 		jit2[i+1] = y;
@@ -104,33 +104,33 @@ void BLI_jitterate2(float *jit1, float *jit2, int num, float rad2)
 	int i, j;
 	float vecx, vecy, dvecx, dvecy, x, y;
 
-	for (i=2*num -2; i>= 0 ; i-=2){
+	for (i=2*num -2; i>= 0 ; i-=2) {
 		dvecx = dvecy = 0.0;
 		x = jit1[i];
 		y = jit1[i+1];
-		for (j =2*num -2; j>= 0 ; j-=2){
-			if (i != j){
+		for (j =2*num -2; j>= 0 ; j-=2) {
+			if (i != j) {
 				vecx = jit1[j] - x - 1.0f;
 				vecy = jit1[j+1] - y - 1.0f;
 
-				if( fabsf(vecx)<rad2) dvecx+= vecx*rad2;
+				if ( fabsf(vecx)<rad2) dvecx+= vecx*rad2;
 				vecx += 1.0f;
-				if( fabsf(vecx)<rad2) dvecx+= vecx*rad2;
+				if ( fabsf(vecx)<rad2) dvecx+= vecx*rad2;
 				vecx += 1.0f;
-				if( fabsf(vecx)<rad2) dvecx+= vecx*rad2;
+				if ( fabsf(vecx)<rad2) dvecx+= vecx*rad2;
 
-				if( fabsf(vecy)<rad2) dvecy+= vecy*rad2;
+				if ( fabsf(vecy)<rad2) dvecy+= vecy*rad2;
 				vecy += 1.0f;
-				if( fabsf(vecy)<rad2) dvecy+= vecy*rad2;
+				if ( fabsf(vecy)<rad2) dvecy+= vecy*rad2;
 				vecy += 1.0f;
-				if( fabsf(vecy)<rad2) dvecy+= vecy*rad2;
+				if ( fabsf(vecy)<rad2) dvecy+= vecy*rad2;
 
 			}
 		}
 
 		x -= dvecx/2.0f;
 		y -= dvecy/2.0f;
-		x -= floorf(x) ;
+		x -= floorf(x);
 		y -= floorf(y);
 		jit2[i] = x;
 		jit2[i+1] = y;
@@ -144,7 +144,7 @@ void BLI_initjit(float *jitarr, int num)
 	float *jit2, x, rad1, rad2, rad3;
 	int i;
 
-	if(num==0) return;
+	if (num==0) return;
 
 	jit2= MEM_mallocN(12 + 2*sizeof(float)*num, "initjit");
 	rad1= 1.0f/sqrtf((float)num);
@@ -153,7 +153,7 @@ void BLI_initjit(float *jitarr, int num)
 
 	BLI_srand(31415926 + num);
 	x= 0;
-	for(i=0; i<2*num; i+=2) {
+	for (i=0; i<2*num; i+=2) {
 		jitarr[i]= x+ rad1*(float)(0.5-BLI_drand());
 		jitarr[i+1]= ((float)i/2)/num +rad1*(float)(0.5-BLI_drand());
 		x+= rad3;
@@ -169,7 +169,7 @@ void BLI_initjit(float *jitarr, int num)
 	MEM_freeN(jit2);
 	
 	/* finally, move jittertab to be centered around (0,0) */
-	for(i=0; i<2*num; i+=2) {
+	for (i=0; i<2*num; i+=2) {
 		jitarr[i] -= 0.5f;
 		jitarr[i+1] -= 0.5f;
 	}
diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c
index 52fd857..fecaa50 100644
--- a/source/blender/blenlib/intern/listbase.c
+++ b/source/blender/blenlib/intern/listbase.c
@@ -114,7 +114,7 @@ void BLI_remlink(ListBase *listbase, void *vlink)
 
 int BLI_remlink_safe(ListBase *listbase, void *vlink)
 {
-	if(BLI_findindex(listbase, vlink) != -1) {
+	if (BLI_findindex(listbase, vlink) != -1) {
 		BLI_remlink(listbase, vlink);
 		return 1;
 	}
@@ -182,16 +182,14 @@ void BLI_sortlist(ListBase *listbase, int (*cmp)(void *, void *))
 	if (cmp == NULL) return;
 	if (listbase == NULL) return;
 
-	if (listbase->first != listbase->last)
-	{
-		for( previous = listbase->first, current = previous->next; current; current = next )
-		{
+	if (listbase->first != listbase->last) {
+		for (previous = listbase->first, current = previous->next; current; current = next) {
 			next = current->next;
 			previous = current->prev;
 			
 			BLI_remlink(listbase, current);
 			
-			while(previous && cmp(previous, current) == 1)
+			while (previous && cmp(previous, current) == 1)
 			{
 				previous = previous->prev;
 			}
@@ -338,6 +336,21 @@ void *BLI_findlink(const ListBase *listbase, int number)
 	return link;
 }
 
+void *BLI_rfindlink(const ListBase *listbase, int number)
+{
+	Link *link = NULL;
+
+	if (number >= 0) {
+		link = listbase->last;
+		while (link != NULL && number != 0) {
+			number--;
+			link = link->prev;
+		}
+	}
+
+	return link;
+}
+
 int BLI_findindex(const ListBase *listbase, void *vlink)
 {
 	Link *link= NULL;
@@ -444,7 +457,7 @@ int BLI_findstringindex(const ListBase *listbase, const char *id, const int offs
 	while (link) {
 		id_iter= ((const char *)link) + offset;
 
-		if(id[0] == id_iter[0] && strcmp(id, id_iter)==0)
+		if (id[0] == id_iter[0] && strcmp(id, id_iter)==0)
 			return i;
 		i++;
 		link= link->next;
@@ -461,7 +474,7 @@ void BLI_duplicatelist(ListBase *dst, const ListBase *src)
 	src_link= src->first;
 	dst->first= dst->last= NULL;
 
-	while(src_link) {
+	while (src_link) {
 		dst_link= MEM_dupallocN(src_link);
 		BLI_addtail(dst, dst_link);
 
diff --git a/source/blender/blenlib/intern/math_base.c b/source/blender/blenlib/intern/math_base.c
index 67c2a98..6bb238a 100644
--- a/source/blender/blenlib/intern/math_base.c
+++ b/source/blender/blenlib/intern/math_base.c
@@ -37,10 +37,11 @@
 /* from python 3.1 pymath.c */
 double copysign(double x, double y)
 {
-	/* use atan2 to distinguish -0. from 0. */
-	if (y > 0. || (y == 0. && atan2(y, -1.) > 0.)) {
+	/* use atan2 to distinguish -0.0 from 0.0 */
+	if (y > 0.0 || (y == 0.0 && atan2(y, -1.0) > 0.0)) {
 		return fabs(x);
-	} else {
+	}
+	else {
 		return -fabs(x);
 	}
 }
@@ -59,7 +60,6 @@ double round(double x)
 double round(double x);
 #endif
 
-
 /* from python 3.1 floatobject.c
  * ndigits must be between 0 and 21 */
 double double_round(double x, int ndigits)
@@ -68,7 +68,7 @@ double double_round(double x, int ndigits)
 	if (ndigits >= 0) {
 		pow1 = pow(10.0, (double)ndigits);
 		pow2 = 1.0;
-		y = (x*pow1)*pow2;
+		y = (x * pow1) * pow2;
 		/* if y overflows, then rounded value is exactly x */
 		if (!finite(y))
 			return x;
@@ -80,9 +80,9 @@ double double_round(double x, int ndigits)
 	}
 
 	z = round(y);
-	if (fabs(y-z) == 0.5)
+	if (fabs(y - z) == 0.5)
 		/* halfway between two integers; use round-half-even */
-		z = 2.0*round(y/2.0);
+		z = 2.0 * round(y / 2.0);
 
 	if (ndigits >= 0)
 		z = (z / pow2) / pow1;
@@ -92,4 +92,3 @@ double double_round(double x, int ndigits)
 	/* if computation resulted in overflow, raise OverflowError */
 	return z;
 }
-
diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c
index 7e04e0a..b2d5392 100644
--- a/source/blender/blenlib/intern/math_base_inline.c
+++ b/source/blender/blenlib/intern/math_base_inline.c
@@ -35,74 +35,74 @@
 
 #include "BLI_math.h"
 
-#ifndef BLI_MATH_BASE_INLINE_H
-#define BLI_MATH_BASE_INLINE_H
+#ifndef __MATH_BASE_INLINE_C__
+#define __MATH_BASE_INLINE_C__
 
 /* A few small defines. Keep'em local! */
-#define SMALL_NUMBER	1.e-8f
+#define SMALL_NUMBER  1.e-8f
 
 MINLINE float sqrt3f(float f)
 {
-	if(f==0.0f) return 0.0f;
-	if(f<0) return (float)(-exp(log(-f)/3));
-	else return (float)(exp(log(f)/3));
+	if (f == 0.0f) return 0.0f;
+	if (f < 0) return (float)(-exp(log(-f) / 3));
+	else return (float)(exp(log(f) / 3));
 }
 
 MINLINE double sqrt3d(double d)
 {
-	if(d==0.0) return 0;
-	if(d<0) return -exp(log(-d)/3);
-	else return exp(log(d)/3);
+	if (d == 0.0) return 0;
+	if (d < 0) return -exp(log(-d) / 3);
+	else return exp(log(d) / 3);
 }
 
 MINLINE float saacos(float fac)
 {
-	if(fac<= -1.0f) return (float)M_PI;
-	else if(fac>=1.0f) return 0.0;
+	if (fac <= -1.0f) return (float)M_PI;
+	else if (fac >= 1.0f) return 0.0;
 	else return (float)acos(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;
+	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);
 }
 
 MINLINE float sasqrt(float fac)
 {
-	if(fac<=0.0f) return 0.0f;
+	if (fac <= 0.0f) return 0.0f;
 	return (float)sqrt(fac);
 }
 
 MINLINE float saacosf(float fac)
 {
-	if(fac<= -1.0f) return (float)M_PI;
-	else if(fac>=1.0f) return 0.0f;
+	if (fac <= -1.0f) return (float)M_PI;
+	else if (fac >= 1.0f) return 0.0f;
 	else return (float)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;
+	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);
 }
 
 MINLINE float sasqrtf(float fac)
 {
-	if(fac<=0.0f) return 0.0f;
-	return (float)sqrtf(fac);
+	if (fac <= 0.0f) return 0.0f;
+	return sqrtf(fac);
 }
 
 MINLINE float interpf(float target, float origin, float fac)
 {
-	return (fac*target) + (1.0f-fac)*origin;
+	return (fac * target) + (1.0f - fac) * origin;
 }
 
 /* useful to calculate an even width shell, by taking the angle between 2 planes.
  * The return value is a scale on the offset.
- * no angle between planes is 1.0, as the angle between the 2 planes approches 180d
+ * no angle between planes is 1.0, as the angle between the 2 planes approaches 180d
  * the distance gets very high, 180d would be inf, but this case isn't valid */
 MINLINE float shell_angle_to_dist(const float angle)
 {
@@ -125,7 +125,7 @@ MINLINE int power_of_2_max_i(int n)
 	if (is_power_of_2_i(n))
 		return n;
 
-	while(!is_power_of_2_i(n))
+	while (!is_power_of_2_i(n))
 		n = n & (n - 1);
 
 	return n * 2;
@@ -139,22 +139,20 @@ MINLINE int power_of_2_min_i(int n)
 	return n;
 }
 
-
 MINLINE float minf(float a, float b)
 {
-	return (a < b)? a: b;
+	return (a < b) ? a : b;
 }
 
 MINLINE float maxf(float a, float b)
 {
-	return (a > b)? a: b;
+	return (a > b) ? a : b;
 }
 
 MINLINE float signf(float f)
 {
-	return (f < 0.f)? -1.f: 1.f;
+	return (f < 0.f) ? -1.f : 1.f;
 }
 
 
-#endif /* BLI_MATH_BASE_INLINE_H */
-
+#endif /* __MATH_BASE_INLINE_C__ */
diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c
index b9772b1..abd9c1e 100644
--- a/source/blender/blenlib/intern/math_color.c
+++ b/source/blender/blenlib/intern/math_color.c
@@ -17,7 +17,7 @@
  *
  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
  * All rights reserved.
- 
+ *
  * The Original Code is: some of this file.
  *
  * ***** END GPL LICENSE BLOCK *****
@@ -41,51 +41,51 @@ void hsv_to_rgb(float h, float s, float v, float *r, float *g, float *b)
 	int i;
 	float f, p, q, t;
 
-	if(s==0.0f) {
+	if (s == 0.0f) {
 		*r = v;
 		*g = v;
 		*b = v;
 	}
 	else {
-		h= (h - floorf(h))*6.0f;
+		h = (h - floorf(h)) * 6.0f;
 
 		i = (int)floorf(h);
 		f = h - i;
-		p = v*(1.0f-s);
-		q = v*(1.0f-(s*f));
-		t = v*(1.0f-(s*(1.0f-f)));
-		
+		p = v * (1.0f - s);
+		q = v * (1.0f - (s * f));
+		t = v * (1.0f - (s * (1.0f - f)));
+
 		switch (i) {
-		case 0 :
-			*r = v;
-			*g = t;
-			*b = p;
-			break;
-		case 1 :
-			*r = q;
-			*g = v;
-			*b = p;
-			break;
-		case 2 :
-			*r = p;
-			*g = v;
-			*b = t;
-			break;
-		case 3 :
-			*r = p;
-			*g = q;
-			*b = v;
-			break;
-		case 4 :
-			*r = t;
-			*g = p;
-			*b = v;
-			break;
-		case 5 :
-			*r = v;
-			*g = p;
-			*b = q;
-			break;
+			case 0:
+				*r = v;
+				*g = t;
+				*b = p;
+				break;
+			case 1:
+				*r = q;
+				*g = v;
+				*b = p;
+				break;
+			case 2:
+				*r = p;
+				*g = v;
+				*b = t;
+				break;
+			case 3:
+				*r = p;
+				*g = q;
+				*b = v;
+				break;
+			case 4:
+				*r = t;
+				*g = p;
+				*b = v;
+				break;
+			case 5:
+				*r = v;
+				*g = p;
+				*b = q;
+				break;
 		}
 	}
 }
@@ -93,93 +93,95 @@ void hsv_to_rgb(float h, float s, float v, float *r, float *g, float *b)
 void rgb_to_yuv(float r, float g, float b, float *ly, float *lu, float *lv)
 {
 	float y, u, v;
-	y= 0.299f*r + 0.587f*g + 0.114f*b;
-	u=-0.147f*r - 0.289f*g + 0.436f*b;
-	v= 0.615f*r - 0.515f*g - 0.100f*b;
-	
-	*ly=y;
-	*lu=u;
-	*lv=v;
+	y = 0.299f * r + 0.587f * g + 0.114f * b;
+	u = -0.147f * r - 0.289f * g + 0.436f * b;
+	v = 0.615f * r - 0.515f * g - 0.100f * b;
+
+	*ly = y;
+	*lu = u;
+	*lv = v;
 }
 
 void yuv_to_rgb(float y, float u, float v, float *lr, float *lg, float *lb)
 {
 	float r, g, b;
-	r=y+1.140f*v;
-	g=y-0.394f*u - 0.581f*v;
-	b=y+2.032f*u;
-	
-	*lr=r;
-	*lg=g;
-	*lb=b;
+	r = y + 1.140f * v;
+	g = y - 0.394f * u - 0.581f * v;
+	b = y + 2.032f * u;
+
+	*lr = r;
+	*lg = g;
+	*lb = b;
 }
 
-/* The RGB inputs are supposed gamma corrected and in the range 0 - 1.0f */
-/* Output YCC have a range of 16-235 and 16-240 except with JFIF_0_255 where the range is 0-255 */
+/* The RGB inputs are supposed gamma corrected and in the range 0 - 1.0f
+ *
+ * Output YCC have a range of 16-235 and 16-240 except with JFIF_0_255 where the range is 0-255 */
 void rgb_to_ycc(float r, float g, float b, float *ly, float *lcb, float *lcr, int colorspace)
 {
-	float sr,sg, sb;
+	float sr, sg, sb;
 	float y = 128.f, cr = 128.f, cb = 128.f;
-	
-	sr=255.0f*r;
-	sg=255.0f*g;
-	sb=255.0f*b;
-	
+
+	sr = 255.0f * r;
+	sg = 255.0f * g;
+	sb = 255.0f * b;
+
 	switch (colorspace) {
-	case BLI_YCC_ITU_BT601 :
-		y=(0.257f*sr)+(0.504f*sg)+(0.098f*sb)+16.0f;
-		cb=(-0.148f*sr)-(0.291f*sg)+(0.439f*sb)+128.0f;
-		cr=(0.439f*sr)-(0.368f*sg)-(0.071f*sb)+128.0f;
-		break;
-	case BLI_YCC_ITU_BT709 :
-		y=(0.183f*sr)+(0.614f*sg)+(0.062f*sb)+16.0f;
-		cb=(-0.101f*sr)-(0.338f*sg)+(0.439f*sb)+128.0f;
-		cr=(0.439f*sr)-(0.399f*sg)-(0.040f*sb)+128.0f;
-		break;
-	case BLI_YCC_JFIF_0_255 :
-		y=(0.299f*sr)+(0.587f*sg)+(0.114f*sb);
-		cb=(-0.16874f*sr)-(0.33126f*sg)+(0.5f*sb)+128.0f;
-		cr=(0.5f*sr)-(0.41869f*sg)-(0.08131f*sb)+128.0f;
-		break;
-	default:
-		assert(!"invalid colorspace");
+		case BLI_YCC_ITU_BT601:
+			y = (0.257f * sr) + (0.504f * sg) + (0.098f * sb) + 16.0f;
+			cb = (-0.148f * sr) - (0.291f * sg) + (0.439f * sb) + 128.0f;
+			cr = (0.439f * sr) - (0.368f * sg) - (0.071f * sb) + 128.0f;
+			break;
+		case BLI_YCC_ITU_BT709:
+			y = (0.183f * sr) + (0.614f * sg) + (0.062f * sb) + 16.0f;
+			cb = (-0.101f * sr) - (0.338f * sg) + (0.439f * sb) + 128.0f;
+			cr = (0.439f * sr) - (0.399f * sg) - (0.040f * sb) + 128.0f;
+			break;
+		case BLI_YCC_JFIF_0_255:
+			y = (0.299f * sr) + (0.587f * sg) + (0.114f * sb);
+			cb = (-0.16874f * sr) - (0.33126f * sg) + (0.5f * sb) + 128.0f;
+			cr = (0.5f * sr) - (0.41869f * sg) - (0.08131f * sb) + 128.0f;
+			break;
+		default:
+			assert(!"invalid colorspace");
 	}
-	
-	*ly=y;
-	*lcb=cb;
-	*lcr=cr;
+
+	*ly = y;
+	*lcb = cb;
+	*lcr = cr;
 }
 
 
 /* YCC input have a range of 16-235 and 16-240 except with JFIF_0_255 where the range is 0-255 */
 /* RGB outputs are in the range 0 - 1.0f */
+
 /* FIXME comment above must be wrong because BLI_YCC_ITU_BT601 y 16.0 cr 16.0 -> r -0.7009 */
 void ycc_to_rgb(float y, float cb, float cr, float *lr, float *lg, float *lb, int colorspace)
 {
 	float r = 128.f, g = 128.f, b = 128.f;
-	
+
 	switch (colorspace) {
-	case BLI_YCC_ITU_BT601 :
-		r=1.164f*(y-16.0f)+1.596f*(cr-128.0f);
-		g=1.164f*(y-16.0f)-0.813f*(cr-128.0f)-0.392f*(cb-128.0f);
-		b=1.164f*(y-16.0f)+2.017f*(cb-128.0f);
-		break;
-	case BLI_YCC_ITU_BT709 :
-		r=1.164f*(y-16.0f)+1.793f*(cr-128.0f);
-		g=1.164f*(y-16.0f)-0.534f*(cr-128.0f)-0.213f*(cb-128.0f);
-		b=1.164f*(y-16.0f)+2.115f*(cb-128.0f);
-		break;
-	case BLI_YCC_JFIF_0_255 :
-		r=y+1.402f*cr - 179.456f;
-		g=y-0.34414f*cb - 0.71414f*cr + 135.45984f;
-		b=y+1.772f*cb - 226.816f;
-		break;
-	default:
-		assert(!"invalid colorspace");
+		case BLI_YCC_ITU_BT601:
+			r = 1.164f * (y - 16.0f) + 1.596f * (cr - 128.0f);
+			g = 1.164f * (y - 16.0f) - 0.813f * (cr - 128.0f) - 0.392f * (cb - 128.0f);
+			b = 1.164f * (y - 16.0f) + 2.017f * (cb - 128.0f);
+			break;
+		case BLI_YCC_ITU_BT709:
+			r = 1.164f * (y - 16.0f) + 1.793f * (cr - 128.0f);
+			g = 1.164f * (y - 16.0f) - 0.534f * (cr - 128.0f) - 0.213f * (cb - 128.0f);
+			b = 1.164f * (y - 16.0f) + 2.115f * (cb - 128.0f);
+			break;
+		case BLI_YCC_JFIF_0_255:
+			r = y + 1.402f * cr - 179.456f;
+			g = y - 0.34414f * cb - 0.71414f * cr + 135.45984f;
+			b = y + 1.772f * cb - 226.816f;
+			break;
+		default:
+			assert(!"invalid colorspace");
 	}
-	*lr=r/255.0f;
-	*lg=g/255.0f;
-	*lb=b/255.0f;
+	*lr = r / 255.0f;
+	*lg = g / 255.0f;
+	*lb = b / 255.0f;
 }
 
 void hex_to_rgb(char *hexcol, float *r, float *g, float *b)
@@ -188,7 +190,7 @@ void hex_to_rgb(char *hexcol, float *r, float *g, float *b)
 
 	if (hexcol[0] == '#') hexcol++;
 
-	if (sscanf(hexcol, "%02x%02x%02x", &ri, &gi, &bi)==3) {
+	if (sscanf(hexcol, "%02x%02x%02x", &ri, &gi, &bi) == 3) {
 		*r = ri / 255.0f;
 		*g = gi / 255.0f;
 		*b = bi / 255.0f;
@@ -198,7 +200,7 @@ void hex_to_rgb(char *hexcol, float *r, float *g, float *b)
 	}
 	else {
 		/* avoid using un-initialized vars */
-		*r= *g= *b= 0.0f;
+		*r = *g = *b = 0.0f;
 	}
 }
 
@@ -210,59 +212,63 @@ void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv)
 
 	cmax = r;
 	cmin = r;
-	cmax = (g>cmax ? g:cmax);
-	cmin = (g<cmin ? g:cmin);
-	cmax = (b>cmax ? b:cmax);
-	cmin = (b<cmin ? b:cmin);
+	cmax = (g > cmax ? g : cmax);
+	cmin = (g < cmin ? g : cmin);
+	cmax = (b > cmax ? b : cmax);
+	cmin = (b < cmin ? b : cmin);
 
-	v = cmax;		/* value */
+	v = cmax; /* value */
 	if (cmax != 0.0f)
-		s = (cmax - cmin)/cmax;
+		s = (cmax - cmin) / cmax;
 	else {
 		s = 0.0f;
 	}
 	if (s == 0.0f)
 		h = -1.0f;
 	else {
-		cdelta = cmax-cmin;
-		rc = (cmax-r)/cdelta;
-		gc = (cmax-g)/cdelta;
-		bc = (cmax-b)/cdelta;
-		if (r==cmax)
-			h = bc-gc;
-		else
-			if (g==cmax)
-				h = 2.0f+rc-bc;
-			else
-				h = 4.0f+gc-rc;
-		h = h*60.0f;
+		cdelta = cmax - cmin;
+		rc = (cmax - r) / cdelta;
+		gc = (cmax - g) / cdelta;
+		bc = (cmax - b) / cdelta;
+
+		if (r == cmax) {
+			h = bc - gc;
+		}
+		else if (g == cmax) {
+			h = 2.0f + rc - bc;
+		}
+		else {
+			h = 4.0f + gc - rc;
+		}
+
+		h = h * 60.0f;
 		if (h < 0.0f)
 			h += 360.0f;
 	}
-	
+
 	*ls = s;
 	*lh = h / 360.0f;
-	if(*lh < 0.0f) *lh= 0.0f;
+	if (*lh < 0.0f) *lh = 0.0f;
 	*lv = v;
 }
 
 void rgb_to_hsv_compat(float r, float g, float b, float *lh, float *ls, float *lv)
 {
-	float orig_h= *lh;
-	float orig_s= *ls;
+	float orig_h = *lh;
+	float orig_s = *ls;
 
 	rgb_to_hsv(r, g, b, lh, ls, lv);
 
-	if(*lv <= 0.0f) {
-		*lh= orig_h;
-		*ls= orig_s;
+	if (*lv <= 0.0f) {
+		*lh = orig_h;
+		*ls = orig_s;
 	}
 	else if (*ls <= 0.0f) {
-		*lh= orig_h;
+		*lh = orig_h;
 	}
 
-	if(*lh==0.0f && orig_h >= 1.0f) {
-		*lh= 1.0f;
+	if (*lh == 0.0f && orig_h >= 1.0f) {
+		*lh = 1.0f;
 	}
 }
 
@@ -270,86 +276,88 @@ void rgb_to_hsv_compat(float r, float g, float b, float *lh, float *ls, float *l
 
 void xyz_to_rgb(float xc, float yc, float zc, float *r, float *g, float *b, int colorspace)
 {
-	switch (colorspace) { 
-	case BLI_XYZ_SMPTE:
-		*r = (3.50570f	 * xc) + (-1.73964f	 * yc) + (-0.544011f * zc);
-		*g = (-1.06906f	 * xc) + (1.97781f	 * yc) + (0.0351720f * zc);
-		*b = (0.0563117f * xc) + (-0.196994f * yc) + (1.05005f	 * zc);
-		break;
-	case BLI_XYZ_REC709_SRGB:
-		*r = (3.240476f	 * xc) + (-1.537150f * yc) + (-0.498535f * zc);
-		*g = (-0.969256f * xc) + (1.875992f  * yc) + (0.041556f  * zc);
-		*b = (0.055648f	 * xc) + (-0.204043f * yc) + (1.057311f  * zc);
-		break;
-	case BLI_XYZ_CIE:
-		*r = (2.28783848734076f	* xc) + (-0.833367677835217f	* yc) + (-0.454470795871421f	* zc);
-		*g = (-0.511651380743862f * xc) + (1.42275837632178f * yc) + (0.0888930017552939f * zc);
-		*b = (0.00572040983140966f	* xc) + (-0.0159068485104036f	* yc) + (1.0101864083734f	* zc);
-		break;
+	switch (colorspace) {
+		case BLI_XYZ_SMPTE:
+			*r = (3.50570f * xc) + (-1.73964f * yc) + (-0.544011f * zc);
+			*g = (-1.06906f * xc) + (1.97781f * yc) + (0.0351720f * zc);
+			*b = (0.0563117f * xc) + (-0.196994f * yc) + (1.05005f * zc);
+			break;
+		case BLI_XYZ_REC709_SRGB:
+			*r = (3.240476f * xc) + (-1.537150f * yc) + (-0.498535f * zc);
+			*g = (-0.969256f * xc) + (1.875992f * yc) + (0.041556f * zc);
+			*b = (0.055648f * xc) + (-0.204043f * yc) + (1.057311f * zc);
+			break;
+		case BLI_XYZ_CIE:
+			*r = (2.28783848734076f * xc) + (-0.833367677835217f * yc) + (-0.454470795871421f * zc);
+			*g = (-0.511651380743862f * xc) + (1.42275837632178f * yc) + (0.0888930017552939f * zc);
+			*b = (0.00572040983140966f * xc) + (-0.0159068485104036f * yc) + (1.0101864083734f * zc);
+			break;
 	}
 }
 
 /* we define a 'cpack' here as a (3 byte color code) number that can be expressed like 0xFFAA66 or so.
-   for that reason it is sensitive for endianness... with this function it works correctly
-*/
+ * for that reason it is sensitive for endianness... with this function it works correctly
+ */
 
 unsigned int hsv_to_cpack(float h, float s, float v)
 {
 	short r, g, b;
 	float rf, gf, bf;
 	unsigned int col;
-	
+
 	hsv_to_rgb(h, s, v, &rf, &gf, &bf);
-	
-	r= (short)(rf*255.0f);
-	g= (short)(gf*255.0f);
-	b= (short)(bf*255.0f);
-	
-	col= ( r + (g*256) + (b*256*256) );
+
+	r = (short) (rf * 255.0f);
+	g = (short) (gf * 255.0f);
+	b = (short) (bf * 255.0f);
+
+	col = (r + (g * 256) + (b * 256 * 256));
 	return col;
 }
 
-
 unsigned int rgb_to_cpack(float r, float g, float b)
 {
 	int ir, ig, ib;
-	
-	ir= (int)floor(255.0f*r);
-	if(ir<0) ir= 0; else if(ir>255) ir= 255;
-	ig= (int)floor(255.0f*g);
-	if(ig<0) ig= 0; else if(ig>255) ig= 255;
-	ib= (int)floor(255.0f*b);
-	if(ib<0) ib= 0; else if(ib>255) ib= 255;
-	
-	return (ir+ (ig*256) + (ib*256*256));
+
+	ir = (int)floor(255.0f * r);
+	if (ir < 0) ir = 0;
+	else if (ir > 255) ir = 255;
+	ig = (int)floor(255.0f * g);
+	if (ig < 0) ig = 0;
+	else if (ig > 255) ig = 255;
+	ib = (int)floor(255.0f * b);
+	if (ib < 0) ib = 0;
+	else if (ib > 255) ib = 255;
+
+	return (ir + (ig * 256) + (ib * 256 * 256));
 }
 
 void cpack_to_rgb(unsigned int col, float *r, float *g, float *b)
 {
-	
-	*r= (float)((col)&0xFF);
+
+	*r = (float)((col) & 0xFF);
 	*r /= 255.0f;
 
-	*g= (float)(((col)>>8)&0xFF);
+	*g = (float)(((col) >> 8) & 0xFF);
 	*g /= 255.0f;
 
-	*b= (float)(((col)>>16)&0xFF);
+	*b = (float)(((col) >> 16) & 0xFF);
 	*b /= 255.0f;
 }
 
 void rgb_uchar_to_float(float col_r[3], const unsigned char col_ub[3])
 {
-	col_r[0]= ((float)col_ub[0]) / 255.0f;
-	col_r[1]= ((float)col_ub[1]) / 255.0f;
-	col_r[2]= ((float)col_ub[2]) / 255.0f;
+	col_r[0] = ((float)col_ub[0]) / 255.0f;
+	col_r[1] = ((float)col_ub[1]) / 255.0f;
+	col_r[2] = ((float)col_ub[2]) / 255.0f;
 }
 
 void rgba_uchar_to_float(float col_r[4], const unsigned char col_ub[4])
 {
-	col_r[0]= ((float)col_ub[0]) / 255.0f;
-	col_r[1]= ((float)col_ub[1]) / 255.0f;
-	col_r[2]= ((float)col_ub[2]) / 255.0f;
-	col_r[3]= ((float)col_ub[3]) / 255.0f;
+	col_r[0] = ((float)col_ub[0]) / 255.0f;
+	col_r[1] = ((float)col_ub[1]) / 255.0f;
+	col_r[2] = ((float)col_ub[2]) / 255.0f;
+	col_r[3] = ((float)col_ub[3]) / 255.0f;
 }
 
 void rgb_float_to_uchar(unsigned char col_r[3], const float col_f[3])
@@ -373,15 +381,15 @@ void gamma_correct(float *c, float gamma)
 float rec709_to_linearrgb(float c)
 {
 	if (c < 0.081f)
-		return (c < 0.0f)? 0.0f: c * (1.0f/4.5f);
+		return (c < 0.0f) ? 0.0f : c * (1.0f / 4.5f);
 	else
-		return powf((c + 0.099f)*(1.0f/1.099f), (1.0f/0.45f));
+		return powf((c + 0.099f) * (1.0f / 1.099f), (1.0f / 0.45f));
 }
 
 float linearrgb_to_rec709(float c)
 {
 	if (c < 0.018f)
-		return (c < 0.0f)? 0.0f: c * 4.5f;
+		return (c < 0.0f) ? 0.0f : c * 4.5f;
 	else
 		return 1.099f * powf(c, 0.45f) - 0.099f;
 }
@@ -389,35 +397,35 @@ float linearrgb_to_rec709(float c)
 float srgb_to_linearrgb(float c)
 {
 	if (c < 0.04045f)
-		return (c < 0.0f)? 0.0f: c * (1.0f/12.92f);
+		return (c < 0.0f) ? 0.0f : c * (1.0f / 12.92f);
 	else
-		return powf((c + 0.055f)*(1.0f/1.055f), 2.4f);
+		return powf((c + 0.055f) * (1.0f / 1.055f), 2.4f);
 }
 
 float linearrgb_to_srgb(float c)
 {
 	if (c < 0.0031308f)
-		return (c < 0.0f)? 0.0f: c * 12.92f;
+		return (c < 0.0f) ? 0.0f : c * 12.92f;
 	else
-		return  1.055f * powf(c, 1.0f/2.4f) - 0.055f;
+		return 1.055f * powf(c, 1.0f / 2.4f) - 0.055f;
 }
 
 void minmax_rgb(short c[])
 {
-	if(c[0]>255) c[0]=255;
-	else if(c[0]<0) c[0]=0;
-	if(c[1]>255) c[1]=255;
-	else if(c[1]<0) c[1]=0;
-	if(c[2]>255) c[2]=255;
-	else if(c[2]<0) c[2]=0;
+	if (c[0] > 255) c[0] = 255;
+	else if (c[0] < 0) c[0] = 0;
+	if (c[1] > 255) c[1] = 255;
+	else if (c[1] < 0) c[1] = 0;
+	if (c[2] > 255) c[2] = 255;
+	else if (c[2] < 0) c[2] = 0;
 }
 
 /*If the requested RGB shade contains a negative weight for
-  one of the primaries, it lies outside the color 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.*/
+ * one of the primaries, it lies outside the color 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.*/
 int constrain_rgb(float *r, float *g, float *b)
 {
 	float w;
@@ -432,31 +440,33 @@ int constrain_rgb(float *r, float *g, float *b)
 	/* Add just enough white to make r, g, b all positive. */
 
 	if (w > 0) {
-		*r += w;  *g += w; *b += w;
-		return 1;                     /* Color modified to fit RGB gamut */
+		*r += w;
+		*g += w;
+		*b += w;
+		return 1; /* Color modified to fit RGB gamut */
 	}
 
-	return 0;                         /* Color within RGB gamut */
+	return 0; /* Color within RGB gamut */
 }
 
 float rgb_to_grayscale(const float rgb[3])
 {
-	return 0.3f*rgb[0] + 0.58f*rgb[1] + 0.12f*rgb[2];
+	return 0.3f * rgb[0] + 0.58f * rgb[1] + 0.12f * rgb[2];
 }
 
 unsigned char rgb_to_grayscale_byte(const unsigned char rgb[3])
 {
-	return (76*(unsigned short)rgb[0] + 148*(unsigned short)rgb[1] + 31*(unsigned short)rgb[2]) / 255;
+	return (76 * (unsigned short) rgb[0] + 148 * (unsigned short) rgb[1] + 31 * (unsigned short) rgb[2]) / 255;
 }
 
 float rgb_to_luma(const float rgb[3])
 {
-	return 0.299f*rgb[0] + 0.587f*rgb[1] + 0.114f*rgb[2];
+	return 0.299f * rgb[0] + 0.587f * rgb[1] + 0.114f * rgb[2];
 }
 
 unsigned char rgb_to_luma_byte(const unsigned char rgb[3])
 {
-	return (76*(unsigned short)rgb[0] + 150*(unsigned short)rgb[1] + 29*(unsigned short)rgb[2]) / 255;
+	return (76 * (unsigned short) rgb[0] + 150 * (unsigned short) rgb[1] + 29 * (unsigned short) rgb[2]) / 255;
 }
 
 /* ********************************* lift/gamma/gain / ASC-CDL conversion ********************************* */
@@ -464,13 +474,13 @@ unsigned char rgb_to_luma_byte(const unsigned char rgb[3])
 void lift_gamma_gain_to_asc_cdl(float *lift, float *gamma, float *gain, float *offset, float *slope, float *power)
 {
 	int c;
-	for(c=0; c<3; c++) {
-		offset[c]= lift[c]*gain[c];
-		slope[c]=  gain[c]*(1.0f-lift[c]);
-		if(gamma[c] == 0)
-			power[c]= FLT_MAX;
+	for (c = 0; c < 3; c++) {
+		offset[c] = lift[c] * gain[c];
+		slope[c] = gain[c] * (1.0f - lift[c]);
+		if (gamma[c] == 0)
+			power[c] = FLT_MAX;
 		else
-			power[c]= 1.0f/gamma[c];
+			power[c] = 1.0f / gamma[c];
 	}
 }
 
@@ -480,21 +490,21 @@ void lift_gamma_gain_to_asc_cdl(float *lift, float *gamma, float *gain, float *o
 void rgb_float_set_hue_float_offset(float rgb[3], float hue_offset)
 {
 	float hsv[3];
-	
-	rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
-	
-	hsv[0]+= hue_offset;
-	if(hsv[0] > 1.0f)		hsv[0] -= 1.0f;
-	else if(hsv[0] < 0.0f)	hsv[0] += 1.0f;
-	
-	hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb+1, rgb+2);
+
+	rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv + 1, hsv + 2);
+
+	hsv[0] += hue_offset;
+	if (hsv[0] > 1.0f) hsv[0] -= 1.0f;
+	else if (hsv[0] < 0.0f) hsv[0] += 1.0f;
+
+	hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb + 1, rgb + 2);
 }
 
 /* Applies an hue offset to a byte rgb color */
 void rgb_byte_set_hue_float_offset(unsigned char rgb[3], float hue_offset)
 {
 	float rgb_float[3];
-	
+
 	rgb_uchar_to_float(rgb_float, rgb);
 	rgb_float_set_hue_float_offset(rgb_float, hue_offset);
 	rgb_float_to_uchar(rgb, rgb_float);
@@ -527,16 +537,17 @@ static unsigned short hipart(const float f)
 
 static float index_to_float(const unsigned short i)
 {
+
 	union {
 		float f;
 		unsigned short us[2];
 	} tmp;
 
 	/* positive and negative zeros, and all gradual underflow, turn into zero: */
-	if (i<0x80 || (i >= 0x8000 && i < 0x8080)) return 0;
+	if (i < 0x80 || (i >= 0x8000 && i < 0x8080)) return 0;
 	/* All NaN's and infinity turn into the largest possible legal float: */
-	if (i>=0x7f80 && i<0x8000) return FLT_MAX;
-	if (i>=0xff80) return -FLT_MAX;
+	if (i >= 0x7f80 && i < 0x8000) return FLT_MAX;
+	if (i >= 0xff80) return -FLT_MAX;
 
 #ifdef __BIG_ENDIAN__
 	tmp.us[0] = i;
@@ -551,7 +562,7 @@ static float index_to_float(const unsigned short i)
 
 void BLI_init_srgb_conversion(void)
 {
-	static int initialized= 0;
+	static int initialized = 0;
 	int i, b;
 
 	if (initialized) return;
@@ -559,19 +570,18 @@ void BLI_init_srgb_conversion(void)
 
 	/* Fill in the lookup table to convert floats to bytes: */
 	for (i = 0; i < 0x10000; i++) {
-		float f = linearrgb_to_srgb(index_to_float(i))*255.0f;
+		float f = linearrgb_to_srgb(index_to_float(i)) * 255.0f;
 		if (f <= 0) BLI_color_to_srgb_table[i] = 0;
-		else if (f < 255) BLI_color_to_srgb_table[i] = (unsigned short)(f*0x100+0.5f);
+		else if (f < 255) BLI_color_to_srgb_table[i] = (unsigned short) (f * 0x100 + 0.5f);
 		else BLI_color_to_srgb_table[i] = 0xff00;
 	}
 
 	/* Fill in the lookup table to convert bytes to float: */
 	for (b = 0; b <= 255; b++) {
-		float f = srgb_to_linearrgb(((float)b)*(1.0f/255.0f));
+		float f = srgb_to_linearrgb(((float)b) * (1.0f / 255.0f));
 		BLI_color_from_srgb_table[b] = f;
 		i = hipart(f);
 		/* replace entries so byte->float->byte does not change the data: */
-		BLI_color_to_srgb_table[i] = b*0x100;
+		BLI_color_to_srgb_table[i] = b * 0x100;
 	}
 }
-
diff --git a/source/blender/blenlib/intern/math_color_inline.c b/source/blender/blenlib/intern/math_color_inline.c
index 386452e..243e9fc 100644
--- a/source/blender/blenlib/intern/math_color_inline.c
+++ b/source/blender/blenlib/intern/math_color_inline.c
@@ -31,8 +31,8 @@
 #include "BLI_math_color.h"
 #include "BLI_utildefines.h"
 
-#ifndef BLI_MATH_COLOR_INLINE_H
-#define BLI_MATH_COLOR_INLINE_H
+#ifndef __MATH_COLOR_INLINE_C__
+#define __MATH_COLOR_INLINE_C__
 
 /******************************** Color Space ********************************/
 
@@ -78,22 +78,22 @@ MINLINE void linearrgb_to_srgb_uchar4(unsigned char srgb[4], const float linear[
 	F4TOCHAR4(srgb_f, srgb);
 }
 
-/* predivide versions to work on associated/premultipled alpha. if this should
-   be done or not depends on the background the image will be composited over,
-   ideally you would never do color space conversion on an image with alpha
-   because it is ill defined */
+/* predivide versions to work on associated/pre-multipled alpha. if this should
+ * be done or not depends on the background the image will be composited over,
+ * ideally you would never do color space conversion on an image with alpha
+ * because it is ill defined */
 
 MINLINE void srgb_to_linearrgb_predivide_v4(float linear[4], const float srgb[4])
 {
 	float alpha, inv_alpha;
 
-	if(srgb[3] == 1.0f || srgb[3] == 0.0f) {
+	if (srgb[3] == 1.0f || srgb[3] == 0.0f) {
 		alpha = 1.0f;
 		inv_alpha = 1.0f;
 	}
 	else {
 		alpha = srgb[3];
-		inv_alpha = 1.0f/alpha;
+		inv_alpha = 1.0f / alpha;
 	}
 
 	linear[0] = srgb_to_linearrgb(srgb[0] * inv_alpha) * alpha;
@@ -106,13 +106,13 @@ MINLINE void linearrgb_to_srgb_predivide_v4(float srgb[4], const float linear[4]
 {
 	float alpha, inv_alpha;
 
-	if(linear[3] == 1.0f || linear[3] == 0.0f) {
+	if (linear[3] == 1.0f || linear[3] == 0.0f) {
 		alpha = 1.0f;
 		inv_alpha = 1.0f;
 	}
 	else {
 		alpha = linear[3];
-		inv_alpha = 1.0f/alpha;
+		inv_alpha = 1.0f / alpha;
 	}
 
 	srgb[0] = linearrgb_to_srgb(linear[0] * inv_alpha) * alpha;
@@ -128,6 +128,7 @@ extern unsigned short BLI_color_to_srgb_table[0x10000];
 
 MINLINE unsigned short to_srgb_table_lookup(const float f)
 {
+
 	union {
 		float f;
 		unsigned short us[2];
@@ -153,17 +154,17 @@ MINLINE void linearrgb_to_srgb_ushort4_predivide(unsigned short srgb[4], const f
 	float alpha, inv_alpha, t;
 	int i;
 
-	if(linear[3] == 1.0f || linear[3] == 0.0f) {
+	if (linear[3] == 1.0f || linear[3] == 0.0f) {
 		linearrgb_to_srgb_ushort4(srgb, linear);
 		return;
 	}
 
 	alpha = linear[3];
-	inv_alpha = 1.0f/alpha;
+	inv_alpha = 1.0f / alpha;
 
-	for(i=0; i<3; ++i) {
+	for (i = 0; i < 3; ++i) {
 		t = linear[i] * inv_alpha;
-		srgb[i] = (t < 1.0f)? to_srgb_table_lookup(t) * alpha : FTOUSHORT(linearrgb_to_srgb(t) * alpha);
+		srgb[i] = (t < 1.0f) ? (unsigned short) (to_srgb_table_lookup(t) * alpha) : FTOUSHORT(linearrgb_to_srgb(t) * alpha);
 	}
 
 	srgb[3] = FTOUSHORT(linear[3]);
@@ -174,27 +175,44 @@ MINLINE void srgb_to_linearrgb_uchar4(float linear[4], const unsigned char srgb[
 	linear[0] = BLI_color_from_srgb_table[srgb[0]];
 	linear[1] = BLI_color_from_srgb_table[srgb[1]];
 	linear[2] = BLI_color_from_srgb_table[srgb[2]];
-	linear[3] = srgb[3] * (1.0f/255.0f);
+	linear[3] = srgb[3] * (1.0f / 255.0f);
 }
 
 MINLINE void srgb_to_linearrgb_uchar4_predivide(float linear[4], const unsigned char srgb[4])
 {
-	float alpha, inv_alpha;
+	float fsrgb[4];
 	int i;
 
-	if(srgb[3] == 255 || srgb[3] == 0) {
+	if (srgb[3] == 255 || srgb[3] == 0) {
 		srgb_to_linearrgb_uchar4(linear, srgb);
 		return;
 	}
 
-	alpha = srgb[3] * (1.0f/255.0f);
-	inv_alpha = 1.0f/alpha;
+	for (i = 0; i < 4; i++)
+		fsrgb[i] = srgb[i] * (1.0f / 255.0f);
+
+	srgb_to_linearrgb_predivide_v4(linear, fsrgb);
+}
 
-	for(i=0; i<3; ++i)
-		linear[i] = linearrgb_to_srgb(srgb[i] * inv_alpha) * alpha;
+/* color macros for themes */
+#define rgba_char_args_set_fl(col, r, g, b, a)  rgba_char_args_set(col, r * 255, g * 255, b * 255, a * 255)
 
-	linear[3] = alpha;
+MINLINE void rgba_char_args_set(char col[4], const char r, const char g, const char b, const char a)
+{
+	col[0] = r;
+	col[1] = g;
+	col[2] = b;
+	col[3] = a;
 }
 
-#endif /* BLI_MATH_COLOR_INLINE_H */
+MINLINE void rgba_char_args_test_set(char col[4], const char r, const char g, const char b, const char a)
+{
+	if (col[3] == 0) {
+		col[0] = r;
+		col[1] = g;
+		col[2] = b;
+		col[3] = a;
+	}
+}
 
+#endif /* __MATH_COLOR_INLINE_C__ */
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index 500e270..a81656d 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -17,7 +17,7 @@
  *
  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
  * All rights reserved.
- 
+ *
  * The Original Code is: some of this file.
  *
  * ***** END GPL LICENSE BLOCK *****
@@ -39,31 +39,31 @@
 
 void cent_tri_v3(float cent[3], const float v1[3], const float v2[3], const float v3[3])
 {
-	cent[0]= 0.33333f*(v1[0]+v2[0]+v3[0]);
-	cent[1]= 0.33333f*(v1[1]+v2[1]+v3[1]);
-	cent[2]= 0.33333f*(v1[2]+v2[2]+v3[2]);
+	cent[0] = 0.33333f * (v1[0] + v2[0] + v3[0]);
+	cent[1] = 0.33333f * (v1[1] + v2[1] + v3[1]);
+	cent[2] = 0.33333f * (v1[2] + v2[2] + v3[2]);
 }
 
 void cent_quad_v3(float cent[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3])
 {
-	cent[0]= 0.25f*(v1[0]+v2[0]+v3[0]+v4[0]);
-	cent[1]= 0.25f*(v1[1]+v2[1]+v3[1]+v4[1]);
-	cent[2]= 0.25f*(v1[2]+v2[2]+v3[2]+v4[2]);
+	cent[0] = 0.25f * (v1[0] + v2[0] + v3[0] + v4[0]);
+	cent[1] = 0.25f * (v1[1] + v2[1] + v3[1] + v4[1]);
+	cent[2] = 0.25f * (v1[2] + v2[2] + v3[2] + v4[2]);
 }
 
 float normal_tri_v3(float n[3], const float v1[3], const float v2[3], const float v3[3])
 {
-	float n1[3],n2[3];
+	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];
 
 	return normalize_v3(n);
 }
@@ -71,88 +71,90 @@ float normal_tri_v3(float n[3], const float v1[3], const float v2[3], const floa
 float normal_quad_v3(float n[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3])
 {
 	/* real cross! */
-	float n1[3],n2[3];
+	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];
 
 	return normalize_v3(n);
 }
 
 float area_tri_v2(const float v1[2], const float v2[2], const float v3[2])
 {
-	return 0.5f * fabsf((v1[0]-v2[0])*(v2[1]-v3[1]) + (v1[1]-v2[1])*(v3[0]-v2[0]));
+	return 0.5f * fabsf((v1[0] - v2[0]) * (v2[1] - v3[1]) + (v1[1] - v2[1]) * (v3[0] - v2[0]));
 }
 
 float area_tri_signed_v2(const float v1[2], const float v2[2], const float v3[2])
 {
-	return 0.5f * ((v1[0]-v2[0])*(v2[1]-v3[1]) + (v1[1]-v2[1])*(v3[0]-v2[0]));
+	return 0.5f * ((v1[0] - v2[0]) * (v2[1] - v3[1]) + (v1[1] - v2[1]) * (v3[0] - v2[0]));
 }
 
-float area_quad_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3])  /* only convex Quadrilaterals */
+/* only convex Quadrilaterals */
+float area_quad_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3])
 {
 	float len, vec1[3], vec2[3], n[3];
 
 	sub_v3_v3v3(vec1, v2, v1);
 	sub_v3_v3v3(vec2, v4, v1);
 	cross_v3_v3v3(n, vec1, vec2);
-	len= normalize_v3(n);
+	len = normalize_v3(n);
 
 	sub_v3_v3v3(vec1, v4, v3);
 	sub_v3_v3v3(vec2, v2, v3);
 	cross_v3_v3v3(n, vec1, vec2);
-	len+= normalize_v3(n);
+	len += normalize_v3(n);
 
-	return (len/2.0f);
+	return (len / 2.0f);
 }
 
-float area_tri_v3(const float v1[3], const float v2[3], const float v3[3])  /* Triangles */
+/* Triangles */
+float area_tri_v3(const float v1[3], const float v2[3], const float v3[3])
 {
 	float len, vec1[3], vec2[3], n[3];
 
 	sub_v3_v3v3(vec1, v3, v2);
 	sub_v3_v3v3(vec2, v1, v2);
 	cross_v3_v3v3(n, vec1, vec2);
-	len= normalize_v3(n);
+	len = normalize_v3(n);
 
-	return (len/2.0f);
+	return (len / 2.0f);
 }
 
 float area_poly_v3(int nr, float verts[][3], const float normal[3])
 {
 	float x, y, z, area, max;
 	float *cur, *prev;
-	int a, px=0, py=1;
+	int a, px = 0, py = 1;
 
 	/* first: find dominant axis: 0==X, 1==Y, 2==Z
 	 * don't use 'axis_dominant_v3()' because we need max axis too */
-	x= fabsf(normal[0]);
-	y= fabsf(normal[1]);
-	z= fabsf(normal[2]);
+	x = fabsf(normal[0]);
+	y = fabsf(normal[1]);
+	z = fabsf(normal[2]);
 	max = MAX3(x, y, z);
-	if(max==y) py=2;
-	else if(max==x) {
-		px=1; 
-		py= 2;
+	if (max == y) py = 2;
+	else if (max == x) {
+		px = 1;
+		py = 2;
 	}
 
 	/* The Trapezium Area Rule */
-	prev= verts[nr-1];
-	cur= verts[0];
-	area= 0;
-	for(a=0; a<nr; a++) {
-		area+= (cur[px]-prev[px])*(cur[py]+prev[py]);
-		prev= verts[a];
-		cur= verts[a+1];
+	prev = verts[nr - 1];
+	cur = verts[0];
+	area = 0;
+	for (a = 0; a < nr; a++) {
+		area += (cur[px] - prev[px]) * (cur[py] + prev[py]);
+		prev = verts[a];
+		cur = verts[a + 1];
 	}
 
 	return fabsf(0.5f * area / max);
@@ -160,18 +162,18 @@ float area_poly_v3(int nr, float verts[][3], const float normal[3])
 
 /********************************* Distance **********************************/
 
-/* distance v1 to line v2-v3 */
-/* using Hesse formula, NO LINE PIECE! */
+/* distance v1 to line v2-v3
+ * using Hesse formula, NO LINE PIECE! */
 float dist_to_line_v2(const float v1[2], const float v2[2], const float v3[2])
 {
-	float a[2],deler;
+	float a[2], deler;
 
-	a[0]= v2[1]-v3[1];
-	a[1]= v3[0]-v2[0];
-	deler= (float)sqrt(a[0]*a[0]+a[1]*a[1]);
-	if(deler== 0.0f) return 0;
+	a[0] = v2[1] - v3[1];
+	a[1] = v3[0] - v2[0];
+	deler = (float)sqrt(a[0] * a[0] + a[1] * a[1]);
+	if (deler == 0.0f) return 0;
 
-	return fabsf((v1[0]-v2[0])*a[0]+(v1[1]-v2[1])*a[1])/deler;
+	return fabsf((v1[0] - v2[0]) * a[0] + (v1[1] - v2[1]) * a[1]) / deler;
 
 }
 
@@ -179,33 +181,33 @@ float dist_to_line_v2(const float v1[2], const float v2[2], const float v3[2])
 float dist_to_line_segment_v2(const float v1[2], const float v2[2], const float v3[2])
 {
 	float labda, rc[2], pt[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) {
-		rc[0]= v1[0]-v2[0];
-		rc[1]= v1[1]-v2[1];
-		return (float)(sqrt(rc[0]*rc[0]+ rc[1]*rc[1]));
-	}
-	
-	labda= (rc[0]*(v1[0]-v2[0]) + rc[1]*(v1[1]-v2[1]))/len;
-	if(labda <= 0.0f) {
-		pt[0]= v2[0];
-		pt[1]= v2[1];
-	}
-	else if(labda >= 1.0f) {
-		pt[0]= v3[0];
-		pt[1]= v3[1];
+
+	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) {
+		rc[0] = v1[0] - v2[0];
+		rc[1] = v1[1] - v2[1];
+		return (float)(sqrt(rc[0] * rc[0] + rc[1] * rc[1]));
+	}
+
+	labda = (rc[0] * (v1[0] - v2[0]) + rc[1] * (v1[1] - v2[1])) / len;
+	if (labda <= 0.0f) {
+		pt[0] = v2[0];
+		pt[1] = v2[1];
+	}
+	else if (labda >= 1.0f) {
+		pt[0] = v3[0];
+		pt[1] = v3[1];
 	}
 	else {
-		pt[0]= labda*rc[0]+v2[0];
-		pt[1]= labda*rc[1]+v2[1];
+		pt[0] = labda * rc[0] + v2[0];
+		pt[1] = labda * rc[1] + v2[1];
 	}
 
-	rc[0]= pt[0]-v1[0];
-	rc[1]= pt[1]-v1[1];
-	return sqrtf(rc[0]*rc[0]+ rc[1]*rc[1]);
+	rc[0] = pt[0] - v1[0];
+	rc[1] = pt[1] - v1[1];
+	return sqrtf(rc[0] * rc[0] + rc[1] * rc[1]);
 }
 
 /* point closest to v1 on line v2-v3 in 2D */
@@ -213,11 +215,11 @@ void closest_to_line_segment_v2(float close_r[2], const float p[2], const float
 {
 	float lambda, cp[2];
 
-	lambda= closest_to_line_v2(cp,p, l1, l2);
+	lambda = closest_to_line_v2(cp, p, l1, l2);
 
-	if(lambda <= 0.0f)
+	if (lambda <= 0.0f)
 		copy_v2_v2(close_r, l1);
-	else if(lambda >= 1.0f)
+	else if (lambda >= 1.0f)
 		copy_v2_v2(close_r, l2);
 	else
 		copy_v2_v2(close_r, cp);
@@ -228,11 +230,11 @@ void closest_to_line_segment_v3(float close_r[3], const float v1[3], const float
 {
 	float lambda, cp[3];
 
-	lambda= closest_to_line_v3(cp,v1, v2, v3);
+	lambda = closest_to_line_v3(cp, v1, v2, v3);
 
-	if(lambda <= 0.0f)
+	if (lambda <= 0.0f)
 		copy_v3_v3(close_r, v2);
-	else if(lambda >= 1.0f)
+	else if (lambda >= 1.0f)
 		copy_v3_v3(close_r, v3);
 	else
 		copy_v3_v3(close_r, cp);
@@ -245,14 +247,13 @@ void closest_to_line_segment_v3(float close_r[3], const float v1[3], const float
  * pt:            the point that you want the nearest of
  */
 
-// const float norm[3], const float coord[3], const float point[3], float dst_r[3]
 void closest_to_plane_v3(float close_r[3], const float plane_co[3], const float plane_no_unit[3], const float pt[3])
 {
 	float temp[3];
 	float dotprod;
 
 	sub_v3_v3v3(temp, pt, plane_co);
-	dotprod= dot_v3v3(temp, plane_no_unit);
+	dotprod = dot_v3v3(temp, plane_no_unit);
 
 	close_r[0] = pt[0] - (plane_no_unit[0] * dotprod);
 	close_r[1] = pt[1] - (plane_no_unit[1] * dotprod);
@@ -296,16 +297,16 @@ float dist_to_line_segment_v3(const float v1[3], const float v2[3], const float
 int isect_line_line_v2_int(const int v1[2], const int v2[2], const int v3[2], const int v4[2])
 {
 	float div, labda, mu;
-	
-	div= (float)((v2[0]-v1[0])*(v4[1]-v3[1])-(v2[1]-v1[1])*(v4[0]-v3[0]));
-	if(div==0.0f) return ISECT_LINE_LINE_COLINEAR;
-	
-	labda= ((float)(v1[1]-v3[1])*(v4[0]-v3[0])-(v1[0]-v3[0])*(v4[1]-v3[1]))/div;
-	
-	mu= ((float)(v1[1]-v3[1])*(v2[0]-v1[0])-(v1[0]-v3[0])*(v2[1]-v1[1]))/div;
-	
-	if(labda>=0.0f && labda<=1.0f && mu>=0.0f && mu<=1.0f) {
-		if(labda==0.0f || labda==1.0f || mu==0.0f || mu==1.0f) return ISECT_LINE_LINE_EXACT;
+
+	div = (float)((v2[0] - v1[0]) * (v4[1] - v3[1]) - (v2[1] - v1[1]) * (v4[0] - v3[0]));
+	if (div == 0.0f) return ISECT_LINE_LINE_COLINEAR;
+
+	labda = ((float)(v1[1] - v3[1]) * (v4[0] - v3[0]) - (v1[0] - v3[0]) * (v4[1] - v3[1])) / div;
+
+	mu = ((float)(v1[1] - v3[1]) * (v2[0] - v1[0]) - (v1[0] - v3[0]) * (v2[1] - v1[1])) / div;
+
+	if (labda >= 0.0f && labda <= 1.0f && mu >= 0.0f && mu <= 1.0f) {
+		if (labda == 0.0f || labda == 1.0f || mu == 0.0f || mu == 1.0f) return ISECT_LINE_LINE_EXACT;
 		return ISECT_LINE_LINE_CROSS;
 	}
 	return ISECT_LINE_LINE_NONE;
@@ -315,52 +316,54 @@ int isect_line_line_v2_int(const int v1[2], const int v2[2], const int v3[2], co
 int isect_line_line_v2(const float v1[2], const float v2[2], const float v3[2], const float v4[2])
 {
 	float div, labda, mu;
-	
-	div= (v2[0]-v1[0])*(v4[1]-v3[1])-(v2[1]-v1[1])*(v4[0]-v3[0]);
-	if(div==0.0f) return ISECT_LINE_LINE_COLINEAR;
-	
-	labda= ((float)(v1[1]-v3[1])*(v4[0]-v3[0])-(v1[0]-v3[0])*(v4[1]-v3[1]))/div;
-	
-	mu= ((float)(v1[1]-v3[1])*(v2[0]-v1[0])-(v1[0]-v3[0])*(v2[1]-v1[1]))/div;
-	
-	if(labda>=0.0f && labda<=1.0f && mu>=0.0f && mu<=1.0f) {
-		if(labda==0.0f || labda==1.0f || mu==0.0f || mu==1.0f) return ISECT_LINE_LINE_EXACT;
+
+	div = (v2[0] - v1[0]) * (v4[1] - v3[1]) - (v2[1] - v1[1]) * (v4[0] - v3[0]);
+	if (div == 0.0f) return ISECT_LINE_LINE_COLINEAR;
+
+	labda = ((float)(v1[1] - v3[1]) * (v4[0] - v3[0]) - (v1[0] - v3[0]) * (v4[1] - v3[1])) / div;
+
+	mu = ((float)(v1[1] - v3[1]) * (v2[0] - v1[0]) - (v1[0] - v3[0]) * (v2[1] - v1[1])) / div;
+
+	if (labda >= 0.0f && labda <= 1.0f && mu >= 0.0f && mu <= 1.0f) {
+		if (labda == 0.0f || labda == 1.0f || mu == 0.0f || mu == 1.0f) return ISECT_LINE_LINE_EXACT;
 		return ISECT_LINE_LINE_CROSS;
 	}
 	return ISECT_LINE_LINE_NONE;
 }
 
 /* get intersection point of two 2D segments and return intersection type:
-    -1: colliniar
-     1: intersection */
+ *  -1: colliniar
+ *   1: intersection
+ */
 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])
 {
 	float a1, a2, b1, b2, c1, c2, d;
 	float u, v;
-	const float eps= 0.000001f;
+	const float eps = 0.000001f;
 
-	a1= v2[0]-v1[0];
-	b1= v4[0]-v3[0];
-	c1= v1[0]-v4[0];
+	a1 = v2[0] - v1[0];
+	b1 = v4[0] - v3[0];
+	c1 = v1[0] - v4[0];
 
-	a2= v2[1]-v1[1];
-	b2= v4[1]-v3[1];
-	c2= v1[1]-v4[1];
+	a2 = v2[1] - v1[1];
+	b2 = v4[1] - v3[1];
+	c2 = v1[1] - v4[1];
 
-	d= a1*b2-a2*b1;
+	d = a1 * b2 - a2 * b1;
 
-	if(d==0) {
-		if(a1*c2-a2*c1==0.0f && b1*c2-b2*c1==0.0f) { /* equal lines */
+	if (d == 0) {
+		if (a1 * c2 - a2 * c1 == 0.0f && b1 * c2 - b2 * c1 == 0.0f) { /* equal lines */
 			float a[2], b[2], c[2];
 			float u2;
 
-			if(len_v2v2(v1, v2)==0.0f) {
-				if(len_v2v2(v3, v4)>eps) {
+			if (len_v2v2(v1, v2) == 0.0f) {
+				if (len_v2v2(v3, v4) > eps) {
 					/* use non-point segment as basis */
 					SWAP(const float *, v1, v3);
 					SWAP(const float *, v2, v4);
-				} else { /* both of segments are points */
-					if(equals_v2v2(v1, v3)) { /* points are equal */
+				}
+				else { /* both of segments are points */
+					if (equals_v2v2(v1, v3)) { /* points are equal */
 						copy_v2_v2(vi, v1);
 						return 1;
 					}
@@ -373,15 +376,15 @@ int isect_seg_seg_v2_point(const float v1[2], const float v2[2], const float v3[
 			sub_v2_v2v2(a, v3, v1);
 			sub_v2_v2v2(b, v2, v1);
 			sub_v2_v2v2(c, v2, v1);
-			u= dot_v2v2(a, b) / dot_v2v2(c, c);
+			u = dot_v2v2(a, b) / dot_v2v2(c, c);
 
 			sub_v2_v2v2(a, v4, v1);
-			u2= dot_v2v2(a, b) / dot_v2v2(c, c);
+			u2 = dot_v2v2(a, b) / dot_v2v2(c, c);
 
-			if(u>u2) SWAP(float, u, u2);
+			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 */
+			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));
 				return 1;
 			}
@@ -391,10 +394,10 @@ int isect_seg_seg_v2_point(const float v1[2], const float v2[2], const float v3[
 		return -1;
 	}
 
-	u= (c2*b1-b2*c1)/d;
-	v= (c1*a2-a1*c2)/d;
+	u = (c2 * b1 - b2 * c1) / d;
+	v = (c1 * a2 - a1 * c2) / d;
 
-	if(u>=-eps && u<=1.0f+eps && v>=-eps && v<=1.0f+eps) { /* intersection */
+	if (u >= -eps && u <= 1.0f + eps && v >= -eps && v <= 1.0f + eps) { /* intersection */
 		interp_v2_v2v2(vi, v1, v2, u);
 		return 1;
 	}
@@ -425,20 +428,20 @@ int isect_line_sphere_v3(const float l1[3], const float l2[3],
 	 * Paul Bourke pbourke at swin.edu.au
 	 */
 
-	const float ldir[3]= {
+	const float ldir[3] = {
 	    l2[0] - l1[0],
 	    l2[1] - l1[1],
 	    l2[2] - l1[2]
 	};
 
-	const float a= dot_v3v3(ldir, ldir);
+	const float a = dot_v3v3(ldir, ldir);
 
-	const float b= 2.0f *
+	const float b = 2.0f *
 	        (ldir[0] * (l1[0] - sp[0]) +
 	         ldir[1] * (l1[1] - sp[1]) +
 	         ldir[2] * (l1[2] - sp[2]));
 
-	const float c=
+	const float c =
 	        dot_v3v3(sp, sp) +
 	        dot_v3v3(l1, l1) -
 	        (2.0f * dot_v3v3(sp, l1)) -
@@ -459,7 +462,7 @@ int isect_line_sphere_v3(const float l1[3], const float l2[3],
 		return 1;
 	}
 	else if (i > 0.0f) {
-		const float i_sqrt= sqrt(i); /* avoid calc twice */
+		const float i_sqrt = sqrt(i); /* avoid calc twice */
 
 		/* first intersection */
 		mu = (-b + i_sqrt) / (2.0f * a);
@@ -481,18 +484,16 @@ int isect_line_sphere_v2(const float l1[2], const float l2[2],
                          const float sp[2], const float r,
                          float r_p1[2], float r_p2[2])
 {
-	const float ldir[2]= {
-	    l2[0] - l1[0],
-	    l2[1] - l1[1]
-	};
+	const float ldir[2] = {l2[0] - l1[0],
+	                       l2[1] - l1[1]};
 
-	const float a= dot_v2v2(ldir, ldir);
+	const float a = dot_v2v2(ldir, ldir);
 
-	const float b= 2.0f *
+	const float b = 2.0f *
 	        (ldir[0] * (l1[0] - sp[0]) +
 	         ldir[1] * (l1[1] - sp[1]));
 
-	const float c=
+	const float c =
 	        dot_v2v2(sp, sp) +
 	        dot_v2v2(l1, l1) -
 	        (2.0f * dot_v2v2(sp, l1)) -
@@ -513,7 +514,7 @@ int isect_line_sphere_v2(const float l1[2], const float l2[2],
 		return 1;
 	}
 	else if (i > 0.0f) {
-		const float i_sqrt= sqrt(i); /* avoid calc twice */
+		const float i_sqrt = sqrt(i); /* avoid calc twice */
 
 		/* first intersection */
 		mu = (-b + i_sqrt) / (2.0f * a);
@@ -531,107 +532,109 @@ int isect_line_sphere_v2(const float l1[2], const float l2[2],
 }
 
 /*
--1: colliniar
- 1: intersection
-
-*/
+ * -1: colliniar
+ *  1: intersection
+ */
 static short IsectLLPt2Df(const float x0, const float y0, const float x1, const float y1,
-					 const float x2, const float y2, const float x3, const float y3, float *xi,float *yi)
+                          const float x2, const float y2, const float x3, const float y3, float *xi, float *yi)
 
 {
 	/*
-	this function computes the intersection of the sent lines
-	and returns the intersection point, note that the function assumes
-	the lines intersect. the function can handle vertical as well
-	as horizontal lines. note the function isn't very clever, it simply
-	applies the math, but we don't need speed since this is a
-	pre-processing step
-	*/
-	float c1,c2, // constants of linear equations
-	det_inv,  // the inverse of the determinant of the coefficient
-	m1,m2;    // the slopes of each line
+	 * this function computes the intersection of the sent lines
+	 * and returns the intersection point, note that the function assumes
+	 * the lines intersect. the function can handle vertical as well
+	 * as horizontal lines. note the function isn't very clever, it simply
+	 * applies the math, but we don't need speed since this is a
+	 * pre-processing step
+	 */
+	float c1, c2; /* constants of linear equations */
+	float det_inv; /* the inverse of the determinant of the coefficient */
+	float m1, m2; /* the slopes of each line */
 	/*
-	compute slopes, note the cludge for infinity, however, this will
-	be close enough
-	*/
-	if (fabs(x1-x0) > 0.000001)
-		m1 = (y1-y0) / (x1-x0);
+	 * compute slopes, note the cludge for infinity, however, this will
+	 * be close enough
+	 */
+	if (fabs(x1 - x0) > 0.000001)
+		m1 = (y1 - y0) / (x1 - x0);
 	else
-		return -1; /*m1 = (float) 1e+10;*/   // close enough to infinity
+		return -1; /*m1 = (float)1e+10;*/ // close enough to infinity
 
-	if (fabs(x3-x2) > 0.000001)
-		m2 = (y3-y2) / (x3-x2);
+	if (fabs(x3 - x2) > 0.000001)
+		m2 = (y3 - y2) / (x3 - x2);
 	else
-		return -1; /*m2 = (float) 1e+10;*/   // close enough to infinity
+		return -1; /*m2 = (float)1e+10;*/ // close enough to infinity
 
-	if (fabs(m1-m2) < 0.000001)
-		return -1; /* parallel lines */
-	
-// compute constants
+	if (fabs(m1 - m2) < 0.000001)
+		return -1;  /* parallel lines */
 
-	c1 = (y0-m1*x0);
-	c2 = (y2-m2*x2);
+	// compute constants
 
-// compute the inverse of the determinate
+	c1 = (y0 - m1 * x0);
+	c2 = (y2 - m2 * x2);
+
+	// compute the inverse of the determinate
 
 	det_inv = 1.0f / (-m1 + m2);
 
-// use Kramers rule to compute xi and yi
+	// use Kramers rule to compute xi and yi
+
+	*xi = ((-c2 + c1) * det_inv);
+	*yi = ((m2 * c1 - m1 * c2) * det_inv);
 
-	*xi= ((-c2 + c1) *det_inv);
-	*yi= ((m2*c1 - m1*c2) *det_inv);
-	
-	return 1; 
-} // end Intersect_Lines
+	return 1;
+}
 
 /* point in tri */
 
 int isect_point_tri_v2(const float pt[2], const float v1[2], const float v2[2], const float v3[2])
 {
-	if (line_point_side_v2(v1,v2,pt)>=0.0f) {
-		if (line_point_side_v2(v2,v3,pt)>=0.0f) {
-			if (line_point_side_v2(v3,v1,pt)>=0.0f) {
+	if (line_point_side_v2(v1, v2, pt) >= 0.0f) {
+		if (line_point_side_v2(v2, v3, pt) >= 0.0f) {
+			if (line_point_side_v2(v3, v1, pt) >= 0.0f) {
 				return 1;
 			}
 		}
-	} else {
-		if (! (line_point_side_v2(v2,v3,pt)>=0.0f)) {
-			if (! (line_point_side_v2(v3,v1,pt)>=0.0f)) {
+	}
+	else {
+		if (!(line_point_side_v2(v2, v3, pt) >= 0.0f)) {
+			if (!(line_point_side_v2(v3, v1, pt) >= 0.0f)) {
 				return -1;
 			}
 		}
 	}
-	
+
 	return 0;
 }
+
 /* point in quad - only convex quads */
 int isect_point_quad_v2(const float pt[2], const float v1[2], const float v2[2], const float v3[2], const float v4[2])
 {
-	if (line_point_side_v2(v1,v2,pt)>=0.0f) {
-		if (line_point_side_v2(v2,v3,pt)>=0.0f) {
-			if (line_point_side_v2(v3,v4,pt)>=0.0f) {
-				if (line_point_side_v2(v4,v1,pt)>=0.0f) {
+	if (line_point_side_v2(v1, v2, pt) >= 0.0f) {
+		if (line_point_side_v2(v2, v3, pt) >= 0.0f) {
+			if (line_point_side_v2(v3, v4, pt) >= 0.0f) {
+				if (line_point_side_v2(v4, v1, pt) >= 0.0f) {
 					return 1;
 				}
 			}
 		}
-	} else {
-		if (! (line_point_side_v2(v2,v3,pt)>=0.0f)) {
-			if (! (line_point_side_v2(v3,v4,pt)>=0.0f)) {
-				if (! (line_point_side_v2(v4,v1,pt)>=0.0f)) {
+	}
+	else {
+		if (!(line_point_side_v2(v2, v3, pt) >= 0.0f)) {
+			if (!(line_point_side_v2(v3, v4, pt) >= 0.0f)) {
+				if (!(line_point_side_v2(v4, v1, pt) >= 0.0f)) {
 					return -1;
 				}
 			}
 		}
 	}
-	
+
 	return 0;
 }
 
 /* moved from effect.c
-   test if the line starting at p1 ending at p2 intersects the triangle v0..v2
-   return non zero if it does 
-*/
+ * test if the line starting at p1 ending at p2 intersects the triangle v0..v2
+ * return non zero if it does
+ */
 int isect_line_tri_v3(const float p1[3], const float p2[3],
                       const float v0[3], const float v1[3], const float v2[3],
                       float *r_lambda, float r_uv[2])
@@ -639,75 +642,76 @@ int isect_line_tri_v3(const float p1[3], const float p2[3],
 
 	float p[3], s[3], d[3], e1[3], e2[3], q[3];
 	float a, f, u, v;
-	
+
 	sub_v3_v3v3(e1, v1, v0);
 	sub_v3_v3v3(e2, v2, v0);
 	sub_v3_v3v3(d, p2, p1);
-	
+
 	cross_v3_v3v3(p, d, e2);
 	a = dot_v3v3(e1, p);
 	if ((a > -0.000001f) && (a < 0.000001f)) return 0;
-	f = 1.0f/a;
-	
+	f = 1.0f / a;
+
 	sub_v3_v3v3(s, p1, v0);
-	
+
 	u = f * dot_v3v3(s, p);
-	if ((u < 0.0f)||(u > 1.0f)) return 0;
-	
+	if ((u < 0.0f) || (u > 1.0f)) return 0;
+
 	cross_v3_v3v3(q, s, e1);
-	
+
 	v = f * dot_v3v3(d, q);
-	if ((v < 0.0f)||((u + v) > 1.0f)) return 0;
+	if ((v < 0.0f) || ((u + v) > 1.0f)) return 0;
 
 	*r_lambda = f * dot_v3v3(e2, q);
-	if ((*r_lambda < 0.0f)||(*r_lambda > 1.0f)) return 0;
+	if ((*r_lambda < 0.0f) || (*r_lambda > 1.0f)) return 0;
 
-	if(r_uv) {
-		r_uv[0]= u;
-		r_uv[1]= v;
+	if (r_uv) {
+		r_uv[0] = u;
+		r_uv[1] = v;
 	}
-	
+
 	return 1;
 }
+
 /* moved from effect.c
-   test if the ray starting at p1 going in d direction intersects the triangle v0..v2
-   return non zero if it does 
-*/
+ * test if the ray starting at p1 going in d direction intersects the triangle v0..v2
+ * return non zero if it does
+ */
 int isect_ray_tri_v3(const float p1[3], const float d[3],
                      const float v0[3], const float v1[3], const float v2[3],
                      float *r_lambda, float r_uv[2])
 {
 	float p[3], s[3], e1[3], e2[3], q[3];
 	float a, f, u, v;
-	
+
 	sub_v3_v3v3(e1, v1, v0);
 	sub_v3_v3v3(e2, v2, v0);
-	
+
 	cross_v3_v3v3(p, d, e2);
 	a = dot_v3v3(e1, p);
 	/* note: these values were 0.000001 in 2.4x but for projection snapping on
 	 * a human head (1BU==1m), subsurf level 2, this gave many errors - campbell */
 	if ((a > -0.00000001f) && (a < 0.00000001f)) return 0;
-	f = 1.0f/a;
-	
+	f = 1.0f / a;
+
 	sub_v3_v3v3(s, p1, v0);
-	
+
 	u = f * dot_v3v3(s, p);
-	if ((u < 0.0f)||(u > 1.0f)) return 0;
+	if ((u < 0.0f) || (u > 1.0f)) return 0;
 
 	cross_v3_v3v3(q, s, e1);
-	
+
 	v = f * dot_v3v3(d, q);
-	if ((v < 0.0f)||((u + v) > 1.0f)) return 0;
+	if ((v < 0.0f) || ((u + v) > 1.0f)) return 0;
 
 	*r_lambda = f * dot_v3v3(e2, q);
 	if ((*r_lambda < 0.0f)) return 0;
 
-	if(r_uv) {
-		r_uv[0]= u;
-		r_uv[1]= v;
+	if (r_uv) {
+		r_uv[0] = u;
+		r_uv[1] = v;
 	}
-	
+
 	return 1;
 }
 
@@ -721,20 +725,20 @@ int isect_ray_plane_v3(const float p1[3], const float d[3],
 
 	sub_v3_v3v3(e1, v1, v0);
 	sub_v3_v3v3(e2, v2, v0);
-	
+
 	cross_v3_v3v3(p, d, e2);
 	a = dot_v3v3(e1, p);
 	/* note: these values were 0.000001 in 2.4x but for projection snapping on
 	 * a human head (1BU==1m), subsurf level 2, this gave many errors - campbell */
 	if ((a > -0.00000001f) && (a < 0.00000001f)) return 0;
-	f = 1.0f/a;
-	
+	f = 1.0f / a;
+
 	sub_v3_v3v3(s, p1, v0);
-	
+
 	/* u = f * dot_v3v3(s, p); */ /*UNUSED*/
 
 	cross_v3_v3v3(q, s, e1);
-	
+
 	/* v = f * dot_v3v3(d, q); */ /*UNUSED*/
 
 	*r_lambda = f * dot_v3v3(e2, q);
@@ -756,24 +760,24 @@ int isect_ray_tri_epsilon_v3(const float p1[3], const float d[3],
 	cross_v3_v3v3(p, d, e2);
 	a = dot_v3v3(e1, p);
 	if (a == 0.0f) return 0;
-	f = 1.0f/a;
+	f = 1.0f / a;
 
 	sub_v3_v3v3(s, p1, v0);
 
 	u = f * dot_v3v3(s, p);
-	if ((u < -epsilon)||(u > 1.0f+epsilon)) return 0;
+	if ((u < -epsilon) || (u > 1.0f + epsilon)) return 0;
 
 	cross_v3_v3v3(q, s, e1);
 
 	v = f * dot_v3v3(d, q);
-	if ((v < -epsilon)||((u + v) > 1.0f+epsilon)) return 0;
+	if ((v < -epsilon) || ((u + v) > 1.0f + epsilon)) return 0;
 
 	*r_lambda = f * dot_v3v3(e2, q);
 	if ((*r_lambda < 0.0f)) return 0;
 
-	if(uv) {
-		uv[0]= u;
-		uv[1]= v;
+	if (uv) {
+		uv[0] = u;
+		uv[1] = v;
 	}
 
 	return 1;
@@ -786,52 +790,52 @@ int isect_ray_tri_threshold_v3(const float p1[3], const float d[3],
 	float p[3], s[3], e1[3], e2[3], q[3];
 	float a, f, u, v;
 	float du = 0, dv = 0;
-	
+
 	sub_v3_v3v3(e1, v1, v0);
 	sub_v3_v3v3(e2, v2, v0);
-	
+
 	cross_v3_v3v3(p, d, e2);
 	a = dot_v3v3(e1, p);
 	if ((a > -0.000001f) && (a < 0.000001f)) return 0;
-	f = 1.0f/a;
-	
+	f = 1.0f / a;
+
 	sub_v3_v3v3(s, p1, v0);
-	
+
 	cross_v3_v3v3(q, s, e1);
 	*r_lambda = f * dot_v3v3(e2, q);
 	if ((*r_lambda < 0.0f)) return 0;
-	
+
 	u = f * dot_v3v3(s, p);
 	v = f * dot_v3v3(d, q);
-	
+
 	if (u < 0) du = u;
 	if (u > 1) du = u - 1;
 	if (v < 0) dv = v;
 	if (v > 1) dv = v - 1;
-	if (u > 0 && v > 0 && u + v > 1)
-	{
+	if (u > 0 && v > 0 && u + v > 1) {
 		float t = u + v - 1;
-		du = u - t/2;
-		dv = v - t/2;
+		du = u - t / 2;
+		dv = v - t / 2;
 	}
 
 	mul_v3_fl(e1, du);
 	mul_v3_fl(e2, dv);
-	
-	if (dot_v3v3(e1, e1) + dot_v3v3(e2, e2) > threshold * threshold)
-	{
+
+	if (dot_v3v3(e1, e1) + dot_v3v3(e2, e2) > threshold * threshold) {
 		return 0;
 	}
 
-	if(r_uv) {
-		r_uv[0]= u;
-		r_uv[1]= v;
+	if (r_uv) {
+		r_uv[0] = u;
+		r_uv[1] = v;
 	}
-	
+
 	return 1;
 }
 
-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)
+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)
 {
 	float l_vec[3]; /* l1 -> l2 normalized vector */
 	float p_no[3]; /* 'plane_no' normalized */
@@ -842,18 +846,18 @@ int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3], cons
 	normalize_v3(l_vec);
 	normalize_v3_v3(p_no, plane_no);
 
-	dot= dot_v3v3(l_vec, p_no);
-	if(dot == 0.0f) {
+	dot = dot_v3v3(l_vec, p_no);
+	if (dot == 0.0f) {
 		return 0;
 	}
 	else {
 		float l1_plane[3]; /* line point aligned with the plane */
 		float dist; /* 'plane_no' aligned distance to the 'plane_co' */
 
-		/* for pradictable flipping since the plane is only used to
+		/* for predictable flipping since the plane is only used to
 		 * define a direction, ignore its flipping and aligned with 'l_vec' */
-		if(dot < 0.0f) {
-			dot= -dot;
+		if (dot < 0.0f) {
+			dot = -dot;
 			negate_v3(p_no);
 		}
 
@@ -862,8 +866,8 @@ int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3], cons
 		dist = line_point_factor_v3(plane_co, l1, l1_plane);
 
 		/* treat line like a ray, when 'no_flip' is set */
-		if(no_flip && dist < 0.0f) {
-			dist= -dist;
+		if (no_flip && dist < 0.0f) {
+			dist = -dist;
 		}
 
 		mul_v3_fl(l_vec, dist / dot);
@@ -874,7 +878,7 @@ int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3], cons
 	}
 }
 
-/* note: return normal isnt unit length */
+/* 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])
@@ -888,36 +892,34 @@ void isect_plane_plane_v3(float r_isect_co[3], float r_isect_no[3],
 
 
 /* Adapted from the paper by Kasper Fauerby */
+
 /* "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
-	float determinant = b*b - 4.0f*a*c;
+	float determinant = b * b - 4.0f * a * c;
 
 	// If determinant is negative it means no solutions.
-	if (determinant >= 0.0f)
-	{
+	if (determinant >= 0.0f) {
 		// calculate the two roots: (if determinant == 0 then
 		// x1==x2 but lets disregard that slight optimization)
 		float sqrtD = (float)sqrt(determinant);
-		float r1 = (-b - sqrtD) / (2.0f*a);
-		float r2 = (-b + sqrtD) / (2.0f*a);
-		
+		float r1 = (-b - sqrtD) / (2.0f * a);
+		float r2 = (-b + sqrtD) / (2.0f * a);
+
 		// Sort so x1 <= x2
 		if (r1 > r2)
 			SWAP(float, r1, r2);
 
 		// Get lowest root:
-		if (r1 > 0.0f && r1 < maxR)
-		{
+		if (r1 > 0.0f && r1 < maxR) {
 			*root = r1;
 			return 1;
 		}
 
 		// It is possible that we want x2 - this can happen
 		// if x1 < 0
-		if (r2 > 0.0f && r2 < maxR)
-		{
+		if (r2 > 0.0f && r2 < maxR) {
 			*root = r2;
 			return 1;
 		}
@@ -926,46 +928,43 @@ static int getLowestRoot(const float a, const float b, const float c, const floa
 	return 0;
 }
 
-int isect_sweeping_sphere_tri_v3(
-        const float p1[3], const float p2[3], const float radius,
-        const float v0[3], const float v1[3], const float v2[3],
-        float *r_lambda, float ipoint[3])
+int isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const float radius,
+                                 const float v0[3], const float v1[3], const float v2[3],
+                                 float *r_lambda, float ipoint[3])
 {
 	float e1[3], e2[3], e3[3], point[3], vel[3], /*dist[3],*/ nor[3], temp[3], bv[3];
-	float a, b, c, d, e, x, y, z, radius2=radius*radius;
-	float elen2,edotv,edotbv,nordotv;
+	float a, b, c, d, e, x, y, z, radius2 = radius * radius;
+	float elen2, edotv, edotbv, nordotv;
 	float newLambda;
-	int found_by_sweep=0;
+	int found_by_sweep = 0;
 
-	sub_v3_v3v3(e1,v1,v0);
-	sub_v3_v3v3(e2,v2,v0);
-	sub_v3_v3v3(vel,p2,p1);
+	sub_v3_v3v3(e1, v1, v0);
+	sub_v3_v3v3(e2, v2, v0);
+	sub_v3_v3v3(vel, p2, p1);
 
-/*---test plane of tri---*/
-	cross_v3_v3v3(nor,e1,e2);
+	/*---test plane of tri---*/
+	cross_v3_v3v3(nor, e1, e2);
 	normalize_v3(nor);
 
 	/* flip normal */
-	if(dot_v3v3(nor,vel)>0.0f) negate_v3(nor);
-	
-	a=dot_v3v3(p1,nor)-dot_v3v3(v0,nor);
-	nordotv=dot_v3v3(nor,vel);
+	if (dot_v3v3(nor, vel) > 0.0f) negate_v3(nor);
 
-	if (fabsf(nordotv) < 0.000001f)
-	{
-		if(fabsf(a) >= radius) {
+	a = dot_v3v3(p1, nor) - dot_v3v3(v0, nor);
+	nordotv = dot_v3v3(nor, vel);
+
+	if (fabsf(nordotv) < 0.000001f) {
+		if (fabsf(a) >= radius) {
 			return 0;
 		}
 	}
-	else
-	{
-		float t0=(-a+radius)/nordotv;
-		float t1=(-a-radius)/nordotv;
+	else {
+		float t0 = (-a + radius) / nordotv;
+		float t1 = (-a - radius) / nordotv;
 
-		if(t0>t1)
+		if (t0 > t1)
 			SWAP(float, t0, t1);
 
-		if(t0>1.0f || t1<0.0f) return 0;
+		if (t0 > 1.0f || t1 < 0.0f) return 0;
 
 		/* clamp to [0,1] */
 		CLAMP(t0, 0.0f, 1.0f);
@@ -974,123 +973,115 @@ int isect_sweeping_sphere_tri_v3(
 		/*---test inside of tri---*/
 		/* plane intersection point */
 
-		point[0] = p1[0] + vel[0]*t0 - nor[0]*radius;
-		point[1] = p1[1] + vel[1]*t0 - nor[1]*radius;
-		point[2] = p1[2] + vel[2]*t0 - nor[2]*radius;
+		point[0] = p1[0] + vel[0] * t0 - nor[0] * radius;
+		point[1] = p1[1] + vel[1] * t0 - nor[1] * radius;
+		point[2] = p1[2] + vel[2] * t0 - nor[2] * radius;
 
 
 		/* is the point in the tri? */
-		a=dot_v3v3(e1,e1);
-		b=dot_v3v3(e1,e2);
-		c=dot_v3v3(e2,e2);
+		a = dot_v3v3(e1, e1);
+		b = dot_v3v3(e1, e2);
+		c = dot_v3v3(e2, e2);
 
-		sub_v3_v3v3(temp,point,v0);
-		d=dot_v3v3(temp,e1);
-		e=dot_v3v3(temp,e2);
-		
-		x=d*c-e*b;
-		y=e*a-d*b;
-		z=x+y-(a*c-b*b);
+		sub_v3_v3v3(temp, point, v0);
+		d = dot_v3v3(temp, e1);
+		e = dot_v3v3(temp, e2);
 
+		x = d * c - e * b;
+		y = e * a - d * b;
+		z = x + y - (a * c - b * b);
 
-		if(z <= 0.0f && (x >= 0.0f && y >= 0.0f))
-		{
-		//(((unsigned int)z)& ~(((unsigned int)x)|((unsigned int)y))) & 0x80000000){
-			*r_lambda=t0;
-			copy_v3_v3(ipoint,point);
+
+		if (z <= 0.0f && (x >= 0.0f && y >= 0.0f)) {
+			//(((unsigned int)z)& ~(((unsigned int)x)|((unsigned int)y))) & 0x80000000) {
+			*r_lambda = t0;
+			copy_v3_v3(ipoint, point);
 			return 1;
 		}
 	}
 
 
-	*r_lambda=1.0f;
+	*r_lambda = 1.0f;
 
-/*---test points---*/
-	a=dot_v3v3(vel,vel);
+	/*---test points---*/
+	a = dot_v3v3(vel, vel);
 
 	/*v0*/
-	sub_v3_v3v3(temp,p1,v0);
-	b=2.0f*dot_v3v3(vel,temp);
-	c=dot_v3v3(temp,temp)-radius2;
+	sub_v3_v3v3(temp, p1, v0);
+	b = 2.0f * dot_v3v3(vel, temp);
+	c = dot_v3v3(temp, temp) - radius2;
 
-	if(getLowestRoot(a, b, c, *r_lambda, r_lambda))
-	{
-		copy_v3_v3(ipoint,v0);
-		found_by_sweep=1;
+	if (getLowestRoot(a, b, c, *r_lambda, r_lambda)) {
+		copy_v3_v3(ipoint, v0);
+		found_by_sweep = 1;
 	}
 
 	/*v1*/
-	sub_v3_v3v3(temp,p1,v1);
-	b=2.0f*dot_v3v3(vel,temp);
-	c=dot_v3v3(temp,temp)-radius2;
+	sub_v3_v3v3(temp, p1, v1);
+	b = 2.0f * dot_v3v3(vel, temp);
+	c = dot_v3v3(temp, temp) - radius2;
 
-	if(getLowestRoot(a, b, c, *r_lambda, r_lambda))
-	{
-		copy_v3_v3(ipoint,v1);
-		found_by_sweep=1;
+	if (getLowestRoot(a, b, c, *r_lambda, r_lambda)) {
+		copy_v3_v3(ipoint, v1);
+		found_by_sweep = 1;
 	}
-	
+
 	/*v2*/
-	sub_v3_v3v3(temp,p1,v2);
-	b=2.0f*dot_v3v3(vel,temp);
-	c=dot_v3v3(temp,temp)-radius2;
+	sub_v3_v3v3(temp, p1, v2);
+	b = 2.0f * dot_v3v3(vel, temp);
+	c = dot_v3v3(temp, temp) - radius2;
 
-	if(getLowestRoot(a, b, c, *r_lambda, r_lambda))
-	{
-		copy_v3_v3(ipoint,v2);
-		found_by_sweep=1;
+	if (getLowestRoot(a, b, c, *r_lambda, r_lambda)) {
+		copy_v3_v3(ipoint, v2);
+		found_by_sweep = 1;
 	}
 
-/*---test edges---*/
-	sub_v3_v3v3(e3,v2,v1); //wasnt yet calculated
+	/*---test edges---*/
+	sub_v3_v3v3(e3, v2, v1); //wasnt yet calculated
 
 
 	/*e1*/
-	sub_v3_v3v3(bv,v0,p1);
+	sub_v3_v3v3(bv, v0, p1);
 
-	elen2 = dot_v3v3(e1,e1);
-	edotv = dot_v3v3(e1,vel);
-	edotbv = dot_v3v3(e1,bv);
+	elen2 = dot_v3v3(e1, e1);
+	edotv = dot_v3v3(e1, vel);
+	edotbv = dot_v3v3(e1, bv);
 
-	a=elen2*(-dot_v3v3(vel,vel))+edotv*edotv;
-	b=2.0f*(elen2*dot_v3v3(vel,bv)-edotv*edotbv);
-	c=elen2*(radius2-dot_v3v3(bv,bv))+edotbv*edotbv;
+	a = elen2 * (-dot_v3v3(vel, vel)) + edotv * edotv;
+	b = 2.0f * (elen2 * dot_v3v3(vel, bv) - edotv * edotbv);
+	c = elen2 * (radius2 - dot_v3v3(bv, bv)) + edotbv * edotbv;
 
-	if(getLowestRoot(a, b, c, *r_lambda, &newLambda))
-	{
-		e=(edotv*newLambda-edotbv)/elen2;
+	if (getLowestRoot(a, b, c, *r_lambda, &newLambda)) {
+		e = (edotv * newLambda - edotbv) / elen2;
 
-		if(e >= 0.0f && e <= 1.0f)
-		{
+		if (e >= 0.0f && e <= 1.0f) {
 			*r_lambda = newLambda;
-			copy_v3_v3(ipoint,e1);
-			mul_v3_fl(ipoint,e);
+			copy_v3_v3(ipoint, e1);
+			mul_v3_fl(ipoint, e);
 			add_v3_v3(ipoint, v0);
-			found_by_sweep=1;
+			found_by_sweep = 1;
 		}
 	}
 
 	/*e2*/
 	/*bv is same*/
-	elen2 = dot_v3v3(e2,e2);
-	edotv = dot_v3v3(e2,vel);
-	edotbv = dot_v3v3(e2,bv);
+	elen2 = dot_v3v3(e2, e2);
+	edotv = dot_v3v3(e2, vel);
+	edotbv = dot_v3v3(e2, bv);
 
-	a=elen2*(-dot_v3v3(vel,vel))+edotv*edotv;
-	b=2.0f*(elen2*dot_v3v3(vel,bv)-edotv*edotbv);
-	c=elen2*(radius2-dot_v3v3(bv,bv))+edotbv*edotbv;
+	a = elen2 * (-dot_v3v3(vel, vel)) + edotv * edotv;
+	b = 2.0f * (elen2 * dot_v3v3(vel, bv) - edotv * edotbv);
+	c = elen2 * (radius2 - dot_v3v3(bv, bv)) + edotbv * edotbv;
 
-	if(getLowestRoot(a, b, c, *r_lambda, &newLambda))
-	{
-		e=(edotv*newLambda-edotbv)/elen2;
+	if (getLowestRoot(a, b, c, *r_lambda, &newLambda)) {
+		e = (edotv * newLambda - edotbv) / elen2;
 
-		if(e >= 0.0f && e <= 1.0f)
-		{
+		if (e >= 0.0f && e <= 1.0f) {
 			*r_lambda = newLambda;
-			copy_v3_v3(ipoint,e2);
-			mul_v3_fl(ipoint,e);
+			copy_v3_v3(ipoint, e2);
+			mul_v3_fl(ipoint, e);
 			add_v3_v3(ipoint, v0);
-			found_by_sweep=1;
+			found_by_sweep = 1;
 		}
 	}
 
@@ -1100,71 +1091,70 @@ int isect_sweeping_sphere_tri_v3(
 	/* edotv = dot_v3v3(e1,vel); */ /* UNUSED */
 	/* edotbv = dot_v3v3(e1,bv); */ /* UNUSED */
 
-	sub_v3_v3v3(bv,v1,p1);
-	elen2 = dot_v3v3(e3,e3);
-	edotv = dot_v3v3(e3,vel);
-	edotbv = dot_v3v3(e3,bv);
+	sub_v3_v3v3(bv, v1, p1);
+	elen2 = dot_v3v3(e3, e3);
+	edotv = dot_v3v3(e3, vel);
+	edotbv = dot_v3v3(e3, bv);
 
-	a=elen2*(-dot_v3v3(vel,vel))+edotv*edotv;
-	b=2.0f*(elen2*dot_v3v3(vel,bv)-edotv*edotbv);
-	c=elen2*(radius2-dot_v3v3(bv,bv))+edotbv*edotbv;
+	a = elen2 * (-dot_v3v3(vel, vel)) + edotv * edotv;
+	b = 2.0f * (elen2 * dot_v3v3(vel, bv) - edotv * edotbv);
+	c = elen2 * (radius2 - dot_v3v3(bv, bv)) + edotbv * edotbv;
 
-	if(getLowestRoot(a, b, c, *r_lambda, &newLambda))
-	{
-		e=(edotv*newLambda-edotbv)/elen2;
+	if (getLowestRoot(a, b, c, *r_lambda, &newLambda)) {
+		e = (edotv * newLambda - edotbv) / elen2;
 
-		if(e >= 0.0f && e <= 1.0f)
-		{
+		if (e >= 0.0f && e <= 1.0f) {
 			*r_lambda = newLambda;
-			copy_v3_v3(ipoint,e3);
-			mul_v3_fl(ipoint,e);
+			copy_v3_v3(ipoint, e3);
+			mul_v3_fl(ipoint, e);
 			add_v3_v3(ipoint, v1);
-			found_by_sweep=1;
+			found_by_sweep = 1;
 		}
 	}
 
 
 	return found_by_sweep;
 }
+
 int isect_axial_line_tri_v3(const int axis, const float p1[3], const float p2[3],
                             const float v0[3], const float v1[3], const float v2[3], float *r_lambda)
 {
 	float p[3], e1[3], e2[3];
 	float u, v, f;
-	int a0=axis, a1=(axis+1)%3, a2=(axis+2)%3;
+	int a0 = axis, a1 = (axis + 1) % 3, a2 = (axis + 2) % 3;
 
 	//return isect_line_tri_v3(p1,p2,v0,v1,v2,lambda);
 
 	///* first a simple bounding box test */
-	//if(MIN3(v0[a1],v1[a1],v2[a1]) > p1[a1]) return 0;
-	//if(MIN3(v0[a2],v1[a2],v2[a2]) > p1[a2]) return 0;
-	//if(MAX3(v0[a1],v1[a1],v2[a1]) < p1[a1]) return 0;
-	//if(MAX3(v0[a2],v1[a2],v2[a2]) < p1[a2]) return 0;
+	//if (MIN3(v0[a1],v1[a1],v2[a1]) > p1[a1]) return 0;
+	//if (MIN3(v0[a2],v1[a2],v2[a2]) > p1[a2]) return 0;
+	//if (MAX3(v0[a1],v1[a1],v2[a1]) < p1[a1]) return 0;
+	//if (MAX3(v0[a2],v1[a2],v2[a2]) < p1[a2]) return 0;
 
 	///* then a full intersection test */
-	
-	sub_v3_v3v3(e1,v1,v0);
-	sub_v3_v3v3(e2,v2,v0);
-	sub_v3_v3v3(p,v0,p1);
 
-	f= (e2[a1]*e1[a2]-e2[a2]*e1[a1]);
+	sub_v3_v3v3(e1, v1, v0);
+	sub_v3_v3v3(e2, v2, v0);
+	sub_v3_v3v3(p, v0, p1);
+
+	f = (e2[a1] * e1[a2] - e2[a2] * e1[a1]);
 	if ((f > -0.000001f) && (f < 0.000001f)) return 0;
 
-	v= (p[a2]*e1[a1]-p[a1]*e1[a2])/f;
-	if ((v < 0.0f)||(v > 1.0f)) return 0;
-	
-	f= e1[a1];
-	if((f > -0.000001f) && (f < 0.000001f)){
-		f= e1[a2];
-		if((f > -0.000001f) && (f < 0.000001f)) return 0;
-		u= (-p[a2]-v*e2[a2])/f;
+	v = (p[a2] * e1[a1] - p[a1] * e1[a2]) / f;
+	if ((v < 0.0f) || (v > 1.0f)) return 0;
+
+	f = e1[a1];
+	if ((f > -0.000001f) && (f < 0.000001f)) {
+		f = e1[a2];
+		if ((f > -0.000001f) && (f < 0.000001f)) return 0;
+		u = (-p[a2] - v * e2[a2]) / f;
 	}
 	else
-		u= (-p[a1]-v*e2[a1])/f;
+		u = (-p[a1] - v * e2[a1]) / f;
 
 	if ((u < 0.0f) || ((u + v) > 1.0f)) return 0;
 
-	*r_lambda = (p[a0]+u*e1[a0]+v*e2[a0])/(p2[a0]-p1[a0]);
+	*r_lambda = (p[a0] + u * e1[a0] + v * e2[a0]) / (p2[a0] - p1[a0]);
 
 	if ((*r_lambda < 0.0f) || (*r_lambda > 1.0f)) return 0;
 
@@ -1174,13 +1164,13 @@ int isect_axial_line_tri_v3(const int axis, const float p1[3], const float p2[3]
 /* 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 
+ * 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];
 	float d;
-	
+
 	sub_v3_v3v3(c, v3, v1);
 	sub_v3_v3v3(a, v2, v1);
 	sub_v3_v3v3(b, v4, v3);
@@ -1203,7 +1193,7 @@ int isect_line_line_v3(const float v1[3], const float v2[3], const float v3[3],
 		mul_v3_fl(a, dot_v3v3(cb, ab) / dot_v3v3(ab, ab));
 		add_v3_v3v3(i1, v1, a);
 		copy_v3_v3(i2, i1);
-		
+
 		return 1; /* one intersection only */
 	}
 	/* if not */
@@ -1219,7 +1209,7 @@ int isect_line_line_v3(const float v1[3], const float v2[3], const float v3[3],
 		/* for the first line, offset the second line until it is coplanar */
 		add_v3_v3v3(v3t, v3, t);
 		add_v3_v3v3(v4t, v4, t);
-		
+
 		sub_v3_v3v3(c, v3t, v1);
 		sub_v3_v3v3(a, v2, v1);
 		sub_v3_v3v3(b, v4t, v3t);
@@ -1232,19 +1222,19 @@ int isect_line_line_v3(const float v1[3], const float v2[3], const float v3[3],
 
 		/* for the second line, just substract the offset from the first intersection point */
 		sub_v3_v3v3(i2, i1, t);
-		
+
 		return 2; /* two nearest points */
 	}
-} 
+}
 
 /* Intersection point strictly between the two lines
- * 0 when no intersection is found 
+ * 0 when no intersection is found
  * */
 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)
 {
 	float a[3], b[3], c[3], ab[3], cb[3], ca[3], dir1[3], dir2[3];
 	float d;
-	
+
 	sub_v3_v3v3(c, v3, v1);
 	sub_v3_v3v3(a, v2, v1);
 	sub_v3_v3v3(b, v4, v3);
@@ -1268,9 +1258,9 @@ int isect_line_line_strict_v3(const float v1[3], const float v2[3], const float
 
 		f1 = dot_v3v3(cb, ab) / dot_v3v3(ab, ab);
 		f2 = dot_v3v3(ca, ab) / dot_v3v3(ab, ab);
-		
+
 		if (f1 >= 0 && f1 <= 1 &&
-			f2 >= 0 && f2 <= 1)
+		    f2 >= 0 && f2 <= 1)
 		{
 			mul_v3_fl(a, f1);
 			add_v3_v3v3(vi, v1, a);
@@ -1279,21 +1269,19 @@ int isect_line_line_strict_v3(const float v1[3], const float v2[3], const float
 
 			return 1; /* intersection found */
 		}
-		else
-		{
+		else {
 			return 0;
 		}
 	}
-	else
-	{
+	else {
 		return 0;
 	}
-} 
+}
 
 int isect_aabb_aabb_v3(const float min1[3], const float max1[3], const float min2[3], const float max2[3])
 {
-	return (min1[0]<max2[0] && min1[1]<max2[1] && min1[2]<max2[2] &&
-			min2[0]<max1[0] && min2[1]<max1[1] && min2[2]<max1[2]);
+	return (min1[0] < max2[0] && min1[1] < max2[1] && min1[2] < max2[2] &&
+	        min2[0] < max1[0] && min2[1] < max1[1] && min2[2] < max1[2]);
 }
 
 /* find closest point to p on line through l1,l2 and return lambda,
@@ -1301,22 +1289,22 @@ int isect_aabb_aabb_v3(const float min1[3], const float max1[3], const float min
  */
 float closest_to_line_v3(float cp[3], const float p[3], const float l1[3], const float l2[3])
 {
-	float h[3],u[3],lambda;
+	float h[3], u[3], lambda;
 	sub_v3_v3v3(u, l2, l1);
 	sub_v3_v3v3(h, p, l1);
-	lambda =dot_v3v3(u,h)/dot_v3v3(u,u);
+	lambda = dot_v3v3(u, h) / dot_v3v3(u, u);
 	cp[0] = l1[0] + u[0] * lambda;
 	cp[1] = l1[1] + u[1] * lambda;
 	cp[2] = l1[2] + u[2] * lambda;
 	return lambda;
 }
 
-float closest_to_line_v2(float cp[2],const float p[2], const float l1[2], const float l2[2])
+float closest_to_line_v2(float cp[2], const float p[2], const float l1[2], const float l2[2])
 {
-	float h[2],u[2],lambda;
+	float h[2], u[2], lambda;
 	sub_v2_v2v2(u, l2, l1);
 	sub_v2_v2v2(h, p, l1);
-	lambda =dot_v2v2(u,h)/dot_v2v2(u,u);
+	lambda = dot_v2v2(u, h) / dot_v2v2(u, u);
 	cp[0] = l1[0] + u[0] * lambda;
 	cp[1] = l1[1] + u[1] * lambda;
 	return lambda;
@@ -1325,10 +1313,10 @@ float closest_to_line_v2(float cp[2],const float p[2], const float l1[2], const
 /* little sister we only need to know lambda */
 float line_point_factor_v3(const float p[3], const float l1[3], const float l2[3])
 {
-	float h[3],u[3];
+	float h[3], u[3];
 	sub_v3_v3v3(u, l2, l1);
 	sub_v3_v3v3(h, p, l1);
-	return(dot_v3v3(u,h)/dot_v3v3(u,u));
+	return (dot_v3v3(u, h) / dot_v3v3(u, u));
 }
 
 float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2])
@@ -1336,105 +1324,137 @@ float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2
 	float h[2], u[2];
 	sub_v2_v2v2(u, l2, l1);
 	sub_v2_v2v2(h, p, l1);
-	return(dot_v2v2(u, h)/dot_v2v2(u, u));
+	return (dot_v2v2(u, h) / dot_v2v2(u, u));
+}
+
+/* ensyre the distance between these points is no greater then 'dist'
+ * if it is, scale then both into the center */
+void limit_dist_v3(float v1[3], float v2[3], const float dist)
+{
+	const float dist_old = len_v3v3(v1, v2);
+
+	if (dist_old > dist) {
+		float v1_old[3];
+		float v2_old[3];
+		float fac = (dist / dist_old) * 0.5f;
+
+		copy_v3_v3(v1_old, v1);
+		copy_v3_v3(v2_old, v2);
+
+		interp_v3_v3v3(v1, v1_old, v2_old, 0.5f - fac);
+		interp_v3_v3v3(v2, v1_old, v2_old, 0.5f + fac);
+	}
 }
 
 /* Similar to LineIntersectsTriangleUV, except it operates on a quad and in 2d, assumes point is in quad */
-void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2[2], const float v3[2], const float pt[2], float r_uv[2])
+void isect_point_quad_uv_v2(const float v0[2], const float v1[2], const float v2[2], const float v3[2],
+                            const float pt[2], float r_uv[2])
 {
-	float x0,y0, x1,y1, wtot, v2d[2], w1, w2;
-	
+	float x0, y0, x1, y1, wtot, v2d[2], w1, w2;
+
 	/* used for parallel lines */
 	float pt3d[3], l1[3], l2[3], pt_on_line[3];
-	
+
 	/* compute 2 edges  of the quad  intersection point */
-	if (IsectLLPt2Df(v0[0],v0[1],v1[0],v1[1],  v2[0],v2[1],v3[0],v3[1], &x0,&y0) == 1) {
+	if (IsectLLPt2Df(v0[0], v0[1], v1[0], v1[1], v2[0], v2[1], v3[0], v3[1], &x0, &y0) == 1) {
 		/* the intersection point between the quad-edge intersection and the point in the quad we want the uv's for */
 		/* should never be paralle !! */
 		/*printf("\tnot parallel 1\n");*/
-		IsectLLPt2Df(pt[0],pt[1],x0,y0,  v0[0],v0[1],v3[0],v3[1], &x1,&y1);
-		
+		IsectLLPt2Df(pt[0], pt[1], x0, y0, v0[0], v0[1], v3[0], v3[1], &x1, &y1);
+
 		/* Get the weights from the new intersection point, to each edge */
-		v2d[0] = x1-v0[0];
-		v2d[1] = y1-v0[1];
+		v2d[0] = x1 - v0[0];
+		v2d[1] = y1 - v0[1];
 		w1 = len_v2(v2d);
-		
-		v2d[0] = x1-v3[0]; /* some but for the other vert */
-		v2d[1] = y1-v3[1];
+
+		v2d[0] = x1 - v3[0]; /* some but for the other vert */
+		v2d[1] = y1 - v3[1];
 		w2 = len_v2(v2d);
-		wtot = w1+w2;
+		wtot = w1 + w2;
 		/*w1 = w1/wtot;*/
 		/*w2 = w2/wtot;*/
-		r_uv[0] = w1/wtot;
-	} else {
+		r_uv[0] = w1 / wtot;
+	}
+	else {
 		/* lines are parallel, lambda_cp_line_ex is 3d grrr */
 		/*printf("\tparallel1\n");*/
 		pt3d[0] = pt[0];
 		pt3d[1] = pt[1];
 		pt3d[2] = l1[2] = l2[2] = 0.0f;
-		
-		l1[0] = v0[0]; l1[1] = v0[1];
-		l2[0] = v1[0]; l2[1] = v1[1];
-		closest_to_line_v3(pt_on_line,pt3d, l1, l2);
-		v2d[0] = pt[0]-pt_on_line[0]; /* same, for the other vert */
-		v2d[1] = pt[1]-pt_on_line[1];
+
+		l1[0] = v0[0];
+		l1[1] = v0[1];
+		l2[0] = v1[0];
+		l2[1] = v1[1];
+		closest_to_line_v3(pt_on_line, pt3d, l1, l2);
+		v2d[0] = pt[0] - pt_on_line[0]; /* same, for the other vert */
+		v2d[1] = pt[1] - pt_on_line[1];
 		w1 = len_v2(v2d);
-		
-		l1[0] = v2[0]; l1[1] = v2[1];
-		l2[0] = v3[0]; l2[1] = v3[1];
-		closest_to_line_v3(pt_on_line,pt3d, l1, l2);
-		v2d[0] = pt[0]-pt_on_line[0]; /* same, for the other vert */
-		v2d[1] = pt[1]-pt_on_line[1];
+
+		l1[0] = v2[0];
+		l1[1] = v2[1];
+		l2[0] = v3[0];
+		l2[1] = v3[1];
+		closest_to_line_v3(pt_on_line, pt3d, l1, l2);
+		v2d[0] = pt[0] - pt_on_line[0]; /* same, for the other vert */
+		v2d[1] = pt[1] - pt_on_line[1];
 		w2 = len_v2(v2d);
-		wtot = w1+w2;
-		r_uv[0] = w1/wtot;
+		wtot = w1 + w2;
+		r_uv[0] = w1 / wtot;
 	}
-	
+
 	/* Same as above to calc the uv[1] value, alternate calculation */
-	
-	if (IsectLLPt2Df(v0[0],v0[1],v3[0],v3[1],  v1[0],v1[1],v2[0],v2[1], &x0,&y0) == 1) { /* was v0,v1  v2,v3  now v0,v3  v1,v2*/
+
+	if (IsectLLPt2Df(v0[0], v0[1], v3[0], v3[1], v1[0], v1[1], v2[0], v2[1], &x0, &y0) == 1) { /* was v0,v1  v2,v3  now v0,v3  v1,v2*/
 		/* never paralle if above was not */
 		/*printf("\tnot parallel2\n");*/
-		IsectLLPt2Df(pt[0],pt[1],x0,y0,  v0[0],v0[1],v1[0],v1[1], &x1,&y1);/* was v0,v3  now v0,v1*/
-		
-		v2d[0] = x1-v0[0];
-		v2d[1] = y1-v0[1];
+		IsectLLPt2Df(pt[0], pt[1], x0, y0, v0[0], v0[1], v1[0], v1[1], &x1, &y1); /* was v0,v3  now v0,v1*/
+
+		v2d[0] = x1 - v0[0];
+		v2d[1] = y1 - v0[1];
 		w1 = len_v2(v2d);
-		
-		v2d[0] = x1-v1[0];
-		v2d[1] = y1-v1[1];
+
+		v2d[0] = x1 - v1[0];
+		v2d[1] = y1 - v1[1];
 		w2 = len_v2(v2d);
-		wtot = w1+w2;
-		r_uv[1] = w1/wtot;
-	} else {
+		wtot = w1 + w2;
+		r_uv[1] = w1 / wtot;
+	}
+	else {
 		/* lines are parallel, lambda_cp_line_ex is 3d grrr */
 		/*printf("\tparallel2\n");*/
 		pt3d[0] = pt[0];
 		pt3d[1] = pt[1];
 		pt3d[2] = l1[2] = l2[2] = 0.0f;
-		
-		
-		l1[0] = v0[0]; l1[1] = v0[1];
-		l2[0] = v3[0]; l2[1] = v3[1];
-		closest_to_line_v3(pt_on_line,pt3d, l1, l2);
-		v2d[0] = pt[0]-pt_on_line[0]; /* some but for the other vert */
-		v2d[1] = pt[1]-pt_on_line[1];
+
+
+		l1[0] = v0[0];
+		l1[1] = v0[1];
+		l2[0] = v3[0];
+		l2[1] = v3[1];
+		closest_to_line_v3(pt_on_line, pt3d, l1, l2);
+		v2d[0] = pt[0] - pt_on_line[0]; /* some but for the other vert */
+		v2d[1] = pt[1] - pt_on_line[1];
 		w1 = len_v2(v2d);
-		
-		l1[0] = v1[0]; l1[1] = v1[1];
-		l2[0] = v2[0]; l2[1] = v2[1];
-		closest_to_line_v3(pt_on_line,pt3d, l1, l2);
-		v2d[0] = pt[0]-pt_on_line[0]; /* some but for the other vert */
-		v2d[1] = pt[1]-pt_on_line[1];
+
+		l1[0] = v1[0];
+		l1[1] = v1[1];
+		l2[0] = v2[0];
+		l2[1] = v2[1];
+		closest_to_line_v3(pt_on_line, pt3d, l1, l2);
+		v2d[0] = pt[0] - pt_on_line[0]; /* some but for the other vert */
+		v2d[1] = pt[1] - pt_on_line[1];
 		w2 = len_v2(v2d);
-		wtot = w1+w2;
-		r_uv[1] = w1/wtot;
+		wtot = w1 + w2;
+		r_uv[1] = w1 / wtot;
 	}
 	/* may need to flip UV's here */
 }
 
 /* same as above but does tri's and quads, tri's are a bit of a hack */
-void isect_point_face_uv_v2(const int isquad, const float v0[2], const float v1[2], const float v2[2], const float v3[2], const float pt[2], float r_uv[2])
+void isect_point_face_uv_v2(const int isquad,
+                            const float v0[2], const float v1[2], const float v2[2], const float v3[2],
+                            const float pt[2], float r_uv[2])
 {
 	if (isquad) {
 		isect_point_quad_uv_v2(v0, v1, v2, v3, pt, r_uv);
@@ -1442,146 +1462,147 @@ void isect_point_face_uv_v2(const int isquad, const float v0[2], const float v1[
 	else {
 		/* not for quads, use for our abuse of LineIntersectsTriangleUV */
 		float p1_3d[3], p2_3d[3], v0_3d[3], v1_3d[3], v2_3d[3], lambda;
-			
+
 		p1_3d[0] = p2_3d[0] = r_uv[0];
 		p1_3d[1] = p2_3d[1] = r_uv[1];
 		p1_3d[2] = 1.0f;
 		p2_3d[2] = -1.0f;
 		v0_3d[2] = v1_3d[2] = v2_3d[2] = 0.0;
-		
+
 		/* generate a new fuv, (this is possibly a non optimal solution,
 		 * since we only need 2d calculation but use 3d func's)
-		 * 
+		 *
 		 * this method makes an imaginary triangle in 2d space using the UV's from the derived mesh face
 		 * Then find new uv coords using the fuv and this face with LineIntersectsTriangleUV.
-		 * This means the new values will be correct in relation to the derived meshes face. 
+		 * This means the new values will be correct in relation to the derived meshes face.
 		 */
 		copy_v2_v2(v0_3d, v0);
 		copy_v2_v2(v1_3d, v1);
 		copy_v2_v2(v2_3d, v2);
-		
+
 		/* Doing this in 3D is not nice */
 		isect_line_tri_v3(p1_3d, p2_3d, v0_3d, v1_3d, v2_3d, &lambda, r_uv);
 	}
 }
 
 #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])
 {
 	float inp1, inp2, inp3;
-	
-	inp1= (v2[0]-v1[0])*(v1[1]-pt[1]) + (v1[1]-v2[1])*(v1[0]-pt[0]);
-	inp2= (v3[0]-v2[0])*(v2[1]-pt[1]) + (v2[1]-v3[1])*(v2[0]-pt[0]);
-	inp3= (v1[0]-v3[0])*(v3[1]-pt[1]) + (v3[1]-v1[1])*(v3[0]-pt[0]);
-	
-	if(inp1<=0.0f && inp2<=0.0f && inp3<=0.0f) return 1;
-	if(inp1>=0.0f && inp2>=0.0f && inp3>=0.0f) return 1;
-	
+
+	inp1 = (v2[0] - v1[0]) * (v1[1] - pt[1]) + (v1[1] - v2[1]) * (v1[0] - pt[0]);
+	inp2 = (v3[0] - v2[0]) * (v2[1] - pt[1]) + (v2[1] - v3[1]) * (v2[0] - pt[0]);
+	inp3 = (v1[0] - v3[0]) * (v3[1] - pt[1]) + (v3[1] - v1[1]) * (v3[0] - pt[0]);
+
+	if (inp1 <= 0.0f && inp2 <= 0.0f && inp3 <= 0.0f) return 1;
+	if (inp1 >= 0.0f && inp2 >= 0.0f && inp3 >= 0.0f) return 1;
+
 	return 0;
 }
 #endif
 
 #if 0
+
 int isect_point_tri_v2(float v0[2], float v1[2], float v2[2], float pt[2])
 {
-		/* not for quads, use for our abuse of LineIntersectsTriangleUV */
-		float p1_3d[3], p2_3d[3], v0_3d[3], v1_3d[3], v2_3d[3];
-		/* not used */
-		float lambda, uv[3];
-			
-		p1_3d[0] = p2_3d[0] = uv[0]= pt[0];
-		p1_3d[1] = p2_3d[1] = uv[1]= uv[2]= pt[1];
-		p1_3d[2] = 1.0f;
-		p2_3d[2] = -1.0f;
-		v0_3d[2] = v1_3d[2] = v2_3d[2] = 0.0;
-		
-		/* generate a new fuv, (this is possibly a non optimal solution,
-		 * since we only need 2d calculation but use 3d func's)
-		 * 
-		 * this method makes an imaginary triangle in 2d space using the UV's from the derived mesh face
-		 * Then find new uv coords using the fuv and this face with LineIntersectsTriangleUV.
-		 * This means the new values will be correct in relation to the derived meshes face. 
-		 */
-		copy_v2_v2(v0_3d, v0);
-		copy_v2_v2(v1_3d, v1);
-		copy_v2_v2(v2_3d, v2);
-		
-		/* Doing this in 3D is not nice */
-		return isect_line_tri_v3(p1_3d, p2_3d, v0_3d, v1_3d, v2_3d, &lambda, uv);
+	/* not for quads, use for our abuse of LineIntersectsTriangleUV */
+	float p1_3d[3], p2_3d[3], v0_3d[3], v1_3d[3], v2_3d[3];
+	/* not used */
+	float lambda, uv[3];
+
+	p1_3d[0] = p2_3d[0] = uv[0] = pt[0];
+	p1_3d[1] = p2_3d[1] = uv[1] = uv[2] = pt[1];
+	p1_3d[2] = 1.0f;
+	p2_3d[2] = -1.0f;
+	v0_3d[2] = v1_3d[2] = v2_3d[2] = 0.0;
+
+	/* generate a new fuv, (this is possibly a non optimal solution,
+	 * since we only need 2d calculation but use 3d func's)
+	 *
+	 * this method makes an imaginary triangle in 2d space using the UV's from the derived mesh face
+	 * Then find new uv coords using the fuv and this face with LineIntersectsTriangleUV.
+	 * This means the new values will be correct in relation to the derived meshes face.
+	 */
+	copy_v2_v2(v0_3d, v0);
+	copy_v2_v2(v1_3d, v1);
+	copy_v2_v2(v2_3d, v2);
+
+	/* Doing this in 3D is not nice */
+	return isect_line_tri_v3(p1_3d, p2_3d, v0_3d, v1_3d, v2_3d, &lambda, uv);
 }
 #endif
 
 /*
-
-	x1,y2
-	|  \
-	|   \     .(a,b)
-	|    \
-	x1,y1-- x2,y1
-
-*/
+ *     x1,y2
+ *     |  \
+ *     |   \     .(a,b)
+ *     |    \
+ *     x1,y1-- x2,y1
+ */
 int isect_point_tri_v2_int(const int x1, const int y1, const int x2, const int y2, const int a, const int b)
 {
 	float v1[2], v2[2], v3[2], p[2];
-	
-	v1[0]= (float)x1;
-	v1[1]= (float)y1;
-	
-	v2[0]= (float)x1;
-	v2[1]= (float)y2;
-	
-	v3[0]= (float)x2;
-	v3[1]= (float)y1;
-	
-	p[0]= (float)a;
-	p[1]= (float)b;
-	
+
+	v1[0] = (float)x1;
+	v1[1] = (float)y1;
+
+	v2[0] = (float)x1;
+	v2[1] = (float)y2;
+
+	v3[0] = (float)x2;
+	v3[1] = (float)y1;
+
+	p[0] = (float)a;
+	p[1] = (float)b;
+
 	return isect_point_tri_v2(p, v1, v2, v3);
 }
 
 static int point_in_slice(const float p[3], const float v1[3], const float l1[3], const float l2[3])
 {
-/* 
-what is a slice ?
-some maths:
-a line including l1,l2 and a point not on the line 
-define a subset of R3 delimeted by planes parallel to the line and orthogonal 
-to the (point --> line) distance vector,one plane on the line one on the point, 
-the room inside usually is rather small compared to R3 though still infinte
-useful for restricting (speeding up) searches 
-e.g. all points of triangular prism are within the intersection of 3 'slices'
-onother trivial case : cube 
-but see a 'spat' which is a deformed cube with paired parallel planes needs only 3 slices too
-*/
-	float h,rp[3],cp[3],q[3];
-
-	closest_to_line_v3(cp,v1,l1,l2);
-	sub_v3_v3v3(q,cp,v1);
-
-	sub_v3_v3v3(rp,p,v1);
-	h=dot_v3v3(q,rp)/dot_v3v3(q,q);
+	/*
+	 * what is a slice ?
+	 * some maths:
+	 * a line including l1,l2 and a point not on the line
+	 * define a subset of R3 delimited by planes parallel to the line and orthogonal
+	 * to the (point --> line) distance vector,one plane on the line one on the point,
+	 * the room inside usually is rather small compared to R3 though still infinte
+	 * useful for restricting (speeding up) searches
+	 * e.g. all points of triangular prism are within the intersection of 3 'slices'
+	 * onother trivial case : cube
+	 * but see a 'spat' which is a deformed cube with paired parallel planes needs only 3 slices too
+	 */
+	float h, rp[3], cp[3], q[3];
+
+	closest_to_line_v3(cp, v1, l1, l2);
+	sub_v3_v3v3(q, cp, v1);
+
+	sub_v3_v3v3(rp, p, v1);
+	h = dot_v3v3(q, rp) / dot_v3v3(q, q);
 	if (h < 0.0f || h > 1.0f) return 0;
 	return 1;
 }
 
 #if 0
-/*adult sister defining the slice planes by the origin and the normal  
-NOTE |normal| may not be 1 but defining the thickness of the slice*/
-static int point_in_slice_as(float p[3],float origin[3],float normal[3])
+
+/* adult sister defining the slice planes by the origin and the normal
+ * NOTE |normal| may not be 1 but defining the thickness of the slice */
+static int point_in_slice_as(float p[3], float origin[3], float normal[3])
 {
-	float h,rp[3];
-	sub_v3_v3v3(rp,p,origin);
-	h=dot_v3v3(normal,rp)/dot_v3v3(normal,normal);
+	float h, rp[3];
+	sub_v3_v3v3(rp, p, origin);
+	h = dot_v3v3(normal, rp) / dot_v3v3(normal, normal);
 	if (h < 0.0f || h > 1.0f) return 0;
 	return 1;
 }
 
 /*mama (knowing the squared length of the normal)*/
-static int point_in_slice_m(float p[3],float origin[3],float normal[3],float lns)
+static int point_in_slice_m(float p[3], float origin[3], float normal[3], float lns)
 {
-	float h,rp[3];
-	sub_v3_v3v3(rp,p,origin);
-	h=dot_v3v3(normal,rp)/lns;
+	float h, rp[3];
+	sub_v3_v3v3(rp, p, origin);
+	h = dot_v3v3(normal, rp) / lns;
 	if (h < 0.0f || h > 1.0f) return 0;
 	return 1;
 }
@@ -1589,9 +1610,9 @@ static int point_in_slice_m(float p[3],float origin[3],float normal[3],float lns
 
 int isect_point_tri_prism_v3(const float p[3], const float v1[3], const float v2[3], const float v3[3])
 {
-	if(!point_in_slice(p,v1,v2,v3)) return 0;
-	if(!point_in_slice(p,v2,v3,v1)) return 0;
-	if(!point_in_slice(p,v3,v1,v2)) return 0;
+	if (!point_in_slice(p, v1, v2, v3)) return 0;
+	if (!point_in_slice(p, v2, v3, v1)) return 0;
+	if (!point_in_slice(p, v3, v1, v2)) return 0;
 	return 1;
 }
 
@@ -1601,23 +1622,23 @@ int clip_line_plane(float p1[3], float p2[3], const float plane[4])
 
 	copy_v3_v3(n, plane);
 	sub_v3_v3v3(dp, p2, p1);
-	div= dot_v3v3(dp, n);
+	div = dot_v3v3(dp, n);
 
-	if(div == 0.0f) /* parallel */
+	if (div == 0.0f) /* parallel */
 		return 1;
 
-	t= -(dot_v3v3(p1, n) + plane[3])/div;
+	t = -(dot_v3v3(p1, n) + plane[3]) / div;
 
-	if(div > 0.0f) {
+	if (div > 0.0f) {
 		/* behind plane, completely clipped */
-		if(t >= 1.0f) {
+		if (t >= 1.0f) {
 			zero_v3(p1);
 			zero_v3(p2);
 			return 0;
 		}
 
 		/* intersect plane */
-		if(t > 0.0f) {
+		if (t > 0.0f) {
 			madd_v3_v3v3fl(pc, p1, dp, t);
 			copy_v3_v3(p1, pc);
 			return 1;
@@ -1627,14 +1648,14 @@ int clip_line_plane(float p1[3], float p2[3], const float plane[4])
 	}
 	else {
 		/* behind plane, completely clipped */
-		if(t <= 0.0f) {
+		if (t <= 0.0f) {
 			zero_v3(p1);
 			zero_v3(p2);
 			return 0;
 		}
 
 		/* intersect plane */
-		if(t < 1.0f) {
+		if (t < 1.0f) {
 			madd_v3_v3v3fl(pc, p1, dp, t);
 			copy_v3_v3(p2, pc);
 			return 1;
@@ -1644,22 +1665,21 @@ int clip_line_plane(float p1[3], float p2[3], const float plane[4])
 	}
 }
 
-
 void plot_line_v2v2i(const int p1[2], const int p2[2], int (*callback)(int, int, void *), void *userData)
 {
-	int x1= p1[0];
-	int y1= p1[1];
-	int x2= p2[0];
-	int y2= p2[1];
+	int x1 = p1[0];
+	int y1 = p1[1];
+	int x2 = p2[0];
+	int y2 = p2[1];
 
 	signed char ix;
 	signed char iy;
 
 	// 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;
+	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;
 
-	if(callback(x1, y1, userData) == 0) {
+	if (callback(x1, y1, userData) == 0) {
 		return;
 	}
 
@@ -1680,8 +1700,8 @@ void plot_line_v2v2i(const int p1[2], const int p2[2], int (*callback)(int, int,
 			x1 += ix;
 			error += delta_y;
 
-			if(callback(x1, y1, userData) == 0) {
-				return ;
+			if (callback(x1, y1, userData) == 0) {
+				return;
 			}
 		}
 	}
@@ -1702,7 +1722,7 @@ void plot_line_v2v2i(const int p1[2], const int p2[2], int (*callback)(int, int,
 			y1 += iy;
 			error += delta_x;
 
-			if(callback(x1, y1, userData) == 0) {
+			if (callback(x1, y1, userData) == 0) {
 				return;
 			}
 		}
@@ -1714,62 +1734,60 @@ void plot_line_v2v2i(const int p1[2], const int p2[2], int (*callback)(int, int,
 /* get the 2 dominant axis values, 0==X, 1==Y, 2==Z */
 void axis_dominant_v3(int *axis_a, int *axis_b, const float axis[3])
 {
-	const float xn= fabsf(axis[0]);
-	const float yn= fabsf(axis[1]);
-	const float zn= fabsf(axis[2]);
+	const float xn = fabsf(axis[0]);
+	const float yn = fabsf(axis[1]);
+	const float zn = fabsf(axis[2]);
 
-	if      (zn >= xn && zn >= yn) { *axis_a= 0; *axis_b= 1; }
-	else if (yn >= xn && yn >= zn) { *axis_a= 0; *axis_b= 2; }
-	else                           { *axis_a= 1; *axis_b= 2; }
+	if      (zn >= xn && zn >= yn) { *axis_a= 0; *axis_b = 1; }
+	else if (yn >= xn && yn >= zn) { *axis_a= 0; *axis_b = 2; }
+	else                           { *axis_a= 1; *axis_b = 2; }
 }
 
 static float tri_signed_area(const float v1[3], const float v2[3], const float v3[3], const int i, const int j)
 {
-	return 0.5f*((v1[i]-v2[i])*(v2[j]-v3[j]) + (v1[j]-v2[j])*(v3[i]-v2[i]));
+	return 0.5f * ((v1[i] - v2[i]) * (v2[j] - v3[j]) + (v1[j] - v2[j]) * (v3[i] - v2[i]));
 }
 
+/* return 1 when degenerate */
 static int barycentric_weights(const float v1[3], const float v2[3], const float v3[3], const float co[3], const float n[3], float w[3])
 {
-	float a1, a2, a3, asum;
+	float wtot;
 	int i, j;
 
 	axis_dominant_v3(&i, &j, n);
 
-	a1= tri_signed_area(v2, v3, co, i, j);
-	a2= tri_signed_area(v3, v1, co, i, j);
-	a3= tri_signed_area(v1, v2, co, i, j);
+	w[0] = tri_signed_area(v2, v3, co, i, j);
+	w[1] = tri_signed_area(v3, v1, co, i, j);
+	w[2] = tri_signed_area(v1, v2, co, i, j);
 
-	asum= a1 + a2 + a3;
+	wtot = w[0] + w[1] + w[2];
 
-	if (fabsf(asum) < FLT_EPSILON) {
+	if (fabsf(wtot) > FLT_EPSILON) {
+		mul_v3_fl(w, 1.0f / wtot);
+		return 0;
+	}
+	else {
 		/* zero area triangle */
-		w[0]= w[1]= w[2]= 1.0f/3.0f;
+		copy_v3_fl(w, 1.0f / 3.0f);
 		return 1;
 	}
-
-	asum= 1.0f/asum;
-	w[0]= a1*asum;
-	w[1]= a2*asum;
-	w[2]= a3*asum;
-
-	return 0;
 }
 
 void interp_weights_face_v3(float w[4], const float v1[3], const float v2[3], const float v3[3], const float v4[3], const float co[3])
 {
 	float w2[3];
 
-	w[0]= w[1]= w[2]= w[3]= 0.0f;
+	w[0] = w[1] = w[2] = w[3] = 0.0f;
 
 	/* first check for exact match */
-	if(equals_v3v3(co, v1))
-		w[0]= 1.0f;
-	else if(equals_v3v3(co, v2))
-		w[1]= 1.0f;
-	else if(equals_v3v3(co, v3))
-		w[2]= 1.0f;
-	else if(v4 && equals_v3v3(co, v4))
-		w[3]= 1.0f;
+	if (equals_v3v3(co, v1))
+		w[0] = 1.0f;
+	else if (equals_v3v3(co, v2))
+		w[1] = 1.0f;
+	else if (equals_v3v3(co, v3))
+		w[2] = 1.0f;
+	else if (v4 && equals_v3v3(co, v4))
+		w[3] = 1.0f;
 	else {
 		/* otherwise compute barycentric interpolation weights */
 		float n1[3], n2[3], n[3];
@@ -1786,19 +1804,19 @@ void interp_weights_face_v3(float w[4], const float v1[3], const float v2[3], co
 
 		/* OpenGL seems to split this way, so we do too */
 		if (v4) {
-			degenerate= barycentric_weights(v1, v2, v4, co, n, w);
+			degenerate = barycentric_weights(v1, v2, v4, co, n, w);
 			SWAP(float, w[2], w[3]);
 
-			if(degenerate || (w[0] < 0.0f)) {
+			if (degenerate || (w[0] < 0.0f)) {
 				/* if w[1] is negative, co is on the other side of the v1-v3 edge,
-				   so we interpolate using the other triangle */
-				degenerate= barycentric_weights(v2, v3, v4, co, n, w2);
-
-				if(!degenerate) {
-					w[0]= 0.0f;
-					w[1]= w2[0];
-					w[2]= w2[1];
-					w[3]= w2[2];
+				 * so we interpolate using the other triangle */
+				degenerate = barycentric_weights(v2, v3, v4, co, n, w2);
+
+				if (!degenerate) {
+					w[0] = 0.0f;
+					w[1] = w2[0];
+					w[2] = w2[1];
+					w[3] = w2[2];
 				}
 			}
 		}
@@ -1811,30 +1829,27 @@ void interp_weights_face_v3(float w[4], const float v1[3], const float v2[3], co
  * note: using area_tri_signed_v2 means locations outside the triangle are correctly weighted */
 void barycentric_weights_v2(const float v1[2], const float v2[2], const float v3[2], const float co[2], float w[3])
 {
-	float wtot_inv, wtot;
+	float wtot;
 
 	w[0] = area_tri_signed_v2(v2, v3, co);
 	w[1] = area_tri_signed_v2(v3, v1, co);
 	w[2] = area_tri_signed_v2(v1, v2, co);
-	wtot = w[0]+w[1]+w[2];
+	wtot = w[0] + w[1] + w[2];
 
 	if (wtot != 0.0f) {
-		wtot_inv = 1.0f/wtot;
-
-		w[0] = w[0]*wtot_inv;
-		w[1] = w[1]*wtot_inv;
-		w[2] = w[2]*wtot_inv;
+		mul_v3_fl(w, 1.0f / wtot);
+	}
+	else { /* dummy values for zero area face */
+		copy_v3_fl(w, 1.0f / 3.0f);
 	}
-	else /* dummy values for zero area face */
-		w[0] = w[1] = w[2] = 1.0f/3.0f;
 }
 
 /* given 2 triangles in 3D space, and a point in relation to the first triangle.
  * calculate the location of a point in relation to the second triangle.
  * Useful for finding relative positions with geometry */
 void barycentric_transform(float pt_tar[3], float const pt_src[3],
-		const float tri_tar_p1[3], const float tri_tar_p2[3], const float tri_tar_p3[3],
-		const float tri_src_p1[3], const float tri_src_p2[3], const float tri_src_p3[3])
+                           const float tri_tar_p1[3], const float tri_tar_p2[3], const float tri_tar_p3[3],
+                           const float tri_src_p1[3], const float tri_src_p2[3], const float tri_src_p3[3])
 {
 	/* this works by moving the source triangle so its normal is pointing on the Z
 	 * axis where its barycentric wights can be calculated in 2D and its Z offset can
@@ -1845,7 +1860,7 @@ void barycentric_transform(float pt_tar[3], float const pt_src[3],
 	float no_tar[3], no_src[3];
 	float quat_src[4];
 	float pt_src_xy[3];
-	float  tri_xy_src[3][3];
+	float tri_xy_src[3][3];
 	float w_src[3];
 	float area_tar, area_src;
 	float z_ofs_src;
@@ -1870,10 +1885,10 @@ void barycentric_transform(float pt_tar[3], float const pt_src[3],
 	barycentric_weights_v2(tri_xy_src[0], tri_xy_src[1], tri_xy_src[2], pt_src_xy, w_src);
 	interp_v3_v3v3v3(pt_tar, tri_tar_p1, tri_tar_p2, tri_tar_p3, w_src);
 
-	area_tar= sqrtf(area_tri_v3(tri_tar_p1, tri_tar_p2, tri_tar_p3));
-	area_src= sqrtf(area_tri_v2(tri_xy_src[0], tri_xy_src[1], tri_xy_src[2]));
+	area_tar = sqrtf(area_tri_v3(tri_tar_p1, tri_tar_p2, tri_tar_p3));
+	area_src = sqrtf(area_tri_v2(tri_xy_src[0], tri_xy_src[1], tri_xy_src[2]));
 
-	z_ofs_src= pt_src_xy[2] - tri_xy_src[0][2];
+	z_ofs_src = pt_src_xy[2] - tri_xy_src[0][2];
 	madd_v3_v3v3fl(pt_tar, pt_tar, no_tar, (z_ofs_src / area_src) * area_tar);
 }
 
@@ -1885,64 +1900,66 @@ int interp_sparse_array(float *array, int const list_size, const float skipval)
 	int found_valid = 0;
 	int i;
 
-	for (i=0; i < list_size; i++) {
-		if(array[i] == skipval)
-			found_invalid= 1;
+	for (i = 0; i < list_size; i++) {
+		if (array[i] == skipval)
+			found_invalid = 1;
 		else
-			found_valid= 1;
+			found_valid = 1;
 	}
 
-	if(found_valid==0) {
+	if (found_valid == 0) {
 		return -1;
 	}
-	else if (found_invalid==0) {
+	else if (found_invalid == 0) {
 		return 0;
 	}
 	else {
 		/* found invalid depths, interpolate */
-		float valid_last= skipval;
-		int valid_ofs= 0;
+		float valid_last = skipval;
+		int valid_ofs = 0;
 
-		float *array_up= MEM_callocN(sizeof(float) * list_size, "interp_sparse_array up");
-		float *array_down= MEM_callocN(sizeof(float) * list_size, "interp_sparse_array up");
+		float *array_up = MEM_callocN(sizeof(float) * list_size, "interp_sparse_array up");
+		float *array_down = MEM_callocN(sizeof(float) * list_size, "interp_sparse_array up");
 
-		int *ofs_tot_up= MEM_callocN(sizeof(int) * list_size, "interp_sparse_array tup");
-		int *ofs_tot_down= MEM_callocN(sizeof(int) * list_size, "interp_sparse_array tdown");
+		int *ofs_tot_up = MEM_callocN(sizeof(int) * list_size, "interp_sparse_array tup");
+		int *ofs_tot_down = MEM_callocN(sizeof(int) * list_size, "interp_sparse_array tdown");
 
-		for (i=0; i < list_size; i++) {
-			if(array[i] == skipval) {
-				array_up[i]= valid_last;
-				ofs_tot_up[i]= ++valid_ofs;
+		for (i = 0; i < list_size; i++) {
+			if (array[i] == skipval) {
+				array_up[i] = valid_last;
+				ofs_tot_up[i] = ++valid_ofs;
 			}
 			else {
-				valid_last= array[i];
-				valid_ofs= 0;
+				valid_last = array[i];
+				valid_ofs = 0;
 			}
 		}
 
-		valid_last= skipval;
-		valid_ofs= 0;
+		valid_last = skipval;
+		valid_ofs = 0;
 
-		for (i=list_size-1; i >= 0; i--) {
-			if(array[i] == skipval) {
-				array_down[i]= valid_last;
-				ofs_tot_down[i]= ++valid_ofs;
+		for (i = list_size - 1; i >= 0; i--) {
+			if (array[i] == skipval) {
+				array_down[i] = valid_last;
+				ofs_tot_down[i] = ++valid_ofs;
 			}
 			else {
-				valid_last= array[i];
-				valid_ofs= 0;
+				valid_last = array[i];
+				valid_ofs = 0;
 			}
 		}
 
 		/* now blend */
-		for (i=0; i < list_size; i++) {
-			if(array[i] == skipval) {
-				if(array_up[i] != skipval && array_down[i] != skipval) {
-					array[i]= ((array_up[i] * ofs_tot_down[i]) +  (array_down[i] * ofs_tot_up[i])) / (float)(ofs_tot_down[i] + ofs_tot_up[i]);
-				} else if (array_up[i] != skipval) {
-					array[i]= array_up[i];
-				} else if (array_down[i] != skipval) {
-					array[i]= array_down[i];
+		for (i = 0; i < list_size; i++) {
+			if (array[i] == skipval) {
+				if (array_up[i] != skipval && array_down[i] != skipval) {
+					array[i] = ((array_up[i] * ofs_tot_down[i]) + (array_down[i] * ofs_tot_up[i])) / (float)(ofs_tot_down[i] + ofs_tot_up[i]);
+				}
+				else if (array_up[i] != skipval) {
+					array[i] = array_up[i];
+				}
+				else if (array_down[i] != skipval) {
+					array[i] = array_down[i];
 				}
 			}
 		}
@@ -1967,14 +1984,14 @@ static float mean_value_half_tan(const float v1[3], const float v2[3], const flo
 	sub_v3_v3v3(d3, v3, v1);
 	cross_v3_v3v3(cross, d2, d3);
 
-	area= len_v3(cross);
-	dot= dot_v3v3(d2, d3);
-	len= len_v3(d2)*len_v3(d3);
+	area = len_v3(cross);
+	dot = dot_v3v3(d2, d3);
+	len = len_v3(d2) * len_v3(d3);
 
-	if(area == 0.0f)
+	if (area == 0.0f)
 		return 0.0f;
 	else
-		return (len - dot)/area;
+		return (len - dot) / area;
 }
 
 void interp_weights_poly_v3(float *w, float v[][3], const int n, const float co[3])
@@ -1982,120 +1999,123 @@ void interp_weights_poly_v3(float *w, float v[][3], const int n, const float co[
 	float totweight, t1, t2, len, *vmid, *vprev, *vnext;
 	int i;
 
-	totweight= 0.0f;
+	totweight = 0.0f;
 
-	for(i=0; i<n; i++) {
-		vmid= v[i];
-		vprev= (i == 0)? v[n-1]: v[i-1];
-		vnext= (i == n-1)? v[0]: v[i+1];
+	for (i = 0; i < n; i++) {
+		vmid = v[i];
+		vprev = (i == 0) ? v[n - 1] : v[i - 1];
+		vnext = (i == n - 1) ? v[0] : v[i + 1];
 
-		t1= mean_value_half_tan(co, vprev, vmid);
-		t2= mean_value_half_tan(co, vmid, vnext);
+		t1 = mean_value_half_tan(co, vprev, vmid);
+		t2 = mean_value_half_tan(co, vmid, vnext);
 
-		len= len_v3v3(co, vmid);
-		w[i]= (t1+t2)/len;
+		len = len_v3v3(co, vmid);
+		w[i] = (t1 + t2) / len;
 		totweight += w[i];
 	}
 
-	if(totweight != 0.0f)
-		for(i=0; i<n; i++)
+	if (totweight != 0.0f)
+		for (i = 0; i < n; i++)
 			w[i] /= totweight;
 }
 
 /* (x1,v1)(t1=0)------(x2,v2)(t2=1), 0<t<1 --> (x,v)(t) */
 void interp_cubic_v3(float x[3], float v[3], const float x1[3], const float v1[3], const float x2[3], const float v2[3], const float t)
 {
-	float a[3],b[3];
-	float t2= t*t;
-	float t3= t2*t;
+	float a[3], b[3];
+	float t2 = t * t;
+	float t3 = t2 * t;
 
 	/* cubic interpolation */
-	a[0]= v1[0] + v2[0] + 2*(x1[0] - x2[0]);
-	a[1]= v1[1] + v2[1] + 2*(x1[1] - x2[1]);
-	a[2]= v1[2] + v2[2] + 2*(x1[2] - x2[2]);
+	a[0] = v1[0] + v2[0] + 2 * (x1[0] - x2[0]);
+	a[1] = v1[1] + v2[1] + 2 * (x1[1] - x2[1]);
+	a[2] = v1[2] + v2[2] + 2 * (x1[2] - x2[2]);
 
-	b[0]= -2*v1[0] - v2[0] - 3*(x1[0] - x2[0]);
-	b[1]= -2*v1[1] - v2[1] - 3*(x1[1] - x2[1]);
-	b[2]= -2*v1[2] - v2[2] - 3*(x1[2] - x2[2]);
+	b[0] = -2 * v1[0] - v2[0] - 3 * (x1[0] - x2[0]);
+	b[1] = -2 * v1[1] - v2[1] - 3 * (x1[1] - x2[1]);
+	b[2] = -2 * v1[2] - v2[2] - 3 * (x1[2] - x2[2]);
 
-	x[0]= a[0]*t3 + b[0]*t2 + v1[0]*t + x1[0];
-	x[1]= a[1]*t3 + b[1]*t2 + v1[1]*t + x1[1];
-	x[2]= a[2]*t3 + b[2]*t2 + v1[2]*t + x1[2];
+	x[0] = a[0] * t3 + b[0] * t2 + v1[0] * t + x1[0];
+	x[1] = a[1] * t3 + b[1] * t2 + v1[1] * t + x1[1];
+	x[2] = a[2] * t3 + b[2] * t2 + v1[2] * t + x1[2];
 
-	v[0]= 3*a[0]*t2 + 2*b[0]*t + v1[0];
-	v[1]= 3*a[1]*t2 + 2*b[1]*t + v1[1];
-	v[2]= 3*a[2]*t2 + 2*b[2]*t + v1[2];
+	v[0] = 3 * a[0] * t2 + 2 * b[0] * t + v1[0];
+	v[1] = 3 * a[1] * t2 + 2 * b[1] * t + v1[1];
+	v[2] = 3 * a[2] * t2 + 2 * b[2] * t + v1[2];
 }
 
 /* unfortunately internal calculations have to be done at double precision to achieve correct/stable results. */
 
-#define IS_ZERO(x) ((x>(-DBL_EPSILON) && x<DBL_EPSILON) ? 1 : 0)
+#define IS_ZERO(x) ((x > (-DBL_EPSILON) && x < DBL_EPSILON) ? 1 : 0)
 
 /* Barycentric reverse  */
 void resolve_tri_uv(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2])
 {
 	/* find UV such that
-	   t= u*t0 + v*t1 + (1-u-v)*t2
-	   u*(t0-t2) + v*(t1-t2)= t-t2 */
-	const double a= st0[0]-st2[0], b= st1[0]-st2[0];
-	const double c= st0[1]-st2[1], d= st1[1]-st2[1];
-	const double det= a*d - c*b;
+	 * t = u * t0 + v * t1 + (1 - u - v) * t2
+	 * u * (t0 - t2) + v * (t1 - t2) = t - t2 */
+	const double a = st0[0] - st2[0], b = st1[0] - st2[0];
+	const double c = st0[1] - st2[1], d = st1[1] - st2[1];
+	const double det = a * d - c * b;
 
-	if(IS_ZERO(det)==0)	{  /* det should never be zero since the determinant is the signed ST area of the triangle. */
-		const double x[]= {st[0]-st2[0], st[1]-st2[1]};
+	if (IS_ZERO(det) == 0) { /* det should never be zero since the determinant is the signed ST area of the triangle. */
+		const double x[] = {st[0] - st2[0], st[1] - st2[1]};
 
-		r_uv[0]= (float)((d*x[0] - b*x[1])/det);
-		r_uv[1]= (float)(((-c)*x[0] + a*x[1])/det);
-	} else zero_v2(r_uv);
+		r_uv[0] = (float)((d * x[0] - b * x[1]) / det);
+		r_uv[1] = (float)(((-c) * x[0] + a * x[1]) / det);
+	}
+	else zero_v2(r_uv);
 }
 
 /* bilinear reverse */
 void resolve_quad_uv(float r_uv[2], const float st[2], const float st0[2], const float st1[2], const float st2[2], const float st3[2])
 {
-	const double signed_area= (st0[0]*st1[1] - st0[1]*st1[0]) + (st1[0]*st2[1] - st1[1]*st2[0]) +
-	                          (st2[0]*st3[1] - st2[1]*st3[0]) + (st3[0]*st0[1] - st3[1]*st0[0]);
+	const double signed_area = (st0[0] * st1[1] - st0[1] * st1[0]) + (st1[0] * st2[1] - st1[1] * st2[0]) +
+	                           (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)*/
-	const double a= (st0[0]-st[0])*(st0[1]-st3[1]) - (st0[1]-st[1])*(st0[0]-st3[0]);
+	 * 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])) );
+	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])));
 
 	/* 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;
+	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
 	zero_v2(r_uv);
 
-	if(IS_ZERO(denom)!=0) {
-		const double fDen= a-fC;
-		if(IS_ZERO(fDen)==0)
-			r_uv[0]= (float)(a / fDen);
-	} else {
-		const double desc_sq= b*b - a*fC;
-		const double desc= sqrt(desc_sq<0.0?0.0:desc_sq);
-		const double s= signed_area>0 ? (-1.0) : 1.0;
+	if (IS_ZERO(denom) != 0) {
+		const double fDen = a - fC;
+		if (IS_ZERO(fDen) == 0)
+			r_uv[0] = (float)(a / fDen);
+	}
+	else {
+		const double desc_sq = b * b - a * fC;
+		const double desc = sqrt(desc_sq < 0.0 ? 0.0 : desc_sq);
+		const double s = signed_area > 0 ? (-1.0) : 1.0;
 
-		r_uv[0]= (float)(( (a-b) + s * desc ) / denom);
+		r_uv[0] = (float)(((a - b) + s * desc) / denom);
 	}
 
 	/* find UV such that
-	  fST = (1-u)(1-v)*ST0 + u*(1-v)*ST1 + u*v*ST2 + (1-u)*v*ST3 */
+	 * fST = (1-u)(1-v) * ST0 + u * (1-v) * ST1 + u * v * ST2 + (1-u) * v * ST3 */
 	{
-		const double denom_s= (1-r_uv[0])*(st0[0]-st3[0]) + r_uv[0]*(st1[0]-st2[0]);
-		const double denom_t= (1-r_uv[0])*(st0[1]-st3[1]) + r_uv[0]*(st1[1]-st2[1]);
-		int i= 0; double denom= denom_s;
-
-		if(fabs(denom_s)<fabs(denom_t)) {
-			i= 1;
-			denom=denom_t;
+		const double denom_s = (1 - r_uv[0]) * (st0[0] - st3[0]) + r_uv[0] * (st1[0] - st2[0]);
+		const double denom_t = (1 - r_uv[0]) * (st0[1] - st3[1]) + r_uv[0] * (st1[1] - st2[1]);
+		int i = 0;
+		double denom = denom_s;
+
+		if (fabs(denom_s) < fabs(denom_t)) {
+			i = 1;
+			denom = denom_t;
 		}
 
-		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);
+		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);
 	}
 }
 
@@ -2106,7 +2126,7 @@ void resolve_quad_uv(float r_uv[2], const float st[2], const float st0[2], const
 void orthographic_m4(float matrix[][4], const float left, const float right, const float bottom, const float top, const float nearClip, const float farClip)
 {
 	float Xdelta, Ydelta, Zdelta;
- 
+
 	Xdelta = right - left;
 	Ydelta = top - bottom;
 	Zdelta = farClip - nearClip;
@@ -2114,12 +2134,12 @@ void orthographic_m4(float matrix[][4], const float left, const float right, con
 		return;
 	}
 	unit_m4(matrix);
-	matrix[0][0] = 2.0f/Xdelta;
-	matrix[3][0] = -(right + left)/Xdelta;
-	matrix[1][1] = 2.0f/Ydelta;
-	matrix[3][1] = -(top + bottom)/Ydelta;
-	matrix[2][2] = -2.0f/Zdelta;		/* note: negate Z	*/
-	matrix[3][2] = -(farClip + nearClip)/Zdelta;
+	matrix[0][0] = 2.0f / Xdelta;
+	matrix[3][0] = -(right + left) / Xdelta;
+	matrix[1][1] = 2.0f / Ydelta;
+	matrix[3][1] = -(top + bottom) / Ydelta;
+	matrix[2][2] = -2.0f / Zdelta; /* note: negate Z	*/
+	matrix[3][2] = -(farClip + nearClip) / Zdelta;
 }
 
 void perspective_m4(float mat[4][4], const float left, const float right, const float bottom, const float top, const float nearClip, const float farClip)
@@ -2133,38 +2153,38 @@ void perspective_m4(float mat[4][4], const float left, const float right, const
 	if (Xdelta == 0.0f || Ydelta == 0.0f || Zdelta == 0.0f) {
 		return;
 	}
-	mat[0][0] = nearClip * 2.0f/Xdelta;
-	mat[1][1] = nearClip * 2.0f/Ydelta;
-	mat[2][0] = (right + left)/Xdelta;		/* note: negate Z	*/
-	mat[2][1] = (top + bottom)/Ydelta;
-	mat[2][2] = -(farClip + nearClip)/Zdelta;
+	mat[0][0] = nearClip * 2.0f / Xdelta;
+	mat[1][1] = nearClip * 2.0f / Ydelta;
+	mat[2][0] = (right + left) / Xdelta; /* note: negate Z	*/
+	mat[2][1] = (top + bottom) / Ydelta;
+	mat[2][2] = -(farClip + nearClip) / Zdelta;
 	mat[2][3] = -1.0f;
-	mat[3][2] = (-2.0f * nearClip * farClip)/Zdelta;
+	mat[3][2] = (-2.0f * nearClip * farClip) / Zdelta;
 	mat[0][1] = mat[0][2] = mat[0][3] =
-		mat[1][0] = mat[1][2] = mat[1][3] =
-		mat[3][0] = mat[3][1] = mat[3][3] = 0.0;
+	        mat[1][0] = mat[1][2] = mat[1][3] =
+	        mat[3][0] = mat[3][1] = mat[3][3] = 0.0;
 
 }
 
 /* translate a matrix created by orthographic_m4 or perspective_m4 in XY coords (used to jitter the view) */
 void window_translate_m4(float winmat[][4], float perspmat[][4], const float x, const float y)
 {
-	if(winmat[2][3] == -1.0f) {
+	if (winmat[2][3] == -1.0f) {
 		/* in the case of a win-matrix, this means perspective always */
 		float v1[3];
 		float v2[3];
 		float len1, len2;
 
-		v1[0]= perspmat[0][0];
-		v1[1]= perspmat[1][0];
-		v1[2]= perspmat[2][0];
+		v1[0] = perspmat[0][0];
+		v1[1] = perspmat[1][0];
+		v1[2] = perspmat[2][0];
 
-		v2[0]= perspmat[0][1];
-		v2[1]= perspmat[1][1];
-		v2[2]= perspmat[2][1];
+		v2[0] = perspmat[0][1];
+		v2[1] = perspmat[1][1];
+		v2[2] = perspmat[2][1];
 
-		len1= (1.0f / len_v3(v1));
-		len2= (1.0f / len_v3(v2));
+		len1 = (1.0f / len_v3(v1));
+		len2 = (1.0f / len_v3(v2));
 
 		winmat[2][0] += len1 * winmat[0][0] * x;
 		winmat[2][1] += len2 * winmat[1][1] * y;
@@ -2180,32 +2200,31 @@ static void i_multmatrix(float icand[][4], float Vm[][4])
 	int row, col;
 	float temp[4][4];
 
-	for(row=0 ; row<4 ; row++) 
-		for(col=0 ; col<4 ; col++)
-			temp[row][col] = icand[row][0] * Vm[0][col]
-						   + icand[row][1] * Vm[1][col]
-						   + icand[row][2] * Vm[2][col]
-						   + icand[row][3] * Vm[3][col];
+	for (row = 0; row < 4; row++)
+		for (col = 0; col < 4; col++)
+			temp[row][col] = (icand[row][0] * Vm[0][col] +
+			                  icand[row][1] * Vm[1][col] +
+			                  icand[row][2] * Vm[2][col] +
+			                  icand[row][3] * Vm[3][col]);
 	copy_m4_m4(Vm, temp);
 }
 
-
-void polarview_m4(float Vm[][4],float dist, float azimuth, float incidence, float twist)
+void polarview_m4(float Vm[][4], float dist, float azimuth, float incidence, float twist)
 {
 
 	unit_m4(Vm);
 
-	translate_m4(Vm,0.0, 0.0, -dist);
-	rotate_m4(Vm,'Z',-twist);
-	rotate_m4(Vm,'X',-incidence);
-	rotate_m4(Vm,'Z',-azimuth);
+	translate_m4(Vm, 0.0, 0.0, -dist);
+	rotate_m4(Vm, 'Z', -twist);
+	rotate_m4(Vm, 'X', -incidence);
+	rotate_m4(Vm, 'Z', -azimuth);
 }
 
-void lookat_m4(float mat[][4],float vx, float vy, float vz, float px, float py, float pz, float twist)
+void lookat_m4(float mat[][4], float vx, float vy, float vz, float px, float py, float pz, float twist)
 {
 	float sine, cosine, hyp, hyp1, dx, dy, dz;
-	float mat1[4][4]= MAT4_UNITY;
-	
+	float mat1[4][4] = MAT4_UNITY;
+
 	unit_m4(mat);
 
 	rotate_m4(mat, 'Z', -twist);
@@ -2213,14 +2232,15 @@ void lookat_m4(float mat[][4],float vx, float vy, float vz, float px, float py,
 	dx = px - vx;
 	dy = py - vy;
 	dz = pz - vz;
-	hyp = dx * dx + dz * dz;	/* hyp squared	*/
-	hyp1 = (float)sqrt(dy*dy + hyp);
-	hyp = (float)sqrt(hyp);		/* the real hyp	*/
-	
-	if (hyp1 != 0.0f) {		/* rotate X	*/
+	hyp = dx * dx + dz * dz; /* hyp squared	*/
+	hyp1 = (float)sqrt(dy * dy + hyp);
+	hyp = (float)sqrt(hyp); /* the real hyp	*/
+
+	if (hyp1 != 0.0f) { /* rotate X	*/
 		sine = -dy / hyp1;
-		cosine = hyp /hyp1;
-	} else {
+		cosine = hyp / hyp1;
+	}
+	else {
 		sine = 0;
 		cosine = 1.0f;
 	}
@@ -2228,17 +2248,18 @@ void lookat_m4(float mat[][4],float vx, float vy, float vz, float px, float py,
 	mat1[1][2] = sine;
 	mat1[2][1] = -sine;
 	mat1[2][2] = cosine;
-	
+
 	i_multmatrix(mat1, mat);
 
-	mat1[1][1] = mat1[2][2] = 1.0f;	/* be careful here to reinit	*/
-	mat1[1][2] = mat1[2][1] = 0.0;	/* those modified by the last	*/
-	
+	mat1[1][1] = mat1[2][2] = 1.0f; /* be careful here to reinit	*/
+	mat1[1][2] = mat1[2][1] = 0.0; /* those modified by the last	*/
+
 	/* paragraph	*/
-	if (hyp != 0.0f) {			/* rotate Y	*/
+	if (hyp != 0.0f) { /* rotate Y	*/
 		sine = dx / hyp;
 		cosine = -dz / hyp;
-	} else {
+	}
+	else {
 		sine = 0;
 		cosine = 1.0f;
 	}
@@ -2246,43 +2267,43 @@ void lookat_m4(float mat[][4],float vx, float vy, float vz, float px, float py,
 	mat1[0][2] = -sine;
 	mat1[2][0] = sine;
 	mat1[2][2] = cosine;
-	
+
 	i_multmatrix(mat1, mat);
-	translate_m4(mat,-vx,-vy,-vz);	/* translate viewpoint to origin */
+	translate_m4(mat, -vx, -vy, -vz); /* translate viewpoint to origin */
 }
 
 int box_clip_bounds_m4(float boundbox[2][3], const float bounds[4], float winmat[4][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++) {
-		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;
+	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;
-		if(bounds) {
-			if(vec[0] > bounds[1]*vec[3]) fl |= 1;
-			if(vec[0]< bounds[0]*vec[3]) fl |= 2;
-			if(vec[1] > bounds[3]*vec[3]) fl |= 4;
-			if(vec[1]< bounds[2]*vec[3]) fl |= 8;
+		fl = 0;
+		if (bounds) {
+			if (vec[0] > bounds[1] * vec[3]) fl |= 1;
+			if (vec[0] < bounds[0] * vec[3]) fl |= 2;
+			if (vec[1] > bounds[3] * vec[3]) fl |= 4;
+			if (vec[1] < bounds[2] * vec[3]) fl |= 8;
 		}
 		else {
-			if(vec[0] < -vec[3]) fl |= 1;
-			if(vec[0] > vec[3]) fl |= 2;
-			if(vec[1] < -vec[3]) fl |= 4;
-			if(vec[1] > vec[3]) fl |= 8;
+			if (vec[0] < -vec[3]) fl |= 1;
+			if (vec[0] > vec[3]) fl |= 2;
+			if (vec[1] < -vec[3]) fl |= 4;
+			if (vec[1] > vec[3]) fl |= 8;
 		}
-		if(vec[2] < -vec[3]) fl |= 16;
-		if(vec[2] > vec[3]) fl |= 32;
+		if (vec[2] < -vec[3]) fl |= 16;
+		if (vec[2] > vec[3]) fl |= 32;
 
 		flag &= fl;
-		if(flag==0) return 0;
+		if (flag == 0) return 0;
 	}
 
 	return flag;
@@ -2296,10 +2317,10 @@ void box_minmax_bounds_m4(float min[3], float max[3], float boundbox[2][3], floa
 	copy_v3_v3(mn, min);
 	copy_v3_v3(mx, max);
 
-	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];
+	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];
 
 		mul_m4_v3(mat, vec);
 		DO_MINMAX(vec, mn, mx);
@@ -2311,48 +2332,51 @@ void box_minmax_bounds_m4(float min[3], float max[3], float boundbox[2][3], floa
 
 /********************************** Mapping **********************************/
 
-void map_to_tube(float *u, float *v, const float x, const float y, const float z)
+void map_to_tube(float *r_u, float *r_v, const float x, const float y, const float z)
 {
 	float len;
-	
-	*v = (z + 1.0f) / 2.0f;
-	
-	len= (float)sqrt(x*x+y*y);
-	if(len > 0.0f)
-		*u = (float)((1.0 - (atan2(x/len,y/len) / M_PI)) / 2.0);
-	else
-		*v = *u = 0.0f; /* to avoid un-initialized variables */
+
+	*r_v = (z + 1.0f) / 2.0f;
+
+	len = sqrtf(x * x + y * y);
+	if (len > 0.0f) {
+		*r_u = (float)((1.0 - (atan2(x / len, y / len) / M_PI)) / 2.0);
+	}
+	else {
+		*r_v = *r_u = 0.0f; /* to avoid un-initialized variables */
+	}
 }
 
-void map_to_sphere(float *u, float *v, const float x, const float y, const float z)
+void map_to_sphere(float *r_u, float *r_v, const float x, const float y, const float z)
 {
 	float len;
-	
-	len= (float)sqrt(x*x+y*y+z*z);
-	if(len > 0.0f) {
-		if(x==0.0f && y==0.0f) *u= 0.0f;	/* othwise domain error */
-		else *u = (1.0f - atan2f(x,y) / (float)M_PI) / 2.0f;
 
-		*v = 1.0f - (float)saacos(z/len)/(float)M_PI;
-	} else {
-		*v = *u = 0.0f; /* to avoid un-initialized variables */
+	len = sqrtf(x * x + y * y + z * z);
+	if (len > 0.0f) {
+		if (x == 0.0f && y == 0.0f) *r_u = 0.0f;  /* othwise domain error */
+		else *r_u = (1.0f - atan2f(x, y) / (float)M_PI) / 2.0f;
+
+		*r_v = 1.0f - (float)saacos(z / len) / (float)M_PI;
+	}
+	else {
+		*r_v = *r_u = 0.0f; /* to avoid un-initialized variables */
 	}
 }
 
 /********************************* Normals **********************************/
 
 void accumulate_vertex_normals(float n1[3], float n2[3], float n3[3],
-	float n4[3], const float f_no[3], const float co1[3], const float co2[3],
-	const float co3[3], const float co4[3])
+                               float n4[3], const float f_no[3], const float co1[3], const float co2[3],
+                               const float co3[3], const float co4[3])
 {
 	float vdiffs[4][3];
-	const int nverts= (n4!=NULL && co4!=NULL)? 4: 3;
+	const int nverts = (n4 != NULL && co4 != NULL) ? 4 : 3;
 
 	/* compute normalized edge vectors */
 	sub_v3_v3v3(vdiffs[0], co2, co1);
 	sub_v3_v3v3(vdiffs[1], co3, co2);
 
-	if(nverts==3) {
+	if (nverts == 3) {
 		sub_v3_v3v3(vdiffs[2], co1, co3);
 	}
 	else {
@@ -2367,13 +2391,13 @@ void accumulate_vertex_normals(float n1[3], float n2[3], float n3[3],
 
 	/* accumulate angle weighted face normal */
 	{
-		float *vn[]= {n1, n2, n3, n4};
-		const float *prev_edge = vdiffs[nverts-1];
+		float *vn[] = {n1, n2, n3, n4};
+		const float *prev_edge = vdiffs[nverts - 1];
 		int i;
 
-		for(i=0; i<nverts; i++) {
-			const float *cur_edge= vdiffs[i];
-			const float fac= saacos(-dot_v3v3(cur_edge, prev_edge));
+		for (i = 0; i < nverts; i++) {
+			const float *cur_edge = vdiffs[i];
+			const float fac = saacos(-dot_v3v3(cur_edge, prev_edge));
 
 			// accumulate
 			madd_v3_v3fl(vn[i], f_no, fac);
@@ -2383,29 +2407,29 @@ void accumulate_vertex_normals(float n1[3], float n2[3], float n3[3],
 }
 
 /* Add weighted face normal component into normals of the face vertices.
-   Caller must pass pre-allocated vdiffs of nverts length. */
+ * Caller must pass pre-allocated vdiffs of nverts length. */
 void accumulate_vertex_normals_poly(float **vertnos, float polyno[3],
-	float **vertcos, float vdiffs[][3], int nverts)
+                                    float **vertcos, float vdiffs[][3], int nverts)
 {
 	int i;
 
 	/* calculate normalized edge directions for each edge in the poly */
 	for (i = 0; i < nverts; i++) {
-		sub_v3_v3v3(vdiffs[i], vertcos[(i+1) % nverts], vertcos[i]);
+		sub_v3_v3v3(vdiffs[i], vertcos[(i + 1) % nverts], vertcos[i]);
 		normalize_v3(vdiffs[i]);
 	}
 
 	/* accumulate angle weighted face normal */
 	{
-		const float *prev_edge = vdiffs[nverts-1];
+		const float *prev_edge = vdiffs[nverts - 1];
 		int i;
 
-		for(i=0; i<nverts; i++) {
+		for (i = 0; i < nverts; i++) {
 			const float *cur_edge = vdiffs[i];
-			
+
 			/* calculate angle between the two poly edges incident on
-			   this vertex */
-			const float fac= saacos(-dot_v3v3(cur_edge, prev_edge));
+			 * this vertex */
+			const float fac = saacos(-dot_v3v3(cur_edge, prev_edge));
 
 			/* accumulate */
 			madd_v3_v3fl(vertnos[i], polyno, fac);
@@ -2417,35 +2441,35 @@ 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 
+ * 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
+#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) {
+	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));
+	vt = BLI_memarena_alloc((MemArena *) arena, sizeof(VertexTangent));
 	copy_v3_v3(vt->tang, tang);
-	vt->uv[0]= uv[0];
-	vt->uv[1]= uv[1];
+	vt->uv[0] = uv[0];
+	vt->uv[1] = uv[1];
 
-	if(*vtang)
-		vt->next= *vtang;
-	*vtang= vt;
+	if (*vtang)
+		vt->next = *vtang;
+	*vtang = vt;
 }
 
 float *find_vertex_tangent(VertexTangent *vtang, const float uv[2])
@@ -2453,44 +2477,44 @@ 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)
+	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 */
+	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];
-	float s2= uv3[0] - uv1[0];
-	float t1= uv2[1] - uv1[1];
-	float t2= uv3[1] - uv1[1];
-	float det= (s1 * t2 - s2 * t1);
+	float s1 = uv2[0] - uv1[0];
+	float s2 = uv3[0] - uv1[0];
+	float t1 = uv2[1] - uv1[1];
+	float t2 = uv3[1] - uv1[1];
+	float det = (s1 * t2 - s2 * t1);
 
-	if(det != 0.0f) { /* otherwise 'tang' becomes nan */
+	if (det != 0.0f) { /* otherwise 'tang' becomes nan */
 		float tangv[3], ct[3], e1[3], e2[3];
 
-		det= 1.0f/det;
+		det = 1.0f / det;
 
 		/* normals in render are inversed... */
 		sub_v3_v3v3(e1, co1, co2);
 		sub_v3_v3v3(e2, co1, co3);
-		tang[0] = (t2*e1[0] - t1*e2[0])*det;
-		tang[1] = (t2*e1[1] - t1*e2[1])*det;
-		tang[2] = (t2*e1[2] - t1*e2[2])*det;
-		tangv[0] = (s1*e2[0] - s2*e1[0])*det;
-		tangv[1] = (s1*e2[1] - s2*e1[1])*det;
-		tangv[2] = (s1*e2[2] - s2*e1[2])*det;
+		tang[0] = (t2 * e1[0] - t1 * e2[0]) * det;
+		tang[1] = (t2 * e1[1] - t1 * e2[1]) * det;
+		tang[2] = (t2 * e1[2] - t1 * e2[2]) * det;
+		tangv[0] = (s1 * e2[0] - s2 * e1[0]) * det;
+		tangv[1] = (s1 * e2[1] - s2 * e1[1]) * det;
+		tangv[2] = (s1 * e2[2] - s2 * e1[2]) * det;
 		cross_v3_v3v3(ct, tang, tangv);
-	
+
 		/* check flip */
 		if (dot_v3v3(ct, n) < 0.0f) {
 			negate_v3(tang);
 		}
 	}
 	else {
-		tang[0]= tang[1]= tang[2]=  0.0;
+		tang[0] = tang[1] = tang[2] = 0.0;
 	}
 }
 
@@ -2498,45 +2522,44 @@ void tangent_from_uv(float uv1[2], float uv2[2], float uv3[3], float co1[3], flo
 
 /* vector clouds */
 /* void vcloud_estimate_transform(int list_size, float (*pos)[3], float *weight,float (*rpos)[3], float *rweight,
-								 float lloc[3],float rloc[3],float lrot[3][3],float lscale[3][3])
-
-input
-(
-int list_size
-4 lists as pointer to array[list_size]
-1. current pos array of 'new' positions 
-2. current weight array of 'new'weights (may be NULL pointer if you have no weights )
-3. reference rpos array of 'old' positions
-4. reference rweight array of 'old'weights (may be NULL pointer if you have no weights )
-)
-output  
-(
-float lloc[3] center of mass pos
-float rloc[3] center of mass rpos
-float lrot[3][3] rotation matrix
-float lscale[3][3] scale matrix
-pointers may be NULL if not needed
-)
-
-*/
+ *                                float lloc[3],float rloc[3],float lrot[3][3],float lscale[3][3])
+ *
+ * input
+ * (
+ * int list_size
+ * 4 lists as pointer to array[list_size]
+ * 1. current pos array of 'new' positions
+ * 2. current weight array of 'new'weights (may be NULL pointer if you have no weights )
+ * 3. reference rpos array of 'old' positions
+ * 4. reference rweight array of 'old'weights (may be NULL pointer if you have no weights )
+ * )
+ * output
+ * (
+ * float lloc[3] center of mass pos
+ * float rloc[3] center of mass rpos
+ * float lrot[3][3] rotation matrix
+ * float lscale[3][3] scale matrix
+ * pointers may be NULL if not needed
+ * )
+ */
+
 /* can't believe there is none in math utils */
 static float _det_m3(float m2[3][3])
 {
 	float det = 0.f;
-	if (m2){
-	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]);
+	if (m2) {
+		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]));
 	}
 	return det;
 }
 
-
-void vcloud_estimate_transform(int list_size, float (*pos)[3], float *weight,float (*rpos)[3], float *rweight,
-							float lloc[3],float rloc[3],float lrot[3][3],float lscale[3][3])
+void vcloud_estimate_transform(int list_size, float (*pos)[3], float *weight, float (*rpos)[3], float *rweight,
+                               float lloc[3], float rloc[3], float lrot[3][3], float lscale[3][3])
 {
-	float accu_com[3]= {0.0f,0.0f,0.0f}, accu_rcom[3]= {0.0f,0.0f,0.0f};
-	float accu_weight = 0.0f,accu_rweight = 0.0f,eps = 0.000001f;
+	float accu_com[3] = {0.0f, 0.0f, 0.0f}, accu_rcom[3] = {0.0f, 0.0f, 0.0f};
+	float accu_weight = 0.0f, accu_rweight = 0.0f, eps = 0.000001f;
 
 	int a;
 	/* first set up a nice default response */
@@ -2545,52 +2568,51 @@ void vcloud_estimate_transform(int list_size, float (*pos)[3], float *weight,flo
 	if (lrot) unit_m3(lrot);
 	if (lscale) unit_m3(lscale);
 	/* do com for both clouds */
-	if (pos && rpos && (list_size > 0)) /* paranoya check */
-	{
+	if (pos && rpos && (list_size > 0)) { /* paranoya check */
 		/* do com for both clouds */
-		for(a=0; a<list_size; a++){
-			if (weight){
+		for (a = 0; a < list_size; a++) {
+			if (weight) {
 				float v[3];
-				copy_v3_v3(v,pos[a]);
-				mul_v3_fl(v,weight[a]);
+				copy_v3_v3(v, pos[a]);
+				mul_v3_fl(v, weight[a]);
 				add_v3_v3(accu_com, v);
-				accu_weight +=weight[a]; 
+				accu_weight += weight[a];
 			}
 			else add_v3_v3(accu_com, pos[a]);
 
-			if (rweight){
+			if (rweight) {
 				float v[3];
-				copy_v3_v3(v,rpos[a]);
-				mul_v3_fl(v,rweight[a]);
+				copy_v3_v3(v, rpos[a]);
+				mul_v3_fl(v, rweight[a]);
 				add_v3_v3(accu_rcom, v);
-				accu_rweight +=rweight[a]; 
+				accu_rweight += rweight[a];
 			}
 			else add_v3_v3(accu_rcom, rpos[a]);
 
 		}
-		if (!weight || !rweight){
+		if (!weight || !rweight) {
 			accu_weight = accu_rweight = list_size;
 		}
 
-		mul_v3_fl(accu_com,1.0f/accu_weight);
-		mul_v3_fl(accu_rcom,1.0f/accu_rweight);
-		if (lloc) copy_v3_v3(lloc,accu_com);
-		if (rloc) copy_v3_v3(rloc,accu_rcom);
-		if (lrot || lscale){ /* caller does not want rot nor scale, strange but legal */
+		mul_v3_fl(accu_com, 1.0f / accu_weight);
+		mul_v3_fl(accu_rcom, 1.0f / accu_rweight);
+		if (lloc) copy_v3_v3(lloc, accu_com);
+		if (rloc) copy_v3_v3(rloc, accu_rcom);
+		if (lrot || lscale) { /* caller does not want rot nor scale, strange but legal */
 			/*so now do some reverse engeneering and see if we can split rotation from scale ->Polardecompose*/
 			/* build 'projection' matrix */
-			float m[3][3],mr[3][3],q[3][3],qi[3][3];
-			float va[3],vb[3],stunt[3];
-			float odet,ndet;
-			int i=0,imax=15;
+			float m[3][3], mr[3][3], q[3][3], qi[3][3];
+			float va[3], vb[3], stunt[3];
+			float odet, ndet;
+			int i = 0, imax = 15;
 			zero_m3(m);
 			zero_m3(mr);
 
 			/* build 'projection' matrix */
-			for(a=0; a<list_size; a++){
-				sub_v3_v3v3(va,rpos[a],accu_rcom);
+			for (a = 0; a < list_size; a++) {
+				sub_v3_v3v3(va, rpos[a], accu_rcom);
 				/* mul_v3_fl(va,bp->mass);  mass needs renormalzation here ?? */
-				sub_v3_v3v3(vb,pos[a],accu_com);
+				sub_v3_v3v3(vb, pos[a], accu_com);
 				/* mul_v3_fl(va,rp->mass); */
 				m[0][0] += va[0] * vb[0];
 				m[0][1] += va[0] * vb[1];
@@ -2604,8 +2626,8 @@ void vcloud_estimate_transform(int list_size, float (*pos)[3], float *weight,flo
 				m[2][1] += va[2] * vb[1];
 				m[2][2] += va[2] * vb[2];
 
-				/* building the referenc matrix on the fly
-				needed to scale properly later*/
+				/* building the reference matrix on the fly
+				 * needed to scale properly later */
 
 				mr[0][0] += va[0] * va[0];
 				mr[0][1] += va[0] * va[1];
@@ -2619,34 +2641,36 @@ void vcloud_estimate_transform(int list_size, float (*pos)[3], float *weight,flo
 				mr[2][1] += va[2] * va[1];
 				mr[2][2] += va[2] * va[2];
 			}
-			copy_m3_m3(q,m);
-			stunt[0] = q[0][0]; stunt[1] = q[1][1]; stunt[2] = q[2][2];
+			copy_m3_m3(q, m);
+			stunt[0] = q[0][0];
+			stunt[1] = q[1][1];
+			stunt[2] = q[2][2];
 			/* renormalizing for numeric stability */
-			mul_m3_fl(q,1.f/len_v3(stunt)); 
+			mul_m3_fl(q, 1.f / len_v3(stunt));
 
 			/* this is pretty much Polardecompose 'inline' the algo based on Higham's thesis */
 			/* without the far case ... but seems to work here pretty neat                   */
 			odet = 0.f;
 			ndet = _det_m3(q);
-			while((odet-ndet)*(odet-ndet) > eps && i<imax){
-				invert_m3_m3(qi,q);
+			while ((odet - ndet) * (odet - ndet) > eps && i < imax) {
+				invert_m3_m3(qi, q);
 				transpose_m3(qi);
-				add_m3_m3m3(q,q,qi);
-				mul_m3_fl(q,0.5f);
-				odet =ndet;
-				ndet =_det_m3(q);
+				add_m3_m3m3(q, q, qi);
+				mul_m3_fl(q, 0.5f);
+				odet = ndet;
+				ndet = _det_m3(q);
 				i++;
 			}
 
-			if (i){
+			if (i) {
 				float scale[3][3];
 				float irot[3][3];
-				if(lrot) copy_m3_m3(lrot,q);
-				invert_m3_m3(irot,q);
-				invert_m3_m3(qi,mr);
-				mul_m3_m3m3(q,m,qi); 
-				mul_m3_m3m3(scale,irot,q); 
-				if(lscale) copy_m3_m3(lscale,scale);
+				if (lrot) copy_m3_m3(lrot, q);
+				invert_m3_m3(irot, q);
+				invert_m3_m3(qi, mr);
+				mul_m3_m3m3(q, m, qi);
+				mul_m3_m3m3(scale, irot, q);
+				if (lscale) copy_m3_m3(lscale, scale);
 
 			}
 		}
@@ -2657,42 +2681,44 @@ void vcloud_estimate_transform(int list_size, float (*pos)[3], float *weight,flo
 
 static void vec_add_dir(float r[3], const float v1[3], const float v2[3], const float fac)
 {
-	r[0]= v1[0] + fac*(v2[0] - v1[0]);
-	r[1]= v1[1] + fac*(v2[1] - v1[1]);
-	r[2]= v1[2] + fac*(v2[2] - v1[2]);
+	r[0] = v1[0] + fac * (v2[0] - v1[0]);
+	r[1] = v1[1] + fac * (v2[1] - v1[1]);
+	r[2] = v1[2] + fac * (v2[2] - v1[2]);
 }
 
-static int ff_visible_quad(const float p[3], const float n[3], const float v0[3], const float v1[3], const float v2[3], float q0[3], float q1[3], float q2[3], float q3[3])
+static int ff_visible_quad(const float p[3], const float n[3],
+                           const float v0[3], const float v1[3], const float v2[3],
+                           float q0[3], float q1[3], float q2[3], float q3[3])
 {
 	static const float epsilon = 1e-6f;
 	float c, sd[3];
-	
-	c= dot_v3v3(n, p);
+
+	c = dot_v3v3(n, p);
 
 	/* signed distances from the vertices to the plane. */
-	sd[0]= dot_v3v3(n, v0) - c;
-	sd[1]= dot_v3v3(n, v1) - c;
-	sd[2]= dot_v3v3(n, v2) - c;
+	sd[0] = dot_v3v3(n, v0) - c;
+	sd[1] = dot_v3v3(n, v1) - c;
+	sd[2] = dot_v3v3(n, v2) - c;
 
-	if(fabsf(sd[0]) < epsilon) sd[0] = 0.0f;
-	if(fabsf(sd[1]) < epsilon) sd[1] = 0.0f;
-	if(fabsf(sd[2]) < epsilon) sd[2] = 0.0f;
+	if (fabsf(sd[0]) < epsilon) sd[0] = 0.0f;
+	if (fabsf(sd[1]) < epsilon) sd[1] = 0.0f;
+	if (fabsf(sd[2]) < epsilon) sd[2] = 0.0f;
 
-	if(sd[0] > 0) {
-		if(sd[1] > 0) {
-			if(sd[2] > 0) {
+	if (sd[0] > 0) {
+		if (sd[1] > 0) {
+			if (sd[2] > 0) {
 				// +++
 				copy_v3_v3(q0, v0);
 				copy_v3_v3(q1, v1);
 				copy_v3_v3(q2, v2);
 				copy_v3_v3(q3, q2);
 			}
-			else if(sd[2] < 0) {
+			else if (sd[2] < 0) {
 				// ++-
 				copy_v3_v3(q0, v0);
 				copy_v3_v3(q1, v1);
-				vec_add_dir(q2, v1, v2, (sd[1]/(sd[1]-sd[2])));
-				vec_add_dir(q3, v0, v2, (sd[0]/(sd[0]-sd[2])));
+				vec_add_dir(q2, v1, v2, (sd[1] / (sd[1] - sd[2])));
+				vec_add_dir(q3, v0, v2, (sd[0] / (sd[0] - sd[2])));
 			}
 			else {
 				// ++0
@@ -2702,42 +2728,42 @@ static int ff_visible_quad(const float p[3], const float n[3], const float v0[3]
 				copy_v3_v3(q3, q2);
 			}
 		}
-		else if(sd[1] < 0) {
-			if(sd[2] > 0) {
+		else if (sd[1] < 0) {
+			if (sd[2] > 0) {
 				// +-+
 				copy_v3_v3(q0, v0);
-				vec_add_dir(q1, v0, v1, (sd[0]/(sd[0]-sd[1])));
-				vec_add_dir(q2, v1, v2, (sd[1]/(sd[1]-sd[2])));
+				vec_add_dir(q1, v0, v1, (sd[0] / (sd[0] - sd[1])));
+				vec_add_dir(q2, v1, v2, (sd[1] / (sd[1] - sd[2])));
 				copy_v3_v3(q3, v2);
 			}
-			else if(sd[2] < 0) {
+			else if (sd[2] < 0) {
 				// +--
 				copy_v3_v3(q0, v0);
-				vec_add_dir(q1, v0, v1, (sd[0]/(sd[0]-sd[1])));
-				vec_add_dir(q2, v0, v2, (sd[0]/(sd[0]-sd[2])));
+				vec_add_dir(q1, v0, v1, (sd[0] / (sd[0] - sd[1])));
+				vec_add_dir(q2, v0, v2, (sd[0] / (sd[0] - sd[2])));
 				copy_v3_v3(q3, q2);
 			}
 			else {
 				// +-0
 				copy_v3_v3(q0, v0);
-				vec_add_dir(q1, v0, v1, (sd[0]/(sd[0]-sd[1])));
+				vec_add_dir(q1, v0, v1, (sd[0] / (sd[0] - sd[1])));
 				copy_v3_v3(q2, v2);
 				copy_v3_v3(q3, q2);
 			}
 		}
 		else {
-			if(sd[2] > 0) {
+			if (sd[2] > 0) {
 				// +0+
 				copy_v3_v3(q0, v0);
 				copy_v3_v3(q1, v1);
 				copy_v3_v3(q2, v2);
 				copy_v3_v3(q3, q2);
 			}
-			else if(sd[2] < 0) {
+			else if (sd[2] < 0) {
 				// +0-
 				copy_v3_v3(q0, v0);
 				copy_v3_v3(q1, v1);
-				vec_add_dir(q2, v0, v2, (sd[0]/(sd[0]-sd[2])));
+				vec_add_dir(q2, v0, v2, (sd[0] / (sd[0] - sd[2])));
 				copy_v3_v3(q3, q2);
 			}
 			else {
@@ -2749,39 +2775,39 @@ static int ff_visible_quad(const float p[3], const float n[3], const float v0[3]
 			}
 		}
 	}
-	else if(sd[0] < 0) {
-		if(sd[1] > 0) {
-			if(sd[2] > 0) {
+	else if (sd[0] < 0) {
+		if (sd[1] > 0) {
+			if (sd[2] > 0) {
 				// -++
-				vec_add_dir(q0, v0, v1, (sd[0]/(sd[0]-sd[1])));
+				vec_add_dir(q0, v0, v1, (sd[0] / (sd[0] - sd[1])));
 				copy_v3_v3(q1, v1);
 				copy_v3_v3(q2, v2);
-				vec_add_dir(q3, v0, v2, (sd[0]/(sd[0]-sd[2])));
+				vec_add_dir(q3, v0, v2, (sd[0] / (sd[0] - sd[2])));
 			}
-			else if(sd[2] < 0) {
+			else if (sd[2] < 0) {
 				// -+-
-				vec_add_dir(q0, v0, v1, (sd[0]/(sd[0]-sd[1])));
+				vec_add_dir(q0, v0, v1, (sd[0] / (sd[0] - sd[1])));
 				copy_v3_v3(q1, v1);
-				vec_add_dir(q2, v1, v2, (sd[1]/(sd[1]-sd[2])));
+				vec_add_dir(q2, v1, v2, (sd[1] / (sd[1] - sd[2])));
 				copy_v3_v3(q3, q2);
 			}
 			else {
 				// -+0
-				vec_add_dir(q0, v0, v1, (sd[0]/(sd[0]-sd[1])));
+				vec_add_dir(q0, v0, v1, (sd[0] / (sd[0] - sd[1])));
 				copy_v3_v3(q1, v1);
 				copy_v3_v3(q2, v2);
 				copy_v3_v3(q3, q2);
 			}
 		}
-		else if(sd[1] < 0) {
-			if(sd[2] > 0) {
+		else if (sd[1] < 0) {
+			if (sd[2] > 0) {
 				// --+
-				vec_add_dir(q0, v0, v2, (sd[0]/(sd[0]-sd[2])));
-				vec_add_dir(q1, v1, v2, (sd[1]/(sd[1]-sd[2])));
+				vec_add_dir(q0, v0, v2, (sd[0] / (sd[0] - sd[2])));
+				vec_add_dir(q1, v1, v2, (sd[1] / (sd[1] - sd[2])));
 				copy_v3_v3(q2, v2);
 				copy_v3_v3(q3, q2);
 			}
-			else if(sd[2] < 0) {
+			else if (sd[2] < 0) {
 				// ---
 				return 0;
 			}
@@ -2791,14 +2817,14 @@ static int ff_visible_quad(const float p[3], const float n[3], const float v0[3]
 			}
 		}
 		else {
-			if(sd[2] > 0) {
+			if (sd[2] > 0) {
 				// -0+
-				vec_add_dir(q0, v0, v2, (sd[0]/(sd[0]-sd[2])));
+				vec_add_dir(q0, v0, v2, (sd[0] / (sd[0] - sd[2])));
 				copy_v3_v3(q1, v1);
 				copy_v3_v3(q2, v2);
 				copy_v3_v3(q3, q2);
 			}
-			else if(sd[2] < 0) {
+			else if (sd[2] < 0) {
 				// -0-
 				return 0;
 			}
@@ -2809,19 +2835,19 @@ static int ff_visible_quad(const float p[3], const float n[3], const float v0[3]
 		}
 	}
 	else {
-		if(sd[1] > 0) {
-			if(sd[2] > 0) {
+		if (sd[1] > 0) {
+			if (sd[2] > 0) {
 				// 0++
 				copy_v3_v3(q0, v0);
 				copy_v3_v3(q1, v1);
 				copy_v3_v3(q2, v2);
 				copy_v3_v3(q3, q2);
 			}
-			else if(sd[2] < 0) {
+			else if (sd[2] < 0) {
 				// 0+-
 				copy_v3_v3(q0, v0);
 				copy_v3_v3(q1, v1);
-				vec_add_dir(q2, v1, v2, (sd[1]/(sd[1]-sd[2])));
+				vec_add_dir(q2, v1, v2, (sd[1] / (sd[1] - sd[2])));
 				copy_v3_v3(q3, q2);
 			}
 			else {
@@ -2832,15 +2858,15 @@ static int ff_visible_quad(const float p[3], const float n[3], const float v0[3]
 				copy_v3_v3(q3, q2);
 			}
 		}
-		else if(sd[1] < 0) {
-			if(sd[2] > 0) {
+		else if (sd[1] < 0) {
+			if (sd[2] > 0) {
 				// 0-+
 				copy_v3_v3(q0, v0);
-				vec_add_dir(q1, v1, v2, (sd[1]/(sd[1]-sd[2])));
+				vec_add_dir(q1, v1, v2, (sd[1] / (sd[1] - sd[2])));
 				copy_v3_v3(q2, v2);
 				copy_v3_v3(q3, q2);
 			}
-			else if(sd[2] < 0) {
+			else if (sd[2] < 0) {
 				// 0--
 				return 0;
 			}
@@ -2850,14 +2876,14 @@ static int ff_visible_quad(const float p[3], const float n[3], const float v0[3]
 			}
 		}
 		else {
-			if(sd[2] > 0) {
+			if (sd[2] > 0) {
 				// 00+
 				copy_v3_v3(q0, v0);
 				copy_v3_v3(q1, v1);
 				copy_v3_v3(q2, v2);
 				copy_v3_v3(q3, q2);
 			}
-			else if(sd[2] < 0) {
+			else if (sd[2] < 0) {
 				// 00-
 				return 0;
 			}
@@ -2883,55 +2909,55 @@ typedef union {
 
 static vFloat vec_splat_float(float val)
 {
-	return (vFloat){val, val, val, val};
+	return (vFloat) {val, val, val, val};
 }
 
 static float ff_quad_form_factor(float *p, float *n, float *q0, float *q1, float *q2, float *q3)
 {
 	vFloat vcos, rlen, vrx, vry, vrz, vsrx, vsry, vsrz, gx, gy, gz, vangle;
-	vUInt8 rotate = (vUInt8){4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3};
+	vUInt8 rotate = (vUInt8) {4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3};
 	vFloatResult vresult;
 	float result;
 
 	/* compute r* */
-	vrx = (vFloat){q0[0], q1[0], q2[0], q3[0]} - vec_splat_float(p[0]);
-	vry = (vFloat){q0[1], q1[1], q2[1], q3[1]} - vec_splat_float(p[1]);
-	vrz = (vFloat){q0[2], q1[2], q2[2], q3[2]} - vec_splat_float(p[2]);
+	vrx = (vFloat) {q0[0], q1[0], q2[0], q3[0]} -vec_splat_float(p[0]);
+	vry = (vFloat) {q0[1], q1[1], q2[1], q3[1]} -vec_splat_float(p[1]);
+	vrz = (vFloat) {q0[2], q1[2], q2[2], q3[2]} -vec_splat_float(p[2]);
 
 	/* normalize r* */
-	rlen = vec_rsqrte(vrx*vrx + vry*vry + vrz*vrz + vec_splat_float(1e-16f));
-	vrx = vrx*rlen;
-	vry = vry*rlen;
-	vrz = vrz*rlen;
+	rlen = vec_rsqrte(vrx * vrx + vry * vry + vrz * vrz + vec_splat_float(1e-16f));
+	vrx = vrx * rlen;
+	vry = vry * rlen;
+	vrz = vrz * rlen;
 
 	/* rotate r* for cross and dot */
-	vsrx= vec_perm(vrx, vrx, rotate);
-	vsry= vec_perm(vry, vry, rotate);
-	vsrz= vec_perm(vrz, vrz, rotate);
+	vsrx = vec_perm(vrx, vrx, rotate);
+	vsry = vec_perm(vry, vry, rotate);
+	vsrz = vec_perm(vrz, vrz, rotate);
 
 	/* cross product */
-	gx = vsry*vrz - vsrz*vry;
-	gy = vsrz*vrx - vsrx*vrz;
-	gz = vsrx*vry - vsry*vrx;
+	gx = vsry * vrz - vsrz * vry;
+	gy = vsrz * vrx - vsrx * vrz;
+	gz = vsrx * vry - vsry * vrx;
 
 	/* normalize */
-	rlen = vec_rsqrte(gx*gx + gy*gy + gz*gz + vec_splat_float(1e-16f));
-	gx = gx*rlen;
-	gy = gy*rlen;
-	gz = gz*rlen;
+	rlen = vec_rsqrte(gx * gx + gy * gy + gz * gz + vec_splat_float(1e-16f));
+	gx = gx * rlen;
+	gy = gy * rlen;
+	gz = gz * rlen;
 
 	/* angle */
-	vcos = vrx*vsrx + vry*vsry + vrz*vsrz;
-	vcos= vec_max(vec_min(vcos, vec_splat_float(1.0f)), vec_splat_float(-1.0f));
-	vangle= vacosf(vcos);
+	vcos = vrx * vsrx + vry * vsry + vrz * vsrz;
+	vcos = vec_max(vec_min(vcos, vec_splat_float(1.0f)), vec_splat_float(-1.0f));
+	vangle = vacosf(vcos);
 
 	/* dot */
-	vresult.v = (vec_splat_float(n[0])*gx +
-	             vec_splat_float(n[1])*gy +
-	             vec_splat_float(n[2])*gz)*vangle;
+	vresult.v = (vec_splat_float(n[0]) * gx +
+	             vec_splat_float(n[1]) * gy +
+	             vec_splat_float(n[2]) * gz) * vangle;
 
-	result= (vresult.f[0] + vresult.f[1] + vresult.f[2] + vresult.f[3])*(0.5f/(float)M_PI);
-	result= MAX2(result, 0.0f);
+	result = (vresult.f[0] + vresult.f[1] + vresult.f[2] + vresult.f[3]) * (0.5f / (float)M_PI);
+	result = MAX2(result, 0.0f);
 
 	return result;
 }
@@ -2947,7 +2973,7 @@ static float ff_quad_form_factor(float *p, float *n, float *q0, float *q1, float
 static __m128 sse_approx_acos(__m128 x)
 {
 	/* needs a better approximation than taylor expansion of acos, since that
-	 * gives big erros for near 1.0 values, sqrt(2*x)*acos(1-x) should work
+	 * gives big erros for near 1.0 values, sqrt(2 * x) * acos(1 - x) should work
 	 * better, see http://www.tom.womack.net/projects/sse-fast-arctrig.html */
 
 	return _mm_set_ps1(1.0f);
@@ -2970,36 +2996,36 @@ static float ff_quad_form_factor(float *p, float *n, float *q0, float *q1, float
 	rz = qz - _mm_set_ps1(p[2]);
 
 	/* normalize r */
-	rlen = _mm_rsqrt_ps(rx*rx + ry*ry + rz*rz + _mm_set_ps1(1e-16f));
-	rx = rx*rlen;
-	ry = ry*rlen;
-	rz = rz*rlen;
+	rlen = _mm_rsqrt_ps(rx * rx + ry * ry + rz * rz + _mm_set_ps1(1e-16f));
+	rx = rx * rlen;
+	ry = ry * rlen;
+	rz = rz * rlen;
 
 	/* cross product */
-	srx = _mm_shuffle_ps(rx, rx, _MM_SHUFFLE(0,3,2,1));
-	sry = _mm_shuffle_ps(ry, ry, _MM_SHUFFLE(0,3,2,1));
-	srz = _mm_shuffle_ps(rz, rz, _MM_SHUFFLE(0,3,2,1));
+	srx = _mm_shuffle_ps(rx, rx, _MM_SHUFFLE(0, 3, 2, 1));
+	sry = _mm_shuffle_ps(ry, ry, _MM_SHUFFLE(0, 3, 2, 1));
+	srz = _mm_shuffle_ps(rz, rz, _MM_SHUFFLE(0, 3, 2, 1));
 
-	gx = sry*rz - srz*ry;
-	gy = srz*rx - srx*rz;
-	gz = srx*ry - sry*rx;
+	gx = sry * rz - srz * ry;
+	gy = srz * rx - srx * rz;
+	gz = srx * ry - sry * rx;
 
 	/* normalize g */
-	glen = _mm_rsqrt_ps(gx*gx + gy*gy + gz*gz + _mm_set_ps1(1e-16f));
-	gx = gx*glen;
-	gy = gy*glen;
-	gz = gz*glen;
+	glen = _mm_rsqrt_ps(gx * gx + gy * gy + gz * gz + _mm_set_ps1(1e-16f));
+	gx = gx * glen;
+	gy = gy * glen;
+	gz = gz * glen;
 
 	/* compute angle */
-	rcos = rx*srx + ry*sry + rz*srz;
-	rcos= _mm_max_ps(_mm_min_ps(rcos, _mm_set_ps1(1.0f)), _mm_set_ps1(-1.0f));
+	rcos = rx * srx + ry * sry + rz * srz;
+	rcos = _mm_max_ps(_mm_min_ps(rcos, _mm_set_ps1(1.0f)), _mm_set_ps1(-1.0f));
 
 	angle = sse_approx_cos(rcos);
-	aresult = (_mm_set_ps1(n[0])*gx + _mm_set_ps1(n[1])*gy + _mm_set_ps1(n[2])*gz)*angle;
+	aresult = (_mm_set_ps1(n[0]) * gx + _mm_set_ps1(n[1]) * gy + _mm_set_ps1(n[2]) * gz) * angle;
 
 	/* sum together */
-	result= (fresult[0] + fresult[1] + fresult[2] + fresult[3])*(0.5f/(float)M_PI);
-	result= MAX2(result, 0.0f);
+	result = (fresult[0] + fresult[1] + fresult[2] + fresult[3]) * (0.5f / (float)M_PI);
+	result = MAX2(result, 0.0f);
 
 	return result;
 }
@@ -3009,19 +3035,20 @@ static float ff_quad_form_factor(float *p, float *n, float *q0, float *q1, float
 static void ff_normalize(float n[3])
 {
 	float d;
-	
-	d= dot_v3v3(n, n);
 
-	if(d > 1.0e-35F) {
-		d= 1.0f/sqrtf(d);
+	d = dot_v3v3(n, n);
 
-		n[0] *= d; 
-		n[1] *= d; 
+	if (d > 1.0e-35F) {
+		d = 1.0f / sqrtf(d);
+
+		n[0] *= d;
+		n[1] *= d;
 		n[2] *= d;
-	} 
+	}
 }
 
-static float ff_quad_form_factor(const float p[3], const float n[3], const float q0[3], const float q1[3], const float q2[3], const float q3[3])
+static float ff_quad_form_factor(const float p[3], const float n[3],
+                                 const float q0[3], const float q1[3], const float q2[3], const float q3[3])
 {
 	float r0[3], r1[3], r2[3], r3[3], g0[3], g1[3], g2[3], g3[3];
 	float a1, a2, a3, a4, dot1, dot2, dot3, dot4, result;
@@ -3036,23 +3063,27 @@ static float ff_quad_form_factor(const float p[3], const float n[3], const float
 	ff_normalize(r2);
 	ff_normalize(r3);
 
-	cross_v3_v3v3(g0, r1, r0); ff_normalize(g0);
-	cross_v3_v3v3(g1, r2, r1); ff_normalize(g1);
-	cross_v3_v3v3(g2, r3, r2); ff_normalize(g2);
-	cross_v3_v3v3(g3, r0, r3); ff_normalize(g3);
+	cross_v3_v3v3(g0, r1, r0);
+	ff_normalize(g0);
+	cross_v3_v3v3(g1, r2, r1);
+	ff_normalize(g1);
+	cross_v3_v3v3(g2, r3, r2);
+	ff_normalize(g2);
+	cross_v3_v3v3(g3, r0, r3);
+	ff_normalize(g3);
 
-	a1= saacosf(dot_v3v3(r0, r1));
-	a2= saacosf(dot_v3v3(r1, r2));
-	a3= saacosf(dot_v3v3(r2, r3));
-	a4= saacosf(dot_v3v3(r3, r0));
+	a1 = saacosf(dot_v3v3(r0, r1));
+	a2 = saacosf(dot_v3v3(r1, r2));
+	a3 = saacosf(dot_v3v3(r2, r3));
+	a4 = saacosf(dot_v3v3(r3, r0));
 
-	dot1= dot_v3v3(n, g0);
-	dot2= dot_v3v3(n, g1);
-	dot3= dot_v3v3(n, g2);
-	dot4= dot_v3v3(n, g3);
+	dot1 = dot_v3v3(n, g0);
+	dot2 = dot_v3v3(n, g1);
+	dot3 = dot_v3v3(n, g2);
+	dot4 = dot_v3v3(n, g3);
 
-	result= (a1*dot1 + a2*dot2 + a3*dot3 + a4*dot4)*0.5f/(float)M_PI;
-	result= MAX2(result, 0.0f);
+	result = (a1 * dot1 + a2 * dot2 + a3 * dot3 + a4 * dot4) * 0.5f / (float)M_PI;
+	result = MAX2(result, 0.0f);
 
 	return result;
 }
@@ -3060,37 +3091,52 @@ static float ff_quad_form_factor(const float p[3], const float n[3], const float
 float form_factor_hemi_poly(float p[3], float n[3], float v1[3], float v2[3], float v3[3], float v4[3])
 {
 	/* computes how much hemisphere defined by point and normal is
-	   covered by a quad or triangle, cosine weighted */
-	float q0[3], q1[3], q2[3], q3[3], contrib= 0.0f;
+	 * covered by a quad or triangle, cosine weighted */
+	float q0[3], q1[3], q2[3], q3[3], contrib = 0.0f;
 
-	if(ff_visible_quad(p, n, v1, v2, v3, q0, q1, q2, q3))
+	if (ff_visible_quad(p, n, v1, v2, v3, q0, q1, q2, q3))
 		contrib += ff_quad_form_factor(p, n, q0, q1, q2, q3);
-	
-	if(v4 && ff_visible_quad(p, n, v1, v3, v4, q0, q1, q2, q3))
+
+	if (v4 && ff_visible_quad(p, n, v1, v3, v4, q0, q1, q2, q3))
 		contrib += ff_quad_form_factor(p, n, q0, q1, q2, q3);
 
 	return contrib;
 }
 
 /* evaluate if entire quad is a proper convex quad */
- int is_quad_convex_v3(const float *v1, const float *v2, const float *v3, const float *v4)
- {
+int is_quad_convex_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3])
+{
 	float nor[3], nor1[3], nor2[3], vec[4][2];
 	int axis_a, axis_b;
-	
+
 	/* define projection, do both trias apart, quad is undefined! */
+
 	normal_tri_v3(nor1, v1, v2, v3);
 	normal_tri_v3(nor2, v1, v3, v4);
+
+	/* when the face is folded over as 2 tris we probably don't want to create
+	 * a quad from it, but go ahead with the intersection test since this
+	 * isn't a function for degenerate faces */
+	if (UNLIKELY(dot_v3v3(nor1, nor2) < 0.0f)) {
+		/* flip so adding normals in the opposite direction
+		 * doesnt give a zero length vector */
+		negate_v3(nor2);
+	}
+
 	add_v3_v3v3(nor, nor1, nor2);
 
 	axis_dominant_v3(&axis_a, &axis_b, nor);
 
-	vec[0][0]= v1[axis_a]; vec[0][1]= v1[axis_b];
-	vec[1][0]= v2[axis_a]; vec[1][1]= v2[axis_b];
+	vec[0][0] = v1[axis_a];
+	vec[0][1] = v1[axis_b];
+	vec[1][0] = v2[axis_a];
+	vec[1][1] = v2[axis_b];
+
+	vec[2][0] = v3[axis_a];
+	vec[2][1] = v3[axis_b];
+	vec[3][0] = v4[axis_a];
+	vec[3][1] = v4[axis_b];
 
-	vec[2][0]= v3[axis_a]; vec[2][1]= v3[axis_b];
-	vec[3][0]= v4[axis_a]; vec[3][1]= v4[axis_b];
-	
 	/* linetests, the 2 diagonals have to instersect to be convex */
-	return (isect_line_line_v2(vec[0], vec[2], vec[1], vec[3]) > 0) ? 1 : 0;
+	return (isect_line_line_v2(vec[0], vec[2], vec[1], vec[3]) > 0) ? TRUE : FALSE;
 }
diff --git a/source/blender/blenlib/intern/math_geom_inline.c b/source/blender/blenlib/intern/math_geom_inline.c
index 832ef5d..0d4c797 100644
--- a/source/blender/blenlib/intern/math_geom_inline.c
+++ b/source/blender/blenlib/intern/math_geom_inline.c
@@ -30,26 +30,26 @@
 
 #include "BLI_math.h"
 
-#ifndef BLI_MATH_GEOM_INLINE_H
-#define BLI_MATH_GEOM_INLINE_H
+#ifndef __MATH_GEOM_INLINE_C__
+#define __MATH_GEOM_INLINE_C__
 
 /****************************** Spherical Harmonics **************************/
 
 MINLINE void zero_sh(float r[9])
 {
-	memset(r, 0, sizeof(float)*9);
+	memset(r, 0, sizeof(float) * 9);
 }
 
 MINLINE void copy_sh_sh(float r[9], const float a[9])
 {
-	memcpy(r, a, sizeof(float)*9);
+	memcpy(r, a, sizeof(float) * 9);
 }
 
 MINLINE void mul_sh_fl(float r[9], const float f)
 {
 	int i;
 
-	for(i=0; i<9; i++)
+	for (i = 0; i < 9; i++)
 		r[i] *= f;
 }
 
@@ -57,39 +57,39 @@ MINLINE void add_sh_shsh(float r[9], const float a[9], const float b[9])
 {
 	int i;
 
-	for(i=0; i<9; i++)
-		r[i]= a[i] + b[i];
+	for (i = 0; i < 9; i++)
+		r[i] = a[i] + b[i];
 }
 
 MINLINE float dot_shsh(float a[9], float b[9])
 {
-	float r= 0.0f;
+	float r = 0.0f;
 	int i;
 
-	for(i=0; i<9; i++)
-		r += a[i]*b[i];
-	
+	for (i = 0; i < 9; i++)
+		r += a[i] * b[i];
+
 	return r;
 }
 
 MINLINE float diffuse_shv3(float sh[9], const float v[3])
 {
 	/* See formula (13) in:
-	   "An Efficient Representation for Irradiance Environment Maps" */
+	 * "An Efficient Representation for Irradiance Environment Maps" */
 	static const float c1 = 0.429043f, c2 = 0.511664f, c3 = 0.743125f;
 	static const float c4 = 0.886227f, c5 = 0.247708f;
 	float x, y, z, sum;
 
-	x= v[0];
-	y= v[1];
-	z= v[2];
+	x = v[0];
+	y = v[1];
+	z = v[2];
 
-	sum= c1*sh[8]*(x*x - y*y);
-	sum += c3*sh[6]*z*z;
-	sum += c4*sh[0];
-	sum += -c5*sh[6];
-	sum += 2.0f*c1*(sh[4]*x*y + sh[7]*x*z + sh[5]*y*z);
-	sum += 2.0f*c2*(sh[3]*x + sh[1]*y + sh[2]*z);
+	sum = c1 * sh[8] * (x * x - y * y);
+	sum += c3 * sh[6] * z * z;
+	sum += c4 * sh[0];
+	sum += -c5 * sh[6];
+	sum += 2.0f * c1 * (sh[4] * x * y + sh[7] * x * z + sh[5] * y * z);
+	sum += 2.0f * c2 * (sh[3] * x + sh[1] * y + sh[2] * z);
 
 	return sum;
 }
@@ -97,24 +97,24 @@ MINLINE float diffuse_shv3(float sh[9], const float v[3])
 MINLINE void vec_fac_to_sh(float r[9], const float v[3], const float f)
 {
 	/* See formula (3) in:
-	   "An Efficient Representation for Irradiance Environment Maps" */
+	 * "An Efficient Representation for Irradiance Environment Maps" */
 	float sh[9], x, y, z;
 
-	x= v[0];
-	y= v[1];
-	z= v[2];
+	x = v[0];
+	y = v[1];
+	z = v[2];
+
+	sh[0] = 0.282095f;
 
-	sh[0]= 0.282095f;
+	sh[1] = 0.488603f * y;
+	sh[2] = 0.488603f * z;
+	sh[3] = 0.488603f * x;
 
-	sh[1]= 0.488603f*y;
-	sh[2]= 0.488603f*z;
-	sh[3]= 0.488603f*x;
-	
-	sh[4]= 1.092548f*x*y;
-	sh[5]= 1.092548f*y*z;
-	sh[6]= 0.315392f*(3.0f*z*z - 1.0f);
-	sh[7]= 1.092548f*x*z;
-	sh[8]= 0.546274f*(x*x - y*y);
+	sh[4] = 1.092548f * x * y;
+	sh[5] = 1.092548f * y * z;
+	sh[6] = 0.315392f * (3.0f * z * z - 1.0f);
+	sh[7] = 1.092548f * x * z;
+	sh[8] = 0.546274f * (x * x - y * y);
 
 	mul_sh_fl(sh, f);
 	copy_sh_sh(r, sh);
@@ -128,7 +128,7 @@ MINLINE float eval_shv3(float sh[9], const float v[3])
 	return dot_shsh(tmp, sh);
 }
 
-MINLINE void madd_sh_shfl(float r[9], const float sh[3], const float f)
+MINLINE void madd_sh_shfl(float r[9], const float sh[9], const float f)
 {
 	float tmp[9];
 
@@ -137,5 +137,4 @@ MINLINE void madd_sh_shfl(float r[9], const float sh[3], const float f)
 	add_sh_shsh(r, r, tmp);
 }
 
-#endif /* BLI_MATH_GEOM_INLINE_H */
-
+#endif /* __MATH_GEOM_INLINE_C__ */
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 0c8c989..76b986d 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -35,80 +35,80 @@
 
 void zero_m3(float m[3][3])
 {
-	memset(m, 0, 3*3*sizeof(float));
+	memset(m, 0, 3 * 3 * sizeof(float));
 }
 
 void zero_m4(float m[4][4])
 {
-	memset(m, 0, 4*4*sizeof(float));
+	memset(m, 0, 4 * 4 * sizeof(float));
 }
 
 void unit_m3(float m[][3])
 {
-	m[0][0]= m[1][1]= m[2][2]= 1.0;
-	m[0][1]= m[0][2]= 0.0;
-	m[1][0]= m[1][2]= 0.0;
-	m[2][0]= m[2][1]= 0.0;
+	m[0][0] = m[1][1] = m[2][2] = 1.0;
+	m[0][1] = m[0][2] = 0.0;
+	m[1][0] = m[1][2] = 0.0;
+	m[2][0] = m[2][1] = 0.0;
 }
 
 void unit_m4(float m[][4])
 {
-	m[0][0]= m[1][1]= m[2][2]= m[3][3]= 1.0;
-	m[0][1]= m[0][2]= m[0][3]= 0.0;
-	m[1][0]= m[1][2]= m[1][3]= 0.0;
-	m[2][0]= m[2][1]= m[2][3]= 0.0;
-	m[3][0]= m[3][1]= m[3][2]= 0.0;
+	m[0][0] = m[1][1] = m[2][2] = m[3][3] = 1.0;
+	m[0][1] = m[0][2] = m[0][3] = 0.0;
+	m[1][0] = m[1][2] = m[1][3] = 0.0;
+	m[2][0] = m[2][1] = m[2][3] = 0.0;
+	m[3][0] = m[3][1] = m[3][2] = 0.0;
 }
 
-void copy_m3_m3(float m1[][3], float m2[][3]) 
-{	
+void copy_m3_m3(float m1[][3], float m2[][3])
+{
 	/* destination comes first: */
-	memcpy(&m1[0], &m2[0], 9*sizeof(float));
+	memcpy(&m1[0], &m2[0], 9 * sizeof(float));
 }
 
-void copy_m4_m4(float m1[][4], float m2[][4]) 
+void copy_m4_m4(float m1[][4], float m2[][4])
 {
-	memcpy(m1, m2, 4*4*sizeof(float));
+	memcpy(m1, m2, 4 * 4 * sizeof(float));
 }
 
 void copy_m3_m4(float m1[][3], float m2[][4])
 {
-	m1[0][0]= m2[0][0];
-	m1[0][1]= m2[0][1];
-	m1[0][2]= m2[0][2];
+	m1[0][0] = m2[0][0];
+	m1[0][1] = m2[0][1];
+	m1[0][2] = m2[0][2];
 
-	m1[1][0]= m2[1][0];
-	m1[1][1]= m2[1][1];
-	m1[1][2]= m2[1][2];
+	m1[1][0] = m2[1][0];
+	m1[1][1] = m2[1][1];
+	m1[1][2] = m2[1][2];
 
-	m1[2][0]= m2[2][0];
-	m1[2][1]= m2[2][1];
-	m1[2][2]= m2[2][2];
+	m1[2][0] = m2[2][0];
+	m1[2][1] = m2[2][1];
+	m1[2][2] = m2[2][2];
 }
 
-void copy_m4_m3(float m1[][4], float m2[][3])	/* no clear */
+void copy_m4_m3(float m1[][4], float m2[][3]) /* no clear */
 {
-	m1[0][0]= m2[0][0];
-	m1[0][1]= m2[0][1];
-	m1[0][2]= m2[0][2];
+	m1[0][0] = m2[0][0];
+	m1[0][1] = m2[0][1];
+	m1[0][2] = m2[0][2];
 
-	m1[1][0]= m2[1][0];
-	m1[1][1]= m2[1][1];
-	m1[1][2]= m2[1][2];
+	m1[1][0] = m2[1][0];
+	m1[1][1] = m2[1][1];
+	m1[1][2] = m2[1][2];
 
-	m1[2][0]= m2[2][0];
-	m1[2][1]= m2[2][1];
-	m1[2][2]= m2[2][2];
+	m1[2][0] = m2[2][0];
+	m1[2][1] = m2[2][1];
+	m1[2][2] = m2[2][2];
 
 	/*	Reevan's Bugfix */
-	m1[0][3]=0.0F;
-	m1[1][3]=0.0F;
-	m1[2][3]=0.0F;
+	m1[0][3] = 0.0F;
+	m1[1][3] = 0.0F;
+	m1[2][3] = 0.0F;
 
-	m1[3][0]=0.0F;	
-	m1[3][1]=0.0F;	
-	m1[3][2]=0.0F;	
-	m1[3][3]=1.0F;
+	m1[3][0] = 0.0F;
+	m1[3][1] = 0.0F;
+	m1[3][2] = 0.0F;
+	m1[3][3] = 1.0F;
 
 }
 
@@ -117,9 +117,9 @@ void swap_m3m3(float m1[][3], float m2[][3])
 	float t;
 	int i, j;
 
-	for(i = 0; i < 3; i++) {
+	for (i = 0; i < 3; i++) {
 		for (j = 0; j < 3; j++) {
-			t        = m1[i][j];
+			t = m1[i][j];
 			m1[i][j] = m2[i][j];
 			m2[i][j] = t;
 		}
@@ -131,9 +131,9 @@ void swap_m4m4(float m1[][4], float m2[][4])
 	float t;
 	int i, j;
 
-	for(i = 0; i < 4; i++) {
+	for (i = 0; i < 4; i++) {
 		for (j = 0; j < 4; j++) {
-			t        = m1[i][j];
+			t = m1[i][j];
 			m1[i][j] = m2[i][j];
 			m2[i][j] = t;
 		}
@@ -151,25 +151,25 @@ void mult_m4_m4m4(float m1[][4], float m3_[][4], float m2_[][4])
 	copy_m4_m4(m3, m3_);
 
 	/* matrix product: m1[j][k] = m2[j][i].m3[i][k] */
-	m1[0][0] = m2[0][0]*m3[0][0] + m2[0][1]*m3[1][0] + m2[0][2]*m3[2][0] + m2[0][3]*m3[3][0];
-	m1[0][1] = m2[0][0]*m3[0][1] + m2[0][1]*m3[1][1] + m2[0][2]*m3[2][1] + m2[0][3]*m3[3][1];
-	m1[0][2] = m2[0][0]*m3[0][2] + m2[0][1]*m3[1][2] + m2[0][2]*m3[2][2] + m2[0][3]*m3[3][2];
-	m1[0][3] = m2[0][0]*m3[0][3] + m2[0][1]*m3[1][3] + m2[0][2]*m3[2][3] + m2[0][3]*m3[3][3];
+	m1[0][0] = m2[0][0] * m3[0][0] + m2[0][1] * m3[1][0] + m2[0][2] * m3[2][0] + m2[0][3] * m3[3][0];
+	m1[0][1] = m2[0][0] * m3[0][1] + m2[0][1] * m3[1][1] + m2[0][2] * m3[2][1] + m2[0][3] * m3[3][1];
+	m1[0][2] = m2[0][0] * m3[0][2] + m2[0][1] * m3[1][2] + m2[0][2] * m3[2][2] + m2[0][3] * m3[3][2];
+	m1[0][3] = m2[0][0] * m3[0][3] + m2[0][1] * m3[1][3] + m2[0][2] * m3[2][3] + m2[0][3] * m3[3][3];
 
-	m1[1][0] = m2[1][0]*m3[0][0] + m2[1][1]*m3[1][0] + m2[1][2]*m3[2][0] + m2[1][3]*m3[3][0];
-	m1[1][1] = m2[1][0]*m3[0][1] + m2[1][1]*m3[1][1] + m2[1][2]*m3[2][1] + m2[1][3]*m3[3][1];
-	m1[1][2] = m2[1][0]*m3[0][2] + m2[1][1]*m3[1][2] + m2[1][2]*m3[2][2] + m2[1][3]*m3[3][2];
-	m1[1][3] = m2[1][0]*m3[0][3] + m2[1][1]*m3[1][3] + m2[1][2]*m3[2][3] + m2[1][3]*m3[3][3];
+	m1[1][0] = m2[1][0] * m3[0][0] + m2[1][1] * m3[1][0] + m2[1][2] * m3[2][0] + m2[1][3] * m3[3][0];
+	m1[1][1] = m2[1][0] * m3[0][1] + m2[1][1] * m3[1][1] + m2[1][2] * m3[2][1] + m2[1][3] * m3[3][1];
+	m1[1][2] = m2[1][0] * m3[0][2] + m2[1][1] * m3[1][2] + m2[1][2] * m3[2][2] + m2[1][3] * m3[3][2];
+	m1[1][3] = m2[1][0] * m3[0][3] + m2[1][1] * m3[1][3] + m2[1][2] * m3[2][3] + m2[1][3] * m3[3][3];
 
-	m1[2][0] = m2[2][0]*m3[0][0] + m2[2][1]*m3[1][0] + m2[2][2]*m3[2][0] + m2[2][3]*m3[3][0];
-	m1[2][1] = m2[2][0]*m3[0][1] + m2[2][1]*m3[1][1] + m2[2][2]*m3[2][1] + m2[2][3]*m3[3][1];
-	m1[2][2] = m2[2][0]*m3[0][2] + m2[2][1]*m3[1][2] + m2[2][2]*m3[2][2] + m2[2][3]*m3[3][2];
-	m1[2][3] = m2[2][0]*m3[0][3] + m2[2][1]*m3[1][3] + m2[2][2]*m3[2][3] + m2[2][3]*m3[3][3];
+	m1[2][0] = m2[2][0] * m3[0][0] + m2[2][1] * m3[1][0] + m2[2][2] * m3[2][0] + m2[2][3] * m3[3][0];
+	m1[2][1] = m2[2][0] * m3[0][1] + m2[2][1] * m3[1][1] + m2[2][2] * m3[2][1] + m2[2][3] * m3[3][1];
+	m1[2][2] = m2[2][0] * m3[0][2] + m2[2][1] * m3[1][2] + m2[2][2] * m3[2][2] + m2[2][3] * m3[3][2];
+	m1[2][3] = m2[2][0] * m3[0][3] + m2[2][1] * m3[1][3] + m2[2][2] * m3[2][3] + m2[2][3] * m3[3][3];
 
-	m1[3][0] = m2[3][0]*m3[0][0] + m2[3][1]*m3[1][0] + m2[3][2]*m3[2][0] + m2[3][3]*m3[3][0];
-	m1[3][1] = m2[3][0]*m3[0][1] + m2[3][1]*m3[1][1] + m2[3][2]*m3[2][1] + m2[3][3]*m3[3][1];
-	m1[3][2] = m2[3][0]*m3[0][2] + m2[3][1]*m3[1][2] + m2[3][2]*m3[2][2] + m2[3][3]*m3[3][2];
-	m1[3][3] = m2[3][0]*m3[0][3] + m2[3][1]*m3[1][3] + m2[3][2]*m3[2][3] + m2[3][3]*m3[3][3];
+	m1[3][0] = m2[3][0] * m3[0][0] + m2[3][1] * m3[1][0] + m2[3][2] * m3[2][0] + m2[3][3] * m3[3][0];
+	m1[3][1] = m2[3][0] * m3[0][1] + m2[3][1] * m3[1][1] + m2[3][2] * m3[2][1] + m2[3][3] * m3[3][1];
+	m1[3][2] = m2[3][0] * m3[0][2] + m2[3][1] * m3[1][2] + m2[3][2] * m3[2][2] + m2[3][3] * m3[3][2];
+	m1[3][3] = m2[3][0] * m3[0][3] + m2[3][1] * m3[1][3] + m2[3][2] * m3[2][3] + m2[3][3] * m3[3][3];
 
 }
 
@@ -181,18 +181,18 @@ void mul_m3_m3m3(float m1[][3], float m3_[][3], float m2_[][3])
 	copy_m3_m3(m2, m2_);
 	copy_m3_m3(m3, m3_);
 
-	/* m1[i][j] = m2[i][k]*m3[k][j], args are flipped!  */
-	m1[0][0]= m2[0][0]*m3[0][0] + m2[0][1]*m3[1][0] + m2[0][2]*m3[2][0]; 
-	m1[0][1]= m2[0][0]*m3[0][1] + m2[0][1]*m3[1][1] + m2[0][2]*m3[2][1]; 
-	m1[0][2]= m2[0][0]*m3[0][2] + m2[0][1]*m3[1][2] + m2[0][2]*m3[2][2]; 
+	/* m1[i][j] = m2[i][k] * m3[k][j], args are flipped!  */
+	m1[0][0] = m2[0][0] * m3[0][0] + m2[0][1] * m3[1][0] + m2[0][2] * m3[2][0];
+	m1[0][1] = m2[0][0] * m3[0][1] + m2[0][1] * m3[1][1] + m2[0][2] * m3[2][1];
+	m1[0][2] = m2[0][0] * m3[0][2] + m2[0][1] * m3[1][2] + m2[0][2] * m3[2][2];
 
-	m1[1][0]= m2[1][0]*m3[0][0] + m2[1][1]*m3[1][0] + m2[1][2]*m3[2][0]; 
-	m1[1][1]= m2[1][0]*m3[0][1] + m2[1][1]*m3[1][1] + m2[1][2]*m3[2][1]; 
-	m1[1][2]= m2[1][0]*m3[0][2] + m2[1][1]*m3[1][2] + m2[1][2]*m3[2][2]; 
+	m1[1][0] = m2[1][0] * m3[0][0] + m2[1][1] * m3[1][0] + m2[1][2] * m3[2][0];
+	m1[1][1] = m2[1][0] * m3[0][1] + m2[1][1] * m3[1][1] + m2[1][2] * m3[2][1];
+	m1[1][2] = m2[1][0] * m3[0][2] + m2[1][1] * m3[1][2] + m2[1][2] * m3[2][2];
 
-	m1[2][0]= m2[2][0]*m3[0][0] + m2[2][1]*m3[1][0] + m2[2][2]*m3[2][0]; 
-	m1[2][1]= m2[2][0]*m3[0][1] + m2[2][1]*m3[1][1] + m2[2][2]*m3[2][1]; 
-	m1[2][2]= m2[2][0]*m3[0][2] + m2[2][1]*m3[1][2] + m2[2][2]*m3[2][2]; 
+	m1[2][0] = m2[2][0] * m3[0][0] + m2[2][1] * m3[1][0] + m2[2][2] * m3[2][0];
+	m1[2][1] = m2[2][0] * m3[0][1] + m2[2][1] * m3[1][1] + m2[2][2] * m3[2][1];
+	m1[2][2] = m2[2][0] * m3[0][2] + m2[2][1] * m3[1][2] + m2[2][2] * m3[2][2];
 }
 
 void mul_m4_m4m3(float (*m1)[4], float (*m3_)[4], float (*m2_)[3])
@@ -203,68 +203,68 @@ void mul_m4_m4m3(float (*m1)[4], float (*m3_)[4], float (*m2_)[3])
 	copy_m3_m3(m2, m2_);
 	copy_m4_m4(m3, m3_);
 
-	m1[0][0]= m2[0][0]*m3[0][0] + m2[0][1]*m3[1][0] + m2[0][2]*m3[2][0];
-	m1[0][1]= m2[0][0]*m3[0][1] + m2[0][1]*m3[1][1] + m2[0][2]*m3[2][1];
-	m1[0][2]= m2[0][0]*m3[0][2] + m2[0][1]*m3[1][2] + m2[0][2]*m3[2][2];
-	m1[1][0]= m2[1][0]*m3[0][0] + m2[1][1]*m3[1][0] + m2[1][2]*m3[2][0];
-	m1[1][1]= m2[1][0]*m3[0][1] + m2[1][1]*m3[1][1] + m2[1][2]*m3[2][1];
-	m1[1][2]= m2[1][0]*m3[0][2] + m2[1][1]*m3[1][2] + m2[1][2]*m3[2][2];
-	m1[2][0]= m2[2][0]*m3[0][0] + m2[2][1]*m3[1][0] + m2[2][2]*m3[2][0];
-	m1[2][1]= m2[2][0]*m3[0][1] + m2[2][1]*m3[1][1] + m2[2][2]*m3[2][1];
-	m1[2][2]= m2[2][0]*m3[0][2] + m2[2][1]*m3[1][2] + m2[2][2]*m3[2][2];
+	m1[0][0] = m2[0][0] * m3[0][0] + m2[0][1] * m3[1][0] + m2[0][2] * m3[2][0];
+	m1[0][1] = m2[0][0] * m3[0][1] + m2[0][1] * m3[1][1] + m2[0][2] * m3[2][1];
+	m1[0][2] = m2[0][0] * m3[0][2] + m2[0][1] * m3[1][2] + m2[0][2] * m3[2][2];
+	m1[1][0] = m2[1][0] * m3[0][0] + m2[1][1] * m3[1][0] + m2[1][2] * m3[2][0];
+	m1[1][1] = m2[1][0] * m3[0][1] + m2[1][1] * m3[1][1] + m2[1][2] * m3[2][1];
+	m1[1][2] = m2[1][0] * m3[0][2] + m2[1][1] * m3[1][2] + m2[1][2] * m3[2][2];
+	m1[2][0] = m2[2][0] * m3[0][0] + m2[2][1] * m3[1][0] + m2[2][2] * m3[2][0];
+	m1[2][1] = m2[2][0] * m3[0][1] + m2[2][1] * m3[1][1] + m2[2][2] * m3[2][1];
+	m1[2][2] = m2[2][0] * m3[0][2] + m2[2][1] * m3[1][2] + m2[2][2] * m3[2][2];
 }
 
-/* m1 = m2 * m3, ignore the elements on the 4th row/column of m3*/
+/* m1 = m2 * m3, ignore the elements on the 4th row/column of m3 */
 void mult_m3_m3m4(float m1[][3], float m3[][4], float m2[][3])
 {
 	/* m1[i][j] = m2[i][k] * m3[k][j] */
-	m1[0][0] = m2[0][0] * m3[0][0] + m2[0][1] * m3[1][0] +m2[0][2] * m3[2][0];
-	m1[0][1] = m2[0][0] * m3[0][1] + m2[0][1] * m3[1][1] +m2[0][2] * m3[2][1];
-	m1[0][2] = m2[0][0] * m3[0][2] + m2[0][1] * m3[1][2] +m2[0][2] * m3[2][2];
+	m1[0][0] = m2[0][0] * m3[0][0] + m2[0][1] * m3[1][0] + m2[0][2] * m3[2][0];
+	m1[0][1] = m2[0][0] * m3[0][1] + m2[0][1] * m3[1][1] + m2[0][2] * m3[2][1];
+	m1[0][2] = m2[0][0] * m3[0][2] + m2[0][1] * m3[1][2] + m2[0][2] * m3[2][2];
 
-	m1[1][0] = m2[1][0] * m3[0][0] + m2[1][1] * m3[1][0] +m2[1][2] * m3[2][0];
-	m1[1][1] = m2[1][0] * m3[0][1] + m2[1][1] * m3[1][1] +m2[1][2] * m3[2][1];
-	m1[1][2] = m2[1][0] * m3[0][2] + m2[1][1] * m3[1][2] +m2[1][2] * m3[2][2];
+	m1[1][0] = m2[1][0] * m3[0][0] + m2[1][1] * m3[1][0] + m2[1][2] * m3[2][0];
+	m1[1][1] = m2[1][0] * m3[0][1] + m2[1][1] * m3[1][1] + m2[1][2] * m3[2][1];
+	m1[1][2] = m2[1][0] * m3[0][2] + m2[1][1] * m3[1][2] + m2[1][2] * m3[2][2];
 
-	m1[2][0] = m2[2][0] * m3[0][0] + m2[2][1] * m3[1][0] +m2[2][2] * m3[2][0];
-	m1[2][1] = m2[2][0] * m3[0][1] + m2[2][1] * m3[1][1] +m2[2][2] * m3[2][1];
-	m1[2][2] = m2[2][0] * m3[0][2] + m2[2][1] * m3[1][2] +m2[2][2] * m3[2][2];
+	m1[2][0] = m2[2][0] * m3[0][0] + m2[2][1] * m3[1][0] + m2[2][2] * m3[2][0];
+	m1[2][1] = m2[2][0] * m3[0][1] + m2[2][1] * m3[1][1] + m2[2][2] * m3[2][1];
+	m1[2][2] = m2[2][0] * m3[0][2] + m2[2][1] * m3[1][2] + m2[2][2] * m3[2][2];
 }
 
 void mul_m4_m3m4(float (*m1)[4], float (*m3)[3], float (*m2)[4])
 {
-	m1[0][0]= m2[0][0]*m3[0][0] + m2[0][1]*m3[1][0] + m2[0][2]*m3[2][0];
-	m1[0][1]= m2[0][0]*m3[0][1] + m2[0][1]*m3[1][1] + m2[0][2]*m3[2][1];
-	m1[0][2]= m2[0][0]*m3[0][2] + m2[0][1]*m3[1][2] + m2[0][2]*m3[2][2];
-	m1[1][0]= m2[1][0]*m3[0][0] + m2[1][1]*m3[1][0] + m2[1][2]*m3[2][0];
-	m1[1][1]= m2[1][0]*m3[0][1] + m2[1][1]*m3[1][1] + m2[1][2]*m3[2][1];
-	m1[1][2]= m2[1][0]*m3[0][2] + m2[1][1]*m3[1][2] + m2[1][2]*m3[2][2];
-	m1[2][0]= m2[2][0]*m3[0][0] + m2[2][1]*m3[1][0] + m2[2][2]*m3[2][0];
-	m1[2][1]= m2[2][0]*m3[0][1] + m2[2][1]*m3[1][1] + m2[2][2]*m3[2][1];
-	m1[2][2]= m2[2][0]*m3[0][2] + m2[2][1]*m3[1][2] + m2[2][2]*m3[2][2];
+	m1[0][0] = m2[0][0] * m3[0][0] + m2[0][1] * m3[1][0] + m2[0][2] * m3[2][0];
+	m1[0][1] = m2[0][0] * m3[0][1] + m2[0][1] * m3[1][1] + m2[0][2] * m3[2][1];
+	m1[0][2] = m2[0][0] * m3[0][2] + m2[0][1] * m3[1][2] + m2[0][2] * m3[2][2];
+	m1[1][0] = m2[1][0] * m3[0][0] + m2[1][1] * m3[1][0] + m2[1][2] * m3[2][0];
+	m1[1][1] = m2[1][0] * m3[0][1] + m2[1][1] * m3[1][1] + m2[1][2] * m3[2][1];
+	m1[1][2] = m2[1][0] * m3[0][2] + m2[1][1] * m3[1][2] + m2[1][2] * m3[2][2];
+	m1[2][0] = m2[2][0] * m3[0][0] + m2[2][1] * m3[1][0] + m2[2][2] * m3[2][0];
+	m1[2][1] = m2[2][0] * m3[0][1] + m2[2][1] * m3[1][1] + m2[2][2] * m3[2][1];
+	m1[2][2] = m2[2][0] * m3[0][2] + m2[2][1] * m3[1][2] + m2[2][2] * m3[2][2];
 }
 
 void mul_serie_m3(float answ[][3],
-				   float m1[][3], float m2[][3], float m3[][3],
-				   float m4[][3], float m5[][3], float m6[][3],
-				   float m7[][3], float m8[][3])
+                  float m1[][3], float m2[][3], float m3[][3],
+                  float m4[][3], float m5[][3], float m6[][3],
+                  float m7[][3], float m8[][3])
 {
 	float temp[3][3];
-	
-	if(m1==NULL || m2==NULL) return;
-	
+
+	if (m1 == NULL || m2 == NULL) return;
+
 	mul_m3_m3m3(answ, m2, m1);
-	if(m3) {
+	if (m3) {
 		mul_m3_m3m3(temp, m3, answ);
-		if(m4) {
+		if (m4) {
 			mul_m3_m3m3(answ, m4, temp);
-			if(m5) {
+			if (m5) {
 				mul_m3_m3m3(temp, m5, answ);
-				if(m6) {
+				if (m6) {
 					mul_m3_m3m3(answ, m6, temp);
-					if(m7) {
+					if (m7) {
 						mul_m3_m3m3(temp, m7, answ);
-						if(m8) {
+						if (m8) {
 							mul_m3_m3m3(answ, m8, temp);
 						}
 						else copy_m3_m3(answ, temp);
@@ -278,26 +278,26 @@ void mul_serie_m3(float answ[][3],
 }
 
 void mul_serie_m4(float answ[][4], float m1[][4],
-				float m2[][4], float m3[][4], float m4[][4],
-				float m5[][4], float m6[][4], float m7[][4],
-				float m8[][4])
+                  float m2[][4], float m3[][4], float m4[][4],
+                  float m5[][4], float m6[][4], float m7[][4],
+                  float m8[][4])
 {
 	float temp[4][4];
-	
-	if(m1==NULL || m2==NULL) return;
-	
+
+	if (m1 == NULL || m2 == NULL) return;
+
 	mult_m4_m4m4(answ, m1, m2);
-	if(m3) {
+	if (m3) {
 		mult_m4_m4m4(temp, answ, m3);
-		if(m4) {
+		if (m4) {
 			mult_m4_m4m4(answ, temp, m4);
-			if(m5) {
+			if (m5) {
 				mult_m4_m4m4(temp, answ, m5);
-				if(m6) {
+				if (m6) {
 					mult_m4_m4m4(answ, temp, m6);
-					if(m7) {
+					if (m7) {
 						mult_m4_m4m4(temp, answ, m7);
-						if(m8) {
+						if (m8) {
 							mult_m4_m4m4(answ, temp, m8);
 						}
 						else copy_m4_m4(answ, temp);
@@ -312,41 +312,41 @@ void mul_serie_m4(float answ[][4], float m1[][4],
 
 void mul_m4_v3(float mat[][4], float vec[3])
 {
-	float x,y;
+	float x, y;
 
-	x=vec[0]; 
-	y=vec[1];
-	vec[0]=x*mat[0][0] + y*mat[1][0] + mat[2][0]*vec[2] + mat[3][0];
-	vec[1]=x*mat[0][1] + y*mat[1][1] + mat[2][1]*vec[2] + mat[3][1];
-	vec[2]=x*mat[0][2] + y*mat[1][2] + mat[2][2]*vec[2] + mat[3][2];
+	x = vec[0];
+	y = vec[1];
+	vec[0] = x * mat[0][0] + y * mat[1][0] + mat[2][0] * vec[2] + mat[3][0];
+	vec[1] = x * mat[0][1] + y * mat[1][1] + mat[2][1] * vec[2] + mat[3][1];
+	vec[2] = x * mat[0][2] + y * mat[1][2] + mat[2][2] * vec[2] + mat[3][2];
 }
 
 void mul_v3_m4v3(float in[3], float mat[][4], const float vec[3])
 {
-	float x,y;
+	float x, y;
 
-	x=vec[0]; 
-	y=vec[1];
-	in[0]= x*mat[0][0] + y*mat[1][0] + mat[2][0]*vec[2] + mat[3][0];
-	in[1]= x*mat[0][1] + y*mat[1][1] + mat[2][1]*vec[2] + mat[3][1];
-	in[2]= x*mat[0][2] + y*mat[1][2] + mat[2][2]*vec[2] + mat[3][2];
+	x = vec[0];
+	y = vec[1];
+	in[0] = x * mat[0][0] + y * mat[1][0] + mat[2][0] * vec[2] + mat[3][0];
+	in[1] = x * mat[0][1] + y * mat[1][1] + mat[2][1] * vec[2] + mat[3][1];
+	in[2] = x * mat[0][2] + y * mat[1][2] + mat[2][2] * vec[2] + mat[3][2];
 }
 
 /* same as mul_m4_v3() but doesnt apply translation component */
 void mul_mat3_m4_v3(float mat[][4], float vec[3])
 {
-	float x,y;
+	float x, y;
 
-	x= vec[0]; 
-	y= vec[1];
-	vec[0]= x*mat[0][0] + y*mat[1][0] + mat[2][0]*vec[2];
-	vec[1]= x*mat[0][1] + y*mat[1][1] + mat[2][1]*vec[2];
-	vec[2]= x*mat[0][2] + y*mat[1][2] + mat[2][2]*vec[2];
+	x = vec[0];
+	y = vec[1];
+	vec[0] = x * mat[0][0] + y * mat[1][0] + mat[2][0] * vec[2];
+	vec[1] = x * mat[0][1] + y * mat[1][1] + mat[2][1] * vec[2];
+	vec[2] = x * mat[0][2] + y * mat[1][2] + mat[2][2] * vec[2];
 }
 
 void mul_project_m4_v3(float mat[][4], float vec[3])
 {
-	const float w= vec[0]*mat[0][3] + vec[1]*mat[1][3] + vec[2]*mat[2][3] + mat[3][3];
+	const float w = vec[0] * mat[0][3] + vec[1] * mat[1][3] + vec[2] * mat[2][3] + mat[3][3];
 	mul_m4_v3(mat, vec);
 
 	vec[0] /= w;
@@ -358,14 +358,14 @@ void mul_v4_m4v4(float r[4], float mat[4][4], float v[4])
 {
 	float x, y, z;
 
-	x= v[0]; 
-	y= v[1]; 
-	z= v[2];
+	x = v[0];
+	y = v[1];
+	z = v[2];
 
-	r[0]= x*mat[0][0] + y*mat[1][0] + z*mat[2][0] + mat[3][0]*v[3];
-	r[1]= x*mat[0][1] + y*mat[1][1] + z*mat[2][1] + mat[3][1]*v[3];
-	r[2]= x*mat[0][2] + y*mat[1][2] + z*mat[2][2] + mat[3][2]*v[3];
-	r[3]= x*mat[0][3] + y*mat[1][3] + z*mat[2][3] + mat[3][3]*v[3];
+	r[0] = x * mat[0][0] + y * mat[1][0] + z * mat[2][0] + mat[3][0] * v[3];
+	r[1] = x * mat[0][1] + y * mat[1][1] + z * mat[2][1] + mat[3][1] * v[3];
+	r[2] = x * mat[0][2] + y * mat[1][2] + z * mat[2][2] + mat[3][2] * v[3];
+	r[3] = x * mat[0][3] + y * mat[1][3] + z * mat[2][3] + mat[3][3] * v[3];
 }
 
 void mul_m4_v4(float mat[4][4], float r[4])
@@ -373,11 +373,30 @@ void mul_m4_v4(float mat[4][4], float r[4])
 	mul_v4_m4v4(r, mat, r);
 }
 
+void mul_v4d_m4v4d(double r[4], float mat[4][4], double v[4])
+{
+	double x, y, z;
+
+	x = v[0];
+	y = v[1];
+	z = v[2];
+
+	r[0] = x * (double)mat[0][0] + y * (double)mat[1][0] + z * (double)mat[2][0] + (double)mat[3][0] * v[3];
+	r[1] = x * (double)mat[0][1] + y * (double)mat[1][1] + z * (double)mat[2][1] + (double)mat[3][1] * v[3];
+	r[2] = x * (double)mat[0][2] + y * (double)mat[1][2] + z * (double)mat[2][2] + (double)mat[3][2] * v[3];
+	r[3] = x * (double)mat[0][3] + y * (double)mat[1][3] + z * (double)mat[2][3] + (double)mat[3][3] * v[3];
+}
+
+void mul_m4_v4d(float mat[4][4], double r[4])
+{
+	mul_v4d_m4v4d(r, mat, r);
+}
+
 void mul_v3_m3v3(float r[3], float M[3][3], float a[3])
 {
-	r[0]= M[0][0]*a[0] + M[1][0]*a[1] + M[2][0]*a[2];
-	r[1]= M[0][1]*a[0] + M[1][1]*a[1] + M[2][1]*a[2];
-	r[2]= M[0][2]*a[0] + M[1][2]*a[1] + M[2][2]*a[2];
+	r[0] = M[0][0] * a[0] + M[1][0] * a[1] + M[2][0] * a[2];
+	r[1] = M[0][1] * a[0] + M[1][1] * a[1] + M[2][1] * a[2];
+	r[2] = M[0][2] * a[0] + M[1][2] * a[1] + M[2][2] * a[2];
 }
 
 void mul_m3_v3(float M[3][3], float r[3])
@@ -390,21 +409,21 @@ void mul_m3_v3(float M[3][3], float r[3])
 
 void mul_transposed_m3_v3(float mat[][3], float vec[3])
 {
-	float x,y;
+	float x, y;
 
-	x=vec[0]; 
-	y=vec[1];
-	vec[0]= x*mat[0][0] + y*mat[0][1] + mat[0][2]*vec[2];
-	vec[1]= x*mat[1][0] + y*mat[1][1] + mat[1][2]*vec[2];
-	vec[2]= x*mat[2][0] + y*mat[2][1] + mat[2][2]*vec[2];
+	x = vec[0];
+	y = vec[1];
+	vec[0] = x * mat[0][0] + y * mat[0][1] + mat[0][2] * vec[2];
+	vec[1] = x * mat[1][0] + y * mat[1][1] + mat[1][2] * vec[2];
+	vec[2] = x * mat[2][0] + y * mat[2][1] + mat[2][2] * vec[2];
 }
 
 void mul_m3_fl(float m[3][3], float f)
 {
 	int i, j;
 
-	for(i=0;i<3;i++)
-		for(j=0;j<3;j++)
+	for (i = 0; i < 3; i++)
+		for (j = 0; j < 3; j++)
 			m[i][j] *= f;
 }
 
@@ -412,8 +431,8 @@ void mul_m4_fl(float m[4][4], float f)
 {
 	int i, j;
 
-	for(i=0;i<4;i++)
-		for(j=0;j<4;j++)
+	for (i = 0; i < 4; i++)
+		for (j = 0; j < 4; j++)
 			m[i][j] *= f;
 }
 
@@ -421,56 +440,56 @@ void mul_mat3_m4_fl(float m[4][4], float f)
 {
 	int i, j;
 
-	for(i=0; i<3; i++)
-		for(j=0; j<3; j++)
+	for (i = 0; i < 3; i++)
+		for (j = 0; j < 3; j++)
 			m[i][j] *= f;
 }
 
 void mul_m3_v3_double(float mat[][3], double vec[3])
 {
-	double x,y;
+	double x, y;
 
-	x=vec[0]; 
-	y=vec[1];
-	vec[0]= x*(double)mat[0][0] + y*(double)mat[1][0] + (double)mat[2][0]*vec[2];
-	vec[1]= x*(double)mat[0][1] + y*(double)mat[1][1] + (double)mat[2][1]*vec[2];
-	vec[2]= x*(double)mat[0][2] + y*(double)mat[1][2] + (double)mat[2][2]*vec[2];
+	x = vec[0];
+	y = vec[1];
+	vec[0] = x * (double)mat[0][0] + y * (double)mat[1][0] + (double)mat[2][0] * vec[2];
+	vec[1] = x * (double)mat[0][1] + y * (double)mat[1][1] + (double)mat[2][1] * vec[2];
+	vec[2] = x * (double)mat[0][2] + y * (double)mat[1][2] + (double)mat[2][2] * vec[2];
 }
 
 void add_m3_m3m3(float m1[][3], float m2[][3], float m3[][3])
 {
 	int i, j;
 
-	for(i=0;i<3;i++)
-		for(j=0;j<3;j++)
-			m1[i][j]= m2[i][j] + m3[i][j];
+	for (i = 0; i < 3; i++)
+		for (j = 0; j < 3; j++)
+			m1[i][j] = m2[i][j] + m3[i][j];
 }
 
 void add_m4_m4m4(float m1[][4], float m2[][4], float m3[][4])
 {
 	int i, j;
 
-	for(i=0;i<4;i++)
-		for(j=0;j<4;j++)
-			m1[i][j]= m2[i][j] + m3[i][j];
+	for (i = 0; i < 4; i++)
+		for (j = 0; j < 4; j++)
+			m1[i][j] = m2[i][j] + m3[i][j];
 }
 
 void sub_m3_m3m3(float m1[][3], float m2[][3], float m3[][3])
 {
 	int i, j;
 
-	for(i=0;i<3;i++)
-		for(j=0;j<3;j++)
-			m1[i][j]= m2[i][j] - m3[i][j];
+	for (i = 0; i < 3; i++)
+		for (j = 0; j < 3; j++)
+			m1[i][j] = m2[i][j] - m3[i][j];
 }
 
 void sub_m4_m4m4(float m1[][4], float m2[][4], float m3[][4])
 {
 	int i, j;
 
-	for(i=0;i<4;i++)
-		for(j=0;j<4;j++)
-			m1[i][j]= m2[i][j] - m3[i][j];
+	for (i = 0; i < 4; i++)
+		for (j = 0; j < 4; j++)
+			m1[i][j] = m2[i][j] - m3[i][j];
 }
 
 int invert_m3(float m[3][3])
@@ -478,7 +497,7 @@ int invert_m3(float m[3][3])
 	float tmp[3][3];
 	int success;
 
-	success= invert_m3_m3(tmp, m);
+	success = invert_m3_m3(tmp, m);
 	copy_m3_m3(m, tmp);
 
 	return success;
@@ -490,20 +509,20 @@ int invert_m3_m3(float m1[3][3], float m2[3][3])
 	int a, b, success;
 
 	/* calc adjoint */
-	adjoint_m3_m3(m1,m2);
+	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 = (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]));
 
-	success= (det != 0);
+	success = (det != 0);
 
-	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 (det == 0) det = 1;
+	det = 1 / det;
+	for (a = 0; a < 3; a++) {
+		for (b = 0; b < 3; b++) {
+			m1[a][b] *= det;
 		}
 	}
 
@@ -515,17 +534,17 @@ int invert_m4(float m[4][4])
 	float tmp[4][4];
 	int success;
 
-	success= invert_m4_m4(tmp, m);
+	success = invert_m4_m4(tmp, m);
 	copy_m4_m4(m, tmp);
 
 	return success;
 }
 
 /*
- * invertmat - 
- * 		computes the inverse of mat and puts it in inverse.  Returns 
- *	TRUE on success (i.e. can always find a pivot) and FALSE on failure.
- * 	Uses Gaussian Elimination with partial (maximal column) pivoting.
+ * invertmat -
+ *      computes the inverse of mat and puts it in inverse.  Returns
+ *  TRUE on success (i.e. can always find a pivot) and FALSE on failure.
+ *  Uses Gaussian Elimination with partial (maximal column) pivoting.
  *
  *					Mark Segal - 1992
  */
@@ -539,30 +558,30 @@ int invert_m4_m4(float inverse[4][4], float mat[4][4])
 	int maxj;
 
 	/* Set inverse to identity */
-	for (i=0; i<4; i++)
-		for (j=0; j<4; j++)
+	for (i = 0; i < 4; i++)
+		for (j = 0; j < 4; j++)
 			inverse[i][j] = 0;
-	for (i=0; i<4; i++)
+	for (i = 0; i < 4; i++)
 		inverse[i][i] = 1;
 
 	/* Copy original matrix so we don't mess it up */
-	for(i = 0; i < 4; i++)
-		for(j = 0; j <4; j++)
+	for (i = 0; i < 4; i++)
+		for (j = 0; j < 4; j++)
 			tempmat[i][j] = mat[i][j];
 
-	for(i = 0; i < 4; i++) {
+	for (i = 0; i < 4; i++) {
 		/* Look for row with max pivot */
 		max = fabs(tempmat[i][i]);
 		maxj = i;
-		for(j = i + 1; j < 4; j++) {
-			if(fabsf(tempmat[j][i]) > max) {
+		for (j = i + 1; j < 4; j++) {
+			if (fabsf(tempmat[j][i]) > max) {
 				max = fabs(tempmat[j][i]);
 				maxj = j;
 			}
 		}
 		/* Swap rows if necessary */
 		if (maxj != i) {
-			for(k = 0; k < 4; k++) {
+			for (k = 0; k < 4; k++) {
 				SWAP(float, tempmat[i][k], tempmat[maxj][k]);
 				SWAP(float, inverse[i][k], inverse[maxj][k]);
 			}
@@ -571,16 +590,16 @@ int invert_m4_m4(float inverse[4][4], float mat[4][4])
 		temp = tempmat[i][i];
 		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);
+		for (k = 0; k < 4; k++) {
+			tempmat[i][k] = (float)(tempmat[i][k] / temp);
+			inverse[i][k] = (float)(inverse[i][k] / temp);
 		}
-		for(j = 0; j < 4; j++) {
-			if(j != i) {
+		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);
+				for (k = 0; k < 4; k++) {
+					tempmat[j][k] -= (float)(tempmat[i][k] * temp);
+					inverse[j][k] -= (float)(inverse[i][k] * temp);
 				}
 			}
 		}
@@ -594,14 +613,14 @@ void transpose_m3(float mat[][3])
 {
 	float t;
 
-	t = mat[0][1] ; 
-	mat[0][1] = mat[1][0] ; 
+	t = mat[0][1];
+	mat[0][1] = mat[1][0];
 	mat[1][0] = t;
-	t = mat[0][2] ; 
-	mat[0][2] = mat[2][0] ; 
+	t = mat[0][2];
+	mat[0][2] = mat[2][0];
 	mat[2][0] = t;
-	t = mat[1][2] ; 
-	mat[1][2] = mat[2][1] ; 
+	t = mat[1][2];
+	mat[1][2] = mat[2][1];
 	mat[2][1] = t;
 }
 
@@ -609,25 +628,25 @@ void transpose_m4(float mat[][4])
 {
 	float t;
 
-	t = mat[0][1] ; 
-	mat[0][1] = mat[1][0] ; 
+	t = mat[0][1];
+	mat[0][1] = mat[1][0];
 	mat[1][0] = t;
-	t = mat[0][2] ; 
-	mat[0][2] = mat[2][0] ; 
+	t = mat[0][2];
+	mat[0][2] = mat[2][0];
 	mat[2][0] = t;
-	t = mat[0][3] ; 
-	mat[0][3] = mat[3][0] ; 
+	t = mat[0][3];
+	mat[0][3] = mat[3][0];
 	mat[3][0] = t;
 
-	t = mat[1][2] ; 
-	mat[1][2] = mat[2][1] ; 
+	t = mat[1][2];
+	mat[1][2] = mat[2][1];
 	mat[2][1] = t;
-	t = mat[1][3] ; 
-	mat[1][3] = mat[3][1] ; 
+	t = mat[1][3];
+	mat[1][3] = mat[3][1];
 	mat[3][1] = t;
 
-	t = mat[2][3] ; 
-	mat[2][3] = mat[3][2] ; 
+	t = mat[2][3];
+	mat[2][3] = mat[3][2];
 	mat[3][2] = t;
 }
 
@@ -636,23 +655,24 @@ void orthogonalize_m3(float mat[][3], int axis)
 	float size[3];
 	mat3_to_size(size, mat);
 	normalize_v3(mat[axis]);
-	switch(axis)
-	{
+	switch (axis) {
 		case 0:
 			if (dot_v3v3(mat[0], mat[1]) < 1) {
 				cross_v3_v3v3(mat[2], mat[0], mat[1]);
 				normalize_v3(mat[2]);
 				cross_v3_v3v3(mat[1], mat[2], mat[0]);
-			} else if (dot_v3v3(mat[0], mat[2]) < 1) {
+			}
+			else if (dot_v3v3(mat[0], mat[2]) < 1) {
 				cross_v3_v3v3(mat[1], mat[2], mat[0]);
 				normalize_v3(mat[1]);
 				cross_v3_v3v3(mat[2], mat[0], mat[1]);
-			} else {
+			}
+			else {
 				float vec[3];
 
-				vec[0]= mat[0][1];
-				vec[1]= mat[0][2];
-				vec[2]= mat[0][0];
+				vec[0] = mat[0][1];
+				vec[1] = mat[0][2];
+				vec[2] = mat[0][0];
 
 				cross_v3_v3v3(mat[2], mat[0], vec);
 				normalize_v3(mat[2]);
@@ -663,16 +683,18 @@ void orthogonalize_m3(float mat[][3], int axis)
 				cross_v3_v3v3(mat[2], mat[0], mat[1]);
 				normalize_v3(mat[2]);
 				cross_v3_v3v3(mat[0], mat[1], mat[2]);
-			} else if (dot_v3v3(mat[0], mat[2]) < 1) {
+			}
+			else if (dot_v3v3(mat[0], mat[2]) < 1) {
 				cross_v3_v3v3(mat[0], mat[1], mat[2]);
 				normalize_v3(mat[0]);
 				cross_v3_v3v3(mat[2], mat[0], mat[1]);
-			} else {
+			}
+			else {
 				float vec[3];
 
-				vec[0]= mat[1][1];
-				vec[1]= mat[1][2];
-				vec[2]= mat[1][0];
+				vec[0] = mat[1][1];
+				vec[1] = mat[1][2];
+				vec[2] = mat[1][0];
 
 				cross_v3_v3v3(mat[0], mat[1], vec);
 				normalize_v3(mat[0]);
@@ -683,16 +705,18 @@ void orthogonalize_m3(float mat[][3], int axis)
 				cross_v3_v3v3(mat[1], mat[2], mat[0]);
 				normalize_v3(mat[1]);
 				cross_v3_v3v3(mat[0], mat[1], mat[2]);
-			} else if (dot_v3v3(mat[2], mat[1]) < 1) {
+			}
+			else if (dot_v3v3(mat[2], mat[1]) < 1) {
 				cross_v3_v3v3(mat[0], mat[1], mat[2]);
 				normalize_v3(mat[0]);
 				cross_v3_v3v3(mat[1], mat[2], mat[0]);
-			} else {
+			}
+			else {
 				float vec[3];
 
-				vec[0]= mat[2][1];
-				vec[1]= mat[2][2];
-				vec[2]= mat[2][0];
+				vec[0] = mat[2][1];
+				vec[1] = mat[2][2];
+				vec[2] = mat[2][0];
 
 				cross_v3_v3v3(mat[0], vec, mat[2]);
 				normalize_v3(mat[0]);
@@ -709,23 +733,24 @@ void orthogonalize_m4(float mat[][4], int axis)
 	float size[3];
 	mat4_to_size(size, mat);
 	normalize_v3(mat[axis]);
-	switch(axis)
-	{
+	switch (axis) {
 		case 0:
 			if (dot_v3v3(mat[0], mat[1]) < 1) {
 				cross_v3_v3v3(mat[2], mat[0], mat[1]);
 				normalize_v3(mat[2]);
 				cross_v3_v3v3(mat[1], mat[2], mat[0]);
-			} else if (dot_v3v3(mat[0], mat[2]) < 1) {
+			}
+			else if (dot_v3v3(mat[0], mat[2]) < 1) {
 				cross_v3_v3v3(mat[1], mat[2], mat[0]);
 				normalize_v3(mat[1]);
 				cross_v3_v3v3(mat[2], mat[0], mat[1]);
-			} else {
+			}
+			else {
 				float vec[3];
 
-				vec[0]= mat[0][1];
-				vec[1]= mat[0][2];
-				vec[2]= mat[0][0];
+				vec[0] = mat[0][1];
+				vec[1] = mat[0][2];
+				vec[2] = mat[0][0];
 
 				cross_v3_v3v3(mat[2], mat[0], vec);
 				normalize_v3(mat[2]);
@@ -737,16 +762,18 @@ void orthogonalize_m4(float mat[][4], int axis)
 				cross_v3_v3v3(mat[2], mat[0], mat[1]);
 				normalize_v3(mat[2]);
 				cross_v3_v3v3(mat[0], mat[1], mat[2]);
-			} else if (dot_v3v3(mat[0], mat[2]) < 1) {
+			}
+			else if (dot_v3v3(mat[0], mat[2]) < 1) {
 				cross_v3_v3v3(mat[0], mat[1], mat[2]);
 				normalize_v3(mat[0]);
 				cross_v3_v3v3(mat[2], mat[0], mat[1]);
-			} else {
+			}
+			else {
 				float vec[3];
 
-				vec[0]= mat[1][1];
-				vec[1]= mat[1][2];
-				vec[2]= mat[1][0];
+				vec[0] = mat[1][1];
+				vec[1] = mat[1][2];
+				vec[2] = mat[1][0];
 
 				cross_v3_v3v3(mat[0], mat[1], vec);
 				normalize_v3(mat[0]);
@@ -757,16 +784,18 @@ void orthogonalize_m4(float mat[][4], int axis)
 				cross_v3_v3v3(mat[1], mat[2], mat[0]);
 				normalize_v3(mat[1]);
 				cross_v3_v3v3(mat[0], mat[1], mat[2]);
-			} else if (dot_v3v3(mat[2], mat[1]) < 1) {
+			}
+			else if (dot_v3v3(mat[2], mat[1]) < 1) {
 				cross_v3_v3v3(mat[0], mat[1], mat[2]);
 				normalize_v3(mat[0]);
 				cross_v3_v3v3(mat[1], mat[2], mat[0]);
-			} else {
+			}
+			else {
 				float vec[3];
 
-				vec[0]= mat[2][1];
-				vec[1]= mat[2][2];
-				vec[2]= mat[2][0];
+				vec[0] = mat[2][1];
+				vec[1] = mat[2][2];
+				vec[2] = mat[2][0];
 
 				cross_v3_v3v3(mat[0], vec, mat[2]);
 				normalize_v3(mat[0]);
@@ -780,154 +809,178 @@ void orthogonalize_m4(float mat[][4], int axis)
 
 int is_orthogonal_m3(float m[][3])
 {
-    int i, j;
-
-    for (i = 0; i < 3; i++) {
-        for (j = 0; j < i; j++) {
-            if (fabsf(dot_v3v3(m[i], m[j])) > 1.5f * FLT_EPSILON)
-                return 0;
-        }
+	int i, j;
 
-        if (fabsf(dot_v3v3(m[i], m[i]) - 1) > 1.5f * FLT_EPSILON)
-            return 0;
-    }
+	for (i = 0; i < 3; i++) {
+		for (j = 0; j < i; j++) {
+			if (fabsf(dot_v3v3(m[i], m[j])) > 1.5f * FLT_EPSILON)
+				return 0;
+		}
+	}
 
-    return 1;
+	return 1;
 }
 
 int is_orthogonal_m4(float m[][4])
 {
-    int i, j;
+	int i, j;
 
-    for (i = 0; i < 4; i++) {
-        for (j = 0; j < i; j++) {
-            if (fabsf(dot_vn_vn(m[i], m[j], 4)) > 1.5f * FLT_EPSILON)
-                return 0;
-        }
+	for (i = 0; i < 4; i++) {
+		for (j = 0; j < i; j++) {
+			if (fabsf(dot_vn_vn(m[i], m[j], 4)) > 1.5f * FLT_EPSILON)
+				return 0;
+		}
 
-        if (fabsf(dot_vn_vn(m[i], m[i], 4) - 1) > 1.5f * FLT_EPSILON)
-            return 0;
-    }
+	}
 
-    return 1;
+	return 1;
+}
+
+int is_orthonormal_m3(float m[][3])
+{
+	if (is_orthogonal_m3(m)) {
+		int i;
+
+		for (i = 0; i < 3; i++)
+			if (fabsf(dot_v3v3(m[i], m[i]) - 1) > 1.5f * FLT_EPSILON)
+				return 0;
+
+		return 1;
+	}
+
+	return 0;
+}
+
+int is_orthonormal_m4(float m[][4])
+{
+	if (is_orthogonal_m4(m)) {
+		int i;
+
+		for (i = 0; i < 4; i++)
+			if (fabsf(dot_vn_vn(m[i], m[i], 4) - 1) > 1.5f * FLT_EPSILON)
+				return 0;
+
+		return 1;
+	}
+
+	return 0;
 }
 
 void normalize_m3(float mat[][3])
-{	
+{
 	normalize_v3(mat[0]);
 	normalize_v3(mat[1]);
 	normalize_v3(mat[2]);
 }
 
 void normalize_m3_m3(float rmat[][3], float mat[][3])
-{	
+{
 	normalize_v3_v3(rmat[0], mat[0]);
 	normalize_v3_v3(rmat[1], mat[1]);
 	normalize_v3_v3(rmat[2], mat[2]);
 }
 
-
 void normalize_m4(float mat[][4])
 {
 	float len;
-	
-	len= normalize_v3(mat[0]);
-	if(len!=0.0f) mat[0][3]/= len;
-	len= normalize_v3(mat[1]);
-	if(len!=0.0f) mat[1][3]/= len;
-	len= normalize_v3(mat[2]);
-	if(len!=0.0f) mat[2][3]/= len;
+
+	len = normalize_v3(mat[0]);
+	if (len != 0.0f) mat[0][3] /= len;
+	len = normalize_v3(mat[1]);
+	if (len != 0.0f) mat[1][3] /= len;
+	len = normalize_v3(mat[2]);
+	if (len != 0.0f) mat[2][3] /= len;
 }
 
 void normalize_m4_m4(float rmat[][4], float mat[][4])
 {
 	float len;
-	
-	len= normalize_v3_v3(rmat[0], mat[0]);
-	if(len!=0.0f) rmat[0][3]= mat[0][3] / len;
-	len= normalize_v3_v3(rmat[1], mat[1]);
-	if(len!=0.0f) rmat[1][3]= mat[1][3] / len;
-	len= normalize_v3_v3(rmat[2], mat[2]);
-	if(len!=0.0f) rmat[2][3]= mat[2][3] / len;
+
+	len = normalize_v3_v3(rmat[0], mat[0]);
+	if (len != 0.0f) rmat[0][3] = mat[0][3] / len;
+	len = normalize_v3_v3(rmat[1], mat[1]);
+	if (len != 0.0f) rmat[1][3] = mat[1][3] / len;
+	len = normalize_v3_v3(rmat[2], mat[2]);
+	if (len != 0.0f) rmat[2][3] = mat[2][3] / len;
 }
 
 void adjoint_m3_m3(float m1[][3], float m[][3])
 {
-	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];
+	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];
 
-	m1[1][0]= -m[1][0]*m[2][2]+m[1][2]*m[2][0];
-	m1[1][1]=m[0][0]*m[2][2]-m[0][2]*m[2][0];
-	m1[1][2]= -m[0][0]*m[1][2]+m[0][2]*m[1][0];
+	m1[1][0] = -m[1][0] * m[2][2] + m[1][2] * m[2][0];
+	m1[1][1] = m[0][0] * m[2][2] - m[0][2] * m[2][0];
+	m1[1][2] = -m[0][0] * m[1][2] + m[0][2] * m[1][0];
 
-	m1[2][0]=m[1][0]*m[2][1]-m[1][1]*m[2][0];
-	m1[2][1]= -m[0][0]*m[2][1]+m[0][1]*m[2][0];
-	m1[2][2]=m[0][0]*m[1][1]-m[0][1]*m[1][0];
+	m1[2][0] = m[1][0] * m[2][1] - m[1][1] * m[2][0];
+	m1[2][1] = -m[0][0] * m[2][1] + m[0][1] * m[2][0];
+	m1[2][2] = m[0][0] * m[1][1] - m[0][1] * m[1][0];
 }
 
-void adjoint_m4_m4(float out[][4], float in[][4])	/* out = ADJ(in) */
+void adjoint_m4_m4(float out[][4], float in[][4]) /* out = ADJ(in) */
 {
 	float a1, a2, a3, a4, b1, b2, b3, b4;
 	float c1, c2, c3, c4, d1, d2, d3, d4;
 
-	a1= in[0][0]; 
-	b1= in[0][1];
-	c1= in[0][2]; 
-	d1= in[0][3];
+	a1 = in[0][0];
+	b1 = in[0][1];
+	c1 = in[0][2];
+	d1 = in[0][3];
 
-	a2= in[1][0]; 
-	b2= in[1][1];
-	c2= in[1][2]; 
-	d2= in[1][3];
+	a2 = in[1][0];
+	b2 = in[1][1];
+	c2 = in[1][2];
+	d2 = in[1][3];
 
-	a3= in[2][0]; 
-	b3= in[2][1];
-	c3= in[2][2]; 
-	d3= in[2][3];
+	a3 = in[2][0];
+	b3 = in[2][1];
+	c3 = in[2][2];
+	d3 = in[2][3];
 
-	a4= in[3][0]; 
-	b4= in[3][1];
-	c4= in[3][2]; 
-	d4= in[3][3];
+	a4 = in[3][0];
+	b4 = in[3][1];
+	c4 = in[3][2];
+	d4 = in[3][3];
 
 
-	out[0][0]  =   determinant_m3(b2, b3, b4, c2, c3, c4, d2, d3, d4);
-	out[1][0]  = - determinant_m3(a2, a3, a4, c2, c3, c4, d2, d3, d4);
-	out[2][0]  =   determinant_m3(a2, a3, a4, b2, b3, b4, d2, d3, d4);
-	out[3][0]  = - determinant_m3(a2, a3, a4, b2, b3, b4, c2, c3, c4);
+	out[0][0] = determinant_m3(b2, b3, b4, c2, c3, c4, d2, d3, d4);
+	out[1][0] = -determinant_m3(a2, a3, a4, c2, c3, c4, d2, d3, d4);
+	out[2][0] = determinant_m3(a2, a3, a4, b2, b3, b4, d2, d3, d4);
+	out[3][0] = -determinant_m3(a2, a3, a4, b2, b3, b4, c2, c3, c4);
 
-	out[0][1]  = - determinant_m3(b1, b3, b4, c1, c3, c4, d1, d3, d4);
-	out[1][1]  =   determinant_m3(a1, a3, a4, c1, c3, c4, d1, d3, d4);
-	out[2][1]  = - determinant_m3(a1, a3, a4, b1, b3, b4, d1, d3, d4);
-	out[3][1]  =   determinant_m3(a1, a3, a4, b1, b3, b4, c1, c3, c4);
+	out[0][1] = -determinant_m3(b1, b3, b4, c1, c3, c4, d1, d3, d4);
+	out[1][1] = determinant_m3(a1, a3, a4, c1, c3, c4, d1, d3, d4);
+	out[2][1] = -determinant_m3(a1, a3, a4, b1, b3, b4, d1, d3, d4);
+	out[3][1] = determinant_m3(a1, a3, a4, b1, b3, b4, c1, c3, c4);
 
-	out[0][2]  =   determinant_m3(b1, b2, b4, c1, c2, c4, d1, d2, d4);
-	out[1][2]  = - determinant_m3(a1, a2, a4, c1, c2, c4, d1, d2, d4);
-	out[2][2]  =   determinant_m3(a1, a2, a4, b1, b2, b4, d1, d2, d4);
-	out[3][2]  = - determinant_m3(a1, a2, a4, b1, b2, b4, c1, c2, c4);
+	out[0][2] = determinant_m3(b1, b2, b4, c1, c2, c4, d1, d2, d4);
+	out[1][2] = -determinant_m3(a1, a2, a4, c1, c2, c4, d1, d2, d4);
+	out[2][2] = determinant_m3(a1, a2, a4, b1, b2, b4, d1, d2, d4);
+	out[3][2] = -determinant_m3(a1, a2, a4, b1, b2, b4, c1, c2, c4);
 
-	out[0][3]  = - determinant_m3(b1, b2, b3, c1, c2, c3, d1, d2, d3);
-	out[1][3]  =   determinant_m3(a1, a2, a3, c1, c2, c3, d1, d2, d3);
-	out[2][3]  = - determinant_m3(a1, a2, a3, b1, b2, b3, d1, d2, d3);
-	out[3][3]  =   determinant_m3(a1, a2, a3, b1, b2, b3, c1, c2, c3);
+	out[0][3] = -determinant_m3(b1, b2, b3, c1, c2, c3, d1, d2, d3);
+	out[1][3] = determinant_m3(a1, a2, a3, c1, c2, c3, d1, d2, d3);
+	out[2][3] = -determinant_m3(a1, a2, a3, b1, b2, b3, d1, d2, d3);
+	out[3][3] = determinant_m3(a1, a2, a3, b1, b2, b3, c1, c2, c3);
 }
 
-float determinant_m2(float a,float b,float c,float d)
+float determinant_m2(float a, float b, float c, float d)
 {
 
-	return a*d - b*c;
+	return a * d - b * c;
 }
 
 float determinant_m3(float a1, float a2, float a3,
-			 float b1, float b2, float b3,
-			 float c1, float c2, float c3)
+                     float b1, float b2, float b3,
+                     float c1, float c2, float c3)
 {
 	float ans;
 
-	ans = a1 * determinant_m2(b2, b3, c2, c3)
-		- b1 * determinant_m2(a2, a3, c2, c3)
-		+ c1 * determinant_m2(a2, a3, b2, b3);
+	ans = (a1 * determinant_m2(b2, b3, c2, c3) -
+	       b1 * determinant_m2(a2, a3, c2, c3) +
+	       c1 * determinant_m2(a2, a3, b2, b3));
 
 	return ans;
 }
@@ -935,32 +988,32 @@ float determinant_m3(float a1, float a2, float a3,
 float determinant_m4(float m[][4])
 {
 	float ans;
-	float a1,a2,a3,a4,b1,b2,b3,b4,c1,c2,c3,c4,d1,d2,d3,d4;
+	float a1, a2, a3, a4, b1, b2, b3, b4, c1, c2, c3, c4, d1, d2, d3, d4;
 
-	a1= m[0][0]; 
-	b1= m[0][1];
-	c1= m[0][2]; 
-	d1= m[0][3];
+	a1 = m[0][0];
+	b1 = m[0][1];
+	c1 = m[0][2];
+	d1 = m[0][3];
 
-	a2= m[1][0]; 
-	b2= m[1][1];
-	c2= m[1][2]; 
-	d2= m[1][3];
+	a2 = m[1][0];
+	b2 = m[1][1];
+	c2 = m[1][2];
+	d2 = m[1][3];
 
-	a3= m[2][0]; 
-	b3= m[2][1];
-	c3= m[2][2]; 
-	d3= m[2][3];
+	a3 = m[2][0];
+	b3 = m[2][1];
+	c3 = m[2][2];
+	d3 = m[2][3];
 
-	a4= m[3][0]; 
-	b4= m[3][1];
-	c4= m[3][2]; 
-	d4= m[3][3];
+	a4 = m[3][0];
+	b4 = m[3][1];
+	c4 = m[3][2];
+	d4 = m[3][3];
 
-	ans = a1 * determinant_m3(b2, b3, b4, c2, c3, c4, d2, d3, d4)
-		- b1 * determinant_m3(a2, a3, a4, c2, c3, c4, d2, d3, d4)
-		+ c1 * determinant_m3(a2, a3, a4, b2, b3, b4, d2, d3, d4)
-		- d1 * determinant_m3(a2, a3, a4, b2, b3, b4, c2, c3, c4);
+	ans = (a1 * determinant_m3(b2, b3, b4, c2, c3, c4, d2, d3, d4) -
+	       b1 * determinant_m3(a2, a3, a4, c2, c3, c4, d2, d3, d4) +
+	       c1 * determinant_m3(a2, a3, a4, b2, b3, b4, d2, d3, d4) -
+	       d1 * determinant_m3(a2, a3, a4, b2, b3, b4, c2, c3, c4));
 
 	return ans;
 }
@@ -969,38 +1022,38 @@ float determinant_m4(float m[][4])
 
 void size_to_mat3(float mat[][3], const float size[3])
 {
-	mat[0][0]= size[0];
-	mat[0][1]= 0.0f;
-	mat[0][2]= 0.0f;
-	mat[1][1]= size[1];
-	mat[1][0]= 0.0f;
-	mat[1][2]= 0.0f;
-	mat[2][2]= size[2];
-	mat[2][1]= 0.0f;
-	mat[2][0]= 0.0f;
+	mat[0][0] = size[0];
+	mat[0][1] = 0.0f;
+	mat[0][2] = 0.0f;
+	mat[1][1] = size[1];
+	mat[1][0] = 0.0f;
+	mat[1][2] = 0.0f;
+	mat[2][2] = size[2];
+	mat[2][1] = 0.0f;
+	mat[2][0] = 0.0f;
 }
 
 void size_to_mat4(float mat[][4], const float size[3])
 {
 	float tmat[3][3];
-	
-	size_to_mat3(tmat,size);
+
+	size_to_mat3(tmat, size);
 	unit_m4(mat);
 	copy_m4_m3(mat, tmat);
 }
 
 void mat3_to_size(float size[3], float mat[][3])
 {
-	size[0]= len_v3(mat[0]);
-	size[1]= len_v3(mat[1]);
-	size[2]= len_v3(mat[2]);
+	size[0] = len_v3(mat[0]);
+	size[1] = len_v3(mat[1]);
+	size[2] = len_v3(mat[2]);
 }
 
 void mat4_to_size(float size[3], float mat[][4])
 {
-	size[0]= len_v3(mat[0]);
-	size[1]= len_v3(mat[1]);
-	size[2]= len_v3(mat[2]);
+	size[0] = len_v3(mat[0]);
+	size[1] = len_v3(mat[1]);
+	size[2] = len_v3(mat[2]);
 }
 
 /* this gets the average scale of a matrix, only use when your scaling
@@ -1021,10 +1074,9 @@ float mat4_to_scale(float mat[][4])
 	return mat3_to_scale(tmat);
 }
 
-
 void mat3_to_rot_size(float rot[3][3], float size[3], float mat3[3][3])
 {
-	float mat3_n[3][3];  /* mat3 -> normalized, 3x3 */
+	float mat3_n[3][3]; /* mat3 -> normalized, 3x3 */
 	float imat3_n[3][3]; /* mat3 -> normalized & inverted, 3x3 */
 
 	/* rotation & scale are linked, we need to create the mat's
@@ -1033,7 +1085,7 @@ void mat3_to_rot_size(float rot[3][3], float size[3], float mat3[3][3])
 	/* so scale doesnt interfear with rotation [#24291] */
 	/* note: this is a workaround for negative matrix not working for rotation conversion, FIXME */
 	normalize_m3_m3(mat3_n, mat3);
-	if(is_negative_m3(mat3)) {
+	if (is_negative_m3(mat3)) {
 		negate_v3(mat3_n[0]);
 		negate_v3(mat3_n[1]);
 		negate_v3(mat3_n[2]);
@@ -1048,14 +1100,14 @@ void mat3_to_rot_size(float rot[3][3], float size[3], float mat3[3][3])
 	invert_m3_m3(imat3_n, mat3_n);
 	mul_m3_m3m3(mat3, imat3_n, mat3);
 
-	size[0]= mat3[0][0];
-	size[1]= mat3[1][1];
-	size[2]= mat3[2][2];
+	size[0] = mat3[0][0];
+	size[1] = mat3[1][1];
+	size[2] = mat3[2][2];
 }
 
 void mat4_to_loc_rot_size(float loc[3], float rot[3][3], float size[3], float wmat[][4])
 {
-	float mat3[3][3];    /* wmat -> 3x3 */
+	float mat3[3][3]; /* wmat -> 3x3 */
 
 	copy_m3_m4(mat3, wmat);
 	mat3_to_rot_size(rot, size, mat3);
@@ -1066,66 +1118,66 @@ void mat4_to_loc_rot_size(float loc[3], float rot[3][3], float size[3], float wm
 
 void scale_m3_fl(float m[][3], float scale)
 {
-	m[0][0]= m[1][1]= m[2][2]= scale;
-	m[0][1]= m[0][2]= 0.0;
-	m[1][0]= m[1][2]= 0.0;
-	m[2][0]= m[2][1]= 0.0;
+	m[0][0] = m[1][1] = m[2][2] = scale;
+	m[0][1] = m[0][2] = 0.0;
+	m[1][0] = m[1][2] = 0.0;
+	m[2][0] = m[2][1] = 0.0;
 }
 
 void scale_m4_fl(float m[][4], float scale)
 {
-	m[0][0]= m[1][1]= m[2][2]= scale;
-	m[3][3]= 1.0;
-	m[0][1]= m[0][2]= m[0][3]= 0.0;
-	m[1][0]= m[1][2]= m[1][3]= 0.0;
-	m[2][0]= m[2][1]= m[2][3]= 0.0;
-	m[3][0]= m[3][1]= m[3][2]= 0.0;
+	m[0][0] = m[1][1] = m[2][2] = scale;
+	m[3][3] = 1.0;
+	m[0][1] = m[0][2] = m[0][3] = 0.0;
+	m[1][0] = m[1][2] = m[1][3] = 0.0;
+	m[2][0] = m[2][1] = m[2][3] = 0.0;
+	m[3][0] = m[3][1] = m[3][2] = 0.0;
 }
 
-void translate_m4(float mat[][4],float Tx, float Ty, float Tz)
+void translate_m4(float mat[][4], float Tx, float Ty, float Tz)
 {
-	mat[3][0] += (Tx*mat[0][0] + Ty*mat[1][0] + Tz*mat[2][0]);
-	mat[3][1] += (Tx*mat[0][1] + Ty*mat[1][1] + Tz*mat[2][1]);
-	mat[3][2] += (Tx*mat[0][2] + Ty*mat[1][2] + Tz*mat[2][2]);
+	mat[3][0] += (Tx * mat[0][0] + Ty * mat[1][0] + Tz * mat[2][0]);
+	mat[3][1] += (Tx * mat[0][1] + Ty * mat[1][1] + Tz * mat[2][1]);
+	mat[3][2] += (Tx * mat[0][2] + Ty * mat[1][2] + Tz * mat[2][2]);
 }
 
 void rotate_m4(float mat[][4], const char axis, const float angle)
 {
 	int col;
-	float temp[4]= {0.0f, 0.0f, 0.0f, 0.0f};
+	float temp[4] = {0.0f, 0.0f, 0.0f, 0.0f};
 	float cosine, sine;
 
 	assert(axis >= 'X' && axis <= 'Z');
 
 	cosine = (float)cos(angle);
 	sine = (float)sin(angle);
-	switch(axis){
-	case 'X':    
-		for(col=0 ; col<4 ; col++)
-			temp[col] = cosine*mat[1][col] + sine*mat[2][col];
-		for(col=0 ; col<4 ; col++) {
-		mat[2][col] = - sine*mat[1][col] + cosine*mat[2][col];
-			mat[1][col] = temp[col];
-	}
-		break;
-
-	case 'Y':
-		for(col=0 ; col<4 ; col++)
-			temp[col] = cosine*mat[0][col] - sine*mat[2][col];
-		for(col=0 ; col<4 ; col++) {
-			mat[2][col] = sine*mat[0][col] + cosine*mat[2][col];
-			mat[0][col] = temp[col];
-		}
-	break;
-
-	case 'Z':
-		for(col=0 ; col<4 ; col++)
-			temp[col] = cosine*mat[0][col] + sine*mat[1][col];
-		for(col=0 ; col<4 ; col++) {
-			mat[1][col] = - sine*mat[0][col] + cosine*mat[1][col];
-			mat[0][col] = temp[col];
-		}
-	break;
+	switch (axis) {
+		case 'X':
+			for (col = 0; col < 4; col++)
+				temp[col] = cosine * mat[1][col] + sine * mat[2][col];
+			for (col = 0; col < 4; col++) {
+				mat[2][col] = -sine * mat[1][col] + cosine * mat[2][col];
+				mat[1][col] = temp[col];
+			}
+			break;
+
+		case 'Y':
+			for (col = 0; col < 4; col++)
+				temp[col] = cosine * mat[0][col] - sine * mat[2][col];
+			for (col = 0; col < 4; col++) {
+				mat[2][col] = sine * mat[0][col] + cosine * mat[2][col];
+				mat[0][col] = temp[col];
+			}
+			break;
+
+		case 'Z':
+			for (col = 0; col < 4; col++)
+				temp[col] = cosine * mat[0][col] + sine * mat[1][col];
+			for (col = 0; col < 4; col++) {
+				mat[1][col] = -sine * mat[0][col] + cosine * mat[1][col];
+				mat[0][col] = temp[col];
+			}
+			break;
 	}
 }
 
@@ -1135,7 +1187,7 @@ void blend_m3_m3m3(float out[][3], float dst[][3], float src[][3], const float s
 	float squat[4], dquat[4], fquat[4];
 	float sscale[3], dscale[3], fsize[3];
 	float rmat[3][3], smat[3][3];
-	
+
 	mat3_to_rot_size(drot, dscale, dst);
 	mat3_to_rot_size(srot, sscale, src);
 
@@ -1147,8 +1199,8 @@ void blend_m3_m3m3(float out[][3], float dst[][3], float src[][3], const float s
 	interp_v3_v3v3(fsize, dscale, sscale, srcweight);
 
 	/* compose new matrix */
-	quat_to_mat3(rmat,fquat);
-	size_to_mat3(smat,fsize);
+	quat_to_mat3(rmat, fquat);
+	size_to_mat3(smat, fsize);
 	mul_m3_m3m3(out, rmat, smat);
 }
 
@@ -1174,7 +1226,6 @@ void blend_m4_m4m4(float out[][4], float dst[][4], float src[][4], const float s
 	loc_quat_size_to_mat4(out, floc, fquat, fsize);
 }
 
-
 int is_negative_m3(float mat[][3])
 {
 	float vec[3];
@@ -1192,21 +1243,22 @@ int is_negative_m4(float mat[][4])
 /* make a 4x4 matrix out of 3 transform components */
 /* matrices are made in the order: scale * rot * loc */
 // TODO: need to have a version that allows for rotation order...
+
 void loc_eul_size_to_mat4(float mat[4][4], const float loc[3], const float eul[3], const float size[3])
 {
 	float rmat[3][3], smat[3][3], tmat[3][3];
-	
-	/* initialise new matrix */
+
+	/* initialize new matrix */
 	unit_m4(mat);
-	
+
 	/* make rotation + scaling part */
-	eul_to_mat3(rmat,eul);
-	size_to_mat3(smat,size);
+	eul_to_mat3(rmat, eul);
+	size_to_mat3(smat, size);
 	mul_m3_m3m3(tmat, rmat, smat);
-	
+
 	/* copy rot/scale part to output matrix*/
 	copy_m4_m3(mat, tmat);
-	
+
 	/* copy location to matrix */
 	mat[3][0] = loc[0];
 	mat[3][1] = loc[1];
@@ -1214,22 +1266,23 @@ void loc_eul_size_to_mat4(float mat[4][4], const float loc[3], const float eul[3
 }
 
 /* make a 4x4 matrix out of 3 transform components */
+
 /* matrices are made in the order: scale * rot * loc */
 void loc_eulO_size_to_mat4(float mat[4][4], const float loc[3], const float eul[3], const float size[3], const short rotOrder)
 {
 	float rmat[3][3], smat[3][3], tmat[3][3];
-	
-	/* initialise new matrix */
+
+	/* initialize new matrix */
 	unit_m4(mat);
-	
+
 	/* make rotation + scaling part */
-	eulO_to_mat3(rmat,eul, rotOrder);
-	size_to_mat3(smat,size);
+	eulO_to_mat3(rmat, eul, rotOrder);
+	size_to_mat3(smat, size);
 	mul_m3_m3m3(tmat, rmat, smat);
-	
+
 	/* copy rot/scale part to output matrix*/
 	copy_m4_m3(mat, tmat);
-	
+
 	/* copy location to matrix */
 	mat[3][0] = loc[0];
 	mat[3][1] = loc[1];
@@ -1238,22 +1291,23 @@ void loc_eulO_size_to_mat4(float mat[4][4], const float loc[3], const float eul[
 
 
 /* make a 4x4 matrix out of 3 transform components */
+
 /* matrices are made in the order: scale * rot * loc */
 void loc_quat_size_to_mat4(float mat[4][4], const float loc[3], const float quat[4], const float size[3])
 {
 	float rmat[3][3], smat[3][3], tmat[3][3];
-	
-	/* initialise new matrix */
+
+	/* initialize new matrix */
 	unit_m4(mat);
-	
+
 	/* make rotation + scaling part */
-	quat_to_mat3(rmat,quat);
-	size_to_mat3(smat,size);
+	quat_to_mat3(rmat, quat);
+	size_to_mat3(smat, size);
 	mul_m3_m3m3(tmat, rmat, smat);
-	
+
 	/* copy rot/scale part to output matrix*/
 	copy_m4_m3(mat, tmat);
-	
+
 	/* copy location to matrix */
 	mat[3][0] = loc[0];
 	mat[3][1] = loc[1];
@@ -1272,29 +1326,29 @@ void loc_axisangle_size_to_mat4(float mat[4][4], const float loc[3], const float
 void print_m3(const char *str, float m[][3])
 {
 	printf("%s\n", str);
-	printf("%f %f %f\n",m[0][0],m[1][0],m[2][0]);
-	printf("%f %f %f\n",m[0][1],m[1][1],m[2][1]);
-	printf("%f %f %f\n",m[0][2],m[1][2],m[2][2]);
+	printf("%f %f %f\n", m[0][0], m[1][0], m[2][0]);
+	printf("%f %f %f\n", m[0][1], m[1][1], m[2][1]);
+	printf("%f %f %f\n", m[0][2], m[1][2], m[2][2]);
 	printf("\n");
 }
 
 void print_m4(const char *str, float m[][4])
 {
 	printf("%s\n", str);
-	printf("%f %f %f %f\n",m[0][0],m[1][0],m[2][0],m[3][0]);
-	printf("%f %f %f %f\n",m[0][1],m[1][1],m[2][1],m[3][1]);
-	printf("%f %f %f %f\n",m[0][2],m[1][2],m[2][2],m[3][2]);
-	printf("%f %f %f %f\n",m[0][3],m[1][3],m[2][3],m[3][3]);
+	printf("%f %f %f %f\n", m[0][0], m[1][0], m[2][0], m[3][0]);
+	printf("%f %f %f %f\n", m[0][1], m[1][1], m[2][1], m[3][1]);
+	printf("%f %f %f %f\n", m[0][2], m[1][2], m[2][2], m[3][2]);
+	printf("%f %f %f %f\n", m[0][3], m[1][3], m[2][3], m[3][3]);
 	printf("\n");
 }
 
 /*********************************** SVD ************************************
  * from TNT matrix library
-
+ *
  * Compute the Single Value Decomposition of an arbitrary matrix A
- * That is compute the 3 matrices U,W,V with U column orthogonal (m,n) 
- * ,W a diagonal matrix and V an orthogonal square matrix s.t. 
- * A = U.W.Vt. From this decomposition it is trivial to compute the 
+ * That is compute the 3 matrices U,W,V with U column orthogonal (m,n)
+ * ,W a diagonal matrix and V an orthogonal square matrix s.t.
+ * A = U.W.Vt. From this decomposition it is trivial to compute the
  * (pseudo-inverse) of A as Ainv = V.Winv.tranpose(U).
  */
 
@@ -1305,25 +1359,25 @@ 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 = minf(m, n);
 
 	float *work = work1;
 	float *e = work2;
 	float eps;
 
-	int i=0, j=0, k=0, p, pp, iter;
+	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.
 
-	int nct = minf(m-1,n);
-	int nrt = maxf(0,minf(n-2,m));
+	int nct = minf(m - 1, n);
+	int nrt = maxf(0, minf(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 < maxf(nct, nrt); k++) {
 		if (k < nct) {
 
 			// Compute the transformation for the k-th column and
@@ -1331,14 +1385,14 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 			// 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]);
+				s[k] = hypotf(s[k], A[i][k]);
 			}
 			if (s[k] != 0.0f) {
 				float invsk;
 				if (A[k][k] < 0.0f) {
 					s[k] = -s[k];
 				}
-				invsk = 1.0f/s[k];
+				invsk = 1.0f / s[k];
 				for (i = k; i < m; i++) {
 					A[i][k] *= invsk;
 				}
@@ -1346,18 +1400,18 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 			}
 			s[k] = -s[k];
 		}
-		for (j = k+1; j < n; j++) {
-			if ((k < nct) && (s[k] != 0.0f))  {
+		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++) {
-					t += A[i][k]*A[i][j];
+					t += A[i][k] * A[i][j];
 				}
-				t = -t/A[k][k];
+				t = -t / A[k][k];
 				for (i = k; i < m; i++) {
-					A[i][j] += t*A[i][k];
+					A[i][j] += t * A[i][k];
 				}
 			}
 
@@ -1380,39 +1434,39 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 			// 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]);
+			for (i = k + 1; i < n; i++) {
+				e[k] = hypotf(e[k], e[i]);
 			}
 			if (e[k] != 0.0f) {
 				float invek;
-				if (e[k+1] < 0.0f) {
+				if (e[k + 1] < 0.0f) {
 					e[k] = -e[k];
 				}
-				invek = 1.0f/e[k];
-				for (i = k+1; i < n; i++) {
+				invek = 1.0f / e[k];
+				for (i = k + 1; i < n; i++) {
 					e[i] *= invek;
 				}
-				e[k+1] += 1.0f;
+				e[k + 1] += 1.0f;
 			}
 			e[k] = -e[k];
-			if ((k+1 < m) & (e[k] != 0.0f)) {
+			if ((k + 1 < m) & (e[k] != 0.0f)) {
 				float invek1;
 
-			// Apply the transformation.
+				// Apply the transformation.
 
-				for (i = k+1; i < m; i++) {
+				for (i = k + 1; i < m; i++) {
 					work[i] = 0.0f;
 				}
-				for (j = k+1; j < n; j++) {
-					for (i = k+1; i < m; i++) {
-						work[i] += e[j]*A[i][j];
+				for (j = k + 1; j < n; j++) {
+					for (i = k + 1; i < m; i++) {
+						work[i] += e[j] * A[i][j];
 					}
 				}
-				invek1 = 1.0f/e[k+1];
-				for (j = k+1; j < n; j++) {
-					float t = -e[j]*invek1;
-					for (i = k+1; i < m; i++) {
-						A[i][j] += t*work[i];
+				invek1 = 1.0f / e[k + 1];
+				for (j = k + 1; j < n; j++) {
+					float t = -e[j] * invek1;
+					for (i = k + 1; i < m; i++) {
+						A[i][j] += t * work[i];
 					}
 				}
 			}
@@ -1420,24 +1474,24 @@ 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.
 
-			for (i = k+1; i < n; i++)
+			for (i = k + 1; i < n; i++)
 				V[i][k] = e[i];
 		}
 	}
 
 	// Set up the final bidiagonal matrix or order p.
 
-	p = minf(n,m+1);
+	p = minf(n, m + 1);
 	if (nct < n) {
 		s[nct] = A[nct][nct];
 	}
 	if (m < p) {
-		s[p-1] = 0.0f;
+		s[p - 1] = 0.0f;
 	}
-	if (nrt+1 < p) {
-		e[nrt] = A[nrt][p-1];
+	if (nrt + 1 < p) {
+		e[nrt] = A[nrt][p - 1];
 	}
-	e[p-1] = 0.0f;
+	e[p - 1] = 0.0f;
 
 	// If required, generate U.
 
@@ -1447,26 +1501,27 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 		}
 		U[j][j] = 1.0f;
 	}
-	for (k = nct-1; k >= 0; k--) {
+	for (k = nct - 1; k >= 0; k--) {
 		if (s[k] != 0.0f) {
-			for (j = k+1; j < nu; j++) {
+			for (j = k + 1; j < nu; j++) {
 				float t = 0;
 				for (i = k; i < m; i++) {
-					t += U[i][k]*U[i][j];
+					t += U[i][k] * U[i][j];
 				}
-				t = -t/U[k][k];
+				t = -t / U[k][k];
 				for (i = k; i < m; i++) {
-					U[i][j] += t*U[i][k];
+					U[i][j] += t * U[i][k];
 				}
 			}
-			for (i = k; i < m; i++ ) {
+			for (i = k; i < m; i++) {
 				U[i][k] = -U[i][k];
 			}
 			U[k][k] = 1.0f + U[k][k];
-			for (i = 0; i < k-1; i++) {
+			for (i = 0; i < k - 1; i++) {
 				U[i][k] = 0.0f;
 			}
-		} else {
+		}
+		else {
 			for (i = 0; i < m; i++) {
 				U[i][k] = 0.0f;
 			}
@@ -1476,16 +1531,16 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 
 	// If required, generate V.
 
-	for (k = n-1; k >= 0; k--) {
+	for (k = n - 1; k >= 0; k--) {
 		if ((k < nrt) & (e[k] != 0.0f)) {
-			for (j = k+1; j < nu; j++) {
+			for (j = k + 1; j < nu; j++) {
 				float t = 0;
-				for (i = k+1; i < n; i++) {
-					t += V[i][k]*V[i][j];
+				for (i = k + 1; i < n; i++) {
+					t += V[i][k] * V[i][j];
 				}
-				t = -t/V[k+1][k];
-				for (i = k+1; i < n; i++) {
-					V[i][j] += t*V[i][k];
+				t = -t / V[k + 1][k];
+				for (i = k + 1; i < n; i++) {
+					V[i][j] += t * V[i][k];
 				}
 			}
 		}
@@ -1497,14 +1552,14 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 
 	// Main iteration loop for the singular values.
 
-	pp = p-1;
+	pp = p - 1;
 	iter = 0;
-	eps = powf(2.0f,-52.0f);
+	eps = powf(2.0f, -52.0f);
 	while (p > 0) {
-		int kase=0;
+		int kase = 0;
 
 		// Test for maximum iterations to avoid infinite loop
-		if(maxiter == 0)
+		if (maxiter == 0)
 			break;
 		maxiter--;
 
@@ -1512,42 +1567,45 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 		// 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 = 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).
+		// 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--) {
+		for (k = p - 2; k >= -1; k--) {
 			if (k == -1) {
 				break;
 			}
-			if (fabsf(e[k]) <= eps*(fabsf(s[k]) + fabsf(s[k+1]))) {
+			if (fabsf(e[k]) <= eps * (fabsf(s[k]) + fabsf(s[k + 1]))) {
 				e[k] = 0.0f;
 				break;
 			}
 		}
-		if (k == p-2) {
+		if (k == p - 2) {
 			kase = 4;
-		} else {
+		}
+		else {
 			int ks;
-			for (ks = p-1; ks >= k; ks--) {
+			for (ks = p - 1; ks >= k; ks--) {
 				float t;
 				if (ks == k) {
 					break;
 				}
-				t = (ks != p ? fabsf(e[ks]) : 0.f) + 
-							  (ks != k+1 ? fabsf(e[ks-1]) : 0.0f);
-				if (fabsf(s[ks]) <= eps*t)  {
+				t = (ks != p ? fabsf(e[ks]) : 0.f) +
+				    (ks != k + 1 ? fabsf(e[ks - 1]) : 0.0f);
+				if (fabsf(s[ks]) <= eps * t) {
 					s[ks] = 0.0f;
 					break;
 				}
 			}
 			if (ks == k) {
 				kase = 3;
-			} else if (ks == p-1) {
+			}
+			else if (ks == p - 1) {
 				kase = 1;
-			} else {
+			}
+			else {
 				kase = 2;
 				k = ks;
 			}
@@ -1560,127 +1618,130 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 
 			// Deflate negligible s(p).
 
-			case 1: {
-				float f = e[p-2];
-				e[p-2] = 0.0f;
-				for (j = p-2; j >= k; j--) {
-					float t = hypotf(s[j],f);
-					float invt = 1.0f/t;
-					float cs = s[j]*invt;
-					float sn = f*invt;
+			case 1:
+			{
+				float f = e[p - 2];
+				e[p - 2] = 0.0f;
+				for (j = p - 2; j >= k; j--) {
+					float t = hypotf(s[j], f);
+					float invt = 1.0f / t;
+					float cs = s[j] * invt;
+					float sn = f * invt;
 					s[j] = t;
 					if (j != k) {
-						f = -sn*e[j-1];
-						e[j-1] = cs*e[j-1];
+						f = -sn * e[j - 1];
+						e[j - 1] = cs * e[j - 1];
 					}
 
 					for (i = 0; i < n; i++) {
-						t = cs*V[i][j] + sn*V[i][p-1];
-						V[i][p-1] = -sn*V[i][j] + cs*V[i][p-1];
+						t = cs * V[i][j] + sn * V[i][p - 1];
+						V[i][p - 1] = -sn * V[i][j] + cs * V[i][p - 1];
 						V[i][j] = t;
 					}
 				}
+				break;
 			}
-			break;
 
 			// Split at negligible s(k).
 
-			case 2: {
-				float f = e[k-1];
-				e[k-1] = 0.0f;
+			case 2:
+			{
+				float f = e[k - 1];
+				e[k - 1] = 0.0f;
 				for (j = k; j < p; j++) {
-					float t = hypotf(s[j],f);
-					float invt = 1.0f/t;
-					float cs = s[j]*invt;
-					float sn = f*invt;
+					float t = hypotf(s[j], f);
+					float invt = 1.0f / t;
+					float cs = s[j] * invt;
+					float sn = f * invt;
 					s[j] = t;
-					f = -sn*e[j];
-					e[j] = cs*e[j];
+					f = -sn * e[j];
+					e[j] = cs * e[j];
 
 					for (i = 0; i < m; i++) {
-						t = cs*U[i][j] + sn*U[i][k-1];
-						U[i][k-1] = -sn*U[i][j] + cs*U[i][k-1];
+						t = cs * U[i][j] + sn * U[i][k - 1];
+						U[i][k - 1] = -sn * U[i][j] + cs * U[i][k - 1];
 						U[i][j] = t;
 					}
 				}
+				break;
 			}
-			break;
 
 			// Perform one qr step.
 
-			case 3: {
+			case 3:
+			{
 
 				// Calculate the shift.
 
 				float scale = maxf(maxf(maxf(maxf(
-						  fabsf(s[p-1]),fabsf(s[p-2])),fabsf(e[p-2])), 
-						  fabsf(s[k])),fabsf(e[k]));
-				float invscale = 1.0f/scale;
-				float sp = s[p-1]*invscale;
-				float spm1 = s[p-2]*invscale;
-				float epm1 = e[p-2]*invscale;
-				float sk = s[k]*invscale;
-				float ek = e[k]*invscale;
-				float b = ((spm1 + sp)*(spm1 - sp) + epm1*epm1)*0.5f;
-				float c = (sp*epm1)*(sp*epm1);
+				                   fabsf(s[p - 1]),fabsf(s[p - 2])),fabsf(e[p - 2])),
+				                   fabsf(s[k])),fabsf(e[k]));
+				float invscale = 1.0f / scale;
+				float sp = s[p - 1] * invscale;
+				float spm1 = s[p - 2] * invscale;
+				float epm1 = e[p - 2] * invscale;
+				float sk = s[k] * invscale;
+				float ek = e[k] * invscale;
+				float b = ((spm1 + sp) * (spm1 - sp) + epm1 * epm1) * 0.5f;
+				float c = (sp * epm1) * (sp * epm1);
 				float shift = 0.0f;
 				float f, g;
 				if ((b != 0.0f) || (c != 0.0f)) {
-					shift = sqrtf(b*b + c);
+					shift = sqrtf(b * b + c);
 					if (b < 0.0f) {
 						shift = -shift;
 					}
-					shift = c/(b + shift);
+					shift = c / (b + shift);
 				}
-				f = (sk + sp)*(sk - sp) + shift;
-				g = sk*ek;
+				f = (sk + sp) * (sk - sp) + shift;
+				g = sk * ek;
 
 				// Chase zeros.
 
-				for (j = k; j < p-1; j++) {
-					float t = hypotf(f,g);
+				for (j = k; j < p - 1; j++) {
+					float t = hypotf(f, g);
 					/* division by zero checks added to avoid NaN (brecht) */
-					float cs = (t == 0.0f)? 0.0f: f/t;
-					float sn = (t == 0.0f)? 0.0f: g/t;
+					float cs = (t == 0.0f) ? 0.0f : f / t;
+					float sn = (t == 0.0f) ? 0.0f : g / t;
 					if (j != k) {
-						e[j-1] = t;
+						e[j - 1] = t;
 					}
-					f = cs*s[j] + sn*e[j];
-					e[j] = cs*e[j] - sn*s[j];
-					g = sn*s[j+1];
-					s[j+1] = cs*s[j+1];
+					f = cs * s[j] + sn * e[j];
+					e[j] = cs * e[j] - sn * s[j];
+					g = sn * s[j + 1];
+					s[j + 1] = cs * s[j + 1];
 
 					for (i = 0; i < n; i++) {
-						t = cs*V[i][j] + sn*V[i][j+1];
-						V[i][j+1] = -sn*V[i][j] + cs*V[i][j+1];
+						t = cs * V[i][j] + sn * V[i][j + 1];
+						V[i][j + 1] = -sn * V[i][j] + cs * V[i][j + 1];
 						V[i][j] = t;
 					}
 
-					t = hypotf(f,g);
+					t = hypotf(f, g);
 					/* division by zero checks added to avoid NaN (brecht) */
-					cs = (t == 0.0f)? 0.0f: f/t;
-					sn = (t == 0.0f)? 0.0f: g/t;
+					cs = (t == 0.0f) ? 0.0f : f / t;
+					sn = (t == 0.0f) ? 0.0f : g / t;
 					s[j] = t;
-					f = cs*e[j] + sn*s[j+1];
-					s[j+1] = -sn*e[j] + cs*s[j+1];
-					g = sn*e[j+1];
-					e[j+1] = cs*e[j+1];
-					if (j < m-1) {
+					f = cs * e[j] + sn * s[j + 1];
+					s[j + 1] = -sn * e[j] + cs * s[j + 1];
+					g = sn * e[j + 1];
+					e[j + 1] = cs * e[j + 1];
+					if (j < m - 1) {
 						for (i = 0; i < m; i++) {
-							t = cs*U[i][j] + sn*U[i][j+1];
-							U[i][j+1] = -sn*U[i][j] + cs*U[i][j+1];
+							t = cs * U[i][j] + sn * U[i][j + 1];
+							U[i][j + 1] = -sn * U[i][j] + cs * U[i][j + 1];
 							U[i][j] = t;
 						}
 					}
 				}
-				e[p-2] = f;
+				e[p - 2] = f;
 				iter = iter + 1;
+				break;
 			}
-			break;
-
 			// Convergence.
 
-			case 4: {
+			case 4:
+			{
 
 				// Make the singular values positive.
 
@@ -1695,28 +1756,32 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 
 				while (k < pp) {
 					float t;
-					if (s[k] >= s[k+1]) {
+					if (s[k] >= s[k + 1]) {
 						break;
 					}
 					t = s[k];
-					s[k] = s[k+1];
-					s[k+1] = t;
-					if (k < n-1) {
+					s[k] = s[k + 1];
+					s[k + 1] = t;
+					if (k < n - 1) {
 						for (i = 0; i < n; i++) {
-							t = V[i][k+1]; V[i][k+1] = V[i][k]; V[i][k] = t;
+							t = V[i][k + 1];
+							V[i][k + 1] = V[i][k];
+							V[i][k] = t;
 						}
 					}
-					if (k < m-1) {
+					if (k < m - 1) {
 						for (i = 0; i < m; i++) {
-							t = U[i][k+1]; U[i][k+1] = U[i][k]; U[i][k] = t;
+							t = U[i][k + 1];
+							U[i][k + 1] = U[i][k];
+							U[i][k] = t;
 						}
 					}
 					k++;
 				}
 				iter = 0;
 				p--;
+				break;
 			}
-			break;
 		}
 	}
 }
@@ -1724,7 +1789,7 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4])
 void pseudoinverse_m4_m4(float Ainv[4][4], float A[4][4], float epsilon)
 {
 	/* compute moon-penrose pseudo inverse of matrix, singular values
-	   below epsilon are ignored for stability (truncated SVD) */
+	 * below epsilon are ignored for stability (truncated SVD) */
 	float V[4][4], W[4], Wm[4][4], U[4][4];
 	int i;
 
@@ -1734,8 +1799,8 @@ void pseudoinverse_m4_m4(float Ainv[4][4], float A[4][4], float epsilon)
 	transpose_m4(V);
 
 	zero_m4(Wm);
-	for(i=0; i<4; i++)
-		Wm[i][i]= (W[i] < epsilon)? 0.0f: 1.0f/W[i];
+	for (i = 0; i < 4; i++)
+		Wm[i][i] = (W[i] < epsilon) ? 0.0f : 1.0f / W[i];
 
 	transpose_m4(V);
 
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index b0e6fe5..ec5fd39 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -17,7 +17,7 @@
  *
  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
  * All rights reserved.
- 
+
  * The Original Code is: some of this file.
  *
  * ***** END GPL LICENSE BLOCK *****
@@ -40,25 +40,24 @@
 /* convenience, avoids setting Y axis everywhere */
 void unit_axis_angle(float axis[3], float *angle)
 {
-	axis[0]= 0.0f;
-	axis[1]= 1.0f;
-	axis[2]= 0.0f;
-	*angle= 0.0f;
+	axis[0] = 0.0f;
+	axis[1] = 1.0f;
+	axis[2] = 0.0f;
+	*angle = 0.0f;
 }
 
-
 void unit_qt(float q[4])
 {
-	q[0]= 1.0f;
-	q[1]= q[2]= q[3]= 0.0f;
+	q[0] = 1.0f;
+	q[1] = q[2] = q[3] = 0.0f;
 }
 
 void copy_qt_qt(float q1[4], const float q2[4])
 {
-	q1[0]= q2[0];
-	q1[1]= q2[1];
-	q1[2]= q2[2];
-	q1[3]= q2[3];
+	q1[0] = q2[0];
+	q1[1] = q2[1];
+	q1[2] = q2[2];
+	q1[3] = q2[3];
 }
 
 int is_zero_qt(float *q)
@@ -66,39 +65,39 @@ int is_zero_qt(float *q)
 	return (q[0] == 0 && q[1] == 0 && q[2] == 0 && q[3] == 0);
 }
 
-void mul_qt_qtqt(float *q, const float *q1, const float *q2)
+void mul_qt_qtqt(float q[4], const float q1[4], const float q2[4])
 {
-	float t0,t1,t2;
+	float t0, t1, t2;
 
-	t0=   q1[0]*q2[0]-q1[1]*q2[1]-q1[2]*q2[2]-q1[3]*q2[3];
-	t1=   q1[0]*q2[1]+q1[1]*q2[0]+q1[2]*q2[3]-q1[3]*q2[2];
-	t2=   q1[0]*q2[2]+q1[2]*q2[0]+q1[3]*q2[1]-q1[1]*q2[3];
-	q[3]= q1[0]*q2[3]+q1[3]*q2[0]+q1[1]*q2[2]-q1[2]*q2[1];
-	q[0]=t0; 
-	q[1]=t1; 
-	q[2]=t2;
+	t0 = q1[0] * q2[0] - q1[1] * q2[1] - q1[2] * q2[2] - q1[3] * q2[3];
+	t1 = q1[0] * q2[1] + q1[1] * q2[0] + q1[2] * q2[3] - q1[3] * q2[2];
+	t2 = q1[0] * q2[2] + q1[2] * q2[0] + q1[3] * q2[1] - q1[1] * q2[3];
+	q[3] = q1[0] * q2[3] + q1[3] * q2[0] + q1[1] * q2[2] - q1[2] * q2[1];
+	q[0] = t0;
+	q[1] = t1;
+	q[2] = t2;
 }
 
 /* Assumes a unit quaternion */
-void mul_qt_v3(const float *q, float *v)
+void mul_qt_v3(const float q[4], float v[3])
 {
 	float t0, t1, t2;
 
-	t0=  -q[1]*v[0]-q[2]*v[1]-q[3]*v[2];
-	t1=   q[0]*v[0]+q[2]*v[2]-q[3]*v[1];
-	t2=   q[0]*v[1]+q[3]*v[0]-q[1]*v[2];
-	v[2]= q[0]*v[2]+q[1]*v[1]-q[2]*v[0];
-	v[0]=t1; 
-	v[1]=t2;
+	t0 = -q[1] * v[0] - q[2] * v[1] - q[3] * v[2];
+	t1 = q[0] * v[0] + q[2] * v[2] - q[3] * v[1];
+	t2 = q[0] * v[1] + q[3] * v[0] - q[1] * v[2];
+	v[2] = q[0] * v[2] + q[1] * v[1] - q[2] * v[0];
+	v[0] = t1;
+	v[1] = t2;
 
-	t1=   t0*-q[1]+v[0]*q[0]-v[1]*q[3]+v[2]*q[2];
-	t2=   t0*-q[2]+v[1]*q[0]-v[2]*q[1]+v[0]*q[3];
-	v[2]= t0*-q[3]+v[2]*q[0]-v[0]*q[2]+v[1]*q[1];
-	v[0]=t1; 
-	v[1]=t2;
+	t1 = t0 * -q[1] + v[0] * q[0] - v[1] * q[3] + v[2] * q[2];
+	t2 = t0 * -q[2] + v[1] * q[0] - v[2] * q[1] + v[0] * q[3];
+	v[2] = t0 * -q[3] + v[2] * q[0] - v[0] * q[2] + v[1] * q[1];
+	v[0] = t1;
+	v[1] = t2;
 }
 
-void conjugate_qt(float *q)
+void conjugate_qt(float q[4])
 {
 	q[1] = -q[1];
 	q[2] = -q[2];
@@ -107,10 +106,10 @@ void conjugate_qt(float *q)
 
 float dot_qtqt(const float q1[4], const float q2[4])
 {
-	return q1[0]*q2[0] + q1[1]*q2[1] + q1[2]*q2[2] + q1[3]*q2[3];
+	return q1[0] * q2[0] + q1[1] * q2[1] + q1[2] * q2[2] + q1[3] * q2[3];
 }
 
-void invert_qt(float *q)
+void invert_qt(float q[4])
 {
 	float f = dot_qtqt(q, q);
 
@@ -118,17 +117,17 @@ void invert_qt(float *q)
 		return;
 
 	conjugate_qt(q);
-	mul_qt_fl(q, 1.0f/f);
+	mul_qt_fl(q, 1.0f / f);
 }
 
-void invert_qt_qt(float *q1, const float *q2)
+void invert_qt_qt(float q1[4], const float q2[4])
 {
 	copy_qt_qt(q1, q2);
 	invert_qt(q1);
 }
 
 /* simple mult */
-void mul_qt_fl(float *q, const float f)
+void mul_qt_fl(float q[4], const float f)
 {
 	q[0] *= f;
 	q[1] *= f;
@@ -140,65 +139,64 @@ void sub_qt_qtqt(float q[4], const float q1[4], const float q2[4])
 {
 	float nq2[4];
 
-	nq2[0]= -q2[0];
-	nq2[1]=  q2[1];
-	nq2[2]=  q2[2];
-	nq2[3]=  q2[3];
+	nq2[0] = -q2[0];
+	nq2[1] = q2[1];
+	nq2[2] = q2[2];
+	nq2[3] = q2[3];
 
 	mul_qt_qtqt(q, q1, nq2);
 }
 
 /* angular mult factor */
-void mul_fac_qt_fl(float *q, const float fac)
+void mul_fac_qt_fl(float q[4], const float fac)
 {
-	float angle= fac*saacos(q[0]);	/* quat[0]= cos(0.5*angle), but now the 0.5 and 2.0 rule out */
-	
-	float co= (float)cos(angle);
-	float si= (float)sin(angle);
-	q[0]= co;
-	normalize_v3(q+1);
-	mul_v3_fl(q+1, si);
+	float angle = fac * saacos(q[0]); /* quat[0] = cos(0.5 * angle), but now the 0.5 and 2.0 rule out */
+
+	float co = (float)cos(angle);
+	float si = (float)sin(angle);
+	q[0] = co;
+	normalize_v3(q + 1);
+	mul_v3_fl(q + 1, si);
 }
 
 /* skip error check, currently only needed by mat3_to_quat_is_ok */
 static void quat_to_mat3_no_error(float m[][3], const float q[4])
 {
-	double q0, q1, q2, q3, qda,qdb,qdc,qaa,qab,qac,qbb,qbc,qcc;
+	double q0, q1, q2, q3, qda, qdb, qdc, qaa, qab, qac, qbb, qbc, qcc;
 
-	q0= M_SQRT2 * (double)q[0];
-	q1= M_SQRT2 * (double)q[1];
-	q2= M_SQRT2 * (double)q[2];
-	q3= M_SQRT2 * (double)q[3];
+	q0 = M_SQRT2 * (double)q[0];
+	q1 = M_SQRT2 * (double)q[1];
+	q2 = M_SQRT2 * (double)q[2];
+	q3 = M_SQRT2 * (double)q[3];
 
-	qda= q0*q1;
-	qdb= q0*q2;
-	qdc= q0*q3;
-	qaa= q1*q1;
-	qab= q1*q2;
-	qac= q1*q3;
-	qbb= q2*q2;
-	qbc= q2*q3;
-	qcc= q3*q3;
+	qda = q0 * q1;
+	qdb = q0 * q2;
+	qdc = q0 * q3;
+	qaa = q1 * q1;
+	qab = q1 * q2;
+	qac = q1 * q3;
+	qbb = q2 * q2;
+	qbc = q2 * q3;
+	qcc = q3 * q3;
 
-	m[0][0]= (float)(1.0-qbb-qcc);
-	m[0][1]= (float)(qdc+qab);
-	m[0][2]= (float)(-qdb+qac);
+	m[0][0] = (float)(1.0 - qbb - qcc);
+	m[0][1] = (float)(qdc + qab);
+	m[0][2] = (float)(-qdb + qac);
 
-	m[1][0]= (float)(-qdc+qab);
-	m[1][1]= (float)(1.0-qaa-qcc);
-	m[1][2]= (float)(qda+qbc);
+	m[1][0] = (float)(-qdc + qab);
+	m[1][1] = (float)(1.0 - qaa - qcc);
+	m[1][2] = (float)(qda + qbc);
 
-	m[2][0]= (float)(qdb+qac);
-	m[2][1]= (float)(-qda+qbc);
-	m[2][2]= (float)(1.0-qaa-qbb);
+	m[2][0] = (float)(qdb + qac);
+	m[2][1] = (float)(-qda + qbc);
+	m[2][2] = (float)(1.0 - qaa - qbb);
 }
 
-
 void quat_to_mat3(float m[][3], const float q[4])
 {
 #ifdef DEBUG
 	float f;
-	if(!((f=dot_qtqt(q, q))==0.0f || (fabsf(f-1.0f) < (float)QUAT_EPSILON))) {
+	if (!((f = dot_qtqt(q, q)) == 0.0f || (fabsf(f - 1.0f) < (float)QUAT_EPSILON))) {
 		fprintf(stderr, "Warning! quat_to_mat3() called with non-normalized: size %.8f *** report a bug ***\n", f);
 	}
 #endif
@@ -208,106 +206,106 @@ void quat_to_mat3(float m[][3], const float q[4])
 
 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;
+	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.0f || (fabsf(q0 - 1.0) < QUAT_EPSILON))) {
 		fprintf(stderr, "Warning! quat_to_mat4() called with non-normalized: size %.8f *** report a bug ***\n", (float)q0);
 	}
 #endif
 
-	q0= M_SQRT2 * (double)q[0];
-	q1= M_SQRT2 * (double)q[1];
-	q2= M_SQRT2 * (double)q[2];
-	q3= M_SQRT2 * (double)q[3];
-
-	qda= q0*q1;
-	qdb= q0*q2;
-	qdc= q0*q3;
-	qaa= q1*q1;
-	qab= q1*q2;
-	qac= q1*q3;
-	qbb= q2*q2;
-	qbc= q2*q3;
-	qcc= q3*q3;
-
-	m[0][0]= (float)(1.0-qbb-qcc);
-	m[0][1]= (float)(qdc+qab);
-	m[0][2]= (float)(-qdb+qac);
-	m[0][3]= 0.0f;
-
-	m[1][0]= (float)(-qdc+qab);
-	m[1][1]= (float)(1.0-qaa-qcc);
-	m[1][2]= (float)(qda+qbc);
-	m[1][3]= 0.0f;
-
-	m[2][0]= (float)(qdb+qac);
-	m[2][1]= (float)(-qda+qbc);
-	m[2][2]= (float)(1.0-qaa-qbb);
-	m[2][3]= 0.0f;
-	
-	m[3][0]= m[3][1]= m[3][2]= 0.0f;
-	m[3][3]= 1.0f;
-}
-
-void mat3_to_quat(float *q, float wmat[][3])
+	q0 = M_SQRT2 * (double)q[0];
+	q1 = M_SQRT2 * (double)q[1];
+	q2 = M_SQRT2 * (double)q[2];
+	q3 = M_SQRT2 * (double)q[3];
+
+	qda = q0 * q1;
+	qdb = q0 * q2;
+	qdc = q0 * q3;
+	qaa = q1 * q1;
+	qab = q1 * q2;
+	qac = q1 * q3;
+	qbb = q2 * q2;
+	qbc = q2 * q3;
+	qcc = q3 * q3;
+
+	m[0][0] = (float)(1.0 - qbb - qcc);
+	m[0][1] = (float)(qdc + qab);
+	m[0][2] = (float)(-qdb + qac);
+	m[0][3] = 0.0f;
+
+	m[1][0] = (float)(-qdc + qab);
+	m[1][1] = (float)(1.0 - qaa - qcc);
+	m[1][2] = (float)(qda + qbc);
+	m[1][3] = 0.0f;
+
+	m[2][0] = (float)(qdb + qac);
+	m[2][1] = (float)(-qda + qbc);
+	m[2][2] = (float)(1.0 - qaa - qbb);
+	m[2][3] = 0.0f;
+
+	m[3][0] = m[3][1] = m[3][2] = 0.0f;
+	m[3][3] = 1.0f;
+}
+
+void mat3_to_quat(float q[4], float wmat[][3])
 {
 	double tr, s;
 	float mat[3][3];
 
 	/* work on a copy */
 	copy_m3_m3(mat, wmat);
-	normalize_m3(mat);  /* this is needed AND a 'normalize_qt' in the end */
-	
-	tr= 0.25* (double)(1.0f+mat[0][0]+mat[1][1]+mat[2][2]);
-	
-	if(tr>(double)FLT_EPSILON) {
-		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);
+	normalize_m3(mat); /* this is needed AND a 'normalize_qt' in the end */
+
+	tr = 0.25 * (double)(1.0f + mat[0][0] + mat[1][1] + mat[2][2]);
+
+	if (tr > (double)FLT_EPSILON) {
+		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);
 	}
 	else {
-		if(mat[0][0] > mat[1][1] && mat[0][0] > mat[2][2]) {
-			s= 2.0f*sqrtf(1.0f + mat[0][0] - mat[1][1] - mat[2][2]);
-			q[1]= (float)(0.25*s);
-
-			s= 1.0/s;
-			q[0]= (float)((double)(mat[2][1] - mat[1][2])*s);
-			q[2]= (float)((double)(mat[1][0] + mat[0][1])*s);
-			q[3]= (float)((double)(mat[2][0] + mat[0][2])*s);
+		if (mat[0][0] > mat[1][1] && mat[0][0] > mat[2][2]) {
+			s = 2.0f * sqrtf(1.0f + mat[0][0] - mat[1][1] - mat[2][2]);
+			q[1] = (float)(0.25 * s);
+
+			s = 1.0 / s;
+			q[0] = (float)((double)(mat[2][1] - mat[1][2]) * s);
+			q[2] = (float)((double)(mat[1][0] + mat[0][1]) * s);
+			q[3] = (float)((double)(mat[2][0] + mat[0][2]) * s);
 		}
-		else if(mat[1][1] > mat[2][2]) {
-			s= 2.0f*sqrtf(1.0f + mat[1][1] - mat[0][0] - mat[2][2]);
-			q[2]= (float)(0.25*s);
-
-			s= 1.0/s;
-			q[0]= (float)((double)(mat[2][0] - mat[0][2])*s);
-			q[1]= (float)((double)(mat[1][0] + mat[0][1])*s);
-			q[3]= (float)((double)(mat[2][1] + mat[1][2])*s);
+		else if (mat[1][1] > mat[2][2]) {
+			s = 2.0f * sqrtf(1.0f + mat[1][1] - mat[0][0] - mat[2][2]);
+			q[2] = (float)(0.25 * s);
+
+			s = 1.0 / s;
+			q[0] = (float)((double)(mat[2][0] - mat[0][2]) * s);
+			q[1] = (float)((double)(mat[1][0] + mat[0][1]) * s);
+			q[3] = (float)((double)(mat[2][1] + mat[1][2]) * s);
 		}
 		else {
-			s= 2.0f*sqrtf(1.0f + mat[2][2] - mat[0][0] - mat[1][1]);
-			q[3]= (float)(0.25*s);
+			s = 2.0f * sqrtf(1.0f + mat[2][2] - mat[0][0] - mat[1][1]);
+			q[3] = (float)(0.25 * s);
 
-			s= 1.0/s;
-			q[0]= (float)((double)(mat[1][0] - mat[0][1])*s);
-			q[1]= (float)((double)(mat[2][0] + mat[0][2])*s);
-			q[2]= (float)((double)(mat[2][1] + mat[1][2])*s);
+			s = 1.0 / s;
+			q[0] = (float)((double)(mat[1][0] - mat[0][1]) * s);
+			q[1] = (float)((double)(mat[2][0] + mat[0][2]) * s);
+			q[2] = (float)((double)(mat[2][1] + mat[1][2]) * s);
 		}
 	}
 
 	normalize_qt(q);
 }
 
-void mat4_to_quat(float *q, float m[][4])
+void mat4_to_quat(float q[4], float m[][4])
 {
 	float mat[3][3];
-	
+
 	copy_m3_m4(mat, m);
-	mat3_to_quat(q,mat);
+	mat3_to_quat(q, mat);
 }
 
 void mat3_to_quat_is_ok(float q[4], float wmat[3][3])
@@ -317,54 +315,53 @@ void mat3_to_quat_is_ok(float q[4], float wmat[3][3])
 	/* work on a copy */
 	copy_m3_m3(mat, wmat);
 	normalize_m3(mat);
-	
+
 	/* rotate z-axis of matrix to z-axis */
 
-	nor[0] = mat[2][1];		/* cross product with (0,0,1) */
-	nor[1] =  -mat[2][0];
+	nor[0] = mat[2][1]; /* cross product with (0,0,1) */
+	nor[1] = -mat[2][0];
 	nor[2] = 0.0;
 	normalize_v3(nor);
-	
-	co= mat[2][2];
-	angle= 0.5f*saacos(co);
-	
-	co= (float)cos(angle);
-	si= (float)sin(angle);
-	q1[0]= co;
-	q1[1]= -nor[0]*si;		/* negative here, but why? */
-	q1[2]= -nor[1]*si;
-	q1[3]= -nor[2]*si;
+
+	co = mat[2][2];
+	angle = 0.5f * saacos(co);
+
+	co = (float)cos(angle);
+	si = (float)sin(angle);
+	q1[0] = co;
+	q1[1] = -nor[0] * si; /* negative here, but why? */
+	q1[2] = -nor[1] * si;
+	q1[3] = -nor[2] * si;
 
 	/* rotate back x-axis from mat, using inverse q1 */
-	quat_to_mat3_no_error( matr,q1);
+	quat_to_mat3_no_error(matr, q1);
 	invert_m3_m3(matn, matr);
 	mul_m3_v3(matn, mat[0]);
-	
+
 	/* and align x-axes */
-	angle= (float)(0.5*atan2(mat[0][1], mat[0][0]));
-	
-	co= (float)cos(angle);
-	si= (float)sin(angle);
-	q2[0]= co;
-	q2[1]= 0.0f;
-	q2[2]= 0.0f;
-	q2[3]= si;
-	
+	angle = (float)(0.5 * atan2(mat[0][1], mat[0][0]));
+
+	co = (float)cos(angle);
+	si = (float)sin(angle);
+	q2[0] = co;
+	q2[1] = 0.0f;
+	q2[2] = 0.0f;
+	q2[3] = si;
+
 	mul_qt_qtqt(q, q1, q2);
 }
 
-
-float normalize_qt(float *q)
+float normalize_qt(float q[4])
 {
 	float len;
-	
-	len= (float)sqrt(dot_qtqt(q, q));
-	if(len!=0.0f) {
-		mul_qt_fl(q, 1.0f/len);
+
+	len = (float)sqrt(dot_qtqt(q, q));
+	if (len != 0.0f) {
+		mul_qt_fl(q, 1.0f / len);
 	}
 	else {
-		q[1]= 1.0f;
-		q[0]= q[2]= q[3]= 0.0f;			
+		q[1] = 1.0f;
+		q[0] = q[2] = q[3] = 0.0f;
 	}
 
 	return len;
@@ -377,19 +374,19 @@ float normalize_qt_qt(float r[4], const float q[4])
 }
 
 /* note: expects vectors to be normalized */
-void rotation_between_vecs_to_quat(float *q, const float v1[3], const float v2[3])
+void rotation_between_vecs_to_quat(float q[4], const float v1[3], const float v2[3])
 {
 	float axis[3];
 	float angle;
-	
+
 	cross_v3_v3v3(axis, v1, v2);
-	
+
 	angle = angle_normalized_v3v3(v1, v2);
-	
+
 	axis_angle_to_quat(q, axis, angle);
 }
 
-void rotation_between_quats_to_quat(float *q, const float q1[4], const float q2[4])
+void rotation_between_quats_to_quat(float q[4], const float q1[4], const float q2[4])
 {
 	float tquat[4];
 	double dot = 0.0f;
@@ -399,147 +396,151 @@ void rotation_between_quats_to_quat(float *q, const float q1[4], const float q2[
 	conjugate_qt(tquat);
 	dot = 1.0f / dot_qtqt(tquat, tquat);
 
-	for(x = 0; x < 4; x++)
+	for (x = 0; x < 4; x++)
 		tquat[x] *= dot;
 
 	mul_qt_qtqt(q, tquat, q2);
 }
 
-
 void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag)
 {
 	float q2[4], nor[3], *fp, mat[3][3], angle, si, co, x2, y2, z2, len1;
-	
+
 	assert(axis >= 0 && axis <= 5);
 	assert(upflag >= 0 && upflag <= 2);
-	
+
 	/* first rotate to axis */
-	if(axis>2) {	
-		x2= vec[0] ; y2= vec[1] ; z2= vec[2];
-		axis-= 3;
+	if (axis > 2) {
+		x2 = vec[0];
+		y2 = vec[1];
+		z2 = vec[2];
+		axis -= 3;
 	}
 	else {
-		x2= -vec[0] ; y2= -vec[1] ; z2= -vec[2];
+		x2 = -vec[0];
+		y2 = -vec[1];
+		z2 = -vec[2];
 	}
-	
-	q[0]=1.0; 
-	q[1]=q[2]=q[3]= 0.0;
 
-	len1= (float)sqrt(x2*x2+y2*y2+z2*z2);
-	if(len1 == 0.0f) return;
+	q[0] = 1.0;
+	q[1] = q[2] = q[3] = 0.0;
+
+	len1 = (float)sqrt(x2 * x2 + y2 * y2 + z2 * z2);
+	if (len1 == 0.0f) return;
 
 	/* nasty! I need a good routine for this...
 	 * problem is a rotation of an Y axis to the negative Y-axis for example.
 	 */
 
-	if(axis==0) {	/* x-axis */
-		nor[0]= 0.0;
-		nor[1]= -z2;
-		nor[2]= y2;
+	if (axis == 0) { /* x-axis */
+		nor[0] = 0.0;
+		nor[1] = -z2;
+		nor[2] = y2;
 
-		if(fabs(y2)+fabs(z2)<0.0001)
-			nor[1]= 1.0;
+		if (fabs(y2) + fabs(z2) < 0.0001)
+			nor[1] = 1.0;
 
-		co= x2;
+		co = x2;
 	}
-	else if(axis==1) {	/* y-axis */
-		nor[0]= z2;
-		nor[1]= 0.0;
-		nor[2]= -x2;
-		
-		if(fabs(x2)+fabs(z2)<0.0001)
-			nor[2]= 1.0;
-		
-		co= y2;
+	else if (axis == 1) { /* y-axis */
+		nor[0] = z2;
+		nor[1] = 0.0;
+		nor[2] = -x2;
+
+		if (fabs(x2) + fabs(z2) < 0.0001)
+			nor[2] = 1.0;
+
+		co = y2;
 	}
-	else {			/* z-axis */
-		nor[0]= -y2;
-		nor[1]= x2;
-		nor[2]= 0.0;
+	else { /* z-axis */
+		nor[0] = -y2;
+		nor[1] = x2;
+		nor[2] = 0.0;
 
-		if(fabs(x2)+fabs(y2)<0.0001)
-			nor[0]= 1.0;
+		if (fabs(x2) + fabs(y2) < 0.0001)
+			nor[0] = 1.0;
 
-		co= z2;
+		co = z2;
 	}
-	co/= len1;
+	co /= len1;
 
 	normalize_v3(nor);
-	
-	angle= 0.5f*saacos(co);
-	si= (float)sin(angle);
-	q[0]= (float)cos(angle);
-	q[1]= nor[0]*si;
-	q[2]= nor[1]*si;
-	q[3]= nor[2]*si;
-	
-	if(axis!=upflag) {
-		quat_to_mat3(mat,q);
-
-		fp= mat[2];
-		if(axis==0) {
-			if(upflag==1) angle= (float)(0.5*atan2(fp[2], fp[1]));
-			else angle= (float)(-0.5*atan2(fp[1], fp[2]));
+
+	angle = 0.5f * saacos(co);
+	si = (float)sin(angle);
+	q[0] = (float)cos(angle);
+	q[1] = nor[0] * si;
+	q[2] = nor[1] * si;
+	q[3] = nor[2] * si;
+
+	if (axis != upflag) {
+		quat_to_mat3(mat, q);
+
+		fp = mat[2];
+		if (axis == 0) {
+			if (upflag == 1) angle = (float)(0.5 * atan2(fp[2], fp[1]));
+			else angle = (float)(-0.5 * atan2(fp[1], fp[2]));
 		}
-		else if(axis==1) {
-			if(upflag==0) angle= (float)(-0.5*atan2(fp[2], fp[0]));
-			else angle= (float)(0.5*atan2(fp[0], fp[2]));
+		else if (axis == 1) {
+			if (upflag == 0) angle = (float)(-0.5 * atan2(fp[2], fp[0]));
+			else angle = (float)(0.5 * atan2(fp[0], fp[2]));
 		}
 		else {
-			if(upflag==0) angle= (float)(0.5*atan2(-fp[1], -fp[0]));
-			else angle= (float)(-0.5*atan2(-fp[0], -fp[1]));
+			if (upflag == 0) angle = (float)(0.5 * atan2(-fp[1], -fp[0]));
+			else angle = (float)(-0.5 * atan2(-fp[0], -fp[1]));
 		}
-				
-		co= cosf(angle);
-		si= sinf(angle)/len1;
-		q2[0]= co;
-		q2[1]= x2*si;
-		q2[2]= y2*si;
-		q2[3]= z2*si;
-			
-		mul_qt_qtqt(q,q2,q);
+
+		co = cosf(angle);
+		si = sinf(angle) / len1;
+		q2[0] = co;
+		q2[1] = x2 * si;
+		q2[2] = y2 * si;
+		q2[3] = z2 * si;
+
+		mul_qt_qtqt(q, q2, q);
 	}
 }
 
 #if 0
+
 /* A & M Watt, Advanced animation and rendering techniques, 1992 ACM press */
-void QuatInterpolW(float *result, float *quat1, float *quat2, float t)
+void QuatInterpolW(float *result, float quat1[4], float quat2[4], float t)
 {
 	float omega, cosom, sinom, sc1, sc2;
 
-	cosom = quat1[0]*quat2[0] + quat1[1]*quat2[1] + quat1[2]*quat2[2] + quat1[3]*quat2[3] ;
-	
+	cosom = quat1[0] * quat2[0] + quat1[1] * quat2[1] + quat1[2] * quat2[2] + quat1[3] * quat2[3];
+
 	/* rotate around shortest angle */
 	if ((1.0f + cosom) > 0.0001f) {
-		
+
 		if ((1.0f - cosom) > 0.0001f) {
 			omega = (float)acos(cosom);
 			sinom = (float)sin(omega);
 			sc1 = (float)sin((1.0 - t) * omega) / sinom;
 			sc2 = (float)sin(t * omega) / sinom;
-		} 
+		}
 		else {
 			sc1 = 1.0f - t;
 			sc2 = t;
 		}
-		result[0] = sc1*quat1[0] + sc2*quat2[0];
-		result[1] = sc1*quat1[1] + sc2*quat2[1];
-		result[2] = sc1*quat1[2] + sc2*quat2[2];
-		result[3] = sc1*quat1[3] + sc2*quat2[3];
-	} 
+		result[0] = sc1 * quat1[0] + sc2 * quat2[0];
+		result[1] = sc1 * quat1[1] + sc2 * quat2[1];
+		result[2] = sc1 * quat1[2] + sc2 * quat2[2];
+		result[3] = sc1 * quat1[3] + sc2 * quat2[3];
+	}
 	else {
 		result[0] = quat2[3];
 		result[1] = -quat2[2];
 		result[2] = quat2[1];
 		result[3] = -quat2[0];
-		
-		sc1 = (float)sin((1.0 - t)*M_PI_2);
-		sc2 = (float)sin(t*M_PI_2);
-		
-		result[0] = sc1*quat1[0] + sc2*result[0];
-		result[1] = sc1*quat1[1] + sc2*result[1];
-		result[2] = sc1*quat1[2] + sc2*result[2];
-		result[3] = sc1*quat1[3] + sc2*result[3];
+
+		sc1 = (float)sin((1.0 - t) * M_PI_2);
+		sc2 = (float)sin(t * M_PI_2);
+
+		result[0] = sc1 * quat1[0] + sc2 * result[0];
+		result[1] = sc1 * quat1[1] + sc2 * result[1];
+		result[2] = sc1 * quat1[2] + sc2 * result[2];
+		result[3] = sc1 * quat1[3] + sc2 * result[3];
 	}
 }
 #endif
@@ -548,33 +549,34 @@ void interp_qt_qtqt(float result[4], const float quat1[4], const float quat2[4],
 {
 	float quat[4], omega, cosom, sinom, sc1, sc2;
 
-	cosom = quat1[0]*quat2[0] + quat1[1]*quat2[1] + quat1[2]*quat2[2] + quat1[3]*quat2[3] ;
-	
+	cosom = quat1[0] * quat2[0] + quat1[1] * quat2[1] + quat1[2] * quat2[2] + quat1[3] * quat2[3];
+
 	/* rotate around shortest angle */
 	if (cosom < 0.0f) {
 		cosom = -cosom;
-		quat[0]= -quat1[0];
-		quat[1]= -quat1[1];
-		quat[2]= -quat1[2];
-		quat[3]= -quat1[3];
-	} 
+		quat[0] = -quat1[0];
+		quat[1] = -quat1[1];
+		quat[2] = -quat1[2];
+		quat[3] = -quat1[3];
+	}
 	else {
-		quat[0]= quat1[0];
-		quat[1]= quat1[1];
-		quat[2]= quat1[2];
-		quat[3]= quat1[3];
+		quat[0] = quat1[0];
+		quat[1] = quat1[1];
+		quat[2] = quat1[2];
+		quat[3] = quat1[3];
 	}
-	
+
 	if ((1.0f - cosom) > 0.0001f) {
 		omega = (float)acos(cosom);
 		sinom = (float)sin(omega);
 		sc1 = (float)sin((1 - t) * omega) / sinom;
 		sc2 = (float)sin(t * omega) / sinom;
-	} else {
-		sc1= 1.0f - t;
-		sc2= t;
 	}
-	
+	else {
+		sc1 = 1.0f - t;
+		sc2 = t;
+	}
+
 	result[0] = sc1 * quat[0] + sc2 * quat2[0];
 	result[1] = sc1 * quat[1] + sc2 * quat2[1];
 	result[2] = sc1 * quat[2] + sc2 * quat2[2];
@@ -583,57 +585,57 @@ void interp_qt_qtqt(float result[4], const float quat1[4], const float quat2[4],
 
 void add_qt_qtqt(float result[4], const float quat1[4], const float quat2[4], const float t)
 {
-	result[0]= quat1[0] + t*quat2[0];
-	result[1]= quat1[1] + t*quat2[1];
-	result[2]= quat1[2] + t*quat2[2];
-	result[3]= quat1[3] + t*quat2[3];
+	result[0] = quat1[0] + t * quat2[0];
+	result[1] = quat1[1] + t * quat2[1];
+	result[2] = quat1[2] + t * quat2[2];
+	result[3] = quat1[3] + t * quat2[3];
 }
 
 void tri_to_quat(float quat[4], const float v1[3], const float v2[3], const float v3[3])
 {
 	/* imaginary x-axis, y-axis triangle is being rotated */
 	float vec[3], q1[4], q2[4], n[3], si, co, angle, mat[3][3], imat[3][3];
-	
+
 	/* move z-axis to face-normal */
-	normal_tri_v3(vec,v1, v2, v3);
+	normal_tri_v3(vec, v1, v2, v3);
 
-	n[0]= vec[1];
-	n[1]= -vec[0];
-	n[2]= 0.0f;
+	n[0] = vec[1];
+	n[1] = -vec[0];
+	n[2] = 0.0f;
 	normalize_v3(n);
-	
-	if(n[0]==0.0f && n[1]==0.0f) n[0]= 1.0f;
-	
-	angle= -0.5f*(float)saacos(vec[2]);
-	co= (float)cos(angle);
-	si= (float)sin(angle);
-	q1[0]= co;
-	q1[1]= n[0]*si;
-	q1[2]= n[1]*si;
-	q1[3]= 0.0f;
-	
+
+	if (n[0] == 0.0f && n[1] == 0.0f) n[0] = 1.0f;
+
+	angle = -0.5f * (float)saacos(vec[2]);
+	co = (float)cos(angle);
+	si = (float)sin(angle);
+	q1[0] = co;
+	q1[1] = n[0] * si;
+	q1[2] = n[1] * si;
+	q1[3] = 0.0f;
+
 	/* rotate back line v1-v2 */
-	quat_to_mat3(mat,q1);
+	quat_to_mat3(mat, q1);
 	invert_m3_m3(imat, mat);
 	sub_v3_v3v3(vec, v2, v1);
 	mul_m3_v3(imat, vec);
 
 	/* what angle has this line with x-axis? */
-	vec[2]= 0.0f;
+	vec[2] = 0.0f;
 	normalize_v3(vec);
 
-	angle= (float)(0.5*atan2(vec[1], vec[0]));
-	co= (float)cos(angle);
-	si= (float)sin(angle);
-	q2[0]= co;
-	q2[1]= 0.0f;
-	q2[2]= 0.0f;
-	q2[3]= si;
+	angle = (float)(0.5 * atan2(vec[1], vec[0]));
+	co = (float)cos(angle);
+	si = (float)sin(angle);
+	q2[0] = co;
+	q2[1] = 0.0f;
+	q2[2] = 0.0f;
+	q2[3] = si;
 
 	mul_qt_qtqt(quat, q1, q2);
 }
 
-void print_qt(const char *str,  const float q[4])
+void print_qt(const char *str, const float q[4])
 {
 	printf("%s: %.3f %.3f %.3f %.3f\n", str, q[0], q[1], q[2], q[3]);
 }
@@ -646,7 +648,7 @@ void axis_angle_to_quat(float q[4], const float axis[3], float angle)
 	float nor[3];
 	float si;
 
-	if(normalize_v3_v3(nor, axis) == 0.0f) {
+	if (normalize_v3_v3(nor, axis) == 0.0f) {
 		unit_qt(q);
 		return;
 	}
@@ -656,7 +658,7 @@ void axis_angle_to_quat(float q[4], const float axis[3], float angle)
 	q[0] = (float)cos(angle);
 	q[1] = nor[0] * si;
 	q[2] = nor[1] * si;
-	q[3] = nor[2] * si;	
+	q[3] = nor[2] * si;
 }
 
 /* Quaternions to Axis Angle */
@@ -665,67 +667,70 @@ void quat_to_axis_angle(float axis[3], float *angle, const float q[4])
 	float ha, si;
 
 #ifdef DEBUG
-	if(!((ha=dot_qtqt(q, q))==0.0f || (fabsf(ha-1.0f) < (float)QUAT_EPSILON))) {
+	if (!((ha = dot_qtqt(q, q)) == 0.0f || (fabsf(ha - 1.0f) < (float)QUAT_EPSILON))) {
 		fprintf(stderr, "Warning! quat_to_axis_angle() called with non-normalized: size %.8f *** report a bug ***\n", ha);
 	}
 #endif
 
 	/* calculate angle/2, and sin(angle/2) */
-	ha= (float)acos(q[0]);
-	si= (float)sin(ha);
-	
+	ha = (float)acos(q[0]);
+	si = (float)sin(ha);
+
 	/* from half-angle to angle */
-	*angle= ha * 2;
-	
+	*angle = ha * 2;
+
 	/* prevent division by zero for axis conversion */
 	if (fabs(si) < 0.0005)
-		si= 1.0f;
-	
-	axis[0]= q[1] / si;
-	axis[1]= q[2] / si;
-	axis[2]= q[3] / si;
+		si = 1.0f;
+
+	axis[0] = q[1] / si;
+	axis[1] = q[2] / si;
+	axis[2] = q[3] / si;
 }
 
 /* Axis Angle to Euler Rotation */
 void axis_angle_to_eulO(float eul[3], const short order, const float axis[3], const float angle)
 {
 	float q[4];
-	
+
 	/* use quaternions as intermediate representation for now... */
 	axis_angle_to_quat(q, axis, angle);
-	quat_to_eulO(eul, order,q);
+	quat_to_eulO(eul, order, q);
 }
 
 /* Euler Rotation to Axis Angle */
 void eulO_to_axis_angle(float axis[3], float *angle, const float eul[3], const short order)
 {
 	float q[4];
-	
+
 	/* use quaternions as intermediate representation for now... */
-	eulO_to_quat(q,eul, order);
-	quat_to_axis_angle(axis, angle,q);
+	eulO_to_quat(q, eul, order);
+	quat_to_axis_angle(axis, angle, q);
 }
 
-/* axis angle to 3x3 matrix - safer version (normalisation of axis performed) */
+/* axis angle to 3x3 matrix - safer version (normalization of axis performed)
+ *
+ * note: we may want a normalized and non normalized version of this function.
+ */
 void axis_angle_to_mat3(float mat[3][3], const float axis[3], const float angle)
 {
 	float nor[3], nsi[3], co, si, ico;
-	
-	/* normalise the axis first (to remove unwanted scaling) */
-	if(normalize_v3_v3(nor, axis) == 0.0f) {
+
+	/* normalize the axis first (to remove unwanted scaling) */
+	if (normalize_v3_v3(nor, axis) == 0.0f) {
 		unit_m3(mat);
 		return;
 	}
-	
+
 	/* now convert this to a 3x3 matrix */
-	co= (float)cos(angle);		
-	si= (float)sin(angle);
-	
-	ico= (1.0f - co);
-	nsi[0]= nor[0]*si;
-	nsi[1]= nor[1]*si;
-	nsi[2]= nor[2]*si;
-	
+	co = (float)cos(angle);
+	si = (float)sin(angle);
+
+	ico = (1.0f - co);
+	nsi[0] = nor[0] * si;
+	nsi[1] = nor[1] * si;
+	nsi[2] = nor[2] * si;
+
 	mat[0][0] = ((nor[0] * nor[0]) * ico) + co;
 	mat[0][1] = ((nor[0] * nor[1]) * ico) + nsi[2];
 	mat[0][2] = ((nor[0] * nor[2]) * ico) - nsi[1];
@@ -737,119 +742,117 @@ void axis_angle_to_mat3(float mat[3][3], const float axis[3], const float angle)
 	mat[2][2] = ((nor[2] * nor[2]) * ico) + co;
 }
 
-/* axis angle to 4x4 matrix - safer version (normalisation of axis performed) */
+/* axis angle to 4x4 matrix - safer version (normalization of axis performed) */
 void axis_angle_to_mat4(float mat[4][4], const float axis[3], const float angle)
 {
 	float tmat[3][3];
-	
-	axis_angle_to_mat3(tmat,axis, angle);
+
+	axis_angle_to_mat3(tmat, axis, angle);
 	unit_m4(mat);
 	copy_m4_m3(mat, tmat);
 }
 
 /* 3x3 matrix to axis angle (see Mat4ToVecRot too) */
-void mat3_to_axis_angle(float axis[3], float *angle,float mat[3][3])
+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...
-	mat3_to_quat(q,mat);
-	quat_to_axis_angle(axis, angle,q);
+	mat3_to_quat(q, mat);
+	quat_to_axis_angle(axis, angle, q);
 }
 
 /* 4x4 matrix to axis angle (see Mat4ToVecRot too) */
-void mat4_to_axis_angle(float axis[3], float *angle,float mat[4][4])
+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...
-	mat4_to_quat(q,mat);
-	quat_to_axis_angle(axis, angle,q);
+	mat4_to_quat(q, mat);
+	quat_to_axis_angle(axis, angle, q);
 }
 
-
-
 void single_axis_angle_to_mat3(float mat[3][3], const char axis, const float angle)
 {
-	const float angle_cos= cosf(angle);
-	const float angle_sin= sinf(angle);
-
-	switch(axis) {
-	case 'X': /* rotation around X */
-		mat[0][0] =  1.0f;
-		mat[0][1] =  0.0f;
-		mat[0][2] =  0.0f;
-		mat[1][0] =  0.0f;
-		mat[1][1] =  angle_cos;
-		mat[1][2] =  angle_sin;
-		mat[2][0] =  0.0f;
-		mat[2][1] = -angle_sin;
-		mat[2][2] =  angle_cos;
-		break;
-	case 'Y': /* rotation around Y */
-		mat[0][0] =  angle_cos;
-		mat[0][1] =  0.0f;
-		mat[0][2] = -angle_sin;
-		mat[1][0] =  0.0f;
-		mat[1][1] =  1.0f;
-		mat[1][2] =  0.0f;
-		mat[2][0] =  angle_sin;
-		mat[2][1] =  0.0f;
-		mat[2][2] =  angle_cos;
-		break;
-	case 'Z': /* rotation around Z */
-		mat[0][0] =  angle_cos;
-		mat[0][1] =  angle_sin;
-		mat[0][2] =  0.0f;
-		mat[1][0] = -angle_sin;
-		mat[1][1] =  angle_cos;
-		mat[1][2] =  0.0f;
-		mat[2][0] =  0.0f;
-		mat[2][1] =  0.0f;
-		mat[2][2] =  1.0f;
-		break;
-	default:
-		assert(0);
+	const float angle_cos = cosf(angle);
+	const float angle_sin = sinf(angle);
+
+	switch (axis) {
+		case 'X': /* rotation around X */
+			mat[0][0] = 1.0f;
+			mat[0][1] = 0.0f;
+			mat[0][2] = 0.0f;
+			mat[1][0] = 0.0f;
+			mat[1][1] = angle_cos;
+			mat[1][2] = angle_sin;
+			mat[2][0] = 0.0f;
+			mat[2][1] = -angle_sin;
+			mat[2][2] = angle_cos;
+			break;
+		case 'Y': /* rotation around Y */
+			mat[0][0] = angle_cos;
+			mat[0][1] = 0.0f;
+			mat[0][2] = -angle_sin;
+			mat[1][0] = 0.0f;
+			mat[1][1] = 1.0f;
+			mat[1][2] = 0.0f;
+			mat[2][0] = angle_sin;
+			mat[2][1] = 0.0f;
+			mat[2][2] = angle_cos;
+			break;
+		case 'Z': /* rotation around Z */
+			mat[0][0] = angle_cos;
+			mat[0][1] = angle_sin;
+			mat[0][2] = 0.0f;
+			mat[1][0] = -angle_sin;
+			mat[1][1] = angle_cos;
+			mat[1][2] = 0.0f;
+			mat[2][0] = 0.0f;
+			mat[2][1] = 0.0f;
+			mat[2][2] = 1.0f;
+			break;
+		default:
+			assert(0);
 	}
 }
 
 /****************************** Vector/Rotation ******************************/
 /* TODO: the following calls should probably be depreceated sometime         */
 
-/* axis angle to 3x3 matrix */
+/* ODO, replace use of this function with axis_angle_to_mat3() */
 void vec_rot_to_mat3(float mat[][3], const float vec[3], const float phi)
 {
 	/* rotation of phi radials around vec */
 	float vx, vx2, vy, vy2, vz, vz2, co, si;
-	
-	vx= vec[0];
-	vy= vec[1];
-	vz= vec[2];
-	vx2= vx*vx;
-	vy2= vy*vy;
-	vz2= vz*vz;
-	co= (float)cos(phi);
-	si= (float)sin(phi);
-	
-	mat[0][0]= vx2+co*(1.0f-vx2);
-	mat[0][1]= vx*vy*(1.0f-co)+vz*si;
-	mat[0][2]= vz*vx*(1.0f-co)-vy*si;
-	mat[1][0]= vx*vy*(1.0f-co)-vz*si;
-	mat[1][1]= vy2+co*(1.0f-vy2);
-	mat[1][2]= vy*vz*(1.0f-co)+vx*si;
-	mat[2][0]= vz*vx*(1.0f-co)+vy*si;
-	mat[2][1]= vy*vz*(1.0f-co)-vx*si;
-	mat[2][2]= vz2+co*(1.0f-vz2);
+
+	vx = vec[0];
+	vy = vec[1];
+	vz = vec[2];
+	vx2 = vx * vx;
+	vy2 = vy * vy;
+	vz2 = vz * vz;
+	co = (float)cos(phi);
+	si = (float)sin(phi);
+
+	mat[0][0] = vx2 + co * (1.0f - vx2);
+	mat[0][1] = vx * vy * (1.0f - co) + vz * si;
+	mat[0][2] = vz * vx * (1.0f - co) - vy * si;
+	mat[1][0] = vx * vy * (1.0f - co) - vz * si;
+	mat[1][1] = vy2 + co * (1.0f - vy2);
+	mat[1][2] = vy * vz * (1.0f - co) + vx * si;
+	mat[2][0] = vz * vx * (1.0f - co) + vy * si;
+	mat[2][1] = vy * vz * (1.0f - co) - vx * si;
+	mat[2][2] = vz2 + co * (1.0f - vz2);
 }
 
 /* axis angle to 4x4 matrix */
 void vec_rot_to_mat4(float mat[][4], const float vec[3], const float phi)
 {
 	float tmat[3][3];
-	
-	vec_rot_to_mat3(tmat,vec, phi);
+
+	vec_rot_to_mat3(tmat, vec, phi);
 	unit_m4(mat);
 	copy_m4_m3(mat, tmat);
 }
@@ -860,16 +863,16 @@ void vec_rot_to_quat(float *quat, const float vec[3], const float phi)
 	/* rotation of phi radials around vec */
 	float si;
 
-	quat[1]= vec[0];
-	quat[2]= vec[1];
-	quat[3]= vec[2];
-	
-	if(normalize_v3(quat+1) == 0.0f) {
+	quat[1] = vec[0];
+	quat[2] = vec[1];
+	quat[3] = vec[2];
+
+	if (normalize_v3(quat + 1) == 0.0f) {
 		unit_qt(quat);
 	}
 	else {
-		quat[0]= (float)cos((double)phi/2.0);
-		si= (float)sin((double)phi/2.0);
+		quat[0] = (float)cos((double)phi / 2.0);
+		si = (float)sin((double)phi / 2.0);
 		quat[1] *= si;
 		quat[2] *= si;
 		quat[3] *= si;
@@ -882,27 +885,27 @@ void vec_rot_to_quat(float *quat, const float vec[3], const float phi)
 void eul_to_mat3(float mat[][3], const float eul[3])
 {
 	double ci, cj, ch, si, sj, sh, cc, cs, sc, ss;
-	
-	ci = cos(eul[0]); 
-	cj = cos(eul[1]); 
+
+	ci = cos(eul[0]);
+	cj = cos(eul[1]);
 	ch = cos(eul[2]);
-	si = sin(eul[0]); 
-	sj = sin(eul[1]); 
+	si = sin(eul[0]);
+	sj = sin(eul[1]);
 	sh = sin(eul[2]);
-	cc = ci*ch; 
-	cs = ci*sh; 
-	sc = si*ch; 
-	ss = si*sh;
+	cc = ci * ch;
+	cs = ci * sh;
+	sc = si * ch;
+	ss = si * sh;
 
-	mat[0][0] = (float)(cj*ch); 
-	mat[1][0] = (float)(sj*sc-cs); 
-	mat[2][0] = (float)(sj*cc+ss);
-	mat[0][1] = (float)(cj*sh); 
-	mat[1][1] = (float)(sj*ss+cc); 
-	mat[2][1] = (float)(sj*cs-sc);
-	mat[0][2] = (float)-sj;	 
-	mat[1][2] = (float)(cj*si);    
-	mat[2][2] = (float)(cj*ci);
+	mat[0][0] = (float)(cj * ch);
+	mat[1][0] = (float)(sj * sc - cs);
+	mat[2][0] = (float)(sj * cc + ss);
+	mat[0][1] = (float)(cj * sh);
+	mat[1][1] = (float)(sj * ss + cc);
+	mat[2][1] = (float)(sj * cs - sc);
+	mat[0][2] = (float)-sj;
+	mat[1][2] = (float)(cj * si);
+	mat[2][2] = (float)(cj * ci);
 
 }
 
@@ -910,74 +913,76 @@ void eul_to_mat3(float mat[][3], const float eul[3])
 void eul_to_mat4(float mat[][4], const float eul[3])
 {
 	double ci, cj, ch, si, sj, sh, cc, cs, sc, ss;
-	
-	ci = cos(eul[0]); 
-	cj = cos(eul[1]); 
+
+	ci = cos(eul[0]);
+	cj = cos(eul[1]);
 	ch = cos(eul[2]);
-	si = sin(eul[0]); 
-	sj = sin(eul[1]); 
+	si = sin(eul[0]);
+	sj = sin(eul[1]);
 	sh = sin(eul[2]);
-	cc = ci*ch; 
-	cs = ci*sh; 
-	sc = si*ch; 
-	ss = si*sh;
+	cc = ci * ch;
+	cs = ci * sh;
+	sc = si * ch;
+	ss = si * sh;
 
-	mat[0][0] = (float)(cj*ch); 
-	mat[1][0] = (float)(sj*sc-cs); 
-	mat[2][0] = (float)(sj*cc+ss);
-	mat[0][1] = (float)(cj*sh); 
-	mat[1][1] = (float)(sj*ss+cc); 
-	mat[2][1] = (float)(sj*cs-sc);
-	mat[0][2] = (float)-sj;	 
-	mat[1][2] = (float)(cj*si);    
-	mat[2][2] = (float)(cj*ci);
+	mat[0][0] = (float)(cj * ch);
+	mat[1][0] = (float)(sj * sc - cs);
+	mat[2][0] = (float)(sj * cc + ss);
+	mat[0][1] = (float)(cj * sh);
+	mat[1][1] = (float)(sj * ss + cc);
+	mat[2][1] = (float)(sj * cs - sc);
+	mat[0][2] = (float)-sj;
+	mat[1][2] = (float)(cj * si);
+	mat[2][2] = (float)(cj * ci);
 
 
-	mat[3][0]= mat[3][1]= mat[3][2]= mat[0][3]= mat[1][3]= mat[2][3]= 0.0f;
-	mat[3][3]= 1.0f;
+	mat[3][0] = mat[3][1] = mat[3][2] = mat[0][3] = mat[1][3] = mat[2][3] = 0.0f;
+	mat[3][3] = 1.0f;
 }
 
 /* returns two euler calculation methods, so we can pick the best */
+
 /* XYZ order */
 static void mat3_to_eul2(float tmat[][3], float eul1[3], float eul2[3])
 {
 	float cy, quat[4], mat[3][3];
-	
-	mat3_to_quat(quat,tmat);
-	quat_to_mat3(mat,quat);
+
+	mat3_to_quat(quat, tmat);
+	quat_to_mat3(mat, quat);
 	copy_m3_m3(mat, tmat);
 	normalize_m3(mat);
-	
-	cy = (float)sqrt(mat[0][0]*mat[0][0] + mat[0][1]*mat[0][1]);
-	
-	if (cy > 16.0f*FLT_EPSILON) {
-		
+
+	cy = (float)sqrt(mat[0][0] * mat[0][0] + mat[0][1] * mat[0][1]);
+
+	if (cy > 16.0f * FLT_EPSILON) {
+
 		eul1[0] = (float)atan2(mat[1][2], mat[2][2]);
 		eul1[1] = (float)atan2(-mat[0][2], cy);
 		eul1[2] = (float)atan2(mat[0][1], mat[0][0]);
-		
+
 		eul2[0] = (float)atan2(-mat[1][2], -mat[2][2]);
 		eul2[1] = (float)atan2(-mat[0][2], -cy);
 		eul2[2] = (float)atan2(-mat[0][1], -mat[0][0]);
-		
-	} else {
+
+	}
+	else {
 		eul1[0] = (float)atan2(-mat[2][1], mat[1][1]);
 		eul1[1] = (float)atan2(-mat[0][2], cy);
 		eul1[2] = 0.0f;
-		
+
 		copy_v3_v3(eul2, eul1);
 	}
 }
 
 /* XYZ order */
-void mat3_to_eul(float *eul,float tmat[][3])
+void mat3_to_eul(float *eul, float tmat[][3])
 {
 	float eul1[3], eul2[3];
-	
+
 	mat3_to_eul2(tmat, eul1, eul2);
-		
+
 	/* return best, which is just the one with lowest values it in */
-	if(fabs(eul1[0])+fabs(eul1[1])+fabs(eul1[2]) > fabs(eul2[0])+fabs(eul2[1])+fabs(eul2[2])) {
+	if (fabs(eul1[0]) + fabs(eul1[1]) + fabs(eul1[2]) > fabs(eul2[0]) + fabs(eul2[1]) + fabs(eul2[2])) {
 		copy_v3_v3(eul, eul2);
 	}
 	else {
@@ -986,13 +991,13 @@ void mat3_to_eul(float *eul,float tmat[][3])
 }
 
 /* XYZ order */
-void mat4_to_eul(float *eul,float tmat[][4])
+void mat4_to_eul(float *eul, float tmat[][4])
 {
 	float tempMat[3][3];
 
 	copy_m3_m4(tempMat, tmat);
 	normalize_m3(tempMat);
-	mat3_to_eul(eul,tempMat);
+	mat3_to_eul(eul, tempMat);
 }
 
 /* XYZ order */
@@ -1000,24 +1005,33 @@ void quat_to_eul(float *eul, const float quat[4])
 {
 	float mat[3][3];
 
-	quat_to_mat3(mat,quat);
-	mat3_to_eul(eul,mat);
+	quat_to_mat3(mat, quat);
+	mat3_to_eul(eul, mat);
 }
 
 /* XYZ order */
 void eul_to_quat(float *quat, const float eul[3])
 {
 	float ti, tj, th, ci, cj, ch, si, sj, sh, cc, cs, sc, ss;
- 
-	ti = eul[0]*0.5f; tj = eul[1]*0.5f; th = eul[2]*0.5f;
-	ci = (float)cos(ti);  cj = (float)cos(tj);  ch = (float)cos(th);
-	si = (float)sin(ti);  sj = (float)sin(tj);  sh = (float)sin(th);
-	cc = ci*ch; cs = ci*sh; sc = si*ch; ss = si*sh;
-	
-	quat[0] = cj*cc + sj*ss;
-	quat[1] = cj*sc - sj*cs;
-	quat[2] = cj*ss + sj*cc;
-	quat[3] = cj*cs - sj*sc;
+
+	ti = eul[0] * 0.5f;
+	tj = eul[1] * 0.5f;
+	th = eul[2] * 0.5f;
+	ci = cosf(ti);
+	cj = cosf(tj);
+	ch = cosf(th);
+	si = sinf(ti);
+	sj = sinf(tj);
+	sh = sinf(th);
+	cc = ci * ch;
+	cs = ci * sh;
+	sc = si * ch;
+	ss = si * sh;
+
+	quat[0] = cj * cc + sj * ss;
+	quat[1] = cj * sc - sj * cs;
+	quat[2] = cj * ss + sj * cc;
+	quat[3] = cj * cs - sj * sc;
 }
 
 /* XYZ order */
@@ -1027,130 +1041,147 @@ void rotate_eul(float *beul, const char axis, const float ang)
 
 	assert(axis >= 'X' && axis <= 'Z');
 
-	eul[0]= eul[1]= eul[2]= 0.0f;
-	if(axis=='X') eul[0]= ang;
-	else if(axis=='Y') eul[1]= ang;
-	else eul[2]= ang;
-	
-	eul_to_mat3(mat1,eul);
-	eul_to_mat3(mat2,beul);
-	
+	eul[0] = eul[1] = eul[2] = 0.0f;
+	if (axis == 'X') eul[0] = ang;
+	else if (axis == 'Y') eul[1] = ang;
+	else eul[2] = ang;
+
+	eul_to_mat3(mat1, eul);
+	eul_to_mat3(mat2, beul);
+
 	mul_m3_m3m3(totmat, mat2, mat1);
-	
-	mat3_to_eul(beul,totmat);
-	
+
+	mat3_to_eul(beul, totmat);
+
 }
 
 /* exported to transform.c */
+
 /* order independent! */
 void compatible_eul(float eul[3], const float oldrot[3])
 {
 	float dx, dy, dz;
-	
+
 	/* correct differences of about 360 degrees first */
-	dx= eul[0] - oldrot[0];
-	dy= eul[1] - oldrot[1];
-	dz= eul[2] - oldrot[2];
-	
-	while(fabs(dx) > 5.1) {
-		if(dx > 0.0f) eul[0] -= 2.0f*(float)M_PI; else eul[0]+= 2.0f*(float)M_PI;
-		dx= eul[0] - oldrot[0];
+	dx = eul[0] - oldrot[0];
+	dy = eul[1] - oldrot[1];
+	dz = eul[2] - oldrot[2];
+
+	while (fabs(dx) > 5.1) {
+		if (dx > 0.0f) eul[0] -= 2.0f * (float)M_PI;
+		else eul[0] += 2.0f * (float)M_PI;
+		dx = eul[0] - oldrot[0];
 	}
-	while(fabs(dy) > 5.1) {
-		if(dy > 0.0f) eul[1] -= 2.0f*(float)M_PI; else eul[1]+= 2.0f*(float)M_PI;
-		dy= eul[1] - oldrot[1];
+	while (fabs(dy) > 5.1) {
+		if (dy > 0.0f) eul[1] -= 2.0f * (float)M_PI;
+		else eul[1] += 2.0f * (float)M_PI;
+		dy = eul[1] - oldrot[1];
 	}
-	while(fabs(dz) > 5.1) {
-		if(dz > 0.0f) eul[2] -= 2.0f*(float)M_PI; else eul[2]+= 2.0f*(float)M_PI;
-		dz= eul[2] - oldrot[2];
+	while (fabs(dz) > 5.1) {
+		if (dz > 0.0f) eul[2] -= 2.0f * (float)M_PI;
+		else eul[2] += 2.0f * (float)M_PI;
+		dz = eul[2] - oldrot[2];
 	}
-	
-	/* is 1 of the axis rotations larger than 180 degrees and the other small? NO ELSE IF!! */	
-	if(fabs(dx) > 3.2 && fabs(dy)<1.6 && fabs(dz)<1.6) {
-		if(dx > 0.0f) eul[0] -= 2.0f*(float)M_PI; else eul[0]+= 2.0f*(float)M_PI;
+
+	/* is 1 of the axis rotations larger than 180 degrees and the other small? NO ELSE IF!! */
+	if (fabs(dx) > 3.2 && fabs(dy) < 1.6 && fabs(dz) < 1.6) {
+		if (dx > 0.0f) eul[0] -= 2.0f * (float)M_PI;
+		else eul[0] += 2.0f * (float)M_PI;
 	}
-	if(fabs(dy) > 3.2 && fabs(dz)<1.6 && fabs(dx)<1.6) {
-		if(dy > 0.0f) eul[1] -= 2.0f*(float)M_PI; else eul[1]+= 2.0f*(float)M_PI;
+	if (fabs(dy) > 3.2 && fabs(dz) < 1.6 && fabs(dx) < 1.6) {
+		if (dy > 0.0f) eul[1] -= 2.0f * (float)M_PI;
+		else eul[1] += 2.0f * (float)M_PI;
 	}
-	if(fabs(dz) > 3.2 && fabs(dx)<1.6 && fabs(dy)<1.6) {
-		if(dz > 0.0f) eul[2] -= 2.0f*(float)M_PI; else eul[2]+= 2.0f*(float)M_PI;
+	if (fabs(dz) > 3.2 && fabs(dx) < 1.6 && fabs(dy) < 1.6) {
+		if (dz > 0.0f) eul[2] -= 2.0f * (float)M_PI;
+		else eul[2] += 2.0f * (float)M_PI;
 	}
-	
+
 	/* the method below was there from ancient days... but why! probably because the code sucks :)
-		*/
-#if 0	
+	 */
+#if 0
 	/* calc again */
-	dx= eul[0] - oldrot[0];
-	dy= eul[1] - oldrot[1];
-	dz= eul[2] - oldrot[2];
-	
+	dx = eul[0] - oldrot[0];
+	dy = eul[1] - oldrot[1];
+	dz = eul[2] - oldrot[2];
+
 	/* special case, tested for x-z  */
-	
-	if((fabs(dx) > 3.1 && fabs(dz) > 1.5) || (fabs(dx) > 1.5 && fabs(dz) > 3.1)) {
-		if(dx > 0.0) eul[0] -= M_PI; else eul[0]+= M_PI;
-		if(eul[1] > 0.0) eul[1]= M_PI - eul[1]; else eul[1]= -M_PI - eul[1];
-		if(dz > 0.0) eul[2] -= M_PI; else eul[2]+= M_PI;
-		
+
+	if ((fabs(dx) > 3.1 && fabs(dz) > 1.5) || (fabs(dx) > 1.5 && fabs(dz) > 3.1)) {
+		if (dx > 0.0) eul[0] -= M_PI;
+		else eul[0] += M_PI;
+		if (eul[1] > 0.0) eul[1] = M_PI - eul[1];
+		else eul[1] = -M_PI - eul[1];
+		if (dz > 0.0) eul[2] -= M_PI;
+		else eul[2] += M_PI;
+
 	}
-	else if((fabs(dx) > 3.1 && fabs(dy) > 1.5) || (fabs(dx) > 1.5 && fabs(dy) > 3.1)) {
-		if(dx > 0.0) eul[0] -= M_PI; else eul[0]+= M_PI;
-		if(dy > 0.0) eul[1] -= M_PI; else eul[1]+= M_PI;
-		if(eul[2] > 0.0) eul[2]= M_PI - eul[2]; else eul[2]= -M_PI - eul[2];
+	else if ((fabs(dx) > 3.1 && fabs(dy) > 1.5) || (fabs(dx) > 1.5 && fabs(dy) > 3.1)) {
+		if (dx > 0.0) eul[0] -= M_PI;
+		else eul[0] += M_PI;
+		if (dy > 0.0) eul[1] -= M_PI;
+		else eul[1] += M_PI;
+		if (eul[2] > 0.0) eul[2] = M_PI - eul[2];
+		else eul[2] = -M_PI - eul[2];
 	}
-	else if((fabs(dy) > 3.1 && fabs(dz) > 1.5) || (fabs(dy) > 1.5 && fabs(dz) > 3.1)) {
-		if(eul[0] > 0.0) eul[0]= M_PI - eul[0]; else eul[0]= -M_PI - eul[0];
-		if(dy > 0.0) eul[1] -= M_PI; else eul[1]+= M_PI;
-		if(dz > 0.0) eul[2] -= M_PI; else eul[2]+= M_PI;
+	else if ((fabs(dy) > 3.1 && fabs(dz) > 1.5) || (fabs(dy) > 1.5 && fabs(dz) > 3.1)) {
+		if (eul[0] > 0.0) eul[0] = M_PI - eul[0];
+		else eul[0] = -M_PI - eul[0];
+		if (dy > 0.0) eul[1] -= M_PI;
+		else eul[1] += M_PI;
+		if (dz > 0.0) eul[2] -= M_PI;
+		else eul[2] += M_PI;
 	}
-#endif	
+#endif
 }
 
 /* uses 2 methods to retrieve eulers, and picks the closest */
+
 /* XYZ order */
 void mat3_to_compatible_eul(float eul[3], const float oldrot[3], float mat[][3])
 {
 	float eul1[3], eul2[3];
 	float d1, d2;
-	
+
 	mat3_to_eul2(mat, eul1, eul2);
-	
+
 	compatible_eul(eul1, oldrot);
 	compatible_eul(eul2, oldrot);
-	
-	d1= (float)fabs(eul1[0]-oldrot[0]) + (float)fabs(eul1[1]-oldrot[1]) + (float)fabs(eul1[2]-oldrot[2]);
-	d2= (float)fabs(eul2[0]-oldrot[0]) + (float)fabs(eul2[1]-oldrot[1]) + (float)fabs(eul2[2]-oldrot[2]);
-	
+
+	d1 = (float)fabs(eul1[0] - oldrot[0]) + (float)fabs(eul1[1] - oldrot[1]) + (float)fabs(eul1[2] - oldrot[2]);
+	d2 = (float)fabs(eul2[0] - oldrot[0]) + (float)fabs(eul2[1] - oldrot[1]) + (float)fabs(eul2[2] - oldrot[2]);
+
 	/* return best, which is just the one with lowest difference */
-	if(d1 > d2) {
+	if (d1 > d2) {
 		copy_v3_v3(eul, eul2);
 	}
 	else {
 		copy_v3_v3(eul, eul1);
 	}
-	
+
 }
 
 /************************** Arbitrary Order Eulers ***************************/
 
 /* Euler Rotation Order Code:
- * was adapted from  
-		  ANSI C code from the article
-		"Euler Angle Conversion"
-		by Ken Shoemake, shoemake at graphics.cis.upenn.edu
-		in "Graphics Gems IV", Academic Press, 1994
+ * was adapted from
+ *      ANSI C code from the article
+ *      "Euler Angle Conversion"
+ *      by Ken Shoemake, shoemake at graphics.cis.upenn.edu
+ *      in "Graphics Gems IV", Academic Press, 1994
  * for use in Blender
  */
 
 /* Type for rotation order info - see wiki for derivation details */
 typedef struct RotOrderInfo {
 	short axis[3];
-	short parity;	/* parity of axis permutation (even=0, odd=1) - 'n' in original code */
+	short parity; /* parity of axis permutation (even=0, odd=1) - 'n' in original code */
 } RotOrderInfo;
 
-/* Array of info for Rotation Order calculations 
+/* Array of info for Rotation Order calculations
  * WARNING: must be kept in same order as eEulerRotationOrders
  */
-static RotOrderInfo rotOrders[]= {
+static RotOrderInfo rotOrders[] = {
 	/* i, j, k, n */
 	{{0, 1, 2}, 0}, // XYZ
 	{{0, 2, 1}, 1}, // XZY
@@ -1160,114 +1191,136 @@ static RotOrderInfo rotOrders[]= {
 	{{2, 1, 0}, 1}  // ZYX
 };
 
-/* Get relevant pointer to rotation order set from the array 
- * NOTE: since we start at 1 for the values, but arrays index from 0, 
+/* Get relevant pointer to rotation order set from the array
+ * NOTE: since we start at 1 for the values, but arrays index from 0,
  *		 there is -1 factor involved in this process...
  */
-#define GET_ROTATIONORDER_INFO(order) (assert(order>=0 && order<=6), (order < 1) ? &rotOrders[0] : &rotOrders[(order)-1])
+#define GET_ROTATIONORDER_INFO(order) (assert(order >= 0 && order <= 6), (order < 1) ? &rotOrders[0] : &rotOrders[(order) - 1])
 
 /* Construct quaternion from Euler angles (in radians). */
 void eulO_to_quat(float q[4], const float e[3], const short order)
 {
-	RotOrderInfo *R= GET_ROTATIONORDER_INFO(order); 
-	short i=R->axis[0],  j=R->axis[1], 	k=R->axis[2];
+	RotOrderInfo *R = GET_ROTATIONORDER_INFO(order);
+	short i = R->axis[0], j = R->axis[1], k = R->axis[2];
 	double ti, tj, th, ci, cj, ch, si, sj, sh, cc, cs, sc, ss;
 	double a[3];
-	
+
 	ti = e[i] * 0.5f;
 	tj = e[j] * (R->parity ? -0.5f : 0.5f);
 	th = e[k] * 0.5f;
 
-	ci = cos(ti);  cj = cos(tj);  ch = cos(th);
-	si = sin(ti);  sj = sin(tj);  sh = sin(th);
-	
-	cc = ci*ch; cs = ci*sh; 
-	sc = si*ch; ss = si*sh;
-	
-	a[i] = cj*sc - sj*cs;
-	a[j] = cj*ss + sj*cc;
-	a[k] = cj*cs - sj*sc;
-	
-	q[0] = cj*cc + sj*ss;
+	ci = cos(ti);
+	cj = cos(tj);
+	ch = cos(th);
+	si = sin(ti);
+	sj = sin(tj);
+	sh = sin(th);
+
+	cc = ci * ch;
+	cs = ci * sh;
+	sc = si * ch;
+	ss = si * sh;
+
+	a[i] = cj * sc - sj * cs;
+	a[j] = cj * ss + sj * cc;
+	a[k] = cj * cs - sj * sc;
+
+	q[0] = cj * cc + sj * ss;
 	q[1] = a[0];
 	q[2] = a[1];
 	q[3] = a[2];
-	
-	if (R->parity) q[j+1] = -q[j+1];
+
+	if (R->parity) q[j + 1] = -q[j + 1];
 }
 
 /* Convert quaternion to Euler angles (in radians). */
 void quat_to_eulO(float e[3], short const order, const float q[4])
 {
 	float M[3][3];
-	
-	quat_to_mat3(M,q);
-	mat3_to_eulO(e, order,M);
+
+	quat_to_mat3(M, q);
+	mat3_to_eulO(e, order, M);
 }
 
 /* Construct 3x3 matrix from Euler angles (in radians). */
 void eulO_to_mat3(float M[3][3], const float e[3], const short order)
 {
-	RotOrderInfo *R= GET_ROTATIONORDER_INFO(order); 
-	short i=R->axis[0],  j=R->axis[1], 	k=R->axis[2];
+	RotOrderInfo *R = GET_ROTATIONORDER_INFO(order);
+	short i = R->axis[0], j = R->axis[1], k = R->axis[2];
 	double ti, tj, th, ci, cj, ch, si, sj, sh, cc, cs, sc, ss;
-	
+
 	if (R->parity) {
-		ti = -e[i];	  tj = -e[j];	th = -e[k];
+		ti = -e[i];
+		tj = -e[j];
+		th = -e[k];
 	}
 	else {
-		ti = e[i];	  tj = e[j];	th = e[k];
+		ti = e[i];
+		tj = e[j];
+		th = e[k];
 	}
-	
-	ci = cos(ti); cj = cos(tj); ch = cos(th);
-	si = sin(ti); sj = sin(tj); sh = sin(th);
-	
-	cc = ci*ch; cs = ci*sh; 
-	sc = si*ch; ss = si*sh;
-	
-	M[i][i] = cj*ch; M[j][i] = sj*sc-cs; M[k][i] = sj*cc+ss;
-	M[i][j] = cj*sh; M[j][j] = sj*ss+cc; M[k][j] = sj*cs-sc;
-	M[i][k] = -sj;	 M[j][k] = cj*si;	 M[k][k] = cj*ci;
+
+	ci = cos(ti);
+	cj = cos(tj);
+	ch = cos(th);
+	si = sin(ti);
+	sj = sin(tj);
+	sh = sin(th);
+
+	cc = ci * ch;
+	cs = ci * sh;
+	sc = si * ch;
+	ss = si * sh;
+
+	M[i][i] = cj * ch;
+	M[j][i] = sj * sc - cs;
+	M[k][i] = sj * cc + ss;
+	M[i][j] = cj * sh;
+	M[j][j] = sj * ss + cc;
+	M[k][j] = sj * cs - sc;
+	M[i][k] = -sj;
+	M[j][k] = cj * si;
+	M[k][k] = cj * ci;
 }
 
 /* returns two euler calculation methods, so we can pick the best */
 static void mat3_to_eulo2(float M[3][3], float *e1, float *e2, short order)
 {
-	RotOrderInfo *R= GET_ROTATIONORDER_INFO(order); 
-	short i=R->axis[0],  j=R->axis[1], 	k=R->axis[2];
+	RotOrderInfo *R = GET_ROTATIONORDER_INFO(order);
+	short i = R->axis[0], j = R->axis[1], k = R->axis[2];
 	float m[3][3];
 	double cy;
-	
+
 	/* process the matrix first */
 	copy_m3_m3(m, M);
 	normalize_m3(m);
-	
-	cy= sqrt(m[i][i]*m[i][i] + m[i][j]*m[i][j]);
-	
-	if (cy > 16.0*(double)FLT_EPSILON) {
+
+	cy = sqrt(m[i][i] * m[i][i] + m[i][j] * m[i][j]);
+
+	if (cy > 16.0 * (double)FLT_EPSILON) {
 		e1[i] = atan2(m[j][k], m[k][k]);
 		e1[j] = atan2(-m[i][k], cy);
 		e1[k] = atan2(m[i][j], m[i][i]);
-		
+
 		e2[i] = atan2(-m[j][k], -m[k][k]);
 		e2[j] = atan2(-m[i][k], -cy);
 		e2[k] = atan2(-m[i][j], -m[i][i]);
-	} 
+	}
 	else {
 		e1[i] = atan2(-m[k][j], m[j][j]);
 		e1[j] = atan2(-m[i][k], cy);
 		e1[k] = 0;
-		
+
 		copy_v3_v3(e2, e1);
 	}
-	
+
 	if (R->parity) {
-		e1[0] = -e1[0]; 
-		e1[1] = -e1[1]; 
+		e1[0] = -e1[0];
+		e1[1] = -e1[1];
 		e1[2] = -e1[2];
-		
-		e2[0] = -e2[0]; 
-		e2[1] = -e2[1]; 
+
+		e2[0] = -e2[0];
+		e2[1] = -e2[1];
 		e2[2] = -e2[2];
 	}
 }
@@ -1276,23 +1329,22 @@ static void mat3_to_eulo2(float M[3][3], float *e1, float *e2, short order)
 void eulO_to_mat4(float M[4][4], const float e[3], const short order)
 {
 	float m[3][3];
-	
+
 	/* for now, we'll just do this the slow way (i.e. copying matrices) */
 	normalize_m3(m);
-	eulO_to_mat3(m,e, order);
+	eulO_to_mat3(m, e, order);
 	copy_m4_m3(M, m);
 }
 
-
 /* Convert 3x3 matrix to Euler angles (in radians). */
-void mat3_to_eulO(float eul[3], const short order,float M[3][3])
+void mat3_to_eulO(float eul[3], const short order, float M[3][3])
 {
 	float eul1[3], eul2[3];
-	
+
 	mat3_to_eulo2(M, eul1, eul2, order);
-		
+
 	/* return best, which is just the one with lowest values it in */
-	if(fabs(eul1[0])+fabs(eul1[1])+fabs(eul1[2]) > fabs(eul2[0])+fabs(eul2[1])+fabs(eul2[2])) {
+	if (fabs(eul1[0]) + fabs(eul1[1]) + fabs(eul1[2]) > fabs(eul2[0]) + fabs(eul2[1]) + fabs(eul2[2])) {
 		copy_v3_v3(eul, eul2);
 	}
 	else {
@@ -1301,30 +1353,30 @@ void mat3_to_eulO(float eul[3], const short order,float M[3][3])
 }
 
 /* Convert 4x4 matrix to Euler angles (in radians). */
-void mat4_to_eulO(float e[3], const short order,float M[4][4])
+void mat4_to_eulO(float e[3], const short order, float M[4][4])
 {
 	float m[3][3];
-	
+
 	/* for now, we'll just do this the slow way (i.e. copying matrices) */
 	copy_m3_m4(m, M);
 	normalize_m3(m);
-	mat3_to_eulO(e, order,m);
+	mat3_to_eulO(e, order, m);
 }
 
 /* uses 2 methods to retrieve eulers, and picks the closest */
-void mat3_to_compatible_eulO(float eul[3], float oldrot[3], short order,float mat[3][3])
+void mat3_to_compatible_eulO(float eul[3], float oldrot[3], short order, float mat[3][3])
 {
 	float eul1[3], eul2[3];
 	float d1, d2;
-	
+
 	mat3_to_eulo2(mat, eul1, eul2, order);
-	
+
 	compatible_eul(eul1, oldrot);
 	compatible_eul(eul2, oldrot);
-	
-	d1= fabsf(eul1[0]-oldrot[0]) + fabsf(eul1[1]-oldrot[1]) + fabsf(eul1[2]-oldrot[2]);
-	d2= fabsf(eul2[0]-oldrot[0]) + fabsf(eul2[1]-oldrot[1]) + fabsf(eul2[2]-oldrot[2]);
-	
+
+	d1 = fabsf(eul1[0] - oldrot[0]) + fabsf(eul1[1] - oldrot[1]) + fabsf(eul1[2] - oldrot[2]);
+	d2 = fabsf(eul2[0] - oldrot[0]) + fabsf(eul2[1] - oldrot[1]) + fabsf(eul2[2] - oldrot[2]);
+
 	/* return best, which is just the one with lowest difference */
 	if (d1 > d2)
 		copy_v3_v3(eul, eul2);
@@ -1332,10 +1384,10 @@ void mat3_to_compatible_eulO(float eul[3], float oldrot[3], short order,float ma
 		copy_v3_v3(eul, eul1);
 }
 
-void mat4_to_compatible_eulO(float eul[3], float oldrot[3], short order,float M[4][4])
+void mat4_to_compatible_eulO(float eul[3], float oldrot[3], short order, float M[4][4])
 {
 	float m[3][3];
-	
+
 	/* for now, we'll just do this the slow way (i.e. copying matrices) */
 	copy_m3_m4(m, M);
 	normalize_m3(m);
@@ -1343,47 +1395,48 @@ void mat4_to_compatible_eulO(float eul[3], float oldrot[3], short order,float M[
 }
 /* rotate the given euler by the given angle on the specified axis */
 // NOTE: is this safe to do with different axis orders?
+
 void rotate_eulO(float beul[3], short order, char axis, float ang)
 {
 	float eul[3], mat1[3][3], mat2[3][3], totmat[3][3];
 
 	assert(axis >= 'X' && axis <= 'Z');
 
-	eul[0]= eul[1]= eul[2]= 0.0f;
-	if (axis=='X') 
-		eul[0]= ang;
-	else if (axis=='Y')
-		eul[1]= ang;
-	else 
-		eul[2]= ang;
-	
-	eulO_to_mat3(mat1,eul, order);
-	eulO_to_mat3(mat2,beul, order);
-	
+	eul[0] = eul[1] = eul[2] = 0.0f;
+	if (axis == 'X')
+		eul[0] = ang;
+	else if (axis == 'Y')
+		eul[1] = ang;
+	else
+		eul[2] = ang;
+
+	eulO_to_mat3(mat1, eul, order);
+	eulO_to_mat3(mat2, beul, order);
+
 	mul_m3_m3m3(totmat, mat2, mat1);
-	
-	mat3_to_eulO(beul, order,totmat);
+
+	mat3_to_eulO(beul, order, totmat);
 }
 
 /* the matrix is written to as 3 axis vectors */
 void eulO_to_gimbal_axis(float gmat[][3], const float eul[3], const short order)
 {
-	RotOrderInfo *R= GET_ROTATIONORDER_INFO(order);
+	RotOrderInfo *R = GET_ROTATIONORDER_INFO(order);
 
 	float mat[3][3];
 	float teul[3];
 
 	/* first axis is local */
-	eulO_to_mat3(mat,eul, order);
+	eulO_to_mat3(mat, eul, order);
 	copy_v3_v3(gmat[R->axis[0]], mat[R->axis[0]]);
-	
+
 	/* second axis is local minus first rotation */
 	copy_v3_v3(teul, eul);
 	teul[R->axis[0]] = 0;
-	eulO_to_mat3(mat,teul, order);
+	eulO_to_mat3(mat, teul, order);
 	copy_v3_v3(gmat[R->axis[1]], mat[R->axis[1]]);
-	
-	
+
+
 	/* Last axis is global */
 	gmat[R->axis[2]][0] = 0;
 	gmat[R->axis[2]][1] = 0;
@@ -1393,57 +1446,59 @@ void eulO_to_gimbal_axis(float gmat[][3], const float eul[3], const short order)
 
 /******************************* Dual Quaternions ****************************/
 
-/*
-   Conversion routines between (regular quaternion, translation) and
-   dual quaternion.
-
-   Version 1.0.0, February 7th, 2007
-
-   Copyright (C) 2006-2007 University of Dublin, Trinity College, All Rights 
-   Reserved
-
-   This software is provided 'as-is', without any express or implied
-   warranty.  In no event will the author(s) be held liable for any damages
-   arising from the use of this software.
-
-   Permission is granted to anyone to use this software for any purpose,
-   including commercial applications, and to alter it and redistribute it
-   freely, subject to the following restrictions:
-
-   1. The origin of this software must not be misrepresented; you must not
-	  claim that you wrote the original software. If you use this software
-	  in a product, an acknowledgment in the product documentation would be
-	  appreciated but is not required.
-   2. Altered source versions must be plainly marked as such, and must not be
-	  misrepresented as being the original software.
-   3. This notice may not be removed or altered from any source distribution.
-
-   Author: Ladislav Kavan, kavanl at cs.tcd.ie
-
-   Changes for Blender:
-   - renaming, style changes and optimizations
-   - added support for scaling
-*/
+/**
+ * Conversion routines between (regular quaternion, translation) and
+ * dual quaternion.
+ *
+ * Version 1.0.0, February 7th, 2007
+ *
+ * Copyright (C) 2006-2007 University of Dublin, Trinity College, All Rights
+ * Reserved
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty.  In no event will the author(s) be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ *    claim that you wrote the original software. If you use this software
+ *    in a product, an acknowledgment in the product documentation would be
+ *    appreciated but is not required.
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ *    misrepresented as being the original software.
+ * 3. This notice may not be removed or altered from any source distribution.
+ *
+ * \author Ladislav Kavan, kavanl at cs.tcd.ie
+ *
+ * Changes for Blender:
+ * - renaming, style changes and optimization's
+ * - added support for scaling
+ */
 
-void mat4_to_dquat(DualQuat *dq,float basemat[][4], float mat[][4])
+void mat4_to_dquat(DualQuat *dq, float basemat[][4], float mat[][4])
 {
 	float *t, *q, dscale[3], scale[3], basequat[4];
 	float baseRS[4][4], baseinv[4][4], baseR[4][4], baseRinv[4][4];
 	float R[4][4], S[4][4];
 
 	/* split scaling and rotation, there is probably a faster way to do
-	   this, it's done like this now to correctly get negative scaling */
+	 * this, it's done like this now to correctly get negative scaling */
 	mult_m4_m4m4(baseRS, mat, basemat);
-	mat4_to_size(scale,baseRS);
+	mat4_to_size(scale, baseRS);
 
 	copy_v3_v3(dscale, scale);
-	dscale[0] -= 1.0f; dscale[1] -= 1.0f; dscale[2] -= 1.0f;
+	dscale[0] -= 1.0f;
+	dscale[1] -= 1.0f;
+	dscale[2] -= 1.0f;
 
-	if((determinant_m4(mat) < 0.0f) || len_v3(dscale) > 1e-4f) {
+	if ((determinant_m4(mat) < 0.0f) || len_v3(dscale) > 1e-4f) {
 		/* extract R and S  */
 		float tmp[4][4];
 
-		 /* extra orthogonalize, to avoid flipping with stretched bones */
+		/* extra orthogonalize, to avoid flipping with stretched bones */
 		copy_m4_m4(tmp, baseRS);
 		orthogonalize_m4(tmp, 1);
 		mat4_to_quat(basequat, tmp);
@@ -1459,78 +1514,78 @@ void mat4_to_dquat(DualQuat *dq,float basemat[][4], float mat[][4])
 
 		/* set scaling part */
 		mul_serie_m4(dq->scale, basemat, S, baseinv, NULL, NULL, NULL, NULL, NULL);
-		dq->scale_weight= 1.0f;
+		dq->scale_weight = 1.0f;
 	}
 	else {
 		/* matrix does not contain scaling */
 		copy_m4_m4(R, mat);
-		dq->scale_weight= 0.0f;
+		dq->scale_weight = 0.0f;
 	}
 
 	/* non-dual part */
-	mat4_to_quat(dq->quat,R);
+	mat4_to_quat(dq->quat, R);
 
 	/* dual part */
-	t= R[3];
-	q= dq->quat;
-	dq->trans[0]= -0.5f*(t[0]*q[1] + t[1]*q[2] + t[2]*q[3]);
-	dq->trans[1]=  0.5f*(t[0]*q[0] + t[1]*q[3] - t[2]*q[2]);
-	dq->trans[2]=  0.5f*(-t[0]*q[3] + t[1]*q[0] + t[2]*q[1]);
-	dq->trans[3]=  0.5f*(t[0]*q[2] - t[1]*q[1] + t[2]*q[0]);
+	t = R[3];
+	q = dq->quat;
+	dq->trans[0] = -0.5f * (t[0] * q[1] + t[1] * q[2] + t[2] * q[3]);
+	dq->trans[1] = 0.5f * (t[0] * q[0] + t[1] * q[3] - t[2] * q[2]);
+	dq->trans[2] = 0.5f * (-t[0] * q[3] + t[1] * q[0] + t[2] * q[1]);
+	dq->trans[3] = 0.5f * (t[0] * q[2] - t[1] * q[1] + t[2] * q[0]);
 }
 
 void dquat_to_mat4(float mat[][4], DualQuat *dq)
 {
 	float len, *t, q0[4];
-	
+
 	/* regular quaternion */
 	copy_qt_qt(q0, dq->quat);
 
 	/* normalize */
-	len= (float)sqrt(dot_qtqt(q0, q0)); 
-	if(len != 0.0f)
-		mul_qt_fl(q0, 1.0f/len);
-	
+	len = (float)sqrt(dot_qtqt(q0, q0));
+	if (len != 0.0f)
+		mul_qt_fl(q0, 1.0f / len);
+
 	/* rotation */
-	quat_to_mat4(mat,q0);
+	quat_to_mat4(mat, q0);
 
 	/* translation */
-	t= dq->trans;
-	mat[3][0]= 2.0f*(-t[0]*q0[1] + t[1]*q0[0] - t[2]*q0[3] + t[3]*q0[2]);
-	mat[3][1]= 2.0f*(-t[0]*q0[2] + t[1]*q0[3] + t[2]*q0[0] - t[3]*q0[1]);
-	mat[3][2]= 2.0f*(-t[0]*q0[3] - t[1]*q0[2] + t[2]*q0[1] + t[3]*q0[0]);
+	t = dq->trans;
+	mat[3][0] = 2.0f * (-t[0] * q0[1] + t[1] * q0[0] - t[2] * q0[3] + t[3] * q0[2]);
+	mat[3][1] = 2.0f * (-t[0] * q0[2] + t[1] * q0[3] + t[2] * q0[0] - t[3] * q0[1]);
+	mat[3][2] = 2.0f * (-t[0] * q0[3] - t[1] * q0[2] + t[2] * q0[1] + t[3] * q0[0]);
 
 	/* note: this does not handle scaling */
-}	
+}
 
 void add_weighted_dq_dq(DualQuat *dqsum, DualQuat *dq, float weight)
 {
-	int flipped= 0;
+	int flipped = 0;
 
 	/* make sure we interpolate quats in the right direction */
 	if (dot_qtqt(dq->quat, dqsum->quat) < 0) {
-		flipped= 1;
-		weight= -weight;
+		flipped = 1;
+		weight = -weight;
 	}
 
 	/* interpolate rotation and translation */
-	dqsum->quat[0] += weight*dq->quat[0];
-	dqsum->quat[1] += weight*dq->quat[1];
-	dqsum->quat[2] += weight*dq->quat[2];
-	dqsum->quat[3] += weight*dq->quat[3];
+	dqsum->quat[0] += weight * dq->quat[0];
+	dqsum->quat[1] += weight * dq->quat[1];
+	dqsum->quat[2] += weight * dq->quat[2];
+	dqsum->quat[3] += weight * dq->quat[3];
 
-	dqsum->trans[0] += weight*dq->trans[0];
-	dqsum->trans[1] += weight*dq->trans[1];
-	dqsum->trans[2] += weight*dq->trans[2];
-	dqsum->trans[3] += weight*dq->trans[3];
+	dqsum->trans[0] += weight * dq->trans[0];
+	dqsum->trans[1] += weight * dq->trans[1];
+	dqsum->trans[2] += weight * dq->trans[2];
+	dqsum->trans[3] += weight * dq->trans[3];
 
 	/* interpolate scale - but only if needed */
 	if (dq->scale_weight) {
 		float wmat[4][4];
-		
-		if(flipped)	/* we don't want negative weights for scaling */
-			weight= -weight;
-		
+
+		if (flipped) /* we don't want negative weights for scaling */
+			weight = -weight;
+
 		copy_m4_m4(wmat, dq->scale);
 		mul_m4_fl(wmat, weight);
 		add_m4_m4m4(dqsum->scale, dqsum->scale, wmat);
@@ -1540,15 +1595,15 @@ void add_weighted_dq_dq(DualQuat *dqsum, DualQuat *dq, float weight)
 
 void normalize_dq(DualQuat *dq, float totweight)
 {
-	float scale= 1.0f/totweight;
+	float scale = 1.0f / totweight;
 
 	mul_qt_fl(dq->quat, scale);
 	mul_qt_fl(dq->trans, scale);
-	
-	if(dq->scale_weight) {
-		float addweight= totweight - dq->scale_weight;
-		
-		if(addweight) {
+
+	if (dq->scale_weight) {
+		float addweight = totweight - dq->scale_weight;
+
+		if (addweight) {
 			dq->scale[0][0] += addweight;
 			dq->scale[1][1] += addweight;
 			dq->scale[2][2] += addweight;
@@ -1556,51 +1611,51 @@ void normalize_dq(DualQuat *dq, float totweight)
 		}
 
 		mul_m4_fl(dq->scale, scale);
-		dq->scale_weight= 1.0f;
+		dq->scale_weight = 1.0f;
 	}
 }
 
-void mul_v3m3_dq(float *co, float mat[][3],DualQuat *dq)
-{	
+void mul_v3m3_dq(float *co, float mat[][3], DualQuat *dq)
+{
 	float M[3][3], t[3], scalemat[3][3], len2;
-	float w= dq->quat[0], x= dq->quat[1], y= dq->quat[2], z= dq->quat[3];
-	float t0= dq->trans[0], t1= dq->trans[1], t2= dq->trans[2], t3= dq->trans[3];
-	
+	float w = dq->quat[0], x = dq->quat[1], y = dq->quat[2], z = dq->quat[3];
+	float t0 = dq->trans[0], t1 = dq->trans[1], t2 = dq->trans[2], t3 = dq->trans[3];
+
 	/* rotation matrix */
-	M[0][0]= w*w + x*x - y*y - z*z;
-	M[1][0]= 2*(x*y - w*z);
-	M[2][0]= 2*(x*z + w*y);
-
-	M[0][1]= 2*(x*y + w*z);
-	M[1][1]= w*w + y*y - x*x - z*z;
-	M[2][1]= 2*(y*z - w*x); 
-
-	M[0][2]= 2*(x*z - w*y);
-	M[1][2]= 2*(y*z + w*x);
-	M[2][2]= w*w + z*z - x*x - y*y;
-	
-	len2= dot_qtqt(dq->quat, dq->quat);
-	if(len2 > 0.0f)
-		len2= 1.0f/len2;
-	
+	M[0][0] = w * w + x * x - y * y - z * z;
+	M[1][0] = 2 * (x * y - w * z);
+	M[2][0] = 2 * (x * z + w * y);
+
+	M[0][1] = 2 * (x * y + w * z);
+	M[1][1] = w * w + y * y - x * x - z * z;
+	M[2][1] = 2 * (y * z - w * x);
+
+	M[0][2] = 2 * (x * z - w * y);
+	M[1][2] = 2 * (y * z + w * x);
+	M[2][2] = w * w + z * z - x * x - y * y;
+
+	len2 = dot_qtqt(dq->quat, dq->quat);
+	if (len2 > 0.0f)
+		len2 = 1.0f / len2;
+
 	/* translation */
-	t[0]= 2*(-t0*x + w*t1 - t2*z + y*t3);
-	t[1]= 2*(-t0*y + t1*z - x*t3 + w*t2);
-	t[2]= 2*(-t0*z + x*t2 + w*t3 - t1*y);
+	t[0] = 2 * (-t0 * x + w * t1 - t2 * z + y * t3);
+	t[1] = 2 * (-t0 * y + t1 * z - x * t3 + w * t2);
+	t[2] = 2 * (-t0 * z + x * t2 + w * t3 - t1 * y);
 
 	/* apply scaling */
-	if(dq->scale_weight)
+	if (dq->scale_weight)
 		mul_m4_v3(dq->scale, co);
-	
+
 	/* apply rotation and translation */
 	mul_m3_v3(M, co);
-	co[0]= (co[0] + t[0])*len2;
-	co[1]= (co[1] + t[1])*len2;
-	co[2]= (co[2] + t[2])*len2;
+	co[0] = (co[0] + t[0]) * len2;
+	co[1] = (co[1] + t[1]) * len2;
+	co[2] = (co[2] + t[2]) * len2;
 
 	/* compute crazyspace correction mat */
-	if(mat) {
-		if(dq->scale_weight) {
+	if (mat) {
+		if (dq->scale_weight) {
 			copy_m3_m4(scalemat, dq->scale);
 			mul_m3_m3m3(mat, M, scalemat);
 		}
@@ -1617,85 +1672,85 @@ void copy_dq_dq(DualQuat *dq1, DualQuat *dq2)
 
 /* axis matches eTrackToAxis_Modes */
 void quat_apply_track(float quat[4], short axis, short upflag)
-{	
+{
 	/* rotations are hard coded to match vec_to_quat */
-	const float quat_track[][4]= {{0.70710676908493, 0.0, -0.70710676908493, 0.0},  /* pos-y90 */ 
-	                              {0.5, 0.5, 0.5, 0.5},  /* Quaternion((1,0,0), radians(90)) * Quaternion((0,1,0), radians(90)) */ 
-	                              {0.70710676908493, 0.0, 0.0, 0.70710676908493},  /* pos-z90 */ 
-	                              {0.70710676908493, 0.0, 0.70710676908493, 0.0}, /* neg-y90 */ 
-	                              {0.5, -0.5, -0.5, 0.5}, /* Quaternion((1,0,0), radians(-90)) * Quaternion((0,1,0), radians(-90)) */ 
-	                              {-3.0908619663705394e-08, 0.70710676908493, 0.70710676908493, 3.0908619663705394e-08}}; /* no rotation */
+	const float quat_track[][4] = {
+	    {0.70710676908493, 0.0, -0.70710676908493, 0.0}, /* pos-y90 */
+	    {0.5, 0.5, 0.5, 0.5}, /* Quaternion((1,0,0), radians(90)) * Quaternion((0,1,0), radians(90)) */
+	    {0.70710676908493, 0.0, 0.0, 0.70710676908493}, /* pos-z90 */
+	    {0.70710676908493, 0.0, 0.70710676908493, 0.0}, /* neg-y90 */
+	    {0.5, -0.5, -0.5, 0.5}, /* Quaternion((1,0,0), radians(-90)) * Quaternion((0,1,0), radians(-90)) */
+	    {-3.0908619663705394e-08, 0.70710676908493, 0.70710676908493, 3.0908619663705394e-08}}; /* no rotation */
 
 	assert(axis >= 0 && axis <= 5);
 	assert(upflag >= 0 && upflag <= 2);
-	
+
 	mul_qt_qtqt(quat, quat, quat_track[axis]);
 
-	if(axis>2)
-		axis= axis-3;
+	if (axis > 2)
+		axis = axis - 3;
 
 	/* there are 2 possible up-axis for each axis used, the 'quat_track' applies so the first
 	 * up axis is used X->Y, Y->X, Z->X, if this first up axis isn used then rotate 90d
 	 * the strange bit shift below just find the low axis {X:Y, Y:X, Z:X} */
-	if(upflag != (2-axis)>>1) {
-		float q[4]= {0.70710676908493, 0.0, 0.0, 0.0}; /* assign 90d rotation axis */
-		q[axis+1] = ((axis==1)) ? 0.70710676908493 : -0.70710676908493; /* flip non Y axis */
+	if (upflag != (2 - axis) >> 1) {
+		float q[4] = {0.70710676908493, 0.0, 0.0, 0.0}; /* assign 90d rotation axis */
+		q[axis + 1] = ((axis == 1)) ? 0.70710676908493 : -0.70710676908493; /* flip non Y axis */
 		mul_qt_qtqt(quat, quat, q);
 	}
 }
 
-
 void vec_apply_track(float vec[3], short axis)
 {
 	float tvec[3];
 
 	assert(axis >= 0 && axis <= 5);
-	
+
 	copy_v3_v3(tvec, vec);
 
-	switch(axis) {
-	case 0: /* pos-x */
-		/* 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]; */ 
-		break;
-	case 2: /* pos-z */
-		/* vec[0]= tvec[0]; */
-		/* vec[1]= tvec[1]; */
-		// vec[2]=  0.0; */
-		break;
-	case 3: /* neg-x */
-		/* 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[2]= tvec[0];
-		break;
-	case 5: /* neg-z */
-		vec[0]= -tvec[0];
-		vec[1]= -tvec[1];
-		/* vec[2]=  0.0; */
-		break;
+	switch (axis) {
+		case 0: /* pos-x */
+			/* 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]; */
+			break;
+		case 2: /* pos-z */
+			/* vec[0]= tvec[0]; */
+			/* vec[1]= tvec[1]; */
+			// vec[2]=  0.0; */
+			break;
+		case 3: /* neg-x */
+			/* 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[2] = tvec[0];
+			break;
+		case 5: /* neg-z */
+			vec[0] = -tvec[0];
+			vec[1] = -tvec[1];
+			/* vec[2]=  0.0; */
+			break;
 	}
 }
 
 /* lens/angle conversion (radians) */
 float focallength_to_fov(float focal_length, float sensor)
 {
-	return 2.0f * atanf((sensor/2.0f) / focal_length);
+	return 2.0f * atanf((sensor / 2.0f) / focal_length);
 }
 
 float fov_to_focallength(float hfov, float sensor)
 {
-	return (sensor/2.0f) / tanf(hfov * 0.5f);
+	return (sensor / 2.0f) / tanf(hfov * 0.5f);
 }
 
 /* 'mod_inline(-3,4)= 1', 'fmod(-3,4)= -3' */
@@ -1706,7 +1761,7 @@ static float mod_inline(float a, float b)
 
 float angle_wrap_rad(float angle)
 {
-	return mod_inline(angle + (float)M_PI, (float)M_PI*2.0f) - (float)M_PI;
+	return mod_inline(angle + (float)M_PI, (float)M_PI * 2.0f) - (float)M_PI;
 }
 
 float angle_wrap_deg(float angle)
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c
index 47deb70..f734e01 100644
--- a/source/blender/blenlib/intern/math_vector.c
+++ b/source/blender/blenlib/intern/math_vector.c
@@ -17,7 +17,7 @@
  *
  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
  * All rights reserved.
- 
+ *
  * The Original Code is: some of this file.
  *
  * ***** END GPL LICENSE BLOCK *****
@@ -35,85 +35,95 @@
 
 void interp_v2_v2v2(float target[2], const float a[2], const float b[2], const float t)
 {
-	float s = 1.0f-t;
+	float s = 1.0f - t;
 
-	target[0]= s*a[0] + t*b[0];
-	target[1]= s*a[1] + t*b[1];
+	target[0] = s * a[0] + t * b[0];
+	target[1] = s * a[1] + t * b[1];
 }
 
 /* weight 3 2D vectors,
  * 'w' must be unit length but is not a vector, just 3 weights */
 void interp_v2_v2v2v2(float p[2], const float v1[2], const float v2[2], const float v3[2], const float w[3])
 {
-	p[0] = v1[0]*w[0] + v2[0]*w[1] + v3[0]*w[2];
-	p[1] = v1[1]*w[0] + v2[1]*w[1] + v3[1]*w[2];
+	p[0] = v1[0] * w[0] + v2[0] * w[1] + v3[0] * w[2];
+	p[1] = v1[1] * w[0] + v2[1] * w[1] + v3[1] * w[2];
 }
 
 void interp_v3_v3v3(float target[3], const float a[3], const float b[3], const float t)
 {
-	float s = 1.0f-t;
+	float s = 1.0f - t;
 
-	target[0]= s*a[0] + t*b[0];
-	target[1]= s*a[1] + t*b[1];
-	target[2]= s*a[2] + t*b[2];
+	target[0] = s * a[0] + t * b[0];
+	target[1] = s * a[1] + t * b[1];
+	target[2] = s * a[2] + t * b[2];
 }
 
 void interp_v4_v4v4(float target[4], const float a[4], const float b[4], const float t)
 {
-	float s = 1.0f-t;
+	float s = 1.0f - t;
 
-	target[0]= s*a[0] + t*b[0];
-	target[1]= s*a[1] + t*b[1];
-	target[2]= s*a[2] + t*b[2];
-	target[3]= s*a[3] + t*b[3];
+	target[0] = s * a[0] + t * b[0];
+	target[1] = s * a[1] + t * b[1];
+	target[2] = s * a[2] + t * b[2];
+	target[3] = s * a[3] + t * b[3];
 }
 
 /* weight 3 vectors,
  * 'w' must be unit length but is not a vector, just 3 weights */
 void interp_v3_v3v3v3(float p[3], const float v1[3], const float v2[3], const float v3[3], const float w[3])
 {
-	p[0] = v1[0]*w[0] + v2[0]*w[1] + v3[0]*w[2];
-	p[1] = v1[1]*w[0] + v2[1]*w[1] + v3[1]*w[2];
-	p[2] = v1[2]*w[0] + v2[2]*w[1] + v3[2]*w[2];
+	p[0] = v1[0] * w[0] + v2[0] * w[1] + v3[0] * w[2];
+	p[1] = v1[1] * w[0] + v2[1] * w[1] + v3[1] * w[2];
+	p[2] = v1[2] * w[0] + v2[2] * w[1] + v3[2] * w[2];
 }
 
 /* weight 3 vectors,
  * 'w' must be unit length but is not a vector, just 4 weights */
 void interp_v3_v3v3v3v3(float p[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3], const float w[4])
 {
-	p[0] = v1[0]*w[0] + v2[0]*w[1] + v3[0]*w[2] + v4[0]*w[3];
-	p[1] = v1[1]*w[0] + v2[1]*w[1] + v3[1]*w[2] + v4[1]*w[3];
-	p[2] = v1[2]*w[0] + v2[2]*w[1] + v3[2]*w[2] + v4[2]*w[3];
+	p[0] = v1[0] * w[0] + v2[0] * w[1] + v3[0] * w[2] + v4[0] * w[3];
+	p[1] = v1[1] * w[0] + v2[1] * w[1] + v3[1] * w[2] + v4[1] * w[3];
+	p[2] = v1[2] * w[0] + v2[2] * w[1] + v3[2] * w[2] + v4[2] * w[3];
 }
 
 void interp_v4_v4v4v4(float p[4], const float v1[4], const float v2[4], const float v3[4], const float w[3])
 {
-	p[0] = v1[0]*w[0] + v2[0]*w[1] + v3[0]*w[2];
-	p[1] = v1[1]*w[0] + v2[1]*w[1] + v3[1]*w[2];
-	p[2] = v1[2]*w[0] + v2[2]*w[1] + v3[2]*w[2];
-	p[3] = v1[3]*w[0] + v2[3]*w[1] + v3[3]*w[2];
+	p[0] = v1[0] * w[0] + v2[0] * w[1] + v3[0] * w[2];
+	p[1] = v1[1] * w[0] + v2[1] * w[1] + v3[1] * w[2];
+	p[2] = v1[2] * w[0] + v2[2] * w[1] + v3[2] * w[2];
+	p[3] = v1[3] * w[0] + v2[3] * w[1] + v3[3] * w[2];
 }
 
 void interp_v4_v4v4v4v4(float p[4], const float v1[4], const float v2[4], const float v3[4], const float v4[4], const float w[4])
 {
-	p[0] = v1[0]*w[0] + v2[0]*w[1] + v3[0]*w[2] + v4[0]*w[3];
-	p[1] = v1[1]*w[0] + v2[1]*w[1] + v3[1]*w[2] + v4[1]*w[3];
-	p[2] = v1[2]*w[0] + v2[2]*w[1] + v3[2]*w[2] + v4[2]*w[3];
-	p[3] = v1[3]*w[0] + v2[3]*w[1] + v3[3]*w[2] + v4[3]*w[3];
+	p[0] = v1[0] * w[0] + v2[0] * w[1] + v3[0] * w[2] + v4[0] * w[3];
+	p[1] = v1[1] * w[0] + v2[1] * w[1] + v3[1] * w[2] + v4[1] * w[3];
+	p[2] = v1[2] * w[0] + v2[2] * w[1] + v3[2] * w[2] + v4[2] * w[3];
+	p[3] = v1[3] * w[0] + v2[3] * w[1] + v3[3] * w[2] + v4[3] * w[3];
 }
 
 void mid_v3_v3v3(float v[3], const float v1[3], const float v2[3])
 {
-	v[0]= 0.5f*(v1[0] + v2[0]);
-	v[1]= 0.5f*(v1[1] + v2[1]);
-	v[2]= 0.5f*(v1[2] + v2[2]);
+	v[0] = 0.5f * (v1[0] + v2[0]);
+	v[1] = 0.5f * (v1[1] + v2[1]);
+	v[2] = 0.5f * (v1[2] + v2[2]);
+}
+
+void mid_v2_v2v2(float v[2], const float v1[2], const float v2[2])
+{
+	v[0] = 0.5f * (v1[0] + v2[0]);
+	v[1] = 0.5f * (v1[1] + v2[1]);
 }
 
 /********************************** Angles ***********************************/
 
 /* Return the angle in radians between vecs 1-2 and 2-3 in radians
-   If v1 is a shoulder, v2 is the elbow and v3 is the hand,
-   this would return the angle at the elbow */
+ * If v1 is a shoulder, v2 is the elbow and v3 is the hand,
+ * this would return the angle at the elbow.
+ *
+ * note that when v1/v2/v3 represent 3 points along a straight line
+ * that the angle returned will be pi (180deg), rather then 0.0
+ */
 float angle_v3v3v3(const float v1[3], const float v2[3], const float v3[3])
 {
 	float vec1[3], vec2[3];
@@ -141,12 +151,12 @@ float angle_v2v2v2(const float v1[2], const float v2[2], const float v3[2])
 {
 	float vec1[2], vec2[2];
 
-	vec1[0] = v2[0]-v1[0];
-	vec1[1] = v2[1]-v1[1];
-	
-	vec2[0] = v2[0]-v3[0];
-	vec2[1] = v2[1]-v3[1];
-	
+	vec1[0] = v2[0] - v1[0];
+	vec1[1] = v2[1] - v1[1];
+
+	vec2[0] = v2[0] - v3[0];
+	vec2[1] = v2[1] - v3[1];
+
 	normalize_v2(vec1);
 	normalize_v2(vec2);
 
@@ -170,20 +180,26 @@ float angle_v2v2(const float v1[2], const float v2[2])
 	return angle_normalized_v2v2(vec1, vec2);
 }
 
+float angle_signed_v2v2(const float v1[2], const float v2[2])
+{
+	const float perp_dot = (v1[1] * v2[0]) - (v1[0] * v2[1]);
+	return atan2f(perp_dot, dot_v2v2(v1, v2));
+}
+
 float angle_normalized_v3v3(const float v1[3], const float v2[3])
 {
 	/* this is the same as acos(dot_v3v3(v1, v2)), but more accurate */
 	if (dot_v3v3(v1, v2) < 0.0f) {
 		float vec[3];
-		
-		vec[0]= -v2[0];
-		vec[1]= -v2[1];
-		vec[2]= -v2[2];
-		
-		return (float)M_PI - 2.0f*(float)saasin(len_v3v3(vec, v1)/2.0f);
+
+		vec[0] = -v2[0];
+		vec[1] = -v2[1];
+		vec[2] = -v2[2];
+
+		return (float)M_PI - 2.0f * (float)saasin(len_v3v3(vec, v1) / 2.0f);
 	}
 	else
-		return 2.0f*(float)saasin(len_v3v3(v2, v1)/2.0f);
+		return 2.0f * (float)saasin(len_v3v3(v2, v1) / 2.0f);
 }
 
 float angle_normalized_v2v2(const float v1[2], const float v2[2])
@@ -191,14 +207,14 @@ float angle_normalized_v2v2(const float v1[2], const float v2[2])
 	/* this is the same as acos(dot_v3v3(v1, v2)), but more accurate */
 	if (dot_v2v2(v1, v2) < 0.0f) {
 		float vec[2];
-		
-		vec[0]= -v2[0];
-		vec[1]= -v2[1];
-		
-		return (float)M_PI - 2.0f*saasin(len_v2v2(vec, v1)/2.0f);
+
+		vec[0] = -v2[0];
+		vec[1] = -v2[1];
+
+		return (float)M_PI - 2.0f * saasin(len_v2v2(vec, v1) / 2.0f);
 	}
 	else
-		return 2.0f*(float)saasin(len_v2v2(v2, v1)/2.0f);
+		return 2.0f * (float)saasin(len_v2v2(v2, v1) / 2.0f);
 }
 
 void angle_tri_v3(float angles[3], const float v1[3], const float v2[3], const float v3[3])
@@ -213,10 +229,10 @@ void angle_tri_v3(float angles[3], const float v1[3], const float v2[3], const f
 	normalize_v3(ed2);
 	normalize_v3(ed3);
 
-	angles[0]= (float)M_PI - angle_normalized_v3v3(ed1, ed2);
-	angles[1]= (float)M_PI - angle_normalized_v3v3(ed2, ed3);
+	angles[0] = (float)M_PI - angle_normalized_v3v3(ed1, ed2);
+	angles[1] = (float)M_PI - angle_normalized_v3v3(ed2, ed3);
 	// face_angles[2] = M_PI - angle_normalized_v3v3(ed3, ed1);
-	angles[2]= (float)M_PI - (angles[0] + angles[1]);
+	angles[2] = (float)M_PI - (angles[0] + angles[1]);
 }
 
 void angle_quad_v3(float angles[4], const float v1[3], const float v2[3], const float v3[3], const float v4[3])
@@ -233,10 +249,10 @@ void angle_quad_v3(float angles[4], const float v1[3], const float v2[3], const
 	normalize_v3(ed3);
 	normalize_v3(ed4);
 
-	angles[0]= (float)M_PI - angle_normalized_v3v3(ed1, ed2);
-	angles[1]= (float)M_PI - angle_normalized_v3v3(ed2, ed3);
-	angles[2]= (float)M_PI - angle_normalized_v3v3(ed3, ed4);
-	angles[3]= (float)M_PI - angle_normalized_v3v3(ed4, ed1);
+	angles[0] = (float)M_PI - angle_normalized_v3v3(ed1, ed2);
+	angles[1] = (float)M_PI - angle_normalized_v3v3(ed2, ed3);
+	angles[2] = (float)M_PI - angle_normalized_v3v3(ed3, ed4);
+	angles[3] = (float)M_PI - angle_normalized_v3v3(ed4, ed1);
 }
 
 void angle_poly_v3(float *angles, const float *verts[3], int len)
@@ -244,12 +260,12 @@ void angle_poly_v3(float *angles, const float *verts[3], int len)
 	int i;
 	float vec[3][3];
 
-	sub_v3_v3v3(vec[2], verts[len-1], verts[0]);
+	sub_v3_v3v3(vec[2], verts[len - 1], verts[0]);
 	normalize_v3(vec[2]);
 	for (i = 0; i < len; i++) {
-		sub_v3_v3v3(vec[i%3], verts[i%len], verts[(i+1)%len]);
-		normalize_v3(vec[i%3]);
-		angles[i] = (float)M_PI - angle_normalized_v3v3(vec[(i+2)%3], vec[i%3]);
+		sub_v3_v3v3(vec[i % 3], verts[i % len], verts[(i + 1) % len]);
+		normalize_v3(vec[i % 3]);
+		angles[i] = (float)M_PI - angle_normalized_v3v3(vec[(i + 2) % 3], vec[i % 3]);
 	}
 }
 
@@ -270,12 +286,26 @@ void project_v3_v3v3(float c[3], const float v1[3], const float v2[3])
 {
 	float mul;
 	mul = dot_v3v3(v1, v2) / dot_v3v3(v2, v2);
-	
+
 	c[0] = mul * v2[0];
 	c[1] = mul * v2[1];
 	c[2] = mul * v2[2];
 }
 
+/* project a vector on a plane defined by normal and a plane point p */
+void project_v3_plane(float v[3], const float n[3], const float p[3])
+{
+	float vector[3];
+	float mul;
+
+	sub_v3_v3v3(vector, v, p);
+	mul = dot_v3v3(vector, n) / len_squared_v3(n);
+
+	mul_v3_v3fl(vector, n, mul);
+
+	sub_v3_v3(v, vector);
+}
+
 /* Returns a vector bisecting the angle at v2 formed by v1, v2 and v3 */
 void bisect_v3_v3v3v3(float out[3], const float v1[3], const float v2[3], const float v3[3])
 {
@@ -289,8 +319,8 @@ void bisect_v3_v3v3v3(float out[3], const float v1[3], const float v2[3], const
 }
 
 /* Returns a reflection vector from a vector and a normal vector
-reflect = vec - ((2 * DotVecs(vec, mirror)) * mirror)
-*/
+ * reflect = vec - ((2 * DotVecs(vec, mirror)) * mirror)
+ */
 void reflect_v3_v3v3(float out[3], const float v1[3], const float v2[3])
 {
 	float vec[3], normal[3];
@@ -311,7 +341,7 @@ void reflect_v3_v3v3(float out[3], const float v1[3], const float v2[3])
 
 void ortho_basis_v3v3_v3(float v1[3], float v2[3], const float v[3])
 {
-	const float f = (float)sqrt(v[0]*v[0] + v[1]*v[1]);
+	const float f = (float)sqrt(v[0] * v[0] + v[1] * v[1]);
 
 	if (f < 1e-35f) {
 		// degenerate case
@@ -319,37 +349,37 @@ void ortho_basis_v3v3_v3(float v1[3], float v2[3], const float v[3])
 		v1[1] = v1[2] = v2[0] = v2[2] = 0.0f;
 		v2[1] = 1.0f;
 	}
-	else  {
-		const float d= 1.0f/f;
+	else {
+		const float d = 1.0f / f;
 
-		v1[0] =  v[1]*d;
-		v1[1] = -v[0]*d;
+		v1[0] = v[1] * d;
+		v1[1] = -v[0] * d;
 		v1[2] = 0.0f;
-		v2[0] = -v[2]*v1[1];
-		v2[1] = v[2]*v1[0];
-		v2[2] = v[0]*v1[1] - v[1]*v1[0];
+		v2[0] = -v[2] * v1[1];
+		v2[1] = v[2] * v1[0];
+		v2[2] = v[0] * v1[1] - v[1] * v1[0];
 	}
 }
 
 /* Rotate a point p by angle theta around an arbitrary axis r
-   http://local.wasp.uwa.edu.au/~pbourke/geometry/
-*/
+ * http://local.wasp.uwa.edu.au/~pbourke/geometry/
+ */
 void rotate_normalized_v3_v3v3fl(float r[3], const float p[3], const float axis[3], const float angle)
 {
-	const float costheta= cos(angle);
-	const float sintheta= sin(angle);
+	const float costheta = cos(angle);
+	const float sintheta = sin(angle);
 
-	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]);
+	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]);
 
-	r[1]=	(((1 - costheta) * axis[0] * axis[1] + axis[2] * sintheta) * p[0]) +
-			((costheta + (1 - costheta) * axis[1] * axis[1]) * p[1]) +
-			(((1 - costheta) * axis[1] * axis[2] - axis[0] * sintheta) * p[2]);
+	r[1] = (((1 - costheta) * axis[0] * axis[1] + axis[2] * sintheta) * p[0]) +
+	       ((costheta + (1 - costheta) * axis[1] * axis[1]) * p[1]) +
+	       (((1 - costheta) * axis[1] * axis[2] - axis[0] * sintheta) * p[2]);
 
-	r[2]=	(((1 - costheta) * axis[0] * axis[2] - axis[1] * sintheta) * p[0]) +
-			(((1 - costheta) * axis[1] * axis[2] + axis[0] * sintheta) * p[1]) +
-			((costheta + (1 - costheta) * axis[2] * axis[2]) * p[2]);
+	r[2] = (((1 - costheta) * axis[0] * axis[2] - axis[1] * sintheta) * p[0]) +
+	       (((1 - costheta) * axis[1] * axis[2] + axis[0] * sintheta) * p[1]) +
+	       ((costheta + (1 - costheta) * axis[2] * axis[2]) * p[2]);
 }
 
 void rotate_v3_v3v3fl(float r[3], const float p[3], const float axis[3], const float angle)
@@ -380,39 +410,40 @@ void print_v4(const char *str, const float v[4])
 
 void minmax_v3v3_v3(float min[3], float max[3], const float vec[3])
 {
-	if(min[0]>vec[0]) min[0]= vec[0];
-	if(min[1]>vec[1]) min[1]= vec[1];
-	if(min[2]>vec[2]) min[2]= vec[2];
+	if (min[0] > vec[0]) min[0] = vec[0];
+	if (min[1] > vec[1]) min[1] = vec[1];
+	if (min[2] > vec[2]) min[2] = vec[2];
 
-	if(max[0]<vec[0]) max[0]= vec[0];
-	if(max[1]<vec[1]) max[1]= vec[1];
-	if(max[2]<vec[2]) max[2]= vec[2];
+	if (max[0] < vec[0]) max[0] = vec[0];
+	if (max[1] < vec[1]) max[1] = vec[1];
+	if (max[2] < vec[2]) max[2] = vec[2];
 }
 
-
 /***************************** Array Functions *******************************/
 
 double dot_vn_vn(const float *array_src_a, const float *array_src_b, const int size)
 {
-	double d= 0.0f;
-	const float *array_pt_a= array_src_a + (size-1);
-	const float *array_pt_b= array_src_b + (size-1);
-	int i= size;
-	while(i--) { d += *(array_pt_a--) * *(array_pt_b--); }
+	double d = 0.0f;
+	const float *array_pt_a = array_src_a + (size - 1);
+	const float *array_pt_b = array_src_b + (size - 1);
+	int i = size;
+	while (i--) {
+		d += *(array_pt_a--) * *(array_pt_b--);
+	}
 	return d;
 }
 
 float normalize_vn_vn(float *array_tar, const float *array_src, const int size)
 {
-	double d= dot_vn_vn(array_tar, array_src, size);
+	double d = dot_vn_vn(array_tar, array_src, size);
 	float d_sqrt;
 	if (d > 1.0e-35) {
-		d_sqrt= (float)sqrt(d);
-		mul_vn_vn_fl(array_tar, array_src, size, 1.0f/d_sqrt);
+		d_sqrt = (float)sqrt(d);
+		mul_vn_vn_fl(array_tar, array_src, size, 1.0f / d_sqrt);
 	}
 	else {
 		fill_vn_fl(array_tar, size, 0.0f);
-		d_sqrt= 0.0f;
+		d_sqrt = 0.0f;
 	}
 	return d_sqrt;
 }
@@ -424,95 +455,126 @@ float normalize_vn(float *array_tar, const int size)
 
 void range_vn_i(int *array_tar, const int size, const int start)
 {
-	int *array_pt= array_tar + (size-1);
-	int j= start + (size-1);
-	int i= size;
-	while(i--) { *(array_pt--) = j--; }
+	int *array_pt = array_tar + (size - 1);
+	int j = start + (size - 1);
+	int i = size;
+	while (i--) {
+		*(array_pt--) = j--;
+	}
 }
 
 void range_vn_fl(float *array_tar, const int size, const float start, const float step)
 {
-	float *array_pt= array_tar + (size-1);
-	int i= size;
-	while(i--) {
+	float *array_pt = array_tar + (size - 1);
+	int i = size;
+	while (i--) {
 		*(array_pt--) = start + step * (float)(i);
 	}
 }
 
 void negate_vn(float *array_tar, const int size)
 {
-	float *array_pt= array_tar + (size-1);
-	int i= size;
-	while(i--) { *(array_pt--) *= -1.0f; }
+	float *array_pt = array_tar + (size - 1);
+	int i = size;
+	while (i--) {
+		*(array_pt--) *= -1.0f;
+	}
 }
 
 void negate_vn_vn(float *array_tar, const float *array_src, const int size)
 {
-	float *tar= array_tar + (size-1);
-	const float *src= array_src + (size-1);
-	int i= size;
-	while(i--) { *(tar--) = - *(src--); }
+	float *tar = array_tar + (size - 1);
+	const float *src = array_src + (size - 1);
+	int i = size;
+	while (i--) {
+		*(tar--) = -*(src--);
+	}
 }
 
 void mul_vn_fl(float *array_tar, const int size, const float f)
 {
-	float *array_pt= array_tar + (size-1);
-	int i= size;
-	while(i--) { *(array_pt--) *= f; }
+	float *array_pt = array_tar + (size - 1);
+	int i = size;
+	while (i--) {
+		*(array_pt--) *= f;
+	}
 }
 
 void mul_vn_vn_fl(float *array_tar, const float *array_src, const int size, const float f)
 {
-	float *tar= array_tar + (size-1);
-	const float *src= array_src + (size-1);
-	int i= size;
-	while(i--) { *(tar--) = *(src--) * f; }
+	float *tar = array_tar + (size - 1);
+	const float *src = array_src + (size - 1);
+	int i = size;
+	while (i--) {
+		*(tar--) = *(src--) * f;
+	}
 }
 
 void add_vn_vn(float *array_tar, const float *array_src, const int size)
 {
-	float *tar= array_tar + (size-1);
-	const float *src= array_src + (size-1);
-	int i= size;
-	while(i--) { *(tar--) += *(src--); }
+	float *tar = array_tar + (size - 1);
+	const float *src = array_src + (size - 1);
+	int i = size;
+	while (i--) {
+		*(tar--) += *(src--);
+	}
 }
 
 void add_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size)
 {
-	float *tar= array_tar + (size-1);
-	const float *src_a= array_src_a + (size-1);
-	const float *src_b= array_src_b + (size-1);
-	int i= size;
-	while(i--) { *(tar--) = *(src_a--) + *(src_b--); }
+	float *tar = array_tar + (size - 1);
+	const float *src_a = array_src_a + (size - 1);
+	const float *src_b = array_src_b + (size - 1);
+	int i = size;
+	while (i--) {
+		*(tar--) = *(src_a--) + *(src_b--);
+	}
 }
 
 void sub_vn_vn(float *array_tar, const float *array_src, const int size)
 {
-	float *tar= array_tar + (size-1);
-	const float *src= array_src + (size-1);
-	int i= size;
-	while(i--) { *(tar--) -= *(src--); }
+	float *tar = array_tar + (size - 1);
+	const float *src = array_src + (size - 1);
+	int i = size;
+	while (i--) {
+		*(tar--) -= *(src--);
+	}
 }
 
 void sub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size)
 {
-	float *tar= array_tar + (size-1);
-	const float *src_a= array_src_a + (size-1);
-	const float *src_b= array_src_b + (size-1);
-	int i= size;
-	while(i--) { *(tar--) = *(src_a--) - *(src_b--); }
+	float *tar = array_tar + (size - 1);
+	const float *src_a = array_src_a + (size - 1);
+	const float *src_b = array_src_b + (size - 1);
+	int i = size;
+	while (i--) {
+		*(tar--) = *(src_a--) - *(src_b--);
+	}
 }
 
 void fill_vn_i(int *array_tar, const int size, const int val)
 {
-	int *tar= array_tar + (size-1);
-	int i= size;
-	while(i--) { *(tar--) = val; }
+	int *tar = array_tar + (size - 1);
+	int i = size;
+	while (i--) {
+		*(tar--) = val;
+	}
+}
+
+void fill_vn_ushort(unsigned short *array_tar, const int size, const unsigned short val)
+{
+	unsigned short *tar = array_tar + (size - 1);
+	int i = size;
+	while (i--) {
+		*(tar--) = val;
+	}
 }
 
 void fill_vn_fl(float *array_tar, const int size, const float val)
 {
-	float *tar= array_tar + (size-1);
-	int i= size;
-	while(i--) { *(tar--) = val; }
+	float *tar = array_tar + (size - 1);
+	int i = size;
+	while (i--) {
+		*(tar--) = val;
+	}
 }
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c
index 9c5d8f3..ef8f26e 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -17,7 +17,7 @@
  *
  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
  * All rights reserved.
- 
+ *
  * The Original Code is: some of this file.
  *
  * ***** END GPL LICENSE BLOCK *****
@@ -30,117 +30,182 @@
 
 #include "BLI_math.h"
 
-#ifndef BLI_MATH_VECTOR_INLINE_H
-#define BLI_MATH_VECTOR_INLINE_H
+#ifndef __MATH_VECTOR_INLINE_C__
+#define __MATH_VECTOR_INLINE_C__
 
 /********************************** Init *************************************/
 
 MINLINE void zero_v2(float r[2])
 {
-	r[0]= 0.0f;
-	r[1]= 0.0f;
+	r[0] = 0.0f;
+	r[1] = 0.0f;
 }
 
 MINLINE void zero_v3(float r[3])
 {
-	r[0]= 0.0f;
-	r[1]= 0.0f;
-	r[2]= 0.0f;
+	r[0] = 0.0f;
+	r[1] = 0.0f;
+	r[2] = 0.0f;
 }
 
 MINLINE void zero_v4(float r[4])
 {
-	r[0]= 0.0f;
-	r[1]= 0.0f;
-	r[2]= 0.0f;
-	r[3]= 0.0f;
+	r[0] = 0.0f;
+	r[1] = 0.0f;
+	r[2] = 0.0f;
+	r[3] = 0.0f;
 }
 
 MINLINE void copy_v2_v2(float r[2], const float a[2])
 {
-	r[0]= a[0];
-	r[1]= a[1];
+	r[0] = a[0];
+	r[1] = a[1];
 }
 
 MINLINE void copy_v3_v3(float r[3], const float a[3])
 {
-	r[0]= a[0];
-	r[1]= a[1];
-	r[2]= a[2];
+	r[0] = a[0];
+	r[1] = a[1];
+	r[2] = a[2];
 }
 
 MINLINE void copy_v4_v4(float r[4], const float a[4])
 {
-	r[0]= a[0];
-	r[1]= a[1];
-	r[2]= a[2];
-	r[3]= a[3];
+	r[0] = a[0];
+	r[1] = a[1];
+	r[2] = a[2];
+	r[3] = a[3];
+}
+
+MINLINE void copy_v2_fl(float r[2], float f)
+{
+	r[0] = f;
+	r[1] = f;
+}
+
+MINLINE void copy_v3_fl(float r[3], float f)
+{
+	r[0] = f;
+	r[1] = f;
+	r[2] = f;
+}
+
+MINLINE void copy_v4_fl(float r[4], float f)
+{
+	r[0] = f;
+	r[1] = f;
+	r[2] = f;
+	r[3] = f;
 }
 
 /* short */
 MINLINE void copy_v2_v2_char(char r[2], const char a[2])
 {
-	r[0]= a[0];
-	r[1]= a[1];
+	r[0] = a[0];
+	r[1] = a[1];
 }
 
 MINLINE void copy_v3_v3_char(char r[3], const char a[3])
 {
-	r[0]= a[0];
-	r[1]= a[1];
-	r[2]= a[2];
+	r[0] = a[0];
+	r[1] = a[1];
+	r[2] = a[2];
 }
 
 MINLINE void copy_v4_v4_char(char r[4], const char a[4])
 {
-	r[0]= a[0];
-	r[1]= a[1];
-	r[2]= a[2];
-	r[3]= a[3];
+	r[0] = a[0];
+	r[1] = a[1];
+	r[2] = a[2];
+	r[3] = a[3];
 }
 
 /* short */
 MINLINE void copy_v2_v2_short(short r[2], const short a[2])
 {
-	r[0]= a[0];
-	r[1]= a[1];
+	r[0] = a[0];
+	r[1] = a[1];
 }
 
 MINLINE void copy_v3_v3_short(short r[3], const short a[3])
 {
-	r[0]= a[0];
-	r[1]= a[1];
-	r[2]= a[2];
+	r[0] = a[0];
+	r[1] = a[1];
+	r[2] = a[2];
 }
 
 MINLINE void copy_v4_v4_short(short r[4], const short a[4])
 {
-	r[0]= a[0];
-	r[1]= a[1];
-	r[2]= a[2];
-	r[3]= a[3];
+	r[0] = a[0];
+	r[1] = a[1];
+	r[2] = a[2];
+	r[3] = a[3];
 }
 
 /* int */
 MINLINE void copy_v2_v2_int(int r[2], const int a[2])
 {
-	r[0]= a[0];
-	r[1]= a[1];
+	r[0] = a[0];
+	r[1] = a[1];
 }
 
 MINLINE void copy_v3_v3_int(int r[3], const int a[3])
 {
-	r[0]= a[0];
-	r[1]= a[1];
-	r[2]= a[2];
+	r[0] = a[0];
+	r[1] = a[1];
+	r[2] = a[2];
 }
 
 MINLINE void copy_v4_v4_int(int r[4], const int a[4])
 {
-	r[0]= a[0];
-	r[1]= a[1];
-	r[2]= a[2];
-	r[3]= a[3];
+	r[0] = a[0];
+	r[1] = a[1];
+	r[2] = a[2];
+	r[3] = a[3];
+}
+
+/* double -> float */
+MINLINE void copy_v2fl_v2db(float r[2], const double a[2])
+{
+	r[0] = (float)a[0];
+	r[1] = (float)a[1];
+}
+
+MINLINE void copy_v3fl_v3db(float r[3], const double a[3])
+{
+	r[0] = (float)a[0];
+	r[1] = (float)a[1];
+	r[2] = (float)a[2];
+}
+
+MINLINE void copy_v4fl_v4db(float r[4], const double a[4])
+{
+	r[0] = (float)a[0];
+	r[1] = (float)a[1];
+	r[2] = (float)a[2];
+	r[3] = (float)a[3];
+}
+
+/* float -> double */
+MINLINE void copy_v2db_v2fl(double r[2], const float a[2])
+{
+	r[0] = (double)a[0];
+	r[1] = (double)a[1];
+}
+
+MINLINE void copy_v3db_v3fl(double r[3], const float a[3])
+{
+	r[0] = (double)a[0];
+	r[1] = (double)a[1];
+	r[2] = (double)a[2];
+}
+
+MINLINE void copy_v4db_v4fl(double r[4], const float a[4])
+{
+	r[0] = (double)a[0];
+	r[1] = (double)a[1];
+	r[2] = (double)a[2];
+	r[3] = (double)a[3];
 }
 
 MINLINE void swap_v2_v2(float a[2], float b[2])
@@ -189,8 +254,8 @@ MINLINE void add_v2_v2(float r[2], const float a[2])
 
 MINLINE void add_v2_v2v2(float r[2], const float a[2], const float b[2])
 {
-	r[0]= a[0] + b[0];
-	r[1]= a[1] + b[1];
+	r[0] = a[0] + b[0];
+	r[1] = a[1] + b[1];
 }
 
 MINLINE void add_v3_v3(float r[3], const float a[3])
@@ -202,9 +267,9 @@ MINLINE void add_v3_v3(float r[3], const float a[3])
 
 MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
 {
-	r[0]= a[0] + b[0];
-	r[1]= a[1] + b[1];
-	r[2]= a[2] + b[2];
+	r[0] = a[0] + b[0];
+	r[1] = a[1] + b[1];
+	r[2] = a[2] + b[2];
 }
 
 MINLINE void sub_v2_v2(float r[2], const float a[2])
@@ -215,8 +280,8 @@ MINLINE void sub_v2_v2(float r[2], const float a[2])
 
 MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
 {
-	r[0]= a[0] - b[0];
-	r[1]= a[1] - b[1];
+	r[0] = a[0] - b[0];
+	r[1] = a[1] - b[1];
 }
 
 MINLINE void sub_v3_v3(float r[3], const float a[3])
@@ -228,9 +293,9 @@ MINLINE void sub_v3_v3(float r[3], const float a[3])
 
 MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
 {
-	r[0]= a[0] - b[0];
-	r[1]= a[1] - b[1];
-	r[2]= a[2] - b[2];
+	r[0] = a[0] - b[0];
+	r[1] = a[1] - b[1];
+	r[2] = a[2] - b[2];
 }
 
 MINLINE void sub_v4_v4(float r[4], const float a[4])
@@ -243,23 +308,22 @@ MINLINE void sub_v4_v4(float r[4], const float a[4])
 
 MINLINE void sub_v4_v4v4(float r[4], const float a[4], const float b[4])
 {
-	r[0]= a[0] - b[0];
-	r[1]= a[1] - b[1];
-	r[2]= a[2] - b[2];
-	r[3]= a[3] - b[3];
+	r[0] = a[0] - b[0];
+	r[1] = a[1] - b[1];
+	r[2] = a[2] - b[2];
+	r[3] = a[3] - b[3];
 }
 
-
 MINLINE void mul_v2_fl(float r[2], float f)
 {
-	r[0]*= f;
-	r[1]*= f;
+	r[0] *= f;
+	r[1] *= f;
 }
 
 MINLINE void mul_v2_v2fl(float r[2], const float a[2], float f)
 {
-	r[0]= a[0]*f;
-	r[1]= a[1]*f;
+	r[0] = a[0] * f;
+	r[1] = a[1] * f;
 }
 
 MINLINE void mul_v3_fl(float r[3], float f)
@@ -271,9 +335,9 @@ MINLINE void mul_v3_fl(float r[3], float f)
 
 MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
 {
-	r[0]= a[0]*f;
-	r[1]= a[1]*f;
-	r[2]= a[2]*f;
+	r[0] = a[0] * f;
+	r[1] = a[1] * f;
+	r[2] = a[2] * f;
 }
 
 MINLINE void mul_v2_v2(float r[2], const float a[2])
@@ -291,58 +355,58 @@ MINLINE void mul_v3_v3(float r[3], const float a[3])
 
 MINLINE void mul_v4_fl(float r[4], float f)
 {
-	r[0]*= f;
-	r[1]*= f;
-	r[2]*= f;
-	r[3]*= f;
+	r[0] *= f;
+	r[1] *= f;
+	r[2] *= f;
+	r[3] *= f;
 }
 
 MINLINE void madd_v2_v2fl(float r[2], const float a[2], float f)
 {
-	r[0] += a[0]*f;
-	r[1] += a[1]*f;
+	r[0] += a[0] * f;
+	r[1] += a[1] * f;
 }
 
 MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
 {
-	r[0] += a[0]*f;
-	r[1] += a[1]*f;
-	r[2] += a[2]*f;
+	r[0] += a[0] * f;
+	r[1] += a[1] * f;
+	r[2] += a[2] * f;
 }
 
 MINLINE void madd_v3_v3v3(float r[3], const float a[3], const float b[3])
 {
-	r[0] += a[0]*b[0];
-	r[1] += a[1]*b[1];
-	r[2] += a[2]*b[2];
+	r[0] += a[0] * b[0];
+	r[1] += a[1] * b[1];
+	r[2] += a[2] * b[2];
 }
 
 MINLINE void madd_v2_v2v2fl(float r[2], const float a[2], const float b[2], float f)
 {
-	r[0] = a[0] + b[0]*f;
-	r[1] = a[1] + b[1]*f;
+	r[0] = a[0] + b[0] * f;
+	r[1] = a[1] + b[1] * f;
 }
 
 MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
 {
-	r[0] = a[0] + b[0]*f;
-	r[1] = a[1] + b[1]*f;
-	r[2] = a[2] + b[2]*f;
+	r[0] = a[0] + b[0] * f;
+	r[1] = a[1] + b[1] * f;
+	r[2] = a[2] + b[2] * f;
 }
 
 MINLINE void madd_v3_v3v3v3(float r[3], const float a[3], const float b[3], const float c[3])
 {
-	r[0] = a[0] + b[0]*c[0];
-	r[1] = a[1] + b[1]*c[1];
-	r[2] = a[2] + b[2]*c[2];
+	r[0] = a[0] + b[0] * c[0];
+	r[1] = a[1] + b[1] * c[1];
+	r[2] = a[2] + b[2] * c[2];
 }
 
 MINLINE void madd_v4_v4fl(float r[4], const float a[4], float f)
 {
-	r[0] += a[0]*f;
-	r[1] += a[1]*f;
-	r[2] += a[2]*f;
-	r[3] += a[3]*f;
+	r[0] += a[0] * f;
+	r[1] += a[1] * f;
+	r[2] += a[2] * f;
+	r[3] += a[3] * f;
 }
 
 MINLINE void mul_v3_v3v3(float r[3], const float v1[3], const float v2[3])
@@ -354,98 +418,114 @@ MINLINE void mul_v3_v3v3(float r[3], const float v1[3], const float v2[3])
 
 MINLINE void negate_v2(float r[3])
 {
-	r[0]= -r[0];
-	r[1]= -r[1];
+	r[0] = -r[0];
+	r[1] = -r[1];
 }
 
 MINLINE void negate_v2_v2(float r[2], const float a[2])
 {
-	r[0]= -a[0];
-	r[1]= -a[1];
+	r[0] = -a[0];
+	r[1] = -a[1];
 }
 
 MINLINE void negate_v3(float r[3])
 {
-	r[0]= -r[0];
-	r[1]= -r[1];
-	r[2]= -r[2];
+	r[0] = -r[0];
+	r[1] = -r[1];
+	r[2] = -r[2];
 }
 
 MINLINE void negate_v3_v3(float r[3], const float a[3])
 {
-	r[0]= -a[0];
-	r[1]= -a[1];
-	r[2]= -a[2];
+	r[0] = -a[0];
+	r[1] = -a[1];
+	r[2] = -a[2];
 }
 
 MINLINE void negate_v4(float r[4])
 {
-	r[0]= -r[0];
-	r[1]= -r[1];
-	r[2]= -r[2];
-	r[3]= -r[3];
+	r[0] = -r[0];
+	r[1] = -r[1];
+	r[2] = -r[2];
+	r[3] = -r[3];
 }
 
 MINLINE void negate_v4_v4(float r[4], const float a[4])
 {
-	r[0]= -a[0];
-	r[1]= -a[1];
-	r[2]= -a[2];
-	r[3]= -a[3];
+	r[0] = -a[0];
+	r[1] = -a[1];
+	r[2] = -a[2];
+	r[3] = -a[3];
 }
 
 MINLINE float dot_v2v2(const float a[2], const float b[2])
 {
-	return a[0]*b[0] + a[1]*b[1];
+	return a[0] * b[0] + a[1] * b[1];
 }
 
 MINLINE float dot_v3v3(const float a[3], const float b[3])
 {
-	return a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
+	return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
 }
 
 MINLINE float cross_v2v2(const float a[2], const float b[2])
 {
-	return a[0]*b[1] - a[1]*b[0];
+	return a[0] * b[1] - a[1] * b[0];
 }
 
 MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
 {
-	r[0]= a[1]*b[2] - a[2]*b[1];
-	r[1]= a[2]*b[0] - a[0]*b[2];
-	r[2]= a[0]*b[1] - a[1]*b[0];
+	r[0] = a[1] * b[2] - a[2] * b[1];
+	r[1] = a[2] * b[0] - a[0] * b[2];
+	r[2] = a[0] * b[1] - a[1] * b[0];
+}
+
+/* Newell's Method */
+/* excuse this fairly spesific function,
+ * its used for polygon normals all over the place
+ * could use a better name */
+MINLINE void add_newell_cross_v3_v3v3(float n[3], const float v_prev[3], const float v_curr[3])
+{
+	n[0] += (v_prev[1] - v_curr[1]) * (v_prev[2] + v_curr[2]);
+	n[1] += (v_prev[2] - v_curr[2]) * (v_prev[0] + v_curr[0]);
+	n[2] += (v_prev[0] - v_curr[0]) * (v_prev[1] + v_curr[1]);
 }
 
 MINLINE void star_m3_v3(float rmat[][3], float a[3])
 {
-	rmat[0][0]= rmat[1][1]= rmat[2][2]= 0.0;
-	rmat[0][1]= -a[2];
-	rmat[0][2]=  a[1];
-	rmat[1][0]=  a[2];
-	rmat[1][2]= -a[0];
-	rmat[2][0]= -a[1];
-	rmat[2][1]=  a[0];
+	rmat[0][0] = rmat[1][1] = rmat[2][2] = 0.0;
+	rmat[0][1] = -a[2];
+	rmat[0][2] = a[1];
+	rmat[1][0] = a[2];
+	rmat[1][2] = -a[0];
+	rmat[2][0] = -a[1];
+	rmat[2][1] = a[0];
 }
 
 /*********************************** Length **********************************/
 
 MINLINE float len_squared_v2(const float v[2])
 {
-	return v[0]*v[0] + v[1]*v[1];
+	return v[0] * v[0] + v[1] * v[1];
+}
+
+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_v2(const float v[2])
 {
-	return (float)sqrtf(v[0]*v[0] + v[1]*v[1]);
+	return sqrtf(v[0] * v[0] + v[1] * v[1]);
 }
 
 MINLINE float len_v2v2(const float v1[2], const float v2[2])
 {
 	float x, y;
 
-	x = v1[0]-v2[0];
-	y = v1[1]-v2[1];
-	return (float)sqrtf(x*x+y*y);
+	x = v1[0] - v2[0];
+	y = v1[1] - v2[1];
+	return sqrtf(x * x + y * y);
 }
 
 MINLINE float len_v3(const float a[3])
@@ -479,14 +559,15 @@ MINLINE float len_squared_v3v3(const float a[3], const float b[3])
 
 MINLINE float normalize_v2_v2(float r[2], const float a[2])
 {
-	float d= dot_v2v2(a, a);
+	float d = dot_v2v2(a, a);
 
-	if(d > 1.0e-35f) {
-		d= sqrtf(d);
-		mul_v2_v2fl(r, a, 1.0f/d);
-	} else {
+	if (d > 1.0e-35f) {
+		d = sqrtf(d);
+		mul_v2_v2fl(r, a, 1.0f / d);
+	}
+	else {
 		zero_v2(r);
-		d= 0.0f;
+		d = 0.0f;
 	}
 
 	return d;
@@ -499,17 +580,17 @@ MINLINE float normalize_v2(float n[2])
 
 MINLINE float normalize_v3_v3(float r[3], const float a[3])
 {
-	float d= dot_v3v3(a, a);
+	float d = dot_v3v3(a, a);
 
 	/* a larger value causes normalize errors in a
-	   scaled down models with camera xtreme close */
-	if(d > 1.0e-35f) {
-		d= sqrtf(d);
-		mul_v3_v3fl(r, a, 1.0f/d);
+	 * scaled down models with camera xtreme close */
+	if (d > 1.0e-35f) {
+		d = sqrtf(d);
+		mul_v3_v3fl(r, a, 1.0f / d);
 	}
 	else {
 		zero_v3(r);
-		d= 0.0f;
+		d = 0.0f;
 	}
 
 	return d;
@@ -517,22 +598,23 @@ MINLINE float normalize_v3_v3(float r[3], const float a[3])
 
 MINLINE double normalize_v3_d(double n[3])
 {
-	double d= n[0]*n[0] + n[1]*n[1] + n[2]*n[2];
+	double d = n[0] * n[0] + n[1] * n[1] + n[2] * n[2];
 
 	/* a larger value causes normalize errors in a
-	   scaled down models with camera xtreme close */
-	if(d > 1.0e-35) {
+	 * scaled down models with camera xtreme close */
+	if (d > 1.0e-35) {
 		double mul;
 
-		d= sqrt(d);
+		d = sqrt(d);
 		mul = 1.0 / d;
 
 		n[0] *= mul;
 		n[1] *= mul;
 		n[2] *= mul;
-	} else {
+	}
+	else {
 		n[0] = n[1] = n[2] = 0;
-		d= 0.0;
+		d = 0.0;
 	}
 
 	return d;
@@ -545,20 +627,26 @@ MINLINE float normalize_v3(float n[3])
 
 MINLINE void normal_short_to_float_v3(float out[3], const short in[3])
 {
-	out[0] = in[0]*(1.0f/32767.0f);
-	out[1] = in[1]*(1.0f/32767.0f);
-	out[2] = in[2]*(1.0f/32767.0f);
+	out[0] = in[0] * (1.0f / 32767.0f);
+	out[1] = in[1] * (1.0f / 32767.0f);
+	out[2] = in[2] * (1.0f / 32767.0f);
 }
 
 MINLINE void normal_float_to_short_v3(short out[3], const float in[3])
 {
-	out[0] = (short)(in[0]*32767.0f);
-	out[1] = (short)(in[1]*32767.0f);
-	out[2] = (short)(in[2]*32767.0f);
+	out[0] = (short) (in[0] * 32767.0f);
+	out[1] = (short) (in[1] * 32767.0f);
+	out[2] = (short) (in[2] * 32767.0f);
 }
 
 /********************************* Comparison ********************************/
 
+
+MINLINE int is_zero_v2(const float v[3])
+{
+	return (v[0] == 0 && v[1] == 0);
+}
+
 MINLINE int is_zero_v3(const float v[3])
 {
 	return (v[0] == 0 && v[1] == 0 && v[2] == 0);
@@ -576,24 +664,24 @@ MINLINE int is_one_v3(const float v[3])
 
 MINLINE int equals_v2v2(const float v1[2], const float v2[2])
 {
-	return ((v1[0]==v2[0]) && (v1[1]==v2[1]));
+	return ((v1[0] == v2[0]) && (v1[1] == v2[1]));
 }
 
 MINLINE int equals_v3v3(const float v1[3], const float v2[3])
 {
-	return ((v1[0]==v2[0]) && (v1[1]==v2[1]) && (v1[2]==v2[2]));
+	return ((v1[0] == v2[0]) && (v1[1] == v2[1]) && (v1[2] == v2[2]));
 }
 
 MINLINE int equals_v4v4(const float v1[4], const float v2[4])
 {
-	return ((v1[0]==v2[0]) && (v1[1]==v2[1]) && (v1[2]==v2[2]) && (v1[3]==v2[3]));
+	return ((v1[0] == v2[0]) && (v1[1] == v2[1]) && (v1[2] == v2[2]) && (v1[3] == v2[3]));
 }
 
 MINLINE int compare_v3v3(const float v1[3], const float v2[3], const float limit)
 {
-	if(fabsf(v1[0]-v2[0])<limit)
-		if(fabsf(v1[1]-v2[1])<limit)
-			if(fabsf(v1[2]-v2[2])<limit)
+	if (fabsf(v1[0] - v2[0]) < limit)
+		if (fabsf(v1[1] - v2[1]) < limit)
+			if (fabsf(v1[2] - v2[2]) < limit)
 				return 1;
 
 	return 0;
@@ -601,21 +689,21 @@ MINLINE int compare_v3v3(const float v1[3], const float v2[3], const float limit
 
 MINLINE int compare_len_v3v3(const float v1[3], const float v2[3], const float limit)
 {
-	float x,y,z;
+	float x, y, z;
 
-	x=v1[0]-v2[0];
-	y=v1[1]-v2[1];
-	z=v1[2]-v2[2];
+	x = v1[0] - v2[0];
+	y = v1[1] - v2[1];
+	z = v1[2] - v2[2];
 
-	return ((x*x + y*y + z*z) < (limit*limit));
+	return ((x * x + y * y + z * z) < (limit * limit));
 }
 
 MINLINE int compare_v4v4(const float v1[4], const float v2[4], const float limit)
 {
-	if(fabsf(v1[0]-v2[0])<limit)
-		if(fabsf(v1[1]-v2[1])<limit)
-			if(fabsf(v1[2]-v2[2])<limit)
-				if(fabsf(v1[3]-v2[3])<limit)
+	if (fabsf(v1[0] - v2[0]) < limit)
+		if (fabsf(v1[1] - v2[1]) < limit)
+			if (fabsf(v1[2] - v2[2]) < limit)
+				if (fabsf(v1[3] - v2[3]) < limit)
 					return 1;
 
 	return 0;
@@ -623,9 +711,8 @@ MINLINE int compare_v4v4(const float v1[4], const float v2[4], const float limit
 
 MINLINE float line_point_side_v2(const float l1[2], const float l2[2], const float pt[2])
 {
-	return	((l1[0]-pt[0]) * (l2[1]-pt[1])) -
-			((l2[0]-pt[0]) * (l1[1]-pt[1]));
+	return (((l1[0] - pt[0]) * (l2[1] - pt[1])) -
+	        ((l2[0] - pt[0]) * (l1[1] - pt[1])));
 }
 
-#endif /* BLI_MATH_VECTOR_INLINE_H */
-
+#endif /* __MATH_VECTOR_INLINE_C__ */
diff --git a/source/blender/blenlib/intern/md5.c b/source/blender/blenlib/intern/md5.c
index 25582a5..a521d0e 100644
--- a/source/blender/blenlib/intern/md5.c
+++ b/source/blender/blenlib/intern/md5.c
@@ -1,6 +1,7 @@
-/** \file blender/imbuf/intern/md5.c
+/** \file blender/blenlib/intern/md5.c
  *  \ingroup imbuf
  */
+
 /* md5.c - Functions to compute MD5 message digest of files or memory blocks
    according to the definition of MD5 in RFC 1321 from April 1992.
    Copyright (C) 1995 Software Foundation, Inc.
diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c
index b3cb285..5db42c3 100644
--- a/source/blender/blenlib/intern/noise.c
+++ b/source/blender/blenlib/intern/noise.c
@@ -332,7 +332,7 @@ 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;
 }
 
@@ -345,7 +345,7 @@ static float orgBlenderNoiseS(float x, float y, float z)
 /* separated from orgBlenderNoise above, with scaling */
 float BLI_hnoise(float noisesize, float x, float y, float z)
 {
-	if(noisesize==0.0f) return 0.0f;
+	if (noisesize==0.0f) return 0.0f;
 	x= (1.0f+x)/noisesize;
 	y= (1.0f+y)/noisesize;
 	z= (1.0f+z)/noisesize;
@@ -360,7 +360,7 @@ float BLI_turbulence(float noisesize, float x, float y, float z, int nr)
 
 	s= BLI_hnoise(noisesize, x, y, z);
 	
-	while(nr>0) {
+	while (nr>0) {
 	
 		s+= d*BLI_hnoise(noisesize*d, x, y, z);
 		div+= d;
@@ -377,7 +377,7 @@ float BLI_turbulence1(float noisesize, float x, float y, float z, int nr)
 
 	s= fabsf( (-1.0f+2.0f*BLI_hnoise(noisesize, x, y, z)));
 	
-	while(nr>0) {
+	while (nr>0) {
 	
 		s+= fabsf(d* (-1.0f+2.0f*BLI_hnoise(noisesize*d, x, y, z)));
 		div+= d;
@@ -919,12 +919,14 @@ static float g[512+2][3]= {
 	{-0.944031, -0.326599, -0.045624},
 };
 
-#define setup(i,b0,b1,r0,r1) \
-		t = vec[i] + 10000.0f; \
-		b0 = ((int)t) & 255; \
-		b1 = (b0+1) & 255; \
-		r0 = t - floorf(t); \
-		r1 = r0 - 1.0f;
+#define SETUP(val, b0, b1, r0, r1)                                            \
+	{                                                                         \
+		t = val + 10000.0f;                                                   \
+		b0 = ((int)t) & 255;                                                  \
+		b1 = (b0 + 1) & 255;                                                  \
+		r0 = t - floorf(t);                                                   \
+		r1 = r0 - 1.0f;                                                       \
+	}
 
 
 static float noise3_perlin(float vec[3])
@@ -934,9 +936,9 @@ static float noise3_perlin(float vec[3])
 	register int i, j;
 
 
-	setup(0, bx0,bx1, rx0,rx1);
-	setup(1, by0,by1, ry0,ry1);
-	setup(2, bz0,bz1, rz0,rz1);
+	SETUP(vec[0],  bx0, bx1,  rx0, rx1);
+	SETUP(vec[1],  by0, by1,  ry0, ry1);
+	SETUP(vec[2],  bz0, bz1,  rz0, rz1);
 
 	i = p[ bx0 ];
 	j = p[ bx1 ];
@@ -946,46 +948,48 @@ static float noise3_perlin(float vec[3])
 	b01 = p[ i + by1 ];
 	b11 = p[ j + by1 ];
 
-#define at(rx,ry,rz) ( rx * q[0] + ry * q[1] + rz * q[2] )
-
-#define surve(t) ( t * t * (3.0f - 2.0f * t) )
+#define VALUE_AT(rx,ry,rz) (rx * q[0] + ry * q[1] + rz * q[2])
+#define SURVE(t) (t * t * (3.0f - 2.0f * t))
 
 /* lerp moved to improved perlin above */
 
-	sx = surve(rx0);
-	sy = surve(ry0);
-	sz = surve(rz0);
+	sx = SURVE(rx0);
+	sy = SURVE(ry0);
+	sz = SURVE(rz0);
 
 
-	q = g[ b00 + bz0 ] ;
-	u = at(rx0,ry0,rz0);
-	q = g[ b10 + bz0 ] ;
-	v = at(rx1,ry0,rz0);
+	q = g[ b00 + bz0 ];
+	u = VALUE_AT(rx0,ry0,rz0);
+	q = g[ b10 + bz0 ];
+	v = VALUE_AT(rx1,ry0,rz0);
 	a = lerp(sx, u, v);
 
-	q = g[ b01 + bz0 ] ;
-	u = at(rx0,ry1,rz0);
-	q = g[ b11 + bz0 ] ;
-	v = at(rx1,ry1,rz0);
+	q = g[ b01 + bz0 ];
+	u = VALUE_AT(rx0,ry1,rz0);
+	q = g[ b11 + bz0 ];
+	v = VALUE_AT(rx1,ry1,rz0);
 	b = lerp(sx, u, v);
 
 	c = lerp(sy, a, b);          /* interpolate in y at lo x */
 
-	q = g[ b00 + bz1 ] ;
-	u = at(rx0,ry0,rz1);
-	q = g[ b10 + bz1 ] ;
-	v = at(rx1,ry0,rz1);
+	q = g[ b00 + bz1 ];
+	u = VALUE_AT(rx0,ry0,rz1);
+	q = g[ b10 + bz1 ];
+	v = VALUE_AT(rx1,ry0,rz1);
 	a = lerp(sx, u, v);
 
-	q = g[ b01 + bz1 ] ;
-	u = at(rx0,ry1,rz1);
-	q = g[ b11 + bz1 ] ;
-	v = at(rx1,ry1,rz1);
+	q = g[ b01 + bz1 ];
+	u = VALUE_AT(rx0,ry1,rz1);
+	q = g[ b11 + bz1 ];
+	v = VALUE_AT(rx1,ry1,rz1);
 	b = lerp(sx, u, v);
 
 	d = lerp(sy, a, b);          /* interpolate in y at hi x */
 
 	return 1.5f * lerp(sz, c, d); /* interpolate in z */
+
+#undef VALUE_AT
+#undef SURVE
 }
 
 #if 0
@@ -998,11 +1002,11 @@ static float turbulence_perlin(float *point, float lofreq, float hifreq)
 	p[2] = point[2];
 
 	t = 0;
-	for (freq = lofreq ; freq < hifreq ; freq *= 2.) {
+	for (freq = lofreq ; freq < hifreq ; freq *= 2.0) {
 		t += fabsf(noise3_perlin(p)) / freq;
-		p[0] *= 2.;
-		p[1] *= 2.;
-		p[2] *= 2.;
+		p[0] *= 2.0f;
+		p[1] *= 2.0f;
+		p[2] *= 2.0f;
 	}
 	return t - 0.3; /* readjust to make mean value = 0.0 */
 }
@@ -1043,7 +1047,8 @@ float BLI_hnoisep(float noisesize, float x, float y, float z)
 	return noise3_perlin(vec);
 }
 
-/*static float turbulencep(float noisesize, float x, float y, float z, int nr)
+#if 0
+static float turbulencep(float noisesize, float x, float y, float z, int nr)
 {
 	float vec[3];
 
@@ -1052,7 +1057,8 @@ float BLI_hnoisep(float noisesize, float x, float y, float z)
 	vec[2]= z/noisesize;
 	nr++;
 	return turbulence_perlin(vec, 1.0, (float)(1<<nr));
-}*/
+}
+#endif
 
 /******************/
 /* VORONOI/WORLEY */
@@ -1106,7 +1112,7 @@ static float dist_Minkovsky(float x, float y, float z, float e)
 
 
 /* Not 'pure' Worley, but the results are virtually the same.
-	 Returns distances in da and point coords in pa */
+ * Returns distances in da and point coords in pa */
 void voronoi(float x, float y, float z, float* da, float* pa, float me, int dtype)
 {
 	int xx, yy, zz, xi, yi, zi;
@@ -1222,7 +1228,7 @@ static float voronoi_Cr(float x, float y, float z)
 
 
 /* Signed version of all 6 of the above, just 2x-1, not really correct though (range is potentially (0, sqrt(6)).
-   Used in the musgrave functions */
+ * Used in the musgrave functions */
 static float voronoi_F1S(float x, float y, float z)
 {
 	float da[4], pa[12];
@@ -1506,9 +1512,10 @@ float mg_fBm(float x, float y, float z, float H, float lacunarity, float octaves
  *    ``octaves''  is the number of frequencies in the fBm
  *    ``offset''  is the zero offset, which determines multifractality (NOT USED??)
  */
- /* this one is in fact rather confusing,
-	 * there seem to be errors in the original source code (in all three versions of proc.text&mod),
-	* I modified it to something that made sense to me, so it might be wrong... */
+
+/* this one is in fact rather confusing,
+ * there seem to be errors in the original source code (in all three versions of proc.text&mod),
+ * I modified it to something that made sense to me, so it might be wrong... */
 float mg_MultiFractal(float x, float y, float z, float H, float lacunarity, float octaves, int noisebasis)
 {
 	float	rmd, value=1.0, pwr=1.0, pwHL=powf(lacunarity, -H);
@@ -1768,7 +1775,7 @@ float mg_RidgedMultiFractal(float x, float y, float z, float H, float lacunarity
 	result = signal;
 
 
-	for( i=1; i<(int)octaves; i++ ) {
+	for ( i=1; i<(int)octaves; i++ ) {
 		x *= lacunarity;
 		y *= lacunarity;
 		z *= lacunarity;
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index bbdb9bc..3c59ca8 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -62,6 +62,7 @@
 #endif
 
 #ifdef WIN32
+#include "utf_winfunc.h"
 #  include <io.h>
 #  ifdef _WIN32_IE
 #    undef _WIN32_IE
@@ -110,18 +111,18 @@ int BLI_stringdec(const char *string, char *head, char *tail, unsigned short *nu
 	short i, found = 0;
 	char *lslash = BLI_last_slash(string);
 	len2 = len = strlen(string);
-	if(lslash)
+	if (lslash)
 		lenlslash= (int)(lslash - string);
 
-	while(len > lenlslash && string[--len] != '.') {};
-	if(len == lenlslash && string[len] != '.') len = len2;
+	while (len > lenlslash && string[--len] != '.') {};
+	if (len == lenlslash && string[len] != '.') len = len2;
 
 	for (i = len - 1; i >= lenlslash; i--) {
 		if (isdigit(string[i])) {
-			if (found){
+			if (found) {
 				nums = i;
 			}
-			else{
+			else {
 				nume = i;
 				nums = i;
 				found = 1;
@@ -153,7 +154,7 @@ int BLI_stringdec(const char *string, char *head, char *tail, unsigned short *nu
 void BLI_stringenc(char *string, const char *head, const char *tail, unsigned short numlen, int pic)
 {
 	char fmtstr[16]="";
-	if(pic < 0) pic= 0;
+	if (pic < 0) pic= 0;
 	sprintf(fmtstr, "%%s%%.%dd%%s", numlen);
 	sprintf(string, fmtstr, head, pic, tail);
 }
@@ -168,23 +169,23 @@ int BLI_split_name_num(char *left, int *nr, const char *name, const char delim)
 	a= strlen(name);
 	memcpy(left, name, (a + 1) * sizeof(char));
 
-	if(a>1 && name[a-1]==delim) return a;
+	if (a>1 && name[a-1]==delim) return a;
 	
-	while(a--) {
-		if( name[a]==delim ) {
+	while (a--) {
+		if ( name[a]==delim ) {
 			left[a]= 0;
 			*nr= atol(name+a+1);
 			/* casting down to an int, can overflow for large numbers */
-			if(*nr < 0)
+			if (*nr < 0)
 				*nr= 0;
 			return a;
 		}
-		if( isdigit(name[a])==0 ) break;
+		if ( isdigit(name[a])==0 ) break;
 		
 		left[a]= 0;
 	}
 
-	for(a= 0; name[a]; a++)
+	for (a= 0; name[a]; a++)
 		left[a]= name[a];
 
 	return a;
@@ -216,11 +217,11 @@ void BLI_newname(char *name, int add)
 
 int BLI_uniquename_cb(int (*unique_check)(void *, const char *), void *arg, const char defname[], char delim, char *name, short name_len)
 {
-	if(name[0] == '\0') {
+	if (name[0] == '\0') {
 		BLI_strncpy(name, defname, name_len);
 	}
 
-	if(unique_check(arg, name)) {
+	if (unique_check(arg, name)) {
 		char	numstr[16];
 		char	tempname[UNIQUE_NAME_MAX];
 		char	left[UNIQUE_NAME_MAX];
@@ -238,10 +239,10 @@ int BLI_uniquename_cb(int (*unique_check)(void *, const char *), void *arg, cons
 			else {
 				char *tempname_buf;
 				tempname[0]= '\0';
-				tempname_buf =BLI_strncat_utf8(tempname, left, name_len - numlen);
+				tempname_buf = BLI_strncat_utf8(tempname, left, name_len - numlen);
 				memcpy(tempname_buf, numstr, numlen + 1);
 			}
-		} while(unique_check(arg, tempname));
+		} while (unique_check(arg, tempname));
 
 		BLI_strncpy(name, tempname, name_len);
 		
@@ -264,7 +265,7 @@ int BLI_uniquename_cb(int (*unique_check)(void *, const char *), void *arg, cons
  * 	name_offs: should be calculated using offsetof(structname, membername) macro from stddef.h
  *	len: maximum length of string (to prevent overflows, etc.)
  *	defname: the name that should be used by default if none is specified already
- *	delim: the character which acts as a delimeter between parts of the name
+ *	delim: the character which acts as a delimiter between parts of the name
  */
 static int uniquename_find_dupe(ListBase *list, void *vlink, const char *name, short name_offs)
 {
@@ -321,7 +322,8 @@ void BLI_cleanup_path(const char *relabase, char *dir)
 	char *start, *eind;
 	if (relabase) {
 		BLI_path_abs(dir, relabase);
-	} else {
+	}
+	else {
 		if (dir[0]=='/' && dir[1]=='/') {
 			if (dir[2]== '\0') {
 				return; /* path is "//" - cant clean it */
@@ -331,18 +333,18 @@ void BLI_cleanup_path(const char *relabase, char *dir)
 	}
 	
 	/* Note
-	 *   memmove( start, eind, strlen(eind)+1 );
+	 *   memmove(start, eind, strlen(eind) + 1);
 	 * is the same as
 	 *   strcpy( start, eind ); 
 	 * except strcpy should not be used because there is overlap,
-	  * so use memmove's slightly more obscure syntax - Campbell
+	 * so use memmove's slightly more obscure syntax - Campbell
 	 */
 	
 #ifdef WIN32
 	
 	/* Note, this should really be moved to the file selector,
 	 * since this function is used in many areas */
-	if(strcmp(dir, ".")==0) {	/* happens for example in FILE_MAIN */
+	if (strcmp(dir, ".")==0) {	/* happens for example in FILE_MAIN */
 		get_default_root(dir);
 		return;
 	}	
@@ -356,32 +358,33 @@ void BLI_cleanup_path(const char *relabase, char *dir)
 		}
 		if (a<0) {
 			break;
-		} else {
-			memmove( dir+a, eind, strlen(eind)+1 );
+		}
+		else {
+			memmove(dir + a, eind, strlen(eind) + 1);
 		}
 	}
 
-	while ( (start = strstr(dir,"\\.\\")) ){
+	while ( (start = strstr(dir,"\\.\\")) ) {
 		eind = start + strlen("\\.\\") - 1;
-		memmove( start, eind, strlen(eind)+1 );
+		memmove(start, eind, strlen(eind) + 1);
 	}
 
-	while ( (start = strstr(dir,"\\\\" )) ){
+	while ( (start = strstr(dir,"\\\\" )) ) {
 		eind = start + strlen("\\\\") - 1;
-		memmove( start, eind, strlen(eind)+1 );
+		memmove(start, eind, strlen(eind) + 1);
 	}
 #else
-	if(dir[0]=='.') {	/* happens, for example in FILE_MAIN */
+	if (dir[0]=='.') {	/* happens, for example in FILE_MAIN */
 		dir[0]= '/';
 		dir[1]= 0;
 		return;
 	}
 
 	/* support for odd paths: eg /../home/me --> /home/me
-	 * this is a valid path in blender but we cant handle this the useual way below
-	 * simply strip this prefix then evaluate the path as useual. pythons os.path.normpath() does this */
-	while((strncmp(dir, "/../", 4)==0)) {
-		memmove( dir, dir + 4, strlen(dir + 4) + 1 );
+	 * this is a valid path in blender but we cant handle this the usual way below
+	 * simply strip this prefix then evaluate the path as usual. pythons os.path.normpath() does this */
+	while ((strncmp(dir, "/../", 4)==0)) {
+		memmove(dir, dir + 4, strlen(dir + 4) + 1);
 	}
 
 	while ( (start = strstr(dir, "/../")) ) {
@@ -393,19 +396,20 @@ void BLI_cleanup_path(const char *relabase, char *dir)
 		}
 		if (a<0) {
 			break;
-		} else {
-			memmove( dir+a, eind, strlen(eind)+1 );
+		}
+		else {
+			memmove(dir+a, eind, strlen(eind) + 1);
 		}
 	}
 
-	while ( (start = strstr(dir,"/./")) ){
+	while ( (start = strstr(dir,"/./")) ) {
 		eind = start + (3 - 1) /* strlen("/./") - 1 */;
-		memmove( start, eind, strlen(eind)+1 );
+		memmove(start, eind, strlen(eind) + 1);
 	}
 
-	while ( (start = strstr(dir,"//" )) ){
+	while ( (start = strstr(dir,"//" )) ) {
 		eind = start + (2 - 1) /* strlen("//") - 1 */;
-		memmove( start, eind, strlen(eind)+1 );
+		memmove(start, eind, strlen(eind) + 1);
 	}
 #endif
 }
@@ -430,7 +434,7 @@ void BLI_path_rel(char *file, const char *relfile)
 	char res[FILE_MAX];
 	
 	/* if file is already relative, bail out */
-	if(file[0]=='/' && file[1]=='/') return;
+	if (file[0]=='/' && file[1]=='/') return;
 	
 	/* also bail out if relative path is not set */
 	if (relfile[0] == 0) return;
@@ -439,14 +443,15 @@ void BLI_path_rel(char *file, const char *relfile)
 	if (BLI_strnlen(relfile, 3) > 2 && relfile[1] != ':') {
 		char* ptemp;
 		/* fix missing volume name in relative base,
-		   can happen with old recent-files.txt files */
+		 * can happen with old recent-files.txt files */
 		get_default_root(temp);
 		ptemp = &temp[2];
 		if (relfile[0] != '\\' && relfile[0] != '/') {
 			ptemp++;
 		}
 		BLI_strncpy(ptemp, relfile, FILE_MAX-3);
-	} else {
+	}
+	else {
 		BLI_strncpy(temp, relfile, FILE_MAX);
 	}
 
@@ -468,10 +473,9 @@ void BLI_path_rel(char *file, const char *relfile)
 	/* the last slash in the file indicates where the path part ends */
 	lslash = BLI_last_slash(temp);
 
-	if (lslash) 
-	{	
+	if (lslash) {
 		/* find the prefix of the filename that is equal for both filenames.
-		   This is replaced by the two slashes at the beginning */
+		 * This is replaced by the two slashes at the beginning */
 		char *p= temp;
 		char *q= file;
 
@@ -482,7 +486,7 @@ void BLI_path_rel(char *file, const char *relfile)
 #endif
 		{
 			++p; ++q;
-			/* dont search beyond the end of the string
+			/* don't search beyond the end of the string
 			 * in the rare case they match */
 			if ((*p=='\0') || (*q=='\0')) {
 				break;
@@ -490,8 +494,8 @@ void BLI_path_rel(char *file, const char *relfile)
 		}
 
 		/* we might have passed the slash when the beginning of a dir matches 
-		   so we rewind. Only check on the actual filename
-		*/
+		 * so we rewind. Only check on the actual filename
+		 */
 		if (*q != '/') {
 			while ( (q >= file) && (*q != '/') ) { --q; --p; }
 		} 
@@ -502,10 +506,10 @@ void BLI_path_rel(char *file, const char *relfile)
 		strcpy(res,	"//");
 
 		/* p now points to the slash that is at the beginning of the part
-		   where the path is different from the relative path. 
-		   We count the number of directories we need to go up in the
-		   hierarchy to arrive at the common 'prefix' of the path
-		*/			
+		 * where the path is different from the relative path. 
+		 * We count the number of directories we need to go up in the
+		 * hierarchy to arrive at the common 'prefix' of the path
+		 */
 		while (p && p < lslash)	{
 			if (*p == '/') 
 				strcat(res,	"../");
@@ -548,7 +552,8 @@ int BLI_parent_dir(char *path)
 	if (!BLI_testextensie(tmp, parent_dir)) {
 		BLI_strncpy(path, tmp, sizeof(tmp));	
 		return 1;
-	} else {
+	}
+	else {
 		return 0;
 	}
 }
@@ -560,8 +565,9 @@ static int stringframe_chars(char *path, int *char_start, int *char_end)
 	ch_sta = ch_end = 0;
 	for (i = 0; path[i] != '\0'; i++) {
 		if (path[i] == '\\' || path[i] == '/') {
-			ch_end = 0; /* this is a directory name, dont use any hashes we found */
-		} else if (path[i] == '#') {
+			ch_end = 0; /* this is a directory name, don't use any hashes we found */
+		}
+		else if (path[i] == '#') {
 			ch_sta = i;
 			ch_end = ch_sta+1;
 			while (path[ch_end] == '#') {
@@ -569,11 +575,11 @@ static int stringframe_chars(char *path, int *char_start, int *char_end)
 			}
 			i = ch_end-1; /* keep searching */
 			
-			/* dont break, there may be a slash after this that invalidates the previous #'s */
+			/* don't break, there may be a slash after this that invalidates the previous #'s */
 		}
 	}
 
-	if(ch_end) {
+	if (ch_end) {
 		*char_start= ch_sta;
 		*char_end= ch_end;
 		return 1;
@@ -589,13 +595,13 @@ static void ensure_digits(char *path, int digits)
 {
 	char *file= BLI_last_slash(path);
 
-	if(file==NULL)
+	if (file==NULL)
 		file= path;
 
-	if(strrchr(file, '#') == NULL) {
+	if (strrchr(file, '#') == NULL) {
 		int len= strlen(file);
 
-		while(digits--) {
+		while (digits--) {
 			file[len++]= '#';
 		}
 		file[len]= '\0';
@@ -606,7 +612,7 @@ int BLI_path_frame(char *path, int frame, int digits)
 {
 	int ch_sta, ch_end;
 
-	if(digits)
+	if (digits)
 		ensure_digits(path, digits);
 
 	if (stringframe_chars(path, &ch_sta, &ch_end)) { /* warning, ch_end is the last # +1 */
@@ -622,7 +628,7 @@ int BLI_path_frame_range(char *path, int sta, int end, int digits)
 {
 	int ch_sta, ch_end;
 
-	if(digits)
+	if (digits)
 		ensure_digits(path, digits);
 
 	if (stringframe_chars(path, &ch_sta, &ch_end)) { /* warning, ch_end is the last # +1 */
@@ -646,9 +652,9 @@ int BLI_path_abs(char *path, const char *basepath)
 
 	BLI_strncpy(vol, path, 3);
 	/* we are checking here if we have an absolute path that is not in the current
-	   blend file as a lib main - we are basically checking for the case that a 
-	   UNIX root '/' is passed.
-	*/
+	 * blend file as a lib main - we are basically checking for the case that a 
+	 * UNIX root '/' is passed.
+	 */
 	if (!wasrelative && (vol[1] != ':' && (vol[0] == '\0' || vol[0] == '/' || vol[0] == '\\'))) {
 		char *p = path;
 		get_default_root(tmp);
@@ -681,20 +687,20 @@ int BLI_path_abs(char *path, const char *basepath)
 
 	BLI_strncpy(base, basepath, sizeof(base));
 
-	/* file component is ignored, so dont bother with the trailing slash */
+	/* file component is ignored, so don't bother with the trailing slash */
 	BLI_cleanup_path(NULL, base);
 	
 	/* push slashes into unix mode - strings entering this part are
-	   potentially messed up: having both back- and forward slashes.
-	   Here we push into one conform direction, and at the end we
-	   push them into the system specific dir. This ensures uniformity
-	   of paths and solving some problems (and prevent potential future
-	   ones) -jesterKing. */
+	 * potentially messed up: having both back- and forward slashes.
+	 * Here we push into one conform direction, and at the end we
+	 * push them into the system specific dir. This ensures uniformity
+	 * of paths and solving some problems (and prevent potential future
+	 * ones) -jesterKing. */
 	BLI_char_switch(tmp, '\\', '/');
 	BLI_char_switch(base, '\\', '/');	
 
 	/* Paths starting with // will get the blend file as their base,
-	 * this isnt standard in any os but is uesed in blender all over the place */
+	 * this isn't standard in any os but is used in blender all over the place */
 	if (wasrelative) {
 		char *lslash= BLI_last_slash(base);
 		if (lslash) {
@@ -705,10 +711,12 @@ int BLI_path_abs(char *path, const char *basepath)
 			memcpy(tmp, base, baselen);
 			BLI_strncpy(tmp+baselen, path, sizeof(tmp)-baselen);
 			BLI_strncpy(path, tmp, FILE_MAX);
-		} else {
+		}
+		else {
 			BLI_strncpy(path, tmp+2, FILE_MAX);
 		}
-	} else {
+	}
+	else {
 		BLI_strncpy(path, tmp, FILE_MAX);
 	}
 
@@ -716,11 +724,11 @@ int BLI_path_abs(char *path, const char *basepath)
 
 #ifdef WIN32
 	/* skip first two chars, which in case of
-	   absolute path will be drive:/blabla and
-	   in case of relpath //blabla/. So relpath
-	   // will be retained, rest will be nice and
-	   shiny win32 backward slashes :) -jesterKing
-	*/
+	 * absolute path will be drive:/blabla and
+	 * in case of relpath //blabla/. So relpath
+	 * // will be retained, rest will be nice and
+	 * shiny win32 backward slashes :) -jesterKing
+	 */
 	BLI_char_switch(path+2, '/', '\\');
 #endif
 	
@@ -730,7 +738,7 @@ int BLI_path_abs(char *path, const char *basepath)
 
 /*
  * Should only be done with command line paths.
- * this is NOT somthing blenders internal paths support like the // prefix
+ * this is NOT something blenders internal paths support like the // prefix
  */
 int BLI_path_cwd(char *path)
 {
@@ -747,18 +755,19 @@ int BLI_path_cwd(char *path)
 	
 	if (wasrelative==1) {
 		char cwd[FILE_MAX]= "";
-		BLI_current_working_dir(cwd, sizeof(cwd)); /* incase the full path to the blend isnt used */
+		BLI_current_working_dir(cwd, sizeof(cwd)); /* in case the full path to the blend isn't used */
 		
 		if (cwd[0] == '\0') {
 			printf( "Could not get the current working directory - $PWD for an unknown reason.");
-		} else {
+		}
+		else {
 			/* uses the blend path relative to cwd important for loading relative linked files.
-			*
-			* cwd should contain c:\ etc on win32 so the relbase can be NULL
-			* relbase being NULL also prevents // being misunderstood as relative to the current
-			* blend file which isnt a feature we want to use in this case since were dealing
-			* with a path from the command line, rather than from inside Blender */
-			
+			 *
+			 * cwd should contain c:\ etc on win32 so the relbase can be NULL
+			 * relbase being NULL also prevents // being misunderstood as relative to the current
+			 * blend file which isn't a feature we want to use in this case since were dealing
+			 * with a path from the command line, rather than from inside Blender */
+
 			char origpath[FILE_MAX];
 			BLI_strncpy(origpath, path, FILE_MAX);
 			
@@ -778,7 +787,8 @@ void BLI_splitdirstring(char *di, char *fi)
 	if (lslash) {
 		BLI_strncpy(fi, lslash+1, FILE_MAXFILE);
 		*(lslash+1)=0;
-	} else {
+	}
+	else {
 		BLI_strncpy(fi, di, FILE_MAXFILE);
 		di[0]= 0;
 	}
@@ -798,14 +808,15 @@ void BLI_getlastdir(const char* dir, char *last, const size_t maxlen)
 	}
 	if (prevslash) {
 		BLI_strncpy(last, prevslash+1, maxlen);
-	} else {
+	}
+	else {
 		BLI_strncpy(last, dir, maxlen);
 	}
 }
 
 /* This is now only used to really get the user's default document folder */
 /* On Windows I chose the 'Users/<MyUserName>/Documents' since it's used
-   as default location to save documents */
+ * as default location to save documents */
 const char *BLI_getDefaultDocumentFolder(void)
 {
 #ifndef WIN32
@@ -820,15 +831,12 @@ const char *BLI_getDefaultDocumentFolder(void)
 		return getenv("HOME");
 
 #else /* Windows */
-		const char * ret;
 		static char documentfolder[MAXPATHLEN];
 		HRESULT hResult;
 
 		/* Check for %HOME% env var */
-
-		ret = getenv("HOME");
-		if(ret) {
-			if (BLI_is_dir(ret)) return ret;
+		if (uput_getenv("HOME",documentfolder,MAXPATHLEN)) {
+			if (BLI_is_dir(documentfolder)) return documentfolder;
 		}
 				
 		/* add user profile support for WIN 2K / NT.
@@ -838,8 +846,7 @@ const char *BLI_getDefaultDocumentFolder(void)
 		 */
 		hResult = SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, documentfolder);
 		
-		if (hResult == S_OK)
-		{
+		if (hResult == S_OK) {
 			if (BLI_is_dir(documentfolder)) return documentfolder;
 		}
 		
@@ -864,11 +871,11 @@ static int test_path(char *targetpath, const char *path_base, const char *path_s
 {
 	char tmppath[FILE_MAX];
 	
-	if(path_sep)	BLI_join_dirfile(tmppath, sizeof(tmppath), path_base, path_sep);
+	if (path_sep)	BLI_join_dirfile(tmppath, sizeof(tmppath), path_base, path_sep);
 	else			BLI_strncpy(tmppath, path_base, sizeof(tmppath));
 
 	/* rare cases folder_name is omitted (when looking for ~/.blender/2.xx dir only) */
-	if(folder_name)
+	if (folder_name)
 		BLI_make_file_string("/", targetpath, tmppath, folder_name);
 	else
 		BLI_strncpy(targetpath, tmppath, sizeof(tmppath));
@@ -896,7 +903,8 @@ static int test_env_path(char *path, const char *envvar)
 	if (BLI_is_dir(env)) {
 		BLI_strncpy(path, env, FILE_MAX);
 		return 1;
-	} else {
+	}
+	else {
 		path[0] = '\0';
 		return 0;
 	}
@@ -910,10 +918,11 @@ static int get_path_local(char *targetpath, const char *folder_name, const char
 	printf("get_path_local...\n");
 #endif
 
-	if(folder_name) {
+	if (folder_name) {
 		if (subfolder_name) {
 			BLI_join_dirfile(relfolder, sizeof(relfolder), folder_name, subfolder_name);
-		} else {
+		}
+		else {
 			BLI_strncpy(relfolder, folder_name, sizeof(relfolder));
 		}
 	}
@@ -922,7 +931,7 @@ static int get_path_local(char *targetpath, const char *folder_name, const char
 	}
 
 	/* try EXECUTABLE_DIR/2.5x/folder_name - new default directory for local blender installed files */
-	if(test_path(targetpath, bprogdir, blender_version_decimal(ver), relfolder))
+	if (test_path(targetpath, bprogdir, blender_version_decimal(ver), relfolder))
 		return 1;
 
 	return 0;
@@ -951,7 +960,8 @@ static int get_path_user(char *targetpath, const char *folder_name, const char *
 	if (test_env_path(user_path, envvar)) {
 		if (subfolder_name) {
 			return test_path(targetpath, user_path, NULL, subfolder_name);
-		} else {
+		}
+		else {
 			BLI_strncpy(targetpath, user_path, FILE_MAX);
 			return 1;
 		}
@@ -962,7 +972,7 @@ static int get_path_user(char *targetpath, const char *folder_name, const char *
 		BLI_snprintf(user_path, FILE_MAX, BLENDER_USER_FORMAT, user_base_path, blender_version_decimal(ver));
 	}
 
-	if(!user_path[0])
+	if (!user_path[0])
 		return 0;
 	
 #ifdef PATH_DEBUG2
@@ -972,7 +982,8 @@ static int get_path_user(char *targetpath, const char *folder_name, const char *
 	if (subfolder_name) {
 		/* try $HOME/folder_name/subfolder_name */
 		return test_path(targetpath, user_path, folder_name, subfolder_name);
-	} else {
+	}
+	else {
 		/* try $HOME/folder_name */
 		return test_path(targetpath, user_path, NULL, folder_name);
 	}
@@ -989,10 +1000,11 @@ static int get_path_system(char *targetpath, const char *folder_name, const char
 	char cwd[FILE_MAX];
 	char relfolder[FILE_MAX];
 
-	if(folder_name) {
+	if (folder_name) {
 		if (subfolder_name) {
 			BLI_join_dirfile(relfolder, sizeof(relfolder), folder_name, subfolder_name);
-		} else {
+		}
+		else {
 			BLI_strncpy(relfolder, folder_name, sizeof(relfolder));
 		}
 	}
@@ -1001,14 +1013,14 @@ static int get_path_system(char *targetpath, const char *folder_name, const char
 	}
 
 	/* try CWD/release/folder_name */
-	if(BLI_current_working_dir(cwd, sizeof(cwd))) {
-		if(test_path(targetpath, cwd, "release", relfolder)) {
+	if (BLI_current_working_dir(cwd, sizeof(cwd))) {
+		if (test_path(targetpath, cwd, "release", relfolder)) {
 			return 1;
 		}
 	}
 
 	/* try EXECUTABLE_DIR/release/folder_name */
-	if(test_path(targetpath, bprogdir, "release", relfolder))
+	if (test_path(targetpath, bprogdir, "release", relfolder))
 		return 1;
 	/* end developer overrides */
 
@@ -1019,7 +1031,8 @@ static int get_path_system(char *targetpath, const char *folder_name, const char
 	if (test_env_path(system_path, envvar)) {
 		if (subfolder_name) {
 			return test_path(targetpath, system_path, NULL, subfolder_name);
-		} else {
+		}
+		else {
 			BLI_strncpy(targetpath, system_path, FILE_MAX);
 			return 1;
 		}
@@ -1030,7 +1043,7 @@ static int get_path_system(char *targetpath, const char *folder_name, const char
 		BLI_snprintf(system_path, FILE_MAX, BLENDER_SYSTEM_FORMAT, system_base_path, blender_version_decimal(ver));
 	}
 	
-	if(!system_path[0])
+	if (!system_path[0])
 		return 0;
 	
 #ifdef PATH_DEBUG2
@@ -1040,7 +1053,8 @@ static int get_path_system(char *targetpath, const char *folder_name, const char
 	if (subfolder_name) {
 		/* try $BLENDERPATH/folder_name/subfolder_name */
 		return test_path(targetpath, system_path, folder_name, subfolder_name);
-	} else {
+	}
+	else {
 		/* try $BLENDERPATH/folder_name */
 		return test_path(targetpath, system_path, NULL, folder_name);
 	}
@@ -1153,12 +1167,12 @@ char *BLI_get_folder_version(const int id, const int ver, const int do_check)
 		ok= get_path_system(path, NULL, NULL, NULL, ver);
 		break;
 	default:
-		path[0]= '\0'; /* incase do_check is false */
+		path[0]= '\0'; /* in case do_check is false */
 		ok= FALSE;
 		BLI_assert(!"incorrect ID");
 	}
 
-	if((ok == FALSE) && do_check) {
+	if ((ok == FALSE) && do_check) {
 		return NULL;
 	}
 
@@ -1187,7 +1201,9 @@ void BLI_setenv(const char *env, const char*val)
 
 	/* non-free windows */
 #elif (defined(WIN32) || defined(WIN64)) /* not free windows */
-	_putenv_s(env, val);
+	uputenv(env, val);
+
+
 #else
 	/* linux/osx/bsd */
 	setenv(env, val, 1);
@@ -1196,22 +1212,22 @@ void BLI_setenv(const char *env, const char*val)
 
 
 /**
- Only set an env var if already not there.
- Like Unix setenv(env, val, 0);
+ * Only set an env var if already not there.
+ * Like Unix setenv(env, val, 0);
  */
 void BLI_setenv_if_new(const char *env, const char* val)
 {
-	if(getenv(env) == NULL)
+	if (getenv(env) == NULL)
 		BLI_setenv(env, val);
 }
 
 
 void BLI_clean(char *path)
 {
-	if(path==NULL) return;
+	if (path==NULL) return;
 
 #ifdef WIN32
-	if(path && BLI_strnlen(path, 3) > 2) {
+	if (path && BLI_strnlen(path, 3) > 2) {
 		BLI_char_switch(path+2, '/', '\\');
 	}
 #else
@@ -1221,7 +1237,7 @@ void BLI_clean(char *path)
 
 void BLI_char_switch(char *string, char from, char to) 
 {
-	if(string==NULL) return;
+	if (string==NULL) return;
 	while (*string != 0) {
 		if (*string == from) *string = to;
 		string++;
@@ -1236,9 +1252,9 @@ void BLI_make_exist(char *dir)
 
 	a = strlen(dir);
 
-	while(BLI_is_dir(dir) == 0){
+	while (BLI_is_dir(dir) == 0) {
 		a --;
-		while(dir[a] != SEP){
+		while (dir[a] != SEP) {
 			a--;
 			if (a <= 0) break;
 		}
@@ -1288,13 +1304,13 @@ void BLI_make_file_string(const char *relabase, char *string,  const char *dir,
 
 
 	/* we first push all slashes into unix mode, just to make sure we don't get
-	   any mess with slashes later on. -jesterKing */
+	 * any mess with slashes later on. -jesterKing */
 	/* constant strings can be passed for those parameters - don't change them - elubie */
-	/*
+#if 0
 	BLI_char_switch(relabase, '\\', '/');
 	BLI_char_switch(dir, '\\', '/');
 	BLI_char_switch(file, '\\', '/');
-	*/
+#endif
 
 	/* Resolve relative references */	
 	if (relabase && dir[0] == '/' && dir[1] == '/') {
@@ -1304,7 +1320,7 @@ void BLI_make_file_string(const char *relabase, char *string,  const char *dir,
 		strcpy(string, relabase);
 		
 		lslash= BLI_last_slash(string);
-		if(lslash) *(lslash+1)= 0;
+		if (lslash) *(lslash+1)= 0;
 
 		dir+=2; /* Skip over the relative reference */
 	}
@@ -1360,11 +1376,13 @@ int BLI_testextensie(const char *str, const char *ext)
 	a= strlen(str);
 	b= strlen(ext);
 	
-	if(a==0 || b==0 || b>=a) {
+	if (a==0 || b==0 || b>=a) {
 		retval = 0;
-	} else if (BLI_strcasecmp(ext, str + a - b)) {
+	}
+	else if (BLI_strcasecmp(ext, str + a - b)) {
 		retval = 0;	
-	} else {
+	}
+	else {
 		retval = 1;
 	}
 	
@@ -1374,8 +1392,8 @@ int BLI_testextensie(const char *str, const char *ext)
 int BLI_testextensie_array(const char *str, const char **ext_array)
 {
 	int i=0;
-	while(ext_array[i]) {
-		if(BLI_testextensie(str, ext_array[i])) {
+	while (ext_array[i]) {
+		if (BLI_testextensie(str, ext_array[i])) {
 			return 1;
 		}
 
@@ -1391,11 +1409,11 @@ int BLI_testextensie_glob(const char *str, const char *ext_fnmatch)
 	const char *ext_step= ext_fnmatch;
 	char pattern[16];
 
-	while(ext_step[0]) {
+	while (ext_step[0]) {
 		char *ext_next;
 		int len_ext;
 
-		if((ext_next=strchr(ext_step, ';'))) {
+		if ((ext_next=strchr(ext_step, ';'))) {
 			len_ext= (int)(ext_next - ext_step) + 1;
 		}
 		else {
@@ -1404,7 +1422,7 @@ int BLI_testextensie_glob(const char *str, const char *ext_fnmatch)
 
 		BLI_strncpy(pattern, ext_step, len_ext);
 
-		if(fnmatch(pattern, str, FNM_CASEFOLD)==0) {
+		if (fnmatch(pattern, str, FNM_CASEFOLD)==0) {
 			return 1;
 		}
 		ext_step += len_ext;
@@ -1420,7 +1438,7 @@ int BLI_replace_extension(char *path, size_t maxlen, const char *ext)
 	size_t ext_len= strlen(ext);
 	ssize_t a;
 
-	for(a= path_len - 1; a >= 0; a--) {
+	for (a= path_len - 1; a >= 0; a--) {
 		if (ELEM3(path[a], '.', '/', '\\')) {
 			break;
 		}
@@ -1430,7 +1448,7 @@ int BLI_replace_extension(char *path, size_t maxlen, const char *ext)
 		a= path_len;
 	}
 
-	if(a + ext_len >= maxlen)
+	if (a + ext_len >= maxlen)
 		return 0;
 
 	memcpy(path+a, ext, ext_len + 1);
@@ -1451,7 +1469,7 @@ int BLI_ensure_extension(char *path, size_t maxlen, const char *ext)
 		return 1;
 	}
 
-	for(a= path_len - 1; a >= 0; a--) {
+	for (a= path_len - 1; a >= 0; a--) {
 		if (path[a] == '.') {
 			path[a]= '\0';
 		}
@@ -1461,7 +1479,7 @@ int BLI_ensure_extension(char *path, size_t maxlen, const char *ext)
 	}
 	a++;
 
-	if(a + ext_len >= maxlen)
+	if (a + ext_len >= maxlen)
 		return 0;
 
 	memcpy(path+a, ext, ext_len + 1);
@@ -1481,7 +1499,7 @@ void BLI_split_dirfile(const char *string, char *dir, char *file, const size_t d
 
 	if (dir) {
 		if (lslash) {
-			BLI_strncpy( dir, string, MIN2(dirlen, lslash + 1)); /* +1 to include the slash and the last char */
+			BLI_strncpy(dir, string, MIN2(dirlen, lslash + 1)); /* +1 to include the slash and the last char */
 		}
 		else {
 			dir[0] = '\0';
@@ -1509,7 +1527,7 @@ void BLI_join_dirfile(char *dst, const size_t maxlen, const char *dir, const cha
 	size_t dirlen= BLI_strnlen(dir, maxlen);
 
 	if (dst != dir) {
-		if(dirlen  == maxlen) {
+		if (dirlen  == maxlen) {
 			memcpy(dst, dir, dirlen);
 			dst[dirlen - 1]= '\0';
 			return; /* dir fills the path */
@@ -1524,9 +1542,9 @@ void BLI_join_dirfile(char *dst, const size_t maxlen, const char *dir, const cha
 	}
 
 	/* inline BLI_add_slash */
-	if (dst[dirlen - 1] != SEP) {
-		dst[dirlen++]= SEP;
-		dst[dirlen  ]= '\0';
+	if ((dirlen > 0) && (dst[dirlen - 1] != SEP)) {
+		dst[dirlen++] = SEP;
+		dst[dirlen  ] = '\0';
 	}
 
 	if (dirlen >= maxlen) {
@@ -1547,31 +1565,31 @@ char *BLI_path_basename(char *path)
 	return filename ? filename + 1 : path;
 }
 
-/*
-  Produce image export path.
-
-  Fails returning 0 if image filename is empty or if destination path
-  matches image path (i.e. both are the same file).
-
-  Trailing slash in dest_dir is optional.
-
-  Logic:
-
-  - if an image is "below" current .blend file directory, rebuild the
-	same dir structure in dest_dir
-
-  For example //textures/foo/bar.png becomes
-  [dest_dir]/textures/foo/bar.png.
-
-  - if an image is not "below" current .blend file directory,
-  disregard it's path and copy it in the same directory where 3D file
-  goes.
-
-  For example //../foo/bar.png becomes [dest_dir]/bar.png.
-
-  This logic will help ensure that all image paths are relative and
-  that a user gets his images in one place. It'll also provide
-  consistent behaviour across exporters.
+/**
+ * Produce image export path.
+ *
+ * Fails returning 0 if image filename is empty or if destination path
+ * matches image path (i.e. both are the same file).
+ *
+ * Trailing slash in dest_dir is optional.
+ *
+ * Logic:
+ *
+ * - if an image is "below" current .blend file directory, rebuild the
+ * same dir structure in dest_dir
+ *
+ * For example //textures/foo/bar.png becomes
+ * [dest_dir]/textures/foo/bar.png.
+ *
+ * - if an image is not "below" current .blend file directory,
+ * disregard it's path and copy it in the same directory where 3D file
+ * goes.
+ *
+ * For example //../foo/bar.png becomes [dest_dir]/bar.png.
+ *
+ * This logic will help ensure that all image paths are relative and
+ * that a user gets his images in one place. It'll also provide
+ * consistent behavior across exporters.
  */
 int BKE_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const char *base_dir, const char *src_dir, const char *dest_dir)
 {
@@ -1638,7 +1656,7 @@ int BKE_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const
 
 	/* return 2 if src=dest */
 	if (BLI_path_cmp(path, dest_path) == 0) {
-		// if (G.f & G_DEBUG) printf("%s and %s are the same file\n", path, dest_path);
+		// if (G.debug & G_DEBUG) printf("%s and %s are the same file\n", path, dest_path);
 		return 2;
 	}
 
@@ -1673,7 +1691,7 @@ char *BLI_last_slash(const char *string)
 	else return lfslash;
 }
 
-/* adds a slash if there isnt one there already */
+/* adds a slash if there isn't one there already */
 int BLI_add_slash(char *string)
 {
 	int len = strlen(string);
@@ -1693,7 +1711,8 @@ void BLI_del_slash(char *string)
 		if (string[len-1] == SEP) {
 			string[len-1] = '\0';
 			len--;
-		} else {
+		}
+		else {
 			break;
 		}
 	}
@@ -1720,7 +1739,8 @@ static int add_win32_extension(char *name)
 					ext[temp - extensions] = 0;
 					extensions = temp + 1;
 					strcat(filename, ext);
-				} else {
+				}
+				else {
 					strcat(filename, extensions);
 				}
 
@@ -1733,25 +1753,26 @@ static int add_win32_extension(char *name)
 			} while (temp);
 		}
 #endif
-	} else {
+	}
+	else {
 		retval = 1;
 	}
 
 	return (retval);
 }
 
-/*
-* Checks if name is a fully qualified filename to an executable.
-* If not it searches $PATH for the file. On Windows it also
-* adds the correct extension (.com .exe etc) from
-* $PATHEXT if necessary. Also on Windows it translates
-* the name to its 8.3 version to prevent problems with
-* spaces and stuff. Final result is returned in fullname.
-*
-* @param fullname The full path and full name of the executable
-* (must be FILE_MAX minimum)
-* @param name The name of the executable (usually argv[0]) to be checked
-*/
+/**
+ * Checks if name is a fully qualified filename to an executable.
+ * If not it searches $PATH for the file. On Windows it also
+ * adds the correct extension (.com .exe etc) from
+ * $PATHEXT if necessary. Also on Windows it translates
+ * the name to its 8.3 version to prevent problems with
+ * spaces and stuff. Final result is returned in fullname.
+ *
+ * \param fullname The full path and full name of the executable
+ * (must be FILE_MAX minimum)
+ * \param name The name of the executable (usually argv[0]) to be checked
+ */
 static void bli_where_am_i(char *fullname, const size_t maxlen, const char *name)
 {
 	char filename[FILE_MAX];
@@ -1775,24 +1796,30 @@ static void bli_where_am_i(char *fullname, const size_t maxlen, const char *name
 #endif
 
 #ifdef _WIN32
-	if(GetModuleFileName(0, fullname, maxlen)) {
-		if(!BLI_exists(fullname)) {
+	wchar_t * fullname_16 = MEM_mallocN(maxlen*sizeof(wchar_t), "ProgramPath");
+	if (GetModuleFileNameW(0, fullname_16, maxlen)) {
+		conv_utf_16_to_8(fullname_16,fullname, maxlen);
+		if (!BLI_exists(fullname)) {
 			printf("path can't be found: \"%.*s\"\n", maxlen, fullname);
 			MessageBox(NULL, "path contains invalid characters or is too long (see console)", "Error", MB_OK);
 		}
+		MEM_freeN(fullname_16);
 		return;
 	}
+
+	MEM_freeN(fullname_16);
 #endif
 
 	/* unix and non linux */
 	if (name && name[0]) {
+
 		BLI_strncpy(fullname, name, maxlen);
 		if (name[0] == '.') {
 			char wdir[FILE_MAX]= "";
 			BLI_current_working_dir(wdir, sizeof(wdir));	 /* backup cwd to restore after */
 
 			// not needed but avoids annoying /./ in name
-			if(name[1]==SEP)
+			if (name[1]==SEP)
 				BLI_join_dirfile(fullname, maxlen, wdir, name+2);
 			else
 				BLI_join_dirfile(fullname, maxlen, wdir, name);
@@ -1803,7 +1830,8 @@ static void bli_where_am_i(char *fullname, const size_t maxlen, const char *name
 			// full path
 			BLI_strncpy(fullname, name, maxlen);
 			add_win32_extension(fullname);
-		} else {
+		}
+		else {
 			// search for binary in $PATH
 			path = getenv("PATH");
 			if (path) {
@@ -1813,7 +1841,8 @@ static void bli_where_am_i(char *fullname, const size_t maxlen, const char *name
 						strncpy(filename, path, temp - path);
 						filename[temp - path] = 0;
 						path = temp + 1;
-					} else {
+					}
+					else {
 						strncpy(filename, path, sizeof(filename));
 					}
 					BLI_join_dirfile(fullname, maxlen, fullname, name);
@@ -1849,14 +1878,15 @@ const char *BLI_program_dir(void)
 }
 
 /**
-* Gets the temp directory when blender first runs.
-* If the default path is not found, use try $TEMP
-* 
-* Also make sure the temp dir has a trailing slash
-*
-* @param fullname The full path to the temp directory
-* @param userdir Directory specified in user preferences 
-*/
+ * Gets the temp directory when blender first runs.
+ * If the default path is not found, use try $TEMP
+ * 
+ * Also make sure the temp dir has a trailing slash
+ *
+ * \param fullname The full path to the temp directory
+ * \param maxlen The size of the fullname buffer
+ * \param userdir Directory specified in user preferences 
+ */
 static void BLI_where_is_temp(char *fullname, const size_t maxlen, char *userdir)
 {
 	fullname[0] = '\0';
@@ -1892,11 +1922,12 @@ static void BLI_where_is_temp(char *fullname, const size_t maxlen, char *userdir
 	
 	if (fullname[0] == '\0') {
 		BLI_strncpy(fullname, "/tmp/", maxlen);
-	} else {
+	}
+	else {
 		/* add a trailing slash if needed */
 		BLI_add_slash(fullname);
 #ifdef WIN32
-		if(userdir && userdir != fullname) {
+		if (userdir && userdir != fullname) {
 			BLI_strncpy(userdir, fullname, maxlen); /* also set user pref to show %TEMP%. /tmp/ is just plain confusing for Windows users. */
 		}
 #endif
@@ -1935,12 +1966,12 @@ void BLI_string_to_utf8(char *original, char *utf_8, const char *code)
 	if (cd == (iconv_t)(-1)) {
 		printf("iconv_open Error");
 		*utf_8='\0';
-		return ;
+		return;
 	}
 	rv=iconv(cd, &original, &inbytesleft, &utf_8, &outbytesleft);
 	if (rv == (size_t) -1) {
 		printf("iconv Error\n");
-		return ;
+		return;
 	}
 	*utf_8 = '\0';
 	iconv_close(cd);
diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c
index 5c7a29c..7a955cf 100644
--- a/source/blender/blenlib/intern/pbvh.c
+++ b/source/blender/blenlib/intern/pbvh.c
@@ -28,6 +28,7 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "BLI_bitmap.h"
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
 #include "BLI_ghash.h"
@@ -36,6 +37,8 @@
 #include "BKE_DerivedMesh.h"
 #include "BKE_mesh.h" /* for mesh_calc_normals */
 #include "BKE_global.h" /* for mesh_calc_normals */
+#include "BKE_paint.h"
+#include "BKE_subsurf.h"
 
 #include "GPU_buffers.h"
 
@@ -43,31 +46,6 @@
 
 //#define PERFCNTRS
 
-/* Bitmap */
-typedef char* BLI_bitmap;
-
-static BLI_bitmap BLI_bitmap_new(int tot)
-{
-	return MEM_callocN((tot >> 3) + 1, "BLI bitmap");
-}
-
-static int BLI_bitmap_get(BLI_bitmap b, int index)
-{
-	return b[index >> 3] & (1 << (index & 7));
-}
-
-static void BLI_bitmap_set(BLI_bitmap b, int index)
-{
-	b[index >> 3] |= (1 << (index & 7));
-}
-
-#if 0 /* UNUSED */
-static void BLI_bitmap_clear(BLI_bitmap b, int index)
-{
-	b[index >> 3] &= ~(1 << (index & 7));
-}
-#endif
-
 /* Axis-aligned bounding box */
 typedef struct {
 	float bmin[3], bmax[3];
@@ -87,52 +65,52 @@ struct PBVHNode {
 	BB orig_vb;
 
 	/* For internal nodes, the offset of the children in the PBVH
-	   'nodes' array. */
+	 * 'nodes' array. */
 	int children_offset;
 
 	/* Pointer into the PBVH prim_indices array and the number of
-	   primitives used by this leaf node.
-
-	   Used for leaf nodes in both mesh- and multires-based PBVHs.
-	*/
+	 * primitives used by this leaf node.
+	 *
+	 * Used for leaf nodes in both mesh- and multires-based PBVHs.
+	 */
 	int *prim_indices;
 	unsigned int totprim;
 
 	/* Array of indices into the mesh's MVert array. Contains the
-	   indices of all vertices used by faces that are within this
-	   node's bounding box.
-
-	   Note that a vertex might be used by a multiple faces, and
-	   these faces might be in different leaf nodes. Such a vertex
-	   will appear in the vert_indices array of each of those leaf
-	   nodes.
-
-	   In order to support cases where you want access to multiple
-	   nodes' vertices without duplication, the vert_indices array
-	   is ordered such that the first part of the array, up to
-	   index 'uniq_verts', contains "unique" vertex indices. These
-	   vertices might not be truly unique to this node, but if
-	   they appear in another node's vert_indices array, they will
-	   be above that node's 'uniq_verts' value.
-
-	   Used for leaf nodes in a mesh-based PBVH (not multires.)
-	*/
+	 * indices of all vertices used by faces that are within this
+	 * node's bounding box.
+	 *
+	 * Note that a vertex might be used by a multiple faces, and
+	 * these faces might be in different leaf nodes. Such a vertex
+	 * will appear in the vert_indices array of each of those leaf
+	 * nodes.
+	 *
+	 * In order to support cases where you want access to multiple
+	 * nodes' vertices without duplication, the vert_indices array
+	 * is ordered such that the first part of the array, up to
+	 * index 'uniq_verts', contains "unique" vertex indices. These
+	 * vertices might not be truly unique to this node, but if
+	 * they appear in another node's vert_indices array, they will
+	 * be above that node's 'uniq_verts' value.
+	 *
+	 * Used for leaf nodes in a mesh-based PBVH (not multires.)
+	 */
 	int *vert_indices;
 	unsigned int uniq_verts, face_verts;
 
 	/* An array mapping face corners into the vert_indices
-	   array. The array is sized to match 'totprim', and each of
-	   the face's corners gets an index into the vert_indices
-	   array, in the same order as the corners in the original
-	   MFace. The fourth value should not be used if the original
-	   face is a triangle.
-
-	   Used for leaf nodes in a mesh-based PBVH (not multires.)
-	*/
+	 * array. The array is sized to match 'totprim', and each of
+	 * the face's corners gets an index into the vert_indices
+	 * array, in the same order as the corners in the original
+	 * MFace. The fourth value should not be used if the original
+	 * face is a triangle.
+	 *
+	 * Used for leaf nodes in a mesh-based PBVH (not multires.)
+	 */
 	int (*face_vert_indices)[4];
 
 	/* Indicates whether this node is a leaf or not; also used for
-	   marking various updates that need to be applied. */
+	 * marking various updates that need to be applied. */
 	PBVHNodeFlags flag : 8;
 
 	/* Used for raycasting: how close bb is to the ray point. */
@@ -143,6 +121,8 @@ struct PBVHNode {
 };
 
 struct PBVH {
+	PBVHType type;
+
 	PBVHNode *nodes;
 	int node_mem_count, totnode;
 
@@ -160,11 +140,13 @@ struct PBVH {
 	DMGridData **grids;
 	DMGridAdjacency *gridadj;
 	void **gridfaces;
+	const DMFlagMat *grid_flag_mats;
 	int totgrid;
 	int gridsize;
+	BLI_bitmap *grid_hidden;
 
 	/* Only used during BVH build and update,
-	   don't need to remain valid after */
+	 * don't need to remain valid after */
 	BLI_bitmap vert_bitmap;
 
 #ifdef PERFCNTRS
@@ -204,7 +186,7 @@ static void BB_reset(BB *bb)
 static void BB_expand(BB *bb, float co[3])
 {
 	int i;
-	for(i = 0; i < 3; ++i) {
+	for (i = 0; i < 3; ++i) {
 		bb->bmin[i] = MIN2(bb->bmin[i], co[i]);
 		bb->bmax[i] = MAX2(bb->bmax[i], co[i]);
 	}
@@ -214,7 +196,7 @@ static void BB_expand(BB *bb, float co[3])
 static void BB_expand_with_bb(BB *bb, BB *bb2)
 {
 	int i;
-	for(i = 0; i < 3; ++i) {
+	for (i = 0; i < 3; ++i) {
 		bb->bmin[i] = MIN2(bb->bmin[i], bb2->bmin[i]);
 		bb->bmax[i] = MAX2(bb->bmax[i], bb2->bmax[i]);
 	}
@@ -226,17 +208,17 @@ static int BB_widest_axis(BB *bb)
 	float dim[3];
 	int i;
 
-	for(i = 0; i < 3; ++i)
+	for (i = 0; i < 3; ++i)
 		dim[i] = bb->bmax[i] - bb->bmin[i];
 
-	if(dim[0] > dim[1]) {
-		if(dim[0] > dim[2])
+	if (dim[0] > dim[1]) {
+		if (dim[0] > dim[2])
 			return 0;
 		else
 			return 2;
 	}
 	else {
-		if(dim[1] > dim[2])
+		if (dim[1] > dim[2])
 			return 1;
 		else
 			return 2;
@@ -246,7 +228,7 @@ static int BB_widest_axis(BB *bb)
 static void BBC_update_centroid(BBC *bbc)
 {
 	int i;
-	for(i = 0; i < 3; ++i)
+	for (i = 0; i < 3; ++i)
 		bbc->bcentroid[i] = (bbc->bmin[i] + bbc->bmax[i]) * 0.5f;
 }
 
@@ -257,7 +239,7 @@ static void update_node_vb(PBVH *bvh, PBVHNode *node)
 
 	BB_reset(&vb);
 	
-	if(node->flag & PBVH_Leaf) {
+	if (node->flag & PBVH_Leaf) {
 		PBVHVertexIter vd;
 
 		BLI_pbvh_vertex_iter_begin(bvh, node, vd, PBVH_ITER_ALL) {
@@ -285,6 +267,17 @@ static void update_node_vb(PBVH *bvh, PBVHNode *node)
 //	BB_expand(&node->vb, co);
 //}
 
+static int face_materials_match(const MFace *f1, const MFace *f2)
+{
+	return ((f1->flag & ME_SMOOTH) == (f2->flag & ME_SMOOTH) &&
+			(f1->mat_nr == f2->mat_nr));
+}
+
+static int grid_materials_match(const DMFlagMat *f1, const DMFlagMat *f2)
+{
+	return ((f1->flag & ME_SMOOTH) == (f2->flag & ME_SMOOTH) &&
+			(f1->mat_nr == f2->mat_nr));
+}
 
 /* Adapted from BLI_kdopbvh.c */
 /* Returns the index of the first element on the right of the partition */
@@ -292,11 +285,11 @@ static int partition_indices(int *prim_indices, int lo, int hi, int axis,
 				 float mid, BBC *prim_bbc)
 {
 	int i=lo, j=hi;
-	for(;;) {
-		for(; prim_bbc[prim_indices[i]].bcentroid[axis] < mid; i++);
-		for(; mid < prim_bbc[prim_indices[j]].bcentroid[axis]; j--);
+	for (;;) {
+		for (; prim_bbc[prim_indices[i]].bcentroid[axis] < mid; i++);
+		for (; mid < prim_bbc[prim_indices[j]].bcentroid[axis]; j--);
 		
-		if(!(i < j))
+		if (!(i < j))
 			return i;
 		
 		SWAP(int, prim_indices[i], prim_indices[j]);
@@ -304,26 +297,44 @@ static int partition_indices(int *prim_indices, int lo, int hi, int axis,
 	}
 }
 
-static void check_partitioning(int *prim_indices, int lo, int hi, int axis,
-				   float mid, BBC *prim_bbc, int index_of_2nd_partition)
+/* Returns the index of the first element on the right of the partition */
+static int partition_indices_material(PBVH *bvh, int lo, int hi)
 {
-	int i;
-	for(i = lo; i <= hi; ++i) {
-		const float c = prim_bbc[prim_indices[i]].bcentroid[axis];
+	const MFace *faces = bvh->faces;
+	const DMFlagMat *flagmats = bvh->grid_flag_mats;
+	const int *indices = bvh->prim_indices;
+	const void *first;
+	int i=lo, j=hi;
+
+	if (bvh->faces)
+		first = &faces[bvh->prim_indices[lo]];
+	else
+		first = &flagmats[bvh->prim_indices[lo]];
 
-		if((i < index_of_2nd_partition && c > mid) ||
-		   (i > index_of_2nd_partition && c < mid)) {
-			printf("fail\n");
+	for (;;) {
+		if (bvh->faces) {
+			for (; face_materials_match(first, &faces[indices[i]]); i++);
+			for (; !face_materials_match(first, &faces[indices[j]]); j--);
+		}
+		else {
+			for (; grid_materials_match(first, &flagmats[indices[i]]); i++);
+			for (; !grid_materials_match(first, &flagmats[indices[j]]); j--);
 		}
+		
+		if (!(i < j))
+			return i;
+
+		SWAP(int, bvh->prim_indices[i], bvh->prim_indices[j]);
+		i++;
 	}
 }
 
 static void grow_nodes(PBVH *bvh, int totnode)
 {
-	if(totnode > bvh->node_mem_count) {
+	if (totnode > bvh->node_mem_count) {
 		PBVHNode *prev = bvh->nodes;
 		bvh->node_mem_count *= 1.33;
-		if(bvh->node_mem_count < totnode)
+		if (bvh->node_mem_count < totnode)
 			bvh->node_mem_count = totnode;
 		bvh->nodes = MEM_callocN(sizeof(PBVHNode) * bvh->node_mem_count,
 					 "bvh nodes");
@@ -335,20 +346,20 @@ static void grow_nodes(PBVH *bvh, int totnode)
 }
 
 /* Add a vertex to the map, with a positive value for unique vertices and
-   a negative value for additional vertices */
+ * a negative value for additional vertices */
 static int map_insert_vert(PBVH *bvh, GHash *map,
 				unsigned int *face_verts,
 				unsigned int *uniq_verts, int vertex)
 {
 	void *value, *key = SET_INT_IN_POINTER(vertex);
 
-	if(!BLI_ghash_haskey(map, key)) {
-		if(BLI_bitmap_get(bvh->vert_bitmap, vertex)) {
+	if (!BLI_ghash_haskey(map, key)) {
+		if (BLI_BITMAP_GET(bvh->vert_bitmap, vertex)) {
 			value = SET_INT_IN_POINTER(~(*face_verts));
 			++(*face_verts);
 		}
 		else {
-			BLI_bitmap_set(bvh->vert_bitmap, vertex);
+			BLI_BITMAP_SET(bvh->vert_bitmap, vertex);
 			value = SET_INT_IN_POINTER(*uniq_verts);
 			++(*uniq_verts);
 		}
@@ -375,11 +386,11 @@ static void build_mesh_leaf_node(PBVH *bvh, PBVHNode *node)
 	node->face_vert_indices = MEM_callocN(sizeof(int) * 4*totface,
 					      "bvh node face vert indices");
 
-	for(i = 0; i < totface; ++i) {
+	for (i = 0; i < totface; ++i) {
 		MFace *f = bvh->faces + node->prim_indices[i];
 		int sides = f->v4 ? 4 : 3;
 
-		for(j = 0; j < sides; ++j) {
+		for (j = 0; j < sides; ++j) {
 			node->face_vert_indices[i][j]= 
 				map_insert_vert(bvh, map, &node->face_verts,
 						&node->uniq_verts, (&f->v1)[j]);
@@ -391,13 +402,13 @@ static void build_mesh_leaf_node(PBVH *bvh, PBVHNode *node)
 					 "bvh node vert indices");
 
 	/* Build the vertex list, unique verts first */
-	for(iter = BLI_ghashIterator_new(map), i = 0;
+	for (iter = BLI_ghashIterator_new(map), i = 0;
 		!BLI_ghashIterator_isDone(iter);
 		BLI_ghashIterator_step(iter), ++i) {
 		void *value = BLI_ghashIterator_getValue(iter);
 		int ndx = GET_INT_FROM_POINTER(value);
 
-		if(ndx < 0)
+		if (ndx < 0)
 			ndx = -ndx + node->uniq_verts - 1;
 
 		node->vert_indices[ndx] =
@@ -406,25 +417,24 @@ static void build_mesh_leaf_node(PBVH *bvh, PBVHNode *node)
 
 	BLI_ghashIterator_free(iter);
 
-	for(i = 0; i < totface; ++i) {
+	for (i = 0; i < totface; ++i) {
 		MFace *f = bvh->faces + node->prim_indices[i];
 		int sides = f->v4 ? 4 : 3;
 		
-		for(j = 0; j < sides; ++j) {
-			if(node->face_vert_indices[i][j] < 0)
+		for (j = 0; j < sides; ++j) {
+			if (node->face_vert_indices[i][j] < 0)
 				node->face_vert_indices[i][j]=
 					-node->face_vert_indices[i][j] +
 					node->uniq_verts - 1;
 		}
 	}
 
-	if(!G.background) {
+	if (!G.background) {
 		node->draw_buffers =
-			GPU_build_mesh_buffers(map, bvh->verts, bvh->faces,
+			GPU_build_mesh_buffers(node->face_vert_indices,
+					bvh->faces, bvh->verts,
 					node->prim_indices,
-					node->totprim, node->vert_indices,
-					node->uniq_verts,
-					node->uniq_verts + node->face_verts);
+					node->totprim);
 	}
 
 	node->flag |= PBVH_UpdateDrawBuffers;
@@ -434,107 +444,151 @@ static void build_mesh_leaf_node(PBVH *bvh, PBVHNode *node)
 
 static void build_grids_leaf_node(PBVH *bvh, PBVHNode *node)
 {
-	if(!G.background) {
+	if (!G.background) {
 		node->draw_buffers =
-			GPU_build_grid_buffers(bvh->grids, node->prim_indices,
-				node->totprim, bvh->gridsize);
+			GPU_build_grid_buffers(node->prim_indices,
+				node->totprim, bvh->grid_hidden, bvh->gridsize);
 	}
 	node->flag |= PBVH_UpdateDrawBuffers;
 }
 
-/* Recursively build a node in the tree
+static void update_vb(PBVH *bvh, PBVHNode *node, BBC *prim_bbc,
+					  int offset, int count)
+{
+	int i;
+	
+	BB_reset(&node->vb);
+	for (i = offset + count - 1; i >= offset; --i) {
+		BB_expand_with_bb(&node->vb, (BB*)(&prim_bbc[bvh->prim_indices[i]]));
+	}
+	node->orig_vb = node->vb;
+}
+
+static void build_leaf(PBVH *bvh, int node_index, BBC *prim_bbc,
+					   int offset, int count)
+{
+	bvh->nodes[node_index].flag |= PBVH_Leaf;
+
+	bvh->nodes[node_index].prim_indices = bvh->prim_indices + offset;
+	bvh->nodes[node_index].totprim = count;
+
+	/* Still need vb for searches */
+	update_vb(bvh, &bvh->nodes[node_index], prim_bbc, offset, count);
+		
+	if (bvh->faces)
+		build_mesh_leaf_node(bvh, bvh->nodes + node_index);
+	else
+		build_grids_leaf_node(bvh, bvh->nodes + node_index);
+}
+
+/* Return zero if all primitives in the node can be drawn with the
+ * same material (including flat/smooth shading), non-zerootherwise */
+int leaf_needs_material_split(PBVH *bvh, int offset, int count)
+{
+	int i, prim;
+
+	if (count <= 1)
+		return 0;
+
+	if (bvh->faces) {
+		const MFace *first = &bvh->faces[bvh->prim_indices[offset]];
+
+		for (i = offset + count - 1; i > offset; --i) {
+			prim = bvh->prim_indices[i];
+			if (!face_materials_match(first, &bvh->faces[prim]))
+				return 1;
+		}
+	}
+	else {
+		const DMFlagMat *first = &bvh->grid_flag_mats[bvh->prim_indices[offset]];
 
-   vb is the voxel box around all of the primitives contained in
-   this node.
+		for (i = offset + count - 1; i > offset; --i) {
+			prim = bvh->prim_indices[i];
+			if (!grid_materials_match(first, &bvh->grid_flag_mats[prim]))
+				return 1;
+		}
+	}
 
-   cb is the bounding box around all the centroids of the primitives
-   contained in this node
+	return 0;
+}
 
-   offset and start indicate a range in the array of primitive indices
-*/
+
+/* Recursively build a node in the tree
+ *
+ * vb is the voxel box around all of the primitives contained in
+ * this node.
+ *
+ * cb is the bounding box around all the centroids of the primitives
+ * contained in this node
+ *
+ * offset and start indicate a range in the array of primitive indices
+ */
 
 static void build_sub(PBVH *bvh, int node_index, BB *cb, BBC *prim_bbc,
-		   int offset, int count)
+					  int offset, int count)
 {
-	int i, axis, end;
+	int i, axis, end, below_leaf_limit;
 	BB cb_backing;
 
 	/* Decide whether this is a leaf or not */
-	// XXX adapt leaf limit for grids
-	if(count <= bvh->leaf_limit) {
-		bvh->nodes[node_index].flag |= PBVH_Leaf;
-
-		bvh->nodes[node_index].prim_indices = bvh->prim_indices + offset;
-		bvh->nodes[node_index].totprim = count;
-
-		/* Still need vb for searches */
-		BB_reset(&bvh->nodes[node_index].vb);
-		for(i = offset + count - 1; i >= offset; --i) {
-			BB_expand_with_bb(&bvh->nodes[node_index].vb,
-					  (BB*)(prim_bbc +
-						bvh->prim_indices[i]));
+	below_leaf_limit = count <= bvh->leaf_limit;
+	if (below_leaf_limit) {
+		if (!leaf_needs_material_split(bvh, offset, count)) {
+			build_leaf(bvh, node_index, prim_bbc, offset, count);
+			return;
 		}
-		
-		if(bvh->faces)
-			build_mesh_leaf_node(bvh, bvh->nodes + node_index);
-		else
-			build_grids_leaf_node(bvh, bvh->nodes + node_index);
-		bvh->nodes[node_index].orig_vb= bvh->nodes[node_index].vb;
-
-		/* Done with this subtree */
-		return;
 	}
-	else {
-		BB_reset(&bvh->nodes[node_index].vb);
-		bvh->nodes[node_index].children_offset = bvh->totnode;
-		grow_nodes(bvh, bvh->totnode + 2);
 
-		if(!cb) {
+	/* Add two child nodes */
+	bvh->nodes[node_index].children_offset = bvh->totnode;
+	grow_nodes(bvh, bvh->totnode + 2);
+
+	/* Update parent node bounding box */
+	update_vb(bvh, &bvh->nodes[node_index], prim_bbc, offset, count);
+
+	if (!below_leaf_limit) {
+		/* Find axis with widest range of primitive centroids */
+		if (!cb) {
 			cb = &cb_backing;
 			BB_reset(cb);
-			for(i = offset + count - 1; i >= offset; --i)
+			for (i = offset + count - 1; i >= offset; --i)
 				BB_expand(cb, prim_bbc[bvh->prim_indices[i]].bcentroid);
 		}
+		axis = BB_widest_axis(cb);
+
+		/* Partition primitives along that axis */
+		end = partition_indices(bvh->prim_indices,
+								offset, offset + count - 1,
+								axis,
+								(cb->bmax[axis] + cb->bmin[axis]) * 0.5f,
+								prim_bbc);
 	}
-
-	axis = BB_widest_axis(cb);
-
-	for(i = offset + count - 1; i >= offset; --i) {
-		BB_expand_with_bb(&bvh->nodes[node_index].vb,
-				  (BB*)(prim_bbc + bvh->prim_indices[i]));
+	else {
+		/* Partition primitives by material */
+		end = partition_indices_material(bvh, offset, offset + count - 1);
 	}
 
-	bvh->nodes[node_index].orig_vb= bvh->nodes[node_index].vb;
-
-	end = partition_indices(bvh->prim_indices, offset, offset + count - 1,
-	                        axis,
-	                        (cb->bmax[axis] + cb->bmin[axis]) * 0.5f,
-	                        prim_bbc);
-	check_partitioning(bvh->prim_indices, offset, offset + count - 1,
-	                   axis,
-	                   (cb->bmax[axis] + cb->bmin[axis]) * 0.5f,
-	                   prim_bbc, end);
-
+	/* Build children */
 	build_sub(bvh, bvh->nodes[node_index].children_offset, NULL,
-		  prim_bbc, offset, end - offset);
+			  prim_bbc, offset, end - offset);
 	build_sub(bvh, bvh->nodes[node_index].children_offset + 1, NULL,
-		  prim_bbc, end, offset + count - end);
+			  prim_bbc, end, offset + count - end);
 }
 
 static void pbvh_build(PBVH *bvh, BB *cb, BBC *prim_bbc, int totprim)
 {
 	int i;
 
-	if(totprim != bvh->totprim) {
+	if (totprim != bvh->totprim) {
 		bvh->totprim = totprim;
-		if(bvh->nodes) MEM_freeN(bvh->nodes);
-		if(bvh->prim_indices) MEM_freeN(bvh->prim_indices);
+		if (bvh->nodes) MEM_freeN(bvh->nodes);
+		if (bvh->prim_indices) MEM_freeN(bvh->prim_indices);
 		bvh->prim_indices = MEM_callocN(sizeof(int) * totprim,
 						"bvh prim indices");
-		for(i = 0; i < totprim; ++i)
+		for (i = 0; i < totprim; ++i)
 			bvh->prim_indices[i] = i;
 		bvh->totnode = 0;
-		if(bvh->node_mem_count < 100) {
+		if (bvh->node_mem_count < 100) {
 			bvh->node_mem_count = 100;
 			bvh->nodes = MEM_callocN(sizeof(PBVHNode) *
 						 bvh->node_mem_count,
@@ -553,9 +607,10 @@ void BLI_pbvh_build_mesh(PBVH *bvh, MFace *faces, MVert *verts, int totface, int
 	BB cb;
 	int i, j;
 
+	bvh->type = PBVH_FACES;
 	bvh->faces = faces;
 	bvh->verts = verts;
-	bvh->vert_bitmap = BLI_bitmap_new(totvert);
+	bvh->vert_bitmap = BLI_BITMAP_NEW(totvert, "bvh->vert_bitmap");
 	bvh->totvert = totvert;
 	bvh->leaf_limit = LEAF_LIMIT;
 
@@ -564,14 +619,14 @@ void BLI_pbvh_build_mesh(PBVH *bvh, MFace *faces, MVert *verts, int totface, int
 	/* For each face, store the AABB and the AABB centroid */
 	prim_bbc = MEM_mallocN(sizeof(BBC) * totface, "prim_bbc");
 
-	for(i = 0; i < totface; ++i) {
+	for (i = 0; i < totface; ++i) {
 		MFace *f = faces + i;
 		const int sides = f->v4 ? 4 : 3;
 		BBC *bbc = prim_bbc + i;
 
 		BB_reset((BB*)bbc);
 
-		for(j = 0; j < sides; ++j)
+		for (j = 0; j < sides; ++j)
 			BB_expand((BB*)bbc, verts[(&f->v1)[j]].co);
 
 		BBC_update_centroid(bbc);
@@ -579,7 +634,7 @@ void BLI_pbvh_build_mesh(PBVH *bvh, MFace *faces, MVert *verts, int totface, int
 		BB_expand(&cb, bbc->bcentroid);
 	}
 
-	if(totface)
+	if (totface)
 		pbvh_build(bvh, &cb, prim_bbc, totface);
 
 	MEM_freeN(prim_bbc);
@@ -588,17 +643,20 @@ void BLI_pbvh_build_mesh(PBVH *bvh, MFace *faces, MVert *verts, int totface, int
 
 /* Do a full rebuild with on Grids data structure */
 void BLI_pbvh_build_grids(PBVH *bvh, DMGridData **grids, DMGridAdjacency *gridadj,
-	int totgrid, int gridsize, void **gridfaces)
+	int totgrid, int gridsize, void **gridfaces, DMFlagMat *flagmats, BLI_bitmap *grid_hidden)
 {
 	BBC *prim_bbc = NULL;
 	BB cb;
 	int i, j;
 
+	bvh->type = PBVH_GRIDS;
 	bvh->grids= grids;
 	bvh->gridadj= gridadj;
 	bvh->gridfaces= gridfaces;
+	bvh->grid_flag_mats= flagmats;
 	bvh->totgrid= totgrid;
 	bvh->gridsize= gridsize;
+	bvh->grid_hidden= grid_hidden;
 	bvh->leaf_limit = MAX2(LEAF_LIMIT/((gridsize-1)*(gridsize-1)), 1);
 
 	BB_reset(&cb);
@@ -606,13 +664,13 @@ void BLI_pbvh_build_grids(PBVH *bvh, DMGridData **grids, DMGridAdjacency *gridad
 	/* For each grid, store the AABB and the AABB centroid */
 	prim_bbc = MEM_mallocN(sizeof(BBC) * totgrid, "prim_bbc");
 
-	for(i = 0; i < totgrid; ++i) {
+	for (i = 0; i < totgrid; ++i) {
 		DMGridData *grid= grids[i];
 		BBC *bbc = prim_bbc + i;
 
 		BB_reset((BB*)bbc);
 
-		for(j = 0; j < gridsize*gridsize; ++j)
+		for (j = 0; j < gridsize*gridsize; ++j)
 			BB_expand((BB*)bbc, grid[j].co);
 
 		BBC_update_centroid(bbc);
@@ -620,7 +678,7 @@ void BLI_pbvh_build_grids(PBVH *bvh, DMGridData **grids, DMGridAdjacency *gridad
 		BB_expand(&cb, bbc->bcentroid);
 	}
 
-	if(totgrid)
+	if (totgrid)
 		pbvh_build(bvh, &cb, prim_bbc, totgrid);
 
 	MEM_freeN(prim_bbc);
@@ -638,15 +696,15 @@ void BLI_pbvh_free(PBVH *bvh)
 	PBVHNode *node;
 	int i;
 
-	for(i = 0; i < bvh->totnode; ++i) {
+	for (i = 0; i < bvh->totnode; ++i) {
 		node= &bvh->nodes[i];
 
-		if(node->flag & PBVH_Leaf) {
-			if(node->draw_buffers)
+		if (node->flag & PBVH_Leaf) {
+			if (node->draw_buffers)
 				GPU_free_buffers(node->draw_buffers);
-			if(node->vert_indices)
+			if (node->vert_indices)
 				MEM_freeN(node->vert_indices);
-			if(node->face_vert_indices)
+			if (node->face_vert_indices)
 				MEM_freeN(node->face_vert_indices);
 		}
 	}
@@ -656,15 +714,15 @@ void BLI_pbvh_free(PBVH *bvh)
 			/* if pbvh was deformed, new memory was allocated for verts/faces -- free it */
 
 			MEM_freeN(bvh->verts);
-			if(bvh->faces)
+			if (bvh->faces)
 				MEM_freeN(bvh->faces);
 		}
 	}
 
-	if(bvh->nodes)
+	if (bvh->nodes)
 		MEM_freeN(bvh->nodes);
 
-	if(bvh->prim_indices)
+	if (bvh->prim_indices)
 		MEM_freeN(bvh->prim_indices);
 
 	MEM_freeN(bvh);
@@ -686,20 +744,20 @@ static void pbvh_iter_begin(PBVHIter *iter, PBVH *bvh, BLI_pbvh_SearchCallback s
 
 static void pbvh_iter_end(PBVHIter *iter)
 {
-	if(iter->stackspace > STACK_FIXED_DEPTH)
+	if (iter->stackspace > STACK_FIXED_DEPTH)
 		MEM_freeN(iter->stack);
 }
 
 static void pbvh_stack_push(PBVHIter *iter, PBVHNode *node, int revisiting)
 {
-	if(iter->stacksize == iter->stackspace) {
+	if (iter->stacksize == iter->stackspace) {
 		PBVHStack *newstack;
 
 		iter->stackspace *= 2;
 		newstack= MEM_callocN(sizeof(PBVHStack)*iter->stackspace, "PBVHStack");
 		memcpy(newstack, iter->stack, sizeof(PBVHStack)*iter->stacksize);
 
-		if(iter->stackspace > STACK_FIXED_DEPTH)
+		if (iter->stackspace > STACK_FIXED_DEPTH)
 			MEM_freeN(iter->stack);
 		iter->stack= newstack;
 	}
@@ -715,28 +773,28 @@ static PBVHNode *pbvh_iter_next(PBVHIter *iter)
 	int revisiting;
 
 	/* purpose here is to traverse tree, visiting child nodes before their
-	   parents, this order is necessary for e.g. computing bounding boxes */
+	 * parents, this order is necessary for e.g. computing bounding boxes */
 
-	while(iter->stacksize) {
+	while (iter->stacksize) {
 		/* pop node */
 		iter->stacksize--;
 		node= iter->stack[iter->stacksize].node;
 
 		/* on a mesh with no faces this can happen
 		 * can remove this check if we know meshes have at least 1 face */
-		if(node==NULL)
+		if (node==NULL)
 			return NULL;
 
 		revisiting= iter->stack[iter->stacksize].revisiting;
 
 		/* revisiting node already checked */
-		if(revisiting)
+		if (revisiting)
 			return node;
 
-		if(iter->scb && !iter->scb(node, iter->search_data))
+		if (iter->scb && !iter->scb(node, iter->search_data))
 			continue; /* don't traverse, outside of search zone */
 
-		if(node->flag & PBVH_Leaf) {
+		if (node->flag & PBVH_Leaf) {
 			/* immediately hit leaf node */
 			return node;
 		}
@@ -757,18 +815,18 @@ static PBVHNode *pbvh_iter_next_occluded(PBVHIter *iter)
 {
 	PBVHNode *node;
 
-	while(iter->stacksize) {
+	while (iter->stacksize) {
 		/* pop node */
 		iter->stacksize--;
 		node= iter->stack[iter->stacksize].node;
 
 		/* on a mesh with no faces this can happen
 		 * can remove this check if we know meshes have at least 1 face */
-		if(node==NULL) return NULL;
+		if (node==NULL) return NULL;
 
-		if(iter->scb && !iter->scb(node, iter->search_data)) continue; /* don't traverse, outside of search zone */
+		if (iter->scb && !iter->scb(node, iter->search_data)) continue; /* don't traverse, outside of search zone */
 
-		if(node->flag & PBVH_Leaf) {
+		if (node->flag & PBVH_Leaf) {
 			/* immediately hit leaf node */
 			return node;
 		}
@@ -791,14 +849,14 @@ void BLI_pbvh_search_gather(PBVH *bvh,
 
 	pbvh_iter_begin(&iter, bvh, scb, search_data);
 
-	while((node=pbvh_iter_next(&iter))) {
-		if(node->flag & PBVH_Leaf) {
-			if(tot == space) {
+	while ((node=pbvh_iter_next(&iter))) {
+		if (node->flag & PBVH_Leaf) {
+			if (tot == space) {
 				/* resize array if needed */
 				space= (tot == 0)? 32: space*2;
 				newarray= MEM_callocN(sizeof(PBVHNode)*space, "PBVHNodeSearch");
 
-				if(array) {
+				if (array) {
 					memcpy(newarray, array, sizeof(PBVHNode)*tot);
 					MEM_freeN(array);
 				}
@@ -813,7 +871,7 @@ void BLI_pbvh_search_gather(PBVH *bvh,
 
 	pbvh_iter_end(&iter);
 
-	if(tot == 0 && array) {
+	if (tot == 0 && array) {
 		MEM_freeN(array);
 		array= NULL;
 	}
@@ -831,7 +889,7 @@ void BLI_pbvh_search_callback(PBVH *bvh,
 
 	pbvh_iter_begin(&iter, bvh, scb, search_data);
 
-	while((node=pbvh_iter_next(&iter)))
+	while ((node=pbvh_iter_next(&iter)))
 		if (node->flag & PBVH_Leaf)
 			hcb(node, hit_data);
 
@@ -904,8 +962,8 @@ static void BLI_pbvh_search_callback_occluded(PBVH *bvh,
 
 	pbvh_iter_begin(&iter, bvh, scb, search_data);
 
-	while((node=pbvh_iter_next_occluded(&iter))) {
-		if(node->flag & PBVH_Leaf) {
+	while ((node=pbvh_iter_next_occluded(&iter))) {
+		if (node->flag & PBVH_Leaf) {
 			node_tree* new_node = malloc(sizeof(node_tree));
 
 			new_node->data = node;
@@ -935,7 +993,7 @@ static int update_search_cb(PBVHNode *node, void *data_v)
 {
 	int flag= GET_INT_FROM_POINTER(data_v);
 
-	if(node->flag & PBVH_Leaf)
+	if (node->flag & PBVH_Leaf)
 		return (node->flag & flag);
 	
 	return 1;
@@ -947,52 +1005,52 @@ static void pbvh_update_normals(PBVH *bvh, PBVHNode **nodes,
 	float (*vnor)[3];
 	int n;
 
-	if(bvh->grids)
+	if (bvh->type != PBVH_FACES)
 		return;
 
 	/* could be per node to save some memory, but also means
-	   we have to store for each vertex which node it is in */
+	 * we have to store for each vertex which node it is in */
 	vnor= MEM_callocN(sizeof(float)*3*bvh->totvert, "bvh temp vnors");
 
-	/* subtle assumptions:
-	   - We know that for all edited vertices, the nodes with faces
-		 adjacent to these vertices have been marked with PBVH_UpdateNormals.
-		 This is true because if the vertex is inside the brush radius, the
-		 bounding box of it's adjacent faces will be as well.
-	   - However this is only true for the vertices that have actually been
-		 edited, not for all vertices in the nodes marked for update, so we
-		 can only update vertices marked with ME_VERT_PBVH_UPDATE.
-	*/
+    /* subtle assumptions:
+     * - We know that for all edited vertices, the nodes with faces
+     *   adjacent to these vertices have been marked with PBVH_UpdateNormals.
+     *   This is true because if the vertex is inside the brush radius, the
+     *   bounding box of it's adjacent faces will be as well.
+     * - However this is only true for the vertices that have actually been
+     *   edited, not for all vertices in the nodes marked for update, so we
+     *   can only update vertices marked with ME_VERT_PBVH_UPDATE.
+     */
 
 	#pragma omp parallel for private(n) schedule(static)
-	for(n = 0; n < totnode; n++) {
+	for (n = 0; n < totnode; n++) {
 		PBVHNode *node= nodes[n];
 
-		if((node->flag & PBVH_UpdateNormals)) {
+		if ((node->flag & PBVH_UpdateNormals)) {
 			int i, j, totface, *faces;
 
 			faces= node->prim_indices;
 			totface= node->totprim;
 
-			for(i = 0; i < totface; ++i) {
+			for (i = 0; i < totface; ++i) {
 				MFace *f= bvh->faces + faces[i];
 				float fn[3];
 				unsigned int *fv = &f->v1;
 				int sides= (f->v4)? 4: 3;
 
-				if(f->v4)
+				if (f->v4)
 					normal_quad_v3(fn, bvh->verts[f->v1].co, bvh->verts[f->v2].co,
 								   bvh->verts[f->v3].co, bvh->verts[f->v4].co);
 				else
 					normal_tri_v3(fn, bvh->verts[f->v1].co, bvh->verts[f->v2].co,
 								  bvh->verts[f->v3].co);
 
-				for(j = 0; j < sides; ++j) {
+				for (j = 0; j < sides; ++j) {
 					int v= fv[j];
 
-					if(bvh->verts[v].flag & ME_VERT_PBVH_UPDATE) {
+					if (bvh->verts[v].flag & ME_VERT_PBVH_UPDATE) {
 						/* this seems like it could be very slow but profile
-						   does not show this, so just leave it for now? */
+						 * does not show this, so just leave it for now? */
 						#pragma omp atomic
 						vnor[v][0] += fn[0];
 						#pragma omp atomic
@@ -1002,27 +1060,27 @@ static void pbvh_update_normals(PBVH *bvh, PBVHNode **nodes,
 					}
 				}
 
-				if(face_nors)
+				if (face_nors)
 					copy_v3_v3(face_nors[faces[i]], fn);
 			}
 		}
 	}
 
 	#pragma omp parallel for private(n) schedule(static)
-	for(n = 0; n < totnode; n++) {
+	for (n = 0; n < totnode; n++) {
 		PBVHNode *node= nodes[n];
 
-		if(node->flag & PBVH_UpdateNormals) {
+		if (node->flag & PBVH_UpdateNormals) {
 			int i, *verts, totvert;
 
 			verts= node->vert_indices;
 			totvert= node->uniq_verts;
 
-			for(i = 0; i < totvert; ++i) {
+			for (i = 0; i < totvert; ++i) {
 				const int v = verts[i];
 				MVert *mvert= &bvh->verts[v];
 
-				if(mvert->flag & ME_VERT_PBVH_UPDATE) {
+				if (mvert->flag & ME_VERT_PBVH_UPDATE) {
 					float no[3];
 
 					copy_v3_v3(no, vnor[v]);
@@ -1050,45 +1108,65 @@ static void pbvh_update_BB_redraw(PBVH *bvh, PBVHNode **nodes,
 
 	/* update BB, redraw flag */
 	#pragma omp parallel for private(n) schedule(static)
-	for(n = 0; n < totnode; n++) {
+	for (n = 0; n < totnode; n++) {
 		PBVHNode *node= nodes[n];
 
-		if((flag & PBVH_UpdateBB) && (node->flag & PBVH_UpdateBB))
+		if ((flag & PBVH_UpdateBB) && (node->flag & PBVH_UpdateBB))
 			/* don't clear flag yet, leave it for flushing later */
 			update_node_vb(bvh, node);
 
-		if((flag & PBVH_UpdateOriginalBB) && (node->flag & PBVH_UpdateOriginalBB))
+		if ((flag & PBVH_UpdateOriginalBB) && (node->flag & PBVH_UpdateOriginalBB))
 			node->orig_vb= node->vb;
 
-		if((flag & PBVH_UpdateRedraw) && (node->flag & PBVH_UpdateRedraw))
+		if ((flag & PBVH_UpdateRedraw) && (node->flag & PBVH_UpdateRedraw))
 			node->flag &= ~PBVH_UpdateRedraw;
 	}
 }
 
-static void pbvh_update_draw_buffers(PBVH *bvh, PBVHNode **nodes, int totnode, int smooth)
+static void pbvh_update_draw_buffers(PBVH *bvh, PBVHNode **nodes, int totnode)
 {
 	PBVHNode *node;
 	int n;
 
 	/* can't be done in parallel with OpenGL */
-	for(n = 0; n < totnode; n++) {
+	for (n = 0; n < totnode; n++) {
 		node= nodes[n];
 
-		if(node->flag & PBVH_UpdateDrawBuffers) {
-			if(bvh->grids) {
+		if (node->flag & PBVH_RebuildDrawBuffers) {
+			GPU_free_buffers(node->draw_buffers);
+			if (bvh->grids) {
+				node->draw_buffers =
+					GPU_build_grid_buffers(node->prim_indices,
+						   node->totprim, bvh->grid_hidden, bvh->gridsize);
+			}
+			else {
+				node->draw_buffers =
+					GPU_build_mesh_buffers(node->face_vert_indices,
+						   bvh->faces, bvh->verts,
+						   node->prim_indices,
+						   node->totprim);
+			}
+ 
+			node->flag &= ~PBVH_RebuildDrawBuffers;
+		}
+
+		if (node->flag & PBVH_UpdateDrawBuffers) {
+			switch(bvh->type) {
+			case PBVH_GRIDS:
 				GPU_update_grid_buffers(node->draw_buffers,
 						   bvh->grids,
+						   bvh->grid_flag_mats,
 						   node->prim_indices,
 						   node->totprim,
-						   bvh->gridsize,
-						   smooth);
-			}
-			else {
+						   bvh->gridsize);
+				break;
+			case PBVH_FACES:
 				GPU_update_mesh_buffers(node->draw_buffers,
 						   bvh->verts,
 						   node->vert_indices,
 						   node->uniq_verts +
 						   node->face_verts);
+				break;
 			}
 
 			node->flag &= ~PBVH_UpdateDrawBuffers;
@@ -1101,13 +1179,13 @@ static int pbvh_flush_bb(PBVH *bvh, PBVHNode *node, int flag)
 	int update= 0;
 
 	/* difficult to multithread well, we just do single threaded recursive */
-	if(node->flag & PBVH_Leaf) {
-		if(flag & PBVH_UpdateBB) {
+	if (node->flag & PBVH_Leaf) {
+		if (flag & PBVH_UpdateBB) {
 			update |= (node->flag & PBVH_UpdateBB);
 			node->flag &= ~PBVH_UpdateBB;
 		}
 
-		if(flag & PBVH_UpdateOriginalBB) {
+		if (flag & PBVH_UpdateOriginalBB) {
 			update |= (node->flag & PBVH_UpdateOriginalBB);
 			node->flag &= ~PBVH_UpdateOriginalBB;
 		}
@@ -1118,9 +1196,9 @@ static int pbvh_flush_bb(PBVH *bvh, PBVHNode *node, int flag)
 		update |= pbvh_flush_bb(bvh, bvh->nodes + node->children_offset, flag);
 		update |= pbvh_flush_bb(bvh, bvh->nodes + node->children_offset + 1, flag);
 
-		if(update & PBVH_UpdateBB)
+		if (update & PBVH_UpdateBB)
 			update_node_vb(bvh, node);
-		if(update & PBVH_UpdateOriginalBB)
+		if (update & PBVH_UpdateOriginalBB)
 			node->orig_vb= node->vb;
 	}
 
@@ -1132,22 +1210,22 @@ void BLI_pbvh_update(PBVH *bvh, int flag, float (*face_nors)[3])
 	PBVHNode **nodes;
 	int totnode;
 
-	if(!bvh->nodes)
+	if (!bvh->nodes)
 		return;
 
 	BLI_pbvh_search_gather(bvh, update_search_cb, SET_INT_IN_POINTER(flag),
 		&nodes, &totnode);
 
-	if(flag & PBVH_UpdateNormals)
+	if (flag & PBVH_UpdateNormals)
 		pbvh_update_normals(bvh, nodes, totnode, face_nors);
 
-	if(flag & (PBVH_UpdateBB|PBVH_UpdateOriginalBB|PBVH_UpdateRedraw))
+	if (flag & (PBVH_UpdateBB|PBVH_UpdateOriginalBB|PBVH_UpdateRedraw))
 		pbvh_update_BB_redraw(bvh, nodes, totnode, flag);
 
-	if(flag & (PBVH_UpdateBB|PBVH_UpdateOriginalBB))
+	if (flag & (PBVH_UpdateBB|PBVH_UpdateOriginalBB))
 		pbvh_flush_bb(bvh, bvh->nodes, flag);
 
-	if(nodes) MEM_freeN(nodes);
+	if (nodes) MEM_freeN(nodes);
 }
 
 void BLI_pbvh_redraw_BB(PBVH *bvh, float bb_min[3], float bb_max[3])
@@ -1160,8 +1238,8 @@ void BLI_pbvh_redraw_BB(PBVH *bvh, float bb_min[3], float bb_max[3])
 
 	pbvh_iter_begin(&iter, bvh, NULL, NULL);
 
-	while((node=pbvh_iter_next(&iter)))
-		if(node->flag & PBVH_UpdateRedraw)
+	while ((node=pbvh_iter_next(&iter)))
+		if (node->flag & PBVH_UpdateRedraw)
 			BB_expand_with_bb(&bb, &node->vb);
 
 	pbvh_iter_end(&iter);
@@ -1184,15 +1262,15 @@ void BLI_pbvh_get_grid_updates(PBVH *bvh, int clear, void ***gridfaces, int *tot
 
 	pbvh_iter_begin(&iter, bvh, NULL, NULL);
 
-	while((node=pbvh_iter_next(&iter))) {
-		if(node->flag & PBVH_UpdateNormals) {
-			for(i = 0; i < node->totprim; ++i) {
+	while ((node=pbvh_iter_next(&iter))) {
+		if (node->flag & PBVH_UpdateNormals) {
+			for (i = 0; i < node->totprim; ++i) {
 				face= bvh->gridfaces[node->prim_indices[i]];
-				if(!BLI_ghash_lookup(map, face))
+				if (!BLI_ghash_lookup(map, face))
 					BLI_ghash_insert(map, face, face);
 			}
 
-			if(clear)
+			if (clear)
 				node->flag &= ~PBVH_UpdateNormals;
 		}
 	}
@@ -1200,7 +1278,7 @@ void BLI_pbvh_get_grid_updates(PBVH *bvh, int clear, void ***gridfaces, int *tot
 	pbvh_iter_end(&iter);
 	
 	tot= BLI_ghash_size(map);
-	if(tot == 0) {
+	if (tot == 0) {
 		*totface= 0;
 		*gridfaces= NULL;
 		BLI_ghash_free(map, NULL, NULL);
@@ -1209,7 +1287,7 @@ void BLI_pbvh_get_grid_updates(PBVH *bvh, int clear, void ***gridfaces, int *tot
 
 	faces= MEM_callocN(sizeof(void*)*tot, "PBVH Grid Faces");
 
-	for(hiter = BLI_ghashIterator_new(map), i = 0;
+	for (hiter = BLI_ghashIterator_new(map), i = 0;
 		!BLI_ghashIterator_isDone(hiter);
 		BLI_ghashIterator_step(hiter), ++i)
 		faces[i]= BLI_ghashIterator_getKey(hiter);
@@ -1222,6 +1300,19 @@ void BLI_pbvh_get_grid_updates(PBVH *bvh, int clear, void ***gridfaces, int *tot
 	*gridfaces= faces;
 }
 
+/***************************** PBVH Access ***********************************/
+
+PBVHType BLI_pbvh_type(const PBVH *bvh)
+{
+	return bvh->type;
+}
+
+BLI_bitmap *BLI_pbvh_grid_hidden(const PBVH *bvh)
+{
+	BLI_assert(bvh->type == PBVH_GRIDS);
+	return bvh->grid_hidden;
+}
+
 /***************************** Node Access ***********************************/
 
 void BLI_pbvh_node_mark_update(PBVHNode *node)
@@ -1229,42 +1320,63 @@ void BLI_pbvh_node_mark_update(PBVHNode *node)
 	node->flag |= PBVH_UpdateNormals|PBVH_UpdateBB|PBVH_UpdateOriginalBB|PBVH_UpdateDrawBuffers|PBVH_UpdateRedraw;
 }
 
+void BLI_pbvh_node_mark_rebuild_draw(PBVHNode *node)
+{
+	node->flag |= PBVH_RebuildDrawBuffers|PBVH_UpdateDrawBuffers|PBVH_UpdateRedraw;
+}
+
+void BLI_pbvh_node_fully_hidden_set(PBVHNode *node, int fully_hidden)
+{
+	BLI_assert(node->flag & PBVH_Leaf);
+	
+	if (fully_hidden)
+		node->flag |= PBVH_FullyHidden;
+	else
+		node->flag &= ~PBVH_FullyHidden;
+}
+
 void BLI_pbvh_node_get_verts(PBVH *bvh, PBVHNode *node, int **vert_indices, MVert **verts)
 {
-	if(vert_indices) *vert_indices= node->vert_indices;
-	if(verts) *verts= bvh->verts;
+	if (vert_indices) *vert_indices= node->vert_indices;
+	if (verts) *verts= bvh->verts;
 }
 
 void BLI_pbvh_node_num_verts(PBVH *bvh, PBVHNode *node, int *uniquevert, int *totvert)
 {
-	if(bvh->grids) {
-		const int tot= node->totprim*bvh->gridsize*bvh->gridsize;
-		if(totvert) *totvert= tot;
-		if(uniquevert) *uniquevert= tot;
-	}
-	else {
-		if(totvert) *totvert= node->uniq_verts + node->face_verts;
-		if(uniquevert) *uniquevert= node->uniq_verts;
+	int tot;
+	
+	switch(bvh->type) {
+	case PBVH_GRIDS:
+		tot= node->totprim*bvh->gridsize*bvh->gridsize;
+		if (totvert) *totvert= tot;
+		if (uniquevert) *uniquevert= tot;
+		break;
+	case PBVH_FACES:
+		if (totvert) *totvert= node->uniq_verts + node->face_verts;
+		if (uniquevert) *uniquevert= node->uniq_verts;
+		break;
 	}
 }
 
 void BLI_pbvh_node_get_grids(PBVH *bvh, PBVHNode *node, int **grid_indices, int *totgrid, int *maxgrid, int *gridsize, DMGridData ***griddata, DMGridAdjacency **gridadj)
 {
-	if(bvh->grids) {
-		if(grid_indices) *grid_indices= node->prim_indices;
-		if(totgrid) *totgrid= node->totprim;
-		if(maxgrid) *maxgrid= bvh->totgrid;
-		if(gridsize) *gridsize= bvh->gridsize;
-		if(griddata) *griddata= bvh->grids;
-		if(gridadj) *gridadj= bvh->gridadj;
-	}
-	else {
-		if(grid_indices) *grid_indices= NULL;
-		if(totgrid) *totgrid= 0;
-		if(maxgrid) *maxgrid= 0;
-		if(gridsize) *gridsize= 0;
-		if(griddata) *griddata= NULL;
-		if(gridadj) *gridadj= NULL;
+	switch(bvh->type) {
+	case PBVH_GRIDS:
+		if (grid_indices) *grid_indices= node->prim_indices;
+		if (totgrid) *totgrid= node->totprim;
+		if (maxgrid) *maxgrid= bvh->totgrid;
+		if (gridsize) *gridsize= bvh->gridsize;
+		if (griddata) *griddata= bvh->grids;
+		if (gridadj) *gridadj= bvh->gridadj;
+		break;
+	case PBVH_FACES:
+		if (grid_indices) *grid_indices= NULL;
+		if (totgrid) *totgrid= 0;
+		if (maxgrid) *maxgrid= 0;
+		if (gridsize) *gridsize= 0;
+		if (griddata) *griddata= NULL;
+		if (gridadj) *gridadj= NULL;
+		break;
 	}
 }
 
@@ -1309,7 +1421,7 @@ static int ray_aabb_intersect(PBVHNode *node, void *data_v)
 	float bbox[2][3];
 	float tmin, tmax, tymin, tymax, tzmin, tzmax;
 
-	if(ray->original)
+	if (ray->original)
 		BLI_pbvh_node_get_original_BB(node, bbox[0], bbox[1]);
 	else
 		BLI_pbvh_node_get_BB(node, bbox[0], bbox[1]);
@@ -1320,27 +1432,27 @@ static int ray_aabb_intersect(PBVHNode *node, void *data_v)
 	tymin = (bbox[ray->sign[1]][1] - ray->start[1]) * ray->inv_dir[1];
 	tymax = (bbox[1-ray->sign[1]][1] - ray->start[1]) * ray->inv_dir[1];
 
-	if((tmin > tymax) || (tymin > tmax))
+	if ((tmin > tymax) || (tymin > tmax))
 		return 0;
 
-	if(tymin > tmin)
+	if (tymin > tmin)
 		tmin = tymin;
 
-	if(tymax < tmax)
+	if (tymax < tmax)
 		tmax = tymax;
 
 	tzmin = (bbox[ray->sign[2]][2] - ray->start[2]) * ray->inv_dir[2];
 	tzmax = (bbox[1-ray->sign[2]][2] - ray->start[2]) * ray->inv_dir[2];
 
-	if((tmin > tzmax) || (tzmin > tmax))
+	if ((tmin > tzmax) || (tzmin > tmax))
 		return 0;
 
-	if(tzmin > tmin)
+	if (tzmin > tmin)
 		tmin = tzmin;
 
 	// XXX jwilkins: tmax does not need to be updated since we don't use it
 	// keeping this here for future reference
-	//if(tzmax < tmax) tmax = tzmax; 
+	//if (tzmax < tmax) tmax = tzmax; 
 
 	node->tmin = tmin;
 
@@ -1384,19 +1496,28 @@ static int ray_face_intersection(float ray_start[3], float ray_normal[3],
 int BLI_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3],
 	float ray_start[3], float ray_normal[3], float *dist)
 {
-	int hit= 0;
+	MVert *vert;
+	BLI_bitmap gh;
+	int *faces, totface, gridsize, totgrid;
+	int i, x, y, hit= 0;
+
+	if (node->flag & PBVH_FullyHidden)
+		return 0;
 
-	if(bvh->faces) {
-		MVert *vert = bvh->verts;
-		int *faces= node->prim_indices;
-		int totface= node->totprim;
-		int i;
+	switch(bvh->type) {
+	case PBVH_FACES:
+		vert = bvh->verts;
+		faces= node->prim_indices;
+		totface= node->totprim;
 
-		for(i = 0; i < totface; ++i) {
-			MFace *f = bvh->faces + faces[i];
+		for (i = 0; i < totface; ++i) {
+			const MFace *f = bvh->faces + faces[i];
 			int *face_verts = node->face_vert_indices[i];
 
-			if(origco) {
+			if (paint_is_face_hidden(f, vert))
+				continue;
+
+			if (origco) {
 				/* intersect with backuped original coordinates */
 				hit |= ray_face_intersection(ray_start, ray_normal,
 							 origco[face_verts[0]],
@@ -1415,20 +1536,27 @@ int BLI_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3],
 							 dist);
 			}
 		}
-	}
-	else {
-		int totgrid= node->totprim;
-		int gridsize= bvh->gridsize;
-		int i, x, y;
+		break;
+	case PBVH_GRIDS:
+		totgrid= node->totprim;
+		gridsize= bvh->gridsize;
 
-		for(i = 0; i < totgrid; ++i) {
+		for (i = 0; i < totgrid; ++i) {
 			DMGridData *grid= bvh->grids[node->prim_indices[i]];
 			if (!grid)
 				continue;
 
-			for(y = 0; y < gridsize-1; ++y) {
-				for(x = 0; x < gridsize-1; ++x) {
-					if(origco) {
+			gh= bvh->grid_hidden[node->prim_indices[i]];
+
+			for (y = 0; y < gridsize-1; ++y) {
+				for (x = 0; x < gridsize-1; ++x) {
+					/* check if grid face is hidden */
+					if (gh) {
+						if (paint_is_grid_face_hidden(gh, gridsize, x, y))
+							continue;
+					}
+
+					if (origco) {
 						hit |= ray_face_intersection(ray_start, ray_normal,
 									 origco[y*gridsize + x],
 									 origco[y*gridsize + x+1],
@@ -1447,9 +1575,10 @@ int BLI_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3],
 				}
 			}
 
-			if(origco)
+			if (origco)
 				origco += gridsize*gridsize;
 		}
+		break;
 	}
 
 	return hit;
@@ -1457,60 +1586,87 @@ int BLI_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3],
 
 //#include <GL/glew.h>
 
-void BLI_pbvh_node_draw(PBVHNode *node, void *UNUSED(data))
+void BLI_pbvh_node_draw(PBVHNode *node, void *setMaterial)
 {
 #if 0
 	/* XXX: Just some quick code to show leaf nodes in different colors */
 	float col[3]; int i;
 
-	if(0) { //is_partial) {
+	if (0) { //is_partial) {
 		col[0] = (rand() / (float)RAND_MAX); col[1] = col[2] = 0.6;
 	}
 	else {
 		srand((long long)node);
-		for(i = 0; i < 3; ++i)
+		for (i = 0; i < 3; ++i)
 			col[i] = (rand() / (float)RAND_MAX) * 0.3 + 0.7;
 	}
 	glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, col);
 
 	glColor3f(1, 0, 0);
 #endif
-	GPU_draw_buffers(node->draw_buffers);
+
+	if (!(node->flag & PBVH_FullyHidden))
+		GPU_draw_buffers(node->draw_buffers, setMaterial);
 }
 
+typedef enum {
+	ISECT_INSIDE,
+	ISECT_OUTSIDE,
+	ISECT_INTERSECT
+} PlaneAABBIsect;
+
 /* Adapted from:
-   http://www.gamedev.net/community/forums/topic.asp?topic_id=512123
-   Returns true if the AABB is at least partially within the frustum
-   (ok, not a real frustum), false otherwise.
-*/
-int BLI_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data)
+ * http://www.gamedev.net/community/forums/topic.asp?topic_id=512123
+ * Returns true if the AABB is at least partially within the frustum
+ * (ok, not a real frustum), false otherwise.
+ */
+static PlaneAABBIsect test_planes_aabb(const float bb_min[3],
+									   const float bb_max[3],
+									   const float (*planes)[4])
 {
-	float (*planes)[4] = data;
+	float vmin[3], vmax[3];
+	PlaneAABBIsect ret = ISECT_INSIDE;
 	int i, axis;
-	float vmin[3] /*, vmax[3]*/, bb_min[3], bb_max[3];
-
-	BLI_pbvh_node_get_BB(node, bb_min, bb_max);
-
-	for(i = 0; i < 4; ++i) { 
-		for(axis = 0; axis < 3; ++axis) {
-			if(planes[i][axis] > 0) { 
+	
+	for (i = 0; i < 4; ++i) { 
+		for (axis = 0; axis < 3; ++axis) {
+			if (planes[i][axis] > 0) { 
 				vmin[axis] = bb_min[axis];
-				/*vmax[axis] = bb_max[axis];*/ /*UNUSED*/
+				vmax[axis] = bb_max[axis];
 			}
 			else {
 				vmin[axis] = bb_max[axis];
-				/*vmax[axis] = bb_min[axis];*/ /*UNUSED*/
+				vmax[axis] = bb_min[axis];
 			}
 		}
 		
-		if(dot_v3v3(planes[i], vmin) + planes[i][3] > 0)
-			return 0;
+		if (dot_v3v3(planes[i], vmin) + planes[i][3] > 0)
+			return ISECT_OUTSIDE;
+		else if (dot_v3v3(planes[i], vmax) + planes[i][3] >= 0)
+			ret = ISECT_INTERSECT;
 	} 
 
-	return 1;
+	return ret;
+}
+
+int BLI_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data)
+{
+	float bb_min[3], bb_max[3];
+	
+	BLI_pbvh_node_get_BB(node, bb_min, bb_max);
+	return test_planes_aabb(bb_min, bb_max, data) != ISECT_OUTSIDE;
+}
+
+int BLI_pbvh_node_planes_exclude_AABB(PBVHNode *node, void *data)
+{
+	float bb_min[3], bb_max[3];
+	
+	BLI_pbvh_node_get_BB(node, bb_min, bb_max);
+	return test_planes_aabb(bb_min, bb_max, data) != ISECT_INSIDE;
 }
 
-void BLI_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3], int smooth)
+void BLI_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3],
+				   DMSetMaterial setMaterial)
 {
 	PBVHNode **nodes;
 	int totnode;
@@ -1519,16 +1675,16 @@ void BLI_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3], int smo
 		&nodes, &totnode);
 
 	pbvh_update_normals(bvh, nodes, totnode, face_nors);
-	pbvh_update_draw_buffers(bvh, nodes, totnode, smooth);
+	pbvh_update_draw_buffers(bvh, nodes, totnode);
 
-	if(nodes) MEM_freeN(nodes);
+	if (nodes) MEM_freeN(nodes);
 
-	if(planes) {
+	if (planes) {
 		BLI_pbvh_search_callback(bvh, BLI_pbvh_node_planes_contain_AABB,
-				planes, BLI_pbvh_node_draw, NULL);
+				planes, BLI_pbvh_node_draw, setMaterial);
 	}
 	else {
-		BLI_pbvh_search_callback(bvh, NULL, NULL, BLI_pbvh_node_draw, NULL);
+		BLI_pbvh_search_callback(bvh, NULL, NULL, BLI_pbvh_node_draw, setMaterial);
 	}
 }
 
@@ -1585,7 +1741,7 @@ void BLI_pbvh_apply_vertCos(PBVH *pbvh, float (*vertCos)[3])
 		}
 
 		/* coordinates are new -- normals should also be updated */
-		mesh_calc_normals(pbvh->verts, pbvh->totvert, pbvh->faces, pbvh->totprim, NULL);
+		mesh_calc_normals_tessface(pbvh->verts, pbvh->totvert, pbvh->faces, pbvh->totprim, NULL);
 
 		for (a= 0; a < pbvh->totnode; ++a)
 			BLI_pbvh_node_mark_update(&pbvh->nodes[a]);
@@ -1656,8 +1812,8 @@ void BLI_pbvh_gather_proxies(PBVH* pbvh, PBVHNode*** r_array,  int* r_tot)
 	for (n= 0; n < pbvh->totnode; n++) {
 		node = pbvh->nodes + n;
 
-		if(node->proxy_count > 0) {
-			if(tot == space) {
+		if (node->proxy_count > 0) {
+			if (tot == space) {
 				/* resize array if needed */
 				space= (tot == 0)? 32: space*2;
 				newarray= MEM_callocN(sizeof(PBVHNode)*space, "BLI_pbvh_gather_proxies");
@@ -1675,7 +1831,7 @@ void BLI_pbvh_gather_proxies(PBVH* pbvh, PBVHNode*** r_array,  int* r_tot)
 		}
 	}
 
-	if(tot == 0 && array) {
+	if (tot == 0 && array) {
 		MEM_freeN(array);
 		array= NULL;
 	}
@@ -1683,3 +1839,37 @@ void BLI_pbvh_gather_proxies(PBVH* pbvh, PBVHNode*** r_array,  int* r_tot)
 	*r_array= array;
 	*r_tot= tot;
 }
+
+void pbvh_vertex_iter_init(PBVH *bvh, PBVHNode *node,
+						   PBVHVertexIter *vi, int mode)
+{
+	struct DMGridData **grids;
+	struct MVert *verts;
+	int *grid_indices, *vert_indices;
+	int totgrid, gridsize, uniq_verts, totvert;
+	
+	vi->grid= 0;
+	vi->no= 0;
+	vi->fno= 0;
+	vi->mvert= 0;
+	
+	BLI_pbvh_node_get_grids(bvh, node, &grid_indices, &totgrid, NULL, &gridsize, &grids, NULL);
+	BLI_pbvh_node_num_verts(bvh, node, &uniq_verts, &totvert);
+	BLI_pbvh_node_get_verts(bvh, node, &vert_indices, &verts);
+	
+	vi->grids= grids;
+	vi->grid_indices= grid_indices;
+	vi->totgrid= (grids)? totgrid: 1;
+	vi->gridsize= gridsize;
+	
+	if (mode == PBVH_ITER_ALL)
+		vi->totvert = totvert;
+	else
+		vi->totvert= uniq_verts;
+	vi->vert_indices= vert_indices;
+	vi->mverts= verts;
+
+	vi->gh= NULL;
+	if (vi->grids && mode == PBVH_ITER_UNIQUE)
+		vi->grid_hidden= bvh->grid_hidden;
+}
diff --git a/source/blender/blenlib/intern/rand.c b/source/blender/blenlib/intern/rand.c
index 28dc5a6..b2e6cab 100644
--- a/source/blender/blenlib/intern/rand.c
+++ b/source/blender/blenlib/intern/rand.c
@@ -111,11 +111,19 @@ float rng_getFloat(RNG *rng)
 void rng_shuffleArray(RNG *rng, void *data, int elemSize, int numElems)
 {
 	int i = numElems;
-	void *temp = malloc(elemSize);
+	void *temp;
 
+	if (numElems <= 0) {
+		return;
+	}
+
+	temp = malloc(elemSize);
+
+	/* 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;
-		if(i!=j) {
+		if (i!=j) {
 			void *iElem = (unsigned char*)data + i*elemSize;
 			void *jElem = (unsigned char*)data + j*elemSize;
 			memcpy(temp, iElem, elemSize);
@@ -131,7 +139,7 @@ void rng_skip(RNG *rng, int n)
 {
 	int i;
 
-	for(i=0; i<n; i++)
+	for (i=0; i<n; i++)
 		rng_getInt(rng);
 }
 
@@ -189,7 +197,7 @@ static RNG rng_tab[BLENDER_MAX_THREADS];
 
 void BLI_thread_srandom(int thread, unsigned int seed)
 {
-	if(thread >= BLENDER_MAX_THREADS)
+	if (thread >= BLENDER_MAX_THREADS)
 		thread= 0;
 	
 	rng_seed(&rng_tab[thread], seed + hash[seed & 255]);
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c
index 3b9fd2e..81a940e 100644
--- a/source/blender/blenlib/intern/rct.c
+++ b/source/blender/blenlib/intern/rct.c
@@ -1,12 +1,4 @@
 /*
- * 
- * rct.c
- * 
- * april 95
- * 
- *
- * A minimalist lib for functions doing stuff with rectangle structs.
- *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -36,6 +28,8 @@
 
 /** \file blender/blenlib/intern/rct.c
  *  \ingroup bli
+ *
+ * A minimalist lib for functions doing stuff with rectangle structs.
  */
 
 #include <stdio.h>
@@ -46,91 +40,134 @@
 
 int BLI_rcti_is_empty(rcti * rect)
 {
-	return ((rect->xmax<=rect->xmin) ||
-			(rect->ymax<=rect->ymin));
+	return ((rect->xmax <= rect->xmin) || (rect->ymax <= rect->ymin));
 }
 
 int BLI_rctf_is_empty(rctf * rect)
 {
-	return ((rect->xmax<=rect->xmin) ||
-			(rect->ymax<=rect->ymin));
+	return ((rect->xmax <= rect->xmin) || (rect->ymax <= rect->ymin));
 }
 
 int BLI_in_rcti(rcti * rect, int x, int y)
 {
-
-	if(x<rect->xmin) return 0;
-	if(x>rect->xmax) return 0;
-	if(y<rect->ymin) return 0;
-	if(y>rect->ymax) return 0;
+	if (x < rect->xmin) return 0;
+	if (x > rect->xmax) return 0;
+	if (y < rect->ymin) return 0;
+	if (y > rect->ymax) return 0;
 	return 1;
 }
 
 int BLI_in_rctf(rctf *rect, float x, float y)
 {
-
-	if(x<rect->xmin) return 0;
-	if(x>rect->xmax) return 0;
-	if(y<rect->ymin) return 0;
-	if(y>rect->ymax) return 0;
+	if (x < rect->xmin) return 0;
+	if (x > rect->xmax) return 0;
+	if (y < rect->ymin) return 0;
+	if (y > rect->ymax) return 0;
 	return 1;
 }
 
+/* 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])
+{
+	const double div = (double)((v2[0] - v1[0]) * (v4[1] - v3[1]) - (v2[1] - v1[1]) * (v4[0] - v3[0]));
+	if (div == 0.0f) {
+		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);
+	}
+}
+
+int BLI_segment_in_rcti(rcti *rect, int s1[2], int 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_in_rcti(rect, s1[0], s1[1]) || BLI_in_rcti(rect, s2[0], s2[1])) {
+		return 1;
+	}
+	else {
+		/* both points are outside but may insersect the rect */
+		int tvec1[2];
+		int tvec2[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)) {
+			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)) {
+			return 1;
+		}
+
+		/* no intersection */
+		return 0;
+	}
+}
+
 void BLI_union_rctf(rctf *rct1, rctf *rct2)
 {
-	
-	if(rct1->xmin>rct2->xmin) rct1->xmin= rct2->xmin;
-	if(rct1->xmax<rct2->xmax) rct1->xmax= rct2->xmax;
-	if(rct1->ymin>rct2->ymin) rct1->ymin= rct2->ymin;
-	if(rct1->ymax<rct2->ymax) rct1->ymax= rct2->ymax;
+	if (rct1->xmin > rct2->xmin) rct1->xmin = rct2->xmin;
+	if (rct1->xmax < rct2->xmax) rct1->xmax = rct2->xmax;
+	if (rct1->ymin > rct2->ymin) rct1->ymin = rct2->ymin;
+	if (rct1->ymax < rct2->ymax) rct1->ymax = rct2->ymax;
 }
 
 void BLI_union_rcti(rcti *rct1, rcti *rct2)
 {
-	
-	if(rct1->xmin>rct2->xmin) rct1->xmin= rct2->xmin;
-	if(rct1->xmax<rct2->xmax) rct1->xmax= rct2->xmax;
-	if(rct1->ymin>rct2->ymin) rct1->ymin= rct2->ymin;
-	if(rct1->ymax<rct2->ymax) rct1->ymax= rct2->ymax;
+	if (rct1->xmin > rct2->xmin) rct1->xmin = rct2->xmin;
+	if (rct1->xmax < rct2->xmax) rct1->xmax = rct2->xmax;
+	if (rct1->ymin > rct2->ymin) rct1->ymin = rct2->ymin;
+	if (rct1->ymax < rct2->ymax) rct1->ymax = rct2->ymax;
 }
 
 void BLI_init_rctf(rctf *rect, float xmin, float xmax, float ymin, float ymax)
 {
-	if(xmin <= xmax) {
-		rect->xmin= xmin;
-		rect->xmax= xmax;
+	if (xmin <= xmax) {
+		rect->xmin = xmin;
+		rect->xmax = xmax;
 	}
 	else {
-		rect->xmax= xmin;
-		rect->xmin= xmax;
+		rect->xmax = xmin;
+		rect->xmin = xmax;
 	}
-	if(ymin <= ymax) {
-		rect->ymin= ymin;
-		rect->ymax= ymax;
+	if (ymin <= ymax) {
+		rect->ymin = ymin;
+		rect->ymax = ymax;
 	}
 	else {
-		rect->ymax= ymin;
-		rect->ymin= ymax;
+		rect->ymax = ymin;
+		rect->ymin = ymax;
 	}
 }
 
 void BLI_init_rcti(rcti *rect, int xmin, int xmax, int ymin, int ymax)
 {
-	if(xmin <= xmax) {
-		rect->xmin= xmin;
-		rect->xmax= xmax;
+	if (xmin <= xmax) {
+		rect->xmin = xmin;
+		rect->xmax = xmax;
 	}
 	else {
-		rect->xmax= xmin;
-		rect->xmin= xmax;
+		rect->xmax = xmin;
+		rect->xmin = xmax;
 	}
-	if(ymin <= ymax) {
-		rect->ymin= ymin;
-		rect->ymax= ymax;
+	if (ymin <= ymax) {
+		rect->ymin = ymin;
+		rect->ymax = ymax;
 	}
 	else {
-		rect->ymax= ymin;
-		rect->ymin= ymax;
+		rect->ymax = ymin;
+		rect->ymin = ymax;
 	}
 }
 
@@ -152,22 +189,22 @@ void BLI_translate_rctf(rctf *rect, float x, float y)
 /* change width & height around the central location */
 void BLI_resize_rcti(rcti *rect, int x, int y)
 {
-	rect->xmin= rect->xmax= (rect->xmax + rect->xmin) / 2;
-	rect->ymin= rect->ymax= (rect->ymax + rect->ymin) / 2;
+	rect->xmin = rect->xmax = (rect->xmax + rect->xmin) / 2;
+	rect->ymin = rect->ymax = (rect->ymax + rect->ymin) / 2;
 	rect->xmin -= x / 2;
 	rect->ymin -= y / 2;
-	rect->xmax= rect->xmin + x;
-	rect->ymax= rect->ymin + y;
+	rect->xmax = rect->xmin + x;
+	rect->ymax = rect->ymin + y;
 }
 
 void BLI_resize_rctf(rctf *rect, float x, float y)
 {
-	rect->xmin= rect->xmax= (rect->xmax + rect->xmin) * 0.5f;
-	rect->ymin= rect->ymax= (rect->ymax + rect->ymin) * 0.5f;
+	rect->xmin = rect->xmax = (rect->xmax + rect->xmin) * 0.5f;
+	rect->ymin = rect->ymax = (rect->ymax + rect->ymin) * 0.5f;
 	rect->xmin -= x * 0.5f;
 	rect->ymin -= y * 0.5f;
-	rect->xmax= rect->xmin + x;
-	rect->ymax= rect->ymin + y;
+	rect->xmax = rect->xmin + x;
+	rect->ymax = rect->ymin + y;
 }
 
 int BLI_isect_rctf(rctf *src1, rctf *src2, rctf *dest)
@@ -179,9 +216,9 @@ int BLI_isect_rctf(rctf *src1, rctf *src2, rctf *dest)
 	xmax = (src1->xmax) < (src2->xmax) ? (src1->xmax) : (src2->xmax);
 	ymin = (src1->ymin) > (src2->ymin) ? (src1->ymin) : (src2->ymin);
 	ymax = (src1->ymax) < (src2->ymax) ? (src1->ymax) : (src2->ymax);
-	
-	if(xmax>=xmin && ymax>=ymin) {
-		if(dest) {
+
+	if (xmax >= xmin && ymax >= ymin) {
+		if (dest) {
 			dest->xmin = xmin;
 			dest->xmax = xmax;
 			dest->ymin = ymin;
@@ -190,7 +227,7 @@ int BLI_isect_rctf(rctf *src1, rctf *src2, rctf *dest)
 		return 1;
 	}
 	else {
-		if(dest) {
+		if (dest) {
 			dest->xmin = 0;
 			dest->xmax = 0;
 			dest->ymin = 0;
@@ -204,14 +241,14 @@ int BLI_isect_rcti(rcti *src1, rcti *src2, rcti *dest)
 {
 	int xmin, xmax;
 	int ymin, ymax;
-	
+
 	xmin = (src1->xmin) > (src2->xmin) ? (src1->xmin) : (src2->xmin);
 	xmax = (src1->xmax) < (src2->xmax) ? (src1->xmax) : (src2->xmax);
 	ymin = (src1->ymin) > (src2->ymin) ? (src1->ymin) : (src2->ymin);
 	ymax = (src1->ymax) < (src2->ymax) ? (src1->ymax) : (src2->ymax);
-	
-	if(xmax>=xmin && ymax>=ymin) {
-		if(dest) {
+
+	if (xmax >= xmin && ymax >= ymin) {
+		if (dest) {
 			dest->xmin = xmin;
 			dest->xmax = xmax;
 			dest->ymin = ymin;
@@ -220,7 +257,7 @@ int BLI_isect_rcti(rcti *src1, rcti *src2, rcti *dest)
 		return 1;
 	}
 	else {
-		if(dest) {
+		if (dest) {
 			dest->xmin = 0;
 			dest->xmax = 0;
 			dest->ymin = 0;
@@ -232,18 +269,20 @@ int BLI_isect_rcti(rcti *src1, rcti *src2, rcti *dest)
 
 void BLI_copy_rcti_rctf(rcti *tar, const rctf *src)
 {
-	tar->xmin= floor(src->xmin + 0.5f);
-	tar->xmax= floor((src->xmax - src->xmin) + 0.5f);
-	tar->ymin= floor(src->ymin + 0.5f);
-	tar->ymax= floor((src->ymax - src->ymin) + 0.5f);
+	tar->xmin = floor(src->xmin + 0.5f);
+	tar->xmax = floor((src->xmax - src->xmin) + 0.5f);
+	tar->ymin = floor(src->ymin + 0.5f);
+	tar->ymax = floor((src->ymax - src->ymin) + 0.5f);
 }
 
 void print_rctf(const char *str, rctf *rect)
 {
-	printf("%s: xmin %.3f, xmax %.3f, ymin %.3f, ymax %.3f (%.3fx%.3f)\n", str, rect->xmin, rect->xmax, rect->ymin, rect->ymax, rect->xmax - rect->xmin, rect->ymax - rect->ymin);
+	printf("%s: xmin %.3f, xmax %.3f, ymin %.3f, ymax %.3f (%.3fx%.3f)\n", str,
+	       rect->xmin, rect->xmax, rect->ymin, rect->ymax, rect->xmax - rect->xmin, rect->ymax - rect->ymin);
 }
 
 void print_rcti(const char *str, rcti *rect)
 {
-	printf("%s: xmin %d, xmax %d, ymin %d, ymax %d (%dx%d)\n", str, rect->xmin, rect->xmax, rect->ymin, rect->ymax, rect->xmax - rect->xmin, rect->ymax - rect->ymin);
+	printf("%s: xmin %d, xmax %d, ymin %d, ymax %d (%dx%d)\n", str,
+	       rect->xmin, rect->xmax, rect->ymin, rect->ymax, rect->xmax - rect->xmin, rect->ymax - rect->ymin);
 }
diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c
index 369984c..25850e1 100644
--- a/source/blender/blenlib/intern/scanfill.c
+++ b/source/blender/blenlib/intern/scanfill.c
@@ -30,17 +30,21 @@
  *  \ingroup bli
  */
 
+#include <stdio.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
 
 #include "MEM_guardedalloc.h"
 
 #include "BLI_callbacks.h"
-#include "BLI_editVert.h"
 #include "BLI_listbase.h"
 #include "BLI_math.h"
 #include "BLI_scanfill.h"
+#include "BLI_utildefines.h"
 
 /* callbacks for errors and interrupts and some goo */
-static void (*BLI_localErrorCallBack)(const char*) = NULL;
+static void (*BLI_localErrorCallBack)(const char *) = NULL;
 static int (*BLI_localInterruptCallBack)(void) = NULL;
 
 void BLI_setErrorCallBack(void (*f)(const char *))
@@ -54,7 +58,7 @@ void BLI_setInterruptCallBack(int (*f)(void))
 }
 
 /* just flush the error to /dev/null if the error handler is missing */
-void callLocalErrorCallBack(const char* msg)
+void callLocalErrorCallBack(const char *msg)
 {
 	if (BLI_localErrorCallBack) {
 		BLI_localErrorCallBack(msg);
@@ -67,7 +71,8 @@ static int callLocalInterruptCallBack(void)
 {
 	if (BLI_localInterruptCallBack) {
 		return BLI_localInterruptCallBack();
-	} else {
+	}
+	else {
 		return 0;
 	}
 }
@@ -75,160 +80,164 @@ static int callLocalInterruptCallBack(void)
 
 /* local types */
 typedef struct PolyFill {
-	int edges,verts;
-	float min[3],max[3];
-	short f,nr;
+	int edges, verts;
+	float min_xy[2], max_xy[2];
+	short f, nr;
 } PolyFill;
 
-typedef struct ScFillVert {
-	EditVert *v1;
-	EditEdge *first,*last;
-} ScFillVert;
+typedef struct ScanFillVertLink {
+	ScanFillVert *v1;
+	ScanFillEdge *first, *last;
+} ScanFillVertLink;
 
 
 /* local funcs */
 
-#define COMPLIMIT	0.00003
+#define SF_EPSILON   0.00003f
+
+#define SF_VERT_UNKNOWN  1    /* TODO, what is this for exactly? - need to document it! */
+#define SF_VERT_ZERO_LEN 255
 
-static ScFillVert *scdata;
+/* Optionally set ScanFillEdge f to this to mark original boundary edges.
+ * Only needed if there are internal diagonal edges passed to BLI_edgefill. */
+#define SF_EDGE_BOUNDARY 1
+#define SF_EDGE_UNKNOWN  2    /* TODO, what is this for exactly? - need to document it! */
 
-ListBase fillvertbase = {NULL, NULL};
-ListBase filledgebase = {NULL, NULL};
-ListBase fillfacebase = {NULL, NULL};
 
-static int cox, coy;
 
-/* ****  FUBCTIONS FOR QSORT *************************** */
+/* ****  FUNCTIONS FOR QSORT *************************** */
 
 
 static int vergscdata(const void *a1, const void *a2)
 {
-	const ScFillVert *x1=a1,*x2=a2;
+	const ScanFillVertLink *x1 = a1, *x2 = a2;
 	
-	if( x1->v1->co[coy] < x2->v1->co[coy] ) return 1;
-	else if( x1->v1->co[coy] > x2->v1->co[coy]) return -1;
-	else if( x1->v1->co[cox] > x2->v1->co[cox] ) return 1;
-	else if( x1->v1->co[cox] < x2->v1->co[cox]) return -1;
+	if      (x1->v1->xy[1] < x2->v1->xy[1]) return  1;
+	else if (x1->v1->xy[1] > x2->v1->xy[1]) return -1;
+	else if (x1->v1->xy[0] > x2->v1->xy[0]) return  1;
+	else if (x1->v1->xy[0] < x2->v1->xy[0]) return -1;
 
 	return 0;
 }
 
 static int vergpoly(const void *a1, const void *a2)
 {
-	const PolyFill *x1=a1, *x2=a2;
+	const PolyFill *x1 = a1, *x2 = a2;
 
-	if( x1->min[cox] > x2->min[cox] ) return 1;
-	else if( x1->min[cox] < x2->min[cox] ) return -1;
-	else if( x1->min[coy] > x2->min[coy] ) return 1;
-	else if( x1->min[coy] < x2->min[coy] ) return -1;
+	if      (x1->min_xy[0] > x2->min_xy[0]) return  1;
+	else if (x1->min_xy[0] < x2->min_xy[0]) return -1;
+	else if (x1->min_xy[1] > x2->min_xy[1]) return  1;
+	else if (x1->min_xy[1] < x2->min_xy[1]) return -1;
 	
 	return 0;
 }
 
 /* ************* MEMORY MANAGEMENT ************* */
 
+/* memory management */
 struct mem_elements {
 	struct mem_elements *next, *prev;
 	char *data;
 };
 
-
-/* simple optimization for allocating thousands of small memory blocks
-   only to be used within loops, and not by one function at a time
-   free in the end, with argument '-1'
-*/
-
-static void *new_mem_element(int size)
+static void *mem_element_new(ScanFillContext *sf_ctx, int size)
 {
-	int blocksize= 16384;
-	static int offs= 0;		/* the current free address */
-	static struct mem_elements *cur= 0;
-	static ListBase lb= {0, 0};
-	void *adr;
+	BLI_assert(!(size > 10000 || size == 0)); /* this is invalid use! */
+
+	size = (size + 3) & ~3;     /* allocate in units of 4 */
 	
-	if(size>10000 || size==0) {
-		printf("incorrect use of new_mem_element\n");
+	if (sf_ctx->melem__cur && (size + sf_ctx->melem__offs < MEM_ELEM_BLOCKSIZE)) {
+		void *adr = (void *) (sf_ctx->melem__cur->data + sf_ctx->melem__offs);
+		sf_ctx->melem__offs += size;
+		return adr;
 	}
-	else if(size== -1) {
-		cur= lb.first;
-		while(cur) {
-			MEM_freeN(cur->data);
-			cur= cur->next;
-		}
-		BLI_freelistN(&lb);
-		
-		return NULL;	
+	else {
+		sf_ctx->melem__cur = MEM_callocN(sizeof(struct mem_elements), "newmem");
+		sf_ctx->melem__cur->data = MEM_callocN(MEM_ELEM_BLOCKSIZE, "newmem");
+		BLI_addtail(&sf_ctx->melem__lb, sf_ctx->melem__cur);
+
+		sf_ctx->melem__offs = size;
+		return sf_ctx->melem__cur->data;
 	}
-	
-	size= 4*( (size+3)/4 );
-	
-	if(cur) {
-		if(size+offs < blocksize) {
-			adr= (void *) (cur->data+offs);
-			offs+= size;
-			return adr;
+}
+static void mem_element_reset(ScanFillContext *sf_ctx, int keep_first)
+{
+	struct mem_elements *first;
+
+	if ((first = sf_ctx->melem__lb.first)) { /* can be false if first fill fails */
+		if (keep_first) {
+			BLI_remlink(&sf_ctx->melem__lb, first);
+		}
+
+		sf_ctx->melem__cur = sf_ctx->melem__lb.first;
+		while (sf_ctx->melem__cur) {
+			MEM_freeN(sf_ctx->melem__cur->data);
+			sf_ctx->melem__cur = sf_ctx->melem__cur->next;
+		}
+		BLI_freelistN(&sf_ctx->melem__lb);
+
+		/*reset the block we're keeping*/
+		if (keep_first) {
+			BLI_addtail(&sf_ctx->melem__lb, first);
+			memset(first->data, 0, MEM_ELEM_BLOCKSIZE);
+		}
+		else {
+			first = NULL;
+
 		}
 	}
-	
-	cur= MEM_callocN( sizeof(struct mem_elements), "newmem");
-	cur->data= MEM_callocN(blocksize, "newmem");
-	BLI_addtail(&lb, cur);
-	
-	offs= size;
-	return cur->data;
+
+	sf_ctx->melem__cur = first;
+	sf_ctx->melem__offs = 0;
 }
 
-void BLI_end_edgefill(void)
+void BLI_end_edgefill(ScanFillContext *sf_ctx)
 {
-	new_mem_element(-1);
+	 mem_element_reset(sf_ctx, FALSE);
 	
-	fillvertbase.first= fillvertbase.last= 0;
-	filledgebase.first= filledgebase.last= 0;
-	fillfacebase.first= fillfacebase.last= 0;
+	sf_ctx->fillvertbase.first = sf_ctx->fillvertbase.last = NULL;
+	sf_ctx->filledgebase.first = sf_ctx->filledgebase.last = NULL;
+	sf_ctx->fillfacebase.first = sf_ctx->fillfacebase.last = NULL;
 }
 
 /* ****  FILL ROUTINES *************************** */
 
-EditVert *BLI_addfillvert(float *vec)
+ScanFillVert *BLI_addfillvert(ScanFillContext *sf_ctx, const float vec[3])
 {
-	EditVert *eve;
+	ScanFillVert *eve;
 	
-	eve= new_mem_element(sizeof(EditVert));
-	BLI_addtail(&fillvertbase, eve);
+	eve = mem_element_new(sf_ctx, sizeof(ScanFillVert));
+	BLI_addtail(&sf_ctx->fillvertbase, eve);
 	
-	eve->co[0] = vec[0];
-	eve->co[1] = vec[1];
-	eve->co[2] = vec[2];
+	copy_v3_v3(eve->co, vec);
 
 	return eve;	
 }
 
-EditEdge *BLI_addfilledge(EditVert *v1, EditVert *v2)
+ScanFillEdge *BLI_addfilledge(ScanFillContext *sf_ctx, ScanFillVert *v1, ScanFillVert *v2)
 {
-	EditEdge *newed;
+	ScanFillEdge *newed;
 
-	newed= new_mem_element(sizeof(EditEdge));
-	BLI_addtail(&filledgebase, newed);
+	newed = mem_element_new(sf_ctx, sizeof(ScanFillEdge));
+	BLI_addtail(&sf_ctx->filledgebase, newed);
 	
-	newed->v1= v1;
-	newed->v2= v2;
+	newed->v1 = v1;
+	newed->v2 = v2;
 
 	return newed;
 }
 
-static void addfillface(EditVert *v1, EditVert *v2, EditVert *v3, short mat_nr)
+static void addfillface(ScanFillContext *sf_ctx, ScanFillVert *v1, ScanFillVert *v2, ScanFillVert *v3)
 {
 	/* does not make edges */
-	EditFace *evl;
+	ScanFillFace *evl;
 
-	evl= new_mem_element(sizeof(EditFace));
-	BLI_addtail(&fillfacebase, evl);
+	evl = mem_element_new(sf_ctx, sizeof(ScanFillFace));
+	BLI_addtail(&sf_ctx->fillfacebase, evl);
 	
-	evl->v1= v1;
-	evl->v2= v2;
-	evl->v3= v3;
-	evl->f= 2;
-	evl->mat_nr= mat_nr;
+	evl->v1 = v1;
+	evl->v2 = v2;
+	evl->v3 = v3;
 }
 
 static int boundisect(PolyFill *pf2, PolyFill *pf1)
@@ -236,725 +245,780 @@ static int boundisect(PolyFill *pf2, PolyFill *pf1)
 	/* has pf2 been touched (intersected) by pf1 ? with bounding box */
 	/* test first if polys exist */
 
-	if(pf1->edges==0 || pf2->edges==0) return 0;
+	if (pf1->edges == 0 || pf2->edges == 0) return 0;
 
-	if(pf2->max[cox] < pf1->min[cox] ) return 0;
-	if(pf2->max[coy] < pf1->min[coy] ) return 0;
+	if (pf2->max_xy[0] < pf1->min_xy[0]) return 0;
+	if (pf2->max_xy[1] < pf1->min_xy[1]) return 0;
 
-	if(pf2->min[cox] > pf1->max[cox] ) return 0;
-	if(pf2->min[coy] > pf1->max[coy] ) return 0;
+	if (pf2->min_xy[0] > pf1->max_xy[0]) return 0;
+	if (pf2->min_xy[1] > pf1->max_xy[1]) return 0;
 
 	/* join */
-	if(pf2->max[cox]<pf1->max[cox]) pf2->max[cox]= pf1->max[cox];
-	if(pf2->max[coy]<pf1->max[coy]) pf2->max[coy]= pf1->max[coy];
+	if (pf2->max_xy[0] < pf1->max_xy[0]) pf2->max_xy[0] = pf1->max_xy[0];
+	if (pf2->max_xy[1] < pf1->max_xy[1]) pf2->max_xy[1] = pf1->max_xy[1];
 
-	if(pf2->min[cox]>pf1->min[cox]) pf2->min[cox]= pf1->min[cox];
-	if(pf2->min[coy]>pf1->min[coy]) pf2->min[coy]= pf1->min[coy];
+	if (pf2->min_xy[0] > pf1->min_xy[0]) pf2->min_xy[0] = pf1->min_xy[0];
+	if (pf2->min_xy[1] > pf1->min_xy[1]) pf2->min_xy[1] = pf1->min_xy[1];
 
 	return 1;
 }
 
 
-static void mergepolysSimp(PolyFill *pf1, PolyFill *pf2)	/* add pf2 to pf1 */
+static void mergepolysSimp(ScanFillContext *sf_ctx, PolyFill *pf1, PolyFill *pf2)    /* add pf2 to pf1 */
 {
-	EditVert *eve;
-	EditEdge *eed;
+	ScanFillVert *eve;
+	ScanFillEdge *eed;
 
 	/* replace old poly numbers */
-	eve= fillvertbase.first;
-	while(eve) {
-		if(eve->xs== pf2->nr) eve->xs= pf1->nr;
-		eve= eve->next;
+	eve = sf_ctx->fillvertbase.first;
+	while (eve) {
+		if (eve->poly_nr == pf2->nr) eve->poly_nr = pf1->nr;
+		eve = eve->next;
 	}
-	eed= filledgebase.first;
-	while(eed) {
-		if(eed->f1== pf2->nr) eed->f1= pf1->nr;
-		eed= eed->next;
+	eed = sf_ctx->filledgebase.first;
+	while (eed) {
+		if (eed->poly_nr == pf2->nr) eed->poly_nr = pf1->nr;
+		eed = eed->next;
 	}
 
-	pf1->verts+= pf2->verts;
-	pf1->edges+= pf2->edges;
-	pf2->verts= pf2->edges= 0;
-	pf1->f= (pf1->f | pf2->f);
+	pf1->verts += pf2->verts;
+	pf1->edges += pf2->edges;
+	pf2->verts = pf2->edges = 0;
+	pf1->f = (pf1->f | pf2->f);
 }
 
-static short testedgeside(float *v1, float *v2, float *v3)
+static short testedgeside(const float v1[2], const float v2[2], const float v3[2])
 /* is v3 to the right of v1-v2 ? With exception: v3==v1 || v3==v2 */
 {
 	float inp;
 
-	inp= (v2[cox]-v1[cox])*(v1[coy]-v3[coy])
-		+(v1[coy]-v2[coy])*(v1[cox]-v3[cox]);
+	inp = (v2[0] - v1[0]) * (v1[1] - v3[1]) +
+	      (v1[1] - v2[1]) * (v1[0] - v3[0]);
 
-	if(inp < 0.0f) return 0;
-	else if(inp==0) {
-		if(v1[cox]==v3[cox] && v1[coy]==v3[coy]) return 0;
-		if(v2[cox]==v3[cox] && v2[coy]==v3[coy]) return 0;
+	if (inp < 0.0f) {
+		return 0;
+	}
+	else if (inp == 0) {
+		if (v1[0] == v3[0] && v1[1] == v3[1]) return 0;
+		if (v2[0] == v3[0] && v2[1] == v3[1]) return 0;
 	}
 	return 1;
 }
 
-static short addedgetoscanvert(ScFillVert *sc, EditEdge *eed)
+static short addedgetoscanvert(ScanFillVertLink *sc, ScanFillEdge *eed)
 {
 	/* find first edge to the right of eed, and insert eed before that */
-	EditEdge *ed;
-	float fac,fac1,x,y;
+	ScanFillEdge *ed;
+	float fac, fac1, x, y;
 
-	if(sc->first==0) {
-		sc->first= sc->last= eed;
-		eed->prev= eed->next=0;
+	if (sc->first == NULL) {
+		sc->first = sc->last = eed;
+		eed->prev = eed->next = NULL;
 		return 1;
 	}
 
-	x= eed->v1->co[cox];
-	y= eed->v1->co[coy];
+	x = eed->v1->xy[0];
+	y = eed->v1->xy[1];
 
-	fac1= eed->v2->co[coy]-y;
-	if(fac1==0.0f) {
-		fac1= 1.0e10f*(eed->v2->co[cox]-x);
+	fac1 = eed->v2->xy[1] - y;
+	if (fac1 == 0.0f) {
+		fac1 = 1.0e10f * (eed->v2->xy[0] - x);
 
 	}
-	else fac1= (x-eed->v2->co[cox])/fac1;
+	else fac1 = (x - eed->v2->xy[0]) / fac1;
 
-	ed= sc->first;
-	while(ed) {
+	for (ed = sc->first; ed; ed = ed->next) {
 
-		if(ed->v2==eed->v2) return 0;
-
-		fac= ed->v2->co[coy]-y;
-		if(fac==0.0f) {
-			fac= 1.0e10f*(ed->v2->co[cox]-x);
+		if (ed->v2 == eed->v2) {
+			return 0;
+		}
 
+		fac = ed->v2->xy[1] - y;
+		if (fac == 0.0f) {
+			fac = 1.0e10f * (ed->v2->xy[0] - x);
+		}
+		else {
+			fac = (x - ed->v2->xy[0]) / fac;
 		}
-		else fac= (x-ed->v2->co[cox])/fac;
-		if(fac>fac1) break;
 
-		ed= ed->next;
+		if (fac > fac1) {
+			break;
+		}
 	}
-	if(ed) BLI_insertlinkbefore((ListBase *)&(sc->first), ed, eed);
-	else BLI_addtail((ListBase *)&(sc->first),eed);
+	if (ed) BLI_insertlinkbefore((ListBase *)&(sc->first), ed, eed);
+	else BLI_addtail((ListBase *)&(sc->first), eed);
 
 	return 1;
 }
 
 
-static ScFillVert *addedgetoscanlist(EditEdge *eed, int len)
+static ScanFillVertLink *addedgetoscanlist(ScanFillContext *sf_ctx, ScanFillEdge *eed, int len)
 {
-	/* inserts edge at correct location in ScFillVert list */
+	/* inserts edge at correct location in ScanFillVertLink list */
 	/* returns sc when edge already exists */
-	ScFillVert *sc,scsearch;
-	EditVert *eve;
+	ScanFillVertLink *sc, scsearch;
+	ScanFillVert *eve;
 
 	/* which vert is left-top? */
-	if(eed->v1->co[coy] == eed->v2->co[coy]) {
-		if(eed->v1->co[cox] > eed->v2->co[cox]) {
-			eve= eed->v1;
-			eed->v1= eed->v2;
-			eed->v2= eve;
+	if (eed->v1->xy[1] == eed->v2->xy[1]) {
+		if (eed->v1->xy[0] > eed->v2->xy[0]) {
+			eve = eed->v1;
+			eed->v1 = eed->v2;
+			eed->v2 = eve;
 		}
 	}
-	else if(eed->v1->co[coy] < eed->v2->co[coy]) {
-		eve= eed->v1;
-		eed->v1= eed->v2;
-		eed->v2= eve;
+	else if (eed->v1->xy[1] < eed->v2->xy[1]) {
+		eve = eed->v1;
+		eed->v1 = eed->v2;
+		eed->v2 = eve;
 	}
 	/* find location in list */
-	scsearch.v1= eed->v1;
-	sc= (ScFillVert *)bsearch(&scsearch,scdata,len,
-		sizeof(ScFillVert), vergscdata);
+	scsearch.v1 = eed->v1;
+	sc = (ScanFillVertLink *)bsearch(&scsearch, sf_ctx->_scdata, len,
+	                                 sizeof(ScanFillVertLink), vergscdata);
 
-	if(sc==0) printf("Error in search edge: %p\n", (void *)eed);
-	else if(addedgetoscanvert(sc,eed)==0) return sc;
+	if (sc == 0) printf("Error in search edge: %p\n", (void *)eed);
+	else if (addedgetoscanvert(sc, eed) == 0) return sc;
 
 	return 0;
 }
 
-static short boundinsideEV(EditEdge *eed, EditVert *eve)
+static short boundinsideEV(ScanFillEdge *eed, ScanFillVert *eve)
 /* is eve inside boundbox eed */
 {
-	float minx,maxx,miny,maxy;
-
-	if(eed->v1->co[cox]<eed->v2->co[cox]) {
-		minx= eed->v1->co[cox];
-		maxx= eed->v2->co[cox];
-	} else {
-		minx= eed->v2->co[cox];
-		maxx= eed->v1->co[cox];
+	float minx, maxx, miny, maxy;
+
+	if (eed->v1->xy[0] < eed->v2->xy[0]) {
+		minx = eed->v1->xy[0];
+		maxx = eed->v2->xy[0];
 	}
-	if(eve->co[cox]>=minx && eve->co[cox]<=maxx) {
-		if(eed->v1->co[coy]<eed->v2->co[coy]) {
-			miny= eed->v1->co[coy];
-			maxy= eed->v2->co[coy];
-		} else {
-			miny= eed->v2->co[coy];
-			maxy= eed->v1->co[coy];
+	else {
+		minx = eed->v2->xy[0];
+		maxx = eed->v1->xy[0];
+	}
+	if (eve->xy[0] >= minx && eve->xy[0] <= maxx) {
+		if (eed->v1->xy[1] < eed->v2->xy[1]) {
+			miny = eed->v1->xy[1];
+			maxy = eed->v2->xy[1];
+		}
+		else {
+			miny = eed->v2->xy[1];
+			maxy = eed->v1->xy[1];
+		}
+		if (eve->xy[1] >= miny && eve->xy[1] <= maxy) {
+			return 1;
 		}
-		if(eve->co[coy]>=miny && eve->co[coy]<=maxy) return 1;
 	}
 	return 0;
 }
 
 
-static void testvertexnearedge(void)
+static void testvertexnearedge(ScanFillContext *sf_ctx)
 {
 	/* only vertices with ->h==1 are being tested for
-		being close to an edge, if true insert */
+	 * being close to an edge, if true insert */
 
-	EditVert *eve;
-	EditEdge *eed,*ed1;
-	float dist,vec1[2],vec2[2],vec3[2];
+	ScanFillVert *eve;
+	ScanFillEdge *eed, *ed1;
 
-	eve= fillvertbase.first;
-	while(eve) {
-		if(eve->h==1) {
-			vec3[0]= eve->co[cox];
-			vec3[1]= eve->co[coy];
+	for (eve = sf_ctx->fillvertbase.first; eve; eve = eve->next) {
+		if (eve->h == 1) {
 			/* find the edge which has vertex eve */
-			ed1= filledgebase.first;
-			while(ed1) {
-				if(ed1->v1==eve || ed1->v2==eve) break;
-				ed1= ed1->next;
+			ed1 = sf_ctx->filledgebase.first;
+			while (ed1) {
+				if (ed1->v1 == eve || ed1->v2 == eve) break;
+				ed1 = ed1->next;
 			}
-			if(ed1->v1==eve) {
-				ed1->v1= ed1->v2;
-				ed1->v2= eve;
+			if (ed1->v1 == eve) {
+				ed1->v1 = ed1->v2;
+				ed1->v2 = eve;
 			}
-			eed= filledgebase.first;
-			while(eed) {
-				if(eve!=eed->v1 && eve!=eed->v2 && eve->xs==eed->f1) {
-					if(compare_v3v3(eve->co,eed->v1->co, COMPLIMIT)) {
-						ed1->v2= eed->v1;
+
+			for (eed = sf_ctx->filledgebase.first; eed; eed = eed->next) {
+				if (eve != eed->v1 && eve != eed->v2 && eve->poly_nr == eed->poly_nr) {
+					if (compare_v3v3(eve->co, eed->v1->co, SF_EPSILON)) {
+						ed1->v2 = eed->v1;
 						eed->v1->h++;
-						eve->h= 0;
+						eve->h = 0;
 						break;
 					}
-					else if(compare_v3v3(eve->co,eed->v2->co, COMPLIMIT)) {
-						ed1->v2= eed->v2;
+					else if (compare_v3v3(eve->co, eed->v2->co, SF_EPSILON)) {
+						ed1->v2 = eed->v2;
 						eed->v2->h++;
-						eve->h= 0;
+						eve->h = 0;
 						break;
 					}
 					else {
-						vec1[0]= eed->v1->co[cox];
-						vec1[1]= eed->v1->co[coy];
-						vec2[0]= eed->v2->co[cox];
-						vec2[1]= eed->v2->co[coy];
-						if(boundinsideEV(eed,eve)) {
-							dist= dist_to_line_v2(vec1,vec2,vec3);
-							if(dist<(float)COMPLIMIT) {
+						if (boundinsideEV(eed, eve)) {
+							const float dist = dist_to_line_v2(eed->v1->xy, eed->v2->xy, eve->xy);
+							if (dist < SF_EPSILON) {
 								/* new edge */
-								ed1= BLI_addfilledge(eed->v1, eve);
+								ed1 = BLI_addfilledge(sf_ctx, eed->v1, eve);
 								
 								/* printf("fill: vertex near edge %x\n",eve); */
-								ed1->f= ed1->h= 0;
-								ed1->f1= eed->f1;
-								eed->v1= eve;
-								eve->h= 3;
+								ed1->f = 0;
+								ed1->poly_nr = eed->poly_nr;
+								eed->v1 = eve;
+								eve->h = 3;
 								break;
 							}
 						}
 					}
 				}
-				eed= eed->next;
 			}
 		}
-		eve= eve->next;
 	}
 }
 
-static void splitlist(ListBase *tempve, ListBase *temped, short nr)
+static void splitlist(ScanFillContext *sf_ctx, ListBase *tempve, ListBase *temped, short nr)
 {
 	/* everything is in templist, write only poly nr to fillist */
-	EditVert *eve,*nextve;
-	EditEdge *eed,*nexted;
-
-	BLI_movelisttolist(tempve,&fillvertbase);
-	BLI_movelisttolist(temped,&filledgebase);
-
-	eve= tempve->first;
-	while(eve) {
-		nextve= eve->next;
-		if(eve->xs==nr) {
-			BLI_remlink(tempve,eve);
-			BLI_addtail(&fillvertbase,eve);
+	ScanFillVert *eve, *nextve;
+	ScanFillEdge *eed, *nexted;
+
+	BLI_movelisttolist(tempve, &sf_ctx->fillvertbase);
+	BLI_movelisttolist(temped, &sf_ctx->filledgebase);
+
+	eve = tempve->first;
+	while (eve) {
+		nextve = eve->next;
+		if (eve->poly_nr == nr) {
+			BLI_remlink(tempve, eve);
+			BLI_addtail(&sf_ctx->fillvertbase, eve);
 		}
-		eve= nextve;
+		eve = nextve;
 	}
-	eed= temped->first;
-	while(eed) {
-		nexted= eed->next;
-		if(eed->f1==nr) {
-			BLI_remlink(temped,eed);
-			BLI_addtail(&filledgebase,eed);
+	eed = temped->first;
+	while (eed) {
+		nexted = eed->next;
+		if (eed->poly_nr == nr) {
+			BLI_remlink(temped, eed);
+			BLI_addtail(&sf_ctx->filledgebase, eed);
 		}
-		eed= nexted;
+		eed = nexted;
 	}
 }
 
 
-static int scanfill(PolyFill *pf, short mat_nr)
+static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf)
 {
-	ScFillVert *sc = NULL, *sc1;
-	EditVert *eve,*v1,*v2,*v3;
-	EditEdge *eed,*nexted,*ed1,*ed2,*ed3;
-	float miny = 0.0;
-	int a,b,verts, maxface, totface;	
-	short nr, test, twoconnected=0;
-
-	nr= pf->nr;
-
-	/* PRINTS
-	verts= pf->verts;
-	eve= fillvertbase.first;
-	while(eve) {
-		printf("vert: %x co: %f %f\n",eve,eve->co[cox],eve->co[coy]);
-		eve= eve->next;
+	ScanFillVertLink *sc = NULL, *sc1;
+	ScanFillVert *eve, *v1, *v2, *v3;
+	ScanFillEdge *eed, *nexted, *ed1, *ed2, *ed3;
+	int a, b, verts, maxface, totface;
+	short nr, test, twoconnected = 0;
+
+	nr = pf->nr;
+
+	/* PRINTS */
+#if 0
+	verts = pf->verts;
+	eve = sf_ctx->fillvertbase.first;
+	while (eve) {
+		printf("vert: %x co: %f %f\n", eve, eve->xy[0], eve->xy[1]);
+		eve = eve->next;
 	}	
-	eed= filledgebase.first;
-	while(eed) {
-		printf("edge: %x  verts: %x %x\n",eed,eed->v1,eed->v2);
-		eed= eed->next;
-	} */
+	eed = sf_ctx->filledgebase.first;
+	while (eed) {
+		printf("edge: %x  verts: %x %x\n", eed, eed->v1, eed->v2);
+		eed = eed->next;
+	}
+#endif
 
 	/* STEP 0: remove zero sized edges */
-	eed= filledgebase.first;
-	while(eed) {
-		if(eed->v1->co[cox]==eed->v2->co[cox]) {
-			if(eed->v1->co[coy]==eed->v2->co[coy]) {
-				if(eed->v1->f==255 && eed->v2->f!=255) {
-					eed->v2->f= 255;
-					eed->v2->tmp.v= eed->v1->tmp.v;
-				}
-				else if(eed->v2->f==255 && eed->v1->f!=255) {
-					eed->v1->f= 255;
-					eed->v1->tmp.v= eed->v2->tmp.v;
-				}
-				else if(eed->v2->f==255 && eed->v1->f==255) {
-					eed->v1->tmp.v= eed->v2->tmp.v;
-				}
-				else {
-					eed->v2->f= 255;
-					eed->v2->tmp.v = eed->v1->tmp.v;
-				}
+	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
-		ScFillVert list
-	*/
-	sc= scdata= (ScFillVert *)MEM_callocN(pf->verts*sizeof(ScFillVert),"Scanfill1");
-	eve= fillvertbase.first;
-	verts= 0;
-	while(eve) {
-		if(eve->xs==nr) {
-			if(eve->f!= 255) {
+	 * ScanFillVertLink list
+	 */
+	sc = sf_ctx->_scdata = (ScanFillVertLink *)MEM_callocN(pf->verts * sizeof(ScanFillVertLink), "Scanfill1");
+	eve = sf_ctx->fillvertbase.first;
+	verts = 0;
+	while (eve) {
+		if (eve->poly_nr == nr) {
+			if (eve->f != SF_VERT_ZERO_LEN) {
 				verts++;
-				eve->f= 0;	/* flag for connectedges later on */
-				sc->v1= eve;
+				eve->f = 0;  /* flag for connectedges later on */
+				sc->v1 = eve;
 				sc++;
 			}
 		}
-		eve= eve->next;
+		eve = eve->next;
 	}
 
-	qsort(scdata, verts, sizeof(ScFillVert), vergscdata);
-
-	eed= filledgebase.first;
-	while(eed) {
-		nexted= eed->next;
-		eed->f= 0;
-		BLI_remlink(&filledgebase,eed);
-/* commented all of this out, this I have no idea for what it is for, probably from ancient past */
-/* it does crash blender, since it uses mixed original and new vertices (ton) */
-//		if(eed->v1->f==255) {
-//			v1= eed->v1;
-//			while((eed->v1->f == 255) && (eed->v1->tmp.v != v1)) 
-//				eed->v1 = eed->v1->tmp.v;
-//		}
-//		if(eed->v2->f==255) {
-//			v2= eed->v2;
-//			while((eed->v2->f == 255) && (eed->v2->tmp.v != v2))
-//				eed->v2 = eed->v2->tmp.v;
-//		}
-		if(eed->v1!=eed->v2) addedgetoscanlist(eed,verts);
-
-		eed= nexted;
+	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 (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);
+
+		eed = nexted;
 	}
-	/*
-	sc= scdata;
-	for(a=0;a<verts;a++) {
-		printf("\nscvert: %x\n",sc->v1);
-		eed= sc->first;
-		while(eed) {
-			printf(" ed %x %x %x\n",eed,eed->v1,eed->v2);
-			eed= eed->next;
+#if 0
+	sc = scdata;
+	for (a = 0; a < verts; a++) {
+		printf("\nscvert: %x\n", sc->v1);
+		eed = sc->first;
+		while (eed) {
+			printf(" ed %x %x %x\n", eed, eed->v1, eed->v2);
+			eed = eed->next;
 		}
 		sc++;
-	}*/
+	}
+#endif
 
 
 	/* STEP 2: FILL LOOP */
 
-	if(pf->f==0) twoconnected= 1;
+	if (pf->f == 0) twoconnected = 1;
 
 	/* (temporal) security: never much more faces than vertices */
-	totface= 0;
-	maxface= 2*verts;		/* 2*verts: based at a filled circle within a triangle */
+	totface = 0;
+	maxface = 2 * verts;       /* 2*verts: based at a filled circle within a triangle */
 
-	sc= scdata;
-	for(a=0;a<verts;a++) {
+	sc = sf_ctx->_scdata;
+	for (a = 0; a < verts; a++) {
 		/* printf("VERTEX %d %x\n",a,sc->v1); */
-		ed1= sc->first;
-		while(ed1) {	/* set connectflags  */
-			nexted= ed1->next;
-			if(ed1->v1->h==1 || ed1->v2->h==1) {
-				BLI_remlink((ListBase *)&(sc->first),ed1);
-				BLI_addtail(&filledgebase,ed1);
-				if(ed1->v1->h>1) ed1->v1->h--;
-				if(ed1->v2->h>1) ed1->v2->h--;
+		ed1 = sc->first;
+		while (ed1) {   /* set connectflags  */
+			nexted = ed1->next;
+			if (ed1->v1->h == 1 || ed1->v2->h == 1) {
+				BLI_remlink((ListBase *)&(sc->first), ed1);
+				BLI_addtail(&sf_ctx->filledgebase, ed1);
+				if (ed1->v1->h > 1) ed1->v1->h--;
+				if (ed1->v2->h > 1) ed1->v2->h--;
 			}
-			else ed1->v2->f= 1;
+			else ed1->v2->f = SF_VERT_UNKNOWN;
 
-			ed1= nexted;
+			ed1 = nexted;
 		}
-		while(sc->first) {	/* for as long there are edges */
-			ed1= sc->first;
-			ed2= ed1->next;
+		while (sc->first) { /* for as long there are edges */
+			ed1 = sc->first;
+			ed2 = ed1->next;
 			
 			/* commented out... the ESC here delivers corrupted memory (and doesnt work during grab) */
-			/* if(callLocalInterruptCallBack()) break; */
-			if(totface>maxface) {
+			/* if (callLocalInterruptCallBack()) break; */
+			if (totface > maxface) {
 				/* printf("Fill error: endless loop. Escaped at vert %d,  tot: %d.\n", a, verts); */
-				a= verts;
+				a = verts;
 				break;
 			}
-			if(ed2==0) {
-				sc->first=sc->last= 0;
+			if (ed2 == 0) {
+				sc->first = sc->last = NULL;
 				/* printf("just 1 edge to vert\n"); */
-				BLI_addtail(&filledgebase,ed1);
-				ed1->v2->f= 0;
+				BLI_addtail(&sf_ctx->filledgebase, ed1);
+				ed1->v2->f = 0;
 				ed1->v1->h--; 
 				ed1->v2->h--;
-			} else {
+			}
+			else {
 				/* test rest of vertices */
-				v1= ed1->v2;
-				v2= ed1->v1;
-				v3= ed2->v2;
+				float miny;
+				v1 = ed1->v2;
+				v2 = ed1->v1;
+				v3 = ed2->v2;
 				/* this happens with a serial of overlapping edges */
-				if(v1==v2 || v2==v3) break;
+				if (v1 == v2 || v2 == v3) break;
 				/* printf("test verts %x %x %x\n",v1,v2,v3); */
-				miny = ( (v1->co[coy])<(v3->co[coy]) ? (v1->co[coy]) : (v3->co[coy]) );
-				/*  miny= MIN2(v1->co[coy],v3->co[coy]); */
-				sc1= sc+1;
-				test= 0;
-
-				for(b=a+1;b<verts;b++) {
-					if(sc1->v1->f==0) {
-						if(sc1->v1->co[coy] <= miny) break;
-
-						if(testedgeside(v1->co,v2->co,sc1->v1->co))
-							if(testedgeside(v2->co,v3->co,sc1->v1->co))
-								if(testedgeside(v3->co,v1->co,sc1->v1->co)) {
+				miny = minf(v1->xy[1], v3->xy[1]);
+				/*  miny= MIN2(v1->xy[1],v3->xy[1]); */
+				sc1 = sc + 1;
+				test = 0;
+
+				for (b = a + 1; b < verts; b++) {
+					if (sc1->v1->f == 0) {
+						if (sc1->v1->xy[1] <= miny) break;
+
+						if (testedgeside(v1->xy, v2->xy, sc1->v1->xy))
+							if (testedgeside(v2->xy, v3->xy, sc1->v1->xy))
+								if (testedgeside(v3->xy, v1->xy, sc1->v1->xy)) {
 									/* point in triangle */
 								
-									test= 1;
+									test = 1;
 									break;
 								}
 					}
 					sc1++;
 				}
-				if(test) {
+				if (test) {
 					/* make new edge, and start over */
 					/* printf("add new edge %x %x and start again\n",v2,sc1->v1); */
 
-					ed3= BLI_addfilledge(v2, sc1->v1);
-					BLI_remlink(&filledgebase, ed3);
+					ed3 = BLI_addfilledge(sf_ctx, v2, sc1->v1);
+					BLI_remlink(&sf_ctx->filledgebase, ed3);
 					BLI_insertlinkbefore((ListBase *)&(sc->first), ed2, ed3);
-					ed3->v2->f= 1;
-					ed3->f= 2;
+					ed3->v2->f = SF_VERT_UNKNOWN;
+					ed3->f = SF_EDGE_UNKNOWN;
 					ed3->v1->h++; 
 					ed3->v2->h++;
 				}
 				else {
 					/* new triangle */
 					/* printf("add face %x %x %x\n",v1,v2,v3); */
-					addfillface(v1, v2, v3, mat_nr);
+					addfillface(sf_ctx, v1, v2, v3);
 					totface++;
-					BLI_remlink((ListBase *)&(sc->first),ed1);
-					BLI_addtail(&filledgebase,ed1);
-					ed1->v2->f= 0;
+					BLI_remlink((ListBase *)&(sc->first), ed1);
+					BLI_addtail(&sf_ctx->filledgebase, ed1);
+					ed1->v2->f = 0;
 					ed1->v1->h--; 
 					ed1->v2->h--;
-					/* ed2 can be removed when it's an old one */
-					if(ed2->f==0 && twoconnected) {
-						BLI_remlink((ListBase *)&(sc->first),ed2);
-						BLI_addtail(&filledgebase,ed2);
-						ed2->v2->f= 0;
+					/* ed2 can be removed when it's a boundary edge */
+					if ((ed2->f == 0 && twoconnected) || (ed2->f == SF_EDGE_BOUNDARY)) {
+						BLI_remlink((ListBase *)&(sc->first), ed2);
+						BLI_addtail(&sf_ctx->filledgebase, ed2);
+						ed2->v2->f = 0;
 						ed2->v1->h--; 
 						ed2->v2->h--;
 					}
 
 					/* new edge */
-					ed3= BLI_addfilledge(v1, v3);
-					BLI_remlink(&filledgebase, ed3);
-					ed3->f= 2;
+					ed3 = BLI_addfilledge(sf_ctx, v1, v3);
+					BLI_remlink(&sf_ctx->filledgebase, ed3);
+					ed3->f = SF_EDGE_UNKNOWN;
 					ed3->v1->h++; 
 					ed3->v2->h++;
 					
 					/* printf("add new edge %x %x\n",v1,v3); */
-					sc1= addedgetoscanlist(ed3, verts);
+					sc1 = addedgetoscanlist(sf_ctx, ed3, verts);
 					
-					if(sc1) {	/* ed3 already exists: remove */
+					if (sc1) {  /* ed3 already exists: remove if a boundary */
 						/* printf("Edge exists\n"); */
 						ed3->v1->h--; 
 						ed3->v2->h--;
 
-						if(twoconnected) ed3= sc1->first;
-						else ed3= 0;
-						while(ed3) {
-							if( (ed3->v1==v1 && ed3->v2==v3) || (ed3->v1==v3 && ed3->v2==v1) ) {
-								BLI_remlink((ListBase *)&(sc1->first),ed3);
-								BLI_addtail(&filledgebase,ed3);
-								ed3->v1->h--; 
-								ed3->v2->h--;
+						ed3 = sc1->first;
+						while (ed3) {
+							if ( (ed3->v1 == v1 && ed3->v2 == v3) || (ed3->v1 == v3 && ed3->v2 == v1) ) {
+								if (twoconnected || ed3->f == SF_EDGE_BOUNDARY) {
+									BLI_remlink((ListBase *)&(sc1->first), ed3);
+									BLI_addtail(&sf_ctx->filledgebase, ed3);
+									ed3->v1->h--; 
+									ed3->v2->h--;
+								}
 								break;
 							}
-							ed3= ed3->next;
+							ed3 = ed3->next;
 						}
 					}
 
 				}
 			}
 			/* test for loose edges */
-			ed1= sc->first;
-			while(ed1) {
-				nexted= ed1->next;
-				if(ed1->v1->h<2 || ed1->v2->h<2) {
-					BLI_remlink((ListBase *)&(sc->first),ed1);
-					BLI_addtail(&filledgebase,ed1);
-					if(ed1->v1->h>1) ed1->v1->h--;
-					if(ed1->v2->h>1) ed1->v2->h--;
+			ed1 = sc->first;
+			while (ed1) {
+				nexted = ed1->next;
+				if (ed1->v1->h < 2 || ed1->v2->h < 2) {
+					BLI_remlink((ListBase *)&(sc->first), ed1);
+					BLI_addtail(&sf_ctx->filledgebase, ed1);
+					if (ed1->v1->h > 1) ed1->v1->h--;
+					if (ed1->v2->h > 1) ed1->v2->h--;
 				}
 
-				ed1= nexted;
+				ed1 = nexted;
 			}
 		}
 		sc++;
 	}
 
-	MEM_freeN(scdata);
+	MEM_freeN(sf_ctx->_scdata);
+	sf_ctx->_scdata = NULL;
 
 	return totface;
 }
 
 
+int BLI_begin_edgefill(ScanFillContext *sf_ctx)
+{
+	memset(sf_ctx, 0, sizeof(*sf_ctx));
+
+	return 1;
+}
+
+int BLI_edgefill(ScanFillContext *sf_ctx, const short do_quad_tri_speedup)
+{
+	return BLI_edgefill_ex(sf_ctx, do_quad_tri_speedup, NULL);
+}
 
-int BLI_edgefill(short mat_nr)
+int BLI_edgefill_ex(ScanFillContext *sf_ctx, const short do_quad_tri_speedup, const float nor_proj[3])
 {
 	/*
-	  - fill works with its own lists, so create that first (no faces!)
-	  - for vertices, put in ->tmp.v the old pointer
-	  - struct elements xs en ys are not used here: don't hide stuff in it
-	  - edge flag ->f becomes 2 when it's a new edge
-	  - mode: & 1 is check for crossings, then create edges (TO DO )
-	  - returns number of triangle faces added.
-	*/
+	 * - fill works with its own lists, so create that first (no faces!)
+	 * - for vertices, put in ->tmp.v the old pointer
+	 * - struct elements xs en ys are not used here: don't hide stuff in it
+	 * - edge flag ->f becomes 2 when it's a new edge
+	 * - mode: & 1 is check for crossings, then create edges (TO DO )
+	 * - returns number of triangle faces added.
+	 */
 	ListBase tempve, temped;
-	EditVert *eve;
-	EditEdge *eed,*nexted;
-	PolyFill *pflist,*pf;
-	float *minp, *maxp, *v1, *v2, norm[3], len;
-	short a,c,poly=0,ok=0,toggle=0;
-	int totfaces= 0; /* total faces added */
+	ScanFillVert *eve;
+	ScanFillEdge *eed, *nexted;
+	PolyFill *pflist, *pf;
+	float *min_xy_p, *max_xy_p;
+	short a, c, poly = 0, ok = 0, toggle = 0;
+	int totfaces = 0; /* total faces added */
+	int co_x, co_y;
 
 	/* reset variables */
-	eve= fillvertbase.first;
-	while(eve) {
-		eve->f= 0;
-		eve->xs= 0;
-		eve->h= 0;
-		eve= eve->next;
+	eve = sf_ctx->fillvertbase.first;
+	a = 0;
+	while (eve) {
+		eve->f = 0;
+		eve->poly_nr = 0;
+		eve->h = 0;
+		eve = eve->next;
+		a += 1;
+	}
+
+	if (do_quad_tri_speedup && (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);
+		}
+		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;
 	}
 
 	/* first test vertices if they are in edges */
 	/* including resetting of flags */
-	eed= filledgebase.first;
-	while(eed) {
-		eed->f= eed->f1= eed->h= 0;
-		eed->v1->f= 1;
-		eed->v2->f= 1;
+	eed = sf_ctx->filledgebase.first;
+	while (eed) {
+		eed->poly_nr = 0;
+		eed->v1->f = SF_VERT_UNKNOWN;
+		eed->v2->f = SF_VERT_UNKNOWN;
 
-		eed= eed->next;
+		eed = eed->next;
 	}
 
-	eve= fillvertbase.first;
-	while(eve) {
-		if(eve->f & 1) {
-			ok=1; 
+	eve = sf_ctx->fillvertbase.first;
+	while (eve) {
+		if (eve->f & SF_VERT_UNKNOWN) {
+			ok = 1;
 			break;
 		}
-		eve= eve->next;
+		eve = eve->next;
 	}
 
-	if(ok==0) return 0;
+	if (ok == 0) {
+		return 0;
+	}
+	else {
+		float n[3];
 
-	/* NEW NEW! define projection: with 'best' normal */
-	/* just use the first three different vertices */
-	
-	/* THIS PART STILL IS PRETTY WEAK! (ton) */
-	
-	eve= fillvertbase.last;
-	len= 0.0;
-	v1= eve->co;
-	v2= 0;
-	eve= fillvertbase.first;
-	while(eve) {
-		if(v2) {
-			if( compare_v3v3(v2, eve->co, COMPLIMIT)==0) {
-				len= normal_tri_v3( norm,v1, v2, eve->co);
-				if(len != 0.0f) break;
+		if (nor_proj) {
+			copy_v3_v3(n, nor_proj);
+		}
+		else {
+			/* define projection: with 'best' normal */
+			/* Newell's Method */
+			/* Similar code used elsewhere, but this checks for double ups
+			 * which historically this function supports so better not change */
+			float *v_prev;
+
+			zero_v3(n);
+			eve = sf_ctx->fillvertbase.last;
+			v_prev = eve->co;
+
+			for (eve = sf_ctx->fillvertbase.first; eve; eve = eve->next) {
+				if (LIKELY(!compare_v3v3(v_prev, eve->co, SF_EPSILON))) {
+					add_newell_cross_v3_v3v3(n, v_prev, eve->co);
+					v_prev = eve->co;
+				}
 			}
 		}
-		else if(compare_v3v3(v1, eve->co, COMPLIMIT)==0) {
-			v2= eve->co;
+
+		if (UNLIKELY(normalize_v3(n) == 0.0f)) {
+			return 0;
 		}
-		eve= eve->next;
-	}
 
-	if(len==0.0f) return 0;	/* no fill possible */
+		axis_dominant_v3(&co_x, &co_y, n);
+	}
 
-	axis_dominant_v3(&cox, &coy, norm);
 
 	/* STEP 1: COUNT POLYS */
-	eve= fillvertbase.first;
-	while(eve) {
+	eve = sf_ctx->fillvertbase.first;
+	while (eve) {
+		eve->xy[0] = eve->co[co_x];
+		eve->xy[1] = eve->co[co_y];
+
 		/* get first vertex with no poly number */
-		if(eve->xs==0) {
+		if (eve->poly_nr == 0) {
 			poly++;
-			/* now a sortof select connected */
-			ok= 1;
-			eve->xs= poly;
+			/* now a sort of select connected */
+			ok = 1;
+			eve->poly_nr = poly;
 			
-			while(ok) {
+			while (ok) {
 				
-				ok= 0;
+				ok = 0;
 				toggle++;
-				if(toggle & 1) eed= filledgebase.first;
-				else eed= filledgebase.last;
-
-				while(eed) {
-					if(eed->v1->xs==0 && eed->v2->xs==poly) {
-						eed->v1->xs= poly;
-						eed->f1= poly;
-						ok= 1;
+				if (toggle & 1) eed = sf_ctx->filledgebase.first;
+				else eed = sf_ctx->filledgebase.last;
+
+				while (eed) {
+					if (eed->v1->poly_nr == 0 && eed->v2->poly_nr == poly) {
+						eed->v1->poly_nr = poly;
+						eed->poly_nr = poly;
+						ok = 1;
 					}
-					else if(eed->v2->xs==0 && eed->v1->xs==poly) {
-						eed->v2->xs= poly;
-						eed->f1= poly;
-						ok= 1;
+					else if (eed->v2->poly_nr == 0 && eed->v1->poly_nr == poly) {
+						eed->v2->poly_nr = poly;
+						eed->poly_nr = poly;
+						ok = 1;
 					}
-					else if(eed->f1==0) {
-						if(eed->v1->xs==poly && eed->v2->xs==poly) {
-							eed->f1= poly;
-							ok= 1;
+					else if (eed->poly_nr == 0) {
+						if (eed->v1->poly_nr == poly && eed->v2->poly_nr == poly) {
+							eed->poly_nr = poly;
+							ok = 1;
 						}
 					}
-					if(toggle & 1) eed= eed->next;
-					else eed= eed->prev;
+					if (toggle & 1) eed = eed->next;
+					else eed = eed->prev;
 				}
 			}
 		}
-		eve= eve->next;
+		eve = eve->next;
 	}
 	/* printf("amount of poly's: %d\n",poly); */
 
 	/* STEP 2: remove loose edges and strings of edges */
-	eed= filledgebase.first;
-	while(eed) {
-		if(eed->v1->h++ >250) break;
-		if(eed->v2->h++ >250) break;
-		eed= eed->next;
+	eed = sf_ctx->filledgebase.first;
+	while (eed) {
+		if (eed->v1->h++ > 250) break;
+		if (eed->v2->h++ > 250) break;
+		eed = eed->next;
 	}
-	if(eed) {
+	if (eed) {
 		/* otherwise it's impossible to be sure you can clear vertices */
 		callLocalErrorCallBack("No vertices with 250 edges allowed!");
 		return 0;
 	}
 	
 	/* does it only for vertices with ->h==1 */
-	testvertexnearedge();
+	testvertexnearedge(sf_ctx);
 
-	ok= 1;
-	while(ok) {
-		ok= 0;
+	ok = 1;
+	while (ok) {
+		ok = 0;
 		toggle++;
-		if(toggle & 1) eed= filledgebase.first;
-		else eed= filledgebase.last;
-		while(eed) {
-			if(toggle & 1) nexted= eed->next;
-			else nexted= eed->prev;
-			if(eed->v1->h==1) {
+		if (toggle & 1) eed = sf_ctx->filledgebase.first;
+		else eed = sf_ctx->filledgebase.last;
+		while (eed) {
+			if (toggle & 1) nexted = eed->next;
+			else nexted = eed->prev;
+			if (eed->v1->h == 1) {
 				eed->v2->h--;
-				BLI_remlink(&fillvertbase,eed->v1); 
-				BLI_remlink(&filledgebase,eed); 
-				ok= 1;
+				BLI_remlink(&sf_ctx->fillvertbase, eed->v1);
+				BLI_remlink(&sf_ctx->filledgebase, eed);
+				ok = 1;
 			}
-			else if(eed->v2->h==1) {
+			else if (eed->v2->h == 1) {
 				eed->v1->h--;
-				BLI_remlink(&fillvertbase,eed->v2); 
-				BLI_remlink(&filledgebase,eed); 
-				ok= 1;
+				BLI_remlink(&sf_ctx->fillvertbase, eed->v2);
+				BLI_remlink(&sf_ctx->filledgebase, eed);
+				ok = 1;
 			}
-			eed= nexted;
+			eed = nexted;
 		}
 	}
-	if(filledgebase.first==0) {
+	if (sf_ctx->filledgebase.first == 0) {
 		/* printf("All edges removed\n"); */
 		return 0;
 	}
 
 
 	/* CURRENT STATUS:
-	- eve->f      :1= availalble in edges
-	- eve->xs     :polynumber
-	- eve->h      :amount of edges connected to vertex
-	- eve->tmp.v  :store! original vertex number
-
-	- eed->f  :
-	- eed->f1 :poly number
-	*/
+	 * - eve->f       :1= availalble 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->poly_nr :poly number
+	 */
 
 
 	/* STEP 3: MAKE POLYFILL STRUCT */
-	pflist= (PolyFill *)MEM_callocN(poly*sizeof(PolyFill),"edgefill");
-	pf= pflist;
-	for(a=1;a<=poly;a++) {
-		pf->nr= a;
-		pf->min[0]=pf->min[1]=pf->min[2]= 1.0e20;
-		pf->max[0]=pf->max[1]=pf->max[2]= -1.0e20;
+	pflist = (PolyFill *)MEM_callocN(poly * sizeof(PolyFill), "edgefill");
+	pf = pflist;
+	for (a = 1; a <= poly; a++) {
+		pf->nr = a;
+		pf->min_xy[0] = pf->min_xy[1] =  1.0e20;
+		pf->max_xy[0] = pf->max_xy[1] = -1.0e20;
 		pf++;
 	}
-	eed= filledgebase.first;
-	while(eed) {
-		pflist[eed->f1-1].edges++;
-		eed= eed->next;
+	eed = sf_ctx->filledgebase.first;
+	while (eed) {
+		pflist[eed->poly_nr - 1].edges++;
+		eed = eed->next;
 	}
 
-	eve= fillvertbase.first;
-	while(eve) {
-		pflist[eve->xs-1].verts++;
-		minp= pflist[eve->xs-1].min;
-		maxp= pflist[eve->xs-1].max;
+	eve = sf_ctx->fillvertbase.first;
+	while (eve) {
+		pflist[eve->poly_nr - 1].verts++;
+		min_xy_p = pflist[eve->poly_nr - 1].min_xy;
+		max_xy_p = pflist[eve->poly_nr - 1].max_xy;
 
-		minp[cox]= (minp[cox])<(eve->co[cox]) ? (minp[cox]) : (eve->co[cox]);
-		minp[coy]= (minp[coy])<(eve->co[coy]) ? (minp[coy]) : (eve->co[coy]);
-		maxp[cox]= (maxp[cox])>(eve->co[cox]) ? (maxp[cox]) : (eve->co[cox]);
-		maxp[coy]= (maxp[coy])>(eve->co[coy]) ? (maxp[coy]) : (eve->co[coy]);
-		if(eve->h>2) pflist[eve->xs-1].f= 1;
+		min_xy_p[0] = (min_xy_p[0]) < (eve->xy[0]) ? (min_xy_p[0]) : (eve->xy[0]);
+		min_xy_p[1] = (min_xy_p[1]) < (eve->xy[1]) ? (min_xy_p[1]) : (eve->xy[1]);
+		max_xy_p[0] = (max_xy_p[0]) > (eve->xy[0]) ? (max_xy_p[0]) : (eve->xy[0]);
+		max_xy_p[1] = (max_xy_p[1]) > (eve->xy[1]) ? (max_xy_p[1]) : (eve->xy[1]);
+		if (eve->h > 2) pflist[eve->poly_nr - 1].f = 1;
 
-		eve= eve->next;
+		eve = eve->next;
 	}
 
 	/* STEP 4: FIND HOLES OR BOUNDS, JOIN THEM
@@ -962,69 +1026,73 @@ int BLI_edgefill(short mat_nr)
 	 *    the edgefill itself has good auto-hole detection)
 	 * WATCH IT: ONLY WORKS WITH SORTED POLYS!!! */
 	
-	if(poly>1) {
+	if (poly > 1) {
 		short *polycache, *pc;
 
 		/* so, sort first */
 		qsort(pflist, poly, sizeof(PolyFill), vergpoly);
-		
-		/*pf= pflist;
-		for(a=1;a<=poly;a++) {
-			printf("poly:%d edges:%d verts:%d flag: %d\n",a,pf->edges,pf->verts,pf->f);
+
+#if 0
+		pf = pflist;
+		for (a = 1; a <= poly; a++) {
+			printf("poly:%d edges:%d verts:%d flag: %d\n", a, pf->edges, pf->verts, pf->f);
 			PRINT2(f, f, pf->min[0], pf->min[1]);
 			pf++;
-		}*/
+		}
+#endif
 	
-		polycache= pc= MEM_callocN(sizeof(short)*poly, "polycache");
-		pf= pflist;
-		for(a=0; a<poly; a++, pf++) {
-			for(c=a+1;c<poly;c++) {
+		polycache = pc = MEM_callocN(sizeof(short) * poly, "polycache");
+		pf = pflist;
+		for (a = 0; a < poly; a++, pf++) {
+			for (c = a + 1; c < poly; c++) {
 				
 				/* if 'a' inside 'c': join (bbox too)
 				 * Careful: 'a' can also be inside another poly.
 				 */
-				if(boundisect(pf, pflist+c)) {
-					*pc= c;
+				if (boundisect(pf, pflist + c)) {
+					*pc = c;
 					pc++;
 				}
 				/* only for optimize! */
-				/* else if(pf->max[cox] < (pflist+c)->min[cox]) break; */
+				/* else if (pf->max_xy[0] < (pflist+c)->min[cox]) break; */
 				
 			}
-			while(pc!=polycache) {
+			while (pc != polycache) {
 				pc--;
-				mergepolysSimp(pf, pflist+ *pc);
+				mergepolysSimp(sf_ctx, pf, pflist + *pc);
 			}
 		}
 		MEM_freeN(polycache);
 	}
-	
-	/* printf("after merge\n");
-	pf= pflist;
-	for(a=1;a<=poly;a++) {
-		printf("poly:%d edges:%d verts:%d flag: %d\n",a,pf->edges,pf->verts,pf->f);
+
+#if 0
+	printf("after merge\n");
+	pf = pflist;
+	for (a = 1; a <= poly; a++) {
+		printf("poly:%d edges:%d verts:%d flag: %d\n", a, pf->edges, pf->verts, pf->f);
 		pf++;
-	} */
+	}
+#endif
 
 	/* STEP 5: MAKE TRIANGLES */
 
-	tempve.first= fillvertbase.first;
-	tempve.last= fillvertbase.last;
-	temped.first= filledgebase.first;
-	temped.last= filledgebase.last;
-	fillvertbase.first=fillvertbase.last= 0;
-	filledgebase.first=filledgebase.last= 0;
-
-	pf= pflist;
-	for(a=0;a<poly;a++) {
-		if(pf->edges>1) {
-			splitlist(&tempve,&temped,pf->nr);
-			totfaces += scanfill(pf, mat_nr);
+	tempve.first = sf_ctx->fillvertbase.first;
+	tempve.last = sf_ctx->fillvertbase.last;
+	temped.first = sf_ctx->filledgebase.first;
+	temped.last = sf_ctx->filledgebase.last;
+	sf_ctx->fillvertbase.first = sf_ctx->fillvertbase.last = NULL;
+	sf_ctx->filledgebase.first = sf_ctx->filledgebase.last = NULL;
+
+	pf = pflist;
+	for (a = 0; a < poly; a++) {
+		if (pf->edges > 1) {
+			splitlist(sf_ctx, &tempve, &temped, pf->nr);
+			totfaces += scanfill(sf_ctx, pf);
 		}
 		pf++;
 	}
-	BLI_movelisttolist(&fillvertbase,&tempve);
-	BLI_movelisttolist(&filledgebase,&temped);
+	BLI_movelisttolist(&sf_ctx->fillvertbase, &tempve);
+	BLI_movelisttolist(&sf_ctx->filledgebase, &temped);
 
 	/* FREE */
 
diff --git a/source/blender/blenlib/intern/smallhash.c b/source/blender/blenlib/intern/smallhash.c
new file mode 100644
index 0000000..fb03849
--- /dev/null
+++ b/source/blender/blenlib/intern/smallhash.c
@@ -0,0 +1,281 @@
+/*
+ * ***** 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.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Joseph Eagar.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <string.h>
+
+#include "MEM_guardedalloc.h"
+#include "BLI_utildefines.h"
+
+#include "BLI_smallhash.h"
+
+/* SMHASH_CELL_UNUSED means this cell is inside a key series,
+ * while SMHASH_CELL_FREE means this cell terminates a key series.
+ *
+ * no chance of anyone shoving INT32_MAX-2 into a *val pointer, I
+ * imagine.  hopefully.
+ *
+ * note: these have the SMHASH suffix because we may want to make them public.
+ */
+#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)))
+
+extern unsigned int hashsizes[];
+
+void BLI_smallhash_init(SmallHash *hash)
+{
+	int i;
+
+	memset(hash, 0, sizeof(*hash));
+
+	hash->table = hash->_stacktable;
+	hash->curhash = 2;
+	hash->size = hashsizes[hash->curhash];
+
+	hash->copytable = hash->_copytable;
+	hash->stacktable = hash->_stacktable;
+
+	for (i = 0; i < hash->size; i++) {
+		hash->table[i].val = SMHASH_CELL_FREE;
+	}
+}
+
+/*NOTE: does *not* free *hash itself!  only the direct data!*/
+void BLI_smallhash_release(SmallHash *hash)
+{
+	if (hash == NULL) {
+		return;
+	}
+
+	if (hash->table != hash->stacktable) {
+		MEM_freeN(hash->table);
+	}
+}
+
+void BLI_smallhash_insert(SmallHash *hash, uintptr_t key, void *item)
+{
+	int h, hoff=1;
+
+	if (hash->size < hash->used * 3) {
+		int newsize = hashsizes[++hash->curhash];
+		SmallHashEntry *tmp;
+		int i = 0;
+
+		if (hash->table != hash->stacktable || newsize > SMSTACKSIZE) {
+			tmp = MEM_callocN(sizeof(*hash->table) * newsize, __func__);
+		}
+		else {
+			SWAP(SmallHashEntry *, hash->stacktable, hash->copytable);
+			tmp = hash->stacktable;
+		}
+
+		SWAP(SmallHashEntry *, tmp, hash->table);
+
+		hash->size = newsize;
+
+		for (i = 0; i < hash->size; i++) {
+			hash->table[i].val = SMHASH_CELL_FREE;
+		}
+
+		for (i = 0; i<hashsizes[hash->curhash - 1]; i++) {
+			if (ELEM(tmp[i].val, SMHASH_CELL_UNUSED, SMHASH_CELL_FREE)) {
+				continue;
+			}
+
+			h = ABS((int)(tmp[i].key));
+			hoff = 1;
+			while (!ELEM(hash->table[h % newsize].val, SMHASH_CELL_UNUSED, SMHASH_CELL_FREE)) {
+				h = SMHASH_NEXT(h, hoff);
+			}
+
+			h %= newsize;
+
+			hash->table[h].key = tmp[i].key;
+			hash->table[h].val = tmp[i].val;
+		}
+
+		if (tmp != hash->stacktable && tmp != hash->copytable) {
+			MEM_freeN(tmp);
+		}
+	}
+
+	h = ABS((int)key);
+	hoff = 1;
+
+	while (!ELEM(hash->table[h % hash->size].val, SMHASH_CELL_UNUSED, SMHASH_CELL_FREE)) {
+		h = SMHASH_NEXT(h, hoff);
+	}
+
+	h %= hash->size;
+	hash->table[h].key = key;
+	hash->table[h].val = item;
+
+	hash->used++;
+}
+
+void BLI_smallhash_remove(SmallHash *hash, uintptr_t key)
+{
+	int h, hoff=1;
+
+	h = ABS((int)key);
+
+	while ((hash->table[h % hash->size].key != key) ||
+	       (hash->table[h % hash->size].val == SMHASH_CELL_UNUSED))
+	{
+		if (hash->table[h % hash->size].val == SMHASH_CELL_FREE) {
+			return;
+		}
+
+		h = SMHASH_NEXT(h, hoff);
+	}
+
+	h %= hash->size;
+	hash->table[h].key = 0;
+	hash->table[h].val = SMHASH_CELL_UNUSED;
+}
+
+void *BLI_smallhash_lookup(SmallHash *hash, uintptr_t key)
+{
+	int h, hoff=1;
+	void *v;
+
+	h = ABS((int)key);
+
+	if (hash->table == NULL) {
+		return NULL;
+	}
+
+	while ((hash->table[h % hash->size].key != key) ||
+	       (hash->table[h % hash->size].val == SMHASH_CELL_UNUSED))
+	{
+		if (hash->table[h % hash->size].val == SMHASH_CELL_FREE) {
+			return NULL;
+		}
+
+		h = SMHASH_NEXT(h, hoff);
+	}
+
+	v = hash->table[h % hash->size].val;
+	if (ELEM(v, SMHASH_CELL_UNUSED, SMHASH_CELL_FREE)) {
+		return NULL;
+	}
+
+	return v;
+}
+
+
+int BLI_smallhash_haskey(SmallHash *hash, uintptr_t key)
+{
+	int h = ABS((int)key);
+	int hoff =1;
+
+	if (hash->table == NULL) {
+		return 0;
+	}
+
+	while ((hash->table[h % hash->size].key != key) ||
+	       (hash->table[h % hash->size].val == SMHASH_CELL_UNUSED))
+	{
+		if (hash->table[h % hash->size].val == SMHASH_CELL_FREE) {
+			return 0;
+		}
+
+		h = SMHASH_NEXT(h, hoff);
+	}
+
+	return !ELEM(hash->table[h % hash->size].val, SMHASH_CELL_UNUSED, SMHASH_CELL_FREE);
+}
+
+int BLI_smallhash_count(SmallHash *hash)
+{
+	return hash->used;
+}
+
+void *BLI_smallhash_iternext(SmallHashIter *iter, uintptr_t *key)
+{
+	while (iter->i < iter->hash->size) {
+		if (    (iter->hash->table[iter->i].val != SMHASH_CELL_UNUSED) &&
+		        (iter->hash->table[iter->i].val != SMHASH_CELL_FREE))
+		{
+			if (key) {
+				*key = iter->hash->table[iter->i].key;
+			}
+
+			iter->i++;
+
+			return iter->hash->table[iter->i - 1].val;
+		}
+
+		iter->i++;
+	}
+
+	return NULL;
+}
+
+void *BLI_smallhash_iternew(SmallHash *hash, SmallHashIter *iter, uintptr_t *key)
+{
+	iter->hash = hash;
+	iter->i = 0;
+
+	return BLI_smallhash_iternext(iter, key);
+}
+
+/* note, this was called _print_smhash in knifetool.c
+ * it may not be intended for general use - campbell */
+#if 0
+void BLI_smallhash_print(SmallHash *hash)
+{
+	int i, linecol=79, c=0;
+
+	printf("{");
+	for (i=0; i<hash->size; i++) {
+		if (hash->table[i].val == SMHASH_CELL_UNUSED) {
+			printf("--u-");
+		}
+		else if (hash->table[i].val == SMHASH_CELL_FREE) {
+			printf("--f-");
+		}
+		else	{
+			printf("%2x", (unsigned int)hash->table[i].key);
+		}
+
+		if (i != hash->size-1)
+			printf(", ");
+
+		c += 6;
+
+		if (c >= linecol) {
+			printf("\n ");
+			c = 0;
+		}
+	}
+
+	fflush(stdout);
+}
+#endif
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index df0634e..1c55d5b 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -68,28 +68,29 @@
 #include <fcntl.h>
 #include <string.h>			/* strcpy etc.. */
 
-#ifndef WIN32
-#include <sys/ioctl.h>
-#include <unistd.h>			/*  */
-#include <pwd.h>
-#endif
-
 #ifdef WIN32
-#include <io.h>
-#include <direct.h>
-#include "BLI_winstuff.h"
+#  include <io.h>
+#  include <direct.h>
+#  include "BLI_winstuff.h"
+#  include "utfconv.h"
+#else
+#  include <sys/ioctl.h>
+#  include <unistd.h>
+#  include <pwd.h>
 #endif
 
-
 /* lib includes */
 #include "MEM_guardedalloc.h"
 
 #include "DNA_listBase.h"
 
-#include "BLI_fileops.h"
 #include "BLI_listbase.h"
 #include "BLI_linklist.h"
+#include "BLI_fileops.h"
+
+#include "BLI_fileops_types.h"
 #include "BLI_string.h"
+#include "BLI_fileops.h"
 
 #include "BKE_utildefines.h"
 
@@ -104,7 +105,7 @@ static struct ListBase *dirbase = &dirbase_;
 char *BLI_current_working_dir(char *dir, const int maxncpy)
 {
 	const char *pwd= getenv("PWD");
-	if (pwd){
+	if (pwd) {
 		BLI_strncpy(dir, pwd, maxncpy);
 		return dir;
 	}
@@ -117,24 +118,26 @@ static int bli_compare(struct direntry *entry1, struct direntry *entry2)
 {
 	/* type is equal to stat.st_mode */
 
-	if (S_ISDIR(entry1->type)){
+	if (S_ISDIR(entry1->type)) {
 		if (S_ISDIR(entry2->type)==0) return (-1);
-	} else{
+	}
+	else {
 		if (S_ISDIR(entry2->type)) return (1);
 	}
-	if (S_ISREG(entry1->type)){
+	if (S_ISREG(entry1->type)) {
 		if (S_ISREG(entry2->type)==0) return (-1);
-	} else{
+	}
+	else {
 		if (S_ISREG(entry2->type)) return (1);
 	}
 	if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
 	if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
 	
 	/* make sure "." and ".." are always first */
-	if( strcmp(entry1->relname, ".")==0 ) return (-1);
-	if( strcmp(entry2->relname, ".")==0 ) return (1);
-	if( strcmp(entry1->relname, "..")==0 ) return (-1);
-	if( strcmp(entry2->relname, "..")==0 ) return (1);
+	if ( strcmp(entry1->relname, ".")==0 ) return (-1);
+	if ( strcmp(entry2->relname, ".")==0 ) return (1);
+	if ( strcmp(entry1->relname, "..")==0 ) return (-1);
+	if ( strcmp(entry2->relname, "..")==0 ) return (1);
 
 	return (BLI_natstrcmp(entry1->relname,entry2->relname));
 }
@@ -150,7 +153,8 @@ double BLI_dir_free_space(const char *dir)
 	if (dir[0]=='/' || dir[0]=='\\') {
 		tmp[0]='\\';
 		tmp[1]=0;
-	} else if (dir[1]==':') {
+	}
+	else if (dir[1]==':') {
 		tmp[0]=dir[0];
 		tmp[1]=':';
 		tmp[2]='\\';
@@ -175,10 +179,11 @@ double BLI_dir_free_space(const char *dir)
 	
 	strcpy(name,dir);
 
-	if(len){
+	if (len) {
 		slash = strrchr(name,'/');
 		if (slash) slash[1] = 0;
-	} else strcpy(name,"/");
+	}
+	else strcpy(name,"/");
 
 #if defined (__FreeBSD__) || defined (linux) || defined (__OpenBSD__) || defined (__APPLE__) || defined(__GNU__) || defined(__GLIBC__)
 	if (statfs(name, &disk)) return(-1);
@@ -206,20 +211,29 @@ static void bli_builddir(const char *dirname, const char *relname)
 	BLI_strncpy(buf, relname, sizeof(buf));
 	rellen=strlen(relname);
 
-	if (rellen){
+	if (rellen) {
 		buf[rellen]='/';
 		rellen++;
 	}
-
-	if (chdir(dirname) == -1){
+#ifndef WIN32
+	if (chdir(dirname) == -1) {
 		perror(dirname);
 		return;
 	}
+#else
+	UTF16_ENCODE(dirname);
+	if (!SetCurrentDirectoryW(dirname_16)) {
+		perror(dirname);
+		free(dirname_16);
+		return;
+	}
+	UTF16_UN_ENCODE(dirname);
 
-	if ( (dir = (DIR *)opendir(".")) ){
+#endif
+	if ((dir = (DIR *)opendir("."))) {
 		while ((fname = (struct dirent*) readdir(dir)) != NULL) {
 			dlink = (struct dirlink *)malloc(sizeof(struct dirlink));
-			if (dlink){
+			if (dlink) {
 				BLI_strncpy(buf + rellen ,fname->d_name, sizeof(buf) - rellen);
 				dlink->name = BLI_strdup(buf);
 				BLI_addhead(dirbase,dlink);
@@ -227,34 +241,39 @@ static void bli_builddir(const char *dirname, const char *relname)
 			}
 		}
 		
-		if (newnum){
+		if (newnum) {
 
-			if(files) {
-				void *tmp= realloc(files, (totnum+newnum) * sizeof(struct direntry));
-				if(tmp) {
-					files= (struct direntry *)tmp;
+			if (files) {
+				void *tmp = realloc(files, (totnum+newnum) * sizeof(struct direntry));
+				if (tmp) {
+					files = (struct direntry *)tmp;
 				}
 				else { /* realloc fail */
 					free(files);
-					files= NULL;
+					files = NULL;
 				}
 			}
 			
-			if(files==NULL)
+			if (files==NULL)
 				files=(struct direntry *)malloc(newnum * sizeof(struct direntry));
 
-			if (files){
+			if (files) {
 				dlink = (struct dirlink *) dirbase->first;
-				while(dlink){
+				while (dlink) {
 					memset(&files[actnum], 0 , sizeof(struct direntry));
 					files[actnum].relname = dlink->name;
 					files[actnum].path = BLI_strdupcat(dirname, dlink->name);
 // use 64 bit file size, only needed for WIN32 and WIN64. 
-// Excluding other than current MSVC compiler until able to test.
+// Excluding other than current MSVC compiler until able to test
+#ifdef WIN32
+					{wchar_t * name_16 = alloc_utf16_from_8(dlink->name,0);
 #if (defined(WIN32) || defined(WIN64)) && (_MSC_VER>=1500)
-					_stat64(dlink->name,&files[actnum].s);
+					_wstat64(name_16,&files[actnum].s);
 #elif defined(__MINGW32__)
 					_stati64(dlink->name,&files[actnum].s);
+#endif
+					free(name_16);};
+
 #else
 					stat(dlink->name,&files[actnum].s);
 #endif
@@ -264,19 +283,22 @@ static void bli_builddir(const char *dirname, const char *relname)
 					actnum++;
 					dlink = dlink->next;
 				}
-			} else{
+			}
+			else {
 				printf("Couldn't get memory for dir\n");
 				exit(1);
 			}
 
 			BLI_freelist(dirbase);
 			if (files) qsort(files, actnum, sizeof(struct direntry), (int (*)(const void *,const void*))bli_compare);
-		} else {
+		}
+		else {
 			printf("%s empty directory\n",dirname);
 		}
 
 		closedir(dir);
-	} else {
+	}
+	else {
 		printf("%s non-existant directory\n",dirname);
 	}
 }
@@ -298,7 +320,7 @@ static void bli_adddirstrings(void)
 	struct tm *tm;
 	time_t zero= 0;
 	
-	for(num=0, file= files; num<actnum; num++, file++){
+	for (num=0, file= files; num<actnum; num++, file++) {
 #ifdef WIN32
 		mode = 0;
 		BLI_strncpy(file->mode1, types[0], sizeof(file->mode1));
@@ -313,14 +335,14 @@ static void bli_adddirstrings(void)
 		
 		if (((mode & S_ISGID) == S_ISGID) && (file->mode2[2]=='-'))file->mode2[2]='l';
 
-		if (mode & (S_ISUID | S_ISGID)){
+		if (mode & (S_ISUID | S_ISGID)) {
 			if (file->mode1[2]=='x') file->mode1[2]='s';
 			else file->mode1[2]='S';
 
 			if (file->mode2[2]=='x')file->mode2[2]='s';
 		}
 
-		if (mode & S_ISVTX){
+		if (mode & S_ISVTX) {
 			if (file->mode3[2] == 'x') file->mode3[2] = 't';
 			else file->mode3[2] = 'T';
 		}
@@ -334,7 +356,8 @@ static void bli_adddirstrings(void)
 			pwuser = getpwuid(file->s.st_uid);
 			if ( pwuser ) {
 				BLI_strncpy(file->owner, pwuser->pw_name, sizeof(file->owner));
-			} else {
+			}
+			else {
 				BLI_snprintf(file->owner, sizeof(file->owner), "%d", file->s.st_uid);
 			}
 		}
@@ -342,7 +365,7 @@ static void bli_adddirstrings(void)
 
 		tm= localtime(&file->s.st_mtime);
 		// prevent impossible dates in windows
-		if(tm==NULL) tm= localtime(&zero);
+		if (tm==NULL) tm= localtime(&zero);
 		strftime(file->time, sizeof(file->time), "%H:%M", tm);
 		strftime(file->date, sizeof(file->date), "%d-%b-%y", tm);
 
@@ -408,7 +431,8 @@ unsigned int BLI_dir_contents(const char *dirname,  struct direntry **filelist)
 
 	if (files) {
 		*(filelist) = files;
-	} else {
+	}
+	else {
 		// keep blender happy. Blender stores this in a variable
 		// where 0 has special meaning.....
 		*(filelist) = files = malloc(sizeof(struct direntry));
@@ -423,13 +447,13 @@ size_t BLI_file_descriptor_size(int file)
 	struct stat buf;
 
 	if (file <= 0) return (-1);
-	fstat(file, &buf);
+	fstat(file, &buf);//CHANGE
 	return (buf.st_size);
 }
 
 size_t BLI_file_size(const char *path)
 {
-	int size, file = open(path, O_BINARY|O_RDONLY);
+	int size, file = BLI_open(path, O_BINARY|O_RDONLY, 0);
 	
 	if (file == -1)
 		return -1;
@@ -442,27 +466,26 @@ size_t BLI_file_size(const char *path)
 
 int BLI_exists(const char *name)
 {
-#if defined(WIN32) && !defined(__MINGW32__)
+#if defined(WIN32) 
+#ifndef __MINGW32__
 	struct _stat64i32 st;
-	/*  in Windows stat doesn't recognize dir ending on a slash 
-		To not break code where the ending slash is expected we
-		don't mess with the argument name directly here - elubie */
-	char tmp[FILE_MAX];
-	int len, res;
-	BLI_strncpy(tmp, name, FILE_MAX);
-	len = strlen(tmp);
-	if (len > 3 && ( tmp[len-1]=='\\' || tmp[len-1]=='/') ) tmp[len-1] = '\0';
-	res = _stat(tmp, &st);
-	if (res == -1) return(0);
-#elif defined(__MINGW32__)
+#else
 	struct _stati64 st;
-	char tmp[FILE_MAX];
+#endif
+	/* in Windows stat doesn't recognize dir ending on a slash
+	 * To not break code where the ending slash is expected we
+	 * don't mess with the argument name directly here - elubie */
+	wchar_t * tmp_16 = alloc_utf16_from_8(name, 0);
 	int len, res;
-	BLI_strncpy(tmp, name, FILE_MAX);
-	len = strlen(tmp);
-	if (len > 3 && ( tmp[len-1]=='\\' || tmp[len-1]=='/') ) tmp[len-1] = '\0';
-	res = _stati64(tmp, &st);
-	if (res) return(0);
+	len = wcslen(tmp_16);
+	if (len > 3 && ( tmp_16[len-1]==L'\\' || tmp_16[len-1]==L'/') ) tmp_16[len-1] = '\0';
+#ifndef __MINGW32__
+	res = _wstat(tmp_16, &st);
+#else
+	res = _wstati64(tmp_16, &st);
+#endif
+	free(tmp_16);
+	if (res == -1) return(0);
 #else
 	struct stat st;
 	if (stat(name,&st)) return(0);	
@@ -484,7 +507,7 @@ int BLI_is_file(const char *path)
 
 LinkNode *BLI_file_read_as_lines(const char *name)
 {
-	FILE *fp= fopen(name, "r");
+	FILE *fp= BLI_fopen(name, "r");
 	LinkNode *lines= NULL;
 	char *buf;
 	size_t size;
@@ -528,13 +551,26 @@ void BLI_file_free_lines(LinkNode *lines)
 	BLI_linklist_free(lines, (void(*)(void*)) MEM_freeN);
 }
 
+/** is file1 older then file2 */
 int BLI_file_older(const char *file1, const char *file2)
 {
-	struct stat st1, st2;
+#ifdef WIN32
+	struct _stat st1, st2;
 
-	if(stat(file1, &st1)) return 0;
-	if(stat(file2, &st2)) return 0;
+	UTF16_ENCODE(file1);
+	UTF16_ENCODE(file2);
+	
+	if (_wstat(file1_16, &st1)) return 0;
+	if (_wstat(file2_16, &st2)) return 0;
 
+	UTF16_UN_ENCODE(file2);
+	UTF16_UN_ENCODE(file1);
+#else
+	struct stat st1, st2;
+
+	if (stat(file1, &st1)) return 0;
+	if (stat(file2, &st2)) return 0;
+#endif
 	return (st1.st_mtime < st2.st_mtime);
 }
 
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index 3a66425..4c92a87 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -124,7 +124,7 @@ char *BLI_sprintfN(const char *format, ...)
 size_t BLI_strescape(char *dst, const char *src, const size_t maxlen)
 {
 	size_t len= 0;
-	while(len < maxlen) {
+	while (len < maxlen) {
 		switch(*src) {
 			case '\0':
 				goto escape_finish;
@@ -135,7 +135,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 <  maxlen) {
 					*dst++ = '\\';
 					len++;
 				}
@@ -184,8 +184,8 @@ char *BLI_getQuotedStr (const char *str, const char *prefix)
 	return BLI_strdupn(startMatch, (size_t)(endMatch-startMatch));
 }
 
-/* Replaces all occurances of oldText with newText in str, returning a new string that doesn't 
- * contain the 'replaced' occurances.
+/* Replaces all occurrences of oldText with newText in str, returning a new string that doesn't 
+ * contain the 'replaced' occurrences.
  */
 // A rather wasteful string-replacement utility, though this shall do for now...
 // Feel free to replace this with an even safe + nicer alternative 
@@ -231,7 +231,7 @@ char *BLI_replacestr(char *str, const char *oldText, const char *newText)
 		str += lenOld;
 	}
 	
-	/* finish off and return a new string that has had all occurances of */
+	/* finish off and return a new string that has had all occurrences of */
 	if (ds) {
 		char *newStr;
 		
@@ -292,9 +292,11 @@ int BLI_strcasecmp(const char *s1, const char *s2)
 
 		if (c1<c2) {
 			return -1;
-		} else if (c1>c2) {
+		}
+		else if (c1>c2) {
 			return 1;
-		} else if (c1==0) {
+		}
+		else if (c1==0) {
 			break;
 		}
 	}
@@ -312,9 +314,11 @@ int BLI_strncasecmp(const char *s1, const char *s2, size_t len)
 
 		if (c1<c2) {
 			return -1;
-		} else if (c1>c2) {
+		}
+		else if (c1>c2) {
 			return 1;
-		} else if (c1==0) {
+		}
+		else if (c1==0) {
 			break;
 		}
 	}
@@ -326,16 +330,16 @@ int BLI_strncasecmp(const char *s1, const char *s2, size_t len)
 int BLI_natstrcmp(const char *s1, const char *s2)
 {
 	int d1= 0, d2= 0;
-	
+
 	/* 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) {
+	 * 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]);
 		
-		if( isdigit(c1) && isdigit(c2) ) {
+		if ( isdigit(c1) && isdigit(c2) ) {
 			int val1, val2;
 			
 			val1= (int)strtol(s1+d1, (char **)NULL, 10);
@@ -343,14 +347,15 @@ int BLI_natstrcmp(const char *s1, const char *s2)
 			
 			if (val1<val2) {
 				return -1;
-			} else if (val1>val2) {
+			}
+			else if (val1>val2) {
 				return 1;
 			}
 			d1++;
-			while( isdigit(s1[d1]) )
+			while ( isdigit(s1[d1]) )
 				d1++;
 			d2++;
-			while( isdigit(s2[d2]) )
+			while ( isdigit(s2[d2]) )
 				d2++;
 			
 			c1 = tolower(s1[d1]);
@@ -358,15 +363,17 @@ int BLI_natstrcmp(const char *s1, const char *s2)
 		}
 	
 		/* first check for '.' so "foo.bar" comes before "foo 1.bar" */	
-		if(c1=='.' && c2!='.')
+		if (c1=='.' && c2!='.')
 			return -1;
-		if(c1!='.' && c2=='.')
+		if (c1!='.' && c2=='.')
 			return 1;
 		else if (c1<c2) {
 			return -1;
-		} else if (c1>c2) {
+		}
+		else if (c1>c2) {
 			return 1;
-		} else if (c1==0) {
+		}
+		else if (c1==0) {
 			break;
 		}
 		d1++;
@@ -385,7 +392,8 @@ void BLI_timestr(double _time, char *str)
 	
 	if (hr) {
 		sprintf(str, "%.2d:%.2d:%.2d.%.2d",hr,min,sec,hun);
-	} else {
+	}
+	else {
 		sprintf(str, "%.2d:%.2d.%.2d",min,sec,hun);
 	}
 	
@@ -403,8 +411,8 @@ void BLI_ascii_strtolower(char *str, int len)
 {
 	int i;
 
-	for(i=0; i<len; i++)
-		if(str[i] >= 'A' && str[i] <= 'Z')
+	for (i=0; i<len; i++)
+		if (str[i] >= 'A' && str[i] <= 'Z')
 			str[i] += 'a' - 'A';
 }
 
@@ -412,8 +420,8 @@ void BLI_ascii_strtoupper(char *str, int len)
 {
 	int i;
 
-	for(i=0; i<len; i++)
-		if(str[i] >= 'a' && str[i] <= 'z')
+	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
new file mode 100644
index 0000000..97559d6
--- /dev/null
+++ b/source/blender/blenlib/intern/string_cursor_utf8.c
@@ -0,0 +1,197 @@
+/*
+ * ***** 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) 2011 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Campbell Barton.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ */
+
+/** \file blender/blenlib/intern/string_cursor_utf8.c
+ *  \ingroup bli
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "BLI_utildefines.h"
+#include "BLI_string_utf8.h"
+
+#include "BLI_string_cursor_utf8.h" /* own include */
+
+typedef enum strCursorDelimType {
+	STRCUR_DELIM_NONE,
+	STRCUR_DELIM_ALPHA,
+	STRCUR_DELIM_PUNCT,
+	STRCUR_DELIM_BRACE,
+	STRCUR_DELIM_OPERATOR,
+	STRCUR_DELIM_QUOTE,
+	STRCUR_DELIM_WHITESPACE,
+	STRCUR_DELIM_OTHER
+} strCursorDelimType;
+
+/* return 1 if char ch is special character, otherwise return 0 */
+static strCursorDelimType test_special_char(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 '.':
+			return STRCUR_DELIM_PUNCT;
+
+		case '{':
+		case '}':
+		case '[':
+		case ']':
+		case '(':
+		case ')':
+			return STRCUR_DELIM_BRACE;
+
+		case '+':
+		case '-':
+		case '=':
+		case '~':
+		case '%':
+		case '/':
+		case '<':
+		case '>':
+		case '^':
+		case '*':
+		case '&':
+			return STRCUR_DELIM_OPERATOR;
+
+		case '\'':
+		case '\"': // " - an extra closing one for Aligorith's text editor
+			return STRCUR_DELIM_QUOTE;
+
+		case ' ':
+			return STRCUR_DELIM_WHITESPACE;
+
+		case '\\':
+		case '!':
+		case '@':
+		case '#':
+		case '$':
+		case ':':
+		case ';':
+		case '?':
+			/* case '_': *//* special case, for python */
+			return STRCUR_DELIM_OTHER;
+
+		default:
+			break;
+	}
+	return STRCUR_DELIM_NONE;
+}
+
+int BLI_str_cursor_step_next_utf8(const char *str, size_t maxlen, int *pos)
+{
+	const char *str_end = str + (maxlen + 1);
+	const char *str_pos = str + (*pos);
+	const char *str_next = BLI_str_find_next_char_utf8(str_pos, str_end);
+	if (str_next) {
+		(*pos) += (str_next - str_pos);
+		if ((*pos) > maxlen) {
+			(*pos) = maxlen;
+		}
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+int BLI_str_cursor_step_prev_utf8(const char *str, size_t UNUSED(maxlen), int *pos)
+{
+	if ((*pos) > 0) {
+		const char *str_pos = str + (*pos);
+		const char *str_prev = BLI_str_find_prev_char_utf8(str, str_pos);
+		if (str_prev) {
+			(*pos) -= (str_pos - str_prev);
+			return TRUE;
+		}
+	}
+
+	return FALSE;
+}
+
+void BLI_str_cursor_step_utf8(const char *str, size_t maxlen,
+                              int *pos, strCursorJumpDirection direction,
+                              strCursorJumpType jump)
+{
+	const short pos_prev = *pos;
+
+	if (direction == STRCUR_DIR_NEXT) {
+		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;
+			/* jump between special characters (/,\,_,-, etc.),
+			 * look at function test_special_char() 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;
+				}
+				else {
+					break; /* unlikely but just in case */
+				}
+			}
+		}
+	}
+	else if (direction == STRCUR_DIR_PREV) {
+		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;
+			/* jump between special characters (/,\,_,-, etc.),
+			 * look at function test_special_char() 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])))
+						break;
+				}
+				else {
+					break;
+				}
+			}
+
+			/* left only: compensate for index/change in direction */
+			if (((*pos) != 0) && ABS(pos_prev - (*pos)) >= 1) {
+				BLI_str_cursor_step_next_utf8(str, maxlen, pos);
+			}
+		}
+	}
+	else {
+		BLI_assert(0);
+	}
+}
diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c
index 89136f2..aede08b 100644
--- a/source/blender/blenlib/intern/string_utf8.c
+++ b/source/blender/blenlib/intern/string_utf8.c
@@ -27,8 +27,8 @@
  */
 
  /** \file blender/blenlib/intern/string_utf8.c
- *  \ingroup bli
- */
+  *  \ingroup bli
+  */
 
 #include <string.h>
 #include <wchar.h>
@@ -41,9 +41,9 @@
  * http://svn.swish-e.org/libswish3/trunk/src/libswish3/utf8.c r3044 - campbell */
 
 /* based on the valid_utf8 routine from the PCRE library by Philip Hazel
-
-   length is in bytes, since without knowing whether the string is valid
-   it's hard to know how many characters there are! */
+ *
+ * length is in bytes, since without knowing whether the string is valid
+ * it's hard to know how many characters there are! */
 
 static const char trailingBytesForUTF8[256] = {
 	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,
@@ -101,7 +101,7 @@ int BLI_utf8_invalid_byte(const char *str, int length)
 			break;
 
 			/* Check for leading 0xfe or 0xff,
-			   and then for 1111 1100, xx00 00xx */
+			 * and then for 1111 1100, xx00 00xx */
 		case 5:
 			if (c == 0xfe || c == 0xff ||
 				(c == 0xfc && (*p & 0x3c) == 0)) goto utf8_error;
@@ -126,11 +126,11 @@ int BLI_utf8_invalid_strip(char *str, int length)
 {
 	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) {
+		if (length == 0) {
 			/* last character bad, strip it */
 			*str= '\0';
 			tot++;
@@ -166,7 +166,7 @@ static const size_t utf8_skip_data[256] = {
 #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) {                                               \
 				case 6: *dst ++ = *src ++;                                    \
@@ -184,7 +184,7 @@ char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy)
 {
 	char *dst_r= dst;
 
-	/* note: currently we dont attempt to deal with invalid utf8 chars */
+	/* note: currently we don't attempt to deal with invalid utf8 chars */
 	BLI_STR_UTF8_CPY(dst, src, maxncpy)
 
 	return dst_r;
@@ -210,7 +210,7 @@ char *BLI_strncat_utf8(char *dst, const char *src, size_t maxncpy)
 size_t BLI_strncpy_wchar_as_utf8(char *dst, const wchar_t *src, const size_t maxcpy)
 {
 	size_t len = 0;
-	while(*src && len < maxcpy) { /* XXX can still run over the buffer because utf8 size isnt known :| */
+	while (*src && len < maxcpy) { /* XXX can still run over the buffer because utf8 size isn't known :| */
 		len += BLI_str_utf8_from_unicode(*src++, dst+len);
 	}
 
@@ -224,7 +224,7 @@ size_t BLI_wstrlen_utf8(const wchar_t *src)
 {
 	size_t len = 0;
 
-	while(*src) {
+	while (*src) {
 		len += BLI_str_utf8_from_unicode(*src++, NULL);
 	}
 
@@ -236,15 +236,17 @@ size_t BLI_strlen_utf8(const char *strc)
 {
 	int len=0;
 
-	while(*strc) {
+	while (*strc) {
 		if ((*strc & 0xe0) == 0xc0) {
-			if((strc[1] & 0x80) && (strc[1] & 0x40) == 0x00)
+			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)
+		}
+		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)
+		}
+		else if ((*strc & 0xf8) == 0xf0) {
+			if ((strc[1] & strc[2] & strc[3] & 0x80) && ((strc[1] | strc[2] | strc[3]) & 0x40) == 0x00)
 				strc += 3;
 		}
 
@@ -259,9 +261,9 @@ size_t BLI_strncpy_wchar_from_utf8(wchar_t *dst_w, const char *src_c, const size
 {
 	int len=0;
 
-	if(dst_w==NULL || src_c==NULL) return(0);
+	if (dst_w==NULL || src_c==NULL) return(0);
 
-	while(*src_c && len < maxcpy) {
+	while (*src_c && len < maxcpy) {
 		size_t step= 0;
 		unsigned int unicode= BLI_str_utf8_as_unicode_and_size(src_c, &step);
 		if (unicode != BLI_UTF8_ERR) {
@@ -284,7 +286,7 @@ size_t BLI_strncpy_wchar_from_utf8(wchar_t *dst_w, const char *src_c, const size
 /* copied from glib's gutf8.c */
 
 /* note, glib uses unsigned int for unicode, best we do the same,
- * though we dont typedef it - campbell */
+ * though we don't typedef it - campbell */
 
 #define UTF8_COMPUTE(Char, Mask, Len)                                         \
 	if (Char < 128) {                                                         \
@@ -345,7 +347,7 @@ 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
+ * @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
@@ -357,19 +359,19 @@ int BLI_str_utf8_size(const char *p)
  **/
 unsigned int BLI_str_utf8_as_unicode(const char *p)
 {
-  int i, mask = 0, len;
-  unsigned int result;
-  unsigned char c = (unsigned char) *p;
+	int i, mask = 0, len;
+	unsigned int result;
+	unsigned char c = (unsigned char) *p;
 
-  UTF8_COMPUTE (c, mask, len);
-  if (len == -1)
-    return BLI_UTF8_ERR;
-  UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR);
+	UTF8_COMPUTE (c, mask, len);
+	if (len == -1)
+		return BLI_UTF8_ERR;
+	UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR);
 
-  return result;
+	return result;
 }
 
-/* varient that increments the length */
+/* variant that increments the length */
 unsigned int BLI_str_utf8_as_unicode_and_size(const char *p, size_t *index)
 {
 	int i, mask = 0, len;
@@ -384,7 +386,7 @@ unsigned int BLI_str_utf8_as_unicode_and_size(const char *p, size_t *index)
 	return result;
 }
 
-/* another varient that steps over the 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)
 {
@@ -415,7 +417,7 @@ unsigned int BLI_str_utf8_as_unicode_step(const char *p, size_t *index)
 	 * this is added for text drawing because some filepaths can have latin1
 	 * characters */
 	UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR);
-	if(result == BLI_UTF8_ERR) {
+	if (result == BLI_UTF8_ERR) {
 		len= 1;
 		result= *p;
 	}
@@ -432,10 +434,10 @@ unsigned int BLI_str_utf8_as_unicode_step(const char *p, size_t *index)
 /* was g_unichar_to_utf8 */
 /**
  * BLI_str_utf8_from_unicode:
- * @c: a Unicode character code
- * @outbuf: output buffer, must have at least 6 bytes of space.
+ * @c a Unicode character code
+ * \param outbuf output buffer, must have at least 6 bytes of space.
  *       If %NULL, the length will be computed and returned
- *       and nothing will be written to @outbuf.
+ *       and nothing will be written to outbuf.
  *
  * Converts a single character to UTF-8.
  *
@@ -488,11 +490,11 @@ size_t BLI_str_utf8_from_unicode(unsigned int c, char *outbuf)
 /**
  * BLI_str_find_prev_char_utf8:
  * @str: pointer to the beginning of a UTF-8 encoded string
- * @p: pointer to some position within @str
+ * @p pointer to some position within @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.
+ * of the previous UTF-8 character starting before. @p Returns %NULL if no
+ * UTF-8 characters are present in @str before @p
  *
  * @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
@@ -513,11 +515,11 @@ 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,
+ * @p a pointer to a position within a UTF-8 encoded string
+ * @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 @p
  *
  * @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
@@ -545,9 +547,9 @@ 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
+ * @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 @p
  *
  * @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
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c
index 98d2179..05d8ded 100644
--- a/source/blender/blenlib/intern/threads.c
+++ b/source/blender/blenlib/intern/threads.c
@@ -63,48 +63,48 @@ static void *thread_tls_data;
 #endif
 
 /* ********** basic thread control API ************ 
-
-Many thread cases have an X amount of jobs, and only an Y amount of
-threads are useful (typically amount of cpus)
-
-This code can be used to start a maximum amount of 'thread slots', which
-then can be filled in a loop with an idle timer. 
-
-A sample loop can look like this (pseudo c);
-
-	ListBase lb;
-	int maxthreads= 2;
-	int cont= 1;
-
-	BLI_init_threads(&lb, do_something_func, maxthreads);
-
-	while(cont) {
-		if(BLI_available_threads(&lb) && !(escape loop event)) {
-			// get new job (data pointer)
-			// tag job 'processed 
-			BLI_insert_thread(&lb, job);
-		}
-		else PIL_sleep_ms(50);
-		
-		// find if a job is ready, this the do_something_func() should write in job somewhere
-		cont= 0;
-		for(go over all jobs)
-			if(job is ready) {
-				if(job was not removed) {
-					BLI_remove_thread(&lb, job);
-				}
-			}
-			else cont= 1;
-		}
-		// conditions to exit loop 
-		if(if escape loop event) {
-			if(BLI_available_threadslots(&lb)==maxthreads)
-				break;
-		}
-	}
-
-	BLI_end_threads(&lb);
-
+ * 
+ * Many thread cases have an X amount of jobs, and only an Y amount of
+ * threads are useful (typically amount of cpus)
+ *
+ * This code can be used to start a maximum amount of 'thread slots', which
+ * then can be filled in a loop with an idle timer. 
+ *
+ * A sample loop can look like this (pseudo c);
+ *
+ *     ListBase lb;
+ *     int maxthreads= 2;
+ *     int cont= 1;
+ * 
+ *     BLI_init_threads(&lb, do_something_func, maxthreads);
+ * 
+ *     while (cont) {
+ *         if (BLI_available_threads(&lb) && !(escape loop event)) {
+ *             // get new job (data pointer)
+ *             // tag job 'processed 
+ *             BLI_insert_thread(&lb, job);
+ *         }
+ *         else PIL_sleep_ms(50);
+ *         
+ *         // find if a job is ready, this the do_something_func() should write in job somewhere
+ *         cont= 0;
+ *         for (go over all jobs)
+ *             if (job is ready) {
+ *                 if (job was not removed) {
+ *                     BLI_remove_thread(&lb, job);
+ *                 }
+ *             }
+ *             else cont= 1;
+ *         }
+ *         // conditions to exit loop 
+ *         if (if escape loop event) {
+ *             if (BLI_available_threadslots(&lb)==maxthreads)
+ *                 break;
+ *         }
+ *     }
+ * 
+ *     BLI_end_threads(&lb);
+ *
  ************************************************ */
 static pthread_mutex_t _malloc_lock = PTHREAD_MUTEX_INITIALIZER;
 static pthread_mutex_t _image_lock = PTHREAD_MUTEX_INITIALIZER;
@@ -145,20 +145,20 @@ void BLI_threadapi_init(void)
 }
 
 /* tot = 0 only initializes malloc mutex in a safe way (see sequence.c)
-   problem otherwise: scene render will kill of the mutex!
-*/
+ * problem otherwise: scene render will kill of the mutex!
+ */
 
 void BLI_init_threads(ListBase *threadbase, void *(*do_thread)(void *), int tot)
 {
 	int a;
 
-	if(threadbase != NULL && tot > 0) {
+	if (threadbase != NULL && tot > 0) {
 		threadbase->first= threadbase->last= NULL;
 	
-		if(tot>RE_MAX_THREAD) tot= RE_MAX_THREAD;
-		else if(tot<1) tot= 1;
+		if (tot>RE_MAX_THREAD) tot= RE_MAX_THREAD;
+		else if (tot<1) tot= 1;
 	
-		for(a=0; a<tot; a++) {
+		for (a=0; a<tot; a++) {
 			ThreadSlot *tslot= MEM_callocN(sizeof(ThreadSlot), "threadslot");
 			BLI_addtail(threadbase, tslot);
 			tslot->do_thread= do_thread;
@@ -166,13 +166,13 @@ void BLI_init_threads(ListBase *threadbase, void *(*do_thread)(void *), int tot)
 		}
 	}
 	
-	if(thread_levels == 0) {
+	if (thread_levels == 0) {
 		MEM_set_lock_callback(BLI_lock_malloc_thread, BLI_unlock_malloc_thread);
 
 #if defined(__APPLE__) && (PARALLEL == 1) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
 		/* workaround for Apple gcc 4.2.1 omp vs background thread bug,
-		   we copy gomp thread local storage pointer to setting it again
-		   inside the thread that we start */
+		 * we copy gomp thread local storage pointer to setting it again
+		 * inside the thread that we start */
 		thread_tls_data = pthread_getspecific(gomp_tls_key);
 #endif
 	}
@@ -186,8 +186,8 @@ int BLI_available_threads(ListBase *threadbase)
 	ThreadSlot *tslot;
 	int counter=0;
 	
-	for(tslot= threadbase->first; tslot; tslot= tslot->next) {
-		if(tslot->avail)
+	for (tslot= threadbase->first; tslot; tslot= tslot->next) {
+		if (tslot->avail)
 			counter++;
 	}
 	return counter;
@@ -199,8 +199,8 @@ int BLI_available_thread_index(ListBase *threadbase)
 	ThreadSlot *tslot;
 	int counter=0;
 	
-	for(tslot= threadbase->first; tslot; tslot= tslot->next, counter++) {
-		if(tslot->avail)
+	for (tslot= threadbase->first; tslot; tslot= tslot->next, counter++) {
+		if (tslot->avail)
 			return counter;
 	}
 	return 0;
@@ -212,7 +212,7 @@ static void *tslot_thread_start(void *tslot_p)
 
 #if defined(__APPLE__) && (PARALLEL == 1) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 2)
 	/* workaround for Apple gcc 4.2.1 omp vs background thread bug,
-	   set gomp thread local storage pointer which was copied beforehand */
+	 * set gomp thread local storage pointer which was copied beforehand */
 	pthread_setspecific (gomp_tls_key, thread_tls_data);
 #endif
 
@@ -228,8 +228,8 @@ void BLI_insert_thread(ListBase *threadbase, void *callerdata)
 {
 	ThreadSlot *tslot;
 	
-	for(tslot= threadbase->first; tslot; tslot= tslot->next) {
-		if(tslot->avail) {
+	for (tslot= threadbase->first; tslot; tslot= tslot->next) {
+		if (tslot->avail) {
 			tslot->avail= 0;
 			tslot->callerdata= callerdata;
 			pthread_create(&tslot->pthread, NULL, tslot_thread_start, tslot);
@@ -243,8 +243,8 @@ void BLI_remove_thread(ListBase *threadbase, void *callerdata)
 {
 	ThreadSlot *tslot;
 	
-	for(tslot= threadbase->first; tslot; tslot= tslot->next) {
-		if(tslot->callerdata==callerdata) {
+	for (tslot= threadbase->first; tslot; tslot= tslot->next) {
+		if (tslot->callerdata==callerdata) {
 			pthread_join(tslot->pthread, NULL);
 			tslot->callerdata= NULL;
 			tslot->avail= 1;
@@ -257,7 +257,7 @@ void BLI_remove_thread_index(ListBase *threadbase, int index)
 	ThreadSlot *tslot;
 	int counter=0;
 	
-	for(tslot = threadbase->first; tslot; tslot = tslot->next, counter++) {
+	for (tslot = threadbase->first; tslot; tslot = tslot->next, counter++) {
 		if (counter == index && tslot->avail == 0) {
 			pthread_join(tslot->pthread, NULL);
 			tslot->callerdata = NULL;
@@ -271,7 +271,7 @@ void BLI_remove_threads(ListBase *threadbase)
 {
 	ThreadSlot *tslot;
 	
-	for(tslot = threadbase->first; tslot; tslot = tslot->next) {
+	for (tslot = threadbase->first; tslot; tslot = tslot->next) {
 		if (tslot->avail == 0) {
 			pthread_join(tslot->pthread, NULL);
 			tslot->callerdata = NULL;
@@ -288,8 +288,8 @@ void BLI_end_threads(ListBase *threadbase)
 	 * this way we don't end up decrementing thread_levels on an empty threadbase 
 	 * */
 	if (threadbase && threadbase->first != NULL) {
-		for(tslot= threadbase->first; tslot; tslot= tslot->next) {
-			if(tslot->avail==0) {
+		for (tslot= threadbase->first; tslot; tslot= tslot->next) {
+			if (tslot->avail==0) {
 				pthread_join(tslot->pthread, NULL);
 			}
 		}
@@ -297,7 +297,7 @@ void BLI_end_threads(ListBase *threadbase)
 	}
 
 	thread_levels--;
-	if(thread_levels==0)
+	if (thread_levels==0)
 		MEM_set_lock_callback(NULL, NULL);
 }
 
@@ -363,15 +363,15 @@ void BLI_unlock_thread(int type)
 		pthread_mutex_unlock(&_preview_lock);
 	else if (type==LOCK_VIEWER)
 		pthread_mutex_unlock(&_viewer_lock);
-	else if(type==LOCK_CUSTOM1)
+	else if (type==LOCK_CUSTOM1)
 		pthread_mutex_unlock(&_custom1_lock);
-	else if(type==LOCK_RCACHE)
+	else if (type==LOCK_RCACHE)
 		pthread_mutex_unlock(&_rcache_lock);
-	else if(type==LOCK_OPENGL)
+	else if (type==LOCK_OPENGL)
 		pthread_mutex_unlock(&_opengl_lock);
-	else if(type==LOCK_NODES)
+	else if (type==LOCK_NODES)
 		pthread_mutex_unlock(&_nodes_lock);
-	else if(type==LOCK_MOVIECLIP)
+	else if (type==LOCK_MOVIECLIP)
 		pthread_mutex_unlock(&_movieclip_lock);
 }
 
@@ -406,7 +406,7 @@ void BLI_rw_mutex_init(ThreadRWMutex *mutex)
 
 void BLI_rw_mutex_lock(ThreadRWMutex *mutex, int mode)
 {
-	if(mode == THREAD_LOCK_READ)
+	if (mode == THREAD_LOCK_READ)
 		pthread_rwlock_rdlock(mutex);
 	else
 		pthread_rwlock_wrlock(mutex);
@@ -459,12 +459,10 @@ ThreadedWorker *BLI_create_worker(void *(*do_thread)(void *), int tot, int sleep
 	
 	worker = MEM_callocN(sizeof(ThreadedWorker), "threadedworker");
 	
-	if (tot > RE_MAX_THREAD)
-	{
+	if (tot > RE_MAX_THREAD) {
 		tot = RE_MAX_THREAD;
 	}
-	else if (tot < 1)
-	{
+	else if (tot < 1) {
 		tot= 1;
 	}
 	
@@ -493,25 +491,20 @@ void BLI_insert_work(ThreadedWorker *worker, void *param)
 	WorkParam *p = MEM_callocN(sizeof(WorkParam), "workparam");
 	int index;
 	
-	if (BLI_available_threads(&worker->threadbase) == 0)
-	{
+	if (BLI_available_threads(&worker->threadbase) == 0) {
 		index = worker->total;
-		while(index == worker->total)
-		{
+		while (index == worker->total) {
 			PIL_sleep_ms(worker->sleep_time);
 			
-			for (index = 0; index < worker->total; index++)
-			{
-				if (worker->busy[index] == 0)
-				{
+			for (index = 0; index < worker->total; index++) {
+				if (worker->busy[index] == 0) {
 					BLI_remove_thread_index(&worker->threadbase, index);
 					break;
 				}
 			}
 		}
 	}
-	else
-	{
+	else {
 		index = BLI_available_thread_index(&worker->threadbase);
 	}
 	
@@ -573,11 +566,11 @@ void *BLI_thread_queue_pop(ThreadQueue *queue)
 
 	/* wait until there is work */
 	pthread_mutex_lock(&queue->mutex);
-	while(BLI_gsqueue_is_empty(queue->queue) && !queue->nowait)
+	while (BLI_gsqueue_is_empty(queue->queue) && !queue->nowait)
 		pthread_cond_wait(&queue->cond, &queue->mutex);
 
 	/* if we have something, pop it */
-	if(!BLI_gsqueue_is_empty(queue->queue))
+	if (!BLI_gsqueue_is_empty(queue->queue))
 		BLI_gsqueue_pop(queue->queue, &work);
 
 	pthread_mutex_unlock(&queue->mutex);
@@ -631,15 +624,15 @@ void *BLI_thread_queue_pop_timeout(ThreadQueue *queue, int ms)
 
 	/* wait until there is work */
 	pthread_mutex_lock(&queue->mutex);
-	while(BLI_gsqueue_is_empty(queue->queue) && !queue->nowait) {
-		if(pthread_cond_timedwait(&queue->cond, &queue->mutex, &timeout) == ETIMEDOUT)
+	while (BLI_gsqueue_is_empty(queue->queue) && !queue->nowait) {
+		if (pthread_cond_timedwait(&queue->cond, &queue->mutex, &timeout) == ETIMEDOUT)
 			break;
-		else if(PIL_check_seconds_timer() - t >= ms*0.001)
+		else if (PIL_check_seconds_timer() - t >= ms*0.001)
 			break;
 	}
 
 	/* if we have something, pop it */
-	if(!BLI_gsqueue_is_empty(queue->queue))
+	if (!BLI_gsqueue_is_empty(queue->queue))
 		BLI_gsqueue_pop(queue->queue, &work);
 
 	pthread_mutex_unlock(&queue->mutex);
@@ -671,7 +664,7 @@ void BLI_thread_queue_nowait(ThreadQueue *queue)
 
 void BLI_begin_threaded_malloc(void)
 {
-	if(thread_levels == 0) {
+	if (thread_levels == 0) {
 		MEM_set_lock_callback(BLI_lock_malloc_thread, BLI_unlock_malloc_thread);
 	}
 	thread_levels++;
@@ -680,6 +673,6 @@ void BLI_begin_threaded_malloc(void)
 void BLI_end_threaded_malloc(void)
 {
 	thread_levels--;
-	if(thread_levels==0)
+	if (thread_levels==0)
 		MEM_set_lock_callback(NULL, NULL);
 }
diff --git a/source/blender/blenlib/intern/time.c b/source/blender/blenlib/intern/time.c
index d86d68f..2f53aa3 100644
--- a/source/blender/blenlib/intern/time.c
+++ b/source/blender/blenlib/intern/time.c
@@ -52,14 +52,16 @@ double PIL_check_seconds_timer(void)
 		QueryPerformanceCounter((LARGE_INTEGER*) &count);
 
 		return count/perffreq;
-	} else {
+	}
+	else {
 		static double accum= 0.0;
 		static int ltick= 0;
 		int ntick= GetTickCount();
 
 		if (ntick<ltick) {
 			accum+= (0xFFFFFFFF-ltick+ntick)/1000.0;
-		} else {
+		}
+		else {
 			accum+= (ntick-ltick)/1000.0;
 		}
 
diff --git a/source/blender/blenlib/intern/uvproject.c b/source/blender/blenlib/intern/uvproject.c
index 8b00d8e..89621cd 100644
--- a/source/blender/blenlib/intern/uvproject.c
+++ b/source/blender/blenlib/intern/uvproject.c
@@ -22,7 +22,6 @@
  *  \ingroup bli
  */
 
-
 #include <math.h>
 
 #include "MEM_guardedalloc.h"
@@ -48,45 +47,46 @@ void project_from_camera(float target[2], float source[3], UvCameraInfo *uci)
 	float pv4[4];
 
 	copy_v3_v3(pv4, source);
-	pv4[3]= 1.0;
+	pv4[3] = 1.0;
 
 	/* rotmat is the object matrix in this case */
-	if(uci->do_rotmat)
+	if (uci->do_rotmat)
 		mul_m4_v4(uci->rotmat, pv4);
 
 	/* caminv is the inverse camera matrix */
 	mul_m4_v4(uci->caminv, pv4);
 
-	if(uci->do_pano) {
-		float angle= atan2f(pv4[0], -pv4[2]) / ((float)M_PI * 2.0f); /* angle around the camera */
-		if (uci->do_persp==0) {
-			target[0]= angle; /* no correct method here, just map to  0-1 */
-			target[1]= pv4[1] / uci->camsize;
+	if (uci->do_pano) {
+		float angle = atan2f(pv4[0], -pv4[2]) / ((float)M_PI * 2.0f); /* angle around the camera */
+		if (uci->do_persp == 0) {
+			target[0] = angle; /* no correct method here, just map to  0-1 */
+			target[1] = pv4[1] / uci->camsize;
 		}
 		else {
 			float vec2d[2]; /* 2D position from the camera */
-			vec2d[0]= pv4[0];
-			vec2d[1]= pv4[2];
-			target[0]= angle * ((float)M_PI / uci->camangle);
-			target[1]= pv4[1] / (len_v2(vec2d) * (uci->camsize * 2.0f));
+			vec2d[0] = pv4[0];
+			vec2d[1] = pv4[2];
+			target[0] = angle * ((float)M_PI / uci->camangle);
+			target[1] = pv4[1] / (len_v2(vec2d) * (uci->camsize * 2.0f));
 		}
 	}
 	else {
-		if (pv4[2]==0.0f) pv4[2]= 0.00001f; /* don't allow div by 0 */
+		if (pv4[2] == 0.0f)
+			pv4[2] = 0.00001f; /* don't allow div by 0 */
 
-		if (uci->do_persp==0) {
-			target[0]= (pv4[0]/uci->camsize);
-			target[1]= (pv4[1]/uci->camsize);
+		if (uci->do_persp == 0) {
+			target[0] = (pv4[0] / uci->camsize);
+			target[1] = (pv4[1] / uci->camsize);
 		}
 		else {
-			target[0]= (-pv4[0]*((1.0f/uci->camsize)/pv4[2])) / 2.0f;
-			target[1]= (-pv4[1]*((1.0f/uci->camsize)/pv4[2])) / 2.0f;
+			target[0] = (-pv4[0] * ((1.0f / uci->camsize) / pv4[2])) / 2.0f;
+			target[1] = (-pv4[1] * ((1.0f / uci->camsize) / pv4[2])) / 2.0f;
 		}
 	}
 
 	target[0] *= uci->xasp;
 	target[1] *= uci->yasp;
-	
+
 	/* adds camera shift + 0.5 */
 	target[0] += uci->shiftx;
 	target[1] += uci->shifty;
@@ -95,54 +95,54 @@ void project_from_camera(float target[2], float source[3], UvCameraInfo *uci)
 /* could rv3d->persmat */
 void project_from_view(float target[2], float source[3], float persmat[4][4], float rotmat[4][4], float winx, float winy)
 {
-	float pv[3], pv4[4], x= 0.0, y= 0.0;
+	float pv[3], pv4[4], x = 0.0, y = 0.0;
 
 	mul_v3_m4v3(pv, rotmat, source);
 
 	copy_v3_v3(pv4, source);
-	pv4[3]= 1.0;
+	pv4[3] = 1.0;
 
 	/* rotmat is the object matrix in this case */
-	mul_m4_v4(rotmat, pv4); 
+	mul_m4_v4(rotmat, pv4);
 
 	/* almost project_short */
 	mul_m4_v4(persmat, pv4);
-	if(fabsf(pv4[3]) > 0.00001f) { /* avoid division by zero */
-		target[0] = winx/2.0f + (winx/2.0f) * pv4[0] / pv4[3];
-		target[1] = winy/2.0f + (winy/2.0f) * pv4[1] / pv4[3];
+	if (fabsf(pv4[3]) > 0.00001f) { /* avoid division by zero */
+		target[0] = winx / 2.0f + (winx / 2.0f) * pv4[0] / pv4[3];
+		target[1] = winy / 2.0f + (winy / 2.0f) * pv4[1] / pv4[3];
 	}
 	else {
 		/* scaling is lost but give a valid result */
-		target[0] = winx/2.0f + (winx/2.0f) * pv4[0];
-		target[1] = winy/2.0f + (winy/2.0f) * pv4[1];
+		target[0] = winx / 2.0f + (winx / 2.0f) * pv4[0];
+		target[1] = winy / 2.0f + (winy / 2.0f) * pv4[1];
 	}
 
-	/* v3d->persmat seems to do this funky scaling */ 
-	if(winx > winy) {
-		y= (winx - winy)/2.0f;
+	/* v3d->persmat seems to do this funky scaling */
+	if (winx > winy) {
+		y = (winx - winy) / 2.0f;
 		winy = winx;
 	}
 	else {
-		x= (winy - winx)/2.0f;
+		x = (winy - winx) / 2.0f;
 		winx = winy;
 	}
 
-	target[0]= (x + target[0]) / winx;
-	target[1]= (y + target[1]) / winy;
+	target[0] = (x + target[0]) / winx;
+	target[1] = (y + target[1]) / winy;
 }
 
 /* 'rotmat' can be obedit->obmat when uv project is used.
- * 'winx' and 'winy' can be from scene->r.xsch/ysch */ 
-UvCameraInfo *project_camera_info(Object *ob, float (*rotmat)[4], float winx, float winy)
+ * 'winx' and 'winy' can be from scene->r.xsch/ysch */
+UvCameraInfo *project_camera_info(Object *ob, float(*rotmat)[4], float winx, float winy)
 {
 	UvCameraInfo uci;
-	Camera *camera= ob->data;
+	Camera *camera = ob->data;
 
 	uci.do_pano = (camera->flag & CAM_PANORAMA);
-	uci.do_persp = (camera->type==CAM_PERSP);
+	uci.do_persp = (camera->type == CAM_PERSP);
 
-	uci.camangle= focallength_to_fov(camera->lens, camera->sensor_x) / 2.0f;
-	uci.camsize= uci.do_persp ? tanf(uci.camangle) : camera->ortho_scale;
+	uci.camangle = focallength_to_fov(camera->lens, camera->sensor_x) / 2.0f;
+	uci.camsize = uci.do_persp ? tanf(uci.camangle) : camera->ortho_scale;
 
 	/* account for scaled cameras */
 	copy_m4_m4(uci.caminv, ob->obmat);
@@ -152,30 +152,30 @@ UvCameraInfo *project_camera_info(Object *ob, float (*rotmat)[4], float winx, fl
 		UvCameraInfo *uci_pt;
 
 		/* normal projection */
-		if(rotmat) {
+		if (rotmat) {
 			copy_m4_m4(uci.rotmat, rotmat);
-			uci.do_rotmat= 1;
+			uci.do_rotmat = 1;
 		}
 		else {
-			uci.do_rotmat= 0;
+			uci.do_rotmat = 0;
 		}
 
 		/* also make aspect ratio adjustment factors */
 		if (winx > winy) {
-			uci.xasp= 1.0f;
-			uci.yasp= winx / winy;
+			uci.xasp = 1.0f;
+			uci.yasp = winx / winy;
 		}
 		else {
-			uci.xasp= winy / winx;
-			uci.yasp= 1.0f;
+			uci.xasp = winy / winx;
+			uci.yasp = 1.0f;
 		}
-		
+
 		/* include 0.5f here to move the UVs into the center */
 		uci.shiftx = 0.5f - (camera->shiftx * uci.xasp);
 		uci.shifty = 0.5f - (camera->shifty * uci.yasp);
-		
-		uci_pt= MEM_mallocN(sizeof(UvCameraInfo), "UvCameraInfo");
-		*uci_pt= uci;
+
+		uci_pt = MEM_mallocN(sizeof(UvCameraInfo), "UvCameraInfo");
+		*uci_pt = uci;
 		return uci_pt;
 	}
 
@@ -193,7 +193,6 @@ void project_from_view_ortho(float target[2], float source[3], float rotmat[4][4
 	target[1] = pv[2];
 }
 
-
 void project_camera_info_scale(UvCameraInfo *uci, float scale_x, float scale_y)
 {
 	uci->xasp *= scale_x;
diff --git a/source/blender/blenlib/intern/voxel.c b/source/blender/blenlib/intern/voxel.c
index f6c8c63..34862c7 100644
--- a/source/blender/blenlib/intern/voxel.c
+++ b/source/blender/blenlib/intern/voxel.c
@@ -35,7 +35,7 @@
 
 
 
-BM_INLINE float D(float *data, const int res[3], int x, int y, int z)
+BLI_INLINE float D(float *data, const int res[3], int x, int y, int z)
 {
 	CLAMP(x, 0, res[0]-1);
 	CLAMP(y, 0, res[1]-1);
@@ -43,7 +43,7 @@ BM_INLINE float D(float *data, const int res[3], int x, int y, int z)
 	return data[ V_I(x, y, z, res) ];
 }
 
-/* *** nearest neighbour *** */
+/* *** nearest neighbor *** */
 /* input coordinates must be in bounding box 0.0 - 1.0 */
 float voxel_sample_nearest(float *data, const int res[3], const float co[3])
 {
@@ -57,7 +57,7 @@ float voxel_sample_nearest(float *data, const int res[3], const float co[3])
 }
 
 // returns highest integer <= x as integer (slightly faster than floor())
-BM_INLINE int FLOORI(float x)
+BLI_INLINE int FLOORI(float x)
 {
 	const int r = (int)x;
 	return ((x >= 0.f) || (float)r == x) ? r : (r - 1);
@@ -65,7 +65,7 @@ BM_INLINE int FLOORI(float x)
 
 // clamp function, cannot use the CLAMPIS macro, it sometimes returns unwanted results apparently related to gcc optimization flag -fstrict-overflow which is enabled at -O2
 // this causes the test (x + 2) < 0 with int x == 2147483647 to return false (x being an integer, x + 2 should wrap around to -2147483647 so the test < 0 should return true, which it doesn't)
-BM_INLINE int _clamp(int a, int b, int c)
+BLI_INLINE int _clamp(int a, int b, int c)
 {
 	return (a < b) ? b : ((a > c) ? c : a);
 }
diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c
index b2002b6..f3cb0dd 100644
--- a/source/blender/blenlib/intern/winstuff.c
+++ b/source/blender/blenlib/intern/winstuff.c
@@ -46,18 +46,22 @@
 
 #define WIN32_SKIP_HKEY_PROTECTION		// need to use HKEY
 #include "BLI_winstuff.h"
+#include "BLI_utildefines.h"
 
- /* FILE_MAX */
+#include "utf_winfunc.h"
+#include "utfconv.h"
 
-int BLI_getInstallationDir( char * str )
+ /* FILE_MAXDIR + FILE_MAXFILE */
+
+int BLI_getInstallationDir(char * str)
 {
 	char dir[FILE_MAXDIR];
 	int a;
-	
+	/*change to utf support*/
 	GetModuleFileName(NULL,str,FILE_MAX);
 	BLI_split_dir_part(str, dir, sizeof(dir)); /* shouldn't be relative */
 	a = strlen(dir);
-	if(dir[a-1] == '\\') dir[a-1]=0;
+	if (dir[a-1] == '\\') dir[a-1]=0;
 	
 	strcpy(str,dir);
 	
@@ -86,7 +90,7 @@ void RegisterBlendExtension(void)
 	char BlPath[MAX_PATH];
 	char InstallDir[FILE_MAXDIR];
 	char SysDir[FILE_MAXDIR];
-	const char* ThumbHandlerDLL;
+    const char *ThumbHandlerDLL;
 	char RegCmd[MAX_PATH*2];
 	char MBox[256];
 	BOOL IsWOW64;
@@ -96,8 +100,7 @@ void RegisterBlendExtension(void)
 
 	// root is HKLM by default
 	lresult = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Classes", 0, KEY_ALL_ACCESS, &root);
-	if (lresult != ERROR_SUCCESS)
-	{
+	if (lresult != ERROR_SUCCESS) {
 		// try HKCU on failure
 		usr_mode = TRUE;
 		lresult = RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Classes", 0, KEY_ALL_ACCESS, &root);
@@ -161,8 +164,7 @@ void RegisterBlendExtension(void)
 
 	RegCloseKey(root);
 	printf("success (%s)\n",usr_mode ? "user" : "system");
-	if (!G.background)
-	{
+	if (!G.background) {
 		sprintf(MBox,"File extension registered for %s.",usr_mode ? "the current user. To register for all users, run as an administrator" : "all users");
 		MessageBox(0,MBox,"Blender",MB_OK|MB_ICONINFORMATION);
 	}
@@ -171,7 +173,9 @@ void RegisterBlendExtension(void)
 
 DIR *opendir (const char *path)
 {
-	if (GetFileAttributes(path) & FILE_ATTRIBUTE_DIRECTORY) {
+    wchar_t *path_16 = alloc_utf16_from_8(path, 0);
+
+	if (GetFileAttributesW(path_16) & FILE_ATTRIBUTE_DIRECTORY) {
 		DIR *newd= MEM_mallocN(sizeof(DIR), "opendir");
 
 		newd->handle = INVALID_HANDLE_VALUE;
@@ -182,12 +186,37 @@ DIR *opendir (const char *path)
 		newd->direntry.d_reclen= 0;
 		newd->direntry.d_name= NULL;
 		
+		free(path_16);
 		return newd;
-	} else {
+	}
+	else {
+		free(path_16);
 		return NULL;
 	}
 }
 
+static char *BLI_alloc_utf_8_from_16(wchar_t *in16, size_t add)
+{
+	size_t bsize = count_utf_8_from_16(in16);
+    char *out8 = NULL;
+	if (!bsize) return NULL;
+	out8 = (char*)MEM_mallocN(sizeof(char) * (bsize + add),"UTF-8 String");
+	conv_utf_16_to_8(in16,out8, bsize);
+	return out8;
+}
+
+static wchar_t *UNUSED_FUNCTION(BLI_alloc_utf16_from_8)(char *in8, size_t add)
+{
+	size_t bsize = count_utf_16_from_8(in8);
+    wchar_t *out16 = NULL;
+	if (!bsize) return NULL;
+	out16 =(wchar_t*) MEM_mallocN(sizeof(wchar_t) * (bsize + add), "UTF-16 String");
+	conv_utf_8_to_16(in8,out16, bsize);
+	return out16;
+}
+
+
+
 struct dirent *readdir(DIR *dp)
 {
 	if (dp->direntry.d_name) {
@@ -196,18 +225,22 @@ struct dirent *readdir(DIR *dp)
 	}
 		
 	if (dp->handle==INVALID_HANDLE_VALUE) {
-		dp->handle= FindFirstFile(dp->path, &(dp->data));
+        wchar_t *path_16 = alloc_utf16_from_8(dp->path, 0);
+		dp->handle= FindFirstFileW(path_16, &(dp->data));
+		free(path_16);
 		if (dp->handle==INVALID_HANDLE_VALUE)
 			return NULL;
 			
-		dp->direntry.d_name= BLI_strdup(dp->data.cFileName);
-
+		dp->direntry.d_name= BLI_alloc_utf_8_from_16(dp->data.cFileName, 0);
+		
 		return &dp->direntry;
-	} else if (FindNextFile (dp->handle, &(dp->data))) {
-		dp->direntry.d_name= BLI_strdup(dp->data.cFileName);
+	}
+	else if (FindNextFileW (dp->handle, &(dp->data))) {
+		dp->direntry.d_name= BLI_alloc_utf_8_from_16(dp->data.cFileName,0);
 
 		return &dp->direntry;
-	} else {
+	}
+	else {
 		return NULL;
 	}
 }
@@ -222,28 +255,30 @@ int closedir (DIR *dp)
 	return 0;
 }
 
-void get_default_root(char* root)
+void get_default_root(char *root)
 {
 	char str[MAX_PATH+1];
 	
 	/* the default drive to resolve a directory without a specified drive 
-	   should be the Windows installation drive, since this was what the OS
-	   assumes. */
+	 * should be the Windows installation drive, since this was what the OS
+	 * assumes. */
 	if (GetWindowsDirectory(str,MAX_PATH+1)) {
 		root[0] = str[0];
 		root[1] = ':';
 		root[2] = '\\';
 		root[3] = '\0';
-	} else {		
+	}
+	else {
 		/* if GetWindowsDirectory fails, something has probably gone wrong, 
-		   we are trying the blender install dir though */
+		 * we are trying the blender install dir though */
 		if (GetModuleFileName(NULL,str,MAX_PATH+1)) {
 			printf("Error! Could not get the Windows Directory - Defaulting to Blender installation Dir!");
 			root[0] = str[0];
 			root[1] = ':';
 			root[2] = '\\';
 			root[3] = '\0';
-		} else {
+		}
+		else {
 			DWORD tmp;
 			int i;
 			int rc = 0;
@@ -300,18 +335,18 @@ int check_file_chars(char *filename)
  * is freely granted, provided that this notice is preserved.
  */
 #include <string.h>
-char* dirname(char *path)
+const char *dirname(char *path)
 {
 	char *p;
-	if( path == NULL || *path == '\0' )
+	if ( path == NULL || *path == '\0' )
 		return ".";
 	p = path + strlen(path) - 1;
-	while( *p == '/' ) {
-		if( p == path )
+	while ( *p == '/' ) {
+		if ( p == path )
 			return path;
 		*p-- = '\0';
 	}
-	while( p >= path && *p != '/' )
+	while ( p >= path && *p != '/' )
 		p--;
 	return
 		p < path ? "." :
diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h
index d63baca..bddaa5f 100644
--- a/source/blender/blenloader/BLO_readfile.h
+++ b/source/blender/blenloader/BLO_readfile.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BLO_READFILE_H
-#define BLO_READFILE_H
+#ifndef __BLO_READFILE_H__
+#define __BLO_READFILE_H__
 
 /** \file BLO_readfile.h
  *  \ingroup blenloader
@@ -78,10 +78,10 @@ typedef struct BlendFileData {
 	 * returns NULL and sets a report in the list if
 	 * it cannot open the file.
 	 * 
-	 * @param filepath The path of the file to open.
-	 * @param reports If the return value is NULL, errors
+	 * \param filepath The path of the file to open.
+	 * \param reports If the return value is NULL, errors
 	 * indicating the cause of the failure.
-	 * @return The data of the file.
+	 * \return The data of the file.
 	 */
 BlendFileData*	BLO_read_from_file(const char *filepath, struct ReportList *reports);
 
@@ -90,11 +90,11 @@ BlendFileData*	BLO_read_from_file(const char *filepath, struct ReportList *repor
 	 * returns NULL and sets a report in the list if
 	 * it cannot open the file.
 	 * 
-	 * @param mem The file data.
-	 * @param memsize The length of @a mem.
-	 * @param reports If the return value is NULL, errors
+	 * \param mem The file data.
+	 * \param memsize The length of \a mem.
+	 * \param reports If the return value is NULL, errors
 	 * indicating the cause of the failure.
-	 * @return The data of the file.
+	 * \return The data of the file.
 	 */
 BlendFileData*	BLO_read_from_memory(void *mem, int memsize, struct ReportList *reports);
 
@@ -109,7 +109,7 @@ BlendFileData *BLO_read_from_memfile(struct Main *oldmain, const char *filename,
  * data associated with it (the userdef data, and
  * the main libblock data).
  * 
- * @param bfd The structure to free.
+ * \param bfd The structure to free.
  */
 	void
 BLO_blendfiledata_free(
@@ -118,9 +118,9 @@ BLO_blendfiledata_free(
 /**
  * Open a blendhandle from a file path.
  * 
- * @param file The file path to open.
- * @param reports Report errors in opening the file (can be NULL).
- * @return A handle on success, or NULL on failure.
+ * \param file The file path to open.
+ * \param reports Report errors in opening the file (can be NULL).
+ * \return A handle on success, or NULL on failure.
  */
 	BlendHandle*
 BLO_blendhandle_from_file(
@@ -130,9 +130,9 @@ BLO_blendhandle_from_file(
 /**
  * Open a blendhandle from memory.
  *
- * @param mem The data to load from.
- * @param memsize The size of the data.
- * @return A handle on success, or NULL on failure.
+ * \param mem The data to load from.
+ * \param memsize The size of the data.
+ * \return A handle on success, or NULL on failure.
  */
 
 	BlendHandle*
@@ -145,10 +145,10 @@ BLO_blendhandle_from_memory(
  * of a certain type (ie. All the scene names in
  * a file).
  * 
- * @param bh The blendhandle to access.
- * @param ofblocktype The type of names to get.
- * @param tot_names The length of the returned list.
- * @return A BLI_linklist of strings. The string links
+ * \param bh The blendhandle to access.
+ * \param ofblocktype The type of names to get.
+ * \param tot_names The length of the returned list.
+ * \return A BLI_linklist of strings. The string links
  * should be freed with malloc.
  */
 	struct LinkNode*
@@ -162,10 +162,10 @@ BLO_blendhandle_get_datablock_names(
  * of a certain type (ie. All the scene names in
  * a file).
  * 
- * @param bh The blendhandle to access.
- * @param ofblocktype The type of names to get.
- * @param tot_prev The length of the returned list.
- * @return A BLI_linklist of PreviewImage. The PreviewImage links
+ * \param bh The blendhandle to access.
+ * \param ofblocktype The type of names to get.
+ * \param tot_prev The length of the returned list.
+ * \return A BLI_linklist of PreviewImage. The PreviewImage links
  * should be freed with malloc.
  */
 	struct LinkNode*
@@ -179,8 +179,8 @@ BLO_blendhandle_get_previews(
  * file. (ie. file contains Scene, Mesh, and Lamp
  * datablocks).
  * 
- * @param bh The blendhandle to access.
- * @return A BLI_linklist of strings. The string links
+ * \param bh The blendhandle to access.
+ * \return A BLI_linklist of strings. The string links
  * should be freed with malloc.
  */
 	struct LinkNode*
@@ -191,7 +191,7 @@ BLO_blendhandle_get_linkable_groups(
  * Close and free a blendhandle. The handle
  * becomes invalid after this call.
  *
- * @param bh The handle to close.
+ * \param bh The handle to close.
  */
 	void
 BLO_blendhandle_close(
@@ -212,10 +212,10 @@ int BLO_is_a_library(const char *path, char *dir, char *group);
 /**
  * Initialize the BlendHandle for appending or linking library data.
  *
- * @param mainvar The current main database eg G.main or CTX_data_main(C).
- * @param bh A blender file handle as returned by BLO_blendhandle_from_file or BLO_blendhandle_from_memory.
- * @param filepath Used for relative linking, copied to the lib->name
- * @return the library Main, to be passed to BLO_library_append_named_part as mainl.
+ * \param mainvar The current main database eg G.main or CTX_data_main(C).
+ * \param bh A blender file handle as returned by BLO_blendhandle_from_file or BLO_blendhandle_from_memory.
+ * \param filepath Used for relative linking, copied to the lib->name
+ * \return the library Main, to be passed to BLO_library_append_named_part as mainl.
  */
 struct Main* BLO_library_append_begin(struct Main *mainvar, BlendHandle** bh, const char *filepath);
 
@@ -223,11 +223,11 @@ struct Main* BLO_library_append_begin(struct Main *mainvar, BlendHandle** bh, co
 /**
  * Link/Append a named datablock from an external blend file.
  *
- * @param mainl The main database to link from (not the active one).
- * @param bh The blender file handle.
- * @param idname The name of the datablock (without the 2 char ID prefix)
- * @param idcode The kind of datablock to link.
- * @return the appended ID when found.
+ * \param mainl The main database to link from (not the active one).
+ * \param bh The blender file handle.
+ * \param idname The name of the datablock (without the 2 char ID prefix)
+ * \param idcode The kind of datablock to link.
+ * \return the appended ID when found.
  */
 struct ID *BLO_library_append_named_part(struct Main *mainl, BlendHandle** bh, const char *idname, const int idcode);
 
@@ -235,13 +235,13 @@ struct ID *BLO_library_append_named_part(struct Main *mainl, BlendHandle** bh, c
  * Link/Append a named datablock from an external blend file.
  * optionally instance the object in the scene when the flags are set.
  *
- * @param C The context, when NULL instancing object in the scene isnt done.
- * @param mainl The main database to link from (not the active one).
- * @param bh The blender file handle.
- * @param idname The name of the datablock (without the 2 char ID prefix)
- * @param idcode The kind of datablock to link.
- * @param flag Options for linking, used for instancing.
- * @return the appended ID when found.
+ * \param C The context, when NULL instancing object in the scene isn't done.
+ * \param mainl The main database to link from (not the active one).
+ * \param bh The blender file handle.
+ * \param idname The name of the datablock (without the 2 char ID prefix)
+ * \param idcode The kind of datablock to link.
+ * \param flag Options for linking, used for instancing.
+ * \return the appended ID when found.
  */
 struct ID *BLO_library_append_named_part_ex(const struct bContext *C, struct Main *mainl, BlendHandle** bh, const char *idname, const int idcode, const short flag);
 
diff --git a/source/blender/blenloader/BLO_runtime.h b/source/blender/blenloader/BLO_runtime.h
index 573db53..0a5a7d3 100644
--- a/source/blender/blenloader/BLO_runtime.h
+++ b/source/blender/blenloader/BLO_runtime.h
@@ -26,8 +26,8 @@
  * 
  */
 
-#ifndef BLO_RUNTIME_H
-#define BLO_RUNTIME_H
+#ifndef __BLO_RUNTIME_H__
+#define __BLO_RUNTIME_H__
 
 /** \file BLO_runtime.h
  *  \ingroup blenloader
@@ -47,5 +47,5 @@ struct BlendFileData *BLO_read_runtime(const char *file, struct ReportList *repo
 }
 #endif
 
-#endif /* BLO_RUNTIME_H */
+#endif /* __BLO_RUNTIME_H__ */
 
diff --git a/source/blender/blenloader/BLO_soundfile.h b/source/blender/blenloader/BLO_soundfile.h
index 4c8d40b..d2f8713 100644
--- a/source/blender/blenloader/BLO_soundfile.h
+++ b/source/blender/blenloader/BLO_soundfile.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef BLO_SOUNDFILE_H
-#define BLO_SOUNDFILE_H
+#ifndef __BLO_SOUNDFILE_H__
+#define __BLO_SOUNDFILE_H__
 
 /** \file BLO_soundfile.h
  *  \ingroup blenloader
diff --git a/source/blender/blenloader/BLO_sys_types.h b/source/blender/blenloader/BLO_sys_types.h
index 20d211a..41e33eb 100644
--- a/source/blender/blenloader/BLO_sys_types.h
+++ b/source/blender/blenloader/BLO_sys_types.h
@@ -40,8 +40,8 @@
  *
  */
 
-#ifndef BLO_SYS_TYPES_H
-#define BLO_SYS_TYPES_H
+#ifndef __BLO_SYS_TYPES_H__
+#define __BLO_SYS_TYPES_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -49,7 +49,7 @@ extern "C" {
  
 #if defined(_WIN32) && !defined(FREE_WINDOWS)
 
-/* The __intXX are built-in types of the visual complier! So we don't
+/* The __intXX are built-in types of the visual compiler! So we don't
  * need to include anything else here. */
 
 
@@ -100,8 +100,10 @@ typedef uint64_t  u_int64_t;
 #include <inttypes.h>
 
 #elif defined(FREE_WINDOWS)
+#ifndef FREE_WINDOWS64
 /* define htoln here, there must be a syntax error in winsock2.h in MinGW */
 unsigned long __attribute__((__stdcall__)) htonl(unsigned long);
+#endif
 #include <stdint.h>
 
 #else
diff --git a/source/blender/blenloader/BLO_undofile.h b/source/blender/blenloader/BLO_undofile.h
index 0e06cbd..f716b47 100644
--- a/source/blender/blenloader/BLO_undofile.h
+++ b/source/blender/blenloader/BLO_undofile.h
@@ -26,8 +26,8 @@
  * external writefile function prototypes
  */
 
-#ifndef BLO_UNDOFILE_H
-#define BLO_UNDOFILE_H
+#ifndef __BLO_UNDOFILE_H__
+#define __BLO_UNDOFILE_H__
 
 /** \file BLO_undofile.h
  *  \ingroup blenloader
@@ -47,7 +47,7 @@ typedef struct MemFile {
 } MemFile;
 
 /* actually only used writefile.c */
-extern void add_memfilechunk(MemFile *compare, MemFile *current, char *buf, unsigned int size);
+extern void add_memfilechunk(MemFile *compare, MemFile *current, const char *buf, unsigned int size);
 
 /* exports */
 extern void BLO_free_memfile(MemFile *memfile);
diff --git a/source/blender/blenloader/BLO_writefile.h b/source/blender/blenloader/BLO_writefile.h
index 1ac5fee..7a8429a 100644
--- a/source/blender/blenloader/BLO_writefile.h
+++ b/source/blender/blenloader/BLO_writefile.h
@@ -25,8 +25,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef BLO_WRITEFILE_H
-#define BLO_WRITEFILE_H
+#ifndef __BLO_WRITEFILE_H__
+#define __BLO_WRITEFILE_H__
 
 /** \file BLO_writefile.h
  *  \ingroup blenloader
@@ -37,9 +37,8 @@ struct MemFile;
 struct Main;
 struct ReportList;
 
-extern int BLO_write_file(struct Main *mainvar, const char *filepath, int write_flags, struct ReportList *reports, int *thumb);
+extern int BLO_write_file(struct Main *mainvar, const char *filepath, int write_flags, struct ReportList *reports, const int *thumb);
 extern int BLO_write_file_mem(struct Main *mainvar, struct MemFile *compare, struct MemFile *current, int write_flags);
-extern int BLO_write_runtime(struct Main *mainvar, const char *file, char *exename, struct ReportList *reports);
 
 #define BLEN_THUMB_SIZE 128
 
diff --git a/source/blender/blenloader/SConscript b/source/blender/blenloader/SConscript
index 0333eab..20b5607 100644
--- a/source/blender/blenloader/SConscript
+++ b/source/blender/blenloader/SConscript
@@ -5,7 +5,7 @@ sources = env.Glob('intern/*.c')
 
 incs = '. #/intern/guardedalloc ../blenlib ../blenkernel'
 incs += ' ../makesdna ../editors/include'
-incs += ' ../render/extern/include ../makesrna ../nodes ../imbuf'
+incs += ' ../render/extern/include ../makesrna ../nodes ../bmesh ../imbuf'
 
 incs += ' ' + env['BF_ZLIB_INC']
 
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index 6e4dcb6..49990a9 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -64,8 +64,8 @@
 
 #include "BLO_sys_types.h" // needed for intptr_t
 
-#ifdef _WIN32
-#include "BLI_winstuff.h"
+#ifdef WIN32
+#  include "BLI_winstuff.h"
 #endif
 
 /* local prototypes --------------------- */
@@ -115,7 +115,7 @@ void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp)
 			buf[2]= buf[2]?buf[2]:' ';
 			buf[3]= buf[3]?buf[3]:' ';
 			
-			fprintf(fp, "['%.4s', '%s', %d, %ld ], \n", buf, name, bhead->nr, (long int)(bhead->len+sizeof(BHead)));
+			fprintf(fp, "['%.4s', '%s', %d, %ld ],\n", buf, name, bhead->nr, (long int)(bhead->len+sizeof(BHead)));
 		}
 	}
 	fprintf(fp, "]\n");
@@ -134,7 +134,8 @@ LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh, int ofblocktype,
 
 			BLI_linklist_prepend(&names, strdup(idname+2));
 			tot++;
-		} else if (bhead->code==ENDB)
+		}
+		else if (bhead->code==ENDB)
 			break;
 	}
 
@@ -170,7 +171,8 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
 				default:
 					break;
 			}
-		} else if (bhead->code==DATA) {
+		}
+		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");	
@@ -182,7 +184,8 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
 							bhead= blo_nextbhead(fd, bhead);
 							rect = (unsigned int*)(bhead+1);
 							memcpy(new_prv->rect[0], rect, bhead->len);					
-						} else {
+						}
+						else {
 							new_prv->rect[0] = NULL;
 						}
 						
@@ -192,16 +195,19 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
 							bhead= blo_nextbhead(fd, bhead);
 							rect = (unsigned int*)(bhead+1);
 							memcpy(new_prv->rect[1], rect, bhead->len);							
-						} else {
+						}
+						else {
 							new_prv->rect[1] = NULL;
 						}
 						MEM_freeN(prv);
 					}
 				}
 			}
-		} else if (bhead->code==ENDB) {
+		}
+		else if (bhead->code==ENDB) {
 			break;
-		} else {
+		}
+		else {
 			looking = 0;
 			new_prv = NULL;
 			prv = NULL;
@@ -223,7 +229,8 @@ LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh)
 	for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
 		if (bhead->code==ENDB) {
 			break;
-		} else if (BKE_idcode_is_valid(bhead->code)) {
+		}
+		else if (BKE_idcode_is_valid(bhead->code)) {
 			if (BKE_idcode_is_linkable(bhead->code)) {
 				const char *str= BKE_idcode_to_name(bhead->code);
 				
@@ -313,7 +320,7 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain, const char *filename, MemFil
 		blo_end_movieclip_pointer_map(fd, oldmain);
 		
 		/* move libraries from old main to new main */
-		if(bfd && mainlist.first!=mainlist.last) {
+		if (bfd && mainlist.first!=mainlist.last) {
 			
 			/* Library structs themselves */
 			bfd->main->library= oldmain->library;
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index ff73733..d278d37 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -42,11 +42,11 @@
 #include <stdarg.h> /* for va_start/end */
 
 #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"
-#include "BLI_winstuff.h"
+#  include <io.h> // for open close read
+#  include "winsock2.h"
+#  include "BLI_winstuff.h"
 #endif
 
 /* allow readfile to use deprecated functionality */
@@ -100,6 +100,7 @@
 #include "BLI_utildefines.h"
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
+#include "BLI_edgehash.h"
 
 #include "BKE_anim.h"
 #include "BKE_action.h"
@@ -271,7 +272,7 @@ static void BKE_reportf_wrap(ReportList *reports, ReportType type, const char *f
 
 	BKE_report(reports, type, fixed_buf);
 
-	if(G.background==0) {
+	if (G.background==0) {
 		printf("%s\n", fixed_buf);
 	}
 }
@@ -290,8 +291,8 @@ static int verg_oldnewmap(const void *v1, const void *v2)
 {
 	const struct OldNew *x1=v1, *x2=v2;
 	
-	if( x1->old > x2->old) return 1;
-	else if( x1->old < x2->old) return -1;
+	if ( x1->old > x2->old) return 1;
+	else if ( x1->old < x2->old) return -1;
 	return 0;
 }
 
@@ -307,7 +308,7 @@ static void oldnewmap_insert(OldNewMap *onm, void *oldaddr, void *newaddr, int n
 {
 	OldNew *entry;
 
-	if(oldaddr==NULL || newaddr==NULL) return;
+	if (oldaddr==NULL || newaddr==NULL) return;
 	
 	if (onm->nentries==onm->entriessize) {
 		int osize= onm->entriessize;
@@ -330,7 +331,7 @@ static void *oldnewmap_lookup_and_inc(OldNewMap *onm, void *addr)
 {
 	int i;
 
-	if(addr==NULL) return NULL;
+	if (addr==NULL) return NULL;
 
 	if (onm->lasthit<onm->nentries-1) {
 		OldNew *entry= &onm->entries[++onm->lasthit];
@@ -360,16 +361,16 @@ 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) {
+	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) {
+		if (entry) {
 			ID *id= entry->newp;
 			
 			if (id && (!lib || id->lib)) {
@@ -431,7 +432,7 @@ static void add_main_to_main(Main *mainvar, Main *from)
 
 	set_listbasepointers(mainvar, lbarray);
 	a= set_listbasepointers(from, fromarray);
-	while(a--) {
+	while (a--) {
 		BLI_movelisttolist(lbarray[a], fromarray[a]);
 	}
 }
@@ -456,12 +457,12 @@ static void split_libdata(ListBase *lb, Main *first)
 	Main *mainvar;
 
 	id= lb->first;
-	while(id) {
+	while (id) {
 		idnext= id->next;
-		if(id->lib) {
+		if (id->lib) {
 			mainvar= first;
-			while(mainvar) {
-				if(mainvar->curlib==id->lib) {
+			while (mainvar) {
+				if (mainvar->curlib==id->lib) {
 					lbn= which_libbase(mainvar, GS(id->name));
 					BLI_remlink(lb, id);
 					BLI_addtail(lbn, id);
@@ -469,7 +470,7 @@ static void split_libdata(ListBase *lb, Main *first)
 				}
 				mainvar= mainvar->next;
 			}
-			if(mainvar==NULL) printf("error split_libdata\n");
+			if (mainvar==NULL) printf("error split_libdata\n");
 		}
 		id= idnext;
 	}
@@ -484,7 +485,7 @@ void blo_split_main(ListBase *mainlist, Main *main)
 	mainlist->first= mainlist->last= main;
 	main->next= NULL;
 
-	if(main->library.first==NULL)
+	if (main->library.first==NULL)
 		return;
 	
 	for (lib= main->library.first; lib; lib= lib->id.next) {
@@ -494,7 +495,7 @@ void blo_split_main(ListBase *mainlist, Main *main)
 	}
 
 	i= set_listbasepointers(main, lbarray);
-	while(i--)
+	while (i--)
 		split_libdata(lbarray[i], main->next);
 }
 
@@ -515,7 +516,7 @@ static void read_file_version(FileData *fd, Main *main)
 	for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
 		if (bhead->code==GLOB) {
 			FileGlobal *fg= read_struct(fd, bhead, "Global");
-			if(fg) {
+			if (fg) {
 				main->subversionfile= fg->subversion;
 				main->minversionfile= fg->minversion;
 				main->minsubversionfile= fg->minsubversion;
@@ -543,7 +544,7 @@ static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *filepat
 		char *libname= (m->curlib)?m->curlib->filepath:m->name;
 		
 		if (BLI_path_cmp(name1, libname) == 0) {
-			if(G.f & G_DEBUG) printf("blo_find_main: found library %s\n", libname);
+			if (G.debug & G_DEBUG) printf("blo_find_main: found library %s\n", libname);
 			return m;
 		}
 	}
@@ -559,7 +560,7 @@ static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *filepat
 	
 	read_file_version(fd, m);
 	
-	if(G.f & G_DEBUG) printf("blo_find_main: added new lib %s\n", filepath);
+	if (G.debug & G_DEBUG) printf("blo_find_main: added new lib %s\n", filepath);
 	return m;
 }
 
@@ -569,7 +570,7 @@ static Main *blo_find_main(FileData *fd, ListBase *mainlist, const char *filepat
 static void switch_endian_bh4(BHead4 *bhead)
 {
 	/* the ID_.. codes */
-	if((bhead->code & 0xFFFF)==0) bhead->code >>=16;
+	if ((bhead->code & 0xFFFF)==0) bhead->code >>=16;
 
 	if (bhead->code != ENDB) {
 		SWITCH_INT(bhead->len);
@@ -581,7 +582,7 @@ static void switch_endian_bh4(BHead4 *bhead)
 static void switch_endian_bh8(BHead8 *bhead)
 {
 	/* the ID_.. codes */
-	if((bhead->code & 0xFFFF)==0) bhead->code >>=16;
+	if ((bhead->code & 0xFFFF)==0) bhead->code >>=16;
 
 	if (bhead->code != ENDB) {
 		SWITCH_INT(bhead->len);
@@ -611,7 +612,7 @@ static void bh4_from_bh8(BHead *bhead, BHead8 *bhead8, int do_endian_swap)
 		}
 
 		/* this patch is to avoid a long long being read from not-eight aligned positions
-		   is necessary on any modern 64bit architecture) */
+		 * is necessary on any modern 64bit architecture) */
 		memcpy(&old, &bhead8->old, 8);
 		bhead4->old = (int) (old >> 3);
 
@@ -665,14 +666,17 @@ static BHeadN *get_bhead(FileData *fd)
 
 					if (fd->flags & FD_FLAGS_POINTSIZE_DIFFERS) {
 						bh8_from_bh4(&bhead, &bhead4);
-					} else {
+					}
+					else {
 						memcpy(&bhead, &bhead4, sizeof(bhead));
 					}
-				} else {
+				}
+				else {
 					fd->eof = 1;
 					bhead.len= 0;
 				}
-			} else {
+			}
+			else {
 				bhead8.code = DATA;
 				readsize = fd->read(fd, &bhead8, sizeof(bhead8));
 
@@ -683,10 +687,12 @@ static BHeadN *get_bhead(FileData *fd)
 
 					if (fd->flags & FD_FLAGS_POINTSIZE_DIFFERS) {
 						bh4_from_bh8(&bhead, &bhead8, (fd->flags & FD_FLAGS_SWITCH_ENDIAN));
-					} else {
+					}
+					else {
 						memcpy(&bhead, &bhead8, sizeof(bhead));
 					}
-				} else {
+				}
+				else {
 					fd->eof = 1;
 					bhead.len= 0;
 				}
@@ -711,7 +717,8 @@ static BHeadN *get_bhead(FileData *fd)
 						MEM_freeN(new_bhead);
 						new_bhead = NULL;
 					}
-				} else {
+				}
+				else {
 					fd->eof = 1;
 				}
 			}
@@ -791,18 +798,19 @@ static void decode_blender_header(FileData *fd)
 	readsize = fd->read(fd, header, sizeof(header));
 
 	if (readsize == sizeof(header)) {
-		if(strncmp(header, "BLENDER", 7) == 0) {
+		if (strncmp(header, "BLENDER", 7) == 0) {
 			int remove_this_endian_test= 1;
 
 			fd->flags |= FD_FLAGS_FILE_OK;
 
 			// what size are pointers in the file ?
-			if(header[7]=='_') {
+			if (header[7]=='_') {
 				fd->flags |= FD_FLAGS_FILE_POINTSIZE_IS_4;
 				if (sizeof(void *) != 4) {
 					fd->flags |= FD_FLAGS_POINTSIZE_DIFFERS;
 				}
-			} else {
+			}
+			else {
 				if (sizeof(void *) != 8) {
 					fd->flags |= FD_FLAGS_POINTSIZE_DIFFERS;
 				}
@@ -840,7 +848,8 @@ static int read_file_dna(FileData *fd)
 			}
 
 			return 1;
-		} else if (bhead->code==ENDB)
+		}
+		else if (bhead->code==ENDB)
 			break;
 	}
 
@@ -853,7 +862,8 @@ static int fd_read_from_file(FileData *filedata, void *buffer, unsigned int size
 
 	if (readsize < 0) {
 		readsize = EOF;
-	} else {
+	}
+	else {
 		filedata->seek += readsize;
 	}
 
@@ -866,7 +876,8 @@ static int fd_read_gzip_from_file(FileData *filedata, void *buffer, unsigned int
 
 	if (readsize < 0) {
 		readsize = EOF;
-	} else {
+	}
+	else {
 		filedata->seek += readsize;
 	}
 
@@ -891,14 +902,14 @@ static int fd_read_from_memfile(FileData *filedata, void *buffer, unsigned int s
 	static MemFileChunk *chunk=NULL;
 	unsigned int chunkoffset, readsize, totread;
 	
-	if(size==0) return 0;
+	if (size==0) return 0;
 	
-	if(seek != (unsigned int)filedata->seek) {
+	if (seek != (unsigned int)filedata->seek) {
 		chunk= filedata->memfile->chunks.first;
 		seek= 0;
 		
-		while(chunk) {
-			if(seek + chunk->size > (unsigned) filedata->seek) break;
+		while (chunk) {
+			if (seek + chunk->size > (unsigned) filedata->seek) break;
 			seek+= chunk->size;
 			chunk= chunk->next;
 		}
@@ -906,18 +917,18 @@ static int fd_read_from_memfile(FileData *filedata, void *buffer, unsigned int s
 		seek= filedata->seek;
 	}
 	
-	if(chunk) {
+	if (chunk) {
 		totread= 0;
 
 		do {
 			/* first check if it's on the end if current chunk */
-			if(seek-offset == chunk->size) {
+			if (seek-offset == chunk->size) {
 				offset+= chunk->size;
 				chunk= chunk->next;
 			}
 
 			/* debug, should never happen */
-			if(chunk==NULL) {
+			if (chunk==NULL) {
 				printf("illegal read, chunk zero\n");
 				return 0;
 			}
@@ -928,14 +939,14 @@ static int fd_read_from_memfile(FileData *filedata, void *buffer, unsigned int s
 			/* data can be spread over multiple chunks, so clamp size
 			 * to within this chunk, and then it will read further in
 			 * the next chunk */
-			if(chunkoffset+readsize > chunk->size)
+			if (chunkoffset+readsize > chunk->size)
 				readsize= chunk->size-chunkoffset;
 
 			memcpy((char*)buffer+totread, chunk->buf+chunkoffset, readsize);
 			totread += readsize;
 			filedata->seek += readsize;
 			seek += readsize;
-		} while(totread < size);
+		} while (totread < size);
 		
 		return totread;
 	}
@@ -951,7 +962,7 @@ static FileData *filedata_new(void)
 	fd->gzfiledes = NULL;
 
 		/* XXX, this doesn't need to be done all the time,
-		 * but it keeps us reentrant,  remove once we have
+		 * but it keeps us re-entrant,  remove once we have
 		 * a lib that provides a nice lock. - zr
 		 */
 	fd->memsdna = DNA_sdna_from_data(DNAstr,  DNAlen,  0);
@@ -989,12 +1000,13 @@ FileData *blo_openblenderfile(const char *filepath, ReportList *reports)
 {
 	gzFile gzfile;
 	errno= 0;
-	gzfile= gzopen(filepath, "rb");
+	gzfile= BLI_gzopen(filepath, "rb");
 
 	if (gzfile == (gzFile)Z_NULL) {
 		BKE_reportf(reports, RPT_ERROR, "Unable to open \"%s\": %s.", filepath, errno ? strerror(errno) : "Unknown error reading file");
 		return NULL;
-	} else {
+	}
+	else {
 		FileData *fd = filedata_new();
 		fd->gzfiledes = gzfile;
 		fd->read = fd_read_gzip_from_file;
@@ -1011,7 +1023,8 @@ FileData *blo_openblendermemory(void *mem, int memsize, ReportList *reports)
 	if (!mem || memsize<SIZEOFBLENDERHEADER) {
 		BKE_report(reports, RPT_ERROR, (mem)? "Unable to read": "Unable to open");
 		return NULL;
-	} else {
+	}
+	else {
 		FileData *fd= filedata_new();
 		fd->buffer= mem;
 		fd->buffersize= memsize;
@@ -1027,7 +1040,8 @@ FileData *blo_openblendermemfile(MemFile *memfile, ReportList *reports)
 	if (!memfile) {
 		BKE_report(reports, RPT_ERROR, "Unable to open blend <memory>");
 		return NULL;
-	} else {
+	}
+	else {
 		FileData *fd= filedata_new();
 		fd->memfile= memfile;
 
@@ -1101,8 +1115,8 @@ int BLO_is_a_library(const char *path, char *dir, char *group)
 	
 	strcpy(dir, path);
 	len= strlen(dir);
-	if(len<7) return 0;
-	if( dir[len-1] != '/' && dir[len-1] != '\\') return 0;
+	if (len<7) return 0;
+	if ( dir[len-1] != '/' && dir[len-1] != '\\') return 0;
 	
 	group[0]= 0;
 	dir[len-1]= 0;
@@ -1110,9 +1124,9 @@ int BLO_is_a_library(const char *path, char *dir, char *group)
 	/* Find the last slash */
 	fd= BLI_last_slash(dir);
 
-	if(fd==NULL) return 0;
+	if (fd==NULL) return 0;
 	*fd= 0;
-	if(BLO_has_bfile_extension(fd+1)) {
+	if (BLO_has_bfile_extension(fd+1)) {
 		/* 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 */
 	}
@@ -1124,7 +1138,7 @@ int BLO_is_a_library(const char *path, char *dir, char *group)
 		if (!fd || !BLO_has_bfile_extension(fd+1)) return 0;
 
 		/* now we know that we are in a blend file and it is safe to 
-		   assume that gp actually points to a group */
+		 * assume that gp actually points to a group */
 		if (strcmp("Screen", gp)!=0)
 			BLI_strncpy(group, gp, GROUP_MAX);
 	}
@@ -1145,14 +1159,14 @@ static void *newglobadr(FileData *fd, void *adr)		/* direct datablocks with glob
 
 static void *newimaadr(FileData *fd, void *adr)		/* used to restore image data after undo */
 {
-	if(fd->imamap && adr)
+	if (fd->imamap && adr)
 		return oldnewmap_lookup_and_inc(fd->imamap, adr);
 	return NULL;
 }
 
 static void *newmclipadr(FileData *fd, void *adr)              /* used to restore movie clip data after undo */
 {
-	if(fd->movieclipmap && adr)
+	if (fd->movieclipmap && adr)
 		return oldnewmap_lookup_and_inc(fd->movieclipmap, adr);
 	return NULL;
 }
@@ -1167,7 +1181,7 @@ static void *newlibadr_us(FileData *fd, void *lib, void *adr)	/* increases user
 {
 	ID *id= newlibadr(fd, lib, adr);
 
-	if(id)
+	if (id)
 		id->us++;
 
 	return id;
@@ -1182,7 +1196,7 @@ static void change_idid_adr_fd(FileData *fd, void *old, void *new)
 		
 		if (old==entry->newp && entry->nr==ID_ID) {
 			entry->newp= new;
-			if(new) entry->nr= GS( ((ID *)new)->name );
+			if (new) entry->nr= GS( ((ID *)new)->name );
 			break;
 		}
 	}
@@ -1192,13 +1206,13 @@ static void change_idid_adr(ListBase *mainlist, FileData *basefd, void *old, voi
 {
 	Main *mainptr;
 	
-	for(mainptr= mainlist->first; mainptr; mainptr= mainptr->next) {
+	for (mainptr= mainlist->first; mainptr; mainptr= mainptr->next) {
 		FileData *fd;
 		
-		if(mainptr->curlib) fd= mainptr->curlib->filedata;
+		if (mainptr->curlib) fd= mainptr->curlib->filedata;
 		else fd= basefd;
 		
-		if(fd) {
+		if (fd) {
 			change_idid_adr_fd(fd, old, new);
 		}
 	}
@@ -1212,8 +1226,8 @@ void blo_clear_proxy_pointers_from_lib(Main *oldmain)
 {
 	Object *ob= oldmain->object.first;
 	
-	for(;ob; ob= ob->id.next)
-		if(ob->id.lib)
+	for (;ob; ob= ob->id.next)
+		if (ob->id.lib)
 			ob->proxy_from= NULL;
 }
 
@@ -1225,20 +1239,20 @@ void blo_make_image_pointer_map(FileData *fd, Main *oldmain)
 	
 	fd->imamap= oldnewmap_new();
 	
-	for(;ima; ima= ima->id.next) {
+	for (;ima; ima= ima->id.next) {
 		Link *ibuf= ima->ibufs.first;
-		for(; ibuf; ibuf= ibuf->next) 
+		for (; ibuf; ibuf= ibuf->next)
 			oldnewmap_insert(fd->imamap, ibuf, ibuf, 0);
-		if(ima->gputexture)
+		if (ima->gputexture)
 			oldnewmap_insert(fd->imamap, ima->gputexture, ima->gputexture, 0);
-		for(a=0; a<IMA_MAX_RENDER_SLOT; a++)
-			if(ima->renders[a])
+		for (a=0; a<IMA_MAX_RENDER_SLOT; a++)
+			if (ima->renders[a])
 				oldnewmap_insert(fd->imamap, ima->renders[a], ima->renders[a], 0);
 	}
-	for(; sce; sce= sce->id.next) {
-		if(sce->nodetree) {
+	for (; sce; sce= sce->id.next) {
+		if (sce->nodetree) {
 			bNode *node;
-			for(node= sce->nodetree->nodes.first; node; node= node->next)
+			for (node= sce->nodetree->nodes.first; node; node= node->next)
 				oldnewmap_insert(fd->imamap, node->preview, node->preview, 0);
 		}
 	}
@@ -1259,27 +1273,27 @@ void blo_end_image_pointer_map(FileData *fd, Main *oldmain)
 			entry->newp= NULL;
 	}
 	
-	for(;ima; ima= ima->id.next) {
+	for (;ima; ima= ima->id.next) {
 		Link *ibuf, *next;
 		
 		/* this mirrors direct_link_image */
-		for(ibuf= ima->ibufs.first; ibuf; ibuf= next) {
+		for (ibuf= ima->ibufs.first; ibuf; ibuf= next) {
 			next= ibuf->next;
-			if(NULL==newimaadr(fd, ibuf)) {	/* so was restored */
+			if (NULL==newimaadr(fd, ibuf)) {	/* so was restored */
 				BLI_remlink(&ima->ibufs, ibuf);
 				ima->bindcode= 0;
 				ima->gputexture= NULL;
 			}
 		}
-		for(i=0; i<IMA_MAX_RENDER_SLOT; i++)
+		for (i=0; i<IMA_MAX_RENDER_SLOT; i++)
 			ima->renders[i]= newimaadr(fd, ima->renders[i]);
 
 		ima->gputexture= newimaadr(fd, ima->gputexture);
 	}
-	for(; sce; sce= sce->id.next) {
-		if(sce->nodetree) {
+	for (; sce; sce= sce->id.next) {
+		if (sce->nodetree) {
 			bNode *node;
-			for(node= sce->nodetree->nodes.first; node; node= node->next)
+			for (node= sce->nodetree->nodes.first; node; node= node->next)
 				node->preview= newimaadr(fd, node->preview);
 		}
 	}
@@ -1292,19 +1306,19 @@ void blo_make_movieclip_pointer_map(FileData *fd, Main *oldmain)
 
 	fd->movieclipmap= oldnewmap_new();
 
-	for(;clip; clip= clip->id.next) {
-		if(clip->cache)
+	for (;clip; clip= clip->id.next) {
+		if (clip->cache)
 			oldnewmap_insert(fd->movieclipmap, clip->cache, clip->cache, 0);
 
-		if(clip->tracking.camera.intrinsics)
+		if (clip->tracking.camera.intrinsics)
 			oldnewmap_insert(fd->movieclipmap, clip->tracking.camera.intrinsics, clip->tracking.camera.intrinsics, 0);
 	}
 
-	for(; sce; sce= sce->id.next) {
-		if(sce->nodetree) {
+	for (; sce; sce= sce->id.next) {
+		if (sce->nodetree) {
 			bNode *node;
-			for(node= sce->nodetree->nodes.first; node; node= node->next)
-				if(node->type==CMP_NODE_MOVIEDISTORTION)
+			for (node= sce->nodetree->nodes.first; node; node= node->next)
+				if (node->type==CMP_NODE_MOVIEDISTORTION)
 					oldnewmap_insert(fd->movieclipmap, node->storage, node->storage, 0);
 		}
 	}
@@ -1325,16 +1339,16 @@ void blo_end_movieclip_pointer_map(FileData *fd, Main *oldmain)
 				entry->newp= NULL;
 	}
 
-	for(;clip; clip= clip->id.next) {
+	for (;clip; clip= clip->id.next) {
 		clip->cache= newmclipadr(fd, clip->cache);
 		clip->tracking.camera.intrinsics= newmclipadr(fd, clip->tracking.camera.intrinsics);
 	}
 
-	for(; sce; sce= sce->id.next) {
-		if(sce->nodetree) {
+	for (; sce; sce= sce->id.next) {
+		if (sce->nodetree) {
 			bNode *node;
-			for(node= sce->nodetree->nodes.first; node; node= node->next)
-				if(node->type==CMP_NODE_MOVIEDISTORTION)
+			for (node= sce->nodetree->nodes.first; node; node= node->next)
+				if (node->type==CMP_NODE_MOVIEDISTORTION)
 					node->storage= newmclipadr(fd, node->storage);
 		}
 	}
@@ -1347,11 +1361,11 @@ void blo_add_library_pointer_map(ListBase *mainlist, FileData *fd)
 	Main *ptr= mainlist->first;
 	ListBase *lbarray[MAX_LIBARRAY];
 	
-	for(ptr= ptr->next; ptr; ptr= ptr->next) {
+	for (ptr= ptr->next; ptr; ptr= ptr->next) {
 		int i= set_listbasepointers(ptr, lbarray);
-		while(i--) {
+		while (i--) {
 			ID *id;
-			for(id= lbarray[i]->first; id; id= id->next)
+			for (id= lbarray[i]->first; id; id= id->next)
 				oldnewmap_insert(fd->libmap, id, id, GS(id->name));
 		}
 	}
@@ -1370,7 +1384,7 @@ static void switch_endian_structs(struct SDNA *filesdna, BHead *bhead)
 	blocksize= filesdna->typelens[ filesdna->structs[bhead->SDNAnr][0] ];
 
 	nblocks= bhead->nr;
-	while(nblocks--) {
+	while (nblocks--) {
 		DNA_struct_switch_endian(filesdna, bhead->SDNAnr, data);
 
 		data+= blocksize;
@@ -1387,9 +1401,10 @@ static void *read_struct(FileData *fd, BHead *bh, const char *blockname)
 			switch_endian_structs(fd->filesdna, bh);
 
 		if (fd->compflags[bh->SDNAnr]) {	/* flag==0: doesn't exist anymore */
-			if(fd->compflags[bh->SDNAnr]==2) {
+			if (fd->compflags[bh->SDNAnr]==2) {
 				temp= DNA_struct_reconstruct(fd->memsdna, fd->filesdna, fd->compflags, bh->SDNAnr, bh->nr, (bh+1));
-			} else {
+			}
+			else {
 				temp= MEM_mallocN(bh->len, blockname);
 				memcpy(temp, (bh+1), bh->len);
 			}
@@ -1403,12 +1418,12 @@ static void link_list(FileData *fd, ListBase *lb)		/* only direct data */
 {
 	Link *ln, *prev;
 
-	if(lb->first==NULL) return;
+	if (lb->first==NULL) return;
 
 	lb->first= newdataadr(fd, lb->first);
 	ln= lb->first;
 	prev= NULL;
-	while(ln) {
+	while (ln) {
 		ln->next= newdataadr(fd, ln->next);
 		ln->prev= prev;
 		prev= ln;
@@ -1422,18 +1437,18 @@ static void link_glob_list(FileData *fd, ListBase *lb)		/* for glob data */
 	Link *ln, *prev;
 	void *poin;
 
-	if(lb->first==NULL) return;
+	if (lb->first==NULL) return;
 	poin= newdataadr(fd, lb->first);
-	if(lb->first) {
+	if (lb->first) {
 		oldnewmap_insert(fd->globmap, lb->first, poin, 0);
 	}
 	lb->first= poin;
 
 	ln= lb->first;
 	prev= NULL;
-	while(ln) {
+	while (ln) {
 		poin= newdataadr(fd, ln->next);
-		if(ln->next) {
+		if (ln->next) {
 			oldnewmap_insert(fd->globmap, ln->next, poin, 0);
 		}
 		ln->next= poin;
@@ -1458,15 +1473,15 @@ static void test_pointer_array(FileData *fd, void **mat)
 		 * the old dna format to a pointer array in
 		 * the new dna format.
 		 */
-	if(*mat) {
+	if (*mat) {
 		len= MEM_allocN_len(*mat)/fd->filesdna->pointerlen;
 
-		if(fd->filesdna->pointerlen==8 && fd->memsdna->pointerlen==4) {
+		if (fd->filesdna->pointerlen==8 && fd->memsdna->pointerlen==4) {
 			ipoin=imat= MEM_mallocN( len*4, "newmatar");
 			lpoin= *mat;
 
-			while(len-- > 0) {
-				if((fd->flags & FD_FLAGS_SWITCH_ENDIAN))
+			while (len-- > 0) {
+				if ((fd->flags & FD_FLAGS_SWITCH_ENDIAN))
 					SWITCH_LONGINT(*lpoin);
 				*ipoin= (int) ((*lpoin) >> 3);
 				ipoin++;
@@ -1476,11 +1491,11 @@ static void test_pointer_array(FileData *fd, void **mat)
 			*mat= imat;
 		}
 
-		if(fd->filesdna->pointerlen==4 && fd->memsdna->pointerlen==8) {
+		if (fd->filesdna->pointerlen==4 && fd->memsdna->pointerlen==8) {
 			lpoin=lmat= MEM_mallocN( len*8, "newmatar");
 			ipoin= *mat;
 
-			while(len-- > 0) {
+			while (len-- > 0) {
 				*lpoin= *ipoin;
 				ipoin++;
 				lpoin++;
@@ -1508,14 +1523,14 @@ static void IDP_DirectLinkIDPArray(IDProperty *prop, int switch_endian, FileData
 	array= (IDProperty*) prop->data.pointer;
 	
 	/* note!, idp-arrays didn't exist in 2.4x, so the pointer will be cleared
-	 * theres not really anything we can do to correct this, at least dont crash */
-	if(array==NULL) {
+	 * theres not really anything we can do to correct this, at least don't crash */
+	if (array==NULL) {
 		prop->len= 0;
 		prop->totallen= 0;
 	}
 	
 
-	for(i=0; i<prop->len; i++)
+	for (i=0; i<prop->len; i++)
 		IDP_DirectLinkProperty(&array[i], switch_endian, fd);
 }
 
@@ -1528,14 +1543,14 @@ static void IDP_DirectLinkArray(IDProperty *prop, int switch_endian, FileData *f
 	prop->totallen = prop->len;
 	prop->data.pointer = newdataadr(fd, prop->data.pointer);
 
-	if(prop->subtype == IDP_GROUP) {
+	if (prop->subtype == IDP_GROUP) {
 		test_pointer_array(fd, prop->data.pointer);
 		array= prop->data.pointer;
 
-		for(i=0; i<prop->len; i++)
+		for (i=0; i<prop->len; i++)
 			IDP_DirectLinkProperty(array[i], switch_endian, fd);
 	}
-	else if(prop->subtype == IDP_DOUBLE) {
+	else if (prop->subtype == IDP_DOUBLE) {
 		if (switch_endian) {
 			for (i=0; i<prop->len; i++) {
 				SWITCH_LONGINT(((double*)prop->data.pointer)[i]);
@@ -1591,7 +1606,7 @@ static void IDP_DirectLinkProperty(IDProperty *prop, int switch_endian, FileData
 			 * in the same field as int val; val2 in the
 			 * IDPropertyData struct, they have to deal with
 			 * endianness specifically
-
+			 *
 			 * in theory, val and val2 would've already been swapped
 			 * if switch_endian is true, so we have to first unswap
 			 * them then reswap them as a single 64-bit entity.
@@ -1622,7 +1637,7 @@ static void direct_link_curvemapping(FileData *fd, CurveMapping *cumap)
 	/* flag seems to be able to hang? Maybe old files... not bad to clear anyway */
 	cumap->flag &= ~CUMA_PREMULLED;
 	
-	for(a=0; a<CM_TOT; a++) {
+	for (a=0; a<CM_TOT; a++) {
 		cumap->cm[a].curve= newdataadr(fd, cumap->cm[a].curve);
 		cumap->cm[a].table= NULL;
 		cumap->cm[a].premultable= NULL;
@@ -1636,8 +1651,8 @@ static void lib_link_brush(FileData *fd, Main *main)
 	Brush *brush;
 	
 	/* only link ID pointers */
-	for(brush= main->brush.first; brush; brush= brush->id.next) {
-		if(brush->id.flag & LIB_NEEDLINK) {
+	for (brush= main->brush.first; brush; brush= brush->id.next) {
+		if (brush->id.flag & LIB_NEEDLINK) {
 			brush->id.flag -= LIB_NEEDLINK;
 
 			brush->mtex.tex= newlibadr_us(fd, brush->id.lib, brush->mtex.tex);
@@ -1652,7 +1667,7 @@ static void direct_link_brush(FileData *fd, Brush *brush)
 
 	/* fallof curve */
 	brush->curve= newdataadr(fd, brush->curve);
-	if(brush->curve)
+	if (brush->curve)
 		direct_link_curvemapping(fd, brush->curve);
 	else
 		brush_curve_preset(brush, CURVE_PRESET_SHARP);
@@ -1664,7 +1679,7 @@ static void direct_link_brush(FileData *fd, Brush *brush)
 static void direct_link_script(FileData *UNUSED(fd), Script *script)
 {
 	script->id.us = 1;
-	SCRIPT_SET_NULL(script)
+	SCRIPT_SET_NULL(script);
 }
 
 
@@ -1709,11 +1724,11 @@ static void lib_link_ipo(FileData *fd, Main *main)
 	Ipo *ipo;
 
 	ipo= main->ipo.first;
-	while(ipo) {
-		if(ipo->id.flag & LIB_NEEDLINK) {
+	while (ipo) {
+		if (ipo->id.flag & LIB_NEEDLINK) {
 			IpoCurve *icu;
-			for(icu= ipo->curve.first; icu; icu= icu->next) {
-				if(icu->driver)
+			for (icu= ipo->curve.first; icu; icu= icu->next) {
+				if (icu->driver)
 					icu->driver->ob= newlibadr(fd, ipo->id.lib, icu->driver->ob);
 			}
 			ipo->id.flag -= LIB_NEEDLINK;
@@ -1729,7 +1744,7 @@ static void direct_link_ipo(FileData *fd, Ipo *ipo)
 
 	link_list(fd, &(ipo->curve));
 	icu= ipo->curve.first;
-	while(icu) {
+	while (icu) {
 		icu->bezt= newdataadr(fd, icu->bezt);
 		icu->bp= newdataadr(fd, icu->bp);
 		icu->driver= newdataadr(fd, icu->driver);
@@ -1743,11 +1758,11 @@ static void lib_link_nlastrips(FileData *fd, ID *id, ListBase *striplist)
 	bActionStrip *strip;
 	bActionModifier *amod;
 	
-	for (strip=striplist->first; strip; strip=strip->next){
+	for (strip=striplist->first; strip; strip=strip->next) {
 		strip->object = newlibadr(fd, id->lib, strip->object);
 		strip->act = newlibadr_us(fd, id->lib, strip->act);
 		strip->ipo = newlibadr(fd, id->lib, strip->ipo);
-		for(amod= strip->modifiers.first; amod; amod= amod->next)
+		for (amod= strip->modifiers.first; amod; amod= amod->next)
 			amod->ob= newlibadr(fd, id->lib, amod->ob);
 	}
 }
@@ -1759,7 +1774,7 @@ static void direct_link_nlastrips(FileData *fd, ListBase *strips)
 	
 	link_list(fd, strips);
 	
-	for(strip= strips->first; strip; strip= strip->next)
+	for (strip= strips->first; strip; strip= strip->next)
 		link_list(fd, &strip->modifiers);
 }
 
@@ -1768,7 +1783,7 @@ static void lib_link_constraint_channels(FileData *fd, ID *id, ListBase *chanbas
 {
 	bConstraintChannel *chan;
 
-	for (chan=chanbase->first; chan; chan=chan->next){
+	for (chan=chanbase->first; chan; chan=chan->next) {
 		chan->ipo = newlibadr_us(fd, id->lib, chan->ipo);
 	}
 }
@@ -1843,9 +1858,9 @@ static void direct_link_fmodifiers(FileData *fd, ListBase *list)
 				
 				data->coefficients= newdataadr(fd, data->coefficients);
 
-				if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
+				if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
 					unsigned int a;
-					for(a = 0; a < data->arraysize; a++)
+					for (a = 0; a < data->arraysize; a++)
 						SWITCH_INT(data->coefficients[a]);
 				}
 			}
@@ -2134,11 +2149,11 @@ static void lib_link_ntree(FileData *fd, ID *id, bNodeTree *ntree)
 {
 	bNode *node;
 	
-	if(ntree->adt) lib_link_animdata(fd, &ntree->id, ntree->adt);
+	if (ntree->adt) lib_link_animdata(fd, &ntree->id, ntree->adt);
 	
 	ntree->gpd= newlibadr_us(fd, id->lib, ntree->gpd);
 	
-	for(node= ntree->nodes.first; node; node= node->next)
+	for (node= ntree->nodes.first; node; node= node->next)
 		node->id= newlibadr_us(fd, id->lib, node->id);
 }
 
@@ -2148,8 +2163,8 @@ static void lib_link_nodetree(FileData *fd, Main *main)
 	bNodeTree *ntree;
 	
 	/* only link ID pointers */
-	for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next) {
-		if(ntree->id.flag & LIB_NEEDLINK) {
+	for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next) {
+		if (ntree->id.flag & LIB_NEEDLINK) {
 			ntree->id.flag -= LIB_NEEDLINK;
 			lib_link_ntree(fd, &ntree->id, ntree);
 		}
@@ -2275,17 +2290,19 @@ static void lib_nodetree_do_versions_update_cb(void *UNUSED(data), ID *UNUSED(id
 
 /* verify types for nodes and groups, all data has to be read */
 /* open = 0: appending/linking, open = 1: open new file (need to clean out dynamic
-* typedefs*/
+ * typedefs */
 static void lib_verify_nodetree(Main *main, int UNUSED(open))
 {
 	bNodeTree *ntree;
 	int i;
 	bNodeTreeType *ntreetype;
 
-	/* this crashes blender on undo/redo
-		if(open==1) {
+	/* this crashes blender on undo/redo */
+#if 0
+		if (open==1) {
 			reinit_nodesystem();
-		}*/
+		}
+#endif
 	
 	/* set node->typeinfo pointers */
 	for (i=0; i < NUM_NTREE_TYPES; ++i) {
@@ -2293,7 +2310,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
 		if (ntreetype && ntreetype->foreach_nodetree)
 			ntreetype->foreach_nodetree(main, NULL, lib_nodetree_init_types_cb);
 	}
-	for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
+	for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
 		lib_nodetree_init_types_cb(NULL, NULL, ntree);
 	
 	{
@@ -2303,7 +2320,7 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
 		 * we have set the NTREE_DO_VERSIONS flag, so at this point we can do the
 		 * actual group node updates.
 		 */
-		for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next) {
+		for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next) {
 			if (ntree->flag & NTREE_DO_VERSIONS_GROUP_EXPOSE) {
 				/* this adds copies and links from all unlinked internal sockets to group inputs/outputs. */
 				node_group_expose_all_sockets(ntree);
@@ -2319,18 +2336,18 @@ static void lib_verify_nodetree(Main *main, int UNUSED(open))
 			}
 		}
 		
-		for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
+		for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
 			ntree->flag &= ~NTREE_DO_VERSIONS_GROUP_EXPOSE;
 	}
 	
 	/* verify all group user nodes */
-	for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next) {
+	for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next) {
 		ntreeVerifyNodes(main, &ntree->id);
 	}
 	
 	/* make update calls where necessary */
 	{
-		for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
+		for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
 			if (ntree->update)
 				ntreeUpdateTree(ntree);
 
@@ -2366,8 +2383,8 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
 	direct_link_animdata(fd, ntree->adt);
 	
 	link_list(fd, &ntree->nodes);
-	for(node= ntree->nodes.first; node; node= node->next) {
-		if(node->type == NODE_DYNAMIC) {
+	for (node= ntree->nodes.first; node; node= node->next) {
+		if (node->type == NODE_DYNAMIC) {
 			node->custom1= 0;
 			node->custom1= BSET(node->custom1, NODE_DYNAMIC_LOADED);
 		}
@@ -2377,25 +2394,26 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
 		link_list(fd, &node->inputs);
 		link_list(fd, &node->outputs);
 		
-		if(node->type == CMP_NODE_MOVIEDISTORTION) {
+		if (node->type == CMP_NODE_MOVIEDISTORTION) {
 			node->storage= newmclipadr(fd, node->storage);
-		} else
+		}
+		else
 			node->storage= newdataadr(fd, node->storage);
 
-		if(node->storage) {
+		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))
+			if (ntree->type==NTREE_SHADER && (node->type==SH_NODE_CURVE_VEC || node->type==SH_NODE_CURVE_RGB))
 				direct_link_curvemapping(fd, node->storage);
-			else if(ntree->type==NTREE_COMPOSIT) {
-				if( ELEM4(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT))
+			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);
-				else if(ELEM3(node->type, CMP_NODE_IMAGE, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
+				else if (ELEM3(node->type, CMP_NODE_IMAGE, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
 					((ImageUser *)node->storage)->ok= 1;
 			}
-			else if( ntree->type==NTREE_TEXTURE) {
-				if(node->type==TEX_NODE_CURVE_RGB || node->type==TEX_NODE_CURVE_TIME)
+			else if ( ntree->type==NTREE_TEXTURE) {
+				if (node->type==TEX_NODE_CURVE_RGB || node->type==TEX_NODE_CURVE_TIME)
 					direct_link_curvemapping(fd, node->storage);
-				else if(node->type==TEX_NODE_IMAGE)
+				else if (node->type==TEX_NODE_IMAGE)
 					((ImageUser *)node->storage)->ok= 1;
 			}
 		}
@@ -2407,22 +2425,22 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
 	link_list(fd, &ntree->outputs);
 	
 	/* and we connect the rest */
-	for(node= ntree->nodes.first; node; node= node->next) {
+	for (node= ntree->nodes.first; node; node= node->next) {
 		node->parent = newdataadr(fd, node->parent);
 		node->preview= newimaadr(fd, node->preview);
 		node->lasty= 0;
 		
-		for(sock= node->inputs.first; sock; sock= sock->next)
+		for (sock= node->inputs.first; sock; sock= sock->next)
 			direct_link_node_socket(fd, sock);
-		for(sock= node->outputs.first; sock; sock= sock->next)
+		for (sock= node->outputs.first; sock; sock= sock->next)
 			direct_link_node_socket(fd, sock);
 	}
-	for(sock= ntree->inputs.first; sock; sock= sock->next)
+	for (sock= ntree->inputs.first; sock; sock= sock->next)
 		direct_link_node_socket(fd, sock);
-	for(sock= ntree->outputs.first; sock; sock= sock->next)
+	for (sock= ntree->outputs.first; sock; sock= sock->next)
 		direct_link_node_socket(fd, sock);
 	
-	for(link= ntree->links.first; link; link= link->next) {
+	for (link= ntree->links.first; link; link= link->next) {
 		link->fromnode= newdataadr(fd, link->fromnode);
 		link->tonode= newdataadr(fd, link->tonode);
 		link->fromsock= newdataadr(fd, link->fromsock);
@@ -2455,7 +2473,7 @@ static void lib_link_constraints(FileData *fd, ID *id, ListBase *conlist)
 	for (con = conlist->first; con; con=con->next) {
 		/* patch for error introduced by changing constraints (dunno how) */
 		/* if con->data type changes, dna cannot resolve the pointer! (ton) */
-		if(con->data==NULL) {
+		if (con->data==NULL) {
 			con->type= CONSTRAINT_TYPE_NULL;
 		}
 		/* own ipo, all constraints have it */
@@ -2504,7 +2522,7 @@ static void direct_link_constraints(FileData *fd, ListBase *lb)
 			case CONSTRAINT_TYPE_CHILDOF:
 			{
 				/* XXX version patch, in older code this flag wasn't always set, and is inherent to type */
-				if(con->ownspace == CONSTRAINT_SPACE_POSE)
+				if (con->ownspace == CONSTRAINT_SPACE_POSE)
 					con->flag |= CONSTRAINT_SPACEONCE;
 			}
 				break;
@@ -2525,13 +2543,13 @@ static void lib_link_pose(FileData *fd, Object *ob, bPose *pose)
 	/* always rebuild to match proxy or lib changes */
 	rebuild= ob->proxy || (ob->id.lib==NULL && arm->id.lib);
 
-	if(ob->proxy) {
+	if (ob->proxy) {
 		/* sync proxy layer */
-		if(pose->proxy_layer)
+		if (pose->proxy_layer)
 			arm->layer = pose->proxy_layer;
 		
 		/* sync proxy active bone */
-		if(pose->proxy_act_bone[0]) {
+		if (pose->proxy_act_bone[0]) {
 			Bone *bone = get_named_bone(arm, pose->proxy_act_bone);
 			if (bone)
 				arm->act_bone = bone;
@@ -2545,16 +2563,16 @@ static void lib_link_pose(FileData *fd, Object *ob, bPose *pose)
 		pchan->bone= get_named_bone(arm, pchan->name);
 		
 		pchan->custom= newlibadr_us(fd, arm->id.lib, pchan->custom);
-		if(pchan->bone==NULL)
+		if (pchan->bone==NULL)
 			rebuild= 1;
-		else if(ob->id.lib==NULL && arm->id.lib) {
+		else if (ob->id.lib==NULL && arm->id.lib) {
 			/* local pose selection copied to armature, bit hackish */
 			pchan->bone->flag &= ~BONE_SELECTED;
 			pchan->bone->flag |= pchan->selectflag;
 		}
 	}
 	
-	if(rebuild) {
+	if (rebuild) {
 		ob->recalc= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
 		pose->flag |= POSE_RECALC;
 	}
@@ -2566,8 +2584,8 @@ static void lib_link_armature(FileData *fd, Main *main)
 
 	arm= main->armature.first;
 
-	while(arm) {
-		if(arm->id.flag & LIB_NEEDLINK) {
+	while (arm) {
+		if (arm->id.flag & LIB_NEEDLINK) {
 			if (arm->adt) lib_link_animdata(fd, &arm->id, arm->adt);
 			arm->id.flag -= LIB_NEEDLINK;
 		}
@@ -2581,14 +2599,14 @@ static void direct_link_bones(FileData *fd, Bone* bone)
 
 	bone->parent= newdataadr(fd, bone->parent);
 	bone->prop= newdataadr(fd, bone->prop);
-	if(bone->prop)
+	if (bone->prop)
 		IDP_DirectLinkProperty(bone->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
 		
 	bone->flag &= ~BONE_DRAW_ACTIVE;
 
 	link_list(fd, &bone->childbase);
 
-	for(child=bone->childbase.first; child; child=child->next)
+	for (child=bone->childbase.first; child; child=child->next)
 		direct_link_bones(fd, child);
 }
 
@@ -2620,8 +2638,8 @@ static void lib_link_camera(FileData *fd, Main *main)
 	Camera *ca;
 
 	ca= main->camera.first;
-	while(ca) {
-		if(ca->id.flag & LIB_NEEDLINK) {
+	while (ca) {
+		if (ca->id.flag & LIB_NEEDLINK) {
 			if (ca->adt) lib_link_animdata(fd, &ca->id, ca->adt);
 			
 			ca->ipo= newlibadr_us(fd, ca->id.lib, ca->ipo); // XXX depreceated - old animation system
@@ -2650,13 +2668,13 @@ static void lib_link_lamp(FileData *fd, Main *main)
 	int a;
 
 	la= main->lamp.first;
-	while(la) {
-		if(la->id.flag & LIB_NEEDLINK) {
+	while (la) {
+		if (la->id.flag & LIB_NEEDLINK) {
 			if (la->adt) lib_link_animdata(fd, &la->id, la->adt);
 			
-			for(a=0; a<MAX_MTEX; a++) {
+			for (a=0; a<MAX_MTEX; a++) {
 				mtex= la->mtex[a];
-				if(mtex) {
+				if (mtex) {
 					mtex->tex= newlibadr_us(fd, la->id.lib, mtex->tex);
 					mtex->object= newlibadr(fd, la->id.lib, mtex->object);
 				}
@@ -2664,7 +2682,7 @@ static void lib_link_lamp(FileData *fd, Main *main)
 			
 			la->ipo= newlibadr_us(fd, la->id.lib, la->ipo); // XXX depreceated - old animation system
 
-			if(la->nodetree)
+			if (la->nodetree)
 				lib_link_ntree(fd, &la->id, la->nodetree);
 			
 			la->id.flag -= LIB_NEEDLINK;
@@ -2680,16 +2698,16 @@ static void direct_link_lamp(FileData *fd, Lamp *la)
 	la->adt= newdataadr(fd, la->adt);
 	direct_link_animdata(fd, la->adt);
 
-	for(a=0; a<MAX_MTEX; a++) {
+	for (a=0; a<MAX_MTEX; a++) {
 		la->mtex[a]= newdataadr(fd, la->mtex[a]);
 	}
 	
 	la->curfalloff= newdataadr(fd, la->curfalloff);
-	if(la->curfalloff)
+	if (la->curfalloff)
 		direct_link_curvemapping(fd, la->curfalloff);
 
 	la->nodetree= newdataadr(fd, la->nodetree);
-	if(la->nodetree)
+	if (la->nodetree)
 		direct_link_nodetree(fd, la->nodetree);
 	
 	la->preview = direct_link_preview_image(fd, la->preview);
@@ -2702,9 +2720,19 @@ static void lib_link_key(FileData *fd, Main *main)
 	Key *key;
 
 	key= main->key.first;
-	while(key) {
-		if(key->id.flag & LIB_NEEDLINK) {
-			if(key->adt) lib_link_animdata(fd, &key->id, key->adt);
+	while (key) {
+		/*check if we need to generate unique ids for the shapekeys*/
+		if (!key->uidgen) {
+			KeyBlock *block;
+
+			key->uidgen = 1;
+			for (block=key->block.first; block; block=block->next) {
+				block->uid = key->uidgen++;
+			}
+		}
+
+		if (key->id.flag & LIB_NEEDLINK) {
+			if (key->adt) lib_link_animdata(fd, &key->id, key->adt);
 			
 			key->ipo= newlibadr_us(fd, key->id.lib, key->ipo); // XXX depreceated - old animation system
 			key->from= newlibadr(fd, key->id.lib, key->from);
@@ -2723,19 +2751,19 @@ static void switch_endian_keyblock(Key *key, KeyBlock *kb)
 	elemsize= key->elemsize;
 	data= kb->data;
 
-	for(a=0; a<kb->totelem; a++) {
+	for (a=0; a<kb->totelem; a++) {
 
 		cp= key->elemstr;
 		poin= data;
 
-		while( cp[0] ) {	/* cp[0]==amount */
+		while ( cp[0] ) {	/* cp[0]==amount */
 
 			switch(cp[1]) {		/* cp[1]= type */
 			case IPO_FLOAT:
 			case IPO_BPOINT:
 			case IPO_BEZTRIPLE:
 				b= cp[0];
-				while(b--) {
+				while (b--) {
 					SWITCH_INT((*poin));
 					poin+= 4;
 				}
@@ -2761,11 +2789,11 @@ static void direct_link_key(FileData *fd, Key *key)
 	key->refkey= newdataadr(fd, key->refkey);
 
 	kb= key->block.first;
-	while(kb) {
+	while (kb) {
 
 		kb->data= newdataadr(fd, kb->data);
 		
-		if(fd->flags & FD_FLAGS_SWITCH_ENDIAN)
+		if (fd->flags & FD_FLAGS_SWITCH_ENDIAN)
 			switch_endian_keyblock(key, kb);
 
 		kb= kb->next;
@@ -2780,11 +2808,11 @@ static void lib_link_mball(FileData *fd, Main *main)
 	int a;
 
 	mb= main->mball.first;
-	while(mb) {
-		if(mb->id.flag & LIB_NEEDLINK) {
+	while (mb) {
+		if (mb->id.flag & LIB_NEEDLINK) {
 			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]);
+			for (a=0; a<mb->totcol; a++) mb->mat[a]= newlibadr_us(fd, mb->id.lib, mb->mat[a]);
 
 			mb->ipo= newlibadr_us(fd, mb->id.lib, mb->ipo); // XXX depreceated - old animation system
 
@@ -2820,21 +2848,21 @@ static void lib_link_world(FileData *fd, Main *main)
 	int a;
 
 	wrld= main->world.first;
-	while(wrld) {
-		if(wrld->id.flag & LIB_NEEDLINK) {
+	while (wrld) {
+		if (wrld->id.flag & LIB_NEEDLINK) {
 			if (wrld->adt) lib_link_animdata(fd, &wrld->id, wrld->adt);
 			
 			wrld->ipo= newlibadr_us(fd, wrld->id.lib, wrld->ipo); // XXX depreceated - old animation system
 			
-			for(a=0; a<MAX_MTEX; a++) {
+			for (a=0; a<MAX_MTEX; a++) {
 				mtex= wrld->mtex[a];
-				if(mtex) {
+				if (mtex) {
 					mtex->tex= newlibadr_us(fd, wrld->id.lib, mtex->tex);
 					mtex->object= newlibadr(fd, wrld->id.lib, mtex->object);
 				}
 			}
 
-			if(wrld->nodetree)
+			if (wrld->nodetree)
 				lib_link_ntree(fd, &wrld->id, wrld->nodetree);
 			
 			wrld->id.flag -= LIB_NEEDLINK;
@@ -2850,12 +2878,12 @@ static void direct_link_world(FileData *fd, World *wrld)
 	wrld->adt= newdataadr(fd, wrld->adt);
 	direct_link_animdata(fd, wrld->adt);
 
-	for(a=0; a<MAX_MTEX; a++) {
+	for (a=0; a<MAX_MTEX; a++) {
 		wrld->mtex[a]= newdataadr(fd, wrld->mtex[a]);
 	}
 
 	wrld->nodetree= newdataadr(fd, wrld->nodetree);
-	if(wrld->nodetree)
+	if (wrld->nodetree)
 		direct_link_nodetree(fd, wrld->nodetree);
 
 	wrld->preview = direct_link_preview_image(fd, wrld->preview);
@@ -2869,8 +2897,8 @@ static void lib_link_vfont(FileData *UNUSED(fd), Main *main)
 	VFont *vf;
 
 	vf= main->vfont.first;
-	while(vf) {
-		if(vf->id.flag & LIB_NEEDLINK) {
+	while (vf) {
+		if (vf->id.flag & LIB_NEEDLINK) {
 			vf->id.flag -= LIB_NEEDLINK;
 		}
 		vf= vf->id.next;
@@ -2890,8 +2918,8 @@ static void lib_link_text(FileData *UNUSED(fd), Main *main)
 	Text *text;
 
 	text= main->text.first;
-	while(text) {
-		if(text->id.flag & LIB_NEEDLINK) {
+	while (text) {
+		if (text->id.flag & LIB_NEEDLINK) {
 			text->id.flag -= LIB_NEEDLINK;
 		}
 		text= text->id.next;
@@ -2910,11 +2938,12 @@ static void direct_link_text(FileData *fd, Text *text)
 
 	text->compiled= NULL;
 
-/*
-	if(text->flags & TXT_ISEXT) {
+#if 0
+	if (text->flags & TXT_ISEXT) {
 		reopen_text(text);
-	} else {
-*/
+		}
+		else {
+#endif
 
 	link_list(fd, &text->lines);
 	link_list(fd, &text->markers);
@@ -2923,7 +2952,7 @@ static void direct_link_text(FileData *fd, Text *text)
 	text->sell= newdataadr(fd, text->sell);
 
 	ln= text->lines.first;
-	while(ln) {
+	while (ln) {
 		ln->line= newdataadr(fd, ln->line);
 		ln->format= NULL;
 		
@@ -2948,7 +2977,7 @@ static void lib_link_image(FileData *fd, Main *main)
 
 	ima= main->image.first;
 	while (ima) {
-		if(ima->id.flag & LIB_NEEDLINK) {
+		if (ima->id.flag & LIB_NEEDLINK) {
 			if (ima->id.properties) IDP_LibLinkProperty(ima->id.properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
 
 			ima->id.flag -= LIB_NEEDLINK;
@@ -2961,12 +2990,12 @@ static void link_ibuf_list(FileData *fd, ListBase *lb)
 {
 	Link *ln, *prev;
 	
-	if(lb->first==NULL) return;
+	if (lb->first==NULL) return;
 	
 	lb->first= newimaadr(fd, lb->first);
 	ln= lb->first;
 	prev= NULL;
-	while(ln) {
+	while (ln) {
 		ln->next= newimaadr(fd, ln->next);
 		ln->prev= prev;
 		prev= ln;
@@ -2978,13 +3007,13 @@ static void link_ibuf_list(FileData *fd, ListBase *lb)
 static void direct_link_image(FileData *fd, Image *ima)
 {
 	/* for undo system, pointers could be restored */
-	if(fd->imamap)
+	if (fd->imamap)
 		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) {
+	if (ima->ibufs.first==NULL) {
 		ima->bindcode= 0;
 		ima->gputexture= NULL;
 	}
@@ -2994,10 +3023,10 @@ static void direct_link_image(FileData *fd, Image *ima)
 	ima->repbind= NULL;
 	
 	/* undo system, try to restore render buffers */
-	if(fd->imamap) {
+	if (fd->imamap) {
 		int a;
 		
-		for(a=0; a<IMA_MAX_RENDER_SLOT; a++)
+		for (a=0; a<IMA_MAX_RENDER_SLOT; a++)
 			ima->renders[a]= newimaadr(fd, ima->renders[a]);
 	}
 	else {
@@ -3019,11 +3048,11 @@ static void lib_link_curve(FileData *fd, Main *main)
 	int a;
 
 	cu= main->curve.first;
-	while(cu) {
-		if(cu->id.flag & LIB_NEEDLINK) {
-			if(cu->adt) lib_link_animdata(fd, &cu->id, cu->adt);
+	while (cu) {
+		if (cu->id.flag & LIB_NEEDLINK) {
+			if (cu->adt) lib_link_animdata(fd, &cu->id, cu->adt);
 
-			for(a=0; a<cu->totcol; a++) cu->mat[a]= newlibadr_us(fd, cu->id.lib, cu->mat[a]);
+			for (a=0; a<cu->totcol; a++) cu->mat[a]= newlibadr_us(fd, cu->id.lib, cu->mat[a]);
 
 			cu->bevobj= newlibadr(fd, cu->id.lib, cu->bevobj);
 			cu->taperobj= newlibadr(fd, cu->id.lib, cu->taperobj);
@@ -3047,15 +3076,15 @@ static void switch_endian_knots(Nurb *nu)
 {
 	int len;
 
-	if(nu->knotsu) {
+	if (nu->knotsu) {
 		len= KNOTSU(nu);
-		while(len--) {
+		while (len--) {
 			SWITCH_INT(nu->knotsu[len]);
 		}
 	}
-	if(nu->knotsv) {
+	if (nu->knotsv) {
 		len= KNOTSV(nu);
-		while(len--) {
+		while (len--) {
 			SWITCH_INT(nu->knotsv[len]);
 		}
 	}
@@ -3075,7 +3104,7 @@ static void direct_link_curve(FileData *fd, Curve *cu)
 	cu->strinfo= newdataadr(fd, cu->strinfo);	
 	cu->tb= newdataadr(fd, cu->tb);
 
-	if(cu->vfont == NULL) link_list(fd, &(cu->nurb));
+	if (cu->vfont == NULL) link_list(fd, &(cu->nurb));
 	else {
 		cu->nurb.first=cu->nurb.last= NULL;
 
@@ -3084,7 +3113,8 @@ static void direct_link_curve(FileData *fd, Curve *cu)
 			memcpy(tb, cu->tb, cu->totbox*sizeof(TextBox));
 			MEM_freeN(cu->tb);
 			cu->tb= tb;			
-		} else {
+		}
+		else {
 			cu->totbox = 1;
 			cu->actbox = 1;
 			cu->tb = tb;
@@ -3101,14 +3131,14 @@ static void direct_link_curve(FileData *fd, Curve *cu)
 	cu->editfont= NULL;
 	
 	nu= cu->nurb.first;
-	while(nu) {
+	while (nu) {
 		nu->bezt= newdataadr(fd, nu->bezt);
 		nu->bp= newdataadr(fd, nu->bp);
 		nu->knotsu= newdataadr(fd, nu->knotsu);
 		nu->knotsv= newdataadr(fd, nu->knotsv);
 		if (cu->vfont == NULL) nu->charidx= nu->mat_nr;
 
-		if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
+		if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
 			switch_endian_knots(nu);
 		}
 
@@ -3124,20 +3154,20 @@ static void lib_link_texture(FileData *fd, Main *main)
 	Tex *tex;
 
 	tex= main->tex.first;
-	while(tex) {
-		if(tex->id.flag & LIB_NEEDLINK) {
-			if(tex->adt) lib_link_animdata(fd, &tex->id, tex->adt);
+	while (tex) {
+		if (tex->id.flag & LIB_NEEDLINK) {
+			if (tex->adt) lib_link_animdata(fd, &tex->id, tex->adt);
 
 			tex->ima= newlibadr_us(fd, tex->id.lib, tex->ima);
 			tex->ipo= newlibadr_us(fd, tex->id.lib, tex->ipo);
-			if(tex->env) tex->env->object= newlibadr(fd, tex->id.lib, tex->env->object);
-			if(tex->pd)
+			if (tex->env) tex->env->object= newlibadr(fd, tex->id.lib, tex->env->object);
+			if (tex->pd)
 				tex->pd->object= newlibadr(fd, tex->id.lib, tex->pd->object);
-			if(tex->vd) tex->vd->object= newlibadr(fd, tex->id.lib, tex->vd->object);
-			if(tex->ot) tex->ot->object= newlibadr(fd, tex->id.lib, tex->ot->object);
+			if (tex->vd) tex->vd->object= newlibadr(fd, tex->id.lib, tex->vd->object);
+			if (tex->ot) tex->ot->object= newlibadr(fd, tex->id.lib, tex->ot->object);
 				
 
-			if(tex->nodetree)
+			if (tex->nodetree)
 				lib_link_ntree(fd, &tex->id, tex->nodetree);
 			
 			tex->id.flag -= LIB_NEEDLINK;
@@ -3152,7 +3182,7 @@ static void direct_link_texture(FileData *fd, Tex *tex)
 	direct_link_animdata(fd, tex->adt);
 	
 	tex->plugin= newdataadr(fd, tex->plugin);
-	if(tex->plugin) {
+	if (tex->plugin) {
 		tex->plugin->handle= NULL;
 		open_plugin_tex(tex->plugin);
 		/* initialize data for this instance, if an initialization
@@ -3163,34 +3193,35 @@ static void direct_link_texture(FileData *fd, Tex *tex)
 	}
 	tex->coba= newdataadr(fd, tex->coba);
 	tex->env= newdataadr(fd, tex->env);
-	if(tex->env) {
+	if (tex->env) {
 		tex->env->ima= NULL;
 		memset(tex->env->cube, 0, 6*sizeof(void *));
 		tex->env->ok= 0;
 	}
 	tex->pd= newdataadr(fd, tex->pd);
-	if(tex->pd) {
+	if (tex->pd) {
 		tex->pd->point_tree = NULL;
 		tex->pd->coba= newdataadr(fd, tex->pd->coba);
 		tex->pd->falloff_curve= newdataadr(fd, tex->pd->falloff_curve);
-		if(tex->pd->falloff_curve) {
+		if (tex->pd->falloff_curve) {
 			direct_link_curvemapping(fd, tex->pd->falloff_curve);
 		}
 	}
 	
 	tex->vd= newdataadr(fd, tex->vd);
-	if(tex->vd) {
+	if (tex->vd) {
 		tex->vd->dataset = NULL;
 		tex->vd->ok = 0;
-	} else {
-		if(tex->type == TEX_VOXELDATA)
+	}
+	else {
+		if (tex->type == TEX_VOXELDATA)
 			tex->vd= MEM_callocN(sizeof(VoxelData), "direct_link_texture VoxelData");
 	}
 	
 	tex->ot= newdataadr(fd, tex->ot);
 	
 	tex->nodetree= newdataadr(fd, tex->nodetree);
-	if(tex->nodetree)
+	if (tex->nodetree)
 		direct_link_nodetree(fd, tex->nodetree);
 	
 	tex->preview = direct_link_preview_image(fd, tex->preview);
@@ -3209,26 +3240,26 @@ static void lib_link_material(FileData *fd, Main *main)
 	int a;
 
 	ma= main->mat.first;
-	while(ma) {
-		if(ma->id.flag & LIB_NEEDLINK) {
-			if(ma->adt) lib_link_animdata(fd, &ma->id, ma->adt);
+	while (ma) {
+		if (ma->id.flag & LIB_NEEDLINK) {
+			if (ma->adt) lib_link_animdata(fd, &ma->id, ma->adt);
 
-			/*Link ID Properties -- and copy this comment EXACTLY for easy finding
-			of library blocks that implement this.*/
+			/* Link ID Properties -- and copy this comment EXACTLY for easy finding
+			 * of library blocks that implement this.*/
 			if (ma->id.properties) IDP_LibLinkProperty(ma->id.properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
 
 			ma->ipo= newlibadr_us(fd, ma->id.lib, ma->ipo);
 			ma->group= newlibadr_us(fd, ma->id.lib, ma->group);
 			
-			for(a=0; a<MAX_MTEX; a++) {
+			for (a=0; a<MAX_MTEX; a++) {
 				mtex= ma->mtex[a];
-				if(mtex) {
+				if (mtex) {
 					mtex->tex= newlibadr_us(fd, ma->id.lib, mtex->tex);
 					mtex->object= newlibadr(fd, ma->id.lib, mtex->object);
 				}
 			}
 			
-			if(ma->nodetree)
+			if (ma->nodetree)
 				lib_link_ntree(fd, &ma->id, ma->nodetree);
 			
 			ma->id.flag -= LIB_NEEDLINK;
@@ -3244,7 +3275,7 @@ static void direct_link_material(FileData *fd, Material *ma)
 	ma->adt= newdataadr(fd, ma->adt);
 	direct_link_animdata(fd, ma->adt);
 	
-	for(a=0; a<MAX_MTEX; a++) {
+	for (a=0; a<MAX_MTEX; a++) {
 		ma->mtex[a]= newdataadr(fd, ma->mtex[a]);
 	}
 
@@ -3252,7 +3283,7 @@ 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_nodetree(fd, ma->nodetree);
 
 	ma->preview = direct_link_preview_image(fd, ma->preview);
@@ -3273,7 +3304,7 @@ static const char *ptcache_data_struct[] = {
 };
 static void direct_link_pointcache(FileData *fd, PointCache *cache)
 {
-	if((cache->flag & PTCACHE_DISK_CACHE)==0) {
+	if ((cache->flag & PTCACHE_DISK_CACHE)==0) {
 		PTCacheMem *pm;
 		PTCacheExtra *extra;
 		int i;
@@ -3282,23 +3313,23 @@ static void direct_link_pointcache(FileData *fd, PointCache *cache)
 
 		pm = cache->mem_cache.first;
 
-		for(; pm; pm=pm->next) {
-			for(i=0; i<BPHYS_TOT_DATA; i++) {
+		for (; pm; pm=pm->next) {
+			for (i=0; i<BPHYS_TOT_DATA; i++) {
 				pm->data[i] = newdataadr(fd, pm->data[i]);
 				
 				/* the cache saves non-struct data without DNA */
-				if(pm->data[i] && ptcache_data_struct[i][0]=='\0' && (fd->flags & FD_FLAGS_SWITCH_ENDIAN)) {
+				if (pm->data[i] && ptcache_data_struct[i][0]=='\0' && (fd->flags & FD_FLAGS_SWITCH_ENDIAN)) {
 					int j, tot= (BKE_ptcache_data_size (i) * pm->totpoint)/4; /* data_size returns bytes */
 					int *poin= pm->data[i];
 					
-					for(j= 0; j<tot; j++)
+					for (j= 0; j<tot; j++)
 						SWITCH_INT(poin[j]);
 				}
 			}
 			
 			link_list(fd, &pm->extradata);
 
-			for(extra=pm->extradata.first; extra; extra=extra->next)
+			for (extra=pm->extradata.first; extra; extra=extra->next)
 				extra->data = newdataadr(fd, extra->data);
 		}
 	}
@@ -3314,12 +3345,12 @@ static void direct_link_pointcache(FileData *fd, PointCache *cache)
 
 static void direct_link_pointcache_list(FileData *fd, ListBase *ptcaches, PointCache **ocache, int force_disk)
 {
-	if(ptcaches->first) {
+	if (ptcaches->first) {
 		PointCache *cache= NULL;
 		link_list(fd, ptcaches);
-		for(cache=ptcaches->first; cache; cache=cache->next) {
+		for (cache=ptcaches->first; cache; cache=cache->next) {
 			direct_link_pointcache(fd, cache);
-			if(force_disk) {
+			if (force_disk) {
 				cache->flag |= PTCACHE_DISK_CACHE;
 				cache->step = 1;
 			}
@@ -3327,11 +3358,11 @@ static void direct_link_pointcache_list(FileData *fd, ListBase *ptcaches, PointC
 
 		*ocache = newdataadr(fd, *ocache);
 	}
-	else if(*ocache) {
+	else if (*ocache) {
 		/* old "single" caches need to be linked too */
 		*ocache = newdataadr(fd, *ocache);
 		direct_link_pointcache(fd, *ocache);
-		if(force_disk) {
+		if (force_disk) {
 			(*ocache)->flag |= PTCACHE_DISK_CACHE;
 			(*ocache)->step = 1;
 		}
@@ -3342,7 +3373,7 @@ static void direct_link_pointcache_list(FileData *fd, ListBase *ptcaches, PointC
 
 static void lib_link_partdeflect(FileData *fd, ID *id, PartDeflect *pd)
 {
-	if(pd && pd->tex)
+	if (pd && pd->tex)
 		pd->tex=newlibadr_us(fd, id->lib, pd->tex);
 }
 
@@ -3354,8 +3385,8 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
 	int a;
 
 	part= main->particle.first;
-	while(part) {
-		if(part->id.flag & LIB_NEEDLINK) {
+	while (part) {
+		if (part->id.flag & LIB_NEEDLINK) {
 			if (part->adt) lib_link_animdata(fd, &part->id, part->adt);
 			part->ipo= newlibadr_us(fd, part->id.lib, part->ipo); // XXX depreceated - old animation system
 			
@@ -3367,37 +3398,37 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
 			lib_link_partdeflect(fd, &part->id, part->pd);
 			lib_link_partdeflect(fd, &part->id, part->pd2);
 
-			if(part->effector_weights)
+			if (part->effector_weights)
 				part->effector_weights->group = newlibadr(fd, part->id.lib, part->effector_weights->group);
 
-			if(part->dupliweights.first && part->dup_group) {
+			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) {
+				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) {
-						if(dw->index > 0) {
+					for (; dw; dw=dw->next) {
+						if (dw->index > 0) {
 							index_ok = 1;
 							break;
 						}
 					}
 				}
 
-				if(index_ok) {
+				if (index_ok) {
 					/* if we have indexes, let's use them */
 					dw = part->dupliweights.first;
-					for(; dw; dw=dw->next) {
+					for (; dw; dw=dw->next) {
 						GroupObject *go = (GroupObject *)BLI_findlink(&part->dup_group->gobject, dw->index);
 						dw->ob = go ? go->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; dw=dw->next)
 						dw->ob = newlibadr(fd, part->id.lib, dw->ob);
 				}
 			}
@@ -3405,12 +3436,12 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
 				part->dupliweights.first = part->dupliweights.last = NULL;
 			}
 
-			if(part->boids) {
+			if (part->boids) {
 				BoidState *state = part->boids->states.first;
 				BoidRule *rule;
-				for(; state; state=state->next) {
+				for (; state; state=state->next) {
 					rule = state->rules.first;
-				for(; rule; rule=rule->next)
+				for (; rule; rule=rule->next)
 					switch(rule->type) {
 						case eBoidRuleType_Goal:
 						case eBoidRuleType_Avoid:
@@ -3429,9 +3460,9 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
 				}
 			}
 			
-			for(a=0; a<MAX_MTEX; a++) {
+			for (a=0; a<MAX_MTEX; a++) {
 				mtex= part->mtex[a];
-				if(mtex) {
+				if (mtex) {
 					mtex->tex = newlibadr_us(fd, part->id.lib, mtex->tex);
 					mtex->object = newlibadr(fd, part->id.lib, mtex->object);
 				}
@@ -3445,7 +3476,7 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
 
 static void direct_link_partdeflect(PartDeflect *pd)
 {
-	if(pd) pd->rng=NULL;
+	if (pd) pd->rng=NULL;
 }
 
 static void direct_link_particlesettings(FileData *fd, ParticleSettings *part)
@@ -3460,7 +3491,7 @@ static void direct_link_particlesettings(FileData *fd, ParticleSettings *part)
 	direct_link_partdeflect(part->pd2);
 
 	part->effector_weights = newdataadr(fd, part->effector_weights);
-	if(!part->effector_weights)
+	if (!part->effector_weights)
 		part->effector_weights = BKE_add_effector_weights(part->eff_group);
 
 	link_list(fd, &part->dupliweights);
@@ -3468,17 +3499,17 @@ static void direct_link_particlesettings(FileData *fd, ParticleSettings *part)
 	part->boids= newdataadr(fd, part->boids);
 	part->fluid= newdataadr(fd, part->fluid);
 
-	if(part->boids) {
+	if (part->boids) {
 		BoidState *state;
 		link_list(fd, &part->boids->states);
 		
-		for(state=part->boids->states.first; state; state=state->next) {
+		for (state=part->boids->states.first; state; state=state->next) {
 			link_list(fd, &state->rules);
 			link_list(fd, &state->conditions);
 			link_list(fd, &state->actions);
 		}
 	}
-	for(a=0; a<MAX_MTEX; a++) {
+	for (a=0; a<MAX_MTEX; a++) {
 		part->mtex[a]= newdataadr(fd, part->mtex[a]);
 	}
 }
@@ -3487,20 +3518,20 @@ static void lib_link_particlesystems(FileData *fd, Object *ob, ID *id, ListBase
 {
 	ParticleSystem *psys, *psysnext;
 
-	for(psys=particles->first; psys; psys=psysnext){
+	for (psys=particles->first; psys; psys=psysnext) {
 		psysnext= psys->next;
 		
 		psys->part = newlibadr_us(fd, id->lib, psys->part);
-		if(psys->part) {
+		if (psys->part) {
 			ParticleTarget *pt = psys->targets.first;
 
-			for(; pt; pt=pt->next)
+			for (; pt; pt=pt->next)
 				pt->ob=newlibadr(fd, id->lib, pt->ob);
 
 			psys->parent= newlibadr_us(fd, id->lib, psys->parent);
 			psys->target_ob = newlibadr(fd, id->lib, psys->target_ob);
 
-			if(psys->clmd) {
+			if (psys->clmd) {
 				/* XXX - from reading existing code this seems correct but intended usage of
 				 * pointcache should /w cloth should be added in 'ParticleSystem' - campbell */
 				psys->clmd->point_cache= psys->pointcache;
@@ -3525,16 +3556,16 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
 	ParticleData *pa;
 	int a;
 
-	for(psys=particles->first; psys; psys=psys->next) {
+	for (psys=particles->first; psys; psys=psys->next) {
 		psys->particles=newdataadr(fd,psys->particles);
 		
-		if(psys->particles && psys->particles->hair){
-			for(a=0,pa=psys->particles; a<psys->totpart; a++, pa++)
+		if (psys->particles && psys->particles->hair) {
+			for (a=0,pa=psys->particles; a<psys->totpart; a++, pa++)
 				pa->hair=newdataadr(fd,pa->hair);
 		}
 		
-		if(psys->particles && psys->particles->keys){
-			for(a=0,pa=psys->particles; a<psys->totpart; a++, pa++) {
+		if (psys->particles && psys->particles->keys) {
+			for (a=0,pa=psys->particles; a<psys->totpart; a++, pa++) {
 				pa->keys= NULL;
 				pa->totkey= 0;
 			}
@@ -3542,14 +3573,14 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
 			psys->flag &= ~PSYS_KEYED;
 		}
 
-		if(psys->particles && psys->particles->boid) {
+		if (psys->particles && psys->particles->boid) {
 			pa = psys->particles;
 			pa->boid = newdataadr(fd, pa->boid);
-			for(a=1,pa++; a<psys->totpart; a++, pa++)
+			for (a=1,pa++; a<psys->totpart; a++, pa++)
 				pa->boid = (pa-1)->boid + 1;
 		}
-		else if(psys->particles) {
-			for(a=0,pa=psys->particles; a<psys->totpart; a++, pa++)
+		else if (psys->particles) {
+			for (a=0,pa=psys->particles; a<psys->totpart; a++, pa++)
 				pa->boid = NULL;
 		}
 
@@ -3572,7 +3603,7 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
 		
 		direct_link_pointcache_list(fd, &psys->ptcaches, &psys->pointcache, 0);
 
-		if(psys->clmd) {
+		if (psys->clmd) {
 			psys->clmd = newdataadr(fd, psys->clmd);
 			psys->clmd->clothObject = NULL;
 			
@@ -3580,8 +3611,8 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
 			psys->clmd->sim_parms->effector_weights = NULL;
 			psys->clmd->coll_parms= newdataadr(fd, psys->clmd->coll_parms);
 			
-			if(psys->clmd->sim_parms) {
-				if(psys->clmd->sim_parms->presets > 10)
+			if (psys->clmd->sim_parms) {
+				if (psys->clmd->sim_parms->presets > 10)
 					psys->clmd->sim_parms->presets = 0;
 			}
 
@@ -3608,7 +3639,7 @@ static void lib_link_mtface(FileData *fd, Mesh *me, MTFace *mtface, int totface)
 	 * to each image it used. - z0r */
 	for (i=0; i<totface; i++, 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;
 	}
 }
@@ -3616,32 +3647,52 @@ 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;	
-	for(i=0; i<fdata->totlayer; i++) {
+	for (i=0; i<fdata->totlayer; i++) {
 		CustomDataLayer *layer = &fdata->layers[i];
 		
-		if(layer->type == CD_MTFACE)
+		if (layer->type == CD_MTFACE)
 			lib_link_mtface(fd, me, layer->data, totface);
 	}
 
 }
 
+static void lib_link_customdata_mtpoly(FileData *fd, Mesh *me, CustomData *pdata, int totface)
+{
+	int i;
+
+	for (i=0; i<pdata->totlayer; i++) {
+		CustomDataLayer *layer = &pdata->layers[i];
+		
+		if (layer->type == CD_MTEXPOLY) {
+			MTexPoly *tf= layer->data;
+			int i;
+
+			for (i=0; i<totface; i++, tf++) {
+				tf->tpage= newlibadr(fd, me->id.lib, tf->tpage);
+				if (tf->tpage && tf->tpage->id.us==0)
+					tf->tpage->id.us= 1;
+			}
+		}
+	}
+}
+
 static void lib_link_mesh(FileData *fd, Main *main)
 {
 	Mesh *me;
 
 	me= main->mesh.first;
-	while(me) {
-		if(me->id.flag & LIB_NEEDLINK) {
+	while (me) {
+		if (me->id.flag & LIB_NEEDLINK) {
 			int i;
 
-			/*Link ID Properties -- and copy this comment EXACTLY for easy finding
-			of library blocks that implement this.*/
+			/* Link ID Properties -- and copy this comment EXACTLY for easy finding
+			 * of library blocks that implement this.*/
 			if (me->id.properties) IDP_LibLinkProperty(me->id.properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
 			if (me->adt) lib_link_animdata(fd, &me->id, me->adt);
 
 			/* this check added for python created meshes */
-			if(me->mat) {
-				for(i=0; i<me->totcol; i++) {
+			if (me->mat) {
+				for (i=0; i<me->totcol; i++) {
 					me->mat[i]= newlibadr_us(fd, me->id.lib, me->mat[i]);
 				}
 			}
@@ -3652,10 +3703,39 @@ static void lib_link_mesh(FileData *fd, Main *main)
 			me->texcomesh= newlibadr_us(fd, me->id.lib, me->texcomesh);
 
 			lib_link_customdata_mtface(fd, me, &me->fdata, me->totface);
-			if(me->mr && me->mr->levels.first)
+			lib_link_customdata_mtpoly(fd, me, &me->pdata, me->totpoly);
+			if (me->mr && me->mr->levels.first)
 				lib_link_customdata_mtface(fd, me, &me->mr->fdata,
 							   ((MultiresLevel*)me->mr->levels.first)->totface);
 
+			/*check if we need to convert mfaces to mpolys*/
+			if (me->totface && !me->totpoly) {
+				/* temporarily switch main so that reading from
+				 * external CustomData works */
+				Main *gmain = G.main;
+				G.main = main;
+				
+				BKE_mesh_convert_mfaces_to_mpolys(me);
+
+				G.main = gmain;
+			}
+			
+			/*
+			 * Re-tessellate, even if the polys were just created from tessfaces, this
+			 * is important because it:
+			 *  - fill the CD_POLYINDEX 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
+			 *    waiting until edit mode has been entered/exited, making it easier
+			 *    to recognize problems that would otherwise only show up after edits).
+			 */
+#ifdef USE_TESSFACE_DEFAULT
+			BKE_mesh_tessface_calc(me);
+#else
+			BKE_mesh_tessface_clear(me);
+#endif
+
 			me->id.flag -= LIB_NEEDLINK;
 		}
 		me= me->id.next;
@@ -3674,10 +3754,17 @@ static void direct_link_dverts(FileData *fd, int count, MDeformVert *mdverts)
 	}
 
 	for (i= count; i > 0; i--, mdverts++) {
-		if(mdverts->dw) {
-			mdverts->dw= newdataadr(fd, mdverts->dw);
+		/*convert to vgroup allocation system*/
+		MDeformWeight *dw;
+		if (mdverts->dw && (dw= newdataadr(fd, mdverts->dw))) {
+			const ssize_t dw_len= mdverts->totweight * sizeof(MDeformWeight);
+			void *dw_tmp= MEM_mallocN(dw_len, "direct_link_dverts");
+			memcpy(dw_tmp, dw, dw_len);
+			mdverts->dw= dw_tmp;
+			MEM_freeN(dw);
 		}
-		if (mdverts->dw == NULL) {
+		else {
+			mdverts->dw= NULL;
 			mdverts->totweight= 0;
 		}
 	}
@@ -3685,23 +3772,33 @@ static void direct_link_dverts(FileData *fd, int count, MDeformVert *mdverts)
 
 static void direct_link_mdisps(FileData *fd, int count, MDisps *mdisps, int external)
 {
-	if(mdisps) {
+	if (mdisps) {
 		int i;
 
-		for(i = 0; i < count; ++i) {
+		for (i = 0; i < count; ++i) {
 			mdisps[i].disps = newdataadr(fd, mdisps[i].disps);
+			mdisps[i].hidden = newdataadr(fd, mdisps[i].hidden);
+
+			if (mdisps[i].totdisp && !mdisps[i].level) {
+				/* this calculation is only correct for loop mdisps;
+				 * if loading pre-BMesh face mdisps this will be
+				 * overwritten with the correct value in
+				 * bm_corners_to_loops() */
+				float gridsize = sqrtf(mdisps[i].totdisp);
+				mdisps[i].level = (int)(logf(gridsize - 1.0f) / M_LN2) + 1;
+			}
 
-			if( (fd->flags & FD_FLAGS_SWITCH_ENDIAN) && (mdisps[i].disps) ) {
+			if ( (fd->flags & FD_FLAGS_SWITCH_ENDIAN) && (mdisps[i].disps) ) {
 				/* DNA_struct_switch_endian doesn't do endian swap for (*disps)[] */
 				/* this does swap for data written at write_mdisps() - readfile.c */
 				int x;
 				float *tmpdisps= *mdisps[i].disps;
-				for(x=0;x<mdisps[i].totdisp*3;x++) {
+				for (x=0;x<mdisps[i].totdisp*3;x++) {
 					SWITCH_INT(*tmpdisps);
 					tmpdisps++;
 				}
 			}
-			if(!external && !mdisps[i].disps)
+			if (!external && !mdisps[i].disps)
 				mdisps[i].totdisp = 0;
 		}
 	}
@@ -3713,17 +3810,25 @@ static void direct_link_customdata(FileData *fd, CustomData *data, int count)
 	int i = 0;
 
 	data->layers= newdataadr(fd, data->layers);
+
+	/* 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));
+		return;
+	}
+
 	data->external= newdataadr(fd, data->external);
 
 	while (i < data->totlayer) {
 		CustomDataLayer *layer = &data->layers[i];
 
-		if(layer->flag & CD_FLAG_EXTERNAL)
+		if (layer->flag & CD_FLAG_EXTERNAL)
 			layer->flag &= ~CD_FLAG_IN_MEMORY;
 
 		if (CustomData_verify_versions(data, i)) {
 			layer->data = newdataadr(fd, layer->data);
-			if(layer->type == CD_MDISPS)
+			if (layer->type == CD_MDISPS)
 				direct_link_mdisps(fd, count, layer->data, layer->flag & CD_FLAG_EXTERNAL);
 			i++;
 		}
@@ -3740,24 +3845,32 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
 	mesh->mvert= newdataadr(fd, mesh->mvert);
 	mesh->medge= newdataadr(fd, mesh->medge);
 	mesh->mface= newdataadr(fd, mesh->mface);
+	mesh->mloop= newdataadr(fd, mesh->mloop);
+	mesh->mpoly= newdataadr(fd, mesh->mpoly);
 	mesh->tface= newdataadr(fd, mesh->tface);
 	mesh->mtface= newdataadr(fd, mesh->mtface);
 	mesh->mcol= newdataadr(fd, mesh->mcol);
 	mesh->msticky= newdataadr(fd, mesh->msticky);
 	mesh->dvert= newdataadr(fd, mesh->dvert);
-	
+	mesh->mloopcol= newdataadr(fd, mesh->mloopcol);
+	mesh->mloopuv= newdataadr(fd, mesh->mloopuv);
+	mesh->mtpoly= newdataadr(fd, mesh->mtpoly);
+	mesh->mselect = newdataadr(fd, mesh->mselect);
+
 	/* animdata */
 	mesh->adt= newdataadr(fd, mesh->adt);
 	direct_link_animdata(fd, mesh->adt);
 
 	/* normally direct_link_dverts should be called in direct_link_customdata,
-	   but for backwards compat in do_versions to work we do it here */
+	 * but for backwards compat in do_versions to work we do it here */
 	direct_link_dverts(fd, mesh->totvert, mesh->dvert);
 
 	direct_link_customdata(fd, &mesh->vdata, mesh->totvert);
 	direct_link_customdata(fd, &mesh->edata, mesh->totedge);
 	direct_link_customdata(fd, &mesh->fdata, mesh->totface);
-
+	direct_link_customdata(fd, &mesh->ldata, mesh->totloop);
+	direct_link_customdata(fd, &mesh->pdata, mesh->totpoly);
+	
 
 #ifdef USE_BMESH_FORWARD_COMPAT
 	/* NEVER ENABLE THIS CODE INTO BMESH!
@@ -3789,12 +3902,11 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
 
 
 	mesh->bb= NULL;
-	mesh->mselect = NULL;
-	mesh->edit_mesh= NULL;
+	mesh->edit_btmesh= NULL;
 	
 	/* Multires data */
 	mesh->mr= newdataadr(fd, mesh->mr);
-	if(mesh->mr) {
+	if (mesh->mr) {
 		MultiresLevel *lvl;
 		
 		link_list(fd, &mesh->mr->levels);
@@ -3810,18 +3922,18 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
 		mesh->mr->verts = newdataadr(fd, mesh->mr->verts);
 		
 		/* If mesh has the same number of vertices as the
-		   highest multires level, load the current mesh verts
-		   into multires and discard the old data. Needed
-		   because some saved files either do not have a verts
-		   array, or the verts array contains out-of-date
-		   data. */
-		if(mesh->totvert == ((MultiresLevel*)mesh->mr->levels.last)->totvert) {
-			if(mesh->mr->verts)
+		 * highest multires level, load the current mesh verts
+		 * into multires and discard the old data. Needed
+		 * because some saved files either do not have a verts
+		 * array, or the verts array contains out-of-date
+		 * data. */
+		if (mesh->totvert == ((MultiresLevel*)mesh->mr->levels.last)->totvert) {
+			if (mesh->mr->verts)
 				MEM_freeN(mesh->mr->verts);
 			mesh->mr->verts = MEM_dupallocN(mesh->mvert);
 		}
 			
-		for(; lvl; lvl= lvl->next) {
+		for (; lvl; lvl= lvl->next) {
 			lvl->verts= newdataadr(fd, lvl->verts);
 			lvl->faces= newdataadr(fd, lvl->faces);
 			lvl->edges= newdataadr(fd, lvl->edges);
@@ -3831,14 +3943,14 @@ static void direct_link_mesh(FileData *fd, Mesh *mesh)
 
 	/* if multires is present but has no valid vertex data,
 	 * there's no way to recover it; silently remove multires */
-	if(mesh->mr && !mesh->mr->verts) {
+	if (mesh->mr && !mesh->mr->verts) {
 		multires_free(mesh->mr);
 		mesh->mr = NULL;
 	}
 	
-	if((fd->flags & FD_FLAGS_SWITCH_ENDIAN) && mesh->tface) {
+	if ((fd->flags & FD_FLAGS_SWITCH_ENDIAN) && mesh->tface) {
 		TFace *tf= mesh->tface;
-		unsigned int i;
+		int i;
 
 		for (i=0; i< (mesh->totface); i++, tf++) {
 			SWITCH_INT(tf->col[0]);
@@ -3856,9 +3968,9 @@ static void lib_link_latt(FileData *fd, Main *main)
 	Lattice *lt;
 	
 	lt= main->latt.first;
-	while(lt) {
-		if(lt->id.flag & LIB_NEEDLINK) {
-			if(lt->adt) lib_link_animdata(fd, &lt->id, lt->adt);
+	while (lt) {
+		if (lt->id.flag & LIB_NEEDLINK) {
+			if (lt->adt) lib_link_animdata(fd, &lt->id, lt->adt);
 			
 			lt->ipo= newlibadr_us(fd, lt->id.lib, lt->ipo); // XXX depreceated - old animation system
 			lt->key= newlibadr_us(fd, lt->id.lib, lt->key);
@@ -3892,7 +4004,7 @@ static void lib_link_modifiers__linkModifiers(void *userData, Object *ob,
 
 	*idpoin = newlibadr(fd, ob->id.lib, *idpoin);
 	/* hardcoded bad exception; non-object modifier data gets user count (texture, displace) */
-	if(*idpoin && GS((*idpoin)->name)!=ID_OB)
+	if (*idpoin && GS((*idpoin)->name)!=ID_OB)
 		(*idpoin)->us++;
 }
 static void lib_link_modifiers(FileData *fd, Object *ob)
@@ -3911,8 +4023,8 @@ static void lib_link_object(FileData *fd, Main *main)
 	int warn=0, a;
 
 	ob= main->object.first;
-	while(ob) {
-		if(ob->id.flag & LIB_NEEDLINK) {
+	while (ob) {
+		if (ob->id.flag & LIB_NEEDLINK) {
 			if (ob->id.properties) IDP_LibLinkProperty(ob->id.properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
 			if (ob->adt) lib_link_animdata(fd, &ob->id, ob->adt);
 			
@@ -3927,9 +4039,9 @@ static void lib_link_object(FileData *fd, Main *main)
 			ob->dup_group= newlibadr_us(fd, ob->id.lib, ob->dup_group);
 			
 			ob->proxy= newlibadr_us(fd, ob->id.lib, ob->proxy);
-			if(ob->proxy) {
+			if (ob->proxy) {
 				/* paranoia check, actually a proxy_from pointer should never be written... */
-				if(ob->proxy->id.lib==NULL) {
+				if (ob->proxy->id.lib==NULL) {
 					ob->proxy->proxy_from= NULL;
 					ob->proxy= NULL;
 					
@@ -3950,8 +4062,8 @@ static void lib_link_object(FileData *fd, Main *main)
 			poin= ob->data;
 			ob->data= newlibadr_us(fd, ob->id.lib, ob->data);
 
-			if(ob->data==NULL && poin!=NULL) {
-				if(ob->id.lib)
+			if (ob->data==NULL && poin!=NULL) {
+				if (ob->id.lib)
 					printf("Can't find obdata of %s lib %s\n", ob->id.name+2, ob->id.lib->name);
 				else
 					printf("Object %s lost data.\n", ob->id.name+2);
@@ -3959,20 +4071,20 @@ static void lib_link_object(FileData *fd, Main *main)
 				ob->type= OB_EMPTY;
 				warn= 1;
 
-				if(ob->pose) {
+				if (ob->pose) {
 					free_pose(ob->pose);
 					ob->pose= NULL;
 					ob->mode &= ~OB_MODE_POSE;
 				}
 			}
-			for(a=0; a<ob->totcol; a++) ob->mat[a]= newlibadr_us(fd, ob->id.lib, ob->mat[a]);
+			for (a=0; a<ob->totcol; a++) ob->mat[a]= newlibadr_us(fd, ob->id.lib, ob->mat[a]);
 			
 			/* When the object is local and the data is library its possible
 			 * the material list size gets out of sync. [#22663] */
-			if(ob->data && ob->id.lib != ((ID *)ob->data)->lib) {
+			if (ob->data && ob->id.lib != ((ID *)ob->data)->lib) {
 				short *totcol_data= give_totcolp(ob);
 				/* Only expand so as not to loose any object materials that might be set. */
-				if(totcol_data && *totcol_data > ob->totcol) {
+				if (totcol_data && *totcol_data > ob->totcol) {
 					/* printf("'%s' %d -> %d\n", ob->id.name, ob->totcol, *totcol_data); */
 					resize_object_material(ob, *totcol_data);
 				}
@@ -3993,22 +4105,22 @@ static void lib_link_object(FileData *fd, Main *main)
 			lib_link_nlastrips(fd, &ob->id, &ob->nlastrips);
 // >>> XXX depreceated - old animation system
 
-			for(paf= ob->effect.first; paf; paf= paf->next) {
-				if(paf->type==EFF_PARTICLE) {
+			for (paf= ob->effect.first; paf; paf= paf->next) {
+				if (paf->type==EFF_PARTICLE) {
 					paf->group= newlibadr_us(fd, ob->id.lib, paf->group);
 				}
 			}				
 
 			sens= ob->sensors.first;
-			while(sens) {
-				for(a=0; a<sens->totlinks; a++)
+			while (sens) {
+				for (a=0; a<sens->totlinks; a++)
 					sens->links[a]= newglobadr(fd, sens->links[a]);
 
-				if(sens->type==SENS_TOUCH) {
+				if (sens->type==SENS_TOUCH) {
 					bTouchSensor *ts= sens->data;
 					ts->ma= newlibadr(fd, ob->id.lib, ts->ma);
 				}
-				else if(sens->type==SENS_MESSAGE) {
+				else if (sens->type==SENS_MESSAGE) {
 					bMessageSensor *ms= sens->data;
 					ms->fromObject=
 						newlibadr(fd, ob->id.lib, ms->fromObject);
@@ -4017,11 +4129,11 @@ static void lib_link_object(FileData *fd, Main *main)
 			}
 
 			cont= ob->controllers.first;
-			while(cont) {
-				for(a=0; a<cont->totlinks; a++)
+			while (cont) {
+				for (a=0; a<cont->totlinks; a++)
 					cont->links[a]= newglobadr(fd, cont->links[a]);
 
-				if(cont->type==CONT_PYTHON) {
+				if (cont->type==CONT_PYTHON) {
 					bPythonCont *pc= cont->data;
 					pc->text= newlibadr(fd, ob->id.lib, pc->text);
 				}
@@ -4032,35 +4144,35 @@ static void lib_link_object(FileData *fd, Main *main)
 			}
 
 			act= ob->actuators.first;
-			while(act) {
-				if(act->type==ACT_SOUND) {
+			while (act) {
+				if (act->type==ACT_SOUND) {
 					bSoundActuator *sa= act->data;
 					sa->sound= newlibadr_us(fd, ob->id.lib, sa->sound);
 				}
-				else if(act->type==ACT_GAME) {
+				else if (act->type==ACT_GAME) {
 					/* bGameActuator *ga= act->data; */
 				}
-				else if(act->type==ACT_CAMERA) {
+				else if (act->type==ACT_CAMERA) {
 					bCameraActuator *ca= act->data;
 					ca->ob= newlibadr(fd, ob->id.lib, ca->ob);
 				}
 					/* leave this one, it's obsolete but necessary to read for conversion */
-				else if(act->type==ACT_ADD_OBJECT) {
+				else if (act->type==ACT_ADD_OBJECT) {
 					bAddObjectActuator *eoa= act->data;
-					if(eoa) eoa->ob= newlibadr(fd, ob->id.lib, eoa->ob);
+					if (eoa) eoa->ob= newlibadr(fd, ob->id.lib, eoa->ob);
 				}
-				else if(act->type==ACT_OBJECT) {
+				else if (act->type==ACT_OBJECT) {
 					bObjectActuator *oa= act->data;
-					if(oa==NULL) {
+					if (oa==NULL) {
 						init_actuator(act);
 					}
 					else {
 						oa->reference= newlibadr(fd, ob->id.lib, oa->reference);
 					}
 				}
-				else if(act->type==ACT_EDIT_OBJECT) {
+				else if (act->type==ACT_EDIT_OBJECT) {
 					bEditObjectActuator *eoa= act->data;
-					if(eoa==NULL) {
+					if (eoa==NULL) {
 						init_actuator(act);
 					}
 					else {
@@ -4068,44 +4180,44 @@ static void lib_link_object(FileData *fd, Main *main)
 						eoa->me= newlibadr(fd, ob->id.lib, eoa->me);
 					}
 				}
-				else if(act->type==ACT_SCENE) {
+				else if (act->type==ACT_SCENE) {
 					bSceneActuator *sa= act->data;
 					sa->camera= newlibadr(fd, ob->id.lib, sa->camera);
 					sa->scene= newlibadr(fd, ob->id.lib, sa->scene);
 				}
-				else if(act->type==ACT_ACTION) {
+				else if (act->type==ACT_ACTION) {
 					bActionActuator *aa= act->data;
 					aa->act= newlibadr(fd, ob->id.lib, aa->act);
 				}
-				else if(act->type==ACT_SHAPEACTION) {
+				else if (act->type==ACT_SHAPEACTION) {
 					bActionActuator *aa= act->data;
 					aa->act= newlibadr(fd, ob->id.lib, aa->act);
 				}
-				else if(act->type==ACT_PROPERTY) {
+				else if (act->type==ACT_PROPERTY) {
 					bPropertyActuator *pa= act->data;
 					pa->ob= newlibadr(fd, ob->id.lib, pa->ob);
 				}
-				else if(act->type==ACT_MESSAGE) {
+				else if (act->type==ACT_MESSAGE) {
 					bMessageActuator *ma= act->data;
 					ma->toObject= newlibadr(fd, ob->id.lib, ma->toObject);
 				}
-				else if(act->type==ACT_2DFILTER){
+				else if (act->type==ACT_2DFILTER) {
 					bTwoDFilterActuator *_2dfa = act->data; 
 					_2dfa->text= newlibadr(fd, ob->id.lib, _2dfa->text);
 				}
-				else if(act->type==ACT_PARENT) {
+				else if (act->type==ACT_PARENT) {
 					bParentActuator *parenta = act->data; 
 					parenta->ob = newlibadr(fd, ob->id.lib, parenta->ob);
 				}
-				else if(act->type==ACT_STATE) {
+				else if (act->type==ACT_STATE) {
 					/* bStateActuator *statea = act->data; */
 				}
-				else if(act->type==ACT_ARMATURE) {
+				else if (act->type==ACT_ARMATURE) {
 					bArmatureActuator *arma= act->data;
 					arma->target= newlibadr(fd, ob->id.lib, arma->target);
 					arma->subtarget= newlibadr(fd, ob->id.lib, arma->subtarget);
 				}
-				else if(act->type==ACT_STEERING) {
+				else if (act->type==ACT_STEERING) {
 					bSteeringActuator *steeringa = act->data; 
 					steeringa->target = newlibadr(fd, ob->id.lib, steeringa->target);
 					steeringa->navmesh = newlibadr(fd, ob->id.lib, steeringa->navmesh);
@@ -4116,24 +4228,24 @@ static void lib_link_object(FileData *fd, Main *main)
 			{
 				FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
 				
-				if(fluidmd && fluidmd->fss) 
+				if (fluidmd && fluidmd->fss)
 					fluidmd->fss->ipo = newlibadr_us(fd, ob->id.lib, fluidmd->fss->ipo);
 			}
 
 			{
 				SmokeModifierData *smd = (SmokeModifierData *)modifiers_findByType(ob, eModifierType_Smoke);
 				
-				if(smd && smd->type == MOD_SMOKE_TYPE_DOMAIN && smd->domain) 
+				if (smd && smd->type == MOD_SMOKE_TYPE_DOMAIN && smd->domain)
 				{
 					smd->domain->flags |= MOD_SMOKE_FILE_LOAD; /* flag for refreshing the simulation after loading */
 				}
 			}
 
 			/* texture field */
-			if(ob->pd)
+			if (ob->pd)
 				lib_link_partdeflect(fd, &ob->id, ob->pd);
 
-			if(ob->soft)
+			if (ob->soft)
 				ob->soft->effector_weights->group = newlibadr(fd, ob->id.lib, ob->soft->effector_weights->group);
 
 			lib_link_particlesystems(fd, ob, &ob->id, &ob->particlesystem);
@@ -4142,7 +4254,7 @@ static void lib_link_object(FileData *fd, Main *main)
 		ob= ob->id.next;
 	}
 
-	if(warn) {
+	if (warn) {
 		BKE_report(fd->reports, RPT_WARNING, "Warning in console");
 	}
 }
@@ -4179,7 +4291,7 @@ static void direct_link_pose(FileData *fd, bPose *pose)
 		pchan->iktree.first= pchan->iktree.last= NULL;
 		pchan->siktree.first= pchan->siktree.last= NULL;
 		
-		/* incase this value changes in future, clamp else we get undefined behavior */
+		/* in case this value changes in future, clamp else we get undefined behavior */
 		CLAMP(pchan->rotmode, ROT_MODE_MIN, ROT_MODE_MAX);
 	}
 	pose->ikdata = NULL;
@@ -4199,7 +4311,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
 		md->scene = NULL;
 		
 		/* if modifiers disappear, or for upward compatibility */
-		if(NULL==modifierType_getInfo(md->type))
+		if (NULL==modifierType_getInfo(md->type))
 			md->type= eModifierType_None;
 			
 		if (md->type==eModifierType_Subsurf) {
@@ -4222,15 +4334,15 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
 
 			direct_link_pointcache_list(fd, &clmd->ptcaches, &clmd->point_cache, 0);
 			
-			if(clmd->sim_parms) {
-				if(clmd->sim_parms->presets > 10)
+			if (clmd->sim_parms) {
+				if (clmd->sim_parms->presets > 10)
 					clmd->sim_parms->presets = 0;
 
 				clmd->sim_parms->reset = 0;
 
 				clmd->sim_parms->effector_weights = newdataadr(fd, clmd->sim_parms->effector_weights);
 
-				if(!clmd->sim_parms->effector_weights) {
+				if (!clmd->sim_parms->effector_weights) {
 					clmd->sim_parms->effector_weights = BKE_add_effector_weights(NULL);
 				}
 			}
@@ -4239,7 +4351,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
 			FluidsimModifierData *fluidmd = (FluidsimModifierData*) md;
 			
 			fluidmd->fss= newdataadr(fd, fluidmd->fss);
-			if(fluidmd->fss) {
+			if (fluidmd->fss) {
 				fluidmd->fss->fmd= fluidmd;
 				fluidmd->fss->meshVelocities = NULL;
 			}
@@ -4247,7 +4359,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
 		else if (md->type==eModifierType_Smoke) {
 			SmokeModifierData *smd = (SmokeModifierData*) md;
 
-			if(smd->type==MOD_SMOKE_TYPE_DOMAIN)
+			if (smd->type==MOD_SMOKE_TYPE_DOMAIN)
 			{
 				smd->flow = NULL;
 				smd->coll = NULL;
@@ -4262,16 +4374,16 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
 				smd->domain->tex_wt = NULL;
 
 				smd->domain->effector_weights = newdataadr(fd, smd->domain->effector_weights);
-				if(!smd->domain->effector_weights)
+				if (!smd->domain->effector_weights)
 					smd->domain->effector_weights = BKE_add_effector_weights(NULL);
 
 				direct_link_pointcache_list(fd, &(smd->domain->ptcaches[0]), &(smd->domain->point_cache[0]), 1);
 
 				/* Smoke uses only one cache from now on, so store pointer convert */
-				if(smd->domain->ptcaches[1].first || smd->domain->point_cache[1]) {
-					if(smd->domain->point_cache[1]) {
+				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)
+						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");
@@ -4282,20 +4394,18 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
 					smd->domain->point_cache[1] = NULL;
 				}
 			}
-			else if(smd->type==MOD_SMOKE_TYPE_FLOW)
-			{
+			else if (smd->type==MOD_SMOKE_TYPE_FLOW) {
 				smd->domain = NULL;
 				smd->coll = NULL;
 				smd->flow = newdataadr(fd, smd->flow);
 				smd->flow->smd = smd;
 				smd->flow->psys = newdataadr(fd, smd->flow->psys);
 			}
-			else if(smd->type==MOD_SMOKE_TYPE_COLL)
-			{
+			else if (smd->type==MOD_SMOKE_TYPE_COLL) {
 				smd->flow = NULL;
 				smd->domain = NULL;
 				smd->coll = newdataadr(fd, smd->coll);
-				if(smd->coll)
+				if (smd->coll)
 				{
 					smd->coll->points = NULL;
 					smd->coll->numpoints = 0;
@@ -4308,7 +4418,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
 		else if (md->type==eModifierType_DynamicPaint) {
 			DynamicPaintModifierData *pmd = (DynamicPaintModifierData*) md;
 
-			if(pmd->canvas)
+			if (pmd->canvas)
 			{
 				pmd->canvas = newdataadr(fd, pmd->canvas);
 				pmd->canvas->pmd = pmd;
@@ -4324,12 +4434,12 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
 						surface->data = NULL;
 						direct_link_pointcache_list(fd, &(surface->ptcaches), &(surface->pointcache), 1);
 
-						if(!(surface->effector_weights = newdataadr(fd, surface->effector_weights)))
+						if (!(surface->effector_weights = newdataadr(fd, surface->effector_weights)))
 							surface->effector_weights = BKE_add_effector_weights(NULL);
 					}
 				}
 			}
-			if(pmd->brush)
+			if (pmd->brush)
 			{
 				pmd->brush = newdataadr(fd, pmd->brush);
 				pmd->brush->pmd = pmd;
@@ -4378,20 +4488,22 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
 			HookModifierData *hmd = (HookModifierData*) md;
 
 			hmd->indexar= newdataadr(fd, hmd->indexar);
-			if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
+			if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
 				int a;
-				for(a=0; a<hmd->totindex; a++) {
+				for (a=0; a<hmd->totindex; a++) {
 					SWITCH_INT(hmd->indexar[a]);
 				}
 			}
-		} else if (md->type==eModifierType_ParticleSystem) {
+		}
+		else if (md->type==eModifierType_ParticleSystem) {
 			ParticleSystemModifierData *psmd = (ParticleSystemModifierData*) md;
 
 			psmd->dm= NULL;
 			psmd->psys= newdataadr(fd, psmd->psys);
 			psmd->flag &= ~eParticleSystemFlag_psys_updated;
 			psmd->flag |= eParticleSystemFlag_file_loaded;
-		} else if (md->type==eModifierType_Explode) {
+		}
+		else if (md->type==eModifierType_Explode) {
 			ExplodeModifierData *psmd = (ExplodeModifierData*) md;
 
 			psmd->facepa=NULL;
@@ -4409,25 +4521,25 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
 			mmd->bindweights= newdataadr(fd, mmd->bindweights);
 			mmd->bindcos= newdataadr(fd, mmd->bindcos);
 
-			if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
+			if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
 				int a;
 
-				if(mmd->bindoffsets)
-					for(a=0; a<mmd->totvert+1; a++)
-						SWITCH_INT(mmd->bindoffsets[a])
-				if(mmd->bindcagecos)
-					for(a=0; a<mmd->totcagevert*3; a++)
-						SWITCH_INT(mmd->bindcagecos[a])
-				if(mmd->dynverts)
-					for(a=0; a<mmd->totvert; a++)
-						SWITCH_INT(mmd->dynverts[a])
+				if (mmd->bindoffsets)
+					for (a=0; a<mmd->totvert+1; a++)
+						SWITCH_INT(mmd->bindoffsets[a]);
+				if (mmd->bindcagecos)
+					for (a=0; a<mmd->totcagevert*3; a++)
+						SWITCH_INT(mmd->bindcagecos[a]);
+				if (mmd->dynverts)
+					for (a=0; a<mmd->totvert; a++)
+						SWITCH_INT(mmd->dynverts[a]);
 
-				if(mmd->bindweights)
-					for(a=0; a<mmd->totcagevert*mmd->totvert; a++)
-						SWITCH_INT(mmd->bindweights[a])
-				if(mmd->bindcos)
-					for(a=0; a<mmd->totcagevert*3; a++)
-						SWITCH_INT(mmd->bindcos[a])
+				if (mmd->bindweights)
+					for (a=0; a<mmd->totcagevert*mmd->totvert; a++)
+						SWITCH_INT(mmd->bindweights[a]);
+				if (mmd->bindcos)
+					for (a=0; a<mmd->totcagevert*3; a++)
+						SWITCH_INT(mmd->bindcos[a]);
 			}
 		}
 		else if (md->type==eModifierType_Ocean) {
@@ -4440,14 +4552,14 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
 			WarpModifierData *tmd = (WarpModifierData *) md;
 
 			tmd->curfalloff= newdataadr(fd, tmd->curfalloff);
-			if(tmd->curfalloff)
+			if (tmd->curfalloff)
 				direct_link_curvemapping(fd, tmd->curfalloff);
 		}
 		else if (md->type==eModifierType_WeightVGEdit) {
 			WeightVGEditModifierData *wmd = (WeightVGEditModifierData*) md;
 
 			wmd->cmap_curve = newdataadr(fd, wmd->cmap_curve);
-			if(wmd->cmap_curve)
+			if (wmd->cmap_curve)
 				direct_link_curvemapping(fd, wmd->cmap_curve);
 		}
 	}
@@ -4465,8 +4577,8 @@ static void direct_link_object(FileData *fd, Object *ob)
 	ob->flag &= ~OB_FROMGROUP;
 
 	/* loading saved files with editmode enabled works, but for undo we like
-	   to stay in object mode during undo presses so keep editmode disabled */
-	if(fd->memfile)
+	 * to stay in object mode during undo presses so keep editmode disabled */
+	if (fd->memfile)
 		ob->mode &= ~(OB_MODE_EDIT|OB_MODE_PARTICLE_EDIT);
 	
 	ob->disp.first=ob->disp.last= NULL;
@@ -4496,11 +4608,11 @@ static void direct_link_object(FileData *fd, Object *ob)
 	
 	link_list(fd, &ob->effect);
 	paf= ob->effect.first;
-	while(paf) {
-		if(paf->type==EFF_PARTICLE) {
+	while (paf) {
+		if (paf->type==EFF_PARTICLE) {
 			paf->keys= NULL;
 		}
-		if(paf->type==EFF_WAVE) {
+		if (paf->type==EFF_WAVE) {
 			WaveEff *wav = (WaveEff*) paf;
 			PartEff *next = paf->next;
 			WaveModifierData *wmd = (WaveModifierData*) modifier_new(eModifierType_Wave);
@@ -4524,7 +4636,7 @@ static void direct_link_object(FileData *fd, Object *ob)
 			paf = next;
 			continue;
 		}
-		if(paf->type==EFF_BUILD) {
+		if (paf->type==EFF_BUILD) {
 			BuildEff *baf = (BuildEff*) paf;
 			PartEff *next = paf->next;
 			BuildModifierData *bmd = (BuildModifierData*) modifier_new(eModifierType_Build);
@@ -4548,7 +4660,7 @@ static void direct_link_object(FileData *fd, Object *ob)
 	ob->pd= newdataadr(fd, ob->pd);
 	direct_link_partdeflect(ob->pd);
 	ob->soft= newdataadr(fd, ob->soft);
-	if(ob->soft) {
+	if (ob->soft) {
 		SoftBody *sb= ob->soft;		
 		
 		sb->bpoint= NULL;	// init pointers so it gets rebuilt nicely
@@ -4558,15 +4670,15 @@ static void direct_link_object(FileData *fd, Object *ob)
 		/* still have to be loaded to be compatible with old files */
 		sb->keys= newdataadr(fd, sb->keys);
 		test_pointer_array(fd, (void **)&sb->keys);
-		if(sb->keys) {
+		if (sb->keys) {
 			int a;
-			for(a=0; a<sb->totkey; a++) {
+			for (a=0; a<sb->totkey; a++) {
 				sb->keys[a]= newdataadr(fd, sb->keys[a]);
 			}
 		}
 
 		sb->effector_weights = newdataadr(fd, sb->effector_weights);
-		if(!sb->effector_weights)
+		if (!sb->effector_weights)
 			sb->effector_weights = BKE_add_effector_weights(NULL);
 
 		direct_link_pointcache_list(fd, &sb->ptcaches, &sb->pointcache, 0);
@@ -4579,15 +4691,15 @@ static void direct_link_object(FileData *fd, Object *ob)
 	
 	link_list(fd, &ob->prop);
 	prop= ob->prop.first;
-	while(prop) {
+	while (prop) {
 		prop->poin= newdataadr(fd, prop->poin);
-		if(prop->poin==NULL) prop->poin= &prop->data;
+		if (prop->poin==NULL) prop->poin= &prop->data;
 		prop= prop->next;
 	}
 
 	link_list(fd, &ob->sensors);
 	sens= ob->sensors.first;
-	while(sens) {
+	while (sens) {
 		sens->data= newdataadr(fd, sens->data);
 		sens->links= newdataadr(fd, sens->links);
 		test_pointer_array(fd, (void **)&sens->links);
@@ -4600,11 +4712,12 @@ static void direct_link_object(FileData *fd, Object *ob)
 	if (ob->init_state) {
 		/* if a known first state is specified, set it so that the game will start ok */
 		ob->state = ob->init_state;
-	} else if (!ob->state) {
+	}
+	else if (!ob->state) {
 		ob->state = 1;
 	}
 	cont= ob->controllers.first;
-	while(cont) {
+	while (cont) {
 		cont->data= newdataadr(fd, cont->data);
 		cont->links= newdataadr(fd, cont->links);
 		test_pointer_array(fd, (void **)&cont->links);
@@ -4615,7 +4728,7 @@ static void direct_link_object(FileData *fd, Object *ob)
 
 	link_glob_list(fd, &ob->actuators);
 	act= ob->actuators.first;
-	while(act) {
+	while (act) {
 		act->data= newdataadr(fd, act->data);
 		act= act->next;
 	}
@@ -4626,16 +4739,16 @@ static void direct_link_object(FileData *fd, Object *ob)
 		HookModifierData *hmd = (HookModifierData*) modifier_new(eModifierType_Hook);
 
 		hook->indexar= newdataadr(fd, hook->indexar);
-		if(fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
+		if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
 			int a;
-			for(a=0; a<hook->totindex; a++) {
+			for (a=0; a<hook->totindex; a++) {
 				SWITCH_INT(hook->indexar[a]);
 			}
 		}
 
 			/* Do conversion here because if we have loaded
 			 * a hook we need to make sure it gets converted
-			 * and free'd, regardless of version.
+			 * and freed, regardless of version.
 			 */
 		copy_v3_v3(hmd->cent, hook->cent);
 		hmd->falloff = hook->falloff;
@@ -4660,10 +4773,10 @@ static void direct_link_object(FileData *fd, Object *ob)
 	ob->gpulamp.first= ob->gpulamp.last= NULL;
 	link_list(fd, &ob->pc_ids);
 
-	/* incase this value changes in future, clamp else we get undefined behavior */
+	/* in case this value changes in future, clamp else we get undefined behavior */
 	CLAMP(ob->rotmode, ROT_MODE_MIN, ROT_MODE_MAX);
 
-	if(ob->sculpt) {
+	if (ob->sculpt) {
 		ob->sculpt= MEM_callocN(sizeof(SculptSession), "reload sculpt session");
 	}
 }
@@ -4675,14 +4788,14 @@ static void composite_patch(bNodeTree *ntree, Scene *scene)
 {
 	bNode *node;
 	
-	for(node= ntree->nodes.first; node; node= node->next)
-		if(node->id==NULL && ELEM4(node->type, CMP_NODE_R_LAYERS, CMP_NODE_COMPOSITE, CMP_NODE_DEFOCUS, CMP_NODE_OUTPUT_FILE))
+	for (node= ntree->nodes.first; node; node= node->next)
+		if (node->id==NULL && ELEM4(node->type, CMP_NODE_R_LAYERS, CMP_NODE_COMPOSITE, CMP_NODE_DEFOCUS, CMP_NODE_OUTPUT_FILE))
 			node->id= &scene->id;
 }
 
 static void link_paint(FileData *fd, Scene *sce, Paint *p)
 {
-	if(p) {
+	if (p) {
 		p->brush= newlibadr_us(fd, sce->id.lib, p->brush);
 		p->paint_cursor= NULL;
 	}
@@ -4697,10 +4810,10 @@ static void lib_link_scene(FileData *fd, Main *main)
 	TimeMarker *marker;
 	
 	sce= main->scene.first;
-	while(sce) {
-		if(sce->id.flag & LIB_NEEDLINK) {
-			/*Link ID Properties -- and copy this comment EXACTLY for easy finding
-			of library blocks that implement this.*/
+	while (sce) {
+		if (sce->id.flag & LIB_NEEDLINK) {
+			/* Link ID Properties -- and copy this comment EXACTLY for easy finding
+			 * of library blocks that implement this.*/
 			if (sce->id.properties) IDP_LibLinkProperty(sce->id.properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
 			if (sce->adt) lib_link_animdata(fd, &sce->id, sce->adt);
 			
@@ -4718,35 +4831,39 @@ static void lib_link_scene(FileData *fd, Main *main)
 			link_paint(fd, sce, &sce->toolsettings->uvsculpt->paint);
 			sce->toolsettings->skgen_template = newlibadr(fd, sce->id.lib, sce->toolsettings->skgen_template);
 
-			for(base= sce->base.first; base; base= next) {
+			for (base= sce->base.first; base; base= next) {
 				next= base->next;
 
 				/* base->object= newlibadr_us(fd, sce->id.lib, base->object); */
 				base->object= newlibadr_us(fd, sce->id.lib, base->object);
 				
-				if(base->object==NULL) {
+				if (base->object==NULL) {
 					BKE_reportf_wrap(fd->reports, RPT_ERROR,
 					                 "LIB ERROR: Object lost from scene:'%s\'\n",
 					                 sce->id.name+2);
 					BLI_remlink(&sce->base, base);
-					if(base==sce->basact) sce->basact= NULL;
+					if (base==sce->basact) sce->basact= NULL;
 					MEM_freeN(base);
 				}
 			}
 
 			SEQ_BEGIN(sce->ed, seq) {
-				if(seq->ipo) seq->ipo= newlibadr_us(fd, sce->id.lib, seq->ipo);
+				if (seq->ipo) seq->ipo= newlibadr_us(fd, sce->id.lib, seq->ipo);
 				seq->scene_sound = NULL;
-				if(seq->scene) {
+				if (seq->scene) {
 					seq->scene= newlibadr(fd, sce->id.lib, seq->scene);
-					if(seq->scene) {
+					if (seq->scene) {
 						seq->scene_sound = sound_scene_add_scene_sound_defaults(sce, seq);
 					}
 				}
-				if(seq->scene_camera) seq->scene_camera= newlibadr(fd, sce->id.lib, seq->scene_camera);
-				if(seq->sound) {
+				if (seq->clip) {
+					seq->clip = newlibadr(fd, sce->id.lib, seq->clip);
+					seq->clip->id.us++;
+				}
+				if (seq->scene_camera) seq->scene_camera= newlibadr(fd, sce->id.lib, seq->scene_camera);
+				if (seq->sound) {
 					seq->scene_sound = NULL;
-					if(seq->type == SEQ_HD_SOUND)
+					if (seq->type == SEQ_HD_SOUND)
 						seq->type = SEQ_SOUND;
 					else
 						seq->sound= newlibadr(fd, sce->id.lib, seq->sound);
@@ -4760,8 +4877,8 @@ static void lib_link_scene(FileData *fd, Main *main)
 			SEQ_END
 
 #ifdef DURIAN_CAMERA_SWITCH
-			for(marker= sce->markers.first; marker; marker= marker->next) {
-				if(marker->camera) {
+			for (marker= sce->markers.first; marker; marker= marker->next) {
+				if (marker->camera) {
 					marker->camera= newlibadr(fd, sce->id.lib, marker->camera);
 				}
 			}
@@ -4772,12 +4889,12 @@ static void lib_link_scene(FileData *fd, Main *main)
 			seq_update_muting(sce->ed);
 			seq_update_sound_bounds_all(sce);
 			
-			if(sce->nodetree) {
+			if (sce->nodetree) {
 				lib_link_ntree(fd, &sce->id, sce->nodetree);
 				composite_patch(sce->nodetree, sce);
 			}
 			
-			for(srl= sce->r.layers.first; srl; srl= srl->next) {
+			for (srl= sce->r.layers.first; srl; srl= srl->next) {
 				srl->mat_override= newlibadr_us(fd, sce->id.lib, srl->mat_override);
 				srl->light_override= newlibadr_us(fd, sce->id.lib, srl->light_override);
 			}
@@ -4800,8 +4917,8 @@ static void link_recurs_seq(FileData *fd, ListBase *lb)
 
 	link_list(fd, lb);
 
-	for(seq=lb->first; seq; seq=seq->next)
-		if(seq->seqbase.first)
+	for (seq=lb->first; seq; seq=seq->next)
+		if (seq->seqbase.first)
 			link_recurs_seq(fd, &seq->seqbase);
 }
 
@@ -4841,7 +4958,7 @@ static void direct_link_scene(FileData *fd, Scene *sce)
 	sce->basact= newdataadr(fd, sce->basact);
 	
 	sce->toolsettings= newdataadr(fd, sce->toolsettings);
-	if(sce->toolsettings) {
+	if (sce->toolsettings) {
 		direct_link_paint(fd, (Paint**)&sce->toolsettings->sculpt);
 		direct_link_paint(fd, (Paint**)&sce->toolsettings->vpaint);
 		direct_link_paint(fd, (Paint**)&sce->toolsettings->wpaint);
@@ -4851,7 +4968,7 @@ static void direct_link_scene(FileData *fd, Scene *sce)
 		sce->toolsettings->particle.paintcursor= NULL;
 	}
 
-	if(sce->ed) {
+	if (sce->ed) {
 		ListBase *old_seqbasep= &((Editing *)sce->ed)->seqbase;
 		
 		ed= sce->ed= newdataadr(fd, sce->ed);
@@ -4866,55 +4983,60 @@ static void direct_link_scene(FileData *fd, Scene *sce)
 			seq->seq2= newdataadr(fd, seq->seq2);
 			seq->seq3= newdataadr(fd, seq->seq3);
 			/* a patch: after introduction of effects with 3 input strips */
-			if(seq->seq3==NULL) seq->seq3= seq->seq2;
+			if (seq->seq3==NULL) seq->seq3= seq->seq2;
 
 			seq->plugin= newdataadr(fd, seq->plugin);
 			seq->effectdata= newdataadr(fd, seq->effectdata);
 			
-			if(seq->type & SEQ_EFFECT)
+			if (seq->type & SEQ_EFFECT)
 				seq->flag |= SEQ_EFFECT_NOT_LOADED;
 
-			if(seq->type == SEQ_SPEED) {
+			if (seq->type == SEQ_SPEED) {
 				SpeedControlVars *s= seq->effectdata;
 				s->frameMap= NULL;
 			}
 
 			seq->strip= newdataadr(fd, seq->strip);
-			if(seq->strip && seq->strip->done==0) {
+			if (seq->strip && seq->strip->done==0) {
 				seq->strip->done= 1;
 
-				if(seq->type == SEQ_IMAGE ||
+				if (seq->type == SEQ_IMAGE ||
 				   seq->type == SEQ_MOVIE ||
 				   seq->type == SEQ_RAM_SOUND ||
 				   seq->type == SEQ_HD_SOUND) {
 					seq->strip->stripdata = newdataadr(
 						fd, seq->strip->stripdata);
-				} else {
+				}
+				else {
 					seq->strip->stripdata = NULL;
 				}
 				if (seq->flag & SEQ_USE_CROP) {
 					seq->strip->crop = newdataadr(
 						fd, seq->strip->crop);
-				} else {
+				}
+				else {
 					seq->strip->crop = NULL;
 				}
 				if (seq->flag & SEQ_USE_TRANSFORM) {
 					seq->strip->transform = newdataadr(
 						fd, seq->strip->transform);
-				} else {
+				}
+				else {
 					seq->strip->transform = NULL;
 				}
 				if (seq->flag & SEQ_USE_PROXY) {
 					seq->strip->proxy = newdataadr(
 						fd, seq->strip->proxy);
 					seq->strip->proxy->anim = NULL;
-				} else {
+				}
+				else {
 					seq->strip->proxy = NULL;
 				}
 				if (seq->flag & SEQ_USE_COLOR_BALANCE) {
 					seq->strip->color_balance = newdataadr(
 						fd, seq->strip->color_balance);
-				} else {
+				}
+				else {
 					seq->strip->color_balance = NULL;
 				}
 				if (seq->strip->color_balance) {
@@ -4933,7 +5055,7 @@ static void direct_link_scene(FileData *fd, Scene *sce)
 			offset= ((intptr_t)&(temp.seqbase)) - ((intptr_t)&temp);
 			
 			/* root pointer */
-			if(ed->seqbasep == old_seqbasep) {
+			if (ed->seqbasep == old_seqbasep) {
 				ed->seqbasep= &ed->seqbase;
 			}
 			else {
@@ -4942,22 +5064,22 @@ static void direct_link_scene(FileData *fd, Scene *sce)
 				poin -= offset;
 				
 				poin= newdataadr(fd, poin);
-				if(poin) ed->seqbasep= (ListBase *)(poin+offset);
+				if (poin) ed->seqbasep= (ListBase *)(poin+offset);
 				else ed->seqbasep= &ed->seqbase;
 			}			
 			/* stack */
 			link_list(fd, &(ed->metastack));
 			
-			for(ms= ed->metastack.first; ms; ms= ms->next) {
+			for (ms= ed->metastack.first; ms; ms= ms->next) {
 				ms->parseq= newdataadr(fd, ms->parseq);
 				
-				if(ms->oldbasep == old_seqbasep)
+				if (ms->oldbasep == old_seqbasep)
 					ms->oldbasep= &ed->seqbase;
 				else {
 					poin= (char *)ms->oldbasep;
 					poin -= offset;
 					poin= newdataadr(fd, poin);
-					if(poin) ms->oldbasep= (ListBase *)(poin+offset);
+					if (poin) ms->oldbasep= (ListBase *)(poin+offset);
 					else ms->oldbasep= &ed->seqbase;
 				}
 			}
@@ -4989,7 +5111,7 @@ 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_nodetree(fd, sce->nodetree);
 }
 
@@ -5002,7 +5124,7 @@ static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm)
 	wm->id.us= 1;
 	link_list(fd, &(wm->windows));
 	
-	for(win= wm->windows.first; win; win= win->next) {
+	for (win= wm->windows.first; win; win= win->next) {
 		win->ghostwin= NULL;
 		win->eventstate= NULL;
 		win->curswin= NULL;
@@ -5044,9 +5166,9 @@ static void lib_link_windowmanager(FileData *fd, Main *main)
 	wmWindowManager *wm;
 	wmWindow *win;
 	
-	for(wm= main->wm.first; wm; wm= wm->id.next) {
-		if(wm->id.flag & LIB_NEEDLINK) {
-			for(win= wm->windows.first; win; win= win->next)
+	for (wm= main->wm.first; wm; wm= wm->id.next) {
+		if (wm->id.flag & LIB_NEEDLINK) {
+			for (win= wm->windows.first; win; win= win->next)
 				win->screen= newlibadr(fd, NULL, win->screen);
 
 			wm->id.flag -= LIB_NEEDLINK;
@@ -5090,10 +5212,10 @@ static void direct_link_gpencil(FileData *fd, bGPdata *gpd)
 
 static void butspace_version_132(SpaceButs *buts)
 {
-	buts->v2d.tot.xmin= 0.0f;
-	buts->v2d.tot.ymin= 0.0f;
-	buts->v2d.tot.xmax= 1279.0f;
-	buts->v2d.tot.ymax= 228.0f;
+	buts->v2d.tot.xmin = 0.0f;
+	buts->v2d.tot.ymin = 0.0f;
+	buts->v2d.tot.xmax = 1279.0f;
+	buts->v2d.tot.ymax = 228.0f;
 
 	buts->v2d.min[0]= 256.0f;
 	buts->v2d.min[1]= 42.0f;
@@ -5110,26 +5232,26 @@ static void butspace_version_132(SpaceButs *buts)
 }
 
 /* note: file read without screens option G_FILE_NO_UI; 
-   check lib pointers in call below */
+ * check lib pointers in call below */
 static void lib_link_screen(FileData *fd, Main *main)
 {
 	bScreen *sc;
 	ScrArea *sa;
 
-	for(sc= main->screen.first; sc; sc= sc->id.next) {
-		if(sc->id.flag & LIB_NEEDLINK) {
+	for (sc= main->screen.first; sc; sc= sc->id.next) {
+		if (sc->id.flag & LIB_NEEDLINK) {
 			sc->id.us= 1;
 			sc->scene= newlibadr(fd, sc->id.lib, sc->scene);
 			sc->animtimer= NULL; /* saved in rare cases */
 			
 			sa= sc->areabase.first;
-			while(sa) {
+			while (sa) {
 				SpaceLink *sl;
 				
 				sa->full= newlibadr(fd, sc->id.lib, sa->full);
 				
 				for (sl= sa->spacedata.first; sl; sl= sl->next) {
-					if(sl->spacetype==SPACE_VIEW3D) {
+					if (sl->spacetype==SPACE_VIEW3D) {
 						View3D *v3d= (View3D*) sl;
 						BGpic *bgpic = NULL;
 						
@@ -5137,21 +5259,21 @@ static void lib_link_screen(FileData *fd, Main *main)
 						v3d->ob_centre= newlibadr(fd, sc->id.lib, v3d->ob_centre);
 						
 						/* should be do_versions but not easy adding into the listbase */
-						if(v3d->bgpic) {
+						if (v3d->bgpic) {
 							v3d->bgpic= newlibadr(fd, sc->id.lib, v3d->bgpic);
 							BLI_addtail(&v3d->bgpicbase, bgpic);
 							v3d->bgpic= NULL;
 						}
 
-						for(bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next) {
+						for (bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next) {
 							bgpic->ima= newlibadr_us(fd, sc->id.lib, bgpic->ima);
 							bgpic->clip= newlibadr_us(fd, sc->id.lib, bgpic->clip);
 						}
-						if(v3d->localvd) {
+						if (v3d->localvd) {
 							v3d->localvd->camera= newlibadr(fd, sc->id.lib, v3d->localvd->camera);
 						}
 					}
-					else if(sl->spacetype==SPACE_IPO) {
+					else if (sl->spacetype==SPACE_IPO) {
 						SpaceIpo *sipo= (SpaceIpo *)sl;
 						bDopeSheet *ads= sipo->ads;
 						
@@ -5160,15 +5282,15 @@ static void lib_link_screen(FileData *fd, Main *main)
 							ads->filter_grp= newlibadr(fd, sc->id.lib, ads->filter_grp);
 						}
 					}
-					else if(sl->spacetype==SPACE_BUTS) {
+					else if (sl->spacetype==SPACE_BUTS) {
 						SpaceButs *sbuts= (SpaceButs *)sl;
 						sbuts->pinid= newlibadr(fd, sc->id.lib, sbuts->pinid);
 						sbuts->mainbo= sbuts->mainb;
 						sbuts->mainbuser= sbuts->mainb;
-						if(main->versionfile<132)
+						if (main->versionfile<132)
 							butspace_version_132(sbuts);
 					}
-					else if(sl->spacetype==SPACE_FILE) {
+					else if (sl->spacetype==SPACE_FILE) {
 						SpaceFile *sfile= (SpaceFile *)sl;
 						sfile->files= NULL;
 						sfile->op= NULL;
@@ -5176,7 +5298,7 @@ static void lib_link_screen(FileData *fd, Main *main)
 						sfile->folders_prev= NULL;
 						sfile->folders_next= NULL;
 					}
-					else if(sl->spacetype==SPACE_ACTION) {
+					else if (sl->spacetype==SPACE_ACTION) {
 						SpaceAction *saction= (SpaceAction *)sl;
 						bDopeSheet *ads= &saction->ads;
 						
@@ -5187,7 +5309,7 @@ static void lib_link_screen(FileData *fd, Main *main)
 						
 						saction->action = newlibadr(fd, sc->id.lib, saction->action);
 					}
-					else if(sl->spacetype==SPACE_IMAGE) {
+					else if (sl->spacetype==SPACE_IMAGE) {
 						SpaceImage *sima= (SpaceImage *)sl;
 
 						sima->image= newlibadr_us(fd, sc->id.lib, sima->image);
@@ -5197,7 +5319,7 @@ static void lib_link_screen(FileData *fd, Main *main)
 						 */
 						sima->gpd= newlibadr_us(fd, sc->id.lib, sima->gpd);
 					}
-					else if(sl->spacetype==SPACE_NLA){
+					else if (sl->spacetype==SPACE_NLA) {
 						SpaceNla *snla= (SpaceNla *)sl;
 						bDopeSheet *ads= snla->ads;
 						
@@ -5206,25 +5328,25 @@ static void lib_link_screen(FileData *fd, Main *main)
 							ads->filter_grp= newlibadr(fd, sc->id.lib, ads->filter_grp);
 						}
 					}
-					else if(sl->spacetype==SPACE_TEXT) {
+					else if (sl->spacetype==SPACE_TEXT) {
 						SpaceText *st= (SpaceText *)sl;
 
 						st->text= newlibadr(fd, sc->id.lib, st->text);
 						st->drawcache= NULL;
 
 					}
-					else if(sl->spacetype==SPACE_SCRIPT) {
+					else if (sl->spacetype==SPACE_SCRIPT) {
 
 						SpaceScript *scpt= (SpaceScript *)sl;
 						/*scpt->script = NULL; - 2.45 set to null, better re-run the script */
 						if (scpt->script) {
 							scpt->script= newlibadr(fd, sc->id.lib, scpt->script);
 							if (scpt->script) {
-								SCRIPT_SET_NULL(scpt->script)
+								SCRIPT_SET_NULL(scpt->script);
 							}
 						}
 					}
-					else if(sl->spacetype==SPACE_OUTLINER) {
+					else if (sl->spacetype==SPACE_OUTLINER) {
 						SpaceOops *so= (SpaceOops *)sl;
 						TreeStoreElem *tselem;
 						int a;
@@ -5232,14 +5354,14 @@ static void lib_link_screen(FileData *fd, Main *main)
 						so->tree.first= so->tree.last= NULL;
 						so->search_tse.id= newlibadr(fd, NULL, so->search_tse.id);
 						
-						if(so->treestore) {
+						if (so->treestore) {
 							tselem= so->treestore->data;
-							for(a=0; a<so->treestore->usedelem; a++, tselem++) {
+							for (a=0; a<so->treestore->usedelem; a++, tselem++) {
 								tselem->id= newlibadr(fd, NULL, tselem->id);
 							}
 						}
 					}
-					else if(sl->spacetype==SPACE_NODE) {
+					else if (sl->spacetype==SPACE_NODE) {
 						SpaceNode *snode= (SpaceNode *)sl;
 						
 						snode->id= newlibadr(fd, sc->id.lib, snode->id);
@@ -5248,16 +5370,16 @@ static void lib_link_screen(FileData *fd, Main *main)
 						if (ELEM3(snode->treetype, NTREE_COMPOSIT, NTREE_SHADER, NTREE_TEXTURE)) {
 							/* internal data, a bit patchy */
 							snode->nodetree= NULL;
-							if(snode->id) {
-								if(GS(snode->id->name)==ID_MA)
+							if (snode->id) {
+								if (GS(snode->id->name)==ID_MA)
 									snode->nodetree= ((Material *)snode->id)->nodetree;
-								else if(GS(snode->id->name)==ID_WO)
+								else if (GS(snode->id->name)==ID_WO)
 									snode->nodetree= ((World *)snode->id)->nodetree;
-								else if(GS(snode->id->name)==ID_LA)
+								else if (GS(snode->id->name)==ID_LA)
 									snode->nodetree= ((Lamp *)snode->id)->nodetree;
-								else if(GS(snode->id->name)==ID_SCE)
+								else if (GS(snode->id->name)==ID_SCE)
 									snode->nodetree= ((Scene *)snode->id)->nodetree;
-								else if(GS(snode->id->name)==ID_TE)
+								else if (GS(snode->id->name)==ID_TE)
 									snode->nodetree= ((Tex *)snode->id)->nodetree;
 							}
 						}
@@ -5267,7 +5389,7 @@ static void lib_link_screen(FileData *fd, Main *main)
 						
 						snode->linkdrag.first = snode->linkdrag.last = NULL;
 					}
-					else if(sl->spacetype==SPACE_CLIP) {
+					else if (sl->spacetype==SPACE_CLIP) {
 						SpaceClip *sclip= (SpaceClip *)sl;
 
 						sclip->clip= newlibadr_us(fd, sc->id.lib, sclip->clip);
@@ -5287,17 +5409,17 @@ static void lib_link_screen(FileData *fd, Main *main)
 static void *restore_pointer_by_name(Main *mainp, ID *id, int user)
 {
 		
-	if(id) {
+	if (id) {
 		ListBase *lb= which_libbase(mainp, GS(id->name));
 		
-		if(lb) {	// there's still risk of checking corrupt mem (freed Ids in oops)
+		if (lb) {	// there's still risk of checking corrupt mem (freed Ids in oops)
 			ID *idn= lb->first;
 			char *name= id->name+2;
 			
-			while(idn) {
-				if(idn->name[2]==name[0] && strcmp(idn->name+2, name)==0) {
-					if(idn->lib==id->lib) {
-						if(user && idn->us==0) idn->us++;
+			while (idn) {
+				if (idn->name[2]==name[0] && strcmp(idn->name+2, name)==0) {
+					if (idn->lib==id->lib) {
+						if (user && idn->us==0) idn->us++;
 						break;
 					}
 				}
@@ -5313,15 +5435,15 @@ static int lib_link_seq_clipboard_cb(Sequence *seq, void *arg_pt)
 {
 	Main *newmain = (Main *)arg_pt;
 
-	if(seq->sound) {
+	if (seq->sound) {
 		seq->sound = restore_pointer_by_name(newmain, (ID *)seq->sound, 0);
 		seq->sound->id.us++;
 	}
 
-	if(seq->scene)
+	if (seq->scene)
 		seq->scene = restore_pointer_by_name(newmain, (ID *)seq->scene, 1);
 
-	if(seq->scene_camera)
+	if (seq->scene_camera)
 		seq->scene_camera = restore_pointer_by_name(newmain, (ID *)seq->scene_camera, 1);
 
 	return 1;
@@ -5344,11 +5466,11 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
 	ScrArea *sa;
 
 	/* first windowmanager */
-	for(wm= newmain->wm.first; wm; wm= wm->id.next) {
-		for(win= wm->windows.first; win; win= win->next) {
+	for (wm= newmain->wm.first; wm; wm= wm->id.next) {
+		for (win= wm->windows.first; win; win= win->next) {
 			win->screen= restore_pointer_by_name(newmain, (ID *)win->screen, 1);
 			
-			if(win->screen==NULL)
+			if (win->screen==NULL)
 				win->screen= curscreen;
 
 			win->screen->winid= win->winid;
@@ -5356,49 +5478,49 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
 	}
 	
 	
-	for(sc= newmain->screen.first; sc; sc= sc->id.next) {
+	for (sc= newmain->screen.first; sc; sc= sc->id.next) {
 		Scene *oldscene= sc->scene;
 
 		sc->scene= restore_pointer_by_name(newmain, (ID *)sc->scene, 1);
-		if(sc->scene==NULL)
+		if (sc->scene==NULL)
 			sc->scene= curscene;
 
 		/* keep cursor location through undo */
 		copy_v3_v3(sc->scene->cursor, oldscene->cursor);
 
 		sa= sc->areabase.first;
-		while(sa) {
+		while (sa) {
 			SpaceLink *sl;
 
 			for (sl= sa->spacedata.first; sl; sl= sl->next) {
-				if(sl->spacetype==SPACE_VIEW3D) {
+				if (sl->spacetype==SPACE_VIEW3D) {
 					View3D *v3d= (View3D*) sl;
 					BGpic *bgpic;
 					ARegion *ar;
 					
-					if(v3d->scenelock)
+					if (v3d->scenelock)
 						v3d->camera= NULL; /* always get from scene */
 					else
 						v3d->camera= restore_pointer_by_name(newmain, (ID *)v3d->camera, 1);
-					if(v3d->camera==NULL)
+					if (v3d->camera==NULL)
 						v3d->camera= sc->scene->camera;
 					v3d->ob_centre= restore_pointer_by_name(newmain, (ID *)v3d->ob_centre, 1);
 					
-					for(bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next) {
+					for (bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next) {
 						bgpic->ima= restore_pointer_by_name(newmain, (ID *)bgpic->ima, 1);
 						bgpic->clip= restore_pointer_by_name(newmain, (ID *)bgpic->clip, 1);
 					}
-					if(v3d->localvd) {
+					if (v3d->localvd) {
 						/*Base *base;*/
 
 						v3d->localvd->camera= sc->scene->camera;
 						
 						/* localview can become invalid during undo/redo steps, so we exit it when no could be found */
 						/* XXX  regionlocalview ?
-						for(base= sc->scene->base.first; base; base= base->next) {
-							if(base->lay & v3d->lay) break;
+						for (base= sc->scene->base.first; base; base= base->next) {
+							if (base->lay & v3d->lay) break;
 						}
-						if(base==NULL) {
+						if (base==NULL) {
 							v3d->lay= v3d->localvd->lay;
 							v3d->layact= v3d->localvd->layact;
 							MEM_freeN(v3d->localvd); 
@@ -5406,22 +5528,22 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
 						}
 						*/
 					}
-					else if(v3d->scenelock) v3d->lay= sc->scene->lay;
+					else if (v3d->scenelock) v3d->lay= sc->scene->lay;
 
 					/* not very nice, but could help */
-					if((v3d->layact & v3d->lay)==0) v3d->layact= v3d->lay;
+					if ((v3d->layact & v3d->lay)==0) v3d->layact= v3d->lay;
 					
 					/* free render engines for now */
-					for(ar= sa->regionbase.first; ar; ar= ar->next) {
+					for (ar= sa->regionbase.first; ar; ar= ar->next) {
 						RegionView3D *rv3d= ar->regiondata;
 
-						if(rv3d && rv3d->render_engine) {
+						if (rv3d && rv3d->render_engine) {
 							RE_engine_free(rv3d->render_engine);
 							rv3d->render_engine= NULL;
 						}
 					}
 				}
-				else if(sl->spacetype==SPACE_IPO) {
+				else if (sl->spacetype==SPACE_IPO) {
 					SpaceIpo *sipo= (SpaceIpo *)sl;
 					bDopeSheet *ads= sipo->ads;
 					
@@ -5432,17 +5554,17 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
 							ads->filter_grp= restore_pointer_by_name(newmain, (ID *)ads->filter_grp, 0);
 					}
 				}
-				else if(sl->spacetype==SPACE_BUTS) {
+				else if (sl->spacetype==SPACE_BUTS) {
 					SpaceButs *sbuts= (SpaceButs *)sl;
 					sbuts->pinid = restore_pointer_by_name(newmain, sbuts->pinid, 0);
 					//XXX if (sbuts->ri) sbuts->ri->curtile = 0;
 				}
-				else if(sl->spacetype==SPACE_FILE) {
+				else if (sl->spacetype==SPACE_FILE) {
 					
 					SpaceFile *sfile= (SpaceFile *)sl;
 					sfile->op= NULL;
 				}
-				else if(sl->spacetype==SPACE_ACTION) {
+				else if (sl->spacetype==SPACE_ACTION) {
 					SpaceAction *saction= (SpaceAction *)sl;
 					
 					saction->action = restore_pointer_by_name(newmain, (ID *)saction->action, 1);
@@ -5451,11 +5573,15 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
 					if (saction->ads.filter_grp)
 						saction->ads.filter_grp= restore_pointer_by_name(newmain, (ID *)saction->ads.filter_grp, 0);
 				}
-				else if(sl->spacetype==SPACE_IMAGE) {
+				else if (sl->spacetype==SPACE_IMAGE) {
 					SpaceImage *sima= (SpaceImage *)sl;
 
 					sima->image= restore_pointer_by_name(newmain, (ID *)sima->image, 1);
 
+					/* this will be freed, not worth attempting to find same scene,
+					 * since it gets initialized later */
+					sima->iuser.scene = NULL;
+
 					sima->scopes.waveform_1 = NULL;
 					sima->scopes.waveform_2 = NULL;
 					sima->scopes.waveform_3 = NULL;
@@ -5467,7 +5593,7 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
 					 */
 					sima->gpd= restore_pointer_by_name(newmain, (ID *)sima->gpd, 1);
 				}
-				else if(sl->spacetype==SPACE_NLA){
+				else if (sl->spacetype==SPACE_NLA) {
 					SpaceNla *snla= (SpaceNla *)sl;
 					bDopeSheet *ads= snla->ads;
 					
@@ -5478,37 +5604,37 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
 							ads->filter_grp= restore_pointer_by_name(newmain, (ID *)ads->filter_grp, 0);
 					}
 				}
-				else if(sl->spacetype==SPACE_TEXT) {
+				else if (sl->spacetype==SPACE_TEXT) {
 					SpaceText *st= (SpaceText *)sl;
 
 					st->text= restore_pointer_by_name(newmain, (ID *)st->text, 1);
-					if(st->text==NULL) st->text= newmain->text.first;
+					if (st->text==NULL) st->text= newmain->text.first;
 				}
-				else if(sl->spacetype==SPACE_SCRIPT) {
+				else if (sl->spacetype==SPACE_SCRIPT) {
 					SpaceScript *scpt= (SpaceScript *)sl;
 					
 					scpt->script= restore_pointer_by_name(newmain, (ID *)scpt->script, 1);
 					
 					/*sc->script = NULL; - 2.45 set to null, better re-run the script */
 					if (scpt->script) {
-						SCRIPT_SET_NULL(scpt->script)
+						SCRIPT_SET_NULL(scpt->script);
 					}
 				}
-				else if(sl->spacetype==SPACE_OUTLINER) {
+				else if (sl->spacetype==SPACE_OUTLINER) {
 					SpaceOops *so= (SpaceOops *)sl;
 					int a;
 					
 					so->search_tse.id= restore_pointer_by_name(newmain, so->search_tse.id, 0);
 					
-					if(so->treestore) {
+					if (so->treestore) {
 						TreeStore *ts= so->treestore;
 						TreeStoreElem *tselem=ts->data;
-						for(a=0; a<ts->usedelem; a++, tselem++) {
+						for (a=0; a<ts->usedelem; a++, tselem++) {
 							tselem->id= restore_pointer_by_name(newmain, tselem->id, 0);
 						}
 					}
 				}
-				else if(sl->spacetype==SPACE_NODE) {
+				else if (sl->spacetype==SPACE_NODE) {
 					SpaceNode *snode= (SpaceNode *)sl;
 					
 					snode->id= restore_pointer_by_name(newmain, snode->id, 1);
@@ -5516,12 +5642,12 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
 					
 					if (ELEM3(snode->treetype, NTREE_COMPOSIT, NTREE_SHADER, NTREE_TEXTURE)) {
 						snode->nodetree= NULL;
-						if(snode->id) {
-							if(GS(snode->id->name)==ID_MA)
+						if (snode->id) {
+							if (GS(snode->id->name)==ID_MA)
 								snode->nodetree= ((Material *)snode->id)->nodetree;
-							else if(GS(snode->id->name)==ID_SCE)
+							else if (GS(snode->id->name)==ID_SCE)
 								snode->nodetree= ((Scene *)snode->id)->nodetree;
-							else if(GS(snode->id->name)==ID_TE)
+							else if (GS(snode->id->name)==ID_TE)
 								snode->nodetree= ((Tex *)snode->id)->nodetree;
 						}
 					}
@@ -5529,7 +5655,7 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
 						snode->nodetree= restore_pointer_by_name(newmain, &snode->nodetree->id, 1);
 					}
 				}
-				else if(sl->spacetype==SPACE_CLIP) {
+				else if (sl->spacetype==SPACE_CLIP) {
 					SpaceClip *sclip= (SpaceClip *)sl;
 
 					sclip->clip= restore_pointer_by_name(newmain, (ID *)sclip->clip, 1);
@@ -5551,7 +5677,7 @@ static void direct_link_region(FileData *fd, ARegion *ar, int spacetype)
 
 	link_list(fd, &(ar->panels));
 
-	for(pa= ar->panels.first; pa; pa=pa->next) {
+	for (pa= ar->panels.first; pa; pa=pa->next) {
 		pa->paneltab= newdataadr(fd, pa->paneltab);
 		pa->runtime_flag= 0;
 		pa->activedata= NULL;
@@ -5559,8 +5685,8 @@ static void direct_link_region(FileData *fd, ARegion *ar, int spacetype)
 	}
 	
 	ar->regiondata= newdataadr(fd, ar->regiondata);
-	if(ar->regiondata) {
-		if(spacetype==SPACE_VIEW3D) {
+	if (ar->regiondata) {
+		if (spacetype==SPACE_VIEW3D) {
 			RegionView3D *rv3d= ar->regiondata;
 			
 			rv3d->localvd= newdataadr(fd, rv3d->localvd);
@@ -5593,13 +5719,13 @@ static void view3d_split_250(View3D *v3d, ListBase *regions)
 {
 	ARegion *ar;
 	
-	for(ar= regions->first; ar; ar= ar->next) {
-		if(ar->regiontype==RGN_TYPE_WINDOW && ar->regiondata==NULL) {
+	for (ar= regions->first; ar; ar= ar->next) {
+		if (ar->regiontype==RGN_TYPE_WINDOW && ar->regiondata==NULL) {
 			RegionView3D *rv3d;
 			
 			rv3d= ar->regiondata= MEM_callocN(sizeof(RegionView3D), "region v3d patch");
-			rv3d->persp= v3d->persp;
-			rv3d->view= v3d->view;
+			rv3d->persp= (char)v3d->persp;
+			rv3d->view= (char)v3d->view;
 			rv3d->dist= v3d->dist;
 			copy_v3_v3(rv3d->ofs, v3d->ofs);
 			copy_qt_qt(rv3d->viewquat, v3d->viewquat);
@@ -5607,7 +5733,7 @@ static void view3d_split_250(View3D *v3d, ListBase *regions)
 	}
 
 	/* this was not initialized correct always */
-	if(v3d->twtype == 0)
+	if (v3d->twtype == 0)
 		v3d->twtype= V3D_MANIP_TRANSLATE;
 }
 
@@ -5628,32 +5754,32 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
 	sc->swap= 0;
 	
 	/* hacky patch... but people have been saving files with the verse-blender,
-	   causing the handler to keep running for ever, with no means to disable it */
-	for(a=0; a<SCREEN_MAXHANDLER; a+=2) {
-		if( sc->handler[a]==SCREEN_HANDLER_VERSE) {
+	 * causing the handler to keep running for ever, with no means to disable it */
+	for (a=0; a<SCREEN_MAXHANDLER; a+=2) {
+		if ( sc->handler[a]==SCREEN_HANDLER_VERSE) {
 			sc->handler[a]= 0;
 			break;
 		}
 	}
 	
 	/* edges */
-	for(se= sc->edgebase.first; se; se= se->next) {
+	for (se= sc->edgebase.first; se; se= se->next) {
 		se->v1= newdataadr(fd, se->v1);
 		se->v2= newdataadr(fd, se->v2);
-		if( (intptr_t)se->v1 > (intptr_t)se->v2) {
+		if ( (intptr_t)se->v1 > (intptr_t)se->v2) {
 			sv= se->v1;
 			se->v1= se->v2;
 			se->v2= sv;
 		}
 
-		if(se->v1==NULL) {
+		if (se->v1==NULL) {
 			printf("error reading screen... file corrupt\n");
 			se->v1= se->v2;
 		}
 	}
 
 	/* areas */
-	for(sa= sc->areabase.first; sa; sa= sa->next) {
+	for (sa= sc->areabase.first; sa; sa= sa->next) {
 		SpaceLink *sl;
 		ARegion *ar;
 
@@ -5663,24 +5789,24 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
 		sa->handlers.first= sa->handlers.last= NULL;
 		sa->type= NULL;	/* spacetype callbacks */
 		
-		for(ar= sa->regionbase.first; ar; ar= ar->next)
+		for (ar= sa->regionbase.first; ar; ar= ar->next)
 			direct_link_region(fd, ar, sa->spacetype);
 		
 		/* accident can happen when read/save new file with older version */
 		/* 2.50: we now always add spacedata for info */
-		if(sa->spacedata.first==NULL) {
+		if (sa->spacedata.first==NULL) {
 			SpaceInfo *sinfo= MEM_callocN(sizeof(SpaceInfo), "spaceinfo");
 			sa->spacetype= sinfo->spacetype= SPACE_INFO;
 			BLI_addtail(&sa->spacedata, sinfo);
 		}
 		/* add local view3d too */
-		else if(sa->spacetype==SPACE_VIEW3D)
+		else if (sa->spacetype==SPACE_VIEW3D)
 			view3d_split_250(sa->spacedata.first, &sa->regionbase);
 		
 		for (sl= sa->spacedata.first; sl; sl= sl->next) {
 			link_list(fd, &(sl->regionbase));
 
-			for(ar= sl->regionbase.first; ar; ar= ar->next)
+			for (ar= sl->regionbase.first; ar; ar= ar->next)
 				direct_link_region(fd, ar, sl->spacetype);
 
 			if (sl->spacetype==SPACE_VIEW3D) {
@@ -5692,16 +5818,16 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
 				link_list(fd, &(v3d->bgpicbase));
 
 				/* should be do_versions except this doesnt fit well there */
-				if(v3d->bgpic) {
+				if (v3d->bgpic) {
 					bgpic= newdataadr(fd, v3d->bgpic);
 					BLI_addtail(&v3d->bgpicbase, bgpic);
 					v3d->bgpic= NULL;
 				}
 
-				for(bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next)
+				for (bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next)
 					bgpic->iuser.ok= 1;
 
-				if(v3d->gpd) {
+				if (v3d->gpd) {
 					v3d->gpd= newdataadr(fd, v3d->gpd);
 					direct_link_gpencil(fd, v3d->gpd);
 				}
@@ -5712,7 +5838,7 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
 				v3d->properties_storage= NULL;
 
 				/* render can be quite heavy, set to wire on load */
-				if(v3d->drawtype == OB_RENDER)
+				if (v3d->drawtype == OB_RENDER)
 					v3d->drawtype = OB_WIRE;
 				
 				view3d_split_250(v3d, &sl->regionbase);
@@ -5732,18 +5858,18 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
 				SpaceOops *soops= (SpaceOops*) sl;
 				
 				soops->treestore= newdataadr(fd, soops->treestore);
-				if(soops->treestore) {
+				if (soops->treestore) {
 					soops->treestore->data= newdataadr(fd, soops->treestore->data);
 					/* we only saved what was used */
 					soops->treestore->totelem= soops->treestore->usedelem;
 					soops->storeflag |= SO_TREESTORE_CLEANUP;	// at first draw
 				}
 			}
-			else if(sl->spacetype==SPACE_IMAGE) {
+			else if (sl->spacetype==SPACE_IMAGE) {
 				SpaceImage *sima= (SpaceImage *)sl;
 				
 				sima->cumap= newdataadr(fd, sima->cumap);
-				if(sima->cumap)
+				if (sima->cumap)
 					direct_link_curvemapping(fd, sima->cumap);
 				
 				sima->iuser.scene= NULL;
@@ -5763,52 +5889,52 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
 					direct_link_gpencil(fd, sima->gpd);
 #endif
 			}
-			else if(sl->spacetype==SPACE_NODE) {
+			else if (sl->spacetype==SPACE_NODE) {
 				SpaceNode *snode= (SpaceNode *)sl;
 				
-				if(snode->gpd) {
+				if (snode->gpd) {
 					snode->gpd= newdataadr(fd, snode->gpd);
 					direct_link_gpencil(fd, snode->gpd);
 				}
 			}
-			else if(sl->spacetype==SPACE_TIME) {
+			else if (sl->spacetype==SPACE_TIME) {
 				SpaceTime *stime= (SpaceTime *)sl;
 				stime->caches.first= stime->caches.last= NULL;
 			}
-			else if(sl->spacetype==SPACE_LOGIC) {
+			else if (sl->spacetype==SPACE_LOGIC) {
 				SpaceLogic *slogic= (SpaceLogic *)sl;
 					
-				if(slogic->gpd) {
+				if (slogic->gpd) {
 					slogic->gpd= newdataadr(fd, slogic->gpd);
 					direct_link_gpencil(fd, slogic->gpd);
 				}
 			}
-			else if(sl->spacetype==SPACE_SEQ) {
+			else if (sl->spacetype==SPACE_SEQ) {
 				SpaceSeq *sseq= (SpaceSeq *)sl;
-				if(sseq->gpd) {
+				if (sseq->gpd) {
 					sseq->gpd= newdataadr(fd, sseq->gpd);
 					direct_link_gpencil(fd, sseq->gpd);
 				}
 			}
-			else if(sl->spacetype==SPACE_BUTS) {
+			else if (sl->spacetype==SPACE_BUTS) {
 				SpaceButs *sbuts= (SpaceButs *)sl;
 				sbuts->path= NULL;
 				sbuts->texuser= NULL;
 			}
-			else if(sl->spacetype==SPACE_CONSOLE) {
+			else if (sl->spacetype==SPACE_CONSOLE) {
 				SpaceConsole *sconsole= (SpaceConsole *)sl;
 				ConsoleLine *cl, *cl_next;
 				
 				link_list(fd, &sconsole->scrollback);
 				link_list(fd, &sconsole->history);
 				
-				//for(cl= sconsole->scrollback.first; cl; cl= cl->next)
+				//for (cl= sconsole->scrollback.first; cl; cl= cl->next)
 				//	cl->line= newdataadr(fd, cl->line);
 				
-				/*comma expressions, (e.g. expr1, expr2, expr3) evalutate each expression,
-				  from left to right.  the right-most expression sets the result of the comma
-				  expression as a whole*/
-				for(cl= sconsole->history.first; cl; cl= cl_next) {
+				/* comma expressions, (e.g. expr1, expr2, expr3) evalutate each expression,
+				 * from left to right.  the right-most expression sets the result of the comma
+				 * expression as a whole*/
+				for (cl= sconsole->history.first; cl; cl= cl_next) {
 					cl_next= cl->next;
 					cl->line= newdataadr(fd, cl->line);
 					if (cl->line) {
@@ -5821,7 +5947,7 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
 					}
 				}
 			}
-			else if(sl->spacetype==SPACE_FILE) {
+			else if (sl->spacetype==SPACE_FILE) {
 				SpaceFile *sfile= (SpaceFile *)sl;
 				
 				/* this sort of info is probably irrelevant for reloading...
@@ -5851,9 +5977,9 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main)
 {
 	Main *newmain;
 	
-	for(newmain= fd->mainlist.first; newmain; newmain= newmain->next) {
-		if(newmain->curlib) {
-			if(BLI_path_cmp(newmain->curlib->filepath, lib->filepath) == 0) {
+	for (newmain= fd->mainlist.first; newmain; newmain= newmain->next) {
+		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!",
 				                 lib->name, lib->filepath);
@@ -5887,7 +6013,7 @@ static void direct_link_library(FileData *fd, Library *lib, Main *main)
 static void lib_link_library(FileData *UNUSED(fd), Main *main)
 {
 	Library *lib;
-	for(lib= main->library.first; lib; lib= lib->id.next) {
+	for (lib= main->library.first; lib; lib= lib->id.next) {
 		lib->id.us= 1;
 	}
 }
@@ -5898,7 +6024,7 @@ static void fix_relpaths_library(const char *basepath, Main *main)
 	Library *lib;
 	/* BLO_read_from_memory uses a blank filename */
 	if (basepath==NULL || basepath[0] == '\0') {
-		for(lib= main->library.first; lib; lib= lib->id.next) {
+		for (lib= main->library.first; lib; lib= lib->id.next) {
 			/* when loading a linked lib into a file which has not been saved,
 			 * there is nothing we can be relative to, so instead we need to make
 			 * it absolute. This can happen when appending an object with a relative
@@ -5910,7 +6036,7 @@ static void fix_relpaths_library(const char *basepath, Main *main)
 		}
 	}
 	else {
-		for(lib= main->library.first; lib; lib= lib->id.next) {
+		for (lib= main->library.first; lib; lib= lib->id.next) {
 			/* Libraries store both relative and abs paths, recreate relative paths,
 			 * relative to the blend file since indirectly linked libs will be relative to their direct linked library */
 			if (strncmp(lib->name, "//", 2)==0) { /* if this is relative to begin with? */
@@ -5928,8 +6054,8 @@ static void lib_link_speaker(FileData *fd, Main *main)
 	Speaker *spk;
 
 	spk= main->speaker.first;
-	while(spk) {
-		if(spk->id.flag & LIB_NEEDLINK) {
+	while (spk) {
+		if (spk->id.flag & LIB_NEEDLINK) {
 			if (spk->adt) lib_link_animdata(fd, &spk->id, spk->adt);
 
 			spk->sound= newlibadr(fd, spk->id.lib, spk->sound);
@@ -5948,8 +6074,10 @@ static void direct_link_speaker(FileData *fd, Speaker *spk)
 	spk->adt= newdataadr(fd, spk->adt);
 	direct_link_animdata(fd, spk->adt);
 
-	/*spk->sound= newdataadr(fd, spk->sound);
-	direct_link_sound(fd, spk->sound);*/
+#if 0
+	spk->sound= newdataadr(fd, spk->sound);
+	direct_link_sound(fd, spk->sound);
+#endif
 }
 
 /* ************** READ SOUND ******************* */
@@ -5961,7 +6089,7 @@ static void direct_link_sound(FileData *fd, bSound *sound)
 	sound->waveform = NULL;
 
 	// versioning stuff, if there was a cache, then we enable caching:
-	if(sound->cache)
+	if (sound->cache)
 	{
 		sound->flags |= SOUND_FLAGS_CACHING;
 		sound->cache = NULL;
@@ -5976,8 +6104,8 @@ static void lib_link_sound(FileData *fd, Main *main)
 	bSound *sound;
 
 	sound= main->sound.first;
-	while(sound) {
-		if(sound->id.flag & LIB_NEEDLINK) {
+	while (sound) {
+		if (sound->id.flag & LIB_NEEDLINK) {
 			sound->id.flag -= LIB_NEEDLINK;
 			sound->ipo= newlibadr_us(fd, sound->id.lib, sound->ipo); // XXX depreceated - old animation system
 			
@@ -5999,25 +6127,25 @@ static void lib_link_group(FileData *fd, Main *main)
 	GroupObject *go;
 	int add_us;
 	
-	while(group) {
-		if(group->id.flag & LIB_NEEDLINK) {
+	while (group) {
+		if (group->id.flag & LIB_NEEDLINK) {
 			group->id.flag -= LIB_NEEDLINK;
 			
 			add_us= 0;
 			
 			go= group->gobject.first;
-			while(go) {
+			while (go) {
 				go->ob= newlibadr(fd, group->id.lib, go->ob);
-				if(go->ob) {
+				if (go->ob) {
 					go->ob->flag |= OB_FROMGROUP;
 					/* if group has an object, it increments user... */
 					add_us= 1;
-					if(go->ob->id.us==0) 
+					if (go->ob->id.us==0)
 						go->ob->id.us= 1;
 				}
 				go= go->next;
 			}
-			if(add_us) group->id.us++;
+			if (add_us) group->id.us++;
 			rem_from_group(group, NULL, NULL, NULL);	/* removes NULL entries */
 		}
 		group= group->id.next;
@@ -6038,7 +6166,7 @@ static void direct_link_movieTracks(FileData *fd, ListBase *tracksbase)
 	link_list(fd, tracksbase);
 
 	track= tracksbase->first;
-	while(track) {
+	while (track) {
 		track->markers= newdataadr(fd, track->markers);
 
 		track= track->next;
@@ -6050,10 +6178,12 @@ static void direct_link_movieclip(FileData *fd, MovieClip *clip)
 	MovieTracking *tracking= &clip->tracking;
 	MovieTrackingObject *object;
 
-	if(fd->movieclipmap) clip->cache= newmclipadr(fd, clip->cache);
+	clip->adt= newdataadr(fd, clip->adt);
+
+	if (fd->movieclipmap) clip->cache= newmclipadr(fd, clip->cache);
 	else clip->cache= NULL;
 
-	if(fd->movieclipmap) clip->tracking.camera.intrinsics= newmclipadr(fd, clip->tracking.camera.intrinsics);
+	if (fd->movieclipmap) clip->tracking.camera.intrinsics= newmclipadr(fd, clip->tracking.camera.intrinsics);
 	else clip->tracking.camera.intrinsics= NULL;
 
 	direct_link_movieTracks(fd, &tracking->tracks);
@@ -6072,7 +6202,7 @@ static void direct_link_movieclip(FileData *fd, MovieClip *clip)
 	link_list(fd, &tracking->objects);
 
 	object= tracking->objects.first;
-	while(object) {
+	while (object) {
 		direct_link_movieTracks(fd, &object->tracks);
 		direct_link_movieReconstruction(fd, &object->reconstruction);
 
@@ -6085,8 +6215,11 @@ static void lib_link_movieclip(FileData *fd, Main *main)
 	MovieClip *clip;
 
 	clip= main->movieclip.first;
-	while(clip) {
-		if(clip->id.flag & LIB_NEEDLINK) {
+	while (clip) {
+		if (clip->id.flag & LIB_NEEDLINK) {
+			if (clip->adt)
+				lib_link_animdata(fd, &clip->id, clip->adt);
+
 			clip->gpd= newlibadr_us(fd, clip->id.lib, clip->gpd);
 
 			clip->id.flag -= LIB_NEEDLINK;
@@ -6139,7 +6272,7 @@ static BHead *read_data_into_oldnewmap(FileData *fd, BHead *bhead, const char *a
 {
 	bhead = blo_nextbhead(fd, bhead);
 
-	while(bhead && bhead->code==DATA) {
+	while (bhead && bhead->code==DATA) {
 		void *data;
 #if 0
 		/* XXX DUMB DEBUGGING OPTION TO GIVE NAMES for guarded malloc errors */
@@ -6182,7 +6315,7 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID
 	oldnewmap_insert(fd->libmap, bhead->old, id, bhead->code);	/* for ID_ID check */
 	
 	/* do after read_struct, for dna reconstruct */
-	if(bhead->code==ID_ID) {
+	if (bhead->code==ID_ID) {
 		lb= which_libbase(main, GS(id->name));
 	}
 	else {
@@ -6194,13 +6327,13 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID
 	/* clear first 8 bits */
 	id->flag= (id->flag & 0xFF00) | flag | LIB_NEEDLINK;
 	id->lib= main->curlib;
-	if(id->flag & LIB_FAKEUSER) id->us= 1;
+	if (id->flag & LIB_FAKEUSER) id->us= 1;
 	else id->us= 0;
 	id->icon_id = 0;
 	id->flag &= ~(LIB_ID_RECALC|LIB_ID_RECALC_DATA);
 
 	/* this case cannot be direct_linked: it's just the ID part */
-	if(bhead->code==ID_ID) {
+	if (bhead->code==ID_ID) {
 		return blo_nextbhead(fd, bhead);
 	}
 
@@ -6336,7 +6469,7 @@ static BHead *read_global(BlendFileData *bfd, FileData *fd, BHead *bhead)
 	bfd->globalf= fg->globalf;
 	BLI_strncpy(bfd->filename, fg->filename, sizeof(bfd->filename));
 	
-	if(G.fileflags & G_FILE_RECOVER)
+	if (G.fileflags & G_FILE_RECOVER)
 		BLI_strncpy(fd->relabase, fg->filename, sizeof(fd->relabase));
 	
 	bfd->curscreen= fg->curscreen;
@@ -6357,8 +6490,8 @@ static void link_global(FileData *fd, BlendFileData *bfd)
 	bfd->curscreen= newlibadr(fd, NULL, bfd->curscreen);
 	bfd->curscene= newlibadr(fd, NULL, bfd->curscene);
 	// this happens in files older than 2.35
-	if(bfd->curscene==NULL) {
-		if(bfd->curscreen) bfd->curscene= bfd->curscreen->scene;
+	if (bfd->curscene==NULL) {
+		if (bfd->curscreen) bfd->curscene= bfd->curscreen->scene;
 	}
 }
 
@@ -6368,12 +6501,12 @@ static void vcol_to_fcol(Mesh *me)
 	unsigned int *mcol, *mcoln, *mcolmain;
 	int a;
 
-	if(me->totface==0 || me->mcol==NULL) return;
+	if (me->totface==0 || me->mcol==NULL) return;
 
 	mcoln= mcolmain= MEM_mallocN(4*sizeof(int)*me->totface, "mcoln");
 	mcol = (unsigned int *)me->mcol;
 	mface= me->mface;
-	for(a=me->totface; a>0; a--, mface++) {
+	for (a=me->totface; a>0; a--, mface++) {
 		mcoln[0]= mcol[mface->v1];
 		mcoln[1]= mcol[mface->v2];
 		mcoln[2]= mcol[mface->v3];
@@ -6417,7 +6550,7 @@ static void do_version_bone_head_tail_237(Bone *bone)
 	mul_v3_fl(vec, bone->length);
 	add_v3_v3v3(bone->arm_tail, bone->arm_head, vec);
 
-	for(child= bone->childbase.first; child; child= child->next)
+	for (child= bone->childbase.first; child; child= child->next)
 		do_version_bone_head_tail_237(child);
 }
 
@@ -6425,13 +6558,13 @@ static void bone_version_238(ListBase *lb)
 {
 	Bone *bone;
 	
-	for(bone= lb->first; bone; bone= bone->next) {
-		if(bone->rad_tail==0.0f && bone->rad_head==0.0f) {
+	for (bone= lb->first; bone; bone= bone->next) {
+		if (bone->rad_tail==0.0f && bone->rad_head==0.0f) {
 			bone->rad_head= 0.25f*bone->length;
 			bone->rad_tail= 0.1f*bone->length;
 			
 			bone->dist-= bone->rad_head;
-			if(bone->dist<=0.0f) bone->dist= 0.0f;
+			if (bone->dist<=0.0f) bone->dist= 0.0f;
 		}
 		bone_version_238(&bone->childbase);
 	}
@@ -6441,8 +6574,8 @@ static void bone_version_239(ListBase *lb)
 {
 	Bone *bone;
 	
-	for(bone= lb->first; bone; bone= bone->next) {
-		if(bone->layer==0) 
+	for (bone= lb->first; bone; bone= bone->next) {
+		if (bone->layer==0)
 			bone->layer= 1;
 		bone_version_239(&bone->childbase);
 	}
@@ -6452,10 +6585,10 @@ static void ntree_version_241(bNodeTree *ntree)
 {
 	bNode *node;
 	
-	if(ntree->type==NTREE_COMPOSIT) {
-		for(node= ntree->nodes.first; node; node= node->next) {
-			if(node->type==CMP_NODE_BLUR) {
-				if(node->storage==NULL) {
+	if (ntree->type==NTREE_COMPOSIT) {
+		for (node= ntree->nodes.first; node; node= node->next) {
+			if (node->type==CMP_NODE_BLUR) {
+				if (node->storage==NULL) {
 					NodeBlurData *nbd= MEM_callocN(sizeof(NodeBlurData), "node blur patch");
 					nbd->sizex= node->custom1;
 					nbd->sizey= node->custom2;
@@ -6463,8 +6596,8 @@ static void ntree_version_241(bNodeTree *ntree)
 					node->storage= nbd;
 				}
 			}
-			else if(node->type==CMP_NODE_VECBLUR) {
-				if(node->storage==NULL) {
+			else if (node->type==CMP_NODE_VECBLUR) {
+				if (node->storage==NULL) {
 					NodeBlurData *nbd= MEM_callocN(sizeof(NodeBlurData), "node blur patch");
 					nbd->samples= node->custom1;
 					nbd->maxspeed= node->custom2;
@@ -6480,49 +6613,24 @@ static void ntree_version_242(bNodeTree *ntree)
 {
 	bNode *node;
 	
-	if(ntree->type==NTREE_COMPOSIT) {
-		for(node= ntree->nodes.first; node; node= node->next) {
-			if(node->type==CMP_NODE_HUE_SAT) {
-				if(node->storage) {
+	if (ntree->type==NTREE_COMPOSIT) {
+		for (node= ntree->nodes.first; node; node= node->next) {
+			if (node->type==CMP_NODE_HUE_SAT) {
+				if (node->storage) {
 					NodeHueSat *nhs= node->storage;
-					if(nhs->val==0.0f) nhs->val= 1.0f;
+					if (nhs->val==0.0f) nhs->val= 1.0f;
 				}
 			}
 		}
 	}
-	else if(ntree->type==NTREE_SHADER) {
-		for(node= ntree->nodes.first; node; node= node->next)
-			if(node->type == SH_NODE_GEOMETRY && node->storage == NULL)
+	else if (ntree->type==NTREE_SHADER) {
+		for (node= ntree->nodes.first; node; node= node->next)
+			if (node->type == SH_NODE_GEOMETRY && node->storage == NULL)
 				node->storage= MEM_callocN(sizeof(NodeGeometry), "NodeGeometry");
 	}
 	
 }
 
-
-/* somehow, probably importing via python, keyblock adrcodes are not in order */
-static void sort_shape_fix(Main *main)
-{
-	Key *key;
-	KeyBlock *kb;
-	int sorted= 0;
-	
-	while(sorted==0) {
-		sorted= 1;
-		for(key= main->key.first; key; key= key->id.next) {
-			for(kb= key->block.first; kb; kb= kb->next) {
-				if(kb->next && kb->adrcode>kb->next->adrcode) {
-					KeyBlock *next= kb->next;
-					BLI_remlink(&key->block, kb);
-					BLI_insertlink(&key->block, next, kb);
-					kb= next;
-					sorted= 0;
-				}
-			}
-		}
-		if(sorted==0) printf("warning, shape keys were sorted incorrect, fixed it!\n");
-	}
-}
-
 static void customdata_version_242(Mesh *me)
 {
 	CustomDataLayer *layer;
@@ -6601,7 +6709,7 @@ static void customdata_version_242(Mesh *me)
 		}
 	}
 
-	mesh_update_customdata_pointers(me);
+	mesh_update_customdata_pointers(me, TRUE);
 }
 
 /*only copy render texface layer from active*/
@@ -6621,11 +6729,11 @@ static void do_version_ntree_242_2(bNodeTree *ntree)
 {
 	bNode *node;
 	
-	if(ntree->type==NTREE_COMPOSIT) {
-		for(node= ntree->nodes.first; node; node= node->next) {
-			if(ELEM3(node->type, CMP_NODE_IMAGE, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
+	if (ntree->type==NTREE_COMPOSIT) {
+		for (node= ntree->nodes.first; node; node= node->next) {
+			if (ELEM3(node->type, CMP_NODE_IMAGE, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
 				/* only image had storage */
-				if(node->storage) {
+				if (node->storage) {
 					NodeImageAnim *nia= node->storage;
 					ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "ima user node");
 
@@ -6658,27 +6766,27 @@ static void ntree_version_245(FileData *fd, Library *lib, bNodeTree *ntree)
 	Image *image;
 	ImageUser *iuser;
 
-	if(ntree->type==NTREE_COMPOSIT) {
-		for(node= ntree->nodes.first; node; node= node->next) {
-			if(node->type == CMP_NODE_ALPHAOVER) {
-				if(!node->storage) {
+	if (ntree->type==NTREE_COMPOSIT) {
+		for (node= ntree->nodes.first; node; node= node->next) {
+			if (node->type == CMP_NODE_ALPHAOVER) {
+				if (!node->storage) {
 					ntf= MEM_callocN(sizeof(NodeTwoFloats), "NodeTwoFloats");
 					node->storage= ntf;
-					if(node->custom1)
+					if (node->custom1)
 						ntf->x= 1.0f;
 				}
 			}
 			
 			/* fix for temporary flag changes during 245 cycle */
 			nodeid= newlibadr(fd, lib, node->id);
-			if(node->storage && nodeid && GS(nodeid->name) == ID_IM) {
+			if (node->storage && nodeid && GS(nodeid->name) == ID_IM) {
 				image= (Image*)nodeid;
 				iuser= node->storage;
-				if(iuser->flag & IMA_OLD_PREMUL) {
+				if (iuser->flag & IMA_OLD_PREMUL) {
 					iuser->flag &= ~IMA_OLD_PREMUL;
 					iuser->flag |= IMA_DO_PREMUL;
 				}
-				if(iuser->flag & IMA_DO_PREMUL) {
+				if (iuser->flag & IMA_DO_PREMUL) {
 					image->flag &= ~IMA_OLD_PREMUL;
 					image->flag |= IMA_DO_PREMUL;
 				}
@@ -6721,27 +6829,27 @@ static void alphasort_version_246(FileData *fd, Library *lib, Mesh *me)
 	int a, b, texalpha;
 
 	/* verify we have a tface layer */
-	for(b=0; b<me->fdata.totlayer; b++)
-		if(me->fdata.layers[b].type == CD_MTFACE)
+	for (b=0; b<me->fdata.totlayer; b++)
+		if (me->fdata.layers[b].type == CD_MTFACE)
 			break;
 	
-	if(b == me->fdata.totlayer)
+	if (b == me->fdata.totlayer)
 		return;
 
 	/* if we do, set alpha sort if the game engine did it before */
-	for(a=0, mf=me->mface; a<me->totface; a++, mf++) {
-		if(mf->mat_nr < me->totcol) {
+	for (a=0, mf=me->mface; a<me->totface; a++, mf++) {
+		if (mf->mat_nr < me->totcol) {
 			ma= newlibadr(fd, lib, me->mat[mf->mat_nr]);
 			texalpha = 0;
 
 			/* we can't read from this if it comes from a library,
 			 * because direct_link might not have happened on it,
 			 * so ma->mtex is not pointing to valid memory yet */
-			if(ma && ma->id.lib)
+			if (ma && ma->id.lib)
 				ma= NULL;
 
-			for(b=0; ma && b<MAX_MTEX; b++)
-				if(ma->mtex && ma->mtex[b] && ma->mtex[b]->mapto & MAP_ALPHA)
+			for (b=0; ma && b<MAX_MTEX; b++)
+				if (ma->mtex && ma->mtex[b] && ma->mtex[b]->mapto & MAP_ALPHA)
 					texalpha = 1;
 		}
 		else {
@@ -6749,13 +6857,13 @@ static void alphasort_version_246(FileData *fd, Library *lib, Mesh *me)
 			texalpha = 0;
 		}
 
-		for(b=0; b<me->fdata.totlayer; b++) {
-			if(me->fdata.layers[b].type == CD_MTFACE) {
+		for (b=0; b<me->fdata.totlayer; b++) {
+			if (me->fdata.layers[b].type == CD_MTFACE) {
 				tf = ((MTFace*)me->fdata.layers[b].data) + a;
 
 				tf->mode &= ~TF_ALPHASORT;
-				if(ma && (ma->mode & MA_ZTRANSP))
-					if(ELEM(tf->transp, TF_ALPHA, TF_ADD) || (texalpha && (tf->transp != TF_CLIP)))
+				if (ma && (ma->mode & MA_ZTRANSP))
+					if (ELEM(tf->transp, TF_ALPHA, TF_ADD) || (texalpha && (tf->transp != TF_CLIP)))
 						tf->mode |= TF_ALPHASORT;
 			}
 		}
@@ -6769,12 +6877,12 @@ static void area_add_header_region(ScrArea *sa, ListBase *lb)
 	
 	BLI_addtail(lb, ar);
 	ar->regiontype= RGN_TYPE_HEADER;
-	if(sa->headertype==HEADERDOWN)
+	if (sa->headertype==HEADERDOWN)
 		ar->alignment= RGN_ALIGN_BOTTOM;
 	else
 		ar->alignment= RGN_ALIGN_TOP;
 	
-	/* initialise view2d data for header region, to allow panning */
+	/* initialize view2d data for header region, to allow panning */
 	/* is copy from ui_view2d.c */
 	ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_LIMITZOOM|V2D_KEEPASPECT);
 	ar->v2d.keepofs = V2D_LOCKOFS_Y;
@@ -6793,10 +6901,10 @@ static void sequencer_init_preview_region(ARegion* ar)
 	ar->v2d.keepzoom= V2D_KEEPASPECT | V2D_KEEPZOOM;
 	ar->v2d.minzoom= 0.00001f;
 	ar->v2d.maxzoom= 100000.0f;
-	ar->v2d.tot.xmin= -960.0f; /* 1920 width centered */
-	ar->v2d.tot.ymin= -540.0f; /* 1080 height centered */
-	ar->v2d.tot.xmax= 960.0f;
-	ar->v2d.tot.ymax= 540.0f;
+	ar->v2d.tot.xmin = -960.0f; /* 1920 width centered */
+	ar->v2d.tot.ymin = -540.0f; /* 1080 height centered */
+	ar->v2d.tot.xmax = 960.0f;
+	ar->v2d.tot.ymax = 540.0f;
 	ar->v2d.min[0]= 0.0f;
 	ar->v2d.min[1]= 0.0f;
 	ar->v2d.max[0]= 12000.0f;
@@ -6812,7 +6920,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
 	ARegion *ar;
 	ARegion *ar_main;
 
-	if(sl) {
+	if (sl) {
 		/* first channels for ipo action nla... */
 		switch(sl->spacetype) {
 			case SPACE_IPO:
@@ -6933,7 +7041,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
 	
 	ar->regiontype= RGN_TYPE_WINDOW;
 	
-	if(sl) {
+	if (sl) {
 		/* if active spacetype has view2d data, copy that over to main region */
 		/* and we split view3d */
 		switch(sl->spacetype) {
@@ -6965,7 +7073,7 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
 				ar->v2d.align |= V2D_ALIGN_NO_NEG_Y;
 				ar->v2d.keepofs |= V2D_LOCKOFS_Y;
 				ar->v2d.keepzoom |= V2D_LOCKZOOM_Y;
-				ar->v2d.tot.ymin= ar->v2d.cur.ymin= -10.0;
+				ar->v2d.tot.ymin = ar->v2d.cur.ymin = -10.0;
 				ar->v2d.min[1]= ar->v2d.max[1]= 20.0;
 			}
 				break;
@@ -6992,8 +7100,8 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
 				SpaceNla *snla= (SpaceNla *)sl;
 				memcpy(&ar->v2d, &snla->v2d, sizeof(View2D));
 				
-				ar->v2d.tot.ymin= (float)(-sa->winy)/3.0f;
-				ar->v2d.tot.ymax= 0.0f;
+				ar->v2d.tot.ymin = (float)(-sa->winy)/3.0f;
+				ar->v2d.tot.ymax = 0.0f;
 				
 				ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
 				ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
@@ -7006,10 +7114,10 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
 				SpaceAction *saction= (SpaceAction *)sl;
 				
 				/* we totally reinit the view for the Action Editor, as some old instances had some weird cruft set */
-				ar->v2d.tot.xmin= -20.0f;
-				ar->v2d.tot.ymin= (float)(-sa->winy)/3.0f;
-				ar->v2d.tot.xmax= (float)((sa->winx > 120)? (sa->winx) : 120);
-				ar->v2d.tot.ymax= 0.0f;
+				ar->v2d.tot.xmin = -20.0f;
+				ar->v2d.tot.ymin = (float)(-sa->winy)/3.0f;
+				ar->v2d.tot.xmax = (float)((sa->winx > 120)? (sa->winx) : 120);
+				ar->v2d.tot.ymax = 0.0f;
 				
 				ar->v2d.cur= ar->v2d.tot;
 				
@@ -7094,23 +7202,23 @@ static void do_versions_windowmanager_2_50(bScreen *screen)
 	SpaceLink *sl;
 	
 	/* add regions */
-	for(sa= screen->areabase.first; sa; sa= sa->next) {
+	for (sa= screen->areabase.first; sa; sa= sa->next) {
 		
 		/* we keep headertype variable to convert old files only */
-		if(sa->headertype)
+		if (sa->headertype)
 			area_add_header_region(sa, &sa->regionbase);
 		
 		area_add_window_regions(sa, sa->spacedata.first, &sa->regionbase);
 		
 		/* space imageselect is deprecated */
-		for(sl= sa->spacedata.first; sl; sl= sl->next) {
-			if(sl->spacetype==SPACE_IMASEL)
+		for (sl= sa->spacedata.first; sl; sl= sl->next) {
+			if (sl->spacetype==SPACE_IMASEL)
 				sl->spacetype= SPACE_EMPTY;	/* spacedata then matches */
 		}
 		
 		/* space sound is deprecated */
-		for(sl= sa->spacedata.first; sl; sl= sl->next) {
-			if(sl->spacetype==SPACE_SOUND)
+		for (sl= sa->spacedata.first; sl; sl= sl->next) {
+			if (sl->spacetype==SPACE_SOUND)
 				sl->spacetype= SPACE_EMPTY;	/* spacedata then matches */
 		}
 		
@@ -7118,10 +7226,10 @@ static void do_versions_windowmanager_2_50(bScreen *screen)
 		sa->butspacetype= sa->spacetype;
 		
 		/* pushed back spaces also need regions! */
-		if(sa->spacedata.first) {
+		if (sa->spacedata.first) {
 			sl= sa->spacedata.first;
-			for(sl= sl->next; sl; sl= sl->next) {
-				if(sa->headertype)
+			for (sl= sl->next; sl; sl= sl->next) {
+				if (sa->headertype)
 					area_add_header_region(sa, &sl->regionbase);
 				area_add_window_regions(sa, sl, &sl->regionbase);
 			}
@@ -7140,7 +7248,7 @@ static void versions_gpencil_add_main(ListBase *lb, ID *id, const char *name)
 	new_id(lb, id, name);
 	/* alphabetic insterion: is in new_id */
 	
-	if(G.f & G_DEBUG)
+	if (G.debug & G_DEBUG)
 		printf("Converted GPencil to ID: %s\n", id->name+2);
 }
 
@@ -7150,25 +7258,25 @@ static void do_versions_gpencil_2_50(Main *main, bScreen *screen)
 	SpaceLink *sl;
 	
 	/* add regions */
-	for(sa= screen->areabase.first; sa; sa= sa->next) {
-		for(sl= sa->spacedata.first; sl; sl= sl->next) {
+	for (sa= screen->areabase.first; sa; sa= sa->next) {
+		for (sl= sa->spacedata.first; sl; sl= sl->next) {
 			if (sl->spacetype==SPACE_VIEW3D) {
 				View3D *v3d= (View3D*) sl;
-				if(v3d->gpd) {
+				if (v3d->gpd) {
 					versions_gpencil_add_main(&main->gpencil, (ID *)v3d->gpd, "GPencil View3D");
 					v3d->gpd= NULL;
 				}
 			}
 			else if (sl->spacetype==SPACE_NODE) {
 				SpaceNode *snode= (SpaceNode *)sl;
-				if(snode->gpd) {
+				if (snode->gpd) {
 					versions_gpencil_add_main(&main->gpencil, (ID *)snode->gpd, "GPencil Node");
 					snode->gpd= NULL;
 				}
 			}
 			else if (sl->spacetype==SPACE_SEQ) {
 				SpaceSeq *sseq= (SpaceSeq *)sl;
-				if(sseq->gpd) {
+				if (sseq->gpd) {
 					versions_gpencil_add_main(&main->gpencil, (ID *)sseq->gpd, "GPencil Node");
 					sseq->gpd= NULL;
 				}
@@ -7176,7 +7284,7 @@ static void do_versions_gpencil_2_50(Main *main, bScreen *screen)
 			else if (sl->spacetype==SPACE_IMAGE) {
 				SpaceImage *sima= (SpaceImage *)sl;
 #if 0			/* see comment on r28002 */
-				if(sima->gpd) {
+				if (sima->gpd) {
 					versions_gpencil_add_main(&main->gpencil, (ID *)sima->gpd, "GPencil Image");
 					sima->gpd= NULL;
 				}
@@ -7194,8 +7302,8 @@ static PartEff *do_version_give_parteff_245(Object *ob)
 	PartEff *paf;
 
 	paf= ob->effect.first;
-	while(paf) {
-		if(paf->type==EFF_PARTICLE) return paf;
+	while (paf) {
+		if (paf->type==EFF_PARTICLE) return paf;
 		paf= paf->next;
 	}
 	return NULL;
@@ -7204,9 +7312,9 @@ static void do_version_free_effect_245(Effect *eff)
 {
 	PartEff *paf;
 
-	if(eff->type==EFF_PARTICLE) {
+	if (eff->type==EFF_PARTICLE) {
 		paf= (PartEff *)eff;
-		if(paf->keys) MEM_freeN(paf->keys);
+		if (paf->keys) MEM_freeN(paf->keys);
 	}
 	MEM_freeN(eff);
 }
@@ -7215,7 +7323,7 @@ static void do_version_free_effects_245(ListBase *lb)
 	Effect *eff;
 
 	eff= lb->first;
-	while(eff) {
+	while (eff) {
 		BLI_remlink(lb, eff);
 		do_version_free_effect_245(eff);
 		eff= lb->first;
@@ -7228,20 +7336,20 @@ static void do_version_mtex_factor_2_50(MTex **mtex_array, short idtype)
 	float varfac, colfac;
 	int a, neg;
 
-	if(!mtex_array)
+	if (!mtex_array)
 		return;
 
-	for(a=0; a<MAX_MTEX; a++) {
-		if(mtex_array[a]) {
+	for (a=0; a<MAX_MTEX; a++) {
+		if (mtex_array[a]) {
 			mtex= mtex_array[a];
 
 			neg= mtex->maptoneg;
 			varfac= mtex->varfac;
 			colfac= mtex->colfac;
 
-			if(neg & MAP_DISP) mtex->dispfac= -mtex->dispfac;
-			if(neg & MAP_NORM) mtex->norfac= -mtex->norfac;
-			if(neg & MAP_WARP) mtex->warpfac= -mtex->warpfac;
+			if (neg & MAP_DISP) mtex->dispfac= -mtex->dispfac;
+			if (neg & MAP_NORM) mtex->norfac= -mtex->norfac;
+			if (neg & MAP_WARP) mtex->warpfac= -mtex->warpfac;
 
 			mtex->colspecfac= (neg & MAP_COLSPEC)? -colfac: colfac;
 			mtex->mirrfac= (neg & MAP_COLMIR)? -colfac: colfac;
@@ -7276,11 +7384,11 @@ static void do_version_mtex_factor_2_50(MTex **mtex_array, short idtype)
 			mtex->zendownfac= (neg & WOMAP_ZENDOWN)? -colfac: colfac;
 			mtex->blendfac= (neg & WOMAP_BLEND)? -varfac: varfac;
 
-			if(idtype == ID_MA)
+			if (idtype == ID_MA)
 				mtex->colfac= (neg & MAP_COL)? -colfac: colfac;
-			else if(idtype == ID_LA)
+			else if (idtype == ID_LA)
 				mtex->colfac= (neg & LAMAP_COL)? -colfac: colfac;
-			else if(idtype == ID_WO)
+			else if (idtype == ID_WO)
 				mtex->colfac= (neg & WOMAP_HORIZ)? -colfac: colfac;
 		}
 	}
@@ -7292,14 +7400,14 @@ static void do_version_mdef_250(Main *main)
 	ModifierData *md;
 	MeshDeformModifierData *mmd;
 
-	for(ob= main->object.first; ob; ob=ob->id.next) {
-		for(md=ob->modifiers.first; md; md=md->next) {
-			if(md->type == eModifierType_MeshDeform) {
+	for (ob= main->object.first; ob; ob=ob->id.next) {
+		for (md=ob->modifiers.first; md; md=md->next) {
+			if (md->type == eModifierType_MeshDeform) {
 				mmd= (MeshDeformModifierData*)md;
 
-				if(mmd->bindcos) {
+				if (mmd->bindcos) {
 					/* make bindcos NULL in order to trick older versions
-					   into thinking that the mesh was not bound yet */
+					 * into thinking that the mesh was not bound yet */
 					mmd->bindcagecos= mmd->bindcos;
 					mmd->bindcos= NULL;
 
@@ -7315,17 +7423,17 @@ static void do_version_constraints_radians_degrees_250(ListBase *lb)
 	bConstraint *con;
 
 	for	(con=lb->first; con; con=con->next) {
-		if(con->type==CONSTRAINT_TYPE_RIGIDBODYJOINT) {
+		if (con->type==CONSTRAINT_TYPE_RIGIDBODYJOINT) {
 			bRigidBodyJointConstraint *data = con->data;
 			data->axX *= (float)(M_PI/180.0);
 			data->axY *= (float)(M_PI/180.0);
 			data->axZ *= (float)(M_PI/180.0);
 		}
-		else if(con->type==CONSTRAINT_TYPE_KINEMATIC) {
+		else if (con->type==CONSTRAINT_TYPE_KINEMATIC) {
 			bKinematicConstraint *data = con->data;
 			data->poleangle *= (float)(M_PI/180.0);
 		}
-		else if(con->type==CONSTRAINT_TYPE_ROTLIMIT) {
+		else if (con->type==CONSTRAINT_TYPE_ROTLIMIT) {
 			bRotLimitConstraint *data = con->data;
 
 			data->xmin *= (float)(M_PI/180.0);
@@ -7362,7 +7470,7 @@ static void do_versions_seq_unique_name_all_strips(
 {
 	Sequence * seq = seqbasep->first;
 
-	while(seq) {
+	while (seq) {
 		seqbase_unique_name_recursive(&sce->ed->seqbase, seq);
 		if (seq->seqbase.first) {
 			do_versions_seq_unique_name_all_strips(
@@ -7381,7 +7489,7 @@ static void do_version_bone_roll_256(Bone *bone)
 	copy_m3_m4(submat, bone->arm_mat);
 	mat3_to_vec_roll(submat, NULL, &bone->arm_roll);
 	
-	for(child = bone->childbase.first; child; child = child->next)
+	for (child = bone->childbase.first; child; child = child->next)
 		do_version_bone_roll_256(child);
 }
 
@@ -7406,7 +7514,7 @@ void convert_tface_mt(FileData *fd, Main *main)
 		gmain = G.main;
 		G.main = main;
 
-		if(!(do_version_tface(main, 1))) {
+		if (!(do_version_tface(main, 1))) {
 			BKE_report(fd->reports, RPT_WARNING, "Texface conversion problem. Error in console");
 		}
 
@@ -7432,8 +7540,8 @@ static void do_version_ntree_tex_mapping_260(void *UNUSED(data), ID *UNUSED(id),
 {
 	bNode *node;
 
-	for(node=ntree->nodes.first; node; node=node->next) {
-		if(node->type == SH_NODE_MAPPING) {
+	for (node=ntree->nodes.first; node; node=node->next) {
+		if (node->type == SH_NODE_MAPPING) {
 			TexMapping *tex_mapping;
 
 			tex_mapping= node->storage;
@@ -7492,15 +7600,16 @@ static void do_versions_nodetree_convert_angle(bNodeTree *ntree)
 
 void do_versions_image_settings_2_60(Scene *sce)
 {
-	/* note: rd->subimtype is moved into indervidual settings now and no longer
+	/* note: rd->subimtype is moved into individual settings now and no longer
 	 * exists */
 	RenderData *rd= &sce->r;
 	ImageFormatData *imf= &sce->r.im_format;
 
-	imf->imtype= rd->imtype;
-	imf->planes= rd->planes;
-	imf->compress= rd->quality;
-	imf->quality= rd->quality;
+	/* we know no data loss happens here, the old values were in char range */
+	imf->imtype=   (char)rd->imtype;
+	imf->planes=   (char)rd->planes;
+	imf->compress= (char)rd->quality;
+	imf->quality=  (char)rd->quality;
 
 	/* default, was stored in multiple places, may override later */
 	imf->depth= R_IMF_CHAN_DEPTH_8;
@@ -7575,28 +7684,93 @@ static void do_versions_nodetree_socket_use_flags_2_62(bNodeTree *ntree)
 	}
 }
 
-/* set the SOCK_AUTO_HIDDEN flag on collapsed nodes */
-static void do_versions_nodetree_socket_auto_hidden_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->flag & NODE_HIDDEN) {
-			for (sock=node->inputs.first; sock; sock=sock->next) {
-				if (sock->link==NULL)
-					sock->flag |= SOCK_AUTO_HIDDEN;
+		if (node->type==CMP_NODE_OUTPUT_FILE) {
+			/* previous CMP_NODE_OUTPUT_FILE nodes get converted to multi-file outputs */
+			NodeImageFile *old_data = node->storage;
+			NodeImageMultiFile *nimf= MEM_callocN(sizeof(NodeImageMultiFile), "node image multi file");
+			bNodeSocket *old_image = BLI_findlink(&node->inputs, 0);
+			bNodeSocket *old_z = BLI_findlink(&node->inputs, 1);
+			bNodeSocket *sock;
+			
+			node->storage= nimf;
+			
+			BLI_strncpy(nimf->base_path, old_data->name, sizeof(nimf->base_path));
+			nimf->format = old_data->im_format;
+			
+			/* if z buffer is saved, change the image type to multilayer exr.
+			 * XXX this is slightly messy, Z buffer was ignored before for anything but EXR and IRIS ...
+			 * i'm just assuming here that IRIZ means IRIS with z buffer ...
+			 */
+			if (ELEM(old_data->im_format.imtype, R_IMF_IMTYPE_IRIZ, R_IMF_IMTYPE_OPENEXR)) {
+				nimf->format.imtype = R_IMF_IMTYPE_MULTILAYER;
+				sock = ntreeCompositOutputFileAddSocket(ntree, node, old_image->name, &nimf->format);
+				if (old_image->link) {
+					old_image->link->tosock = sock;
+					sock->link = old_image->link;
+				}
+				sock = ntreeCompositOutputFileAddSocket(ntree, node, old_z->name, &nimf->format);
+				if (old_z->link) {
+					old_z->link->tosock = sock;
+					sock->link = old_z->link;
+				}
 			}
-			for(sock=node->outputs.first; sock; sock= sock->next) {
-				if(nodeCountSocketLinks(ntree, sock)==0)
-					sock->flag |= SOCK_AUTO_HIDDEN;
+			else {
+				/* saves directly to base path, which is the old image output path */
+				sock = ntreeCompositOutputFileAddSocket(ntree, node, "", &nimf->format);
+				if (old_image->link) {
+					old_image->link->tosock = sock;
+					sock->link = old_image->link;
+				}
 			}
+			
+			nodeRemoveSocket(ntree, node, old_image);
+			nodeRemoveSocket(ntree, node, old_z);
+			MEM_freeN(old_data);
 		}
-		else {
-			for(sock=node->inputs.first; sock; sock= sock->next)
-				sock->flag &= ~SOCK_AUTO_HIDDEN;
-			for(sock=node->outputs.first; sock; sock= sock->next)
-				sock->flag &= ~SOCK_AUTO_HIDDEN;
+		else if (node->type==CMP_NODE_OUTPUT_MULTI_FILE__DEPRECATED) {
+			NodeImageMultiFile *nimf = node->storage;
+			
+			/* CMP_NODE_OUTPUT_MULTI_FILE has been redeclared as CMP_NODE_OUTPUT_FILE */
+			node->type = CMP_NODE_OUTPUT_FILE;
+			
+			/* initialize the node-wide image format from render data, if available */
+			if (sce)
+				nimf->format = sce->r.im_format;
+			
+			/* transfer render format toggle to node format toggle */
+			for (sock=node->inputs.first; sock; sock=sock->next) {
+				NodeImageMultiFileSocket *simf = sock->storage;
+				simf->use_node_format = simf->use_render_format;
+			}
+			
+			/* we do have preview now */
+			node->flag |= NODE_PREVIEW;
+		}
+	}
+}
+
+/* blue and red are swapped pre 2.62.1, be sane (red == red) now! */
+static void do_versions_mesh_mloopcol_swap_2_62_1(Mesh *me)
+{
+	CustomDataLayer *layer;
+	MLoopCol *mloopcol;
+	int a;
+	int i;
+
+	for (a = 0; a < me->ldata.totlayer; a++) {
+		layer = &me->ldata.layers[a];
+
+		if (layer->type == CD_MLOOPCOL) {
+			mloopcol = (MLoopCol *)layer->data;
+			for (i = 0; i < me->totloop; i++, mloopcol++) {
+				SWAP(char, mloopcol->r, mloopcol->b);
+			}
 		}
 	}
 }
@@ -7605,17 +7779,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 {
 	/* WATCH IT!!!: pointers from libdata have not been converted */
 
-	if(G.f & G_DEBUG)
+	if (G.debug & G_DEBUG)
 		printf("read file %s\n  Version %d sub %d svn r%d\n", fd->relabase, main->versionfile, main->subversionfile, main->revision);
 	
-	if(main->versionfile == 100) {
+	if (main->versionfile == 100) {
 		/* tex->extend and tex->imageflag have changed: */
 		Tex *tex = main->tex.first;
-		while(tex) {
-			if(tex->id.flag & LIB_NEEDLINK) {
+		while (tex) {
+			if (tex->id.flag & LIB_NEEDLINK) {
 
-				if(tex->extend==0) {
-					if(tex->xrepeat || tex->yrepeat) tex->extend= TEX_REPEAT;
+				if (tex->extend==0) {
+					if (tex->xrepeat || tex->yrepeat) tex->extend= TEX_REPEAT;
 					else {
 						tex->extend= TEX_EXTEND;
 						tex->xrepeat= tex->yrepeat= 1;
@@ -7626,87 +7800,87 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			tex= tex->id.next;
 		}
 	}
-	if(main->versionfile <= 101) {
+	if (main->versionfile <= 101) {
 		/* frame mapping */
 		Scene *sce = main->scene.first;
-		while(sce) {
+		while (sce) {
 			sce->r.framapto= 100;
 			sce->r.images= 100;
 			sce->r.framelen= 1.0;
 			sce= sce->id.next;
 		}
 	}
-	if(main->versionfile <= 102) {
+	if (main->versionfile <= 102) {
 		/* init halo's at 1.0 */
 		Material *ma = main->mat.first;
-		while(ma) {
+		while (ma) {
 			ma->add= 1.0;
 			ma= ma->id.next;
 		}
 	}
-	if(main->versionfile <= 103) {
+	if (main->versionfile <= 103) {
 		/* new variable in object: colbits */
 		Object *ob = main->object.first;
 		int a;
-		while(ob) {
+		while (ob) {
 			ob->colbits= 0;
-			if(ob->totcol) {
-				for(a=0; a<ob->totcol; a++) {
-					if(ob->mat[a]) ob->colbits |= (1<<a);
+			if (ob->totcol) {
+				for (a=0; a<ob->totcol; a++) {
+					if (ob->mat[a]) ob->colbits |= (1<<a);
 				}
 			}
 			ob= ob->id.next;
 		}
 	}
-	if(main->versionfile <= 104) {
+	if (main->versionfile <= 104) {
 		/* timeoffs moved */
 		Object *ob = main->object.first;
-		while(ob) {
-			if(ob->transflag & 1) {
+		while (ob) {
+			if (ob->transflag & 1) {
 				ob->transflag -= 1;
 				//ob->ipoflag |= OB_OFFS_OB;
 			}
 			ob= ob->id.next;
 		}
 	}
-	if(main->versionfile <= 105) {
+	if (main->versionfile <= 105) {
 		Object *ob = main->object.first;
-		while(ob) {
+		while (ob) {
 			ob->dupon= 1; ob->dupoff= 0;
 			ob->dupsta= 1; ob->dupend= 100;
 			ob= ob->id.next;
 		}
 	}
-	if(main->versionfile <= 106) {
+	if (main->versionfile <= 106) {
 		/* mcol changed */
 		Mesh *me = main->mesh.first;
-		while(me) {
-			if(me->mcol) vcol_to_fcol(me);
+		while (me) {
+			if (me->mcol) vcol_to_fcol(me);
 			me= me->id.next;
 		}
 
 	}
-	if(main->versionfile <= 107) {
+	if (main->versionfile <= 107) {
 		Object *ob;
 		Scene *sce = main->scene.first;
-		while(sce) {
+		while (sce) {
 			sce->r.mode |= R_GAMMA;
 			sce= sce->id.next;
 		}
 		ob= main->object.first;
-		while(ob) {
+		while (ob) {
 			//ob->ipoflag |= OB_OFFS_PARENT;
-			if(ob->dt==0) ob->dt= OB_SOLID;
+			if (ob->dt==0) ob->dt= OB_SOLID;
 			ob= ob->id.next;
 		}
 
 	}
-	if(main->versionfile <= 109) {
+	if (main->versionfile <= 109) {
 		/* new variable: gridlines */
 		bScreen *sc = main->screen.first;
-		while(sc) {
+		while (sc) {
 			ScrArea *sa= sc->areabase.first;
-			while(sa) {
+			while (sa) {
 				SpaceLink *sl= sa->spacedata.first;
 				while (sl) {
 					if (sl->spacetype==SPACE_VIEW3D) {
@@ -7721,17 +7895,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			sc= sc->id.next;
 		}
 	}
-	if(main->versionfile <= 113) {
+	if (main->versionfile <= 113) {
 		Material *ma = main->mat.first;
-		while(ma) {
-			if(ma->flaresize==0.0f) ma->flaresize= 1.0f;
+		while (ma) {
+			if (ma->flaresize==0.0f) ma->flaresize= 1.0f;
 			ma->subsize= 1.0f;
 			ma->flareboost= 1.0f;
 			ma= ma->id.next;
 		}
 	}
 
-	if(main->versionfile <= 134) {
+	if (main->versionfile <= 134) {
 		Tex *tex = main->tex.first;
 		while (tex) {
 			if ((tex->rfac == 0.0f) &&
@@ -7745,7 +7919,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			tex = tex->id.next;
 		}
 	}
-	if(main->versionfile <= 140) {
+	if (main->versionfile <= 140) {
 		/* r-g-b-fac in texture */
 		Tex *tex = main->tex.first;
 		while (tex) {
@@ -7760,54 +7934,54 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			tex = tex->id.next;
 		}
 	}
-	if(main->versionfile <= 153) {
+	if (main->versionfile <= 153) {
 		Scene *sce = main->scene.first;
-		while(sce) {
-			if(sce->r.blurfac==0.0f) sce->r.blurfac= 1.0f;
+		while (sce) {
+			if (sce->r.blurfac==0.0f) sce->r.blurfac= 1.0f;
 			sce= sce->id.next;
 		}
 	}
-	if(main->versionfile <= 163) {
+	if (main->versionfile <= 163) {
 		Scene *sce = main->scene.first;
-		while(sce) {
-			if(sce->r.frs_sec==0) sce->r.frs_sec= 25;
+		while (sce) {
+			if (sce->r.frs_sec==0) sce->r.frs_sec= 25;
 			sce= sce->id.next;
 		}
 	}
-	if(main->versionfile <= 164) {
+	if (main->versionfile <= 164) {
 		Mesh *me= main->mesh.first;
-		while(me) {
+		while (me) {
 			me->smoothresh= 30;
 			me= me->id.next;
 		}
 	}
-	if(main->versionfile <= 165) {
+	if (main->versionfile <= 165) {
 		Mesh *me= main->mesh.first;
 		TFace *tface;
 		int nr;
 		char *cp;
 
-		while(me) {
-			if(me->tface) {
+		while (me) {
+			if (me->tface) {
 				nr= me->totface;
 				tface= me->tface;
-				while(nr--) {
+				while (nr--) {
 					cp= (char *)&tface->col[0];
-					if(cp[1]>126) cp[1]= 255; else cp[1]*=2;
-					if(cp[2]>126) cp[2]= 255; else cp[2]*=2;
-					if(cp[3]>126) cp[3]= 255; else cp[3]*=2;
+					if (cp[1]>126) cp[1]= 255; else cp[1]*=2;
+					if (cp[2]>126) cp[2]= 255; else cp[2]*=2;
+					if (cp[3]>126) cp[3]= 255; else cp[3]*=2;
 					cp= (char *)&tface->col[1];
-					if(cp[1]>126) cp[1]= 255; else cp[1]*=2;
-					if(cp[2]>126) cp[2]= 255; else cp[2]*=2;
-					if(cp[3]>126) cp[3]= 255; else cp[3]*=2;
+					if (cp[1]>126) cp[1]= 255; else cp[1]*=2;
+					if (cp[2]>126) cp[2]= 255; else cp[2]*=2;
+					if (cp[3]>126) cp[3]= 255; else cp[3]*=2;
 					cp= (char *)&tface->col[2];
-					if(cp[1]>126) cp[1]= 255; else cp[1]*=2;
-					if(cp[2]>126) cp[2]= 255; else cp[2]*=2;
-					if(cp[3]>126) cp[3]= 255; else cp[3]*=2;
+					if (cp[1]>126) cp[1]= 255; else cp[1]*=2;
+					if (cp[2]>126) cp[2]= 255; else cp[2]*=2;
+					if (cp[3]>126) cp[3]= 255; else cp[3]*=2;
 					cp= (char *)&tface->col[3];
-					if(cp[1]>126) cp[1]= 255; else cp[1]*=2;
-					if(cp[2]>126) cp[2]= 255; else cp[2]*=2;
-					if(cp[3]>126) cp[3]= 255; else cp[3]*=2;
+					if (cp[1]>126) cp[1]= 255; else cp[1]*=2;
+					if (cp[2]>126) cp[2]= 255; else cp[2]*=2;
+					if (cp[3]>126) cp[3]= 255; else cp[3]*=2;
 
 					tface++;
 				}
@@ -7816,22 +7990,22 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 	}
 
-	if(main->versionfile <= 169) {
+	if (main->versionfile <= 169) {
 		Mesh *me= main->mesh.first;
-		while(me) {
-			if(me->subdiv==0) me->subdiv= 1;
+		while (me) {
+			if (me->subdiv==0) me->subdiv= 1;
 			me= me->id.next;
 		}
 	}
 
-	if(main->versionfile <= 169) {
+	if (main->versionfile <= 169) {
 		bScreen *sc= main->screen.first;
-		while(sc) {
+		while (sc) {
 			ScrArea *sa= sc->areabase.first;
-			while(sa) {
+			while (sa) {
 				SpaceLink *sl= sa->spacedata.first;
-				while(sl) {
-					if(sl->spacetype==SPACE_IPO) {
+				while (sl) {
+					if (sl->spacetype==SPACE_IPO) {
 						SpaceIpo *sipo= (SpaceIpo*) sl;
 						sipo->v2d.max[0]= 15000.0;
 					}
@@ -7843,7 +8017,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 	}
 
-	if(main->versionfile <= 170) {
+	if (main->versionfile <= 170) {
 		Object *ob = main->object.first;
 		PartEff *paf;
 		while (ob) {
@@ -7857,14 +8031,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 	}
 
-	if(main->versionfile <= 171) {
+	if (main->versionfile <= 171) {
 		bScreen *sc= main->screen.first;
-		while(sc) {
+		while (sc) {
 			ScrArea *sa= sc->areabase.first;
-			while(sa) {
+			while (sa) {
 				SpaceLink *sl= sa->spacedata.first;
-				while(sl) {
-					if(sl->spacetype==SPACE_TEXT) {
+				while (sl) {
+					if (sl->spacetype==SPACE_TEXT) {
 						SpaceText *st= (SpaceText*) sl;
 						st->lheight= 12;
 					}
@@ -7876,14 +8050,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 	}
 
-	if(main->versionfile <= 173) {
+	if (main->versionfile <= 173) {
 		int a, b;
 		Mesh *me= main->mesh.first;
-		while(me) {
-			if(me->tface) {
+		while (me) {
+			if (me->tface) {
 				TFace *tface= me->tface;
-				for(a=0; a<me->totface; a++, tface++) {
-					for(b=0; b<4; b++) {
+				for (a=0; a<me->totface; a++, tface++) {
+					for (b=0; b<4; b++) {
 						tface->uv[b][0]/= 32767.0f;
 						tface->uv[b][1]/= 32767.0f;
 					}
@@ -7893,17 +8067,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 	}
 
-	if(main->versionfile <= 191) {
+	if (main->versionfile <= 191) {
 		Object *ob= main->object.first;
 		Material *ma = main->mat.first;
 
 		/* let faces have default add factor of 0.0 */
-		while(ma) {
+		while (ma) {
 		  if (!(ma->mode & MA_HALO)) ma->add = 0.0;
 		  ma = ma->id.next;
 		}
 
-		while(ob) {
+		while (ob) {
 			ob->mass= 1.0f;
 			ob->damping= 0.1f;
 			/*ob->quat[1]= 1.0f;*/ /* quats arnt used yet */
@@ -7911,23 +8085,23 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 	}
 
-	if(main->versionfile <= 193) {
+	if (main->versionfile <= 193) {
 		Object *ob= main->object.first;
-		while(ob) {
+		while (ob) {
 			ob->inertia= 1.0f;
 			ob->rdamping= 0.1f;
 			ob= ob->id.next;
 		}
 	}
 
-	if(main->versionfile <= 196) {
+	if (main->versionfile <= 196) {
 		Mesh *me= main->mesh.first;
 		int a, b;
-		while(me) {
-			if(me->tface) {
+		while (me) {
+			if (me->tface) {
 				TFace *tface= me->tface;
-				for(a=0; a<me->totface; a++, tface++) {
-					for(b=0; b<4; b++) {
+				for (a=0; a<me->totface; a++, tface++) {
+					for (b=0; b<4; b++) {
 						tface->mode |= TF_DYNAMIC;
 						tface->mode &= ~TF_INVISIBLE;
 					}
@@ -7937,9 +8111,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 	}
 
-	if(main->versionfile <= 200) {
+	if (main->versionfile <= 200) {
 		Object *ob= main->object.first;
-		while(ob) {
+		while (ob) {
 			ob->scaflag = ob->gameflag & (OB_DO_FH|OB_ROT_FH|OB_ANISOTROPIC_FRICTION|OB_GHOST|OB_RIGID_BODY|OB_BOUNDS);
 				/* 64 is do_fh */
 			ob->gameflag &= ~(OB_ROT_FH|OB_ANISOTROPIC_FRICTION|OB_GHOST|OB_RIGID_BODY|OB_BOUNDS);
@@ -7947,7 +8121,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 	}
 
-	if(main->versionfile <= 201) {
+	if (main->versionfile <= 201) {
 		/* add-object + end-object are joined to edit-object actuator */
 		Object *ob = main->object.first;
 		bProperty *prop;
@@ -7958,14 +8132,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		while (ob) {
 			act = ob->actuators.first;
 			while (act) {
-				if(act->type==ACT_IPO) {
+				if (act->type==ACT_IPO) {
 					ia= act->data;
 					prop= get_ob_property(ob, ia->name);
-					if(prop) {
+					if (prop) {
 						ia->type= ACT_IPO_FROM_PROP;
 					}
 				}
-				else if(act->type==ACT_ADD_OBJECT) {
+				else if (act->type==ACT_ADD_OBJECT) {
 					aoa= act->data;
 					eoa= MEM_callocN(sizeof(bEditObjectActuator), "edit ob act");
 					eoa->type= ACT_EDOB_ADD_OBJECT;
@@ -7975,7 +8149,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 					act->data= eoa;
 					act->type= act->otype= ACT_EDIT_OBJECT;
 				}
-				else if(act->type==ACT_END_OBJECT) {
+				else if (act->type==ACT_END_OBJECT) {
 					eoa= MEM_callocN(sizeof(bEditObjectActuator), "edit ob act");
 					eoa->type= ACT_EDOB_END_OBJECT;
 					act->data= eoa;
@@ -7987,16 +8161,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 	}
 
-	if(main->versionfile <= 202) {
+	if (main->versionfile <= 202) {
 		/* add-object and end-object are joined to edit-object
 		 * actuator */
 		Object *ob= main->object.first;
 		bActuator *act;
 		bObjectActuator *oa;
-		while(ob) {
+		while (ob) {
 			act= ob->actuators.first;
-			while(act) {
-				if(act->type==ACT_OBJECT) {
+			while (act) {
+				if (act->type==ACT_OBJECT) {
 					oa= act->data;
 					oa->flag &= ~(ACT_TORQUE_LOCAL|ACT_DROT_LOCAL);		/* this actuator didn't do local/glob rot before */
 				}
@@ -8006,20 +8180,20 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 	}
 
-	if(main->versionfile <= 204) {
+	if (main->versionfile <= 204) {
 		/* patches for new physics */
 		Object *ob= main->object.first;
 		bActuator *act;
 		bObjectActuator *oa;
 		bSound *sound;
-		while(ob) {
+		while (ob) {
 
 			/* please check this for demo20 files like
 			 * original Egypt levels etc.  converted
 			 * rotation factor of 50 is not workable */
 			act= ob->actuators.first;
-			while(act) {
-				if(act->type==ACT_OBJECT) {
+			while (act) {
+				if (act->type==ACT_OBJECT) {
 					oa= act->data;
 
 					oa->forceloc[0]*= 25.0f;
@@ -8044,7 +8218,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 	}
 
-	if(main->versionfile <= 205) {
+	if (main->versionfile <= 205) {
 		/* patches for new physics */
 		Object *ob= main->object.first;
 		bActuator *act;
@@ -8052,7 +8226,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		bEditObjectActuator *oa;
 		bRaySensor *rs;
 		bCollisionSensor *cs;
-		while(ob) {
+		while (ob) {
 			/* Set anisotropic friction off for old objects,
 			 * values to 1.0.  */
 			ob->gameflag &= ~OB_ANISOTROPIC_FRICTION;
@@ -8061,8 +8235,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			ob->anisotropicFriction[2] = 1.0;
 
 			act= ob->actuators.first;
-			while(act) {
-				if(act->type==ACT_EDIT_OBJECT) {
+			while (act) {
+				if (act->type==ACT_EDIT_OBJECT) {
 					/* Zero initial velocity for newly
 					 * added objects */
 					oa= act->data;
@@ -8077,16 +8251,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			sens= ob->sensors.first;
 			while (sens) {
 				/* Extra fields for radar sensors. */
-				if(sens->type == SENS_RADAR) {
+				if (sens->type == SENS_RADAR) {
 					bRadarSensor *s = sens->data;
 					s->range = 10000.0;
 				}
 
 				/* Pulsing: defaults for new sensors. */
-				if(sens->type != SENS_ALWAYS) {
+				if (sens->type != SENS_ALWAYS) {
 					sens->pulse = 0;
 					sens->freq = 0;
-				} else {
+				}
+				else {
 					sens->pulse = 1;
 				}
 
@@ -8096,11 +8271,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 				/* Collision and ray: default = trigger
 				 * on property. The material field can
 				 * remain empty. */
-				if(sens->type == SENS_COLLISION) {
+				if (sens->type == SENS_COLLISION) {
 					cs = (bCollisionSensor*) sens->data;
 					cs->mode = 0;
 				}
-				if(sens->type == SENS_RAY) {
+				if (sens->type == SENS_RAY) {
 					rs = (bRaySensor*) sens->data;
 					rs->mode = 0;
 				}
@@ -8111,7 +8286,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		/* have to check the exact multiplier */
 	}
 
-	if(main->versionfile <= 211) {
+	if (main->versionfile <= 211) {
 		/* Render setting: per scene, the applicable gamma value
 		 * can be set. Default is 1.0, which means no
 		 * correction.  */
@@ -8121,16 +8296,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
 		/* added alpha in obcolor */
 		ob= main->object.first;
-		while(ob) {
+		while (ob) {
 			ob->col[3]= 1.0;
 			ob= ob->id.next;
 		}
 
 		/* added alpha in obcolor */
 		ob= main->object.first;
-		while(ob) {
+		while (ob) {
 			act= ob->actuators.first;
-			while(act) {
+			while (act) {
 				if (act->type==ACT_OBJECT) {
 					/* multiply velocity with 50 in old files */
 					oa= act->data;
@@ -8153,7 +8328,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 	}
 
-	if(main->versionfile <= 212) {
+	if (main->versionfile <= 212) {
 
 		bSound* sound;
 		bProperty *prop;
@@ -8179,7 +8354,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
 		while (ob) {
 			prop= ob->prop.first;
-			while(prop) {
+			while (prop) {
 				if (prop->type == GPROP_TIME) {
 					// convert old GPROP_TIME values from int to float
 					*((float *)&prop->data) = (float) prop->data;
@@ -8201,7 +8376,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 				me->flag|= ME_SUBSURF;
 
 				me->subdiv= 1;
-			} else {
+			}
+			else {
 				if (me->subdiv<2)
 					me->subdiv= 1;
 				else
@@ -8210,14 +8386,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 	}
 
-	if(main->versionfile <= 220) {
+	if (main->versionfile <= 220) {
 		Object *ob;
 		Mesh *me;
 
 		ob = main->object.first;
 
 		/* adapt form factor in order to get the 'old' physics
-		 * behaviour back...*/
+		 * behavior back...*/
 
 		while (ob) {
 			/* in future, distinguish between different
@@ -8259,11 +8435,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 		}
 	}
-	if(main->versionfile <= 221) {
+	if (main->versionfile <= 221) {
 		Scene *sce= main->scene.first;
 
 		// new variables for std-alone player and runtime
-		while(sce) {
+		while (sce) {
 
 			sce->r.xplay= 640;
 			sce->r.yplay= 480;
@@ -8273,11 +8449,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 
 	}
-	if(main->versionfile <= 222) {
+	if (main->versionfile <= 222) {
 		Scene *sce= main->scene.first;
 
 		// new variables for std-alone player and runtime
-		while(sce) {
+		while (sce) {
 
 			sce->r.depth= 32;
 
@@ -8286,7 +8462,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 	}
 
 
-	if(main->versionfile <= 223) {
+	if (main->versionfile <= 223) {
 		VFont *vf;
 		Image *ima;
 		Object *ob;
@@ -8298,7 +8474,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 
 		/* Old textures animate at 25 FPS */
-		for (ima = main->image.first; ima; ima=ima->id.next){
+		for (ima = main->image.first; ima; ima=ima->id.next) {
 			ima->animspeed = 25;
 		}
 
@@ -8317,7 +8493,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 		}
 	}
-	if(main->versionfile <= 224) {
+	if (main->versionfile <= 224) {
 		bSound* sound;
 		Scene *sce;
 		Mesh *me;
@@ -8332,7 +8508,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 		}
 		/* Make sure that old subsurf meshes don't have zero subdivision level for rendering */
-		for (me=main->mesh.first; me; me=me->id.next){
+		for (me=main->mesh.first; me; me=me->id.next) {
 			if ((me->flag & ME_SUBSURF) && (me->subdivr==0))
 				me->subdivr=me->subdiv;
 		}
@@ -8360,7 +8536,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 	}
 
 
-	if(main->versionfile <= 225) {
+	if (main->versionfile <= 225) {
 		World *wo;
 		/* Use Sumo for old games */
 		for (wo = main->world.first; wo; wo= wo->id.next) {
@@ -8368,15 +8544,15 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 	}
 
-	if(main->versionfile <= 227) {
+	if (main->versionfile <= 227) {
 		Scene *sce;
 		Material *ma;
 		bScreen *sc;
 		Object *ob;
 
-		/*  As of now, this insures that the transition from the old Track system
-			to the new full constraint Track is painless for everyone. - theeth
-		*/
+		/* As of now, this insures that the transition from the old Track system
+		 * to the new full constraint Track is painless for everyone. - theeth
+		 */
 		ob = main->object.first;
 
 		while (ob) {
@@ -8384,12 +8560,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			list = &ob->constraints;
 
 			/* check for already existing TrackTo constraint
-			   set their track and up flag correctly */
+			 * set their track and up flag correctly */
 
-			if (list){
+			if (list) {
 				bConstraint *curcon;
-				for (curcon = list->first; curcon; curcon=curcon->next){
-					if (curcon->type == CONSTRAINT_TYPE_TRACKTO){
+				for (curcon = list->first; curcon; curcon=curcon->next) {
+					if (curcon->type == CONSTRAINT_TYPE_TRACKTO) {
 						bTrackToConstraint *data = curcon->data;
 						data->reserved1 = ob->trackflag;
 						data->reserved2 = ob->upflag;
@@ -8398,14 +8574,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 
 			if (ob->type == OB_ARMATURE) {
-				if (ob->pose){
+				if (ob->pose) {
 					bConstraint *curcon;
 					bPoseChannel *pchan;
 					for (pchan = ob->pose->chanbase.first;
-						 pchan; pchan=pchan->next){
+						 pchan; pchan=pchan->next) {
 						for (curcon = pchan->constraints.first;
-							 curcon; curcon=curcon->next){
-							if (curcon->type == CONSTRAINT_TYPE_TRACKTO){
+							 curcon; curcon=curcon->next) {
+							if (curcon->type == CONSTRAINT_TYPE_TRACKTO) {
 								bTrackToConstraint *data = curcon->data;
 								data->reserved1 = ob->trackflag;
 								data->reserved2 = ob->upflag;
@@ -8456,14 +8632,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 		}
 	}
-	if(main->versionfile <= 228) {
+	if (main->versionfile <= 228) {
 		Scene *sce;
 		bScreen *sc;
 		Object *ob;
 
 
-		/*  As of now, this insures that the transition from the old Track system
-			to the new full constraint Track is painless for everyone.*/
+		/* As of now, this insures that the transition from the old Track system
+		 * to the new full constraint Track is painless for everyone.*/
 		ob = main->object.first;
 
 		while (ob) {
@@ -8471,12 +8647,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			list = &ob->constraints;
 
 			/* check for already existing TrackTo constraint
-			   set their track and up flag correctly */
+			 * set their track and up flag correctly */
 
-			if (list){
+			if (list) {
 				bConstraint *curcon;
-				for (curcon = list->first; curcon; curcon=curcon->next){
-					if (curcon->type == CONSTRAINT_TYPE_TRACKTO){
+				for (curcon = list->first; curcon; curcon=curcon->next) {
+					if (curcon->type == CONSTRAINT_TYPE_TRACKTO) {
 						bTrackToConstraint *data = curcon->data;
 						data->reserved1 = ob->trackflag;
 						data->reserved2 = ob->upflag;
@@ -8485,14 +8661,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 
 			if (ob->type == OB_ARMATURE) {
-				if (ob->pose){
+				if (ob->pose) {
 					bConstraint *curcon;
 					bPoseChannel *pchan;
 					for (pchan = ob->pose->chanbase.first;
-						 pchan; pchan=pchan->next){
+						 pchan; pchan=pchan->next) {
 						for (curcon = pchan->constraints.first;
-							 curcon; curcon=curcon->next){
-							if (curcon->type == CONSTRAINT_TYPE_TRACKTO){
+							 curcon; curcon=curcon->next) {
+							if (curcon->type == CONSTRAINT_TYPE_TRACKTO) {
 								bTrackToConstraint *data = curcon->data;
 								data->reserved1 = ob->trackflag;
 								data->reserved2 = ob->upflag;
@@ -8523,46 +8699,46 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 						sbuts->v2d.maxzoom= 1.2f;
 						sbuts->align= 1;	/* horizontal default */
 					
-						if(sbuts->mainb==BUTS_LAMP) {
+						if (sbuts->mainb==BUTS_LAMP) {
 							sbuts->mainb= CONTEXT_SHADING;
 							//sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
 						}
-						else if(sbuts->mainb==BUTS_MAT) {
+						else if (sbuts->mainb==BUTS_MAT) {
 							sbuts->mainb= CONTEXT_SHADING;
 							//sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
 						}
-						else if(sbuts->mainb==BUTS_TEX) {
+						else if (sbuts->mainb==BUTS_TEX) {
 							sbuts->mainb= CONTEXT_SHADING;
 							//sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_TEX;
 						}
-						else if(sbuts->mainb==BUTS_ANIM) {
+						else if (sbuts->mainb==BUTS_ANIM) {
 							sbuts->mainb= CONTEXT_OBJECT;
 						}
-						else if(sbuts->mainb==BUTS_WORLD) {
+						else if (sbuts->mainb==BUTS_WORLD) {
 							sbuts->mainb= CONTEXT_SCENE;
 							//sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_WORLD;
 						}
-						else if(sbuts->mainb==BUTS_RENDER) {
+						else if (sbuts->mainb==BUTS_RENDER) {
 							sbuts->mainb= CONTEXT_SCENE;
 							//sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_RENDER;
 						}
-						else if(sbuts->mainb==BUTS_GAME) {
+						else if (sbuts->mainb==BUTS_GAME) {
 							sbuts->mainb= CONTEXT_LOGIC;
 						}
-						else if(sbuts->mainb==BUTS_FPAINT) {
+						else if (sbuts->mainb==BUTS_FPAINT) {
 							sbuts->mainb= CONTEXT_EDITING;
 						}
-						else if(sbuts->mainb==BUTS_RADIO) {
+						else if (sbuts->mainb==BUTS_RADIO) {
 							sbuts->mainb= CONTEXT_SHADING;
 							//sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_RAD;
 						}
-						else if(sbuts->mainb==BUTS_CONSTRAINT) {
+						else if (sbuts->mainb==BUTS_CONSTRAINT) {
 							sbuts->mainb= CONTEXT_OBJECT;
 						}
-						else if(sbuts->mainb==BUTS_SCRIPT) {
+						else if (sbuts->mainb==BUTS_SCRIPT) {
 							sbuts->mainb= CONTEXT_OBJECT;
 						}
-						else if(sbuts->mainb==BUTS_EDIT) {
+						else if (sbuts->mainb==BUTS_EDIT) {
 							sbuts->mainb= CONTEXT_EDITING;
 						}
 						else sbuts->mainb= CONTEXT_SCENE;
@@ -8572,11 +8748,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 	}
 	/* ton: made this 230 instead of 229,
-	   to be sure (tuho files) and this is a reliable check anyway
-	   nevertheless, we might need to think over a fitness (initialize)
-	   check apart from the do_versions() */
+	 * to be sure (tuho files) and this is a reliable check anyway
+	 * nevertheless, we might need to think over a fitness (initialize)
+	 * check apart from the do_versions() */
 
-	if(main->versionfile <= 230) {
+	if (main->versionfile <= 230) {
 		bScreen *sc;
 
 		// new variable blockscale, for panels in any area
@@ -8587,9 +8763,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 				SpaceLink *sl;
 
 				for (sl= sa->spacedata.first; sl; sl= sl->next) {
-					if(sl->blockscale==0.0f) sl->blockscale= 0.7f;
+					if (sl->blockscale==0.0f) sl->blockscale= 0.7f;
 					/* added: 5x better zoom in for action */
-					if(sl->spacetype==SPACE_ACTION) {
+					if (sl->spacetype==SPACE_ACTION) {
 						SpaceAction *sac= (SpaceAction *)sl;
 						sac->v2d.maxzoom= 50;
 					}
@@ -8597,12 +8773,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 		}
 	}
-	if(main->versionfile <= 231) {
+	if (main->versionfile <= 231) {
 		/* new bit flags for showing/hiding grid floor and axes */
 		bScreen *sc = main->screen.first;
-		while(sc) {
+		while (sc) {
 			ScrArea *sa= sc->areabase.first;
-			while(sa) {
+			while (sa) {
 				SpaceLink *sl= sa->spacedata.first;
 				while (sl) {
 					if (sl->spacetype==SPACE_VIEW3D) {
@@ -8622,7 +8798,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			sc= sc->id.next;
 		}
 	}
-	if(main->versionfile <= 231) {
+	if (main->versionfile <= 231) {
 		Material *ma= main->mat.first;
 		bScreen *sc = main->screen.first;
 		Scene *sce;
@@ -8630,9 +8806,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		World *wrld;
 
 		/* introduction of raytrace */
-		while(ma) {
-			if(ma->fresnel_tra_i==0.0f) ma->fresnel_tra_i= 1.25f;
-			if(ma->fresnel_mir_i==0.0f) ma->fresnel_mir_i= 1.25f;
+		while (ma) {
+			if (ma->fresnel_tra_i==0.0f) ma->fresnel_tra_i= 1.25f;
+			if (ma->fresnel_mir_i==0.0f) ma->fresnel_mir_i= 1.25f;
 
 			ma->ang= 1.0;
 			ma->ray_depth= 2;
@@ -8643,24 +8819,24 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			ma= ma->id.next;
 		}
 		sce= main->scene.first;
-		while(sce) {
-			if(sce->r.gauss==0.0f) sce->r.gauss= 1.0f;
+		while (sce) {
+			if (sce->r.gauss==0.0f) sce->r.gauss= 1.0f;
 			sce= sce->id.next;
 		}
 		la= main->lamp.first;
-		while(la) {
-			if(la->k==0.0f) la->k= 1.0;
-			if(la->ray_samp==0) la->ray_samp= 1;
-			if(la->ray_sampy==0) la->ray_sampy= 1;
-			if(la->ray_sampz==0) la->ray_sampz= 1;
-			if(la->area_size==0.0f) la->area_size= 1.0f;
-			if(la->area_sizey==0.0f) la->area_sizey= 1.0f;
-			if(la->area_sizez==0.0f) la->area_sizez= 1.0f;
+		while (la) {
+			if (la->k==0.0f) la->k= 1.0;
+			if (la->ray_samp==0) la->ray_samp= 1;
+			if (la->ray_sampy==0) la->ray_sampy= 1;
+			if (la->ray_sampz==0) la->ray_sampz= 1;
+			if (la->area_size==0.0f) la->area_size= 1.0f;
+			if (la->area_sizey==0.0f) la->area_sizey= 1.0f;
+			if (la->area_sizez==0.0f) la->area_sizez= 1.0f;
 			la= la->id.next;
 		}
 		wrld= main->world.first;
-		while(wrld) {
-			if(wrld->range==0.0f) {
+		while (wrld) {
+			if (wrld->range==0.0f) {
 				wrld->range= 1.0f/wrld->exposure;
 			}
 			wrld= wrld->id.next;
@@ -8668,9 +8844,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
 		/* new bit flags for showing/hiding grid floor and axes */
 
-		while(sc) {
+		while (sc) {
 			ScrArea *sa= sc->areabase.first;
-			while(sa) {
+			while (sa) {
 				SpaceLink *sl= sa->spacedata.first;
 				while (sl) {
 					if (sl->spacetype==SPACE_VIEW3D) {
@@ -8690,18 +8866,18 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			sc= sc->id.next;
 		}
 	}
-	if(main->versionfile <= 232) {
+	if (main->versionfile <= 232) {
 		Tex *tex= main->tex.first;
 		World *wrld= main->world.first;
 		bScreen *sc;
 		Scene *sce;
 
-		while(tex) {
-			if((tex->flag & (TEX_CHECKER_ODD+TEX_CHECKER_EVEN))==0) {
+		while (tex) {
+			if ((tex->flag & (TEX_CHECKER_ODD+TEX_CHECKER_EVEN))==0) {
 				tex->flag |= TEX_CHECKER_ODD;
 			}
 			/* copied from kernel texture.c */
-			if(tex->ns_outscale==0.0f) {
+			if (tex->ns_outscale==0.0f) {
 				/* musgrave */
 				tex->mg_H = 1.0f;
 				tex->mg_lacunarity = 2.0f;
@@ -8718,13 +8894,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			tex= tex->id.next;
 		}
 
-		while(wrld) {
-			if(wrld->aodist==0.0f) {
+		while (wrld) {
+			if (wrld->aodist==0.0f) {
 				wrld->aodist= 10.0f;
 				wrld->aobias= 0.05f;
 			}
-			if(wrld->aosamp==0) wrld->aosamp= 5;
-			if(wrld->aoenergy==0.0f) wrld->aoenergy= 1.0f;
+			if (wrld->aosamp==0) wrld->aosamp= 5;
+			if (wrld->aoenergy==0.0f) wrld->aoenergy= 1.0f;
 			wrld= wrld->id.next;
 		}
 
@@ -8736,10 +8912,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			for (sa= sc->areabase.first; sa; sa= sa->next) {
 				SpaceLink *sl;
 				for (sl= sa->spacedata.first; sl; sl= sl->next) {
-					if(sl->blockscale==0.0f) sl->blockscale= 0.7f;
+					if (sl->blockscale==0.0f) sl->blockscale= 0.7f;
 
 					/* added: 5x better zoom in for nla */
-					if(sl->spacetype==SPACE_NLA) {
+					if (sl->spacetype==SPACE_NLA) {
 						SpaceNla *snla= (SpaceNla *)sl;
 						snla->v2d.maxzoom= 50;
 					}
@@ -8747,28 +8923,28 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 		}
 		sce= main->scene.first;
-		while(sce) {
-			if(sce->r.ocres==0) sce->r.ocres= 64;
+		while (sce) {
+			if (sce->r.ocres==0) sce->r.ocres= 64;
 			sce= sce->id.next;
 		}
 
 	}
-	if(main->versionfile <= 233) {
+	if (main->versionfile <= 233) {
 		bScreen *sc;
 		Material *ma= main->mat.first;
 		/* Object *ob= main->object.first; */
 		
-		while(ma) {
-			if(ma->rampfac_col==0.0f) ma->rampfac_col= 1.0;
-			if(ma->rampfac_spec==0.0f) ma->rampfac_spec= 1.0;
-			if(ma->pr_lamp==0) ma->pr_lamp= 3;
+		while (ma) {
+			if (ma->rampfac_col==0.0f) ma->rampfac_col= 1.0;
+			if (ma->rampfac_spec==0.0f) ma->rampfac_spec= 1.0;
+			if (ma->pr_lamp==0) ma->pr_lamp= 3;
 			ma= ma->id.next;
 		}
 		
 		/* this should have been done loooong before! */
 #if 0   /* deprecated in 2.5+ */
-		while(ob) {
-			if(ob->ipowin==0) ob->ipowin= ID_OB;
+		while (ob) {
+			if (ob->ipowin==0) ob->ipowin= ID_OB;
 			ob= ob->id.next;
 		}
 #endif
@@ -8777,7 +8953,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			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) {
+					if (sl->spacetype==SPACE_VIEW3D) {
 						View3D *v3d= (View3D *)sl;
 						v3d->flag |= V3D_SELECT_OUTLINE;
 					}
@@ -8789,13 +8965,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
 	
 
-	if(main->versionfile <= 234) {
+	if (main->versionfile <= 234) {
 		World *wo;
 		bScreen *sc;
 		
 		// force sumo engine to be active
 		for (wo = main->world.first; wo; wo= wo->id.next) {
-			if(wo->physicsEngine==0) wo->physicsEngine = 2;
+			if (wo->physicsEngine==0) wo->physicsEngine = 2;
 		}
 		
 		for (sc= main->screen.first; sc; sc= sc->id.next) {
@@ -8803,33 +8979,33 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			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) {
+					if (sl->spacetype==SPACE_VIEW3D) {
 						View3D *v3d= (View3D *)sl;
 						v3d->flag |= V3D_ZBUF_SELECT;
 					}
-					else if(sl->spacetype==SPACE_TEXT) {
+					else if (sl->spacetype==SPACE_TEXT) {
 						SpaceText *st= (SpaceText *)sl;
-						if(st->tabnumber==0) st->tabnumber= 2;
+						if (st->tabnumber==0) st->tabnumber= 2;
 					}
 				}
 			}
 		}
 	}
-	if(main->versionfile <= 235) {
+	if (main->versionfile <= 235) {
 		Tex *tex= main->tex.first;
 		Scene *sce= main->scene.first;
 		Sequence *seq;
 		Editing *ed;
 		
-		while(tex) {
-			if(tex->nabla==0.0f) tex->nabla= 0.025f;
+		while (tex) {
+			if (tex->nabla==0.0f) tex->nabla= 0.025f;
 			tex= tex->id.next;
 		}
-		while(sce) {
+		while (sce) {
 			ed= sce->ed;
-			if(ed) {
+			if (ed) {
 				SEQ_BEGIN(sce->ed, seq) {
-					if(seq->type==SEQ_IMAGE || seq->type==SEQ_MOVIE)
+					if (seq->type==SEQ_IMAGE || seq->type==SEQ_MOVIE)
 						seq->flag |= SEQ_MAKE_PREMUL;
 				}
 				SEQ_END
@@ -8838,16 +9014,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			sce= sce->id.next;
 		}
 	}
-	if(main->versionfile <= 236) {
+	if (main->versionfile <= 236) {
 		Object *ob;
 		Camera *cam= main->camera.first;
 		Material *ma;
 		bScreen *sc;
 
-		while(cam) {
-			if(cam->ortho_scale==0.0f) {
+		while (cam) {
+			if (cam->ortho_scale==0.0f) {
 				cam->ortho_scale= 256.0f/cam->lens;
-				if(cam->type==CAM_ORTHO) printf("NOTE: ortho render has changed, tweak new Camera 'scale' value.\n");
+				if (cam->type==CAM_ORTHO) printf("NOTE: ortho render has changed, tweak new Camera 'scale' value.\n");
 			}
 			cam= cam->id.next;
 		}
@@ -8859,34 +9035,34 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			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) {
+					if (sl->spacetype==SPACE_VIEW3D) {
 						View3D *v3d= (View3D *)sl;
-						if(v3d->twtype==0) v3d->twtype= V3D_MANIP_TRANSLATE;
+						if (v3d->twtype==0) v3d->twtype= V3D_MANIP_TRANSLATE;
 					}
 				}
 			}
 		}
 		// init new shader vars
 		for (ma= main->mat.first; ma; ma= ma->id.next) {
-			if(ma->darkness==0.0f) {
+			if (ma->darkness==0.0f) {
 				ma->rms=0.1f;
 				ma->darkness=1.0f;
 			}
 		}
 		
 		/* softbody init new vars */
-		for(ob= main->object.first; ob; ob= ob->id.next) {
-			if(ob->soft) {
-				if(ob->soft->defgoal==0.0f) ob->soft->defgoal= 0.7f;
-				if(ob->soft->physics_speed==0.0f) ob->soft->physics_speed= 1.0f;
+		for (ob= main->object.first; ob; ob= ob->id.next) {
+			if (ob->soft) {
+				if (ob->soft->defgoal==0.0f) ob->soft->defgoal= 0.7f;
+				if (ob->soft->physics_speed==0.0f) ob->soft->physics_speed= 1.0f;
 				
-				if(ob->soft->interval==0) {
+				if (ob->soft->interval==0) {
 					ob->soft->interval= 2;
 					ob->soft->sfra= 1;
 					ob->soft->efra= 100;
 				}
 			}
-			if(ob->soft && ob->soft->vertgroup==0) {
+			if (ob->soft && ob->soft->vertgroup==0) {
 				bDeformGroup *locGroup = defgroup_find_name(ob, "SOFTGOAL");
 				if (locGroup) {
 					/* retrieve index for that group */
@@ -8895,38 +9071,39 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 		}
 	}
-	if(main->versionfile <= 237) {
+	if (main->versionfile <= 237) {
 		bArmature *arm;
 		bConstraint *con;
 		Object *ob;
 		Bone *bone;
 		
 		// armature recode checks 
-		for(arm= main->armature.first; arm; arm= arm->id.next) {
+		for (arm= main->armature.first; arm; arm= arm->id.next) {
 			where_is_armature(arm);
 
-			for(bone= arm->bonebase.first; bone; bone= bone->next)
+			for (bone= arm->bonebase.first; bone; bone= bone->next)
 				do_version_bone_head_tail_237(bone);
 		}
-		for(ob= main->object.first; ob; ob= ob->id.next) {
-			if(ob->parent) {
+		for (ob= main->object.first; ob; ob= ob->id.next) {
+			if (ob->parent) {
 				Object *parent= newlibadr(fd, lib, ob->parent);
 				if (parent && parent->type==OB_LATTICE)
 					ob->partype = PARSKEL;
 			}
 
 			// btw. armature_rebuild_pose is further only called on leave editmode
-			if(ob->type==OB_ARMATURE) {
-				if(ob->pose)
+			if (ob->type==OB_ARMATURE) {
+				if (ob->pose)
 					ob->pose->flag |= POSE_RECALC;
 				ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;	// cannot call stuff now (pointers!), done in setup_app_data
 
 				/* new generic xray option */
 				arm= newlibadr(fd, lib, ob->data);
-				if(arm->flag & ARM_DRAWXRAY) {
+				if (arm->flag & ARM_DRAWXRAY) {
 					ob->dtx |= OB_DRAWXRAY;
 				}
-			} else if (ob->type==OB_MESH) {
+			}
+			else if (ob->type==OB_MESH) {
 				Mesh *me = newlibadr(fd, lib, ob->data);
 				
 				if ((me->flag&ME_SUBSURF)) {
@@ -8951,20 +9128,20 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 			
 			// follow path constraint needs to set the 'path' option in curves...
-			for(con=ob->constraints.first; con; con= con->next) {
-				if(con->type==CONSTRAINT_TYPE_FOLLOWPATH) {
+			for (con=ob->constraints.first; con; con= con->next) {
+				if (con->type==CONSTRAINT_TYPE_FOLLOWPATH) {
 					bFollowPathConstraint *data = con->data;
 					Object *obc= newlibadr(fd, lib, data->tar);
 					
-					if(obc && obc->type==OB_CURVE) {
+					if (obc && obc->type==OB_CURVE) {
 						Curve *cu= newlibadr(fd, lib, obc->data);
-						if(cu) cu->flag |= CU_PATH;
+						if (cu) cu->flag |= CU_PATH;
 					}
 				}
 			}
 		}
 	}
-	if(main->versionfile <= 238) {
+	if (main->versionfile <= 238) {
 		Lattice *lt;
 		Object *ob;
 		bArmature *arm;
@@ -8972,8 +9149,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		Key *key;
 		Scene *sce= main->scene.first;
 
-		while(sce){
-			if(sce->toolsettings == NULL){
+		while (sce) {
+			if (sce->toolsettings == NULL) {
 				sce->toolsettings = MEM_callocN(sizeof(struct ToolSettings),"Tool Settings Struct");	
 				sce->toolsettings->cornertype=0;
 				sce->toolsettings->degr = 90; 
@@ -8984,7 +9161,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 				sce->toolsettings->segments = 32;
 				sce->toolsettings->rings = 32;
 				sce->toolsettings->vertices = 32;
-				sce->toolsettings->editbutflag =1;
 			}
 			sce= sce->id.next;	
 		}
@@ -8997,7 +9173,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 		}
 
-		for(ob=main->object.first; ob; ob= ob->id.next) {
+		for (ob=main->object.first; ob; ob= ob->id.next) {
 			ModifierData *md;
 			PartEff *paf;
 
@@ -9018,23 +9194,24 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 					}
 
 					BLI_insertlinkbefore(&ob->modifiers, md, modifier_new(eModifierType_Softbody));
-				} else {
+				}
+				else {
 					BLI_addhead(&ob->modifiers, modifier_new(eModifierType_Softbody));
 				}
 
 				ob->softflag &= ~OB_SB_ENABLE;
 			}
-			if(ob->pose) {
+			if (ob->pose) {
 				bPoseChannel *pchan;
 				bConstraint *con;
-				for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+				for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
 					// note, pchan->bone is also lib-link stuff
 					if (pchan->limitmin[0] == 0.0f && pchan->limitmax[0] == 0.0f) {
 						pchan->limitmin[0]= pchan->limitmin[1]= pchan->limitmin[2]= -180.0f;
 						pchan->limitmax[0]= pchan->limitmax[1]= pchan->limitmax[2]= 180.0f;
 						
-						for(con= pchan->constraints.first; con; con= con->next) {
-							if(con->type == CONSTRAINT_TYPE_KINEMATIC) {
+						for (con= pchan->constraints.first; con; con= con->next) {
+							if (con->type == CONSTRAINT_TYPE_KINEMATIC) {
 								bKinematicConstraint *data = (bKinematicConstraint*)con->data;
 								data->weight = 1.0f;
 								data->orientweight = 1.0f;
@@ -9053,53 +9230,48 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
 			paf = do_version_give_parteff_245(ob);
 			if (paf) {
-				if(paf->disp == 0)
+				if (paf->disp == 0)
 					paf->disp = 100;
-				if(paf->speedtex == 0)
+				if (paf->speedtex == 0)
 					paf->speedtex = 8;
-				if(paf->omat == 0)
+				if (paf->omat == 0)
 					paf->omat = 1;
 			}
 		}
 		
-		for(arm=main->armature.first; arm; arm= arm->id.next) {
+		for (arm=main->armature.first; arm; arm= arm->id.next) {
 			bone_version_238(&arm->bonebase);
 			arm->deformflag |= ARM_DEF_VGROUP;
 		}
 
-		for(me=main->mesh.first; me; me= me->id.next) {
+		for (me=main->mesh.first; me; me= me->id.next) {
 			if (!me->medge) {
 				make_edges(me, 1);	/* 1 = use mface->edcode */
-			} else {
+			}
+			else {
 				mesh_strip_loose_faces(me);
 			}
 		}
 		
-		for(key= main->key.first; key; key= key->id.next) {
+		for (key= main->key.first; key; key= key->id.next) {
 			KeyBlock *kb;
-			int index= 1;
-			
-			/* trick to find out if we already introduced adrcode */
-			for(kb= key->block.first; kb; kb= kb->next)
-				if(kb->adrcode) break;
-			
-			if(kb==NULL) {
-				for(kb= key->block.first; kb; kb= kb->next) {
-					if(kb==key->refkey) {
-						if(kb->name[0]==0)
-							strcpy(kb->name, "Basis");
-					}
-					else {
-						if (kb->name[0]==0) {
-							BLI_snprintf(kb->name, sizeof(kb->name), "Key %d", index);
-						}
-						kb->adrcode= index++;
+			int index = 1;
+
+			for (kb= key->block.first; kb; kb= kb->next) {
+				if (kb==key->refkey) {
+					if (kb->name[0]==0)
+						strcpy(kb->name, "Basis");
+				}
+				else {
+					if (kb->name[0]==0) {
+						BLI_snprintf(kb->name, sizeof(kb->name), "Key %d", index);
 					}
+					index++;
 				}
 			}
 		}
 	}
-	if(main->versionfile <= 239) {
+	if (main->versionfile <= 239) {
 		bArmature *arm;
 		Object *ob;
 		Scene *sce= main->scene.first;
@@ -9108,13 +9280,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		int set_passepartout= 0;
 		
 		/* deformflag is local in modifier now */
-		for(ob=main->object.first; ob; ob= ob->id.next) {
+		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_Armature) {
 					ArmatureModifierData *amd = (ArmatureModifierData*) md;
-					if(amd->object && amd->deformflag==0) {
+					if (amd->object && amd->deformflag==0) {
 						Object *oba= newlibadr(fd, lib, amd->object);
 						arm= newlibadr(fd, lib, oba->data);
 						amd->deformflag= arm->deformflag;
@@ -9124,29 +9296,29 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 		
 		/* updating stepsize for ghost drawing */
-		for(arm= main->armature.first; arm; arm= arm->id.next) {
+		for (arm= main->armature.first; arm; arm= arm->id.next) {
 			if (arm->ghostsize==0) arm->ghostsize=1;
 			bone_version_239(&arm->bonebase);
-			if(arm->layer==0) arm->layer= 1;
+			if (arm->layer==0) arm->layer= 1;
 		}
 		
-		for(;sce;sce= sce->id.next) {
+		for (;sce;sce= sce->id.next) {
 			/* make 'innervert' the default subdivide type, for backwards compat */
 			sce->toolsettings->cornertype=1;
 		
-			if(sce->r.scemode & R_PASSEPARTOUT) {
+			if (sce->r.scemode & R_PASSEPARTOUT) {
 				set_passepartout= 1;
 				sce->r.scemode &= ~R_PASSEPARTOUT;
 			}
 			/* gauss is filter variable now */
-			if(sce->r.mode & R_GAUSS) {
+			if (sce->r.mode & R_GAUSS) {
 				sce->r.filtertype= R_FILTER_GAUSS;
 				sce->r.mode &= ~R_GAUSS;
 			}
 		}
 		
-		for(;cam; cam= cam->id.next) {
-			if(set_passepartout)
+		for (;cam; cam= cam->id.next) {
+			if (set_passepartout)
 				cam->flag |= CAM_SHOWPASSEPARTOUT;
 			
 			/* make sure old cameras have title safe on */
@@ -9157,16 +9329,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			if (!(cam->passepartalpha)) cam->passepartalpha = 0.2f;
 		}
 		
-		for(; ma; ma= ma->id.next) {
-			if(ma->strand_sta==0.0f) {
+		for (; ma; ma= ma->id.next) {
+			if (ma->strand_sta==0.0f) {
 				ma->strand_sta= ma->strand_end= 1.0f;
 				ma->mode |= MA_TANGENT_STR;
 			}
-			if(ma->mode & MA_TRACEBLE) ma->mode |= MA_SHADBUF;
+			if (ma->mode & MA_TRACEBLE) ma->mode |= MA_SHADBUF;
 		}
 	}
 	
-	if(main->versionfile <= 241) {
+	if (main->versionfile <= 241) {
 		Object *ob;
 		Tex *tex;
 		Scene *sce;
@@ -9179,37 +9351,37 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		for (wo = main->world.first; wo; wo= wo->id.next) {
 			/* Migrate to Bullet for games, except for the NaN versions */
 			/* People can still explicitly choose for Sumo (after 2.42 is out) */
-			if(main->versionfile > 225)
+			if (main->versionfile > 225)
 				wo->physicsEngine = WOPHY_BULLET;
-			if(WO_AODIST == wo->aomode)
+			if (WO_AODIST == wo->aomode)
 				wo->aocolor= WO_AOPLAIN;
 		}
 		
 		/* updating layers still */
-		for(arm= main->armature.first; arm; arm= arm->id.next) {
+		for (arm= main->armature.first; arm; arm= arm->id.next) {
 			bone_version_239(&arm->bonebase);
-			if(arm->layer==0) arm->layer= 1;
+			if (arm->layer==0) arm->layer= 1;
 		}
-		for(sce= main->scene.first; sce; sce= sce->id.next) {
-			if(sce->audio.mixrate==0) sce->audio.mixrate= 44100;
+		for (sce= main->scene.first; sce; sce= sce->id.next) {
+			if (sce->audio.mixrate==0) sce->audio.mixrate= 44100;
 
-			if(sce->r.xparts<2) sce->r.xparts= 4;
-			if(sce->r.yparts<2) sce->r.yparts= 4;
+			if (sce->r.xparts<2) sce->r.xparts= 4;
+			if (sce->r.yparts<2) sce->r.yparts= 4;
 			/* adds default layer */
-			if(sce->r.layers.first==NULL)
+			if (sce->r.layers.first==NULL)
 				scene_add_render_layer(sce, NULL);
 			else {
 				SceneRenderLayer *srl;
 				/* new layer flag for sky, was default for solid */
-				for(srl= sce->r.layers.first; srl; srl= srl->next) {
-					if(srl->layflag & SCE_LAY_SOLID)
+				for (srl= sce->r.layers.first; srl; srl= srl->next) {
+					if (srl->layflag & SCE_LAY_SOLID)
 						srl->layflag |= SCE_LAY_SKY;
 					srl->passflag &= (SCE_PASS_COMBINED|SCE_PASS_Z|SCE_PASS_NORMAL|SCE_PASS_VECTOR);
 				}
 			}
 			
 			/* node version changes */
-			if(sce->nodetree)
+			if (sce->nodetree)
 				ntree_version_241(sce->nodetree);
 
 			/* uv calculation options moved to toolsettings */
@@ -9222,13 +9394,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 				sce->toolsettings->unwrapper = 1;
 			}
 
-			if(sce->r.mode & R_PANORAMA) {
+			if (sce->r.mode & R_PANORAMA) {
 				/* all these checks to ensure saved files with svn version keep working... */
-				if(sce->r.xsch < sce->r.ysch) {
+				if (sce->r.xsch < sce->r.ysch) {
 					Object *obc= newlibadr(fd, lib, sce->camera);
-					if(obc && obc->type==OB_CAMERA) {
+					if (obc && obc->type==OB_CAMERA) {
 						Camera *cam= newlibadr(fd, lib, obc->data);
-						if(cam->lens>=10.0f) {
+						if (cam->lens>=10.0f) {
 							sce->r.xsch*= sce->r.xparts;
 							cam->lens*= (float)sce->r.ysch/(float)sce->r.xsch;
 						}
@@ -9237,53 +9409,53 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 		}
 		
-		for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
+		for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
 			ntree_version_241(ntree);
 		
-		for(la= main->lamp.first; la; la= la->id.next)
-			if(la->buffers==0)
+		for (la= main->lamp.first; la; la= la->id.next)
+			if (la->buffers==0)
 				la->buffers= 1;
 		
-		for(tex= main->tex.first; tex; tex= tex->id.next) {
-			if(tex->env && tex->env->viewscale==0.0f)
+		for (tex= main->tex.first; tex; tex= tex->id.next) {
+			if (tex->env && tex->env->viewscale==0.0f)
 				tex->env->viewscale= 1.0f;
 //			tex->imaflag |= TEX_GAUSS_MIP;
 		}
 		
 		/* for empty drawsize and drawtype */
-		for(ob=main->object.first; ob; ob= ob->id.next) {
-			if(ob->empty_drawsize==0.0f) {
+		for (ob=main->object.first; ob; ob= ob->id.next) {
+			if (ob->empty_drawsize==0.0f) {
 				ob->empty_drawtype = OB_ARROWS;
 				ob->empty_drawsize = 1.0;
 			}
 		}
 		
-		for(ma= main->mat.first; ma; ma= ma->id.next) {
+		for (ma= main->mat.first; ma; ma= ma->id.next) {
 			/* stucci returns intensity from now on */
 			int a;
-			for(a=0; a<MAX_MTEX; a++) {
-				if(ma->mtex[a] && ma->mtex[a]->tex) {
+			for (a=0; a<MAX_MTEX; a++) {
+				if (ma->mtex[a] && ma->mtex[a]->tex) {
 					tex= newlibadr(fd, lib, ma->mtex[a]->tex);
-					if(tex && tex->type==TEX_STUCCI)
+					if (tex && tex->type==TEX_STUCCI)
 						ma->mtex[a]->mapto &= ~(MAP_COL|MAP_SPEC|MAP_REF);
 				}
 			}
 			/* transmissivity defaults */
-			if(ma->tx_falloff==0.0f) ma->tx_falloff= 1.0f;
+			if (ma->tx_falloff==0.0f) ma->tx_falloff= 1.0f;
 		}
 		
 		/* during 2.41 images with this name were used for viewer node output, lets fix that */
-		if(main->versionfile == 241) {
+		if (main->versionfile == 241) {
 			Image *ima;
-			for(ima= main->image.first; ima; ima= ima->id.next)
-				if(strcmp(ima->name, "Compositor")==0) {
+			for (ima= main->image.first; ima; ima= ima->id.next)
+				if (strcmp(ima->name, "Compositor")==0) {
 					strcpy(ima->id.name+2, "Viewer Node");
 					strcpy(ima->name, "Viewer Node");
 				}
 		}
 	}
 		
-	if(main->versionfile <= 242) {
+	if (main->versionfile <= 242) {
 		Scene *sce;
 		bScreen *sc;
 		Object *ob;
@@ -9297,14 +9469,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		bNodeTree *ntree;
 		int a;
 		
-		for(sc= main->screen.first; sc; sc= sc->id.next) {
+		for (sc= main->screen.first; sc; sc= sc->id.next) {
 			ScrArea *sa;
 			sa= sc->areabase.first;
-			while(sa) {
+			while (sa) {
 				SpaceLink *sl;
 
 				for (sl= sa->spacedata.first; sl; sl= sl->next) {
-					if(sl->spacetype==SPACE_VIEW3D) {
+					if (sl->spacetype==SPACE_VIEW3D) {
 						View3D *v3d= (View3D*) sl;
 						if (v3d->gridsubdiv == 0)
 							v3d->gridsubdiv = 10;
@@ -9314,7 +9486,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 		}
 		
-		for(sce= main->scene.first; sce; sce= sce->id.next) {
+		for (sce= main->scene.first; sce; sce= sce->id.next) {
 			if (sce->toolsettings->select_thresh == 0.0f)
 				sce->toolsettings->select_thresh= 0.01f;
 			if (sce->toolsettings->clean_thresh == 0.0f) 
@@ -9326,42 +9498,42 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 				else
 					sce->r.threads= 1;
 			}
-			if(sce->nodetree)
+			if (sce->nodetree)
 				ntree_version_242(sce->nodetree);
 		}
 		
-		for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
+		for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
 			ntree_version_242(ntree);
 		
 		/* add default radius values to old curve points */
-		for(cu= main->curve.first; cu; cu= cu->id.next) {
-			for(nu= cu->nurb.first; nu; nu= nu->next) {
+		for (cu= main->curve.first; cu; cu= cu->id.next) {
+			for (nu= cu->nurb.first; nu; nu= nu->next) {
 				if (nu) {
-					if(nu->bezt) {
-						for(bezt=nu->bezt, a=0; a<nu->pntsu; a++, bezt++) {
+					if (nu->bezt) {
+						for (bezt=nu->bezt, a=0; a<nu->pntsu; a++, bezt++) {
 							if (!bezt->radius) bezt->radius= 1.0;
 						}
 					}
-					else if(nu->bp) {
-						for(bp=nu->bp, a=0; a<nu->pntsu*nu->pntsv; a++, bp++) {
-							if(!bp->radius) bp->radius= 1.0;
+					else if (nu->bp) {
+						for (bp=nu->bp, a=0; a<nu->pntsu*nu->pntsv; a++, bp++) {
+							if (!bp->radius) bp->radius= 1.0;
 						}
 					}
 				}
 			}
 		}
 		
-		for(ob = main->object.first; ob; ob= ob->id.next) {
+		for (ob = main->object.first; ob; ob= ob->id.next) {
 			ModifierData *md;
 			ListBase *list;
 			list = &ob->constraints;
 
 			/* check for already existing MinMax (floor) constraint
-			   and update the sticky flagging */
+			 * and update the sticky flagging */
 
-			if (list){
+			if (list) {
 				bConstraint *curcon;
-				for (curcon = list->first; curcon; curcon=curcon->next){
+				for (curcon = list->first; curcon; curcon=curcon->next) {
 					switch (curcon->type) {
 						case CONSTRAINT_TYPE_MINMAX:
 						{
@@ -9377,7 +9549,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 							bRotateLikeConstraint *data = curcon->data;
 							
 							/* version patch from buttons_object.c */
-							if(data->flag==0) 
+							if (data->flag==0)
 								data->flag = ROTLIKE_X|ROTLIKE_Y|ROTLIKE_Z;
 						}
 							break;
@@ -9386,11 +9558,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 
 			if (ob->type == OB_ARMATURE) {
-				if (ob->pose){
+				if (ob->pose) {
 					bConstraint *curcon;
 					bPoseChannel *pchan;
-					for (pchan = ob->pose->chanbase.first; pchan; pchan=pchan->next){
-						for (curcon = pchan->constraints.first; curcon; curcon=curcon->next){
+					for (pchan = ob->pose->chanbase.first; pchan; pchan=pchan->next) {
+						for (curcon = pchan->constraints.first; curcon; curcon=curcon->next) {
 							switch (curcon->type) {
 								case CONSTRAINT_TYPE_MINMAX:
 								{
@@ -9415,7 +9587,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 									bRotateLikeConstraint *data = curcon->data;
 									
 									/* version patch from buttons_object.c */
-									if(data->flag==0) 
+									if (data->flag==0)
 										data->flag = ROTLIKE_X|ROTLIKE_Y|ROTLIKE_Z;
 								}
 									break;
@@ -9436,54 +9608,51 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			
 		}
 		
-		for(ma = main->mat.first; ma; ma= ma->id.next) {
-			if(ma->shad_alpha==0.0f)
+		for (ma = main->mat.first; ma; ma= ma->id.next) {
+			if (ma->shad_alpha==0.0f)
 				ma->shad_alpha= 1.0f;
-			if(ma->nodetree)
+			if (ma->nodetree)
 				ntree_version_242(ma->nodetree);
 		}
 
-		for(me=main->mesh.first; me; me=me->id.next)
+		for (me=main->mesh.first; me; me=me->id.next)
 			customdata_version_242(me);
 		
-		for(group= main->group.first; group; group= group->id.next)
-			if(group->layer==0)
+		for (group= main->group.first; group; group= group->id.next)
+			if (group->layer==0)
 				group->layer= (1<<20)-1;
-		
-		/* History fix (python?), shape key adrcode numbers have to be sorted */
-		sort_shape_fix(main);
-				
+
 		/* now, subversion control! */
-		if(main->subversionfile < 3) {
+		if (main->subversionfile < 3) {
 			Image *ima;
 			Tex *tex;
 			
 			/* Image refactor initialize */
-			for(ima= main->image.first; ima; ima= ima->id.next) {
+			for (ima= main->image.first; ima; ima= ima->id.next) {
 				ima->source= IMA_SRC_FILE;
 				ima->type= IMA_TYPE_IMAGE;
 				
 				ima->gen_x= 256; ima->gen_y= 256;
 				ima->gen_type= 1;
 				
-				if(0==strncmp(ima->id.name+2, "Viewer Node", sizeof(ima->id.name)-2)) {
+				if (0==strncmp(ima->id.name+2, "Viewer Node", sizeof(ima->id.name)-2)) {
 					ima->source= IMA_SRC_VIEWER;
 					ima->type= IMA_TYPE_COMPOSITE;
 				}
-				if(0==strncmp(ima->id.name+2, "Render Result", sizeof(ima->id.name)-2)) {
+				if (0==strncmp(ima->id.name+2, "Render Result", sizeof(ima->id.name)-2)) {
 					ima->source= IMA_SRC_VIEWER;
 					ima->type= IMA_TYPE_R_RESULT;
 				}
 				
 			}
-			for(tex= main->tex.first; tex; tex= tex->id.next) {
-				if(tex->type==TEX_IMAGE && tex->ima) {
+			for (tex= main->tex.first; tex; tex= tex->id.next) {
+				if (tex->type==TEX_IMAGE && tex->ima) {
 					ima= newlibadr(fd, lib, tex->ima);
-					if(tex->imaflag & TEX_ANIM5_)
+					if (tex->imaflag & TEX_ANIM5_)
 						ima->source= IMA_SRC_MOVIE;
-					if(tex->imaflag & TEX_FIELDS_)
+					if (tex->imaflag & TEX_FIELDS_)
 						ima->flag |= IMA_FIELDS;
-					if(tex->imaflag & TEX_STD_FIELD_)
+					if (tex->imaflag & TEX_STD_FIELD_)
 						ima->flag |= IMA_STD_FIELD;
 				}
 				tex->iuser.frames= tex->frames;
@@ -9492,27 +9661,27 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 				tex->iuser.sfra= tex->sfra;
 				tex->iuser.cycl= (tex->imaflag & TEX_ANIMCYCLIC_)!=0;
 			}
-			for(sce= main->scene.first; sce; sce= sce->id.next) {
-				if(sce->nodetree)
+			for (sce= main->scene.first; sce; sce= sce->id.next) {
+				if (sce->nodetree)
 					do_version_ntree_242_2(sce->nodetree);
 			}
-			for(ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
+			for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
 				do_version_ntree_242_2(ntree);
-			for(ma = main->mat.first; ma; ma= ma->id.next)
-				if(ma->nodetree)
+			for (ma = main->mat.first; ma; ma= ma->id.next)
+				if (ma->nodetree)
 					do_version_ntree_242_2(ma->nodetree);
 			
-			for(sc= main->screen.first; sc; sc= sc->id.next) {
+			for (sc= main->screen.first; sc; sc= sc->id.next) {
 				ScrArea *sa;
-				for(sa= sc->areabase.first; sa; sa= sa->next) {
+				for (sa= sc->areabase.first; sa; sa= sa->next) {
 					SpaceLink *sl;
 					for (sl= sa->spacedata.first; sl; sl= sl->next) {
-						if(sl->spacetype==SPACE_IMAGE)
+						if (sl->spacetype==SPACE_IMAGE)
 							((SpaceImage *)sl)->iuser.fie_ima= 2;
-						else if(sl->spacetype==SPACE_VIEW3D) {
+						else if (sl->spacetype==SPACE_VIEW3D) {
 							View3D *v3d= (View3D *)sl;
 							BGpic *bgpic;
-							for(bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next)
+							for (bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next)
 								bgpic->iuser.fie_ima= 2;
 						}
 					}
@@ -9520,8 +9689,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 		}
 		
-		if(main->subversionfile < 4) {
-			for(sce= main->scene.first; sce; sce= sce->id.next) {
+		if (main->subversionfile < 4) {
+			for (sce= main->scene.first; sce; sce= sce->id.next) {
 				sce->r.bake_mode= 1;	/* prevent to include render stuff here */
 				sce->r.bake_filter= 2;
 				sce->r.bake_osa= 5;
@@ -9529,20 +9698,20 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 		}
 
-		if(main->subversionfile < 5) {
-			for(sce= main->scene.first; sce; sce= sce->id.next) {
+		if (main->subversionfile < 5) {
+			for (sce= main->scene.first; sce; sce= sce->id.next) {
 				/* improved triangle to quad conversion settings */
-				if(sce->toolsettings->jointrilimit==0.0f)
+				if (sce->toolsettings->jointrilimit==0.0f)
 					sce->toolsettings->jointrilimit= 0.8f;
 			}
 		}
 	}
-	if(main->versionfile <= 243) {
+	if (main->versionfile <= 243) {
 		Object *ob= main->object.first;
 		Material *ma;
 
-		for(ma=main->mat.first; ma; ma= ma->id.next) {
-			if(ma->sss_scale==0.0f) {
+		for (ma=main->mat.first; ma; ma= ma->id.next) {
+			if (ma->sss_scale==0.0f) {
 				ma->sss_radius[0]= 1.0f;
 				ma->sss_radius[1]= 1.0f;
 				ma->sss_radius[2]= 1.0f;
@@ -9555,28 +9724,28 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 				ma->sss_colfac= 1.0f;
 				ma->sss_texfac= 0.0f;
 			}
-			if(ma->sss_front==0 && ma->sss_back==0) {
+			if (ma->sss_front==0 && ma->sss_back==0) {
 				ma->sss_front= 1.0f;
 				ma->sss_back= 1.0f;
 			}
-			if(ma->sss_col[0]==0 && ma->sss_col[1]==0 && ma->sss_col[2]==0) {
+			if (ma->sss_col[0]==0 && ma->sss_col[1]==0 && ma->sss_col[2]==0) {
 				ma->sss_col[0]= ma->r;
 				ma->sss_col[1]= ma->g;
 				ma->sss_col[2]= ma->b;
 			}
 		}
 		
-		for(; ob; ob= ob->id.next) {
+		for (; ob; ob= ob->id.next) {
 			bDeformGroup *curdef;
 			
-			for(curdef= ob->defbase.first; curdef; curdef=curdef->next) {
+			for (curdef= ob->defbase.first; curdef; curdef=curdef->next) {
 				/* replace an empty-string name with unique name */
 				if (curdef->name[0] == '\0') {
 					defgroup_unique_name(curdef, ob);
 				}
 			}
 
-			if(main->versionfile < 243 || main->subversionfile < 1) {
+			if (main->versionfile < 243 || main->subversionfile < 1) {
 				ModifierData *md;
 
 				/* translate old mirror modifier axis values to new flags */
@@ -9604,40 +9773,40 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 		
 		/* render layer added, this is not the active layer */
-		if(main->versionfile <= 243 || main->subversionfile < 2) {
+		if (main->versionfile <= 243 || main->subversionfile < 2) {
 			Mesh *me;
-			for(me=main->mesh.first; me; me=me->id.next)
+			for (me=main->mesh.first; me; me=me->id.next)
 				customdata_version_243(me);
 		}		
 
 	}
 	
-	if(main->versionfile <= 244) {
+	if (main->versionfile <= 244) {
 		Scene *sce;
 		bScreen *sc;
 		Lamp *la;
 		World *wrld;
 		
-		if(main->versionfile != 244 || main->subversionfile < 2) {
-			for(sce= main->scene.first; sce; sce= sce->id.next)
+		if (main->versionfile != 244 || main->subversionfile < 2) {
+			for (sce= main->scene.first; sce; sce= sce->id.next)
 				sce->r.mode |= R_SSS;
 
 			/* correct older action editors - incorrect scrolling */
-			for(sc= main->screen.first; sc; sc= sc->id.next) {
+			for (sc= main->screen.first; sc; sc= sc->id.next) {
 				ScrArea *sa;
 				sa= sc->areabase.first;
-				while(sa) {
+				while (sa) {
 					SpaceLink *sl;
 
 					for (sl= sa->spacedata.first; sl; sl= sl->next) {
-						if(sl->spacetype==SPACE_ACTION) {
+						if (sl->spacetype==SPACE_ACTION) {
 							SpaceAction *saction= (SpaceAction*) sl;
 							
-							saction->v2d.tot.ymin= -1000.0;
-							saction->v2d.tot.ymax= 0.0;
+							saction->v2d.tot.ymin = -1000.0;
+							saction->v2d.tot.ymax = 0.0;
 							
-							saction->v2d.cur.ymin= -75.0;
-							saction->v2d.cur.ymax= 5.0;
+							saction->v2d.cur.ymin = -75.0;
+							saction->v2d.cur.ymax = 5.0;
 						}
 					}
 					sa = sa->next;
@@ -9648,7 +9817,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			/* constraints recode version patch used to be here. Moved to 245 now... */
 			
 			
-			for(wrld=main->world.first; wrld; wrld= wrld->id.next) {
+			for (wrld=main->world.first; wrld; wrld= wrld->id.next) {
 				if (wrld->mode & WO_AMB_OCC)
 					wrld->ao_samp_method = WO_AOSAMP_CONSTANT;
 				else
@@ -9657,7 +9826,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 				wrld->ao_adapt_thresh = 0.005f;
 			}
 			
-			for(la=main->lamp.first; la; la= la->id.next) {
+			for (la=main->lamp.first; la; la= la->id.next) {
 				if (la->type == LA_AREA)
 					la->ray_samp_method = LA_SAMP_CONSTANT;
 				else
@@ -9667,7 +9836,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 		}
 	}
-	if(main->versionfile <= 245) {
+	if (main->versionfile <= 245) {
 		Scene *sce;
 		Object *ob;
 		Image *ima;
@@ -9713,7 +9882,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 					}
 				}
 				
-				/* correctly initialise constinv matrix */
+				/* correctly initialize constinv matrix */
 				unit_m4(ob->constinv);
 				
 				if (ob->type == OB_ARMATURE) {
@@ -9743,7 +9912,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 								}
 							}
 							
-							/* correctly initialise constinv matrix */
+							/* correctly initialize constinv matrix */
 							unit_m4(pchan->constinv);
 						}
 					}
@@ -9755,19 +9924,19 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		if (main->versionfile != 245) {
 
 			/* repair preview from 242 - 244*/
-			for(ima= main->image.first; ima; ima= ima->id.next) {
+			for (ima= main->image.first; ima; ima= ima->id.next) {
 				ima->preview = NULL;
 			}
 		}
 
 		/* add point caches */
-		for(ob=main->object.first; ob; ob=ob->id.next) {
-			if(ob->soft && !ob->soft->pointcache)
+		for (ob=main->object.first; ob; ob=ob->id.next) {
+			if (ob->soft && !ob->soft->pointcache)
 				ob->soft->pointcache= BKE_ptcache_add(&ob->soft->ptcaches);
 
-			for(psys=ob->particlesystem.first; psys; psys=psys->next) {
-				if(psys->pointcache) {
-					if(psys->pointcache->flag & PTCACHE_BAKED && (psys->pointcache->flag & PTCACHE_DISK_CACHE)==0) {
+			for (psys=ob->particlesystem.first; psys; psys=psys->next) {
+				if (psys->pointcache) {
+					if (psys->pointcache->flag & PTCACHE_BAKED && (psys->pointcache->flag & PTCACHE_DISK_CACHE)==0) {
 						printf("Old memory cache isn't supported for particles, so re-bake the simulation!\n");
 						psys->pointcache->flag &= ~PTCACHE_BAKED;
 					}
@@ -9776,25 +9945,25 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 					psys->pointcache= BKE_ptcache_add(&psys->ptcaches);
 			}
 
-			for(md=ob->modifiers.first; md; md=md->next) {
-				if(md->type==eModifierType_Cloth) {
+			for (md=ob->modifiers.first; md; md=md->next) {
+				if (md->type==eModifierType_Cloth) {
 					ClothModifierData *clmd = (ClothModifierData*) md;
-					if(!clmd->point_cache)
+					if (!clmd->point_cache)
 						clmd->point_cache= BKE_ptcache_add(&clmd->ptcaches);
 				}
 			}
 		}
 
 		/* Copy over old per-level multires vertex data
-		   into a single vertex array in struct Multires */
-		for(me = main->mesh.first; me; me=me->id.next) {
-			if(me->mr && !me->mr->verts) {
+		 * into a single vertex array in struct Multires */
+		for (me = main->mesh.first; me; me=me->id.next) {
+			if (me->mr && !me->mr->verts) {
 				MultiresLevel *lvl = me->mr->levels.last;
-				if(lvl) {
+				if (lvl) {
 					me->mr->verts = lvl->verts;
 					lvl->verts = NULL;
 					/* Don't need the other vert arrays */
-					for(lvl = lvl->prev; lvl; lvl = lvl->prev) {
+					for (lvl = lvl->prev; lvl; lvl = lvl->prev) {
 						MEM_freeN(lvl->verts);
 						lvl->verts = NULL;
 					}
@@ -9803,7 +9972,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 		
 		if (main->versionfile != 245 || main->subversionfile < 1) {
-			for(la=main->lamp.first; la; la= la->id.next) {
+			for (la=main->lamp.first; la; la= la->id.next) {
 				if (la->mode & LA_QUAD) la->falloff_type = LA_FALLOFF_SLIDERS;
 				else la->falloff_type = LA_FALLOFF_INVLINEAR;
 				
@@ -9814,8 +9983,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 		}		
 		
-		for(ma=main->mat.first; ma; ma= ma->id.next) {
-			if(ma->samp_gloss_mir == 0) {
+		for (ma=main->mat.first; ma; ma= ma->id.next) {
+			if (ma->samp_gloss_mir == 0) {
 				ma->gloss_mir = ma->gloss_tra= 1.0f;
 				ma->aniso_gloss_mir = 1.0f;
 				ma->samp_gloss_mir = ma->samp_gloss_tra= 18;
@@ -9824,15 +9993,15 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 				ma->fadeto_mir = MA_RAYMIR_FADETOSKY;
 			}
 
-			if(ma->strand_min == 0.0f)
+			if (ma->strand_min == 0.0f)
 				ma->strand_min= 1.0f;
 		}
 
-		for(part=main->particle.first; part; part=part->id.next) {
-			if(part->ren_child_nbr==0)
+		for (part=main->particle.first; part; part=part->id.next) {
+			if (part->ren_child_nbr==0)
 				part->ren_child_nbr= part->child_nbr;
 
-			if(part->simplify_refsize==0) {
+			if (part->simplify_refsize==0) {
 				part->simplify_refsize= 1920;
 				part->simplify_rate= 1.0f;
 				part->simplify_transition= 0.1f;
@@ -9840,49 +10009,49 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 		}
 
-		for(wrld=main->world.first; wrld; wrld= wrld->id.next) {
-			if(wrld->ao_approx_error == 0.0f)
+		for (wrld=main->world.first; wrld; wrld= wrld->id.next) {
+			if (wrld->ao_approx_error == 0.0f)
 				wrld->ao_approx_error= 0.25f;
 		}
 
-		for(sce= main->scene.first; sce; sce= sce->id.next) {
-			if(sce->nodetree)
+		for (sce= main->scene.first; sce; sce= sce->id.next) {
+			if (sce->nodetree)
 				ntree_version_245(fd, lib, sce->nodetree);
 
-			if(sce->r.simplify_shadowsamples == 0) {
+			if (sce->r.simplify_shadowsamples == 0) {
 				sce->r.simplify_subsurf= 6;
 				sce->r.simplify_particles= 1.0f;
 				sce->r.simplify_shadowsamples= 16;
 				sce->r.simplify_aosss= 1.0f;
 			}
 
-			if(sce->r.cineongamma == 0) {
+			if (sce->r.cineongamma == 0) {
 				sce->r.cineonblack= 95;
 				sce->r.cineonwhite= 685;
 				sce->r.cineongamma= 1.7f;
 			}
 		}
 
-		for(ntree=main->nodetree.first; ntree; ntree= ntree->id.next)
+		for (ntree=main->nodetree.first; ntree; ntree= ntree->id.next)
 			ntree_version_245(fd, lib, ntree);
 
 		/* fix for temporary flag changes during 245 cycle */
-		for(ima= main->image.first; ima; ima= ima->id.next) {
-			if(ima->flag & IMA_OLD_PREMUL) {
+		for (ima= main->image.first; ima; ima= ima->id.next) {
+			if (ima->flag & IMA_OLD_PREMUL) {
 				ima->flag &= ~IMA_OLD_PREMUL;
 				ima->flag |= IMA_DO_PREMUL;
 			}
 		}
 
-		for(tex=main->tex.first; tex; tex=tex->id.next) {
-			if(tex->iuser.flag & IMA_OLD_PREMUL) {
+		for (tex=main->tex.first; tex; tex=tex->id.next) {
+			if (tex->iuser.flag & IMA_OLD_PREMUL) {
 				tex->iuser.flag &= ~IMA_OLD_PREMUL;
 				tex->iuser.flag |= IMA_DO_PREMUL;
 
 			}
 
 			ima= newlibadr(fd, lib, tex->ima);
-			if(ima && (tex->iuser.flag & IMA_DO_PREMUL)) { 
+			if (ima && (tex->iuser.flag & IMA_DO_PREMUL)) {
 				ima->flag &= ~IMA_OLD_PREMUL;
 				ima->flag |= IMA_DO_PREMUL;
 			}
@@ -9893,7 +10062,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 	 * */
 	{
 		Scene *sce;
-		for(sce=main->scene.first; sce; sce = sce->id.next)
+		for (sce=main->scene.first; sce; sce = sce->id.next)
 		{
 			if (sce->toolsettings->skgen_subdivisions[0] == sce->toolsettings->skgen_subdivisions[1] ||
 				sce->toolsettings->skgen_subdivisions[0] == sce->toolsettings->skgen_subdivisions[2] ||
@@ -9911,7 +10080,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		Image *ima;
 
 		/* initialize 1:1 Aspect */
-		for(ima= main->image.first; ima; ima= ima->id.next) {
+		for (ima= main->image.first; ima; ima= ima->id.next) {
 			ima->aspx = ima->aspy = 1.0f;				
 		}
 
@@ -9922,23 +10091,23 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		ModifierData *md;
 		Object *ob;
 		
-		for(arm= main->armature.first; arm; arm= arm->id.next)
+		for (arm= main->armature.first; arm; arm= arm->id.next)
 			arm->deformflag |= ARM_DEF_B_BONE_REST;
 		
-		for(ob = main->object.first; ob; ob= ob->id.next) {
-			for(md=ob->modifiers.first; md; md=md->next) {
-				if(md->type==eModifierType_Armature)
+		for (ob = main->object.first; ob; ob= ob->id.next) {
+			for (md=ob->modifiers.first; md; md=md->next) {
+				if (md->type==eModifierType_Armature)
 					((ArmatureModifierData*)md)->deformflag |= ARM_DEF_B_BONE_REST;
 			}
 		}
 	}
 
 	if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 5)) {
-		/* foreground color needs to be somthing other then black */
+		/* foreground color needs to be something other then black */
 		Scene *sce;
-		for(sce= main->scene.first; sce; sce=sce->id.next) {
+		for (sce= main->scene.first; sce; sce=sce->id.next) {
 			sce->r.fg_stamp[0] = sce->r.fg_stamp[1] = sce->r.fg_stamp[2] = 0.8f;
-			sce->r.fg_stamp[3] = 1.0f; /* dont use text alpha yet */
+			sce->r.fg_stamp[3] = 1.0f; /* don't use text alpha yet */
 			sce->r.bg_stamp[3] = 0.25f; /* make sure the background has full alpha */
 		}
 	}
@@ -9947,7 +10116,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 	if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 6)) {
 		Scene *sce;
 		/* fix frs_sec_base */
-		for(sce= main->scene.first; sce; sce= sce->id.next) {
+		for (sce= main->scene.first; sce; sce= sce->id.next) {
 			if (sce->r.frs_sec_base == 0) {
 				sce->r.frs_sec_base = 1;
 			}
@@ -10021,12 +10190,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 				}
 			}
 
-			if(ob->soft && ob->soft->keys) {
+			if (ob->soft && ob->soft->keys) {
 				SoftBody *sb = ob->soft;
 				int k;
 
-				for(k=0; k<sb->totkey; k++) {
-					if(sb->keys[k])
+				for (k=0; k<sb->totkey; k++) {
+					if (sb->keys[k])
 						MEM_freeN(sb->keys[k]);
 				}
 
@@ -10043,13 +10212,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		Object *ob;
 		PartEff *paf=NULL;
 
-		for(ob = main->object.first; ob; ob= ob->id.next) {
-			if(ob->soft && ob->soft->keys) {
+		for (ob = main->object.first; ob; ob= ob->id.next) {
+			if (ob->soft && ob->soft->keys) {
 				SoftBody *sb = ob->soft;
 				int k;
 
-				for(k=0; k<sb->totkey; k++) {
-					if(sb->keys[k])
+				for (k=0; k<sb->totkey; k++) {
+					if (sb->keys[k])
 						MEM_freeN(sb->keys[k]);
 				}
 
@@ -10060,7 +10229,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 
 			/* convert old particles to new system */
-			if((paf = do_version_give_parteff_245(ob))) {
+			if ((paf = do_version_give_parteff_245(ob))) {
 				ParticleSystem *psys;
 				ModifierData *md;
 				ParticleSystemModifierData *psmd;
@@ -10115,8 +10284,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 				copy_v3_v3(part->acc, paf->force);
 
 				/* flags */
-				if(paf->stype & PAF_VECT) {
-					if(paf->flag & PAF_STATIC) {
+				if (paf->stype & PAF_VECT) {
+					if (paf->flag & PAF_STATIC) {
 						/* new hair lifetime is always 100.0f */
 						float fac = paf->lifetime / 100.0f;
 
@@ -10149,11 +10318,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 				psys->vgroup[PSYS_VG_LENGTH] = paf->vertgroup_v;
 
 				/* dupliobjects */
-				if(ob->transflag & OB_DUPLIVERTS) {
+				if (ob->transflag & OB_DUPLIVERTS) {
 					Object *dup = main->object.first;
 
-					for(; dup; dup= dup->id.next) {
-						if(ob == newlibadr(fd, lib, dup->parent)) {
+					for (; dup; dup= dup->id.next) {
+						if (ob == newlibadr(fd, lib, dup->parent)) {
 							part->dup_ob = dup;
 							ob->transflag |= OB_DUPLIPARTS;
 							ob->transflag &= ~OB_DUPLIVERTS;
@@ -10169,7 +10338,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 				
 				{
 					FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
-					if(fluidmd && fluidmd->fss && fluidmd->fss->type == OB_FLUIDSIM_PARTICLE)
+					if (fluidmd && fluidmd->fss && fluidmd->fss->type == OB_FLUIDSIM_PARTICLE)
 						part->type = PART_FLUID;
 				}
 
@@ -10179,18 +10348,18 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 		}
 
-		for(sce= main->scene.first; sce; sce=sce->id.next) {
+		for (sce= main->scene.first; sce; sce=sce->id.next) {
 			ParticleEditSettings *pset= &sce->toolsettings->particle;
 			int a;
 
-			if(pset->brush[0].size == 0) {
+			if (pset->brush[0].size == 0) {
 				pset->flag= PE_KEEP_LENGTHS|PE_LOCK_FIRST|PE_DEFLECT_EMITTER;
 				pset->emitterdist= 0.25f;
 				pset->totrekey= 5;
 				pset->totaddkey= 5;
 				pset->brushtype= PE_BRUSH_NONE;
 
-				for(a=0; a<PE_TOT_BRUSH; a++) {
+				for (a=0; a<PE_TOT_BRUSH; a++) {
 					pset->brush[a].strength= 50;
 					pset->brush[a].size= 50;
 					pset->brush[a].step= 10;
@@ -10204,10 +10373,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		Material *ma;
 		int a;
 
-		for(ma=main->mat.first; ma; ma= ma->id.next)
-			if(ma->mode & MA_NORMAP_TANG)
-				for(a=0; a<MAX_MTEX; a++)
-					if(ma->mtex[a] && ma->mtex[a]->tex)
+		for (ma=main->mat.first; ma; ma= ma->id.next)
+			if (ma->mode & MA_NORMAP_TANG)
+				for (a=0; a<MAX_MTEX; a++)
+					if (ma->mtex[a] && ma->mtex[a]->tex)
 						ma->mtex[a]->normapspace = MTEX_NSPACE_TANGENT;
 	}
 	
@@ -10215,7 +10384,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		Object *ob;
 		
 		/* dupliface scale */
-		for(ob= main->object.first; ob; ob= ob->id.next)
+		for (ob= main->object.first; ob; ob= ob->id.next)
 			ob->dupfacesca = 1.0f;
 	}
 	
@@ -10240,7 +10409,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 				strip->scale = length / (repeat * actlength);
 				if (strip->scale == 0.0f) strip->scale= 1.0f;
 			}	
-			if(ob->soft){
+			if (ob->soft) {
 				ob->soft->inpush =  ob->soft->inspring;
 				ob->soft->shearstiff = 1.0f; 
 			}
@@ -10251,7 +10420,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		Scene *sce;
 		Sequence *seq;
 		
-		for(sce=main->scene.first; sce; sce=sce->id.next) {
+		for (sce=main->scene.first; sce; sce=sce->id.next) {
 			SEQ_BEGIN(sce->ed, seq) {
 				if (seq->blend_mode == 0)
 					seq->blend_opacity = 100.0f;
@@ -10291,13 +10460,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 	}
 
 	/* sun/sky */
-	if(main->versionfile < 246) {
+	if (main->versionfile < 246) {
 		Object *ob;
 		bActuator *act;
 
 		/* dRot actuator change direction in 2.46 */
-		for(ob = main->object.first; ob; ob= ob->id.next) {
-			for(act= ob->actuators.first; act; act= act->next) {
+		for (ob = main->object.first; ob; ob= ob->id.next) {
+			for (act= ob->actuators.first; act; act= act->next) {
 				if (act->type == ACT_OBJECT) {
 					bObjectActuator *ba= act->data;
 
@@ -10310,12 +10479,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 	}
 	
 	// convert fluids to modifier
-	if(main->versionfile < 246 || (main->versionfile == 246 && main->subversionfile < 1))
+	if (main->versionfile < 246 || (main->versionfile == 246 && main->subversionfile < 1))
 	{
 		Object *ob;
 		
-		for(ob = main->object.first; ob; ob= ob->id.next) {
-			if(ob->fluidsimSettings)
+		for (ob = main->object.first; ob; ob= ob->id.next) {
+			if (ob->fluidsimSettings)
 			{
 				FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifier_new(eModifierType_Fluidsim);
 				BLI_addhead(&ob->modifiers, (ModifierData *)fluidmd);
@@ -10333,32 +10502,32 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 	}
 	
 
-	if(main->versionfile < 246 || (main->versionfile == 246 && main->subversionfile < 1)) {
+	if (main->versionfile < 246 || (main->versionfile == 246 && main->subversionfile < 1)) {
 		Mesh *me;
 
-		for(me=main->mesh.first; me; me= me->id.next)
+		for (me=main->mesh.first; me; me= me->id.next)
 			alphasort_version_246(fd, lib, me);
 	}
 	
-	if(main->versionfile < 246 || (main->versionfile == 246 && main->subversionfile < 1)){
+	if (main->versionfile < 246 || (main->versionfile == 246 && main->subversionfile < 1)) {
 		Object *ob;
-		for(ob = main->object.first; ob; ob= ob->id.next) {
-			if(ob->pd && (ob->pd->forcefield == PFIELD_WIND))
+		for (ob = main->object.first; ob; ob= ob->id.next) {
+			if (ob->pd && (ob->pd->forcefield == PFIELD_WIND))
 				ob->pd->f_noise = 0.0f;
 		}
 	}
 
-	if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 2)){
+	if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 2)) {
 		Object *ob;
-		for(ob = main->object.first; ob; ob= ob->id.next) {
+		for (ob = main->object.first; ob; ob= ob->id.next) {
 			ob->gameflag |= OB_COLLISION;
 			ob->margin = 0.06f;
 		}
 	}
 
-	if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 3)){
+	if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 3)) {
 		Object *ob;
-		for(ob = main->object.first; ob; ob= ob->id.next) {
+		for (ob = main->object.first; ob; ob= ob->id.next) {
 			// Starting from subversion 3, ACTOR is a separate feature.
 			// Before it was conditioning all the other dynamic flags
 			if (!(ob->gameflag & OB_ACTOR))
@@ -10369,7 +10538,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
 	if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 5)) {
 		Lamp *la= main->lamp.first;
-		for(; la; la= la->id.next) {
+		for (; la; la= la->id.next) {
 			la->skyblendtype= MA_RAMP_ADD;
 			la->skyblendfac= 1.0f;
 		}
@@ -10380,8 +10549,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		Curve *cu;
 		Nurb *nu;
 		
-		for(cu= main->curve.first; cu; cu= cu->id.next) {
-			for(nu= cu->nurb.first; nu; nu= nu->next) {
+		for (cu= main->curve.first; cu; cu= cu->id.next) {
+			for (nu= cu->nurb.first; nu; nu= nu->next) {
 				if (nu) {
 					nu->radius_interp = 3;
 					
@@ -10402,8 +10571,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		bActuator *act;
 		Object *ob;
 		
-		for(ob = main->object.first; ob; ob= ob->id.next) {
-			for(act= ob->actuators.first; act; act= act->next) {
+		for (ob = main->object.first; ob; ob= ob->id.next) {
+			for (act= ob->actuators.first; act; act= act->next) {
 				if (act->type == ACT_CONSTRAINT) {
 					bConstraintActuator *coa = act->data;
 					if (coa->type == ACT_CONST_TYPE_DIST) {
@@ -10416,7 +10585,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
 	if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 9)) {
 		Lamp *la= main->lamp.first;
-		for(; la; la= la->id.next) {
+		for (; la; la= la->id.next) {
 			la->sky_exposure= 1.0f;
 		}
 	}
@@ -10426,14 +10595,15 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		bActuator *act;
 		Object *ob;
 		
-		for(ob = main->object.first; ob; ob= ob->id.next) {
-			for(act= ob->actuators.first; act; act= act->next) {
+		for (ob = main->object.first; ob; ob= ob->id.next) {
+			for (act= ob->actuators.first; act; act= act->next) {
 				if (act->type == ACT_MESSAGE) {
 					bMessageActuator *msgAct = (bMessageActuator *) act->data;
 					if (BLI_strnlen(msgAct->toPropName, 3) > 2) {
 						/* strip first 2 chars, would have only worked if these were OB anyway */
-						memmove( msgAct->toPropName, msgAct->toPropName+2, sizeof(msgAct->toPropName)-2 );
-					} else {
+						memmove(msgAct->toPropName, msgAct->toPropName + 2, sizeof(msgAct->toPropName) - 2);
+					}
+					else {
 						msgAct->toPropName[0] = '\0';
 					}
 				}
@@ -10444,8 +10614,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 	if (main->versionfile < 248) {
 		Lamp *la;
 
-		for(la=main->lamp.first; la; la= la->id.next) {
-			if(la->atm_turbidity == 0.0f) {
+		for (la=main->lamp.first; la; la= la->id.next) {
+			if (la->atm_turbidity == 0.0f) {
 				la->sun_effect_type = 0;
 				la->horizon_brightness = 1.0f;
 				la->spread = 1.0f;
@@ -10537,7 +10707,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		Object *ob;
 
 		/* Adjustments needed after Bullets update */
-		for(ob = main->object.first; ob; ob= ob->id.next) {
+		for (ob = main->object.first; ob; ob= ob->id.next) {
 			ob->damping *= 0.635f;
 			ob->rdamping = 0.1f + (0.8f * ob->rdamping);
 		}
@@ -10556,7 +10726,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			sce->r.dometilt = 0;
 		}
 		/* DBVT culling by default */
-		for(wrld=main->world.first; wrld; wrld= wrld->id.next) {
+		for (wrld=main->world.first; wrld; wrld= wrld->id.next) {
 			wrld->mode |= WO_DBVT_CULLING;
 			wrld->occlusionRes = 128;
 		}
@@ -10565,22 +10735,22 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 	if (main->versionfile < 248 || (main->versionfile == 248 && main->subversionfile < 5)) {
 		Object *ob;
 		World *wrld;
-		for(ob = main->object.first; ob; ob= ob->id.next) {
-			ob->m_contactProcessingThreshold = 1.; //pad3 is used for m_contactProcessingThreshold
-			if(ob->parent) {
+		for (ob = main->object.first; ob; ob= ob->id.next) {
+			ob->m_contactProcessingThreshold = 1.0f; //pad3 is used for m_contactProcessingThreshold
+			if (ob->parent) {
 				/* check if top parent has compound shape set and if yes, set this object
-				   to compound shaper as well (was the behaviour before, now it's optional) */
+				 * to compound shaper as well (was the behavior before, now it's optional) */
 				Object *parent= newlibadr(fd, lib, ob->parent);
 				while (parent && parent != ob &&  parent->parent != NULL) {
 					parent = newlibadr(fd, lib, parent->parent);
 				}
-				if(parent) {
+				if (parent) {
 					if (parent->gameflag & OB_CHILD)
 						ob->gameflag |= OB_CHILD;
 				}
 			}
 		}
-		for(wrld=main->world.first; wrld; wrld= wrld->id.next) {
+		for (wrld=main->world.first; wrld; wrld= wrld->id.next) {
 			wrld->ticrate = 60;
 			wrld->maxlogicstep = 5;
 			wrld->physubstep = 1;
@@ -10591,8 +10761,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 	// correct introduce of seed for wind force
 	if (main->versionfile < 249 && main->subversionfile < 1) {
 		Object *ob;
-		for(ob = main->object.first; ob; ob= ob->id.next) {
-			if(ob->pd)
+		for (ob = main->object.first; ob; ob= ob->id.next) {
+			if (ob->pd)
 				ob->pd->seed = ((unsigned int)(ceil(PIL_check_seconds_timer()))+1) % 128;
 		}
 	
@@ -10603,11 +10773,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		Sequence *seq;
 		Editing *ed;
 		
-		while(sce) {
+		while (sce) {
 			ed= sce->ed;
-			if(ed) {
+			if (ed) {
 				SEQP_BEGIN(ed, seq) {
-					if (seq->strip && seq->strip->proxy){
+					if (seq->strip && seq->strip->proxy) {
 						seq->strip->proxy->quality =90;
 					}
 				}
@@ -10639,20 +10809,20 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		bActuator *act;
 		int a;
 
-		for(sound = main->sound.first; sound; sound = sound->id.next)
+		for (sound = main->sound.first; sound; sound = sound->id.next)
 		{
-			if(sound->newpackedfile)
+			if (sound->newpackedfile)
 			{
 				sound->packedfile = sound->newpackedfile;
 				sound->newpackedfile = NULL;
 			}
 		}
 
-		for(ob = main->object.first; ob; ob= ob->id.next) {
-			for(act= ob->actuators.first; act; act= act->next) {
+		for (ob = main->object.first; ob; ob= ob->id.next) {
+			for (act= ob->actuators.first; act; act= act->next) {
 				if (act->type == ACT_SOUND) {
 					bSoundActuator *sAct = (bSoundActuator*) act->data;
-					if(sAct->sound)
+					if (sAct->sound)
 					{
 						sound = newlibadr(fd, lib, sAct->sound);
 						sAct->flag = sound->flags & SOUND_FLAGS_3D ? ACT_SND_3D_SOUND : 0;
@@ -10663,8 +10833,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 						sAct->sound3D.min_gain = sound->min_gain;
 						sAct->sound3D.rolloff_factor = sound->attenuation;
 					}
-					else
-					{
+					else {
 						sAct->sound3D.reference_distance = 1.0f;
 						sAct->volume = 1.0f;
 						sAct->sound3D.max_gain = 1.0f;
@@ -10677,12 +10846,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 		}
 
-		for(scene = main->scene.first; scene; scene = scene->id.next)
+		for (scene = main->scene.first; scene; scene = scene->id.next)
 		{
-			if(scene->ed && scene->ed->seqbasep)
+			if (scene->ed && scene->ed->seqbasep)
 			{
 				SEQ_BEGIN(scene->ed, seq) {
-					if(seq->type == SEQ_HD_SOUND)
+					if (seq->type == SEQ_HD_SOUND)
 					{
 						char str[FILE_MAX];
 						BLI_join_dirfile(str, sizeof(str), seq->strip->dir, seq->strip->stripdata->name);
@@ -10690,9 +10859,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 						seq->sound = sound_new_file(main, str);
 					}
 					/* don't know, if anybody used that
-					   this way, but just in case, upgrade
-					   to new way... */
-					if((seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) &&
+					 * this way, but just in case, upgrade
+					 * to new way... */
+					if ((seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) &&
 					   !(seq->flag & SEQ_USE_PROXY_CUSTOM_DIR))
 					{
 						
@@ -10705,38 +10874,38 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 		}
 
-		for(screen= main->screen.first; screen; screen= screen->id.next) {
+		for (screen= main->screen.first; screen; screen= screen->id.next) {
 			do_versions_windowmanager_2_50(screen);
 			do_versions_gpencil_2_50(main, screen);
 		}
 		
-		/* shader, composit and texture node trees have id.name empty, put something in
+		/* shader, composite and texture node trees have id.name empty, put something in
 		 * to have them show in RNA viewer and accessible otherwise.
 		 */
-		for(ma= main->mat.first; ma; ma= ma->id.next) {
-			if(ma->nodetree && ma->nodetree->id.name[0] == '\0')
+		for (ma= main->mat.first; ma; ma= ma->id.next) {
+			if (ma->nodetree && ma->nodetree->id.name[0] == '\0')
 				strcpy(ma->nodetree->id.name, "NTShader Nodetree");
 			
 			/* which_output 0 is now "not specified" */
-			for(a=0; a<MAX_MTEX; a++) {
-				if(ma->mtex[a]) {
+			for (a=0; a<MAX_MTEX; a++) {
+				if (ma->mtex[a]) {
 					tx= newlibadr(fd, lib, ma->mtex[a]->tex);
-					if(tx && tx->use_nodes)
+					if (tx && tx->use_nodes)
 						ma->mtex[a]->which_output++;
 				}
 			}
 		}
-		/* and composit trees */
-		for(sce= main->scene.first; sce; sce= sce->id.next) {
-			if(sce->nodetree && sce->nodetree->id.name[0] == '\0')
+		/* and composite trees */
+		for (sce= main->scene.first; sce; sce= sce->id.next) {
+			if (sce->nodetree && sce->nodetree->id.name[0] == '\0')
 				strcpy(sce->nodetree->id.name, "NTCompositing Nodetree");
 
 			/* move to cameras */
-			if(sce->r.mode & R_PANORAMA) {
-				for(base=sce->base.first; base; base=base->next) {
+			if (sce->r.mode & R_PANORAMA) {
+				for (base=sce->base.first; base; base=base->next) {
 					ob= newlibadr(fd, lib, base->object);
 
-					if(ob->type == OB_CAMERA && !ob->id.lib) {
+					if (ob->type == OB_CAMERA && !ob->id.lib) {
 						cam= newlibadr(fd, lib, ob->data);
 						cam->flag |= CAM_PANORAMA;
 					}
@@ -10746,33 +10915,33 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 		}
 		/* and texture trees */
-		for(tx= main->tex.first; tx; tx= tx->id.next) {
+		for (tx= main->tex.first; tx; tx= tx->id.next) {
 			bNode *node;
 
-			if(tx->nodetree) {
-				if(tx->nodetree->id.name[0] == '\0')
+			if (tx->nodetree) {
+				if (tx->nodetree->id.name[0] == '\0')
 					strcpy(tx->nodetree->id.name, "NTTexture Nodetree");
 
 				/* which_output 0 is now "not specified" */
-				for(node=tx->nodetree->nodes.first; node; node=node->next)
-					if(node->type == TEX_NODE_OUTPUT)
+				for (node=tx->nodetree->nodes.first; node; node=node->next)
+					if (node->type == TEX_NODE_OUTPUT)
 						node->custom1++;
 			}
 		}
 		
 		/* copy standard draw flag to meshes(used to be global, is not available here) */
-		for(me= main->mesh.first; me; me= me->id.next) {
+		for (me= main->mesh.first; me; me= me->id.next) {
 			me->drawflag= ME_DRAWEDGES|ME_DRAWFACES|ME_DRAWCREASES;
 		}
 
 		/* particle draw and render types */
-		for(part= main->particle.first; part; part= part->id.next) {
-			if(part->draw_as) {
-				if(part->draw_as == PART_DRAW_DOT) {
+		for (part= main->particle.first; part; part= part->id.next) {
+			if (part->draw_as) {
+				if (part->draw_as == PART_DRAW_DOT) {
 					part->ren_as = PART_DRAW_HALO;
 					part->draw_as = PART_DRAW_REND;
 				}
-				else if(part->draw_as <= PART_DRAW_AXIS) {
+				else if (part->draw_as <= PART_DRAW_AXIS) {
 					part->ren_as = PART_DRAW_HALO;
 				}
 				else {
@@ -10784,21 +10953,21 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			part->clength = 1.0f;
 		}
 		/* set old pointcaches to have disk cache flag */
-		for(ob = main->object.first; ob; ob= ob->id.next) {
+		for (ob = main->object.first; ob; ob= ob->id.next) {
 
 			//BKE_ptcache_ids_from_object(&pidlist, ob);
 
-			//for(pid=pidlist.first; pid; pid=pid->next)
+			//for (pid=pidlist.first; pid; pid=pid->next)
 			//	pid->cache->flag |= PTCACHE_DISK_CACHE;
 
 			//BLI_freelistN(&pidlist);
 		}
 
 		/* type was a mixed flag & enum. move the 2d flag elsewhere */
-		for(cu = main->curve.first; cu; cu= cu->id.next) {
+		for (cu = main->curve.first; cu; cu= cu->id.next) {
 			Nurb *nu;
 
-			for(nu= cu->nurb.first; nu; nu= nu->next) {
+			for (nu= cu->nurb.first; nu; nu= nu->next) {
 				nu->flag |= (nu->type & CU_2D);
 				nu->type &= CU_TYPE;
 			}
@@ -10814,57 +10983,57 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		//PTCacheID *pid;
 		//ListBase pidlist;
 
-		for(ob = main->object.first; ob; ob = ob->id.next) {
+		for (ob = main->object.first; ob; ob = ob->id.next) {
 			//BKE_ptcache_ids_from_object(&pidlist, ob);
 
-			//for(pid=pidlist.first; pid; pid=pid->next) {
-			//	if(pid->ptcaches->first == NULL)
+			//for (pid=pidlist.first; pid; pid=pid->next) {
+			//	if (pid->ptcaches->first == NULL)
 			//		pid->ptcaches->first = pid->ptcaches->last = pid->cache;
 			//}
 
 			//BLI_freelistN(&pidlist);
 
-			if(ob->type == OB_MESH) {
+			if (ob->type == OB_MESH) {
 				Mesh *me = newlibadr(fd, lib, ob->data);
 				void *olddata = ob->data;
 				ob->data = me;
 
 				/* XXX - library meshes crash on loading most yoFrankie levels,
 				 * the multires pointer gets invalid -  Campbell */
-				if(me && me->id.lib==NULL && me->mr && me->mr->level_count > 1) {
+				if (me && me->id.lib==NULL && me->mr && me->mr->level_count > 1) {
 					multires_load_old(ob, me);
 				}
 
 				ob->data = olddata;
 			}
 
-			if(ob->totcol && ob->matbits == NULL) {
+			if (ob->totcol && ob->matbits == NULL) {
 				int a;
 
 				ob->matbits= MEM_callocN(sizeof(char)*ob->totcol, "ob->matbits");
-				for(a=0; a<ob->totcol; a++)
+				for (a=0; a<ob->totcol; a++)
 					ob->matbits[a]= ob->colbits & (1<<a);
 			}
 		}
 
 		/* texture filter */
-		for(tex = main->tex.first; tex; tex = tex->id.next) {
-			if(tex->afmax == 0)
+		for (tex = main->tex.first; tex; tex = tex->id.next) {
+			if (tex->afmax == 0)
 				tex->afmax= 8;
 		}
 
-		for(ma = main->mat.first; ma; ma = ma->id.next) {
+		for (ma = main->mat.first; ma; ma = ma->id.next) {
 			int a;
-			if(ma->mode & MA_WIRE) {
+			if (ma->mode & MA_WIRE) {
 				ma->material_type= MA_TYPE_WIRE;
 				ma->mode &= ~MA_WIRE;
 			}
-			if(ma->mode & MA_HALO) {
+			if (ma->mode & MA_HALO) {
 				ma->material_type= MA_TYPE_HALO;
 				ma->mode &= ~MA_HALO;
 			}
 
-			if(ma->mode & (MA_ZTRANSP|MA_RAYTRANSP)) {
+			if (ma->mode & (MA_ZTRANSP|MA_RAYTRANSP)) {
 				ma->mode |= MA_TRANSP;
 			}
 			else {
@@ -10873,15 +11042,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 
 			/* set new bump for unused slots */
-			for(a=0; a<MAX_MTEX; a++) {
-				if(ma->mtex[a]) {
+			for (a=0; a<MAX_MTEX; a++) {
+				if (ma->mtex[a]) {
 					tex= ma->mtex[a]->tex;
-					if(!tex) {
+					if (!tex) {
 						ma->mtex[a]->texflag |= MTEX_3TAP_BUMP;
 						ma->mtex[a]->texflag |= MTEX_BUMP_OBJECTSPACE;
-					} else {
+					}
+					else {
 						tex= (Tex*)newlibadr(fd, ma->id.lib, tex);
-						if(tex && tex->type == 0) { /* invalid type */
+						if (tex && tex->type == 0) { /* invalid type */
 							ma->mtex[a]->texflag |= MTEX_3TAP_BUMP;
 							ma->mtex[a]->texflag |= MTEX_BUMP_OBJECTSPACE;
 						}
@@ -10905,9 +11075,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 		}
 
-		for(sce = main->scene.first; sce; sce = sce->id.next) {
+		for (sce = main->scene.first; sce; sce = sce->id.next) {
 			ts= sce->toolsettings;
-			if(ts->normalsize == 0.0f || !ts->uv_selectmode || ts->vgroup_weight == 0.0f) {
+			if (ts->normalsize == 0.0f || !ts->uv_selectmode || ts->vgroup_weight == 0.0f) {
 				ts->normalsize= 0.1f;
 				ts->selectmode= SCE_SELECT_VERTEX;
 				
@@ -10942,11 +11112,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			//Stereo
 			sce->gm.stereomode = sce->r.stereomode;
 			/* reassigning stereomode NO_STEREO and DOME to a separeted flag*/
-			if (sce->gm.stereomode == 1){ //1 = STEREO_NOSTEREO
+			if (sce->gm.stereomode == 1) { //1 = STEREO_NOSTEREO
 				sce->gm.stereoflag = STEREO_NOSTEREO;
 				sce->gm.stereomode = STEREO_ANAGLYPH;
 			}
-			else if(sce->gm.stereomode == 8){ //8 = STEREO_DOME
+			else if (sce->gm.stereomode == 8) { //8 = STEREO_DOME
 				sce->gm.stereoflag = STEREO_DOME;
 				sce->gm.stereomode = STEREO_ANAGLYPH;
 			}
@@ -10976,31 +11146,31 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		Scene *sce;
 		Object *ob;
 
-		for(sce = main->scene.first; sce; sce = sce->id.next) {
-			if(fd->fileflags & G_FILE_ENABLE_ALL_FRAMES)
+		for (sce = main->scene.first; sce; sce = sce->id.next) {
+			if (fd->fileflags & G_FILE_ENABLE_ALL_FRAMES)
 				sce->gm.flag |= GAME_ENABLE_ALL_FRAMES;
-			if(fd->fileflags & G_FILE_SHOW_DEBUG_PROPS)
+			if (fd->fileflags & G_FILE_SHOW_DEBUG_PROPS)
 				sce->gm.flag |= GAME_SHOW_DEBUG_PROPS;
-			if(fd->fileflags & G_FILE_SHOW_FRAMERATE)
+			if (fd->fileflags & G_FILE_SHOW_FRAMERATE)
 				sce->gm.flag |= GAME_SHOW_FRAMERATE;
-			if(fd->fileflags & G_FILE_SHOW_PHYSICS)
+			if (fd->fileflags & G_FILE_SHOW_PHYSICS)
 				sce->gm.flag |= GAME_SHOW_PHYSICS;
-			if(fd->fileflags & G_FILE_GLSL_NO_SHADOWS)
+			if (fd->fileflags & G_FILE_GLSL_NO_SHADOWS)
 				sce->gm.flag |= GAME_GLSL_NO_SHADOWS;
-			if(fd->fileflags & G_FILE_GLSL_NO_SHADERS)
+			if (fd->fileflags & G_FILE_GLSL_NO_SHADERS)
 				sce->gm.flag |= GAME_GLSL_NO_SHADERS;
-			if(fd->fileflags & G_FILE_GLSL_NO_RAMPS)
+			if (fd->fileflags & G_FILE_GLSL_NO_RAMPS)
 				sce->gm.flag |= GAME_GLSL_NO_RAMPS;
-			if(fd->fileflags & G_FILE_GLSL_NO_NODES)
+			if (fd->fileflags & G_FILE_GLSL_NO_NODES)
 				sce->gm.flag |= GAME_GLSL_NO_NODES;
-			if(fd->fileflags & G_FILE_GLSL_NO_EXTRA_TEX)
+			if (fd->fileflags & G_FILE_GLSL_NO_EXTRA_TEX)
 				sce->gm.flag |= GAME_GLSL_NO_EXTRA_TEX;
-			if(fd->fileflags & G_FILE_IGNORE_DEPRECATION_WARNINGS)
+			if (fd->fileflags & G_FILE_IGNORE_DEPRECATION_WARNINGS)
 				sce->gm.flag |= GAME_IGNORE_DEPRECATION_WARNINGS;
 
-			if(fd->fileflags & G_FILE_GAME_MAT_GLSL)
+			if (fd->fileflags & G_FILE_GAME_MAT_GLSL)
 				sce->gm.matmode= GAME_MAT_GLSL;
-			else if(fd->fileflags & G_FILE_GAME_MAT)
+			else if (fd->fileflags & G_FILE_GAME_MAT)
 				sce->gm.matmode= GAME_MAT_MULTITEX;
 			else
 				sce->gm.matmode= GAME_MAT_TEXFACE;
@@ -11008,8 +11178,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			sce->gm.flag |= GAME_DISPLAY_LISTS;
 		}
 		
-		for(ob = main->object.first; ob; ob = ob->id.next) {
-			if(ob->flag & 8192) // OB_POSEMODE = 8192
+		for (ob = main->object.first; ob; ob = ob->id.next) {
+			if (ob->flag & 8192) // OB_POSEMODE = 8192
 				ob->mode |= OB_MODE_POSE;
 		}
 	}
@@ -11024,11 +11194,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		ParticleSettings *part;
 		int do_gravity = 0;
 
-		for(sce = main->scene.first; sce; sce = sce->id.next)
-			if(sce->unit.scale_length == 0.0f)
+		for (sce = main->scene.first; sce; sce = sce->id.next)
+			if (sce->unit.scale_length == 0.0f)
 				sce->unit.scale_length= 1.0f;
 		
-		for(ob = main->object.first; ob; ob = ob->id.next) {
+		for (ob = main->object.first; ob; ob = ob->id.next) {
 			/* fluid-sim stuff */
 			FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
 			if (fluidmd) fluidmd->fss->fmd = fluidmd;
@@ -11037,8 +11207,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			ob->rotmode= ROT_MODE_EUL;
 		}
 		
-		for(ma = main->mat.first; ma; ma=ma->id.next) {
-			if(ma->vol.reflection == 0.f) {
+		for (ma = main->mat.first; ma; ma=ma->id.next) {
+			if (ma->vol.reflection == 0.f) {
 				ma->vol.reflection = 1.f;
 				ma->vol.transmission_col[0] = ma->vol.transmission_col[1] = ma->vol.transmission_col[2] = 1.0f;
 				ma->vol.reflection_col[0] = ma->vol.reflection_col[1] = ma->vol.reflection_col[2] = 1.0f;
@@ -11047,20 +11217,20 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			do_version_mtex_factor_2_50(ma->mtex, ID_MA);
 		}
 
-		for(la = main->lamp.first; la; la=la->id.next)
+		for (la = main->lamp.first; la; la=la->id.next)
 			do_version_mtex_factor_2_50(la->mtex, ID_LA);
 
-		for(wo = main->world.first; wo; wo=wo->id.next)
+		for (wo = main->world.first; wo; wo=wo->id.next)
 			do_version_mtex_factor_2_50(wo->mtex, ID_WO);
 
-		for(tex = main->tex.first; tex; tex=tex->id.next)
-			if(tex->vd)
-				if(tex->vd->extend == 0)
+		for (tex = main->tex.first; tex; tex=tex->id.next)
+			if (tex->vd)
+				if (tex->vd->extend == 0)
 					tex->vd->extend = TEX_CLIP;
 		
-		for(sce= main->scene.first; sce; sce= sce->id.next)
+		for (sce= main->scene.first; sce; sce= sce->id.next)
 		{
-			if(sce->audio.main == 0.0f)
+			if (sce->audio.main == 0.0f)
 				sce->audio.main = 1.0f;
 
 			sce->r.ffcodecdata.audio_mixrate = sce->audio.mixrate;
@@ -11071,10 +11241,10 @@ static void do_versions(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) {
-
+		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)
+			{
 				sce->physics_settings.gravity[0] = sce->physics_settings.gravity[1] = 0.0f;
 				sce->physics_settings.gravity[2] = -9.81f;
 				sce->physics_settings.flag = PHYS_GLOBAL_GRAVITY;
@@ -11083,31 +11253,31 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 
 		/* Assign proper global gravity weights for dynamics (only z-coordinate is taken into account) */
-		if(do_gravity) for(part= main->particle.first; part; part= part->id.next)
+		if (do_gravity) for (part= main->particle.first; part; part= part->id.next)
 			part->effector_weights->global_gravity = part->acc[2]/-9.81f;
 
-		for(ob = main->object.first; ob; ob = ob->id.next) {
+		for (ob = main->object.first; ob; ob = ob->id.next) {
 			ModifierData *md;
 
-			if(do_gravity) {
-				for(md= ob->modifiers.first; md; md= md->next) {
+			if (do_gravity) {
+				for (md= ob->modifiers.first; md; md= md->next) {
 					ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth);
-					if(clmd)
+					if (clmd)
 						clmd->sim_parms->effector_weights->global_gravity = clmd->sim_parms->gravity[2]/-9.81f;
 				}
 
-				if(ob->soft)
+				if (ob->soft)
 					ob->soft->effector_weights->global_gravity = ob->soft->grav/9.81f;
 			}
 
 			/* Normal wind shape is plane */
-			if(ob->pd) {
-				if(ob->pd->forcefield == PFIELD_WIND)
+			if (ob->pd) {
+				if (ob->pd->forcefield == PFIELD_WIND)
 					ob->pd->shape = PFIELD_SHAPE_PLANE;
 				
-				if(ob->pd->flag & PFIELD_PLANAR)
+				if (ob->pd->flag & PFIELD_PLANAR)
 					ob->pd->shape = PFIELD_SHAPE_PLANE;
-				else if(ob->pd->flag & PFIELD_SURFACE)
+				else if (ob->pd->flag & PFIELD_SURFACE)
 					ob->pd->shape = PFIELD_SHAPE_SURFACE;
 
 				ob->pd->flag |= PFIELD_DO_LOCATION;
@@ -11119,7 +11289,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		Object *ob;
 		Lamp *la;
 		
-		/* New variables for axis-angle rotations and/or quaternion rotations were added, and need proper initialisation */
+		/* New variables for axis-angle rotations and/or quaternion rotations were added, and need proper initialization */
 		for (ob= main->object.first; ob; ob= ob->id.next) {
 			/* new variables for all objects */
 			ob->quat[0]= 1.0f;
@@ -11136,7 +11306,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 		}
 
-		for(la = main->lamp.first; la; la=la->id.next)
+		for (la = main->lamp.first; la; la=la->id.next)
 			la->compressthresh= 0.05f;
 	}
 
@@ -11150,48 +11320,48 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		int a, tot;
 
 		/* shape keys are no longer applied to the mesh itself, but rather
-		   to the derivedmesh/displist, so here we ensure that the basis
-		   shape key is always set in the mesh coordinates. */
+		 * to the derivedmesh/displist, so here we ensure that the basis
+		 * shape key is always set in the mesh coordinates. */
 
-		for(me= main->mesh.first; me; me= me->id.next) {
-			if((key = newlibadr(fd, lib, me->key)) && key->refkey) {
+		for (me= main->mesh.first; me; me= me->id.next) {
+			if ((key = newlibadr(fd, lib, me->key)) && key->refkey) {
 				data= key->refkey->data;
 				tot= MIN2(me->totvert, key->refkey->totelem);
 
-				for(a=0; a<tot; a++, data+=3)
+				for (a=0; a<tot; a++, data+=3)
 					copy_v3_v3(me->mvert[a].co, data);
 			}
 		}
 
-		for(lt= main->latt.first; lt; lt= lt->id.next) {
-			if((key = newlibadr(fd, lib, lt->key)) && key->refkey) {
+		for (lt= main->latt.first; lt; lt= lt->id.next) {
+			if ((key = newlibadr(fd, lib, lt->key)) && key->refkey) {
 				data= key->refkey->data;
 				tot= MIN2(lt->pntsu*lt->pntsv*lt->pntsw, key->refkey->totelem);
 
-				for(a=0; a<tot; a++, data+=3)
+				for (a=0; a<tot; a++, data+=3)
 					copy_v3_v3(lt->def[a].vec, data);
 			}
 		}
 
-		for(cu= main->curve.first; cu; cu= cu->id.next) {
-			if((key = newlibadr(fd, lib, cu->key)) && key->refkey) {
+		for (cu= main->curve.first; cu; cu= cu->id.next) {
+			if ((key = newlibadr(fd, lib, cu->key)) && key->refkey) {
 				data= key->refkey->data;
 
-				for(nu=cu->nurb.first; nu; nu=nu->next) {
-					if(nu->bezt) {
+				for (nu=cu->nurb.first; nu; nu=nu->next) {
+					if (nu->bezt) {
 						BezTriple *bezt = nu->bezt;
 
-						for(a=0; a<nu->pntsu; a++, bezt++) {
+						for (a=0; a<nu->pntsu; a++, bezt++) {
 							copy_v3_v3(bezt->vec[0], data); data+=3;
 							copy_v3_v3(bezt->vec[1], data); data+=3;
 							copy_v3_v3(bezt->vec[2], data); data+=3;
 							bezt->alfa= *data; data++;
 						}
 					}
-					else if(nu->bp) {
+					else if (nu->bp) {
 						BPoint *bp = nu->bp;
 
-						for(a=0; a<nu->pntsu*nu->pntsv; a++, bp++) {
+						for (a=0; a<nu->pntsu*nu->pntsv; a++, bp++) {
 							copy_v3_v3(bp->vec, data); data+=3;
 							bp->alfa= *data; data++;
 						}
@@ -11205,8 +11375,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 	{
 		{
 			Scene *sce= main->scene.first;
-			while(sce) {
-				if(sce->r.frame_step==0)
+			while (sce) {
+				if (sce->r.frame_step==0)
 					sce->r.frame_step= 1;
 				if (sce->r.mblur_samples==0)
 					sce->r.mblur_samples = sce->r.osa;
@@ -11222,10 +11392,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		{
 			/* ensure all nodes have unique names */
 			bNodeTree *ntree= main->nodetree.first;
-			while(ntree) {
+			while (ntree) {
 				bNode *node=ntree->nodes.first;
 				
-				while(node) {
+				while (node) {
 					nodeUniqueName(ntree, node);
 					node= node->next;
 				}
@@ -11247,10 +11417,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			ScrArea *sa;
 			SpaceLink *sl;
 			
-			for(screen= main->screen.first; screen; screen= screen->id.next) {
-				for(sa= screen->areabase.first; sa; sa= sa->next) {
-					for(sl= sa->spacedata.first; sl; sl= sl->next) {
-						if(sl->spacetype==SPACE_VIEW3D) {
+			for (screen= main->screen.first; screen; screen= screen->id.next) {
+				for (sa= screen->areabase.first; sa; sa= sa->next) {
+					for (sl= sa->spacedata.first; sl; sl= sl->next) {
+						if (sl->spacetype==SPACE_VIEW3D) {
 							View3D *v3d = (View3D *)sl;
 							if (v3d->drawtype == OB_MATERIAL) v3d->drawtype = OB_SOLID;
 						}
@@ -11268,19 +11438,19 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			int i, convert=0;
 			
 			/* convert to new color management system:
-			 while previously colors were stored as srgb, 
-			 now they are stored as linear internally, 
-			 with screen gamma correction in certain places in the UI. */
+			 * while previously colors were stored as srgb,
+			 * now they are stored as linear internally,
+			 * with screen gamma correction in certain places in the UI. */
 
 			/* don't know what scene is active, so we'll convert if any scene has it enabled... */
 			while (sce) {
-				if(sce->r.color_mgt_flag & R_COLOR_MANAGEMENT)
+				if (sce->r.color_mgt_flag & R_COLOR_MANAGEMENT)
 					convert=1;
 				sce=sce->id.next;
 			}
 			
 			if (convert) {
-				while(ma) {
+				while (ma) {
 					if (ma->ramp_col) {
 						ColorBand *band = (ColorBand *)ma->ramp_col;
 						for (i=0; i<band->tot; i++) {
@@ -11303,7 +11473,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 					ma=ma->id.next;
 				}
 				
-				while(tex) {
+				while (tex) {
 					if (tex->coba) {
 						ColorBand *band = (ColorBand *)tex->coba;
 						for (i=0; i<band->tot; i++) {
@@ -11314,7 +11484,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 					tex=tex->id.next;
 				}
 				
-				while(wo) {
+				while (wo) {
 					srgb_to_linearrgb_v3_v3(&wo->ambr, &wo->ambr);
 					srgb_to_linearrgb_v3_v3(&wo->horr, &wo->horr);
 					srgb_to_linearrgb_v3_v3(&wo->zenr, &wo->zenr);
@@ -11330,18 +11500,18 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		Mesh *me;
 		Object *ob;
 
-		for(sce=main->scene.first; sce; sce=sce->id.next)
-			if(!sce->toolsettings->particle.selectmode)
+		for (sce=main->scene.first; sce; sce=sce->id.next)
+			if (!sce->toolsettings->particle.selectmode)
 				sce->toolsettings->particle.selectmode= SCE_SELECT_PATH;
 
 		if (main->versionfile == 250 && main->subversionfile > 1) {
-			for(me=main->mesh.first; me; me=me->id.next)
+			for (me=main->mesh.first; me; me=me->id.next)
 				multires_load_old_250(me);
 
-			for(ob=main->object.first; ob; ob=ob->id.next) {
+			for (ob=main->object.first; ob; ob=ob->id.next) {
 				MultiresModifierData *mmd = (MultiresModifierData *)modifiers_findByType(ob, eModifierType_Multires);
 
-				if(mmd) {
+				if (mmd) {
 					mmd->totlvl--;
 					mmd->lvl--;
 					mmd->sculptlvl= mmd->lvl;
@@ -11355,10 +11525,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 	{
 		Object *ob;
 
-		/* properly initialise hair clothsim data on old files */
-		for(ob = main->object.first; ob; ob = ob->id.next) {
+		/* properly initialize hair clothsim data on old files */
+		for (ob = main->object.first; ob; ob = ob->id.next) {
 			ModifierData *md;
-			for(md= ob->modifiers.first; md; md= md->next) {
+			for (md= ob->modifiers.first; md; md= md->next) {
 				if (md->type == eModifierType_Cloth) {
 					ClothModifierData *clmd = (ClothModifierData *)md;
 					if (clmd->sim_parms->velocity_smooth < 0.01f)
@@ -11378,21 +11548,22 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
 
 		/* remove all preview window in wrong spaces */
-		for(screen= main->screen.first; screen; screen= screen->id.next) {
-			for(sa= screen->areabase.first; sa; sa= sa->next) {
-				for(sl= sa->spacedata.first; sl; sl= sl->next) {
-					if(sl->spacetype!=SPACE_SEQ) {
+		for (screen= main->screen.first; screen; screen= screen->id.next) {
+			for (sa= screen->areabase.first; sa; sa= sa->next) {
+				for (sl= sa->spacedata.first; sl; sl= sl->next) {
+					if (sl->spacetype!=SPACE_SEQ) {
 						ARegion *ar;
 						ListBase *regionbase;
 
 						if (sl == sa->spacedata.first) {
 							regionbase = &sa->regionbase;
-						} else {
+						}
+						else {
 							regionbase = &sl->regionbase;
 						}
 
 
-						for( ar = regionbase->first; ar; ar = ar->next) {
+						for ( ar = regionbase->first; ar; ar = ar->next) {
 							if (ar->regiontype == RGN_TYPE_PREVIEW)
 								break;
 						}
@@ -11417,10 +11588,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			SpaceLink *sl;
 
 
-			for(screen= main->screen.first; screen; screen= screen->id.next) {
-				for(sa= screen->areabase.first; sa; sa= sa->next) {
-					for(sl= sa->spacedata.first; sl; sl= sl->next) {
-						if(sl->spacetype==SPACE_SEQ) {
+			for (screen= main->screen.first; screen; screen= screen->id.next) {
+				for (sa= screen->areabase.first; sa; sa= sa->next) {
+					for (sl= sa->spacedata.first; sl; sl= sl->next) {
+						if (sl->spacetype==SPACE_SEQ) {
 							ARegion *ar;
 							ARegion *ar_main;
 							ListBase *regionbase;
@@ -11428,7 +11599,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
 							if (sl == sa->spacedata.first) {
 								regionbase = &sa->regionbase;
-							} else {
+							}
+							else {
 								regionbase = &sl->regionbase;
 							}
 
@@ -11458,21 +11630,21 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		Material *ma;
 		
 		/* game engine changes */
-		for(sce = main->scene.first; sce; sce = sce->id.next) {
+		for (sce = main->scene.first; sce; sce = sce->id.next) {
 			sce->gm.eyeseparation = 0.10f;
 		}
 		
 		/* anim viz changes */
 		for (ob= main->object.first; ob; ob= ob->id.next) {
-			/* initialise object defaults */
+			/* initialize object defaults */
 			animviz_settings_init(&ob->avs);
 			
 			/* if armature, copy settings for pose from armature data 
-			 * performing initialisation where appropriate 
+			 * performing initialization where appropriate
 			 */
 			if (ob->pose && ob->data) {
 				bArmature *arm= newlibadr(fd, lib, ob->data);
-				if(arm) { /* XXX - why does this fail in some cases? */
+				if (arm) { /* XXX - why does this fail in some cases? */
 					bAnimVizSettings *avs= &ob->pose->avs;
 					
 					/* ghosting settings ---------------- */
@@ -11553,7 +11725,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 	
 	if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 13)) {
 		/* NOTE: if you do more conversion, be sure to do it outside of this and
-		   increase subversion again, otherwise it will not be correct */
+		 * increase subversion again, otherwise it will not be correct */
 		Object *ob;
 		
 		/* convert degrees to radians for internal use */
@@ -11597,8 +11769,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 					if (ELEM(sl->spacetype, SPACE_ACTION, SPACE_NLA)) {
 						for (ar = (ARegion*)regionbase->first; ar; ar = ar->next) {
 							if (ar->regiontype == RGN_TYPE_WINDOW) {
-								ar->v2d.cur.ymax= ar->v2d.tot.ymax= 0.0f;
-								ar->v2d.cur.ymin= ar->v2d.tot.ymin= (float)(-sa->winy) / 3.0f;
+								ar->v2d.cur.ymax = ar->v2d.tot.ymax = 0.0f;
+								ar->v2d.cur.ymin = ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
 							}
 						}
 					}
@@ -11612,22 +11784,22 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		Material *ma;
 
 		/* ambient default from 0.5f to 1.0f */
-		for(ma= main->mat.first; ma; ma=ma->id.next)
+		for (ma= main->mat.first; ma; ma=ma->id.next)
 			ma->amb *= 2.0f;
 
-		for(wo= main->world.first; wo; wo=wo->id.next) {
+		for (wo= main->world.first; wo; wo=wo->id.next) {
 			/* ao splitting into ao/env/indirect */
 			wo->ao_env_energy= wo->aoenergy;
 			wo->aoenergy= 1.0f;
 
-			if(wo->ao_indirect_bounces == 0)
+			if (wo->ao_indirect_bounces == 0)
 				wo->ao_indirect_bounces= 1;
 			else
 				wo->mode |= WO_INDIRECT_LIGHT;
 
-			if(wo->aomix == WO_AOSUB)
+			if (wo->aomix == WO_AOSUB)
 				wo->ao_env_energy= -wo->ao_env_energy;
-			else if(wo->aomix == WO_AOADDSUB)
+			else if (wo->aomix == WO_AOADDSUB)
 				wo->mode |= WO_AMB_OCC;
 
 			wo->aomix= WO_AOMUL;
@@ -11644,16 +11816,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		Material *ma;
 
 		/* initialize to sane default so toggling on border shows something */
-		for(sce = main->scene.first; sce; sce = sce->id.next) {
-			if(sce->r.border.xmin == 0.0f && sce->r.border.ymin == 0.0f &&
+		for (sce = main->scene.first; sce; sce = sce->id.next) {
+			if (sce->r.border.xmin == 0.0f && sce->r.border.ymin == 0.0f &&
 			   sce->r.border.xmax == 0.0f && sce->r.border.ymax == 0.0f) {
-				sce->r.border.xmin= 0.0f;
-				sce->r.border.ymin= 0.0f;
-				sce->r.border.xmax= 1.0f;
-				sce->r.border.ymax= 1.0f;
+				sce->r.border.xmin = 0.0f;
+				sce->r.border.ymin = 0.0f;
+				sce->r.border.xmax = 1.0f;
+				sce->r.border.ymax = 1.0f;
 			}
 
-			if((sce->r.ffcodecdata.flags & FFMPEG_MULTIPLEX_AUDIO) == 0)
+			if ((sce->r.ffcodecdata.flags & FFMPEG_MULTIPLEX_AUDIO) == 0)
 				sce->r.ffcodecdata.audio_codec = 0x0; // CODEC_ID_NONE
 
 			SEQ_BEGIN(sce->ed, seq) {
@@ -11663,16 +11835,16 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 
 		/* particle brush strength factor was changed from int to float */
-		for(sce= main->scene.first; sce; sce=sce->id.next) {
+		for (sce= main->scene.first; sce; sce=sce->id.next) {
 			ParticleEditSettings *pset= &sce->toolsettings->particle;
 			int a;
 
-			for(a=0; a<PE_TOT_BRUSH; a++)
+			for (a=0; a<PE_TOT_BRUSH; a++)
 				pset->brush[a].strength /= 100.0f;
 		}
 
-		for(ma = main->mat.first; ma; ma=ma->id.next)
-			if(ma->mode & MA_TRACEBLE)
+		for (ma = main->mat.first; ma; ma=ma->id.next)
+			if (ma->mode & MA_TRACEBLE)
 				ma->shade_flag |= MA_APPROX_OCCLUSION;
 
 		/* sequencer changes */
@@ -11681,16 +11853,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			ScrArea *sa;
 			SpaceLink *sl;
 
-			for(screen= main->screen.first; screen; screen= screen->id.next) {
-				for(sa= screen->areabase.first; sa; sa= sa->next) {
-					for(sl= sa->spacedata.first; sl; sl= sl->next) {
-						if(sl->spacetype==SPACE_SEQ) {
+			for (screen= main->screen.first; screen; screen= screen->id.next) {
+				for (sa= screen->areabase.first; sa; sa= sa->next) {
+					for (sl= sa->spacedata.first; sl; sl= sl->next) {
+						if (sl->spacetype==SPACE_SEQ) {
 							ARegion *ar_preview;
 							ListBase *regionbase;
 
 							if (sl == sa->spacedata.first) {
 								regionbase = &sa->regionbase;
-							} else {
+							}
+							else {
 								regionbase = &sl->regionbase;
 							}
 
@@ -11716,12 +11889,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		 * This bit was used in the past for V3D_TRANSFORM_SNAP, which is now deprecated. 
 		 * Here we clear it for old files so they don't come in with V3D_RENDER_OVERRIDE set,
 		 * which would cause cameras, lamps, etc to become invisible */
-		for(sc= main->screen.first; sc; sc= sc->id.next) {
+		for (sc= main->screen.first; sc; sc= sc->id.next) {
 			ScrArea *sa;
-			for(sa= sc->areabase.first; sa; sa= sa->next) {
+			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) {
+					if (sl->spacetype==SPACE_VIEW3D) {
 						View3D* v3d = (View3D *)sl;
 						v3d->flag2 &= ~V3D_RENDER_OVERRIDE;
 					}
@@ -11740,10 +11913,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			if (brush->curve) brush->curve->preset = CURVE_PRESET_SMOOTH;
 		}
 		
-		/* properly initialise active flag for fluidsim modifiers */
-		for(ob = main->object.first; ob; ob = ob->id.next) {
+		/* properly initialize active flag for fluidsim modifiers */
+		for (ob = main->object.first; ob; ob = ob->id.next) {
 			ModifierData *md;
-			for(md= ob->modifiers.first; md; md= md->next) {
+			for (md= ob->modifiers.first; md; md= md->next) {
 				if (md->type == eModifierType_Fluidsim) {
 					FluidsimModifierData *fmd = (FluidsimModifierData *)md;
 					fmd->fss->flag |= OB_FLUIDSIM_ACTIVE; 
@@ -11753,11 +11926,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 		
 		/* adjustment to color balance node values */
-		for(scene= main->scene.first; scene; scene= scene->id.next) {
-			if(scene->nodetree) {
+		for (scene= main->scene.first; scene; scene= scene->id.next) {
+			if (scene->nodetree) {
 				bNode *node=scene->nodetree->nodes.first;
 				
-				while(node) {
+				while (node) {
 					if (node->type == CMP_NODE_COLORBALANCE) {
 						NodeColorBalance *n= (NodeColorBalance *)node->storage;
 						n->lift[0] += 1.f;
@@ -11772,7 +11945,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		for (ntree= main->nodetree.first; ntree; ntree=ntree->id.next) {
 			bNode *node=ntree->nodes.first;
 			
-			while(node) {
+			while (node) {
 				if (node->type == CMP_NODE_COLORBALANCE) {
 					NodeColorBalance *n= (NodeColorBalance *)node->storage;
 					n->lift[0] += 1.f;
@@ -11796,12 +11969,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		bScreen *sc;
 		
 		/* Image editor scopes */
-		for(sc= main->screen.first; sc; sc= sc->id.next) {
+		for (sc= main->screen.first; sc; sc= sc->id.next) {
 			ScrArea *sa;
-			for(sa= sc->areabase.first; sa; sa= sa->next) {
+			for (sa= sc->areabase.first; sa; sa= sa->next) {
 				SpaceLink *sl;
 				for (sl= sa->spacedata.first; sl; sl= sl->next) {
-					if(sl->spacetype==SPACE_IMAGE) {
+					if (sl->spacetype==SPACE_IMAGE) {
 						SpaceImage *sima = (SpaceImage *)sl;
 						scopes_new(&sima->scopes);
 					}
@@ -11863,11 +12036,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		do_version_mdef_250(main);
 
 		/* parent type to modifier */
-		for(ob = main->object.first; ob; ob = ob->id.next) {
-			if(ob->parent) {
+		for (ob = main->object.first; ob; ob = ob->id.next) {
+			if (ob->parent) {
 				Object *parent= (Object *)newlibadr(fd, lib, ob->parent);
-				if(parent) { /* parent may not be in group */
-					if(parent->type==OB_ARMATURE && ob->partype==PARSKEL) {
+				if (parent) { /* parent may not be in group */
+					if (parent->type==OB_ARMATURE && ob->partype==PARSKEL) {
 						ArmatureModifierData *amd;
 						bArmature *arm= (bArmature *)newlibadr(fd, lib, parent->data);
 
@@ -11877,7 +12050,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 						amd->deformflag= arm->deformflag;
 						ob->partype = PAROBJECT;
 					}
-					else if(parent->type==OB_LATTICE && ob->partype==PARSKEL) {
+					else if (parent->type==OB_LATTICE && ob->partype==PARSKEL) {
 						LatticeModifierData *lmd;
 
 						lmd = (LatticeModifierData*) modifier_new(eModifierType_Lattice);
@@ -11885,7 +12058,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 						BLI_addtail((ListBase*)&ob->modifiers, lmd);
 						ob->partype = PAROBJECT;
 					}
-					else if(parent->type==OB_CURVE && ob->partype==PARCURVE) {
+					else if (parent->type==OB_CURVE && ob->partype==PARCURVE) {
 						CurveModifierData *cmd;
 
 						cmd = (CurveModifierData*) modifier_new(eModifierType_Curve);
@@ -11897,36 +12070,36 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			}
 		}
 		
-		/* initialise scene active layer */
+		/* initialize scene active layer */
 		for (scene= main->scene.first; scene; scene=scene->id.next) {
 			int i;
-			for(i=0; i<20; i++) {
-				if(scene->lay & (1<<i)) {
+			for (i=0; i<20; i++) {
+				if (scene->lay & (1<<i)) {
 					scene->layact= 1<<i;
 					break;
 				}
 			}
 		}
 
-		for(tex= main->tex.first; tex; tex= tex->id.next) {
+		for (tex= main->tex.first; tex; tex= tex->id.next) {
 			/* if youre picky, this isn't correct until we do a version bump
 			 * since you could set saturation to be 0.0*/
-			if(tex->saturation==0.0f)
+			if (tex->saturation==0.0f)
 				tex->saturation= 1.0f;
 		}
 
 		{
 			Curve *cu;
-			for(cu= main->curve.first; cu; cu= cu->id.next) {
+			for (cu= main->curve.first; cu; cu= cu->id.next) {
 				cu->smallcaps_scale= 0.75f;
 			}
 		}
 
 		for (scene= main->scene.first; scene; scene=scene->id.next) {
-			if(scene) {
+			if (scene) {
 				Sequence *seq;
 				SEQ_BEGIN(scene->ed, seq) {
-					if(seq->sat==0.0f) {
+					if (seq->sat==0.0f) {
 						seq->sat= 1.0f;
 					}
 				}
@@ -12027,18 +12200,18 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		{
 			Object *ob;
 
-			for(ob = main->object.first; ob; ob = ob->id.next) {
+			for (ob = main->object.first; ob; ob = ob->id.next) {
 				ModifierData *md;
-				for(md= ob->modifiers.first; md; md= md->next) {
+				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)
+						if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain)
 						{
 							smd->domain->vorticity = 2.0f;
 							smd->domain->time_scale = 1.0f;
 
-							if(!(smd->domain->flags & (1<<4)))
+							if (!(smd->domain->flags & (1<<4)))
 								continue;
 
 							/* delete old MOD_SMOKE_INITVELOCITY flag */
@@ -12047,13 +12220,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 							/* for now just add it to all flow objects in the scene */
 							{
 								Object *ob2;
-								for(ob2 = main->object.first; ob2; ob2 = ob2->id.next) {
+								for (ob2 = main->object.first; ob2; ob2 = ob2->id.next) {
 									ModifierData *md2;
-									for(md2= ob2->modifiers.first; md2; md2= md2->next) {
+									for (md2= ob2->modifiers.first; md2; md2= md2->next) {
 										if (md2->type == eModifierType_Smoke) {
 											SmokeModifierData *smd2 = (SmokeModifierData *)md2;
 
-											if((smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow)
+											if ((smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow)
 											{
 												smd2->flow->flags |= MOD_SMOKE_FLOW_INITVELOCITY;
 											}
@@ -12063,8 +12236,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 							}
 
 						}
-						else if((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow)
-						{
+						else if ((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow) {
 							smd->flow->vel_multi = 1.0f;
 						}
 
@@ -12079,13 +12251,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		bScreen *sc;
 		Object *ob;
 
-		for(br= main->brush.first; br; br= br->id.next) {
-			if(br->ob_mode==0)
+		for (br= main->brush.first; br; br= br->id.next) {
+			if (br->ob_mode==0)
 				br->ob_mode= OB_MODE_ALL_PAINT;
 		}
 
-		for(part = main->particle.first; part; part = part->id.next) {
-			if(part->boids)
+		for (part = main->particle.first; part; part = part->id.next) {
+			if (part->boids)
 				part->boids->pitch = 1.0f;
 
 			part->flag &= ~PART_HAIR_REGROW; /* this was a deprecated flag before */
@@ -12120,9 +12292,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
 		/* fix rotation actuators for objects so they use real angles (radians)
 		 * since before blender went opensource this strange scalar was used: (1 / 0.02) * 2 * math.pi/360 */
-		for(ob= main->object.first; ob; ob= ob->id.next) {
+		for (ob= main->object.first; ob; ob= ob->id.next) {
 			bActuator *act= ob->actuators.first;
-			while(act) {
+			while (act) {
 				if (act->type==ACT_OBJECT) {
 					/* multiply velocity with 50 in old files */
 					bObjectActuator *oa= act->data;
@@ -12136,10 +12308,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 	// init facing axis property of steering actuators
 	{					
 		Object *ob;
-		for(ob = main->object.first; ob; ob = ob->id.next) {
+		for (ob = main->object.first; ob; ob = ob->id.next) {
 			bActuator *act;
-			for(act= ob->actuators.first; act; act= act->next) {
-				if(act->type==ACT_STEERING) {
+			for (act= ob->actuators.first; act; act= act->next) {
+				if (act->type==ACT_STEERING) {
 					bSteeringActuator* stact = act->data;
 					if (stact->facingaxis==0)
 					{
@@ -12154,9 +12326,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		Object *ob;
 
 		/* ocean res is now squared, reset old ones - will be massive */
-		for(ob = main->object.first; ob; ob = ob->id.next) {
+		for (ob = main->object.first; ob; ob = ob->id.next) {
 			ModifierData *md;
-			for(md= ob->modifiers.first; md; md= md->next) {
+			for (md= ob->modifiers.first; md; md= md->next) {
 				if (md->type == eModifierType_Ocean) {
 					OceanModifierData *omd = (OceanModifierData *)md;
 					omd->resolution = 7;
@@ -12172,12 +12344,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		Key *key;
 		
 		/* Fix for sample line scope initializing with no height */
-		for(sc= main->screen.first; sc; sc= sc->id.next) {
+		for (sc= main->screen.first; sc; sc= sc->id.next) {
 			sa= sc->areabase.first;
-			while(sa) {
+			while (sa) {
 				SpaceLink *sl;
 				for (sl= sa->spacedata.first; sl; sl= sl->next) {
-					if(sl->spacetype==SPACE_IMAGE) {
+					if (sl->spacetype==SPACE_IMAGE) {
 						SpaceImage *sima= (SpaceImage *)sl;
 						if (sima->sample_line_hist.height == 0 )
 							sima->sample_line_hist.height = 100;
@@ -12213,11 +12385,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
 		/* fix for objects which have zero dquat's
 		 * since this is multiplied with the quat rather than added */
-		for(ob= main->object.first; ob; ob= ob->id.next) {
-			if(is_zero_v4(ob->dquat)) {
+		for (ob= main->object.first; ob; ob= ob->id.next) {
+			if (is_zero_v4(ob->dquat)) {
 				unit_qt(ob->dquat);
 			}
-			if(is_zero_v3(ob->drotAxis) && ob->drotAngle == 0.0f) {
+			if (is_zero_v3(ob->drotAxis) && ob->drotAngle == 0.0f) {
 				unit_axis_angle(ob->drotAxis, &ob->drotAngle);
 			}
 		}
@@ -12227,7 +12399,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		bNodeTree *ntree;
 		
 		/* node sockets are not exposed automatically any more,
-		 * this mimics the old behaviour by adding all unlinked sockets to groups.
+		 * this mimics the old behavior by adding all unlinked sockets to groups.
 		 */
 		for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next) {
 			/* XXX Only setting a flag here. Actual adding of group sockets
@@ -12238,7 +12410,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 	}
 
-	if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile <3)){
+	if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile <3)) {
 		bScreen *sc;
 		Brush *brush;
 		Object *ob;
@@ -12246,18 +12418,18 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		Material *mat;
 		int tex_nr, transp_tex;
 		
-		for(mat = main->mat.first; mat; mat = mat->id.next){
-			if(!(mat->mode & MA_TRANSP) && !(mat->material_type & MA_TYPE_VOLUME)){
+		for (mat = main->mat.first; mat; mat = mat->id.next) {
+			if (!(mat->mode & MA_TRANSP) && !(mat->material_type & MA_TYPE_VOLUME)) {
 				
 				transp_tex= 0;
 				
-				for(tex_nr=0; tex_nr<MAX_MTEX; tex_nr++){
-					if(!mat->mtex[tex_nr]) continue;
-					if(mat->mtex[tex_nr]->mapto & MAP_ALPHA) transp_tex= 1;
+				for (tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
+					if (!mat->mtex[tex_nr]) continue;
+					if (mat->mtex[tex_nr]->mapto & MAP_ALPHA) transp_tex= 1;
 				}
 
 				/* weak! material alpha could be animated */
-				if(mat->alpha < 1.0f || mat->fresnel_tra > 0.0f || transp_tex){
+				if (mat->alpha < 1.0f || mat->fresnel_tra > 0.0f || transp_tex) {
 					mat->mode |= MA_TRANSP;
 					mat->mode &= ~(MA_ZTRANSP|MA_RAYTRANSP);
 				}
@@ -12267,24 +12439,24 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		/* redraws flag in SpaceTime has been moved to Screen level */
 		for (sc = main->screen.first; sc; sc= sc->id.next) {
 			if (sc->redraws_flag == 0) {
-				/* just initialise to default? */
+				/* just initialize to default? */
 				// 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;
 			}
 		}
 
 		for (brush= main->brush.first; brush; brush= brush->id.next) {
-			if(brush->height == 0)
+			if (brush->height == 0)
 				brush->height= 0.4f;
 		}
 
 		/* replace 'rim material' option for in offset*/
-		for(ob = main->object.first; ob; ob = ob->id.next) {
+		for (ob = main->object.first; ob; ob = ob->id.next) {
 			ModifierData *md;
-			for(md= ob->modifiers.first; md; md= md->next) {
+			for (md= ob->modifiers.first; md; md= md->next) {
 				if (md->type == eModifierType_Solidify) {
 					SolidifyModifierData *smd = (SolidifyModifierData *)md;
-					if(smd->flag & MOD_SOLIDIFY_RIM_MATERIAL) {
+					if (smd->flag & MOD_SOLIDIFY_RIM_MATERIAL) {
 						smd->mat_ofs_rim= 1;
 						smd->flag &= ~MOD_SOLIDIFY_RIM_MATERIAL;
 					}
@@ -12293,20 +12465,20 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 
 		/* particle draw color from material */
-		for(part = main->particle.first; part; part = part->id.next) {
-			if(part->draw & PART_DRAW_MAT_COL)
+		for (part = main->particle.first; part; part = part->id.next) {
+			if (part->draw & PART_DRAW_MAT_COL)
 				part->draw_col = PART_DRAW_COL_MAT;
 		}
 	}
 
-	if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 6)){
+	if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 6)) {
 		Mesh *me;
 
-		for(me= main->mesh.first; me; me= me->id.next)
-			mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
+		for (me= main->mesh.first; me; me= me->id.next)
+			mesh_calc_normals_tessface(me->mvert, me->totvert, me->mface, me->totface, NULL);
 	}
 
-	if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 2)){
+	if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 2)) {
 		/* update blur area sizes from 0..1 range to 0..100 percentage */
 		Scene *scene;
 		bNode *node;
@@ -12320,30 +12492,30 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 					}
 	}
 
-	if (main->versionfile < 258 || (main->versionfile == 258 && main->subversionfile < 1)){
+	if (main->versionfile < 258 || (main->versionfile == 258 && main->subversionfile < 1)) {
 		/* screen view2d settings were not properly initialized [#27164]
 		 * v2d->scroll caused the bug but best reset other values too which are in old blend files only.
 		 * need to make less ugly - possibly an iterator? */
 		bScreen *screen;
-		for(screen= main->screen.first; screen; screen= screen->id.next) {
+		for (screen= main->screen.first; screen; screen= screen->id.next) {
 			ScrArea *sa;
 			/* add regions */
-			for(sa= screen->areabase.first; sa; sa= sa->next) {
+			for (sa= screen->areabase.first; sa; sa= sa->next) {
 				SpaceLink *sl= sa->spacedata.first;
-				if(sl->spacetype==SPACE_IMAGE) {
+				if (sl->spacetype==SPACE_IMAGE) {
 					ARegion *ar;
 					for (ar=sa->regionbase.first; ar; ar= ar->next) {
-						if(ar->regiontype == RGN_TYPE_WINDOW) {
+						if (ar->regiontype == RGN_TYPE_WINDOW) {
 							View2D *v2d= &ar->v2d;
 							v2d->minzoom= v2d->maxzoom= v2d->scroll= v2d->keeptot= v2d->keepzoom= v2d->keepofs= v2d->align= 0;
 						}
 					}
 				}
 				for (sl= sa->spacedata.first; sl; sl= sl->next) {
-					if(sl->spacetype==SPACE_IMAGE) {
+					if (sl->spacetype==SPACE_IMAGE) {
 						ARegion *ar;
 						for (ar=sl->regionbase.first; ar; ar= ar->next) {
-							if(ar->regiontype == RGN_TYPE_WINDOW) {
+							if (ar->regiontype == RGN_TYPE_WINDOW) {
 								View2D *v2d= &ar->v2d;
 								v2d->minzoom= v2d->maxzoom= v2d->scroll= v2d->keeptot= v2d->keepzoom= v2d->keepofs= v2d->align= 0;
 							}
@@ -12356,8 +12528,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		{
 			/* Initialize texture point density curve falloff */
 			Tex *tex;
-			for(tex= main->tex.first; tex; tex= tex->id.next) {
-				if(tex->pd) {
+			for (tex= main->tex.first; tex; tex= tex->id.next) {
+				if (tex->pd) {
 					if (tex->pd->falloff_speed_scale == 0.0f)
 						tex->pd->falloff_speed_scale = 100.0f;
 					
@@ -12377,8 +12549,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			/* add default value for behind strength of camera actuator */
 			Object *ob;
 			bActuator *act;
-			for(ob = main->object.first; ob; ob= ob->id.next) {
-				for(act= ob->actuators.first; act; act= act->next) {
+			for (ob = main->object.first; ob; ob= ob->id.next) {
+				for (act= ob->actuators.first; act; act= act->next) {
 					if (act->type == ACT_CAMERA) {
 						bCameraActuator *ba= act->data;
 
@@ -12390,14 +12562,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
 		{
 			ParticleSettings *part;
-			for(part = main->particle.first; part; part = part->id.next) {
+			for (part = main->particle.first; part; part = part->id.next) {
 				/* Initialize particle billboard scale */
 				part->bb_size[0] = part->bb_size[1] = 1.0f;
 			}
 		}
 	}
 
-	if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 1)){
+	if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 1)) {
 		{
 			Scene *scene;
 			Sequence *seq;
@@ -12414,26 +12586,26 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 		{
 			bScreen *screen;
-			for(screen= main->screen.first; screen; screen= screen->id.next) {
+			for (screen= main->screen.first; screen; screen= screen->id.next) {
 				ScrArea *sa;
 				/* add regions */
-				for(sa= screen->areabase.first; sa; sa= sa->next) {
+				for (sa= screen->areabase.first; sa; sa= sa->next) {
 					SpaceLink *sl= sa->spacedata.first;
-					if(sl->spacetype==SPACE_SEQ) {
+					if (sl->spacetype==SPACE_SEQ) {
 						ARegion *ar;
 						for (ar=sa->regionbase.first; ar; ar= ar->next) {
-							if(ar->regiontype == RGN_TYPE_WINDOW) {
-								if(ar->v2d.min[1] == 4.0f)
+							if (ar->regiontype == RGN_TYPE_WINDOW) {
+								if (ar->v2d.min[1] == 4.0f)
 									ar->v2d.min[1]= 0.5f;
 							}
 						}
 					}
 					for (sl= sa->spacedata.first; sl; sl= sl->next) {
-						if(sl->spacetype==SPACE_SEQ) {
+						if (sl->spacetype==SPACE_SEQ) {
 							ARegion *ar;
 							for (ar=sl->regionbase.first; ar; ar= ar->next) {
-								if(ar->regiontype == RGN_TYPE_WINDOW) {
-									if(ar->v2d.min[1] == 4.0f)
+								if (ar->regiontype == RGN_TYPE_WINDOW) {
+									if (ar->v2d.min[1] == 4.0f)
 										ar->v2d.min[1]= 0.5f;
 								}
 							}
@@ -12506,7 +12678,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 						act->type= act->otype= ACT_ACTION;
 						
 					}
-					else if (act->type == ACT_SHAPEACTION)  {
+					else if (act->type == ACT_SHAPEACTION) {
 						act->type = act->otype = ACT_ACTION;
 					}
 				}
@@ -12514,7 +12686,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 	}
 
-	if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 2)){
+	if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 2)) {
 		{
 			/* Convert default socket values from bNodeStack */
 			Scene *sce;
@@ -12564,7 +12736,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 	}
 
-	if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 4)){
+	if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 4)) {
 		{
 			/* Adaptive time step for particle systems */
 			ParticleSettings *part;
@@ -12577,42 +12749,42 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		{
 			/* set defaults for obstacle avoidance, recast data */
 			Scene *sce;
-			for(sce = main->scene.first; sce; sce = sce->id.next)
+			for (sce = main->scene.first; sce; sce = sce->id.next)
 			{
 				if (sce->gm.levelHeight == 0.f)
 					sce->gm.levelHeight = 2.f;
 
-				if(sce->gm.recastData.cellsize == 0.0f)
+				if (sce->gm.recastData.cellsize == 0.0f)
 					sce->gm.recastData.cellsize = 0.3f;
-				if(sce->gm.recastData.cellheight == 0.0f)
+				if (sce->gm.recastData.cellheight == 0.0f)
 					sce->gm.recastData.cellheight = 0.2f;
-				if(sce->gm.recastData.agentmaxslope == 0.0f)
+				if (sce->gm.recastData.agentmaxslope == 0.0f)
 					sce->gm.recastData.agentmaxslope = (float)M_PI/4;
-				if(sce->gm.recastData.agentmaxclimb == 0.0f)
+				if (sce->gm.recastData.agentmaxclimb == 0.0f)
 					sce->gm.recastData.agentmaxclimb = 0.9f;
-				if(sce->gm.recastData.agentheight == 0.0f)
+				if (sce->gm.recastData.agentheight == 0.0f)
 					sce->gm.recastData.agentheight = 2.0f;
-				if(sce->gm.recastData.agentradius == 0.0f)
+				if (sce->gm.recastData.agentradius == 0.0f)
 					sce->gm.recastData.agentradius = 0.6f;
-				if(sce->gm.recastData.edgemaxlen == 0.0f)
+				if (sce->gm.recastData.edgemaxlen == 0.0f)
 					sce->gm.recastData.edgemaxlen = 12.0f;
-				if(sce->gm.recastData.edgemaxerror == 0.0f)
+				if (sce->gm.recastData.edgemaxerror == 0.0f)
 					sce->gm.recastData.edgemaxerror = 1.3f;
-				if(sce->gm.recastData.regionminsize == 0.0f)
+				if (sce->gm.recastData.regionminsize == 0.0f)
 					sce->gm.recastData.regionminsize = 8.f;
-				if(sce->gm.recastData.regionmergesize == 0.0f)
+				if (sce->gm.recastData.regionmergesize == 0.0f)
 					sce->gm.recastData.regionmergesize = 20.f;
-				if(sce->gm.recastData.vertsperpoly<3)
+				if (sce->gm.recastData.vertsperpoly<3)
 					sce->gm.recastData.vertsperpoly = 6;
-				if(sce->gm.recastData.detailsampledist == 0.0f)
+				if (sce->gm.recastData.detailsampledist == 0.0f)
 					sce->gm.recastData.detailsampledist = 6.0f;
-				if(sce->gm.recastData.detailsamplemaxerror == 0.0f)
+				if (sce->gm.recastData.detailsamplemaxerror == 0.0f)
 					sce->gm.recastData.detailsamplemaxerror = 1.0f;
 			}
 		}
 	}
 
-	if (main->versionfile < 260){
+	if (main->versionfile < 260) {
 		{
 			/* set default alpha value of Image outputs in image and render layer nodes to 0 */
 			Scene *sce;
@@ -12620,8 +12792,8 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			
 			for (sce=main->scene.first; sce; sce=sce->id.next) {
 				/* there are files with invalid audio_channels value, the real cause
-				   is unknown, but we fix it here anyway to avoid crashes */
-				if(sce->r.ffcodecdata.audio_channels == 0)
+				 * is unknown, but we fix it here anyway to avoid crashes */
+				if (sce->r.ffcodecdata.audio_channels == 0)
 					sce->r.ffcodecdata.audio_channels = 2;
 
 				if (sce->nodetree)
@@ -12637,17 +12809,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			ParticleSettings *part;
 
 			for (part=main->particle.first; part; part=part->id.next) {
-				if(ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
+				if (ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
 					part->draw |= PART_DRAW_ROTATE_OB;
 
-					if(part->rotmode == 0)
+					if (part->rotmode == 0)
 						part->rotmode = PART_ROT_VEL;
 				}
 			}
 		}
 	}
 
-	if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 1)){
+	if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 1)) {
 		Object *ob;
 
 		for (ob= main->object.first; ob; ob= ob->id.next) {
@@ -12656,7 +12828,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
 		{
 			Camera *cam;
-			for(cam= main->camera.first; cam; cam= cam->id.next) {
+			for (cam= main->camera.first; cam; cam= cam->id.next) {
 				if (cam->sensor_x < 0.01f)
 					cam->sensor_x = DEFAULT_SENSOR_WIDTH;
 
@@ -12669,11 +12841,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 	if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 2)) {
 		bNodeTreeType *ntreetype= ntreeGetType(NTREE_SHADER);
 
-		if(ntreetype && ntreetype->foreach_nodetree)
+		if (ntreetype && ntreetype->foreach_nodetree)
 			ntreetype->foreach_nodetree(main, NULL, do_version_ntree_tex_mapping_260);
 	}
 
-	if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 4)){
+	if (main->versionfile < 260 || (main->versionfile == 260 && main->subversionfile < 4)) {
 		{
 			/* Convert node angles to radians! */
 			Scene *sce;
@@ -12704,19 +12876,19 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 				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) {
+						if (sl->spacetype==SPACE_VIEW3D) {
 							View3D *v3d= (View3D *)sl;
-							if(v3d->bundle_size==0.0f) {
+							if (v3d->bundle_size==0.0f) {
 								v3d->bundle_size= 0.2f;
 								v3d->flag2 |= V3D_SHOW_RECONSTRUCTION;
 							}
-							else if(sl->spacetype==SPACE_CLIP) {
+							else if (sl->spacetype==SPACE_CLIP) {
 								SpaceClip *sc= (SpaceClip *)sl;
-								if(sc->scopes.track_preview_height==0)
+								if (sc->scopes.track_preview_height==0)
 									sc->scopes.track_preview_height= 120;
 							}
 
-							if(v3d->bundle_drawtype==0)
+							if (v3d->bundle_drawtype==0)
 								v3d->bundle_drawtype= OB_PLAINAXES;
 						}
 					}
@@ -12726,7 +12898,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			for (clip= main->movieclip.first; clip; clip= clip->id.next) {
 				MovieTrackingTrack *track;
 
-				if(clip->aspx<1.0f) {
+				if (clip->aspx<1.0f) {
 					clip->aspx= 1.0f;
 					clip->aspy= 1.0f;
 				}
@@ -12735,21 +12907,21 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 				                           IMB_TC_FREE_RUN |
 				                           IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN;
 
-				if(clip->proxy.build_size_flag==0)
+				if (clip->proxy.build_size_flag==0)
 					clip->proxy.build_size_flag= IMB_PROXY_25;
 
-				if(clip->proxy.quality==0)
+				if (clip->proxy.quality==0)
 					clip->proxy.quality= 90;
 
-				if(clip->tracking.camera.pixel_aspect<0.01f)
+				if (clip->tracking.camera.pixel_aspect<0.01f)
 					clip->tracking.camera.pixel_aspect= 1.f;
 
 				track= clip->tracking.tracks.first;
-				while(track) {
-					if(track->pyramid_levels==0)
+				while (track) {
+					if (track->pyramid_levels==0)
 						track->pyramid_levels= 2;
 
-					if(track->minimum_correlation==0.0f)
+					if (track->minimum_correlation==0.0f)
 						track->minimum_correlation= 0.75f;
 
 					track= track->next;
@@ -12764,14 +12936,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		MovieClip *clip;
 		bScreen *sc;
 
-		for(sce = main->scene.first; sce; sce = sce->id.next) {
+		for (sce = main->scene.first; sce; sce = sce->id.next) {
 			do_versions_image_settings_2_60(sce);
 		}
 
 		for (clip= main->movieclip.first; clip; clip= clip->id.next) {
 			MovieTrackingSettings *settings= &clip->tracking.settings;
 
-			if(settings->default_pyramid_levels==0) {
+			if (settings->default_pyramid_levels==0) {
 				settings->default_tracker= TRACKER_KLT;
 				settings->default_pyramid_levels= 2;
 				settings->default_minimum_correlation= 0.75;
@@ -12785,7 +12957,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			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) {
+					if (sl->spacetype==SPACE_VIEW3D) {
 						View3D *v3d= (View3D *)sl;
 						v3d->flag2&= ~V3D_RENDER_SHADOW;
 					}
@@ -12814,10 +12986,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 	/* sigh, this dscale vs dsize version patching was not done right, fix for fix,
 	 * this intentionally checks an exact subversion, also note this was never in a release,
 	 * at some point this could be removed. */
-	else if (main->versionfile == 260 && main->subversionfile == 6)
-	{
+	else if (main->versionfile == 260 && main->subversionfile == 6) {
 		Object *ob;
-		for (ob= main->object.first; ob; ob= ob->id.next) {
+		for (ob = main->object.first; ob; ob= ob->id.next) {
 			if (is_zero_v3(ob->dscale)) {
 				fill_vn_fl(ob->dscale, 3, 1.0f);
 			}
@@ -12871,7 +13042,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		{
 			/* Initialize BGE exit key to esc key */
 			Scene *scene;
-			for(scene= main->scene.first; scene; scene= scene->id.next) {
+			for (scene= main->scene.first; scene; scene= scene->id.next) {
 				if (!scene->gm.exitkey)
 					scene->gm.exitkey = 218; // Blender key code for ESC
 			}
@@ -12886,14 +13057,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
 				clip->proxy.build_tc_flag|= IMB_TC_RECORD_RUN_NO_GAPS;
 
-				if(!tracking->settings.object_distance)
+				if (!tracking->settings.object_distance)
 					tracking->settings.object_distance= 1.0f;
 
-				if(tracking->objects.first == NULL)
+				if (tracking->objects.first == NULL)
 					BKE_tracking_new_object(tracking, "Camera");
 
-				while(tracking_object) {
-					if(!tracking_object->scale)
+				while (tracking_object) {
+					if (!tracking_object->scale)
 						tracking_object->scale= 1.0f;
 
 					tracking_object= tracking_object->next;
@@ -12905,13 +13076,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 				for (con= ob->constraints.first; con; con=con->next) {
 					bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
 
-					if(!cti)
+					if (!cti)
 						continue;
 
-					if(cti->type==CONSTRAINT_TYPE_OBJECTSOLVER) {
+					if (cti->type==CONSTRAINT_TYPE_OBJECTSOLVER) {
 						bObjectSolverConstraint *data= (bObjectSolverConstraint *)con->data;
 
-						if(data->invmat[3][3]==0.0f)
+						if (data->invmat[3][3]==0.0f)
 							unit_m4(data->invmat);
 					}
 				}
@@ -12934,38 +13105,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 				}
 			}
 		}
-		{
-			/* set the SOCK_AUTO_HIDDEN flag on collapsed nodes */
-			Scene *sce;
-			Material *mat;
-			Tex *tex;
-			Lamp *lamp;
-			World *world;
-			bNodeTree *ntree;
-
-			for (sce=main->scene.first; sce; sce=sce->id.next)
-				if (sce->nodetree)
-					do_versions_nodetree_socket_auto_hidden_flags_2_62(sce->nodetree);
-
-			for (mat=main->mat.first; mat; mat=mat->id.next)
-				if (mat->nodetree)
-					do_versions_nodetree_socket_auto_hidden_flags_2_62(mat->nodetree);
-
-			for (tex=main->tex.first; tex; tex=tex->id.next)
-				if (tex->nodetree)
-					do_versions_nodetree_socket_auto_hidden_flags_2_62(tex->nodetree);
-
-			for (lamp=main->lamp.first; lamp; lamp=lamp->id.next)
-				if (lamp->nodetree)
-					do_versions_nodetree_socket_auto_hidden_flags_2_62(lamp->nodetree);
-
-			for (world=main->world.first; world; world=world->id.next)
-				if (world->nodetree)
-					do_versions_nodetree_socket_auto_hidden_flags_2_62(world->nodetree);
-
-			for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next)
-				do_versions_nodetree_socket_auto_hidden_flags_2_62(ntree);
-		}
 	}
 
 	if (main->versionfile < 261 || (main->versionfile == 261 && main->subversionfile < 2))
@@ -12974,12 +13113,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			/* convert Camera Actuator values to defines */
 			Object *ob;
 			bActuator *act;
-			for(ob = main->object.first; ob; ob= ob->id.next) {
-				for(act= ob->actuators.first; act; act= act->next) {
+			for (ob = main->object.first; ob; ob= ob->id.next) {
+				for (act= ob->actuators.first; act; act= act->next) {
 					if (act->type == ACT_CAMERA) {
 						bCameraActuator *ba= act->data;
 
-						if(ba->axis==(float) 'x') ba->axis=OB_POSX;
+						if (ba->axis==(float) 'x') ba->axis=OB_POSX;
 						else if (ba->axis==(float)'y') ba->axis=OB_POSY;
 						/* don't do an if/else to avoid imediate subversion bump*/
 //					ba->axis=((ba->axis == (float) 'x')?OB_POSX_X:OB_POSY);
@@ -12990,9 +13129,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
 		{
 			/* convert deprecated sculpt_paint_unified_* fields to
-			   UnifiedPaintSettings */
+			 * UnifiedPaintSettings */
 			Scene *scene;
-			for(scene= main->scene.first; scene; scene= scene->id.next) {
+			for (scene= main->scene.first; scene; scene= scene->id.next) {
 				ToolSettings *ts= scene->toolsettings;
 				UnifiedPaintSettings *ups= &ts->unified_paint_settings;
 				ups->size= ts->sculpt_paint_unified_size;
@@ -13009,7 +13148,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 			/* convert extended ascii to utf-8 for text editor */
 			Text *text;
 			for (text= main->text.first; text; text= text->id.next)
-				if(!(text->flags & TXT_ISEXT)) {
+				if (!(text->flags & TXT_ISEXT)) {
 					TextLine *tl;
 					
 					for (tl= text->lines.first; tl; tl= tl->next) {
@@ -13025,12 +13164,12 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		{
 			/* set new dynamic paint values */
 			Object *ob;
-			for(ob = main->object.first; ob; ob = ob->id.next) {
+			for (ob = main->object.first; ob; ob = ob->id.next) {
 				ModifierData *md;
-				for(md= ob->modifiers.first; md; md= md->next) {
+				for (md= ob->modifiers.first; md; md= md->next) {
 					if (md->type == eModifierType_DynamicPaint) {
 						DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
-						if(pmd->canvas)
+						if (pmd->canvas)
 						{
 							DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
 							for (; surface; surface=surface->next) {
@@ -13046,39 +13185,130 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 		}
 	}
 	
-	if (main->versionfile < 261 || (main->versionfile == 261 && main->subversionfile < 4))
+	if (main->versionfile < 262)
 	{
-		{
-			/* set fluidsim rate */
-			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_Fluidsim) {
-						FluidsimSettings *fss = (FluidsimSettings *)md;
-						fss->animRate = 1.0f;
-					}
+		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_Cloth) {
+					ClothModifierData *clmd = (ClothModifierData*) md;
+					if (clmd->sim_parms)
+						clmd->sim_parms->vel_damping = 1.0f;
 				}
 			}
 		}
 	}
 
-	if (main->versionfile < 262)
+	if (main->versionfile < 263)
 	{
+		/* set fluidsim rate. the version patch for this in 2.62 was wrong, so
+		 * try to correct it, if rate is 0.0 that's likely not intentional */
 		Object *ob;
-		for(ob=main->object.first; ob; ob= ob->id.next) {
+
+		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_Fluidsim) {
+					FluidsimModifierData *fmd = (FluidsimModifierData *)md;
+					if (fmd->fss->animRate == 0.0f)
+						fmd->fss->animRate = 1.0f;
+				}
+			}
+		}
+	}
 
+	if (main->versionfile < 262 || (main->versionfile == 262 && main->subversionfile < 1))
+	{
+		/* update use flags for node sockets (was only temporary before) */
+		Scene *sce;
+		bNodeTree *ntree;
+		
+		for (sce=main->scene.first; sce; sce=sce->id.next)
+			if (sce->nodetree)
+				do_versions_nodetree_multi_file_output_format_2_62_1(sce, sce->nodetree);
+		
+		/* XXX can't associate with scene for group nodes, image format will stay uninitialized */
+		for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next)
+			do_versions_nodetree_multi_file_output_format_2_62_1(NULL, ntree);
+	}
+
+	/* only swap for pre-release bmesh merge which had MLoopCol red/blue swap */
+	if (main->versionfile == 262 && main->subversionfile == 1)
+	{
+		{
+			Mesh *me;
+			for (me = main->mesh.first; me; me = me->id.next) {
+				do_versions_mesh_mloopcol_swap_2_62_1(me);
+			}
+		}
+
+	}
+
+	if (main->versionfile < 262 || (main->versionfile == 262 && main->subversionfile < 2))
+	{
+		{
+			/* Set new idname of keyingsets from their now "label-only" name. */
+			Scene *scene;
+			for (scene = main->scene.first; scene; scene = scene->id.next) {
+				KeyingSet *ks;
+				for (ks = scene->keyingsets.first; ks; ks = ks->next) {
+					if (!ks->idname[0])
+						BLI_strncpy(ks->idname, ks->name, sizeof(ks->idname));
+				}
+			}
+		}
+	}
+	
+	if (main->versionfile < 262 || (main->versionfile == 262 && main->subversionfile < 3))
+	{
+		Object *ob;
+		ModifierData *md;
+	
+		for (ob = main->object.first; ob; ob = ob->id.next) {
 			for (md=ob->modifiers.first; md; md=md->next) {
-				if (md->type==eModifierType_Cloth) {
-					ClothModifierData *clmd = (ClothModifierData*) md;
-					if(clmd->sim_parms)
-						clmd->sim_parms->vel_damping = 1.0f;
+				if (md->type == eModifierType_Lattice) {
+					LatticeModifierData *lmd = (LatticeModifierData *)md;
+					lmd->strength = 1.0f;
+				}
+			}
+		}
+	}
+
+	if (main->versionfile < 262 || (main->versionfile == 262 && main->subversionfile < 4))
+	{
+		/* Read Viscosity presets from older files */
+		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_Fluidsim) {
+					FluidsimModifierData *fmd = (FluidsimModifierData *)md;
+					if (fmd->fss->viscosityMode == 3) {
+						fmd->fss->viscosityValue = 5.0;
+						fmd->fss->viscosityExponent = 5;
+					}
+					else if (fmd->fss->viscosityMode == 4) {
+						fmd->fss->viscosityValue = 2.0;
+						fmd->fss->viscosityExponent = 3;
+					}
 				}
 			}
 		}
 	}
 
+
+
+	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)
+			part->flag |= PART_ROTATIONS;
+	}
+
 	/* 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! */
 
@@ -13089,7 +13319,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 static void do_versions_after_linking(FileData *fd, Library *lib, Main *main)
 {
 	/* old Animation System (using IPO's) needs to be converted to the new Animato system */
-	if(main->versionfile < 250)
+	if (main->versionfile < 250)
 		do_versions_ipos_to_animato(main);
 }
 #endif
@@ -13133,7 +13363,7 @@ static void lib_link_all(FileData *fd, Main *main)
 static void direct_link_keymapitem(FileData *fd, wmKeyMapItem *kmi)
 {
 	kmi->properties= newdataadr(fd, kmi->properties);
-	if(kmi->properties)
+	if (kmi->properties)
 		IDP_DirectLinkProperty(kmi->properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
 	kmi->ptr= NULL;
 	kmi->flag &= ~KMI_UPDATE;
@@ -13151,7 +13381,7 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
 	/* read all data into fd->datamap */
 	bhead= read_data_into_oldnewmap(fd, bhead, "user def");
 
-	if(user->keymaps.first) {
+	if (user->keymaps.first) {
 		/* backwards compatibility */
 		user->user_keymaps= user->keymaps;
 		user->keymaps.first= user->keymaps.last= NULL;
@@ -13161,25 +13391,25 @@ static BHead *read_userdef(BlendFileData *bfd, FileData *fd, BHead *bhead)
 	link_list(fd, &user->user_keymaps);
 	link_list(fd, &user->addons);
 
-	for(keymap=user->user_keymaps.first; keymap; keymap=keymap->next) {
+	for (keymap=user->user_keymaps.first; keymap; keymap=keymap->next) {
 		keymap->modal_items= NULL;
-		keymap->poll= NULL;
+		keymap->poll = NULL;
 		keymap->flag &= ~KEYMAP_UPDATE;
 
 		link_list(fd, &keymap->diff_items);
 		link_list(fd, &keymap->items);
 		
-		for(kmdi=keymap->diff_items.first; kmdi; kmdi=kmdi->next) {
+		for (kmdi=keymap->diff_items.first; kmdi; kmdi=kmdi->next) {
 			kmdi->remove_item= newdataadr(fd, kmdi->remove_item);
 			kmdi->add_item= newdataadr(fd, kmdi->add_item);
 
-			if(kmdi->remove_item)
+			if (kmdi->remove_item)
 				direct_link_keymapitem(fd, kmdi->remove_item);
-			if(kmdi->add_item)
+			if (kmdi->add_item)
 				direct_link_keymapitem(fd, kmdi->add_item);
 		}
 
-		for(kmi=keymap->items.first; kmi; kmi=kmi->next)
+		for (kmi=keymap->items.first; kmi; kmi=kmi->next)
 			direct_link_keymapitem(fd, kmi);
 	}
 
@@ -13209,7 +13439,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
 	bfd->type= BLENFILETYPE_BLEND;
 	BLI_strncpy(bfd->main->name, filepath, sizeof(bfd->main->name));
 
-	while(bhead) {
+	while (bhead) {
 		switch(bhead->code) {
 		case DATA:
 		case DNA1:
@@ -13229,18 +13459,18 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
 
 		case ID_LI:
 			/* skip library datablocks in undo, this works together with
-			   BLO_read_from_memfile, where the old main->library is restored
-			   overwriting  the libraries from the memory file. previously
-			   it did not save ID_LI/ID_ID blocks in this case, but they are
-			   needed to make quit.blend recover them correctly. */
-			if(fd->memfile)
+			 * BLO_read_from_memfile, where the old main->library is restored
+			 * overwriting  the libraries from the memory file. previously
+			 * it did not save ID_LI/ID_ID blocks in this case, but they are
+			 * needed to make quit.blend recover them correctly. */
+			if (fd->memfile)
 				bhead= blo_nextbhead(fd, bhead);
 			else
 				bhead= read_libblock(fd, bfd->main, bhead, LIB_LOCAL, NULL);
 			break;
 		case ID_ID:
 			/* same as above */
-			if(fd->memfile)
+			if (fd->memfile)
 				bhead= blo_nextbhead(fd, bhead);
 			else
 				/* always adds to the most recently loaded
@@ -13259,7 +13489,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath)
 	}
 
 	/* do before read_libraries, but skip undo case */
-//	if(fd->memfile==NULL) (the mesh shuffle hacks don't work yet? ton)
+//	if (fd->memfile==NULL) (the mesh shuffle hacks don't work yet? ton)
 		do_versions(fd, NULL, bfd->main);
 
 	read_libraries(fd, &fd->mainlist);
@@ -13287,8 +13517,8 @@ static int verg_bheadsort(const void *v1, const void *v2)
 {
 	const struct bheadsort *x1=v1, *x2=v2;
 	
-	if( x1->old > x2->old) return 1;
-	else if( x1->old < x2->old) return -1;
+	if ( x1->old > x2->old) return 1;
+	else if ( x1->old < x2->old) return -1;
 	return 0;
 }
 
@@ -13302,7 +13532,7 @@ static void sort_bhead_old_map(FileData *fd)
 		tot++;
 	
 	fd->tot_bheadmap= tot;
-	if(tot==0) return;
+	if (tot==0) return;
 	
 	bhs= fd->bheadmap= MEM_mallocN(tot*sizeof(struct bheadsort), "bheadsort");
 	
@@ -13318,7 +13548,7 @@ static void sort_bhead_old_map(FileData *fd)
 static BHead *find_previous_lib(FileData *fd, BHead *bhead)
 {
 	/* skip library datablocks in undo, see comment in read_libblock */
-	if(fd->memfile)
+	if (fd->memfile)
 		return NULL;
 
 	for (; bhead; bhead= blo_prevbhead(fd, bhead))
@@ -13344,7 +13574,7 @@ static BHead *find_bhead(FileData *fd, void *old)
 	bhs_s.old= old;
 	bhs= bsearch(&bhs_s, fd->bheadmap, fd->tot_bheadmap, sizeof(struct bheadsort), verg_bheadsort);
 
-	if(bhs)
+	if (bhs)
 		return bhs->bhead;
 	
 #if 0
@@ -13374,21 +13604,21 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old)
 	ID *id;
 
 	bhead= find_bhead(fd, old);
-	if(bhead) {
+	if (bhead) {
 			/* from another library? */
-		if(bhead->code==ID_ID) {
+		if (bhead->code==ID_ID) {
 			BHead *bheadlib= find_previous_lib(fd, bhead);
 
-			if(bheadlib) {
+			if (bheadlib) {
 				Library *lib= read_struct(fd, bheadlib, "Library");
 				Main *ptr= blo_find_main(fd, &fd->mainlist, lib->name, fd->relabase);
 
 				id= is_yet_read(fd, ptr, bhead);
 
-				if(id==NULL) {
+				if (id==NULL) {
 					read_libblock(fd, ptr, bhead, LIB_READ+LIB_INDIRECT, NULL);
 					// commented because this can print way too much
-					// if(G.f & G_DEBUG) printf("expand_doit: other lib %s\n", lib->name);
+					// if (G.debug & G_DEBUG) printf("expand_doit: other lib %s\n", lib->name);
 					
 					/* for outliner dependency only */
 					ptr->curlib->parent= mainvar->curlib;
@@ -13402,13 +13632,13 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old)
 					/* This crashes files, must look further into it */
 					
 					/* Update: the issue is that in file reading, the oldnewmap is OK, but for existing data, it has to be
-					   inserted in the map to be found! */
-					if(id->flag & LIB_PRE_EXISTING)
+					 * inserted in the map to be found! */
+					if (id->flag & LIB_PRE_EXISTING)
 						oldnewmap_insert(fd->libmap, bhead->old, id, 1);
 					
 					change_idid_adr_fd(fd, bhead->old, id);
 					// commented because this can print way too much
-					// if(G.f & G_DEBUG) printf("expand_doit: already linked: %s lib: %s\n", id->name, lib->name);
+					// if (G.debug & G_DEBUG) printf("expand_doit: already linked: %s lib: %s\n", id->name, lib->name);
 				}
 				
 				MEM_freeN(lib);
@@ -13416,15 +13646,15 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old)
 		}
 		else {
 			id= is_yet_read(fd, mainvar, bhead);
-			if(id==NULL) {
+			if (id==NULL) {
 				read_libblock(fd, mainvar, bhead, LIB_TESTIND, NULL);
 			}
 			else {
 				/* this is actually only needed on UI call? when ID was already read before, and another append
-				   happens which invokes same ID... in that case the lookup table needs this entry */
+				 * happens which invokes same ID... in that case the lookup table needs this entry */
 				oldnewmap_insert(fd->libmap, bhead->old, id, 1);
 				// commented because this can print way too much
-				// if(G.f & G_DEBUG) printf("expand: already read %s\n", id->name);
+				// if (G.debug & G_DEBUG) printf("expand: already read %s\n", id->name);
 			}
 		}
 	}
@@ -13436,8 +13666,8 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old)
 static void expand_ipo(FileData *fd, Main *mainvar, Ipo *ipo)
 {
 	IpoCurve *icu;
-	for(icu= ipo->curve.first; icu; icu= icu->next) {
-		if(icu->driver)
+	for (icu= ipo->curve.first; icu; icu= icu->next) {
+		if (icu->driver)
 			expand_doit(fd, mainvar, icu->driver->ob);
 	}
 }
@@ -13566,11 +13796,11 @@ static void expand_particlesettings(FileData *fd, Main *mainvar, ParticleSetting
 	expand_doit(fd, mainvar, part->eff_group);
 	expand_doit(fd, mainvar, part->bb_ob);
 	
-	if(part->adt)
+	if (part->adt)
 		expand_animdata(fd, mainvar, part->adt);
 
-	for(a=0; a<MAX_MTEX; a++) {
-		if(part->mtex[a]) {
+	for (a=0; a<MAX_MTEX; a++) {
+		if (part->mtex[a]) {
 			expand_doit(fd, mainvar, part->mtex[a]->tex);
 			expand_doit(fd, mainvar, part->mtex[a]->object);
 		}
@@ -13581,7 +13811,7 @@ static void expand_group(FileData *fd, Main *mainvar, Group *group)
 {
 	GroupObject *go;
 	
-	for(go= group->gobject.first; go; go= go->next) {
+	for (go= group->gobject.first; go; go= go->next) {
 		expand_doit(fd, mainvar, go->ob);
 	}
 }
@@ -13590,7 +13820,7 @@ static void expand_key(FileData *fd, Main *mainvar, Key *key)
 {
 	expand_doit(fd, mainvar, key->ipo); // XXX depreceated - old animation system
 	
-	if(key->adt)
+	if (key->adt)
 		expand_animdata(fd, mainvar, key->adt);
 }
 
@@ -13598,14 +13828,14 @@ static void expand_nodetree(FileData *fd, Main *mainvar, bNodeTree *ntree)
 {
 	bNode *node;
 	
-	if(ntree->adt)
+	if (ntree->adt)
 		expand_animdata(fd, mainvar, ntree->adt);
 		
-	if(ntree->gpd)
+	if (ntree->gpd)
 		expand_doit(fd, mainvar, ntree->gpd);
 	
-	for(node= ntree->nodes.first; node; node= node->next)
-		if(node->id && node->type!=CMP_NODE_R_LAYERS)
+	for (node= ntree->nodes.first; node; node= node->next)
+		if (node->id && node->type!=CMP_NODE_R_LAYERS)
 			expand_doit(fd, mainvar, node->id);
 
 }
@@ -13615,10 +13845,10 @@ static void expand_texture(FileData *fd, Main *mainvar, Tex *tex)
 	expand_doit(fd, mainvar, tex->ima);
 	expand_doit(fd, mainvar, tex->ipo); // XXX depreceated - old animation system
 	
-	if(tex->adt)
+	if (tex->adt)
 		expand_animdata(fd, mainvar, tex->adt);
 	
-	if(tex->nodetree)
+	if (tex->nodetree)
 		expand_nodetree(fd, mainvar, tex->nodetree);
 }
 
@@ -13632,8 +13862,8 @@ static void expand_material(FileData *fd, Main *mainvar, Material *ma)
 {
 	int a;
 
-	for(a=0; a<MAX_MTEX; a++) {
-		if(ma->mtex[a]) {
+	for (a=0; a<MAX_MTEX; a++) {
+		if (ma->mtex[a]) {
 			expand_doit(fd, mainvar, ma->mtex[a]->tex);
 			expand_doit(fd, mainvar, ma->mtex[a]->object);
 		}
@@ -13641,13 +13871,13 @@ static void expand_material(FileData *fd, Main *mainvar, Material *ma)
 	
 	expand_doit(fd, mainvar, ma->ipo); // XXX depreceated - old animation system
 	
-	if(ma->adt)
+	if (ma->adt)
 		expand_animdata(fd, mainvar, ma->adt);
 	
-	if(ma->nodetree)
+	if (ma->nodetree)
 		expand_nodetree(fd, mainvar, ma->nodetree);
 	
-	if(ma->group)
+	if (ma->group)
 		expand_doit(fd, mainvar, ma->group);
 }
 
@@ -13655,8 +13885,8 @@ static void expand_lamp(FileData *fd, Main *mainvar, Lamp *la)
 {
 	int a;
 
-	for(a=0; a<MAX_MTEX; a++) {
-		if(la->mtex[a]) {
+	for (a=0; a<MAX_MTEX; a++) {
+		if (la->mtex[a]) {
 			expand_doit(fd, mainvar, la->mtex[a]->tex);
 			expand_doit(fd, mainvar, la->mtex[a]->object);
 		}
@@ -13667,7 +13897,7 @@ static void expand_lamp(FileData *fd, Main *mainvar, Lamp *la)
 	if (la->adt)
 		expand_animdata(fd, mainvar, la->adt);
 
-	if(la->nodetree)
+	if (la->nodetree)
 		expand_nodetree(fd, mainvar, la->nodetree);
 }
 
@@ -13685,8 +13915,8 @@ static void expand_world(FileData *fd, Main *mainvar, World *wrld)
 {
 	int a;
 
-	for(a=0; a<MAX_MTEX; a++) {
-		if(wrld->mtex[a]) {
+	for (a=0; a<MAX_MTEX; a++) {
+		if (wrld->mtex[a]) {
 			expand_doit(fd, mainvar, wrld->mtex[a]->tex);
 			expand_doit(fd, mainvar, wrld->mtex[a]->object);
 		}
@@ -13697,7 +13927,7 @@ static void expand_world(FileData *fd, Main *mainvar, World *wrld)
 	if (wrld->adt)
 		expand_animdata(fd, mainvar, wrld->adt);
 
-	if(wrld->nodetree)
+	if (wrld->nodetree)
 		expand_nodetree(fd, mainvar, wrld->nodetree);
 }
 
@@ -13706,11 +13936,11 @@ static void expand_mball(FileData *fd, Main *mainvar, MetaBall *mb)
 {
 	int a;
 
-	for(a=0; a<mb->totcol; a++) {
+	for (a=0; a<mb->totcol; a++) {
 		expand_doit(fd, mainvar, mb->mat[a]);
 	}
 	
-	if(mb->adt)
+	if (mb->adt)
 		expand_animdata(fd, mainvar, mb->adt);
 }
 
@@ -13718,7 +13948,7 @@ static void expand_curve(FileData *fd, Main *mainvar, Curve *cu)
 {
 	int a;
 
-	for(a=0; a<cu->totcol; a++) {
+	for (a=0; a<cu->totcol; a++) {
 		expand_doit(fd, mainvar, cu->mat[a]);
 	}
 	
@@ -13732,7 +13962,7 @@ static void expand_curve(FileData *fd, Main *mainvar, Curve *cu)
 	expand_doit(fd, mainvar, cu->taperobj);
 	expand_doit(fd, mainvar, cu->textoncurve);
 	
-	if(cu->adt)
+	if (cu->adt)
 		expand_animdata(fd, mainvar, cu->adt);
 }
 
@@ -13743,30 +13973,30 @@ static void expand_mesh(FileData *fd, Main *mainvar, Mesh *me)
 	TFace *tf;
 	int a, i;
 	
-	if(me->adt)
+	if (me->adt)
 		expand_animdata(fd, mainvar, me->adt);
 		
-	for(a=0; a<me->totcol; a++) {
+	for (a=0; a<me->totcol; a++) {
 		expand_doit(fd, mainvar, me->mat[a]);
 	}
 
 	expand_doit(fd, mainvar, me->key);
 	expand_doit(fd, mainvar, me->texcomesh);
 
-	if(me->tface) {
+	if (me->tface) {
 		tf= me->tface;
-		for(i=0; i<me->totface; i++, tf++)
-			if(tf->tpage)
+		for (i=0; i<me->totface; i++, tf++)
+			if (tf->tpage)
 				expand_doit(fd, mainvar, tf->tpage);
 	}
 
-	for(a=0; a<me->fdata.totlayer; a++) {
+	for (a=0; a<me->fdata.totlayer; a++) {
 		layer= &me->fdata.layers[a];
 
-		if(layer->type == CD_MTFACE) {
+		if (layer->type == CD_MTFACE) {
 			mtf= (MTFace*)layer->data;
-			for(i=0; i<me->totface; i++, mtf++)
-				if(mtf->tpage)
+			for (i=0; i<me->totface; i++, mtf++)
+				if (mtf->tpage)
 					expand_doit(fd, mainvar, mtf->tpage);
 		}
 	}
@@ -13829,7 +14059,7 @@ static void expand_armature(FileData *fd, Main *mainvar, bArmature *arm)
 {
 	Bone *curBone;
 
-	if(arm->adt)
+	if (arm->adt)
 		expand_animdata(fd, mainvar, arm->adt);
 
 	for (curBone = arm->bonebase.first; curBone; curBone=curBone->next) {
@@ -13861,7 +14091,7 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
 	expand_doit(fd, mainvar, ob->data);
 
 	/* expand_object_expandModifier() */
-	if(ob->modifiers.first) {
+	if (ob->modifiers.first) {
 		struct { FileData *fd; Main *mainvar; } data;
 		data.fd= fd;
 		data.mainvar= mainvar;
@@ -13881,17 +14111,17 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
 	
 	expand_constraint_channels(fd, mainvar, &ob->constraintChannels);
 
-	for (strip=ob->nlastrips.first; strip; strip=strip->next){
+	for (strip=ob->nlastrips.first; strip; strip=strip->next) {
 		expand_doit(fd, mainvar, strip->object);
 		expand_doit(fd, mainvar, strip->act);
 		expand_doit(fd, mainvar, strip->ipo);
 	}
 // XXX depreceated - old animation system (for version patching only)
 	
-	if(ob->adt)
+	if (ob->adt)
 		expand_animdata(fd, mainvar, ob->adt);
 	
-	for(a=0; a<ob->totcol; a++) {
+	for (a=0; a<ob->totcol; a++) {
 		expand_doit(fd, mainvar, ob->mat[a]);
 	}
 	
@@ -13899,24 +14129,24 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
 	if (paf && paf->group) 
 		expand_doit(fd, mainvar, paf->group);
 
-	if(ob->dup_group)
+	if (ob->dup_group)
 		expand_doit(fd, mainvar, ob->dup_group);
 	
-	if(ob->proxy)
+	if (ob->proxy)
 		expand_doit(fd, mainvar, ob->proxy);
-	if(ob->proxy_group)
+	if (ob->proxy_group)
 		expand_doit(fd, mainvar, ob->proxy_group);
 
-	for(psys=ob->particlesystem.first; psys; psys=psys->next)
+	for (psys=ob->particlesystem.first; psys; psys=psys->next)
 		expand_doit(fd, mainvar, psys->part);
 
 	sens= ob->sensors.first;
-	while(sens) {
-		if(sens->type==SENS_TOUCH) {
+	while (sens) {
+		if (sens->type==SENS_TOUCH) {
 			bTouchSensor *ts= sens->data;
 			expand_doit(fd, mainvar, ts->ma);
 		}
-		else if(sens->type==SENS_MESSAGE) {
+		else if (sens->type==SENS_MESSAGE) {
 			bMessageSensor *ms= sens->data;
 			expand_doit(fd, mainvar, ms->fromObject);
 		}
@@ -13924,8 +14154,8 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
 	}
 
 	cont= ob->controllers.first;
-	while(cont) {
-		if(cont->type==CONT_PYTHON) {
+	while (cont) {
+		if (cont->type==CONT_PYTHON) {
 			bPythonCont *pc= cont->data;
 			expand_doit(fd, mainvar, pc->text);
 		}
@@ -13933,64 +14163,64 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
 	}
 
 	act= ob->actuators.first;
-	while(act) {
-		if(act->type==ACT_SOUND) {
+	while (act) {
+		if (act->type==ACT_SOUND) {
 			bSoundActuator *sa= act->data;
 			expand_doit(fd, mainvar, sa->sound);
 		}
-		else if(act->type==ACT_CAMERA) {
+		else if (act->type==ACT_CAMERA) {
 			bCameraActuator *ca= act->data;
 			expand_doit(fd, mainvar, ca->ob);
 		}
-		else if(act->type==ACT_EDIT_OBJECT) {
+		else if (act->type==ACT_EDIT_OBJECT) {
 			bEditObjectActuator *eoa= act->data;
-			if(eoa) {
+			if (eoa) {
 				expand_doit(fd, mainvar, eoa->ob);
 				expand_doit(fd, mainvar, eoa->me);
 			}
 		}
-		else if(act->type==ACT_OBJECT) {
+		else if (act->type==ACT_OBJECT) {
 			bObjectActuator *oa= act->data;
 			expand_doit(fd, mainvar, oa->reference);
 		}
-		else if(act->type==ACT_ADD_OBJECT) {
+		else if (act->type==ACT_ADD_OBJECT) {
 			bAddObjectActuator *aoa= act->data;
 			expand_doit(fd, mainvar, aoa->ob);
 		}
-		else if(act->type==ACT_SCENE) {
+		else if (act->type==ACT_SCENE) {
 			bSceneActuator *sa= act->data;
 			expand_doit(fd, mainvar, sa->camera);
 			expand_doit(fd, mainvar, sa->scene);
 		}
-		else if(act->type==ACT_2DFILTER) {
+		else if (act->type==ACT_2DFILTER) {
 			bTwoDFilterActuator *tdfa= act->data;
 			expand_doit(fd, mainvar, tdfa->text);
 		}
-		else if(act->type==ACT_ACTION) {
+		else if (act->type==ACT_ACTION) {
 			bActionActuator *aa= act->data;
 			expand_doit(fd, mainvar, aa->act);
 		}
-		else if(act->type==ACT_SHAPEACTION) {
+		else if (act->type==ACT_SHAPEACTION) {
 			bActionActuator *aa= act->data;
 			expand_doit(fd, mainvar, aa->act);
 		}
-		else if(act->type==ACT_PROPERTY) {
+		else if (act->type==ACT_PROPERTY) {
 			bPropertyActuator *pa= act->data;
 			expand_doit(fd, mainvar, pa->ob);
 		}
-		else if(act->type==ACT_MESSAGE) {
+		else if (act->type==ACT_MESSAGE) {
 			bMessageActuator *ma= act->data;
 			expand_doit(fd, mainvar, ma->toObject);
 		}
-		else if(act->type==ACT_PARENT) {
+		else if (act->type==ACT_PARENT) {
 			bParentActuator *pa= act->data;
 			expand_doit(fd, mainvar, pa->ob);
 		}
-		else if(act->type==ACT_ARMATURE) {
+		else if (act->type==ACT_ARMATURE) {
 			bArmatureActuator *arma= act->data;
 			expand_doit(fd, mainvar, arma->target);
 		}
-		else if(act->type==ACT_STEERING) {
+		else if (act->type==ACT_STEERING) {
 			bSteeringActuator *sta= act->data;
 			expand_doit(fd, mainvar, sta->target);
 			expand_doit(fd, mainvar, sta->navmesh);
@@ -13998,7 +14228,7 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
 		act= act->next;
 	}
 
-	if(ob->pd && ob->pd->tex)
+	if (ob->pd && ob->pd->tex)
 		expand_doit(fd, mainvar, ob->pd->tex);
 	
 }
@@ -14008,40 +14238,40 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
 	Base *base;
 	SceneRenderLayer *srl;
 
-	for(base= sce->base.first; base; base= base->next) {
+	for (base= sce->base.first; base; base= base->next) {
 		expand_doit(fd, mainvar, base->object);
 	}
 	expand_doit(fd, mainvar, sce->camera);
 	expand_doit(fd, mainvar, sce->world);
 	
-	if(sce->adt)
+	if (sce->adt)
 		expand_animdata(fd, mainvar, sce->adt);
 	expand_keyingsets(fd, mainvar, &sce->keyingsets);
 	
-	if(sce->set)
+	if (sce->set)
 		expand_doit(fd, mainvar, sce->set);
 	
-	if(sce->nodetree)
+	if (sce->nodetree)
 		expand_nodetree(fd, mainvar, sce->nodetree);
 	
-	for(srl= sce->r.layers.first; srl; srl= srl->next) {
+	for (srl= sce->r.layers.first; srl; srl= srl->next) {
 		expand_doit(fd, mainvar, srl->mat_override);
 		expand_doit(fd, mainvar, srl->light_override);
 	}
 
-	if(sce->r.dometext)
+	if (sce->r.dometext)
 		expand_doit(fd, mainvar, sce->gm.dome.warptext);
 		
-	if(sce->gpd)
+	if (sce->gpd)
 		expand_doit(fd, mainvar, sce->gpd);
 
-	if(sce->ed) {
+	if (sce->ed) {
 		Sequence *seq;
 
 		SEQ_BEGIN(sce->ed, seq) {
-			if(seq->scene) expand_doit(fd, mainvar, seq->scene);
-			if(seq->scene_camera) expand_doit(fd, mainvar, seq->scene_camera);
-			if(seq->sound) expand_doit(fd, mainvar, seq->sound);
+			if (seq->scene) expand_doit(fd, mainvar, seq->scene);
+			if (seq->scene_camera) expand_doit(fd, mainvar, seq->scene_camera);
+			if (seq->sound) expand_doit(fd, mainvar, seq->sound);
 		}
 		SEQ_END
 	}
@@ -14050,20 +14280,22 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
 	{
 		TimeMarker *marker;
 
-		for(marker= sce->markers.first; marker; marker= marker->next) {
-			if(marker->camera) {
+		for (marker= sce->markers.first; marker; marker= marker->next) {
+			if (marker->camera) {
 				expand_doit(fd, mainvar, marker->camera);
 			}
 		}
 	}
 #endif
+
+	expand_doit(fd, mainvar, sce->clip);
 }
 
 static void expand_camera(FileData *fd, Main *mainvar, Camera *ca)
 {
 	expand_doit(fd, mainvar, ca->ipo); // XXX depreceated - old animation system
 	
-	if(ca->adt)
+	if (ca->adt)
 		expand_animdata(fd, mainvar, ca->adt);
 }
 
@@ -14080,6 +14312,11 @@ static void expand_sound(FileData *fd, Main *mainvar, bSound *snd)
 	expand_doit(fd, mainvar, snd->ipo); // XXX depreceated - old animation system
 }
 
+static void expand_movieclip(FileData *fd, Main *mainvar, MovieClip *clip)
+{
+	if (clip->adt)
+		expand_animdata(fd, mainvar, clip->adt);
+}
 
 static void expand_main(FileData *fd, Main *mainvar)
 {
@@ -14087,17 +14324,17 @@ static void expand_main(FileData *fd, Main *mainvar)
 	ID *id;
 	int a, doit= 1;
 
-	if(fd==NULL) return;
+	if (fd==NULL) return;
 
-	while(doit) {
+	while (doit) {
 		doit= 0;
 
 		a= set_listbasepointers(mainvar, lbarray);
-		while(a--) {
+		while (a--) {
 			id= lbarray[a]->first;
 
-			while(id) {
-				if(id->flag & LIB_TEST) {
+			while (id) {
+				if (id->flag & LIB_TEST) {
 
 					switch(GS(id->name)) {
 
@@ -14163,6 +14400,10 @@ static void expand_main(FileData *fd, Main *mainvar)
 						break;
 					case ID_PA:
 						expand_particlesettings(fd, mainvar, (ParticleSettings *)id);
+						break;
+					case ID_MC:
+						expand_movieclip(fd, mainvar, (MovieClip *)id);
+						break;
 					}
 
 					doit= 1;
@@ -14179,8 +14420,8 @@ static int object_in_any_scene(Main *mainvar, Object *ob)
 {
 	Scene *sce;
 	
-	for(sce= mainvar->scene.first; sce; sce= sce->id.next)
-		if(object_in_scene(ob, sce))
+	for (sce= mainvar->scene.first; sce; sce= sce->id.next)
+		if (object_in_scene(ob, sce))
 			return 1;
 	return 0;
 }
@@ -14192,25 +14433,25 @@ static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, const
 	const short is_group_append= (is_link==FALSE && idcode==ID_GR);
 
 	/* give all objects which are LIB_INDIRECT a base, or for a group when *lib has been set */
-	for(ob= mainvar->object.first; ob; ob= ob->id.next) {
+	for (ob= mainvar->object.first; ob; ob= ob->id.next) {
 		
-		if( ob->id.flag & LIB_INDIRECT ) {
+		if ( ob->id.flag & LIB_INDIRECT ) {
 			
-				/* IF below is quite confusing!
-				if we are appending, but this object wasnt just added along with a group,
-				then this is already used indirectly in the scene somewhere else and we didnt just append it.
-				
-				(ob->id.flag & LIB_PRE_EXISTING)==0 means that this is a newly appended object - Campbell */
+			/* IF below is quite confusing!
+			 * if we are appending, but this object wasnt just added along with a group,
+			 * then this is already used indirectly in the scene somewhere else and we didnt just append it.
+			 *
+			 * (ob->id.flag & LIB_PRE_EXISTING)==0 means that this is a newly appended object - Campbell */
 			if (is_group_append==0 || (ob->id.flag & LIB_PRE_EXISTING)==0) {
 				
 				int do_it= 0;
 				
-				if(ob->id.us==0) {
+				if (ob->id.us==0) {
 					do_it= 1;
 				}
-				else if(idcode==ID_GR) {
-					if(ob->id.us==1 && is_link==FALSE && ob->id.lib==lib) {
-						if((ob->flag & OB_FROMGROUP) && object_in_any_scene(mainvar, ob)==0) {
+				else if (idcode==ID_GR) {
+					if (ob->id.us==1 && is_link==FALSE && ob->id.lib==lib) {
+						if ((ob->flag & OB_FROMGROUP) && object_in_any_scene(mainvar, ob)==0) {
 							do_it= 1;
 						}
 					}
@@ -14218,20 +14459,20 @@ static void give_base_to_objects(Main *mainvar, Scene *sce, Library *lib, const
 				else {
 					/* when appending, make sure any indirectly loaded objects
 					 * get a base else they cant be accessed at all [#27437] */
-					if(ob->id.us==1 && is_link==FALSE && ob->id.lib==lib) {
+					if (ob->id.us==1 && is_link==FALSE && ob->id.lib==lib) {
 
 						/* we may be appending from a scene where we already
 						 *  have a linked object which is not in any scene [#27616] */
-						if((ob->id.flag & LIB_PRE_EXISTING)==0) {
+						if ((ob->id.flag & LIB_PRE_EXISTING)==0) {
 
-							if(object_in_any_scene(mainvar, ob)==0) {
+							if (object_in_any_scene(mainvar, ob)==0) {
 								do_it= 1;
 							}
 						}
 					}
 				}
 
-				if(do_it) {
+				if (do_it) {
 					base= MEM_callocN( sizeof(Base), "add_ext_base");
 					BLI_addtail(&(sce->base), base);
 					base->lay= ob->lay;
@@ -14252,8 +14493,8 @@ static void give_base_to_groups(Main *mainvar, Scene *scene)
 	Group *group;
 
 	/* give all objects which are LIB_INDIRECT a base, or for a group when *lib has been set */
-	for(group= mainvar->group.first; group; group= group->id.next) {
-		if(((group->id.flag & LIB_INDIRECT)==0 && (group->id.flag & LIB_PRE_EXISTING)==0)) {
+	for (group= mainvar->group.first; group; group= group->id.next) {
+		if (((group->id.flag & LIB_INDIRECT)==0 && (group->id.flag & LIB_PRE_EXISTING)==0)) {
 			Base *base;
 
 			/* add_object(...) messes with the selection */
@@ -14278,27 +14519,35 @@ static void give_base_to_groups(Main *mainvar, Scene *scene)
 }
 
 /* returns true if the item was found
-* but it may already have already been appended/linked */
+ * but it may already have already been appended/linked */
 static ID *append_named_part(Main *mainl, FileData *fd, const char *idname, const short idcode)
 {
 	BHead *bhead;
 	ID *id= NULL;
 	int found=0;
 
-	for(bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
-		if(bhead->code==idcode) {
+	for (bhead= blo_firstbhead(fd); bhead; bhead= blo_nextbhead(fd, bhead)) {
+		if (bhead->code==idcode) {
 			const char *idname_test= bhead_id_name(fd, bhead);
 
-			if(strcmp(idname_test + 2, idname)==0) {
+			if (strcmp(idname_test + 2, idname)==0) {
 				found= 1;
 				id= is_yet_read(fd, mainl, bhead);
-				if(id==NULL) {
+				if (id==NULL) {
+					/* not read yet */
 					read_libblock(fd, mainl, bhead, LIB_TESTEXT, &id);
+
+					if (id) {
+						/* sort by name in list */
+						ListBase *lb= which_libbase(mainl, idcode);
+						id_sort_by_name(lb, id);
+					}
 				}
 				else {
+					/* already linked */
 					printf("append: already linked\n");
 					oldnewmap_insert(fd->libmap, bhead->old, id, 1);
-					if(id->flag & LIB_INDIRECT) {
+					if (id->flag & LIB_INDIRECT) {
 						id->flag -= LIB_INDIRECT;
 						id->flag |= LIB_EXTERN;
 					}
@@ -14307,7 +14556,7 @@ static ID *append_named_part(Main *mainl, FileData *fd, const char *idname, cons
 				break;
 			}
 		}
-		else if(bhead->code==ENDB) {
+		else if (bhead->code==ENDB) {
 			break;
 		}
 	}
@@ -14322,9 +14571,9 @@ static ID *append_named_part_ex(const bContext *C, Main *mainl, FileData *fd, co
 {
 	ID *id= append_named_part(mainl, fd, idname, idcode);
 
-	if(id && (GS(id->name) == ID_OB)) {	/* loose object: give a base */
+	if (id && (GS(id->name) == ID_OB)) {	/* loose object: give a base */
 		Scene *scene= CTX_data_scene(C); /* can be NULL */
-		if(scene) {
+		if (scene) {
 			Base *base;
 			Object *ob;
 
@@ -14334,7 +14583,7 @@ static ID *append_named_part_ex(const bContext *C, Main *mainl, FileData *fd, co
 			ob= (Object *)id;
 
 			/* link at active layer (view3d->lay if in context, else scene->lay */
-			if((flag & FILE_ACTIVELAY)) {
+			if ((flag & FILE_ACTIVELAY)) {
 				View3D *v3d = CTX_wm_view3d(C);
 				ob->lay = v3d ? v3d->layact : scene->lay;
 			}
@@ -14344,7 +14593,7 @@ static ID *append_named_part_ex(const bContext *C, Main *mainl, FileData *fd, co
 			base->object= ob;
 			ob->id.us++;
 
-			if(flag & FILE_AUTOSELECT) {
+			if (flag & FILE_AUTOSELECT) {
 				base->flag |= SELECT;
 				base->object->flag = base->flag;
 				/* do NOT make base active here! screws up GUI stuff, if you want it do it on src/ level */
@@ -14382,7 +14631,8 @@ static void append_id_part(FileData *fd, Main *mainvar, ID *id, ID **id_r)
 
 				break;
 			}
-		} else if (bhead->code==ENDB)
+		}
+		else if (bhead->code==ENDB)
 			break;
 	}
 }
@@ -14428,7 +14678,7 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in
 	curlib= mainl->curlib;
 
 	/* make the lib path relative if required */
-	if(flag & FILE_RELPATH) {
+	if (flag & FILE_RELPATH) {
 
 		/* use the full path, this could have been read by other library even */
 		BLI_strncpy(curlib->name, curlib->filepath, sizeof(curlib->name));
@@ -14445,14 +14695,14 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in
 	lib_verify_nodetree(mainvar, FALSE);
 	fix_relpaths_library(G.main->name, mainvar); /* make all relative paths, relative to the open blend file */
 
-	if(C) {
+	if (C) {
 		Scene *scene= CTX_data_scene(C);
 
 		/* give a base to loose objects. If group append, do it for objects too */
-		if(scene) {
+		if (scene) {
 			const short is_link= (flag & FILE_LINK) != 0;
-			if(idcode==ID_SCE) {
-				/* dont instance anything when linking in scenes, assume the scene its self instances the data */
+			if (idcode==ID_SCE) {
+				/* don't instance anything when linking in scenes, assume the scene its self instances the data */
 			}
 			else {
 				give_base_to_objects(mainvar, scene, curlib, idcode, is_link);
@@ -14471,7 +14721,7 @@ static void library_append_end(const bContext *C, Main *mainl, FileData **fd, in
 	/* 20041208: put back. It only linked direct, not indirect objects (ton) */
 	
 	/* patch to prevent switch_endian happens twice */
-	if((*fd)->flags & FD_FLAGS_SWITCH_ENDIAN) {
+	if ((*fd)->flags & FD_FLAGS_SWITCH_ENDIAN) {
 		blo_freefiledata( *fd );
 		*fd = NULL;
 	}	
@@ -14497,7 +14747,7 @@ static int mainvar_count_libread_blocks(Main *mainvar)
 	int a, tot= 0;
 
 	a= set_listbasepointers(mainvar, lbarray);
-	while(a--) {
+	while (a--) {
 		ID *id;
 
 		for (id= lbarray[a]->first; id; id= id->next)
@@ -14514,19 +14764,19 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
 	ListBase *lbarray[MAX_LIBARRAY];
 	int a, doit= 1;
 
-	while(doit) {
+	while (doit) {
 		doit= 0;
 
 		/* test 1: read libdata */
 		mainptr= mainl->next;
-		while(mainptr) {
+		while (mainptr) {
 			int tot= mainvar_count_libread_blocks(mainptr);
 			
 			// printf("found LIB_READ %s\n", mainptr->curlib->name);
-			if(tot) {
+			if (tot) {
 				FileData *fd= mainptr->curlib->filedata;
 
-				if(fd==NULL) {
+				if (fd==NULL) {
 
 					/* printf and reports for now... its important users know this */
 					BKE_reportf_wrap(basefd->reports, RPT_INFO,
@@ -14536,8 +14786,8 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
 					fd= blo_openblenderfile(mainptr->curlib->filepath, basefd->reports);
 					
 					/* allow typing in a new lib path */
-					if(G.rt==-666) {
-						while(fd==NULL) {
+					if (G.rt==-666) {
+						while (fd==NULL) {
 							char newlib_path[FILE_MAX] = { 0 };
 							printf("Missing library...'\n");
 							printf("	current file: %s\n", G.main->name);
@@ -14545,14 +14795,14 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
 							printf("	relative lib: %s\n", mainptr->curlib->name);
 							printf("  enter a new path:\n");
 
-							if(scanf("%s", newlib_path) > 0) {
+							if (scanf("%s", newlib_path) > 0) {
 								BLI_strncpy(mainptr->curlib->name, newlib_path, sizeof(mainptr->curlib->name));
 								BLI_strncpy(mainptr->curlib->filepath, newlib_path, sizeof(mainptr->curlib->filepath));
 								cleanup_path(G.main->name, mainptr->curlib->filepath);
 								
 								fd= blo_openblenderfile(mainptr->curlib->filepath, basefd->reports);
 
-								if(fd) {
+								if (fd) {
 									printf("found: '%s', party on macuno!\n", mainptr->curlib->filepath);
 								}
 							}
@@ -14581,15 +14831,15 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
 						                 mainptr->curlib->filepath);
 					}
 				}
-				if(fd) {
+				if (fd) {
 					doit= 1;
 					a= set_listbasepointers(mainptr, lbarray);
-					while(a--) {
+					while (a--) {
 						ID *id= lbarray[a]->first;
 
-						while(id) {
+						while (id) {
 							ID *idn= id->next;
-							if(id->flag & LIB_READ) {
+							if (id->flag & LIB_READ) {
 								ID *realid= NULL;
 								BLI_remlink(lbarray[a], id);
 
@@ -14613,7 +14863,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
 					
 					/* dang FileData... now new libraries need to be appended to original filedata,
 					 * it is not a good replacement for the old global (ton) */
-					while( fd->mainlist.first ) {
+					while ( fd->mainlist.first ) {
 						Main *mp= fd->mainlist.first;
 						BLI_remlink(&fd->mainlist, mp);
 						BLI_addtail(&basefd->mainlist, mp);
@@ -14626,13 +14876,13 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
 	}
 	
 	/* test if there are unread libblocks */
-	for(mainptr= mainl->next; mainptr; mainptr= mainptr->next) {
+	for (mainptr= mainl->next; mainptr; mainptr= mainptr->next) {
 		a= set_listbasepointers(mainptr, lbarray);
-		while(a--) {
+		while (a--) {
 			ID *id= lbarray[a]->first;
-			while(id) {
+			while (id) {
 				ID *idn= id->next;
-				if(id->flag & LIB_READ) {
+				if (id->flag & LIB_READ) {
 					BLI_remlink(lbarray[a], id);
 					BKE_reportf_wrap(basefd->reports, RPT_ERROR,
 					                 "LIB ERROR: %s:'%s' unread libblock missing from '%s'\n",
@@ -14647,20 +14897,20 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
 	}
 	
 	/* do versions, link, and free */
-	for(mainptr= mainl->next; mainptr; mainptr= mainptr->next) {
+	for (mainptr= mainl->next; mainptr; mainptr= mainptr->next) {
 		/* some mains still have to be read, then
 		 * versionfile is still zero! */
-		if(mainptr->versionfile) {
-			if(mainptr->curlib->filedata) // can be zero... with shift+f1 append
+		if (mainptr->versionfile) {
+			if (mainptr->curlib->filedata) // can be zero... with shift+f1 append
 				do_versions(mainptr->curlib->filedata, mainptr->curlib, mainptr);
 			else
 				do_versions(basefd, NULL, mainptr);
 		}
 		
-		if(mainptr->curlib->filedata)
+		if (mainptr->curlib->filedata)
 			lib_link_all(mainptr->curlib->filedata, mainptr);
 		
-		if(mainptr->curlib->filedata) blo_freefiledata(mainptr->curlib->filedata);
+		if (mainptr->curlib->filedata) blo_freefiledata(mainptr->curlib->filedata);
 		mainptr->curlib->filedata= NULL;
 	}
 }
diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h
index c7a5355..511ded0 100644
--- a/source/blender/blenloader/intern/readfile.h
+++ b/source/blender/blenloader/intern/readfile.h
@@ -30,8 +30,8 @@
  *  \ingroup blenloader
  */
 
-#ifndef READFILE_H
-#define READFILE_H
+#ifndef __READFILE_H__
+#define __READFILE_H__
 
 #include "zlib.h"
 
diff --git a/source/blender/blenloader/intern/runtime.c b/source/blender/blenloader/intern/runtime.c
index 3f8a980..2f86c81 100644
--- a/source/blender/blenloader/intern/runtime.c
+++ b/source/blender/blenloader/intern/runtime.c
@@ -39,10 +39,10 @@
 #include <errno.h>
 
 #ifdef WIN32
-#include <io.h>		// read, open
-#include "BLI_winstuff.h"
+#  include <io.h>		// read, open
+#  include "BLI_winstuff.h"
 #else // ! WIN32
-#include <unistd.h>		// read
+#  include <unistd.h>		// read
 #endif
 
 #include "BLO_readfile.h"
@@ -60,7 +60,7 @@ static int handle_read_msb_int(int handle)
 {
 	unsigned char buf[4];
 
-	if(read(handle, buf, 4) != 4)
+	if (read(handle, buf, 4) != 4)
 		return -1;
 
 	return (buf[0]<<24) + (buf[1]<<16) + (buf[2]<<8) + (buf[3]<<0);
@@ -68,28 +68,28 @@ static int handle_read_msb_int(int handle)
 
 int BLO_is_a_runtime(const char *path)
 {
-	int res= 0, fd= open(path, O_BINARY|O_RDONLY, 0);
+	int res= 0, fd= BLI_open(path, O_BINARY|O_RDONLY, 0);
 	int datastart;
 	char buf[8];
 
-	if(fd==-1)
+	if (fd==-1)
 		goto cleanup;
 	
 	lseek(fd, -12, SEEK_END);
 	
 	datastart= handle_read_msb_int(fd);
 
-	if(datastart==-1)
+	if (datastart==-1)
 		goto cleanup;
-	else if(read(fd, buf, 8)!=8)
+	else if (read(fd, buf, 8)!=8)
 		goto cleanup;
-	else if(memcmp(buf, "BRUNTIME", 8)!=0)
+	else if (memcmp(buf, "BRUNTIME", 8)!=0)
 		goto cleanup;
 	else
 		res= 1;
 
 cleanup:
-	if(fd!=-1)
+	if (fd!=-1)
 		close(fd);
 
 	return res;	
@@ -102,9 +102,9 @@ BlendFileData *BLO_read_runtime(const char *path, ReportList *reports)
 	int fd, datastart;
 	char buf[8];
 
-	fd= open(path, O_BINARY|O_RDONLY, 0);
+	fd= BLI_open(path, O_BINARY|O_RDONLY, 0);
 
-	if(fd==-1) {
+	if (fd==-1) {
 		BKE_reportf(reports, RPT_ERROR, "Unable to open \"%s\": %s.", path, strerror(errno));
 		goto cleanup;
 	}
@@ -115,15 +115,15 @@ BlendFileData *BLO_read_runtime(const char *path, ReportList *reports)
 
 	datastart= handle_read_msb_int(fd);
 
-	if(datastart==-1) {
+	if (datastart==-1) {
 		BKE_reportf(reports, RPT_ERROR, "Unable to read  \"%s\" (problem seeking)", path);
 		goto cleanup;
 	}
-	else if(read(fd, buf, 8)!=8) {
+	else if (read(fd, buf, 8)!=8) {
 		BKE_reportf(reports, RPT_ERROR, "Unable to read  \"%s\" (truncated header)", path);
 		goto cleanup;
 	}
-	else if(memcmp(buf, "BRUNTIME", 8)!=0) {
+	else if (memcmp(buf, "BRUNTIME", 8)!=0) {
 		BKE_reportf(reports, RPT_ERROR, "Unable to read  \"%s\" (not a blend file)", path);
 		goto cleanup;
 	}
@@ -135,7 +135,7 @@ BlendFileData *BLO_read_runtime(const char *path, ReportList *reports)
 	}
 	
 cleanup:
-	if(fd!=-1)
+	if (fd!=-1)
 		close(fd);
 	
 	return bfd;
diff --git a/source/blender/blenloader/intern/undofile.c b/source/blender/blenloader/intern/undofile.c
index 03c5070..75fa8d0 100644
--- a/source/blender/blenloader/intern/undofile.c
+++ b/source/blender/blenloader/intern/undofile.c
@@ -55,8 +55,8 @@ void BLO_free_memfile(MemFile *memfile)
 {
 	MemFileChunk *chunk;
 	
-	while( (chunk = (memfile->chunks.first) ) ) {
-		if(chunk->ident==0) MEM_freeN(chunk->buf);
+	while ( (chunk = (memfile->chunks.first) ) ) {
+		if (chunk->ident==0) MEM_freeN(chunk->buf);
 		BLI_remlink(&memfile->chunks, chunk);
 		MEM_freeN(chunk);
 	}
@@ -72,42 +72,44 @@ void BLO_merge_memfile(MemFile *first, MemFile *second)
 	fc= first->chunks.first;
 	sc= second->chunks.first;
 	while (fc || sc) {
-		if(fc && sc) {
-			if(sc->ident) {
+		if (fc && sc) {
+			if (sc->ident) {
 				sc->ident= 0;
 				fc->ident= 1;
 			}
 		}
-		if(fc) fc= fc->next;
-		if(sc) sc= sc->next;
+		if (fc) fc= fc->next;
+		if (sc) sc= sc->next;
 	}
 	
 	BLO_free_memfile(first);
 }
 
-static int my_memcmp(int *mem1, int *mem2, int len)
+static int my_memcmp(const int *mem1, const int *mem2, const int len)
 {
-	register int a= len, *mema= mem1, *memb= mem2;
+	register int a = len;
+	register const int *mema = mem1;
+	register const int *memb = mem2;
 	
-	while(a--) {
-		if( *mema != *memb) return 1;
+	while (a--) {
+		if ( *mema != *memb) return 1;
 		mema++;
 		memb++;
 	}
 	return 0;
 }
 
-void add_memfilechunk(MemFile *compare, MemFile *current, char *buf, unsigned int size)
+void add_memfilechunk(MemFile *compare, MemFile *current, const char *buf, unsigned int size)
 {
 	static MemFileChunk *compchunk=NULL;
 	MemFileChunk *curchunk;
 	
 	/* this function inits when compare != NULL or when current==NULL */
-	if(compare) {
+	if (compare) {
 		compchunk= compare->chunks.first;
 		return;
 	}
-	if(current==NULL) {
+	if (current==NULL) {
 		compchunk= NULL;
 		return;
 	}
@@ -119,9 +121,9 @@ void add_memfilechunk(MemFile *compare, MemFile *current, char *buf, unsigned in
 	BLI_addtail(&current->chunks, curchunk);
 	
 	/* we compare compchunk with buf */
-	if(compchunk) {
-		if(compchunk->size == curchunk->size) {
-			if( my_memcmp((int *)compchunk->buf, (int *)buf, size/4)==0) {
+	if (compchunk) {
+		if (compchunk->size == curchunk->size) {
+			if (my_memcmp((int *)compchunk->buf, (const int *)buf, size / 4) == 0) {
 				curchunk->buf= compchunk->buf;
 				curchunk->ident= 1;
 			}
@@ -130,7 +132,7 @@ void add_memfilechunk(MemFile *compare, MemFile *current, char *buf, unsigned in
 	}
 	
 	/* not equal... */
-	if(curchunk->buf==NULL) {
+	if (curchunk->buf==NULL) {
 		curchunk->buf= MEM_mallocN(size, "Chunk buffer");
 		memcpy(curchunk->buf, buf, size);
 		current->size += size;
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index ae4bc93..61969c7 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -81,12 +81,12 @@ Any case: direct data is ALWAYS after the lib block
 #include "zlib.h"
 
 #ifndef WIN32
-#include <unistd.h>
+#  include <unistd.h>
 #else
-#include "winsock2.h"
-#include <io.h>
-#include <process.h> // for getpid
-#include "BLI_winstuff.h"
+#  include "winsock2.h"
+#  include <io.h>
+#  include <process.h> // for getpid
+#  include "BLI_winstuff.h"
 #endif
 
 /* allow writefile to use deprecated functionality (for forward compatibility code) */
@@ -135,6 +135,7 @@ Any case: direct data is ALWAYS after the lib block
 #include "DNA_movieclip_types.h"
 
 #include "MEM_guardedalloc.h" // MEM_freeN
+#include "BLI_bitmap.h"
 #include "BLI_blenlib.h"
 #include "BLI_linklist.h"
 #include "BLI_bpath.h"
@@ -155,6 +156,7 @@ Any case: direct data is ALWAYS after the lib block
 #include "BKE_modifier.h"
 #include "BKE_fcurve.h"
 #include "BKE_pointcache.h"
+#include "BKE_mesh.h"
 
 #include "BLO_writefile.h"
 #include "BLO_readfile.h"
@@ -202,13 +204,13 @@ static WriteData *writedata_new(int file)
 	return wd;
 }
 
-static void writedata_do_write(WriteData *wd, void *mem, int memlen)
+static void writedata_do_write(WriteData *wd, const void *mem, int memlen)
 {
 	if ((wd == NULL) || wd->error || (mem == NULL) || memlen < 1) return;
 	if (wd->error) return;
 
 	/* memory based save */
-	if(wd->current) {
+	if (wd->current) {
 		add_memfilechunk(NULL, wd->current, mem, memlen);
 	}
 	else {
@@ -230,20 +232,20 @@ static void writedata_free(WriteData *wd)
 
 /**
  * Low level WRITE(2) wrapper that buffers data
- * @param adr Pointer to new chunk of data
- * @param len Length of new chunk of data
- * @warning Talks to other functions with global parameters
+ * \param adr Pointer to new chunk of data
+ * \param len Length of new chunk of data
+ * \warning Talks to other functions with global parameters
  */
  
 #define MYWRITE_FLUSH		NULL
 
-static void mywrite( WriteData *wd, void *adr, int len)
+static void mywrite( WriteData *wd, const void *adr, int len)
 {
 	if (wd->error) return;
 
 	/* flush helps compression for undo-save */
-	if(adr==MYWRITE_FLUSH) {
-		if(wd->count) {
+	if (adr==MYWRITE_FLUSH) {
+		if (wd->count) {
 			writedata_do_write(wd, wd->buf, wd->count);
 			wd->count= 0;
 		}
@@ -254,8 +256,8 @@ static void mywrite( WriteData *wd, void *adr, int len)
 	
 	/* if we have a single big chunk, write existing data in
 	 * buffer and write out big chunk in smaller pieces */
-	if(len>MYWRITE_MAX_CHUNK) {
-		if(wd->count) {
+	if (len>MYWRITE_MAX_CHUNK) {
+		if (wd->count) {
 			writedata_do_write(wd, wd->buf, wd->count);
 			wd->count= 0;
 		}
@@ -263,15 +265,15 @@ static void mywrite( WriteData *wd, void *adr, int len)
 		do {
 			int writelen= MIN2(len, MYWRITE_MAX_CHUNK);
 			writedata_do_write(wd, adr, writelen);
-			adr = (char*)adr + writelen;
+			adr = (const char *)adr + writelen;
 			len -= writelen;
-		} while(len > 0);
+		} while (len > 0);
 
 		return;
 	}
 
 	/* if data would overflow buffer, write out the buffer */
-	if(len+wd->count>MYWRITE_BUFFER_SIZE-1) {
+	if (len+wd->count>MYWRITE_BUFFER_SIZE-1) {
 		writedata_do_write(wd, wd->buf, wd->count);
 		wd->count= 0;
 	}
@@ -283,9 +285,10 @@ static void mywrite( WriteData *wd, void *adr, int len)
 
 /**
  * BeGiN initializer for mywrite
- * @param file File descriptor
- * @param write_flags Write parameters
- * @warning Talks to other functions with global parameters
+ * \param file File descriptor
+ * \param compare Previous memory file (can be NULL).
+ * \param current The current memory file (can be NULL).
+ * \warning Talks to other functions with global parameters
  */
 static WriteData *bgnwrite(int file, MemFile *compare, MemFile *current)
 {
@@ -303,9 +306,9 @@ static WriteData *bgnwrite(int file, MemFile *compare, MemFile *current)
 
 /**
  * END the mywrite wrapper
- * @return 1 if write failed
- * @return unknown global variable otherwise
- * @warning Talks to other functions with global parameters
+ * \return 1 if write failed
+ * \return unknown global variable otherwise
+ * \warning Talks to other functions with global parameters
  */
 static int endwrite(WriteData *wd)
 {
@@ -329,7 +332,7 @@ static void writestruct(WriteData *wd, int filecode, const char *structname, int
 	BHead bh;
 	short *sp;
 
-	if(adr==NULL || nr==0) return;
+	if (adr==NULL || nr==0) return;
 
 	/* init BHead */
 	bh.code= filecode;
@@ -337,7 +340,7 @@ static void writestruct(WriteData *wd, int filecode, const char *structname, int
 	bh.nr= nr;
 
 	bh.SDNAnr= DNA_struct_find_nr(wd->sdna, structname);
-	if(bh.SDNAnr== -1) {
+	if (bh.SDNAnr== -1) {
 		printf("error: can't find SDNA code <%s>\n", structname);
 		return;
 	}
@@ -345,31 +348,31 @@ static void writestruct(WriteData *wd, int filecode, const char *structname, int
 
 	bh.len= nr*wd->sdna->typelens[sp[0]];
 
-	if(bh.len==0) return;
+	if (bh.len==0) return;
 
 	mywrite(wd, &bh, sizeof(BHead));
 	mywrite(wd, adr, bh.len);
 }
 
-static void writedata(WriteData *wd, int filecode, int len, void *adr)	/* do not use for structs */
+static void writedata(WriteData *wd, int filecode, int len, const void *adr)  /* do not use for structs */
 {
 	BHead bh;
 
-	if(adr==NULL) return;
-	if(len==0) return;
+	if (adr==NULL) return;
+	if (len==0) return;
 
-	len+= 3;
-	len-= ( len % 4);
+	len += 3;
+	len -= (len % 4);
 
 	/* init BHead */
-	bh.code= filecode;
-	bh.old= adr;
-	bh.nr= 1;
-	bh.SDNAnr= 0;
-	bh.len= len;
+	bh.code   = filecode;
+	bh.old    = (void *)adr;  /* this is safe to cast from const */
+	bh.nr     = 1;
+	bh.SDNAnr = 0;
+	bh.len    = len;
 
 	mywrite(wd, &bh, sizeof(BHead));
-	if(len) mywrite(wd, adr, len);
+	if (len) mywrite(wd, adr, len);
 }
 
 /* *************** writing some direct data structs used in more code parts **************** */
@@ -383,11 +386,11 @@ static void IDP_WriteArray(IDProperty *prop, void *wd)
 	if (prop->data.pointer) {
 		writedata(wd, DATA, MEM_allocN_len(prop->data.pointer), prop->data.pointer);
 
-		if(prop->subtype == IDP_GROUP) {
+		if (prop->subtype == IDP_GROUP) {
 			IDProperty **array= prop->data.pointer;
 			int a;
 
-			for(a=0; a<prop->len; a++)
+			for (a=0; a<prop->len; a++)
 				IDP_WriteProperty(array[a], wd);
 		}
 	}
@@ -402,7 +405,7 @@ static void IDP_WriteIDPArray(IDProperty *prop, void *wd)
 
 		writestruct(wd, DATA, "IDProperty", prop->len, array);
 
-		for(a=0; a<prop->len; a++)
+		for (a=0; a<prop->len; a++)
 			IDP_WriteProperty_OnlyData(&array[a], wd);
 	}
 }
@@ -485,7 +488,7 @@ static void write_fmodifiers(WriteData *wd, ListBase *fmodifiers)
 					FMod_Python *data = (FMod_Python *)fcm->data;
 					
 					/* Write ID Properties -- and copy this comment EXACTLY for easy finding
-					 of library blocks that implement this.*/
+					 * of library blocks that implement this.*/
 					IDP_WriteProperty(data->prop, wd);
 				}
 					break;
@@ -545,7 +548,7 @@ static void write_actions(WriteData *wd, ListBase *idbase)
 	bActionGroup *grp;
 	TimeMarker *marker;
 	
-	for(act=idbase->first; act; act= act->id.next) {
+	for (act=idbase->first; act; act= act->id.next) {
 		if (act->id.us>0 || wd->current) {
 			writestruct(wd, ID_AC, "bAction", 1, act);
 			if (act->id.properties) IDP_WriteProperty(act->id.properties, wd);
@@ -646,7 +649,7 @@ static void write_curvemapping(WriteData *wd, CurveMapping *cumap)
 	int a;
 	
 	writestruct(wd, DATA, "CurveMapping", 1, cumap);
-	for(a=0; a<CM_TOT; a++)
+	for (a=0; a<CM_TOT; a++)
 		writestruct(wd, DATA, "CurveMapPoint", cumap->cm[a].totpoint, cumap->cm[a].curve);
 }
 
@@ -657,7 +660,7 @@ static void write_node_socket(WriteData *wd, bNodeSocket *sock)
 	/* forward compatibility code, so older blenders still open */
 	sock->stack_type = 1;
 	
-	if(sock->default_value) {
+	if (sock->default_value) {
 		bNodeSocketValueFloat *valfloat;
 		bNodeSocketValueVector *valvector;
 		bNodeSocketValueRGBA *valrgba;
@@ -699,40 +702,46 @@ static void write_nodetree(WriteData *wd, bNodeTree *ntree)
 	
 	/* for link_list() speed, we write per list */
 	
-	if(ntree->adt) write_animdata(wd, ntree->adt);
+	if (ntree->adt) write_animdata(wd, ntree->adt);
 	
-	for(node= ntree->nodes.first; node; node= node->next)
+	for (node= ntree->nodes.first; node; node= node->next)
 		writestruct(wd, DATA, "bNode", 1, node);
 
-	for(node= ntree->nodes.first; node; node= node->next) {
-		for(sock= node->inputs.first; sock; sock= sock->next)
+	for (node= ntree->nodes.first; node; node= node->next) {
+		for (sock= node->inputs.first; sock; sock= sock->next)
 			write_node_socket(wd, sock);
-		for(sock= node->outputs.first; sock; sock= sock->next)
+		for (sock= node->outputs.first; sock; sock= sock->next)
 			write_node_socket(wd, sock);
 
 		
-		if(node->storage && node->type!=NODE_DYNAMIC) {
+		if (node->storage && node->type!=NODE_DYNAMIC) {
 			/* 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))
+			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_COMPOSIT && ELEM4(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT))
+			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) )
+			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);
 		}
+		
+		if (node->type==CMP_NODE_OUTPUT_FILE) {
+			/* inputs have own storage data */
+			for (sock=node->inputs.first; sock; sock=sock->next)
+				writestruct(wd, DATA, "NodeImageMultiFileSocket", 1, sock->storage);
+		}
 	}
 	
-	for(link= ntree->links.first; link; link= link->next)
+	for (link= ntree->links.first; link; link= link->next)
 		writestruct(wd, DATA, "bNodeLink", 1, link);
 	
 	/* external sockets */
-	for(sock= ntree->inputs.first; sock; sock= sock->next)
+	for (sock= ntree->inputs.first; sock; sock= sock->next)
 		write_node_socket(wd, sock);
-	for(sock= ntree->outputs.first; sock; sock= sock->next)
+	for (sock= ntree->outputs.first; sock; sock= sock->next)
 		write_node_socket(wd, sock);
 }
 
@@ -748,24 +757,30 @@ static void current_screen_compat(Main *mainvar, bScreen **screen)
 	*screen= (window)? window->screen: NULL;
 }
 
+typedef struct RenderInfo {
+	int sfra;
+	int efra;
+	char scene_name[MAX_ID_NAME - 2];
+} RenderInfo;
+
 static void write_renderinfo(WriteData *wd, Main *mainvar)		/* for renderdeamon */
 {
 	bScreen *curscreen;
 	Scene *sce;
-	int data[8];
+	RenderInfo data;
 
 	/* XXX in future, handle multiple windows with multiple screnes? */
 	current_screen_compat(mainvar, &curscreen);
 
-	for(sce= mainvar->scene.first; sce; sce= sce->id.next) {
-		if(sce->id.lib==NULL  && ( sce==curscreen->scene || (sce->r.scemode & R_BG_RENDER)) ) {
-			data[0]= sce->r.sfra;
-			data[1]= sce->r.efra;
+	for (sce= mainvar->scene.first; sce; sce= sce->id.next) {
+		if (sce->id.lib==NULL  && ( sce==curscreen->scene || (sce->r.scemode & R_BG_RENDER)) ) {
+			data.sfra = sce->r.sfra;
+			data.efra = sce->r.efra;
+			memset(data.scene_name, 0, sizeof(data.scene_name));
 
-			memset(data+2, 0, sizeof(int)*6);
-			BLI_strncpy((char *)(data+2), sce->id.name+2, sizeof(sce->id.name)-2);
+			BLI_strncpy(data.scene_name, sce->id.name + 2, sizeof(data.scene_name));
 
-			writedata(wd, REND, 32, data);
+			writedata(wd, REND, sizeof(data), &data);
 		}
 	}
 }
@@ -773,7 +788,7 @@ static void write_renderinfo(WriteData *wd, Main *mainvar)		/* for renderdeamon
 static void write_keymapitem(WriteData *wd, wmKeyMapItem *kmi)
 {
 	writestruct(wd, DATA, "wmKeyMapItem", 1, kmi);
-	if(kmi->properties)
+	if (kmi->properties)
 		IDP_WriteProperty(kmi->properties, wd);
 }
 
@@ -788,28 +803,28 @@ static void write_userdef(WriteData *wd)
 	
 	writestruct(wd, USER, "UserDef", 1, &U);
 
-	for(btheme= U.themes.first; btheme; btheme=btheme->next)
+	for (btheme= U.themes.first; btheme; btheme=btheme->next)
 		writestruct(wd, DATA, "bTheme", 1, btheme);
 
-	for(keymap= U.user_keymaps.first; keymap; keymap=keymap->next) {
+	for (keymap= U.user_keymaps.first; keymap; keymap=keymap->next) {
 		writestruct(wd, DATA, "wmKeyMap", 1, keymap);
 
-		for(kmdi=keymap->diff_items.first; kmdi; kmdi=kmdi->next) {
+		for (kmdi=keymap->diff_items.first; kmdi; kmdi=kmdi->next) {
 			writestruct(wd, DATA, "wmKeyMapDiffItem", 1, kmdi);
-			if(kmdi->remove_item)
+			if (kmdi->remove_item)
 				write_keymapitem(wd, kmdi->remove_item);
-			if(kmdi->add_item)
+			if (kmdi->add_item)
 				write_keymapitem(wd, kmdi->add_item);
 		}
 
-		for(kmi=keymap->items.first; kmi; kmi=kmi->next)
+		for (kmi=keymap->items.first; kmi; kmi=kmi->next)
 			write_keymapitem(wd, kmi);
 	}
 
-	for(bext= U.addons.first; bext; bext=bext->next)
+	for (bext= U.addons.first; bext; bext=bext->next)
 		writestruct(wd, DATA, "bAddon", 1, bext);
 	
-	for(style= U.uistyles.first; style; style= style->next) {
+	for (style= U.uistyles.first; style; style= style->next) {
 		writestruct(wd, DATA, "uiStyle", 1, style);
 	}
 }
@@ -821,7 +836,7 @@ static void write_boid_state(WriteData *wd, BoidState *state)
 
 	writestruct(wd, DATA, "BoidState", 1, state);
 
-	for(; rule; rule=rule->next) {
+	for (; rule; rule=rule->next) {
 		switch(rule->type) {
 			case eBoidRuleType_Goal:
 			case eBoidRuleType_Avoid:
@@ -844,7 +859,7 @@ static void write_boid_state(WriteData *wd, BoidState *state)
 				break;
 		}
 	}
-	//for(; cond; cond=cond->next)
+	//for (; cond; cond=cond->next)
 	//	writestruct(wd, DATA, "BoidCondition", 1, cond);
 }
 
@@ -868,28 +883,28 @@ static void write_pointcaches(WriteData *wd, ListBase *ptcaches)
 	PointCache *cache = ptcaches->first;
 	int i;
 
-	for(; cache; cache=cache->next) {
+	for (; cache; cache=cache->next) {
 		writestruct(wd, DATA, "PointCache", 1, cache);
 
-		if((cache->flag & PTCACHE_DISK_CACHE)==0) {
+		if ((cache->flag & PTCACHE_DISK_CACHE)==0) {
 			PTCacheMem *pm = cache->mem_cache.first;
 
-			for(; pm; pm=pm->next) {
+			for (; pm; pm=pm->next) {
 				PTCacheExtra *extra = pm->extradata.first;
 
 				writestruct(wd, DATA, "PTCacheMem", 1, pm);
 				
-				for(i=0; i<BPHYS_TOT_DATA; i++) {
-					if(pm->data[i] && pm->data_types & (1<<i)) {
-						if(ptcache_data_struct[i][0]=='\0')
+				for (i=0; i<BPHYS_TOT_DATA; i++) {
+					if (pm->data[i] && pm->data_types & (1<<i)) {
+						if (ptcache_data_struct[i][0]=='\0')
 							writedata(wd, DATA, MEM_allocN_len(pm->data[i]), pm->data[i]);
 						else
 							writestruct(wd, DATA, ptcache_data_struct[i], pm->totpoint, pm->data[i]);
 					}
 				}
 
-				for(; extra; extra=extra->next) {
-					if(ptcache_extra_struct[extra->type][0]=='\0')
+				for (; extra; extra=extra->next) {
+					if (ptcache_extra_struct[extra->type][0]=='\0')
 						continue;
 					writestruct(wd, DATA, "PTCacheExtra", 1, extra);
 					writestruct(wd, DATA, ptcache_extra_struct[extra->type], extra->totdata, extra->data);
@@ -906,8 +921,8 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase)
 	int a;
 
 	part= idbase->first;
-	while(part) {
-		if(part->id.us>0 || wd->current) {
+	while (part) {
+		if (part->id.us>0 || wd->current) {
 			/* write LibData */
 			writestruct(wd, ID_PA, "ParticleSettings", 1, part);
 			if (part->id.properties) IDP_WriteProperty(part->id.properties, wd);
@@ -917,12 +932,12 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase)
 			writestruct(wd, DATA, "EffectorWeights", 1, part->effector_weights);
 
 			dw = part->dupliweights.first;
-			for(; dw; dw=dw->next) {
+			for (; dw; dw=dw->next) {
 				/* update indices */
 				dw->index = 0;
-				if(part->dup_group) { /* can be NULL if lining fails or set to None */
+				if (part->dup_group) { /* can be NULL if lining fails or set to None */
 					go = part->dup_group->gobject.first;
-					while(go && go->ob != dw->ob) {
+					while (go && go->ob != dw->ob) {
 						go=go->next;
 						dw->index++;
 					}
@@ -930,20 +945,20 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase)
 				writestruct(wd, DATA, "ParticleDupliWeight", 1, dw);
 			}
 
-			if(part->boids && part->phystype == PART_PHYS_BOIDS) {
+			if (part->boids && part->phystype == PART_PHYS_BOIDS) {
 				BoidState *state = part->boids->states.first;
 
 				writestruct(wd, DATA, "BoidSettings", 1, part->boids);
 
-				for(; state; state=state->next)
+				for (; state; state=state->next)
 					write_boid_state(wd, state);
 			}
-			if(part->fluid && part->phystype == PART_PHYS_FLUID){
+			if (part->fluid && part->phystype == PART_PHYS_FLUID) {
 				writestruct(wd, DATA, "SPHFluidSettings", 1, part->fluid); 
 			}
 
-			for(a=0; a<MAX_MTEX; a++) {
-				if(part->mtex[a]) writestruct(wd, DATA, "MTex", 1, part->mtex[a]);
+			for (a=0; a<MAX_MTEX; a++) {
+				if (part->mtex[a]) writestruct(wd, DATA, "MTex", 1, part->mtex[a]);
 			}
 		}
 		part= part->id.next;
@@ -955,32 +970,32 @@ static void write_particlesystems(WriteData *wd, ListBase *particles)
 	ParticleTarget *pt;
 	int a;
 
-	for(; psys; psys=psys->next) {
+	for (; psys; psys=psys->next) {
 		writestruct(wd, DATA, "ParticleSystem", 1, psys);
 
-		if(psys->particles) {
+		if (psys->particles) {
 			writestruct(wd, DATA, "ParticleData", psys->totpart ,psys->particles);
 
-			if(psys->particles->hair) {
+			if (psys->particles->hair) {
 				ParticleData *pa = psys->particles;
 
-				for(a=0; a<psys->totpart; a++, pa++)
+				for (a=0; a<psys->totpart; a++, pa++)
 					writestruct(wd, DATA, "HairKey", pa->totkey, pa->hair);
 			}
 
-			if(psys->particles->boid && psys->part->phystype == PART_PHYS_BOIDS)
+			if (psys->particles->boid && psys->part->phystype == PART_PHYS_BOIDS)
 				writestruct(wd, DATA, "BoidParticle", psys->totpart, psys->particles->boid);
 
-			if(psys->part->fluid && psys->part->phystype == PART_PHYS_FLUID && (psys->part->fluid->flag & SPH_VISCOELASTIC_SPRINGS))
+			if (psys->part->fluid && psys->part->phystype == PART_PHYS_FLUID && (psys->part->fluid->flag & SPH_VISCOELASTIC_SPRINGS))
 				writestruct(wd, DATA, "ParticleSpring", psys->tot_fluidsprings, psys->fluid_springs);
 		}
 		pt = psys->targets.first;
-		for(; pt; pt=pt->next)
+		for (; pt; pt=pt->next)
 			writestruct(wd, DATA, "ParticleTarget", 1, pt);
 
-		if(psys->child) writestruct(wd, DATA, "ChildParticle", psys->totchild ,psys->child);
+		if (psys->child) writestruct(wd, DATA, "ChildParticle", psys->totchild ,psys->child);
 
-		if(psys->clmd) {
+		if (psys->clmd) {
 			writestruct(wd, DATA, "ClothModifierData", 1, psys->clmd);
 			writestruct(wd, DATA, "ClothSimSettings", 1, psys->clmd->sim_parms);
 			writestruct(wd, DATA, "ClothCollSettings", 1, psys->clmd->coll_parms);
@@ -995,10 +1010,10 @@ static void write_properties(WriteData *wd, ListBase *lb)
 	bProperty *prop;
 
 	prop= lb->first;
-	while(prop) {
+	while (prop) {
 		writestruct(wd, DATA, "bProperty", 1, prop);
 
-		if(prop->poin && prop->poin != &prop->data)
+		if (prop->poin && prop->poin != &prop->data)
 			writedata(wd, DATA, MEM_allocN_len(prop->poin), prop->poin);
 
 		prop= prop->next;
@@ -1010,7 +1025,7 @@ static void write_sensors(WriteData *wd, ListBase *lb)
 	bSensor *sens;
 
 	sens= lb->first;
-	while(sens) {
+	while (sens) {
 		writestruct(wd, DATA, "bSensor", 1, sens);
 
 		writedata(wd, DATA, sizeof(void *)*sens->totlinks, sens->links);
@@ -1071,7 +1086,7 @@ static void write_controllers(WriteData *wd, ListBase *lb)
 	bController *cont;
 
 	cont= lb->first;
-	while(cont) {
+	while (cont) {
 		writestruct(wd, DATA, "bController", 1, cont);
 
 		writedata(wd, DATA, sizeof(void *)*cont->totlinks, cont->links);
@@ -1096,7 +1111,7 @@ static void write_actuators(WriteData *wd, ListBase *lb)
 	bActuator *act;
 
 	act= lb->first;
-	while(act) {
+	while (act) {
 		writestruct(wd, DATA, "bActuator", 1, act);
 
 		switch(act->type) {
@@ -1203,7 +1218,7 @@ static void write_constraints(WriteData *wd, ListBase *conlist)
 						writestruct(wd, DATA, "bConstraintTarget", 1, ct);
 					
 					/* Write ID Properties -- and copy this comment EXACTLY for easy finding
-					 of library blocks that implement this.*/
+					 * of library blocks that implement this.*/
 					IDP_WriteProperty(data->prop, wd);
 				}
 					break;
@@ -1235,7 +1250,7 @@ static void write_pose(WriteData *wd, bPose *pose)
 	/* Write channels */
 	for (chan=pose->chanbase.first; chan; chan=chan->next) {
 		/* Write ID Properties -- and copy this comment EXACTLY for easy finding
-		 of library blocks that implement this.*/
+		 * of library blocks that implement this.*/
 		if (chan->prop)
 			IDP_WriteProperty(chan->prop, wd);
 		
@@ -1290,7 +1305,7 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
 			
 			writedata(wd, DATA, sizeof(int)*hmd->totindex, hmd->indexar);
 		}
-		else if(md->type==eModifierType_Cloth) {
+		else if (md->type==eModifierType_Cloth) {
 			ClothModifierData *clmd = (ClothModifierData*) md;
 			
 			writestruct(wd, DATA, "ClothSimSettings", 1, clmd->sim_parms);
@@ -1298,12 +1313,12 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
 			writestruct(wd, DATA, "EffectorWeights", 1, clmd->sim_parms->effector_weights);
 			write_pointcaches(wd, &clmd->ptcaches);
 		} 
-		else if(md->type==eModifierType_Smoke) {
+		else if (md->type==eModifierType_Smoke) {
 			SmokeModifierData *smd = (SmokeModifierData*) md;
 			
-			if(smd->type & MOD_SMOKE_TYPE_DOMAIN)
+			if (smd->type & MOD_SMOKE_TYPE_DOMAIN)
 			{
-				if(smd->domain)
+				if (smd->domain)
 				{
 					write_pointcaches(wd, &(smd->domain->ptcaches[0]));
 
@@ -1317,7 +1332,7 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
 				
 				writestruct(wd, DATA, "SmokeDomainSettings", 1, smd->domain);
 
-				if(smd->domain) {
+				if (smd->domain) {
 					/* cleanup the fake pointcache */
 					BKE_ptcache_free_list(&smd->domain->ptcaches[1]);
 					smd->domain->point_cache[1] = NULL;
@@ -1325,20 +1340,20 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
 					writestruct(wd, DATA, "EffectorWeights", 1, smd->domain->effector_weights);
 				}
 			}
-			else if(smd->type & MOD_SMOKE_TYPE_FLOW)
+			else if (smd->type & MOD_SMOKE_TYPE_FLOW)
 				writestruct(wd, DATA, "SmokeFlowSettings", 1, smd->flow);
-			else if(smd->type & MOD_SMOKE_TYPE_COLL)
+			else if (smd->type & MOD_SMOKE_TYPE_COLL)
 				writestruct(wd, DATA, "SmokeCollSettings", 1, smd->coll);
 		} 
-		else if(md->type==eModifierType_Fluidsim) {
+		else if (md->type==eModifierType_Fluidsim) {
 			FluidsimModifierData *fluidmd = (FluidsimModifierData*) md;
 			
 			writestruct(wd, DATA, "FluidsimSettings", 1, fluidmd->fss);
 		}
-		else if(md->type==eModifierType_DynamicPaint) {
+		else if (md->type==eModifierType_DynamicPaint) {
 			DynamicPaintModifierData *pmd = (DynamicPaintModifierData*) md;
 			
-			if(pmd->canvas)
+			if (pmd->canvas)
 			{
 				DynamicPaintSurface *surface;
 				writestruct(wd, DATA, "DynamicPaintCanvasSettings", 1, pmd->canvas);
@@ -1353,7 +1368,7 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
 					writestruct(wd, DATA, "EffectorWeights", 1, surface->effector_weights);
 				}
 			}
-			if(pmd->brush)
+			if (pmd->brush)
 			{
 				writestruct(wd, DATA, "DynamicPaintBrushSettings", 1, pmd->brush);
 				writestruct(wd, DATA, "ColorBand", 1, pmd->brush->paint_ramp);
@@ -1385,7 +1400,7 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
 		}
 		else if (md->type==eModifierType_Warp) {
 			WarpModifierData *tmd = (WarpModifierData*) md;
-			if(tmd->curfalloff) {
+			if (tmd->curfalloff) {
 				write_curvemapping(wd, tmd->curfalloff);
 			}
 		}
@@ -1403,13 +1418,13 @@ static void write_objects(WriteData *wd, ListBase *idbase)
 	Object *ob;
 	
 	ob= idbase->first;
-	while(ob) {
-		if(ob->id.us>0 || wd->current) {
+	while (ob) {
+		if (ob->id.us>0 || wd->current) {
 			/* write LibData */
 			writestruct(wd, ID_OB, "Object", 1, ob);
 			
-			/*Write ID Properties -- and copy this comment EXACTLY for easy finding
-			  of library blocks that implement this.*/
+			/* Write ID Properties -- and copy this comment EXACTLY for easy finding
+			 * of library blocks that implement this.*/
 			if (ob->id.properties) IDP_WriteProperty(ob->id.properties, wd);
 			
 			if (ob->adt) write_animdata(wd, ob->adt);
@@ -1437,7 +1452,7 @@ static void write_objects(WriteData *wd, ListBase *idbase)
 			
 			writestruct(wd, DATA, "PartDeflect", 1, ob->pd);
 			writestruct(wd, DATA, "SoftBody", 1, ob->soft);
-			if(ob->soft) {
+			if (ob->soft) {
 				write_pointcaches(wd, &ob->soft->ptcaches);
 				writestruct(wd, DATA, "EffectorWeights", 1, ob->soft->effector_weights);
 			}
@@ -1460,8 +1475,8 @@ static void write_vfonts(WriteData *wd, ListBase *idbase)
 	PackedFile * pf;
 
 	vf= idbase->first;
-	while(vf) {
-		if(vf->id.us>0 || wd->current) {
+	while (vf) {
+		if (vf->id.us>0 || wd->current) {
 			/* write LibData */
 			writestruct(wd, ID_VF, "VFont", 1, vf);
 			if (vf->id.properties) IDP_WriteProperty(vf->id.properties, wd);
@@ -1486,8 +1501,8 @@ static void write_keys(WriteData *wd, ListBase *idbase)
 	KeyBlock *kb;
 
 	key= idbase->first;
-	while(key) {
-		if(key->id.us>0 || wd->current) {
+	while (key) {
+		if (key->id.us>0 || wd->current) {
 			/* write LibData */
 			writestruct(wd, ID_KE, "Key", 1, key);
 			if (key->id.properties) IDP_WriteProperty(key->id.properties, wd);
@@ -1496,9 +1511,9 @@ static void write_keys(WriteData *wd, ListBase *idbase)
 			
 			/* direct data */
 			kb= key->block.first;
-			while(kb) {
+			while (kb) {
 				writestruct(wd, DATA, "KeyBlock", 1, kb);
-				if(kb->data) writedata(wd, DATA, kb->totelem*key->elemsize, kb->data);
+				if (kb->data) writedata(wd, DATA, kb->totelem*key->elemsize, kb->data);
 				kb= kb->next;
 			}
 		}
@@ -1514,8 +1529,8 @@ static void write_cameras(WriteData *wd, ListBase *idbase)
 	Camera *cam;
 
 	cam= idbase->first;
-	while(cam) {
-		if(cam->id.us>0 || wd->current) {
+	while (cam) {
+		if (cam->id.us>0 || wd->current) {
 			/* write LibData */
 			writestruct(wd, ID_CA, "Camera", 1, cam);
 			if (cam->id.properties) IDP_WriteProperty(cam->id.properties, wd);
@@ -1533,8 +1548,8 @@ static void write_mballs(WriteData *wd, ListBase *idbase)
 	MetaElem *ml;
 
 	mb= idbase->first;
-	while(mb) {
-		if(mb->id.us>0 || wd->current) {
+	while (mb) {
+		if (mb->id.us>0 || wd->current) {
 			/* write LibData */
 			writestruct(wd, ID_MB, "MetaBall", 1, mb);
 			if (mb->id.properties) IDP_WriteProperty(mb->id.properties, wd);
@@ -1544,7 +1559,7 @@ static void write_mballs(WriteData *wd, ListBase *idbase)
 			if (mb->adt) write_animdata(wd, mb->adt);
 
 			ml= mb->elems.first;
-			while(ml) {
+			while (ml) {
 				writestruct(wd, DATA, "MetaElem", 1, ml);
 				ml= ml->next;
 			}
@@ -1566,8 +1581,8 @@ static void write_curves(WriteData *wd, ListBase *idbase)
 	Nurb *nu;
 
 	cu= idbase->first;
-	while(cu) {
-		if(cu->id.us>0 || wd->current) {
+	while (cu) {
+		if (cu->id.us>0 || wd->current) {
 			/* write LibData */
 			writestruct(wd, ID_CU, "Curve", 1, cu);
 			
@@ -1576,7 +1591,7 @@ static void write_curves(WriteData *wd, ListBase *idbase)
 			if (cu->id.properties) IDP_WriteProperty(cu->id.properties, wd);
 			if (cu->adt) write_animdata(wd, cu->adt);
 			
-			if(cu->vfont) {
+			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);				
@@ -1584,18 +1599,18 @@ static void write_curves(WriteData *wd, ListBase *idbase)
 			else {
 				/* is also the order of reading */
 				nu= cu->nurb.first;
-				while(nu) {
+				while (nu) {
 					writestruct(wd, DATA, "Nurb", 1, nu);
 					nu= nu->next;
 				}
 				nu= cu->nurb.first;
-				while(nu) {
-					if(nu->type == CU_BEZIER)
+				while (nu) {
+					if (nu->type == CU_BEZIER)
 						writestruct(wd, DATA, "BezTriple", nu->pntsu, nu->bezt);
 					else {
 						writestruct(wd, DATA, "BPoint", nu->pntsu*nu->pntsv, nu->bp);
-						if(nu->knotsu) writedata(wd, DATA, KNOTSU(nu)*sizeof(float), nu->knotsu);
-						if(nu->knotsv) writedata(wd, DATA, KNOTSV(nu)*sizeof(float), nu->knotsv);
+						if (nu->knotsu) writedata(wd, DATA, KNOTSU(nu)*sizeof(float), nu->knotsu);
+						if (nu->knotsv) writedata(wd, DATA, KNOTSV(nu)*sizeof(float), nu->knotsv);
 					}
 					nu= nu->next;
 				}
@@ -1626,15 +1641,19 @@ static void write_dverts(WriteData *wd, int count, MDeformVert *dvlist)
 
 static void write_mdisps(WriteData *wd, int count, MDisps *mdlist, int external)
 {
-	if(mdlist) {
+	if (mdlist) {
 		int i;
 		
 		writestruct(wd, DATA, "MDisps", count, mdlist);
-		if(!external) {
-			for(i = 0; i < count; ++i) {
-				if(mdlist[i].disps)
-					writedata(wd, DATA, sizeof(float)*3*mdlist[i].totdisp, mdlist[i].disps);
+		for (i = 0; i < count; ++i) {
+			MDisps *md = &mdlist[i];
+			if (md->disps) {
+				if (!external)
+					writedata(wd, DATA, sizeof(float)*3*md->totdisp, md->disps);
 			}
+			
+			if (md->hidden)
+				writedata(wd, DATA, BLI_BITMAP_SIZE(md->totdisp), md->hidden);
 		}
 	}
 }
@@ -1644,7 +1663,7 @@ static void write_customdata(WriteData *wd, ID *id, int count, CustomData *data,
 	int i;
 
 	/* write external customdata (not for undo) */
-	if(data->external && !wd->current)
+	if (data->external && !wd->current)
 		CustomData_external_write(data, id, CD_MASK_MESH, count, 0);
 
 	writestruct(wd, DATA, "CustomDataLayer", data->maxlayer, data->layers);
@@ -1665,8 +1684,8 @@ static void write_customdata(WriteData *wd, ID *id, int count, CustomData *data,
 			CustomData_file_write_info(layer->type, &structname, &structnum);
 			if (structnum) {
 				/* when using partial visibility, the MEdge and MFace layers
-				   are smaller than the original, so their type and count is
-				   passed to make this work */
+				 * are smaller than the original, so their type and count is
+				 * passed to make this work */
 				if (layer->type != partial_type) datasize= structnum*count;
 				else datasize= structnum*partial_count;
 
@@ -1678,29 +1697,144 @@ static void write_customdata(WriteData *wd, ID *id, int count, CustomData *data,
 		}
 	}
 
-	if(data->external)
+	if (data->external)
 		writestruct(wd, DATA, "CustomDataExternal", 1, data->external);
 }
 
 static void write_meshs(WriteData *wd, ListBase *idbase)
 {
 	Mesh *mesh;
+	int save_for_old_blender= 0;
+
+#ifdef USE_BMESH_SAVE_AS_COMPAT
+	save_for_old_blender = wd->use_mesh_compat; /* option to save with older mesh format */
+#endif
 
 	mesh= idbase->first;
-	while(mesh) {
-		if(mesh->id.us>0 || wd->current) {
+	while (mesh) {
+		if (mesh->id.us>0 || wd->current) {
 			/* write LibData */
-			writestruct(wd, ID_ME, "Mesh", 1, mesh);
+			if (!save_for_old_blender) {
+
+#ifdef USE_BMESH_SAVE_WITHOUT_MFACE
+				Mesh backup_mesh = {{0}};
+				/* cache only - don't write */
+				backup_mesh.mface = mesh->mface;
+				mesh->mface = NULL;
+				/* -- */
+				backup_mesh.totface = mesh->totface;
+				mesh->totface = 0;
+				/* -- */
+#endif /* USE_BMESH_SAVE_WITHOUT_MFACE */
+
+				writestruct(wd, ID_ME, "Mesh", 1, mesh);
+
+				/* direct data */
+				if (mesh->id.properties) IDP_WriteProperty(mesh->id.properties, wd);
+				if (mesh->adt) write_animdata(wd, mesh->adt);
+
+				writedata(wd, DATA, sizeof(void *)*mesh->totcol, mesh->mat);
+				writedata(wd, DATA, sizeof(MSelect) * mesh->totselect, mesh->mselect);
+
+				write_customdata(wd, &mesh->id, mesh->totvert, &mesh->vdata, -1, 0);
+				write_customdata(wd, &mesh->id, mesh->totedge, &mesh->edata, -1, 0);
+				/* fdata is really a dummy - written so slots align */
+				write_customdata(wd, &mesh->id, mesh->totface, &mesh->fdata, -1, 0);
+				write_customdata(wd, &mesh->id, mesh->totloop, &mesh->ldata, -1, 0);
+				write_customdata(wd, &mesh->id, mesh->totpoly, &mesh->pdata, -1, 0);
+
+#ifdef USE_BMESH_SAVE_WITHOUT_MFACE
+				/* cache only - don't write */
+				mesh->mface = backup_mesh.mface;
+				/* -- */
+				mesh->totface = backup_mesh.totface;
+#endif /* USE_BMESH_SAVE_WITHOUT_MFACE */
 
-			/* direct data */
-			if (mesh->id.properties) IDP_WriteProperty(mesh->id.properties, wd);
-			if (mesh->adt) write_animdata(wd, mesh->adt);
+			}
+			else {
 
-			writedata(wd, DATA, sizeof(void *)*mesh->totcol, mesh->mat);
+#ifdef USE_BMESH_SAVE_AS_COMPAT
 
-			write_customdata(wd, &mesh->id, mesh->totvert, &mesh->vdata, -1, 0);
-			write_customdata(wd, &mesh->id, mesh->totedge, &mesh->edata, -1, 0);
-			write_customdata(wd, &mesh->id, mesh->totface, &mesh->fdata, -1, 0);
+				Mesh backup_mesh = {{0}};
+
+				/* backup */
+				backup_mesh.mpoly = mesh->mpoly;
+				mesh->mpoly = NULL;
+				/* -- */
+				backup_mesh.mface = mesh->mface;
+				mesh->mface = NULL;
+				/* -- */
+				backup_mesh.totface = mesh->totface;
+				mesh->totface = 0;
+				/* -- */
+				backup_mesh.totpoly = mesh->totpoly;
+				mesh->totpoly = 0;
+				/* -- */
+				backup_mesh.totloop = mesh->totloop;
+				mesh->totloop = 0;
+				/* -- */
+				backup_mesh.fdata = mesh->fdata;
+				memset(&mesh->fdata, 0, sizeof(CustomData));
+				/* -- */
+				backup_mesh.pdata = mesh->pdata;
+				memset(&mesh->pdata, 0, sizeof(CustomData));
+				/* -- */
+				backup_mesh.ldata = mesh->ldata;
+				memset(&mesh->ldata, 0, sizeof(CustomData));
+				/* -- */
+				backup_mesh.edit_btmesh = mesh->edit_btmesh;
+				mesh->edit_btmesh = NULL;
+				/* backup */
+
+
+				/* now fill in polys to mfaces*/
+				mesh->totface= mesh_mpoly_to_mface(&mesh->fdata, &backup_mesh.ldata, &backup_mesh.pdata,
+				                                   mesh->totface, backup_mesh.totloop, backup_mesh.totpoly);
+
+				mesh_update_customdata_pointers(mesh, FALSE);
+
+				writestruct(wd, ID_ME, "Mesh", 1, mesh);
+
+				/* direct data */
+				if (mesh->id.properties) IDP_WriteProperty(mesh->id.properties, wd);
+				if (mesh->adt) write_animdata(wd, mesh->adt);
+
+				writedata(wd, DATA, sizeof(void *)*mesh->totcol, mesh->mat);
+				/* writedata(wd, DATA, sizeof(MSelect) * mesh->totselect, mesh->mselect); */ /* pre-bmesh NULL's */
+
+				write_customdata(wd, &mesh->id, mesh->totvert, &mesh->vdata, -1, 0);
+				write_customdata(wd, &mesh->id, mesh->totedge, &mesh->edata, -1, 0);
+				write_customdata(wd, &mesh->id, mesh->totface, &mesh->fdata, -1, 0);
+				/* harmless for older blender versioins but _not_ writing these keeps file size down */
+#if 0
+				write_customdata(wd, &mesh->id, mesh->totloop, &mesh->ldata, -1, 0);
+				write_customdata(wd, &mesh->id, mesh->totpoly, &mesh->pdata, -1, 0);
+#endif
+
+				/* restore */
+				mesh->mpoly = backup_mesh.mpoly;
+				/* -- */
+				mesh->mface = backup_mesh.mface;
+				/* -- */
+				CustomData_free(&mesh->fdata, mesh->totface);
+				/* -- */
+				mesh->fdata= backup_mesh.fdata;
+				/* -- */
+				mesh->pdata= backup_mesh.pdata;
+				/* -- */
+				mesh->ldata= backup_mesh.ldata;
+				/* -- */
+				mesh->totface = backup_mesh.totface;
+				mesh->totpoly = backup_mesh.totpoly;
+				mesh->totloop = backup_mesh.totloop;
+				/* -- */
+				mesh_update_customdata_pointers(mesh, FALSE);
+				/* --*/
+				mesh->edit_btmesh = backup_mesh.edit_btmesh; /* keep this after updating custom pointers */
+				/* restore */
+
+#endif /* USE_BMESH_SAVE_AS_COMPAT */
+			}
 		}
 		mesh= mesh->id.next;
 	}
@@ -1711,8 +1845,8 @@ static void write_lattices(WriteData *wd, ListBase *idbase)
 	Lattice *lt;
 	
 	lt= idbase->first;
-	while(lt) {
-		if(lt->id.us>0 || wd->current) {
+	while (lt) {
+		if (lt->id.us>0 || wd->current) {
 			/* write LibData */
 			writestruct(wd, ID_LT, "Lattice", 1, lt);
 			if (lt->id.properties) IDP_WriteProperty(lt->id.properties, wd);
@@ -1737,7 +1871,7 @@ static void write_previews(WriteData *wd, PreviewImage *prv)
 		short h = prv->h[1];
 		unsigned int *rect = prv->rect[1];
 		/* don't write out large previews if not requested */
-		if (!(U.flag & USER_SAVE_PREVIEWS) ) {
+		if (!(U.flag & USER_SAVE_PREVIEWS)) {
 			prv->w[1] = 0;
 			prv->h[1] = 0;
 			prv->rect[1] = NULL;
@@ -1762,8 +1896,8 @@ static void write_images(WriteData *wd, ListBase *idbase)
 
 
 	ima= idbase->first;
-	while(ima) {
-		if(ima->id.us>0 || wd->current) {
+	while (ima) {
+		if (ima->id.us>0 || wd->current) {
 			/* write LibData */
 			writestruct(wd, ID_IM, "Image", 1, ima);
 			if (ima->id.properties) IDP_WriteProperty(ima->id.properties, wd);
@@ -1787,8 +1921,8 @@ static void write_textures(WriteData *wd, ListBase *idbase)
 	Tex *tex;
 
 	tex= idbase->first;
-	while(tex) {
-		if(tex->id.us>0 || wd->current) {
+	while (tex) {
+		if (tex->id.us>0 || wd->current) {
 			/* write LibData */
 			writestruct(wd, ID_TE, "Tex", 1, tex);
 			if (tex->id.properties) IDP_WriteProperty(tex->id.properties, wd);
@@ -1796,19 +1930,19 @@ static void write_textures(WriteData *wd, ListBase *idbase)
 			if (tex->adt) write_animdata(wd, tex->adt);
 
 			/* direct data */
-			if(tex->type == TEX_PLUGIN && tex->plugin) writestruct(wd, DATA, "PluginTex", 1, tex->plugin);
-			if(tex->coba) writestruct(wd, DATA, "ColorBand", 1, tex->coba);
-			if(tex->type == TEX_ENVMAP && tex->env) writestruct(wd, DATA, "EnvMap", 1, tex->env);
-			if(tex->type == TEX_POINTDENSITY && tex->pd) {
+			if (tex->type == TEX_PLUGIN && tex->plugin) writestruct(wd, DATA, "PluginTex", 1, tex->plugin);
+			if (tex->coba) writestruct(wd, DATA, "ColorBand", 1, tex->coba);
+			if (tex->type == TEX_ENVMAP && tex->env) writestruct(wd, DATA, "EnvMap", 1, tex->env);
+			if (tex->type == TEX_POINTDENSITY && tex->pd) {
 				writestruct(wd, DATA, "PointDensity", 1, tex->pd);
-				if(tex->pd->coba) writestruct(wd, DATA, "ColorBand", 1, tex->pd->coba);
-				if(tex->pd->falloff_curve) write_curvemapping(wd, tex->pd->falloff_curve);
+				if (tex->pd->coba) writestruct(wd, DATA, "ColorBand", 1, tex->pd->coba);
+				if (tex->pd->falloff_curve) write_curvemapping(wd, tex->pd->falloff_curve);
 			}
-			if(tex->type == TEX_VOXELDATA) writestruct(wd, DATA, "VoxelData", 1, tex->vd);
-			if(tex->type == TEX_OCEAN && tex->ot) writestruct(wd, DATA, "OceanTex", 1, tex->ot);
+			if (tex->type == TEX_VOXELDATA) writestruct(wd, DATA, "VoxelData", 1, tex->vd);
+			if (tex->type == TEX_OCEAN && tex->ot) writestruct(wd, DATA, "OceanTex", 1, tex->ot);
 			
 			/* nodetree is integral part of texture, no libdata */
-			if(tex->nodetree) {
+			if (tex->nodetree) {
 				writestruct(wd, DATA, "bNodeTree", 1, tex->nodetree);
 				write_nodetree(wd, tex->nodetree);
 			}
@@ -1828,28 +1962,28 @@ static void write_materials(WriteData *wd, ListBase *idbase)
 	int a;
 
 	ma= idbase->first;
-	while(ma) {
-		if(ma->id.us>0 || wd->current) {
+	while (ma) {
+		if (ma->id.us>0 || wd->current) {
 			/* write LibData */
 			writestruct(wd, ID_MA, "Material", 1, ma);
 			
-			/*Write ID Properties -- and copy this comment EXACTLY for easy finding
-			  of library blocks that implement this.*/
-			/*manually set head group property to IDP_GROUP, just in case it hadn't been
-			  set yet :) */
+			/* Write ID Properties -- and copy this comment EXACTLY for easy finding
+			 * of library blocks that implement this.*/
+			/* manually set head group property to IDP_GROUP, just in case it hadn't been
+			 * set yet :) */
 			if (ma->id.properties) IDP_WriteProperty(ma->id.properties, wd);
 			
 			if (ma->adt) write_animdata(wd, ma->adt);
 
-			for(a=0; a<MAX_MTEX; a++) {
-				if(ma->mtex[a]) writestruct(wd, DATA, "MTex", 1, ma->mtex[a]);
+			for (a=0; a<MAX_MTEX; a++) {
+				if (ma->mtex[a]) writestruct(wd, DATA, "MTex", 1, ma->mtex[a]);
 			}
 			
-			if(ma->ramp_col) writestruct(wd, DATA, "ColorBand", 1, ma->ramp_col);
-			if(ma->ramp_spec) writestruct(wd, DATA, "ColorBand", 1, ma->ramp_spec);
+			if (ma->ramp_col) writestruct(wd, DATA, "ColorBand", 1, ma->ramp_col);
+			if (ma->ramp_spec) writestruct(wd, DATA, "ColorBand", 1, ma->ramp_spec);
 			
 			/* nodetree is integral part of material, no libdata */
-			if(ma->nodetree) {
+			if (ma->nodetree) {
 				writestruct(wd, DATA, "bNodeTree", 1, ma->nodetree);
 				write_nodetree(wd, ma->nodetree);
 			}
@@ -1866,20 +2000,20 @@ static void write_worlds(WriteData *wd, ListBase *idbase)
 	int a;
 
 	wrld= idbase->first;
-	while(wrld) {
-		if(wrld->id.us>0 || wd->current) {
+	while (wrld) {
+		if (wrld->id.us>0 || wd->current) {
 			/* write LibData */
 			writestruct(wd, ID_WO, "World", 1, wrld);
 			if (wrld->id.properties) IDP_WriteProperty(wrld->id.properties, wd);
 			
 			if (wrld->adt) write_animdata(wd, wrld->adt);
 			
-			for(a=0; a<MAX_MTEX; a++) {
-				if(wrld->mtex[a]) writestruct(wd, DATA, "MTex", 1, wrld->mtex[a]);
+			for (a=0; a<MAX_MTEX; a++) {
+				if (wrld->mtex[a]) writestruct(wd, DATA, "MTex", 1, wrld->mtex[a]);
 			}
 
 			/* nodetree is integral part of lamps, no libdata */
-			if(wrld->nodetree) {
+			if (wrld->nodetree) {
 				writestruct(wd, DATA, "bNodeTree", 1, wrld->nodetree);
 				write_nodetree(wd, wrld->nodetree);
 			}
@@ -1896,8 +2030,8 @@ static void write_lamps(WriteData *wd, ListBase *idbase)
 	int a;
 
 	la= idbase->first;
-	while(la) {
-		if(la->id.us>0 || wd->current) {
+	while (la) {
+		if (la->id.us>0 || wd->current) {
 			/* write LibData */
 			writestruct(wd, ID_LA, "Lamp", 1, la);
 			if (la->id.properties) IDP_WriteProperty(la->id.properties, wd);
@@ -1905,15 +2039,15 @@ static void write_lamps(WriteData *wd, ListBase *idbase)
 			if (la->adt) write_animdata(wd, la->adt);
 			
 			/* direct data */
-			for(a=0; a<MAX_MTEX; a++) {
-				if(la->mtex[a]) writestruct(wd, DATA, "MTex", 1, la->mtex[a]);
+			for (a=0; a<MAX_MTEX; a++) {
+				if (la->mtex[a]) writestruct(wd, DATA, "MTex", 1, la->mtex[a]);
 			}
 			
-			if(la->curfalloff)
+			if (la->curfalloff)
 				write_curvemapping(wd, la->curfalloff);	
 			
 			/* nodetree is integral part of lamps, no libdata */
-			if(la->nodetree) {
+			if (la->nodetree) {
 				writestruct(wd, DATA, "bNodeTree", 1, la->nodetree);
 				write_nodetree(wd, la->nodetree);
 			}
@@ -1940,7 +2074,7 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
 	ToolSettings *tos;
 	
 	sce= scebase->first;
-	while(sce) {
+	while (sce) {
 		/* write LibData */
 		writestruct(wd, ID_SCE, "Scene", 1, sce);
 		if (sce->id.properties) IDP_WriteProperty(sce->id.properties, wd);
@@ -1950,47 +2084,47 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
 		
 		/* direct data */
 		base= sce->base.first;
-		while(base) {
+		while (base) {
 			writestruct(wd, DATA, "Base", 1, base);
 			base= base->next;
 		}
 		
 		tos = sce->toolsettings;
 		writestruct(wd, DATA, "ToolSettings", 1, tos);
-		if(tos->vpaint) {
+		if (tos->vpaint) {
 			writestruct(wd, DATA, "VPaint", 1, tos->vpaint);
 		}
-		if(tos->wpaint) {
+		if (tos->wpaint) {
 			writestruct(wd, DATA, "VPaint", 1, tos->wpaint);
 		}
-		if(tos->sculpt) {
+		if (tos->sculpt) {
 			writestruct(wd, DATA, "Sculpt", 1, tos->sculpt);
 		}
-		if(tos->uvsculpt) {
+		if (tos->uvsculpt) {
 			writestruct(wd, DATA, "UvSculpt", 1, tos->uvsculpt);
 		}
 
 		// write_paint(wd, &tos->imapaint.paint);
 
 		ed= sce->ed;
-		if(ed) {
+		if (ed) {
 			writestruct(wd, DATA, "Editing", 1, ed);
 			
 			/* reset write flags too */
 			
 			SEQ_BEGIN(ed, seq) {
-				if(seq->strip) seq->strip->done= 0;
+				if (seq->strip) seq->strip->done= 0;
 				writestruct(wd, DATA, "Sequence", 1, seq);
 			}
 			SEQ_END
 			
 			SEQ_BEGIN(ed, seq) {
-				if(seq->strip && seq->strip->done==0) {
+				if (seq->strip && seq->strip->done==0) {
 					/* write strip with 'done' at 0 because readfile */
 					
-					if(seq->plugin) writestruct(wd, DATA, "PluginSeq", 1, seq->plugin);
-					if(seq->effectdata) {
-						switch(seq->type){
+					if (seq->plugin) writestruct(wd, DATA, "PluginSeq", 1, seq->plugin);
+					if (seq->effectdata) {
+						switch(seq->type) {
 						case SEQ_COLOR:
 							writestruct(wd, DATA, "SolidColorVars", 1, seq->effectdata);
 							break;
@@ -2011,21 +2145,21 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
 					
 					strip= seq->strip;
 					writestruct(wd, DATA, "Strip", 1, strip);
-					if(seq->flag & SEQ_USE_CROP && strip->crop) {
+					if (seq->flag & SEQ_USE_CROP && strip->crop) {
 						writestruct(wd, DATA, "StripCrop", 1, strip->crop);
 					}
-					if(seq->flag & SEQ_USE_TRANSFORM && strip->transform) {
+					if (seq->flag & SEQ_USE_TRANSFORM && strip->transform) {
 						writestruct(wd, DATA, "StripTransform", 1, strip->transform);
 					}
-					if(seq->flag & SEQ_USE_PROXY && strip->proxy) {
+					if (seq->flag & SEQ_USE_PROXY && strip->proxy) {
 						writestruct(wd, DATA, "StripProxy", 1, strip->proxy);
 					}
-					if(seq->flag & SEQ_USE_COLOR_BALANCE && strip->color_balance) {
+					if (seq->flag & SEQ_USE_COLOR_BALANCE && strip->color_balance) {
 						writestruct(wd, DATA, "StripColorBalance", 1, strip->color_balance);
 					}
-					if(seq->type==SEQ_IMAGE)
+					if (seq->type==SEQ_IMAGE)
 						writestruct(wd, DATA, "StripElem", MEM_allocN_len(strip->stripdata) / sizeof(struct StripElem), strip->stripdata);
-					else if(seq->type==SEQ_MOVIE || seq->type==SEQ_RAM_SOUND || seq->type == SEQ_HD_SOUND)
+					else if (seq->type==SEQ_MOVIE || seq->type==SEQ_RAM_SOUND || seq->type == SEQ_HD_SOUND)
 						writestruct(wd, DATA, "StripElem", 1, strip->stripdata);
 					
 					strip->done= 1;
@@ -2034,7 +2168,7 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
 			SEQ_END
 				
 			/* new; meta stack too, even when its nasty restore code */
-			for(ms= ed->metastack.first; ms; ms= ms->next) {
+			for (ms= ed->metastack.first; ms; ms= ms->next) {
 				writestruct(wd, DATA, "MetaStack", 1, ms);
 			}
 		}
@@ -2054,17 +2188,17 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
 		}
 
 		/* writing dynamic list of TimeMarkers to the blend file */
-		for(marker= sce->markers.first; marker; marker= marker->next)
+		for (marker= sce->markers.first; marker; marker= marker->next)
 			writestruct(wd, DATA, "TimeMarker", 1, marker);
 		
 		/* writing dynamic list of TransformOrientations to the blend file */
-		for(ts = sce->transform_spaces.first; ts; ts = ts->next)
+		for (ts = sce->transform_spaces.first; ts; ts = ts->next)
 			writestruct(wd, DATA, "TransformOrientation", 1, ts);
 		
-		for(srl= sce->r.layers.first; srl; srl= srl->next)
+		for (srl= sce->r.layers.first; srl; srl= srl->next)
 			writestruct(wd, DATA, "SceneRenderLayer", 1, srl);
 		
-		if(sce->nodetree) {
+		if (sce->nodetree) {
 			writestruct(wd, DATA, "bNodeTree", 1, sce->nodetree);
 			write_nodetree(wd, sce->nodetree);
 		}
@@ -2111,10 +2245,10 @@ static void write_windowmanagers(WriteData *wd, ListBase *lb)
 	wmWindowManager *wm;
 	wmWindow *win;
 	
-	for(wm= lb->first; wm; wm= wm->id.next) {
+	for (wm= lb->first; wm; wm= wm->id.next) {
 		writestruct(wd, ID_WM, "wmWindowManager", 1, wm);
 		
-		for(win= wm->windows.first; win; win= win->next)
+		for (win= wm->windows.first; win; win= win->next)
 			writestruct(wd, DATA, "wmWindow", 1, win);
 	}
 }
@@ -2123,16 +2257,16 @@ static void write_region(WriteData *wd, ARegion *ar, int spacetype)
 {	
 	writestruct(wd, DATA, "ARegion", 1, ar);
 	
-	if(ar->regiondata) {
+	if (ar->regiondata) {
 		switch(spacetype) {
 			case SPACE_VIEW3D:
-				if(ar->regiontype==RGN_TYPE_WINDOW) {
+				if (ar->regiontype==RGN_TYPE_WINDOW) {
 					RegionView3D *rv3d= ar->regiondata;
 					writestruct(wd, DATA, "RegionView3D", 1, rv3d);
 					
-					if(rv3d->localvd)
+					if (rv3d->localvd)
 						writestruct(wd, DATA, "RegionView3D", 1, rv3d->localvd);
-					if(rv3d->clipbb) 
+					if (rv3d->clipbb)
 						writestruct(wd, DATA, "BoundBox", 1, rv3d->clipbb);
 
 				}
@@ -2153,7 +2287,7 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
 	ScrEdge *se;
 
 	sc= scrbase->first;
-	while(sc) {
+	while (sc) {
 		
 		/* write LibData */
 		/* in 2.50+ files, the file identifier for screens is patched, forward compatibility */
@@ -2162,40 +2296,40 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
 			IDP_WriteProperty(sc->id.properties, wd);
 		
 		/* direct data */
-		for(sv= sc->vertbase.first; sv; sv= sv->next)
+		for (sv= sc->vertbase.first; sv; sv= sv->next)
 			writestruct(wd, DATA, "ScrVert", 1, sv);
 		
-		for(se= sc->edgebase.first; se; se= se->next) 
+		for (se= sc->edgebase.first; se; se= se->next)
 			writestruct(wd, DATA, "ScrEdge", 1, se);
 		
-		for(sa= sc->areabase.first; sa; sa= sa->next) {
+		for (sa= sc->areabase.first; sa; sa= sa->next) {
 			SpaceLink *sl;
 			Panel *pa;
 			ARegion *ar;
 			
 			writestruct(wd, DATA, "ScrArea", 1, sa);
 			
-			for(ar= sa->regionbase.first; ar; ar= ar->next) {
+			for (ar= sa->regionbase.first; ar; ar= ar->next) {
 				write_region(wd, ar, sa->spacetype);
 				
-				for(pa= ar->panels.first; pa; pa= pa->next)
+				for (pa= ar->panels.first; pa; pa= pa->next)
 					writestruct(wd, DATA, "Panel", 1, pa);
 			}
 			
 			sl= sa->spacedata.first;
-			while(sl) {
-				for(ar= sl->regionbase.first; ar; ar= ar->next)
+			while (sl) {
+				for (ar= sl->regionbase.first; ar; ar= ar->next)
 					write_region(wd, ar, sl->spacetype);
 				
-				if(sl->spacetype==SPACE_VIEW3D) {
+				if (sl->spacetype==SPACE_VIEW3D) {
 					View3D *v3d= (View3D *) sl;
 					BGpic *bgpic;
 					writestruct(wd, DATA, "View3D", 1, v3d);
 					for (bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next)
 						writestruct(wd, DATA, "BGpic", 1, bgpic);
-					if(v3d->localvd) writestruct(wd, DATA, "View3D", 1, v3d->localvd);
+					if (v3d->localvd) writestruct(wd, DATA, "View3D", 1, v3d->localvd);
 				}
-				else if(sl->spacetype==SPACE_IPO) {
+				else if (sl->spacetype==SPACE_IPO) {
 					SpaceIpo *sipo= (SpaceIpo *)sl;
 					ListBase tmpGhosts = sipo->ghostCurves;
 					
@@ -2203,70 +2337,70 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
 					sipo->ghostCurves.first= sipo->ghostCurves.last= NULL;
 					
 					writestruct(wd, DATA, "SpaceIpo", 1, sl);
-					if(sipo->ads) writestruct(wd, DATA, "bDopeSheet", 1, sipo->ads);
+					if (sipo->ads) writestruct(wd, DATA, "bDopeSheet", 1, sipo->ads);
 					
 					/* reenable ghost curves */
 					sipo->ghostCurves= tmpGhosts;
 				}
-				else if(sl->spacetype==SPACE_BUTS) {
+				else if (sl->spacetype==SPACE_BUTS) {
 					writestruct(wd, DATA, "SpaceButs", 1, sl);
 				}
-				else if(sl->spacetype==SPACE_FILE) {
+				else if (sl->spacetype==SPACE_FILE) {
 					SpaceFile *sfile= (SpaceFile *)sl;
 
 					writestruct(wd, DATA, "SpaceFile", 1, sl);
-					if(sfile->params)
+					if (sfile->params)
 						writestruct(wd, DATA, "FileSelectParams", 1, sfile->params);
 				}
-				else if(sl->spacetype==SPACE_SEQ) {
+				else if (sl->spacetype==SPACE_SEQ) {
 					writestruct(wd, DATA, "SpaceSeq", 1, sl);
 				}
-				else if(sl->spacetype==SPACE_OUTLINER) {
+				else if (sl->spacetype==SPACE_OUTLINER) {
 					SpaceOops *so= (SpaceOops *)sl;
 					
 					writestruct(wd, DATA, "SpaceOops", 1, so);
 
 					/* outliner */
-					if(so->treestore) {
+					if (so->treestore) {
 						writestruct(wd, DATA, "TreeStore", 1, so->treestore);
-						if(so->treestore->data)
+						if (so->treestore->data)
 							writestruct(wd, DATA, "TreeStoreElem", so->treestore->usedelem, so->treestore->data);
 					}
 				}
-				else if(sl->spacetype==SPACE_IMAGE) {
+				else if (sl->spacetype==SPACE_IMAGE) {
 					SpaceImage *sima= (SpaceImage *)sl;
 					
 					writestruct(wd, DATA, "SpaceImage", 1, sl);
-					if(sima->cumap)
+					if (sima->cumap)
 						write_curvemapping(wd, sima->cumap);
 				}
-				else if(sl->spacetype==SPACE_TEXT) {
+				else if (sl->spacetype==SPACE_TEXT) {
 					writestruct(wd, DATA, "SpaceText", 1, sl);
 				}
-				else if(sl->spacetype==SPACE_SCRIPT) {
+				else if (sl->spacetype==SPACE_SCRIPT) {
 					SpaceScript *scr = (SpaceScript*)sl;
 					scr->but_refs = NULL;
 					writestruct(wd, DATA, "SpaceScript", 1, sl);
 				}
-				else if(sl->spacetype==SPACE_ACTION) {
+				else if (sl->spacetype==SPACE_ACTION) {
 					writestruct(wd, DATA, "SpaceAction", 1, sl);
 				}
-				else if(sl->spacetype==SPACE_NLA){
+				else if (sl->spacetype==SPACE_NLA) {
 					SpaceNla *snla= (SpaceNla *)sl;
 					
 					writestruct(wd, DATA, "SpaceNla", 1, snla);
-					if(snla->ads) writestruct(wd, DATA, "bDopeSheet", 1, snla->ads);
+					if (snla->ads) writestruct(wd, DATA, "bDopeSheet", 1, snla->ads);
 				}
-				else if(sl->spacetype==SPACE_TIME){
+				else if (sl->spacetype==SPACE_TIME) {
 					writestruct(wd, DATA, "SpaceTime", 1, sl);
 				}
-				else if(sl->spacetype==SPACE_NODE){
+				else if (sl->spacetype==SPACE_NODE) {
 					writestruct(wd, DATA, "SpaceNode", 1, sl);
 				}
-				else if(sl->spacetype==SPACE_LOGIC){
+				else if (sl->spacetype==SPACE_LOGIC) {
 					writestruct(wd, DATA, "SpaceLogic", 1, sl);
 				}
-				else if(sl->spacetype==SPACE_CONSOLE) {
+				else if (sl->spacetype==SPACE_CONSOLE) {
 					SpaceConsole *con = (SpaceConsole*)sl;
 					ConsoleLine *cl;
 
@@ -2278,10 +2412,10 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
 					writestruct(wd, DATA, "SpaceConsole", 1, sl);
 
 				}
-				else if(sl->spacetype==SPACE_USERPREF) {
+				else if (sl->spacetype==SPACE_USERPREF) {
 					writestruct(wd, DATA, "SpaceUserPref", 1, sl);
 				}
-				else if(sl->spacetype==SPACE_CLIP) {
+				else if (sl->spacetype==SPACE_CLIP) {
 					writestruct(wd, DATA, "SpaceClip", 1, sl);
 				}
 
@@ -2299,28 +2433,28 @@ static void write_libraries(WriteData *wd, Main *main)
 	ID *id;
 	int a, tot, foundone;
 
-	for(; main; main= main->next) {
+	for (; main; main= main->next) {
 
 		a=tot= set_listbasepointers(main, lbarray);
 
 		/* test: is lib being used */
 		foundone= 0;
-		while(tot--) {
-			for(id= lbarray[tot]->first; id; id= id->next) {
-				if(id->us>0 && (id->flag & LIB_EXTERN)) {
+		while (tot--) {
+			for (id= lbarray[tot]->first; id; id= id->next) {
+				if (id->us>0 && (id->flag & LIB_EXTERN)) {
 					foundone= 1;
 					break;
 				}
 			}
-			if(foundone) break;
+			if (foundone) break;
 		}
 
-		if(foundone) {
+		if (foundone) {
 			writestruct(wd, ID_LI, "Library", 1, main->curlib);
 
-			while(a--) {
-				for(id= lbarray[a]->first; id; id= id->next) {
-					if(id->us>0 && (id->flag & LIB_EXTERN)) {
+			while (a--) {
+				for (id= lbarray[a]->first; id; id= id->next) {
+					if (id->us>0 && (id->flag & LIB_EXTERN)) {
 						writestruct(wd, ID_ID, "ID", 1, id);
 					}
 				}
@@ -2340,13 +2474,13 @@ static void write_bone(WriteData *wd, Bone* bone)
 	writestruct(wd, DATA, "Bone", 1, bone);
 
 	/* Write ID Properties -- and copy this comment EXACTLY for easy finding
-	 of library blocks that implement this.*/
+	 * of library blocks that implement this.*/
 	if (bone->prop)
 		IDP_WriteProperty(bone->prop, wd);
 	
 	// Write Children
 	cbone= bone->childbase.first;
-	while(cbone) {
+	while (cbone) {
 		write_bone(wd, cbone);
 		cbone= cbone->next;
 	}
@@ -2367,7 +2501,7 @@ static void write_armatures(WriteData *wd, ListBase *idbase)
 
 			/* Direct data */
 			bone= arm->bonebase.first;
-			while(bone) {
+			while (bone) {
 				write_bone(wd, bone);
 				bone=bone->next;
 			}
@@ -2386,15 +2520,15 @@ static void write_texts(WriteData *wd, ListBase *idbase)
 	TextMarker *mrk;
 
 	text= idbase->first;
-	while(text) {
+	while (text) {
 		if ( (text->flags & TXT_ISMEM) && (text->flags & TXT_ISEXT)) text->flags &= ~TXT_ISEXT;
 
 		/* write LibData */
 		writestruct(wd, ID_TXT, "Text", 1, text);
-		if(text->name) writedata(wd, DATA, strlen(text->name)+1, text->name);
+		if (text->name) writedata(wd, DATA, strlen(text->name)+1, text->name);
 		if (text->id.properties) IDP_WriteProperty(text->id.properties, wd);
 
-		if(!(text->flags & TXT_ISEXT)) {
+		if (!(text->flags & TXT_ISEXT)) {
 			/* now write the text data, in two steps for optimization in the readfunction */
 			tmp= text->lines.first;
 			while (tmp) {
@@ -2429,8 +2563,8 @@ static void write_speakers(WriteData *wd, ListBase *idbase)
 	Speaker *spk;
 
 	spk= idbase->first;
-	while(spk) {
-		if(spk->id.us>0 || wd->current) {
+	while (spk) {
+		if (spk->id.us>0 || wd->current) {
 			/* write LibData */
 			writestruct(wd, ID_SPK, "Speaker", 1, spk);
 			if (spk->id.properties) IDP_WriteProperty(spk->id.properties, wd);
@@ -2448,8 +2582,8 @@ static void write_sounds(WriteData *wd, ListBase *idbase)
 	PackedFile * pf;
 
 	sound= idbase->first;
-	while(sound) {
-		if(sound->id.us>0 || wd->current) {
+	while (sound) {
+		if (sound->id.us>0 || wd->current) {
 			/* write LibData */
 			writestruct(wd, ID_SO, "bSound", 1, sound);
 			if (sound->id.properties) IDP_WriteProperty(sound->id.properties, wd);
@@ -2472,14 +2606,14 @@ static void write_groups(WriteData *wd, ListBase *idbase)
 	Group *group;
 	GroupObject *go;
 
-	for(group= idbase->first; group; group= group->id.next) {
-		if(group->id.us>0 || wd->current) {
+	for (group= idbase->first; group; group= group->id.next) {
+		if (group->id.us>0 || wd->current) {
 			/* write LibData */
 			writestruct(wd, ID_GR, "Group", 1, group);
 			if (group->id.properties) IDP_WriteProperty(group->id.properties, wd);
 
 			go= group->gobject.first;
-			while(go) {
+			while (go) {
 				writestruct(wd, DATA, "GroupObject", 1, go);
 				go= go->next;
 			}
@@ -2491,7 +2625,7 @@ static void write_nodetrees(WriteData *wd, ListBase *idbase)
 {
 	bNodeTree *ntree;
 	
-	for(ntree=idbase->first; ntree; ntree= ntree->id.next) {
+	for (ntree=idbase->first; ntree; ntree= ntree->id.next) {
 		if (ntree->id.us>0 || wd->current) {
 			writestruct(wd, ID_NT, "bNodeTree", 1, ntree);
 			write_nodetree(wd, ntree);
@@ -2507,14 +2641,14 @@ static void write_brushes(WriteData *wd, ListBase *idbase)
 {
 	Brush *brush;
 	
-	for(brush=idbase->first; brush; brush= brush->id.next) {
-		if(brush->id.us>0 || wd->current) {
+	for (brush=idbase->first; brush; brush= brush->id.next) {
+		if (brush->id.us>0 || wd->current) {
 			writestruct(wd, ID_BR, "Brush", 1, brush);
 			if (brush->id.properties) IDP_WriteProperty(brush->id.properties, wd);
 			
 			writestruct(wd, DATA, "MTex", 1, &brush->mtex);
 			
-			if(brush->curve)
+			if (brush->curve)
 				write_curvemapping(wd, brush->curve);
 		}
 	}
@@ -2524,8 +2658,8 @@ static void write_scripts(WriteData *wd, ListBase *idbase)
 {
 	Script *script;
 	
-	for(script=idbase->first; script; script= script->id.next) {
-		if(script->id.us>0 || wd->current) {
+	for (script=idbase->first; script; script= script->id.next) {
+		if (script->id.us>0 || wd->current) {
 			writestruct(wd, ID_SCRIPT, "Script", 1, script);
 			if (script->id.properties) IDP_WriteProperty(script->id.properties, wd);
 		}
@@ -2537,10 +2671,10 @@ static void write_movieTracks(WriteData *wd, ListBase *tracks)
 	MovieTrackingTrack *track;
 
 	track= tracks->first;
-	while(track) {
+	while (track) {
 		writestruct(wd, DATA, "MovieTrackingTrack", 1, track);
 
-		if(track->markers)
+		if (track->markers)
 			writestruct(wd, DATA, "MovieTrackingMarker", track->markersnr, track->markers);
 
 		track= track->next;
@@ -2549,7 +2683,7 @@ static void write_movieTracks(WriteData *wd, ListBase *tracks)
 
 static void write_movieReconstruction(WriteData *wd, MovieTrackingReconstruction *reconstruction)
 {
-	if(reconstruction->camnr)
+	if (reconstruction->camnr)
 		writestruct(wd, DATA, "MovieReconstructedCamera", reconstruction->camnr, reconstruction->cameras);
 }
 
@@ -2558,17 +2692,20 @@ static void write_movieclips(WriteData *wd, ListBase *idbase)
 	MovieClip *clip;
 
 	clip= idbase->first;
-	while(clip) {
-		if(clip->id.us>0 || wd->current) {
+	while (clip) {
+		if (clip->id.us>0 || wd->current) {
 			MovieTracking *tracking= &clip->tracking;
 			MovieTrackingObject *object;
 			writestruct(wd, ID_MC, "MovieClip", 1, clip);
 
+			if (clip->adt)
+				write_animdata(wd, clip->adt);
+
 			write_movieTracks(wd, &tracking->tracks);
 			write_movieReconstruction(wd, &tracking->reconstruction);
 
 			object= tracking->objects.first;
-			while(object) {
+			while (object) {
 				writestruct(wd, DATA, "MovieTrackingObject", 1, object);
 
 				write_movieTracks(wd, &object->tracks);
@@ -2633,15 +2770,15 @@ static void write_global(WriteData *wd, int fileflags, Main *mainvar)
  * second are an RGBA image (unsigned char)
  * note, this uses 'TEST' since new types will segfault on file load for older blender versions.
  */
-static void write_thumb(WriteData *wd, int *img)
+static void write_thumb(WriteData *wd, const int *img)
 {
-	if(img)
+	if (img)
 		writedata(wd, TEST, (2 + img[0] * img[1]) * sizeof(int), img);
 }
 
 /* if MemFile * there's filesave to memory */
 static int write_file_handle(Main *mainvar, int handle, MemFile *compare, MemFile *current, 
-							 int write_user_block, int write_flags, int *thumb)
+                             int write_user_block, int write_flags, const int *thumb)
 {
 	BHead bhead;
 	ListBase mainlist;
@@ -2664,7 +2801,7 @@ static int write_file_handle(Main *mainvar, int handle, MemFile *compare, MemFil
 	write_global(wd, write_flags, mainvar);
 
 	/* no UI save in undo */
-	if(current==NULL) {
+	if (current==NULL) {
 		write_windowmanagers(wd, &mainvar->wm);
 		write_screens  (wd, &mainvar->screen);
 	}
@@ -2720,17 +2857,17 @@ static int do_history(const char *name, ReportList *reports)
 	char tempname1[FILE_MAX], tempname2[FILE_MAX];
 	int hisnr= U.versions;
 	
-	if(U.versions==0) return 0;
-	if(strlen(name)<2) {
+	if (U.versions==0) return 0;
+	if (strlen(name)<2) {
 		BKE_report(reports, RPT_ERROR, "Unable to make version backup: filename too short");
 		return 1;
 	}
 		
-	while(hisnr > 1) {
+	while (hisnr > 1) {
 		BLI_snprintf(tempname1, sizeof(tempname1), "%s%d", name, hisnr-1);
 		BLI_snprintf(tempname2, sizeof(tempname2), "%s%d", name, hisnr);
 	
-		if(BLI_rename(tempname1, tempname2)) {
+		if (BLI_rename(tempname1, tempname2)) {
 			BKE_report(reports, RPT_ERROR, "Unable to make version backup");
 			return 1;
 		}	
@@ -2740,7 +2877,7 @@ static int do_history(const char *name, ReportList *reports)
 	/* is needed when hisnr==1 */
 	BLI_snprintf(tempname1, sizeof(tempname1), "%s%d", name, hisnr);
 
-	if(BLI_rename(name, tempname1)) {
+	if (BLI_rename(name, tempname1)) {
 		BKE_report(reports, RPT_ERROR, "Unable to make version backup");
 		return 1;
 	}
@@ -2749,7 +2886,7 @@ static int do_history(const char *name, ReportList *reports)
 }
 
 /* return: success (1) */
-int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportList *reports, int *thumb)
+int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportList *reports, const int *thumb)
 {
 	char userfilename[FILE_MAX];
 	char tempname[FILE_MAX+1];
@@ -2758,32 +2895,32 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
 	/* open temporary file, so we preserve the original in case we crash */
 	BLI_snprintf(tempname, sizeof(tempname), "%s@", filepath);
 
-	file = open(tempname,O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666);
-	if(file == -1) {
+	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));
 		return 0;
 	}
 
 	/* remapping of relative paths to new file location */
-	if(write_flags & G_FILE_RELATIVE_REMAP) {
+	if (write_flags & G_FILE_RELATIVE_REMAP) {
 		char dir1[FILE_MAX];
 		char dir2[FILE_MAX];
 		BLI_split_dir_part(filepath, dir1, sizeof(dir1));
 		BLI_split_dir_part(mainvar->name, dir2, sizeof(dir2));
 
-		/* just incase there is some subtle difference */
+		/* just in case there is some subtle difference */
 		BLI_cleanup_dir(mainvar->name, dir1);
 		BLI_cleanup_dir(mainvar->name, dir2);
 
-		if(BLI_path_cmp(dir1, dir2)==0) {
+		if (BLI_path_cmp(dir1, dir2)==0) {
 			write_flags &= ~G_FILE_RELATIVE_REMAP;
 		}
 		else {
-			if(G.relbase_valid) {
+			if (G.relbase_valid) {
 				/* blend may not have been saved before. Tn this case
 				 * we should not have any relative paths, but if there
 				 * is somehow, an invalid or empty G.main->name it will
-				 * print an error, dont try make the absolute in this case. */
+				 * print an error, don't try make the absolute in this case. */
 				makeFilesAbsolute(mainvar, G.main->name, NULL);
 			}
 		}
@@ -2792,7 +2929,7 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
 	BLI_make_file_string(G.main->name, userfilename, BLI_get_folder_create(BLENDER_USER_CONFIG, NULL), BLENDER_STARTUP_FILE);
 	write_user_block= (BLI_path_cmp(filepath, userfilename) == 0);
 
-	if(write_flags & G_FILE_RELATIVE_REMAP)
+	if (write_flags & G_FILE_RELATIVE_REMAP)
 		makeFilesRelative(mainvar, filepath, NULL); /* note, making relative to something OTHER then G.main->name */
 
 	/* actual file writing */
@@ -2816,7 +2953,7 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
 		}
 	}
 
-	if(write_flags & G_FILE_COMPRESS) {
+	if (write_flags & G_FILE_COMPRESS) {
 		/* compressed files have the same ending as regular files... only from 2.4!!! */
 		char gzname[FILE_MAX+4];
 		int ret;
@@ -2825,25 +2962,25 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL
 		BLI_snprintf(gzname, sizeof(gzname), "%s at .gz", filepath);
 		ret = BLI_file_gzip(tempname, gzname);
 		
-		if(0==ret) {
+		if (0==ret) {
 			/* now rename to real file name, and delete temp @ file too */
-			if(BLI_rename(gzname, filepath) != 0) {
+			if (BLI_rename(gzname, filepath) != 0) {
 				BKE_report(reports, RPT_ERROR, "Can't change old file. File saved with @.");
 				return 0;
 			}
 
 			BLI_delete(tempname, 0, 0);
 		}
-		else if(-1==ret) {
+		else if (-1==ret) {
 			BKE_report(reports, RPT_ERROR, "Failed opening .gz file.");
 			return 0;
 		}
-		else if(-2==ret) {
+		else if (-2==ret) {
 			BKE_report(reports, RPT_ERROR, "Failed opening .blend file for compression.");
 			return 0;
 		}
 	}
-	else if(BLI_rename(tempname, filepath) != 0) {
+	else if (BLI_rename(tempname, filepath) != 0) {
 		BKE_report(reports, RPT_ERROR, "Can't change old file. File saved with @");
 		return 0;
 	}
@@ -2858,6 +2995,6 @@ int BLO_write_file_mem(Main *mainvar, MemFile *compare, MemFile *current, int wr
 
 	err= write_file_handle(mainvar, 0, compare, current, 0, write_flags, NULL);
 	
-	if(err==0) return 1;
+	if (err==0) return 1;
 	return 0;
 }
diff --git a/source/blender/blenpluginapi/SConscript b/source/blender/blenpluginapi/SConscript
index 7c7c131..fe37091 100644
--- a/source/blender/blenpluginapi/SConscript
+++ b/source/blender/blenpluginapi/SConscript
@@ -7,6 +7,8 @@ incs = '. .. #/intern/guardedalloc ../blenlib ../imbuf ../makesdna ../blenloader
 
 defs = []
 
+incs += ' ' + env["BF_PTHREADS_INC"]
+
 if env['WITH_BF_QUICKTIME']:
     defs.append('WITH_QUICKTIME')
     incs += ' ' + env['BF_QUICKTIME_INC']
@@ -15,7 +17,7 @@ if env['OURPLATFORM'] == 'linux':
     cflags='-pthread'
     incs += ' ../../../extern/binreloc/include'
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
 
 env.BlenderLib ( libname = 'bf_blenpluginapi', sources = sources, includes = Split(incs), defines = defs, libtype=['core'], priority = [170] )
diff --git a/source/blender/blenpluginapi/documentation.h b/source/blender/blenpluginapi/documentation.h
index 45e9ec7..3e4aa3c 100644
--- a/source/blender/blenpluginapi/documentation.h
+++ b/source/blender/blenpluginapi/documentation.h
@@ -27,13 +27,13 @@
  * @mainpage plugin API - the access point for texture and sequence
  * plugins
  *
- * @section about About the plugin API
+ * \section about About the plugin API
  *
  * This API wraps functions that are used by texture and sequence
  * plugins. They are explicitly wrapped in order to make the
  * dependencies to the rest of the system clear.
  *
- * @section issues Known issues with the plugin API
+ * \section issues Known issues with the plugin API
  *
  * - It can be difficult at times to get access to the API functions
  * linked into the final executable. On gcc, the -fpic and -shared
@@ -59,7 +59,7 @@
  * code. It will be removed as soon as the replacing system is in
  * place.
  * 
- * @section dependencies Dependencies
+ * \section dependencies Dependencies
  *
  * The plugins wraps functions from IMB and BLI. In addition, they
  * define some useful variables.
diff --git a/source/blender/blenpluginapi/externdef.h b/source/blender/blenpluginapi/externdef.h
index 28239d1..fbd81a8 100644
--- a/source/blender/blenpluginapi/externdef.h
+++ b/source/blender/blenpluginapi/externdef.h
@@ -30,8 +30,8 @@
  * SUCH DAMAGE.
  */
 
-#ifndef _EXTERNDEF_H
-#define _EXTERNDEF_H
+#ifndef __EXTERNDEF_H__
+#define __EXTERNDEF_H__
 
 #ifdef WIN32
  #ifdef PLUGIN_INTERN
@@ -46,4 +46,4 @@
 	#define LIBIMPORT extern
 #endif
 
-#endif /* _EXTERNDEF_H */
+#endif /* __EXTERNDEF_H__ */
diff --git a/source/blender/blenpluginapi/floatpatch.h b/source/blender/blenpluginapi/floatpatch.h
index 73fe35c..4c9b98d 100644
--- a/source/blender/blenpluginapi/floatpatch.h
+++ b/source/blender/blenpluginapi/floatpatch.h
@@ -30,8 +30,8 @@
  * SUCH DAMAGE.
  */
 
-#ifndef FLOATPATCH_H
-#define FLOATPATCH_H
+#ifndef __FLOATPATCH_H__
+#define __FLOATPATCH_H__
 
 /* floating point libs differ at systems... with these defines it comilies at all! */
 
@@ -88,5 +88,5 @@
 
 #endif
 
-#endif /* FLOATPATCH_H */
+#endif /* __FLOATPATCH_H__ */
 
diff --git a/source/blender/blenpluginapi/iff.h b/source/blender/blenpluginapi/iff.h
index f07e80b..450dfc7 100644
--- a/source/blender/blenpluginapi/iff.h
+++ b/source/blender/blenpluginapi/iff.h
@@ -30,8 +30,8 @@
  * SUCH DAMAGE.
  */
 
-#ifndef IFF_H
-#define IFF_H
+#ifndef __IFF_H__
+#define __IFF_H__
 
 #include <sys/types.h>
 #include "util.h"
@@ -57,9 +57,9 @@ typedef struct ImBuf {
 	unsigned int   encodedsize;       /**< Size of data written to encodedbuffer */
 	unsigned int   encodedbuffersize; /**< Size of encodedbuffer */
 
-	float *rect_float;		/**< floating point Rect equivalent
-								Linear RGB color space - may need gamma correction to 
-								sRGB when generating 8bit representations */
+	float *rect_float;		/** < floating point Rect equivalent
+							 * Linear RGB color space - may need gamma correction to
+							 * sRGB when generating 8bit representations */
 	int channels;			/**< amount of channels in rect_float (0 = 4 channel default) */
 	float dither;			/**< random dither value, for conversion from float -> byte rect */
 	short profile;			/** color space/profile preset that the byte rect buffer represents */
@@ -117,5 +117,5 @@ LIBIMPORT void IMB_rectfill_area(struct ImBuf *ibuf, float *col, int x1, int y1,
 LIBIMPORT void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, const float col[4], int x1, int y1, int x2, int y2);
 LIBIMPORT void IMB_rectfill_alpha(struct ImBuf *drect, const float value);
 
-#endif /* IFF_H */
+#endif /* __IFF_H__ */
 
diff --git a/source/blender/blenpluginapi/intern/pluginapi.c b/source/blender/blenpluginapi/intern/pluginapi.c
index b6bd15f..02166c4 100644
--- a/source/blender/blenpluginapi/intern/pluginapi.c
+++ b/source/blender/blenpluginapi/intern/pluginapi.c
@@ -42,7 +42,7 @@
  */
 
 #define PLUGIN_INTERN /* This tells the LIBEXPORT macro to compile with
-	dll export set on windows */
+                       * dll export set on windows */
 
 #ifdef WIN32
 #include "blenpluginapi/util.h"
@@ -186,7 +186,7 @@ LIBEXPORT int ispic(char * name)
 }
 
 /* still the same name */
-/*  void (*ditherfunc)(struct ImBuf *, short, short){} */
+/*  void (*ditherfunc)(struct ImBuf *, short, short) {} */
 
 LIBEXPORT struct ImBuf *scaleImBuf(struct ImBuf *ib,
 						 short nx,
@@ -220,7 +220,7 @@ LIBEXPORT void de_interlace(struct ImBuf *ib)
 /* stuff from plugin.h                                                        */ 
 /* -------------------------------------------------------------------------- */
 
-/* These three need to be defined in the plugion itself. The plugin
+/* These three need to be defined in the plugin itself. The plugin
  * loader looks for these functions to check whether it can use the
  * plugin. For sequences, something similar exists. */
 /*  int plugin_tex_getversion(void); */
diff --git a/source/blender/blenpluginapi/plugin.h b/source/blender/blenpluginapi/plugin.h
index 6556956..eb32fe8 100644
--- a/source/blender/blenpluginapi/plugin.h
+++ b/source/blender/blenpluginapi/plugin.h
@@ -30,8 +30,8 @@
  * SUCH DAMAGE.
  */
 
-#ifndef PLUGIN_H
-#define PLUGIN_H
+#ifndef __PLUGIN_H__
+#define __PLUGIN_H__
 
 #include "externdef.h"
 #include "iff.h"
@@ -102,5 +102,5 @@ LIBIMPORT float turbulence(float noisesize, float x, float y, float z, int depth
 	/* hard turbulence */
 LIBIMPORT float turbulence1(float noisesize, float x, float y, float z, int depth);
 
-#endif /* PLUGIN_H */
+#endif /* __PLUGIN_H__ */
 
diff --git a/source/blender/blenpluginapi/util.h b/source/blender/blenpluginapi/util.h
index 156e758..3402019 100644
--- a/source/blender/blenpluginapi/util.h
+++ b/source/blender/blenpluginapi/util.h
@@ -30,8 +30,8 @@
  * SUCH DAMAGE.
  */
 
-#ifndef UTIL_H
-#define UTIL_H
+#ifndef __UTIL_H__
+#define __UTIL_H__
 
 #include <sys/types.h>
 #include <stdlib.h>
@@ -98,5 +98,5 @@ LIBEXPORT          void *mallocT(int len, char *str);
 LIBEXPORT          void *callocT(int len, char *str);
 LIBEXPORT          void freeT(void *vmemh);   
 
-#endif /* UTIL_H */
+#endif /* __UTIL_H__ */
 
diff --git a/source/blender/bmesh/CMakeLists.txt b/source/blender/bmesh/CMakeLists.txt
new file mode 100644
index 0000000..1cf2b91
--- /dev/null
+++ b/source/blender/bmesh/CMakeLists.txt
@@ -0,0 +1,105 @@
+# $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
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public 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 
+	.
+	../blenkernel
+	../blenlib
+	../makesdna
+	../../../intern/guardedalloc
+)
+
+set(SRC
+	operators/bmo_bevel.c
+	operators/bmo_connect.c
+	operators/bmo_slide.c
+	operators/bmo_create.c
+	operators/bmo_dissolve.c
+	operators/bmo_dupe.c
+	operators/bmo_edgesplit.c
+	operators/bmo_extrude.c
+	operators/bmo_inset.c
+	operators/bmo_join_triangles.c
+	operators/bmo_mesh_conv.c
+	operators/bmo_mirror.c
+	operators/bmo_primitive.c
+	operators/bmo_removedoubles.c
+	operators/bmo_subdivide.c
+	operators/bmo_subdivide.h
+	operators/bmo_triangulate.c
+	operators/bmo_utils.c
+
+	intern/bmesh_construct.c
+	intern/bmesh_construct.h
+	intern/bmesh_core.c
+	intern/bmesh_core.h
+	intern/bmesh_inline.h
+	intern/bmesh_interp.c
+	intern/bmesh_interp.h
+	intern/bmesh_iterators.c
+	intern/bmesh_iterators.h
+	intern/bmesh_iterators_inline.h
+	intern/bmesh_marking.c
+	intern/bmesh_marking.h
+	intern/bmesh_mesh.c
+	intern/bmesh_mesh.h
+	intern/bmesh_mesh_conv.c
+	intern/bmesh_mesh_conv.h
+	intern/bmesh_mesh_validate.c
+	intern/bmesh_mesh_validate.h
+	intern/bmesh_mods.c
+	intern/bmesh_mods.h
+	intern/bmesh_opdefines.c
+	intern/bmesh_operator_api_inline.h
+	intern/bmesh_operators.c
+	intern/bmesh_operators.h
+	intern/bmesh_operators_private.h
+	intern/bmesh_polygon.c
+	intern/bmesh_polygon.h
+	intern/bmesh_private.h
+	intern/bmesh_queries.c
+	intern/bmesh_queries.h
+	intern/bmesh_structure.c
+	intern/bmesh_structure.h
+	intern/bmesh_walkers.c
+	intern/bmesh_walkers.h
+	intern/bmesh_walkers_impl.c
+	intern/bmesh_walkers_private.h
+
+	intern/bmesh_operator_api.h
+	intern/bmesh_error.h
+
+	tools/BME_bevel.c
+
+	bmesh.h
+	bmesh_class.h
+)
+
+if(MSVC)
+	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
+endif()
+
+blender_add_lib(bf_bmesh "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/bmesh/SConscript b/source/blender/bmesh/SConscript
new file mode 100644
index 0000000..fb00aef
--- /dev/null
+++ b/source/blender/bmesh/SConscript
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+Import ('env')
+
+cflags=''
+
+sources = env.Glob('intern/*.c')
+sources += env.Glob('operators/*.c')
+sources += env.Glob('tools/*.c')
+
+incs = [
+	'./',
+	'../blenlib',
+	'../makesdna',
+	'../blenkernel',
+	'#/intern/guardedalloc',
+	]
+
+defs = []
+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
new file mode 100644
index 0000000..13926c4
--- /dev/null
+++ b/source/blender/bmesh/bmesh.h
@@ -0,0 +1,268 @@
+/*
+ * ***** 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): Geoffrey Bantle, Levi Schooley.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BMESH_H__
+#define __BMESH_H__
+
+/** \file blender/bmesh/bmesh.h
+ *  \ingroup bmesh
+ *
+ * \addtogroup bmesh BMesh
+ *
+ * \brief BMesh is a non-manifold boundary representation designed to replace the current, limited EditMesh structure,
+ * solving many of the design limitations and maintenance issues of EditMesh.
+ *
+ *
+ * \section bm_structure The Structure
+ *
+ * BMesh stores topology in four main element structures:
+ *
+ * - Faces - BMFace
+ * - Loops - BMLoop, (stores per-face-vertex data, UV's, vertex-colors, etc)
+ * - Edges - BMEdge
+ * - Verts - BMVert
+ *
+ *
+ * \subsection bm_header_flags Header Flags
+ * Each element (vertex/edge/face/loop) in a mesh has an associated bit-field called "header flags".
+ *
+ * BMHeader flags should <b>never</b> be read or written to by bmesh operators (see Operators below).
+ *
+ * Access to header flags is done with BM_elem_flag_*() functions.
+ *
+ *
+ * \subsection bm_faces Faces
+ *
+ * Faces in BMesh are stored as a circular linked list of loops. Loops store per-face-vertex data
+ * (amongst other things outlined later in this document), and define the face boundary.
+ *
+ *
+ * \subsection bm_loop The Loop
+ *
+ * Loops define the boundary loop of a face. Each loop logically corresponds to an edge,
+ * which is defined by the loop and next loop's vertices.
+ *
+ * Loops store several handy pointers:
+ *
+ * - BMLoop#v - pointer to the vertex associated with this loop.
+ * - BMLoop#e - pointer to the edge associated with this loop.
+ * - BMLoop#f - pointer to the face associated with this loop.
+ *
+ *
+ * \subsection bm_two_side_face 2-Sided Faces
+ *
+ * There are some situations where you need 2-sided faces (e.g. a face of two vertices).
+ * This is supported by BMesh, but note that such faces should only be used as intermediary steps,
+ * and should not end up in the final mesh.
+ *
+ *
+ * \subsection bm_edges_and_verts Edges and Vertices
+ *
+ * Edges and Vertices in BMesh are much like their counterparts in EditMesh,
+ * except for some members private to the BMesh api.
+ *
+ * \note There can be more then one edge between two vertices in bmesh,
+ * though the rest of blender (e.g. DerivedMesh, CDDM, CCGSubSurf, etc) does not support this.
+ *
+ *
+ * \subsection bm_queries Queries
+ *
+ * The following topological queries are available:
+ *
+ * - Edges/Faces/Loops around a vertex.
+ * - Faces around an edge.
+ * - Loops around an edge.
+ *
+ * These are accessible through the iterator api, which is covered later in this document
+ *
+ * See source/blender/bmesh/bmesh_queries.h for more misc. queries.
+ *
+ *
+ * \section bm_api The BMesh API
+ *
+ * One of the goals of the BMesh API is to make it easy and natural to produce highly maintainable code.
+ * Code duplication, etc are avoided where possible.
+ *
+ *
+ * \subsection bm_iter_api Iterator API
+ *
+ * Most topological queries in BMesh go through an iterator API (see Queries above).
+ * These are defined in bmesh_iterators.h.  If you can, please use the #BM_ITER macro in bmesh_iterators.h
+ *
+ *
+ * \subsection bm_walker_api Walker API
+ *
+ * Topological queries that require a stack (e.g. recursive queries) go through the Walker API,
+ * which is defined in bmesh_walkers.h. Currently the "walkers" are hard-coded into the API,
+ * though a mechanism for plugging in new walkers needs to be added at some point.
+ *
+ * Most topological queries should go through these two APIs;
+ * there are additional functions you can use for topological iteration, but their meant for internal bmesh code.
+ *
+ * Note that the walker API supports delimiter flags, to allow the caller to flag elements not to walk past.
+ *
+ *
+ * \subsection bm_ops Operators
+ *
+ * Operators are an integral part of BMesh. Unlike regular blender operators,
+ * BMesh operators <b>bmo's</b> are designed to be nested (e.g. call other operators).
+ *
+ * Each operator has a number of input/output "slots" which are used to pass settings & data into/out of the operator
+ * (and allows for chaining operators together).
+ *
+ * These slots are identified by name, using strings.
+ *
+ * Access to slots is done with BMO_slot_*() functions.
+ *
+ *
+ * \subsection bm_tool_flags Tool Flags
+ *
+ * The BMesh API provides a set of flags for faces, edges and vertices, which are private to an operator.
+ * These flags may be used by the client operator code as needed
+ * (a common example is flagging elements for use in another operator).
+ * Each call to an operator allocates it's own set of tool flags when it's executed,
+ * avoiding flag conflicts between operators.
+ *
+ * These flags should not be confused with header flags, which are used to store persistent flags
+ * (e.g. selection, hide status, etc).
+ *
+ * Access to tool flags is done with BMO_elem_flag_*() functions.
+ *
+ * \warning Operators are never allowed to read or write to header flags.
+ * They act entirely on the data inside their input slots.
+ * For example an operator should not check the selected state of an element,
+ * there are some exceptions to this - some operators check of a face is smooth.
+ *
+ *
+ * \subsection bm_slot_types Slot Types
+ *
+ * The following slot types are available:
+ *
+ * - integer - #BMO_OP_SLOT_INT
+ * - boolean - #BMO_OP_SLOT_BOOL
+ * - float   - #BMO_OP_SLOT_FLT
+ * - pointer - #BMO_OP_SLOT_PNT
+ * - element buffer - #BMO_OP_SLOT_ELEMENT_BUF - a list of verts/edges/faces
+ * - map     - BMO_OP_SLOT_MAPPING - simple hash map
+ *
+ *
+ * \subsection bm_slot_iter Slot Iterators
+ *
+ * Access to element buffers or maps must go through the slot iterator api, defined in bmesh_operators.h.
+ * Use #BMO_ITER where ever possible.
+ *
+ *
+ * \subsection bm_elem_buf Element Buffers
+ *
+ * The element buffer slot type is used to feed elements (verts/edges/faces) to operators.
+ * Internally they are stored as pointer arrays (which happily has not caused any problems so far).
+ * Many operators take in a buffer of elements, process it,
+ * then spit out a new one; this allows operators to be chained together.
+ *
+ * \note Element buffers may have elements of different types within the same buffer (this is supported by the API.
+ *
+ *
+ * \section bm_fname Function Naming Conventions
+ *
+ * These conventions should be used throughout the bmesh module.
+ *
+ * - BM_xxx() -     High level BMesh API function for use anywhere.
+ * - bmesh_xxx() -  Low level API function.
+ * - bm_xxx() -     'static' functions, not apart of the API at all, but use prefix since they operate on BMesh data.
+ * - BMO_xxx() -    High level operator API function for use anywhere.
+ * - bmo_xxx() -    Low level / internal operator API functions.
+ * - _bm_xxx() -    Functions which are called via macros only.
+ *
+ * \section bm_todo BMesh TODO's
+ *
+ * There may be a better place for this section, but adding here for now.
+ *
+ *
+ * \subsection bm_todo_tools Tools
+ *
+ * Probably most of these will be bmesh operators.
+ *
+ * - make ngons flat.
+ * - make ngons into tris/quads (ngon poke?), many methods could be used here (triangulate/fan/quad-fan).
+ * - solidify (precise mode), keeps even wall thickness, re-creates outlines of offset faces with plane-plane
+ *   intersections.
+ * - split vert (we already have in our API, just no tool)
+ * - bridge (add option to bridge between different edge loop counts, option to remove selected face regions)
+ * - flip selected region (invert all faces about the plane defined by the selected region outline)
+ * - interactive dissolve (like the knife tool but draw over edges to dissolve)
+ *
+ *
+ * \subsection bm_todo_optimize Optimizations
+ *
+ * - skip normal calc when its not needed (when calling chain of operators & for modifiers, flag as dirty)
+ * - skip BMO flag allocation, its not needed in many cases, this is fairly redundant to calc by default.
+ * - ability to call BMO's with option not to create return data (will save some time)
+ * - binary diff UNDO, currently this uses huge amount of ram when all shapes are stored for each undo step for eg.
+ * - use two differnt iterator types for BMO map/buffer types.
+ * - avoid string lookups for BMO slot lookups _especially_ when used in loops, this is very crappy.
+ *
+ *
+ * \subsection bm_todo_tools_enhance Tool Enhancements
+ *
+ * - face inset interpolate loop data from face (currently copies - but this stretches UV's in an ugly way)
+ * - vert slide UV correction (like we have for edge slide)
+ * - fill-face edge net - produce consistant normals, currently it won't, fix should be to fill in edge-net node
+ *   connected with previous one - since they already check for normals of adjacent edge-faces before creating.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "DNA_listBase.h" /* selection history uses */
+#include "DNA_customdata_types.h" /* BMesh struct in bmesh_class.h uses */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "bmesh_class.h"
+
+/* include the rest of the API */
+#include "intern/bmesh_operator_api.h"
+#include "intern/bmesh_error.h"
+
+#include "intern/bmesh_construct.h"
+#include "intern/bmesh_core.h"
+#include "intern/bmesh_interp.h"
+#include "intern/bmesh_iterators.h"
+#include "intern/bmesh_marking.h"
+#include "intern/bmesh_mesh.h"
+#include "intern/bmesh_mesh_conv.h"
+#include "intern/bmesh_mesh_validate.h"
+#include "intern/bmesh_mods.h"
+#include "intern/bmesh_operators.h"
+#include "intern/bmesh_polygon.h"
+#include "intern/bmesh_queries.h"
+#include "intern/bmesh_walkers.h"
+
+#include "intern/bmesh_inline.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __BMESH_H__ */
diff --git a/source/blender/bmesh/bmesh_class.h b/source/blender/bmesh/bmesh_class.h
new file mode 100644
index 0000000..c536a22
--- /dev/null
+++ b/source/blender/bmesh/bmesh_class.h
@@ -0,0 +1,258 @@
+/*
+ * ***** 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): Geoffrey Bantle, Levi Schooley, Joseph Eagar.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BMESH_CLASS_H__
+#define __BMESH_CLASS_H__
+
+/** \file blender/bmesh/bmesh_class.h
+ *  \ingroup bmesh
+ */
+
+/* bmesh data structures */
+
+/* dissable holes for now, these are ifdef'd because they use more memory and cant be saved in DNA currently */
+// #define USE_BMESH_HOLES
+
+struct BMesh;
+struct BMVert;
+struct BMEdge;
+struct BMLoop;
+struct BMFace;
+
+struct BLI_mempool;
+struct Object;
+
+/* note: it is very important for BMHeader to start with two
+ * pointers. this is a requirement of mempool's method of
+ * iteration.
+ *
+ * hrm. it doesn't but stull works ok, remove the comment above? - campbell.
+ */
+
+/**
+ * BMHeader
+ *
+ * All mesh elements begin with a BMHeader. This structure
+ * hold several types of data
+ *
+ * 1: The type of the element (vert, edge, loop or face)
+ * 2: Persistent "header" flags/markings (smooth, seam, select, hidden, etc)
+ *     note that this is different from the "tool" flags.
+ * 3: Unique ID in the bmesh.
+ * 4: some elements for internal record keeping.
+ */
+typedef struct BMHeader {
+	void *data; /* customdata layers */
+	int index; /* notes:
+	            * - Use BM_elem_index_get/set macros for index
+	            * - Unitialized to -1 so we can easily tell its not set.
+	            * - Used for edge/vert/face, check BMesh.elem_index_dirty for valid index values,
+	            *   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 */
+} BMHeader;
+
+/* 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.*/
+
+typedef struct BMVert {
+	BMHeader head;
+	struct BMFlagLayer *oflags; /* keep after header, an array of flags, mostly used by the operator stack */
+
+	float co[3];
+	float no[3];
+	struct BMEdge *e;
+} BMVert;
+
+/* disk link structure, only used by edges */
+typedef struct BMDiskLink {
+	struct BMEdge *next, *prev;
+} BMDiskLink;
+
+typedef struct BMEdge {
+	BMHeader head;
+	struct BMFlagLayer *oflags; /* keep after header, an array of flags, mostly used by the operator stack */
+
+	struct BMVert *v1, *v2;
+	struct BMLoop *l;
+	
+	/* disk cycle pointers */
+	BMDiskLink v1_disk_link, v2_disk_link;
+} BMEdge;
+
+typedef struct BMLoop {
+	BMHeader head;
+	/* notice no flags layer */
+
+	struct BMVert *v;
+	struct BMEdge *e; /* edge, using verts (v, next->v) */
+	struct BMFace *f;
+
+	/* circular linked list of loops which all use the same edge as this one '->e',
+	 * but not necessarily the same vertex (can be either v1 or v2 of our own '->e') */
+	struct BMLoop *radial_next, *radial_prev;
+
+	/* these were originally commented as private but are used all over the code */
+	/* can't use ListBase API, due to head */
+	struct BMLoop *next, *prev; /* next/prev verts around the face */
+} 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 */
+} BMElemF;
+
+/* can cast anything to this, including BMLoop */
+typedef struct BMElem {
+	BMHeader head;
+} BMElem;
+
+#ifdef USE_BMESH_HOLES
+/* eventually, this structure will be used for supporting holes in faces */
+typedef struct BMLoopList {
+	struct BMLoopList *next, *prev;
+	struct BMLoop *first, *last;
+} BMLoopList;
+#endif
+
+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*/
+	short mat_nr;
+} BMFace;
+
+typedef struct BMFlagLayer {
+	short f, pflag; /* flags */
+} BMFlagLayer;
+
+typedef struct BMesh {
+	int totvert, totedge, totloop, totface;
+	int totvertsel, totedgesel, totfacesel;
+
+	/* flag index arrays as being dirty so we can check if they are clean and
+	 * avoid looping over the entire vert/edge/face array in those cases.
+	 * 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;
+
+	/*operator api stuff*/
+	struct BLI_mempool *toolflagpool;
+	int stackdepth;
+	struct BMOperator *currentop;
+	
+	CustomData vdata, edata, ldata, pdata;
+
+#ifdef USE_BMESH_HOLES
+	struct BLI_mempool *looplistpool;
+#endif
+
+	/* should be copy of scene select mode */
+	/* stored in BMEditMesh too, this is a bit confusing,
+	 * make sure they're in sync!
+	 * Only use when the edit mesh cant be accessed - campbell */
+	short selectmode;
+	
+	/*ID of the shape key this bmesh came from*/
+	int shapenr;
+	
+	int walkers, totflags;
+	ListBase selected, error_stack;
+	
+	BMFace *act_face;
+
+	ListBase errorstack;
+
+	void *py_handle;
+
+	int opflag; /* current operator flag */
+} BMesh;
+
+/* BMHeader->htype (char) */
+enum {
+	BM_VERT = 1,
+	BM_EDGE = 2,
+	BM_LOOP = 4,
+	BM_FACE = 8
+};
+
+#define BM_ALL (BM_VERT | BM_EDGE | BM_LOOP | BM_FACE)
+
+/* BMHeader->hflag (char) */
+enum {
+	BM_ELEM_SELECT  = (1 << 0),
+	BM_ELEM_HIDDEN  = (1 << 1),
+	BM_ELEM_SEAM    = (1 << 2),
+	BM_ELEM_SMOOTH  = (1 << 3), /* used for faces and edges, note from the user POV,
+                                 * this is a sharp edge when disabled */
+
+	BM_ELEM_TAG     = (1 << 4), /* internal flag, used for ensuring correct normals
+                                 * during multires interpolation, and any other time
+                                 * when temp tagging is handy.
+                                 * always assume dirty & clear before use. */
+
+	/* we have 2 spare flags which is awesome but since we're limited to 8
+	 * only add new flags with care! - campbell */
+	/* BM_ELEM_SPARE  = (1 << 5), */
+	/* BM_ELEM_SPARE  = (1 << 6), */
+
+	BM_ELEM_INTERNAL_TAG = (1 << 7) /* for low level internal API tagging,
+                                     * since tools may want to tag verts and
+                                     * not have functions clobber them */
+};
+
+/* defines */
+
+/*forward declarations*/
+
+#ifdef USE_BMESH_HOLES
+#  define BM_FACE_FIRST_LOOP(p) (((BMLoopList *)((p)->loops.first))->first)
+#else
+#  define BM_FACE_FIRST_LOOP(p) ((p)->l_first)
+#endif
+
+/* size to use for static arrays when dealing with NGons,
+ * alloc after this limit is reached.
+ * this value is rather arbitrary */
+#define BM_NGON_STACK_SIZE 32
+
+/* avoid inf loop, this value is arbitrary
+ * but should not error on valid cases */
+#define BM_LOOP_RADIAL_MAX 10000
+#define BM_NGON_MAX 100000
+
+#endif /* __BMESH_CLASS_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c
new file mode 100644
index 0000000..cbdd5dd
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_construct.c
@@ -0,0 +1,1004 @@
+/*
+ * ***** 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) 2007 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Geoffrey Bantle.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/intern/bmesh_construct.c
+ *  \ingroup bmesh
+ *
+ * BM construction functions.
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_array.h"
+#include "BLI_math.h"
+
+#include "BKE_customdata.h"
+
+#include "DNA_meshdata_types.h"
+
+#include "bmesh.h"
+#include "intern/bmesh_private.h"
+
+#define SELECT 1
+
+/* prototypes */
+static void bm_loop_attrs_copy(BMesh *source_mesh, BMesh *target_mesh,
+                               const BMLoop *source_loop, BMLoop *target_loop);
+
+/**
+ * \brief Make Quad/Triangle
+ *
+ * Creates a new quad or triangle from a list of 3 or 4 vertices.
+ * If \a nodouble is TRUE, then a check is done to see if a face
+ * with these vertices already exists and returns it instead.
+ *
+ * If a pointer to an example face is provided, it's custom data
+ * and properties will be copied to the new face.
+ *
+ * \note The winding of the face is determined by the order
+ * of the vertices in the vertex array.
+ */
+
+BMFace *BM_face_create_quad_tri(BMesh *bm,
+                                BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4,
+                                const BMFace *example, const int nodouble)
+{
+	BMVert *vtar[4] = {v1, v2, v3, v4};
+	return BM_face_create_quad_tri_v(bm, vtar, v4 ? 4 : 3, example, nodouble);
+}
+
+BMFace *BM_face_create_quad_tri_v(BMesh *bm, BMVert **verts, int len, const BMFace *example, const int nodouble)
+{
+	BMFace *f = NULL;
+	int is_overlap = FALSE;
+
+	/* sanity check - debug mode only */
+	if (len == 3) {
+		BLI_assert(verts[0] != verts[1]);
+		BLI_assert(verts[0] != verts[2]);
+		BLI_assert(verts[1] != verts[2]);
+	}
+	else if (len == 4) {
+		BLI_assert(verts[0] != verts[1]);
+		BLI_assert(verts[0] != verts[2]);
+		BLI_assert(verts[0] != verts[3]);
+
+		BLI_assert(verts[1] != verts[2]);
+		BLI_assert(verts[1] != verts[3]);
+
+		BLI_assert(verts[2] != verts[3]);
+	}
+	else {
+		BLI_assert(0);
+	}
+
+
+	if (nodouble) {
+		/* check if face exists or overlaps */
+		is_overlap = BM_face_exists(bm, 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);
+		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);
+		}
+		else {
+			edar[2] = BM_edge_create(bm, verts[2], verts[0], NULL, TRUE);
+		}
+
+		f = BM_face_create(bm, verts, edar, len, FALSE);
+
+		if (example && f) {
+			BM_elem_attrs_copy(bm, bm, example, f);
+		}
+	}
+
+	return f;
+}
+
+/**
+ * \brief copies face loop data from shared adjacent faces.
+ * \note when a matching edge is found, both loops of that edge are copied
+ * this is done since the face may not be completely surrounded by faces,
+ * this way: a quad with 2 connected quads on either side will still get all 4 loops updated */
+void BM_face_copy_shared(BMesh *bm, BMFace *f)
+{
+	BMLoop *l_first;
+	BMLoop *l_iter;
+
+	l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+	do {
+		BMLoop *l_other = l_iter->radial_next;
+
+		if (l_other && l_other != l_iter) {
+			if (l_other->v == l_iter->v) {
+				bm_loop_attrs_copy(bm, bm, l_other, l_iter);
+				bm_loop_attrs_copy(bm, bm, l_other->next, l_iter->next);
+			}
+			else {
+				bm_loop_attrs_copy(bm, bm, l_other->next, l_iter);
+				bm_loop_attrs_copy(bm, bm, l_other, l_iter->next);
+			}
+			/* since we copy both loops of the shared edge, step over the next loop here */
+			if ((l_iter = l_iter->next) == l_first) {
+				break;
+			}
+		}
+	} while ((l_iter = l_iter->next) != l_first);
+}
+
+/**
+ * \brief Make NGon
+ *
+ * Makes an ngon from an unordered list of edges. \a v1 and \a v2
+ * must be the verts defining edges[0],
+ * and define the winding of the new face.
+ *
+ * \a edges are not required to be ordered, simply to to form
+ * a single closed loop as a whole.
+ *
+ * \note While this function will work fine when the edges
+ * are already sorted, if the edges are always going to be sorted,
+ * #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)
+{
+	BMEdge **edges2 = NULL;
+	BLI_array_staticdeclare(edges2, BM_NGON_STACK_SIZE);
+	BMVert **verts = NULL;
+	BLI_array_staticdeclare(verts, BM_NGON_STACK_SIZE);
+	BMFace *f = NULL;
+	BMEdge *e;
+	BMVert *v, *ev1, *ev2;
+	int i, /* j, */ v1found, reverse;
+
+	/* this code is hideous, yeek.  I'll have to think about ways of
+	 *  cleaning it up.  basically, it now combines the old BM_face_create_ngon
+	 *  _and_ the old bmesh_mf functions, so its kindof smashed together
+	 * - joeedh */
+
+	if (!len || !v1 || !v2 || !edges || !bm)
+		return NULL;
+
+	/* put edges in correct order */
+	for (i = 0; i < len; i++) {
+		BM_ELEM_API_FLAG_ENABLE(edges[i], _FLAG_MF);
+	}
+
+	ev1 = edges[0]->v1;
+	ev2 = edges[0]->v2;
+
+	if (v1 == ev2) {
+		/* Swapping here improves performance and consistency of face
+		 * structure in the special case that the edges are already in
+		 * the correct order and winding */
+		SWAP(BMVert *, ev1, ev2);
+	}
+
+	BLI_array_append(verts, ev1);
+	v = ev2;
+	e = edges[0];
+	do {
+		BMEdge *e2 = e;
+
+		BLI_array_append(verts, v);
+		BLI_array_append(edges2, e);
+
+		do {
+			e2 = bmesh_disk_edge_next(e2, v);
+			if (e2 != e && BM_ELEM_API_FLAG_TEST(e2, _FLAG_MF)) {
+				v = BM_edge_other_vert(e2, v);
+				break;
+			}
+		} while (e2 != e);
+
+		if (e2 == e)
+			goto err; /* the edges do not form a closed loop */
+
+		e = e2;
+	} while (e != edges[0]);
+
+	if (BLI_array_count(edges2) != len) {
+		goto err; /* we didn't use all edges in forming the boundary loop */
+	}
+
+	/* ok, edges are in correct order, now ensure they are going
+	 * in the correct direction */
+	v1found = reverse = FALSE;
+	for (i = 0; i < len; i++) {
+		if (BM_vert_in_edge(edges2[i], v1)) {
+			/* see if v1 and v2 are in the same edge */
+			if (BM_vert_in_edge(edges2[i], v2)) {
+				/* if v1 is shared by the *next* edge, then the winding
+				 * is incorrect */
+				if (BM_vert_in_edge(edges2[(i + 1) % len], v1)) {
+					reverse = TRUE;
+					break;
+				}
+			}
+
+			v1found = TRUE;
+		}
+
+		if ((v1found == FALSE) && BM_vert_in_edge(edges2[i], v2)) {
+			reverse = TRUE;
+			break;
+		}
+	}
+
+	if (reverse) {
+		for (i = 0; i < len / 2; i++) {
+			v = verts[i];
+			verts[i] = verts[len - i - 1];
+			verts[len - i - 1] = v;
+		}
+	}
+
+	for (i = 0; i < len; i++) {
+		edges2[i] = BM_edge_exists(verts[i], verts[(i + 1) % len]);
+		if (!edges2[i]) {
+			goto err;
+		}
+	}
+
+	f = BM_face_create(bm, verts, edges2, len, nodouble);
+
+	/* clean up flags */
+	for (i = 0; i < len; i++) {
+		BM_ELEM_API_FLAG_DISABLE(edges2[i], _FLAG_MF);
+	}
+
+	BLI_array_free(verts);
+	BLI_array_free(edges2);
+
+	return f;
+
+err:
+	for (i = 0; i < len; i++) {
+		BM_ELEM_API_FLAG_DISABLE(edges[i], _FLAG_MF);
+	}
+
+	BLI_array_free(verts);
+	BLI_array_free(edges2);
+
+	return NULL;
+}
+
+typedef struct AngleIndexPair {
+	float angle;
+	int index;
+} AngleIndexPair;
+
+static int angle_index_pair_cmp(const void *e1, const void *e2)
+{
+	const AngleIndexPair *p1 = e1, *p2 = e2;
+	if      (p1->angle > p2->angle) return  1;
+	else if (p1->angle < p2->angle) return -1;
+	else return 0;
+}
+
+/**
+ * Makes an NGon from an un-ordered set of verts
+ *
+ * assumes...
+ * - that verts are only once in the list.
+ * - that the verts have roughly planer bounds
+ * - that the verts are roughly circular
+ * there can be concave areas but overlapping folds from the center point will fail.
+ *
+ * a brief explanation of the method used
+ * - find the center point
+ * - find the normal of the vcloud
+ * - order the verts around the face based on their angle to the normal vector at the center point.
+ *
+ * \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 *f;
+
+	float totv_inv = 1.0f / (float)totv;
+	int i = 0;
+
+	float cent[3], nor[3];
+
+	float *far = NULL, *far_cross = NULL;
+
+	float far_vec[3];
+	float far_cross_vec[3];
+	float sign_vec[3]; /* work out if we are pos/neg angle */
+
+	float far_dist, far_best;
+	float far_cross_dist, far_cross_best = 0.0f;
+
+	AngleIndexPair *vang;
+
+	BMVert **vert_arr_map;
+	BMEdge **edge_arr;
+	int i_prev;
+
+	unsigned int winding[2] = {0, 0};
+
+	/* get the center point and collect vector array since we loop over these a lot */
+	zero_v3(cent);
+	for (i = 0; i < totv; i++) {
+		madd_v3_v3fl(cent, vert_arr[i]->co, totv_inv);
+	}
+
+
+	/* find the far point from cent */
+	far_best = 0.0f;
+	for (i = 0; i < totv; i++) {
+		far_dist = len_squared_v3v3(vert_arr[i]->co, cent);
+		if (far_dist > far_best || far == NULL) {
+			far = vert_arr[i]->co;
+			far_best = far_dist;
+		}
+	}
+
+	sub_v3_v3v3(far_vec, far, cent);
+	far_dist = len_v3(far_vec); /* real dist */
+
+	/* --- */
+
+	/* find a point 90deg about to compare with */
+	far_cross_best = 0.0f;
+	for (i = 0; i < totv; i++) {
+
+		if (far == vert_arr[i]->co) {
+			continue;
+		}
+
+		sub_v3_v3v3(far_cross_vec, vert_arr[i]->co, cent);
+		far_cross_dist = normalize_v3(far_cross_vec);
+
+		/* more of a weight then a distance */
+		far_cross_dist = (/* first we want to have a value close to zero mapped to 1 */
+						  1.0 - 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);
+
+		if (far_cross_dist > far_cross_best || far_cross == NULL) {
+			far_cross = vert_arr[i]->co;
+			far_cross_best = far_cross_dist;
+		}
+	}
+
+	sub_v3_v3v3(far_cross_vec, far_cross, cent);
+
+	/* --- */
+
+	/* now we have 2 vectors we can have a cross product */
+	cross_v3_v3v3(nor, far_vec, far_cross_vec);
+	normalize_v3(nor);
+	cross_v3_v3v3(sign_vec, far_vec, nor); /* this vector should match 'far_cross_vec' closely */
+
+	/* --- */
+
+	/* now calculate every points angle around the normal (signed) */
+	vang = MEM_mallocN(sizeof(AngleIndexPair) * totv, __func__);
+
+	for (i = 0; i < totv; i++) {
+		float co[3];
+		float proj_vec[3];
+		float angle;
+
+		/* center relative vec */
+		sub_v3_v3v3(co, vert_arr[i]->co, cent);
+
+		/* align to plane */
+		project_v3_v3v3(proj_vec, co, nor);
+		sub_v3_v3(co, proj_vec);
+
+		/* now 'co' is valid - we can compare its angle against the far vec */
+		angle = angle_v3v3(far_vec, co);
+
+		if (dot_v3v3(co, sign_vec) < 0.0f) {
+			angle = -angle;
+		}
+
+		vang[i].angle = angle;
+		vang[i].index = i;
+	}
+
+	/* sort by angle and magic! - we have our ngon */
+	qsort(vang, totv, sizeof(AngleIndexPair), angle_index_pair_cmp);
+
+	/* --- */
+
+	/* create edges and find the winding (if faces are attached to any existing edges) */
+	vert_arr_map = MEM_mallocN(sizeof(BMVert **) * totv, __func__);
+	edge_arr = MEM_mallocN(sizeof(BMEdge **) * totv, __func__);
+
+	for (i = 0; i < totv; i++) {
+		vert_arr_map[i] = vert_arr[vang[i].index];
+	}
+	MEM_freeN(vang);
+
+	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);
+
+		/* 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 */
+		if (edge_arr[i]->l) {
+			BMVert *test_v1, *test_v2;
+			/* we want to use the reverse winding to the existing order */
+			BM_edge_ordered_verts(edge_arr[i], &test_v2, &test_v1);
+			winding[(vert_arr_map[i_prev] == test_v2)]++;
+
+		}
+
+		i_prev = i;
+	}
+
+	/* --- */
+
+	if (winding[0] < winding[1]) {
+		winding[0] = 1;
+		winding[1] = 0;
+	}
+	else {
+		winding[0] = 0;
+		winding[1] = 1;
+	}
+
+	/* --- */
+
+	/* create the face */
+	f = BM_face_create_ngon(bm, vert_arr_map[winding[0]], vert_arr_map[winding[1]], edge_arr, totv, nodouble);
+
+	MEM_freeN(edge_arr);
+	MEM_freeN(vert_arr_map);
+
+	return f;
+}
+
+/**
+ * Called by operators to remove elements that they have marked for
+ * removal.
+ */
+void BMO_remove_tagged_faces(BMesh *bm, const short oflag)
+{
+	BMFace *f;
+	BMIter iter;
+
+	BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+		if (BMO_elem_flag_test(bm, f, oflag)) {
+			BM_face_kill(bm, f);
+		}
+	}
+}
+
+void BMO_remove_tagged_edges(BMesh *bm, const short oflag)
+{
+	BMEdge *e;
+	BMIter iter;
+
+	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+		if (BMO_elem_flag_test(bm, e, oflag)) {
+			BM_edge_kill(bm, e);
+		}
+	}
+}
+
+void BMO_remove_tagged_verts(BMesh *bm, const short oflag)
+{
+	BMVert *v;
+	BMIter iter;
+
+	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+		if (BMO_elem_flag_test(bm, v, oflag)) {
+			BM_vert_kill(bm, v);
+		}
+	}
+}
+
+/*************************************************************/
+/* you need to make remove tagged verts/edges/faces
+ * api functions that take a filter callback.....
+ * and this new filter type will be for opstack flags.
+ * This is because the BM_remove_taggedXXX functions bypass iterator API.
+ *  - Ops don't care about 'UI' considerations like selection state, hide state, etc.
+ *    If you want to work on unhidden selections for instance,
+ *    copy output from a 'select context' operator to another operator....
+ */
+
+static void bmo_remove_tagged_context_verts(BMesh *bm, const short oflag)
+{
+	BMVert *v;
+	BMEdge *e;
+	BMFace *f;
+
+	BMIter iter;
+	BMIter itersub;
+
+	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+		if (BMO_elem_flag_test(bm, v, oflag)) {
+			/* Visit edge */
+			BM_ITER_ELEM (e, &itersub, v, BM_EDGES_OF_VERT) {
+				BMO_elem_flag_enable(bm, e, oflag);
+			}
+			/* Visit face */
+			BM_ITER_ELEM (f, &itersub, v, BM_FACES_OF_VERT) {
+				BMO_elem_flag_enable(bm, f, oflag);
+			}
+		}
+	}
+
+	BMO_remove_tagged_faces(bm, oflag);
+	BMO_remove_tagged_edges(bm, oflag);
+	BMO_remove_tagged_verts(bm, oflag);
+}
+
+static void bmo_remove_tagged_context_edges(BMesh *bm, const short oflag)
+{
+	BMEdge *e;
+	BMFace *f;
+
+	BMIter iter;
+	BMIter itersub;
+
+	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+		if (BMO_elem_flag_test(bm, e, oflag)) {
+			BM_ITER_ELEM (f, &itersub, e, BM_FACES_OF_EDGE) {
+				BMO_elem_flag_enable(bm, f, oflag);
+			}
+		}
+	}
+	BMO_remove_tagged_faces(bm, oflag);
+	BMO_remove_tagged_edges(bm, oflag);
+}
+
+#define DEL_WIREVERT	(1 << 10)
+
+/**
+ * \warning oflag applies to different types in some contexts,
+ * not just the type being removed.
+ *
+ * \warning take care, uses operator flag DEL_WIREVERT
+ */
+void BMO_remove_tagged_context(BMesh *bm, const short oflag, const int type)
+{
+	BMVert *v;
+	BMEdge *e;
+	BMFace *f;
+
+	BMIter viter;
+	BMIter eiter;
+	BMIter fiter;
+
+	switch (type) {
+		case DEL_VERTS:
+		{
+			bmo_remove_tagged_context_verts(bm, oflag);
+
+			break;
+		}
+		case DEL_EDGES:
+		{
+			/* flush down to vert */
+			BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) {
+				if (BMO_elem_flag_test(bm, e, oflag)) {
+					BMO_elem_flag_enable(bm, e->v1, oflag);
+					BMO_elem_flag_enable(bm, e->v2, oflag);
+				}
+			}
+			bmo_remove_tagged_context_edges(bm, oflag);
+			/* remove loose vertice */
+			BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
+				if (BMO_elem_flag_test(bm, v, oflag) && (!(v->e)))
+					BMO_elem_flag_enable(bm, v, DEL_WIREVERT);
+			}
+			BMO_remove_tagged_verts(bm, DEL_WIREVERT);
+
+			break;
+		}
+		case DEL_EDGESFACES:
+		{
+			bmo_remove_tagged_context_edges(bm, oflag);
+
+			break;
+		}
+		case DEL_ONLYFACES:
+		{
+			BMO_remove_tagged_faces(bm, oflag);
+
+			break;
+		}
+		case DEL_ONLYTAGGED:
+		{
+			BMO_remove_tagged_faces(bm, oflag);
+			BMO_remove_tagged_edges(bm, oflag);
+			BMO_remove_tagged_verts(bm, oflag);
+
+			break;
+		}
+		case DEL_FACES:
+		{
+			/* go through and mark all edges and all verts of all faces for delet */
+			BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
+				if (BMO_elem_flag_test(bm, f, oflag)) {
+					for (e = BM_iter_new(&eiter, bm, BM_EDGES_OF_FACE, f); e; e = BM_iter_step(&eiter))
+						BMO_elem_flag_enable(bm, e, oflag);
+					for (v = BM_iter_new(&viter, bm, BM_VERTS_OF_FACE, f); v; v = BM_iter_step(&viter))
+						BMO_elem_flag_enable(bm, v, oflag);
+				}
+			}
+			/* now go through and mark all remaining faces all edges for keeping */
+			BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
+				if (!BMO_elem_flag_test(bm, f, oflag)) {
+					for (e = BM_iter_new(&eiter, bm, BM_EDGES_OF_FACE, f); e; e = BM_iter_step(&eiter)) {
+						BMO_elem_flag_disable(bm, e, oflag);
+					}
+					for (v = BM_iter_new(&viter, bm, BM_VERTS_OF_FACE, f); v; v = BM_iter_step(&viter)) {
+						BMO_elem_flag_disable(bm, v, oflag);
+					}
+				}
+			}
+			/* also mark all the vertices of remaining edges for keeping */
+			BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) {
+				if (!BMO_elem_flag_test(bm, e, oflag)) {
+					BMO_elem_flag_disable(bm, e->v1, oflag);
+					BMO_elem_flag_disable(bm, e->v2, oflag);
+				}
+			}
+			/* now delete marked face */
+			BMO_remove_tagged_faces(bm, oflag);
+			/* delete marked edge */
+			BMO_remove_tagged_edges(bm, oflag);
+			/* remove loose vertice */
+			BMO_remove_tagged_verts(bm, oflag);
+
+			break;
+		}
+		case DEL_ALL:
+		{
+			/* does this option even belong in here? */
+			BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
+				BMO_elem_flag_enable(bm, f, oflag);
+			}
+			BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) {
+				BMO_elem_flag_enable(bm, e, oflag);
+			}
+			BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
+				BMO_elem_flag_enable(bm, v, oflag);
+			}
+
+			BMO_remove_tagged_faces(bm, oflag);
+			BMO_remove_tagged_edges(bm, oflag);
+			BMO_remove_tagged_verts(bm, oflag);
+
+			break;
+		}
+	}
+}
+/*************************************************************/
+
+
+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)) {
+		return;
+	}
+	copy_v3_v3(target_vertex->no, source_vertex->no);
+	CustomData_bmesh_free_block(&target_mesh->vdata, &target_vertex->head.data);
+	CustomData_bmesh_copy_data(&source_mesh->vdata, &target_mesh->vdata,
+	                           source_vertex->head.data, &target_vertex->head.data);
+}
+
+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)) {
+		return;
+	}
+	CustomData_bmesh_free_block(&target_mesh->edata, &target_edge->head.data);
+	CustomData_bmesh_copy_data(&source_mesh->edata, &target_mesh->edata,
+	                           source_edge->head.data, &target_edge->head.data);
+}
+
+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)) {
+		return;
+	}
+	CustomData_bmesh_free_block(&target_mesh->ldata, &target_loop->head.data);
+	CustomData_bmesh_copy_data(&source_mesh->ldata, &target_mesh->ldata,
+	                           source_loop->head.data, &target_loop->head.data);
+}
+
+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)) {
+		return;
+	}
+	copy_v3_v3(target_face->no, source_face->no);
+	CustomData_bmesh_free_block(&target_mesh->pdata, &target_face->head.data);
+	CustomData_bmesh_copy_data(&source_mesh->pdata, &target_mesh->pdata,
+	                           source_face->head.data, &target_face->head.data);
+	target_face->mat_nr = source_face->mat_nr;
+}
+
+/* BMESH_TODO: Special handling for hide flags? */
+
+/**
+ * Copies attributes, e.g. customdata, header flags, etc, from one element
+ * to another of the same type.
+ */
+void BM_elem_attrs_copy(BMesh *source_mesh, BMesh *target_mesh, const void *source, void *target)
+{
+	const BMHeader *sheader = source;
+	BMHeader *theader = target;
+
+	BLI_assert(sheader->htype == theader->htype);
+
+	if (sheader->htype != theader->htype)
+		return;
+
+	/* First we copy select */
+	if (BM_elem_flag_test((BMElem *)sheader, BM_ELEM_SELECT)) {
+		BM_elem_select_set(target_mesh, (BMElem *)target, TRUE);
+	}
+	
+	/* Now we copy flags */
+	theader->hflag = sheader->hflag;
+	
+	/* Copy specific attributes */
+	switch (theader->htype) {
+		case BM_VERT:
+			bm_vert_attrs_copy(source_mesh, target_mesh, (const BMVert *)source, (BMVert *)target);
+			break;
+		case BM_EDGE:
+			bm_edge_attrs_copy(source_mesh, target_mesh, (const BMEdge *)source, (BMEdge *)target);
+			break;
+		case BM_LOOP:
+			bm_loop_attrs_copy(source_mesh, target_mesh, (const BMLoop *)source, (BMLoop *)target);
+			break;
+		case BM_FACE:
+			bm_face_attrs_copy(source_mesh, target_mesh, (const BMFace *)source, (BMFace *)target);
+			break;
+		default:
+			BLI_assert(0);
+	}
+}
+
+BMesh *BM_mesh_copy(BMesh *bm_old)
+{
+	BMesh *bm_new;
+	BMVert *v, *v2, **vtable = NULL;
+	BMEdge *e, *e2, **edges = NULL, **etable = NULL;
+	BMElem **eletable;
+	BLI_array_declare(edges);
+	BMLoop *l, /* *l2, */ **loops = NULL;
+	BLI_array_declare(loops);
+	BMFace *f, *f2, **ftable = NULL;
+	BMEditSelection *ese;
+	BMIter iter, liter;
+	int i, j;
+	BMAllocTemplate allocsize = {bm_old->totvert,
+	                             bm_old->totedge,
+	                             bm_old->totloop,
+	                             bm_old->totface};
+
+	/* allocate a bmesh */
+	bm_new = BM_mesh_create(&allocsize);
+
+	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);
+	CustomData_copy(&bm_old->pdata, &bm_new->pdata, CD_MASK_BMESH, CD_CALLOC, 0);
+
+	CustomData_bmesh_init_pool(&bm_new->vdata, allocsize.totvert, BM_VERT);
+	CustomData_bmesh_init_pool(&bm_new->edata, allocsize.totedge, BM_EDGE);
+	CustomData_bmesh_init_pool(&bm_new->ldata, allocsize.totloop, BM_LOOP);
+	CustomData_bmesh_init_pool(&bm_new->pdata, allocsize.totface, BM_FACE);
+
+	vtable = MEM_mallocN(sizeof(BMVert *) * bm_old->totvert, "BM_mesh_copy vtable");
+	etable = MEM_mallocN(sizeof(BMEdge *) * bm_old->totedge, "BM_mesh_copy etable");
+	ftable = MEM_mallocN(sizeof(BMFace *) * bm_old->totface, "BM_mesh_copy ftable");
+
+	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 */
+		BM_elem_attrs_copy(bm_old, bm_new, v, v2);
+		vtable[i] = v2;
+		BM_elem_index_set(v, i); /* set_inline */
+		BM_elem_index_set(v2, i); /* set_inline */
+	}
+	bm_old->elem_index_dirty &= ~BM_VERT;
+	bm_new->elem_index_dirty &= ~BM_VERT;
+
+	/* safety check */
+	BLI_assert(i == bm_old->totvert);
+	
+	e = BM_iter_new(&iter, bm_old, BM_EDGES_OF_MESH, NULL);
+	for (i = 0; e; e = BM_iter_step(&iter), i++) {
+		e2 = BM_edge_create(bm_new,
+		                    vtable[BM_elem_index_get(e->v1)],
+		                    vtable[BM_elem_index_get(e->v2)],
+		                    e, FALSE);
+
+		BM_elem_attrs_copy(bm_old, bm_new, e, e2);
+		etable[i] = e2;
+		BM_elem_index_set(e, i); /* set_inline */
+		BM_elem_index_set(e2, i); /* set_inline */
+	}
+	bm_old->elem_index_dirty &= ~BM_EDGE;
+	bm_new->elem_index_dirty &= ~BM_EDGE;
+
+	/* safety check */
+	BLI_assert(i == bm_old->totedge);
+	
+	f = BM_iter_new(&iter, bm_old, BM_FACES_OF_MESH, NULL);
+	for (i = 0; f; f = BM_iter_step(&iter), i++) {
+		BM_elem_index_set(f, i); /* set_inline */
+
+		BLI_array_empty(loops);
+		BLI_array_empty(edges);
+		BLI_array_growitems(loops, f->len);
+		BLI_array_growitems(edges, f->len);
+
+		l = BM_iter_new(&liter, bm_old, BM_LOOPS_OF_FACE, f);
+		for (j = 0; j < f->len; j++, l = BM_iter_step(&liter)) {
+			loops[j] = l;
+			edges[j] = etable[BM_elem_index_get(l->e)];
+		}
+
+		v = vtable[BM_elem_index_get(loops[0]->v)];
+		v2 = vtable[BM_elem_index_get(loops[1]->v)];
+
+		if (!bmesh_verts_in_edge(v, v2, edges[0])) {
+			v = vtable[BM_elem_index_get(loops[BLI_array_count(loops) - 1]->v)];
+			v2 = vtable[BM_elem_index_get(loops[0]->v)];
+		}
+
+		f2 = BM_face_create_ngon(bm_new, v, v2, edges, f->len, FALSE);
+		if (!f2)
+			continue;
+		/* use totface in case adding some faces fails */
+		BM_elem_index_set(f2, (bm_new->totface - 1)); /* set_inline */
+
+		ftable[i] = f2;
+
+		BM_elem_attrs_copy(bm_old, bm_new, f, f2);
+		copy_v3_v3(f2->no, f->no);
+
+		l = BM_iter_new(&liter, bm_new, BM_LOOPS_OF_FACE, f2);
+		for (j = 0; j < f->len; j++, l = BM_iter_step(&liter)) {
+			BM_elem_attrs_copy(bm_old, bm_new, loops[j], l);
+		}
+
+		if (f == bm_old->act_face) bm_new->act_face = f2;
+	}
+	bm_old->elem_index_dirty &= ~BM_FACE;
+	bm_new->elem_index_dirty &= ~BM_FACE;
+
+	/* safety check */
+	BLI_assert(i == bm_old->totface);
+
+	/* copy over edit selection history */
+	for (ese = bm_old->selected.first; ese; ese = ese->next) {
+		BMElem *ele = NULL;
+
+		switch (ese->htype) {
+			case BM_VERT:
+				eletable = (BMElem **)vtable;
+				break;
+			case BM_EDGE:
+				eletable = (BMElem **)etable;
+				break;
+			case BM_FACE:
+				eletable = (BMElem **)ftable;
+				break;
+			default:
+				eletable = NULL;
+				break;
+		}
+
+		if (eletable) {
+			ele = eletable[BM_elem_index_get(ese->ele)];
+			if (ele) {
+				BM_select_history_store(bm_new, ele);
+			}
+		}
+	}
+
+	MEM_freeN(etable);
+	MEM_freeN(vtable);
+	MEM_freeN(ftable);
+
+	BLI_array_free(loops);
+	BLI_array_free(edges);
+
+	return bm_new;
+}
+
+/* ME -> BM */
+char BM_vert_flag_from_mflag(const char  meflag)
+{
+	return ( ((meflag & SELECT)       ? BM_ELEM_SELECT : 0) |
+	         ((meflag & ME_HIDE)      ? BM_ELEM_HIDDEN : 0)
+	         );
+}
+char BM_edge_flag_from_mflag(const short meflag)
+{
+	return ( ((meflag & SELECT)        ? BM_ELEM_SELECT : 0) |
+	         ((meflag & ME_SEAM)       ? BM_ELEM_SEAM   : 0) |
+	         ((meflag & ME_SHARP) == 0 ? BM_ELEM_SMOOTH : 0) | /* invert */
+	         ((meflag & ME_HIDE)       ? BM_ELEM_HIDDEN : 0)
+	         );
+}
+char BM_face_flag_from_mflag(const char  meflag)
+{
+	return ( ((meflag & ME_FACE_SEL)  ? BM_ELEM_SELECT : 0) |
+	         ((meflag & ME_SMOOTH)    ? BM_ELEM_SMOOTH : 0) |
+	         ((meflag & ME_HIDE)      ? BM_ELEM_HIDDEN : 0)
+	         );
+}
+
+/* BM -> ME */
+char  BM_vert_flag_to_mflag(BMVert *eve)
+{
+	const char hflag = eve->head.hflag;
+
+	return ( ((hflag & BM_ELEM_SELECT)  ? SELECT  : 0) |
+	         ((hflag & BM_ELEM_HIDDEN)  ? ME_HIDE : 0)
+	         );
+}
+short BM_edge_flag_to_mflag(BMEdge *eed)
+{
+	const char hflag = eed->head.hflag;
+
+	return ( ((hflag & BM_ELEM_SELECT)       ? SELECT    : 0) |
+	         ((hflag & BM_ELEM_SEAM)         ? ME_SEAM   : 0) |
+	         ((hflag & BM_ELEM_SMOOTH) == 0  ? ME_SHARP  : 0) |
+	         ((hflag & BM_ELEM_HIDDEN)       ? ME_HIDE   : 0) |
+	         ((BM_edge_is_wire(eed)) ? ME_LOOSEEDGE : 0) | /* not typical */
+	         (ME_EDGEDRAW | ME_EDGERENDER)
+	         );
+}
+char  BM_face_flag_to_mflag(BMFace *efa)
+{
+	const char hflag = efa->head.hflag;
+
+	return ( ((hflag & BM_ELEM_SELECT) ? ME_FACE_SEL : 0) |
+	         ((hflag & BM_ELEM_SMOOTH) ? ME_SMOOTH   : 0) |
+	         ((hflag & BM_ELEM_HIDDEN) ? ME_HIDE     : 0)
+	         );
+}
diff --git a/source/blender/bmesh/intern/bmesh_construct.h b/source/blender/bmesh/intern/bmesh_construct.h
new file mode 100644
index 0000000..29b8404
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_construct.h
@@ -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.
+ *
+ * Contributor(s): Joseph Eagar.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BMESH_CONSTRUCT_H__
+#define __BMESH_CONSTRUCT_H__
+
+/** \file blender/bmesh/intern/bmesh_construct.h
+ *  \ingroup bmesh
+ */
+
+BMFace *BM_face_create_quad_tri_v(BMesh *bm,
+                                  BMVert **verts, int len,
+                                  const BMFace *example, const int nodouble);
+
+BMFace *BM_face_create_quad_tri(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4,
+                                const BMFace *example, const int nodouble);
+
+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_vcloud(BMesh *bm, BMVert **vert_arr, int len, int nodouble);
+
+void BMO_remove_tagged_faces(BMesh *bm, const short oflag);
+void BMO_remove_tagged_edges(BMesh *bm, const short oflag);
+void BMO_remove_tagged_verts(BMesh *bm, const short oflag);
+
+void BMO_remove_tagged_context(BMesh *bm, const short oflag, const int type);
+
+void BM_elem_attrs_copy(BMesh *source_mesh, BMesh *target_mesh, const void *source, void *target);
+
+BMesh *BM_mesh_copy(BMesh *bm_old);
+
+char  BM_face_flag_from_mflag(const char  mflag);
+char  BM_edge_flag_from_mflag(const short mflag);
+char  BM_vert_flag_from_mflag(const char  mflag);
+char  BM_face_flag_to_mflag(BMFace *f);
+short BM_edge_flag_to_mflag(BMEdge *e);
+char  BM_vert_flag_to_mflag(BMVert *v);
+
+#endif /* __BMESH_CONSTRUCT_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c
new file mode 100644
index 0000000..756fd74
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -0,0 +1,2125 @@
+/*
+ * ***** 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, Geoffrey Bantle, Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/intern/bmesh_core.c
+ *  \ingroup bmesh
+ *
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_math_vector.h"
+
+#include "BKE_DerivedMesh.h"
+
+#include "BLI_listbase.h"
+#include "BLI_array.h"
+
+#include "bmesh.h"
+#include "intern/bmesh_private.h"
+
+/* use so valgrinds memcheck alerts us when undefined index is used.
+ * TESTING ONLY! */
+// #define USE_DEBUG_INDEX_MEMCHECK
+
+#ifdef USE_DEBUG_INDEX_MEMCHECK
+#define DEBUG_MEMCHECK_INDEX_INVALIDATE(ele)               \
+	{                                                      \
+		int undef_idx;                                     \
+		BM_elem_index_set(ele, undef_idx); /* set_ok_invalid */  \
+	}                                                      \
+
+#endif
+
+/**
+ * \brief Main function for creating a new vertex.
+ */
+BMVert *BM_vert_create(BMesh *bm, const float co[3], const BMVert *example)
+{
+	BMVert *v = BLI_mempool_calloc(bm->vpool);
+
+#ifdef USE_DEBUG_INDEX_MEMCHECK
+	DEBUG_MEMCHECK_INDEX_INVALIDATE(v)
+#else
+	BM_elem_index_set(v, -1); /* set_ok_invalid */
+#endif
+
+	bm->elem_index_dirty |= BM_VERT; /* may add to middle of the pool */
+
+	bm->totvert++;
+
+	v->head.htype = BM_VERT;
+
+	/* 'v->no' is handled by BM_elem_attrs_copy */
+	if (co) {
+		copy_v3_v3(v->co, co);
+	}
+
+	/* allocate flag */
+	v->oflags = BLI_mempool_calloc(bm->toolflagpool);
+
+	CustomData_bmesh_set_default(&bm->vdata, &v->head.data);
+	
+	if (example) {
+		BM_elem_attrs_copy(bm, bm, example, v);
+	}
+
+	BM_CHECK_ELEMENT(v);
+
+	return v;
+}
+
+/**
+ * \brief Main function for creating a new edge.
+ *
+ * \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 wih \a nodouble=TRUE
+ */
+BMEdge *BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *example, int nodouble)
+{
+	BMEdge *e;
+	
+	if (nodouble && (e = BM_edge_exists(v1, v2)))
+		return e;
+	
+	e = BLI_mempool_calloc(bm->epool);
+
+#ifdef USE_DEBUG_INDEX_MEMCHECK
+	DEBUG_MEMCHECK_INDEX_INVALIDATE(e)
+#else
+	BM_elem_index_set(e, -1); /* set_ok_invalid */
+#endif
+
+	bm->elem_index_dirty |= BM_EDGE; /* may add to middle of the pool */
+
+	bm->totedge++;
+
+	e->head.htype = BM_EDGE;
+	
+	/* allocate flag */
+	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);
+	
+	bmesh_disk_edge_append(e, e->v1);
+	bmesh_disk_edge_append(e, e->v2);
+	
+	if (example)
+		BM_elem_attrs_copy(bm, bm, example, e);
+	
+	BM_CHECK_ELEMENT(e);
+
+	return e;
+}
+
+static BMLoop *bm_loop_create(BMesh *bm, BMVert *v, BMEdge *e, BMFace *f, const BMLoop *example)
+{
+	BMLoop *l = NULL;
+
+	l = BLI_mempool_calloc(bm->lpool);
+	l->next = l->prev = NULL;
+	l->v = v;
+	l->e = e;
+	l->f = f;
+	l->radial_next = l->radial_prev = NULL;
+	l->head.data = NULL;
+	l->head.htype = BM_LOOP;
+
+	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);
+	}
+
+	return l;
+}
+
+static BMLoop *bm_face_boundary_add(BMesh *bm, BMFace *f, BMVert *startv, BMEdge *starte)
+{
+#ifdef USE_BMESH_HOLES
+	BMLoopList *lst = BLI_mempool_calloc(bm->looplistpool);
+#endif
+	BMLoop *l = bm_loop_create(bm, startv, starte, f, NULL);
+	
+	bmesh_radial_append(starte, l);
+
+#ifdef USE_BMESH_HOLES
+	lst->first = lst->last = l;
+	BLI_addtail(&f->loops, lst);
+#else
+	f->l_first = l;
+#endif
+
+	l->f = f;
+	
+	return l;
+}
+
+BMFace *BM_face_copy(BMesh *bm, BMFace *f, const short copyverts, const short copyedges)
+{
+	BMEdge **edges = NULL;
+	BMVert **verts = NULL;
+	BLI_array_staticdeclare(edges, BM_NGON_STACK_SIZE);
+	BLI_array_staticdeclare(verts, BM_NGON_STACK_SIZE);
+	BMLoop *l_iter;
+	BMLoop *l_first;
+	BMLoop *l_copy;
+	BMFace *f_copy;
+	int i;
+
+	/* BMESH_TODO - grow verts array in one go! (right here) */
+	l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+	do {
+		if (copyverts) {
+			BMVert *v = BM_vert_create(bm, l_iter->v->co, l_iter->v);
+			BLI_array_append(verts, v);
+		}
+		else {
+			BLI_array_append(verts, l_iter->v);
+		}
+	} while ((l_iter = l_iter->next) != l_first);
+
+	/* BMESH_TODO - grow edges array in one go! (right here) */
+	l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+	i = 0;
+	do {
+		if (copyedges) {
+			BMEdge *e;
+			BMVert *v1, *v2;
+			
+			if (l_iter->e->v1 == verts[i]) {
+				v1 = verts[i];
+				v2 = verts[(i + 1) % f->len];
+			}
+			else {
+				v2 = verts[i];
+				v1 = verts[(i + 1) % f->len];
+			}
+			
+			e = BM_edge_create(bm,  v1, v2, l_iter->e, FALSE);
+			BLI_array_append(edges, e);
+		}
+		else {
+			BLI_array_append(edges, l_iter->e);
+		}
+		
+		i++;
+	} while ((l_iter = l_iter->next) != l_first);
+	
+	f_copy = BM_face_create(bm, verts, edges, f->len, FALSE);
+	
+	BM_elem_attrs_copy(bm, bm, f, f_copy);
+	
+	l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+	l_copy = BM_FACE_FIRST_LOOP(f_copy);
+	do {
+		BM_elem_attrs_copy(bm, bm, l_iter, l_copy);
+		l_copy = l_copy->next;
+	} while ((l_iter = l_iter->next) != l_first);
+	
+	return f_copy;
+}
+
+/**
+ * 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)
+{
+	BMFace *f;
+
+	f = BLI_mempool_calloc(bm->fpool);
+
+#ifdef USE_DEBUG_INDEX_MEMCHECK
+	DEBUG_MEMCHECK_INDEX_INVALIDATE(f)
+#else
+	BM_elem_index_set(f, -1); /* set_ok_invalid */
+#endif
+
+	bm->elem_index_dirty |= BM_FACE; /* may add to middle of the pool */
+
+	bm->totface++;
+
+	f->head.htype = BM_FACE;
+
+	/* allocate flag */
+	f->oflags = BLI_mempool_calloc(bm->toolflagpool);
+
+	CustomData_bmesh_set_default(&bm->pdata, &f->head.data);
+
+#ifdef USE_BMESH_HOLES
+	f->totbounds = 0;
+#endif
+
+	return f;
+}
+
+/**
+ * \brief Main face creation function
+ */
+BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len, int nodouble)
+{
+	BMFace *f = NULL;
+	BMLoop *l, *startl, *lastl;
+	int i, overlap;
+	
+	if (len == 0) {
+		/* just return NULL for no */
+		return NULL;
+	}
+
+	if (nodouble) {
+		/* Check if face already exists */
+		overlap = BM_face_exists(bm, verts, len, &f);
+		if (overlap) {
+			return f;
+		}
+		else {
+			BLI_assert(f == NULL);
+		}
+	}
+
+	f = bm_face_create__internal(bm);
+
+	startl = lastl = bm_face_boundary_add(bm, f, verts[0], edges[0]);
+	
+	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->f = f;
+		bmesh_radial_append(edges[i], l);
+
+		l->prev = lastl;
+		lastl->next = l;
+		lastl = l;
+	}
+	
+	startl->prev = lastl;
+	lastl->next = startl;
+	
+	f->len = len;
+	
+	BM_CHECK_ELEMENT(f);
+
+	return f;
+}
+
+/**
+ * Check the element is valid.
+ *
+ * BMESH_TODO, when this raises an error the output is incredible confusing.
+ * need to have some nice way to print/debug what the hecks going on.
+ */
+int bmesh_elem_check(void *element, const char htype)
+{
+	BMHeader *head = element;
+	int err = 0;
+
+	if (!element)
+		return 1;
+
+	if (head->htype != htype)
+		return 2;
+	
+	switch (htype) {
+		case BM_VERT: {
+			BMVert *v = element;
+			if (v->e && v->e->head.htype != BM_EDGE) {
+				err |= 4;
+			}
+			break;
+		}
+		case BM_EDGE: {
+			BMEdge *e = element;
+			if (e->l && e->l->head.htype != BM_LOOP)
+				err |= 8;
+			if (e->l && e->l->f->head.htype != BM_FACE)
+				err |= 16;
+			if (e->v1_disk_link.prev == NULL ||
+			    e->v2_disk_link.prev == NULL ||
+			    e->v1_disk_link.next == NULL ||
+			    e->v2_disk_link.next == NULL)
+			{
+				err |= 32;
+			}
+			if (e->l && (e->l->radial_next == NULL || e->l->radial_prev == NULL))
+				err |= 64;
+			if (e->l && e->l->f->len <= 0)
+				err |= 128;
+			break;
+		}
+		case BM_LOOP: {
+			BMLoop *l = element, *l2;
+			int i;
+
+			if (l->f->head.htype != BM_FACE)
+				err |= 256;
+			if (l->e->head.htype != BM_EDGE)
+				err |= 512;
+			if (l->v->head.htype !=  BM_VERT)
+				err |= 1024;
+			if (!BM_vert_in_edge(l->e, l->v)) {
+				fprintf(stderr, "%s: fatal bmesh error (vert not in edge)! (bmesh internal error)\n", __func__);
+				err |= 2048;
+			}
+
+			if (l->radial_next == NULL || l->radial_prev == NULL)
+				err |= (1 << 12);
+			if (l->f->len <= 0)
+				err |= (1 << 13);
+
+			/* validate boundary loop -- invalid for hole loops, of course,
+			 * but we won't be allowing those for a while yet */
+			l2 = l;
+			i = 0;
+			do {
+				if (i >= BM_NGON_MAX) {
+					break;
+				}
+
+				i++;
+			} while ((l2 = l2->next) != l);
+
+			if (i != l->f->len || l2 != l)
+				err |= (1 << 14);
+
+			if (!bmesh_radial_validate(bmesh_radial_length(l), l))
+				err |= (1 << 15);
+
+			break;
+		}
+		case BM_FACE: {
+			BMFace *f = element;
+			BMLoop *l_iter;
+			BMLoop *l_first;
+			int len = 0;
+
+#ifdef USE_BMESH_HOLES
+			if (!f->loops.first)
+#else
+			if (!f->l_first)
+#endif
+			{
+				err |= (1 << 16);
+			}
+			l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+			do {
+				if (l_iter->f != f) {
+					fprintf(stderr, "%s: loop inside one face points to another! (bmesh internal error)\n", __func__);
+					err |= (1 << 17);
+				}
+
+				if (!l_iter->e)
+					err |= (1 << 18);
+				if (!l_iter->v)
+					err |= (1 << 19);
+				if (!BM_vert_in_edge(l_iter->e, l_iter->v) || !BM_vert_in_edge(l_iter->e, l_iter->next->v)) {
+					err |= (1 << 20);
+				}
+
+				if (!bmesh_radial_validate(bmesh_radial_length(l_iter), l_iter))
+					err |= (1 << 21);
+
+				if (!bmesh_disk_count(l_iter->v) || !bmesh_disk_count(l_iter->next->v))
+					err |= (1 << 22);
+
+				len++;
+			} while ((l_iter = l_iter->next) != l_first);
+
+			if (len != f->len)
+				err |= (1 << 23);
+		}
+	}
+
+	BMESH_ASSERT(err == 0);
+
+	return err;
+}
+
+/**
+ * low level function, only frees the vert,
+ * doesn't change or adjust surrounding geometry
+ */
+static void bm_kill_only_vert(BMesh *bm, BMVert *v)
+{
+	bm->totvert--;
+	bm->elem_index_dirty |= BM_VERT;
+
+	BM_select_history_remove(bm, v);
+
+	if (v->head.data)
+		CustomData_bmesh_free_block(&bm->vdata, &v->head.data);
+
+	BLI_mempool_free(bm->toolflagpool, v->oflags);
+	BLI_mempool_free(bm->vpool, v);
+}
+
+/**
+ * low level function, only frees the edge,
+ * doesn't change or adjust surrounding geometry
+ */
+static void bm_kill_only_edge(BMesh *bm, BMEdge *e)
+{
+	bm->totedge--;
+	bm->elem_index_dirty |= BM_EDGE;
+
+	BM_select_history_remove(bm, (BMElem *)e);
+
+	if (e->head.data)
+		CustomData_bmesh_free_block(&bm->edata, &e->head.data);
+
+	BLI_mempool_free(bm->toolflagpool, e->oflags);
+	BLI_mempool_free(bm->epool, e);
+}
+
+/**
+ * low level function, only frees the face,
+ * doesn't change or adjust surrounding geometry
+ */
+static void bm_kill_only_face(BMesh *bm, BMFace *f)
+{
+	if (bm->act_face == f)
+		bm->act_face = NULL;
+
+	bm->totface--;
+	bm->elem_index_dirty |= BM_FACE;
+
+	BM_select_history_remove(bm, (BMElem *)f);
+
+	if (f->head.data)
+		CustomData_bmesh_free_block(&bm->pdata, &f->head.data);
+
+	BLI_mempool_free(bm->toolflagpool, f->oflags);
+	BLI_mempool_free(bm->fpool, f);
+}
+
+/**
+ * low level function, only frees the loop,
+ * doesn't change or adjust surrounding geometry
+ */
+static void bm_kill_only_loop(BMesh *bm, BMLoop *l)
+{
+	bm->totloop--;
+	if (l->head.data)
+		CustomData_bmesh_free_block(&bm->ldata, &l->head.data);
+
+	BLI_mempool_free(bm->lpool, l);
+}
+
+/**
+ * kills all edges associated with \a f, along with any other faces containing
+ * those edges
+ */
+void BM_face_edges_kill(BMesh *bm, BMFace *f)
+{
+	BMEdge **edges = NULL;
+	BLI_array_staticdeclare(edges, BM_NGON_STACK_SIZE);
+	BMLoop *l_iter;
+	BMLoop *l_first;
+	int i;
+	
+	l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+	do {
+		BLI_array_append(edges, l_iter->e);
+	} while ((l_iter = l_iter->next) != l_first);
+	
+	for (i = 0; i < BLI_array_count(edges); i++) {
+		BM_edge_kill(bm, edges[i]);
+	}
+	
+	BLI_array_free(edges);
+}
+
+/**
+ * kills all verts associated with \a f, along with any other faces containing
+ * those vertices
+ */
+void BM_face_verts_kill(BMesh *bm, BMFace *f)
+{
+	BMVert **verts = NULL;
+	BLI_array_staticdeclare(verts, BM_NGON_STACK_SIZE);
+	BMLoop *l_iter;
+	BMLoop *l_first;
+	int i;
+	
+	l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+	do {
+		BLI_array_append(verts, l_iter->v);
+	} while ((l_iter = l_iter->next) != l_first);
+	
+	for (i = 0; i < BLI_array_count(verts); i++) {
+		BM_vert_kill(bm, verts[i]);
+	}
+	
+	BLI_array_free(verts);
+}
+
+void BM_face_kill(BMesh *bm, BMFace *f)
+{
+#ifdef USE_BMESH_HOLES
+	BMLoopList *ls, *ls_next;
+#endif
+
+	BM_CHECK_ELEMENT(f);
+
+#ifdef USE_BMESH_HOLES
+	for (ls = f->loops.first; ls; ls = ls_next)
+#else
+	if (f->l_first)
+#endif
+	{
+		BMLoop *l_iter, *l_next, *l_first;
+
+#ifdef USE_BMESH_HOLES
+		ls_next = ls->next;
+		l_iter = l_first = ls->first;
+#else
+		l_iter = l_first = f->l_first;
+#endif
+
+		do {
+			l_next = l_iter->next;
+
+			bmesh_radial_loop_remove(l_iter, l_iter->e);
+			bm_kill_only_loop(bm, l_iter);
+
+		} while ((l_iter = l_next) != l_first);
+
+#ifdef USE_BMESH_HOLES
+		BLI_mempool_free(bm->looplistpool, ls);
+#endif
+	}
+
+	bm_kill_only_face(bm, f);
+}
+/**
+ * kills \a e and all faces that use it.
+ */
+void BM_edge_kill(BMesh *bm, BMEdge *e)
+{
+
+	bmesh_disk_edge_remove(e, e->v1);
+	bmesh_disk_edge_remove(e, e->v2);
+
+	if (e->l) {
+		BMLoop *l = e->l, *lnext, *startl = e->l;
+
+		do {
+			lnext = l->radial_next;
+			if (lnext->f == l->f) {
+				BM_face_kill(bm, l->f);
+				break;
+			}
+			
+			BM_face_kill(bm, l->f);
+
+			if (l == lnext)
+				break;
+			l = lnext;
+		} while (l != startl);
+	}
+	
+	bm_kill_only_edge(bm, e);
+}
+
+/**
+ * kills \a v and all edges that use it.
+ */
+void BM_vert_kill(BMesh *bm, BMVert *v)
+{
+	if (v->e) {
+		BMEdge *e, *nexte;
+		
+		e = v->e;
+		while (v->e) {
+			nexte = bmesh_disk_edge_next(e, v);
+			BM_edge_kill(bm, e);
+			e = nexte;
+		}
+	}
+
+	bm_kill_only_vert(bm, v);
+}
+
+/********** private disk and radial cycle functions ********** */
+
+static int bm_loop_length(BMLoop *l)
+{
+	BMLoop *l_first = l;
+	int i = 0;
+
+	do {
+		i++;
+	} while ((l = l->next) != l_first);
+
+	return i;
+}
+
+/**
+ * \brief Loop Reverse
+ *
+ * Changes the winding order of a face from CW to CCW or vice versa.
+ * This euler is a bit peculiar in comparison to others as it is its
+ * own inverse.
+ *
+ * BMESH_TODO: reinsert validation code.
+ *
+ * \return Success
+ */
+static int bm_loop_reverse_loop(BMesh *bm, BMFace *f
+#ifdef USE_BMESH_HOLES
+                                , BMLoopList *lst
+#endif
+                                )
+{
+
+#ifdef USE_BMESH_HOLES
+	BMLoop *l_first = lst->first;
+#else
+	BMLoop *l_first = f->l_first;
+#endif
+
+	BMLoop *l_iter, *oldprev, *oldnext;
+	BMEdge **edar = NULL;
+	MDisps *md;
+	BLI_array_staticdeclare(edar, BM_NGON_STACK_SIZE);
+	int i, j, edok, len = 0, do_disps = CustomData_has_layer(&bm->ldata, CD_MDISPS);
+
+	len = bm_loop_length(l_first);
+
+	for (i = 0, l_iter = l_first; i < len; i++, l_iter = l_iter->next) {
+		BMEdge *curedge = l_iter->e;
+		bmesh_radial_loop_remove(l_iter, curedge);
+		BLI_array_append(edar, curedge);
+	}
+
+	/* actually reverse the loop */
+	for (i = 0, l_iter = l_first; i < len; i++) {
+		oldnext = l_iter->next;
+		oldprev = l_iter->prev;
+		l_iter->next = oldprev;
+		l_iter->prev = oldnext;
+		l_iter = oldnext;
+		
+		if (do_disps) {
+			float (*co)[3];
+			int x, y, sides;
+			
+			md = CustomData_bmesh_get(&bm->ldata, l_iter->head.data, CD_MDISPS);
+			if (!md->totdisp || !md->disps)
+				continue;
+
+			sides = (int)sqrt(md->totdisp);
+			co = md->disps;
+			
+			for (x = 0; x < sides; x++) {
+				for (y = 0; y < x; y++) {
+					swap_v3_v3(co[y * sides + x], co[sides * x + y]);
+				}
+			}
+		}
+	}
+
+	if (len == 2) { /* two edged face */
+		/* do some verification here! */
+		l_first->e = edar[1];
+		l_first->next->e = edar[0];
+	}
+	else {
+		for (i = 0, l_iter = l_first; i < len; i++, l_iter = l_iter->next) {
+			edok = 0;
+			for (j = 0; j < len; j++) {
+				edok = bmesh_verts_in_edge(l_iter->v, l_iter->next->v, edar[j]);
+				if (edok) {
+					l_iter->e = edar[j];
+					break;
+				}
+			}
+		}
+	}
+	/* rebuild radia */
+	for (i = 0, l_iter = l_first; i < len; i++, l_iter = l_iter->next)
+		bmesh_radial_append(l_iter->e, l_iter);
+
+	/* validate radia */
+	for (i = 0, l_iter = l_first; i < len; i++, l_iter = l_iter->next) {
+		BM_CHECK_ELEMENT(l_iter);
+		BM_CHECK_ELEMENT(l_iter->e);
+		BM_CHECK_ELEMENT(l_iter->v);
+		BM_CHECK_ELEMENT(l_iter->f);
+	}
+
+	BLI_array_free(edar);
+
+	BM_CHECK_ELEMENT(f);
+
+	return 1;
+}
+
+/**
+ * \brief Flip the faces direction
+ */
+int bmesh_loop_reverse(BMesh *bm, BMFace *f)
+{
+#ifdef USE_BMESH_HOLES
+	return bmesh_loop_reverse_loop(bm, f, f->loops.first);
+#else
+	return bm_loop_reverse_loop(bm, f);
+#endif
+}
+
+static void bm_elements_systag_enable(void *veles, int tot, int flag)
+{
+	BMHeader **eles = veles;
+	int i;
+
+	for (i = 0; i < tot; i++) {
+		BM_ELEM_API_FLAG_ENABLE((BMElemF *)eles[i], flag);
+	}
+}
+
+static void bm_elements_systag_disable(void *veles, int tot, int flag)
+{
+	BMHeader **eles = veles;
+	int i;
+
+	for (i = 0; i < tot; i++) {
+		BM_ELEM_API_FLAG_DISABLE((BMElemF *)eles[i], flag);
+	}
+}
+
+#define FACE_MARK  (1 << 10)
+
+static int count_flagged_radial(BMesh *bm, BMLoop *l, int flag)
+{
+	BMLoop *l2 = l;
+	int i = 0, c = 0;
+
+	do {
+		if (UNLIKELY(!l2)) {
+			BMESH_ASSERT(0);
+			goto error;
+		}
+		
+		i += BM_ELEM_API_FLAG_TEST(l2->f, flag) ? 1 : 0;
+		l2 = l2->radial_next;
+		if (UNLIKELY(c >= BM_LOOP_RADIAL_MAX)) {
+			BMESH_ASSERT(0);
+			goto error;
+		}
+		c++;
+	} while (l2 != l);
+
+	return i;
+
+error:
+	BMO_error_raise(bm, bm->currentop, BMERR_MESH_ERROR, NULL);
+	return 0;
+}
+
+static int UNUSED_FUNCTION(count_flagged_disk)(BMVert *v, int flag)
+{
+	BMEdge *e = v->e;
+	int i = 0;
+
+	if (!e)
+		return 0;
+
+	do {
+		i += BM_ELEM_API_FLAG_TEST(e, flag) ? 1 : 0;
+	} while ((e = bmesh_disk_edge_next(e, v)) != v->e);
+
+	return i;
+}
+
+static int disk_is_flagged(BMVert *v, int flag)
+{
+	BMEdge *e = v->e;
+
+	if (!e)
+		return FALSE;
+
+	do {
+		BMLoop *l = e->l;
+
+		if (!l) {
+			return FALSE;
+		}
+		
+		if (bmesh_radial_length(l) == 1)
+			return FALSE;
+		
+		do {
+			if (!BM_ELEM_API_FLAG_TEST(l->f, flag))
+				return FALSE;
+
+			l = l->radial_next;
+		} while (l != e->l);
+
+		e = bmesh_disk_edge_next(e, v);
+	} while (e != v->e);
+
+	return TRUE;
+}
+
+/* Mid-level Topology Manipulation Functions */
+
+/**
+ * \brief Join Connected Faces
+ *
+ * Joins a collected group of faces into one. Only restriction on
+ * the input data is that the faces must be connected to each other.
+ *
+ * \return The newly created combine BMFace.
+ *
+ * \note If a pair of faces share multiple edges,
+ * the pair of faces will be joined at every edge.
+ *
+ * \note this is a generic, flexible join faces function,
+ * almost everything uses this, including #BM_faces_join_pair
+ */
+BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const short do_del)
+{
+	BMFace *f, *newf;
+#ifdef USE_BMESH_HOLES
+	BMLoopList *lst;
+	ListBase holes = {NULL, NULL};
+#endif
+	BMLoop *l_iter;
+	BMLoop *l_first;
+	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);
+	BMVert *v1 = NULL, *v2 = NULL;
+	const char *err = NULL;
+	int i, tote = 0;
+
+	if (UNLIKELY(!totface)) {
+		BMESH_ASSERT(0);
+		return NULL;
+	}
+
+	if (totface == 1)
+		return faces[0];
+
+	bm_elements_systag_enable(faces, totface, _FLAG_JF);
+
+	for (i = 0; i < totface; i++) {
+		f = faces[i];
+		l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+		do {
+			int rlen = count_flagged_radial(bm, l_iter, _FLAG_JF);
+
+			if (rlen > 2) {
+				err = "Input faces do not form a contiguous manifold region";
+				goto error;
+			}
+			else if (rlen == 1) {
+				BLI_array_append(edges, l_iter->e);
+
+				if (!v1) {
+					v1 = l_iter->v;
+					v2 = BM_edge_other_vert(l_iter->e, l_iter->v);
+				}
+				tote++;
+			}
+			else if (rlen == 2) {
+				int d1, d2;
+
+				d1 = disk_is_flagged(l_iter->e->v1, _FLAG_JF);
+				d2 = disk_is_flagged(l_iter->e->v2, _FLAG_JF);
+
+				if (!d1 && !d2 && !BM_ELEM_API_FLAG_TEST(l_iter->e, _FLAG_JF)) {
+					/* don't remove an edge it makes up the side of another face
+					 * else this will remove the face as well - campbell */
+					if (BM_edge_face_count(l_iter->e) <= 2) {
+						if (do_del) {
+							BLI_array_append(deledges, l_iter->e);
+						}
+						BM_ELEM_API_FLAG_ENABLE(l_iter->e, _FLAG_JF);
+					}
+				}
+				else {
+					if (d1 && !BM_ELEM_API_FLAG_TEST(l_iter->e->v1, _FLAG_JF)) {
+						if (do_del) {
+							BLI_array_append(delverts, l_iter->e->v1);
+						}
+						BM_ELEM_API_FLAG_ENABLE(l_iter->e->v1, _FLAG_JF);
+					}
+
+					if (d2 && !BM_ELEM_API_FLAG_TEST(l_iter->e->v2, _FLAG_JF)) {
+						if (do_del) {
+							BLI_array_append(delverts, l_iter->e->v2);
+						}
+						BM_ELEM_API_FLAG_ENABLE(l_iter->e->v2, _FLAG_JF);
+					}
+				}
+			}
+		} while ((l_iter = l_iter->next) != l_first);
+
+#ifdef USE_BMESH_HOLES
+		for (lst = f->loops.first; lst; lst = lst->next) {
+			if (lst == f->loops.first) {
+				continue;
+			}
+
+			BLI_remlink(&f->loops, lst);
+			BLI_addtail(&holes, lst);
+		}
+#endif
+
+	}
+
+	/* create region face */
+	newf = BM_face_create_ngon(bm, v1, v2, edges, tote, FALSE);
+	if (!newf || BMO_error_occurred(bm)) {
+		if (!BMO_error_occurred(bm))
+			err = "Invalid boundary region to join faces";
+		goto error;
+	}
+
+	/* copy over loop data */
+	l_iter = l_first = BM_FACE_FIRST_LOOP(newf);
+	do {
+		BMLoop *l2 = l_iter->radial_next;
+
+		do {
+			if (BM_ELEM_API_FLAG_TEST(l2->f, _FLAG_JF))
+				break;
+			l2 = l2->radial_next;
+		} while (l2 != l_iter);
+
+		if (l2 != l_iter) {
+			/* I think this is correct */
+			if (l2->v != l_iter->v) {
+				l2 = l2->next;
+			}
+
+			BM_elem_attrs_copy(bm, bm, l2, l_iter);
+		}
+	} while ((l_iter = l_iter->next) != l_first);
+	
+	BM_elem_attrs_copy(bm, bm, faces[0], newf);
+
+#ifdef USE_BMESH_HOLES
+	/* add hole */
+	BLI_movelisttolist(&newf->loops, &holes);
+#endif
+
+	/* update loop face pointer */
+#ifdef USE_BMESH_HOLES
+	for (lst = newf->loops.first; lst; lst = lst->next)
+#endif
+	{
+#ifdef USE_BMESH_HOLES
+		l_iter = l_first = lst->first;
+#else
+		l_iter = l_first = BM_FACE_FIRST_LOOP(newf);
+#endif
+		do {
+			l_iter->f = newf;
+		} while ((l_iter = l_iter->next) != l_first);
+	}
+
+	bm_elements_systag_disable(faces, totface, _FLAG_JF);
+	BM_ELEM_API_FLAG_DISABLE(newf, _FLAG_JF);
+
+	/* handle multi-res data */
+	if (CustomData_has_layer(&bm->ldata, CD_MDISPS)) {
+		l_iter = l_first = BM_FACE_FIRST_LOOP(newf);
+		do {
+			for (i = 0; i < totface; i++) {
+				BM_loop_interp_multires(bm, l_iter, faces[i]);
+			}
+		} while ((l_iter = l_iter->next) != l_first);
+	}
+
+	/* delete old geometry */
+	if (do_del) {
+		for (i = 0; i < BLI_array_count(deledges); i++) {
+			BM_edge_kill(bm, deledges[i]);
+		}
+
+		for (i = 0; i < BLI_array_count(delverts); i++) {
+			BM_vert_kill(bm, delverts[i]);
+		}
+	}
+	else {
+		/* otherwise we get both old and new faces */
+		for (i = 0; i < totface; i++) {
+			BM_face_kill(bm, faces[i]);
+		}
+	}
+	
+	BLI_array_free(edges);
+	BLI_array_free(deledges);
+	BLI_array_free(delverts);
+
+	BM_CHECK_ELEMENT(newf);
+	return newf;
+
+error:
+	bm_elements_systag_disable(faces, totface, _FLAG_JF);
+	BLI_array_free(edges);
+	BLI_array_free(deledges);
+	BLI_array_free(delverts);
+
+	if (err) {
+		BMO_error_raise(bm, bm->currentop, BMERR_DISSOLVEFACES_FAILED, err);
+	}
+	return NULL;
+}
+
+static BMFace *bm_face_create__sfme(BMesh *bm, BMFace *UNUSED(example))
+{
+	BMFace *f;
+#ifdef USE_BMESH_HOLES
+	BMLoopList *lst;
+#endif
+
+	f = bm_face_create__internal(bm);
+
+#ifdef USE_BMESH_HOLES
+	lst = BLI_mempool_calloc(bm->looplistpool);
+	BLI_addtail(&f->loops, lst);
+#endif
+
+#ifdef USE_BMESH_HOLES
+	f->totbounds = 1;
+#endif
+
+	return f;
+}
+
+/**
+ * \brief Split Face Make Edge (SFME)
+ *
+ * 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.
+ *
+ * \par Examples:
+ *
+ *     Before:               After:
+ *      +--------+           +--------+
+ *      |        |           |        |
+ *      |        |           |   f1   |
+ *     v1   f1   v2          v1======v2
+ *      |        |           |   f2   |
+ *      |        |           |        |
+ *      +--------+           +--------+
+ *
+ * \note the input vertices can be part of the same edge. This will
+ * result in a two edged face. This is desirable for advanced construction
+ * tools and particularly essential for edge bevel. Because of this it is
+ * up to the caller to decide what to do with the extra edge.
+ *
+ * \note If \a holes is NULL, then both faces will lose
+ * all holes from the original face.  Also, you cannot split between
+ * a hole vert and a boundary vert; that case is handled by higher-
+ * level wrapping functions (when holes are fully implemented, anyway).
+ *
+ * \note that holes represents which holes goes to the new face, and of
+ * course this requires removing them from the existing face first, since
+ * you cannot have linked list links inside multiple lists.
+ *
+ * \return A BMFace pointer
+ */
+BMFace *bmesh_sfme(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2,
+                   BMLoop **r_l,
+#ifdef USE_BMESH_HOLES
+                   ListBase *holes,
+#endif
+                   BMEdge *example,
+                   const short nodouble
+                   )
+{
+#ifdef USE_BMESH_HOLES
+	BMLoopList *lst, *lst2;
+#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;
+
+	/* verify that v1 and v2 are in face */
+	len = f->len;
+	for (i = 0, l_iter = BM_FACE_FIRST_LOOP(f); i < len; i++, l_iter = l_iter->next) {
+		if (l_iter->v == v1) v1loop = l_iter;
+		else if (l_iter->v == v2) v2loop = l_iter;
+	}
+
+	if (!v1loop || !v2loop) {
+		return NULL;
+	}
+
+	/* allocate new edge between v1 and v2 */
+	e = BM_edge_create(bm, v1, v2, example, nodouble);
+
+	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->prev = v2loop->prev;
+	f2loop->prev = v1loop->prev;
+	v2loop->prev->next = f1loop;
+	v1loop->prev->next = f2loop;
+
+	f1loop->next = v1loop;
+	f2loop->next = v2loop;
+	v1loop->prev = f1loop;
+	v2loop->prev = f2loop;
+
+#ifdef USE_BMESH_HOLES
+	lst = f->loops.first;
+	lst2 = f2->loops.first;
+
+	lst2->first = lst2->last = f2loop;
+	lst->first = lst->last = f1loop;
+#else
+	/* find which of the faces the original first loop is in */
+	l_iter = l_first = f1loop;
+	first_loop_f1 = 0;
+	do {
+		if (l_iter == f->l_first)
+			first_loop_f1 = 1;
+	} while ((l_iter = l_iter->next) != l_first);
+
+	if (first_loop_f1) {
+		/* original first loop was in f1, find a suitable first loop for f2
+		 * which is as similar as possible to f1. the order matters for tools
+		 * such as duplifaces. */
+		if (f->l_first->prev == f1loop)
+			f2->l_first = f2loop->prev;
+		else if (f->l_first->next == f1loop)
+			f2->l_first = f2loop->next;
+		else
+			f2->l_first = f2loop;
+	}
+	else {
+		/* original first loop was in f2, further do same as above */
+		f2->l_first = f->l_first;
+
+		if (f->l_first->prev == f2loop)
+			f->l_first = f1loop->prev;
+		else if (f->l_first->next == f2loop)
+			f->l_first = f1loop->next;
+		else
+			f->l_first = f1loop;
+	}
+#endif
+
+	/* validate both loop */
+	/* I don't know how many loops are supposed to be in each face at this point! FIXME */
+
+	/* go through all of f2's loops and make sure they point to it properly */
+	l_iter = l_first = BM_FACE_FIRST_LOOP(f2);
+	f2len = 0;
+	do {
+		l_iter->f = f2;
+		f2len++;
+	} while ((l_iter = l_iter->next) != l_first);
+
+	/* link up the new loops into the new edges radial */
+	bmesh_radial_append(e, f1loop);
+	bmesh_radial_append(e, f2loop);
+
+	f2->len = f2len;
+
+	f1len = 0;
+	l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+	do {
+		f1len++;
+	} while ((l_iter = l_iter->next) != l_first);
+
+	f->len = f1len;
+
+	if (r_l) *r_l = f2loop;
+
+#ifdef USE_BMESH_HOLES
+	if (holes) {
+		BLI_movelisttolist(&f2->loops, holes);
+	}
+	else {
+		/* this code is not significant until holes actually work */
+		//printf("warning: call to split face euler without holes argument; holes will be tossed.\n");
+		for (lst = f->loops.last; lst != f->loops.first; lst = lst2) {
+			lst2 = lst->prev;
+			BLI_mempool_free(bm->looplistpool, lst);
+		}
+	}
+#endif
+
+	BM_CHECK_ELEMENT(e);
+	BM_CHECK_ELEMENT(f);
+	BM_CHECK_ELEMENT(f2);
+	
+	return f2;
+}
+
+/**
+ * \brief Split Edge Make Vert (SEMV)
+ *
+ * Takes \a e edge and splits it into two, creating a new vert.
+ * \a tv should be one end of \a e : the newly created edge
+ * will be attached to that end and is returned in \a r_e.
+ *
+ * \par Examples:
+ *
+ *                     E
+ *     Before: OV-------------TV
+ *
+ *                 E       RE
+ *     After:  OV------NV-----TV
+ *
+ * \return The newly created BMVert pointer.
+ */
+BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e)
+{
+	BMLoop *nextl;
+	BMEdge *ne;
+	BMVert *nv, *ov;
+	int i, edok, valence1 = 0, valence2 = 0;
+
+	BLI_assert(bmesh_vert_in_edge(e, tv) != FALSE);
+
+	ov = bmesh_edge_other_vert_get(e, tv);
+
+	valence1 = bmesh_disk_count(ov);
+
+	valence2 = bmesh_disk_count(tv);
+
+	nv = BM_vert_create(bm, tv->co, tv);
+	ne = BM_edge_create(bm, nv, tv, e, FALSE);
+
+	bmesh_disk_edge_remove(ne, tv);
+	bmesh_disk_edge_remove(ne, nv);
+
+	/* remove e from tv's disk cycle */
+	bmesh_disk_edge_remove(e, tv);
+
+	/* swap out tv for nv in e */
+	bmesh_edge_swapverts(e, tv, nv);
+
+	/* add e to nv's disk cycle */
+	bmesh_disk_edge_append(e, nv);
+
+	/* add ne to nv's disk cycle */
+	bmesh_disk_edge_append(ne, nv);
+
+	/* add ne to tv's disk cycle */
+	bmesh_disk_edge_append(ne, tv);
+
+	/* verify disk cycle */
+	edok = bmesh_disk_validate(valence1, ov->e, ov);
+	BMESH_ASSERT(edok != FALSE);
+	edok = bmesh_disk_validate(valence2, tv->e, tv);
+	BMESH_ASSERT(edok != FALSE);
+	edok = bmesh_disk_validate(2, nv->e, nv);
+	BMESH_ASSERT(edok != FALSE);
+
+	/* Split the radial cycle if present */
+	nextl = e->l;
+	e->l = NULL;
+	if (nextl) {
+		BMLoop *nl, *l;
+		int radlen = bmesh_radial_length(nextl);
+		int first1 = 0, first2 = 0;
+
+		/* Take the next loop. Remove it from radial. Split it. Append to appropriate radials */
+		while (nextl) {
+			l = nextl;
+			l->f->len++;
+			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->prev = l;
+			nl->next = (l->next);
+			nl->prev->next = nl;
+			nl->next->prev = nl;
+			nl->v = nv;
+
+			/* assign the correct edge to the correct loop */
+			if (bmesh_verts_in_edge(nl->v, nl->next->v, e)) {
+				nl->e = e;
+				l->e = ne;
+
+				/* append l into ne's rad cycle */
+				if (!first1) {
+					first1 = 1;
+					l->radial_next = l->radial_prev = NULL;
+				}
+
+				if (!first2) {
+					first2 = 1;
+					l->radial_next = l->radial_prev = NULL;
+				}
+				
+				bmesh_radial_append(nl->e, nl);
+				bmesh_radial_append(l->e, l);
+			}
+			else if (bmesh_verts_in_edge(nl->v, nl->next->v, ne)) {
+				nl->e = ne;
+				l->e = e;
+
+				/* append l into ne's rad cycle */
+				if (!first1) {
+					first1 = 1;
+					l->radial_next = l->radial_prev = NULL;
+				}
+
+				if (!first2) {
+					first2 = 1;
+					l->radial_next = l->radial_prev = NULL;
+				}
+
+				bmesh_radial_append(nl->e, nl);
+				bmesh_radial_append(l->e, l);
+			}
+
+		}
+
+		/* verify length of radial cycle */
+		edok = bmesh_radial_validate(radlen, e->l);
+		BMESH_ASSERT(edok != FALSE);
+		edok = bmesh_radial_validate(radlen, ne->l);
+		BMESH_ASSERT(edok != FALSE);
+
+		/* verify loop->v and loop->next->v pointers for e */
+		for (i = 0, l = e->l; i < radlen; i++, l = l->radial_next) {
+			BMESH_ASSERT(l->e == e);
+			//BMESH_ASSERT(l->radial_next == l);
+			BMESH_ASSERT(!(l->prev->e != ne && l->next->e != ne));
+
+			edok = bmesh_verts_in_edge(l->v, l->next->v, e);
+			BMESH_ASSERT(edok != FALSE);
+			BMESH_ASSERT(l->v != l->next->v);
+			BMESH_ASSERT(l->e != l->next->e);
+
+			/* verify loop cycle for kloop-> */
+			BM_CHECK_ELEMENT(l);
+			BM_CHECK_ELEMENT(l->v);
+			BM_CHECK_ELEMENT(l->e);
+			BM_CHECK_ELEMENT(l->f);
+		}
+		/* verify loop->v and loop->next->v pointers for ne */
+		for (i = 0, l = ne->l; i < radlen; i++, l = l->radial_next) {
+			BMESH_ASSERT(l->e == ne);
+			// BMESH_ASSERT(l->radial_next == l);
+			BMESH_ASSERT(!(l->prev->e != e && l->next->e != e));
+			edok = bmesh_verts_in_edge(l->v, l->next->v, ne);
+			BMESH_ASSERT(edok != FALSE);
+			BMESH_ASSERT(l->v != l->next->v);
+			BMESH_ASSERT(l->e != l->next->e);
+
+			BM_CHECK_ELEMENT(l);
+			BM_CHECK_ELEMENT(l->v);
+			BM_CHECK_ELEMENT(l->e);
+			BM_CHECK_ELEMENT(l->f);
+		}
+	}
+
+	BM_CHECK_ELEMENT(ne);
+	BM_CHECK_ELEMENT(nv);
+	BM_CHECK_ELEMENT(ov);
+	BM_CHECK_ELEMENT(e);
+	BM_CHECK_ELEMENT(tv);
+
+	if (r_e) *r_e = ne;
+	return nv;
+}
+
+/**
+ * \brief Join Edge Kill Vert (JEKV)
+ *
+ * Takes an edge \a ke and pointer to one of its vertices \a kv
+ * and collapses the edge on that vertex.
+ *
+ * \par Examples:
+ *
+ *     Before:         OE      KE
+ *                   ------- -------
+ *                   |     ||      |
+ *                  OV     KV      TV
+ *
+ *
+ *     After:              OE
+ *                   ---------------
+ *                   |             |
+ *                  OV             TV
+ *
+ * \par Restrictions:
+ * KV is a vertex that must have a valance of exactly two. Furthermore
+ * both edges in KV's disk cycle (OE and KE) must be unique (no double edges).
+ *
+ * \return The resulting edge, NULL for failure.
+ *
+ * \note This euler has the possibility of creating
+ * faces with just 2 edges. It is up to the caller to decide what to do with
+ * these faces.
+ */
+BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_double)
+{
+	BMEdge *oe;
+	BMVert *ov, *tv;
+	BMLoop *killoop, *l;
+	int len, radlen = 0, halt = 0, i, valence1, valence2, edok;
+
+	if (bmesh_vert_in_edge(ke, kv) == 0) {
+		return NULL;
+	}
+
+	len = bmesh_disk_count(kv);
+	
+	if (len == 2) {
+		oe = bmesh_disk_edge_next(ke, kv);
+		tv = bmesh_edge_other_vert_get(ke, kv);
+		ov = bmesh_edge_other_vert_get(oe, kv);
+		halt = bmesh_verts_in_edge(kv, tv, oe); /* check for double edge */
+		
+		if (halt) {
+			return NULL;
+		}
+		else {
+			BMEdge *e_splice;
+
+			/* For verification later, count valence of ov and t */
+			valence1 = bmesh_disk_count(ov);
+			valence2 = bmesh_disk_count(tv);
+
+			if (check_edge_double) {
+				e_splice = BM_edge_exists(tv, ov);
+			}
+
+			/* remove oe from kv's disk cycle */
+			bmesh_disk_edge_remove(oe, kv);
+			/* relink oe->kv to be oe->tv */
+			bmesh_edge_swapverts(oe, kv, tv);
+			/* append oe to tv's disk cycle */
+			bmesh_disk_edge_append(oe, tv);
+			/* remove ke from tv's disk cycle */
+			bmesh_disk_edge_remove(ke, tv);
+
+			/* deal with radial cycle of ke */
+			radlen = bmesh_radial_length(ke->l);
+			if (ke->l) {
+				/* first step, fix the neighboring loops of all loops in ke's radial cycle */
+				for (i = 0, killoop = ke->l; i < radlen; i++, killoop = killoop->radial_next) {
+					/* relink loops and fix vertex pointer */
+					if (killoop->next->v == kv) {
+						killoop->next->v = tv;
+					}
+
+					killoop->next->prev = killoop->prev;
+					killoop->prev->next = killoop->next;
+					if (BM_FACE_FIRST_LOOP(killoop->f) == killoop) {
+						BM_FACE_FIRST_LOOP(killoop->f) = killoop->next;
+					}
+					killoop->next = NULL;
+					killoop->prev = NULL;
+
+					/* fix len attribute of face */
+					killoop->f->len--;
+				}
+				/* second step, remove all the hanging loops attached to ke */
+				radlen = bmesh_radial_length(ke->l);
+
+				if (LIKELY(radlen)) {
+					BMLoop **loops = NULL;
+					BLI_array_fixedstack_declare(loops, BM_NGON_STACK_SIZE, radlen, __func__);
+
+					killoop = ke->l;
+
+					/* this should be wrapped into a bme_free_radial function to be used by bmesh_KF as well... */
+					for (i = 0; i < radlen; i++) {
+						loops[i] = killoop;
+						killoop = killoop->radial_next;
+					}
+					for (i = 0; i < radlen; i++) {
+						bm->totloop--;
+						BLI_mempool_free(bm->lpool, loops[i]);
+					}
+					BLI_array_fixedstack_free(loops);
+				}
+
+				/* Validate radial cycle of oe */
+				edok = bmesh_radial_validate(radlen, oe->l);
+				BMESH_ASSERT(edok != FALSE);
+			}
+
+			/* deallocate edg */
+			bm_kill_only_edge(bm, ke);
+
+			/* deallocate verte */
+			bm_kill_only_vert(bm, kv);
+
+			/* Validate disk cycle lengths of ov, tv are unchanged */
+			edok = bmesh_disk_validate(valence1, ov->e, ov);
+			BMESH_ASSERT(edok != FALSE);
+			edok = bmesh_disk_validate(valence2, tv->e, tv);
+			BMESH_ASSERT(edok != FALSE);
+
+			/* 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);
+				BMESH_ASSERT(edok != FALSE);
+				edok = bmesh_loop_validate(l->f);
+				BMESH_ASSERT(edok != FALSE);
+
+				BM_CHECK_ELEMENT(l);
+				BM_CHECK_ELEMENT(l->v);
+				BM_CHECK_ELEMENT(l->e);
+				BM_CHECK_ELEMENT(l->f);
+			}
+
+			if (check_edge_double) {
+				if (e_splice) {
+					/* removes e_splice */
+					BM_edge_splice(bm, e_splice, oe);
+				}
+			}
+
+			BM_CHECK_ELEMENT(ov);
+			BM_CHECK_ELEMENT(tv);
+			BM_CHECK_ELEMENT(oe);
+
+			return oe;
+		}
+	}
+	return NULL;
+}
+
+/**
+ * \brief Join Face Kill Edge (JFKE)
+ *
+ * Takes two faces joined by a single 2-manifold edge and fuses them together.
+ * The edge shared by the faces must not be connected to any other edges which have
+ * Both faces in its radial cycle
+ *
+ * \par Examples:
+ *
+ *           A                   B
+ *      +--------+           +--------+
+ *      |        |           |        |
+ *      |   f1   |           |   f1   |
+ *     v1========v2 = Ok!    v1==V2==v3 == Wrong!
+ *      |   f2   |           |   f2   |
+ *      |        |           |        |
+ *      +--------+           +--------+
+ *
+ * In the example A, faces \a f1 and \a f2 are joined by a single edge,
+ * and the euler can safely be used.
+ * In example B however, \a f1 and \a f2 are joined by multiple edges and will produce an error.
+ * The caller in this case should call #bmesh_jekv on the extra edges
+ * before attempting to fuse \a f1 and \a f2.
+ *
+ * \note The order of arguments decides whether or not certain per-face attributes are present
+ * in the resultant face. For instance vertex winding, material index, smooth flags, etc are inherited
+ * from \a f1, not \a f2.
+ *
+ * \return A BMFace pointer
+ */
+BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e)
+{
+	BMLoop *l_iter, *f1loop = NULL, *f2loop = NULL;
+	int newlen = 0, i, f1len = 0, f2len = 0, edok;
+
+	/* can't join a face to itself */
+	if (f1 == f2) {
+		return NULL;
+	}
+
+	/* validate that edge is 2-manifold edge */
+	if (!BM_edge_is_manifold(e)) {
+		return NULL;
+	}
+
+	/* verify that e is in both f1 and f2 */
+	f1len = f1->len;
+	f2len = f2->len;
+
+	if (!((f1loop = BM_face_edge_share_loop(f1, e)) &&
+	      (f2loop = BM_face_edge_share_loop(f2, e))))
+	{
+		return NULL;
+	}
+
+	/* validate direction of f2's loop cycle is compatible */
+	if (f1loop->v == f2loop->v) {
+		return NULL;
+	}
+
+	/* validate that for each face, each vertex has another edge in its disk cycle that is
+	 * not e, and not shared. */
+	if (bmesh_radial_face_find(f1loop->next->e, f2) ||
+	    bmesh_radial_face_find(f1loop->prev->e, f2) ||
+	    bmesh_radial_face_find(f2loop->next->e, f1) ||
+	    bmesh_radial_face_find(f2loop->prev->e, f1) )
+	{
+		return NULL;
+	}
+
+	/* validate only one shared edge */
+	if (BM_face_share_edge_count(f1, f2) > 1) {
+		return NULL;
+	}
+
+	/* validate no internal join */
+	for (i = 0, l_iter = BM_FACE_FIRST_LOOP(f1); i < f1len; i++, l_iter = l_iter->next) {
+		BM_elem_flag_disable(l_iter->v, BM_ELEM_INTERNAL_TAG);
+	}
+	for (i = 0, l_iter = BM_FACE_FIRST_LOOP(f2); i < f2len; i++, l_iter = l_iter->next) {
+		BM_elem_flag_disable(l_iter->v, BM_ELEM_INTERNAL_TAG);
+	}
+
+	for (i = 0, l_iter = BM_FACE_FIRST_LOOP(f1); i < f1len; i++, l_iter = l_iter->next) {
+		if (l_iter != f1loop) {
+			BM_elem_flag_enable(l_iter->v, BM_ELEM_INTERNAL_TAG);
+		}
+	}
+	for (i = 0, l_iter = BM_FACE_FIRST_LOOP(f2); i < f2len; i++, l_iter = l_iter->next) {
+		if (l_iter != f2loop) {
+			/* as soon as a duplicate is found, bail out */
+			if (BM_elem_flag_test(l_iter->v, BM_ELEM_INTERNAL_TAG)) {
+				return NULL;
+			}
+		}
+	}
+
+	/* join the two loop */
+	f1loop->prev->next = f2loop->next;
+	f2loop->next->prev = f1loop->prev;
+	
+	f1loop->next->prev = f2loop->prev;
+	f2loop->prev->next = f1loop->next;
+	
+	/* if f1loop was baseloop, make f1loop->next the base. */
+	if (BM_FACE_FIRST_LOOP(f1) == f1loop)
+		BM_FACE_FIRST_LOOP(f1) = f1loop->next;
+
+	/* increase length of f1 */
+	f1->len += (f2->len - 2);
+
+	/* make sure each loop points to the proper face */
+	newlen = f1->len;
+	for (i = 0, l_iter = BM_FACE_FIRST_LOOP(f1); i < newlen; i++, l_iter = l_iter->next)
+		l_iter->f = f1;
+	
+	/* remove edge from the disk cycle of its two vertices */
+	bmesh_disk_edge_remove(f1loop->e, f1loop->e->v1);
+	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);
+	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);
+	BLI_mempool_free(bm->fpool, f2);
+	bm->totface--;
+	/* account for both above */
+	bm->elem_index_dirty |= BM_EDGE | BM_FACE;
+
+	BM_CHECK_ELEMENT(f1);
+
+	/* validate the new loop cycle */
+	edok = bmesh_loop_validate(f1);
+	BMESH_ASSERT(edok != FALSE);
+	
+	return f1;
+}
+
+/**
+ * \brief Splice Vert
+ *
+ * Merges two verts into one (\a v into \a vtarget).
+ *
+ * \return Success
+ */
+int BM_vert_splice(BMesh *bm, BMVert *v, BMVert *vtarget)
+{
+	BMEdge *e;
+	BMLoop *l;
+	BMIter liter;
+
+	/* verts already spliced */
+	if (v == vtarget) {
+		return FALSE;
+	}
+
+	/* retarget all the loops of v to vtarget */
+	BM_ITER_ELEM (l, &liter, v, BM_LOOPS_OF_VERT) {
+		l->v = vtarget;
+	}
+
+	/* 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);
+	}
+
+	BM_CHECK_ELEMENT(v);
+	BM_CHECK_ELEMENT(vtarget);
+
+	/* v is unused now, and can be killed */
+	BM_vert_kill(bm, v);
+
+	return TRUE;
+}
+
+/**
+ * \brief Separate Vert
+ *
+ * Separates all disjoint fans that meet at a vertex, making a unique
+ * vertex for each region. returns an array of all resulting vertices.
+ *
+ * \note this is a low level function, bm_edge_separate needs to run on edges first
+ * or, the faces sharing verts must not be sharing edges for them to split at least.
+ *
+ * \return Success
+ */
+int bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len)
+{
+	BMEdge **stack = NULL;
+	BLI_array_declare(stack);
+	BMVert **verts = NULL;
+	GHash *visithash;
+	BMIter eiter, liter;
+	BMLoop *l;
+	BMEdge *e;
+	int i, maxindex;
+	BMLoop *nl;
+
+	visithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, __func__);
+
+	maxindex = 0;
+	BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
+		if (BLI_ghash_haskey(visithash, e)) {
+			continue;
+		}
+
+		/* Prime the stack with this unvisited edge */
+		BLI_array_append(stack, e);
+
+		/* Considering only edges and faces incident on vertex v, walk
+		 * the edges & faces and assign an index to each connected set */
+		while ((e = BLI_array_pop(stack))) {
+			BLI_ghash_insert(visithash, e, SET_INT_IN_POINTER(maxindex));
+
+			BM_ITER_ELEM (l, &liter, e, BM_LOOPS_OF_EDGE) {
+				nl = (l->v == v) ? l->prev : l->next;
+				if (!BLI_ghash_haskey(visithash, nl->e)) {
+					BLI_array_append(stack, nl->e);
+				}
+			}
+		}
+
+		maxindex++;
+	}
+
+	/* Make enough verts to split v for each group */
+	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);
+	}
+
+	/* Replace v with the new verts in each group */
+#if 0
+	BM_ITER_ELEM (l, &liter, v, BM_LOOPS_OF_VERT) {
+		/* call first since its faster then a hash lookup */
+		if (l->v != v) {
+			continue;
+		}
+		i = GET_INT_FROM_POINTER(BLI_ghash_lookup(visithash, l->e));
+		if (i == 0) {
+			continue;
+		}
+
+		/* Loops here should always refer to an edge that has v as an
+		 * endpoint. For each appearance of this vert in a face, there
+		 * will actually be two iterations: one for the loop heading
+		 * towards vertex v, and another for the loop heading out from
+		 * vertex v. Only need to swap the vertex on one of those times,
+		 * on the outgoing loop. */
+
+		/* XXX - because this clobbers the iterator, this *whole* block is commented, see below */
+		l->v = verts[i];
+	}
+#else
+	/* note: this is the same as the commented code above *except* that it doesn't break iterator
+	 * by modifying data it loops over [#30632], this re-uses the 'stack' variable which is a bit
+	 * bad practice but save alloc'ing a new array - note, the comment above is useful, keep it
+	 * if you are tidying up code - campbell */
+	BLI_array_empty(stack);
+	BM_ITER_ELEM (l, &liter, v, BM_LOOPS_OF_VERT) {
+		if (l->v == v) {
+			BLI_array_append(stack, (BMEdge *)l);
+		}
+	}
+	while ((l = (BMLoop *)(BLI_array_pop(stack)))) {
+		if ((i = GET_INT_FROM_POINTER(BLI_ghash_lookup(visithash, l->e)))) {
+			l->v = verts[i];
+		}
+	}
+#endif
+
+	BLI_array_free(stack);
+
+	BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
+		i = GET_INT_FROM_POINTER(BLI_ghash_lookup(visithash, e));
+		if (i == 0) {
+			continue;
+		}
+
+		BLI_assert(e->v1 == v || e->v2 == v);
+		bmesh_disk_edge_remove(e, v);
+		bmesh_edge_swapverts(e, v, verts[i]);
+		bmesh_disk_edge_append(e, verts[i]);
+	}
+
+	BLI_ghash_free(visithash, NULL, NULL);
+
+	for (i = 0; i < maxindex; i++) {
+		BM_CHECK_ELEMENT(verts[i]);
+	}
+
+	if (r_vout_len != NULL) {
+		*r_vout_len = maxindex;
+	}
+
+	if (r_vout != NULL) {
+		*r_vout = verts;
+	}
+	else {
+		MEM_freeN(verts);
+	}
+
+	return TRUE;
+}
+
+/**
+ * High level function which wraps both #bm_vert_separate and #bm_edge_separate
+ */
+int BM_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
+                     BMEdge **e_in, int e_in_len)
+{
+	int i;
+
+	for (i = 0; i < e_in_len; i++) {
+		BMEdge *e = e_in[i];
+		if (e->l && BM_vert_in_edge(e, v)) {
+			bmesh_edge_separate(bm, e, e->l);
+		}
+	}
+
+	return bmesh_vert_separate(bm, v, r_vout, r_vout_len);
+}
+
+/**
+ * \brief Splice Edge
+ *
+ * Splice two unique edges which share the same two vertices into one edge.
+ *
+ * \return Success
+ *
+ * \note Edges must already have the same vertices.
+ */
+int BM_edge_splice(BMesh *bm, BMEdge *e, BMEdge *etarget)
+{
+	BMLoop *l;
+
+	if (!BM_vert_in_edge(e, etarget->v1) || !BM_vert_in_edge(e, etarget->v2)) {
+		/* not the same vertices can't splice */
+		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));
+		bmesh_radial_loop_remove(l, e);
+		bmesh_radial_append(etarget, l);
+	}
+
+	BLI_assert(bmesh_radial_length(e->l) == 0);
+
+	BM_CHECK_ELEMENT(e);
+	BM_CHECK_ELEMENT(etarget);
+
+	/* removes from disks too */
+	BM_edge_kill(bm, e);
+
+	return TRUE;
+}
+
+/**
+ * \brief Separate Edge
+ *
+ * Separates a single edge into two edge: the original edge and
+ * a new edge that has only \a l_sep in its radial.
+ *
+ * \return Success
+ *
+ * \note Does nothing if \a l_sep is already the only loop in the
+ * edge radial.
+ */
+int bmesh_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep)
+{
+	BMEdge *ne;
+	int radlen;
+
+	BLI_assert(l_sep->e == e);
+	BLI_assert(e->l);
+	
+	radlen = bmesh_radial_length(e->l);
+	if (radlen < 2) {
+		/* no cut required */
+		return TRUE;
+	}
+
+	if (l_sep == e->l) {
+		e->l = l_sep->radial_next;
+	}
+
+	ne = BM_edge_create(bm, e->v1, e->v2, e, FALSE);
+	bmesh_radial_loop_remove(l_sep, e);
+	bmesh_radial_append(ne, l_sep);
+	l_sep->e = ne;
+
+	BLI_assert(bmesh_radial_length(e->l) == radlen - 1);
+	BLI_assert(bmesh_radial_length(ne->l) == 1);
+
+	BM_CHECK_ELEMENT(ne);
+	BM_CHECK_ELEMENT(e);
+
+	return TRUE;
+}
+
+/**
+ * \brief Unglue Region Make Vert (URMV)
+ *
+ * Disconnects a face from its vertex fan at loop \a sl
+ *
+ * \return The newly created BMVert
+ */
+BMVert *bmesh_urmv_loop(BMesh *bm, BMLoop *sl)
+{
+	BMVert **vtar;
+	int len, i;
+	BMVert *nv = NULL;
+	BMVert *sv = sl->v;
+
+	/* peel the face from the edge radials on both sides of the
+	 * loop vert, disconnecting the face from its fan */
+	bmesh_edge_separate(bm, sl->e, sl);
+	bmesh_edge_separate(bm, sl->prev->e, sl->prev);
+
+	if (bmesh_disk_count(sv) == 2) {
+		/* If there are still only two edges out of sv, then
+		 * this whole URMV was just a no-op, so exit now. */
+		return sv;
+	}
+
+	/* Update the disk start, so that v->e points to an edge
+	 * not touching the split loop. This is so that BM_vert_split
+	 * will leave the original sv on some *other* fan (not the
+	 * one-face fan that holds the unglue face). */
+	while (sv->e == sl->e || sv->e == sl->prev->e) {
+		sv->e = bmesh_disk_edge_next(sv->e, sv);
+	}
+
+	/* Split all fans connected to the vert, duplicating it for
+	 * each fans. */
+	bmesh_vert_separate(bm, sv, &vtar, &len);
+
+	/* There should have been at least two fans cut apart here,
+	 * otherwise the early exit would have kicked in. */
+	BLI_assert(len >= 2);
+
+	nv = sl->v;
+
+	/* Desired result here is that a new vert should always be
+	 * created for the unglue face. This is so we can glue any
+	 * extras back into the original vert. */
+	BLI_assert(nv != sv);
+	BLI_assert(sv == vtar[0]);
+
+	/* If there are more than two verts as a result, glue together
+	 * all the verts except the one this URMV intended to create */
+	if (len > 2) {
+		for (i = 0; i < len; i++) {
+			if (vtar[i] == nv) {
+				break;
+			}
+		}
+
+		if (i != len) {
+			/* Swap the single vert that was needed for the
+			 * unglue into the last array slot */
+			SWAP(BMVert *, vtar[i], vtar[len - 1]);
+
+			/* And then glue the rest back together */
+			for (i = 1; i < len - 1; i++) {
+				BM_vert_splice(bm, vtar[i], vtar[0]);
+			}
+		}
+	}
+
+	MEM_freeN(vtar);
+
+	return nv;
+}
+
+/**
+ * \brief Unglue Region Make Vert (URMV)
+ *
+ * Disconnects sf from the vertex fan at \a sv
+ *
+ * \return The newly created BMVert
+ */
+BMVert *bmesh_urmv(BMesh *bm, BMFace *sf, BMVert *sv)
+{
+	BMLoop *l = BM_face_vert_share_loop(sf, sv);
+	return bmesh_urmv_loop(bm, l);
+}
diff --git a/source/blender/bmesh/intern/bmesh_core.h b/source/blender/bmesh/intern/bmesh_core.h
new file mode 100644
index 0000000..4912879
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_core.h
@@ -0,0 +1,71 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BMESH_CORE_H__
+#define __BMESH_CORE_H__
+
+/** \file blender/bmesh/intern/bmesh_core.h
+ *  \ingroup bmesh
+ */
+
+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);
+
+void    BM_face_edges_kill(BMesh *bm, BMFace *f);
+void    BM_face_verts_kill(BMesh *bm, BMFace *f);
+
+void    BM_face_kill(BMesh *bm, BMFace *f);
+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     bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len);
+
+int     bmesh_loop_reverse(BMesh *bm, BMFace *f);
+
+BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const short do_del);
+int     BM_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
+                         BMEdge **e_in, int e_in_len);
+
+/* EULER API - For modifying structure */
+BMFace *bmesh_sfme(BMesh *bm, BMFace *f, BMVert *v1,
+                          BMVert *v2, BMLoop **r_l,
+#ifdef USE_BMESH_HOLES
+                          ListBase *holes,
+#endif
+                          BMEdge *example,
+                          const short nodouble
+                          );
+
+BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **r_e);
+BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_splice);
+BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e);
+BMVert *bmesh_urmv(BMesh *bm, BMFace *sf, BMVert *sv);
+BMVert *bmesh_urmv_loop(BMesh *bm, BMLoop *sl);
+
+#endif /* __BMESH_CORE_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_error.h b/source/blender/bmesh/intern/bmesh_error.h
new file mode 100644
index 0000000..84065fe
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_error.h
@@ -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.
+ *
+ * Contributor(s): Joseph Eagar.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BMESH_ERROR_H__
+#define __BMESH_ERROR_H__
+
+/** \file blender/bmesh/bmesh_error.h
+ *  \ingroup bmesh
+ */
+
+/*----------- bmop error system ----------*/
+
+/* pushes an error onto the bmesh error stack.
+ * if msg is null, then the default message for the errorcode is used.*/
+void BMO_error_raise(BMesh *bm, BMOperator *owner, int errcode, const char *msg);
+
+/* gets the topmost error from the stack.
+ * returns error code or 0 if no error.*/
+int BMO_error_get(BMesh *bm, const char **msg, BMOperator **op);
+int BMO_error_occurred(BMesh *bm);
+
+/* same as geterror, only pops the error off the stack as well */
+int BMO_error_pop(BMesh *bm, const char **msg, BMOperator **op);
+void BMO_error_clear(BMesh *bm);
+
+/* this is meant for handling errors, like self-intersection test failures.
+ * it's dangerous to handle errors in general though, so disabled for now. */
+
+/* catches an error raised by the op pointed to by catchop.
+ * errorcode is either the errorcode, or BMERR_ALL for any
+ * error.*/
+
+/* not yet implemented.
+ * int BMO_error_catch_op(BMesh *bm, BMOperator *catchop, int errorcode, char **msg);
+ */
+
+#define BM_ELEM_INDEX_VALIDATE(_bm, _msg_a, _msg_b) \
+	BM_mesh_elem_index_validate(_bm, __FILE__ ":" STRINGIFY(__LINE__), __func__, _msg_a, _msg_b)
+
+/*------ error code defines -------*/
+
+/*error messages*/
+#define BMERR_SELF_INTERSECTING			1
+#define BMERR_DISSOLVEDISK_FAILED		2
+#define BMERR_CONNECTVERT_FAILED		3
+#define BMERR_WALKER_FAILED				4
+#define BMERR_DISSOLVEFACES_FAILED		5
+#define BMERR_DISSOLVEVERTS_FAILED		6
+#define BMERR_TESSELLATION				7
+#define BMERR_NONMANIFOLD				8
+#define BMERR_INVALID_SELECTION			9
+#define BMERR_MESH_ERROR				10
+
+/* BMESH_ASSERT */
+#ifdef WITH_ASSERT_ABORT
+#  define _BMESH_DUMMY_ABORT abort
+#else
+#  define _BMESH_DUMMY_ABORT() (void)0
+#endif
+
+/* this is meant to be higher level then BLI_assert(),
+ * its enabled even when in Release mode*/
+#define BMESH_ASSERT(a)                                                       \
+	(void)((!(a)) ?  (                                                        \
+		(                                                                     \
+		fprintf(stderr,                                                       \
+			"BMESH_ASSERT failed: %s, %s(), %d at \'%s\'\n",                  \
+			__FILE__, __func__, __LINE__, STRINGIFY(a)),                      \
+		_BMESH_DUMMY_ABORT(),                                                 \
+		NULL)) : NULL)
+
+#endif /* __BMESH_ERROR_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_inline.h b/source/blender/bmesh/intern/bmesh_inline.h
new file mode 100644
index 0000000..400f4a5
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_inline.h
@@ -0,0 +1,121 @@
+/*
+ * ***** 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, Geoffrey Bantle, Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/intern/bmesh_inline.h
+ *  \ingroup bmesh
+ *
+ * BM Inline functions.
+ */
+
+#ifndef __BMESH_INLINE_H__
+#define __BMESH_INLINE_H__
+
+/* stuff for dealing with header flags */
+#define BM_elem_flag_test(     ele, hflag)      _bm_elem_flag_test     (&(ele)->head, hflag)
+#define BM_elem_flag_test_bool(ele, hflag)      _bm_elem_flag_test_bool(&(ele)->head, hflag)
+#define BM_elem_flag_enable(   ele, hflag)      _bm_elem_flag_enable   (&(ele)->head, hflag)
+#define BM_elem_flag_disable(  ele, hflag)      _bm_elem_flag_disable  (&(ele)->head, hflag)
+#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)
+
+BLI_INLINE char _bm_elem_flag_test(const BMHeader *head, const char hflag)
+{
+	return head->hflag & hflag;
+}
+
+BLI_INLINE short _bm_elem_flag_test_bool(const BMHeader *head, const char hflag)
+{
+	return (head->hflag & hflag) != 0;
+}
+
+BLI_INLINE void _bm_elem_flag_enable(BMHeader *head, const char hflag)
+{
+	head->hflag |= hflag;
+}
+
+BLI_INLINE void _bm_elem_flag_disable(BMHeader *head, const char hflag)
+{
+	head->hflag &= ~hflag;
+}
+
+BLI_INLINE void _bm_elem_flag_set(BMHeader *head, const char hflag, const int val)
+{
+	if (val)  _bm_elem_flag_enable(head,  hflag);
+	else      _bm_elem_flag_disable(head, hflag);
+}
+
+BLI_INLINE void _bm_elem_flag_toggle(BMHeader *head, const char hflag)
+{
+	head->hflag ^= hflag;
+}
+
+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;
+}
+
+/**
+ * notes on #BM_elem_index_set(...) usage,
+ * Set index is sometimes abused as temp storage, other times we cant be
+ * sure if the index values are valid because certain operations have modified
+ * the mesh structure.
+ *
+ * To set the elements to valid indices 'BM_mesh_elem_index_ensure' should be used
+ * rather then adding inline loops, however there are cases where we still
+ * set the index directly
+ *
+ * In an attempt to manage this,
+ * here are 5 tags I'm adding to uses of #BM_elem_index_set
+ *
+ * - 'set_inline'  -- since the data is already being looped over set to a
+ *                    valid value inline.
+ *
+ * - 'set_dirty!'  -- intentionally sets the index to an invalid value,
+ *                    flagging 'bm->elem_index_dirty' so we don't use it.
+ *
+ * - 'set_ok'      -- this is valid use since the part of the code is low level.
+ *
+ * - 'set_ok_invalid'  -- set to -1 on purpose since this should not be
+ *                    used without a full array re-index, do this on
+ *                    adding new vert/edge/faces since they may be added at
+ *                    the end of the array.
+ *
+ * - 'set_loop'    -- currently loop index values are not used used much so
+ *                    assume each case they are dirty.
+ *
+ * - campbell */
+
+#define BM_elem_index_get(ele)           _bm_elem_index_get(&(ele)->head)
+#define BM_elem_index_set(ele, index)    _bm_elem_index_set(&(ele)->head, index)
+
+BLI_INLINE void _bm_elem_index_set(BMHeader *head, const int index)
+{
+	head->index = index;
+}
+
+BLI_INLINE int _bm_elem_index_get(const BMHeader *head)
+{
+	return head->index;
+}
+
+#endif /* __BMESH_INLINE_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c
new file mode 100644
index 0000000..5149a54
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_interp.c
@@ -0,0 +1,866 @@
+/*
+ * ***** 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) 2007 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Geoffrey Bantle.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/intern/bmesh_interp.c
+ *  \ingroup bmesh
+ *
+ * Functions for interpolating data across the surface of a mesh.
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
+
+#include "BKE_customdata.h"
+#include "BKE_multires.h"
+
+#include "BLI_array.h"
+#include "BLI_math.h"
+
+#include "bmesh.h"
+#include "intern/bmesh_private.h"
+
+/**
+ * \brief Data, Interp From Verts
+ *
+ * Interpolates per-vertex data from two sources to a target.
+ */
+void BM_data_interp_from_verts(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v, const float fac)
+{
+	if (v1->head.data && v2->head.data) {
+		/* first see if we can avoid interpolation */
+		if (fac <= 0.0f) {
+			if (v1 == v) {
+				/* do nothing */
+			}
+			else {
+				CustomData_bmesh_free_block(&bm->vdata, &v->head.data);
+				CustomData_bmesh_copy_data(&bm->vdata, &bm->vdata, v1->head.data, &v->head.data);
+			}
+		}
+		else if (fac >= 1.0f) {
+			if (v2 == v) {
+				/* do nothing */
+			}
+			else {
+				CustomData_bmesh_free_block(&bm->vdata, &v->head.data);
+				CustomData_bmesh_copy_data(&bm->vdata, &bm->vdata, v2->head.data, &v->head.data);
+			}
+		}
+		else {
+			void *src[2];
+			float w[2];
+
+			src[0] = v1->head.data;
+			src[1] = v2->head.data;
+			w[0] = 1.0f-fac;
+			w[1] = fac;
+			CustomData_bmesh_interp(&bm->vdata, src, w, NULL, 2, v->head.data);
+		}
+	}
+}
+
+/**
+ * \brief Data Vert Average
+ *
+ * Sets all the customdata (e.g. vert, loop) associated with a vert
+ * to the average of the face regions surrounding it.
+ */
+static void UNUSED_FUNCTION(BM_Data_Vert_Average)(BMesh *UNUSED(bm), BMFace *UNUSED(f))
+{
+	// BMIter iter;
+}
+
+/**
+ * \brief Data Face-Vert Edge Interp
+ *
+ * Walks around the faces of an edge and interpolates the per-face-edge
+ * data between two sources to a target.
+ */
+void BM_data_interp_face_vert_edge(BMesh *bm, BMVert *v1, BMVert *UNUSED(v2), BMVert *v, BMEdge *e1, const float fac)
+{
+	void *src[2];
+	float w[2];
+	BMLoop *v1loop = NULL, *vloop = NULL, *v2loop = NULL;
+	BMLoop *l_iter = NULL;
+
+	if (!e1->l) {
+		return;
+	}
+
+	w[1] = 1.0f - fac;
+	w[0] = fac;
+
+	l_iter = e1->l;
+	do {
+		if (l_iter->v == v1) {
+			v1loop = l_iter;
+			vloop = v1loop->next;
+			v2loop = vloop->next;
+		}
+		else if (l_iter->v == v) {
+			v1loop = l_iter->next;
+			vloop = l_iter;
+			v2loop = l_iter->prev;
+		}
+		
+		if (!v1loop || !v2loop)
+			return;
+		
+		src[0] = v1loop->head.data;
+		src[1] = v2loop->head.data;
+
+		CustomData_bmesh_interp(&bm->ldata, src, w, NULL, 2, vloop->head.data);
+	} while ((l_iter = l_iter->radial_next) != e1->l);
+}
+
+/**
+ * \brief Data Interp From Face
+ *
+ * projects target onto source, and pulls interpolated customdata from
+ * source.
+ *
+ * \note Only handles loop customdata. multires is handled.
+ */
+void BM_face_interp_from_face(BMesh *bm, BMFace *target, BMFace *source)
+{
+	BMLoop *l_iter;
+	BMLoop *l_first;
+
+	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__);
+	int i;
+	
+	BM_elem_attrs_copy(bm, bm, source, target);
+
+	i = 0;
+	l_iter = l_first = BM_FACE_FIRST_LOOP(source);
+	do {
+		copy_v3_v3(cos[i], l_iter->v->co);
+		blocks[i] = l_iter->head.data;
+		i++;
+	} while ((l_iter = l_iter->next) != l_first);
+
+	i = 0;
+	l_iter = l_first = BM_FACE_FIRST_LOOP(target);
+	do {
+		interp_weights_poly_v3(w, cos, source->len, l_iter->v->co);
+		CustomData_bmesh_interp(&bm->ldata, blocks, w, NULL, source->len, l_iter->head.data);
+		i++;
+	} while ((l_iter = l_iter->next) != l_first);
+
+	BLI_array_fixedstack_free(cos);
+	BLI_array_fixedstack_free(w);
+	BLI_array_fixedstack_free(blocks);
+}
+
+/**
+ * \brief Multires Interpolation
+ *
+ * mdisps is a grid of displacements, ordered thus:
+ *
+ *      v1/center----v4/next -> x
+ *          |           |
+ *          |           |
+ *       v2/prev------v3/cur
+ *          |
+ *          V
+ *          y
+ */
+static int compute_mdisp_quad(BMLoop *l, float v1[3], float v2[3], float v3[3], float v4[3],
+                              float e1[3], float e2[3])
+{
+	float cent[3] = {0.0f, 0.0f, 0.0f}, n[3], p[3];
+	BMLoop *l_first;
+	BMLoop *l_iter;
+	
+	/* computer center */
+	l_iter = l_first = BM_FACE_FIRST_LOOP(l->f);
+	do {
+		cent[0] += (float)l_iter->v->co[0];
+		cent[1] += (float)l_iter->v->co[1];
+		cent[2] += (float)l_iter->v->co[2];
+	} while ((l_iter = l_iter->next) != l_first);
+	
+	mul_v3_fl(cent, (1.0 / (float)l->f->len));
+	
+	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);
+	
+	copy_v3_v3(v1, cent);
+	copy_v3_v3(v2, p);
+	copy_v3_v3(v3, l->v->co);
+	copy_v3_v3(v4, n);
+	
+	sub_v3_v3v3(e1, v2, v1);
+	sub_v3_v3v3(e2, v3, v4);
+	
+	return 1;
+}
+
+/* funnily enough, I think this is identical to face_to_crn_interp, heh */
+static float quad_coord(float aa[3], float bb[3], float cc[3], float dd[3], int a1, int a2)
+{
+	float x, y, z, f1;
+	
+	x = aa[a1] * cc[a2] - cc[a1] * aa[a2];
+	y = aa[a1] * dd[a2] + bb[a1] * cc[a2] - cc[a1] * bb[a2] - dd[a1] * aa[a2];
+	z = bb[a1] * dd[a2] - dd[a1] * bb[a2];
+	
+	if (fabsf(2.0f * (x - y + z)) > FLT_EPSILON * 10.0f) {
+		float f2;
+
+		f1 = (sqrt(y * y - 4.0 * x * z) - y + 2.0 * z) / (2.0 * (x - y + z));
+		f2 = (-sqrt(y * y - 4.0 * x * z) - y + 2.0 * z) / (2.0 * (x - y + z));
+
+		f1 = fabsf(f1);
+		f2 = fabsf(f2);
+		f1 = MIN2(f1, f2);
+		CLAMP(f1, 0.0f, 1.0f + FLT_EPSILON);
+	}
+	else {
+		f1 = -z / (y - 2 * z);
+		CLAMP(f1, 0.0f, 1.0f + FLT_EPSILON);
+		
+		if (isnan(f1) || f1 > 1.0 || f1 < 0.0f) {
+			int i;
+			
+			for (i = 0; i < 2; i++) {
+				if (fabsf(aa[i]) < FLT_EPSILON * 100.0f)
+					return aa[(i + 1) % 2] / fabsf(bb[(i + 1) % 2] - aa[(i + 1) % 2]);
+				if (fabsf(cc[i]) < FLT_EPSILON * 100.0f)
+					return cc[(i + 1) % 2] / fabsf(dd[(i + 1) % 2] - cc[(i + 1) % 2]);
+			}
+		}
+	}
+
+	return f1;
+}
+
+static int quad_co(float *x, float *y, float v1[3], float v2[3], float v3[3], float v4[3],
+                   float p[3], float n[3])
+{
+	float projverts[5][3], n2[3];
+	float dprojverts[4][3], origin[3] = {0.0f, 0.0f, 0.0f};
+	int i;
+
+	/* project points into 2d along normal */
+	copy_v3_v3(projverts[0], v1);
+	copy_v3_v3(projverts[1], v2);
+	copy_v3_v3(projverts[2], v3);
+	copy_v3_v3(projverts[3], v4);
+	copy_v3_v3(projverts[4], p);
+
+	normal_quad_v3(n2, projverts[0], projverts[1], projverts[2], projverts[3]);
+
+	if (dot_v3v3(n, n2) < -FLT_EPSILON) {
+		return 0;
+	}
+
+	/* rotate */
+	poly_rotate_plane(n, projverts, 5);
+	
+	/* flatten */
+	for (i = 0; i < 5; i++) {
+		projverts[i][2] = 0.0f;
+	}
+	
+	/* subtract origin */
+	for (i = 0; i < 4; i++) {
+		sub_v3_v3(projverts[i], projverts[4]);
+	}
+	
+	copy_v3_v3(dprojverts[0], projverts[0]);
+	copy_v3_v3(dprojverts[1], projverts[1]);
+	copy_v3_v3(dprojverts[2], projverts[2]);
+	copy_v3_v3(dprojverts[3], projverts[3]);
+
+	if (!isect_point_quad_v2(origin, dprojverts[0], dprojverts[1], dprojverts[2], dprojverts[3])) {
+		return 0;
+	}
+	
+	*y = quad_coord(dprojverts[1], dprojverts[0], dprojverts[2], dprojverts[3], 0, 1);
+	*x = quad_coord(dprojverts[2], dprojverts[1], dprojverts[3], dprojverts[0], 0, 1);
+
+	return 1;
+}
+
+static void mdisp_axis_from_quad(float v1[3], float v2[3], float UNUSED(v3[3]), float v4[3],
+                                float axis_x[3], float axis_y[3])
+{
+	sub_v3_v3v3(axis_x, v4, v1);
+	sub_v3_v3v3(axis_y, v2, v1);
+
+	normalize_v3(axis_x);
+	normalize_v3(axis_y);
+}
+
+/* tl is loop to project onto, l is loop whose internal displacement, co, is being
+ * projected.  x and y are location in loop's mdisps grid of point co. */
+static int mdisp_in_mdispquad(BMLoop *l, BMLoop *tl, float p[3], float *x, float *y,
+                              int res, float axis_x[3], float axis_y[3])
+{
+	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)
+		BM_vert_normal_update_all(l->v);
+	if (len_v3(tl->v->no) == 0.0f)
+		BM_vert_normal_update_all(tl->v);
+
+	compute_mdisp_quad(tl, v1, v2, v3, v4, e1, e2);
+
+	/* expand quad a bit */
+	cent_quad_v3(c, v1, v2, v3, v4);
+	
+	sub_v3_v3(v1, c); sub_v3_v3(v2, c);
+	sub_v3_v3(v3, c); sub_v3_v3(v4, c);
+	mul_v3_fl(v1, 1.0 + eps); mul_v3_fl(v2, 1.0 + eps);
+	mul_v3_fl(v3, 1.0 + eps); mul_v3_fl(v4, 1.0 + eps);
+	add_v3_v3(v1, c); add_v3_v3(v2, c);
+	add_v3_v3(v3, c); add_v3_v3(v4, c);
+	
+	if (!quad_co(x, y, v1, v2, v3, v4, p, l->v->no))
+		return 0;
+	
+	*x *= res - 1;
+	*y *= res - 1;
+
+	mdisp_axis_from_quad(v1, v2, v3, v4, axis_x, axis_y);
+
+	return 1;
+}
+
+static float bm_loop_flip_equotion(float mat[2][2], float b[2], float target_axis_x[3], float target_axis_y[3],
+                                   float coord[3], int i, int j)
+{
+	mat[0][0] = target_axis_x[i];
+	mat[0][1] = target_axis_y[i];
+	mat[1][0] = target_axis_x[j];
+	mat[1][1] = target_axis_y[j];
+	b[0] = coord[i];
+	b[1] = coord[j];
+
+	return mat[0][0] * mat[1][1] - mat[0][1] * mat[1][0];
+}
+
+static void bm_loop_flip_disp(float source_axis_x[3], float source_axis_y[3],
+                                 float target_axis_x[3], float target_axis_y[3], float disp[3])
+{
+	float vx[3], vy[3], coord[3];
+	float n[3], vec[3];
+	float b[2], mat[2][2], d;
+
+	mul_v3_v3fl(vx, source_axis_x, disp[0]);
+	mul_v3_v3fl(vy, source_axis_y, disp[1]);
+	add_v3_v3v3(coord, vx, vy);
+
+	/* project displacement from source grid plane onto target grid plane */
+	cross_v3_v3v3(n, target_axis_x, target_axis_y);
+	project_v3_v3v3(vec, coord, n);
+	sub_v3_v3v3(coord, coord, vec);
+
+	d = bm_loop_flip_equotion(mat, b, target_axis_x, target_axis_y, coord, 0, 1);
+
+	if (fabsf(d) < 1e-4) {
+		d = bm_loop_flip_equotion(mat, b, target_axis_x, target_axis_y, coord, 0, 2);
+		if (fabsf(d) < 1e-4)
+			d = bm_loop_flip_equotion(mat, b, target_axis_x, target_axis_y, coord, 1, 2);
+	}
+
+	disp[0] = (b[0] * mat[1][1] - mat[0][1] * b[1]) / d;
+	disp[1] = (mat[0][0] * b[1] - b[0] * mat[1][0]) / d;
+}
+
+static void bm_loop_interp_mdisps(BMesh *bm, BMLoop *target, BMFace *source)
+{
+	MDisps *mdisps;
+	BMLoop *l_iter;
+	BMLoop *l_first;
+	float x, y, d, v1[3], v2[3], v3[3], v4[3] = {0.0f, 0.0f, 0.0f}, e1[3], e2[3];
+	int ix, iy, res;
+	float axis_x[3], axis_y[3];
+	
+	/* ignore 2-edged faces */
+	if (target->f->len < 3)
+		return;
+	
+	if (!CustomData_has_layer(&bm->ldata, CD_MDISPS))
+		return;
+	
+	mdisps = CustomData_bmesh_get(&bm->ldata, target->head.data, CD_MDISPS);
+	compute_mdisp_quad(target, v1, v2, v3, v4, e1, e2);
+	
+	/* if no disps data allocate a new grid, the size of the first grid in source. */
+	if (!mdisps->totdisp) {
+		MDisps *md2 = CustomData_bmesh_get(&bm->ldata, BM_FACE_FIRST_LOOP(source)->head.data, CD_MDISPS);
+		
+		mdisps->totdisp = md2->totdisp;
+		mdisps->level = md2->level;
+		if (mdisps->totdisp) {
+			mdisps->disps = MEM_callocN(sizeof(float) * 3 * mdisps->totdisp,
+			                            "mdisp->disps in bmesh_loop_intern_mdisps");
+		}
+		else {
+			return;
+		}
+	}
+	
+	mdisp_axis_from_quad(v1, v2, v3, v4, axis_x, axis_y);
+
+	res = (int)sqrt(mdisps->totdisp);
+	d = 1.0 / (float)(res - 1);
+	for (x = 0.0f, ix = 0; ix < res; x += d, ix++) {
+		for (y = 0.0f, iy = 0; iy < res; y += d, iy++) {
+			float co1[3], co2[3], co[3];
+			
+			copy_v3_v3(co1, e1);
+			
+			mul_v3_fl(co1, y);
+			add_v3_v3(co1, v1);
+			
+			copy_v3_v3(co2, e2);
+			mul_v3_fl(co2, y);
+			add_v3_v3(co2, v4);
+			
+			sub_v3_v3v3(co, co2, co1);
+			mul_v3_fl(co, x);
+			add_v3_v3(co, co1);
+			
+			l_iter = l_first = BM_FACE_FIRST_LOOP(source);
+			do {
+				float x2, y2;
+				MDisps *md1, *md2;
+				float src_axis_x[3], src_axis_y[3];
+
+				md1 = CustomData_bmesh_get(&bm->ldata, target->head.data, CD_MDISPS);
+				md2 = CustomData_bmesh_get(&bm->ldata, l_iter->head.data, CD_MDISPS);
+				
+				if (mdisp_in_mdispquad(target, l_iter, co, &x2, &y2, res, src_axis_x, src_axis_y)) {
+					old_mdisps_bilinear(md1->disps[iy * res + ix], md2->disps, res, (float)x2, (float)y2);
+					bm_loop_flip_disp(src_axis_x, src_axis_y, axis_x, axis_y, md1->disps[iy * res + ix]);
+
+					break;
+				}
+			} while ((l_iter = l_iter->next) != l_first);
+		}
+	}
+}
+
+/**
+ * smoothes boundaries between multires grids,
+ * including some borders in adjacent faces
+ */
+void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f)
+{
+	BMLoop *l;
+	BMIter liter;
+	
+	if (!CustomData_has_layer(&bm->ldata, CD_MDISPS))
+		return;
+	
+	BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+		MDisps *mdp = CustomData_bmesh_get(&bm->ldata, l->prev->head.data, CD_MDISPS);
+		MDisps *mdl = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MDISPS);
+		MDisps *mdn = CustomData_bmesh_get(&bm->ldata, l->next->head.data, CD_MDISPS);
+		float co1[3];
+		int sides;
+		int y;
+		
+		/*
+		 *  mdisps is a grid of displacements, ordered thus:
+		 *
+		 *                     v4/next
+		 *                       |
+		 *   |      v1/cent-----mid2 ---> x
+		 *   |         |         |
+		 *   |         |         |
+		 *  v2/prev---mid1-----v3/cur
+		 *             |
+		 *             V
+		 *             y
+		 */
+
+		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);
+
+			copy_v3_v3(mdn->disps[y * sides], co1);
+			copy_v3_v3(mdl->disps[y], co1);
+		}
+	}
+	
+	BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+		MDisps *mdl1 = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MDISPS);
+		MDisps *mdl2;
+		float co1[3], co2[3], co[3];
+		int sides;
+		int y;
+		
+		/*
+		 *  mdisps is a grid of displacements, ordered thus:
+		 *
+		 *                     v4/next
+		 *                       |
+		 *   |      v1/cent-----mid2 ---> x
+		 *   |         |         |
+		 *   |         |         |
+		 *  v2/prev---mid1-----v3/cur
+		 *             |
+		 *             V
+		 *             y
+		 */
+
+		if (l->radial_next == l)
+			continue;
+
+		if (l->radial_next->v == l->v)
+			mdl2 = CustomData_bmesh_get(&bm->ldata, l->radial_next->head.data, CD_MDISPS);
+		else
+			mdl2 = CustomData_bmesh_get(&bm->ldata, l->radial_next->next->head.data, CD_MDISPS);
+
+		sides = (int)sqrt(mdl1->totdisp);
+		for (y = 0; y < sides; y++) {
+			int a1, a2, o1, o2;
+			
+			if (l->v != l->radial_next->v) {
+				a1 = sides * y + sides - 2;
+				a2 = (sides - 2) * sides + y;
+				
+				o1 = sides * y + sides - 1;
+				o2 = (sides - 1) * sides + y;
+			}
+			else {
+				a1 = sides * y + sides - 2;
+				a2 = sides * y + sides - 2;
+				o1 = sides * y + sides - 1;
+				o2 = sides * y + sides - 1;
+			}
+			
+			/* magic blending numbers, hardcoded! */
+			add_v3_v3v3(co1, mdl1->disps[a1], mdl2->disps[a2]);
+			mul_v3_fl(co1, 0.18);
+			
+			add_v3_v3v3(co2, mdl1->disps[o1], mdl2->disps[o2]);
+			mul_v3_fl(co2, 0.32);
+			
+			add_v3_v3v3(co, co1, co2);
+			
+			copy_v3_v3(mdl1->disps[o1], co);
+			copy_v3_v3(mdl2->disps[o2], co);
+		}
+	}
+}
+
+/**
+ * project the multires grid in target onto source's set of multires grids
+ */
+void BM_loop_interp_multires(BMesh *bm, BMLoop *target, BMFace *source)
+{
+	bm_loop_interp_mdisps(bm, target, source);
+}
+
+/**
+ * projects a single loop, target, onto source for customdata interpolation. multires is handled.
+ * if do_vertex is true, target's vert data will also get interpolated.
+ */
+void BM_loop_interp_from_face(BMesh *bm, BMLoop *target, BMFace *source,
+                              int do_vertex, int do_multires)
+{
+	BMLoop *l_iter;
+	BMLoop *l_first;
+	void **blocks = NULL;
+	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__);
+	int i, ax, ay;
+
+	BM_elem_attrs_copy(bm, bm, source, target->f);
+
+	i = 0;
+	l_iter = l_first = BM_FACE_FIRST_LOOP(source);
+	do {
+		copy_v3_v3(cos[i], l_iter->v->co);
+		add_v3_v3(cent, cos[i]);
+
+		w[i] = 0.0f;
+		blocks[i] = l_iter->head.data;
+
+		if (do_vertex) {
+			vblocks[i] = l_iter->v->head.data;
+		}
+		i++;
+
+	} while ((l_iter = l_iter->next) != l_first);
+
+	/* find best projection of face XY, XZ or YZ: barycentric weights of
+	 * the 2d projected coords are the same and faster to compute */
+
+	axis_dominant_v3(&ax, &ay, source->no);
+
+	/* scale source face coordinates a bit, so points sitting directly on an
+	 * edge will work. */
+	mul_v3_fl(cent, 1.0f / (float)source->len);
+	for (i = 0; i < source->len; i++) {
+		float vec[3], tmp[3];
+		sub_v3_v3v3(vec, cent, cos[i]);
+		mul_v3_fl(vec, 0.001f);
+		add_v3_v3(cos[i], vec);
+
+		copy_v3_v3(tmp, cos[i]);
+		cos[i][0] = tmp[ax];
+		cos[i][1] = tmp[ay];
+		cos[i][2] = 0.0f;
+	}
+
+
+	/* interpolate */
+	co[0] = target->v->co[ax];
+	co[1] = target->v->co[ay];
+	co[2] = 0.0f;
+
+	interp_weights_poly_v3(w, cos, source->len, co);
+	CustomData_bmesh_interp(&bm->ldata, blocks, w, NULL, source->len, target->head.data);
+	if (do_vertex) {
+		CustomData_bmesh_interp(&bm->vdata, vblocks, w, NULL, source->len, target->v->head.data);
+		BLI_array_fixedstack_free(vblocks);
+	}
+
+	BLI_array_fixedstack_free(cos);
+	BLI_array_fixedstack_free(w);
+	BLI_array_fixedstack_free(blocks);
+
+	if (do_multires) {
+		if (CustomData_has_layer(&bm->ldata, CD_MDISPS)) {
+			bm_loop_interp_mdisps(bm, target, source);
+		}
+	}
+}
+
+
+void BM_vert_interp_from_face(BMesh *bm, BMVert *v, BMFace *source)
+{
+	BMLoop *l_iter;
+	BMLoop *l_first;
+	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__);
+	int i;
+
+	i = 0;
+	l_iter = l_first = BM_FACE_FIRST_LOOP(source);
+	do {
+		copy_v3_v3(cos[i], l_iter->v->co);
+		add_v3_v3(cent, cos[i]);
+
+		w[i] = 0.0f;
+		blocks[i] = l_iter->v->head.data;
+		i++;
+	} while ((l_iter = l_iter->next) != l_first);
+
+	/* scale source face coordinates a bit, so points sitting directly on an
+	 * edge will work. */
+	mul_v3_fl(cent, 1.0f / (float)source->len);
+	for (i = 0; i < source->len; i++) {
+		float vec[3];
+		sub_v3_v3v3(vec, cent, cos[i]);
+		mul_v3_fl(vec, 0.01f);
+		add_v3_v3(cos[i], vec);
+	}
+
+	/* interpolate */
+	interp_weights_poly_v3(w, cos, source->len, v->co);
+	CustomData_bmesh_interp(&bm->vdata, blocks, w, NULL, source->len, v->head.data);
+
+	BLI_array_fixedstack_free(cos);
+	BLI_array_fixedstack_free(w);
+	BLI_array_fixedstack_free(blocks);
+}
+
+static void update_data_blocks(BMesh *bm, CustomData *olddata, CustomData *data)
+{
+	BMIter iter;
+	BLI_mempool *oldpool = olddata->pool;
+	void *block;
+
+	if (data == &bm->vdata) {
+		BMVert *eve;
+
+		CustomData_bmesh_init_pool(data, bm->totvert, BM_VERT);
+
+		BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
+			block = NULL;
+			CustomData_bmesh_set_default(data, &block);
+			CustomData_bmesh_copy_data(olddata, data, eve->head.data, &block);
+			CustomData_bmesh_free_block(olddata, &eve->head.data);
+			eve->head.data = block;
+		}
+	}
+	else if (data == &bm->edata) {
+		BMEdge *eed;
+
+		CustomData_bmesh_init_pool(data, bm->totedge, BM_EDGE);
+
+		BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
+			block = NULL;
+			CustomData_bmesh_set_default(data, &block);
+			CustomData_bmesh_copy_data(olddata, data, eed->head.data, &block);
+			CustomData_bmesh_free_block(olddata, &eed->head.data);
+			eed->head.data = block;
+		}
+	}
+	else if (data == &bm->ldata) {
+		BMIter liter;
+		BMFace *efa;
+		BMLoop *l;
+
+		CustomData_bmesh_init_pool(data, bm->totloop, BM_LOOP);
+		BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+				block = NULL;
+				CustomData_bmesh_set_default(data, &block);
+				CustomData_bmesh_copy_data(olddata, data, l->head.data, &block);
+				CustomData_bmesh_free_block(olddata, &l->head.data);
+				l->head.data = block;
+			}
+		}
+	}
+	else if (data == &bm->pdata) {
+		BMFace *efa;
+
+		CustomData_bmesh_init_pool(data, bm->totface, BM_FACE);
+
+		BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+			block = NULL;
+			CustomData_bmesh_set_default(data, &block);
+			CustomData_bmesh_copy_data(olddata, data, efa->head.data, &block);
+			CustomData_bmesh_free_block(olddata, &efa->head.data);
+			efa->head.data = block;
+		}
+	}
+	else {
+		/* should never reach this! */
+		BLI_assert(0);
+	}
+
+	if (oldpool) {
+		/* this should never happen but can when dissolve fails - [#28960] */
+		BLI_assert(data->pool != oldpool);
+
+		BLI_mempool_destroy(oldpool);
+	}
+}
+
+void BM_data_layer_add(BMesh *bm, CustomData *data, int type)
+{
+	CustomData olddata;
+
+	olddata = *data;
+	olddata.layers = (olddata.layers) ? MEM_dupallocN(olddata.layers): NULL;
+
+	/* the pool is now owned by olddata and must not be shared */
+	data->pool = NULL;
+
+	CustomData_add_layer(data, type, CD_DEFAULT, NULL, 0);
+
+	update_data_blocks(bm, &olddata, data);
+	if (olddata.layers) MEM_freeN(olddata.layers);
+}
+
+void BM_data_layer_add_named(BMesh *bm, CustomData *data, int type, const char *name)
+{
+	CustomData olddata;
+
+	olddata = *data;
+	olddata.layers = (olddata.layers) ? MEM_dupallocN(olddata.layers): NULL;
+
+	/* the pool is now owned by olddata and must not be shared */
+	data->pool = NULL;
+
+	CustomData_add_layer_named(data, type, CD_DEFAULT, NULL, 0, name);
+
+	update_data_blocks(bm, &olddata, data);
+	if (olddata.layers) MEM_freeN(olddata.layers);
+}
+
+void BM_data_layer_free(BMesh *bm, CustomData *data, int type)
+{
+	CustomData olddata;
+
+	olddata = *data;
+	olddata.layers = (olddata.layers) ? MEM_dupallocN(olddata.layers): NULL;
+
+	/* the pool is now owned by olddata and must not be shared */
+	data->pool = NULL;
+
+	CustomData_free_layer_active(data, type, 0);
+
+	update_data_blocks(bm, &olddata, data);
+	if (olddata.layers) MEM_freeN(olddata.layers);
+}
+
+void BM_data_layer_free_n(BMesh *bm, CustomData *data, int type, int n)
+{
+	CustomData olddata;
+
+	olddata = *data;
+	olddata.layers = (olddata.layers) ? MEM_dupallocN(olddata.layers): NULL;
+
+	/* the pool is now owned by olddata and must not be shared */
+	data->pool = NULL;
+
+	CustomData_free_layer(data, type, 0, CustomData_get_layer_index_n(data, type, n));
+	
+	update_data_blocks(bm, &olddata, data);
+	if (olddata.layers) MEM_freeN(olddata.layers);
+}
+
+float BM_elem_float_data_get(CustomData *cd, void *element, int type)
+{
+	float *f = CustomData_bmesh_get(cd, ((BMHeader *)element)->data, type);
+	return f ? *f : 0.0f;
+}
+
+void BM_elem_float_data_set(CustomData *cd, void *element, int type, const float val)
+{
+	float *f = CustomData_bmesh_get(cd, ((BMHeader *)element)->data, type);
+	if (f) *f = val;
+}
diff --git a/source/blender/bmesh/intern/bmesh_interp.h b/source/blender/bmesh/intern/bmesh_interp.h
new file mode 100644
index 0000000..0d97fbc
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_interp.h
@@ -0,0 +1,48 @@
+/*
+ * ***** 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): Geoffrey Bantle, Levi Schooley.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BMESH_INTERP_H__
+#define __BMESH_INTERP_H__
+
+/** \file blender/bmesh/intern/bmesh_interp.h
+ *  \ingroup bmesh
+ */
+
+void  BM_loop_interp_multires(BMesh *bm, BMLoop *target, BMFace *source);
+void  BM_vert_interp_from_face(BMesh *bm, BMVert *v, BMFace *source);
+
+void  BM_data_interp_from_verts(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v, const float fac);
+void  BM_data_interp_face_vert_edge(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v, BMEdge *e1, const float fac);
+void  BM_data_layer_add(BMesh *em, CustomData *data, int type);
+void  BM_data_layer_add_named(BMesh *bm, CustomData *data, int type, const char *name);
+void  BM_data_layer_free(BMesh *em, CustomData *data, int type);
+void  BM_data_layer_free_n(BMesh *bm, CustomData *data, int type, int n);
+float BM_elem_float_data_get(CustomData *cd, void *element, int type);
+void  BM_elem_float_data_set(CustomData *cd, void *element, int type, const float val);
+
+void  BM_face_interp_from_face(BMesh *bm, BMFace *target, BMFace *source);
+void  BM_loop_interp_from_face(BMesh *bm, BMLoop *target, BMFace *source,
+                              int do_vertex, int do_multires);
+
+void  BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f);
+
+#endif /* __BMESH_INTERP_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_iterators.c b/source/blender/bmesh/intern/bmesh_iterators.c
new file mode 100644
index 0000000..384715d
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_iterators.c
@@ -0,0 +1,452 @@
+/*
+ * ***** 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, Geoffrey Bantle, Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/intern/bmesh_iterators.c
+ *  \ingroup bmesh
+ *
+ * Functions to abstract looping over bmesh data structures.
+ *
+ * See: bmesh_iterators_inlin.c too, some functions are here for speed reasons.
+ */
+
+#include "BLI_utildefines.h"
+
+#include "bmesh.h"
+#include "intern/bmesh_private.h"
+
+const char bm_iter_itype_htype_map[BM_ITYPE_MAX] = {
+	'\0',
+	BM_VERT, /* BM_VERTS_OF_MESH */
+	BM_EDGE, /* BM_EDGES_OF_MESH */
+	BM_FACE, /* BM_FACES_OF_MESH */
+	BM_EDGE, /* BM_EDGES_OF_VERT */
+	BM_FACE, /* BM_FACES_OF_VERT */
+	BM_LOOP, /* BM_LOOPS_OF_VERT */
+	BM_VERT, /* BM_VERTS_OF_EDGE */
+	BM_FACE, /* BM_FACES_OF_EDGE */
+	BM_VERT, /* BM_VERTS_OF_FACE */
+	BM_EDGE, /* BM_EDGES_OF_FACE */
+	BM_LOOP, /* BM_LOOPS_OF_FACE */
+	BM_LOOP, /* BM_ALL_LOOPS_OF_FACE */
+	BM_LOOP, /* BM_LOOPS_OF_LOOP */
+	BM_LOOP  /* BM_LOOPS_OF_EDGE */
+};
+
+/**
+ * \note Use #BM_vert_at_index / #BM_edge_at_index / #BM_face_at_index for mesh arrays.
+ */
+void *BM_iter_at_index(BMesh *bm, const char itype, void *data, int index)
+{
+	BMIter iter;
+	void *val;
+	int i;
+
+	/* sanity check */
+	if (index < 0) {
+		return NULL;
+	}
+
+	val = BM_iter_new(&iter, bm, itype, data);
+
+	i = 0;
+	while (i < index) {
+		val = BM_iter_step(&iter);
+		i++;
+	}
+
+	return val;
+}
+
+
+/**
+ * \brief Iterator as Array
+ *
+ * Sometimes its convenient to get the iterator as an array
+ * to avoid multiple calls to #BM_iter_at_index.
+ */
+int BM_iter_as_array(BMesh *bm, const char itype, void *data, void **array, const int len)
+{
+	int i = 0;
+
+	/* sanity check */
+	if (len > 0) {
+		BMIter iter;
+		void *ele;
+
+		for (ele = BM_iter_new(&iter, bm, itype, data); ele; ele = BM_iter_step(&iter)) {
+			array[i] = ele;
+			i++;
+			if (i == len) {
+				return len;
+			}
+		}
+	}
+
+	return i;
+}
+
+
+/**
+ * \brief Init Iterator
+ *
+ * Clears the internal state of an iterator for begin() callbacks.
+ */
+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->ldata = NULL;
+}
+
+/**
+ * Notes on iterator implementation:
+ *
+ * Iterators keep track of the next element in a sequence.
+ * When a step() callback is invoked the current value of 'next'
+ * is stored to be returned later and the next variable is incremented.
+ *
+ * When the end of a sequence is reached, next should always equal NULL
+ *
+ * The 'bmiter__' prefix is used because these are used in
+ * bmesh_iterators_inine.c but should otherwise be seen as
+ * private.
+ */
+
+/*
+ * VERT OF MESH CALLBACKS
+ */
+
+void bmiter__vert_of_mesh_begin(BMIter *iter)
+{
+	BLI_mempool_iternew(iter->bm->vpool, &iter->pooliter);
+}
+
+void  *bmiter__vert_of_mesh_step(BMIter *iter)
+{
+	return BLI_mempool_iterstep(&iter->pooliter);
+
+}
+
+void  bmiter__edge_of_mesh_begin(BMIter *iter)
+{
+	BLI_mempool_iternew(iter->bm->epool, &iter->pooliter);
+}
+
+void  *bmiter__edge_of_mesh_step(BMIter *iter)
+{
+	return BLI_mempool_iterstep(&iter->pooliter);
+
+}
+
+void  bmiter__face_of_mesh_begin(BMIter *iter)
+{
+	BLI_mempool_iternew(iter->bm->fpool, &iter->pooliter);
+}
+
+void  *bmiter__face_of_mesh_step(BMIter *iter)
+{
+	return BLI_mempool_iterstep(&iter->pooliter);
+
+}
+
+/*
+ * EDGE OF VERT CALLBACKS
+ */
+
+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;
+	}
+}
+
+void  *bmiter__edge_of_vert_step(BMIter *iter)
+{
+	BMEdge *current = iter->nextedge;
+
+	if (iter->nextedge)
+		iter->nextedge = bmesh_disk_edge_next(iter->nextedge, iter->vdata);
+	
+	if (iter->nextedge == iter->firstedge) iter->nextedge = NULL;
+
+	return current;
+}
+
+/*
+ * FACE OF VERT CALLBACKS
+ */
+
+void  bmiter__face_of_vert_begin(BMIter *iter)
+{
+	init_iterator(iter);
+	iter->count = 0;
+	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;
+	}
+}
+void  *bmiter__face_of_vert_step(BMIter *iter)
+{
+	BMLoop *current = iter->nextloop;
+
+	if (iter->count && iter->nextloop) {
+		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;
+		}
+	}
+	
+	if (!iter->count) iter->nextloop = NULL;
+
+	return current ? current->f : NULL;
+}
+
+
+/*
+ * LOOP OF VERT CALLBACKS
+ *
+ */
+
+void  bmiter__loop_of_vert_begin(BMIter *iter)
+{
+	init_iterator(iter);
+	iter->count = 0;
+	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;
+	}
+}
+void  *bmiter__loop_of_vert_step(BMIter *iter)
+{
+	BMLoop *current = iter->nextloop;
+
+	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;
+		}
+	}
+	
+	if (!iter->count) iter->nextloop = NULL;
+
+	
+	if (current) {
+		return current;
+	}
+
+	return NULL;
+}
+
+
+void  bmiter__loops_of_edge_begin(BMIter *iter)
+{
+	BMLoop *l;
+
+	l = iter->edata->l;
+
+	/* note sure why this sets ldata ... */
+	init_iterator(iter);
+	
+	iter->firstloop = iter->nextloop = l;
+}
+
+void  *bmiter__loops_of_edge_step(BMIter *iter)
+{
+	BMLoop *current = iter->nextloop;
+
+	if (iter->nextloop) {
+		iter->nextloop = iter->nextloop->radial_next;
+	}
+
+	if (iter->nextloop == iter->firstloop) {
+		iter->nextloop = NULL;
+	}
+
+	if (current) {
+		return current;
+	}
+
+	return NULL;
+}
+
+void  bmiter__loops_of_loop_begin(BMIter *iter)
+{
+	BMLoop *l;
+
+	l = iter->ldata;
+
+	/* note sure why this sets ldata ... */
+	init_iterator(iter);
+
+	iter->firstloop = l;
+	iter->nextloop = iter->firstloop->radial_next;
+	
+	if (iter->nextloop == iter->firstloop)
+		iter->nextloop = NULL;
+}
+
+void  *bmiter__loops_of_loop_step(BMIter *iter)
+{
+	BMLoop *current = iter->nextloop;
+	
+	if (iter->nextloop) {
+		iter->nextloop = iter->nextloop->radial_next;
+	}
+
+	if (iter->nextloop == iter->firstloop) {
+		iter->nextloop = NULL;
+	}
+
+	if (current) {
+		return current;
+	}
+
+	return NULL;
+}
+
+/*
+ * FACE OF EDGE CALLBACKS
+ */
+
+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;
+	}
+}
+
+void  *bmiter__face_of_edge_step(BMIter *iter)
+{
+	BMLoop *current = iter->nextloop;
+
+	if (iter->nextloop) {
+		iter->nextloop = iter->nextloop->radial_next;
+	}
+
+	if (iter->nextloop == iter->firstloop) iter->nextloop = NULL;
+
+	return current ? current->f : NULL;
+}
+
+/*
+ * VERTS OF EDGE CALLBACKS
+ */
+
+void  bmiter__vert_of_edge_begin(BMIter *iter)
+{
+	init_iterator(iter);
+	iter->count = 0;
+}
+
+void  *bmiter__vert_of_edge_step(BMIter *iter)
+{
+	iter->count++;
+	switch (iter->count) {
+		case 1:
+			return iter->edata->v1;
+		case 2:
+			return iter->edata->v2;
+		default:
+			return NULL;
+	}
+}
+
+/*
+ * VERT OF FACE CALLBACKS
+ */
+
+void  bmiter__vert_of_face_begin(BMIter *iter)
+{
+	init_iterator(iter);
+	iter->firstloop = iter->nextloop = BM_FACE_FIRST_LOOP(iter->pdata);
+}
+
+void  *bmiter__vert_of_face_step(BMIter *iter)
+{
+	BMLoop *current = iter->nextloop;
+
+	if (iter->nextloop) iter->nextloop = iter->nextloop->next;
+	if (iter->nextloop == iter->firstloop) iter->nextloop = NULL;
+
+	return current ? current->v : NULL;
+}
+
+/*
+ * EDGE OF FACE CALLBACKS
+ */
+
+void  bmiter__edge_of_face_begin(BMIter *iter)
+{
+	init_iterator(iter);
+	iter->firstloop = iter->nextloop = BM_FACE_FIRST_LOOP(iter->pdata);
+}
+
+void  *bmiter__edge_of_face_step(BMIter *iter)
+{
+	BMLoop *current = iter->nextloop;
+
+	if (iter->nextloop) iter->nextloop = iter->nextloop->next;
+	if (iter->nextloop == iter->firstloop) iter->nextloop = NULL;
+	
+	return current ? current->e : NULL;
+}
+
+/*
+ * LOOP OF FACE CALLBACKS
+ */
+
+void  bmiter__loop_of_face_begin(BMIter *iter)
+{
+	init_iterator(iter);
+	iter->firstloop = iter->nextloop = BM_FACE_FIRST_LOOP(iter->pdata);
+}
+
+void  *bmiter__loop_of_face_step(BMIter *iter)
+{
+	BMLoop *current = iter->nextloop;
+
+	if (iter->nextloop) iter->nextloop = iter->nextloop->next;
+	if (iter->nextloop == iter->firstloop) iter->nextloop = NULL;
+
+	return current;
+}
diff --git a/source/blender/bmesh/intern/bmesh_iterators.h b/source/blender/bmesh/intern/bmesh_iterators.h
new file mode 100644
index 0000000..c687e4b
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_iterators.h
@@ -0,0 +1,151 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BMESH_ITERATORS_H__
+#define __BMESH_ITERATORS_H__
+
+/** \file blender/bmesh/intern/bmesh_iterators.h
+ *  \ingroup bmesh
+ */
+
+/**
+ * \brief BMesh Iterators
+ *
+ * The functions and structures in this file
+ * provide a unified method for iterating over
+ * the elements of a mesh and answering simple
+ * adjacency queries. Tool authors should use
+ * the iterators provided in this file instead
+ * of inspecting the structure directly.
+ *
+ */
+
+#include "BLI_mempool.h"
+
+/* Defines for passing to BM_iter_new.
+ *
+ * "OF" can be substituted for "around"
+ * so BM_VERTS_OF_FACE means "vertices
+ * around a face."
+ */
+
+/* these iterator over all elements of a specific
+ * type in the mesh.
+ *
+ * be sure to keep 'bm_iter_itype_htype_map' in sync with any changes
+ */
+typedef enum BMIterType {
+	BM_VERTS_OF_MESH = 1,
+	BM_EDGES_OF_MESH = 2,
+	BM_FACES_OF_MESH = 3,
+	/* these are topological iterators. */
+	BM_EDGES_OF_VERT = 4,
+	BM_FACES_OF_VERT = 5,
+	BM_LOOPS_OF_VERT = 6,
+	BM_VERTS_OF_EDGE = 7, /* just v1, v2: added so py can use generalized sequencer wrapper */
+	BM_FACES_OF_EDGE = 8,
+	BM_VERTS_OF_FACE = 9,
+	BM_EDGES_OF_FACE = 10,
+	BM_LOOPS_OF_FACE = 11,
+	/* returns elements from all boundaries, and returns
+	 * the first element at the end to flag that we're entering
+	 * a different face hole boundary*/
+	BM_ALL_LOOPS_OF_FACE = 12,
+	/* iterate through loops around this loop, which are fetched
+	 * from the other faces in the radial cycle surrounding the
+	 * input loop's edge.*/
+	BM_LOOPS_OF_LOOP = 13,
+	BM_LOOPS_OF_EDGE = 14
+} BMIterType;
+
+#define BM_ITYPE_MAX 15
+
+/* the iterator htype for each iterator */
+extern const char bm_iter_itype_htype_map[BM_ITYPE_MAX];
+
+#define BM_ITER_MESH(ele, iter, bm, itype) \
+	for (ele = BM_iter_new(iter, bm, itype, NULL); ele; ele = BM_iter_step(iter))
+
+#define BM_ITER_MESH_INDEX(ele, iter, bm, itype, indexvar) \
+	for (ele = BM_iter_new(iter, bm, itype, NULL), indexvar = 0; ele; ele = BM_iter_step(iter), (indexvar)++)
+
+#define BM_ITER_ELEM(ele, iter, data, itype) \
+	for (ele = BM_iter_new(iter, NULL, itype, data); ele; ele = BM_iter_step(iter))
+
+#define BM_ITER_ELEM_INDEX(ele, iter, data, itype, indexvar) \
+	for (ele = BM_iter_new(iter, NULL, itype, data), indexvar = 0; ele; ele = BM_iter_step(iter), (indexvar)++)
+
+/* Iterator Structure */
+typedef struct BMIter {
+	BLI_mempool_iter pooliter;
+
+	BMVert *firstvert, *nextvert, *vdata;
+	BMEdge *firstedge, *nextedge, *edata;
+	BMLoop *firstloop, *nextloop, *ldata, *l;
+	BMFace *firstpoly, *nextpoly, *pdata;
+	BMesh *bm;
+	void (*begin)(struct BMIter *iter);
+	void *(*step)(struct BMIter *iter);
+	union {
+		void       *p;
+		int         i;
+		long        l;
+		float       f;
+	} filter;
+	int count;
+	char itype;
+} BMIter;
+
+void *BM_iter_at_index(BMesh *bm, const char itype, void *data, int index);
+int   BM_iter_as_array(BMesh *bm, const char itype, void *data, void **array, const int len);
+
+/* private for bmesh_iterators_inline.c */
+void  bmiter__vert_of_mesh_begin(struct BMIter *iter);
+void *bmiter__vert_of_mesh_step(struct BMIter *iter);
+void  bmiter__edge_of_mesh_begin(struct BMIter *iter);
+void *bmiter__edge_of_mesh_step(struct BMIter *iter);
+void  bmiter__face_of_mesh_begin(struct BMIter *iter);
+void *bmiter__face_of_mesh_step(struct BMIter *iter);
+void  bmiter__edge_of_vert_begin(struct BMIter *iter);
+void *bmiter__edge_of_vert_step(struct BMIter *iter);
+void  bmiter__face_of_vert_begin(struct BMIter *iter);
+void *bmiter__face_of_vert_step(struct BMIter *iter);
+void  bmiter__loop_of_vert_begin(struct BMIter *iter);
+void *bmiter__loop_of_vert_step(struct BMIter *iter);
+void  bmiter__loops_of_edge_begin(struct BMIter *iter);
+void *bmiter__loops_of_edge_step(struct BMIter *iter);
+void  bmiter__loops_of_loop_begin(struct BMIter *iter);
+void *bmiter__loops_of_loop_step(struct BMIter *iter);
+void  bmiter__face_of_edge_begin(struct BMIter *iter);
+void *bmiter__face_of_edge_step(struct BMIter *iter);
+void  bmiter__vert_of_edge_begin(struct BMIter *iter);
+void *bmiter__vert_of_edge_step(struct BMIter *iter);
+void  bmiter__vert_of_face_begin(struct BMIter *iter);
+void *bmiter__vert_of_face_step(struct BMIter *iter);
+void  bmiter__edge_of_face_begin(struct BMIter *iter);
+void *bmiter__edge_of_face_step(struct BMIter *iter);
+void  bmiter__loop_of_face_begin(struct BMIter *iter);
+void *bmiter__loop_of_face_step(struct BMIter *iter);
+
+#include "intern/bmesh_iterators_inline.h"
+
+#endif /* __BMESH_ITERATORS_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_iterators_inline.h b/source/blender/bmesh/intern/bmesh_iterators_inline.h
new file mode 100644
index 0000000..9681652
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_iterators_inline.h
@@ -0,0 +1,200 @@
+/*
+ * ***** 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, Geoffrey Bantle, Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/intern/bmesh_iterators_inline.h
+ *  \ingroup bmesh
+ *
+ * BMesh inline iterator functions.
+ */
+
+#ifndef __BMESH_ITERATORS_INLINE_H__
+#define __BMESH_ITERATORS_INLINE_H__
+
+/* inline here optimizes out the switch statement when called with
+ * constant values (which is very common), nicer for loop-in-loop situations */
+
+/**
+ * \brief Iterator Step
+ *
+ * Calls an iterators step fucntion to return the next element.
+ */
+BLI_INLINE void *BM_iter_step(BMIter *iter)
+{
+	return iter->step(iter);
+}
+
+
+/**
+ * \brief Iterator Init
+ *
+ * Takes a bmesh iterator structure and fills
+ * it with the appropriate function pointers based
+ * upon its type.
+ */
+BLI_INLINE int BM_iter_init(BMIter *iter, BMesh *bm, const char itype, void *data)
+{
+	/* int argtype; */
+	iter->itype = itype;
+	iter->bm = bm;
+
+	/* inlining optimizes out this switch when called with the defined type */
+	switch ((BMIterType)itype) {
+		case BM_VERTS_OF_MESH:
+			BLI_assert(bm != NULL);
+			BLI_assert(data == NULL);
+			iter->begin = bmiter__vert_of_mesh_begin;
+			iter->step =  bmiter__vert_of_mesh_step;
+			break;
+		case BM_EDGES_OF_MESH:
+			BLI_assert(bm != NULL);
+			BLI_assert(data == NULL);
+			iter->begin = bmiter__edge_of_mesh_begin;
+			iter->step =  bmiter__edge_of_mesh_step;
+			break;
+		case BM_FACES_OF_MESH:
+			BLI_assert(bm != NULL);
+			BLI_assert(data == NULL);
+			iter->begin = bmiter__face_of_mesh_begin;
+			iter->step =  bmiter__face_of_mesh_step;
+			break;
+		case BM_EDGES_OF_VERT:
+			if (UNLIKELY(!data)) {
+				return FALSE;
+			}
+
+			iter->begin = bmiter__edge_of_vert_begin;
+			iter->step =  bmiter__edge_of_vert_step;
+			iter->vdata = data;
+			break;
+		case BM_FACES_OF_VERT:
+			if (UNLIKELY(!data)) {
+				return FALSE;
+			}
+
+			iter->begin = bmiter__face_of_vert_begin;
+			iter->step =  bmiter__face_of_vert_step;
+			iter->vdata = data;
+			break;
+		case BM_LOOPS_OF_VERT:
+			if (UNLIKELY(!data)) {
+				return FALSE;
+			}
+
+			iter->begin = bmiter__loop_of_vert_begin;
+			iter->step =  bmiter__loop_of_vert_step;
+			iter->vdata = data;
+			break;
+		case BM_VERTS_OF_EDGE:
+			if (UNLIKELY(!data)) {
+				return FALSE;
+			}
+
+			iter->begin = bmiter__vert_of_edge_begin;
+			iter->step =  bmiter__vert_of_edge_step;
+			iter->edata = data;
+			break;
+		case BM_FACES_OF_EDGE:
+			if (UNLIKELY(!data)) {
+				return FALSE;
+			}
+
+			iter->begin = bmiter__face_of_edge_begin;
+			iter->step =  bmiter__face_of_edge_step;
+			iter->edata = data;
+			break;
+		case BM_VERTS_OF_FACE:
+			if (UNLIKELY(!data)) {
+				return FALSE;
+			}
+
+			iter->begin = bmiter__vert_of_face_begin;
+			iter->step =  bmiter__vert_of_face_step;
+			iter->pdata = data;
+			break;
+		case BM_EDGES_OF_FACE:
+			if (UNLIKELY(!data)) {
+				return FALSE;
+			}
+
+			iter->begin = bmiter__edge_of_face_begin;
+			iter->step =  bmiter__edge_of_face_step;
+			iter->pdata = data;
+			break;
+		case BM_LOOPS_OF_FACE:
+			if (UNLIKELY(!data)) {
+				return FALSE;
+			}
+
+			iter->begin = bmiter__loop_of_face_begin;
+			iter->step =  bmiter__loop_of_face_step;
+			iter->pdata = data;
+			break;
+		case BM_LOOPS_OF_LOOP:
+			if (UNLIKELY(!data)) {
+				return FALSE;
+			}
+
+			iter->begin = bmiter__loops_of_loop_begin;
+			iter->step =  bmiter__loops_of_loop_step;
+			iter->ldata = data;
+			break;
+		case BM_LOOPS_OF_EDGE:
+			if (UNLIKELY(!data)) {
+				return FALSE;
+			}
+
+			iter->begin = bmiter__loops_of_edge_begin;
+			iter->step =  bmiter__loops_of_edge_step;
+			iter->edata = data;
+			break;
+		default:
+			/* should never happen */
+			BLI_assert(0);
+			return FALSE;
+			break;
+	}
+	
+	iter->begin(iter);
+
+	return TRUE;
+}
+
+/**
+ * \brief Iterator New
+ *
+ * Takes a bmesh iterator structure and fills
+ * it with the appropriate function pointers based
+ * upon its type and then calls BMeshIter_step()
+ * to return the first element of the iterator.
+ *
+ */
+BLI_INLINE void *BM_iter_new(BMIter *iter, BMesh *bm, const char itype, void *data)
+{
+	if (LIKELY(BM_iter_init(iter, bm, itype, data))) {
+		return BM_iter_step(iter);
+	}
+	else {
+		return NULL;
+	}
+}
+
+#endif /* __BMESH_ITERATORS_INLINE_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c
new file mode 100644
index 0000000..a69558e
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_marking.c
@@ -0,0 +1,1035 @@
+/*
+ * ***** 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, Geoffrey Bantle, Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/intern/bmesh_marking.c
+ *  \ingroup bmesh
+ *
+ * Selection routines for bmesh structures.
+ * This is actually all old code ripped from
+ * editmesh_lib.c and slightly modified to work
+ * for bmesh's. This also means that it has some
+ * of the same problems.... something that
+ * that should be addressed eventually.
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_scene_types.h"
+
+#include "BLI_math.h"
+#include "BLI_listbase.h"
+
+#include "bmesh.h"
+
+static void recount_totsels(BMesh *bm)
+{
+	BMIter iter;
+	BMElem *ele;
+	const char iter_types[3] = {BM_VERTS_OF_MESH,
+	                            BM_EDGES_OF_MESH,
+	                            BM_FACES_OF_MESH};
+	int *tots[3];
+	int i;
+
+	/* recount (tot * sel) variables */
+	bm->totvertsel = bm->totedgesel = bm->totfacesel = 0;
+	tots[0] = &bm->totvertsel;
+	tots[1] = &bm->totedgesel;
+	tots[2] = &bm->totfacesel;
+
+	for (i = 0; i < 3; i++) {
+		ele = BM_iter_new(&iter, bm, iter_types[i], NULL);
+		for ( ; ele; ele = BM_iter_step(&iter)) {
+			if (BM_elem_flag_test(ele, BM_ELEM_SELECT)) *tots[i] += 1;
+		}
+	}
+}
+
+/**
+ * \brief Select Mode Flush
+ *
+ * Makes sure to flush selections 'upwards'
+ * (ie: all verts of an edge selects the edge and so on).
+ * This should only be called by system and not tool authors.
+ */
+void BM_mesh_select_mode_flush(BMesh *bm)
+{
+	BMEdge *e;
+	BMLoop *l_iter;
+	BMLoop *l_first;
+	BMFace *f;
+
+	BMIter eiter;
+	BMIter fiter;
+
+	int ok;
+
+	if (bm->selectmode & SCE_SELECT_VERTEX) {
+		BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) {
+			if (BM_elem_flag_test(e->v1, BM_ELEM_SELECT) &&
+			    BM_elem_flag_test(e->v2, BM_ELEM_SELECT) &&
+			    !BM_elem_flag_test(e, BM_ELEM_HIDDEN))
+			{
+				BM_elem_flag_enable(e, BM_ELEM_SELECT);
+			}
+			else {
+				BM_elem_flag_disable(e, BM_ELEM_SELECT);
+			}
+		}
+		BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
+			ok = TRUE;
+			if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
+				l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+				do {
+					if (!BM_elem_flag_test(l_iter->v, BM_ELEM_SELECT)) {
+						ok = FALSE;
+						break;
+					}
+				} while ((l_iter = l_iter->next) != l_first);
+			}
+			else {
+				ok = FALSE;
+			}
+
+			BM_elem_flag_set(f, BM_ELEM_SELECT, ok);
+		}
+	}
+	else if (bm->selectmode & SCE_SELECT_EDGE) {
+		BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
+			ok = TRUE;
+			if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
+				l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+				do {
+					if (!BM_elem_flag_test(l_iter->e, BM_ELEM_SELECT)) {
+						ok = FALSE;
+						break;
+					}
+				} while ((l_iter = l_iter->next) != l_first);
+			}
+			else {
+				ok = FALSE;
+			}
+
+			BM_elem_flag_set(f, BM_ELEM_SELECT, ok);
+		}
+	}
+
+	/* Remove any deselected elements from the BMEditSelection */
+	BM_select_history_validate(bm);
+
+	recount_totsels(bm);
+}
+
+/**
+ * mode independent flushing up/down
+ */
+void BM_mesh_deselect_flush(BMesh *bm)
+{
+	BMEdge *e;
+	BMLoop *l_iter;
+	BMLoop *l_first;
+	BMFace *f;
+
+	BMIter eiter;
+	BMIter fiter;
+
+	int ok;
+
+	BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) {
+		if (!(BM_elem_flag_test(e->v1, BM_ELEM_SELECT) &&
+		      BM_elem_flag_test(e->v2, BM_ELEM_SELECT) &&
+		      !BM_elem_flag_test(e, BM_ELEM_HIDDEN)))
+		{
+			BM_elem_flag_disable(e, BM_ELEM_SELECT);
+		}
+	}
+
+	BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
+		ok = TRUE;
+		if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
+			l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+			do {
+				if (!BM_elem_flag_test(l_iter->v, BM_ELEM_SELECT)) {
+					ok = FALSE;
+					break;
+				}
+			} while ((l_iter = l_iter->next) != l_first);
+		}
+		else {
+			ok = FALSE;
+		}
+
+		if (ok == FALSE) {
+			BM_elem_flag_disable(f, BM_ELEM_SELECT);
+		}
+	}
+
+	/* Remove any deselected elements from the BMEditSelection */
+	BM_select_history_validate(bm);
+
+	recount_totsels(bm);
+}
+
+
+/**
+ * mode independent flushing up/down
+ */
+void BM_mesh_select_flush(BMesh *bm)
+{
+	BMEdge *e;
+	BMLoop *l_iter;
+	BMLoop *l_first;
+	BMFace *f;
+
+	BMIter eiter;
+	BMIter fiter;
+
+	int ok;
+
+	BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) {
+		if (BM_elem_flag_test(e->v1, BM_ELEM_SELECT) &&
+		    BM_elem_flag_test(e->v2, BM_ELEM_SELECT) &&
+		    !BM_elem_flag_test(e, BM_ELEM_HIDDEN))
+		{
+			BM_elem_flag_enable(e, BM_ELEM_SELECT);
+		}
+	}
+
+	BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
+		ok = TRUE;
+		if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
+			l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+			do {
+				if (!BM_elem_flag_test(l_iter->v, BM_ELEM_SELECT)) {
+					ok = FALSE;
+					break;
+				}
+			} while ((l_iter = l_iter->next) != l_first);
+		}
+		else {
+			ok = FALSE;
+		}
+
+		if (ok) {
+			BM_elem_flag_enable(f, BM_ELEM_SELECT);
+		}
+	}
+
+	recount_totsels(bm);
+}
+
+/**
+ * \brief Select Vert
+ *
+ * Changes selection state of a single vertex
+ * in a mesh
+ */
+void BM_vert_select_set(BMesh *bm, BMVert *v, int select)
+{
+	BLI_assert(v->head.htype == BM_VERT);
+
+	if (BM_elem_flag_test(v, BM_ELEM_HIDDEN)) {
+		return;
+	}
+
+	if (select) {
+		if (!BM_elem_flag_test(v, BM_ELEM_SELECT)) {
+			bm->totvertsel += 1;
+			BM_elem_flag_enable(v, BM_ELEM_SELECT);
+		}
+	}
+	else {
+		if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
+			bm->totvertsel -= 1;
+			BM_elem_flag_disable(v, BM_ELEM_SELECT);
+		}
+	}
+}
+
+/**
+ * \brief Select Edge
+ *
+ * Changes selection state of a single edge in a mesh.
+ */
+void BM_edge_select_set(BMesh *bm, BMEdge *e, int select)
+{
+	BLI_assert(e->head.htype == BM_EDGE);
+
+	if (BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
+		return;
+	}
+
+	if (select) {
+		if (!BM_elem_flag_test(e, BM_ELEM_SELECT)) bm->totedgesel += 1;
+
+		BM_elem_flag_enable(e, BM_ELEM_SELECT);
+		BM_vert_select_set(bm, e->v1, TRUE);
+		BM_vert_select_set(bm, e->v2, TRUE);
+	}
+	else {
+		if (BM_elem_flag_test(e, BM_ELEM_SELECT)) bm->totedgesel -= 1;
+		BM_elem_flag_disable(e, BM_ELEM_SELECT);
+
+		if (bm->selectmode == SCE_SELECT_EDGE ||
+		    bm->selectmode == SCE_SELECT_FACE ||
+		    bm->selectmode == (SCE_SELECT_EDGE | SCE_SELECT_FACE))
+		{
+
+			BMIter iter;
+			BMVert *verts[2] = {e->v1, e->v2};
+			BMEdge *e2;
+			int i;
+
+			for (i = 0; i < 2; i++) {
+				int deselect = 1;
+
+				for (e2 = BM_iter_new(&iter, bm, BM_EDGES_OF_VERT, verts[i]); e2; e2 = BM_iter_step(&iter)) {
+					if (e2 == e) {
+						continue;
+					}
+
+					if (BM_elem_flag_test(e2, BM_ELEM_SELECT)) {
+						deselect = 0;
+						break;
+					}
+				}
+
+				if (deselect) {
+					BM_vert_select_set(bm, verts[i], FALSE);
+				}
+			}
+		}
+		else {
+			BM_vert_select_set(bm, e->v1, FALSE);
+			BM_vert_select_set(bm, e->v2, FALSE);
+		}
+
+	}
+}
+
+/**
+ * \brief Select Face
+ *
+ * Changes selection state of a single
+ * face in a mesh.
+ */
+void BM_face_select_set(BMesh *bm, BMFace *f, int select)
+{
+	BMLoop *l_iter;
+	BMLoop *l_first;
+
+	BLI_assert(f->head.htype == BM_FACE);
+
+	if (BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
+		return;
+	}
+
+	if (select) {
+		if (!BM_elem_flag_test(f, BM_ELEM_SELECT)) {
+			bm->totfacesel++;
+		}
+
+		BM_elem_flag_enable(f, BM_ELEM_SELECT);
+		l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+		do {
+			BM_vert_select_set(bm, l_iter->v, TRUE);
+			BM_edge_select_set(bm, l_iter->e, TRUE);
+		} while ((l_iter = l_iter->next) != l_first);
+	}
+	else {
+		BMIter liter;
+		BMLoop *l;
+
+		if (BM_elem_flag_test(f, BM_ELEM_SELECT)) bm->totfacesel -= 1;
+		BM_elem_flag_disable(f, BM_ELEM_SELECT);
+
+		/* flush down to edges */
+		BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+			BMIter fiter;
+			BMFace *f2;
+			BM_ITER_ELEM (f2, &fiter, l->e, BM_FACES_OF_EDGE) {
+				if (BM_elem_flag_test(f2, BM_ELEM_SELECT))
+					break;
+			}
+
+			if (!f2) {
+				BM_edge_select_set(bm, l->e, FALSE);
+			}
+		}
+
+		/* flush down to verts */
+		BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+			BMIter eiter;
+			BMEdge *e;
+			BM_ITER_ELEM (e, &eiter, l->v, BM_EDGES_OF_VERT) {
+				if (BM_elem_flag_test(e, BM_ELEM_SELECT))
+					break;
+			}
+
+			if (!e) {
+				BM_vert_select_set(bm, l->v, FALSE);
+			}
+		}
+	}
+}
+
+/**
+ * Select Mode Set
+ *
+ * Sets the selection mode for the bmesh,
+ * updating the selection state.
+ */
+void BM_mesh_select_mode_set(BMesh *bm, int selectmode)
+{
+	BMIter iter;
+	BMElem *ele;
+	
+	bm->selectmode = selectmode;
+
+	if (bm->selectmode & SCE_SELECT_VERTEX) {
+		/* disabled because selection flushing handles these */
+#if 0
+		BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) {
+			BM_elem_flag_disable(ele, BM_ELEM_SELECT);
+		}
+		BM_ITER_MESH (ele, &iter, bm, BM_FACES_OF_MESH) {
+			BM_elem_flag_disable(ele, BM_ELEM_SELECT);
+		}
+#endif
+		BM_mesh_select_mode_flush(bm);
+	}
+	else if (bm->selectmode & SCE_SELECT_EDGE) {
+		/* disabled because selection flushing handles these */
+#if 0
+		BM_ITER_MESH (ele, &iter, bm, BM_VERTS_OF_MESH) {
+			BM_elem_flag_disable(ele, BM_ELEM_SELECT);
+		}
+#endif
+
+		BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) {
+			if (BM_elem_flag_test(ele, BM_ELEM_SELECT)) {
+				BM_edge_select_set(bm, (BMEdge *)ele, TRUE);
+			}
+		}
+		BM_mesh_select_mode_flush(bm);
+	}
+	else if (bm->selectmode & SCE_SELECT_FACE) {
+		/* disabled because selection flushing handles these */
+#if 0
+		BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) {
+			BM_elem_flag_disable(ele, BM_ELEM_SELECT);
+		}
+#endif
+		BM_ITER_MESH (ele, &iter, bm, BM_FACES_OF_MESH) {
+			if (BM_elem_flag_test(ele, BM_ELEM_SELECT)) {
+				BM_face_select_set(bm, (BMFace *)ele, TRUE);
+			}
+		}
+		BM_mesh_select_mode_flush(bm);
+	}
+}
+
+/**
+ * counts number of elements with flag enabled/disabled
+ */
+static int bm_mesh_flag_count(BMesh *bm, const char htype, const char hflag,
+                              const short respecthide, const short test_for_enabled)
+{
+	BMElem *ele;
+	BMIter iter;
+	int tot = 0;
+
+	BLI_assert(ELEM(TRUE, FALSE, test_for_enabled));
+
+	if (htype & BM_VERT) {
+		for (ele = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); ele; ele = BM_iter_step(&iter)) {
+			if (respecthide && BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) continue;
+			if (BM_elem_flag_test_bool(ele, hflag) == test_for_enabled) tot++;
+		}
+	}
+	if (htype & BM_EDGE) {
+		for (ele = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, NULL); ele; ele = BM_iter_step(&iter)) {
+			if (respecthide && BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) continue;
+			if (BM_elem_flag_test_bool(ele, hflag) == test_for_enabled) tot++;
+		}
+	}
+	if (htype & BM_FACE) {
+		for (ele = BM_iter_new(&iter, bm, BM_FACES_OF_MESH, NULL); ele; ele = BM_iter_step(&iter)) {
+			if (respecthide && BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) continue;
+			if (BM_elem_flag_test_bool(ele, hflag) == test_for_enabled) tot++;
+		}
+	}
+
+	return tot;
+}
+
+int BM_mesh_elem_hflag_count_enabled(BMesh *bm, const char htype, const char hflag, int respecthide)
+{
+	return bm_mesh_flag_count(bm, htype, hflag, respecthide, TRUE);
+}
+
+int BM_mesh_elem_hflag_count_disabled(BMesh *bm, const char htype, const char hflag, int respecthide)
+{
+	return bm_mesh_flag_count(bm, htype, hflag, respecthide, FALSE);
+}
+
+/**
+ * \note use BM_elem_flag_test(ele, BM_ELEM_SELECT) to test selection
+ * \note by design, this will not touch the editselection history stuff
+ */
+void BM_elem_select_set(BMesh *bm, BMElem *ele, int select)
+{
+	switch (ele->head.htype) {
+		case BM_VERT:
+			BM_vert_select_set(bm, (BMVert *)ele, select);
+			break;
+		case BM_EDGE:
+			BM_edge_select_set(bm, (BMEdge *)ele, select);
+			break;
+		case BM_FACE:
+			BM_face_select_set(bm, (BMFace *)ele, select);
+			break;
+		default:
+			BLI_assert(0);
+			break;
+	}
+}
+
+/* this replaces the active flag used in uv/face mode */
+void BM_active_face_set(BMesh *bm, BMFace *efa)
+{
+	bm->act_face = efa;
+}
+
+BMFace *BM_active_face_get(BMesh *bm, int sloppy)
+{
+	if (bm->act_face) {
+		return bm->act_face;
+	}
+	else if (sloppy) {
+		BMIter iter;
+		BMFace *f = NULL;
+		BMEditSelection *ese;
+		
+		/* Find the latest non-hidden face from the BMEditSelection */
+		ese = bm->selected.last;
+		for ( ; ese; ese = ese->prev) {
+			if (ese->htype == BM_FACE) {
+				f = (BMFace *)ese->ele;
+				
+				if (BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
+					f = NULL;
+				}
+				else {
+					break;
+				}
+			}
+		}
+		/* Last attempt: try to find any selected face */
+		if (f == NULL) {
+			BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+				if (BM_elem_flag_test(f, BM_ELEM_SELECT)) {
+					break;
+				}
+			}
+		}
+		return f; /* can still be null */
+	}
+	return NULL;
+}
+
+/**
+ * Generic way to get data from an EditSelection type
+ * These functions were written to be used by the Modifier widget
+ * when in Rotate about active mode, but can be used anywhere.
+ *
+ * - #EM_editselection_center
+ * - #EM_editselection_normal
+ * - #EM_editselection_plane
+ */
+void BM_editselection_center(BMEditSelection *ese, float r_center[3])
+{
+	if (ese->htype == BM_VERT) {
+		BMVert *eve = (BMVert *)ese->ele;
+		copy_v3_v3(r_center, eve->co);
+	}
+	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);
+	}
+	else if (ese->htype == BM_FACE) {
+		BMFace *efa = (BMFace *)ese->ele;
+		BM_face_calc_center_bounds(efa, r_center);
+	}
+}
+
+void BM_editselection_normal(BMEditSelection *ese, float r_normal[3])
+{
+	if (ese->htype == BM_VERT) {
+		BMVert *eve = (BMVert *)ese->ele;
+		copy_v3_v3(r_normal, eve->no);
+	}
+	else if (ese->htype == BM_EDGE) {
+		BMEdge *eed = (BMEdge *)ese->ele;
+		float plane[3]; /* need a plane to correct the normal */
+		float vec[3]; /* temp vec storage */
+		
+		add_v3_v3v3(r_normal, eed->v1->no, eed->v2->no);
+		sub_v3_v3v3(plane, eed->v2->co, eed->v1->co);
+		
+		/* the 2 vertex normals will be close but not at rightangles to the edge
+		 * for rotate about edge we want them to be at right angles, so we need to
+		 * do some extra colculation to correct the vert normals,
+		 * we need the plane for this */
+		cross_v3_v3v3(vec, r_normal, plane);
+		cross_v3_v3v3(r_normal, plane, vec);
+		normalize_v3(r_normal);
+		
+	}
+	else if (ese->htype == BM_FACE) {
+		BMFace *efa = (BMFace *)ese->ele;
+		copy_v3_v3(r_normal, efa->no);
+	}
+}
+
+/* ref - editmesh_lib.cL:EM_editselection_plane() */
+
+/* Calculate a plane that is rightangles to the edge/vert/faces normal
+ * also make the plane run along an axis that is related to the geometry,
+ * because this is used for the manipulators Y axis. */
+void BM_editselection_plane(BMEditSelection *ese, float r_plane[3])
+{
+	if (ese->htype == BM_VERT) {
+		BMVert *eve = (BMVert *)ese->ele;
+		float vec[3] = {0.0f, 0.0f, 0.0f};
+		
+		if (ese->prev) { /* use previously selected data to make a useful vertex plane */
+			BM_editselection_center(ese->prev, vec);
+			sub_v3_v3v3(r_plane, vec, eve->co);
+		}
+		else {
+			/* make a fake  plane thats at rightangles to the normal
+			 * we cant make a crossvec from a vec thats the same as the vec
+			 * unlikely but possible, so make sure if the normal is (0, 0, 1)
+			 * that vec isn't the same or in the same direction even. */
+			if      (eve->no[0] < 0.5f) vec[0] = 1.0f;
+			else if (eve->no[1] < 0.5f) vec[1] = 1.0f;
+			else                        vec[2] = 1.0f;
+			cross_v3_v3v3(r_plane, eve->no, vec);
+		}
+	}
+	else if (ese->htype == BM_EDGE) {
+		BMEdge *eed = (BMEdge *)ese->ele;
+
+		/* the plane is simple, it runs along the edge
+		 * however selecting different edges can swap the direction of the y axis.
+		 * this makes it less likely for the y axis of the manipulator
+		 * (running along the edge).. to flip less often.
+		 * at least its more predictable */
+		if (eed->v2->co[1] > eed->v1->co[1]) {  /* check which to do first */
+			sub_v3_v3v3(r_plane, eed->v2->co, eed->v1->co);
+		}
+		else {
+			sub_v3_v3v3(r_plane, eed->v1->co, eed->v2->co);
+		}
+		
+	}
+	else if (ese->htype == BM_FACE) {
+		BMFace *efa = (BMFace *)ese->ele;
+		float vec[3] = {0.0f, 0.0f, 0.0f};
+		
+		/* for now, use face normal */
+
+		/* make a fake plane thats at rightangles to the normal
+		 * we cant make a crossvec from a vec thats the same as the vec
+		 * unlikely but possible, so make sure if the normal is (0, 0, 1)
+		 * that vec isn't the same or in the same direction even. */
+		if (efa->len < 3) {
+			/* crappy fallback method */
+			if      (efa->no[0] < 0.5f)	vec[0] = 1.0f;
+			else if (efa->no[1] < 0.5f)	vec[1] = 1.0f;
+			else                        vec[2] = 1.0f;
+			cross_v3_v3v3(r_plane, efa->no, vec);
+		}
+		else {
+			BMVert *verts[4] = {NULL};
+
+			BM_iter_as_array(NULL, BM_VERTS_OF_FACE, efa, (void **)verts, 4);
+
+			if (efa->len == 4) {
+				float vecA[3], vecB[3];
+				sub_v3_v3v3(vecA, verts[3]->co, verts[2]->co);
+				sub_v3_v3v3(vecB, verts[0]->co, verts[1]->co);
+				add_v3_v3v3(r_plane, vecA, vecB);
+
+				sub_v3_v3v3(vecA, verts[0]->co, verts[3]->co);
+				sub_v3_v3v3(vecB, verts[1]->co, verts[2]->co);
+				add_v3_v3v3(vec, vecA, vecB);
+				/* use the biggest edge length */
+				if (dot_v3v3(r_plane, r_plane) < dot_v3v3(vec, vec)) {
+					copy_v3_v3(r_plane, vec);
+				}
+			}
+			else {
+				/* BMESH_TODO (not urgent, use longest ngon edge for alignment) */
+
+				/* start with v1-2 */
+				sub_v3_v3v3(r_plane, verts[0]->co, verts[1]->co);
+
+				/* test the edge between v2-3, use if longer */
+				sub_v3_v3v3(vec, verts[1]->co, verts[2]->co);
+				if (dot_v3v3(r_plane, r_plane) < dot_v3v3(vec, vec))
+					copy_v3_v3(r_plane, vec);
+
+				/* test the edge between v1-3, use if longer */
+				sub_v3_v3v3(vec, verts[2]->co, verts[0]->co);
+				if (dot_v3v3(r_plane, r_plane) < dot_v3v3(vec, vec)) {
+					copy_v3_v3(r_plane, vec);
+				}
+			}
+
+		}
+	}
+	normalize_v3(r_plane);
+}
+
+
+/* --- macro wrapped funcs --- */
+int _bm_select_history_check(BMesh *bm, const BMHeader *ele)
+{
+	BMEditSelection *ese;
+	
+	for (ese = bm->selected.first; ese; ese = ese->next) {
+		if (ese->ele == (BMElem *)ele) {
+			return TRUE;
+		}
+	}
+	
+	return FALSE;
+}
+
+int _bm_select_history_remove(BMesh *bm, BMHeader *ele)
+{
+	BMEditSelection *ese;
+	for (ese = bm->selected.first; ese; ese = ese->next) {
+		if (ese->ele == (BMElem *)ele) {
+			BLI_freelinkN(&(bm->selected), ese);
+			return TRUE;
+		}
+	}
+
+	return FALSE;
+}
+
+void _bm_select_history_store_notest(BMesh *bm, BMHeader *ele)
+{
+	BMEditSelection *ese = (BMEditSelection *) MEM_callocN(sizeof(BMEditSelection), "BMEdit Selection");
+	ese->htype = ele->htype;
+	ese->ele = (BMElem *)ele;
+	BLI_addtail(&(bm->selected), ese);
+}
+
+void _bm_select_history_store(BMesh *bm, BMHeader *ele)
+{
+	if (!BM_select_history_check(bm, (BMElem *)ele)) {
+		BM_select_history_store_notest(bm, (BMElem *)ele);
+	}
+}
+/* --- end macro wrapped funcs --- */
+
+
+void BM_select_history_clear(BMesh *bm)
+{
+	BLI_freelistN(&bm->selected);
+	bm->selected.first = bm->selected.last = NULL;
+}
+
+
+void BM_select_history_validate(BMesh *bm)
+{
+	BMEditSelection *ese, *nextese;
+
+	ese = bm->selected.first;
+
+	while (ese) {
+		nextese = ese->next;
+		if (!BM_elem_flag_test(ese->ele, BM_ELEM_SELECT)) {
+			BLI_freelinkN(&(bm->selected), ese);
+		}
+		ese = nextese;
+	}
+}
+
+/* utility function */
+int BM_select_history_active_get(BMesh *bm, BMEditSelection *ese)
+{
+	BMEditSelection *ese_last = bm->selected.last;
+	BMFace *efa = BM_active_face_get(bm, FALSE);
+
+	ese->next = ese->prev = NULL;
+
+	if (ese_last) {
+		if (ese_last->htype == BM_FACE) { /* if there is an active face, use it over the last selected face */
+			if (efa) {
+				ese->ele = (BMElem *)efa;
+			}
+			else {
+				ese->ele = ese_last->ele;
+			}
+			ese->htype = BM_FACE;
+		}
+		else {
+			ese->ele =   ese_last->ele;
+			ese->htype = ese_last->htype;
+		}
+	}
+	else if (efa) { /* no */
+		ese->ele   = (BMElem *)efa;
+		ese->htype = BM_FACE;
+	}
+	else {
+		ese->ele = NULL;
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+void BM_mesh_elem_hflag_disable_test(BMesh *bm, const char htype, const char hflag,
+                                     int respecthide, const char hflag_test)
+{
+	const char iter_types[3] = {BM_VERTS_OF_MESH,
+	                            BM_EDGES_OF_MESH,
+	                            BM_FACES_OF_MESH};
+
+	const char flag_types[3] = {BM_VERT, BM_EDGE, BM_FACE};
+
+	BMIter iter;
+	BMElem *ele;
+	int i;
+
+	if (hflag & BM_ELEM_SELECT) {
+		BM_select_history_clear(bm);
+	}
+
+	if ((htype == (BM_VERT | BM_EDGE | BM_FACE)) &&
+	    (hflag == BM_ELEM_SELECT) &&
+	    (respecthide == FALSE) &&
+	    (hflag_test == 0))
+	{
+		/* fast path for deselect all, avoid topology loops
+		 * since we know all will be de-selected anyway. */
+		for (i = 0; i < 3; i++) {
+			ele = BM_iter_new(&iter, bm, iter_types[i], NULL);
+			for ( ; ele; ele = BM_iter_step(&iter)) {
+				BM_elem_flag_disable(ele, BM_ELEM_SELECT);
+			}
+		}
+		bm->totvertsel = bm->totedgesel = bm->totfacesel = 0;
+	}
+	else {
+		for (i = 0; i < 3; i++) {
+			if (htype & flag_types[i]) {
+				ele = BM_iter_new(&iter, bm, iter_types[i], NULL);
+				for ( ; ele; ele = BM_iter_step(&iter)) {
+
+					if (respecthide && BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) {
+						continue;
+					}
+					if (hflag_test && !BM_elem_flag_test(ele, hflag_test)) {
+						continue;
+					}
+
+					if (hflag & BM_ELEM_SELECT) {
+						BM_elem_select_set(bm, ele, FALSE);
+					}
+					BM_elem_flag_disable(ele, hflag);
+				}
+			}
+		}
+	}
+}
+
+void BM_mesh_elem_hflag_enable_test(BMesh *bm, const char htype, const char hflag,
+                                    int respecthide, const char hflag_test)
+{
+	const char iter_types[3] = {BM_VERTS_OF_MESH,
+	                            BM_EDGES_OF_MESH,
+	                            BM_FACES_OF_MESH};
+
+	const char flag_types[3] = {BM_VERT, BM_EDGE, BM_FACE};
+
+	/* use the nosel version when setting so under no
+	 * condition may a hidden face become selected.
+	 * Applying other flags to hidden faces is OK. */
+	const char hflag_nosel = hflag & ~BM_ELEM_SELECT;
+
+	BMIter iter;
+	BMElem *ele;
+	int i;
+
+	if (hflag & BM_ELEM_SELECT) {
+		BM_select_history_clear(bm);
+	}
+
+	/* note, better not attempt a fast path for selection as done with de-select
+	 * because hidden geometry and different selection modes can give different results,
+	 * we could of course check for no hiddent faces and then use quicker method but its not worth it. */
+
+	for (i = 0; i < 3; i++) {
+		if (htype & flag_types[i]) {
+			ele = BM_iter_new(&iter, bm, iter_types[i], NULL);
+			for ( ; ele; ele = BM_iter_step(&iter)) {
+
+				if (respecthide && BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) {
+					continue;
+				}
+				if (hflag_test && !BM_elem_flag_test(ele, hflag_test)) {
+					continue;
+				}
+
+				if (hflag & BM_ELEM_SELECT) {
+					BM_elem_select_set(bm, ele, TRUE);
+				}
+				BM_elem_flag_enable(ele, hflag_nosel);
+			}
+		}
+	}
+}
+
+void BM_mesh_elem_hflag_disable_all(BMesh *bm, const char htype, const char hflag,
+                                    int respecthide)
+{
+	/* call with 0 hflag_test */
+	BM_mesh_elem_hflag_disable_test(bm, htype, hflag, respecthide, 0);
+}
+
+void BM_mesh_elem_hflag_enable_all(BMesh *bm, const char htype, const char hflag,
+                                   int respecthide)
+{
+	/* call with 0 hflag_test */
+	BM_mesh_elem_hflag_enable_test(bm, htype, hflag, respecthide, 0);
+}
+
+/***************** Mesh Hiding stuff *********** */
+
+static void vert_flush_hide_set(BMVert *v)
+{
+	BMIter iter;
+	BMEdge *e;
+	int hide = TRUE;
+
+	BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
+		hide = hide && BM_elem_flag_test(e, BM_ELEM_HIDDEN);
+	}
+
+	BM_elem_flag_set(v, BM_ELEM_HIDDEN, hide);
+}
+
+static void edge_flush_hide(BMEdge *e)
+{
+	BMIter iter;
+	BMFace *f;
+	int hide = TRUE;
+
+	BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) {
+		hide = hide && BM_elem_flag_test(f, BM_ELEM_HIDDEN);
+	}
+
+	BM_elem_flag_set(e, BM_ELEM_HIDDEN, hide);
+}
+
+void BM_vert_hide_set(BMVert *v, int hide)
+{
+	/* vert hiding: vert + surrounding edges and faces */
+	BMIter iter, fiter;
+	BMEdge *e;
+	BMFace *f;
+
+	BM_elem_flag_set(v, BM_ELEM_HIDDEN, hide);
+
+	BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
+		BM_elem_flag_set(e, BM_ELEM_HIDDEN, hide);
+
+		BM_ITER_ELEM (f, &fiter, e, BM_FACES_OF_EDGE) {
+			BM_elem_flag_set(f, BM_ELEM_HIDDEN, hide);
+		}
+	}
+}
+
+void BM_edge_hide_set(BMEdge *e, int hide)
+{
+	BMIter iter;
+	BMFace *f;
+	/* BMVert *v; */
+
+	/* edge hiding: faces around the edge */
+	BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) {
+		BM_elem_flag_set(f, BM_ELEM_HIDDEN, hide);
+	}
+	
+	BM_elem_flag_set(e, BM_ELEM_HIDDEN, hide);
+
+	/* hide vertices if necessary */
+	vert_flush_hide_set(e->v1);
+	vert_flush_hide_set(e->v2);
+}
+
+void BM_face_hide_set(BMFace *f, int hide)
+{
+	BMIter iter;
+	BMLoop *l;
+
+	BM_elem_flag_set(f, BM_ELEM_HIDDEN, hide);
+
+	BM_ITER_ELEM (l, &iter, f, BM_LOOPS_OF_FACE) {
+		edge_flush_hide(l->e);
+	}
+
+	BM_ITER_ELEM (l, &iter, f, BM_LOOPS_OF_FACE) {
+		vert_flush_hide_set(l->v);
+	}
+}
+
+void _bm_elem_hide_set(BMesh *bm, BMHeader *head, int hide)
+{
+	/* Follow convention of always deselecting before
+	 * hiding an element */
+	switch (head->htype) {
+		case BM_VERT:
+			if (hide) BM_vert_select_set(bm, (BMVert *)head, FALSE);
+			BM_vert_hide_set((BMVert *)head, hide);
+			break;
+		case BM_EDGE:
+			if (hide) BM_edge_select_set(bm, (BMEdge *)head, FALSE);
+			BM_edge_hide_set((BMEdge *)head, hide);
+			break;
+		case BM_FACE:
+			if (hide) BM_face_select_set(bm, (BMFace *)head, FALSE);
+			BM_face_hide_set((BMFace *)head, hide);
+			break;
+		default:
+			BMESH_ASSERT(0);
+			break;
+	}
+}
diff --git a/source/blender/bmesh/intern/bmesh_marking.h b/source/blender/bmesh/intern/bmesh_marking.h
new file mode 100644
index 0000000..12ebaed
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_marking.h
@@ -0,0 +1,94 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BMESH_MARKING_H__
+#define __BMESH_MARKING_H__
+
+/** \file blender/bmesh/intern/bmesh_marking.h
+ *  \ingroup bmesh
+ */
+
+typedef struct BMEditSelection
+{
+	struct BMEditSelection *next, *prev;
+	BMElem *ele;
+	char htype;
+} BMEditSelection;
+
+/* geometry hiding code */
+#define BM_elem_hide_set(bm, ele, hide) _bm_elem_hide_set(bm, &(ele)->head, hide)
+void _bm_elem_hide_set(BMesh *bm, BMHeader *ele, int hide);
+void BM_vert_hide_set(BMVert *v, int hide);
+void BM_edge_hide_set(BMEdge *e, int hide);
+void BM_face_hide_set(BMFace *f, int hide);
+
+/* Selection code */
+void BM_elem_select_set(BMesh *bm, BMElem *ele, int select);
+
+void BM_mesh_elem_hflag_enable_test(BMesh *bm, const char htype, const char hflag,
+                                    int respecthide, const char hflag_test);
+void BM_mesh_elem_hflag_disable_test(BMesh *bm, const char htype, const char hflag,
+                                     int respecthide, const char hflag_test);
+
+void BM_mesh_elem_hflag_enable_all(BMesh *bm, const char htype, const char hflag,
+                                   int respecthide);
+void BM_mesh_elem_hflag_disable_all(BMesh *bm, const char htype, const char hflag,
+                                    int respecthide);
+
+/* individual element select functions, BM_elem_select_set is a shortcut for these
+ * that automatically detects which one to use*/
+void BM_vert_select_set(BMesh *bm, BMVert *v, int select);
+void BM_edge_select_set(BMesh *bm, BMEdge *e, int select);
+void BM_face_select_set(BMesh *bm, BMFace *f, int select);
+
+void BM_mesh_select_mode_set(BMesh *bm, int selectmode);
+void BM_mesh_select_mode_flush(BMesh *bm);
+
+void BM_mesh_deselect_flush(BMesh *bm);
+void BM_mesh_select_flush(BMesh *bm);
+
+int BM_mesh_elem_hflag_count_enabled(BMesh *bm, const char htype, const char hflag, int respecthide);
+int BM_mesh_elem_hflag_count_disabled(BMesh *bm, const char htype, const char hflag, int respecthide);
+
+/* edit selection stuff */
+void    BM_active_face_set(BMesh *bm, BMFace *f);
+BMFace *BM_active_face_get(BMesh *bm, int sloppy);
+
+void    BM_editselection_center(BMEditSelection *ese, float r_center[3]);
+void    BM_editselection_normal(BMEditSelection *ese, float r_normal[3]);
+void    BM_editselection_plane(BMEditSelection *ese,  float r_plane[3]);
+
+#define BM_select_history_check(bm, ele)        _bm_select_history_check(bm,        &(ele)->head)
+#define BM_select_history_remove(bm, ele)       _bm_select_history_remove(bm,       &(ele)->head)
+#define BM_select_history_store_notest(bm, ele) _bm_select_history_store_notest(bm, &(ele)->head)
+#define BM_select_history_store(bm, ele)        _bm_select_history_store(bm,        &(ele)->head)
+
+int  _bm_select_history_check(BMesh *bm, const  BMHeader *ele);
+int  _bm_select_history_remove(BMesh *bm,       BMHeader *ele);
+void _bm_select_history_store_notest(BMesh *bm, BMHeader *ele);
+void _bm_select_history_store(BMesh *bm,        BMHeader *ele);
+
+void BM_select_history_validate(BMesh *bm);
+void BM_select_history_clear(BMesh *em);
+int  BM_select_history_active_get(BMesh *bm, struct BMEditSelection *ese);
+
+#endif /* __BMESH_MARKING_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c
new file mode 100644
index 0000000..bd6eb7a
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -0,0 +1,774 @@
+/*
+ * ***** 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): Geoffrey Bantle.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/intern/bmesh_mesh.c
+ *  \ingroup bmesh
+ *
+ * BM mesh level functions.
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_listBase.h"
+#include "DNA_object_types.h"
+
+#include "BLI_listbase.h"
+#include "BLI_math.h"
+#include "BLI_utildefines.h"
+
+#include "BKE_cdderivedmesh.h"
+#include "BKE_tessmesh.h"
+#include "BKE_multires.h"
+
+#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};
+
+static void bm_mempool_init(BMesh *bm, const BMAllocTemplate *allocsize)
+{
+	bm->vpool = BLI_mempool_create(sizeof(BMVert), allocsize->totvert, bm_mesh_chunksize_default.totvert, BLI_MEMPOOL_ALLOW_ITER);
+	bm->epool = BLI_mempool_create(sizeof(BMEdge), allocsize->totedge, bm_mesh_chunksize_default.totedge, BLI_MEMPOOL_ALLOW_ITER);
+	bm->lpool = BLI_mempool_create(sizeof(BMLoop), allocsize->totloop, bm_mesh_chunksize_default.totloop, 0);
+	bm->fpool = BLI_mempool_create(sizeof(BMFace), allocsize->totface, 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);
+#endif
+
+	/* allocate one flag pool that we don't get rid of. */
+	bm->toolflagpool = BLI_mempool_create(sizeof(BMFlagLayer), 512, 512, 0);
+}
+
+/**
+ * \brief BMesh Make Mesh
+ *
+ * Allocates a new BMesh structure.
+ *
+ * \return The New bmesh
+ *
+ * \note ob is needed by multires
+ */
+BMesh *BM_mesh_create(BMAllocTemplate *allocsize)
+{
+	/* allocate the structure */
+	BMesh *bm = MEM_callocN(sizeof(BMesh), __func__);
+	
+	/* allocate the memory pools for the mesh elements */
+	bm_mempool_init(bm, allocsize);
+
+	/* allocate one flag pool that we don't get rid of. */
+	bm->stackdepth = 1;
+	bm->totflags = 1;
+
+	return bm;
+}
+
+/**
+ * \brief BMesh Free Mesh Data
+ *
+ *	Frees a BMesh structure.
+ *
+ * \note frees mesh, but not actual BMesh struct
+ */
+void BM_mesh_data_free(BMesh *bm)
+{
+	BMVert *v;
+	BMEdge *e;
+	BMLoop *l;
+	BMFace *f;
+	
+
+	BMIter iter;
+	BMIter itersub;
+	
+	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+		CustomData_bmesh_free_block(&(bm->vdata), &(v->head.data));
+	}
+	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+		CustomData_bmesh_free_block(&(bm->edata), &(e->head.data));
+	}
+	BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+		CustomData_bmesh_free_block(&(bm->pdata), &(f->head.data));
+		BM_ITER_ELEM (l, &itersub, f, BM_LOOPS_OF_FACE) {
+			CustomData_bmesh_free_block(&(bm->ldata), &(l->head.data));
+		}
+	}
+
+	/* Free custom data pools, This should probably go in CustomData_free? */
+	if (bm->vdata.totlayer) BLI_mempool_destroy(bm->vdata.pool);
+	if (bm->edata.totlayer) BLI_mempool_destroy(bm->edata.pool);
+	if (bm->ldata.totlayer) BLI_mempool_destroy(bm->ldata.pool);
+	if (bm->pdata.totlayer) BLI_mempool_destroy(bm->pdata.pool);
+
+	/* free custom data */
+	CustomData_free(&bm->vdata, 0);
+	CustomData_free(&bm->edata, 0);
+	CustomData_free(&bm->ldata, 0);
+	CustomData_free(&bm->pdata, 0);
+
+	/* destroy element pools */
+	BLI_mempool_destroy(bm->vpool);
+	BLI_mempool_destroy(bm->epool);
+	BLI_mempool_destroy(bm->lpool);
+	BLI_mempool_destroy(bm->fpool);
+
+	/* destroy flag pool */
+	BLI_mempool_destroy(bm->toolflagpool);
+
+#ifdef USE_BMESH_HOLES
+	BLI_mempool_destroy(bm->looplistpool);
+#endif
+
+	BLI_freelistN(&bm->selected);
+
+	BMO_error_clear(bm);
+}
+
+/**
+ * \brief BMesh Clear Mesh
+ *
+ * Clear all data in bm
+ */
+void BM_mesh_clear(BMesh *bm)
+{
+	/* free old mesh */
+	BM_mesh_data_free(bm);
+	memset(bm, 0, sizeof(BMesh));
+
+	/* allocate the memory pools for the mesh elements */
+	bm_mempool_init(bm, &bm_mesh_allocsize_default);
+
+	bm->stackdepth = 1;
+	bm->totflags = 1;
+}
+
+/**
+ * \brief BMesh Free Mesh
+ *
+ *	Frees a BMesh data and its structure.
+ */
+void BM_mesh_free(BMesh *bm)
+{
+	BM_mesh_data_free(bm);
+
+	if (bm->py_handle) {
+		/* keep this out of 'BM_mesh_data_free' because we wan't python
+		 * to be able to clear the mesh and maintain access. */
+		extern void bpy_bm_generic_invalidate(void *self);
+
+		bpy_bm_generic_invalidate(bm->py_handle);
+		bm->py_handle = NULL;
+	}
+
+	MEM_freeN(bm);
+}
+
+/**
+ * \brief BMesh Compute Normals
+ *
+ * Updates the normals of a mesh.
+ */
+void BM_mesh_normals_update(BMesh *bm, const short skip_hidden)
+{
+	BMVert *v;
+	BMFace *f;
+	BMLoop *l;
+	BMEdge *e;
+	BMIter verts;
+	BMIter faces;
+	BMIter loops;
+	BMIter edges;
+	int index;
+	float (*edgevec)[3];
+	
+	/* calculate all face normals */
+	BM_ITER_MESH (f, &faces, bm, BM_FACES_OF_MESH) {
+		if (skip_hidden && BM_elem_flag_test(f, BM_ELEM_HIDDEN))
+			continue;
+#if 0   /* UNUSED */
+		if (f->head.flag & BM_NONORMCALC)
+			continue;
+#endif
+
+		BM_face_normal_update(f);
+	}
+	
+	/* Zero out vertex normals */
+	BM_ITER_MESH (v, &verts, bm, BM_VERTS_OF_MESH) {
+		if (skip_hidden && BM_elem_flag_test(v, BM_ELEM_HIDDEN))
+			continue;
+
+		zero_v3(v->no);
+	}
+
+	/* compute normalized direction vectors for each edge. directions will be
+	 * used below for calculating the weights of the face normals on the vertex
+	 * normals */
+	index = 0;
+	edgevec = MEM_callocN(sizeof(float) * 3 * bm->totedge, "BM normal computation array");
+	BM_ITER_MESH (e, &edges, bm, BM_EDGES_OF_MESH) {
+		BM_elem_index_set(e, index); /* set_inline */
+
+		if (e->l) {
+			sub_v3_v3v3(edgevec[index], e->v2->co, e->v1->co);
+			normalize_v3(edgevec[index]);
+		}
+		else {
+			/* the edge vector will not be needed when the edge has no radial */
+		}
+
+		index++;
+	}
+	bm->elem_index_dirty &= ~BM_EDGE;
+
+	/* add weighted face normals to vertices */
+	BM_ITER_MESH (f, &faces, bm, BM_FACES_OF_MESH) {
+
+		if (skip_hidden && BM_elem_flag_test(f, BM_ELEM_HIDDEN))
+			continue;
+
+		BM_ITER_ELEM (l, &loops, f, BM_LOOPS_OF_FACE) {
+			float *e1diff, *e2diff;
+			float dotprod;
+			float fac;
+
+			/* calculate the dot product of the two edges that
+			 * meet at the loop's vertex */
+			e1diff = edgevec[BM_elem_index_get(l->prev->e)];
+			e2diff = edgevec[BM_elem_index_get(l->e)];
+			dotprod = dot_v3v3(e1diff, e2diff);
+
+			/* edge vectors are calculated from e->v1 to e->v2, so
+			 * adjust the dot product if one but not both loops
+			 * actually runs from from e->v2 to e->v1 */
+			if ((l->prev->e->v1 == l->prev->v) ^ (l->e->v1 == l->v)) {
+				dotprod = -dotprod;
+			}
+
+			fac = saacos(-dotprod);
+
+			/* accumulate weighted face normal into the vertex's normal */
+			madd_v3_v3fl(l->v->no, f->no, fac);
+		}
+	}
+	
+	/* normalize the accumulated vertex normals */
+	BM_ITER_MESH (v, &verts, bm, BM_VERTS_OF_MESH) {
+		if (skip_hidden && BM_elem_flag_test(v, BM_ELEM_HIDDEN))
+			continue;
+
+		if (normalize_v3(v->no) == 0.0f) {
+			normalize_v3_v3(v->no, v->co);
+		}
+	}
+	
+	MEM_freeN(edgevec);
+}
+
+/*
+ * This function ensures correct normals for the mesh, but
+ * sets the flag BM_ELEM_TAG in flipped faces, to allow restoration
+ * of original normals.
+ *
+ * if undo is 0: calculate right normals
+ * if undo is 1: restore original normals
+ */
+
+//keep in sycn with utils.c!
+#define FACE_FLIP   8
+static void bm_rationalize_normals(BMesh *bm, int undo)
+{
+	BMOperator bmop;
+	BMFace *f;
+	BMIter iter;
+	
+	if (undo) {
+		BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+			if (BM_elem_flag_test(f, BM_ELEM_TAG)) {
+				BM_face_normal_flip(bm, f);
+			}
+			BM_elem_flag_disable(f, BM_ELEM_TAG);
+		}
+		
+		return;
+	}
+	
+	BMO_op_initf(bm, &bmop, "righthandfaces faces=%af do_flip=%b", FALSE);
+	
+	BMO_push(bm, &bmop);
+	bmo_righthandfaces_exec(bm, &bmop);
+	
+	BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+		BM_elem_flag_set(f, BM_ELEM_TAG, BMO_elem_flag_test(bm, f, FACE_FLIP));
+	}
+
+	BMO_pop(bm);
+	BMO_op_finish(bm, &bmop);
+}
+
+static void UNUSED_FUNCTION(bm_mdisps_space_set)(Object *ob, BMesh *bm, int from, int to)
+{
+	/* 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);
+		MDisps *mdisps;
+		BMFace *f;
+		BMIter iter;
+		// int i = 0; // UNUSED
+		
+		multires_set_space(dm, ob, from, to);
+		
+		mdisps = CustomData_get_layer(&dm->loopData, CD_MDISPS);
+		
+		BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+			BMLoop *l;
+			BMIter liter;
+			BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+				MDisps *lmd = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MDISPS);
+				
+				if (!lmd->disps) {
+					printf("%s: warning - 'lmd->disps' == NULL\n", __func__);
+				}
+				
+				if (lmd->disps && lmd->totdisp == mdisps->totdisp) {
+					memcpy(lmd->disps, mdisps->disps, sizeof(float) * 3 * lmd->totdisp);
+				}
+				else if (mdisps->disps) {
+					if (lmd->disps)
+						MEM_freeN(lmd->disps);
+					
+					lmd->disps = MEM_dupallocN(mdisps->disps);
+					lmd->totdisp = mdisps->totdisp;
+					lmd->level = mdisps->level;
+				}
+				
+				mdisps++;
+				// i += 1;
+			}
+		}
+		
+		dm->needsFree = 1;
+		dm->release(dm);
+		
+		/* setting this to NULL prevents BMEdit_Free from freeing it */
+		em->bm = NULL;
+		BMEdit_Free(em);
+		MEM_freeN(em);
+	}
+}
+
+/**
+ * \brief BMesh Begin Edit
+ *
+ * Functions for setting up a mesh for editing and cleaning up after
+ * the editing operations are done. These are called by the tools/operator
+ * API for each time a tool is executed.
+ */
+void bmesh_edit_begin(BMesh *bm, int flag)
+{
+	bm->opflag = flag;
+	
+	/* Most operators seem to be using BMO_OP_FLAG_UNTAN_MULTIRES to change the MDisps to
+	 * absolute space during mesh edits. With this enabled, changes to the topology
+	 * (loop cuts, edge subdivides, etc) are not reflected in the higher levels of
+	 * the mesh at all, which doesn't seem right. Turning off completely for now,
+	 * until this is shown to be better for certain types of mesh edits. */
+#if BMOP_UNTAN_MULTIRES_ENABLED
+	/* switch multires data out of tangent space */
+	if ((flag & BMO_OP_FLAG_UNTAN_MULTIRES) && CustomData_has_layer(&bm->ldata, CD_MDISPS)) {
+		bmesh_mdisps_space_set(bm, MULTIRES_SPACE_TANGENT, MULTIRES_SPACE_ABSOLUTE);
+
+		/* ensure correct normals, if possible */
+		bmesh_rationalize_normals(bm, 0);
+		BM_mesh_normals_update(bm);
+	}
+	else if (flag & BMO_OP_FLAG_RATIONALIZE_NORMALS) {
+		bmesh_rationalize_normals(bm, 0);
+	}
+#else
+	if (flag & BMO_OP_FLAG_RATIONALIZE_NORMALS) {
+		bm_rationalize_normals(bm, 0);
+	}
+#endif
+}
+
+/**
+ * \brief BMesh End Edit
+ */
+void bmesh_edit_end(BMesh *bm, int flag)
+{
+	/* BMO_OP_FLAG_UNTAN_MULTIRES disabled for now, see comment above in bmesh_edit_begin. */
+#if BMOP_UNTAN_MULTIRES_ENABLED
+	/* switch multires data into tangent space */
+	if ((flag & BMO_OP_FLAG_UNTAN_MULTIRES) && CustomData_has_layer(&bm->ldata, CD_MDISPS)) {
+		/* set normals to their previous winding */
+		bmesh_rationalize_normals(bm, 1);
+		bmesh_mdisps_space_set(bm, MULTIRES_SPACE_ABSOLUTE, MULTIRES_SPACE_TANGENT);
+	}
+	else if (flag & BMO_OP_FLAG_RATIONALIZE_NORMALS) {
+		bmesh_rationalize_normals(bm, 1);
+	}
+#else
+	if (flag & BMO_OP_FLAG_RATIONALIZE_NORMALS) {
+		bm_rationalize_normals(bm, 1);
+	}
+#endif
+
+	bm->opflag = 0;
+
+	/* compute normals, clear temp flags and flush selections */
+	BM_mesh_normals_update(bm, TRUE);
+	BM_mesh_select_mode_flush(bm);
+}
+
+void BM_mesh_elem_index_ensure(BMesh *bm, const char hflag)
+{
+	BMIter iter;
+	BMElem *ele;
+
+#ifdef DEBUG
+	BM_ELEM_INDEX_VALIDATE(bm, "Should Never Fail!", __func__);
+#endif
+
+	if (hflag & BM_VERT) {
+		if (bm->elem_index_dirty & BM_VERT) {
+			int index = 0;
+			BM_ITER_MESH (ele, &iter, bm, BM_VERTS_OF_MESH) {
+				BM_elem_index_set(ele, index); /* set_ok */
+				index++;
+			}
+			bm->elem_index_dirty &= ~BM_VERT;
+			BLI_assert(index == bm->totvert);
+		}
+		else {
+			// printf("%s: skipping vert index calc!\n", __func__);
+		}
+	}
+
+	if (hflag & BM_EDGE) {
+		if (bm->elem_index_dirty & BM_EDGE) {
+			int index = 0;
+			BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) {
+				BM_elem_index_set(ele, index); /* set_ok */
+				index++;
+			}
+			bm->elem_index_dirty &= ~BM_EDGE;
+			BLI_assert(index == bm->totedge);
+		}
+		else {
+			// printf("%s: skipping edge index calc!\n", __func__);
+		}
+	}
+
+	if (hflag & BM_FACE) {
+		if (bm->elem_index_dirty & BM_FACE) {
+			int index = 0;
+			BM_ITER_MESH (ele, &iter, bm, BM_FACES_OF_MESH) {
+				BM_elem_index_set(ele, index); /* set_ok */
+				index++;
+			}
+			bm->elem_index_dirty &= ~BM_FACE;
+			BLI_assert(index == bm->totface);
+		}
+		else {
+			// printf("%s: skipping face index calc!\n", __func__);
+		}
+	}
+}
+
+
+/**
+ * Array checking/setting macros
+ *
+ * Currently vert/edge/loop/face index data is being abused, in a few areas of the code.
+ *
+ * To avoid correcting them afterwards, set 'bm->elem_index_dirty' however its possible
+ * this flag is set incorrectly which could crash blender.
+ *
+ * These functions ensure its correct and are called more often in debug mode.
+ */
+
+void BM_mesh_elem_index_validate(BMesh *bm, const char *location, const char *func,
+                                 const char *msg_a, const char *msg_b)
+{
+	const char iter_types[3] = {BM_VERTS_OF_MESH,
+	                            BM_EDGES_OF_MESH,
+	                            BM_FACES_OF_MESH};
+
+	const char flag_types[3] = {BM_VERT, BM_EDGE, BM_FACE};
+	const char *type_names[3] = {"vert", "edge", "face"};
+
+	BMIter iter;
+	BMElem *ele;
+	int i;
+	int is_any_error = 0;
+
+	for (i = 0; i < 3; i++) {
+		const int is_dirty = (flag_types[i] & bm->elem_index_dirty);
+		int index = 0;
+		int is_error = FALSE;
+		int err_val = 0;
+		int err_idx = 0;
+
+		BM_ITER_MESH (ele, &iter, bm, iter_types[i]) {
+			if (!is_dirty) {
+				if (BM_elem_index_get(ele) != index) {
+					err_val = BM_elem_index_get(ele);
+					err_idx = index;
+					is_error = TRUE;
+				}
+			}
+
+			BM_elem_index_set(ele, index); /* set_ok */
+			index++;
+		}
+
+		if ((is_error == TRUE) && (is_dirty == FALSE)) {
+			is_any_error = TRUE;
+			fprintf(stderr,
+			        "Invalid Index: at %s, %s, %s[%d] invalid index %d, '%s', '%s'\n",
+			        location, func, type_names[i], err_idx, err_val, msg_a, msg_b);
+		}
+		else if ((is_error == FALSE) && (is_dirty == TRUE)) {
+
+#if 0       /* mostly annoying */
+
+			/* dirty may have been incorrectly set */
+			fprintf(stderr,
+			        "Invalid Dirty: at %s, %s (%s), dirty flag was set but all index values are correct, '%s', '%s'\n",
+			        location, func, type_names[i], msg_a, msg_b);
+#endif
+		}
+	}
+
+#if 0 /* mostly annoying, even in debug mode */
+#ifdef DEBUG
+	if (is_any_error == 0) {
+		fprintf(stderr,
+		        "Valid Index Success: at %s, %s, '%s', '%s'\n",
+		        location, func, msg_a, msg_b);
+	}
+#endif
+#endif
+	(void) is_any_error; /* shut up the compiler */
+
+}
+
+/**
+ * Return the amount of element of type 'type' in a given bmesh.
+ */
+int BM_mesh_elem_count(BMesh *bm, const char htype)
+{
+	if (htype == BM_VERT) return bm->totvert;
+	else if (htype == BM_EDGE) return bm->totedge;
+	else if (htype == BM_FACE) return bm->totface;
+
+	return 0;
+}
+
+/**
+ * Remaps the vertices, edges and/or faces of the bmesh as indicated by vert/edge/face_idx arrays
+ * (xxx_idx[org_index] = new_index).
+ *
+ * A NULL array means no changes.
+ *
+ * Note: - Does not mess with indices, just sets elem_index_dirty flag.
+ *       - For verts/edges/faces only (as loops must remain "ordered" and "aligned"
+ *         on a per-face basis...).
+ *
+ * WARNING: Be careful if you keep pointers to affected BM elements, or arrays, when using this func!
+ */
+void BM_mesh_remap(BMesh *bm, int *vert_idx, int *edge_idx, int *face_idx)
+{
+	/* Mapping old to new pointers. */
+	GHash *vptr_map = NULL, *eptr_map = NULL, *fptr_map = NULL;
+	BMIter iter, iterl;
+	BMVert *ve;
+	BMEdge *ed;
+	BMFace *fa;
+	BMLoop *lo;
+
+	if (!(vert_idx || edge_idx || face_idx))
+		return;
+
+	/* Remap vertices */
+	if (vert_idx) {
+		BMVert **verts_pool, *verts_copy, **vep;
+		int i, totvert = bm->totvert;
+		int *new_idx = NULL;
+
+		/* Init the old-to-new vert pointers mapping */
+		vptr_map = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "BM_mesh_remap vert pointers mapping");
+
+		/* Make a copy of all vertices. */
+		verts_pool = MEM_callocN(sizeof(BMVert *) * totvert, "BM_mesh_remap verts pool");
+		BM_iter_as_array(bm, BM_VERTS_OF_MESH, NULL, (void **)verts_pool, totvert);
+		verts_copy = MEM_mallocN(sizeof(BMVert) * totvert, "BM_mesh_remap verts copy");
+		for (i = totvert, ve = verts_copy + totvert - 1, vep = verts_pool + totvert - 1; i--; ve--, vep--) {
+			*ve = **vep;
+/*			printf("*vep: %p, verts_pool[%d]: %p\n", *vep, i, verts_pool[i]);*/
+		}
+
+		/* Copy back verts to their new place, and update old2new pointers mapping. */
+		new_idx = vert_idx + totvert - 1;
+		ve = verts_copy + totvert - 1;
+		vep = verts_pool + totvert - 1; /* old, org pointer */
+		for (i = totvert; i--; new_idx--, ve--, vep--) {
+			BMVert *new_vep = verts_pool[*new_idx];
+			*new_vep = *ve;
+/*			printf("mapping vert from %d to %d (%p/%p to %p)\n", i, *new_idx, *vep, verts_pool[i], new_vep);*/
+			BLI_ghash_insert(vptr_map, (void *)*vep, (void *)new_vep);
+		}
+		bm->elem_index_dirty |= BM_VERT;
+
+		MEM_freeN(verts_pool);
+		MEM_freeN(verts_copy);
+	}
+
+	/* XXX Code not tested yet (though I don't why it would fail)! */
+	if (edge_idx) {
+		BMEdge **edges_pool, *edges_copy, **edp;
+		int i, totedge = bm->totedge;
+		int *new_idx = NULL;
+
+		/* Init the old-to-new vert pointers mapping */
+		eptr_map = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "BM_mesh_remap edge pointers mapping");
+
+		/* Make a copy of all vertices. */
+		edges_pool = MEM_callocN(sizeof(BMEdge *) * totedge, "BM_mesh_remap edges pool");
+		BM_iter_as_array(bm, BM_EDGES_OF_MESH, NULL, (void **)edges_pool, totedge);
+		edges_copy = MEM_mallocN(sizeof(BMEdge) * totedge, "BM_mesh_remap edges copy");
+		for (i = totedge, ed = edges_copy + totedge - 1, edp = edges_pool + totedge - 1; i--; ed--, edp--) {
+			*ed = **edp;
+		}
+
+		/* Copy back verts to their new place, and update old2new pointers mapping. */
+		new_idx = edge_idx + totedge - 1;
+		ed = edges_copy + totedge - 1;
+		edp = edges_pool + totedge - 1; /* old, org pointer */
+		for (i = totedge; i--; new_idx--, ed--, edp--) {
+			BMEdge *new_edp = edges_pool[*new_idx];
+			*new_edp = *ed;
+			BLI_ghash_insert(eptr_map, (void *)*edp, (void *)new_edp);
+		}
+
+		bm->elem_index_dirty |= BM_EDGE;
+
+		MEM_freeN(edges_pool);
+		MEM_freeN(edges_copy);
+	}
+
+	/* XXX Code not tested yet (though I don't why it would fail)! */
+	if (face_idx) {
+		BMFace **faces_pool, *faces_copy, **fap;
+		int i, totface = bm->totface;
+		int *new_idx = NULL;
+
+		/* Init the old-to-new vert pointers mapping */
+		fptr_map = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "BM_mesh_remap face pointers mapping");
+
+		/* Make a copy of all vertices. */
+		faces_pool = MEM_callocN(sizeof(BMFace *) * totface, "BM_mesh_remap faces pool");
+		BM_iter_as_array(bm, BM_FACES_OF_MESH, NULL, (void **)faces_pool, totface);
+		faces_copy = MEM_mallocN(sizeof(BMFace) * totface, "BM_mesh_remap faces copy");
+		for (i = totface, fa = faces_copy + totface - 1, fap = faces_pool + totface - 1; i--; fa--, fap--) {
+			*fa = **fap;
+		}
+
+		/* Copy back verts to their new place, and update old2new pointers mapping. */
+		new_idx = face_idx + totface - 1;
+		fa = faces_copy + totface - 1;
+		fap = faces_pool + totface - 1; /* old, org pointer */
+		for (i = totface; i--; new_idx--, fa--, fap--) {
+			BMFace *new_fap = faces_pool[*new_idx];
+			*new_fap = *fa;
+			BLI_ghash_insert(fptr_map, (void *)*fap, (void *)new_fap);
+		}
+
+		bm->elem_index_dirty |= BM_FACE;
+
+		MEM_freeN(faces_pool);
+		MEM_freeN(faces_copy);
+	}
+
+	/* And now, fix all vertices/edges/faces/loops pointers! */
+	/* Verts' pointers, only edge pointers... */
+	if (eptr_map) {
+		BM_ITER_MESH (ve, &iter, bm, BM_VERTS_OF_MESH) {
+/*			printf("Vert e: %p -> %p\n", ve->e, BLI_ghash_lookup(eptr_map, (const void*)ve->e));*/
+			ve->e = BLI_ghash_lookup(eptr_map, (const void *)ve->e);
+		}
+	}
+
+	/* Edges' pointers, only vert pointers (as we don't mess with loops!)... */
+	if (vptr_map) {
+		BM_ITER_MESH (ed, &iter, bm, BM_EDGES_OF_MESH) {
+/*			printf("Edge v1: %p -> %p\n", ed->v1, BLI_ghash_lookup(vptr_map, (const void*)ed->v1));*/
+/*			printf("Edge v2: %p -> %p\n", ed->v2, BLI_ghash_lookup(vptr_map, (const void*)ed->v2));*/
+			ed->v1 = BLI_ghash_lookup(vptr_map, (const void *)ed->v1);
+			ed->v2 = BLI_ghash_lookup(vptr_map, (const void *)ed->v2);
+		}
+	}
+
+	/* Faces' pointers (loops, in fact), always needed... */
+	BM_ITER_MESH (fa, &iter, bm, BM_FACES_OF_MESH) {
+		BM_ITER_ELEM (lo, &iterl, fa, BM_LOOPS_OF_FACE) {
+			if (vptr_map) {
+/*				printf("Loop v: %p -> %p\n", lo->v, BLI_ghash_lookup(vptr_map, (const void*)lo->v));*/
+				lo->v = BLI_ghash_lookup(vptr_map, (const void *)lo->v);
+			}
+			if (eptr_map) {
+/*				printf("Loop e: %p -> %p\n", lo->e, BLI_ghash_lookup(eptr_map, (const void*)lo->e));*/
+				lo->e = BLI_ghash_lookup(eptr_map, (const void *)lo->e);
+			}
+			if (fptr_map) {
+/*				printf("Loop f: %p -> %p\n", lo->f, BLI_ghash_lookup(fptr_map, (const void*)lo->f));*/
+				lo->f = BLI_ghash_lookup(fptr_map, (const void *)lo->f);
+			}
+		}
+	}
+
+	if (vptr_map)
+		BLI_ghash_free(vptr_map, NULL, NULL);
+	if (eptr_map)
+		BLI_ghash_free(eptr_map, NULL, NULL);
+	if (fptr_map)
+		BLI_ghash_free(fptr_map, NULL, NULL);
+}
+
+BMVert *BM_vert_at_index(BMesh *bm, const int index)
+{
+	return BLI_mempool_findelem(bm->vpool, index);
+}
+
+BMEdge *BM_edge_at_index(BMesh *bm, const int index)
+{
+	return BLI_mempool_findelem(bm->epool, index);
+}
+
+BMFace *BM_face_at_index(BMesh *bm, const int index)
+{
+	return BLI_mempool_findelem(bm->fpool, index);
+}
diff --git a/source/blender/bmesh/intern/bmesh_mesh.h b/source/blender/bmesh/intern/bmesh_mesh.h
new file mode 100644
index 0000000..0441f38
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_mesh.h
@@ -0,0 +1,61 @@
+/*
+ * ***** 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): Geoffrey Bantle, Levi Schooley.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BMESH_MESH_H__
+#define __BMESH_MESH_H__
+
+/** \file blender/bmesh/intern/bmesh_mesh.h
+ *  \ingroup bmesh
+ */
+
+struct BMAllocTemplate;
+
+BMesh *BM_mesh_create(struct BMAllocTemplate *allocsize);
+
+void   BM_mesh_free(BMesh *bm);
+void   BM_mesh_data_free(BMesh *bm);
+void   BM_mesh_clear(BMesh *bm);
+
+void BM_mesh_normals_update(BMesh *bm, const short skip_hidden);
+
+void bmesh_edit_begin(BMesh *bm, int flag);
+void bmesh_edit_end(BMesh *bm, int flag);
+
+void BM_mesh_elem_index_ensure(BMesh *bm, const char hflag);
+void BM_mesh_elem_index_validate(BMesh *bm, const char *location, const char *func,
+                                 const char *msg_a, const char *msg_b);
+int  BM_mesh_elem_count(BMesh *bm, const char htype);
+
+void BM_mesh_remap(BMesh *bm, int *vert_idx, int *edge_idx, int *face_idx);
+
+BMVert *BM_vert_at_index(BMesh *bm, const int index);
+BMEdge *BM_edge_at_index(BMesh *bm, const int index);
+BMFace *BM_face_at_index(BMesh *bm, const int index);
+
+typedef struct BMAllocTemplate {
+	int totvert, totedge, totloop, totface;
+} BMAllocTemplate;
+
+extern BMAllocTemplate bm_mesh_allocsize_default;
+extern BMAllocTemplate bm_mesh_chunksize_default;
+
+#endif /* __BMESH_MESH_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c
new file mode 100644
index 0000000..f72efe8
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c
@@ -0,0 +1,866 @@
+/*
+ * ***** 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): Geoffrey Bantle.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/intern/bmesh_mesh_conv.c
+ *  \ingroup bmesh
+ *
+ * BM mesh conversion functions.
+ *
+ * \section bm_mesh_conv_shapekey Converting Shape Keys
+ *
+ * When converting to/from a Mesh/BMesh you can optionally pass a shape key to edit.
+ * This has the effect of editing the shape key-block rather then the original mesh vertex coords
+ * (although additional geometry is still allowed and uses fallback locations on converting).
+ *
+ * While this works for any mesh/bmesh this is made use of by entering and exiting edit-mode.
+ *
+ * There are comments in code but this should help explain the general
+ * intention as to how this works converting from/to bmesh.
+ *
+ *
+ * \subsection user_pov User Perspective
+ *
+ * - Editmode operations when a shape key-block is active edits only that key-block.
+ * - The first Basis key-block always matches the Mesh verts.
+ * - Changing vertex locations of _any_ Basis will apply offsets to those shape keys using this as their Basis.
+ *
+ *
+ * \subsection enter_editmode Entering EditMode - #BM_mesh_bm_from_me
+ *
+ * - the active key-block is used for BMesh vertex locations on entering edit-mode.
+ * So obviously the meshes vertex locations remain unchanged and the shape key its self is not being edited directly.
+ * Simply the #BMVert.co is a initialized from active shape key (when its set).
+ * - all key-blocks are added as CustomData layers (read code for details).
+ *
+ *
+ * \subsection exit_editmode Exiting EditMode - #BM_mesh_bm_to_me
+ *
+ * This is where the most confusing code is! Won't attempt to document the details here, for that read the code.
+ * But basics are as follows.
+ *
+ * - Vertex locations (possibly modified from initial active key-block) are copied directly into #MVert.co
+ * (special confusing note that these may be restored later, when editing the 'Basis', read on).
+ * - if the 'Key' is relative, and the active key-block is the basis for ANY other key-blocks - get an array of offsets
+ * between the new vertex locations and the original shape key (before entering edit-mode),
+ * these offsets get applied later on to inactive key-blocks using the active one (which we are editing) as their Basis.
+ *
+ * Copying the locations back to the shape keys is quite confusing...
+ * One main area of confusion is that when editing a 'Basis' key-block 'me->key->refkey'
+ * The coords are written into the mesh, from the users perspective the Basis coords are written into the mesh
+ * when exiting edit-mode.
+ *
+ * When _not_ editing the 'Basis', the original vertex locations (stored in the mesh and unchanged during edit-mode),
+ * are copied back into the mesh.
+ *
+ * This has the effect from the users POV of leaving the mesh un-touched, and only editing the active shape key-block.
+ *
+ */
+
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_object_types.h"
+#include "DNA_modifier_types.h"
+#include "DNA_key_types.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_listbase.h"
+#include "BLI_array.h"
+#include "BLI_math_vector.h"
+
+#include "BKE_mesh.h"
+#include "BKE_customdata.h"
+#include "BKE_multires.h"
+
+#include "BKE_global.h" /* ugh - for looping over all objects */
+#include "BKE_main.h"
+#include "BKE_key.h"
+
+#include "bmesh.h"
+#include "intern/bmesh_private.h" /* for element checking */
+
+/* Mesh -> BMesh */
+void BM_mesh_bm_from_me(BMesh *bm, Mesh *me, int set_key, int act_key_nr)
+{
+	MVert *mvert;
+	BLI_array_declare(verts);
+	MEdge *medge;
+	MLoop *ml;
+	MPoly *mpoly;
+	KeyBlock *actkey, *block;
+	BMVert *v, **vt = NULL, **verts = NULL;
+	BMEdge *e, **fedges = NULL, **et = NULL;
+	BMFace *f;
+	BMLoop *l;
+	BLI_array_declare(fedges);
+	float (*keyco)[3] = NULL;
+	int *keyi;
+	int totuv, i, j;
+
+	/* free custom data */
+	/* this isnt needed in most cases but do just incase */
+	CustomData_free(&bm->vdata, bm->totvert);
+	CustomData_free(&bm->edata, bm->totedge);
+	CustomData_free(&bm->ldata, bm->totloop);
+	CustomData_free(&bm->pdata, bm->totface);
+
+	if (!me || !me->totvert) {
+		if (me) { /*no verts? still copy customdata layout*/
+			CustomData_copy(&me->vdata, &bm->vdata, CD_MASK_BMESH, CD_ASSIGN, 0);
+			CustomData_copy(&me->edata, &bm->edata, CD_MASK_BMESH, CD_ASSIGN, 0);
+			CustomData_copy(&me->ldata, &bm->ldata, CD_MASK_BMESH, CD_ASSIGN, 0);
+			CustomData_copy(&me->pdata, &bm->pdata, CD_MASK_BMESH, CD_ASSIGN, 0);
+
+			CustomData_bmesh_init_pool(&bm->vdata, me->totvert, BM_VERT);
+			CustomData_bmesh_init_pool(&bm->edata, me->totedge, BM_EDGE);
+			CustomData_bmesh_init_pool(&bm->ldata, me->totloop, BM_LOOP);
+			CustomData_bmesh_init_pool(&bm->pdata, me->totpoly, BM_FACE);
+		}
+		return; /* sanity check */
+	}
+
+	vt = MEM_mallocN(sizeof(void **) * me->totvert, "mesh to bmesh vtable");
+
+	CustomData_copy(&me->vdata, &bm->vdata, CD_MASK_BMESH, CD_CALLOC, 0);
+	CustomData_copy(&me->edata, &bm->edata, CD_MASK_BMESH, CD_CALLOC, 0);
+	CustomData_copy(&me->ldata, &bm->ldata, CD_MASK_BMESH, CD_CALLOC, 0);
+	CustomData_copy(&me->pdata, &bm->pdata, CD_MASK_BMESH, CD_CALLOC, 0);
+
+	/* make sure uv layer names are consisten */
+	totuv = CustomData_number_of_layers(&bm->pdata, CD_MTEXPOLY);
+	for (i = 0; i < totuv; i++) {
+		int li = CustomData_get_layer_index_n(&bm->pdata, CD_MTEXPOLY, i);
+		CustomData_set_layer_name(&bm->ldata, CD_MLOOPUV, i, bm->pdata.layers[li].name);
+	}
+
+	if (!CustomData_has_layer(&bm->edata, CD_CREASE))
+		CustomData_add_layer(&bm->edata, CD_CREASE, CD_ASSIGN, NULL, 0);
+
+	if (!CustomData_has_layer(&bm->edata, CD_BWEIGHT))
+		CustomData_add_layer(&bm->edata, CD_BWEIGHT, CD_ASSIGN, NULL, 0);
+
+	if (!CustomData_has_layer(&bm->vdata, CD_BWEIGHT))
+		CustomData_add_layer(&bm->vdata, CD_BWEIGHT, CD_ASSIGN, NULL, 0);
+
+	if ((act_key_nr != 0) && (me->key != NULL)) {
+		actkey = BLI_findlink(&me->key->block, act_key_nr - 1);
+	}
+	else {
+		actkey = NULL;
+	}
+
+	if (me->key) {
+		CustomData_add_layer(&bm->vdata, CD_SHAPE_KEYINDEX, CD_ASSIGN, NULL, 0);
+
+		/* check if we need to generate unique ids for the shapekeys.
+		 * this also exists in the file reading code, but is here for
+		 * a sanity check */
+		if (!me->key->uidgen) {
+			fprintf(stderr,
+			        "%s had to generate shape key uid's in a situation we shouldn't need to! "
+			        "(bmesh internal error)\n",
+			        __func__);
+
+			me->key->uidgen = 1;
+			for (block = me->key->block.first; block; block = block->next) {
+				block->uid = me->key->uidgen++;
+			}
+		}
+
+		if (actkey && actkey->totelem == me->totvert) {
+			keyco = actkey->data;
+			bm->shapenr = act_key_nr;
+		}
+
+		for (i = 0, block = me->key->block.first; block; block = block->next, i++) {
+			CustomData_add_layer_named(&bm->vdata, CD_SHAPEKEY,
+			                           CD_ASSIGN, NULL, 0, block->name);
+
+			j = CustomData_get_layer_index_n(&bm->vdata, CD_SHAPEKEY, i);
+			bm->vdata.layers[j].uid = block->uid;
+		}
+	}
+
+	CustomData_bmesh_init_pool(&bm->vdata, me->totvert, BM_VERT);
+	CustomData_bmesh_init_pool(&bm->edata, me->totedge, BM_EDGE);
+	CustomData_bmesh_init_pool(&bm->ldata, me->totloop, BM_LOOP);
+	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);
+		BM_elem_index_set(v, i); /* set_ok */
+		vt[i] = v;
+
+		/* transfer flag */
+		v->head.hflag = BM_vert_flag_from_mflag(mvert->flag & ~SELECT);
+
+		/* this is necessary for selection counts to work properly */
+		if (mvert->flag & SELECT) {
+			BM_vert_select_set(bm, v, TRUE);
+		}
+
+		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 */
+		CustomData_to_bmesh_block(&me->vdata, &bm->vdata, i, &v->head.data);
+
+		/* set shapekey data */
+		if (me->key) {
+			/* set shape key original index */
+			keyi = CustomData_bmesh_get(&bm->vdata, v->head.data, CD_SHAPE_KEYINDEX);
+			if (keyi) {
+				*keyi = i;
+			}
+
+			for (block = me->key->block.first, j = 0; block; block = block->next, j++) {
+				float *co = CustomData_bmesh_get_n(&bm->vdata, v->head.data, CD_SHAPEKEY, j);
+
+				if (co) {
+					copy_v3_v3(co, ((float *)block->data) + 3 * i);
+				}
+			}
+		}
+	}
+
+	bm->elem_index_dirty &= ~BM_VERT; /* added in order, clear dirty flag */
+
+	if (!me->totedge) {
+		MEM_freeN(vt);
+		return;
+	}
+
+	et = MEM_mallocN(sizeof(void **) * me->totedge, "mesh to bmesh etable");
+
+	medge = me->medge;
+	for (i = 0; i < me->totedge; i++, medge++) {
+		e = BM_edge_create(bm, vt[medge->v1], vt[medge->v2], NULL, FALSE);
+		BM_elem_index_set(e, i); /* set_ok */
+		et[i] = e;
+
+		/* transfer flags */
+		e->head.hflag = BM_edge_flag_from_mflag(medge->flag & ~SELECT);
+
+		/* this is necessary for selection counts to work properly */
+		if (medge->flag & SELECT) {
+			BM_edge_select_set(bm, e, TRUE);
+		}
+
+		/* Copy Custom Data */
+		CustomData_to_bmesh_block(&me->edata, &bm->edata, i, &e->head.data);
+
+		BM_elem_float_data_set(&bm->edata, e, CD_CREASE, (float)medge->crease / 255.0f);
+		BM_elem_float_data_set(&bm->edata, e, CD_BWEIGHT, (float)medge->bweight / 255.0f);
+	}
+
+	bm->elem_index_dirty &= ~BM_EDGE; /* added in order, clear dirty flag */
+
+	mpoly = me->mpoly;
+	for (i = 0; i < me->totpoly; i++, mpoly++) {
+		BMIter iter;
+
+		BLI_array_empty(fedges);
+		BLI_array_empty(verts);
+
+		BLI_array_growitems(fedges, mpoly->totloop);
+		BLI_array_growitems(verts, mpoly->totloop);
+
+		for (j = 0; j < mpoly->totloop; j++) {
+			ml = &me->mloop[mpoly->loopstart + j];
+			v = vt[ml->v];
+			e = et[ml->e];
+
+			fedges[j] = e;
+			verts[j] = v;
+		}
+
+		/* not sure what this block is supposed to do,
+		 * but its unused. so commenting - campbell */
+#if 0
+		{
+			BMVert *v1, *v2;
+			v1 = vt[me->mloop[mpoly->loopstart].v];
+			v2 = vt[me->mloop[mpoly->loopstart + 1].v];
+
+			if (v1 == fedges[0]->v1) {
+				v2 = fedges[0]->v2;
+			}
+			else {
+				v1 = fedges[0]->v2;
+				v2 = fedges[0]->v1;
+			}
+		}
+#endif
+
+		f = BM_face_create(bm, verts, fedges, mpoly->totloop, FALSE);
+
+		if (!f) {
+			printf("%s: Warning! Bad face in mesh"
+			       " \"%s\" at index %d!, skipping\n",
+			       __func__, me->id.name + 2, i);
+			continue;
+		}
+
+		/* don't use 'i' since we may have skipped the face */
+		BM_elem_index_set(f, bm->totface - 1); /* set_ok */
+
+		/* transfer flag */
+		f->head.hflag = BM_face_flag_from_mflag(mpoly->flag & ~ME_FACE_SEL);
+
+		/* this is necessary for selection counts to work properly */
+		if (mpoly->flag & ME_FACE_SEL) {
+			BM_face_select_set(bm, f, TRUE);
+		}
+
+		f->mat_nr = mpoly->mat_nr;
+		if (i == me->act_face) bm->act_face = f;
+
+		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 */
+		}
+
+		/* Copy Custom Data */
+		CustomData_to_bmesh_block(&me->pdata, &bm->pdata, i, &f->head.data);
+	}
+
+	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,
+		                                  "Selection Conversion Vertex Pointer Array");
+		BMEdge **edge_array = MEM_callocN(sizeof(BMEdge *) * bm->totedge,
+		                                  "Selection Conversion Edge Pointer Array");
+		BMFace **face_array = MEM_callocN(sizeof(BMFace *) * bm->totface,
+		                                  "Selection Conversion Face Pointer Array");
+
+		BMIter  iter;
+		BMVert  *vert;
+		BMEdge  *edge;
+		BMFace  *face;
+		MSelect *msel;
+
+		BM_ITER_MESH_INDEX (vert, &iter, bm, BM_VERTS_OF_MESH, i) { vert_array[i] = vert; }
+		BM_ITER_MESH_INDEX (edge, &iter, bm, BM_EDGES_OF_MESH, i) { edge_array[i] = edge; }
+		BM_ITER_MESH_INDEX (face, &iter, bm, BM_FACES_OF_MESH, i) { face_array[i] = face; }
+
+		for (i = 0, msel = me->mselect; i < me->totselect; i++, msel++) {
+			switch (msel->type) {
+				case ME_VSEL:
+					BM_select_history_store(bm, (BMElem *)vert_array[msel->index]);
+					break;
+				case ME_ESEL:
+					BM_select_history_store(bm, (BMElem *)edge_array[msel->index]);
+					break;
+				case ME_FSEL:
+					BM_select_history_store(bm, (BMElem *)face_array[msel->index]);
+					break;
+			}
+		}
+
+		MEM_freeN(vert_array);
+		MEM_freeN(edge_array);
+		MEM_freeN(face_array);
+	}
+	else {
+		me->totselect = 0;
+		if (me->mselect) {
+			MEM_freeN(me->mselect);
+			me->mselect = NULL;
+		}
+	}
+
+	BLI_array_free(fedges);
+	BLI_array_free(verts);
+
+	MEM_freeN(vt);
+	MEM_freeN(et);
+}
+
+
+/* BMesh -> Mesh */
+static BMVert **bm_to_mesh_vertex_map(BMesh *bm, int ototvert)
+{
+	BMVert **vertMap = NULL;
+	BMVert *eve;
+	int index;
+	int i = 0;
+	BMIter iter;
+
+	/* caller needs to ensure this */
+	BLI_assert(ototvert > 0);
+
+	vertMap = MEM_callocN(sizeof(*vertMap) * ototvert, "vertMap");
+	if (CustomData_has_layer(&bm->vdata, CD_SHAPE_KEYINDEX)) {
+		int *keyi;
+		BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
+			keyi = CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_SHAPE_KEYINDEX);
+			if (keyi) {
+				if (((index = *keyi) != ORIGINDEX_NONE) && (index < ototvert)) {
+					vertMap[index] = eve;
+				}
+			}
+			else {
+				if (i < ototvert) {
+					vertMap[i] = eve;
+				}
+			}
+			i++;
+		}
+	}
+	else {
+		BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
+			if (i < ototvert) {
+				vertMap[i] = eve;
+			}
+			else {
+				break;
+			}
+			i++;
+		}
+	}
+
+	return vertMap;
+}
+
+/**
+ * returns customdata shapekey index from a keyblock or -1
+ * \note could split this out into a more generic function */
+static int bm_to_mesh_shape_layer_index_from_kb(BMesh *bm, KeyBlock *currkey)
+{
+	int i;
+	int j = 0;
+
+	for (i = 0; i < bm->vdata.totlayer; i++) {
+		if (bm->vdata.layers[i].type == CD_SHAPEKEY) {
+			if (currkey->uid == bm->vdata.layers[i].uid) {
+				return j;
+			}
+			j++;
+		}
+	}
+	return -1;
+}
+
+BLI_INLINE void bmesh_quick_edgedraw_flag(MEdge *med, BMEdge *e)
+{
+	/* this is a cheap way to set the edge draw, its not precise and will
+	 * pick the first 2 faces an edge uses.
+	 * The dot comparison is a little arbitrary, but set so that a 5 subd
+	 * IcoSphere won't vanish but subd 6 will (as with pre-bmesh blender) */
+
+
+	if ( /* (med->flag & ME_EDGEDRAW) && */ /* assume to be true */
+	     (e->l && (e->l != e->l->radial_next)) &&
+	     (dot_v3v3(e->l->f->no, e->l->radial_next->f->no) > 0.9995f))
+	{
+		med->flag &= ~ME_EDGEDRAW;
+	}
+}
+
+void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, int dotess)
+{
+	MLoop *mloop;
+	MPoly *mpoly;
+	MVert *mvert, *oldverts;
+	MEdge *med, *medge;
+	BMVert *v, *eve;
+	BMEdge *e;
+	BMLoop *l;
+	BMFace *f;
+	BMIter iter, liter;
+	int i, j, ototvert;
+
+	ototvert = me->totvert;
+
+	/* new vertex block */
+	if (bm->totvert == 0) mvert = NULL;
+	else mvert = MEM_callocN(bm->totvert * sizeof(MVert), "loadeditbMesh vert");
+
+	/* new edge block */
+	if (bm->totedge == 0) medge = NULL;
+	else medge = MEM_callocN(bm->totedge * sizeof(MEdge), "loadeditbMesh edge");
+
+	/* new ngon face block */
+	if (bm->totface == 0) mpoly = NULL;
+	else mpoly = MEM_callocN(bm->totface * sizeof(MPoly), "loadeditbMesh poly");
+
+	/* new loop block */
+	if (bm->totloop == 0) mloop = NULL;
+	else mloop = MEM_callocN(bm->totloop * sizeof(MLoop), "loadeditbMesh loop");
+
+	/* lets save the old verts just in case we are actually working on
+	 * a key ... we now do processing of the keys at the end */
+	oldverts = me->mvert;
+
+	/* don't free this yet */
+	CustomData_set_layer(&me->vdata, CD_MVERT, NULL);
+
+	/* free custom data */
+	CustomData_free(&me->vdata, me->totvert);
+	CustomData_free(&me->edata, me->totedge);
+	CustomData_free(&me->fdata, me->totface);
+	CustomData_free(&me->ldata, me->totloop);
+	CustomData_free(&me->pdata, me->totpoly);
+
+	/* add new custom data */
+	me->totvert = bm->totvert;
+	me->totedge = bm->totedge;
+	me->totloop = bm->totloop;
+	me->totpoly = bm->totface;
+	/* will be overwritten with a valid value if 'dotess' is set, otherwise we
+	 * end up with 'me->totface' and me->mface == NULL which can crash [#28625]
+	 */
+	me->totface = 0;
+
+	CustomData_copy(&bm->vdata, &me->vdata, CD_MASK_MESH, CD_CALLOC, me->totvert);
+	CustomData_copy(&bm->edata, &me->edata, CD_MASK_MESH, CD_CALLOC, me->totedge);
+	CustomData_copy(&bm->ldata, &me->ldata, CD_MASK_MESH, CD_CALLOC, me->totloop);
+	CustomData_copy(&bm->pdata, &me->pdata, CD_MASK_MESH, CD_CALLOC, me->totpoly);
+
+	CustomData_add_layer(&me->vdata, CD_MVERT, CD_ASSIGN, mvert, me->totvert);
+	CustomData_add_layer(&me->edata, CD_MEDGE, CD_ASSIGN, medge, me->totedge);
+	CustomData_add_layer(&me->ldata, CD_MLOOP, CD_ASSIGN, mloop, me->totloop);
+	CustomData_add_layer(&me->pdata, CD_MPOLY, CD_ASSIGN, mpoly, me->totpoly);
+
+	/* this is called again, 'dotess' arg is used there */
+	mesh_update_customdata_pointers(me, 0);
+
+	i = 0;
+	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+		float *bweight = CustomData_bmesh_get(&bm->vdata, v->head.data, CD_BWEIGHT);
+
+		mvert->bweight = bweight ? (char)((*bweight) * 255) : 0;
+
+		copy_v3_v3(mvert->co, v->co);
+		normal_float_to_short_v3(mvert->no, v->no);
+
+		mvert->flag = BM_vert_flag_to_mflag(v);
+
+		BM_elem_index_set(v, i); /* set_inline */
+
+		/* copy over customdat */
+		CustomData_from_bmesh_block(&bm->vdata, &me->vdata, v->head.data, i);
+
+		i++;
+		mvert++;
+
+		BM_CHECK_ELEMENT(v);
+	}
+	bm->elem_index_dirty &= ~BM_VERT;
+
+	med = medge;
+	i = 0;
+	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+		float *crease = CustomData_bmesh_get(&bm->edata, e->head.data, CD_CREASE);
+		float *bweight = CustomData_bmesh_get(&bm->edata, e->head.data, CD_BWEIGHT);
+
+		med->v1 = BM_elem_index_get(e->v1);
+		med->v2 = BM_elem_index_get(e->v2);
+		med->crease = crease ? (char)((*crease) * 255) : 0;
+		med->bweight = bweight ? (char)((*bweight) * 255) : 0;
+
+		med->flag = BM_edge_flag_to_mflag(e);
+
+		BM_elem_index_set(e, i); /* set_inline */
+
+		/* copy over customdata */
+		CustomData_from_bmesh_block(&bm->edata, &me->edata, e->head.data, i);
+
+		bmesh_quick_edgedraw_flag(med, e);
+
+		i++;
+		med++;
+		BM_CHECK_ELEMENT(e);
+	}
+	bm->elem_index_dirty &= ~BM_EDGE;
+
+	i = 0;
+	j = 0;
+	BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+		mpoly->loopstart = j;
+		mpoly->totloop = f->len;
+		mpoly->mat_nr = f->mat_nr;
+		mpoly->flag = BM_face_flag_to_mflag(f);
+
+		l = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, f);
+		for ( ; l; l = BM_iter_step(&liter), j++, mloop++) {
+			mloop->e = BM_elem_index_get(l->e);
+			mloop->v = BM_elem_index_get(l->v);
+
+			/* copy over customdat */
+			CustomData_from_bmesh_block(&bm->ldata, &me->ldata, l->head.data, j);
+			BM_CHECK_ELEMENT(l);
+			BM_CHECK_ELEMENT(l->e);
+			BM_CHECK_ELEMENT(l->v);
+		}
+
+		if (f == bm->act_face) me->act_face = i;
+
+		/* copy over customdata */
+		CustomData_from_bmesh_block(&bm->pdata, &me->pdata, f->head.data, i);
+
+		i++;
+		mpoly++;
+		BM_CHECK_ELEMENT(f);
+	}
+
+	/* patch hook indices and vertex parents */
+	if (ototvert > 0) {
+		Object *ob;
+		ModifierData *md;
+		BMVert **vertMap = NULL;
+		int i, j;
+
+		for (ob = G.main->object.first; ob; ob = ob->id.next) {
+			if ((ob->parent) && (ob->parent->data == me) && ELEM(ob->partype, PARVERT1, PARVERT3)) {
+
+				if (vertMap == NULL) {
+					vertMap = bm_to_mesh_vertex_map(bm, ototvert);
+				}
+
+				if (ob->par1 < ototvert) {
+					eve = vertMap[ob->par1];
+					if (eve) ob->par1 = BM_elem_index_get(eve);
+				}
+				if (ob->par2 < ototvert) {
+					eve = vertMap[ob->par2];
+					if (eve) ob->par2 = BM_elem_index_get(eve);
+				}
+				if (ob->par3 < ototvert) {
+					eve = vertMap[ob->par3];
+					if (eve) ob->par3 = BM_elem_index_get(eve);
+				}
+
+			}
+			if (ob->data == me) {
+				for (md = ob->modifiers.first; md; md = md->next) {
+					if (md->type == eModifierType_Hook) {
+						HookModifierData *hmd = (HookModifierData *) md;
+
+						if (vertMap == NULL) {
+							vertMap = bm_to_mesh_vertex_map(bm, ototvert);
+						}
+
+						for (i = j = 0; i < hmd->totindex; i++) {
+							if (hmd->indexar[i] < ototvert) {
+								eve = vertMap[hmd->indexar[i]];
+
+								if (eve) {
+									hmd->indexar[j++] = BM_elem_index_get(eve);
+								}
+							}
+							else j++;
+						}
+
+						hmd->totindex = j;
+					}
+				}
+			}
+		}
+
+		if (vertMap) MEM_freeN(vertMap);
+	}
+
+	if (dotess) {
+		BKE_mesh_tessface_calc(me);
+	}
+
+	mesh_update_customdata_pointers(me, dotess);
+
+	{
+		BMEditSelection *selected;
+		me->totselect = BLI_countlist(&(bm->selected));
+
+		if (me->mselect) MEM_freeN(me->mselect);
+
+		me->mselect = MEM_callocN(sizeof(MSelect) * me->totselect, "Mesh selection history");
+
+
+		for (i = 0, selected = bm->selected.first; selected; i++, selected = selected->next) {
+			if (selected->htype == BM_VERT) {
+				me->mselect[i].type = ME_VSEL;
+
+			}
+			else if (selected->htype == BM_EDGE) {
+				me->mselect[i].type = ME_ESEL;
+
+			}
+			else if (selected->htype == BM_FACE) {
+				me->mselect[i].type = ME_FSEL;
+			}
+
+			me->mselect[i].index = BM_elem_index_get(selected->ele);
+		}
+	}
+
+	/* see comment below, this logic is in twice */
+
+	if (me->key) {
+		KeyBlock *currkey;
+		KeyBlock *actkey = BLI_findlink(&me->key->block, bm->shapenr - 1);
+
+		float (*ofs)[3] = NULL;
+
+		/* go through and find any shapekey customdata layers
+		 * that might not have corresponding KeyBlocks, and add them if
+		 * necessary */
+		j = 0;
+		for (i = 0; i < bm->vdata.totlayer; i++) {
+			if (bm->vdata.layers[i].type != CD_SHAPEKEY)
+				continue;
+
+			for (currkey = me->key->block.first; currkey; currkey = currkey->next) {
+				if (currkey->uid == bm->vdata.layers[i].uid)
+					break;
+			}
+
+			if (!currkey) {
+				currkey = add_keyblock(me->key, bm->vdata.layers[i].name);
+				currkey->uid = bm->vdata.layers[i].uid;
+			}
+
+			j++;
+		}
+
+
+		/* editing the base key should update others */
+		if ((me->key->type == KEY_RELATIVE) && /* only need offsets for relative shape keys */
+		    (actkey   != NULL) &&              /* unlikely, but the active key may not be valid if the
+		                                        * bmesh and the mesh are out of sync */
+		    (oldverts != NULL))                /* not used here, but 'oldverts' is used later for applying 'ofs' */
+		{
+			int act_is_basis = FALSE;
+
+			/* find if this key is a basis for any others */
+			for (currkey = me->key->block.first; currkey; currkey = currkey->next) {
+				if (bm->shapenr - 1 == currkey->relative) {
+					act_is_basis = TRUE;
+					break;
+				}
+			}
+
+			if (act_is_basis) { /* active key is a base */
+				float (*fp)[3] = actkey->data;
+				int *keyi;
+
+				ofs = MEM_callocN(sizeof(float) * 3 * bm->totvert,  "currkey->data");
+				mvert = me->mvert;
+				BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, i) {
+					keyi = CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_SHAPE_KEYINDEX);
+					if (keyi && *keyi != ORIGINDEX_NONE) {
+						sub_v3_v3v3(ofs[i], mvert->co, fp[*keyi]);
+					}
+					mvert++;
+				}
+			}
+		}
+
+		for (currkey = me->key->block.first; currkey; currkey = currkey->next) {
+			int apply_offset = (ofs && (currkey != actkey) && (bm->shapenr - 1 == currkey->relative));
+			int *keyi;
+			float (*ofs_pt)[3] = ofs;
+			float *newkey, *oldkey, *fp;
+
+			j = bm_to_mesh_shape_layer_index_from_kb(bm, currkey);
+
+
+			fp = newkey = MEM_callocN(me->key->elemsize * bm->totvert,  "currkey->data");
+			oldkey = currkey->data;
+
+			mvert = me->mvert;
+			BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
+
+				if (currkey == actkey) {
+					copy_v3_v3(fp, eve->co);
+
+					if (actkey != me->key->refkey) { /* important see bug [#30771] */
+						if (oldverts) {
+							keyi = CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_SHAPE_KEYINDEX);
+							if (*keyi != ORIGINDEX_NONE && *keyi < currkey->totelem) { /* valid old vertex */
+								copy_v3_v3(mvert->co, oldverts[*keyi].co);
+							}
+						}
+					}
+				}
+				else if (j != -1) {
+					/* in most cases this runs */
+					copy_v3_v3(fp, CustomData_bmesh_get_n(&bm->vdata, eve->head.data, CD_SHAPEKEY, j));
+				}
+				else if (oldkey &&
+				         (keyi = CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_SHAPE_KEYINDEX)) &&
+				         (*keyi != ORIGINDEX_NONE && *keyi < currkey->totelem))
+				{
+					/* old method of reconstructing keys via vertice's original key indices,
+					 * currently used if the new method above fails (which is theoretically
+					 * possible in certain cases of undo) */
+					copy_v3_v3(fp, &oldkey[3 * (*keyi)]);
+				}
+				else {
+					/* fail! fill in with dummy value */
+					copy_v3_v3(fp, mvert->co);
+				}
+
+				/* propagate edited basis offsets to other shapes */
+				if (apply_offset) {
+					add_v3_v3(fp, *ofs_pt++);
+				}
+
+				fp += 3;
+				mvert++;
+			}
+
+			currkey->totelem = bm->totvert;
+			if (currkey->data) {
+				MEM_freeN(currkey->data);
+			}
+			currkey->data = newkey;
+		}
+
+		if (ofs) MEM_freeN(ofs);
+	}
+
+	if (oldverts) MEM_freeN(oldverts);
+
+	/* topology could be changed, ensure mdisps are ok */
+	multires_topology_changed(me);
+}
diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.h b/source/blender/bmesh/intern/bmesh_mesh_conv.h
new file mode 100644
index 0000000..f9c5158
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_mesh_conv.h
@@ -0,0 +1,40 @@
+/*
+ * ***** 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) 2004 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Geoffrey Bantle.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BMESH_MESH_CONV_H__
+#define __BMESH_MESH_CONV_H__
+
+/** \file blender/bmesh/intern/bmesh_mesh_conv.h
+ *  \ingroup bmesh
+ */
+
+struct Mesh;
+
+void BM_mesh_bm_from_me(BMesh *bm, struct Mesh *me, int set_key, int act_key_nr);
+void BM_mesh_bm_to_me(BMesh *bm, struct Mesh *me, int dotess);
+
+#endif /* __BMESH_MESH_CONV_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_mesh_validate.c b/source/blender/bmesh/intern/bmesh_mesh_validate.c
new file mode 100644
index 0000000..3ec3b84
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_mesh_validate.c
@@ -0,0 +1,186 @@
+/*
+ * ***** 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/bmesh/intern/bmesh_mesh_validate.c
+ *  \ingroup bmesh
+ *
+ * BM mesh validation function.
+ */
+
+/* debug builds only */
+#ifdef DEBUG
+
+#include "BLI_utildefines.h"
+
+#include "bmesh.h"
+
+#include "bmesh_mesh_validate.h"
+
+
+/* macro which inserts the function name */
+#if defined __GNUC__ || defined __sun
+#  define ERRMSG(format, args...) { fprintf(stderr, "%s: " format ", " AT "\n", __func__, ##args); errtot++; } (void)0
+#else
+#  define ERRMSG(format, ...) { fprintf(stderr, "%s: " format ", " AT "\n", __func__, __VA_ARGS__); errtot++; } (void)0
+#endif
+
+/**
+ * Check of this BMesh is valid, this function can be slow since its intended to help with debugging.
+ *
+ * \return TRUE when the mesh is valid.
+ */
+int BM_mesh_validate(BMesh *bm)
+{
+	int errtot;
+
+	BMIter iter;
+	BMVert *v;
+	BMEdge *e;
+	BMFace *f;
+
+	int i, j;
+
+	errtot = -1;
+	fprintf(stderr, "\n");
+	ERRMSG("This is a debugging function and not intended for general use, running slow test!");
+
+	/* force recalc, even if tagged as valid, since this mesh is suspect! */
+	bm->elem_index_dirty |= BM_ALL;
+	BM_mesh_elem_index_ensure(bm, BM_ALL);
+
+	BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) {
+		if (BM_elem_flag_test(v, BM_ELEM_SELECT | BM_ELEM_HIDDEN) == (BM_ELEM_SELECT | BM_ELEM_HIDDEN)) {
+			ERRMSG("vert %d: is hidden and selected", i);
+		}
+
+		if (v->e) {
+			if (!BM_vert_in_edge(v->e, v)) {
+				ERRMSG("vert %d: is not in its referenced edge: %d", i, BM_elem_index_get(v->e));
+			}
+		}
+	}
+
+	/* check edges */
+	BM_ITER_MESH_INDEX (e, &iter, bm, BM_EDGES_OF_MESH, i) {
+		if (e->v1 == e->v2)
+		ERRMSG("edge %d: duplicate index: %d", i, BM_elem_index_get(e->v1));
+	}
+
+	/* edge radial structure */
+	BM_ITER_MESH_INDEX (e, &iter, bm, BM_EDGES_OF_MESH, i) {
+		if (BM_elem_flag_test(e, BM_ELEM_SELECT | BM_ELEM_HIDDEN) == (BM_ELEM_SELECT | BM_ELEM_HIDDEN)) {
+			ERRMSG("edge %d: is hidden and selected", i);
+		}
+
+		if (e->l) {
+			BMLoop *l_iter;
+			BMLoop *l_first;
+
+			j = 0;
+
+			l_iter = l_first = e->l;
+			/* we could do more checks here, but save for face checks */
+			do {
+				if (l_iter->e != e) {
+					ERRMSG("edge %d: has invalid loop, loop is of face %d", i, BM_elem_index_get(l_iter->f));
+				}
+				else if (BM_vert_in_edge(e, l_iter->v) == FALSE) {
+					ERRMSG("edge %d: has invalid loop with vert not in edge, loop is of face %d", i, BM_elem_index_get(l_iter->f));
+				}
+				else if (BM_vert_in_edge(e, l_iter->next->v) == FALSE) {
+					ERRMSG("edge %d: has invalid loop with next vert not in edge, loop is of face %d", i, BM_elem_index_get(l_iter->f));
+				}
+			} while ((l_iter = l_iter->radial_next) != l_first);
+		}
+	}
+
+	/* face structure */
+	BM_ITER_MESH_INDEX (f, &iter, bm, BM_FACES_OF_MESH, i) {
+		BMLoop *l_iter;
+		BMLoop *l_first;
+
+		if (BM_elem_flag_test(f, BM_ELEM_SELECT | BM_ELEM_HIDDEN) == (BM_ELEM_SELECT | BM_ELEM_HIDDEN)) {
+			ERRMSG("face %d: is hidden and selected", i);
+		}
+
+		l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+
+		do {
+			BM_elem_flag_disable(l_iter,    BM_ELEM_INTERNAL_TAG);
+			BM_elem_flag_disable(l_iter->v, BM_ELEM_INTERNAL_TAG);
+			BM_elem_flag_disable(l_iter->e, BM_ELEM_INTERNAL_TAG);
+		} while ((l_iter = l_iter->next) != l_first);
+
+		j = 0;
+
+		l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+		do {
+			if (BM_elem_flag_test(l_iter, BM_ELEM_INTERNAL_TAG)) {
+				ERRMSG("face %d: has duplicate loop at corner: %d", i, j);
+			}
+			if (BM_elem_flag_test(l_iter->v, BM_ELEM_INTERNAL_TAG)) {
+				ERRMSG("face %d: has duplicate vert: %d, at corner: %d", i, BM_elem_index_get(l_iter->v), j);
+			}
+			if (BM_elem_flag_test(l_iter->e, BM_ELEM_INTERNAL_TAG)) {
+				ERRMSG("face %d: has duplicate edge: %d, at corner: %d", i,  BM_elem_index_get(l_iter->e), j);
+			}
+
+			/* adjacent data checks */
+			if (l_iter->f != f) {
+				ERRMSG("face %d: has loop that points to face: %d at corner: %d", i, BM_elem_index_get(l_iter->f), j);
+			}
+			if (l_iter != l_iter->prev->next) {
+				ERRMSG("face %d: has invalid 'prev/next' at corner: %d", i, j);
+			}
+			if (l_iter != l_iter->next->prev) {
+				ERRMSG("face %d: has invalid 'next/prev' at corner: %d", i, j);
+			}
+			if (l_iter != l_iter->radial_prev->radial_next) {
+				ERRMSG("face %d: has invalid 'radial_prev/radial_next' at corner: %d", i, j);
+			}
+			if (l_iter != l_iter->radial_next->radial_prev) {
+				ERRMSG("face %d: has invalid 'radial_next/radial_prev' at corner: %d", i, j);
+			}
+
+			BM_elem_flag_enable(l_iter,    BM_ELEM_INTERNAL_TAG);
+			BM_elem_flag_enable(l_iter->v, BM_ELEM_INTERNAL_TAG);
+			BM_elem_flag_enable(l_iter->e, BM_ELEM_INTERNAL_TAG);
+			j++;
+		} while ((l_iter = l_iter->next) != l_first);
+
+		if (j != f->len) {
+			ERRMSG("face %d: has length if %d but should be %d", i, f->len, j);
+		}
+	}
+
+
+
+	ERRMSG("Finished - errors %d", errtot);
+
+	return TRUE;
+}
+
+
+#endif
diff --git a/source/blender/bmesh/intern/bmesh_mesh_validate.h b/source/blender/bmesh/intern/bmesh_mesh_validate.h
new file mode 100644
index 0000000..6839dc7
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_mesh_validate.h
@@ -0,0 +1,35 @@
+/*
+ * ***** 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 *****
+ */
+
+#ifndef __BMESH_MESH_VALIDATE_H__
+#define __BMESH_MESH_VALIDATE_H__
+
+/** \file blender/bmesh/intern/bmesh_mesh_validate.h
+ *  \ingroup bmesh
+ */
+
+int BM_mesh_validate(BMesh *bm);
+
+#endif /* __BMESH_MESH_VALIDATE_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c
new file mode 100644
index 0000000..a5e761a
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_mods.c
@@ -0,0 +1,1104 @@
+/*
+ * ***** 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, Geoffrey Bantle, Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/intern/bmesh_mods.c
+ *  \ingroup bmesh
+ *
+ * This file contains functions for locally modifying
+ * the topology of existing mesh data. (split, join, flip etc).
+ */
+
+#include "MEM_guardedalloc.h"
+
+
+#include "BLI_math.h"
+#include "BLI_array.h"
+#include "BLI_smallhash.h"
+
+#include "BKE_customdata.h"
+
+#include "bmesh.h"
+#include "intern/bmesh_private.h"
+
+/**
+ * \brief Dissolve Vert
+ *
+ * Turns the face region surrounding a manifold vertex into a single polygon.
+ *
+ * \par Example:
+ *
+ *              +---------+             +---------+
+ *              |  \   /  |             |         |
+ *     Before:  |    v    |      After: |         |
+ *              |  /   \  |             |         |
+ *              +---------+             +---------+
+ *
+ *
+ * This function can also collapse edges too
+ * in cases when it cant merge into faces.
+ *
+ * \par Example:
+ *
+ *     Before:  +----v----+      After: +---------+
+ *
+ * \note dissolves vert, in more situations then BM_disk_dissolve
+ * (e.g. if the vert is part of a wire edge, etc).
+ */
+int BM_vert_dissolve(BMesh *bm, BMVert *v)
+{
+	const int len = BM_vert_edge_count(v);
+	
+	if (len == 1) {
+		BM_vert_kill(bm, v); /* will kill edges too */
+		return TRUE;
+	}
+	else if (!BM_vert_is_manifold(v)) {
+		if (!v->e) {
+			BM_vert_kill(bm, v);
+			return TRUE;
+		}
+		else if (!v->e->l) {
+			if (len == 2) {
+				return (BM_vert_collapse_edge(bm, v->e, v, TRUE) != NULL);
+			}
+			else {
+				/* used to kill the vertex here, but it may be connected to faces.
+				 * so better do nothing */
+				return FALSE;
+			}
+		}
+		else {
+			return FALSE;
+		}
+	}
+	else if (len == 2 && BM_vert_face_count(v) == 1) {
+		/* boundary vertex on a face */
+		return (BM_vert_collapse_edge(bm, v->e, v, TRUE) != NULL);
+	}
+	else {
+		return BM_disk_dissolve(bm, v);
+	}
+}
+
+/**
+ * dissolves all faces around a vert, and removes it.
+ */
+int BM_disk_dissolve(BMesh *bm, BMVert *v)
+{
+	BMFace *f, *f2;
+	BMEdge *e, *keepedge = NULL, *baseedge = NULL;
+	int len = 0;
+
+	if (!BM_vert_is_manifold(v)) {
+		return FALSE;
+	}
+	
+	if (v->e) {
+		/* v->e we keep, what else */
+		e = v->e;
+		do {
+			e = bmesh_disk_edge_next(e, v);
+			if (!(BM_edge_share_face_count(e, v->e))) {
+				keepedge = e;
+				baseedge = v->e;
+				break;
+			}
+			len++;
+		} while (e != v->e);
+	}
+	
+	/* this code for handling 2 and 3-valence verts
+	 * may be totally bad */
+	if (keepedge == NULL && len == 3) {
+		/* handle specific case for three-valence.  solve it by
+		 * increasing valence to four.  this may be hackish. .  */
+		BMLoop *loop = e->l;
+		if (loop->v == v) loop = loop->next;
+		if (!BM_face_split(bm, loop->f, v, loop->v, NULL, NULL, FALSE))
+			return FALSE;
+
+		if (!BM_disk_dissolve(bm, v)) {
+			return FALSE;
+		}
+		return TRUE;
+	}
+	else if (keepedge == NULL && len == 2) {
+		/* collapse the verte */
+		e = BM_vert_collapse_faces(bm, v->e, v, 1.0, TRUE, TRUE);
+
+		if (!e) {
+			return FALSE;
+		}
+
+		/* handle two-valenc */
+		f = e->l->f;
+		f2 = e->l->radial_next->f;
+
+		if (f != f2 && !BM_faces_join_pair(bm, f, f2, e, TRUE)) {
+			return FALSE;
+		}
+
+		return TRUE;
+	}
+
+	if (keepedge) {
+		int done = 0;
+
+		while (!done) {
+			done = 1;
+			e = v->e;
+			do {
+				f = NULL;
+				len = bmesh_radial_length(e->l);
+				if (len == 2 && (e != baseedge) && (e != keepedge)) {
+					f = BM_faces_join_pair(bm, e->l->f, e->l->radial_next->f, e, TRUE);
+					/* return if couldn't join faces in manifold
+					 * conditions */
+					//!disabled for testing why bad things happen
+					if (!f) {
+						return FALSE;
+					}
+				}
+
+				if (f) {
+					done = 0;
+					break;
+				}
+				e = bmesh_disk_edge_next(e, v);
+			} while (e != v->e);
+		}
+
+		/* collapse the verte */
+		e = BM_vert_collapse_faces(bm, baseedge, v, 1.0, TRUE, TRUE);
+
+		if (!e) {
+			return FALSE;
+		}
+		
+		/* get remaining two face */
+		f = e->l->f;
+		f2 = e->l->radial_next->f;
+
+		if (f != f2) {
+			/* join two remaining face */
+			if (!BM_faces_join_pair(bm, f, f2, e, TRUE)) {
+				return FALSE;
+			}
+		}
+	}
+
+	return TRUE;
+}
+
+/**
+ * \brief Faces Join Pair
+ *
+ * Joins two adjacent faces together.
+ *
+ * Because this method calls to #BM_faces_join to do its work, if a pair
+ * of faces share multiple edges, the pair of faces will be joined at
+ * every edge (not just edge \a e). This part of the functionality might need
+ * to be reconsidered.
+ *
+ * If the windings do not match the winding of the new face will follow
+ * \a f1's winding (i.e. \a f2 will be reversed before the join).
+ *
+ * \return pointer to the combined face
+ */
+BMFace *BM_faces_join_pair(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e, const short do_del)
+{
+	BMLoop *l1, *l2;
+	BMEdge *jed = NULL;
+	BMFace *faces[2] = {f1, f2};
+	
+	jed = e;
+	if (!jed) {
+		BMLoop *l_first;
+		/* search for an edge that has both these faces in its radial cycle */
+		l1 = l_first = BM_FACE_FIRST_LOOP(f1);
+		do {
+			if (l1->radial_next->f == f2) {
+				jed = l1->e;
+				break;
+			}
+		} while ((l1 = l1->next) != l_first);
+	}
+
+	if (UNLIKELY(!jed)) {
+		BMESH_ASSERT(0);
+		return NULL;
+	}
+	
+	l1 = jed->l;
+	
+	if (UNLIKELY(!l1)) {
+		BMESH_ASSERT(0);
+		return NULL;
+	}
+	
+	l2 = l1->radial_next;
+	if (l1->v == l2->v) {
+		bmesh_loop_reverse(bm, f2);
+	}
+
+	f1 = BM_faces_join(bm, faces, 2, do_del);
+	
+	return f1;
+}
+
+/**
+ * \brief Connect Verts, Split Face
+ *
+ * connects two verts together, automatically (if very naively) finding the
+ * face they both share (if there is one) and splitting it.  Use this at your
+ * own risk, as it doesn't handle the many complex cases it should (like zero-area faces,
+ * multiple faces, etc).
+ *
+ * this is really only meant for cases where you don't know before hand the face
+ * the two verts belong to for splitting (e.g. the subdivision operator).
+ *
+ * \return The newly created edge.
+ */
+BMEdge *BM_verts_connect(BMesh *bm, BMVert *v1, BMVert *v2, BMFace **r_f)
+{
+	BMIter fiter;
+	BMIter viter;
+	BMVert *v_iter;
+	BMFace *f_iter;
+
+	/* be warned: this can do weird things in some ngon situation, see BM_face_legal_splits */
+	BM_ITER_ELEM (f_iter, &fiter, v1, BM_FACES_OF_VERT) {
+		BM_ITER_ELEM (v_iter, &viter, f_iter, BM_FACES_OF_VERT) {
+			if (v_iter == v2) {
+				BMLoop *nl;
+
+				f_iter = BM_face_split(bm, f_iter, v1, v2, &nl, NULL, FALSE);
+
+				if (r_f) {
+					*r_f = f_iter;
+				}
+				return nl->e;
+			}
+		}
+	}
+
+	if (r_f) {
+		*r_f = NULL;
+	}
+	return NULL;
+}
+
+/**
+ * \brief Face Split
+ *
+ * Split a face along two vertices. returns the newly made face, and sets
+ * the \a r_l member to a loop in the newly created edge.
+ *
+ * \param bm The bmesh
+ * \param f the original face
+ * \param v1, v2 vertices which define the split edge, must be different
+ * \param r_l pointer which will receive the BMLoop for the split edge in the new face
+ * \param example Edge used for attributes of splitting edge, if non-NULL
+ * \param nodouble Use an existing edge if found
+ *
+ * \return Pointer to the newly created face representing one side of the split
+ * if the split is successful (and the original original face will be the
+ * other side). NULL if the split fails.
+ */
+BMFace *BM_face_split(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2, BMLoop **r_l,
+                      BMEdge *example, const short nodouble)
+{
+	const int has_mdisp = CustomData_has_layer(&bm->ldata, CD_MDISPS);
+	BMFace *nf, *of;
+
+	BLI_assert(v1 != v2);
+
+	/* do we have a multires layer */
+	if (has_mdisp) {
+		of = BM_face_copy(bm, f, FALSE, FALSE);
+	}
+	
+#ifdef USE_BMESH_HOLES
+	nf = bmesh_sfme(bm, f, v1, v2, r_l, NULL, example, nodouble);
+#else
+	nf = bmesh_sfme(bm, f, v1, v2, r_l, example, nodouble);
+#endif
+	
+	if (nf) {
+		BM_elem_attrs_copy(bm, bm, f, nf);
+		copy_v3_v3(nf->no, f->no);
+
+		/* handle multires update */
+		if (has_mdisp && (nf != f)) {
+			BMLoop *l_iter;
+			BMLoop *l_first;
+
+			l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+			do {
+				BM_loop_interp_from_face(bm, l_iter, of, FALSE, TRUE);
+			} while ((l_iter = l_iter->next) != l_first);
+
+			l_iter = l_first = BM_FACE_FIRST_LOOP(nf);
+			do {
+				BM_loop_interp_from_face(bm, l_iter, of, FALSE, TRUE);
+			} while ((l_iter = l_iter->next) != l_first);
+
+			BM_face_kill(bm, of);
+
+#if 0
+			/* BM_face_multires_bounds_smooth doesn't flip displacement correct */
+			BM_face_multires_bounds_smooth(bm, f);
+			BM_face_multires_bounds_smooth(bm, nf);
+#endif
+		}
+	}
+
+	return nf;
+}
+
+/**
+ * \brief Face Split with intermediate points
+ *
+ * Like BM_face_split, but with an edge split by \a n intermediate points with given coordinates.
+ *
+ * \param bm The bmesh
+ * \param f the original face
+ * \param v1, v2 vertices which define the split edge, must be different
+ * \param co Array of coordinates for intermediate points
+ * \param n Length of \a cos (must be > 0)
+ * \param r_l pointer which will receive the BMLoop for the first split edge (from \a v1) in the new face
+ * \param example Edge used for attributes of splitting edge, if non-NULL
+ *
+ * \return Pointer to the newly created face representing one side of the split
+ * if the split is successful (and the original original face will be the
+ * other side). NULL if the split fails.
+ */
+BMFace *BM_face_split_n(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2, float cos[][3], int n,
+                        BMLoop **r_l, BMEdge *example)
+{
+	BMFace *nf, *of;
+	BMLoop *l_dummy;
+	BMEdge *e, *newe;
+	BMVert *newv;
+	int i, j;
+
+	BLI_assert(v1 != v2);
+
+	of = BM_face_copy(bm, f, TRUE, TRUE);
+
+	if (!r_l)
+		r_l = &l_dummy;
+	
+#ifdef USE_BMESH_HOLES
+	nf = bmesh_sfme(bm, f, v1, v2, r_l, NULL, example, FALSE);
+#else
+	nf = bmesh_sfme(bm, f, v1, v2, r_l, example, FALSE);
+#endif
+	/* bmesh_sfme returns in r_l a Loop for nf going from v1 to v2.
+	 * The radial_next is for f and goes from v2 to v1  */
+
+	if (nf) {
+		BM_elem_attrs_copy(bm, bm, f, nf);
+		copy_v3_v3(nf->no, f->no);
+
+		e = (*r_l)->e;
+		for (i = 0; i < n; i++) {
+			newv = bmesh_semv(bm, v2, e, &newe);
+			BLI_assert(newv != NULL);
+			/* 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 */
+			for (j = 0; j < 2; j++) {
+				BMEdge *e_iter = (j == 0) ? e : newe;
+				BMLoop *l_iter = e_iter->l;
+				do {
+					if (l_iter->v == newv) {
+						/* this interpolates both loop and vertex data */
+						BM_loop_interp_from_face(bm, l_iter, of, TRUE, TRUE);
+					}
+				} while ((l_iter = l_iter->radial_next) != e_iter->l);
+			}
+			e = newe;
+		}
+	}
+
+	BM_face_verts_kill(bm, of);
+
+	return nf;
+}
+
+/**
+ * \brief Vert Collapse Faces
+ *
+ * Collapses vertex \a kv that has only two manifold edges
+ * onto a vertex it shares an edge with.
+ * \a fac defines the amount of interpolation for Custom Data.
+ *
+ * \note that this is not a general edge collapse function.
+ *
+ * \note this function is very close to #BM_vert_collapse_edge,
+ * 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
+ * \param fac The factor along the edge
+ * \param join_faces When true the faces around the vertex will be joined
+ * otherwise collapse the vertex by merging the 2 edges this vert touches into one.
+ * \param kill_degenerate_faces Removes faces with less than 3 verts after collapsing.
+ *
+ * \returns The New Edge
+ */
+BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac,
+                               const short join_faces, const short kill_degenerate_faces)
+{
+	BMEdge *ne = NULL;
+	BMVert *tv = bmesh_edge_other_vert_get(ke, kv);
+
+	BMEdge *e2;
+	BMVert *tv2;
+
+	BMIter iter;
+	BMLoop *l_iter = NULL, *kvloop = NULL, *tvloop = NULL;
+
+	void *src[2];
+	float w[2];
+
+	/* Only intended to be called for 2-valence vertices */
+	BLI_assert(bmesh_disk_count(kv) <= 2);
+
+
+	/* first modify the face loop data  */
+	w[0] = 1.0f - fac;
+	w[1] = fac;
+
+	if (ke->l) {
+		l_iter = ke->l;
+		do {
+			if (l_iter->v == tv && l_iter->next->v == kv) {
+				tvloop = l_iter;
+				kvloop = l_iter->next;
+
+				src[0] = kvloop->head.data;
+				src[1] = tvloop->head.data;
+				CustomData_bmesh_interp(&bm->ldata, src, w, NULL, 2, kvloop->head.data);
+			}
+		} while ((l_iter = l_iter->radial_next) != ke->l);
+	}
+
+	/* now interpolate the vertex data */
+	BM_data_interp_from_verts(bm, kv, tv, kv, fac);
+
+	e2 = bmesh_disk_edge_next(ke, kv);
+	tv2 = BM_edge_other_vert(e2, kv);
+
+	if (join_faces) {
+		BMFace **faces = NULL;
+		BMFace *f;
+		BLI_array_staticdeclare(faces, 8);
+
+		BM_ITER_ELEM (f, &iter, kv, BM_FACES_OF_VERT) {
+			BLI_array_append(faces, f);
+		}
+
+		if (BLI_array_count(faces) >= 2) {
+			BMFace *f2 = BM_faces_join(bm, faces, BLI_array_count(faces), TRUE);
+			if (f2) {
+				BMLoop *nl = NULL;
+				if (BM_face_split(bm, f2, tv, tv2, &nl, NULL, FALSE)) {
+					ne = nl->e;
+				}
+			}
+		}
+
+		BLI_array_free(faces);
+	}
+	else {
+		/* single face or no faces */
+		/* same as BM_vert_collapse_edge() however we already
+		 * have vars to perform this operation so don't call. */
+		ne = bmesh_jekv(bm, ke, kv, TRUE);
+		/* ne = BM_edge_exists(tv, tv2); */ /* same as return above */
+
+		if (ne && kill_degenerate_faces) {
+			BLI_array_declare(bad_faces);
+			BMFace **bad_faces = NULL;
+
+			BMIter fiter;
+			BMFace *f;
+			BMVert *verts[2] = {ne->v1, ne->v2};
+			int i;
+
+			for (i = 0; i < 2; i++) {
+				/* cant kill data we loop on, build a list and remove those */
+				BLI_array_empty(bad_faces);
+				BM_ITER_ELEM (f, &fiter, verts[i], BM_FACES_OF_VERT) {
+					if (f->len < 3) {
+						BLI_array_append(bad_faces, f);
+					}
+				}
+				while ((f = BLI_array_pop(bad_faces))) {
+					BM_face_kill(bm, f);
+				}
+			}
+			BLI_array_free(bad_faces);
+		}
+	}
+
+	return ne;
+}
+
+
+/**
+ * \brief Vert Collapse Faces
+ *
+ * Collapses a vertex onto another vertex it shares an edge with.
+ *
+ * \return The New Edge
+ */
+BMEdge *BM_vert_collapse_edge(BMesh *bm, BMEdge *ke, BMVert *kv,
+                              const short kill_degenerate_faces)
+{
+	/* nice example implementation but we want loops to have their customdata
+	 * accounted for */
+#if 0
+	BMEdge *ne = NULL;
+
+	/* Collapse between 2 edges */
+
+	/* in this case we want to keep all faces and not join them,
+	 * rather just get rid of the vertex - see bug [#28645] */
+	BMVert *tv  = bmesh_edge_other_vert_get(ke, kv);
+	if (tv) {
+		BMEdge *e2 = bmesh_disk_edge_next(ke, kv);
+		if (e2) {
+			BMVert *tv2 = BM_edge_other_vert(e2, kv);
+			if (tv2) {
+				/* only action, other calls here only get the edge to return */
+				ne = bmesh_jekv(bm, ke, kv);
+
+				/* ne = BM_edge_exists(tv, tv2); */ /* same as return above */
+			}
+		}
+	}
+
+	return ne;
+#else
+	/* with these args faces are never joined, same as above
+	 * but account for loop customdata */
+	return BM_vert_collapse_faces(bm, ke, kv, 1.0f, FALSE, kill_degenerate_faces);
+#endif
+}
+
+#undef DO_V_INTERP
+
+/**
+ * \brief Edge Split
+ *
+ * Splits an edge. \a v should be one of the vertices in \a e and defines
+ * the "from" end of the splitting operation: the new vertex will be
+ * \a percent of the way from \a v to the other end.
+ * The newly created edge is attached to \a v and is returned in \a r_e.
+ * The original edge \a e will be the other half of the split.
+ *
+ * \return The new vert
+ */
+BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float percent)
+{
+	BMVert *nv, *v2;
+	BMFace **oldfaces = NULL;
+	BMEdge *e_dummy;
+	BLI_array_staticdeclare(oldfaces, 32);
+	SmallHash hash;
+	const int do_mdisp = (e->l && CustomData_has_layer(&bm->ldata, CD_MDISPS));
+
+	/* we need this for handling multi-res */
+	if (!r_e) {
+		r_e = &e_dummy;
+	}
+
+	/* do we have a multi-res layer */
+	if (do_mdisp) {
+		BMLoop *l;
+		int i;
+		
+		l = e->l;
+		do {
+			BLI_array_append(oldfaces, l->f);
+			l = l->radial_next;
+		} while (l != e->l);
+		
+		/* create a hash so we can differentiate oldfaces from new face */
+		BLI_smallhash_init(&hash);
+		
+		for (i = 0; i < BLI_array_count(oldfaces); i++) {
+			oldfaces[i] = BM_face_copy(bm, oldfaces[i], TRUE, TRUE);
+			BLI_smallhash_insert(&hash, (intptr_t)oldfaces[i], NULL);
+		}
+	}
+
+	v2 = bmesh_edge_other_vert_get(e, v);
+	nv = bmesh_semv(bm, v, e, r_e);
+
+	BLI_assert(nv != NULL);
+
+	sub_v3_v3v3(nv->co, v2->co, v->co);
+	madd_v3_v3v3fl(nv->co, v->co, nv->co, percent);
+
+	if (r_e) {
+		(*r_e)->head.hflag = e->head.hflag;
+		BM_elem_attrs_copy(bm, bm, e, *r_e);
+	}
+
+	/* v->nv->v2 */
+	BM_data_interp_face_vert_edge(bm, v2, v, nv, e, percent);
+	BM_data_interp_from_verts(bm, v, v2, nv, percent);
+
+	if (do_mdisp) {
+		int i, j;
+
+		/* interpolate new/changed loop data from copied old face */
+		for (j = 0; j < 2; j++) {
+			for (i = 0; i < BLI_array_count(oldfaces); i++) {
+				BMEdge *e1 = j ? *r_e : e;
+				BMLoop *l, *l2;
+				
+				l = e1->l;
+
+				if (UNLIKELY(!l)) {
+					BMESH_ASSERT(0);
+					break;
+				}
+				
+				do {
+					if (!BLI_smallhash_haskey(&hash, (intptr_t)l->f)) {
+						BMLoop *l2_first;
+
+						l2 = l2_first = BM_FACE_FIRST_LOOP(l->f);
+						do {
+							BM_loop_interp_multires(bm, l2, oldfaces[i]);
+						} while ((l2 = l2->next) != l2_first);
+					}
+					l = l->radial_next;
+				} while (l != e1->l);
+			}
+		}
+		
+		/* destroy the old face */
+		for (i = 0; i < BLI_array_count(oldfaces); i++) {
+			BM_face_verts_kill(bm, oldfaces[i]);
+		}
+		
+		/* fix boundaries a bit, doesn't work too well quite yet */
+#if 0
+		for (j = 0; j < 2; j++) {
+			BMEdge *e1 = j ? *r_e : e;
+			BMLoop *l, *l2;
+			
+			l = e1->l;
+			if (UNLIKELY(!l)) {
+				BMESH_ASSERT(0);
+				break;
+			}
+			
+			do {
+				BM_face_multires_bounds_smooth(bm, l->f);
+				l = l->radial_next;
+			} while (l != e1->l);
+		}
+#endif
+		
+		BLI_array_free(oldfaces);
+		BLI_smallhash_release(&hash);
+	}
+
+	return nv;
+}
+
+/**
+ * \brief Split an edge multiple times evenly
+ */
+BMVert  *BM_edge_split_n(BMesh *bm, BMEdge *e, int numcuts)
+{
+	int i;
+	float percent;
+	BMVert *nv = NULL;
+	
+	for (i = 0; i < numcuts; i++) {
+		percent = 1.0f / (float)(numcuts + 1 - i);
+		nv = BM_edge_split(bm, e, e->v2, NULL, percent);
+	}
+	return nv;
+}
+
+/**
+ * Checks if a face is valid in the data structure
+ */
+int BM_face_validate(BMFace *face, FILE *err)
+{
+	BMIter iter;
+	BLI_array_declare(verts);
+	BMVert **verts = NULL;
+	BMLoop *l;
+	int ret = 1, i, j;
+	
+	if (face->len == 2) {
+		fprintf(err, "warning: found two-edged face. face ptr: %p\n", face);
+		fflush(err);
+	}
+
+	BLI_array_growitems(verts, face->len);
+	BM_ITER_ELEM_INDEX (l, &iter, face, BM_LOOPS_OF_FACE, i) {
+		verts[i] = l->v;
+		if (l->e->v1 == l->e->v2) {
+			fprintf(err, "Found bmesh edge with identical verts!\n");
+			fprintf(err, "  edge ptr: %p, vert: %p\n",  l->e, l->e->v1);
+			fflush(err);
+			ret = 0;
+		}
+	}
+
+	for (i = 0; i < face->len; i++) {
+		for (j = 0; j < face->len; j++) {
+			if (j == i) {
+				continue;
+			}
+
+			if (verts[i] == verts[j]) {
+				fprintf(err, "Found duplicate verts in bmesh face!\n");
+				fprintf(err, "  face ptr: %p, vert: %p\n", face, verts[i]);
+				fflush(err);
+				ret = 0;
+			}
+		}
+	}
+	
+	BLI_array_free(verts);
+	return ret;
+}
+
+
+/**
+ * Calculate the 2 loops which _would_ make up the newly rotated Edge
+ * but don't actually change anything.
+ *
+ * Use this to further inspect if the loops to be connected have issues:
+ *
+ * Examples:
+ * - the newly formed edge already exists
+ * - the new face would be degenerate (zero area / concave /  bow-tie)
+ * - may want to measure if the new edge gives improved results topology.
+ *   over the old one, as with beauty fill.
+ *
+ * \note #BM_edge_rotate_check must have already run.
+ */
+void BM_edge_calc_rotate(BMEdge *e, int ccw,
+                         BMLoop **r_l1, BMLoop **r_l2)
+{
+	BMVert *v1, *v2;
+	BMFace *fa, *fb;
+
+	/* this should have already run */
+	BLI_assert(BM_edge_rotate_check(e) == TRUE);
+
+	/* we know this will work */
+	BM_edge_face_pair(e, &fa, &fb);
+
+	/* so we can use ccw variable correctly,
+	 * otherwise we could use the edges verts direct */
+	BM_edge_ordered_verts(e, &v1, &v2);
+
+	/* we could swap the verts _or_ the faces, swapping faces
+	 * gives more predictable results since that way the next vert
+	 * just stitches from face fa / fb */
+	if (ccw) {
+		SWAP(BMFace *, fa, fb);
+	}
+
+	*r_l1 = BM_face_other_vert_loop(fb, v2, v1);
+	*r_l2 = BM_face_other_vert_loop(fa, v1, v2);
+}
+
+/**
+ * \brief Check if Rotate Edge is OK
+ *
+ * Quick check to see if we could rotate the edge,
+ * use this to avoid calling exceptions on common cases.
+ */
+int BM_edge_rotate_check(BMEdge *e)
+{
+	BMFace *fa, *fb;
+	if (BM_edge_face_pair(e, &fa, &fb)) {
+		BMLoop *la, *lb;
+
+		la = BM_face_other_vert_loop(fa, e->v2, e->v1);
+		lb = BM_face_other_vert_loop(fb, e->v2, e->v1);
+
+		/* check that the next vert in both faces isn't the same
+		 * (ie - the next edge doesn't share the same faces).
+		 * since we can't rotate usefully in this case. */
+		if (la->v == lb->v) {
+			return FALSE;
+		}
+
+		/* mirror of the check above but in the opposite direction */
+		la = BM_face_other_vert_loop(fa, e->v1, e->v2);
+		lb = BM_face_other_vert_loop(fb, e->v1, e->v2);
+
+		if (la->v == lb->v) {
+			return FALSE;
+		}
+
+		return TRUE;
+	}
+	else {
+		return FALSE;
+	}
+}
+
+/**
+ * \brief Check if Edge Rotate Gives Degenerate Faces
+ *
+ * Check 2 cases
+ * 1) does the newly forms edge form a flipped face (compare with previous cross product)
+ * 2) does the newly formed edge cause a zero area corner (or close enough to be almost zero)
+ *
+ * \param l1,l2 are the loops of the proposed verts to rotate too and should
+ * be the result of calling #BM_edge_calc_rotate
+ */
+int BM_edge_rotate_check_degenerate(BMEdge *e, BMLoop *l1, BMLoop *l2)
+{
+	/* note: for these vars 'old' just means initial edge state. */
+
+	float ed_dir_old[3]; /* edge vector */
+	float ed_dir_new[3]; /* edge vector */
+	float ed_dir_new_flip[3]; /* edge vector */
+
+	float ed_dir_v1_old[3];
+	float ed_dir_v2_old[3];
+
+	float ed_dir_v1_new[3];
+	float ed_dir_v2_new[3];
+
+	float cross_old[3];
+	float cross_new[3];
+
+	/* original verts - these will be in the edge 'e' */
+	BMVert *v1_old, *v2_old;
+
+	/* verts from the loops passed */
+
+	BMVert *v1, *v2;
+	/* these are the opposite verts - the verts that _would_ be used if 'ccw' was inverted*/
+	BMVert *v1_alt, *v2_alt;
+
+	/* this should have already run */
+	BLI_assert(BM_edge_rotate_check(e) == TRUE);
+
+	BM_edge_ordered_verts(e, &v1_old, &v2_old);
+
+	v1 = l1->v;
+	v2 = l2->v;
+
+	/* get the next vert along */
+	v1_alt = BM_face_other_vert_loop(l1->f, v1_old, v1)->v;
+	v2_alt = BM_face_other_vert_loop(l2->f, v2_old, v2)->v;
+
+	/* normalize all so comparisons are scale independent */
+
+	BLI_assert(BM_edge_exists(v1_old, v1));
+	BLI_assert(BM_edge_exists(v1, v1_alt));
+
+	BLI_assert(BM_edge_exists(v2_old, v2));
+	BLI_assert(BM_edge_exists(v2, v2_alt));
+
+	/* old and new edge vecs */
+	sub_v3_v3v3(ed_dir_old, v1_old->co, v2_old->co);
+	sub_v3_v3v3(ed_dir_new, v1->co, v2->co);
+	normalize_v3(ed_dir_old);
+	normalize_v3(ed_dir_new);
+
+	/* old edge corner vecs */
+	sub_v3_v3v3(ed_dir_v1_old, v1_old->co, v1->co);
+	sub_v3_v3v3(ed_dir_v2_old, v2_old->co, v2->co);
+	normalize_v3(ed_dir_v1_old);
+	normalize_v3(ed_dir_v2_old);
+
+	/* old edge corner vecs */
+	sub_v3_v3v3(ed_dir_v1_new, v1->co, v1_alt->co);
+	sub_v3_v3v3(ed_dir_v2_new, v2->co, v2_alt->co);
+	normalize_v3(ed_dir_v1_new);
+	normalize_v3(ed_dir_v2_new);
+
+	/* compare */
+	cross_v3_v3v3(cross_old, ed_dir_old, ed_dir_v1_old);
+	cross_v3_v3v3(cross_new, ed_dir_new, ed_dir_v1_new);
+	if (dot_v3v3(cross_old, cross_new) < 0.0f) { /* does this flip? */
+		return FALSE;
+	}
+	cross_v3_v3v3(cross_old, ed_dir_old, ed_dir_v2_old);
+	cross_v3_v3v3(cross_new, ed_dir_new, ed_dir_v2_new);
+	if (dot_v3v3(cross_old, cross_new) < 0.0f) { /* does this flip? */
+		return FALSE;
+	}
+
+	negate_v3_v3(ed_dir_new_flip, ed_dir_new);
+
+	/* result is zero area corner */
+	if ((dot_v3v3(ed_dir_new,      ed_dir_v1_new) > 0.999f) ||
+	    (dot_v3v3(ed_dir_new_flip, ed_dir_v2_new) > 0.999f))
+	{
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+int BM_edge_rotate_check_beauty(BMEdge *e,
+                                BMLoop *l1, BMLoop *l2)
+{
+	/* Stupid check for now:
+	 * Could compare angles of surrounding edges
+	 * before & after, but this is OK.*/
+	return (len_squared_v3v3(e->v1->co, e->v2->co) >
+	        len_squared_v3v3(l1->v->co, l2->v->co));
+}
+
+/**
+ * \brief Rotate Edge
+ *
+ * Spins an edge topologically,
+ * either counter-clockwise or clockwise depending on \a ccw.
+ *
+ * \return The spun edge, NULL on error
+ * (e.g., if the edge isn't surrounded by exactly two faces).
+ *
+ * \note This works by dissolving the edge then re-creating it,
+ * so the returned edge won't have the same pointer address as the original one.
+ *
+ * \see header definition for \a check_flag enum.
+ */
+BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const short ccw, const short check_flag)
+{
+	BMVert *v1, *v2;
+	BMLoop *l1, *l2;
+	BMFace *f;
+	BMEdge *e_new = NULL;
+	char f_hflag_prev_1;
+	char f_hflag_prev_2;
+
+	if (!BM_edge_rotate_check(e)) {
+		return NULL;
+	}
+
+	BM_edge_calc_rotate(e, ccw, &l1, &l2);
+
+	/* the loops will be freed so assign verts */
+	v1 = l1->v;
+	v2 = l2->v;
+
+	/* --------------------------------------- */
+	/* Checking Code - make sure we can rotate */
+
+	if (check_flag & BM_EDGEROT_CHECK_BEAUTY) {
+		if (!BM_edge_rotate_check_beauty(e, l1, l2)) {
+			return NULL;
+		}
+	}
+
+	/* check before applying */
+	if (check_flag & BM_EDGEROT_CHECK_EXISTS) {
+		if (BM_edge_exists(v1, v2)) {
+			return NULL;
+		}
+	}
+
+	/* slowest, check last */
+	if (check_flag & BM_EDGEROT_CHECK_DEGENERATE) {
+		if (!BM_edge_rotate_check_degenerate(e, l1, l2)) {
+			return NULL;
+		}
+	}
+	/* Done Checking */
+	/* ------------- */
+
+
+
+	/* --------------- */
+	/* Rotate The Edge */
+
+	/* first create the new edge, this is so we can copy the customdata from the old one
+	 * if splice if disabled, always add in a new edge even if theres one there. */
+	e_new = BM_edge_create(bm, v1, v2, e, (check_flag & BM_EDGEROT_CHECK_SPLICE)!=0);
+
+	f_hflag_prev_1 = l1->f->head.hflag;
+	f_hflag_prev_2 = l2->f->head.hflag;
+
+	/* don't delete the edge, manually remove the egde after so we can copy its attributes */
+	f = BM_faces_join_pair(bm, l1->f, l2->f, NULL, TRUE);
+
+	if (f == NULL) {
+		return NULL;
+	}
+
+	/* note, this assumes joining the faces _didnt_ also remove the verts.
+	 * the #BM_edge_rotate_check will ensure this, but its possibly corrupt state or future edits
+	 * break this */
+	if (!BM_face_split(bm, f, v1, v2, NULL, NULL, TRUE)) {
+		return NULL;
+	}
+	else {
+		/* we should really be able to know the faces some other way,
+		 * rather then fetching them back from the edge, but this is predictable
+		 * where using the return values from face split isn't. - campbell */
+		BMFace *fa, *fb;
+		if (BM_edge_face_pair(e_new, &fa, &fb)) {
+			fa->head.hflag = f_hflag_prev_1;
+			fb->head.hflag = f_hflag_prev_2;
+		}
+	}
+
+	return e_new;
+}
+
+/**
+ * \brief Rip a single face from a vertex fan
+ */
+BMVert *BM_face_vert_separate(BMesh *bm, BMFace *sf, BMVert *sv)
+{
+	return bmesh_urmv(bm, sf, sv);
+}
+
+/**
+ * \brief Rip a single face from a vertex fan
+ *
+ * \note same as #BM_face_vert_separate but faster (avoids a loop lookup)
+ */
+BMVert *BM_face_loop_separate(BMesh *bm, BMLoop *sl)
+{
+	return bmesh_urmv_loop(bm, sl);
+}
diff --git a/source/blender/bmesh/intern/bmesh_mods.h b/source/blender/bmesh/intern/bmesh_mods.h
new file mode 100644
index 0000000..802c6cc
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_mods.h
@@ -0,0 +1,83 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BMESH_MODS_H__
+#define __BMESH_MODS_H__
+
+/** \file blender/bmesh/intern/bmesh_mods.h
+ *  \ingroup bmesh
+ */
+
+#include <stdio.h>
+
+int BM_vert_dissolve(BMesh *bm, BMVert *v);
+
+int BM_disk_dissolve(BMesh *bm, BMVert *v);
+
+BMFace *BM_faces_join_pair(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e, const short do_del);
+
+BMEdge *BM_verts_connect(BMesh *bm, BMVert *v1, BMVert *v2, BMFace **r_f);
+
+BMFace *BM_face_split(BMesh *bm, BMFace *f,
+                      BMVert *v1, BMVert *v2,
+                      BMLoop **r_l,
+                      BMEdge *example, const short nodouble);
+
+BMFace *BM_face_split_n(BMesh *bm, BMFace *f,
+                        BMVert *v1, BMVert *v2,
+                        float cos[][3], int n,
+                        BMLoop **r_l, BMEdge *example);
+
+BMEdge* BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac,
+                               const short join_faces, const short kill_degenerate_faces);
+BMEdge* BM_vert_collapse_edge(BMesh *bm, BMEdge *ke, BMVert *kv,
+                              const short kill_degenerate_faces);
+
+
+BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float percent);
+
+BMVert *BM_edge_split_n(BMesh *bm, BMEdge *e, int numcuts);
+
+int     BM_face_validate(BMFace *face, FILE *err);
+
+void    BM_edge_calc_rotate(BMEdge *e, int ccw,
+                            BMLoop **r_l1, BMLoop **r_l2);
+int     BM_edge_rotate_check(BMEdge *e);
+int     BM_edge_rotate_check_degenerate(BMEdge *e,
+                                        BMLoop *l1, BMLoop *l2);
+int     BM_edge_rotate_check_beauty(BMEdge *e,
+                                    BMLoop *l1, BMLoop *l2);
+BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const short ccw, const short check_flag);
+
+/* flags for BM_edge_rotate */
+enum {
+	BM_EDGEROT_CHECK_EXISTS     = (1 << 0), /* disallow to rotate when the new edge matches an existing one */
+	BM_EDGEROT_CHECK_SPLICE     = (1 << 1), /* overrides existing check, if the edge already, rotate and merge them */
+	BM_EDGEROT_CHECK_DEGENERATE = (1 << 2), /* disallow creating bow-tie, concave or zero area faces */
+	BM_EDGEROT_CHECK_BEAUTY     = (1 << 3)  /* disallow to rotate into ugly topology */
+};
+
+
+BMVert *BM_face_vert_separate(BMesh *bm, BMFace *sf, BMVert *sv);
+BMVert *BM_face_loop_separate(BMesh *bm, BMLoop *sl);
+
+#endif /* __BMESH_MODS_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c
new file mode 100644
index 0000000..4b5c67c
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_opdefines.c
@@ -0,0 +1,1198 @@
+/*
+ * ***** 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, Geoffrey Bantle, Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/intern/bmesh_opdefines.c
+ *  \ingroup bmesh
+ *
+ * BMesh operator definitions.
+ *
+ * This file defines (and documents) all bmesh operators (bmops).
+ *
+ * Do not rename any operator or slot names! otherwise you must go
+ * through the code and find all references to them!
+ *
+ * A word on slot names:
+ *
+ * For geometry input slots, the following are valid names:
+ * - verts
+ * - edges
+ * - faces
+ * - edgefacein
+ * - vertfacein
+ * - vertedgein
+ * - vertfacein
+ * - geom
+ *
+ * The basic rules are, for single-type geometry slots, use the plural of the
+ * type name (e.g. edges).  for double-type slots, use the two type names plus
+ * "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
+ * slot definition tells you what types of elements are in it.
+ *
+ */
+
+#include "BLI_utildefines.h"
+
+#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:
+ *
+ * template (py quotes used because nested comments don't work
+ * on all C compilers):
+ *
+ * """
+ * Region Extend.
+ *
+ * paragraph1, Extends bleh bleh bleh.
+ * Bleh Bleh bleh.
+ *
+ * Another paragraph.
+ *
+ * Another paragraph.
+ * """
+ *
+ * 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.
+ *
+ * {BMO_OP_SLOT_ELEMENT_BUF, "geomout"}, //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".
+ *
+ * note that slots default to being input slots.
+ */
+
+/*
+ * Vertex Smooth
+ *
+ * Smooths vertices by using a basic vertex averaging scheme.
+ */
+static BMOpDefine bmo_vertexsmooth_def = {
+	"vertexsmooth",
+	{{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
+	{0} /* null-terminating sentinel */,
+	},
+	bmo_vertexsmooth_exec,
+	0
+};
+
+/*
+ * Right-Hand Faces
+ *
+ * Computes an "outside" normal for the specified input faces.
+ */
+
+static BMOpDefine bmo_righthandfaces_def = {
+	"righthandfaces",
+	{{BMO_OP_SLOT_ELEMENT_BUF, "faces"},
+	 {BMO_OP_SLOT_BOOL, "do_flip"}, //internal flag, used by bmesh_rationalize_normals
+	 {0} /* null-terminating sentinel */,
+	},
+	bmo_righthandfaces_exec,
+	BMO_OP_FLAG_UNTAN_MULTIRES,
+};
+
+/*
+ * Region Extend
+ *
+ * used to implement the select more/less tools.
+ * this puts some geometry surrounding regions of
+ * geometry in geom into geomout.
+ *
+ * if usefaces is 0 then geomout spits out verts and edges,
+ * otherwise it spits out faces.
+ */
+static BMOpDefine bmo_regionextend_def = {
+	"regionextend",
+	{{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 */,
+	},
+	bmo_regionextend_exec,
+	0
+};
+
+/*
+ * Edge Rotate
+ *
+ * Rotates edges topologically.  Also known as "spin edge" to some people.
+ * Simple example: [/] becomes [|] then [\].
+ */
+static BMOpDefine bmo_edgerotate_def = {
+	"edgerotate",
+	{{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 */,
+	},
+	bmo_edgerotate_exec,
+	BMO_OP_FLAG_UNTAN_MULTIRES
+};
+
+/*
+ * Reverse Faces
+ *
+ * Reverses the winding (vertex order) of faces.  This has the effect of
+ * flipping the normal.
+ */
+static BMOpDefine bmo_reversefaces_def = {
+	"reversefaces",
+	{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, //input faces
+	 {0} /* null-terminating sentinel */,
+	},
+	bmo_reversefaces_exec,
+	BMO_OP_FLAG_UNTAN_MULTIRES,
+};
+
+/*
+ * Edge Bisect
+ *
+ * Splits input edges (but doesn't do anything else).
+ * This creates a 2-valence vert.
+ */
+static BMOpDefine bmo_edgebisect_def = {
+	"edgebisect",
+	{{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 */,
+	},
+	bmo_edgebisect_exec,
+	BMO_OP_FLAG_UNTAN_MULTIRES
+};
+
+/*
+ * Mirror
+ *
+ * Mirrors geometry along an axis.  The resulting geometry is welded on using
+ * mergedist.  Pairs of original/mirrored vertices are welded using the mergedist
+ * 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 */}},
+	bmo_mirror_exec,
+	0,
+};
+
+/*
+ * Find Doubles
+ *
+ * Takes input verts and find vertices they should weld to.  Outputs a
+ * mapping slot suitable for use with the weld verts bmop.
+ *
+ * If keepverts is used, vertices outside that set can only be merged
+ * with vertices in that set.
+ */
+static BMOpDefine bmo_finddoubles_def = {
+	"finddoubles",
+	{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, //input vertices
+	 {BMO_OP_SLOT_ELEMENT_BUF, "keepverts"}, //list of verts to keep
+	 {BMO_OP_SLOT_FLT,         "dist"}, //minimum distance
+	 {BMO_OP_SLOT_MAPPING, "targetmapout"},
+	 {0, /* null-terminating sentinel */}},
+	bmo_finddoubles_exec,
+	0,
+};
+
+/*
+ * Remove Doubles
+ *
+ * Finds groups of vertices closer then dist and merges them together,
+ * using the weld verts bmop.
+ */
+static BMOpDefine bmo_removedoubles_def = {
+	"removedoubles",
+	{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, //input verts
+	 {BMO_OP_SLOT_FLT,         "dist"}, //minimum distance
+	 {0, /* null-terminating sentinel */}},
+	bmo_removedoubles_exec,
+	BMO_OP_FLAG_UNTAN_MULTIRES,
+};
+
+/*
+ * Auto Merge
+ *
+ * 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.
+ */
+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 */}},
+	bmo_automerge_exec,
+	BMO_OP_FLAG_UNTAN_MULTIRES,
+};
+
+/*
+ * Collapse Connected
+ *
+ * Collapses connected vertices
+ */
+static BMOpDefine bmo_collapse_def = {
+	"collapse",
+	{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edge */
+	 {0, /* null-terminating sentinel */}},
+	bmo_collapse_exec,
+	BMO_OP_FLAG_UNTAN_MULTIRES,
+};
+
+
+/*
+ * Facedata 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 */}},
+	bmo_pointmerge_facedata_exec,
+	0,
+};
+
+/*
+ * Average Vertices Facevert Data
+ *
+ * Merge uv/vcols associated with the input vertices at
+ * the bounding box center. (I know, it's not averaging but
+ * the vert_snap_to_bb_center is just too long).
+ */
+static BMOpDefine bmo_vert_average_facedata_def = {
+	"vert_average_facedata",
+	{{BMO_OP_SLOT_ELEMENT_BUF, "verts"}, /* input vertice */
+	 {0, /* null-terminating sentinel */}},
+	bmo_vert_average_facedata_exec,
+	0,
+};
+
+/*
+ * 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,         "mergeco"},
+	 {0, /* null-terminating sentinel */}},
+	bmo_pointmerge_exec,
+	BMO_OP_FLAG_UNTAN_MULTIRES,
+};
+
+/*
+ * Collapse Connected UVs
+ *
+ * Collapses connected UV vertices.
+ */
+static BMOpDefine bmo_collapse_uvs_def = {
+	"collapse_uvs",
+	{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edge */
+	 {0, /* null-terminating sentinel */}},
+	bmo_collapse_uvs_exec,
+	0,
+};
+
+/*
+ * Weld Verts
+ *
+ * Welds verts together (kindof 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_weldverts_def = {
+	"weldverts",
+	{{BMO_OP_SLOT_MAPPING, "targetmap"}, /* maps welded vertices to verts they should weld to */
+	 {0, /* null-terminating sentinel */}},
+	bmo_weldverts_exec,
+	BMO_OP_FLAG_UNTAN_MULTIRES,
+};
+
+/*
+ * Make Vertex
+ *
+ * Creates a single vertex; this bmop was necessary
+ * for click-create-vertex.
+ */
+static BMOpDefine bmo_makevert_def = {
+	"makevert",
+	{{BMO_OP_SLOT_VEC, "co"}, //the coordinate of the new vert
+	 {BMO_OP_SLOT_ELEMENT_BUF, "newvertout"}, //the new vert
+	 {0, /* null-terminating sentinel */}},
+	bmo_makevert_exec,
+	0,
+};
+
+/*
+ * 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 */}},
+	bmo_join_triangles_exec,
+	BMO_OP_FLAG_UNTAN_MULTIRES,
+};
+
+/*
+ * Contextual Create
+ *
+ * This is basically fkey, it creates
+ * new faces from vertices, makes stuff from edge nets,
+ * 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) */
+	 {BMO_OP_SLOT_INT,         "mat_nr"},      /* material to use */
+	 {BMO_OP_SLOT_BOOL,        "use_smooth"},  /* material to use */
+	 {0, /* null-terminating sentinel */}},
+	bmo_contextual_create_exec,
+	BMO_OP_FLAG_UNTAN_MULTIRES,
+};
+
+/*
+ * 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 */
+	 {0, /* null-terminating sentinel */}},
+	bmo_bridge_loops_exec,
+	0,
+};
+
+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 */}},
+	bmo_edgenet_fill_exec,
+	0,
+};
+
+/*
+ * 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:
+ *
+ * - One single loop; an edge is added to connect the ends
+ * - Two loops; two edges are added to connect the endpoints (based on the
+ *   shortest distance between each endpont).
+ */
+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,
+	0,
+};
+
+/*
+ * Rotate
+ *
+ * Rotate vertices around a center, using a 3x3 rotation
+ * matrix.  Equivalent of the old rotateflag function.
+ */
+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 */}},
+	bmo_rotate_exec,
+	0,
+};
+
+/*
+ * Translate
+ *
+ * Translate vertices by an offset.  Equivalent of the
+ * old translateflag function.
+ */
+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 */}},
+	bmo_translate_exec,
+	0,
+};
+
+/*
+ * 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 */}},
+	bmo_scale_exec,
+	0,
+};
+
+
+/*
+ * 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 */}},
+	bmo_transform_exec,
+	0,
+};
+
+/*
+ * 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_PNT, "scene"},
+	 {BMO_OP_SLOT_PNT, "object"},
+	 {0, /* null-terminating sentinel */}},
+	bmo_object_load_bmesh_exec,
+	0,
+};
+
+
+/*
+ * 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_PNT, "mesh"}, //pointer to a mesh structure to fill in
+	 {BMO_OP_SLOT_PNT, "object"}, //pointer to an object structure
+	 {BMO_OP_SLOT_BOOL, "notessellation"}, //don't calculate mfaces
+	 {0, /* null-terminating sentinel */}},
+	bmo_bmesh_to_mesh_exec,
+	0,
+};
+
+/*
+ * 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_PNT, "mesh"}, //pointer to a Mesh structure
+	 {BMO_OP_SLOT_PNT, "object"}, //pointer to an Object structure
+	 {BMO_OP_SLOT_BOOL, "set_shapekey"}, //load active shapekey coordinates into verts
+	 {0, /* null-terminating sentinel */}},
+	bmo_mesh_to_bmesh_exec,
+	0
+};
+
+/*
+ * Individual Face Extrude
+ *
+ * Extrudes faces individually.
+ */
+static BMOpDefine bmo_extrude_indivface_def = {
+	"extrude_face_indiv",
+	{{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 */},
+	bmo_extrude_face_indiv_exec,
+	0
+};
+
+/*
+ * 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 */},
+	bmo_extrude_edge_only_exec,
+	0
+};
+
+/*
+ * 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 */},
+	bmo_extrude_vert_indiv_exec,
+	0
+};
+
+static BMOpDefine bmo_connectverts_def = {
+	"connectverts",
+	{{BMO_OP_SLOT_ELEMENT_BUF, "verts"},
+	 {BMO_OP_SLOT_ELEMENT_BUF, "edgeout"},
+	 {0} /* null-terminating sentinel */},
+	bmo_connectverts_exec,
+	BMO_OP_FLAG_UNTAN_MULTIRES
+};
+
+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 */},
+	bmo_extrude_face_region_exec,
+	0
+};
+
+static BMOpDefine bmo_dissolve_verts_def = {
+	"dissolve_verts",
+	{{BMO_OP_SLOT_ELEMENT_BUF, "verts"},
+	 {0} /* null-terminating sentinel */},
+	bmo_dissolve_verts_exec,
+	BMO_OP_FLAG_UNTAN_MULTIRES
+};
+
+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 */},
+	bmo_dissolve_edges_exec,
+	BMO_OP_FLAG_UNTAN_MULTIRES
+};
+
+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 */},
+	bmo_dissolve_edgeloop_exec,
+	BMO_OP_FLAG_UNTAN_MULTIRES
+};
+
+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 */},
+	bmo_dissolve_faces_exec,
+	BMO_OP_FLAG_UNTAN_MULTIRES
+};
+
+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 */},
+	bmo_dissolve_limit_exec,
+	BMO_OP_FLAG_UNTAN_MULTIRES
+};
+
+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 */},
+	bmo_triangulate_exec,
+	BMO_OP_FLAG_UNTAN_MULTIRES
+};
+
+static BMOpDefine bmo_esubd_def = {
+	"esubd",
+	{{BMO_OP_SLOT_ELEMENT_BUF, "edges"},
+	 {BMO_OP_SLOT_FLT, "smooth"},
+	 {BMO_OP_SLOT_FLT, "fractal"},
+	 {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 */,
+	},
+	bmo_esubd_exec,
+	BMO_OP_FLAG_UNTAN_MULTIRES
+};
+
+static BMOpDefine bmo_del_def = {
+	"del",
+	{{BMO_OP_SLOT_ELEMENT_BUF, "geom"},
+	 {BMO_OP_SLOT_INT, "context"},
+	 {0} /* null-terminating sentinel */},
+	bmo_del_exec,
+	0
+};
+
+static BMOpDefine bmo_dupe_def = {
+	"dupe",
+	{{BMO_OP_SLOT_ELEMENT_BUF, "geom"},
+	 {BMO_OP_SLOT_ELEMENT_BUF, "origout"},
+	 {BMO_OP_SLOT_ELEMENT_BUF, "newout"},
+	/* 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_PNT, "dest"}, /* destination bmesh, if NULL will use current on */
+	 {0} /* null-terminating sentinel */},
+	bmo_dupe_exec,
+	0
+};
+
+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_PNT, "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 */},
+	bmo_split_exec,
+	0
+};
+
+/*
+ * 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 */},
+	bmo_spin_exec,
+	0
+};
+
+
+/*
+ * Similar faces search
+ *
+ * Find similar faces (area/material/perimeter, ...).
+ */
+static BMOpDefine bmo_similarfaces_def = {
+	"similarfaces",
+	{{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 */},
+	bmo_similarfaces_exec,
+	0
+};
+
+/*
+ * Similar edges search
+ *
+ *  Find similar edges (length, direction, edge, seam, ...).
+ */
+static BMOpDefine bmo_similaredges_def = {
+	"similaredges",
+	{{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 */},
+	bmo_similaredges_exec,
+	0
+};
+
+/*
+ * Similar vertices search
+ *
+ * Find similar vertices (normal, face, vertex group, ...).
+ */
+static BMOpDefine bmo_similarverts_def = {
+	"similarverts",
+	{{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 */},
+	bmo_similarverts_exec,
+	0
+};
+
+/*
+ * uv rotation
+ * cycle the uvs
+ */
+static BMOpDefine bmo_face_rotateuvs_def = {
+	"face_rotateuvs",
+	{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
+	 {BMO_OP_SLOT_INT, "dir"},			/* direction */
+	 {0} /* null-terminating sentinel */},
+	bmo_face_rotateuvs_exec,
+	0
+};
+
+/*
+ * uv reverse
+ * reverse the uvs
+ */
+static BMOpDefine bmo_face_reverseuvs_def = {
+	"face_reverseuvs",
+	{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
+	 {0} /* null-terminating sentinel */},
+	bmo_face_reverseuvs_exec,
+	0
+};
+
+/*
+ * color rotation
+ * cycle the colors
+ */
+static BMOpDefine bmo_face_rotatecolors_def = {
+	"face_rotatecolors",
+	{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
+	 {BMO_OP_SLOT_INT, "dir"},			/* direction */
+	 {0} /* null-terminating sentinel */},
+	bmo_rotatecolors_exec,
+	0
+};
+
+/*
+ * color reverse
+ * reverse the colors
+ */
+static BMOpDefine bmo_face_reversecolors_def = {
+	"face_reversecolors",
+	{{BMO_OP_SLOT_ELEMENT_BUF, "faces"}, /* input faces */
+	 {0} /* null-terminating sentinel */},
+	bmo_face_reversecolors_exec,
+	0
+};
+
+/*
+ * Similar vertices search
+ *
+ * Find similar vertices (normal, face, vertex group, ...).
+ */
+static BMOpDefine bmo_vertexshortestpath_def = {
+	"vertexshortestpath",
+	{{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 */},
+	bmo_vertexshortestpath_exec,
+	0
+};
+
+/*
+ * Edge Split
+ *
+ * Disconnects faces along input edges.
+ */
+static BMOpDefine bmo_edgesplit_def = {
+	"edgesplit",
+	{{BMO_OP_SLOT_ELEMENT_BUF, "edges"}, /* input edges */
+	 {BMO_OP_SLOT_ELEMENT_BUF, "edgeout"}, /* old output disconnected 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 */},
+	bmo_edgesplit_exec,
+	BMO_OP_FLAG_UNTAN_MULTIRES
+};
+
+/*
+ * 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 */}},
+	bmo_create_grid_exec,
+	0,
+};
+
+/*
+ * 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 */}},
+	bmo_create_uvsphere_exec,
+	0,
+};
+
+/*
+ * 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 */}},
+	bmo_create_icosphere_exec,
+	0,
+};
+
+/*
+ * Create Suzanne
+ *
+ * Creates a monkey.  Be wary.
+ */
+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 */}},
+	bmo_create_monkey_exec,
+	0,
+};
+
+/*
+ * 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 */}},
+	bmo_create_cone_exec,
+	0,
+};
+
+/*
+ * 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 */}},
+	bmo_create_circle_exec,
+	0,
+};
+
+/*
+ * Create Cone
+ *
+ * Creates a cone with variable depth at both ends
+ */
+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 */}},
+	bmo_create_cube_exec,
+	0,
+};
+
+/*
+ * 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 laye */
+	 {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 bevelled edge */
+	 {0} /* null-terminating sentinel */},
+	bmo_bevel_exec,
+	BMO_OP_FLAG_UNTAN_MULTIRES
+};
+
+/*
+ * Beautify Fill
+ *
+ * Makes triangle a bit nicer
+ */
+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 */},
+	bmo_beautify_fill_exec,
+	BMO_OP_FLAG_UNTAN_MULTIRES
+};
+
+/*
+ * 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 */},
+	bmo_triangle_fill_exec,
+	BMO_OP_FLAG_UNTAN_MULTIRES
+};
+
+/*
+ * 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}},
+	bmo_solidify_face_region_exec,
+	0
+};
+
+/*
+ * Face Inset
+ *
+ * Extrudes faces individually.
+ */
+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 */},
+	bmo_inset_exec,
+	0
+};
+
+/*
+ * Vertex Slide
+ *
+ * Translates vertes along an edge
+ */
+static BMOpDefine bmo_vertex_slide_def = {
+	"vertex_slide",
+	{{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 */},
+	bmo_vertex_slide_exec,
+	BMO_OP_FLAG_UNTAN_MULTIRES
+};
+
+
+BMOpDefine *opdefines[] = {
+	&bmo_split_def,
+	&bmo_spin_def,
+	&bmo_dupe_def,
+	&bmo_del_def,
+	&bmo_esubd_def,
+	&bmo_triangulate_def,
+	&bmo_dissolve_faces_def,
+	&bmo_dissolve_edges_def,
+	&bmo_dissolve_edge_loop_def,
+	&bmo_dissolve_verts_def,
+	&bmo_dissolve_limit_def,
+	&bmo_extrude_face_region_def,
+	&bmo_connectverts_def,
+	&bmo_extrude_vert_indiv_def,
+	&bmo_mesh_to_bmesh_def,
+	&bmo_object_load_bmesh_def,
+	&bmo_transform_def,
+	&bmo_translate_def,
+	&bmo_rotate_def,
+	&bmo_edgenet_fill_def,
+	&bmo_contextual_create_def,
+	&bmo_makevert_def,
+	&bmo_weldverts_def,
+	&bmo_removedoubles_def,
+	&bmo_finddoubles_def,
+	&bmo_mirror_def,
+	&bmo_edgebisect_def,
+	&bmo_reversefaces_def,
+	&bmo_edgerotate_def,
+	&bmo_regionextend_def,
+	&bmo_righthandfaces_def,
+	&bmo_vertexsmooth_def,
+	&bmo_extrude_edge_only_def,
+	&bmo_extrude_indivface_def,
+	&bmo_collapse_uvs_def,
+	&bmo_pointmerge_def,
+	&bmo_collapse_def,
+	&bmo_similarfaces_def,
+	&bmo_similaredges_def,
+	&bmo_similarverts_def,
+	&bmo_pointmerge_facedata_def,
+	&bmo_vert_average_facedata_def,
+	&bmo_face_rotateuvs_def,
+	&bmo_bmesh_to_mesh_def,
+	&bmo_face_reverseuvs_def,
+	&bmo_edgenet_prepare_def,
+	&bmo_face_rotatecolors_def,
+	&bmo_face_reversecolors_def,
+	&bmo_vertexshortestpath_def,
+	&bmo_scale_def,
+	&bmo_edgesplit_def,
+	&bmo_automerge_def,
+	&bmo_create_uvsphere_def,
+	&bmo_create_grid_def,
+	&bmo_create_icosphere_def,
+	&bmo_create_monkey_def,
+	&bmo_create_cube_def,
+	&bmo_create_circle_def,
+	&bmo_create_cone_def,
+	&bmo_join_triangles_def,
+	&bmo_bevel_def,
+	&bmo_beautify_fill_def,
+	&bmo_triangle_fill_def,
+	&bmo_bridge_loops_def,
+	&bmo_solidify_def,
+	&bmo_inset_def,
+	&bmo_vertex_slide_def,
+};
+
+int bmesh_total_ops = (sizeof(opdefines) / sizeof(void *));
diff --git a/source/blender/bmesh/intern/bmesh_operator_api.h b/source/blender/bmesh/intern/bmesh_operator_api.h
new file mode 100644
index 0000000..b5e6534
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_operator_api.h
@@ -0,0 +1,434 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BMESH_OPERATOR_API_H__
+#define __BMESH_OPERATOR_API_H__
+
+/** \file blender/bmesh/bmesh_operator_api.h
+ *  \ingroup bmesh
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "BLI_ghash.h"
+
+#include <stdarg.h>
+
+/**
+ * operators represent logical, executable mesh modules.  all topological
+ * operations involving a bmesh has to go through them.
+ *
+ * operators are nested, as are tool flags, which are private to an operator
+ * when it's executed.  tool flags are allocated in layers, one per operator
+ * execution, and are used for all internal flagging a tool needs to do.
+ *
+ * each operator has a series of "slots" which can be of the following types:
+ * - simple numerical types
+ * - arrays of elements (e.g. arrays of faces).
+ * - hash mappings.
+ *
+ * each slot is identified by a slot code, as are each operator.
+ * operators, and their slots, are defined in bmesh_opdefines.c (with their
+ * execution functions prototyped in bmesh_operators_private.h), with all their
+ * operator code and slot codes defined in bmesh_operators.h.  see
+ * bmesh_opdefines.c and the BMOpDefine struct for how to define new operators.
+ *
+ * in general, operators are fed arrays of elements, created using either
+ * #BMO_slot_buffer_from_hflag or #BMO_slot_buffer_from_flag
+ * (or through one of the format specifiers in #BMO_op_callf or #BMO_op_initf).
+ *
+ * \note multiple element types (e.g. faces and edges)
+ * can be fed to the same slot array.  Operators act on this data,
+ * and possibly spit out data into output slots.
+ *
+ * \note operators should never read from header flags (e.g. element->head.flag).
+ * For example, if you want an operator to only operate on selected faces, you
+ * should use #BMO_slot_buffer_from_hflag to put the selected elements into a slot.
+ *
+ * \note when you read from an element slot array or mapping, you can either tool-flag
+ * all the elements in it, or read them using an iterator API (which is semantically
+ * similar to the iterator api in bmesh_iterators.h).
+ *
+ * \note only #BMLoop items can't be put into slots as with verts, edges & faces.
+ */
+
+struct GHashIterator;
+
+#define BMO_elem_flag_test(     bm, ele, oflag)      _bmo_elem_flag_test     (bm, (ele)->oflags, oflag)
+#define BMO_elem_flag_test_bool(bm, ele, oflag)      _bmo_elem_flag_test_bool(bm, (ele)->oflags, oflag)
+#define BMO_elem_flag_enable(   bm, ele, oflag)      _bmo_elem_flag_enable   (bm, (ele)->oflags, oflag)
+#define BMO_elem_flag_disable(  bm, ele, oflag)      _bmo_elem_flag_disable  (bm, (ele)->oflags, oflag)
+#define BMO_elem_flag_set(      bm, ele, oflag, val) _bmo_elem_flag_set      (bm, (ele)->oflags, oflag, val)
+#define BMO_elem_flag_toggle(   bm, ele, oflag)      _bmo_elem_flag_toggle   (bm, (ele)->oflags, oflag)
+
+BLI_INLINE short _bmo_elem_flag_test(     BMesh *bm, BMFlagLayer *oflags, const short oflag);
+BLI_INLINE short _bmo_elem_flag_test_bool(BMesh *bm, BMFlagLayer *oflags, const short oflag);
+BLI_INLINE void  _bmo_elem_flag_enable(   BMesh *bm, BMFlagLayer *oflags, const short oflag);
+BLI_INLINE void  _bmo_elem_flag_disable(  BMesh *bm, BMFlagLayer *oflags, const short oflag);
+BLI_INLINE void  _bmo_elem_flag_set(      BMesh *bm, BMFlagLayer *oflags, const short oflag, int val);
+BLI_INLINE void  _bmo_elem_flag_toggle(   BMesh *bm, BMFlagLayer *oflags, const short oflag);
+
+/* slot type arrays are terminated by the last member
+ * having a slot type of 0 */
+enum {
+	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_PNT = 4,
+	BMO_OP_SLOT_MAT = 5,
+	BMO_OP_SLOT_VEC = 8,
+
+	/* after BMO_OP_SLOT_VEC, everything is dynamically allocated arrays.
+	 * We leave a space in the identifiers for future growth.
+	 *
+	 * 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 */
+};
+#define BMO_OP_SLOT_TOTAL_TYPES 11
+
+/* 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 slottype;
+	int len;
+	int flag;
+	int index; /* index within slot array */
+	union {
+		int i;
+		float f;
+		void *p;
+		float vec[3];
+		void *buf;
+		GHash *ghash;
+	} data;
+} BMOpSlot;
+
+#define BMO_OP_MAX_SLOTS 16 /* way more than probably needed */
+
+#ifdef slots
+#undef slots
+#endif
+
+typedef struct BMOperator {
+	int type;
+	int slottype;
+	int needflag;
+	int flag;
+	struct BMOpSlot slots[BMO_OP_MAX_SLOTS]; void (*exec)(BMesh *bm, struct BMOperator *op);
+	struct MemArena *arena;
+} BMOperator;
+
+#define MAX_SLOTNAME	32
+
+typedef struct BMOSlotType {
+	int type;
+	char name[MAX_SLOTNAME];
+} BMOSlotType;
+
+typedef struct BMOpDefine {
+	const char *name;
+	BMOSlotType slottypes[BMO_OP_MAX_SLOTS];
+	void (*exec)(BMesh *bm, BMOperator *op);
+	int flag;
+} BMOpDefine;
+
+/* BMOpDefine->flag */
+#define BMO_OP_FLAG_UNTAN_MULTIRES		1 /*switch from multires tangent space to absolute coordinates*/
+
+/* ensures consistent normals before operator execution,
+ * restoring the original ones windings/normals afterwards.
+ * keep in mind, this won't work if the input mesh isn't
+ * manifold.*/
+#define BMO_OP_FLAG_RATIONALIZE_NORMALS 2
+
+/*------------- Operator API --------------*/
+
+/* data types that use pointers (arrays, etc) should never
+ * have it set directly.  and never use BMO_slot_ptr_set to
+ * pass in a list of edges or any arrays, really.*/
+
+void BMO_op_init(BMesh *bm, BMOperator *op, const char *opname);
+
+/* executes an operator, pushing and popping a new tool flag
+ * layer as appropriate.*/
+void BMO_op_exec(BMesh *bm, BMOperator *op);
+
+/* finishes an operator (though note the operator's tool flag is removed
+ * after it finishes executing in BMO_op_exec).*/
+void BMO_op_finish(BMesh *bm, BMOperator *op);
+
+/* count the number of elements with the specified flag enabled.
+ * type can be a bitmask of BM_FACE, BM_EDGE, or BM_FACE. */
+int BMO_mesh_enabled_flag_count(BMesh *bm, const char htype, const short oflag);
+
+/* count the number of elements with the specified flag disabled.
+ * type can be a bitmask of BM_FACE, BM_EDGE, or BM_FACE. */
+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, "del 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] [slotname]=%[code] [slotname]=%[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);
+
+/*executes an operator*/
+int BMO_op_callf(BMesh *bm, const char *fmt, ...);
+
+/* initializes, but doesn't execute an operator.  this is so you can
+ * gain access to the outputs of the operator.  note that you have
+ * to execute/finitsh (BMO_op_exec and BMO_op_finish) yourself. */
+int BMO_op_initf(BMesh *bm, BMOperator *op, const char *fmt, ...);
+
+/* va_list version, used to implement the above two functions,
+ * plus EDBM_op_callf in editmesh_utils.c. */
+int BMO_op_vinitf(BMesh *bm, BMOperator *op, const char *fmt, va_list vlist);
+
+/* test whether a named slot exists */
+int BMO_slot_exists(BMOperator *op, const char *slotname);
+
+/* get a pointer to a slot.  this may be removed layer on from the public API. */
+BMOpSlot *BMO_slot_get(BMOperator *op, const char *slotname);
+
+/* 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);
+
+/* del "context" slot values, used for operator too */
+enum {
+	DEL_VERTS = 1,
+	DEL_EDGES,
+	DEL_ONLYFACES,
+	DEL_EDGESFACES,
+	DEL_FACES,
+	DEL_ALL,
+	DEL_ONLYTAGGED
+};
+
+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 *slotname, const float f);
+float BMO_slot_float_get(BMOperator *op, const char *slotname);
+void  BMO_slot_int_set(BMOperator *op, const char *slotname, const int i);
+int   BMO_slot_int_get(BMOperator *op, const char *slotname);
+void  BMO_slot_bool_set(BMOperator *op, const char *slotname, const int i);
+int   BMO_slot_bool_get(BMOperator *op, const char *slotname);
+
+/* 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 *slotname, void *p);
+void *BMO_slot_ptr_get(BMOperator *op, const char *slotname);
+void  BMO_slot_vec_set(BMOperator *op, const char *slotname, const float vec[3]);
+void  BMO_slot_vec_get(BMOperator *op, const char *slotname, 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_Mat* function you want. */
+void BMO_slot_mat_set(BMOperator *op, const char *slotname, const float *mat, int size);
+void BMO_slot_mat4_get(BMOperator *op, const char *slotname, float r_mat[4][4]);
+void BMO_slot_mat3_set(BMOperator *op, const char *slotname, 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);
+
+/* 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 *slotname,
+                                       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 *slotname,
+                                        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 *slotname,
+                                 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 *slotname,
+                                  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 *slotname,
+                                  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 *slotname,
+                                   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 *slotname,
+                                        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 *slotname,
+                                         const char htype, const char hflag);
+
+/* counts number of elements inside a slot array. */
+int BMO_slot_buffer_count(BMesh *bm, BMOperator *op, const char *slotname);
+int BMO_slot_map_count(BMesh *bm, BMOperator *op, const char *slotname);
+
+void BMO_slot_map_insert(BMesh *UNUSED(bm), BMOperator *op, const char *slotname,
+                         void *element, void *data, int len);
+
+/* Counts the number of edges with tool flag toolflag around
+ */
+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 *slotname,
+                          const char hflag, const short oflag);
+
+/* 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:
+ *
+ *    BMOIter oiter;
+ *    BMFace *f;
+ *
+ *    f = BMO_iter_new(&oiter, bm, some_operator, "slotname", BM_FACE);
+ *    for (; f; f = BMO_iter_step(&oiter)) {
+ *        /do something with the face
+ *    }
+ *
+ * another example, iterating over a mapping:
+ *    BMOIter oiter;
+ *    void *key;
+ *    void *val;
+ *
+ *    key = BMO_iter_new(&oiter, bm, some_operator, "slotname", 0);
+ *    for (; key; key = BMO_iter_step(&oiter)) {
+ *        val = BMO_iter_map_value(&oiter);
+ *        //do something with the key/val pair
+ *        //note that val is a pointer to the val data,
+ *        //whether it's a float, pointer, whatever.
+ *        //
+ *        // so to get a pointer, for example, use:
+ *        //  *((void**)BMO_iter_map_value(&oiter));
+ *        //or something like that.
+ *    }
+ */
+
+/* contents of this structure are private,
+ * don't directly access. */
+typedef struct BMOIter {
+	BMOpSlot *slot;
+	int cur; //for arrays
+	GHashIterator giter;
+	void *val;
+	char restrictmask; /* bitwise '&' with BMHeader.htype */
+} BMOIter;
+
+void *BMO_slot_buffer_elem_first(BMOperator *op, const char *slotname);
+
+void *BMO_iter_new(BMOIter *iter, BMesh *bm, BMOperator *op,
+                   const char *slotname, const char restrictmask);
+void *BMO_iter_step(BMOIter *iter);
+
+/* returns a pointer to the key value when iterating over mappings.
+ * remember for pointer maps this will be a pointer to a pointer.*/
+void *BMO_iter_map_value(BMOIter *iter);
+
+/* use this for pointer mappings */
+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, slotname, restrict)   \
+	for (ele = BMO_iter_new(iter, bm, op, slotname, restrict); ele; ele = BMO_iter_step(iter))
+
+/******************* Inlined Functions********************/
+typedef void (*opexec)(BMesh *bm, BMOperator *op);
+
+/* mappings map elements to data, which
+ * follows the mapping struct in memory. */
+typedef struct BMOElemMapping {
+	BMHeader *element;
+	int len;
+} BMOElemMapping;
+
+extern const int BMO_OPSLOT_TYPEINFO[BMO_OP_SLOT_TOTAL_TYPES];
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __BMESH_OPERATOR_API_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_operator_api_inline.h b/source/blender/bmesh/intern/bmesh_operator_api_inline.h
new file mode 100644
index 0000000..e04079f
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_operator_api_inline.h
@@ -0,0 +1,151 @@
+/*
+ * ***** 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, Geoffrey Bantle, Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/intern/bmesh_operator_api_inline.h
+ *  \ingroup bmesh
+ *
+ * BMesh inline operator functions.
+ */
+
+#ifndef __BMESH_OPERATOR_API_INLINE_H__
+#define __BMESH_OPERATOR_API_INLINE_H__
+
+/* tool flag API. never, ever ever should tool code put junk in
+ * header flags (element->head.flag), nor should they use
+ * element->head.eflag1/eflag2.  instead, use this api to set
+ * flags.
+ *
+ * if you need to store a value per element, use a
+ * ghash or a mapping slot to do it. */
+
+/* flags 15 and 16 (1 << 14 and 1 << 15) are reserved for bmesh api use */
+BLI_INLINE short _bmo_elem_flag_test(BMesh *bm, BMFlagLayer *oflags, const short oflag)
+{
+	return oflags[bm->stackdepth - 1].f & oflag;
+}
+
+BLI_INLINE short _bmo_elem_flag_test_bool(BMesh *bm, BMFlagLayer *oflags, const short oflag)
+{
+	return (oflags[bm->stackdepth - 1].f & oflag) != 0;
+}
+
+BLI_INLINE void _bmo_elem_flag_enable(BMesh *bm, BMFlagLayer *oflags, const short oflag)
+{
+	oflags[bm->stackdepth - 1].f |= oflag;
+}
+
+BLI_INLINE void _bmo_elem_flag_disable(BMesh *bm, BMFlagLayer *oflags, const short oflag)
+{
+	oflags[bm->stackdepth - 1].f &= ~oflag;
+}
+
+BLI_INLINE void _bmo_elem_flag_set(BMesh *bm, BMFlagLayer *oflags, const short oflag, int val)
+{
+	if (val) oflags[bm->stackdepth - 1].f |= oflag;
+	else     oflags[bm->stackdepth - 1].f &= ~oflag;
+}
+
+BLI_INLINE void _bmo_elem_flag_toggle(BMesh *bm, BMFlagLayer *oflags, const short oflag)
+{
+	oflags[bm->stackdepth - 1].f ^= oflag;
+}
+
+BLI_INLINE void BMO_slot_map_int_insert(BMesh *bm, BMOperator *op, const char *slotname,
+                                        void *element, int val)
+{
+	BMO_slot_map_insert(bm, op, slotname, element, &val, sizeof(int));
+}
+
+BLI_INLINE void BMO_slot_map_float_insert(BMesh *bm, BMOperator *op, const char *slotname,
+                                          void *element, float val)
+{
+	BMO_slot_map_insert(bm, op, slotname, element, &val, sizeof(float));
+}
+
+
+/* pointer versions of BMO_slot_map_float_get and BMO_slot_map_float_insert.
+ *
+ * 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 *slotname,
+                                        void *element, void *val)
+{
+	BMO_slot_map_insert(bm, op, slotname, element, &val, sizeof(void *));
+}
+
+BLI_INLINE int BMO_slot_map_contains(BMesh *UNUSED(bm), BMOperator *op, const char *slotname, void *element)
+{
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	BLI_assert(slot->slottype == BMO_OP_SLOT_MAPPING);
+
+	/* sanity check */
+	if (!slot->data.ghash) 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 *slotname,
+                                       void *element)
+{
+	BMOElemMapping *mapping;
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	BLI_assert(slot->slottype == BMO_OP_SLOT_MAPPING);
+
+	/* sanity check */
+	if (!slot->data.ghash) return NULL;
+
+	mapping = (BMOElemMapping *)BLI_ghash_lookup(slot->data.ghash, element);
+
+	if (!mapping) return NULL;
+
+	return mapping + 1;
+}
+
+BLI_INLINE float BMO_slot_map_float_get(BMesh *bm, BMOperator *op, const char *slotname,
+                                        void *element)
+{
+	float *val = (float *) BMO_slot_map_data_get(bm, op, slotname, element);
+	if (val) return *val;
+
+	return 0.0f;
+}
+
+BLI_INLINE int BMO_slot_map_int_get(BMesh *bm, BMOperator *op, const char *slotname,
+                                    void *element)
+{
+	int *val = (int *) BMO_slot_map_data_get(bm, op, slotname, element);
+	if (val) return *val;
+
+	return 0;
+}
+
+BLI_INLINE void *BMO_slot_map_ptr_get(BMesh *bm, BMOperator *op, const char *slotname,
+                                      void *element)
+{
+	void **val = (void **) BMO_slot_map_data_get(bm, op, slotname, element);
+	if (val) return *val;
+
+	return NULL;
+}
+
+#endif /* __BMESH_OPERATOR_API_INLINE_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c
new file mode 100644
index 0000000..dce491e
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_operators.c
@@ -0,0 +1,1588 @@
+/*
+ * ***** 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, Geoffrey Bantle, Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/intern/bmesh_operators.c
+ *  \ingroup bmesh
+ *
+ * BMesh operator access.
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_utildefines.h"
+#include "BLI_string.h"
+#include "BLI_math.h"
+#include "BLI_memarena.h"
+#include "BLI_mempool.h"
+#include "BLI_listbase.h"
+#include "BLI_array.h"
+
+#include "bmesh.h"
+#include "intern/bmesh_private.h"
+
+/* forward declarations */
+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_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",
+};
+
+
+/* operator slot type information - size of one element of the type given. */
+const int BMO_OPSLOT_TYPEINFO[BMO_OP_SLOT_TOTAL_TYPES] = {
+	0,                      /*  0: BMO_OP_SLOT_SENTINEL */
+	sizeof(int),            /*  1: BMO_OP_SLOT_BOOL */ 
+	sizeof(int),            /*  2: BMO_OP_SLOT_INT */ 
+	sizeof(float),          /*  3: BMO_OP_SLOT_FLT */ 
+	sizeof(void *),         /*  4: BMO_OP_SLOT_PNT */ 
+	sizeof(void *),         /*  5: BMO_OP_SLOT_PNT */
+	0,                      /*  6: unused */
+	0,                      /*  7: unused */
+	sizeof(float) * 3,      /*  8: BMO_OP_SLOT_VEC */
+	sizeof(void *),	        /*  9: BMO_OP_SLOT_ELEMENT_BUF */
+	sizeof(BMOElemMapping)  /* 10: BMO_OP_SLOT_MAPPING */
+};
+
+/* Dummy slot so there is something to return when slot name lookup fails */
+static BMOpSlot BMOpEmptySlot = {0};
+
+void BMO_op_flag_enable(BMesh *UNUSED(bm), BMOperator *op, const int op_flag)
+{
+	op->flag |= op_flag;
+}
+
+void BMO_op_flag_disable(BMesh *UNUSED(bm), BMOperator *op, const int op_flag)
+{
+	op->flag &= ~op_flag;
+}
+
+/**
+ * \brief BMESH OPSTACK PUSH
+ *
+ * Pushes the opstack down one level and allocates a new flag layer if appropriate.
+ */
+void BMO_push(BMesh *bm, BMOperator *UNUSED(op))
+{
+	bm->stackdepth++;
+
+	/* add flag layer, if appropriate */
+	if (bm->stackdepth > 1)
+		bmo_flag_layer_alloc(bm);
+	else
+		bmo_flag_layer_clear(bm);
+}
+
+/**
+ * \brief BMESH OPSTACK POP
+ *
+ * Pops the opstack one level and frees a flag layer if appropriate
+ *
+ * BMESH_TODO: investigate NOT freeing flag layers.
+ */
+void BMO_pop(BMesh *bm)
+{
+	if (bm->stackdepth > 1)
+		bmo_flag_layer_free(bm);
+
+	bm->stackdepth--;
+}
+
+/**
+ * \brief BMESH OPSTACK INIT OP
+ *
+ * Initializes an operator structure to a certain type
+ */
+void BMO_op_init(BMesh *bm, BMOperator *op, const char *opname)
+{
+	int i, opcode = bmo_opname_to_opcode(opname);
+
+#ifdef DEBUG
+	BM_ELEM_INDEX_VALIDATE(bm, "pre bmo", opname);
+#else
+	(void)bm;
+#endif
+
+	if (opcode == -1) {
+		opcode = 0; /* error!, already printed, have a better way to handle this? */
+	}
+
+	memset(op, 0, sizeof(BMOperator));
+	op->type = opcode;
+	op->flag = opdefines[opcode]->flag;
+	
+	/* initialize the operator slot types */
+	for (i = 0; opdefines[opcode]->slottypes[i].type; i++) {
+		op->slots[i].slottype = opdefines[opcode]->slottypes[i].type;
+		op->slots[i].index = i;
+	}
+
+	/* callback */
+	op->exec = opdefines[opcode]->exec;
+
+	/* memarena, used for operator's slot buffers */
+	op->arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__);
+	BLI_memarena_use_calloc(op->arena);
+}
+
+/**
+ * \brief BMESH OPSTACK EXEC OP
+ *
+ * Executes a passed in operator.
+ *
+ * This handles the allocation and freeing of temporary flag
+ * layers and starting/stopping the modeling loop.
+ * Can be called from other operators exec callbacks as well.
+ */
+void BMO_op_exec(BMesh *bm, BMOperator *op)
+{
+	
+	BMO_push(bm, op);
+
+	if (bm->stackdepth == 2)
+		bmesh_edit_begin(bm, op->flag);
+	op->exec(bm, op);
+	
+	if (bm->stackdepth == 2)
+		bmesh_edit_end(bm, op->flag);
+	
+	BMO_pop(bm);
+}
+
+/**
+ * \brief BMESH OPSTACK FINISH OP
+ *
+ * Does housekeeping chores related to finishing up an operator.
+ */
+void BMO_op_finish(BMesh *bm, BMOperator *op)
+{
+	BMOpSlot *slot;
+	int i;
+
+	for (i = 0; opdefines[op->type]->slottypes[i].type; i++) {
+		slot = &op->slots[i];
+		if (slot->slottype == BMO_OP_SLOT_MAPPING) {
+			if (slot->data.ghash)
+				BLI_ghash_free(slot->data.ghash, NULL, NULL);
+		}
+	}
+
+	BLI_memarena_free(op->arena);
+
+#ifdef DEBUG
+	BM_ELEM_INDEX_VALIDATE(bm, "post bmo", opdefines[op->type]->name);
+#else
+	(void)bm;
+#endif
+}
+
+/**
+ * \brief BMESH OPSTACK HAS SLOT
+ *
+ * \return Success if the slot if found.
+ */
+int BMO_slot_exists(BMOperator *op, const char *slotname)
+{
+	int slotcode = bmo_name_to_slotcode(opdefines[op->type], slotname);
+	return (slotcode >= 0);
+}
+
+/**
+ * \brief BMESH OPSTACK GET SLOT
+ *
+ * Returns a pointer to the slot of type 'slotcode'
+ */
+BMOpSlot *BMO_slot_get(BMOperator *op, const char *slotname)
+{
+	int slotcode = bmo_name_to_slotcode_check(opdefines[op->type], slotname);
+
+	if (slotcode < 0) {
+		return &BMOpEmptySlot;
+	}
+
+	return &(op->slots[slotcode]);
+}
+
+/**
+ * \brief BMESH OPSTACK COPY SLOT
+ *
+ * Copies data from one slot to another.
+ */
+void BMO_slot_copy(BMOperator *source_op, BMOperator *dest_op, const char *src, const char *dst)
+{
+	BMOpSlot *source_slot = BMO_slot_get(source_op, src);
+	BMOpSlot *dest_slot = BMO_slot_get(dest_op, dst);
+
+	if (source_slot == dest_slot)
+		return;
+
+	if (source_slot->slottype != dest_slot->slottype) {
+		/* possibly assert here? */
+		return;
+	}
+
+	if (dest_slot->slottype  == 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->slottype] * 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);
+		}
+	}
+	else if (dest_slot->slottype  == BMO_OP_SLOT_MAPPING) {
+		GHashIterator it;
+		BMOElemMapping *srcmap, *dstmap;
+
+		/* sanity check */
+		if (!source_slot->data.ghash) {
+			return;
+		}
+
+		if (!dest_slot->data.ghash) {
+			dest_slot->data.ghash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh operator 2");
+		}
+
+		BLI_ghashIterator_init(&it, source_slot->data.ghash);
+		for ( ; (srcmap = BLI_ghashIterator_getValue(&it));
+			  BLI_ghashIterator_step(&it))
+		{
+			dstmap = BLI_memarena_alloc(dest_op->arena, sizeof(*dstmap) + srcmap->len);
+
+			dstmap->element = srcmap->element;
+			dstmap->len = srcmap->len;
+			memcpy(dstmap + 1, srcmap + 1, srcmap->len);
+
+			BLI_ghash_insert(dest_slot->data.ghash, dstmap->element, dstmap);
+		}
+	}
+	else {
+		dest_slot->data = source_slot->data;
+	}
+}
+
+/*
+ * BMESH OPSTACK SET XXX
+ *
+ * Sets the value of a slot depending on it's type
+ */
+
+void BMO_slot_float_set(BMOperator *op, const char *slotname, const float f)
+{
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	BLI_assert(slot->slottype == BMO_OP_SLOT_FLT);
+	if (!(slot->slottype == BMO_OP_SLOT_FLT))
+		return;
+
+	slot->data.f = f;
+}
+
+void BMO_slot_int_set(BMOperator *op, const char *slotname, const int i)
+{
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	BLI_assert(slot->slottype == BMO_OP_SLOT_INT);
+	if (!(slot->slottype == BMO_OP_SLOT_INT))
+		return;
+
+	slot->data.i = i;
+}
+
+void BMO_slot_bool_set(BMOperator *op, const char *slotname, const int i)
+{
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	BLI_assert(slot->slottype == BMO_OP_SLOT_BOOL);
+	if (!(slot->slottype == BMO_OP_SLOT_BOOL))
+		return;
+
+	slot->data.i = i;
+}
+
+/* only supports square mats */
+void BMO_slot_mat_set(BMOperator *op, const char *slotname, const float *mat, int size)
+{
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	BLI_assert(slot->slottype == BMO_OP_SLOT_MAT);
+	if (!(slot->slottype == BMO_OP_SLOT_MAT))
+		return;
+
+	slot->len = 4;
+	slot->data.p = BLI_memarena_alloc(op->arena, sizeof(float) * 4 * 4);
+	
+	if (size == 4) {
+		memcpy(slot->data.p, mat, sizeof(float) * 4 * 4);
+	}
+	else if (size == 3) {
+		copy_m4_m3(slot->data.p, (float (*)[3])mat);
+	}
+	else {
+		fprintf(stderr, "%s: invalid size argument %d (bmesh internal error)\n", __func__, size);
+
+		memset(slot->data.p, 0, sizeof(float) * 4 * 4);
+	}
+}
+
+void BMO_slot_mat4_get(BMOperator *op, const char *slotname, float r_mat[4][4])
+{
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	BLI_assert(slot->slottype == BMO_OP_SLOT_MAT);
+	if (!(slot->slottype == BMO_OP_SLOT_MAT))
+		return;
+
+	copy_m4_m4(r_mat, (float (*)[4])slot->data.p);
+}
+
+void BMO_slot_mat3_set(BMOperator *op, const char *slotname, float r_mat[3][3])
+{
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	BLI_assert(slot->slottype == BMO_OP_SLOT_MAT);
+	if (!(slot->slottype == BMO_OP_SLOT_MAT))
+		return;
+
+	copy_m3_m4(r_mat, slot->data.p);
+}
+
+void BMO_slot_ptr_set(BMOperator *op, const char *slotname, void *p)
+{
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	BLI_assert(slot->slottype == BMO_OP_SLOT_PNT);
+	if (!(slot->slottype == BMO_OP_SLOT_PNT))
+		return;
+
+	slot->data.p = p;
+}
+
+void BMO_slot_vec_set(BMOperator *op, const char *slotname, const float vec[3])
+{
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	BLI_assert(slot->slottype == BMO_OP_SLOT_VEC);
+	if (!(slot->slottype == BMO_OP_SLOT_VEC))
+		return;
+
+	copy_v3_v3(slot->data.vec, vec);
+}
+
+
+float BMO_slot_float_get(BMOperator *op, const char *slotname)
+{
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	BLI_assert(slot->slottype == BMO_OP_SLOT_FLT);
+	if (!(slot->slottype == BMO_OP_SLOT_FLT))
+		return 0.0f;
+
+	return slot->data.f;
+}
+
+int BMO_slot_int_get(BMOperator *op, const char *slotname)
+{
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	BLI_assert(slot->slottype == BMO_OP_SLOT_INT);
+	if (!(slot->slottype == BMO_OP_SLOT_INT))
+		return 0;
+
+	return slot->data.i;
+}
+
+int BMO_slot_bool_get(BMOperator *op, const char *slotname)
+{
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	BLI_assert(slot->slottype == BMO_OP_SLOT_BOOL);
+	if (!(slot->slottype == BMO_OP_SLOT_BOOL))
+		return 0;
+
+	return slot->data.i;
+}
+
+
+void *BMO_slot_ptr_get(BMOperator *op, const char *slotname)
+{
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	BLI_assert(slot->slottype == BMO_OP_SLOT_PNT);
+	if (!(slot->slottype == BMO_OP_SLOT_PNT))
+		return NULL;
+
+	return slot->data.p;
+}
+
+void BMO_slot_vec_get(BMOperator *op, const char *slotname, float r_vec[3])
+{
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	BLI_assert(slot->slottype == BMO_OP_SLOT_VEC);
+	if (!(slot->slottype == BMO_OP_SLOT_VEC))
+		return;
+
+	copy_v3_v3(r_vec, slot->data.vec);
+}
+
+/*
+ * BMO_COUNTFLAG
+ *
+ * Counts the number of elements of a certain type that have a
+ * specific flag enabled (or disabled if test_for_enabled is false).
+ *
+ */
+
+static int bmo_mesh_flag_count(BMesh *bm, const char htype, const short oflag,
+                               const short test_for_enabled)
+{
+	const char iter_types[3] = {BM_VERTS_OF_MESH,
+	                            BM_EDGES_OF_MESH,
+	                            BM_FACES_OF_MESH};
+
+	const char flag_types[3] = {BM_VERT, BM_EDGE, BM_FACE};
+
+	BMIter iter;
+	int count = 0;
+	BMElemF *ele_f;
+	int i;
+
+	BLI_assert(ELEM(TRUE, FALSE, test_for_enabled));
+
+	for (i = 0; i < 3; i++) {
+		if (htype & flag_types[i]) {
+			BM_ITER_MESH (ele_f, &iter, bm, iter_types[i]) {
+				if (BMO_elem_flag_test_bool(bm, ele_f, oflag) == test_for_enabled)
+					count++;
+			}
+		}
+	}
+
+	return count;
+}
+
+
+int BMO_mesh_enabled_flag_count(BMesh *bm, const char htype, const short oflag)
+{
+	return bmo_mesh_flag_count(bm, htype, oflag, TRUE);
+}
+
+int BMO_mesh_disabled_flag_count(BMesh *bm, const char htype, const short oflag)
+{
+	return bmo_mesh_flag_count(bm, htype, oflag, FALSE);
+}
+
+void BMO_mesh_flag_disable_all(BMesh *bm, BMOperator *UNUSED(op), const char htype, const short oflag)
+{
+	const char iter_types[3] = {BM_VERTS_OF_MESH,
+	                            BM_EDGES_OF_MESH,
+	                            BM_FACES_OF_MESH};
+
+	const char flag_types[3] = {BM_VERT, BM_EDGE, BM_FACE};
+
+	BMIter iter;
+	BMElemF *ele;
+	int i;
+
+	for (i = 0; i < 3; i++) {
+		if (htype & flag_types[i]) {
+			BM_ITER_MESH (ele, &iter, bm, iter_types[i]) {
+				BMO_elem_flag_disable(bm, ele, oflag);
+			}
+		}
+	}
+}
+
+int BMO_slot_buffer_count(BMesh *UNUSED(bm), BMOperator *op, const char *slotname)
+{
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	BLI_assert(slot->slottype == BMO_OP_SLOT_ELEMENT_BUF);
+	
+	/* check if its actually a buffer */
+	if (slot->slottype != BMO_OP_SLOT_ELEMENT_BUF)
+		return 0;
+
+	return slot->len;
+}
+
+int BMO_slot_map_count(BMesh *UNUSED(bm), BMOperator *op, const char *slotname)
+{
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	BLI_assert(slot->slottype == BMO_OP_SLOT_MAPPING);
+	
+	/* check if its actually a buffer */
+	if (!(slot->slottype == BMO_OP_SLOT_MAPPING))
+		return 0;
+
+	return slot->data.ghash ? BLI_ghash_size(slot->data.ghash) : 0;
+}
+
+/* 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 *slotname,
+                         void *element, void *data, int len)
+{
+	BMOElemMapping *mapping;
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	BLI_assert(slot->slottype == BMO_OP_SLOT_MAPPING);
+
+	mapping = (BMOElemMapping *) BLI_memarena_alloc(op->arena, sizeof(*mapping) + len);
+
+	mapping->element = (BMHeader *) element;
+	mapping->len = len;
+	memcpy(mapping + 1, data, len);
+
+	if (!slot->data.ghash) {
+		slot->data.ghash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh slot map hash");
+	}
+
+	BLI_ghash_insert(slot->data.ghash, element, mapping);
+}
+
+#if 0
+void *bmo_slot_buffer_grow(BMesh *bm, BMOperator *op, int slotcode, int totadd)
+{
+	BMOpSlot *slot = &op->slots[slotcode];
+	void *tmp;
+	ssize_t allocsize;
+	
+	BLI_assert(slot->slottype == BMO_OP_SLOT_ELEMENT_BUF);
+
+	/* check if its actually a buffer */
+	if (slot->slottype != BMO_OP_SLOT_ELEMENT_BUF)
+		return NULL;
+
+	if (slot->flag & BMOS_DYNAMIC_ARRAY) {
+		if (slot->len >= slot->size) {
+			slot->size = (slot->size + 1 + totadd) * 2;
+
+			allocsize = BMO_OPSLOT_TYPEINFO[opdefines[op->type]->slottypes[slotcode].type] * slot->size;
+
+			tmp = slot->data.buf;
+			slot->data.buf = MEM_callocN(allocsize, "opslot dynamic array");
+			memcpy(slot->data.buf, tmp, allocsize);
+			MEM_freeN(tmp);
+		}
+
+		slot->len += totadd;
+	}
+	else {
+		slot->flag |= BMOS_DYNAMIC_ARRAY;
+		slot->len += totadd;
+		slot->size = slot->len + 2;
+
+		allocsize = BMO_OPSLOT_TYPEINFO[opdefines[op->type]->slottypes[slotcode].type] * slot->len;
+
+		tmp = slot->data.buf;
+		slot->data.buf = MEM_callocN(allocsize, "opslot dynamic array");
+		memcpy(slot->data.buf, tmp, allocsize);
+	}
+
+	return slot->data.buf;
+}
+#endif
+
+void BMO_slot_map_to_flag(BMesh *bm, BMOperator *op, const char *slotname,
+                          const char htype, const short oflag)
+{
+	GHashIterator it;
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	BMElemF *ele_f;
+
+	BLI_assert(slot->slottype == BMO_OP_SLOT_MAPPING);
+
+	/* sanity check */
+	if (!slot->data.ghash) return;
+
+	BLI_ghashIterator_init(&it, slot->data.ghash);
+	for ( ; (ele_f = BLI_ghashIterator_getKey(&it)); BLI_ghashIterator_step(&it)) {
+		if (ele_f->head.htype & htype) {
+			BMO_elem_flag_enable(bm, ele_f, oflag);
+		}
+	}
+}
+
+static void *bmo_slot_buffer_alloc(BMOperator *op, const char *slotname, int len)
+{
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	BLI_assert(slot->slottype == BMO_OP_SLOT_ELEMENT_BUF);
+
+	/* check if its actually a buffer */
+	if (slot->slottype != BMO_OP_SLOT_ELEMENT_BUF)
+		return NULL;
+	
+	slot->len = len;
+	if (len)
+		slot->data.buf = BLI_memarena_alloc(op->arena, BMO_OPSLOT_TYPEINFO[slot->slottype] * len);
+	return slot->data.buf;
+}
+
+/**
+ * \brief BMO_ALL_TO_SLOT
+ *
+ * Copies all elements of a certain type into an operator slot.
+ */
+static void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, const char *slotname, const char htype)
+{
+	BMOpSlot *output = BMO_slot_get(op, slotname);
+	int totelement = 0, i = 0;
+	
+	if (htype & BM_VERT) totelement += bm->totvert;
+	if (htype & BM_EDGE) totelement += bm->totedge;
+	if (htype & BM_FACE) totelement += bm->totface;
+
+	if (totelement) {
+		BMIter iter;
+		BMHeader *ele;
+
+		bmo_slot_buffer_alloc(op, slotname, 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;
+				i++;
+			}
+		}
+
+		if (htype & BM_EDGE) {
+			BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) {
+				((BMHeader **)output->data.p)[i] = ele;
+				i++;
+			}
+		}
+
+		if (htype & BM_FACE) {
+			BM_ITER_MESH (ele, &iter, bm, BM_FACES_OF_MESH) {
+				((BMHeader **)output->data.p)[i] = ele;
+				i++;
+			}
+		}
+	}
+}
+
+/**
+ * \brief BMO_HEADERFLAG_TO_SLOT
+ *
+ * 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 *slotname,
+                                       const char htype, const char hflag,
+                                       const short test_for_enabled)
+{
+	BMOpSlot *output = BMO_slot_get(op, slotname);
+	int totelement = 0, i = 0;
+
+	BLI_assert(ELEM(TRUE, FALSE, test_for_enabled));
+
+	if (test_for_enabled)
+		totelement = BM_mesh_elem_hflag_count_enabled(bm, htype, hflag, TRUE);
+	else
+		totelement = BM_mesh_elem_hflag_count_disabled(bm, htype, hflag, TRUE);
+
+	if (totelement) {
+		BMIter iter;
+		BMElem *ele;
+
+		bmo_slot_buffer_alloc(op, slotname, totelement);
+
+		/* TODO - collapse these loops into one */
+
+		if (htype & BM_VERT) {
+			BM_ITER_MESH (ele, &iter, bm, BM_VERTS_OF_MESH) {
+				if (!BM_elem_flag_test(ele, BM_ELEM_HIDDEN) &&
+				    BM_elem_flag_test_bool(ele, hflag) == test_for_enabled)
+				{
+					((BMElem **)output->data.p)[i] = ele;
+					i++;
+				}
+			}
+		}
+
+		if (htype & BM_EDGE) {
+			BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) {
+				if (!BM_elem_flag_test(ele, BM_ELEM_HIDDEN) &&
+				    BM_elem_flag_test_bool(ele, hflag) == test_for_enabled)
+				{
+					((BMElem **)output->data.p)[i] = ele;
+					i++;
+				}
+			}
+		}
+
+		if (htype & BM_FACE) {
+			BM_ITER_MESH (ele, &iter, bm, BM_FACES_OF_MESH) {
+				if (!BM_elem_flag_test(ele, BM_ELEM_HIDDEN) &&
+				    BM_elem_flag_test_bool(ele, hflag) == test_for_enabled)
+				{
+					((BMElem **)output->data.p)[i] = ele;
+					i++;
+				}
+			}
+		}
+	}
+	else {
+		output->len = 0;
+	}
+}
+
+void BMO_slot_buffer_from_enabled_hflag(BMesh *bm, BMOperator *op, const char *slotname,
+                                        const char htype, const char hflag)
+{
+	bmo_slot_buffer_from_hflag(bm, op, slotname, htype, hflag, TRUE);
+}
+
+void BMO_slot_buffer_from_disabled_hflag(BMesh *bm, BMOperator *op, const char *slotname,
+                                         const char htype, const char hflag)
+{
+	bmo_slot_buffer_from_hflag(bm, op, slotname, htype, hflag, FALSE);
+}
+
+/**
+ * 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)
+{
+	BMOpSlot *output_slot = BMO_slot_get(output_op, output_slot_name);
+	BMOpSlot *other_slot = BMO_slot_get(other_op, other_slot_name);
+
+	BLI_assert(output_slot->slottype == BMO_OP_SLOT_ELEMENT_BUF &&
+	           other_slot->slottype == BMO_OP_SLOT_ELEMENT_BUF);
+
+	if (output_slot->len == 0) {
+		/* output slot is empty, copy rather than append */
+		BMO_slot_copy(other_op, output_op, other_slot_name, output_slot_name);
+	}
+	else if (other_slot->len != 0) {
+		int elem_size = BMO_OPSLOT_TYPEINFO[output_slot->slottype];
+		int alloc_size = elem_size * (output_slot->len + other_slot->len);
+		/* allocate new buffer */
+		void *buf = BLI_memarena_alloc(output_op->arena, 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);
+
+		output_slot->data.buf = buf;
+		output_slot->len += other_slot->len;
+	}
+}
+
+/**
+ * \brief BMO_FLAG_TO_SLOT
+ *
+ * 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 *slotname,
+                                      const char htype, const short oflag,
+                                      const short test_for_enabled)
+{
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	int totelement, i = 0;
+
+	BLI_assert(ELEM(TRUE, FALSE, test_for_enabled));
+
+	if (test_for_enabled)
+		totelement = BMO_mesh_enabled_flag_count(bm, htype, oflag);
+	else
+		totelement = BMO_mesh_disabled_flag_count(bm, htype, oflag);
+
+	BLI_assert(slot->slottype == BMO_OP_SLOT_ELEMENT_BUF);
+
+	if (totelement) {
+		BMIter iter;
+		BMHeader *ele;
+		BMHeader **ele_array;
+
+		bmo_slot_buffer_alloc(op, slotname, totelement);
+
+		ele_array = (BMHeader **)slot->data.p;
+
+		/* TODO - collapse these loops into one */
+
+		if (htype & BM_VERT) {
+			BM_ITER_MESH (ele, &iter, bm, BM_VERTS_OF_MESH) {
+				if (BMO_elem_flag_test_bool(bm, (BMElemF *)ele, oflag) == test_for_enabled) {
+					ele_array[i] = ele;
+					i++;
+				}
+			}
+		}
+
+		if (htype & BM_EDGE) {
+			BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) {
+				if (BMO_elem_flag_test_bool(bm, (BMElemF *)ele, oflag) == test_for_enabled) {
+					ele_array[i] = ele;
+					i++;
+				}
+			}
+		}
+
+		if (htype & BM_FACE) {
+			BM_ITER_MESH (ele, &iter, bm, BM_FACES_OF_MESH) {
+				if (BMO_elem_flag_test_bool(bm, (BMElemF *)ele, oflag) == test_for_enabled) {
+					ele_array[i] = ele;
+					i++;
+				}
+			}
+		}
+	}
+	else {
+		slot->len = 0;
+	}
+}
+
+void BMO_slot_buffer_from_enabled_flag(BMesh *bm, BMOperator *op, const char *slotname,
+                                       const char htype, const short oflag)
+{
+	bmo_slot_buffer_from_flag(bm, op, slotname, htype, oflag, TRUE);
+}
+
+void BMO_slot_buffer_from_disabled_flag(BMesh *bm, BMOperator *op, const char *slotname,
+                                        const char htype, const short oflag)
+{
+	bmo_slot_buffer_from_flag(bm, op, slotname, htype, oflag, FALSE);
+}
+
+/**
+ * \brief BMO_FLAG_BUFFER
+ *
+ * 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 *slotname,
+                                  const char htype, const char hflag, const char do_flush)
+{
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	BMElem **data =  slot->data.p;
+	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->slottype == BMO_OP_SLOT_ELEMENT_BUF);
+
+	for (i = 0; i < slot->len; i++, data++) {
+		if (!(htype & (*data)->head.htype))
+			continue;
+
+		if (do_flush_select) {
+			BM_elem_select_set(bm, *data, TRUE);
+		}
+
+		if (do_flush_hide) {
+			BM_elem_hide_set(bm, *data, FALSE);
+		}
+
+		BM_elem_flag_enable(*data, hflag);
+	}
+}
+
+/**
+ * \brief BMO_FLAG_BUFFER
+ *
+ * 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 *slotname,
+                                   const char htype, const char hflag, const char do_flush)
+{
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	BMElem **data =  slot->data.p;
+	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->slottype == BMO_OP_SLOT_ELEMENT_BUF);
+
+	for (i = 0; i < slot->len; i++, data++) {
+		if (!(htype & (*data)->head.htype))
+			continue;
+
+		if (do_flush_select) {
+			BM_elem_select_set(bm, *data, FALSE);
+		}
+
+		if (do_flush_hide) {
+			BM_elem_hide_set(bm, *data, FALSE);
+		}
+
+		BM_elem_flag_disable(*data, hflag);
+	}
+}
+
+int BMO_vert_edge_flags_count(BMesh *bm, BMVert *v, const short oflag)
+{
+	int count = 0;
+
+	if (v->e) {
+		BMEdge *curedge;
+		const int len = bmesh_disk_count(v);
+		int i;
+		
+		for (i = 0, curedge = v->e; i < len; i++) {
+			if (BMO_elem_flag_test(bm, curedge, oflag))
+				count++;
+			curedge = bmesh_disk_edge_next(curedge, v);
+		}
+	}
+
+	return count;
+}
+
+/**
+ * \brief BMO_FLAG_BUFFER
+ *
+ * Flags elements in a slots buffer
+ */
+void BMO_slot_buffer_flag_enable(BMesh *bm, BMOperator *op, const char *slotname,
+                                 const char htype, const short oflag)
+{
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	BMHeader **data =  slot->data.p;
+	int i;
+
+	BLI_assert(slot->slottype == BMO_OP_SLOT_ELEMENT_BUF);
+
+	for (i = 0; i < slot->len; i++) {
+		if (!(htype & data[i]->htype))
+			continue;
+
+		BMO_elem_flag_enable(bm, (BMElemF *)data[i], oflag);
+	}
+}
+
+/**
+ * \brief BMO_FLAG_BUFFER
+ *
+ * Removes flags from elements in a slots buffer
+ */
+void BMO_slot_buffer_flag_disable(BMesh *bm, BMOperator *op, const char *slotname,
+                                  const char htype, const short oflag)
+{
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	BMHeader **data =  slot->data.p;
+	int i;
+
+	BLI_assert(slot->slottype == BMO_OP_SLOT_ELEMENT_BUF);
+
+	for (i = 0; i < slot->len; i++) {
+		if (!(htype & data[i]->htype))
+			continue;
+
+		BMO_elem_flag_disable(bm, (BMElemF *)data[i], oflag);
+	}
+}
+
+
+/**
+ * \brief ALLOC/FREE FLAG LAYER
+ *
+ * Used by operator stack to free/allocate
+ * private flag data. This is allocated
+ * using a mempool so the allocation/frees
+ * should be quite fast.
+ *
+ * BMESH_TODO:
+ * Investigate not freeing flag layers until
+ * all operators have been executed. This would
+ * save a lot of realloc potentially.
+ */
+static void bmo_flag_layer_alloc(BMesh *bm)
+{
+	BMElemF *ele;
+	/* set the index values since we are looping over all data anyway,
+	 * may save time later on */
+	int i;
+
+	BMIter iter;
+	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));
+	
+	bm->totflags++;
+
+	/* allocate new flag poo */
+	bm->toolflagpool = newpool = BLI_mempool_create(sizeof(BMFlagLayer) * bm->totflags, 512, 512, 0);
+	
+	/* now go through and memcpy all the flags. Loops don't get a flag layer at this time.. */
+	BM_ITER_MESH_INDEX (ele, &iter, bm, BM_VERTS_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_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_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_index_dirty &= ~(BM_VERT|BM_EDGE|BM_FACE);
+
+	BLI_mempool_destroy(oldpool);
+}
+
+static void bmo_flag_layer_free(BMesh *bm)
+{
+	BMElemF *ele;
+	/* set the index values since we are looping over all data anyway,
+	 * may save time later on */
+	int i;
+
+	BMIter iter;
+	BLI_mempool *oldpool = bm->toolflagpool;
+	BLI_mempool *newpool;
+	void *oldflags;
+	
+	/* store memcpy size for reuse */
+	const size_t new_totflags_size = ((bm->totflags - 1) * sizeof(BMFlagLayer));
+
+	/* 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);
+	
+	/* now go through and memcpy all the flag */
+	BM_ITER_MESH_INDEX (ele, &iter, bm, BM_VERTS_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_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_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_index_dirty &= ~(BM_VERT|BM_EDGE|BM_FACE);
+
+	BLI_mempool_destroy(oldpool);
+}
+
+static void bmo_flag_layer_clear(BMesh *bm)
+{
+	BMElemF *ele;
+	/* set the index values since we are looping over all data anyway,
+	 * may save time later on */
+	int i;
+
+	BMIter iter;
+	const int totflags_offset = bm->totflags - 1;
+
+	/* now go through and memcpy all the flag */
+	BM_ITER_MESH_INDEX (ele, &iter, bm, BM_VERTS_OF_MESH, i) {
+		memset(ele->oflags + totflags_offset, 0, sizeof(BMFlagLayer));
+		BM_elem_index_set(ele, i); /* set_inline */
+	}
+	BM_ITER_MESH_INDEX (ele, &iter, bm, BM_EDGES_OF_MESH, i) {
+		memset(ele->oflags + totflags_offset, 0, sizeof(BMFlagLayer));
+		BM_elem_index_set(ele, i); /* set_inline */
+	}
+	BM_ITER_MESH_INDEX (ele, &iter, bm, BM_FACES_OF_MESH, i) {
+		memset(ele->oflags + totflags_offset, 0, sizeof(BMFlagLayer));
+		BM_elem_index_set(ele, i); /* set_inline */
+	}
+
+	bm->elem_index_dirty &= ~(BM_VERT|BM_EDGE|BM_FACE);
+}
+
+void *BMO_slot_buffer_elem_first(BMOperator *op, const char *slotname)
+{
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+	
+	if (slot->slottype != BMO_OP_SLOT_ELEMENT_BUF)
+		return NULL;
+
+	return slot->data.buf ? *(void **)slot->data.buf : NULL;
+}
+
+/**
+ * \brief New Iterator
+ *
+ * \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 *slotname, const char restrictmask)
+{
+	BMOpSlot *slot = BMO_slot_get(op, slotname);
+
+	memset(iter, 0, sizeof(BMOIter));
+
+	iter->slot = slot;
+	iter->cur = 0;
+	iter->restrictmask = restrictmask;
+
+	if (iter->slot->slottype == BMO_OP_SLOT_MAPPING) {
+		if (iter->slot->data.ghash) {
+			BLI_ghashIterator_init(&iter->giter, slot->data.ghash);
+		}
+		else {
+			return NULL;
+		}
+	}
+
+	return BMO_iter_step(iter);
+}
+
+void *BMO_iter_step(BMOIter *iter)
+{
+	if (iter->slot->slottype == BMO_OP_SLOT_ELEMENT_BUF) {
+		BMHeader *h;
+
+		if (iter->cur >= iter->slot->len) {
+			return NULL;
+		}
+
+		h = ((void **)iter->slot->data.buf)[iter->cur++];
+		while (!(iter->restrictmask & h->htype)) {
+			if (iter->cur >= iter->slot->len) {
+				return NULL;
+			}
+
+			h = ((void **)iter->slot->data.buf)[iter->cur++];
+		}
+
+		return h;
+	}
+	else if (iter->slot->slottype == BMO_OP_SLOT_MAPPING) {
+		BMOElemMapping *map;
+		void *ret = BLI_ghashIterator_getKey(&iter->giter);
+		map = BLI_ghashIterator_getValue(&iter->giter);
+		
+		iter->val = map + 1;
+
+		BLI_ghashIterator_step(&iter->giter);
+
+		return ret;
+	}
+
+	return NULL;
+}
+
+/* used for iterating over mapping */
+void *BMO_iter_map_value(BMOIter *iter)
+{
+	return iter->val;
+}
+
+void *BMO_iter_map_value_p(BMOIter *iter)
+{
+	return *((void **)iter->val);
+}
+
+float BMO_iter_map_value_f(BMOIter *iter)
+{
+	return *((float *)iter->val);
+}
+
+/* error syste */
+typedef struct BMOpError {
+	struct BMOpError *next, *prev;
+	int errorcode;
+	BMOperator *op;
+	const char *msg;
+} BMOpError;
+
+void BMO_error_clear(BMesh *bm)
+{
+	while (BMO_error_pop(bm, NULL, NULL));
+}
+
+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];
+	err->msg = msg;
+	err->op = owner;
+	
+	BLI_addhead(&bm->errorstack, err);
+}
+
+int BMO_error_occurred(BMesh *bm)
+{
+	return bm->errorstack.first != NULL;
+}
+
+/* returns error code or 0 if no erro */
+int BMO_error_get(BMesh *bm, const char **msg, BMOperator **op)
+{
+	BMOpError *err = bm->errorstack.first;
+	if (!err) {
+		return 0;
+	}
+
+	if (msg) *msg = err->msg;
+	if (op) *op = err->op;
+	
+	return err->errorcode;
+}
+
+int BMO_error_pop(BMesh *bm, const char **msg, BMOperator **op)
+{
+	int errorcode = BMO_error_get(bm, msg, op);
+	
+	if (errorcode) {
+		BMOpError *err = bm->errorstack.first;
+		
+		BLI_remlink(&bm->errorstack, bm->errorstack.first);
+		MEM_freeN(err);
+	}
+
+	return errorcode;
+}
+
+
+#define NEXT_CHAR(fmt) ((fmt)[0] != 0 ? (fmt)[1] : 0)
+
+static int bmo_name_to_slotcode(BMOpDefine *def, const char *name)
+{
+	int i;
+
+	for (i = 0; def->slottypes[i].type; i++) {
+		if (!strncmp(name, def->slottypes[i].name, MAX_SLOTNAME)) {
+			return i;
+		}
+	}
+
+	return -1;
+}
+
+static int bmo_name_to_slotcode_check(BMOpDefine *def, const char *name)
+{
+	int i = bmo_name_to_slotcode(def, name);
+	if (i < 0) {
+		fprintf(stderr, "%s: ! could not find bmesh slot for name %s! (bmesh internal error)\n", __func__, name);
+	}
+
+	return i;
+}
+
+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)) {
+			return i;
+		}
+	}
+
+	fprintf(stderr, "%s: ! could not find bmesh slot for name %s! (bmesh internal error)\n", __func__, opname);
+	return -1;
+}
+
+/* Example:
+ * BMO_op_callf(bm, "del %i %hv", DEL_ONLYFACES, BM_ELEM_SELECT);
+ *
+ *  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)
+ */
+
+int BMO_op_vinitf(BMesh *bm, BMOperator *op, const char *_fmt, va_list vlist)
+{
+	BMOpDefine *def;
+	char *opname, *ofmt, *fmt;
+	char slotname[64] = {0};
+	int i /*, n = strlen(fmt) */, stop /*, slotcode = -1 */, type, state;
+	char htype;
+	int noslot = 0;
+
+
+	/* basic useful info to help find where bmop formatting strings fail */
+	const char *err_reason = "Unknown";
+	int lineno = -1;
+
+#define GOTO_ERROR(reason)   \
+	{                        \
+		err_reason = reason; \
+		lineno = __LINE__;   \
+		goto error;          \
+	} (void)0
+
+	/* we muck around in here, so dup i */
+	fmt = ofmt = BLI_strdup(_fmt);
+	
+	/* find operator name */
+	i = strcspn(fmt, " ");
+
+	opname = fmt;
+	if (!opname[i]) noslot = 1;
+	opname[i] = '\0';
+
+	fmt += i + (noslot ? 0 : 1);
+	
+	i = bmo_opname_to_opcode(opname);
+
+	if (i == -1) {
+		MEM_freeN(ofmt);
+		return FALSE;
+	}
+
+	BMO_op_init(bm, op, opname);
+	def = opdefines[i];
+	
+	i = 0;
+	state = 1; /* 0: not inside slotcode name, 1: inside slotcode name */
+
+	while (*fmt) {
+		if (state) {
+			/* jump past leading whitespac */
+			i = strspn(fmt, " ");
+			fmt += i;
+			
+			/* ignore trailing whitespac */
+			if (!fmt[i])
+				break;
+
+			/* find end of slot name, only "slot=%f", can be used */
+			i = strcspn(fmt, "=");
+			if (!fmt[i]) {
+				GOTO_ERROR("could not match end of slot name");
+			}
+
+			fmt[i] = 0;
+
+			if (bmo_name_to_slotcode_check(def, fmt) < 0) {
+				GOTO_ERROR("name to slot code check failed");
+			}
+			
+			BLI_strncpy(slotname, fmt, sizeof(slotname));
+			
+			state = 0;
+			fmt += i;
+		}
+		else {
+			switch (*fmt) {
+				case ' ':
+				case '=':
+				case '%':
+					break;
+				case 'm': {
+					int size, c;
+
+					c = NEXT_CHAR(fmt);
+					fmt++;
+
+					if      (c == '3') size = 3;
+					else if (c == '4') size = 4;
+					else GOTO_ERROR("matrix size was not 3 or 4");
+
+					BMO_slot_mat_set(op, slotname, va_arg(vlist, void *), size);
+					state = 1;
+					break;
+				}
+				case 'v': {
+					BMO_slot_vec_set(op, slotname, va_arg(vlist, float *));
+					state = 1;
+					break;
+				}
+				case 'e': {
+					BMHeader *ele = va_arg(vlist, void *);
+					BMOpSlot *slot = BMO_slot_get(op, slotname);
+
+					slot->data.buf = BLI_memarena_alloc(op->arena, sizeof(void *) * 4);
+					slot->len = 1;
+					*((void **)slot->data.buf) = ele;
+
+					state = 1;
+					break;
+				}
+				case 's': {
+					BMOperator *op2 = va_arg(vlist, void *);
+					const char *slotname2 = va_arg(vlist, char *);
+
+					BMO_slot_copy(op2, op, slotname2, slotname);
+					state = 1;
+					break;
+				}
+				case 'i':
+					BMO_slot_int_set(op, slotname, va_arg(vlist, int));
+					state = 1;
+					break;
+				case 'b':
+					BMO_slot_bool_set(op, slotname, va_arg(vlist, int));
+					state = 1;
+					break;
+				case 'p':
+					BMO_slot_ptr_set(op, slotname, va_arg(vlist, void *));
+					state = 1;
+					break;
+				case 'f':
+				case 'F':
+				case 'h':
+				case 'H':
+				case 'a':
+					type = *fmt;
+
+					if (NEXT_CHAR(fmt) == ' ' || NEXT_CHAR(fmt) == '\0') {
+						BMO_slot_float_set(op, slotname, va_arg(vlist, double));
+					}
+					else {
+						htype = 0;
+						stop = 0;
+						while (1) {
+							switch (NEXT_CHAR(fmt)) {
+								case 'f': htype |= BM_FACE; break;
+								case 'e': htype |= BM_EDGE; break;
+								case 'v': htype |= BM_VERT; break;
+								default:
+									stop = 1;
+									break;
+							}
+							if (stop) {
+								break;
+							}
+
+							fmt++;
+						}
+
+						if (type == 'h') {
+							BMO_slot_buffer_from_enabled_hflag(bm, op, slotname, htype, va_arg(vlist, int));
+						}
+						else if (type == 'H') {
+							BMO_slot_buffer_from_disabled_hflag(bm, op, slotname, htype, va_arg(vlist, int));
+						}
+						else if (type == 'a') {
+							BMO_slot_buffer_from_all(bm, op, slotname, htype);
+						}
+						else if (type == 'f') {
+							BMO_slot_buffer_from_enabled_flag(bm, op, slotname, htype, va_arg(vlist, int));
+						}
+						else if (type == 'F') {
+							BMO_slot_buffer_from_disabled_flag(bm, op, slotname, htype, va_arg(vlist, int));
+						}
+					}
+
+					state = 1;
+					break;
+				default:
+					fprintf(stderr,
+					        "%s: unrecognized bmop format char: %c, %d in '%s'\n",
+					        __func__, *fmt, (int)(fmt - ofmt), ofmt);
+					break;
+			}
+		}
+		fmt++;
+	}
+
+	MEM_freeN(ofmt);
+	return TRUE;
+error:
+
+	/* non urgent todo - explain exactly what is failing */
+	fprintf(stderr, "%s: error parsing formatting string\n", __func__);
+
+	fprintf(stderr, "string: '%s', position %d\n", _fmt, (int)(fmt - ofmt));
+	fprintf(stderr, "         ");
+	{
+		int pos = (int)(fmt - ofmt);
+		int i;
+		for (i = 0; i < pos; i++) {
+			fprintf(stderr, " ");
+		}
+		fprintf(stderr, "^\n");
+	}
+
+	fprintf(stderr, "source code:  %s:%d\n", __FILE__, lineno);
+
+	fprintf(stderr, "reason: %s\n", err_reason);
+
+
+	MEM_freeN(ofmt);
+
+	BMO_op_finish(bm, op);
+	return FALSE;
+
+#undef GOTO_ERROR
+
+}
+
+
+int BMO_op_initf(BMesh *bm, BMOperator *op, const char *fmt, ...)
+{
+	va_list list;
+
+	va_start(list, fmt);
+	if (!BMO_op_vinitf(bm, op, fmt, list)) {
+		printf("%s: failed\n", __func__);
+		va_end(list);
+		return FALSE;
+	}
+	va_end(list);
+
+	return TRUE;
+}
+
+int BMO_op_callf(BMesh *bm, const char *fmt, ...)
+{
+	va_list list;
+	BMOperator op;
+
+	va_start(list, fmt);
+	if (!BMO_op_vinitf(bm, &op, fmt, list)) {
+		printf("%s: failed, format is:\n    \"%s\"\n", __func__, fmt);
+		va_end(list);
+		return FALSE;
+	}
+
+	BMO_op_exec(bm, &op);
+	BMO_op_finish(bm, &op);
+
+	va_end(list);
+	return TRUE;
+}
diff --git a/source/blender/bmesh/intern/bmesh_operators.h b/source/blender/bmesh/intern/bmesh_operators.h
new file mode 100644
index 0000000..f4db13e
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_operators.h
@@ -0,0 +1,109 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BMESH_OPERATORS_H__
+#define __BMESH_OPERATORS_H__
+
+/** \file blender/bmesh/intern/bmesh_operators.h
+ *  \ingroup bmesh
+ */
+
+/*see comments in intern/bmesh_opdefines.c for documentation of specific operators*/
+
+/*--------defines/enumerations for specific operators-------*/
+
+/*quad innervert values*/
+enum {
+	SUBD_INNERVERT,
+	SUBD_PATH,
+	SUBD_FAN,
+	SUBD_STRAIGHT_CUT
+};
+
+enum {
+	SUBDIV_SELECT_ORIG,
+	SUBDIV_SELECT_INNER,
+	SUBDIV_SELECT_INNER_SEL,
+	SUBDIV_SELECT_LOOPCUT
+};
+
+/* similar face selection slot values */
+enum {
+	SIMFACE_MATERIAL = 201,
+	SIMFACE_IMAGE,
+	SIMFACE_AREA,
+	SIMFACE_PERIMETER,
+	SIMFACE_NORMAL,
+	SIMFACE_COPLANAR
+};
+
+/* similar edge selection slot values */
+enum {
+	SIMEDGE_LENGTH = 101,
+	SIMEDGE_DIR,
+	SIMEDGE_FACE,
+	SIMEDGE_FACE_ANGLE,
+	SIMEDGE_CREASE,
+	SIMEDGE_SEAM,
+	SIMEDGE_SHARP
+};
+
+/* similar vertex selection slot values */
+enum {
+	SIMVERT_NORMAL = 0,
+	SIMVERT_FACE,
+	SIMVERT_VGROUP
+};
+
+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;
+
+/*------specific operator helper functions-------*/
+
+struct Object;
+
+void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
+                        float smooth, float fractal,
+                        int numcuts,
+                        int seltype, int cornertype,
+                        const short use_singleedge, const short use_gridfill,
+                        int seed);
+
+#include "intern/bmesh_operator_api_inline.h"
+
+#endif /* __BMESH_OPERATORS_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_operators_private.h b/source/blender/bmesh/intern/bmesh_operators_private.h
new file mode 100644
index 0000000..423b30a
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_operators_private.h
@@ -0,0 +1,104 @@
+/*
+ * ***** 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, Geoffrey Bantle, Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BMESH_OPERATORS_PRIVATE_H__
+#define __BMESH_OPERATORS_PRIVATE_H__
+
+/** \file blender/bmesh/intern/bmesh_operators_private.h
+ *  \ingroup bmesh
+ */
+
+struct BMesh;
+struct BMOperator;
+
+void BMO_push(BMesh *bm, BMOperator *op);
+void BMO_pop(BMesh *bm);
+
+void bmo_split_exec(BMesh *bm, BMOperator *op);
+void bmo_spin_exec(BMesh *bm, BMOperator *op);
+void bmo_dupe_exec(BMesh *bm, BMOperator *op);
+void bmo_del_exec(BMesh *bm, BMOperator *op);
+void bmo_esubd_exec(BMesh *bm, BMOperator *op);
+void bmo_triangulate_exec(BMesh *bm, BMOperator *op);
+void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op);
+void bmo_dissolve_verts_exec(BMesh *bm, BMOperator *op);
+void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op);
+void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op);
+void bmo_vertex_slide_exec(BMesh *bm, BMOperator *op);
+void bmo_connectverts_exec(BMesh *bm, BMOperator *op);
+void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op);
+void bmo_mesh_to_bmesh_exec(BMesh *bm, BMOperator *op);
+void bmo_bmesh_to_mesh_exec(BMesh *bm, BMOperator *op);
+void bmo_translate_exec(BMesh *bm, BMOperator *op);
+void bmo_transform_exec(BMesh *bm, BMOperator *op);
+void bmo_contextual_create_exec(BMesh *bm, BMOperator *op);
+void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op);
+void bmo_rotate_exec(BMesh *bm, BMOperator *op);
+void bmo_makevert_exec(BMesh *bm, BMOperator *op);
+void bmo_dissolve_edges_exec(BMesh *bm, BMOperator *op);
+void bmo_dissolve_edgeloop_exec(BMesh *bm, BMOperator *op);
+void bmo_weldverts_exec(BMesh *bm, BMOperator *op);
+void bmo_removedoubles_exec(BMesh *bm, BMOperator *op);
+void bmo_finddoubles_exec(BMesh *bm, BMOperator *op);
+void bmo_mirror_exec(BMesh *bm, BMOperator *op);
+void bmo_edgebisect_exec(BMesh *bm, BMOperator *op);
+void bmo_reversefaces_exec(BMesh *bm, BMOperator *op);
+void bmo_edgerotate_exec(BMesh *bm, BMOperator *op);
+void bmo_regionextend_exec(BMesh *bm, BMOperator *op);
+void bmo_righthandfaces_exec(BMesh *bm, BMOperator *op);
+void bmo_vertexsmooth_exec(BMesh *bm, BMOperator *op);
+void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op);
+void bmo_extrude_face_indiv_exec(BMesh *bm, BMOperator *op);
+void bmo_collapse_uvs_exec(BMesh *bm, BMOperator *op);
+void bmo_pointmerge_exec(BMesh *bm, BMOperator *op);
+void bmo_collapse_exec(BMesh *bm, BMOperator *op);
+void bmo_similarfaces_exec(BMesh *bm, BMOperator *op);
+void bmo_similaredges_exec(BMesh *bm, BMOperator *op);
+void bmo_similarverts_exec(BMesh *bm, BMOperator *op);
+void bmo_pointmerge_facedata_exec(BMesh *bm, BMOperator *op);
+void bmo_vert_average_facedata_exec(BMesh *bm, BMOperator *op);
+void bmo_face_rotateuvs_exec(BMesh *bm, BMOperator *op);
+void bmo_object_load_bmesh_exec(BMesh *bm, BMOperator *op);
+void bmo_face_reverseuvs_exec(BMesh *bm, BMOperator *op);
+void bmo_edgenet_prepare(BMesh *bm, BMOperator *op);
+void bmo_rotatecolors_exec(BMesh *bm, BMOperator *op);
+void bmo_face_reversecolors_exec(BMesh *bm, BMOperator *op);
+void bmo_vertexshortestpath_exec(BMesh *bm, BMOperator *op);
+void bmo_scale_exec(BMesh *bm, BMOperator *op);
+void bmo_edgesplit_exec(BMesh *bm, BMOperator *op);
+void bmo_automerge_exec(BMesh *bm, BMOperator *op);
+void bmo_create_cone_exec(BMesh *bm, BMOperator *op);
+void bmo_create_monkey_exec(BMesh *bm, BMOperator *op);
+void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op);
+void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op);
+void bmo_create_grid_exec(BMesh *bm, BMOperator *op);
+void bmo_create_cube_exec(BMesh *bm, BMOperator *op);
+void bmo_join_triangles_exec(BMesh *bm, BMOperator *op);
+void bmo_bevel_exec(BMesh *bm, BMOperator *op);
+void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op);
+void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op);
+void bmo_create_circle_exec(BMesh *bm, BMOperator *op);
+void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op);
+void bmo_solidify_face_region_exec(BMesh *bm, BMOperator *op);
+void bmo_inset_exec(BMesh *bm, BMOperator *op);
+
+#endif /* __BMESH_OPERATORS_PRIVATE_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c
new file mode 100644
index 0000000..fbfc253
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_polygon.c
@@ -0,0 +1,973 @@
+/*
+ * ***** 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, Geoffrey Bantle, Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/intern/bmesh_polygon.c
+ *  \ingroup bmesh
+ *
+ * This file contains code for dealing
+ * with polygons (normal/area calculation,
+ * tessellation, etc)
+ *
+ * BMESH_TODO:
+ *  - Add in Tessellator frontend that creates
+ *    BMTriangles from copied faces
+ *
+ *  - Add in Function that checks for and flags
+ *    degenerate faces.
+ */
+
+#include "BLI_math.h"
+#include "BLI_array.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "bmesh.h"
+#include "intern/bmesh_private.h"
+
+/**
+ * \brief TEST EDGE SIDE and POINT IN TRIANGLE
+ *
+ * Point in triangle tests stolen from scanfill.c.
+ * Used for tessellator
+ */
+
+static short testedgesidef(const float v1[2], const float v2[2], const float v3[2])
+{
+	/* is v3 to the right of v1 - v2 ? With exception: v3 == v1 || v3 == v2 */
+	double inp;
+
+	//inp = (v2[cox] - v1[cox]) * (v1[coy] - v3[coy]) + (v1[coy] - v2[coy]) * (v1[cox] - v3[cox]);
+	inp = (v2[0] - v1[0]) * (v1[1] - v3[1]) + (v1[1] - v2[1]) * (v1[0] - v3[0]);
+
+	if (inp < 0.0) {
+		return FALSE;
+	}
+	else if (inp == 0) {
+		if (v1[0] == v3[0] && v1[1] == v3[1]) return FALSE;
+		if (v2[0] == v3[0] && v2[1] == v3[1]) return FALSE;
+	}
+	return TRUE;
+}
+
+/**
+ * \brief COMPUTE POLY NORMAL
+ *
+ * Computes the normal of a planar
+ * polygon See Graphics Gems for
+ * computing newell normal.
+ */
+static void calc_poly_normal(float normal[3], float verts[][3], int nverts)
+{
+	float const *v_prev = verts[nverts - 1];
+	float const *v_curr = verts[0];
+	float n[3] = {0.0f};
+	int i;
+
+	/* Newell's Method */
+	for (i = 0; i < nverts; v_prev = v_curr, v_curr = verts[++i]) {
+		add_newell_cross_v3_v3v3(n, v_prev, v_curr);
+	}
+
+	if (UNLIKELY(normalize_v3_v3(normal, n) == 0.0f)) {
+		normal[2] = 1.0f; /* other axis set to 0.0 */
+	}
+}
+
+/**
+ * \brief COMPUTE POLY NORMAL (BMFace)
+ *
+ * Same as #calc_poly_normal but operates directly on a bmesh face.
+ */
+static void bm_face_calc_poly_normal(BMFace *f)
+{
+	BMLoop *l_first = BM_FACE_FIRST_LOOP(f);
+	BMLoop *l_iter  = l_first;
+	float const *v_prev = l_first->prev->v->co;
+	float const *v_curr = l_first->v->co;
+	float n[3] = {0.0f};
+
+	/* Newell's Method */
+	do {
+		add_newell_cross_v3_v3v3(n, v_prev, v_curr);
+
+		l_iter = l_iter->next;
+		v_prev = v_curr;
+		v_curr = l_iter->v->co;
+
+	} while (l_iter != l_first);
+
+	if (UNLIKELY(normalize_v3_v3(f->no, n) == 0.0f)) {
+		f->no[2] = 1.0f; /* other axis set to 0.0 */
+	}
+}
+
+/**
+ * \brief COMPUTE POLY NORMAL (BMFace)
+ *
+ * Same as #calc_poly_normal and #bm_face_calc_poly_normal
+ * but takes an array of vertex locations.
+ */
+static void bm_face_calc_poly_normal_vertex_cos(BMFace *f, float n[3],
+                                                float const (*vertexCos)[3])
+{
+	BMLoop *l_first = BM_FACE_FIRST_LOOP(f);
+	BMLoop *l_iter  = l_first;
+	float const *v_prev = vertexCos[BM_elem_index_get(l_first->prev->v)];
+	float const *v_curr = vertexCos[BM_elem_index_get(l_first->v)];
+
+	zero_v3(n);
+
+	/* Newell's Method */
+	do {
+		add_newell_cross_v3_v3v3(n, v_prev, v_curr);
+
+		l_iter = l_iter->next;
+		v_prev = v_curr;
+		v_curr = vertexCos[BM_elem_index_get(l_iter->v)];
+	} while (l_iter != l_first);
+
+	if (UNLIKELY(normalize_v3(n) == 0.0f)) {
+		n[2] = 1.0f; /* other axis set to 0.0 */
+	}
+}
+
+/**
+ * get the area of the face
+ */
+float BM_face_calc_area(BMFace *f)
+{
+	BMLoop *l;
+	BMIter iter;
+	float (*verts)[3];
+	float normal[3];
+	float area;
+	int i;
+
+	BLI_array_fixedstack_declare(verts, BM_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);
+	}
+
+	if (f->len == 3) {
+		area = area_tri_v3(verts[0], verts[1], verts[2]);
+	}
+	else if (f->len == 4) {
+		area = area_quad_v3(verts[0], verts[1], verts[2], verts[3]);
+	}
+	else {
+		calc_poly_normal(normal, verts, f->len);
+		area = area_poly_v3(f->len, verts, normal);
+	}
+
+	BLI_array_fixedstack_free(verts);
+
+	return area;
+}
+
+/**
+ * compute the perimeter of an ngon
+ */
+float BM_face_calc_perimeter(BMFace *f)
+{
+	BMLoop *l_iter, *l_first;
+	float perimeter = 0.0f;
+
+	l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+	do {
+		perimeter += len_v3v3(l_iter->v->co, l_iter->next->v->co);
+	} while ((l_iter = l_iter->next) != l_first);
+
+	return perimeter;
+}
+
+/**
+ * computes center of face in 3d.  uses center of bounding box.
+ */
+void BM_face_calc_center_bounds(BMFace *f, float r_cent[3])
+{
+	BMLoop *l_iter;
+	BMLoop *l_first;
+	float min[3], max[3];
+
+	INIT_MINMAX(min, max);
+
+	l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+	do {
+		DO_MINMAX(l_iter->v->co, min, max);
+	} while ((l_iter = l_iter->next) != l_first);
+
+	mid_v3_v3v3(r_cent, min, max);
+}
+
+/**
+ * computes the center of a face, using the mean average
+ */
+void BM_face_calc_center_mean(BMFace *f, float r_cent[3])
+{
+	BMLoop *l_iter;
+	BMLoop *l_first;
+
+	zero_v3(r_cent);
+
+	l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+	do {
+		add_v3_v3(r_cent, l_iter->v->co);
+	} while ((l_iter = l_iter->next) != l_first);
+
+	if (f->len)
+		mul_v3_fl(r_cent, 1.0f / (float) f->len);
+}
+
+/**
+ * COMPUTE POLY PLANE
+ *
+ * Projects a set polygon's vertices to
+ * a plane defined by the average
+ * of its edges cross products
+ */
+void calc_poly_plane(float (*verts)[3], const int nverts)
+{
+	
+	float avgc[3], norm[3], mag, avgn[3];
+	float *v1, *v2, *v3;
+	int i;
+	
+	if (nverts < 3)
+		return;
+
+	zero_v3(avgn);
+	zero_v3(avgc);
+
+	for (i = 0; i < nverts; i++) {
+		v1 = verts[i];
+		v2 = verts[(i + 1) % nverts];
+		v3 = verts[(i + 2) % nverts];
+		normal_tri_v3(norm, v1, v2, v3);
+
+		add_v3_v3(avgn, norm);
+	}
+
+	if (UNLIKELY(normalize_v3(avgn) == 0.0f)) {
+		avgn[2] = 1.0f;
+	}
+	
+	for (i = 0; i < nverts; i++) {
+		v1 = verts[i];
+		mag = dot_v3v3(v1, avgn);
+		madd_v3_v3fl(v1, avgn, -mag);
+	}
+}
+
+/**
+ * \brief BM LEGAL EDGES
+ *
+ * takes in a face and a list of edges, and sets to NULL any edge in
+ * the list that bridges a concave region of the face or intersects
+ * any of the faces's edges.
+ */
+static void shrink_edgef(float v1[3], float v2[3], const float fac)
+{
+	float mid[3];
+
+	mid_v3_v3v3(mid, v1, v2);
+
+	sub_v3_v3v3(v1, v1, mid);
+	sub_v3_v3v3(v2, v2, mid);
+
+	mul_v3_fl(v1, fac);
+	mul_v3_fl(v2, fac);
+
+	add_v3_v3v3(v1, v1, mid);
+	add_v3_v3v3(v2, v2, mid);
+}
+
+
+/**
+ * \brief POLY ROTATE PLANE
+ *
+ * Rotates a polygon so that it's
+ * normal is pointing towards the mesh Z axis
+ */
+void poly_rotate_plane(const float normal[3], float (*verts)[3], const int nverts)
+{
+
+	float up[3] = {0.0f, 0.0f, 1.0f}, axis[3], q[4];
+	float mat[3][3];
+	double angle;
+	int i;
+
+	cross_v3_v3v3(axis, normal, up);
+
+	angle = saacos(dot_v3v3(normal, up));
+
+	if (angle == 0.0) return;
+
+	axis_angle_to_quat(q, axis, (float)angle);
+	quat_to_mat3(mat, q);
+
+	for (i = 0; i < nverts; i++)
+		mul_m3_v3(mat, verts[i]);
+}
+
+/**
+ * updates face and vertex normals incident on an edge
+ */
+void BM_edge_normals_update(BMEdge *e)
+{
+	BMIter iter;
+	BMFace *f;
+	
+	BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) {
+		BM_face_normal_update(f);
+	}
+
+	BM_vert_normal_update(e->v1);
+	BM_vert_normal_update(e->v2);
+}
+
+/**
+ * update a vert normal (but not the faces incident on it)
+ */
+void BM_vert_normal_update(BMVert *v)
+{
+	/* TODO, we can normalize each edge only once, then compare with previous edge */
+
+	BMIter liter;
+	BMLoop *l;
+	float vec1[3], vec2[3], fac;
+	int len = 0;
+
+	zero_v3(v->no);
+
+	BM_ITER_ELEM (l, &liter, v, BM_LOOPS_OF_VERT) {
+		/* Same calculation used in BM_mesh_normals_update */
+		sub_v3_v3v3(vec1, l->v->co, l->prev->v->co);
+		sub_v3_v3v3(vec2, l->next->v->co, l->v->co);
+		normalize_v3(vec1);
+		normalize_v3(vec2);
+
+		fac = saacos(-dot_v3v3(vec1, vec2));
+
+		madd_v3_v3fl(v->no, l->f->no, fac);
+
+		len++;
+	}
+
+	if (len) {
+		normalize_v3(v->no);
+	}
+}
+
+void BM_vert_normal_update_all(BMVert *v)
+{
+	BMIter iter;
+	BMFace *f;
+
+	BM_ITER_ELEM (f, &iter, v, BM_FACES_OF_VERT) {
+		BM_face_normal_update(f);
+	}
+
+	BM_vert_normal_update(v);
+}
+
+/**
+ * \brief BMESH UPDATE FACE NORMAL
+ *
+ * Updates the stored normal for the
+ * given face. Requires that a buffer
+ * of sufficient length to store projected
+ * coordinates for all of the face's vertices
+ * is passed in as well.
+ */
+
+void BM_face_normal_update(BMFace *f)
+{
+	BMLoop *l;
+
+	/* common cases first */
+	switch (f->len) {
+		case 4:
+		{
+			const float *co1 = (l = BM_FACE_FIRST_LOOP(f))->v->co;
+			const float *co2 = (l = l->next)->v->co;
+			const float *co3 = (l = l->next)->v->co;
+			const float *co4 = (l->next)->v->co;
+
+			normal_quad_v3(f->no, co1, co2, co3, co4);
+			break;
+		}
+		case 3:
+		{
+			const float *co1 = (l = BM_FACE_FIRST_LOOP(f))->v->co;
+			const float *co2 = (l = l->next)->v->co;
+			const float *co3 = (l->next)->v->co;
+
+			normal_tri_v3(f->no, co1, co2, co3);
+			break;
+		}
+		case 0:
+		{
+			zero_v3(f->no);
+			break;
+		}
+		default:
+		{
+			bm_face_calc_poly_normal(f);
+			break;
+		}
+	}
+}
+/* exact same as 'bmesh_face_normal_update' but accepts vertex coords */
+void BM_face_normal_update_vcos(BMesh *bm, BMFace *f, float no[3],
+                                float const (*vertexCos)[3])
+{
+	BMLoop *l;
+
+	/* must have valid index data */
+	BLI_assert((bm->elem_index_dirty & BM_VERT) == 0);
+	(void)bm;
+
+	/* common cases first */
+	switch (f->len) {
+		case 4:
+		{
+			const float *co1 = vertexCos[BM_elem_index_get((l = BM_FACE_FIRST_LOOP(f))->v)];
+			const float *co2 = vertexCos[BM_elem_index_get((l = l->next)->v)];
+			const float *co3 = vertexCos[BM_elem_index_get((l = l->next)->v)];
+			const float *co4 = vertexCos[BM_elem_index_get((l->next)->v)];
+
+			normal_quad_v3(no, co1, co2, co3, co4);
+			break;
+		}
+		case 3:
+		{
+			const float *co1 = vertexCos[BM_elem_index_get((l = BM_FACE_FIRST_LOOP(f))->v)];
+			const float *co2 = vertexCos[BM_elem_index_get((l = l->next)->v)];
+			const float *co3 = vertexCos[BM_elem_index_get((l->next)->v)];
+
+			normal_tri_v3(no, co1, co2, co3);
+			break;
+		}
+		case 0:
+		{
+			zero_v3(no);
+			break;
+		}
+		default:
+		{
+			bm_face_calc_poly_normal_vertex_cos(f, no, vertexCos);
+			break;
+		}
+	}
+}
+
+/**
+ * \brief Face Flip Normal
+ *
+ * Reverses the winding of a face.
+ * \note This updates the calculated normal.
+ */
+void BM_face_normal_flip(BMesh *bm, BMFace *f)
+{
+	bmesh_loop_reverse(bm, f);
+	negate_v3(f->no);
+}
+
+/* detects if two line segments cross each other (intersects).
+ * note, there could be more winding cases then there needs to be. */
+static int linecrossesf(const float v1[2], const float v2[2], const float v3[2], const float v4[2])
+{
+
+#define GETMIN2_AXIS(a, b, ma, mb, axis)   \
+	{                                      \
+		ma[axis] = MIN2(a[axis], b[axis]); \
+		mb[axis] = MAX2(a[axis], b[axis]); \
+	} (void)0
+
+#define GETMIN2(a, b, ma, mb)          \
+	{                                  \
+		GETMIN2_AXIS(a, b, ma, mb, 0); \
+		GETMIN2_AXIS(a, b, ma, mb, 1); \
+	} (void)0
+
+#define EPS (FLT_EPSILON * 15)
+
+	int w1, w2, w3, w4, w5 /*, re */;
+	float mv1[2], mv2[2], mv3[2], mv4[2];
+	
+	/* now test winding */
+	w1 = testedgesidef(v1, v3, v2);
+	w2 = testedgesidef(v2, v4, v1);
+	w3 = !testedgesidef(v1, v2, v3);
+	w4 = testedgesidef(v3, v2, v4);
+	w5 = !testedgesidef(v3, v1, v4);
+	
+	if (w1 == w2 && w2 == w3 && w3 == w4 && w4 == w5) {
+		return TRUE;
+	}
+	
+	GETMIN2(v1, v2, mv1, mv2);
+	GETMIN2(v3, v4, mv3, mv4);
+	
+	/* do an interval test on the x and y axes */
+	/* first do x axis */
+	if (ABS(v1[1] - v2[1]) < EPS &&
+	    ABS(v3[1] - v4[1]) < EPS &&
+	    ABS(v1[1] - v3[1]) < EPS)
+	{
+		return (mv4[0] >= mv1[0] && mv3[0] <= mv2[0]);
+	}
+
+	/* now do y axis */
+	if (ABS(v1[0] - v2[0]) < EPS &&
+	    ABS(v3[0] - v4[0]) < EPS &&
+	    ABS(v1[0] - v3[0]) < EPS)
+	{
+		return (mv4[1] >= mv1[1] && mv3[1] <= mv2[1]);
+	}
+
+	return FALSE;
+
+#undef GETMIN2_AXIS
+#undef GETMIN2
+#undef EPS
+
+}
+
+/**
+ *  BM POINT IN FACE
+ *
+ * Projects co onto face f, and returns true if it is inside
+ * the face bounds.
+ *
+ * \note this uses a best-axis projection test,
+ * instead of projecting co directly into f's orientation space,
+ * so there might be accuracy issues.
+ */
+int BM_face_point_inside_test(BMFace *f, const float co[3])
+{
+	int ax, ay;
+	float co2[2], cent[2] = {0.0f, 0.0f}, out[2] = {FLT_MAX * 0.5f, FLT_MAX * 0.5f};
+	BMLoop *l_iter;
+	BMLoop *l_first;
+	int crosses = 0;
+	float onepluseps = 1.0f + (float)FLT_EPSILON * 150.0f;
+	
+	if (dot_v3v3(f->no, f->no) <= FLT_EPSILON * 10)
+		BM_face_normal_update(f);
+	
+	/* find best projection of face XY, XZ or YZ: barycentric weights of
+	 * the 2d projected coords are the same and faster to compute
+	 *
+	 * this probably isn't all that accurate, but it has the advantage of
+	 * being fast (especially compared to projecting into the face orientation)
+	 */
+	axis_dominant_v3(&ax, &ay, f->no);
+
+	co2[0] = co[ax];
+	co2[1] = co[ay];
+	
+	l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+	do {
+		cent[0] += l_iter->v->co[ax];
+		cent[1] += l_iter->v->co[ay];
+	} while ((l_iter = l_iter->next) != l_first);
+	
+	mul_v2_fl(cent, 1.0f / (float)f->len);
+	
+	l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+	do {
+		float v1[2], v2[2];
+		
+		v1[0] = (l_iter->prev->v->co[ax] - cent[ax]) * onepluseps + cent[ax];
+		v1[1] = (l_iter->prev->v->co[ay] - cent[ay]) * onepluseps + cent[ay];
+		
+		v2[0] = (l_iter->v->co[ax] - cent[ax]) * onepluseps + cent[ax];
+		v2[1] = (l_iter->v->co[ay] - cent[ay]) * onepluseps + cent[ay];
+		
+		crosses += linecrossesf(v1, v2, co2, out) != 0;
+	} while ((l_iter = l_iter->next) != l_first);
+	
+	return crosses % 2 != 0;
+}
+
+static int bm_face_goodline(float const (*projectverts)[3], BMFace *f,
+                            int v1i, int v2i, int v3i,
+                            int UNUSED(nvert))
+{
+	BMLoop *l_iter;
+	BMLoop *l_first;
+	float v1[3], v2[3], v3[3], pv1[3], pv2[3];
+	int i;
+
+	copy_v3_v3(v1, projectverts[v1i]);
+	copy_v3_v3(v2, projectverts[v2i]);
+	copy_v3_v3(v3, projectverts[v3i]);
+	
+	if (testedgesidef(v1, v2, v3)) {
+		return FALSE;
+	}
+
+	//for (i = 0; i < nvert; i++) {
+	l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+	do {
+		i = BM_elem_index_get(l_iter->v);
+		if (i == v1i || i == v2i || i == v3i) {
+			continue;
+		}
+		
+		copy_v3_v3(pv1, projectverts[BM_elem_index_get(l_iter->v)]);
+		copy_v3_v3(pv2, projectverts[BM_elem_index_get(l_iter->next->v)]);
+		
+		//if (linecrossesf(pv1, pv2, v1, v3)) return FALSE;
+
+		if (isect_point_tri_v2(pv1, v1, v2, v3) ||
+		    isect_point_tri_v2(pv1, v3, v2, v1))
+		{
+			return FALSE;
+		}
+	} while ((l_iter = l_iter->next) != l_first);
+	return TRUE;
+}
+
+/**
+ * \brief Find Ear
+ *
+ * Used by tessellator to find
+ * the next triangle to 'clip off'
+ * of a polygon while tessellating.
+ *
+ * \param use_beauty Currently only applies to quads, can be extended later on.
+ */
+static BMLoop *find_ear(BMFace *f, float (*verts)[3], const int nvert, const int use_beauty)
+{
+	BMLoop *bestear = NULL;
+
+	BMLoop *l_iter;
+	BMLoop *l_first;
+
+	if (f->len == 4) {
+		BMLoop *larr[4];
+		int i = 0;
+
+		l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+		do {
+			larr[i] = l_iter;
+			i++;
+		} while ((l_iter = l_iter->next) != l_first);
+
+		/* pick 0/1 based on best lenth */
+		bestear = larr[(((len_squared_v3v3(larr[0]->v->co, larr[2]->v->co) >
+		                  len_squared_v3v3(larr[1]->v->co, larr[3]->v->co))) != use_beauty)];
+
+	}
+	else {
+		BMVert *v1, *v2, *v3;
+
+		/* float angle, bestangle = 180.0f; */
+		int isear /*, i = 0 */;
+
+		l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+		do {
+			isear = TRUE;
+
+			v1 = l_iter->prev->v;
+			v2 = l_iter->v;
+			v3 = l_iter->next->v;
+
+			if (BM_edge_exists(v1, v3)) {
+				isear = FALSE;
+			}
+			else if (!bm_face_goodline((float const (*)[3])verts, f,
+			                           BM_elem_index_get(v1), BM_elem_index_get(v2), BM_elem_index_get(v3),
+			                           nvert))
+			{
+				isear = FALSE;
+			}
+
+			if (isear) {
+	#if 0
+				/* if this code comes back, it needs to be converted to radians */
+				angle = angle_v3v3v3(verts[v1->head.eflag2], verts[v2->head.eflag2], verts[v3->head.eflag2]);
+				if (!bestear || ABS(angle - 45.0f) < bestangle) {
+					bestear = l;
+					bestangle = ABS(45.0f - angle);
+				}
+
+				if (angle > 20 && angle < 90) break;
+				if (angle < 100 && i > 5) break;
+				i += 1;
+	#endif
+
+				bestear = l_iter;
+				break;
+			}
+		} while ((l_iter = l_iter->next) != l_first);
+	}
+
+	return bestear;
+}
+
+/**
+ * \brief BMESH TRIANGULATE FACE
+ *
+ * Triangulates a face using a simple 'ear clipping' algorithm that tries to
+ * favor non-skinny triangles (angles less than 90 degrees).
+ *
+ * If the triangulator has bits left over (or cannot triangulate at all)
+ * it uses a simple fan triangulation,
+ *
+ * newfaces, if non-null, must be an array of BMFace pointers,
+ * with a length equal to f->len.  it will be filled with the new
+ * triangles, and will be NULL-terminated.
+ *
+ * \note newedgeflag sets a flag layer flag, obviously not the header flag.
+ */
+void BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3],
+                         const short newedge_oflag, const short newface_oflag, BMFace **newfaces,
+                         const short use_beauty)
+{
+	int i, done, nvert, nf_i = 0;
+	BMLoop *newl, *nextloop;
+	BMLoop *l_iter;
+	BMLoop *l_first;
+	/* BMVert *v; */ /* UNUSED */
+
+	/* copy vertex coordinates to vertspace arra */
+	i = 0;
+	l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+	do {
+		copy_v3_v3(projectverts[i], l_iter->v->co);
+		BM_elem_index_set(l_iter->v, i); /* set dirty! */
+		i++;
+	} while ((l_iter = l_iter->next) != l_first);
+
+	bm->elem_index_dirty |= BM_VERT; /* see above */
+
+	///bmesh_face_normal_update(bm, f, f->no, projectverts);
+
+	calc_poly_normal(f->no, projectverts, f->len);
+	poly_rotate_plane(f->no, projectverts, i);
+
+	nvert = f->len;
+
+	//calc_poly_plane(projectverts, i);
+	for (i = 0; i < nvert; i++) {
+		projectverts[i][2] = 0.0f;
+	}
+
+	done = 0;
+	while (!done && f->len > 3) {
+		done = 1;
+		l_iter = find_ear(f, projectverts, nvert, use_beauty);
+		if (l_iter) {
+			done = 0;
+			/* v = l->v; */ /* UNUSED */
+			f = BM_face_split(bm, l_iter->f, l_iter->prev->v,
+			                  l_iter->next->v,
+			                  &newl, NULL, TRUE);
+
+			if (UNLIKELY(!f)) {
+				fprintf(stderr, "%s: triangulator failed to split face! (bmesh internal error)\n", __func__);
+				break;
+			}
+
+			copy_v3_v3(f->no, l_iter->f->no);
+			BMO_elem_flag_enable(bm, newl->e, newedge_oflag);
+			BMO_elem_flag_enable(bm, f, newface_oflag);
+			
+			if (newfaces) newfaces[nf_i++] = f;
+
+#if 0
+			l = f->loopbase;
+			do {
+				if (l->v == v) {
+					f->loopbase = l;
+					break;
+				}
+				l = l->next;
+			} while (l != f->loopbase);
+#endif
+
+		}
+	}
+
+	if (f->len > 3) {
+		l_iter = BM_FACE_FIRST_LOOP(f);
+		while (l_iter->f->len > 3) {
+			nextloop = l_iter->next->next;
+			f = BM_face_split(bm, l_iter->f, l_iter->v, nextloop->v,
+			                  &newl, NULL, TRUE);
+			if (!f) {
+				printf("triangle fan step of triangulator failed.\n");
+
+				/* NULL-terminate */
+				if (newfaces) newfaces[nf_i] = NULL;
+				return;
+			}
+
+			if (newfaces) newfaces[nf_i++] = f;
+			
+			BMO_elem_flag_enable(bm, newl->e, newedge_oflag);
+			BMO_elem_flag_enable(bm, f, newface_oflag);
+			l_iter = nextloop;
+		}
+	}
+	
+	/* NULL-terminate */
+	if (newfaces) newfaces[nf_i] = NULL;
+}
+
+/**
+ * each pair of loops defines a new edge, a split.  this function goes
+ * through and sets pairs that are geometrically invalid to null.  a
+ * split is invalid, if it forms a concave angle or it intersects other
+ * edges in the face, or it intersects another split.  in the case of
+ * intersecting splits, only the first of the set of intersecting
+ * splits survives
+ */
+void BM_face_legal_splits(BMesh *bm, BMFace *f, BMLoop *(*loops)[2], int len)
+{
+	BMIter iter;
+	BMLoop *l;
+	float v1[3], v2[3], v3[3] /*, v4[3 */, no[3], mid[3], *p1, *p2, *p3, *p4;
+	float out[3] = {-234324.0f, -234324.0f, 0.0f};
+	float (*projverts)[3];
+	float (*edgeverts)[3];
+	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");
+	
+	i = 0;
+	l = BM_iter_new(&iter, bm, BM_LOOPS_OF_FACE, f);
+	for ( ; l; l = BM_iter_step(&iter)) {
+		BM_elem_index_set(l, i); /* set_loop */
+		copy_v3_v3(projverts[i], l->v->co);
+		i++;
+	}
+	
+	for (i = 0; i < len; i++) {
+		copy_v3_v3(v1, loops[i][0]->v->co);
+		copy_v3_v3(v2, loops[i][1]->v->co);
+
+		shrink_edgef(v1, v2, fac2);
+		
+		copy_v3_v3(edgeverts[a], v1);
+		a++;
+		copy_v3_v3(edgeverts[a], v2);
+		a++;
+	}
+	
+	calc_poly_normal(no, projverts, f->len);
+	poly_rotate_plane(no, projverts, f->len);
+	poly_rotate_plane(no, edgeverts, len * 2);
+
+	for (i = 0, l = BM_FACE_FIRST_LOOP(f); i < f->len; i++, l = l->next) {
+		p1 = projverts[i];
+		out[0] = MAX2(out[0], p1[0]) + 0.01f;
+		out[1] = MAX2(out[1], p1[1]) + 0.01f;
+		out[2] = 0.0f;
+		p1[2] = 0.0f;
+
+		//copy_v3_v3(l->v->co, p1);
+	}
+	
+	for (i = 0; i < len; i++) {
+		edgeverts[i * 2][2] = 0.0f;
+		edgeverts[i * 2 + 1][2] = 0.0f;
+	}
+
+	/* do convexity test */
+	for (i = 0; i < len; i++) {
+		copy_v3_v3(v2, edgeverts[i * 2]);
+		copy_v3_v3(v3, edgeverts[i * 2 + 1]);
+
+		mid_v3_v3v3(mid, v2, v3);
+		
+		clen = 0;
+		for (j = 0; j < f->len; j++) {
+			p1 = projverts[j];
+			p2 = projverts[(j + 1) % f->len];
+			
+			copy_v3_v3(v1, p1);
+			copy_v3_v3(v2, p2);
+
+			shrink_edgef(v1, v2, fac1);
+
+			if (linecrossesf(p1, p2, mid, out)) clen++;
+		}
+		
+		if (clen % 2 == 0) {
+			loops[i][0] = NULL;
+		}
+	}
+	
+	/* do line crossing test */
+	for (i = 0; i < f->len; i++) {
+		p1 = projverts[i];
+		p2 = projverts[(i + 1) % f->len];
+		
+		copy_v3_v3(v1, p1);
+		copy_v3_v3(v2, p2);
+
+		shrink_edgef(v1, v2, fac1);
+
+		for (j = 0; j < len; j++) {
+			if (!loops[j][0]) {
+				continue;
+			}
+
+			p3 = edgeverts[j * 2];
+			p4 = edgeverts[j * 2 + 1];
+
+			if (linecrossesf(v1, v2, p3, p4)) {
+				loops[j][0] = NULL;
+			}
+		}
+	}
+
+	for (i = 0; i < len; i++) {
+		for (j = 0; j < len; j++) {
+			if (j != i && loops[i][0] && loops[j][0]) {
+				p1 = edgeverts[i * 2];
+				p2 = edgeverts[i * 2 + 1];
+				p3 = edgeverts[j * 2];
+				p4 = edgeverts[j * 2 + 1];
+
+				copy_v3_v3(v1, p1);
+				copy_v3_v3(v2, p2);
+
+				shrink_edgef(v1, v2, fac1);
+
+				if (linecrossesf(v1, v2, p3, p4)) {
+					loops[i][0] = NULL;
+				}
+			}
+		}
+	}
+
+	BLI_array_fixedstack_free(projverts);
+	BLI_array_fixedstack_free(edgeverts);
+}
diff --git a/source/blender/bmesh/intern/bmesh_polygon.h b/source/blender/bmesh/intern/bmesh_polygon.h
new file mode 100644
index 0000000..e5777d3
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_polygon.h
@@ -0,0 +1,53 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BMESH_POLYGON_H__
+#define __BMESH_POLYGON_H__
+
+/** \file blender/bmesh/intern/bmesh_polygon.h
+ *  \ingroup bmesh
+ */
+
+float BM_face_calc_area(BMFace *f);
+float BM_face_calc_perimeter(BMFace *f);
+void  BM_face_calc_center_bounds(BMFace *f, float center[3]);
+void  BM_face_calc_center_mean(BMFace *f, float center[3]);
+
+void  BM_face_normal_update(BMFace *f);
+void  BM_face_normal_update_vcos(BMesh *bm, BMFace *f, float no[3],
+                                 float const (*vertexCos)[3]);
+
+void  BM_edge_normals_update(BMEdge *e);
+
+void  BM_vert_normal_update(BMVert *v);
+void  BM_vert_normal_update_all(BMVert *v);
+
+void  BM_face_normal_flip(BMesh *bm, BMFace *f);
+int   BM_face_point_inside_test(BMFace *f, const float co[3]);
+
+void  BM_face_triangulate(BMesh *bm, BMFace *f, float (*projectverts)[3],
+                          const short newedge_oflag, const short newface_oflag, BMFace **newfaces,
+                          const short use_beauty);
+
+void  BM_face_legal_splits(BMesh *bm, BMFace *f, BMLoop *(*loops)[2], int len);
+
+#endif /* __BMESH_POLYGON_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_private.h b/source/blender/bmesh/intern/bmesh_private.h
new file mode 100644
index 0000000..6297e20
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_private.h
@@ -0,0 +1,75 @@
+/*
+ * ***** 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) 2004 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Geoffrey Bantle.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BMESH_PRIVATE_H__
+#define __BMESH_PRIVATE_H__
+
+/** \file blender/bmesh/intern/bmesh_private.h
+ *  \ingroup bmesh
+ *
+ *  Private function prototypes for bmesh public API.
+ *  This file is a grab-bag of functions from various
+ *  parts of the bmesh internals.
+ */
+
+/* returns positive nonzero on error */
+int bmesh_elem_check(void *element, const char htype);
+
+#define BM_CHECK_ELEMENT(el)                                                  \
+    if (bmesh_elem_check(el, ((BMHeader *)el)->htype)) {                      \
+        printf("check_element failure, with code %i on line %i in file\n"     \
+        "    \"%s\"\n\n",                                                     \
+        bmesh_elem_check(el, ((BMHeader *)el)->htype),                    \
+        __LINE__, __FILE__);                                                  \
+    }
+
+#define BM_DISK_EDGE_LINK_GET(e, v)  (                                        \
+	((v) == ((BMEdge *)(e))->v1) ?                                            \
+		&((e)->v1_disk_link) :                                                \
+		&((e)->v2_disk_link)                                                  \
+    )
+
+int bmesh_radial_length(BMLoop *l);
+int bmesh_disk_count(BMVert *v);
+
+/* 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 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))
+
+void calc_poly_plane(float (*verts)[3], const int nverts);
+void poly_rotate_plane(const float normal[3], float (*verts)[3], const int nverts);
+
+/* include the rest of our private declarations */
+#include "bmesh_structure.h"
+#include "bmesh_operators_private.h"
+
+#endif /* __BMESH_PRIVATE_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c
new file mode 100644
index 0000000..3543fd9
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_queries.c
@@ -0,0 +1,1160 @@
+/*
+ * ***** 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, Geoffrey Bantle, Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/intern/bmesh_queries.c
+ *  \ingroup bmesh
+ *
+ * This file contains functions for answering common
+ * Topological and geometric queries about a mesh, such
+ * as, "What is the angle between these two faces?" or,
+ * "How many faces are incident upon this vertex?" Tool
+ * authors should use the functions in this file instead
+ * of inspecting the mesh structure directly.
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_array.h"
+#include "BLI_math.h"
+
+#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.
+ */
+int BM_vert_in_edge(BMEdge *e, BMVert *v)
+{
+	return bmesh_vert_in_edge(e, v);
+}
+
+/**
+ * \brief Other Loop in Face Sharing an Edge
+ *
+ * Finds the other loop that shares \a v with \a e loop in \a f.
+ *
+ *     +----------+
+ *     |          |
+ *     |    f     |
+ *     |          |
+ *     +----------+ <-- return the face loop of this vertex.
+ *     v --> e
+ *     ^     ^ <------- These vert args define direction
+ *                      in the face to check.
+ *                      The faces loop direction is ignored.
+ *
+ */
+BMLoop *BM_face_other_edge_loop(BMFace *f, BMEdge *e, BMVert *v)
+{
+	BMLoop *l_iter;
+	BMLoop *l_first;
+
+	/* we could loop around the face too, but turns out this uses a lot
+	 * more iterations (approx double with quads, many more with 5+ ngons) */
+	l_iter = l_first = e->l;
+
+	do {
+		if (l_iter->e == e && l_iter->f == f) {
+			break;
+		}
+	} while ((l_iter = l_iter->radial_next) != l_first);
+	
+	return l_iter->v == v ? l_iter->prev : l_iter->next;
+}
+
+/**
+ * \brief Other Loop in Face Sharing a Vertex
+ *
+ * Finds the other loop in a face.
+ *
+ * This function returns a loop in \a f that shares an edge with \a v
+ * The direction is defined by \a v_prev, where the return value is
+ * the loop of what would be 'v_next'
+ *
+ *
+ *     +----------+ <-- return the face loop of this vertex.
+ *     |          |
+ *     |    f     |
+ *     |          |
+ *     +----------+
+ *     v_prev --> v
+ *     ^^^^^^     ^ <-- These vert args define direction
+ *                      in the face to check.
+ *                      The faces loop direction is ignored.
+ *
+ * \note \a v_prev and \a v _implicitly_ define an edge.
+ */
+BMLoop *BM_face_other_vert_loop(BMFace *f, BMVert *v_prev, BMVert *v)
+{
+	BMIter liter;
+	BMLoop *l_iter;
+
+	BLI_assert(BM_edge_exists(v_prev, v) != NULL);
+
+	BM_ITER_ELEM (l_iter, &liter, v, BM_LOOPS_OF_VERT) {
+		if (l_iter->f == f) {
+			break;
+		}
+	}
+
+	if (l_iter) {
+		if (l_iter->prev->v == v_prev) {
+			return l_iter->next;
+		}
+		else if (l_iter->next->v == v_prev) {
+			return l_iter->prev;
+		}
+		else {
+			/* invalid args */
+			BLI_assert(0);
+			return NULL;
+		}
+	}
+	else {
+		/* invalid args */
+		BLI_assert(0);
+		return NULL;
+	}
+}
+
+/**
+ * \brief Other Loop in Face Sharing a Vert
+ *
+ * Finds the other loop that shares \a v with \a e loop in \a f.
+ *
+ *     +----------+ <-- return the face loop of this vertex.
+ *     |          |
+ *     |          |
+ *     |          |
+ *     +----------+ <-- This vertex defines the direction.
+ *           l    v
+ *           ^ <------- This loop defines both the face to search
+ *                      and the edge, in combination with 'v'
+ *                      The faces loop direction is ignored.
+ */
+
+BMLoop *BM_loop_other_vert_loop(BMLoop *l, BMVert *v)
+{
+#if 0 /* works but slow */
+	return BM_face_other_vert_loop(l->f, BM_edge_other_vert(l->e, v), v);
+#else
+	BMEdge *e = l->e;
+	BMVert *v_prev = BM_edge_other_vert(e, v);
+	if (l->v == v) {
+		if (l->prev->v == v_prev) {
+			return l->next;
+		}
+		else {
+			BLI_assert(l->next->v == v_prev);
+
+			return l->prev;
+		}
+	}
+	else {
+		BLI_assert(l->v == v_prev);
+
+		if (l->prev->v == v) {
+			return l->prev->prev;
+		}
+		else {
+			BLI_assert(l->next->v == v);
+			return l->next->next;
+		}
+	}
+
+
+
+#endif
+}
+
+/**
+ * Returns TRUE if the vertex is used in a given face.
+ */
+
+int BM_vert_in_face(BMFace *f, BMVert *v)
+{
+	BMLoop *l_iter, *l_first;
+
+#ifdef USE_BMESH_HOLES
+	BMLoopList *lst;
+	for (lst = f->loops.first; lst; lst = lst->next)
+#endif
+	{
+#ifdef USE_BMESH_HOLES
+		l_iter = l_first = lst->first;
+#else
+		l_iter = l_first = f->l_first;
+#endif
+		do {
+			if (l_iter->v == v) {
+				return TRUE;
+			}
+		} while ((l_iter = l_iter->next) != l_first);
+	}
+
+	return FALSE;
+}
+
+/**
+ * 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)
+{
+	BMLoop *l_iter, *l_first;
+
+#ifdef USE_BMESH_HOLES
+	BMLoopList *lst;
+#endif
+
+	int i, count = 0;
+	
+	for (i = 0; i < len; i++) {
+		BMO_elem_flag_enable(bm, varr[i], BM_OVERLAP);
+	}
+
+#ifdef USE_BMESH_HOLES
+	for (lst = f->loops.first; lst; lst = lst->next)
+#endif
+	{
+
+#ifdef USE_BMESH_HOLES
+		l_iter = l_first = lst->first;
+#else
+		l_iter = l_first = f->l_first;
+#endif
+
+		do {
+			if (BMO_elem_flag_test(bm, l_iter->v, BM_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);
+
+	return count;
+}
+
+/**
+ * Returns whether or not a given edge is is part of a given face.
+ */
+int BM_edge_in_face(BMFace *f, BMEdge *e)
+{
+	BMLoop *l_iter;
+	BMLoop *l_first;
+
+	l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+
+	do {
+		if (l_iter->e == e) {
+			return TRUE;
+		}
+	} while ((l_iter = l_iter->next) != l_first);
+
+	return FALSE;
+}
+
+/**
+ * Returns whether or not two vertices are in
+ * a given edge
+ */
+int BM_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e)
+{
+	return bmesh_verts_in_edge(v1, v2, e);
+}
+
+/**
+ * Given a edge and one of its vertices, returns
+ * the other vertex.
+ */
+BMVert *BM_edge_other_vert(BMEdge *e, BMVert *v)
+{
+	return bmesh_edge_other_vert_get(e, v);
+}
+
+/**
+ * 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.
+ *
+ * \note This could (probably) be done more effieiently.
+ */
+BMEdge *BM_vert_other_disk_edge(BMVert *v, BMEdge *e_first)
+{
+	BMLoop *l_a;
+	int tot = 0;
+	int i;
+
+	BLI_assert(BM_vert_in_edge(e_first, v));
+
+	l_a = e_first->l;
+	do {
+		l_a = BM_loop_other_vert_loop(l_a, v);
+		l_a = BM_vert_in_edge(l_a->e, v) ? l_a : l_a->prev;
+		if (BM_edge_is_manifold(l_a->e)) {
+			l_a = l_a->radial_next;
+		}
+		else {
+			return NULL;
+		}
+
+		tot++;
+	} while (l_a != e_first->l);
+
+	/* we know the total, now loop half way */
+	tot /= 2;
+	i = 0;
+
+	l_a = e_first->l;
+	do {
+		if (i == tot) {
+			l_a = BM_vert_in_edge(l_a->e, v) ? l_a : l_a->prev;
+			return l_a->e;
+		}
+
+		l_a = BM_loop_other_vert_loop(l_a, v);
+		l_a = BM_vert_in_edge(l_a->e, v) ? l_a : l_a->prev;
+		if (BM_edge_is_manifold(l_a->e)) {
+			l_a = l_a->radial_next;
+		}
+		/* this wont have changed from the previous loop */
+
+
+		i++;
+	} while (l_a != e_first->l);
+
+	return NULL;
+}
+
+/**
+ * Returms edge length
+ */
+float BM_edge_calc_length(BMEdge *e)
+{
+	return len_v3v3(e->v1->co, e->v2->co);
+}
+
+/**
+ * Utility function, since enough times we have an edge
+ * and want to access 2 connected faces.
+ *
+ * \return TRUE when only 2 faces are found.
+ */
+int BM_edge_face_pair(BMEdge *e, BMFace **r_fa, BMFace **r_fb)
+{
+	BMLoop *la, *lb;
+
+	if ((la = e->l) &&
+	    (lb = la->radial_next) &&
+	    (lb->radial_next == la))
+	{
+		*r_fa = la->f;
+		*r_fb = lb->f;
+		return TRUE;
+	}
+	else {
+		*r_fa = NULL;
+		*r_fb = NULL;
+		return FALSE;
+	}
+}
+
+/**
+ * Utility function, since enough times we have an edge
+ * and want to access 2 connected loops.
+ *
+ * \return TRUE when only 2 faces are found.
+ */
+int BM_edge_loop_pair(BMEdge *e, BMLoop **r_la, BMLoop **r_lb)
+{
+	BMLoop *la, *lb;
+
+	if ((la = e->l) &&
+	    (lb = la->radial_next) &&
+	    (lb->radial_next == la))
+	{
+		*r_la = la;
+		*r_lb = lb;
+		return TRUE;
+	}
+	else {
+		*r_la = NULL;
+		*r_lb = NULL;
+		return FALSE;
+	}
+}
+
+/**
+ *	Returns the number of edges around this vertex.
+ */
+int BM_vert_edge_count(BMVert *v)
+{
+	return bmesh_disk_count(v);
+}
+
+int BM_vert_edge_count_nonwire(BMVert *v)
+{
+	int count = 0;
+	BMIter eiter;
+	BMEdge *edge;
+	BM_ITER_ELEM (edge, &eiter, v, BM_EDGES_OF_VERT) {
+		if (edge->l) {
+			count++;
+		}
+	}
+	return count;
+}
+/**
+ *	Returns the number of faces around this edge
+ */
+int BM_edge_face_count(BMEdge *e)
+{
+	int count = 0;
+
+	if (e->l) {
+		BMLoop *l_iter;
+		BMLoop *l_first;
+
+		l_iter = l_first = e->l;
+
+		do {
+			count++;
+		} while ((l_iter = l_iter->radial_next) != l_first);
+	}
+
+	return count;
+}
+
+/**
+ *	Returns the number of faces around this vert
+ */
+int BM_vert_face_count(BMVert *v)
+{
+	int count = 0;
+	BMLoop *l;
+	BMIter iter;
+
+	BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) {
+		count++;
+	}
+
+	return count;
+#if 0 //this code isn't working
+	BMEdge *curedge = NULL;
+
+	if (v->e) {
+		curedge = v->e;
+		do {
+			if (curedge->l) count += BM_edge_face_count(curedge);
+			curedge = bmesh_disk_edge_next(curedge, v);
+		} while (curedge != v->e);
+	}
+	return count;
+#endif
+}
+
+/**
+ * Tests whether or not the vertex is part of a wire edge.
+ * (ie: has no faces attached to it)
+ */
+int BM_vert_is_wire(BMVert *v)
+{
+	BMEdge *curedge;
+
+	if (v->e == NULL) {
+		return FALSE;
+	}
+	
+	curedge = v->e;
+	do {
+		if (curedge->l) {
+			return FALSE;
+		}
+
+		curedge = bmesh_disk_edge_next(curedge, v);
+	} while (curedge != v->e);
+
+	return TRUE;
+}
+
+/**
+ * Tests whether or not the edge is part of a wire.
+ * (ie: has no faces attached to it)
+ */
+int BM_edge_is_wire(BMEdge *e)
+{
+	return (e->l) ? FALSE : TRUE;
+}
+
+/**
+ * A vertex is non-manifold if it meets the following conditions:
+ * 1: Loose - (has no edges/faces incident upon it).
+ * 2: Joins two distinct regions - (two pyramids joined at the tip).
+ * 3: Is part of a an edge with more than 2 faces.
+ * 4: Is part of a wire edge.
+ */
+int BM_vert_is_manifold(BMVert *v)
+{
+	BMEdge *e, *oe;
+	BMLoop *l;
+	int len, count, flag;
+
+	if (v->e == NULL) {
+		/* loose vert */
+		return FALSE;
+	}
+
+	/* count edges while looking for non-manifold edges */
+	len = 0;
+	oe = e = v->e;
+	do {
+		/* loose edge or edge shared by more than two faces,
+		 * edges with 1 face user are OK, otherwise we could
+		 * use BM_edge_is_manifold() here */
+		if (e->l == NULL || bmesh_radial_length(e->l) > 2) {
+			return FALSE;
+		}
+		len++;
+	} while ((e = bmesh_disk_edge_next(e, v)) != oe);
+
+	count = 1;
+	flag = 1;
+	e = NULL;
+	oe = v->e;
+	l = oe->l;
+	while (e != oe) {
+		l = (l->v == v) ? l->prev : l->next;
+		e = l->e;
+		count++; /* count the edges */
+
+		if (flag && l->radial_next == l) {
+			/* we've hit the edge of an open mesh, reset once */
+			flag = 0;
+			count = 1;
+			oe = e;
+			e = NULL;
+			l = oe->l;
+		}
+		else if (l->radial_next == l) {
+			/* break the loop */
+			e = oe;
+		}
+		else {
+			l = l->radial_next;
+		}
+	}
+
+	if (count < len) {
+		/* vert shared by multiple regions */
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+/**
+ * Tests whether or not this edge is manifold.
+ * A manifold edge has exactly 2 faces attached to it.
+ */
+
+#if 1 /* fast path for checking manifold */
+int BM_edge_is_manifold(BMEdge *e)
+{
+	const BMLoop *l = e->l;
+	return (l && (l->radial_next != l) &&             /* not 0 or 1 face users */
+	             (l->radial_next->radial_next == l)); /* 2 face users */
+}
+#else
+int BM_edge_is_manifold(BMEdge *e)
+{
+	int count = BM_edge_face_count(e);
+	if (count == 2) {
+		return TRUE;
+	}
+	else {
+		return FALSE;
+	}
+}
+#endif
+
+/**
+ * Tests whether or not an edge is on the boundary
+ * of a shell (has one face associated with it)
+ */
+
+#if 1 /* fast path for checking boundary */
+int BM_edge_is_boundary(BMEdge *e)
+{
+	const BMLoop *l = e->l;
+	return (l && (l->radial_next == l));
+}
+#else
+int BM_edge_is_boundary(BMEdge *e)
+{
+	int count = BM_edge_face_count(e);
+	if (count == 1) {
+		return TRUE;
+	}
+	else {
+		return FALSE;
+	}
+}
+#endif
+
+/**
+ *  Counts the number of edges two faces share (if any)
+ */
+int BM_face_share_edge_count(BMFace *f1, BMFace *f2)
+{
+	BMLoop *l_iter;
+	BMLoop *l_first;
+	int count = 0;
+	
+	l_iter = l_first = BM_FACE_FIRST_LOOP(f1);
+	do {
+		if (bmesh_radial_face_find(l_iter->e, f2)) {
+			count++;
+		}
+	} while ((l_iter = l_iter->next) != l_first);
+
+	return count;
+}
+
+/**
+ *	Test if e1 shares any faces with e2
+ */
+int BM_edge_share_face_count(BMEdge *e1, BMEdge *e2)
+{
+	BMLoop *l;
+	BMFace *f;
+
+	if (e1->l && e2->l) {
+		l = e1->l;
+		do {
+			f = l->f;
+			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)
+{
+	return (e1->v1 == e2->v1 ||
+	        e1->v1 == e2->v2 ||
+	        e1->v2 == e2->v1 ||
+	        e1->v2 == e2->v2);
+}
+
+/**
+ *	Return the shared vertex between the two edges or NULL
+ */
+BMVert *BM_edge_share_vert(BMEdge *e1, BMEdge *e2)
+{
+	if (BM_vert_in_edge(e2, e1->v1)) {
+		return e1->v1;
+	}
+	else if (BM_vert_in_edge(e2, e1->v2)) {
+		return e1->v2;
+	}
+	else {
+		return NULL;
+	}
+}
+
+/**
+ * \brief Return the Loop Shared by Face and Vertex
+ *
+ * Finds the loop used which uses \a v in face loop \a l
+ *
+ * \note currenly this just uses simple loop in future may be speeded up
+ * using radial vars
+ */
+BMLoop *BM_face_vert_share_loop(BMFace *f, BMVert *v)
+{
+	BMLoop *l_first;
+	BMLoop *l_iter;
+
+	l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+	do {
+		if (l_iter->v == v) {
+			return l_iter;
+		}
+	} while ((l_iter = l_iter->next) != l_first);
+
+	return NULL;
+}
+
+/**
+ * \brief Return the Loop Shared by Face and Edge
+ *
+ * Finds the loop used which uses \a e in face loop \a l
+ *
+ * \note currenly this just uses simple loop in future may be speeded up
+ * using radial vars
+ */
+BMLoop *BM_face_edge_share_loop(BMFace *f, BMEdge *e)
+{
+	BMLoop *l_first;
+	BMLoop *l_iter;
+
+	l_iter = l_first = e->l;
+	do {
+		if (l_iter->f == f) {
+			return l_iter;
+		}
+	} while ((l_iter = l_iter->radial_next) != l_first);
+
+	return NULL;
+}
+
+/**
+ * Returns the verts of an edge as used in a face
+ * if used in a face at all, otherwise just assign as used in the edge.
+ *
+ * Useful to get a deterministic winding order when calling
+ * BM_face_create_ngon() on an arbitrary array of verts,
+ * though be sure to pick an edge which has a face.
+ *
+ * \note This is infact quite a simple check, mainly include this function so the intent is more obvious.
+ * We know these 2 verts will _always_ make up the loops edge
+ */
+void BM_edge_ordered_verts_ex(BMEdge *edge, BMVert **r_v1, BMVert **r_v2,
+                              BMLoop *edge_loop)
+{
+	BLI_assert(edge_loop->e == edge);
+	*r_v1 = edge_loop->v;
+	*r_v2 = edge_loop->next->v;
+}
+
+void BM_edge_ordered_verts(BMEdge *edge, BMVert **r_v1, BMVert **r_v2)
+{
+	BM_edge_ordered_verts_ex(edge, r_v1, r_v2, edge->l);
+}
+
+/**
+ * Calculates the angle between the previous and next loops
+ * (angle at this loops face corner).
+ *
+ * \return angle in radians
+ */
+float BM_loop_calc_face_angle(BMLoop *l)
+{
+	return angle_v3v3v3(l->prev->v->co,
+	                    l->v->co,
+	                    l->next->v->co);
+}
+
+/**
+ * \brief BM_loop_calc_face_normal
+ *
+ * Calculate the normal at this loop corner or fallback to the face normal on straignt lines.
+ *
+ * \param bm The BMesh
+ * \param l The loop to calculate the normal at
+ * \param r_normal Resulting normal
+ */
+void BM_loop_calc_face_normal(BMLoop *l, float r_normal[3])
+{
+	if (normal_tri_v3(r_normal,
+	                  l->prev->v->co,
+	                  l->v->co,
+	                  l->next->v->co) != 0.0f)
+	{
+		return;
+	}
+	else {
+		copy_v3_v3(r_normal, l->f->no);
+	}
+}
+
+/**
+ * \brief BM_loop_calc_face_tangent
+ *
+ * Calculate the tangent at this loop corner or fallback to the face normal on straignt lines.
+ * This vector always points inward into the face.
+ *
+ * \param bm The BMesh
+ * \param l The loop to calculate the tangent at
+ * \param r_tangent Resulting tangent
+ */
+void BM_loop_calc_face_tangent(BMLoop *l, float r_tangent[3])
+{
+	float v_prev[3];
+	float v_next[3];
+
+	sub_v3_v3v3(v_prev, l->prev->v->co, l->v->co);
+	sub_v3_v3v3(v_next, l->v->co, l->next->v->co);
+
+	normalize_v3(v_prev);
+	normalize_v3(v_next);
+
+	if (compare_v3v3(v_prev, v_next, FLT_EPSILON) == FALSE) {
+		float dir[3];
+		float nor[3]; /* for this purpose doesn't need to be normalized */
+		add_v3_v3v3(dir, v_prev, v_next);
+		cross_v3_v3v3(nor, v_prev, v_next);
+		cross_v3_v3v3(r_tangent, dir, nor);
+	}
+	else {
+		/* prev/next are the same - compare with face normal since we don't have one */
+		cross_v3_v3v3(r_tangent, v_next, l->f->no);
+	}
+
+	normalize_v3(r_tangent);
+}
+
+/**
+ * \brief BMESH EDGE/FACE ANGLE
+ *
+ *  Calculates the angle between two faces.
+ *  Assumes the face normals are correct.
+ *
+ * \return angle in radians
+ */
+float BM_edge_calc_face_angle(BMEdge *e)
+{
+	if (BM_edge_is_manifold(e)) {
+		BMLoop *l1 = e->l;
+		BMLoop *l2 = e->l->radial_next;
+		return angle_normalized_v3v3(l1->f->no, l2->f->no);
+	}
+	else {
+		return DEG2RADF(90.0f);
+	}
+}
+
+/**
+ * \brief BMESH EDGE/FACE TANGENT
+ *
+ * Calculate the tangent at this loop corner or fallback to the face normal on straignt lines.
+ * This vector always points inward into the face.
+ *
+ * \brief BM_edge_calc_face_tangent
+ * \param e
+ * \param e_loop The loop to calculate the tangent at,
+ * used to get the face and winding direction.
+ */
+
+void BM_edge_calc_face_tangent(BMEdge *e, BMLoop *e_loop, float r_tangent[3])
+{
+	float tvec[3];
+	BMVert *v1, *v2;
+	BM_edge_ordered_verts_ex(e, &v1, &v2, e_loop);
+
+	sub_v3_v3v3(tvec, v1->co, v2->co); /* use for temp storage */
+	/* note, we could average the tangents of both loops,
+	 * for non flat ngons it will give a better direction */
+	cross_v3_v3v3(r_tangent, tvec, e_loop->f->no);
+	normalize_v3(r_tangent);
+}
+
+/**
+ * \brief BMESH VERT/EDGE ANGLE
+ *
+ * Calculates the angle a verts 2 edges.
+ *
+ * \returns the angle in radians
+ */
+float BM_vert_calc_edge_angle(BMVert *v)
+{
+	BMEdge *e1, *e2;
+
+	/* saves BM_vert_edge_count(v) and and edge iterator,
+	 * get the edges and count them both at once */
+
+	if ((e1 = v->e) &&
+	    (e2 =  bmesh_disk_edge_next(e1, v)) &&
+	    /* make sure we come full circle and only have 2 connected edges */
+	    (e1 == bmesh_disk_edge_next(e2, v)))
+	{
+		BMVert *v1 = BM_edge_other_vert(e1, v);
+		BMVert *v2 = BM_edge_other_vert(e2, v);
+
+		return M_PI - angle_v3v3v3(v1->co, v->co, v2->co);
+	}
+	else {
+		return DEG2RADF(90.0f);
+	}
+}
+
+/**
+ * \note this isn't optimal to run on an array of verts,
+ * see 'solidify_add_thickness' for a function which runs on an array.
+ */
+float BM_vert_calc_shell_factor(BMVert *v)
+{
+	BMIter iter;
+	BMLoop *l;
+	float accum_shell = 0.0f;
+	float accum_angle = 0.0f;
+
+	BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) {
+		const float face_angle = BM_loop_calc_face_angle(l);
+		accum_shell += shell_angle_to_dist(angle_normalized_v3v3(v->no, l->f->no)) * face_angle;
+		accum_angle += face_angle;
+	}
+
+	return accum_shell / accum_angle;
+}
+
+/**
+ * Returns the edge existing between v1 and v2, or NULL if there isn't one.
+ *
+ * \note multiple edges may exist between any two vertices, and therefore
+ * this function only returns the first one found.
+ */
+BMEdge *BM_edge_exists(BMVert *v1, BMVert *v2)
+{
+	BMIter iter;
+	BMEdge *e;
+
+	BM_ITER_ELEM (e, &iter, v1, BM_EDGES_OF_VERT) {
+		if (e->v1 == v2 || e->v2 == v2)
+			return e;
+	}
+
+	return NULL;
+}
+
+/**
+ * Given a set of vertices \a varr, find out if
+ * all those vertices overlap an existing face.
+ *
+ * \note Making a face here is valid but in some cases you wont want to
+ * make a face thats part of another.
+ *
+ * \returns TRUE for overlap
+ *
+ */
+int BM_face_exists_overlap(BMesh *bm, BMVert **varr, int len, BMFace **r_overlapface)
+{
+	BMIter viter;
+	BMFace *f;
+	int i, amount;
+
+	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);
+			if (amount >= len) {
+				if (r_overlapface) {
+					*r_overlapface = f;
+				}
+				return TRUE;
+			}
+		}
+	}
+
+	if (r_overlapface) {
+		*r_overlapface = NULL;
+	}
+
+	return FALSE;
+}
+
+/**
+ * Given a set of vertices (varr), find out if
+ * 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)
+{
+	BMIter viter;
+	BMFace *f;
+	int i, amount;
+
+	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);
+			if (amount == len && amount == f->len) {
+				if (r_existface) {
+					*r_existface = f;
+				}
+				return TRUE;
+			}
+		}
+	}
+
+	if (r_existface) {
+		*r_existface = NULL;
+	}
+	return FALSE;
+}
+
+
+/**
+ * Given a set of vertices and edges (\a varr, \a earr), find out if
+ * all those vertices are filled in by existing faces that _only_ use those vertices.
+ *
+ * This is for use in cases where creating a face is possible but would result in
+ * many overlapping faces.
+ *
+ * An example of how this is used: when 2 tri's are selected that share an edge,
+ * pressing Fkey would make a new overlapping quad (without a check like this)
+ *
+ * \a earr and \a varr can be in any order, however they _must_ form a closed loop.
+ */
+int BM_face_exists_multi(BMVert **varr, BMEdge **earr, int len)
+{
+	BMFace *f;
+	BMEdge *e;
+	BMVert *v;
+	int ok;
+	int tot_tag;
+
+	BMIter fiter;
+	BMIter viter;
+
+	int i;
+
+	for (i = 0; i < len; i++) {
+		/* save some time by looping over edge faces rather then vert faces
+		 * will still loop over some faces twice but not as many */
+		BM_ITER_ELEM (f, &fiter, earr[i], BM_FACES_OF_EDGE) {
+			BM_elem_flag_disable(f, BM_ELEM_INTERNAL_TAG);
+			BM_ITER_ELEM (v, &viter, f, BM_VERTS_OF_FACE) {
+				BM_elem_flag_disable(v, BM_ELEM_INTERNAL_TAG);
+			}
+		}
+
+		/* clear all edge tags */
+		BM_ITER_ELEM (e, &fiter, varr[i], BM_EDGES_OF_VERT) {
+			BM_elem_flag_disable(e, BM_ELEM_INTERNAL_TAG);
+		}
+	}
+
+	/* now tag all verts and edges in the boundary array as true so
+	 * we can know if a face-vert is from our array */
+	for (i = 0; i < len; i++) {
+		BM_elem_flag_enable(varr[i], BM_ELEM_INTERNAL_TAG);
+		BM_elem_flag_enable(earr[i], BM_ELEM_INTERNAL_TAG);
+	}
+
+
+	/* so! boundary is tagged, everything else cleared */
+
+
+	/* 1) tag all faces connected to edges - if all their verts are boundary */
+	tot_tag = 0;
+	for (i = 0; i < len; i++) {
+		BM_ITER_ELEM (f, &fiter, earr[i], BM_FACES_OF_EDGE) {
+			if (!BM_elem_flag_test(f, BM_ELEM_INTERNAL_TAG)) {
+				ok = TRUE;
+				BM_ITER_ELEM (v, &viter, f, BM_VERTS_OF_FACE) {
+					if (!BM_elem_flag_test(v, BM_ELEM_INTERNAL_TAG)) {
+						ok = FALSE;
+						break;
+					}
+				}
+
+				if (ok) {
+					/* we only use boundary verts */
+					BM_elem_flag_enable(f, BM_ELEM_INTERNAL_TAG);
+					tot_tag++;
+				}
+			}
+			else {
+				/* we already found! */
+			}
+		}
+	}
+
+	if (tot_tag == 0) {
+		/* no faces use only boundary verts, quit early */
+		return FALSE;
+	}
+
+	/* 2) loop over non-boundary edges that use boundary verts,
+	 *    check each have 2 tagges faces connected (faces that only use 'varr' verts) */
+	ok = TRUE;
+	for (i = 0; i < len; i++) {
+		BM_ITER_ELEM (e, &fiter, varr[i], BM_EDGES_OF_VERT) {
+
+			if (/* non-boundary edge */
+			    BM_elem_flag_test(e, BM_ELEM_INTERNAL_TAG) == FALSE &&
+			    /* ...using boundary verts */
+			    BM_elem_flag_test(e->v1, BM_ELEM_INTERNAL_TAG) == TRUE &&
+			    BM_elem_flag_test(e->v2, BM_ELEM_INTERNAL_TAG) == TRUE)
+			{
+				int tot_face_tag = 0;
+				BM_ITER_ELEM (f, &fiter, e, BM_FACES_OF_EDGE) {
+					if (BM_elem_flag_test(f, BM_ELEM_INTERNAL_TAG)) {
+						tot_face_tag++;
+					}
+				}
+
+				if (tot_face_tag != 2) {
+					ok = FALSE;
+					break;
+				}
+
+			}
+		}
+
+		if (ok == FALSE) {
+			break;
+		}
+	}
+
+	return ok;
+}
+
+/* same as 'BM_face_exists_multi' but built vert array from edges */
+int BM_face_exists_multi_edge(BMEdge **earr, int len)
+{
+	BMVert **varr;
+	BLI_array_fixedstack_declare(varr, BM_NGON_STACK_SIZE, len, __func__);
+
+	int ok;
+	int i, i_next;
+
+	/* first check if verts have edges, if not we can bail out early */
+	ok = TRUE;
+	for (i = len - 1, i_next = 0; i_next < len; (i = i_next++)) {
+		if (!(varr[i] = BM_edge_share_vert(earr[i], earr[i_next]))) {
+			ok = FALSE;
+			break;
+		}
+	}
+
+	if (ok == FALSE) {
+		BMESH_ASSERT(0);
+		BLI_array_fixedstack_free(varr);
+		return FALSE;
+	}
+
+	ok = BM_face_exists_multi(varr, earr, len);
+
+	BLI_array_fixedstack_free(varr);
+
+	return ok;
+}
diff --git a/source/blender/bmesh/intern/bmesh_queries.h b/source/blender/bmesh/intern/bmesh_queries.h
new file mode 100644
index 0000000..aefeb80
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_queries.h
@@ -0,0 +1,90 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BMESH_QUERIES_H__
+#define __BMESH_QUERIES_H__
+
+/** \file blender/bmesh/intern/bmesh_queries.h
+ *  \ingroup bmesh
+ */
+
+int     BM_vert_in_face(BMFace *f, BMVert *v);
+int     BM_verts_in_face(BMesh *bm, BMFace *f, BMVert **varr, int len);
+
+int     BM_edge_in_face(BMFace *f, BMEdge *e);
+
+int     BM_vert_in_edge(BMEdge *e, BMVert *v);
+int     BM_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e);
+
+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_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);
+
+int     BM_vert_edge_count_nonwire(BMVert *v);
+int     BM_vert_edge_count(BMVert *v);
+int     BM_edge_face_count(BMEdge *e);
+int     BM_vert_face_count(BMVert *v);
+BMEdge *BM_vert_other_disk_edge(BMVert *v, BMEdge *e);
+
+int     BM_vert_is_wire(BMVert *v);
+int     BM_edge_is_wire(BMEdge *e);
+
+int     BM_vert_is_manifold(BMVert *v);
+int     BM_edge_is_manifold(BMEdge *e);
+int     BM_edge_is_boundary(BMEdge *e);
+
+float   BM_loop_calc_face_angle(BMLoop *l);
+void    BM_loop_calc_face_normal(BMLoop *l, float r_normal[3]);
+void    BM_loop_calc_face_tangent(BMLoop *l, float r_tangent[3]);
+
+float   BM_edge_calc_face_angle(BMEdge *e);
+void    BM_edge_calc_face_tangent(BMEdge *e, BMLoop *e_loop, float r_tangent[3]);
+
+float   BM_vert_calc_edge_angle(BMVert *v);
+float   BM_vert_calc_shell_factor(BMVert *v);
+
+BMEdge *BM_edge_exists(BMVert *v1, BMVert *v2);
+
+int     BM_face_exists_overlap(BMesh *bm, BMVert **varr, int len, BMFace **r_existface);
+
+int     BM_face_exists(BMesh *bm, 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_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);
+
+BMVert *BM_edge_share_vert(BMEdge *e1, BMEdge *e2);
+BMLoop *BM_face_vert_share_loop(BMFace *f, BMVert *v);
+BMLoop *BM_face_edge_share_loop(BMFace *f, BMEdge *e);
+
+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);
+
+#endif /* __BMESH_QUERIES_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_structure.c b/source/blender/bmesh/intern/bmesh_structure.c
new file mode 100644
index 0000000..7fcd6f3
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_structure.c
@@ -0,0 +1,571 @@
+/*
+ * ***** 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) 2007 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Geoffrey Bantle.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/intern/bmesh_structure.c
+ *  \ingroup bmesh
+ *
+ * Low level routines for manipulating the BM structure.
+ */
+
+#include "BLI_utildefines.h"
+
+#include "bmesh.h"
+#include "intern/bmesh_private.h"
+
+/**
+ *	MISC utility functions.
+ */
+
+int bmesh_vert_in_edge(BMEdge *e, BMVert *v)
+{
+	if (e->v1 == v || e->v2 == v) return TRUE;
+	return FALSE;
+}
+int bmesh_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e)
+{
+	if (e->v1 == v1 && e->v2 == v2) return TRUE;
+	else if (e->v1 == v2 && e->v2 == v1) return TRUE;
+	return FALSE;
+}
+
+BMVert *bmesh_edge_other_vert_get(BMEdge *e, BMVert *v)
+{
+	if (e->v1 == v) {
+		return e->v2;
+	}
+	else if (e->v2 == v) {
+		return e->v1;
+	}
+	return NULL;
+}
+
+int bmesh_edge_swapverts(BMEdge *e, BMVert *orig, BMVert *newv)
+{
+	if (e->v1 == orig) {
+		e->v1 = newv;
+		e->v1_disk_link.next = e->v1_disk_link.prev = NULL;
+		return TRUE;
+	}
+	else if (e->v2 == orig) {
+		e->v2 = newv;
+		e->v2_disk_link.next = e->v2_disk_link.prev = NULL;
+		return TRUE;
+	}
+	return FALSE;
+}
+
+/**
+ * \section bm_cycles BMesh Cycles
+ * (this is somewhat outdate, though bits of its API are still used) - joeedh
+ *
+ * Cycles are circular doubly linked lists that form the basis of adjacency
+ * information in the BME modeler. Full adjacency relations can be derived
+ * from examining these cycles very quickly. Although each cycle is a double
+ * circular linked list, each one is considered to have a 'base' or 'head',
+ * and care must be taken by Euler code when modifying the contents of a cycle.
+ *
+ * The contents of this file are split into two parts. First there are the
+ * bmesh_cycle family of functions which are generic circular double linked list
+ * procedures. The second part contains higher level procedures for supporting
+ * modification of specific cycle types.
+ *
+ * The three cycles explicitly stored in the BM data structure are as follows:
+ *
+ *
+ * 1: The Disk Cycle - A circle of edges around a vertex
+ * Base: vertex->edge pointer.
+ *
+ * This cycle is the most complicated in terms of its structure. Each bmesh_Edge contains
+ * two bmesh_CycleNode structures to keep track of that edges membership in the disk cycle
+ * of each of its vertices. However for any given vertex it may be the first in some edges
+ * in its disk cycle and the second for others. The bmesh_disk_XXX family of functions contain
+ * some nice utilities for navigating disk cycles in a way that hides this detail from the
+ * tool writer.
+ *
+ * Note that the disk cycle is completely independent from face data. One advantage of this
+ * is that wire edges are fully integrated into the topology database. Another is that the
+ * the disk cycle has no problems dealing with non-manifold conditions involving faces.
+ *
+ * Functions relating to this cycle:
+ * - #bmesh_disk_edge_append
+ * - #bmesh_disk_edge_remove
+ * - #bmesh_disk_edge_next
+ * - #bmesh_disk_edge_prev
+ * - #bmesh_disk_facevert_count
+ * - #bmesh_disk_faceedge_find_first
+ * - #bmesh_disk_faceedge_find_next
+ *
+ *
+ * 2: The Radial Cycle - A circle of face edges (bmesh_Loop) around an edge
+ * Base: edge->l->radial structure.
+ *
+ * The radial cycle is similar to the radial cycle in the radial edge data structure.*
+ * Unlike the radial edge however, the radial cycle does not require a large amount of memory
+ * to store non-manifold conditions since BM does not keep track of region/shell information.
+ *
+ * Functions relating to this cycle:
+ * - #bmesh_radial_append
+ * - #bmesh_radial_loop_remove
+ * - #bmesh_radial_face_find
+ * - #bmesh_radial_facevert_count
+ * - #bmesh_radial_faceloop_find_first
+ * - #bmesh_radial_faceloop_find_next
+ * - #bmesh_radial_validate
+ *
+ *
+ * 3: The Loop Cycle - A circle of face edges around a polygon.
+ * Base: polygon->lbase.
+ *
+ * The loop cycle keeps track of a faces vertices and edges. It should be noted that the
+ * direction of a loop cycle is either CW or CCW depending on the face normal, and is
+ * not oriented to the faces editedges.
+ *
+ * Functions relating to this cycle:
+ * - bmesh_cycle_XXX family of functions.
+ *
+ *
+ * \note the order of elements in all cycles except the loop cycle is undefined. This
+ * leads to slightly increased seek time for deriving some adjacency relations, however the
+ * advantage is that no intrinsic properties of the data structures are dependent upon the
+ * cycle order and all non-manifold conditions are represented trivially.
+ */
+int bmesh_disk_edge_append(BMEdge *e, BMVert *v)
+{
+	if (!v->e) {
+		BMDiskLink *dl1 = BM_DISK_EDGE_LINK_GET(e, v);
+
+		v->e = e;
+		dl1->next = dl1->prev = e;
+	}
+	else {
+		BMDiskLink *dl1, *dl2, *dl3;
+
+		dl1 = BM_DISK_EDGE_LINK_GET(e, v);
+		dl2 = BM_DISK_EDGE_LINK_GET(v->e, v);
+		dl3 = dl2->prev ? BM_DISK_EDGE_LINK_GET(dl2->prev, v) : NULL;
+
+		dl1->next = v->e;
+		dl1->prev = dl2->prev;
+
+		dl2->prev = e;
+		if (dl3)
+			dl3->next = e;
+	}
+
+	return TRUE;
+}
+
+void bmesh_disk_edge_remove(BMEdge *e, BMVert *v)
+{
+	BMDiskLink *dl1, *dl2;
+
+	dl1 = BM_DISK_EDGE_LINK_GET(e, v);
+	if (dl1->prev) {
+		dl2 = BM_DISK_EDGE_LINK_GET(dl1->prev, v);
+		dl2->next = dl1->next;
+	}
+
+	if (dl1->next) {
+		dl2 = BM_DISK_EDGE_LINK_GET(dl1->next, v);
+		dl2->prev = dl1->prev;
+	}
+
+	if (v->e == e)
+		v->e = (e != dl1->next) ? dl1->next : NULL;
+
+	dl1->next = dl1->prev = NULL;
+}
+
+/**
+ * \brief Next Disk Edge
+ *
+ *	Find the next edge in a disk cycle
+ *
+ *	\return Pointer to the next edge in the disk cycle for the vertex v.
+ */
+BMEdge *bmesh_disk_edge_next(BMEdge *e, BMVert *v)
+{
+	if (v == e->v1)
+		return e->v1_disk_link.next;
+	if (v == e->v2)
+		return e->v2_disk_link.next;
+	return NULL;
+}
+
+BMEdge *bmesh_disk_edge_prev(BMEdge *e, BMVert *v)
+{
+	if (v == e->v1)
+		return e->v1_disk_link.prev;
+	if (v == e->v2)
+		return e->v2_disk_link.prev;
+	return NULL;
+}
+
+BMEdge *bmesh_disk_edge_exists(BMVert *v1, BMVert *v2)
+{
+	BMEdge *e_iter, *e_first;
+	
+	if (v1->e) {
+		e_first = e_iter = v1->e;
+
+		do {
+			if (bmesh_verts_in_edge(v1, v2, e_iter)) {
+				return e_iter;
+			}
+		} while ((e_iter = bmesh_disk_edge_next(e_iter, v1)) != e_first);
+	}
+	
+	return NULL;
+}
+
+int bmesh_disk_count(BMVert *v)
+{
+	if (v->e) {
+		BMEdge *e_first, *e_iter;
+		int count = 0;
+
+		e_iter = e_first = v->e;
+
+		do {
+			if (!e_iter) {
+				return 0;
+			}
+
+			if (count >= (1 << 20)) {
+				printf("bmesh error: infinite loop in disk cycle!\n");
+				return 0;
+			}
+			count++;
+		} while ((e_iter = bmesh_disk_edge_next(e_iter, v)) != e_first);
+		return count;
+	}
+	else {
+		return 0;
+	}
+}
+
+int bmesh_disk_validate(int len, BMEdge *e, BMVert *v)
+{
+	BMEdge *e_iter;
+
+	if (!BM_vert_in_edge(e, v))
+		return FALSE;
+	if (bmesh_disk_count(v) != len || len == 0)
+		return FALSE;
+
+	e_iter = e;
+	do {
+		if (len != 1 && bmesh_disk_edge_prev(e_iter, v) == e_iter) {
+			return FALSE;
+		}
+	} while ((e_iter = bmesh_disk_edge_next(e_iter, v)) != e);
+
+	return TRUE;
+}
+
+/**
+ * \brief DISK COUNT FACE VERT
+ *
+ * Counts the number of loop users
+ * for this vertex. Note that this is
+ * equivalent to counting the number of
+ * faces incident upon this vertex
+ */
+int bmesh_disk_facevert_count(BMVert *v)
+{
+	/* is there an edge on this vert at all */
+	if (v->e) {
+		BMEdge *e_first, *e_iter;
+		int count = 0;
+
+		/* first, loop around edge */
+		e_first = e_iter = v->e;
+		do {
+			if (e_iter->l) {
+				count += bmesh_radial_facevert_count(e_iter->l, v);
+			}
+		} while ((e_iter = bmesh_disk_edge_next(e_iter, v)) != e_first);
+		return count;
+	}
+	else {
+		return 0;
+	}
+}
+
+/**
+ * \brief FIND FIRST FACE EDGE
+ *
+ * Finds the first edge in a vertices
+ * Disk cycle that has one of this
+ * vert's loops attached
+ * to it.
+ */
+BMEdge *bmesh_disk_faceedge_find_first(BMEdge *e, BMVert *v)
+{
+	BMEdge *searchedge = NULL;
+	searchedge = e;
+	do {
+		if (searchedge->l && bmesh_radial_facevert_count(searchedge->l, v)) {
+			return searchedge;
+		}
+	} while ((searchedge = bmesh_disk_edge_next(searchedge, v)) != e);
+
+	return NULL;
+}
+
+BMEdge *bmesh_disk_faceedge_find_next(BMEdge *e, BMVert *v)
+{
+	BMEdge *searchedge = NULL;
+	searchedge = bmesh_disk_edge_next(e, v);
+	do {
+		if (searchedge->l && bmesh_radial_facevert_count(searchedge->l, v)) {
+			return searchedge;
+		}
+	} while ((searchedge = bmesh_disk_edge_next(searchedge, v)) != e);
+	return e;
+}
+
+/*****radial cycle functions, e.g. loops surrounding edges**** */
+int bmesh_radial_validate(int radlen, BMLoop *l)
+{
+	BMLoop *l_iter = l;
+	int i = 0;
+	
+	if (bmesh_radial_length(l) != radlen)
+		return FALSE;
+
+	do {
+		if (UNLIKELY(!l_iter)) {
+			BMESH_ASSERT(0);
+			return FALSE;
+		}
+		
+		if (l_iter->e != l->e)
+			return FALSE;
+		if (l_iter->v != l->e->v1 && l_iter->v != l->e->v2)
+			return FALSE;
+		
+		if (UNLIKELY(i > BM_LOOP_RADIAL_MAX)) {
+			BMESH_ASSERT(0);
+			return FALSE;
+		}
+		
+		i++;
+	} while ((l_iter = l_iter->radial_next) != l);
+
+	return TRUE;
+}
+
+/**
+ * \brief BMESH RADIAL REMOVE LOOP
+ *
+ * Removes a loop from an radial cycle. If edge e is non-NULL
+ * it should contain the radial cycle, and it will also get
+ * updated (in the case that the edge's link into the radial
+ * cycle was the loop which is being removed from the cycle).
+ */
+void bmesh_radial_loop_remove(BMLoop *l, BMEdge *e)
+{
+	/* if e is non-NULL, l must be in the radial cycle of e */
+	if (UNLIKELY(e && e != l->e)) {
+		BMESH_ASSERT(0);
+	}
+
+	if (l->radial_next != l) {
+		if (e && l == e->l)
+			e->l = l->radial_next;
+
+		l->radial_next->radial_prev = l->radial_prev;
+		l->radial_prev->radial_next = l->radial_next;
+	}
+	else {
+		if (e) {
+			if (l == e->l) {
+				e->l = NULL;
+			}
+			else {
+				BMESH_ASSERT(0);
+			}
+		}
+	}
+
+	/* l is no longer in a radial cycle; empty the links
+	 * to the cycle and the link back to an edge */
+	l->radial_next = l->radial_prev = NULL;
+	l->e = NULL;
+}
+
+
+/**
+ * \brief BME RADIAL FIND FIRST FACE VERT
+ *
+ * Finds the first loop of v around radial
+ * cycle
+ */
+BMLoop *bmesh_radial_faceloop_find_first(BMLoop *l, BMVert *v)
+{
+	BMLoop *l_iter;
+	l_iter = l;
+	do {
+		if (l_iter->v == v) {
+			return l_iter;
+		}
+	} while ((l_iter = l_iter->radial_next) != l);
+	return NULL;
+}
+
+BMLoop *bmesh_radial_faceloop_find_next(BMLoop *l, BMVert *v)
+{
+	BMLoop *l_iter;
+	l_iter = l->radial_next;
+	do {
+		if (l_iter->v == v) {
+			return l_iter;
+		}
+	} while ((l_iter = l_iter->radial_next) != l);
+	return l;
+}
+
+int bmesh_radial_length(BMLoop *l)
+{
+	BMLoop *l_iter = l;
+	int i = 0;
+
+	if (!l)
+		return 0;
+
+	do {
+		if (UNLIKELY(!l_iter)) {
+			/* radial cycle is broken (not a circulat loop) */
+			BMESH_ASSERT(0);
+			return 0;
+		}
+		
+		i++;
+		if (UNLIKELY(i >= BM_LOOP_RADIAL_MAX)) {
+			BMESH_ASSERT(0);
+			return -1;
+		}
+	} while ((l_iter = l_iter->radial_next) != l);
+
+	return i;
+}
+
+void bmesh_radial_append(BMEdge *e, BMLoop *l)
+{
+	if (e->l == NULL) {
+		e->l = l;
+		l->radial_next = l->radial_prev = l;
+	}
+	else {
+		l->radial_prev = e->l;
+		l->radial_next = e->l->radial_next;
+
+		e->l->radial_next->radial_prev = l;
+		e->l->radial_next = l;
+
+		e->l = l;
+	}
+
+	if (UNLIKELY(l->e && l->e != e)) {
+		/* l is already in a radial cycle for a different edge */
+		BMESH_ASSERT(0);
+	}
+	
+	l->e = e;
+}
+
+int bmesh_radial_face_find(BMEdge *e, BMFace *f)
+{
+	BMLoop *l_iter;
+	int i, len;
+
+	len = bmesh_radial_length(e->l);
+	for (i = 0, l_iter = e->l; i < len; i++, l_iter = l_iter->radial_next) {
+		if (l_iter->f == f)
+			return TRUE;
+	}
+	return FALSE;
+}
+
+/**
+ * \brief RADIAL COUNT FACE VERT
+ *
+ * Returns the number of times a vertex appears
+ * in a radial cycle
+ */
+int bmesh_radial_facevert_count(BMLoop *l, BMVert *v)
+{
+	BMLoop *l_iter;
+	int count = 0;
+	l_iter = l;
+	do {
+		if (l_iter->v == v) {
+			count++;
+		}
+	} while ((l_iter = l_iter->radial_next) != l);
+
+	return count;
+}
+
+/*****loop cycle functions, e.g. loops surrounding a face**** */
+int bmesh_loop_validate(BMFace *f)
+{
+	int i;
+	int len = f->len;
+	BMLoop *l_iter, *l_first;
+
+	l_first = BM_FACE_FIRST_LOOP(f);
+
+	if (l_first == NULL) {
+		return FALSE;
+	}
+
+	/* Validate that the face loop cycle is the length specified by f->len */
+	for (i = 1, l_iter = l_first->next; i < len; i++, l_iter = l_iter->next) {
+		if ((l_iter->f != f) ||
+		    (l_iter == l_first))
+		{
+			return FALSE;
+		}
+	}
+	if (l_iter != l_first) {
+		return FALSE;
+	}
+
+	/* Validate the loop->prev links also form a cycle of length f->len */
+	for (i = 1, l_iter = l_first->prev; i < len; i++, l_iter = l_iter->prev) {
+		if (l_iter == l_first) {
+			return FALSE;
+		}
+	}
+	if (l_iter != l_first) {
+		return FALSE;
+	}
+
+	return TRUE;
+}
diff --git a/source/blender/bmesh/intern/bmesh_structure.h b/source/blender/bmesh/intern/bmesh_structure.h
new file mode 100644
index 0000000..8b43f72
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_structure.h
@@ -0,0 +1,78 @@
+/*
+ * ***** 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) 2004 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Geoffrey Bantle.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BMESH_STRUCTURE_H__
+#define __BMESH_STRUCTURE_H__
+
+/** \file blender/bmesh/intern/bmesh_structure.h
+ *  \ingroup bmesh
+ *
+ * The lowest level of functionality for manipulating bmesh structures.
+ * None of these functions should ever be exported to the rest of Blender.
+ *
+ * in the vast majority of cases thes should not be used directly.
+ * if absolutely necessary, see function definitions in code for
+ * descriptive comments.  but seriously, don't use this stuff.
+ */
+
+struct ListBase;
+
+/* LOOP CYCLE MANAGEMENT */
+int bmesh_loop_validate(BMFace *f);
+
+/* DISK CYCLE MANAGMENT */
+int     bmesh_disk_edge_append(BMEdge *e, BMVert *v);
+void    bmesh_disk_edge_remove(BMEdge *e, BMVert *v);
+BMEdge *bmesh_disk_edge_next(BMEdge *e, BMVert *v);
+BMEdge *bmesh_disk_edge_prev(BMEdge *e, BMVert *v);
+int     bmesh_disk_facevert_count(BMVert *v);
+BMEdge *bmesh_disk_faceedge_find_first(BMEdge *e, BMVert *v);
+BMEdge *bmesh_disk_faceedge_find_next(BMEdge *e, BMVert *v);
+
+/* RADIAL CYCLE MANAGMENT */
+void    bmesh_radial_append(BMEdge *e, BMLoop *l);
+void    bmesh_radial_loop_remove(BMLoop *l, BMEdge *e);
+/* note:
+ *      bmesh_radial_loop_next(BMLoop *l) / prev.
+ * just use member access l->radial_next, l->radial_prev now */
+
+int     bmesh_radial_face_find(BMEdge *e, BMFace *f);
+int     bmesh_radial_facevert_count(BMLoop *l, BMVert *v);
+BMLoop *bmesh_radial_faceloop_find_first(BMLoop *l, BMVert *v);
+BMLoop *bmesh_radial_faceloop_find_next(BMLoop *l, BMVert *v);
+BMLoop *bmesh_radial_faceloop_find_vert(BMFace *f, BMVert *v);
+int     bmesh_radial_validate(int radlen, BMLoop *l);
+
+/* EDGE UTILITIES */
+int     bmesh_vert_in_edge(BMEdge *e, BMVert *v);
+int     bmesh_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e);
+int     bmesh_edge_swapverts(BMEdge *e, BMVert *orig, BMVert *newv); /*relink edge*/
+BMVert *bmesh_edge_other_vert_get(BMEdge *e, BMVert *v);
+BMEdge *bmesh_disk_edge_exists(BMVert *v1, BMVert *v2);
+int     bmesh_disk_validate(int len, BMEdge *e, BMVert *v);
+
+#endif /* __BMESH_STRUCTURE_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_walkers.c b/source/blender/bmesh/intern/bmesh_walkers.c
new file mode 100644
index 0000000..a3b5d94
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_walkers.c
@@ -0,0 +1,260 @@
+/*
+ * ***** 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, Geoffrey Bantle, Levi Schooley.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/intern/bmesh_walkers.c
+ *  \ingroup bmesh
+ *
+ * BMesh Walker API.
+ */
+
+#include <stdlib.h>
+#include <string.h> /* for memcpy */
+
+#include "BLI_utildefines.h"
+#include "BLI_listbase.h"
+
+#include "bmesh.h"
+
+#include "bmesh_walkers_private.h"
+
+/**
+ * - joeedh -
+ * design notes:
+ *
+ * original desing: walkers directly emulation recursive functions.
+ * functions save their state onto a worklist, and also add new states
+ * to implement recursive or looping behavior.  generally only one
+ * state push per call with a specific state is desired.
+ *
+ * basic design pattern: the walker step function goes through it's
+ * list of possible choices for recursion, and recurses (by pushing a new state)
+ * using the first non-visited one.  this choise is the flagged as visited using
+ * the ghash.  each step may push multiple new states onto the worklist at once.
+ *
+ * - Walkers use tool flags, not header flags.
+ * - Walkers now use ghash for storing visited elements,
+ *   rather then stealing flags.  ghash can be rewritten
+ *   to be faster if necessary, in the far future :) .
+ * - tools should ALWAYS have necessary error handling
+ *   for if walkers fail.
+ */
+
+void *BMW_begin(BMWalker *walker, void *start)
+{
+	walker->begin(walker, start);
+	
+	return BMW_current_state(walker) ? walker->step(walker) : NULL;
+}
+
+/**
+ * \brief Init Walker
+ *
+ * Allocates and returns a new mesh walker of
+ * a given type. The elements visited are filtered
+ * by the bitmask 'searchmask'.
+ */
+void BMW_init(BMWalker *walker, BMesh *bm, int type,
+              short mask_vert, short mask_edge, short mask_face,
+              BMWFlag flag,
+              int layer)
+{
+	memset(walker, 0, sizeof(BMWalker));
+
+	walker->layer = layer;
+	walker->flag = flag;
+	walker->bm = bm;
+
+	walker->mask_vert = mask_vert;
+	walker->mask_edge = mask_edge;
+	walker->mask_face = mask_face;
+
+	walker->visithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh walkers 1");
+	walker->secvisithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh walkers sec 1");
+
+	if (UNLIKELY(type >= BMW_MAXWALKERS || type < 0)) {
+		fprintf(stderr,
+		        "Invalid walker type in BMW_init; type: %d, "
+		        "searchmask: (v:%d, e:%d, f:%d), flag: %d, layer: %d\n",
+		        type, mask_vert, mask_edge, mask_face, flag, layer);
+		BMESH_ASSERT(0);
+	}
+	
+	if (type != BMW_CUSTOM) {
+		walker->begin = bm_walker_types[type]->begin;
+		walker->yield = bm_walker_types[type]->yield;
+		walker->step = bm_walker_types[type]->step;
+		walker->structsize = bm_walker_types[type]->structsize;
+		walker->order = bm_walker_types[type]->order;
+		walker->valid_mask = bm_walker_types[type]->valid_mask;
+
+		/* safety checks */
+		/* if this raises an error either the caller is wrong or
+		 * 'bm_walker_types' needs updating */
+		BLI_assert(mask_vert == 0 || (walker->valid_mask & BM_VERT));
+		BLI_assert(mask_edge == 0 || (walker->valid_mask & BM_EDGE));
+		BLI_assert(mask_face == 0 || (walker->valid_mask & BM_FACE));
+	}
+	
+	walker->worklist = BLI_mempool_create(walker->structsize, 100, 100, BLI_MEMPOOL_SYSMALLOC);
+	walker->states.first = walker->states.last = NULL;
+}
+
+/**
+ * \brief End Walker
+ *
+ * Frees a walker's worklist.
+ */
+void BMW_end(BMWalker *walker)
+{
+	BLI_mempool_destroy(walker->worklist);
+	BLI_ghash_free(walker->visithash, NULL, NULL);
+	BLI_ghash_free(walker->secvisithash, NULL, NULL);
+}
+
+
+/**
+ * \brief Step Walker
+ */
+void *BMW_step(BMWalker *walker)
+{
+	BMHeader *head;
+
+	head = BMW_walk(walker);
+
+	return head;
+}
+
+/**
+ * \brief Walker Current Depth
+ *
+ * Returns the current depth of the walker.
+ */
+
+int BMW_current_depth(BMWalker *walker)
+{
+	return walker->depth;
+}
+
+/**
+ * \brief Main Walking Function
+ *
+ * Steps a mesh walker forward by one element
+ */
+void *BMW_walk(BMWalker *walker)
+{
+	void *current = NULL;
+
+	while (BMW_current_state(walker)) {
+		current = walker->step(walker);
+		if (current) {
+			return current;
+		}
+	}
+	return NULL;
+}
+
+/**
+ * \brief Current Walker State
+ *
+ * Returns the first state from the walker state
+ * worklist. This state is the the next in the
+ * worklist for processing.
+ */
+void *BMW_current_state(BMWalker *walker)
+{
+	BMwGenericWalker *currentstate = walker->states.first;
+	if (currentstate) {
+		/* Automatic update of depth. For most walkers that
+		 * follow the standard "Step" pattern of:
+		 *  - read current state
+		 *  - remove current state
+		 *  - push new states
+		 *  - return walk result from just-removed current state
+		 * this simple automatic update should keep track of depth
+		 * just fine. Walkers that deviate from that pattern may
+		 * need to manually update the depth if they care about
+		 * keeping it correct. */
+		walker->depth = currentstate->depth + 1;
+	}
+	return currentstate;
+}
+
+/**
+ * \brief Remove Current Walker State
+ *
+ * Remove and free an item from the end of the walker state
+ * worklist.
+ */
+void BMW_state_remove(BMWalker *walker)
+{
+	void *oldstate;
+	oldstate = BMW_current_state(walker);
+	BLI_remlink(&walker->states, oldstate);
+	BLI_mempool_free(walker->worklist, oldstate);
+}
+
+/**
+ * \brief Add a new Walker State
+ *
+ * Allocate a new empty state and put it on the worklist.
+ * A pointer to the new state is returned so that the caller
+ * can fill in the state data. The new state will be inserted
+ * at the front for depth-first walks, and at the end for
+ * breadth-first walks.
+ */
+void *BMW_state_add(BMWalker *walker)
+{
+	BMwGenericWalker *newstate;
+	newstate = BLI_mempool_alloc(walker->worklist);
+	newstate->depth = walker->depth;
+	switch (walker->order)
+	{
+		case BMW_DEPTH_FIRST:
+			BLI_addhead(&walker->states, newstate);
+			break;
+		case BMW_BREADTH_FIRST:
+			BLI_addtail(&walker->states, newstate);
+			break;
+		default:
+			BLI_assert(0);
+			break;
+	}
+	return newstate;
+}
+
+/**
+ * \brief Reset Walker
+ *
+ * Frees all states from the worklist, resetting the walker
+ * for reuse in a new walk.
+ */
+void BMW_reset(BMWalker *walker)
+{
+	while (BMW_current_state(walker)) {
+		BMW_state_remove(walker);
+	}
+	walker->depth = 0;
+	BLI_ghash_free(walker->visithash, NULL, NULL);
+	BLI_ghash_free(walker->secvisithash, NULL, NULL);
+	walker->visithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh walkers 1");
+	walker->secvisithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh walkers sec 1");
+}
diff --git a/source/blender/bmesh/intern/bmesh_walkers.h b/source/blender/bmesh/intern/bmesh_walkers.h
new file mode 100644
index 0000000..4f81f38
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_walkers.h
@@ -0,0 +1,150 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BMESH_WALKERS_H__
+#define __BMESH_WALKERS_H__
+
+/** \file blender/bmesh/intern/bmesh_walkers.h
+ *  \ingroup bmesh
+ */
+
+#include "BLI_ghash.h"
+
+/*
+ * NOTE: do NOT modify topology while walking a mesh!
+ */
+
+typedef enum {
+	BMW_DEPTH_FIRST,
+	BMW_BREADTH_FIRST
+} BMWOrder;
+
+typedef enum {
+	BMW_FLAG_NOP = 0,
+	BMW_FLAG_TEST_HIDDEN = (1 << 0)
+} BMWFlag;
+
+/*Walkers*/
+typedef struct BMWalker {
+	void  (*begin) (struct BMWalker *walker, void *start);
+	void *(*step)  (struct BMWalker *walker);
+	void *(*yield) (struct BMWalker *walker);
+	int structsize;
+	BMWOrder order;
+	int valid_mask;
+
+	/* runtime */
+	int layer;
+
+	BMesh *bm;
+	BLI_mempool *worklist;
+	ListBase states;
+
+	/* these masks are to be tested against elements BMO_elem_flag_test(),
+	 * should never be accessed directly only through BMW_init() and bmw_mask_check_*() functions */
+	short mask_vert;
+	short mask_edge;
+	short mask_face;
+
+	BMWFlag flag;
+
+	GHash *visithash;
+	GHash *secvisithash;
+	int depth;
+} BMWalker;
+
+/* define to make BMW_init more clear */
+#define BMW_MASK_NOP 0
+
+/* initialize a walker.  searchmask restricts some (not all) walkers to
+ * elements with a specific tool flag set.  flags is specific to each walker.*/
+void BMW_init(struct BMWalker *walker, BMesh *bm, int type,
+              short mask_vert, short mask_edge, short mask_face,
+              BMWFlag flag,
+              int layer);
+void *BMW_begin(BMWalker *walker, void *start);
+void *BMW_step(struct BMWalker *walker);
+void  BMW_end(struct BMWalker *walker);
+int   BMW_current_depth(BMWalker *walker);
+
+/*these are used by custom walkers*/
+void *BMW_current_state(BMWalker *walker);
+void *BMW_state_add(BMWalker *walker);
+void  BMW_state_remove(BMWalker *walker);
+void *BMW_walk(BMWalker *walker);
+void  BMW_reset(BMWalker *walker);
+
+/*
+ * example of usage, walking over an island of tool flagged faces:
+ *
+ * BMWalker walker;
+ * BMFace *f;
+ *
+ * BMW_init(&walker, bm, BMW_ISLAND, SOME_OP_FLAG);
+ * f = BMW_begin(&walker, some_start_face);
+ * for (; f; f = BMW_step(&walker))
+ * {
+ *     //do something with f
+ * }
+ * BMW_end(&walker);
+ */
+
+enum {
+	/* walk over connected geometry.  can restrict to a search flag,
+	 * or not, it's optional.
+	 *
+	 * takes a vert as an argument, and spits out edges, restrict flag acts
+	 * on the edges as well. */
+	BMW_SHELL,
+	/*walk over an edge loop.  search flag doesn't do anything.*/
+	BMW_LOOP,
+	BMW_FACELOOP,
+	BMW_EDGERING,
+	/* #define BMW_RING	2 */
+	/* walk over uv islands; takes a loop as input.  restrict flag
+	 * restricts the walking to loops whose vert has restrict flag set as a
+	 * tool flag.
+	 *
+	 * the flag parameter to BMW_init maps to a loop customdata layer index.
+	 */
+	BMW_LOOPDATA_ISLAND,
+	/* walk over an island of flagged faces.  note, that this doesn't work on
+	 * non-manifold geometry.  it might be better to rewrite this to extract
+	 * boundary info from the island walker, rather then directly walking
+	 * over the boundary.  raises an error if it encounters nonmanifold
+	 * geometry. */
+	BMW_ISLANDBOUND,
+	/* walk over all faces in an island of tool flagged faces. */
+	BMW_ISLAND,
+	/* walk from a vertex to all connected vertices. */
+	BMW_CONNECTED_VERTEX,
+	/* end of array index enum vals */
+
+	/* do not intitialze function pointers and struct size in BMW_init */
+	BMW_CUSTOM,
+	BMW_MAXWALKERS
+};
+
+/* use with BMW_init, so as not to confuse with restrict flags */
+#define BMW_NIL_LAY  0
+
+#endif /* __BMESH_WALKERS_H__ */
diff --git a/source/blender/bmesh/intern/bmesh_walkers_impl.c b/source/blender/bmesh/intern/bmesh_walkers_impl.c
new file mode 100644
index 0000000..113e1dd
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c
@@ -0,0 +1,1075 @@
+/*
+ * ***** 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, Geoffrey Bantle, Levi Schooley.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/intern/bmesh_walkers_impl.c
+ *  \ingroup bmesh
+ *
+ * BMesh Walker Code.
+ */
+
+#include "BLI_utildefines.h"
+
+#include "BKE_customdata.h"
+
+#include "bmesh.h"
+#include "intern/bmesh_private.h"
+#include "intern/bmesh_walkers_private.h"
+
+static int bmw_mask_check_vert(BMWalker *walker, BMVert *v)
+{
+	if ((walker->flag & BMW_FLAG_TEST_HIDDEN) && BM_elem_flag_test(v, BM_ELEM_HIDDEN)) {
+		return FALSE;
+	}
+	else if (walker->mask_vert && !BMO_elem_flag_test(walker->bm, v, walker->mask_vert)) {
+		return FALSE;
+	}
+	else {
+		return TRUE;
+	}
+}
+
+static int bmw_mask_check_edge(BMWalker *walker, BMEdge *e)
+{
+	if ((walker->flag & BMW_FLAG_TEST_HIDDEN) && BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
+		return FALSE;
+	}
+	else if (walker->mask_edge && !BMO_elem_flag_test(walker->bm, e, walker->mask_edge)) {
+		return FALSE;
+	}
+	else {
+		return TRUE;
+	}
+}
+
+static int bmw_mask_check_face(BMWalker *walker, BMFace *f)
+{
+	if ((walker->flag & BMW_FLAG_TEST_HIDDEN) && BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
+		return FALSE;
+	}
+	else if (walker->mask_face && !BMO_elem_flag_test(walker->bm, f, walker->mask_face)) {
+		return FALSE;
+	}
+	else {
+		return TRUE;
+	}
+}
+
+/**
+ * Shell Walker:
+ *
+ * Starts at a vertex on the mesh and walks over the 'shell' it belongs
+ * to via visiting connected edges.
+ *
+ * \todo Add restriction flag/callback for wire edges.
+ */
+static void bmw_ShellWalker_visitEdge(BMWalker *walker, BMEdge *e)
+{
+	BMwShellWalker *shellWalk = NULL;
+
+	if (BLI_ghash_haskey(walker->visithash, e)) {
+		return;
+	}
+
+	if (!bmw_mask_check_edge(walker, e)) {
+		return;
+	}
+
+	shellWalk = BMW_state_add(walker);
+	shellWalk->curedge = e;
+	BLI_ghash_insert(walker->visithash, e, NULL);
+}
+
+static void bmw_ShellWalker_begin(BMWalker *walker, void *data)
+{
+	BMIter eiter;
+	BMHeader *h = data;
+	BMEdge *e;
+	BMVert *v;
+
+	if (UNLIKELY(h == NULL)) {
+		return;
+	}
+
+	switch (h->htype) {
+		case BM_VERT:
+		{
+			/* starting the walk at a vert, add all the edges
+			 * to the worklist */
+			v = (BMVert *)h;
+			BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
+				bmw_ShellWalker_visitEdge(walker, e);
+			}
+			break;
+		}
+
+		case BM_EDGE:
+		{
+			/* starting the walk at an edge, add the single edge
+			 * to the worklist */
+			e = (BMEdge *)h;
+			bmw_ShellWalker_visitEdge(walker, e);
+			break;
+		}
+	}
+}
+
+static void *bmw_ShellWalker_yield(BMWalker *walker)
+{
+	BMwShellWalker *shellWalk = BMW_current_state(walker);
+	return shellWalk->curedge;
+}
+
+static void *bmw_ShellWalker_step(BMWalker *walker)
+{
+	BMwShellWalker *swalk = BMW_current_state(walker);
+	BMEdge *e, *e2;
+	BMVert *v;
+	BMIter iter;
+	int i;
+
+	e = swalk->curedge;
+	BMW_state_remove(walker);
+
+	for (i = 0; i < 2; i++) {
+		v = i ? e->v2 : e->v1;
+		BM_ITER_ELEM (e2, &iter, v, BM_EDGES_OF_VERT) {
+			bmw_ShellWalker_visitEdge(walker, e2);
+		}
+	}
+
+	return e;
+}
+
+#if 0
+static void *bmw_ShellWalker_step(BMWalker *walker)
+{
+	BMEdge *curedge, *next = NULL;
+	BMVert *ov = NULL;
+	int restrictpass = 1;
+	BMwShellWalker shellWalk = *((BMwShellWalker *)BMW_current_state(walker));
+	
+	if (!BLI_ghash_haskey(walker->visithash, shellWalk.base)) {
+		BLI_ghash_insert(walker->visithash, shellWalk.base, NULL);
+	}
+
+	BMW_state_remove(walker);
+
+
+	/* find the next edge whose other vertex has not been visite */
+	curedge = shellWalk.curedge;
+	do {
+		if (!BLI_ghash_haskey(walker->visithash, curedge)) {
+			if (!walker->restrictflag ||
+			    (walker->restrictflag && BMO_elem_flag_test(walker->bm, curedge, walker->restrictflag)))
+			{
+				BMwShellWalker *newstate;
+
+				ov = BM_edge_other_vert(curedge, shellWalk.base);
+				
+				/* push a new state onto the stac */
+				newState = BMW_state_add(walker);
+				BLI_ghash_insert(walker->visithash, curedge, NULL);
+				
+				/* populate the new stat */
+
+				newState->base = ov;
+				newState->curedge = curedge;
+			}
+		}
+		curedge = bmesh_disk_edge_next(curedge, shellWalk.base);
+	} while (curedge != shellWalk.curedge);
+	
+	return shellWalk.curedge;
+}
+#endif
+
+/**
+ * Connected Vertex Walker:
+ *
+ * Similar to shell walker, but visits vertices instead of edges.
+ */
+static void bmw_ConnectedVertexWalker_visitVertex(BMWalker *walker, BMVert *v)
+{
+	BMwConnectedVertexWalker *vwalk;
+
+	if (BLI_ghash_haskey(walker->visithash, v)) {
+		/* already visited */
+		return;
+	}
+
+	if (!bmw_mask_check_vert(walker, v)) {
+		/* not flagged for walk */
+		return;
+	}
+
+	vwalk = BMW_state_add(walker);
+	vwalk->curvert = v;
+	BLI_ghash_insert(walker->visithash, v, NULL);
+}
+
+static void bmw_ConnectedVertexWalker_begin(BMWalker *walker, void *data)
+{
+	BMVert *v = data;
+	bmw_ConnectedVertexWalker_visitVertex(walker, v);
+}
+
+static void *bmw_ConnectedVertexWalker_yield(BMWalker *walker)
+{
+	BMwConnectedVertexWalker *vwalk = BMW_current_state(walker);
+	return vwalk->curvert;
+}
+
+static void *bmw_ConnectedVertexWalker_step(BMWalker *walker)
+{
+	BMwConnectedVertexWalker *vwalk = BMW_current_state(walker);
+	BMVert *v, *v2;
+	BMEdge *e;
+	BMIter iter;
+
+	v = vwalk->curvert;
+
+	BMW_state_remove(walker);
+
+	BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
+		v2 = BM_edge_other_vert(e, v);
+		if (!BLI_ghash_haskey(walker->visithash, v2)) {
+			bmw_ConnectedVertexWalker_visitVertex(walker, v2);
+		}
+	}
+
+	return v;
+}
+
+/**
+ * Island Boundary Walker:
+ *
+ * Starts at a edge on the mesh and walks over the boundary of an island it belongs to.
+ *
+ * \todo Add restriction flag/callback for wire edges.
+ */
+static void bmw_IslandboundWalker_begin(BMWalker *walker, void *data)
+{
+	BMLoop *l = data;
+	BMwIslandboundWalker *iwalk = NULL;
+
+	iwalk = BMW_state_add(walker);
+
+	iwalk->base = iwalk->curloop = l;
+	iwalk->lastv = l->v;
+
+	BLI_ghash_insert(walker->visithash, data, NULL);
+
+}
+
+static void *bmw_IslandboundWalker_yield(BMWalker *walker)
+{
+	BMwIslandboundWalker *iwalk = BMW_current_state(walker);
+
+	return iwalk->curloop;
+}
+
+static void *bmw_IslandboundWalker_step(BMWalker *walker)
+{
+	BMwIslandboundWalker *iwalk = BMW_current_state(walker), owalk;
+	BMVert *v;
+	BMEdge *e = iwalk->curloop->e;
+	BMFace *f;
+	BMLoop *l = iwalk->curloop;
+	/* int found = 0; */
+
+	owalk = *iwalk;
+
+	v = BM_edge_other_vert(e, iwalk->lastv);
+
+	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");
+		return NULL;
+	}
+	
+	/* pop off current stat */
+	BMW_state_remove(walker);
+	
+	f = l->f;
+	
+	while (1) {
+		l = BM_face_other_edge_loop(f, e, v);
+		if (l != l->radial_next) {
+			l = l->radial_next;
+			f = l->f;
+			e = l->e;
+
+			if (!bmw_mask_check_face(walker, f)) {
+				l = l->radial_next;
+				break;
+			}
+		}
+		else {
+			f = l->f;
+			e = l->e;
+			break;
+		}
+	}
+	
+	if (l == owalk.curloop) {
+		return NULL;
+	}
+	else if (BLI_ghash_haskey(walker->visithash, l)) {
+		return owalk.curloop;
+	}
+
+	BLI_ghash_insert(walker->visithash, l, NULL);
+	iwalk = BMW_state_add(walker);
+	iwalk->base = owalk.base;
+
+	//if (!BMO_elem_flag_test(walker->bm, l->f, walker->restrictflag))
+	//	iwalk->curloop = l->radial_next;
+	iwalk->curloop = l; //else iwalk->curloop = l;
+	iwalk->lastv = v;
+
+	return owalk.curloop;
+}
+
+
+/**
+ * Island Walker:
+ *
+ * Starts at a tool flagged-face and walks over the face region
+ *
+ * \todo Add restriction flag/callback for wire edges.
+ */
+static void bmw_IslandWalker_begin(BMWalker *walker, void *data)
+{
+	BMwIslandWalker *iwalk = NULL;
+
+	if (!bmw_mask_check_face(walker, data)) {
+		return;
+	}
+
+	iwalk = BMW_state_add(walker);
+	BLI_ghash_insert(walker->visithash, data, NULL);
+
+	iwalk->cur = data;
+}
+
+static void *bmw_IslandWalker_yield(BMWalker *walker)
+{
+	BMwIslandWalker *iwalk = BMW_current_state(walker);
+
+	return iwalk->cur;
+}
+
+static void *bmw_IslandWalker_step(BMWalker *walker)
+{
+	BMwIslandWalker *iwalk = BMW_current_state(walker);
+	/* BMwIslandWalker *owalk = iwalk; */ /* UNUSED */
+	BMIter iter, liter;
+	BMFace *f, *curf = iwalk->cur;
+	BMLoop *l;
+	
+	BMW_state_remove(walker);
+
+	l = BM_iter_new(&liter, walker->bm, BM_LOOPS_OF_FACE, iwalk->cur);
+	for ( ; l; l = BM_iter_step(&liter)) {
+		/* could skip loop here too, but don't add unless we need it */
+		if (!bmw_mask_check_edge(walker, l->e)) {
+			continue;
+		}
+
+		f = BM_iter_new(&iter, walker->bm, BM_FACES_OF_EDGE, l->e);
+		for ( ; f; f = BM_iter_step(&iter)) {
+
+			if (!bmw_mask_check_face(walker, f)) {
+				continue;
+			}
+
+			if (BLI_ghash_haskey(walker->visithash, f)) {
+				continue;
+			}
+			
+			iwalk = BMW_state_add(walker);
+			iwalk->cur = f;
+			BLI_ghash_insert(walker->visithash, f, NULL);
+			break;
+		}
+	}
+	
+	return curf;
+}
+
+
+/**
+ * Edge Loop Walker:
+ *
+ * Starts at a tool-flagged edge and walks over the edge loop
+ */
+static void bmw_LoopWalker_begin(BMWalker *walker, void *data)
+{
+	BMwLoopWalker *lwalk = NULL, owalk;
+	BMEdge *e = data;
+	BMVert *v;
+	int vert_edge_count[2] = {BM_vert_edge_count_nonwire(e->v1),
+	                          BM_vert_edge_count_nonwire(e->v2)};
+
+	v = e->v1;
+
+	lwalk = BMW_state_add(walker);
+	BLI_ghash_insert(walker->visithash, e, NULL);
+
+	lwalk->cur = lwalk->start = e;
+	lwalk->lastv = lwalk->startv = v;
+	lwalk->is_boundary = BM_edge_is_boundary(e);
+	lwalk->is_single = (vert_edge_count[0] == 2 && vert_edge_count[1] == 2);
+
+	/* could also check that vertex*/
+	if ((lwalk->is_boundary == FALSE) &&
+	    (vert_edge_count[0] == 3 || vert_edge_count[1] == 3))
+	{
+		BMIter iter;
+		BMFace *f_iter;
+		BMFace *f_best = NULL;
+
+		BM_ITER_ELEM (f_iter, &iter, e, BM_FACES_OF_EDGE) {
+			if (f_best == NULL || f_best->len < f_iter->len) {
+				f_best = f_iter;
+			}
+		}
+
+		if (f_best) {
+			/* only use hub selection for 5+ sides else this could
+			 * conflict with normal edge loop selection. */
+			lwalk->f_hub = f_best->len > 4 ? f_best : NULL;
+		}
+		else {
+			/* edge doesn't have any faces connected to it */
+			lwalk->f_hub = NULL;
+		}
+	}
+	else {
+		lwalk->f_hub = NULL;
+	}
+
+	/* rewind */
+	while (BMW_current_state(walker)) {
+		owalk = *((BMwLoopWalker *)BMW_current_state(walker));
+		BMW_walk(walker);
+	}
+
+	lwalk = BMW_state_add(walker);
+	*lwalk = owalk;
+
+	lwalk->lastv = lwalk->startv = BM_edge_other_vert(owalk.cur, lwalk->lastv);
+
+	BLI_ghash_free(walker->visithash, NULL, NULL);
+	walker->visithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh walkers 2");
+	BLI_ghash_insert(walker->visithash, owalk.cur, NULL);
+}
+
+static void *bmw_LoopWalker_yield(BMWalker *walker)
+{
+	BMwLoopWalker *lwalk = BMW_current_state(walker);
+
+	return lwalk->cur;
+}
+
+static void *bmw_LoopWalker_step(BMWalker *walker)
+{
+	BMwLoopWalker *lwalk = BMW_current_state(walker), owalk;
+	BMEdge *e = lwalk->cur, *nexte = NULL;
+	BMLoop *l;
+	BMVert *v;
+	int i;
+
+	owalk = *lwalk;
+	BMW_state_remove(walker);
+
+	l = e->l;
+
+	if (owalk.f_hub) { /* NGON EDGE */
+		int vert_edge_tot;
+
+		v = BM_edge_other_vert(e, lwalk->lastv);
+
+		vert_edge_tot = BM_vert_edge_count_nonwire(v);
+
+		if (vert_edge_tot == 3) {
+			l = BM_face_other_vert_loop(owalk.f_hub, lwalk->lastv, v);
+			nexte = BM_edge_exists(v, l->v);
+
+			if (bmw_mask_check_edge(walker, nexte) &&
+			    !BLI_ghash_haskey(walker->visithash, nexte))
+			{
+				lwalk = BMW_state_add(walker);
+				lwalk->cur = nexte;
+				lwalk->lastv = v;
+
+				lwalk->is_boundary = owalk.is_boundary;
+				lwalk->is_single = owalk.is_single;
+				lwalk->f_hub = owalk.f_hub;
+
+				BLI_ghash_insert(walker->visithash, nexte, NULL);
+			}
+		}
+	}
+	else if (l) { /* NORMAL EDGE WITH FACES */
+		int vert_edge_tot;
+		int stopi;
+
+		v = BM_edge_other_vert(e, lwalk->lastv);
+
+		vert_edge_tot = BM_vert_edge_count_nonwire(v);
+
+		if (/* check if we should step, this is fairly involved */
+
+			/* typical loopiong over edges in the middle of a mesh */
+			/* however, why use 2 here at all? I guess for internal ngon loops it can be useful. Antony R. */
+			((vert_edge_tot == 4 || vert_edge_tot == 2) && owalk.is_boundary == FALSE) ||
+
+			/* walk over boundary of faces but stop at corners */
+			(owalk.is_boundary == TRUE && owalk.is_single  == FALSE && vert_edge_tot > 2) ||
+
+			/* initial edge was a boundary, so is this edge and vertex is only apart of this face
+			 * this lets us walk over the the boundary of an ngon which is handy */
+			(owalk.is_boundary == TRUE && owalk.is_single == TRUE && vert_edge_tot == 2 && BM_edge_is_boundary(e)))
+		{
+			i = 0;
+			stopi = vert_edge_tot / 2;
+			while (1) {
+				if ((owalk.is_boundary == FALSE) && (i == stopi)) {
+					break;
+				}
+
+				l = BM_face_other_edge_loop(l->f, l->e, v);
+
+				if (l == NULL) {
+					break;
+				}
+				else {
+					BMLoop *l_next;
+
+					l_next = l->radial_next;
+
+					if ((l_next == l) || (l_next == NULL)) {
+						break;
+					}
+
+					l = l_next;
+					i++;
+				}
+			}
+		}
+
+		if (l != NULL) {
+			if (l != e->l &&
+			    bmw_mask_check_edge(walker, l->e) &&
+			    !BLI_ghash_haskey(walker->visithash, l->e))
+			{
+				if (!(owalk.is_boundary == FALSE && i != stopi)) {
+					lwalk = BMW_state_add(walker);
+					lwalk->cur = l->e;
+					lwalk->lastv = v;
+
+					lwalk->is_boundary = owalk.is_boundary;
+					lwalk->is_single = owalk.is_single;
+					lwalk->f_hub = owalk.f_hub;
+
+					BLI_ghash_insert(walker->visithash, l->e, NULL);
+				}
+			}
+		}
+	}
+	else { 	/* WIRE EDGE */
+		BMIter eiter;
+
+		/* match trunk: mark all connected wire edges */
+		for (i = 0; i < 2; i++) {
+			v = i ? e->v2 : e->v1;
+
+			BM_ITER_ELEM (nexte, &eiter, v, BM_EDGES_OF_VERT) {
+				if ((nexte->l == NULL) &&
+				    bmw_mask_check_edge(walker, nexte) &&
+				    !BLI_ghash_haskey(walker->visithash, nexte))
+				{
+					lwalk = BMW_state_add(walker);
+					lwalk->cur = nexte;
+					lwalk->lastv = v;
+
+					lwalk->is_boundary = owalk.is_boundary;
+					lwalk->is_single = owalk.is_single;
+					lwalk->f_hub = owalk.f_hub;
+
+					BLI_ghash_insert(walker->visithash, nexte, NULL);
+				}
+			}
+		}
+	}
+
+	return owalk.cur;
+}
+
+/**
+ * Face Loop Walker:
+ *
+ * Starts at a tool-flagged face and walks over the face loop
+ * Conditions for starting and stepping the face loop have been
+ * tuned in an attempt to match the face loops built by EditMesh
+ */
+
+/* Check whether the face loop should includes the face specified
+ * by the given BMLoop */
+static int bmw_FaceLoopWalker_include_face(BMWalker *walker, BMLoop *l)
+{
+	/* face must have degree 4 */
+	if (l->f->len != 4) {
+		return FALSE;
+	}
+
+	if (!bmw_mask_check_face(walker, l->f)) {
+		return FALSE;
+	}
+
+	/* the face must not have been already visite */
+	if (BLI_ghash_haskey(walker->visithash, l->f) && BLI_ghash_haskey(walker->secvisithash, l->e)) {
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+/* Check whether the face loop can start from the given edge */
+static int bmw_FaceLoopWalker_edge_begins_loop(BMWalker *walker, BMEdge *e)
+{
+	/* There is no face loop starting from a wire edge */
+	if (BM_edge_is_wire(e)) {
+		return FALSE;
+	}
+	
+	/* Don't start a loop from a boundary edge if it cannot
+	 * be extended to cover any faces */
+	if (BM_edge_is_boundary(e)) {
+		if (!bmw_FaceLoopWalker_include_face(walker, e->l)) {
+			return FALSE;
+		}
+	}
+	
+	/* Don't start a face loop from non-manifold edges */
+	if (!BM_edge_is_manifold(e)) {
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+static void bmw_FaceLoopWalker_begin(BMWalker *walker, void *data)
+{
+	BMwFaceLoopWalker *lwalk, owalk;
+	BMEdge *e = data;
+	/* BMesh *bm = walker->bm; */ /* UNUSED */
+	/* int fcount = BM_edge_face_count(e); */ /* UNUSED */
+
+	if (!bmw_FaceLoopWalker_edge_begins_loop(walker, e))
+		return;
+
+	lwalk = BMW_state_add(walker);
+	lwalk->l = e->l;
+	lwalk->nocalc = 0;
+	BLI_ghash_insert(walker->visithash, lwalk->l->f, NULL);
+
+	/* rewin */
+	while (BMW_current_state(walker)) {
+		owalk = *((BMwFaceLoopWalker *)BMW_current_state(walker));
+		BMW_walk(walker);
+	}
+
+	lwalk = BMW_state_add(walker);
+	*lwalk = owalk;
+	lwalk->nocalc = 0;
+
+	BLI_ghash_free(walker->secvisithash, NULL, NULL);
+	walker->secvisithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh walkers 3");
+	BLI_ghash_insert(walker->visithash, lwalk->l->e, NULL);
+
+	BLI_ghash_free(walker->visithash, NULL, NULL);
+	walker->visithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh walkers 3");
+	BLI_ghash_insert(walker->visithash, lwalk->l->f, NULL);
+}
+
+static void *bmw_FaceLoopWalker_yield(BMWalker *walker)
+{
+	BMwFaceLoopWalker *lwalk = BMW_current_state(walker);
+	
+	if (!lwalk) {
+		return NULL;
+	}
+
+	return lwalk->l->f;
+}
+
+static void *bmw_FaceLoopWalker_step(BMWalker *walker)
+{
+	BMwFaceLoopWalker *lwalk = BMW_current_state(walker);
+	BMFace *f = lwalk->l->f;
+	BMLoop *l = lwalk->l, *origl = lwalk->l;
+
+	BMW_state_remove(walker);
+
+	l = l->radial_next;
+	
+	if (lwalk->nocalc) {
+		return f;
+	}
+
+	if (!bmw_FaceLoopWalker_include_face(walker, l)) {
+		l = lwalk->l;
+		l = l->next->next;
+		if (!BM_edge_is_manifold(l->e)) {
+			l = l->prev->prev;
+		}
+		l = l->radial_next;
+	}
+
+	if (bmw_FaceLoopWalker_include_face(walker, l)) {
+		lwalk = BMW_state_add(walker);
+		lwalk->l = l;
+
+		if (l->f->len != 4) {
+			lwalk->nocalc = 1;
+			lwalk->l = origl;
+		}
+		else {
+			lwalk->nocalc = 0;
+		}
+
+		BLI_ghash_insert(walker->secvisithash, l->e, NULL);
+		BLI_ghash_insert(walker->visithash, l->f, NULL);
+	}
+
+	return f;
+}
+
+// #define BMW_EDGERING_NGON
+
+/**
+ * Edge Ring Walker:
+ *
+ * Starts at a tool-flagged edge and walks over the edge ring
+ * Conditions for starting and stepping the edge ring have been
+ * tuned in an attempt to match the edge rings built by EditMesh
+ */
+static void bmw_EdgeringWalker_begin(BMWalker *walker, void *data)
+{
+	BMwEdgeringWalker *lwalk, owalk;
+	BMEdge *e = data;
+
+	lwalk = BMW_state_add(walker);
+	lwalk->l = e->l;
+
+	if (!lwalk->l) {
+		lwalk->wireedge = e;
+		return;
+	}
+	else {
+		lwalk->wireedge = NULL;
+	}
+
+	BLI_ghash_insert(walker->visithash, lwalk->l->e, NULL);
+
+	/* rewin */
+	while (BMW_current_state(walker)) {
+		owalk = *((BMwEdgeringWalker *)BMW_current_state(walker));
+		BMW_walk(walker);
+	}
+
+	lwalk = BMW_state_add(walker);
+	*lwalk = owalk;
+
+#ifdef BMW_EDGERING_NGON
+	if (lwalk->l->f->len % 2 != 0)
+#else
+	if (lwalk->l->f->len != 4)
+#endif
+	{
+		lwalk->l = lwalk->l->radial_next;
+	}
+
+	BLI_ghash_free(walker->visithash, NULL, NULL);
+	walker->visithash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh walkers 4");
+	BLI_ghash_insert(walker->visithash, lwalk->l->e, NULL);
+}
+
+static void *bmw_EdgeringWalker_yield(BMWalker *walker)
+{
+	BMwEdgeringWalker *lwalk = BMW_current_state(walker);
+	
+	if (!lwalk) {
+		return NULL;
+	}
+
+	if (lwalk->l) {
+		return lwalk->l->e;
+	}
+	else {
+		return lwalk->wireedge;
+	}
+}
+
+static void *bmw_EdgeringWalker_step(BMWalker *walker)
+{
+	BMwEdgeringWalker *lwalk = BMW_current_state(walker);
+	BMEdge *e, *wireedge = lwalk->wireedge;
+	BMLoop *l = lwalk->l , *origl = lwalk->l;
+#ifdef BMW_EDGERING_NGON
+	int i, len;
+#endif
+
+#define EDGE_CHECK(e) (bmw_mask_check_edge(walker, e) && (BM_edge_is_boundary(e) || BM_edge_is_manifold(e)))
+
+	BMW_state_remove(walker);
+
+	if (!l)
+		return wireedge;
+
+	e = l->e;
+	if (!EDGE_CHECK(e)) {
+		/* walker won't traverse to a non-manifold edge, but may
+		 * be started on one, and should not traverse *away* from
+		 * a non-manfold edge (non-manifold edges are never in an
+		 * edge ring with manifold edges */
+		return e;
+	}
+
+#ifdef BMW_EDGERING_NGON
+	l = l->radial_next;
+
+	i = len = l->f->len;
+	while (i > 0) {
+		l = l->next;
+		i -= 2;
+	}
+
+	if ((len <= 0) || (len % 2 != 0) || !EDGE_CHECK(l->e) ||
+		!bmw_mask_check_face(walker, l->f))
+	{
+		l = origl;
+		i = len;
+		while (i > 0) {
+			l = l->next;
+			i -= 2;
+		}
+	}
+	/* only walk to manifold edge */
+	if ((l->f->len % 2 == 0) && EDGE_CHECK(l->e) &&
+	    !BLI_ghash_haskey(walker->visithash, l->e)) 
+
+#else
+
+	l = l->radial_next;
+	l = l->next->next;
+	
+	if ((l->f->len != 4) || !EDGE_CHECK(l->e) || !bmw_mask_check_face(walker, l->f)) {
+		l = origl->next->next;
+	}
+	/* only walk to manifold edge */
+	if ((l->f->len == 4) && EDGE_CHECK(l->e) &&
+	    !BLI_ghash_haskey(walker->visithash, l->e))
+#endif
+	{
+		lwalk = BMW_state_add(walker);
+		lwalk->l = l;
+		lwalk->wireedge = NULL;
+
+		BLI_ghash_insert(walker->visithash, l->e, NULL);
+	}
+
+	return e;
+
+#undef EDGE_CHECK
+}
+
+static void bmw_UVEdgeWalker_begin(BMWalker *walker, void *data)
+{
+	BMwUVEdgeWalker *lwalk;
+	BMLoop *l = data;
+
+	if (BLI_ghash_haskey(walker->visithash, l))
+		return;
+
+	lwalk = BMW_state_add(walker);
+	lwalk->l = l;
+	BLI_ghash_insert(walker->visithash, l, NULL);
+}
+
+static void *bmw_UVEdgeWalker_yield(BMWalker *walker)
+{
+	BMwUVEdgeWalker *lwalk = BMW_current_state(walker);
+	
+	if (!lwalk) {
+		return NULL;
+	}
+
+	return lwalk->l;
+}
+
+static void *bmw_UVEdgeWalker_step(BMWalker *walker)
+{
+	BMwUVEdgeWalker *lwalk = BMW_current_state(walker);
+	BMLoop *l, *l2, *l3, *nl, *cl;
+	BMIter liter;
+	void *d1, *d2;
+	int i, j, rlen, type;
+
+	l = lwalk->l;
+	nl = l->next;
+	type = walker->bm->ldata.layers[walker->layer].type;
+
+	BMW_state_remove(walker);
+
+	if (!bmw_mask_check_edge(walker, l->e)) {
+		return l;
+	}
+
+	/* go over loops around l->v and nl->v and see which ones share l and nl's
+	 * mloopuv's coordinates. in addition, push on l->next if necessary */
+	for (i = 0; i < 2; i++) {
+		cl = i ? nl : l;
+		BM_ITER_ELEM (l2, &liter, cl->v, BM_LOOPS_OF_VERT) {
+			d1 = CustomData_bmesh_get_layer_n(&walker->bm->ldata,
+			                                  cl->head.data, walker->layer);
+			
+			rlen = BM_edge_face_count(l2->e);
+			for (j = 0; j < rlen; j++) {
+				if (BLI_ghash_haskey(walker->visithash, l2)) {
+					continue;
+				}
+
+				if (!bmw_mask_check_edge(walker, l2->e)) {
+					if (l2->v != cl->v) {
+						continue;
+					}
+				}
+
+				l3 = l2->v != cl->v ? l2->next : l2;
+				d2 = CustomData_bmesh_get_layer_n(&walker->bm->ldata,
+				                                  l3->head.data, walker->layer);
+
+				if (!CustomData_data_equals(type, d1, d2))
+					continue;
+				
+				lwalk = BMW_state_add(walker);
+				BLI_ghash_insert(walker->visithash, l2, NULL);
+
+				lwalk->l = l2;
+
+				l2 = l2->radial_next;
+			}
+		}
+	}
+
+	return l;
+}
+
+static BMWalker bmw_ShellWalker_Type = {
+	bmw_ShellWalker_begin,
+	bmw_ShellWalker_step,
+	bmw_ShellWalker_yield,
+	sizeof(BMwShellWalker),
+	BMW_BREADTH_FIRST,
+	BM_EDGE, /* valid restrict masks */
+};
+
+static BMWalker bmw_IslandboundWalker_Type = {
+	bmw_IslandboundWalker_begin,
+	bmw_IslandboundWalker_step,
+	bmw_IslandboundWalker_yield,
+	sizeof(BMwIslandboundWalker),
+	BMW_DEPTH_FIRST,
+	BM_FACE, /* valid restrict masks */
+};
+
+static BMWalker bmw_IslandWalker_Type = {
+	bmw_IslandWalker_begin,
+	bmw_IslandWalker_step,
+	bmw_IslandWalker_yield,
+	sizeof(BMwIslandWalker),
+	BMW_BREADTH_FIRST,
+	BM_EDGE | BM_FACE, /* valid restrict masks */
+};
+
+static BMWalker bmw_LoopWalker_Type = {
+	bmw_LoopWalker_begin,
+	bmw_LoopWalker_step,
+	bmw_LoopWalker_yield,
+	sizeof(BMwLoopWalker),
+	BMW_DEPTH_FIRST,
+	0, /* valid restrict masks */ /* could add flags here but so far none are used */
+};
+
+static BMWalker bmw_FaceLoopWalker_Type = {
+	bmw_FaceLoopWalker_begin,
+	bmw_FaceLoopWalker_step,
+	bmw_FaceLoopWalker_yield,
+	sizeof(BMwFaceLoopWalker),
+	BMW_DEPTH_FIRST,
+	0, /* valid restrict masks */ /* could add flags here but so far none are used */
+};
+
+static BMWalker bmw_EdgeringWalker_Type = {
+	bmw_EdgeringWalker_begin,
+	bmw_EdgeringWalker_step,
+	bmw_EdgeringWalker_yield,
+	sizeof(BMwEdgeringWalker),
+	BMW_DEPTH_FIRST,
+	0, /* valid restrict masks */ /* could add flags here but so far none are used */
+};
+
+static BMWalker bmw_UVEdgeWalker_Type = {
+	bmw_UVEdgeWalker_begin,
+	bmw_UVEdgeWalker_step,
+	bmw_UVEdgeWalker_yield,
+	sizeof(BMwUVEdgeWalker),
+	BMW_DEPTH_FIRST,
+	BM_EDGE, /* valid restrict masks */
+};
+
+static BMWalker bmw_ConnectedVertexWalker_Type = {
+	bmw_ConnectedVertexWalker_begin,
+	bmw_ConnectedVertexWalker_step,
+	bmw_ConnectedVertexWalker_yield,
+	sizeof(BMwConnectedVertexWalker),
+	BMW_BREADTH_FIRST,
+	BM_VERT, /* valid restrict masks */
+};
+
+BMWalker *bm_walker_types[] = {
+	&bmw_ShellWalker_Type,              /* BMW_SHELL */
+	&bmw_LoopWalker_Type,               /* BMW_LOOP */
+	&bmw_FaceLoopWalker_Type,           /* BMW_FACELOOP */
+	&bmw_EdgeringWalker_Type,           /* BMW_EDGERING */
+	&bmw_UVEdgeWalker_Type,             /* BMW_LOOPDATA_ISLAND */
+	&bmw_IslandboundWalker_Type,        /* BMW_ISLANDBOUND */
+	&bmw_IslandWalker_Type,             /* BMW_ISLAND */
+	&bmw_ConnectedVertexWalker_Type,    /* BMW_CONNECTED_VERTEX */
+};
+
+const int bm_totwalkers = sizeof(bm_walker_types) / sizeof(*bm_walker_types);
diff --git a/source/blender/bmesh/intern/bmesh_walkers_private.h b/source/blender/bmesh/intern/bmesh_walkers_private.h
new file mode 100644
index 0000000..fc56393
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_walkers_private.h
@@ -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.
+ *
+ * Contributor(s): Joseph Eagar, Geoffrey Bantle.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BMESH_WALKERS_PRIVATE_H__
+#define __BMESH_WALKERS_PRIVATE_H__
+
+/** \file blender/bmesh/intern/bmesh_walkers_private.h
+ *  \ingroup bmesh
+ *
+ * BMesh walker API.
+ */
+
+extern BMWalker *bm_walker_types[];
+extern const int bm_totwalkers;
+
+
+/* Pointer hiding */
+typedef struct BMwGenericWalker {
+	Link link;
+	int depth;
+} BMwGenericWalker;
+
+
+typedef struct BMwShellWalker {
+	BMwGenericWalker header;
+	BMEdge *curedge;
+} BMwShellWalker;
+
+typedef struct BMwIslandboundWalker {
+	BMwGenericWalker header;
+	BMLoop *base;
+	BMVert *lastv;
+	BMLoop *curloop;
+} BMwIslandboundWalker;
+
+typedef struct BMwIslandWalker {
+	BMwGenericWalker header;
+	BMFace *cur;
+} BMwIslandWalker;
+
+typedef struct BMwLoopWalker {
+	BMwGenericWalker header;
+	BMEdge *cur, *start;
+	BMVert *lastv, *startv;
+	BMFace *f_hub;
+	short is_boundary; /* boundary looping changes behavior */
+	short is_single;  /* single means the edge verts are only connected to 1 face */
+} BMwLoopWalker;
+
+typedef struct BMwFaceLoopWalker {
+	BMwGenericWalker header;
+	BMLoop *l;
+	int nocalc;
+} BMwFaceLoopWalker;
+
+typedef struct BMwEdgeringWalker {
+	BMwGenericWalker header;
+	BMLoop *l;
+	BMEdge *wireedge;
+} BMwEdgeringWalker;
+
+typedef struct BMwUVEdgeWalker {
+	BMwGenericWalker header;
+	BMLoop *l;
+} BMwUVEdgeWalker;
+
+typedef struct BMwConnectedVertexWalker {
+	BMwGenericWalker header;
+	BMVert *curvert;
+} BMwConnectedVertexWalker;
+
+#endif /* __BMESH_WALKERS_PRIVATE_H__ */
diff --git a/source/blender/bmesh/operators/bmo_bevel.c b/source/blender/bmesh/operators/bmo_bevel.c
new file mode 100644
index 0000000..46dd760
--- /dev/null
+++ b/source/blender/bmesh/operators/bmo_bevel.c
@@ -0,0 +1,888 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/operators/bmo_bevel.c
+ *  \ingroup bmesh
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_array.h"
+#include "BLI_math.h"
+#include "BLI_smallhash.h"
+
+#include "BKE_customdata.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 straignt 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.5) * shell_angle_to_dist(0.5f * angle));
+		}
+		else {
+			mul_v3_fl(co_ofs, fac * 0.5);
+		}
+	}
+
+	/* 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_growone(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;
+
+				BM_ITER_ELEM (l2, &liter2, l->f, BM_LOOPS_OF_FACE) {
+					BM_elem_index_set(l2, BLI_array_count(tags)); /* set_loop */
+					BLI_array_growone(tags);
+
+					if (!BMO_elem_flag_test(bm, l2->e, EDGE_OLD)) {
+						BM_elem_index_set(l2->e, BLI_array_count(etags)); /* set_dirty! */
+						BLI_array_growone(etags);
+						
+						BMO_elem_flag_enable(bm, l2->e, EDGE_OLD);
+					}
+				}
+
+				BMO_elem_flag_enable(bm, l->f, BEVEL_FLAG);
+				BLI_array_append(faces, l->f);
+			}
+		}
+		else {
+			BM_elem_index_set(e, -1); /* set_dirty! */
+		}
+	}
+#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_growone(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_growone(tags);
+					BM_elem_index_set(l2, BLI_array_count(tags) - 1); /* set_loop */
+					
+					if (!BLI_smallhash_haskey(&hash, (intptr_t)l2->e)) {
+						BLI_array_growone(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);
+			}
+		}
+	}
+
+	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);
+
+					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);
+			}
+		}
+	}
+	
+	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 (!f) {
+			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 (!f) {
+					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 (!f) {
+				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, "del 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, "del geom=%fe context=%i", BEVEL_DEL, DEL_EDGES);
+	BMO_op_callf(bm, "del 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
new file mode 100644
index 0000000..3c1f10b
--- /dev/null
+++ b/source/blender/bmesh/operators/bmo_connect.c
@@ -0,0 +1,491 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/operators/bmo_connect.c
+ *  \ingroup bmesh
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_math.h"
+#include "BLI_array.h"
+#include "BLI_utildefines.h"
+
+#include "bmesh.h"
+
+#include "intern/bmesh_operators_private.h" /* own include */
+
+#define VERT_INPUT	1
+#define EDGE_OUT	1
+#define FACE_NEW	2
+#define EDGE_MARK	4
+#define EDGE_DONE	8
+
+void bmo_connectverts_exec(BMesh *bm, BMOperator *op)
+{
+	BMIter iter, liter;
+	BMFace *f, *nf;
+	BMLoop **loops = NULL, *lastl = NULL;
+	BLI_array_declare(loops);
+	BMLoop *l, *nl;
+	BMVert **verts = NULL;
+	BLI_array_declare(verts);
+	int i;
+	
+	BMO_slot_buffer_flag_enable(bm, op, "verts", BM_VERT, VERT_INPUT);
+
+	for (f = BM_iter_new(&iter, bm, BM_FACES_OF_MESH, NULL); f; f = BM_iter_step(&iter)) {
+		BLI_array_empty(loops);
+		BLI_array_empty(verts);
+		
+		if (BMO_elem_flag_test(bm, f, FACE_NEW)) {
+			continue;
+		}
+
+		l = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, f);
+		lastl = NULL;
+		for ( ; l; l = BM_iter_step(&liter)) {
+			if (BMO_elem_flag_test(bm, l->v, VERT_INPUT)) {
+				if (!lastl) {
+					lastl = l;
+					continue;
+				}
+
+				if (lastl != l->prev && lastl != l->next) {
+					BLI_array_growone(loops);
+					loops[BLI_array_count(loops) - 1] = lastl;
+
+					BLI_array_growone(loops);
+					loops[BLI_array_count(loops) - 1] = l;
+
+				}
+				lastl = l;
+			}
+		}
+
+		if (BLI_array_count(loops) == 0) {
+			continue;
+		}
+		
+		if (BLI_array_count(loops) > 2) {
+			BLI_array_growone(loops);
+			loops[BLI_array_count(loops) - 1] = loops[BLI_array_count(loops) - 2];
+
+			BLI_array_growone(loops);
+			loops[BLI_array_count(loops) - 1] = loops[0];
+		}
+
+		BM_face_legal_splits(bm, f, (BMLoop *(*)[2])loops, BLI_array_count(loops) / 2);
+		
+		for (i = 0; i < BLI_array_count(loops) / 2; i++) {
+			if (loops[i * 2] == NULL) {
+				continue;
+			}
+
+			BLI_array_growone(verts);
+			verts[BLI_array_count(verts) - 1] = loops[i * 2]->v;
+
+			BLI_array_growone(verts);
+			verts[BLI_array_count(verts) - 1] = loops[i * 2 + 1]->v;
+		}
+
+		for (i = 0; i < BLI_array_count(verts) / 2; i++) {
+			nf = BM_face_split(bm, f, verts[i * 2], verts[i * 2 + 1], &nl, NULL, FALSE);
+			f = nf;
+			
+			if (!nl || !nf) {
+				BMO_error_raise(bm, op, BMERR_CONNECTVERT_FAILED, NULL);
+				BLI_array_free(loops);
+				return;
+			}
+			BMO_elem_flag_enable(bm, nf, FACE_NEW);
+			BMO_elem_flag_enable(bm, nl->e, EDGE_OUT);
+		}
+	}
+
+	BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, EDGE_OUT);
+
+	BLI_array_free(loops);
+	BLI_array_free(verts);
+}
+
+static BMVert *get_outer_vert(BMesh *bm, BMEdge *e)
+{
+	BMIter iter;
+	BMEdge *e2;
+	int i;
+
+	i = 0;
+	BM_ITER_ELEM (e2, &iter, e->v1, BM_EDGES_OF_VERT) {
+		if (BMO_elem_flag_test(bm, e2, EDGE_MARK)) {
+			i++;
+		}
+	}
+
+	return (i == 2) ? e->v2 : e->v1;
+}
+
+/* Clamp x to the interval {0..len-1}, with wrap-around */
+static int clamp_index(const int x, const int len)
+{
+	if (x >= 0) {
+		return x % len;
+	}
+	else {
+		int r = len - (-x % len);
+		if (r == len)
+			return len - 1;
+		else
+			return r;
+	}
+}
+
+/* There probably is a better way to swap BLI_arrays, or if there
+ * isn't there should be... */
+#define ARRAY_SWAP(elemtype, arr1, arr2)                                      \
+	{                                                                         \
+		int i;                                                                \
+		elemtype *arr_tmp = NULL;                                             \
+		BLI_array_declare(arr_tmp);                                           \
+		for (i = 0; i < BLI_array_count(arr1); i++) {                         \
+			BLI_array_append(arr_tmp, arr1[i]);                               \
+		}                                                                     \
+		BLI_array_empty(arr1);                                                \
+		for (i = 0; i < BLI_array_count(arr2); i++) {                         \
+			BLI_array_append(arr1, arr2[i]);                                  \
+		}                                                                     \
+		BLI_array_empty(arr2);                                                \
+		for (i = 0; i < BLI_array_count(arr_tmp); i++) {                      \
+			BLI_array_append(arr2, arr_tmp[i]);                               \
+		}                                                                     \
+		BLI_array_free(arr_tmp);                                              \
+	}
+
+/* get the 2 loops matching 2 verts.
+ * first attempt to get the face corners that use the edge defined by v1 & v2,
+ * if that fails just get any loop thats on the vert (the first one) */
+static void bm_vert_loop_pair(BMesh *bm, BMVert *v1, BMVert *v2, BMLoop **l1, BMLoop **l2)
+{
+	BMIter liter;
+	BMLoop *l;
+
+	if ((v1->e && v1->e->l) &&
+	    (v2->e && v2->e->l))
+	{
+		BM_ITER_ELEM (l, &liter, v1, BM_LOOPS_OF_VERT) {
+			if (l->prev->v == v2) {
+				*l1 = l;
+				*l2 = l->prev;
+				return;
+			}
+			else if (l->next->v == v2) {
+				*l1 = l;
+				*l2 = l->next;
+				return;
+			}
+		}
+	}
+
+	/* fallback to _any_ loop */
+	*l1 = BM_iter_at_index(bm, BM_LOOPS_OF_VERT, v1, 0);
+	*l2 = BM_iter_at_index(bm, BM_LOOPS_OF_VERT, v2, 0);
+}
+
+void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op)
+{
+	BMEdge **ee1 = NULL, **ee2 = NULL;
+	BMVert **vv1 = NULL, **vv2 = NULL;
+	BLI_array_declare(ee1);
+	BLI_array_declare(ee2);
+	BLI_array_declare(vv1);
+	BLI_array_declare(vv2);
+	BMOIter siter;
+	BMIter iter;
+	BMEdge *e, *nexte;
+	int c = 0, cl1 = 0, cl2 = 0;
+
+	BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_MARK);
+
+	BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+		if (!BMO_elem_flag_test(bm, e, EDGE_DONE)) {
+			BMVert *v, *ov;
+			/* BMEdge *e2, *e3, *oe = e; */ /* UNUSED */
+			BMEdge *e2, *e3;
+			
+			if (c > 2) {
+				BMO_error_raise(bm, op, BMERR_INVALID_SELECTION, "Select only two edge loops");
+				goto cleanup;
+			}
+			
+			e2 = e;
+			v = e->v1;
+			do {
+				v = BM_edge_other_vert(e2, v);
+				nexte = NULL;
+				BM_ITER_ELEM (e3, &iter, v, BM_EDGES_OF_VERT) {
+					if (e3 != e2 && BMO_elem_flag_test(bm, e3, EDGE_MARK)) {
+						if (nexte == NULL) {
+							nexte = e3;
+						}
+						else {
+							/* edges do not form a loop: there is a disk
+							 * with more than two marked edges. */
+							BMO_error_raise(bm, op, BMERR_INVALID_SELECTION,
+							                "Selection must only contain edges from two edge loops");
+							goto cleanup;
+						}
+					}
+				}
+				
+				if (nexte)
+					e2 = nexte;
+			} while (nexte && e2 != e);
+			
+			if (!e2)
+				e2 = e;
+
+			e = e2;
+			ov = v;
+			do {
+				if (c == 0) {
+					BLI_array_append(ee1, e2);
+					BLI_array_append(vv1, v);
+				}
+				else {
+					BLI_array_append(ee2, e2);
+					BLI_array_append(vv2, v);
+				}
+				
+				BMO_elem_flag_enable(bm, e2, EDGE_DONE);
+				
+				v = BM_edge_other_vert(e2, v);
+				BM_ITER_ELEM (e3, &iter, v, BM_EDGES_OF_VERT) {
+					if (e3 != e2 && BMO_elem_flag_test(bm, e3, EDGE_MARK) && !BMO_elem_flag_test(bm, e3, EDGE_DONE)) {
+						break;
+					}
+				}
+				if (e3)
+					e2 = e3;
+			} while (e3 && e2 != e);
+			
+			if (v && !e3) {
+				if (c == 0) {
+					if (BLI_array_count(vv1) && v == vv1[BLI_array_count(vv1) - 1]) {
+						printf("%s: internal state waning *TODO DESCRIPTION!*\n", __func__);
+					}
+					BLI_array_append(vv1, v);
+				}
+				else {
+					BLI_array_append(vv2, v);
+				}
+			}
+			
+			/* test for connected loops, and set cl1 or cl2 if so */
+			if (v == ov) {
+				if (c == 0) {
+					cl1 = 1;
+				}
+				else {
+					cl2 = 1;
+				}
+			}
+			
+			c++;
+		}
+	}
+
+	if (ee1 && ee2) {
+		int i, j;
+		BMVert *v1, *v2, *v3, *v4;
+		int starti = 0, dir1 = 1, wdir = 0, lenv1, lenv2;
+
+		/* Simplify code below by avoiding the (!cl1 && cl2) case */
+		if (!cl1 && cl2) {
+			SWAP(int, cl1, cl2);
+			ARRAY_SWAP(BMVert *, vv1, vv2);
+			ARRAY_SWAP(BMEdge *, ee1, ee2);
+		}
+
+		lenv1 = lenv2 = BLI_array_count(vv1);
+
+		/* Below code assumes vv1/vv2 each have at least two verts. should always be
+		 * a safe assumption, since ee1/ee2 are non-empty and an edge has two verts. */
+		BLI_assert((lenv1 > 1) && (lenv2 > 1));
+
+		/* BMESH_TODO: Would be nice to handle cases where the edge loops
+		 * have different edge counts by generating triangles & quads for
+		 * the bridge instead of quads only. */
+		if (BLI_array_count(ee1) != BLI_array_count(ee2)) {
+			BMO_error_raise(bm, op, BMERR_INVALID_SELECTION,
+			                "Selected loops must have equal edge counts");
+			goto cleanup;
+		}
+
+		j = 0;
+		if (vv1[0] == vv1[lenv1 - 1]) {
+			lenv1--;
+		}
+		if (vv2[0] == vv2[lenv2 - 1]) {
+			lenv2--;
+		}
+
+		/* Find starting point and winding direction for two unclosed loops */
+		if (!cl1 && !cl2) {
+			/* First point of loop 1 */
+			v1 = get_outer_vert(bm, ee1[0]);
+			/* Last point of loop 1 */
+			v2 = get_outer_vert(bm, ee1[clamp_index(-1, BLI_array_count(ee1))]);
+			/* First point of loop 2 */
+			v3 = get_outer_vert(bm, ee2[0]);
+			/* Last point of loop 2 */
+			v4 = get_outer_vert(bm, ee2[clamp_index(-1, BLI_array_count(ee2))]);
+
+			/* If v1 is a better match for v4 than v3, AND v2 is a better match
+			 * for v3 than v4, the loops are in opposite directions, so reverse
+			 * the order of reads from vv1. We can avoid sqrt for comparison */
+			if (len_squared_v3v3(v1->co, v3->co) > len_squared_v3v3(v1->co, v4->co) &&
+			    len_squared_v3v3(v2->co, v4->co) > len_squared_v3v3(v2->co, v3->co))
+			{
+				dir1 = -1;
+				starti = clamp_index(-1, lenv1);
+			}
+		}
+
+		/* Find the shortest distance from a vert in vv1 to vv2[0]. Use that
+		 * vertex in vv1 as a starting point in the first loop, while starting
+		 * from vv2[0] in the second loop. This is a simplistic attempt to get
+		 * a better edge-to-edge match between the two loops. */
+		if (cl1) {
+			int previ, nexti;
+			float min = 1e32;
+
+			/* BMESH_TODO: Would be nice to do a more thorough analysis of all
+			 * the vertices in both loops to find a more accurate match for the
+			 * starting point and winding direction of the bridge generation. */
+			
+			for (i = 0; i < BLI_array_count(vv1); i++) {
+				if (len_v3v3(vv1[i]->co, vv2[0]->co) < min) {
+					min = len_v3v3(vv1[i]->co, vv2[0]->co);
+					starti = i;
+				}
+			}
+
+			/* Reverse iteration order for the first loop if the distance of
+			 * the (starti - 1) vert from vv1 is a better match for vv2[1] than
+			 * the (starti + 1) vert.
+			 *
+			 * This is not always going to be right, but it will work better in
+			 * the average case.
+			 */
+			previ = clamp_index(starti - 1, lenv1);
+			nexti = clamp_index(starti + 1, lenv1);
+
+			/* avoid sqrt for comparison */
+			if (len_squared_v3v3(vv1[nexti]->co, vv2[1]->co) > len_squared_v3v3(vv1[previ]->co, vv2[1]->co)) {
+				/* reverse direction for reading vv1 (1 is forward, -1 is backward) */
+				dir1 = -1;
+			}
+		}
+
+		/* Vert rough attempt to determine proper winding for the bridge quads:
+		 * just uses the first loop it finds for any of the edges of ee2 or ee1 */
+		if (wdir == 0) {
+			for (i = 0; i < BLI_array_count(ee2); i++) {
+				if (ee2[i]->l) {
+					wdir = (ee2[i]->l->v == vv2[i]) ? (-1) : (1);
+					break;
+				}
+			}
+		}
+		if (wdir == 0) {
+			for (i = 0; i < BLI_array_count(ee1); i++) {
+				j = clamp_index((i * dir1) + starti, BLI_array_count(ee1));
+				if (ee1[j]->l && ee2[j]->l) {
+					wdir = (ee2[j]->l->v == vv2[j]) ? (1) : (-1);
+					break;
+				}
+			}
+		}
+		
+		/* Generate the bridge quads */
+		for (i = 0; i < BLI_array_count(ee1) && i < BLI_array_count(ee2); i++) {
+			BMFace *f;
+
+			BMLoop *l_1 = NULL;
+			BMLoop *l_2 = NULL;
+			BMLoop *l_1_next = NULL;
+			BMLoop *l_2_next = NULL;
+			BMLoop *l_iter;
+			BMFace *f_example;
+
+			int i1, i1next, i2, i2next;
+
+			i1 = clamp_index(i * dir1 + starti, lenv1);
+			i1next = clamp_index((i + 1) * dir1 + starti, lenv1);
+			i2 = i;
+			i2next = clamp_index(i + 1, lenv2);
+
+			if (vv1[i1] ==  vv1[i1next]) {
+				continue;
+			}
+
+			if (wdir < 0) {
+				SWAP(int, i1, i1next);
+				SWAP(int, i2, i2next);
+			}
+
+			/* get loop data - before making the face */
+			bm_vert_loop_pair(bm, vv1[i1], vv2[i2], &l_1, &l_2);
+			bm_vert_loop_pair(bm, vv1[i1next], vv2[i2next], &l_1_next, &l_2_next);
+			/* copy if loop data if its is missing on one ring */
+			if (l_1 && l_1_next == NULL) l_1_next = l_1;
+			if (l_1_next && l_1 == NULL) l_1 = l_1_next;
+			if (l_2 && l_2_next == NULL) l_2_next = l_2;
+			if (l_2_next && l_2 == NULL) l_2 = l_2_next;
+			f_example = l_1 ? l_1->f : (l_2 ? l_2->f : NULL);
+
+			f = BM_face_create_quad_tri(bm,
+			                            vv1[i1],
+			                            vv2[i2],
+			                            vv2[i2next],
+			                            vv1[i1next],
+			                            f_example, TRUE);
+			if (!f || f->len != 4) {
+				fprintf(stderr, "%s: in bridge! (bmesh internal error)\n", __func__);
+			}
+			else {
+				l_iter = BM_FACE_FIRST_LOOP(f);
+
+				if (l_1)      BM_elem_attrs_copy(bm, bm, l_1,      l_iter); l_iter = l_iter->next;
+				if (l_2)      BM_elem_attrs_copy(bm, bm, l_2,      l_iter); l_iter = l_iter->next;
+				if (l_2_next) BM_elem_attrs_copy(bm, bm, l_2_next, l_iter); l_iter = l_iter->next;
+				if (l_1_next) BM_elem_attrs_copy(bm, bm, l_1_next, l_iter);
+			}
+		}
+	}
+
+cleanup:
+	BLI_array_free(ee1);
+	BLI_array_free(ee2);
+	BLI_array_free(vv1);
+	BLI_array_free(vv2);
+}
diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c
new file mode 100644
index 0000000..f2ba110
--- /dev/null
+++ b/source/blender/bmesh/operators/bmo_create.c
@@ -0,0 +1,1487 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/operators/bmo_create.c
+ *  \ingroup bmesh
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_heap.h"
+#include "BLI_listbase.h"
+#include "BLI_math.h"
+#include "BLI_array.h"
+#include "BLI_smallhash.h"
+#include "BLI_rand.h"
+
+#include "bmesh.h"
+
+#include "intern/bmesh_operators_private.h" /* own include */
+
+#define EDGE_MARK	1
+#define EDGE_VIS	2
+
+#define FACE_NEW	1
+
+#define ELE_NEW		1
+#define ELE_OUT		2
+#define ELE_ORIG	4
+
+#define FACE_IGNORE	16
+
+typedef struct EPathNode {
+	struct EPathNode *next, *prev;
+	BMVert *v;
+	BMEdge *e;
+	BMEdge *cure;
+} EPathNode;
+
+typedef struct EPath {
+	ListBase nodes;
+	float weight;
+	int group;
+} EPath;
+
+typedef struct PathBase {
+	BLI_mempool *nodepool, *pathpool;
+} PathBase;
+
+typedef struct EdgeData {
+	int tag;
+	int ftag;
+	BMDiskLink v1_disk_link, v2_disk_link;
+} EdgeData;
+
+typedef struct VertData {
+	BMEdge *e;
+	float no[3], offco[3], sco[3]; /* offco is vertex coordinate slightly offset randomly */
+	int tag;
+} VertData;
+
+static int count_edge_faces(BMesh *bm, BMEdge *e);
+
+/****  rotation system code * */
+
+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) ;
+}
+
+static int rotsys_append_edge(BMEdge *e, BMVert *v,
+                              EdgeData *edata, VertData *vdata)
+{
+	EdgeData *ed = &edata[BM_elem_index_get(e)];
+	VertData *vd = &vdata[BM_elem_index_get(v)];
+	
+	if (!vd->e) {
+		Link *e1 = (Link *)rs_edge_link_get(e, v, ed);
+
+		vd->e = e;
+		e1->next = e1->prev = (Link *)e;
+	}
+	else {
+		BMDiskLink *dl1, *dl2, *dl3;
+		EdgeData *ved = &edata[BM_elem_index_get(vd->e)];
+
+		dl1 = rs_edge_link_get(e, v, ed);
+		dl2 = rs_edge_link_get(vd->e, v, ved);
+		dl3 = dl2->prev ? rs_edge_link_get(dl2->prev, v, &edata[BM_elem_index_get(dl2->prev)]) : NULL;
+
+		dl1->next = vd->e;
+		dl1->prev = dl2->prev;
+
+		dl2->prev = e;
+		if (dl3) {
+			dl3->next = e;
+		}
+	}
+
+	return TRUE;
+}
+
+static void UNUSED_FUNCTION(rotsys_remove_edge)(BMEdge *e, BMVert *v,
+                                                EdgeData *edata, VertData *vdata)
+{
+	EdgeData *ed = edata + BM_elem_index_get(e);
+	VertData *vd = vdata + BM_elem_index_get(v);
+	BMDiskLink *e1, *e2;
+
+	e1 = rs_edge_link_get(e, v, ed);
+	if (e1->prev) {
+		e2 = rs_edge_link_get(e1->prev, v, ed);
+		e2->next = e1->next;
+	}
+
+	if (e1->next) {
+		e2 = rs_edge_link_get(e1->next, v, ed);
+		e2->prev = e1->prev;
+	}
+
+	if (vd->e == e)
+		vd->e = (e != e1->next) ? e1->next : NULL;
+
+	e1->next = e1->prev = NULL;
+}
+
+static BMEdge *rotsys_nextedge(BMEdge *e, BMVert *v,
+                               EdgeData *edata, VertData *UNUSED(vdata))
+{
+	if (v == e->v1)
+		return edata[BM_elem_index_get(e)].v1_disk_link.next;
+	if (v == e->v2)
+		return edata[BM_elem_index_get(e)].v2_disk_link.next;
+	return NULL;
+}
+
+static BMEdge *rotsys_prevedge(BMEdge *e, BMVert *v,
+                               EdgeData *edata, VertData *UNUSED(vdata))
+{
+	if (v == e->v1)
+		return edata[BM_elem_index_get(e)].v1_disk_link.prev;
+	if (v == e->v2)
+		return edata[BM_elem_index_get(e)].v2_disk_link.prev;
+	return NULL;
+}
+
+static void rotsys_reverse(BMEdge *UNUSED(e), BMVert *v, EdgeData *edata, VertData *vdata)
+{
+	BMEdge **edges = NULL;
+	BMEdge *e_first;
+	BMEdge *e;
+	BLI_array_staticdeclare(edges, BM_NGON_STACK_SIZE);
+	int i, totedge;
+	
+	e = e_first = vdata[BM_elem_index_get(v)].e;
+	do {
+		BLI_array_append(edges, e);
+		e = rotsys_nextedge(e, v, edata, vdata);
+	} while (e != e_first);
+	
+	totedge = BLI_array_count(edges);
+	for (i = 0; i < totedge / 2; i++) {
+		SWAP(BMEdge *, edges[i], edges[totedge - 1 - i]);
+	}
+	
+	vdata[BM_elem_index_get(v)].e = NULL;
+	for (i = 0; i < totedge; i++) {
+		rotsys_append_edge(edges[i], v, edata, vdata);
+	}
+	
+	BLI_array_free(edges);
+}
+
+static int UNUSED_FUNCTION(rotsys_count)(BMVert *v, EdgeData *edata, VertData *vdata)
+{
+	BMEdge *e = vdata[BM_elem_index_get(v)].e;
+	int i = 0;
+
+	if (!e)
+		return 0;
+
+	do {
+		if (!e)
+			return 0;
+		e =  rotsys_nextedge(e, v, edata, vdata);
+
+		if (i >= (1 << 20)) {
+			printf("bmesh error: infinite loop in disk cycle!\n");
+			return 0;
+		}
+
+		i += 1;
+	} while (e != vdata[BM_elem_index_get(v)].e);
+
+	return i;
+}
+
+static int UNUSED_FUNCTION(rotsys_fill_faces)(BMesh *bm, EdgeData *edata, VertData *vdata)
+{
+	BMIter iter;
+	BMEdge *e, **edges = NULL;
+	BLI_array_declare(edges);
+	BMVert *v, **verts = NULL;
+	BMFace *f;
+	BLI_array_declare(verts);
+	SmallHash visithash, *hash = &visithash;
+	int i;
+	
+	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+		BMEdge *e2, *starte;
+		BMVert *startv;
+		int rad, ok;
+		
+		rad = count_edge_faces(bm, e);
+		
+		if (rad < 2) {
+			starte = e;
+		}
+		else {
+			continue;
+		}
+
+		/* do two passes, going forward then backward */
+		for (i = 0; i < 2; i++) {
+			BLI_smallhash_init(hash);
+			
+			BLI_array_empty(verts);
+			BLI_array_empty(edges);
+
+			startv = v = starte->v1;
+			e2 = starte;
+			ok = 1;
+			if (!v || !e2)
+				continue;
+
+			do {
+				if (BLI_smallhash_haskey(hash, (intptr_t)e2) ||
+				    BLI_smallhash_haskey(hash, (intptr_t)v))
+				{
+					ok = 0;
+					break;
+				}
+				
+				BLI_array_append(verts, v);
+				BLI_array_append(edges, e2);
+				
+				BLI_smallhash_insert(hash, (intptr_t)e2, NULL);
+
+				v = BM_edge_other_vert(e2, v);
+				e2 = i ? rotsys_prevedge(e2, v, edata, vdata) : rotsys_nextedge(e2, v, edata, vdata);
+			} while (e2 != starte && v != startv);
+			
+			BLI_smallhash_release(hash);
+			
+			if (!ok || BLI_array_count(edges) < 3)
+				continue;
+			
+			f = BM_face_create_ngon(bm, verts[0], verts[1], edges, BLI_array_count(edges), TRUE);
+			if (!f)
+				continue;
+		}
+	}
+	
+	return 0;
+}
+
+static void rotsys_make_consistent(BMesh *bm, EdgeData *edata, VertData *vdata)
+{
+	BMIter iter;
+	BMEdge *e;
+	BMVert *v, **stack = NULL;
+	BLI_array_declare(stack);
+	int i;
+	
+	for (i = 0; i < bm->totvert; i++) {
+		vdata[i].tag = 0;
+	}
+	
+	while (1) {
+		VertData *vd;
+		BMVert *startv = NULL;
+		float dis;
+		
+		v = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL);
+		for (i = 0; i < bm->totvert; i++, BM_iter_step(&iter)) {
+			vd = vdata + BM_elem_index_get(v);
+			
+			if (vd->tag)
+				continue;
+			
+			if (!startv || dot_v3v3(vd->offco, vd->offco) > dis) {
+				dis = dot_v3v3(vd->offco, vd->offco);
+				startv = v;
+			}
+		}
+		
+		if (!startv)
+			break;
+		
+		vd = vdata + BM_elem_index_get(startv);
+		
+		BLI_array_empty(stack);
+		BLI_array_append(stack, startv);
+		
+		vd->tag = 1;
+		
+		while (BLI_array_count(stack)) {
+			v = BLI_array_pop(stack);
+			vd = vdata + BM_elem_index_get(v);
+			
+			if (!vd->e)
+				continue;
+			
+			e = vd->e;
+			do {
+				BMVert *v2 = BM_edge_other_vert(e, v);
+				VertData *vd2 = vdata + BM_elem_index_get(v2);
+				
+				if (dot_v3v3(vd->no, vd2->no) < 0.0f + FLT_EPSILON * 2) {
+					rotsys_reverse(e, v2, edata, vdata);
+					mul_v3_fl(vd2->no, -1.0f);
+				}
+
+				if (!vd2->tag) {
+					BLI_array_append(stack, v2);
+					vd2->tag = 1;
+				}
+				
+				e = rotsys_nextedge(e, v, edata, vdata);
+			} while (e != vd->e);
+		}
+	}
+
+	BLI_array_free(stack);
+}
+
+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);
+	BMVert *v;
+	/* BMVert **verts = NULL; */
+	/* BLI_array_staticdeclare(verts, BM_NGON_STACK_SIZE); */ /* UNUSE */
+	int i;
+	
+#define SIGN(n) ((n)<0.0f)
+	
+	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+		BMIter eiter;
+		float no[3], cent[3];
+		int j, k = 0, totedge = 0;
+		
+		if (BM_elem_index_get(v) == -1)
+			continue;
+		
+		BLI_array_empty(edges);
+		
+		BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
+			if (BMO_elem_flag_test(bm, e, EDGE_MARK)) {
+				BLI_array_append(edges, e);
+				totedge++;
+			}
+		}
+		
+		copy_v3_v3(cent, v->co);
+		
+		zero_v3(no);
+		for (i = 0; i < totedge; i++) {
+			BMEdge *e1, *e2;
+			float cno[3], vec1[3], vec2[3];
+			
+			e1 = edges[i];
+			e2 = edges[(i + 1) % totedge];
+
+			sub_v3_v3v3(vec1, (BM_edge_other_vert(e1, v))->co, v->co);
+			sub_v3_v3v3(vec2, (BM_edge_other_vert(e2, v))->co, v->co);
+			
+			cross_v3_v3v3(cno, vec1, vec2);
+			normalize_v3(cno);
+			
+			if (i && dot_v3v3(cno, no) < 0.0f + FLT_EPSILON * 10)
+				mul_v3_fl(cno, -1.0f);
+			
+			add_v3_v3(no, cno);
+			normalize_v3(no);
+		}
+		
+		/* generate plane-flattened coordinates */
+		for (i = 0; i < totedge; i++) {
+			BMEdge *e1;
+			BMVert *v2;
+			float cvec[3], vec1[3];
+			
+			e1 = edges[i];
+			v2 = BM_edge_other_vert(e1, v);
+			
+			sub_v3_v3v3(vec1, v2->co, v->co);
+			
+			cross_v3_v3v3(cvec, vec1, no);
+			cross_v3_v3v3(vec1, cvec, no);
+			normalize_v3(vec1);
+			
+			mul_v3_fl(vec1, len_v3v3(v2->co, v->co));
+			add_v3_v3(vec1, v->co);
+			
+			copy_v3_v3(vdata[BM_elem_index_get(v2)].sco, vec1);
+		}
+		
+		BLI_srandom(0);
+		
+		/* first, ensure no 0 or 180 angles between adjacent
+		 * (and that adjacent's adjacent) edges */
+		for (i = 0, k = 0; i < totedge; i++) {
+			BMEdge *e1, *e2, *e3 = NULL;
+			BMVert *v1, *v2, *v3;
+			VertData *vd1, *vd2, *vd3;
+			float vec1[3], vec2[3], vec3[3], size;
+			int s1, s2, s3;
+			
+			if (totedge < 3)
+				continue;
+			
+			e1 = edges[(i + totedge - 1) % totedge];
+			e2 = edges[i];
+			e3 = edges[(i + 1) % totedge];
+			
+			v1 = BM_edge_other_vert(e1, v);
+			v2 = BM_edge_other_vert(e2, v);
+			v3 = BM_edge_other_vert(e3, v);
+
+			vd1 = vdata + BM_elem_index_get(v1);
+			vd2 = vdata + BM_elem_index_get(v2);
+			vd3 = vdata + BM_elem_index_get(v3);
+			
+			sub_v3_v3v3(vec1, vd1->sco, cent);
+			sub_v3_v3v3(vec2, vd2->sco, cent);
+			sub_v3_v3v3(vec3, vd3->sco, cent);
+			
+			size = (len_v3(vec1) + len_v3(vec3)) * 0.01f;
+			normalize_v3(vec1); normalize_v3(vec2); normalize_v3(vec3);
+			
+#ifdef STRAIGHT
+#undef STRAIGHT
+#endif
+#define STRAIGHT(vec11, vec22) (fabsf(dot_v3v3((vec11), (vec22))) > 1.0f - ((float)FLT_EPSILON * 1000.0f))
+			
+			s1 = STRAIGHT(vec1, vec2); s2 = STRAIGHT(vec2, vec3); s3 = STRAIGHT(vec1, vec3);
+			
+			if (s1 || s2 || s3) {
+				copy_v3_v3(cent, v->co);
+
+				for (j = 0; j < 3; j++) {
+					float fac = (BLI_frand() - 0.5f) * size;
+					cent[j] += fac;
+				}
+				
+				if (k < 2000) {
+					i = 0;
+					k++;
+					continue;
+				}
+				else {
+					k++;
+					continue;
+				}
+
+			}
+		}
+		
+		copy_v3_v3(vdata[BM_elem_index_get(v)].offco, cent);
+		//copy_v3_v3(v->co, cent);
+		
+		/* now, sort edges so the triangle fan of all edges
+		 * has a consistent normal.  this is the same as
+		 * sorting by polar coordinates along a group normal */
+		for (j = 0; j < totedge; j++) {
+			for (i = 0; i < totedge; i++) {
+				BMEdge *e1, *e2, *e3 = NULL;
+				BMVert *v1, *v2, *v3;
+				VertData *vd1, *vd2, *vd3;
+				float vec1[3], vec2[3], vec3[3], n1[3], n2[3], n3[3];
+				
+				e1 = edges[(i + totedge - 1) % totedge];
+				e2 = edges[i];
+				e3 = edges[(i + 1) % totedge];
+				
+				v1 = BM_edge_other_vert(e1, v);
+				v2 = BM_edge_other_vert(e2, v);
+				v3 = BM_edge_other_vert(e3, v);
+
+				vd1 = vdata + BM_elem_index_get(v1);
+				vd2 = vdata + BM_elem_index_get(v2);
+				vd3 = vdata + BM_elem_index_get(v3);
+
+				sub_v3_v3v3(vec1, vd1->sco, cent);
+				sub_v3_v3v3(vec2, vd2->sco, cent);
+				sub_v3_v3v3(vec3, vd3->sco, cent);
+				
+				cross_v3_v3v3(n1, vec1, vec2);
+				cross_v3_v3v3(n2, vec2, vec3);
+				cross_v3_v3v3(n3, vec1, vec3);
+
+				/* this case happens often enough and probably not worth bothering users with,
+				 * maybe enable for debugging code but not for everyday use - campbell */
+#if 0
+				/* Other way to determine if two vectors approach are (nearly) parallel: the
+				 * cross product of the two vectors will approach zero */
+				{
+					int s1, s2, s3;
+					s1 = (dot_v3v3(n1, n1) < (0.0f + FLT_EPSILON * 10));
+					s2 = (dot_v3v3(n2, n2) < (0.0f + FLT_EPSILON * 10));
+					s3 = (totedge < 3) ? 0 : (dot_v3v3(n3, n3) < (0.0f + FLT_EPSILON * 10));
+
+					if (s1 || s2 || s3) {
+						fprintf(stderr, "%s: s1: %d, s2: %d, s3: %dx (bmesh internal error)\n", __func__, s1, s2, s3);
+					}
+				}
+#endif
+
+				normalize_v3(n1); normalize_v3(n2); normalize_v3(n3);
+
+
+				if (dot_v3v3(n1, n2) < 0.0f) {
+					if (dot_v3v3(n1, n3) >= 0.0f + FLT_EPSILON * 10) {
+						SWAP(BMEdge *, edges[i], edges[(i + 1) % totedge]);
+					}
+					else {
+						SWAP(BMEdge *, edges[(i + totedge - 1) % totedge], edges[(i + 1) % totedge]);
+						SWAP(BMEdge *, edges[i], edges[(i + 1) % totedge]);
+					}
+				}
+			}
+		}
+		
+#undef STRAIGHT
+
+		zero_v3(no);
+
+		/* yay, edges are sorted */
+		for (i = 0; i < totedge; i++) {
+			BMEdge *e1 = edges[i], *e2 = edges[(i + 1) % totedge];
+			float eno[3];
+			
+			normal_tri_v3(eno, BM_edge_other_vert(e1, v)->co, v->co, BM_edge_other_vert(e2, v)->co);
+			add_v3_v3(no, eno);
+			
+			rotsys_append_edge(edges[i], v, edata, vdata);
+		}
+		
+		normalize_v3(no);
+		copy_v3_v3(vdata[BM_elem_index_get(v)].no, no);
+	}
+	
+	/* now, make sure rotation system is topologically consistent
+	 * (e.g. vert normals consistently point either inside or outside) */
+	rotsys_make_consistent(bm, edata, vdata);
+
+	//rotsys_fill_faces(bm, edata, vdata);
+
+#if 0
+	/* create visualizing geometr */
+	BMVert *lastv;
+	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+		BMVert *v2;
+		BMFace *f;
+		int totedge = BM_vert_edge_count(v);
+
+		if (BM_elem_index_get(v) == -1)
+			continue;
+		
+		//cv = BM_vert_create(bm, cent, v);
+		//BM_elem_index_set(cv, -1);  /* set_dirty! */
+		i = 0;
+		e = vdata[BM_elem_index_get(v)].e;
+		lastv = NULL;
+		do {
+			BMEdge *e2;
+			BMVert *v2;
+			float f = ((float)i / (float)totedge) * 0.35 + 0.05;
+			float co[3];
+			
+			if (!e)
+				break;
+
+			if (!BM_edge_other_vert(e, v))
+				continue;
+			
+			sub_v3_v3v3(co, (BM_edge_other_vert(e, v))->co, vdata[BM_elem_index_get(v)].offco);
+			mul_v3_fl(co, f);
+			add_v3_v3(co, vdata[BM_elem_index_get(v)].offco);
+			
+			v2 = BM_vert_create(bm, co, NULL);
+			BM_elem_index_set(v2, -1); /* set_dirty! */
+			//BM_edge_create(bm, cv, v2, NULL, FALSE);
+			
+			BM_vert_select_set(bm, v2, TRUE);
+			if (lastv) {
+				e2 = BM_edge_create(bm, lastv, v2, NULL, FALSE);
+				BM_edge_select_set(bm, e2, TRUE);
+			}
+			
+			lastv = v2;
+			
+			e = rotsys_nextedge(e, v, edata, vdata);
+			i++;
+		} while (e != vdata[BM_elem_index_get(v)].e);
+	}
+#endif
+
+	BLI_array_free(edges);
+}
+
+static PathBase *edge_pathbase_new(void)
+{
+	PathBase *pb = MEM_callocN(sizeof(PathBase), "PathBase");
+
+	pb->nodepool = BLI_mempool_create(sizeof(EPathNode), 1, 512, BLI_MEMPOOL_SYSMALLOC);
+	pb->pathpool = BLI_mempool_create(sizeof(EPath), 1, 512, BLI_MEMPOOL_SYSMALLOC);
+
+	return pb;
+}
+
+static void edge_pathbase_free(PathBase *pathbase)
+{
+	BLI_mempool_destroy(pathbase->nodepool);
+	BLI_mempool_destroy(pathbase->pathpool);
+	MEM_freeN(pathbase);
+}
+
+static EPath *edge_copy_add_path(PathBase *pb, EPath *path, BMVert *appendv, BMEdge *e)
+{
+	EPath *path2;
+	EPathNode *node, *node2;
+
+	path2 = BLI_mempool_alloc(pb->pathpool);
+	path2->nodes.first = path2->nodes.last = NULL;
+	path2->weight = 0.0f;
+	path2->group = path->group;
+	
+	for (node = path->nodes.first; node; node = node->next) {
+		node2 = BLI_mempool_alloc(pb->nodepool);
+		*node2 = *node;
+		BLI_addtail(&path2->nodes, node2);
+	}
+
+	node2 = BLI_mempool_alloc(pb->nodepool);
+	node2->v = appendv;
+	node2->e = e;
+	node2->cure = NULL;
+
+	BLI_addtail(&path2->nodes, node2);
+
+	return path2;
+}
+
+static EPath *edge_path_new(PathBase *pb, BMVert *start, BMEdge *starte)
+{
+	EPath *path;
+	EPathNode *node;
+
+	path = BLI_mempool_alloc(pb->pathpool);
+	node = BLI_mempool_alloc(pb->nodepool);
+	
+	path->nodes.first = path->nodes.last = NULL;
+	
+	node->v = start;
+	node->e = starte;
+	node->cure = NULL;
+
+	BLI_addtail(&path->nodes, node);
+	path->weight = 0.0f;
+
+	return path;
+}
+
+static float edge_weight_path(EPath *path, EdgeData *edata, VertData *UNUSED(vdata))
+{
+	EPathNode *node, *first = path->nodes.first;
+	float w = 0.0;
+
+	for (node = path->nodes.first; node; node = node->next) {
+		if (node->e && node != path->nodes.first) {
+			w += edata[BM_elem_index_get(node->e)].ftag;
+			if (node->prev) {
+				/* BMESH_TOD */
+				(void)first;
+				//w += len_v3v3(node->v->co, first->e->v1->co) * 0.0001f;
+				//w += len_v3v3(node->v->co, first->e->v2->co) * 0.0001f;
+			}
+		}
+
+		w += 1.0f;
+	}
+
+	return w;
+}
+
+
+static void edge_free_path(PathBase *pathbase, EPath *path)
+{
+	EPathNode *node, *next;
+
+	for (node = path->nodes.first; node; node = next) {
+		next = node->next;
+		BLI_mempool_free(pathbase->nodepool, node);
+	}
+
+	BLI_mempool_free(pathbase->pathpool, path);
+}
+
+static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, EdgeData *edata,
+                                      VertData *vdata, PathBase *pathbase, int group)
+{
+	BMEdge *e;
+	GHash *gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "createops find shortest path");
+	BMVert *v1, *v2;
+	BMVert **verts = NULL;
+	BLI_array_staticdeclare(verts, 1024);
+	Heap *heap = BLI_heap_new();
+	EPath *path = NULL, *path2;
+	BMVert *startv;
+	BMVert *endv;
+	EPathNode *node;
+	int i, use_restrict = BMO_slot_bool_get(op, "use_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;
+	
+	path = edge_path_new(pathbase, startv, edge);
+	BLI_ghash_insert(gh, startv, NULL);
+	BLI_heap_insert(heap, path->weight, path);
+	path->group = group;
+
+	while (BLI_heap_size(heap)) {
+		VertData *vd;
+		EPathNode *last;
+		BMFace *f = NULL;
+		
+		path = BLI_heap_popmin(heap);
+		last = path->nodes.last;
+		v1 = last->v;
+		
+		if (v1 == endv) {
+			/* make sure this path loop doesn't already exists */
+			i = 0;
+			BLI_array_empty(verts);
+			for (i = 0, node = path->nodes.first; node; node = node->next, i++) {
+				BLI_array_growone(verts);
+				verts[i] = node->v;
+			}
+
+			if (BM_face_exists(bm, verts, i, &f)) {
+				if (!BMO_elem_flag_test(bm, f, FACE_IGNORE)) {
+					BLI_ghash_remove(gh, endv, NULL, NULL);
+					continue;
+				}
+			}
+			break;
+		}
+		
+		vd = vdata + BM_elem_index_get(v1);
+		if (!vd->e)
+			continue;
+		
+		v2 = NULL;
+		while (1) {
+			if (!last->cure) {
+				last->cure = e = vdata[BM_elem_index_get(last->v)].e;
+			}
+			else {
+				last->cure = e = rotsys_nextedge(last->cure, last->v, edata, vdata);
+				if (last->cure == vdata[BM_elem_index_get(last->v)].e) {
+					v2 = NULL;
+					break;
+				}
+			}
+			
+			if (e == edge || !BMO_elem_flag_test(bm, e, EDGE_MARK)) {
+				continue;
+			}
+
+			v2 = BM_edge_other_vert(e, last->v);
+			
+			if (BLI_ghash_haskey(gh, v2)) {
+				v2 = NULL;
+				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;
+				}
+			}
+
+			break;
+		}
+		
+		if (!v2) {
+			if (path) {
+				edge_free_path(pathbase, path);
+				path = NULL;
+			}
+			continue;
+		}
+		
+		/* add path back into heap */
+		BLI_heap_insert(heap, path->weight, path);
+		
+		/* put v2 in gh ma */
+		BLI_ghash_insert(gh, v2, NULL);
+
+		path2 = edge_copy_add_path(pathbase, path, v2, e);
+		path2->weight = edge_weight_path(path2, edata, vdata);
+
+		BLI_heap_insert(heap, path2->weight, path2);
+	}
+	
+	if (path && ((EPathNode *)path->nodes.last)->v != endv) {
+		edge_free_path(pathbase, path);
+		path = NULL;
+	}
+
+	BLI_array_free(verts);
+	BLI_heap_free(heap, NULL);
+	BLI_ghash_free(gh, NULL, NULL);
+
+	return path;
+}
+
+static int count_edge_faces(BMesh *bm, BMEdge *e)
+{
+	int i = 0;
+	BMLoop *l = e->l;
+	
+	if (!l) {
+		return 0;
+	}
+
+	do {
+		if (!BMO_elem_flag_test(bm, l->f, FACE_IGNORE)) {
+			i++;
+		}
+
+		l = l->radial_next;
+	} while (l != e->l);
+
+	return i;
+}
+
+BLI_INLINE void vote_on_winding(BMEdge *edge, EPathNode *node, unsigned int winding[2])
+{
+	BMVert *test_v1, *test_v2;
+	/* we want to use the reverse winding to the existing order */
+	BM_edge_ordered_verts(edge, &test_v2, &test_v1);
+
+	/* edges vote on which winding wins out */
+	winding[(test_v1 == node->v)]++;
+}
+
+void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op)
+{
+	BMIter iter;
+	BMOIter siter;
+	BMFace *f;
+	BMEdge *e, *edge;
+	BMVert **verts = NULL;
+	BLI_array_declare(verts);
+	EPath *path;
+	EPathNode *node;
+	EdgeData *edata;
+	VertData *vdata;
+	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 i, j, group = 0;
+	unsigned int winding[2]; /* accumulte winding directions for each edge which has a face */
+
+	if (!bm->totvert || !bm->totedge)
+		return;
+
+	pathbase = edge_pathbase_new();
+
+	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);
+	
+	BM_mesh_elem_index_ensure(bm, BM_VERT);
+
+	BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+		BMO_elem_flag_enable(bm, f, ELE_ORIG);
+	}
+
+	i = 0;
+	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+		BM_elem_index_set(e, i); /* set_inline */
+		
+		if (!BMO_elem_flag_test(bm, e, EDGE_MARK)) {
+			edata[i].tag = 2;
+		}
+
+		i++;
+	}
+	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) {
+			/* if restrict is on, only start on faces in the restrict map */
+			if (use_restrict && !BMO_slot_map_contains(bm, op, "restrict", e))
+				continue;
+
+			if (edata[BM_elem_index_get(e)].tag < 2) {
+				edge = e;
+
+				if (use_restrict) {
+					int i = 0, j = 0, gi = 0;
+					
+					group = BMO_slot_map_int_get(bm, op, "restrict", e);
+					
+					for (i = 0; i < 30; i++) {
+						if (group & (1 << i)) {
+							j++;
+							gi = i;
+
+							if (j - 1 == edata[BM_elem_index_get(e)].tag) {
+								break;
+							}
+						}
+					}
+
+					group = (1 << gi);
+				}
+				
+				break;
+			}
+		}
+
+		if (!edge)
+			break;
+
+		edata[BM_elem_index_get(edge)].tag += 1;
+
+		path = edge_find_shortest_path(bm, op, edge, edata, vdata, pathbase, group);
+		if (!path)
+			continue;
+		
+		winding[0] = winding[1] = 0;
+
+		BLI_array_empty(edges);
+		BLI_array_empty(verts);
+		i = 0;
+		for (node = path->nodes.first; node; node = node->next) {
+			if (!node->next)
+				continue;
+
+			e = BM_edge_exists(node->v, node->next->v);
+			
+			/* this should never happe */
+			if (!e)
+				break;
+			
+			/* check on the winding */
+			if (e->l) {
+				vote_on_winding(e, node, winding);
+			}
+
+			edata[BM_elem_index_get(e)].ftag++;
+			BLI_array_growone(edges);
+			edges[i++] = e;
+
+			BLI_array_append(verts, node->v);
+		}
+		
+		if (edge->l) {
+			vote_on_winding(edge, path->nodes.last, winding);
+		}
+
+		BLI_array_growone(edges);
+		edges[i++] = edge;
+		edata[BM_elem_index_get(edge)].ftag++;
+		
+		for (j = 0; j < i; j++) {
+			if (count_edge_faces(bm, edges[j]) >= 2) {
+				edge_free_path(pathbase, path);
+				break;
+			}
+		}
+
+		if (j != i) {
+			continue;
+		}
+
+		if (i) {
+			BMVert *v1, *v2;
+
+			/* to define the winding order must select first edge,
+			 * otherwise we could leave this as-is */
+			edge = edges[0];
+
+			/* if these are even it doesn't really matter what to do,
+			 * with consistent geometry one will be zero, the choice is clear */
+			if (winding[0] < winding[1]) {
+				v1 = verts[0];
+				v2 = verts[1];
+			}
+			else {
+				v1 = verts[1];
+				v2 = verts[0];
+			}
+
+			if ((use_fill_check == FALSE) ||
+			    /* 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);
+				if (f && !BMO_elem_flag_test(bm, f, ELE_ORIG)) {
+					BMO_elem_flag_enable(bm, f, FACE_NEW);
+					f->mat_nr = mat_nr;
+					if (use_smooth) {
+						BM_elem_flag_enable(f, BM_ELEM_SMOOTH);
+					}
+				}
+
+				if (use_restrict) {
+					BMO_slot_map_int_insert(bm, op, "faceout_groupmap", f, path->group);
+				}
+			}
+		}
+		
+		edge_free_path(pathbase, path);
+	}
+
+	BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, FACE_NEW);
+
+	BLI_array_free(edges);
+	BLI_array_free(verts);
+	edge_pathbase_free(pathbase);
+	MEM_freeN(edata);
+	MEM_freeN(vdata);
+}
+
+static BMEdge *edge_next(BMesh *bm, BMEdge *e)
+{
+	BMIter iter;
+	BMEdge *e2;
+	int i;
+
+	for (i = 0; i < 2; i++) {
+		BM_ITER_ELEM (e2, &iter, i ? e->v2 : e->v1, BM_EDGES_OF_VERT) {
+			if ((BMO_elem_flag_test(bm, e2, EDGE_MARK)) &&
+			    (!BMO_elem_flag_test(bm, e2, EDGE_VIS)) &&
+			    (e2 != e))
+			{
+				return e2;
+			}
+		}
+	}
+
+	return NULL;
+}
+
+void bmo_edgenet_prepare(BMesh *bm, BMOperator *op)
+{
+	BMOIter siter;
+	BMEdge *e;
+	BMEdge **edges1 = NULL, **edges2 = NULL, **edges;
+	BLI_array_declare(edges1);
+	BLI_array_declare(edges2);
+	BLI_array_declare(edges);
+	int ok = 1;
+	int i, count;
+
+	BMO_slot_buffer_flag_enable(bm, op, "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) {
+		for (i = 0; i < 2; i++) {
+			count = BMO_vert_edge_flags_count(bm, i ? e->v2 : e->v1, EDGE_MARK);
+			if (count > 2) {
+				ok = 0;
+				break;
+			}
+		}
+
+		if (!ok) {
+			break;
+		}
+	}
+
+	/* we don't have valid edge layouts, retur */
+	if (!ok) {
+		return;
+	}
+
+	/* find connected loops within the input edge */
+	count = 0;
+	while (1) {
+		BMO_ITER (e, &siter, bm, op, "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)
+				{
+					break;
+				}
+			}
+		}
+		
+		if (!e) {
+			break;
+		}
+
+		if (!count) {
+			edges = edges1;
+		}
+		else if (count == 1) {
+			edges = edges2;
+		}
+		else {
+			break;
+		}
+		
+		i = 0;
+		while (e) {
+			BMO_elem_flag_enable(bm, e, EDGE_VIS);
+			BLI_array_growone(edges);
+			edges[i] = e;
+
+			e = edge_next(bm, e);
+			i++;
+		}
+
+		if (!count) {
+			edges1 = edges;
+			BLI_array_set_length(edges1, BLI_array_count(edges));
+		}
+		else {
+			edges2 = edges;
+			BLI_array_set_length(edges2, BLI_array_count(edges));
+		}
+
+		BLI_array_empty(edges);
+		count++;
+	}
+
+	if (edges1 && BLI_array_count(edges1) > 2 &&
+	    BM_edge_share_vert_count(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]))
+		{
+			BLI_array_free(edges1);
+			BLI_array_free(edges2);
+			return;
+		}
+		else {
+			edges1 = edges2;
+			edges2 = NULL;
+		}
+	}
+
+	if (edges2 && BLI_array_count(edges2) > 2 &&
+	    BM_edge_share_vert_count(edges2[0], edges2[BLI_array_count(edges2) - 1]))
+	{
+		edges2 = NULL;
+	}
+
+	/* two unconnected loops, connect the */
+	if (edges1 && edges2) {
+		BMVert *v1, *v2, *v3, *v4;
+		float dvec1[3];
+		float dvec2[3];
+
+		if (BLI_array_count(edges1) == 1) {
+			v1 = edges1[0]->v1;
+			v2 = edges1[0]->v2;
+		}
+		else {
+			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;
+		}
+
+		if (BLI_array_count(edges2) == 1) {
+			v3 = edges2[0]->v1;
+			v4 = edges2[0]->v2;
+		}
+		else {
+			v3 = BM_vert_in_edge(edges2[1], edges2[0]->v1) ? edges2[0]->v2 : edges2[0]->v1;
+			i  = BLI_array_count(edges2) - 1;
+			v4 = BM_vert_in_edge(edges2[i - 1], edges2[i]->v1) ? edges2[i]->v2 : edges2[i]->v1;
+		}
+
+		/* if there is ever bowtie quads between two edges the problem is here! [#30367] */
+#if 0
+		normal_tri_v3(dvec1, v1->co, v2->co, v4->co);
+		normal_tri_v3(dvec2, v1->co, v4->co, v3->co);
+#else
+		{
+			/* save some CPU cycles and skip the sqrt and 1 subtraction */
+			float a1[3], a2[3], a3[3];
+			sub_v3_v3v3(a1, v1->co, v2->co);
+			sub_v3_v3v3(a2, v1->co, v4->co);
+			sub_v3_v3v3(a3, v1->co, v3->co);
+			cross_v3_v3v3(dvec1, a1, a2);
+			cross_v3_v3v3(dvec2, a2, a3);
+		}
+#endif
+		if (dot_v3v3(dvec1, dvec2) < 0.0f) {
+			SWAP(BMVert *, v3, v4);
+		}
+
+		e = BM_edge_create(bm, v1, v3, NULL, TRUE);
+		BMO_elem_flag_enable(bm, e, ELE_NEW);
+		e = BM_edge_create(bm, v2, v4, NULL, TRUE);
+		BMO_elem_flag_enable(bm, e, ELE_NEW);
+	}
+	else if (edges1) {
+		BMVert *v1, *v2;
+
+		if (BLI_array_count(edges1) > 1) {
+			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);
+			BMO_elem_flag_enable(bm, e, ELE_NEW);
+		}
+	}
+	
+	BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, ELE_NEW);
+
+	BLI_array_free(edges1);
+	BLI_array_free(edges2);
+}
+
+/* This is what runs when pressing the F key
+ * doing the best thing here isn't always easy create vs dissolve, its nice to support
+ * but it it _really_ gives issues we might have to not call dissolve. - campbell
+ */
+void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
+{
+	BMOperator op2;
+	BMOIter oiter;
+	BMIter iter;
+	BMHeader *h;
+	BMVert *v, *verts[4];
+	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");
+
+	/* count number of each element type we were passe */
+	BMO_ITER (h, &oiter, bm, op, "geom", BM_VERT|BM_EDGE|BM_FACE) {
+		switch (h->htype) {
+			case BM_VERT: totv++; break;
+			case BM_EDGE: tote++; break;
+			case BM_FACE: totf++; break;
+		}
+
+		BMO_elem_flag_enable(bm, (BMElemF *)h, ELE_NEW);
+	}
+	
+	/* --- Support for Special Case ---
+	 * where there is a contiguous edge ring with one isolated vertex.
+	 *
+	 * This example shows 2 edges created from 3 verts
+	 * with 1 free standing vertex. Dotted lines denote the 2 edges that are created.
+	 *
+	 * note that this works for any sided shape.
+	 *
+	 * +--------+
+	 * |        .
+	 * |        .
+	 * |        .
+	 * |        .
+	 * +........+ <-- starts out free standing.
+	 *
+	 */
+
+	/* Here we check for consistancy and create 2 edges */
+	if (totf == 0 && totv >= 4 && totv == tote + 2) {
+		/* find a free standing vertex and 2 endpoint verts */
+		BMVert *v_free = NULL, *v_a = NULL, *v_b = NULL;
+		int ok = TRUE;
+
+
+		BMO_ITER (v, &oiter, bm, op, "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) {
+				if (BMO_elem_flag_test(bm, e, ELE_NEW)) {
+					tot_edges++;
+					if (tot_edges > 2) {
+						break;
+					}
+				}
+			}
+
+			if (tot_edges == 0) {
+				/* only accept 1 free vert */
+				if (v_free == NULL)  v_free = v;
+				else                 ok = FALSE;  /* only ever want one of these */
+			}
+			else if (tot_edges == 1) {
+				if (v_a == NULL)       v_a = v;
+				else if (v_b == NULL)  v_b = v;
+				else                   ok = FALSE;  /* only ever want 2 of these */
+			}
+			else if (tot_edges == 2) {
+				/* do nothing, regular case */
+			}
+			else {
+				ok = FALSE; /* if a vertex has 3+ edge users then cancel - this is only simple cases */
+			}
+
+			if (ok == FALSE) {
+				break;
+			}
+		}
+
+		if (ok == TRUE && v_free && v_a && v_b) {
+			e = BM_edge_create(bm, v_free, v_a, NULL, TRUE);
+			BMO_elem_flag_enable(bm, e, ELE_NEW);
+
+			e = BM_edge_create(bm, v_free, v_b, NULL, TRUE);
+			BMO_elem_flag_enable(bm, e, ELE_NEW);
+		}
+	}
+	/* --- end special case support, continue as normal --- */
+
+	/* call edgenet create */
+	/* call edgenet prepare op so additional face creation cases wore */
+	BMO_op_initf(bm, &op2, "edgenet_prepare edges=%fe", ELE_NEW);
+	BMO_op_exec(bm, &op2);
+	BMO_slot_buffer_flag_enable(bm, &op2, "edgeout", BM_EDGE, ELE_NEW);
+	BMO_op_finish(bm, &op2);
+
+	BMO_op_initf(bm, &op2,
+	             "edgenet_fill edges=%fe use_fill_check=%b mat_nr=%i use_smooth=%b",
+	             ELE_NEW, TRUE, mat_nr, use_smooth);
+
+	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");
+		BMO_op_finish(bm, &op2);
+		return;
+	}
+
+	BMO_op_finish(bm, &op2);
+	
+	/* now call dissolve face */
+	BMO_op_initf(bm, &op2, "dissolve_faces faces=%ff", ELE_NEW);
+	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");
+		BMO_op_finish(bm, &op2);
+		return;
+	}
+
+	BMO_op_finish(bm, &op2);
+
+	/* now, count how many verts we have */
+	amount = 0;
+	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+		if (BMO_elem_flag_test(bm, v, ELE_NEW)) {
+			verts[amount] = v;
+			amount++;
+
+			if (amount > 4) break;
+		}
+	}
+
+	if (amount == 2) {
+		/* create edge */
+		e = BM_edge_create(bm, verts[0], verts[1], NULL, TRUE);
+		BMO_elem_flag_enable(bm, e, ELE_OUT);
+	}
+	else if (0) { /* nice feature but perhaps it should be a different tool? */
+
+		/* tricky feature for making a line/edge from selection history...
+		 *
+		 * Rather then do nothing, when 5+ verts are selected, check if they are in our history,
+		 * when this is so, we can make edges from them, but _not_ a face,
+		 * if it is the intention to make a face the user can just hit F again since there will be edges next
+		 * time around.
+		 *
+		 * if all history verts have ELE_NEW flagged and the total number of history verts == totv,
+		 * then we know the history contains all verts here and we can continue...
+		 */
+
+		BMEditSelection *ese;
+		int tot_ese_v = 0;
+
+		for (ese = bm->selected.first; ese; ese = ese->next) {
+			if (ese->htype == BM_VERT) {
+				if (BMO_elem_flag_test(bm, (BMElemF *)ese->ele, ELE_NEW)) {
+					tot_ese_v++;
+				}
+				else {
+					/* unflagged vert means we are not in sync */
+					tot_ese_v = -1;
+					break;
+				}
+			}
+		}
+
+		if (tot_ese_v == totv) {
+			BMVert *v_prev = NULL;
+			/* yes, all select-history verts are accounted for, now make edges */
+
+			for (ese = bm->selected.first; ese; ese = ese->next) {
+				if (ese->htype == BM_VERT) {
+					v = (BMVert *)ese->ele;
+					if (v_prev) {
+						e = BM_edge_create(bm, v, v_prev, NULL, TRUE);
+						BMO_elem_flag_enable(bm, e, ELE_OUT);
+					}
+					v_prev = v;
+				}
+			}
+		}
+		/* done creating edges */
+	}
+	else if (amount > 2) {
+		/* TODO, all these verts may be connected by edges.
+		 * we should check on this before assuming they are a random set of verts */
+
+		BMVert **vert_arr = MEM_mallocN(sizeof(BMVert **) * totv, __func__);
+		int i = 0;
+
+		BMO_ITER (v, &oiter, bm, op, "geom", BM_VERT) {
+			vert_arr[i] = v;
+			i++;
+		}
+
+		f = BM_face_create_ngon_vcloud(bm, vert_arr, totv, TRUE);
+
+		if (f) {
+			BMO_elem_flag_enable(bm, f, ELE_OUT);
+			f->mat_nr = mat_nr;
+			if (use_smooth) {
+				BM_elem_flag_enable(f, BM_ELEM_SMOOTH);
+			}
+		}
+
+		MEM_freeN(vert_arr);
+	}
+}
diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c
new file mode 100644
index 0000000..8e7723f
--- /dev/null
+++ b/source/blender/bmesh/operators/bmo_dissolve.c
@@ -0,0 +1,615 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/operators/bmo_dissolve.c
+ *  \ingroup bmesh
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_array.h"
+#include "BLI_math.h"
+
+#include "bmesh.h"
+#include "intern/bmesh_private.h"
+
+#include "intern/bmesh_operators_private.h" /* own include */
+
+#define FACE_MARK	1
+#define FACE_ORIG	2
+#define FACE_NEW	4
+#define EDGE_MARK	1
+
+#define VERT_MARK	1
+
+static int UNUSED_FUNCTION(check_hole_in_region)(BMesh *bm, BMFace *f)
+{
+	BMWalker regwalker;
+	BMIter liter2;
+	BMLoop *l2, *l3;
+	BMFace *f2;
+
+	/* checks if there are any unmarked boundary edges in the face regio */
+
+	BMW_init(&regwalker, bm, BMW_ISLAND,
+	         BMW_MASK_NOP, BMW_MASK_NOP, FACE_MARK,
+	         BMW_FLAG_NOP,
+	         BMW_NIL_LAY);
+
+	f2 = BMW_begin(&regwalker, f);
+	for ( ; f2; f2 = BMW_step(&regwalker)) {
+		l2 = BM_iter_new(&liter2, bm, BM_LOOPS_OF_FACE, f2);
+		for ( ; l2; l2 = BM_iter_step(&liter2)) {
+			l3 = l2->radial_next;
+			if ( BMO_elem_flag_test(bm, l3->f, FACE_MARK) !=
+			     BMO_elem_flag_test(bm, l2->f, FACE_MARK))
+			{
+				if (!BMO_elem_flag_test(bm, l2->e, EDGE_MARK)) {
+					return FALSE;
+				}
+			}
+		}
+	}
+	BMW_end(&regwalker);
+
+	return TRUE;
+}
+
+void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
+{
+	BMOIter oiter;
+	BMFace *f, *f2 /* , *nf = NULL */;
+	BLI_array_declare(faces);
+	BLI_array_declare(regions);
+	BMFace ***regions = NULL;
+	BMFace **faces = NULL;
+	BMWalker regwalker;
+	int i;
+
+	int use_verts = BMO_slot_bool_get(op, "use_verts");
+
+	if (use_verts) {
+		/* tag verts that start out with only 2 edges,
+		 * don't remove these later */
+		BMIter viter;
+		BMVert *v;
+
+		BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
+			BMO_elem_flag_set(bm, v, VERT_MARK, (BM_vert_edge_count(v) != 2));
+		}
+	}
+
+	BMO_slot_buffer_flag_enable(bm, op, "faces", BM_FACE, FACE_MARK);
+	
+	/* collect region */
+	BMO_ITER (f, &oiter, bm, op, "faces", BM_FACE) {
+
+		if (!BMO_elem_flag_test(bm, f, FACE_MARK)) {
+			continue;
+		}
+
+		BLI_array_empty(faces);
+		faces = NULL; /* forces different allocatio */
+
+		BMW_init(&regwalker, bm, BMW_ISLAND,
+		         BMW_MASK_NOP, BMW_MASK_NOP, FACE_MARK,
+		         BMW_FLAG_NOP, /* no need to check BMW_FLAG_TEST_HIDDEN, faces are already marked by the bmo */
+		         BMW_NIL_LAY);
+
+		f2 = BMW_begin(&regwalker, f);
+		for ( ; f2; f2 = BMW_step(&regwalker)) {
+			BLI_array_append(faces, f2);
+		}
+		BMW_end(&regwalker);
+		
+		for (i = 0; i < BLI_array_count(faces); i++) {
+			f2 = faces[i];
+			BMO_elem_flag_disable(bm, f2, FACE_MARK);
+			BMO_elem_flag_enable(bm, f2, FACE_ORIG);
+		}
+
+		if (BMO_error_occurred(bm)) {
+			BMO_error_clear(bm);
+			BMO_error_raise(bm, op, BMERR_DISSOLVEFACES_FAILED, NULL);
+			goto cleanup;
+		}
+		
+		BLI_array_append(faces, NULL);
+		BLI_array_append(regions, faces);
+	}
+	
+	for (i = 0; i < BLI_array_count(regions); i++) {
+		int tot = 0;
+		
+		faces = regions[i];
+		if (!faces[0]) {
+			BMO_error_raise(bm, op, BMERR_DISSOLVEFACES_FAILED,
+			                "Could not find boundary of dissolve region");
+			goto cleanup;
+		}
+		
+		while (faces[tot])
+			tot++;
+		
+		f = BM_faces_join(bm, faces, tot, TRUE);
+		if (!f) {
+			BMO_error_raise(bm, op, BMERR_DISSOLVEFACES_FAILED,
+			                "Could not create merged face");
+			goto cleanup;
+		}
+
+		/* if making the new face failed (e.g. overlapping test)
+		 * unmark the original faces for deletion */
+		BMO_elem_flag_disable(bm, f, FACE_ORIG);
+		BMO_elem_flag_enable(bm, f, FACE_NEW);
+
+	}
+
+	BMO_op_callf(bm, "del geom=%ff context=%i", FACE_ORIG, DEL_FACES);
+
+
+	if (use_verts) {
+		BMIter viter;
+		BMVert *v;
+
+		BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
+			if (BMO_elem_flag_test(bm, v, VERT_MARK)) {
+				if (BM_vert_edge_count(v) == 2) {
+					BM_vert_collapse_edge(bm, v->e, v, TRUE);
+				}
+			}
+		}
+	}
+
+	if (BMO_error_occurred(bm)) {
+		goto cleanup;
+	}
+
+	BMO_slot_buffer_from_enabled_flag(bm, op, "regionout", BM_FACE, FACE_NEW);
+
+cleanup:
+	/* free/cleanup */
+	for (i = 0; i < BLI_array_count(regions); i++) {
+		if (regions[i]) MEM_freeN(regions[i]);
+	}
+
+	BLI_array_free(regions);
+}
+
+/* almost identical to dissolve edge, except it cleans up vertice */
+void bmo_dissolve_edgeloop_exec(BMesh *bm, BMOperator *op)
+{
+	/* BMOperator fop; */
+	BMOIter oiter;
+	BMIter iter;
+	BMVert *v, **verts = NULL;
+	BLI_array_declare(verts);
+	BMEdge *e;
+	BMFace *fa, *fb;
+	int i;
+
+
+	BMO_ITER (e, &oiter, bm, op, "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);
+
+			/* BMESH_TODO - check on delaying edge removal since we may end up removing more then
+			 * one edge, and later referene a removed edge */
+			BM_faces_join_pair(bm, fa, fb, e, TRUE);
+		}
+	}
+
+	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+		if (BMO_elem_flag_test(bm, v, VERT_MARK) && BM_vert_edge_count(v) == 2) {
+			BLI_array_append(verts, v);
+		}
+	}
+
+	/* clean up extreneous 2-valence vertice */
+	for (i = 0; i < BLI_array_count(verts); i++) {
+		if (verts[i]->e) {
+			BM_vert_collapse_edge(bm, verts[i]->e, verts[i], TRUE);
+		}
+	}
+	
+	BLI_array_free(verts);
+
+	//BMO_op_initf(bm, &fop, "dissolve_faces faces=%ff", FACE_MARK);
+	//BMO_op_exec(bm, &fop);
+
+	//BMO_slot_copy(op, &fop, "regionout", "regionout");
+
+	//BMO_op_finish(bm, &fop);
+}
+
+
+void bmo_dissolve_edges_exec(BMesh *bm, BMOperator *op)
+{
+	/* might want to make this an option or mode - campbell */
+
+	/* BMOperator fop; */
+	BMOIter eiter;
+	BMEdge *e;
+
+	BMIter viter;
+	BMVert *v;
+
+	int use_verts = BMO_slot_bool_get(op, "use_verts");
+
+	if (use_verts) {
+		BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
+			BMO_elem_flag_set(bm, v, VERT_MARK, (BM_vert_edge_count(v) != 2));
+		}
+	}
+
+	BMO_ITER (e, &eiter, bm, op, "edges", BM_EDGE) {
+		BMFace *fa, *fb;
+
+		if (BM_edge_face_pair(e, &fa, &fb)) {
+
+			/* join faces */
+
+			/* BMESH_TODO - check on delaying edge removal since we may end up removing more then
+			 * one edge, and later referene a removed edge */
+			BM_faces_join_pair(bm, fa, fb, e, TRUE);
+		}
+	}
+
+	if (use_verts) {
+		BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
+			if (BMO_elem_flag_test(bm, v, VERT_MARK)) {
+				if (BM_vert_edge_count(v) == 2) {
+					BM_vert_collapse_edge(bm, v->e, v, TRUE);
+				}
+			}
+		}
+	}
+}
+
+static int test_extra_verts(BMesh *bm, BMVert *v)
+{
+	BMIter iter, liter, iter2, iter3;
+	BMFace *f, *f2;
+	BMLoop *l;
+	BMEdge *e;
+	int found;
+
+	/* test faces around verts for verts that would be wrongly killed
+	 * by dissolve faces. */
+	f = BM_iter_new(&iter, bm, BM_FACES_OF_VERT, v);
+	for ( ; f; f = BM_iter_step(&iter)) {
+		l = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, f);
+		for ( ; l; l = BM_iter_step(&liter)) {
+			if (!BMO_elem_flag_test(bm, l->v, VERT_MARK)) {
+				/* if an edge around a vert is a boundary edge,
+				 * then dissolve faces won't destroy it.
+				 * also if it forms a boundary with one
+				 * of the face region */
+				found = FALSE;
+				e = BM_iter_new(&iter2, bm, BM_EDGES_OF_VERT, l->v);
+				for ( ; e; e = BM_iter_step(&iter2)) {
+					if (BM_edge_is_boundary(e)) {
+						found = TRUE;
+					}
+					f2 = BM_iter_new(&iter3, bm, BM_FACES_OF_EDGE, e);
+					for ( ; f2; f2 = BM_iter_step(&iter3)) {
+						if (!BMO_elem_flag_test(bm, f2, FACE_MARK)) {
+							found = TRUE;
+							break;
+						}
+					}
+					if (found == TRUE) {
+						break;
+					}
+				}
+				if (found == FALSE) {
+					return FALSE;
+				}
+			}
+		}
+	}
+
+	return TRUE;
+}
+void bmo_dissolve_verts_exec(BMesh *bm, BMOperator *op)
+{
+	BMIter iter, fiter;
+	BMVert *v;
+	BMFace *f;
+	/* int i; */
+
+	BMO_slot_buffer_flag_enable(bm, op, "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)) {
+			/* check if it's a two-valence ver */
+			if (BM_vert_edge_count(v) == 2) {
+
+				/* collapse the ver */
+				/* previously the faces were joined, but collapsing between 2 edges
+				 * gives some advantage/difference in using vertex-dissolve over edge-dissolve */
+#if 0
+				BM_vert_collapse_faces(bm, v->e, v, 1.0f, TRUE, TRUE);
+#else
+				BM_vert_collapse_edge(bm, v->e, v, TRUE);
+#endif
+
+				continue;
+			}
+
+			f = BM_iter_new(&fiter, bm, BM_FACES_OF_VERT, v);
+			for ( ; f; f = BM_iter_step(&fiter)) {
+				BMO_elem_flag_enable(bm, f, FACE_ORIG);
+				BMO_elem_flag_enable(bm, f, FACE_MARK);
+			}
+			
+			/* check if our additions to the input to face dissolve
+			 * will destroy nonmarked vertices. */
+			if (!test_extra_verts(bm, v)) {
+				f = BM_iter_new(&fiter, bm, BM_FACES_OF_VERT, v);
+				for ( ; f; f = BM_iter_step(&fiter)) {
+					if (BMO_elem_flag_test(bm, f, FACE_ORIG)) {
+						BMO_elem_flag_disable(bm, f, FACE_MARK);
+						BMO_elem_flag_disable(bm, f, FACE_ORIG);
+					}
+				}
+			}
+			else {
+				f = BM_iter_new(&fiter, bm, BM_FACES_OF_VERT, v);
+				for ( ; f; f = BM_iter_step(&fiter)) {
+					BMO_elem_flag_disable(bm, f, FACE_ORIG);
+				}
+			}
+		}
+	}
+
+	BMO_op_callf(bm, "dissolve_faces faces=%ff", FACE_MARK);
+	if (BMO_error_occurred(bm)) {
+		const char *msg;
+
+		BMO_error_get(bm, &msg, NULL);
+		BMO_error_clear(bm);
+		BMO_error_raise(bm, op, BMERR_DISSOLVEVERTS_FAILED, msg);
+	}
+	
+	/* clean up any remainin */
+	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)) {
+			if (!BM_vert_dissolve(bm, v)) {
+				BMO_error_raise(bm, op, BMERR_DISSOLVEVERTS_FAILED, NULL);
+				return;
+			}
+		}
+	}
+
+}
+
+/* this code is for cleaning up two-edged faces, it shall become
+ * it's own function one day */
+#if 0
+void dummy_exec(BMesh *bm, BMOperator *op)
+{
+	{
+		/* clean up two-edged face */
+		/* basic idea is to keep joining 2-edged faces until their
+		 * gone.  this however relies on joining two 2-edged faces
+		 * together to work, which doesn't */
+		found3 = 1;
+		while (found3) {
+			found3 = 0;
+			for (f = BM_iter_new(&iter, bm, BM_FACES_OF_MESH, NULL); f; f = BM_iter_step(&iter)) {
+				if (!BM_face_validate(bm, f, stderr)) {
+					printf("error.\n");
+				}
+
+				if (f->len == 2) {
+					//this design relies on join faces working
+					//with two-edged faces properly.
+					//commenting this line disables the
+					//outermost loop.
+					//found3 = 1;
+					found2 = 0;
+					l = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, f);
+					fe = l->e;
+					for ( ; l; l = BM_iter_step(&liter)) {
+						f2 = BM_iter_new(&fiter, bm,
+								BM_FACES_OF_EDGE, l->e);
+						for ( ; f2; f2 = BM_iter_step(&fiter)) {
+							if (f2 != f) {
+								BM_faces_join_pair(bm, f, f2, l->e);
+								found2 = 1;
+								break;
+							}
+						}
+						if (found2) break;
+					}
+
+					if (!found2) {
+						BM_face_kill(bm, f);
+						BM_edge_kill(bm, fe);
+					}
+				}
+#if 0
+				else if (f->len == 3) {
+					BMEdge *ed[3];
+					BMVert *vt[3];
+					BMLoop *lp[3];
+					int i = 0;
+
+					//check for duplicate edges
+					l = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, f);
+					for ( ; l; l = BM_iter_step(&liter)) {
+						ed[i] = l->e;
+						lp[i] = l;
+						vt[i++] = l->v;
+					}
+					if (vt[0] == vt[1] || vt[0] == vt[2]) {
+						i += 1;
+					}
+#endif
+			}
+		}
+		if (oldlen == len) break;
+		oldlen = len;
+	}
+}
+
+#endif
+
+/* Limited Dissolve */
+
+#define UNIT_TO_ANGLE DEG2RADF(90.0)
+#define ANGLE_TO_UNIT (1.0 / 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. */
+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");
+	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;
+
+	/* --- first edges --- */
+
+	/* go through and split edge */
+	for (i = 0, tot_found = 0; i < einput->len; i++) {
+		BMEdge *e = ((BMEdge **)einput->data.p)[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);
+				}
+			}
+		}
+
+		/* remove all edges/verts left behind from dissolving */
+		for (i = 0; i < einput->len; i++) {
+			BMEdge *e = (BMEdge *)weight_elems[i].ele;
+			if (BM_edge_is_wire(e)) {
+				BMVert *v1 = e->v1;
+				BMVert *v2 = e->v2;
+				BM_edge_kill(bm, e);
+				if (v1->e == NULL) BM_vert_kill(bm, v1);
+				if (v2->e == NULL) BM_vert_kill(bm, v2);
+			}
+		}
+	}
+
+	/* --- second verts --- */
+	for (i = 0, tot_found = 0; i < vinput->len; i++) {
+		BMVert *v = ((BMVert **)vinput->data.p)[i];
+		const float angle = bm_vert_edge_face_angle(v);
+
+		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);
+				}
+			}
+		}
+	}
+
+	MEM_freeN(weight_elems);
+}
diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c
new file mode 100644
index 0000000..36d446a
--- /dev/null
+++ b/source/blender/bmesh/operators/bmo_dupe.c
@@ -0,0 +1,510 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/operators/bmo_dupe.c
+ *  \ingroup bmesh
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_array.h"
+#include "BLI_math.h"
+
+#include "bmesh.h"
+
+#include "intern/bmesh_operators_private.h" /* own include */
+
+/* local flag define */
+#define DUPE_INPUT      1 /* input from operator */
+#define DUPE_NEW        2
+#define DUPE_DONE       4
+#define DUPE_MAPPED     8
+
+/**
+ * COPY VERTEX
+ *
+ * Copy an existing vertex from one bmesh to another.
+ */
+static BMVert *copy_vertex(BMesh *source_mesh, BMVert *source_vertex, BMesh *target_mesh, GHash *vhash)
+{
+	BMVert *target_vertex = NULL;
+
+	/* Create a new vertex */
+	target_vertex = BM_vert_create(target_mesh, source_vertex->co, NULL);
+	
+	/* Insert new vertex into the vert hash */
+	BLI_ghash_insert(vhash, source_vertex, target_vertex);
+	
+	/* Copy attributes */
+	BM_elem_attrs_copy(source_mesh, target_mesh, source_vertex, target_vertex);
+	
+	/* Set internal op flags */
+	BMO_elem_flag_enable(target_mesh, target_vertex, DUPE_NEW);
+	
+	return target_vertex;
+}
+
+/**
+ * COPY EDGE
+ *
+ * Copy an existing edge from one bmesh to another.
+ */
+static BMEdge *copy_edge(BMOperator *op, BMesh *source_mesh,
+                         BMEdge *source_edge, BMesh *target_mesh,
+                         GHash *vhash, GHash *ehash)
+{
+	BMEdge *target_edge = NULL;
+	BMVert *target_vert1, *target_vert2;
+	BMFace *face;
+	BMIter fiter;
+	int rlen;
+
+	/* see if any of the neighboring faces are
+	 * not being duplicated.  in that case,
+	 * add it to the new/old map. */
+	rlen = 0;
+	for (face = BM_iter_new(&fiter, source_mesh, BM_FACES_OF_EDGE, source_edge);
+	     face;
+	     face = BM_iter_step(&fiter))
+	{
+		if (BMO_elem_flag_test(source_mesh, face, DUPE_INPUT)) {
+			rlen++;
+		}
+	}
+
+	/* Lookup v1 and v2 */
+	target_vert1 = BLI_ghash_lookup(vhash, source_edge->v1);
+	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);
+	
+	/* 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);
+	}
+
+	/* Insert new edge into the edge hash */
+	BLI_ghash_insert(ehash, source_edge, target_edge);
+	
+	/* Copy attributes */
+	BM_elem_attrs_copy(source_mesh, target_mesh, source_edge, target_edge);
+	
+	/* Set internal op flags */
+	BMO_elem_flag_enable(target_mesh, target_edge, DUPE_NEW);
+	
+	return target_edge;
+}
+
+/**
+ * COPY FACE
+ *
+ * Copy an existing face from one bmesh to another.
+ */
+
+static BMFace *copy_face(BMOperator *op, BMesh *source_mesh,
+                         BMFace *source_face, BMesh *target_mesh,
+                         BMVert **vtar, BMEdge **edar, GHash *vhash, GHash *ehash)
+{
+	/* BMVert *target_vert1, *target_vert2; */ /* UNUSED */
+	BMLoop *source_loop, *target_loop;
+	BMFace *target_face = NULL;
+	BMIter iter, iter2;
+	int i;
+	
+	/* lookup the first and second vert */
+#if 0 /* UNUSED */
+	target_vert1 = BLI_ghash_lookup(vhash, BM_iter_new(&iter, source_mesh, BM_VERTS_OF_FACE, source_face));
+	target_vert2 = BLI_ghash_lookup(vhash, BM_iter_step(&iter));
+#else
+	BM_iter_new(&iter, source_mesh, BM_VERTS_OF_FACE, source_face);
+	BM_iter_step(&iter);
+#endif
+
+	/* lookup edge */
+	for (i = 0, source_loop = BM_iter_new(&iter, source_mesh, BM_LOOPS_OF_FACE, source_face);
+	     source_loop;
+	     source_loop = BM_iter_step(&iter), i++)
+	{
+		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);
+
+	BM_elem_attrs_copy(source_mesh, target_mesh, source_face, target_face);
+
+	/* mark the face for output */
+	BMO_elem_flag_enable(target_mesh, target_face, DUPE_NEW);
+	
+	/* copy per-loop custom data */
+	BM_ITER_ELEM (source_loop, &iter, source_face, BM_LOOPS_OF_FACE) {
+		BM_ITER_ELEM (target_loop, &iter2, target_face, BM_LOOPS_OF_FACE) {
+			if (BLI_ghash_lookup(vhash, source_loop->v) == target_loop->v) {
+				BM_elem_attrs_copy(source_mesh, target_mesh, source_loop, target_loop);
+				break;
+			}
+		}
+	}
+
+	return target_face;
+}
+
+/**
+ * COPY MESH
+ *
+ * Internal Copy function.
+ */
+
+static void copy_mesh(BMOperator *op, BMesh *source, BMesh *target)
+{
+
+	BMVert *v = NULL, *v2;
+	BMEdge *e = NULL;
+	BMFace *f = NULL;
+
+	BLI_array_declare(vtar);
+	BLI_array_declare(edar);
+	BMVert **vtar = NULL;
+	BMEdge **edar = NULL;
+	
+	BMIter viter, eiter, fiter;
+	GHash *vhash, *ehash;
+
+	/* initialize pointer hashes */
+	vhash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh dupeops v");
+	ehash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "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))
+		{
+			BMIter iter;
+			int isolated = 1;
+
+			v2 = copy_vertex(source, v, target, vhash);
+
+			BM_ITER_ELEM (f, &iter, v, BM_FACES_OF_VERT) {
+				if (BMO_elem_flag_test(source, f, DUPE_INPUT)) {
+					isolated = 0;
+					break;
+				}
+			}
+
+			if (isolated) {
+				BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
+					if (BMO_elem_flag_test(source, e, DUPE_INPUT)) {
+						isolated = 0;
+						break;
+					}
+				}
+			}
+
+			if (isolated) {
+				BMO_slot_map_ptr_insert(source, op, "isovertmap", v, v2);
+			}
+
+			BMO_elem_flag_enable(source, 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))
+		{
+			/* 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(source, e->v2, DUPE_DONE)) {
+				copy_vertex(source, e->v2, target, vhash);
+				BMO_elem_flag_enable(source, 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);
+		}
+	}
+
+	/* 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)) {
+			/* 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);
+				}
+			}
+
+			/* 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);
+				}
+			}
+
+			/* ensure arrays are the right size */
+			BLI_array_empty(vtar);
+			BLI_array_empty(edar);
+
+			BLI_array_growitems(vtar, f->len);
+			BLI_array_growitems(edar, f->len);
+
+			copy_face(op, source, f, target, vtar, edar, vhash, ehash);
+			BMO_elem_flag_enable(source, f, DUPE_DONE);
+		}
+	}
+	
+	/* free pointer hashes */
+	BLI_ghash_free(vhash, NULL, NULL);
+	BLI_ghash_free(ehash, NULL, NULL);
+
+	BLI_array_free(vtar); /* free vert pointer array */
+	BLI_array_free(edar); /* free edge pointer array */
+}
+
+/**
+ * Duplicate Operator
+ *
+ * Duplicates verts, edges and faces of a mesh.
+ *
+ * INPUT SLOTS:
+ *
+ * BMOP_DUPE_VINPUT: Buffer containing pointers to mesh vertices to be duplicated
+ * BMOP_DUPE_EINPUT: Buffer containing pointers to mesh edges to be duplicated
+ * BMOP_DUPE_FINPUT: Buffer containing pointers to mesh faces to be duplicated
+ *
+ * OUTPUT SLOTS:
+ *
+ * BMOP_DUPE_VORIGINAL: Buffer containing pointers to the original mesh vertices
+ * BMOP_DUPE_EORIGINAL: Buffer containing pointers to the original mesh edges
+ * BMOP_DUPE_FORIGINAL: Buffer containing pointers to the original mesh faces
+ * BMOP_DUPE_VNEW: Buffer containing pointers to the new mesh vertices
+ * BMOP_DUPE_ENEW: Buffer containing pointers to the new mesh edges
+ * BMOP_DUPE_FNEW: Buffer containing pointers to the new mesh faces
+ */
+
+void bmo_dupe_exec(BMesh *bm, BMOperator *op)
+{
+	BMOperator *dupeop = op;
+	BMesh *bm2 = BMO_slot_ptr_get(op, "dest");
+	
+	if (!bm2)
+		bm2 = bm;
+
+	/* flag input */
+	BMO_slot_buffer_flag_enable(bm, dupeop, "geom", BM_ALL, DUPE_INPUT);
+
+	/* use the internal copy function */
+	copy_mesh(dupeop, bm, bm2);
+	
+	/* Output */
+	/* First copy the input buffers to output buffers - original data */
+	BMO_slot_copy(dupeop, dupeop, "geom", "origout");
+
+	/* Now alloc the new output buffers */
+	BMO_slot_buffer_from_enabled_flag(bm, dupeop, "newout", BM_ALL, DUPE_NEW);
+}
+
+#if 0 /* UNUSED */
+/* executes the duplicate operation, feeding elements of
+ * type flag etypeflag and header flag flag to it.  note,
+ * to get more useful information (such as the mapping from
+ * original to new elements) you should run the dupe op manually */
+void BMO_dupe_from_flag(BMesh *bm, int htype, const char hflag)
+{
+	BMOperator dupeop;
+
+	BMO_op_init(bm, &dupeop, "dupe");
+	BMO_slot_buffer_from_enabled_hflag(bm, &dupeop, "geom", htype, hflag);
+
+	BMO_op_exec(bm, &dupeop);
+	BMO_op_finish(bm, &dupeop);
+}
+#endif
+
+/**
+ * Split Operator
+ *
+ * Duplicates verts, edges and faces of a mesh but also deletes the originals.
+ *
+ * INPUT SLOTS:
+ *
+ * BMOP_DUPE_VINPUT: Buffer containing pointers to mesh vertices to be split
+ * BMOP_DUPE_EINPUT: Buffer containing pointers to mesh edges to be split
+ * BMOP_DUPE_FINPUT: Buffer containing pointers to mesh faces to be split
+ *
+ * OUTPUT SLOTS:
+ *
+ * BMOP_DUPE_VOUTPUT: Buffer containing pointers to the split mesh vertices
+ * BMOP_DUPE_EOUTPUT: Buffer containing pointers to the split mesh edges
+ * BMOP_DUPE_FOUTPUT: Buffer containing pointers to the split mesh faces
+ */
+
+#define SPLIT_INPUT 1
+
+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");
+
+	/* initialize our sub-operator */
+	BMO_op_init(bm, &dupeop, "dupe");
+	BMO_op_init(bm, &delop, "del");
+	
+	BMO_slot_copy(splitop, &dupeop, "geom", "geom");
+	BMO_op_exec(bm, &dupeop);
+	
+	BMO_slot_buffer_flag_enable(bm, splitop, "geom", BM_ALL, SPLIT_INPUT);
+
+	if (use_only_faces) {
+		BMVert *v;
+		BMEdge *e;
+		BMFace *f;
+		BMIter iter, iter2;
+		int found;
+
+		/* make sure to remove edges and verts we don't need */
+		for (e = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, NULL); e; e = BM_iter_step(&iter)) {
+			found = 0;
+			f = BM_iter_new(&iter2, bm, BM_FACES_OF_EDGE, e);
+			for ( ; f; f = BM_iter_step(&iter2)) {
+				if (!BMO_elem_flag_test(bm, f, SPLIT_INPUT)) {
+					found = 1;
+					break;
+				}
+			}
+			if (!found) {
+				BMO_elem_flag_enable(bm, e, SPLIT_INPUT);
+			}
+		}
+
+		for (v = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); v; v = BM_iter_step(&iter)) {
+			found = 0;
+			e = BM_iter_new(&iter2, bm, BM_EDGES_OF_VERT, v);
+			for ( ; e; e = BM_iter_step(&iter2)) {
+				if (!BMO_elem_flag_test(bm, e, SPLIT_INPUT)) {
+					found = 1;
+					break;
+				}
+			}
+			if (!found) {
+				BMO_elem_flag_enable(bm, v, SPLIT_INPUT);
+			}
+		}
+	}
+
+	/* 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_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");
+	
+	/* cleanup */
+	BMO_op_finish(bm, &delop);
+	BMO_op_finish(bm, &dupeop);
+}
+
+
+void bmo_del_exec(BMesh *bm, BMOperator *op)
+{
+#define DEL_INPUT 1
+
+	BMOperator *delop = op;
+
+	/* Mark Buffer */
+	BMO_slot_buffer_flag_enable(bm, delop, "geom", BM_ALL, DEL_INPUT);
+
+	BMO_remove_tagged_context(bm, DEL_INPUT, BMO_slot_int_get(op, "context"));
+
+#undef DEL_INPUT
+}
+
+/**
+ * Spin Operator
+ *
+ * Extrude or duplicate geometry a number of times,
+ * rotating and possibly translating after each step
+ */
+
+void bmo_spin_exec(BMesh *bm, BMOperator *op)
+{
+	BMOperator dupop, extop;
+	float cent[3], dvec[3];
+	float axis[3] = {0.0f, 0.0f, 1.0f};
+	float rmat[3][3];
+	float phi;
+	int steps, do_dupli, a, usedvec;
+
+	BMO_slot_vec_get(op, "cent", cent);
+	BMO_slot_vec_get(op, "axis", axis);
+	normalize_v3(axis);
+	BMO_slot_vec_get(op, "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");
+
+	axis_angle_to_mat3(rmat, axis, phi);
+
+	BMO_slot_copy(op, op, "geom", "lastout");
+	for (a = 0; a < steps; a++) {
+		if (do_dupli) {
+			BMO_op_initf(bm, &dupop, "dupe geom=%s", op, "lastout");
+			BMO_op_exec(bm, &dupop);
+			BMO_op_callf(bm, "rotate cent=%v mat=%m3 verts=%s",
+			             cent, rmat, &dupop, "newout");
+			BMO_slot_copy(&dupop, op, "newout", "lastout");
+			BMO_op_finish(bm, &dupop);
+		}
+		else {
+			BMO_op_initf(bm, &extop, "extrude_face_region edgefacein=%s",
+			             op, "lastout");
+			BMO_op_exec(bm, &extop);
+			BMO_op_callf(bm, "rotate cent=%v mat=%m3 verts=%s",
+			             cent, rmat, &extop, "geomout");
+			BMO_slot_copy(&extop, op, "geomout", "lastout");
+			BMO_op_finish(bm, &extop);
+		}
+
+		if (usedvec)
+			BMO_op_callf(bm, "translate vec=%v verts=%s", dvec, op, "lastout");
+	}
+}
diff --git a/source/blender/bmesh/operators/bmo_edgesplit.c b/source/blender/bmesh/operators/bmo_edgesplit.c
new file mode 100644
index 0000000..ccbcb29
--- /dev/null
+++ b/source/blender/bmesh/operators/bmo_edgesplit.c
@@ -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.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/operators/bmo_edgesplit.c
+ *  \ingroup bmesh
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_utildefines.h"
+
+#include "bmesh.h"
+
+#include "intern/bmesh_operators_private.h" /* own include */
+
+enum {
+	EDGE_SEAM  = 1
+};
+
+enum {
+	VERT_SEAM  = 2
+};
+
+/**
+ * Remove the EDGE_SEAM flag for edges we cant split
+ *
+ * un-tag edges not connected to other tagged edges,
+ * unless they are on a boundary
+ */
+static void bm_edgesplit_validate_seams(BMesh *bm, BMOperator *op)
+{
+	BMOIter siter;
+	BMIter iter;
+	BMEdge *e;
+
+	unsigned char *vtouch;
+	unsigned char *vt;
+
+	BM_mesh_elem_index_ensure(bm, BM_VERT);
+
+	vtouch = MEM_callocN(sizeof(char) * bm->totvert, __func__);
+
+	/* tag all boundary verts so as not to untag an edge which is inbetween only 2 faces [] */
+	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+
+		/* unrelated to flag assignment in this function - since this is the
+		 * only place we loop over all edges, disable tag */
+		BM_elem_flag_disable(e, BM_ELEM_INTERNAL_TAG);
+
+		if (e->l == NULL) {
+			BMO_elem_flag_disable(bm, e, EDGE_SEAM);
+		}
+		else if (BM_edge_is_boundary(e)) {
+			vt = &vtouch[BM_elem_index_get(e->v1)]; if (*vt < 2) (*vt)++;
+			vt = &vtouch[BM_elem_index_get(e->v2)]; if (*vt < 2) (*vt)++;
+
+			/* while the boundary verts need to be tagged,
+			 * the edge its self can't be split */
+			BMO_elem_flag_disable(bm, e, EDGE_SEAM);
+		}
+	}
+
+	/* 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) {
+		/* 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) {
+		if (vtouch[BM_elem_index_get(e->v1)] == 1 &&
+		    vtouch[BM_elem_index_get(e->v2)] == 1)
+		{
+			BMO_elem_flag_disable(bm, e, EDGE_SEAM);
+		}
+	}
+
+	MEM_freeN(vtouch);
+}
+
+/* keep this operator fast, its used in a modifier */
+void bmo_edgesplit_exec(BMesh *bm, BMOperator *op)
+{
+	BMOIter siter;
+	BMEdge *e;
+	const int use_verts = BMO_slot_bool_get(op, "use_verts");
+
+	BMO_slot_buffer_flag_enable(bm, op, "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);
+
+		/* prevent one edge having both verts unflagged
+		 * we could alternately disable these edges, either way its a corner case.
+		 *
+		 * 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) {
+			if (UNLIKELY((BMO_elem_flag_test(bm, e->v1, VERT_SEAM) == FALSE &&
+			              (BMO_elem_flag_test(bm, e->v2, VERT_SEAM) == FALSE))))
+			{
+				BMO_elem_flag_enable(bm, e->v1, VERT_SEAM);
+				BMO_elem_flag_enable(bm, e->v2, VERT_SEAM);
+			}
+		}
+	}
+
+	bm_edgesplit_validate_seams(bm, op);
+
+	BMO_ITER (e, &siter, bm, op, "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);
+
+			/* keep splitting until each loop has its own edge */
+			do {
+				bmesh_edge_separate(bm, e, e->l);
+			} while (!BM_edge_is_boundary(e));
+
+			BM_elem_flag_enable(e->v1, BM_ELEM_TAG);
+			BM_elem_flag_enable(e->v2, BM_ELEM_TAG);
+		}
+	}
+
+	if (use_verts) {
+		BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+			if (BMO_elem_flag_test(bm, e->v1, VERT_SEAM) == FALSE) {
+				BM_elem_flag_disable(e->v1, BM_ELEM_TAG);
+			}
+			if (BMO_elem_flag_test(bm, e->v2, VERT_SEAM) == FALSE) {
+				BM_elem_flag_disable(e->v2, BM_ELEM_TAG);
+			}
+		}
+	}
+
+	BMO_ITER (e, &siter, bm, op, "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);
+				bmesh_vert_separate(bm, e->v1, NULL, NULL);
+			}
+			if (BM_elem_flag_test(e->v2, BM_ELEM_TAG)) {
+				BM_elem_flag_disable(e->v2, BM_ELEM_TAG);
+				bmesh_vert_separate(bm, e->v2, NULL, NULL);
+			}
+		}
+	}
+
+	BMO_slot_buffer_from_enabled_hflag(bm, op, "edgeout", BM_EDGE, BM_ELEM_INTERNAL_TAG);
+}
diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c
new file mode 100644
index 0000000..19e2dd8
--- /dev/null
+++ b/source/blender/bmesh/operators/bmo_extrude.c
@@ -0,0 +1,637 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/operators/bmo_extrude.c
+ *  \ingroup bmesh
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_math.h"
+#include "BLI_array.h"
+
+#include "bmesh.h"
+
+#include "intern/bmesh_operators_private.h" /* own include */
+
+enum {
+	EXT_INPUT   = 1,
+	EXT_KEEP    = 2,
+	EXT_DEL     = 4
+};
+
+#define VERT_MARK 1
+#define EDGE_MARK 1
+#define FACE_MARK 1
+#define VERT_NONMAN 2
+#define EDGE_NONMAN 2
+
+void bmo_extrude_face_indiv_exec(BMesh *bm, BMOperator *op)
+{
+	BMOIter siter;
+	BMIter liter, liter2;
+	BMFace *f, *f2, *f3;
+	BMLoop *l, *l2, *l3, *l4, *l_tmp;
+	BMEdge **edges = NULL, *e, *laste;
+	BMVert *v, *lastv, *firstv;
+	BLI_array_declare(edges);
+	int i;
+
+	BMO_ITER (f, &siter, bm, op, "faces", BM_FACE) {
+		BLI_array_empty(edges);
+		BLI_array_growitems(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);
+
+			/* skip on the first iteration */
+			if (lastv) {
+				e = BM_edge_create(bm, lastv, v, l->e, FALSE);
+				edges[i++] = e;
+			}
+
+			lastv = v;
+			laste = l->e;
+			if (!firstv) firstv = v;
+		}
+
+		/* this fits in the array because we skip one in the loop above */
+		e = BM_edge_create(bm, v, firstv, laste, FALSE);
+		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);
+		if (!f2) {
+			BMO_error_raise(bm, op, BMERR_MESH_ERROR, "Extrude failed; could not create face");
+			BLI_array_free(edges);
+			return;
+		}
+		
+		BMO_elem_flag_enable(bm, f2, EXT_KEEP);
+		BM_elem_attrs_copy(bm, bm, f, f2);
+
+		l2 = BM_iter_new(&liter2, bm, BM_LOOPS_OF_FACE, f2);
+		BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+			BM_elem_attrs_copy(bm, bm, l, l2);
+
+			l3 = l->next;
+			l4 = l2->next;
+
+			f3 = BM_face_create_quad_tri(bm, l3->v, l4->v, l2->v, l->v, f, FALSE);
+
+			l_tmp = BM_FACE_FIRST_LOOP(f3);
+
+			BM_elem_attrs_copy(bm, bm, l->next, l_tmp);  l_tmp = l_tmp->next;
+			BM_elem_attrs_copy(bm, bm, l->next, l_tmp);  l_tmp = l_tmp->next;
+			BM_elem_attrs_copy(bm, bm, l, l_tmp);        l_tmp = l_tmp->next;
+			BM_elem_attrs_copy(bm, bm, l, l_tmp);
+
+			l2 = BM_iter_step(&liter2);
+		}
+	}
+
+	BLI_array_free(edges);
+
+	BMO_op_callf(bm, "del geom=%ff context=%i", EXT_DEL, DEL_ONLYFACES);
+	BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, EXT_KEEP);
+}
+
+/**
+ * \brief Copy the loop pair from an adjacent face to both sides of this quad.
+ *
+ * The face is assumed to be a quad, created by extruding.
+ * 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.
+ */
+static void bm_extrude_copy_face_loop_attributes(BMesh *bm, BMFace *f, BMEdge *e_a, BMEdge *e_b)
+{
+	/* '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 */
+		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 */
+
+	/* 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_src_1, l_dst_a->next);
+	BM_elem_attrs_copy(bm, bm, l_src_1, l_dst_b);
+}
+
+void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op)
+{
+	BMOIter siter;
+	BMOperator dupeop;
+	BMVert *v1, *v2, *v3, *v4;
+	BMEdge *e, *e2;
+	BMFace *f;
+	
+	BMO_ITER (e, &siter, bm, op, "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);
+	}
+
+	BMO_op_initf(bm, &dupeop, "dupe geom=%fve", EXT_INPUT);
+	BMO_op_exec(bm, &dupeop);
+
+	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;
+
+		if (e->l && e->v1 != e->l->v) {
+			v1 = e->v1;
+			v2 = e->v2;
+			v3 = e2->v2;
+			v4 = e2->v1;
+		}
+		else {
+			v1 = e2->v1;
+			v2 = e2->v2;
+			v3 = e->v2;
+			v4 = e->v1;
+		}
+		/* 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);
+		
+		if (BMO_elem_flag_test(bm, e, EXT_INPUT))
+			e = e2;
+		
+		BMO_elem_flag_enable(bm, f, EXT_KEEP);
+		BMO_elem_flag_enable(bm, e, EXT_KEEP);
+		BMO_elem_flag_enable(bm, e->v1, EXT_KEEP);
+		BMO_elem_flag_enable(bm, e->v2, EXT_KEEP);
+		
+	}
+
+	BMO_op_finish(bm, &dupeop);
+
+	BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_ALL, EXT_KEEP);
+}
+
+void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op)
+{
+	BMOIter siter;
+	BMVert *v, *dupev;
+	BMEdge *e;
+
+	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);
+
+		e = BM_edge_create(bm, v, dupev, NULL, FALSE);
+
+		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);
+}
+
+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;
+	BMFace *f;
+	int found, fwd, delorig = FALSE;
+
+	/* initialize our sub-operators */
+	BMO_op_init(bm, &dupeop, "dupe");
+	
+	BMO_slot_buffer_flag_enable(bm, op, "edgefacein", 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")) {
+		BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+
+			int edge_face_tot;
+
+			if (!BMO_elem_flag_test(bm, e, EXT_INPUT)) {
+				continue;
+			}
+
+			found = FALSE; /* found a face that isn't input? */
+			edge_face_tot = 0; /* edge/face count */
+
+			BM_ITER_ELEM (f, &fiter, e, BM_FACES_OF_EDGE) {
+				if (!BMO_elem_flag_test(bm, f, EXT_INPUT)) {
+					found = TRUE;
+					delorig = TRUE;
+					break;
+				}
+
+				edge_face_tot++;
+			}
+
+			if ((edge_face_tot > 1) && (found == FALSE)) {
+				/* edge has a face user, that face isn't extrude input */
+				BMO_elem_flag_enable(bm, e, EXT_DEL);
+			}
+		}
+	}
+
+	/* calculate verts to delete */
+	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+		found = FALSE;
+
+		BM_ITER_ELEM (e, &viter, v, BM_EDGES_OF_VERT) {
+			if (!BMO_elem_flag_test(bm, e, EXT_INPUT) || !BMO_elem_flag_test(bm, e, EXT_DEL)) {
+				found = TRUE;
+				break;
+			}
+		}
+
+		/* avoid an extra loop */
+		if (found == TRUE) {
+			BM_ITER_ELEM (f, &viter, v, BM_FACES_OF_VERT) {
+				if (!BMO_elem_flag_test(bm, f, EXT_INPUT)) {
+					found = TRUE;
+					break;
+				}
+			}
+		}
+
+		if (found == FALSE) {
+			BMO_elem_flag_enable(bm, v, EXT_DEL);
+		}
+	}
+	
+	BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+		if (BMO_elem_flag_test(bm, f, EXT_INPUT)) {
+			BMO_elem_flag_enable(bm, f, EXT_DEL);
+		}
+	}
+
+	if (delorig == TRUE) {
+		BMO_op_initf(bm, &delop, "del geom=%fvef context=%i",
+		             EXT_DEL, DEL_ONLYTAGGED);
+	}
+
+	BMO_slot_copy(op, &dupeop, "edgefacein", "geom");
+	BMO_op_exec(bm, &dupeop);
+
+	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);
+
+	if (delorig) {
+		BMO_op_exec(bm, &delop);
+	}
+	
+	/* if not delorig, reverse loops of original face */
+	if (!delorig) {
+		BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+			if (BMO_elem_flag_test(bm, f, EXT_INPUT)) {
+				BM_face_normal_flip(bm, f);
+			}
+		}
+	}
+	
+	BMO_slot_copy(&dupeop, op, "newout", "geomout");
+
+	for (e = BMO_iter_new(&siter, bm, &dupeop, "boundarymap", 0); e; e = BMO_iter_step(&siter)) {
+
+		/* 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)) {
+			/* The original edge was excluded,
+			 * this would result in a standalone wire edge - see [#30399] */
+			BM_edge_kill(bm, e);
+
+			continue;
+		}
+
+		newedge = *(BMEdge **)BMO_iter_map_value(&siter);
+
+		if (!newedge) {
+			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)
+			fwd = !e->l || !(e->l->v == e->v1);
+		else
+			fwd = (newedge->l->v == newedge->v1);
+
+		
+		if (fwd) {
+			verts[0] = e->v1;
+			verts[1] = e->v2;
+			verts[2] = newedge->v2;
+			verts[3] = newedge->v1;
+		}
+		else {
+			verts[3] = e->v1;
+			verts[2] = e->v2;
+			verts[1] = newedge->v2;
+			verts[0] = newedge->v1;
+		}
+
+		/* 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);
+	}
+
+	/* link isolated vert */
+	for (v = BMO_iter_new(&siter, bm, &dupeop, "isovertmap", 0); v; v = BMO_iter_step(&siter)) {
+		v2 = *((void **)BMO_iter_map_value(&siter));
+		BM_edge_create(bm, v, v2, v->e, TRUE);
+	}
+
+	/* cleanup */
+	if (delorig) BMO_op_finish(bm, &delop);
+	BMO_op_finish(bm, &dupeop);
+}
+
+/*
+ * Compute higher-quality vertex normals used by solidify.
+ * Only considers geometry in the marked solidify region.
+ * Note that this does not work so well for non-manifold
+ * regions.
+ */
+static void calc_solidify_normals(BMesh *bm)
+{
+	BMIter viter, eiter, fiter;
+	BMVert *v;
+	BMEdge *e;
+	BMFace *f, *f1, *f2;
+	float edge_normal[3];
+	int i;
+
+	/* can't use BM_edge_face_count because we need to count only marked faces */
+	int *edge_face_count = MEM_callocN(sizeof(int) * bm->totedge, __func__);
+
+	BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
+		BM_elem_flag_enable(v, BM_ELEM_TAG);
+	}
+
+	BM_mesh_elem_index_ensure(bm, BM_EDGE);
+
+	BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
+		if (!BMO_elem_flag_test(bm, f, FACE_MARK)) {
+			continue;
+		}
+
+		BM_ITER_ELEM (e, &eiter, f, BM_EDGES_OF_FACE) {
+
+			/* And mark all edges and vertices on the
+			 * marked faces */
+			BMO_elem_flag_enable(bm, e, EDGE_MARK);
+			BMO_elem_flag_enable(bm, e->v1, VERT_MARK);
+			BMO_elem_flag_enable(bm, e->v2, VERT_MARK);
+			edge_face_count[BM_elem_index_get(e)]++;
+		}
+	}
+
+	BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) {
+		if (!BMO_elem_flag_test(bm, e, EDGE_MARK)) {
+			continue;
+		}
+
+		i = edge_face_count[BM_elem_index_get(e)]++;
+
+		if (i == 0 || i > 2) {
+			/* Edge & vertices are non-manifold even when considering
+			 * only marked faces */
+			BMO_elem_flag_enable(bm, e, EDGE_NONMAN);
+			BMO_elem_flag_enable(bm, e->v1, VERT_NONMAN);
+			BMO_elem_flag_enable(bm, e->v2, VERT_NONMAN);
+		}
+	}
+	MEM_freeN(edge_face_count);
+	edge_face_count = NULL; /* don't re-use */
+
+	BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
+		if (!BM_vert_is_manifold(v)) {
+			BMO_elem_flag_enable(bm, v, VERT_NONMAN);
+			continue;
+		}
+
+		if (BMO_elem_flag_test(bm, v, VERT_MARK)) {
+			zero_v3(v->no);
+		}
+	}
+
+	BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) {
+
+		/* If the edge is not part of a the solidify region
+		 * its normal should not be considered */
+		if (!BMO_elem_flag_test(bm, e, EDGE_MARK)) {
+			continue;
+		}
+
+		/* If the edge joins more than two marked faces high
+		 * quality normal computation won't work */
+		if (BMO_elem_flag_test(bm, e, EDGE_NONMAN)) {
+			continue;
+		}
+
+		f1 = f2 = NULL;
+
+		BM_ITER_ELEM (f, &fiter, e, BM_FACES_OF_EDGE) {
+			if (BMO_elem_flag_test(bm, f, FACE_MARK)) {
+				if (f1 == NULL) {
+					f1 = f;
+				}
+				else {
+					BLI_assert(f2 == NULL);
+					f2 = f;
+				}
+			}
+		}
+
+		BLI_assert(f1 != NULL);
+
+		if (f2 != NULL) {
+			const float angle = angle_normalized_v3v3(f1->no, f2->no);
+
+			if (angle > 0.0f) {
+				/* two faces using this edge, calculate the edge normal
+				 * using the angle between the faces as a weighting */
+				add_v3_v3v3(edge_normal, f1->no, f2->no);
+				normalize_v3(edge_normal);
+				mul_v3_fl(edge_normal, angle);
+			}
+			else {
+				/* can't do anything useful here!
+				 * Set the face index for a vert in case it gets a zero normal */
+				BM_elem_flag_disable(e->v1, BM_ELEM_TAG);
+				BM_elem_flag_disable(e->v2, BM_ELEM_TAG);
+				continue;
+			}
+		}
+		else {
+			/* only one face attached to that edge */
+			/* an edge without another attached- the weight on this is
+			 * undefined, M_PI / 2 is 90d in radians and that seems good enough */
+			copy_v3_v3(edge_normal, f1->no);
+			mul_v3_fl(edge_normal, M_PI / 2);
+		}
+
+		add_v3_v3(e->v1->no, edge_normal);
+		add_v3_v3(e->v2->no, edge_normal);
+	}
+
+	/* normalize accumulated vertex normal */
+	BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
+		if (!BMO_elem_flag_test(bm, v, VERT_MARK)) {
+			continue;
+		}
+
+		if (BMO_elem_flag_test(bm, v, VERT_NONMAN)) {
+			/* use standard normals for vertices connected to non-manifold edges */
+			BM_vert_normal_update(v);
+		}
+		else if (normalize_v3(v->no) == 0.0f && !BM_elem_flag_test(v, BM_ELEM_TAG)) {
+			/* exceptional case, totally flat. use the normal
+			 * of any marked face around the vertex */
+			BM_ITER_ELEM (f, &fiter, v, BM_FACES_OF_VERT) {
+				if (BMO_elem_flag_test(bm, f, FACE_MARK)) {
+					break;
+				}
+			}
+			copy_v3_v3(v->no, f->no);
+		}
+	}
+}
+
+static void solidify_add_thickness(BMesh *bm, const float dist)
+{
+	BMFace *f;
+	BMVert *v;
+	BMLoop *l;
+	BMIter iter, loopIter;
+	float *vert_angles = MEM_callocN(sizeof(float) * bm->totvert * 2, "solidify"); /* 2 in 1 */
+	float *vert_accum = vert_angles + bm->totvert;
+	int i, index;
+
+	/* array for passing verts to angle_poly_v3 */
+	float **verts = NULL;
+	BLI_array_staticdeclare(verts, BM_NGON_STACK_SIZE);
+	/* array for receiving angles from angle_poly_v3 */
+	float *face_angles = NULL;
+	BLI_array_staticdeclare(face_angles, BM_NGON_STACK_SIZE);
+
+	BM_mesh_elem_index_ensure(bm, BM_VERT);
+
+	BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+		if (!BMO_elem_flag_test(bm, f, FACE_MARK)) {
+			continue;
+		}
+
+		BLI_array_growitems(verts, f->len);
+		BM_ITER_ELEM_INDEX (l, &loopIter, f, BM_LOOPS_OF_FACE, i) {
+			verts[i] = l->v->co;
+		}
+
+		BLI_array_growitems(face_angles, f->len);
+		angle_poly_v3(face_angles, (const float **)verts, f->len);
+
+		i = 0;
+		BM_ITER_ELEM (l, &loopIter, f, BM_LOOPS_OF_FACE) {
+			v = l->v;
+			index = BM_elem_index_get(v);
+			vert_accum[index] += face_angles[i];
+			vert_angles[index] += shell_angle_to_dist(angle_normalized_v3v3(v->no, f->no)) * face_angles[i];
+			i++;
+		}
+
+		BLI_array_empty(verts);
+		BLI_array_empty(face_angles);
+	}
+
+	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+		index = BM_elem_index_get(v);
+		if (vert_accum[index]) { /* zero if unselected */
+			madd_v3_v3fl(v->co, v->no, dist * (vert_angles[index] / vert_accum[index]));
+		}
+	}
+
+	MEM_freeN(vert_angles);
+
+	BLI_array_free(verts);
+	BLI_array_free(face_angles);
+}
+
+void bmo_solidify_face_region_exec(BMesh *bm, BMOperator *op)
+{
+	BMOperator extrudeop;
+	BMOperator reverseop;
+	float thickness;
+
+	thickness = BMO_slot_float_get(op, "thickness");
+
+	/* Flip original faces (so the shell is extruded inward) */
+	BMO_op_init(bm, &reverseop, "reversefaces");
+	BMO_slot_copy(op, &reverseop, "geom", "faces");
+	BMO_op_exec(bm, &reverseop);
+	BMO_op_finish(bm, &reverseop);
+
+	/* Extrude the region */
+	BMO_op_initf(bm, &extrudeop, "extrude_face_region alwayskeeporig=%b", TRUE);
+	BMO_slot_copy(op, &extrudeop, "geom", "edgefacein");
+	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);
+	calc_solidify_normals(bm);
+	solidify_add_thickness(bm, thickness);
+
+	BMO_slot_copy(&extrudeop, op, "geomout", "geomout");
+
+	BMO_op_finish(bm, &extrudeop);
+}
diff --git a/source/blender/bmesh/operators/bmo_inset.c b/source/blender/bmesh/operators/bmo_inset.c
new file mode 100644
index 0000000..712f6b7
--- /dev/null
+++ b/source/blender/bmesh/operators/bmo_inset.c
@@ -0,0 +1,562 @@
+/*
+ * ***** 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_inset.c
+ *  \ingroup bmesh
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_math.h"
+
+#include "bmesh.h"
+
+#include "intern/bmesh_operators_private.h" /* own include */
+
+#define ELE_NEW		1
+
+typedef struct SplitEdgeInfo {
+	float   no[3];
+	float   length;
+	BMEdge *e_old;
+	BMEdge *e_new;
+	BMLoop *l;
+} SplitEdgeInfo;
+
+/**
+ * return the tag loop where there is...
+ * - only 1 tagged face attached to this edge.
+ * - 1 or more untagged faces.
+ *
+ * \note this function looks to be expensive
+ * but in most cases it will only do 2 iterations.
+ */
+static BMLoop *bm_edge_is_mixed_face_tag(BMLoop *l)
+{
+	if (LIKELY(l != NULL)) {
+		int tot_tag = 0;
+		int tot_untag = 0;
+		BMLoop *l_iter;
+		BMLoop *l_tag = NULL;
+		l_iter = l;
+		do {
+			if (BM_elem_flag_test(l_iter->f, BM_ELEM_TAG)) {
+				/* more then one tagged face - bail out early! */
+				if (tot_tag == 1) {
+					return NULL;
+				}
+				l_tag = l_iter;
+				tot_tag++;
+			}
+			else {
+				tot_untag++;
+			}
+
+		} while ((l_iter = l_iter->radial_next) != l);
+
+		return ((tot_tag == 1) && (tot_untag >= 1)) ? l_tag : NULL;
+	}
+	else {
+		return NULL;
+	}
+}
+
+float bm_vert_avg_tag_dist(BMVert *v)
+{
+	BMIter iter;
+	BMEdge *e;
+	int tot;
+	float length = 0.0f;
+
+	BM_ITER_ELEM_INDEX (e, &iter, v, BM_EDGES_OF_VERT, tot) {
+		BMVert *v_other = BM_edge_other_vert(e, v);
+		if (BM_elem_flag_test(v_other, BM_ELEM_TAG)) {
+			length += BM_edge_calc_length(e);
+		}
+	}
+
+	return length / (float)tot;
+}
+
+/**
+ * implementation is as follows...
+ *
+ * - set all faces as tagged/untagged based on selection.
+ * - find all edges that have 1 tagged, 1 untagged face.
+ * - separate these edges and tag vertices, set their index to point to the original edge.
+ * - build faces between old/new edges.
+ * - inset the new edges into their faces.
+ */
+
+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_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");
+
+	int edge_info_len = 0;
+
+	BMIter iter;
+	SplitEdgeInfo *edge_info;
+	SplitEdgeInfo *es;
+
+	BMVert *v;
+	BMEdge *e;
+	BMFace *f;
+	int i, j, k;
+
+	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);
+	}
+	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);
+	}
+
+	/* first count all inset edges we will split */
+	/* fill in array and initialize tagging */
+	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+		if (
+		    /* tag if boundary is enabled */
+		    (use_boundary && BM_edge_is_boundary(e) && BM_elem_flag_test(e->l->f, BM_ELEM_TAG)) ||
+
+		    /* tag if edge is an interior edge inbetween a tagged and untagged face */
+		    (bm_edge_is_mixed_face_tag(e->l)))
+		{
+			/* tag */
+			BM_elem_flag_enable(e->v1, BM_ELEM_TAG);
+			BM_elem_flag_enable(e->v2, BM_ELEM_TAG);
+			BM_elem_flag_enable(e, BM_ELEM_TAG);
+
+			BM_elem_index_set(e, edge_info_len); /* set_dirty! */
+			edge_info_len++;
+		}
+		else {
+			BM_elem_flag_disable(e->v1, BM_ELEM_TAG);
+			BM_elem_flag_disable(e->v2, BM_ELEM_TAG);
+			BM_elem_flag_disable(e, BM_ELEM_TAG);
+
+			BM_elem_index_set(e, -1); /* set_dirty! */
+		}
+	}
+	bm->elem_index_dirty |= BM_EDGE;
+
+	edge_info = MEM_mallocN(edge_info_len * sizeof(SplitEdgeInfo), __func__);
+
+	/* fill in array and initialize tagging */
+	es = edge_info;
+	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+		i = BM_elem_index_get(e);
+		if (i != -1) {
+			/* calc edge-split info */
+			es->length = BM_edge_calc_length(e);
+			es->e_old = e;
+			es++;
+			/* initialize no and e_new after */
+		}
+	}
+
+	for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
+		if ((es->l = bm_edge_is_mixed_face_tag(es->e_old->l))) {
+			/* do nothing */
+		}
+		else {
+			es->l = es->e_old->l; /* must be a boundary */
+		}
+
+
+		/* run the separate arg */
+		bmesh_edge_separate(bm, es->e_old, es->l);
+
+		/* calc edge-split info */
+		es->e_new = es->l->e;
+		BM_edge_calc_face_tangent(es->e_new, es->l, es->no);
+
+		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);
+		}
+
+		/* store index back to original in 'edge_info' */
+		BM_elem_index_set(es->e_new, i);
+		BM_elem_flag_enable(es->e_new, BM_ELEM_TAG);
+
+		/* important to tag again here */
+		BM_elem_flag_enable(es->e_new->v1, BM_ELEM_TAG);
+		BM_elem_flag_enable(es->e_new->v2, BM_ELEM_TAG);
+	}
+
+
+	/* show edge normals for debugging */
+#if 0
+	for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
+		float tvec[3];
+		BMVert *v1, *v2;
+
+		mid_v3_v3v3(tvec, es->e_new->v1->co, es->e_new->v2->co);
+
+		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);
+	}
+#endif
+
+	/* execute the split and position verts, it would be most obvious to loop over verts
+	 * here but don't do this since we will be splitting them off (iterating stuff you modify is bad juju)
+	 * instead loop over edges then their verts */
+	for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
+		for (j = 0; j < 2; j++) {
+			v = (j == 0) ? es->e_new->v1 : es->e_new->v2;
+
+			/* end confusing part - just pretend this is a typical loop on verts */
+
+			/* only split of tagged verts - used by separated edges */
+
+			/* comment the first part because we know this verts in a tagged face */
+			if (/* v->e && */BM_elem_flag_test(v, BM_ELEM_TAG)) {
+				BMVert **vout;
+				int r_vout_len;
+				BMVert *v_glue = NULL;
+
+				/* disable touching twice, this _will_ happen if the flags not disabled */
+				BM_elem_flag_disable(v, BM_ELEM_TAG);
+
+				bmesh_vert_separate(bm, v, &vout, &r_vout_len);
+				v = NULL; /* don't use again */
+
+				/* in some cases the edge doesn't split off */
+				if (r_vout_len == 1) {
+					MEM_freeN(vout);
+					continue;
+				}
+
+				for (k = 0; k < r_vout_len; k++) {
+					BMVert *v_split = vout[k]; /* only to avoid vout[k] all over */
+
+					/* need to check if this vertex is from a */
+					int vert_edge_tag_tot = 0;
+					int vecpair[2];
+
+					/* find adjacent */
+					BM_ITER_ELEM (e, &iter, v_split, BM_EDGES_OF_VERT) {
+						if (BM_elem_flag_test(e, BM_ELEM_TAG) &&
+						    e->l && BM_elem_flag_test(e->l->f, BM_ELEM_TAG))
+						{
+							if (vert_edge_tag_tot < 2) {
+								vecpair[vert_edge_tag_tot] = BM_elem_index_get(e);
+								BLI_assert(vecpair[vert_edge_tag_tot] != -1);
+							}
+
+							vert_edge_tag_tot++;
+						}
+					}
+
+					if (vert_edge_tag_tot != 0) {
+						float tvec[3];
+
+						if (vert_edge_tag_tot >= 2) { /* 2 edge users - common case */
+							/* now there are 2 cases to check for,
+							 *
+							 * if both edges use the same face OR both faces have the same normal,
+							 * ...then we can calculate an edge that fits nicely between the 2 edge normals.
+							 *
+							 * Otherwise use the shared edge OR the corner defined by these 2 face normals,
+							 * when both edges faces are adjacent this works best but even when this vertex
+							 * fans out faces it should work ok.
+							 */
+
+							SplitEdgeInfo *e_info_a = &edge_info[vecpair[0]];
+							SplitEdgeInfo *e_info_b = &edge_info[vecpair[1]];
+
+							BMFace *f_a = e_info_a->l->f;
+							BMFace *f_b = e_info_b->l->f;
+
+							/* we use this as either the normal OR to find the right direction for the
+							 * crpss product between both face normals */
+							add_v3_v3v3(tvec, e_info_a->no, e_info_b->no);
+
+							if ((f_a == f_b) || compare_v3v3(f_a->no, f_b->no, 0.00001f)) {
+								normalize_v3(tvec);
+							}
+							else {
+								/* these lookups are very quick */
+								BMLoop *l_other_a = BM_loop_other_vert_loop(e_info_a->l, v_split);
+								BMLoop *l_other_b = BM_loop_other_vert_loop(e_info_b->l, v_split);
+
+								if (l_other_a->v == l_other_b->v) {
+									/* both edges faces are adjacent, but we don't need to know the shared edge
+									 * having both verts is enough. */
+									sub_v3_v3v3(tvec, l_other_a->v->co, v_split->co);
+								}
+								else {
+									/* faces don't touch,
+									 * just get cross product of their normals, its *good enough*
+									 */
+									float tno[3];
+									cross_v3_v3v3(tno, f_a->no, f_b->no);
+									if (dot_v3v3(tvec, tno) < 0.0f) {
+										negate_v3(tno);
+									}
+									copy_v3_v3(tvec, tno);
+								}
+
+								normalize_v3(tvec);
+							}
+
+							/* scale by edge angle */
+							if (use_even_offset) {
+								mul_v3_fl(tvec, shell_angle_to_dist(angle_normalized_v3v3(e_info_a->no, e_info_b->no) / 2.0f));
+							}
+
+							/* scale relative to edge lengths */
+							if (use_relative_offset) {
+								mul_v3_fl(tvec, (edge_info[vecpair[0]].length + edge_info[vecpair[1]].length) / 2.0f);
+							}
+						}
+						else if (vert_edge_tag_tot == 1) { /* 1 edge user - boundary vert, not so common */
+							const float *e_no_a = edge_info[vecpair[0]].no;
+
+							if (use_even_boundry) {
+
+								/* This case where only one edge attached to v_split
+								 * is used - ei - the face to inset is on a boundary.
+								 *
+								 *                  We want the inset to align flush with the
+								 *                  boundary edge, not the normal of the interior
+								 *             <--- edge which would give an unsightly bump.
+								 * --+-------------------------+---------------+--
+								 *   |^v_other    ^e_other    /^v_split        |
+								 *   |                       /                 |
+								 *   |                      /                  |
+								 *   |                     / <- tag split edge |
+								 *   |                    /                    |
+								 *   |                   /                     |
+								 *   |                  /                      |
+								 * --+-----------------+-----------------------+--
+								 *   |                                         |
+								 *   |                                         |
+								 *
+								 * note, the fact we are doing location comparisons on verts that are moved about
+								 * doesn't matter because the direction will remain the same in this case.
+								 */
+
+								BMEdge *e_other;
+								BMVert *v_other;
+								/* loop will always be either next of prev */
+								BMLoop *l = v_split->e->l;
+								if (l->prev->v == v_split) {
+									l = l->prev;
+								}
+								else if (l->next->v == v_split) {
+									l = l->next;
+								}
+								else if (l->v == v_split) {
+									/* pass */
+								}
+								else {
+									/* should never happen */
+									BLI_assert(0);
+								}
+
+								/* find the edge which is _not_ being split here */
+								if (!BM_elem_flag_test(l->e, BM_ELEM_TAG)) {
+									e_other = l->e;
+								}
+								else if (!BM_elem_flag_test(l->prev->e, BM_ELEM_TAG)) {
+									e_other = l->prev->e;
+								}
+								else {
+									BLI_assert(0);
+									e_other = NULL;
+								}
+
+								v_other = BM_edge_other_vert(e_other, v_split);
+								sub_v3_v3v3(tvec, v_other->co, v_split->co);
+								normalize_v3(tvec);
+
+								if (use_even_offset) {
+									mul_v3_fl(tvec, shell_angle_to_dist(angle_normalized_v3v3(e_no_a, tvec)));
+								}
+							}
+							else {
+								copy_v3_v3(tvec, e_no_a);
+							}
+
+							/* use_even_offset - doesn't apply here */
+
+							/* scale relative to edge length */
+							if (use_relative_offset) {
+								mul_v3_fl(tvec, edge_info[vecpair[0]].length);
+							}
+						}
+						else {
+							/* should never happen */
+							BLI_assert(0);
+							zero_v3(tvec);
+						}
+
+						/* apply the offset */
+						madd_v3_v3fl(v_split->co, tvec, thickness);
+					}
+
+					/* this saves expensive/slow glue check for common cases */
+					if (r_vout_len > 2) {
+						int ok = TRUE;
+						/* last step, NULL this vertex if has a tagged face */
+						BM_ITER_ELEM (f, &iter, v_split, BM_FACES_OF_VERT) {
+							if (BM_elem_flag_test(f, BM_ELEM_TAG)) {
+								ok = FALSE;
+								break;
+							}
+						}
+
+						if (ok) {
+							if (v_glue == NULL) {
+								v_glue = v_split;
+							}
+							else {
+								BM_vert_splice(bm, v_split, v_glue);
+							}
+						}
+					}
+					/* end glue */
+
+				}
+				MEM_freeN(vout);
+			}
+		}
+	}
+
+	/* create faces */
+	for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
+		BMVert *varr[4] = {NULL};
+		/* get the verts in the correct order */
+		BM_edge_ordered_verts_ex(es->e_new, &varr[1], &varr[0], es->l);
+#if 0
+		if (varr[0] == es->e_new->v1) {
+			varr[2] = es->e_old->v2;
+			varr[3] = es->e_old->v1;
+		}
+		else {
+			varr[2] = es->e_old->v1;
+			varr[3] = es->e_old->v2;
+		}
+		j = 4;
+#else
+		/* slightly trickier check - since we can't assume the verts are split */
+		j = 2; /* 2 edges are set */
+		if (varr[0] == es->e_new->v1) {
+			if (es->e_old->v2 != es->e_new->v2) { varr[j++] = es->e_old->v2; }
+			if (es->e_old->v1 != es->e_new->v1) { varr[j++] = es->e_old->v1; }
+		}
+		else {
+			if (es->e_old->v1 != es->e_new->v1) { varr[j++] = es->e_old->v1; }
+			if (es->e_old->v2 != es->e_new->v2) { varr[j++] = es->e_old->v2; }
+		}
+
+		if (j == 2) {
+			/* can't make face! */
+			continue;
+		}
+#endif
+		/* no need to check doubles, we KNOW there won't be any */
+		/* yes - reverse face is correct in this case */
+		f = BM_face_create_quad_tri_v(bm, varr, j, es->l->f, FALSE);
+		BMO_elem_flag_enable(bm, f, ELE_NEW);
+
+		/* 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 */
+		BM_face_copy_shared(bm, f);
+	}
+
+	/* we could flag new edges/verts too, is it useful? */
+	BMO_slot_buffer_from_enabled_flag(bm, op, "faceout", BM_FACE, ELE_NEW);
+
+	/* cheap feature to add depth to the inset */
+	if (depth != 0.0f) {
+		float (*varr_co)[3];
+		BMOIter oiter;
+
+		/* we need to re-calculate tagged normals, but for this purpose we can copy tagged verts from the
+		 * faces they inset from,  */
+		for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
+			zero_v3(es->e_new->v1->no);
+			zero_v3(es->e_new->v2->no);
+		}
+		for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
+			float *no = es->l->f->no;
+			add_v3_v3(es->e_new->v1->no, no);
+			add_v3_v3(es->e_new->v2->no, no);
+		}
+		for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
+			/* annoying, avoid normalizing twice */
+			if (len_squared_v3(es->e_new->v1->no) != 1.0f) {
+				normalize_v3(es->e_new->v1->no);
+			}
+			if (len_squared_v3(es->e_new->v2->no) != 1.0f) {
+				normalize_v3(es->e_new->v2->no);
+			}
+		}
+		/* done correcting edge verts normals */
+
+		/* untag verts */
+		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) {
+			BM_ITER_ELEM (v, &iter, f, BM_VERTS_OF_FACE) {
+				BM_elem_flag_enable(v, BM_ELEM_TAG);
+			}
+		}
+
+		/* do in 2 passes so moving the verts doesn't feed back into face angle checks
+		 * which BM_vert_calc_shell_factor uses. */
+
+		/* over allocate */
+		varr_co = MEM_callocN(sizeof(*varr_co) * bm->totvert, __func__);
+
+		BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) {
+			if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
+				const float fac = (depth *
+				                   (use_relative_offset ? bm_vert_avg_tag_dist(v) : 1.0f) *
+				                   (use_even_boundry    ? BM_vert_calc_shell_factor(v) : 1.0f));
+				madd_v3_v3v3fl(varr_co[i], v->co, v->no, fac);
+			}
+		}
+
+		BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) {
+			if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
+				copy_v3_v3(v->co, varr_co[i]);
+			}
+		}
+		MEM_freeN(varr_co);
+	}
+
+	MEM_freeN(edge_info);
+}
diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c
new file mode 100644
index 0000000..582039f
--- /dev/null
+++ b/source/blender/bmesh/operators/bmo_join_triangles.c
@@ -0,0 +1,369 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/operators/bmo_join_triangles.c
+ *  \ingroup bmesh
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_meshdata_types.h"
+
+#include "BKE_customdata.h"
+
+#include "BLI_math.h"
+#include "BLI_array.h"
+
+#include "bmesh.h"
+
+#include "intern/bmesh_operators_private.h" /* own include */
+
+/* Bitflags for edges */
+#define T2QDELETE	1
+#define T2QCOMPLEX	2
+#define T2QJOIN		4
+
+/* assumes edges are validated before reaching this poin */
+static float measure_facepair(BMVert *v1, BMVert *v2,
+                              BMVert *v3, BMVert *v4, float limit)
+{
+	/* gives a 'weight' to a pair of triangles that join an edge to decide how good a join they would make */
+	/* Note: this is more complicated than it needs to be and should be cleaned up.. */
+	float n1[3], n2[3], measure = 0.0f, angle1, angle2, diff;
+	float edgeVec1[3], edgeVec2[3], edgeVec3[3], edgeVec4[3];
+	float minarea, maxarea, areaA, areaB;
+
+	/* First Test: Normal difference */
+	normal_tri_v3(n1, v1->co, v2->co, v3->co);
+	normal_tri_v3(n2, v1->co, v3->co, v4->co);
+
+	if (n1[0] == n2[0] && n1[1] == n2[1] && n1[2] == n2[2]) angle1 = 0.0f;
+	else angle1 = angle_v3v3(n1, n2);
+
+	normal_tri_v3(n1, v2->co, v3->co, v4->co);
+	normal_tri_v3(n2, v4->co, v1->co, v2->co);
+
+	if (n1[0] == n2[0] && n1[1] == n2[1] && n1[2] == n2[2]) angle2 = 0.0f;
+	else angle2 = angle_v3v3(n1, n2);
+
+	measure += (angle1 + angle2) * 0.5f;
+	if (measure > limit) {
+		return measure;
+	}
+
+	/* Second test: Colinearity */
+	sub_v3_v3v3(edgeVec1, v1->co, v2->co);
+	sub_v3_v3v3(edgeVec2, v2->co, v3->co);
+	sub_v3_v3v3(edgeVec3, v3->co, v4->co);
+	sub_v3_v3v3(edgeVec4, v4->co, v1->co);
+
+	/* a completely skinny face is 'pi' after halving */
+	diff = 0.25f * (fabsf(angle_v3v3(edgeVec1, edgeVec2) - (float)M_PI_2) +
+	                fabsf(angle_v3v3(edgeVec2, edgeVec3) - (float)M_PI_2) +
+	                fabsf(angle_v3v3(edgeVec3, edgeVec4) - (float)M_PI_2) +
+	                fabsf(angle_v3v3(edgeVec4, edgeVec1) - (float)M_PI_2));
+
+	if (!diff) {
+		return 0.0;
+	}
+
+	measure +=  diff;
+	if (measure > limit) {
+		return measure;
+	}
+
+	/* Third test: Concavity */
+	areaA = area_tri_v3(v1->co, v2->co, v3->co) + area_tri_v3(v1->co, v3->co, v4->co);
+	areaB = area_tri_v3(v2->co, v3->co, v4->co) + area_tri_v3(v4->co, v1->co, v2->co);
+
+	if (areaA <= areaB) minarea = areaA;
+	else minarea = areaB;
+
+	if (areaA >= areaB) maxarea = areaA;
+	else maxarea = areaB;
+
+	if (!maxarea) measure += 1;
+	else measure += (1 - (minarea / maxarea));
+
+	return measure;
+}
+
+#define T2QUV_LIMIT 0.005f
+#define T2QCOL_LIMIT 3
+
+static int compareFaceAttribs(BMesh *bm, BMEdge *e, int douvs, int dovcols)
+{
+	MTexPoly *tp1, *tp2;
+	MLoopCol *lcol1, *lcol2, *lcol3, *lcol4;
+	MLoopUV *luv1, *luv2, *luv3, *luv4;
+	BMLoop *l1, *l2, *l3, *l4;
+	int mergeok_uvs = !douvs, mergeok_vcols = !dovcols;
+	
+	l1 = e->l;
+	l3 = e->l->radial_next;
+	
+	/* match up loops on each side of an edge corresponding to each ver */
+	if (l1->v == l3->v) {
+		l2 = l1->next;
+		l4 = l2->next;
+	}
+	else {
+		l2 = l1->next;
+
+		l4 = l3;
+		l3 = l4->next;
+	}
+
+	lcol1 = CustomData_bmesh_get(&bm->ldata, l1->head.data, CD_MLOOPCOL);
+	lcol2 = CustomData_bmesh_get(&bm->ldata, l1->head.data, CD_MLOOPCOL);
+	lcol3 = CustomData_bmesh_get(&bm->ldata, l1->head.data, CD_MLOOPCOL);
+	lcol4 = CustomData_bmesh_get(&bm->ldata, l1->head.data, CD_MLOOPCOL);
+
+	luv1 = CustomData_bmesh_get(&bm->ldata, l1->head.data, CD_MLOOPUV);
+	luv2 = CustomData_bmesh_get(&bm->ldata, l1->head.data, CD_MLOOPUV);
+	luv3 = CustomData_bmesh_get(&bm->ldata, l1->head.data, CD_MLOOPUV);
+	luv4 = CustomData_bmesh_get(&bm->ldata, l1->head.data, CD_MLOOPUV);
+
+	tp1 = CustomData_bmesh_get(&bm->pdata, l1->f->head.data, CD_MTEXPOLY);
+	tp2 = CustomData_bmesh_get(&bm->pdata, l2->f->head.data, CD_MTEXPOLY);
+
+	if (!lcol1)
+		mergeok_vcols = 1;
+
+	if (!luv1)
+		mergeok_uvs = 1;
+
+	/* compare faceedges for each face attribute. Additional per face attributes can be added late */
+
+	/* do VCOL */
+	if (lcol1 && dovcols) {
+		char *cols[4] = {(char *)lcol1, (char *)lcol2, (char *)lcol3, (char *)lcol4};
+		int i;
+
+		for (i = 0; i < 3; i++) {
+			if (cols[0][i] + T2QCOL_LIMIT < cols[2][i] - T2QCOL_LIMIT)
+				break;
+			if (cols[1][i] + T2QCOL_LIMIT < cols[3][i] - T2QCOL_LIMIT)
+				break;
+		}
+
+		if (i == 3)
+			mergeok_vcols = 1;
+	}
+
+	/* do UV */
+	if (luv1 && douvs) {
+		if (tp1->tpage != tp2->tpage) {
+			/* do nothing */
+		}
+		else {
+			int i;
+
+			for (i = 0; i < 2; i++) {
+				if (luv1->uv[0] + T2QUV_LIMIT > luv3->uv[0] && luv1->uv[0] - T2QUV_LIMIT < luv3->uv[0] &&
+				    luv1->uv[1] + T2QUV_LIMIT > luv3->uv[1] && luv1->uv[1] - T2QUV_LIMIT < luv3->uv[1])
+				{
+					if (luv2->uv[0] + T2QUV_LIMIT > luv4->uv[0] && luv2->uv[0] - T2QUV_LIMIT < luv4->uv[0] &&
+					    luv2->uv[1] + T2QUV_LIMIT > luv4->uv[1] && luv2->uv[1] - T2QUV_LIMIT < luv4->uv[1])
+					{
+						mergeok_uvs = 1;
+					}
+				}
+			}
+		}
+	}
+
+	if (douvs == mergeok_uvs && dovcols == mergeok_vcols) {
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+typedef struct JoinEdge {
+	float weight;
+	BMEdge *e;
+} JoinEdge;
+
+#define EDGE_MARK	1
+#define EDGE_CHOSEN	2
+
+#define FACE_MARK	1
+#define FACE_INPUT	2
+
+static int fplcmp(const void *v1, const void *v2)
+{
+	const JoinEdge *e1 = (JoinEdge *)v1, *e2 = (JoinEdge *)v2;
+
+	if (e1->weight > e2->weight) return 1;
+	else if (e1->weight < e2->weight) return -1;
+
+	return 0;
+}
+
+void bmo_join_triangles_exec(BMesh *bm, BMOperator *op)
+{
+	BMIter iter, liter;
+	BMOIter siter;
+	BMFace *f1, *f2;
+	BMLoop *l;
+	BMEdge *e;
+	BLI_array_declare(jedges);
+	JoinEdge *jedges = NULL;
+	int dosharp = BMO_slot_bool_get(op, "cmp_sharp");
+	int douvs =   BMO_slot_bool_get(op, "cmp_uvs");
+	int dovcols = BMO_slot_bool_get(op, "cmp_vcols");
+	int domat =   BMO_slot_bool_get(op, "cmp_materials");
+	float limit = BMO_slot_float_get(op, "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_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) {
+		if (!BMO_elem_flag_test(bm, e, EDGE_MARK))
+			continue;
+
+		if (!BM_edge_face_pair(e, &f1, &f2)) {
+			BMO_elem_flag_disable(bm, e, EDGE_MARK);
+			continue;
+		}
+
+		if (f1->len != 3 || f2->len != 3) {
+			BMO_elem_flag_disable(bm, e, EDGE_MARK);
+			continue;
+		}
+
+		if (!BMO_elem_flag_test(bm, f1, FACE_INPUT) || !BMO_elem_flag_test(bm, f2, FACE_INPUT)) {
+			BMO_elem_flag_disable(bm, e, EDGE_MARK);
+			continue;
+		}
+	}
+	
+	i = 0;
+	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+		BMVert *v1, *v2, *v3, *v4;
+		BMFace *f1, *f2;
+		float measure;
+
+		if (!BMO_elem_flag_test(bm, e, EDGE_MARK))
+			continue;
+
+		f1 = e->l->f;
+		f2 = e->l->radial_next->f;
+
+		v1 = e->l->v;
+		v2 = e->l->prev->v;
+		v3 = e->l->next->v;
+		v4 = e->l->radial_next->prev->v;
+
+		if (dosharp && !BM_elem_flag_test(e, BM_ELEM_SMOOTH))
+			continue;
+		
+		if ((douvs || dovcols) && compareFaceAttribs(bm, e, douvs, dovcols))
+			continue;
+
+		if (domat && f1->mat_nr != f2->mat_nr)
+			continue;
+
+		measure = measure_facepair(v1, v2, v3, v4, limit);
+		if (measure < limit) {
+			BLI_array_growone(jedges);
+
+			jedges[i].e = e;
+			jedges[i].weight = measure;
+
+			i++;
+		}
+	}
+
+	if (!jedges)
+		return;
+
+	qsort(jedges, BLI_array_count(jedges), sizeof(JoinEdge), fplcmp);
+
+	totedge = BLI_array_count(jedges);
+	for (i = 0; i < totedge; i++) {
+		BMFace *f1, *f2;
+
+		e = jedges[i].e;
+		f1 = e->l->f;
+		f2 = e->l->radial_next->f;
+
+		if (BMO_elem_flag_test(bm, f1, FACE_MARK) || BMO_elem_flag_test(bm, f2, FACE_MARK))
+			continue;
+
+		BMO_elem_flag_enable(bm, f1, FACE_MARK);
+		BMO_elem_flag_enable(bm, f2, FACE_MARK);
+		BMO_elem_flag_enable(bm, e, EDGE_CHOSEN);
+	}
+
+	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+		if (!BMO_elem_flag_test(bm, e, EDGE_CHOSEN))
+			continue;
+
+
+		BM_edge_face_pair(e, &f1, &f2); /* checked above */
+		BM_faces_join_pair(bm, f1, f2, e, TRUE);
+	}
+
+	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+		if (BMO_elem_flag_test(bm, e, EDGE_MARK)) {
+			/* ok, this edge wasn't merged, check if it's
+			 * in a 2-tri-pair island, and if so merg */
+
+			f1 = e->l->f;
+			f2 = e->l->radial_next->f;
+			
+			if (f1->len != 3 || f2->len != 3)
+				continue;
+
+			for (i = 0; i < 2; i++) {
+				BM_ITER_ELEM (l, &liter, i ? f2 : f1, BM_LOOPS_OF_FACE) {
+					if (l->e != e && BMO_elem_flag_test(bm, l->e, EDGE_MARK)) {
+						break;
+					}
+				}
+				
+				/* if l isn't NULL, we broke out of the loo */
+				if (l) {
+					break;
+				}
+			}
+
+			/* if i isn't 2, we broke out of that loo */
+			if (i != 2) {
+				continue;
+			}
+
+			BM_faces_join_pair(bm, f1, f2, e, TRUE);
+		}
+	}
+
+	BLI_array_free(jedges);
+}
diff --git a/source/blender/bmesh/operators/bmo_mesh_conv.c b/source/blender/bmesh/operators/bmo_mesh_conv.c
new file mode 100644
index 0000000..4578270
--- /dev/null
+++ b/source/blender/bmesh/operators/bmo_mesh_conv.c
@@ -0,0 +1,83 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/operators/bmesh_mesh_conv.c
+ *  \ingroup bmesh
+ *
+ * This file contains functions
+ * for converting a Mesh
+ * into a Bmesh, and back again.
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_object_types.h"
+#include "DNA_key_types.h"
+#include "DNA_modifier_types.h"
+
+#include "BKE_mesh.h"
+#include "BLI_listbase.h"
+#include "BKE_global.h"
+#include "BKE_key.h"
+#include "BKE_main.h"
+#include "BKE_customdata.h"
+
+#include "BLI_math.h"
+#include "BLI_array.h"
+
+#include "bmesh.h"
+#include "intern/bmesh_private.h"
+
+#include "intern/bmesh_operators_private.h" /* own include */
+
+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");
+
+	BM_mesh_bm_from_me(bm, me, set_key, ob->shapenr);
+
+	if (me->key && ob->shapenr > me->key->totkey) {
+		ob->shapenr = me->key->totkey - 1;
+	}
+}
+
+void bmo_object_load_bmesh_exec(BMesh *bm, BMOperator *op)
+{
+	Object *ob = BMO_slot_ptr_get(op, "object");
+	/* Scene *scene = BMO_slot_ptr_get(op, "scene"); */
+	Mesh *me = ob->data;
+
+	BMO_op_callf(bm, "bmesh_to_mesh mesh=%p object=%p notessellation=%b", me, ob, TRUE);
+}
+
+void bmo_bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
+{
+	Mesh *me = BMO_slot_ptr_get(op, "mesh");
+	/* Object *ob = BMO_slot_ptr_get(op, "object"); */
+	int dotess = !BMO_slot_bool_get(op, "notessellation");
+
+	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
new file mode 100644
index 0000000..cf1669d
--- /dev/null
+++ b/source/blender/bmesh/operators/bmo_mirror.c
@@ -0,0 +1,127 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/operators/bmo_mirror.c
+ *  \ingroup bmesh
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_meshdata_types.h"
+
+#include "BLI_math.h"
+#include "BLI_array.h"
+
+#include "BKE_customdata.h"
+
+#include "bmesh.h"
+#include "intern/bmesh_operators_private.h" /* own include */
+
+#define ELE_NEW		1
+
+void bmo_mirror_exec(BMesh *bm, BMOperator *op)
+{
+	BMOperator dupeop, weldop;
+	BMOIter siter;
+	BMIter iter;
+	BMVert *v /* , *v2 */ /* UNUSED */, **vmap = NULL;
+	BLI_array_declare(vmap);
+	BMEdge /*  *e, */ **emap = NULL;
+	BLI_array_declare(emap);
+	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");
+	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");
+
+	ototvert = bm->totvert;
+	/* ototedge = bm->totedge; */ /* UNUSED */
+	
+	BMO_slot_mat4_get(op, "mat", mtx);
+	invert_m4_m4(imtx, mtx);
+	
+	BMO_op_initf(bm, &dupeop, "dupe geom=%s", op, "geom");
+	BMO_op_exec(bm, &dupeop);
+	
+	BMO_slot_buffer_flag_enable(bm, &dupeop, "newout", BM_ALL, 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) {
+		BLI_array_growone(vmap);
+		vmap[i] = v;
+		/* v2 = BM_iter_step(&iter); */ /* UNUSED */
+		i++;
+	}
+	bm->elem_index_dirty |= BM_VERT;
+
+	/* feed old data to transform bmo */
+	scale[axis] = -1.0f;
+	BMO_op_callf(bm, "transform verts=%fv mat=%m4", ELE_NEW, mtx);
+	BMO_op_callf(bm, "scale verts=%fv vec=%v", ELE_NEW, scale);
+	BMO_op_callf(bm, "transform verts=%fv mat=%m4", ELE_NEW, imtx);
+	
+	BMO_op_init(bm, &weldop, "weldverts");
+
+	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);
+		}
+		v = BM_iter_step(&iter);
+	}
+	
+	if (mirroru || mirrorv) {
+		BMFace *f;
+		BMLoop *l;
+		MLoopUV *luv;
+		int totlayer;
+		BMIter liter;
+
+		BMO_ITER (f, &siter, bm, &dupeop, "newout", 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++) {
+					luv = CustomData_bmesh_get_n(&bm->ldata, l->head.data, CD_MLOOPUV, i);
+					if (mirroru)
+						luv->uv[0] = 1.0f - luv->uv[0];
+					if (mirrorv)
+						luv->uv[1] = 1.0f - luv->uv[1];
+				}
+			}
+		}
+	}
+
+	BMO_op_exec(bm, &weldop);
+	
+	BMO_op_finish(bm, &weldop);
+	BMO_op_finish(bm, &dupeop);
+
+	BMO_slot_buffer_from_enabled_flag(bm, op, "newout", BM_ALL, 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
new file mode 100644
index 0000000..6fd3c8c
--- /dev/null
+++ b/source/blender/bmesh/operators/bmo_primitive.c
@@ -0,0 +1,743 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/operators/bmo_primitive.c
+ *  \ingroup bmesh
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_math.h"
+
+#include "bmesh.h"
+#include "intern/bmesh_private.h"
+
+#include "intern/bmesh_operators_private.h" /* own include */
+
+/* ************************ primitives ******************* */
+
+static float icovert[12][3] = {
+	{0.0f,0.0f,-200.0f},
+	{144.72f, -105.144f,-89.443f},
+	{-55.277f, -170.128,-89.443f},
+	{-178.885f,0.0f,-89.443f},
+	{-55.277f,170.128f,-89.443f},
+	{144.72f,105.144f,-89.443f},
+	{55.277f,-170.128f,89.443f},
+	{-144.72f,-105.144f,89.443f},
+	{-144.72f,105.144f,89.443f},
+	{55.277f,170.128f,89.443f},
+	{178.885f,0.0f,89.443f},
+	{0.0f,0.0f,200.0f}
+};
+
+static short icoface[20][3] = {
+	{0,1,2},
+	{1,0,5},
+	{0,2,3},
+	{0,3,4},
+	{0,4,5},
+	{1,5,10},
+	{2,1,6},
+	{3,2,7},
+	{4,3,8},
+	{5,4,9},
+	{1,10,6},
+	{2,6,7},
+	{3,7,8},
+	{4,8,9},
+	{5,9,10},
+	{6,10,11},
+	{7,6,11},
+	{8,7,11},
+	{9,8,11},
+	{10,9,11}
+};
+
+/* HACK: these can also be found in cmoview.tga.c, but are here so that they can be found by linker
+ * this hack is only used so that scons & mingw + split-sources hack works
+ * ------------------------------- start copied code */
+/* these are not the monkeys you are looking for */
+static int monkeyo = 4;
+static int monkeynv = 271;
+static int monkeynf = 250;
+static signed char monkeyv[271][3] = {
+	{-71,21,98},{-63,12,88},{-57,7,74},{-82,-3,79},{-82,4,92},
+	{-82,17,100},{-92,21,102},{-101,12,95},{-107,7,83},
+	{-117,31,84},{-109,31,95},{-96,31,102},{-92,42,102},
+	{-101,50,95},{-107,56,83},{-82,66,79},{-82,58,92},
+	{-82,46,100},{-71,42,98},{-63,50,88},{-57,56,74},
+	{-47,31,72},{-55,31,86},{-67,31,97},{-66,31,99},
+	{-70,43,100},{-82,48,103},{-93,43,105},{-98,31,105},
+	{-93,20,105},{-82,31,106},{-82,15,103},{-70,20,100},
+	{-127,55,95},{-127,45,105},{-127,-87,94},{-127,-41,100},
+	{-127,-24,102},{-127,-99,92},{-127,52,77},{-127,73,73},
+	{-127,115,-70},{-127,72,-109},{-127,9,-106},{-127,-49,-45},
+	{-101,-24,72},{-87,-56,73},{-82,-89,73},{-80,-114,68},
+	{-85,-121,67},{-104,-124,71},{-127,-126,74},{-71,-18,68},
+	{-46,-5,69},{-21,19,57},{-17,55,76},{-36,62,80},
+	{-64,77,88},{-86,97,94},{-107,92,97},{-119,63,96},
+	{-106,53,99},{-111,39,98},{-101,12,95},{-79,2,90},
+	{-64,8,86},{-47,24,83},{-45,38,83},{-50,48,85},
+	{-72,56,92},{-95,60,97},{-127,-98,94},{-113,-92,94},
+	{-112,-107,91},{-119,-113,89},{-127,-114,88},{-127,-25,96},
+	{-127,-18,95},{-114,-19,95},{-111,-29,96},{-116,-37,95},
+	{-76,-6,86},{-48,7,80},{-34,26,77},{-32,48,84},
+	{-39,53,93},{-71,70,102},{-87,82,107},{-101,79,109},
+	{-114,55,108},{-111,-13,104},{-100,-57,91},{-95,-90,88},
+	{-93,-105,85},{-97,-117,81},{-106,-119,81},{-127,-121,82},
+	{-127,6,93},{-127,27,98},{-85,61,95},{-106,18,96},
+	{-110,27,97},{-112,-88,94},{-117,-57,96},{-127,-57,96},
+	{-127,-42,95},{-115,-35,100},{-110,-29,102},{-113,-17,100},
+	{-122,-16,100},{-127,-26,106},{-121,-19,104},{-115,-20,104},
+	{-113,-29,106},{-117,-32,103},{-127,-37,103},{-94,-40,71},
+	{-106,-31,91},{-104,-40,91},{-97,-32,71},{-127,-112,88},
+	{-121,-111,88},{-115,-105,91},{-115,-95,93},{-127,-100,84},
+	{-115,-96,85},{-115,-104,82},{-121,-109,81},{-127,-110,81},
+	{-105,28,100},{-103,20,99},{-84,55,97},{-92,54,99},
+	{-73,51,99},{-55,45,89},{-52,37,88},{-53,25,87},
+	{-66,13,92},{-79,8,95},{-98,14,100},{-104,38,100},
+	{-100,48,100},{-97,46,97},{-102,38,97},{-96,16,97},
+	{-79,11,93},{-68,15,90},{-57,27,86},{-56,36,86},
+	{-59,43,87},{-74,50,96},{-91,51,98},{-84,52,96},
+	{-101,22,96},{-102,29,96},{-113,59,78},{-102,85,79},
+	{-84,88,76},{-65,71,71},{-40,58,63},{-25,52,59},
+	{-28,21,48},{-50,0,53},{-71,-12,60},{-127,115,37},
+	{-127,126,-10},{-127,-25,-86},{-127,-59,24},{-127,-125,59},
+	{-127,-103,44},{-127,-73,41},{-127,-62,36},{-18,30,7},
+	{-17,41,-6},{-28,34,-56},{-68,56,-90},{-33,-6,9},
+	{-51,-16,-21},{-45,-1,-55},{-84,7,-85},{-97,-45,52},
+	{-104,-53,33},{-90,-91,49},{-95,-64,50},{-85,-117,51},
+	{-109,-97,47},{-111,-69,46},{-106,-121,56},{-99,-36,55},
+	{-100,-29,60},{-101,-22,64},{-100,-50,21},{-89,-40,-34},
+	{-83,-19,-69},{-69,111,-49},{-69,119,-9},{-69,109,30},
+	{-68,67,55},{-34,52,43},{-46,58,36},{-45,90,7},
+	{-25,72,16},{-25,79,-15},{-45,96,-25},{-45,87,-57},
+	{-25,69,-46},{-48,42,-75},{-65,3,-70},{-22,42,-26},
+	{-75,-22,19},{-72,-25,-27},{-13,52,-30},{-28,-18,-16},
+	{6,-13,-42},{37,7,-55},{46,41,-54},{31,65,-54},
+	{4,61,-40},{3,53,-37},{25,56,-50},{35,37,-52},
+	{28,10,-52},{5,-5,-39},{-21,-9,-17},{-9,46,-28},
+	{-6,39,-37},{-14,-3,-27},{6,0,-47},{25,12,-57},
+	{31,32,-57},{23,46,-56},{4,44,-46},{-19,37,-27},
+	{-20,22,-35},{-30,12,-35},{-22,11,-35},{-19,2,-35},
+	{-23,-2,-35},{-34,0,-9},{-35,-3,-22},{-35,5,-24},
+	{-25,26,-27},{-13,31,-34},{-13,30,-41},{-23,-2,-41},
+	{-18,2,-41},{-21,10,-41},{-29,12,-41},{-19,22,-41},
+	{6,42,-53},{25,44,-62},{34,31,-63},{28,11,-62},
+	{7,0,-54},{-14,-2,-34},{-5,37,-44},{-13,14,-42},
+	{-7,8,-43},{1,16,-47},{-4,22,-45},{3,30,-48},
+	{8,24,-49},{15,27,-50},{12,35,-50},{4,56,-62},
+	{33,60,-70},{48,38,-64},{41,7,-68},{6,-11,-63},
+	{-26,-16,-42},{-17,49,-49},
+};
+
+static signed char monkeyf[250][4] = {
+	{27,4,5,26}, {25,4,5,24}, {3,6,5,4}, {1,6,5,2}, {5,6,7,4},
+	{3,6,7,2}, {5,8,7,6}, {3,8,7,4}, {7,8,9,6},
+	{5,8,9,4}, {7,10,9,8}, {5,10,9,6}, {9,10,11,8},
+	{7,10,11,6}, {9,12,11,10}, {7,12,11,8}, {11,6,13,12},
+	{5,4,13,12}, {3,-2,13,12}, {-3,-4,13,12}, {-5,-10,13,12},
+	{-11,-12,14,12}, {-13,-18,14,13}, {-19,4,5,13}, {10,12,4,4},
+	{10,11,9,9}, {8,7,9,9}, {7,5,6,6}, {6,3,4,4},
+	{5,1,2,2}, {4,-1,0,0}, {3,-3,-2,-2}, {22,67,68,23},
+	{20,65,66,21}, {18,63,64,19}, {16,61,62,17}, {14,59,60,15},
+	{12,19,48,57}, {18,19,48,47}, {18,19,48,47}, {18,19,48,47},
+	{18,19,48,47}, {18,19,48,47}, {18,19,48,47}, {18,19,48,47},
+	{18,19,48,47}, {18,-9,-8,47}, {18,27,45,46}, {26,55,43,44},
+	{24,41,42,54}, {22,39,40,23}, {20,37,38,21}, {18,35,36,19},
+	{16,33,34,17}, {14,31,32,15}, {12,39,30,13}, {11,48,45,38},
+	{8,36,-19,9}, {8,-20,44,47}, {42,45,46,43}, {18,19,40,39},
+	{16,17,38,37}, {14,15,36,35}, {32,44,43,33}, {12,33,32,42},
+	{19,44,43,42}, {40,41,42,-27}, {8,9,39,-28}, {15,43,42,16},
+	{13,43,42,14}, {11,43,42,12}, {9,-30,42,10}, {37,12,38,-32},
+	{-33,37,45,46}, {-33,40,41,39}, {38,40,41,37}, {36,40,41,35},
+	{34,40,41,33}, {36,39,38,37}, {35,40,39,38}, {1,2,14,21},
+	{1,2,40,13}, {1,2,40,39}, {1,24,12,39}, {-34,36,38,11},
+	{35,38,36,37}, {-37,8,35,37}, {-11,-12,-45,40}, {-11,-12,39,38},
+	{-11,-12,37,36}, {-11,-12,35,34}, {33,34,40,41}, {33,34,38,39},
+	{33,34,36,37}, {33,-52,34,35}, {33,37,36,34}, {33,35,34,34},
+	{8,7,37,36}, {-32,7,35,46}, {-34,-33,45,46}, {4,-33,43,34},
+	{-34,-33,41,42}, {-34,-33,39,40}, {-34,-33,37,38}, {-34,-33,35,36},
+	{-34,-33,33,34}, {-34,-33,31,32}, {-34,-4,28,30}, {-5,-34,28,27},
+	{-35,-44,36,27}, {26,35,36,45}, {24,25,44,45}, {25,23,44,42},
+	{25,24,41,40}, {25,24,39,38}, {25,24,37,36}, {25,24,35,34},
+	{25,24,33,32}, {25,24,31,30}, {15,24,29,38}, {25,24,27,26},
+	{23,12,37,26}, {11,12,35,36}, {-86,-59,36,-80}, {-60,-61,36,35},
+	{-62,-63,36,35}, {-64,-65,36,35}, {-66,-67,36,35}, {-68,-69,36,35},
+	{-70,-71,36,35}, {-72,-73,36,35}, {-74,-75,36,35}, {42,43,53,58},
+	{40,41,57,56}, {38,39,55,57}, {-81,-80,37,56}, {-83,-82,55,52},
+	{-85,-84,51,49}, {-87,-86,48,49}, {47,50,51,48}, {46,48,51,49},
+	{43,46,49,44}, {-92,-91,45,42}, {-23,49,50,-20}, {-94,40,48,-24},
+	{-96,-22,48,49}, {-97,48,21,-90}, {-100,36,50,23}, {22,49,48,-100},
+	{-101,47,46,22}, {21,45,35,25}, {33,34,44,41}, {13,14,28,24},
+	{-107,26,30,-106}, {14,46,45,15}, {14,44,43,-110}, {-111,42,23,-110},
+	{6,7,45,46}, {45,44,47,46}, {45,46,47,48}, {47,46,49,48},
+	{17,49,47,48}, {17,36,46,48}, {35,36,44,45}, {35,36,40,43},
+	{35,36,38,39}, {-4,-3,37,35}, {-123,34,33,1}, {-9,-8,-7,-6},
+	{-10,-7,32,-125}, {-127,-11,-126,-126}, {-7,-6,5,31}, {4,5,33,30},
+	{4,39,33,32}, {4,35,32,38}, {20,21,39,38}, {4,37,38,5},
+	{-11,-10,36,3}, {-11,15,14,35}, {13,16,34,34}, {-13,14,13,13},
+	{-3,1,30,29}, {-3,28,29,1}, {-2,31,28,-1}, {12,13,27,30},
+	{-2,26,12,12}, {35,29,42,36}, {34,35,36,33}, {32,35,36,31},
+	{30,35,36,29}, {28,35,36,27}, {26,35,36,25}, {34,39,38,35},
+	{32,39,38,33}, {30,39,38,31}, {28,39,38,29}, {26,39,38,27},
+	{25,31,32,38}, {-18,-17,45,44}, {-18,17,28,44}, {-24,-20,42,-23},
+	{11,35,27,14}, {25,28,39,41}, {37,41,40,38}, {34,40,36,35},
+	{32,40,39,33}, {30,39,31,40}, {21,29,39,22}, {-31,37,28,4},
+	{-32,33,35,36}, {32,33,34,34}, {18,35,36,48}, {34,25,40,35},
+	{24,25,38,39}, {24,25,36,37}, {24,25,34,35}, {24,25,32,33},
+	{24,13,41,31}, {17,11,41,35}, {15,16,34,35}, {13,14,34,35},
+	{11,12,34,35}, {9,10,34,35}, {7,8,34,35}, {26,25,37,36},
+	{35,36,37,38}, {37,36,39,38}, {37,38,39,40}, {25,31,36,39},
+	{18,34,35,30}, {17,22,30,33}, {19,29,21,20}, {16,26,29,17},
+	{24,29,28,25}, {22,31,28,23}, {20,31,30,21}, {18,31,30,19},
+	{16,30,17,17}, {-21,-22,35,34}, {-21,-22,33,32}, {-21,-22,31,30},
+	{-21,-22,29,28}, {-21,-22,27,26}, {-28,-22,25,31}, {24,28,29,30},
+	{23,24,26,27}, {23,24,25,25}, {-69,-35,-32,27}, {-70,26,25,-66},
+	{-68,-67,24,-33},
+};
+
+#define VERT_MARK	1
+
+#define EDGE_ORIG	1
+#define EDGE_MARK	2
+
+#define FACE_MARK	1
+#define FACE_NEW	2
+
+void bmo_create_grid_exec(BMesh *bm, BMOperator *op)
+{
+	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;
+
+	BMO_slot_mat4_get(op, "mat", mat);
+
+	/* one segment first: the X axis */
+	phi = 1.0f;
+	phid = 2.0f / ((float)tot - 1);
+	for (a = 0; a < tot; a++) {
+		vec[0] = dia * phi;
+		vec[1] = -dia;
+		vec[2] = 0.0f;
+		mul_m4_v3(mat, vec);
+
+		eve = BM_vert_create(bm, vec, NULL);
+		BMO_elem_flag_enable(bm, eve, VERT_MARK);
+
+		if (a != 0) {
+			e = BM_edge_create(bm, preveve, eve, NULL, TRUE);
+			BMO_elem_flag_enable(bm, e, EDGE_ORIG);
+		}
+
+		preveve = eve;
+		phi -= phid;
+	}
+
+	/* extrude and translate */
+	vec[0] = vec[2] = 0.0f;
+	vec[1] = dia * phid;
+	mul_mat3_m4_v3(mat, vec);
+
+	for (a = 0; a < seg - 1; a++) {
+		if (a) {
+			BMO_op_initf(bm, &bmop, "extrude_edge_only edges=%s", &prevop, "geomout");
+			BMO_op_exec(bm, &bmop);
+			BMO_op_finish(bm, &prevop);
+
+			BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_VERT, VERT_MARK);
+		}
+		else {
+			BMO_op_initf(bm, &bmop, "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_op_callf(bm, "translate vec=%v verts=%s", vec, &bmop, "geomout");
+		prevop = bmop;
+	}
+
+	if (a)
+		BMO_op_finish(bm, &bmop);
+
+	BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
+}
+
+void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op)
+{
+	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");
+
+	BMO_slot_mat4_get(op, "mat", mat);
+
+	phid = 2.0f * (float)M_PI / tot;
+	/* phi = 0.25f * (float)M_PI; */ /* UNUSED */
+
+	/* one segment first */
+	phi = 0;
+	phid /= 2;
+	for (a = 0; a <= tot; a++) {
+		/* Going in this direction, then edge extruding, makes normals face outward */
+		vec[0] = -dia * sinf(phi);
+		vec[1] = 0.0;
+		vec[2] = dia * cosf(phi);
+		eve = BM_vert_create(bm, vec, NULL);
+		BMO_elem_flag_enable(bm, eve, VERT_MARK);
+
+		if (a != 0) {
+			e = BM_edge_create(bm, preveve, eve, NULL, FALSE);
+			BMO_elem_flag_enable(bm, e, EDGE_ORIG);
+		}
+
+		phi += phid;
+		preveve = eve;
+	}
+
+	/* extrude and rotate; negative phi to make normals face outward */
+	phi = -M_PI / seg;
+	q[0] = cosf(phi);
+	q[3] = sinf(phi);
+	q[1] = q[2] = 0.0f;
+	quat_to_mat3(cmat, q);
+
+	for (a = 0; a < seg; a++) {
+		if (a) {
+			BMO_op_initf(bm, &bmop, "extrude_edge_only edges=%s", &prevop, "geomout");
+			BMO_op_exec(bm, &bmop);
+			BMO_op_finish(bm, &prevop);
+		}
+		else {
+			BMO_op_initf(bm, &bmop, "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_op_callf(bm, "rotate cent=%v mat=%m3 verts=%s", vec, cmat, &bmop, "geomout");
+		
+		prevop = bmop;
+	}
+
+	if (a)
+		BMO_op_finish(bm, &bmop);
+
+	{
+		float len, len2, vec2[3];
+
+		len = 2 * dia * sinf(phid / 2.0f);
+
+		/* length of one segment in shortest parallen */
+		vec[0] = dia * sinf(phid);
+		vec[1] = 0.0f;
+		vec[2] = dia * cosf(phid);
+
+		mul_v3_m3v3(vec2, cmat, vec);
+		len2 = len_v3v3(vec, vec2);
+
+		/* use shortest segment length divided by 3 as merge threshold */
+		BMO_op_callf(bm, "removedoubles verts=%fv dist=%f", VERT_MARK, MIN2(len, len2) / 3.0f);
+	}
+
+	/* and now do imat */
+	BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
+		if (BMO_elem_flag_test(bm, eve, VERT_MARK)) {
+			mul_m4_v3(mat, eve->co);
+		}
+	}
+
+	BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
+}
+
+void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op)
+{
+	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");
+
+	BMO_slot_mat4_get(op, "mat", 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);
+
+		BMO_elem_flag_enable(bm, eva[a], VERT_MARK);
+	}
+
+	for (a = 0; a < 20; a++) {
+		BMFace *eftemp;
+		BMVert *v1, *v2, *v3;
+
+		v1 = eva[icoface[a][0]];
+		v2 = eva[icoface[a][1]];
+		v3 = eva[icoface[a][2]];
+
+		eftemp = BM_face_create_quad_tri(bm, v1, v2, v3, NULL, NULL, FALSE);
+		
+		BM_ITER_ELEM (l, &liter, eftemp, BM_LOOPS_OF_FACE) {
+			BMO_elem_flag_enable(bm, l->e, EDGE_MARK);
+		}
+
+		BMO_elem_flag_enable(bm, eftemp, FACE_MARK);
+	}
+
+	dia *= 200.0f;
+
+	if (subdiv > 1) {
+		BMOperator bmop;
+
+		BMO_op_initf(bm, &bmop,
+		             "esubd edges=%fe "
+		             "smooth=%f "
+		             "numcuts=%i "
+		             "use_gridfill=%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_op_finish(bm, &bmop);
+	}
+
+	/* must transform after because of sphere subdivision */
+	BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
+		if (BMO_elem_flag_test(bm, v, VERT_MARK)) {
+			mul_m4_v3(mat, v->co);
+		}
+	}
+
+	BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
+}
+
+void bmo_create_monkey_exec(BMesh *bm, BMOperator *op)
+{
+	BMVert *eve;
+	BMVert **tv = MEM_mallocN(sizeof(*tv) * monkeynv * 2, "tv");
+	float mat[4][4];
+	int i;
+
+	BMO_slot_mat4_get(op, "mat", 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);
+		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);
+
+		BMO_elem_flag_enable(bm, tv[monkeynv + i], VERT_MARK);
+
+		mul_m4_v3(mat, tv[i]->co);
+	}
+
+	for (i = 0; i < monkeynf; i++) {
+		BM_face_create_quad_tri(bm,
+		                        tv[monkeyf[i][0] + i - monkeyo],
+		                        tv[monkeyf[i][1] + i - monkeyo],
+		                        tv[monkeyf[i][2] + i - monkeyo],
+		                        (monkeyf[i][3] != monkeyf[i][2]) ? tv[monkeyf[i][3] + i - monkeyo] : NULL,
+		                        NULL, FALSE);
+
+		BM_face_create_quad_tri(bm,
+		                        tv[monkeynv + monkeyf[i][2] + i - monkeyo],
+		                        tv[monkeynv + monkeyf[i][1] + i - monkeyo],
+		                        tv[monkeynv + monkeyf[i][0] + i - monkeyo],
+		                        (monkeyf[i][3] != monkeyf[i][2]) ? tv[monkeynv + monkeyf[i][3] + i - monkeyo]: NULL,
+		                        NULL, FALSE);
+	}
+
+	MEM_freeN(tv);
+
+	BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
+}
+
+
+void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
+{
+	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);
+
+	phid = 2.0f * (float)M_PI / segs;
+	phi = 0;
+
+	if (cap_ends) {
+		vec[0] = vec[1] = 0.0f;
+		vec[2] = 0.0;
+		mul_m4_v3(mat, vec);
+		
+		cent1 = BM_vert_create(bm, vec, NULL);
+	}
+
+	for (a = 0; a < segs; a++, phi += phid) {
+		/* Going this way ends up with normal(s) upward */
+		vec[0] = -dia * sinf(phi);
+		vec[1] = dia * cosf(phi);
+		vec[2] = 0.0f;
+		mul_m4_v3(mat, vec);
+		v1 = BM_vert_create(bm, vec, NULL);
+
+		BMO_elem_flag_enable(bm, v1, VERT_MARK);
+		
+		if (lastv1)
+			BM_edge_create(bm, v1, lastv1, NULL, FALSE);
+		
+		if (a && cap_ends) {
+			BMFace *f;
+			
+			f = BM_face_create_quad_tri(bm, cent1, lastv1, v1, NULL, NULL, FALSE);
+			BMO_elem_flag_enable(bm, f, FACE_NEW);
+		}
+		
+		if (!firstv1)
+			firstv1 = v1;
+
+		lastv1 = v1;
+	}
+
+	if (!a)
+		return;
+
+	BM_edge_create(bm, lastv1, firstv1, NULL, FALSE);
+
+	if (cap_ends) {
+		BMFace *f;
+		
+		f = BM_face_create_quad_tri(bm, cent1, v1, firstv1, NULL, NULL, FALSE);
+		BMO_elem_flag_enable(bm, f, FACE_NEW);
+	}
+	
+	if (!cap_tris) {
+		BMO_op_callf(bm, "dissolve_faces faces=%ff", FACE_NEW);
+	}
+	
+	BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", 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");
+	int a;
+	
+	if (!segs)
+		return;
+	
+	BMO_slot_mat4_get(op, "mat", mat);
+
+	phid = 2.0f * (float)M_PI / segs;
+	phi = 0;
+
+	depth *= 0.5f;
+	if (cap_ends) {
+		vec[0] = vec[1] = 0.0f;
+		vec[2] = -depth;
+		mul_m4_v3(mat, vec);
+		
+		cent1 = BM_vert_create(bm, vec, NULL);
+
+		vec[0] = vec[1] = 0.0f;
+		vec[2] = depth;
+		mul_m4_v3(mat, vec);
+		
+		cent2 = BM_vert_create(bm, vec, NULL);
+
+		BMO_elem_flag_enable(bm, cent1, VERT_MARK);
+		BMO_elem_flag_enable(bm, cent2, VERT_MARK);
+	}
+
+	for (a = 0; a < segs; a++, phi += phid) {
+		vec[0] = dia1 * sinf(phi);
+		vec[1] = dia1 * cosf(phi);
+		vec[2] = -depth;
+		mul_m4_v3(mat, vec);
+		v1 = BM_vert_create(bm, vec, NULL);
+
+		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);
+
+		BMO_elem_flag_enable(bm, v1, VERT_MARK);
+		BMO_elem_flag_enable(bm, v2, VERT_MARK);
+
+		if (a) {
+			if (cap_ends) {
+				BMFace *f;
+				
+				f = BM_face_create_quad_tri(bm, cent1, lastv1, v1, NULL, NULL, FALSE);
+				BMO_elem_flag_enable(bm, f, FACE_NEW);
+				f = BM_face_create_quad_tri(bm, cent2, v2, lastv2, NULL, NULL, FALSE);
+				BMO_elem_flag_enable(bm, f, FACE_NEW);
+			}
+			BM_face_create_quad_tri(bm, lastv1, lastv2, v2, v1, NULL, FALSE);
+		}
+		else {
+			firstv1 = v1;
+			firstv2 = v2;
+		}
+
+		lastv1 = v1;
+		lastv2 = v2;
+	}
+
+	if (!a)
+		return;
+
+	if (cap_ends) {
+		BMFace *f;
+		
+		f = BM_face_create_quad_tri(bm, cent1, v1, firstv1, NULL, NULL, FALSE);
+		BMO_elem_flag_enable(bm, f, FACE_NEW);
+		f = BM_face_create_quad_tri(bm, cent2, firstv2, v2, NULL, NULL, FALSE);
+		BMO_elem_flag_enable(bm, f, FACE_NEW);
+	}
+	
+	if (!cap_tris) {
+		BMO_op_callf(bm, "dissolve_faces faces=%ff", FACE_NEW);
+	}
+	
+	BM_face_create_quad_tri(bm, v1, v2, firstv2, firstv1, NULL, FALSE);
+
+	BMO_op_callf(bm, "removedoubles verts=%fv dist=%f", VERT_MARK, 0.000001);
+	BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", 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;
+
+	BMO_slot_mat4_get(op, "mat", mat);
+
+	if (!off) off = 0.5f;
+
+	vec[0] = -off;
+	vec[1] = -off;
+	vec[2] = -off;
+	mul_m4_v3(mat, vec);
+	v1 = BM_vert_create(bm, vec, NULL);
+	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);
+	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);
+	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);
+	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);
+	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);
+	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);
+	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);
+	BMO_elem_flag_enable(bm, v8, VERT_MARK);
+
+	/* the four sides */
+	BM_face_create_quad_tri(bm, v5, v6, v2, v1, NULL, FALSE);
+	BM_face_create_quad_tri(bm, v6, v7, v3, v2, NULL, FALSE);
+	BM_face_create_quad_tri(bm, v7, v8, v4, v3, NULL, FALSE);
+	BM_face_create_quad_tri(bm, v8, v5, v1, v4, NULL, FALSE);
+	
+	/* top/bottom */
+	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);
+}
diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c
new file mode 100644
index 0000000..149f253
--- /dev/null
+++ b/source/blender/bmesh/operators/bmo_removedoubles.c
@@ -0,0 +1,605 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/operators/bmo_removedoubles.c
+ *  \ingroup bmesh
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_math.h"
+#include "BLI_array.h"
+
+#include "BKE_customdata.h"
+
+#include "bmesh.h"
+#include "intern/bmesh_private.h"
+
+#include "intern/bmesh_operators_private.h" /* own include */
+
+static void remdoubles_splitface(BMFace *f, BMesh *bm, BMOperator *op)
+{
+	BMIter liter;
+	BMLoop *l;
+	BMVert *v2, *doub;
+	int split = FALSE;
+
+	BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+		v2 = BMO_slot_map_ptr_get(bm, op, "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)) &&
+		    (v2 != l->prev->v) &&
+		    (v2 != l->next->v))
+		{
+			doub = l->v;
+			split = TRUE;
+			break;
+		}
+	}
+
+	if (split && doub != v2) {
+		BMLoop *nl;
+		BMFace *f2 = BM_face_split(bm, f, doub, v2, &nl, NULL, FALSE);
+
+		remdoubles_splitface(f, bm, op);
+		remdoubles_splitface(f2, bm, op);
+	}
+}
+
+#define ELE_DEL		1
+#define EDGE_COL	2
+#define FACE_MARK	2
+
+#if 0
+int remdoubles_face_overlaps(BMesh *bm, BMVert **varr,
+                             int len, BMFace *exclude,
+                             BMFace **overlapface)
+{
+	BMIter vertfaces;
+	BMFace *f;
+	int i, amount;
+
+	if (overlapface) *overlapface = NULL;
+
+	for (i = 0; i < len; i++) {
+		f = BM_iter_new(&vertfaces, bm, BM_FACES_OF_VERT, varr[i]);
+		while (f) {
+			amount = BM_verts_in_face(bm, f, varr, len);
+			if (amount >= len) {
+				if (overlapface) *overlapface = f;
+				return TRUE;
+			}
+			f = BM_iter_step(&vertfaces);
+		}
+	}
+	return FALSE;
+}
+#endif
+
+void bmo_weldverts_exec(BMesh *bm, BMOperator *op)
+{
+	BMIter iter, liter;
+	BMVert *v, *v2;
+	BMEdge *e, *e2, **edges = NULL;
+	BLI_array_declare(edges);
+	BMLoop *l, *l2, **loops = NULL;
+	BLI_array_declare(loops);
+	BMFace *f, *f2;
+	int a, b;
+
+	/* 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))) {
+			BMO_elem_flag_enable(bm, v, ELE_DEL);
+
+			/* merge the vertex flags, else we get randomly selected/unselected verts */
+			BM_elem_flag_merge(v, v2);
+		}
+	}
+
+	/* 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);
+	}
+
+	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);
+			
+			if (!v) v = e->v1;
+			if (!v2) v2 = e->v2;
+
+			if (v == v2) {
+				BMO_elem_flag_enable(bm, e, EDGE_COL);
+			}
+			else if (!BM_edge_exists(v, v2)) {
+				BM_edge_create(bm, v, v2, e, TRUE);
+			}
+
+			BMO_elem_flag_enable(bm, e, ELE_DEL);
+		}
+	}
+
+	/* BMESH_TODO, stop abusing face index here */
+	BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+		BM_elem_index_set(f, 0); /* set_dirty! */
+		BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+			if (BMO_elem_flag_test(bm, l->v, ELE_DEL)) {
+				BMO_elem_flag_enable(bm, f, FACE_MARK|ELE_DEL);
+			}
+			if (BMO_elem_flag_test(bm, l->e, EDGE_COL)) {
+				BM_elem_index_set(f, BM_elem_index_get(f) + 1); /* set_dirty! */
+			}
+		}
+	}
+	bm->elem_index_dirty |= BM_FACE;
+
+	/* faces get "modified" by creating new faces here, then at the
+	 * end the old faces are deleted */
+	BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+		if (!BMO_elem_flag_test(bm, f, FACE_MARK))
+			continue;
+
+		if (f->len - BM_elem_index_get(f) < 3) {
+			BMO_elem_flag_enable(bm, f, ELE_DEL);
+			continue;
+		}
+
+		BLI_array_empty(edges);
+		BLI_array_empty(loops);
+		a = 0;
+		BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+			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);
+			}
+			if (BMO_elem_flag_test(bm, v2, ELE_DEL)) {
+				v2 = BMO_slot_map_ptr_get(bm, op, "targetmap", v2);
+			}
+			
+			e2 = v != v2 ? BM_edge_exists(v, v2) : NULL;
+			if (e2) {
+				for (b = 0; b < a; b++) {
+					if (edges[b] == e2) {
+						break;
+					}
+				}
+				if (b != a) {
+					continue;
+				}
+
+				BLI_array_growone(edges);
+				BLI_array_growone(loops);
+
+				edges[a] = e2;
+				loops[a] = l;
+
+				a++;
+			}
+		}
+		
+		if (BLI_array_count(loops) < 3)
+			continue;
+		v = loops[0]->v;
+		v2 = loops[1]->v;
+
+		if (BMO_elem_flag_test(bm, v, ELE_DEL)) {
+			v = BMO_slot_map_ptr_get(bm, op, "targetmap", v);
+		}
+		if (BMO_elem_flag_test(bm, v2, ELE_DEL)) {
+			v2 = BMO_slot_map_ptr_get(bm, op, "targetmap", v2);
+		}
+		
+		f2 = BM_face_create_ngon(bm, v, v2, edges, a, TRUE);
+		if (f2 && (f2 != f)) {
+			BM_elem_attrs_copy(bm, bm, f, f2);
+
+			a = 0;
+			BM_ITER_ELEM (l, &liter, f2, BM_LOOPS_OF_FACE) {
+				l2 = loops[a];
+				BM_elem_attrs_copy(bm, bm, l2, l);
+
+				a++;
+			}
+		}
+	}
+
+	BMO_op_callf(bm, "del geom=%fvef context=%i", ELE_DEL, DEL_ONLYTAGGED);
+
+	BLI_array_free(edges);
+	BLI_array_free(loops);
+}
+
+static int vergaverco(const void *e1, const void *e2)
+{
+	const BMVert *v1 = *(void **)e1, *v2 = *(void **)e2;
+	float x1 = v1->co[0] + v1->co[1] + v1->co[2];
+	float x2 = v2->co[0] + v2->co[1] + v2->co[2];
+
+	if      (x1 > x2) return  1;
+	else if (x1 < x2) return -1;
+	else return 0;
+}
+
+#define VERT_TESTED	1
+#define VERT_DOUBLE	2
+#define VERT_TARGET	4
+#define VERT_KEEP	8
+#define VERT_MARK	16
+#define VERT_IN		32
+
+#define EDGE_MARK	1
+
+void bmo_pointmerge_facedata_exec(BMesh *bm, BMOperator *op)
+{
+	BMOIter siter;
+	BMIter iter;
+	BMVert *v, *snapv;
+	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);
+
+	if (!tot)
+		return;
+
+	fac = 1.0f / tot;
+	BM_ITER_ELEM (l, &iter, snapv, BM_LOOPS_OF_VERT) {
+		if (!firstl) {
+			firstl = l;
+		}
+		
+		for (i = 0; i < bm->ldata.totlayer; i++) {
+			if (CustomData_layer_has_math(&bm->ldata, i)) {
+				int type = bm->ldata.layers[i].type;
+				void *e1, *e2;
+
+				e1 = CustomData_bmesh_get_layer_n(&bm->ldata, firstl->head.data, i);
+				e2 = CustomData_bmesh_get_layer_n(&bm->ldata, l->head.data, i);
+				
+				CustomData_data_multiply(type, e2, fac);
+
+				if (l != firstl)
+					CustomData_data_add(type, e1, e2);
+			}
+		}
+	}
+
+	BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
+		BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) {
+			if (l == firstl) {
+				continue;
+			}
+
+			CustomData_bmesh_copy_data(&bm->ldata, &bm->ldata, firstl->head.data, &l->head.data);
+		}
+	}
+}
+
+void bmo_vert_average_facedata_exec(BMesh *bm, BMOperator *op)
+{
+	BMOIter siter;
+	BMIter iter;
+	BMVert *v;
+	BMLoop *l /* , *firstl = NULL */;
+	CDBlockBytes min, max;
+	void *block;
+	int i, type;
+
+	for (i = 0; i < bm->ldata.totlayer; i++) {
+		if (!CustomData_layer_has_math(&bm->ldata, i))
+			continue;
+		
+		type = bm->ldata.layers[i].type;
+		CustomData_data_initminmax(type, &min, &max);
+
+		BMO_ITER (v, &siter, bm, op, "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);
+			}
+		}
+
+		CustomData_data_multiply(type, &min, 0.5f);
+		CustomData_data_multiply(type, &max, 0.5f);
+		CustomData_data_add(type, &min, &max);
+
+		BMO_ITER (v, &siter, bm, op, "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);
+			}
+		}
+	}
+}
+
+void bmo_pointmerge_exec(BMesh *bm, BMOperator *op)
+{
+	BMOperator weldop;
+	BMOIter siter;
+	BMVert *v, *snapv = NULL;
+	float vec[3];
+	
+	BMO_slot_vec_get(op, "mergeco", vec);
+
+	//BMO_op_callf(bm, "collapse_uvs edges=%s", op, "edges");
+	BMO_op_init(bm, &weldop, "weldverts");
+	
+	BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
+		if (!snapv) {
+			snapv = v;
+			copy_v3_v3(snapv->co, vec);
+		}
+		else {
+			BMO_slot_map_ptr_insert(bm, &weldop, "targetmap", v, snapv);
+		}
+	}
+
+	BMO_op_exec(bm, &weldop);
+	BMO_op_finish(bm, &weldop);
+}
+
+void bmo_collapse_exec(BMesh *bm, BMOperator *op)
+{
+	BMOperator weldop;
+	BMWalker walker;
+	BMIter iter;
+	BMEdge *e, **edges = NULL;
+	BLI_array_declare(edges);
+	float min[3], max[3];
+	int i, tot;
+	
+	BMO_op_callf(bm, "collapse_uvs edges=%s", op, "edges");
+	BMO_op_init(bm, &weldop, "weldverts");
+
+	BMO_slot_buffer_flag_enable(bm, op, "edges", BM_EDGE, EDGE_MARK);
+
+	BMW_init(&walker, bm, BMW_SHELL,
+	         BMW_MASK_NOP, EDGE_MARK, BMW_MASK_NOP,
+	         BMW_FLAG_NOP, /* no need to use BMW_FLAG_TEST_HIDDEN, already marked data */
+	         BMW_NIL_LAY);
+
+	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+		if (!BMO_elem_flag_test(bm, e, EDGE_MARK))
+			continue;
+
+		e = BMW_begin(&walker, e->v1);
+		BLI_array_empty(edges);
+
+		INIT_MINMAX(min, max);
+		for (tot = 0; e; tot++, e = BMW_step(&walker)) {
+			BLI_array_growone(edges);
+			edges[tot] = e;
+
+			DO_MINMAX(e->v1->co, min, max);
+			DO_MINMAX(e->v2->co, min, max);
+		}
+
+		add_v3_v3v3(min, min, max);
+		mul_v3_fl(min, 0.5f);
+
+		/* 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);
+			
+			if (edges[i]->v1 != edges[0]->v1)
+				BMO_slot_map_ptr_insert(bm, &weldop, "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_op_exec(bm, &weldop);
+	BMO_op_finish(bm, &weldop);
+
+	BMW_end(&walker);
+	BLI_array_free(edges);
+}
+
+/* uv collapse function */
+static void bmo_collapsecon_do_layer(BMesh *bm, BMOperator *op, int layer)
+{
+	BMIter iter, liter;
+	BMFace *f;
+	BMLoop *l, *l2;
+	BMWalker walker;
+	void **blocks = NULL;
+	BLI_array_declare(blocks);
+	CDBlockBytes min, max;
+	int i, tot, type = bm->ldata.layers[layer].type;
+
+	/* 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);
+
+	BMW_init(&walker, bm, BMW_LOOPDATA_ISLAND,
+	         BMW_MASK_NOP, EDGE_MARK, BMW_MASK_NOP,
+	         BMW_FLAG_NOP, /* no need to use BMW_FLAG_TEST_HIDDEN, already marked data */
+	         layer);
+
+	BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+		BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+			if (BMO_elem_flag_test(bm, l->e, EDGE_MARK)) {
+				/* walk */
+				BLI_array_empty(blocks);
+				tot = 0;
+				l2 = BMW_begin(&walker, l);
+
+				CustomData_data_initminmax(type, &min, &max);
+				for (tot = 0; l2; tot++, l2 = BMW_step(&walker)) {
+					BLI_array_growone(blocks);
+					blocks[tot] = CustomData_bmesh_get_layer_n(&bm->ldata, l2->head.data, layer);
+					CustomData_data_dominmax(type, blocks[tot], &min, &max);
+				}
+
+				if (tot) {
+					CustomData_data_multiply(type, &min, 0.5f);
+					CustomData_data_multiply(type, &max, 0.5f);
+					CustomData_data_add(type, &min, &max);
+
+					/* snap CD (uv, vcol) points to their centroid */
+					for (i = 0; i < tot; i++) {
+						CustomData_data_copy_value(type, &min, blocks[i]);
+					}
+				}
+			}
+		}
+	}
+
+	BMW_end(&walker);
+	BLI_array_free(blocks);
+}
+
+void bmo_collapse_uvs_exec(BMesh *bm, BMOperator *op)
+{
+	int i;
+
+	for (i = 0; i < bm->ldata.totlayer; i++) {
+		if (CustomData_layer_has_math(&bm->ldata, i))
+			bmo_collapsecon_do_layer(bm, op, i);
+	}
+}
+
+void bmesh_finddoubles_common(BMesh *bm, BMOperator *op, BMOperator *optarget, const char *targetmapname)
+{
+	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_growone(verts);
+		verts[i++] = v;
+	}
+
+	/* Test whether keepverts arg exists and is non-empty */
+	if (BMO_slot_exists(op, "keepverts")) {
+		keepvert = BMO_iter_new(&oiter, bm, op, "keepverts", BM_VERT) != NULL;
+	}
+
+	/* sort by vertex coordinates added together */
+	qsort(verts, BLI_array_count(verts), sizeof(void *), vergaverco);
+
+	/* Flag keepverts */
+	if (keepvert) {
+		BMO_slot_buffer_flag_enable(bm, op, "keepverts", 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)) {
+			continue;
+		}
+
+		for (j = i + 1; j < len; j++) {
+			v2 = 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)
+				break;
+
+			if (keepvert) {
+				if (BMO_elem_flag_test(bm, v2, VERT_KEEP) == BMO_elem_flag_test(bm, v, VERT_KEEP))
+					continue;
+			}
+
+			if (compare_len_v3v3(v->co, v2->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);
+				}
+
+				BMO_elem_flag_enable(bm, v2, VERT_DOUBLE);
+				BMO_elem_flag_enable(bm, v, VERT_TARGET);
+
+				BMO_slot_map_ptr_insert(bm, optarget, targetmapname, v2, v);
+			}
+		}
+	}
+
+	BLI_array_free(verts);
+}
+
+void bmo_removedoubles_exec(BMesh *bm, BMOperator *op)
+{
+	BMOperator weldop;
+
+	BMO_op_init(bm, &weldop, "weldverts");
+	bmesh_finddoubles_common(bm, op, &weldop, "targetmap");
+	BMO_op_exec(bm, &weldop);
+	BMO_op_finish(bm, &weldop);
+}
+
+
+void bmo_finddoubles_exec(BMesh *bm, BMOperator *op)
+{
+	bmesh_finddoubles_common(bm, op, op, "targetmapout");
+}
+
+void bmo_automerge_exec(BMesh *bm, BMOperator *op)
+{
+	BMOperator findop, weldop;
+	BMIter viter;
+	BMVert *v;
+
+	/* 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);
+	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);
+		}
+	}
+
+	/* Search for doubles among all vertices, but only merge non-VERT_KEEP
+	 * vertices into VERT_KEEP vertices. */
+	BMO_op_initf(bm, &findop, "finddoubles verts=%av keepverts=%fv", VERT_KEEP);
+	BMO_slot_copy(op, &findop, "dist", "dist");
+	BMO_op_exec(bm, &findop);
+
+	/* weld the vertices */
+	BMO_op_init(bm, &weldop, "weldverts");
+	BMO_slot_copy(&findop, &weldop, "targetmapout", "targetmap");
+	BMO_op_exec(bm, &weldop);
+
+	BMO_op_finish(bm, &findop);
+	BMO_op_finish(bm, &weldop);
+}
diff --git a/source/blender/bmesh/operators/bmo_slide.c b/source/blender/bmesh/operators/bmo_slide.c
new file mode 100644
index 0000000..5a91fde
--- /dev/null
+++ b/source/blender/bmesh/operators/bmo_slide.c
@@ -0,0 +1,115 @@
+/*
+ * ***** 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): Francisco De La Cruz
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/operators/bmo_slide.c
+ *  \ingroup bmesh
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BKE_global.h"
+
+#include "BLI_math.h"
+
+#include "bmesh.h"
+#include "intern/bmesh_operators_private.h" /* own include */
+
+#define EDGE_MARK 1
+#define VERT_MARK 2
+
+/*
+ * Slides a vertex along a connected edge
+ *
+ */
+void bmo_vertex_slide_exec(BMesh *bm, BMOperator *op)
+{
+	BMOIter oiter;
+	BMIter iter;
+	BMHeader *h;
+	BMVert *vertex;
+	BMEdge *edge;
+	BMEdge *slide_edge;
+
+	/* Selection counts */
+	int selected_edges = 0;
+
+	/* Get slide amount */
+	const float distance_t = BMO_slot_float_get(op, "distance_t");
+
+	/* Get start vertex */
+	vertex = BMO_iter_new(&oiter, bm, op, "vert", BM_VERT);
+
+
+	if (!vertex) {
+		if (G.debug & G_DEBUG) {
+			fprintf(stderr, "vertex_slide: No vertex selected...");
+		}
+		BMO_error_raise(bm, op, BMERR_INVALID_SELECTION, "Vertex Slide Error: Invalid selection.");
+		return;
+	}
+
+	/* 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;
+		}
+	}
+
+	/* Only allow sliding if an edge is selected */
+	if (selected_edges == 0) {
+		if (G.debug & G_DEBUG) {
+			fprintf(stderr, "vertex_slide: select a single edge\n");
+		}
+		BMO_error_raise(bm, op, BMERR_INVALID_SELECTION, "Vertex Slide Error: Invalid selection.");
+		return;
+	}
+
+	/* Make sure we get the correct edge. */
+	BM_ITER_ELEM (edge, &iter, vertex, BM_EDGES_OF_VERT) {
+		if (BMO_elem_flag_test(bm, edge, EDGE_MARK) && BM_vert_in_edge(edge, vertex)) {
+			slide_edge = edge;
+			break;
+		}
+	}
+
+	/* Found edge */
+	if (slide_edge) {
+		BMVert *other = BM_edge_other_vert(slide_edge, vertex);
+
+		/* mark */
+		BMO_elem_flag_enable(bm, vertex, VERT_MARK);
+
+		/* Interpolate */
+		interp_v3_v3v3(vertex->co, vertex->co, other->co, distance_t);
+	}
+
+	/* Return the new edge. The same previously marked with VERT_MARK */
+	BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
+	return;
+}
+
+#undef EDGE_MARK
+#undef VERT_MARK
diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c
new file mode 100644
index 0000000..7da02a5
--- /dev/null
+++ b/source/blender/bmesh/operators/bmo_subdivide.c
@@ -0,0 +1,1119 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/operators/bmo_subdivide.c
+ *  \ingroup bmesh
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_math.h"
+#include "BLI_rand.h"
+#include "BLI_array.h"
+#include "BLI_noise.h"
+
+#include "BKE_customdata.h"
+
+#include "DNA_object_types.h"
+
+#include "bmesh.h"
+#include "intern/bmesh_private.h"
+
+#include "intern/bmesh_operators_private.h" /* own include */
+
+#include "bmo_subdivide.h" /* own include */
+
+/* flags for all elements share a common bitfield space */
+#define SUBD_SPLIT	1
+
+#define EDGE_PERCENT	2
+
+/* I don't think new faces are flagged, currently, but
+ * better safe than sorry. */
+#define FACE_CUSTOMFILL	4
+#define ELE_INNER	8
+#define ELE_SPLIT	16
+
+/*
+ * NOTE: beauty has been renamed to flag!
+ */
+
+/* generic subdivision rules:
+ *
+ * - two selected edges in a face should make a link
+ *   between them.
+ *
+ * - one edge should do, what? make pretty topology, or just
+ *   split the edge only?
+ */
+
+/* connects face with smallest len, which I think should always be correct for
+ * edge subdivision */
+static BMEdge *connect_smallest_face(BMesh *bm, BMVert *v1, BMVert *v2, BMFace **r_nf)
+{
+	BMIter iter, iter2;
+	BMVert *v;
+	BMLoop *nl;
+	BMFace *face, *curf = NULL;
+
+	/* this isn't the best thing in the world.  it doesn't handle cases where there's
+	 * multiple faces yet.  that might require a convexity test to figure out which
+	 * face is "best" and who knows what for non-manifold conditions. */
+	for (face = BM_iter_new(&iter, bm, BM_FACES_OF_VERT, v1); face; face = BM_iter_step(&iter)) {
+		for (v = BM_iter_new(&iter2, bm, BM_VERTS_OF_FACE, face); v; v = BM_iter_step(&iter2)) {
+			if (v == v2) {
+				if (!curf || face->len < curf->len) curf = face;
+			}
+		}
+	}
+
+	if (curf) {
+		face = BM_face_split(bm, curf, v1, v2, &nl, NULL, FALSE);
+		
+		if (r_nf) *r_nf = face;
+		return nl ? nl->e : NULL;
+	}
+
+	return NULL;
+}
+/* calculates offset for co, based on fractal, sphere or smooth settings  */
+static void alter_co(BMesh *bm, BMVert *v, BMEdge *UNUSED(origed), const SubDParams *params, float perc,
+                     BMVert *vsta, BMVert *vend)
+{
+	float tvec[3], prev_co[3], fac;
+	float *co = NULL;
+	int i, totlayer = CustomData_number_of_layers(&bm->vdata, CD_SHAPEKEY);
+	
+	BM_vert_normal_update_all(v);
+
+	co = CustomData_bmesh_get_n(&bm->vdata, v->head.data, CD_SHAPEKEY, params->origkey);
+	copy_v3_v3(co, v->co);
+	copy_v3_v3(prev_co, co);
+
+	if (UNLIKELY(params->use_sphere)) { /* subdivide sphere */
+		normalize_v3(co);
+		mul_v3_fl(co, params->smooth);
+	}
+	else if (params->use_smooth) {
+		/* we calculate an offset vector vec1[], to be added to *co */
+		float len, nor[3], nor1[3], nor2[3], smooth = params->smooth;
+
+		sub_v3_v3v3(nor, vsta->co, vend->co);
+		len = 0.5f * normalize_v3(nor);
+
+		copy_v3_v3(nor1, vsta->no);
+		copy_v3_v3(nor2, vend->no);
+
+		/* cosine angle */
+		fac = dot_v3v3(nor, nor1);
+		mul_v3_v3fl(tvec, nor1, fac);
+
+		/* cosine angle */
+		fac = -dot_v3v3(nor, nor2);
+		madd_v3_v3fl(tvec, nor2, fac);
+
+		/* falloff for multi subdivide */
+		smooth *= sqrtf(fabsf(1.0f - 2.0f * fabsf(0.5f-perc)));
+
+		mul_v3_fl(tvec, smooth * len);
+
+		add_v3_v3(co, tvec);
+	}
+
+	if (params->use_fractal) {
+		float len = len_v3v3(vsta->co, vend->co);
+		float vec2[3] = {0.0f, 0.0f, 0.0f}, co2[3];
+
+		fac = params->fractal * len;
+
+		add_v3_v3(vec2, vsta->no);
+		add_v3_v3(vec2, vend->no);
+		mul_v3_fl(vec2, 0.5f);
+
+		add_v3_v3v3(co2, v->co, params->off);
+		tvec[0] = fac * (BLI_gTurbulence(1.0, co2[0], co2[1], co2[2], 15, 0, 1) - 0.5f);
+		tvec[1] = fac * (BLI_gTurbulence(1.0, co2[0], co2[1], co2[2], 15, 0, 1) - 0.5f);
+		tvec[2] = fac * (BLI_gTurbulence(1.0, co2[0], co2[1], co2[2], 15, 0, 1) - 0.5f);
+
+		mul_v3_v3(vec2, tvec);
+
+		/* add displacement */
+		add_v3_v3v3(co, co, vec2);
+	}
+
+	/* apply the new difference to the rest of the shape keys,
+	 * note that this doent 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 */
+	sub_v3_v3v3(tvec, prev_co, co);
+
+	for (i = 0; i < totlayer; i++) {
+		if (params->origkey != i) {
+			co = CustomData_bmesh_get_n(&bm->vdata, v->head.data, CD_SHAPEKEY, i);
+			sub_v3_v3(co, tvec);
+		}
+	}
+
+}
+
+/* assumes in the edge is the correct interpolated vertices already */
+/* percent defines the interpolation, rad and flag are for special options */
+/* results in new vertex with correct coordinate, vertex normal and weight group info */
+static BMVert *bm_subdivide_edge_addvert(BMesh *bm, BMEdge *edge, BMEdge *oedge,
+                                         const SubDParams *params, float percent,
+                                         float percent2,
+                                         BMEdge **out, BMVert *vsta, BMVert *vend)
+{
+	BMVert *ev;
+	
+	ev = BM_edge_split(bm, edge, edge->v1, out, percent);
+
+	BMO_elem_flag_enable(bm, ev, ELE_INNER);
+
+	/* offset for smooth or sphere or fractal */
+	alter_co(bm, ev, oedge, params, percent2, vsta, vend);
+
+#if 0 //BMESH_TODO
+	/* clip if needed by mirror modifier */
+	if (edge->v1->f2) {
+		if (edge->v1->f2 & edge->v2->f2 & 1) {
+			co[0] = 0.0f;
+		}
+		if (edge->v1->f2 & edge->v2->f2 & 2) {
+			co[1] = 0.0f;
+		}
+		if (edge->v1->f2 & edge->v2->f2 & 4) {
+			co[2] = 0.0f;
+		}
+	}
+#endif
+	
+	interp_v3_v3v3(ev->no, vsta->no, vend->no, percent2);
+	normalize_v3(ev->no);
+
+	return ev;
+}
+
+static BMVert *subdivideedgenum(BMesh *bm, BMEdge *edge, BMEdge *oedge,
+                                int curpoint, int totpoint, const SubDParams *params,
+                                BMEdge **newe, BMVert *vsta, BMVert *vend)
+{
+	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);
+	else {
+		percent = 1.0f / (float)(totpoint + 1-curpoint);
+		percent2 = (float)(curpoint + 1) / (float)(totpoint + 1);
+
+	}
+	
+	ev = bm_subdivide_edge_addvert(bm, edge, oedge, params, percent,
+	                               percent2, newe, vsta, vend);
+	return ev;
+}
+
+static void bm_subdivide_multicut(BMesh *bm, BMEdge *edge, const SubDParams *params,
+                                  BMVert *vsta, BMVert *vend)
+{
+	BMEdge *eed = edge, *newe, temp = *edge;
+	BMVert *v, ov1 = *edge->v1, ov2 = *edge->v2, *v1 = edge->v1, *v2 = edge->v2;
+	int i, numcuts = params->numcuts;
+
+	temp.v1 = &ov1;
+	temp.v2 = &ov2;
+	
+	for (i = 0; i < numcuts; i++) {
+		v = subdivideedgenum(bm, eed, &temp, i, params->numcuts, params, &newe, vsta, vend);
+
+		BMO_elem_flag_enable(bm, v, SUBD_SPLIT);
+		BMO_elem_flag_enable(bm, eed, SUBD_SPLIT);
+		BMO_elem_flag_enable(bm, newe, SUBD_SPLIT);
+
+		BMO_elem_flag_enable(bm, v, ELE_SPLIT);
+		BMO_elem_flag_enable(bm, eed, ELE_SPLIT);
+		BMO_elem_flag_enable(bm, newe, SUBD_SPLIT);
+
+		BM_CHECK_ELEMENT(v);
+		if (v->e) BM_CHECK_ELEMENT(v->e);
+		if (v->e && v->e->l) BM_CHECK_ELEMENT(v->e->l->f);
+	}
+	
+	alter_co(bm, v1, &temp, params, 0, &ov1, &ov2);
+	alter_co(bm, v2, &temp, params, 1.0, &ov1, &ov2);
+}
+
+/* note: the patterns are rotated as necessary to
+ * match the input geometry.  they're based on the
+ * pre-split state of the  face */
+
+/*
+ *  v3---------v2
+ *  |          |
+ *  |          |
+ *  |          |
+ *  |          |
+ *  v4---v0---v1
+ */
+static void quad_1edge_split(BMesh *bm, BMFace *UNUSED(face),
+                             BMVert **verts, const SubDParams *params)
+{
+	BMFace *nf;
+	int i, add, numcuts = params->numcuts;
+
+	/* if it's odd, the middle face is a quad, otherwise it's a triangle */
+	if ((numcuts % 2) == 0) {
+		add = 2;
+		for (i = 0; i < numcuts; i++) {
+			if (i == numcuts / 2) {
+				add -= 1;
+			}
+			connect_smallest_face(bm, verts[i], verts[numcuts + add], &nf);
+		}
+	}
+	else {
+		add = 2;
+		for (i = 0; i < numcuts; i++) {
+			connect_smallest_face(bm, verts[i], verts[numcuts + add], &nf);
+			if (i == numcuts / 2) {
+				add -= 1;
+				connect_smallest_face(bm, verts[i], verts[numcuts + add], &nf);
+			}
+		}
+
+	}
+}
+
+static SubDPattern quad_1edge = {
+	{1, 0, 0, 0},
+	quad_1edge_split,
+	4,
+};
+
+
+/*
+ *  v6--------v5
+ *  |          |
+ *  |          |v4s
+ *  |          |v3s
+ *  |   s  s   |
+ *  v7-v0--v1-v2
+ */
+static void quad_2edge_split_path(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
+                                  const SubDParams *params)
+{
+	BMFace *nf;
+	int i, numcuts = params->numcuts;
+	
+	for (i = 0; i < numcuts; i++) {
+		connect_smallest_face(bm, verts[i], verts[numcuts + (numcuts - i)], &nf);
+	}
+	connect_smallest_face(bm, verts[numcuts * 2 + 3], verts[numcuts * 2 + 1], &nf);
+}
+
+static SubDPattern quad_2edge_path = {
+	{1, 1, 0, 0},
+	quad_2edge_split_path,
+	4,
+};
+
+/*
+ *  v6--------v5
+ *  |          |
+ *  |          |v4s
+ *  |          |v3s
+ *  |   s  s   |
+ *  v7-v0--v1-v2
+ */
+static void quad_2edge_split_innervert(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
+                                       const SubDParams *params)
+{
+	BMFace *nf;
+	BMVert *v, *lastv;
+	BMEdge *e, *ne, olde;
+	int i, numcuts = params->numcuts;
+	
+	lastv = verts[numcuts];
+
+	for (i = numcuts - 1; i >= 0; i--) {
+		e = connect_smallest_face(bm, verts[i], verts[numcuts + (numcuts - i)], &nf);
+
+		olde = *e;
+		v = bm_subdivide_edge_addvert(bm, e, &olde, params, 0.5f, 0.5f, &ne, e->v1, e->v2);
+
+		if (i != numcuts - 1) {
+			connect_smallest_face(bm, lastv, v, &nf);
+		}
+
+		lastv = v;
+	}
+
+	connect_smallest_face(bm, lastv, verts[numcuts * 2 + 2], &nf);
+}
+
+static SubDPattern quad_2edge_innervert = {
+	{1, 1, 0, 0},
+	quad_2edge_split_innervert,
+	4,
+};
+
+/*
+ *  v6--------v5
+ *  |          |
+ *  |          |v4s
+ *  |          |v3s
+ *  |   s  s   |
+ *  v7-v0--v1-v2
+ *
+ */
+static void quad_2edge_split_fan(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
+                                 const SubDParams *params)
+{
+	BMFace *nf;
+	/* BMVert *v; */               /* UNUSED */
+	/* BMVert *lastv = verts[2]; */ /* UNUSED */
+	/* BMEdge *e, *ne; */          /* UNUSED */
+	int i, numcuts = params->numcuts;
+
+	for (i = 0; i < numcuts; i++) {
+		connect_smallest_face(bm, verts[i], verts[numcuts * 2 + 2], &nf);
+		connect_smallest_face(bm, verts[numcuts + (numcuts - i)], verts[numcuts * 2 + 2], &nf);
+	}
+}
+
+static SubDPattern quad_2edge_fan = {
+	{1, 1, 0, 0},
+	quad_2edge_split_fan,
+	4,
+};
+
+/*
+ *      s   s
+ *  v8--v7--v6-v5
+ *  |          |
+ *  |          v4 s
+ *  |          |
+ *  |          v3 s
+ *  |   s  s   |
+ *  v9-v0--v1-v2
+ */
+static void quad_3edge_split(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
+                             const SubDParams *params)
+{
+	BMFace *nf;
+	int i, add = 0, numcuts = params->numcuts;
+	
+	for (i = 0; i < numcuts; i++) {
+		if (i == numcuts / 2) {
+			if (numcuts % 2 != 0) {
+				connect_smallest_face(bm, verts[numcuts - i - 1 + add], verts[i + numcuts + 1], &nf);
+			}
+			add = numcuts * 2 + 2;
+		}
+		connect_smallest_face(bm, verts[numcuts - i - 1 + add], verts[i + numcuts + 1], &nf);
+	}
+
+	for (i = 0; i < numcuts / 2 + 1; i++) {
+		connect_smallest_face(bm, verts[i], verts[(numcuts - i) + numcuts * 2 + 1], &nf);
+	}
+}
+
+static SubDPattern quad_3edge = {
+	{1, 1, 1, 0},
+	quad_3edge_split,
+	4,
+};
+
+/*
+ *            v8--v7-v6--v5
+ *            |     s    |
+ *            |v9 s     s|v4
+ * first line |          |   last line
+ *            |v10s s   s|v3
+ *            v11-v0--v1-v2
+ *
+ *            it goes from bottom up
+ */
+static void quad_4edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
+                                 const SubDParams *params)
+{
+	BMFace *nf;
+	BMVert *v, *v1, *v2;
+	BMEdge *e, *ne, temp;
+	BMVert **lines;
+	int numcuts = params->numcuts;
+	int i, j, a, b, s = numcuts + 2 /* , totv = numcuts * 4 + 4 */;
+
+	lines = MEM_callocN(sizeof(BMVert *) * (numcuts + 2) * (numcuts + 2), "q_4edge_split");
+	/* build a 2-dimensional array of verts,
+	 * containing every vert (and all new ones)
+	 * in the face */
+
+	/* first line */
+	for (i = 0; i < numcuts + 2; i++) {
+		lines[i] = verts[numcuts * 3 + 2 + (numcuts - i + 1)];
+	}
+
+	/* last line */
+	for (i = 0; i < numcuts + 2; i++) {
+		lines[(s - 1) * s + i] = verts[numcuts + i];
+	}
+	
+	/* first and last members of middle lines */
+	for (i = 0; i < numcuts; i++) {
+		a = i;
+		b = numcuts + 1 + numcuts + 1 + (numcuts - i - 1);
+		
+		e = connect_smallest_face(bm, verts[a], verts[b], &nf);
+		if (!e)
+			continue;
+
+		BMO_elem_flag_enable(bm, e, ELE_INNER);
+		BMO_elem_flag_enable(bm, nf, ELE_INNER);
+
+		
+		v1 = lines[(i + 1) * s] = verts[a];
+		v2 = lines[(i + 1) * s + s - 1] = verts[b];
+		
+		temp = *e;
+		for (a = 0; a < numcuts; a++) {
+			v = subdivideedgenum(bm, e, &temp, a, numcuts, params, &ne,
+			                     v1, v2);
+
+			BMESH_ASSERT(v != NULL);
+
+			BMO_elem_flag_enable(bm, ne, ELE_INNER);
+			lines[(i + 1) * s + a + 1] = v;
+		}
+	}
+
+	for (i = 1; i < numcuts + 2; i++) {
+		for (j = 1; j < numcuts + 1; j++) {
+			a = i * s + j;
+			b = (i - 1) * s + j;
+			e = connect_smallest_face(bm, lines[a], lines[b], &nf);
+			if (!e)
+				continue;
+
+			BMO_elem_flag_enable(bm, e, ELE_INNER);
+			BMO_elem_flag_enable(bm, nf, ELE_INNER);
+		}
+	}
+
+	MEM_freeN(lines);
+}
+
+/*
+ *        v3
+ *       / \
+ *      /   \
+ *     /     \
+ *    /       \
+ *   /         \
+ *  v4--v0--v1--v2
+ *      s    s
+ */
+static void tri_1edge_split(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
+                            const SubDParams *params)
+{
+	BMFace *nf;
+	int i, numcuts = params->numcuts;
+	
+	for (i = 0; i < numcuts; i++) {
+		connect_smallest_face(bm, verts[i], verts[numcuts + 1], &nf);
+	}
+}
+
+static SubDPattern tri_1edge = {
+	{1, 0, 0},
+	tri_1edge_split,
+	3,
+};
+
+/*         v5
+ *        / \
+ *   s v6/---\ v4 s
+ *      / \ / \
+ *  sv7/---v---\ v3 s
+ *    /  \/  \/ \
+ *   v8--v0--v1--v2
+ *      s    s
+ */
+static void tri_3edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts,
+                                const SubDParams *params)
+{
+	BMFace *nf;
+	BMEdge *e, *ne, temp;
+	BMVert ***lines, *v, ov1, ov2;
+	void *stackarr[1];
+	int i, j, a, b, numcuts = params->numcuts;
+	
+	/* number of verts in each lin */
+	lines = MEM_callocN(sizeof(void *) * (numcuts + 2), "triangle vert table");
+	
+	lines[0] = (BMVert **) stackarr;
+	lines[0][0] = verts[numcuts * 2 + 1];
+	
+	lines[numcuts + 1] = MEM_callocN(sizeof(void *) * (numcuts + 2), "triangle vert table 2");
+	for (i = 0; i < numcuts; i++) {
+		lines[numcuts + 1][i + 1] = verts[i];
+	}
+	lines[numcuts + 1][0] = verts[numcuts * 3 + 2];
+	lines[numcuts + 1][numcuts + 1] = verts[numcuts];
+
+	for (i = 0; i < numcuts; i++) {
+		lines[i + 1] = MEM_callocN(sizeof(void *) * (2 + i), "triangle vert table row");
+		a = numcuts * 2 + 2 + i;
+		b = numcuts + numcuts - i;
+		e = connect_smallest_face(bm, verts[a], verts[b], &nf);
+		if (!e) goto cleanup;
+
+		BMO_elem_flag_enable(bm, e, ELE_INNER);
+		BMO_elem_flag_enable(bm, nf, ELE_INNER);
+
+		lines[i + 1][0] = verts[a];
+		lines[i + 1][i + 1] = verts[b];
+		
+		temp = *e;
+		ov1 = *verts[a];
+		ov2 = *verts[b];
+		temp.v1 = &ov1;
+		temp.v2 = &ov2;
+		for (j = 0; j < i; j++) {
+			v = subdivideedgenum(bm, e, &temp, j, i, params, &ne,
+			                     verts[a], verts[b]);
+			lines[i + 1][j + 1] = v;
+
+			BMO_elem_flag_enable(bm, ne, ELE_INNER);
+		}
+	}
+	
+	/*
+	 *         v5
+	 *        / \
+	 *   s v6/---\ v4 s
+	 *      / \ / \
+	 *  sv7/---v---\ v3 s
+	 *    /  \/  \/ \
+	 *   v8--v0--v1--v2
+	 *      s    s
+	 */
+	for (i = 1; i < numcuts + 1; i++) {
+		for (j = 0; j < i; j++) {
+			e = connect_smallest_face(bm, lines[i][j], lines[i + 1][j + 1], &nf);
+
+			BMO_elem_flag_enable(bm, e, ELE_INNER);
+			BMO_elem_flag_enable(bm, nf, ELE_INNER);
+
+			e = connect_smallest_face(bm, lines[i][j + 1], lines[i + 1][j + 1], &nf);
+
+			BMO_elem_flag_enable(bm, e, ELE_INNER);
+			BMO_elem_flag_enable(bm, nf, ELE_INNER);
+		}
+	}
+
+cleanup:
+	for (i = 1; i < numcuts + 2; i++) {
+		if (lines[i]) MEM_freeN(lines[i]);
+	}
+
+	MEM_freeN(lines);
+}
+
+static SubDPattern tri_3edge = {
+	{1, 1, 1},
+	tri_3edge_subdivide,
+	3,
+};
+
+
+static SubDPattern quad_4edge = {
+	{1, 1, 1, 1},
+	quad_4edge_subdivide,
+	4,
+};
+
+static SubDPattern *patterns[] = {
+	NULL, //quad single edge pattern is inserted here
+	NULL, //quad corner vert pattern is inserted here
+	NULL, //tri single edge pattern is inserted here
+	NULL,
+	&quad_3edge,
+	NULL,
+};
+
+#define PLEN  (sizeof(patterns) / sizeof(void *))
+
+typedef struct SubDFaceData {
+	BMVert *start; SubDPattern *pat;
+	int totedgesel; //only used if pat was NULL, e.g. no pattern was found
+	BMFace *face;
+} SubDFaceData;
+
+void bmo_esubd_exec(BMesh *bm, BMOperator *op)
+{
+	BMOpSlot *einput;
+	SubDPattern *pat;
+	SubDParams params;
+	SubDFaceData *facedata = NULL;
+	BMIter viter, fiter, liter;
+	BMVert *v, **verts = NULL;
+	BMEdge *edge, **edges = NULL;
+	BMLoop *nl, *l, **splits = NULL, **loops = NULL;
+	BMFace *face;
+	BLI_array_declare(splits);
+	BLI_array_declare(loops);
+	BLI_array_declare(facedata);
+	BLI_array_declare(edges);
+	BLI_array_declare(verts);
+	float smooth, fractal;
+	int use_sphere, cornertype, use_singleedge, use_gridfill;
+	int skey, seed, i, j, matched, a, b, numcuts, totesel;
+	
+	BMO_slot_buffer_flag_enable(bm, op, "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");
+	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");
+	
+	BLI_srandom(seed);
+	
+	patterns[1] = NULL;
+	//straight cut is patterns[1] == NULL
+	switch (cornertype) {
+		case SUBD_PATH:
+			patterns[1] = &quad_2edge_path;
+			break;
+		case SUBD_INNERVERT:
+			patterns[1] = &quad_2edge_innervert;
+			break;
+		case SUBD_FAN:
+			patterns[1] = &quad_2edge_fan;
+			break;
+	}
+	
+	if (use_singleedge) {
+		patterns[0] = &quad_1edge;
+		patterns[2] = &tri_1edge;
+	}
+	else {
+		patterns[0] = NULL;
+		patterns[2] = NULL;
+	}
+
+	if (use_gridfill) {
+		patterns[3] = &quad_4edge;
+		patterns[5] = &tri_3edge;
+	}
+	else {
+		patterns[3] = NULL;
+		patterns[5] = NULL;
+	}
+	
+	/* add a temporary shapekey layer to store displacements on current geometry */
+	BM_data_layer_add(bm, &bm->vdata, CD_SHAPEKEY);
+	skey = CustomData_number_of_layers(&bm->vdata, CD_SHAPEKEY) - 1;
+	
+	BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
+		float *co = CustomData_bmesh_get_n(&bm->vdata, v->head.data, CD_SHAPEKEY, skey);
+		copy_v3_v3(co, v->co);
+	}
+
+	/* first go through and tag edges */
+	BMO_slot_buffer_from_enabled_flag(bm, op, "edges", BM_EDGE, SUBD_SPLIT);
+
+	params.numcuts = numcuts;
+	params.op = op;
+	params.smooth = smooth;
+	params.seed = seed;
+	params.fractal = fractal;
+	params.use_smooth  = (smooth  != 0.0f);
+	params.use_fractal = (fractal != 0.0f);
+	params.use_sphere  = use_sphere;
+	params.origkey = skey;
+	params.off[0] = (float)BLI_drand() * 200.0f;
+	params.off[1] = (float)BLI_drand() * 200.0f;
+	params.off[2] = (float)BLI_drand() * 200.0f;
+	
+	BMO_slot_map_to_flag(bm, op, "custompatterns",
+	                     BM_FACE, FACE_CUSTOMFILL);
+
+	BMO_slot_map_to_flag(bm, op, "edgepercents",
+	                     BM_EDGE, EDGE_PERCENT);
+
+
+	BM_ITER_MESH (face, &fiter, bm, BM_FACES_OF_MESH) {
+		BMEdge *e1 = NULL, *e2 = NULL;
+		float vec1[3], vec2[3];
+
+		/* figure out which pattern to use */
+
+		BLI_array_empty(edges);
+		BLI_array_empty(verts);
+
+		BLI_array_growitems(edges, face->len);
+		BLI_array_growitems(verts, face->len);
+
+		matched = 0;
+
+		totesel = 0;
+		BM_ITER_ELEM_INDEX (nl, &liter, face, BM_LOOPS_OF_FACE, i) {
+			edges[i] = nl->e;
+			verts[i] = nl->v;
+
+			if (BMO_elem_flag_test(bm, edges[i], SUBD_SPLIT)) {
+				if (!e1) e1 = edges[i];
+				else     e2 = edges[i];
+
+				totesel++;
+			}
+		}
+
+		/* make sure the two edges have a valid angle to each other */
+		if (totesel == 2 && BM_edge_share_vert_count(e1, e2)) {
+			float angle;
+
+			sub_v3_v3v3(vec1, e1->v2->co, e1->v1->co);
+			sub_v3_v3v3(vec2, e2->v2->co, e2->v1->co);
+			normalize_v3(vec1);
+			normalize_v3(vec2);
+
+			angle = dot_v3v3(vec1, vec2);
+			angle = fabsf(angle);
+			if (fabsf(angle - 1.0f) < 0.01f) {
+				totesel = 0;
+			}
+		}
+
+		if (BMO_elem_flag_test(bm, face, FACE_CUSTOMFILL)) {
+			pat = BMO_slot_map_data_get(bm, op,
+			                            "custompatterns", face);
+			for (i = 0; i < pat->len; i++) {
+				matched = 1;
+				for (j = 0; j < pat->len; j++) {
+					a = (j + i) % pat->len;
+					if ((!!BMO_elem_flag_test(bm, edges[a], SUBD_SPLIT)) != (!!pat->seledges[j])) {
+						matched = 0;
+						break;
+					}
+				}
+				if (matched) {
+					BLI_array_growone(facedata);
+					b = BLI_array_count(facedata) - 1;
+					facedata[b].pat = pat;
+					facedata[b].start = verts[i];
+					facedata[b].face = face;
+					facedata[b].totedgesel = totesel;
+					BMO_elem_flag_enable(bm, face, SUBD_SPLIT);
+					break;
+				}
+			}
+
+			/* obvously don't test for other patterns matching */
+			continue;
+		}
+
+		for (i = 0; i < PLEN; i++) {
+			pat = patterns[i];
+			if (!pat) {
+				continue;
+			}
+
+			if (pat->len == face->len) {
+				for (a = 0; a < pat->len; a++) {
+					matched = 1;
+					for (b = 0; b < pat->len; b++) {
+						j = (b + a) % pat->len;
+						if ((!!BMO_elem_flag_test(bm, edges[j], SUBD_SPLIT)) != (!!pat->seledges[b])) {
+							matched = 0;
+							break;
+						}
+					}
+					if (matched) {
+						break;
+					}
+				}
+				if (matched) {
+					BLI_array_growone(facedata);
+					j = BLI_array_count(facedata) - 1;
+
+					BMO_elem_flag_enable(bm, face, SUBD_SPLIT);
+
+					facedata[j].pat = pat;
+					facedata[j].start = verts[a];
+					facedata[j].face = face;
+					facedata[j].totedgesel = totesel;
+					break;
+				}
+			}
+
+		}
+		
+		if (!matched && totesel) {
+			BLI_array_growone(facedata);
+			j = BLI_array_count(facedata) - 1;
+			
+			BMO_elem_flag_enable(bm, face, SUBD_SPLIT);
+			facedata[j].totedgesel = totesel;
+			facedata[j].face = face;
+		}
+	}
+
+	einput = BMO_slot_get(op, "edges");
+
+	/* go through and split edges */
+	for (i = 0; i < einput->len; i++) {
+		edge = ((BMEdge **)einput->data.p)[i];
+		bm_subdivide_multicut(bm, edge, &params, edge->v1, edge->v2);
+	}
+
+	/* copy original-geometry displacements to current coordinates */
+	BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
+		float *co = CustomData_bmesh_get_n(&bm->vdata, v->head.data, CD_SHAPEKEY, skey);
+		copy_v3_v3(v->co, co);
+	}
+
+	i = 0;
+	for (i = 0; i < BLI_array_count(facedata); i++) {
+		face = facedata[i].face;
+
+		/* figure out which pattern to use */
+		BLI_array_empty(verts);
+
+		pat = facedata[i].pat;
+
+		if (!pat && facedata[i].totedgesel == 2) {
+			int vlen;
+			
+			/* ok, no pattern.  we still may be able to do something */
+			BLI_array_empty(loops);
+			BLI_array_empty(splits);
+
+			/* for case of two edges, connecting them shouldn't be too hard */
+			BM_ITER_ELEM (l, &liter, face, BM_LOOPS_OF_FACE) {
+				BLI_array_growone(loops);
+				loops[BLI_array_count(loops) - 1] = l;
+			}
+			
+			vlen = BLI_array_count(loops);
+
+			/* find the boundary of one of the split edges */
+			for (a = 1; a < vlen; a++) {
+				if (!BMO_elem_flag_test(bm, loops[a - 1]->v, ELE_INNER) &&
+				    BMO_elem_flag_test(bm, loops[a]->v, ELE_INNER))
+				{
+					break;
+				}
+			}
+			
+			if (BMO_elem_flag_test(bm, loops[(a + numcuts + 1) % vlen]->v, ELE_INNER)) {
+				b = (a + numcuts + 1) % vlen;
+			}
+			else {
+				/* find the boundary of the other edge. */
+				for (j = 0; j < vlen; j++) {
+					b = (j + a + numcuts + 1) % vlen;
+					if (!BMO_elem_flag_test(bm, loops[b == 0 ? vlen - 1 : b - 1]->v, ELE_INNER) &&
+					    BMO_elem_flag_test(bm, loops[b]->v, ELE_INNER))
+					{
+						break;
+					}
+				}
+			}
+			
+			b += numcuts - 1;
+
+			for (j = 0; j < numcuts; j++) {
+				BLI_array_growone(splits);
+				splits[BLI_array_count(splits) - 1] = loops[a];
+				
+				BLI_array_growone(splits);
+				splits[BLI_array_count(splits) - 1] = loops[b];
+
+				b = (b - 1) % vlen;
+				a = (a + 1) % vlen;
+			}
+			
+			//BM_face_legal_splits(bmesh, face, splits, BLI_array_count(splits) / 2);
+
+			for (j = 0; j < BLI_array_count(splits) / 2; j++) {
+				if (splits[j * 2]) {
+					/* BMFace *nf = */ /* UNUSED */
+					BM_face_split(bm, face, splits[j * 2]->v, splits[j * 2 + 1]->v, &nl, NULL, FALSE);
+				}
+			}
+
+			continue;
+		}
+		else if (!pat) {
+			continue;
+		}
+
+		j = a = 0;
+		for (nl = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, face);
+		     nl;
+		     nl = BM_iter_step(&liter))
+		{
+			if (nl->v == facedata[i].start) {
+				a = j + 1;
+				break;
+			}
+			j++;
+		}
+
+		for (j = 0; j < face->len; j++) {
+			BLI_array_growone(verts);
+		}
+		
+		j = 0;
+		for (nl = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, face); nl; nl = BM_iter_step(&liter)) {
+			b = (j - a + face->len) % face->len;
+			verts[b] = nl->v;
+			j += 1;
+		}
+
+		BM_CHECK_ELEMENT(face);
+		pat->connectexec(bm, face, verts, &params);
+	}
+
+	/* copy original-geometry displacements to current coordinates */
+	BM_ITER_MESH (v, &viter, bm, BM_VERTS_OF_MESH) {
+		float *co = CustomData_bmesh_get_n(&bm->vdata, v->head.data, CD_SHAPEKEY, skey);
+		copy_v3_v3(v->co, co);
+	}
+
+	BM_data_layer_free_n(bm, &bm->vdata, CD_SHAPEKEY, skey);
+	
+	if (facedata) BLI_array_free(facedata);
+	if (edges) BLI_array_free(edges);
+	if (verts) BLI_array_free(verts);
+	BLI_array_free(splits);
+	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, "geomout", BM_ALL, ELE_INNER|ELE_SPLIT|SUBD_SPLIT);
+}
+
+/* editmesh-emulating function */
+void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
+                        float smooth, float fractal,
+                        int numcuts,
+                        int seltype, int cornertype,
+                        const short use_singleedge, const short use_gridfill,
+                        int seed)
+{
+	BMOperator op;
+	
+	/* use_sphere isnt exposed here since its only used for new primitives */
+	BMO_op_initf(bm, &op,
+	             "esubd edges=%he "
+	             "smooth=%f fractal=%f "
+	             "numcuts=%i "
+	             "quadcornertype=%i "
+	             "use_singleedge=%b use_gridfill=%b "
+	             "seed=%i",
+	             edge_hflag,
+	             smooth, fractal,
+	             numcuts,
+	             cornertype,
+	             use_singleedge, use_gridfill,
+	             seed);
+	
+	BMO_op_exec(bm, &op);
+	
+	if (seltype == SUBDIV_SELECT_INNER) {
+		BMOIter iter;
+		BMElem *ele;
+
+		for (ele = BMO_iter_new(&iter, bm, &op, "outinner", BM_EDGE | BM_VERT); ele; ele = BMO_iter_step(&iter)) {
+			BM_elem_select_set(bm, ele, TRUE);
+		}
+	}
+	else if (seltype == SUBDIV_SELECT_LOOPCUT) {
+		BMOIter iter;
+		BMElem *ele;
+		
+		/* 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)) {
+			BM_elem_select_set(bm, ele, TRUE);
+
+			if (ele->head.htype == BM_VERT) {
+				BMEdge *e;
+				BMIter eiter;
+
+				BM_ITER_ELEM (e, &eiter, ele, BM_EDGES_OF_VERT) {
+					if (!BM_elem_flag_test(e, BM_ELEM_SELECT) &&
+					     BM_elem_flag_test(e->v1, BM_ELEM_SELECT) &&
+					     BM_elem_flag_test(e->v2, BM_ELEM_SELECT))
+					{
+						BM_edge_select_set(bm, e, TRUE);
+					}
+					else if (BM_elem_flag_test(e, BM_ELEM_SELECT) &&
+					         (!BM_elem_flag_test(e->v1, BM_ELEM_SELECT) ||
+					          !BM_elem_flag_test(e->v2, BM_ELEM_SELECT)))
+					{
+						BM_edge_select_set(bm, e, FALSE);
+					}
+				}
+			}
+		}
+	}
+
+	BMO_op_finish(bm, &op);
+}
+
+void bmo_edgebisect_exec(BMesh *bm, BMOperator *op)
+{
+	BMOIter siter;
+	BMEdge *e;
+	SubDParams params = {0};
+	int skey;
+	
+	params.numcuts = BMO_slot_int_get(op, "numcuts");
+	params.op = op;
+	
+	BM_data_layer_add(bm, &bm->vdata, CD_SHAPEKEY);
+	skey = CustomData_number_of_layers(&bm->vdata, CD_SHAPEKEY) - 1;
+	
+	params.origkey = skey;
+
+	/* go through and split edges */
+	BMO_ITER (e, &siter, bm, op, "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);
+
+	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
new file mode 100644
index 0000000..cc6ced8
--- /dev/null
+++ b/source/blender/bmesh/operators/bmo_subdivide.h
@@ -0,0 +1,69 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/operators/bmo_subdivide.h
+ *  \ingroup bmesh
+ */
+
+#ifndef __BMO_SUBDIVIDE_H__
+#define __BMO_SUBDIVIDE_H__
+
+typedef struct SubDParams {
+	int numcuts;
+	float smooth;
+	float fractal;
+	//int beauty;
+	short use_smooth;
+	short use_sphere;
+	short use_fractal;
+	int seed;
+	int origkey; /* shapekey holding displaced vertex coordinates for current geometry */
+	BMOperator *op;
+	float off[3];
+} SubDParams;
+
+typedef void (*subd_pattern_fill_fp)(BMesh *bm, BMFace *face, BMVert **verts,
+                                     const SubDParams *params);
+
+/*
+ * note: this is a pattern-based edge subdivider.
+ * it tries to match a pattern to edge selections on faces,
+ * then executes functions to cut them.
+ */
+typedef struct SubDPattern {
+	int seledges[20]; /* selected edges mask, for splitting */
+
+	/* verts starts at the first new vert cut, not the first vert in the face */
+	subd_pattern_fill_fp connectexec;
+	int len; /* total number of verts, before any subdivision */
+} SubDPattern;
+
+/* generic subdivision rules:
+ *
+ * - two selected edges in a face should make a link
+ *   between them.
+ *
+ * - one edge should do, what? make pretty topology, or just
+ *   split the edge only?
+ */
+
+#endif /* __BMO_SUBDIVIDE_H__ */
diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c
new file mode 100644
index 0000000..7fd6cf6
--- /dev/null
+++ b/source/blender/bmesh/operators/bmo_triangulate.c
@@ -0,0 +1,221 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/operators/bmo_subdivide.c
+ *  \ingroup bmesh
+ */
+
+#include "MEM_guardedalloc.h"
+#include "DNA_listBase.h"
+
+#include "BLI_math.h"
+#include "BLI_array.h"
+#include "BLI_smallhash.h"
+#include "BLI_scanfill.h"
+
+#include "bmesh.h"
+#include "intern/bmesh_private.h"
+
+#include "intern/bmesh_operators_private.h" /* own include */
+
+#define EDGE_NEW	1
+#define FACE_NEW	1
+
+#define ELE_NEW		1
+#define FACE_MARK	2
+#define EDGE_MARK	4
+
+void bmo_triangulate_exec(BMesh *bm, BMOperator *op)
+{
+	BMOIter siter;
+	BMFace *face, **newfaces = NULL;
+	BLI_array_declare(newfaces);
+	float (*projectverts)[3] = NULL;
+	BLI_array_declare(projectverts);
+	int i;
+	const int use_beauty = BMO_slot_bool_get(op, "use_beauty");
+
+	for (face = BMO_iter_new(&siter, bm, op, "faces", BM_FACE); face; face = BMO_iter_step(&siter)) {
+
+		BLI_array_empty(projectverts);
+		BLI_array_empty(newfaces);
+
+		BLI_array_growitems(projectverts, face->len * 3);
+		BLI_array_growitems(newfaces, face->len);
+
+		BM_face_triangulate(bm, face, projectverts, EDGE_NEW, FACE_NEW, newfaces, use_beauty);
+
+		BMO_slot_map_ptr_insert(bm, op, "facemap", face, face);
+		for (i = 0; newfaces[i]; i++) {
+			BMO_slot_map_ptr_insert(bm, op, "facemap",
+			                        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);
+	
+	BLI_array_free(projectverts);
+	BLI_array_free(newfaces);
+}
+
+void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
+{
+	BMOIter siter;
+	BMIter iter;
+	BMFace *f;
+	BMEdge *e;
+	int stop = 0;
+	
+	BMO_slot_buffer_flag_enable(bm, op, "constrain_edges", BM_EDGE, EDGE_MARK);
+	
+	BMO_ITER (f, &siter, bm, op, "faces", BM_FACE) {
+		if (f->len == 3) {
+			BMO_elem_flag_enable(bm, f, FACE_MARK);
+		}
+	}
+
+	while (!stop) {
+		stop = 1;
+		
+		BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+			BMVert *v1, *v2, *v3, *v4;
+			
+			if (!BM_edge_is_manifold(e) || BMO_elem_flag_test(bm, e, EDGE_MARK)) {
+				continue;
+			}
+
+			if (!BMO_elem_flag_test(bm, e->l->f, FACE_MARK) ||
+			    !BMO_elem_flag_test(bm, e->l->radial_next->f, FACE_MARK))
+			{
+				continue;
+			}
+			
+			v1 = e->l->prev->v;
+			v2 = e->l->v;
+			v3 = e->l->radial_next->prev->v;
+			v4 = e->l->next->v;
+			
+			if (is_quad_convex_v3(v1->co, v2->co, v3->co, v4->co)) {
+				float len1, len2, len3, len4, len5, len6, opp1, opp2, fac1, fac2;
+				/* testing rule:
+				 * the area divided by the total edge lengths
+				 */
+				len1 = len_v3v3(v1->co, v2->co);
+				len2 = len_v3v3(v2->co, v3->co);
+				len3 = len_v3v3(v3->co, v4->co);
+				len4 = len_v3v3(v4->co, v1->co);
+				len5 = len_v3v3(v1->co, v3->co);
+				len6 = len_v3v3(v2->co, v4->co);
+
+				opp1 = area_tri_v3(v1->co, v2->co, v3->co);
+				opp2 = area_tri_v3(v1->co, v3->co, v4->co);
+
+				fac1 = opp1 / (len1 + len2 + len5) + opp2 / (len3 + len4 + len5);
+
+				opp1 = area_tri_v3(v2->co, v3->co, v4->co);
+				opp2 = area_tri_v3(v2->co, v4->co, v1->co);
+
+				fac2 = opp1 / (len2 + len3 + len6) + opp2 / (len4 + len1 + len6);
+				
+				if (fac1 > fac2) {
+					e = BM_edge_rotate(bm, e, FALSE, BM_EDGEROT_CHECK_EXISTS);
+					if (e) {
+						BMO_elem_flag_enable(bm, e, ELE_NEW);
+
+						BMO_elem_flag_enable(bm, e->l->f, FACE_MARK|ELE_NEW);
+						BMO_elem_flag_enable(bm, e->l->radial_next->f, FACE_MARK|ELE_NEW);
+						stop = 0;
+					}
+				}
+			}
+		}
+	}
+	
+	BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_EDGE|BM_FACE, ELE_NEW);
+}
+
+void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
+{
+	BMOIter siter;
+	BMEdge *e;
+	BMOperator bmop;
+	ScanFillContext sf_ctx;
+	/* ScanFillEdge *eed; */ /* UNUSED */
+	ScanFillVert *eve, *v1, *v2;
+	ScanFillFace *efa;
+	SmallHash hash;
+
+	BLI_smallhash_init(&hash);
+	
+	BLI_begin_edgefill(&sf_ctx);
+	
+	BMO_ITER (e, &siter, bm, op, "edges", BM_EDGE) {
+		BMO_elem_flag_enable(bm, e, EDGE_MARK);
+		
+		if (!BLI_smallhash_haskey(&hash, (uintptr_t)e->v1)) {
+			eve = BLI_addfillvert(&sf_ctx, e->v1->co);
+			eve->tmp.p = e->v1;
+			BLI_smallhash_insert(&hash, (uintptr_t)e->v1, eve);
+		}
+		
+		if (!BLI_smallhash_haskey(&hash, (uintptr_t)e->v2)) {
+			eve = BLI_addfillvert(&sf_ctx, e->v2->co);
+			eve->tmp.p = e->v2;
+			BLI_smallhash_insert(&hash, (uintptr_t)e->v2, eve);
+		}
+		
+		v1 = BLI_smallhash_lookup(&hash, (uintptr_t)e->v1);
+		v2 = BLI_smallhash_lookup(&hash, (uintptr_t)e->v2);
+		/* eed = */ BLI_addfilledge(&sf_ctx, v1, v2);
+		/* eed->tmp.p = e; */ /* UNUSED */
+	}
+	
+	BLI_edgefill(&sf_ctx, FALSE);
+	
+	for (efa = sf_ctx.fillfacebase.first; efa; efa = efa->next) {
+		BMFace *f = BM_face_create_quad_tri(bm,
+		                                    efa->v1->tmp.p, efa->v2->tmp.p, efa->v3->tmp.p, NULL,
+		                                    NULL, TRUE);
+		BMLoop *l;
+		BMIter liter;
+		
+		BMO_elem_flag_enable(bm, f, ELE_NEW);
+		BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+			if (!BMO_elem_flag_test(bm, l->e, EDGE_MARK)) {
+				BMO_elem_flag_enable(bm, l->e, ELE_NEW);
+			}
+		}
+	}
+	
+	BLI_end_edgefill(&sf_ctx);
+	BLI_smallhash_release(&hash);
+	
+	/* clean up fill */
+	BMO_op_initf(bm, &bmop, "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_op_finish(bm, &bmop);
+	
+	BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_EDGE|BM_FACE, ELE_NEW);
+}
diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c
new file mode 100644
index 0000000..3cfa70f
--- /dev/null
+++ b/source/blender/bmesh/operators/bmo_utils.c
@@ -0,0 +1,1271 @@
+/*
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/operators/bmo_subdivide.c
+ *  \ingroup bmesh
+ *
+ * utility bmesh operators, e.g. transform,
+ * translate, rotate, scale, etc.
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_meshdata_types.h"
+
+#include "BLI_math.h"
+#include "BLI_array.h"
+#include "BLI_heap.h"
+
+#include "BKE_customdata.h"
+
+#include "bmesh.h"
+
+#include "intern/bmesh_operators_private.h" /* own include */
+
+void bmo_makevert_exec(BMesh *bm, BMOperator *op)
+{
+	float vec[3];
+
+	BMO_slot_vec_get(op, "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);
+}
+
+void bmo_transform_exec(BMesh *bm, BMOperator *op)
+{
+	BMOIter iter;
+	BMVert *v;
+	float mat[4][4];
+
+	BMO_slot_mat4_get(op, "mat", mat);
+
+	BMO_ITER (v, &iter, bm, op, "verts", BM_VERT) {
+		mul_m4_v3(mat, v->co);
+	}
+}
+
+void bmo_translate_exec(BMesh *bm, BMOperator *op)
+{
+	float mat[4][4], vec[3];
+	
+	BMO_slot_vec_get(op, "vec", vec);
+
+	unit_m4(mat);
+	copy_v3_v3(mat[3], vec);
+
+	BMO_op_callf(bm, "transform mat=%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);
+
+	unit_m3(mat);
+	mat[0][0] = vec[0];
+	mat[1][1] = vec[1];
+	mat[2][2] = vec[2];
+
+	BMO_op_callf(bm, "transform mat=%m3 verts=%s", mat, op, "verts");
+}
+
+void bmo_rotate_exec(BMesh *bm, BMOperator *op)
+{
+	float vec[3];
+	
+	BMO_slot_vec_get(op, "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
+	 * through the math right now. */
+	mul_v3_fl(vec, -1.0f);
+	BMO_op_callf(bm, "translate verts=%s vec=%v", op, "verts", vec);
+
+	BMO_op_callf(bm, "transform mat=%s verts=%s", op, "mat", op, "verts");
+
+	mul_v3_fl(vec, -1.0f);
+	BMO_op_callf(bm, "translate verts=%s vec=%v", op, "verts", vec);
+}
+
+void bmo_reversefaces_exec(BMesh *bm, BMOperator *op)
+{
+	BMOIter siter;
+	BMFace *f;
+
+	BMO_ITER (f, &siter, bm, op, "faces", BM_FACE) {
+		BM_face_normal_flip(bm, f);
+	}
+}
+
+void bmo_edgerotate_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;
+	short check_flag = is_single ?
+	            BM_EDGEROT_CHECK_EXISTS :
+	            BM_EDGEROT_CHECK_EXISTS | BM_EDGEROT_CHECK_DEGENERATE;
+
+#define EDGE_OUT   1
+#define FACE_TAINT 1
+
+	BMO_ITER (e, &siter, bm, op, "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 */
+		if (BM_edge_rotate_check(e)) {
+			BMFace *fa, *fb;
+			if (BM_edge_face_pair(e, &fa, &fb)) {
+
+				/* check we're untouched */
+				if (BMO_elem_flag_test(bm, fa, FACE_TAINT) == FALSE &&
+				    BMO_elem_flag_test(bm, fb, FACE_TAINT) == FALSE)
+				{
+
+					if (!(e2 = BM_edge_rotate(bm, e, ccw, check_flag))) {
+#if 0
+						BMO_error_raise(bm, op, BMERR_INVALID_SELECTION, "Could not rotate edge");
+						return;
+#endif
+						continue;
+					}
+
+					BMO_elem_flag_enable(bm, e2, EDGE_OUT);
+
+					/* don't touch again */
+					BMO_elem_flag_enable(bm, fa, FACE_TAINT);
+					BMO_elem_flag_enable(bm, fb, FACE_TAINT);
+				}
+			}
+		}
+	}
+
+	BMO_slot_buffer_from_enabled_flag(bm, op, "edgeout", BM_EDGE, EDGE_OUT);
+
+#undef EDGE_OUT
+#undef FACE_TAINT
+
+}
+
+#define SEL_FLAG	1
+#define SEL_ORIG	2
+
+static void bmo_regionextend_extend(BMesh *bm, BMOperator *op, int usefaces)
+{
+	BMVert *v;
+	BMEdge *e;
+	BMIter eiter;
+	BMOIter siter;
+
+	if (!usefaces) {
+		BMO_ITER (v, &siter, bm, op, "geom", BM_VERT) {
+			BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
+				if (!BMO_elem_flag_test(bm, e, SEL_ORIG))
+					break;
+			}
+
+			if (e) {
+				BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
+					BMO_elem_flag_enable(bm, e, SEL_FLAG);
+					BMO_elem_flag_enable(bm, BM_edge_other_vert(e, v), SEL_FLAG);
+				}
+			}
+		}
+	}
+	else {
+		BMIter liter, fiter;
+		BMFace *f, *f2;
+		BMLoop *l;
+
+		BMO_ITER (f, &siter, bm, op, "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 (!BMO_elem_flag_test(bm, f2, SEL_ORIG)) {
+						BMO_elem_flag_enable(bm, f2, SEL_FLAG);
+					}
+				}
+			}
+		}
+	}
+}
+
+static void bmo_regionextend_constrict(BMesh *bm, BMOperator *op, int usefaces)
+{
+	BMVert *v;
+	BMEdge *e;
+	BMIter eiter;
+	BMOIter siter;
+
+	if (!usefaces) {
+		BMO_ITER (v, &siter, bm, op, "geom", BM_VERT) {
+			BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
+				if (!BMO_elem_flag_test(bm, e, SEL_ORIG))
+					break;
+			}
+
+			if (e) {
+				BMO_elem_flag_enable(bm, v, SEL_FLAG);
+
+				BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
+					BMO_elem_flag_enable(bm, e, SEL_FLAG);
+				}
+
+			}
+		}
+	}
+	else {
+		BMIter liter, fiter;
+		BMFace *f, *f2;
+		BMLoop *l;
+
+		BMO_ITER (f, &siter, bm, op, "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 (!BMO_elem_flag_test(bm, f2, SEL_ORIG)) {
+						BMO_elem_flag_enable(bm, f, SEL_FLAG);
+						break;
+					}
+				}
+			}
+		}
+	}
+}
+
+void bmo_regionextend_exec(BMesh *bm, BMOperator *op)
+{
+	int use_faces = BMO_slot_bool_get(op, "use_faces");
+	int constrict = BMO_slot_bool_get(op, "constrict");
+
+	BMO_slot_buffer_flag_enable(bm, op, "geom", BM_ALL, SEL_ORIG);
+
+	if (constrict)
+		bmo_regionextend_constrict(bm, op, use_faces);
+	else
+		bmo_regionextend_extend(bm, op, use_faces);
+
+	BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_ALL, SEL_FLAG);
+}
+
+/********* righthand faces implementation ****** */
+
+#define FACE_VIS	1
+#define FACE_FLAG	2
+#define FACE_MARK	4
+#define FACE_FLIP	8
+
+/* NOTE: these are the original righthandfaces comment in editmesh_mods.c,
+ *       copied here for reference. */
+
+/* based at a select-connected to witness loose objects */
+
+/* count per edge the amount of faces
+ * find the ultimate left, front, upper face (not manhattan dist!!)
+ * also evaluate both triangle cases in quad, since these can be non-flat
+ *
+ * put normal to the outside, and set the first direction flags in edges
+ *
+ * then check the object, and set directions / direction-flags: but only for edges with 1 or 2 faces
+ * this is in fact the 'select connected'
+ *
+ * in case (selected) faces were not done: start over with 'find the ultimate ...' */
+
+/* NOTE: this function uses recursion, which is a little unusual for a bmop
+ *       function, but acceptable I think. */
+
+/* NOTE: BM_ELEM_TAG is used on faces to tell if they are flipped. */
+
+void bmo_righthandfaces_exec(BMesh *bm, BMOperator *op)
+{
+	BMIter liter, liter2;
+	BMOIter siter;
+	BMFace *f, *startf, **fstack = NULL;
+	BLI_array_declare(fstack);
+	BMLoop *l, *l2;
+	float maxx, maxx_test, cent[3];
+	int i, maxi, flagflip = BMO_slot_bool_get(op, "do_flip");
+
+	startf = NULL;
+	maxx = -1.0e10;
+	
+	BMO_slot_buffer_flag_enable(bm, op, "faces", BM_FACE, FACE_FLAG);
+
+	/* find a starting face */
+	BMO_ITER (f, &siter, bm, op, "faces", BM_FACE) {
+
+		/* clear dirty flag */
+		BM_elem_flag_disable(f, BM_ELEM_TAG);
+
+		if (BMO_elem_flag_test(bm, f, FACE_VIS))
+			continue;
+
+		if (!startf) startf = f;
+
+		BM_face_calc_center_bounds(f, cent);
+
+		if ((maxx_test = dot_v3v3(cent, cent)) > maxx) {
+			maxx = maxx_test;
+			startf = f;
+		}
+	}
+
+	if (!startf) return;
+
+	BM_face_calc_center_bounds(startf, cent);
+
+	/* make sure the starting face has the correct winding */
+	if (dot_v3v3(cent, startf->no) < 0.0f) {
+		BM_face_normal_flip(bm, startf);
+		BMO_elem_flag_toggle(bm, startf, FACE_FLIP);
+
+		if (flagflip)
+			BM_elem_flag_toggle(startf, BM_ELEM_TAG);
+	}
+	
+	/* now that we've found our starting face, make all connected faces
+	 * have the same winding.  this is done recursively, using a manual
+	 * stack (if we use simple function recursion, we'd end up overloading
+	 * the stack on large meshes). */
+
+	BLI_array_growone(fstack);
+	fstack[0] = startf;
+	BMO_elem_flag_enable(bm, startf, FACE_VIS);
+
+	i = 0;
+	maxi = 1;
+	while (i >= 0) {
+		f = fstack[i];
+		i--;
+
+		BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+			BM_ITER_ELEM (l2, &liter2, l, BM_LOOPS_OF_LOOP) {
+				if (!BMO_elem_flag_test(bm, l2->f, FACE_FLAG) || l2 == l)
+					continue;
+
+				if (!BMO_elem_flag_test(bm, l2->f, FACE_VIS)) {
+					BMO_elem_flag_enable(bm, l2->f, FACE_VIS);
+					i++;
+					
+					if (l2->v == l->v) {
+						BM_face_normal_flip(bm, l2->f);
+						
+						BMO_elem_flag_toggle(bm, l2->f, FACE_FLIP);
+						if (flagflip)
+							BM_elem_flag_toggle(l2->f, BM_ELEM_TAG);
+					}
+					else if (BM_elem_flag_test(l2->f, BM_ELEM_TAG) || BM_elem_flag_test(l->f, BM_ELEM_TAG)) {
+						if (flagflip) {
+							BM_elem_flag_disable(l->f, BM_ELEM_TAG);
+							BM_elem_flag_disable(l2->f, BM_ELEM_TAG);
+						}
+					}
+					
+					if (i == maxi) {
+						BLI_array_growone(fstack);
+						maxi++;
+					}
+
+					fstack[i] = l2->f;
+				}
+			}
+		}
+	}
+
+	BLI_array_free(fstack);
+
+	/* check if we have faces yet to do.  if so, recurse */
+	BMO_ITER (f, &siter, bm, op, "faces", BM_FACE) {
+		if (!BMO_elem_flag_test(bm, f, FACE_VIS)) {
+			bmo_righthandfaces_exec(bm, op);
+			break;
+		}
+	}
+}
+
+void bmo_vertexsmooth_exec(BMesh *bm, BMOperator *op)
+{
+	BMOIter siter;
+	BMIter iter;
+	BMVert *v;
+	BMEdge *e;
+	BLI_array_declare(cos);
+	float (*cos)[3] = NULL;
+	float *co, *co2, clipdist = BMO_slot_float_get(op, "clipdist");
+	int i, j, clipx, clipy, clipz;
+	
+	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");
+
+	i = 0;
+	BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
+		BLI_array_growone(cos);
+		co = cos[i];
+		
+		j  = 0;
+		BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
+			co2 = BM_edge_other_vert(e, v)->co;
+			add_v3_v3v3(co, co, co2);
+			j += 1;
+		}
+		
+		if (!j) {
+			copy_v3_v3(co, v->co);
+			i++;
+			continue;
+		}
+
+		mul_v3_fl(co, 1.0f / (float)j);
+		mid_v3_v3v3(co, co, v->co);
+
+		if (clipx && fabsf(v->co[0]) <= clipdist)
+			co[0] = 0.0f;
+		if (clipy && fabsf(v->co[1]) <= clipdist)
+			co[1] = 0.0f;
+		if (clipz && fabsf(v->co[2]) <= clipdist)
+			co[2] = 0.0f;
+
+		i++;
+	}
+
+	i = 0;
+	BMO_ITER (v, &siter, bm, op, "verts", BM_VERT) {
+		copy_v3_v3(v->co, cos[i]);
+		i++;
+	}
+
+	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_similarfaces_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");
+	float thresh = BMO_slot_float_get(op, "thresh");
+
+	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 originaly 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 = RAD2DEGF(angle_v3v3(fs->no, fm->no));	/* if the angle between the normals -> 0 */
+						if (angle / 180.0f <= thresh) {
+							BMO_elem_flag_enable(bm, fm, FACE_MARK);
+							cont = FALSE;
+						}
+						break;
+
+					case SIMFACE_COPLANAR:
+						angle = RAD2DEGF(angle_v3v3(fs->no, fm->no)); /* angle -> 0 */
+						if (angle / 180.0f <= thresh) { /* 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_similaredges_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");
+	float thresh = BMO_slot_float_get(op, "thresh");
+
+	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, "indices util.c");
+	e_ext = (SimSel_EdgeExt *)MEM_callocN(sizeof(SimSel_EdgeExt) * num_total, "e_ext util.c");
+
+	/* 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);
+					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 = RAD2DEGF(angle_v3v3(e_ext[i].dir, e_ext[indices[idx]].dir));
+
+						if (angle > 90.0f) /* use the smallest angle between the edges */
+							angle = fabsf(angle - 180.0f);
+
+						if (angle / 90.0f <= 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:
+						if (CustomData_has_layer(&bm->edata, CD_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 (c1 && c2 && 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 */
+		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_similarverts_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");
+	float thresh = BMO_slot_float_get(op, "thresh");
+
+	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;
+		}
+
+		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 (RAD2DEGF(angle_v3v3(v->no, vs->no)) / 180.0f <= thresh) {
+							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;
+				}
+			}
+		}
+	}
+
+	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_face_rotateuvs_exec(BMesh *bm, BMOperator *op)
+{
+	BMOIter fs_iter;	/* selected faces iterator */
+	BMFace *fs;	/* current face */
+	BMIter l_iter;	/* iteration loop */
+	// int n;
+
+	int dir = BMO_slot_int_get(op, "dir");
+
+	BMO_ITER (fs, &fs_iter, bm, op, "faces", BM_FACE) {
+		if (CustomData_has_layer(&(bm->ldata), CD_MLOOPUV)) {
+			if (dir == DIRECTION_CW) { /* same loops direction */
+				BMLoop *lf;	/* current face loops */
+				MLoopUV *f_luv; /* first face loop uv */
+				float p_uv[2];	/* previous uvs */
+				float t_uv[2];	/* tmp uvs */
+
+				int n = 0;
+				BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) {
+					/* current loop uv is the previous loop uv */
+					MLoopUV *luv = CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPUV);
+					if (n == 0) {
+						f_luv = luv;
+						copy_v2_v2(p_uv, luv->uv);
+					}
+					else {
+						copy_v2_v2(t_uv, luv->uv);
+						copy_v2_v2(luv->uv, p_uv);
+						copy_v2_v2(p_uv, t_uv);
+					}
+					n++;
+				}
+
+				copy_v2_v2(f_luv->uv, p_uv);
+			}
+			else if (dir == DIRECTION_CCW) { /* counter loop direction */
+				BMLoop *lf;	/* current face loops */
+				MLoopUV *p_luv; /* previous loop uv */
+				MLoopUV *luv;
+				float t_uv[2];	/* current uvs */
+
+				int n = 0;
+				BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) {
+					/* previous loop uv is the current loop uv */
+					luv = CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPUV);
+					if (n == 0) {
+						p_luv = luv;
+						copy_v2_v2(t_uv, luv->uv);
+					}
+					else {
+						copy_v2_v2(p_luv->uv, luv->uv);
+						p_luv = luv;
+					}
+					n++;
+				}
+
+				copy_v2_v2(luv->uv, t_uv);
+			}
+		}
+	}
+
+}
+
+/**************************************************************************** *
+ * Reverse UVs for a face
+ **************************************************************************** */
+
+void bmo_face_reverseuvs_exec(BMesh *bm, BMOperator *op)
+{
+	BMOIter fs_iter;	/* selected faces iterator */
+	BMFace *fs;		/* current face */
+	BMIter l_iter;		/* iteration loop */
+	BLI_array_declare(uvs);
+	float (*uvs)[2] = NULL;
+
+	BMO_ITER (fs, &fs_iter, bm, op, "faces", BM_FACE) {
+		if (CustomData_has_layer(&(bm->ldata), CD_MLOOPUV)) {
+			BMLoop *lf;	/* current face loops */
+			int i;
+
+			BLI_array_empty(uvs);
+			BLI_array_growitems(uvs, fs->len);
+
+			BM_ITER_ELEM_INDEX (lf, &l_iter, fs, BM_LOOPS_OF_FACE, i) {
+				MLoopUV *luv = CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPUV);
+
+				/* current loop uv is the previous loop uv */
+				copy_v2_v2(uvs[i], luv->uv);
+			}
+
+			/* now that we have the uvs in the array, reverse! */
+			i = 0;
+			BM_ITER_ELEM_INDEX (lf, &l_iter, fs, BM_LOOPS_OF_FACE, i) {
+				/* current loop uv is the previous loop uv */
+				MLoopUV *luv = CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPUV);
+				copy_v2_v2(luv->uv, uvs[(fs->len - i - 1)]);
+			}
+		}
+	}
+
+	BLI_array_free(uvs);
+}
+
+/**************************************************************************** *
+ * Cycle colors for a face
+ **************************************************************************** */
+
+void bmo_rotatecolors_exec(BMesh *bm, BMOperator *op)
+{
+	BMOIter fs_iter;	/* selected faces iterator */
+	BMFace *fs;	/* current face */
+	BMIter l_iter;	/* iteration loop */
+	// int n;
+
+	int dir = BMO_slot_int_get(op, "dir");
+
+	BMO_ITER (fs, &fs_iter, bm, op, "faces", BM_FACE) {
+		if (CustomData_has_layer(&(bm->ldata), CD_MLOOPCOL)) {
+			if (dir == DIRECTION_CW) { /* same loops direction */
+				BMLoop *lf;	/* current face loops */
+				MLoopCol *f_lcol; /* first face loop color */
+				MLoopCol p_col;	/* previous color */
+				MLoopCol t_col;	/* tmp color */
+
+				int n = 0;
+				BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) {
+					/* current loop color is the previous loop color */
+					MLoopCol *luv = CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPCOL);
+					if (n == 0) {
+						f_lcol = luv;
+						p_col = *luv;
+					}
+					else {
+						t_col = *luv;
+						*luv = p_col;
+						p_col = t_col;
+					}
+					n++;
+				}
+
+				*f_lcol = p_col;
+			}
+			else if (dir == DIRECTION_CCW) { /* counter loop direction */
+				BMLoop *lf;	/* current face loops */
+				MLoopCol *p_lcol; /* previous loop color */
+				MLoopCol *lcol;
+				MLoopCol t_col;	/* current color */
+
+				int n = 0;
+				BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) {
+					/* previous loop color is the current loop color */
+					lcol = CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPCOL);
+					if (n == 0) {
+						p_lcol = lcol;
+						t_col = *lcol;
+					}
+					else {
+						*p_lcol = *lcol;
+						p_lcol = lcol;
+					}
+					n++;
+				}
+
+				*lcol = t_col;
+			}
+		}
+	}
+}
+
+/*************************************************************************** *
+ * Reverse colors for a face
+ *************************************************************************** */
+
+void bmo_face_reversecolors_exec(BMesh *bm, BMOperator *op)
+{
+	BMOIter fs_iter;	/* selected faces iterator */
+	BMFace *fs;		/* current face */
+	BMIter l_iter;		/* iteration loop */
+	BLI_array_declare(cols);
+	MLoopCol *cols = NULL;
+
+	BMO_ITER (fs, &fs_iter, bm, op, "faces", BM_FACE) {
+		if (CustomData_has_layer(&(bm->ldata), CD_MLOOPCOL)) {
+			BMLoop *lf;	/* current face loops */
+			int i;
+
+			BLI_array_empty(cols);
+			BLI_array_growitems(cols, fs->len);
+
+			BM_ITER_ELEM_INDEX (lf, &l_iter, fs, BM_LOOPS_OF_FACE, i) {
+				cols[i] = *((MLoopCol *)CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPCOL));
+			}
+
+			/* now that we have the uvs in the array, reverse! */
+			BM_ITER_ELEM_INDEX (lf, &l_iter, fs, BM_LOOPS_OF_FACE, i) {
+				/* current loop uv is the previous loop color */
+				MLoopCol *lcol = CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPCOL);
+				*lcol = cols[(fs->len - i - 1)];
+			}
+		}
+	}
+
+	BLI_array_free(cols);
+}
+
+
+/*************************************************************************** *
+ * shortest vertex path select
+ *************************************************************************** */
+
+typedef struct ElemNode {
+	BMVert *v;	/* vertex */
+	BMVert *parent;	/* node parent id */
+	float weight;	/* node weight */
+	HeapNode *hn;	/* heap node */
+} ElemNode;
+
+void bmo_vertexshortestpath_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 *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");
+
+	BMO_ITER (vs, &vs_iter, bm, op, "startv", BM_VERT) {
+		sv = vs;
+	}
+	BMO_ITER (vs, &vs_iter, bm, op, "endv", BM_VERT) {
+		ev = vs;
+	}
+
+	num_total = BM_mesh_elem_count(bm, BM_VERT);
+
+	/* allocate memory for the nodes */
+	vert_list = (ElemNode *)MEM_mallocN(sizeof(ElemNode) * num_total, "vertex nodes");
+
+	/* iterate through all the mesh vertices */
+	/* loop through all the vertices and fill the vertices/indices structure */
+	i = 0;
+	BM_ITER_MESH (v, &v_iter, bm, BM_VERTS_OF_MESH) {
+		vert_list[i].v = v;
+		vert_list[i].parent = NULL;
+		vert_list[i].weight = FLT_MAX;
+		BM_elem_index_set(v, i); /* set_inline */
+		i++;
+	}
+	bm->elem_index_dirty &= ~BM_VERT;
+
+	/*
+	 * we now have everything we need, start Dijkstra path finding algorithm
+	 */
+
+	/* set the distance/weight of the start vertex to 0 */
+	vert_list[BM_elem_index_get(sv)].weight = 0.0f;
+
+	h = BLI_heap_new();
+
+	for (i = 0; i < num_total; i++) {
+		vert_list[i].hn = BLI_heap_insert(h, vert_list[i].weight, vert_list[i].v);
+	}
+
+	while (!BLI_heap_empty(h)) {
+		BMEdge *e;
+		BMIter e_i;
+		float v_weight;
+
+		/* take the vertex with the lowest weight out of the heap */
+		BMVert *v = (BMVert *)BLI_heap_popmin(h);
+
+		if (vert_list[BM_elem_index_get(v)].weight == FLT_MAX) /* this means that there is no path */
+			break;
+
+		v_weight = vert_list[BM_elem_index_get(v)].weight;
+
+		BM_ITER_ELEM (e, &e_i, v, BM_EDGES_OF_VERT) {
+			BMVert *u;
+			float e_weight = v_weight;
+
+			if (type == VPATH_SELECT_EDGE_LENGTH)
+				e_weight += len_v3v3(e->v1->co, e->v2->co);
+			else e_weight += 1.0f;
+
+			u = (e->v1 == v) ? e->v2 : e->v1;
+
+			if (e_weight < vert_list[BM_elem_index_get(u)].weight) { /* is this path shorter ? */
+				/* add it if so */
+				vert_list[BM_elem_index_get(u)].parent = v;
+				vert_list[BM_elem_index_get(u)].weight = e_weight;
+
+				/* we should do a heap update node function!!! :-/ */
+				BLI_heap_remove(h, vert_list[BM_elem_index_get(u)].hn);
+				BLI_heap_insert(h, e_weight, u);
+			}
+		}
+	}
+
+	/* now we trace the path (if it exists) */
+	v = ev;
+
+	while (vert_list[BM_elem_index_get(v)].parent != NULL) {
+		BMO_elem_flag_enable(bm, v, VERT_MARK);
+		v = vert_list[BM_elem_index_get(v)].parent;
+	}
+
+	BLI_heap_free(h, NULL);
+	MEM_freeN(vert_list);
+
+	BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
+}
diff --git a/source/blender/bmesh/tools/BME_bevel.c b/source/blender/bmesh/tools/BME_bevel.c
new file mode 100644
index 0000000..a357767
--- /dev/null
+++ b/source/blender/bmesh/tools/BME_bevel.c
@@ -0,0 +1,1152 @@
+/*
+ * ***** 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) 2004 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Geoffrey Bantle and Levi Schooley.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <math.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_listBase.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_mesh_types.h"
+
+#include "BLI_math.h"
+#include "BLI_blenlib.h"
+#include "BLI_ghash.h"
+#include "BLI_memarena.h"
+
+#include "BKE_utildefines.h"
+#include "BKE_tessmesh.h"
+#include "BKE_bmesh.h"
+
+#include "bmesh.h"
+#include "intern/bmesh_private.h"
+
+/* BMESH_TODO
+ *
+ * Date: 2011-11-24 06:25
+ * Sender: Andrew Wiggin
+ * Status update: I have code changes to actually make basic bevel modifier work. The things that still need to be done:
+ * - clean up the changes
+ * - get bevel by weight and bevel by angles working for vertex only bevel.
+ * - the code uses adaptations of a couple of bmesh APIs,
+ * that work a little differently. for example, a join faces that doesn't just create a new face and then delete the
+ * original two faces and all associated loops, it extends one of the original faces to cover all the original loops
+ * (except for the loop on the join edge which is of course deleted). the bevel code currently requires this because it
+ * expects to be able to continue walking loop lists and doesn't like for loops to be deleted out from under it
+ * while working...
+ * but bmesh APIs don't do it this way because it makes it trickier to manage the interp during these operations,
+ * so I need to decide what to do in these cases.
+ */
+
+/* BMESH_TODO - resolve this */
+#define BMESH_263_VERT_BEVEL_WORKAROUND
+
+/* ------- Bevel code starts here -------- */
+
+BME_TransData_Head *BME_init_transdata(int bufsize)
+{
+	BME_TransData_Head *td;
+
+	td = MEM_callocN(sizeof(BME_TransData_Head), "BM transdata header");
+	td->gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "BME_init_transdata gh");
+	td->ma = BLI_memarena_new(bufsize, "BME_TransData arena");
+	BLI_memarena_use_calloc(td->ma);
+
+	return td;
+}
+
+void BME_free_transdata(BME_TransData_Head *td)
+{
+	BLI_ghash_free(td->gh, NULL, NULL);
+	BLI_memarena_free(td->ma);
+	MEM_freeN(td);
+}
+
+BME_TransData *BME_assign_transdata(BME_TransData_Head *td, BMesh *bm, BMVert *v,
+                                    float *co, float *org, float *vec, float *loc,
+                                    float factor, float weight, float maxfactor, float *max)
+{
+	BME_TransData *vtd;
+	int is_new = 0;
+
+	if (v == NULL) {
+		return NULL;
+	}
+
+	if ((vtd = BLI_ghash_lookup(td->gh, v)) == NULL && bm != NULL) {
+		vtd = BLI_memarena_alloc(td->ma, sizeof(*vtd));
+		BLI_ghash_insert(td->gh, v, vtd);
+		td->len++;
+		is_new = 1;
+	}
+
+	vtd->bm = bm;
+	vtd->v = v;
+
+	if (co != NULL) {
+		copy_v3_v3(vtd->co, co);
+	}
+
+	if (org == NULL && is_new) {
+		copy_v3_v3(vtd->org, v->co); /* default */
+	}
+	else if (org != NULL) {
+		copy_v3_v3(vtd->org, org);
+	}
+
+	if (vec != NULL) {
+		copy_v3_v3(vtd->vec, vec);
+		normalize_v3(vtd->vec);
+	}
+
+	vtd->loc = loc;
+
+	vtd->factor = factor;
+	vtd->weight = weight;
+	vtd->maxfactor = maxfactor;
+	vtd->max = max;
+
+	return vtd;
+}
+
+BME_TransData *BME_get_transdata(BME_TransData_Head *td, BMVert *v)
+{
+	BME_TransData *vtd;
+	vtd = BLI_ghash_lookup(td->gh, v);
+	return vtd;
+}
+
+/* a hack (?) to use the transdata memarena to allocate floats for use with the max limits */
+float *BME_new_transdata_float(BME_TransData_Head *td)
+{
+	return BLI_memarena_alloc(td->ma, sizeof(float));
+}
+
+/* ported from before bmesh merge into trunk (was called)
+ * problem with this is it creates 2 vert faces */
+static void BME_Bevel_Dissolve_Disk(BMesh *bm, BMVert *v)
+{
+	BMFace *f;
+	BMEdge *e;
+	int done;
+
+	if (v->e) {
+		done = 0;
+		while (!done) {
+			done = 1;
+			e = v->e; /*loop the edge looking for a edge to dissolve*/
+			do {
+				f = NULL;
+				if (BM_edge_is_manifold(e)) {
+					f = bmesh_jfke(bm, e->l->f, e->l->radial_next->f, e);
+				}
+				if (f) {
+					done = 0;
+					break;
+				}
+				e = bmesh_disk_edge_next(e, v);
+			} while (e != v->e);
+		}
+		BM_vert_collapse_edge(bm, v->e, v, TRUE);
+		// bmesh_jekv(bm, v->e, v, FALSE);
+	}
+}
+
+static int BME_bevel_is_split_vert(BMesh *bm, BMLoop *l)
+{
+	/* look for verts that have already been added to the edge when
+	 * beveling other polys; this can be determined by testing the
+	 * vert and the edges around it for originality
+	 */
+	if (!BMO_elem_flag_test(bm, l->v, BME_BEVEL_ORIG) &&
+	    BMO_elem_flag_test(bm, l->e, BME_BEVEL_ORIG) &&
+	    BMO_elem_flag_test(bm, l->prev->e, BME_BEVEL_ORIG))
+	{
+		return 1;
+	}
+	return 0;
+}
+
+/* get a vector, vec, that points from v1->co to wherever makes sense to
+ * the bevel operation as a whole based on the relationship between v1 and v2
+ * (won't necessarily be a vec from v1->co to v2->co, though it probably will be);
+ * the return value is -1 for failure, 0 if we used vert co's, and 1 if we used transform origins */
+static int BME_bevel_get_vec(float *vec, BMVert *v1, BMVert *v2, BME_TransData_Head *td)
+{
+	BME_TransData *vtd1, *vtd2;
+
+	vtd1 = BME_get_transdata(td, v1);
+	vtd2 = BME_get_transdata(td, v2);
+	if (!vtd1 || !vtd2) {
+		//printf("BME_bevel_get_vec() got called without proper BME_TransData\n");
+		return -1;
+	}
+
+	/* compare the transform origins to see if we can use the vert co's;
+	 * if they belong to different origins, then we will use the origins to determine
+	 * the vector */
+	if (compare_v3v3(vtd1->org, vtd2->org, 0.000001f)) {
+		sub_v3_v3v3(vec, v2->co, v1->co);
+		if (len_v3(vec) < 0.000001f) {
+			zero_v3(vec);
+		}
+		return 0;
+	}
+	else {
+		sub_v3_v3v3(vec, vtd2->org, vtd1->org);
+		if (len_v3(vec) < 0.000001f) {
+			zero_v3(vec);
+		}
+		return 1;
+	}
+}
+
+/* "Projects" a vector perpendicular to vec2 against vec1, such that
+ * the projected vec1 + vec2 has a min distance of 1 from the "edge" defined by vec2.
+ * note: the direction, is_forward, is used in conjunction with up_vec to determine
+ * whether this is a convex or concave corner. If it is a concave corner, it will
+ * be projected "backwards." If vec1 is before vec2, is_forward should be 0 (we are projecting backwards).
+ * vec1 is the vector to project onto (expected to be normalized)
+ * vec2 is the direction of projection (pointing away from vec1)
+ * up_vec is used for orientation (expected to be normalized)
+ * returns the length of the projected vector that lies along vec1 */
+static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec, int is_forward, BME_TransData_Head *UNUSED(td))
+{
+	float factor, vec3[3], tmp[3], c1, c2;
+
+	cross_v3_v3v3(tmp, vec1, vec2);
+	normalize_v3(tmp);
+	factor = dot_v3v3(up_vec, tmp);
+	if ((factor > 0 && is_forward) || (factor < 0 && !is_forward)) {
+		cross_v3_v3v3(vec3, vec2, tmp); /* hmm, maybe up_vec should be used instead of tmp */
+	}
+	else {
+		cross_v3_v3v3(vec3, tmp, vec2); /* hmm, maybe up_vec should be used instead of tmp */
+	}
+	normalize_v3(vec3);
+	c1 = dot_v3v3(vec3, vec1);
+	c2 = dot_v3v3(vec1, vec1);
+	if (fabsf(c1) < 0.000001f || fabsf(c2) < 0.000001f) {
+		factor = 0.0f;
+	}
+	else {
+		factor = c2 / c1;
+	}
+
+	return factor;
+}
+
+/* BME_bevel_split_edge() is the main math work-house; its responsibilities are:
+ * using the vert and the loop passed, get or make the split vert, set its coordinates
+ * and transform properties, and set the max limits.
+ * Finally, return the split vert. */
+static BMVert *BME_bevel_split_edge(BMesh *bm, BMVert *v, BMVert *v1, BMLoop *l, float *up_vec, float value, BME_TransData_Head *td)
+{
+	BME_TransData *vtd, *vtd1, *vtd2;
+	BMVert *sv, *v2, *v3, *ov;
+	BMLoop *lv1, *lv2;
+	BMEdge *ne, *e1, *e2;
+	float maxfactor, scale, len, dis, vec1[3], vec2[3], t_up_vec[3];
+	int is_edge, forward, is_split_vert;
+
+	/* ov, vtd2, and is_split_vert are set but UNUSED */
+	(void)ov, (void)vtd2, (void)is_split_vert;
+
+	if (l == NULL) {
+		/* what you call operator overloading in C :)
+		 * I wanted to use the same function for both wire edges and poly loops
+		 * so... here we walk around edges to find the needed verts */
+		forward = 1;
+		is_split_vert = 0;
+		if (v->e == NULL) {
+			//printf("We can't split a loose vert's edge!\n");
+			return NULL;
+		}
+		e1 = v->e; /* we just use the first two edges */
+		e2 = bmesh_disk_edge_next(v->e, v);
+		if (e1 == e2) {
+			//printf("You need at least two edges to use BME_bevel_split_edge()\n");
+			return NULL;
+		}
+		v2 = BM_edge_other_vert(e1, v);
+		v3 = BM_edge_other_vert(e2, v);
+		if (v1 != v2 && v1 != v3) {
+			//printf("Error: more than 2 edges in v's disk cycle, or v1 does not share an edge with v\n");
+			return NULL;
+		}
+		if (v1 == v2) {
+			v2 = v3;
+		}
+		else {
+			e1 = e2;
+		}
+		ov = BM_edge_other_vert(e1, v);
+		sv = BM_edge_split(bm, e1, v, &ne, 0.0f);
+		//BME_data_interp_from_verts(bm, v, ov, sv, 0.25); /* this is technically wrong.. */
+		//BME_data_interp_from_faceverts(bm, v, ov, sv, 0.25);
+		//BME_data_interp_from_faceverts(bm, ov, v, sv, 0.25);
+		BME_assign_transdata(td, bm, sv, sv->co, sv->co, NULL, sv->co, 0, -1, -1, NULL); /* quick default */
+		BMO_elem_flag_enable(bm, sv, BME_BEVEL_BEVEL);
+		BMO_elem_flag_enable(bm, ne, BME_BEVEL_ORIG); /* mark edge as original, even though it isn't */
+		BME_bevel_get_vec(vec1, v1, v, td);
+		BME_bevel_get_vec(vec2, v2, v, td);
+		cross_v3_v3v3(t_up_vec, vec1, vec2);
+		normalize_v3(t_up_vec);
+		up_vec = t_up_vec;
+	}
+	else {
+		/* establish loop direction */
+		if (l->v == v) {
+			forward = 1;
+			lv1 = l->next;
+			lv2 = l->prev;
+			v1 = l->next->v;
+			v2 = l->prev->v;
+		}
+		else if (l->next->v == v) {
+			forward = 0;
+			lv1 = l;
+			lv2 = l->next->next;
+			v1 = l->v;
+			v2 = l->next->next->v;
+		}
+		else {
+			//printf("ERROR: BME_bevel_split_edge() - v must be adjacent to l\n");
+			return NULL;
+		}
+
+		if (BME_bevel_is_split_vert(bm, lv1)) {
+			is_split_vert = 1;
+			sv = v1;
+			v1 = forward ? l->next->next->v : l->prev->v;
+		}
+		else {
+			is_split_vert = 0;
+			ov = BM_edge_other_vert(l->e, v);
+			sv = BM_edge_split(bm, l->e, v, &ne, 0.0f);
+			//BME_data_interp_from_verts(bm, v, ov, sv, 0.25); /* this is technically wrong.. */
+			//BME_data_interp_from_faceverts(bm, v, ov, sv, 0.25);
+			//BME_data_interp_from_faceverts(bm, ov, v, sv, 0.25);
+			BME_assign_transdata(td, bm, sv, sv->co, sv->co, NULL, sv->co, 0, -1, -1, NULL); /* quick default */
+			BMO_elem_flag_enable(bm, sv, BME_BEVEL_BEVEL);
+			BMO_elem_flag_enable(bm, ne, BME_BEVEL_ORIG); /* mark edge as original, even though it isn't */
+		}
+
+		if (BME_bevel_is_split_vert(bm, lv2)) {
+			v2 = forward ? lv2->prev->v : lv2->next->v;
+		}
+	}
+
+	is_edge = BME_bevel_get_vec(vec1, v, v1, td); /* get the vector we will be projecting onto */
+	BME_bevel_get_vec(vec2, v, v2, td); /* get the vector we will be projecting parallel to */
+	len = normalize_v3(vec1);
+
+	vtd = BME_get_transdata(td, sv);
+	vtd1 = BME_get_transdata(td, v);
+	vtd2 = BME_get_transdata(td, v1);
+
+	if (vtd1->loc == NULL) {
+		/* this is a vert with data only for calculating initial weights */
+		if (vtd1->weight < 0.0f) {
+			vtd1->weight = 0.0f;
+		}
+		scale = vtd1->weight / vtd1->factor;
+		if (!vtd1->max) {
+			vtd1->max = BME_new_transdata_float(td);
+			*vtd1->max = -1;
+		}
+	}
+	else {
+		scale = vtd1->weight;
+	}
+	vtd->max = vtd1->max;
+
+	if (is_edge && vtd1->loc != NULL) {
+		maxfactor = vtd1->maxfactor;
+	}
+	else {
+		maxfactor = scale * BME_bevel_project_vec(vec1, vec2, up_vec, forward, td);
+		if (vtd->maxfactor > 0 && vtd->maxfactor < maxfactor) {
+			maxfactor = vtd->maxfactor;
+		}
+	}
+
+	dis = BMO_elem_flag_test(bm, v1, BME_BEVEL_ORIG) ? len / 3 : len / 2;
+	if (is_edge || dis > maxfactor * value) {
+		dis = maxfactor * value;
+	}
+	madd_v3_v3v3fl(sv->co, v->co, vec1, dis);
+	sub_v3_v3v3(vec1, sv->co, vtd1->org);
+	dis = normalize_v3(vec1);
+	BME_assign_transdata(td, bm, sv, vtd1->org, vtd1->org, vec1, sv->co, dis, scale, maxfactor, vtd->max);
+
+	return sv;
+}
+
+#if 0 /* UNUSED */
+static float BME_bevel_set_max(BMVert *v1, BMVert *v2, float value, BME_TransData_Head *td)
+{
+	BME_TransData *vtd1, *vtd2;
+	float max, fac1, fac2, vec1[3], vec2[3], vec3[3];
+
+	BME_bevel_get_vec(vec1, v1, v2, td);
+	vtd1 = BME_get_transdata(td, v1);
+	vtd2 = BME_get_transdata(td, v2);
+
+	if (vtd1->loc == NULL) {
+		fac1 = 0;
+	}
+	else {
+		copy_v3_v3(vec2, vtd1->vec);
+		mul_v3_fl(vec2, vtd1->factor);
+		if (dot_v3v3(vec1, vec1)) {
+			project_v3_v3v3(vec2, vec2, vec1);
+			fac1 = len_v3(vec2) / value;
+		}
+		else {
+			fac1 = 0;
+		}
+	}
+
+	if (vtd2->loc == NULL) {
+		fac2 = 0;
+	}
+	else {
+		copy_v3_v3(vec3, vtd2->vec);
+		mul_v3_fl(vec3, vtd2->factor);
+		if (dot_v3v3(vec1, vec1)) {
+			project_v3_v3v3(vec2, vec3, vec1);
+			fac2 = len_v3(vec2) / value;
+		}
+		else {
+			fac2 = 0;
+		}
+	}
+
+	if (fac1 || fac2) {
+		max = len_v3(vec1) / (fac1 + fac2);
+		if (vtd1->max && (*vtd1->max < 0 || max < *vtd1->max)) {
+			*vtd1->max = max;
+		}
+		if (vtd2->max && (*vtd2->max < 0 || max < *vtd2->max)) {
+			*vtd2->max = max;
+		}
+	}
+	else {
+		max = -1;
+	}
+
+	return max;
+}
+#endif
+
+#if 0 /* UNUSED */
+static BMVert *BME_bevel_wire(BMesh *bm, BMVert *v, float value, int res, int UNUSED(options), BME_TransData_Head *td)
+{
+	BMVert *ov1, *ov2, *v1, *v2;
+
+	ov1 = BM_edge_other_vert(v->e, v);
+	ov2 = BM_edge_other_vert(bmesh_disk_edge_next(v->e, v), v);
+
+	/* split the edges */
+	v1 = BME_bevel_split_edge(bm, v, ov1, NULL, NULL, value, td);
+	BMO_elem_flag_enable(bm, v1, BME_BEVEL_NONMAN);
+	v2 = BME_bevel_split_edge(bm, v, ov2, NULL, NULL, value, td);
+	BMO_elem_flag_enable(bm, v2, BME_BEVEL_NONMAN);
+
+	if (value > 0.5) {
+		BME_bevel_set_max(v1, ov1, value, td);
+		BME_bevel_set_max(v2, ov2, value, td);
+	}
+
+	/* remove the original vert */
+	if (res) {
+		/* bmesh_jekv; */
+
+		//void BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac, int calcnorm) {
+		//hrm, why is there a fac here? it just removes a vert
+		BM_vert_collapse_edge(bm, v->e, v);
+	}
+
+	return v1;
+}
+#endif
+
+static BMLoop *BME_bevel_edge(BMesh *bm, BMLoop *l, float value, int UNUSED(options), float *up_vec, BME_TransData_Head *td)
+{
+	BMVert *v1, *v2, *kv;
+	BMLoop *kl = NULL, *nl;
+	BMEdge *e, *ke, *se;
+	BMFace *f, *jf;
+
+	f = l->f;
+	e = l->e;
+
+	/* sanity check */
+	if (!BMO_elem_flag_test(bm, l->e, BME_BEVEL_BEVEL) &&
+	    (BMO_elem_flag_test(bm, l->v, BME_BEVEL_BEVEL) || BMO_elem_flag_test(bm, l->next->v, BME_BEVEL_BEVEL)))
+	{
+		return l;
+	}
+
+	/* checks and operations for prev edge */
+	/* first, check to see if this edge was inset previously */
+	if (!BMO_elem_flag_test(bm, l->prev->e, BME_BEVEL_ORIG) &&
+	    !BMO_elem_flag_test(bm, l->v, BME_BEVEL_NONMAN))
+	{
+		kl = l->prev->radial_next;
+		kl = (kl->v == l->v) ? kl->prev : kl->next;
+		kv = l->v;
+	}
+	else {
+		kv = NULL;
+	}
+	/* get/make the first vert to be used in SFME */
+	if (BMO_elem_flag_test(bm, l->v, BME_BEVEL_NONMAN)) {
+		v1 = l->v;
+	}
+	else { /* we'll need to split the previous edge */
+		v1 = BME_bevel_split_edge(bm, l->v, NULL, l->prev, up_vec, value, td);
+	}
+	/* if we need to clean up geometry... */
+	if (kv) {
+		se = l->next->e;
+		jf = NULL;
+		if (kl->v == kv) {
+			BM_face_split(bm, kl->f, kl->prev->v, kl->next->v, &nl, kl->prev->e, TRUE);
+			ke = kl->e;
+			/* BMESH-TODO: jfke doesn't handle customdata */
+			jf = bmesh_jfke(bm, kl->prev->radial_next->f, kl->f, kl->prev->e);
+			BM_vert_collapse_edge(bm, ke, kv, FALSE);
+		}
+		else {
+			BM_face_split(bm, kl->f, kl->next->next->v, kl->v, &nl, kl->next->e, TRUE);
+			ke = kl->e;
+			/* BMESH-TODO: jfke doesn't handle customdata */
+			jf = bmesh_jfke(bm, kl->next->radial_next->f, kl->f, kl->next->e);
+			BM_vert_collapse_edge(bm, ke, kv, FALSE);
+		}
+		/* find saved loop pointer */
+		l = se->l;
+		while (l->f != jf) {
+			l = l->radial_next;
+			BLI_assert(l != se->l);
+		}
+		l = l->prev;
+	}
+
+	/* checks and operations for the next edge */
+	/* first, check to see if this edge was inset previously  */
+	if (!BMO_elem_flag_test(bm, l->next->e, BME_BEVEL_ORIG) &&
+	    !BMO_elem_flag_test(bm, l->next->v, BME_BEVEL_NONMAN))
+	{
+		kl = l->next->radial_next;
+		kl = (kl->v == l->next->v) ? kl->prev : kl->next;
+		kv = l->next->v;
+	}
+	else {
+		kv = NULL;
+	}
+	/* get/make the second vert to be used in SFME */
+	if (BMO_elem_flag_test(bm, l->next->v, BME_BEVEL_NONMAN)) {
+		v2 = l->next->v;
+	}
+	else { /* we'll need to split the next edge */
+		v2 = BME_bevel_split_edge(bm, l->next->v, NULL, l->next, up_vec, value, td);
+	}
+	/* if we need to clean up geometry... */
+	if (kv) {
+		se = l->e;
+		jf = NULL;
+		if (kl->v == kv) {
+			BM_face_split(bm, kl->f, kl->prev->v, kl->next->v, &nl, kl->prev->e, TRUE);
+			ke = kl->e;
+			/* BMESH-TODO: jfke doesn't handle customdata */
+			jf = bmesh_jfke(bm, kl->prev->radial_next->f, kl->f, kl->prev->e);
+			BM_vert_collapse_edge(bm, ke, kv, FALSE);
+		}
+		else {
+			BM_face_split(bm, kl->f, kl->next->next->v, kl->v, &nl, kl->next->e, TRUE);
+			ke = kl->e;
+			/* BMESH-TODO: jfke doesn't handle customdata */
+			jf = bmesh_jfke(bm, kl->next->radial_next->f, kl->f, kl->next->e);
+			BM_vert_collapse_edge(bm, ke, kv, FALSE);
+		}
+		/* find saved loop pointer */
+		l = se->l;
+		while (l->f != jf) {
+			l = l->radial_next;
+			BLI_assert(l != se->l);
+		}
+	}
+
+	if (!BMO_elem_flag_test(bm, v1, BME_BEVEL_NONMAN) || !BMO_elem_flag_test(bm, v2, BME_BEVEL_NONMAN)) {
+		BM_face_split(bm, f, v2, v1, &l, e, TRUE);
+		BMO_elem_flag_enable(bm, l->e, BME_BEVEL_BEVEL);
+		l = l->radial_next;
+	}
+
+	if (l->f != f) {
+		//printf("Whoops! You got something out of order in BME_bevel_edge()!\n");
+	}
+
+	return l;
+}
+
+static BMLoop *BME_bevel_vert(BMesh *bm, BMLoop *l, float value, int UNUSED(options), float *up_vec, BME_TransData_Head *td)
+{
+	BMVert *v1, *v2;
+	/* BMFace *f; */ /* UNUSED */
+
+	/* get/make the first vert to be used in SFME */
+	/* may need to split the previous edge */
+	v1 = BME_bevel_split_edge(bm, l->v, NULL, l->prev, up_vec, value, td);
+
+	/* get/make the second vert to be used in SFME */
+	/* may need to split this edge (so move l) */
+	l = l->prev;
+	v2 = BME_bevel_split_edge(bm, l->next->v, NULL, l->next, up_vec, value, td);
+	l = l->next->next;
+
+	/* "cut off" this corner */
+	/* f = */ BM_face_split(bm, l->f, v2, v1, NULL, l->e, TRUE);
+
+	return l;
+}
+
+/*
+ *			BME_bevel_poly
+ *
+ *	Polygon inset tool:
+ *
+ *	Insets a polygon/face based on the flagss of its vertices
+ *	and edges. Used by the bevel tool only, for now.
+ *  The parameter "value" is the distance to inset (should be negative).
+ *  The parameter "options" is not currently used.
+ *
+ *	Returns -
+ *  A BMFace pointer to the resulting inner face.
+ */
+static BMFace *BME_bevel_poly(BMesh *bm, BMFace *f, float value, int options, BME_TransData_Head *td)
+{
+	BMLoop *l /*, *o */;
+	BME_TransData *vtd1, *vtd2;
+	float up_vec[3], vec1[3], vec2[3], vec3[3], fac1, fac2, max = -1;
+	int len, i;
+	BMIter iter;
+
+	zero_v3(up_vec);
+
+	/* find a good normal for this face (there's better ways, I'm sure) */
+	BM_ITER_ELEM (l, &iter, f, BM_LOOPS_OF_FACE) {
+#ifdef BMESH_263_VERT_BEVEL_WORKAROUND
+		add_newell_cross_v3_v3v3(up_vec, l->prev->v->co, l->v->co);
+#else
+		BME_bevel_get_vec(vec1, l->v, l->next->v, td);
+		BME_bevel_get_vec(vec2, l->prev->v, l->v, td);
+		cross_v3_v3v3(vec3, vec2, vec1);
+		add_v3_v3(up_vec, vec3);
+
+#endif
+	}
+	normalize_v3(up_vec);
+
+	/* Can't use a BM_LOOPS_OF_FACE iterator here, because the loops are being modified
+	 * and so the end condition will never hi */
+	for (l = BM_FACE_FIRST_LOOP(f)->prev, i = 0, len = f->len; i < len; i++, l = l->next) {
+		if (BMO_elem_flag_test(bm, l->e, BME_BEVEL_BEVEL) && BMO_elem_flag_test(bm, l->e, BME_BEVEL_ORIG)) {
+			max = 1.0f;
+			l = BME_bevel_edge(bm, l, value, options, up_vec, td);
+		}
+		else if (BMO_elem_flag_test(bm, l->v, BME_BEVEL_BEVEL) &&
+		         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);
+		}
+	}
+
+	f = l->f;
+
+	/* max pass */
+	if (value > 0.5f && max > 0.0f) {
+		max = -1;
+		BM_ITER_ELEM (l, &iter, f, BM_LOOPS_OF_FACE) {
+			if (BMO_elem_flag_test(bm, l->e, BME_BEVEL_BEVEL) || BMO_elem_flag_test(bm, l->e, BME_BEVEL_ORIG)) {
+				BME_bevel_get_vec(vec1, l->v, l->next->v, td);
+				vtd1 = BME_get_transdata(td, l->v);
+				vtd2 = BME_get_transdata(td, l->next->v);
+				if (vtd1->loc == NULL) {
+					fac1 = 0;
+				}
+				else {
+					copy_v3_v3(vec2, vtd1->vec);
+					mul_v3_fl(vec2, vtd1->factor);
+					if (dot_v3v3(vec1, vec1)) {
+						project_v3_v3v3(vec2, vec2, vec1);
+						fac1 = len_v3(vec2) / value;
+					}
+					else {
+						fac1 = 0;
+					}
+				}
+				if (vtd2->loc == NULL) {
+					fac2 = 0;
+				}
+				else {
+					copy_v3_v3(vec3, vtd2->vec);
+					mul_v3_fl(vec3, vtd2->factor);
+					if (dot_v3v3(vec1, vec1)) {
+						project_v3_v3v3(vec2, vec3, vec1);
+						fac2 = len_v3(vec2) / value;
+					}
+					else {
+						fac2 = 0;
+					}
+				}
+				if (fac1 || fac2) {
+					max = len_v3(vec1) / (fac1 + fac2);
+					if (vtd1->max && (*vtd1->max < 0 || max < *vtd1->max)) {
+						*vtd1->max = max;
+					}
+					if (vtd2->max && (*vtd2->max < 0 || max < *vtd2->max)) {
+						*vtd2->max = max;
+					}
+				}
+			}
+		}
+	}
+
+	/* return l->f; */
+	return NULL;
+}
+
+static float BME_bevel_get_angle(BMEdge *e, BMVert *v)
+{
+	BMVert *v1, *v2;
+	BMLoop *l1, *l2;
+	float vec1[3], vec2[3], vec3[3], vec4[3];
+
+	l1 = e->l;
+	l2 = e->l->radial_next;
+	if (l1->v == v) {
+		v1 = l1->prev->v;
+		v2 = l1->next->v;
+	}
+	else {
+		v1 = l1->next->next->v;
+		v2 = l1->v;
+	}
+	sub_v3_v3v3(vec1, v1->co, v->co);
+	sub_v3_v3v3(vec2, v2->co, v->co);
+	cross_v3_v3v3(vec3, vec1, vec2);
+
+	l1 = l2;
+	if (l1->v == v) {
+		v1 = l1->prev->v;
+		v2 = l1->next->v;
+	}
+	else {
+		v1 = l1->next->next->v;
+		v2 = l1->v;
+	}
+	sub_v3_v3v3(vec1, v1->co, v->co);
+	sub_v3_v3v3(vec2, v2->co, v->co);
+	cross_v3_v3v3(vec4, vec2, vec1);
+
+	normalize_v3(vec3);
+	normalize_v3(vec4);
+
+	return dot_v3v3(vec3, vec4);
+}
+
+static float BME_bevel_get_angle_vert(BMVert *v)
+{
+	BMIter iter;
+	BMLoop *l;
+	float n[3];
+	float n_tmp[3];
+	float angle_diff = 0.0f;
+	float tot_angle = 0.0f;
+
+
+	BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) {
+		const float angle = BM_loop_calc_face_angle(l);
+		tot_angle += angle;
+		BM_loop_calc_face_normal(l, n_tmp);
+		madd_v3_v3fl(n, n_tmp, angle);
+	}
+	normalize_v3(n);
+
+	BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) {
+		/* could cache from before */
+		BM_loop_calc_face_normal(l, n_tmp);
+		angle_diff += angle_normalized_v3v3(n, n_tmp) * BM_loop_calc_face_angle(l);
+	}
+
+	/* return cosf(angle_diff + 0.001f); */ /* compare with dot product */
+	return (angle_diff / tot_angle) * (M_PI / 2);
+}
+
+static void BME_bevel_add_vweight(BME_TransData_Head *td, BMesh *bm, BMVert *v, float weight, float factor, int options)
+{
+	BME_TransData *vtd;
+
+	if (BMO_elem_flag_test(bm, v, BME_BEVEL_NONMAN)) {
+		return;
+	}
+
+	BMO_elem_flag_enable(bm, v, BME_BEVEL_BEVEL);
+	if ((vtd = BME_get_transdata(td, v))) {
+		if (options & BME_BEVEL_EMIN) {
+			vtd->factor = 1.0;
+			if (vtd->weight < 0 || weight < vtd->weight) {
+				vtd->weight = weight;
+			}
+		}
+		else if (options & BME_BEVEL_EMAX) {
+			vtd->factor = 1.0;
+			if (weight > vtd->weight) {
+				vtd->weight = weight;
+			}
+		}
+		else if (vtd->weight < 0.0f) {
+			vtd->factor = factor;
+			vtd->weight = weight;
+		}
+		else {
+			vtd->factor += factor; /* increment number of edges with weights (will be averaged) */
+			vtd->weight += weight; /* accumulate all the weights */
+		}
+	}
+	else {
+		/* we'll use vtd->loc == NULL to mark that this vert is not moving */
+		vtd = BME_assign_transdata(td, bm, v, v->co, NULL, NULL, NULL, factor, weight, -1, NULL);
+	}
+}
+
+static void bevel_init_verts(BMesh *bm, int options, float angle, BME_TransData_Head *td)
+{
+	BMVert *v;
+	BMIter iter;
+	float weight;
+	/* const float threshold = (options & BME_BEVEL_ANGLE) ? cosf(angle + 0.001) : 0.0f; */ /* UNUSED */
+
+	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+		weight = 0.0f;
+		if (!BMO_elem_flag_test(bm, v, BME_BEVEL_NONMAN)) {
+			/* modifiers should not use selection */
+			if (options & BME_BEVEL_SELECT) {
+				if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
+					weight = 1.0f;
+				}
+			}
+			/* bevel weight NYI */
+			else if (options & BME_BEVEL_WEIGHT) {
+				weight = BM_elem_float_data_get(&bm->vdata, v, CD_BWEIGHT);
+			}
+			else if (options & BME_BEVEL_ANGLE) {
+				/* dont set weight_v1/weight_v2 here, add direct */
+				if (BME_bevel_get_angle_vert(v) > angle) {
+					weight = 1.0f;
+				}
+			}
+			else {
+				weight = 1.0f;
+			}
+
+			if (weight > 0.0f) {
+				BMO_elem_flag_enable(bm, v, BME_BEVEL_BEVEL);
+				BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 1.0, weight, -1, NULL);
+			}
+		}
+	}
+}
+
+static void bevel_init_edges(BMesh *bm, int options, float angle, BME_TransData_Head *td)
+{
+	BMEdge *e;
+	int count;
+	float weight;
+	BMIter iter;
+	const float threshold = (options & BME_BEVEL_ANGLE) ? cosf(angle + 0.001) : 0.0f;
+
+	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+		weight = 0.0f;
+		if (!BMO_elem_flag_test(bm, e, BME_BEVEL_NONMAN)) {
+			if (options & BME_BEVEL_SELECT) {
+				if (BM_elem_flag_test(e, BM_ELEM_SELECT)) {
+					weight = 1.0f;
+				}
+			}
+			else if (options & BME_BEVEL_WEIGHT) {
+				weight = BM_elem_float_data_get(&bm->edata, e, CD_BWEIGHT);
+			}
+			else if (options & BME_BEVEL_ANGLE) {
+				/* dont set weight_v1/weight_v2 here, add direct */
+				if (!BMO_elem_flag_test(bm, e->v1, BME_BEVEL_NONMAN) && BME_bevel_get_angle(e, e->v1) < threshold) {
+					BMO_elem_flag_enable(bm, e, BME_BEVEL_BEVEL);
+					BME_bevel_add_vweight(td, bm, e->v1, 1.0, 1.0, options);
+				}
+				else {
+					BME_bevel_add_vweight(td, bm, e->v1, 0.0, 1.0, options);
+				}
+				if (!BMO_elem_flag_test(bm, e->v2, BME_BEVEL_NONMAN) && BME_bevel_get_angle(e, e->v2) < threshold) {
+					BMO_elem_flag_enable(bm, e, BME_BEVEL_BEVEL);
+					BME_bevel_add_vweight(td, bm, e->v2, 1.0, 1.0, options);
+				}
+				else {
+					BME_bevel_add_vweight(td, bm, e->v2, 0.0, 1.0, options);
+				}
+			}
+			else {
+				weight = 1.0f;
+			}
+
+			if (weight > 0.0f) {
+				BMO_elem_flag_enable(bm, e, BME_BEVEL_BEVEL);
+				BME_bevel_add_vweight(td, bm, e->v1, weight, 1.0, options);
+				BME_bevel_add_vweight(td, bm, e->v2, weight, 1.0, options);
+			}
+		}
+	}
+
+	/* clean up edges with 2 faces that share more than one edg */
+	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+		if (BMO_elem_flag_test(bm, e, BME_BEVEL_BEVEL)) {
+			count = BM_face_share_edge_count(e->l->f, e->l->radial_next->f);
+			if (count > 1) BMO_elem_flag_disable(bm, e, BME_BEVEL_BEVEL);
+		}
+	}
+}
+
+static BMesh *BME_bevel_initialize(BMesh *bm, int options, int UNUSED(defgrp_index), float angle, BME_TransData_Head *td)
+{
+	BMVert *v /*, *v2 */;
+	BMEdge *e /*, *curedg */;
+	BMFace *f;
+	BMIter iter;
+	int /* wire, */ len;
+
+	/* tag non-manifold geometr */
+	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+		BMO_elem_flag_enable(bm, v, BME_BEVEL_ORIG);
+		if (v->e) {
+			BME_assign_transdata(td, bm, v, v->co, v->co, NULL, NULL, 0, -1, -1, NULL);
+			if (!BM_vert_is_manifold(v)) {
+				BMO_elem_flag_enable(bm, v, BME_BEVEL_NONMAN);
+			}
+
+			/* test wire ver */
+			len = BM_vert_edge_count(v);
+			if (len == 2 && BM_vert_is_wire(v))
+				BMO_elem_flag_disable(bm, v, BME_BEVEL_NONMAN);
+		}
+		else {
+			BMO_elem_flag_enable(bm, v, BME_BEVEL_NONMAN);
+		}
+	}
+
+	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+		BMO_elem_flag_enable(bm, e, BME_BEVEL_ORIG);
+		if (!(BM_edge_is_boundary(e) || BM_edge_is_manifold(e))) {
+			BMO_elem_flag_enable(bm, e->v1, BME_BEVEL_NONMAN);
+			BMO_elem_flag_enable(bm, e->v2, BME_BEVEL_NONMAN);
+			BMO_elem_flag_enable(bm, e, BME_BEVEL_NONMAN);
+		}
+		if (BMO_elem_flag_test(bm, e->v1, BME_BEVEL_NONMAN) || BMO_elem_flag_test(bm, e->v2, BME_BEVEL_NONMAN)) {
+			BMO_elem_flag_enable(bm, e, BME_BEVEL_NONMAN);
+		}
+	}
+
+	BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+		BMO_elem_flag_enable(bm, f, BME_BEVEL_ORIG);
+	}
+
+	if (options & BME_BEVEL_VERT) {
+		bevel_init_verts(bm, options, angle, td);
+	}
+	else {
+		bevel_init_edges(bm, options, angle, td);
+	}
+
+	return bm;
+
+}
+
+#if 0
+
+static BMesh *BME_bevel_reinitialize(BMesh *bm)
+{
+	BMVert *v;
+	BMEdge *e;
+	BMFace *f;
+	BMIter iter;
+
+	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+		BMO_elem_flag_enable(bm, v, BME_BEVEL_ORIG);
+	}
+	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+		BMO_elem_flag_enable(bm, e, BME_BEVEL_ORIG);
+	}
+	BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+		BMO_elem_flag_enable(bm, f, BME_BEVEL_ORIG);
+	}
+	return bm;
+
+}
+
+#endif
+
+/**
+ *			BME_bevel_mesh
+ *
+ *	Mesh beveling tool:
+ *
+ *	Bevels an entire mesh. It currently uses the flags of
+ *	its vertices and edges to track topological changes.
+ *  The parameter "value" is the distance to inset (should be negative).
+ *  The parameter "options" is not currently used.
+ *
+ *	Returns -
+ *  A BMesh pointer to the BM passed as a parameter.
+ */
+
+static BMesh *BME_bevel_mesh(BMesh *bm, float value, int UNUSED(res), int options, int UNUSED(defgrp_index), BME_TransData_Head *td)
+{
+	BMVert *v;
+	BMEdge *e, *curedge;
+	BMLoop *l, *l2;
+	BMFace *f;
+	BMIter iter;
+
+	/* unsigned int i, len; */
+
+	/* bevel poly */
+	BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+		if (BMO_elem_flag_test(bm, f, BME_BEVEL_ORIG)) {
+			BME_bevel_poly(bm, f, value, options, td);
+		}
+	}
+
+	/* get rid of beveled edge */
+	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+		if (BMO_elem_flag_test(bm, e, BME_BEVEL_BEVEL) && BMO_elem_flag_test(bm, e, BME_BEVEL_ORIG)) {
+			BM_faces_join_pair(bm, e->l->f, e->l->radial_next->f, e, TRUE);
+		}
+	}
+
+	/* link up corners and cli */
+	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+		if (BMO_elem_flag_test(bm, v, BME_BEVEL_ORIG) && BMO_elem_flag_test(bm, v, BME_BEVEL_BEVEL)) {
+			curedge = v->e;
+			do {
+				l = curedge->l;
+				l2 = l->radial_next;
+				if (l->v != v) l = l->next;
+				if (l2->v != v) l2 = l2->next;
+				if (l->f->len > 3)
+					BM_face_split(bm, l->f, l->next->v, l->prev->v, &l, l->e, TRUE);  /* clip this corner off */
+				if (l2->f->len > 3)
+					BM_face_split(bm, l2->f, l2->next->v, l2->prev->v, &l, l2->e, TRUE);  /* clip this corner off */
+				curedge = bmesh_disk_edge_next(curedge, v);
+			} while (curedge != v->e);
+			BME_Bevel_Dissolve_Disk(bm, v);
+		}
+	}
+
+#ifdef DEBUG
+	/* Debug print, remov */
+	BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+		if (f->len == 2) {
+			printf("%s: warning, 2 edge face\n", __func__);
+		}
+	}
+#endif
+
+	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 *bm = em->bm;
+	BMVert *v;
+	BMIter iter;
+
+	BME_TransData_Head *td;
+	BME_TransData *vtd;
+	int i;
+	double fac = 1, d;
+
+	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.0f / 3.0f; else fac += 1.0f / (3 * i * 2.0f);
+	}
+	d = 1.0f / fac;
+
+	for (i = 0; i < res || (res == 0 && i == 0); i++) {
+		BMO_push(bm, NULL);
+		BME_bevel_initialize(bm, options, defgrp_index, angle, td);
+		//if (i != 0) BME_bevel_reinitialize(bm);
+		bmesh_edit_begin(bm, 0);
+		BME_bevel_mesh(bm, (float)d, res, options, defgrp_index, td);
+		bmesh_edit_end(bm, 0);
+		d /= (i == 0) ? 3.0 : 2.0;
+		BMO_pop(bm);
+	}
+
+	/* possibly needed when running as a tool (which is no longer functional)
+	 * but keep as an optioin for now */
+	if (do_tessface) {
+		BMEdit_RecalcTessellation(em);
+	}
+
+	/* interactive preview? */
+	if (rtd) {
+		*rtd = td;
+		return bm;
+	}
+
+	/* otherwise apply transforms */
+	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+		if ((vtd = BME_get_transdata(td, v))) {
+			if (vtd->max && (*vtd->max > 0 && value > *vtd->max)) {
+				d = *vtd->max;
+			}
+			else {
+				d = value;
+			}
+			madd_v3_v3v3fl(v->co, vtd->org, vtd->vec, vtd->factor * d);
+		}
+	}
+
+	BME_free_transdata(td);
+	return bm;
+}
diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp
index c2d8c35..778e302 100644
--- a/source/blender/collada/AnimationExporter.cpp
+++ b/source/blender/collada/AnimationExporter.cpp
@@ -40,7 +40,7 @@ void forEachObjectInScene(Scene *sce, Functor &f)
 
 void AnimationExporter::exportAnimations(Scene *sce)
 {
-	if(hasAnimations(sce)) {
+	if (hasAnimations(sce)) {
 		this->scene = sce;
 
 		openLibrary();
@@ -55,11 +55,11 @@ void AnimationExporter::exportAnimations(Scene *sce)
 void AnimationExporter::operator() (Object *ob) 
 {
 	FCurve *fcu;
-	char * transformName ;
+	char *transformName;
 	/* bool isMatAnim = false; */ /* UNUSED */
 
 	//Export transform animations
-	if(ob->adt && ob->adt->action)
+	if (ob->adt && ob->adt->action)
 	{
 		fcu = (FCurve*)ob->adt->action->curves.first;
 
@@ -88,7 +88,7 @@ void AnimationExporter::operator() (Object *ob)
 	}
 
 	//Export Lamp parameter animations
-	if( (ob->type == OB_LAMP ) && ((Lamp*)ob ->data)->adt && ((Lamp*)ob ->data)->adt->action )
+	if ( (ob->type == OB_LAMP ) && ((Lamp*)ob ->data)->adt && ((Lamp*)ob ->data)->adt->action )
 	{
 		fcu = (FCurve*)(((Lamp*)ob ->data)->adt->action->curves.first);
 		while (fcu) {
@@ -102,7 +102,7 @@ void AnimationExporter::operator() (Object *ob)
 	}
 
 	//Export Camera parameter animations
-	if( (ob->type == OB_CAMERA ) && ((Camera*)ob ->data)->adt && ((Camera*)ob ->data)->adt->action )
+	if ( (ob->type == OB_CAMERA ) && ((Camera*)ob ->data)->adt && ((Camera*)ob ->data)->adt->action )
 	{		
 		fcu = (FCurve*)(((Camera*)ob ->data)->adt->action->curves.first);
 		while (fcu) {
@@ -117,11 +117,11 @@ void AnimationExporter::operator() (Object *ob)
 	}
 
 	//Export Material parameter animations.
-	for(int a = 0; a < ob->totcol; a++)
+	for (int a = 0; a < ob->totcol; a++)
 	{
 		Material *ma = give_current_material(ob, a+1);
 		if (!ma) continue;
-		if(ma->adt && ma->adt->action)
+		if (ma->adt && ma->adt->action)
 		{
 			/* isMatAnim = true; */
 			fcu = (FCurve*)ma->adt->action->curves.first;
@@ -152,15 +152,15 @@ float * AnimationExporter::get_eul_source_for_quat(Object *ob )
 	{
 		char * transformName = extract_transform_name( fcu->rna_path );
 
-		if( !strcmp(transformName, "rotation_quaternion") )	{ 
-			for ( int i = 0 ; i < fcu->totvert ; i++){
+		if ( !strcmp(transformName, "rotation_quaternion") )	{ 
+			for ( int i = 0 ; i < fcu->totvert ; i++) {
 				*(quat + ( i * 4 ) + fcu->array_index) = fcu->bezt[i].vec[1][1];
 			}
 		}
 		fcu = fcu->next;
 	}
 
-	for ( int i = 0 ; i < keys ; i++){
+	for ( int i = 0 ; i < keys ; i++) {
 		for ( int j = 0;j<4;j++)
 			temp_quat[j] = quat[(i*4)+j];
 
@@ -184,7 +184,7 @@ std::string AnimationExporter::getObjectBoneName( Object* ob,const FCurve* fcu )
 	char* boneName = strtok((char *)rna_path.c_str(), "\"");
 	boneName = strtok(NULL,"\"");
 
-	if( boneName != NULL )
+	if ( boneName != NULL )
 		return /*id_name(ob) + "_" +*/ std::string(boneName);
 	else		
 		return id_name(ob);
@@ -254,10 +254,10 @@ void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformNa
 	std::string input_id = create_source_from_fcurve(COLLADASW::InputSemantic::INPUT, fcu, anim_id, axis_name);
 
 	// create output source
-	std::string output_id ;
+	std::string output_id;
 
 	//quat rotations are skipped for now, because of complications with determining axis.
-	if(quatRotation) 
+	if (quatRotation) 
 	{
 		float * eul  = get_eul_source_for_quat(ob);
 		float * eul_axis = (float*)MEM_callocN(sizeof(float) * fcu->totvert, "quat output source values");
@@ -302,7 +302,7 @@ void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformNa
 
 	addSampler(sampler);
 
-	std::string target ;
+	std::string target;
 
 	if ( !is_param )
 		target = translate_id(ob_name)
@@ -317,7 +317,7 @@ void AnimationExporter::dae_animation(Object* ob, FCurve *fcu, char* transformNa
 			target = get_camera_id(ob)
 			+ "/" + get_camera_param_sid(fcu->rna_path, -1, axis_name, true);
 
-		if( ma ) 
+		if ( ma ) 
 			target = translate_id(id_name(ma)) + "-effect"
 			+"/common/" /*profile common is only supported */ + get_transform_sid(fcu->rna_path, -1, axis_name, true);
 	}
@@ -335,8 +335,7 @@ void AnimationExporter::write_bone_animation_matrix(Object *ob_arm, Bone *bone)
 		return;
 
 	//This will only export animations of bones in deform group.
-	/*if(!is_bone_deform_group(bone))
-	return;*/
+	/* if (!is_bone_deform_group(bone)) return; */
 
 	sample_and_write_bone_animation_matrix(ob_arm, bone);
 
@@ -348,11 +347,11 @@ bool AnimationExporter::is_bone_deform_group(Bone * bone)
 {   
 	bool is_def;
 	//Check if current bone is deform
-	if((bone->flag & BONE_NO_DEFORM) == 0 ) return true;
+	if ((bone->flag & BONE_NO_DEFORM) == 0 ) return true;
 	//Check child bones
 	else 
 	{   
-		for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next){
+		for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) {
 			//loop through all the children until deform bone is found, and then return
 			is_def = is_bone_deform_group(child);
 			if (is_def) return true;
@@ -374,11 +373,11 @@ void AnimationExporter::sample_and_write_bone_animation_matrix(Object *ob_arm, B
 	{
 		std::string bone_name = getObjectBoneName(ob_arm,fcu);
 		int val = BLI_strcasecmp((char*)bone_name.c_str(),bone->name);
-		if(val==0) break;
+		if (val==0) break;
 		fcu = fcu->next;
 	}
 
-	if(!(fcu)) return; 
+	if (!(fcu)) return; 
 	bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name);
 	if (!pchan)
 		return;
@@ -548,7 +547,8 @@ void AnimationExporter::add_source_parameters(COLLADASW::SourceBase::ParameterNa
 					if ( transform )
 					{
 						param.push_back("TRANSFORM");  
-					}else{ //assumes if axis isn't specified all axises are added
+					}
+					else { //assumes if axis isn't specified all axises are added
 						param.push_back("X");
 						param.push_back("Y");
 						param.push_back("Z");
@@ -592,7 +592,8 @@ void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSeman
 			}
 			else if (rotation) {
 				values[1] = RAD2DEGF(bezt->vec[0][1]);
-			} else {
+			}
+			else {
 				values[1] = bezt->vec[0][1];
 			}
 			break;
@@ -607,7 +608,8 @@ void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSeman
 			}
 			else if (rotation) {
 				values[1] = RAD2DEGF(bezt->vec[2][1]);
-			} else {
+			}
+			else {
 				values[1] = bezt->vec[2][1];
 			}
 			break;
@@ -776,7 +778,7 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames , Ob
 		// SECOND_LIFE_COMPATIBILITY
 		// AFAIK animation to second life is via BVH, but no
 		// reason to not have the collada-animation be correct
-		if(export_settings->second_life)
+		if (export_settings->second_life)
 		{
 			float temp[4][4];
 			copy_m4_m4(temp, bone->arm_mat);
@@ -785,7 +787,7 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames , Ob
 
 			mult_m4_m4m4(mat, mat, temp);
 
-			if(bone->parent)
+			if (bone->parent)
 			{
 				copy_m4_m4(temp, bone->parent->arm_mat);
 				temp[3][0] = temp[3][1] = temp[3][2] = 0.0f;
@@ -858,9 +860,11 @@ std::string AnimationExporter::create_interpolation_source(FCurve *fcu, const st
 		if (fcu->bezt[i].ipo==BEZT_IPO_BEZ) {
 			source.appendValues(BEZIER_NAME);
 			*has_tangents = true;
-		} else if (fcu->bezt[i].ipo==BEZT_IPO_CONST) {
+		}
+		else if (fcu->bezt[i].ipo==BEZT_IPO_CONST) {
 			source.appendValues(STEP_NAME);
-		} else { // BEZT_IPO_LIN
+		}
+		else { // BEZT_IPO_LIN
 			source.appendValues(LINEAR_NAME);
 		}
 	}
@@ -1129,21 +1133,21 @@ bool AnimationExporter::hasAnimations(Scene *sce)
 
 		FCurve *fcu = 0;
 		//Check for object transform animations
-		if(ob->adt && ob->adt->action)
+		if (ob->adt && ob->adt->action)
 			fcu = (FCurve*)ob->adt->action->curves.first;
 		//Check for Lamp parameter animations
-		else if( (ob->type == OB_LAMP ) && ((Lamp*)ob ->data)->adt && ((Lamp*)ob ->data)->adt->action )
+		else if ( (ob->type == OB_LAMP ) && ((Lamp*)ob ->data)->adt && ((Lamp*)ob ->data)->adt->action )
 			fcu = (FCurve*)(((Lamp*)ob ->data)->adt->action->curves.first);
 		//Check for Camera parameter animations
-		else if( (ob->type == OB_CAMERA ) && ((Camera*)ob ->data)->adt && ((Camera*)ob ->data)->adt->action )
+		else if ( (ob->type == OB_CAMERA ) && ((Camera*)ob ->data)->adt && ((Camera*)ob ->data)->adt->action )
 			fcu = (FCurve*)(((Camera*)ob ->data)->adt->action->curves.first);
 
 		//Check Material Effect parameter animations.
-		for(int a = 0; a < ob->totcol; a++)
+		for (int a = 0; a < ob->totcol; a++)
 		{
 			Material *ma = give_current_material(ob, a+1);
 			if (!ma) continue;
-			if(ma->adt && ma->adt->action)
+			if (ma->adt && ma->adt->action)
 			{
 				fcu = (FCurve*)ma->adt->action->curves.first;	
 			}
@@ -1217,7 +1221,7 @@ void AnimationExporter::sample_and_write_bone_animation(Object *ob_arm, Bone *bo
 	bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name);
 	if (!pchan)
 		return;
-	//Fill frame array with key frame values framed at @param:transform_type
+	//Fill frame array with key frame values framed at \param:transform_type
 	switch (transform_type) {
 		case 0:
 			find_rotation_frames(ob_arm, fra, prefix, pchan->rotmode);
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp
index c47e024..e0079fb 100644
--- a/source/blender/collada/AnimationImporter.cpp
+++ b/source/blender/collada/AnimationImporter.cpp
@@ -119,7 +119,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve)
 					bez.vec[1][1] = bc_get_float_value(output, j * dim + i);
 
 
-					if( curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER ||
+					if ( curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER ||
 						curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_STEP) 
 					{
 						COLLADAFW::FloatOrDoubleArray& intan = curve->getInTangentValues();
@@ -132,7 +132,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve)
 						// outtangent
 						bez.vec[2][0] = bc_get_float_value(outtan, (j * 2 * dim ) + (2 * i)) * fps;
 						bez.vec[2][1] = bc_get_float_value(outtan, (j * 2 * dim )+ (2 * i) + 1);
-						if(curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER) 
+						if (curve->getInterpolationType() == COLLADAFW::AnimationCurve::INTERPOLATION_BEZIER) 
 							bez.ipo = BEZT_IPO_BEZ;
 						else 
 							bez.ipo = BEZT_IPO_CONST;
@@ -261,7 +261,7 @@ bool AnimationImporter::write_animation(const COLLADAFW::Animation* anim)
 		// XXX Don't know if it's necessary
 		// Should we check outPhysicalDimension?
 		if (curve->getInPhysicalDimension() != COLLADAFW::PHYSICAL_DIMENSION_TIME) {
-			fprintf(stderr, "Inputs physical dimension is not time. \n");
+			fprintf(stderr, "Inputs physical dimension is not time.\n");
 			return true;
 		}
 
@@ -610,9 +610,10 @@ void AnimationImporter:: Assign_color_animations(const COLLADAFW::UniqueId& list
 void AnimationImporter:: Assign_float_animations(const COLLADAFW::UniqueId& listid, ListBase *AnimCurves, const char * anim_type)
 {
 	char rna_path[100];
-	if (animlist_map.find(listid) == animlist_map.end()) return ;
-	else 
-	{
+	if (animlist_map.find(listid) == animlist_map.end()) {
+		return;
+	}
+	else {
 		//anim_type has animations
 		const COLLADAFW::AnimationList *animlist = animlist_map[listid];
 		const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings();
@@ -665,7 +666,7 @@ void AnimationImporter::apply_matrix_curves( Object * ob, std::vector<FCurve*>&
 	}
 	// new curves to assign matrix transform animation
 	FCurve *newcu[10]; // if tm_type is matrix, then create 10 curves: 4 rot, 3 loc, 3 scale
-	unsigned int totcu = 10 ;
+	unsigned int totcu = 10;
 	const char *tm_str = NULL;
 	char rna_path[200];
 	for (int i = 0; i < totcu; i++) {
@@ -824,9 +825,10 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node ,
 			const COLLADAFW::UniqueId& listid = transform->getAnimationList();
 
 			//check if transformation has animations
-			if (animlist_map.find(listid) == animlist_map.end()) continue ; 
-			else 
-			{
+			if (animlist_map.find(listid) == animlist_map.end()) {
+				continue;
+			}
+			else {
 				//transformation has animations
 				const COLLADAFW::AnimationList *animlist = animlist_map[listid];
 				const COLLADAFW::AnimationList::AnimationBindings& bindings = animlist->getAnimationBindings();
@@ -834,34 +836,33 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node ,
 				std::vector<FCurve*> animcurves;
 				for (unsigned int j = 0; j < bindings.getCount(); j++) {
 					animcurves = curve_map[bindings[j].animation];
-					if ( is_matrix )
+					if ( is_matrix ) {
 						apply_matrix_curves(ob, animcurves, root , node,  transform  );
+					}
 					else {				
-						//calculate rnapaths and array index of fcurves according to transformation and animation class
-						Assign_transform_animations(transform, &bindings[j], &animcurves, is_joint, joint_path ); 
-
-						std::vector<FCurve*>::iterator iter;
-						//Add the curves of the current animation to the object
-						for (iter = animcurves.begin(); iter != animcurves.end(); iter++) {
-							FCurve * fcu = *iter;
-							if ((ob->type == OB_ARMATURE))
-								add_bone_fcurve( ob, node , fcu );
-							else 
-								BLI_addtail(AnimCurves, fcu);	
+
+						if (is_joint) {
+
+							add_bone_animation_sampled(ob, animcurves, root, node, transform);
+						}
+						else {
+							//calculate rnapaths and array index of fcurves according to transformation and animation class
+							Assign_transform_animations(transform, &bindings[j], &animcurves, is_joint, joint_path ); 
+
+							std::vector<FCurve*>::iterator iter;
+							//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);
+							}
 						}
+						
 					}
 				}
 			}
-			if (is_rotation) {
-				if (is_joint) 
-				{
-					bPoseChannel *chan = get_pose_channel(ob->pose, bone_name);
-					chan->rotmode = ROT_MODE_EUL;
-				}
-				else 
-				{
-					ob->rotmode = ROT_MODE_EUL;
-				}
+			if (is_rotation && !is_joint) {
+				ob->rotmode = ROT_MODE_EUL;
 			}
 		}
 	}
@@ -947,7 +948,7 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node ,
 
 		}
 	}
-	if ( animType->material != 0){
+	if ( animType->material != 0) {
 		Material *ma = give_current_material(ob, 1);
 		if (!ma->adt || !ma->adt->action) act = verify_adt_action((ID*)&ma->id, 1);
 		else act = ma->adt->action;
@@ -963,25 +964,25 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node ,
 				if (ef != NULL) { /* can be NULL [#28909] */
 					const COLLADAFW::CommonEffectPointerArray& commonEffects  =  ef->getCommonEffects();
 					COLLADAFW::EffectCommon *efc = commonEffects[0];
-					if((animType->material & MATERIAL_SHININESS) != 0){
+					if ((animType->material & MATERIAL_SHININESS) != 0) {
 						const COLLADAFW::FloatOrParam *shin = &(efc->getShininess());
 						const COLLADAFW::UniqueId& listid =  shin->getAnimationList();
 						Assign_float_animations( listid, AnimCurves , "specular_hardness" );
 					}
 
-					if((animType->material & MATERIAL_IOR) != 0){
+					if ((animType->material & MATERIAL_IOR) != 0) {
 						const COLLADAFW::FloatOrParam *ior = &(efc->getIndexOfRefraction());
 						const COLLADAFW::UniqueId& listid =  ior->getAnimationList();
 						Assign_float_animations( listid, AnimCurves , "raytrace_transparency.ior" );
 					}
 
-					if((animType->material & MATERIAL_SPEC_COLOR) != 0){
+					if ((animType->material & MATERIAL_SPEC_COLOR) != 0) {
 						const COLLADAFW::ColorOrTexture *cot = &(efc->getSpecular());
 						const COLLADAFW::UniqueId& listid =  cot->getColor().getAnimationList();
 						Assign_color_animations( listid, AnimCurves , "specular_color" );
 					}
 
-					if((animType->material & MATERIAL_DIFF_COLOR) != 0){
+					if ((animType->material & MATERIAL_DIFF_COLOR) != 0) {
 						const COLLADAFW::ColorOrTexture *cot = &(efc->getDiffuse());
 						const COLLADAFW::UniqueId& listid =  cot->getColor().getAnimationList();
 						Assign_color_animations( listid, AnimCurves , "diffuse_color" );
@@ -992,6 +993,136 @@ void AnimationImporter::translate_Animations ( COLLADAFW::Node * node ,
 	}
 }
 
+void AnimationImporter::add_bone_animation_sampled(Object * ob, std::vector<FCurve*>& animcurves, COLLADAFW::Node* root, COLLADAFW::Node* node, COLLADAFW::Transformation * tm)
+{
+	const char *bone_name = bc_get_joint_name(node);
+	char joint_path[200];
+	armature_importer->get_rna_path_for_joint(node, joint_path, sizeof(joint_path));
+
+	std::vector<float> frames;
+	find_frames(&frames, &animcurves);
+
+	// convert degrees to radians
+	if (tm->getTransformationType() == COLLADAFW::Transformation::ROTATE) {
+
+		std::vector<FCurve*>::iterator iter;
+		for (iter = animcurves.begin(); iter != animcurves.end(); iter++) {
+			FCurve* fcu = *iter;
+
+			fcurve_deg_to_rad(fcu);		 
+		}					
+	}
+
+
+	float irest_dae[4][4];
+	float rest[4][4], irest[4][4];
+
+	get_joint_rest_mat(irest_dae, root, node);
+	invert_m4(irest_dae);
+
+	Bone *bone = get_named_bone((bArmature*)ob->data, bone_name);
+	if (!bone) {
+		fprintf(stderr, "cannot find bone \"%s\"\n", bone_name);
+		return;
+	}
+
+	unit_m4(rest);
+	copy_m4_m4(rest, bone->arm_mat);
+	invert_m4_m4(irest, rest);
+
+	// new curves to assign matrix transform animation
+	FCurve *newcu[10]; // if tm_type is matrix, then create 10 curves: 4 rot, 3 loc, 3 scale
+	unsigned int totcu = 10;
+	const char *tm_str = NULL;
+	char rna_path[200];
+	for (int i = 0; i < totcu; i++) {
+
+		int axis = i;
+
+		if (i < 4) {
+			tm_str = "rotation_quaternion";
+			axis = i;
+		}
+		else if (i < 7) {
+			tm_str = "location";
+			axis = i - 4;
+		}
+		else {
+			tm_str = "scale";
+			axis = i - 7;
+		}
+
+
+		BLI_snprintf(rna_path, sizeof(rna_path), "%s.%s", joint_path, tm_str);
+
+		newcu[i] = create_fcurve(axis, rna_path);
+		newcu[i]->totvert = frames.size();
+	}
+
+	if (frames.size() == 0)
+		return;
+
+	std::sort(frames.begin(), frames.end());
+
+	std::vector<float>::iterator it;
+
+	// sample values at each frame
+	for (it = frames.begin(); it != frames.end(); it++) {
+		float fra = *it;
+
+		float mat[4][4];
+		float matfra[4][4];
+
+		unit_m4(matfra);
+
+		// calc object-space mat
+		evaluate_transform_at_frame(matfra, node, fra);
+
+
+		// for joints, we need a special matrix
+		// special matrix: iR * M * iR_dae * R
+		// where R, iR are bone rest and inverse rest mats in world space (Blender bones),
+		// iR_dae is joint inverse rest matrix (DAE) and M is an evaluated joint world-space matrix (DAE)
+		float temp[4][4], par[4][4];
+
+
+		// calc M
+		calc_joint_parent_mat_rest(par, NULL, root, node);
+		mult_m4_m4m4(temp, par, matfra);
+
+		// evaluate_joint_world_transform_at_frame(temp, NULL, , node, fra);
+
+		// calc special matrix
+		mul_serie_m4(mat, irest, temp, irest_dae, rest, NULL, NULL, NULL, NULL);
+
+		float  rot[4], loc[3], scale[3];
+
+		mat4_to_quat(rot, mat);
+		copy_v3_v3(loc, mat[3]);
+		mat4_to_size(scale, mat);
+
+		// add keys
+		for (int i = 0; i < totcu; i++) {
+			if (i < 4)
+				add_bezt(newcu[i], fra, rot[i]);
+			else if (i < 7)
+				add_bezt(newcu[i], fra, loc[i - 4]);
+			else
+				add_bezt(newcu[i], fra, scale[i - 7]);
+		}
+	}
+	verify_adt_action((ID*)&ob->id, 1);
+
+	// add curves
+	for (int i= 0; i < totcu; i++) {
+		add_bone_fcurve(ob, node, newcu[i]);
+	}
+
+	bPoseChannel *chan = get_pose_channel(ob->pose, bone_name);
+	chan->rotmode = ROT_MODE_QUAT;
+
+}
+
 
 //Check if object is animated by checking if animlist_map holds the animlist_id of node transforms
 AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLADAFW::Node * node , 
@@ -1007,9 +1138,10 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD
 		const COLLADAFW::UniqueId& listid = transform->getAnimationList();
 
 		//check if transformation has animations
-		if (animlist_map.find(listid) == animlist_map.end()) continue ;
-		else 
-		{
+		if (animlist_map.find(listid) == animlist_map.end()) {
+			continue;
+		}
+		else {
 			types->transform = types->transform|NODE_TRANSFORM;
 			break;
 		}
@@ -1053,7 +1185,7 @@ AnimationImporter::AnimMix* AnimationImporter::get_animation_type ( const COLLAD
 			const COLLADAFW::Effect *ef = (COLLADAFW::Effect *) (FW_object_map[matuid]);
 			if (ef != NULL) { /* can be NULL [#28909] */
 				const COLLADAFW::CommonEffectPointerArray& commonEffects = ef->getCommonEffects();
-				if(!commonEffects.empty()) {
+				if (!commonEffects.empty()) {
 					COLLADAFW::EffectCommon *efc = commonEffects[0];
 					types->material =  setAnimType(&(efc->getShininess()),(types->material), MATERIAL_SHININESS);
 					types->material =  setAnimType(&(efc->getSpecular().getColor()),(types->material), MATERIAL_SPEC_COLOR);
@@ -1406,12 +1538,10 @@ void AnimationImporter::evaluate_transform_at_frame(float mat[4][4], COLLADAFW::
 		float m[4][4];
 
 		unit_m4(m);
-		if ( type != COLLADAFW::Transformation::MATRIX )
-			continue;
 
 		std::string nodename = node->getName().size() ? node->getName() : node->getOriginalId();
 		if (!evaluate_animation(tm, m, fra, nodename.c_str())) {
-			/*switch (type) {
+			switch (type) {
 			case COLLADAFW::Transformation::ROTATE:
 				dae_rotate_to_mat4(tm, m);
 				break;
@@ -1426,8 +1556,8 @@ void AnimationImporter::evaluate_transform_at_frame(float mat[4][4], COLLADAFW::
 				break;
 			default:
 				fprintf(stderr, "unsupported transformation type %d\n", type);
-			}*/
-			dae_matrix_to_mat4(tm, m);
+			}
+			// dae_matrix_to_mat4(tm, m);
 			
 		}
 
@@ -1510,6 +1640,7 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float
 				}
 
 				COLLADABU::Math::Vector3& axis = ((COLLADAFW::Rotate*)tm)->getRotationAxis();
+
 				float ax[3] = {axis[0], axis[1], axis[2]};
 				float angle = evaluate_fcurve(curves[0], fra);
 				axis_angle_to_mat4(mat, ax, angle);
@@ -1740,7 +1871,7 @@ void AnimationImporter::add_bezt(FCurve *fcu, float fra, float value)
 	//float fps = (float)FPS;
 	BezTriple bez;
 	memset(&bez, 0, sizeof(BezTriple));
-	bez.vec[1][0] = fra ;
+	bez.vec[1][0] = fra;
 	bez.vec[1][1] = value;
 	bez.ipo = BEZT_IPO_LIN ;/* use default interpolation mode here... */
 	bez.f1 = bez.f2 = bez.f3 = SELECT;
diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h
index 2c3165d..e42a1cc 100644
--- a/source/blender/collada/AnimationImporter.h
+++ b/source/blender/collada/AnimationImporter.h
@@ -24,8 +24,8 @@
  *  \ingroup collada
  */
 
-#ifndef __BC_ANIMATIONIMPORTER_H__
-#define __BC_ANIMATIONIMPORTER_H__
+#ifndef __ANIMATIONIMPORTER_H__
+#define __ANIMATIONIMPORTER_H__
 
 #include <map>
 #include <vector>
@@ -148,11 +148,13 @@ public:
 												   std::map<COLLADAFW::UniqueId, Object*>& object_map ,
 												   std::map<COLLADAFW::UniqueId, const COLLADAFW::Object*> FW_object_map);
 
-	AnimMix* get_animation_type( const COLLADAFW::Node * node , std::map<COLLADAFW::UniqueId,const COLLADAFW::Object*> FW_object_map ) ;
+	AnimMix* get_animation_type( const COLLADAFW::Node * node , std::map<COLLADAFW::UniqueId,const COLLADAFW::Object*> FW_object_map );
 
 	void apply_matrix_curves( Object * ob, std::vector<FCurve*>& animcurves, COLLADAFW::Node* root ,COLLADAFW::Node* node,
 									COLLADAFW::Transformation * tm );
 
+	void add_bone_animation_sampled(Object * ob, std::vector<FCurve*>& animcurves, COLLADAFW::Node* root ,COLLADAFW::Node* node, COLLADAFW::Transformation * tm);
+
 	void Assign_transform_animations(COLLADAFW::Transformation* transform , 
 									 const COLLADAFW::AnimationList::AnimationBinding * binding,
 									 std::vector<FCurve*>* curves, bool is_joint, char * joint_path);
diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp
index 0e89f2d..743d3c2 100644
--- a/source/blender/collada/ArmatureExporter.cpp
+++ b/source/blender/collada/ArmatureExporter.cpp
@@ -43,6 +43,7 @@
 
 #include "GeometryExporter.h"
 #include "ArmatureExporter.h"
+#include "SceneExporter.h"
 
 // XXX exporter writes wrong data for shared armatures.  A separate
 // controller should be written for each armature-mesh binding how do
@@ -50,14 +51,16 @@
 ArmatureExporter::ArmatureExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings) : COLLADASW::LibraryControllers(sw), export_settings(export_settings) {}
 
 // write bone nodes
-void ArmatureExporter::add_armature_bones(Object *ob_arm, Scene *sce)
+void ArmatureExporter::add_armature_bones(Object *ob_arm, Scene* sce,
+										  SceneExporter* se,
+										  std::list<Object*>& child_objects)
 {
 	// write bone nodes
 	bArmature *arm = (bArmature*)ob_arm->data;
 	for (Bone *bone = (Bone*)arm->bonebase.first; bone; bone = bone->next) {
 		// start from root bones
 		if (!bone->parent)
-			add_bone_node(bone, ob_arm);
+			add_bone_node(bone, ob_arm, sce, se, child_objects);
 	}
 }
 
@@ -163,7 +166,9 @@ std::string ArmatureExporter::get_joint_sid(Bone *bone, Object *ob_arm)
 }
 
 // parent_mat is armature-space
-void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm)
+void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene* sce,
+									 SceneExporter* se,
+									 std::list<Object*>& child_objects)
 {
 	std::string node_id = get_joint_id(bone, ob_arm);
 	std::string node_name = std::string(bone->name);
@@ -183,14 +188,55 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm)
 
 	add_bone_transform(ob_arm, bone, node);
 
+	// Write nodes of childobjects, remove written objects from list
+	std::list<Object*>::iterator i = child_objects.begin();
+
+	while( i != child_objects.end() )
+	{
+		if ((*i)->partype == PARBONE && (0 == strcmp((*i)->parsubstr, bone->name)))
+		{
+			float backup_parinv[4][4];
+			copy_m4_m4(backup_parinv, (*i)->parentinv);
+
+			// crude, temporary change to parentinv
+			// so transform gets exported correctly.
+
+			// Add bone tail- translation... don't know why
+			// bone parenting is against the tail of a bone
+			// and not it's head, seems arbitrary.
+			(*i)->parentinv[3][1] += bone->length;
+
+			// SECOND_LIFE_COMPATIBILITY
+			// TODO: when such objects are animated as
+			// single matrix the tweak must be applied
+			// to the result.
+			if (export_settings->second_life)
+			{
+				// tweak objects parentinverse to match compatibility
+				float temp[4][4];
+
+				copy_m4_m4(temp, bone->arm_mat);
+				temp[3][0] = temp[3][1] = temp[3][2] = 0.0f;
+
+				mult_m4_m4m4((*i)->parentinv, temp, (*i)->parentinv);
+			}
+
+			se->writeNodes(*i, sce);
+
+			copy_m4_m4((*i)->parentinv, backup_parinv);
+			child_objects.erase(i++);
+		}
+		else i++;
+	}
+
 	for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) {
-		add_bone_node(child, ob_arm);
+		add_bone_node(child, ob_arm, sce, se, child_objects);
 	}
 	node.end();
 	//}
 }
 
-void ArmatureExporter::add_blender_leaf_bone(Bone *bone, Object *ob_arm, COLLADASW::Node& node)
+/*void ArmatureExporter::add_blender_leaf_bone(Bone *bone, Object *ob_arm, COLLADASW::Node& node)
 {
 	node.start();
 	
@@ -201,11 +247,11 @@ void ArmatureExporter::add_blender_leaf_bone(Bone *bone, Object *ob_arm, COLLADA
 	node.addExtraTechniqueParameter("blender", "tip_z", bone->tail[2] );
 	
 	for (Bone *child = (Bone*)bone->childbase.first; child; child = child->next) {
-		add_bone_node(child, ob_arm);
+		add_bone_node(child, ob_arm, sce, se, child_objects);
 	}
 	node.end();
 	
-}
+}*/
 void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW::Node& node)
 {
 	bPoseChannel *pchan = get_pose_channel(ob_arm->pose, bone->name);
@@ -228,7 +274,7 @@ void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW:
 	}
 
 	// SECOND_LIFE_COMPATIBILITY
-	if(export_settings->second_life)
+	if (export_settings->second_life)
 	{
 		// Remove rotations vs armature from transform
 		// parent_rest_rot * mat * irest_rot
@@ -239,7 +285,7 @@ void ArmatureExporter::add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW:
 
 		mult_m4_m4m4(mat, mat, temp);
 
-		if(bone->parent)
+		if (bone->parent)
 		{
 			copy_m4_m4(temp, bone->parent->arm_mat);
 			temp[3][0] = temp[3][1] = temp[3][2] = 0.0f;
@@ -296,10 +342,64 @@ void ArmatureExporter::export_controller(Object* ob, Object *ob_arm)
 
 	std::string joints_source_id = add_joints_source(ob_arm, &ob->defbase, controller_id);
 	std::string inv_bind_mat_source_id = add_inv_bind_mats_source(ob_arm, &ob->defbase, controller_id);
-	std::string weights_source_id = add_weights_source(me, controller_id);
 
+	std::list<int> vcounts;
+	std::list<int> joints;
+	std::list<float> weights;
+
+	{
+		int i, j;
+
+		// def group index -> joint index
+		std::vector<int> joint_index_by_def_index;
+		bDeformGroup *def;
+
+		for (def = (bDeformGroup*)ob->defbase.first, i = 0, j = 0; def; def = def->next, i++) {
+			if (is_bone_defgroup(ob_arm, def))
+				joint_index_by_def_index.push_back(j++);
+			else
+				joint_index_by_def_index.push_back(-1);
+		}
+
+		for (i = 0; i < me->totvert; i++) {
+			MDeformVert *vert = &me->dvert[i];
+			std::map<int, float> jw;
+
+			// We're normalizing the weights later
+			float sumw = 0.0f;
+
+			for (j = 0; j < vert->totweight; j++) {
+				int joint_index = joint_index_by_def_index[vert->dw[j].def_nr];
+				if (joint_index != -1 && vert->dw[j].weight > 0.0f)
+				{
+					jw[joint_index] += vert->dw[j].weight;
+					sumw += vert->dw[j].weight;
+				}
+			}
+
+			if (sumw > 0.0f)
+			{
+				float invsumw = 1.0f/sumw;
+				vcounts.push_back(jw.size());
+				for (std::map<int, float>::iterator m = jw.begin(); m != jw.end(); ++m)
+				{
+					joints.push_back((*m).first);
+					weights.push_back(invsumw*(*m).second);
+				}
+			}
+			else
+			{
+				vcounts.push_back(0);
+				/*vcounts.push_back(1);
+				joints.push_back(-1);
+				weights.push_back(1.0f);*/
+			}
+		}
+	}
+
+	std::string weights_source_id = add_weights_source(me, controller_id, weights);
 	add_joints_element(&ob->defbase, joints_source_id, inv_bind_mat_source_id);
-	add_vertex_weights_element(weights_source_id, joints_source_id, me, ob_arm, &ob->defbase);
+	add_vertex_weights_element(weights_source_id, joints_source_id, vcounts, joints);
 
 	closeSkin();
 	closeController();
@@ -402,7 +502,7 @@ std::string ArmatureExporter::add_inv_bind_mats_source(Object *ob_arm, ListBase
 			float inv_bind_mat[4][4];
 
 			// SECOND_LIFE_COMPATIBILITY
-			if(export_settings->second_life)
+			if (export_settings->second_life)
 			{
 				// Only translations, no rotation vs armature
 				float temp[4][4];
@@ -445,21 +545,14 @@ bool ArmatureExporter::is_bone_defgroup(Object *ob_arm, bDeformGroup* def)
 	return get_bone_from_defgroup(ob_arm, def) != NULL;
 }
 
-std::string ArmatureExporter::add_weights_source(Mesh *me, const std::string& controller_id)
+std::string ArmatureExporter::add_weights_source(Mesh *me, const std::string& controller_id, const std::list<float>& weights)
 {
 	std::string source_id = controller_id + WEIGHTS_SOURCE_ID_SUFFIX;
 
-	int i;
-	int totweight = 0;
-
-	for (i = 0; i < me->totvert; i++) {
-		totweight += me->dvert[i].totweight;
-	}
-
 	COLLADASW::FloatSourceF source(mSW);
 	source.setId(source_id);
 	source.setArrayId(source_id + ARRAY_ID_SUFFIX);
-	source.setAccessorCount(totweight);
+	source.setAccessorCount(weights.size());
 	source.setAccessorStride(1);
 	
 	COLLADASW::SourceBase::ParameterNameList &param = source.getParameterNameList();
@@ -467,13 +560,8 @@ std::string ArmatureExporter::add_weights_source(Mesh *me, const std::string& co
 
 	source.prepareToAppendValues();
 
-	// NOTE: COLLADA spec says weights should be normalized
-
-	for (i = 0; i < me->totvert; i++) {
-		MDeformVert *vert = &me->dvert[i];
-		for (int j = 0; j < vert->totweight; j++) {
-			source.appendValues(vert->dw[j].weight);
-		}
+	for (std::list<float>::const_iterator i = weights.begin(); i != weights.end(); ++i) {
+		source.appendValues(*i);
 	}
 
 	source.finish();
@@ -481,11 +569,12 @@ std::string ArmatureExporter::add_weights_source(Mesh *me, const std::string& co
 	return source_id;
 }
 
-void ArmatureExporter::add_vertex_weights_element(const std::string& weights_source_id, const std::string& joints_source_id, Mesh *me,
-								Object *ob_arm, ListBase *defbase)
+void ArmatureExporter::add_vertex_weights_element(const std::string& weights_source_id, const std::string& joints_source_id,
+												  const std::list<int>& vcounts,
+												  const std::list<int>& joints)
 {
-	COLLADASW::VertexWeightsElement weights(mSW);
-	COLLADASW::InputList &input = weights.getInputList();
+	COLLADASW::VertexWeightsElement weightselem(mSW);
+	COLLADASW::InputList &input = weightselem.getInputList();
 
 	int offset = 0;
 	input.push_back(COLLADASW::Input(COLLADASW::InputSemantic::JOINT, // constant declared in COLLADASWInputList.h
@@ -493,40 +582,25 @@ void ArmatureExporter::add_vertex_weights_element(const std::string& weights_sou
 	input.push_back(COLLADASW::Input(COLLADASW::InputSemantic::WEIGHT,
 									 COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, weights_source_id), offset++));
 
-	weights.setCount(me->totvert);
+	weightselem.setCount(vcounts.size());
 
 	// write number of deformers per vertex
-	COLLADASW::PrimitivesBase::VCountList vcount;
-	int i;
-	for (i = 0; i < me->totvert; i++) {
-		vcount.push_back(me->dvert[i].totweight);
-	}
+	COLLADASW::PrimitivesBase::VCountList vcountlist;
 
-	weights.prepareToAppendVCountValues();
-	weights.appendVertexCount(vcount);
+	vcountlist.resize(vcounts.size());
+	std::copy(vcounts.begin(), vcounts.end(), vcountlist.begin());
 
-	// def group index -> joint index
-	std::map<int, int> joint_index_by_def_index;
-	bDeformGroup *def;
-	int j;
-	for (def = (bDeformGroup*)defbase->first, i = 0, j = 0; def; def = def->next, i++) {
-		if (is_bone_defgroup(ob_arm, def))
-			joint_index_by_def_index[i] = j++;
-		else
-			joint_index_by_def_index[i] = -1;
-	}
+	weightselem.prepareToAppendVCountValues();
+	weightselem.appendVertexCount(vcountlist);
 
-	weights.CloseVCountAndOpenVElement();
+	weightselem.CloseVCountAndOpenVElement();
 
 	// write deformer index - weight index pairs
 	int weight_index = 0;
-	for (i = 0; i < me->totvert; i++) {
-		MDeformVert *dvert = &me->dvert[i];
-		for (int j = 0; j < dvert->totweight; j++) {
-			weights.appendValues(joint_index_by_def_index[dvert->dw[j].def_nr]);
-			weights.appendValues(weight_index++);
-		}
+	for (std::list<int>::const_iterator i = joints.begin(); i != joints.end(); ++i)
+	{
+		weightselem.appendValues(*i, weight_index++);
 	}
 
-	weights.finish();
+	weightselem.finish();
 }
diff --git a/source/blender/collada/ArmatureExporter.h b/source/blender/collada/ArmatureExporter.h
index 925e65c..e9ee38d 100644
--- a/source/blender/collada/ArmatureExporter.h
+++ b/source/blender/collada/ArmatureExporter.h
@@ -28,6 +28,7 @@
 #ifndef __ARMATUREEXPORTER_H__
 #define __ARMATUREEXPORTER_H__
 
+#include <list>
 #include <string>
 //#include <vector>
 
@@ -47,6 +48,8 @@
 
 #include "ExportSettings.h"
 
+class SceneExporter;
+
 // XXX exporter writes wrong data for shared armatures.  A separate
 // controller should be written for each armature-mesh binding how do
 // we make controller ids then?
@@ -56,7 +59,8 @@ public:
 	ArmatureExporter(COLLADASW::StreamWriter *sw, const ExportSettings *export_settings);
 
 	// write bone nodes
-	void add_armature_bones(Object *ob_arm, Scene *sce);
+	void add_armature_bones(Object *ob_arm, Scene* sce, SceneExporter* se,
+							std::list<Object*>& child_objects);
 
 	bool is_skinned_mesh(Object *ob);
 
@@ -85,8 +89,10 @@ private:
 
 	std::string get_joint_sid(Bone *bone, Object *ob_arm);
 
-	// parent_mat is armature-space
-	void add_bone_node(Bone *bone, Object *ob_arm);
+	// Scene, SceneExporter and the list of child_objects
+	// are required for writing bone parented objects
+	void add_bone_node(Bone *bone, Object *ob_arm, Scene* sce, SceneExporter* se,
+					   std::list<Object*>& child_objects);
 
 	void add_bone_transform(Object *ob_arm, Bone *bone, COLLADASW::Node& node);
 
@@ -111,10 +117,11 @@ private:
 
 	bool is_bone_defgroup(Object *ob_arm, bDeformGroup* def);
 
-	std::string add_weights_source(Mesh *me, const std::string& controller_id);
+	std::string add_weights_source(Mesh *me, const std::string& controller_id,
+								   const std::list<float>& weights);
 
-	void add_vertex_weights_element(const std::string& weights_source_id, const std::string& joints_source_id, Mesh *me,
-									Object *ob_arm, ListBase *defbase);
+	void add_vertex_weights_element(const std::string& weights_source_id, const std::string& joints_source_id,
+									const std::list<int>& vcount, const std::list<int>& joints);
 };
 
 #endif
diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp
index 4bc0c18..a978a47 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -98,7 +98,7 @@ void ArmatureImporter::create_unskinned_bone( COLLADAFW::Node *node, EditBone *p
 	float angle = 0;
 
 	// get world-space
-	if (parent){
+	if (parent) {
 		mult_m4_m4m4(mat, parent_mat, obmat);
 
 	}
@@ -278,7 +278,7 @@ void ArmatureImporter::add_leaf_bone(float mat[][4], EditBone *bone,  COLLADAFW:
 	TagsMap::iterator etit;
 	ExtraTags *et = 0;
 	etit = uid_tags_map.find(node->getUniqueId().toAscii());
-	if(etit !=  uid_tags_map.end())
+	if (etit !=  uid_tags_map.end())
 	{
 		et = etit->second;
 		//else return;
@@ -306,7 +306,7 @@ void ArmatureImporter::fix_leaf_bones( )
 		float vec[3] = {0.0f, 0.0f, 0.1f};
 		
 		// if parent: take parent length and direction
-		if(leaf.bone->parent) sub_v3_v3v3(vec, leaf.bone->parent->tail, leaf.bone->parent->head);
+		if (leaf.bone->parent) sub_v3_v3v3(vec, leaf.bone->parent->tail, leaf.bone->parent->head);
 
 		copy_v3_v3(leaf.bone->tail, leaf.bone->head);
 		add_v3_v3v3(leaf.bone->tail, leaf.bone->head, vec);
@@ -410,12 +410,16 @@ void ArmatureImporter::create_armature_bones( )
 	std::vector<COLLADAFW::Node*>::iterator ri;
 	//if there is an armature created for root_joint next root_joint
 	for (ri = root_joints.begin(); ri != root_joints.end(); ri++) {
-			if ( get_armature_for_joint(*ri) != NULL ) continue;
+		if ( get_armature_for_joint(*ri) != NULL ) continue;
 		
 		//add armature object for current joint
 		//Object *ob_arm = add_object(scene, OB_ARMATURE);
 
 		Object *ob_arm = joint_parent_map[(*ri)->getUniqueId()];
+
+		if (!ob_arm)
+			continue;
+
 		//ob_arm->type = OB_ARMATURE;
 		ED_armature_to_edit(ob_arm);
 
@@ -423,24 +427,24 @@ void ArmatureImporter::create_armature_bones( )
 
 		// create unskinned bones
 		/*
-		   TODO:
-		   check if bones have already been created for a given joint
+		  TODO:
+		  check if bones have already been created for a given joint
 		*/
 		leaf_bone_length = FLT_MAX;
 		create_unskinned_bone(*ri, NULL, (*ri)->getChildNodes().getCount(), NULL, ob_arm);
 
 		fix_leaf_bones();
 
-	// exit armature edit mode
+		// exit armature edit mode
 	
-	unskinned_armature_map[(*ri)->getUniqueId()] = ob_arm;
+		unskinned_armature_map[(*ri)->getUniqueId()] = ob_arm;
 
-	ED_armature_from_edit(ob_arm);
+		ED_armature_from_edit(ob_arm);
 
-	set_pose(ob_arm , *ri, NULL, NULL ); 
+		set_pose(ob_arm , *ri, NULL, NULL ); 
 
-	ED_armature_edit_free(ob_arm);
-	DAG_id_tag_update(&ob_arm->id, OB_RECALC_OB|OB_RECALC_DATA);
+		ED_armature_edit_free(ob_arm);
+		DAG_id_tag_update(&ob_arm->id, OB_RECALC_OB|OB_RECALC_DATA);
 	}
 
 	
@@ -570,7 +574,7 @@ void ArmatureImporter::set_pose ( Object * ob_arm ,  COLLADAFW::Node * root_node
 { 
 	char * bone_name = (char *) bc_get_joint_name ( root_node);
 	float mat[4][4];
-   float obmat[4][4];
+	float obmat[4][4];
 
 	float ax[3];
 	float angle = 0.0f;
@@ -578,12 +582,12 @@ void ArmatureImporter::set_pose ( Object * ob_arm ,  COLLADAFW::Node * root_node
 	// object-space
 	get_node_mat(obmat, root_node, NULL, NULL);
 
-	//if(*edbone)
+	//if (*edbone)
 	bPoseChannel * pchan  = get_pose_channel(ob_arm -> pose ,  bone_name); 
 	//else fprintf ( "",
 
 	// get world-space
-	if (parentname){
+	if (parentname) {
 		mult_m4_m4m4(mat, parent_mat, obmat);
 		bPoseChannel *parchan = get_pose_channel(ob_arm->pose, parentname);
 
@@ -763,7 +767,7 @@ Object *ArmatureImporter::get_armature_for_joint(COLLADAFW::Node *node)
 
 	std::map<COLLADAFW::UniqueId, Object*>::iterator arm;
 	for (arm = unskinned_armature_map.begin(); arm != unskinned_armature_map.end(); arm++) {
-		if(arm->first == node->getUniqueId() )
+		if (arm->first == node->getUniqueId() )
 			return arm->second;
 	}
 	return NULL;
diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h
index 343bada..0c95ee8 100644
--- a/source/blender/collada/ArmatureImporter.h
+++ b/source/blender/collada/ArmatureImporter.h
@@ -24,8 +24,8 @@
  *  \ingroup collada
  */
 
-#ifndef __BC_ARMATUREIMPORTER_H__
-#define __BC_ARMATUREIMPORTER_H__
+#ifndef __ARMATUREIMPORTER_H__
+#define __ARMATUREIMPORTER_H__
 
 #include "COLLADAFWNode.h"
 #include "COLLADAFWUniqueId.h"
diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp
index 6e04a17..5226134 100644
--- a/source/blender/collada/DocumentExporter.cpp
+++ b/source/blender/collada/DocumentExporter.cpp
@@ -130,7 +130,7 @@ extern char build_rev[];
 char *bc_CustomData_get_layer_name(const struct CustomData *data, int type, int n)
 {
 	int layer_index = CustomData_get_layer_index(data, type);
-	if(layer_index < 0) return NULL;
+	if (layer_index < 0) return NULL;
 
 	return data->layers[layer_index+n].name;
 }
@@ -139,7 +139,7 @@ char *bc_CustomData_get_active_layer_name(const CustomData *data, int type)
 {
 	/* get the layer index of the active layer of type */
 	int layer_index = CustomData_get_active_layer_index(data, type);
-	if(layer_index < 0) return NULL;
+	if (layer_index < 0) return NULL;
 
 	return data->layers[layer_index].name;
 }
@@ -178,30 +178,30 @@ void DocumentExporter::exportCurrentScene(Scene *sce)
 	switch(RNA_property_enum_get(&unit_settings, system)) {
 		case USER_UNIT_NONE:
 		case USER_UNIT_METRIC:
-			if(linearmeasure == 0.001f) {
+			if (linearmeasure == 0.001f) {
 				unitname = "millimeter";
 			}
-			else if(linearmeasure == 0.01f) {
+			else if (linearmeasure == 0.01f) {
 				unitname = "centimeter";
 			}
-			else if(linearmeasure == 0.1f) {
+			else if (linearmeasure == 0.1f) {
 				unitname = "decimeter";
 			}
-			else if(linearmeasure == 1.0f) {
+			else if (linearmeasure == 1.0f) {
 				unitname = "meter";
 			}
-			else if(linearmeasure == 1000.0f) {
+			else if (linearmeasure == 1000.0f) {
 				unitname = "kilometer";
 			}
 			break;
 		case USER_UNIT_IMPERIAL:
-			if(linearmeasure == 0.0254f) {
+			if (linearmeasure == 0.0254f) {
 				unitname = "inch";
 			}
-			else if(linearmeasure == 0.3048f) {
+			else if (linearmeasure == 0.3048f) {
 				unitname = "foot";
 			}
-			else if(linearmeasure == 0.9144f) {
+			else if (linearmeasure == 0.9144f) {
 				unitname = "yard";
 			}
 			break;
@@ -211,29 +211,29 @@ void DocumentExporter::exportCurrentScene(Scene *sce)
 
 	asset.setUnit(unitname, linearmeasure);
 	asset.setUpAxisType(COLLADASW::Asset::Z_UP);
-	if(U.author[0] != '\0') {
+	if (U.author[0] != '\0') {
 		asset.getContributor().mAuthor = U.author;
 	}
 	else {
 		asset.getContributor().mAuthor = "Blender User";
 	}
-#ifdef WITH_BUILDINFO
 	char version_buf[128];
+#ifdef WITH_BUILDINFO
 	sprintf(version_buf, "Blender %d.%02d.%d r%s", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION, build_rev);
-	asset.getContributor().mAuthoringTool = version_buf;
 #else
-	asset.getContributor().mAuthoringTool = "Blender 2.5x";
+	sprintf(version_buf, "Blender %d.%02d.%d", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
 #endif
+	asset.getContributor().mAuthoringTool = version_buf;
 	asset.add();
 	
 	// <library_cameras>
-	if(has_object_type(sce, OB_CAMERA)) {
+	if (has_object_type(sce, OB_CAMERA)) {
 		CamerasExporter ce(&sw, this->export_settings);
 		ce.exportCameras(sce);
 	}
 	
 	// <library_lights>
-	if(has_object_type(sce, OB_LAMP)) {
+	if (has_object_type(sce, OB_LAMP)) {
 		LightsExporter le(&sw, this->export_settings);
 		le.exportLights(sce);
 	}
@@ -251,7 +251,7 @@ void DocumentExporter::exportCurrentScene(Scene *sce)
 	me.exportMaterials(sce);
 
 	// <library_geometries>
-	if(has_object_type(sce, OB_MESH)) {
+	if (has_object_type(sce, OB_MESH)) {
 		GeometryExporter ge(&sw, this->export_settings);
 		ge.exportGeom(sce);
 	}
@@ -262,7 +262,7 @@ void DocumentExporter::exportCurrentScene(Scene *sce)
 
 	// <library_controllers>
 	ArmatureExporter arm_exporter(&sw, this->export_settings);
-	if(has_object_type(sce, OB_ARMATURE)) {
+	if (has_object_type(sce, OB_ARMATURE)) {
 		arm_exporter.export_controllers(sce);
 	}
 
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp
index 05b2b3b..bc06061 100644
--- a/source/blender/collada/DocumentImporter.cpp
+++ b/source/blender/collada/DocumentImporter.cpp
@@ -121,10 +121,12 @@ bool DocumentImporter::import()
 	
 	loader.registerExtraDataCallbackHandler(ehandler);
 
-	if (!root.loadDocument(mFilename))
+	if (!root.loadDocument(mFilename)) {
+		fprintf(stderr, "COLLADAFW::Root::loadDocument() returned false on 1st pass\n");
 		return false;
+	}
 	
-	if(errorHandler.hasError())
+	if (errorHandler.hasError())
 		return false;
 	
 	/** TODO set up scene graph and such here */
@@ -134,8 +136,10 @@ bool DocumentImporter::import()
 	COLLADASaxFWL::Loader loader2;
 	COLLADAFW::Root root2(&loader2, this);
 	
-	if (!root2.loadDocument(mFilename))
+	if (!root2.loadDocument(mFilename)) {
+		fprintf(stderr, "COLLADAFW::Root::loadDocument() returned false on 2nd pass\n");
 		return false;
+	}
 	
 	
 	delete ehandler;
@@ -153,11 +157,11 @@ void DocumentImporter::cancel(const COLLADAFW::String& errorMessage)
 	// The latter sounds better.
 }
 
-void DocumentImporter::start(){}
+void DocumentImporter::start() {}
 
 void DocumentImporter::finish()
 {
-	if(mImportStage!=General)
+	if (mImportStage!=General)
 		return;
 		
 	/** TODO Break up and put into 2-pass parsing of DAE */
@@ -235,7 +239,15 @@ void DocumentImporter::finish()
 
 void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW::Node *par = NULL, Object *parob = NULL)
 {
-	if (par && par->getType() == COLLADAFW::Node::JOINT) {
+
+	// The split in #29246, rootmap must point at actual root when
+	// calculating bones in apply_curves_as_matrix.
+	// This has to do with inverse bind poses being world space
+	// (the sources for skinned bones' restposes) and the way
+	// non-skinning nodes have their "restpose" recursively calculated.
+	// XXX TODO: design issue, how to support unrelated joints taking
+	// part in skinning.
+	if (par) { // && par->getType() == COLLADAFW::Node::JOINT) {
 		// par is root if there's no corresp. key in root_map
 		if (root_map.find(par->getUniqueId()) == root_map.end())
 			root_map[node->getUniqueId()] = par;
@@ -264,7 +276,7 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW
 }
 
 /** When this method is called, the writer must write the global document asset.
-	@return The writer should return true, if writing succeeded, false otherwise.*/
+	\return The writer should return true, if writing succeeded, false otherwise.*/
 bool DocumentImporter::writeGlobalAsset ( const COLLADAFW::FileInfo* asset ) 
 {
 	unit_converter.read_asset(asset);
@@ -273,7 +285,7 @@ bool DocumentImporter::writeGlobalAsset ( const COLLADAFW::FileInfo* asset )
 }
 
 /** When this method is called, the writer must write the scene.
-	@return The writer should return true, if writing succeeded, false otherwise.*/
+	\return The writer should return true, if writing succeeded, false otherwise.*/
 bool DocumentImporter::writeScene ( const COLLADAFW::Scene* scene ) 
 {
 	// XXX could store the scene id, but do nothing for now
@@ -300,7 +312,7 @@ Object* DocumentImporter::create_lamp_object(COLLADAFW::InstanceLight *lamp, Sce
 {
 	const COLLADAFW::UniqueId& lamp_uid = lamp->getInstanciatedObjectId();
 	if (uid_lamp_map.find(lamp_uid) == uid_lamp_map.end()) {	
-		fprintf(stderr, "Couldn't find lamp by UID. \n");
+		fprintf(stderr, "Couldn't find lamp by UID.\n");
 		return NULL;
 	}
 	Object *ob = add_object(sce, OB_LAMP);
@@ -313,8 +325,10 @@ Object* DocumentImporter::create_lamp_object(COLLADAFW::InstanceLight *lamp, Sce
 	return ob;
 }
 
-Object* DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Node *source_node, COLLADAFW::Node *instance_node, Scene *sce, Object *par_ob, bool is_library_node)
+Object* DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Node *source_node, COLLADAFW::Node *instance_node, Scene *sce, bool is_library_node)
 {
+	fprintf(stderr, "create <instance_node> under node id=%s from node id=%s\n", instance_node ? instance_node->getOriginalId().c_str() : NULL, source_node ? source_node->getOriginalId().c_str() : NULL);
+
 	Object *obn = copy_object(source_ob);
 	obn->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
 	scene_add_base(sce, obn);
@@ -325,7 +339,7 @@ Object* DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Nod
 		// transformation matrix and apply it to the newly instantiated
 		// object to account for node hierarchy transforms in
 		// .dae
-		if(source_node) {
+		if (source_node) {
 			COLLADABU::Math::Matrix4 mat4 = source_node->getTransformationMatrix();
 			COLLADABU::Math::Matrix4 bmat4 = mat4.transpose(); // transpose to get blender row-major order
 			float mat[4][4];
@@ -357,10 +371,10 @@ Object* DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Nod
 			Object *new_child = NULL;
 			if (inodes.getCount()) { // \todo loop through instance nodes
 				const COLLADAFW::UniqueId& id = inodes[0]->getInstanciatedObjectId();
-				new_child = create_instance_node(object_map[id], node_map[id], child_node, sce, NULL, is_library_node);
+				new_child = create_instance_node(object_map[id], node_map[id], child_node, sce, is_library_node);
 			}
 			else {
-				new_child = create_instance_node(object_map[child_id], child_node, NULL, sce, NULL, is_library_node);
+				new_child = create_instance_node(object_map[child_id], child_node, NULL, sce, is_library_node);
 			}
 			bc_set_parent(new_child, obn, mContext, true);
 
@@ -369,21 +383,14 @@ Object* DocumentImporter::create_instance_node(Object *source_ob, COLLADAFW::Nod
 		}
 	}
 
-	// when we have an instance_node, don't return the object, because otherwise
-	// its correct location gets overwritten in write_node(). Fixes bug #26012.
-	if(instance_node) {
-		if (par_ob && obn)
-			bc_set_parent(obn, par_ob, mContext);
-		return NULL;
-	}
-
-	else return obn;
+	return obn;
 }
 
 void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *parent_node, Scene *sce, Object *par, bool is_library_node)
 {
 	Object *ob = NULL;
 	bool is_joint = node->getType() == COLLADAFW::Node::JOINT;
+	bool read_transform = true;
 
 	if (is_joint) {
 		if ( par ) {
@@ -432,16 +439,18 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren
 		while (inst_done < inst_node.getCount()) {
 			const COLLADAFW::UniqueId& node_id = inst_node[inst_done]->getInstanciatedObjectId();
 			if (object_map.find(node_id) == object_map.end()) {
-				fprintf(stderr, "Cannot find node to instanciate.\n");
+				fprintf(stderr, "Cannot find object for node referenced by <instance_node name=\"%s\">.\n", inst_node[inst_done]->getName().c_str());
 				ob = NULL;
 			}
 			else {
 				Object *source_ob = object_map[node_id];
 				COLLADAFW::Node *source_node = node_map[node_id];
 
-				ob = create_instance_node(source_ob, source_node, node, sce, par, is_library_node);
+				ob = create_instance_node(source_ob, source_node, node, sce, is_library_node);
 			}
 			++inst_done;
+
+			read_transform = false;
 		}
 		// if node is empty - create empty object
 		// XXX empty node may not mean it is empty object, not sure about this
@@ -449,7 +458,8 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren
 			ob = add_object(sce, OB_EMPTY);
 		}
 		
-		// check if object is not NULL
+		// XXX: if there're multiple instances, only one is stored
+
 		if (!ob) return;
 		
 		std::string nodename = node->getName().size() ? node->getName() : node->getOriginalId();
@@ -462,7 +472,8 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren
 			libnode_ob.push_back(ob);
 	}
 
-	anim_importer.read_node_transform(node, ob); // overwrites location set earlier
+	if (read_transform)
+		anim_importer.read_node_transform(node, ob); // overwrites location set earlier
 
 	if (!is_joint) {
 		// if par was given make this object child of the previous 
@@ -478,10 +489,10 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren
 }
 
 /** When this method is called, the writer must write the entire visual scene.
-	@return The writer should return true, if writing succeeded, false otherwise.*/
+	\return The writer should return true, if writing succeeded, false otherwise.*/
 bool DocumentImporter::writeVisualScene ( const COLLADAFW::VisualScene* visualScene ) 
 {
-	if(mImportStage!=General)
+	if (mImportStage!=General)
 		return true;
 		
 	// this method called on post process after writeGeometry, writeMaterial, etc.
@@ -501,10 +512,10 @@ bool DocumentImporter::writeVisualScene ( const COLLADAFW::VisualScene* visualSc
 
 /** 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.*/
+	\return The writer should return true, if writing succeeded, false otherwise.*/
 bool DocumentImporter::writeLibraryNodes ( const COLLADAFW::LibraryNodes* libraryNodes ) 
 {
-	if(mImportStage!=General)
+	if (mImportStage!=General)
 		return true;
 		
 	Scene *sce = CTX_data_scene(mContext);
@@ -519,20 +530,20 @@ bool DocumentImporter::writeLibraryNodes ( const COLLADAFW::LibraryNodes* librar
 }
 
 /** When this method is called, the writer must write the geometry.
-	@return The writer should return true, if writing succeeded, false otherwise.*/
+	\return The writer should return true, if writing succeeded, false otherwise.*/
 bool DocumentImporter::writeGeometry ( const COLLADAFW::Geometry* geom ) 
 {
-	if(mImportStage!=General)
+	if (mImportStage!=General)
 		return true;
 		
 	return mesh_importer.write_geometry(geom);
 }
 
 /** When this method is called, the writer must write the material.
-	@return The writer should return true, if writing succeeded, false otherwise.*/
+	\return The writer should return true, if writing succeeded, false otherwise.*/
 bool DocumentImporter::writeMaterial( const COLLADAFW::Material* cmat ) 
 {
-	if(mImportStage!=General)
+	if (mImportStage!=General)
 		return true;
 		
 	const std::string& str_mat_id = cmat->getName().size() ? cmat->getName() : cmat->getOriginalId();
@@ -688,10 +699,10 @@ void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia
 		}
 	}
 	
-	if(ef->getOpacity().isTexture()) {
+	if (ef->getOpacity().isTexture()) {
 		COLLADAFW::Texture ctex = ef->getOpacity().getTexture();
 		mtex = create_texture(ef, ctex, ma, i, texindex_texarray_map);
-		if(mtex != NULL) {
+		if (mtex != NULL) {
 			mtex->mapto = MAP_ALPHA;
 			mtex->tex->imaflag |= TEX_USEALPHA;
 			i++;
@@ -717,11 +728,11 @@ void DocumentImporter::write_profile_COMMON(COLLADAFW::EffectCommon *ef, Materia
 }
 
 /** When this method is called, the writer must write the effect.
-	@return The writer should return true, if writing succeeded, false otherwise.*/
+	\return The writer should return true, if writing succeeded, false otherwise.*/
 
 bool DocumentImporter::writeEffect( const COLLADAFW::Effect* effect ) 
 {
-	if(mImportStage!=General)
+	if (mImportStage!=General)
 		return true;
 	
 	const COLLADAFW::UniqueId& uid = effect->getUniqueId();
@@ -733,7 +744,7 @@ bool DocumentImporter::writeEffect( const COLLADAFW::Effect* effect )
 	
 	Material *ma = uid_effect_map[uid];
 	std::map<COLLADAFW::UniqueId, Material*>::iterator  iter;
-	for(iter = uid_material_map.begin(); iter != uid_material_map.end() ; iter++ )
+	for (iter = uid_material_map.begin(); iter != uid_material_map.end() ; iter++ )
 	{
 		if ( iter->second == ma ) {
 			this->FW_object_map[iter->first] = effect;
@@ -756,10 +767,10 @@ bool DocumentImporter::writeEffect( const COLLADAFW::Effect* effect )
 
 
 /** When this method is called, the writer must write the camera.
-	@return The writer should return true, if writing succeeded, false otherwise.*/
+	\return The writer should return true, if writing succeeded, false otherwise.*/
 bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera ) 
 {
-	if(mImportStage!=General)
+	if (mImportStage!=General)
 		return true;
 		
 	Camera *cam = NULL;
@@ -771,7 +782,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera )
 	else cam = (Camera*)add_camera((char*)cam_id.c_str());
 	
 	if (!cam) {
-		fprintf(stderr, "Cannot create camera. \n");
+		fprintf(stderr, "Cannot create camera.\n");
 		return true;
 	}
 	cam->clipsta = camera->getNearClippingPlane().getValue();
@@ -791,7 +802,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera )
 		break;
 	case COLLADAFW::Camera::UNDEFINED_CAMERATYPE:
 		{
-			fprintf(stderr, "Current camera type is not supported. \n");
+			fprintf(stderr, "Current camera type is not supported.\n");
 			cam->type = CAM_PERSP;
 		}
 		break;
@@ -872,10 +883,10 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera )
 }
 
 /** When this method is called, the writer must write the image.
-	@return The writer should return true, if writing succeeded, false otherwise.*/
+	\return The writer should return true, if writing succeeded, false otherwise.*/
 bool DocumentImporter::writeImage( const COLLADAFW::Image* image ) 
 {
-	if(mImportStage!=General)
+	if (mImportStage!=General)
 		return true;
 		
 	// XXX maybe it is necessary to check if the path is absolute or relative
@@ -888,7 +899,7 @@ bool DocumentImporter::writeImage( const COLLADAFW::Image* image )
 	BLI_join_dirfile(full_path, sizeof(full_path), dir, filepath.c_str());
 	Image *ima = BKE_add_image_file(full_path);
 	if (!ima) {
-		fprintf(stderr, "Cannot create image. \n");
+		fprintf(stderr, "Cannot create image.\n");
 		return true;
 	}
 	this->uid_image_map[image->getUniqueId()] = ima;
@@ -897,10 +908,10 @@ bool DocumentImporter::writeImage( const COLLADAFW::Image* image )
 }
 
 /** When this method is called, the writer must write the light.
-	@return The writer should return true, if writing succeeded, false otherwise.*/
+	\return The writer should return true, if writing succeeded, false otherwise.*/
 bool DocumentImporter::writeLight( const COLLADAFW::Light* light ) 
 {
-	if(mImportStage!=General)
+	if (mImportStage!=General)
 		return true;
 
 	Lamp *lamp = NULL;
@@ -909,7 +920,7 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light )
 	TagsMap::iterator etit;
 	ExtraTags *et = 0;
 	etit = uid_tags_map.find(light->getUniqueId().toAscii());
-	if(etit != uid_tags_map.end())
+	if (etit != uid_tags_map.end())
 		et = etit->second;
 
 	la_id = light->getOriginalId();
@@ -918,12 +929,12 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light )
 	else lamp = (Lamp*)add_lamp((char*)la_id.c_str());
 
 	if (!lamp) {
-		fprintf(stderr, "Cannot create lamp. \n");
+		fprintf(stderr, "Cannot create lamp.\n");
 		return true;
 	}
 
 	// if we find an ExtraTags for this, use that instead.
-	if(et && et->isProfile("blender")) {
+	if (et && et->isProfile("blender")) {
 		et->setData("type", &(lamp->type));
 		et->setData("flag", &(lamp->flag));
 		et->setData("mode", &(lamp->mode));
@@ -996,17 +1007,19 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light )
 			lamp->b = col.getBlue();
 		}
 
-		if(IS_EQ(linatt, 0.0f) && quadatt > 0.0f) {
+		if (IS_EQ(linatt, 0.0f) && quadatt > 0.0f) {
 			att2 = quadatt;
 			d = sqrt(1.0f/quadatt);
 		}
 		// linear light
-		else if(IS_EQ(quadatt, 0.0f) && linatt > 0.0f) {
+		else if (IS_EQ(quadatt, 0.0f) && linatt > 0.0f) {
 			att1 = linatt;
 			d = (1.0f/linatt);
-		} else if (IS_EQ(constatt, 1.0f)) {
+		}
+		else if (IS_EQ(constatt, 1.0f)) {
 			att1 = 1.0f;
-		} else {
+		}
+		else {
 			// assuming point light (const att = 1.0);
 			att1 = 1.0f;
 		}
@@ -1028,9 +1041,9 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light )
 					lamp->type = LA_SPOT;
 					lamp->att1 = att1;
 					lamp->att2 = att2;
-					if(IS_EQ(att1, 0.0f) && att2 > 0)
+					if (IS_EQ(att1, 0.0f) && att2 > 0)
 						lamp->falloff_type = LA_FALLOFF_INVSQUARE;
-					if(IS_EQ(att2, 0.0f) && att1 > 0)
+					if (IS_EQ(att2, 0.0f) && att1 > 0)
 						lamp->falloff_type = LA_FALLOFF_INVLINEAR;
 					lamp->spotsize = light->getFallOffAngle().getValue();
 					lamp->spotblend = light->getFallOffExponent().getValue();
@@ -1048,15 +1061,15 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light )
 					lamp->type = LA_LOCAL;
 					lamp->att1 = att1;
 					lamp->att2 = att2;
-					if(IS_EQ(att1, 0.0f) && att2 > 0)
+					if (IS_EQ(att1, 0.0f) && att2 > 0)
 						lamp->falloff_type = LA_FALLOFF_INVSQUARE;
-					if(IS_EQ(att2, 0.0f) && att1 > 0)
+					if (IS_EQ(att2, 0.0f) && att1 > 0)
 						lamp->falloff_type = LA_FALLOFF_INVLINEAR;
 				}
 				break;
 			case COLLADAFW::Light::UNDEFINED:
 				{
-					fprintf(stderr, "Current lamp type is not supported. \n");
+					fprintf(stderr, "Current lamp type is not supported.\n");
 					lamp->type = LA_LOCAL;
 				}
 				break;
@@ -1071,7 +1084,7 @@ bool DocumentImporter::writeLight( const COLLADAFW::Light* light )
 // this function is called only for animations that pass COLLADAFW::validate
 bool DocumentImporter::writeAnimation( const COLLADAFW::Animation* anim ) 
 {
-	if(mImportStage!=General)
+	if (mImportStage!=General)
 		return true;
 		
 	// return true;
@@ -1081,7 +1094,7 @@ bool DocumentImporter::writeAnimation( const COLLADAFW::Animation* anim )
 // called on post-process stage after writeVisualScenes
 bool DocumentImporter::writeAnimationList( const COLLADAFW::AnimationList* animationList ) 
 {
-	if(mImportStage!=General)
+	if (mImportStage!=General)
 		return true;
 		
 	// return true;
@@ -1089,7 +1102,7 @@ bool DocumentImporter::writeAnimationList( const COLLADAFW::AnimationList* anima
 }
 
 /** When this method is called, the writer must write the skin controller data.
-	@return The writer should return true, if writing succeeded, false otherwise.*/
+	\return The writer should return true, if writing succeeded, false otherwise.*/
 bool DocumentImporter::writeSkinControllerData( const COLLADAFW::SkinControllerData* skin ) 
 {
 	return armature_importer.write_skin_controller_data(skin);
@@ -1098,7 +1111,7 @@ bool DocumentImporter::writeSkinControllerData( const COLLADAFW::SkinControllerD
 // this is called on postprocess, before writeVisualScenes
 bool DocumentImporter::writeController( const COLLADAFW::Controller* controller ) 
 {
-	if(mImportStage!=General)
+	if (mImportStage!=General)
 		return true;
 		
 	return armature_importer.write_controller(controller);
@@ -1116,7 +1129,7 @@ bool DocumentImporter::writeKinematicsScene( const COLLADAFW::KinematicsScene* k
 
 ExtraTags* DocumentImporter::getExtraTags(const COLLADAFW::UniqueId &uid)
 {
-	if(uid_tags_map.find(uid.toAscii())==uid_tags_map.end()) {
+	if (uid_tags_map.find(uid.toAscii())==uid_tags_map.end()) {
 		return NULL;
 	}
 	return uid_tags_map[uid.toAscii()];
diff --git a/source/blender/collada/DocumentImporter.h b/source/blender/collada/DocumentImporter.h
index 96c587e..606218b 100644
--- a/source/blender/collada/DocumentImporter.h
+++ b/source/blender/collada/DocumentImporter.h
@@ -72,7 +72,7 @@ public:
 	/** these should not be here */
 	Object* create_camera_object(COLLADAFW::InstanceCamera*, Scene*);
 	Object* create_lamp_object(COLLADAFW::InstanceLight*, Scene*);
-	Object* create_instance_node(Object*, COLLADAFW::Node*, COLLADAFW::Node*, Scene*, Object*, bool);
+	Object* create_instance_node(Object*, COLLADAFW::Node*, COLLADAFW::Node*, Scene*, bool);
 	void write_node(COLLADAFW::Node*, COLLADAFW::Node*, Scene*, Object*, bool);
 	MTex* create_texture(COLLADAFW::EffectCommon*, COLLADAFW::Texture&, Material*, int, TexIndexTextureArrayMap&);
 	void write_profile_COMMON(COLLADAFW::EffectCommon*, Material*);
@@ -80,7 +80,7 @@ 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);
 
diff --git a/source/blender/collada/EffectExporter.cpp b/source/blender/collada/EffectExporter.cpp
index 7ada149..9720b92 100644
--- a/source/blender/collada/EffectExporter.cpp
+++ b/source/blender/collada/EffectExporter.cpp
@@ -63,7 +63,7 @@ bool EffectsExporter::hasEffects(Scene *sce)
 	while(base) {
 		Object *ob= base->object;
 		int a;
-		for(a = 0; a < ob->totcol; a++)
+		for (a = 0; a < ob->totcol; a++)
 		{
 			Material *ma = give_current_material(ob, a+1);
 
@@ -79,7 +79,7 @@ bool EffectsExporter::hasEffects(Scene *sce)
 
 void EffectsExporter::exportEffects(Scene *sce)
 {
-	if(hasEffects(sce)) {
+	if (hasEffects(sce)) {
 		this->scene = sce;
 		openLibrary();
 		MaterialFunctor mf;
@@ -129,7 +129,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
 	ep.setProfileType(COLLADASW::EffectProfile::COMMON);
 	ep.openProfile();
 	// set shader type - one of three blinn, phong or lambert
-	if(ma->spec>0.0f) {
+	if (ma->spec>0.0f) {
 		if (ma->spec_shader == MA_SPEC_BLINN) {
 			writeBlinn(ep, ma);
 		}
@@ -138,8 +138,9 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
 			// for now set phong in case spec shader is not blinn
 			writePhong(ep, ma);
 		}
-	} else {
-		if(ma->diff_shader == MA_DIFF_LAMBERT) {
+	}
+	else {
+		if (ma->diff_shader == MA_DIFF_LAMBERT) {
 			writeLambert(ep, ma);
 		}
 		else {
@@ -176,7 +177,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
 
 	// ambient
 	/* ma->ambX is calculated only on render, so lets do it here manually and not rely on ma->ambX. */
-	if(this->scene->world)
+	if (this->scene->world)
 		cot = getcol(this->scene->world->ambr*ma->amb, this->scene->world->ambg*ma->amb, this->scene->world->ambb*ma->amb, 1.0f);
 	else
 		cot = getcol(ma->amb, ma->amb, ma->amb, 1.0f);
@@ -219,7 +220,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
 		Image *ima = t->tex->ima;
 		
 		// Image not set for texture
-		if(!ima) continue;
+		if (!ima) continue;
 		
 		std::string key(id_name(ima));
 		key = translate_id(key);
@@ -265,7 +266,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
 		Image *ima = t->tex->ima;
 		
 		// Image not set for texture
-		if(!ima) continue;
+		if (!ima) continue;
 
 		// we assume map input is always TEXCO_UV
 
@@ -363,9 +364,10 @@ void EffectsExporter::createTextureIndices(Material *ma, std::vector<int> &indic
 
 	for (int a = 0; a < MAX_MTEX; a++) {
 		if (ma->mtex[a] &&
-			ma->mtex[a]->tex &&
-			ma->mtex[a]->tex->type == TEX_IMAGE &&
-			ma->mtex[a]->texco == TEXCO_UV){
+		    ma->mtex[a]->tex &&
+		    ma->mtex[a]->tex->type == TEX_IMAGE &&
+		    ma->mtex[a]->texco == TEXCO_UV)
+		{
 			indices.push_back(a);
 		}
 	}
diff --git a/source/blender/collada/ErrorHandler.cpp b/source/blender/collada/ErrorHandler.cpp
index 9ed8034..1c0f40d 100644
--- a/source/blender/collada/ErrorHandler.cpp
+++ b/source/blender/collada/ErrorHandler.cpp
@@ -83,5 +83,9 @@ bool ErrorHandler::handleError( const COLLADASaxFWL::IError* error )
 		COLLADASaxFWL::SaxFWLError* saxFWLError = (COLLADASaxFWL::SaxFWLError*) error;
 		std::cout << "Sax FWL Error: " << saxFWLError->getErrorMessage() << std::endl;
 	}
+	else {
+		std::cout << "opencollada error: " << error->getFullErrorMessage() << std::endl;
+	}
+
 	return false;
 }
diff --git a/source/blender/collada/ExtraHandler.cpp b/source/blender/collada/ExtraHandler.cpp
index d6d3aa8..6606fe1 100644
--- a/source/blender/collada/ExtraHandler.cpp
+++ b/source/blender/collada/ExtraHandler.cpp
@@ -54,7 +54,7 @@ bool ExtraHandler::textData(const char* text, size_t textLength)
 {
 	char buf[1024];
 	
-	if(currentElement.length() == 0 || currentExtraTags == 0) return false;
+	if (currentElement.length() == 0 || currentExtraTags == 0) return false;
 	
 	BLI_snprintf(buf, textLength+1, "%s", text);
 	currentExtraTags->addTag(currentElement, std::string(buf));
@@ -65,11 +65,11 @@ bool ExtraHandler::parseElement (
 	const char* profileName, 
 	const unsigned long& elementHash, 
 	const COLLADAFW::UniqueId& uniqueId ) {
-		if(BLI_strcaseeq(profileName, "blender")) {
+		if (BLI_strcaseeq(profileName, "blender")) {
 			//printf("In parseElement for supported profile %s for id %s\n", profileName, uniqueId.toAscii().c_str());
 			currentUid = uniqueId;
 			ExtraTags *et = dimp->getExtraTags(uniqueId);
-			if(!et) {
+			if (!et) {
 				et = new ExtraTags(std::string(profileName));
 				dimp->addExtraTags(uniqueId, et);
 			}
diff --git a/source/blender/collada/ExtraHandler.h b/source/blender/collada/ExtraHandler.h
index eb7d32b..68656df 100644
--- a/source/blender/collada/ExtraHandler.h
+++ b/source/blender/collada/ExtraHandler.h
@@ -35,7 +35,7 @@
 #include "DocumentImporter.h"
 #include "AnimationImporter.h"
 
-/** \brief Handler class for <extra> data, through which different
+/** \brief Handler class for \<extra\> data, through which different
  * profiles can be handled
  */
 class ExtraHandler : public COLLADASaxFWL::IExtraDataCallbackHandler
diff --git a/source/blender/collada/ExtraTags.cpp b/source/blender/collada/ExtraTags.cpp
index b1b1936..c5a1268 100644
--- a/source/blender/collada/ExtraTags.cpp
+++ b/source/blender/collada/ExtraTags.cpp
@@ -56,7 +56,7 @@ bool ExtraTags::addTag( std::string tag,  std::string data)
 
 int ExtraTags::asInt( std::string tag, bool *ok)
 {
-	if(tags.find(tag) == tags.end()) {
+	if (tags.find(tag) == tags.end()) {
 		*ok = false;
 		return -1;
 	}
@@ -66,7 +66,7 @@ int ExtraTags::asInt( std::string tag, bool *ok)
 
 float ExtraTags::asFloat( std::string tag, bool *ok)
 {
-	if(tags.find(tag) == tags.end()) {
+	if (tags.find(tag) == tags.end()) {
 		*ok = false;
 		return -1.0f;
 	}
@@ -76,7 +76,7 @@ float ExtraTags::asFloat( std::string tag, bool *ok)
 
 std::string ExtraTags::asString( std::string tag, bool *ok)
 {
-	if(tags.find(tag) == tags.end()) {
+	if (tags.find(tag) == tags.end()) {
 		*ok = false;
 		return "";
 	}
@@ -89,28 +89,28 @@ void ExtraTags::setData(std::string tag, short *data)
 {
 	bool ok = false;
 	int tmp = asInt(tag, &ok);
-	if(ok)
+	if (ok)
 		*data = (short)tmp;
 }
 void ExtraTags::setData(std::string tag, int *data)
 {
 	bool ok = false;
 	int tmp = asInt(tag, &ok);
-	if(ok)
+	if (ok)
 		*data = tmp;
 }
 void ExtraTags::setData(std::string tag, float *data)
 {
 	bool ok = false;
 	float tmp = asFloat(tag, &ok);
-	if(ok)
+	if (ok)
 		*data = tmp;
 }
 void ExtraTags::setData(std::string tag, char *data)
 {
 	bool ok = false;
 	int tmp = asInt(tag, &ok);
-	if(ok)
+	if (ok)
 		*data = (char)tmp;
 }
 	
diff --git a/source/blender/collada/ExtraTags.h b/source/blender/collada/ExtraTags.h
index 1655ff0..f8d12e6 100644
--- a/source/blender/collada/ExtraTags.h
+++ b/source/blender/collada/ExtraTags.h
@@ -28,7 +28,7 @@
 #include <map>
 #include <vector>
 
-/** \brief Class for saving <extra> tags for a specific UniqueId.
+/** \brief Class for saving \<extra\> tags for a specific UniqueId.
  */
 class ExtraTags
 {
diff --git a/source/blender/collada/GeometryExporter.cpp b/source/blender/collada/GeometryExporter.cpp
index 4a838e9..ca112ab 100644
--- a/source/blender/collada/GeometryExporter.cpp
+++ b/source/blender/collada/GeometryExporter.cpp
@@ -38,6 +38,7 @@
 #include "DNA_meshdata_types.h"
 #include "BKE_customdata.h"
 #include "BKE_material.h"
+#include "BKE_mesh.h"
 
 #include "collada_internal.h"
 
@@ -64,6 +65,8 @@ void GeometryExporter::operator()(Object *ob)
 	DerivedMesh *dm = mesh_get_derived_final(mScene, ob, CD_MASK_BAREMESH);
 #endif
 	Mesh *me = (Mesh*)ob->data;
+	BKE_mesh_tessface_ensure(me);
+
 	std::string geom_id = get_geometry_id(ob);
 	std::string geom_name = id_name(ob->data);
 	std::vector<Normal> nor;
@@ -106,7 +109,7 @@ void GeometryExporter::operator()(Object *ob)
 
 	// XXX slow		
 	if (ob->totcol) {
-		for(int a = 0; a < ob->totcol; a++)	{
+		for (int a = 0; a < ob->totcol; a++)	{
 			createPolylist(a, has_uvs, has_color, ob, geom_id, norind);
 		}
 	}
@@ -322,8 +325,8 @@ std::string GeometryExporter::makeTexcoordSourceId(std::string& geom_id, int lay
 void GeometryExporter::createTexcoordsSource(std::string geom_id, Mesh *me)
 {
 #if 0
-	int totfaces = dm->getNumFaces(dm);
-	MFace *mfaces = dm->getFaceArray(dm);
+	int totfaces = dm->getNumTessFaces(dm);
+	MFace *mfaces = dm->getTessFaceArray(dm);
 #endif
 	int totfaces = me->totface;
 	MFace *mfaces = me->mface;
@@ -457,12 +460,14 @@ void GeometryExporter::create_normals(std::vector<Normal> &nor, std::vector<Face
 	}
 }
 
-std::string GeometryExporter::getIdBySemantics(std::string geom_id, COLLADASW::InputSemantic::Semantics type, std::string other_suffix) {
+std::string GeometryExporter::getIdBySemantics(std::string geom_id, COLLADASW::InputSemantic::Semantics type, std::string other_suffix)
+{
 	return geom_id + getSuffixBySemantic(type) + other_suffix;
 }
 
 
-COLLADASW::URI GeometryExporter::getUrlBySemantics(std::string geom_id, COLLADASW::InputSemantic::Semantics type, std::string other_suffix) {
+COLLADASW::URI GeometryExporter::getUrlBySemantics(std::string geom_id, COLLADASW::InputSemantic::Semantics type, std::string other_suffix)
+{
 	
 	std::string id(getIdBySemantics(geom_id, type, other_suffix));
 	return COLLADASW::URI(COLLADABU::Utils::EMPTY_STRING, id);
diff --git a/source/blender/collada/ImageExporter.cpp b/source/blender/collada/ImageExporter.cpp
index 3926cb4..946effd 100644
--- a/source/blender/collada/ImageExporter.cpp
+++ b/source/blender/collada/ImageExporter.cpp
@@ -51,7 +51,7 @@ bool ImagesExporter::hasImages(Scene *sce)
 	while(base) {
 		Object *ob= base->object;
 		int a;
-		for(a = 0; a < ob->totcol; a++)
+		for (a = 0; a < ob->totcol; a++)
 		{
 			Material *ma = give_current_material(ob, a+1);
 
@@ -71,7 +71,7 @@ bool ImagesExporter::hasImages(Scene *sce)
 
 void ImagesExporter::exportImages(Scene *sce)
 {
-	if(hasImages(sce)) {
+	if (hasImages(sce)) {
 		openLibrary();
 		MaterialFunctor mf;
 		mf.forEachMaterialInScene<ImagesExporter>(sce, *this, this->export_settings->selected);
@@ -109,7 +109,7 @@ void ImagesExporter::operator()(Material *ma, Object *ob)
 				BLI_make_existing_file(abs);
 			
 				if (BLI_copy(src, abs) != 0) {
-					fprintf(stderr, "Cannot copy image to file's directory. \n");
+					fprintf(stderr, "Cannot copy image to file's directory.\n");
 				}
 			} 
 			
diff --git a/source/blender/collada/InstanceWriter.cpp b/source/blender/collada/InstanceWriter.cpp
index 40ca1bc..a605bde 100644
--- a/source/blender/collada/InstanceWriter.cpp
+++ b/source/blender/collada/InstanceWriter.cpp
@@ -43,7 +43,7 @@
 
 void InstanceWriter::add_material_bindings(COLLADASW::BindMaterial& bind_material, Object *ob)
 {
-	for(int a = 0; a < ob->totcol; a++)	{
+	for (int a = 0; a < ob->totcol; a++)	{
 		Material *ma = give_current_material(ob, a+1);
 			
 		COLLADASW::InstanceMaterialList& iml = bind_material.getInstanceMaterialList();
diff --git a/source/blender/collada/LightExporter.cpp b/source/blender/collada/LightExporter.cpp
index d74a1d1..51242b3 100644
--- a/source/blender/collada/LightExporter.cpp
+++ b/source/blender/collada/LightExporter.cpp
@@ -73,7 +73,7 @@ void LightsExporter::operator()(Object *ob)
 	
 	constatt = 1.0f;
 	
-	if(la->falloff_type==LA_FALLOFF_INVLINEAR) {
+	if (la->falloff_type==LA_FALLOFF_INVLINEAR) {
 		linatt = 1.0f / d;
 		quadatt = 0.0f;
 	}
diff --git a/source/blender/collada/MaterialExporter.cpp b/source/blender/collada/MaterialExporter.cpp
index b667799..1e3358c 100644
--- a/source/blender/collada/MaterialExporter.cpp
+++ b/source/blender/collada/MaterialExporter.cpp
@@ -35,7 +35,7 @@ MaterialsExporter::MaterialsExporter(COLLADASW::StreamWriter *sw, const ExportSe
 
 void MaterialsExporter::exportMaterials(Scene *sce)
 {
-	if(hasMaterials(sce)) {
+	if (hasMaterials(sce)) {
 		openLibrary();
 
 		MaterialFunctor mf;
@@ -53,7 +53,7 @@ bool MaterialsExporter::hasMaterials(Scene *sce)
 	while(base) {
 		Object *ob= base->object;
 		int a;
-		for(a = 0; a < ob->totcol; a++)
+		for (a = 0; a < ob->totcol; a++)
 		{
 			Material *ma = give_current_material(ob, a+1);
 
diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp
index 1e5783f..5c01c31 100644
--- a/source/blender/collada/MeshImporter.cpp
+++ b/source/blender/collada/MeshImporter.cpp
@@ -145,7 +145,7 @@ void WVDataWrapper::print()
 void UVDataWrapper::getUV(int uv_index, float *uv)
 {
 	int stride = mVData->getStride(0);
-	if(stride==0) stride = 2;
+	if (stride==0) stride = 2;
 
 	switch(mVData->getType()) {
 	case COLLADAFW::MeshVertexData::DATA_TYPE_FLOAT:
@@ -180,7 +180,7 @@ void MeshImporter::set_face_indices(MFace *mface, unsigned int *indices, bool qu
 	if (quad) mface->v4 = indices[3];
 	else mface->v4 = 0;
 #ifdef COLLADA_DEBUG
-	// fprintf(stderr, "%u, %u, %u \n", indices[0], indices[1], indices[2]);
+	// fprintf(stderr, "%u, %u, %u\n", indices[0], indices[1], indices[2]);
 #endif
 }
 
@@ -281,7 +281,7 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh)	// checks if mesh has sup
 			COLLADAFW::Polygons *mpvc = (COLLADAFW::Polygons*)mp;
 			COLLADAFW::Polygons::VertexCountArray& vca = mpvc->getGroupedVerticesVertexCountArray();
 			
-			for(unsigned int j = 0; j < vca.getCount(); j++){
+			for (unsigned int j = 0; j < vca.getCount(); j++) {
 				int count = vca[j];
 				if (count < 3) {
 					fprintf(stderr, "Primitive %s in %s has at least one face with vertex count < 3\n",
@@ -291,7 +291,7 @@ bool MeshImporter::is_nice_mesh(COLLADAFW::Mesh *mesh)	// checks if mesh has sup
 			}
 				
 		}
-		else if(type != COLLADAFW::MeshPrimitive::TRIANGLES && type!= COLLADAFW::MeshPrimitive::TRIANGLE_FANS) {
+		else if (type != COLLADAFW::MeshPrimitive::TRIANGLES && type!= COLLADAFW::MeshPrimitive::TRIANGLE_FANS) {
 			fprintf(stderr, "Primitive type %s is not supported.\n", type_str);
 			return false;
 		}
@@ -310,7 +310,7 @@ void MeshImporter::read_vertices(COLLADAFW::Mesh *mesh, Mesh *me)
 	// vertices
 	COLLADAFW::MeshVertexData& pos = mesh->getPositions();
 	int stride = pos.getStride(0);
-	if(stride==0) stride = 3;
+	if (stride==0) stride = 3;
 	
 	me->totvert = mesh->getPositions().getFloatValues()->getCount() / stride;
 	me->mvert = (MVert*)CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, me->totvert);
@@ -486,7 +486,7 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) //T
 #endif
 		
 		if (type == COLLADAFW::MeshPrimitive::TRIANGLES) {
-			for (j = 0; j < prim_totface; j++){
+			for (j = 0; j < prim_totface; j++) {
 				
 				set_face_indices(mface, indices, false);
 				indices += 3;
@@ -527,12 +527,12 @@ void MeshImporter::read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris) //T
 		// The first trifan vertex will be the first vertex in every triangle
 		if (type == COLLADAFW::MeshPrimitive::TRIANGLE_FANS) {
 			unsigned grouped_vertex_count = mp->getGroupedVertexElementsCount();
-			for (unsigned int group_index = 0; group_index < grouped_vertex_count; group_index++){
+			for (unsigned int group_index = 0; group_index < grouped_vertex_count; group_index++) {
 				unsigned int first_vertex = indices[0]; // Store first trifan vertex
 				unsigned int first_normal = nind[0]; // Store first trifan vertex normal
 				unsigned int vertex_count = mp->getGroupedVerticesVertexCount(group_index);
 
-				for (unsigned int vertex_index = 0; vertex_index < vertex_count - 2; vertex_index++){
+				for (unsigned int vertex_index = 0; vertex_index < vertex_count - 2; vertex_index++) {
 					// For each triangle store indeces of its 3 vertices
 					unsigned int triangle_vertex_indices[3]={first_vertex, indices[1], indices[2]};
 					set_face_indices(mface, triangle_vertex_indices, false);
@@ -742,10 +742,13 @@ MTex *MeshImporter::assign_textures_to_uvlayer(COLLADAFW::TextureCoordinateBindi
 	size_t setindex = ctexture.getSetIndex();
 	std::string uvname = ctexture.getSemantic();
 	
-	if(setindex==-1) return NULL;
+	if (setindex==-1) return NULL;
 	
 	const CustomData *data = &me->fdata;
 	int layer_index = CustomData_get_layer_index(data, CD_MTFACE);
+
+	if (layer_index == -1) return NULL;
+
 	CustomDataLayer *cdl = &data->layers[layer_index+setindex];
 	
 	/* set uvname to bind_vertex_input semantic */
@@ -795,7 +798,7 @@ MTFace *MeshImporter::assign_material_to_geom(COLLADAFW::MaterialBinding cmateri
 	std::multimap<COLLADAFW::UniqueId, COLLADAFW::UniqueId>::iterator it;
 	it=materials_mapped_to_geom.find(*geom_uid);
 	while(it!=materials_mapped_to_geom.end()) {
-		if(it->second == ma_uid && it->first == *geom_uid) return NULL; // do nothing if already found
+		if (it->second == ma_uid && it->first == *geom_uid) return NULL; // do nothing if already found
 		it++;
 	}
 	// first time we get geom_uid, ma_uid pair. Save for later check.
@@ -910,11 +913,12 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta
 	// loop through geom's materials
 	for (unsigned int i = 0; i < mat_array.getCount(); i++)	{
 		
-		if(mat_array[i].getReferencedMaterial().isValid()) {
+		if (mat_array[i].getReferencedMaterial().isValid()) {
 			texture_face = assign_material_to_geom(mat_array[i], uid_material_map, ob, geom_uid,
 												   &color_texture, layername, texture_face,
 												   material_texture_mapping_map, i);
-		} else {
+		}
+		else {
 			fprintf(stderr, "invalid referenced material for %s\n", mat_array[i].getName().c_str());
 		}
 	}
@@ -958,8 +962,9 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry* geom)
 	read_faces(mesh, me, new_tris);
 
 	make_edges(me, 0);
-	
-	mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
 
+	mesh_calc_normals_mapping(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL);
+
+	BKE_mesh_convert_mfaces_to_mpolys(me);
 	return true;
 }
diff --git a/source/blender/collada/MeshImporter.h b/source/blender/collada/MeshImporter.h
index 3bccc4e..0c2e600 100644
--- a/source/blender/collada/MeshImporter.h
+++ b/source/blender/collada/MeshImporter.h
@@ -24,8 +24,8 @@
  *  \ingroup collada
  */
 
-#ifndef __BC__MESHIMPORTER_H__
-#define __BC__MESHIMPORTER_H__
+#ifndef __MESHIMPORTER_H__
+#define __MESHIMPORTER_H__
 
 #include <map>
 #include <vector>
diff --git a/source/blender/collada/SceneExporter.cpp b/source/blender/collada/SceneExporter.cpp
index 5dd452f..9010fd5 100644
--- a/source/blender/collada/SceneExporter.cpp
+++ b/source/blender/collada/SceneExporter.cpp
@@ -47,7 +47,7 @@ void SceneExporter::exportHierarchy(Scene *sce)
 		Object *ob = base->object;
 
 		if (!ob->parent) {
-			if(sce->lay & ob->lay) {
+			if (sce->lay & ob->lay) {
 				switch(ob->type) {
 					case OB_MESH:
 					case OB_CAMERA:
@@ -77,6 +77,29 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
 	node.start();
 
 	bool is_skinned_mesh = arm_exporter->is_skinned_mesh(ob);
+	std::list<Object*> child_objects;
+
+	// list child objects
+	Base *b = (Base*) sce->base.first;
+	while(b) {
+		// cob - child object
+		Object *cob = b->object;
+
+		if (cob->parent == ob) {
+			switch(cob->type) {
+				case OB_MESH:
+				case OB_CAMERA:
+				case OB_LAMP:
+				case OB_EMPTY:
+				case OB_ARMATURE:
+					child_objects.push_back(cob);
+					break;
+			}
+		}
+
+		b = b->next;
+	}
+
 
 	if (ob->type == OB_MESH && is_skinned_mesh)
 		// for skinned mesh we write obmat in <bind_shape_matrix>
@@ -101,7 +124,7 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
 
 	// <instance_controller>
 	else if (ob->type == OB_ARMATURE) {
-		arm_exporter->add_armature_bones(ob, sce);
+		arm_exporter->add_armature_bones(ob, sce, this, child_objects);
 
 		// XXX this looks unstable...
 		node.end();
@@ -121,38 +144,22 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
 
 	// empty object
 	else if (ob->type == OB_EMPTY) { // TODO: handle groups (OB_DUPLIGROUP
-		if((ob->transflag & OB_DUPLIGROUP) == OB_DUPLIGROUP && ob->dup_group) {
+		if ((ob->transflag & OB_DUPLIGROUP) == OB_DUPLIGROUP && ob->dup_group) {
 			GroupObject *go = NULL;
 			Group *gr = ob->dup_group;
 			/* printf("group detected '%s'\n", gr->id.name+2); */
-			for(go = (GroupObject*)(gr->gobject.first); go; go=go->next) {
+			for (go = (GroupObject*)(gr->gobject.first); go; go=go->next) {
 				printf("\t%s\n", go->ob->id.name);
 			}
 		}
 	}
 
-	// write nodes for child objects
-	Base *b = (Base*) sce->base.first;
-	while(b) {
-		// cob - child object
-		Object *cob = b->object;
-
-		if (cob->parent == ob) {
-			switch(cob->type) {
-				case OB_MESH:
-				case OB_CAMERA:
-				case OB_LAMP:
-				case OB_EMPTY:
-				case OB_ARMATURE:
-					// write node...
-					writeNodes(cob, sce);
-					break;
-			}
-		}
-
-		b = b->next;
+	for (std::list<Object*>::iterator i= child_objects.begin(); i != child_objects.end(); ++i)
+	{
+		writeNodes(*i, sce);
 	}
 
+
 	if (ob->type != OB_ARMATURE)
 		node.end();
 }
diff --git a/source/blender/collada/SceneExporter.h b/source/blender/collada/SceneExporter.h
index de01eb6..31b471a 100644
--- a/source/blender/collada/SceneExporter.h
+++ b/source/blender/collada/SceneExporter.h
@@ -97,6 +97,8 @@ public:
 	void exportScene(Scene *sce);
 
 private:
+	// required for writeNodes() for bone-parented objects
+	friend class ArmatureExporter;
 	void exportHierarchy(Scene *sce);
 	void writeNodes(Object *ob, Scene *sce);
 	
diff --git a/source/blender/collada/SkinInfo.h b/source/blender/collada/SkinInfo.h
index 71b7c71..7befe71 100644
--- a/source/blender/collada/SkinInfo.h
+++ b/source/blender/collada/SkinInfo.h
@@ -24,8 +24,8 @@
  *  \ingroup collada
  */
 
-#ifndef __BC_SKININFO_H__
-#define __BC_SKININFO_H__
+#ifndef __SKININFO_H__
+#define __SKININFO_H__
 
 #include <map>
 #include <vector>
diff --git a/source/blender/collada/TransformReader.h b/source/blender/collada/TransformReader.h
index e1409a9..a08f443 100644
--- a/source/blender/collada/TransformReader.h
+++ b/source/blender/collada/TransformReader.h
@@ -24,8 +24,8 @@
  *  \ingroup collada
  */
 
-#ifndef __BC_TRANSFORMREADER_H__
-#define __BC_TRANSFORMREADER_H__
+#ifndef __TRANSFORMREADER_H__
+#define __TRANSFORMREADER_H__
 
 #include "COLLADAFWNode.h"
 #include "COLLADAFWTransformation.h"
diff --git a/source/blender/collada/TransformWriter.cpp b/source/blender/collada/TransformWriter.cpp
index c806cd4..f441833 100644
--- a/source/blender/collada/TransformWriter.cpp
+++ b/source/blender/collada/TransformWriter.cpp
@@ -95,20 +95,24 @@ void TransformWriter::add_node_transform_ob(COLLADASW::Node& node, Object *ob)
 	*/
 
 	/* Using parentinv should allow use of existing curves */
-	// If parentinv is identity don't add it.
-	bool add_parinv = false;
-	for(int i = 0; i < 16; ++i)
+	if (ob->parent)
 	{
-		float f = (i%4 == i/4) ? 1.0f : 0.0f ;
-		if(ob->parentinv[i%4][i/4] != f) add_parinv = true;
-	}
-
-	if(add_parinv && ob->parent)
-	{
-		double dmat[4][4];
-		UnitConverter converter;
-		converter.mat4_to_dae_double(dmat, ob->parentinv);
-		node.addMatrix("parentinverse", dmat);
+		// If parentinv is identity don't add it.
+		bool add_parinv = false;
+
+		for (int i = 0; i < 16; ++i)
+		{
+			float f = (i % 4 == i / 4) ? 1.0f : 0.0f;
+			add_parinv |= (ob->parentinv[i % 4][i / 4] != f);
+		}
+
+		if (add_parinv)
+		{
+			double dmat[4][4];
+			UnitConverter converter;
+			converter.mat4_to_dae_double(dmat, ob->parentinv);
+			node.addMatrix("parentinverse", dmat);
+		}
 	}
 
 	add_transform(node, ob->loc, ob->rot, ob->size);
diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp
index 39114f6..70bf055 100644
--- a/source/blender/collada/collada.cpp
+++ b/source/blender/collada/collada.cpp
@@ -44,7 +44,7 @@ extern "C"
 	int collada_import(bContext *C, const char *filepath)
 	{
 		DocumentImporter imp (C, filepath);
-		if(imp.import()) return 1;
+		if (imp.import()) return 1;
 
 		return 0;
 	}
@@ -58,9 +58,9 @@ extern "C"
 		export_settings.filepath = (char *)filepath;
 
 		/* annoying, collada crashes if file cant be created! [#27162] */
-		if(!BLI_exists(filepath)) {
+		if (!BLI_exists(filepath)) {
 			BLI_make_existing_file(filepath); /* makes the dir if its not there */
-			if(BLI_file_touch(filepath) == 0) {
+			if (BLI_file_touch(filepath) == 0) {
 				return 0;
 			}
 		}
diff --git a/source/blender/collada/collada.h b/source/blender/collada/collada.h
index 1619773..f8afc79 100644
--- a/source/blender/collada/collada.h
+++ b/source/blender/collada/collada.h
@@ -24,8 +24,8 @@
  *  \ingroup collada
  */
 
-#ifndef BLENDER_COLLADA_H
-#define BLENDER_COLLADA_H
+#ifndef __COLLADA_H__
+#define __COLLADA_H__
 
 struct bContext;
 struct Scene;
diff --git a/source/blender/collada/collada_internal.cpp b/source/blender/collada/collada_internal.cpp
index 5d0e8d9..fc4093b 100644
--- a/source/blender/collada/collada_internal.cpp
+++ b/source/blender/collada/collada_internal.cpp
@@ -111,14 +111,14 @@ void TransformBase::decompose(float mat[][4], float *loc, float eul[3], float qu
 }
 
 /**
-Translation map.
-Used to translate every COLLADA id to a valid id, no matter what "wrong" letters may be
-included. Look at the IDREF XSD declaration for more.
-Follows strictly the COLLADA XSD declaration which explicitly allows non-english chars,
-like special chars (e.g. micro sign), umlauts and so on.
-The COLLADA spec also allows additional chars for member access ('.'), these
-must obviously be removed too, otherwise they would be heavily misinterpreted.
-*/
+ * Translation map.
+ * Used to translate every COLLADA id to a valid id, no matter what "wrong" letters may be
+ * included. Look at the IDREF XSD declaration for more.
+ * Follows strictly the COLLADA XSD declaration which explicitly allows non-english chars,
+ * like special chars (e.g. micro sign), umlauts and so on.
+ * The COLLADA spec also allows additional chars for member access ('.'), these
+ * must obviously be removed too, otherwise they would be heavily misinterpreted.
+ */
 const unsigned char translate_start_name_map[256] = {
 95,  95,  95,  95,  95,  95,  95,  95,  95,
 95,  95,  95,  95,  95,  95,  95,  95,
@@ -206,7 +206,7 @@ std::string translate_id(const std::string &id)
 	{
 		id_translated[i] = translate_name_map[(unsigned int)id_translated[i]];
 	}
-	// It's so much workload now, the if() should speed up things.
+	// It's so much workload now, the if () should speed up things.
 	if (id_translated != id)
 	{
 		// Search duplicates
diff --git a/source/blender/collada/collada_internal.h b/source/blender/collada/collada_internal.h
index 5c3aa49..4f555ac 100644
--- a/source/blender/collada/collada_internal.h
+++ b/source/blender/collada/collada_internal.h
@@ -24,8 +24,8 @@
  *  \ingroup collada
  */
 
-#ifndef COLLADA_INTERNAL_H
-#define COLLADA_INTERNAL_H
+#ifndef __COLLADA_INTERNAL_H__
+#define __COLLADA_INTERNAL_H__
 
 #include <string>
 #include <vector>
@@ -98,4 +98,4 @@ extern std::string get_material_id(Material *mat);
 
 extern bool has_object_type(Scene* sce, short obtype);
 
-#endif /* COLLADA_INTERNAL_H */
+#endif /* __COLLADA_INTERNAL_H__ */
diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp
index c3aa735..4aed29d 100644
--- a/source/blender/collada/collada_utils.cpp
+++ b/source/blender/collada/collada_utils.cpp
@@ -61,8 +61,8 @@ int bc_test_parent_loop(Object *par, Object *ob)
 {
 	/* test if 'ob' is a parent somewhere in par's parents */
 	
-	if(par == NULL) return 0;
-	if(ob == par) return 1;
+	if (par == NULL) return 0;
+	if (ob == par) return 1;
 	
 	return bc_test_parent_loop(par->parent, ob);
 }
diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h
index b95e3bd..b0c2415 100644
--- a/source/blender/collada/collada_utils.h
+++ b/source/blender/collada/collada_utils.h
@@ -24,8 +24,8 @@
  *  \ingroup collada
  */
 
-#ifndef __BC_UTILS_H__
-#define __BC_UTILS_H__
+#ifndef __COLLADA_UTILS_H__
+#define __COLLADA_UTILS_H__
 
 #include "COLLADAFWMeshPrimitive.h"
 #include "COLLADAFWGeometry.h"
diff --git a/source/blender/editors/animation/CMakeLists.txt b/source/blender/editors/animation/CMakeLists.txt
index 0386af9..9e1e44e 100644
--- a/source/blender/editors/animation/CMakeLists.txt
+++ b/source/blender/editors/animation/CMakeLists.txt
@@ -20,6 +20,7 @@
 
 set(INC
 	../include
+	../../blenfont
 	../../blenkernel
 	../../blenlib
 	../../blenloader
@@ -53,4 +54,8 @@ set(SRC
 	anim_intern.h
 )
 
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
 blender_add_lib(bf_editor_animation "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/animation/SConscript b/source/blender/editors/animation/SConscript
index 96b05b8..658ad27 100644
--- a/source/blender/editors/animation/SConscript
+++ b/source/blender/editors/animation/SConscript
@@ -3,7 +3,12 @@ Import ('env')
 
 sources = env.Glob('*.c')
 
-incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../makesrna ../../imbuf'
-incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include ../../blenloader'
+incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../makesrna ../../imbuf ../../blenfont'
+incs += ' ../../bmesh ../../windowmanager #/intern/guardedalloc #/extern/glew/include ../../blenloader'
 
-env.BlenderLib ( 'bf_editors_animation', sources, Split(incs), [], libtype=['core'], priority=[125] )
+defs = []
+
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
+
+env.BlenderLib ( 'bf_editors_animation', sources, Split(incs), defs, libtype=['core'], priority=[125] )
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index a0082b3..01ab361 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -87,12 +87,9 @@
 #define ANIM_CHAN_NAME_SIZE 256
 
 /* macros used for type defines */
-	/* get the pointer used for some flag */
-#define GET_ACF_FLAG_PTR(ptr) \
-	{ \
-		*type= sizeof((ptr)); \
-		return &(ptr); \
-	} 
+
+/* get the pointer used for some flag and return */
+#define GET_ACF_FLAG_PTR(ptr, type) ((*(type) = sizeof((ptr))), &(ptr))
 
 
 /* *********************************************** */
@@ -453,7 +450,7 @@ static void *acf_summary_setting_ptr(bAnimListElem *ale, int setting, short *typ
 		bDopeSheet *ads= &saction->ads;
 		
 		/* return pointer to DopeSheet's flag */
-		GET_ACF_FLAG_PTR(ads->flag);
+		return GET_ACF_FLAG_PTR(ads->flag, type);
 	}
 	else {
 		/* can't return anything useful - unsupported */
@@ -547,15 +544,15 @@ static void *acf_scene_setting_ptr(bAnimListElem *ale, int setting, short *type)
 	
 	switch (setting) {
 		case ACHANNEL_SETTING_SELECT: /* selected */
-			GET_ACF_FLAG_PTR(scene->flag);
+			return GET_ACF_FLAG_PTR(scene->flag, type);
 			
 		case ACHANNEL_SETTING_EXPAND: /* expanded */
-			GET_ACF_FLAG_PTR(scene->flag);
+			return GET_ACF_FLAG_PTR(scene->flag, type);
 			
 		case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
 		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (scene->adt)
-				GET_ACF_FLAG_PTR(scene->adt->flag)
+				return GET_ACF_FLAG_PTR(scene->adt->flag, type);
 			else
 				return NULL;
 			
@@ -694,15 +691,15 @@ static void *acf_object_setting_ptr(bAnimListElem *ale, int setting, short *type
 	
 	switch (setting) {
 		case ACHANNEL_SETTING_SELECT: /* selected */
-			GET_ACF_FLAG_PTR(ob->flag);
+			return GET_ACF_FLAG_PTR(ob->flag, type);
 			
 		case ACHANNEL_SETTING_EXPAND: /* expanded */
-			GET_ACF_FLAG_PTR(ob->nlaflag); // xxx
+			return GET_ACF_FLAG_PTR(ob->nlaflag, type); // xxx
 			
 		case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
 		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (ob->adt)
-				GET_ACF_FLAG_PTR(ob->adt->flag)
+				return GET_ACF_FLAG_PTR(ob->adt->flag, type);
 			else
 				return NULL;
 			
@@ -817,7 +814,7 @@ static int acf_group_setting_flag(bAnimContext *ac, int setting, short *neg)
 			return AGRP_MUTED;
 			
 		case ACHANNEL_SETTING_PROTECT: /* protected */
-			//*neg= 1; - if we change this to edtiability
+			// *neg= 1; - if we change this to edtiability
 			return AGRP_PROTECTED;
 			
 		case ACHANNEL_SETTING_VISIBLE: /* visiblity - graph editor */
@@ -835,7 +832,7 @@ static void *acf_group_setting_ptr(bAnimListElem *ale, int UNUSED(setting), shor
 	bActionGroup *agrp= (bActionGroup *)ale->data;
 	
 	/* all flags are just in agrp->flag for now... */
-	GET_ACF_FLAG_PTR(agrp->flag);
+	return GET_ACF_FLAG_PTR(agrp->flag, type);
 }
 
 /* group type define */
@@ -905,7 +902,7 @@ static int acf_fcurve_setting_flag(bAnimContext *UNUSED(ac), int setting, short
 			return FCURVE_MUTED;
 			
 		case ACHANNEL_SETTING_PROTECT: /* protected */
-			//*neg= 1; - if we change this to edtiability
+			// *neg= 1; - if we change this to edtiability
 			return FCURVE_PROTECTED;
 			
 		case ACHANNEL_SETTING_VISIBLE: /* visiblity - graph editor */
@@ -922,7 +919,7 @@ static void *acf_fcurve_setting_ptr(bAnimListElem *ale, int UNUSED(setting), sho
 	FCurve *fcu= (FCurve *)ale->data;
 	
 	/* all flags are just in agrp->flag for now... */
-	GET_ACF_FLAG_PTR(fcu->flag);
+	return GET_ACF_FLAG_PTR(fcu->flag, type);
 }
 
 /* fcurve type define */
@@ -997,13 +994,13 @@ static void *acf_fillactd_setting_ptr(bAnimListElem *ale, int setting, short *ty
 	switch (setting) {
 		case ACHANNEL_SETTING_SELECT: /* selected */
 			if (adt) {
-				GET_ACF_FLAG_PTR(adt->flag);
+				return GET_ACF_FLAG_PTR(adt->flag, type);
 			}
 			else
 				return NULL;
 			
 		case ACHANNEL_SETTING_EXPAND: /* expanded */
-			GET_ACF_FLAG_PTR(act->flag);
+			return GET_ACF_FLAG_PTR(act->flag, type);
 		
 		default: /* unsupported */
 			return NULL;
@@ -1082,7 +1079,7 @@ static void *acf_filldrivers_setting_ptr(bAnimListElem *ale, int setting, short
 	
 	switch (setting) {
 		case ACHANNEL_SETTING_EXPAND: /* expanded */
-			GET_ACF_FLAG_PTR(adt->flag);
+			return GET_ACF_FLAG_PTR(adt->flag, type);
 		
 		default: /* unsupported */
 			return NULL;
@@ -1152,13 +1149,13 @@ static void *acf_dsmat_setting_ptr(bAnimListElem *ale, int setting, short *type)
 	
 	switch (setting) {
 		case ACHANNEL_SETTING_EXPAND: /* expanded */
-			GET_ACF_FLAG_PTR(ma->flag);
+			return GET_ACF_FLAG_PTR(ma->flag, type);
 			
 		case ACHANNEL_SETTING_SELECT: /* selected */
 		case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
 		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (ma->adt)
-				GET_ACF_FLAG_PTR(ma->adt->flag)
+				return GET_ACF_FLAG_PTR(ma->adt->flag, type);
 			else
 				return NULL;	
 		
@@ -1229,13 +1226,13 @@ static void *acf_dslam_setting_ptr(bAnimListElem *ale, int setting, short *type)
 	
 	switch (setting) {
 		case ACHANNEL_SETTING_EXPAND: /* expanded */
-			GET_ACF_FLAG_PTR(la->flag);
+			return GET_ACF_FLAG_PTR(la->flag, type);
 			
 		case ACHANNEL_SETTING_SELECT: /* selected */
 		case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
 		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (la->adt)
-				GET_ACF_FLAG_PTR(la->adt->flag)
+				return GET_ACF_FLAG_PTR(la->adt->flag, type);
 			else
 				return NULL;	
 		
@@ -1313,13 +1310,13 @@ static void *acf_dstex_setting_ptr(bAnimListElem *ale, int setting, short *type)
 	
 	switch (setting) {
 		case ACHANNEL_SETTING_EXPAND: /* expanded */
-			GET_ACF_FLAG_PTR(tex->flag);
+			return GET_ACF_FLAG_PTR(tex->flag, type);
 			
 		case ACHANNEL_SETTING_SELECT: /* selected */
 		case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
 		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (tex->adt)
-				GET_ACF_FLAG_PTR(tex->adt->flag)
+				return GET_ACF_FLAG_PTR(tex->adt->flag, type);
 			else
 				return NULL;	
 		
@@ -1390,13 +1387,13 @@ static void *acf_dscam_setting_ptr(bAnimListElem *ale, int setting, short *type)
 	
 	switch (setting) {
 		case ACHANNEL_SETTING_EXPAND: /* expanded */
-			GET_ACF_FLAG_PTR(ca->flag);
+			return GET_ACF_FLAG_PTR(ca->flag, type);
 			
 		case ACHANNEL_SETTING_SELECT: /* selected */
 		case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
 		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (ca->adt)
-				GET_ACF_FLAG_PTR(ca->adt->flag)
+				return GET_ACF_FLAG_PTR(ca->adt->flag, type);
 			else
 				return NULL;
 		
@@ -1477,13 +1474,13 @@ static void *acf_dscur_setting_ptr(bAnimListElem *ale, int setting, short *type)
 	
 	switch (setting) {
 		case ACHANNEL_SETTING_EXPAND: /* expanded */
-			GET_ACF_FLAG_PTR(cu->flag);
+			return GET_ACF_FLAG_PTR(cu->flag, type);
 			
 		case ACHANNEL_SETTING_SELECT: /* selected */
 		case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
 		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (cu->adt)
-				GET_ACF_FLAG_PTR(cu->adt->flag)
+				return GET_ACF_FLAG_PTR(cu->adt->flag, type);
 			else
 				return NULL;
 		
@@ -1554,13 +1551,13 @@ static void *acf_dsskey_setting_ptr(bAnimListElem *ale, int setting, short *type
 	
 	switch (setting) {
 		case ACHANNEL_SETTING_EXPAND: /* expanded */
-			GET_ACF_FLAG_PTR(key->flag);
+			return GET_ACF_FLAG_PTR(key->flag, type);
 			
 		case ACHANNEL_SETTING_SELECT: /* selected */
 		case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
 		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (key->adt)
-				GET_ACF_FLAG_PTR(key->adt->flag)
+				return GET_ACF_FLAG_PTR(key->adt->flag, type);
 			else
 				return NULL;
 		
@@ -1631,13 +1628,13 @@ static void *acf_dswor_setting_ptr(bAnimListElem *ale, int setting, short *type)
 	
 	switch (setting) {
 		case ACHANNEL_SETTING_EXPAND: /* expanded */
-			GET_ACF_FLAG_PTR(wo->flag);
+			return GET_ACF_FLAG_PTR(wo->flag, type);
 			
 		case ACHANNEL_SETTING_SELECT: /* selected */
 		case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
 		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (wo->adt)
-				GET_ACF_FLAG_PTR(wo->adt->flag)
+				return GET_ACF_FLAG_PTR(wo->adt->flag, type);
 			else
 				return NULL;
 		
@@ -1708,13 +1705,13 @@ static void *acf_dspart_setting_ptr(bAnimListElem *ale, int setting, short *type
 	
 	switch (setting) {
 		case ACHANNEL_SETTING_EXPAND: /* expanded */
-			GET_ACF_FLAG_PTR(part->flag);
+			return GET_ACF_FLAG_PTR(part->flag, type);
 			
 		case ACHANNEL_SETTING_SELECT: /* selected */
 		case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
 		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (part->adt)
-				GET_ACF_FLAG_PTR(part->adt->flag)
+				return GET_ACF_FLAG_PTR(part->adt->flag, type);
 			else
 				return NULL;
 		
@@ -1785,13 +1782,13 @@ static void *acf_dsmball_setting_ptr(bAnimListElem *ale, int setting, short *typ
 	
 	switch (setting) {
 		case ACHANNEL_SETTING_EXPAND: /* expanded */
-			GET_ACF_FLAG_PTR(mb->flag);
+			return GET_ACF_FLAG_PTR(mb->flag, type);
 			
 		case ACHANNEL_SETTING_SELECT: /* selected */
 		case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
 		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (mb->adt)
-				GET_ACF_FLAG_PTR(mb->adt->flag)
+				return GET_ACF_FLAG_PTR(mb->adt->flag, type);
 			else
 				return NULL;
 		
@@ -1862,13 +1859,13 @@ static void *acf_dsarm_setting_ptr(bAnimListElem *ale, int setting, short *type)
 	
 	switch (setting) {
 		case ACHANNEL_SETTING_EXPAND: /* expanded */
-			GET_ACF_FLAG_PTR(arm->flag);
+			return GET_ACF_FLAG_PTR(arm->flag, type);
 			
 		case ACHANNEL_SETTING_SELECT: /* selected */
 		case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
 		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (arm->adt)
-				GET_ACF_FLAG_PTR(arm->adt->flag)
+				return GET_ACF_FLAG_PTR(arm->adt->flag, type);
 			else
 				return NULL;
 		
@@ -1950,13 +1947,13 @@ static void *acf_dsntree_setting_ptr(bAnimListElem *ale, int setting, short *typ
 	
 	switch (setting) {
 		case ACHANNEL_SETTING_EXPAND: /* expanded */
-			GET_ACF_FLAG_PTR(ntree->flag);
+			return GET_ACF_FLAG_PTR(ntree->flag, type);
 			
 		case ACHANNEL_SETTING_SELECT: /* selected */
 		case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
 		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (ntree->adt)
-				GET_ACF_FLAG_PTR(ntree->adt->flag)
+				return GET_ACF_FLAG_PTR(ntree->adt->flag, type);
 				else
 					return NULL;
 			
@@ -2027,13 +2024,13 @@ static void *acf_dsmesh_setting_ptr(bAnimListElem *ale, int setting, short *type
 	
 	switch (setting) {
 		case ACHANNEL_SETTING_EXPAND: /* expanded */
-			GET_ACF_FLAG_PTR(me->flag);
+			return GET_ACF_FLAG_PTR(me->flag, type);
 			
 		case ACHANNEL_SETTING_SELECT: /* selected */
 		case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
 		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (me->adt)
-				GET_ACF_FLAG_PTR(me->adt->flag)
+				return GET_ACF_FLAG_PTR(me->adt->flag, type);
 				else
 					return NULL;
 			
@@ -2104,13 +2101,13 @@ static void *acf_dslat_setting_ptr(bAnimListElem *ale, int setting, short *type)
 	
 	switch (setting) {
 		case ACHANNEL_SETTING_EXPAND: /* expanded */
-			GET_ACF_FLAG_PTR(lt->flag);
+			return GET_ACF_FLAG_PTR(lt->flag, type);
 			
 		case ACHANNEL_SETTING_SELECT: /* selected */
 		case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
 		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (lt->adt)
-				GET_ACF_FLAG_PTR(lt->adt->flag)
+				return GET_ACF_FLAG_PTR(lt->adt->flag, type);
 				else
 					return NULL;
 			
@@ -2181,13 +2178,13 @@ static void *acf_dsspk_setting_ptr(bAnimListElem *ale, int setting, short *type)
 
 	switch (setting) {
 		case ACHANNEL_SETTING_EXPAND: /* expanded */
-			GET_ACF_FLAG_PTR(spk->flag);
+			return GET_ACF_FLAG_PTR(spk->flag, type);
 		
 		case ACHANNEL_SETTING_SELECT: /* selected */
 		case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
 		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
 			if (spk->adt)
-				GET_ACF_FLAG_PTR(spk->adt->flag)
+				return GET_ACF_FLAG_PTR(spk->adt->flag, type);
 			else
 				return NULL;
 		
@@ -2296,7 +2293,7 @@ static void *acf_shapekey_setting_ptr(bAnimListElem *ale, int setting, short *ty
 		case ACHANNEL_SETTING_SELECT: /* selected */
 		case ACHANNEL_SETTING_MUTE: /* muted */
 		case ACHANNEL_SETTING_PROTECT: /* protected */
-			GET_ACF_FLAG_PTR(kb->flag)
+			return GET_ACF_FLAG_PTR(kb->flag, type);
 		
 		default: /* unsupported */
 			return NULL;
@@ -2375,7 +2372,7 @@ static void *acf_gpd_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short
 	bGPdata *gpd= (bGPdata *)ale->data;
 	
 	/* all flags are just in gpd->flag for now... */
-	GET_ACF_FLAG_PTR(gpd->flag);
+	return GET_ACF_FLAG_PTR(gpd->flag, type);
 }
 
 /* gpencil datablock type define */
@@ -2399,7 +2396,7 @@ static bAnimChannelType ACF_GPD =
 
 /* GPencil Layer ------------------------------------------- */
 
-/* name for grase pencil layer entries */
+/* name for grease pencil layer entries */
 static void acf_gpl_name(bAnimListElem *ale, char *name)
 {
 	bGPDlayer *gpl = (bGPDlayer *)ale->data;
@@ -2450,7 +2447,7 @@ static int acf_gpl_setting_flag(bAnimContext *UNUSED(ac), int setting, short *ne
 			return GP_LAYER_HIDE;
 			
 		case ACHANNEL_SETTING_PROTECT: /* protected */
-			//*neg= 1; - if we change this to edtiability
+			// *neg= 1; - if we change this to edtiability
 			return GP_LAYER_LOCKED;
 			
 		default: /* unsupported */
@@ -2464,7 +2461,7 @@ static void *acf_gpl_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short
 	bGPDlayer *gpl= (bGPDlayer *)ale->data;
 	
 	/* all flags are just in agrp->flag for now... */
-	GET_ACF_FLAG_PTR(gpl->flag);
+	return GET_ACF_FLAG_PTR(gpl->flag, type);
 }
 
 /* grease pencil layer type define */
@@ -2493,12 +2490,12 @@ static bAnimChannelType ACF_GPL =
 static bAnimChannelType *animchannelTypeInfo[ANIMTYPE_NUM_TYPES];
 static short ACF_INIT= 1; /* when non-zero, the list needs to be updated */
 
-/* Initialise type info definitions */
+/* Initialize type info definitions */
 static void ANIM_init_channel_typeinfo_data (void)
 {
 	int type= 0;
 	
-	/* start initialising if necessary... */
+	/* start initializing if necessary... */
 	if (ACF_INIT) {
 		ACF_INIT= 0;
 		
@@ -2600,8 +2597,7 @@ short ANIM_channel_setting_get (bAnimContext *ac, bAnimListElem *ale, int settin
 	bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
 	
 	/* 1) check that the setting exists for the current context */
-	if ( (acf) && (!acf->has_setting || acf->has_setting(ac, ale, setting)) ) 
-	{
+	if ((acf) && (!acf->has_setting || acf->has_setting(ac, ale, setting))) {
 		/* 2) get pointer to check for flag in, and the flag to check for */
 		short negflag, ptrsize;
 		int flag;
@@ -2678,8 +2674,7 @@ void ANIM_channel_setting_set (bAnimContext *ac, bAnimListElem *ale, int setting
 	bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale);
 	
 	/* 1) check that the setting exists for the current context */
-	if ( (acf) && (!acf->has_setting || acf->has_setting(ac, ale, setting)) ) 
-	{
+	if ((acf) && (!acf->has_setting || acf->has_setting(ac, ale, setting))) {
 		/* 2) get pointer to check for flag in, and the flag to check for */
 		short negflag, ptrsize;
 		int flag;
@@ -2735,7 +2730,7 @@ void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float
 	float y, ymid, ytext;
 	
 	/* sanity checks - don't draw anything */
-	if ELEM(NULL, acf, ale)
+	if (ELEM(NULL, acf, ale))
 		return;
 	
 	/* get initial offset */
@@ -2831,8 +2826,7 @@ void ANIM_channel_draw (bAnimContext *ac, bAnimListElem *ale, float yminc, float
 		UI_DrawString(offset, ytext, name);
 		
 		/* draw red underline if channel is disabled */
-		if ((ale->type == ANIMTYPE_FCURVE) && (ale->flag & FCURVE_DISABLED)) 
-		{
+		if ((ale->type == ANIMTYPE_FCURVE) && (ale->flag & FCURVE_DISABLED)) {
 			// FIXME: replace hardcoded color here, and check on extents!
 			glColor3f(1.0f, 0.0f, 0.0f);
 			glLineWidth(2.0);
@@ -3121,17 +3115,17 @@ static void draw_setting_widget (bAnimContext *ac, bAnimListElem *ale, bAnimChan
 	if (ptr && flag) {
 		switch (ptrsize) {
 			case sizeof(int):	/* integer pointer for setting */
-				but= uiDefIconButBitI(block, butType, flag, 0, icon, 
+				but = uiDefIconButBitI(block, butType, flag, 0, icon, 
 						xpos, ypos, ICON_WIDTH, ICON_WIDTH, ptr, 0, 0, 0, 0, tooltip);
 				break;
 				
 			case sizeof(short):	/* short pointer for setting */
-				but= uiDefIconButBitS(block, butType, flag, 0, icon, 
+				but = uiDefIconButBitS(block, butType, flag, 0, icon, 
 						xpos, ypos, ICON_WIDTH, ICON_WIDTH, ptr, 0, 0, 0, 0, tooltip);
 				break;
 				
 			case sizeof(char):	/* char pointer for setting */
-				but= uiDefIconButBitC(block, butType, flag, 0, icon, 
+				but = uiDefIconButBitC(block, butType, flag, 0, icon, 
 						xpos, ypos, ICON_WIDTH, ICON_WIDTH, ptr, 0, 0, 0, 0, tooltip);
 				break;
 		}
@@ -3164,7 +3158,7 @@ void ANIM_channel_draw_widgets (bContext *C, bAnimContext *ac, bAnimListElem *al
 	short offset;
 	
 	/* sanity checks - don't draw anything */
-	if ELEM3(NULL, acf, ale, block)
+	if (ELEM3(NULL, acf, ale, block))
 		return;
 	
 	/* get initial offset */
@@ -3282,7 +3276,7 @@ void ANIM_channel_draw_widgets (bContext *C, bAnimContext *ac, bAnimListElem *al
 		 *	- even if we can draw sliders for this view, we must also check that the channel-type supports them
 		 *	  (only only F-Curves really can support them for now)
 		 *	- to make things easier, we use RNA-autobuts for this so that changes are reflected immediately, 
-		 *	  whereever they occurred. BUT, we don't use the layout engine, otherwise we'd get wrong alignment,
+		 *	  wherever they occurred. BUT, we don't use the layout engine, otherwise we'd get wrong alignment,
 		 *	  and wouldn't be able to auto-keyframe...
 		 *	- slider should start before the toggles (if they're visible) to keep a clean line down the side
 		 */
@@ -3326,7 +3320,7 @@ void ANIM_channel_draw_widgets (bContext *C, bAnimContext *ac, bAnimListElem *al
 						uiBut *but;
 						
 						/* create the slider button, and assign relevant callback to ensure keyframes are inserted... */
-						but= uiDefAutoButR(block, &ptr, prop, array_index, "", ICON_NONE, (int)v2d->cur.xmax-offset, ymid, SLIDER_WIDTH, (int)ymaxc-yminc);
+						but = uiDefAutoButR(block, &ptr, prop, array_index, "", ICON_NONE, (int)v2d->cur.xmax-offset, ymid, SLIDER_WIDTH, (int)ymaxc-yminc);
 						
 						/* assign keyframing function according to slider type */
 						if (ale->type == ANIMTYPE_SHAPEKEY)
diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c
index 8ac7406..fb6a65a 100644
--- a/source/blender/editors/animation/anim_channels_edit.c
+++ b/source/blender/editors/animation/anim_channels_edit.c
@@ -367,7 +367,7 @@ void ANIM_deselect_anim_channels (bAnimContext *ac, void *data, short datatype,
  *	- anim_data: list of the all the anim channels that can be chosen
  *		-> filtered using ANIMFILTER_CHANNELS only, since if we took VISIBLE too,
  *		  then the channels under closed expanders get ignored...
- *	- ale_setting: the anim channel (not in the anim_data list directly, though occuring there)
+ *	- ale_setting: the anim channel (not in the anim_data list directly, though occurring there)
  *		with the new state of the setting that we want flushed up/down the hierarchy 
  *	- setting: type of setting to set
  *	- on: whether the visibility setting has been enabled or disabled 
@@ -394,14 +394,14 @@ void ANIM_flush_setting_anim_channels (bAnimContext *ac, ListBase *anim_data, bA
 		}
 	}
 	if (match == NULL) {
-		printf("ERROR: no channel matching the one changed was found \n");
+		printf("ERROR: no channel matching the one changed was found\n");
 		return;
 	}
 	else {
 		bAnimChannelType *acf= ANIM_channel_get_typeinfo(ale_setting);
 		
 		if (acf == NULL) {
-			printf("ERROR: no channel info for the changed channel \n");
+			printf("ERROR: no channel info for the changed channel\n");
 			return;
 		}
 		
@@ -541,8 +541,7 @@ void ANIM_fcurve_delete_from_animdata (bAnimContext *ac, AnimData *adt, FCurve *
 			/* XXX: there's a problem where many actions could build up in the file if multiple
 			 * full add/delete cycles are performed on the same objects, but assume that this is rare
 			 */
-		if ((adt->action->curves.first == NULL) && (adt->flag & ADT_NLA_EDIT_ON)==0)
-		{
+		if ((adt->action->curves.first == NULL) && (adt->flag & ADT_NLA_EDIT_ON)==0) {
 			id_us_min(&adt->action->id);
 			adt->action = NULL;
 		}
@@ -951,7 +950,7 @@ static void split_groups_action_temp (bAction *act, bActionGroup *tgrp)
 		}
 	}
 	
-	/* Initialise memory for temp-group */
+	/* Initialize memory for temp-group */
 	memset(tgrp, 0, sizeof(bActionGroup));
 	tgrp->flag |= (AGRP_EXPANDED|AGRP_TEMP);
 	BLI_strncpy(tgrp->name, "#TempGroup", sizeof(tgrp->name));
@@ -1086,7 +1085,7 @@ static int animchannels_rearrange_exec(bContext *C, wmOperator *op)
 				default: /* some collection of actions */
 					if (adt->action)
 						rearrange_action_channels(&ac, adt->action, mode);
-					else if (G.f & G_DEBUG)
+					else if (G.debug & G_DEBUG)
 						printf("Animdata has no action\n");
 					break;
 			}
@@ -1105,19 +1104,19 @@ static int animchannels_rearrange_exec(bContext *C, wmOperator *op)
 static void ANIM_OT_channels_move (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Move Channels";
-	ot->idname= "ANIM_OT_channels_move";
+	ot->name = "Move Channels";
+	ot->idname = "ANIM_OT_channels_move";
 	ot->description = "Rearrange selected animation channels";
 	
 	/* api callbacks */
-	ot->exec= animchannels_rearrange_exec;
-	ot->poll= animedit_poll_channels_nla_tweakmode_off;
+	ot->exec = animchannels_rearrange_exec;
+	ot->poll = animedit_poll_channels_nla_tweakmode_off;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* props */
-	ot->prop= RNA_def_enum(ot->srna, "direction", prop_animchannel_rearrange_types, REARRANGE_ANIMCHAN_DOWN, "Direction", "");
+	ot->prop = RNA_def_enum(ot->srna, "direction", prop_animchannel_rearrange_types, REARRANGE_ANIMCHAN_DOWN, "Direction", "");
 }
 
 /* ******************** Delete Channel Operator *********************** */
@@ -1221,16 +1220,16 @@ static int animchannels_delete_exec(bContext *C, wmOperator *UNUSED(op))
 static void ANIM_OT_channels_delete (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete Channels";
-	ot->idname= "ANIM_OT_channels_delete";
-	ot->description= "Delete all selected animation channels";
+	ot->name = "Delete Channels";
+	ot->idname = "ANIM_OT_channels_delete";
+	ot->description = "Delete all selected animation channels";
 	
 	/* api callbacks */
-	ot->exec= animchannels_delete_exec;
-	ot->poll= animedit_poll_channels_active;
+	ot->exec = animchannels_delete_exec;
+	ot->poll = animedit_poll_channels_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ******************** Set Channel Visibility Operator *********************** */
@@ -1313,16 +1312,16 @@ static int animchannels_visibility_set_exec(bContext *C, wmOperator *UNUSED(op))
 static void ANIM_OT_channels_visibility_set (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Visibility";
-	ot->idname= "ANIM_OT_channels_visibility_set";
-	ot->description= "Make only the selected animation channels visible in the Graph Editor";
+	ot->name = "Set Visibility";
+	ot->idname = "ANIM_OT_channels_visibility_set";
+	ot->description = "Make only the selected animation channels visible in the Graph Editor";
 	
 	/* api callbacks */
-	ot->exec= animchannels_visibility_set_exec;
-	ot->poll= ED_operator_graphedit_active;
+	ot->exec = animchannels_visibility_set_exec;
+	ot->poll = ED_operator_graphedit_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 
@@ -1390,16 +1389,16 @@ static int animchannels_visibility_toggle_exec(bContext *C, wmOperator *UNUSED(o
 static void ANIM_OT_channels_visibility_toggle (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Toggle Visibility";
-	ot->idname= "ANIM_OT_channels_visibility_toggle";
-	ot->description= "Toggle visibility in Graph Editor of all selected animation channels";
+	ot->name = "Toggle Visibility";
+	ot->idname = "ANIM_OT_channels_visibility_toggle";
+	ot->description = "Toggle visibility in Graph Editor of all selected animation channels";
 	
 	/* api callbacks */
-	ot->exec= animchannels_visibility_toggle_exec;
-	ot->poll= ED_operator_graphedit_active;
+	ot->exec = animchannels_visibility_toggle_exec;
+	ot->poll = ED_operator_graphedit_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ********************** Set Flags Operator *********************** */
@@ -1533,82 +1532,82 @@ static int animchannels_setflag_exec(bContext *C, wmOperator *op)
 static void ANIM_OT_channels_setting_enable (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Enable Channel Setting";
-	ot->idname= "ANIM_OT_channels_setting_enable";
-	ot->description= "Enable specified setting on all selected animation channels";
+	ot->name = "Enable Channel Setting";
+	ot->idname = "ANIM_OT_channels_setting_enable";
+	ot->description = "Enable specified setting on all selected animation channels";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= animchannels_setflag_exec;
-	ot->poll= animedit_poll_channels_active;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = animchannels_setflag_exec;
+	ot->poll = animedit_poll_channels_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* props */
 		/* flag-setting mode */
 	RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_ADD, "Mode", "");
 		/* setting to set */
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", "");
+	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)
 {
 	/* identifiers */
-	ot->name= "Disable Channel Setting";
-	ot->idname= "ANIM_OT_channels_setting_disable";
-	ot->description= "Disable specified setting on all selected animation channels";
+	ot->name = "Disable Channel Setting";
+	ot->idname = "ANIM_OT_channels_setting_disable";
+	ot->description = "Disable specified setting on all selected animation channels";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= animchannels_setflag_exec;
-	ot->poll= animedit_poll_channels_active;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = animchannels_setflag_exec;
+	ot->poll = animedit_poll_channels_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* props */
 		/* flag-setting mode */
 	RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_CLEAR, "Mode", "");
 		/* setting to set */
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", "");
 }
 
 static void ANIM_OT_channels_setting_toggle (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Toggle Channel Setting";
-	ot->idname= "ANIM_OT_channels_setting_toggle";
-	ot->description= "Toggle specified setting on all selected animation channels";
+	ot->name = "Toggle Channel Setting";
+	ot->idname = "ANIM_OT_channels_setting_toggle";
+	ot->description = "Toggle specified setting on all selected animation channels";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= animchannels_setflag_exec;
-	ot->poll= animedit_poll_channels_active;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = animchannels_setflag_exec;
+	ot->poll = animedit_poll_channels_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* props */
 		/* flag-setting mode */
 	RNA_def_enum(ot->srna, "mode", prop_animchannel_setflag_types, ACHANNEL_SETFLAG_TOGGLE, "Mode", "");
 		/* setting to set */
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_animchannel_settings_types, 0, "Type", "");
 }
 
 static void ANIM_OT_channels_editable_toggle (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Toggle Channel Editability";
-	ot->idname= "ANIM_OT_channels_editable_toggle";
-	ot->description= "Toggle editability of selected channels";
+	ot->name = "Toggle Channel Editability";
+	ot->idname = "ANIM_OT_channels_editable_toggle";
+	ot->description = "Toggle editability of selected channels";
 	
 	/* api callbacks */
-	ot->exec= animchannels_setflag_exec;
-	ot->poll= animedit_poll_channels_active;
+	ot->exec = animchannels_setflag_exec;
+	ot->poll = animedit_poll_channels_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* props */
 		/* flag-setting mode */
@@ -1644,19 +1643,19 @@ static int animchannels_expand_exec (bContext *C, wmOperator *op)
 static void ANIM_OT_channels_expand (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Expand Channels";
-	ot->idname= "ANIM_OT_channels_expand";
-	ot->description= "Expand (i.e. open) all selected expandable animation channels";
+	ot->name = "Expand Channels";
+	ot->idname = "ANIM_OT_channels_expand";
+	ot->description = "Expand (i.e. open) all selected expandable animation channels";
 	
 	/* api callbacks */
-	ot->exec= animchannels_expand_exec;
-	ot->poll= animedit_poll_channels_active;
+	ot->exec = animchannels_expand_exec;
+	ot->poll = animedit_poll_channels_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* props */
-	ot->prop= RNA_def_boolean(ot->srna, "all", 1, "All", "Expand all channels (not just selected ones)");
+	ot->prop = RNA_def_boolean(ot->srna, "all", 1, "All", "Expand all channels (not just selected ones)");
 }
 
 /* ********************** Collapse Channels Operator *********************** */
@@ -1686,19 +1685,19 @@ static int animchannels_collapse_exec (bContext *C, wmOperator *op)
 static void ANIM_OT_channels_collapse (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Collapse Channels";
-	ot->idname= "ANIM_OT_channels_collapse";
-	ot->description= "Collapse (i.e. close) all selected expandable animation channels";
+	ot->name = "Collapse Channels";
+	ot->idname = "ANIM_OT_channels_collapse";
+	ot->description = "Collapse (i.e. close) all selected expandable animation channels";
 	
 	/* api callbacks */
-	ot->exec= animchannels_collapse_exec;
-	ot->poll= animedit_poll_channels_active;
+	ot->exec = animchannels_collapse_exec;
+	ot->poll = animedit_poll_channels_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* props */
-	ot->prop= RNA_def_boolean(ot->srna, "all", 1, "All", "Collapse all channels (not just selected ones)");
+	ot->prop = RNA_def_boolean(ot->srna, "all", 1, "All", "Collapse all channels (not just selected ones)");
 }
 
 /* ******************* Reenable Disabled Operator ******************* */
@@ -1762,16 +1761,16 @@ static int animchannels_enable_exec (bContext *C, wmOperator *UNUSED(op))
 static void ANIM_OT_channels_fcurves_enable (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Revive Disabled F-Curves";
-	ot->idname= "ANIM_OT_channels_fcurves_enable";
-	ot->description= "Clears 'disabled' tag from all F-Curves to get broken F-Curves working again";
+	ot->name = "Revive Disabled F-Curves";
+	ot->idname = "ANIM_OT_channels_fcurves_enable";
+	ot->description = "Clears 'disabled' tag from all F-Curves to get broken F-Curves working again";
 	
 	/* api callbacks */
-	ot->exec= animchannels_enable_exec;
-	ot->poll= animchannels_enable_poll;
+	ot->exec = animchannels_enable_exec;
+	ot->poll = animchannels_enable_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ********************** Select All Operator *********************** */
@@ -1784,7 +1783,7 @@ static int animchannels_deselectall_exec (bContext *C, wmOperator *op)
 	if (ANIM_animdata_get_context(C, &ac) == 0)
 		return OPERATOR_CANCELLED;
 		
-	/* 'standard' behaviour - check if selected, then apply relevant selection */
+	/* 'standard' behavior - check if selected, then apply relevant selection */
 	if (RNA_boolean_get(op->ptr, "invert"))
 		ANIM_deselect_anim_channels(&ac, ac.data, ac.datatype, 0, ACHANNEL_SETFLAG_TOGGLE);
 	else
@@ -1799,19 +1798,19 @@ static int animchannels_deselectall_exec (bContext *C, wmOperator *op)
 static void ANIM_OT_channels_select_all_toggle (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select All";
-	ot->idname= "ANIM_OT_channels_select_all_toggle";
-	ot->description= "Toggle selection of all animation channels";
+	ot->name = "Select All";
+	ot->idname = "ANIM_OT_channels_select_all_toggle";
+	ot->description = "Toggle selection of all animation channels";
 	
 	/* api callbacks */
-	ot->exec= animchannels_deselectall_exec;
-	ot->poll= animedit_poll_channels_nla_tweakmode_off;
+	ot->exec = animchannels_deselectall_exec;
+	ot->poll = animedit_poll_channels_nla_tweakmode_off;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* props */
-	ot->prop= RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
+	ot->prop = RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
 }
 
 /* ******************** Borderselect Operator *********************** */
@@ -1902,15 +1901,15 @@ static int animchannels_borderselect_exec(bContext *C, wmOperator *op)
 		return OPERATOR_CANCELLED;
 	
 	/* get settings from operator */
-	rect.xmin= RNA_int_get(op->ptr, "xmin");
-	rect.ymin= RNA_int_get(op->ptr, "ymin");
-	rect.xmax= RNA_int_get(op->ptr, "xmax");
-	rect.ymax= RNA_int_get(op->ptr, "ymax");
+	rect.xmin = RNA_int_get(op->ptr, "xmin");
+	rect.ymin = RNA_int_get(op->ptr, "ymin");
+	rect.xmax = RNA_int_get(op->ptr, "xmax");
+	rect.ymax = RNA_int_get(op->ptr, "ymax");
 	
 	gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
 	extend= RNA_boolean_get(op->ptr, "extend");
 
-	if(!extend)
+	if (!extend)
 		ANIM_deselect_anim_channels(&ac, ac.data, ac.datatype, 1, ACHANNEL_SETFLAG_CLEAR);
 
 	if (gesture_mode == GESTURE_MODAL_SELECT)
@@ -1930,20 +1929,20 @@ static int animchannels_borderselect_exec(bContext *C, wmOperator *op)
 static void ANIM_OT_channels_select_border(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Border Select";
-	ot->idname= "ANIM_OT_channels_select_border";
-	ot->description= "Select all animation channels within the specified region";
+	ot->name = "Border Select";
+	ot->idname = "ANIM_OT_channels_select_border";
+	ot->description = "Select all animation channels within the specified region";
 	
 	/* api callbacks */
-	ot->invoke= WM_border_select_invoke;
-	ot->exec= animchannels_borderselect_exec;
-	ot->modal= WM_border_select_modal;
-	ot->cancel= WM_border_select_cancel;
+	ot->invoke = WM_border_select_invoke;
+	ot->exec = animchannels_borderselect_exec;
+	ot->modal = WM_border_select_modal;
+	ot->cancel = WM_border_select_cancel;
 	
-	ot->poll= animedit_poll_channels_nla_tweakmode_off;
+	ot->poll = animedit_poll_channels_nla_tweakmode_off;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* rna */
 	WM_operator_properties_gesture_border(ot, TRUE);
@@ -1968,8 +1967,8 @@ static void rename_anim_channels (bAnimContext *ac, int channel_index)
 	ale= BLI_findlink(&anim_data, channel_index);
 	if (ale == NULL) {
 		/* channel not found */
-		if (G.f & G_DEBUG)
-			printf("Error: animation channel (index = %d) not found in rename_anim_channels() \n", channel_index);
+		if (G.debug & G_DEBUG)
+			printf("Error: animation channel (index = %d) not found in rename_anim_channels()\n", channel_index);
 		
 		BLI_freelistN(&anim_data);
 		return;
@@ -1985,7 +1984,7 @@ static void rename_anim_channels (bAnimContext *ac, int channel_index)
 		if (acf->name_prop(ale, &ptr, &prop)) {
 			/* actually showing the rename textfield is done on redraw,
 			 * so here we just store the index of this channel in the 
-			 * dopesheet data, which will get utilised when drawing the
+			 * dopesheet data, which will get utilized when drawing the
 			 * channel...
 			 *
 			 * +1 factor is for backwards compat issues
@@ -2041,13 +2040,13 @@ static int animchannels_rename_invoke (bContext *C, wmOperator *UNUSED(op), wmEv
 static void ANIM_OT_channels_rename (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Rename Channels";
-	ot->idname= "ANIM_OT_channels_rename";
-	ot->description= "Rename animation channel under mouse";
+	ot->name = "Rename Channels";
+	ot->idname = "ANIM_OT_channels_rename";
+	ot->description = "Rename animation channel under mouse";
 	
 	/* api callbacks */
-	ot->invoke= animchannels_rename_invoke;
-	ot->poll= animedit_poll_channels_active;
+	ot->invoke = animchannels_rename_invoke;
+	ot->poll = animedit_poll_channels_active;
 }
 
 /* ******************** Mouse-Click Operator *********************** */
@@ -2069,8 +2068,8 @@ static int mouse_anim_channels (bAnimContext *ac, float UNUSED(x), int channel_i
 	ale= BLI_findlink(&anim_data, channel_index);
 	if (ale == NULL) {
 		/* channel not found */
-		if (G.f & G_DEBUG)
-			printf("Error: animation channel (index = %d) not found in mouse_anim_channels() \n", channel_index);
+		if (G.debug & G_DEBUG)
+			printf("Error: animation channel (index = %d) not found in mouse_anim_channels()\n", channel_index);
 		
 		BLI_freelistN(&anim_data);
 		return 0;
@@ -2289,8 +2288,8 @@ static int mouse_anim_channels (bAnimContext *ac, float UNUSED(x), int channel_i
 		}
 			break;
 		default:
-			if (G.f & G_DEBUG)
-				printf("Error: Invalid channel type in mouse_anim_channels() \n");
+			if (G.debug & G_DEBUG)
+				printf("Error: Invalid channel type in mouse_anim_channels()\n");
 	}
 	
 	/* free channels */
@@ -2350,16 +2349,16 @@ static int animchannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *
 static void ANIM_OT_channels_click (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Mouse Click on Channels";
-	ot->idname= "ANIM_OT_channels_click";
-	ot->description= "Handle mouse-clicks over animation channels";
+	ot->name = "Mouse Click on Channels";
+	ot->idname = "ANIM_OT_channels_click";
+	ot->description = "Handle mouse-clicks over animation channels";
 	
 	/* api callbacks */
-	ot->invoke= animchannels_mouseclick_invoke;
-	ot->poll= animedit_poll_channels_active;
+	ot->invoke = animchannels_mouseclick_invoke;
+	ot->poll = animedit_poll_channels_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* id-props */
 	RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", ""); // SHIFTKEY
diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c
index 3f85193..3f0e1b1 100644
--- a/source/blender/editors/animation/anim_deps.c
+++ b/source/blender/editors/animation/anim_deps.c
@@ -81,19 +81,19 @@ void ANIM_list_elem_update(Scene *scene, bAnimListElem *ale)
 		
 	if (fcu && fcu->rna_path) {
 		/* if we have an fcurve, call the update for the property we
-		   are editing, this is then expected to do the proper redraws
-		   and depsgraph updates  */
+		 * are editing, this is then expected to do the proper redraws
+		 * and depsgraph updates  */
 		PointerRNA id_ptr, ptr;
 		PropertyRNA *prop;
 		
 		RNA_id_pointer_create(id, &id_ptr);
 			
-		if(RNA_path_resolve(&id_ptr, fcu->rna_path, &ptr, &prop))
+		if (RNA_path_resolve(&id_ptr, fcu->rna_path, &ptr, &prop))
 			RNA_property_update_main(G.main, scene, &ptr, prop);
 	}
 	else {
 		/* in other case we do standard depsgaph update, ideally
-		   we'd be calling property update functions here too ... */
+		 * we'd be calling property update functions here too ... */
 		DAG_id_tag_update(id, OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME); // XXX or do we want something more restrictive?
 	}
 }
@@ -115,7 +115,7 @@ void ANIM_id_update(Scene *UNUSED(scene), ID *id)
 }
 
 /* **************************** animation data <-> data syncing ******************************** */
-/* This code here is used to synchronise the 
+/* This code here is used to synchronize the
  *	- selection (to find selected data easier)
  *	- ... (insert other relevant items here later) 
  * status in relevant Blender data with the status stored in animation channels.
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index 32e5fe8..bab341a 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -51,9 +51,6 @@
 #include "UI_resources.h"
 #include "UI_view2d.h"
 
-/* XXX */
-extern void ui_rasterpos_safe(float x, float y, float aspect);
-
 /* *************************************************** */
 /* TIME CODE FORMATTING */
 
@@ -189,7 +186,7 @@ static void draw_cfra_number (Scene *scene, View2D *v2d, float cfra, short time)
 	
 	/* get timecode string 
 	 *	- padding on str-buf passed so that it doesn't sit on the frame indicator
-	 *	- power = 0, gives 'standard' behaviour for time
+	 *	- power = 0, gives 'standard' behavior for time
 	 *	  but power = 1 is required for frames (to get integer frames)
 	 */
 	if (time)
@@ -367,18 +364,15 @@ void ANIM_nla_mapping_apply_fcurve (AnimData *adt, FCurve *fcu, short restore, s
 float ANIM_unit_mapping_get_factor (Scene *scene, ID *id, FCurve *fcu, short restore)
 {
 	/* sanity checks */
-	if (id && fcu && fcu->rna_path) 
-	{
+	if (id && fcu && fcu->rna_path) {
 		PointerRNA ptr, id_ptr;
 		PropertyRNA *prop;
 		
 		/* get RNA property that F-Curve affects */
 		RNA_id_pointer_create(id, &id_ptr);
-		if (RNA_path_resolve(&id_ptr, fcu->rna_path, &ptr, &prop)) 
-		{
+		if (RNA_path_resolve(&id_ptr, fcu->rna_path, &ptr, &prop)) {
 			/* rotations: radians <-> degrees? */
-			if (RNA_SUBTYPE_UNIT(RNA_property_subtype(prop)) == PROP_UNIT_ROTATION)
-			{
+			if (RNA_SUBTYPE_UNIT(RNA_property_subtype(prop)) == PROP_UNIT_ROTATION) {
 				/* if the radians flag is not set, default to using degrees which need conversions */
 				if ((scene) && (scene->unit.system_rotation == USER_UNIT_ROT_RADIANS) == 0) {
 					if (restore)
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index b84ec54..e5822c7 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -362,7 +362,10 @@ short ANIM_animdata_get_context (const bContext *C, bAnimContext *ac)
 		else {\
 			filter_mode |= ANIMFILTER_TMP_PEEK; \
 		} \
-		(void) _doSubChannels;
+		  \
+		{ \
+			(void) _doSubChannels; \
+		}
 		/* ... standard sub-channel filtering can go on here now ... */
 #define END_ANIMFILTER_SUBCHANNELS \
 		filter_mode = _filter; \
@@ -954,7 +957,7 @@ static FCurve *animfilter_fcurve_next (bDopeSheet *ads, FCurve *first, bActionGr
 			/* only work with this channel and its subchannels if it is editable */
 			if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_FCU(fcu)) {
 				/* only include this curve if selected in a way consistent with the filtering requirements */
-				if ( ANIMCHANNEL_SELOK(SEL_FCU(fcu)) && ANIMCHANNEL_SELEDITOK(SEL_FCU(fcu)) ) {
+				if (ANIMCHANNEL_SELOK(SEL_FCU(fcu)) && ANIMCHANNEL_SELEDITOK(SEL_FCU(fcu))) {
 					/* only include if this curve is active */
 					if (!(filter_mode & ANIMFILTER_ACTIVE) || (fcu->flag & FCURVE_ACTIVE)) {
 						/* name based filtering... */
@@ -1038,8 +1041,7 @@ static size_t animfilter_act_group (bAnimContext *ac, ListBase *anim_data, bDope
 			 * but to do this, we need to check that the group doesn't have it's not-visible flag set preventing 
 			 * all its sub-curves to be shown
 			 */
-			if ( !(filter_mode & ANIMFILTER_CURVE_VISIBLE) || !(agrp->flag & AGRP_NOTVISIBLE) )
-			{
+			if (!(filter_mode & ANIMFILTER_CURVE_VISIBLE) || !(agrp->flag & AGRP_NOTVISIBLE)) {
 				/* group must be editable for its children to be editable (if we care about this) */
 				if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_AGRP(agrp)) {
 					/* get first F-Curve which can be used here */
@@ -1101,7 +1103,7 @@ static size_t animfilter_action (bAnimContext *ac, ListBase *anim_data, bDopeShe
 	}
 	
 	/* un-grouped F-Curves (only if we're not only considering those channels in the active group) */
-	if (!(filter_mode & ANIMFILTER_ACTGROUPED))  {
+	if (!(filter_mode & ANIMFILTER_ACTGROUPED)) {
 		FCurve *firstfcu = (lastchan)? (lastchan->next) : (act->curves.first);
 		items += animfilter_fcurves(anim_data, ads, firstfcu, NULL, filter_mode, owner_id);
 	}
@@ -1169,7 +1171,7 @@ static size_t animfilter_nla (bAnimContext *UNUSED(ac), ListBase *anim_data, bDo
 		/* only work with this channel and its subchannels if it is editable */
 		if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_NLT(nlt)) {
 			/* only include this track if selected in a way consistent with the filtering requirements */
-			if ( ANIMCHANNEL_SELOK(SEL_NLT(nlt)) ) {
+			if (ANIMCHANNEL_SELOK(SEL_NLT(nlt))) {
 				/* only include if this track is active */
 				if (!(filter_mode & ANIMFILTER_ACTIVE) || (nlt->flag & NLATRACK_ACTIVE)) {
 					ANIMCHANNEL_NEW_CHANNEL(nlt, ANIMTYPE_NLATRACK, owner_id);
@@ -1189,7 +1191,7 @@ static size_t animfilter_block_data (bAnimContext *ac, ListBase *anim_data, bDop
 	size_t items = 0;
 
 	/* image object datablocks have no anim-data so check for NULL */
-	if(adt) {
+	if (adt) {
 		IdAdtTemplate *iat = (IdAdtTemplate*)id;
 
 		/* NOTE: this macro is used instead of inlining the logic here, since this sort of filtering is still needed
@@ -1229,7 +1231,7 @@ static size_t animdata_filter_shapekey (bAnimContext *ac, ListBase *anim_data, K
 		
 		/* loop through the channels adding ShapeKeys as appropriate */
 		for (kb= key->block.first; kb; kb= kb->next) {
-			/* skip the first one, since that's the non-animateable basis */
+			/* skip the first one, since that's the non-animatable basis */
 			// XXX maybe in future this may become handy?
 			if (kb == key->block.first) continue;
 			
@@ -1285,7 +1287,7 @@ static size_t animdata_filter_gpencil_data (ListBase *anim_data, bGPdata *gpd, i
 	return items;
 }
 
-/* Grab all Grase Pencil datablocks in file */
+/* Grab all Grease Pencil datablocks in file */
 // TODO: should this be amalgamated with the dopesheet filtering code?
 static size_t animdata_filter_gpencil (ListBase *anim_data, void *UNUSED(data), int filter_mode)
 {
@@ -1349,7 +1351,7 @@ static size_t animdata_filter_ds_nodetree (bAnimContext *ac, ListBase *anim_data
 		/* include data-expand widget first */
 		if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
 			/* check if filtering by active status */
-			if ANIMCHANNEL_ACTIVEOK(ntree) {
+			if (ANIMCHANNEL_ACTIVEOK(ntree)) {
 				ANIMCHANNEL_NEW_CHANNEL(ntree, ANIMTYPE_DSNTREE, owner_id);
 			}
 		}
@@ -1397,8 +1399,8 @@ static size_t animdata_filter_ds_textures (bAnimContext *ac, ListBase *anim_data
 		default: 
 		{
 			/* invalid/unsupported option */
-			if (G.f & G_DEBUG)
-				printf("ERROR: unsupported owner_id (i.e. texture stack) for filter textures - %s \n", owner_id->name);
+			if (G.debug & G_DEBUG)
+				printf("ERROR: unsupported owner_id (i.e. texture stack) for filter textures - %s\n", owner_id->name);
 			return 0;
 		}
 	}
@@ -1434,7 +1436,7 @@ static size_t animdata_filter_ds_textures (bAnimContext *ac, ListBase *anim_data
 			/* include texture-expand widget? */
 			if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
 				/* check if filtering by active status */
-				if ANIMCHANNEL_ACTIVEOK(tex) {
+				if (ANIMCHANNEL_ACTIVEOK(tex)) {
 					ANIMCHANNEL_NEW_CHANNEL(tex, ANIMTYPE_DSTEX, owner_id);
 				}
 			}
@@ -1486,7 +1488,7 @@ static size_t animdata_filter_ds_materials (bAnimContext *ac, ListBase *anim_dat
 			// hmm... do we need to store the index of this material in the array anywhere?
 			if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
 				/* check if filtering by active status */
-				if ANIMCHANNEL_ACTIVEOK(ma) {
+				if (ANIMCHANNEL_ACTIVEOK(ma)) {
 					ANIMCHANNEL_NEW_CHANNEL(ma, ANIMTYPE_DSMAT, ma);
 				}
 			}
@@ -1528,7 +1530,7 @@ static size_t animdata_filter_ds_particles (bAnimContext *ac, ListBase *anim_dat
 			/* include particle-expand widget first */
 			if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
 				/* check if filtering by active status */
-				if ANIMCHANNEL_ACTIVEOK(psys->part) {
+				if (ANIMCHANNEL_ACTIVEOK(psys->part)) {
 					ANIMCHANNEL_NEW_CHANNEL(psys->part, ANIMTYPE_DSPART, psys->part);
 				}
 			}
@@ -1668,7 +1670,7 @@ static size_t animdata_filter_ds_obdata (bAnimContext *ac, ListBase *anim_data,
 		/* include data-expand widget first */
 		if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
 			/* check if filtering by active status */
-			if ANIMCHANNEL_ACTIVEOK(iat) {
+			if (ANIMCHANNEL_ACTIVEOK(iat)) {
 				ANIMCHANNEL_NEW_CHANNEL(iat, type, iat);
 			}
 		}
@@ -1702,7 +1704,7 @@ static size_t animdata_filter_ds_keyanim (bAnimContext *ac, ListBase *anim_data,
 	if (tmp_items) {
 		/* include key-expand widget first */
 		if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
-			if ANIMCHANNEL_ACTIVEOK(key) {
+			if (ANIMCHANNEL_ACTIVEOK(key)) {
 				ANIMCHANNEL_NEW_CHANNEL(key, ANIMTYPE_DSSKEY, ob);
 			}
 		}
@@ -1819,7 +1821,7 @@ static size_t animdata_filter_dopesheet_ob (bAnimContext *ac, ListBase *anim_dat
 		if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
 			/* check if filtering by selection */
 			// XXX: double-check on this - most of the time, a lot of tools need to filter out these channels!
-			if ANIMCHANNEL_SELOK((base->flag & SELECT)) {
+			if (ANIMCHANNEL_SELOK((base->flag & SELECT))) {
 				/* check if filtering by active status */
 				if (ANIMCHANNEL_ACTIVEOK(ob)) {
 					ANIMCHANNEL_NEW_CHANNEL(base, ANIMTYPE_OBJECT, ob);
@@ -1864,7 +1866,7 @@ static size_t animdata_filter_ds_world (bAnimContext *ac, ListBase *anim_data, b
 		/* include data-expand widget first */
 		if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
 			/* check if filtering by active status */
-			if ANIMCHANNEL_ACTIVEOK(wo) {
+			if (ANIMCHANNEL_ACTIVEOK(wo)) {
 				ANIMCHANNEL_NEW_CHANNEL(wo, ANIMTYPE_DSWOR, sce);
 			}
 		}
@@ -1969,7 +1971,7 @@ static size_t animdata_filter_dopesheet_scene (bAnimContext *ac, ListBase *anim_
 		/* firstly add object expander if required */
 		if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
 			/* check if filtering by selection */
-			if ANIMCHANNEL_SELOK((sce->flag & SCE_DS_SELECTED)) {
+			if (ANIMCHANNEL_SELOK((sce->flag & SCE_DS_SELECTED))) {
 				/* NOTE: active-status doesn't matter for this! */
 				ANIMCHANNEL_NEW_CHANNEL(sce, ANIMTYPE_SCENE, sce);
 			}
@@ -1995,8 +1997,8 @@ static size_t animdata_filter_dopesheet (bAnimContext *ac, ListBase *anim_data,
 	/* check that we do indeed have a scene */
 	if ((ads->source == NULL) || (GS(ads->source->name)!=ID_SCE)) {
 		printf("DopeSheet Error: Not scene!\n");
-		if (G.f & G_DEBUG)
-			printf("\tPointer = %p, Name = '%s' \n", (void *)ads->source, (ads->source)?ads->source->name:NULL);
+		if (G.debug & G_DEBUG)
+			printf("\tPointer = %p, Name = '%s'\n", (void *)ads->source, (ads->source)?ads->source->name:NULL);
 		return 0;
 	}
 	
@@ -2043,7 +2045,7 @@ static size_t animdata_filter_dopesheet (bAnimContext *ac, ListBase *anim_data,
 			}
 			
 			/* check selection and object type filters */
-			if ( (ads->filterflag & ADS_FILTER_ONLYSEL) && !((base->flag & SELECT) /*|| (base == sce->basact)*/) )  {
+			if ( (ads->filterflag & ADS_FILTER_ONLYSEL) && !((base->flag & SELECT) /*|| (base == sce->basact)*/) ) {
 				/* only selected should be shown */
 				continue;
 			}
diff --git a/source/blender/editors/animation/anim_intern.h b/source/blender/editors/animation/anim_intern.h
index 0ac941e..bfc70c7 100644
--- a/source/blender/editors/animation/anim_intern.h
+++ b/source/blender/editors/animation/anim_intern.h
@@ -28,8 +28,8 @@
  */
 
  
-#ifndef ANIM_INTERN_H
-#define ANIM_INTERN_H
+#ifndef __ANIM_INTERN_H__
+#define __ANIM_INTERN_H__
 
 /* KeyingSets/Keyframing Interface ------------- */
 
@@ -79,4 +79,4 @@ void ANIM_OT_driver_button_remove(struct wmOperatorType *ot);
 void ANIM_OT_copy_driver_button(struct wmOperatorType *ot);
 void ANIM_OT_paste_driver_button(struct wmOperatorType *ot);
 
-#endif // ANIM_INTERN_H
+#endif // __ANIM_INTERN_H__
diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c
index 169d6b9..6f4d4c4 100644
--- a/source/blender/editors/animation/anim_ipo_utils.c
+++ b/source/blender/editors/animation/anim_ipo_utils.c
@@ -61,7 +61,7 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
 	/* sanity checks */
 	if (name == NULL)
 		return icon;
-	else if ELEM3(NULL, id, fcu, fcu->rna_path) {
+	else if (ELEM3(NULL, id, fcu, fcu->rna_path)) {
 		if (fcu == NULL)
 			strcpy(name, "<invalid>");
 		else if (fcu->rna_path == NULL)
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 79d767b..73dba91 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -83,10 +83,10 @@ static ListBase *context_get_markers(Scene *scene, ScrArea *sa)
 			/* local markers can only be shown when there's only a single active action to grab them from 
 			 * 	- flag only takes effect when there's an action, otherwise it can get too confusing?
 			 */
-			if (ELEM(saction->mode, SACTCONT_ACTION, SACTCONT_SHAPEKEY) && (saction->action)) 
-			{
-				if (saction->flag & SACTION_POSEMARKERS_SHOW)
+			if (ELEM(saction->mode, SACTCONT_ACTION, SACTCONT_SHAPEKEY) && (saction->action)) {
+				if (saction->flag & SACTION_POSEMARKERS_SHOW) {
 					return &saction->action->markers;
+				}
 			}
 		}
 	}
@@ -201,7 +201,7 @@ void ED_markers_get_minmax (ListBase *markers, short sel, float *first, float *l
 	int selcount = 0;
 	
 	/* sanity check */
-	//printf("markers = %p -  %p, %p \n", markers, markers->first, markers->last);
+	//printf("markers = %p -  %p, %p\n", markers, markers->first, markers->last);
 	if (markers == NULL) {
 		*first = 0.0f;
 		*last = 0.0f;
@@ -232,7 +232,7 @@ void ED_markers_get_minmax (ListBase *markers, short sel, float *first, float *l
 		selcount= BLI_countlist(markers);
 	
 	/* if only selected are to be considered, only consider the selected ones
-	 * (optimisation for not searching list) 
+	 * (optimization for not searching list)
 	 */
 	if (selcount > 1) {
 		for (marker= markers->first; marker; marker= marker->next) {
@@ -323,7 +323,7 @@ TimeMarker *ED_markers_get_first_selected(ListBase *markers)
 /* --------------------------------- */
 
 /* Print debugging prints of list of markers 
- * BSI's: do NOT make static or put in if-defs as "unused code". That's too much trouble when we need to use for quick debuggging!
+ * BSI's: do NOT make static or put in if-defs as "unused code". That's too much trouble when we need to use for quick debugging!
  */
 void debug_markers_print_list(ListBase *markers)
 {
@@ -410,7 +410,7 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
 		}
 		else {
 			UI_ThemeColor(TH_TEXT);
-			if((marker->frame <= cfra) && (marker->frame+5 > cfra)) {
+			if ((marker->frame <= cfra) && (marker->frame+5 > cfra)) {
 				x= xpos*xscale + 4.0f;
 				y= (ypixels <= 39.0f)? (ypixels - 10.0f) : 29.0f;
 			}
@@ -421,7 +421,7 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag)
 		}
 
 #ifdef DURIAN_CAMERA_SWITCH
-		if(marker->camera && (marker->camera->restrictflag & OB_RESTRICT_RENDER)) {
+		if (marker->camera && (marker->camera->restrictflag & OB_RESTRICT_RENDER)) {
 			float col[4];
 			glGetFloatv(GL_CURRENT_COLOR, col);
 			col[3]= 0.4;
@@ -582,44 +582,43 @@ static int ed_marker_add(bContext *C, wmOperator *UNUSED(op))
 static void MARKER_OT_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Time Marker";
-	ot->description= "Add a new time marker";
-	ot->idname= "MARKER_OT_add";
+	ot->name = "Add Time Marker";
+	ot->description = "Add a new time marker";
+	ot->idname = "MARKER_OT_add";
 	
 	/* api callbacks */
-	ot->exec= ed_marker_add;
+	ot->exec = ed_marker_add;
 	ot->invoke = ed_markers_opwrap_invoke;
-	ot->poll= ED_operator_animview_active;
+	ot->poll = ED_operator_animview_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ************************** transform markers *************************** */
 
-
 /* operator state vars used:  
-	frs: delta movement
-
-functions:
-
-	init()   check selection, add customdata with old values and some lookups
-
-	apply()  do the actual movement
-
-	exit()	cleanup, send notifier
-
-	cancel() to escape from modal
-
-callbacks:
-
-	exec()	calls init, apply, exit 
-
-	invoke() calls init, adds modal handler
-
-	modal()	accept modal events while doing it, ends with apply and exit, or cancel
-
-*/
+ *     frs: delta movement
+ * 
+ * functions:
+ * 
+ *     init()   check selection, add customdata with old values and some lookups
+ * 
+ *     apply()  do the actual movement
+ * 
+ *     exit()    cleanup, send notifier
+ * 
+ *     cancel() to escape from modal
+ * 
+ * callbacks:
+ * 
+ *     exec()    calls init, apply, exit 
+ * 
+ *     invoke() calls init, adds modal handler
+ * 
+ *     modal()    accept modal events while doing it, ends with apply and exit, or cancel
+ * 
+ */
 
 typedef struct MarkerMove {
 	SpaceLink *slink;
@@ -639,7 +638,7 @@ static int ed_marker_move_init(bContext *C, wmOperator *op)
 	int totmark=0;
 	int a;
 
-	if(markers == NULL) return 0;
+	if (markers == NULL) return 0;
 	
 	for (marker= markers->first; marker; marker= marker->next)
 		if (marker->flag & SELECT) totmark++;
@@ -682,7 +681,7 @@ static void ed_marker_move_exit(bContext *C, wmOperator *op)
 
 static int ed_marker_move_invoke(bContext *C, wmOperator *op, wmEvent *evt)
 {
-	if(ed_marker_move_init(C, op)) {
+	if (ed_marker_move_init(C, op)) {
 		MarkerMove *mm= op->customdata;
 		
 		mm->evtx= evt->x;
@@ -752,7 +751,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
 			return OPERATOR_CANCELLED;
 		
 		case RIGHTMOUSE:
-			/* press = user manually demands transform to be cancelled */
+			/* press = user manually demands transform to be canceled */
 			if (evt->val == KM_PRESS) {
 				ed_marker_move_cancel(C, op);
 				return OPERATOR_CANCELLED;
@@ -852,8 +851,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt)
 		float vec[3];
 		char str_tx[256];
 		
-		if (handleNumInput(&mm->num, evt))
-		{
+		if (handleNumInput(&mm->num, evt)) {
 			applyNumInput(&mm->num, vec);
 			outputNumInput(&mm->num, str_tx);
 			
@@ -874,7 +872,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)) {
+	if (ed_marker_move_init(C, op)) {
 		ed_marker_move_apply(op);
 		ed_marker_move_exit(C, op);
 		return OPERATOR_FINISHED;
@@ -885,19 +883,19 @@ static int ed_marker_move_exec(bContext *C, wmOperator *op)
 static void MARKER_OT_move(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Move Time Marker";
-	ot->description= "Move selected time marker(s)";
-	ot->idname= "MARKER_OT_move";
+	ot->name = "Move Time Marker";
+	ot->description = "Move selected time marker(s)";
+	ot->idname = "MARKER_OT_move";
 	
 	/* api callbacks */
-	ot->exec= ed_marker_move_exec;
-	ot->invoke= ed_marker_move_invoke_wrapper;
-	ot->modal= ed_marker_move_modal;
-	ot->poll= ed_markers_poll_selected_markers;
-	ot->cancel= ed_marker_move_cancel;
+	ot->exec = ed_marker_move_exec;
+	ot->invoke = ed_marker_move_invoke_wrapper;
+	ot->modal = ed_marker_move_modal;
+	ot->poll = ed_markers_poll_selected_markers;
+	ot->cancel = ed_marker_move_cancel;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
 	
 	/* rna storage */
 	RNA_def_int(ot->srna, "frames", 0, INT_MIN, INT_MAX, "Frames", "", INT_MIN, INT_MAX);
@@ -905,23 +903,21 @@ static void MARKER_OT_move(wmOperatorType *ot)
 
 /* ************************** duplicate markers *************************** */
 
-/* operator state vars used:  
-	frs: delta movement
-
-functions:
-
-	apply()  do the actual duplicate
-
-callbacks:
-
-	exec()	calls apply, move_exec
-
-	invoke() calls apply, move_invoke
-
-	modal()	uses move_modal
-
-*/
-
+/* operator state vars used:
+ *     frs: delta movement
+ *
+ * functions:
+ *
+ *     apply()  do the actual duplicate
+ *
+ * callbacks:
+ *
+ *     exec()    calls apply, move_exec
+ *
+ *     invoke() calls apply, move_invoke
+ *
+ *     modal()    uses move_modal
+ */
 
 /* duplicate selected TimeMarkers */
 static void ed_marker_duplicate_apply(bContext *C)
@@ -933,7 +929,7 @@ static void ed_marker_duplicate_apply(bContext *C)
 		return;
 
 	/* go through the list of markers, duplicate selected markers and add duplicated copies
-	 * to the begining of the list (unselect original markers) 
+	 * to the beginning of the list (unselect original markers)
 	 */
 	for (marker= markers->first; marker; marker= marker->next) {
 		if (marker->flag & SELECT) {
@@ -950,7 +946,7 @@ static void ed_marker_duplicate_apply(bContext *C)
 			newmarker->camera= marker->camera;
 #endif
 
-			/* new marker is added to the begining of list */
+			/* new marker is added to the beginning of list */
 			// FIXME: bad ordering!
 			BLI_addhead(markers, newmarker);
 		}
@@ -980,19 +976,19 @@ static int ed_marker_duplicate_invoke_wrapper(bContext *C, wmOperator *op, wmEve
 static void MARKER_OT_duplicate(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Duplicate Time Marker";
-	ot->description= "Duplicate selected time marker(s)";
-	ot->idname= "MARKER_OT_duplicate";
+	ot->name = "Duplicate Time Marker";
+	ot->description = "Duplicate selected time marker(s)";
+	ot->idname = "MARKER_OT_duplicate";
 	
 	/* api callbacks */
-	ot->exec= ed_marker_duplicate_exec;
-	ot->invoke= ed_marker_duplicate_invoke_wrapper;
-	ot->modal= ed_marker_move_modal;
-	ot->poll= ed_markers_poll_selected_markers;
-	ot->cancel= ed_marker_move_cancel;
+	ot->exec = ed_marker_duplicate_exec;
+	ot->invoke = ed_marker_duplicate_invoke_wrapper;
+	ot->modal = ed_marker_move_modal;
+	ot->poll = ed_markers_poll_selected_markers;
+	ot->cancel = ed_marker_move_cancel;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* rna storage */
 	RNA_def_int(ot->srna, "frames", 0, INT_MIN, INT_MAX, "Frames", "", INT_MIN, INT_MAX);
@@ -1055,7 +1051,7 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera)
 			scene_deselect_all(scene);
 		
 		for (marker= markers->first; marker; marker= marker->next) {
-			if(marker->frame==cfra) {
+			if (marker->frame==cfra) {
 				sel= (marker->flag & SELECT);
 				break;
 			}
@@ -1067,7 +1063,7 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera)
 					base= object_in_scene(marker->camera, scene);
 					if (base) {
 						ED_base_object_select(base, sel);
-						if(sel)
+						if (sel)
 							ED_base_object_activate(C, base);
 					}
 				}
@@ -1105,18 +1101,18 @@ static int ed_marker_select_invoke_wrapper(bContext *C, wmOperator *op, wmEvent
 static void MARKER_OT_select(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Time Marker";
-	ot->description= "Select time marker(s)";
-	ot->idname= "MARKER_OT_select";
+	ot->name = "Select Time Marker";
+	ot->description = "Select time marker(s)";
+	ot->idname = "MARKER_OT_select";
 	
 	/* api callbacks */
-	ot->invoke= ed_marker_select_invoke_wrapper;
-	ot->poll= ed_markers_poll_markers_exist;
+	ot->invoke = ed_marker_select_invoke_wrapper;
+	ot->poll = ed_markers_poll_markers_exist;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
-	RNA_def_boolean(ot->srna, "extend", 0, "Extend", "extend the selection");
+	RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection");
 #ifdef DURIAN_CAMERA_SWITCH
 	RNA_def_boolean(ot->srna, "camera", 0, "Camera", "Select the camera");
 #endif
@@ -1125,23 +1121,23 @@ static void MARKER_OT_select(wmOperatorType *ot)
 /* *************************** border select markers **************** */
 
 /* operator state vars used: (added by default WM callbacks)   
-	xmin, ymin     
-	xmax, ymax     
-
-customdata: the wmGesture pointer, with subwindow
-
-callbacks:
-
-	exec()	has to be filled in by user
-
-	invoke() default WM function
-			adds modal handler
-
-	modal()	default WM function 
-			accept modal events while doing it, calls exec(), handles ESC and border drawing
-
-	poll()	has to be filled in by user for context
-*/
+ * xmin, ymin
+ * xmax, ymax
+ *
+ * customdata: the wmGesture pointer, with subwindow
+ *
+ * callbacks:
+ *
+ * 	exec()	has to be filled in by user
+ *
+ * 	invoke() default WM function
+ * 			adds modal handler
+ *
+ * 	modal()	default WM function 
+ * 			accept modal events while doing it, calls exec(), handles ESC and border drawing
+ *
+ * 	poll()	has to be filled in by user for context
+ */
 
 static int ed_marker_border_select_exec(bContext *C, wmOperator *op)
 {
@@ -1193,20 +1189,20 @@ static int ed_marker_select_border_invoke_wrapper(bContext *C, wmOperator *op, w
 static void MARKER_OT_select_border(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Marker Border select";
-	ot->description= "Select all time markers using border selection";
-	ot->idname= "MARKER_OT_select_border";
+	ot->name = "Marker Border select";
+	ot->description = "Select all time markers using border selection";
+	ot->idname = "MARKER_OT_select_border";
 	
 	/* api callbacks */
-	ot->exec= ed_marker_border_select_exec;
-	ot->invoke= ed_marker_select_border_invoke_wrapper;
-	ot->modal= WM_border_select_modal;
-	ot->cancel= WM_border_select_cancel;
+	ot->exec = ed_marker_border_select_exec;
+	ot->invoke = ed_marker_select_border_invoke_wrapper;
+	ot->modal = WM_border_select_modal;
+	ot->cancel = WM_border_select_cancel;
 	
-	ot->poll= ed_markers_poll_markers_exist;
+	ot->poll = ed_markers_poll_markers_exist;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* rna */
 	WM_operator_properties_gesture_border(ot, TRUE);
@@ -1227,7 +1223,7 @@ static int ed_marker_select_all_exec(bContext *C, wmOperator *op)
 		action = (ED_markers_get_first_selected(markers) != NULL) ? SEL_DESELECT : SEL_SELECT;
 	}
 	
-	for(marker= markers->first; marker; marker= marker->next) {
+	for (marker= markers->first; marker; marker= marker->next) {
 		switch (action) {
 		case SEL_SELECT:
 			marker->flag |= SELECT;
@@ -1250,17 +1246,17 @@ static int ed_marker_select_all_exec(bContext *C, wmOperator *op)
 static void MARKER_OT_select_all(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "(De)select all markers";
-	ot->description= "Change selection of all time markers";
-	ot->idname= "MARKER_OT_select_all";
+	ot->name = "(De)select all markers";
+	ot->description = "Change selection of all time markers";
+	ot->idname = "MARKER_OT_select_all";
 	
 	/* api callbacks */
-	ot->exec= ed_marker_select_all_exec;
+	ot->exec = ed_marker_select_all_exec;
 	ot->invoke = ed_markers_opwrap_invoke;
-	ot->poll= ed_markers_poll_markers_exist;
+	ot->poll = ed_markers_poll_markers_exist;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* rna */
 	WM_operator_properties_select_all(ot);
@@ -1303,17 +1299,17 @@ static int ed_marker_delete_invoke_wrapper(bContext *C, wmOperator *op, wmEvent
 static void MARKER_OT_delete(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete Markers";
-	ot->description= "Delete selected time marker(s)";
-	ot->idname= "MARKER_OT_delete";
+	ot->name = "Delete Markers";
+	ot->description = "Delete selected time marker(s)";
+	ot->idname = "MARKER_OT_delete";
 	
 	/* api callbacks */
-	ot->invoke= ed_marker_delete_invoke_wrapper;
-	ot->exec= ed_marker_delete_exec;
-	ot->poll= ed_markers_poll_selected_markers;
+	ot->invoke = ed_marker_delete_invoke_wrapper;
+	ot->exec = ed_marker_delete_exec;
+	ot->poll = ed_markers_poll_selected_markers;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;	
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;	
 }
 
 
@@ -1339,7 +1335,7 @@ static int ed_marker_rename_exec(bContext *C, wmOperator *op)
 
 static int ed_marker_rename_invoke_wrapper(bContext *C, wmOperator *op, wmEvent *evt)
 {
-	/* must initialise the marker name first if there is a marker selected */
+	/* must initialize the marker name first if there is a marker selected */
 	TimeMarker *marker = ED_markers_get_first_selected(ED_context_get_markers(C));
 	if (marker)
 		RNA_string_set(op->ptr, "name", marker->name);
@@ -1351,17 +1347,17 @@ static int ed_marker_rename_invoke_wrapper(bContext *C, wmOperator *op, wmEvent
 static void MARKER_OT_rename(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Rename Marker";
-	ot->description= "Rename first selected time marker";
-	ot->idname= "MARKER_OT_rename";
+	ot->name = "Rename Marker";
+	ot->description = "Rename first selected time marker";
+	ot->idname = "MARKER_OT_rename";
 	
 	/* api callbacks */
-	ot->invoke= ed_marker_rename_invoke_wrapper;
-	ot->exec= ed_marker_rename_exec;
-	ot->poll= ed_markers_poll_selected_markers;
+	ot->invoke = ed_marker_rename_invoke_wrapper;
+	ot->exec = ed_marker_rename_exec;
+	ot->poll = ed_markers_poll_selected_markers;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;	
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;	
 	
 	/* properties */
 	ot->prop = RNA_def_string(ot->srna, "name", "RenamedMarker", sizeof(((TimeMarker *)NULL)->name), "Name", "New name for marker");
@@ -1404,22 +1400,22 @@ static void MARKER_OT_make_links_scene(wmOperatorType *ot)
 	PropertyRNA *prop;
 
 	/* identifiers */
-	ot->name= "Make Links to Scene";
-	ot->description= "Copy selected markers to another scene";
-	ot->idname= "MARKER_OT_make_links_scene";
+	ot->name = "Make Links to Scene";
+	ot->description = "Copy selected markers to another scene";
+	ot->idname = "MARKER_OT_make_links_scene";
 
 	/* api callbacks */
-	ot->exec= ed_marker_make_links_scene_exec;
+	ot->exec = ed_marker_make_links_scene_exec;
 	ot->invoke = ed_markers_opwrap_invoke;
-	ot->poll= ed_markers_poll_selected_markers;
+	ot->poll = ed_markers_poll_selected_markers;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	prop= RNA_def_enum(ot->srna, "scene", DummyRNA_NULL_items, 0, "Scene", "");
 	RNA_def_enum_funcs(prop, RNA_scene_itemf);
-	ot->prop= prop;
+	ot->prop = prop;
 
 }
 
@@ -1435,7 +1431,7 @@ static int ed_marker_camera_bind_exec(bContext *C, wmOperator *UNUSED(op))
 	TimeMarker *marker;
 
 	marker= ED_markers_get_first_selected(markers);
-	if(marker == NULL)
+	if (marker == NULL)
 		return OPERATOR_CANCELLED;
 
 	marker->camera= ob;
@@ -1454,17 +1450,17 @@ static int ed_marker_camera_bind_exec(bContext *C, wmOperator *UNUSED(op))
 static void MARKER_OT_camera_bind(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Bind Camera to Markers";
-	ot->description= "Bind the active camera to selected markers(s)";
-	ot->idname= "MARKER_OT_camera_bind";
+	ot->name = "Bind Camera to Markers";
+	ot->description = "Bind the active camera to selected markers(s)";
+	ot->idname = "MARKER_OT_camera_bind";
 
 	/* api callbacks */
-	ot->exec= ed_marker_camera_bind_exec;
+	ot->exec = ed_marker_camera_bind_exec;
 	ot->invoke = ed_markers_opwrap_invoke;
-	ot->poll= ed_markers_poll_selected_markers;
+	ot->poll = ed_markers_poll_selected_markers;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 #endif
 
@@ -1490,7 +1486,7 @@ void ED_operatortypes_marker(void)
 /* called in screen_ops.c:ED_keymap_screen() */
 void ED_marker_keymap(wmKeyConfig *keyconf)
 {
-	wmKeyMap *keymap= WM_keymap_find(keyconf, "Markers", 0, 0);
+	wmKeyMap *keymap = WM_keymap_find(keyconf, "Markers", 0, 0);
 	wmKeyMapItem *kmi;
 	
 	WM_keymap_verify_item(keymap, "MARKER_OT_add", MKEY, KM_PRESS, 0, 0);
@@ -1501,11 +1497,11 @@ void ED_marker_keymap(wmKeyConfig *keyconf)
 	RNA_boolean_set(kmi->ptr, "extend", TRUE);
 
 #ifdef DURIAN_CAMERA_SWITCH
-	kmi= WM_keymap_add_item(keymap, "MARKER_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
+	kmi = WM_keymap_add_item(keymap, "MARKER_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
 	RNA_boolean_set(kmi->ptr, "extend", FALSE);
 	RNA_boolean_set(kmi->ptr, "camera", TRUE);
 
-	kmi= WM_keymap_add_item(keymap, "MARKER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+	kmi = WM_keymap_add_item(keymap, "MARKER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
 	RNA_boolean_set(kmi->ptr, "extend", TRUE);
 	RNA_boolean_set(kmi->ptr, "camera", TRUE);
 #else
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index 5b246e6..8286e81 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -65,7 +65,7 @@ static int change_frame_poll(bContext *C)
 	ScrArea *curarea= CTX_wm_area(C);
 	
 	/* XXX temp? prevent changes during render */
-	if(G.rendering) return 0;
+	if (G.rendering) return 0;
 	
 	/* as long as there is an active area, and it isn't a Graph Editor 
 	 * (since the Graph Editor has its own version which does extra stuff),
@@ -161,18 +161,18 @@ static int change_frame_modal(bContext *C, wmOperator *op, wmEvent *event)
 static void ANIM_OT_change_frame(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Change frame";
-	ot->idname= "ANIM_OT_change_frame";
-	ot->description= "Interactively change the current frame number";
+	ot->name = "Change frame";
+	ot->idname = "ANIM_OT_change_frame";
+	ot->description = "Interactively change the current frame number";
 	
 	/* api callbacks */
-	ot->exec= change_frame_exec;
-	ot->invoke= change_frame_invoke;
-	ot->modal= change_frame_modal;
-	ot->poll= change_frame_poll;
+	ot->exec = change_frame_exec;
+	ot->invoke = change_frame_invoke;
+	ot->modal = change_frame_modal;
+	ot->poll = change_frame_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_BLOCKING|OPTYPE_UNDO;
+	ot->flag = OPTYPE_BLOCKING|OPTYPE_UNDO;
 
 	/* rna */
 	RNA_def_int(ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME);
@@ -216,20 +216,20 @@ static int previewrange_define_exec(bContext *C, wmOperator *op)
 static void ANIM_OT_previewrange_set(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Preview Range";
-	ot->idname= "ANIM_OT_previewrange_set";
-	ot->description= "Interactively define frame range used for playback";
+	ot->name = "Set Preview Range";
+	ot->idname = "ANIM_OT_previewrange_set";
+	ot->description = "Interactively define frame range used for playback";
 	
 	/* api callbacks */
-	ot->invoke= WM_border_select_invoke;
-	ot->exec= previewrange_define_exec;
-	ot->modal= WM_border_select_modal;
-	ot->cancel= WM_border_select_cancel;
+	ot->invoke = WM_border_select_invoke;
+	ot->exec = previewrange_define_exec;
+	ot->modal = WM_border_select_modal;
+	ot->cancel = WM_border_select_cancel;
 	
-	ot->poll= ED_operator_animview_active;
+	ot->poll = ED_operator_animview_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* rna */
 		/* used to define frame range */
@@ -264,17 +264,17 @@ static int previewrange_clear_exec(bContext *C, wmOperator *UNUSED(op))
 static void ANIM_OT_previewrange_clear(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear Preview Range";
-	ot->idname= "ANIM_OT_previewrange_clear";
-	ot->description= "Clear Preview Range";
+	ot->name = "Clear Preview Range";
+	ot->idname = "ANIM_OT_previewrange_clear";
+	ot->description = "Clear Preview Range";
 	
 	/* api callbacks */
-	ot->exec= previewrange_clear_exec;
+	ot->exec = previewrange_clear_exec;
 	
-	ot->poll= ED_operator_animview_active;
+	ot->poll = ED_operator_animview_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ************************** registration **********************************/
@@ -315,7 +315,7 @@ void ED_operatortypes_anim(void)
 
 void ED_keymap_anim(wmKeyConfig *keyconf)
 {
-	wmKeyMap *keymap= WM_keymap_find(keyconf, "Animation", 0, 0);
+	wmKeyMap *keymap = WM_keymap_find(keyconf, "Animation", 0, 0);
 	wmKeyMapItem *kmi;
 	
 	/* frame management */
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index e8f3fc2..9c4f96e 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -84,7 +84,7 @@ FCurve *verify_driver_fcurve (ID *id, const char rna_path[], const int array_ind
 	FCurve *fcu;
 	
 	/* sanity checks */
-	if ELEM(NULL, id, rna_path)
+	if (ELEM(NULL, id, rna_path))
 		return NULL;
 	
 	/* init animdata if none available yet */
@@ -515,16 +515,16 @@ static int add_driver_button_exec (bContext *C, wmOperator *op)
 void ANIM_OT_driver_button_add (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Driver";
-	ot->idname= "ANIM_OT_driver_button_add";
-	ot->description= "Add driver(s) for the property(s) connected represented by the highlighted button";
+	ot->name = "Add Driver";
+	ot->idname = "ANIM_OT_driver_button_add";
+	ot->description = "Add driver(s) for the property(s) connected represented by the highlighted button";
 	
 	/* callbacks */
-	ot->exec= add_driver_button_exec; 
-	//op->poll= ??? // TODO: need to have some animateable property to do this
+	ot->exec = add_driver_button_exec; 
+	//op->poll= ??? // TODO: need to have some animatable property to do this
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "all", 1, "All", "Create drivers for all elements of the array");
@@ -567,16 +567,16 @@ static int remove_driver_button_exec (bContext *C, wmOperator *op)
 void ANIM_OT_driver_button_remove (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove Driver";
-	ot->idname= "ANIM_OT_driver_button_remove";
-	ot->description= "Remove the driver(s) for the property(s) connected represented by the highlighted button";
+	ot->name = "Remove Driver";
+	ot->idname = "ANIM_OT_driver_button_remove";
+	ot->description = "Remove the driver(s) for the property(s) connected represented by the highlighted button";
 	
 	/* callbacks */
-	ot->exec= remove_driver_button_exec; 
+	ot->exec = remove_driver_button_exec; 
 	//op->poll= ??? // TODO: need to have some driver to be able to do this...
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "all", 1, "All", "Delete drivers for all elements of the array");
@@ -614,16 +614,16 @@ static int copy_driver_button_exec (bContext *C, wmOperator *op)
 void ANIM_OT_copy_driver_button (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Copy Driver";
-	ot->idname= "ANIM_OT_copy_driver_button";
-	ot->description= "Copy the driver for the highlighted button";
+	ot->name = "Copy Driver";
+	ot->idname = "ANIM_OT_copy_driver_button";
+	ot->description = "Copy the driver for the highlighted button";
 	
 	/* callbacks */
-	ot->exec= copy_driver_button_exec; 
+	ot->exec = copy_driver_button_exec; 
 	//op->poll= ??? // TODO: need to have some driver to be able to do this...
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* Paste Driver Button Operator ------------------------ */
@@ -658,16 +658,16 @@ static int paste_driver_button_exec (bContext *C, wmOperator *op)
 void ANIM_OT_paste_driver_button (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Paste Driver";
-	ot->idname= "ANIM_OT_paste_driver_button";
-	ot->description= "Paste the driver in the copy/paste buffer for the highlighted button";
+	ot->name = "Paste Driver";
+	ot->idname = "ANIM_OT_paste_driver_button";
+	ot->description = "Paste the driver in the copy/paste buffer for the highlighted button";
 	
 	/* callbacks */
-	ot->exec= paste_driver_button_exec; 
+	ot->exec = paste_driver_button_exec; 
 	//op->poll= ??? // TODO: need to have some driver to be able to do this...
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ************************************************** */
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c
index 05f9248..d5ec98d 100644
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@ -45,6 +45,8 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "BLF_translation.h"
+
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
 
@@ -124,7 +126,7 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
 	/* col= uiLayoutColumn(layout, 1); */ /* 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, width-30, 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);
@@ -141,41 +143,52 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
 			/* draw polynomial order selector */
 			row= uiLayoutRow(layout, 0);
 			block= uiLayoutGetBlock(row);
-				but= uiDefButI(block, NUM, B_FMODIFIER_REDRAW, "Poly Order: ", 10,0,width-30,19, &data->poly_order, 1, 100, 0, 0, "'Order' of the Polynomial - for a polynomial with n terms, 'order' is n-1");
+				but = uiDefButI(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Poly Order:"), 10, 0, width-30, 19,
+				               &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);
 			
 			
 			/* draw controls for each coefficient and a + sign at end of row */
 			row= uiLayoutRow(layout, 1);
 			block= uiLayoutGetBlock(row);
-				uiDefBut(block, LABEL, 1, "y = ", 0, 0, 50, 20, NULL, 0.0, 0.0, 0, 0, "");
 			
 			cp= data->coefficients;
 			for (i=0; (i < data->arraysize) && (cp); i++, cp++) {
+				/* To align with first line */
+				if (i)
+					uiDefBut(block, LABEL, 1, "   ", 0, 0, 50, 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, "");
 				/* coefficient */
-				uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 0, 0, 150, 20, cp, -UI_FLT_MAX, UI_FLT_MAX, 10, 3, "Coefficient for polynomial");
+				uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 0, 0, 150, 20, cp, -UI_FLT_MAX, UI_FLT_MAX,
+				          10, 3, TIP_("Coefficient for polynomial"));
 				
 				/* 'x' param (and '+' if necessary) */
-				if (i) {
-					if (i == 1)
-						strcpy(xval, "x");
-					else
-						sprintf(xval, "x^%u", i);
-					uiDefBut(block, LABEL, 1, xval, 0, 0, 50, 20, NULL, 0.0, 0.0, 0, 0, "Power of x");
-				}
+				if (i == 0)
+					strcpy(xval, "");
+				else if (i == 1)
+					strcpy(xval, "x");
+				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"));
 				
 				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, 30, 20, NULL, 0.0, 0.0, 0, 0, "");
 					
 					/* next coefficient on a new row */
 					row= uiLayoutRow(layout, 1);
 					block= uiLayoutGetBlock(row);
 				}
+				else {
+					/* For alignement in UI! */
+					uiDefBut(block, LABEL, 1, " ", 0, 0, 30, 20, NULL, 0.0, 0.0, 0, 0, "");
+				}
 			}
-		}
 			break;
+		}
 		
-		case FCM_GENERATOR_POLYNOMIAL_FACTORISED: /* factorised polynomial expression */
+		case FCM_GENERATOR_POLYNOMIAL_FACTORISED: /* Factorized polynomial expression */
 		{
 			float *cp = NULL;
 			unsigned int i;
@@ -183,26 +196,34 @@ static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, s
 			/* draw polynomial order selector */
 			row= uiLayoutRow(layout, 0);
 			block= uiLayoutGetBlock(row);
-				but= uiDefButI(block, NUM, B_FMODIFIER_REDRAW, "Poly Order: ", 0,0,width-30,19, &data->poly_order, 1, 100, 0, 0, "'Order' of the Polynomial - for a polynomial with n terms, 'order' is n-1");
+				but = uiDefButI(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Poly Order:"), 0, 0, width-30, 19,
+				               &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);
 			
 			
 			/* draw controls for each pair of coefficients */
 			row= uiLayoutRow(layout, 1);
 			block= uiLayoutGetBlock(row);
-				uiDefBut(block, LABEL, 1, "y=", 0, 0, 50, 20, NULL, 0.0, 0.0, 0, 0, "");
 			
 			cp= data->coefficients;
 			for (i=0; (i < data->poly_order) && (cp); i++, cp+=2) {
+				/* To align with first line */
+				if (i)
+					uiDefBut(block, LABEL, 1, "   ", 0, 0, 50, 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, "");
 				/* opening bracket */
 				uiDefBut(block, LABEL, 1, "(", 0, 0, 20, 20, NULL, 0.0, 0.0, 0, 0, "");
 				
 				/* coefficients */
-				uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 0, 0, 100, 20, cp, -UI_FLT_MAX, UI_FLT_MAX, 10, 3, "Coefficient of x");
+				uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 0, 0, 100, 20, cp, -UI_FLT_MAX, UI_FLT_MAX,
+				          10, 3, TIP_("Coefficient of x"));
 				
-				uiDefBut(block, LABEL, 1, "x+", 0, 0, 40, 20, NULL, 0.0, 0.0, 0, 0, "");
+				uiDefBut(block, LABEL, 1, "x +", 0, 0, 40, 20, NULL, 0.0, 0.0, 0, 0, "");
 				
-				uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 0, 0, 100, 20, cp+1, -UI_FLT_MAX, UI_FLT_MAX, 10, 3, "Second coefficient");
+				uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "", 0, 0, 100, 20, cp+1, -UI_FLT_MAX, UI_FLT_MAX,
+				          10, 3, TIP_("Second coefficient"));
 				
 				/* closing bracket and '+' sign */
 				if ( (i != (data->poly_order - 1)) || ((i==0) && data->poly_order==2) ) {
@@ -261,13 +282,13 @@ static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, shor
 	
 	/* before range */
 	col= uiLayoutColumn(split, 1);
-		uiItemL(col, "Before:", ICON_NONE);
+		uiItemL(col, IFACE_("Before:"), ICON_NONE);
 		uiItemR(col, &ptr, "mode_before", 0, "", ICON_NONE);
 		uiItemR(col, &ptr, "cycles_before", 0, NULL, ICON_NONE);
 		
 	/* after range */
 	col= uiLayoutColumn(split, 1);
-		uiItemL(col, "After:", ICON_NONE);
+		uiItemL(col, IFACE_("After:"), ICON_NONE);
 		uiItemR(col, &ptr, "mode_after", 0, "", ICON_NONE);
 		uiItemR(col, &ptr, "cycles_after", 0, NULL, ICON_NONE);
 }
@@ -312,7 +333,7 @@ static int binarysearch_fcm_envelopedata_index (FCM_EnvelopeData array[], float
 	int start=0, end=arraylen;
 	int loopbreaker= 0, maxloop= arraylen * 2;
 	
-	/* initialise exists-flag first */
+	/* initialize exists-flag first */
 	*exists= 0;
 	
 	/* sneaky optimisations (don't go through searching process if...):
@@ -320,7 +341,7 @@ static int binarysearch_fcm_envelopedata_index (FCM_EnvelopeData array[], float
 	 *	- keyframe to be added would replace one of the existing ones on bounds
 	 */
 	if ((arraylen <= 0) || (array == NULL)) {
-		printf("Warning: binarysearch_fcm_envelopedata_index() encountered invalid array \n");
+		printf("Warning: binarysearch_fcm_envelopedata_index() encountered invalid array\n");
 		return 0;
 	}
 	else {
@@ -370,10 +391,10 @@ static int binarysearch_fcm_envelopedata_index (FCM_EnvelopeData array[], float
 	
 	/* print error if loop-limit exceeded */
 	if (loopbreaker == (maxloop-1)) {
-		printf("Error: binarysearch_fcm_envelopedata_index() was taking too long \n");
+		printf("Error: binarysearch_fcm_envelopedata_index() was taking too long\n");
 		
 		// include debug info 
-		printf("\tround = %d: start = %d, end = %d, arraylen = %d \n", loopbreaker, start, end, arraylen);
+		printf("\tround = %d: start = %d, end = %d, arraylen = %d\n", loopbreaker, start, end, arraylen);
 	}
 	
 	/* not found, so return where to place it */
@@ -479,12 +500,12 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh
 	
 	/* general settings */
 	col= uiLayoutColumn(layout, 1);
-		uiItemL(col, "Envelope:", ICON_NONE);
+		uiItemL(col, IFACE_("Envelope:"), ICON_NONE);
 		uiItemR(col, &ptr, "reference_value", 0, NULL, ICON_NONE);
 		
 		row= uiLayoutRow(col, 1);
-			uiItemR(row, &ptr, "default_min", 0, "Min", ICON_NONE);
-			uiItemR(row, &ptr, "default_max", 0, "Max", ICON_NONE);
+			uiItemR(row, &ptr, "default_min", 0, IFACE_("Min"), ICON_NONE);
+			uiItemR(row, &ptr, "default_max", 0, IFACE_("Max"), ICON_NONE);
 			
 	/* control points header */
 	// TODO: move this control-point control stuff to using the new special widgets for lists
@@ -492,9 +513,10 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh
 	row= uiLayoutRow(layout, 0);
 	block= uiLayoutGetBlock(row);
 		
-		uiDefBut(block, LABEL, 1, "Control Points:", 0, 0, 150, 20, NULL, 0.0, 0.0, 0, 0, "");
+		uiDefBut(block, LABEL, 1, IFACE_("Control Points:"), 0, 0, 150, 20, NULL, 0.0, 0.0, 0, 0, "");
 		
-		but= uiDefBut(block, BUT, B_FMODIFIER_REDRAW, "Add Point", 0,0,150,19, NULL, 0, 0, 0, 0, "Adds a new control-point to the envelope on the current frame");
+		but = uiDefBut(block, BUT, B_FMODIFIER_REDRAW, IFACE_("Add Point"), 0, 0, 150, 19,
+		              NULL, 0, 0, 0, 0, TIP_("Add a new control-point to the envelope on the current frame"));
 		uiButSetFunc(but, fmod_envelope_addpoint_cb, env, NULL);
 		
 	/* control points list */
@@ -504,13 +526,17 @@ static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, sh
 		block= uiLayoutGetBlock(row);
 		
 		uiBlockBeginAlign(block);
-			but=uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "Fra:", 0, 0, 90, 20, &fed->time, -MAXFRAMEF, MAXFRAMEF, 10, 1, "Frame that envelope point occurs");
+			but=uiDefButF(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Fra:"), 0, 0, 90, 20,
+			              &fed->time, -MAXFRAMEF, MAXFRAMEF, 10, 1, TIP_("Frame that envelope point occurs"));
 			uiButSetFunc(but, validate_fmodifier_cb, fcm, NULL);
 			
-			uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "Min:", 0, 0, 100, 20, &fed->min, -UI_FLT_MAX, UI_FLT_MAX, 10, 2, "Minimum bound of envelope at this point");
-			uiDefButF(block, NUM, B_FMODIFIER_REDRAW, "Max:", 0, 0, 100, 20, &fed->max, -UI_FLT_MAX, UI_FLT_MAX, 10, 2, "Maximum bound of envelope at this point");
+			uiDefButF(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Min:"), 0, 0, 100, 20,
+			          &fed->min, -UI_FLT_MAX, UI_FLT_MAX, 10, 2, TIP_("Minimum bound of envelope at this point"));
+			uiDefButF(block, NUM, B_FMODIFIER_REDRAW, IFACE_("Max:"), 0, 0, 100, 20,
+			          &fed->max, -UI_FLT_MAX, UI_FLT_MAX, 10, 2, TIP_("Maximum bound of envelope at this point"));
 			
-			but= uiDefIconBut(block, BUT, B_FMODIFIER_REDRAW, ICON_X, 0, 0, 18, 20, NULL, 0.0, 0.0, 0.0, 0.0, "Delete envelope control point");
+			but = uiDefIconBut(block, BUT, B_FMODIFIER_REDRAW, ICON_X, 0, 0, 18, 20,
+			                  NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete envelope control point"));
 			uiButSetFunc(but, fmod_envelope_deletepoint_cb, env, SET_INT_IN_POINTER(i));
 		uiBlockBeginAlign(block);
 	}
@@ -648,7 +674,8 @@ void ANIM_uiTemplate_fmodifier_draw (uiLayout *layout, ID *id, ListBase *modifie
 		uiBlockSetEmboss(block, UI_EMBOSSN);
 		
 		/* delete button */
-		but= uiDefIconBut(block, BUT, B_REDR, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Delete F-Curve Modifier");
+		but = uiDefIconBut(block, BUT, B_REDR, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y,
+		                  NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete F-Curve Modifier"));
 		uiButSetFunc(but, delete_fmodifier_cb, modifiers, fcm);
 		
 		uiBlockSetEmboss(block, UI_EMBOSS);
@@ -709,14 +736,14 @@ void ANIM_uiTemplate_fmodifier_draw (uiLayout *layout, ID *id, ListBase *modifie
 				/* second row: settings */
 				row = uiLayoutRow(col, 1);
 				
-				uiItemR(row, &ptr, "frame_start", 0, "Start", ICON_NONE);
-				uiItemR(row, &ptr, "frame_end", 0, "End", ICON_NONE);
+				uiItemR(row, &ptr, "frame_start", 0, IFACE_("Start"), ICON_NONE);
+				uiItemR(row, &ptr, "frame_end", 0, IFACE_("End"), ICON_NONE);
 				
 				/* third row: blending influence */
 				row = uiLayoutRow(col, 1);
 				
-				uiItemR(row, &ptr, "blend_in", 0, "In", ICON_NONE);
-				uiItemR(row, &ptr, "blend_out", 0, "Out", ICON_NONE);
+				uiItemR(row, &ptr, "blend_in", 0, IFACE_("In"), ICON_NONE);
+				uiItemR(row, &ptr, "blend_out", 0, IFACE_("Out"), ICON_NONE);
 			}
 			
 			/* influence -------------------------------------------------------------- */
@@ -757,7 +784,7 @@ short ANIM_fmodifiers_copy_to_buf (ListBase *modifiers, short active)
 	short ok = 1;
 	
 	/* sanity checks */
-	if ELEM(NULL, modifiers, modifiers->first)
+	if (ELEM(NULL, modifiers, modifiers->first))
 		return 0;
 		
 	/* copy the whole list, or just the active one? */
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index c1e81cd..0e0ff0d 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -189,7 +189,7 @@ static void nupdate_ak_gpframe (void *node, void *data)
 /* Add the given BezTriple to the given 'list' of Keyframes */
 static void add_bezt_to_keycolumns_list(DLRBT_Tree *keys, BezTriple *bezt)
 {
-	if ELEM(NULL, keys, bezt) 
+	if (ELEM(NULL, keys, bezt))
 		return;
 	else
 		BLI_dlrbTree_add(keys, compare_ak_bezt, nalloc_ak_bezt, nupdate_ak_bezt, bezt);
@@ -198,7 +198,7 @@ static void add_bezt_to_keycolumns_list(DLRBT_Tree *keys, BezTriple *bezt)
 /* Add the given GPencil Frame to the given 'list' of Keyframes */
 static void add_gpframe_to_keycolumns_list(DLRBT_Tree *keys, bGPDframe *gpf)
 {
-	if ELEM(NULL, keys, gpf) 
+	if (ELEM(NULL, keys, gpf))
 		return;
 	else
 		BLI_dlrbTree_add(keys, compare_ak_gpframe, nalloc_ak_gpframe, nupdate_ak_gpframe, gpf);
@@ -269,8 +269,8 @@ static void nupdate_abk_bezt (void *node, void *data)
 	if (abk->numBezts >= MAX_ABK_BUFSIZE) {
 		// TODO: need to allocate new array to cater...
 		//bezts_extra= MEM_callocN(...);
-		if(G.f & G_DEBUG)
-			printf("FIXME: nupdate_abk_bezt() missing case for too many overlapping BezTriples \n");
+		if (G.debug & G_DEBUG)
+			printf("FIXME: nupdate_abk_bezt() missing case for too many overlapping BezTriples\n");
 	}
 	else {
 		/* just store an extra one */
@@ -374,7 +374,7 @@ static void add_bezt_to_keyblocks_list(DLRBT_Tree *blocks, DLRBT_Tree *beztTree,
 		ActKeyBlock *ab, *abn=NULL;
 		
 		/* try to find a keyblock that starts on the previous beztriple, and add a new one if none start there
-		 * Note: we can't search from end to try to optimise this as it causes errors there's
+		 * Note: we can't search from end to try to optimize this as it causes errors there's
 		 * 		an A ___ B |---| B situation
 		 */
 		// FIXME: here there is a bug where we are trying to get the summary for the following channels
@@ -499,7 +499,7 @@ void draw_keyframe_shape (float x, float y, float xscale, float hsize, short sel
 	static GLuint displist1=0;
 	static GLuint displist2=0;
 	
-	/* initialise 2 display lists for diamond shape - one empty, one filled */
+	/* initialize 2 display lists for diamond shape - one empty, one filled */
 	if (displist1 == 0) {
 		displist1= glGenLists(1);
 			glNewList(displist1, GL_COMPILE);
@@ -538,7 +538,7 @@ void draw_keyframe_shape (float x, float y, float xscale, float hsize, short sel
 	glEnable(GL_LINE_SMOOTH);
 	
 	/* draw! */
-	if ELEM(mode, KEYFRAME_SHAPE_INSIDE, KEYFRAME_SHAPE_BOTH) {
+	if (ELEM(mode, KEYFRAME_SHAPE_INSIDE, KEYFRAME_SHAPE_BOTH)) {
 		/* interior - hardcoded colors (for selected and unselected only) */
 		switch (key_type) {
 			case BEZT_KEYTYPE_BREAKDOWN: /* bluish frames for now */
@@ -574,7 +574,7 @@ void draw_keyframe_shape (float x, float y, float xscale, float hsize, short sel
 		glCallList(displist2);
 	}
 	
-	if ELEM(mode, KEYFRAME_SHAPE_FRAME, KEYFRAME_SHAPE_BOTH) {
+	if (ELEM(mode, KEYFRAME_SHAPE_FRAME, KEYFRAME_SHAPE_BOTH)) {
 		/* exterior - black frame */
 		glColor4f(0.0f, 0.0f, 0.0f, alpha);
 		
@@ -621,7 +621,7 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
 		float kalpha = (channelLocked)? 0.35f : 1.0f;
 		
 		for (ak= keys->first; ak; ak= ak->next) {
-			/* optimisation: if keyframe doesn't appear within 5 units (screenspace) in visible area, don't draw 
+			/* optimization: if keyframe doesn't appear within 5 units (screenspace) in visible area, don't draw 
 			 *	- this might give some improvements, since we current have to flip between view/region matrices
 			 */
 			if (IN_RANGE_INCL(ak->cfra, v2d->cur.xmin, v2d->cur.xmax) == 0)
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index af78fe7..4e59216 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -70,7 +70,7 @@
  * which take the data they operate on, a few callbacks defining what operations to perform.
  *
  * As operators which work on keyframes usually apply the same operation on all BezTriples in 
- * every channel, the code has been optimised providing a set of functions which will get the 
+ * every channel, the code has been optimized providing a set of functions which will get the 
  * appropriate bezier-modify function to set. These functions (ANIM_editkeyframes_*) will need
  * to be called before getting any channels.
  * 
@@ -136,8 +136,8 @@ short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, FCurve *fcu, KeyframeEdi
 				if (ked) ked->curIndex= i;
 				
 				/* Exit with return-code '1' if function returns positive
-				* This is useful if finding if some BezTriple satisfies a condition.
-				*/
+				 * This is useful if finding if some BezTriple satisfies a condition.
+				 */
 				if (key_cb(ked, bezt)) return 1;
 			}
 		}
@@ -751,7 +751,6 @@ KeyframeEditFunc ANIM_editkeyframes_mirror(short type)
 			return mirror_bezier_value;
 		default: /* just in case */
 			return mirror_bezier_yaxis;
-			break;
 	}
 }
 
@@ -761,11 +760,13 @@ KeyframeEditFunc ANIM_editkeyframes_mirror(short type)
 /* standard validation step for a few of these (implemented as macro for inlining without fn-call overhead):
  *	"if the handles are not of the same type, set them to type free"
  */
-#define ENSURE_HANDLES_MATCH(bezt) \
-		if (bezt->h1 != bezt->h2) { \
-			if ELEM3(bezt->h1, HD_ALIGN, HD_AUTO, HD_AUTO_ANIM) bezt->h1= HD_FREE; \
-			if ELEM3(bezt->h2, HD_ALIGN, HD_AUTO, HD_AUTO_ANIM) bezt->h2= HD_FREE; \
-		}
+#define ENSURE_HANDLES_MATCH(bezt)                                            \
+	if (bezt->h1 != bezt->h2) {                                               \
+		if (ELEM3(bezt->h1, HD_ALIGN, HD_AUTO, HD_AUTO_ANIM))                 \
+			bezt->h1= HD_FREE;                                                \
+		if (ELEM3(bezt->h2, HD_ALIGN, HD_AUTO, HD_AUTO_ANIM))                 \
+		bezt->h2= HD_FREE;                                                    \
+	}
 
 /* Sets the selected bezier handles to type 'auto' */
 static short set_bezier_auto(KeyframeEditData *UNUSED(ked), BezTriple *bezt) 
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c
index 732f84b..831b8d2 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -145,7 +145,7 @@ void duplicate_fcurve_keys(FCurve *fcu)
 	int i;
 	
 	/* this can only work when there is an F-Curve, and also when there are some BezTriples */
-	if ELEM(NULL, fcu, fcu->bezt)
+	if (ELEM(NULL, fcu, fcu->bezt))
 		return;
 	
 	for (i=0; i < fcu->totvert; i++) {
@@ -544,7 +544,7 @@ short copy_animedit_keys (bAnimContext *ac, ListBase *anim_data)
 				/* add to buffer */
 				newbuf= MEM_callocN(sizeof(BezTriple)*(aci->totvert+1), "copybuf beztriple");
 				
-				/* assume that since we are just resizing the array, just copy all existing data across */
+				/* assume that since we are just re-sizing the array, just copy all existing data across */
 				if (aci->bezt)
 					memcpy(newbuf, aci->bezt, sizeof(BezTriple)*(aci->totvert));
 				
@@ -574,7 +574,7 @@ short copy_animedit_keys (bAnimContext *ac, ListBase *anim_data)
 	if (ELEM(NULL, animcopybuf.first, animcopybuf.last))
 		return -1;
 
-	/* incase 'relative' paste method is used */
+	/* in case 'relative' paste method is used */
 	animcopy_cfra= CFRA;
 
 	/* everything went fine */
@@ -853,7 +853,7 @@ short paste_animedit_keys (bAnimContext *ac, ListBase *anim_data,
 				}
 			}
 			
-			/* dont continue if some fcurves were pasted */
+			/* don't continue if some fcurves were pasted */
 			if (totmatch)
 				break;
 		}
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 84206c4..47972ca 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -71,6 +71,7 @@
 #include "ED_screen.h"
 
 #include "UI_interface.h"
+#include "UI_resources.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
@@ -105,8 +106,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;
@@ -131,7 +131,7 @@ bAction *verify_adt_action (ID *id, short add)
 		adt= BKE_id_add_animdata(id);
 	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>");
+		printf("ERROR: Couldn't add AnimData (ID = %s)\n", (id) ? (id->name) : "<None>");
 		return NULL;
 	}
 		
@@ -156,7 +156,7 @@ FCurve *verify_fcurve (bAction *act, const char group[], const char rna_path[],
 	FCurve *fcu;
 	
 	/* sanity checks */
-	if ELEM(NULL, act, rna_path)
+	if (ELEM(NULL, act, rna_path))
 		return NULL;
 		
 	/* try to find f-curve matching for this setting 
@@ -317,9 +317,9 @@ int insert_vert_fcurve (FCurve *fcu, float x, float y, short flag)
 	/* use default interpolation mode, with exceptions for int/discrete values */
 	beztr.ipo= U.ipo_new;
 
-	if(fcu->flag & FCURVE_DISCRETE_VALUES)
+	if (fcu->flag & FCURVE_DISCRETE_VALUES)
 		beztr.ipo = BEZT_IPO_CONST;
-	else if(beztr.ipo == BEZT_IPO_BEZ && (fcu->flag & FCURVE_INT_VALUES))
+	else if (beztr.ipo == BEZT_IPO_BEZ && (fcu->flag & FCURVE_INT_VALUES))
 		beztr.ipo = BEZT_IPO_LIN;
 	
 	/* add temp beztriple to keyframes */
@@ -375,7 +375,7 @@ enum {
 
 /* This helper function determines whether a new keyframe is needed */
 /* Cases where keyframes should not be added:
- *	1. Keyframe to be added bewteen two keyframes with similar values
+ *	1. Keyframe to be added between two keyframes with similar values
  *	2. Keyframe to be added on frame where two keyframes are already situated
  *	3. Keyframe lies at point that intersects the linear line between two keyframes
  */
@@ -446,7 +446,7 @@ static short new_key_needed (FCurve *fcu, float cFrame, float nValue)
 		}
 		else {
 			/* just add a keyframe if there's only one keyframe 
-			 * and the new one occurs before the exisiting one does.
+			 * and the new one occurs before the existing one does.
 			 */
 			if ((cFrame < beztPosi) && (totCount==1))
 				return KEYNEEDED_JUSTADD;
@@ -573,7 +573,7 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
 		return 0;
 		
 	/* location or rotation identifiers only... */
-	if(identifier == NULL) {
+	if (identifier == NULL) {
 		printf("%s failed: NULL identifier\n", __func__);
 		return 0;
 	}
@@ -584,7 +584,7 @@ static short visualkey_can_use (PointerRNA *ptr, PropertyRNA *prop)
 		searchtype= VISUALKEY_ROT;
 	}
 	else {
-		printf("%s failed: identifier - '%s' \n", __func__, identifier);
+		printf("%s failed: identifier - '%s'\n", __func__, identifier);
 		return 0;
 	}
 	
@@ -755,7 +755,7 @@ static float visualkey_get_value (PointerRNA *ptr, PropertyRNA *prop, int array_
  * 	Use this when validation of necessary animation data is not necessary, since an RNA-pointer to the necessary
  *	data being keyframed, and a pointer to the F-Curve to use have both been provided.
  *
- *	The flag argument is used for special settings that alter the behaviour of
+ *	The flag argument is used for special settings that alter the behavior of
  *	the keyframe insertion. These include the 'visual' keyframing modes, quick refresh,
  *	and extra keyframe filtering.
  */
@@ -874,7 +874,7 @@ short insert_keyframe_direct (ReportList *reports, PointerRNA ptr, PropertyRNA *
 /* Main Keyframing API call:
  *	Use this when validation of necessary animation data is necessary, since it may not exist yet.
  *	
- *	The flag argument is used for special settings that alter the behaviour of
+ *	The flag argument is used for special settings that alter the behavior of
  *	the keyframe insertion. These include the 'visual' keyframing modes, quick refresh,
  *	and extra keyframe filtering.
  *
@@ -968,7 +968,7 @@ short insert_keyframe (ReportList *reports, ID *id, bAction *act, const char gro
  *	Use this when validation of necessary animation data isn't necessary as it
  *	already exists. It will delete a keyframe at the current frame.
  *	
- *	The flag argument is used for special settings that alter the behaviour of
+ *	The flag argument is used for special settings that alter the behavior of
  *	the keyframe deletion. These include the quick refresh options.
  */
 short delete_keyframe (ReportList *reports, ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short UNUSED(flag))
@@ -980,7 +980,7 @@ short delete_keyframe (ReportList *reports, ID *id, bAction *act, const char gro
 	int ret= 0;
 	
 	/* sanity checks */
-	if ELEM(NULL, id, adt) {
+	if (ELEM(NULL, id, adt)) {
 		BKE_report(reports, RPT_ERROR, "No ID-Block and/Or AnimData to delete keyframe from");
 		return 0;
 	}
@@ -1007,7 +1007,7 @@ short delete_keyframe (ReportList *reports, ID *id, bAction *act, const char gro
 			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\n", id->name);
 			return 0;
 		}
 	}
@@ -1036,8 +1036,8 @@ short delete_keyframe (ReportList *reports, ID *id, bAction *act, const char gro
 			continue;
 			
 		if ( (fcu->flag & FCURVE_PROTECTED) || ((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)) ) {
-			if (G.f & G_DEBUG)
-				printf("WARNING: not deleting keyframe for locked F-Curve \n");
+			if (G.debug & G_DEBUG)
+				printf("WARNING: not deleting keyframe for locked F-Curve\n");
 			continue;
 		}
 		
@@ -1116,7 +1116,7 @@ static int insert_key_exec (bContext *C, wmOperator *op)
 	if (type == 0) 
 		type= scene->active_keyingset;
 	if (type > 0)
-		ks= BLI_findlink(&scene->keyingsets, scene->active_keyingset-1);
+		ks= BLI_findlink(&scene->keyingsets, type-1);
 	else
 		ks= BLI_findlink(&builtin_keyingsets, -type-1);
 		
@@ -1128,8 +1128,8 @@ static int insert_key_exec (bContext *C, wmOperator *op)
 	
 	/* try to insert keyframes for the channels specified by KeyingSet */
 	success= ANIM_apply_keyingset(C, NULL, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
-	if (G.f & G_DEBUG)
-		BKE_reportf(op->reports, RPT_INFO, "KeyingSet '%s' - Successfully added %d Keyframes \n", ks->name, success);
+	if (G.debug & G_DEBUG)
+		BKE_reportf(op->reports, RPT_INFO, "KeyingSet '%s' - Successfully added %d Keyframes\n", ks->name, success);
 	
 	/* report failure or do updates? */
 	if (success == MODIFYKEY_INVALID_CONTEXT) {
@@ -1158,27 +1158,28 @@ void ANIM_OT_keyframe_insert (wmOperatorType *ot)
 	PropertyRNA *prop;
 	
 	/* identifiers */
-	ot->name= "Insert Keyframe";
-	ot->idname= "ANIM_OT_keyframe_insert";
-	ot->description= "Insert keyframes on the current frame for all properties in the specified Keying Set";
+	ot->name = "Insert Keyframe";
+	ot->idname = "ANIM_OT_keyframe_insert";
+	ot->description = "Insert keyframes on the current frame for all properties in the specified Keying Set";
 	
 	/* callbacks */
-	ot->exec= insert_key_exec; 
-	ot->poll= modify_key_op_poll;
+	ot->exec = insert_key_exec; 
+	ot->poll = modify_key_op_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* keyingset to use (dynamic enum) */
 	prop= RNA_def_enum(ot->srna, "type", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
 	RNA_def_enum_funcs(prop, ANIM_keying_sets_enum_itemf);
 	RNA_def_property_flag(prop, PROP_HIDDEN);
-	ot->prop= prop;
+	ot->prop = prop;
 	
 	/* confirm whether a keyframe was added by showing a popup 
 	 *	- by default, this is enabled, since this operator is assumed to be called independently
 	 */
-	prop= RNA_def_boolean(ot->srna, "confirm_success", 1, "Confirm Successful Insert", "Show a popup when the keyframes get successfully added");
+	prop= RNA_def_boolean(ot->srna, "confirm_success", 1, "Confirm Successful Insert",
+	                      "Show a popup when the keyframes get successfully added");
 	RNA_def_property_flag(prop, PROP_HIDDEN);
 }
 
@@ -1193,8 +1194,15 @@ static int insert_key_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(
 	
 	/* if prompting or no active Keying Set, show the menu */
 	if ((scene->active_keyingset == 0) || RNA_boolean_get(op->ptr, "always_prompt")) {
-		/* call the menu, which will call this operator again, hence the cancelled */
-		ANIM_keying_sets_menu_setup(C, op->type->name, "ANIM_OT_keyframe_insert_menu");
+		uiPopupMenu *pup;
+		uiLayout *layout;
+		
+		/* call the menu, which will call this operator again, hence the canceled */
+		pup = uiPupMenuBegin(C, op->type->name, ICON_NONE);
+		layout = uiPupMenuLayout(pup);
+		uiItemsEnumO(layout, "ANIM_OT_keyframe_insert_menu", "type");
+		uiPupMenuEnd(C, pup);
+		
 		return OPERATOR_CANCELLED;
 	}
 	else {
@@ -1211,34 +1219,35 @@ void ANIM_OT_keyframe_insert_menu (wmOperatorType *ot)
 	PropertyRNA *prop;
 	
 	/* identifiers */
-	ot->name= "Insert Keyframe Menu";
-	ot->idname= "ANIM_OT_keyframe_insert_menu";
-	ot->description= "Insert Keyframes for specified Keying Set, with menu of available Keying Sets if undefined";
+	ot->name = "Insert Keyframe Menu";
+	ot->idname = "ANIM_OT_keyframe_insert_menu";
+	ot->description = "Insert Keyframes for specified Keying Set, with menu of available Keying Sets if undefined";
 	
 	/* callbacks */
-	ot->invoke= insert_key_menu_invoke;
-	ot->exec= insert_key_exec; 
-	ot->poll= ED_operator_areaactive;
+	ot->invoke = insert_key_menu_invoke;
+	ot->exec = insert_key_exec; 
+	ot->poll = ED_operator_areaactive;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* keyingset to use (dynamic enum) */
 	prop= RNA_def_enum(ot->srna, "type", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
 	RNA_def_enum_funcs(prop, ANIM_keying_sets_enum_itemf);
 	RNA_def_property_flag(prop, PROP_HIDDEN);
-	ot->prop= prop;
+	ot->prop = prop;
 	
 	/* confirm whether a keyframe was added by showing a popup 
 	 *	- by default, this is disabled so that if a menu is shown, this doesn't come up too
 	 */
 	// XXX should this just be always on?
-	prop= RNA_def_boolean(ot->srna, "confirm_success", 0, "Confirm Successful Insert", "Show a popup when the keyframes get successfully added");
+	prop= RNA_def_boolean(ot->srna, "confirm_success", 0, "Confirm Successful Insert",
+	                      "Show a popup when the keyframes get successfully added");
 	RNA_def_property_flag(prop, PROP_HIDDEN);
 	
 	/* whether the menu should always be shown 
-	 *	- by default, the menu should only be shown when there is no active Keying Set (2.5 behaviour),
-	 *	  although in some cases it might be useful to always shown (pre 2.5 behaviour)
+	 *	- by default, the menu should only be shown when there is no active Keying Set (2.5 behavior),
+	 *	  although in some cases it might be useful to always shown (pre 2.5 behavior)
 	 */
 	prop= RNA_def_boolean(ot->srna, "always_prompt", 0, "Always Show Menu", "");
 	RNA_def_property_flag(prop, PROP_HIDDEN);
@@ -1263,7 +1272,7 @@ static int delete_key_exec (bContext *C, wmOperator *op)
 	if (type == 0) 
 		type= scene->active_keyingset;
 	if (type > 0)
-		ks= BLI_findlink(&scene->keyingsets, scene->active_keyingset-1);
+		ks= BLI_findlink(&scene->keyingsets, type-1);
 	else
 		ks= BLI_findlink(&builtin_keyingsets, -type-1);
 	
@@ -1273,10 +1282,10 @@ static int delete_key_exec (bContext *C, wmOperator *op)
 		return OPERATOR_CANCELLED;
 	}
 	
-	/* try to insert keyframes for the channels specified by KeyingSet */
+	/* try to delete keyframes for the channels specified by KeyingSet */
 	success= ANIM_apply_keyingset(C, NULL, NULL, ks, MODIFYKEY_MODE_DELETE, cfra);
-	if (G.f & G_DEBUG)
-		printf("KeyingSet '%s' - Successfully removed %d Keyframes \n", ks->name, success);
+	if (G.debug & G_DEBUG)
+		printf("KeyingSet '%s' - Successfully removed %d Keyframes\n", ks->name, success);
 	
 	/* report failure or do updates? */
 	if (success == MODIFYKEY_INVALID_CONTEXT) {
@@ -1305,27 +1314,28 @@ void ANIM_OT_keyframe_delete (wmOperatorType *ot)
 	PropertyRNA *prop;
 	
 	/* identifiers */
-	ot->name= "Delete Keying-Set Keyframe";
-	ot->idname= "ANIM_OT_keyframe_delete";
-	ot->description= "Delete keyframes on the current frame for all properties in the specified Keying Set";
+	ot->name = "Delete Keying-Set Keyframe";
+	ot->idname = "ANIM_OT_keyframe_delete";
+	ot->description = "Delete keyframes on the current frame for all properties in the specified Keying Set";
 	
 	/* callbacks */
-	ot->exec= delete_key_exec; 
-	ot->poll= modify_key_op_poll;
+	ot->exec = delete_key_exec; 
+	ot->poll = modify_key_op_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* keyingset to use (dynamic enum) */
 	prop= RNA_def_enum(ot->srna, "type", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
 	RNA_def_enum_funcs(prop, ANIM_keying_sets_enum_itemf);
 	RNA_def_property_flag(prop, PROP_HIDDEN);
-	ot->prop= prop;
+	ot->prop = prop;
 	
 	/* confirm whether a keyframe was added by showing a popup 
 	 *	- by default, this is enabled, since this operator is assumed to be called independently
 	 */
-	RNA_def_boolean(ot->srna, "confirm_success", 1, "Confirm Successful Insert", "Show a popup when the keyframes get successfully added");
+	RNA_def_boolean(ot->srna, "confirm_success", 1, "Confirm Successful Delete",
+	                "Show a popup when the keyframes get successfully removed");
 }
 
 /* Delete Key Operator ------------------------ */
@@ -1377,18 +1387,18 @@ static int delete_key_v3d_exec (bContext *C, wmOperator *op)
 void ANIM_OT_keyframe_delete_v3d (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete Keyframe";
-	ot->description= "Remove keyframes on current frame for selected object";
-	ot->idname= "ANIM_OT_keyframe_delete_v3d";
+	ot->name = "Delete Keyframe";
+	ot->description = "Remove keyframes on current frame for selected object";
+	ot->idname = "ANIM_OT_keyframe_delete_v3d";
 	
 	/* callbacks */
-	ot->invoke= WM_operator_confirm;
-	ot->exec= delete_key_v3d_exec; 
+	ot->invoke = WM_operator_confirm;
+	ot->exec = delete_key_v3d_exec; 
 	
-	ot->poll= ED_operator_areaactive;
+	ot->poll = ED_operator_areaactive;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 
@@ -1419,7 +1429,7 @@ static int insert_key_button_exec (bContext *C, wmOperator *op)
 			if (all) {
 				length= RNA_property_array_length(&ptr, prop);
 				
-				if(length) index= 0;
+				if (length) index= 0;
 				else length= 1;
 			}
 			else
@@ -1438,17 +1448,17 @@ static int insert_key_button_exec (bContext *C, wmOperator *op)
 			success+= insert_keyframe_direct(op->reports, ptr, prop, fcu, cfra, 0);
 		}
 		else {
-			if (G.f & G_DEBUG)
-				printf("Button Insert-Key: no path to property \n");
+			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");
 		}
 	}
-	else if (G.f & G_DEBUG) {
+	else if (G.debug & G_DEBUG) {
 		printf("ptr.data = %p, prop = %p,", (void *)ptr.data, (void *)prop);
 		if (prop)
-			printf("animateable = %d \n", RNA_property_animateable(&ptr, prop));
+			printf("animatable = %d\n", RNA_property_animateable(&ptr, prop));
 		else
-			printf("animateable = NULL \n");
+			printf("animatable = NULL\n");
 	}
 	
 	if (success) {
@@ -1467,15 +1477,15 @@ static int insert_key_button_exec (bContext *C, wmOperator *op)
 void ANIM_OT_keyframe_insert_button (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Insert Keyframe (Buttons)";
-	ot->idname= "ANIM_OT_keyframe_insert_button";
+	ot->name = "Insert Keyframe (Buttons)";
+	ot->idname = "ANIM_OT_keyframe_insert_button";
 	
 	/* callbacks */
-	ot->exec= insert_key_button_exec; 
-	ot->poll= modify_key_op_poll;
+	ot->exec = insert_key_button_exec; 
+	ot->poll = modify_key_op_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_UNDO;
+	ot->flag = OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "all", 1, "All", "Insert a keyframe for all element of the array");
@@ -1515,11 +1525,11 @@ static int delete_key_button_exec (bContext *C, wmOperator *op)
 			
 			MEM_freeN(path);
 		}
-		else if (G.f & G_DEBUG)
-			printf("Button Delete-Key: no path to property \n");
+		else if (G.debug & G_DEBUG)
+			printf("Button Delete-Key: no path to property\n");
 	}
-	else if (G.f & G_DEBUG) {
-		printf("ptr.data = %p, prop = %p \n", (void *)ptr.data, (void *)prop);
+	else if (G.debug & G_DEBUG) {
+		printf("ptr.data = %p, prop = %p\n", (void *)ptr.data, (void *)prop);
 	}
 	
 	
@@ -1539,15 +1549,15 @@ static int delete_key_button_exec (bContext *C, wmOperator *op)
 void ANIM_OT_keyframe_delete_button (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete Keyframe (Buttons)";
-	ot->idname= "ANIM_OT_keyframe_delete_button";
+	ot->name = "Delete Keyframe (Buttons)";
+	ot->idname = "ANIM_OT_keyframe_delete_button";
 	
 	/* callbacks */
-	ot->exec= delete_key_button_exec; 
-	ot->poll= modify_key_op_poll;
+	ot->exec = delete_key_button_exec; 
+	ot->poll = modify_key_op_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_UNDO;
+	ot->flag = OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "all", 1, "All", "Delete keyfames from all elements of the array");
@@ -1708,7 +1718,7 @@ short id_frame_has_keyframe (ID *id, float frame, short filter)
 			break;
 			
 		case ID_SCE: /* scene */
-		// XXX TODO... for now, just use 'normal' behaviour
+		// XXX TODO... for now, just use 'normal' behavior
 		//	break;
 		
 		default: 	/* 'normal type' */
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index 2543226..f66aa31 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -127,7 +127,7 @@ static int add_default_keyingset_exec (bContext *C, wmOperator *UNUSED(op))
 	keyingflag = ANIM_get_keyframing_flags(scene, 0);
 	
 	/* call the API func, and set the active keyingset index */
-	BKE_keyingset_add(&scene->keyingsets, NULL, flag, keyingflag);
+	BKE_keyingset_add(&scene->keyingsets, NULL, NULL, flag, keyingflag);
 	
 	scene->active_keyingset= BLI_countlist(&scene->keyingsets);
 	
@@ -140,13 +140,13 @@ static int add_default_keyingset_exec (bContext *C, wmOperator *UNUSED(op))
 void ANIM_OT_keying_set_add (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Empty Keying Set";
-	ot->idname= "ANIM_OT_keying_set_add";
-	ot->description= "Add a new (empty) Keying Set to the active Scene";
+	ot->name = "Add Empty Keying Set";
+	ot->idname = "ANIM_OT_keying_set_add";
+	ot->description = "Add a new (empty) Keying Set to the active Scene";
 	
 	/* callbacks */
-	ot->exec= add_default_keyingset_exec;
-	ot->poll= keyingset_poll_default_add;
+	ot->exec = add_default_keyingset_exec;
+	ot->poll = keyingset_poll_default_add;
 }
 
 /* Remove 'Active' Keying Set ------------------------- */
@@ -187,13 +187,13 @@ static int remove_active_keyingset_exec (bContext *C, wmOperator *op)
 void ANIM_OT_keying_set_remove (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Removed Active Keying Set";
-	ot->idname= "ANIM_OT_keying_set_remove";
-	ot->description= "Remove the active Keying Set";
+	ot->name = "Remove Active Keying Set";
+	ot->idname = "ANIM_OT_keying_set_remove";
+	ot->description = "Remove the active Keying Set";
 	
 	/* callbacks */
-	ot->exec= remove_active_keyingset_exec;
-	ot->poll= keyingset_poll_active_edit;
+	ot->exec = remove_active_keyingset_exec;
+	ot->poll = keyingset_poll_active_edit;
 }
 
 /* Add Empty Keying Set Path ------------------------- */
@@ -230,13 +230,13 @@ static int add_empty_ks_path_exec (bContext *C, wmOperator *op)
 void ANIM_OT_keying_set_path_add (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Empty Keying Set Path";
-	ot->idname= "ANIM_OT_keying_set_path_add";
-	ot->description= "Add empty path to active Keying Set";
+	ot->name = "Add Empty Keying Set Path";
+	ot->idname = "ANIM_OT_keying_set_path_add";
+	ot->description = "Add empty path to active Keying Set";
 	
 	/* callbacks */
-	ot->exec= add_empty_ks_path_exec;
-	ot->poll= keyingset_poll_active_edit;
+	ot->exec = add_empty_ks_path_exec;
+	ot->poll = keyingset_poll_active_edit;
 }
 
 /* Remove Active Keying Set Path ------------------------- */
@@ -273,13 +273,13 @@ static int remove_active_ks_path_exec (bContext *C, wmOperator *op)
 void ANIM_OT_keying_set_path_remove (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove Active Keying Set Path";
-	ot->idname= "ANIM_OT_keying_set_path_remove";
-	ot->description= "Remove active Path from active Keying Set";
+	ot->name = "Remove Active Keying Set Path";
+	ot->idname = "ANIM_OT_keying_set_path_remove";
+	ot->description = "Remove active Path from active Keying Set";
 	
 	/* callbacks */
-	ot->exec= remove_active_ks_path_exec;
-	ot->poll= keyingset_poll_activePath_edit;
+	ot->exec = remove_active_ks_path_exec;
+	ot->poll = keyingset_poll_activePath_edit;
 }
 
 /* ************************************************** */
@@ -317,7 +317,7 @@ static int add_keyingset_button_exec (bContext *C, wmOperator *op)
 			keyingflag |= INSERTKEY_XYZ2RGB;
 			
 		/* call the API func, and set the active keyingset index */
-		ks= BKE_keyingset_add(&scene->keyingsets, "ButtonKeyingSet", flag, keyingflag);
+		ks= BKE_keyingset_add(&scene->keyingsets, "ButtonKeyingSet", "Button Keying Set", flag, keyingflag);
 		
 		scene->active_keyingset= BLI_countlist(&scene->keyingsets);
 	}
@@ -371,15 +371,15 @@ static int add_keyingset_button_exec (bContext *C, wmOperator *op)
 void ANIM_OT_keyingset_button_add (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add to Keying Set";
-	ot->idname= "ANIM_OT_keyingset_button_add";
+	ot->name = "Add to Keying Set";
+	ot->idname = "ANIM_OT_keyingset_button_add";
 	
 	/* callbacks */
-	ot->exec= add_keyingset_button_exec; 
+	ot->exec = add_keyingset_button_exec; 
 	//op->poll= ???
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "all", 1, "All", "Add all elements of the array to a Keying Set");
@@ -450,15 +450,15 @@ static int remove_keyingset_button_exec (bContext *C, wmOperator *op)
 void ANIM_OT_keyingset_button_remove (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove from Keying Set";
-	ot->idname= "ANIM_OT_keyingset_button_remove";
+	ot->name = "Remove from Keying Set";
+	ot->idname = "ANIM_OT_keyingset_button_remove";
 	
 	/* callbacks */
-	ot->exec= remove_keyingset_button_exec; 
+	ot->exec = remove_keyingset_button_exec; 
 	//op->poll= ???
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ******************************************* */
@@ -468,22 +468,26 @@ void ANIM_OT_keyingset_button_remove (wmOperatorType *ot)
 
 static int keyingset_active_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	/* call the menu, which will call this operator again, hence the cancelled */
-	ANIM_keying_sets_menu_setup(C, op->type->name, "ANIM_OT_keying_set_active_set");
+	uiPopupMenu *pup;
+	uiLayout *layout;
+	
+	/* call the menu, which will call this operator again, hence the canceled */
+	pup = uiPupMenuBegin(C, op->type->name, ICON_NONE);
+	layout = uiPupMenuLayout(pup);
+	uiItemsEnumO(layout, "ANIM_OT_keying_set_active_set", "type");
+	uiPupMenuEnd(C, pup);
+	
 	return OPERATOR_CANCELLED;
 }
 
 static int keyingset_active_menu_exec (bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	int type= RNA_int_get(op->ptr, "type");
+	Scene *scene = CTX_data_scene(C);
+	int type = RNA_enum_get(op->ptr, "type");
+	
+	/* If type == 0, it will deselect any active keying set. */
+	scene->active_keyingset = type;
 	
-	/* simply set the scene's active keying set index, unless the type == 0 
-	 * (i.e. which happens if we want the current active to be maintained) 
-	 */
-	if (type)
-		scene->active_keyingset= type;
-		
 	/* send notifiers */
 	WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, NULL);
 	
@@ -492,22 +496,24 @@ static int keyingset_active_menu_exec (bContext *C, wmOperator *op)
  
 void ANIM_OT_keying_set_active_set (wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+	
 	/* identifiers */
-	ot->name= "Set Active Keying Set";
-	ot->idname= "ANIM_OT_keying_set_active_set";
+	ot->name = "Set Active Keying Set";
+	ot->idname = "ANIM_OT_keying_set_active_set";
 	
 	/* callbacks */
-	ot->invoke= keyingset_active_menu_invoke;
-	ot->exec= keyingset_active_menu_exec; 
-	ot->poll= ED_operator_areaactive;
+	ot->invoke = keyingset_active_menu_invoke;
+	ot->exec = keyingset_active_menu_exec; 
+	ot->poll = ED_operator_areaactive;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
-	/* keyingset to use
-	 *	- here the type is int not enum, since many of the indices here are determined dynamically
-	 */
-	RNA_def_int(ot->srna, "type", 0, INT_MIN, INT_MAX, "Keying Set Number", "Index (determined internally) of the Keying Set to use", 0, 1);
+	/* keyingset to use (dynamic enum) */
+	prop= RNA_def_enum(ot->srna, "type", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
+	RNA_def_enum_funcs(prop, ANIM_keying_sets_enum_itemf);
+/*	RNA_def_property_flag(prop, PROP_HIDDEN);*/
 }
 
 /* ******************************************* */
@@ -546,10 +552,10 @@ KeyingSet *ANIM_builtin_keyingset_get_named (KeyingSet *prevKS, const char name[
 		first= prevKS->next;
 	else
 		first= builtin_keyingsets.first;
-		
+	
 	/* loop over KeyingSets checking names */
 	for (ks= first; ks; ks= ks->next) {
-		if (strcmp(name, ks->name) == 0)
+		if (strcmp(name, ks->idname) == 0)
 			return ks;
 	}
 
@@ -572,11 +578,14 @@ void ANIM_keyingset_info_register (KeyingSetInfo *ksi)
 	/* create a new KeyingSet 
 	 *	- inherit name and keyframing settings from the typeinfo
 	 */
-	ks = BKE_keyingset_add(&builtin_keyingsets, ksi->name, 1, ksi->keyingflag);
+	ks = BKE_keyingset_add(&builtin_keyingsets, ksi->idname, ksi->name, 1, ksi->keyingflag);
 	
 	/* link this KeyingSet with its typeinfo */
 	memcpy(&ks->typeinfo, ksi->idname, sizeof(ks->typeinfo));
 	
+	/* Copy description... */
+	BLI_strncpy(ks->description, ksi->description, sizeof(ks->description));
+	
 	/* add type-info to the list */
 	BLI_addtail(&keyingset_type_infos, ksi);
 }
@@ -598,7 +607,7 @@ void ANIM_keyingset_info_unregister (Main *bmain, KeyingSetInfo *ksi)
 			BKE_keyingset_free(ks);
 			BLI_remlink(&builtin_keyingsets, ks);
 
-			for(scene= bmain->scene.first; scene; scene= scene->id.next)
+			for (scene= bmain->scene.first; scene; scene= scene->id.next)
 				BLI_remlink_safe(&scene->keyingsets, ks);
 
 			MEM_freeN(ks);
@@ -717,23 +726,26 @@ EnumPropertyItem *ANIM_keying_sets_enum_itemf (bContext *C, PointerRNA *UNUSED(p
 	 */
 	if (scene->active_keyingset) {
 		/* active Keying Set */
-		item_tmp.identifier= item_tmp.name= "Active Keying Set";
-		item_tmp.value= i++;
+		item_tmp.identifier= "__ACTIVE__";
+		item_tmp.name= "Active Keying Set";
+		item_tmp.value= i;
 		RNA_enum_item_add(&item, &totitem, &item_tmp);
 		
 		/* separator */
 		RNA_enum_item_add_separator(&item, &totitem);
 	}
-	else
-		i++;
-		
+	
+	i++;
+	
 	/* user-defined Keying Sets 
 	 *	- these are listed in the order in which they were defined for the active scene
 	 */
 	if (scene->keyingsets.first) {
 		for (ks= scene->keyingsets.first; ks; ks= ks->next, i++) {
 			if (ANIM_keyingset_context_ok_poll(C, ks)) {
-				item_tmp.identifier= item_tmp.name= ks->name;
+				item_tmp.identifier = ks->idname;
+				item_tmp.name = ks->name;
+				item_tmp.description = ks->description;
 				item_tmp.value= i;
 				RNA_enum_item_add(&item, &totitem, &item_tmp);
 			}
@@ -748,7 +760,9 @@ EnumPropertyItem *ANIM_keying_sets_enum_itemf (bContext *C, PointerRNA *UNUSED(p
 	for (ks= builtin_keyingsets.first; ks; ks= ks->next, i--) {
 		/* only show KeyingSet if context is suitable */
 		if (ANIM_keyingset_context_ok_poll(C, ks)) {
-			item_tmp.identifier= item_tmp.name= ks->name;
+			item_tmp.identifier = ks->idname;
+			item_tmp.name = ks->name;
+			item_tmp.description = ks->description;
 			item_tmp.value= i;
 			RNA_enum_item_add(&item, &totitem, &item_tmp);
 		}
@@ -760,50 +774,6 @@ EnumPropertyItem *ANIM_keying_sets_enum_itemf (bContext *C, PointerRNA *UNUSED(p
 	return item;
 }
 
-/* Create (and show) a menu containing all the Keying Sets which can be used in the current context */
-void ANIM_keying_sets_menu_setup (bContext *C, const char title[], const char op_name[])
-{
-	Scene *scene= CTX_data_scene(C);
-	KeyingSet *ks;
-	uiPopupMenu *pup;
-	uiLayout *layout;
-	int i = 0;
-	
-	pup= uiPupMenuBegin(C, title, ICON_NONE);
-	layout= uiPupMenuLayout(pup);
-	
-	/* active Keying Set 
-	 *	- only include entry if it exists
-	 */
-	if (scene->active_keyingset) {
-		uiItemEnumO(layout, op_name, "Active Keying Set", ICON_NONE, "type", i++);
-		uiItemS(layout);
-	}
-	else
-		i++;
-	
-	/* user-defined Keying Sets 
-	 *	- these are listed in the order in which they were defined for the active scene
-	 */
-	if (scene->keyingsets.first) {
-		for (ks= scene->keyingsets.first; ks; ks=ks->next, i++) {
-			if (ANIM_keyingset_context_ok_poll(C, ks))
-				uiItemEnumO(layout, op_name, ks->name, ICON_NONE, "type", i);
-		}
-		uiItemS(layout);
-	}
-	
-	/* builtin Keying Sets */
-	i= -1;
-	for (ks= builtin_keyingsets.first; ks; ks=ks->next, i--) {
-		/* only show KeyingSet if context is suitable */
-		if (ANIM_keyingset_context_ok_poll(C, ks))
-			uiItemEnumO(layout, op_name, ks->name, ICON_NONE, "type", i);
-	}
-	
-	uiPupMenuEnd(C, pup);
-} 
-
 /* ******************************************* */
 /* KEYFRAME MODIFICATION */
 
@@ -839,7 +809,7 @@ typedef struct tRKS_DSource {
 } tRKS_DSource;
 
 
-/* Iterator used for overriding the behaviour of iterators defined for 
+/* Iterator used for overriding the behavior of iterators defined for 
  * relative Keying Sets, with the main usage of this being operators 
  * requiring Auto Keyframing. Internal Use Only!
  */
diff --git a/source/blender/editors/armature/BIF_generate.h b/source/blender/editors/armature/BIF_generate.h
index 311b110..1d8ee8e 100644
--- a/source/blender/editors/armature/BIF_generate.h
+++ b/source/blender/editors/armature/BIF_generate.h
@@ -23,8 +23,8 @@
  */
 
  
-#ifndef BIF_GENERATE_H
-#define BIF_GENERATE_H
+#ifndef __BIF_GENERATE_H__
+#define __BIF_GENERATE_H__
 
 struct ToolSettings;
 struct EditBone;
@@ -45,4 +45,4 @@ struct EditBone * subdivideArcBy(struct ToolSettings *toolsettings, struct bArma
 void setBoneRollFromNormal(struct EditBone *bone, float *no, float invmat[][4], float tmat[][3]);
  
 
-#endif /* BIF_GENERATE_H */
+#endif /* __BIF_GENERATE_H__ */
diff --git a/source/blender/editors/armature/BIF_retarget.h b/source/blender/editors/armature/BIF_retarget.h
index ad3d355..c878b0c 100644
--- a/source/blender/editors/armature/BIF_retarget.h
+++ b/source/blender/editors/armature/BIF_retarget.h
@@ -23,8 +23,8 @@
  */
 
 
-#ifndef BIF_RETARGET_H
-#define BIF_RETARGET_H
+#ifndef __BIF_RETARGET_H__
+#define __BIF_RETARGET_H__
 
 #include "DNA_listBase.h"
 
@@ -168,4 +168,4 @@ void RIG_printArc(struct RigGraph *rg, struct RigArc *arc);
 void RIG_printGraph(struct RigGraph *rg);
 void RIG_printArcBones(struct RigArc *arc);
 
-#endif /* BIF_RETARGET_H */
+#endif /* __BIF_RETARGET_H__ */
diff --git a/source/blender/editors/armature/CMakeLists.txt b/source/blender/editors/armature/CMakeLists.txt
index 8c1243e..2bd9956 100644
--- a/source/blender/editors/armature/CMakeLists.txt
+++ b/source/blender/editors/armature/CMakeLists.txt
@@ -55,4 +55,8 @@ set(SRC
 	reeb.h
 )
 
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
 blender_add_lib(bf_editor_armature "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/armature/SConscript b/source/blender/editors/armature/SConscript
index ded82b3..ba375f3 100644
--- a/source/blender/editors/armature/SConscript
+++ b/source/blender/editors/armature/SConscript
@@ -5,13 +5,19 @@ sources = env.Glob('*.c')
 
 incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../imbuf ../../blenloader'
 incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
+incs += ' ../../render/extern/include ../../bmesh'
 incs += ' ../../gpu ../../makesrna #/intern/opennl/extern'
 
+defs = []
+
 if env['OURPLATFORM'] == 'linux':
     cflags='-pthread'
     incs += ' ../../../extern/binreloc/include'
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
 
-env.BlenderLib ( 'bf_editors_armature', sources, Split(incs), [], libtype=['core'], priority=[44] )
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
+
+env.BlenderLib ( 'bf_editors_armature', sources, Split(incs), defs, libtype=['core'], priority=[44] )
diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h
index 40d9093..13239f8 100644
--- a/source/blender/editors/armature/armature_intern.h
+++ b/source/blender/editors/armature/armature_intern.h
@@ -28,8 +28,8 @@
  *  \ingroup edarmature
  */
 
-#ifndef ED_ARMATURE_INTERN_H
-#define ED_ARMATURE_INTERN_H
+#ifndef __ARMATURE_INTERN_H__
+#define __ARMATURE_INTERN_H__
 
 /* internal exports only */
 struct wmOperatorType;
@@ -219,5 +219,5 @@ struct EditBone *duplicateEditBoneObjects(struct EditBone *curBone, const char *
 /* editbones is the source list */
 void updateDuplicateSubtargetObjects(struct EditBone *dupBone, struct ListBase *editbones, struct Object *src_ob, struct Object *dst_ob);
 
-#endif /* ED_ARMATURE_INTERN_H */
+#endif /* __ARMATURE_INTERN_H__ */
 
diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c
index 7379a27..21b9718 100644
--- a/source/blender/editors/armature/armature_ops.c
+++ b/source/blender/editors/armature/armature_ops.c
@@ -170,31 +170,31 @@ void ED_operatormacros_armature(void)
 	wmOperatorType *ot;
 	wmOperatorTypeMacro *otmacro;
 	
-	ot= WM_operatortype_append_macro("ARMATURE_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
-	if(ot) {
-		ot->description= "Make copies of the selected bones within the same armature and move them";
+	ot = WM_operatortype_append_macro("ARMATURE_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
+	if (ot) {
+		ot->description = "Make copies of the selected bones within the same armature and move them";
 		WM_operatortype_macro_define(ot, "ARMATURE_OT_duplicate");
-		otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+		otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
 		RNA_enum_set(otmacro->ptr, "proportional", 0);
 	}
 
-	ot= WM_operatortype_append_macro("ARMATURE_OT_extrude_move", "Extrude", OPTYPE_UNDO|OPTYPE_REGISTER);
-	if(ot) {
-		ot->description= "Create new bones from the selected joints and move them";
+	ot = WM_operatortype_append_macro("ARMATURE_OT_extrude_move", "Extrude", OPTYPE_UNDO|OPTYPE_REGISTER);
+	if (ot) {
+		ot->description = "Create new bones from the selected joints and move them";
 		otmacro=WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude");
 		RNA_boolean_set(otmacro->ptr, "forked", FALSE);
-		otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+		otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
 		RNA_enum_set(otmacro->ptr, "proportional", 0);
 	}
 	
 	// XXX would it be nicer to just be able to have standard extrude_move, but set the forked property separate?
 	// that would require fixing a properties bug 19733
-	ot= WM_operatortype_append_macro("ARMATURE_OT_extrude_forked", "Extrude Forked", OPTYPE_UNDO|OPTYPE_REGISTER);
-	if(ot) {
-		ot->description= "Create new bones from the selected joints and move them";
+	ot = WM_operatortype_append_macro("ARMATURE_OT_extrude_forked", "Extrude Forked", OPTYPE_UNDO|OPTYPE_REGISTER);
+	if (ot) {
+		ot->description = "Create new bones from the selected joints and move them";
 		otmacro=WM_operatortype_macro_define(ot, "ARMATURE_OT_extrude");
 		RNA_boolean_set(otmacro->ptr, "forked", TRUE);
-		otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+		otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
 		RNA_enum_set(otmacro->ptr, "proportional", 0);
 	}
 }
@@ -205,8 +205,8 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
 	wmKeyMapItem *kmi;
 	
 	/* Armature ------------------------ */
-	keymap= WM_keymap_find(keyconf, "Armature", 0, 0);
-	keymap->poll= ED_operator_editarmature;
+	keymap = WM_keymap_find(keyconf, "Armature", 0, 0);
+	keymap->poll = ED_operator_editarmature;
 	
 	/* Armature -> Etch-A-Ton ------------------------ */
 	WM_keymap_add_item(keymap, "SKETCH_OT_delete", XKEY, KM_PRESS, 0, 0);
@@ -228,7 +228,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
 	/* only set in editmode armature, by space_view3d listener */
 	kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_hide", HKEY, KM_PRESS, 0, 0);
 	RNA_boolean_set(kmi->ptr, "unselected", FALSE);
-	kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_hide", HKEY, KM_PRESS, KM_SHIFT, 0);
 	RNA_boolean_set(kmi->ptr, "unselected", TRUE);
 
 	WM_keymap_add_item(keymap, "ARMATURE_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0);
@@ -247,17 +247,17 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
 	kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
 		RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
 	
-	kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0);
 		RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
 		RNA_boolean_set(kmi->ptr, "extend", FALSE);
-	kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
 		RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
 		RNA_boolean_set(kmi->ptr, "extend", TRUE);
 	
-	kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
 		RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
 		RNA_boolean_set(kmi->ptr, "extend", FALSE);
-	kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "ARMATURE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
 		RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
 		RNA_boolean_set(kmi->ptr, "extend", TRUE);
 
@@ -286,10 +286,10 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
 	
 		/* special transforms: */
 		/* 	1) envelope/b-bone size */
-	kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
+	kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
 		RNA_enum_set(kmi->ptr, "mode", TFM_BONESIZE);
 		/* 	2) set roll */
-	kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", RKEY, KM_PRESS, KM_CTRL, 0);
+	kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", RKEY, KM_PRESS, KM_CTRL, 0);
 		RNA_enum_set(kmi->ptr, "mode", TFM_BONE_ROLL);
 		
 		/* menus */
@@ -297,11 +297,11 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
 
 	/* Pose ------------------------ */
 	/* only set in posemode, by space_view3d listener */
-	keymap= WM_keymap_find(keyconf, "Pose", 0, 0);
-	keymap->poll= ED_operator_posemode;
+	keymap = WM_keymap_find(keyconf, "Pose", 0, 0);
+	keymap->poll = ED_operator_posemode;
 	
 	/* set parent and add object are object-based operators, but we make them
-	   available here because it's useful to do in pose mode too */
+	 * available here because it's useful to do in pose mode too */
 	WM_keymap_add_item(keymap, "OBJECT_OT_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
 	WM_keymap_add_menu(keymap, "INFO_MT_add", AKEY, KM_PRESS, KM_SHIFT, 0);
 	
@@ -327,7 +327,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
 	kmi = WM_keymap_add_item(keymap, "POSE_OT_paste", VKEY, KM_PRESS, KM_CTRL, 0);
 	RNA_boolean_set(kmi->ptr, "flipped", FALSE);
 
-	kmi= WM_keymap_add_item(keymap, "POSE_OT_paste", VKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "POSE_OT_paste", VKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
 	RNA_boolean_set(kmi->ptr, "flipped", TRUE);
 	
 	kmi = WM_keymap_add_item(keymap, "POSE_OT_select_all", AKEY, KM_PRESS, 0, 0);
@@ -337,17 +337,17 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
 
 	WM_keymap_add_item(keymap, "POSE_OT_select_parent", PKEY, KM_PRESS, KM_SHIFT, 0);
 
-	kmi= WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, 0, 0);
 		RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
 		RNA_boolean_set(kmi->ptr, "extend", FALSE);
-	kmi= WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
 		RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_PARENT);
 		RNA_boolean_set(kmi->ptr, "extend", TRUE);
 	
-	kmi= WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
 		RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
 		RNA_boolean_set(kmi->ptr, "extend", FALSE);
-	kmi= WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "POSE_OT_select_hierarchy", RIGHTBRACKETKEY, KM_PRESS, KM_SHIFT, 0);
 		RNA_enum_set(kmi->ptr, "direction", BONE_SELECT_CHILD);
 		RNA_boolean_set(kmi->ptr, "extend", TRUE);
 
@@ -374,7 +374,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
 	
 		/* special transforms: */
 		/* 	1) envelope/b-bone size */
-	kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
+	kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
 		RNA_enum_set(kmi->ptr, "mode", TFM_BONESIZE);
 	
 		/* keyframes management */
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index e8c9a2c..cc3d0c6 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -38,6 +38,7 @@
 
 
 #include "DNA_anim_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_armature_types.h"
 #include "DNA_constraint_types.h"
 #include "DNA_meshdata_types.h"
@@ -48,7 +49,6 @@
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
-#include "BLI_editVert.h"
 #include "BLI_ghash.h"
 
 #include "BKE_animsys.h"
@@ -123,18 +123,18 @@ void ED_armature_validate_active(struct bArmature *arm)
 {
 	EditBone *ebone= arm->act_edbone;
 
-	if(ebone) { 
-		if(ebone->flag & BONE_HIDDEN_A)
+	if (ebone) { 
+		if (ebone->flag & BONE_HIDDEN_A)
 			arm->act_edbone= NULL;
 	}
 }
 
 static void bone_free(bArmature *arm, EditBone *bone)
 {
-	if(arm->act_edbone==bone)
+	if (arm->act_edbone==bone)
 		arm->act_edbone= NULL;
 
-	if(bone->prop) {
+	if (bone->prop) {
 		IDP_FreeProperty(bone->prop);
 		MEM_freeN(bone->prop);
 	}
@@ -179,7 +179,7 @@ EditBone *ED_armature_bone_get_mirrored(ListBase *edbo, EditBone *ebo)
 }
 
 /* helper function for tools to work on mirrored parts.
-   it leaves mirrored bones selected then too, which is a good indication of what happened */
+ * it leaves mirrored bones selected then too, which is a good indication of what happened */
 static void armature_select_mirrored(bArmature *arm)
 {
 	/* Select mirrored bones */
@@ -275,16 +275,16 @@ EditBone *make_boneList(ListBase *edbo, ListBase *bones, EditBone *parent, Bone
 		else {
 			/* if the bone is not selected, but connected to its parent
 			 *  copy the parents tip selection state */
-			if(eBone->parent &&  (eBone->flag & BONE_CONNECTED)) {
+			if (eBone->parent &&  (eBone->flag & BONE_CONNECTED)) {
 				/* selecting with the mouse gives this behavior */
-				if(eBone->parent->flag & BONE_TIPSEL) {
+				if (eBone->parent->flag & BONE_TIPSEL) {
 					eBone->flag |= BONE_ROOTSEL;
 				}
 				else {
 					eBone->flag &= ~BONE_ROOTSEL;
 				}
 
-				/* probably not selected but just incase */
+				/* probably not selected but just in case */
 				eBone->flag &= ~BONE_TIPSEL;
 			}
 		}
@@ -306,7 +306,7 @@ EditBone *make_boneList(ListBase *edbo, ListBase *bones, EditBone *parent, Bone
 		eBone->segments = curBone->segments;		
 		eBone->layer = curBone->layer;
 
-		if(curBone->prop)
+		if (curBone->prop)
 			eBone->prop= IDP_CopyProperty(curBone->prop);
 		
 		BLI_addtail(edbo, eBone);
@@ -314,11 +314,11 @@ EditBone *make_boneList(ListBase *edbo, ListBase *bones, EditBone *parent, Bone
 		/*	Add children if necessary */
 		if (curBone->childbase.first) {
 			eBoneTest= make_boneList(edbo, &curBone->childbase, eBone, actBone);
-			if(eBoneTest)
+			if (eBoneTest)
 				eBoneAct= eBoneTest;
 		}
 
-		if(curBone==actBone)
+		if (curBone==actBone)
 			eBoneAct= eBone;
 	}
 
@@ -395,7 +395,7 @@ void ED_armature_from_edit(Object *obedit)
 				if (fBone->parent==eBone)
 					fBone->parent= eBone->parent;
 			}
-			if (G.f & G_DEBUG)
+			if (G.debug & G_DEBUG)
 				printf("Warning: removed zero sized bone: %s\n", eBone->name);
 			bone_free(arm, eBone);
 		}
@@ -434,12 +434,12 @@ void ED_armature_from_edit(Object *obedit)
 		newBone->segments= eBone->segments;
 		newBone->layer = eBone->layer;
 		
-		if(eBone->prop)
+		if (eBone->prop)
 			newBone->prop= IDP_CopyProperty(eBone->prop);
 	}
 	
-	/*	Fix parenting in a separate pass to ensure ebone->bone connections
-		are valid at this point */
+	/* Fix parenting in a separate pass to ensure ebone->bone connections
+	 * are valid at this point */
 	for (eBone=arm->edbo->first;eBone;eBone=eBone->next) {
 		newBone= (Bone *)eBone->temp;
 		if (eBone->parent) {
@@ -542,7 +542,7 @@ void docenter_armature (Scene *scene, Object *ob, float cursor[3], int centermod
 	float cent[3];
 
 	/* Put the armature into editmode */
-	if(ob != obedit) {
+	if (ob != obedit) {
 		ED_armature_to_edit(ob);
 		obedit= NULL; /* we cant use this so behave as if there is no obedit */
 	}
@@ -554,7 +554,7 @@ void docenter_armature (Scene *scene, Object *ob, float cursor[3], int centermod
 		mul_m4_v3(ob->imat, cent);
 	}
 	else {
-		if(around==V3D_CENTROID) {
+		if (around==V3D_CENTROID) {
 			int total= 0;
 			zero_v3(cent);
 			for (ebone= arm->edbo->first; ebone; ebone=ebone->next) {
@@ -582,13 +582,13 @@ void docenter_armature (Scene *scene, Object *ob, float cursor[3], int centermod
 	}
 	
 	/* Turn the list into an armature */
-	if(obedit==NULL) {
+	if (obedit==NULL) {
 		ED_armature_from_edit(ob);
 		ED_armature_edit_free(ob);
 	}
 
 	/* Adjust object location for new centerpoint */
-	if(centermode && obedit==NULL) {
+	if (centermode && obedit==NULL) {
 		mul_mat3_m4_v3(ob->obmat, cent); /* ommit translation part */
 		add_v3_v3(ob->loc, cent);
 	}
@@ -729,16 +729,16 @@ static int apply_armature_pose2bones_exec (bContext *C, wmOperator *op)
 void POSE_OT_armature_apply (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Apply Pose as Rest Pose";
-	ot->idname= "POSE_OT_armature_apply";
-	ot->description= "Apply the current pose as the new rest pose";
+	ot->name = "Apply Pose as Rest Pose";
+	ot->idname = "POSE_OT_armature_apply";
+	ot->description = "Apply the current pose as the new rest pose";
 	
 	/* callbacks */
-	ot->exec= apply_armature_pose2bones_exec;
-	ot->poll= ED_operator_posemode;
+	ot->exec = apply_armature_pose2bones_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 
@@ -780,16 +780,16 @@ static int pose_visual_transform_apply_exec (bContext *C, wmOperator *UNUSED(op)
 void POSE_OT_visual_transform_apply (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Apply Visual Transform to Pose";
-	ot->idname= "POSE_OT_visual_transform_apply";
-	ot->description= "Apply final constrained position of pose bones to their transform";
+	ot->name = "Apply Visual Transform to Pose";
+	ot->idname = "POSE_OT_visual_transform_apply";
+	ot->description = "Apply final constrained position of pose bones to their transform";
 	
 	/* callbacks */
-	ot->exec= pose_visual_transform_apply_exec;
-	ot->poll= ED_operator_posemode;
+	ot->exec = pose_visual_transform_apply_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ---------------------- */
@@ -1043,12 +1043,12 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm)
 							 */
 							if (ct->subtarget[0] != 0) {
 								if (ct->tar == origArm) {
-									if(BLI_findstring(npchans, ct->subtarget, offsetof(bPoseChannel, name))) {
+									if (BLI_findstring(npchans, ct->subtarget, offsetof(bPoseChannel, name))) {
 										ct->tar= newArm;
 									}
 								}
 								else if (ct->tar == newArm) {
-									if(BLI_findstring(opchans, ct->subtarget, offsetof(bPoseChannel, name))) {
+									if (BLI_findstring(opchans, ct->subtarget, offsetof(bPoseChannel, name))) {
 										ct->tar= origArm;
 									}
 								}
@@ -1079,14 +1079,14 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm)
 						 *	- the target isn't origArm/newArm itself
 						 *	- the target is one that can be found in newArm/origArm
 						 */
-						if(ct->subtarget[0] != '\0')  {
+						if (ct->subtarget[0] != '\0') {
 							if (ct->tar == origArm) {
-								if(BLI_findstring(npchans, ct->subtarget, offsetof(bPoseChannel, name))) {
+								if (BLI_findstring(npchans, ct->subtarget, offsetof(bPoseChannel, name))) {
 									ct->tar= newArm;
 								}
 							}
 							else if (ct->tar == newArm) {
-								if(BLI_findstring(opchans, ct->subtarget, offsetof(bPoseChannel, name))) {
+								if (BLI_findstring(opchans, ct->subtarget, offsetof(bPoseChannel, name))) {
 									ct->tar= origArm;
 								}
 							}
@@ -1104,7 +1104,7 @@ static void separated_armature_fix_links(Object *origArm, Object *newArm)
 		if (ob->parent && (ob->parent == origArm)) {
 			/* Is object parented to a bone of this src armature? */
 			if ((ob->partype == PARBONE) && (ob->parsubstr[0] != '\0')) {
-				if(BLI_findstring(npchans, ob->parsubstr, offsetof(bPoseChannel, name))) {
+				if (BLI_findstring(npchans, ob->parsubstr, offsetof(bPoseChannel, name))) {
 					ob->parent= newArm;
 				}
 			}
@@ -1243,17 +1243,17 @@ static int separate_armature_exec (bContext *C, wmOperator *UNUSED(op))
 void ARMATURE_OT_separate (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Separate Bones";
-	ot->idname= "ARMATURE_OT_separate";
-	ot->description= "Isolate selected bones into a separate armature";
+	ot->name = "Separate Bones";
+	ot->idname = "ARMATURE_OT_separate";
+	ot->description = "Isolate selected bones into a separate armature";
 	
 	/* callbacks */
-	ot->invoke= WM_operator_confirm;
-	ot->exec= separate_armature_exec;
-	ot->poll= ED_operator_editarmature;
+	ot->invoke = WM_operator_confirm;
+	ot->exec = separate_armature_exec;
+	ot->poll = ED_operator_editarmature;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* **************** END tools on Editmode Armature **************** */
@@ -1263,7 +1263,7 @@ void ARMATURE_OT_separate (wmOperatorType *ot)
 Bone *get_indexed_bone (Object *ob, int index)
 {
 	bPoseChannel *pchan;
-	if(ob->pose==NULL) return NULL;
+	if (ob->pose==NULL) return NULL;
 	index>>=16;		// bone selection codes use left 2 bytes
 	
 	pchan= BLI_findlink(&ob->pose->chanbase, index);
@@ -1281,17 +1281,17 @@ static void *get_bone_from_selectbuffer(Scene *scene, Base *base, unsigned int *
 	unsigned int hitresult;
 	short i, takeNext=0, sel;
 	
-	for (i=0; i< hits; i++){
+	for (i=0; i< hits; i++) {
 		hitresult = buffer[3+(i*4)];
 		
 		if (!(hitresult & BONESEL_NOSEL)) {	// -1
-			if(hitresult & BONESEL_ANY) {	// to avoid including objects in selection
+			if (hitresult & BONESEL_ANY) {	// to avoid including objects in selection
 				
 				hitresult &= ~(BONESEL_ANY);
 				/* Determine what the current bone is */
 				if (obedit==NULL || base->object!=obedit) {
 					/* no singular posemode, so check for correct object */
-					if(base->selcol == (hitresult & 0xFFFF)) {
+					if (base->selcol == (hitresult & 0xFFFF)) {
 						bone = get_indexed_bone(base->object, hitresult);
 						
 						if (findunsel)
@@ -1306,7 +1306,7 @@ static void *get_bone_from_selectbuffer(Scene *scene, Base *base, unsigned int *
 						sel= 0;
 					}
 				}
-				else{
+				else {
 					bArmature *arm= obedit->data;
 					
 					ebone = BLI_findlink(arm->edbo, hitresult);
@@ -1318,9 +1318,9 @@ static void *get_bone_from_selectbuffer(Scene *scene, Base *base, unsigned int *
 					data = ebone;
 				}
 				
-				if(data) {
+				if (data) {
 					if (sel) {
-						if(!firstSel) firstSel= data;
+						if (!firstSel) firstSel= data;
 						takeNext=1;
 					}
 					else {
@@ -1354,9 +1354,9 @@ static void *get_nearest_bone (bContext *C, short findunsel, int x, int y)
 	
 	view3d_set_viewcontext(C, &vc);
 	
-	// rect.xmin= ... mouseco!
-	rect.xmin= rect.xmax= x;
-	rect.ymin= rect.ymax= y;
+	// rect.xmin = ... mouseco!
+	rect.xmin = rect.xmax = x;
+	rect.ymin = rect.ymax = y;
 	
 	glInitNames();
 	hits= view3d_opengl_select(&vc, buffer, MAXPICKBUF, &rect);
@@ -1430,7 +1430,7 @@ static int pose_select_connected_invoke(bContext *C, wmOperator *op, wmEvent *ev
 		return OPERATOR_CANCELLED;
 	
 	/* Select parents */
-	for (curBone=bone; curBone; curBone=next){
+	for (curBone=bone; curBone; curBone=next) {
 		/* ignore bone if cannot be selected */
 		if ((curBone->flag & BONE_UNSELECTABLE) == 0) { 
 				// XXX old cruft! use notifiers instead
@@ -1467,17 +1467,17 @@ static int pose_select_linked_poll(bContext *C)
 void POSE_OT_select_linked(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Connected";
-	ot->idname= "POSE_OT_select_linked";
-	ot->description= "Select bones related to selected ones by parent/child relationships";
+	ot->name = "Select Connected";
+	ot->idname = "POSE_OT_select_linked";
+	ot->description = "Select bones related to selected ones by parent/child relationships";
 	
 	/* api callbacks */
-	ot->exec= NULL;
-	ot->invoke= pose_select_connected_invoke;
-	ot->poll= pose_select_linked_poll;
+	ot->exec = NULL;
+	ot->invoke = pose_select_connected_invoke;
+	ot->poll = pose_select_linked_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* props */	
 	RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first");
@@ -1512,7 +1512,7 @@ static int armature_select_linked_invoke(bContext *C, wmOperator *op, wmEvent *e
 			if (extend) {
 				curBone->flag &= ~(BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
 			}
-			else{
+			else {
 				curBone->flag |= (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
 			}
 		}
@@ -1561,17 +1561,17 @@ static int armature_select_linked_poll(bContext *C)
 void ARMATURE_OT_select_linked(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Connected";
-	ot->idname= "ARMATURE_OT_select_linked";
-	ot->description= "Select bones related to selected ones by parent/child relationships";
+	ot->name = "Select Connected";
+	ot->idname = "ARMATURE_OT_select_linked";
+	ot->description = "Select bones related to selected ones by parent/child relationships";
 	
 	/* api callbacks */
-	ot->exec= NULL;
-	ot->invoke= armature_select_linked_invoke;
-	ot->poll= armature_select_linked_poll;
+	ot->exec = NULL;
+	ot->invoke = armature_select_linked_invoke;
+	ot->poll = armature_select_linked_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties s*/
 	RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first");
@@ -1590,23 +1590,23 @@ static EditBone *get_nearest_editbonepoint (ViewContext *vc, const int mval[2],
 
 	glInitNames();
 	
-	rect.xmin= mval[0]-5;
-	rect.xmax= mval[0]+5;
-	rect.ymin= mval[1]-5;
-	rect.ymax= mval[1]+5;
+	rect.xmin = mval[0]-5;
+	rect.xmax = mval[0]+5;
+	rect.ymin = mval[1]-5;
+	rect.ymax = mval[1]+5;
 	
 	hits= view3d_opengl_select(vc, buffer, MAXPICKBUF, &rect);
-	if(hits==0) {
-		rect.xmin= mval[0]-12;
-		rect.xmax= mval[0]+12;
-		rect.ymin= mval[1]-12;
-		rect.ymax= mval[1]+12;
+	if (hits==0) {
+		rect.xmin = mval[0]-12;
+		rect.xmax = mval[0]+12;
+		rect.ymin = mval[1]-12;
+		rect.ymax = mval[1]+12;
 		hits= view3d_opengl_select(vc, buffer, MAXPICKBUF, &rect);
 	}
 	/* See if there are any selected bones in this group */
 	if (hits>0) {
 		
-		if(hits==1) {
+		if (hits==1) {
 			if (!(buffer[3] & BONESEL_NOSEL)) 
 				besthitresult= buffer[3];
 		}
@@ -1619,12 +1619,12 @@ static EditBone *get_nearest_editbonepoint (ViewContext *vc, const int mval[2],
 					ebone = BLI_findlink(edbo, hitresult & ~BONESEL_ANY);
 					
 					/* clicks on bone points get advantage */
-					if( hitresult & (BONESEL_ROOT|BONESEL_TIP)) {
+					if ( hitresult & (BONESEL_ROOT|BONESEL_TIP)) {
 						/* but also the unselected one */
-						if(findunsel) {
-							if( (hitresult & BONESEL_ROOT) && (ebone->flag & BONE_ROOTSEL)==0) 
+						if (findunsel) {
+							if ( (hitresult & BONESEL_ROOT) && (ebone->flag & BONE_ROOTSEL)==0) 
 								dep= 1;
-							else if( (hitresult & BONESEL_TIP) && (ebone->flag & BONE_TIPSEL)==0) 
+							else if ( (hitresult & BONESEL_TIP) && (ebone->flag & BONE_TIPSEL)==0) 
 								dep= 1;
 							else 
 								dep= 2;
@@ -1633,15 +1633,15 @@ static EditBone *get_nearest_editbonepoint (ViewContext *vc, const int mval[2],
 					}
 					else {
 						/* bone found */
-						if(findunsel) {
-							if((ebone->flag & BONE_SELECTED)==0)
+						if (findunsel) {
+							if ((ebone->flag & BONE_SELECTED)==0)
 								dep= 2;
 							else
 								dep= 3;
 						}
 						else dep= 3;
 					}
-					if(dep < mindep) {
+					if (dep < mindep) {
 						mindep= dep;
 						besthitresult= hitresult;
 					}
@@ -1729,7 +1729,7 @@ static int armature_delete_selected_exec(bContext *C, wmOperator *UNUSED(op))
 		ebone_next= curBone->next;
 		if (arm->layer & curBone->layer) {
 			if (curBone->flag & BONE_SELECTED) {
-				if(curBone==arm->act_edbone) arm->act_edbone= NULL;
+				if (curBone==arm->act_edbone) arm->act_edbone= NULL;
 				ED_armature_edit_bone_remove(arm, curBone);
 			}
 		}
@@ -1746,9 +1746,9 @@ static int armature_delete_selected_exec(bContext *C, wmOperator *UNUSED(op))
 void ARMATURE_OT_delete(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete Selected Bone(s)";
-	ot->idname= "ARMATURE_OT_delete";
-	ot->description= "Remove selected bones from the armature";
+	ot->name = "Delete Selected Bone(s)";
+	ot->idname = "ARMATURE_OT_delete";
+	ot->description = "Remove selected bones from the armature";
 	
 	/* api callbacks */
 	ot->invoke = WM_operator_confirm;
@@ -1756,7 +1756,7 @@ void ARMATURE_OT_delete(wmOperatorType *ot)
 	ot->poll = ED_operator_editarmature;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* toggle==0: deselect
@@ -1769,12 +1769,12 @@ void ED_armature_deselect_all(Object *obedit, int toggle)
 	EditBone	*eBone;
 	int			sel=1;
 	
-	if(toggle==1) {
-		/*	Determine if there are any selected bones
-		And therefore whether we are selecting or deselecting */
-		for (eBone=arm->edbo->first;eBone;eBone=eBone->next){
-			//			if(arm->layer & eBone->layer) {
-			if (eBone->flag & (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL)){
+	if (toggle==1) {
+		/* Determine if there are any selected bones
+		 * and therefore whether we are selecting or deselecting */
+		for (eBone=arm->edbo->first;eBone;eBone=eBone->next) {
+			//			if (arm->layer & eBone->layer) {
+			if (eBone->flag & (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL)) {
 				sel=0;
 				break;
 			}
@@ -1787,24 +1787,24 @@ void ED_armature_deselect_all(Object *obedit, int toggle)
 	for (eBone=arm->edbo->first;eBone;eBone=eBone->next) {
 		if (sel==2) {
 			/* invert selection of bone */
-			if(EBONE_VISIBLE(arm, eBone)) {
+			if (EBONE_VISIBLE(arm, eBone)) {
 				eBone->flag ^= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
-				if(arm->act_edbone==eBone)
+				if (arm->act_edbone==eBone)
 					arm->act_edbone= NULL;
 			}
 		}
 		else if (sel==1) {
 			/* select bone */
-			if(EBONE_VISIBLE(arm, eBone)) {
+			if (EBONE_VISIBLE(arm, eBone)) {
 				eBone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
-				if(eBone->parent)
+				if (eBone->parent)
 					eBone->parent->flag |= (BONE_TIPSEL);
 			}
 		}
 		else {
 			/* deselect bone */
 			eBone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
-			if(arm->act_edbone==eBone)
+			if (arm->act_edbone==eBone)
 				arm->act_edbone= NULL;
 		}
 	}
@@ -1830,7 +1830,7 @@ void ED_armature_deselect_all_visible(Object *obedit)
 /* accounts for connected parents */
 static int ebone_select_flag(EditBone *ebone)
 {
-	if(ebone->parent && (ebone->flag & BONE_CONNECTED)) {
+	if (ebone->parent && (ebone->flag & BONE_CONNECTED)) {
 		return ((ebone->parent->flag & BONE_TIPSEL) ? BONE_ROOTSEL : 0) | (ebone->flag & (BONE_SELECTED|BONE_TIPSEL));
 	}
 	else {
@@ -1858,18 +1858,18 @@ int mouse_armature(bContext *C, const int mval[2], int extend)
 			ED_armature_deselect_all(obedit, 0);
 		
 		/* by definition the non-root connected bones have no root point drawn,
-		   so a root selection needs to be delivered to the parent tip */
+		 * so a root selection needs to be delivered to the parent tip */
 		
-		if(selmask & BONE_SELECTED) {
-			if(nearBone->parent && (nearBone->flag & BONE_CONNECTED)) {
+		if (selmask & BONE_SELECTED) {
+			if (nearBone->parent && (nearBone->flag & BONE_CONNECTED)) {
 				/* click in a chain */
-				if(extend) {
+				if (extend) {
 					/* hold shift inverts this bone's selection */
-					if(nearBone->flag & BONE_SELECTED) {
+					if (nearBone->flag & BONE_SELECTED) {
 						/* deselect this bone */
 						nearBone->flag &= ~(BONE_TIPSEL|BONE_SELECTED);
 						/* only deselect parent tip if it is not selected */
-						if(!(nearBone->parent->flag & BONE_SELECTED))
+						if (!(nearBone->parent->flag & BONE_SELECTED))
 							nearBone->parent->flag &= ~BONE_TIPSEL;
 					}
 					else {
@@ -1885,9 +1885,9 @@ int mouse_armature(bContext *C, const int mval[2], int extend)
 				}
 			}
 			else {
-				if(extend) {
+				if (extend) {
 					/* hold shift inverts this bone's selection */
-					if(nearBone->flag & BONE_SELECTED)
+					if (nearBone->flag & BONE_SELECTED)
 					   nearBone->flag &= ~(BONE_TIPSEL|BONE_ROOTSEL);
 					else
 						nearBone->flag |= (BONE_TIPSEL|BONE_ROOTSEL);
@@ -1904,9 +1904,9 @@ int mouse_armature(bContext *C, const int mval[2], int extend)
 		
 		ED_armature_sync_selection(arm->edbo);
 		
-		if(nearBone) {
+		if (nearBone) {
 			/* then now check for active status */
-			if(ebone_select_flag(nearBone)) {
+			if (ebone_select_flag(nearBone)) {
 				arm->act_edbone= nearBone;
 			}
 		}
@@ -1965,16 +1965,16 @@ float ED_rollBoneToVector(EditBone *bone, const float align_axis[3], const short
 	sub_v3_v3v3(nor, bone->tail, bone->head);
 	vec_roll_to_mat3(nor, 0.0f, mat);
 
-	/* check the bone isnt aligned with the axis */
-	if(!is_zero_v3(align_axis) && angle_v3v3(align_axis, mat[2]) > FLT_EPSILON) {
+	/* check the bone isn't aligned with the axis */
+	if (!is_zero_v3(align_axis) && angle_v3v3(align_axis, mat[2]) > FLT_EPSILON) {
 		float vec[3], align_axis_proj[3], roll;
 
 		/* project the new_up_axis along the normal */
 		project_v3_v3v3(vec, align_axis, nor);
 		sub_v3_v3v3(align_axis_proj, align_axis, vec);
 		
-		if(axis_only) {
-			if(angle_v3v3(align_axis_proj, mat[2]) > (float)(M_PI/2.0)) {
+		if (axis_only) {
+			if (angle_v3v3(align_axis_proj, mat[2]) > (float)(M_PI/2.0)) {
 				negate_v3(align_axis_proj);
 			}
 		}
@@ -2020,7 +2020,7 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op)
 	copy_m3_m4(imat, ob->obmat);
 	invert_m3(imat);
 
-	if(type==7) { /* Cursor */
+	if (type==7) { /* Cursor */
 		Scene *scene= CTX_data_scene(C);
 		View3D *v3d= CTX_wm_view3d(C); /* can be NULL */
 		float cursor_local[3];
@@ -2031,20 +2031,20 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op)
 		mul_m3_v3(imat, cursor_local);
 
 		/* cursor */
-		for(ebone= arm->edbo->first; ebone; ebone= ebone->next) {
-			if(EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) {
+		for (ebone= arm->edbo->first; ebone; ebone= ebone->next) {
+			if (EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) {
 				float cursor_rel[3];
 				sub_v3_v3v3(cursor_rel, cursor_local, ebone->head);
-				if(axis_flip) negate_v3(cursor_rel);
+				if (axis_flip) negate_v3(cursor_rel);
 				ebone->roll= ED_rollBoneToVector(ebone, cursor_rel, axis_only);
 			}
 		}
 	}
 	else {
 		float vec[3]= {0.0f, 0.0f, 0.0f};
-		if(type==6) { /* View */
+		if (type==6) { /* View */
 			RegionView3D *rv3d= CTX_wm_region_view3d(C);
-			if(rv3d==NULL) {
+			if (rv3d==NULL) {
 				BKE_report(op->reports, RPT_ERROR, "No region view3d available");
 				return OPERATOR_CANCELLED;
 			}
@@ -2055,7 +2055,7 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op)
 		else if (type==5) {
 			float mat[3][3], nor[3];
 			ebone= (EditBone *)arm->act_edbone;
-			if(ebone==NULL) {
+			if (ebone==NULL) {
 				BKE_report(op->reports, RPT_ERROR, "No active bone set");
 				return OPERATOR_CANCELLED;
 			}
@@ -2066,15 +2066,15 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op)
 		}
 		else { /* Axis */
 			assert(type >= 0 && type <= 5);
-			if(type<3)	vec[type]= 1.0f; 
+			if (type<3)	vec[type]= 1.0f; 
 			else		vec[type-2]= -1.0f; 
 			mul_m3_v3(imat, vec);
 		}
 
-		if(axis_flip) negate_v3(vec);
+		if (axis_flip) negate_v3(vec);
 
-		for(ebone= arm->edbo->first; ebone; ebone= ebone->next) {
-			if(EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) {
+		for (ebone= arm->edbo->first; ebone; ebone= ebone->next) {
+			if (EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) {
 				/* roll func is a callback which assumes that all is well */
 				ebone->roll= ED_rollBoneToVector(ebone, vec, axis_only);
 			}
@@ -2082,8 +2082,8 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op)
 	}
 
 	if (arm->flag & ARM_MIRROR_EDIT) {
-		for(ebone= arm->edbo->first; ebone; ebone= ebone->next) {
-			if((EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) == 0) {
+		for (ebone= arm->edbo->first; ebone; ebone= ebone->next) {
+			if ((EBONE_VISIBLE(arm, ebone) && EBONE_EDITABLE(ebone)) == 0) {
 				EditBone *ebone_mirr= ED_armature_bone_get_mirrored(arm->edbo, ebone);
 				if (ebone_mirr && (EBONE_VISIBLE(arm, ebone_mirr) && EBONE_EDITABLE(ebone_mirr))) {
 					ebone->roll= -ebone_mirr->roll;
@@ -2101,9 +2101,9 @@ static int armature_calc_roll_exec(bContext *C, wmOperator *op)
 void ARMATURE_OT_calculate_roll(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Recalculate Roll";
-	ot->idname= "ARMATURE_OT_calculate_roll";
-	ot->description= "Automatically fix alignment of select bones' axes";
+	ot->name = "Recalculate Roll";
+	ot->idname = "ARMATURE_OT_calculate_roll";
+	ot->description = "Automatically fix alignment of select bones' axes";
 	
 	/* api callbacks */
 	ot->invoke = WM_menu_invoke;
@@ -2111,10 +2111,10 @@ void ARMATURE_OT_calculate_roll(wmOperatorType *ot)
 	ot->poll = ED_operator_editarmature;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_calc_roll_types, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_calc_roll_types, 0, "Type", "");
 	RNA_def_boolean(ot->srna, "axis_flip", 0, "Flip Axis", "Negate the alignment axis");
 	RNA_def_boolean(ot->srna, "axis_only", 0, "Shortest Rotation", "Ignore the axis direction, use the shortest rotation to align");
 }
@@ -2126,7 +2126,7 @@ typedef struct UndoArmature {
 	ListBase lb;
 } UndoArmature;
 
-static void undoBones_to_editBones(void *uarmv, void *armv)
+static void undoBones_to_editBones(void *uarmv, void *armv, void *UNUSED(data))
 {
 	UndoArmature *uarm= uarmv;
 	bArmature *arm= armv;
@@ -2135,14 +2135,14 @@ static void undoBones_to_editBones(void *uarmv, void *armv)
 	BLI_freelistN(arm->edbo);
 	
 	/* copy  */
-	for(ebo= uarm->lb.first; ebo; ebo= ebo->next) {
+	for (ebo= uarm->lb.first; ebo; ebo= ebo->next) {
 		newebo= MEM_dupallocN(ebo);
 		ebo->temp= newebo;
 		BLI_addtail(arm->edbo, newebo);
 	}
 	
 	/* active bone */
-	if(uarm->act_edbone) {
+	if (uarm->act_edbone) {
 		ebo= uarm->act_edbone;
 		arm->act_edbone= ebo->temp;
 	}
@@ -2150,16 +2150,16 @@ static void undoBones_to_editBones(void *uarmv, void *armv)
 		arm->act_edbone= NULL;
 
 	/* set pointers */
-	for(newebo= arm->edbo->first; newebo; newebo= newebo->next) {
-		if(newebo->parent) newebo->parent= newebo->parent->temp;
+	for (newebo= arm->edbo->first; newebo; newebo= newebo->next) {
+		if (newebo->parent) newebo->parent= newebo->parent->temp;
 	}
-	/* be sure they dont hang ever */
-	for(newebo= arm->edbo->first; newebo; newebo= newebo->next) {
+	/* be sure they don't hang ever */
+	for (newebo= arm->edbo->first; newebo; newebo= newebo->next) {
 		newebo->temp= NULL;
 	}
 }
 
-static void *editBones_to_undoBones(void *armv)
+static void *editBones_to_undoBones(void *armv, void *UNUSED(obdata))
 {
 	bArmature *arm= armv;
 	UndoArmature *uarm;
@@ -2168,21 +2168,21 @@ static void *editBones_to_undoBones(void *armv)
 	uarm= MEM_callocN(sizeof(UndoArmature), "listbase undo");
 	
 	/* copy */
-	for(ebo= arm->edbo->first; ebo; ebo= ebo->next) {
+	for (ebo= arm->edbo->first; ebo; ebo= ebo->next) {
 		newebo= MEM_dupallocN(ebo);
 		ebo->temp= newebo;
 		BLI_addtail(&uarm->lb, newebo);
 	}
 	
 	/* active bone */
-	if(arm->act_edbone) {
+	if (arm->act_edbone) {
 		ebo= arm->act_edbone;
 		uarm->act_edbone= ebo->temp;
 	}
 
 	/* set pointers */
-	for(newebo= uarm->lb.first; newebo; newebo= newebo->next) {
-		if(newebo->parent) newebo->parent= newebo->parent->temp;
+	for (newebo= uarm->lb.first; newebo; newebo= newebo->next) {
+		if (newebo->parent) newebo->parent= newebo->parent->temp;
 	}
 	
 	return uarm;
@@ -2199,7 +2199,7 @@ static void free_undoBones(void *uarmv)
 static void *get_armature_edit(bContext *C)
 {
 	Object *obedit= CTX_data_edit_object(C);
-	if(obedit && obedit->type==OB_ARMATURE) {
+	if (obedit && obedit->type==OB_ARMATURE) {
 		return obedit->data;
 	}
 	return NULL;
@@ -2375,7 +2375,7 @@ static int armature_click_extrude_exec(bContext *C, wmOperator *UNUSED(op))
 static int armature_click_extrude_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 	/* TODO most of this code is copied from set3dcursor_invoke,
-	   it would be better to reuse code in set3dcursor_invoke */
+	 * it would be better to reuse code in set3dcursor_invoke */
 
 	/* temporarily change 3d cursor position */
 	Scene *scene;
@@ -2408,9 +2408,9 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, wmEvent *e
 void ARMATURE_OT_click_extrude(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Click-Extrude";
-	ot->idname= "ARMATURE_OT_click_extrude";
-	ot->description= "Create a new bone going from the last selected joint to the mouse position";
+	ot->name = "Click-Extrude";
+	ot->idname = "ARMATURE_OT_click_extrude";
+	ot->description = "Create a new bone going from the last selected joint to the mouse position";
 	
 	/* api callbacks */
 	ot->invoke = armature_click_extrude_invoke;
@@ -2418,7 +2418,7 @@ void ARMATURE_OT_click_extrude(wmOperatorType *ot)
 	ot->poll = ED_operator_editarmature;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* props */
 }
@@ -2533,8 +2533,7 @@ EditBone *duplicateEditBoneObjects(EditBone *curBone, const char *name, ListBase
 	curBone->temp = eBone;
 	eBone->temp = curBone;
 	
-	if (name != NULL)
-	{
+	if (name != NULL) {
 		BLI_strncpy(eBone->name, name, sizeof(eBone->name));
 	}
 
@@ -2542,7 +2541,7 @@ EditBone *duplicateEditBoneObjects(EditBone *curBone, const char *name, ListBase
 	BLI_addtail(editbones, eBone);
 	
 	/* copy the ID property */
-	if(curBone->prop)
+	if (curBone->prop)
 		eBone->prop= IDP_CopyProperty(curBone->prop);
 
 	/* Lets duplicate the list of constraints that the
@@ -2558,7 +2557,7 @@ EditBone *duplicateEditBoneObjects(EditBone *curBone, const char *name, ListBase
 			 */
 			channew= verify_pose_channel(dst_ob->pose, eBone->name);
 
-			if(channew) {
+			if (channew) {
 				duplicate_pose_channel_data(channew, chanold);
 			}
 		}
@@ -2654,9 +2653,9 @@ static int armature_duplicate_selected_exec(bContext *C, wmOperator *UNUSED(op))
 	} 
 	
 	/* correct the active bone */
-	if(arm->act_edbone) {
+	if (arm->act_edbone) {
 		eBone= arm->act_edbone;
-		if(eBone->temp)
+		if (eBone->temp)
 			arm->act_edbone= eBone->temp;
 	}
 
@@ -2677,16 +2676,16 @@ static int armature_duplicate_selected_exec(bContext *C, wmOperator *UNUSED(op))
 void ARMATURE_OT_duplicate(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Duplicate Selected Bone(s)";
-	ot->idname= "ARMATURE_OT_duplicate";
-	ot->description= "Make copies of the selected bones within the same armature";
+	ot->name = "Duplicate Selected Bone(s)";
+	ot->idname = "ARMATURE_OT_duplicate";
+	ot->description = "Make copies of the selected bones within the same armature";
 	
 	/* api callbacks */
 	ot->exec = armature_duplicate_selected_exec;
 	ot->poll = ED_operator_editarmature;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 
@@ -2934,7 +2933,7 @@ 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); 
+		BKE_reportf(op->reports, RPT_ERROR, "Too many points selected: %d\n", count);
 		BLI_freelistN(&points);
 		return OPERATOR_CANCELLED;
 	}
@@ -2951,16 +2950,16 @@ static int armature_fill_bones_exec (bContext *C, wmOperator *op)
 void ARMATURE_OT_fill (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Fill Between Joints";
-	ot->idname= "ARMATURE_OT_fill";
-	ot->description= "Add bone between selected joint(s) and/or 3D-Cursor";
+	ot->name = "Fill Between Joints";
+	ot->idname = "ARMATURE_OT_fill";
+	ot->description = "Add bone between selected joint(s) and/or 3D-Cursor";
 	
 	/* callbacks */
-	ot->exec= armature_fill_bones_exec;
-	ot->poll= ED_operator_editarmature;
+	ot->exec = armature_fill_bones_exec;
+	ot->poll = ED_operator_editarmature;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* --------------------- */
@@ -2977,9 +2976,9 @@ static void bones_merge(Object *obedit, EditBone *start, EditBone *end, EditBone
 	
 	/* check if same bone */
 	if (start == end) {
-		if (G.f & G_DEBUG) {
-			printf("Error: same bone! \n");
-			printf("\tstart = %s, end = %s \n", start->name, end->name);
+		if (G.debug & G_DEBUG) {
+			printf("Error: same bone!\n");
+			printf("\tstart = %s, end = %s\n", start->name, end->name);
 		}
 	}
 	
@@ -3056,7 +3055,7 @@ static int armature_merge_exec (bContext *C, wmOperator *op)
 	short type= RNA_enum_get(op->ptr, "type");
 	
 	/* sanity checks */
-	if ELEM(NULL, obedit, arm)
+	if (ELEM(NULL, obedit, arm))
 		return OPERATOR_CANCELLED;
 	
 	/* for now, there's only really one type of merging that's performed... */
@@ -3089,7 +3088,7 @@ static int armature_merge_exec (bContext *C, wmOperator *op)
 					 (ebo->flag & BONE_SELECTED) )
 				{
 					/* set either end or start (end gets priority, unless it is already set) */
-					if (bend == NULL)  {
+					if (bend == NULL) {
 						bend= ebo;
 						bchild= child;
 					}
@@ -3135,20 +3134,20 @@ void ARMATURE_OT_merge (wmOperatorType *ot)
 	};
 
 	/* identifiers */
-	ot->name= "Merge Bones";
-	ot->idname= "ARMATURE_OT_merge";
-	ot->description= "Merge continuous chains of selected bones";
+	ot->name = "Merge Bones";
+	ot->idname = "ARMATURE_OT_merge";
+	ot->description = "Merge continuous chains of selected bones";
 	
 	/* callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= armature_merge_exec;
-	ot->poll= ED_operator_editarmature;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = armature_merge_exec;
+	ot->poll = ED_operator_editarmature;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
-	ot->prop= RNA_def_enum(ot->srna, "type", merge_types, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", merge_types, 0, "Type", "");
 }
 
 /* ************** END Add/Remove stuff in editmode ************ */
@@ -3184,16 +3183,16 @@ static int armature_hide_exec(bContext *C, wmOperator *op)
 void ARMATURE_OT_hide(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Hide Selected Bones";
-	ot->idname= "ARMATURE_OT_hide";
-	ot->description= "Tag selected bones to not be visible in Edit Mode";
+	ot->name = "Hide Selected Bones";
+	ot->idname = "ARMATURE_OT_hide";
+	ot->description = "Tag selected bones to not be visible in Edit Mode";
 	
 	/* api callbacks */
-	ot->exec= armature_hide_exec;
-	ot->poll= ED_operator_editarmature;
+	ot->exec = armature_hide_exec;
+	ot->poll = ED_operator_editarmature;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* props */
 	RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected");
@@ -3206,7 +3205,7 @@ static int armature_reveal_exec(bContext *C, wmOperator *UNUSED(op))
 	EditBone *ebone;
 	
 	for (ebone = arm->edbo->first; ebone; ebone=ebone->next) {
-		if(arm->layer & ebone->layer) {
+		if (arm->layer & ebone->layer) {
 			if (ebone->flag & BONE_HIDDEN_A) {
 				ebone->flag |= (BONE_TIPSEL|BONE_SELECTED|BONE_ROOTSEL);
 				ebone->flag &= ~BONE_HIDDEN_A;
@@ -3224,16 +3223,16 @@ static int armature_reveal_exec(bContext *C, wmOperator *UNUSED(op))
 void ARMATURE_OT_reveal(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Reveal Bones";
-	ot->idname= "ARMATURE_OT_reveal";
-	ot->description= "Unhide all bones that have been tagged to be hidden in Edit Mode";
+	ot->name = "Reveal Bones";
+	ot->idname = "ARMATURE_OT_reveal";
+	ot->description = "Unhide all bones that have been tagged to be hidden in Edit Mode";
 	
 	/* api callbacks */
-	ot->exec= armature_reveal_exec;
-	ot->poll= ED_operator_editarmature;
+	ot->exec = armature_reveal_exec;
+	ot->poll = ED_operator_editarmature;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 }
 #if 0 // remove this?
@@ -3282,7 +3281,7 @@ void show_all_armature_bones(Scene *scene)
 	EditBone *ebone;
 	
 	for (ebone = arm->edbo->first; ebone; ebone=ebone->next) {
-		if(arm->layer & ebone->layer) {
+		if (arm->layer & ebone->layer) {
 			if (ebone->flag & BONE_HIDDEN_A) {
 				ebone->flag |= (BONE_TIPSEL|BONE_SELECTED|BONE_ROOTSEL);
 				ebone->flag &= ~BONE_HIDDEN_A;
@@ -3387,7 +3386,7 @@ static int armature_extrude_exec(bContext *C, wmOperator *op)
 					newbone->zwidth= ebone->zwidth;
 					newbone->ease1= ebone->ease1;
 					newbone->ease2= ebone->ease2;
-					newbone->rad_head= ebone->rad_tail;	// dont copy entire bone...
+					newbone->rad_head= ebone->rad_tail;	// don't copy entire bone...
 					newbone->rad_tail= ebone->rad_tail;
 					newbone->segments= 1;
 					newbone->layer= ebone->layer;
@@ -3433,16 +3432,16 @@ static int armature_extrude_exec(bContext *C, wmOperator *op)
 void ARMATURE_OT_extrude(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Extrude";
-	ot->idname= "ARMATURE_OT_extrude";
-	ot->description= "Create new bones from the selected joints";
+	ot->name = "Extrude";
+	ot->idname = "ARMATURE_OT_extrude";
+	ot->description = "Create new bones from the selected joints";
 	
 	/* api callbacks */
-	ot->exec= armature_extrude_exec;
-	ot->poll= ED_operator_editarmature;
+	ot->exec = armature_extrude_exec;
+	ot->poll = ED_operator_editarmature;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* props */
 	RNA_def_boolean(ot->srna, "forked", 0, "Forked", "");
@@ -3482,7 +3481,7 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op)
 
 	copy_v3_v3(bone->head, curs);
 	
-	if(rv3d && (U.flag & USER_ADD_VIEWALIGNED))
+	if (rv3d && (U.flag & USER_ADD_VIEWALIGNED))
 		add_v3_v3v3(bone->tail, bone->head, imat[1]);	// bone with unit length 1
 	else
 		add_v3_v3v3(bone->tail, bone->head, imat[2]);	// bone with unit length 1, pointing up Z
@@ -3496,16 +3495,16 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op)
 void ARMATURE_OT_bone_primitive_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Bone";
-	ot->idname= "ARMATURE_OT_bone_primitive_add";
-	ot->description= "Add a new bone located at the 3D-Cursor";
+	ot->name = "Add Bone";
+	ot->idname = "ARMATURE_OT_bone_primitive_add";
+	ot->description = "Add a new bone located at the 3D-Cursor";
 	
 	/* api callbacks */
 	ot->exec = armature_bone_primitive_add_exec;
 	ot->poll = ED_operator_editarmature;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	RNA_def_string(ot->srna, "name", "Bone", MAXBONENAME, "Name", "Name of the newly created bone");
 	
@@ -3585,27 +3584,31 @@ static int armature_subdivide_exec(bContext *C, wmOperator *op)
 
 void ARMATURE_OT_subdivide(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+
 	/* identifiers */
-	ot->name= "Subdivide Multi";
-	ot->idname= "ARMATURE_OT_subdivide";
-	ot->description= "Break selected bones into chains of smaller bones";
+	ot->name = "Subdivide Multi";
+	ot->idname = "ARMATURE_OT_subdivide";
+	ot->description = "Break selected bones into chains of smaller bones";
 	
 	/* api callbacks */
 	ot->exec = armature_subdivide_exec;
 	ot->poll = ED_operator_editarmature;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* Properties */
-	RNA_def_int(ot->srna, "number_cuts", 1, 1, INT_MAX, "Number of Cuts", "", 1, 10);
+	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);
 }
 
 /* ----------- */
 
 /* Switch Direction operator:
  * Currently, this does not use context loops, as context loops do not make it
- * easy to retrieve any hierarchial/chain relationships which are necessary for
+ * easy to retrieve any hierarchical/chain relationships which are necessary for
  * this to be done easily.
  */
 
@@ -3688,16 +3691,16 @@ static int armature_switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
 void ARMATURE_OT_switch_direction(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Switch Direction";
-	ot->idname= "ARMATURE_OT_switch_direction";
-	ot->description= "Change the direction that a chain of bones points in (head <-> tail swap)";
+	ot->name = "Switch Direction";
+	ot->idname = "ARMATURE_OT_switch_direction";
+	ot->description = "Change the direction that a chain of bones points in (head <-> tail swap)";
 	
 	/* api callbacks */
 	ot->exec = armature_switch_direction_exec;
 	ot->poll = ED_operator_editarmature;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 /* ***************** Parenting *********************** */
 
@@ -3783,10 +3786,10 @@ static int armature_parent_set_exec(bContext *C, wmOperator *op)
 	else if (arm->flag & ARM_MIRROR_EDIT) {
 		/* For X-Axis Mirror Editing option, we may need a mirror copy of actbone
 		 * - if there's a mirrored copy of selbone, try to find a mirrored copy of actbone 
-		 *	(i.e.  selbone="child.L" and actbone="parent.L", find "child.R" and "parent.R").
-		 *	This is useful for arm-chains, for example parenting lower arm to upper arm
+		 *   (i.e.  selbone="child.L" and actbone="parent.L", find "child.R" and "parent.R").
+		 * This is useful for arm-chains, for example parenting lower arm to upper arm
 		 * - if there's no mirrored copy of actbone (i.e. actbone = "parent.C" or "parent")
-		 *	then just use actbone. Useful when doing upper arm to spine.
+		 *   then just use actbone. Useful when doing upper arm to spine.
 		 */
 		actmirb= ED_armature_bone_get_mirrored(arm->edbo, actbone);
 		if (actmirb == NULL) 
@@ -3812,7 +3815,7 @@ static int armature_parent_set_exec(bContext *C, wmOperator *op)
 		 * - the context iterator contains both selected bones and their mirrored copies,
 		 *   so we assume that unselected bones are mirrored copies of some selected bone
 		 * - since the active one (and/or its mirror) will also be selected, we also need 
-		 * 	to check that we are not trying to opearate on them, since such an operation 
+		 * 	to check that we are not trying to operate on them, since such an operation
 		 *	would cause errors
 		 */
 		
@@ -3863,9 +3866,9 @@ static int armature_parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEve
 void ARMATURE_OT_parent_set(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Make Parent";
-	ot->idname= "ARMATURE_OT_parent_set";
-	ot->description= "Set the active bone as the parent of the selected bones";
+	ot->name = "Make Parent";
+	ot->idname = "ARMATURE_OT_parent_set";
+	ot->description = "Set the active bone as the parent of the selected bones";
 	
 	/* api callbacks */
 	ot->invoke = armature_parent_set_invoke;
@@ -3873,7 +3876,7 @@ void ARMATURE_OT_parent_set(wmOperatorType *ot)
 	ot->poll = ED_operator_editarmature;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	RNA_def_enum(ot->srna, "type", prop_editarm_make_parent_types, 0, "ParentType", "Type of parenting");
 }
@@ -3917,9 +3920,9 @@ static int armature_parent_clear_exec(bContext *C, wmOperator *op)
 void ARMATURE_OT_parent_clear(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear Parent";
-	ot->idname= "ARMATURE_OT_parent_clear";
-	ot->description= "Remove the parent-child relationship between selected bones and their parents";
+	ot->name = "Clear Parent";
+	ot->idname = "ARMATURE_OT_parent_clear";
+	ot->description = "Remove the parent-child relationship between selected bones and their parents";
 	
 	/* api callbacks */
 	ot->invoke = WM_menu_invoke;
@@ -3927,9 +3930,9 @@ void ARMATURE_OT_parent_clear(wmOperatorType *ot)
 	ot->poll = ED_operator_editarmature;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_editarm_clear_parent_types, 0, "ClearType", "What way to clear parenting");
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_editarm_clear_parent_types, 0, "ClearType", "What way to clear parenting");
 }
 
 /* ****************  Selections  ******************/
@@ -3954,16 +3957,16 @@ static int armature_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
 void ARMATURE_OT_select_inverse(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Inverse";
-	ot->idname= "ARMATURE_OT_select_inverse";
-	ot->description= "Flip the selection status of bones (selected -> unselected, unselected -> selected)";
+	ot->name = "Select Inverse";
+	ot->idname = "ARMATURE_OT_select_inverse";
+	ot->description = "Flip the selection status of bones (selected -> unselected, unselected -> selected)";
 	
 	/* api callbacks */
-	ot->exec= armature_select_inverse_exec;
-	ot->poll= ED_operator_editarmature;
+	ot->exec = armature_select_inverse_exec;
+	ot->poll = ED_operator_editarmature;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 }
 static int armature_de_select_all_exec(bContext *C, wmOperator *op)
@@ -3972,8 +3975,8 @@ static int armature_de_select_all_exec(bContext *C, wmOperator *op)
 
 	if (action == SEL_TOGGLE) {
 		action = SEL_SELECT;
-		/*	Determine if there are any selected bones
-		And therefore whether we are selecting or deselecting */
+		/* Determine if there are any selected bones
+		 * And therefore whether we are selecting or deselecting */
 		if (CTX_DATA_COUNT(C, selected_bones) > 0)
 			action = SEL_DESELECT;
 	}
@@ -3985,7 +3988,7 @@ static int armature_de_select_all_exec(bContext *C, wmOperator *op)
 			switch (action) {
 			case SEL_SELECT:
 				ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
-				if(ebone->parent)
+				if (ebone->parent)
 					ebone->parent->flag |= (BONE_TIPSEL);
 				break;
 			case SEL_DESELECT:
@@ -3997,7 +4000,7 @@ static int armature_de_select_all_exec(bContext *C, wmOperator *op)
 				} 
 				else {
 					ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
-					if(ebone->parent)
+					if (ebone->parent)
 						ebone->parent->flag |= (BONE_TIPSEL);
 				}
 				break;
@@ -4014,16 +4017,16 @@ static int armature_de_select_all_exec(bContext *C, wmOperator *op)
 void ARMATURE_OT_select_all(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select or Deselect All";
-	ot->idname= "ARMATURE_OT_select_all";
-	ot->description= "Toggle selection status of all bones";
+	ot->name = "(De)select All";
+	ot->idname = "ARMATURE_OT_select_all";
+	ot->description = "Toggle selection status of all bones";
 	
 	/* api callbacks */
-	ot->exec= armature_de_select_all_exec;
-	ot->poll= ED_operator_editarmature;
+	ot->exec = armature_de_select_all_exec;
+	ot->poll = ED_operator_editarmature;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	WM_operator_properties_select_all(ot);
 }
@@ -4095,16 +4098,16 @@ void ARMATURE_OT_select_hierarchy(wmOperatorType *ot)
 	};
 	
 	/* identifiers */
-	ot->name= "Select Hierarchy";
-	ot->idname= "ARMATURE_OT_select_hierarchy";
-	ot->description= "Select immediate parent/children of selected bones";
+	ot->name = "Select Hierarchy";
+	ot->idname = "ARMATURE_OT_select_hierarchy";
+	ot->description = "Select immediate parent/children of selected bones";
 	
 	/* api callbacks */
-	ot->exec= armature_select_hierarchy_exec;
-	ot->poll= ED_operator_editarmature;
+	ot->exec = armature_select_hierarchy_exec;
+	ot->poll = ED_operator_editarmature;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* props */
 	RNA_def_enum(ot->srna, "direction", direction_items,
@@ -4158,8 +4161,8 @@ static void bone_align_to_bone(ListBase *edbo, EditBone *selbone, EditBone *actb
 	selbone->roll = actbone->roll;
 	
 	/* if the bone being aligned has connected descendants they must be moved
-	according to their parent new position, otherwise they would be left
-	in an unconsistent state: connected but away from the parent*/
+	 * according to their parent new position, otherwise they would be left
+	 * in an inconsistent state: connected but away from the parent*/
 	fix_editbone_connected_children(edbo, selbone);
 	return;
 }
@@ -4179,10 +4182,10 @@ static int armature_align_bones_exec(bContext *C, wmOperator *op)
 	else if (arm->flag & ARM_MIRROR_EDIT) {
 		/* For X-Axis Mirror Editing option, we may need a mirror copy of actbone
 		 * - if there's a mirrored copy of selbone, try to find a mirrored copy of actbone 
-		 *	(i.e.  selbone="child.L" and actbone="parent.L", find "child.R" and "parent.R").
-		 *	This is useful for arm-chains, for example parenting lower arm to upper arm
+		 *   (i.e.  selbone="child.L" and actbone="parent.L", find "child.R" and "parent.R").
+		 *   This is useful for arm-chains, for example parenting lower arm to upper arm
 		 * - if there's no mirrored copy of actbone (i.e. actbone = "parent.C" or "parent")
-		 *	then just use actbone. Useful when doing upper arm to spine.
+		 *   then just use actbone. Useful when doing upper arm to spine.
 		 */
 		actmirb= ED_armature_bone_get_mirrored(arm->edbo, actbone);
 		if (actmirb == NULL) 
@@ -4208,8 +4211,8 @@ static int armature_align_bones_exec(bContext *C, wmOperator *op)
 		 * - the context iterator contains both selected bones and their mirrored copies,
 		 *   so we assume that unselected bones are mirrored copies of some selected bone
 		 * - since the active one (and/or its mirror) will also be selected, we also need 
-		 * 	to check that we are not trying to opearate on them, since such an operation 
-		 *	would cause errors
+		 *   to check that we are not trying to operate on them, since such an operation
+		 *   would cause errors
 		 */
 		
 		/* align selected bones to the active one */
@@ -4234,9 +4237,9 @@ static int armature_align_bones_exec(bContext *C, wmOperator *op)
 void ARMATURE_OT_align(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Align Bones";
-	ot->idname= "ARMATURE_OT_align";
-	ot->description= "Align selected bones to the active bone (or to their parent)";
+	ot->name = "Align Bones";
+	ot->idname = "ARMATURE_OT_align";
+	ot->description = "Align selected bones to the active bone (or to their parent)";
 	
 	/* api callbacks */
 	ot->invoke = WM_operator_confirm;
@@ -4244,7 +4247,7 @@ void ARMATURE_OT_align(wmOperatorType *ot)
 	ot->poll = ED_operator_editarmature;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ***************** Pose tools ********************* */
@@ -4254,11 +4257,11 @@ static int bone_looper(Object *ob, Bone *bone, void *data,
 				int (*bone_func)(Object *, Bone *, void *)) 
 {
 	/* We want to apply the function bone_func to every bone 
-	* in an armature -- feed bone_looper the first bone and 
-	* a pointer to the bone_func and watch it go!. The int count 
-	* can be useful for counting bones with a certain property
-	* (e.g. skinnable)
-	*/
+	 * in an armature -- feed bone_looper the first bone and 
+	 * a pointer to the bone_func and watch it go!. The int count 
+	 * can be useful for counting bones with a certain property
+	 * (e.g. skinnable)
+	 */
 	int count = 0;
 	
 	if (bone) {
@@ -4269,8 +4272,8 @@ static int bone_looper(Object *ob, Bone *bone, void *data,
 		count += bone_looper(ob, bone->childbase.first, data, bone_func);
 		
 		/* try to execute bone_func for the next bone at this
-			* depth of the recursion.
-			*/
+		 * depth of the recursion.
+		 */
 		count += bone_looper(ob, bone->next, data, bone_func);
 	}
 	
@@ -4297,7 +4300,7 @@ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, shor
 		 * armature object was not active yet.
 		 * note, special exception for armature mode so we can do multi-select
 		 * we could check for multi-select explicitly but think its fine to
-		 * always give pradictable behavior in weight paint mode - campbell */
+		 * always give predictable behavior in weight paint mode - campbell */
 		if (!extend || ((ob_act && (ob_act != ob) && (ob_act->mode & OB_MODE_WEIGHT_PAINT)==0))) {
 			ED_pose_deselectall(ob, 0);
 			nearBone->flag |= (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
@@ -4309,7 +4312,7 @@ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, shor
 		else {
 			if (nearBone->flag & BONE_SELECTED) {
 				/* if not active, we make it active */
-				if(nearBone != arm->act_bone) {
+				if (nearBone != arm->act_bone) {
 					arm->act_bone= nearBone;
 				}
 				else {
@@ -4342,10 +4345,10 @@ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, shor
 }
 
 /* test==0: deselect all
-   test==1: swap select (apply to all the opposite of current situation) 
-   test==2: only clear active tag
-   test==3: swap select (no test / inverse selection status of all independently)
-*/
+ * test==1: swap select (apply to all the opposite of current situation) 
+ * test==2: only clear active tag
+ * test==3: swap select (no test / inverse selection status of all independently)
+ */
 void ED_pose_deselectall (Object *ob, int test)
 {
 	bArmature *arm= ob->data;
@@ -4413,7 +4416,7 @@ static int bone_skinnable_cb(Object *ob, Bone *bone, void *datap)
 	int a, segments;
 	struct { Object *armob; void *list; int heat; } *data = datap;
 
-	if(!(ob->mode & OB_MODE_WEIGHT_PAINT) || !(bone->flag & BONE_HIDDEN_P)) {
+	if (!(ob->mode & OB_MODE_WEIGHT_PAINT) || !(bone->flag & BONE_HIDDEN_P)) {
 		if (!(bone->flag & BONE_NO_DEFORM)) {
 			if (data->heat && data->armob->pose && get_pose_channel(data->armob->pose, bone->name))
 				segments = bone->segments;
@@ -4437,9 +4440,9 @@ static int bone_skinnable_cb(Object *ob, Bone *bone, void *datap)
 static int vgroup_add_unique_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr)) 
 {
 	/* This group creates a vertex group to ob that has the
-	  * same name as bone (provided the bone is skinnable). 
+	 * same name as bone (provided the bone is skinnable). 
 	 * If such a vertex group aleady exist the routine exits.
-	  */
+	 */
 	if (!(bone->flag & BONE_NO_DEFORM)) {
 		if (!defgroup_find_name(ob,bone->name)) {
 			ED_vgroup_add_name(ob, bone->name);
@@ -4487,7 +4490,7 @@ static int dgroup_skinnable_cb(Object *ob, Bone *bone, void *datap)
 			else
 				segments = 1;
 
-			if(!wpmode || ((arm->layer & bone->layer) && (bone->flag & BONE_SELECTED)))
+			if (!wpmode || ((arm->layer & bone->layer) && (bone->flag & BONE_SELECTED)))
 				if (!(defgroup = defgroup_find_name(ob, bone->name)))
 					defgroup = ED_vgroup_add_name(ob, bone->name);
 			
@@ -4505,7 +4508,8 @@ static int dgroup_skinnable_cb(Object *ob, Bone *bone, void *datap)
 	return 0;
 }
 
-static void add_vgroups__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
+static void add_vgroups__mapFunc(void *userData, int index, const float co[3],
+                                 const float UNUSED(no_f[3]), const short UNUSED(no_s[3]))
 {
 	/* DerivedMesh mapFunc for getting final coords in weight paint mode */
 
@@ -4688,7 +4692,7 @@ static void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob,
 	}
 	else if (modifiers_findByType(ob, eModifierType_Subsurf)) {
 		/* is subsurf on? Lets use the verts on the limit surface then.
-		  * = same amount of vertices as mesh, but vertices  moved to the
+		 * = same amount of vertices as mesh, but vertices  moved to the
 		 * subsurfed position, like for 'optimal'. */
 		subsurf_calculate_limit_positions(mesh, verts);
 		vertsfilled = 1;
@@ -4707,7 +4711,7 @@ static void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob,
 		heat_bone_weighting(ob, mesh, verts, numbones, dgrouplist, dgroupflip,
 			root, tip, selected, &error);
 		
-		if(error) {
+		if (error) {
 			BKE_report(reports, RPT_WARNING, error);
 		}
 	}
@@ -4736,16 +4740,16 @@ void create_vgroups_from_armature(ReportList *reports, Scene *scene, Object *ob,
 	 */
 	bArmature *arm= par->data;
 
-	if(mode == ARM_GROUPS_NAME) {
+	if (mode == ARM_GROUPS_NAME) {
 		/* Traverse the bone list, trying to create empty vertex 
-		 * groups cooresponding to the bone.
+		 * groups corresponding to the bone.
 		 */
 		bone_looper(ob, arm->bonebase.first, NULL, vgroup_add_unique_bone_cb);
 
 		if (ob->type == OB_MESH)
 			ED_vgroup_data_create(ob->data);
 	}
-	else if(mode == ARM_GROUPS_ENVELOPE || mode == ARM_GROUPS_AUTO) {
+	else if (mode == ARM_GROUPS_ENVELOPE || mode == ARM_GROUPS_AUTO) {
 		/* Traverse the bone list, trying to create vertex groups 
 		 * that are populated with the vertices for which the
 		 * bone is closest.
@@ -4895,7 +4899,7 @@ static int pose_clear_transform_generic_exec(bContext *C, wmOperator *op,
 	short autokey = 0;
 	
 	/* sanity checks */
-	if ELEM(NULL, clear_func, default_ksName) {
+	if (ELEM(NULL, clear_func, default_ksName)) {
 		BKE_report(op->reports, RPT_ERROR, "Programming error: missing clear transform func or Keying Set Name");
 		return OPERATOR_CANCELLED;
 	}
@@ -4954,8 +4958,8 @@ static int pose_clear_scale_exec(bContext *C, wmOperator *op)
 void POSE_OT_scale_clear(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear Pose Scale";
-	ot->idname= "POSE_OT_scale_clear";
+	ot->name = "Clear Pose Scale";
+	ot->idname = "POSE_OT_scale_clear";
 	ot->description = "Reset scaling of selected bones to their default values";
 	
 	/* api callbacks */
@@ -4963,7 +4967,7 @@ void POSE_OT_scale_clear(wmOperatorType *ot)
 	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 
@@ -4975,8 +4979,8 @@ static int pose_clear_rot_exec(bContext *C, wmOperator *op)
 void POSE_OT_rot_clear(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear Pose Rotation";
-	ot->idname= "POSE_OT_rot_clear";
+	ot->name = "Clear Pose Rotation";
+	ot->idname = "POSE_OT_rot_clear";
 	ot->description = "Reset rotations of selected bones to their default values";
 	
 	/* api callbacks */
@@ -4984,7 +4988,7 @@ void POSE_OT_rot_clear(wmOperatorType *ot)
 	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 
@@ -4996,8 +5000,8 @@ static int pose_clear_loc_exec(bContext *C, wmOperator *op)
 void POSE_OT_loc_clear(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear Pose Location";
-	ot->idname= "POSE_OT_loc_clear";
+	ot->name = "Clear Pose Location";
+	ot->idname = "POSE_OT_loc_clear";
 	ot->description = "Reset locations of selected bones to their default values";
 	
 	/* api callbacks */
@@ -5005,7 +5009,7 @@ void POSE_OT_loc_clear(wmOperatorType *ot)
 	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 
@@ -5017,8 +5021,8 @@ static int pose_clear_transforms_exec(bContext *C, wmOperator *op)
 void POSE_OT_transforms_clear(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear Pose Transforms";
-	ot->idname= "POSE_OT_transforms_clear";
+	ot->name = "Clear Pose Transforms";
+	ot->idname = "POSE_OT_transforms_clear";
 	ot->description = "Reset location, rotation, and scaling of selected bones to their default values";
 	
 	/* api callbacks */
@@ -5026,7 +5030,7 @@ void POSE_OT_transforms_clear(wmOperatorType *ot)
 	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ***************** selections ********************** */
@@ -5078,16 +5082,16 @@ static int pose_de_select_all_exec(bContext *C, wmOperator *op)
 void POSE_OT_select_all(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select or Deselect All";
-	ot->idname= "POSE_OT_select_all";
-	ot->description= "Toggle selection status of all bones";
+	ot->name = "(De)select All";
+	ot->idname = "POSE_OT_select_all";
+	ot->description = "Toggle selection status of all bones";
 	
 	/* api callbacks */
-	ot->exec= pose_de_select_all_exec;
-	ot->poll= ED_operator_posemode;
+	ot->exec = pose_de_select_all_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	WM_operator_properties_select_all(ot);
 }
@@ -5122,16 +5126,16 @@ static int pose_select_parent_exec(bContext *C, wmOperator *UNUSED(op))
 void POSE_OT_select_parent(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Parent Bone";
-	ot->idname= "POSE_OT_select_parent";
-	ot->description= "Select bones that are parents of the currently selected bones";
+	ot->name = "Select Parent Bone";
+	ot->idname = "POSE_OT_select_parent";
+	ot->description = "Select bones that are parents of the currently selected bones";
 
 	/* api callbacks */
-	ot->exec= pose_select_parent_exec;
-	ot->poll= ED_operator_posemode;
+	ot->exec = pose_select_parent_exec;
+	ot->poll = ED_operator_posemode;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 }
 
@@ -5145,7 +5149,7 @@ static int hide_selected_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr))
 		if (bone->flag & BONE_SELECTED) {
 			bone->flag |= BONE_HIDDEN_P;
 			bone->flag &= ~BONE_SELECTED;
-			if(arm->act_bone==bone)
+			if (arm->act_bone==bone)
 				arm->act_bone= NULL;
 		}
 	}
@@ -5160,7 +5164,7 @@ static int hide_unselected_pose_bone_cb(Object *ob, Bone *bone, void *UNUSED(ptr
 		// hrm... typo here?
 		if ((bone->flag & BONE_SELECTED)==0) {
 			bone->flag |= BONE_HIDDEN_P;
-			if(arm->act_bone==bone)
+			if (arm->act_bone==bone)
 				arm->act_bone= NULL;
 		}
 	}
@@ -5173,7 +5177,7 @@ static int pose_hide_exec(bContext *C, wmOperator *op)
 	Object *ob= object_pose_armature_get(CTX_data_active_object(C));
 	bArmature *arm= ob->data;
 
-	if(RNA_boolean_get(op->ptr, "unselected"))
+	if (RNA_boolean_get(op->ptr, "unselected"))
 		bone_looper(ob, arm->bonebase.first, NULL, hide_unselected_pose_bone_cb);
 	else
 		bone_looper(ob, arm->bonebase.first, NULL, hide_selected_pose_bone_cb);
@@ -5187,16 +5191,16 @@ static int pose_hide_exec(bContext *C, wmOperator *op)
 void POSE_OT_hide(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Hide Selected";
-	ot->idname= "POSE_OT_hide";
-	ot->description= "Tag selected bones to not be visible in Pose Mode";
+	ot->name = "Hide Selected";
+	ot->idname = "POSE_OT_hide";
+	ot->description = "Tag selected bones to not be visible in Pose Mode";
 	
 	/* api callbacks */
-	ot->exec= pose_hide_exec;
-	ot->poll= ED_operator_posemode;
+	ot->exec = pose_hide_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* props */
 	RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "");
@@ -5233,16 +5237,16 @@ static int pose_reveal_exec(bContext *C, wmOperator *UNUSED(op))
 void POSE_OT_reveal(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Reveal Selected";
-	ot->idname= "POSE_OT_reveal";
-	ot->description= "Unhide all bones that have been tagged to be hidden in Pose Mode";
+	ot->name = "Reveal Selected";
+	ot->idname = "POSE_OT_reveal";
+	ot->description = "Unhide all bones that have been tagged to be hidden in Pose Mode";
 	
 	/* api callbacks */
-	ot->exec= pose_reveal_exec;
-	ot->poll= ED_operator_posemode;
+	ot->exec = pose_reveal_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ************* RENAMING DISASTERS ************ */
@@ -5293,7 +5297,7 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n
 	char oldname[MAXBONENAME];
 	
 	/* names better differ! */
-	if(strncmp(oldnamep, newnamep, MAXBONENAME)) {
+	if (strncmp(oldnamep, newnamep, MAXBONENAME)) {
 		
 		/* we alter newname string... so make copy */
 		BLI_strncpy(newname, newnamep, MAXBONENAME);
@@ -5368,7 +5372,7 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n
 			
 			if (modifiers_usesArmature(ob, arm)) { 
 				bDeformGroup *dg= defgroup_find_name(ob, oldname);
-				if(dg) {
+				if (dg) {
 					BLI_strncpy(dg->name, newname, MAXBONENAME);
 				}
 			}
@@ -5390,20 +5394,23 @@ void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *n
 		/* Fix all animdata that may refer to this bone - we can't just do the ones attached to objects, since
 		 * other ID-blocks may have drivers referring to this bone [#29822]
 		 */
-		BKE_all_animdata_fix_paths_rename("pose.bones", oldname, newname);
+		{
+			
+			BKE_all_animdata_fix_paths_rename(&arm->id, "pose.bones", oldname, newname);
+		}
 		
 		/* correct view locking */
 		{
 			bScreen *screen;
-			for(screen= G.main->screen.first; screen; screen= screen->id.next) {
+			for (screen= G.main->screen.first; screen; screen= screen->id.next) {
 				ScrArea *sa;
 				/* add regions */
-				for(sa= screen->areabase.first; sa; sa= sa->next) {
+				for (sa= screen->areabase.first; sa; sa= sa->next) {
 					SpaceLink *sl;
 					for (sl= sa->spacedata.first; sl; sl= sl->next) {
-						if(sl->spacetype==SPACE_VIEW3D) {
+						if (sl->spacetype==SPACE_VIEW3D) {
 							View3D *v3d= (View3D *)sl;
-							if(v3d->ob_centre && v3d->ob_centre->data == arm) {
+							if (v3d->ob_centre && v3d->ob_centre->data == arm) {
 								if (!strcmp(v3d->ob_centre_bone, oldname)) {
 									BLI_strncpy(v3d->ob_centre_bone, newname, MAXBONENAME);
 								}
@@ -5448,16 +5455,16 @@ static int armature_flip_names_exec (bContext *C, wmOperator *UNUSED(op))
 void ARMATURE_OT_flip_names (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Flip Names";
-	ot->idname= "ARMATURE_OT_flip_names";
-	ot->description= "Flips (and corrects) the axis suffixes of the names of selected bones";
+	ot->name = "Flip Names";
+	ot->idname = "ARMATURE_OT_flip_names";
+	ot->description = "Flips (and corrects) the axis suffixes of the names of selected bones";
 	
 	/* api callbacks */
-	ot->exec= armature_flip_names_exec;
-	ot->poll= ED_operator_editarmature;
+	ot->exec = armature_flip_names_exec;
+	ot->poll = ED_operator_editarmature;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 
@@ -5477,7 +5484,7 @@ static int armature_autoside_names_exec (bContext *C, wmOperator *op)
 	CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones)
 	{
 		BLI_strncpy(newname, ebone->name, sizeof(newname));
-		if(bone_autoside_name(newname, 1, axis, ebone->head[axis], ebone->tail[axis]))
+		if (bone_autoside_name(newname, 1, axis, ebone->head[axis], ebone->tail[axis]))
 			ED_armature_bone_rename(arm, ebone->name, newname);
 	}
 	CTX_DATA_END;
@@ -5500,20 +5507,20 @@ void ARMATURE_OT_autoside_names (wmOperatorType *ot)
 		{0, NULL, 0, NULL, NULL}};
 	
 	/* identifiers */
-	ot->name= "AutoName by Axis";
-	ot->idname= "ARMATURE_OT_autoside_names";
-	ot->description= "Automatically renames the selected bones according to which side of the target axis they fall on";
+	ot->name = "AutoName by Axis";
+	ot->idname = "ARMATURE_OT_autoside_names";
+	ot->description = "Automatically renames the selected bones according to which side of the target axis they fall on";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= armature_autoside_names_exec;
-	ot->poll= ED_operator_editarmature;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = armature_autoside_names_exec;
+	ot->poll = ED_operator_editarmature;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* settings */
-	ot->prop= RNA_def_enum(ot->srna, "type", axis_items, 0, "Axis", "Axis tag names with");
+	ot->prop = RNA_def_enum(ot->srna, "type", axis_items, 0, "Axis", "Axis tag names with");
 }
 
 
@@ -5557,8 +5564,7 @@ void transform_armature_mirror_update(Object *obedit)
 					eboflip->roll= -ebo->roll;
 					
 					/* Also move connected parent, in case parent's name isn't mirrored properly */
-					if (eboflip->parent && eboflip->flag & BONE_CONNECTED)
-					{
+					if (eboflip->parent && eboflip->flag & BONE_CONNECTED) {
 						EditBone *parent = eboflip->parent;
 						copy_v3_v3(parent->tail, eboflip->head);
 						parent->rad_tail = ebo->rad_head;
@@ -5589,8 +5595,7 @@ EditBone * subdivideByAngle(Scene *scene, Object *obedit, ReebArc *arc, ReebNode
 	bArmature *arm= obedit->data;
 	EditBone *lastBone = NULL;
 	
-	if (scene->toolsettings->skgen_options & SKGEN_CUT_ANGLE)
-	{
+	if (scene->toolsettings->skgen_options & SKGEN_CUT_ANGLE) {
 		ReebArcIterator arc_iter;
 		BArcIterator *iter = (BArcIterator*)&arc_iter;
 		float *previous = NULL, *current = NULL;
@@ -5624,8 +5629,7 @@ EditBone * subdivideByAngle(Scene *scene, Object *obedit, ReebArc *arc, ReebNode
 			len1 = normalize_v3(vec1);
 			len2 = normalize_v3(vec2);
 
-			if (len1 > 0.0f && len2 > 0.0f && dot_v3v3(vec1, vec2) < angleLimit)
-			{
+			if (len1 > 0.0f && len2 > 0.0f && dot_v3v3(vec1, vec2) < angleLimit) {
 				copy_v3_v3(parent->tail, previous);
 
 				child = ED_armature_edit_bone_add(arm, "Bone");
@@ -5641,9 +5645,8 @@ EditBone * subdivideByAngle(Scene *scene, Object *obedit, ReebArc *arc, ReebNode
 		/* If the bone wasn't subdivided, delete it and return NULL
 		 * to let subsequent subdivision methods do their thing. 
 		 * */
-		if (parent == root)
-		{
-			if(parent==arm->act_edbone) arm->act_edbone= NULL;
+		if (parent == root) {
+			if (parent==arm->act_edbone) arm->act_edbone= NULL;
 			ED_armature_edit_bone_remove(arm, parent);
 			parent = NULL;
 		}
@@ -5658,8 +5661,7 @@ EditBone * test_subdivideByCorrelation(Scene *scene, Object *obedit, ReebArc *ar
 {
 	EditBone *lastBone = NULL;
 
-	if (scene->toolsettings->skgen_options & SKGEN_CUT_CORRELATION)
-	{
+	if (scene->toolsettings->skgen_options & SKGEN_CUT_CORRELATION) {
 		float invmat[4][4]= MAT4_UNITY;
 		float tmat[3][3]= MAT3_UNITY;
 		ReebArcIterator arc_iter;
@@ -5682,19 +5684,16 @@ float arcLengthRatio(ReebArc *arc)
 	
 	arcLength = len_v3v3(arc->head->p, arc->tail->p);
 	
-	if (arc->bcount > 0)
-	{
+	if (arc->bcount > 0) {
 		/* Add the embedding */
-		for ( i = 1; i < arc->bcount; i++)
-		{
+		for ( i = 1; i < arc->bcount; i++) {
 			embedLength += len_v3v3(arc->buckets[i - 1].p, arc->buckets[i].p);
 		}
 		/* Add head and tail -> embedding vectors */
 		embedLength += len_v3v3(arc->head->p, arc->buckets[0].p);
 		embedLength += len_v3v3(arc->tail->p, arc->buckets[arc->bcount - 1].p);
 	}
-	else
-	{
+	else {
 		embedLength = arcLength;
 	}
 	
@@ -5734,8 +5733,7 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg)
 	
 	src = scene->basact->object;
 	
-	if (obedit != NULL)
-	{
+	if (obedit != NULL) {
 		ED_armature_from_edit(obedit);
 		ED_armature_edit_free(obedit);
 	}
@@ -5772,32 +5770,28 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg)
 		 * Finally, the arc direction is stored in its flag: 1 (low -> high), -1 (high -> low)
 		 */
 
-		/* if arc is a symmetry axis, internal bones go up the tree */		
-		if (arc->symmetry_level == 1 && arc->tail->degree != 1)
-		{
+		/* if arc is a symmetry axis, internal bones go up the tree */
+		if (arc->symmetry_level == 1 && arc->tail->degree != 1) {
 			head = arc->tail;
 			tail = arc->head;
 			
 			arc->flag = -1; /* mark arc direction */
 		}
 		/* Bones point AWAY from the symmetry axis */
-		else if (arc->head->symmetry_level == 1)
-		{
+		else if (arc->head->symmetry_level == 1) {
 			head = arc->head;
 			tail = arc->tail;
 			
 			arc->flag = 1; /* mark arc direction */
 		}
-		else if (arc->tail->symmetry_level == 1)
-		{
+		else if (arc->tail->symmetry_level == 1) {
 			head = arc->tail;
 			tail = arc->head;
 			
 			arc->flag = -1; /* mark arc direction */
 		}
 		/* otherwise, always go from low weight to high weight */
-		else
-		{
+		else {
 			head = arc->head;
 			tail = arc->tail;
 			
@@ -5805,10 +5799,8 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg)
 		}
 		
 		/* Loop over subdivision methods */	
-		for (i = 0; lastBone == NULL && i < SKGEN_SUB_TOTAL; i++)
-		{
-			switch(scene->toolsettings->skgen_subdivisions[i])
-			{
+		for (i = 0; lastBone == NULL && i < SKGEN_SUB_TOTAL; i++) {
+			switch(scene->toolsettings->skgen_subdivisions[i]) {
 				case SKGEN_SUB_LENGTH:
 					lastBone = test_subdivideByLength(scene, obedit, arc, head, tail);
 					break;
@@ -5821,8 +5813,7 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg)
 			}
 		}
 	
-		if (lastBone == NULL)
-		{
+		if (lastBone == NULL) {
 			EditBone	*bone;
 			bone = ED_armature_edit_bone_add(obedit->data, "Bone");
 			bone->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
@@ -5843,20 +5834,18 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg)
 		ReebArc *incomingArc = NULL;
 		int i;
 
-		for (i = 0; i < node->degree; i++)
-		{
+		for (i = 0; i < node->degree; i++) {
 			arc = (ReebArc*)node->arcs[i];
 
 			/* if arc is incoming into the node */
-			if ((arc->head == node && arc->flag == -1) || (arc->tail == node && arc->flag == 1))
+			if ((arc->head == node && arc->flag == -1) ||
+			    (arc->tail == node && arc->flag ==  1))
 			{
-				if (incomingArc == NULL)
-				{
+				if (incomingArc == NULL) {
 					incomingArc = arc;
 					/* loop further to make sure there's only one incoming arc */
 				}
-				else
-				{
+				else {
 					/* skip this node if more than one incomingArc */
 					incomingArc = NULL;
 					break; /* No need to look further, we are skipping already */
@@ -5864,8 +5853,7 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg)
 			}
 		}
 
-		if (incomingArc != NULL)
-		{
+		if (incomingArc != NULL) {
 			EditBone *parentBone = BLI_ghash_lookup(arcBoneMap, incomingArc);
 
 			/* Look for outgoing arcs and parent their bones */
@@ -5874,12 +5862,11 @@ void generateSkeletonFromReebGraph(Scene *scene, ReebGraph *rg)
 				arc = node->arcs[i];
 
 				/* if arc is outgoing from the node */
-				if ((arc->head == node && arc->flag == 1) || (arc->tail == node && arc->flag == -1))
-				{
+				if ((arc->head == node && arc->flag == 1) || (arc->tail == node && arc->flag == -1)) {
 					EditBone *childBone = BLI_ghash_lookup(arcBoneMap, arc);
 
 					/* find the root bone */
-					while(childBone->parent != NULL)
+					while (childBone->parent != NULL)
 					{
 						childBone = childBone->parent;
 					}
diff --git a/source/blender/editors/armature/editarmature_generate.c b/source/blender/editors/armature/editarmature_generate.c
index 3d02006..37d0952 100644
--- a/source/blender/editors/armature/editarmature_generate.c
+++ b/source/blender/editors/armature/editarmature_generate.c
@@ -161,9 +161,8 @@ int nextFixedSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int sta
 
 		current_length += len_v3v3(v1, v2);
 
-		if (current_length >= length_threshold)
-		{
-			VECCOPY(p, v2);
+		if (current_length >= length_threshold) {
+			copy_v3_v3(p, v2);
 			return i;
 		}
 		
@@ -190,10 +189,9 @@ int nextAdaptativeSubdivision(ToolSettings *toolsettings, BArcIterator *iter, in
 		IT_peek(iter, i);
 		sub_v3_v3v3(n, iter->p, head);
 
-		if (calcArcCorrelation(iter, start, i, start_p, n) < correlation_threshold)
-		{
+		if (calcArcCorrelation(iter, start, i, start_p, n) < correlation_threshold) {
 			IT_peek(iter, i - 1);
-			VECCOPY(p, iter->p);
+			copy_v3_v3(p, iter->p);
 			return i - 1;
 		}
 	}
@@ -240,25 +238,22 @@ int nextLengthSubdivision(ToolSettings *toolsettings, BArcIterator *iter, int st
 				
 				//printf("a %f, b %f, c %f, f %f\n", a, b, c, f);
 				
-				if (isnan(f) == 0 && f < 1.0f)
-				{
-					VECCOPY(p, dv);
+				if (isnan(f) == 0 && f < 1.0f) {
+					copy_v3_v3(p, dv);
 					mul_v3_fl(p, f);
 					add_v3_v3(p, vec0);
 				}
-				else
-				{
-					VECCOPY(p, vec1);
+				else {
+					copy_v3_v3(p, vec1);
 				}
 			}
-			else
-			{
+			else {
 				float dv[3];
 				
 				sub_v3_v3v3(dv, vec1, vec0);
 				normalize_v3(dv);
 				 
-				VECCOPY(p, dv);
+				copy_v3_v3(p, dv);
 				mul_v3_fl(p, lengthLimit);
 				add_v3_v3(p, head);
 			}
@@ -289,7 +284,7 @@ EditBone * subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase *
 	IT_head(iter);
 	
 	parent = ED_armature_edit_bone_add(arm, "Bone");
-	VECCOPY(parent->head, iter->p);
+	copy_v3_v3(parent->head, iter->p);
 	
 	if (iter->size > 0)
 	{
@@ -304,7 +299,7 @@ EditBone * subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase *
 		IT_peek(iter, index);
 
 		child = ED_armature_edit_bone_add(arm, "Bone");
-		VECCOPY(child->head, parent->tail);
+		copy_v3_v3(child->head, parent->tail);
 		child->parent = parent;
 		child->flag |= BONE_CONNECTED;
 		
@@ -329,9 +324,8 @@ EditBone * subdivideArcBy(ToolSettings *toolsettings, bArmature *arm, ListBase *
 	
 	iter->tail(iter);
 
-	VECCOPY(parent->tail, iter->p);
-	if (iter->size > 0)
-	{
+	copy_v3_v3(parent->tail, iter->p);
+	if (iter->size > 0) {
 		parent->rad_tail = iter->size * size_buffer;
 	}
 		
diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c
index a8978a0..f554b7b 100644
--- a/source/blender/editors/armature/editarmature_retarget.c
+++ b/source/blender/editors/armature/editarmature_retarget.c
@@ -43,7 +43,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
-#include "BLI_editVert.h"
 #include "BLI_utildefines.h"
 #include "BLI_ghash.h"
 #include "BLI_graph.h"
@@ -324,7 +323,7 @@ static RigGraph *newRigGraph(void)
 	rg->free_node = NULL;
 	
 #ifdef USE_THREADS
-//	if(G.scene->r.mode & R_FIXED_THREADS)
+//	if (G.scene->r.mode & R_FIXED_THREADS)
 //	{
 //		totthread = G.scene->r.threads;
 //	}
@@ -1009,7 +1008,7 @@ static void RIG_reconnectControlBones(RigGraph *rg)
 			/* look on deform bones first */
 			BLI_ghashIterator_init(&ghi, rg->bones_map);
 			
-			for( ; !BLI_ghashIterator_isDone(&ghi); BLI_ghashIterator_step(&ghi))
+			for ( ; !BLI_ghashIterator_isDone(&ghi); BLI_ghashIterator_step(&ghi))
 			{
 				EditBone *bone = (EditBone*)BLI_ghashIterator_getValue(&ghi);
 				
@@ -1299,7 +1298,7 @@ static void RIG_arcFromBoneChain(RigGraph *rg, ListBase *list, EditBone *root_bo
 	RigArc *arc = NULL;
 	int contain_head = 0;
 	
-	for(bone = root_bone; bone; bone = nextEditBoneChild(list, bone, 0))
+	for (bone = root_bone; bone; bone = nextEditBoneChild(list, bone, 0))
 	{
 		int nb_children;
 		
@@ -1551,7 +1550,7 @@ RigGraph *RIG_graphFromArmature(const bContext *C, Object *ob, bArmature *arm)
 	rg->ob = ob;
 
 	/* Do the rotations */
-	for (ebone = rg->editbones->first; ebone; ebone=ebone->next){
+	for (ebone = rg->editbones->first; ebone; ebone=ebone->next) {
 		if (ebone->parent == NULL)
 		{
 			RIG_arcFromBoneChain(rg, rg->editbones, ebone, NULL, 0);
@@ -1603,7 +1602,7 @@ static RigGraph *armatureSelectedToGraph(bContext *C, Object *ob, bArmature *arm
 	rg->ob = ob;
 
 	/* Do the rotations */
-	for (ebone = rg->editbones->first; ebone; ebone=ebone->next){
+	for (ebone = rg->editbones->first; ebone; ebone=ebone->next) {
 		if (ebone->parent == NULL)
 		{
 			RIG_arcFromBoneChain(rg, rg->editbones, ebone, NULL, 1);
@@ -2489,7 +2488,7 @@ static void markMultiResolutionChildArc(ReebNode *end_enode, ReebNode *enode)
 {
 	int i;
 	
-	for(i = 0; i < enode->degree; i++)
+	for (i = 0; i < enode->degree; i++)
 	{
 		ReebArc *earc = (ReebArc*)enode->arcs[i];
 		
@@ -2594,7 +2593,7 @@ static void findCorrespondingArc(RigGraph *rigg, RigArc *start_arc, RigNode *sta
 //		RIG_printArcBones(next_iarc);
 //	}
 	
-	for(i = 0; i < enode->degree; i++)
+	for (i = 0; i < enode->degree; i++)
 	{
 		next_earc = (ReebArc*)enode->arcs[i];
 		
@@ -2645,20 +2644,20 @@ static void findCorrespondingArc(RigGraph *rigg, RigArc *start_arc, RigNode *sta
 //		printf("flag %i -- level %i -- flag %i -- group %i\n", ARC_FREE, symmetry_level, symmetry_flag, symmetry_group);
 //		
 //		printf("CANDIDATES\n");
-//		for(i = 0; i < enode->degree; i++)
+//		for (i = 0; i < enode->degree; i++)
 //		{
 //			next_earc = (ReebArc*)enode->arcs[i];
 //			printf("flag %i -- level %i -- flag %i -- group %i\n", next_earc->flag, next_earc->symmetry_level, next_earc->symmetry_flag, next_earc->symmetry_group);
 //		}
 		
 		/* Emergency matching */
-		for(i = 0; i < enode->degree; i++)
+		for (i = 0; i < enode->degree; i++)
 		{
 			next_earc = (ReebArc*)enode->arcs[i];
 			
 			if (next_earc->flag == ARC_FREE && next_earc->symmetry_level == symmetry_level)
 			{
-//				printf("USING: \n");
+//				printf("USING:\n");
 //				printf("flag %i -- level %i -- flag %i -- group %i\n", next_earc->flag, next_earc->symmetry_level, next_earc->symmetry_flag, next_earc->symmetry_group);
 				matchMultiResolutionArc(rigg, start_node, next_iarc, next_earc);
 				break;
@@ -2688,7 +2687,7 @@ static void retargetSubgraph(bContext *C, RigGraph *rigg, RigArc *start_arc, Rig
 		matchMultiResolutionNode(rigg, inode, enode);
 	}
 	
-	for(i = 0; i < inode->degree; i++)
+	for (i = 0; i < inode->degree; i++)
 	{
 		RigArc *next_iarc = (RigArc*)inode->arcs[i];
 		
@@ -2902,12 +2901,10 @@ void BIF_retargetArc(bContext *C, ReebArc *earc, RigGraph *template_rigg)
 	char *num_string = scene->toolsettings->skgen_num_string;
 	int free_template = 0;
 	
-	if (template_rigg)
-	{
-		ob = template_rigg->ob; 	
+	if (template_rigg) {
+		ob = template_rigg->ob;
 	}
-	else
-	{
+	else {
 		free_template = 1;
 		ob = obedit;
 		template_rigg = armatureSelectedToGraph(C, ob, ob->data);
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index f16771b..81b020a 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -1008,7 +1008,7 @@ static void sk_interpolateDepth(bContext *C, SK_Stroke *stk, int start, int end,
 		mul_v3_fl(ray_normal, distance * progress / length);
 		add_v3_v3(stk->points[i].p, ray_normal);
 
-		progress += delta ;
+		progress += delta;
 	}
 }
 
@@ -1079,7 +1079,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
 
 		mvalf[0]= dd->mval[0];
 		mvalf[1]= dd->mval[1];
-		peelObjectsContext(C, &sketch->depth_peels, mvalf);
+		peelObjectsContext(C, &sketch->depth_peels, mvalf, SNAP_ALL);
 
 		if (stk->nb_points > 0 && stk->points[stk->nb_points - 1].type == PT_CONTINUOUS)
 		{
@@ -1799,7 +1799,7 @@ void sk_applyCutGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSED
 		SK_Point pt;
 
 		pt.type = PT_EXACT;
-		pt.mode = PT_PROJECT; /* take mode from neighbouring points */
+		pt.mode = PT_PROJECT; /* take mode from neighboring points */
 		copy_v3_v3(pt.p, isect->p);
 		copy_v3_v3(pt.no, isect->stroke->points[isect->before].no);
 
@@ -1841,7 +1841,7 @@ void sk_applyTrimGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UNUSE
 		float stroke_dir[3];
 
 		pt.type = PT_EXACT;
-		pt.mode = PT_PROJECT; /* take mode from neighbouring points */
+		pt.mode = PT_PROJECT; /* take mode from neighboring points */
 		copy_v3_v3(pt.p, isect->p);
 		copy_v3_v3(pt.no, isect->stroke->points[isect->before].no);
 
@@ -1870,7 +1870,7 @@ int sk_detectCommandGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UN
 		SK_Intersection *isect, *self_isect;
 
 		/* get the the last intersection of the first pair */
-		for( isect = gest->intersections.first; isect; isect = isect->next )
+		for ( isect = gest->intersections.first; isect; isect = isect->next )
 		{
 			if (isect->stroke == isect->next->stroke)
 			{
@@ -1897,7 +1897,7 @@ void sk_applyCommandGesture(bContext *UNUSED(C), SK_Gesture *gest, SK_Sketch *UN
 
 //	XXX
 //	command = pupmenu("Action %t|Flatten %x1|Straighten %x2|Polygonize %x3");
-	if(command < 1) return;
+	if (command < 1) return;
 
 	for (isect = gest->intersections.first; isect; isect = isect->next)
 	{
@@ -2166,10 +2166,10 @@ static int sk_selectStroke(bContext *C, SK_Sketch *sketch, const int mval[2], in
 
 	view3d_set_viewcontext(C, &vc);
 
-	rect.xmin= mval[0]-5;
-	rect.xmax= mval[0]+5;
-	rect.ymin= mval[1]-5;
-	rect.ymax= mval[1]+5;
+	rect.xmin = mval[0]-5;
+	rect.xmax = mval[0]+5;
+	rect.ymin = mval[1]-5;
+	rect.ymax = mval[1]+5;
 
 	hits = view3d_opengl_select(&vc, buffer, MAXPICKBUF, &rect);
 
@@ -2177,7 +2177,7 @@ static int sk_selectStroke(bContext *C, SK_Sketch *sketch, const int mval[2], in
 	{
 		int besthitresult = -1;
 
-		if(hits == 1) {
+		if (hits == 1) {
 			besthitresult = buffer[3];
 		}
 		else {
@@ -2839,130 +2839,130 @@ int ED_operator_sketch_mode(const bContext *C)
 void SKETCH_OT_delete(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "delete";
-	ot->idname= "SKETCH_OT_delete";
+	ot->name = "Delete";
+	ot->idname = "SKETCH_OT_delete";
 
 	/* api callbacks */
-	ot->invoke= sketch_delete;
+	ot->invoke = sketch_delete;
 
-	ot->poll= ED_operator_sketch_full_mode;
+	ot->poll = ED_operator_sketch_full_mode;
 
 	/* flags */
-//	ot->flag= OPTYPE_UNDO;
+//	ot->flag = OPTYPE_UNDO;
 }
 
 void SKETCH_OT_select(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "select";
-	ot->idname= "SKETCH_OT_select";
+	ot->name = "Select";
+	ot->idname = "SKETCH_OT_select";
 
 	/* api callbacks */
-	ot->invoke= sketch_select;
+	ot->invoke = sketch_select;
 
-	ot->poll= ED_operator_sketch_full_mode;
+	ot->poll = ED_operator_sketch_full_mode;
 
 	/* flags */
-//	ot->flag= OPTYPE_UNDO;
+//	ot->flag = OPTYPE_UNDO;
 }
 
 void SKETCH_OT_cancel_stroke(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "cancel stroke";
-	ot->idname= "SKETCH_OT_cancel_stroke";
+	ot->name = "Cancel Stroke";
+	ot->idname = "SKETCH_OT_cancel_stroke";
 
 	/* api callbacks */
-	ot->invoke= sketch_cancel;
+	ot->invoke = sketch_cancel;
 
-	ot->poll= ED_operator_sketch_mode_active_stroke;
+	ot->poll = ED_operator_sketch_mode_active_stroke;
 
 	/* flags */
-//	ot->flag= OPTYPE_UNDO;
+//	ot->flag = OPTYPE_UNDO;
 }
 
 void SKETCH_OT_convert(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "convert";
-	ot->idname= "SKETCH_OT_convert";
+	ot->name = "Convert";
+	ot->idname = "SKETCH_OT_convert";
 
 	/* api callbacks */
-	ot->invoke= sketch_convert;
+	ot->invoke = sketch_convert;
 
-	ot->poll= ED_operator_sketch_full_mode;
+	ot->poll = ED_operator_sketch_full_mode;
 
 	/* flags */
-	ot->flag= OPTYPE_UNDO;
+	ot->flag = OPTYPE_UNDO;
 }
 
 void SKETCH_OT_finish_stroke(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "end stroke";
-	ot->idname= "SKETCH_OT_finish_stroke";
+	ot->name = "End Stroke";
+	ot->idname = "SKETCH_OT_finish_stroke";
 
 	/* api callbacks */
-	ot->invoke= sketch_finish;
+	ot->invoke = sketch_finish;
 
-	ot->poll= ED_operator_sketch_mode_active_stroke;
+	ot->poll = ED_operator_sketch_mode_active_stroke;
 
 	/* flags */
-//	ot->flag= OPTYPE_UNDO;
+//	ot->flag = OPTYPE_UNDO;
 }
 
 void SKETCH_OT_draw_preview(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "draw preview";
-	ot->idname= "SKETCH_OT_draw_preview";
+	ot->name = "Draw Preview";
+	ot->idname = "SKETCH_OT_draw_preview";
 
 	/* api callbacks */
-	ot->invoke= sketch_draw_preview;
+	ot->invoke = sketch_draw_preview;
 
-	ot->poll= ED_operator_sketch_mode_active_stroke;
+	ot->poll = ED_operator_sketch_mode_active_stroke;
 
 	RNA_def_boolean(ot->srna, "snap", 0, "Snap", "");
 
 	/* flags */
-//	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+//	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 void SKETCH_OT_draw_stroke(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "draw stroke";
-	ot->idname= "SKETCH_OT_draw_stroke";
+	ot->name = "Draw Stroke";
+	ot->idname = "SKETCH_OT_draw_stroke";
 
 	/* api callbacks */
 	ot->invoke = sketch_draw_stroke;
 	ot->modal  = sketch_draw_stroke_modal;
 	ot->cancel = sketch_draw_stroke_cancel;
 
-	ot->poll= (int (*)(bContext *))ED_operator_sketch_mode;
+	ot->poll = (int (*)(bContext *))ED_operator_sketch_mode;
 
 	RNA_def_boolean(ot->srna, "snap", 0, "Snap", "");
 
 	/* flags */
-	ot->flag= OPTYPE_BLOCKING; // OPTYPE_REGISTER|OPTYPE_UNDO
+	ot->flag = OPTYPE_BLOCKING; // OPTYPE_REGISTER|OPTYPE_UNDO
 }
 
 void SKETCH_OT_gesture(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "gesture";
-	ot->idname= "SKETCH_OT_gesture";
+	ot->name = "Gesture";
+	ot->idname = "SKETCH_OT_gesture";
 
 	/* api callbacks */
 	ot->invoke = sketch_draw_gesture;
 	ot->modal  = sketch_draw_gesture_modal;
 	ot->cancel = sketch_draw_gesture_cancel;
 
-	ot->poll= ED_operator_sketch_mode_gesture;
+	ot->poll = ED_operator_sketch_mode_gesture;
 
 	RNA_def_boolean(ot->srna, "snap", 0, "Snap", "");
 
 	/* flags */
-	ot->flag= OPTYPE_BLOCKING; // OPTYPE_UNDO
+	ot->flag = OPTYPE_BLOCKING; // OPTYPE_UNDO
 }
 
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index 319b2c7..59a7437 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -41,18 +41,20 @@
 #include "DNA_meshdata_types.h"
 #include "DNA_scene_types.h"
 
+#include "BLI_utildefines.h"
 #include "BLI_math.h"
 #include "BLI_edgehash.h"
 #include "BLI_memarena.h"
-#include "BLI_utildefines.h"
 #include "BLI_string.h"
 
+#include "BLF_translation.h"
+
 #include "BKE_DerivedMesh.h"
 #include "BKE_modifier.h"
+#include "BKE_mesh.h"
 
 
 #ifdef RIGID_DEFORM
-#include "BLI_editVert.h"
 #include "BLI_polardecomp.h"
 #endif
 
@@ -129,18 +131,18 @@ struct LaplacianSystem {
 /* Laplacian matrix construction */
 
 /* Computation of these weights for the laplacian is based on:
-   "Discrete Differential-Geometry Operators for Triangulated 2-Manifolds",
-   Meyer et al, 2002. Section 3.5, formula (8).
-   
-   We do it a bit different by going over faces instead of going over each
-   vertex and adjacent faces, since we don't store this adjacency. Also, the
-   formulas are tweaked a bit to work for non-manifold meshes. */
+ * "Discrete Differential-Geometry Operators for Triangulated 2-Manifolds",
+ * Meyer et al, 2002. Section 3.5, formula (8).
+ * 
+ * We do it a bit different by going over faces instead of going over each
+ * vertex and adjacent faces, since we don't store this adjacency. Also, the
+ * formulas are tweaked a bit to work for non-manifold meshes. */
 
 static void laplacian_increase_edge_count(EdgeHash *edgehash, int v1, int v2)
 {
 	void **p = BLI_edgehash_lookup_p(edgehash, v1, v2);
 
-	if(p)
+	if (p)
 		*p = (void*)((intptr_t)*p + (intptr_t)1);
 	else
 		BLI_edgehash_insert(edgehash, v1, v2, (void*)(intptr_t)1);
@@ -181,9 +183,9 @@ static void laplacian_triangle_area(LaplacianSystem *sys, int i1, int i2, int i3
 	t2= cotan_weight(v2, v3, v1);
 	t3= cotan_weight(v3, v1, v2);
 
-	if(RAD2DEGF(angle_v3v3v3(v2, v1, v3)) > 90) obtuse= 1;
-	else if(RAD2DEGF(angle_v3v3v3(v1, v2, v3)) > 90) obtuse= 2;
-	else if(RAD2DEGF(angle_v3v3v3(v1, v3, v2)) > 90) obtuse= 3;
+	if      (angle_v3v3v3(v2, v1, v3) > DEG2RADF(90.0f)) obtuse= 1;
+	else if (angle_v3v3v3(v1, v2, v3) > DEG2RADF(90.0f)) obtuse= 2;
+	else if (angle_v3v3v3(v1, v3, v2) > DEG2RADF(90.0f)) obtuse= 3;
 
 	if (obtuse > 0) {
 		area= area_tri_v3(v1, v2, v3);
@@ -217,7 +219,7 @@ static void laplacian_triangle_weights(LaplacianSystem *sys, int f, int i1, int
 	v3= sys->verts[i3];
 
 	/* instead of *0.5 we divided by the number of faces of the edge, it still
-	   needs to be verified that this is indeed the correct thing to do! */
+	 * needs to be verified that this is indeed the correct thing to do! */
 	t1= cotan_weight(v1, v2, v3)/laplacian_edge_count(sys->edgehash, i2, i3);
 	t2= cotan_weight(v2, v3, v1)/laplacian_edge_count(sys->edgehash, i3, i1);
 	t3= cotan_weight(v3, v1, v2)/laplacian_edge_count(sys->edgehash, i1, i2);
@@ -235,7 +237,7 @@ static void laplacian_triangle_weights(LaplacianSystem *sys, int f, int i1, int
 	nlMatrixAdd(i3, i1, -t2*varea[i3]);
 	nlMatrixAdd(i1, i3, -t2*varea[i1]);
 
-	if(sys->storeweights) {
+	if (sys->storeweights) {
 		sys->fweights[f][0]= t1*varea[i1];
 		sys->fweights[f][1]= t2*varea[i2];
 		sys->fweights[f][2]= t3*varea[i3];
@@ -261,7 +263,7 @@ static LaplacianSystem *laplacian_system_construct_begin(int totvert, int totfac
 	/* create opennl context */
 	nlNewContext();
 	nlSolverParameteri(NL_NB_VARIABLES, totvert);
-	if(lsq)
+	if (lsq)
 		nlSolverParameteri(NL_LEAST_SQUARES, NL_TRUE);
 
 	sys->context= nlGetCurrent();
@@ -294,39 +296,39 @@ static void laplacian_system_construct_end(LaplacianSystem *sys)
 	sys->varea= MEM_callocN(sizeof(float)*totvert, "LaplacianSystemVarea");
 
 	sys->edgehash= BLI_edgehash_new();
-	for(a=0, face=sys->faces; a<sys->totface; a++, face++) {
+	for (a=0, face=sys->faces; a<sys->totface; a++, face++) {
 		laplacian_increase_edge_count(sys->edgehash, (*face)[0], (*face)[1]);
 		laplacian_increase_edge_count(sys->edgehash, (*face)[1], (*face)[2]);
 		laplacian_increase_edge_count(sys->edgehash, (*face)[2], (*face)[0]);
 	}
 
-	if(sys->areaweights)
-		for(a=0, face=sys->faces; a<sys->totface; a++, face++)
+	if (sys->areaweights)
+		for (a=0, face=sys->faces; a<sys->totface; a++, face++)
 			laplacian_triangle_area(sys, (*face)[0], (*face)[1], (*face)[2]);
 	
-	for(a=0; a<totvert; a++) {
-		if(sys->areaweights) {
-			if(sys->varea[a] != 0.0f)
+	for (a=0; a<totvert; a++) {
+		if (sys->areaweights) {
+			if (sys->varea[a] != 0.0f)
 				sys->varea[a]= 0.5f/sys->varea[a];
 		}
 		else
 			sys->varea[a]= 1.0f;
 
 		/* for heat weighting */
-		if(sys->heat.H)
+		if (sys->heat.H)
 			nlMatrixAdd(a, a, sys->heat.H[a]);
 	}
 
-	if(sys->storeweights)
+	if (sys->storeweights)
 		sys->fweights= MEM_callocN(sizeof(float)*3*totface, "LaplacianFWeight");
 	
-	for(a=0, face=sys->faces; a<totface; a++, face++)
+	for (a=0, face=sys->faces; a<totface; a++, face++)
 		laplacian_triangle_weights(sys, a, (*face)[0], (*face)[1], (*face)[2]);
 
 	MEM_freeN(sys->faces);
 	sys->faces= NULL;
 
-	if(sys->varea) {
+	if (sys->varea) {
 		MEM_freeN(sys->varea);
 		sys->varea= NULL;
 	}
@@ -337,11 +339,11 @@ static void laplacian_system_construct_end(LaplacianSystem *sys)
 
 static void laplacian_system_delete(LaplacianSystem *sys)
 {
-	if(sys->verts) MEM_freeN(sys->verts);
-	if(sys->varea) MEM_freeN(sys->varea);
-	if(sys->vpinned) MEM_freeN(sys->vpinned);
-	if(sys->faces) MEM_freeN(sys->faces);
-	if(sys->fweights) MEM_freeN(sys->fweights);
+	if (sys->verts) MEM_freeN(sys->verts);
+	if (sys->varea) MEM_freeN(sys->varea);
+	if (sys->vpinned) MEM_freeN(sys->vpinned);
+	if (sys->faces) MEM_freeN(sys->faces);
+	if (sys->fweights) MEM_freeN(sys->fweights);
 
 	nlDeleteContext(sys->context);
 	MEM_freeN(sys);
@@ -354,9 +356,9 @@ void laplacian_begin_solve(LaplacianSystem *sys, int index)
 	if (!sys->nlbegun) {
 		nlBegin(NL_SYSTEM);
 
-		if(index >= 0) {
-			for(a=0; a<sys->totvert; a++) {
-				if(sys->vpinned[a]) {
+		if (index >= 0) {
+			for (a=0; a<sys->totvert; a++) {
+				if (sys->vpinned[a]) {
 					nlSetVariable(0, a, sys->verts[a][index]);
 					nlLockVariable(a);
 				}
@@ -391,7 +393,7 @@ float laplacian_system_get_solution(int v)
 
 /************************* Heat Bone Weighting ******************************/
 /* From "Automatic Rigging and Animation of 3D Characters"
-		 Ilya Baran and Jovan Popovic, SIGGRAPH 2007 */
+ * Ilya Baran and Jovan Popovic, SIGGRAPH 2007 */
 
 #define C_WEIGHT			1.0f
 #define WEIGHT_LIMIT_START	0.05f
@@ -413,9 +415,9 @@ static void bvh_callback(void *userdata, int index, const BVHTreeRay *UNUSED(ray
 
 	mul_v3_v3fl(dir, data->vec, hit->dist);
 
-	if(isect_ray_tri_v3(data->start, dir, verts[mf->v1], verts[mf->v2], verts[mf->v3], &lambda, uv)) {
+	if (isect_ray_tri_v3(data->start, dir, verts[mf->v1], verts[mf->v2], verts[mf->v3], &lambda, uv)) {
 		normal_tri_v3(n, verts[mf->v1], verts[mf->v2], verts[mf->v3]);
-		if(lambda < 1.0f && dot_v3v3(n, data->vec) < -1e-5f) {
+		if (lambda < 1.0f && dot_v3v3(n, data->vec) < -1e-5f) {
 			hit->index = index;
 			hit->dist *= lambda;
 		}
@@ -423,9 +425,9 @@ static void bvh_callback(void *userdata, int index, const BVHTreeRay *UNUSED(ray
 
 	mul_v3_v3fl(dir, data->vec, hit->dist);
 
-	if(isect_ray_tri_v3(data->start, dir, verts[mf->v1], verts[mf->v3], verts[mf->v4], &lambda, uv)) {
+	if (isect_ray_tri_v3(data->start, dir, verts[mf->v1], verts[mf->v3], verts[mf->v4], &lambda, uv)) {
 		normal_tri_v3(n, verts[mf->v1], verts[mf->v3], verts[mf->v4]);
-		if(lambda < 1.0f && dot_v3v3(n, data->vec) < -1e-5f) {
+		if (lambda < 1.0f && dot_v3v3(n, data->vec) < -1e-5f) {
 			hit->index = index;
 			hit->dist *= lambda;
 		}
@@ -444,7 +446,7 @@ static void heat_ray_tree_create(LaplacianSystem *sys)
 	sys->heat.bvhtree = BLI_bvhtree_new(totface, 0.0f, 4, 6);
 	sys->heat.vface = MEM_callocN(sizeof(MFace*)*totvert, "HeatVFaces");
 
-	for(a=0; a<totface; a++) {
+	for (a=0; a<totface; a++) {
 		MFace *mf = mface+a;
 		float bb[6];
 
@@ -452,7 +454,7 @@ static void heat_ray_tree_create(LaplacianSystem *sys)
 		DO_MINMAX(verts[mf->v1], bb, bb+3);
 		DO_MINMAX(verts[mf->v2], bb, bb+3);
 		DO_MINMAX(verts[mf->v3], bb, bb+3);
-		if(mf->v4) {
+		if (mf->v4) {
 			DO_MINMAX(verts[mf->v4], bb, bb+3);
 		}
 
@@ -462,7 +464,7 @@ static void heat_ray_tree_create(LaplacianSystem *sys)
 		sys->heat.vface[mf->v1]= mf;
 		sys->heat.vface[mf->v2]= mf;
 		sys->heat.vface[mf->v3]= mf;
-		if(mf->v4) sys->heat.vface[mf->v4]= mf;
+		if (mf->v4) sys->heat.vface[mf->v4]= mf;
 	}
 
 	BLI_bvhtree_balance(sys->heat.bvhtree); 
@@ -477,13 +479,13 @@ static int heat_ray_source_visible(LaplacianSystem *sys, int vertex, int source)
 	int visible;
 
 	mface= sys->heat.vface[vertex];
-	if(!mface)
+	if (!mface)
 		return 1;
 
 	data.sys= sys;
 	copy_v3_v3(data.start, sys->heat.verts[vertex]);
 
-	if(sys->heat.root) /* bone */
+	if (sys->heat.root) /* bone */
 		closest_to_line_segment_v3(end, data.start,
 			sys->heat.root[source], sys->heat.tip[source]);
 	else /* vertex */
@@ -507,7 +509,7 @@ static float heat_source_distance(LaplacianSystem *sys, int vertex, int source)
 	float closest[3], d[3], dist, cosine;
 	
 	/* compute euclidian distance */
-	if(sys->heat.root) /* bone */
+	if (sys->heat.root) /* bone */
 		closest_to_line_segment_v3(closest, sys->heat.verts[vertex],
 			sys->heat.root[source], sys->heat.tip[source]);
 	else /* vertex */
@@ -528,8 +530,8 @@ static int heat_source_closest(LaplacianSystem *sys, int vertex, int source)
 
 	dist= heat_source_distance(sys, vertex, source);
 
-	if(dist <= sys->heat.mindist[vertex]*(1.0f + DISTANCE_EPSILON))
-		if(heat_ray_source_visible(sys, vertex, source))
+	if (dist <= sys->heat.mindist[vertex]*(1.0f + DISTANCE_EPSILON))
+		if (heat_ray_source_visible(sys, vertex, source))
 			return 1;
 		
 	return 0;
@@ -543,24 +545,24 @@ static void heat_set_H(LaplacianSystem *sys, int vertex)
 	mindist= 1e10;
 
 	/* compute minimum distance */
-	for(j=0; j<sys->heat.numsource; j++) {
+	for (j=0; j<sys->heat.numsource; j++) {
 		dist= heat_source_distance(sys, vertex, j);
 
-		if(dist < mindist)
+		if (dist < mindist)
 			mindist= dist;
 	}
 
 	sys->heat.mindist[vertex]= mindist;
 
 	/* count number of sources with approximately this minimum distance */
-	for(j=0; j<sys->heat.numsource; j++)
-		if(heat_source_closest(sys, vertex, j))
+	for (j=0; j<sys->heat.numsource; j++)
+		if (heat_source_closest(sys, vertex, j))
 			numclosest++;
 
 	sys->heat.p[vertex]= (numclosest > 0)? 1.0f/numclosest: 0.0f;
 
 	/* compute H entry */
-	if(numclosest > 0) {
+	if (numclosest > 0) {
 		mindist= maxf(mindist, 1e-4f);
 		h= numclosest*C_WEIGHT/(mindist*mindist);
 	}
@@ -577,7 +579,7 @@ static void heat_calc_vnormals(LaplacianSystem *sys)
 
 	sys->heat.vnors= MEM_callocN(sizeof(float)*3*sys->totvert, "HeatVNors");
 
-	for(a=0, face=sys->faces; a<sys->totface; a++, face++) {
+	for (a=0, face=sys->faces; a<sys->totface; a++, face++) {
 		v1= (*face)[0];
 		v2= (*face)[1];
 		v3= (*face)[2];
@@ -589,7 +591,7 @@ static void heat_calc_vnormals(LaplacianSystem *sys)
 		add_v3_v3(sys->heat.vnors[v3], fnor);
 	}
 
-	for(a=0; a<sys->totvert; a++)
+	for (a=0; a<sys->totvert; a++)
 		normalize_v3(sys->heat.vnors[a]);
 }
 
@@ -606,19 +608,19 @@ static void heat_laplacian_create(LaplacianSystem *sys)
 	sys->heat.p= MEM_callocN(sizeof(float)*totvert, "HeatP");
 
 	/* add verts and faces to laplacian */
-	for(a=0; a<totvert; a++)
+	for (a=0; a<totvert; a++)
 		laplacian_add_vertex(sys, sys->heat.verts[a], 0);
 
-	for(a=0, mf=mface; a<totface; a++, mf++) {
+	for (a=0, mf=mface; a<totface; a++, mf++) {
 		laplacian_add_triangle(sys, mf->v1, mf->v2, mf->v3);
-		if(mf->v4)
+		if (mf->v4)
 			laplacian_add_triangle(sys, mf->v1, mf->v3, mf->v4);
 	}
 
 	/* for distance computation in set_H */
 	heat_calc_vnormals(sys);
 
-	for(a=0; a<totvert; a++)
+	for (a=0; a<totvert; a++)
 		heat_set_H(sys, a);
 }
 
@@ -637,10 +639,10 @@ static float heat_limit_weight(float weight)
 {
 	float t;
 
-	if(weight < WEIGHT_LIMIT_END) {
+	if (weight < WEIGHT_LIMIT_END) {
 		return 0.0f;
 	}
-	else if(weight < WEIGHT_LIMIT_START) {
+	else if (weight < WEIGHT_LIMIT_START) {
 		t= (weight - WEIGHT_LIMIT_END)/(WEIGHT_LIMIT_START - WEIGHT_LIMIT_END);
 		return t*WEIGHT_LIMIT_START;
 	}
@@ -651,10 +653,12 @@ static float heat_limit_weight(float weight)
 void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource, bDeformGroup **dgrouplist, bDeformGroup **dgroupflip, float (*root)[3], float (*tip)[3], int *selected, const char **err_str)
 {
 	LaplacianSystem *sys;
-	MFace *mface;
+	MPoly *mp;
+	MLoop *ml;
+	MFace *mf;
 	float solution, weight;
 	int *vertsflipped = NULL, *mask= NULL;
-	int a, totface, j, bbone, firstsegment, lastsegment;
+	int a, tottri, j, bbone, firstsegment, lastsegment;
 
 	MVert *mvert = me->mvert;
 	int use_vert_sel= FALSE;
@@ -663,39 +667,40 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
 	*err_str= NULL;
 
 	/* count triangles and create mask */
-	if(     (use_face_sel= (me->editflag & ME_EDIT_PAINT_MASK) != 0) ||
+	if (     (use_face_sel= (me->editflag & ME_EDIT_PAINT_MASK) != 0) ||
 	        (use_vert_sel= ((me->editflag & ME_EDIT_VERT_SEL) != 0)))
 	{
 		mask= MEM_callocN(sizeof(int)*me->totvert, "heat_bone_weighting mask");
 	}
 
-	for(totface=0, a=0, mface=me->mface; a<me->totface; a++, mface++) {
-		totface++;
-		if(mface->v4) totface++;
-
+	for (a = 0, mp=me->mpoly; a < me->totpoly; mp++, a++) {
 		/*  (added selectedVerts content for vertex mask, they used to just equal 1) */
-		if(use_vert_sel) {
-			mask[mface->v1]= (mvert[mface->v1].flag & SELECT) != 0;
-			mask[mface->v2]= (mvert[mface->v2].flag & SELECT) != 0;
-			mask[mface->v3]= (mvert[mface->v3].flag & SELECT) != 0;
-			if(mface->v4) {
-				mask[mface->v4]= (mvert[mface->v4].flag & SELECT) != 0;
+		if (use_vert_sel) {
+			for (j = 0, ml = me->mloop + mp->loopstart; j < mp->totloop; j++, ml++) {
+				if (use_vert_sel) {
+					mask[ml->v] = (mvert[ml->v].flag & SELECT) != 0;
+				}
 			}
 		}
 		else if (use_face_sel) {
-			if (mface->flag & ME_FACE_SEL) {
-				mask[mface->v1]= 1;
-				mask[mface->v2]= 1;
-				mask[mface->v3]= 1;
-				if(mface->v4) {
-					mask[mface->v4]= 1;
+			if (mp->flag & ME_FACE_SEL) {
+				for (j = 0, ml = me->mloop + mp->loopstart; j < mp->totloop; j++, ml++) {
+					mask[ml->v] = 1;
 				}
 			}
 		}
 	}
 
+	/* bone heat needs triangulated faces */
+	BKE_mesh_tessface_ensure(me);
+
+	for (tottri = 0, a = 0, mf = me->mface; a < me->totface; mf++, a++) {
+		tottri++;
+		if (mf->v4) tottri++;
+	}
+
 	/* create laplacian */
-	sys = laplacian_system_construct_begin(me->totvert, totface, 1);
+	sys = laplacian_system_construct_begin(me->totvert, tottri, 1);
 
 	sys->heat.mface= me->mface;
 	sys->heat.totface= me->totface;
@@ -710,15 +715,15 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
 
 	laplacian_system_construct_end(sys);
 
-	if(dgroupflip) {
+	if (dgroupflip) {
 		vertsflipped = MEM_callocN(sizeof(int)*me->totvert, "vertsflipped");
-		for(a=0; a<me->totvert; a++)
+		for (a=0; a<me->totvert; a++)
 			vertsflipped[a] = mesh_get_x_mirror_vert(ob, a);
 	}
-
+	
 	/* compute weights per bone */
-	for(j=0; j<numsource; j++) {
-		if(!selected[j])
+	for (j=0; j<numsource; j++) {
+		if (!selected[j])
 			continue;
 
 		firstsegment= (j == 0 || dgrouplist[j-1] != dgrouplist[j]);
@@ -726,13 +731,13 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
 		bbone= !(firstsegment && lastsegment);
 
 		/* clear weights */
-		if(bbone && firstsegment) {
-			for(a=0; a<me->totvert; a++) {
-				if(mask && !mask[a])
+		if (bbone && firstsegment) {
+			for (a=0; a<me->totvert; a++) {
+				if (mask && !mask[a])
 					continue;
 
 				ED_vgroup_vert_remove(ob, dgrouplist[j], a);
-				if(vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0)
+				if (vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0)
 					ED_vgroup_vert_remove(ob, dgroupflip[j], vertsflipped[a]);
 			}
 		}
@@ -740,28 +745,28 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
 		/* fill right hand side */
 		laplacian_begin_solve(sys, -1);
 
-		for(a=0; a<me->totvert; a++)
-			if(heat_source_closest(sys, a, j))
+		for (a=0; a<me->totvert; a++)
+			if (heat_source_closest(sys, a, j))
 				laplacian_add_right_hand_side(sys, a,
 					sys->heat.H[a]*sys->heat.p[a]);
 
 		/* solve */
-		if(laplacian_system_solve(sys)) {
+		if (laplacian_system_solve(sys)) {
 			/* load solution into vertex groups */
-			for(a=0; a<me->totvert; a++) {
-				if(mask && !mask[a])
+			for (a=0; a<me->totvert; a++) {
+				if (mask && !mask[a])
 					continue;
 
 				solution= laplacian_system_get_solution(a);
 				
-				if(bbone) {
-					if(solution > 0.0f)
+				if (bbone) {
+					if (solution > 0.0f)
 						ED_vgroup_vert_add(ob, dgrouplist[j], a, solution,
 							WEIGHT_ADD);
 				}
 				else {
 					weight= heat_limit_weight(solution);
-					if(weight > 0.0f)
+					if (weight > 0.0f)
 						ED_vgroup_vert_add(ob, dgrouplist[j], a, weight,
 							WEIGHT_REPLACE);
 					else
@@ -769,15 +774,15 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
 				}
 
 				/* do same for mirror */
-				if(vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0) {
-					if(bbone) {
-						if(solution > 0.0f)
+				if (vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0) {
+					if (bbone) {
+						if (solution > 0.0f)
 							ED_vgroup_vert_add(ob, dgroupflip[j], vertsflipped[a],
 								solution, WEIGHT_ADD);
 					}
 					else {
 						weight= heat_limit_weight(solution);
-						if(weight > 0.0f)
+						if (weight > 0.0f)
 							ED_vgroup_vert_add(ob, dgroupflip[j], vertsflipped[a],
 								weight, WEIGHT_REPLACE);
 						else
@@ -786,26 +791,26 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
 				}
 			}
 		}
-		else if(*err_str == NULL) {
+		else if (*err_str == NULL) {
 			*err_str= "Bone Heat Weighting: failed to find solution for one or more bones";
 			break;
 		}
 
 		/* remove too small vertex weights */
-		if(bbone && lastsegment) {
-			for(a=0; a<me->totvert; a++) {
-				if(mask && !mask[a])
+		if (bbone && lastsegment) {
+			for (a=0; a<me->totvert; a++) {
+				if (mask && !mask[a])
 					continue;
 
 				weight= ED_vgroup_vert_weight(ob, dgrouplist[j], a);
 				weight= heat_limit_weight(weight);
-				if(weight <= 0.0f)
+				if (weight <= 0.0f)
 					ED_vgroup_vert_remove(ob, dgrouplist[j], a);
 
-				if(vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0) {
+				if (vertsflipped && dgroupflip[j] && vertsflipped[a] >= 0) {
 					weight= ED_vgroup_vert_weight(ob, dgroupflip[j], vertsflipped[a]);
 					weight= heat_limit_weight(weight);
-					if(weight <= 0.0f)
+					if (weight <= 0.0f)
 						ED_vgroup_vert_remove(ob, dgroupflip[j], vertsflipped[a]);
 				}
 			}
@@ -813,8 +818,8 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
 	}
 
 	/* free */
-	if(vertsflipped) MEM_freeN(vertsflipped);
-	if(mask) MEM_freeN(mask);
+	if (vertsflipped) MEM_freeN(vertsflipped);
+	if (mask) MEM_freeN(mask);
 
 	heat_system_free(sys);
 
@@ -824,13 +829,13 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
 #ifdef RIGID_DEFORM
 /********************** As-Rigid-As-Possible Deformation ******************/
 /* From "As-Rigid-As-Possible Surface Modeling",
-		Olga Sorkine and Marc Alexa, ESGP 2007. */
+ * Olga Sorkine and Marc Alexa, ESGP 2007. */
 
 /* investigate:
-   - transpose R in orthogonal
-   - flipped normals and per face adding
-   - move cancelling to transform, make origco pointer
-*/
+ * - transpose R in orthogonal
+ * - flipped normals and per face adding
+ * - move canceling to transform, make origco pointer
+ */
 
 static LaplacianSystem *RigidDeformSystem = NULL;
 
@@ -898,7 +903,7 @@ void rigid_deform_iteration()
 	EditFace *efa;
 	int a, i;
 
-	if(!sys)
+	if (!sys)
 		return;
 	
 	nlMakeCurrent(sys->context);
@@ -908,12 +913,12 @@ void rigid_deform_iteration()
 	memset(sys->rigid.R, 0, sizeof(float)*3*3*sys->totvert);
 	memset(sys->rigid.rhs, 0, sizeof(float)*3*sys->totvert);
 
-	for(a=0, efa=em->faces.first; efa; efa=efa->next, a++) {
+	for (a=0, efa=em->faces.first; efa; efa=efa->next, a++) {
 		rigid_add_edge_to_R(sys, efa->v1, efa->v2, sys->fweights[a][2]);
 		rigid_add_edge_to_R(sys, efa->v2, efa->v3, sys->fweights[a][0]);
 		rigid_add_edge_to_R(sys, efa->v3, efa->v1, sys->fweights[a][1]);
 
-		if(efa->v4) {
+		if (efa->v4) {
 			a++;
 			rigid_add_edge_to_R(sys, efa->v1, efa->v3, sys->fweights[a][2]);
 			rigid_add_edge_to_R(sys, efa->v3, efa->v4, sys->fweights[a][0]);
@@ -921,18 +926,18 @@ void rigid_deform_iteration()
 		}
 	}
 
-	for(a=0, eve=em->verts.first; eve; eve=eve->next, a++) {
+	for (a=0, eve=em->verts.first; eve; eve=eve->next, a++) {
 		rigid_orthogonalize_R(sys->rigid.R[a]);
 		eve->tmp.l= a;
 	}
 	
 	/* compute right hand sides for solving */
-	for(a=0, efa=em->faces.first; efa; efa=efa->next, a++) {
+	for (a=0, efa=em->faces.first; efa; efa=efa->next, a++) {
 		rigid_add_edge_to_rhs(sys, efa->v1, efa->v2, sys->fweights[a][2]);
 		rigid_add_edge_to_rhs(sys, efa->v2, efa->v3, sys->fweights[a][0]);
 		rigid_add_edge_to_rhs(sys, efa->v3, efa->v1, sys->fweights[a][1]);
 
-		if(efa->v4) {
+		if (efa->v4) {
 			a++;
 			rigid_add_edge_to_rhs(sys, efa->v1, efa->v3, sys->fweights[a][2]);
 			rigid_add_edge_to_rhs(sys, efa->v3, efa->v4, sys->fweights[a][0]);
@@ -941,19 +946,19 @@ void rigid_deform_iteration()
 	}
 
 	/* solve for positions, for X,Y and Z separately */
-	for(i=0; i<3; i++) {
+	for (i=0; i<3; i++) {
 		laplacian_begin_solve(sys, i);
 
-		for(a=0; a<sys->totvert; a++)
-			if(!sys->vpinned[a])
+		for (a=0; a<sys->totvert; a++)
+			if (!sys->vpinned[a])
 				laplacian_add_right_hand_side(sys, a, sys->rigid.rhs[a][i]);
 
-		if(laplacian_system_solve(sys)) {
-			for(a=0, eve=em->verts.first; eve; eve=eve->next, a++)
+		if (laplacian_system_solve(sys)) {
+			for (a=0, eve=em->verts.first; eve; eve=eve->next, a++)
 				eve->co[i]= laplacian_system_get_solution(a);
 		}
 		else {
-			if(!sys->rigid.thrownerror) {
+			if (!sys->rigid.thrownerror) {
 				error("RigidDeform: failed to find solution");
 				sys->rigid.thrownerror= 1;
 			}
@@ -970,15 +975,15 @@ static void rigid_laplacian_create(LaplacianSystem *sys)
 	int a;
 
 	/* add verts and faces to laplacian */
-	for(a=0, eve=em->verts.first; eve; eve=eve->next, a++) {
+	for (a=0, eve=em->verts.first; eve; eve=eve->next, a++) {
 		laplacian_add_vertex(sys, eve->co, eve->pinned);
 		eve->tmp.l= a;
 	}
 
-	for(efa=em->faces.first; efa; efa=efa->next) {
+	for (efa=em->faces.first; efa; efa=efa->next) {
 		laplacian_add_triangle(sys,
 			efa->v1->tmp.l, efa->v2->tmp.l, efa->v3->tmp.l);
-		if(efa->v4)
+		if (efa->v4)
 			laplacian_add_triangle(sys,
 				efa->v1->tmp.l, efa->v3->tmp.l, efa->v4->tmp.l);
 	}
@@ -992,12 +997,12 @@ void rigid_deform_begin(EditMesh *em)
 	int a, totvert, totface;
 
 	/* count vertices, triangles */
-	for(totvert=0, eve=em->verts.first; eve; eve=eve->next)
+	for (totvert=0, eve=em->verts.first; eve; eve=eve->next)
 		totvert++;
 
-	for(totface=0, efa=em->faces.first; efa; efa=efa->next) {
+	for (totface=0, efa=em->faces.first; efa; efa=efa->next) {
 		totface++;
-		if(efa->v4) totface++;
+		if (efa->v4) totface++;
 	}
 
 	/* create laplacian */
@@ -1008,7 +1013,7 @@ void rigid_deform_begin(EditMesh *em)
 	sys->rigid.rhs = MEM_callocN(sizeof(float)*3*totvert, "RigidDeformRHS");
 	sys->rigid.origco = MEM_callocN(sizeof(float)*3*totvert, "RigidDeformCo");
 
-	for(a=0, eve=em->verts.first; eve; eve=eve->next, a++)
+	for (a=0, eve=em->verts.first; eve; eve=eve->next, a++)
 		copy_v3_v3(sys->rigid.origco[a], eve->co);
 
 	sys->areaweights= 0;
@@ -1025,19 +1030,19 @@ void rigid_deform_end(int cancel)
 {
 	LaplacianSystem *sys = RigidDeformSystem;
 
-	if(sys) {
+	if (sys) {
 		EditMesh *em = sys->rigid.mesh;
 		EditVert *eve;
 		int a;
 
-		if(cancel)
-			for(a=0, eve=em->verts.first; eve; eve=eve->next, a++)
-				if(!eve->pinned)
+		if (cancel)
+			for (a=0, eve=em->verts.first; eve; eve=eve->next, a++)
+				if (!eve->pinned)
 					copy_v3_v3(eve->co, sys->rigid.origco[a]);
 
-		if(sys->rigid.R) MEM_freeN(sys->rigid.R);
-		if(sys->rigid.rhs) MEM_freeN(sys->rigid.rhs);
-		if(sys->rigid.origco) MEM_freeN(sys->rigid.origco);
+		if (sys->rigid.R) MEM_freeN(sys->rigid.R);
+		if (sys->rigid.rhs) MEM_freeN(sys->rigid.rhs);
+		if (sys->rigid.origco) MEM_freeN(sys->rigid.origco);
 
 		/* free */
 		laplacian_system_delete(sys);
@@ -1049,8 +1054,8 @@ void rigid_deform_end(int cancel)
 
 /************************** Harmonic Coordinates ****************************/
 /* From "Harmonic Coordinates for Character Articulation",
-	Pushkar Joshi, Mark Meyer, Tony DeRose, Brian Green and Tom Sanocki,
-	SIGGRAPH 2007. */
+ * Pushkar Joshi, Mark Meyer, Tony DeRose, Brian Green and Tom Sanocki,
+ * SIGGRAPH 2007. */
 
 #define EPSILON 0.0001f
 
@@ -1171,10 +1176,10 @@ static int meshdeform_tri_intersect(float orig[3], float end[3], float vert0[3],
 	/* check if it is within the length of the line segment */
 	sub_v3_v3v3(isectdir, isectco, orig);
 
-	if(dot_v3v3(dir, isectdir) < -EPSILON)
+	if (dot_v3v3(dir, isectdir) < -EPSILON)
 		return 0;
 	
-	if(dot_v3v3(dir, dir) + EPSILON < dot_v3v3(isectdir, isectdir))
+	if (dot_v3v3(dir, dir) + EPSILON < dot_v3v3(isectdir, isectdir))
 		return 0;
 
 	return 1;
@@ -1188,21 +1193,21 @@ static int meshdeform_intersect(MeshDeformBind *mdb, MeshDeformIsect *isec)
 
 	isec->labda= 1e10;
 
-	mface= mdb->cagedm->getFaceArray(mdb->cagedm);
-	totface= mdb->cagedm->getNumFaces(mdb->cagedm);
+	mface= mdb->cagedm->getTessFaceArray(mdb->cagedm);
+	totface= mdb->cagedm->getNumTessFaces(mdb->cagedm);
 
 	add_v3_v3v3(end, isec->start, isec->vec);
 
-	for(f=0; f<totface; f++, mface++) {
+	for (f=0; f<totface; f++, mface++) {
 		copy_v3_v3(face[0], mdb->cagecos[mface->v1]);
 		copy_v3_v3(face[1], mdb->cagecos[mface->v2]);
 		copy_v3_v3(face[2], mdb->cagecos[mface->v3]);
 
-		if(mface->v4) {
+		if (mface->v4) {
 			copy_v3_v3(face[3], mdb->cagecos[mface->v4]);
 			hit = meshdeform_tri_intersect(isec->start, end, face[0], face[1], face[2], co, uvw);
 
-			if(hit) {
+			if (hit) {
 				normal_tri_v3( nor,face[0], face[1], face[2]);
 			}
 			else {
@@ -1215,9 +1220,9 @@ static int meshdeform_intersect(MeshDeformBind *mdb, MeshDeformIsect *isec)
 			normal_tri_v3( nor,face[0], face[1], face[2]);
 		}
 
-		if(hit) {
+		if (hit) {
 			len= len_v3v3(isec->start, co)/len_v3v3(isec->start, end);
-			if(len < isec->labda) {
+			if (len < isec->labda) {
 				isec->labda= len;
 				isec->face = mface;
 				isec->isect= (dot_v3v3(isec->vec, nor) <= 0.0f);
@@ -1246,7 +1251,7 @@ static MDefBoundIsect *meshdeform_ray_tree_intersect(MeshDeformBind *mdb, float
 	add_v3_v3v3(end, co2, epsilon);
 	sub_v3_v3v3(isec.vec, end, isec.start);
 
-	if(meshdeform_intersect(mdb, &isec)) {
+	if (meshdeform_intersect(mdb, &isec)) {
 		len= isec.labda;
 		mface=(MFace*)isec.face;
 
@@ -1259,7 +1264,7 @@ static MDefBoundIsect *meshdeform_ray_tree_intersect(MeshDeformBind *mdb, float
 		isect->co[2]= co1[2] + isec.vec[2]*len;
 
 		isect->len= len_v3v3(co1, isect->co);
-		if(isect->len < MESHDEFORM_LEN_THRESHOLD)
+		if (isect->len < MESHDEFORM_LEN_THRESHOLD)
 			isect->len= MESHDEFORM_LEN_THRESHOLD;
 
 		isect->v[0]= mface->v1;
@@ -1275,7 +1280,7 @@ static MDefBoundIsect *meshdeform_ray_tree_intersect(MeshDeformBind *mdb, float
 		copy_v3_v3(vert[0], cagecos[mface->v1]);
 		copy_v3_v3(vert[1], cagecos[mface->v2]);
 		copy_v3_v3(vert[2], cagecos[mface->v3]);
-		if(mface->v4) copy_v3_v3(vert[3], cagecos[mface->v4]);
+		if (mface->v4) copy_v3_v3(vert[3], cagecos[mface->v4]);
 		interp_weights_poly_v3( isect->uvw,vert, isect->nvert, isect->co);
 
 		return isect;
@@ -1290,7 +1295,7 @@ static int meshdeform_inside_cage(MeshDeformBind *mdb, float *co)
 	float outside[3], start[3], dir[3];
 	int i;
 
-	for(i=1; i<=6; i++) {
+	for (i=1; i<=6; i++) {
 		outside[0] = co[0] + (mdb->max[0] - mdb->min[0] + 1.0f)*MESHDEFORM_OFFSET[i][0];
 		outside[1] = co[1] + (mdb->max[1] - mdb->min[1] + 1.0f)*MESHDEFORM_OFFSET[i][1];
 		outside[2] = co[2] + (mdb->max[2] - mdb->min[2] + 1.0f)*MESHDEFORM_OFFSET[i][2];
@@ -1300,7 +1305,7 @@ static int meshdeform_inside_cage(MeshDeformBind *mdb, float *co)
 		normalize_v3(dir);
 		
 		isect = meshdeform_ray_tree_intersect(mdb, start, outside);
-		if(isect && !isect->facing)
+		if (isect && !isect->facing)
 			return 1;
 	}
 
@@ -1317,11 +1322,11 @@ static int meshdeform_index(MeshDeformBind *mdb, int x, int y, int z, int n)
 	y += MESHDEFORM_OFFSET[n][1];
 	z += MESHDEFORM_OFFSET[n][2];
 
-	if(x < 0 || x >= mdb->size)
+	if (x < 0 || x >= mdb->size)
 		return -1;
-	if(y < 0 || y >= mdb->size)
+	if (y < 0 || y >= mdb->size)
 		return -1;
-	if(z < 0 || z >= mdb->size)
+	if (z < 0 || z >= mdb->size)
 		return -1;
 
 	return x + y*size + z*size*size;
@@ -1348,14 +1353,14 @@ static void meshdeform_add_intersections(MeshDeformBind *mdb, int x, int y, int
 	meshdeform_cell_center(mdb, x, y, z, 0, center);
 
 	/* check each outgoing edge for intersection */
-	for(i=1; i<=6; i++) {
-		if(meshdeform_index(mdb, x, y, z, i) == -1)
+	for (i=1; i<=6; i++) {
+		if (meshdeform_index(mdb, x, y, z, i) == -1)
 			continue;
 
 		meshdeform_cell_center(mdb, x, y, z, i, ncenter);
 
 		isect= meshdeform_ray_tree_intersect(mdb, center, ncenter);
-		if(isect) {
+		if (isect) {
 			mdb->boundisect[a][i-1]= isect;
 			mdb->tag[a]= MESHDEFORM_TAG_BOUNDARY;
 		}
@@ -1375,18 +1380,18 @@ static void meshdeform_bind_floodfill(MeshDeformBind *mdb)
 	stacksize= 1;
 
 	/* floodfill exterior tag */
-	while(stacksize > 0) {
+	while (stacksize > 0) {
 		a= stack[--stacksize];
 
 		xyz[2]= a/(size*size);
 		xyz[1]= (a - xyz[2]*size*size)/size;
 		xyz[0]= a - xyz[1]*size - xyz[2]*size*size;
 
-		for(i=1; i<=6; i++) {
+		for (i=1; i<=6; i++) {
 			b= meshdeform_index(mdb, xyz[0], xyz[1], xyz[2], i);
 
-			if(b != -1) {
-				if(tag[b] == MESHDEFORM_TAG_UNTYPED ||
+			if (b != -1) {
+				if (tag[b] == MESHDEFORM_TAG_UNTYPED ||
 				   (tag[b] == MESHDEFORM_TAG_BOUNDARY && !mdb->boundisect[a][i-1])) {
 					tag[b]= MESHDEFORM_TAG_EXTERIOR;
 					stack[stacksize++]= b;
@@ -1396,23 +1401,23 @@ static void meshdeform_bind_floodfill(MeshDeformBind *mdb)
 	}
 
 	/* other cells are interior */
-	for(a=0; a<size*size*size; a++)
-		if(tag[a]==MESHDEFORM_TAG_UNTYPED)
+	for (a=0; a<size*size*size; a++)
+		if (tag[a]==MESHDEFORM_TAG_UNTYPED)
 			tag[a]= MESHDEFORM_TAG_INTERIOR;
 
 #if 0
 	{
 		int tb, ti, te, ts;
 		tb= ti= te= ts= 0;
-		for(a=0; a<size*size*size; a++)
-			if(tag[a]==MESHDEFORM_TAG_BOUNDARY)
+		for (a=0; a<size*size*size; a++)
+			if (tag[a]==MESHDEFORM_TAG_BOUNDARY)
 				tb++;
-			else if(tag[a]==MESHDEFORM_TAG_INTERIOR)
+			else if (tag[a]==MESHDEFORM_TAG_INTERIOR)
 				ti++;
-			else if(tag[a]==MESHDEFORM_TAG_EXTERIOR) {
+			else if (tag[a]==MESHDEFORM_TAG_EXTERIOR) {
 				te++;
 
-				if(mdb->semibound[a])
+				if (mdb->semibound[a])
 					ts++;
 			}
 		
@@ -1427,8 +1432,8 @@ static float meshdeform_boundary_phi(MeshDeformBind *UNUSED(mdb), MDefBoundIsect
 {
 	int a;
 
-	for(a=0; a<isect->nvert; a++)
-		if(isect->v[a] == cagevert)
+	for (a=0; a<isect->nvert; a++)
+		if (isect->v[a] == cagevert)
 			return isect->uvw[a];
 	
 	return 0.0f;
@@ -1440,19 +1445,19 @@ static float meshdeform_interp_w(MeshDeformBind *mdb, float *gridvec, float *UNU
 	float weight, totweight= 0.0f;
 	int i, a, x, y, z;
 
-	for(i=0; i<3; i++) {
+	for (i=0; i<3; i++) {
 		ivec[i]= (int)gridvec[i];
 		dvec[i]= gridvec[i] - ivec[i];
 	}
 
-	for(i=0; i<8; i++) {
-		if(i & 1) { x= ivec[0]+1; wx= dvec[0]; }
+	for (i=0; i<8; i++) {
+		if (i & 1) { x= ivec[0]+1; wx= dvec[0]; }
 		else { x= ivec[0]; wx= 1.0f-dvec[0]; } 
 
-		if(i & 2) { y= ivec[1]+1; wy= dvec[1]; }
+		if (i & 2) { y= ivec[1]+1; wy= dvec[1]; }
 		else { y= ivec[1]; wy= 1.0f-dvec[1]; } 
 
-		if(i & 4) { z= ivec[2]+1; wz= dvec[2]; }
+		if (i & 4) { z= ivec[2]+1; wz= dvec[2]; }
 		else { z= ivec[2]; wz= 1.0f-dvec[2]; } 
 
 		CLAMP(x, 0, mdb->size-1);
@@ -1465,7 +1470,7 @@ static float meshdeform_interp_w(MeshDeformBind *mdb, float *gridvec, float *UNU
 		totweight += weight;
 	}
 
-	if(totweight > 0.0f)
+	if (totweight > 0.0f)
 		result /= totweight;
 
 	return result;
@@ -1476,11 +1481,11 @@ static void meshdeform_check_semibound(MeshDeformBind *mdb, int x, int y, int z)
 	int i, a;
 
 	a= meshdeform_index(mdb, x, y, z, 0);
-	if(mdb->tag[a] != MESHDEFORM_TAG_EXTERIOR)
+	if (mdb->tag[a] != MESHDEFORM_TAG_EXTERIOR)
 		return;
 
-	for(i=1; i<=6; i++)
-		if(mdb->boundisect[a][i-1]) 
+	for (i=1; i<=6; i++)
+		if (mdb->boundisect[a][i-1]) 
 			mdb->semibound[a]= 1;
 }
 
@@ -1491,14 +1496,14 @@ static float meshdeform_boundary_total_weight(MeshDeformBind *mdb, int x, int y,
 
 	a= meshdeform_index(mdb, x, y, z, 0);
 
-	/* count weight for neighbour cells */
-	for(i=1; i<=6; i++) {
-		if(meshdeform_index(mdb, x, y, z, i) == -1)
+	/* count weight for neighbor cells */
+	for (i=1; i<=6; i++) {
+		if (meshdeform_index(mdb, x, y, z, i) == -1)
 			continue;
 
-		if(mdb->boundisect[a][i-1])
+		if (mdb->boundisect[a][i-1])
 			weight= 1.0f/mdb->boundisect[a][i-1]->len;
-		else if(!mdb->semibound[a])
+		else if (!mdb->semibound[a])
 			weight= 1.0f/mdb->width[0];
 		else
 			weight= 0.0f;
@@ -1516,15 +1521,15 @@ static void meshdeform_matrix_add_cell(MeshDeformBind *mdb, int x, int y, int z)
 	int i, a, acenter;
 
 	acenter= meshdeform_index(mdb, x, y, z, 0);
-	if(mdb->tag[acenter] == MESHDEFORM_TAG_EXTERIOR)
+	if (mdb->tag[acenter] == MESHDEFORM_TAG_EXTERIOR)
 		return;
 
 	nlMatrixAdd(mdb->varidx[acenter], mdb->varidx[acenter], 1.0f);
 	
 	totweight= meshdeform_boundary_total_weight(mdb, x, y, z);
-	for(i=1; i<=6; i++) {
+	for (i=1; i<=6; i++) {
 		a= meshdeform_index(mdb, x, y, z, i);
-		if(a == -1 || mdb->tag[a] == MESHDEFORM_TAG_EXTERIOR)
+		if (a == -1 || mdb->tag[a] == MESHDEFORM_TAG_EXTERIOR)
 			continue;
 
 		isect= mdb->boundisect[acenter][i-1];
@@ -1542,13 +1547,13 @@ static void meshdeform_matrix_add_rhs(MeshDeformBind *mdb, int x, int y, int z,
 	int i, a, acenter;
 
 	acenter= meshdeform_index(mdb, x, y, z, 0);
-	if(mdb->tag[acenter] == MESHDEFORM_TAG_EXTERIOR)
+	if (mdb->tag[acenter] == MESHDEFORM_TAG_EXTERIOR)
 		return;
 
 	totweight= meshdeform_boundary_total_weight(mdb, x, y, z);
-	for(i=1; i<=6; i++) {
+	for (i=1; i<=6; i++) {
 		a= meshdeform_index(mdb, x, y, z, i);
-		if(a == -1)
+		if (a == -1)
 			continue;
 
 		isect= mdb->boundisect[acenter][i-1];
@@ -1568,13 +1573,13 @@ static void meshdeform_matrix_add_semibound_phi(MeshDeformBind *mdb, int x, int
 	int i, a;
 
 	a= meshdeform_index(mdb, x, y, z, 0);
-	if(!mdb->semibound[a])
+	if (!mdb->semibound[a])
 		return;
 	
 	mdb->phi[a]= 0.0f;
 
 	totweight= meshdeform_boundary_total_weight(mdb, x, y, z);
-	for(i=1; i<=6; i++) {
+	for (i=1; i<=6; i++) {
 		isect= mdb->boundisect[a][i-1];
 
 		if (isect) {
@@ -1591,21 +1596,21 @@ static void meshdeform_matrix_add_exterior_phi(MeshDeformBind *mdb, int x, int y
 	int i, a, acenter;
 
 	acenter= meshdeform_index(mdb, x, y, z, 0);
-	if(mdb->tag[acenter] != MESHDEFORM_TAG_EXTERIOR || mdb->semibound[acenter])
+	if (mdb->tag[acenter] != MESHDEFORM_TAG_EXTERIOR || mdb->semibound[acenter])
 		return;
 
 	phi= 0.0f;
 	totweight= 0.0f;
-	for(i=1; i<=6; i++) {
+	for (i=1; i<=6; i++) {
 		a= meshdeform_index(mdb, x, y, z, i);
 
-		if(a != -1 && mdb->semibound[a]) {
+		if (a != -1 && mdb->semibound[a]) {
 			phi += mdb->phi[a];
 			totweight += 1.0f;
 		}
 	}
 
-	if(totweight != 0.0f)
+	if (totweight != 0.0f)
 		mdb->phi[acenter]= phi/totweight;
 }
 
@@ -1618,10 +1623,10 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind
 
 	/* setup variable indices */
 	mdb->varidx= MEM_callocN(sizeof(int)*mdb->size3, "MeshDeformDSvaridx");
-	for(a=0, totvar=0; a<mdb->size3; a++)
+	for (a=0, totvar=0; a<mdb->size3; a++)
 		mdb->varidx[a]= (mdb->tag[a] == MESHDEFORM_TAG_EXTERIOR)? -1: totvar++;
 
-	if(totvar == 0) {
+	if (totvar == 0) {
 		MEM_freeN(mdb->varidx);
 		return;
 	}
@@ -1640,22 +1645,22 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind
 	nlBegin(NL_MATRIX);
 
 	/* build matrix */
-	for(z=0; z<mdb->size; z++)
-		for(y=0; y<mdb->size; y++)
-			for(x=0; x<mdb->size; x++)
+	for (z=0; z<mdb->size; z++)
+		for (y=0; y<mdb->size; y++)
+			for (x=0; x<mdb->size; x++)
 				meshdeform_matrix_add_cell(mdb, x, y, z);
 
 	/* solve for each cage vert */
-	for(a=0; a<mdb->totcagevert; a++) {
-		if(a != 0) {
+	for (a=0; a<mdb->totcagevert; a++) {
+		if (a != 0) {
 			nlBegin(NL_SYSTEM);
 			nlBegin(NL_MATRIX);
 		}
 
 		/* fill in right hand side and solve */
-		for(z=0; z<mdb->size; z++)
-			for(y=0; y<mdb->size; y++)
-				for(x=0; x<mdb->size; x++)
+		for (z=0; z<mdb->size; z++)
+			for (y=0; y<mdb->size; y++)
+				for (x=0; x<mdb->size; x++)
 					meshdeform_matrix_add_rhs(mdb, x, y, z, a);
 
 		nlEnd(NL_MATRIX);
@@ -1665,27 +1670,27 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind
 		nlPrintMatrix();
 #endif
 
-		if(nlSolveAdvanced(NULL, NL_TRUE)) {
-			for(z=0; z<mdb->size; z++)
-				for(y=0; y<mdb->size; y++)
-					for(x=0; x<mdb->size; x++)
+		if (nlSolveAdvanced(NULL, NL_TRUE)) {
+			for (z=0; z<mdb->size; z++)
+				for (y=0; y<mdb->size; y++)
+					for (x=0; x<mdb->size; x++)
 						meshdeform_matrix_add_semibound_phi(mdb, x, y, z, a);
 
-			for(z=0; z<mdb->size; z++)
-				for(y=0; y<mdb->size; y++)
-					for(x=0; x<mdb->size; x++)
+			for (z=0; z<mdb->size; z++)
+				for (y=0; y<mdb->size; y++)
+					for (x=0; x<mdb->size; x++)
 						meshdeform_matrix_add_exterior_phi(mdb, x, y, z, a);
 
-			for(b=0; b<mdb->size3; b++) {
-				if(mdb->tag[b] != MESHDEFORM_TAG_EXTERIOR)
+			for (b=0; b<mdb->size3; b++) {
+				if (mdb->tag[b] != MESHDEFORM_TAG_EXTERIOR)
 					mdb->phi[b]= nlGetVariable(0, mdb->varidx[b]);
 				mdb->totalphi[b] += mdb->phi[b];
 			}
 
-			if(mdb->weights) {
+			if (mdb->weights) {
 				/* static bind : compute weights for each vertex */
-				for(b=0; b<mdb->totvert; b++) {
-					if(mdb->inside[b]) {
+				for (b=0; b<mdb->totvert; b++) {
+					if (mdb->inside[b]) {
 						copy_v3_v3(vec, mdb->vertexcos[b]);
 						gridvec[0]= (vec[0] - mdb->min[0] - mdb->halfwidth[0])/mdb->width[0];
 						gridvec[1]= (vec[1] - mdb->min[1] - mdb->halfwidth[1])/mdb->width[1];
@@ -1699,8 +1704,8 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind
 				MDefBindInfluence *inf;
 
 				/* dynamic bind */
-				for(b=0; b<mdb->size3; b++) {
-					if(mdb->phi[b] >= MESHDEFORM_MIN_INFLUENCE) {
+				for (b=0; b<mdb->size3; b++) {
+					if (mdb->phi[b] >= MESHDEFORM_MIN_INFLUENCE) {
 						inf= BLI_memarena_alloc(mdb->memarena, sizeof(*inf));
 						inf->vertex= a;
 						inf->weight= mdb->phi[b];
@@ -1711,7 +1716,7 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind
 			}
 		}
 		else {
-			modifier_setError(&mmd->modifier, "Failed to find bind solution (increase precision?).");
+			modifier_setError(&mmd->modifier, "%s", TIP_("Failed to find bind solution (increase precision?)."));
 			error("Mesh Deform: failed to find bind solution.");
 			break;
 		}
@@ -1722,9 +1727,9 @@ static void meshdeform_matrix_solve(MeshDeformModifierData *mmd, MeshDeformBind
 
 #if 0
 	/* sanity check */
-	for(b=0; b<mdb->size3; b++)
-		if(mdb->tag[b] != MESHDEFORM_TAG_EXTERIOR)
-			if(fabs(mdb->totalphi[b] - 1.0f) > 1e-4)
+	for (b=0; b<mdb->size3; b++)
+		if (mdb->tag[b] != MESHDEFORM_TAG_EXTERIOR)
+			if (fabs(mdb->totalphi[b] - 1.0f) > 1e-4)
 				printf("totalphi deficiency [%s|%d] %d: %.10f\n",
 					(mdb->tag[b] == MESHDEFORM_TAG_INTERIOR)? "interior": "boundary", mdb->semibound[b], mdb->varidx[b], mdb->totalphi[b]);
 #endif
@@ -1746,7 +1751,7 @@ static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierDa
 	/* compute bounding box of the cage mesh */
 	INIT_MINMAX(mdb->min, mdb->max);
 
-	for(a=0; a<mdb->totcagevert; a++)
+	for (a=0; a<mdb->totcagevert; a++)
 		DO_MINMAX(mdb->cagecos[a], mdb->min, mdb->max);
 
 	/* allocate memory */
@@ -1760,7 +1765,7 @@ static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierDa
 
 	mdb->inside= MEM_callocN(sizeof(int)*mdb->totvert, "MDefInside");
 
-	if(mmd->flag & MOD_MDEF_DYNAMIC_BIND)
+	if (mmd->flag & MOD_MDEF_DYNAMIC_BIND)
 		mdb->dyngrid= MEM_callocN(sizeof(MDefBindInfluence*)*mdb->size3, "MDefDynGrid");
 	else
 		mdb->weights= MEM_callocN(sizeof(float)*mdb->totvert*mdb->totcagevert, "MDefWeights");
@@ -1771,11 +1776,11 @@ static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierDa
 	/* make bounding box equal size in all directions, add padding, and compute
 	 * width of the cells */
 	maxwidth = -1.0f;
-	for(a=0; a<3; a++)
-		if(mdb->max[a]-mdb->min[a] > maxwidth)
+	for (a=0; a<3; a++)
+		if (mdb->max[a]-mdb->min[a] > maxwidth)
 			maxwidth= mdb->max[a]-mdb->min[a];
 
-	for(a=0; a<3; a++) {
+	for (a=0; a<3; a++) {
 		center[a]= (mdb->min[a]+mdb->max[a])*0.5f;
 		mdb->min[a]= center[a] - maxwidth*0.5f;
 		mdb->max[a]= center[a] + maxwidth*0.5f;
@@ -1791,10 +1796,10 @@ static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierDa
 	progress_bar(0, "Setting up mesh deform system");
 
 	totinside= 0;
-	for(a=0; a<mdb->totvert; a++) {
+	for (a=0; a<mdb->totvert; a++) {
 		copy_v3_v3(vec, mdb->vertexcos[a]);
 		mdb->inside[a]= meshdeform_inside_cage(mdb, vec);
-		if(mdb->inside[a])
+		if (mdb->inside[a])
 			totinside++;
 	}
 
@@ -1803,53 +1808,53 @@ static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierDa
 	mdb->memarena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "harmonic coords arena");
 
 	/* start with all cells untyped */
-	for(a=0; a<mdb->size3; a++)
+	for (a=0; a<mdb->size3; a++)
 		mdb->tag[a]= MESHDEFORM_TAG_UNTYPED;
 	
 	/* detect intersections and tag boundary cells */
-	for(z=0; z<mdb->size; z++)
-		for(y=0; y<mdb->size; y++)
-			for(x=0; x<mdb->size; x++)
+	for (z=0; z<mdb->size; z++)
+		for (y=0; y<mdb->size; y++)
+			for (x=0; x<mdb->size; x++)
 				meshdeform_add_intersections(mdb, x, y, z);
 
 	/* compute exterior and interior tags */
 	meshdeform_bind_floodfill(mdb);
 
-	for(z=0; z<mdb->size; z++)
-		for(y=0; y<mdb->size; y++)
-			for(x=0; x<mdb->size; x++)
+	for (z=0; z<mdb->size; z++)
+		for (y=0; y<mdb->size; y++)
+			for (x=0; x<mdb->size; x++)
 				meshdeform_check_semibound(mdb, x, y, z);
 
 	/* solve */
 	meshdeform_matrix_solve(mmd, mdb);
 
 	/* assign results */
-	if(mmd->flag & MOD_MDEF_DYNAMIC_BIND) {
+	if (mmd->flag & MOD_MDEF_DYNAMIC_BIND) {
 		mmd->totinfluence= 0;
-		for(a=0; a<mdb->size3; a++)
-			for(inf=mdb->dyngrid[a]; inf; inf=inf->next)
+		for (a=0; a<mdb->size3; a++)
+			for (inf=mdb->dyngrid[a]; inf; inf=inf->next)
 				mmd->totinfluence++;
 
 		/* convert MDefBindInfluences to smaller MDefInfluences */
 		mmd->dyngrid= MEM_callocN(sizeof(MDefCell)*mdb->size3, "MDefDynGrid");
 		mmd->dyninfluences= MEM_callocN(sizeof(MDefInfluence)*mmd->totinfluence, "MDefInfluence");
 		offset= 0;
-		for(a=0; a<mdb->size3; a++) {
+		for (a=0; a<mdb->size3; a++) {
 			cell= &mmd->dyngrid[a];
 			cell->offset= offset;
 
 			totweight= 0.0f;
 			mdinf= mmd->dyninfluences + cell->offset;
-			for(inf=mdb->dyngrid[a]; inf; inf=inf->next, mdinf++) {
+			for (inf=mdb->dyngrid[a]; inf; inf=inf->next, mdinf++) {
 				mdinf->weight= inf->weight;
 				mdinf->vertex= inf->vertex;
 				totweight += mdinf->weight;
 				cell->totinfluence++;
 			}
 
-			if(totweight > 0.0f) {
+			if (totweight > 0.0f) {
 				mdinf= mmd->dyninfluences + cell->offset;
-				for(b=0; b<cell->totinfluence; b++, mdinf++)
+				for (b=0; b<cell->totinfluence; b++, mdinf++)
 					mdinf->weight /= totweight;
 			}
 
@@ -1879,18 +1884,18 @@ static void harmonic_coordinates_bind(Scene *UNUSED(scene), MeshDeformModifierDa
 static void heat_weighting_bind(Scene *scene, DerivedMesh *dm, MeshDeformModifierData *mmd, MeshDeformBind *mdb)
 {
 	LaplacianSystem *sys;
-	MFace *mface= dm->getFaceArray(dm), *mf;
+	MFace *mface= dm->getTessFaceArray(dm), *mf;
 	int totvert= dm->getNumVerts(dm);
-	int totface= dm->getNumFaces(dm);
+	int totface= dm->getNumTessFaces(dm);
 	float solution, weight;
 	int a, tottri, j, thrownerror = 0;
 
 	mdb->weights= MEM_callocN(sizeof(float)*mdb->totvert*mdb->totcagevert, "MDefWeights");
 
 	/* count triangles */
-	for(tottri=0, a=0, mf=mface; a<totface; a++, mf++) {
+	for (tottri=0, a=0, mf=mface; a<totface; a++, mf++) {
 		tottri++;
-		if(mf->v4) tottri++;
+		if (mf->v4) tottri++;
 	}
 
 	/* create laplacian */
@@ -1909,27 +1914,27 @@ static void heat_weighting_bind(Scene *scene, DerivedMesh *dm, MeshDeformModifie
 	laplacian_system_construct_end(sys);
 
 	/* compute weights per bone */
-	for(j=0; j<mdb->totcagevert; j++) {
+	for (j=0; j<mdb->totcagevert; j++) {
 		/* fill right hand side */
 		laplacian_begin_solve(sys, -1);
 
-		for(a=0; a<totvert; a++)
-			if(heat_source_closest(sys, a, j))
+		for (a=0; a<totvert; a++)
+			if (heat_source_closest(sys, a, j))
 				laplacian_add_right_hand_side(sys, a,
 					sys->heat.H[a]*sys->heat.p[a]);
 
 		/* solve */
-		if(laplacian_system_solve(sys)) {
+		if (laplacian_system_solve(sys)) {
 			/* load solution into vertex groups */
-			for(a=0; a<totvert; a++) {
+			for (a=0; a<totvert; a++) {
 				solution= laplacian_system_get_solution(a);
 				
 				weight= heat_limit_weight(solution);
-				if(weight > 0.0f)
+				if (weight > 0.0f)
 					mdb->weights[a*mdb->totcagevert + j] = weight;
 			}
 		}
-		else if(!thrownerror) {
+		else if (!thrownerror) {
 			error("Mesh Deform Heat Weighting:"
 				" failed to find solution for one or more vertices");
 			thrownerror= 1;
@@ -1966,14 +1971,14 @@ void mesh_deform_bind(Scene *scene, MeshDeformModifierData *mmd, float *vertexco
 	copy_m4_m4(mdb.cagemat, cagemat);
 
 	mvert= mdb.cagedm->getVertArray(mdb.cagedm);
-	for(a=0; a<mdb.totcagevert; a++)
+	for (a=0; a<mdb.totcagevert; a++)
 		copy_v3_v3(mdb.cagecos[a], mvert[a].co);
-	for(a=0; a<mdb.totvert; a++)
+	for (a=0; a<mdb.totvert; a++)
 		mul_v3_m4v3(mdb.vertexcos[a], mdb.cagemat, vertexcos + a*3);
 
 	/* solve */
 #if 0
-	if(mmd->mode == MOD_MDEF_VOLUME)
+	if (mmd->mode == MOD_MDEF_VOLUME)
 		harmonic_coordinates_bind(scene, mmd, &mdb);
 	else
 		heat_weighting_bind(scene, dm, mmd, &mdb);
@@ -1988,7 +1993,7 @@ void mesh_deform_bind(Scene *scene, MeshDeformModifierData *mmd, float *vertexco
 	copy_m4_m4(mmd->bindmat, mmd->object->obmat);
 
 	/* transform bindcagecos to world space */
-	for(a=0; a<mdb.totcagevert; a++)
+	for (a=0; a<mdb.totcagevert; a++)
 		mul_m4_v3(mmd->object->obmat, mmd->bindcagecos+a*3);
 
 	/* free */
diff --git a/source/blender/editors/armature/meshlaplacian.h b/source/blender/editors/armature/meshlaplacian.h
index 6ec6799..095de4a 100644
--- a/source/blender/editors/armature/meshlaplacian.h
+++ b/source/blender/editors/armature/meshlaplacian.h
@@ -31,8 +31,8 @@
  */
 
 
-#ifndef BIF_MESHLAPLACIAN_H
-#define BIF_MESHLAPLACIAN_H
+#ifndef __MESHLAPLACIAN_H__
+#define __MESHLAPLACIAN_H__
 
 //#define RIGID_DEFORM
 
@@ -51,14 +51,9 @@ struct EditMesh;
 struct LaplacianSystem;
 typedef struct LaplacianSystem LaplacianSystem;
 
-LaplacianSystem *laplacian_construct_begin(int totvert, int totface, int lsq);
-
 void laplacian_add_vertex(LaplacianSystem *sys, float *co, int pinned);
 void laplacian_add_triangle(LaplacianSystem *sys, int v1, int v2, int v3);
 
-void laplacian_construct_end(LaplacianSystem *sys);
-void laplacian_delete(LaplacianSystem *sys);
-
 void laplacian_begin_solve(LaplacianSystem *sys, int index);
 void laplacian_add_right_hand_side(LaplacianSystem *sys, int v, float value);
 int laplacian_system_solve(LaplacianSystem *sys);
diff --git a/source/blender/editors/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c
index c28b688..be520d1 100644
--- a/source/blender/editors/armature/poseSlide.c
+++ b/source/blender/editors/armature/poseSlide.c
@@ -159,7 +159,7 @@ static int pose_slide_init (bContext *C, wmOperator *op, short mode)
 	pso->ob->pose->flag |= POSE_LOCKED;
 	pso->ob->pose->flag &= ~POSE_DO_UNLOCK;
 	
-	/* do basic initialise of RB-BST used for finding keyframes, but leave the filling of it up 
+	/* do basic initialize of RB-BST used for finding keyframes, but leave the filling of it up 
 	 * to the caller of this (usually only invoke() will do it, to make things more efficient).
 	 */
 	BLI_dlrbTree_init(&pso->keys);
@@ -239,7 +239,7 @@ static void pose_slide_apply_val (tPoseSlideOp *pso, FCurve *fcu, float *val)
 	switch (pso->mode) {
 		case POSESLIDE_PUSH: /* make the current pose more pronounced */
 		{
-			/* perform a weighted average here, favouring the middle pose 
+			/* perform a weighted average here, favoring the middle pose
 			 *	- numerator should be larger than denominator to 'expand' the result
 			 *	- perform this weighting a number of times given by the percentage...
 			 */
@@ -253,7 +253,7 @@ static void pose_slide_apply_val (tPoseSlideOp *pso, FCurve *fcu, float *val)
 			
 		case POSESLIDE_RELAX: /* make the current pose more like its surrounding ones */
 		{
-			/* perform a weighted average here, favouring the middle pose 
+			/* perform a weighted average here, favoring the middle pose
 			 *	- numerator should be smaller than denominator to 'relax' the result
 			 *	- perform this weighting a number of times given by the percentage...
 			 */
@@ -660,14 +660,14 @@ static int pose_slide_modal (bContext *C, wmOperator *op, wmEvent *evt)
 			/* clean up temp data */
 			pose_slide_exit(op);
 			
-			/* cancelled! */
+			/* canceled! */
 			return OPERATOR_CANCELLED;
 		}
 			
 		case MOUSEMOVE: /* calculate new position */
 		{
 			/* calculate percentage based on position of mouse (we only use x-axis for now.
-			 * since this is more conveninent for users to do), and store new percentage value 
+			 * since this is more convenient for users to do), and store new percentage value
 			 */
 			pso->percentage= (evt->x - pso->ar->winrct.xmin) / ((float)pso->ar->winx);
 			RNA_float_set(op->ptr, "percentage", pso->percentage);
@@ -730,7 +730,7 @@ static int pose_slide_push_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED(
 {
 	tPoseSlideOp *pso;
 	
-	/* initialise data  */
+	/* initialize data  */
 	if (pose_slide_init(C, op, POSESLIDE_PUSH) == 0) {
 		pose_slide_exit(op);
 		return OPERATOR_CANCELLED;
@@ -747,7 +747,7 @@ static int pose_slide_push_exec (bContext *C, wmOperator *op)
 {
 	tPoseSlideOp *pso;
 	
-	/* initialise data (from RNA-props) */
+	/* initialize data (from RNA-props) */
 	if (pose_slide_init(C, op, POSESLIDE_PUSH) == 0) {
 		pose_slide_exit(op);
 		return OPERATOR_CANCELLED;
@@ -762,19 +762,19 @@ static int pose_slide_push_exec (bContext *C, wmOperator *op)
 void POSE_OT_push (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Push Pose";
-	ot->idname= "POSE_OT_push";
-	ot->description= "Exaggerate the current pose";
+	ot->name = "Push Pose";
+	ot->idname = "POSE_OT_push";
+	ot->description = "Exaggerate the current pose";
 	
 	/* callbacks */
-	ot->exec= pose_slide_push_exec;
-	ot->invoke= pose_slide_push_invoke;
-	ot->modal= pose_slide_modal;
-	ot->cancel= pose_slide_cancel;
-	ot->poll= ED_operator_posemode;
+	ot->exec = pose_slide_push_exec;
+	ot->invoke = pose_slide_push_invoke;
+	ot->modal = pose_slide_modal;
+	ot->cancel = pose_slide_cancel;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
 	
 	/* Properties */
 	pose_slide_opdef_properties(ot);
@@ -787,7 +787,7 @@ static int pose_slide_relax_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED
 {
 	tPoseSlideOp *pso;
 	
-	/* initialise data  */
+	/* initialize data  */
 	if (pose_slide_init(C, op, POSESLIDE_RELAX) == 0) {
 		pose_slide_exit(op);
 		return OPERATOR_CANCELLED;
@@ -804,7 +804,7 @@ static int pose_slide_relax_exec (bContext *C, wmOperator *op)
 {
 	tPoseSlideOp *pso;
 	
-	/* initialise data (from RNA-props) */
+	/* initialize data (from RNA-props) */
 	if (pose_slide_init(C, op, POSESLIDE_RELAX) == 0) {
 		pose_slide_exit(op);
 		return OPERATOR_CANCELLED;
@@ -819,19 +819,19 @@ static int pose_slide_relax_exec (bContext *C, wmOperator *op)
 void POSE_OT_relax (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Relax Pose";
-	ot->idname= "POSE_OT_relax";
-	ot->description= "Make the current pose more similar to its surrounding ones";
+	ot->name = "Relax Pose";
+	ot->idname = "POSE_OT_relax";
+	ot->description = "Make the current pose more similar to its surrounding ones";
 	
 	/* callbacks */
-	ot->exec= pose_slide_relax_exec;
-	ot->invoke= pose_slide_relax_invoke;
-	ot->modal= pose_slide_modal;
-	ot->cancel= pose_slide_cancel;
-	ot->poll= ED_operator_posemode;
+	ot->exec = pose_slide_relax_exec;
+	ot->invoke = pose_slide_relax_invoke;
+	ot->modal = pose_slide_modal;
+	ot->cancel = pose_slide_cancel;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
 	
 	/* Properties */
 	pose_slide_opdef_properties(ot);
@@ -844,7 +844,7 @@ static int pose_slide_breakdown_invoke (bContext *C, wmOperator *op, wmEvent *UN
 {
 	tPoseSlideOp *pso;
 	
-	/* initialise data  */
+	/* initialize data  */
 	if (pose_slide_init(C, op, POSESLIDE_BREAKDOWN) == 0) {
 		pose_slide_exit(op);
 		return OPERATOR_CANCELLED;
@@ -861,7 +861,7 @@ static int pose_slide_breakdown_exec (bContext *C, wmOperator *op)
 {
 	tPoseSlideOp *pso;
 	
-	/* initialise data (from RNA-props) */
+	/* initialize data (from RNA-props) */
 	if (pose_slide_init(C, op, POSESLIDE_BREAKDOWN) == 0) {
 		pose_slide_exit(op);
 		return OPERATOR_CANCELLED;
@@ -876,19 +876,19 @@ static int pose_slide_breakdown_exec (bContext *C, wmOperator *op)
 void POSE_OT_breakdown (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Pose Breakdowner";
-	ot->idname= "POSE_OT_breakdown";
-	ot->description= "Create a suitable breakdown pose on the current frame";
+	ot->name = "Pose Breakdowner";
+	ot->idname = "POSE_OT_breakdown";
+	ot->description = "Create a suitable breakdown pose on the current frame";
 	
 	/* callbacks */
-	ot->exec= pose_slide_breakdown_exec;
-	ot->invoke= pose_slide_breakdown_invoke;
-	ot->modal= pose_slide_modal;
-	ot->cancel= pose_slide_cancel;
-	ot->poll= ED_operator_posemode;
+	ot->exec = pose_slide_breakdown_exec;
+	ot->invoke = pose_slide_breakdown_invoke;
+	ot->modal = pose_slide_modal;
+	ot->cancel = pose_slide_cancel;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
 	
 	/* Properties */
 	pose_slide_opdef_properties(ot);
@@ -939,7 +939,7 @@ static float pose_propagate_get_boneHoldEndFrame (Object *ob, tPChanFCurveLink *
 	LinkData *ld;
 	float endFrame = startFrame;
 	
-	/* set up optimised data-structures for searching for relevant keyframes + holds */
+	/* set up optimized data-structures for searching for relevant keyframes + holds */
 	BLI_dlrbTree_init(&keys);
 	BLI_dlrbTree_init(&blocks);
 	
@@ -1102,7 +1102,7 @@ static void pose_propagate_fcurve (wmOperator *op, Object *ob, FCurve *fcu,
 	 * doesn't need to firstly keyframe the pose (though this doesn't mean that 
 	 * they can't either)
 	 */
-	if( !pose_propagate_get_refVal(ob, fcu, &refVal))
+	if ( !pose_propagate_get_refVal(ob, fcu, &refVal))
 		return;
 	
 	/* find the first keyframe to start propagating from 
@@ -1231,7 +1231,7 @@ static int pose_propagate_exec (bContext *C, wmOperator *op)
 void POSE_OT_propagate (wmOperatorType *ot)
 {
 	static EnumPropertyItem terminate_items[]= {
-		{POSE_PROPAGATE_SMART_HOLDS, "WHILE_HELD", 0, "While Held", "Propagate pose to all keyframes after current frame that don't change (Default behaviour)"},
+		{POSE_PROPAGATE_SMART_HOLDS, "WHILE_HELD", 0, "While Held", "Propagate pose to all keyframes after current frame that don't change (Default behavior)"},
 		{POSE_PROPAGATE_NEXT_KEY, "NEXT_KEY", 0, "To Next Keyframe", "Propagate pose to first keyframe following the current frame only"},
 		{POSE_PROPAGATE_LAST_KEY, "LAST_KEY", 0, "To Last Keyframe", "Propagate pose to the last keyframe only (i.e. making action cyclic)"},
 		{POSE_PROPAGATE_BEFORE_FRAME, "BEFORE_FRAME", 0, "Before Frame", "Propagate pose to all keyframes between current frame and 'Frame' property"},
@@ -1240,20 +1240,20 @@ void POSE_OT_propagate (wmOperatorType *ot)
 		{0, NULL, 0, NULL, NULL}};
 		
 	/* identifiers */
-	ot->name= "Propagate Pose";
-	ot->idname= "POSE_OT_propagate";
-	ot->description= "Copy selected aspects of the current pose to subsequent poses already keyframed";
+	ot->name = "Propagate Pose";
+	ot->idname = "POSE_OT_propagate";
+	ot->description = "Copy selected aspects of the current pose to subsequent poses already keyframed";
 	
 	/* callbacks */
-	ot->exec= pose_propagate_exec;
-	ot->poll= ED_operator_posemode; // XXX: needs selected bones!
+	ot->exec = pose_propagate_exec;
+	ot->poll = ED_operator_posemode; // XXX: needs selected bones!
 	
 	/* flag */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	// 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");
+	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/poselib.c b/source/blender/editors/armature/poselib.c
index eb49f16..2799d79 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -186,7 +186,7 @@ static int has_poselib_pose_data_poll (bContext *C)
 
 /* ----------------------------------- */
 
-/* Initialise a new poselib (whether it is needed or not) */
+/* Initialize a new poselib (whether it is needed or not) */
 static bAction *poselib_init_new (Object *ob)
 {
 	/* sanity checks - only for armatures */
@@ -201,7 +201,7 @@ static bAction *poselib_init_new (Object *ob)
 	return ob->poselib;
 }
 
-/* Initialise a new poselib (checks if that needs to happen) */
+/* Initialize a new poselib (checks if that needs to happen) */
 static bAction *poselib_validate (Object *ob)
 {
 	if (ELEM(NULL, ob, ob->pose))
@@ -241,10 +241,10 @@ void POSELIB_OT_new (wmOperatorType *ot)
 	
 	/* callbacks */
 	ot->exec = poselib_new_exec;
-	ot->poll= ED_operator_posemode;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ------------------------------------------------ */
@@ -276,10 +276,10 @@ void POSELIB_OT_unlink (wmOperatorType *ot)
 	
 	/* callbacks */
 	ot->exec = poselib_unlink_exec;
-	ot->poll= has_poselib_pose_data_poll;
+	ot->poll = has_poselib_pose_data_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ************************************************************* */
@@ -297,7 +297,7 @@ static int poselib_sanitise_exec (bContext *C, wmOperator *op)
 	TimeMarker *marker, *markern;
 	
 	/* validate action */
-	if (act == NULL)  {
+	if (act == NULL) {
 		BKE_report(op->reports, RPT_WARNING, "No Action to validate");
 		return OPERATOR_CANCELLED;
 	}
@@ -365,7 +365,7 @@ void POSELIB_OT_action_sanitise (wmOperatorType *ot)
 	ot->poll = has_poselib_pose_data_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ------------------------------------------ */
@@ -472,7 +472,7 @@ static int poselib_add_exec (bContext *C, wmOperator *op)
 	BLI_uniquename(&act->markers, marker, "Pose", '.', offsetof(TimeMarker, name), sizeof(marker->name));
 	
 	/* use Keying Set to determine what to store for the pose */
-	// FIXME: in the past, the Keying Set respected selections (LocRotScale), but the current one doesn't (Whole Character)
+	// FIXME: in the past, the Keying Set respected selections (LocRotScale), but the current one doesn't (WholeCharacter)
 	// so perhaps we need either a new Keying Set, or just to add overrides here...
 	ANIM_apply_keyingset(C, NULL, act, ks, MODIFYKEY_MODE_INSERT, (float)frame);
 	
@@ -486,17 +486,17 @@ static int poselib_add_exec (bContext *C, wmOperator *op)
 void POSELIB_OT_pose_add (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "PoseLib Add Pose";
-	ot->idname= "POSELIB_OT_pose_add";
-	ot->description= "Add the current Pose to the active Pose Library";
+	ot->name = "PoseLib Add Pose";
+	ot->idname = "POSELIB_OT_pose_add";
+	ot->description = "Add the current Pose to the active Pose Library";
 	
 	/* api callbacks */
-	ot->invoke= poselib_add_menu_invoke;
-	ot->exec= poselib_add_exec;
-	ot->poll= ED_operator_posemode;
+	ot->invoke = poselib_add_menu_invoke;
+	ot->exec = poselib_add_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_int(ot->srna, "frame", 1, 0, INT_MAX, "Frame", "Frame to store pose on", 0, INT_MAX);
@@ -516,7 +516,7 @@ static EnumPropertyItem *poselib_stored_pose_itemf(bContext *C, PointerRNA *UNUS
 	int i= 0;
 
 	if (C == NULL) {
-		return DummyRNA_DEFAULT_items;
+		return DummyRNA_NULL_items;
 	}
 	
 	/* check that the action exists */
@@ -541,18 +541,28 @@ static int poselib_remove_exec (bContext *C, wmOperator *op)
 	Object *ob= get_poselib_object(C);
 	bAction *act= (ob) ? ob->poselib : NULL;
 	TimeMarker *marker;
+	int marker_index;
 	FCurve *fcu;
-	
+	PropertyRNA *prop;
+
 	/* check if valid poselib */
 	if (act == NULL) {
 		BKE_report(op->reports, RPT_ERROR, "Object doesn't have PoseLib data");
 		return OPERATOR_CANCELLED;
 	}
-	
+
+	prop = RNA_struct_find_property(op->ptr, "pose");
+	if (RNA_property_is_set(op->ptr, prop)) {
+		marker_index = RNA_property_enum_get(op->ptr, prop);
+	}
+	else {
+		marker_index = act->active_marker - 1;
+	}
+
 	/* get index (and pointer) of pose to remove */
-	marker= BLI_findlink(&act->markers, RNA_enum_get(op->ptr, "pose"));
+	marker = BLI_findlink(&act->markers, marker_index);
 	if (marker == NULL) {
-		BKE_reportf(op->reports, RPT_ERROR, "Invalid Pose specified %d", RNA_int_get(op->ptr, "pose"));
+		BKE_reportf(op->reports, RPT_ERROR, "Invalid Pose specified %d", marker_index);
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -592,22 +602,22 @@ void POSELIB_OT_pose_remove (wmOperatorType *ot)
 	PropertyRNA *prop;
 	
 	/* identifiers */
-	ot->name= "PoseLib Remove Pose";
-	ot->idname= "POSELIB_OT_pose_remove";
-	ot->description= "Remove nth pose from the active Pose Library";
+	ot->name = "PoseLib Remove Pose";
+	ot->idname = "POSELIB_OT_pose_remove";
+	ot->description = "Remove nth pose from the active Pose Library";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= poselib_remove_exec;
-	ot->poll= has_poselib_pose_data_poll;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = poselib_remove_exec;
+	ot->poll = has_poselib_pose_data_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
-	prop= RNA_def_enum(ot->srna, "pose", DummyRNA_DEFAULT_items, 0, "Pose", "The pose to remove");
-		RNA_def_enum_funcs(prop, poselib_stored_pose_itemf);
-	ot->prop= prop;
+	prop = RNA_def_enum(ot->srna, "pose", DummyRNA_NULL_items, 0, "Pose", "The pose to remove");
+	RNA_def_enum_funcs(prop, poselib_stored_pose_itemf);
+	ot->prop = prop;
 }
 
 static int poselib_rename_invoke (bContext *C, wmOperator *op, wmEvent *evt)
@@ -682,21 +692,21 @@ void POSELIB_OT_pose_rename (wmOperatorType *ot)
 	};
 	
 	/* identifiers */
-	ot->name= "PoseLib Rename Pose";
-	ot->idname= "POSELIB_OT_pose_rename";
-	ot->description= "Rename specified pose from the active Pose Library";
+	ot->name = "PoseLib Rename Pose";
+	ot->idname = "POSELIB_OT_pose_rename";
+	ot->description = "Rename specified pose from the active Pose Library";
 	
 	/* api callbacks */
-	ot->invoke= poselib_rename_invoke;
-	ot->exec= poselib_rename_exec;
-	ot->poll= has_poselib_pose_data_poll;
+	ot->invoke = poselib_rename_invoke;
+	ot->exec = poselib_rename_exec;
+	ot->poll = has_poselib_pose_data_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 		/* NOTE: name not pose is the operator's "main" property, so that it will get activated in the popup for easy renaming */
-	ot->prop= RNA_def_string(ot->srna, "name", "RenamedPose", 64, "New Pose Name", "New name for pose");
+	ot->prop = RNA_def_string(ot->srna, "name", "RenamedPose", 64, "New Pose Name", "New name for pose");
 	prop= RNA_def_enum(ot->srna, "pose", prop_poses_dummy_types, 0, "Pose", "The pose to rename");
 		RNA_def_enum_funcs(prop, poselib_stored_pose_itemf);
 }
@@ -1473,7 +1483,7 @@ static void poselib_preview_cleanup (bContext *C, wmOperator *op)
 	/* this signal does one recalc on pose, then unlocks, so ESC or edit will work */
 	pose->flag |= POSE_DO_UNLOCK;
 	
-	/* clear pose if cancelled */
+	/* clear pose if canceled */
 	if (pld->state == PL_PREVIEW_CANCEL) {
 		poselib_backup_restore(pld);
 		
@@ -1613,23 +1623,23 @@ static int poselib_preview_exec (bContext *C, wmOperator *op)
 void POSELIB_OT_browse_interactive (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "PoseLib Browse Poses";
-	ot->idname= "POSELIB_OT_browse_interactive";
-	ot->description= "Interactively browse poses in 3D-View";
+	ot->name = "PoseLib Browse Poses";
+	ot->idname = "POSELIB_OT_browse_interactive";
+	ot->description = "Interactively browse poses in 3D-View";
 	
 	/* callbacks */
-	ot->invoke= poselib_preview_invoke;
-	ot->modal= poselib_preview_modal;
-	ot->cancel= poselib_preview_cancel;
-	ot->exec= poselib_preview_exec;
-	ot->poll= has_poselib_pose_data_poll;
+	ot->invoke = poselib_preview_invoke;
+	ot->modal = poselib_preview_modal;
+	ot->cancel = poselib_preview_cancel;
+	ot->exec = poselib_preview_exec;
+	ot->poll = has_poselib_pose_data_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
 	
 	/* 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);
+	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);
 	
 	// XXX: percentage vs factor?
 	/* not used yet */
@@ -1644,13 +1654,13 @@ void POSELIB_OT_apply_pose (wmOperatorType *ot)
 	ot->description = "Apply specified Pose Library pose to the rig";
 	
 	/* callbacks */
-	ot->exec= poselib_preview_exec;
-	ot->poll= has_poselib_pose_data_poll;
+	ot->exec = poselib_preview_exec;
+	ot->poll = has_poselib_pose_data_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* 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);
+	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 b14ce7e..043383d 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -109,7 +109,7 @@ void ED_armature_enter_posemode(bContext *C, Base *base)
 
 void ED_armature_exit_posemode(bContext *C, Base *base)
 {
-	if(base) {
+	if (base) {
 		Object *ob= base->object;
 		
 		ob->restore_mode = ob->mode;
@@ -154,18 +154,18 @@ static int pose_channel_in_IK_chain(Object *ob, bPoseChannel *pchan, int level)
 	
 	/* No need to check if constraint is active (has influence),
 	 * since all constraints with CONSTRAINT_IK_AUTO are active */
-	for(con= pchan->constraints.first; con; con= con->next) {
-		if(con->type==CONSTRAINT_TYPE_KINEMATIC) {
+	for (con= pchan->constraints.first; con; con= con->next) {
+		if (con->type==CONSTRAINT_TYPE_KINEMATIC) {
 			bKinematicConstraint *data= con->data;
-			if(data->rootbone == 0 || data->rootbone > level) {
-				if((data->flag & CONSTRAINT_IK_AUTO)==0)
+			if (data->rootbone == 0 || data->rootbone > level) {
+				if ((data->flag & CONSTRAINT_IK_AUTO)==0)
 					return 1;
 			}
 		}
 	}
-	for(bone= pchan->bone->childbase.first; bone; bone= bone->next) {
+	for (bone= pchan->bone->childbase.first; bone; bone= bone->next) {
 		pchan= get_pose_channel(ob->pose, bone->name);
-		if(pchan && pose_channel_in_IK_chain(ob, pchan, level + 1))
+		if (pchan && pose_channel_in_IK_chain(ob, pchan, level + 1))
 			return 1;
 	}
 	return 0;
@@ -236,16 +236,16 @@ static int pose_calculate_paths_exec (bContext *C, wmOperator *op)
 void POSE_OT_paths_calculate (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Calculate Bone Paths";
-	ot->idname= "POSE_OT_paths_calculate";
-	ot->description= "Calculate paths for the selected bones";
+	ot->name = "Calculate Bone Paths";
+	ot->idname = "POSE_OT_paths_calculate";
+	ot->description = "Calculate paths for the selected bones";
 	
 	/* api callbacks */
-	ot->exec= pose_calculate_paths_exec;
-	ot->poll= ED_operator_posemode;
+	ot->exec = pose_calculate_paths_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* --------- */
@@ -256,7 +256,7 @@ static void ED_pose_clear_paths(Object *ob)
 	bPoseChannel *pchan;
 	short skipped = 0;
 	
-	if ELEM(NULL, ob, ob->pose)
+	if (ELEM(NULL, ob, ob->pose))
 		return;
 	
 	/* free the motionpath blocks, but also take note of whether we skipped some... */
@@ -289,7 +289,7 @@ static int pose_clear_paths_exec (bContext *C, wmOperator *UNUSED(op))
 		ob= object_pose_armature_get(CTX_data_active_object(C));
 		
 	/* only continue if there's an object */
-	if ELEM(NULL, ob, ob->pose)
+	if (ELEM(NULL, ob, ob->pose))
 		return OPERATOR_CANCELLED;
 	
 	/* use the backend function for this */
@@ -304,13 +304,13 @@ static int pose_clear_paths_exec (bContext *C, wmOperator *UNUSED(op))
 void POSE_OT_paths_clear (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear Bone Paths";
-	ot->idname= "POSE_OT_paths_clear";
-	ot->description= "Clear path caches for selected bones";
+	ot->name = "Clear Bone Paths";
+	ot->idname = "POSE_OT_paths_clear";
+	ot->description = "Clear path caches for selected bones";
 	
 	/* api callbacks */
-	ot->exec= pose_clear_paths_exec;
-	ot->poll= ED_operator_posemode;
+	ot->exec = pose_clear_paths_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -338,7 +338,7 @@ static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op
 					for (ct= targets.first; ct; ct= ct->next) {
 						if ((ct->tar == ob) && (ct->subtarget[0])) {
 							bPoseChannel *pchanc= get_pose_channel(ob->pose, ct->subtarget);
-							if((pchanc) && !(pchanc->bone->flag & BONE_UNSELECTABLE)) {
+							if ((pchanc) && !(pchanc->bone->flag & BONE_UNSELECTABLE)) {
 								pchanc->bone->flag |= BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
 								found= 1;
 							}
@@ -364,16 +364,16 @@ static int pose_select_constraint_target_exec(bContext *C, wmOperator *UNUSED(op
 void POSE_OT_select_constraint_target(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Constraint Target";
-	ot->idname= "POSE_OT_select_constraint_target";
-	ot->description= "Select bones used as targets for the currently selected bones";
+	ot->name = "Select Constraint Target";
+	ot->idname = "POSE_OT_select_constraint_target";
+	ot->description = "Select bones used as targets for the currently selected bones";
 	
 	/* api callbacks */
-	ot->exec= pose_select_constraint_target_exec;
-	ot->poll= ED_operator_posemode;
+	ot->exec = pose_select_constraint_target_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ******************* select hierarchy operator ************* */
@@ -407,8 +407,30 @@ static int pose_select_hierarchy_exec(bContext *C, wmOperator *op)
 					}
 				} 
 				else { /* direction == BONE_SELECT_CHILD */
+
+					/* the child member is only assigned to connected bones, see [#30340] */
+#if 0
 					if (pchan->child == NULL) continue;
 					else chbone = pchan->child->bone;
+#else
+					/* instead. find _any_ visible child bone, using the first one is a little arbitrary  - campbell */
+					chbone = pchan->child ? pchan->child->bone : NULL;
+					if (chbone == NULL) {
+						bPoseChannel *pchan_child;
+
+						for (pchan_child = ob->pose->chanbase.first; pchan_child; pchan_child = pchan_child->next) {
+							/* possible we have multiple children, some invisible */
+							if (PBONE_VISIBLE(arm, pchan_child->bone)) {
+								if (pchan_child->parent == pchan) {
+									chbone = pchan_child->bone;
+									break;
+								}
+							}
+						}
+					}
+
+					if (chbone == NULL) continue;
+#endif
 					
 					if (PBONE_VISIBLE(arm, chbone)) {
 						if (!add_to_sel) curbone->flag &= ~BONE_SELECTED;
@@ -441,19 +463,19 @@ void POSE_OT_select_hierarchy(wmOperatorType *ot)
 	};
 	
 	/* identifiers */
-	ot->name= "Select Hierarchy";
-	ot->idname= "POSE_OT_select_hierarchy";
-	ot->description= "Select immediate parent/children of selected bones";
+	ot->name = "Select Hierarchy";
+	ot->idname = "POSE_OT_select_hierarchy";
+	ot->description = "Select immediate parent/children of selected bones";
 	
 	/* api callbacks */
-	ot->exec= pose_select_hierarchy_exec;
-	ot->poll= ED_operator_posemode;
+	ot->exec = pose_select_hierarchy_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* props */
-	ot->prop= RNA_def_enum(ot->srna, "direction", direction_items, BONE_SELECT_PARENT, "Direction", "");
+	ot->prop = RNA_def_enum(ot->srna, "direction", direction_items, BONE_SELECT_PARENT, "Direction", "");
 	RNA_def_boolean(ot->srna, "extend", 0, "Add to Selection", "");
 	
 }
@@ -497,7 +519,7 @@ static short pose_select_same_group (bContext *C, Object *ob, short extend)
 	}
 	CTX_DATA_END;
 	
-	/* small optimisation: only loop through bones a second time if there are any groups tagged */
+	/* small optimization: only loop through bones a second time if there are any groups tagged */
 	if (tagged) {
 		/* only if group matches (and is not selected or current bone) */
 		CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones) 
@@ -661,21 +683,21 @@ void POSE_OT_select_grouped (wmOperatorType *ot)
 	};
 
 	/* identifiers */
-	ot->name= "Select Grouped";
+	ot->name = "Select Grouped";
 	ot->description = "Select all visible bones grouped by similar properties";
-	ot->idname= "POSE_OT_select_grouped";
+	ot->idname = "POSE_OT_select_grouped";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= pose_select_grouped_exec;
-	ot->poll= ED_operator_posemode;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = pose_select_grouped_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first");
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_select_grouped_types, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_select_grouped_types, 0, "Type", "");
 }
 
 
@@ -687,23 +709,23 @@ static int pose_bone_flip_active_exec (bContext *C, wmOperator *UNUSED(op))
 	Object *ob_act= CTX_data_active_object(C);
 	Object *ob= object_pose_armature_get(ob_act);
 
-	if(ob && (ob->mode & OB_MODE_POSE)) {
+	if (ob && (ob->mode & OB_MODE_POSE)) {
 		bArmature *arm= ob->data;
 
-		if(arm->act_bone) {
+		if (arm->act_bone) {
 			bPoseChannel *pchanf;
 			char name[MAXBONENAME];
 			flip_side_name(name, arm->act_bone->name, TRUE);
 
 			pchanf= get_pose_channel(ob->pose, name);
-			if(pchanf && pchanf->bone != arm->act_bone) {
+			if (pchanf && pchanf->bone != arm->act_bone) {
 				arm->act_bone->flag &= ~BONE_SELECTED;
 				pchanf->bone->flag |= BONE_SELECTED;
 
 				arm->act_bone= pchanf->bone;
 
 				/* in weightpaint we select the associated vertex group too */
-				if(ob_act->mode & OB_MODE_WEIGHT_PAINT) {
+				if (ob_act->mode & OB_MODE_WEIGHT_PAINT) {
 					ED_vgroup_select_by_name(ob_act, name);
 					DAG_id_tag_update(&ob_act->id, OB_RECALC_DATA);
 				}
@@ -721,13 +743,13 @@ static int pose_bone_flip_active_exec (bContext *C, wmOperator *UNUSED(op))
 void POSE_OT_select_flip_active(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Flip Selected Active Bone";
-	ot->idname= "POSE_OT_select_flip_active";
-	ot->description= "Activate the bone with a flipped name";
+	ot->name = "Flip Selected Active Bone";
+	ot->idname = "POSE_OT_select_flip_active";
+	ot->description = "Activate the bone with a flipped name";
 	
 	/* api callbacks */
-	ot->exec= pose_bone_flip_active_exec;
-	ot->poll= ED_operator_posemode;
+	ot->exec = pose_bone_flip_active_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -755,7 +777,7 @@ static void pose_copy_menu(Scene *scene)
 	pchanact= pchan;
 	arm= ob->data;
 
-	/* if proxy-protected bones selected, some things (such as locks + displays) shouldn't be changable, 
+	/* if proxy-protected bones selected, some things (such as locks + displays) shouldn't be changeable,
 	 * but for constraints (just add local constraints)
 	 */
 	if (pose_has_protected_selected(ob, 0)) {
@@ -776,7 +798,7 @@ static void pose_copy_menu(Scene *scene)
 	if (nr <= 0) 
 		return;
 	
-	if (nr != 5)  {
+	if (nr != 5) {
 		for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
 			if ( (arm->layer & pchan->bone->layer) &&
 				 (pchan->bone->flag & BONE_SELECTED) &&
@@ -876,7 +898,7 @@ static void pose_copy_menu(Scene *scene)
 		BLI_duplicatelist(&const_copy, &(pchanact->constraints));
 		
 		/* build the puplist of constraints */
-		for (con = pchanact->constraints.first, i=0; con; con=con->next, i++){
+		for (con = pchanact->constraints.first, i=0; con; con=con->next, i++) {
 			const_toggle[i]= 1;
 //			add_numbut(i, TOG|INT, con->name, 0, 0, &(const_toggle[i]), "");
 		}
@@ -946,7 +968,7 @@ void free_posebuf(void)
 		bPoseChannel *pchan;
 		
 		for (pchan= g_posebuf->chanbase.first; pchan; pchan= pchan->next) {
-			if(pchan->prop) {
+			if (pchan->prop) {
 				IDP_FreeProperty(pchan->prop);
 				MEM_freeN(pchan->prop);
 			}
@@ -968,8 +990,8 @@ static void set_pose_keys (Object *ob)
 	bArmature *arm= ob->data;
 	bPoseChannel *chan;
 
-	if (ob->pose){
-		for (chan=ob->pose->chanbase.first; chan; chan=chan->next){
+	if (ob->pose) {
+		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;	
@@ -1110,7 +1132,7 @@ static int pose_copy_exec (bContext *C, wmOperator *op)
 	Object *ob= object_pose_armature_get(CTX_data_active_object(C));
 	
 	/* sanity checking */
-	if ELEM(NULL, ob, ob->pose) {
+	if (ELEM(NULL, ob, ob->pose)) {
 		BKE_report(op->reports, RPT_ERROR, "No Pose to Copy");
 		return OPERATOR_CANCELLED;
 	}
@@ -1129,16 +1151,16 @@ static int pose_copy_exec (bContext *C, wmOperator *op)
 void POSE_OT_copy (wmOperatorType *ot) 
 {
 	/* identifiers */
-	ot->name= "Copy Pose";
-	ot->idname= "POSE_OT_copy";
-	ot->description= "Copies the current pose of the selected bones to copy/paste buffer";
+	ot->name = "Copy Pose";
+	ot->idname = "POSE_OT_copy";
+	ot->description = "Copies the current pose of the selected bones to copy/paste buffer";
 	
 	/* api callbacks */
-	ot->exec= pose_copy_exec;
-	ot->poll= ED_operator_posemode;
+	ot->exec = pose_copy_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flag */
-	ot->flag= OPTYPE_REGISTER;
+	ot->flag = OPTYPE_REGISTER;
 }
 
 /* ---- */
@@ -1155,7 +1177,7 @@ static int pose_paste_exec (bContext *C, wmOperator *op)
 	KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_LOC_ROT_SCALE_ID);
 
 	/* sanity checks */
-	if ELEM(NULL, ob, ob->pose)
+	if (ELEM(NULL, ob, ob->pose))
 		return OPERATOR_CANCELLED;
 
 	if (g_posebuf == NULL) {
@@ -1164,7 +1186,7 @@ static int pose_paste_exec (bContext *C, wmOperator *op)
 	}
 	
 	/* if selOnly option is enabled, if user hasn't selected any bones, 
-	 * just go back to default behaviour to be more in line with other pose tools
+	 * just go back to default behavior to be more in line with other pose tools
 	 */
 	if (selOnly) {
 		if (CTX_DATA_COUNT(C, selected_pose_bones) == 0)
@@ -1195,20 +1217,24 @@ static int pose_paste_exec (bContext *C, wmOperator *op)
 
 void POSE_OT_paste (wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+
 	/* identifiers */
-	ot->name= "Paste Pose";
-	ot->idname= "POSE_OT_paste";
-	ot->description= "Paste the stored pose on to the current pose";
+	ot->name = "Paste Pose";
+	ot->idname = "POSE_OT_paste";
+	ot->description = "Paste the stored pose on to the current pose";
 	
 	/* api callbacks */
-	ot->exec= pose_paste_exec;
-	ot->poll= ED_operator_posemode;
+	ot->exec = pose_paste_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flag */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
-	RNA_def_boolean(ot->srna, "flipped", FALSE, "Flipped on X-Axis", "Paste the stored pose flipped on to current pose");
+	prop = RNA_def_boolean(ot->srna, "flipped", FALSE, "Flipped on X-Axis", "Paste the stored pose flipped on to current pose");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+
 	RNA_def_boolean(ot->srna, "selected_mask", FALSE, "On Selected Only", "Only paste the stored pose on to selected bones in the current pose");
 }
 
@@ -1242,13 +1268,13 @@ static int pose_group_add_exec (bContext *C, wmOperator *UNUSED(op))
 void POSE_OT_group_add (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Bone Group";
-	ot->idname= "POSE_OT_group_add";
-	ot->description= "Add a new bone group";
+	ot->name = "Add Bone Group";
+	ot->idname = "POSE_OT_group_add";
+	ot->description = "Add a new bone group";
 	
 	/* api callbacks */
-	ot->exec= pose_group_add_exec;
-	ot->poll= ED_operator_posemode;
+	ot->exec = pose_group_add_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1282,13 +1308,13 @@ static int pose_group_remove_exec (bContext *C, wmOperator *UNUSED(op))
 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->name = "Remove Bone Group";
+	ot->idname = "POSE_OT_group_remove";
+	ot->description = "Removes the active bone group";
 	
 	/* api callbacks */
-	ot->exec= pose_group_remove_exec;
-	ot->poll= ED_operator_posemode;
+	ot->exec = pose_group_remove_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1397,14 +1423,14 @@ static int pose_group_assign_exec (bContext *C, wmOperator *op)
 void POSE_OT_group_assign (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Selected to Bone Group";
-	ot->idname= "POSE_OT_group_assign";
-	ot->description= "Add selected bones to the chosen bone group";
+	ot->name = "Add Selected to Bone Group";
+	ot->idname = "POSE_OT_group_assign";
+	ot->description = "Add selected bones to the chosen bone group";
 	
 	/* api callbacks */
-	ot->invoke= pose_groups_menu_invoke;
-	ot->exec= pose_group_assign_exec;
-	ot->poll= ED_operator_posemode;
+	ot->invoke = pose_groups_menu_invoke;
+	ot->exec = pose_group_assign_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1453,13 +1479,13 @@ static int pose_group_unassign_exec (bContext *C, wmOperator *UNUSED(op))
 void POSE_OT_group_unassign (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove Selected from Bone Groups";
-	ot->idname= "POSE_OT_group_unassign";
-	ot->description= "Remove selected bones from all bone groups";
+	ot->name = "Remove Selected from Bone Groups";
+	ot->idname = "POSE_OT_group_unassign";
+	ot->description = "Remove selected bones from all bone groups";
 	
 	/* api callbacks */
-	ot->exec= pose_group_unassign_exec;
-	ot->poll= ED_operator_posemode;
+	ot->exec = pose_group_unassign_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1534,16 +1560,16 @@ void POSE_OT_group_move(wmOperatorType *ot)
 	};
 
 	/* identifiers */
-	ot->name= "Move Bone Group";
-	ot->idname= "POSE_OT_group_move";
-	ot->description= "Change position of active Bone Group in list of Bone Groups";
+	ot->name = "Move Bone Group";
+	ot->idname = "POSE_OT_group_move";
+	ot->description = "Change position of active Bone Group in list of Bone Groups";
 
 	/* api callbacks */
-	ot->exec= group_move_exec;
-	ot->poll= ED_operator_posemode;
+	ot->exec = group_move_exec;
+	ot->poll = ED_operator_posemode;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	RNA_def_enum(ot->srna, "direction", group_slot_move, 0, "Direction", "Direction to move, UP or DOWN");
 }
@@ -1618,16 +1644,16 @@ static int group_sort_exec(bContext *C, wmOperator *UNUSED(op))
 void POSE_OT_group_sort(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Sort Bone Groups";
-	ot->idname= "POSE_OT_group_sort";
-	ot->description= "Sort Bone Groups by their names in ascending order";
+	ot->name = "Sort Bone Groups";
+	ot->idname = "POSE_OT_group_sort";
+	ot->description = "Sort Bone Groups by their names in ascending order";
 
 	/* api callbacks */
-	ot->exec= group_sort_exec;
-	ot->poll= ED_operator_posemode;
+	ot->exec = group_sort_exec;
+	ot->poll = ED_operator_posemode;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static void pose_group_select(bContext *C, Object *ob, int select)
@@ -1676,13 +1702,13 @@ static int pose_group_select_exec (bContext *C, wmOperator *UNUSED(op))
 void POSE_OT_group_select (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Bones of Bone Group";
-	ot->idname= "POSE_OT_group_select";
-	ot->description= "Select bones in active Bone Group";
+	ot->name = "Select Bones of Bone Group";
+	ot->idname = "POSE_OT_group_select";
+	ot->description = "Select bones in active Bone Group";
 	
 	/* api callbacks */
-	ot->exec= pose_group_select_exec;
-	ot->poll= ED_operator_posemode;
+	ot->exec = pose_group_select_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1714,13 +1740,13 @@ static int pose_group_deselect_exec (bContext *C, wmOperator *UNUSED(op))
 void POSE_OT_group_deselect (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Deselect Bone Group";
-	ot->idname= "POSE_OT_group_deselect";
-	ot->description= "Deselect bones of active Bone Group";
+	ot->name = "Deselect Bone Group";
+	ot->idname = "POSE_OT_group_deselect";
+	ot->description = "Deselect bones of active Bone Group";
 	
 	/* api callbacks */
-	ot->exec= pose_group_deselect_exec;
-	ot->poll= ED_operator_posemode;
+	ot->exec = pose_group_deselect_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1759,16 +1785,16 @@ static int pose_flip_names_exec (bContext *C, wmOperator *UNUSED(op))
 void POSE_OT_flip_names (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Flip Names";
-	ot->idname= "POSE_OT_flip_names";
-	ot->description= "Flips (and corrects) the axis suffixes of the the names of selected bones";
+	ot->name = "Flip Names";
+	ot->idname = "POSE_OT_flip_names";
+	ot->description = "Flips (and corrects) the axis suffixes of the the names of selected bones";
 	
 	/* api callbacks */
-	ot->exec= pose_flip_names_exec;
-	ot->poll= ED_operator_posemode;
+	ot->exec = pose_flip_names_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ------------------ */
@@ -1789,7 +1815,7 @@ static int pose_autoside_names_exec (bContext *C, wmOperator *op)
 	CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones)
 	{
 		BLI_strncpy(newname, pchan->name, sizeof(newname));
-		if(bone_autoside_name(newname, 1, axis, pchan->bone->head[axis], pchan->bone->tail[axis]))
+		if (bone_autoside_name(newname, 1, axis, pchan->bone->head[axis], pchan->bone->tail[axis]))
 			ED_armature_bone_rename(arm, pchan->name, newname);
 	}
 	CTX_DATA_END;
@@ -1812,20 +1838,20 @@ void POSE_OT_autoside_names (wmOperatorType *ot)
 		{0, NULL, 0, NULL, NULL}};
 	
 	/* identifiers */
-	ot->name= "AutoName by Axis";
-	ot->idname= "POSE_OT_autoside_names";
-	ot->description= "Automatically renames the selected bones according to which side of the target axis they fall on";
+	ot->name = "AutoName by Axis";
+	ot->idname = "POSE_OT_autoside_names";
+	ot->description = "Automatically renames the selected bones according to which side of the target axis they fall on";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= pose_autoside_names_exec;
-	ot->poll= ED_operator_posemode;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = pose_autoside_names_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* settings */
-	ot->prop= RNA_def_enum(ot->srna, "axis", axis_items, 0, "Axis", "Axis tag names with");
+	ot->prop = RNA_def_enum(ot->srna, "axis", axis_items, 0, "Axis", "Axis tag names with");
 }
 
 /* ********************************************** */
@@ -1852,20 +1878,20 @@ static int pose_bone_rotmode_exec (bContext *C, wmOperator *op)
 void POSE_OT_rotation_mode_set (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Rotation Mode";
-	ot->idname= "POSE_OT_rotation_mode_set";
-	ot->description= "Set the rotation representation used by selected bones";
+	ot->name = "Set Rotation Mode";
+	ot->idname = "POSE_OT_rotation_mode_set";
+	ot->description = "Set the rotation representation used by selected bones";
 	
 	/* callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= pose_bone_rotmode_exec;
-	ot->poll= ED_operator_posemode;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = pose_bone_rotmode_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
-	ot->prop= RNA_def_enum(ot->srna, "type", posebone_rotmode_items, 0, "Rotation Mode", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", posebone_rotmode_items, 0, "Rotation Mode", "");
 }
 
 /* ********************************************** */
@@ -1911,16 +1937,16 @@ static int pose_armature_layers_showall_exec (bContext *C, wmOperator *op)
 void ARMATURE_OT_layers_show_all (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Show All Layers";
-	ot->idname= "ARMATURE_OT_layers_show_all";
-	ot->description= "Make all armature layers visible";
+	ot->name = "Show All Layers";
+	ot->idname = "ARMATURE_OT_layers_show_all";
+	ot->description = "Make all armature layers visible";
 	
 	/* callbacks */
-	ot->exec= pose_armature_layers_showall_exec;
-	ot->poll= pose_armature_layers_showall_poll;
+	ot->exec = pose_armature_layers_showall_exec;
+	ot->poll = pose_armature_layers_showall_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	ot->prop = RNA_def_boolean(ot->srna, "all", 1, "All Layers", "Enable all layers or just the first 16 (top row)");
@@ -1977,17 +2003,17 @@ static int pose_armature_layers_exec (bContext *C, wmOperator *op)
 void POSE_OT_armature_layers (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Change Armature Layers";
-	ot->idname= "POSE_OT_armature_layers";
-	ot->description= "Change the visible armature layers";
+	ot->name = "Change Armature Layers";
+	ot->idname = "POSE_OT_armature_layers";
+	ot->description = "Change the visible armature layers";
 	
 	/* callbacks */
-	ot->invoke= pose_armature_layers_invoke;
-	ot->exec= pose_armature_layers_exec;
-	ot->poll= ED_operator_posemode;
+	ot->invoke = pose_armature_layers_invoke;
+	ot->exec = pose_armature_layers_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_boolean_layer_member(ot->srna, "layers", 32, NULL, "Layer", "Armature layers to make visible");
@@ -1996,17 +2022,17 @@ void POSE_OT_armature_layers (wmOperatorType *ot)
 void ARMATURE_OT_armature_layers (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Change Armature Layers";
-	ot->idname= "ARMATURE_OT_armature_layers";
-	ot->description= "Change the visible armature layers";
+	ot->name = "Change Armature Layers";
+	ot->idname = "ARMATURE_OT_armature_layers";
+	ot->description = "Change the visible armature layers";
 	
 	/* callbacks */
-	ot->invoke= pose_armature_layers_invoke;
-	ot->exec= pose_armature_layers_exec;
-	ot->poll= ED_operator_editarmature;
+	ot->invoke = pose_armature_layers_invoke;
+	ot->exec = pose_armature_layers_exec;
+	ot->poll = ED_operator_editarmature;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_boolean_layer_member(ot->srna, "layers", 32, NULL, "Layer", "Armature layers to make visible");
@@ -2046,7 +2072,7 @@ static int pose_bone_layers_exec (bContext *C, wmOperator *op)
 	PointerRNA ptr;
 	int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */
 
-	if(ob==NULL || ob->data==NULL) {
+	if (ob==NULL || ob->data==NULL) {
 		return OPERATOR_CANCELLED;
 	}
 
@@ -2071,17 +2097,17 @@ static int pose_bone_layers_exec (bContext *C, wmOperator *op)
 void POSE_OT_bone_layers (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Change Bone Layers";
-	ot->idname= "POSE_OT_bone_layers";
-	ot->description= "Change the layers that the selected bones belong to";
+	ot->name = "Change Bone Layers";
+	ot->idname = "POSE_OT_bone_layers";
+	ot->description = "Change the layers that the selected bones belong to";
 	
 	/* callbacks */
-	ot->invoke= pose_bone_layers_invoke;
-	ot->exec= pose_bone_layers_exec;
-	ot->poll= ED_operator_posemode;
+	ot->invoke = pose_bone_layers_invoke;
+	ot->exec = pose_bone_layers_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_boolean_layer_member(ot->srna, "layers", 32, NULL, "Layer", "Armature layers that bone belongs to");
@@ -2143,17 +2169,17 @@ static int armature_bone_layers_exec (bContext *C, wmOperator *op)
 void ARMATURE_OT_bone_layers (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Change Bone Layers";
-	ot->idname= "ARMATURE_OT_bone_layers";
-	ot->description= "Change the layers that the selected bones belong to";
+	ot->name = "Change Bone Layers";
+	ot->idname = "ARMATURE_OT_bone_layers";
+	ot->description = "Change the layers that the selected bones belong to";
 	
 	/* callbacks */
-	ot->invoke= armature_bone_layers_invoke;
-	ot->exec= armature_bone_layers_exec;
-	ot->poll= ED_operator_editarmature;
+	ot->invoke = armature_bone_layers_invoke;
+	ot->exec = armature_bone_layers_exec;
+	ot->poll = ED_operator_editarmature;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_boolean_layer_member(ot->srna, "layers", 32, NULL, "Layer", "Armature layers that bone belongs to");
@@ -2192,15 +2218,15 @@ void POSE_OT_quaternions_flip (wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name = "Flip Quats";
-	ot->idname= "POSE_OT_quaternions_flip";
-	ot->description= "Flip quaternion values to achieve desired rotations, while maintaining the same orientations";
+	ot->idname = "POSE_OT_quaternions_flip";
+	ot->description = "Flip quaternion values to achieve desired rotations, while maintaining the same orientations";
 	
 	/* callbacks */
-	ot->exec= pose_flip_quats_exec;
-	ot->poll= ED_operator_posemode;
+	ot->exec = pose_flip_quats_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ********************************************** */
@@ -2268,14 +2294,14 @@ void POSE_OT_user_transforms_clear (wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name = "Clear User Transforms";
-	ot->idname= "POSE_OT_user_transforms_clear";
-	ot->description= "Reset pose on selected bones to keyframed state";
+	ot->idname = "POSE_OT_user_transforms_clear";
+	ot->description = "Reset pose on selected bones to keyframed state";
 	
 	/* callbacks */
-	ot->exec= pose_clear_user_transforms_exec;
-	ot->poll= ED_operator_posemode;
+	ot->exec = pose_clear_user_transforms_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c
index bcdda8e..546bcb1 100644
--- a/source/blender/editors/armature/reeb.c
+++ b/source/blender/editors/armature/reeb.c
@@ -52,6 +52,7 @@
 //#include "BIF_toolbox.h"
 //#include "BIF_graphics.h"
 
+#include "BKE_mesh.h"
 
 //#include "blendef.h"
 
@@ -114,6 +115,7 @@ void flipArcBuckets(ReebArc *arc);
 
 /***************************************** UTILS **********************************************/
 
+#if 0 /* UNUSED */
 static VertexData *allocVertexData(EditMesh *em)
 {
 	VertexData *data;
@@ -124,7 +126,7 @@ static VertexData *allocVertexData(EditMesh *em)
 	
 	data = MEM_callocN(sizeof(VertexData) * totvert, "VertexData");
 
-	for(index = 0, eve = em->verts.first; eve; index++, eve = eve->next)
+	for (index = 0, eve = em->verts.first; eve; index++, eve = eve->next)
 	{
 		data[index].i = index;
 		data[index].w = 0;
@@ -159,6 +161,8 @@ static void nodeSetData(EditVert *eve, ReebNode *n)
 	((VertexData*)eve->tmp.p)->n = n;
 }
 
+#endif
+
 void REEB_freeArc(BArc *barc)
 {
 	ReebArc *arc = (ReebArc*)barc;
@@ -179,7 +183,7 @@ void REEB_freeGraph(ReebGraph *rg)
 	ReebNode *node;
 	
 	// free nodes
-	for( node = rg->nodes.first; node; node = node->next )
+	for ( node = rg->nodes.first; node; node = node->next )
 	{
 		BLI_freeNode((BGraph*)rg, (BNode*)node);
 	}
@@ -187,7 +191,7 @@ void REEB_freeGraph(ReebGraph *rg)
 	
 	// free arcs
 	arc = rg->arcs.first;
-	while( arc )
+	while ( arc )
 	{
 		ReebArc *next = arc->next;
 		REEB_freeArc((BArc*)arc);
@@ -231,6 +235,7 @@ void BIF_flagMultiArcs(ReebGraph *rg, int flag)
 	}
 }
 
+#if 0 /* UNUSED */
 static ReebNode * addNode(ReebGraph *rg, EditVert *eve)
 {
 	float weight;
@@ -246,7 +251,7 @@ static ReebNode * addNode(ReebGraph *rg, EditVert *eve)
 	node->degree = 0;
 	node->weight = weight;
 	node->index = rg->totnodes;
-	VECCOPY(node->p, eve->co);	
+	copy_v3_v3(node->p, eve->co);
 	
 	BLI_addtail(&rg->nodes, node);
 	rg->totnodes++;
@@ -299,6 +304,7 @@ static void relinkNodes(ReebGraph *low_rg, ReebGraph *high_rg)
 		}
 	}
 }
+#endif 
 
 ReebNode *BIF_otherNodeFromIndex(ReebArc *arc, ReebNode *node)
 {
@@ -320,6 +326,7 @@ ReebNode *BIF_lowestLevelNode(ReebNode *node)
 	return node;
 }
 
+#if 0 /* UNUSED */
 static ReebArc * copyArc(ReebGraph *rg, ReebArc *arc)
 {
 	ReebArc *cp_arc;
@@ -394,12 +401,13 @@ static ReebGraph * copyReebGraph(ReebGraph *rg, int level)
 	
 	return cp_rg;
 }
+#endif
 
 ReebGraph *BIF_graphForMultiNode(ReebGraph *rg, ReebNode *node)
 {
 	ReebGraph *multi_rg = rg;
 	
-	while(multi_rg && multi_rg->multi_level != node->multi_level)
+	while (multi_rg && multi_rg->multi_level != node->multi_level)
 	{
 		multi_rg = multi_rg->link_up;
 	}
@@ -407,6 +415,7 @@ ReebGraph *BIF_graphForMultiNode(ReebGraph *rg, ReebNode *node)
 	return multi_rg;
 }
 
+#if 0 /* UNUSED */
 static ReebEdge * copyEdge(ReebEdge *edge)
 {
 	ReebEdge *newEdge = NULL;
@@ -427,7 +436,7 @@ static void printArc(ReebArc *arc)
 	ReebNode *tail = (ReebNode*)arc->tail;
 	printf("arc: (%i) %f -> (%i) %f\n", head->index, head->weight, tail->index, tail->weight);
 	
-	for(edge = arc->edges.first; edge ; edge = edge->next)
+	for (edge = arc->edges.first; edge ; edge = edge->next)
 	{
 		printf("\tedge (%i, %i)\n", edge->v1->index, edge->v2->index);
 	}
@@ -475,22 +484,22 @@ void repositionNodes(ReebGraph *rg)
 	BNode *node = NULL;
 	
 	// Reset node positions
-	for(node = rg->nodes.first; node; node = node->next)
+	for (node = rg->nodes.first; node; node = node->next)
 	{
 		node->p[0] = node->p[1] = node->p[2] = 0;
 	}
 	
-	for(arc = rg->arcs.first; arc; arc = arc->next)
+	for (arc = rg->arcs.first; arc; arc = arc->next)
 	{
 		if (((ReebArc*)arc)->bcount > 0)
 		{
 			float p[3];
 			
-			VECCOPY(p, ((ReebArc*)arc)->buckets[0].p);
+			copy_v3_v3(p, ((ReebArc*)arc)->buckets[0].p);
 			mul_v3_fl(p, 1.0f / arc->head->degree);
 			add_v3_v3(arc->head->p, p);
 			
-			VECCOPY(p, ((ReebArc*)arc)->buckets[((ReebArc*)arc)->bcount - 1].p);
+			copy_v3_v3(p, ((ReebArc*)arc)->buckets[((ReebArc*)arc)->bcount - 1].p);
 			mul_v3_fl(p, 1.0f / arc->tail->degree);
 			add_v3_v3(arc->tail->p, p);
 		}
@@ -503,10 +512,10 @@ void verifyNodeDegree(ReebGraph *rg)
 	ReebNode *node = NULL;
 	ReebArc *arc = NULL;
 
-	for(node = rg->nodes.first; node; node = node->next)
+	for (node = rg->nodes.first; node; node = node->next)
 	{
 		int count = 0;
-		for(arc = rg->arcs.first; arc; arc = arc->next)
+		for (arc = rg->arcs.first; arc; arc = arc->next)
 		{
 			if (arc->head == node || arc->tail == node)
 			{
@@ -533,7 +542,7 @@ static void verifyBucketsArc(ReebGraph *UNUSED(rg), ReebArc *arc)
 	if (arc->bcount > 0)
 	{
 		int i;
-		for(i = 0; i < arc->bcount; i++)
+		for (i = 0; i < arc->bcount; i++)
 		{
 			if (arc->buckets[i].nv == 0)
 			{
@@ -545,12 +554,12 @@ static void verifyBucketsArc(ReebGraph *UNUSED(rg), ReebArc *arc)
 		if (ceilf(head->weight) != arc->buckets[0].val)
 		{
 			printArc(arc);
-			printf("alloc error in first bucket: %f should be %f \n", arc->buckets[0].val, ceil(head->weight));
+			printf("alloc error in first bucket: %f should be %f\n", arc->buckets[0].val, ceil(head->weight));
 		}
 		if (floorf(tail->weight) != arc->buckets[arc->bcount - 1].val)
 		{
 			printArc(arc);
-			printf("alloc error in last bucket: %f should be %f \n", arc->buckets[arc->bcount - 1].val, floor(tail->weight));
+			printf("alloc error in last bucket: %f should be %f\n", arc->buckets[arc->bcount - 1].val, floor(tail->weight));
 		}
 	}
 }
@@ -559,7 +568,7 @@ void verifyBuckets(ReebGraph *rg)
 {
 #ifdef DEBUG_REEB
 	ReebArc *arc = NULL;
-	for(arc = rg->arcs.first; arc; arc = arc->next)
+	for (arc = rg->arcs.first; arc; arc = arc->next)
 	{
 		verifyBucketsArc(rg, arc);
 	}
@@ -571,7 +580,7 @@ void verifyFaces(ReebGraph *rg)
 #ifdef DEBUG_REEB
 	int total = 0;
 	ReebArc *arc = NULL;
-	for(arc = rg->arcs.first; arc; arc = arc->next)
+	for (arc = rg->arcs.first; arc; arc = arc->next)
 	{
 		total += BLI_ghash_size(arc->faces);
 	}
@@ -646,7 +655,7 @@ static void mergeBuckets(EmbedBucket *bDst, EmbedBucket *bSrc)
 	else if (bSrc->nv > 0)
 	{
 		bDst->nv = bSrc->nv;
-		VECCOPY(bDst->p, bSrc->p);
+		copy_v3_v3(bDst->p, bSrc->p);
 	}
 }
 
@@ -658,17 +667,17 @@ static void mergeArcBuckets(ReebArc *aDst, ReebArc *aSrc, float start, float end
 		
 		start = MAX3(start, aDst->buckets[0].val, aSrc->buckets[0].val);
 		
-		while(indexDst < aDst->bcount && aDst->buckets[indexDst].val < start)
+		while (indexDst < aDst->bcount && aDst->buckets[indexDst].val < start)
 		{
 			indexDst++;
 		}
 
-		while(indexSrc < aSrc->bcount && aSrc->buckets[indexSrc].val < start)
+		while (indexSrc < aSrc->bcount && aSrc->buckets[indexSrc].val < start)
 		{
 			indexSrc++;
 		}
 		
-		for( ;	indexDst < aDst->bcount &&
+		for ( ;	indexDst < aDst->bcount &&
 				indexSrc < aSrc->bcount &&
 				aDst->buckets[indexDst].val <= end &&
 				aSrc->buckets[indexSrc].val <= end
@@ -709,7 +718,7 @@ static void allocArcBuckets(ReebArc *arc)
 	{
 		arc->buckets = MEM_callocN(sizeof(EmbedBucket) * arc->bcount, "embed bucket");
 		
-		for(i = 0; i < arc->bcount; i++)
+		for (i = 0; i < arc->bcount; i++)
 		{
 			arc->buckets[i].val = start + i;
 		}
@@ -770,7 +779,7 @@ static void reweightBuckets(ReebArc *arc)
 	
 	if (arc->bcount > 0)
 	{
-		for(i = 0; i < arc->bcount; i++)
+		for (i = 0; i < arc->bcount; i++)
 		{
 			arc->buckets[i].val = start + i;
 		}
@@ -801,7 +810,7 @@ static void fillArcEmptyBuckets(ReebArc *arc)
 	
 	start_p = arc->head->p;
 	
-	for(i = 0; i < arc->bcount; i++)
+	for (i = 0; i < arc->bcount; i++)
 	{
 		EmbedBucket *bucket = arc->buckets + i;
 		
@@ -953,6 +962,7 @@ static void calculateGraphLength(ReebGraph *rg)
 		calculateArcLength(arc);
 	}
 }
+#endif
 
 /**************************************** SYMMETRY HANDLING ******************************************/
 
@@ -962,7 +972,7 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count)
 	float axis[3];
 	int i;
 	
-	VECCOPY(axis, root_node->symmetry_axis);
+	copy_v3_v3(axis, root_node->symmetry_axis);
 	
 	/* first pass, merge incrementally */
 	for (i = 0; i < count - 1; i++)
@@ -1003,12 +1013,12 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count)
 			bucket2 = IT_next(iter2);
 		
 			/* Make sure they both start at the same value */	
-			while(bucket1 && bucket2 && bucket1->val < bucket2->val)
+			while (bucket1 && bucket2 && bucket1->val < bucket2->val)
 			{
 				bucket1 = IT_next(iter1);
 			}
 			
-			while(bucket1 && bucket2 && bucket2->val < bucket1->val)
+			while (bucket1 && bucket2 && bucket2->val < bucket1->val)
 			{
 				bucket2 = IT_next(iter2);
 			}
@@ -1045,7 +1055,7 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count)
 		arc2 = (ReebArc*)ring[j].arc;
 
 		/* copy first node than mirror */
-		VECCOPY(node2->p, node1->p);
+		copy_v3_v3(node2->p, node1->p);
 		BLI_mirrorAlongAxis(node2->p, root_node->p, normal);
 		
 		/* Copy buckets
@@ -1065,12 +1075,12 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count)
 			bucket2 = IT_next(iter2);
 		
 			/* Make sure they both start at the same value */	
-			while(bucket1 && bucket1->val < bucket2->val)
+			while (bucket1 && bucket1->val < bucket2->val)
 			{
 				bucket1 = IT_next(iter1);
 			}
 			
-			while(bucket2 && bucket2->val < bucket1->val)
+			while (bucket2 && bucket2->val < bucket1->val)
 			{
 				bucket2 = IT_next(iter2);
 			}
@@ -1080,7 +1090,7 @@ void REEB_RadialSymmetry(BNode* root_node, RadialArc* ring, int count)
 			{
 				/* copy and mirror back to bucket2 */			
 				bucket2->nv = bucket1->nv;
-				VECCOPY(bucket2->p, bucket1->p);
+				copy_v3_v3(bucket2->p, bucket1->p);
 				BLI_mirrorAlongAxis(bucket2->p, node->p, normal);
 			}
 		}
@@ -1095,10 +1105,10 @@ void REEB_AxialSymmetry(BNode* root_node, BNode* node1, BNode* node2, struct BAr
 	arc1 = (ReebArc*)barc1;
 	arc2 = (ReebArc*)barc2;
 
-	VECCOPY(nor, root_node->symmetry_axis);
+	copy_v3_v3(nor, root_node->symmetry_axis);
 	
 	/* mirror node2 along axis */
-	VECCOPY(p, node2->p);
+	copy_v3_v3(p, node2->p);
 	BLI_mirrorAlongAxis(p, root_node->p, nor);
 
 	/* average with node1 */
@@ -1106,7 +1116,7 @@ void REEB_AxialSymmetry(BNode* root_node, BNode* node1, BNode* node2, struct BAr
 	mul_v3_fl(node1->p, 0.5f);
 	
 	/* mirror back on node2 */
-	VECCOPY(node2->p, node1->p);
+	copy_v3_v3(node2->p, node1->p);
 	BLI_mirrorAlongAxis(node2->p, root_node->p, nor);
 	
 	/* Merge buckets
@@ -1126,12 +1136,12 @@ void REEB_AxialSymmetry(BNode* root_node, BNode* node1, BNode* node2, struct BAr
 		bucket2 = IT_next(iter2);
 	
 		/* Make sure they both start at the same value */	
-		while(bucket1 && bucket1->val < bucket2->val)
+		while (bucket1 && bucket1->val < bucket2->val)
 		{
 			bucket1 = IT_next(iter1);
 		}
 		
-		while(bucket2 && bucket2->val < bucket1->val)
+		while (bucket2 && bucket2->val < bucket1->val)
 		{
 			bucket2 = IT_next(iter2);
 		}
@@ -1148,7 +1158,7 @@ void REEB_AxialSymmetry(BNode* root_node, BNode* node1, BNode* node2, struct BAr
 
 			/* copy and mirror back to bucket2 */			
 			bucket2->nv = bucket1->nv;
-			VECCOPY(bucket2->p, bucket1->p);
+			copy_v3_v3(bucket2->p, bucket1->p);
 			BLI_mirrorAlongAxis(bucket2->p, root_node->p, nor);
 		}
 	}
@@ -1159,6 +1169,7 @@ void REEB_AxialSymmetry(BNode* root_node, BNode* node1, BNode* node2, struct BAr
 
 /****************************************** SMOOTHING **************************************************/
 
+#if 0 /* UNUSED */
 void postprocessGraph(ReebGraph *rg, char mode)
 {
 	ReebArc *arc;
@@ -1183,13 +1194,13 @@ void postprocessGraph(ReebGraph *rg, char mode)
 		return;
 	}
 	
-	for(arc = rg->arcs.first; arc; arc = arc->next)
+	for (arc = rg->arcs.first; arc; arc = arc->next)
 	{
 		EmbedBucket *buckets = arc->buckets;
 		int bcount = arc->bcount;
 		int index;
 
-		for(index = 1; index < bcount - 1; index++)
+		for (index = 1; index < bcount - 1; index++)
 		{
 			interp_v3_v3v3(buckets[index].p, buckets[index].p, buckets[index - 1].p, fac1 / (fac1 + fac2));
 			interp_v3_v3v3(buckets[index].p, buckets[index].p, buckets[index + 1].p, fac3 / (fac1 + fac2 + fac3));
@@ -1500,7 +1511,7 @@ static void filterArc(ReebGraph *rg, ReebNode *newNode, ReebNode *removedNode, R
 	if (merging)
 	{
 		/* first pass, merge buckets for arcs that spawned the two nodes into the source arc*/
-		for(arc = rg->arcs.first; arc; arc = arc->next)
+		for (arc = rg->arcs.first; arc; arc = arc->next)
 		{
 			if (arc->head == srcArc->head && arc->tail == srcArc->tail && arc != srcArc)
 			{
@@ -1513,7 +1524,7 @@ static void filterArc(ReebGraph *rg, ReebNode *newNode, ReebNode *removedNode, R
 
 	/* second pass, replace removedNode by newNode, remove arcs that are collapsed in a loop */
 	arc = rg->arcs.first;
-	while(arc)
+	while (arc)
 	{
 		nextArc = arc->next;
 		
@@ -1576,7 +1587,7 @@ void filterNullReebGraph(ReebGraph *rg)
 	ReebArc *arc = NULL, *nextArc = NULL;
 	
 	arc = rg->arcs.first;
-	while(arc)
+	while (arc)
 	{
 		nextArc = arc->next;
 		// Only collapse arcs too short to have any embed bucket
@@ -1738,14 +1749,14 @@ int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold))
 #ifdef DEBUG_REEB
 	{	
 		EditFace *efa;
-		for(efa=G.editMesh->faces.first; efa; efa=efa->next) {
+		for (efa=G.editMesh->faces.first; efa; efa=efa->next) {
 			efa->tmp.fp = -1;
 		}
 	}
 #endif
 
 	arc = rg->arcs.first;
-	while(arc)
+	while (arc)
 	{
 		nextArc = arc->next;
 		
@@ -1761,7 +1772,7 @@ int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold))
 			float avg_angle = 0;
 			float avg_vec[3] = {0,0,0};
 			
-			for(BLI_ghashIterator_init(&ghi, arc->faces);
+			for (BLI_ghashIterator_init(&ghi, arc->faces);
 				!BLI_ghashIterator_isDone(&ghi);
 				BLI_ghashIterator_step(&ghi))
 			{
@@ -1797,7 +1808,7 @@ int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold))
 						vec0 = previous->p;
 					}
 					
-					VECCOPY(midpoint, vec1);
+					copy_v3_v3(midpoint, vec1);
 					
 					distance = len_v3v3(midpoint, efa->cent);
 					
@@ -1952,7 +1963,7 @@ static void finalizeGraph(ReebGraph *rg, char passes, char method)
 	
 	sortArcs(rg);
 	
-	for(i = 0; i <  passes; i++)
+	for (i = 0; i <  passes; i++)
 	{
 		postprocessGraph(rg, method);
 	}
@@ -1990,17 +2001,17 @@ static void spreadWeight(EditMesh *em)
 	
 	verts = MEM_callocN(sizeof(EditVert*) * totvert, "verts array");
 	
-	for(eve = em->verts.first, i = 0; eve; eve = eve->next, i++)
+	for (eve = em->verts.first, i = 0; eve; eve = eve->next, i++)
 	{
 		verts[i] = eve;
 	}
 	
-	while(work_needed == 1)
+	while (work_needed == 1)
 	{
 		work_needed = 0;
 		qsort(verts, totvert, sizeof(EditVert*), compareVerts);
 		
-		for(i = 0; i < totvert; i++)
+		for (i = 0; i < totvert; i++)
 		{
 			eve = verts[i];
 			
@@ -2040,16 +2051,16 @@ void REEB_exportGraph(ReebGraph *rg, int count)
 	else {
 		sprintf(filename, "test%05i.txt", count);
 	}
-	f = fopen(filename, "w");
+	f = BLI_fopen(filename, "w");
 
-	for(arc = rg->arcs.first; arc; arc = arc->next)
+	for (arc = rg->arcs.first; arc; arc = arc->next)
 	{
 		int i;
 		float p[3];
 		
 		exportNode(f, "v1", arc->head);
 		
-		for(i = 0; i < arc->bcount; i++)
+		for (i = 0; i < arc->bcount; i++)
 		{
 			fprintf(f, "b nv:%i %f %f %f\n", arc->buckets[i].nv, arc->buckets[i].p[0], arc->buckets[i].p[1], arc->buckets[i].p[2]);
 		}
@@ -2087,7 +2098,7 @@ void removeNormalNodes(ReebGraph *rg)
 	ReebArc *arc, *nextArc;
 	
 	// Merge degree 2 nodes
-	for(arc = rg->arcs.first; arc; arc = nextArc)
+	for (arc = rg->arcs.first; arc; arc = nextArc)
 	{
 		nextArc = arc->next;
 		
@@ -2165,7 +2176,7 @@ static ReebArc *nextArcMappedToEdge(ReebArc *arc, ReebEdge *e)
 	ReebArc *result = NULL;
 
 	/* Find the ReebEdge in the edge list */
-	for(edge = arc->edges.first; edge && !edgeEquals(edge, e); edge = edge->next)
+	for (edge = arc->edges.first; edge && !edgeEquals(edge, e); edge = edge->next)
 	{	}
 	
 	nextEdge = edge->nextEdge;
@@ -2187,7 +2198,7 @@ void mergeArcFaces(ReebGraph *UNUSED(rg), ReebArc *aDst, ReebArc *aSrc)
 {
 	GHashIterator ghi;
 	
-	for(BLI_ghashIterator_init(&ghi, aSrc->faces);
+	for (BLI_ghashIterator_init(&ghi, aSrc->faces);
 		!BLI_ghashIterator_isDone(&ghi);
 		BLI_ghashIterator_step(&ghi))
 	{
@@ -2202,7 +2213,7 @@ void mergeArcEdges(ReebGraph *rg, ReebArc *aDst, ReebArc *aSrc, MergeDirection d
 	
 	if (direction == MERGE_APPEND)
 	{
-		for(e = aSrc->edges.first; e; e = e->next)
+		for (e = aSrc->edges.first; e; e = e->next)
 		{
 			e->arc = aDst; // Edge is stolen by new arc
 		}
@@ -2211,7 +2222,7 @@ void mergeArcEdges(ReebGraph *rg, ReebArc *aDst, ReebArc *aSrc, MergeDirection d
 	}
 	else
 	{
-		for(e = aSrc->edges.first; e; e = e->next)
+		for (e = aSrc->edges.first; e; e = e->next)
 		{
 			ReebEdge *newEdge = copyEdge(e);
 
@@ -2235,7 +2246,7 @@ void mergeArcEdges(ReebGraph *rg, ReebArc *aDst, ReebArc *aSrc, MergeDirection d
 				{
 					ReebEdge *previous = (ReebEdge*)*p;
 					
-					while(previous->nextEdge != e)
+					while (previous->nextEdge != e)
 					{
 						previous = previous->nextEdge;
 					}
@@ -2486,7 +2497,7 @@ static ReebEdge * createArc(ReebGraph *rg, ReebNode *node1, ReebNode *node2)
 			addVertToBucket(&(arc->buckets[arc->bcount - 1]), arc->tail->co);
 		}
 #else
-		for(i = 0; i < arc->bcount; i++)
+		for (i = 0; i < arc->bcount; i++)
 		{
 			float co[3];
 			float f = (arc->buckets[i].val - offset) / len;
@@ -2584,7 +2595,7 @@ ReebGraph * generateReebGraph(EditMesh *em, int subdivisions)
 	renormalizeWeight(em, (float)rg->resolution);
 
 	/* Adding vertice */
-	for(index = 0, eve = em->verts.first; eve; eve = eve->next)
+	for (index = 0, eve = em->verts.first; eve; eve = eve->next)
 	{
 		if (eve->h == 0)
 		{
@@ -2595,7 +2606,7 @@ ReebGraph * generateReebGraph(EditMesh *em, int subdivisions)
 	}
 	
 	/* Adding face, edge per edge */
-	for(efa = em->faces.first; efa; efa = efa->next)
+	for (efa = em->faces.first; efa; efa = efa->next)
 	{
 		if (efa->h == 0)
 		{
@@ -2645,7 +2656,7 @@ void renormalizeWeight(EditMesh *em, float newmax)
 	eve = em->verts.first;
 	minimum = weightData(eve);
 	maximum = minimum;
-	for(; eve; eve = eve->next)
+	for (; eve; eve = eve->next)
 	{
 		maximum = MAX2(maximum, weightData(eve));
 		minimum = MIN2(minimum, weightData(eve));
@@ -2654,7 +2665,7 @@ void renormalizeWeight(EditMesh *em, float newmax)
 	range = maximum - minimum;
 
 	/* Normalize weights */
-	for(eve = em->verts.first; eve; eve = eve->next)
+	for (eve = em->verts.first; eve; eve = eve->next)
 	{
 		float weight = (weightData(eve) - minimum) / range * newmax;
 		weightSetData(eve, weight);
@@ -2670,7 +2681,7 @@ int weightFromLoc(EditMesh *em, int axis)
 		return 0;
 
 	/* Copy coordinate in weight */
-	for(eve = em->verts.first; eve; eve = eve->next)
+	for (eve = em->verts.first; eve; eve = eve->next)
 	{
 		weightSetData(eve, eve->co[axis]);
 	}
@@ -2734,7 +2745,7 @@ int weightToHarmonic(EditMesh *em, EdgeIndex *indexed_edges)
 	int rval;
 	
 	/* Find local extrema */
-	for(eve = em->verts.first; eve; eve = eve->next)
+	for (eve = em->verts.first; eve; eve = eve->next)
 	{
 		totvert++;
 	}
@@ -2748,7 +2759,7 @@ int weightToHarmonic(EditMesh *em, EdgeIndex *indexed_edges)
 	nlBegin(NL_SYSTEM);
 	
 	/* Find local extrema */
-	for(index = 0, eve = em->verts.first; eve; index++, eve = eve->next)
+	for (index = 0, eve = em->verts.first; eve; index++, eve = eve->next)
 	{
 		if (eve->h == 0)
 		{
@@ -2757,7 +2768,7 @@ int weightToHarmonic(EditMesh *em, EdgeIndex *indexed_edges)
 			int minimum = 1;
 			
 			NextEdgeForVert(indexed_edges, -1); /* Reset next edge */
-			for(eed = NextEdgeForVert(indexed_edges, index); eed && (maximum || minimum); eed = NextEdgeForVert(indexed_edges, index))
+			for (eed = NextEdgeForVert(indexed_edges, index); eed && (maximum || minimum); eed = NextEdgeForVert(indexed_edges, index))
 			{
 				EditVert *eve2;
 				
@@ -2802,13 +2813,13 @@ int weightToHarmonic(EditMesh *em, EdgeIndex *indexed_edges)
 	nlBegin(NL_MATRIX);
 
 	/* Zero edge weight */
-	for(eed = em->edges.first; eed; eed = eed->next)
+	for (eed = em->edges.first; eed; eed = eed->next)
 	{
 		eed->tmp.l = 0;
 	}
 	
 	/* Add faces count to the edge weight */
-	for(efa = em->faces.first; efa; efa = efa->next)
+	for (efa = em->faces.first; efa; efa = efa->next)
 	{
 		if (efa->h == 0)
 		{
@@ -2824,7 +2835,7 @@ int weightToHarmonic(EditMesh *em, EdgeIndex *indexed_edges)
 	}
 
 	/* Add faces angle to the edge weight */
-	for(efa = em->faces.first; efa; efa = efa->next)
+	for (efa = em->faces.first; efa; efa = efa->next)
 	{
 		if (efa->h == 0)
 		{
@@ -2849,7 +2860,7 @@ int weightToHarmonic(EditMesh *em, EdgeIndex *indexed_edges)
 	if (success)
 	{
 		rval = 1;
-		for(index = 0, eve = em->verts.first; eve; index++, eve = eve->next)
+		for (index = 0, eve = em->verts.first; eve; index++, eve = eve->next)
 		{
 			weightSetData(eve, nlGetVariable(0, index));
 		}
@@ -2905,7 +2916,7 @@ static void shortestPathsFromVert(EditMesh *em, EditVert *starting_vert, EdgeInd
 	BLI_heap_insert(edge_heap, FLT_MAX, NULL);
 
 	/* Initialize edge flag */
-	for(eed= em->edges.first; eed; eed= eed->next)
+	for (eed= em->edges.first; eed; eed= eed->next)
 	{
 		eed->f1 = 0;
 	}
@@ -2918,7 +2929,7 @@ static void shortestPathsFromVert(EditMesh *em, EditVert *starting_vert, EdgeInd
 		
 		/* Add all new edges connected to current_eve to the list */
 		NextEdgeForVert(indexed_edges, -1); // Reset next edge
-		for(eed = NextEdgeForVert(indexed_edges, indexData(current_eve)); eed; eed = NextEdgeForVert(indexed_edges, indexData(current_eve)))
+		for (eed = NextEdgeForVert(indexed_edges, indexData(current_eve)); eed; eed = NextEdgeForVert(indexed_edges, indexData(current_eve)))
 		{ 
 			if (eed->f1 == 0)
 			{
@@ -2972,7 +2983,7 @@ static void buildIndexedEdges(EditMesh *em, EdgeIndex *indexed_edges)
 
 	indexed_edges->offset = MEM_callocN(totvert * sizeof(int), "EdgeIndex offset");
 
-	for(eed = em->edges.first; eed; eed = eed->next)
+	for (eed = em->edges.first; eed; eed = eed->next)
 	{
 		if (eed->v1->h == 0 && eed->v2->h == 0)
 		{
@@ -2987,7 +2998,7 @@ static void buildIndexedEdges(EditMesh *em, EdgeIndex *indexed_edges)
 	indexed_edges->edges = MEM_callocN(tot_indexed * sizeof(EditEdge*), "EdgeIndex edges");
 
 	/* setting vert offsets */
-	for(eve = em->verts.first; eve; eve = eve->next)
+	for (eve = em->verts.first; eve; eve = eve->next)
 	{
 		if (eve->h == 0)
 		{
@@ -2998,7 +3009,7 @@ static void buildIndexedEdges(EditMesh *em, EdgeIndex *indexed_edges)
 	}
 
 	/* adding edges in array */
-	for(eed = em->edges.first; eed; eed= eed->next)
+	for (eed = em->edges.first; eed; eed= eed->next)
 	{
 		if (eed->v1->h == 0 && eed->v2->h == 0)
 		{
@@ -3046,7 +3057,7 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges)
 	}
 	
 	/* Initialize vertice flag and find at least one selected vertex */
-	for(eve = em->verts.first; eve; eve = eve->next)
+	for (eve = em->verts.first; eve; eve = eve->next)
 	{
 		eve->f1 = 0;
 		if (eve->f & SELECT)
@@ -3065,7 +3076,7 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges)
 		int allDone = 0;
 
 		/* Calculate edge weight */
-		for(eed = em->edges.first; eed; eed= eed->next)
+		for (eed = em->edges.first; eed; eed= eed->next)
 		{
 			if (eed->v1->h == 0 && eed->v2->h == 0)
 			{
@@ -3074,7 +3085,7 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges)
 		}
 
 		/* Apply dijkstra spf for each selected vert */
-		for(eve = em->verts.first; eve; eve = eve->next)
+		for (eve = em->verts.first; eve; eve = eve->next)
 		{
 			if (eve->f & SELECT)
 			{
@@ -3126,7 +3137,7 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges)
 		}
 	}
 
-	for(eve = em->verts.first; eve && vCount == 0; eve = eve->next)
+	for (eve = em->verts.first; eve && vCount == 0; eve = eve->next)
 	{
 		if (eve->f1 == 0)
 		{
@@ -3137,6 +3148,7 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges)
 	
 	return 1;
 }
+#endif
 
 /****************************************** BUCKET ITERATOR **************************************************/
 
@@ -3377,9 +3389,12 @@ static int iteratorStopped(void *arg)
 
 ReebGraph *BIF_ReebGraphMultiFromEditMesh(bContext *C)
 {
+	(void)C;
+	return NULL;
+#if 0
 	Scene *scene = CTX_data_scene(C);
 	Object *obedit = CTX_data_edit_object(C);
-	EditMesh *em =( (Mesh*)obedit->data)->edit_mesh;
+	EditMesh *em = BKE_mesh_get_editmesh(((Mesh*)obedit->data));
 	EdgeIndex indexed_edges;
 	VertexData *data;
 	ReebGraph *rg = NULL;
@@ -3475,7 +3490,13 @@ ReebGraph *BIF_ReebGraphMultiFromEditMesh(bContext *C)
 	
 	MEM_freeN(data);
 
+	/* no need to load the editmesh back into the object, just
+	 * free it (avoids ngon conversion issues too going back the other way) */
+	free_editMesh(em);
+	MEM_freeN(em);
+	
 	return rg;
+#endif
 }
 
 #if 0
@@ -3588,13 +3609,13 @@ void REEB_draw()
 	
 	if (GLOBAL_RG->link_up && G.scene->toolsettings->skgen_options & SKGEN_DISP_ORIG)
 	{
-		for (rg = GLOBAL_RG; rg->link_up; rg = rg->link_up) ;
+		for (rg = GLOBAL_RG; rg->link_up; rg = rg->link_up);
 	}
 	else
 	{
 		i = G.scene->toolsettings->skgen_multi_level;
 		
-		for (rg = GLOBAL_RG; rg->multi_level != i && rg->link_up; rg = rg->link_up) ;
+		for (rg = GLOBAL_RG; rg->multi_level != i && rg->link_up; rg = rg->link_up);
 	}
 	
 	glPointSize(BIF_GetThemeValuef(TH_VERTEX_SIZE));
diff --git a/source/blender/editors/armature/reeb.h b/source/blender/editors/armature/reeb.h
index 0080bbe..a9b32da 100644
--- a/source/blender/editors/armature/reeb.h
+++ b/source/blender/editors/armature/reeb.h
@@ -25,8 +25,8 @@
  */
 
  
-#ifndef REEB_H_
-#define REEB_H_
+#ifndef __REEB_H__
+#define __REEB_H__
 
 #define WITH_BF_REEB
 
@@ -161,8 +161,6 @@ void initArcIteratorStart(BArcIterator *iter, struct ReebArc *arc, struct ReebNo
 /* Filtering */
 void filterNullReebGraph(ReebGraph *rg);
 int filterSmartReebGraph(ReebGraph *rg, float threshold);
-int filterExternalReebGraph(ReebGraph *rg, float threshold);
-int filterInternalReebGraph(ReebGraph *rg, float threshold);
 
 /* Post-Build processing */
 void repositionNodes(ReebGraph *rg);
@@ -203,4 +201,4 @@ void REEB_exportGraph(ReebGraph *rg, int count);
 void REEB_draw(void);
 
 
-#endif /*REEB_H_*/
+#endif /*__REEB_H__*/
diff --git a/source/blender/editors/curve/SConscript b/source/blender/editors/curve/SConscript
index efb56ce..95dd7fc 100644
--- a/source/blender/editors/curve/SConscript
+++ b/source/blender/editors/curve/SConscript
@@ -5,7 +5,7 @@ sources = env.Glob('*.c')
 
 incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
 incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
-incs += ' ../../gpu ../../blenloader'
+incs += ' ../../bmesh ../../gpu ../../blenloader'
 incs += ' ../../makesrna ../../render/extern/include  #/intern/elbeem/extern'
 
 env.BlenderLib ( 'bf_editors_curve', sources, Split(incs), [], libtype=['core'], priority=[45] )
diff --git a/source/blender/editors/curve/curve_intern.h b/source/blender/editors/curve/curve_intern.h
index 2014345..0521297 100644
--- a/source/blender/editors/curve/curve_intern.h
+++ b/source/blender/editors/curve/curve_intern.h
@@ -29,8 +29,8 @@
  */
 
 
-#ifndef ED_CURVE_INTERN_H
-#define ED_CURVE_INTERN_H
+#ifndef __CURVE_INTERN_H__
+#define __CURVE_INTERN_H__
 
 /* internal exports only */
 struct wmOperatorType;
@@ -124,7 +124,5 @@ void CURVE_OT_vertex_add(struct wmOperatorType *ot);
 void CURVE_OT_extrude(struct wmOperatorType *ot);
 void CURVE_OT_cyclic_toggle(struct wmOperatorType *ot);
 
-void CURVE_OT_specials_menu(struct wmOperatorType *ot);
-
 #endif /* ED_UTIL_INTERN_H */
 
diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c
index b213f79..94ec7c7 100644
--- a/source/blender/editors/curve/curve_ops.c
+++ b/source/blender/editors/curve/curve_ops.c
@@ -140,17 +140,17 @@ void ED_operatormacros_curve(void)
 	wmOperatorType *ot;
 	wmOperatorTypeMacro *otmacro;
 
-	ot= WM_operatortype_append_macro("CURVE_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
+	ot = WM_operatortype_append_macro("CURVE_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
 	ot->description = "Duplicate curve and move";
 	WM_operatortype_macro_define(ot, "CURVE_OT_duplicate");
-	otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+	otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
 	RNA_enum_set(otmacro->ptr, "proportional", 0);
 	RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
 
-	ot= WM_operatortype_append_macro("CURVE_OT_extrude_move", "Extrude Curve and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
+	ot = WM_operatortype_append_macro("CURVE_OT_extrude_move", "Extrude Curve and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
 	ot->description = "Extrude curve and move result";
 	WM_operatortype_macro_define(ot, "CURVE_OT_extrude");
-	otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+	otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
 	RNA_enum_set(otmacro->ptr, "proportional", 0);
 	RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
 }
@@ -160,8 +160,8 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
 	wmKeyMap *keymap;
 	wmKeyMapItem *kmi;
 	
-	keymap= WM_keymap_find(keyconf, "Font", 0, 0);
-	keymap->poll= ED_operator_editfont;
+	keymap = WM_keymap_find(keyconf, "Font", 0, 0);
+	keymap->poll = ED_operator_editfont;
 	
 	/* only set in editmode font, by space_view3d listener */
 	RNA_enum_set(WM_keymap_add_item(keymap, "FONT_OT_style_toggle", BKEY, KM_PRESS, KM_CTRL, 0)->ptr, "style", CU_CHINFO_BOLD);
@@ -214,8 +214,8 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
 	RNA_boolean_set(kmi->ptr, "accent", TRUE); /* accented characters */
 
 	/* only set in editmode curve, by space_view3d listener */
-	keymap= WM_keymap_find(keyconf, "Curve", 0, 0);
-	keymap->poll= ED_operator_editsurfcurve;
+	keymap = WM_keymap_find(keyconf, "Curve", 0, 0);
+	keymap->poll = ED_operator_editsurfcurve;
 
 	WM_keymap_add_menu(keymap, "INFO_MT_edit_curve_add", AKEY, KM_PRESS, KM_SHIFT, 0);
 	
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 5c762ca..c19041b 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -117,7 +117,7 @@ static float nurbcircle[8][2]= {
 
 ListBase *object_editcurve_get(Object *ob)
 {
-	if(ob && ELEM(ob->type, OB_CURVE, OB_SURF)) {
+	if (ob && ELEM(ob->type, OB_CURVE, OB_SURF)) {
 		Curve *cu= ob->data;
 		return &cu->editnurb->nurbs;
 	}
@@ -129,7 +129,7 @@ static void set_actNurb(Object *obedit, Nurb *nu)
 {
 	Curve *cu= obedit->data;
 	
-	if(nu==NULL)
+	if (nu==NULL)
 		cu->actnu = -1;
 	else {
 		ListBase *nurbs= curve_editnurbs(cu);
@@ -157,9 +157,9 @@ static Nurb *get_actNurb(Object *obedit)
 /* returns 1 in case (de)selection was successful */
 static short select_beztriple(BezTriple *bezt, short selstatus, short flag, short hidden)
 {	
-	if(bezt) {
-		if((bezt->hide==0) || (hidden==1)) {
-			if(selstatus==1) { /* selects */			
+	if (bezt) {
+		if ((bezt->hide==0) || (hidden==1)) {
+			if (selstatus==1) { /* selects */			
 				bezt->f1 |= flag;
 				bezt->f2 |= flag;
 				bezt->f3 |= flag;
@@ -180,9 +180,9 @@ static short select_beztriple(BezTriple *bezt, short selstatus, short flag, shor
 /* returns 1 in case (de)selection was successful */
 static short select_bpoint(BPoint *bp, short selstatus, short flag, short hidden) 
 {	
-	if(bp) {
-		if((bp->hide==0) || (hidden==1)) {
-			if(selstatus==1) {
+	if (bp) {
+		if ((bp->hide==0) || (hidden==1)) {
+			if (selstatus==1) {
 				bp->f1 |= flag;
 				return 1;
 			}
@@ -198,7 +198,7 @@ static short select_bpoint(BPoint *bp, short selstatus, short flag, short hidden
 
 static short swap_selection_beztriple(BezTriple *bezt)
 {
-	if(bezt->f2 & SELECT)
+	if (bezt->f2 & SELECT)
 		return select_beztriple(bezt, DESELECT, 1, VISIBLE);
 	else
 		return select_beztriple(bezt, SELECT, 1, VISIBLE);
@@ -206,7 +206,7 @@ static short swap_selection_beztriple(BezTriple *bezt)
 
 static short swap_selection_bpoint(BPoint *bp)
 {
-	if(bp->f1 & SELECT)
+	if (bp->f1 & SELECT)
 		return select_bpoint(bp, DESELECT, 1, VISIBLE);
 	else
 		return select_bpoint(bp, SELECT, 1, VISIBLE);
@@ -218,19 +218,19 @@ int isNurbsel(Nurb *nu)
 	BPoint *bp;
 	int a;
 
-	if(nu->type == CU_BEZIER) {
+	if (nu->type == CU_BEZIER) {
 		bezt= nu->bezt;
 		a= nu->pntsu;
-		while(a--) {
-			if( (bezt->f1 & SELECT) || (bezt->f2 & SELECT) || (bezt->f3 & SELECT) ) return 1;
+		while (a--) {
+			if ( (bezt->f1 & SELECT) || (bezt->f2 & SELECT) || (bezt->f3 & SELECT) ) return 1;
 			bezt++;
 		}
 	}
 	else {
 		bp= nu->bp;
 		a= nu->pntsu*nu->pntsv;
-		while(a--) {
-			if( (bp->f1 & SELECT) ) return 1;
+		while (a--) {
+			if ( (bp->f1 & SELECT) ) return 1;
 			bp++;
 		}
 	}
@@ -243,10 +243,10 @@ static int isNurbsel_count(Curve *cu, Nurb *nu)
 	BPoint *bp;
 	int a, sel=0;
 
-	if(nu->type == CU_BEZIER) {
+	if (nu->type == CU_BEZIER) {
 		bezt= nu->bezt;
 		a= nu->pntsu;
-		while(a--) {
+		while (a--) {
 			if (BEZSELECTED_HIDDENHANDLES(cu, bezt)) sel++;
 			bezt++;
 		}
@@ -254,8 +254,8 @@ static int isNurbsel_count(Curve *cu, Nurb *nu)
 	else {
 		bp= nu->bp;
 		a= nu->pntsu*nu->pntsv;
-		while(a--) {
-			if( (bp->f1 & SELECT) ) sel++;
+		while (a--) {
+			if ( (bp->f1 & SELECT) ) sel++;
 			bp++;
 		}
 	}
@@ -270,15 +270,15 @@ void printknots(Object *obedit)
 	Nurb *nu;
 	int a, num;
 
-	for(nu= editnurb->first; nu; nu= nu->next) {
-		if(isNurbsel(nu) &&  nu->type == CU_NURBS) {
-			if(nu->knotsu) {
+	for (nu= editnurb->first; nu; nu= nu->next) {
+		if (isNurbsel(nu) &&  nu->type == CU_NURBS) {
+			if (nu->knotsu) {
 				num= KNOTSU(nu);
-				for(a=0;a<num;a++) printf("knotu %d: %f\n", a, nu->knotsu[a]);
+				for (a=0;a<num;a++) printf("knotu %d: %f\n", a, nu->knotsu[a]);
 			}
-			if(nu->knotsv) {
+			if (nu->knotsv) {
 				num= KNOTSV(nu);
-				for(a=0;a<num;a++) printf("knotv %d: %f\n", a, nu->knotsv[a]);
+				for (a=0;a<num;a++) printf("knotv %d: %f\n", a, nu->knotsv[a]);
 			}
 		}
 	}
@@ -310,7 +310,7 @@ static void init_editNurb_keyIndex(EditNurb *editnurb, ListBase *origBase)
 	CVKeyIndex *keyIndex;
 	int a, key_index= 0, nu_index= 0, pt_index= 0;
 
-	if(editnurb->keyindex) return;
+	if (editnurb->keyindex) return;
 
 	gh= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "editNurb keyIndex");
 
@@ -328,7 +328,8 @@ static void init_editNurb_keyIndex(EditNurb *editnurb, ListBase *origBase)
 				origbezt++;
 				pt_index++;
 			}
-		} else {
+		}
+		else {
 			a= orignu->pntsu * orignu->pntsv;
 			bp= nu->bp;
 			origbp= orignu->bp;
@@ -424,7 +425,8 @@ static void keyIndex_delNurb(EditNurb *editnurb, Nurb *nu)
 			BLI_ghash_remove(editnurb->keyindex, bezt, NULL, (GHashValFreeFP)MEM_freeN);
 			++bezt;
 		}
-	} else {
+	}
+	else {
 		BPoint *bp= nu->bp;
 		a= nu->pntsu * nu->pntsv;
 
@@ -487,7 +489,8 @@ static void keyIndex_updateNurb(EditNurb *editnurb, Nurb *nu, Nurb *newnu)
 {
 	if (nu->bezt) {
 		keyIndex_updateBezt(editnurb, nu->bezt, newnu->bezt, newnu->pntsu);
-	} else {
+	}
+	else {
 		keyIndex_updateBP(editnurb, nu->bp, newnu->bp, newnu->pntsu * newnu->pntsv);
 	}
 }
@@ -500,8 +503,8 @@ static void keyIndex_swap(EditNurb *editnurb, void *a, void *b)
 	BLI_ghash_remove(editnurb->keyindex, a, NULL, NULL);
 	BLI_ghash_remove(editnurb->keyindex, b, NULL, NULL);
 
-	if(index2) BLI_ghash_insert(editnurb->keyindex, a, index2);
-	if(index1) BLI_ghash_insert(editnurb->keyindex, b, index1);
+	if (index2) BLI_ghash_insert(editnurb->keyindex, a, index2);
+	if (index1) BLI_ghash_insert(editnurb->keyindex, b, index1);
 }
 
 static void keyIndex_switchDirection(EditNurb *editnurb, Nurb *nu)
@@ -525,18 +528,19 @@ static void keyIndex_switchDirection(EditNurb *editnurb, Nurb *nu)
 			index1= getCVKeyIndex(editnurb, bezt1);
 			index2= getCVKeyIndex(editnurb, bezt2);
 
-			if(index1) index1->switched= !index1->switched;
+			if (index1) index1->switched= !index1->switched;
 
 			if (bezt1 != bezt2) {
 				keyIndex_swap(editnurb, bezt1, bezt2);
 
-				if(index2) index2->switched= !index2->switched;
+				if (index2) index2->switched= !index2->switched;
 			}
 
 			bezt1++;
 			bezt2--;
 		}
-	} else {
+	}
+	else {
 		BPoint *bp1, *bp2;
 
 		if (nu->pntsv == 1) {
@@ -544,14 +548,14 @@ static void keyIndex_switchDirection(EditNurb *editnurb, Nurb *nu)
 			bp1= nu->bp;
 			bp2= bp1+(a-1);
 			a/= 2;
-			while(bp1!=bp2 && a>0) {
+			while (bp1!=bp2 && a>0) {
 				index1= getCVKeyIndex(editnurb, bp1);
 				index2= getCVKeyIndex(editnurb, bp2);
 
-				if(index1) index1->switched= !index1->switched;
+				if (index1) index1->switched= !index1->switched;
 
 				if (bp1 != bp2) {
-					if(index2) index2->switched= !index2->switched;
+					if (index2) index2->switched= !index2->switched;
 
 					keyIndex_swap(editnurb, bp1, bp2);
 				}
@@ -560,24 +564,25 @@ static void keyIndex_switchDirection(EditNurb *editnurb, Nurb *nu)
 				bp1++;
 				bp2--;
 			}
-		} else {
+		}
+		else {
 			int b;
 
-			for(b=0; b<nu->pntsv; b++) {
+			for (b=0; b<nu->pntsv; b++) {
 
 				bp1= nu->bp+b*nu->pntsu;
 				a= nu->pntsu;
 				bp2= bp1+(a-1);
 				a/= 2;
 
-				while(bp1!=bp2 && a>0) {
+				while (bp1!=bp2 && a>0) {
 					index1= getCVKeyIndex(editnurb, bp1);
 					index2= getCVKeyIndex(editnurb, bp2);
 
-					if(index1) index1->switched= !index1->switched;
+					if (index1) index1->switched= !index1->switched;
 
 					if (bp1 != bp2) {
-						if(index2) index2->switched= !index2->switched;
+						if (index2) index2->switched= !index2->switched;
 
 						keyIndex_swap(editnurb, bp1, bp2);
 					}
@@ -602,7 +607,7 @@ static void switch_keys_direction(Curve *cu, Nurb *actnu)
 	int a;
 
 	currkey = cu->key->block.first;
-	while(currkey) {
+	while (currkey) {
 		fp= currkey->data;
 
 		nu= nubase->first;
@@ -612,26 +617,29 @@ static void switch_keys_direction(Curve *cu, Nurb *actnu)
 				a= nu->pntsu;
 				if (nu == actnu) {
 					while (a--) {
-						if(getKeyIndexOrig_bezt(editnurb, bezt)) {
+						if (getKeyIndexOrig_bezt(editnurb, bezt)) {
 							swap_v3_v3(fp, fp + 6);
 							*(fp+9) = -*(fp+9);
 							fp += 12;
 						}
 						bezt++;
 					}
-				} else fp += a * 12;
-			} else {
+				}
+				else fp += a * 12;
+			}
+			else {
 				BPoint *bp= nu->bp;
 				a= nu->pntsu * nu->pntsv;
 				if (nu == actnu) {
 					while (a--) {
-						if(getKeyIndexOrig_bp(editnurb, bp)) {
+						if (getKeyIndexOrig_bp(editnurb, bp)) {
 							*(fp+3) = -*(fp+3);
 							fp += 4;
 						}
 						bp++;
 					}
-				} else fp += a * 4;
+				}
+				else fp += a * 4;
 			}
 
 			nu= nu->next;
@@ -651,7 +659,7 @@ static void keyData_switchDirectionNurb(Curve *cu, Nurb *nu)
 	}
 
 	keyIndex_switchDirection(editnurb, nu);
-	if(cu->key)
+	if (cu->key)
 		switch_keys_direction(cu, nu);
 }
 
@@ -662,7 +670,7 @@ static GHash *dupli_keyIndexHash(GHash *keyindex)
 
 	gh= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "dupli_keyIndex gh");
 
-	for(hashIter = BLI_ghashIterator_new(keyindex);
+	for (hashIter = BLI_ghashIterator_new(keyindex);
 				   !BLI_ghashIterator_isDone(hashIter);
 				   BLI_ghashIterator_step(hashIter)) {
 		void *cv = BLI_ghashIterator_getKey(hashIter);
@@ -710,10 +718,11 @@ static void calc_keyHandles(ListBase *nurb, float *key)
 			a= nu->pntsu;
 			startfp= fp;
 
-			if(nu->flagu & CU_NURB_CYCLIC) {
+			if (nu->flagu & CU_NURB_CYCLIC) {
 				prevp= bezt+(a-1);
 				prevfp= fp+(12 * (a-1));
-			} else {
+			}
+			else {
 				prevp= NULL;
 				prevfp= NULL;
 			}
@@ -732,11 +741,12 @@ static void calc_keyHandles(ListBase *nurb, float *key)
 
 				prevp= bezt;
 				prevfp= fp;
-				if(a==1) {
-					if(nu->flagu & CU_NURB_CYCLIC) {
+				if (a==1) {
+					if (nu->flagu & CU_NURB_CYCLIC) {
 						nextp= nu->bezt;
 						nextfp= startfp;
-					} else {
+					}
+					else {
 						nextp= NULL;
 						nextfp= NULL;
 					}
@@ -749,7 +759,8 @@ static void calc_keyHandles(ListBase *nurb, float *key)
 				++bezt;
 				fp += 12;
 			}
-		} else {
+		}
+		else {
 			a= nu->pntsu * nu->pntsv;
 			fp += a * 4;
 		}
@@ -763,7 +774,7 @@ static void calc_shapeKeys(Object *obedit)
 	Curve *cu= (Curve*)obedit->data;
 
 	/* are there keys? */
-	if(cu->key) {
+	if (cu->key) {
 		int a, i;
 		EditNurb *editnurb= cu->editnurb;
 		KeyBlock *currkey;
@@ -777,26 +788,27 @@ static void calc_shapeKeys(Object *obedit)
 		float *oldkey, *newkey, *ofp;
 
 		/* editing the base key should update others */
-		if(cu->key->type==KEY_RELATIVE) {
+		if (cu->key->type==KEY_RELATIVE) {
 			int act_is_basis = 0;
 			/* find if this key is a basis for any others */
-			for(currkey = cu->key->block.first; currkey; currkey= currkey->next) {
-				if(editnurb->shapenr-1 == currkey->relative) {
+			for (currkey = cu->key->block.first; currkey; currkey= currkey->next) {
+				if (editnurb->shapenr-1 == currkey->relative) {
 					act_is_basis = 1;
 					break;
 				}
 			}
 
-			if(act_is_basis) { /* active key is a base */
+			if (act_is_basis) { /* active key is a base */
 				int totvec= 0;
 
 				/* Calculate needed memory to store offset */
 				nu= editnurb->nurbs.first;
-				while(nu) {
+				while (nu) {
 					if (nu->bezt) {
 						/* Three vects to store handles and one for alfa */
 						totvec+= nu->pntsu * 4;
-					} else {
+					}
+					else {
 						totvec+= 2 * nu->pntsu * nu->pntsv;
 					}
 
@@ -806,11 +818,11 @@ static void calc_shapeKeys(Object *obedit)
 				ofs= MEM_callocN(sizeof(float) * 3 * totvec,  "currkey->data");
 				nu= editnurb->nurbs.first;
 				i= 0;
-				while(nu) {
-					if(nu->bezt) {
+				while (nu) {
+					if (nu->bezt) {
 						bezt= nu->bezt;
 						a= nu->pntsu;
-						while(a--) {
+						while (a--) {
 							oldbezt= getKeyIndexOrig_bezt(editnurb, bezt);
 
 							if (oldbezt) {
@@ -820,7 +832,8 @@ static void calc_shapeKeys(Object *obedit)
 									i++;
 								}
 								ofs[i++][0]= bezt->alfa - oldbezt->alfa;
-							} else {
+							}
+							else {
 								i += 4;
 							}
 							bezt++;
@@ -829,7 +842,7 @@ static void calc_shapeKeys(Object *obedit)
 					else {
 						bp= nu->bp;
 						a= nu->pntsu*nu->pntsv;
-						while(a--) {
+						while (a--) {
 							oldbp= getKeyIndexOrig_bp(editnurb, bp);
 							if (oldbp) {
 								sub_v3_v3v3(ofs[i], bp->vec, oldbp->vec);
@@ -846,7 +859,7 @@ static void calc_shapeKeys(Object *obedit)
 		}
 
 		currkey = cu->key->block.first;
-		while(currkey) {
+		while (currkey) {
 			int apply_offset = (ofs && (currkey != actkey) && (editnurb->shapenr-1 == currkey->relative));
 
 			float *fp= newkey= MEM_callocN(cu->key->elemsize * totvert,  "currkey->data");
@@ -854,14 +867,14 @@ static void calc_shapeKeys(Object *obedit)
 
 			nu= editnurb->nurbs.first;
 			i = 0;
-			while(nu) {
-				if(currkey == actkey) {
+			while (nu) {
+				if (currkey == actkey) {
 					int restore= actkey != cu->key->refkey;
 
-					if(nu->bezt) {
+					if (nu->bezt) {
 						bezt= nu->bezt;
 						a= nu->pntsu;
-						while(a--) {
+						while (a--) {
 							int j;
 							oldbezt= getKeyIndexOrig_bezt(editnurb, bezt);
 
@@ -876,7 +889,7 @@ static void calc_shapeKeys(Object *obedit)
 							}
 							fp[0]= bezt->alfa;
 
-							if(restore && oldbezt) {
+							if (restore && oldbezt) {
 								bezt->alfa= oldbezt->alfa;
 							}
 
@@ -887,14 +900,14 @@ static void calc_shapeKeys(Object *obedit)
 					else {
 						bp= nu->bp;
 						a= nu->pntsu*nu->pntsv;
-						while(a--) {
+						while (a--) {
 							oldbp= getKeyIndexOrig_bp(editnurb, bp);
 
 							copy_v3_v3(fp, bp->vec);
 
 							fp[3]= bp->alfa;
 
-							if(restore && oldbp) {
+							if (restore && oldbp) {
 								copy_v3_v3(bp->vec, oldbp->vec);
 								bp->alfa= oldbp->alfa;
 							}
@@ -909,12 +922,12 @@ static void calc_shapeKeys(Object *obedit)
 					int index;
 					float *curofp;
 
-					if(oldkey) {
-						if(nu->bezt) {
+					if (oldkey) {
+						if (nu->bezt) {
 							bezt= nu->bezt;
 							a= nu->pntsu;
 
-							while(a--) {
+							while (a--) {
 								index= getKeyIndexOrig_keyIndex(editnurb, bezt);
 								if (index >= 0) {
 									int j;
@@ -923,7 +936,7 @@ static void calc_shapeKeys(Object *obedit)
 									for (j= 0; j < 3; ++j, ++i) {
 										copy_v3_v3(fp, curofp);
 
-										if(apply_offset) {
+										if (apply_offset) {
 											add_v3_v3(fp, ofs[i]);
 										}
 
@@ -931,14 +944,15 @@ static void calc_shapeKeys(Object *obedit)
 									}
 									fp[0]= curofp[0];
 
-									if(apply_offset) {
+									if (apply_offset) {
 										/* apply alfa offsets */
 										add_v3_v3(fp, ofs[i]);
 										++i;
 									}
 
 									fp+= 3;	/* alphas */
-								} else {
+								}
+								else {
 									int j;
 									for (j= 0; j < 3; ++j, ++i) {
 										copy_v3_v3(fp, bezt->vec[j]);
@@ -954,7 +968,7 @@ static void calc_shapeKeys(Object *obedit)
 						else {
 							bp= nu->bp;
 							a= nu->pntsu*nu->pntsv;
-							while(a--) {
+							while (a--) {
 								index= getKeyIndexOrig_keyIndex(editnurb, bp);
 
 								if (index >= 0) {
@@ -962,11 +976,12 @@ static void calc_shapeKeys(Object *obedit)
 									copy_v3_v3(fp, curofp);
 									fp[3]= curofp[3];
 
-									if(apply_offset) {
+									if (apply_offset) {
 										add_v3_v3(fp, ofs[i]);
 										fp[3]+=ofs[i+1][0];
 									}
-								} else {
+								}
+								else {
 									copy_v3_v3(fp, bp->vec);
 									fp[3]= bp->alfa;
 								}
@@ -988,21 +1003,20 @@ static void calc_shapeKeys(Object *obedit)
 			}
 
 			currkey->totelem= totvert;
-			if(currkey->data) MEM_freeN(currkey->data);
+			if (currkey->data) MEM_freeN(currkey->data);
 			currkey->data = newkey;
 
 			currkey= currkey->next;
 		}
 
-		if(ofs) MEM_freeN(ofs);
+		if (ofs) MEM_freeN(ofs);
 	}
 }
 
 /* ********************* Amimation data *************** */
 
-static int curve_is_animated(Object *ob)
+static int curve_is_animated(Curve *cu)
 {
-	Curve *cu= (Curve*)ob->data;
 	AnimData *ad= BKE_animdata_from_id(&cu->id);
 
 	return ad && (ad->action || ad->drivers.first);
@@ -1016,7 +1030,7 @@ static void fcurve_path_rename(AnimData *ad, char *orig_rna_path, char *rna_path
 	fcu= orig_curves->first;
 	while (fcu) {
 		nextfcu= fcu->next;
-		if(!strncmp(fcu->rna_path, orig_rna_path, len)) {
+		if (!strncmp(fcu->rna_path, orig_rna_path, len)) {
 			char *spath, *suffix= fcu->rna_path + len;
 			nfcu= copy_fcurve(fcu);
 			spath= nfcu->rna_path;
@@ -1042,16 +1056,15 @@ static void fcurve_path_rename(AnimData *ad, char *orig_rna_path, char *rna_path
 
 static void fcurve_remove(AnimData *ad, ListBase *orig_curves, FCurve *fcu)
 {
-	if(orig_curves==&ad->drivers) BLI_remlink(&ad->drivers, fcu);
+	if (orig_curves==&ad->drivers) BLI_remlink(&ad->drivers, fcu);
 	else action_groups_remove_channel(ad->action, fcu);
 
 	free_fcurve(fcu);
 }
 
-static void curve_rename_fcurves(Object *obedit, ListBase *orig_curves)
+static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves)
 {
 	int nu_index= 0, a, pt_index;
-	Curve *cu= (Curve*)obedit->data;
 	EditNurb *editnurb= cu->editnurb;
 	Nurb *nu= editnurb->nurbs.first;
 	CVKeyIndex *keyIndex;
@@ -1060,19 +1073,19 @@ static void curve_rename_fcurves(Object *obedit, ListBase *orig_curves)
 	ListBase curves= {NULL, NULL};
 	FCurve *fcu, *next;
 
-	while(nu) {
-		if(nu->bezt) {
+	while (nu) {
+		if (nu->bezt) {
 			BezTriple *bezt= nu->bezt;
 			a= nu->pntsu;
 			pt_index= 0;
 
 			while (a--) {
 				keyIndex= getCVKeyIndex(editnurb, bezt);
-				if(keyIndex) {
+				if (keyIndex) {
 					BLI_snprintf(rna_path, sizeof(rna_path), "splines[%d].bezier_points[%d]", nu_index, pt_index);
 					BLI_snprintf(orig_rna_path, sizeof(orig_rna_path), "splines[%d].bezier_points[%d]", keyIndex->nu_index, keyIndex->pt_index);
 
-					if(keyIndex->switched) {
+					if (keyIndex->switched) {
 						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);
@@ -1092,14 +1105,15 @@ static void curve_rename_fcurves(Object *obedit, ListBase *orig_curves)
 				bezt++;
 				pt_index++;
 			}
-		} else {
+		}
+		else {
 			BPoint *bp= nu->bp;
 			a= nu->pntsu * nu->pntsv;
 			pt_index= 0;
 
 			while (a--) {
 				keyIndex= getCVKeyIndex(editnurb, bp);
-				if(keyIndex) {
+				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);
@@ -1116,13 +1130,13 @@ static void curve_rename_fcurves(Object *obedit, ListBase *orig_curves)
 		nu_index++;
 	}
 
-	/* remove pathes for removed control points
-	   need this to make further step with copying non-cv related curves copying
-	   not touching cv's f-cruves */
-	for(fcu= orig_curves->first; fcu; fcu= next) {
+	/* remove paths for removed control points
+	 * need this to make further step with copying non-cv related curves copying
+	 * not touching cv's f-curves */
+	for (fcu= orig_curves->first; fcu; fcu= next) {
 		next= fcu->next;
 
-		if(!strncmp(fcu->rna_path, "splines", 7)) {
+		if (!strncmp(fcu->rna_path, "splines", 7)) {
 			char *ch= strchr(fcu->rna_path, '.');
 
 			if (ch && (!strncmp(ch, ".bezier_points", 14) || !strncmp(ch, ".points", 7)))
@@ -1132,14 +1146,14 @@ static void curve_rename_fcurves(Object *obedit, ListBase *orig_curves)
 
 	nu_index= 0;
 	nu= editnurb->nurbs.first;
-	while(nu) {
+	while (nu) {
 		keyIndex= NULL;
-		if(nu->pntsu) {
-			if(nu->bezt) keyIndex= getCVKeyIndex(editnurb, &nu->bezt[0]);
+		if (nu->pntsu) {
+			if (nu->bezt) keyIndex= getCVKeyIndex(editnurb, &nu->bezt[0]);
 			else keyIndex= getCVKeyIndex(editnurb, &nu->bp[0]);
 		}
 
-		if(keyIndex) {
+		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);
@@ -1151,10 +1165,10 @@ static void curve_rename_fcurves(Object *obedit, ListBase *orig_curves)
 
 	/* the remainders in orig_curves can be copied back (like follow path) */
 	/* (if it's not path to spline) */
-	for(fcu= orig_curves->first; fcu; fcu= next) {
+	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(ad, orig_curves, fcu);
 		else BLI_addtail(&curves, fcu);
 	}
 
@@ -1162,17 +1176,16 @@ static void curve_rename_fcurves(Object *obedit, ListBase *orig_curves)
 }
 
 /* return 0 if animation data wasn't changed, 1 otherwise */
-int ED_curve_updateAnimPaths(Object *obedit)
+int ED_curve_updateAnimPaths(Curve *cu)
 {
-	Curve *cu= (Curve*)obedit->data;
 	AnimData *ad= BKE_animdata_from_id(&cu->id);
 
-	if(!curve_is_animated(obedit)) return 0;
+	if (!curve_is_animated(cu)) return 0;
 
-	if(ad->action)
-		curve_rename_fcurves(obedit, &ad->action->curves);
+	if (ad->action)
+		curve_rename_fcurves(cu, &ad->action->curves);
 
-	curve_rename_fcurves(obedit, &ad->drivers);
+	curve_rename_fcurves(cu, &ad->drivers);
 
 	return 1;
 }
@@ -1184,7 +1197,7 @@ void load_editNurb(Object *obedit)
 {
 	ListBase *editnurb= object_editcurve_get(obedit);
 
-	if(obedit==NULL) return;
+	if (obedit==NULL) return;
 
 	set_actNurb(obedit, NULL);
 
@@ -1193,11 +1206,11 @@ void load_editNurb(Object *obedit)
 		Nurb *nu, *newnu;
 		ListBase newnurb= {NULL, NULL}, oldnurb= cu->nurb;
 
-		for(nu= editnurb->first; nu; nu= nu->next) {
+		for (nu= editnurb->first; nu; nu= nu->next) {
 			newnu= duplicateNurb(nu);
 			BLI_addtail(&newnurb, newnu);
 
-			if(nu->type == CU_NURBS) {
+			if (nu->type == CU_NURBS) {
 				clamp_nurb_order_u(nu);
 			}
 		}
@@ -1205,7 +1218,7 @@ void load_editNurb(Object *obedit)
 		cu->nurb= newnurb;
 
 		calc_shapeKeys(obedit);
-		ED_curve_updateAnimPaths(obedit);
+		ED_curve_updateAnimPaths(obedit->data);
 
 		freeNurblist(&oldnurb);
 	}
@@ -1227,17 +1240,18 @@ void make_editNurb(Object *obedit)
 	if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
 		actkey= ob_get_keyblock(obedit);
 
-		if(actkey) {
+		if (actkey) {
 			// XXX strcpy(G.editModeTitleExtra, "(Key) ");
 			undo_editmode_clear();
 			key_to_curve(actkey, cu, &cu->nurb);
 		}
 
-		if(editnurb) {
+		if (editnurb) {
 			freeNurblist(&editnurb->nurbs);
 			free_curve_editNurb_keyIndex(editnurb);
 			editnurb->keyindex= NULL;
-		} else {
+		}
+		else {
 			editnurb= MEM_callocN(sizeof(EditNurb), "editnurb");
 			cu->editnurb= editnurb;
 		}
@@ -1245,7 +1259,7 @@ void make_editNurb(Object *obedit)
 		nu= cu->nurb.first;
 		cu->lastsel= NULL;   /* for select row */
 
-		while(nu) {
+		while (nu) {
 			newnu= duplicateNurb(nu);
 			test2DNurb(newnu);	// after join, or any other creation of curve
 			BLI_addtail(&editnurb->nurbs, newnu);
@@ -1258,11 +1272,11 @@ void make_editNurb(Object *obedit)
 			nu= nu->next;
 		}
 
-		if(actkey)
+		if (actkey)
 			editnurb->shapenr= obedit->shapenr;
 
-		/* animation could be added in editmode even if teher was no animdata i
-		   object mode hence we always need CVs index be created */
+		/* animation could be added in editmode even if there was no animdata i
+		 * object mode hence we always need CVs index be created */
 		init_editNurb_keyIndex(editnurb, &cu->nurb);
 	}
 }
@@ -1307,14 +1321,14 @@ void CU_select_swap(Object *obedit)
 
 		cu->lastsel= NULL;
 
-		for(nu= editnurb->first; nu; nu= nu->next) {
-			if(nu->type == CU_BEZIER) {
+		for (nu= editnurb->first; nu; nu= nu->next) {
+			if (nu->type == CU_BEZIER) {
 				bezt= nu->bezt;
 				a= nu->pntsu;
-				while(a--) {
-					if(bezt->hide==0) {
+				while (a--) {
+					if (bezt->hide==0) {
 						bezt->f2 ^= SELECT; /* always do the center point */
-						if((cu->drawflag & CU_HIDE_HANDLES)==0) {
+						if ((cu->drawflag & CU_HIDE_HANDLES)==0) {
 							bezt->f1 ^= SELECT;
 							bezt->f3 ^= SELECT;
 						}
@@ -1325,7 +1339,7 @@ void CU_select_swap(Object *obedit)
 			else {
 				bp= nu->bp;
 				a= nu->pntsu*nu->pntsv;
-				while(a--) {
+				while (a--) {
 					swap_selection_bpoint(bp);
 					bp++;
 				}
@@ -1351,7 +1365,7 @@ static int separate_exec(bContext *C, wmOperator *op)
 	oldcu= oldob->data;
 	oldedit= oldcu->editnurb;
 
-	if(oldcu->key) {
+	if (oldcu->key) {
 		BKE_report(op->reports, RPT_ERROR, "Can't separate a curve with vertex keys");
 		return OPERATOR_CANCELLED;
 	}
@@ -1374,10 +1388,10 @@ static int separate_exec(bContext *C, wmOperator *op)
 	free_curve_editNurb_keyIndex(newedit);
 
 	/* 3. move over parts from old object */
-	for(nu= oldedit->nurbs.first; nu; nu=nu1) {
+	for (nu= oldedit->nurbs.first; nu; nu=nu1) {
 		nu1= nu->next;
 
-		if(isNurbsel(nu)) {
+		if (isNurbsel(nu)) {
 			BLI_remlink(&oldedit->nurbs, nu);
 			BLI_addtail(&newedit->nurbs, nu);
 		}
@@ -1400,15 +1414,15 @@ static int separate_exec(bContext *C, wmOperator *op)
 void CURVE_OT_separate(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Separate";
-	ot->idname= "CURVE_OT_separate";
+	ot->name = "Separate";
+	ot->idname = "CURVE_OT_separate";
 	
 	/* api callbacks */
-	ot->exec= separate_exec;
-	ot->poll= ED_operator_editsurfcurve;
+	ot->exec = separate_exec;
+	ot->poll = ED_operator_editsurfcurve;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ******************* FLAGS ********************* */
@@ -1416,7 +1430,7 @@ void CURVE_OT_separate(wmOperatorType *ot)
 static short isNurbselUV(Nurb *nu, int *u, int *v, int flag)
 {
 	/* return u!=-1:     1 row in u-direction selected. U has value between 0-pntsv 
-	 * return v!=-1: 1 collumn in v-direction selected. V has value between 0-pntsu 
+	 * return v!=-1: 1 column in v-direction selected. V has value between 0-pntsu
 	 */
 	BPoint *bp;
 	int a, b, sel;
@@ -1424,33 +1438,33 @@ static short isNurbselUV(Nurb *nu, int *u, int *v, int flag)
 	*u= *v= -1;
 
 	bp= nu->bp;
-	for(b=0; b<nu->pntsv; b++) {
+	for (b=0; b<nu->pntsv; b++) {
 		sel= 0;
-		for(a=0; a<nu->pntsu; a++, bp++) {
-			if(bp->f1 & flag) sel++;
+		for (a=0; a<nu->pntsu; a++, bp++) {
+			if (bp->f1 & flag) sel++;
 		}
-		if(sel==nu->pntsu) {
-			if(*u== -1) *u= b;
+		if (sel==nu->pntsu) {
+			if (*u== -1) *u= b;
 			else return 0;
 		}
-		else if(sel>1) return 0;    /* because sel==1 is still ok */
+		else if (sel>1) return 0;    /* because sel==1 is still ok */
 	}
 
-	for(a=0; a<nu->pntsu; a++) {
+	for (a=0; a<nu->pntsu; a++) {
 		sel= 0;
 		bp= nu->bp+a;
-		for(b=0; b<nu->pntsv; b++, bp+=nu->pntsu) {
-			if(bp->f1 & flag) sel++;
+		for (b=0; b<nu->pntsv; b++, bp+=nu->pntsu) {
+			if (bp->f1 & flag) sel++;
 		}
-		if(sel==nu->pntsv) {
-			if(*v== -1) *v= a;
+		if (sel==nu->pntsv) {
+			if (*v== -1) *v= a;
 			else return 0;
 		}
-		else if(sel>1) return 0;
+		else if (sel>1) return 0;
 	}
 
-	if(*u==-1 && *v>-1) return 1;
-	if(*v==-1 && *u>-1) return 1;
+	if (*u==-1 && *v>-1) return 1;
+	if (*v==-1 && *u>-1) return 1;
 	return 0;
 }
 
@@ -1461,11 +1475,11 @@ static void setflagsNurb(ListBase *editnurb, short flag)
 	BPoint *bp;
 	int a;
 
-	for(nu= editnurb->first; nu; nu= nu->next) {
-		if(nu->type == CU_BEZIER) {
+	for (nu= editnurb->first; nu; nu= nu->next) {
+		if (nu->type == CU_BEZIER) {
 			a= nu->pntsu;
 			bezt= nu->bezt;
-			while(a--) {
+			while (a--) {
 				bezt->f1= bezt->f2= bezt->f3= flag;
 				bezt++;
 			}
@@ -1473,7 +1487,7 @@ static void setflagsNurb(ListBase *editnurb, short flag)
 		else {
 			a= nu->pntsu*nu->pntsv;
 			bp= nu->bp;
-			while(a--) {
+			while (a--) {
 				bp->f1= flag;
 				bp++;
 			}
@@ -1488,13 +1502,13 @@ static void rotateflagNurb(ListBase *editnurb, short flag, float *cent, float ro
 	BPoint *bp;
 	int a;
 
-	for(nu= editnurb->first; nu; nu= nu->next) {
-		if(nu->type == CU_NURBS) {
+	for (nu= editnurb->first; nu; nu= nu->next) {
+		if (nu->type == CU_NURBS) {
 			bp= nu->bp;
 			a= nu->pntsu*nu->pntsv;
 
-			while(a--) {
-				if(bp->f1 & flag) {
+			while (a--) {
+				if (bp->f1 & flag) {
 					sub_v3_v3(bp->vec, cent);
 					mul_m3_v3(rotmat, bp->vec);
 					add_v3_v3(bp->vec, cent);
@@ -1505,7 +1519,7 @@ static void rotateflagNurb(ListBase *editnurb, short flag, float *cent, float ro
 	}
 }
 
-static void translateflagNurb(ListBase *editnurb, short flag, float *vec)
+static void translateflagNurb(ListBase *editnurb, short flag, const float vec[3])
 {
 	/* all verts with ('flag' & flag) translate */
 	Nurb *nu;
@@ -1513,22 +1527,22 @@ static void translateflagNurb(ListBase *editnurb, short flag, float *vec)
 	BPoint *bp;
 	int a;
 
-	for(nu= editnurb->first; nu; nu= nu->next) {
-		if(nu->type == CU_BEZIER) {
+	for (nu= editnurb->first; nu; nu= nu->next) {
+		if (nu->type == CU_BEZIER) {
 			a= nu->pntsu;
 			bezt= nu->bezt;
-			while(a--) {
-				if(bezt->f1 & flag) add_v3_v3(bezt->vec[0], vec);
-				if(bezt->f2 & flag) add_v3_v3(bezt->vec[1], vec);
-				if(bezt->f3 & flag) add_v3_v3(bezt->vec[2], vec);
+			while (a--) {
+				if (bezt->f1 & flag) add_v3_v3(bezt->vec[0], vec);
+				if (bezt->f2 & flag) add_v3_v3(bezt->vec[1], vec);
+				if (bezt->f3 & flag) add_v3_v3(bezt->vec[2], vec);
 				bezt++;
 			}
 		}
 		else {
 			a= nu->pntsu*nu->pntsv;
 			bp= nu->bp;
-			while(a--) {
-				if(bp->f1 & flag) add_v3_v3(bp->vec, vec);
+			while (a--) {
+				if (bp->f1 & flag) add_v3_v3(bp->vec, vec);
 				bp++;
 			}
 		}
@@ -1543,12 +1557,12 @@ static void weightflagNurb(ListBase *editnurb, short flag, float w)
 	BPoint *bp;
 	int a;
 
-	for(nu= editnurb->first; nu; nu= nu->next) {
-		if(nu->type == CU_NURBS) {
+	for (nu= editnurb->first; nu; nu= nu->next) {
+		if (nu->type == CU_NURBS) {
 			a= nu->pntsu*nu->pntsv;
 			bp= nu->bp;
-			while(a--) {
-				if(bp->f1 & flag) {
+			while (a--) {
+				if (bp->f1 & flag) {
 					/* a mode used to exist for replace/multiple but is was unused */
 					bp->vec[3]*= w;
 				}
@@ -1567,25 +1581,25 @@ static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag)
 	BPoint *bp, *bpn, *newbp;
 	int a, b, newu, newv, sel;
 
-	if(obedit->type==OB_SURF);
+	if (obedit->type==OB_SURF);
 	else return OPERATOR_CANCELLED;
 
 	cu->lastsel= NULL;
 
 	nu= editnurb->first;
-	while(nu) {
+	while (nu) {
 		next= nu->next;
 
 		/* is entire nurb selected */
 		bp= nu->bp;
 		a= nu->pntsu*nu->pntsv;
-		while(a) {
+		while (a) {
 			a--;
-			if(bp->f1 & flag);
+			if (bp->f1 & flag);
 			else break;
 			bp++;
 		}
-		if(a==0) {
+		if (a==0) {
 			BLI_remlink(editnurb, nu);
 			keyIndex_delNurb(cu->editnurb, nu);
 			freeNurb(nu); nu=NULL;
@@ -1594,30 +1608,31 @@ static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag)
 			/* is nurb in U direction selected */
 			newv= nu->pntsv;
 			bp= nu->bp;
-			for(b=0; b<nu->pntsv; b++) {
+			for (b=0; b<nu->pntsv; b++) {
 				sel= 0;
-				for(a=0; a<nu->pntsu; a++, bp++) {
-					if(bp->f1 & flag) sel++;
+				for (a=0; a<nu->pntsu; a++, bp++) {
+					if (bp->f1 & flag) sel++;
 				}
-				if(sel==nu->pntsu) {
+				if (sel==nu->pntsu) {
 					newv--;
 				}
-				else if(sel>=1) {
+				else if (sel>=1) {
 					/* don't delete */
 					break;
 				}
 			}
-			if(newv!=nu->pntsv && b==nu->pntsv)	{
+			if (newv!=nu->pntsv && b==nu->pntsv)	{
 				/* delete */
 				bp= nu->bp;
 				bpn = newbp =
 					(BPoint*) MEM_mallocN(newv * nu->pntsu * sizeof(BPoint), "deleteNurb");
-				for(b=0; b<nu->pntsv; b++) {
-					if((bp->f1 & flag)==0) {
+				for (b=0; b<nu->pntsv; b++) {
+					if ((bp->f1 & flag)==0) {
 						memcpy(bpn, bp, nu->pntsu*sizeof(BPoint));
 						keyIndex_updateBP(cu->editnurb, bp, bpn, nu->pntsu);
 						bpn+= nu->pntsu;
-					} else {
+					}
+					else {
 						keyIndex_delBP(cu->editnurb, bp);
 					}
 					bp+= nu->pntsu;
@@ -1632,44 +1647,45 @@ static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag)
 			else {
 				/* is the nurb in V direction selected */
 				newu= nu->pntsu;
-				for(a=0; a<nu->pntsu; a++) {
+				for (a=0; a<nu->pntsu; a++) {
 					bp= nu->bp+a;
 					sel= 0;
-					for(b=0; b<nu->pntsv; b++, bp+=nu->pntsu) {
-						if(bp->f1 & flag) sel++;
+					for (b=0; b<nu->pntsv; b++, bp+=nu->pntsu) {
+						if (bp->f1 & flag) sel++;
 					}
-					if(sel==nu->pntsv) {
+					if (sel==nu->pntsv) {
 						newu--;
 					}
-					else if(sel>=1) {
+					else if (sel>=1) {
 						/* don't delete */
 						break;
 					}
 				}
-				if(newu!=nu->pntsu && a==nu->pntsu)	{
+				if (newu!=nu->pntsu && a==nu->pntsu)	{
 					/* delete */
 					bp= nu->bp;
 					bpn = newbp =
 						(BPoint*) MEM_mallocN(newu * nu->pntsv * sizeof(BPoint), "deleteNurb");
-					for(b=0; b<nu->pntsv; b++) {
-						for(a=0; a<nu->pntsu; a++, bp++) {
-							if((bp->f1 & flag)==0) {
+					for (b=0; b<nu->pntsv; b++) {
+						for (a=0; a<nu->pntsu; a++, bp++) {
+							if ((bp->f1 & flag)==0) {
 								*bpn= *bp;
 								keyIndex_updateBP(cu->editnurb, bp, bpn, 1);
 								bpn++;
-							} else {
+							}
+							else {
 								keyIndex_delBP(cu->editnurb, bp);
 							}
 						}
 					}
 					MEM_freeN(nu->bp);
 					nu->bp= newbp;
-					if(newu==1 && nu->pntsv>1) {    /* make a U spline */
+					if (newu==1 && nu->pntsv>1) {    /* make a U spline */
 						nu->pntsu= nu->pntsv;
 						nu->pntsv= 1;
 						SWAP(short, nu->orderu, nu->orderv);
 						clamp_nurb_order_u(nu);
-						if(nu->knotsv) MEM_freeN(nu->knotsv);
+						if (nu->knotsv) MEM_freeN(nu->knotsv);
 						nu->knotsv= NULL;
 					}
 					else {
@@ -1683,7 +1699,7 @@ static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag)
 		nu= next;
 	}
 
-	if(ED_curve_updateAnimPaths(obedit))
+	if (ED_curve_updateAnimPaths(obedit->data))
 		WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
 
 	return OPERATOR_FINISHED;
@@ -1697,18 +1713,18 @@ static short extrudeflagNurb(EditNurb *editnurb, int flag)
 	int ok= 0, a, u, v, len;
 
 	nu= editnurb->nurbs.first;
-	while(nu) {
+	while (nu) {
 
-		if(nu->pntsv==1) {
+		if (nu->pntsv==1) {
 			bp= nu->bp;
 			a= nu->pntsu;
-			while(a) {
-				if(bp->f1 & flag);
+			while (a) {
+				if (bp->f1 & flag);
 				else break;
 				bp++;
 				a--;
 			}
-			if(a==0) {
+			if (a==0) {
 				ok= 1;
 				newbp =
 					(BPoint*)MEM_mallocN(2 * nu->pntsu * sizeof(BPoint), "extrudeNurb1");
@@ -1718,7 +1734,7 @@ static short extrudeflagNurb(EditNurb *editnurb, int flag)
 				MEM_freeN(nu->bp);
 				nu->bp= newbp;
 				a= nu->pntsu;
-				while(a--) {
+				while (a--) {
 					select_bpoint(bp, SELECT, flag, HIDDEN);
 					select_bpoint(newbp, DESELECT, flag, HIDDEN);
 					bp++; 
@@ -1733,22 +1749,22 @@ static short extrudeflagNurb(EditNurb *editnurb, int flag)
 		else {
 			/* which row or column is selected */
 
-			if( isNurbselUV(nu, &u, &v, flag) ) {
+			if ( isNurbselUV(nu, &u, &v, flag) ) {
 
 				/* deselect all */
 				bp= nu->bp;
 				a= nu->pntsu*nu->pntsv;
-				while(a--) {
+				while (a--) {
 					select_bpoint(bp, DESELECT, flag, HIDDEN);
 					bp++;
 				}
 
-				if(u==0 || u== nu->pntsv-1) {	    /* row in u-direction selected */
+				if (u==0 || u== nu->pntsv-1) {	    /* row in u-direction selected */
 					ok= 1;
 					newbp =
 						(BPoint*) MEM_mallocN(nu->pntsu*(nu->pntsv + 1)
 										  * sizeof(BPoint), "extrudeNurb1");
-					if(u==0) {
+					if (u==0) {
 						len= nu->pntsv*nu->pntsu;
 						ED_curve_bpcpy(editnurb, newbp+nu->pntsu, nu->bp, len);
 						ED_curve_bpcpy(editnurb, newbp, nu->bp, nu->pntsu);
@@ -1762,7 +1778,7 @@ static short extrudeflagNurb(EditNurb *editnurb, int flag)
 					}
 
 					a= nu->pntsu;
-					while(a--) {
+					while (a--) {
 						select_bpoint(bp, SELECT, flag, HIDDEN);
 						bp++;
 					}
@@ -1772,14 +1788,14 @@ static short extrudeflagNurb(EditNurb *editnurb, int flag)
 					nu->pntsv++;
 					nurbs_knot_calc_v(nu);
 				}
-				else if(v==0 || v== nu->pntsu-1) {	    /* collumn in v-direction selected */
+				else if (v==0 || v== nu->pntsu-1) {	    /* column in v-direction selected */
 					ok= 1;
 					bpn = newbp =
 						(BPoint*) MEM_mallocN((nu->pntsu + 1) * nu->pntsv * sizeof(BPoint), "extrudeNurb1");
 					bp= nu->bp;
 
-					for(a=0; a<nu->pntsv; a++) {
-						if(v==0) {
+					for (a=0; a<nu->pntsv; a++) {
+						if (v==0) {
 							*bpn= *bp;
 							bpn->f1 |= flag;
 							bpn++;
@@ -1787,7 +1803,7 @@ static short extrudeflagNurb(EditNurb *editnurb, int flag)
 						ED_curve_bpcpy(editnurb, bpn, bp, nu->pntsu);
 						bp+= nu->pntsu;
 						bpn+= nu->pntsu;
-						if(v== nu->pntsu-1) {
+						if (v== nu->pntsu-1) {
 							*bpn= *(bp-1);
 							bpn->f1 |= flag;
 							bpn++;
@@ -1820,20 +1836,20 @@ static void adduplicateflagNurb(Object *obedit, short flag)
 	cu->lastsel= NULL;
 
 	nu= editnurb->last;
-	while(nu) {
-		if(nu->type == CU_BEZIER) {
+	while (nu) {
+		if (nu->type == CU_BEZIER) {
 			bezt= nu->bezt;
-			for(a=0; a<nu->pntsu; a++) {
+			for (a=0; a<nu->pntsu; a++) {
 				enda= -1;
 				starta= a;
-				while( (bezt->f1 & flag) || (bezt->f2 & flag) || (bezt->f3 & flag) ) {
+				while ( (bezt->f1 & flag) || (bezt->f2 & flag) || (bezt->f3 & flag) ) {
 					select_beztriple(bezt, DESELECT, flag, HIDDEN);
 					enda=a;
-					if(a>=nu->pntsu-1) break;
+					if (a>=nu->pntsu-1) break;
 					a++;
 					bezt++;
 				}
-				if(enda>=starta) {
+				if (enda>=starta) {
 					newnu = (Nurb*)MEM_mallocN(sizeof(Nurb), "adduplicateN");  
 					memcpy(newnu, nu, sizeof(Nurb));
 					BLI_addtail(editnurb, newnu);
@@ -1845,13 +1861,13 @@ static void adduplicateflagNurb(Object *obedit, short flag)
 
 					b= newnu->pntsu;
 					bezt1= newnu->bezt;
-					while(b--) {
+					while (b--) {
 						select_beztriple(bezt1, SELECT, flag, HIDDEN);
 						bezt1++;
 					}
 
-					if(nu->flagu & CU_NURB_CYCLIC) {
-						if(starta!=0 || enda!=nu->pntsu-1) {
+					if (nu->flagu & CU_NURB_CYCLIC) {
+						if (starta!=0 || enda!=nu->pntsu-1) {
 							newnu->flagu &= ~CU_NURB_CYCLIC;
 						}
 					}
@@ -1859,19 +1875,19 @@ static void adduplicateflagNurb(Object *obedit, short flag)
 				bezt++;
 			}
 		}
-		else if(nu->pntsv==1) {	/* because UV Nurb has a different method for dupli */
+		else if (nu->pntsv==1) {	/* because UV Nurb has a different method for dupli */
 			bp= nu->bp;
-			for(a=0; a<nu->pntsu; a++) {
+			for (a=0; a<nu->pntsu; a++) {
 				enda= -1;
 				starta= a;
-				while(bp->f1 & flag) {
+				while (bp->f1 & flag) {
 					select_bpoint(bp, DESELECT, flag, HIDDEN);
 					enda= a;
-					if(a>=nu->pntsu-1) break;
+					if (a>=nu->pntsu-1) break;
 					a++;
 					bp++;
 				}
-				if(enda>=starta) {
+				if (enda>=starta) {
 					newnu = (Nurb*)MEM_mallocN(sizeof(Nurb), "adduplicateN3");  
 					memcpy(newnu, nu, sizeof(Nurb));
 					set_actNurb(obedit, newnu);
@@ -1882,13 +1898,13 @@ static void adduplicateflagNurb(Object *obedit, short flag)
 
 					b= newnu->pntsu;
 					bp1= newnu->bp;
-					while(b--) {
+					while (b--) {
 						select_bpoint(bp1, SELECT, flag, HIDDEN);
 						bp1++;
 					}
 
-					if(nu->flagu & CU_NURB_CYCLIC) {
-						if(starta!=0 || enda!=nu->pntsu-1) {
+					if (nu->flagu & CU_NURB_CYCLIC) {
+						if (starta!=0 || enda!=nu->pntsu-1) {
 							newnu->flagu &= ~CU_NURB_CYCLIC;
 						}
 					}
@@ -1902,19 +1918,19 @@ static void adduplicateflagNurb(Object *obedit, short flag)
 		}
 		else {
 			/* a rectangular area in nurb has to be selected */
-			if(isNurbsel(nu)) {
+			if (isNurbsel(nu)) {
 				usel= MEM_callocN(nu->pntsu, "adduplicateN4");
 				bp= nu->bp;
-				for(a=0; a<nu->pntsv; a++) {
-					for(b=0; b<nu->pntsu; b++, bp++) {
-						if(bp->f1 & flag) usel[b]++;
+				for (a=0; a<nu->pntsv; a++) {
+					for (b=0; b<nu->pntsu; b++, bp++) {
+						if (bp->f1 & flag) usel[b]++;
 					}
 				}
 				newu= 0;
 				newv= 0;
-				for(a=0; a<nu->pntsu; a++) {
-					if(usel[a]) {
-						if(newv==0 || usel[a]==newv) {
+				for (a=0; a<nu->pntsu; a++) {
+					if (usel[a]) {
+						if (newv==0 || usel[a]==newv) {
 							newv= usel[a];
 							newu++;
 						}
@@ -1924,13 +1940,13 @@ static void adduplicateflagNurb(Object *obedit, short flag)
 						}
 					}
 				}
-				if(newu==0 || newv==0) {
-					if (G.f & G_DEBUG)
+				if (newu==0 || newv==0) {
+					if (G.debug & G_DEBUG)
 						printf("Can't duplicate Nurb\n");
 				}
 				else {
 
-					if(newu==1) SWAP(short, newu, newv);
+					if (newu==1) SWAP(short, newu, newv);
 
 					newnu = (Nurb*)MEM_mallocN(sizeof(Nurb), "adduplicateN5");
 					memcpy(newnu, nu, sizeof(Nurb));
@@ -1947,9 +1963,9 @@ static void adduplicateflagNurb(Object *obedit, short flag)
 					
 					bp= newnu->bp;
 					bp1= nu->bp;
-					for(a=0; a<nu->pntsv; a++) {
-						for(b=0; b<nu->pntsu; b++, bp1++) {
-							if(bp1->f1 & flag) {
+					for (a=0; a<nu->pntsv; a++) {
+						for (b=0; b<nu->pntsu; b++, bp1++) {
+							if (bp1->f1 & flag) {
 								memcpy(bp, bp1, sizeof(BPoint));
 								select_bpoint(bp1, DESELECT, flag, HIDDEN);
 								bp++;
@@ -1957,16 +1973,18 @@ static void adduplicateflagNurb(Object *obedit, short flag)
 						}
 					}
 					if (check_valid_nurb_u(newnu)) {
-						if(nu->pntsu==newnu->pntsu && nu->knotsu) {
+						if (nu->pntsu==newnu->pntsu && nu->knotsu) {
 							newnu->knotsu= MEM_dupallocN( nu->knotsu );
-						} else {
+						}
+						else {
 							nurbs_knot_calc_u(newnu);
 						}
 					}
 					if (check_valid_nurb_v(newnu)) {
-						if(nu->pntsv==newnu->pntsv && nu->knotsv) {
+						if (nu->pntsv==newnu->pntsv && nu->knotsv) {
 							newnu->knotsv= MEM_dupallocN( nu->knotsv );
-						} else {
+						}
+						else {
 							nurbs_knot_calc_v(newnu);
 						}
 					}
@@ -1990,13 +2008,13 @@ static int switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
 	EditNurb *editnurb= cu->editnurb;
 	Nurb *nu;
 
-	for(nu= editnurb->nurbs.first; nu; nu= nu->next)
-		if(isNurbsel(nu)) {
+	for (nu= editnurb->nurbs.first; nu; nu= nu->next)
+		if (isNurbsel(nu)) {
 			switchdirectionNurb(nu);
 			keyData_switchDirectionNurb(cu, nu);
 		}
 
-	if(ED_curve_updateAnimPaths(obedit))
+	if (ED_curve_updateAnimPaths(obedit->data))
 		WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
 
 	DAG_id_tag_update(obedit->data, 0);
@@ -2008,16 +2026,16 @@ static int switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
 void CURVE_OT_switch_direction(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Switch Direction";
-	ot->description= "Switch direction of selected splines";
-	ot->idname= "CURVE_OT_switch_direction";
+	ot->name = "Switch Direction";
+	ot->description = "Switch direction of selected splines";
+	ot->idname = "CURVE_OT_switch_direction";
 	
 	/* api callbacks */
-	ot->exec= switch_direction_exec;
-	ot->poll= ED_operator_editsurfcurve;
+	ot->exec = switch_direction_exec;
+	ot->poll = ED_operator_editsurfcurve;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /****************** set weight operator *******************/
@@ -2032,16 +2050,16 @@ static int set_goal_weight_exec(bContext *C, wmOperator *op)
 	float weight= RNA_float_get(op->ptr, "weight");
 	int a;
 				
-	for(nu= editnurb->first; nu; nu= nu->next) {
-		if(nu->bezt) {
-			for(bezt=nu->bezt, a=0; a<nu->pntsu; a++, bezt++) {
-				if(bezt->f2 & SELECT)
+	for (nu= editnurb->first; nu; nu= nu->next) {
+		if (nu->bezt) {
+			for (bezt=nu->bezt, a=0; a<nu->pntsu; a++, bezt++) {
+				if (bezt->f2 & SELECT)
 					bezt->weight= weight;
 			}
 		}
-		else if(nu->bp) {
-			for(bp=nu->bp, a=0; a<nu->pntsu*nu->pntsv; a++, bp++) {
-				if(bp->f1 & SELECT)
+		else if (nu->bp) {
+			for (bp=nu->bp, a=0; a<nu->pntsu*nu->pntsv; a++, bp++) {
+				if (bp->f1 & SELECT)
 					bp->weight= weight;
 			}
 		}
@@ -2056,17 +2074,17 @@ static int set_goal_weight_exec(bContext *C, wmOperator *op)
 void CURVE_OT_spline_weight_set(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Goal Weight";
-	ot->description= "Set softbody goal weight for selected points";
-	ot->idname= "CURVE_OT_spline_weight_set";
+	ot->name = "Set Goal Weight";
+	ot->description = "Set softbody goal weight for selected points";
+	ot->idname = "CURVE_OT_spline_weight_set";
 	
 	/* api callbacks */
-	ot->exec= set_goal_weight_exec;
-	ot->invoke= WM_operator_props_popup;
-	ot->poll= ED_operator_editsurfcurve;
+	ot->exec = set_goal_weight_exec;
+	ot->invoke = WM_operator_props_popup;
+	ot->poll = ED_operator_editsurfcurve;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_float_factor(ot->srna, "weight", 1.0f, 0.0f, 1.0f, "Weight", "", 0.0f, 1.0f);
@@ -2084,16 +2102,16 @@ static int set_radius_exec(bContext *C, wmOperator *op)
 	float radius= RNA_float_get(op->ptr, "radius");
 	int a;
 	
-	for(nu= editnurb->first; nu; nu= nu->next) {
-		if(nu->bezt) {
-			for(bezt=nu->bezt, a=0; a<nu->pntsu; a++, bezt++) {
-				if(bezt->f2 & SELECT)
+	for (nu= editnurb->first; nu; nu= nu->next) {
+		if (nu->bezt) {
+			for (bezt=nu->bezt, a=0; a<nu->pntsu; a++, bezt++) {
+				if (bezt->f2 & SELECT)
 					bezt->radius= radius;
 			}
 		}
-		else if(nu->bp) {
-			for(bp=nu->bp, a=0; a<nu->pntsu*nu->pntsv; a++, bp++) {
-				if(bp->f1 & SELECT)
+		else if (nu->bp) {
+			for (bp=nu->bp, a=0; a<nu->pntsu*nu->pntsv; a++, bp++) {
+				if (bp->f1 & SELECT)
 					bp->radius= radius;
 			}
 		}
@@ -2108,17 +2126,17 @@ static int set_radius_exec(bContext *C, wmOperator *op)
 void CURVE_OT_radius_set(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Curve Radius";
-	ot->description= "Set per-point radius which is used for bevel tapering";
-	ot->idname= "CURVE_OT_radius_set";
+	ot->name = "Set Curve Radius";
+	ot->description = "Set per-point radius which is used for bevel tapering";
+	ot->idname = "CURVE_OT_radius_set";
 	
 	/* api callbacks */
-	ot->exec= set_radius_exec;
-	ot->invoke= WM_operator_props_popup;
-	ot->poll= ED_operator_editsurfcurve;
+	ot->exec = set_radius_exec;
+	ot->invoke = WM_operator_props_popup;
+	ot->poll = ED_operator_editsurfcurve;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_float(ot->srna, "radius", 1.0f, 0.0f, FLT_MAX, "Radius", "", 0.0001f, 10.0f);
@@ -2136,13 +2154,13 @@ static int smooth_exec(bContext *C, wmOperator *UNUSED(op))
 	float val, newval, offset;
 	int a, i, change = 0;
 	
-	for(nu= editnurb->first; nu; nu= nu->next) {
-		if(nu->bezt) {
+	for (nu= editnurb->first; nu; nu= nu->next) {
+		if (nu->bezt) {
 			change = 0;
 			beztOrig = MEM_dupallocN( nu->bezt );
-			for(bezt=nu->bezt+1, a=1; a<nu->pntsu-1; a++, bezt++) {
-				if(bezt->f2 & SELECT) {
-					for(i=0; i<3; i++) {
+			for (bezt=nu->bezt+1, a=1; a<nu->pntsu-1; a++, bezt++) {
+				if (bezt->f2 & SELECT) {
+					for (i=0; i<3; i++) {
 						val = bezt->vec[1][i];
 						newval = ((beztOrig+(a-1))->vec[1][i] * 0.5f) + ((beztOrig+(a+1))->vec[1][i] * 0.5f);
 						offset = (val*((1.0f/6.0f)*5.0f)) + (newval*(1.0f/6.0f)) - val;
@@ -2157,12 +2175,13 @@ static int smooth_exec(bContext *C, wmOperator *UNUSED(op))
 			MEM_freeN(beztOrig);
 			if (change)
 				calchandlesNurb(nu);
-		} else if (nu->bp) {
+		}
+		else if (nu->bp) {
 			bpOrig = MEM_dupallocN( nu->bp );
 			/* Same as above, keep these the same! */
-			for(bp=nu->bp+1, a=1; a<nu->pntsu-1; a++, bp++) {
-				if(bp->f1 & SELECT) {
-					for(i=0; i<3; i++) {
+			for (bp=nu->bp+1, a=1; a<nu->pntsu-1; a++, bp++) {
+				if (bp->f1 & SELECT) {
+					for (i=0; i<3; i++) {
 						val = bp->vec[i];
 						newval = ((bpOrig+(a-1))->vec[i] * 0.5f) + ((bpOrig+(a+1))->vec[i] * 0.5f);
 						offset = (val*((1.0f/6.0f)*5.0f)) + (newval*(1.0f/6.0f)) - val;
@@ -2184,16 +2203,16 @@ static int smooth_exec(bContext *C, wmOperator *UNUSED(op))
 void CURVE_OT_smooth(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Smooth";
-	ot->description= "Flatten angles of selected points";
-	ot->idname= "CURVE_OT_smooth";
+	ot->name = "Smooth";
+	ot->description = "Flatten angles of selected points";
+	ot->idname = "CURVE_OT_smooth";
 	
 	/* api callbacks */
-	ot->exec= smooth_exec;
-	ot->poll= ED_operator_editsurfcurve;
+	ot->exec = smooth_exec;
+	ot->poll = ED_operator_editsurfcurve;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /**************** smooth curve radius operator *************/
@@ -2213,24 +2232,24 @@ static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op))
 	int start_sel, end_sel; /* selection indices, inclusive */
 	float start_rad, end_rad, fac, range;
 	
-	for(nu= editnurb->first; nu; nu= nu->next) {
-		if(nu->bezt) {
+	for (nu= editnurb->first; nu; nu= nu->next) {
+		if (nu->bezt) {
 			
 			for (last_sel=0; last_sel < nu->pntsu; last_sel++) {
 				/* loop over selection segments of a curve, smooth each */
 				
 				/* Start BezTriple code, this is duplicated below for points, make sure these functions stay in sync */
 				start_sel = -1;
-				for(bezt=nu->bezt+last_sel, a=last_sel; a<nu->pntsu; a++, bezt++) {
-					if(bezt->f2 & SELECT) {
+				for (bezt=nu->bezt+last_sel, a=last_sel; a<nu->pntsu; a++, bezt++) {
+					if (bezt->f2 & SELECT) {
 						start_sel = a;
 						break;
 					}
 				}
-				/* incase there are no other selected verts */
+				/* in case there are no other selected verts */
 				end_sel = start_sel;
-				for(bezt=nu->bezt+(start_sel+1), a=start_sel+1; a<nu->pntsu; a++, bezt++) {
-					if((bezt->f2 & SELECT)==0) {
+				for (bezt=nu->bezt+(start_sel+1), a=start_sel+1; a<nu->pntsu; a++, bezt++) {
+					if ((bezt->f2 & SELECT)==0) {
 						break;
 					}
 					end_sel = a;
@@ -2238,7 +2257,8 @@ static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op))
 				
 				if (start_sel == -1) {
 					last_sel = nu->pntsu; /* next... */
-				} else {
+				}
+				else {
 					last_sel = end_sel; /* before we modify it */
 					
 					/* now blend between start and end sel */
@@ -2252,47 +2272,51 @@ static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op))
 						if (start_rad >= 0.0f && end_rad >= 0.0f)	(nu->bezt+start_sel)->radius = (start_rad + end_rad)/2;
 						else if (start_rad >= 0.0f)				(nu->bezt+start_sel)->radius = start_rad;
 						else if (end_rad >= 0.0f)				(nu->bezt+start_sel)->radius = end_rad;
-					} else {
+					}
+					else {
 						/* if endpoints selected, then use them */
 						if (start_sel==0) {
 							start_rad = (nu->bezt+start_sel)->radius;
-							start_sel++; /* we dont want to edit the selected endpoint */
-						} else {
+							start_sel++; /* we don't want to edit the selected endpoint */
+						}
+						else {
 							start_rad = (nu->bezt+start_sel-1)->radius;
 						}
 						if (end_sel==nu->pntsu-1) {
 							end_rad = (nu->bezt+end_sel)->radius;
-							end_sel--; /* we dont want to edit the selected endpoint */
-						} else {
+							end_sel--; /* we don't want to edit the selected endpoint */
+						}
+						else {
 							end_rad = (nu->bezt+end_sel+1)->radius;
 						}
 						
 						/* Now Blend between the points */
 						range = (float)(end_sel - start_sel) + 2.0f;
-						for(bezt=nu->bezt+start_sel, a=start_sel; a<=end_sel; a++, bezt++) {
+						for (bezt=nu->bezt+start_sel, a=start_sel; a<=end_sel; a++, bezt++) {
 							fac = (float)(1+a-start_sel) / range;
 							bezt->radius = start_rad*(1.0f-fac) + end_rad*fac;
 						}
 					}
 				}
 			}
-		} else if (nu->bp) {
+		}
+		else if (nu->bp) {
 			/* Same as above, keep these the same! */
 			for (last_sel=0; last_sel < nu->pntsu; last_sel++) {
 				/* loop over selection segments of a curve, smooth each */
 				
 				/* Start BezTriple code, this is duplicated below for points, make sure these functions stay in sync */
 				start_sel = -1;
-				for(bp=nu->bp+last_sel, a=last_sel; a<nu->pntsu; a++, bp++) {
-					if(bp->f1 & SELECT) {
+				for (bp=nu->bp+last_sel, a=last_sel; a<nu->pntsu; a++, bp++) {
+					if (bp->f1 & SELECT) {
 						start_sel = a;
 						break;
 					}
 				}
-				/* incase there are no other selected verts */
+				/* in case there are no other selected verts */
 				end_sel = start_sel;
-				for(bp=nu->bp+(start_sel+1), a=start_sel+1; a<nu->pntsu; a++, bp++) {
-					if((bp->f1 & SELECT)==0) {
+				for (bp=nu->bp+(start_sel+1), a=start_sel+1; a<nu->pntsu; a++, bp++) {
+					if ((bp->f1 & SELECT)==0) {
 						break;
 					}
 					end_sel = a;
@@ -2300,7 +2324,8 @@ static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op))
 				
 				if (start_sel == -1) {
 					last_sel = nu->pntsu; /* next... */
-				} else {
+				}
+				else {
 					last_sel = end_sel; /* before we modify it */
 					
 					/* now blend between start and end sel */
@@ -2314,24 +2339,27 @@ static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op))
 						if (start_rad >= 0.0f && end_rad >= 0.0f)	(nu->bp+start_sel)->radius = (start_rad + end_rad)/2;
 						else if (start_rad >= 0.0f)					(nu->bp+start_sel)->radius = start_rad;
 						else if (end_rad >= 0.0f)					(nu->bp+start_sel)->radius = end_rad;
-					} else {
+					}
+					else {
 						/* if endpoints selected, then use them */
 						if (start_sel==0) {
 							start_rad = (nu->bp+start_sel)->radius;
-							start_sel++; /* we dont want to edit the selected endpoint */
-						} else {
+							start_sel++; /* we don't want to edit the selected endpoint */
+						}
+						else {
 							start_rad = (nu->bp+start_sel-1)->radius;
 						}
 						if (end_sel==nu->pntsu-1) {
 							end_rad = (nu->bp+end_sel)->radius;
-							end_sel--; /* we dont want to edit the selected endpoint */
-						} else {
+							end_sel--; /* we don't want to edit the selected endpoint */
+						}
+						else {
 							end_rad = (nu->bp+end_sel+1)->radius;
 						}
 						
 						/* Now Blend between the points */
 						range = (float)(end_sel - start_sel) + 2.0f;
-						for(bp=nu->bp+start_sel, a=start_sel; a<=end_sel; a++, bp++) {
+						for (bp=nu->bp+start_sel, a=start_sel; a<=end_sel; a++, bp++) {
 							fac = (float)(1+a-start_sel) / range;
 							bp->radius = start_rad*(1.0f-fac) + end_rad*fac;
 						}
@@ -2350,16 +2378,16 @@ static int smooth_radius_exec(bContext *C, wmOperator *UNUSED(op))
 void CURVE_OT_smooth_radius(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Smooth Curve Radius";
-	ot->description= "Flatten radiuses of selected points";
-	ot->idname= "CURVE_OT_smooth_radius";
+	ot->name = "Smooth Curve Radius";
+	ot->description = "Flatten radiuses of selected points";
+	ot->idname = "CURVE_OT_smooth_radius";
 	
 	/* api clastbacks */
-	ot->exec= smooth_radius_exec;
-	ot->poll= ED_operator_editsurfcurve;
+	ot->exec = smooth_radius_exec;
+	ot->poll = ED_operator_editsurfcurve;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /***************** selection utility *************************/
@@ -2367,7 +2395,7 @@ void CURVE_OT_smooth_radius(wmOperatorType *ot)
 /* next == 1 -> select next 		*/
 /* next == -1 -> select previous 	*/
 /* cont == 1 -> select continuously 	*/
-/* selstatus, inverts behaviour		*/
+/* selstatus, inverts behavior		*/
 static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short selstatus)
 {
 	Nurb *nu;
@@ -2376,21 +2404,21 @@ static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short
 	int a;
 	short lastsel= 0;
 	
-	if(next==0) return;
+	if (next==0) return;
 	
-	for(nu= editnurb->first; nu; nu= nu->next) {
+	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));
-			while(a--) {
-				if(a-abs(next) < 0) break;
-				if((lastsel==0) && (bezt->hide==0) && ((bezt->f2 & SELECT) || (selstatus==0))) {
+			if (next < 0) bezt= (nu->bezt + (a-1));
+			while (a--) {
+				if (a-abs(next) < 0) break;
+				if ((lastsel==0) && (bezt->hide==0) && ((bezt->f2 & SELECT) || (selstatus==0))) {
 					bezt+=next;
-					if(!(bezt->f2 & SELECT) || (selstatus==0)) {
+					if (!(bezt->f2 & SELECT) || (selstatus==0)) {
 						short sel= select_beztriple(bezt, selstatus, 1, VISIBLE);
-						if((sel==1) && (cont==0)) lastsel= 1;
+						if ((sel==1) && (cont==0)) lastsel= 1;
 					}
 				}
 				else {
@@ -2404,14 +2432,14 @@ static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short
 		else {
 			a= nu->pntsu*nu->pntsv;
 			bp= nu->bp;
-			if(next < 0) bp= (nu->bp + (a-1));
-			while(a--) {
-				if(a-abs(next) < 0) break;
-				if((lastsel==0) && (bp->hide==0) && ((bp->f1 & SELECT) || (selstatus==0))) {
+			if (next < 0) bp= (nu->bp + (a-1));
+			while (a--) {
+				if (a-abs(next) < 0) break;
+				if ((lastsel==0) && (bp->hide==0) && ((bp->f1 & SELECT) || (selstatus==0))) {
 					bp+=next;
-					if(!(bp->f1 & SELECT) || (selstatus==0)) {
+					if (!(bp->f1 & SELECT) || (selstatus==0)) {
 						short sel= select_bpoint(bp, selstatus, 1, VISIBLE);
-						if((sel==1) && (cont==0)) lastsel= 1;
+						if ((sel==1) && (cont==0)) lastsel= 1;
 					}			
 				}
 				else {
@@ -2440,49 +2468,49 @@ void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatu
 	Curve *cu;
 	int a;
 
-	if(obedit==NULL) return;
+	if (obedit==NULL) return;
 
 	cu= (Curve*)obedit->data;
 	cu->lastsel= NULL;
 
-	for(nu= editnurb->first; nu; nu= nu->next) {
-		if(nu->type == CU_BEZIER) {
+	for (nu= editnurb->first; nu; nu= nu->next) {
+		if (nu->type == CU_BEZIER) {
 			a= nu->pntsu;
 			
 			/* which point? */
-			if(selfirst==0) { /* select last */ 
+			if (selfirst==0) { /* select last */ 
 				bezt= (nu->bezt + (a-1));
 			}
 			else { /* select first */
 				bezt= nu->bezt;
 			}
 			
-			while(a--) {
+			while (a--) {
 				short sel;
-				if(doswap) sel= swap_selection_beztriple(bezt);
+				if (doswap) sel= swap_selection_beztriple(bezt);
 				else sel= select_beztriple(bezt, selstatus, 1, VISIBLE);
 				
-				if(sel==1) break;
+				if (sel==1) break;
 			}
 		}
 		else {
 			a= nu->pntsu*nu->pntsv;
 			
 			/* which point? */
-			if(selfirst==0) { /* select last */
+			if (selfirst==0) { /* select last */
 				bp= (nu->bp + (a-1));
 			}
-			else{ /* select first */
+			else { /* select first */
 				bp= nu->bp;
 			}
 
-			while(a--) {
+			while (a--) {
 				if (bp->hide == 0) {
 					short sel;
-					if(doswap) sel= swap_selection_bpoint(bp);
+					if (doswap) sel= swap_selection_bpoint(bp);
 					else sel= select_bpoint(bp, selstatus, 1, VISIBLE);
 					
-					if(sel==1) break;
+					if (sel==1) break;
 				}
 			}
 		}
@@ -2502,15 +2530,15 @@ static int de_select_first_exec(bContext *C, wmOperator *UNUSED(op))
 void CURVE_OT_de_select_first(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select or Deselect First";
-	ot->idname= "CURVE_OT_de_select_first";
+	ot->name = "(De)select First";
+	ot->idname = "CURVE_OT_de_select_first";
 	
 	/* api cfirstbacks */
-	ot->exec= de_select_first_exec;
-	ot->poll= ED_operator_editcurve;
+	ot->exec = de_select_first_exec;
+	ot->poll = ED_operator_editcurve;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int de_select_last_exec(bContext *C, wmOperator *UNUSED(op))
@@ -2526,15 +2554,15 @@ static int de_select_last_exec(bContext *C, wmOperator *UNUSED(op))
 void CURVE_OT_de_select_last(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select or Deselect Last";
-	ot->idname= "CURVE_OT_de_select_last";
+	ot->name = "(De)select Last";
+	ot->idname = "CURVE_OT_de_select_last";
 	
 	/* api clastbacks */
-	ot->exec= de_select_last_exec;
-	ot->poll= ED_operator_editcurve;
+	ot->exec = de_select_last_exec;
+	ot->poll = ED_operator_editcurve;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /******************* de select all operator ***************/
@@ -2546,15 +2574,18 @@ static short nurb_has_selected_cps(ListBase *editnurb)
 	BPoint *bp;
 	int a;
 
-	for(nu= editnurb->first; nu; nu= nu->next) {
-		if(nu->type == CU_BEZIER) {
+	for (nu= editnurb->first; nu; nu= nu->next) {
+		if (nu->type == CU_BEZIER) {
 			a= nu->pntsu;
 			bezt= nu->bezt;
-			while(a--) {
-				if(bezt->hide==0) {
-					if((bezt->f1 & SELECT)
-					|| (bezt->f2 & SELECT)
-					|| (bezt->f3 & SELECT)) return 1;
+			while (a--) {
+				if (bezt->hide==0) {
+					if ((bezt->f1 & SELECT) ||
+					    (bezt->f2 & SELECT) ||
+					    (bezt->f3 & SELECT))
+					{
+						return 1;
+					}
 				}
 				bezt++;
 			}
@@ -2562,8 +2593,8 @@ static short nurb_has_selected_cps(ListBase *editnurb)
 		else {
 			a= nu->pntsu*nu->pntsv;
 			bp= nu->bp;
-			while(a--) {
-				if((bp->hide==0) && (bp->f1 & SELECT)) return 1;
+			while (a--) {
+				if ((bp->hide==0) && (bp->f1 & SELECT)) return 1;
 				bp++;
 			}
 		}
@@ -2580,7 +2611,7 @@ static int de_select_all_exec(bContext *C, wmOperator *op)
 
 	if (action == SEL_TOGGLE) {
 		action = SEL_SELECT;
-		if(nurb_has_selected_cps(editnurb))
+		if (nurb_has_selected_cps(editnurb))
 			action = SEL_DESELECT;
 	}
 
@@ -2604,15 +2635,15 @@ static int de_select_all_exec(bContext *C, wmOperator *op)
 void CURVE_OT_select_all(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select or Deselect All";
-	ot->idname= "CURVE_OT_select_all";
+	ot->name = "(De)select All";
+	ot->idname = "CURVE_OT_select_all";
 	
 	/* api callbacks */
-	ot->exec= de_select_all_exec;
-	ot->poll= ED_operator_editsurfcurve;
+	ot->exec = de_select_all_exec;
+	ot->poll = ED_operator_editsurfcurve;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	WM_operator_properties_select_all(ot);
@@ -2630,42 +2661,42 @@ static int hide_exec(bContext *C, wmOperator *op)
 	BezTriple *bezt;
 	int a, sel, invert= RNA_boolean_get(op->ptr, "unselected");
 
-	for(nu= editnurb->first; nu; nu= nu->next) {
-		if(nu->type == CU_BEZIER) {
+	for (nu= editnurb->first; nu; nu= nu->next) {
+		if (nu->type == CU_BEZIER) {
 			bezt= nu->bezt;
 			a= nu->pntsu;
 			sel= 0;
-			while(a--) {
-				if(invert == 0 && BEZSELECTED_HIDDENHANDLES(cu, bezt)) {
+			while (a--) {
+				if (invert == 0 && BEZSELECTED_HIDDENHANDLES(cu, bezt)) {
 					select_beztriple(bezt, DESELECT, 1, HIDDEN);
 					bezt->hide= 1;
 				}
-				else if(invert && !BEZSELECTED_HIDDENHANDLES(cu, bezt)) {
+				else if (invert && !BEZSELECTED_HIDDENHANDLES(cu, bezt)) {
 					select_beztriple(bezt, DESELECT, 1, HIDDEN);
 					bezt->hide= 1;
 				}
-				if(bezt->hide) sel++;
+				if (bezt->hide) sel++;
 				bezt++;
 			}
-			if(sel==nu->pntsu) nu->hide= 1;
+			if (sel==nu->pntsu) nu->hide= 1;
 		}
 		else {
 			bp= nu->bp;
 			a= nu->pntsu*nu->pntsv;
 			sel= 0;
-			while(a--) {
-				if(invert==0 && (bp->f1 & SELECT)) {
+			while (a--) {
+				if (invert==0 && (bp->f1 & SELECT)) {
 					select_bpoint(bp, DESELECT, 1, HIDDEN);
 					bp->hide= 1;
 				}
-				else if(invert && (bp->f1 & SELECT)==0) {
+				else if (invert && (bp->f1 & SELECT)==0) {
 					select_bpoint(bp, DESELECT, 1, HIDDEN);
 					bp->hide= 1;
 				}
-				if(bp->hide) sel++;
+				if (bp->hide) sel++;
 				bp++;
 			}
-			if(sel==nu->pntsu*nu->pntsv) nu->hide= 1;
+			if (sel==nu->pntsu*nu->pntsv) nu->hide= 1;
 		}
 	}
 
@@ -2678,15 +2709,15 @@ static int hide_exec(bContext *C, wmOperator *op)
 void CURVE_OT_hide(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Hide Selected";
-	ot->idname= "CURVE_OT_hide";
+	ot->name = "Hide Selected";
+	ot->idname = "CURVE_OT_hide";
 	
 	/* api callbacks */
-	ot->exec= hide_exec;
-	ot->poll= ED_operator_editsurfcurve;
+	ot->exec = hide_exec;
+	ot->poll = ED_operator_editsurfcurve;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* props */
 	RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected");
@@ -2703,13 +2734,13 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
 	BezTriple *bezt;
 	int a;
 
-	for(nu= editnurb->first; nu; nu= nu->next) {
+	for (nu= editnurb->first; nu; nu= nu->next) {
 		nu->hide= 0;
-		if(nu->type == CU_BEZIER) {
+		if (nu->type == CU_BEZIER) {
 			bezt= nu->bezt;
 			a= nu->pntsu;
-			while(a--) {
-				if(bezt->hide) {
+			while (a--) {
+				if (bezt->hide) {
 					select_beztriple(bezt, SELECT, 1, HIDDEN);
 					bezt->hide= 0;
 				}
@@ -2719,8 +2750,8 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
 		else {
 			bp= nu->bp;
 			a= nu->pntsu*nu->pntsv;
-			while(a--) {
-				if(bp->hide) {
+			while (a--) {
+				if (bp->hide) {
 					select_bpoint(bp, SELECT, 1, HIDDEN);
 					bp->hide= 0;
 				}
@@ -2738,15 +2769,15 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
 void CURVE_OT_reveal(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Reveal Hidden";
-	ot->idname= "CURVE_OT_reveal";
+	ot->name = "Reveal Hidden";
+	ot->idname = "CURVE_OT_reveal";
 	
 	/* api callbacks */
-	ot->exec= reveal_exec;
-	ot->poll= ED_operator_editsurfcurve;
+	ot->exec = reveal_exec;
+	ot->poll = ED_operator_editsurfcurve;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************** subdivide operator *********************/
@@ -2768,16 +2799,16 @@ static void subdividenurb(Object *obedit, int number_cuts)
 
 	// printf("*** subdivideNurb: entering subdivide\n");
 
-	for(nu= editnurb->nurbs.first; nu; nu= nu->next) {
+	for (nu= editnurb->nurbs.first; nu; nu= nu->next) {
 		amount= 0;
-		if(nu->type == CU_BEZIER) {
+		if (nu->type == CU_BEZIER) {
 		/* 
-		   Insert a point into a 2D Bezier curve. 
-		   Endpoints are preserved. Otherwise, all selected and inserted points are 
-		   newly created. Old points are discarded.
-		*/
+		 * Insert a point into a 2D Bezier curve. 
+		 * Endpoints are preserved. Otherwise, all selected and inserted points are 
+		 * newly created. Old points are discarded.
+		 */
 			/* count */
-			if(nu->flagu & CU_NURB_CYCLIC) {
+			if (nu->flagu & CU_NURB_CYCLIC) {
 				a= nu->pntsu;
 				bezt= nu->bezt;
 				prevbezt= bezt+(a-1);
@@ -2787,18 +2818,18 @@ static void subdividenurb(Object *obedit, int number_cuts)
 				prevbezt= nu->bezt;
 				bezt= prevbezt+1;
 			}
-			while(a--) {
-				if( BEZSELECTED_HIDDENHANDLES(cu, prevbezt) && BEZSELECTED_HIDDENHANDLES(cu, bezt) ) amount+=number_cuts;
+			while (a--) {
+				if ( BEZSELECTED_HIDDENHANDLES(cu, prevbezt) && BEZSELECTED_HIDDENHANDLES(cu, bezt) ) amount+=number_cuts;
 				prevbezt= bezt;
 				bezt++;
 			}
 
-			if(amount) {
+			if (amount) {
 				/* insert */
 				beztnew =
 					(BezTriple*)MEM_mallocN((amount + nu->pntsu) * sizeof(BezTriple), "subdivNurb");
 				beztn= beztnew;
-				if(nu->flagu & CU_NURB_CYCLIC) {
+				if (nu->flagu & CU_NURB_CYCLIC) {
 					a= nu->pntsu;
 					bezt= nu->bezt;
 					prevbezt= bezt+(a-1);
@@ -2808,12 +2839,12 @@ static void subdividenurb(Object *obedit, int number_cuts)
 					prevbezt= nu->bezt;
 					bezt= prevbezt+1;
 				}
-				while(a--) {
+				while (a--) {
 					memcpy(beztn, prevbezt, sizeof(BezTriple));
 					keyIndex_updateBezt(editnurb, prevbezt, beztn, 1);
 					beztn++;
 
-					if( BEZSELECTED_HIDDENHANDLES(cu, prevbezt) && BEZSELECTED_HIDDENHANDLES(cu, bezt) ) {
+					if ( BEZSELECTED_HIDDENHANDLES(cu, prevbezt) && BEZSELECTED_HIDDENHANDLES(cu, bezt) ) {
 						float prevvec[3][3];
 
 						memcpy(prevvec, prevbezt->vec, sizeof(float) * 9);
@@ -2838,7 +2869,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
 							interp_v3_v3v3(beztn->vec[1], vec+9, vec+12, factor);
 							copy_v3_v3(beztn->vec[2], vec+12);
 							/* handle of next bezt */
-							if(a==0 && i == number_cuts - 1 && (nu->flagu & CU_NURB_CYCLIC)) {copy_v3_v3(beztnew->vec[0], vec+6);}
+							if (a==0 && i == number_cuts - 1 && (nu->flagu & CU_NURB_CYCLIC)) {copy_v3_v3(beztnew->vec[0], vec+6);}
 							else {copy_v3_v3(bezt->vec[0], vec+6);}
 
 							beztn->radius = (prevbezt->radius + bezt->radius)/2;
@@ -2853,7 +2884,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
 					bezt++;
 				}
 				/* last point */
-				if((nu->flagu & CU_NURB_CYCLIC)==0) {
+				if ((nu->flagu & CU_NURB_CYCLIC)==0) {
 					memcpy(beztn, prevbezt, sizeof(BezTriple));
 					keyIndex_updateBezt(editnurb, prevbezt, beztn, 1);
 				}
@@ -2864,16 +2895,16 @@ static void subdividenurb(Object *obedit, int number_cuts)
 
 				calchandlesNurb(nu);
 			}
-		} /* End of 'if(nu->type == CU_BEZIER)' */
+		} /* End of 'if (nu->type == CU_BEZIER)' */
 		else if (nu->pntsv==1) {
 		/* 
-		   All flat lines (ie. co-planar), except flat Nurbs. Flat NURB curves 
-		   are handled together with the regular NURB plane division, as it 
-		   should be. I split it off just now, let's see if it is
-		   stable... nzc 30-5-'00
+		 * All flat lines (ie. co-planar), except flat Nurbs. Flat NURB curves 
+		 * are handled together with the regular NURB plane division, as it 
+		 * should be. I split it off just now, let's see if it is
+		 * stable... nzc 30-5-'00
 		 */
 			/* count */
-			if(nu->flagu & CU_NURB_CYCLIC) {
+			if (nu->flagu & CU_NURB_CYCLIC) {
 				a= nu->pntsu;
 				bp= nu->bp;
 				prevbp= bp+(a-1);
@@ -2883,19 +2914,19 @@ static void subdividenurb(Object *obedit, int number_cuts)
 				prevbp= nu->bp;
 				bp= prevbp+1;
 			}
-			while(a--) {
-				if( (bp->f1 & SELECT) && (prevbp->f1 & SELECT) ) amount+=number_cuts;
+			while (a--) {
+				if ( (bp->f1 & SELECT) && (prevbp->f1 & SELECT) ) amount+=number_cuts;
 				prevbp= bp;
 				bp++;
 			}
 
-			if(amount) {
+			if (amount) {
 				/* insert */
 				bpnew =
 					(BPoint*)MEM_mallocN((amount + nu->pntsu) * sizeof(BPoint), "subdivNurb2");
 				bpn= bpnew;
 
-				if(nu->flagu & CU_NURB_CYCLIC) {
+				if (nu->flagu & CU_NURB_CYCLIC) {
 					a= nu->pntsu;
 					bp= nu->bp;
 					prevbp= bp+(a-1);
@@ -2905,12 +2936,12 @@ static void subdividenurb(Object *obedit, int number_cuts)
 					prevbp= nu->bp;
 					bp= prevbp+1;
 				}
-				while(a--) {
+				while (a--) {
 					memcpy(bpn, prevbp, sizeof(BPoint));
 					keyIndex_updateBP(editnurb, prevbp, bpn, 1);
 					bpn++;
 
-					if( (bp->f1 & SELECT) && (prevbp->f1 & SELECT) ) {
+					if ( (bp->f1 & SELECT) && (prevbp->f1 & SELECT) ) {
 				 // printf("*** subdivideNurb: insert 'linear' point\n");
 						for (i = 0; i < number_cuts; i++) {
 							factor = (float)(i + 1) / (number_cuts + 1);
@@ -2924,7 +2955,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
 					prevbp= bp;
 					bp++;
 				}
-				if((nu->flagu & CU_NURB_CYCLIC)==0) { /* last point */
+				if ((nu->flagu & CU_NURB_CYCLIC)==0) { /* last point */
 					memcpy(bpn, prevbp, sizeof(BPoint));
 					keyIndex_updateBP(editnurb, prevbp, bpn, 1);
 				}
@@ -2933,54 +2964,54 @@ static void subdividenurb(Object *obedit, int number_cuts)
 				nu->bp= bpnew;
 				nu->pntsu+= amount;
 
-				if(nu->type & CU_NURBS) {
+				if (nu->type & CU_NURBS) {
 					nurbs_knot_calc_u(nu);
 				}
 			}
-		} /* End of 'else if(nu->pntsv==1)' */
-		else if(nu->type == CU_NURBS) {
+		} /* End of 'else if (nu->pntsv==1)' */
+		else if (nu->type == CU_NURBS) {
 		/* This is a very strange test ... */
 		/** 
-		   Subdivide NURB surfaces - nzc 30-5-'00 -
-
-			 Subdivision of a NURB curve can be effected by adding a 
-		   control point (insertion of a knot), or by raising the
-		   degree of the functions used to build the NURB. The
-		   expression 
-
-			   degree = #knots - #controlpoints + 1 (J Walter piece)
-			   degree = #knots - #controlpoints     (Blender
-													  implementation)
-				 ( this is confusing.... what is true? Another concern
-				 is that the JW piece allows the curve to become
-				 explicitly 1st order derivative discontinuous, while
-				 this is not what we want here... )
-
-		   is an invariant for a single NURB curve. Raising the degree
-		   of the NURB is done elsewhere; the degree is assumed
-		   constant during this opration. Degree is a property shared
-		   by all controlpoints in a curve (even though it is stored
-		   per control point - this can be misleading).
-			 Adding a knot is done by searching for the place in the
-		   knot vector where a certain knot value must be inserted, or
-		   by picking an appropriate knot value between two existing
-		   ones. The number of controlpoints that is influenced by the
-		   insertion depends on the order of the curve. A certain
-		   minimum number of knots is needed to form high-order
-		   curves, as can be seen from the equation above. In Blender,
-		   currently NURBs may be up to 6th order, so we modify at
-		   most 6 points. One point is added. For an n-degree curve,
-		   n points are discarded, and n+1 points inserted
-		   (so effectively, n points are modified).  (that holds for
-		   the JW piece, but it seems not for our NURBs)
-			  In practice, the knot spacing is copied, but the tail
-		   (the points following the insertion point) need to be
-		   offset to keep the knot series ascending. The knot series
-		   is always a series of monotonically ascending integers in
-		   Blender. When not enough control points are available to
-		   fit the order, duplicates of the endpoints are added as
-		   needed. 
-		*/
+		 * Subdivide NURB surfaces - nzc 30-5-'00 -
+		 *
+		 * Subdivision of a NURB curve can be effected by adding a 
+		 * control point (insertion of a knot), or by raising the
+		 * degree of the functions used to build the NURB. The
+		 * expression 
+		 *
+		 *     degree = #knots - #controlpoints + 1 (J Walter piece)
+		 *     degree = #knots - #controlpoints     (Blender
+		 *                                           implementation)
+		 *       ( this is confusing.... what is true? Another concern
+		 *       is that the JW piece allows the curve to become
+		 *       explicitly 1st order derivative discontinuous, while
+		 *       this is not what we want here... )
+		 *
+		 * is an invariant for a single NURB curve. Raising the degree
+		 * of the NURB is done elsewhere; the degree is assumed
+		 * constant during this operation. Degree is a property shared
+		 * by all controlpoints in a curve (even though it is stored
+		 * per control point - this can be misleading).
+		 * Adding a knot is done by searching for the place in the
+		 * knot vector where a certain knot value must be inserted, or
+		 * by picking an appropriate knot value between two existing
+		 * ones. The number of controlpoints that is influenced by the
+		 * insertion depends on the order of the curve. A certain
+		 * minimum number of knots is needed to form high-order
+		 * curves, as can be seen from the equation above. In Blender,
+		 * currently NURBs may be up to 6th order, so we modify at
+		 * most 6 points. One point is added. For an n-degree curve,
+		 * n points are discarded, and n+1 points inserted
+		 * (so effectively, n points are modified).  (that holds for
+		 * the JW piece, but it seems not for our NURBs)
+		 * In practice, the knot spacing is copied, but the tail
+		 * (the points following the insertion point) need to be
+		 * offset to keep the knot series ascending. The knot series
+		 * is always a series of monotonically ascending integers in
+		 * Blender. When not enough control points are available to
+		 * fit the order, duplicates of the endpoints are added as
+		 * needed. 
+		 */
 			/* selection-arrays */
 			usel= MEM_callocN(sizeof(int)*nu->pntsu, "subivideNurb3");
 			vsel= MEM_callocN(sizeof(int)*nu->pntsv, "subivideNurb3");
@@ -2988,9 +3019,9 @@ static void subdividenurb(Object *obedit, int number_cuts)
 
 		 /* Count the number of selected points. */
 			bp= nu->bp;
-			for(a=0; a<nu->pntsv; a++) {
-				for(b=0; b<nu->pntsu; b++) {
-					if(bp->f1 & SELECT) {
+			for (a=0; a<nu->pntsv; a++) {
+				for (b=0; b<nu->pntsu; b++) {
+					if (bp->f1 & SELECT) {
 						usel[b]++;
 						vsel[a]++;
 						sel++;
@@ -2998,9 +3029,9 @@ static void subdividenurb(Object *obedit, int number_cuts)
 					bp++;
 				}
 			}
-			if( sel == (nu->pntsu*nu->pntsv) ) {	/* subdivide entire nurb */
-		   /* Global subdivision is a special case of partial
-			  subdivision. Strange it is considered separately... */
+			if ( sel == (nu->pntsu*nu->pntsv) ) {  /* subdivide entire nurb */
+				/* Global subdivision is a special case of partial
+				 * subdivision. Strange it is considered separately... */
 
 				/* count of nodes (after subdivision) along U axis */
 				int countu= nu->pntsu + (nu->pntsu - 1) * number_cuts;
@@ -3011,13 +3042,13 @@ static void subdividenurb(Object *obedit, int number_cuts)
 				bpn=bpnew= MEM_mallocN( tot*sizeof(BPoint), "subdivideNurb4");
 				bp= nu->bp;
 				/* first subdivide rows */
-				for(a=0; a<nu->pntsv; a++) {
-					for(b=0; b<nu->pntsu; b++) {
+				for (a=0; a<nu->pntsv; a++) {
+					for (b=0; b<nu->pntsu; b++) {
 						*bpn= *bp;
 						keyIndex_updateBP(editnurb, bp, bpn, 1);
 						bpn++; 
 						bp++;
-						if(b<nu->pntsu-1) {
+						if (b<nu->pntsu-1) {
 							prevbp= bp-1;
 							for (i = 0; i < number_cuts; i++) {
 								factor = (float)(i + 1) / (number_cuts + 1);
@@ -3033,9 +3064,9 @@ static void subdividenurb(Object *obedit, int number_cuts)
 				bpn= bpnew+((number_cuts+1)*nu->pntsu - number_cuts);
 				bp= bpnew+(number_cuts+1)*((number_cuts+1)*nu->pntsu-number_cuts);
 				prevbp= bpnew;
-				for(a=1; a<nu->pntsv; a++) {
+				for (a=1; a<nu->pntsv; a++) {
 
-					for(b=0; b<(number_cuts+1)*nu->pntsu-number_cuts; b++) {
+					for (b=0; b<(number_cuts+1)*nu->pntsu-number_cuts; b++) {
 						BPoint *tmp= bpn;
 						for (i = 0; i < number_cuts; i++) {
 							factor = (float)(i + 1) / (number_cuts + 1);
@@ -3057,36 +3088,36 @@ static void subdividenurb(Object *obedit, int number_cuts)
 				nu->pntsv= (number_cuts+1)*nu->pntsv-number_cuts;
 				nurbs_knot_calc_u(nu);
 				nurbs_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;
-				for(a=0; a<nu->pntsv-1; a++) {
-					if(vsel[a]==nu->pntsu && vsel[a+1]==nu->pntsu) sel+=number_cuts;
+				for (a=0; a<nu->pntsv-1; a++) {
+					if (vsel[a]==nu->pntsu && vsel[a+1]==nu->pntsu) sel+=number_cuts;
 				}
 
-				if(sel) {   /* V ! */
+				if (sel) {   /* V ! */
 					bpn=bpnew= MEM_mallocN( (sel+nu->pntsv)*nu->pntsu*sizeof(BPoint), "subdivideNurb4");
 					bp= nu->bp;
-					for(a=0; a<nu->pntsv; a++) {
-						for(b=0; b<nu->pntsu; b++) {
+					for (a=0; a<nu->pntsv; a++) {
+						for (b=0; b<nu->pntsu; b++) {
 							*bpn= *bp;
 							keyIndex_updateBP(editnurb, bp, bpn, 1);
 							bpn++;
 							bp++;
 						}
-						if( (a<nu->pntsv-1) && vsel[a]==nu->pntsu && vsel[a+1]==nu->pntsu ) {
+						if ( (a<nu->pntsv-1) && vsel[a]==nu->pntsu && vsel[a+1]==nu->pntsu ) {
 							for (i = 0; i < number_cuts; i++) {
 								factor = (float)(i + 1) / (number_cuts + 1);
 								prevbp= bp- nu->pntsu;
-								for(b=0; b<nu->pntsu; b++) {
+								for (b=0; b<nu->pntsu; b++) {
 										/*
-										  This simple bisection must be replaces by a
-										  subtle resampling of a number of points. Our
-										  task is made slightly easier because each
-										  point in our curve is a separate data
-										  node. (is it?)
-										*/
+										 * This simple bisection must be replaces by a
+										 * subtle resampling of a number of points. Our
+										 * task is made slightly easier because each
+										 * point in our curve is a separate data
+										 * node. (is it?)
+										 */
 										*bpn= *prevbp;
 										interp_v4_v4v4(bpn->vec, prevbp->vec, bp->vec, factor);
 										bpn++;
@@ -3106,29 +3137,29 @@ static void subdividenurb(Object *obedit, int number_cuts)
 				else {
 					/* or in u direction? */
 					sel= 0;
-					for(a=0; a<nu->pntsu-1; a++) {
-						if(usel[a]==nu->pntsv && usel[a+1]==nu->pntsv) sel+=number_cuts;
+					for (a=0; a<nu->pntsu-1; a++) {
+						if (usel[a]==nu->pntsv && usel[a+1]==nu->pntsv) sel+=number_cuts;
 					}
 
-					if(sel) {	/* U ! */
+					if (sel) {	/* U ! */
 				 /* Inserting U points is sort of 'default' Flat curves only get */
 				 /* U points inserted in them.                                   */
 						bpn=bpnew= MEM_mallocN( (sel+nu->pntsu)*nu->pntsv*sizeof(BPoint), "subdivideNurb4");
 						bp= nu->bp;
-						for(a=0; a<nu->pntsv; a++) {
-							for(b=0; b<nu->pntsu; b++) {
+						for (a=0; a<nu->pntsv; a++) {
+							for (b=0; b<nu->pntsu; b++) {
 								*bpn= *bp;
 								keyIndex_updateBP(editnurb, bp, bpn, 1);
 								bpn++; 
 								bp++;
-								if( (b<nu->pntsu-1) && usel[b]==nu->pntsv && usel[b+1]==nu->pntsv ) {
+								if ( (b<nu->pntsu-1) && usel[b]==nu->pntsv && usel[b+1]==nu->pntsv ) {
 									/*
-									   One thing that bugs me here is that the
-									   orders of things are not the same as in
-									   the JW piece. Also, this implies that we
-									   handle at most 3rd order curves? I miss
-									   some symmetry here...
-									*/
+									 * One thing that bugs me here is that the
+									 * orders of things are not the same as in
+									 * the JW piece. Also, this implies that we
+									 * handle at most 3rd order curves? I miss
+									 * some symmetry here...
+									 */
 									for (i = 0; i < number_cuts; i++) {
 										factor = (float)(i + 1) / (number_cuts + 1);
 									prevbp= bp- 1;
@@ -3149,7 +3180,7 @@ static void subdividenurb(Object *obedit, int number_cuts)
 			MEM_freeN(usel); 
 			MEM_freeN(vsel);
 
-		} /* End of 'if(nu->type == CU_NURBS)'  */
+		} /* End of 'if (nu->type == CU_NURBS)'  */
 	}
 }
 
@@ -3160,7 +3191,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
 
 	subdividenurb(obedit, number_cuts);
 
-	if(ED_curve_updateAnimPaths(obedit))
+	if (ED_curve_updateAnimPaths(obedit->data))
 		WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
 
 	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -3171,19 +3202,23 @@ static int subdivide_exec(bContext *C, wmOperator *op)
 
 void CURVE_OT_subdivide(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+
 	/* identifiers */
-	ot->name= "Subdivide";
-	ot->description= "Subdivide selected segments";
-	ot->idname= "CURVE_OT_subdivide";
+	ot->name = "Subdivide";
+	ot->description = "Subdivide selected segments";
+	ot->idname = "CURVE_OT_subdivide";
 	
 	/* api callbacks */
-	ot->exec= subdivide_exec;
-	ot->poll= ED_operator_editsurfcurve;
+	ot->exec = subdivide_exec;
+	ot->poll = ED_operator_editsurfcurve;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
-	RNA_def_int(ot->srna, "number_cuts", 1, 1, INT_MAX, "Number of cuts", "", 1, 10);
+	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);
 }
 
 /******************** find nearest ************************/
@@ -3197,12 +3232,15 @@ static void findnearestNurbvert__doClosest(void *userData, Nurb *nu, BPoint *bp,
 
 	if (bp) {
 		flag = bp->f1;
-	} else {
+	}
+	else {
 		if (beztindex==0) {
 			flag = bezt->f1;
-		} else if (beztindex==1) {
+		}
+		else if (beztindex==1) {
 			flag = bezt->f2;
-		} else {
+		}
+		else {
 			flag = bezt->f3;
 		}
 	}
@@ -3256,19 +3294,19 @@ static void findselectedNurbvert(ListBase *editnurb, Nurb **nu, BezTriple **bezt
 	*nu= NULL;
 	*bezt= NULL;
 	*bp= NULL;
-	for(nu1= editnurb->first; nu1; nu1= nu1->next) {
-		if(nu1->type == CU_BEZIER) {
+	for (nu1= editnurb->first; nu1; nu1= nu1->next) {
+		if (nu1->type == CU_BEZIER) {
 			bezt1= nu1->bezt;
 			a= nu1->pntsu;
-			while(a--) {
-				if( (bezt1->f1 & SELECT) || (bezt1->f2 & SELECT) || (bezt1->f3 & SELECT) ) {
-					if(*nu != NULL && *nu != nu1) {
+			while (a--) {
+				if ( (bezt1->f1 & SELECT) || (bezt1->f2 & SELECT) || (bezt1->f3 & SELECT) ) {
+					if (*nu != NULL && *nu != nu1) {
 						*nu= NULL;
 						*bp= NULL;
 						*bezt= NULL;
 						return;
 					}
-					else if(*bezt || *bp) {
+					else if (*bezt || *bp) {
 						*bp= NULL;
 						*bezt= NULL;
 					}
@@ -3283,15 +3321,15 @@ static void findselectedNurbvert(ListBase *editnurb, Nurb **nu, BezTriple **bezt
 		else {
 			bp1= nu1->bp;
 			a= nu1->pntsu*nu1->pntsv;
-			while(a--) {
-				if( bp1->f1 & 1 ) {
-					if(*nu != NULL && *nu != nu1) {
+			while (a--) {
+				if ( bp1->f1 & 1 ) {
+					if (*nu != NULL && *nu != nu1) {
 						*bp= NULL;
 						*bezt= NULL;
 						*nu= NULL;
 						return;
 					}
-					else if(*bezt || *bp) {
+					else if (*bezt || *bp) {
 						*bp= NULL;
 						*bezt= NULL;
 					}
@@ -3314,15 +3352,15 @@ static int convertspline(short type, Nurb *nu)
 	BPoint *bp;
 	int a, c, nr;
 
-	if(nu->type == CU_POLY) {
-		if(type==CU_BEZIER) {			    /* to Bezier with vecthandles  */
+	if (nu->type == CU_POLY) {
+		if (type==CU_BEZIER) {			    /* to Bezier with vecthandles  */
 			nr= nu->pntsu;
 			bezt =
 				(BezTriple*)MEM_callocN(nr * sizeof(BezTriple), "setsplinetype2");
 			nu->bezt= bezt;
 			a= nr;
 			bp= nu->bp;
-			while(a--) {
+			while (a--) {
 				copy_v3_v3(bezt->vec[1], bp->vec);
 				bezt->f1=bezt->f2=bezt->f3= bp->f1;
 				bezt->h1= bezt->h2= HD_VECT;
@@ -3337,28 +3375,28 @@ static int convertspline(short type, Nurb *nu)
 			nu->type = CU_BEZIER;
 			calchandlesNurb(nu);
 		}
-		else if(type==CU_NURBS) {
+		else if (type==CU_NURBS) {
 			nu->type = CU_NURBS;
 			nu->orderu= 4;
 			nu->flagu &= CU_NURB_CYCLIC; /* disable all flags except for cyclic */
 			nurbs_knot_calc_u(nu);
 			a= nu->pntsu*nu->pntsv;
 			bp= nu->bp;
-			while(a--) {
+			while (a--) {
 				bp->vec[3]= 1.0;
 				bp++;
 			}
 		}
 	}
-	else if(nu->type == CU_BEZIER) {	/* Bezier */
-		if(type==CU_POLY || type==CU_NURBS) {
+	else if (nu->type == CU_BEZIER) {	/* Bezier */
+		if (type==CU_POLY || type==CU_NURBS) {
 			nr= 3*nu->pntsu;
 			nu->bp = MEM_callocN(nr * sizeof(BPoint), "setsplinetype");
 			a= nu->pntsu;
 			bezt= nu->bezt;
 			bp= nu->bp;
-			while(a--) {
-				if(type==CU_POLY && bezt->h1==HD_VECT && bezt->h2==HD_VECT) {
+			while (a--) {
+				if (type==CU_POLY && bezt->h1==HD_VECT && bezt->h2==HD_VECT) {
 					/* vector handle becomes 1 poly vertice */
 					copy_v3_v3(bp->vec, bezt->vec[1]);
 					bp->vec[3]= 1.0;
@@ -3369,11 +3407,11 @@ static int convertspline(short type, Nurb *nu)
 					bp++;
 				}
 				else {
-					for(c=0;c<3;c++) {
+					for (c=0;c<3;c++) {
 						copy_v3_v3(bp->vec, bezt->vec[c]);
 						bp->vec[3]= 1.0;
-						if(c==0) bp->f1= bezt->f1;
-						else if(c==1) bp->f1= bezt->f2;
+						if (c==0) bp->f1= bezt->f1;
+						else if (c==1) bp->f1= bezt->f2;
 						else bp->f1= bezt->f3;
 						bp->radius= bezt->radius;
 						bp->weight= bezt->weight;
@@ -3391,36 +3429,36 @@ static int convertspline(short type, Nurb *nu)
 			nu->type = type;
 
 #if 0		/* UNUSED */
-			if(nu->flagu & CU_NURB_CYCLIC) c= nu->orderu-1; 
+			if (nu->flagu & CU_NURB_CYCLIC) c= nu->orderu-1; 
 			else c= 0;
 #endif
 
-			if(type== CU_NURBS) {
+			if (type== CU_NURBS) {
 				nu->flagu &= CU_NURB_CYCLIC; /* disable all flags except for cyclic */
 				nu->flagu |= CU_NURB_BEZIER;
 				nurbs_knot_calc_u(nu);
 			}
 		}
 	}
-	else if(nu->type == CU_NURBS) {
-		if(type==CU_POLY) {
+	else if (nu->type == CU_NURBS) {
+		if (type==CU_POLY) {
 			nu->type = CU_POLY;
-			if(nu->knotsu) MEM_freeN(nu->knotsu); /* python created nurbs have a knotsu of zero */
+			if (nu->knotsu) MEM_freeN(nu->knotsu); /* python created nurbs have a knotsu of zero */
 			nu->knotsu= NULL;
-			if(nu->knotsv) MEM_freeN(nu->knotsv);
+			if (nu->knotsv) MEM_freeN(nu->knotsv);
 			nu->knotsv= NULL;
 		}
-		else if(type==CU_BEZIER) {		/* to Bezier */
+		else if (type==CU_BEZIER) {		/* to Bezier */
 			nr= nu->pntsu/3;
 
-			if(nr<2) 
+			if (nr<2) 
 				return 1;	/* conversion impossible */
 			else {
 				bezt = MEM_callocN(nr * sizeof(BezTriple), "setsplinetype2");
 				nu->bezt= bezt;
 				a= nr;
 				bp= nu->bp;
-				while(a--) {
+				while (a--) {
 					copy_v3_v3(bezt->vec[0], bp->vec);
 					bezt->f1= bp->f1;
 					bp++;
@@ -3459,22 +3497,22 @@ static int set_spline_type_exec(bContext *C, wmOperator *op)
 	Nurb *nu;
 	int changed=0, type= RNA_enum_get(op->ptr, "type");
 
-	if(type==CU_CARDINAL || type==CU_BSPLINE) {
+	if (type==CU_CARDINAL || type==CU_BSPLINE) {
 		BKE_report(op->reports, RPT_ERROR, "Not implemented yet");
 		return OPERATOR_CANCELLED;
 	}
 	
-	for(nu= editnurb->first; nu; nu= nu->next) {
-		if(isNurbsel(nu)) {
-			if(convertspline(type, nu))
+	for (nu= editnurb->first; nu; nu= nu->next) {
+		if (isNurbsel(nu)) {
+			if (convertspline(type, nu))
 				BKE_report(op->reports, RPT_ERROR, "No conversion possible");
 			else
 				changed= 1;
 		}
 	}
 
-	if(changed) {
-		if(ED_curve_updateAnimPaths(obedit))
+	if (changed) {
+		if (ED_curve_updateAnimPaths(obedit->data))
 			WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
 
 		DAG_id_tag_update(obedit->data, 0);
@@ -3498,20 +3536,20 @@ void CURVE_OT_spline_type_set(wmOperatorType *ot)
 		{0, NULL, 0, NULL, NULL}};
 
 	/* identifiers */
-	ot->name= "Set Spline Type";
+	ot->name = "Set Spline Type";
 	ot->description = "Set type of active spline";
-	ot->idname= "CURVE_OT_spline_type_set";
+	ot->idname = "CURVE_OT_spline_type_set";
 	
 	/* api callbacks */
-	ot->exec= set_spline_type_exec;
-	ot->invoke= WM_menu_invoke;
-	ot->poll= ED_operator_editcurve;
+	ot->exec = set_spline_type_exec;
+	ot->invoke = WM_menu_invoke;
+	ot->poll = ED_operator_editcurve;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
-	ot->prop= RNA_def_enum(ot->srna, "type", type_items, CU_POLY, "Type", "Spline type");
+	ot->prop = RNA_def_enum(ot->srna, "type", type_items, CU_POLY, "Type", "Spline type");
 }
 
 /***************** set handle type operator *******************/
@@ -3541,20 +3579,20 @@ void CURVE_OT_handle_type_set(wmOperatorType *ot)
 		{0, NULL, 0, NULL, NULL}};
 
 	/* identifiers */
-	ot->name= "Set Handle Type";
+	ot->name = "Set Handle Type";
 	ot->description = "Set type of handles for selected control points";
-	ot->idname= "CURVE_OT_handle_type_set";
+	ot->idname = "CURVE_OT_handle_type_set";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= set_handle_type_exec;
-	ot->poll= ED_operator_editcurve;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = set_handle_type_exec;
+	ot->poll = ED_operator_editcurve;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
-	ot->prop= RNA_def_enum(ot->srna, "type", editcurve_handle_type_items, 1, "Type", "Spline type");
+	ot->prop = RNA_def_enum(ot->srna, "type", editcurve_handle_type_items, 1, "Type", "Spline type");
 }
 
 /***************** make segment operator **********************/
@@ -3566,14 +3604,14 @@ static void switchdirection_knots(float *base, int tot)
 	float *fp1, *fp2, *tempf;
 	int a;
 	
-	if(base==NULL || tot==0) return;
+	if (base==NULL || tot==0) return;
 	
 	/* reverse knots */
 	a= tot;
 	fp1= base;
 	fp2= fp1+(a-1);
 	a/= 2;
-	while(fp1!=fp2 && a>0) {
+	while (fp1!=fp2 && a>0) {
 		SWAP(float, *fp1, *fp2);
 		a--;
 		fp1++; 
@@ -3583,7 +3621,7 @@ static void switchdirection_knots(float *base, int tot)
 	a= tot;
 	fp1= base;
 	fp2=tempf= MEM_mallocN(sizeof(float)*a, "switchdirect");
-	while(a--) {
+	while (a--) {
 		fp2[0]= fabs(fp1[1]-fp1[0]);
 		fp1++;
 		fp2++;
@@ -3594,7 +3632,7 @@ static void switchdirection_knots(float *base, int tot)
 	fp2= tempf;
 	fp1[0]= 0.0;
 	fp1++;
-	while(a--) {
+	while (a--) {
 		fp1[0]= fp1[-1]+fp2[0];
 		fp1++;
 		fp2++;
@@ -3617,8 +3655,8 @@ static void rotate_direction_nurb(Nurb *nu)
 	
 	temp= MEM_dupallocN(nu->bp);
 	bp1= nu->bp;
-	for(v=0; v<nu->pntsv; v++) {
-		for(u=0; u<nu->pntsu; u++, bp1++) {
+	for (v=0; v<nu->pntsv; v++) {
+		for (u=0; u<nu->pntsu; u++, bp1++) {
 			bp2= temp + (nu->pntsu-u-1)*(nu->pntsv) + v;
 			*bp1= *bp2;
 		}
@@ -3634,8 +3672,8 @@ 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;
+	for (v=0; v<nu->pntsv-1; v++, bp+=nu->pntsu) {
+		if (v) if (bp->f1 & SELECT) return 1;
 	}
 	
 	return 0;
@@ -3659,8 +3697,8 @@ static void make_selection_list_nurb(ListBase *editnurb)
 	float dist, headdist, taildist;
 	int a;
 	
-	for(nu= editnurb->first; nu; nu= nu->next) {
-		if( isNurbsel(nu) ) {
+	for (nu= editnurb->first; nu; nu= nu->next) {
+		if ( isNurbsel(nu) ) {
 			
 			nus = (NurbSort*)MEM_callocN(sizeof(NurbSort), "sort");
 			BLI_addhead(&nbase, nus);
@@ -3668,7 +3706,7 @@ static void make_selection_list_nurb(ListBase *editnurb)
 			
 			bp= nu->bp;
 			a= nu->pntsu;
-			while(a--) {
+			while (a--) {
 				add_v3_v3(nus->vec, bp->vec);
 				bp++;
 			}
@@ -3684,29 +3722,29 @@ static void make_selection_list_nurb(ListBase *editnurb)
 	BLI_addtail( &nsortbase, nus);
 	
 	/* now add, either at head or tail, the closest one */
-	while(nbase.first) {
+	while (nbase.first) {
 	
 		headdist= taildist= 1.0e30;
 		headdo= taildo= NULL;
 
 		nustest= nbase.first;
-		while(nustest) {
+		while (nustest) {
 			dist= len_v3v3(nustest->vec, ((NurbSort *)nsortbase.first)->vec);
 
-			if(dist<headdist) {
+			if (dist<headdist) {
 				headdist= dist;
 				headdo= nustest;
 			}
 			dist= len_v3v3(nustest->vec, ((NurbSort *)nsortbase.last)->vec);
 
-			if(dist<taildist) {
+			if (dist<taildist) {
 				taildist= dist;
 				taildo= nustest;
 			}
 			nustest= nustest->next;
 		}
 		
-		if(headdist<taildist) {
+		if (headdist<taildist) {
 			BLI_remlink(&nbase, headdo);
 			BLI_addhead(&nsortbase, headdo);
 		}
@@ -3728,23 +3766,23 @@ static void merge_2_nurb(wmOperator *op, ListBase *editnurb, Nurb *nu1, Nurb *nu
 
 	/* first nurbs: u = resolu-1 selected */
 	
-	if( is_u_selected(nu1, nu1->pntsu-1) );
+	if ( is_u_selected(nu1, nu1->pntsu-1) );
 	else {
 		/* For 2D curves blender uses orderv=0. It doesn't make any sense mathematically. */
 		/* but after rotating orderu=0 will be confusing. */
 		if (nu1->orderv == 0) nu1->orderv= 1;
 
 		rotate_direction_nurb(nu1);
-		if( is_u_selected(nu1, nu1->pntsu-1) );
+		if ( is_u_selected(nu1, nu1->pntsu-1) );
 		else {
 			rotate_direction_nurb(nu1);
-			if( is_u_selected(nu1, nu1->pntsu-1) );
+			if ( is_u_selected(nu1, nu1->pntsu-1) );
 			else {
 				rotate_direction_nurb(nu1);
-				if( is_u_selected(nu1, nu1->pntsu-1) );
+				if ( is_u_selected(nu1, nu1->pntsu-1) );
 				else {
 					/* rotate again, now its OK! */
-					if(nu1->pntsv!=1) rotate_direction_nurb(nu1);
+					if (nu1->pntsv!=1) rotate_direction_nurb(nu1);
 					return;
 				}
 			}
@@ -3752,40 +3790,40 @@ static void merge_2_nurb(wmOperator *op, ListBase *editnurb, Nurb *nu1, Nurb *nu
 	}
 	
 	/* 2nd nurbs: u = 0 selected */
-	if( is_u_selected(nu2, 0) );
+	if ( is_u_selected(nu2, 0) );
 	else {
 		if (nu2->orderv == 0) nu2->orderv= 1;
 		rotate_direction_nurb(nu2);
-		if( is_u_selected(nu2, 0) );
+		if ( is_u_selected(nu2, 0) );
 		else {
 			rotate_direction_nurb(nu2);
-			if( is_u_selected(nu2, 0) );
+			if ( is_u_selected(nu2, 0) );
 			else {
 				rotate_direction_nurb(nu2);
-				if( is_u_selected(nu2, 0) );
+				if ( is_u_selected(nu2, 0) );
 				else {
 					/* rotate again, now its OK! */
-					if(nu1->pntsu==1) rotate_direction_nurb(nu1);
-					if(nu2->pntsv!=1) rotate_direction_nurb(nu2);
+					if (nu1->pntsu==1) rotate_direction_nurb(nu1);
+					if (nu2->pntsv!=1) rotate_direction_nurb(nu2);
 					return;
 				}
 			}
 		}
 	}
 	
-	if( nu1->pntsv != nu2->pntsv ) {
+	if ( nu1->pntsv != nu2->pntsv ) {
 		BKE_report(op->reports, RPT_ERROR, "Resolution doesn't match");
 		return;
 	}
 	
-	/* ok, now nu1 has the rightmost collumn and nu2 the leftmost collumn selected */
+	/* ok, now nu1 has the rightmost column and nu2 the leftmost column selected */
 	/* maybe we need a 'v' flip of nu2? */
 	
 	bp1= nu1->bp+nu1->pntsu-1;
 	bp2= nu2->bp;
 	len1= 0.0;
 	
-	for(v=0; v<nu1->pntsv; v++, bp1+=nu1->pntsu, bp2+=nu2->pntsu) {
+	for (v=0; v<nu1->pntsv; v++, bp1+=nu1->pntsu, bp2+=nu2->pntsu) {
 		len1+= len_v3v3(bp1->vec, bp2->vec);
 	}
 
@@ -3793,29 +3831,29 @@ static void merge_2_nurb(wmOperator *op, ListBase *editnurb, Nurb *nu1, Nurb *nu
 	bp2= nu2->bp + nu2->pntsu*(nu2->pntsv-1);
 	len2= 0.0;
 	
-	for(v=0; v<nu1->pntsv; v++, bp1+=nu1->pntsu, bp2-=nu2->pntsu) {
+	for (v=0; v<nu1->pntsv; v++, bp1+=nu1->pntsu, bp2-=nu2->pntsu) {
 		len2+= len_v3v3(bp1->vec, bp2->vec);
 	}
 
 	/* merge */
 	origu= nu1->pntsu;
 	nu1->pntsu+= nu2->pntsu;
-	if(nu1->orderu<3 && nu1->orderu<nu1->pntsu) nu1->orderu++;
-	if(nu1->orderv<3 && nu1->orderv<nu1->pntsv) nu1->orderv++;
+	if (nu1->orderu<3 && nu1->orderu<nu1->pntsu) nu1->orderu++;
+	if (nu1->orderv<3 && nu1->orderv<nu1->pntsv) nu1->orderv++;
 	temp= nu1->bp;
 	nu1->bp= MEM_mallocN(nu1->pntsu*nu1->pntsv*sizeof(BPoint), "mergeBP");
 	
 	bp= nu1->bp;
 	bp1= temp;
 	
-	for(v=0; v<nu1->pntsv; v++) {
+	for (v=0; v<nu1->pntsv; v++) {
 		
 		/* switch direction? */
-		if(len1<len2) bp2= nu2->bp + v*nu2->pntsu;
+		if (len1<len2) bp2= nu2->bp + v*nu2->pntsu;
 		else bp2= nu2->bp + (nu1->pntsv-v-1)*nu2->pntsu;
 
-		for(u=0; u<nu1->pntsu; u++, bp++) {
-			if(u<origu) {
+		for (u=0; u<nu1->pntsu; u++, bp++) {
+			if (u<origu) {
 				*bp= *bp1; bp1++;
 				select_bpoint(bp, SELECT, 1, HIDDEN);
 			}
@@ -3825,7 +3863,7 @@ static void merge_2_nurb(wmOperator *op, ListBase *editnurb, Nurb *nu1, Nurb *nu
 		}
 	}
 
-	if(nu1->type == CU_NURBS) {
+	if (nu1->type == CU_NURBS) {
 		/* merge knots */
 		nurbs_knot_calc_u(nu1);
 	
@@ -3847,7 +3885,7 @@ static int merge_nurb(bContext *C, wmOperator *op)
 	
 	make_selection_list_nurb(editnurb);
 	
-	if(nsortbase.first == nsortbase.last) {
+	if (nsortbase.first == nsortbase.last) {
 		BLI_freelistN(&nsortbase);
 		BKE_report(op->reports, RPT_ERROR, "Too few selections to merge");
 		return OPERATOR_CANCELLED;
@@ -3857,27 +3895,27 @@ static int merge_nurb(bContext *C, wmOperator *op)
 	nus2= nus1->next;
 
 	/* resolution match, to avoid uv rotations */
-	if(nus1->nu->pntsv==1) {
-		if(nus1->nu->pntsu==nus2->nu->pntsu || nus1->nu->pntsu==nus2->nu->pntsv);
+	if (nus1->nu->pntsv==1) {
+		if (nus1->nu->pntsu==nus2->nu->pntsu || nus1->nu->pntsu==nus2->nu->pntsv);
 		else ok= 0;
 	}
-	else if(nus2->nu->pntsv==1) {
-		if(nus2->nu->pntsu==nus1->nu->pntsu || nus2->nu->pntsu==nus1->nu->pntsv);
+	else if (nus2->nu->pntsv==1) {
+		if (nus2->nu->pntsu==nus1->nu->pntsu || nus2->nu->pntsu==nus1->nu->pntsv);
 		else ok= 0;
 	}
-	else if( nus1->nu->pntsu==nus2->nu->pntsu || nus1->nu->pntsv==nus2->nu->pntsv);
-	else if( nus1->nu->pntsu==nus2->nu->pntsv || nus1->nu->pntsv==nus2->nu->pntsu);
+	else if ( nus1->nu->pntsu==nus2->nu->pntsu || nus1->nu->pntsv==nus2->nu->pntsv);
+	else if ( nus1->nu->pntsu==nus2->nu->pntsv || nus1->nu->pntsv==nus2->nu->pntsu);
 	else {
 		ok= 0;
 	}
 	
-	if(ok==0) {
+	if (ok==0) {
 		BKE_report(op->reports, RPT_ERROR, "Resolution doesn't match");
 		BLI_freelistN(&nsortbase);
 		return OPERATOR_CANCELLED;
 	}
 
-	while(nus2) {
+	while (nus2) {
 		merge_2_nurb(op, editnurb, nus1->nu, nus2->nu);
 		nus2= nus2->next;
 	}
@@ -3904,18 +3942,18 @@ static int make_segment_exec(bContext *C, wmOperator *op)
 	int a, ok= 0;
 
 	/* first decide if this is a surface merge! */
-	if(obedit->type==OB_SURF) nu= nubase->first;
+	if (obedit->type==OB_SURF) nu= nubase->first;
 	else nu= NULL;
 	
-	while(nu) {
-		if( isNurbsel(nu) ) {
+	while (nu) {
+		if ( isNurbsel(nu) ) {
 		
-			if(nu->pntsu>1 && nu->pntsv>1) break;
-			if(isNurbsel_count(cu, nu)>1) break;
-			if(isNurbsel_count(cu, nu)==1) {
+			if (nu->pntsu>1 && nu->pntsv>1) break;
+			if (isNurbsel_count(cu, nu)>1) break;
+			if (isNurbsel_count(cu, nu)==1) {
 				/* only 1 selected, not first or last, a little complex, but intuitive */
-				if(nu->pntsv==1) {
-					if( (nu->bp->f1 & SELECT) || ((nu->bp+nu->pntsu-1)->f1 & SELECT));
+				if (nu->pntsv==1) {
+					if ( (nu->bp->f1 & SELECT) || ((nu->bp+nu->pntsu-1)->f1 & SELECT));
 					else break;
 				}
 			}
@@ -3923,62 +3961,62 @@ static int make_segment_exec(bContext *C, wmOperator *op)
 		nu= nu->next;
 	}
 
-	if(nu)
+	if (nu)
 		return merge_nurb(C, op);
 	
 	/* find both nurbs and points, nu1 will be put behind nu2 */
-	for(nu= nubase->first; nu; nu= nu->next) {
-		if(nu->pntsu == 1)
+	for (nu= nubase->first; nu; nu= nu->next) {
+		if (nu->pntsu == 1)
 			nu->flagu&= ~CU_NURB_CYCLIC;
 
-		if((nu->flagu & CU_NURB_CYCLIC)==0) {    /* not cyclic */
-			if(nu->type == CU_BEZIER) {
-				if(nu1==NULL) {
-					if( BEZSELECTED_HIDDENHANDLES(cu, nu->bezt) ) nu1= nu;
+		if ((nu->flagu & CU_NURB_CYCLIC)==0) {    /* not cyclic */
+			if (nu->type == CU_BEZIER) {
+				if (nu1==NULL) {
+					if ( BEZSELECTED_HIDDENHANDLES(cu, nu->bezt) ) nu1= nu;
 					else {
-						if( BEZSELECTED_HIDDENHANDLES(cu, &(nu->bezt[nu->pntsu-1])) ) {
+						if ( BEZSELECTED_HIDDENHANDLES(cu, &(nu->bezt[nu->pntsu-1])) ) {
 							nu1= nu;
 							switchdirectionNurb(nu);
 							keyData_switchDirectionNurb(cu, nu);
 						}
 					}
 				}
-				else if(nu2==NULL) {
-					if( BEZSELECTED_HIDDENHANDLES(cu, nu->bezt) ) {
+				else if (nu2==NULL) {
+					if ( BEZSELECTED_HIDDENHANDLES(cu, nu->bezt) ) {
 						nu2= nu;
 						switchdirectionNurb(nu);
 						keyData_switchDirectionNurb(cu, nu);
 					}
 					else {
-						if( BEZSELECTED_HIDDENHANDLES(cu, &(nu->bezt[nu->pntsu-1])) ) {
+						if ( BEZSELECTED_HIDDENHANDLES(cu, &(nu->bezt[nu->pntsu-1])) ) {
 							nu2= nu;
 						}
 					}
 				}
 				else break;
 			}
-			else if(nu->pntsv==1) {
+			else if (nu->pntsv==1) {
 				bp= nu->bp;
-				if(nu1==NULL) {
-					if( bp->f1 & SELECT) nu1= nu;
+				if (nu1==NULL) {
+					if ( bp->f1 & SELECT) nu1= nu;
 					else {
 						bp= bp+(nu->pntsu-1);
-						if( bp->f1 & SELECT ) {
+						if ( bp->f1 & SELECT ) {
 							nu1= nu;
 							switchdirectionNurb(nu);
 							keyData_switchDirectionNurb(cu, nu);
 						}
 					}
 				}
-				else if(nu2==NULL) {
-					if( bp->f1 & SELECT ) {
+				else if (nu2==NULL) {
+					if ( bp->f1 & SELECT ) {
 						nu2= nu;
 						switchdirectionNurb(nu);
 						keyData_switchDirectionNurb(cu, nu);
 					}
 					else {
 						bp= bp+(nu->pntsu-1);
-						if( bp->f1 & SELECT ) {
+						if ( bp->f1 & SELECT ) {
 							nu2= nu;
 						}
 					}
@@ -3988,9 +4026,9 @@ static int make_segment_exec(bContext *C, wmOperator *op)
 		}
 	}
 
-	if((nu1 && nu2) && (nu1!=nu2)) {
-		if( nu1->type==nu2->type) {
-			if(nu1->type == CU_BEZIER) {
+	if ((nu1 && nu2) && (nu1!=nu2)) {
+		if ( nu1->type==nu2->type) {
+			if (nu1->type == CU_BEZIER) {
 				BezTriple *bezt =
 					(BezTriple*)MEM_mallocN((nu1->pntsu+nu2->pntsu) * sizeof(BezTriple), "addsegmentN");
 				ED_curve_beztcpy(cu->editnurb, bezt, nu2->bezt, nu2->pntsu);
@@ -4017,8 +4055,8 @@ static int make_segment_exec(bContext *C, wmOperator *op)
 				BLI_remlink(nubase, nu2);
 
 				/* now join the knots */
-				if(nu1->type == CU_NURBS) {
-					if(nu1->knotsu==NULL) {
+				if (nu1->type == CU_NURBS) {
+					if (nu1->knotsu==NULL) {
 						nurbs_knot_calc_u(nu1);
 					}
 					else {
@@ -4030,8 +4068,8 @@ static int make_segment_exec(bContext *C, wmOperator *op)
 						
 						offset= nu1->knotsu[a-1] + 1.0f;
 						fp= nu1->knotsu+a;
-						for(a=0; a<nu2->pntsu; a++, fp++) {
-							if(nu2->knotsu) 
+						for (a=0; a<nu2->pntsu; a++, fp++) {
+							if (nu2->knotsu) 
 								*fp= offset+nu2->knotsu[a+1];
 							else 
 								*fp = offset;
@@ -4044,14 +4082,16 @@ static int make_segment_exec(bContext *C, wmOperator *op)
 			set_actNurb(obedit, nu1);	/* for selected */
 			ok= 1;
 		}
-	} else if(nu1 && !nu2) {
-		if(!(nu1->flagu & CU_NURB_CYCLIC) && nu1->pntsu>1) {
+	}
+	else if (nu1 && !nu2) {
+		if (!(nu1->flagu & CU_NURB_CYCLIC) && nu1->pntsu>1) {
 			if (nu1->type == CU_BEZIER && BEZSELECTED_HIDDENHANDLES(cu, nu1->bezt) &&
 				BEZSELECTED_HIDDENHANDLES(cu, nu1->bezt+(nu1->pntsu-1))) {
 				nu1->flagu|= CU_NURB_CYCLIC;
 				calchandlesNurb(nu1);
 				ok= 1;
-			} else if (nu1->type == CU_NURBS && nu1->bp->f1&SELECT && (nu1->bp+(nu1->pntsu-1))->f1&SELECT) {
+			}
+			else if (nu1->type == CU_NURBS && nu1->bp->f1&SELECT && (nu1->bp+(nu1->pntsu-1))->f1&SELECT) {
 				nu1->flagu|= CU_NURB_CYCLIC;
 				nurbs_knot_calc_u(nu1);
 				ok= 1;
@@ -4059,12 +4099,12 @@ static int make_segment_exec(bContext *C, wmOperator *op)
 		}
 	}
 
-	if(!ok) {
+	if (!ok) {
 		BKE_report(op->reports, RPT_ERROR, "Can't make segment");
 		return OPERATOR_CANCELLED;
 	}
 
-	if(ED_curve_updateAnimPaths(obedit))
+	if (ED_curve_updateAnimPaths(obedit->data))
 		WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
 
 	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -4076,15 +4116,15 @@ static int make_segment_exec(bContext *C, wmOperator *op)
 void CURVE_OT_make_segment(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Make Segment";
-	ot->idname= "CURVE_OT_make_segment";
+	ot->name = "Make Segment";
+	ot->idname = "CURVE_OT_make_segment";
 	
 	/* api callbacks */
-	ot->exec= make_segment_exec;
-	ot->poll= ED_operator_editsurfcurve;
+	ot->exec = make_segment_exec;
+	ot->poll = ED_operator_editsurfcurve;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /***************** pick select from 3d view **********************/
@@ -4108,18 +4148,19 @@ int mouse_nurb(bContext *C, const int mval[2], int extend)
 	location[1]= mval[1];
 	hand= findnearestNurbvert(&vc, 1, location, &nu, &bezt, &bp);
 
-	if(bezt || bp) {
-		if(extend==0) {
+	if (bezt || bp) {
+		if (extend==0) {
 		
 			setflagsNurb(editnurb, 0);
 
-			if(bezt) {
+			if (bezt) {
 
-				if(hand==1) {
+				if (hand==1) {
 					select_beztriple(bezt, SELECT, 1, HIDDEN);
 					cu->lastsel= bezt;
-				} else {
-					if(hand==0) bezt->f1|= SELECT;
+				}
+				else {
+					if (hand==0) bezt->f1|= SELECT;
 					else bezt->f3|= SELECT;
 
 					cu->lastsel= NULL;
@@ -4132,26 +4173,30 @@ int mouse_nurb(bContext *C, const int mval[2], int extend)
 
 		}
 		else {
-			if(bezt) {
-				if(hand==1) {
-					if(bezt->f2 & SELECT) {
+			if (bezt) {
+				if (hand==1) {
+					if (bezt->f2 & SELECT) {
 						select_beztriple(bezt, DESELECT, 1, HIDDEN);
 						if (bezt == cu->lastsel) cu->lastsel = NULL;
-					} else {
+					}
+					else {
 						select_beztriple(bezt, SELECT, 1, HIDDEN);
 						cu->lastsel= bezt;
 					}
-				} else if(hand==0) {
+				}
+				else if (hand==0) {
 					bezt->f1 ^= SELECT;
-				} else {
+				}
+				else {
 					bezt->f3 ^= SELECT;
 				}
 			}
 			else {
-				if(bp->f1 & SELECT) {
+				if (bp->f1 & SELECT) {
 					select_bpoint(bp, DESELECT, 1, HIDDEN);
 					if (cu->lastsel == bp) cu->lastsel = NULL;
-				} else {
+				}
+				else {
 					select_bpoint(bp, SELECT, 1, HIDDEN);
 					cu->lastsel= bp;
 				}
@@ -4159,7 +4204,7 @@ int mouse_nurb(bContext *C, const int mval[2], int extend)
 
 		}
 
-		if(nu!=get_actNurb(obedit))
+		if (nu!=get_actNurb(obedit))
 			set_actNurb(obedit, nu);
 
 		WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
@@ -4223,17 +4268,17 @@ static int spin_nurb(float viewmat[][4], Object *obedit, float *axis, float *cen
 
 	ok= 1;
 
-	for(a=0;a<7;a++) {
+	for (a=0;a<7;a++) {
 		ok= extrudeflagNurb(cu->editnurb, 1);
 
-		if(ok==0)
+		if (ok==0)
 			return changed;
 
 		changed= 1;
 
 		rotateflagNurb(editnurb, SELECT, cent, rotmat);
 
-		if( (a & SELECT)==0 ) {
+		if ( (a & SELECT)==0 ) {
 			rotateflagNurb(editnurb, SELECT, cent, scalemat1);
 			weightflagNurb(editnurb, SELECT, 0.25*M_SQRT2);
 		}
@@ -4243,9 +4288,9 @@ static int spin_nurb(float viewmat[][4], Object *obedit, float *axis, float *cen
 		}
 	}
 
-	if(ok) {
-		for(nu= editnurb->first; nu; nu= nu->next) {
-			if(isNurbsel(nu)) {
+	if (ok) {
+		for (nu= editnurb->first; nu; nu= nu->next) {
+			if (isNurbsel(nu)) {
 				nu->orderv= 4;
 				nu->flagv |= CU_NURB_CYCLIC;
 				nurbs_knot_calc_v(nu);
@@ -4268,17 +4313,17 @@ static int spin_exec(bContext *C, wmOperator *op)
 	invert_m4_m4(obedit->imat, obedit->obmat);
 	mul_m4_v3(obedit->imat, cent);
 	
-	if(rv3d)
+	if (rv3d)
 		copy_m4_m4(viewmat, rv3d->viewmat);
 	else
 		unit_m4(viewmat);
 	
-	if(!spin_nurb(viewmat, obedit, axis, cent)) {
+	if (!spin_nurb(viewmat, obedit, axis, cent)) {
 		BKE_report(op->reports, RPT_ERROR, "Can't spin");
 		return OPERATOR_CANCELLED;
 	}
 
-	if(ED_curve_updateAnimPaths(obedit))
+	if (ED_curve_updateAnimPaths(obedit->data))
 		WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
 
 	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -4294,7 +4339,7 @@ static int spin_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 	RegionView3D *rv3d= ED_view3d_context_rv3d(C);
 	float axis[3]= {0.0f, 0.0f, 1.0f};
 	
-	if(rv3d)
+	if (rv3d)
 		copy_v3_v3(axis, rv3d->viewinv[2]);
 	
 	RNA_float_set_array(op->ptr, "center", give_cursor(scene, v3d));
@@ -4306,16 +4351,16 @@ static int spin_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 void CURVE_OT_spin(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Spin";
-	ot->idname= "CURVE_OT_spin";
+	ot->name = "Spin";
+	ot->idname = "CURVE_OT_spin";
 	
 	/* api callbacks */
-	ot->exec= spin_exec;
+	ot->exec = spin_exec;
 	ot->invoke = spin_invoke;
-	ot->poll= ED_operator_editsurf;
+	ot->poll = ED_operator_editsurf;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	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);
@@ -4333,17 +4378,18 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
 	BPoint *bp, *newbp = NULL;
 	float imat[4][4], temp[3];
 	int ok= 0;
+	BezTriple *bezt_recalc[3] = {NULL};
 
 	invert_m4_m4(imat, obedit->obmat);
 
 	findselectedNurbvert(&editnurb->nurbs, &nu, &bezt, &bp);
 
 	if ((nu == NULL) || (nu->type==CU_BEZIER && bezt==NULL) || (nu->type!=CU_BEZIER && bp==NULL)) {
-		if(mode!='e') {
-			if(cu->actnu >= 0)
+		if (mode!='e') {
+			if (cu->actnu >= 0)
 				nu= BLI_findlink(&editnurb->nurbs, cu->actnu);
 
-			if(!nu || nu->type==CU_BEZIER) {
+			if (!nu || nu->type==CU_BEZIER) {
 				newbezt= (BezTriple*)MEM_callocN(sizeof(BezTriple), "addvert_Nurb");
 				newbezt->radius= 1;
 				newbezt->alfa= 0;
@@ -4351,14 +4397,15 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
 				newbezt->h2= newbezt->h1= HD_AUTO;
 
 				newnu= (Nurb*)MEM_callocN(sizeof(Nurb), "addvert_Nurb newnu");
-				if(!nu) {
-					/* no selected sement -- create new one which is BEZIER tpye
-					   type couldn't be determined from Curve bt could be changed
-					   in the future, so shouldn't make much headache */
+				if (!nu) {
+					/* no selected segment -- create new one which is BEZIER type
+					 * type couldn't be determined from Curve bt could be changed
+					 * in the future, so shouldn't make much headache */
 					newnu->type= CU_BEZIER;
 					newnu->resolu= cu->resolu;
 					newnu->flag |= CU_SMOOTH;
-				} else memcpy(newnu, nu, sizeof(Nurb));
+				}
+				else memcpy(newnu, nu, sizeof(Nurb));
 
 				BLI_addtail(&editnurb->nurbs, newnu);
 				set_actNurb(obedit, newnu);
@@ -4379,7 +4426,8 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
 
 				ok= 1;
 				nu= newnu;
-			} else if(nu->pntsv == 1) {
+			}
+			else if (nu->pntsv == 1) {
 				newbp= (BPoint*)MEM_callocN(sizeof(BPoint), "addvert_Nurb5");
 				newbp->radius= 1;
 				newbp->alfa= 0;
@@ -4406,13 +4454,13 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
 
 		}
 
-		if(!ok)
+		if (!ok)
 			return OPERATOR_CANCELLED;
 	}
 
-	if(!ok && nu->type == CU_BEZIER) {
+	if (!ok && nu->type == CU_BEZIER) {
 		/* which bezpoint? */
-		if(bezt== (nu->bezt+nu->pntsu-1)) {  /* last */
+		if (bezt== (nu->bezt+nu->pntsu-1)) {  /* last */
 			BEZ_DESEL(bezt);
 			newbezt =
 				(BezTriple*)MEM_callocN((nu->pntsu+1) * sizeof(BezTriple), "addvert_Nurb");
@@ -4424,11 +4472,16 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
 			newbezt+= nu->pntsu;
 			BEZ_SEL(newbezt);
 			cu->lastsel= newbezt;
-			newbezt->h2= newbezt->h1;
+			newbezt->h1 = newbezt->h2;
 			bezt= nu->bezt+nu->pntsu-1;
 			ok= 1;
+
+			if (nu->pntsu > 1) {
+				bezt_recalc[1] = newbezt;
+				bezt_recalc[0] = newbezt - 1;
+			}
 		}
-		else if(bezt== nu->bezt) {   /* first */
+		else if (bezt== nu->bezt) {   /* first */
 			BEZ_DESEL(bezt);
 			newbezt =
 				(BezTriple*)MEM_callocN((nu->pntsu+1) * sizeof(BezTriple), "addvert_Nurb");
@@ -4442,8 +4495,13 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
 			nu->bezt= newbezt;
 			bezt= newbezt+1;
 			ok= 1;
+
+			if (nu->pntsu > 1) {
+				bezt_recalc[1] = newbezt;
+				bezt_recalc[2] = newbezt + 1;
+			}
 		}
-		else if(mode!='e') {
+		else if (mode!='e') {
 			BEZ_DESEL(bezt);
 			newbezt= (BezTriple*)MEM_callocN(sizeof(BezTriple), "addvert_Nurb");
 			*newbezt= *bezt;
@@ -4465,10 +4523,10 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
 		}
 		else bezt= NULL;
 
-		if(bezt) {
-			if(!newnu) nu->pntsu++;
+		if (bezt) {
+			if (!newnu) nu->pntsu++;
 
-			if(mode=='e') {
+			if (mode=='e') {
 				copy_v3_v3(newbezt->vec[0], bezt->vec[0]);
 				copy_v3_v3(newbezt->vec[1], bezt->vec[1]);
 				copy_v3_v3(newbezt->vec[2], bezt->vec[2]);
@@ -4476,17 +4534,28 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
 			else {
 				mul_v3_m4v3(newbezt->vec[1], imat, location);
 				sub_v3_v3v3(temp, newbezt->vec[1],temp);
-				add_v3_v3v3(newbezt->vec[0], bezt->vec[0],temp);
-				add_v3_v3v3(newbezt->vec[2], bezt->vec[2],temp);
 
-				if(newnu) calchandlesNurb(newnu);
+				if (bezt_recalc[1]) {
+					const char h1 = bezt_recalc[1]->h1, h2 = bezt_recalc[1]->h2;
+					bezt_recalc[1]->h1 = bezt_recalc[1]->h2 = HD_AUTO;
+					calchandleNurb(bezt_recalc[1], bezt_recalc[0], bezt_recalc[2], 0);
+					bezt_recalc[1]->h1 = h1;
+					bezt_recalc[1]->h2 = h2;
+				}
+				else {
+					add_v3_v3v3(newbezt->vec[0], bezt->vec[0],temp);
+					add_v3_v3v3(newbezt->vec[2], bezt->vec[2],temp);
+				}
+				
+
+				if (newnu) calchandlesNurb(newnu);
 				else calchandlesNurb(nu);
 			}
 		}
 	}
-	else if(!ok && nu->pntsv==1) {
+	else if (!ok && nu->pntsv==1) {
 		/* which b-point? */
-		if(bp== (nu->bp+nu->pntsu-1)) {  /* last */
+		if (bp== (nu->bp+nu->pntsu-1)) {  /* last */
 			bp->f1= 0;
 			newbp =
 				(BPoint*)MEM_callocN((nu->pntsu+1) * sizeof(BPoint), "addvert_Nurb4");
@@ -4500,7 +4569,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
 			bp= newbp - 1;
 			ok= 1;
 		}
-		else if(bp== nu->bp) {   /* first */
+		else if (bp== nu->bp) {   /* first */
 			bp->f1= 0;
 			newbp =
 				(BPoint*)MEM_callocN((nu->pntsu+1) * sizeof(BPoint), "addvert_Nurb3");
@@ -4513,7 +4582,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
 			bp= newbp + 1;
 			ok= 1;
 		}
-		else if(mode!='e') {
+		else if (mode!='e') {
 			bp->f1= 0;
 			newbp= (BPoint*)MEM_callocN(sizeof(BPoint), "addvert_Nurb5");
 			*newbp= *bp;
@@ -4534,29 +4603,30 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
 		}
 		else bp= NULL;
 
-		if(bp) {
-			if(mode=='e') {
+		if (bp) {
+			if (mode=='e') {
 				copy_v3_v3(newbp->vec, bp->vec);
 			}
 			else {
 				mul_v3_m4v3(newbp->vec, imat, location);
 				newbp->vec[3]= 1.0;
 
-				if(!newnu && nu->orderu<4 && nu->orderu<=nu->pntsu)
+				if (!newnu && nu->orderu<4 && nu->orderu<=nu->pntsu)
 					nu->orderu++;
 			}
 
-			if(!newnu) {
+			if (!newnu) {
 				nu->pntsu++;
 				nurbs_knot_calc_u(nu);
-			} else nurbs_knot_calc_u(newnu);
+			}
+			else nurbs_knot_calc_u(newnu);
 		}
 	}
 
-	if(ok) {
+	if (ok) {
 		test2DNurb(nu);
 
-		if(ED_curve_updateAnimPaths(obedit))
+		if (ED_curve_updateAnimPaths(obedit->data))
 			WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
 
 		WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -4580,7 +4650,7 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 	RegionView3D *rv3d= CTX_wm_region_view3d(C);
 
-	if(rv3d && !RNA_struct_property_is_set(op->ptr, "location")) {
+	if (rv3d && !RNA_struct_property_is_set(op->ptr, "location")) {
 		Curve *cu;
 		ViewContext vc;
 		float location[3];
@@ -4595,7 +4665,7 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 		findselectedNurbvert(&cu->editnurb->nurbs, &nu, &bezt, &bp);
 
-		if(bezt) {
+		if (bezt) {
 			mul_v3_m4v3(location, vc.obedit->obmat, bezt->vec[1]);
 		}
 		else if (bp) {
@@ -4615,16 +4685,16 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, wmEvent *event)
 void CURVE_OT_vertex_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Vertex";
-	ot->idname= "CURVE_OT_vertex_add";
+	ot->name = "Add Vertex";
+	ot->idname = "CURVE_OT_vertex_add";
 	
 	/* api callbacks */
-	ot->exec= add_vertex_exec;
-	ot->invoke= add_vertex_invoke;
-	ot->poll= ED_operator_editcurve;
+	ot->exec = add_vertex_exec;
+	ot->invoke = add_vertex_invoke;
+	ot->poll = ED_operator_editcurve;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_float_vector_xyz(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location to add new vertex at", -1e4, 1e4);
@@ -4640,16 +4710,16 @@ static int extrude_exec(bContext *C, wmOperator *UNUSED(op))
 	Nurb *nu;
 	
 	/* first test: curve? */
-	for(nu= editnurb->nurbs.first; nu; nu= nu->next)
-		if(nu->pntsv==1 && isNurbsel_count(cu, nu)==1)
+	for (nu= editnurb->nurbs.first; nu; nu= nu->next)
+		if (nu->pntsv==1 && isNurbsel_count(cu, nu)==1)
 			break;
 
-	if(obedit->type==OB_CURVE || nu) {
+	if (obedit->type==OB_CURVE || nu) {
 		addvert_Nurb(C, 'e', NULL);
 	}
 	else {
-		if(extrudeflagNurb(editnurb, 1)) { /* '1'= flag */
-			if(ED_curve_updateAnimPaths(obedit))
+		if (extrudeflagNurb(editnurb, 1)) { /* '1'= flag */
+			if (ED_curve_updateAnimPaths(obedit->data))
 				WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
 
 			WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -4663,16 +4733,16 @@ static int extrude_exec(bContext *C, wmOperator *UNUSED(op))
 void CURVE_OT_extrude(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Extrude";
+	ot->name = "Extrude";
 	ot->description = "Extrude selected control point(s) and move";
-	ot->idname= "CURVE_OT_extrude";
+	ot->idname = "CURVE_OT_extrude";
 	
 	/* api callbacks */
-	ot->exec= extrude_exec;
-	ot->poll= ED_operator_editsurfcurve;
+	ot->exec = extrude_exec;
+	ot->poll = ED_operator_editsurfcurve;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* to give to transform */
 	RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
@@ -4690,24 +4760,24 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
 	BPoint *bp;
 	int a, direction= RNA_enum_get(op->ptr, "direction");
 
-	for(nu= editnurb->first; nu; nu= nu->next) {
-		if( nu->pntsu>1 || nu->pntsv>1) {
-			if(nu->type == CU_POLY) {
+	for (nu= editnurb->first; nu; nu= nu->next) {
+		if ( nu->pntsu>1 || nu->pntsv>1) {
+			if (nu->type == CU_POLY) {
 				a= nu->pntsu;
 				bp= nu->bp;
-				while(a--) {
-					if( bp->f1 & SELECT ) {
+				while (a--) {
+					if ( bp->f1 & SELECT ) {
 						nu->flagu ^= CU_NURB_CYCLIC;
 						break;
 					}
 					bp++;
 				}
 			}
-			else if(nu->type == CU_BEZIER) {
+			else if (nu->type == CU_BEZIER) {
 				a= nu->pntsu;
 				bezt= nu->bezt;
-				while(a--) {
-					if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) {
+				while (a--) {
+					if ( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) {
 						nu->flagu ^= CU_NURB_CYCLIC;
 						break;
 					}
@@ -4715,12 +4785,12 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
 				}
 				calchandlesNurb(nu);
 			}
-			else if(nu->pntsv==1 && nu->type == CU_NURBS) {
+			else if (nu->pntsv==1 && nu->type == CU_NURBS) {
 				if (nu->knotsu) { /* if check_valid_nurb_u fails the knotsu can be NULL */
 					a= nu->pntsu;
 					bp= nu->bp;
-					while(a--) {
-						if( bp->f1 & SELECT ) {
+					while (a--) {
+						if ( bp->f1 & SELECT ) {
 							nu->flagu ^= CU_NURB_CYCLIC;
 							nurbs_knot_calc_u(nu);	/* 1==u  type is ignored for cyclic curves */
 							break;
@@ -4729,17 +4799,17 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op)
 					}
 				}
 			}
-			else if(nu->type==CU_NURBS) {
+			else if (nu->type==CU_NURBS) {
 				a= nu->pntsu*nu->pntsv;
 				bp= nu->bp;
-				while(a--) {
+				while (a--) {
 	
-					if( bp->f1 & SELECT) {
-						if(direction==0 && nu->pntsu>1) {
+					if ( bp->f1 & SELECT) {
+						if (direction==0 && nu->pntsu>1) {
 							nu->flagu ^= CU_NURB_CYCLIC;
 							nurbs_knot_calc_u(nu);   /* 1==u  type is ignored for cyclic curves */
 						}
-						if(direction==1 && nu->pntsv>1) {
+						if (direction==1 && nu->pntsv>1) {
 							nu->flagv ^= CU_NURB_CYCLIC;
 							nurbs_knot_calc_v(nu);   /* 2==v  type is ignored for cyclic curves */
 						}
@@ -4766,10 +4836,10 @@ static int toggle_cyclic_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
 	uiLayout *layout;
 	Nurb *nu;
 
-	if(obedit->type == OB_SURF) {
-		for(nu= editnurb->first; nu; nu= nu->next) {
-			if(nu->pntsu>1 || nu->pntsv>1) {
-				if(nu->type==CU_NURBS) {
+	if (obedit->type == OB_SURF) {
+		for (nu= editnurb->first; nu; nu= nu->next) {
+			if (nu->pntsu>1 || nu->pntsv>1) {
+				if (nu->type==CU_NURBS) {
 					pup= uiPupMenuBegin(C, "Direction", ICON_NONE);
 					layout= uiPupMenuLayout(pup);
 					uiItemsEnumO(layout, op->type->idname, "direction");
@@ -4791,17 +4861,17 @@ void CURVE_OT_cyclic_toggle(wmOperatorType *ot)
 		{0, NULL, 0, NULL, NULL}};
 
 	/* identifiers */
-	ot->name= "Toggle Cyclic";
+	ot->name = "Toggle Cyclic";
 	ot->description = "Make active spline closed/opened loop";
-	ot->idname= "CURVE_OT_cyclic_toggle";
+	ot->idname = "CURVE_OT_cyclic_toggle";
 	
 	/* api callbacks */
-	ot->exec= toggle_cyclic_exec;
-	ot->invoke= toggle_cyclic_invoke;
-	ot->poll= ED_operator_editsurfcurve;
+	ot->exec = toggle_cyclic_exec;
+	ot->invoke = toggle_cyclic_invoke;
+	ot->poll = ED_operator_editsurfcurve;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "direction", direction_items, 0, "Direction", "Direction to make surface cyclic in");
@@ -4820,15 +4890,15 @@ static int select_linked_exec(bContext *C, wmOperator *UNUSED(op))
 	BPoint *bp;
 	int a;
 
-	for(nu= nurbs->first; nu; nu= nu->next) {
-		if(nu->type == CU_BEZIER) {
+	for (nu= nurbs->first; nu; nu= nu->next) {
+		if (nu->type == CU_BEZIER) {
 			bezt= nu->bezt;
 			a= nu->pntsu;
-			while(a--) {
-				if( (bezt->f1 & SELECT) || (bezt->f2 & SELECT) || (bezt->f3 & SELECT) ) {
+			while (a--) {
+				if ( (bezt->f1 & SELECT) || (bezt->f2 & SELECT) || (bezt->f3 & SELECT) ) {
 					a= nu->pntsu;
 					bezt= nu->bezt;
-					while(a--) {
+					while (a--) {
 						select_beztriple(bezt, SELECT, 1, VISIBLE);
 						bezt++;
 					}
@@ -4840,11 +4910,11 @@ static int select_linked_exec(bContext *C, wmOperator *UNUSED(op))
 		else {
 			bp= nu->bp;
 			a= nu->pntsu*nu->pntsv;
-			while(a--) {
-				if( bp->f1 & 1 ) {
+			while (a--) {
+				if ( bp->f1 & 1 ) {
 					a= nu->pntsu*nu->pntsv;
 					bp= nu->bp;
-					while(a--) {
+					while (a--) {
 						select_bpoint(bp, SELECT, 1, VISIBLE);
 						bp++;
 					}
@@ -4868,16 +4938,16 @@ static int select_linked_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
 void CURVE_OT_select_linked(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Linked All";
-	ot->idname= "CURVE_OT_select_linked";
+	ot->name = "Select Linked All";
+	ot->idname = "CURVE_OT_select_linked";
 
 	/* api callbacks */
-	ot->exec= select_linked_exec;
-	ot->invoke= select_linked_invoke;
-	ot->poll= ED_operator_editsurfcurve;
+	ot->exec = select_linked_exec;
+	ot->invoke = select_linked_invoke;
+	ot->poll = ED_operator_editsurfcurve;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 }
@@ -4901,20 +4971,20 @@ static int select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event
 
 	findnearestNurbvert(&vc, 1, event->mval, &nu, &bezt, &bp);
 
-	if(bezt) {
+	if (bezt) {
 		a= nu->pntsu;
 		bezt= nu->bezt;
-		while(a--) {
-			if(deselect) select_beztriple(bezt, DESELECT, 1, VISIBLE);
+		while (a--) {
+			if (deselect) select_beztriple(bezt, DESELECT, 1, VISIBLE);
 			else select_beztriple(bezt, SELECT, 1, VISIBLE);
 			bezt++;
 		}
 	}
-	else if(bp) {
+	else if (bp) {
 		a= nu->pntsu*nu->pntsv;
 		bp= nu->bp;
-		while(a--) {
-			if(deselect) select_bpoint(bp, DESELECT, 1, VISIBLE);
+		while (a--) {
+			if (deselect) select_bpoint(bp, DESELECT, 1, VISIBLE);
 			else select_bpoint(bp, SELECT, 1, VISIBLE);
 			bp++;
 		}
@@ -4928,15 +4998,15 @@ static int select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event
 void CURVE_OT_select_linked_pick(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Linked";
-	ot->idname= "CURVE_OT_select_linked_pick";
+	ot->name = "Select Linked";
+	ot->idname = "CURVE_OT_select_linked_pick";
 
 	/* api callbacks */
-	ot->invoke= select_linked_pick_invoke;
-	ot->poll= ED_operator_editsurfcurve_region_view3d;
+	ot->invoke = select_linked_pick_invoke;
+	ot->poll = ED_operator_editsurfcurve_region_view3d;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Deselect linked control points rather than selecting them");
@@ -4955,41 +5025,41 @@ static int select_row_exec(bContext *C, wmOperator *UNUSED(op))
 	BPoint *bp;
 	int u = 0, v = 0, a, b, ok=0;
 
-	if(editnurb->first == NULL)
+	if (editnurb->first == NULL)
 		return OPERATOR_CANCELLED;
-	if(cu->lastsel==NULL)
+	if (cu->lastsel==NULL)
 		return OPERATOR_CANCELLED;
 
 	/* find the correct nurb and toggle with u of v */
-	for(nu= editnurb->first; nu; nu= nu->next) {
+	for (nu= editnurb->first; nu; nu= nu->next) {
 		bp= nu->bp;
-		for(v=0; v<nu->pntsv; v++) {
-			for(u=0; u<nu->pntsu; u++, bp++) {
-				if(bp==cu->lastsel) {
-					if(bp->f1 & SELECT) {
+		for (v=0; v<nu->pntsv; v++) {
+			for (u=0; u<nu->pntsu; u++, bp++) {
+				if (bp==cu->lastsel) {
+					if (bp->f1 & SELECT) {
 						ok= 1;
 						break;
 					}
 				}
 			}
-			if(ok) break;
+			if (ok) break;
 		}
 
-		if(ok) {
-			if(last==cu->lastsel) {
+		if (ok) {
+			if (last==cu->lastsel) {
 				direction= 1-direction;
 				setflagsNurb(editnurb, 0);
 			}
 			last= cu->lastsel;
 
 			bp= nu->bp;
-			for(a=0; a<nu->pntsv; a++) {
-				for(b=0; b<nu->pntsu; b++, bp++) {
-					if(direction) {
-						if(a==v) select_bpoint(bp, SELECT, 1, VISIBLE);
+			for (a=0; a<nu->pntsv; a++) {
+				for (b=0; b<nu->pntsu; b++, bp++) {
+					if (direction) {
+						if (a==v) select_bpoint(bp, SELECT, 1, VISIBLE);
 					}
 					else {
-						if(b==u) select_bpoint(bp, SELECT, 1, VISIBLE);
+						if (b==u) select_bpoint(bp, SELECT, 1, VISIBLE);
 					}
 				}
 			}
@@ -5006,15 +5076,15 @@ static int select_row_exec(bContext *C, wmOperator *UNUSED(op))
 void CURVE_OT_select_row(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Control Point Row";
-	ot->idname= "CURVE_OT_select_row";
+	ot->name = "Select Control Point Row";
+	ot->idname = "CURVE_OT_select_row";
 	
 	/* api callbacks */
-	ot->exec= select_row_exec;
-	ot->poll= ED_operator_editsurf;
+	ot->exec = select_row_exec;
+	ot->poll = ED_operator_editsurf;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /***************** select next operator **********************/
@@ -5033,15 +5103,15 @@ static int select_next_exec(bContext *C, wmOperator *UNUSED(op))
 void CURVE_OT_select_next(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Next";
-	ot->idname= "CURVE_OT_select_next";
+	ot->name = "Select Next";
+	ot->idname = "CURVE_OT_select_next";
 	
 	/* api callbacks */
-	ot->exec= select_next_exec;
-	ot->poll= ED_operator_editcurve;
+	ot->exec = select_next_exec;
+	ot->poll = ED_operator_editcurve;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /***************** select previous operator **********************/
@@ -5060,15 +5130,15 @@ static int select_previous_exec(bContext *C, wmOperator *UNUSED(op))
 void CURVE_OT_select_previous(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Previous";
-	ot->idname= "CURVE_OT_select_previous";
+	ot->name = "Select Previous";
+	ot->idname = "CURVE_OT_select_previous";
 	
 	/* api callbacks */
-	ot->exec= select_previous_exec;
-	ot->poll= ED_operator_editcurve;
+	ot->exec = select_previous_exec;
+	ot->poll = ED_operator_editcurve;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /***************** select more operator **********************/
@@ -5084,43 +5154,43 @@ static int select_more_exec(bContext *C, wmOperator *UNUSED(op))
 	short *selbpoints;
 	
 	/* note that NURBS surface is a special case because we mimic */
-	/* the behaviour of "select more" of mesh tools.	      */
+	/* the behavior of "select more" of mesh tools.	      */
 	/* The algorithm is designed to work in planar cases so it    */
 	/* may not be optimal always (example: end of NURBS sphere)   */
-	if(obedit->type==OB_SURF) {
-		for(nu= editnurb->first; nu; nu= nu->next) {
+	if (obedit->type==OB_SURF) {
+		for (nu= editnurb->first; nu; nu= nu->next) {
 			a= nu->pntsu*nu->pntsv;
 			bp= nu->bp;
 			selbpoints= MEM_callocN(sizeof(short)*a-nu->pntsu, "selectlist");
-			while(a > 0) {
-				if((selbpoints[a]!=1) && (bp->hide==0) && (bp->f1 & SELECT)) {
+			while (a > 0) {
+				if ((selbpoints[a]!=1) && (bp->hide==0) && (bp->f1 & SELECT)) {
 					/* upper control point */
-					if(a%nu->pntsu != 0) {
+					if (a%nu->pntsu != 0) {
 						tempbp= bp-1;
-						if(!(tempbp->f1 & SELECT)) select_bpoint(tempbp, SELECT, 1, VISIBLE); 
+						if (!(tempbp->f1 & SELECT)) select_bpoint(tempbp, SELECT, 1, VISIBLE); 
 					}
 
 					/* left control point. select only if it is not selected already */
-					if(a-nu->pntsu > 0) {
+					if (a-nu->pntsu > 0) {
 						sel= 0;
 						tempbp= bp+nu->pntsu;
-						if(!(tempbp->f1 & SELECT)) sel= select_bpoint(tempbp, SELECT, 1, VISIBLE); 
+						if (!(tempbp->f1 & SELECT)) sel= select_bpoint(tempbp, SELECT, 1, VISIBLE); 
 						/* make sure selected bpoint is discarded */
-						if(sel == 1) selbpoints[a-nu->pntsu]= 1;
+						if (sel == 1) selbpoints[a-nu->pntsu]= 1;
 					}
 					
 					/* right control point */
-					if(a+nu->pntsu < nu->pntsu*nu->pntsv) {
+					if (a+nu->pntsu < nu->pntsu*nu->pntsv) {
 						tempbp= bp-nu->pntsu;
-						if(!(tempbp->f1 & SELECT)) select_bpoint(tempbp, SELECT, 1, VISIBLE); 
+						if (!(tempbp->f1 & SELECT)) select_bpoint(tempbp, SELECT, 1, VISIBLE); 
 					}
 				
 					/* lower control point. skip next bp in case selection was made */
-					if(a%nu->pntsu != 1) {
+					if (a%nu->pntsu != 1) {
 						sel= 0;
 						tempbp= bp+1;
-						if(!(tempbp->f1 & 1)) sel= select_bpoint(tempbp, SELECT, 1, VISIBLE); 
-						if(sel) {
+						if (!(tempbp->f1 & 1)) sel= select_bpoint(tempbp, SELECT, 1, VISIBLE); 
+						if (sel) {
 							bp++;	
 							a--;
 						}
@@ -5147,20 +5217,20 @@ static int select_more_exec(bContext *C, wmOperator *UNUSED(op))
 void CURVE_OT_select_more(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select More";
-	ot->idname= "CURVE_OT_select_more";
+	ot->name = "Select More";
+	ot->idname = "CURVE_OT_select_more";
 	
 	/* api callbacks */
-	ot->exec= select_more_exec;
-	ot->poll= ED_operator_editsurfcurve;
+	ot->exec = select_more_exec;
+	ot->poll = ED_operator_editsurfcurve;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /******************** select less operator *****************/
 
-/* basic method: deselect if control point doesn't have all neighbours selected */
+/* basic method: deselect if control point doesn't have all neighbors selected */
 static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
 {
 	Object *obedit= CTX_data_edit_object(C);
@@ -5172,46 +5242,46 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
 	short sel= 0, lastsel= 0;
 	short *selbpoints;
 	
-	if(obedit->type==OB_SURF) {		
-		for(nu= editnurb->first; nu; nu= nu->next) {
+	if (obedit->type==OB_SURF) {		
+		for (nu= editnurb->first; nu; nu= nu->next) {
 			a= nu->pntsu*nu->pntsv;
 			bp= nu->bp;
 			selbpoints= MEM_callocN(sizeof(short)*a, "selectlist");
-			while(a--) {
-				if((bp->hide==0) && (bp->f1 & SELECT)) {
+			while (a--) {
+				if ((bp->hide==0) && (bp->f1 & SELECT)) {
 					sel= 0;
 									
-					/* check if neighbours have been selected */	
+					/* check if neighbors have been selected */	
 					/* edges of surface are an exception */	
-					if((a+1)%nu->pntsu==0) sel++;	
+					if ((a+1)%nu->pntsu==0) sel++;	
 					else {
 						bp--;
-						if((selbpoints[a+1]==1) || ((bp->hide==0) && (bp->f1 & SELECT))) sel++;
+						if ((selbpoints[a+1]==1) || ((bp->hide==0) && (bp->f1 & SELECT))) sel++;
 						bp++;
 					}
 					
-					if((a+1)%nu->pntsu==1) sel++;
+					if ((a+1)%nu->pntsu==1) sel++;
 					else {
 						bp++;
-						if((bp->hide==0) && (bp->f1 & SELECT)) sel++;
+						if ((bp->hide==0) && (bp->f1 & SELECT)) sel++;
 						bp--;
 					}
 					
-					if(a+1 > nu->pntsu*nu->pntsv-nu->pntsu) sel++;
+					if (a+1 > nu->pntsu*nu->pntsv-nu->pntsu) sel++;
 					else {
 						bp-=nu->pntsu;
-						if((selbpoints[a+nu->pntsu]==1) || ((bp->hide==0) && (bp->f1 & SELECT))) sel++;
+						if ((selbpoints[a+nu->pntsu]==1) || ((bp->hide==0) && (bp->f1 & SELECT))) sel++;
 						bp+=nu->pntsu;
 					}
 									
-					if(a < nu->pntsu) sel++;
+					if (a < nu->pntsu) sel++;
 					else {
 						bp+=nu->pntsu;
-						if((bp->hide==0) && (bp->f1 & SELECT)) sel++;
+						if ((bp->hide==0) && (bp->f1 & SELECT)) sel++;
 						bp-=nu->pntsu;
 					}
 													
-					if(sel!=4) {
+					if (sel!=4) {
 						select_bpoint(bp, DESELECT, 1, VISIBLE); 
 						selbpoints[a]= 1;												
 					}									
@@ -5225,34 +5295,34 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
 		}
 	}
 	else {
-		for(nu= editnurb->first; nu; nu= nu->next) {
+		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--) {
-					if((bezt->hide==0) && (bezt->f2 & SELECT)) {
-						if(lastsel==1) sel= 1;
+				while (a--) {
+					if ((bezt->hide==0) && (bezt->f2 & SELECT)) {
+						if (lastsel==1) sel= 1;
 						else sel= 0;
 												
-						/* check if neighbours have been selected */						
+						/* check if neighbors have been selected */						
 						/* first and last are exceptions */					
-						if(a==nu->pntsu-1) sel++; 
+						if (a==nu->pntsu-1) sel++; 
 						else { 
 							bezt--;
-							if((bezt->hide==0) && (bezt->f2 & SELECT)) sel++;
+							if ((bezt->hide==0) && (bezt->f2 & SELECT)) sel++;
 							bezt++;
 						}
 						
-						if(a==0) sel++;
+						if (a==0) sel++;
 						else {
 							bezt++;
-							if((bezt->hide==0) && (bezt->f2 & SELECT)) sel++;
+							if ((bezt->hide==0) && (bezt->f2 & SELECT)) sel++;
 							bezt--;
 						}
 
-						if(sel!=2) {
+						if (sel!=2) {
 							select_beztriple(bezt, DESELECT, 1, VISIBLE);	
 							lastsel= 1;
 						}
@@ -5266,27 +5336,27 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
 			else {
 				a= nu->pntsu*nu->pntsv;
 				bp= nu->bp;
-				while(a--) {
-					if((lastsel==0) && (bp->hide==0) && (bp->f1 & SELECT)) {
-						if(lastsel!=0) sel= 1;
+				while (a--) {
+					if ((lastsel==0) && (bp->hide==0) && (bp->f1 & SELECT)) {
+						if (lastsel!=0) sel= 1;
 						else sel= 0;
 						
 						/* first and last are exceptions */					
-						if(a==nu->pntsu*nu->pntsv-1) sel++; 
+						if (a==nu->pntsu*nu->pntsv-1) sel++; 
 						else { 
 							bp--;
-							if((bp->hide==0) && (bp->f1 & SELECT)) sel++;
+							if ((bp->hide==0) && (bp->f1 & SELECT)) sel++;
 							bp++;
 						}
 						
-						if(a==0) sel++;
+						if (a==0) sel++;
 						else {
 							bp++;
-							if((bp->hide==0) && (bp->f1 & SELECT)) sel++;
+							if ((bp->hide==0) && (bp->f1 & SELECT)) sel++;
 							bp--;
 						}
 											
-						if(sel!=2) {
+						if (sel!=2) {
 							select_bpoint(bp, DESELECT, 1, VISIBLE); 	
 							lastsel= 1;						
 						}				
@@ -5308,15 +5378,15 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
 void CURVE_OT_select_less(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Less";
-	ot->idname= "CURVE_OT_select_less";
+	ot->name = "Select Less";
+	ot->idname = "CURVE_OT_select_less";
 	
 	/* api callbacks */
-	ot->exec= select_less_exec;
-	ot->poll= ED_operator_editsurfcurve;
+	ot->exec = select_less_exec;
+	ot->poll = ED_operator_editsurfcurve;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************** select random *********************/
@@ -5330,11 +5400,11 @@ static void selectrandom_curve(ListBase *editnurb, float randfac)
 	
 	BLI_srand( BLI_rand() ); /* random seed */
 	
-	for(nu= editnurb->first; nu; nu= nu->next) {	
-		if(nu->type == CU_BEZIER) {
+	for (nu= editnurb->first; nu; nu= nu->next) {	
+		if (nu->type == CU_BEZIER) {
 			bezt= nu->bezt;
 			a= nu->pntsu;
-			while(a--) {
+			while (a--) {
 				if (BLI_frand() < randfac)
 					select_beztriple(bezt, SELECT, 1, VISIBLE);
 				bezt++;
@@ -5344,7 +5414,7 @@ static void selectrandom_curve(ListBase *editnurb, float randfac)
 			bp= nu->bp;
 			a= nu->pntsu*nu->pntsv;
 			
-			while(a--) {
+			while (a--) {
 				if (BLI_frand() < randfac)
 					select_bpoint(bp, SELECT, 1, VISIBLE); 
 				bp++;
@@ -5358,7 +5428,7 @@ static int select_random_exec(bContext *C, wmOperator *op)
 	Object *obedit= CTX_data_edit_object(C);
 	ListBase *editnurb= object_editcurve_get(obedit);
 
-	if(!RNA_boolean_get(op->ptr, "extend"))
+	if (!RNA_boolean_get(op->ptr, "extend"))
 		CU_deselect_all(obedit);
 	
 	selectrandom_curve(editnurb, RNA_float_get(op->ptr, "percent")/100.0f);
@@ -5371,15 +5441,15 @@ static int select_random_exec(bContext *C, wmOperator *op)
 void CURVE_OT_select_random(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Random";
-	ot->idname= "CURVE_OT_select_random";
+	ot->name = "Select Random";
+	ot->idname = "CURVE_OT_select_random";
 	
 	/* api callbacks */
-	ot->exec= select_random_exec;
-	ot->poll= ED_operator_editsurfcurve;
+	ot->exec = select_random_exec;
+	ot->poll = ED_operator_editsurfcurve;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_float_percentage(ot->srna, "percent", 50.f, 0.0f, 100.0f, "Percent", "Percentage of elements to select randomly", 0.f, 100.0f);
@@ -5393,7 +5463,8 @@ static int point_on_nurb(Nurb *nu, void *point)
 	if (nu->bezt) {
 		BezTriple *bezt= (BezTriple*)point;
 		return bezt >= nu->bezt && bezt < nu->bezt + nu->pntsu;
-	} else {
+	}
+	else {
 		BPoint *bp= (BPoint*)point;
 		return bp >= nu->bp && bp < nu->bp + nu->pntsu * nu->pntsv;
 	}
@@ -5404,7 +5475,7 @@ static Nurb *get_lastsel_nurb(Curve *cu)
 	ListBase *nubase= curve_editnurbs(cu);
 	Nurb *nu= nubase->first;
 
-	if(!cu->lastsel)
+	if (!cu->lastsel)
 		return NULL;
 
 	while (nu) {
@@ -5474,7 +5545,8 @@ int CU_select_nth(Object *obedit, int nth)
 
 	if (nu->bezt) {
 		select_nth_bezt(nu, cu->lastsel, nth);
-	} else {
+	}
+	else {
 		select_nth_bp(nu, cu->lastsel, nth);
 	}
 
@@ -5489,7 +5561,8 @@ 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");
-		} else {
+		}
+		else {
 			BKE_report(op->reports, RPT_ERROR, "Curve hasn't got active point");
 		}
 
@@ -5504,16 +5577,16 @@ static int select_nth_exec(bContext *C, wmOperator *op)
 void CURVE_OT_select_nth(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Nth";
-	ot->description= "";
-	ot->idname= "CURVE_OT_select_nth";
+	ot->name = "Select Nth";
+	ot->description = "";
+	ot->idname = "CURVE_OT_select_nth";
 
 	/* api callbacks */
-	ot->exec= select_nth_exec;
-	ot->poll= ED_operator_editsurfcurve;
+	ot->exec = select_nth_exec;
+	ot->poll = ED_operator_editsurfcurve;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	RNA_def_int(ot->srna, "nth", 2, 2, 100, "Nth Selection", "", 1, INT_MAX);
 }
@@ -5533,16 +5606,16 @@ static int duplicate_exec(bContext *C, wmOperator *UNUSED(op))
 void CURVE_OT_duplicate(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Duplicate Curve";
+	ot->name = "Duplicate Curve";
 	ot->description = "Duplicate selected control points and segments between them";
-	ot->idname= "CURVE_OT_duplicate";
+	ot->idname = "CURVE_OT_duplicate";
 	
 	/* api callbacks */
-	ot->exec= duplicate_exec;
-	ot->poll= ED_operator_editsurfcurve;
+	ot->exec = duplicate_exec;
+	ot->poll = ED_operator_editsurfcurve;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************** delete operator *********************/
@@ -5559,14 +5632,15 @@ static int delete_exec(bContext *C, wmOperator *op)
 	int a, cut= 0, type= RNA_enum_get(op->ptr, "type");
 	int nuindex= 0;
 
-	if(obedit->type==OB_SURF) {
-		if(type==0) {
+	if (obedit->type==OB_SURF) {
+		if (type==0) {
 			deleteflagNurb(C, op, 1);
-		} else {
+		}
+		else {
 			keyIndex_delNurbList(editnurb, nubase);
 			freeNurblist(nubase);
 
-			if(ED_curve_updateAnimPaths(obedit))
+			if (ED_curve_updateAnimPaths(obedit->data))
 				WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
 		}
 
@@ -5576,24 +5650,24 @@ static int delete_exec(bContext *C, wmOperator *op)
 		return OPERATOR_FINISHED;
 	}
 
-	if(type==0) {
+	if (type==0) {
 		/* first loop, can we remove entire pieces? */
 		Nurb *next;
 		nu= nubase->first;
-		while(nu) {
+		while (nu) {
 			next= nu->next;
-			if(nu->type == CU_BEZIER) {
+			if (nu->type == CU_BEZIER) {
 				bezt= nu->bezt;
 				a= nu->pntsu;
-				if(a) {
-					while(a) {
-						if( BEZSELECTED_HIDDENHANDLES(cu, bezt) );
+				if (a) {
+					while (a) {
+						if ( BEZSELECTED_HIDDENHANDLES(cu, bezt) );
 						else break;
 						a--;
 						bezt++;
 					}
-					if(a==0) {
-						if(cu->actnu == nuindex)
+					if (a==0) {
+						if (cu->actnu == nuindex)
 							cu->actnu= -1;
 
 						BLI_remlink(nubase, nu);
@@ -5605,15 +5679,15 @@ static int delete_exec(bContext *C, wmOperator *op)
 			else {
 				bp= nu->bp;
 				a= nu->pntsu*nu->pntsv;
-				if(a) {
-					while(a) {
-						if(bp->f1 & SELECT);
+				if (a) {
+					while (a) {
+						if (bp->f1 & SELECT);
 						else break;
 						a--;
 						bp++;
 					}
-					if(a==0) {
-						if(cu->actnu == nuindex)
+					if (a==0) {
+						if (cu->actnu == nuindex)
 							cu->actnu= -1;
 
 						BLI_remlink(nubase, nu);
@@ -5624,25 +5698,25 @@ static int delete_exec(bContext *C, wmOperator *op)
 			}
 			
 			/* Never allow the order to exceed the number of points
-			- note, this is ok but changes unselected nurbs, disable for now */
-			/*
+			 * - note, this is ok but changes unselected nurbs, disable for now */
+#if 0
 			if ((nu!= NULL) && (nu->type == CU_NURBS)) {
 				clamp_nurb_order_u(nu);
 			}
-			*/
+#endif
 			nu= next;
 			nuindex++;
 		}
 		/* 2nd loop, delete small pieces: just for curves */
 		nu= nubase->first;
-		while(nu) {
+		while (nu) {
 			next= nu->next;
 			type= 0;
-			if(nu->type == CU_BEZIER) {
+			if (nu->type == CU_BEZIER) {
 				int delta= 0;
 				bezt= nu->bezt;
-				for(a=0;a<nu->pntsu;a++) {
-					if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) {
+				for (a=0;a<nu->pntsu;a++) {
+					if ( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) {
 						memmove(bezt, bezt+1, (nu->pntsu-a-1)*sizeof(BezTriple));
 						keyIndex_delBezt(editnurb, bezt + delta);
 						keyIndex_updateBezt(editnurb, bezt + 1, bezt, nu->pntsu-a-1);
@@ -5653,7 +5727,7 @@ static int delete_exec(bContext *C, wmOperator *op)
 					}
 					else bezt++;
 				}
-				if(type) {
+				if (type) {
 					bezt1 =
 						(BezTriple*)MEM_mallocN((nu->pntsu) * sizeof(BezTriple), "delNurb");
 					memcpy(bezt1, nu->bezt, (nu->pntsu)*sizeof(BezTriple) );
@@ -5663,12 +5737,12 @@ static int delete_exec(bContext *C, wmOperator *op)
 					calchandlesNurb(nu);
 				}
 			}
-			else if(nu->pntsv==1) {
+			else if (nu->pntsv==1) {
 				int delta= 0;
 				bp= nu->bp;
 				
-				for(a=0;a<nu->pntsu;a++) {
-					if( bp->f1 & SELECT ) {
+				for (a=0;a<nu->pntsu;a++) {
+					if ( bp->f1 & SELECT ) {
 						memmove(bp, bp+1, (nu->pntsu-a-1)*sizeof(BPoint));
 						keyIndex_delBP(editnurb, bp + delta);
 						keyIndex_updateBP(editnurb, bp+1, bp, nu->pntsu-a-1);
@@ -5681,19 +5755,20 @@ static int delete_exec(bContext *C, wmOperator *op)
 						bp++;
 					}
 				}
-				if(type) {
+				if (type) {
 					bp1 = (BPoint*)MEM_mallocN(nu->pntsu * sizeof(BPoint), "delNurb2");
 					memcpy(bp1, nu->bp, (nu->pntsu)*sizeof(BPoint) );
 					keyIndex_updateBP(editnurb, nu->bp, bp1, nu->pntsu);
 					MEM_freeN(nu->bp);
 					nu->bp= bp1;
 					
-					/* Never allow the order to exceed the number of points\
-					- note, this is ok but changes unselected nurbs, disable for now */
-					/*
+					/* Never allow the order to exceed the number of points
+					 * - note, this is ok but changes unselected nurbs, disable for now */
+#if 0
 					if (nu->type == CU_NURBS) {
 						clamp_nurb_order_u(nu);
-					}*/
+					}
+#endif
 				}
 				clamp_nurb_order_u(nu);
 				nurbs_knot_calc_u(nu);
@@ -5701,24 +5776,26 @@ static int delete_exec(bContext *C, wmOperator *op)
 			nu= next;
 		}
 	}
-	else if(type==1) {	/* erase segment */
+	else if (type==1) {	/* erase segment */
 		/* find the 2 selected points */
 		bezt1= bezt2= NULL;
 		bp1= bp2= NULL;
 		nu1= NULL;
 		nuindex= 0;
-		for(nu= nubase->first; nu; nu= nu->next) {
-			if(nu->type == CU_BEZIER) {
+		for (nu= nubase->first; nu; nu= nu->next) {
+			if (nu->type == CU_BEZIER) {
 				bezt= nu->bezt;
-				for(a=0; a<nu->pntsu-1; a++) {
-					if( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) {
+				for (a=0; a<nu->pntsu-1; a++) {
+					if ( BEZSELECTED_HIDDENHANDLES(cu, bezt) ) {
 						bezt1= bezt;
 						bezt2= bezt+1;
-						if( (bezt2->f1 & SELECT) || (bezt2->f2 & SELECT) || (bezt2->f3 & SELECT) ) ;
+						if ((bezt2->f1 & SELECT) || (bezt2->f2 & SELECT) || (bezt2->f3 & SELECT)) {
+							/* pass */
+						}
 						else {	/* maybe do not make cyclic */
-							if(a==0 && (nu->flagu & CU_NURB_CYCLIC) ) {
+							if (a==0 && (nu->flagu & CU_NURB_CYCLIC) ) {
 								bezt2= bezt+(nu->pntsu-1);
-								if( (bezt2->f1 & SELECT) || (bezt2->f2 & SELECT) || (bezt2->f3 & SELECT) ) {
+								if ( (bezt2->f1 & SELECT) || (bezt2->f2 & SELECT) || (bezt2->f3 & SELECT) ) {
 									nu->flagu &= ~CU_NURB_CYCLIC;
 									calchandlesNurb(nu);
 									WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -5735,17 +5812,19 @@ static int delete_exec(bContext *C, wmOperator *op)
 					bezt++;
 				}
 			}
-			else if(nu->pntsv==1) {
+			else if (nu->pntsv==1) {
 				bp= nu->bp;
-				for(a=0; a<nu->pntsu-1; a++) {
-					if( bp->f1 & SELECT ) {
+				for (a=0; a<nu->pntsu-1; a++) {
+					if ( bp->f1 & SELECT ) {
 						bp1= bp;
 						bp2= bp+1;
-						if( bp2->f1 & 1 ) ;
+						if (bp2->f1 & 1) {
+							/* pass */
+						}
 						else {	/* maybe do not make cyclic */
-							if(a==0 && (nu->flagu & CU_NURB_CYCLIC) ) {
+							if (a==0 && (nu->flagu & CU_NURB_CYCLIC) ) {
 								bp2= bp+(nu->pntsu-1);
-								if( bp2->f1 & SELECT ) {
+								if ( bp2->f1 & SELECT ) {
 									nu->flagu &= ~CU_NURB_CYCLIC;
 									WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 									DAG_id_tag_update(obedit->data, 0);
@@ -5761,19 +5840,19 @@ static int delete_exec(bContext *C, wmOperator *op)
 					bp++;
 				}
 			}
-			if(nu1) break;
+			if (nu1) break;
 			nuindex++;
 		}
-		if(nu1) {
-			if(bezt1) {
-				if(nu1->pntsu==2) {	/* remove completely */
-					if(cu->actnu == nuindex)
+		if (nu1) {
+			if (bezt1) {
+				if (nu1->pntsu==2) {	/* remove completely */
+					if (cu->actnu == nuindex)
 						cu->actnu= -1;
 
 					BLI_remlink(nubase, nu);
 					freeNurb(nu); nu = NULL;
 				}
-				else if(nu1->flagu & CU_NURB_CYCLIC) {	/* cyclic */
+				else if (nu1->flagu & CU_NURB_CYCLIC) {	/* cyclic */
 					bezt =
 						(BezTriple*)MEM_mallocN((cut+1) * sizeof(BezTriple), "delNurb1");
 					ED_curve_beztcpy(editnurb, bezt, nu1->bezt, cut+1);
@@ -5811,15 +5890,15 @@ static int delete_exec(bContext *C, wmOperator *op)
 					calchandlesNurb(nu1);
 				}
 			}
-			else if(bp1) {
-				if(nu1->pntsu==2) {	/* remove completely */
-					if(cu->actnu == nuindex)
+			else if (bp1) {
+				if (nu1->pntsu==2) {	/* remove completely */
+					if (cu->actnu == nuindex)
 						cu->actnu= -1;
 
 					BLI_remlink(nubase, nu);
 					freeNurb(nu); nu= NULL;
 				}
-				else if(nu1->flagu & CU_NURB_CYCLIC) {	/* cyclic */
+				else if (nu1->flagu & CU_NURB_CYCLIC) {	/* cyclic */
 					bp =
 						(BPoint*)MEM_mallocN((cut+1) * sizeof(BPoint), "delNurb5");
 					ED_curve_bpcpy(editnurb, bp, nu1->bp, cut+1);
@@ -5856,13 +5935,13 @@ static int delete_exec(bContext *C, wmOperator *op)
 			}
 		}
 	}
-	else if(type==2) {
+	else if (type==2) {
 		cu->actnu= -1;
 		keyIndex_delNurbList(editnurb, nubase);
 		freeNurblist(nubase);
 	}
 
-	if(ED_curve_updateAnimPaths(obedit))
+	if (ED_curve_updateAnimPaths(obedit->data))
 		WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
 
 	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -5877,7 +5956,7 @@ static int delete_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 	uiPopupMenu *pup;
 	uiLayout *layout;
 
-	if(obedit->type==OB_SURF) {
+	if (obedit->type==OB_SURF) {
 		pup= uiPupMenuBegin(C, "Delete", ICON_NONE);
 		layout= uiPupMenuLayout(pup);
 		uiItemEnumO_ptr(layout, op->type, NULL, 0, "type", 0);
@@ -5903,17 +5982,17 @@ void CURVE_OT_delete(wmOperatorType *ot)
 		{0, NULL, 0, NULL, NULL}};
 
 	/* identifiers */
-	ot->name= "Delete";
+	ot->name = "Delete";
 	ot->description = "Delete selected control points or segments";
-	ot->idname= "CURVE_OT_delete";
+	ot->idname = "CURVE_OT_delete";
 	
 	/* api callbacks */
-	ot->exec= delete_exec;
-	ot->invoke= delete_invoke;
-	ot->poll= ED_operator_editsurfcurve;
+	ot->exec = delete_exec;
+	ot->invoke = delete_invoke;
+	ot->poll = ED_operator_editsurfcurve;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "Which elements to delete");
@@ -5928,12 +6007,12 @@ static int shade_smooth_exec(bContext *C, wmOperator *op)
 	Nurb *nu;
 	int clear= (strcmp(op->idname, "CURVE_OT_shade_flat") == 0);
 	
-	if(obedit->type != OB_CURVE)
+	if (obedit->type != OB_CURVE)
 		return OPERATOR_CANCELLED;
 	
-	for(nu= editnurb->first; nu; nu= nu->next) {
-		if(isNurbsel(nu)) {
-			if(!clear) nu->flag |= CU_SMOOTH;
+	for (nu= editnurb->first; nu; nu= nu->next) {
+		if (isNurbsel(nu)) {
+			if (!clear) nu->flag |= CU_SMOOTH;
 			else nu->flag &= ~CU_SMOOTH;
 		}
 	}
@@ -5947,29 +6026,29 @@ static int shade_smooth_exec(bContext *C, wmOperator *op)
 void CURVE_OT_shade_smooth(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Shade Smooth";
-	ot->idname= "CURVE_OT_shade_smooth";
+	ot->name = "Shade Smooth";
+	ot->idname = "CURVE_OT_shade_smooth";
 	
 	/* api callbacks */
-	ot->exec= shade_smooth_exec;
-	ot->poll= ED_operator_editsurfcurve;
+	ot->exec = shade_smooth_exec;
+	ot->poll = ED_operator_editsurfcurve;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 void CURVE_OT_shade_flat(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Shade Flat";
-	ot->idname= "CURVE_OT_shade_flat";
+	ot->name = "Shade Flat";
+	ot->idname = "CURVE_OT_shade_flat";
 	
 	/* api callbacks */
-	ot->exec= shade_smooth_exec;
-	ot->poll= ED_operator_editsurfcurve;
+	ot->exec = shade_smooth_exec;
+	ot->poll = ED_operator_editsurfcurve;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /************** join operator, to be used externally? ****************/
@@ -5993,26 +6072,27 @@ int join_curve_exec(bContext *C, wmOperator *UNUSED(op))
 	invert_m4_m4(imat, ob->obmat);
 	
 	CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
-		if(base->object->type==ob->type) {
-			if(base->object != ob) {
+		if (base->object->type==ob->type) {
+			if (base->object != ob) {
 			
 				cu= base->object->data;
 			
-				if(cu->nurb.first) {
+				if (cu->nurb.first) {
 					/* watch it: switch order here really goes wrong */
 					mult_m4_m4m4(cmat, imat, base->object->obmat);
 					
 					nu= cu->nurb.first;
-					while(nu) {
+					while (nu) {
 						newnu= duplicateNurb(nu);
-						if(ob->totcol) { /* TODO, merge material lists */
+						if (ob->totcol) { /* TODO, merge material lists */
 							CLAMP(newnu->mat_nr, 0, ob->totcol-1);
-						} else newnu->mat_nr= 0;
+						}
+						else newnu->mat_nr= 0;
 						BLI_addtail(&tempbase, newnu);
 						
-						if( (bezt= newnu->bezt) ) {
+						if ( (bezt= newnu->bezt) ) {
 							a= newnu->pntsu;
-							while(a--) {
+							while (a--) {
 								mul_m4_v3(cmat, bezt->vec[0]);
 								mul_m4_v3(cmat, bezt->vec[1]);
 								mul_m4_v3(cmat, bezt->vec[2]);
@@ -6020,9 +6100,9 @@ int join_curve_exec(bContext *C, wmOperator *UNUSED(op))
 							}
 							calchandlesNurb(newnu);
 						}
-						if( (bp= newnu->bp) ) {
+						if ( (bp= newnu->bp) ) {
 							a= newnu->pntsu*nu->pntsv;
-							while(a--) {
+							while (a--) {
 								mul_m4_v3(cmat, bp->vec);
 								bp++;
 							}
@@ -6056,7 +6136,7 @@ static const char *get_curve_defname(int type)
 {
 	int stype= type & CU_PRIMITIVE;
 
-	if((type & CU_TYPE)==CU_BEZIER) {
+	if ((type & CU_TYPE)==CU_BEZIER) {
 		switch (stype) {
 			case CU_PRIM_CURVE: return "BezierCurve";
 			case CU_PRIM_CIRCLE: return "BezierCircle";
@@ -6112,7 +6192,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
 	const int stype= (type & CU_PRIMITIVE);
 	const int force_3d = ((Curve *)obedit->data)->flag & CU_3D; /* could be adding to an existing 3D curve */
 
-	if(rv3d) {
+	if (rv3d) {
 		copy_m4_m4(viewmat, rv3d->viewmat);
 		copy_v3_v3(zvec, rv3d->viewinv[2]);
 	}
@@ -6130,7 +6210,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
 	switch(stype) {
 	case CU_PRIM_CURVE:	/* curve */
 		nu->resolu= cu->resolu;
-		if(cutype==CU_BEZIER) {
+		if (cutype==CU_BEZIER) {
 			if (!force_3d) nu->flag |= CU_2D;
 			nu->pntsu= 2;
 			nu->bezt =
@@ -6145,7 +6225,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
 			bezt->vec[0][1]+= -0.5f*grid;
 			bezt->vec[2][0]+= -0.5f*grid;
 			bezt->vec[2][1]+=  0.5f*grid;
-			for(a=0;a<3;a++) mul_m4_v3(mat, bezt->vec[a]);
+			for (a=0;a<3;a++) mul_m4_v3(mat, bezt->vec[a]);
 
 			bezt++;
 			bezt->h1= bezt->h2= HD_ALIGN;
@@ -6158,7 +6238,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
 			bezt->vec[1][1] = 0;
 			bezt->vec[2][0] = grid*2;
 			bezt->vec[2][1] = 0;
-			for(a=0;a<3;a++) mul_m4_v3(mat, bezt->vec[a]);
+			for (a=0;a<3;a++) mul_m4_v3(mat, bezt->vec[a]);
 
 			calchandlesNurb(nu);
 		}
@@ -6170,7 +6250,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
 			nu->bp= callocstructN(BPoint, 4, "addNurbprim3");
 
 			bp= nu->bp;
-			for(a=0;a<4;a++, bp++) {
+			for (a=0;a<4;a++, bp++) {
 				bp->vec[3]= 1.0;
 				bp->f1= SELECT;
 				bp->radius = bp->weight = 1.0;
@@ -6188,9 +6268,9 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
 			bp->vec[0]+= 1.5f*grid;
 
 			bp= nu->bp;
-			for(a=0;a<4;a++, bp++) mul_m4_v3(mat,bp->vec);
+			for (a=0;a<4;a++, bp++) mul_m4_v3(mat,bp->vec);
 
-			if(cutype==CU_NURBS) {
+			if (cutype==CU_NURBS) {
 				nu->knotsu= NULL;	/* nurbs_knot_calc_u allocates */
 				nurbs_knot_calc_u(nu);
 			}
@@ -6206,7 +6286,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
 		nu->bp= callocstructN(BPoint, 5, "addNurbprim3");
 
 		bp= nu->bp;
-		for(a=0;a<5;a++, bp++) {
+		for (a=0;a<5;a++, bp++) {
 			bp->vec[3]= 1.0;
 			bp->f1= SELECT;
 			bp->radius = bp->weight = 1.0;
@@ -6222,9 +6302,9 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
 		bp->vec[0]+= 2.0f*grid;
 
 		bp= nu->bp;
-		for(a=0;a<5;a++, bp++) mul_m4_v3(mat,bp->vec);
+		for (a=0;a<5;a++, bp++) mul_m4_v3(mat,bp->vec);
 
-		if(cutype==CU_NURBS) {
+		if (cutype==CU_NURBS) {
 			nu->knotsu= NULL;	/* nurbs_knot_calc_u allocates */
 			nurbs_knot_calc_u(nu);
 		}
@@ -6233,7 +6313,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
 	case CU_PRIM_CIRCLE:	/* circle */
 		nu->resolu= cu->resolu;
 
-		if(cutype==CU_BEZIER) {
+		if (cutype==CU_BEZIER) {
 			if (!force_3d) nu->flag |= CU_2D;
 			nu->pntsu= 4;
 			nu->bezt= callocstructN(BezTriple, 4, "addNurbprim1");
@@ -6243,33 +6323,33 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
 			bezt->h1= bezt->h2= HD_AUTO;
 			bezt->f1= bezt->f2= bezt->f3= SELECT;
 			bezt->vec[1][0]+= -grid;
-			for(a=0;a<3;a++) mul_m4_v3(mat,bezt->vec[a]);
+			for (a=0;a<3;a++) mul_m4_v3(mat,bezt->vec[a]);
 			bezt->radius = bezt->weight = 1.0;
 			
 			bezt++;
 			bezt->h1= bezt->h2= HD_AUTO;
 			bezt->f1= bezt->f2= bezt->f3= SELECT;
 			bezt->vec[1][1]+= grid;
-			for(a=0;a<3;a++) mul_m4_v3(mat,bezt->vec[a]);
+			for (a=0;a<3;a++) mul_m4_v3(mat,bezt->vec[a]);
 			bezt->radius = bezt->weight = 1.0;
 
 			bezt++;
 			bezt->h1= bezt->h2= HD_AUTO;
 			bezt->f1= bezt->f2= bezt->f3= SELECT;
 			bezt->vec[1][0]+= grid;
-			for(a=0;a<3;a++) mul_m4_v3(mat,bezt->vec[a]);
+			for (a=0;a<3;a++) mul_m4_v3(mat,bezt->vec[a]);
 			bezt->radius = bezt->weight = 1.0;
 
 			bezt++;
 			bezt->h1= bezt->h2= HD_AUTO;
 			bezt->f1= bezt->f2= bezt->f3= SELECT;
 			bezt->vec[1][1]+= -grid;
-			for(a=0;a<3;a++) mul_m4_v3(mat,bezt->vec[a]);
+			for (a=0;a<3;a++) mul_m4_v3(mat,bezt->vec[a]);
 			bezt->radius = bezt->weight = 1.0;
 
 			calchandlesNurb(nu);
 		}
-		else if( cutype==CU_NURBS ) {  /* nurb */
+		else if ( cutype==CU_NURBS ) {  /* nurb */
 			nu->pntsu= 8;
 			nu->pntsv= 1;
 			nu->orderu= 4;
@@ -6277,9 +6357,9 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
 			nu->flagu= CU_NURB_CYCLIC;
 			bp= nu->bp;
 
-			for(a=0; a<8; a++) {
+			for (a=0; a<8; a++) {
 				bp->f1= SELECT;
-				if(xzproj==0) {
+				if (xzproj==0) {
 					bp->vec[0]+= nurbcircle[a][0]*grid;
 					bp->vec[1]+= nurbcircle[a][1]*grid;
 				}
@@ -6287,7 +6367,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
 					bp->vec[0]+= 0.25f*nurbcircle[a][0]*grid-0.75f*grid;
 					bp->vec[2]+= 0.25f*nurbcircle[a][1]*grid;
 				}
-				if(a & 1) bp->vec[3]= 0.25*M_SQRT2;
+				if (a & 1) bp->vec[3]= 0.25*M_SQRT2;
 				else bp->vec[3]= 1.0;
 				mul_m4_v3(mat,bp->vec);
 				bp->radius = bp->weight = 1.0;
@@ -6299,7 +6379,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
 		}
 		break;
 	case CU_PRIM_PATCH:	/* 4x4 patch */
-		if( cutype==CU_NURBS ) {  /* nurb */
+		if ( cutype==CU_NURBS ) {  /* nurb */
 
 			nu->pntsu= 4;
 			nu->pntsv= 4;
@@ -6311,14 +6391,14 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
 			nu->flagv= 0;
 			bp= nu->bp;
 
-			for(a=0; a<4; a++) {
-				for(b=0; b<4; b++) {
+			for (a=0; a<4; a++) {
+				for (b=0; b<4; b++) {
 					bp->f1= SELECT;
 					fac= (float)a -1.5f;
 					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) {
+					if (a==1 || a==2) if (b==1 || b==2) {
 						bp->vec[2]+= grid;
 					}
 					mul_m4_v3(mat,bp->vec);
@@ -6332,7 +6412,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
 		}
 		break;
 	case CU_PRIM_TUBE:	/* Cylinder */
-		if( cutype==CU_NURBS ) {
+		if ( cutype==CU_NURBS ) {
 			nu= add_nurbs_primitive(C, mat, CU_NURBS|CU_PRIM_CIRCLE, 0);  /* circle */
 			nu->resolu= cu->resolu;
 			nu->flag= CU_SMOOTH;
@@ -6340,7 +6420,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
 			vec[0]=vec[1]= 0.0;
 			vec[2]= -grid;
 			
-			if(newob && (U.flag & USER_ADD_VIEWALIGNED) == 0) {
+			if (newob && (U.flag & USER_ADD_VIEWALIGNED) == 0) {
 				/* pass */
 			}
 			else {
@@ -6358,14 +6438,14 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
 
 			a= nu->pntsu*nu->pntsv;
 			bp= nu->bp;
-			while(a-- >0) {
+			while (a-- >0) {
 				bp->f1 |= SELECT;
 				bp++;
 			}
 		}
 		break;
 	case CU_PRIM_SPHERE:	/* sphere */
-		if( cutype==CU_NURBS ) {
+		if ( cutype==CU_NURBS ) {
 			float tmp_cent[3] = {0.f, 0.f, 0.f};
 			float tmp_vec[3] = {0.f, 0.f, 1.f};
 			
@@ -6379,11 +6459,11 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
 			nu->flagu= 0;
 			bp= nu->bp;
 
-			for(a=0; a<5; a++) {
+			for (a=0; a<5; a++) {
 				bp->f1= SELECT;
 				bp->vec[0]+= nurbcircle[a][0]*grid;
 				bp->vec[2]+= nurbcircle[a][1]*grid;
-				if(a & 1) bp->vec[3]= 0.5*M_SQRT2;
+				if (a & 1) bp->vec[3]= 0.5*M_SQRT2;
 				else bp->vec[3]= 1.0;
 				mul_m4_v3(mat,bp->vec);
 				bp++;
@@ -6393,7 +6473,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
 
 			BLI_addtail(editnurb, nu); /* temporal for spin */
 
-			if(newob && (U.flag & USER_ADD_VIEWALIGNED) == 0)	spin_nurb(umat, obedit, tmp_vec, tmp_cent);
+			if (newob && (U.flag & USER_ADD_VIEWALIGNED) == 0)	spin_nurb(umat, obedit, tmp_vec, tmp_cent);
 			else if ((U.flag & USER_ADD_VIEWALIGNED))			spin_nurb(viewmat, obedit, zvec, mat[3]);
 			else												spin_nurb(umat, obedit, tmp_vec, mat[3]);
 
@@ -6401,7 +6481,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
 
 			a= nu->pntsu*nu->pntsv;
 			bp= nu->bp;
-			while(a-- >0) {
+			while (a-- >0) {
 				bp->f1 |= SELECT;
 				bp++;
 			}
@@ -6409,7 +6489,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
 		}
 		break;
 	case CU_PRIM_DONUT:	/* torus */
-		if( cutype==CU_NURBS ) {
+		if ( cutype==CU_NURBS ) {
 			float tmp_cent[3] = {0.f, 0.f, 0.f};
 			float tmp_vec[3] = {0.f, 0.f, 1.f};
 			
@@ -6422,7 +6502,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
 			BLI_addtail(editnurb, nu); /* temporal for spin */
 
 			/* same as above */
-			if(newob && (U.flag & USER_ADD_VIEWALIGNED) == 0)	spin_nurb(umat, obedit, tmp_vec, tmp_cent);
+			if (newob && (U.flag & USER_ADD_VIEWALIGNED) == 0)	spin_nurb(umat, obedit, tmp_vec, tmp_cent);
 			else if ((U.flag & USER_ADD_VIEWALIGNED))			spin_nurb(viewmat, obedit, zvec, mat[3]);
 			else												spin_nurb(umat, obedit, tmp_vec, mat[3]);
 
@@ -6431,7 +6511,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
 
 			a= nu->pntsu*nu->pntsv;
 			bp= nu->bp;
-			while(a-- >0) {
+			while (a-- >0) {
 				bp->f1 |= SELECT;
 				bp++;
 			}
@@ -6446,7 +6526,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
 
 	BLI_assert(nu != NULL);
 
-	if(nu) { /* should always be set */
+	if (nu) { /* should always be set */
 		nu->flag |= CU_SMOOTH;
 
 		test2DNurb(nu);
@@ -6461,16 +6541,16 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
 	ListBase *editnurb;
 	Nurb *nu;
 	int newob= 0;
-	int enter_editmode;
+	int enter_editmode, is_aligned;
 	unsigned int layer;
 	float loc[3], rot[3];
 	float mat[4][4];
 
-	if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer))
+	if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, &is_aligned))
 		return OPERATOR_CANCELLED;
 
 	if (!isSurf) { /* adding curve */
-		if(obedit==NULL || obedit->type!=OB_CURVE) {
+		if (obedit==NULL || obedit->type!=OB_CURVE) {
 			Curve *cu;
 			
 			obedit= ED_object_add_type(C, OB_CURVE, loc, rot, TRUE, layer);
@@ -6479,13 +6559,13 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
 			cu= (Curve*)obedit->data;
 			cu->flag |= CU_DEFORM_FILL;
 			
-			if(type & CU_PRIM_PATH)
+			if (type & CU_PRIM_PATH)
 				cu->flag |= CU_PATH|CU_3D;
 		} 
 		else DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
 	} 
 	else { /* adding surface */
-		if(obedit==NULL || obedit->type!=OB_SURF) {
+		if (obedit==NULL || obedit->type!=OB_SURF) {
 			obedit= ED_object_add_type(C, OB_SURF, loc, rot, TRUE, layer);
 			newob = 1;
 		} 
@@ -6493,9 +6573,9 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
 	}
 
 	/* rename here, the undo stack checks name for valid undo pushes */
-	if(newob) {
+	if (newob) {
 
-		if(obedit->type==OB_CURVE) {
+		if (obedit->type==OB_CURVE) {
 			rename_id((ID *)obedit, get_curve_defname(type));
 			rename_id((ID *)obedit->data, get_curve_defname(type));
 		}
@@ -6506,7 +6586,7 @@ static int curvesurf_prim_add(bContext *C, wmOperator *op, int type, int isSurf)
 	}
 	
 	/* ED_object_add_type doesnt do an undo, is needed for redo operator on primitive */
-	if(newob && enter_editmode)
+	if (newob && enter_editmode)
 		ED_undo_push(C, "Enter Editmode");
 	
 	ED_object_new_primitive_matrix(C, obedit, loc, rot, mat);
@@ -6545,17 +6625,17 @@ static int add_primitive_bezier_exec(bContext *C, wmOperator *op)
 void CURVE_OT_primitive_bezier_curve_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Bezier";
-	ot->description= "Construct a Bezier Curve";
-	ot->idname= "CURVE_OT_primitive_bezier_curve_add";
+	ot->name = "Add Bezier";
+	ot->description = "Construct a Bezier Curve";
+	ot->idname = "CURVE_OT_primitive_bezier_curve_add";
 	
 	/* api callbacks */
-	ot->invoke= ED_object_add_generic_invoke;
-	ot->exec= add_primitive_bezier_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->invoke = ED_object_add_generic_invoke;
+	ot->exec = add_primitive_bezier_exec;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	ED_object_add_generic_props(ot, TRUE);
 }
@@ -6568,17 +6648,17 @@ static int add_primitive_bezier_circle_exec(bContext *C, wmOperator *op)
 void CURVE_OT_primitive_bezier_circle_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Bezier Circle";
-	ot->description= "Construct a Bezier Circle";
-	ot->idname= "CURVE_OT_primitive_bezier_circle_add";
+	ot->name = "Add Bezier Circle";
+	ot->description = "Construct a Bezier Circle";
+	ot->idname = "CURVE_OT_primitive_bezier_circle_add";
 	
 	/* api callbacks */
-	ot->invoke= ED_object_add_generic_invoke;
-	ot->exec= add_primitive_bezier_circle_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->invoke = ED_object_add_generic_invoke;
+	ot->exec = add_primitive_bezier_circle_exec;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	ED_object_add_generic_props(ot, TRUE);
 }
@@ -6591,17 +6671,17 @@ static int add_primitive_nurbs_curve_exec(bContext *C, wmOperator *op)
 void CURVE_OT_primitive_nurbs_curve_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Nurbs Curve";
-	ot->description= "Construct a Nurbs Curve";
-	ot->idname= "CURVE_OT_primitive_nurbs_curve_add";
+	ot->name = "Add Nurbs Curve";
+	ot->description = "Construct a Nurbs Curve";
+	ot->idname = "CURVE_OT_primitive_nurbs_curve_add";
 	
 	/* api callbacks */
-	ot->invoke= ED_object_add_generic_invoke;
-	ot->exec= add_primitive_nurbs_curve_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->invoke = ED_object_add_generic_invoke;
+	ot->exec = add_primitive_nurbs_curve_exec;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	ED_object_add_generic_props(ot, TRUE);
 }
@@ -6614,17 +6694,17 @@ static int add_primitive_nurbs_circle_exec(bContext *C, wmOperator *op)
 void CURVE_OT_primitive_nurbs_circle_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Nurbs Circle";
-	ot->description= "Construct a Nurbs Circle";
-	ot->idname= "CURVE_OT_primitive_nurbs_circle_add";
+	ot->name = "Add Nurbs Circle";
+	ot->description = "Construct a Nurbs Circle";
+	ot->idname = "CURVE_OT_primitive_nurbs_circle_add";
 	
 	/* api callbacks */
-	ot->invoke= ED_object_add_generic_invoke;
-	ot->exec= add_primitive_nurbs_circle_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->invoke = ED_object_add_generic_invoke;
+	ot->exec = add_primitive_nurbs_circle_exec;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	ED_object_add_generic_props(ot, TRUE);
 }
@@ -6637,17 +6717,17 @@ static int add_primitive_curve_path_exec(bContext *C, wmOperator *op)
 void CURVE_OT_primitive_nurbs_path_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Path";
-	ot->description= "Construct a Path";
-	ot->idname= "CURVE_OT_primitive_nurbs_path_add";
+	ot->name = "Add Path";
+	ot->description = "Construct a Path";
+	ot->idname = "CURVE_OT_primitive_nurbs_path_add";
 	
 	/* api callbacks */
-	ot->invoke= ED_object_add_generic_invoke;
-	ot->exec= add_primitive_curve_path_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->invoke = ED_object_add_generic_invoke;
+	ot->exec = add_primitive_curve_path_exec;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	ED_object_add_generic_props(ot, TRUE);
 }
@@ -6661,17 +6741,17 @@ static int add_primitive_nurbs_surface_curve_exec(bContext *C, wmOperator *op)
 void SURFACE_OT_primitive_nurbs_surface_curve_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Surface Curve";
-	ot->description= "Construct a Nurbs surface Curve";
-	ot->idname= "SURFACE_OT_primitive_nurbs_surface_curve_add";
+	ot->name = "Add Surface Curve";
+	ot->description = "Construct a Nurbs surface Curve";
+	ot->idname = "SURFACE_OT_primitive_nurbs_surface_curve_add";
 	
 	/* api callbacks */
-	ot->invoke= ED_object_add_generic_invoke;
-	ot->exec= add_primitive_nurbs_surface_curve_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->invoke = ED_object_add_generic_invoke;
+	ot->exec = add_primitive_nurbs_surface_curve_exec;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	ED_object_add_generic_props(ot, TRUE);
 }
@@ -6684,17 +6764,17 @@ static int add_primitive_nurbs_surface_circle_exec(bContext *C, wmOperator *op)
 void SURFACE_OT_primitive_nurbs_surface_circle_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Surface Circle";
-	ot->description= "Construct a Nurbs surface Circle";
-	ot->idname= "SURFACE_OT_primitive_nurbs_surface_circle_add";
+	ot->name = "Add Surface Circle";
+	ot->description = "Construct a Nurbs surface Circle";
+	ot->idname = "SURFACE_OT_primitive_nurbs_surface_circle_add";
 	
 	/* api callbacks */
-	ot->invoke= ED_object_add_generic_invoke;
-	ot->exec= add_primitive_nurbs_surface_circle_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->invoke = ED_object_add_generic_invoke;
+	ot->exec = add_primitive_nurbs_surface_circle_exec;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	ED_object_add_generic_props(ot, TRUE);
 }
@@ -6707,17 +6787,17 @@ static int add_primitive_nurbs_surface_surface_exec(bContext *C, wmOperator *op)
 void SURFACE_OT_primitive_nurbs_surface_surface_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Surface Patch";
-	ot->description= "Construct a Nurbs surface Patch";
-	ot->idname= "SURFACE_OT_primitive_nurbs_surface_surface_add";
+	ot->name = "Add Surface Patch";
+	ot->description = "Construct a Nurbs surface Patch";
+	ot->idname = "SURFACE_OT_primitive_nurbs_surface_surface_add";
 	
 	/* api callbacks */
-	ot->invoke= ED_object_add_generic_invoke;
-	ot->exec= add_primitive_nurbs_surface_surface_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->invoke = ED_object_add_generic_invoke;
+	ot->exec = add_primitive_nurbs_surface_surface_exec;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	ED_object_add_generic_props(ot, TRUE);
 }
@@ -6730,17 +6810,17 @@ static int add_primitive_nurbs_surface_cylinder_exec(bContext *C, wmOperator *op
 void SURFACE_OT_primitive_nurbs_surface_cylinder_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Surface Cylinder";
-	ot->description= "Construct a Nurbs surface Cylinder";
-	ot->idname= "SURFACE_OT_primitive_nurbs_surface_cylinder_add";
+	ot->name = "Add Surface Cylinder";
+	ot->description = "Construct a Nurbs surface Cylinder";
+	ot->idname = "SURFACE_OT_primitive_nurbs_surface_cylinder_add";
 	
 	/* api callbacks */
-	ot->invoke= ED_object_add_generic_invoke;
-	ot->exec= add_primitive_nurbs_surface_cylinder_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->invoke = ED_object_add_generic_invoke;
+	ot->exec = add_primitive_nurbs_surface_cylinder_exec;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	ED_object_add_generic_props(ot, TRUE);
 }
@@ -6753,17 +6833,17 @@ static int add_primitive_nurbs_surface_sphere_exec(bContext *C, wmOperator *op)
 void SURFACE_OT_primitive_nurbs_surface_sphere_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Surface Sphere";
-	ot->description= "Construct a Nurbs surface Sphere";
-	ot->idname= "SURFACE_OT_primitive_nurbs_surface_sphere_add";
+	ot->name = "Add Surface Sphere";
+	ot->description = "Construct a Nurbs surface Sphere";
+	ot->idname = "SURFACE_OT_primitive_nurbs_surface_sphere_add";
 	
 	/* api callbacks */
-	ot->invoke= ED_object_add_generic_invoke;
-	ot->exec= add_primitive_nurbs_surface_sphere_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->invoke = ED_object_add_generic_invoke;
+	ot->exec = add_primitive_nurbs_surface_sphere_exec;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	ED_object_add_generic_props(ot, TRUE);
 }
@@ -6776,17 +6856,17 @@ static int add_primitive_nurbs_surface_torus_exec(bContext *C, wmOperator *op)
 void SURFACE_OT_primitive_nurbs_surface_torus_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Surface Torus";
-	ot->description= "Construct a Nurbs surface Torus";
-	ot->idname= "SURFACE_OT_primitive_nurbs_surface_torus_add";
+	ot->name = "Add Surface Torus";
+	ot->description = "Construct a Nurbs surface Torus";
+	ot->idname = "SURFACE_OT_primitive_nurbs_surface_torus_add";
 	
 	/* api callbacks */
-	ot->invoke= ED_object_add_generic_invoke;
-	ot->exec= add_primitive_nurbs_surface_torus_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->invoke = ED_object_add_generic_invoke;
+	ot->exec = add_primitive_nurbs_surface_torus_exec;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	ED_object_add_generic_props(ot, TRUE);
 }
@@ -6803,20 +6883,20 @@ static int clear_tilt_exec(bContext *C, wmOperator *UNUSED(op))
 	BPoint *bp;
 	int a;
 
-	for(nu= editnurb->first; nu; nu= nu->next) {
-		if( nu->bezt ) {
+	for (nu= editnurb->first; nu; nu= nu->next) {
+		if ( nu->bezt ) {
 			bezt= nu->bezt;
 			a= nu->pntsu;
-			while(a--) {
-				if(BEZSELECTED_HIDDENHANDLES(cu, bezt)) bezt->alfa= 0.0;
+			while (a--) {
+				if (BEZSELECTED_HIDDENHANDLES(cu, bezt)) bezt->alfa= 0.0;
 				bezt++;
 			}
 		}
-		else if(nu->bp) {
+		else if (nu->bp) {
 			bp= nu->bp;
 			a= nu->pntsu*nu->pntsv;
-			while(a--) {
-				if(bp->f1 & SELECT) bp->alfa= 0.0;
+			while (a--) {
+				if (bp->f1 & SELECT) bp->alfa= 0.0;
 				bp++;
 			}
 		}
@@ -6831,15 +6911,15 @@ static int clear_tilt_exec(bContext *C, wmOperator *UNUSED(op))
 void CURVE_OT_tilt_clear(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear Tilt";
-	ot->idname= "CURVE_OT_tilt_clear";
+	ot->name = "Clear Tilt";
+	ot->idname = "CURVE_OT_tilt_clear";
 	
 	/* api callbacks */
-	ot->exec= clear_tilt_exec;
-	ot->poll= ED_operator_editcurve;
+	ot->exec = clear_tilt_exec;
+	ot->poll = ED_operator_editcurve;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /****************** undo for curves ****************/
@@ -6851,7 +6931,8 @@ static void *undo_check_lastsel(void *lastsel, Nurb *nu, Nurb *newnu)
 		if (lastbezt >= nu->bezt && lastbezt < nu->bezt + nu->pntsu) {
 			return newnu->bezt + (lastbezt - nu->bezt);
 		}
-	} else {
+	}
+	else {
 		BPoint *lastbp= (BPoint*)lastsel;
 		if (lastbp >= nu->bp && lastbp < nu->bp + nu->pntsu*nu->pntsv) {
 			return newnu->bp + (lastbp - nu->bp);
@@ -6861,10 +6942,9 @@ static void *undo_check_lastsel(void *lastsel, Nurb *nu, Nurb *newnu)
 	return NULL;
 }
 
-static void undoCurve_to_editCurve(void *ucu, void *obe)
+static void undoCurve_to_editCurve(void *ucu, void *UNUSED(edata), void *cu_v)
 {
-	Object *obedit= obe;
-	Curve *cu= (Curve*)obedit->data;
+	Curve *cu= cu_v;
 	UndoCurve *undoCurve= ucu;
 	ListBase *undobase= &undoCurve->nubase;
 	ListBase *editbase= curve_editnurbs(cu);
@@ -6880,8 +6960,8 @@ static void undoCurve_to_editCurve(void *ucu, void *obe)
 		editnurb->keyindex= dupli_keyIndexHash(undoCurve->undoIndex);
 	}
 
-	if(ad) {
-		if(ad->action) {
+	if (ad) {
+		if (ad->action) {
 			free_fcurves(&ad->action->curves);
 			copy_fcurves(&ad->action->curves, &undoCurve->fcurves);
 		}
@@ -6891,7 +6971,7 @@ static void undoCurve_to_editCurve(void *ucu, void *obe)
 	}
 
 	/* copy  */
-	for(nu= undobase->first; nu; nu= nu->next) {
+	for (nu= undobase->first; nu; nu= nu->next) {
 		newnu= duplicateNurb(nu);
 
 		if (lastsel == NULL) {
@@ -6907,14 +6987,12 @@ static void undoCurve_to_editCurve(void *ucu, void *obe)
 
 	cu->lastsel= lastsel;
 	cu->actnu= undoCurve->actnu;
-
-	ED_curve_updateAnimPaths(obedit);
+	ED_curve_updateAnimPaths(cu);
 }
 
-static void *editCurve_to_undoCurve(void *obe)
+static void *editCurve_to_undoCurve(void *UNUSED(edata), void *cu_v)
 {
-	Object *obedit= obe;
-	Curve *cu= (Curve*)obedit->data;
+	Curve *cu= cu_v;
 	ListBase *nubase= curve_editnurbs(cu);
 	UndoCurve *undoCurve;
 	EditNurb *editnurb= cu->editnurb, tmpEditnurb;
@@ -6929,15 +7007,15 @@ static void *editCurve_to_undoCurve(void *obe)
 		tmpEditnurb.keyindex= undoCurve->undoIndex;
 	}
 
-	if(ad) {
-		if(ad->action)
+	if (ad) {
+		if (ad->action)
 			copy_fcurves(&undoCurve->fcurves, &ad->action->curves);
 
 		copy_fcurves(&undoCurve->drivers, &ad->drivers);
 	}
 
 	/* copy  */
-	for(nu= nubase->first; nu; nu= nu->next) {
+	for (nu= nubase->first; nu; nu= nu->next) {
 		newnu= duplicateNurb(nu);
 
 		if (lastsel == NULL) {
@@ -6963,7 +7041,7 @@ static void free_undoCurve(void *ucv)
 
 	freeNurblist(&undoCurve->nubase);
 
-	if(undoCurve->undoIndex)
+	if (undoCurve->undoIndex)
 		BLI_ghash_free(undoCurve->undoIndex, NULL, (GHashValFreeFP)MEM_freeN);
 
 	free_fcurves(&undoCurve->fcurves);
@@ -7000,10 +7078,10 @@ int ED_curve_actSelection(Curve *cu, float center[3])
 {
 	Nurb *nu= get_lastsel_nurb(cu);
 
-	if(!nu)
+	if (!nu)
 		return 0;
 
-	if(nu->bezt) {
+	if (nu->bezt) {
 		BezTriple *bezt= cu->lastsel;
 
 		copy_v3_v3(center, bezt->vec[1]);
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index 493fc6e..1f1d149 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -82,130 +82,130 @@ static char findaccent(char char1, unsigned int code)
 {
 	char new= 0;
 	
-	if(char1=='a') {
-		if(code=='`') new= 224;
-		else if(code==39) new= 225;
-		else if(code=='^') new= 226;
-		else if(code=='~') new= 227;
-		else if(code=='"') new= 228;
-		else if(code=='o') new= 229;
-		else if(code=='e') new= 230;
-		else if(code=='-') new= 170;
+	if (char1=='a') {
+		if (code=='`') new= 224;
+		else if (code==39) new= 225;
+		else if (code=='^') new= 226;
+		else if (code=='~') new= 227;
+		else if (code=='"') new= 228;
+		else if (code=='o') new= 229;
+		else if (code=='e') new= 230;
+		else if (code=='-') new= 170;
 	}
-	else if(char1=='c') {
-		if(code==',') new= 231;
-		if(code=='|') new= 162;
+	else if (char1=='c') {
+		if (code==',') new= 231;
+		if (code=='|') new= 162;
 	}
-	else if(char1=='e') {
-		if(code=='`') new= 232;
-		else if(code==39) new= 233;
-		else if(code=='^') new= 234;
-		else if(code=='"') new= 235;
+	else if (char1=='e') {
+		if (code=='`') new= 232;
+		else if (code==39) new= 233;
+		else if (code=='^') new= 234;
+		else if (code=='"') new= 235;
 	}
-	else if(char1=='i') {
-		if(code=='`') new= 236;
-		else if(code==39) new= 237;
-		else if(code=='^') new= 238;
-		else if(code=='"') new= 239;
+	else if (char1=='i') {
+		if (code=='`') new= 236;
+		else if (code==39) new= 237;
+		else if (code=='^') new= 238;
+		else if (code=='"') new= 239;
 	}
-	else if(char1=='n') {
-		if(code=='~') new= 241;
+	else if (char1=='n') {
+		if (code=='~') new= 241;
 	}
-	else if(char1=='o') {
-		if(code=='`') new= 242;
-		else if(code==39) new= 243;
-		else if(code=='^') new= 244;
-		else if(code=='~') new= 245;
-		else if(code=='"') new= 246;
-		else if(code=='/') new= 248;
-		else if(code=='-') new= 186;
-		else if(code=='e') new= 143;
+	else if (char1=='o') {
+		if (code=='`') new= 242;
+		else if (code==39) new= 243;
+		else if (code=='^') new= 244;
+		else if (code=='~') new= 245;
+		else if (code=='"') new= 246;
+		else if (code=='/') new= 248;
+		else if (code=='-') new= 186;
+		else if (code=='e') new= 143;
 	}
-	else if(char1=='s') {
-		if(code=='s') new= 167;
+	else if (char1=='s') {
+		if (code=='s') new= 167;
 	}
-	else if(char1=='u') {
-		if(code=='`') new= 249;
-		else if(code==39) new= 250;
-		else if(code=='^') new= 251;
-		else if(code=='"') new= 252;
+	else if (char1=='u') {
+		if (code=='`') new= 249;
+		else if (code==39) new= 250;
+		else if (code=='^') new= 251;
+		else if (code=='"') new= 252;
 	}
-	else if(char1=='y') {
-		if(code==39) new= 253;
-		else if(code=='"') new= 255;
+	else if (char1=='y') {
+		if (code==39) new= 253;
+		else if (code=='"') new= 255;
 	}
-	else if(char1=='A') {
-		if(code=='`') new= 192;
-		else if(code==39) new= 193;
-		else if(code=='^') new= 194;
-		else if(code=='~') new= 195;
-		else if(code=='"') new= 196;
-		else if(code=='o') new= 197;
-		else if(code=='e') new= 198;
+	else if (char1=='A') {
+		if (code=='`') new= 192;
+		else if (code==39) new= 193;
+		else if (code=='^') new= 194;
+		else if (code=='~') new= 195;
+		else if (code=='"') new= 196;
+		else if (code=='o') new= 197;
+		else if (code=='e') new= 198;
 	}
-	else if(char1=='C') {
-		if(code==',') new= 199;
+	else if (char1=='C') {
+		if (code==',') new= 199;
 	}
-	else if(char1=='E') {
-		if(code=='`') new= 200;
-		else if(code==39) new= 201;
-		else if(code=='^') new= 202;
-		else if(code=='"') new= 203;
+	else if (char1=='E') {
+		if (code=='`') new= 200;
+		else if (code==39) new= 201;
+		else if (code=='^') new= 202;
+		else if (code=='"') new= 203;
 	}
-	else if(char1=='I') {
-		if(code=='`') new= 204;
-		else if(code==39) new= 205;
-		else if(code=='^') new= 206;
-		else if(code=='"') new= 207;
+	else if (char1=='I') {
+		if (code=='`') new= 204;
+		else if (code==39) new= 205;
+		else if (code=='^') new= 206;
+		else if (code=='"') new= 207;
 	}
-	else if(char1=='N') {
-		if(code=='~') new= 209;
+	else if (char1=='N') {
+		if (code=='~') new= 209;
 	}
-	else if(char1=='O') {
-		if(code=='`') new= 210;
-		else if(code==39) new= 211;
-		else if(code=='^') new= 212;
-		else if(code=='~') new= 213;
-		else if(code=='"') new= 214;
-		else if(code=='/') new= 216;
-		else if(code=='e') new= 141;
+	else if (char1=='O') {
+		if (code=='`') new= 210;
+		else if (code==39) new= 211;
+		else if (code=='^') new= 212;
+		else if (code=='~') new= 213;
+		else if (code=='"') new= 214;
+		else if (code=='/') new= 216;
+		else if (code=='e') new= 141;
 	}
-	else if(char1=='U') {
-		if(code=='`') new= 217;
-		else if(code==39) new= 218;
-		else if(code=='^') new= 219;
-		else if(code=='"') new= 220;
+	else if (char1=='U') {
+		if (code=='`') new= 217;
+		else if (code==39) new= 218;
+		else if (code=='^') new= 219;
+		else if (code=='"') new= 220;
 	}
-	else if(char1=='Y') {
-		if(code==39) new= 221;
+	else if (char1=='Y') {
+		if (code==39) new= 221;
 	}
-	else if(char1=='1') {
-		if(code=='4') new= 188;
-		if(code=='2') new= 189;
+	else if (char1=='1') {
+		if (code=='4') new= 188;
+		if (code=='2') new= 189;
 	}
-	else if(char1=='3') {
-		if(code=='4') new= 190;
+	else if (char1=='3') {
+		if (code=='4') new= 190;
 	}
-	else if(char1==':') {
-		if(code=='-') new= 247;
+	else if (char1==':') {
+		if (code=='-') new= 247;
 	}
-	else if(char1=='-') {
-		if(code==':') new= 247;
-		if(code=='|') new= 135;
-		if(code=='+') new= 177;
+	else if (char1=='-') {
+		if (code==':') new= 247;
+		if (code=='|') new= 135;
+		if (code=='+') new= 177;
 	}
-	else if(char1=='|') {
-		if(code=='-') new= 135;
-		if(code=='=') new= 136;
+	else if (char1=='|') {
+		if (code=='-') new= 135;
+		if (code=='=') new= 136;
 	}
-	else if(char1=='=') {
-		if(code=='|') new= 136;
+	else if (char1=='=') {
+		if (code=='|') new= 136;
 	}
-	else if(char1=='+') {
-		if(code=='-') new= 177;
+	else if (char1=='+') {
+		if (code=='-') new= 177;
 	}
 	
-	if(new) return new;
+	if (new) return new;
 	else return char1;
 }
 
@@ -232,12 +232,12 @@ static int insert_into_textbuf(Object *obedit, uintptr_t c)
 {
 	Curve *cu= obedit->data;
 	
-	if(cu->len<MAXTEXT-1) {
+	if (cu->len<MAXTEXT-1) {
 		EditFont *ef= cu->editfont;
 		int x;
 
-		for(x= cu->len; x>cu->pos; x--) ef->textbuf[x]= ef->textbuf[x-1];
-		for(x= cu->len; x>cu->pos; x--) ef->textbufinfo[x]= ef->textbufinfo[x-1];		
+		for (x= cu->len; x>cu->pos; x--) ef->textbuf[x]= ef->textbuf[x-1];
+		for (x= cu->len; x>cu->pos; x--) ef->textbufinfo[x]= ef->textbufinfo[x-1];		
 		ef->textbuf[cu->pos]= c;
 		ef->textbufinfo[cu->pos] = cu->curinfo;
 		ef->textbufinfo[cu->pos].kern = 0;
@@ -262,7 +262,7 @@ static void text_update_edited(bContext *C, Scene *scene, Object *obedit, int re
 	EditFont *ef= cu->editfont;
 	cu->curinfo = ef->textbufinfo[cu->pos?cu->pos-1:0];
 	
-	if(obedit->totcol > 0) {
+	if (obedit->totcol > 0) {
 		obedit->actcol= ef->textbufinfo[cu->pos?cu->pos-1:0].mat_nr;
 
 		/* since this array is calloc'd, it can be 0 even though we try ensure
@@ -272,12 +272,12 @@ static void text_update_edited(bContext *C, Scene *scene, Object *obedit, int re
 		}
 	}
 
-	if(mode == FO_EDIT)
+	if (mode == FO_EDIT)
 		update_string(cu);
 
 	BKE_text_to_curve(bmain, scene, obedit, mode);
 
-	if(recalc)
+	if (recalc)
 		DAG_id_tag_update(obedit->data, 0);
 	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
 }
@@ -291,22 +291,22 @@ static int insert_lorem_exec(bContext *C, wmOperator *UNUSED(op))
 	int i;
 	static const char *lastlorem;
 	
-	if(lastlorem)
+	if (lastlorem)
 		p= lastlorem;
 	else
 		p= ED_lorem;
 	
 	i= rand()/(RAND_MAX/6)+4;	
 		
-	for(p2=p; *p2 && i; p2++) {
+	for (p2=p; *p2 && i; p2++) {
 		insert_into_textbuf(obedit, *p2);
 
-		if(*p2=='.')
+		if (*p2=='.')
 			i--;
 	}
 
 	lastlorem = p2+1;
-	if(strlen(lastlorem)<5)
+	if (strlen(lastlorem)<5)
 		lastlorem = ED_lorem;
 	
 	insert_into_textbuf(obedit, '\n');
@@ -321,16 +321,16 @@ static int insert_lorem_exec(bContext *C, wmOperator *UNUSED(op))
 void FONT_OT_insert_lorem(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Insert Lorem";
-	ot->description= "Insert placeholder text";
-	ot->idname= "FONT_OT_insert_lorem";
+	ot->name = "Insert Lorem";
+	ot->description = "Insert placeholder text";
+	ot->idname = "FONT_OT_insert_lorem";
 	
 	/* api callbacks */
-	ot->exec= insert_lorem_exec;
-	ot->poll= ED_operator_editfont;
+	ot->exec = insert_lorem_exec;
+	ot->poll = ED_operator_editfont;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /******************* paste file operator ********************/
@@ -348,10 +348,10 @@ static int paste_file(bContext *C, ReportList *reports, const char *filename)
 	int filelen;
 	char *strp;
 
-	fp= fopen(filename, "r");
+	fp= BLI_fopen(filename, "r");
 
-	if(!fp) {
-		if(reports)
+	if (!fp) {
+		if (reports)
 			BKE_reportf(reports, RPT_ERROR, "Failed to open file %s", filename);
 		return OPERATOR_CANCELLED;
 	}
@@ -368,7 +368,7 @@ static int paste_file(bContext *C, ReportList *reports, const char *filename)
 	fclose(fp);
 	strp[filelen]= 0;
 
-	if(cu->len+filelen<MAXTEXT) {
+	if (cu->len+filelen<MAXTEXT) {
 		int tmplen;
 		wchar_t *mem = MEM_callocN((sizeof(wchar_t)*filelen)+(4*sizeof(wchar_t)), "temporary");
 		tmplen = BLI_strncpy_wchar_from_utf8(mem, strp, filelen + 1);
@@ -398,7 +398,7 @@ static int paste_file_exec(bContext *C, wmOperator *op)
 
 static int paste_file_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	if(RNA_struct_property_is_set(op->ptr, "filepath"))
+	if (RNA_struct_property_is_set(op->ptr, "filepath"))
 		return paste_file_exec(C, op);
 
 	WM_event_add_fileselect(C, op); 
@@ -409,17 +409,17 @@ static int paste_file_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
 void FONT_OT_file_paste(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Paste File";
-	ot->description= "Paste contents from file";
-	ot->idname= "FONT_OT_file_paste";
+	ot->name = "Paste File";
+	ot->description = "Paste contents from file";
+	ot->idname = "FONT_OT_file_paste";
 	
 	/* api callbacks */
-	ot->exec= paste_file_exec;
-	ot->invoke= paste_file_invoke;
-	ot->poll= ED_operator_editfont;
+	ot->exec = paste_file_exec;
+	ot->invoke = paste_file_invoke;
+	ot->poll = ED_operator_editfont;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
@@ -452,11 +452,11 @@ static void txt_add_object(bContext *C, TextLine *firstline, int totline, float
 	cu->vfont= get_builtin_font();
 	cu->vfont->id.us++;
 
-	for(tmp=firstline, a=0; cu->len<MAXTEXT && a<totline; tmp=tmp->next, a++)
+	for (tmp=firstline, a=0; cu->len<MAXTEXT && a<totline; tmp=tmp->next, a++)
 		nchars += strlen(tmp->line) + 1;
 
-	if(cu->str) MEM_freeN(cu->str);
-	if(cu->strinfo) MEM_freeN(cu->strinfo);	
+	if (cu->str) MEM_freeN(cu->str);
+	if (cu->strinfo) MEM_freeN(cu->strinfo);	
 
 	cu->str= MEM_callocN(nchars+4, "str");
 	cu->strinfo= MEM_callocN((nchars+4)*sizeof(CharInfo), "strinfo");
@@ -465,11 +465,11 @@ static void txt_add_object(bContext *C, TextLine *firstline, int totline, float
 	cu->len= 0;
 	cu->pos= 0;
 	
-	for(tmp=firstline, a=0; cu->len<MAXTEXT && a<totline; tmp=tmp->next, a++) {
+	for (tmp=firstline, a=0; cu->len<MAXTEXT && a<totline; tmp=tmp->next, a++) {
 		strcat(cu->str, tmp->line);
 		cu->len+= strlen(tmp->line);
 
-		if(tmp->next) {
+		if (tmp->next) {
 			strcat(cu->str, "\n");
 			cu->len++;
 		}
@@ -487,12 +487,12 @@ void ED_text_to_object(bContext *C, Text *text, int split_lines)
 	float offset[3];
 	int linenum= 0;
 
-	if(!text || !text->lines.first) return;
+	if (!text || !text->lines.first) return;
 
-	if(split_lines) {
-		for(line=text->lines.first; line; line=line->next) {
+	if (split_lines) {
+		for (line=text->lines.first; line; line=line->next) {
 			/* skip lines with no text, but still make space for them */
-			if(line->line[0] == '\0') {
+			if (line->line[0] == '\0') {
 				linenum++;
 				continue;
 			}
@@ -502,7 +502,7 @@ void ED_text_to_object(bContext *C, Text *text, int split_lines)
 			offset[1] = -linenum;
 			offset[2] = 0;
 	
-			if(rv3d)
+			if (rv3d)
 				mul_mat3_m4_v3(rv3d->viewinv, offset);
 
 			txt_add_object(C, line, 1, offset);
@@ -524,19 +524,19 @@ void ED_text_to_object(bContext *C, Text *text, int split_lines)
 static short next_word(Curve *cu)
 {
 	short s;
-	for(s=cu->pos; (cu->str[s]) && (cu->str[s]!=' ') && (cu->str[s]!='\n') &&
+	for (s=cu->pos; (cu->str[s]) && (cu->str[s]!=' ') && (cu->str[s]!='\n') &&
 					(cu->str[s]!=1) && (cu->str[s]!='\r'); s++);
-	if(cu->str[s]) return(s+1); else return(s);
+	if (cu->str[s]) return(s+1); else return(s);
 }
 
 static short prev_word(Curve *cu)
 {
 	short s;
 	
-	if(cu->pos==0) return(0);
-	for(s=cu->pos-2; (cu->str[s]) && (cu->str[s]!=' ') && (cu->str[s]!='\n') &&
+	if (cu->pos==0) return(0);
+	for (s=cu->pos-2; (cu->str[s]) && (cu->str[s]!=' ') && (cu->str[s]!='\n') &&
 					(cu->str[s]!=1) && (cu->str[s]!='\r'); s--);
-	if(cu->str[s]) return(s+1); else return(s);
+	if (cu->str[s]) return(s+1); else return(s);
 }
 
 static int kill_selection(Object *obedit, int ins)	/* 1 == new character */
@@ -548,16 +548,16 @@ static int kill_selection(Object *obedit, int ins)	/* 1 == new character */
 	int getfrom;
 
 	direction = BKE_font_getselection(obedit, &selstart, &selend);
-	if(direction) {
+	if (direction) {
 		int size;
-		if(ins) offset = 1;
-		if(cu->pos >= selstart) cu->pos = selstart+offset;
-		if((direction == -1) && ins) {
+		if (ins) offset = 1;
+		if (cu->pos >= selstart) cu->pos = selstart+offset;
+		if ((direction == -1) && ins) {
 			selstart++;
 			selend++;
 		}
 		getfrom = selend+offset;
-		if(ins==0) getfrom++;
+		if (ins==0) getfrom++;
 		size = (cu->len * sizeof(wchar_t)) - (selstart * sizeof(wchar_t)) + (offset*sizeof(wchar_t));
 		memmove(ef->textbuf+selstart, ef->textbuf+getfrom, size);
 		memmove(ef->textbufinfo+selstart, ef->textbufinfo+getfrom, ((cu->len-selstart)+offset)*sizeof(CharInfo));
@@ -584,11 +584,11 @@ static int set_style(bContext *C, const int style, const int clear)
 	EditFont *ef= cu->editfont;
 	int i, selstart, selend;
 
-	if(!BKE_font_getselection(obedit, &selstart, &selend))
+	if (!BKE_font_getselection(obedit, &selstart, &selend))
 		return OPERATOR_CANCELLED;
 
-	for(i=selstart; i<=selend; i++) {
-		if(clear)
+	for (i=selstart; i<=selend; i++) {
+		if (clear)
 			ef->textbufinfo[i].flag &= ~style;
 		else
 			ef->textbufinfo[i].flag |= style;
@@ -611,16 +611,16 @@ static int set_style_exec(bContext *C, wmOperator *op)
 void FONT_OT_style_set(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Style";
-	ot->description= "Set font style";
-	ot->idname= "FONT_OT_style_set";
+	ot->name = "Set Style";
+	ot->description = "Set font style";
+	ot->idname = "FONT_OT_style_set";
 	
 	/* api callbacks */
-	ot->exec= set_style_exec;
-	ot->poll= ED_operator_editfont;
+	ot->exec = set_style_exec;
+	ot->poll = ED_operator_editfont;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "style", style_items, CU_CHINFO_BOLD, "Style", "Style to set selection to");
@@ -635,7 +635,7 @@ static int toggle_style_exec(bContext *C, wmOperator *op)
 	Curve *cu= obedit->data;
 	int style, clear, selstart, selend;
 
-	if(!BKE_font_getselection(obedit, &selstart, &selend))
+	if (!BKE_font_getselection(obedit, &selstart, &selend))
 		return OPERATOR_CANCELLED;
 	
 	style= RNA_enum_get(op->ptr, "style");
@@ -649,16 +649,16 @@ static int toggle_style_exec(bContext *C, wmOperator *op)
 void FONT_OT_style_toggle(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Toggle Style";
-	ot->description= "Toggle font style";
-	ot->idname= "FONT_OT_style_toggle";
+	ot->name = "Toggle Style";
+	ot->description = "Toggle font style";
+	ot->idname = "FONT_OT_style_toggle";
 	
 	/* api callbacks */
-	ot->exec= toggle_style_exec;
-	ot->poll= ED_operator_editfont;
+	ot->exec = toggle_style_exec;
+	ot->poll = ED_operator_editfont;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "style", style_items, CU_CHINFO_BOLD, "Style", "Style to set selection to");
@@ -670,7 +670,7 @@ static void copy_selection(Object *obedit)
 {
 	int selstart, selend;
 	
-	if(BKE_font_getselection(obedit, &selstart, &selend)) {
+	if (BKE_font_getselection(obedit, &selstart, &selend)) {
 		Curve *cu= obedit->data;
 		EditFont *ef= cu->editfont;
 		
@@ -692,13 +692,13 @@ static int copy_text_exec(bContext *C, wmOperator *UNUSED(op))
 void FONT_OT_text_copy(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Copy Text";
-	ot->description= "Copy selected text to clipboard";
-	ot->idname= "FONT_OT_text_copy";
+	ot->name = "Copy Text";
+	ot->description = "Copy selected text to clipboard";
+	ot->idname = "FONT_OT_text_copy";
 	
 	/* api callbacks */
-	ot->exec= copy_text_exec;
-	ot->poll= ED_operator_editfont;
+	ot->exec = copy_text_exec;
+	ot->poll = ED_operator_editfont;
 }
 
 /******************* cut text operator ********************/
@@ -709,7 +709,7 @@ static int cut_text_exec(bContext *C, wmOperator *UNUSED(op))
 	Object *obedit= CTX_data_edit_object(C);
 	int selstart, selend;
 
-	if(!BKE_font_getselection(obedit, &selstart, &selend))
+	if (!BKE_font_getselection(obedit, &selstart, &selend))
 		return OPERATOR_CANCELLED;
 
 	copy_selection(obedit);
@@ -723,16 +723,16 @@ static int cut_text_exec(bContext *C, wmOperator *UNUSED(op))
 void FONT_OT_text_cut(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Cut Text";
-	ot->description= "Cut selected text to clipboard";
-	ot->idname= "FONT_OT_text_cut";
+	ot->name = "Cut Text";
+	ot->description = "Cut selected text to clipboard";
+	ot->idname = "FONT_OT_text_cut";
 	
 	/* api callbacks */
-	ot->exec= cut_text_exec;
-	ot->poll= ED_operator_editfont;
+	ot->exec = cut_text_exec;
+	ot->poll = ED_operator_editfont;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /******************* paste text operator ********************/
@@ -744,8 +744,8 @@ static int paste_selection(Object *obedit, ReportList *reports)
 	int len= wcslen(ef->copybuf);
 
 	// Verify that the copy buffer => [copy buffer len] + cu->len < MAXTEXT
-	if(cu->len + len <= MAXTEXT) {
-		if(len) {	
+	if (cu->len + len <= MAXTEXT) {
+		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));
@@ -770,7 +770,7 @@ static int paste_text_exec(bContext *C, wmOperator *op)
 	Scene *scene= CTX_data_scene(C);
 	Object *obedit= CTX_data_edit_object(C);
 
-	if(!paste_selection(obedit, op->reports))
+	if (!paste_selection(obedit, op->reports))
 		return OPERATOR_CANCELLED;
 
 	text_update_edited(C, scene, obedit, 1, FO_EDIT);
@@ -781,16 +781,16 @@ static int paste_text_exec(bContext *C, wmOperator *op)
 void FONT_OT_text_paste(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Paste Text";
-	ot->description= "Paste text from clipboard";
-	ot->idname= "FONT_OT_text_paste";
+	ot->name = "Paste Text";
+	ot->description = "Paste text from clipboard";
+	ot->idname = "FONT_OT_text_paste";
 	
 	/* api callbacks */
-	ot->exec= paste_text_exec;
-	ot->poll= ED_operator_editfont;
+	ot->exec = paste_text_exec;
+	ot->poll = ED_operator_editfont;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /************************ move operator ************************/
@@ -818,77 +818,77 @@ static int move_cursor(bContext *C, int type, int select)
 
 	switch(type) {
 		case LINE_BEGIN:
-			if((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
-			while(cu->pos>0) {
-				if(ef->textbuf[cu->pos-1]=='\n') break;
-				if(ef->textbufinfo[cu->pos-1].flag & CU_CHINFO_WRAP) break;				
+			if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
+			while (cu->pos>0) {
+				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;
 			
 		case LINE_END:
-			if((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;		
-			while(cu->pos<cu->len) {
-				if(ef->textbuf[cu->pos]==0) break;
-				if(ef->textbuf[cu->pos]=='\n') break;
-				if(ef->textbufinfo[cu->pos].flag & CU_CHINFO_WRAP ) break;
+			if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;		
+			while (cu->pos<cu->len) {
+				if (ef->textbuf[cu->pos]==0) break;
+				if (ef->textbuf[cu->pos]=='\n') break;
+				if (ef->textbufinfo[cu->pos].flag & CU_CHINFO_WRAP ) break;
 				cu->pos++;
 			}
 			cursmove=FO_CURS;
 			break;
 
 		case PREV_WORD:
-			if((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
+			if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
 			cu->pos= prev_word(cu);
 			cursmove= FO_CURS;
 			break;
 
 		case NEXT_WORD:
-			if((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
+			if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
 			cu->pos= next_word(cu);
 			cursmove= FO_CURS;				
 			break;
 
 		case PREV_CHAR:
-			if((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
+			if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
 			cu->pos--;
 			cursmove=FO_CURS;
 			break;
 
 		case NEXT_CHAR:	
-			if((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
+			if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
 			cu->pos++;
 			cursmove= FO_CURS;				
 
 			break;
 
 		case PREV_LINE:
-			if((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
+			if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
 			cursmove=FO_CURSUP;
 			break;
 			
 		case NEXT_LINE:
-			if((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
+			if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
 			cursmove= FO_CURSDOWN;
 			break;
 
 		case PREV_PAGE:
-			if((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
+			if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
 			cursmove=FO_PAGEUP;
 			break;
 
 		case NEXT_PAGE:
-			if((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
+			if ((select) && (cu->selstart==0)) cu->selstart = cu->selend = cu->pos+1;
 			cursmove=FO_PAGEDOWN;
 			break;
 	}
 		
-	if(cursmove == -1)
+	if (cursmove == -1)
 		return OPERATOR_CANCELLED;
 
-	if(select == 0) {
-		if(cu->selstart) {
+	if (select == 0) {
+		if (cu->selstart) {
 			struct Main *bmain= CTX_data_main(C);
 			cu->selstart = cu->selend = 0;
 			update_string(cu);
@@ -896,13 +896,13 @@ static int move_cursor(bContext *C, int type, int select)
 		}
 	}
 
-	if(cu->pos>cu->len) cu->pos= cu->len;
-	else if(cu->pos>=MAXTEXT) cu->pos= MAXTEXT;
-	else if(cu->pos<0) cu->pos= 0;
+	if (cu->pos>cu->len) cu->pos= cu->len;
+	else if (cu->pos>=MAXTEXT) cu->pos= MAXTEXT;
+	else if (cu->pos<0) cu->pos= 0;
 
 	text_update_edited(C, scene, obedit, select, cursmove);
 
-	if(select)
+	if (select)
 		cu->selend = cu->pos;
 
 	return OPERATOR_FINISHED;
@@ -918,16 +918,16 @@ static int move_exec(bContext *C, wmOperator *op)
 void FONT_OT_move(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Move Cursor";
-	ot->description= "Move cursor to position type";
-	ot->idname= "FONT_OT_move";
+	ot->name = "Move Cursor";
+	ot->description = "Move cursor to position type";
+	ot->idname = "FONT_OT_move";
 	
 	/* api callbacks */
-	ot->exec= move_exec;
-	ot->poll= ED_operator_editfont;
+	ot->exec = move_exec;
+	ot->poll = ED_operator_editfont;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "type", move_type_items, LINE_BEGIN, "Type", "Where to move cursor to");
@@ -945,16 +945,16 @@ static int move_select_exec(bContext *C, wmOperator *op)
 void FONT_OT_move_select(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Move Select";
-	ot->description= "Make selection from current cursor position to new cursor position type";
-	ot->idname= "FONT_OT_move_select";
+	ot->name = "Move Select";
+	ot->description = "Make selection from current cursor position to new cursor position type";
+	ot->idname = "FONT_OT_move_select";
 	
 	/* api callbacks */
-	ot->exec= move_select_exec;
-	ot->poll= ED_operator_editfont;
+	ot->exec = move_select_exec;
+	ot->poll = ED_operator_editfont;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "type", move_type_items, LINE_BEGIN, "Type", "Where to move cursor to, to make a selection");
@@ -974,7 +974,7 @@ static int change_spacing_exec(bContext *C, wmOperator *op)
 	kern += delta;
 	CLAMP(kern, -20, 20);
 
-	if(ef->textbufinfo[cu->pos-1].kern == kern)
+	if (ef->textbufinfo[cu->pos-1].kern == kern)
 		return OPERATOR_CANCELLED;
 
 	ef->textbufinfo[cu->pos-1].kern = kern;
@@ -987,16 +987,16 @@ static int change_spacing_exec(bContext *C, wmOperator *op)
 void FONT_OT_change_spacing(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Change Spacing";
-	ot->description= "Change font spacing";
-	ot->idname= "FONT_OT_change_spacing";
+	ot->name = "Change Spacing";
+	ot->description = "Change font spacing";
+	ot->idname = "FONT_OT_change_spacing";
 	
 	/* api callbacks */
-	ot->exec= change_spacing_exec;
-	ot->poll= ED_operator_editfont;
+	ot->exec = change_spacing_exec;
+	ot->poll = ED_operator_editfont;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_int(ot->srna, "delta", 1, -20, 20, "Delta", "Amount to decrease or increase character spacing with", -20, 20);
@@ -1012,14 +1012,14 @@ static int change_character_exec(bContext *C, wmOperator *op)
 	EditFont *ef= cu->editfont;
 	int character, delta= RNA_int_get(op->ptr, "delta");
 
-	if(cu->pos <= 0)
+	if (cu->pos <= 0)
 		return OPERATOR_CANCELLED;
 
 	character= ef->textbuf[cu->pos - 1];
 	character += delta;
 	CLAMP(character, 0, 255);
 
-	if(character == ef->textbuf[cu->pos - 1])
+	if (character == ef->textbuf[cu->pos - 1])
 		return OPERATOR_CANCELLED;
 
 	ef->textbuf[cu->pos - 1]= character;
@@ -1032,16 +1032,16 @@ static int change_character_exec(bContext *C, wmOperator *op)
 void FONT_OT_change_character(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Change Character";
-	ot->description= "Change font character code";
-	ot->idname= "FONT_OT_change_character";
+	ot->name = "Change Character";
+	ot->description = "Change font character code";
+	ot->idname = "FONT_OT_change_character";
 	
 	/* api callbacks */
-	ot->exec= change_character_exec;
-	ot->poll= ED_operator_editfont;
+	ot->exec = change_character_exec;
+	ot->poll = ED_operator_editfont;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_int(ot->srna, "delta", 1, -255, 255, "Delta", "Number to increase or decrease character code with", -255, 255);
@@ -1057,9 +1057,9 @@ static int line_break_exec(bContext *C, wmOperator *op)
 	EditFont *ef= cu->editfont;
 	const int ctrl= RNA_boolean_get(op->ptr, "ctrl");
 
-	if(ctrl) {
+	if (ctrl) {
 		insert_into_textbuf(obedit, 1);
-		if(ef->textbuf[cu->pos]!='\n')
+		if (ef->textbuf[cu->pos]!='\n')
 			insert_into_textbuf(obedit, '\n');
 	}
 	else
@@ -1075,16 +1075,16 @@ static int line_break_exec(bContext *C, wmOperator *op)
 void FONT_OT_line_break(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Line Break";
-	ot->description= "Insert line break at cursor position";
-	ot->idname= "FONT_OT_line_break";
+	ot->name = "Line Break";
+	ot->description = "Insert line break at cursor position";
+	ot->idname = "FONT_OT_line_break";
 	
 	/* api callbacks */
-	ot->exec= line_break_exec;
-	ot->poll= ED_operator_editfont;
+	ot->exec = line_break_exec;
+	ot->poll = ED_operator_editfont;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "ctrl", 0, "Ctrl", ""); // XXX what is this?
@@ -1109,16 +1109,16 @@ static int delete_exec(bContext *C, wmOperator *op)
 	EditFont *ef= cu->editfont;
 	int x, selstart, selend, type= RNA_enum_get(op->ptr, "type");
 
-	if(cu->len == 0)
+	if (cu->len == 0)
 		return OPERATOR_CANCELLED;
 
-	if(BKE_font_getselection(obedit, &selstart, &selend)) {
-		if(type == DEL_NEXT_SEL) type= DEL_SELECTION;
-		else if(type == DEL_PREV_SEL) type= DEL_SELECTION;
+	if (BKE_font_getselection(obedit, &selstart, &selend)) {
+		if (type == DEL_NEXT_SEL) type= DEL_SELECTION;
+		else if (type == DEL_PREV_SEL) type= DEL_SELECTION;
 	}
 	else {
-		if(type == DEL_NEXT_SEL) type= DEL_NEXT_CHAR;
-		else if(type == DEL_PREV_SEL) type= DEL_PREV_CHAR;
+		if (type == DEL_NEXT_SEL) type= DEL_NEXT_CHAR;
+		else if (type == DEL_PREV_SEL) type= DEL_PREV_CHAR;
 	}
 
 	switch(type) {
@@ -1127,28 +1127,28 @@ static int delete_exec(bContext *C, wmOperator *op)
 			ef->textbuf[0]= 0;
 			break;
 		case DEL_SELECTION:
-			if(!kill_selection(obedit, 0))
+			if (!kill_selection(obedit, 0))
 				return OPERATOR_CANCELLED;
 			break;
 		case DEL_PREV_CHAR:
-			if(cu->pos<=0)
+			if (cu->pos<=0)
 				return OPERATOR_CANCELLED;
 
-			for(x=cu->pos;x<=cu->len;x++)
+			for (x=cu->pos;x<=cu->len;x++)
 				ef->textbuf[x-1]= ef->textbuf[x];
-			for(x=cu->pos;x<=cu->len;x++)
+			for (x=cu->pos;x<=cu->len;x++)
 				ef->textbufinfo[x-1]= ef->textbufinfo[x];					
 
 			cu->pos--;
 			ef->textbuf[--cu->len]='\0';
 			break;
 		case DEL_NEXT_CHAR:
-			if(cu->pos>=cu->len)
+			if (cu->pos>=cu->len)
 				return OPERATOR_CANCELLED;
 
-			for(x=cu->pos;x<cu->len;x++)
+			for (x=cu->pos;x<cu->len;x++)
 				ef->textbuf[x]= ef->textbuf[x+1];
-			for(x=cu->pos;x<cu->len;x++)
+			for (x=cu->pos;x<cu->len;x++)
 				ef->textbufinfo[x]= ef->textbufinfo[x+1];					
 
 			ef->textbuf[--cu->len]='\0';
@@ -1165,16 +1165,16 @@ static int delete_exec(bContext *C, wmOperator *op)
 void FONT_OT_delete(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete";
-	ot->description= "Delete text by cursor position";
-	ot->idname= "FONT_OT_delete";
+	ot->name = "Delete";
+	ot->description = "Delete text by cursor position";
+	ot->idname = "FONT_OT_delete";
 	
 	/* api callbacks */
-	ot->exec= delete_exec;
-	ot->poll= ED_operator_editfont;
+	ot->exec = delete_exec;
+	ot->poll = ED_operator_editfont;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "type", delete_type_items, DEL_ALL, "Type", "Which part of the text to delete");
@@ -1190,7 +1190,7 @@ static int insert_text_exec(bContext *C, wmOperator *op)
 	wchar_t *inserted_text;
 	int a, len;
 
-	if(!RNA_struct_property_is_set(op->ptr, "text"))
+	if (!RNA_struct_property_is_set(op->ptr, "text"))
 		return OPERATOR_CANCELLED;
 	
 	inserted_utf8= RNA_string_get_alloc(op->ptr, "text", NULL, 0);
@@ -1199,7 +1199,7 @@ static int insert_text_exec(bContext *C, wmOperator *op)
 	inserted_text= MEM_callocN(sizeof(wchar_t)*(len+1), "FONT_insert_text");
 	BLI_strncpy_wchar_from_utf8(inserted_text, inserted_utf8, len+1);
 
-	for(a=0; a<len; a++)
+	for (a=0; a<len; a++)
 		insert_into_textbuf(obedit, inserted_text[a]);
 
 	MEM_freeN(inserted_text);
@@ -1223,28 +1223,28 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt)
 	int event= evt->type, val= evt->val;
 	wchar_t inserted_text[2]= {0};
 
-	if(RNA_struct_property_is_set(op->ptr, "text"))
+	if (RNA_struct_property_is_set(op->ptr, "text"))
 		return insert_text_exec(C, op);
 
-	if(RNA_struct_property_is_set(op->ptr, "accent")) {
-		if(cu->len!=0 && cu->pos>0)
+	if (RNA_struct_property_is_set(op->ptr, "accent")) {
+		if (cu->len!=0 && cu->pos>0)
 			accentcode= 1;
 		return OPERATOR_FINISHED;
 	}
 	
 	/* tab should exit editmode, but we allow it to be typed using modifier keys */
-	if(event==TABKEY) {
-		if((alt||ctrl||shift) == 0)
+	if (event==TABKEY) {
+		if ((alt||ctrl||shift) == 0)
 			return OPERATOR_PASS_THROUGH;
 		else
 			ascii= 9;
 	}
-	else if(event==BACKSPACEKEY)
+	else if (event==BACKSPACEKEY)
 		ascii= 0;
 
-	if(val && (ascii || evt->utf8_buf[0])) {
+	if (val && (ascii || evt->utf8_buf[0])) {
 		/* handle case like TAB (== 9) */
-		if(     (ascii > 31 && ascii < 254 && ascii != 127) ||
+		if (     (ascii > 31 && ascii < 254 && ascii != 127) ||
 		        (ascii==13) ||
 		        (ascii==10) ||
 		        (ascii==8)  ||
@@ -1257,34 +1257,34 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt)
 				insert_into_textbuf(obedit, ascii);
 				accentcode= 0;
 			}
-			else if(accentcode) {
-				if(cu->pos>0) {
+			else 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) {
+			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;
+					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;
@@ -1300,8 +1300,8 @@ 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)
+	else if (val && event == BACKSPACEKEY) {
+		if (alt && cu->len!=0 && cu->pos>0)
 			accentcode= 1;
 
 		return OPERATOR_PASS_THROUGH;
@@ -1309,7 +1309,7 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt)
 	else
 		return OPERATOR_PASS_THROUGH;
 
-	if(inserted_text[0]) {
+	if (inserted_text[0]) {
 		/* store as utf8 in RNA string */
 		char inserted_utf8[8] = {0};
 
@@ -1326,17 +1326,17 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt)
 void FONT_OT_text_insert(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Insert Text";
-	ot->description= "Insert text at cursor position";
-	ot->idname= "FONT_OT_text_insert";
+	ot->name = "Insert Text";
+	ot->description = "Insert text at cursor position";
+	ot->idname = "FONT_OT_text_insert";
 	
 	/* api callbacks */
-	ot->exec= insert_text_exec;
-	ot->invoke= insert_text_invoke;
-	ot->poll= ED_operator_editfont;
+	ot->exec = insert_text_exec;
+	ot->invoke = insert_text_invoke;
+	ot->poll = ED_operator_editfont;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position");
@@ -1365,16 +1365,16 @@ static int textbox_add_exec(bContext *C, wmOperator *UNUSED(op))
 void FONT_OT_textbox_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Textbox";
-	ot->description= "Add a new text box";
-	ot->idname= "FONT_OT_textbox_add";
+	ot->name = "Add Textbox";
+	ot->description = "Add a new text box";
+	ot->idname = "FONT_OT_textbox_add";
 	
 	/* api callbacks */
-	ot->exec= textbox_add_exec;
-	ot->poll= ED_operator_object_active_editable_font;
+	ot->exec = textbox_add_exec;
+	ot->poll = ED_operator_object_active_editable_font;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	
 }
@@ -1408,16 +1408,16 @@ static int textbox_remove_exec(bContext *C, wmOperator *op)
 void FONT_OT_textbox_remove(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove Textbox";
-	ot->description= "Remove the textbox";
-	ot->idname= "FONT_OT_textbox_remove";
+	ot->name = "Remove Textbox";
+	ot->description = "Remove the textbox";
+	ot->idname = "FONT_OT_textbox_remove";
 	
 	/* api callbacks */
-	ot->exec= textbox_remove_exec;
-	ot->poll= ED_operator_object_active_editable_font;
+	ot->exec = textbox_remove_exec;
+	ot->poll = ED_operator_object_active_editable_font;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "The current text box", 0, INT_MAX);
 }
@@ -1431,7 +1431,7 @@ void make_editText(Object *obedit)
 	Curve *cu= obedit->data;
 	EditFont *ef= cu->editfont;
 	
-	if(ef==NULL) {
+	if (ef==NULL) {
 		ef= cu->editfont= MEM_callocN(sizeof(EditFont), "editfont");
 	
 		ef->textbuf= MEM_callocN((MAXTEXT+4)*sizeof(wchar_t), "texteditbuf");
@@ -1451,9 +1451,9 @@ void make_editText(Object *obedit)
 	memcpy(ef->textbufinfo, cu->strinfo, (cu->len)*sizeof(CharInfo));
 	memcpy(ef->oldstrinfo, cu->strinfo, (cu->len)*sizeof(CharInfo));
 
-	if(cu->pos>cu->len) cu->pos= cu->len;
+	if (cu->pos>cu->len) cu->pos= cu->len;
 
-	if(cu->pos)
+	if (cu->pos)
 		cu->curinfo = ef->textbufinfo[cu->pos-1];
 	else
 		cu->curinfo = ef->textbufinfo[0];
@@ -1474,7 +1474,7 @@ void load_editText(Object *obedit)
 	
 	update_string(cu);
 	
-	if(cu->strinfo)
+	if (cu->strinfo)
 		MEM_freeN(cu->strinfo);
 	cu->strinfo= MEM_callocN((cu->len+4)*sizeof(CharInfo), "texteditinfo");
 	memcpy(cu->strinfo, ef->textbufinfo, (cu->len)*sizeof(CharInfo));
@@ -1483,7 +1483,7 @@ void load_editText(Object *obedit)
 	
 	/* this memory system is weak... */
 	
-	if(cu->selboxes) {
+	if (cu->selboxes) {
 		MEM_freeN(cu->selboxes);
 		cu->selboxes= NULL;
 	}
@@ -1512,18 +1512,18 @@ static int set_case(bContext *C, int ccase)
 	
 	len= wcslen(ef->textbuf);
 	str= ef->textbuf;
-	while(len) {
-		if(*str>='a' && *str<='z')
+	while (len) {
+		if (*str>='a' && *str<='z')
 			*str-= 32;
 		len--;
 		str++;
 	}
 	
-	if(ccase == CASE_LOWER) {
+	if (ccase == CASE_LOWER) {
 		len= wcslen(ef->textbuf);
 		str= ef->textbuf;
-		while(len) {
-			if(*str>='A' && *str<='Z') {
+		while (len) {
+			if (*str>='A' && *str<='Z') {
 				*str+= 32;
 			}
 			len--;
@@ -1544,16 +1544,16 @@ static int set_case_exec(bContext *C, wmOperator *op)
 void FONT_OT_case_set(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Case";
-	ot->description= "Set font case";
-	ot->idname= "FONT_OT_case_set";
+	ot->name = "Set Case";
+	ot->description = "Set font case";
+	ot->idname = "FONT_OT_case_set";
 	
 	/* api callbacks */
-	ot->exec= set_case_exec;
-	ot->poll= ED_operator_editfont;
+	ot->exec = set_case_exec;
+	ot->poll = ED_operator_editfont;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "case", case_items, CASE_LOWER, "Case", "Lower or upper case");
@@ -1571,8 +1571,8 @@ static int toggle_case_exec(bContext *C, wmOperator *UNUSED(op))
 	
 	len= wcslen(ef->textbuf);
 	str= ef->textbuf;
-	while(len) {
-		if(*str>='a' && *str<='z') {
+	while (len) {
+		if (*str>='a' && *str<='z') {
 			ccase= CASE_LOWER;
 			break;
 		}
@@ -1587,16 +1587,16 @@ static int toggle_case_exec(bContext *C, wmOperator *UNUSED(op))
 void FONT_OT_case_toggle(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Toggle Case";
-	ot->description= "Toggle font case";
-	ot->idname= "FONT_OT_case_toggle";
+	ot->name = "Toggle Case";
+	ot->description = "Toggle font case";
+	ot->idname = "FONT_OT_case_toggle";
 	
 	/* api callbacks */
-	ot->exec= toggle_case_exec;
-	ot->poll= ED_operator_editfont;
+	ot->exec = toggle_case_exec;
+	ot->poll = ED_operator_editfont;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* **************** Open Font ************** */
@@ -1627,18 +1627,18 @@ static int font_open_exec(bContext *C, wmOperator *op)
 
 	font= load_vfont(bmain, filepath);
 
-	if(!font) {
-		if(op->customdata) MEM_freeN(op->customdata);
+	if (!font) {
+		if (op->customdata) MEM_freeN(op->customdata);
 		return OPERATOR_CANCELLED;
 	}
 
-	if(!op->customdata)
+	if (!op->customdata)
 		font_ui_template_init(C, op);
 	
 	/* hook into UI */
 	pprop= op->customdata;
 
-	if(pprop->prop) {
+	if (pprop->prop) {
 		/* when creating new ID blocks, use is already 1, but RNA
 		 * pointer se also increases user, so this compensates it */
 		font->id.us--;
@@ -1666,14 +1666,14 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 	/* hook into UI */
 	pprop= op->customdata;
 
-	if(pprop->prop) {
+	if (pprop->prop) {
 		idptr= RNA_property_pointer_get((PointerRNA *)pprop, pprop->prop);
 		font= idptr.id.data;
 	}
 
 	path = (font && strcmp(font->name, FO_BUILTIN_NAME) != 0)? font->name: U.fontdir;
 
-	if(RNA_struct_property_is_set(op->ptr, "filepath"))
+	if (RNA_struct_property_is_set(op->ptr, "filepath"))
 		return font_open_exec(C, op);
 
 	RNA_string_set(op->ptr, "filepath", path);
@@ -1685,16 +1685,16 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 void FONT_OT_open(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Open Font";
-	ot->idname= "FONT_OT_open";
+	ot->name = "Open Font";
+	ot->idname = "FONT_OT_open";
 	
 	/* api callbacks */
-	ot->exec= font_open_exec;
-	ot->invoke= open_invoke;
-	ot->cancel= font_open_cancel;
+	ot->exec = font_open_exec;
+	ot->invoke = open_invoke;
+	ot->cancel = font_open_cancel;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	WM_operator_properties_filesel(ot, FOLDERFILE|FTFONTFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
@@ -1711,7 +1711,7 @@ static int font_unlink_exec(bContext *C, wmOperator *op)
 
 	uiIDContextProperty(C, &pprop.ptr, &pprop.prop);
 	
-	if(pprop.prop==NULL) {
+	if (pprop.prop==NULL) {
 		BKE_report(op->reports, RPT_ERROR, "Incorrect context for running font unlink");
 		return OPERATOR_CANCELLED;
 	}
@@ -1728,18 +1728,18 @@ static int font_unlink_exec(bContext *C, wmOperator *op)
 void FONT_OT_unlink(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Unlink";
-	ot->idname= "FONT_OT_unlink";
-	ot->description= "Unlink active font data block";
+	ot->name = "Unlink";
+	ot->idname = "FONT_OT_unlink";
+	ot->description = "Unlink active font data block";
 	
 	/* api callbacks */
-	ot->exec= font_unlink_exec;
+	ot->exec = font_unlink_exec;
 }
 
 
 /* **************** undo for font object ************** */
 
-static void undoFont_to_editFont(void *strv, void *ecu)
+static void undoFont_to_editFont(void *strv, void *ecu, void *UNUSED(obdata))
 {
 	Curve *cu= (Curve *)ecu;
 	EditFont *ef= cu->editfont;
@@ -1756,7 +1756,7 @@ static void undoFont_to_editFont(void *strv, void *ecu)
 	update_string(cu);
 }
 
-static void *editFont_to_undoFont(void *ecu)
+static void *editFont_to_undoFont(void *ecu, void *UNUSED(obdata))
 {
 	Curve *cu= (Curve *)ecu;
 	EditFont *ef= cu->editfont;
@@ -1783,7 +1783,7 @@ static void free_undoFont(void *strv)
 static void *get_undoFont(bContext *C)
 {
 	Object *obedit= CTX_data_edit_object(C);
-	if(obedit && obedit->type==OB_FONT) {
+	if (obedit && obedit->type==OB_FONT) {
 		return obedit->data;
 	}
 	return NULL;
diff --git a/source/blender/editors/datafiles/CMakeLists.txt b/source/blender/editors/datafiles/CMakeLists.txt
index 946e1c6..b27901c 100644
--- a/source/blender/editors/datafiles/CMakeLists.txt
+++ b/source/blender/editors/datafiles/CMakeLists.txt
@@ -74,6 +74,7 @@ if(WITH_BLENDER)
 			smooth.png.c
 			snake_hook.png.c
 			soften.png.c
+			claystrips.png.c
 			subtract.png.c
 			texdraw.png.c
 			thumb.png.c
diff --git a/source/blender/editors/datafiles/SConscript b/source/blender/editors/datafiles/SConscript
index dd0db90..0cbeb96 100644
--- a/source/blender/editors/datafiles/SConscript
+++ b/source/blender/editors/datafiles/SConscript
@@ -4,6 +4,6 @@ Import ('env')
 sources = env.Glob('*.c')
 
 incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
-incs += ' #/intern/guardedalloc'
+incs += ' ../../bmesh #/intern/guardedalloc'
 
 env.BlenderLib ( 'bf_editor_datafiles', sources, Split(incs), [], libtype=['core', 'player'], priority=[235, 30] )
diff --git a/source/blender/editors/datafiles/blender_icons.png.c b/source/blender/editors/datafiles/blender_icons.png.c
index d7582a1..85e4697 100644
--- a/source/blender/editors/datafiles/blender_icons.png.c
+++ b/source/blender/editors/datafiles/blender_icons.png.c
@@ -1,6865 +1,7089 @@
 /* DataToC output of file <blender_icons_png> */
 
-int datatoc_blender_icons_png_size= 219467;
+int datatoc_blender_icons_png_size= 226647;
 char datatoc_blender_icons_png[]= {
-137, 80, 78, 71, 13, 10, 26, 10,  0,  0,  0,
- 13, 73, 72, 68, 82,  0,  0,  2, 90,  0,  0,  2,128,  8,  6,  0,  0,  0, 68,254,214,163,  0,  0, 10, 79,105, 67, 67, 80, 80,104,
-111,116,111,115,104,111,112, 32, 73, 67, 67, 32,112,114,111,102,105,108,101,  0,  0,120,218,157, 83,103, 84, 83,233, 22, 61,247,
-222,244, 66, 75,136,128,148, 75,111, 82, 21,  8, 32, 82, 66,139,128, 20,145, 38, 42, 33,  9, 16, 74,136, 33,161,217, 21, 81,193,
- 17, 69, 69,  4, 27,200,160,136,  3,142,142,128,140, 21, 81, 44, 12,138, 10,216,  7,228, 33,162,142,131,163,136,138,202,251,225,
-123,163,107,214,188,247,230,205,254,181,215, 62,231,172,243,157,179,207,  7,192,  8, 12,150, 72, 51, 81, 53,128, 12,169, 66, 30,
- 17,224,131,199,196,198,225,228, 46, 64,129, 10, 36,112,  0, 16,  8,179,100, 33,115,253, 35,  1,  0,248,126, 60, 60, 43, 34,192,
-  7,190,  0,  1,120,211, 11,  8,  0,192, 77,155,192, 48, 28,135,255, 15,234, 66,153, 92,  1,128,132,  1,192,116,145, 56, 75,  8,
-128, 20,  0, 64,122,142, 66,166,  0, 64, 70,  1,128,157,152, 38, 83,  0,160,  4,  0, 96,203, 99, 98,227,  0, 80, 45,  0, 96, 39,
-127,230,211,  0,128,157,248,153,123,  1,  0, 91,148, 33, 21,  1,160,145,  0, 32, 19,101,136, 68,  0,104, 59,  0,172,207, 86,138,
- 69,  0, 88, 48,  0, 20,102, 75,196, 57,  0,216, 45,  0, 48, 73, 87,102, 72,  0,176,183,  0,192,206, 16, 11,178,  0,  8, 12,  0,
- 48, 81,136,133, 41,  0,  4,123,  0, 96,200, 35, 35,120,  0,132,153,  0, 20, 70,242, 87, 60,241, 43,174, 16,231, 42,  0,  0,120,
-153,178, 60,185, 36, 57, 69,129, 91,  8, 45,113,  7, 87, 87, 46, 30, 40,206, 73, 23, 43, 20, 54, 97,  2, 97,154, 64, 46,194,121,
-153, 25, 50,129, 52, 15,224,243,204,  0,  0,160,145, 21, 17,224,131,243,253,120,206, 14,174,206,206, 54,142,182, 14, 95, 45,234,
-191,  6,255, 34, 98, 98,227,254,229,207,171,112, 64,  0,  0,225,116,126,209,254, 44, 47,179, 26,128, 59,  6,128,109,254,162, 37,
-238,  4,104, 94, 11,160,117,247,139,102,178, 15, 64,181,  0,160,233,218, 87,243,112,248,126, 60, 60, 69,161,144,185,217,217,229,
-228,228,216, 74,196, 66, 91, 97,202, 87,125,254,103,194, 95,192, 87,253,108,249,126, 60,252,247,245,224,190,226, 36,129, 50, 93,
-129, 71,  4,248,224,194,204,244, 76,165, 28,207,146,  9,132, 98,220,230,143, 71,252,183, 11,255,252, 29,211, 34,196, 73, 98,185,
- 88, 42, 20,227, 81, 18,113,142, 68,154,140,243, 50,165, 34,137, 66,146, 41,197, 37,210,255,100,226,223, 44,251,  3, 62,223, 53,
-  0,176,106, 62,  1,123,145, 45,168, 93, 99,  3,246, 75, 39, 16, 88,116,192,226,247,  0,  0,242,187,111,193,212, 40,  8,  3,128,
-104,131,225,207,119,255,239, 63,253, 71,160, 37,  0,128,102, 73,146,113,  0,  0, 94, 68, 36, 46, 84,202,179, 63,199,  8,  0,  0,
- 68,160,129, 42,176, 65, 27,244,193, 24, 44,192,  6, 28,193,  5,220,193, 11,252, 96, 54,132, 66, 36,196,194, 66, 16, 66, 10,100,
-128, 28,114, 96, 41,172,130, 66, 40,134,205,176, 29, 42, 96, 47,212, 64, 29, 52,192, 81,104,134,147,112, 14, 46,194, 85,184, 14,
- 61,112, 15,250, 97,  8,158,193, 40,188,129,  9,  4, 65,200,  8, 19, 97, 33,218,136,  1, 98,138, 88, 35,142,  8, 23,153,133,248,
- 33,193, 72,  4, 18,139, 36, 32,201,136, 20, 81, 34, 75,145, 53, 72, 49, 82,138, 84, 32, 85, 72, 29,242, 61,114,  2, 57,135, 92,
- 70,186,145, 59,200,  0, 50,130,252,134,188, 71, 49,148,129,178, 81, 61,212, 12,181, 67,185,168, 55, 26,132, 70,162, 11,208,100,
-116, 49,154,143, 22,160,155,208,114,180, 26, 61,140, 54,161,231,208,171,104, 15,218,143, 62, 67,199, 48,192,232, 24,  7, 51,196,
-108, 48, 46,198,195, 66,177, 56, 44,  9,147, 99,203,177, 34,172, 12,171,198, 26,176, 86,172,  3,187,137,245, 99,207,177,119,  4,
- 18,129, 69,192,  9, 54,  4,119, 66, 32, 97, 30, 65, 72, 88, 76, 88, 78,216, 72,168, 32, 28, 36, 52, 17,218,  9, 55,  9,  3,132,
- 81,194, 39, 34,147,168, 75,180, 38,186, 17,249,196, 24, 98, 50, 49,135, 88, 72, 44, 35,214, 18,143, 19, 47, 16,123,136, 67,196,
- 55, 36, 18,137, 67, 50, 39,185,144,  2, 73,177,164, 84,210, 18,210, 70,210,110, 82, 35,233, 44,169,155, 52, 72, 26, 35,147,201,
-218,100,107,178,  7, 57,148, 44, 32, 43,200,133,228,157,228,195,228, 51,228, 27,228, 33,242, 91, 10,157, 98, 64,113,164,248, 83,
-226, 40, 82,202,106, 74, 25,229, 16,229, 52,229,  6,101,152, 50, 65, 85,163,154, 82,221,168,161, 84, 17, 53,143, 90, 66,173,161,
-182, 82,175, 81,135,168, 19, 52,117,154, 57,205,131, 22, 73, 75,165,173,162,149,211, 26,104, 23,104,247,105,175,232,116,186, 17,
-221,149, 30, 78,151,208, 87,210,203,233, 71,232,151,232,  3,244,119, 12, 13,134, 21,131,199,136,103, 40, 25,155, 24,  7, 24,103,
- 25,119, 24,175,152, 76,166, 25,211,139, 25,199, 84, 48, 55, 49,235,152,231,153, 15,153,111, 85, 88, 42,182, 42,124, 21,145,202,
- 10,149, 74,149, 38,149, 27, 42, 47, 84,169,170,166,170,222,170, 11, 85,243, 85,203, 84,143,169, 94, 83,125,174, 70, 85, 51, 83,
-227,169,  9,212,150,171, 85,170,157, 80,235, 83, 27, 83,103,169, 59,168,135,170,103,168,111, 84, 63,164,126, 89,253,137,  6, 89,
-195, 76,195, 79, 67,164, 81,160,177, 95,227,188,198, 32, 11, 99, 25,179,120, 44, 33,107, 13,171,134,117,129, 53,196, 38,177,205,
-217,124,118, 42,187,152,253, 29,187,139, 61,170,169,161, 57, 67, 51, 74, 51, 87,179, 82,243,148,102, 63,  7,227,152,113,248,156,
-116, 78,  9,231, 40,167,151,243,126,138,222, 20,239, 41,226, 41, 27,166, 52, 76,185, 49,101, 92,107,170,150,151,150, 88,171, 72,
-171, 81,171, 71,235,189, 54,174,237,167,157,166,189, 69,187, 89,251,129, 14, 65,199, 74, 39, 92, 39, 71,103,143,206,  5,157,231,
- 83,217, 83,221,167, 10,167, 22, 77, 61, 58,245,174, 46,170,107,165, 27,161,187, 68,119,191,110,167,238,152,158,190, 94,128,158,
- 76,111,167,222,121,189,231,250, 28,125, 47,253, 84,253,109,250,167,245, 71, 12, 88,  6,179, 12, 36,  6,219, 12,206, 24, 60,197,
- 53,113,111, 60, 29, 47,199,219,241, 81, 67, 93,195, 64, 67,165, 97,149, 97,151,225,132,145,185,209, 60,163,213, 70,141, 70, 15,
-140,105,198, 92,227, 36,227,109,198,109,198,163, 38,  6, 38, 33, 38, 75, 77,234, 77,238,154, 82, 77,185,166, 41,166, 59, 76, 59,
- 76,199,205,204,205,162,205,214,153, 53,155, 61, 49,215, 50,231,155,231,155,215,155,223,183, 96, 90,120, 90, 44,182,168,182,184,
-101, 73,178,228, 90,166, 89,238,182,188,110,133, 90, 57, 89,165, 88, 85, 90, 93,179, 70,173,157,173, 37,214,187,173,187,167, 17,
-167,185, 78,147, 78,171,158,214,103,195,176,241,182,201,182,169,183, 25,176,229,216,  6,219,174,182,109,182,125, 97,103, 98, 23,
-103,183,197,174,195,238,147,189,147,125,186,125,141,253, 61,  7, 13,135,217, 14,171, 29, 90, 29,126,115,180,114, 20, 58, 86, 58,
-222,154,206,156,238, 63,125,197,244,150,233, 47,103, 88,207, 16,207,216, 51,227,182, 19,203, 41,196,105,157, 83,155,211, 71,103,
- 23,103,185,115,131,243,136,139,137, 75,130,203, 46,151, 62, 46,155, 27,198,221,200,189,228, 74,116,245,113, 93,225,122,210,245,
-157,155,179,155,194,237,168,219,175,238, 54,238,105,238,135,220,159,204, 52,159, 41,158, 89, 51,115,208,195,200, 67,224, 81,229,
-209, 63, 11,159,149, 48,107,223,172,126, 79, 67, 79,129,103,181,231, 35, 47, 99, 47,145, 87,173,215,176,183,165,119,170,247, 97,
-239, 23, 62,246, 62,114,159,227, 62,227, 60, 55,222, 50,222, 89, 95,204, 55,192,183,200,183,203, 79,195,111,158, 95,133,223, 67,
-127, 35,255,100,255,122,255,209,  0,167,128, 37,  1,103,  3,137,129, 65,129, 91,  2,251,248,122,124, 33,191,142, 63, 58,219,101,
-246,178,217,237, 65,140,160,185, 65, 21, 65,143,130,173,130,229,193,173, 33,104,200,236,144,173, 33,247,231,152,206,145,206,105,
- 14,133, 80,126,232,214,208,  7, 97,230, 97,139,195,126, 12, 39,133,135,133, 87,134, 63,142,112,136, 88, 26,209, 49,151, 53,119,
-209,220, 67,115,223, 68,250, 68,150, 68,222,155,103, 49, 79, 57,175, 45, 74, 53, 42, 62,170, 46,106, 60,218, 55,186, 52,186, 63,
-198, 46,102, 89,204,213, 88,157, 88, 73,108, 75, 28, 57, 46, 42,174, 54,110,108,190,223,252,237,243,135,226,157,226, 11,227,123,
- 23,152, 47,200, 93,112,121,161,206,194,244,133,167, 22,169, 46, 18, 44, 58,150, 64, 76,136, 78, 56,148,240, 65, 16, 42,168, 22,
-140, 37,242, 19,119, 37,142, 10,121,194, 29,194,103, 34, 47,209, 54,209,136,216, 67, 92, 42, 30, 78,242, 72, 42, 77,122,146,236,
-145,188, 53,121, 36,197, 51,165, 44,229,185,132, 39,169,144,188, 76, 13, 76,221,155, 58,158, 22,154,118, 32,109, 50, 61, 58,189,
- 49,131,146,145,144,113, 66,170, 33, 77,147,182,103,234,103,230,102,118,203,172,101,133,178,254,197,110,139,183, 47, 30,149,  7,
-201,107,179,144,172,  5, 89, 45, 10,182, 66,166,232, 84, 90, 40,215, 42,  7,178,103,101, 87,102,191,205,137,202, 57,150,171,158,
- 43,205,237,204,179,202,219,144, 55,156,239,159,255,237, 18,194, 18,225,146,182,165,134, 75, 87, 45, 29, 88,230,189,172,106, 57,
-178, 60,113,121,219, 10,227, 21,  5, 43,134, 86,  6,172, 60,184,138,182, 42,109,213, 79,171,237, 87,151,174,126,189, 38,122, 77,
-107,129, 94,193,202,130,193,181,  1,107,235, 11, 85, 10,229,133,125,235,220,215,237, 93, 79, 88, 47, 89,223,181, 97,250,134,157,
- 27, 62, 21,137,138,174, 20,219, 23,151, 21,127,216, 40,220,120,229, 27,135,111,202,191,153,220,148,180,169,171,196,185,100,207,
-102,210,102,233,230,222, 45,158, 91, 14,150,170,151,230,151, 14,110, 13,217,218,180, 13,223, 86,180,237,245,246, 69,219, 47,151,
-205, 40,219,187,131,182, 67,185,163,191, 60,184,188,101,167,201,206,205, 59, 63, 84,164, 84,244, 84,250, 84, 54,238,210,221,181,
- 97,215,248,110,209,238, 27,123,188,246, 52,236,213,219, 91,188,247,253, 62,201,190,219, 85,  1, 85, 77,213,102,213,101,251, 73,
-251,179,247, 63,174,137,170,233,248,150,251,109, 93,173, 78,109,113,237,199,  3,210,  3,253,  7, 35, 14,182,215,185,212,213, 29,
-210, 61, 84, 82,143,214, 43,235, 71, 14,199, 31,190,254,157,239,119, 45, 13, 54, 13, 85,141,156,198,226, 35,112, 68,121,228,233,
-247,  9,223,247, 30, 13, 58,218,118,140,123,172,225,  7,211, 31,118, 29,103, 29, 47,106, 66,154,242,154, 70,155, 83,154,251, 91,
- 98, 91,186, 79,204, 62,209,214,234,222,122,252, 71,219, 31, 15,156, 52, 60, 89,121, 74,243, 84,201,105,218,233,130,211,147,103,
-242,207,140,157,149,157,125,126, 46,249,220, 96,219,162,182,123,231, 99,206,223,106, 15,111,239,186, 16,116,225,210, 69,255,139,
-231, 59,188, 59,206, 92,242,184,116,242,178,219,229, 19, 87,184, 87,154,175, 58, 95,109,234,116,234, 60,254,147,211, 79,199,187,
-156,187,154,174,185, 92,107,185,238,122,189,181,123,102,247,233, 27,158, 55,206,221,244,189,121,241, 22,255,214,213,158, 57, 61,
-221,189,243,122,111,247,197,247,245,223, 22,221,126,114, 39,253,206,203,187,217,119, 39,238,173,188, 79,188, 95,244, 64,237, 65,
-217, 67,221,135,213, 63, 91,254,220,216,239,220,127,106,192,119,160,243,209,220, 71,247,  6,133,131,207,254,145,245,143, 15, 67,
-  5,143,153,143,203,134, 13,134,235,158, 56, 62, 57, 57,226, 63,114,253,233,252,167, 67,207,100,207, 38,158, 23,254,162,254,203,
-174, 23, 22, 47,126,248,213,235,215,206,209,152,209,161,151,242,151,147,191,109,124,165,253,234,192,235, 25,175,219,198,194,198,
- 30,190,201,120, 51, 49, 94,244, 86,251,237,193,119,220,119, 29,239,163,223, 15, 79,228,124, 32,127, 40,255,104,249,177,245, 83,
-208,167,251,147, 25,147,147,255,  4,  3,152,243,252, 99, 51, 45,219,  0,  0,  0,  6, 98, 75, 71, 68,  0,255,  0,255,  0,255,160,
-189,167,147,  0,  0,  0,  9,112, 72, 89,115,  0,  0, 13,213,  0,  0, 13,213,  1, 61,214, 88,241,  0,  0,  0,  7,116, 73, 77, 69,
-  7,220,  2, 12, 19, 45, 40,146,193,117, 16,  0,  0, 32,  0, 73, 68, 65, 84,120,218,236, 93,119,120, 20,213,226, 61, 51, 59,179,
-187,217,146, 77, 35, 61,144, 66,  9, 96,  0, 67, 81,130, 84, 65, 80,140,138, 10, 86,132,167,207,103,197,134,  5, 84, 68, 68, 32,
- 54, 64,240, 39,242,208,167,128,160,128,  5,  4,164, 68, 74,232, 29,233,  9,144,  4, 18, 66, 58,201, 38,219,203,220,223, 31,217,
- 89, 55,203,182, 64, 98,129,123,190,111,190,221,157,157, 57,115,239,157,123,239,156, 57,183,  1, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,215, 52, 86,175, 94, 77,154,112,248,144, 64, 57, 29,219,128,191, 59,103, 11,198,157, 52,
- 35,231,  0,  7,231,187,255,144,112, 14,248,187,114,138,241,109,  2,239,144,166,228,163,230, 74, 79,151,112,146,230, 14,103, 75,
-113, 54, 87, 57,242, 16, 78,210,  2,247,253,221,127, 72, 56,  7,252,221, 56,221,243, 79,128,188, 77,226, 12, 48, 79, 53, 53,156,
-164,185,195,217, 82,156, 87, 91,142,124,132,147, 92,109, 94,242,114,239,223,197,117,  4,174,  5, 69, 86,192,200,204,204,100, 92,
-248,153,191, 43,167,107, 58,136,252,205, 25,214,102,196,150,230,230,116, 75,207,230,194,187,153,153,153,204,234,213,171,183,  2,
- 24,208,156,113,111,142,251,238, 22,215,102,225,189,  2,145,213, 36,206,230,202,247, 45,205,217, 92,101,201,157,179, 57,242,189,
-167,251,222,130,247,168,185,194,217, 44,101,169, 37,242,188,135,252,115,213,188,238,156,205, 81,150,220, 57,155, 35,223,255, 25,
-156,205, 81,150, 60,113, 54, 71,190,247,118,239,175, 55,131,138,253,139,  5,129,123,  1, 31,248,119, 22, 68, 45, 37, 54,155,224,
-192,252,229,156,205,124,143,222,117,112, 54,231,219,205,192,230,186, 71, 45,145,223, 93, 57,155,139,223,157,167, 57,238,147, 39,
-206,171, 13,175,151,112, 54,123,220,175, 54,223,255, 89,156,205,124,143,154,165, 44,185,113, 14,108,230,151,129,129, 46,191,223,
-109, 78,206,230, 42, 75, 30,194,121,213,247,201, 19,231,213,134,215, 75, 56,155, 61,238,205,241, 12,105, 41,222,107, 26, 45,213,
-124,214,220,156, 77,228,190,166, 56,155,216, 60, 51,164,  5,238,253, 95, 26,206,230,228,116, 15, 99,115, 54,247,180,100, 56,155,
-147,179,  9, 97,189,230, 56,255,105,247,253,239,152,158,222,248,174,166, 89,202,155, 59,218, 18,225,108, 78,206,  0,185,175,  9,
-206,171,184,247,215, 28,184,191, 75, 64,196,132,111,230, 55, 19, 52,179,  3,211,146,194,181, 57,195, 57,176, 37, 28,194, 22, 64,
-179,135,211,241,166, 60,185,  5,226,254, 79, 73, 83, 90,150,104, 89,250,219,149, 37,183, 60, 57,176, 25,157,162,102,117,158,221,
- 57,155,227, 26,174, 28,205,149, 71, 91, 58,238,205, 89,150, 90,226,222, 83, 92,133, 11, 65, 57, 41, 39,229,164,156,148,147,114,
- 82,206,235,150,243,154,  4, 75,147,128,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,226, 31,  5,175,237,187,
-113,113,113,171,149, 74,101, 59,111,255,235,116,186,139, 23, 47, 94, 28, 68,147,240,175,  3,189, 71, 20,255, 32,176,248,195, 65,
- 23,  0, 16,199, 70, 65, 65, 65,113, 77,195,107,103,120,185, 92,158,114,242,228,201, 14,130, 32,192,110,183,195,102,179, 57, 63,
-205,102, 51,250,247,239,223,228,142,244,209,209,209, 57, 18,137, 36,169, 41,231,216,237,246,243,101,101,101,125,125, 28,178, 19,
- 64, 10,195,252,161, 25,197,239,222, 62,  1,148, 88,173,214,238,190, 56, 25,134, 73,113,231,243,194, 37,126,247,201, 25, 18, 18,
-178,159,227,184,  4, 79, 92,222,190, 11,130,144, 95, 81, 81,209,231,207,188, 71,215, 51,162,163,163,115, 56,142,107,114,254, 44,
- 45, 45,245,154, 63, 99, 99, 99, 15,177, 44, 27,215,  4, 74,137, 32,  8,185, 23, 47, 94,236,235, 67,136,236,  4,144,226,243, 13,
-202, 45, 63, 49, 12, 83,108,183,219,123,250, 43, 71,190,184, 60,228, 81,127,156, 78,145,197,113, 92, 86, 84, 84,212, 51,122,189,
-222,  8,128, 72, 36, 18,226, 18, 54,  0,128,205,102,171,168,169,169,233, 66,115, 34,  5,  5,197,117, 33,180,  4, 65, 96, 77, 38,
- 19,242,242,242, 64,136,199,250,222,126,  5,215,235,112,224,183,141, 81,193, 81,209,176, 89, 44, 80,181,138,116,114,151,157, 56,
-  6,155,213,  2,155,217,140, 54,189,122,139, 97, 64,231,206,157, 37,126, 56, 19, 62,248,224,131,168,224,224, 96, 24,141, 70, 24,
-141, 70,152, 76, 38, 24,141, 70,152,205,102,152,205,102, 88, 44, 22, 88, 44, 22,216,108, 54,152, 76, 38,100,103,103,219,173, 86,
-171, 79,206,105,211,166, 69,105, 52, 26, 39,159,184,137,156, 34,175,213,106,133,209,104,196,166, 77,155,124,114,114, 28,151, 80,
- 82, 82, 18, 37,149, 74, 65,  8,129, 32,  8, 32,132, 52,218,220,209,182,109, 91,139,175, 64,182,208, 61,186,158,209, 97,218,210,
- 53, 81, 33, 10, 57,108,130,128,204,110,109,157,127,228,127,185, 28,196,102,135, 96,179,161,253,243,163,157,251, 59,117,234,228,
- 51,127, 18, 66, 18,167, 45, 93, 19, 26, 40,103, 85, 85,149,161, 99,199,142, 37,104,112,155,189,  9,173,  4,131,193, 16,229,224,
-191, 76, 16,177, 44,219,104, 91,191,126, 61, 50, 51, 51,253,197, 61,225,229,151, 95,142,178, 90,173, 48,155,205, 48,153, 76,176,
- 90,173,176,217,108,206,205,110,183, 59, 55,179,217,140, 61,123,246,  4,234,100,125,112,219,109,183, 61,190,102,205, 26,213,207,
- 63,255,172, 74, 74, 74,130, 84, 42,133, 68, 34,129, 68, 34,  1,203,178,224, 56, 14, 55,223,124, 51, 67,179, 32,  5,  5,197,117,
- 35,180, 76, 38, 83, 65,122,122, 58,113,124,143,151,203,229, 82,183,183,220,184,246,237,219,231,186,159,231,175,185, 42, 56, 42,
- 26, 19, 91,135,  3,  0,222, 57, 87,229,124, 64,124,216,231, 70,231, 49,239, 93,168,  5,  0, 40, 20, 10, 48,174,175,209, 94,160,
- 82,169,112,219,109,183, 65, 38,147,161,103,207,158,224,121,222,227, 38,149, 74,193,243,188,223, 68, 97, 24,  6,106,181, 26, 83,
-166, 76, 17, 69, 18, 84, 65,114,140,235,211, 19, 65, 32,248,239,177,211, 48, 11,  4, 28,199, 57,183, 64, 56,165, 82, 41,142, 30,
- 61, 10,142,227, 32,145, 72,156,159,226,247, 85,171, 86, 97,228,200,145,224, 56, 14, 10,133,  2,240, 51,115,176,235, 61, 50,155,
-205,177, 50,153,204,  2, 64, 20,103, 82,134, 97, 98,174,228, 30, 93,207,  8, 81,200, 49,102,222, 79,  0,128,162, 89,207, 59,239,
-221,158,103,223,113, 30,147,248,159,  7,192, 48, 12,120,158,  7,203,178,205,198, 89, 93, 93,109,120,232,161,135,182,  7,  7,  7,
-175,215,106,181,240, 35,224, 80, 84, 84,  4,142,227,188,230,119,150,101, 49,115,230, 76,156, 57,115, 38,160,184, 27,141, 70, 44,
- 88,176,  0,118,187,189, 17,175,248,221,125, 95,128, 34,235,253,161, 67,135,142, 94,179,102, 77, 24,195, 48,248,236,179,207, 32,
-149, 74, 49,124,248,112, 68, 68, 68, 96,195,134, 13,144, 74,165,120,253,245,215,105,230,163,160,160,240, 85,231,241,  0,110,  4,
- 16,233, 48, 17,234,  0,132,186, 28, 82,225,248,140, 20,127, 51, 12,179,207,  3, 79, 47,199, 49, 21, 12,195,236,115,249,109,  6,
- 32,243,176,191, 10,128,194,177,153,208,224,254,167,185, 92, 71, 60, 15,222,174,203,  1, 13,235, 15,  1,216,  2, 96, 96,102,102,
-230, 86,  0, 40, 45, 45,189,163,180,180, 20,  0,144,146,146,114, 50, 55, 55,183,163,168,121, 28,205, 83, 82,155,205,214, 65,108,
-170, 18,221,162, 33, 67,134,248,124,195,183, 89, 44,151,  9, 16, 79, 90,202, 83,115,133, 55,  1, 99,177, 88,240,192,  3, 15,  0,
-128,215,135,142,235, 22,128,118,131,217,108,  6,199,113, 72,109, 29,137, 73,195,210,113, 19,177, 66, 87,207,192, 86,171,195, 61,
-106, 43, 78,118,238,142,249,231, 43,112, 78, 91, 15,142,227,  2,226, 20,  4,193,171,200,146, 72, 36,152, 55,111, 30, 30,122,232,
- 33, 72, 36,146,128,248, 92,239, 81,114,114,242,154,220,220,220,  8,134, 97, 76,142,123, 36,183,217,108, 26,155,205, 22, 97,183,
-219, 35,154,114,143,174,103,216,  4,193, 99, 62,244,150,103,  3,185, 79,129,112, 86, 87, 87, 27, 50, 51, 51,119,203,229,242,133,
-209,209,209, 37,197,197,197,126,133,150,187,248,113,127,169,248,228,147, 79, 48,103,206, 28, 12, 26, 52, 40,160,112,154, 76, 38,
- 48, 12,131,249,243,231, 95,246,223,212,169, 83, 47,187,158, 31, 78,  6,  0, 27, 23, 23,247,236,186,117,235, 52,226,177,173, 90,
-181,  2,207,243,232,210,165, 11,130,131,131,177,125,251,118,216,237,246,128,203, 37,  5,  5,197,181, 11, 79, 90,196,  5,253, 39,
- 78,156,216, 51, 43, 43,107,122, 70, 70,198,119, 59,119,238, 92,202, 48,204,106,151, 58, 49,211, 81,191,174, 22,127, 19, 66,122,
-185,138, 30,135, 88,139,100, 24,102,181,120,188,235,111,241,147, 16, 50,  4,128, 76,252, 61,113,226,196,180,172,172,172,233, 19,
- 38, 76,120,115,198,140, 25,210,137, 19, 39,118,205,202,202,154, 46, 94,199, 83, 56, 60, 57, 90, 62,215,158, 18,155,168, 78,157,
- 58,229,173,137,202,245,  1,224,179,182, 84,181,138,116, 58, 89,239, 37, 70, 56,247, 79, 41,174,113, 62,192,230,246,104,  7,149,
- 74,133, 97,239,125, 20,144, 83,100, 54,155, 81, 94, 94,238,116, 25,252,109,129,114, 42, 21, 65,200,126,185, 11,138,170,100,120,
-119, 87, 53,214, 28, 62,  3,158,231,113,123,231, 46,184, 67, 26,140,183, 19,101,120,249,116, 33,172, 36,176, 62,189,132, 16,143,
-  2, 75,252, 46, 54,161,  4, 42,180,220,238, 81,145,209,104,172,202,203,203, 51,  8, 13, 15,118,  5, 33, 36,140, 97,152, 58,135,
-203, 21, 27,232, 61,186,158,145,217,173,173,211,117,218, 19, 60,216,185,127,164,238,168,243,158,140,159,247, 33,  0, 96, 80,247,
-155,253,150,135, 64, 56,171,170,170, 12,125,  7, 15,220,106, 55,152,191, 25, 61,122,116,193,230,205,155, 21,129,132,213,147,208,
- 18, 93, 91, 81,100,113, 28,  7,179,217, 28, 80,220,205,102,179,215,242, 33,149, 74,175,196,209,130, 78,167, 51,175, 92,185, 18,
-115,231,206, 69, 68, 68,  4,134, 14, 29,138,216,216, 88, 44, 95,190, 28,132, 16, 60,255,252,243, 80, 40, 20,162,123, 77, 51, 32,
-  5,197,245, 13, 95, 90, 68,158,149,149, 53,221, 93,200,184,254,118, 21, 80,110, 98,202, 85,172,165,249,121,254,175,118, 23, 79,
-226,117, 25,134, 89, 61, 99,198,140, 76, 63,225,168,240, 38,180,124, 78,137,111, 50,153, 10,186,117,235, 22,144,154,208,235,245,
-165,254,196,134,167,183,122, 87,151, 64,173, 86, 67,165, 81,131, 13,176,222,181, 90,173, 78,161,178,113,227, 70, 40, 20, 10, 12,
- 31, 62,252,170, 28, 45,139,197,  2,153,148,  7,219, 42, 26, 99,102,109, 70, 85,157,193,249,128,217,146, 95,128,131,101,229,120,
- 57, 99, 48, 84,138,114,212,155,205,  1, 57,111,130, 32, 92, 38,178, 56,142,195,  3, 15, 60,224,116, 19, 92,251,173,192, 71,211,
- 97, 68, 68,196,126,142,227, 18, 92,238, 81, 80, 74, 74, 10,240, 71,191, 30, 70, 16,132,250,208,208,208, 31,  1,196, 17, 66, 18,
-  0,  4,  7,114,143, 40, 60,231, 79,247,253,130,155, 83,117, 37,156, 85, 85, 85,134,204,204,204,221,118,131,249,155, 11, 23, 46,
-236,  6, 16,116,211, 77, 55, 53, 89,104,137,  2,139,231,121,204,156, 57, 19,115,230,204,113,254, 31,168,208,178,217,108,141,  4,
-212,233,211,167, 27, 93,203, 93,216,249,105, 54, 37,104, 24, 93, 40,164,164,164, 56,207,137,137,137, 65,104,104, 40,  4, 65,128,
- 32,  8,  8, 10, 10,130, 66,161,128, 84, 42,165,153,142,130,130,194,151, 22, 49, 76,152, 48,225, 77,134, 97, 86, 59,156,165, 99,
- 62,  4,149, 39,237,209,203, 77,172, 85,120, 57, 46,211,147,216,114,253, 46, 98,226,196,137,105,238,225,240,212, 92,233,172, 85,
-221,166,221,111,  4,215, 38,170,230,122,136,249,122,144,169, 67, 53, 80,168, 84,144, 72, 88, 48, 12, 67,252,113, 89, 44, 22,103,
-197,255,204, 51,207,248,236,183, 18,104,127, 42,139,197,  2,150,147,224, 98, 76, 50,236,236, 54,231,185,226,198,114, 60,206,197,
-116,132,228,212, 33,240,  1, 62,112,221, 29,173,231,159,127, 30, 11, 22, 44,  0,203,178,206, 52,225, 56, 14,237,219,183, 71, 65,
- 65,129, 79, 46,142,227, 18,206,157, 59, 23,229,154,142,162,136, 37,132,192,110,183,163,109,219,182,198,188,188,188, 23,105,209,
-189, 58,145,229,109,191,221, 46,  4,236,194,120, 58,174,170,170,202, 48,106,212,168,173,181,181,181,223,220,112,195, 13,167,209,
-120, 10,  4,191,124, 28,199, 53, 18, 88,162,200,250,244,211, 79, 27,137, 34,171,213, 26,208,139,128,213,106,189, 76,240,124,252,
-241,199,141, 62,  1,160, 79,159, 62,  1, 57,195,  0,  8,203,178, 68, 42,149,226,182,219,110, 67,215,174, 93,241,243,207, 63, 67,
- 16,  4, 60,247,220,115, 80, 40, 20,152, 61,123, 54,108, 54, 27, 62,248,224,  3,234,104, 81, 80, 80,248,210, 34,166, 25, 51,102,
- 28,155, 49, 99,134,211, 89,114,119,180,188, 60,119,239,116,136,170, 72, 81,164,  1, 48,121, 18, 68,158, 92, 50,119,  1,230,186,
- 47, 43, 43,107,186,123, 56,220,155, 43, 27,  9,173, 63, 11,165,199,143,226,163, 91,210,  1, 52,110, 46,156,119,115, 71,168,212,
- 42,168,130,213, 24,181,106, 27,  0, 56, 42,253,  9,  1, 57, 90,162,208,170,170,170,242, 41,178,154,226,104,177, 50, 14, 43, 18,
- 46,129,200,120,112,102,107, 35,161, 37,225,120, 20, 69, 36,131,229,165,224,236,182,128, 56,  9, 33,151, 53, 21,142, 29, 59, 22,
- 12,195, 56, 71,136,117,235,214,205,149,139,241,247,112,124, 45,188,161, 15,158,123,115,236,  7,149, 70, 90, 98,175, 36,127,238,
-255, 18, 39,127,120, 22,  0,208, 87,167,115,222,139,105,221,254, 24, 59, 48,235,232, 86,167,251,248, 30, 94,189, 34,206,170,170,
- 42,195, 77,157,210,118, 75,195, 67,190, 57,127,254,252,110,  0,236,131, 15, 62, 24,218,173, 91,183,128,202,164, 56,184,194, 93,
-100,185, 58, 89,226,167,159, 17,182, 46,194,209, 30,144,128, 18,155, 17,  3,200,243, 68,204,219, 26,141,  6,106,181,218, 57,226,
- 54, 40, 40,  8, 74,165,210,217,191, 51, 64,225, 70, 65, 65,113,253, 34, 76, 20, 58, 14,177,212,200,105,114,244,173,202,116,253,
-237,201,241,114, 56, 80, 57,126,234,215, 53, 14,129,230, 17,162,179,230,118,206,106,111, 34,141, 19, 21,164,235,103, 76, 76,204,
-175,106,181, 58, 57,208,216, 55,101, 20,155,221,106,185,204,217, 98, 24,  6,234, 96, 53, 20,106, 21, 20,193,106,175,174,151, 47,
-161, 37, 58, 69,226, 67,103,225,194,133, 80,171,213,248,215,191,254,213,228, 62, 90, 78,161, 37,101,177, 65,190,  9, 18, 25,215,
- 72,100,113, 28,  7,  9,207,163, 84, 29, 11,150,231,193,217,  2,115,201,106,107,107,193,113, 28, 38, 77,154,228,124,131,119, 21,
- 89, 77,137,179, 47,176, 12, 35,186, 91,242,118,237,218,189,202, 48, 76, 34,128, 36,157, 78, 39,191,120,241,226,173,180,188,250,
- 80,  6,118,235,101, 46,148, 55,247,245, 74, 57, 69, 39, 75, 26, 30,242, 77,199,142, 29,157, 78,150, 82,169, 20, 71,155,250,191,
-199, 44,235, 81,100,185,143, 16,228, 56,174, 33, 47,251, 25, 29,233,234,104,205,152, 49,195,201,235,234,100,137,104, 74, 57, 18,
-195,186,117,235, 86, 28, 60,120, 16,207, 60,243, 12, 20, 10,  5,230,204,153,  3,155,205,134,169, 83,167, 66,161, 80, 64, 38,147,
-209,204, 71, 65, 65,221,172, 70, 90,196, 13, 21,110,253,160, 24, 55, 81, 83,225, 73, 96,185, 54, 19,138,223, 25,134,177,122,224,
- 53,187, 53, 41,186,239, 23, 63,171,102,204,152,177, 89,116,178, 92,246, 55, 10,135, 95, 71, 75, 46,151, 39,231,229,229, 57, 39,
-194,244,245,105, 54,155, 49,104,208,160,128,157, 49,113,212, 33,199, 73, 26,  9, 11,101,176, 26, 74, 77, 48, 20,106,181,187,224,
- 96,252, 85,226,226, 27,177,171,208,154, 60,121, 50, 56,142,195,130,  5, 11,  0,  0,175,190,250,106,192,125,180, 68, 78,216, 25,
- 20,147,179, 72,159, 53, 18,230,111,173, 40,219,241, 59, 56,142, 67, 84,239, 59, 32,220, 52, 18,122,133, 26,156,221, 22,240,168,
-195,234,234,106, 20, 20, 20, 64, 34,145,224,149, 87, 94,105, 52,215,145,251, 72,182,141, 27, 55,250,141,187, 39, 39,107,242,249,
-106, 39,143, 66,161, 96,127,255,253,247,100, 65, 16, 82, 12,  6, 67,187, 62,125,250,  8,180, 40,251, 17, 69,130, 45, 32, 81, 21,
-104,254,116,231, 20,251,100,213,214,214,126,115,254,252,249, 61,  0,216,209,163, 71,135, 42,149, 74,124,245,213, 87,122,  0,178,
-229,203,151, 43,252,137, 34, 49,223,248, 19, 89, 60,207, 55,228,229, 64,226, 78, 26, 79, 89,226,175, 99,124, 32,121, 94, 12, 43,
-195, 48,176,219,237, 80, 40, 20,141,156,172,160,160, 32,200,229,114,154,241, 40, 40, 40,252,213, 37,251,  2,174,199,  9,233,229,
- 34,170,246, 93,  9,111, 83,174,231, 15,156, 55,161, 97, 50,153,112,226,196,137, 64,121,  2,158, 24,179,117,207,155,241,222,133,
- 90, 48, 12,131,255,246,185,  1, 42,141, 26, 74,149, 10,247,255,188,213, 89,113, 31,157,254, 42,228, 42, 53,226,250, 13, 13,168,
- 34, 23,155, 14, 93,133, 86, 77, 77, 13,120,158,199,251,239,191, 15,150,101,241,193,  7, 31, 32, 62, 62, 30, 23, 47, 94,196,242,
-229,203,  3,114,180, 36,118,  9, 98, 31,235,  4,229,216, 16,104, 30,235,143,176,219, 38,227,130,153,195, 78,163, 18,253,141,199,
- 33,219,240, 41,204,130, 61,224, 17, 88, 54,155, 13, 91,183,110,117,239,240,238,236, 83,101,179,217, 96,181, 90, 97,177, 88,240,
-193,  7, 31,  4, 50,194,243,178,251, 38,166,161, 99, 18, 84, 73,110,110,110, 36, 33, 36, 28, 64,  8,128, 74, 90, 92,125, 35,182,
-247,243,136,236,249, 52,  0, 96,213,140, 39,156,251, 39, 29,253, 35,127,206,252,182, 97,  1,128,142, 73, 67,155,196, 89, 85, 85,
-101,184,125, 80,159, 28,163,192,127,221,165, 75,151, 70, 78, 86, 80, 80, 16,227,248, 29,144, 93,198,178, 44, 36, 18,201,101,205,
-133,222,196, 86, 32,125,180,108, 54,155,115, 34, 81, 95,253, 25,175,196,209,122,226,137, 39, 16, 27, 27,235,116,178,222,123,239,
- 61, 40, 20, 10, 76,156, 56, 17, 86,171, 21,159,126,250, 41,205,124, 20, 20, 20,127,186, 40,251, 51,224,177, 38, 53, 26,141,133,
- 93,187,118,133,151,255,226,131,130,130,120,183, 72,197,181,111,223, 62,215, 67, 19,226, 16,  0,217,158, 42,117,134, 97, 16,172,
-  9, 70,144, 90,  5,165,155,139, 21, 20,172,129, 92,173,  6, 43,245, 88,153, 95,198, 41,246, 45,113, 21, 90,226, 86, 91, 91, 11,
-158,231, 49,119,238, 92,104, 52, 26,152, 76, 38,191,156,226, 67, 71, 34,145, 64, 95, 84,135,147,211,179, 33, 11,218,137,118, 67,
- 31, 66, 44,175,128,116,251,143, 48,216,173,254, 38, 44,189,140,179, 67,135, 14,120,231,157,119, 46,155,214,193, 27,226,227,227,
-253,198,221,221,201,154,121, 67, 27, 72,101, 82,140, 63, 94,  4,147,201,196, 60,244,208, 67,  2,  0,  3,128, 10,131,193,112, 62,
-144,244,108,  6,252,227, 57,125,141,138, 21, 33, 16,187, 39,  1,227,145, 83,116,178,140,  2,255,117, 65, 65,129,232,100,133, 40,
-149, 74,124,241,197, 23,122,  0,236,212,169, 83,149,137,137,137,146, 64,242,146, 68, 34,193,172, 89,179, 60,246,201,242, 36,186,
-154, 82,142, 92,207, 29, 48, 96,128,199,  9, 75,189,136,183,203, 56,197,176, 70, 68, 68, 56,157, 44,187,221,238, 28,109, 40,206,
- 62,239,227,165,130,230, 79,202, 73, 57,175, 31,206,107, 18, 30,107,224,139, 23, 47,222,238,237,132,182,109,219,230,229,229,229,
-181, 23,151,226,112, 84,156, 82,163,209,216,161, 79,159, 62,126,173, 29, 65, 16, 32,151,203, 65,  8,193,173,239,100,129, 97,  1,
- 22,141, 31, 98, 81,183, 12,134, 68,194, 65,104, 88,234,195,239,168, 67,131,193,208,232,225,224,105,171,175,175,135,201,100, 10,
-120, 54,111,163,209,216,104, 10,  6,134,  8, 56,247,219,178,203, 70, 31,138, 91,160,253,118,130,130,130, 26, 53,253,248,113,172,
-152, 64, 28, 45,215,166, 71,169, 76, 10, 78,202,139,142, 86,221,233,211,167, 71,209,108, 30, 56,196,  1, 11,  0,144,218,103, 56,
-  4,193, 14, 98,183, 55, 90, 38,169, 83,242,237, 16,136, 29, 22,171, 30, 38,147,201,223,180, 39, 76,101,101,165, 97,212,168, 81,
- 91,  1,252,239,158,123,238,201, 69,195,236,194, 68,173, 86,203,121,158, 23,  0, 84,  3, 32,151, 46, 93, 10,185,112,225,130, 96,
- 52, 26,219,248, 11,231,154, 53,107,112,226,196,  9,244,235,215,175,209,114, 80,162, 43,234, 58,187,123, 32,249, 83,108, 46,247,
- 52, 35,188, 55, 33, 23, 40, 36, 18,  9, 66, 66, 66, 32,149, 74,241,254,251,239, 67, 42,149, 66,169, 84,  2,  0, 62,253,244, 83,
-231,228,171, 20, 20, 20, 20,215,141,208,242, 87,111,250,104, 86,244,217,132,104,179,217,138, 19, 19, 19,155,116, 49,187,221, 94,
-230, 71,184, 21, 47, 95,190, 92,234,234, 66,248,251, 36,132,148,249,121,216, 22,175, 90,181, 74,234,201,221,240,182,192,180, 63,
- 78,187,221, 94,156,148,148,228,213, 49,241,  4,171,213,122,193,159,104,205,170, 48, 52, 18,  9,227,143, 23,121, 93, 59,145,194,
-111, 94,243,145, 63,223,186,210,252,121, 58, 53, 53,245, 66,104,104,232,218,232,232,232,170, 29, 59,118, 68,244,234,213, 43,194,
-245,152, 94,189,122,197,186,157,102,134,247,117, 14,193, 48, 76,241, 61,247,220,227, 49,207,139,162,201, 67,254, 44,246,151,231,
-247,238,221, 43,117, 61,223, 27,191, 75, 57, 42, 14, 64,184,158, 75, 79, 79,103, 93,121,188,229,125,171,213, 90, 65,115, 33,  5,
-  5,197,117, 47,180, 12,  6, 67, 81,215,174, 93,109, 94,254, 59,239,235,220,170,170,170,158,205, 29,  1,171,213,218,231,159,192,
- 89, 89, 89,217,172,113,183,217,108,197,142,  9, 74,125, 30, 67,179,248, 95,119,143,  0,160,188,188,252, 38,  0,208,233,116,240,
-183,172, 78, 19,  4, 97,179,231, 79,155,205,214,167, 37,210,180,186,186, 58,131,230, 44, 10, 10, 10, 42,180,154,  0,186, 24,241,
-223,  3, 45, 33, 90, 41, 40, 40, 40, 40, 40, 40,154, 23, 44, 77,  2, 10, 10, 10, 10, 10, 10, 10,138,150,  1,131,134,145,  3,158,
-208,148,209,  4, 67,174,224,218,217,148,147,114, 82, 78,202, 73, 57, 41, 39,229,188,238, 56,253,113,211,209,140, 45, 44,192, 40,
- 39,229,164,156,148,147,114, 82, 78,202,121,253,113, 94,147,160, 77,135, 20, 20, 20, 20, 20, 20, 20, 20, 45,  4,142, 38,193, 95,
-  6,  9,154, 48,163,190, 63, 16, 66,194,  0,120, 91, 48,206,204, 48,204,165, 43,224,100,  0, 72, 29,155, 56,209,145, 21,128,  5,
-128,133, 97, 24,226,159,227, 93,182,164, 36, 44,141,216,249, 94,132, 97,120, 65,192,225, 54,109, 90, 31, 98,152, 59,204,  0,160,
-138,238,212, 89,173, 82, 12, 49, 89,204,201,114, 94,118,162, 70, 87,191,209, 84,158, 87, 72,179,  7,  5,197, 95,130,187,  0, 76,
- 65, 67,183,146, 25,  0,150,209, 36,161,160,104, 33,161,165, 86,171,247,179, 44,155,224,111,126, 30, 17,142,181,204,138, 47, 93,
-186,212,179,  9,215, 30,165, 86,171,  7,241, 60,127, 11,  0, 88,173,214, 29,245,245,245,155,  1, 44,  7, 96,187,194, 56,105,  0,
- 60,  0,224, 17,199,239, 37,142,202, 66,123,133,124, 93, 67, 66, 66,126,224,121,158, 84, 86, 86,246,  6,128,136,136,136,221, 86,
-171,149,209,106,181,247,  3, 56,210, 68, 62,150,231,249,153,189,123,247,238,191,109,219,182,255,  1,152,219, 76,247, 82,206,178,
-172, 71,129, 34,  8, 66,210, 21,136, 44, 41,128,144,185,115,231, 70, 44, 94,188, 56,189,184,184,184, 11,  0, 36, 36, 36, 28, 29,
- 61,122,244,161,113,227,198, 85, 17, 66,106, 25,134,177,248,226, 41, 41,  9, 75, 43, 47,205,127,166,172,252,196,  3,  0, 16, 19,
-219,101,153, 68,194, 74,  9, 57,176, 75,217,234,145, 86,237,219, 37, 61,253,221, 87,115,165, 73,201,173,177,105,231,193, 27,199,
-189,248,102,218,  5,224, 19, 42,182,254, 60,  4,  7,  7,239,103, 89, 54,193, 87, 25,247, 84,230,237,118,123,113,117,117,117, 79,
-111,156, 28,199, 37,248,170, 47, 60,237, 19,  4, 33,191,178,178,210,227, 84, 19, 26,141,102, 23,199,113,201,129,114,137,159, 54,
-155,173,216,219, 40, 93,141, 70,179, 95, 34,145, 36,248,138,167,167,255,  4, 65,200,175,168,168,240, 22,206,203,226,222, 28,225,
-188, 18, 78, 95,225, 20,235, 35,  0,159, 70, 68, 68,220, 92, 85, 85,245, 40,128, 55,181, 90,109, 55,137, 68,130,240,240,240, 55,
-205,102,243,153,144,144,144, 47,107,107,107,119,  2,120, 17,  0, 93, 47,149,130,162,185,160,209,104,202,234,235,235,137,  8, 65,
- 16,136,213,106, 37, 38,147,137, 24, 12,  6,162,211,233, 72,125,125, 61,209,106,181,164,182,182,150, 84, 85, 85,145,200,200, 72,
-247,201, 27,189,181,225,118,209,104, 52,121, 89, 89, 89,166,130,130,  2, 98,177, 88,136,197, 98, 33,133,133,133,228,163,143, 62,
- 50,105, 52,154, 60,  0, 93,188,156, 59,196, 75,101,113, 27,128,165,233,233,233,230, 53,107,214, 16,163,209, 72,116, 58, 29, 89,
-182,108, 25,185,225,134, 27,204,  0,150, 58,142, 97,  3,228,  4,128,190, 49, 49, 49,197,103,207,158,181,111,220,184,209, 18, 18,
- 18,146, 29, 18, 18,146, 93, 88, 88,104, 63,123,246,172,208,170, 85,171, 98,  0,125,155, 16, 78,  0, 24, 57,126,252,248,178,194,
-194, 66, 50, 96,192,128,195, 46,251, 25,248, 95,231,110,136, 39, 39,139, 16, 18, 67,  8,137, 69,195, 36,151,151,109,132,144, 88,
-199, 49, 97,  1,114,170,242,243,243, 91, 71, 71, 71,103, 49, 12, 99,118,231, 99, 24,198, 28, 29, 29,157,149,159,159,223,154, 16,
-162,242,197, 89,124,126,222,147,107,215, 12,174,209, 93, 58, 69,116,151, 78,145,255,125, 61, 80,251,212,184, 71,151,198,182,237,
-190, 32, 52, 33,109,238,137, 83,167,231, 19, 66,230,111,222,151, 55,127,242,231,191,206,191,119,220,236, 47, 34, 18,211,159,106,
- 66,122, 94, 13, 40, 39,128,208,208,208, 82,157, 78, 71,  8, 33,196,110,183, 19,139,197, 66, 76, 38, 19,209,235,245,164,190,190,
-158,212,213,213, 57,203,121,109,109,173,243,123, 84, 84,148,215,242, 30, 22, 22, 86,102, 48, 24, 26,213, 29,102,179,217, 89,127,
-232,245,122,162,215,235,137, 78,167,115,110,245,245,245, 36, 46, 46,174,200, 71, 56, 47,138,225, 20,  4,129,216,108, 54, 98,177,
- 88,156,188, 70,163,177,209,102, 50,153,136,201,100, 34,137,137,137,  1,135, 51, 16, 78,163,209, 72, 18, 18, 18, 74,188,113,134,
-135,135,151, 25,141,198, 70,156,174,241,119,231, 21,127,199,196,196,148, 54,133, 51,144,112,250, 74, 79,  7,230,230,230,230, 18,
-131,193, 64,226,227,227,171,238,191,255,126,171,221,110, 39,107,214,172, 33,233,233,233,194,192,129,  3, 45,149,149,149,228, 95,
-255,250, 23,241,241, 82, 72,203, 17,229,164,184, 18, 71,139, 97, 24,168, 84, 42,124,255,253,247, 94,151,227,112,253,222,166, 77,
-155, 64,175,217, 51, 57, 57,121,235,246,237,219, 21,177,177,127, 76,136,109, 54,155, 17, 22, 22,134,231,158,123, 78,118,215, 93,
-119,181, 31, 58,116,232,238,115,231,206, 13,  0,176,223, 15,223,125,145,145,145,159, 77,154, 52, 41,250,193,  7, 31, 68, 68, 68,
-163, 73,183, 49,106,212, 40,220,127,255,253,210,220,220,220,135, 22, 46, 92,248,208,188,121,243, 74,235,235,235,199,  1,248,209,
- 23,169, 66,161,184, 39, 46, 46,238,139,237,219,183, 71, 69, 69, 69, 33, 37, 37,133,125,253,245,215,219,119,232,208, 65,145,144,
-144,192, 94,188,120, 17, 63,255,252,115,252,195, 15, 63,188,162,172,172,236,105,139,197,178, 50,128,184,203, 34, 34, 34,222,124,
-250,233,167, 91,105,181, 90,219,129,  3,  7,242,196,253, 50,153,108,106, 70, 70, 70,175, 45, 91,182,124, 11,224,203, 43,113,178,
-  8, 33, 90,252,209,196, 39,194, 42,254, 31,136,179, 69,  8,145, 29, 62,124, 56, 60, 35, 35,227, 71,147,201,212,253,153,103,158,
- 57, 63,125,250,116,133, 70,163,209,  0, 96,180, 90,237,165, 41, 83,166,152,103,207,158,253, 70,231,206,157,  7,239,218,181,235,
- 62, 66,136,213, 33,200, 46,231, 99, 24,103,120,138, 46, 84, 96,235, 78, 65,246,206,196, 87, 19, 62,156,150,124,110,223,241, 34,
-129, 83,104,240, 75,206, 49,148, 85,213,227,215, 93,199, 17, 19, 17,204, 72,229,124, 90, 72,252, 13,  3,106, 47, 28,207,129,143,
- 25,210, 41,154,  7, 12,195, 64,169, 84,226,151, 95,126,185,108,233, 42, 79,203, 90,113, 28,135,208,208, 80,191,171, 27,  4,  5,
-  5, 97,227,198,141, 30,215, 94,244,180,164, 79, 72, 72,  8,124,189,108, 48, 12,131,160,160, 32,236,216,177,  3, 44,203,122, 92,
- 26,200,125,159, 74,165,  2,235, 99,173, 43,145, 51, 39, 39,199, 47,151,248,169, 86,171,129,134,166,127,239,133, 82, 46,199,246,
-237,219,189,198,217,253,187,218,177,222,171, 63,206, 29, 59,118, 52, 90,250,203,125, 73, 48,215,223, 42,149, 10,140, 31,210,176,
-176,176,222,  9,  9,  9,216,187,119, 47,150, 47, 95, 30,158,150,150,134,211,167, 79,131, 97, 24, 76,159, 62,157,185,225,134, 27,
-248,210,210, 82,244,235,215, 15, 63,253,244, 83, 31,173, 86, 75, 11, 12,197, 95,  2, 66,  8, 15,224, 70,  0,145,104,232,118, 83,
-  7, 32, 20, 13, 43,105,200,  0, 84,  1, 80, 56, 54, 19,128,122,  0,173, 28,167, 87, 58,234, 22, 87,129, 80,225,186,248, 52, 33,
-164,151,131, 91, 92,161, 34,210,229, 88,241, 26,238,191,221, 63, 61,114,115,  0,176,122,245,106,241, 97, 54, 48, 51, 51,115,171,
-107,228,  2, 17, 89,226, 58,101, 30,202,180,251, 16, 77,185, 74,165,250, 97,247,238,221,138,200,200, 63,226, 96, 50,153, 80, 87,
- 87,135,250,250,122,212,213,213, 33, 56, 56, 24,203,151, 47, 87, 12, 30, 60,248,135,186,186,186, 14,142, 68,243,198, 57,235,226,
-197,139,209, 54,155, 13, 50,153,231, 46, 74, 44,203,162, 83,167, 78,120,243,205, 55, 49,108,216,176,152, 65,131,  6,205,114, 19,
- 90,151, 13, 37, 85, 42,149, 95, 28, 56,112, 32, 74,169, 84, 34, 47, 47, 15,197,197,197, 24, 63,126,124,107, 65, 16, 80, 84, 84,
-132,211,167, 79,227,194,133, 11, 88,184,112, 97,212,136, 17, 35,190,240, 32,180, 60, 13, 79,125,230,229,151, 95,238, 24, 22, 22,
-198,126,244,209, 71, 53, 58,157,238,255, 28,251,223,153, 51,103,206, 99,253,251,247,143,250,247,191,255, 77,118,236,216,177,216,
-113,227,188,166,167,107,159, 44, 71, 51, 31, 28,153,239,164,219, 57,157, 92,254,  7, 33, 36,  6,128,137, 97,152, 26, 15,156, 12,
-128,144,161, 67,135,190, 98, 50,153,186,111,223,190,253,204, 45,183,220,146,  8,224,162,152,249, 66, 66, 66, 84,179,102,205,138,
-206,204,204,204,189,245,214, 91,187, 15, 29, 58,244,149,138,138,138,233,132,144, 10,151, 62, 91, 78, 78, 65,192,225,152,216, 46,
-203,114,118,141,123, 96,203, 14,179,244,213, 23, 39,159,111,211, 58,169,246,112, 94,181,253,120,126,  5,234, 12, 54,220,123,107,
-195,  2,230,189,187,180,193,103,223,111,199,115, 47,189,197,255,184,108,209,253,103,  8, 84,245, 37,199,215,248, 72,207,171,  5,
-229,132,179,137,  9, 60,207,227,142, 59,238,  0,195, 48,151,173,229,201,243, 60,118,237,218,133, 91,111,189, 21, 60,207,227,137,
- 39,158,  8,136,147,227, 56, 12, 29, 58,212,185,142,162, 43,159,187,104,240,162,  9,178,221, 42, 91,112, 28,  7,150,101,189, 46,
-164,237,206,233,175, 94, 18,195,233,139,203,245, 63,127,225,116, 44,121, 20,176,200, 10,148, 83, 12, 39,199,113,232,211,167, 15,
- 14, 29, 58,228, 83,116,121,209,151,141,226,126,233,210,165, 49, 29, 58,116,200,153, 59,119,110, 56,  0, 84, 85, 85, 57, 23,188,
-151, 72, 36, 56,117,234, 20,204,102, 51,222,125,247, 93,139, 86,171,253, 55, 45, 71,148,179, 37, 57,125,105, 17,  0,253, 39, 78,
-156,216, 51, 43, 43,107,122, 70, 70,198,119, 59,119,238, 92,202, 48,204,106, 66, 72,166,248, 57,113,226,196,180,172,172,172,233,
- 19, 38, 76,120,115,198,140, 25,199, 24,134, 89, 13,  0,238,191, 29,117, 73,166,155,136,139, 20,121, 28,101,174,209,177,158,126,
-187,127,122,226,110,228,104,101,102,102, 50,142, 72, 50,174,149, 90,160, 66, 43,144,181,251, 56,142,123,126,250,244,233,209,190,
- 68, 86,125,125, 61, 74, 74, 74,144,152,152,136, 39,158,120, 34,122,238,220,185,207,219,108,182,143,125,208, 74, 37, 18,  9,246,
-238,221,139,242,242,114,116,237,218, 21,201,201,201,141, 14, 56,123,246, 44,214,174, 93,139,154,154, 26,244,232,209,  3,104,232,
-220,237, 17,221,186,117,123,183, 83,167, 78, 67, 89,150,181, 41, 20, 10, 28, 62,124, 24,221,187,119,199,247,223,127,143, 54,109,
-218, 64,169, 84, 34, 55, 55, 23, 93,187,118,197,214,173, 91, 17, 25, 25,137,244,244,116,155, 86,171,221, 86, 93, 93,189,249,220,
-185,115,239,122, 11,103,124,124,252,228,167,158,122, 74, 86, 82, 82, 34,124,243,205, 55,219,  1,108,  7,240,252, 91,111,189,245,
-248,176, 97,195,162, 14, 30, 60, 88,187,111,223,190, 61, 94, 68, 86, 32, 78,150,205,253,161,100,183,219, 77,  6,131,193,108, 50,
-153,172, 44,203, 22, 50, 12, 99,182,219,237, 29,188,153, 16, 99,199,142,109, 91, 89, 89,249,220, 75, 47,189, 84,224, 16, 89,167,
-208,208,  1, 30,  0, 96,179,217, 76,245,245,245,218,140,140,140,196,135, 31,126,248,204,210,165, 75,159, 27, 59,118,236,242,111,
-190,249,166, 30,128,193,157,176, 77,155,214,135, 36, 18, 86,170,171, 11,207, 95,177,252,203,151,215,174,122,190,117, 81,209,133,
-246, 17,173, 34,117, 82,117,100,201,242, 37, 95,239,  7, 96, 46,169,208,226,200,217, 82,240,188,  4, 39,138,106,209,255,246, 81,
-252,153,188,105,125,  1,172,161,239,114, 45,255,178, 40, 46, 66,189,101,203, 22,159,142,214,174, 93,187,192,243, 60, 20, 10,  5,
-102,207,158,237,147, 84, 20,  6,162, 91,228, 79,204,136,139,163,251,114,159,  4, 65,112, 46,244,238,190,253,223,255,253, 31, 94,
-122,233,165, 70,215,112,136, 13,198, 31,167,183,240, 37, 38, 37,161,188,172,172,209,190, 64, 22,165,183,219,237,224,121, 30, 11,
- 22, 44, 64,102,102, 38, 86,175, 94,237,243,243,142, 59,238,  0,203,178, 36,144,244,236,211,167, 15, 44, 22,139, 51,204,167, 78,
-157,242,200, 59,111,222, 60,127,193,188, 11,192,148,238,221,187,107,  6, 13, 26,132,156,156, 28,220,127,255,253, 38,139,197,146,
-  7,  0,119,222,121,103,234,220,185,115,101,  7, 14, 28, 64, 68, 68,  4,127,254,252,249,255,129,118,144,167,104, 97,120,210, 34,
-226, 51, 47, 43, 43,107,186,187,136,113,133,248, 63,195, 48,171,103,204,152,145,233, 42,138, 92,127,139,174,147,155,136, 75,115,
-117,164, 92, 69,148, 55,  1,229,246,188,117, 61,190,194,163,208,114, 68,108,160,171, 11, 36, 86,190,254, 68,150,143, 55,199, 70,
-  8,  9,  9, 25,126,239,189,247, 58, 69,142,209,104,116, 10, 44, 81,100,137,191,115,115,115,209,179,103, 79,105, 72, 72,200,240,
-170,170,170,143,  3, 16,113,136,139,139, 67,101,101, 37,142, 30, 61,138,196,196, 68, 88,173, 86,172, 95,191, 30,181,181,181,224,
-121, 30, 82,169, 20, 22,139,207,190,219,232,212,169,211, 29,139, 23, 47,238,185,104,209,162, 75,226, 27,221,146, 37, 75, 64,  8,
- 65,100,100, 36,244,122, 61,202,202,202,176,121,243,102,216,108, 54,168,213,106,164,164,164,200,238,185,231,158,190, 83,166, 76,
-225,125,  8,173, 62,247,223,127,127,136, 70,163,193,139, 47,190, 72, 44, 22,203, 12,199,190,201,227,198,141,139, 40, 44, 44, 52,
- 63,249,228,147,123, 45, 22,203, 71,162,153,232, 42,112,188,220, 88,175, 78,150,213,106, 21,211,180,160,190,190, 30,173, 90,181,
- 74,116,117,182,188,137,193, 29, 59,118,244,  1, 32,153, 58,117,106, 16,128, 50,215, 48,152,205,102,212,215,215, 67,167,211, 89,
-107,107,107,203, 95,123,237, 53,219,210,165, 75, 37,142,115, 78,120, 18, 90, 12,115,135, 89,163, 81,202,  8,145,188, 53,127,254,
-124,245,176, 97,195, 88,181, 90,141,186,186, 58,205,175,235,214,169,  7, 15,234,155, 50, 61,235,195, 13,154,132,174,101, 59, 14,
-231,227, 66,105, 45,204, 86, 43, 82, 98, 67, 26,252, 48,138, 22,135, 99, 32,139,211,209,114, 21, 21, 57, 57, 57,184,253,246,219,
-157,101, 93, 42,149, 54,114,190,252,113,114, 28,135,219,111,191,253, 50,135,103,203,150, 45, 30,221, 39,127,112, 21, 69,238,226,
-200,147,  0, 99, 89,214,239,  2,235,162,155,231, 73,108,185,186,250,110,226,205, 95, 51,  7, 56,142,195,184,113,227,192,243, 60,
- 94,127,253,117,112, 28,135,244,244,116,112, 28,135,140,140, 12,240, 60,143, 91,111,189,181,201,113,223,189,123, 55,186,119,239,
-238, 12, 83,122,122, 58,122,245,234,  5,142,227,208,175, 95, 63,240, 60,143,161, 67,135,  6,194,249,102, 93, 93, 93, 55,181, 90,
-141,220,220, 92, 72, 36, 18, 48, 12,115, 26, 64, 55,  0,136,141,141, 61,163,  6,111,130,189,  0,  0, 32,  0, 73, 68, 65, 84,215,
-235,219, 26,141, 70, 60,245,212, 83,140,217,108,238,250,250,235,175,191,101, 52, 26,169,208,162,104, 49,184,107, 17, 23, 24, 38,
- 76,152,240, 38,195, 48,171, 69,135,202,221,121,242,244,219, 67,221, 36, 58, 80,251, 28,101,181,151,155,136,171, 96, 24,102, 31,
- 33,228, 78,111,231,  2, 48,187,  9,171, 70, 77,135,174,205,134,126, 29, 45,177,242, 13, 84,104,249,131,209,104,188, 49, 42, 42,
-202,171,200,114,253, 52,155,205, 72, 78, 78,134,209,104,188,177,169, 15,141,216,216, 88, 88, 44, 22,124,249,229,151,144, 74,165,
-144, 74,255,208, 23,102,179,111,179,232,248,241,227,  5,187,119,239,238,222,163, 71,143,176,159,126,250,169, 98,192,128,  1,145,
-195,134, 13,131, 66,161,128,193, 96,128,213,106, 69,239,222,189,209,169, 83, 39, 20, 23, 23,227,215, 95,127,173,236,208,161, 67,
-171, 61,123,246,  8,165,165,165,231,124, 80,223, 54,120,240, 96, 48, 12,131,117,235,214, 85,  2,216, 39,151,203,215, 78,155, 54,
- 45,204,108, 54, 11,163, 71,143, 62, 95, 93, 93,253, 18,  0,139, 76, 38,155, 51, 96,192,128,140,236,236,236,111,  5, 65,152,221,
-212,140,234,158,182, 58,157, 14, 65, 65, 65,129, 76, 37,193, 87, 87, 87,119,  1,  0,149, 74, 21, 14,224,140, 51,135, 27, 12,141,
-196,176,217,108, 54,134,135,135,171,  0,192,113, 14,239,133, 51,210,102,195,138,115,231,242,131, 93,251,207,133,134,134,226,145,
-135, 31,102,111,233,211, 71,214,237,198, 27,135,190,253,201,162,239,227, 34, 52,230,148,184,  8, 88,237, 86,100,111, 88, 47, 16,
-193,186,129, 86, 59,127,142,208, 18,197,134,187,163,197,243, 60,182,110,221,122,217, 62,169, 84,138,255,254,247,191,  1,  9,  3,
- 81, 84,121,107, 58,115,107,234, 98,252,  9, 24,158,231, 33,145, 72,176, 96,193,  2,  8,130,128,151, 95,126,185, 81,115,162, 43,
-127, 64,118,158,139,  8,236, 52, 89,  0, 96, 70,241, 76,185,243,124,247,240, 58,206,  9,200, 37,155, 59,119,110, 64,142,214,157,
-119,222,233, 87,184,186,182, 48,184,134,235,208,161, 67, 30,121,231,207,159,239, 55, 61,237,118, 59,214,172, 89,227, 20,169, 34,
-222,126,251,237,167,100, 50, 89,244,182,109,219, 80, 90, 90, 10,157, 78,135,250,250,122,244,238,221, 59,133,101,217,195,165,165,
-165,133, 39, 78,156,184,151,150, 30,138, 63,209,209, 50,205,152, 49,227,216,140, 25, 51, 60, 58, 86,238,206,146, 47,231, 73, 20,
- 88, 14, 65, 20, 41,138, 55, 52,116,171,217,231,239, 92,  0, 50,247,166, 67,159, 70,144,155,138,156,226,169,242, 13,164,249, 48,
- 64, 59,157, 99, 24,  6, 70,163,209,163,192,114, 21,  7, 22,139,  5,213,213,213,176,219,237, 87, 60,215,151,167, 55, 89,127, 66,
-235,232,209,163,255,122,252,241,199, 75, 66, 66, 66,186, 85, 84, 84,148, 11,130,112,235,174, 93,187, 34, 57,142,131, 70,163,129,
- 70,163,193,218,181,107,161, 84, 42, 49,110,220,184,114,187,221,158, 19, 28, 28, 28, 97, 48, 24,126, 47, 45, 45,125,219,171,130,
-225,249,161,253,250,245,195,129,  3,  7,112,233,210,165,141,  0,210, 31,125,244,209,219, 91,183,110,205, 76,155, 54,205,120,246,
-236,217,217,  0,202, 85, 42,213,226,197,139, 23, 15,234,209,163, 71,240,232,209,163,177,117,235,214,249,  0,140,129,198, 89,167,
-211, 53, 18, 88, 90,173, 22,117,117,117, 80,169, 84,182,  0,211,140,199, 31, 35, 12, 65,  8,113,222, 27,135,155, 37,222, 31,194,
-113,156, 56,170,209,155,200,130, 74,165,154,186,104,209, 34,133,251, 32,  5,187,221,142,178,178, 50,104, 52, 26, 76,122,251,109,
-233,123,227,255,221, 93,162,142,222,197,178, 12,204, 22, 82, 67,  4,243,122, 93,217,131,219,128,119,105,205,243, 39, 64, 20,  6,
-119,223,125,247,101,205,133, 82,169, 20, 27, 55,110,196,136, 17, 35,156, 47, 46, 61,122,244,240,251,114, 37, 10,131,187,238,186,
-203,233, 12,173, 95,191,222, 99,179,159,232, 72,  5, 34,  8,197, 99, 95,120,225,  5,112, 28,135,207, 62,251, 12,175,188,242, 10,
- 88,150,197,204,153, 51,193,178, 44,222,121,231,157,128, 69,166,171,128, 41,252,176,225, 51,225, 21, 45,170,230, 69,  3,  0,130,
- 53, 26, 49, 66, 77,170,123, 56,142,115, 58, 89, 55,222,120, 35,120,158, 71, 70, 70,  6, 56,142,115, 58, 89,195,135, 15,119, 77,
- 71, 18,  8, 39,199,113,200,203,203,115,134, 57, 35, 35,163,145,147,197,113, 28,238,188,243,206, 64,130, 57, 61, 52, 52,116, 74,
-167, 78,157, 58,207,154, 53,139,151, 72, 36, 24, 60,120,112,106, 76, 76,204, 57,155,205, 22, 49,117,234, 84,165,135,115, 20,  0,
-186,117,238,220, 89, 69, 75, 13, 69, 11, 58, 90, 83, 60,252, 21,230,218,231,170,  9, 47,146,171, 93,143, 23, 57,220,197,145,195,
- 33,203,241,199,229,233, 92,127,224, 68,  5,233,203, 82, 15, 68,104, 57,108,103,159, 23, 83, 42,149, 71,202,203,203, 51, 20, 10,
- 69, 35,145,229, 73,112, 73, 36, 18,148,150,150, 66,169, 84, 30, 49,153, 76,205,118, 19,253, 53, 29,  2, 48,158, 62,125,122,188,
-203,239, 33,195,135, 15,255,102,227,198,141,177,217,217,217,216,179,103, 15, 34, 35, 35, 49,119,238,220,139,101,101,101,255,  2,
-176,177,178,178,210,239,117,219,182,109,219, 69,173, 86, 99,199,142, 29,  0,176, 21,192,191,159,123,238, 57,198,106,181, 98,222,
-188,121, 58,  0,235, 66, 67, 67,215, 44, 95,190,188,123,183,110,221,100,217,217,217,218, 61,123,246,252, 22,160,200,178, 11,130,
-112,153,192,114, 77,211,224,224,224, 64, 28, 45,107, 72, 72,200, 81,173, 86, 59,202, 96, 48,104,229,114,121,176, 86,171, 53,185,
- 10, 44,145,159,227, 56, 62, 47, 47,175,  4, 64, 74, 72, 72,200, 81,120,105,230,228, 56,110,240,224,193,131, 57,247,123, 80, 86,
- 86,134,210,210, 82, 88, 44, 22,244,232,209,131,145, 48, 86,201,165,162, 35,110,211, 58, 80,145,245, 39, 57, 90, 68, 44,235,226,
- 40, 65, 79, 35, 13,215,175, 95,239,252,205,178, 44,190,254,250,235,128, 68,209,198,141, 27,125,118, 88,119,107, 58,244,107,141,
-139,199,127,254,249,231, 32,132, 56,157, 44,150,101, 49, 97,194,  4,200,229,114, 76,155, 54, 13, 19, 38, 76,  0,199,113,126,155,
- 14, 93,  5, 76,210,235,122,215,151,163,134, 66,225,232, 15,197, 48,140,171,216, 98,  2, 21,111,190,220,188, 64, 90,  2, 92, 57,
-197,243,130,130,130,188,118,132,119,227,244,117,129, 95,  0,228,199,198,198,238,200,200,200,  8,217,191,127, 63,102,206,156, 41,
- 53,153, 76,109,178,179,179,157,215,245,148, 94, 58,157, 78, 65, 75, 14, 69, 75,184, 89, 62,254,174,112,235, 95,197,184, 54,227,
-249,248,116, 63, 30, 46,251, 92,121, 43, 24,134,177,122,184, 94,133,  7,113,229,126, 13,215, 99, 42,188, 58, 90,254, 42, 11,127,
-130, 43, 16, 71, 75,175,215,255,182,110,221,186, 94, 15, 63,252, 48,231,171,217, 80,167,211, 33, 58, 58, 26,199,142, 29,179,233,
-245,250,223,  2,112,202,154, 83,104,185, 35,187,188,188, 92, 98,181, 90,209,190,125,123,196,199,199,195,104, 52,162,166,166, 70,
-  2, 96, 99,128, 28, 82,149, 74, 37,  1,128,154,154, 26,160, 97,168,105,106,135, 14, 29,112,224,192,  1, 84, 87, 87,255,  8, 96,
-216,148, 41, 83,122,244,238,221, 91,250,253,247,223,235,159,121,230,153, 31,173, 86,107, 64, 74, 67, 16,  4,179,205,102, 75,102,
- 89,214, 82, 83, 83,115,193, 53, 61,163,163,163,195, 85, 42, 21, 83, 86, 86,102, 13, 68,104,117,235,214,109,239,249,243,231, 49,
-117,234,212,138,233,211,167,119,168,171,171,187, 84, 91, 91,107,115, 21, 91, 70,163,145,109,213,170,149,124,222,188,121, 10,  0,
-232,214,173,219, 94,111, 66, 75,167,211,181, 86, 42,255,120, 49, 54,153, 76, 40, 45, 45, 69,105,105, 41,202,202,202, 80, 87, 87,
-135,148,148, 20,232,245,250, 68, 90,205,252,101, 66,171, 81,243,153,107,249,118,125,144, 55,165,172,187, 10,152,187,239,190,219,
-217,183, 75,116,200,196,109,197,138, 21,238, 29,204,  3, 18, 90,159,127,254, 57, 94,120,225,  5,  4,  5,  5, 97,214,172, 89,141,
-154, 14,221,197,129, 32,  8, 76, 32,113, 79,126,195,128,210, 57,225,224,121, 30, 17,207,148, 53,106,162,243, 32, 56,  2, 10,231,
-244,233,211,155,165,233,208,149, 51, 49,177,161,168, 44, 88,176,  0,163, 70,141,194,182,109,219,174,184,233, 48, 45, 45,109,201,
-234,213,171, 67,142, 31, 63, 14,173, 86,139,138,138, 10,152, 76, 38, 20, 23, 23,123,109, 21,112,212,229, 65,180,228, 80,252,201,
-245,212,190, 63,147,183, 57,175,199,249,121,128,  7, 44,180,  2,113,180, 76, 38,211,172, 23, 95,124,241,185, 33, 67,134,132,  7,
-  7,  7,163,164,164,228, 50,145, 85, 95, 95, 15,181, 90, 13,131,193,128, 85,171, 86,105, 77, 38,211, 44,127,226,192,106,181, 34,
- 42, 42, 10,149,149,149, 16,188,244,159,102, 89, 22, 10,133,  2,245,245,245,128,159, 78,230,158, 30, 24, 22,139,  5, 86,171, 21,
- 86,171, 21, 22,139,197,239, 91,178,187,153,167, 82,169, 68,225,  1,  0,186,184,184,184,246, 65, 65, 65, 40, 40, 40,  0, 26, 70,
-246, 13,185,253,246,219,249,170,170, 42,242,228,147, 79,110, 39,132, 60,  5,223,179,227,155,115,114,114,146,  1, 64,161, 80,228,
-  2, 64,113,113,177,181,166,166,166,145, 83,168, 84, 42,201,136, 17, 35, 98,  9, 33,200,201,201, 73,150, 74,165,  4,222, 71, 53,
- 26, 87,174, 92,121, 60, 36, 36,100,105, 86, 86,214,195,153,153,153,199,186,116,233,146,172,211,233,202, 13,  6,131,193,104, 52,
- 18,137, 68, 34, 13, 11, 11, 11,218,176, 97,195,153, 93,187,118, 13,209,104, 52, 75, 87,174, 92,121,220,155,243,166, 82,169,138,
-245,122,125,146,120, 79, 93, 69, 86,105,105, 41,  8, 33,200,207,207,135, 82,169, 60,239,175, 89,151,162,229, 32,190, 84,185, 59,
- 47,238,251,  2, 21, 89,174,194, 96,195,134, 13, 62,231,208, 10,148,211, 85, 20,189,242,202, 43,152, 51,103,206,101,142,214,180,
-105,211,  0,  0,111,191,253,118,192,125,180, 68,247,170,116, 78, 56, 98, 94,168,110, 20,118,  0, 96,196,240, 53,173,204,131,227,
- 56, 76,157, 58,245,178, 78,234,174, 77,123,  1, 54,241, 53, 10,103,121,121, 57, 56,142, 67,120,120, 56, 30,121,228, 17, 12, 29,
- 58,212,217,  4,217, 84,222,147, 39, 79,238,120,227,141, 55,186,166,165,165,225,253,247,223,175, 14, 13, 13, 13,254,207,127,254,
-195,213,212,212, 48,190, 28, 45, 42,180, 40, 40,154, 65,104,137,  5, 44,208, 81,135, 94, 42,203, 33,104, 60,215, 70,173, 94,175,
-127,228,182,219,110,251,105,217,178,101,138,182,109,219,226,228,201,147,168,174,174,134,217,108,134, 84, 42, 69,108,108, 44,106,
-106,106,240,245,215, 95, 27,244,122,253, 35,  0,106,253,112,190,213,179,103,207, 47, 62,254,248,227,160,244,244,116, 84, 87, 87,
-163,190,190,222, 41,132, 24,134,129, 70,163,129, 66,161,192,222,189,123,177,126,253,122,  3,128,183,252,112,122, 82,115,176, 88,
- 44, 78,193, 21,128,208,114,229, 84,137,174,142, 94,175,  7,  0,107,235,214,173, 99,  0, 32, 63, 63, 31,  0, 10, 83, 82, 82,166,
-180,109,219,150, 89,188,120, 49, 33,132,172,247, 34,178,156,156, 12,195, 84, 19, 66, 46,  1,136, 49,155,205, 82,  0,168,173,173,
-181,180,106,213, 42, 74, 46,151, 11, 10,133, 66,  8, 10, 10, 18, 74, 74, 74,108, 54,155, 77, 10,  0,253,250,245, 51,  3, 40,117,
- 91,163,208,149, 83, 32,132,104,231,207,159, 63,101,244,232,209, 25,125,250,244, 73,123,246,217,103,143, 62,249,228,147,108,124,
-124,124, 88, 93, 93,157,241,244,233,211,151, 62,249,228,147,186,221,187,119, 15,225,121,254,220,252,249,243,167,  0,208, 50, 12,
- 35,120,226,180,217,108,191,101,103,103,255, 43, 51, 51,147,187,112,225,  2,202,202,202,156, 34,171,172,172, 12,157, 58,117,194,
-174, 93,187,236, 22,139, 37,187,  9,233,217, 92,160,156, 13, 47, 33, 68, 44,235,222,  4,150,248, 50, 21, 40,167,171, 40, 26, 53,
-106, 84, 35, 23, 75, 42,149,226,135, 31,126,240, 88,111,120, 40, 87,141,226,238, 58,199,215, 27,111,188,209, 72,180, 77,154, 52,
-201,107,117,230, 47, 61, 69,158,218,  5,241,141, 71, 29,122, 41,231,190,194, 41,214,157, 60,207, 99,210,164, 73,  1, 59, 90,184,
-188,143,214,101,156, 98,220,  7, 12, 24,  0,189, 94,239, 20,178,222, 28, 45,127,233,105,183,219, 95,152, 51,103, 14,209,104, 52,
- 55,107,181,218, 71,207,159, 63,191, 80,175,215,223, 84, 91, 91,235,211,209, 50,153, 76,114, 90,142, 40, 39, 90,102,126,174,235,
- 71,104, 57, 30,146,104,221,186,117,163,181,179, 88,150,109,180, 53,165,159,129,  3, 27,242,242,242,238,187,229,150, 91,190,125,
-225,133, 23,130,211,211,211,249,164,164, 36,232,116, 58, 20, 20, 20,224,216,177, 99,182,149, 43, 87,106,245,122,253,163,  0,  2,
- 25,117,182,232,248,241,227,235,135, 13, 27,246, 78,239,222,189,159,158, 60,121,178, 36, 53, 53, 21,181,181,181,  8, 11, 11, 67,
- 84, 84, 20, 78,157, 58,133, 85,171, 86,217, 43, 43, 43,191,  0,240, 30, 60,180,161,250,123,225,183, 88, 44,120,232,161,135, 32,
-  8,  2,102,207,158,141, 64, 22, 84,118,129,197, 98,177, 16,  0,140,163, 63,151,222, 49,187, 52, 78,159, 62, 13,  0,231,146,147,
-147,131,  1, 32, 59, 59,155, 65,195,252, 90,129,188,225, 19, 66,136,211,217,234,212,169, 83,129,123,229, 40, 58, 89,162, 11,230,
- 47,220, 12,195, 24,  9, 33,229,122,189,126,216, 43,175,188,242,206,231,159,127,254,240,231,159,127,126,217,113, 26,141,102,233,
-204,153, 51,223,123,224,129,  7,202, 25,134,241,218,143, 76,167,211,189, 61,102,204,152,  7,142, 28, 57, 18, 28, 20, 20,  4,157,
- 78,135,170,170, 42, 88, 44, 22,164,164,164,160,188,188, 28,139, 22, 45,170, 51, 24, 12,239,210,226,248,215,192, 85, 24,120,115,
-181,  2, 16, 89, 94, 93,157, 95,126,249,197,227, 28, 85, 77,229,116, 23, 27,129,206,109,229,235,165, 72,156,150,198,211,148, 17,
- 77,172,215, 46,227,229, 56, 14, 31,125,244,145,115,210, 86, 79, 78, 86, 83, 28, 45,145, 51, 60, 60,188,193, 38, 87, 42, 33,  8,
-  2,238,188,243,206,171,225, 21,  0,140,115,153,241,125,250,107,175,189, 54,165, 83,167, 78,169,  0,228,174,105,208, 68, 23,159,
-130,130,194,159,208,178,219,237,197, 29, 59,118,108, 84,193,249, 91,204,212,106,181, 22,  7,120,221,245, 58,157, 46,101,230,204,
-153, 47,170, 84,170, 33,122,189,190,171,163,226, 56,162,211,233,178, 77, 38,211,167,104,218, 34,208, 21,  0,158,223,189,123,247,
-236, 97,195,134, 77,187,245,214, 91, 71,142, 31, 63,158, 33,132, 96,222,188,121,228,236,217,179, 43, 28, 46,214,217, 43, 73,164,
-240,240,240,227, 95,127,253,117,244, 79, 63,253,  4,171,213,138, 79, 63,253, 20,193,193,193,199,171,171,171,  3,165, 40,223,180,
-105,211, 55,125,250,244,121,108,215,174, 93,139,  0,252,190,117,235,214,133,125,251,246, 29,179,107,215,174, 37,  0,142,109,222,
-188,121, 97,239,222,189,199,236,219,183,111, 57,128, 67, 77,168,124,157,206,150,205,230,185,165,209,139,147,229,139, 83, 75,  8,
-177, 60,254,248,227,227, 31,120,224,129, 47,247,237,219,119, 83, 77, 77, 77, 87,  0,  8, 13, 13, 61,210,171, 87,175,189,203,150,
- 45, 59,229,112,178,252,117,214,175,208,233,116, 35,186,118,237,250,227,251,239,191,175, 74, 75, 75,227,218,183,111,143,194,194,
- 66, 28, 61,122,212,246,191,255,253,175,222, 96, 48,220, 13,224, 18, 45,142,127,157,208, 34,132, 32, 52, 52,180,209, 75,148, 56,
-228,191,169,205,133,174, 15,102,113,169, 30,119, 94,111,156,190,166, 77, 16,161, 86,171,157,147,155,  6,210,101, 65, 16,124,207,
-199, 70,  8,113,114,138, 91,  0, 34,203,239,  8, 65,199, 18, 56,  1,115,  6, 50,189,131, 74,165,130,213,106,117,242,  6, 48,242,
-179,169,106,241, 23,  0,191, 88,173,214,211,  0,218, 81,113, 69, 65,209,130, 66,235,210,165, 75, 61, 91,248,218, 90,147,201,244,
-158,201,100,122, 79,220, 97, 52, 26,175,150,243, 44,128,  7, 54,109,218,244,241,166, 77,155,196,118,132,169,240,191, 94,162, 79,
-156, 60,121, 50,147,231,249,255, 46, 93,186,180, 55, 33,  4, 33, 33, 33,187, 11, 11, 11,255,211, 20, 14,187,221,254,248,174, 93,
-187,158,131,163, 47,147,197, 98,121,124,199,142, 29, 47,162, 97, 61, 38,216,237,246,199,247,236,217,227,252,221,196,  7, 37, 33,
-132,152,  8, 33,113, 94, 14, 49, 53,209,129, 19,157, 45,243,178,101,203,234,  1, 28,198, 31,243,100, 89, 29,155,209,173,185,208,
- 23, 54,235,116,186,246,147, 38, 77,154, 46,145, 72,  6,235,116,186,120,149, 74, 85,100,179,217,126,211,235,245,111,161, 97,141,
- 42,138,191,  8,102,179,249, 66,199,142, 29, 57, 79, 47, 80,190, 30,228,190, 94,172,236,118,123,113,135, 14, 29,252,190,156,121,
-224,188,224, 67, 52,156, 75, 73, 73, 97,  3,229, 18, 97,177, 88,202,125,133, 51, 37, 37,  5, 77,229,244, 23,247,228,228,100,143,
-113,247, 35,  8,189,198,221,102,179, 93, 17,167,175,244,244,  5,131,193,112, 41, 50, 50,178,222,104, 52,242, 38,147,137,183,217,
-108,141,236, 71,133, 66, 81, 97, 48, 24,104,225,161,160,184, 26,161,245, 15,199,126, 52, 44, 47,209, 92, 48, 29, 57,114,228, 49,
-167, 61, 85, 94,126,165, 60,238, 74,178,222,207,239,166,  8,163,102,119,132, 28, 66, 74,223, 76,116,149,245,245,245, 79,138, 63,
-196, 62, 32, 20,127, 61,170,170,170,110,110,110,206,234,234,234,102,127, 81,171,172,172,204,104,129,184,247,188, 94, 57,125,161,
-164,164,228,102, 63, 66,140, 22, 28, 10,138,  0,193,210, 36,160,160,160,160,160,160,160,160,104, 25, 48,104, 24, 57,224,  9, 77,
- 25, 77, 48,228, 10,174,157, 77, 57, 41, 39,229,164,156,148,147,114, 82,206,235,142,211, 31, 55, 29,205,216,194,  2,140,114, 82,
- 78,202, 73, 57, 41, 39,229,164,156,215, 31,231, 53,  9,218,116, 72, 65, 65, 65, 65, 65, 65, 65, 65,133, 22,  5,  5,  5,  5,  5,
-  5,  5,  5, 21, 90, 20, 20, 20, 20,174, 72,109,221,186,245,137,212,212,212, 11,  0,198,182,240,181, 30,233,221,187,119,149, 92,
- 46,223,  0, 32,149, 38, 61,  5,  5,  5, 21, 90, 20, 20, 20,215,180,200,234,218,181,235,246,147, 39, 79,118,202,206,206,142,139,
-143,143,255,176, 37, 47,214,179,103,207, 15,182,109,219, 22,190,110,221,186,219, 98, 98, 98,114,174, 80,108,165,182,105,211,230,
- 68,106,106,106, 49,128, 71,154, 57,136, 99, 51, 50, 50,170,101, 50,217,122, 42,  4, 41,174,  3,116,  1,208,149, 10, 45, 10, 10,
- 10,138, 22, 20, 89, 59,119,238,140, 48, 26,141, 56,121,242, 36, 42, 42, 42, 14,181,228,  5,115,115,115, 47,237,220,185, 19,  9,
-  9,  9, 88,178,100, 73,100,114,114,242,182, 38, 10,154,212,174, 93,187,110, 63,113,226, 68,167,236,236,236,248,168,168,168, 79,
-154, 51,124, 55,221,116,211,180,109,219,182,133,109,216,176, 97,104,100,100,228,149, 10, 65, 10,138,191, 51,228,  0, 30, 99, 24,
-102,111,151, 46, 93,142,164,165,165,253,206, 48,204, 46,  0,163,112,237,206,221, 25, 24, 86,175, 94,189,117,245,234,213, 91,105,
- 30,161,160,160,104,  6,164,165,165,165,233,116, 58, 29,169,168,168, 32,159,125,246, 25,  9, 15, 15,183,  0,248, 13,192, 74, 15,
-219,155,  0, 52,  1,114,107, 28,199,123,226,249, 45, 60, 60,220,242,217,103,159,145,252,252,124,114,252,248,113,146,154,154,106,
-  8, 80,208,164,118,237,218,181, 82, 12,243,218,181,107,  9,199,113,235,155, 51, 81, 52, 26,205,177,156,156, 28,114,246,236, 89,
-178, 97,195,  6, 18, 29, 29, 93, 78,197, 22,197, 53,130, 36,  0, 31,168,213,234,234,187,238,186,139,124,245,213, 87,100,213,170,
- 85,228,199, 31,127, 36,179,102,205, 34,131,  6, 13, 34, 50,153,236,  2,128,215,  1,132, 94, 79, 90,132,113, 68,140,  0, 24,  8,
-  0,153,153,153, 84,108, 81, 80, 80, 92, 45,118,234,245,250, 12,189, 94,143,186,186, 58,180,110,221, 26, 60,207,123, 60,176,188,
-188, 28, 59,118,236,192,184,113,227,142,151,150,150,246,135,239,117, 47,195,186,119,239,190,115,243,230,205,169,193,193,193,206,
-157,130, 32,192, 98,177,192,106,181,194, 98,177,192,100, 50,193,100, 50, 65, 38,147, 65,161, 80, 32, 60, 60,252, 40,124, 55, 97,
- 56,221, 55,131,193,128,131,  7, 15, 98,244,232,209, 21, 85, 85, 85,253,  1,228, 54, 99,186,164, 70, 69, 69,229, 44, 90,180, 40,
- 50, 37, 37,  5,231,207,159,199, 19, 79, 60, 81,121,238,220,185,126,205,124, 29, 10,138, 63, 19, 19,238,187,239,190,105,209,209,
-209,108,151, 46, 93, 16, 27, 27, 11,147,201,  4,131,193,  0, 66,  8, 56,142,  3, 33,  4,181,181,181,200,201,201,193,230,205,155,
- 77,151, 46, 93,250, 26,192,167,  0,242, 92, 68,214, 53,169, 69,156, 66, 43, 51, 51,147,161,121,133,130,130,162,153,112,164,182,
-182,182,139,201,100,130, 78,167, 11,232,132,252,252,124,140, 29, 59,246,120,105,105,233, 45,240,188,168,188,166,123,247,238,123,
-114,114,114, 82,141, 70, 35,180, 90,255,235,206,203,100, 50,  4,  5,  5, 33, 34, 34, 98, 23,128, 62,222,222,196,187,116,233,178,
-127,215,174, 93,225,  6,131,  1,135, 14, 29,194, 35,143, 60, 98,169,174,174,222, 14,192, 91,224,171,209,176,142,234, 57, 15,255,
- 37,  2,120,209,241,134,239,  9,170,200,200,200,190,139, 23, 47,150,182,109,219, 22,122,189, 30,163, 70,141,170,206,205,205,237,
-  5,160,128,102, 29,138,127, 32,114, 79,158, 60,217,193,110,183,163,178,178, 18, 38,147,  9,122,189,222, 41,180, 36, 18,  9,  8,
- 33,176,217,108,206, 23,163,  3,  7, 14, 32, 59, 59,155,228,231,231, 79,118,148,165,107, 86,139, 80,161, 69, 65, 65,209, 18, 72,
-237,208,161,195,161, 95,127,253, 53, 72, 42,149, 98,213,170, 85,152, 60,121,178,181,186,186,122,155,187,120,137,142,142, 78, 91,
-184,112, 97,114, 74, 74, 10,126,255,253,119,220,127,255,253,111,  1,152,238,129,243, 77,173, 86, 59,205, 98,177,224,208,161, 67,
- 24, 51,102, 76, 65, 89, 89,217, 49,119, 17,147,156,156,220,239,147, 79, 62,225,123,244,232,  1,173, 86,139,145, 35, 71,234, 79,
-157, 58,213, 27,192, 49, 47, 97,253,164,186,186,250, 21,187,221,142,186,186, 58, 36, 36, 36, 64, 42,149,250,140,156,193, 96, 64,
- 82, 82,210,174,138,138,138,203,196, 91, 68, 68,196,166,243,231,207, 15, 82, 40, 20, 62, 57, 44, 22, 11,138,139,139, 33,147,201,
- 96, 50,153,208,174, 93,187,175,  1, 60, 78,179, 14,197, 63, 81,104, 29, 62,124,184,195,119,223,125,135,238,221,187,163,115,231,
-206,168,175,175,119,138, 46,179,217, 12,171,213,122,217, 73, 90,173, 22, 47,191,252,114, 30, 28,205,231,215,170, 22, 17, 59,166,
- 77, 17,219, 68, 51, 51, 51,  7,208, 60, 67, 65, 65,113,181, 21,111, 94, 94, 94,250,144, 33, 67,182,173, 88,177,162,213,240,225,
-195,209,174, 93, 59,254,222,123,239,141,212,235,245,131, 93, 15, 44, 43, 43, 11, 27, 51,102,204,254,162,162,162,100,199,174, 94,
- 94, 56,123,  5,  7,  7, 35, 63, 63, 95, 20, 89, 61,225,214,204, 40,147,201,214, 31, 62,124,152,151,201,100,216,183,111, 31,198,
-142, 29, 91, 89, 80, 80,224,175, 89, 46,212,108, 54, 67, 34,145,  0,  0,138,139,139,253, 70,238,252,249,243, 16,  4,193,228,233,
- 63,150,101,229,  7, 14, 28, 64, 92, 92,156, 79, 14,150,101,221,  5, 93, 13,205, 54, 20,255, 80, 88,205,102, 51,122,246,236,137,
-130,130,  2, 28, 56,112,192, 41,184, 42, 43, 43, 81, 82, 82,210,232,224,189,123,247,226,224,193,131,232,223,191,191, 59,207, 53,
-169, 69,156,202,113,245,234,213,  3, 28,145,219, 74,243, 12,  5,  5, 69, 51, 33, 53, 46, 46, 46,103,209,162, 69,145,177,177,177,
- 24, 52,104, 80, 81,105,105,105, 27, 15,199,173, 36,132,220,157,159,159,143,182,109,219,174,  2,112,207,149, 28,147,152,152, 88,
-177,111,223,190, 86,199,143, 31,199, 35,143, 60, 82,225,232,243,229,175,239, 83,114,167, 78,157,246,109,216,176, 33,156,101, 89,
- 28, 59,118, 44,144,166,195, 66, 52,244, 47, 57,231,225,191, 68,  0,147,  0,132,123, 57, 87,213,161, 67,135,190,251,247,239,151,
- 50, 12,131,194,194, 66,177,233,176,167,131,151,130,226,159,134, 17,113,113,113,255,123,238,185,231, 66,122,247,238,141,226,226,
- 98, 92,184,112,  1,151, 46, 93, 66,122,122, 58,210,210,210,112,246,236, 89,172, 95,191, 30,  7, 15, 30,132, 92, 46, 71, 66, 66,
-  2,212, 75,191,195,127, 25, 28,  7,144, 70,181,  8,  5,  5,  5,197, 85,136, 45,169, 84,186, 62, 62, 62,190, 28,158,231,165, 10,
- 27, 57,114,100,137,221,110, 39,103,207,158, 37,104, 24, 61,  8, 47, 66,139,156, 61,123,150, 68, 71, 71,231,  3,  8,243,112,204,
-216,152,152,152, 34,165, 82,121, 20, 77,156,214,161,125,251,246, 21,167, 78,157, 34, 69, 69, 69,100,221,186,117, 36, 34, 34,162,
- 37, 70,  4,166,118,236,216,177,178,174,174,142, 24,141, 70,146,147,147, 67, 18, 19, 19, 43, 64, 71, 30, 82,252,243, 17, 12, 96,
-106, 74, 74,138,241,227,143, 63, 38,235,215,175, 39, 11, 22, 44, 32,211,166, 77, 35,227,199,143, 39, 25, 25, 25, 36, 35, 35,131,
-140, 26, 53,138,188,242,202, 43,228,246,219,111, 39,106,181,186, 22,192,189, 52,233, 40, 40, 40, 40,154, 23,137,  0,102, 57,  4,
-213,202,145, 35, 71,150,152, 76, 38,114,225,194,  5,242,195, 15, 63, 16, 52, 76,221,224,  9,111,150,150,150,146,210,210, 82,113,
-106,132,124,252, 49,173,195, 87, 14,222,171, 18, 65, 73, 73, 73, 21,251,247,239, 39,133,133,133,100,237,218,181,196, 33,216,154,
- 13, 10,133, 98,131, 86,171, 37, 70,163,145,108,218,180,137, 78,239, 64,113, 45, 34, 10,192,220, 27,110,184,193, 58,123,246,108,
-178,114,229, 74,242,217,103,159,145, 17, 35, 70,144,215, 95,127,157, 60,248,224,131, 36, 50, 50,210,  4, 32, 11, 64,  8, 77,174,
-171,  7, 93,217,156,114, 82, 78,202,233,142,245,199,143, 31, 39, 34,236,118, 59,185,112,225,  2,217,176, 97,  3,137,137,137, 57,
-134,198,243,105,185,114,106, 58,119,238,124,242,212,169, 83,228,252,249,243,196, 98,177, 56, 57, 78,158, 60, 73,  0,108,109,134,
-112,166,198,199,199,151,111,217,178,133,156, 58,117,138,196,196,196, 20, 53,103,220,147,146,146,202, 43, 42, 42,200,166, 77,155,
- 72,100,100,164, 63,145, 69,243, 18,229,252, 39,115, 38,  1, 88,220,163, 71, 15,251,156, 57,115,200,211, 79, 63, 77, 18, 19, 19,
-237,142,151,162,248,235, 73,  8, 93,223,179,180, 82, 80, 80,252, 21,144,239,222,189, 27,114,185,220,185,227,247,223,127,119,157,
- 71,203,219,188, 13,218, 19, 39, 78,220, 50,124,248,240,109,115,230,204,233,236, 58,138,105,203,150, 45,  0, 96,106,134,176,229,
- 94,184,112,161,255,176, 97,195, 62,141,136,136,184,177,180,180,244,157,230,140,120, 97, 97,225, 43, 93,187,118,157, 94, 87, 87,
-167,213,235,245,163, 64,231,206,162,184,118, 81,  8, 96,244,129,  3,  7, 62, 60,112,224,192, 91,  0,  8,128,247,  1,156,184,222,
- 18,130, 10, 45, 10, 10,138, 63, 27, 99,159,124,242, 73,247,206,226,251,  0,252,159, 15,145, 37,226, 82, 65, 65, 65,159, 59,239,
-188,243, 57, 52, 30,157, 40,118, 78,111, 14,228,154,205,230,161,238, 35,165,154,  9, 75, 74, 75, 75,151,208, 44, 64,113, 29,225,
- 24,128,  7,175,231,  4,160, 66,139,130,130,226,207,198, 57,  0, 79, 92,197,249, 90,120,158,103,139,130,130,130,226,111,  7,186,
-168, 52,  5,  5,  5,  5,  5,  5,  5,  5, 21, 90, 20, 20, 20, 20, 20, 20, 20, 20,255, 44, 48,240, 62,114, 32,187,  9, 60, 87, 50,
-162, 33,155,114, 82, 78,202, 73, 57, 41, 39,229,164,156,215, 29,167, 63,238,108, 80,180,168,  0,163,156,148,147,114, 82, 78,202,
-249,207,230,100, 28, 27,235,216,196,223,127,231,184, 51,127,227,184, 95, 47,156,215, 36,254,170,206,240,226,141, 16,208, 48,228,
-147,226,239,  7,215,  2, 66,232,125,162,160,160,104, 98,221, 33,113,121,216,218, 29, 27,254,134,117,137,171, 40, 16,174,242,185,
-212, 18,113,191,158, 57,175,121,161,117,163, 74,165,154, 44,147,201, 82, 24,134,177,235,116,186, 35, 38,147,105, 62,128, 93, 87,
-121,205,175,162,163,163,199, 86, 85, 85,  9, 44,203,130,101, 89, 48, 12,  3,150,101,193,243,188,161,182,182, 86,115, 37,164,145,
- 93, 70,188,202, 49,204, 11,118, 98,159, 95,126,116,213, 52,127,251, 41,124, 23, 24,169, 84,122, 95,120,120,120,104, 69, 69,  5,
- 97,217,134,174,124, 18,137, 68, 92,  8,215, 86, 91, 91,251, 77,160,100, 97, 97, 97,123,195,195,195, 67,197,243, 25,134, 65, 85,
- 85, 85, 77,121,121,249, 77,  0, 16, 20, 20,180, 67,165, 82, 69,112, 28,  7,137, 68,  2,137, 68,  2,189, 94, 95, 85, 85, 85,117,
- 11,189, 21,255, 76, 44, 95,190, 92, 50, 44,254,137,118, 28, 49,116, 99, 89, 18, 34,  8, 76,173,141, 81,252,190,254,194, 87,103,
-  2, 57,127,212,168, 81,118,154,138,127, 30,100, 50,217,236,232,232,232,127,215,215,215,235, 25,134, 33, 12,195,128, 97, 26,222,
-179,220, 63,237,118,123,113, 85, 85, 85, 79, 63, 15, 91, 94, 38,147,205,140,137,137, 25,163,215,235,245, 14, 62,143,188,  0, 96,
-181, 90,139, 43, 43, 43,123,  6, 84,215, 71, 70,206, 87, 40, 20,143,234,245,122, 29,195, 48,130,235,127,132, 16,215,135,249,217,
-202,202,202,126,254,132,129, 76, 38,251, 52, 58, 58,250, 95,142,184, 59,195,121,181,113,143,142,142, 30,163,211,233,  2,226,244,
- 17,247,203, 56, 91, 34,156,127, 83,206,107, 95,104,165,167,167,127,183,103,207,158, 14, 60,207,  3,  0,140, 70, 99,215,185,115,
-231, 62,246,198, 27,111,100,  1,152,120,133,215, 91,216,175, 95,191,135,114,114,114,216,149, 43, 87,178,189,122,245,  2,195, 48,
-176,219,237,176,219,237,232,210,165,139,226, 74, 35, 18,162, 82, 78, 56,184,241,191, 65, 55, 14,121,242,133,114, 96,154,191,253,
-190,  4, 38,128,183,  1,164, 52, 49,  8, 21,142,116, 57,232, 69,108,236,100, 89,182, 73,156,130, 32,228, 95,186,116,169,143, 15,
-  1,211,236,156, 14,145,117,127,191,126,253, 66,178,179,179,153,162,162, 34, 70,161, 80, 64, 16,  4,216,237,118, 88,173, 86,220,
-112,195, 13, 77,114, 66, 67, 67, 67, 53, 19, 38, 76,104,119,199, 29,119,224,135, 31,126,192, 99,143, 61,134,190,125,251,230,149,
-151,151,  3,  0, 84, 42, 85,196,241,227,199, 59,132,135,135, 67,175,215,163,182,182, 22,183,221,118, 27,170,170,170,254,209,133,
-235,230,244,132,247, 25,150,113,206, 21, 69,108,246,234, 61,191,151,188,125,181,188,225,225,225,  7,229,114,121,180, 95,181,236,
-242, 32, 51, 26,141,101,213,213,213,221,253,156,146,  4,224, 46,137, 68,210,158,227,184,142,  0,146,108, 54, 91, 52,  0, 72,165,
-210, 50,137, 68, 82,104,181, 90, 79,153,205,230,211,  0,126,129,143,  5,144,135,197, 63,209,142,177,233, 71,214,153,132,225,202,
-182, 89,169,250,179, 19,114,149,114,253,218, 97,241, 79,172,  8, 84,108,253,133, 72,  5,176, 12, 13, 11, 74, 63,141,134,121,128,
-174,  6,241,  0,238, 70,195,154,143,201, 22,139,165, 18,192,  1, 52,244, 67,201,  3,144, 24, 25, 25,185, 68, 16,  4, 83, 85, 85,
-213, 19,240,176, 80,117,239, 30,173,247,179, 44,155, 32,122,  2,  2,177, 23,239, 62, 80,220, 44, 15, 40,150,101, 63,205,204,204,
-252,215,138, 21, 43,148,  7, 14, 28, 80,118,238,220,217,249, 66, 36,  8,  2, 26,107, 23, 32, 57, 57,217,159,171,193,177, 44, 59,
-123,228,200,145, 15, 47, 94,188, 88,121,238,220, 57,101, 92, 92,156,147,211, 85,108,137,136,139,139, 11, 52,239,127, 53,116,232,
-208,209,139, 22, 45,226, 87,173, 90,165,104,213,170, 21, 34, 34, 34, 32,149, 74, 47, 59,246,150, 91,110, 17,252, 71,157,253,244,
-158,123,238, 25,253,253,247,223, 43,247,236,217,163,236,210,165, 11, 36, 18,201, 85,199,125,196,136, 17, 15,127,247,221,119,202,
- 35, 71,142, 40,219,183,111, 15,209, 84,112,231, 99, 89, 22,173, 91,183, 14,136,243,238,187,239,126,120,217,178,101,202,131,  7,
- 15, 42, 59,118,236,232, 76, 79, 66,200, 21,135,243,111,206,121, 93, 56, 90, 50,139,197,130,173, 91,183,130,101, 89,132,135,135,
- 99,236,216,177,216,184,113,227,132, 77,155, 54,173,190,  2,103,235, 43,135,200,226,  1,224,199, 71, 71, 32,159,  7,198,149,155,
- 33,149, 74,113,246,236, 89, 72, 36,146, 38, 91,139,114,185,124, 12, 33,100,146,254,194, 62,185,193, 96,133,177,100,191, 82,161,
- 80, 56, 31,  0,250, 18,199,254,139,251,149, 10,133,226,172, 68, 34,153, 90, 95, 95,191,208, 27, 95,251,246,237,191, 61,118,236,
- 88, 39, 79,  5,215, 23,244,122, 61,218,180,105,147, 88, 93, 93,221,222,211,255, 60,207, 39,156, 59,119, 46, 74, 38,147,129, 16,
-226, 44,196,238,159,226,119,139,197,130, 27,110,184,193,226,235,154,190, 56,109, 54, 27,130,130,130, 32,186, 81,102,179, 25,245,
-245,245,254, 56, 25,169, 84,122,159, 40,178,  0, 96,233,210,165,136,137,137, 65, 84, 84, 20, 84, 42, 21, 20, 10,133,147, 51, 80,
- 72, 36, 18, 12, 27, 54, 12,239,190,251, 46,178,178,178,240,218,107,175, 53,170,104,121,158, 71,120,120, 56,214,173, 91,  7,141,
- 70,131,196,196, 68,136,  2,255, 31,109, 11,178, 76,248,174,253,231,157, 14,237,237,183,118,226,110,238,206,125,238,120, 84,130,
-101,  1, 65,104,120,116, 50, 12,136,205, 42, 92,218,127,164,228,157,  0,210, 51,174,176,176, 48, 42,208, 52,178,217,108,136,139,
-139,147,248, 57,108,120, 90, 90,218,143,207, 62,251,172,180,125,251,246,140, 84, 42,  5,199,113,224, 56, 78, 20,232,137,132,144,
- 68, 65, 16,  6,150,149,149,145,185,115,231,126,184,101,203,150,123,  1,172,245, 88,177, 16, 67,183, 58,147, 48,124,219, 33,220,
- 52,114,200, 27, 88,183,124,194, 77,253,210,  5,  4, 43, 13,103,  0,252,157,133, 86,106, 90, 90,218,161, 61,123,246,  4, 89, 44,
- 22,244,238,221,123,119,110,110,110, 15, 92,217, 12,238, 97,  0, 62,153, 56,113,226,232,103,159,125, 86, 18, 26, 26, 10,153, 76,
-134,186,186, 58,156, 57,115,102,204, 55,223,124, 67,190,248,226,139,255,  3, 16, 92, 88, 88,152,177,119,239, 94, 12, 26, 52,232,
- 69,  0, 47, 95,174,  8, 36,  9, 59,246, 22, 68,137,191,239, 30,214, 85,154,209,147, 45,107,112,113,220,143, 38, 16,236, 66,241,
-222,195, 23,  2, 17, 98, 31,142, 24, 49,226,145, 21, 43, 86,168,  1, 96,222,188,121,184,239,190,251, 16, 30, 30, 14,165, 82,  9,
-169, 84, 10,158,231, 27,125,250,121,216, 74,  0,124,248,224,131, 15,142, 92,188,120,113, 48,  0, 44, 94,188, 24, 35, 70,140, 64,
- 68, 68,  4,130,131,131, 33,147,201, 32,145, 72,154,156,152,225,225,225, 95,245,189,233,166,199, 23, 45, 90,  4,  0,120,235,165,
-151,112,199,205, 55, 67,173, 84, 64,169,144, 65, 76, 11,153,132,199,237,227, 94,240,171, 47,  1,124,124,223,125,247, 61,240,253,
-247,223,  7,  3,192,129,  3,  7, 80, 94, 94,142,232,232,104, 40, 20, 10,200,100, 50,103,156, 25,134,129, 66,161,  8, 40,238,247,
-221,119,223,200,239,190,251, 46, 24,  0, 22, 46, 92,136, 97,195,134, 57,227, 46,151,203, 33,149, 74, 27,109,238,162,211, 19,231,
-189,247,222, 59,114,217,178,101,193,  0,240,205, 55,223, 96,200,144, 33,  8, 11, 11,115,166,167,200,213,148,123,244, 55,231,188,
- 62,132,214,161, 67,135,238, 87,169, 84, 51,  0, 68,202,100,178,208,135, 31,126,184,245,227,143, 63,142,  7, 31,124, 16,155, 54,
-109,122,170,137, 66,139,137,142,142, 30,155,147,147,227,124, 66,155,201,101,130,169,201, 15,112,  7, 38,237,127,234,169,152,172,
- 51,245,216,189,247, 20,130,192, 50,123, 63,254, 56,210,120,250, 52,236,102, 51,222, 59, 91,215,176,223, 70,152,173,175,140,139,
-185,113,246,255, 77,  2,176,208,135, 11, 32, 55,153, 76,200,203,203,107, 82, 32,138,138,138, 32,  8,130,201,151,187, 32,149, 74,
-113,244,232,209,203, 84,189, 39, 36, 38, 38,250, 42,128,126, 57,215,175, 95,143,241,227,199,227,212,169, 83, 16,151, 42,  9,128,
-147,  9, 15, 15, 15, 21, 69,150, 40,130, 20, 10,  5,120,158,103, 56,142, 99,196,166, 61, 71,225, 10, 72, 24,179, 44,139,111,191,
-253, 22, 31,124,240,  1, 94,127,253,117,204,159, 63, 31,221,186,117,251, 35, 19,114, 28,180, 90, 45,194,194,194, 16, 22, 22,214,
- 72, 32,254,147,225,126,155,103,206,154,163,132, 64, 26, 58,129, 16,  1, 16,  0,  2,  2,129,  8, 40,187,112,  6,147,223,253, 40,
-224,167, 15,207,243, 56,125,250,180, 51, 31,136,206,176, 40,140, 92, 93,131,164,164, 36,191,121, 73, 42,149, 78,249,249,231,159,
-101,223,126,251, 45,190,255,254,123, 48, 12,  3,185, 92, 14,149, 74,133,208,208, 80, 68, 68, 68, 56,183,132,132,  4,230,127, 61,
-184,254,121,  0,  0, 32,  0, 73, 68, 65, 84,255,251,159,180, 91,183,110, 83,180, 90,237, 90,207,247,156,132, 40,219,102,165,142,
- 28,242,  6,  0, 96,228, 27,  4,151,242,166,221,200,214,188,243,119, 94, 68, 54,181,107,215,174,219,119,238,220, 25,164,215,235,
- 33,  8,  2,214,174, 93,171, 28, 50,100,200,182,130,130,130,126, 77, 21, 91, 73, 73, 73,171,118,238,220,121, 75,100,100, 36,106,
-107,107,161,213,106, 97,181, 90, 33,145, 72,144,152,152,136, 15, 63,252,144,185,231,158,123,158, 31, 51,102,140, 81,161, 80,136,
-206, 70,146,231,188,212, 56, 51,205,253,236,243, 80, 66, 26,242, 15, 17, 72,163,207,234,242, 66,188,244,202,228,128,194,216,186,
-117,235,167,127,248,225,  7,181,171,179,228, 42,  2, 92, 69,150,184,249, 17,  6,108,155, 54,109, 30, 95,178,100,137,147,179, 85,
-171, 86,224, 56, 14, 60,207,131,227, 56,176, 44,139,109,219,182, 97,198,148,137,  8,139,140,195,156,207,230,249, 13,103,100,100,
-228,252, 97,195,134, 61,186,112,225, 31, 85,119,215,182,109,113,231, 45, 55, 35,170,149,  6,173,194,130, 27,210, 73, 96,240,251,
-169,  2,191,207, 35,  0,108,235,214,173,159, 88,190,124,185,218,245,133, 80,140,171,248,242, 44,186,248,102,179, 25, 61,123,246,
- 12, 40,238,174,156,162,219, 38,138, 54, 49, 61,197,235,136,229,213, 79, 56, 31, 23,133,176, 67,112, 54,226,224,121, 30,203,215,
- 45,242,234,102, 95, 41,103, 83,239,187, 59,103, 97, 97, 33,166, 79,159, 14,241,165,205,181,171, 80,124,124, 60,230,204,153,227,
-183, 94,114, 43,  3,189,  0, 68,186,236, 50,  3,144,185,124, 86, 48, 12,179,207,195,113,226,126,222,209, 98, 21,137,134,126, 99,
-117,  0, 66, 61,240,121,227,169,116, 60,243, 34,221,142,111,116, 29,175, 66,107,245,234,213, 98, 41, 30,152,153,153,185,213,241,
-189, 70, 46,151, 23, 41,149,202, 24,  0,117,107,215,174,197,127,254,243, 31, 56,172,213,187, 67, 66, 66,142,121,112,117, 14,153,
- 76,166, 55,  0,148, 57,118,137, 67, 52,217,234,234,106, 97,227,198,141,236,226,123,135,194, 76,128,244, 73, 51, 48, 44, 51, 19,
-235,227,101,144,  0,184,233,100, 37,148, 74, 37,167,213,106,173,174,253,182, 60,244,221,202,118,203, 80,146, 32,142, 67,239,237,
-107, 48,126,251, 26,220,164,146,161,106,197, 50,212,237,200,  1,203, 50,232,175,106,133,215, 30,217,136, 62, 26, 57,100, 38, 29,
- 88,150,245,148,179,157,156,121,121,121,163, 52, 26,205, 12,183,  4, 14,  4,249,104, 88,199,  9, 94,194,  9, 66,  8,186,117,235,
-  6,134, 97,156,110,129,184,137,133, 78,220, 14, 30,244,216,  2,233,149,211,209,  4,  7,149, 74,133,223,126,251,205,121,204,224,
-193,131, 97, 52, 26, 17, 30, 30, 30, 16,103, 69, 69,  5, 41, 41, 41, 97, 22, 47, 94, 12,158,231, 17, 17, 17,  1,165, 82,201, 44,
- 90,180,104,162, 84, 42, 77, 48, 26,141,130,217,108,134, 76, 38,155, 35,222, 31,142,227,116, 90,173, 54,194, 27,167, 68, 34,193,
-179,207, 62,139, 87, 95,125, 21,243,231,207,199, 83, 79, 61,117,153,227,101, 52, 26,209,170, 85, 43,167,216,242, 80,  0, 91, 98,
-184,111,203,114, 10,  4,199, 14,174,199,241, 35,217, 16,236,  2,236,  2,  1, 33,118,  8, 54,224,192,198,221, 29, 46,230,151,196,
- 19,144,134,174,183,  0,228,181,245,182,  1, 17,178,142,  0, 86,110,173, 50,207,246, 23, 78,142,227, 96, 52, 26,241,243,207, 63,
-227,228,201,147, 88,187,118, 45, 12,  6,  3, 90,181,106,133,208,208, 80,220,124,243,205, 24, 51,102, 12,146,146,146,252,198,157,
- 16,178,176,168,168, 40,189,111,223,190, 76, 77, 77, 13,106,106,106, 96, 48, 24, 96,183,219, 97,179,217,192,113, 28,130,130,130,
-160, 80, 40, 16, 29, 29, 13,163,209, 72, 76, 38,211, 66,111,156,130,192,212,234,207, 78,200, 93,183,124,194, 77, 35,223, 32, 88,
-241,  1,131,118,109,228,250,223,246,  7, 63,190,114,251,107,183,  1, 32,  2,113, 90, 11,196,106, 23, 42, 95,157,248,201,243,127,
-250, 61,186, 92,100, 69, 24, 12,  6,212,213,213, 53,216,250, 50, 25, 86,172, 88,209,234,174,187,238,202, 41, 41, 41,233,239, 67,
-108, 93,198, 25, 28, 28,156, 40,145, 72,112,244,232, 81,124,241,197, 23,248,237,183,223, 80, 86, 86,118, 41, 46, 46, 46,100,224,
-192,129,236, 75, 47,189,132,244,244,116,124,253,245,215, 65,254, 56,  9, 33, 40,204,219,134,194,211,219, 33,  8, 13,174,117,195,
-230,249, 59,  9, 48,238, 58,157,206,120,232,208, 33,245,151, 95,126,137,168,168, 40, 36, 39, 39, 67,169, 84, 34, 40, 40,168,209,
- 67,214,245,193,235,175,108, 26, 12,  6, 99, 97, 97,161,250,187,239,190, 67, 68, 68,  4,146,146,146,160, 84, 42, 33,147,201,192,
-113, 28, 24,134,193,226,197,139,177,244,221, 71, 80,120,234,  8, 70,220,121,155,223,112, 42,149,202, 71, 23, 46, 92,216,200,  2,
-137, 14, 11,  3,199,179,144,240, 12,194,  6,223, 11,  0,184,180,233, 39, 95,179, 67,186,114, 50,117,117,117,198, 61,123,246,168,
-247,239,223, 15, 65, 16,144,148,148,  4,189, 94, 15,141, 70,227,140,255,198,141, 27,113,207, 61,247,224,219,111,191, 69, 70, 70,
-134,223,184,215,215,215, 27,143, 28, 57,162, 94,178,100,  9,194,195,195,209,186,117,107,103,220,197,141,231,121, 72, 36, 18,164,
-164,164,160,182,182, 22,106,181,218,239, 61, 58,112,224,128,122,201,146, 37,  8, 11, 11, 67, 66, 66,130,211,113, 19,197,209,  7,
-159,191,219,136, 32,136,137,189,106,206,166,222,119,119,206, 17, 35, 70,160, 93,187,118,208,104, 52, 80,169, 84, 78,110, 95,156,
- 94,180,136, 83,111, 51, 12,179,218,165, 76,100, 50, 12,179,218,245,211,219,113,142,175,253, 39, 78,156,216, 51, 43, 43,107,122,
- 70, 70,198,119, 59,119,238, 92,234,141,207, 27,207,196,137, 19,211,178,178,178,166,187, 30,239,225, 58,222, 29,173,204,204, 76,
-198, 17, 73,  6, 64,114,143, 30, 61,246,109,218,180, 41, 60, 56, 56,216,121,240,249,243,231, 81, 83, 83,131,224,224, 96,205,204,
-153, 51, 53,  3,  7, 14, 68,116,116,180,243, 13, 32, 47, 47,239,134,212,212, 84, 45,  0,119,223, 86, 96, 89, 22,125,250,244,193,
- 49, 71,107,199,176,204, 76, 36, 36, 36, 56, 59,121,  4,  5,  5,225,249,231,159,103,198,143, 31,207,137,110,  6, 33,  4,  6,131,
-  1,177,177,177, 10, 95,174, 14,  0,164, 25, 42,241,211,192,254, 96, 25, 64,127,112, 47,164, 50,  6,172,132, 65,119, 82,133, 95,
-  7,245,  7,  3,192,124,120, 23,  2,112, 97, 14,  2,184,173,101, 28, 14,130, 51,103,206,  4,228,104, 57,226,197, 92, 41,167,232,
-104,236,220,185, 19,118,187, 61, 80, 78,194,178, 44, 84, 42, 21, 98, 98, 98,160, 80, 40,160, 84, 42,153,239,190,251,238,237,228,
-228,228,216,241,227,199,179, 90,173,150,237,211,167, 15,238,187,239, 62, 78,108,226, 76, 75, 75,243, 27,151,173, 91,183,226,139,
- 47,190,192, 83, 79, 61,229,209,209, 98, 24,  6,145,145,145,208,104, 52,184, 86, 32,  0,176,216,172,208,215, 27,156, 77,186,118,
-187, 29, 71,182, 28,238,144,127, 56, 47,109,245,119,223,242,  0, 96,220,242,147,235,105,177,247,125,190, 44,117, 64, 24,191,103,
-235, 37,235, 30, 95,121,158,227, 56,140, 29, 59, 22, 89, 89, 89,120,244,209, 71,177,118,237, 90,188,243,206, 59,248,247,191,255,
-125,153,171,229,239,205,209,106,181,254,247,177,199, 30,123,106,197,138, 21, 29,223,120,227, 13, 86,116,180,148, 74, 37, 24,134,
-129,209,104,132,201,100,130,193, 96,192,169, 83,167,132, 39,159,124, 50,215,108, 54,255,215,107,115, 37,163,248, 93, 41,215,175,
-109,155,192,182,211, 21,124, 20,220,247,230, 36,  3,163,232, 81,123,111,234, 16, 50,124,108, 82, 24,  8,  1, 17,  0,129,  0, 38,
-147, 14,207, 63,255,162,228, 47,188, 85, 78,145,101, 52, 26,113,232,208, 33, 12, 26, 52,  8, 69, 69, 69, 56,113,226,  4, 58,116,
-232,128, 69,139, 22, 69, 62,252,240,195, 57,229,229,229,253,  3,117,182,142, 28, 57, 50,241,198, 27,111,252,180,190,190,190,186,
-190,190,254, 83,  0, 75,  1,212,156, 57,115,166,243,153, 51,103,230,174, 95,191,190,223,228,201,147, 37,110,125,116, 36,222,236,
- 81,171,213,  6,131,193,228, 83, 96,137,191,  9, 17,  2,138, 56,195, 48,164, 99,199,142,184,235,174,187,192,243, 60,148, 74, 37,
-212,106,117,163,102, 51,119,193,229,171,254,  0, 32, 48, 12,131,184,184, 56, 12, 31, 62, 28, 82,169,180, 17,167,152, 15,135, 15,
- 31,142, 23,222,155,132,255,190,112, 43,190,120,172,  3,134,188, 95,230, 51,156,122,189,190,126,243,230,205,138, 87,159,122, 10,
- 55,182,111,143, 86, 26, 13,218, 68, 71, 66, 33,151, 65,234, 26, 38, 38, 32,147,157,  0, 16, 36, 18,  9,186,116,233,130,178,178,
- 50, 20, 20, 20,160,160,160,  0, 44,203,162,111,223,190, 78, 23,230,244,233,211,120,239,189,247, 96, 50,153,  2,142,123,251,246,
-237,113,235,173,183, 66, 38,147, 65,169, 84, 54,106, 50, 20,211,180,174,174, 14,237,218,181,195,202,149, 43,145,154,154,234,151,
-179, 83,167, 78, 24, 48, 96, 64,163,244, 84, 40, 20, 78, 81,  4,  0, 69,123,234,157,215,136,143,143,111, 18,231,134,189,231,241,
-229,198,205, 48,153,  5,104,245,214, 70, 39,196,182,210, 96,251,146, 55,  2,138,187,200,185, 96,193,  2,212,212,212, 56,141,  3,
-241,165, 92, 52, 81, 90,183,110,141,121,243, 60, 59,153,110, 90,196,211, 51, 47, 51,192,231,173,120,156,152,185,228, 89, 89, 89,
-211,221,207,247,199,231,250,191,219,249,102, 55,113, 86,214,164,166, 67,185, 92,254,230,230,205,155,195,107,107,107,113,250,244,
-105,176, 44,235,108, 83,231, 56, 14, 22,139,  5,103,207,158, 69,120,120, 56,202,203,203, 33,151,203, 33,145, 72, 96, 54,155,  1,
-160,187,183,  7, 56, 33,  4, 47, 84, 52,116, 17, 90, 23, 39, 69, 33,128, 59, 43, 26, 10,134,216, 33,254,135, 31,126,128, 90,173,
- 70,112,112,176,243,211, 95, 51,210,145,130, 51, 40,227, 25,176,187,182,129, 97,  1,150,  1, 24,  9,192,178,  4, 44,195,128,221,
-149,  3,134,  1, 84, 17, 97, 77,173,128,253,117,140,247,217,  1,222,155,251,228,201,197,114,255,190,101,203, 22,  4,202,217,174,
- 93, 59,168,213,106,231,182,126,253,250, 70,142,150,221,110, 71, 68, 68, 68, 32,156,164,193,141, 16, 16, 21, 21,  5,158,231,153,
- 69,139, 22, 77, 76,249,127,246,174, 59, 60,138,106,125,191, 51,219,119,147,108, 54, 61, 33, 33,148,  0, 82, 34, 77,225,194,165,
-151,  0, 66,104, 34, 69, 46,  4, 17, 81,138,168, 40, 17,129, 31, 42, 32,161, 73,147, 42,200, 37, 32, 72,151, 46, 69,164,131,  5,
- 20, 36,129, 64,  8,  9,164,111,234,246, 50,237,247, 71,118,227,102,179, 73, 54, 33,194,  5,231,125,158,121,118,167,189,115,206,
-156, 51,103,222,243,157,239,124,211,176, 97,200,244,233,211, 73,129, 64,128,235,215,175, 35, 33, 33,  1,245,235,215,119,219,103,
-171,168,168, 40,235,147, 79, 62, 97, 62,249,164,100, 14, 69,100,100, 36,138,138,138,114,237,251, 53, 26, 77,126,159, 62,125,202,
-248,109,228,229,229, 61,219,158,240,182,251, 72, 91,105, 24, 76, 38,232,180,134, 82,235, 80,110,102,142,234,227, 15, 63, 16, 45,
-155,250,  6,  0,224,195,149,107,160,221,248, 87, 67,118,224,195, 81,129, 67,191,220, 53, 19,192,224,202,248,117, 58, 29, 76, 38,
- 19, 34, 34, 34,112,249,242,101,104,181, 90,244,235,215, 15,  4, 65,148,206, 16,173,  6, 44, 25, 25, 25,157,162,163,163,127, 93,
-177, 98, 69, 68,243,230,205,  9,189, 94, 15,131,193,  0,199,223,155, 55,111,114, 59,119,238, 76, 49, 24, 12,255,182,153,206, 93,
-226, 68,198, 55,201,125, 67,223,220,251,227,117, 65,116, 96,163, 36,101, 70, 97,  4,157,159, 33,213,107,140,119, 76, 12,151,  0,
-142,  1, 24,176,224,104, 22,140,109,216,235,105, 65, 46,151,127,117,241,226, 69, 63,147,201,132,107,215,174, 97,204,152, 49,150,
-188,188, 60,  9,  0,252,231, 63,255,177,108,223,190, 93,210,168, 81, 35,108,219,182, 45,224,213, 87, 95,221,163,215,235, 95,116,
-147,250,219,172,172,172,111,157, 55,250,249,249,173,126,248,240, 97,119, 71,159, 31,154,166, 75,147,227,242,193,100,  1,138,162,
- 96, 52,154, 81, 92,172,133,197, 74,217,218, 76, 22, 12, 67,219,126, 89,208,182,118, 84, 34, 22,122,181,125, 49, 88,199,113, 28,
- 72,130, 40,186,246,103,118,221,202, 68,187,171, 33, 46, 55,173, 89,206, 96,236,179,204,252,252,252, 32, 18,137,240,237,183,223,
-226,198,165, 19,144,  8, 56, 48, 52,  5,154,178,130,161, 44, 16,  9,  4,248,241,250,  3, 68, 53,243,114, 75, 16,250,251,251, 99,
- 64,199,142,136,238,216,177,100,122,155, 80,  8, 79,169, 20, 10,177,172,196,146,  5,128, 99, 72,119,131,  8,176,246,116,  6,  5,
-  5,225,183,223,126,195,180,105,211,176,120,241, 98,200,229,242,210,217,207,183,111,223,198,238,221,187, 17, 21, 21, 85,237,188,
-219, 45,120, 51,103,206, 68,102,102, 38, 86,174, 92,137,151, 94,122,  9, 34,145,  8, 69, 69, 69,248,247,191,255,141,156,156, 28,
-183, 56, 29,135,247, 36, 18, 73, 25,235,147, 93,  0, 86,183,140, 28, 57,223, 24, 18,130, 67,151,118,130,  0,129,171, 59, 62, 40,
- 35, 10,215,239,186, 80,109,206,185,115,231,150, 73,167, 59,214, 44,119,225,100,117,170,242, 56,130, 32,174,217,141,173, 51,103,
-206,156, 69, 16,196,145,153, 51,103,206,138,139,139,187,229, 14,159,171,253,  4, 65, 28,181,137,176,  1, 14,219,174, 85, 75,104,
- 41, 20,138,246,158,158,158,184,119,239, 30,250,245,235,103,201,207,207, 79, 18,137, 68, 77,242,242,242,164,185,185,185, 48, 24,
- 12,186,249,243,231, 63,  0, 32,239,208,161, 67,163, 31,127,252, 17,143, 30, 61,194,246,237,219,  1,224,128,107,159, 13, 18, 44,
-203,150, 86, 10,231,110,155, 64, 32,192,149, 43, 87,112,229, 74, 89,215,175,205,155, 55, 87,249,194,120,245,251,195,184,126,253,
- 58, 28,195,  3,216,255, 59,110,147,201,100, 64,229, 51, 60,202,160, 42,199,248,170, 28,224, 93,193, 93,223, 47, 87, 51,115, 42,
- 66, 70, 70, 70,133,231, 95,185,114,165,140, 69,171, 42, 78,129, 64,  0,134, 97, 32,151,203,  9,177, 88, 76,136,197,226, 48,187,
-200, 18,  8,  4,165, 15,140, 84, 42,133, 84, 42, 45,211, 75,173,  8,153,153,153, 61, 50, 51, 51, 43,220,175, 86,171, 59,169,213,
-106, 60,143,176, 82, 20,140,  6, 11,180, 58, 35, 62,143,251,111,201,198,207,241, 51,128,159, 59,189, 51, 13,147,251, 70,245,172,
-238, 48,181,253,126,  7,  6,  6,226,220,185,115, 32,  8,  2,123,246,236,129,183,183, 55,250,246,237, 11,165, 82,137,153, 51,103,
- 98,248,240,225,213,109,204,138,243,243,243, 59,189,255,254,251,191, 46, 93,186, 52,188,110,221,186,176, 88, 44,176, 90,173,176,
- 88, 44, 72, 78, 78,198,206,157, 59, 31, 25, 12,134, 78,  0,138,171, 34, 59,145,241, 77,242,254,243, 31,102,246, 30,249,170,241,
-118,206, 15,200,206,206,  7, 77,103,128,101,104, 88,105,166,196,194, 71,211,160,105,  6, 98,177, 64,185,244,139, 15, 78,177,224,
- 64,146,132,  5,192, 43, 79,170,140, 84, 42, 85,164, 90,173,198,221,187,119, 17, 19, 19,147,157,159,159,159,  8,160, 23,  0,228,
-231,231, 95, 28, 51,102, 76,243,248,248,248,224,  6, 13, 26,192,211,211, 83,169,215,235,171,162,244,  4, 48, 25, 64, 31,148,248,
-129,216, 81,  0, 96, 62, 73,146,210,107,215,174,149,155,105,119,254,252,121,  0,248,217,117, 15,200,102,209, 50,153,160,206, 47,
-196,132,119,230,252,213, 51,  2, 87, 70, 92,112,224, 48,233, 93,200,  0, 32, 47, 39, 25,111, 76,152, 38,173,170, 67,224,234, 69,
- 88, 13, 31,157, 50, 29, 53,123, 29,245,244,244, 44, 25,126, 59,184, 19, 71,191,124,  7, 96,172,224, 40, 35, 96, 53,  0, 86, 29,
- 88,139,  1,132, 88, 14, 80, 70,183,132,150,167,167, 39, 60,229,114,  4,170, 84,224, 56, 14, 66,129,  0, 34,145, 16, 44,  5, 16,
- 12, 81, 42, 72, 89,247,  2,131,148,118, 42,229,114, 57, 82, 83, 83, 49,121,242,100, 88,173, 86, 12, 25, 50,  4, 22,139,  5, 38,
-147,  9, 70,163, 17, 13, 27, 54,132,193, 96,112,139,207, 62, 91,209,211,211, 19, 98,177, 24, 31,124,240,  1, 94,126,249,101,204,
-155, 55, 15,177,177,177,104,216,176, 33, 38, 77,154,132,157, 59,119, 34, 50, 50,178, 42, 94,206,177,140,236,247,211, 46,182, 28,
-135,248,  0, 84,187,140,156, 57,  9,130, 44, 35,216,236,203,123, 99,123, 85,155,115,209,162, 69, 80,171,213,229, 44, 89,246,255,
-161,161,161, 88,183,110, 93, 77, 71,134,236,214,163, 32, 23,251,  6, 56, 91,162, 56,142,107,103,243,157, 50,199,197,197,221,138,
-139,139,139, 38,  8,226, 72, 92, 92, 92,116, 69, 22, 45, 87, 60, 46,246,187,253,210, 18, 58,141,141,118,119,220,105,191,209,190,
-190,190,130,240,240,112, 82,169, 84,162,168,168,  8,  1,  1,  1,156, 90,173, 30,169, 80, 40, 62,251,238,187,239, 26,233,116, 58,
-220,190,125, 27,171, 87,175,254, 25,192,170,202,132,214,177,  0,155,233,216,102,201,114, 92, 31, 56,112, 32, 26, 52,104, 80,198,
-154, 37,151,203, 43,173, 60,246,125,118,139,144, 64, 32,192, 11, 47,188, 32, 79, 73, 73, 49,138,197, 98,132,133,133,201,179,179,
-179,141, 98,177,184,218, 51, 93,170,114,140,175,202,  1,222,149,240,105,215,174, 93, 25, 11,150,227,175,227,255, 67,135, 14, 85,
- 57,116,104,231,108,222,188,121,233,253,242,242,242,178,159, 11,  0,232,215,175, 31, 88,150,133,191,191,191, 91,156,118, 81,107,
-115,128,135,201,100, 98,181, 90, 45,121,237,218, 53, 72, 36, 18,120,121,121,149,250,234,200,100,178, 82,107, 38, 15, 87, 13,  2,
- 11, 11, 69,193,104, 52, 66,167,211,  1,  0,146,255,220, 87, 86,136,153, 53, 53,230,183, 55,176,  5,  5,  5, 56,113,226,  4,126,
-248,225,  7,188,252,242,203, 46, 69,117, 53,  4,151,186,160,160,160,243,140, 25, 51,174, 46, 88,176,160,142,175,175, 47,172, 86,
- 43, 30, 62,124,136, 45, 91,182,100, 26, 12,134,206,213,105, 96,192,  1, 20, 69,195,100, 48,163, 88,163,197,103, 95,108,173,176,
-234,  1, 64, 65,238, 29, 12, 28, 52, 92,242, 36,203, 41, 51, 51,115,122,231,206,157,191,208,106,181, 69,  6,131, 97, 56,128,101,
-142,253,169,252,252,252, 46,131,  6, 13, 90,225,235,235,251, 82,110,110,238, 44, 55, 40,103,166,166,166,206,170, 87,175, 94,153,
-141,102,179, 25,245,234,213,123, 33, 55, 55,119,116,215,174, 93,255, 15,128,175,195,110, 47,  0, 39,  1,172,171,168, 46,217,135,
- 14,117, 58, 35,148,170, 16,100, 60, 56, 87,101, 66,196,  2, 19, 56,150,173,180, 13,177,119,128, 43, 90,170,152, 25, 87, 46,169,
-246, 99,237, 47,236, 87,134,141,197, 43,147, 23, 65, 33,  2, 22,190,209,  9, 13, 85,  0,228,190, 16,119,253, 24,132,202,118,143,
- 38, 31,118,139, 60,118,195,  6, 92,183,181,199, 97,  1,  1,152, 49,114, 36, 56, 10,184,156,144,128, 93, 63,253,132,145, 61,122,
- 64, 33,147,185,221, 97, 97, 89, 22, 98,177, 24,201,201,201,184,124,249, 50,154, 53,107,134,123,247,238,149,  9, 67,193,113,156,
-187,249, 47,205,187, 84, 42,133, 72, 36, 66,118,118, 54,162,163,163, 33, 22,139,177,117,235, 86,156, 59,119, 14, 51,102,204,192,
-248,241,227,209,189,123,119, 36, 38, 38,186,197,201,113, 92,185,217,138,206,195,185,213, 45, 35,103, 78,231,247,126, 77,202,221,
-206,185, 96,193,  2,151, 19, 42,220,225,116,165, 69, 92,148,221, 53, 71, 49,100,183, 60, 57, 10, 35,231,117,  0, 62,246,109, 51,
-103,206,156,229,238,121,142,235,118,139, 88,117,134, 48, 75,133, 86,116,116,116,153,156, 23, 20, 20, 92,189,122,245,106, 11, 15,
- 15, 15,220,185,115, 71,162, 84, 42, 91,216, 27,116,146, 36,177,103,207, 30,175,254,253,251,159, 90,182,108, 89, 24,203,178,200,
-201,201,193, 71, 31,125,164,163,105,122, 20,  0,186,162, 23,120, 85,150,169,195,135,203, 63,108,  7, 15, 30,116,107,  8,196, 46,
-164,132, 66, 33,124,124,124,140, 70,163, 17, 10,133,  2, 62, 62, 62, 70,131,193,  0, 15, 15, 15,251, 88, 49,137,191,102, 42, 84,
-101,125,170,202, 49,222,217,  1,190, 74, 36, 36, 36,184,117,156,109,168,213,173, 90,158,154,154, 90, 97, 67,114,238,220, 57,176,
-182,134,214, 93, 78, 91, 47,143,179, 11, 63,133, 66,  1, 95, 95, 95, 72,165, 82,200,229,242, 50, 34, 75, 42,149, 86,249,224, 84,
- 21,144, 84, 38,147,253,226,225,225,161,178,239, 23,137, 68,208,106,181, 69,  5,  5,  5,237,159,233,161, 67,112,160,173, 52,140,
- 70, 19,116, 90, 99,173,243, 91, 44, 22, 72,165, 82,236,220,185, 19,157, 58,117, 66,135, 14, 29,202,137,172, 26,154,231,211, 11,
- 10, 10,186,175, 90,181,234,231,229,203,151,251,232,116, 58,252,247,191,255, 45,214,233,116,221,  1,164, 87, 75,108,178, 28, 40,
-171, 21,  6,147, 25,122, 93,201, 61,184,127,107,223,255, 90, 81,237,204,206,206,222, 89,201,254,251, 52, 77, 71,219,227,190,185,
-129,127,213,171, 87, 15,217,217,217,101, 54,166,165,165,129, 97, 24, 51, 74,226,100,189,233,104, 72,198, 95,209,179, 43,234,197,
-151, 88, 71,141,102,232,116, 37, 86, 16,147, 62,175,118,234,169, 77,108, 84,228,147, 85,147, 58, 68, 16, 68,169,211,247,212,169,
- 83,113,243,198, 13,244,170,163, 65,195, 96, 47,112,154, 12,136,123,126,138, 63,212,114, 44, 91,113,172,218,220,187, 29, 92, 32,
-150,237,222,237,114,223,253,193,131,171,149,247,164,164, 36,200,229,114, 48, 12, 83,238,125, 83,221,252, 59, 10,152, 21, 43, 86,
- 96,198,140, 25,216,186,117, 43,110,222,188,137,214,173, 91,163,119,239,222,200,205,205,197,141, 27, 55, 96, 54,155,221, 78,167,
-163,223, 92, 82, 74,  2, 78, 95, 62,142,180,244,  7,200,204,126, 84,227,114,119,228,116, 22, 90,251, 79,255,142, 97, 81,109,107,
-196,249,217,103,159, 33, 55, 55,183,140, 37,203,177, 93,170,200,162,229,172, 69,156,144,231,228, 11,101, 95,183, 56,137, 30,231,
-117,231,227,  1, 32, 23,128,160,138,243,156,215,243,226,226,226,206,218, 45, 97, 54, 94, 65, 85,254, 89,101, 44, 90, 78, 88, 52,
-120,240,224, 65,171, 87,175, 14,144,201,100,165, 51,144,102,206,156,137, 25, 51,102, 32, 34, 34,  2,254,254,254,161, 42,149, 10,
-249,249,249, 88,188,120, 49, 82, 83, 83, 39,194, 69,160, 61,103,161,213, 37, 69, 11,137,228,175, 14,171,221,178,  5,  0,227,199,
-143, 47,103,209,178, 23, 80,101,160, 40, 10,126,126,126, 48, 24, 12, 16,  8,  4, 24, 50,100,136,224,207, 63,255,100,250,246,237,
-139,161, 67,135, 10,110,220,184,193, 12, 24, 48,  0,  2,129,  0, 61,123,246,212,236,223,191,255, 67,  0, 95,186, 33,182,106,205,
- 49,222, 94,201,220,141,125,228,142,184,172,140,147, 32,  8, 24, 12,  6,  8,133,194, 82, 71,121,119, 56,237, 67,135,142, 15, 32,
- 73,146, 80,169, 84,165,141,135,221,162,101, 23, 90, 85,241, 86, 21,144, 84,161, 80, 40,239,220,185,211,200, 62,241, 34, 47, 47,
- 15, 61,123,246,188, 91, 80, 80,240,108,155,180, 88,192, 74, 51,208, 25, 77,208, 25, 13,181, 70,107,127, 30, 54,110,220,136,196,
-196, 68,152, 76, 38,124,245,213, 87,165,147, 10, 28, 69,214, 99,  8,174,100,185, 92,206,246,235,215, 15, 87,175, 94,133, 84, 42,
-165, 80,131,248, 87, 44,199,194, 74,211, 48, 25,141,208, 85, 61,228,246,188,160, 84, 85, 39, 38, 38,194, 98,177, 96,222,188,121,
-204,175,191,254,122, 22, 37,  1, 80,237, 22,188,209,221,186,117,155,239,225,225,161, 58,122,244,232,123,  0,182, 86,246,242,166,
-104,155,104,175,197,251,232, 56, 34,224,202, 39,171, 38, 97, 86, 28, 95,172, 44,203, 98,226, 91,111,161,119, 29, 13,134,190, 20,
-  0,125,214, 93, 40,188,  3, 64,168,234, 99,217,138, 99,184,149,226,182, 43, 38,  7,  0,253,186, 13, 70,171,102,229,195,131,117,
-238, 85,210, 39,187,248,227, 47,200,201,203,172,118,222,245,122,125,133,150,171,106, 88,180, 74,159, 57,251,253,107,211,166, 13,
-154, 52,105,130,179,103,207,162,109,219,182,184,119,239, 30,238,221,187,135,212,212, 84,220,188,121, 19,133,133,133,213, 46,163,
-239, 79,238, 66,161,182,  0, 18,177,  4,  5, 69,121, 72,203,120,128, 32,191,224,199, 46,119, 59,154, 14,248, 12,  0, 80, 39,192,
-187, 90, 66,203,145,115,201,146, 37,229,196,251,227,134,236, 33,  8,226,151,202,214,171,123,254,147, 68, 69, 66,235,129, 90,173,
-238, 48,114,228,200,153,  0,218,217,182, 21,  3,216,125,234,212,169,193,129,129,129, 61, 58,118,236, 40,148, 72, 36,184,124,249,
- 50,246,239,223,191, 21,192,174,202, 46, 36,145, 72,140,245,235,215,151,219, 43,162,253, 65, 84, 42,149,130,197,139, 23, 19,155,
- 55,111,174,208,202, 85, 85,  1, 21, 23, 23, 67,175,215,195,219,219, 27, 86,171, 21,253,250,245, 99, 18, 19, 19, 33, 22,139, 49,
-104,208, 32, 38, 33, 33,161,180,160, 55,109,218, 20,102, 52, 26,255,253,195, 15, 63,244,  1,208,181, 26,247,202,238, 24,239,  9,
- 55, 29,224, 43,234,229,185,  3,119,135,227, 42,226,156, 54,109, 90,141, 56,197, 98, 49,109,143,252, 78,146, 36,172, 86, 43,218,
-182,109,139,220,220,220,210,135,198,195,195,163, 84,100,185, 35,180,170, 10, 72, 42, 20, 10, 97,177, 88,208,181,107, 87, 16,  4,
-129, 53,107,214, 60, 31,195,145, 44, 75,120,122,250,161, 78,157, 23, 16, 16,104,  2,203,214,238, 87,101, 98, 99, 99,203,136, 41,
- 87,145,151,237,247,191, 38,176,115,185, 51, 75,182,178,183,163,125,200, 75,175, 55, 61,115, 69, 24, 24, 24,216, 33, 55, 55,247,
-160,211,230,  2,  0,243, 43,233, 88,150, 22,244,163, 71,143,208,183,111, 95, 28, 63,126, 92,112,224,192,129, 94,135, 14, 29, 74,
-184,123,247,238,163,182,109,219,214,125,251,237,183,165, 93,187,118, 69, 94, 94, 30, 94,122,233,165,207, 51, 50, 50, 42, 17, 90,
-182,251,104, 50, 67,175,175,125,235,168, 43,107,214,227,188, 24,237,117,114,238,220,255, 67,239,144, 34, 12,105,237,141,248, 35,
-151, 48,186,141, 28,176, 72,171,205,103, 79,139,111,157,  6,168, 31,217,161,220,126,169,178, 36,150,107,253,200, 14, 32, 31,221,
-171,118,222, 29,211,236, 44,170,106, 98,209,115,188,159, 19, 38, 76,192,199, 31,127,140, 62,125,250,224,222,189,123, 56,127,254,
- 60,238,221,187,135,105,211,166, 33, 50, 50, 18,173, 91,183,174, 22,231,161,211,123,161,209, 21,131, 36, 72, 20, 20,231,195,100,
- 54, 34,118,210,220,199, 46,247,210,151,255,233, 56,  0,192,190, 83,215,107,204, 57,123,246,108,100,103,103,151,177,100, 61,142,
- 95,214,179,142,202,162,165, 61,  0, 48,209,121,163,197, 98,241,154, 55,111, 94,148,191,191, 63,  8,130,192,138, 21, 43,224,235,
-235,219,  9,192, 45,139,197,146,167,215,235,103, 56,136,144,222,176,197,218,200,201,201,113, 57,111, 95,175,215, 91,163,162,162,
- 68, 33, 33, 33,101,102, 27,122,120,120, 84,100,221, 41,229,180,239,163,105, 26,177,177,177, 88,184,112, 33,194,195,195, 49, 96,
-192,  0, 68, 71, 71,131, 32,  8,244,235,215, 15,  3,  6,252, 53,148,171, 82,169,196,199,143, 31,239, 70,146,100,130,195, 11,164,
- 12,167, 43,216, 29,227, 41,138,114,215,  1,190, 12,167,189,178, 77,155, 54, 13, 11, 23, 46,196,172, 89,149,187,122,108,216,176,
-  1, 40,239, 79,245,183,115, 22, 20, 20,148,105,236, 21, 10,197,154,161, 67,135, 10, 31, 61,122, 84, 70, 92, 57, 46, 46, 26,162,
- 50,156, 85,  5, 36, 21,  8,  4,  8, 10, 10,194,130,  5, 11,224,231,231,135,224,224, 96, 87,129,252,170, 44,163, 26,224,111,229,
-100, 56,246,218,210, 69,255,215,249,191,219, 15,137,164, 18,224,202,249,125,208, 20,150, 29, 78, 50, 91,255,154, 74, 45,105,219,
- 11,150,235, 63,186, 85,151,236, 98,250,179,207, 62,195,103,159,125, 86,105,130, 54,110,220,248,216,121,119, 83,108,149,231,100,
- 57, 66,225,225,  3,153, 71, 29,180,136,244,  1,203,209,255, 83,101, 84,  1,126,253,229,151, 95,  6,249,249,249, 33, 61, 61, 61,
- 64, 36, 18, 13, 42, 99,174, 50, 26, 81,191,126,253, 23,212,106,245,191,171,226,156, 54,109,154,121,206,156, 57,210, 81,163, 70,
- 97,232,208,161, 24, 53,106,148, 84, 44, 22, 55,230, 56, 14, 86,171, 21,233,233,233,248,241,199, 31,161, 86,171,111, 87,150, 78,
-150,227,  8,185, 66,  5,153, 71,  8, 90,188,168,  2,203,210,181,146,119, 71,171,184,163, 53,171,154, 34,203,101,253,  4,128, 95,
-127, 60,136,185, 31,188,136,173, 71,127,198,234, 95,128, 86,170, 92,180,  8, 80,131, 85,223,198, 71,163, 95,198,178, 29,191,  1,
-  0,206,159,171,178,140,184,202,234,160,201,104,125,172,188, 59, 90,174, 28,175,227,134,143, 86, 57, 78,123, 39, 81,171,213,162,
-168,168,  8,241,241,241,120,227,141, 55,144,155,155,139,212,212, 84,220,189,123, 23,223,125,247, 29, 20, 10, 69,141,202,232,195,
-183,102, 99,206,178,233,224,192,161,105,163, 22,152, 57,249, 51,180,107,213,241,177,203,221, 25,110, 88,179, 42,228, 92,185,114,
-101, 77,235,210, 63, 78,104,185,132,191,191,255,168,110,221,186,193,100, 50, 33, 32, 32,  0,169,169,169, 32, 73, 50,  2, 40, 25,
-194, 11, 13, 13,221,173, 86,171, 35,220,229, 19,  8,  4,160,105,186,212,247,199,190,  0,192,192,129,  3,113,248,240,225, 42,123,
- 20,193,193,193,168, 91,183, 46,222,127,255,253,114,179, 28, 28,103, 58,200,229,114, 28, 61,122, 52,187,160,160,160,128,227,184,
-106, 77,115,179, 59,198, 95,188,120,209,109,  7,120, 71, 88,173,214, 71,119,239,222, 13,217,184,113,163,160,146,151, 95, 41,206,
-159, 63, 79,163,138,161,154,191,131,211, 85,207,148,227,184, 10, 69,150, 59, 97,  4,170, 10, 72, 42, 20, 10,145,148,148,132,185,
-115,231,130, 32,  8,236,219,183,239,185,120,184,254,188,147,191,153, 36, 73,159,129,175,116,110,  9,130,128,213, 82,126,164,218,
-179, 80, 87, 42,178,134,126,185, 11,  7, 62, 28,233,142,232, 73,190,112,225,130,239,198,141, 27,133,238,148,251,133, 11, 23,104,
-142,227,170, 61,236,103,127,225, 88,173, 86, 24,141, 53,179,162,112, 28,119, 57,238,139, 57, 81,219,190, 61, 38, 34,  8, 11,174,
-156,219,135,226, 34,215,238, 12, 18,145, 16,155,227,247,211, 98,145,224,209, 83, 46,186,181, 67,134, 12, 25,245,213, 87, 95,181,
-112,181,211,141, 73, 48,169, 38,147,  9, 25, 25, 25, 48, 24, 12,123, 63,249,228, 19,235,177, 99,199,222,124,245,213, 87,209,186,
-117,107,132,132,132, 32, 43, 43, 11,201,201,201,136,143,143,231, 46, 93,186,180, 23,192,148, 42,238,227,193, 69, 95,204,137,137,
-223,113, 76, 66, 18, 86, 92, 57,191, 15,197, 78,162,189,188,117, 90,132,111,182,238,183,138,197,162, 59, 85, 89,139, 28,173, 89,
-181,249, 98, 28, 52,102, 50,134,174, 90,141,136,118,125,177,104,113,111,124,243,197,112, 44,239, 39,134,117,207,104,180,122,109,
- 27,118,206,235, 15,  0,168,243,141,155,214, 18,161, 24, 15, 93, 88,172,138,138,101, 54,113, 83, 61,171,169, 61,239,149, 89,174,
-170,107,209, 34, 73, 18, 13, 26, 52, 64, 68, 68,  4, 58,117,234,132,182,109,219,162, 71,143, 30,184,113,227,  6,110,220,184,129,
-105,211,166, 85, 38,178,170, 44,163,238,255,142,194,207, 93,238, 60,118,217, 56,151,123,109,192,157,186, 52,121,242,100,  0,248,
- 71, 89,183,170, 45,180, 52, 26,205, 13,150,101, 91,122,123,123,219, 45, 82,165,251,210,210,210,192,178,172,161,186,  5, 99,177,
- 88,236,193, 49,203,196,101,178, 59,199, 87,246,224,115, 28,199, 20, 20, 20,160, 91,183,110,232,210,165, 75,233,240,137,227,226,
- 32, 76,112,224,192,  1,112, 28, 87,109, 39,107,  7,199,120, 29,170,233,  0, 15,  0,185,185,185,125,187,118,237,122, 74, 40, 20,
-186,245, 21, 77,150,101, 83,115,114,114, 94,121,210,156,174,202,135,101,217, 10, 69,150, 59, 13, 81, 85,  1, 73,133, 66, 33, 60,
- 60, 60,240,253,247,223,195,223,223,255,185,122,192,110, 36,170,151, 84,182,191,155,159,228, 28,128,128,161, 95,238,122,120, 46,
-223, 90,111,232,151,187,210, 14,124, 56, 50,188,178,115,178,179,179,251,140, 28, 57,242,184,187,229, 78,211,244,131,236,236,236,
-106,135, 75,224, 56, 14,119,238,220, 97, 39, 76,152,144,167, 86,171,135,215, 36,255, 51,231,174, 94,190,240,243,169,126,253,162,
- 58,180,  3,  9, 88, 42,118,254,229,  8,128, 19,138,  4,143,102,204, 90,249,214,240,225,195,159,102,177,105,178,179,179, 59, 13,
- 27, 54,108, 10,254,114,157, 40, 35,164, 80,193,236,106, 27, 86,213,173, 91,247, 69,129, 64, 32,  5, 48, 23, 64,218,165, 75,151,
-214, 94,186,116,169, 15,128,127,  9,  4,130, 16,134, 97, 50,108,157,158, 93,  0,254,168,186, 30,229,190, 13,142, 13,235,215,251,
- 95,125, 65, 16,156,197, 98,174,162,131,  4, 14, 28,199,137,197,162, 59,191,222,200,106, 85, 89, 71,202,225, 11, 28,181, 62,100,
- 63,101,202, 20, 76,153, 50,165,180, 62,173, 89,211,  5,123,255,188,136,215, 90,165,195,252,117,103, 16,202,112,183, 59,124,  0,
- 48,251,255, 38,212, 90,218, 28,243,238,104,209,114,245, 28, 84,199, 71, 75, 32, 16, 32, 47, 47, 15, 73, 73, 73,200,201,201,129,
-193, 96, 64, 98, 98, 34,172, 86, 43, 10, 11, 11,241,226,139, 47,214, 56,157,181, 85, 70, 79,147,243,159, 56,124, 88,109,161,101,
-181, 90, 63,109,208,160,129, 72, 38,147,181, 96, 24,  6, 28,199,129, 97, 24,206, 38,106,170, 61, 11, 79, 36, 18,153,154, 52,105,
- 66,184,154,157, 96,255,239,225,225, 97,172,196, 90, 18, 87,191,126,253, 79,  8,130, 16, 84,212, 11,177,255,103, 89,150, 17, 10,
-133,113, 53,188, 87,143,235, 24,175, 87,171,213, 29,107,185,252,254, 14, 78,231,242,209, 55,107,214,172,244,139,246,206, 49, 81,
-108, 31, 91,213, 87, 33,206, 43, 13, 72,170,215,235,179,250,246,237,203, 56,238,119, 12,104,250, 92,131,224,210,250,143,122,179,
-222,185,124,107, 61,  0,176,139, 45,112, 92, 90, 37,103, 25,179,179,179,187,253,221, 73, 75, 73, 73,177,252,235, 95,255,250, 86,
-171,213, 78,  6, 80, 99,111,254, 89,159,174,153,245, 12,150,140,  6,192,194, 26,158,155,150,159,159,223,211,105,219, 31,118, 65,
-101,143,107, 87,109,209,126, 59,175,214, 99,139,209, 52,157, 30, 17, 17, 81, 45,203, 13, 69, 81,233, 85,237,119,142, 17,230,136,
- 91,240,198,172,171, 64,201,228,239,124,183, 56, 77, 38, 83, 65,199,142, 29, 69,213,204, 91,174,187,121, 15,  9,  9, 65,157, 58,
-117, 74,127,237,112,222, 94, 85, 58,105,154, 78, 15, 11, 11,131,191,191,127,133, 17,223,157,125,178,220,225,172,237, 50,170,140,
-179, 78,157,109,181,206, 89,211,116,242,112, 15,189,121, 78,158,147,231,124,102, 57,  5,252,253,228, 57,121, 78,158,243,  9,114,
- 62,151,224,189,212,120,240,224, 81, 17, 24,254, 22,240,224,193,131,199,227,129,168, 68,149, 86,103,166, 79, 77,148,237,105,158,
-147,231,228, 57,121, 78,158,147,231,228, 57,255,113,156, 85,113,215,246, 76,227,231, 26,188, 89,149,231,228, 57,121, 78,158,147,
-231,228, 57,121,206,127, 44,248,161, 67, 30, 60,120,240,224,193,131,  7, 15, 94,104,241,224,193,131,  7, 15, 30, 60,120,240, 66,
-139,  7, 15, 30, 60,120,240,224,193,131,  7, 47,180,120,240,224,193,131,  7, 15, 30, 60,120,161,197,131,  7, 15, 30, 60,120,240,
-224,193,131,  7, 15, 30, 60,120,240,224,193,131, 71,  9,  8,  0, 56,114,228, 72,233,  7,  1,163,163,163,  9,254,182,240,224,193,
-131,  7, 15, 30, 60,158, 36,158,107, 45,226,152, 57, 30, 60,120,240,224,193,131,  7, 15, 94,139,212, 14, 72, 94,108,241,224,193,
-131,  7, 15, 30, 60,120,177,197,103,140,  7, 15, 30, 60,120,240,224,193,139,172,103, 10,101, 44, 90,188,224,226,193,131,  7, 15,
- 30, 60,120, 60, 77,177,245,140,106, 17,206,182, 56,174,243,224,193,131,  7, 15, 30, 60,120,240,120, 76,129, 85,217, 47, 15, 30,
- 60,120,240,224,193,131,  7,143, 90, 18, 92,246,255, 79, 76,104,241, 95, 54,231, 57,121, 78,158,147,231,228, 57,121, 78,158,243,
- 31, 11, 33,127, 11,120,240,224,193,131,  7, 15, 30, 60, 30, 27,142, 86, 44,130, 23, 90, 60,120,240,224,193,131,  7, 15, 30,181,
- 39,178,  8, 87,235,252,183, 14,121,240,224,193,131,  7, 15, 30, 60,254, 38,240, 22, 45, 30, 60,120,240,224,193,131,  7,143,199,
-  3,  1,126,232,144,  7, 15, 30, 60,120,240,224,193,227,111, 21, 91, 46, 55, 86, 52,115,224,116, 53,200,107, 50,251,224, 52,207,
-201,115,242,156, 60, 39,207,201,115,242,156,255, 56,206,170,184, 79,227,217, 67, 55,  0,103,  1,116,183,253, 86, 40,188,106, 27,
-252,212, 87,158,147,231,228, 57,121, 78,158,147,231,228, 57,159,119, 84, 24,168,148,119,134,231, 81, 21,132,168,124,136,185,170,
-253, 60,120,240,224,193,131,199, 63, 77,108, 17,225, 72,218,  0,  0, 32,  0, 73, 68, 65, 84,113,142, 47, 73, 87,104, 12, 96, 22,
-  0,111,135,109,191,  0,136,115, 58,110,  7,  0,133,195,186, 30,192, 60,  0,247,170, 76, 13,199,137,109,252, 82,219,194,  2, 48,
-  1, 48,  3,208, 18,  4, 65,241,101,246,212,209, 17, 64,180,237,255, 17,  0, 87,170,185,255,185, 66, 72, 72,136,220,199,199,167,
-207,245,235,215, 37,137,137,137,184,112,225,  2,183,121,243,102,107, 97, 97,225,201,172,172, 44, 35, 95, 93,158, 11,244,  5, 48,
-211,246,127, 17,128, 19,143,201, 71, 40, 20,138,105, 30, 30, 30,253,165, 82,105, 29,154,166,  9,131,193,144,169,215,235, 79,209,
- 52,253,165,173,221,171, 46,  6,251,250,250,190,217,180,105,211,198,169,169,169, 25,153,153,153, 59,  0,236,  1, 48,188, 78,157,
- 58,163,235,215,175, 31,122,231,206,157,123,  5,  5,  5,223,  0, 56,248, 20,211,201,131,199, 63,  9, 68,101,214,  8, 87,152,203,
-113,220,232, 50, 12, 68,121,142,158, 61,123, 14, 58,121,242,164,130,101, 89,216, 23,185, 92, 78,  3, 24, 87,133,200,242,187,124,
-249,114,189,201,147, 39, 15,205,204,204,124, 89,171,213,182,  7,  0,133, 66,241,115, 96, 96,224,175,171, 86,173,250,142,227,184,
-116,130, 32,180,213,204,168, 80, 36, 18,189,225,227,227,211,159,166,233,182, 28,199, 65, 36, 18, 93, 47, 44, 44, 60, 65, 81,212,
- 55,  0,106, 34,222, 36, 66,161,112,138, 84, 42,237, 75,211,116, 75,  0, 16, 10,133, 55,205,102,243,  9,154,166,215,  2,176,212,
-128, 83, 38,145, 72,166, 40,149,202, 40,139,197,210, 18,  0, 36, 18,201, 77,141, 70,115,202, 98,177,172,181,  9,206,167, 13, 33,
-128,104,142,227, 68,  0, 32, 16,  8,  6,183,111,223,190, 30, 65, 16, 44, 65, 16, 28,199,113,196,207, 63,255,220,134, 97, 24,210,
- 86, 63,162,  1,252, 10,128,126, 22,159, 16,127,127,255,133, 44,203,214,169,180,208,100,178,151,175, 95,191,222,116,247,238,221,
-204,215, 95,127, 93, 52,126,252,120,207,201,147, 39, 11,215,172, 89,179, 54, 43, 43,235, 61,231,227,253,252,252,150,147, 36,233,
-239,206,245, 89,150,205,203,207,207,159,254,180,242, 31, 19, 99, 42, 99,238,142,143,151, 53,  2,144, 94,195,250,253,247,113,154,
- 98, 56,  0,136,151,197, 55,138, 49,197, 36,219,255, 63, 46,175,  3,102,174, 59,173,237,202,113,192,148, 40, 47,242,113,133, 86,
-104,104,104,124, 76, 76,204,168,150, 45, 91, 10, 57,142,  3, 69, 81, 48,155,205, 77,175, 92,185,210,125,223,190,125, 47,107,181,
-218,225,213,164,124,235,227,143, 63, 94, 48,127,254,124,127,145, 72, 68, 80, 20,213,104,247,238,221,109,223,126,251,237,247, 55,
-110,220, 88,119,196,136, 17, 94,246,237,115,231,206,109,183,104,209,162,134,  0,190,124, 10,233,228,193,227,159,134,110, 40,235,
-163,245, 57,128,207, 42, 19, 90, 30,182,151,103,142,205,146,  5,135,223, 82,156, 57,115,230,144, 80, 40,180, 91,180,218,235,245,
-250, 32, 39, 43,152, 43,145, 85,127,204,152, 49, 29,247,238,221,187,112,196,136, 17,217, 10,133,162,201,171,175,190,170, 37,  8,
- 66,176,123,247,238, 54, 17, 17, 17,242,129,  3,  7,142,233,217,179,231,135, 28,199, 93, 32,  8, 66,237,102, 38, 91,248,250,250,
-238, 95,178,100, 73,189,190,125,251,138,253,253,253,193,113, 28, 50, 51, 51, 67,143, 30, 61,218,239,243,207, 63,255,176,160,160,
- 96,  8,128,132,106,220,184,118,114,185,124,239,231,159,127, 30,210,175, 95, 63, 97,112,112, 48, 76, 38, 19, 18, 19, 19,123,159,
- 56,113,162,235,198,141, 27,223, 51, 26,141,175,217,  4,134,187,104,239,237,237,189,239,191, 31,127, 28,212,225,141, 55,132,190,
-190,190,224, 56, 14,106,181,186,247,197,109,219,186, 79, 90,178,228,189,226,226,226, 97,174,238,247,211,132, 68, 34, 33,183,111,
-223,222, 90, 34,145,  0,  0, 44, 22, 11, 34, 35, 35,137,231,229,  9, 33,  8, 34, 44, 51, 51,211, 91, 44, 22,187,220,207, 48, 12,
-186,118,237,218, 64, 44, 22,227,203, 47,191,164,242,242,242,218,124,245,213, 87,215,119,238,220,233,191,118,237,218,215,  0,148,
- 19, 90, 36, 73,250,167,167,167,187,228,100, 24,  6, 86,171, 21, 52, 77,195, 98,177,160,121,243,230, 79, 53,255,241,241,178, 48,
-  0,211, 99, 98, 76, 31,216, 54,125,  9,224, 67,  0, 41,168,225, 55,187,254,  6, 78,199,250,182,220,225,255, 99,167,213,  1,245,
-  0,224,216, 13, 19,  0,248, 62,238,125,245,240,240,104,246,250,235,175, 11,213,106, 53, 68, 34, 17,172, 86, 43,178,179,179, 17,
- 25, 25, 41,248,246,219,111, 95,168, 46, 95,163, 70,141,198, 47, 90,180, 40,224,216,177, 99,214,237,219,183, 91,162,162,162, 68,
-227,199,143, 87,118,237,218,181,121, 88, 88, 24,185,101,203, 22,243,169, 83,167,168, 49, 99,198, 72,226,226,226,  2,142, 30, 61,
- 58, 48, 33, 33,225,203, 39,157, 78, 30, 60,254,129, 56,139,191, 66, 60,216,127, 43, 21, 90,112, 16, 87,131,  1, 64, 36, 18,181,
-  9, 10, 10,138,167,105, 58,216,102,213,201,206,201,201,249,146,162,168,223,109,199, 30,100, 89,118, 80, 85,150,172, 49, 99,198,
-116, 60,126,252,248,178, 43, 87,174, 20,231,231,231,  7, 31, 58,116,200,244,225,135, 31,166,  2, 64, 74, 74, 74,195,129,  3,  7,
-134, 78,157, 58, 53,189, 79,159, 62,171,122,244,232,241, 46,199,113,167,  8,130,208, 87, 37,178, 34, 35, 35, 47,159, 63,127,222,
- 75,165, 82,149,217, 81,191,126,125,188,251,238,187,226, 65,131,  6, 69,244,234,213,235, 82,114,114,114, 23,  0,127,186, 35,136,
- 26, 55,110,124,250,204,153, 51,158, 62, 62, 62, 40, 42, 42, 66,118,118, 54, 12,  6,  3,148, 74, 37, 70,140, 24, 33,238,214,185,
- 83,221,169,211,222, 59,157,158,145,209,219, 77,177,213,190, 83,139, 22,167,119,198,197,121, 82, 15, 31, 66, 46,151, 67,167,211,
-  1,  0,188,188,188,240,114,131,  6,194,223,182,109, 11, 29, 29, 27,123,250,215,164,164,222, 79, 73,108, 73,109,191,102,  0, 71,
-  4,  2,193, 96,137, 68, 66, 14, 30, 60, 24,167, 79,159, 38, 76, 38,147,208,102,221,161,  7, 15, 30, 12,185, 92, 14,139,197,194,
-162,100,232,144,126,150,159, 18,137, 68,130,228,228,228, 50,219,180, 90, 45,212,106, 53,242,243,243, 97, 54,155, 81, 84, 84,  4,
-150,101,  9,185, 92,174,102, 89, 22, 36, 73, 58, 11,128, 50, 16,139,197, 72, 74, 74, 42,179,141,166,105,232,245,122,152,205,102,
- 88,173, 86,104,181, 90,185,151,151, 87, 99,127,127,255,116,  0,  7, 11, 10, 10,190,204,201,201, 73,123,194,217,207,179, 11,162,
-248,120,217,125,  0,146,255, 69, 78,  7, 75, 86,168,109,253,143, 90, 74,171, 29, 15,143,252,110, 10,183, 89,199, 30,212,  2, 31,
- 11,  0, 23, 46, 92, 64, 78, 78, 14,242,242,242,160, 86,171, 17, 22, 22,  6,142,227,170, 61, 28,151,156,156,188,238,197, 23, 95,
- 36,110,221,186,117,  2,192,154,221,187,119,143, 43, 40, 40,152, 57, 99,198, 12,223,165, 75,151, 22,196,198,198, 46,  2,176,117,
-247,238,221,239, 52,107,214,172,255,237,219,183, 55, 62,141,116,242,224, 81,219,224, 56,174, 29,128,  0,123,219, 98,107,119,253,
- 28,214,111, 16,  4, 97,113, 56,206, 98,107, 27,156,127,237,176,175,171,  9,130,248,213,225, 60, 53, 65, 16,191,214, 52,153, 78,
-191, 37,157,110,  0, 56,114,228,  8,103, 95, 92,157, 25, 24, 24, 56,173,103,207,158,203,174, 93,187,214, 60, 43, 43,203, 39, 43,
- 43,203,231,218,181,107,205,123,246,236,185, 44, 48, 48,112,154,195,141,112, 62,245,180,195, 62,241,229,203,151,235,237,223,191,
-127,209,233,211,167,139,219,180,105, 99, 57,115,230, 12,221,167, 79,159, 92,219, 11,154,238,211,167, 79,238, 79, 63,253,196,116,
-232,208, 65,126,252,248,241, 71,151, 46, 93, 90,190,119,239,222, 32,142,227,  4,174, 56,109, 16,169, 84,170,239,207,157, 59, 87,
- 78,100, 57,162,110,221,186, 56,114,228,136, 82,165, 82, 29,  4, 32,174, 40,157, 54,200,100, 50,217,190,159,126,250,201,211,203,
-203, 11,185,185,185, 16,137, 68,  8, 12, 12, 68,113,113, 49,178,179,178,144,118,247, 46, 72,139,  5, 43,190,152,239, 37,151,203,
-247,186,104,236,203,113,122,123,123,239,219,185,112,161,103,254,233,211,248, 99,193,  2, 88,173,214,210, 33, 87,171,213,138, 75,
-147, 39, 67,253,227,143,216, 50,119,174,167,183,183,247, 62,  0,178, 42, 56,107,  3,142,156,147,  1, 20,216,150,201,  0,174, 68,
- 70, 70, 94, 75, 76, 76, 68,151, 46, 93,176,103,207,158, 86, 51,102,204,152, 60, 99,198,140,201,123,246,236,105,213,165, 75, 23,
- 36, 38, 38, 34, 50, 50,242, 26,202,250,103,253,221,233,252,219, 56, 25,134, 41,179,176,236, 95,239,152, 58,117,234,228,238,223,
-191, 31, 35, 70,140, 32, 37, 18, 73,214,200,145, 35,165, 23, 47, 94,228,108, 34,211,237,116,154, 76, 38, 24,141, 70,232,245,122,
-164,164,164,200,151, 44, 89,210,249,179,207, 62,107,116,250,244,233,208, 89,179,102, 77, 10,  8,  8,184, 30, 20, 20, 84,239,  9,
-231,221,234,244,127,  5,128,140,106, 90,136,254,110, 78,206,118, 62, 98, 76, 49,173, 29, 26,216,234,242, 86,118, 63,179,109,105,
-213,  3, 72,123,156,186,212,179,103,207, 23, 27, 53,106, 20,180,251,150, 15, 10,197, 77,193,138, 85, 96,197, 42, 48,126,237,144,
- 44,121,  5,225,225,225, 65,158,158,158, 29,171,153,206,237,183,110,221,250,151,173,167,156, 15, 96, 89,108,108,236,231,  4, 65,
- 92,136,141,141,157, 15, 96,153,109,251,130,219,183,111,119,  0,176,243, 41,165,243,153,120,222,121,206,255, 45,206, 42,180, 72,
-  0, 65, 16, 71,  8,130, 56,242,201, 39,159,244,  0,224,231,180,254,111,199,227,  0, 72, 92,253,218, 23,135,237,  1, 28,199, 13,
-112, 56, 47,160,134,201, 39, 92, 44,127,  9, 45,  0,136,142,142, 38,162,163,163,237, 59,126, 33,  8,226, 16,128, 95, 68, 34, 81,
-155,214,173, 91, 15,254,225,135, 31,188,  2,  2,254,186,126, 64, 64,  0,246,238,221,235,213,162, 69,139,193, 34,145,168, 13,128,
- 95,148, 74,229,161, 74,172, 48,170,201,147, 39, 15, 29, 59,118,172,166, 77,155, 54,  0, 80,148,144,144,160,232,208,161,131,158,
-166,105,130,166,105,162, 67,135, 14,250,132,132,  4,  5, 69, 81,218,118,237,218,121,244,234,213, 43,117,250,244,233, 99, 92,  8,
- 14, 71,188,190,120,241,226, 48, 31, 31,159,202,148, 48,180, 90, 45,130,130,130, 48,121,242,228, 96,145, 72,244,102,101,119, 75,
- 40, 20, 78, 89,188,120,113,160, 74,165, 66, 97, 97, 33,194,194,194, 96,177, 88,144,148,148,  4,147, 94,  7, 74,171,  1,165, 41,
-130,250,254, 61,168, 68, 66,140, 25, 20, 29, 36, 20, 10,167, 84, 97, 45,153,242, 77,108,108,144, 37, 53, 21, 41,123,246,128,161,
-203, 27,127,104,171, 21, 55, 55,109,130, 41, 61, 29,139, 38, 76,  8,146, 72, 36, 83,158,176, 37,107, 41,199,113,114,142,227,228,
-  4, 65,172,234,216,177,227,183,114,185,124,114, 92, 92, 92,223,147, 39, 79,246, 59,127,254,124,119,154,166, 69, 52, 77,139, 46,
- 92,184,208,197,100, 50,  9,165, 82, 41,132, 66, 33,135,231, 20, 34,145,  8, 98,177, 24,114,185, 28,157, 59,119,190,191,121,243,
-102, 42, 44, 44, 76,180,111,223, 62,159, 58,117,234,120,172, 89,179,166, 72,171,213, 46,118,151,207,106,181,194,108, 54,195,104,
- 52,194,100, 50,225,204,153, 51, 13,166, 78,157, 42, 52,153, 76,204,192,129,  3, 11, 40,138, 50,199,198,198, 42,125,125,125, 63,
-124,146,249,140,137, 49,177, 54,203,211,109,155,104,121,128,199,244,121,250, 59, 56,  1, 88,108, 62, 89,118,248,219,184, 45,181,
-116, 43,104,  0, 58,155,208, 50, 59, 61, 31, 45, 29, 44,190, 85,162,168,168,104,227, 55,223,124, 19, 70, 74, 85,184,104,233,143,
-239,216,207,113,210,123, 13,114,235,125,132,192,176, 70, 24, 53,106, 84, 32,199,113,107,106, 33,205, 95,  1,232, 10, 96, 85, 77,
- 78,126,  2,233,172,231,225,225,177,199,203,203,235,162,135,135,199, 30,216,134,103, 31,  7, 81,141,208,123, 80, 51, 50, 61, 42,
-  2,220,160,102,100,122, 84, 35, 62,212,192,243,  2, 39, 45,226,  8, 53,199,113,209, 28,199, 69, 47, 90,180,104,161,195,251,221,
-190, 46,119,211, 50, 22,205,113, 92,116, 25,133, 84, 34,176, 30,219,232,230, 98, 41,209, 20,142, 74,210, 33,115,165,179, 11,131,
-130,130,226,227,227,227,189,156, 25,179,178,178,160,209,104, 48,103,206, 28,175,177, 99,199,190,151,158,158, 30, 83, 69, 34, 36,
-217,217,217,109, 71,143, 30, 45,179, 90,173,133, 44,203,146, 26,141, 70,232,237,237,205,216, 15,240,246,246,102,138,139,139, 69,
-122,189, 94,192, 48,140,121,236,216,177,146,  9, 19, 38,188, 12, 64, 80, 17,105, 64, 64, 64, 84,255,254,253, 43, 28, 58,160, 40,
- 10,122,189, 30,122,189, 30, 86,171, 21,157, 59,119,150,110,222,188,185, 79,110,110,238,250, 10, 21,135, 84, 26, 21, 21, 21, 37,
- 42, 40, 40,128,183,183, 55,210,210,210,240,224,193,  3,152,117, 58, 88,117, 26, 88,117, 90,208, 90, 13, 56, 77, 49,242,239,221,
- 65,135,102, 77,197, 59,164,210,190,122,189,126,121, 69,156, 74,165, 50,170,195,184,113, 66, 15, 15, 15,116, 31, 93, 50,207,224,
-120,179,102,224, 24,  6, 44,195,128,161,105,244, 77, 74,  2, 69, 81, 32, 73, 18,237, 10, 10,132,202,109,219,162,212,106,245,178,
-167, 81,217,165, 82,169,112,251,246,237,175, 75, 36, 18,112, 28, 71, 88, 44, 22,156, 60,121,242, 31,247,208, 75, 36, 18,200,100,
- 50, 88,173, 86,212,175, 95,223, 56,122,244,232,203, 95,124,241, 69, 56, 73,146, 30, 98,177,248,135,252,252,252,133, 89, 89, 89,
- 41,238,242, 81, 20,  5,139,197,  2,139,197,  2,163,209,136,251,247,239,  7, 55,104,208,128,152, 60,121, 50, 99, 48, 24, 26,174,
- 94,189, 58,249,228,201,147,138,197,139, 23,191, 10,224,221, 39,157,223,152, 24, 83, 51,  0,205,226,227,101, 98,155,229,215,242,
- 63,198,201,161,196,241, 29,241,178,248, 68,  0,234, 90, 20, 89, 18,  0,222,225,126, 66,189, 72,  0, 29,  0, 47,155, 40,120,149,
- 32,136, 14,205,155, 55,247, 73, 76, 76, 44,228, 56,238, 42,128,239,  0,100, 85, 70,198,178, 44,193,178, 44,222,110, 95,132,201,
- 29,  5,160,168, 98, 20, 23, 23, 35, 45, 45, 13,  9,  9,  9,248,249,231,132,154, 62,155,111,122,122,122,246,145,201,100,245,105,
-154, 38,117, 58, 93,154,193, 96, 56,205,178,236, 70,212,192, 71,237,239, 74,167, 29, 30, 30, 30, 75,102,205,154,213,201,219,219,
- 27,191,255,254,123,195, 93,187,118, 45,209,235,245,143,229, 92, 47, 19,145, 91,150,175, 92, 19, 26, 26,168,194,141,243,135, 67,
- 23,110,216,189,  5, 96,195,120,153,242,236,195, 73,139, 56,138,161, 95, 57,142, 27, 64, 16,196, 17,103,161, 84, 45,179,211, 99,
-158, 95,133, 69,203,249,195,210,101,133, 86,  5, 10, 18, 52, 77,  7, 59, 90,178, 56,142, 67, 86, 86, 22, 50, 50, 50,160, 86,171,
-225,227,227,  3,171,213, 26,236, 78,251,160,213,106,219,251,249,249, 25, 68, 34,145,217,104, 52, 66,161, 80,176, 34,145,136,179,
- 93,135,176,205, 90,100,204,102, 51, 33, 20, 10, 41, 47, 47, 47, 79,179,217,220, 20,149,248,146,113, 28,215,222,207,207,207,229,
- 62,179,217, 12,157, 78,  7,189, 94, 15,157, 78,  7,179,217,140,160,160, 32,208, 52,221,182,210, 46, 45, 77,183, 12,  8,  8, 64,
-102,102, 38,228,114, 57,210,211,211, 97,209,105, 97,213,106, 65,235, 53, 96,138,139,193,106, 52, 96,245, 26, 80, 22,  3, 66,155,
- 52,131,125, 70, 98,133,221,112,139,165,165,159,159, 31,244,250,191,220,205, 56,155,192,162,105, 26,180,205, 57,218, 62,156,232,
-239,239, 15,251,140,196, 39,  4, 51,128, 25, 36, 73,174,146, 74,165,194, 73,147, 38, 33, 43, 43,171, 76,157,152, 52,105, 82,169,
- 79, 86,215,174, 93, 47,200,100, 50, 90,173, 86,195,108, 54,139,158,215,135,158, 32,  8, 16,  4, 81, 82, 70, 52, 13,127,127,127,
-125, 94, 94,222,207, 69, 69, 69,175,215,132,143,162, 40,251,140, 46, 24,141, 70,112, 28,135,223,127,255, 29, 50,153, 76,196, 48,
-204, 45,154,166, 21, 34,145,  8,164,205,249,235, 73,193, 54, 35,240, 75,  0, 97, 54, 11,209,155, 40,113, 56,207,112,209,144,184,
-117,235,220,228,172,190,112, 51,197,216, 45, 77, 25,168,217,112,164, 43,116,111,170,146, 44,143,235, 16,168,106, 61,208, 67,175,
-144,  8,244,108, 90,235,250,255, 93,154,176,107,236,152, 55,189,230,205,155, 87,207,223,223, 95,150,156,156,108,154, 63,127,126,
-131,237,219,183, 19, 40, 25,166,171, 16, 15, 31, 62, 60, 48,107,214, 44,223,254,253,251, 55,148, 74,165, 68,113,113, 49,212,106,
- 53,114,114,114,240,224,193,  3,238,198,141, 27,247,205,102,243,158,234, 36, 50, 36, 36,100,243,235,175,191, 62,246,165,151, 94,
- 18,217, 45,164,122,189,190,205,185,115,231,  6, 29, 63,126,188,139, 94,175,175,118,189,124,244,232,209,158,217,179,103,123,188,
-242,202, 43, 77,165, 82, 41, 89, 27,233,116,  4, 73,146, 65,158,158,158, 56,125,250, 52, 84, 42, 21, 72,146, 12,122,220,250,106,
-178,178,161,117,130,253, 96,186,180, 28, 77,  3,234,193,100,101, 67,121,137,242,252, 88,180, 42,120,215,183,179, 91,164,170, 16,
- 75,198,153, 51,103,206, 34,  8,226,200,204,153, 51,103,185,178,104,217,254, 50,142,199, 57, 28,111,174,109,177, 85,173, 64,147,
- 44,203, 34, 35, 35,  3,153,153,153,200,200,200, 64,126,126, 62, 72,146,  4,199,113,238,204, 62,227,  8,130, 96, 79,157, 58,229,
-115,249,242,101,125,187,118,237,138,236,254, 47, 52, 77, 19, 20, 69, 17, 54,191, 24, 34, 45, 45, 77,124,241,226, 69,213,237,219,
-183,131,108,189, 85,182, 10, 83, 96,185,109,118,129,229,184,152, 76, 38,200,100, 50,247, 84,135,237, 69,248,251,181,107, 37, 34,
- 75,167,181, 13, 25, 22,131,209, 20,131,211,107, 33, 97, 40, 72,192,129, 48, 25,220,190,127,142,176,139, 44,171, 77,104, 89, 44,
- 22, 80, 20,  5,150,101, 65,211, 79,197,175,124, 93,171, 86,173,218, 30, 56,112, 96,124, 70, 70,249,119,225,144, 33, 67,240,238,
-187,239, 98,234,212,169,183,  7, 12, 24,112,227,240,225,195,152, 50,101, 10, 88,150,109, 13,160, 24,192,241,231,237,161, 55,155,
-205,165, 22, 40,147,201,  4,171,213, 10, 84,227,179, 10,206,117,211, 94,182, 52, 77,219,185,137,  3,  7,246,227,194,133, 11,100,
- 66,194,173,176, 73,147, 38,219, 29,238,159,116, 86,211, 81, 50,115, 79, 98,107, 40, 44, 40,241,127,170, 40,164, 66,  4, 42, 31,
-178,227, 42,227,124, 28,180,218,208,106,196,  7, 31,124, 16,133,146, 25,206, 41,143,105,209,122, 69, 66, 18, 95, 79,107,233, 43,
-251,176,149,159, 94, 34, 36,116, 73, 95,207,210, 61,  8, 87,234,131,234, 42, 44, 97, 13, 84,117, 22, 46,252, 34,228,246,237, 59,
-230, 57,115,230, 36,142, 28, 57, 50,240,195, 15, 63,108,190,111,223,190, 46, 38,147,233, 27,  0, 69, 21, 25, 93,  6, 13, 26,116,
- 53, 48, 48,176,193,134, 13, 27,114, 31, 61,122,228, 67, 81,148,135,213,106,101,245,122,253,  3,163,209,120,218,106,181,158,  6,
-112,173, 58,137,245,242,242,106, 53,110,220, 56, 81, 81, 81, 17,132, 66, 33,172, 86, 43,114,115,115,209,169, 83, 39,193,161, 67,
-135, 90,212,228,  6, 20, 22, 22, 46,255,230,155,111,206,238,220,185,179,143, 82,169,124, 73, 42,149,  6,  3, 96,180, 90,109,142,
- 94,175,255,163, 38,233, 44,211,206, 49, 76,206,181,107,215, 34,148, 74, 37, 30, 62,124,  8,134, 97,114, 30,183, 14,200,196,228,
-163,155,231, 15,213,109,230,223,  0, 23, 47, 95,133, 76, 76, 62,226, 67,125, 61,247,176,251, 80,193, 81, 64,185, 16, 72,151,227,
-226,226,228,139, 22, 45, 66, 92, 92,220, 45, 87, 22, 45,187,224,138,139,139,187,101, 63,206,225,248,243,143,145,198,138, 45, 90,
- 21, 41, 72,160,100,118,161, 90,173,246, 81,169, 84,165,  2, 43, 51, 51, 19,153,153,153,144, 72, 36, 72, 75, 75,131, 68, 34,201,
-114,167, 19, 34,151,203,127,107,211,166,205, 11, 41, 41, 41,226,249,243,231,215,189,118,237,154,178, 83,167, 78, 47,202,229,114,
-134,227, 56,152, 76, 38, 50, 49, 49,209,115,217,178,101,161,237,219,183,183,180,111,223,254,250,238,221,187,141,168, 36,254, 21,
- 65, 16,191,100,101,101, 53,172, 95,191,190, 93,180,149, 17, 87,142,130, 11, 40, 25,242, 20, 10,133,215, 43, 75,168, 80, 40,188,
-153,148,148,212, 91, 33,147,194,162,213,192,170,211,128,214,106,193,104,139,193, 20, 23,  3,122, 13, 36, 52, 13, 17, 67, 65, 46,
-147, 33, 35, 61, 29, 66,161,240,102,101,156, 18,137,228,102, 78, 78, 78,111,149, 74, 85,250, 18,165,104,186,100, 97, 24, 88,104,
-186,212,162, 37, 18,137,240,232,209, 35, 72, 36,146,155, 79,186, 38,147, 36,201,216, 67, 56, 84,144, 15,  4,  5,  5,177, 29, 58,
-116,192,148, 41, 83,192, 48,140,173, 24,136,238,  0, 46,162,196,191,229,153,132, 43,113,107,119, 90, 55, 26,141,208,233,116, 40,
- 44, 44, 20,202,229,242, 23, 66, 67, 67,175, 90, 44,150, 61, 52, 77,111,121,240,224,129,166, 34, 78,155, 48, 43, 21, 93, 44,203,
-130,227, 56, 48, 12,  3,138,162, 32, 22,139,217,115,231,206, 99,217,138, 37,136,223,178,157, 27, 52,104, 16,113,232,208, 33,176,
- 44,155,254,132,179,111,177,137,150,202, 26, 13,231,144, 10, 31,161,242,144, 10, 21,113, 58,246,254, 28,183, 17, 46,142, 41,135,
- 15, 62,248,224,  4, 74,134, 12,243,108, 98,238,113, 56,191, 44,250,238, 11, 25,104, 70,111, 62,183, 83,247,237, 93,141,126,222,
-183, 43,127,179, 72,  4,154,151,187,  5,181,108,216,224,  5,129, 74,229, 67,174,223,184, 42,127,199,246,189,201, 15, 31, 62,212,
-172, 93,187,182,227, 11, 47,188,224,253,199, 31,127,132, 86, 36,180, 20, 10, 69,227, 55,223,124,115, 92, 97, 97,161, 56, 62, 62,
-126,119, 86, 86,214,111, 40,  9, 45,227, 56,131,122,  0,128,173, 54, 33, 26,100,107,231, 46,  2,152, 95, 89,127,141, 32,  8,252,
-244,211, 79,229,102,  7,178,143,167,206, 85,141, 26, 53, 26,145,146,146,114, 33, 39, 39,103,152,243, 78,177, 88, 60,175, 73,147,
- 38,125,111,221,186,245, 57,128, 99,213, 33, 54, 24, 12,177,123,247,238, 93, 42, 16,  8,234, 48, 12,147,105, 52, 26, 99, 31,219,
-162, 69,177, 19,226,214,239,218,100,180, 48,225,114,137,224,161,137, 98,223,226,117,200,243,107,205,178, 65,237, 96,141, 82,  3,
- 32,156,214,255,176,189,140, 44, 28,199,217,143, 85, 59, 88,177, 44, 78, 86, 48, 87,251,212,143, 17, 44,157,171,168,141,171,200,
-162,245,  9,128,246,  0,126,201,201,201, 89, 53,118,236,216,101, 59,118,236,240,210,104, 52,200,201,201, 65,110,110, 46,132, 66,
- 33,148, 74, 37,214,173, 91,103,204,201,201, 89,229,120, 14,202, 71,144,  7,  0,147,191,191,255,111,219,183,111, 15,254,250,235,
-175,133, 49, 49, 49,105,  3,  6, 12,104,186,110,221,186, 20,177, 88,204, 49, 12, 67,152,205,102,226,237,183,223,142, 88,177, 98,
- 69,170, 64, 32, 80,140, 24, 49,130,240,240,240,248,  5,149,132, 13, 80,171,213,167,190,255,254,251,161,211,167, 79,151, 90, 44,
- 22,151,150, 44,251, 54,149, 74,133, 75,151, 46, 89, 10, 11, 11, 79, 86, 97,197, 56,245,195,177,163, 93,255, 51,114,164,152,210,
-106, 64,105, 53,160, 53, 26, 48,218, 34, 16, 58, 13, 68, 12, 13,185,152, 69,112,152, 12,180,209, 19, 71,127,253,131, 50,155,205,
-149,  6, 54,212,104, 52,167, 46,198,199,119,111, 95,175,158,240,210,180,105,176, 82, 20, 94, 73, 74, 42, 21, 87, 86,171, 21,  7,
- 91,182,  4, 67, 16,104, 61,113, 34,238,209, 52,173,209,104, 78,253, 47, 62, 12, 55,110,220,200, 29, 61,122,244, 53,150,101,219,
-226,  9,125, 52,243, 73,128,162,168,114,214, 40,134, 97, 74,172,142, 37,150,  3,201,209,163, 71,187, 38, 38, 38,138,255,252,243,
- 79, 92,184,112,161,245,142, 29, 59, 62,  9, 15, 15,111,249,240,225,195,236,170,196,155,171,160,191,176,249, 31,238,222,185,  7,
-239,188,243, 14,145,157,157,141,239,190,251, 14, 85,  5, 79,253, 59, 16, 19, 99, 98,227,227,101,117,225,228,247,228, 34,164,194,
-239,112, 51,164, 66, 69,156,166,152, 18, 43,153, 44,190, 36,216,168, 41,166,100, 56, 80, 22, 95,165,165, 12, 49,166, 24,141,205,
- 33, 62,171, 22, 56,245,160, 25,185,229,220, 78,221,128, 99, 15,181, 87,178,140,243,  1,156,128,137,225,238, 93,231,110,188,244,
-146,143, 63,  0,152, 77, 76,112,227,198,141,187,  9,133, 66,  9,  0,120,122,122,190,228,231,231,183, 46, 63, 63,191,179,171, 50,
-141,142,142,238, 16, 24, 24,216,230,248,241,227,127,100,101,101,221,  2,240,179,243, 65, 17, 17, 17,115,110,223,190,221, 78, 36,
- 18, 17, 85,212, 17,  0, 64,183,110,221, 94,144, 74,165,126,199,238,122, 67, 35,110,  4, 78, 80, 12,  8,101, 96, 84,173,144, 38,
-110,142,176,176,171,126,133,133,133,173,139,139,139,255,168,102,209,247, 24, 58,116,232,150,248,248,248,176,110,221,186,113,215,
-175, 95, 39,157, 71, 17, 34, 34, 34,250, 92,185,114,165,237, 91,111,189,181, 97,215,174, 93,147, 81,118,166,109, 85, 72,179,197,
- 27,172, 53,156, 74,198,105,128,169,103,179,153,241, 10,229, 31,128,234,132, 92,120,140,240, 12,143,149,196, 10, 13, 24, 21,108,
-111,111,139,137,213,158,162,168,223,111,220,184,113,112,196,136, 17,186,252,252,124,248,249,249,161,126,253,250, 32,  8,  2,235,
-214,173, 51, 62,120,240, 96,159, 45,150, 86,251,204,204,204, 65, 54,177,229, 10,218,213,171, 87,239,218,182,109,155,234,218,181,
-107,  2,154,166,149, 77,155, 54, 53, 92,190,124,217, 83, 36, 18,113, 98,177,152,189,118,237,154, 34, 34, 34,194, 68, 16,132,244,
-199, 31,127,204,191,122,245,106,248,140, 25, 51,190, 65,217,105,226,206,216,185, 96,193,130,140,148,148, 20,152,205,102,104, 52,
- 26, 20, 23, 23,151, 46, 69, 69, 69, 40, 46, 46,134, 72, 36, 66,118,118, 54,246,239,223,159,101,139, 18, 95,153,101, 99,237,154,
-117,235,213, 89, 15,211,160, 84,200, 65,107,138,192, 20,231,  3,218, 98, 72, 40, 43, 60, 68, 12,234, 54,146, 67,166, 80, 34, 71,
-163, 67,252,229, 95,179,109, 81,226, 43, 54, 23, 88, 44,107,223, 93,177, 34,135, 22,139, 81,111,248,112, 88,109, 67,133,142, 66,
-139, 33,  8,132,247,234,  5,210,219, 27, 11,247,237,203,177, 69,137,127,162, 96, 89, 86, 96,177, 88, 42,203,  7, 88,150, 77, 79,
- 76, 76,220,  5,224, 44, 65, 16, 28, 65, 16, 28, 74,130,181,233,158,229,  7,153,162, 40,204,157, 59, 23, 98,177, 24,115,231,206,
-197,167,159,126,138,101,203,150, 97,253,250,245,248,246,219,111,113,244,232,209,  6, 23, 47, 94, 20,159, 63,127,158,139,139,139,
-203,139,136,136, 16, 76,156, 56, 81, 37,151,203, 63,168,140, 51, 54, 54, 22, 94, 94, 94,136,141,141,197,146, 37, 75,176,121,243,
-102, 28, 60,120, 16,151, 46, 93,130, 64, 32, 96,211,211, 31,193,100, 50,113,171, 87,175,206, 56,120,240,160,113,213,170, 85, 16,
- 10,133,196, 83,106, 36, 62,176,  9, 42, 71, 75,144,115, 72,133,124,  0, 43, 81,181,111, 84, 69,156,144,197,199,215,181,137,163,
-100,  7, 65,116, 24,192,116, 84, 62,189,218,206, 49, 25, 64,112, 45,112,206,150,143,254,191, 68,213,166, 59,247,175,100, 25,103,
-  3,248,193,158, 39,165, 82, 41, 63,112,224,123, 33,  0,236,219,187, 95,148,148,148,228,253,253,247,223,203,  2,  3,  3,241,237,
-183,223,202,228,114,121, 96,  5,156,204,193,131,  7,205, 18,137,196,111,194,132,  9,253,218,181,107,247,190,173, 35,218, 11, 64,
- 11,148,204, 94,140,186,127,255,126,130,191,191,255,221,147, 39, 79,234,221, 41, 32,173, 86,251,205,214,173, 91,235, 23, 48,190,
- 56,166, 31,138,120,118, 41,142,170,182, 32,173,222,167, 80,212,121, 25,175,191,254,122, 29,134, 97, 54, 85,179,220, 95, 31, 50,
-100,200,214,248,248,248,176,  9, 19, 38,100, 95,191,126, 61,  7, 64, 60,128,237,142,203,237,219,183,243,198,142, 29,155,181,105,
-211,166,144, 17, 35, 70,172,  7, 48,140,127,245,243,224, 81,182, 47,132,170,102, 29,186,120,225,150,254,207,205,205, 93, 93, 88,
- 88,120,233,222,189,123,239, 89, 44,150, 16,130, 32, 56,177, 88,156,157,147,147,179,202, 33, 96,169, 43,191,146,222,176,197,218,
- 32,  8,130,226, 56, 46,189, 71,143, 30, 31,244,234,213,235,171, 35, 71,142,152,186,119,239,142,189,123,247,250,247,232,209,195,
-192,178, 44,119,236,216, 49,255,190,125,251, 26,206,158, 61,171,127,251,237,183,155, 54,105,210,100, 98,108,108,172,154, 32,  8,
-214, 21,167,253, 93, 86, 84, 84, 52,164, 95,191,126,151,246,237,219,167, 84,169, 84,160,105, 26,  6,131,  1,  6,131,  1, 28,199,
-193,219,219, 27,106,181, 26,243,231,207,215, 20, 23, 23, 15,118, 33,220,156, 57, 77, 38,147,105,216,228,247,167,159, 90,245,249,
- 92,175,240,  6, 13,144,127,199,  4,218,100,128,136, 35, 81,247,  5,111,136, 37,114,220, 75,210,226,163, 93,  7,180, 70,147,233,
- 53, 23,189,229,114,156,197,197,197,195, 98, 62,253,244,244,134, 25, 51, 60,219,  4,  5, 65, 32, 16,192,108, 54,131, 97, 24,136,
- 68, 34, 68,198,196, 64, 28, 16,128, 57,187,118,233, 53, 26,205, 48,148,255, 20,143, 51,103,109,192,145,115,242,141, 27, 55,198,
- 54,107,214, 12,147, 38, 77,194,144, 33, 67,202, 28,248,253,247,223, 99,253,250,245, 48,155,205, 99,  1, 92,  7,176, 14, 37, 67,
- 29,112, 18, 89,127,119, 58,107,157,147, 97,152,194,164,164, 36,229,210,165, 75,  9,171,213,138,207, 63,255, 28,118,193,105,175,
-215, 83,166, 76,169,227,229,229,133,207, 62,251,204,146,151,151,215,115,201,146, 37,103,182,111,223,238,255,205, 55,223,188, 14,
- 32,214,153,147,101,217,220,155, 55,111,122,109,216,176,129,164,105, 26,203,151, 47, 47, 55, 60, 57,126,252,120, 88,173, 20,  4,
-  2,161,197,100, 50,183,144,203,229,201,126,126,126,114,174,172,115,215,147,188,159,161, 40,  9, 97,224,232,248,110,113,244,207,
- 66,197, 33, 21,170,195,169,150,197,199,119, 55,197,196,156,181,  9,162, 68,219, 49,123,237, 38,253,106,112,218,  5, 97, 77, 56,
- 79,217,150, 42, 97, 50,153,160, 86,171,145,151,151,  7,149, 74,  5,129, 64, 64, 84,148, 78,179,217,252,231, 71, 31,125,116, 99,
-211,166, 77,189,175, 92,185, 50,240,252,249,243, 61, 78,159, 62,109, 74, 75, 75,163, 41,138,226, 66, 66, 66,132,157, 59,119,150,
-245,239,223,223, 67, 42,149,146,179,103,207,206,251,226,139, 47,252, 81,214,135,205, 57,239,  2,130, 32,240, 97, 87, 45, 98,123,
-  8, 96,177, 88, 81, 84, 84,132,140,140,116, 36, 36, 36,224,202,149, 59,224, 56,142,172, 70,185,251,  1,152,253,221,119,223,133,
- 74, 36, 18, 98,215,174, 93,117,118,237,218, 85,165, 37,117,199,142, 29,117,118,239,222, 61,207, 54,122,145,254, 44, 62,239, 60,
-231,255, 44,231,179, 12,231,200,240,168, 82,104,217,218,249,246,176,125,148,148,162,168, 95, 92,132,112,248,  4,192, 92,  7, 43,
- 88, 85,230, 60, 13,199,113, 23,122,247,238, 61,165, 87,175, 94, 43,250,244,233,147,149,149,149,213,112,249,242,229, 97, 52, 77,
- 91, 19, 18, 18,200,228,228,228,180,223,126,251,173, 81,147, 38, 77, 38,222,190,125,251, 28, 65, 16, 86, 55, 50,152,144,156,156,
-220,169, 71,143, 30,251, 39, 78,156, 24,222,161, 67,  7,137, 74,165,130, 80, 40, 68, 74, 74, 10,254,248,227, 15,203,238,221,187,
-211,139,138,138,170,243,  9,158, 95, 82, 51, 50,162, 70, 76,125,111,223,196, 33,  3,253,255,213,244,  5, 73, 72, 72,  8, 96, 52,
-226,206,195,108, 92,189,243,135,117,243,133,171,106,179,217, 60, 12,238,127,130,231,151,223,238,221,235,221,115,198,140,125,243,
-254,243,159, 32,100,101,  9, 67, 66, 66, 32,145, 72,240,224,193,  3, 36,179, 44,189,120,227,198, 28,155,200,122,210, 81,225,165,
-  0,150,178, 44, 43,  4,  0,185, 92,142,119,223,125, 23,142,159,220, 89,191,126, 61,140, 70, 35,  0,  8,  9,130, 88, 10, 96,203,
-179,110,197,178,163,160,160, 96,206, 43,175,188, 18, 39, 20, 10, 43,140,122,235,227,227,  3,173, 86, 11,154,166,153,140,140,140,
- 59, 62, 62, 62, 16,137, 68,224, 56,206,229,115,148,159,159, 63,103,216,176, 97, 11, 72,146,172,200,242,  1,165, 82,153,118,230,
-204,153,198,111,189,245, 22,249,223,255,254, 55,101,194,132,  9,210, 51,103,206, 48, 28,199,237,127,210,247,160, 75,151,157,192,
-134,152,215,  0,188,  6,148,115,120,207,176,109,171, 86, 72,133, 46, 93,118, 98,  3,254,226,116, 28,198,179, 11, 34,155, 21,170,
-185, 44, 62,126,  5, 74,252, 44, 42,229,238,178,179, 11, 54,196,160, 86, 57,221,129,163,246,213,235,245, 96, 24,166, 50,107,222,
-239,123,247,238, 93,241,219,111,191,  5, 76,153, 50,165,225,127,254,243, 31,101,143, 30, 61, 60, 29, 15, 48, 26,141,236,225,195,
-135,245,235,215,175, 47,190,112,225, 66,234,248,241,227, 59, 84,150,206,135, 15, 31, 30, 93,184,112,161,119,255,254,253,155,  0,
- 40,245,207, 82,171,213, 72, 75, 75,195,159,127,254,153,102,181, 90, 15, 85, 35, 75,249,  0,230,141, 26, 53,106,233,182,109,219,
-234, 76,152, 48, 33,123,247,238,221,127,162, 36, 96,177, 51, 84, 67,134, 12,105,185,109,219,182,144,  9, 19, 38,100,163,196,143,
- 44, 29, 60,120,240,176,163, 59,202,251,105, 85, 58, 50,177,213, 98,177,112, 38,147,137, 51, 24, 12,156, 78,167,227,224,250, 43,
-240,  7, 51, 51, 51,185,244,244,116,238,225,195,135, 92,106,106, 42,  7,224, 91, 39,197,235,170,193,242,216,177, 99, 71,163,208,
-208,208,207, 21, 10,197,  9,129, 64,160, 17,  8,  4, 26,169, 84,250,131,159,159,223,167,139, 23, 47, 14,229, 56, 78, 92,137,138,
-174,  8, 66,145, 72,244, 86, 96, 96,224, 65, 95, 95,223,116, 31, 31,159,244,192,192,192,131, 34,145,232, 29,  0,162, 42,148,121,
- 69,144,  9,133,194,143, 60, 60, 60, 78, 73,165,210, 92,169, 84,154,235,225,225,113, 74, 40, 20,126,132,202,  3,169, 86,202, 41,
-145, 72, 62, 10,  8,  8, 56,165, 84, 42,115,149, 74,101,110, 64, 64,192, 41,137, 68,242, 56,156,143,211, 43,177, 11, 45,  3,103,
-  3, 65, 16, 84,235,214,173, 55,180,109,219,118, 93,219,182,109,215,181,106,213,234,107,155, 85,146,179, 89, 91, 12,168, 56,120,
-227,223,153,206,167,198, 25, 25, 25,185,125,219,182,109,236,156, 57,115, 52, 77,154, 52, 41,152, 51,103,142,102,219,182,109,108,
-100,100,228,246,154,114,  6,  5,  5,213,139,140,140, 44,216,180,105, 19,157,148,148,196,109,218,180,137,142,140,140, 44,112,138,
- 12,255, 36,242, 78,  0,136,176, 89,127, 14,  1,216,131, 18,231,247, 80,  0, 68,140, 41,134,179,205, 62, 60,  1,160, 79,  5,101,
-239, 46,103,152, 41, 38,134,179,249, 84,157,  4,144,232,176,222, 13,101,253,191,158,  4,167, 75,180,104,209,226, 30,231,  0,139,
-197,194,169,213,106, 46, 41, 41,137,187,112,225,  2, 23, 22, 22,118,207, 13, 78, 63,  0,111,  3, 56, 28, 28, 28,124,187, 99,199,
-142, 15, 59,117,234,244,176, 94,189,122, 41, 34,145,232, 10, 74, 34,188, 71,218,150,165,  0,154, 84,193,217, 81,165, 82, 45, 12,
- 11, 11, 59,212,184,113,227, 75,245,235,215,191,226,235,235,123, 68, 38,147, 45,194, 95,145,177,171, 91,231,123, 12, 29, 58, 52,
- 77,167,211, 49, 47,189,244,210,109, 87, 39, 53,107,214,236,162, 78,167, 99, 70,142, 28,153, 14, 32,250,159,240,188,243,156, 79,
-133,243, 31,133,198, 54,193,116,208, 97,249,196,197,113,159, 56, 29,179,213,118,110,149,  5,193,113,156,128,227, 56, 15,142,227,
-188, 57,142,243,229, 56, 78,197,113,156, 39,199,113,210, 42,204,223,124,197,254,251, 56, 39,219,  4,148,193,246,223, 25, 85,237,
-127,174,239,103,104,104,168, 79,187,118,237,166, 30, 56,112,224,163,251,247,239,127,116,224,192,129,143,218,181,107, 55, 53, 52,
- 52,212,231,113,210, 25, 20, 20, 84,175,121,243,230, 95, 53,107,214, 44,189,121,243,230, 95, 57,137,172, 39,153,119,137, 77,196,
- 52,179, 45, 13,109,219,  8,148,196,194, 90,107, 19, 54, 17, 21,244,212,170,195,105,231, 59,  4,160,175,109, 57,100,219, 22,246,
- 20, 56,203,161, 65,131,  6,199, 91,182,108,121,175, 85,171, 86,201,173, 90,181,186,215,162, 69,139,123, 77,155, 54,189, 23, 17,
- 17,113,175,110,221,186,247,252,253,253,143,215,160,140,124,  1,132,160,252,103,192,158,118,157,239, 30, 25, 25,121, 85, 38,147,
-185,140, 13, 38, 20, 10,231,181,106,213,234, 38, 74,102, 74,242,237, 39,207,201, 11,173,255, 33,240,149,240,217,227,148,162,242,
-207,140, 84,181,159,191,159,207, 54,167,203,111,117,217,132, 76, 67,155,192,145,212,  2,167, 35,159,189, 78, 69, 56,136,166,167,
-193,201,215, 37,158,147,231,228,133, 86,173, 67,200,223,  2, 30, 78, 48, 63,230,126, 30,207,197,104, 60,126,  0,  0, 32,  0, 73,
- 68, 65, 84, 54,170, 19, 19,235,113, 56, 93,241,221,127,202,156, 60,120,240,224, 81, 91,109,103,119,  0,231,236,189,194,138, 84,
-105,117,102, 19,212, 68,217,158,230, 57,121, 78,158,147,231,228, 57,121, 78,158,243, 31,199,105,199,138, 10,182,223,113, 90,255,
-250, 25, 21, 94, 79, 36, 76, 15,111, 86,229, 57,121, 78,158,147,231,228, 57,121, 78,158,179,166,152,248,140,138,172,110,246, 21,
-126,232,144,  7, 15, 30, 60,120,240,224,193,163,246, 80,117, 28,173, 61,123,246,  8,236,255, 71,141, 26, 53,158, 97,152,169,246,
-117,129, 64,176,230,187,239,190,219, 82,217, 21,134, 15, 31,206, 84,198,233, 10, 85, 93,199, 21,103,139, 38,202, 73,126,222,138,
-247,138,138, 13, 43, 83, 50,153, 11, 38,147,169,185,125,159, 76, 38, 75,220,178,101,203,221,218, 78,231,248,241,227,155, 56, 95,
-167,126,152,168,187,175,151,236,221,130, 34,221,242, 91,247,116, 95,243,117,236,169,192, 31, 64,180,151, 76, 60,168,133, 74,220,
-241,207,124,211,101,189,149, 57,140,146,217,176,133,207, 99,134,131,131,131,155, 42,149,202, 49,  0, 90, 24, 12,134, 64,133, 66,
-145, 11, 32, 65,163,209,108,207,206,206,190,227, 46, 79,183,250, 72,  3, 16,110, 91,125,120, 46, 21,245,220,217, 87, 21,250, 68,
-192,196,  1, 82,130,128,245,100,242, 95,206,232,125, 27,193,196,114,229,183,247,105,  4, 11,199, 65, 76,  0,230,147,247, 33,123,
-142,138, 74,  9, 32, 10, 37, 33, 28,110,160, 36,252,132,129,127,100,121,240,120,174,224, 60, 84, 88,186, 46,172, 64, 76,116, 21,
- 11,137,175, 56,112, 42,128,243, 51,155,205, 34,137, 68,  2,139,197,  2,133, 66,190,246,237,  9,227, 63,  7,137, 34,138,198,187,
- 91,182,108,169,241,151,174,171,115, 29,  0, 63, 57,159,239,163,148, 47, 56,123,248, 99,159,174,  3, 22, 47,178, 60,200,139,213,
-106,181,164, 84, 42,133,217,108,134,183,183,119,167, 73, 19, 39,190, 68,138, 56,139, 88,236,113,121,197,138, 21,217, 53, 77,231,
-  7, 31,124, 16,108,181,154,254,205,178,172,196, 98,177, 72,157,175,227,173,240, 88,124,246,240,199,138,110,209,139, 62,  7,120,
-161,245, 20, 32,169,231,227,113,110,229,168,238,205, 58,182,104, 12, 54,225, 60, 76, 22,235,160,179,233,186, 65,159, 94,201,156,
-158,174,179,182, 69, 45,  4,172,252, 31,130,160, 97,195,134, 83,  2,  2,  2, 70,110,220,184, 81,220,176, 97, 67,200,100, 50, 24,
-141,198,144,251,247,239,135, 76,154, 52,169,155, 92, 46,223,149,146,146,178, 22,238,125,  8, 46,252,236,214,255,  3,  0,116, 26,
- 51, 63, 28, 37, 31,139, 54, 56,239,235, 62,110,126, 56,128, 25, 40,251, 97,228, 44,148,132, 80,112,213,234, 72,142,108, 91,134,
- 65, 99, 63, 18,  2,152, 84,154,120, 18,248,225,219, 85,232, 55,234,189, 50,219,  9, 14,194,195,219,150, 33,122,236, 71, 21,126,
- 71,177,111, 99,130, 98, 89,174, 66, 75, 60, 73, 18,244,137,123,156,171, 15, 12,231,160, 36,  6, 88, 57, 74,148,124,208,217,229,
-241,  3,154, 10,114,172, 20,227, 50,224,172, 88, 36,200, 61,122,135, 41,119,110, 76, 27, 80, 20, 83,210,182,138,133, 96, 14,166,
-120,159,157, 61,123,182, 48, 58, 58, 26,155, 55,111,238,252,245,215, 95, 79,212,106,181, 63,218,238, 91, 50,255,248,242,224,241,
- 92, 11, 46,215, 66, 75, 40,192,134, 67,251,182, 52,202,201,205, 67,204, 91, 31, 98,231,206,157, 40, 44, 44,132,143,143, 15, 36,
- 98,177,104,229,210,255, 11, 86, 42, 61,130, 99, 38,198,110,  0,208,180,166,169,169,230,117, 26, 59,159, 79,216, 62,165, 35, 20,
-144, 34,137, 68, 66,238,218,181, 11, 69, 69, 69, 80,169, 84,144, 72, 68,228,138, 69,159,200,149, 74, 79,249,155,147,103,118, 70,
- 73,252,159, 26,193, 98,209,117, 62,176,115,139, 82,173, 86, 99,220, 59,177,112,190,142, 88, 44,102,236, 47, 22,190,142, 61, 21,
-204,222,248,238,216,102, 47,122,  1,214, 91,151, 32, 18,  8,160,240,246, 65,148, 80,  0,  1,129,230, 49, 39, 82,103,  1,248,244,
-121,201,108,195,134, 13,167, 12, 31, 62,124,228,130,  5, 11,196, 36, 89, 18,114, 78,175,215,195,104, 52, 34, 52, 52, 20,103,207,
-158, 21,207,153, 51,103,228,247,223,127,143,148,148,148,213,213,229,191,117,235, 86,253,240,240,112, 19,  0, 12,108,233,229,188,
-175,158,125, 31,  0,120,121,121, 85,201,231,167,242, 48,223,186,117,181,133,253,188, 41,189, 66,153, 10,182,155,  0, 40, 42,227,
- 98, 89, 78,120,242,171, 73, 21,238,127,107,193, 14,250,198,158, 11, 77, 27, 54,108,104,116,220,238,233,233, 89,209, 41, 65, 58,
-157, 46,220,121,163,253,120, 43,197,  4, 86,116,189, 62,239,174,119, 41,192, 40,  6,194, 29, 59,118,  0,  0,190,252,104,180, 96,
-211,207,121, 66,161,176,164,169, 93,186,116, 41,230,205,155, 39, 57,113,226, 68,255,109,219,182,245, 63,120,240,224,202,138,132,
- 42, 15, 30, 60,158, 73,145,229,248, 91,177,208, 34,  9,194, 75,233,229,137,215, 94,127, 27,199,143,255,128,174, 93,187,150,238,
-107,208,160,  1,134, 15, 27,140,239,182,174,  0,  0,175,199, 73,209,227, 94,167,176, 88,255,105,191,145, 95,205,127,152,173,187,
-114,228,200, 17,116,233,210,165,204,249,175,143,120, 13,223,126,179, 20,149, 68,153,119, 11,  4, 71,138,189,148, 30, 24, 21,243,
- 14, 92, 93,103,226,184, 33, 71,250, 14, 95,213, 59, 39, 95,191,130,175,103, 79, 30,141,130,253,250,180,108,214, 20,133,251,215,
-226,143, 34, 19,142,103,154,240,102,212,191, 16,233, 43, 71, 23,154, 65,176,135,168,103,182,158,122, 46,132, 86,112,112,112,211,
-128,128,128, 50, 34, 75,171,213, 66,167,211, 65,163,209, 64,171,213,130, 36, 73,196,198,198,138,207,157, 59, 55, 50, 56, 56,248,
-180, 27,195,136, 15,109,150, 44, 64, 32,210,205,157, 59,215, 28, 24, 24,104, 86, 40, 20,156, 80, 44,213,118, 31, 55,223, 11,  0,
- 72,161, 88,187,114,229, 74, 75,104,104,168, 73, 40, 20, 74,222,123,239, 61,210,157, 52,155,205,102,206,145,211, 98, 49,151,110,
- 95,188,120,177, 37, 40, 40,200,172, 80, 40, 56,171,213,125,163,227,205,  7,  5,144,138,  5,144,138,  5,144, 73, 68,240,170,223,
- 14,210,194, 63, 65,211, 52,150, 44, 89, 98, 13, 14, 14,182, 40, 20, 10, 78, 34,145,136,167, 77,155, 86,101, 58,199,143, 31,207,
-169, 84, 42,171, 66,161, 16,207,155, 55,175,220, 76,161, 51, 55, 50, 32,151,136,160,144, 10,209,184, 65, 24,164,156,209,237,180,
- 10,  4,101,189, 17,164, 82, 41, 58,119,238,140, 22, 45, 90,224,224,193,131,221,121,161,197,131,199,115,129, 10,103, 24, 10,  1,
-224,200,145, 35,221, 80,242, 65, 68, 68, 71, 71, 19, 37,103,112,152, 49,101, 24,222, 28, 55, 10, 12,195,150,126,231,139, 32,  9,
- 76,126,163, 63, 88,214,157, 17,137,170,167,120,214,224, 58,165,156, 28, 65, 10,  0,160, 81,189, 16,110,226,155,255,  1,195,178,
-127, 13,148,  8,128,183,199,245, 43,217, 86, 11,233, 20,128,193,135,147, 94,133,171,235, 52,109, 84,135,164,173, 38, 16,101, 63,
-246,248,119,124,108,147,231,116,129, 22,117, 67, 34, 40,163, 17, 38, 19,133,248, 59,  5,198, 83, 25,250, 64, 82,149,170, 94,245,
- 90,  7,153, 64,157,137,122, 94,146,198,217,122,234,185,200,187, 82,169, 28,179,113,227,198,114, 34, 43, 39, 39,135,212,233,116,
-176, 90,173,172, 86,171,  5,195, 48,152, 57,115,166,104,206,156, 57, 99,178,179,179,231,217, 53,143, 43, 78,155,223,213,140, 91,
-183,110,213,155, 61,123,182,181,103,207,158, 15, 27, 52,104,160, 23,  8,  4,  8,  9,  9, 89, 21, 21, 21,229,187, 96,193,  2,107,
-255,254,253, 83,  5,  2,  1, 26, 55,110,172,255,243,207, 63,235,  1,144,187,155,119, 71,206, 45,103,214,112,  0, 64, 16,  4,162,
-162,162,210, 26, 55,110,172, 23,  8,  4,184,123,120, 49,231,238,253, 20,  9, 73, 52,  9,245,182, 53, 34,  4, 32,247, 44,245,196,
-139,138,138, 74,111,218,180,169,142, 36, 73,220,188,121, 51, 12,229, 63,107, 85,142, 83, 46,151, 83,175,191,254,250,195, 59,119,
-238,184, 58, 30, 66,  1,137, 14, 77,109,  6,172,208,182, 64,250,197, 10,211, 41, 18,128,158, 51,101,180, 80, 37,  3,164, 94,254,
-102,141, 70,  3,165, 82, 89, 98, 33,179, 90,241,251,239,191,163, 99,199,142,221,246,236,217,115,142,127,222,121, 78,158,243, 47,
-184,210, 34,207,160, 53,203,241, 67,247,101,124,180,206, 58,103,138, 97,104, 52,  8, 15,194,226,255, 27, 15,134, 97,193, 48, 12,
-104,219, 47,195, 48,160,172,214, 90, 73,217,227, 92,199, 71, 41, 95,240,195,174,119,125,122, 14, 89,218, 43,110,246,184, 83, 12,
-  3,176, 44,  5,138,  2, 24,150,  2,203, 48,160,168,218,113,205,161, 88, 22,245,194,130, 17, 55,123, 28,156,175,179,253,187, 61,
-  3,207, 28,138, 85,116,141, 94,244,225,221, 52,195, 18, 94,216, 63, 89,200,196, 82, 33, 39,148,193, 98,161,161,181,176, 22,  0,
-122, 19,197, 90, 57, 15,127, 25,  0,  8, 73,226,121,154, 93,219,162, 97,195,134,101, 68,214,178,101,203,252,215,173, 91, 23, 10,
-  0,195,134, 13,203,232,213,171, 87, 94, 82, 82, 18, 66, 66, 66,136,188,188,188,  1,  0,222,179,157, 59,  3,192,186, 10,120,245,
-225,225,225,166,128,128,  0,179, 93, 16,145, 36,  9,161, 80,136,240,240,112, 83, 96, 96,160,185,113,227,198,122,177, 88, 12,146,
- 36, 97, 23,122,110,117,243,  8,  2,  2,129,  0,118, 78,103,107,143,157,179, 58, 16,  9,201,242,205,155,  3, 39, 73,146, 46,175,
- 87, 97, 29,146,201, 56,  0, 21, 30, 47, 32, 29,154, 71, 97,229, 30,  2,241,191, 67,  4,224, 44,199,113,184,126,253, 58, 82, 82,
- 82, 32, 22,139, 17, 28, 28,140,121,243,230,193,108, 46,209,187,195,135, 15,239,  6,224, 38,255,  4,243,224, 81,138,179,207,160,
-192,114,182,106, 85,238,163,117,228,200,145,110,209,209,209,231,236,  2,168, 68,236,184, 16, 63, 20, 13,138,178,  2, 28, 87, 43,
- 66,171,162,235, 48, 12, 91,233,117,236, 62, 90, 44,203,  9, 93,138, 44,150,  5, 77, 81,181,114,247, 88,134,  2,203, 82,112,117,
- 29,130, 32, 25, 91,131, 47,230,159,147, 39,143,224,240,122, 36, 21,222,  0, 23,104, 19, 66,253,164, 18,228, 25,209,240,133,102,
-130,223, 13, 20, 46,221, 72,132,191,167,242,185, 41, 23,131,193, 16, 40,147,201,160,215,235, 75, 45, 89,235,214,173, 11,181, 88,
- 44, 36,  0,  8,133,162, 48, 53, 27, 42, 99, 88,192, 91,153,133,194,194, 98, 63,142,227,  8,155,224, 89, 10, 96, 11, 42,137,238,
- 47, 22,139, 75,  5,138,163,  0,146, 74,165, 53, 18, 48,118,216,197,153, 88, 44,118,185,221,121,120,173, 42,136, 29,133, 22,184,
- 18,171,150,147,216, 18,  8,  4,176,251, 70, 85,  5,137, 68, 82,154,119, 87, 16, 10, 28,174, 39,168,190, 43,166,213,106,133, 78,
-167, 67, 81, 81, 17,100,178, 18,131, 25,199,113, 32,  8,226, 61,  0,239,243, 79, 49, 15, 30,174,181,200, 51, 44,182, 92, 11, 45,
-148,152,236,  8,  0,160, 41,171, 75,241,179,231,240, 37, 60,204,214, 35,216,255, 23,112,213,140,122, 58,114,228,200,173, 33, 33,
- 33, 29,236,235, 82,185,167,223,196,119, 63,  3, 77, 91,225, 37, 39,241,214,152,126,101, 68, 86,137, 69,203, 82,225, 55, 65, 10,
-139,245,159,246, 27,190,122,190,183,210,239,138,179,248,137,139,191,246, 90,161,198, 28, 70,146,191,162,144,  8, 97,134,191,253,
-217,120,135,198,253,198,174,245,115,167,187,109, 15, 36, 72,209,107,147, 86, 77,228,132,158,205, 21,164,246,252,199,227,254,117,
-192, 81,204,249,250,250, 30,233,243,218,202,222, 57,  5,188,143,214,211,128,151,183,138, 12,123,185, 59, 94,126,239, 43,156,249,
-228, 99, 14, 40,132, 95, 72, 40,217, 99,202, 23,240,124,121, 32,174,190, 53,134,  5, 10,158,139,188, 42, 20,138, 92,131,193, 16,
- 98, 52, 26,161,209,104,160,209,104,202, 10,  2,145,136,152,248,206, 84,127,145, 88,  2,202,106,193,241,237, 95, 84,201,105, 15,
-225, 48,176,165, 23,  4, 34,137, 54,161, 97,195, 85, 66,161, 16, 36, 73,226,240,218,143,223,219,191,252, 93, 47,  0,184,113,100,
-173,102, 84,236,154,213, 36, 73,194,108, 54, 75,171,147,238, 71,143, 30,133,153,205,102,147, 77,160,217,133, 31, 30, 60,120, 80,
-215,108, 54, 27, 29,183,187,  3,185,194, 11, 80, 53,  0, 20,129,229,172,103,169,169,169,117, 40,138, 50,  8,133, 66, 88, 44, 22,
-183, 84, 17, 73,146,226,155, 55,111,134,177, 44,235,242,248, 22, 17,117,128,224,150,128,196,219,237, 60,115,110,116, 68,109, 98,
-235,137, 69,144,230,193,227, 89,177,108, 61,131,207,  4, 81,193,255, 82,161,213,253,200,145, 35,156, 99, 15,145,166, 40,155,200,
-250, 75,244, 48, 12,139, 76,181,  9, 73, 73,119,177,114,229, 74, 92,186,250,145,247,130,  5, 11,164,115,230,204, 49,143, 28, 57,
-114, 57,203,178,173, 72,146,188,129,191,134, 42,202, 90,133, 88,182,238,181,107,215, 26,218,215, 41,138,130,151,151, 23,188,188,
-188,208,180,113, 88, 57,145,197, 48, 12,172,149, 12, 29,218,125,180,  8,142,229, 40,138,  1,195,178,165,226,167, 80, 99, 14, 59,
-116,250,122, 35,135,195, 95,176,255,233,220,174,121,197, 98,112,210,188,210,124,236, 90, 63,119,250,130,205,155,165,133, 76,192,
-180, 81,175,189, 25, 57,124,212, 24,188,254,234, 43,221,204, 22,203, 65,  1,201,177, 84,233,245, 64,130,131,179,143, 22,143, 39,
-132,228, 34, 61, 37,146,202,225, 25, 92, 31,119,117,140, 88, 32, 16,252,114,191,200, 32, 38,  5, 66,144, 66, 49, 18, 10, 77,212,
-115,148,221,132,228,228,228,144,186,117,235, 66,163,209,128,166,105,118,216,176, 97, 25, 66,161, 40, 76, 40, 18, 17,209,163,166,
-178,217,217,153, 20, 73, 10,192,113, 12, 94, 25, 62,137,144,202,228, 98,171,197, 66,163,100,232,208,149, 53,203, 49,132,131, 87,
- 84, 84,148,175,125, 38,224,254,229,239,122, 57,236, 83,190,244,210, 75,190,142,179, 14,221,180, 22, 17, 35, 71,142,148,135,135,
-135, 19,  0,240,235,246,217,118,235, 25, 49,112,224, 64, 89,120,120,137, 31,254,143,107,223,117,155,211, 95,193,  1,197, 15,128,
-226,212,114,150,172,129,  3,  7, 74, 27, 54,108, 88,173,103,209,230,  0, 95, 97,236, 46, 15, 33, 13,100, 95,119,139, 43,166, 13,
-168, 80, 79,  8,151,191, 66, 66,226,233,103,238,240,241,137,159,121,177,197,131,135, 91,112,210, 34,207, 20,186,217,  4, 98,119,
-219,111,169,224, 18,  2,128,205, 68, 71, 56,232, 44, 80,180,181,156,200, 98, 24,  6, 34,194,140,149, 43, 87,226,253,247,223,  7,
-  0,241,244,233,211, 15, 44, 88,176, 96, 40,203,178,173, 56,142,235, 66, 16, 68,101,189,198,179, 33, 33, 33, 57, 28,199,137, 72,
-146,236,178,118,237, 90,223,254,253,251,195,203,203, 11, 28,203,149, 19, 89, 12,195,194,106,181, 84,248,153, 91, 31,165,124,193,
- 15,123,166,249,244, 28,188,180, 23,195,178,167,236, 34,139,101, 24,128, 45, 57, 41, 63, 55,  3, 39,143, 31,196,134,245, 27, 10,
- 65,112,183,193,129,181,137, 65, 84, 32,  6, 91, 93,252, 53,177, 75,231,118,205,177, 96,243,102,233,173,107, 89,  7,166,126, 48,
- 43,114,248,168, 49,216,243,221,118,144,116,209,117, 71,145,197, 80, 44,138, 11,243,  6,254,196,251,104, 61, 45,248,158, 60,117,
-138, 24, 51,102, 12,171,213,106, 33,150, 72, 88,138,162,  4,255,254,247,191,153,247,223,127,159,204,206,206,134, 70,171, 19,  2,
-240,197,115, 96,214,210,104, 52,219, 39, 77,154,212,237,252,249,243, 98,146, 36,161,209,104,208,163, 71,143, 60, 53, 27, 42,155,
-248,206, 84,255,204,204, 12, 90, 41, 23,154,197, 98, 17,114,115,115,217,110,253, 71, 27, 71,141,127,191,206,251,179,227, 54,102,
- 93, 94,191,206,157,107, 56,206,  4,116,222,183,105,211, 38, 75,104,104,168, 73, 42,149, 74,198,141, 27,231,214,248,161,197, 98,
-225, 22, 47, 94,108,118,158, 93,104,177, 88,184,149, 43, 87, 90,194,194,194,204,114,185,156,163,168,170,253, 62, 73,146,160,223,
- 90,176,131,166,105,186,140, 21,203, 46,178, 40,150,208,125,245,213, 87,214,176,176, 48,139, 66,161,224,164, 82,169,216,157,116,
- 78,157, 58,149,243,241,241,177,122,120,120,136, 99, 99, 99, 31,107,214, 33,197, 64,184, 96,109,105,120,  7,169,151,151, 23,180,
- 90,109,105, 90, 67, 66, 66,120,177,197,131,135, 11,148,211, 34,207,166, 21,206,189, 56, 90, 44,160,203,201,205, 11,244, 15,170,
- 15,154,166,109, 11,  5,154,162, 48,237,237, 81, 88,190,254, 43,  0,176,139,173,168,233,211,167, 31,  0, 80,101, 99,182,107,215,
-174,249,211,167, 79, 87,230,228,228,156,216,186,117,171,239,232,209,163, 49, 99,198, 12, 44, 93,186, 20, 34,137, 12,190,  1,117,
- 75,175, 99,191,110,158,186,  0, 28, 56, 93,  5,118, 58,107, 73, 35,  5,161, 95, 64, 61, 80, 12,  5,150,162, 64, 81, 20,  8, 65,
- 73,214, 78, 30, 63,136,209,111, 76,133, 72,170,244, 89,179,114,137, 49,242,229,144,161,115, 38, 76, 48,187, 97,  4, 36,111, 93,
-203, 58, 48,245,253,216, 40,187,200,218,183,125,253,237, 47,103, 14,222, 41,149,  8, 75,175, 67,177, 44, 72, 82,192,251,104, 61,
- 37,145, 37,149, 74,247, 30, 59,118,236, 94,219,182,109,  9,189, 94, 15,138,162,144,151,151,135,  3,  7, 14, 36,112, 28,  7, 31,
- 31, 31, 28, 59,118,140, 29, 61,122,244, 94,179,217,252,218,179, 46,182,178,179,179,239,200,229,242, 93,179,102,205, 26, 53,115,
-230, 76, 17,203,178, 72, 74, 74,  2,  8,130, 19,137, 37, 32, 73, 18, 34,145, 16,197,197, 26, 86,225,169,202,178,114,  2,133, 72,
- 44,  1, 41, 16, 87, 54, 77,248,161, 45, 24, 41, 72,161, 88,107,159,  9, 40, 22,139,113,117,207, 50, 77,247,113,243,149,  0, 32,
-150,202, 11,251,244,233,147,214,188,121,115,253,111,191,253, 86, 15,229,103, 29, 58, 63,159,244,144,113,177,  2,133, 92,166,143,
-138,138,122,104,231, 76, 61,181, 70, 51,102,242,108,130, 16, 72,244,209,209,209,105,145,145,145,122,129, 64,128,196,131, 75, 52,
- 67,198,197,202,136, 74,130,172,158,184,199,189,117, 99,207,133,166, 95,124,241,  5,213,191,127,255, 71,118,127,177,212,212,212,
- 58,  3,  6, 12,144,174, 88,177,130, 26, 48, 96, 64,250,139,255,207,222,117,199, 53,113,254,225,231, 46,155,189, 71, 16, 68, 69,
- 81, 20,112,139, 11,197, 58,107, 29,173,226,194,189, 71,157,173,179, 14,220, 74,221,168,117,214, 90,220, 84,171,162,214, 81, 23,
- 42, 46, 16,  7, 67, 69,  1, 25, 97, 67,128,144,157,187,223, 31, 36, 52, 32, 35, 65, 91,107,127,121, 62,159,124,146,220,189,247,
-220,123,251,185,239,251, 29, 94, 94,197, 36, 73, 34, 50, 50,210,185, 58, 75,149,  6, 70, 70, 70,138,  9, 19, 38,188,123,254,252,
-121,109,163, 14,171,133,139,139, 11, 40,138, 66,183,110,221, 32,145, 72, 12,150, 45,  3, 12,248,111,162, 98, 30,173,170, 51,195,
- 43,148,138,111,167,204, 94,185, 19, 32, 76,181,238,  2,127, 25,150,104, 16,223,127,255,157,  9,  0, 35,141,216,154, 59,119,110,
-141,101, 78,180, 68, 86,155,128,128,  0, 44, 94,188, 24,155, 55,111, 86,253,248,227,143,140,248, 87,137,242,177,211, 87, 20, 84,
- 88, 15,104,208,197,148,130,250,182, 50,190,124,161,104,133,239, 87, 27, 86,166,101,150,220, 25, 59,109,105,217,221, 75,  5,160,
-144,224,171,  0, 96,207, 79, 63,137, 88, 92,115,147, 33,195, 71,  1, 64,207,157,219,130,206,172,193,129,154,197, 22, 77,120,124,
- 59,119,129,149, 70,100,237,218,186,246,185,  5,145, 25, 60,243,187, 24,133,246,122,  0,192,218, 12,103,124,191,218,208, 59, 43,
- 79,180,221,112,158,253,115,224,112, 56,171,175, 95,191,110,226,237,237, 77,228,230,230, 66,165, 42, 61, 34,114,185, 28, 66,161,
- 16, 69, 69, 69,144, 74,165,104,221,186, 53,185, 99,199, 14,147,153, 51,103,174,150,201,100,211, 63,247,237,126,251,246,237,174,
-115,231,206,225,214,173, 91,195, 22, 45, 90,196,114,116,116, 36, 44, 44, 50,  9,133, 92,  6,128,166,179,179,179, 41, 99, 83, 75,
-129,173,131,243,187,244,140, 44, 15,133, 92,  6, 74, 37,175,210,219, 92,157,222,225,251, 23, 47, 94,212,219,180,105,147, 76, 59,
- 18,112,248,130,157, 59, 90,183,110,109, 29, 28, 28, 44,235,215,175, 95,178,198,121, 93, 23,103,248, 43,111, 48,251,197,139,103,
-205, 42,114,250, 77,222,116, 80,195,169, 29,141,216,255,187,189,  7, 27, 53,106,100,237,233,233,153, 92, 29,111,131,  6, 13,196,
-124, 62, 95,214,164, 73,147, 98, 22,139, 85,106,201, 82, 40, 74, 26, 52,104, 64, 57, 56, 56,200,154, 54,109, 90,172,175,211,190,
-145,145, 17,173,177,138, 85,  6,125,162, 14, 89, 12, 40,  3,  2,  2,202, 50,195,127,223,168,145, 96,212,168, 81,252,121,243,230,
-225,224,193,131,184,123,247,238,123, 98,191,107,215,174,184,125,251,246, 74,252,135, 18,235, 26, 96,192,255, 25,170,207,163, 85,
- 17,135, 14,133,252,  9, 45,159,166,202,176,102,205, 26,174,218,146,213,115,206,156, 57, 16,139,197, 86,149, 52,235,  1,117,174,
-141,202, 68, 86, 80, 80,208, 49,154,166,157,  1,116, 86,169,168,  7,251, 15, 28,234, 86,213,250,134, 12, 25,242, 30, 39, 77,144,
- 12,146, 36,138, 57, 44,250,201, 79,251, 14, 30, 41,215,190,212,249,189, 49,  8, 60,221,185, 45, 72, 12,160,103, 69,177,133,191,
-202,140,148,113,106, 48,117,218,212, 50,145,181,115, 91,208, 85,207, 54,117,191, 89, 58,113,117,165,226,108,245,138, 41, 38, 36,
- 73,116,172,224,163,245, 30,231, 71,128,129,243, 47,116, 11,  8,  8,104,238,227,227, 67,106,139, 44,153, 76, 86,150,184, 83,227,
- 44,158,150,150,134,174, 93,187,146,205,155, 55,247,122,248,240, 97, 55,252, 85,206,233,115,221,118,213,219,183,111,119, 56, 58,
- 58, 94, 91,190,124,249,168,156,156,156,175,242,243, 11,108,194, 14,173, 70,159, 33,211,136,174,125, 71,136,100, 52,147,151, 42,
-200,108,114,243,226, 81,235, 75, 39,118, 65, 46,147, 77,  1, 16,135,191,210, 59, 84,228, 44,209,164,113,104,210,164,137, 72, 91,
-168,212,173, 91, 87,226,228,228, 36,245,244,244, 44,155, 94, 69, 52,223,123,219,174, 47,167,218,255, 75, 84,211,254,212,136,182,
-138,105, 35,140,141,141,161, 17, 95,250,244, 83, 59,218,178,210, 27,101,205, 81,135,101,156,234,244, 14,229,116, 90, 72, 72, 72,
-143,144,144,144, 54,  0,158,160,180,214,161,  2, 40, 29, 74,212,114,154, 15, 84,127, 12,215,187,129,243,255,149,243,115, 70, 87,
-252,229,155,  5,148,250,106,221,170, 82,104,213,  4,141,227, 59,  0,114,238,220,185,249, 98,177,216,106,212,168, 81,213, 46,147,
-145,145,113,240,240,225,195,229, 68,214,160, 65,131,198,133,134,134, 94,203,202,202,170,213, 86, 89,153, 27,173,185,117,126,161,
- 85,215,126, 27,230,  0,248,177, 10, 67, 30,229,217,134,255,205,206,109, 65,103, 42,136,173, 95,  1, 12,170, 74,149,246,250,114,
- 32,142, 30,218,169,241,237, 50,122,254, 56,237,210,176,168, 85,149, 70, 43, 90,154,114, 87,169,251, 49,207,224,163,245,207,128,
-205,102,251, 45, 90,180,136, 45, 18,137,222, 19, 89, 21,133, 86, 97, 97, 33,158, 62,125,138,177, 99,199,114,163,163,163,253,228,
-114,249,141,255,194, 62,200,200,200,136, 87, 39, 35,157,173, 73,225,192,229, 25,177, 71,140,159,227, 92, 22,117,120, 98, 23,164,
- 18, 49,  0, 48,117, 73,239,192,100, 50,217,209,209,209,174, 26,171,149, 92, 46,231,106,166, 63,126,252,216, 85,147, 91, 75, 34,
-145,232, 28,117,248,119,113, 62,123,246,204, 89, 19, 29,169,137, 46,100, 50,153,236,200,200, 72,103, 13,167, 84, 42,213, 41,234,
-144,195,225,176,163,163,163,157, 85, 42,213, 71,139, 58,212, 22,198, 40,173,179, 88,174,214,162,218,183,140, 32,  8,130, 54, 12,
- 27, 26, 96,192,103,143,138,145,146,213, 23,149,174,  9, 26,199,119, 61, 22, 97,186,184,184,244, 26, 62,124,120, 57,145,229,239,
-239,175, 58,125,250,244, 77, 62,159,159, 73,146,100,188,190,253, 40,243,209,194,123,111,144, 32, 73,242,105,231,182, 77, 65,146,
-228,211,165, 19, 39, 74,215,224, 64, 57,177,117,246,204,201,222,169,249, 49,149, 75, 51,  0, 54,246,117, 16, 48,238, 91,  4,140,
-251,214, 10, 64, 39,160,234,104,197,234,250, 97,192,223,  3,130, 32, 56, 78, 78, 78,207, 37, 18,  9,  8,130,128, 84, 42, 45, 19,
- 88, 69, 69, 69, 16, 10,133,101,255,229,114, 57,178,179,179, 81,183,110, 93, 16,  4,241,159,246,163,147,203,229,202, 69, 43, 55,
- 29,102, 48,217, 74,138,146, 19,114,185,124,188, 62,215,249,162, 69,139, 72, 84,226,123, 53,115,230,204, 74,167,127, 42,206, 37,
- 75,150, 84, 26, 37, 56,115,230,204,106,163,  7,171,194,119,223,125,247,209,162, 14,117,191,125, 25, 96,128,  1,255, 49, 84, 26,
-186, 87, 43,161, 69,146,228,211, 74,162, 11,  9,  0, 52, 73,146, 79, 43,201,114,160,124,247,238,221, 74, 75, 75,203, 41, 34,145,
-232,143, 65,131,  6,205,245,247,247, 87,  1,165, 14,242,181,221,162,124,161,104,133, 95,255,141,243, 10,138,165,193, 21,231, 85,
-180, 60,105,196,214,174,237, 65,187,207,132, 30,247,207, 72, 79,221, 93,213,182, 85, 37,168,170,138, 86, 20, 22,138, 87,250,245,
-223, 56, 39,191, 80,108,240,209,250,135,160, 82,169,174, 24, 25, 25, 17,154, 98,202,218,214,171,194,194, 66,148,148,148, 64, 93,
-146,  6,  0, 80, 92, 92, 12, 11, 11, 11,168, 84, 42,250, 63,182, 43,164,  0,230,171,173, 85,  0, 48, 63,241,230, 14,237,115,251,
-153,246,188,106,172, 89,  2, 93, 10, 68, 87,182, 92,117,243,254,  6,206,204,106, 10, 68, 87,135, 76, 61,249, 50,  1,128,205, 98,
-100, 85, 85, 60,154,205, 98,100, 85,227,183,175,231,123,  3, 65,  3, 88,105,184,178, 13, 48,224,243,125,255,255, 84, 43,238, 97,
-224, 52,112, 26, 56,255, 17, 78,174,250,163,235, 60,195,254, 52,112, 26, 56, 13,156,255, 54,206,202, 48,249, 51, 17, 90,116, 37,
- 31,  0,181,180,104, 25, 96,128,  1,255, 58, 72,107, 57,207,  0,  3, 12, 48,192,128, 15,199,123,197,164,181,103, 84,165, 74,245,
-137, 38,168,141,178,189,102,224, 52,112, 26, 56, 13,156,  6, 78,  3,167,129,243,255,142,179, 38,110,237,229, 39,  3,216,247,153,
-136,173, 79, 18,208, 98, 48,171, 26, 56, 13,156,  6, 78,  3,167,129,211,192,105,224,172, 45, 12, 67,135,  6, 24, 96,128,  1,  6,
- 24, 96,128,  1,255,231,208, 47, 97,169,  1,149,160,238,192,165,160,176, 68,189, 59,131,144,114, 54,240,191,182,137,254,254,254,
- 12,125,218, 39, 38, 90,146, 81,224,111, 54, 55, 97,247, 47, 22, 41, 54, 83, 81, 43,130,107, 58, 17,109, 27,180, 26,109,204, 51,
-158, 46,147,201,234,155,154,153,101,229,229,102,239,201,123,247,108,151, 86, 27,243,  7, 15, 30,240,125,124,124,210,  1, 20,105,
-189, 41, 24, 96,128,  1, 31, 19,150, 77, 93, 64, 16,227,  1,250,175,176, 75,138,142,129, 48,238, 80,185,118, 22, 30,227, 64, 18,
-205,180,166,136, 65, 99, 63, 10, 98, 83,106,120,224, 88, 38, 36, 36,184, 54,108,216, 48, 25, 64, 65,197,181, 87, 50,207,112,157,
- 27,240, 57,163, 43,202, 39, 44, 45,187, 22, 62, 92,104, 53, 26, 84, 31, 74,114, 12,104,140,  4,129,104, 36,134, 14,174, 21,143,
-219, 55,117, 64, 49,219,  1,104,  5,208,173, 76,140,120, 45,197, 50,121, 22, 69,211,163,241,230,228, 19,189,249,234,251, 79, 67,
-213,229, 44, 86, 34, 49,244, 39,189,248, 40,250,135, 71,183, 79,115, 45,141,  9, 52,108, 61,104,  1,202,103,112,174, 45, 56,  0,
-124, 73,146,108,102,108,108,204, 47, 41, 41,201,166, 40, 42,  5,165,227,211,249,181,228, 36,  1, 76, 48, 53, 49,233,227,106,198,
-105,245, 46, 71,152, 86,164, 80,133,163, 52,161,107,254,199, 58,163, 74, 69,150,227,190, 57, 35,124,198,  6,205,234,  1, 75,191,
-141, 11, 74,128,234,132, 22,225,220,184,227,217, 97,195,135,248,205,152, 60,214,180,142,157, 41,  4, 57, 34,155,159, 14,134,108,
- 10,  9, 57,218,111,226,176,158,125,  0, 96,245,234,213, 95,187,184,184,212, 99, 48, 24,137,203,150, 45,251,117,197,138, 21, 52,
- 81,117,165,114,190,250, 28,214,220,240, 77,  0,120,  2,104,  0,224, 45,128, 23, 40,159,101,188, 54,248, 44, 56,235,212,169,227,
- 68, 81,212, 68,  7,  7,135,175, 50, 51, 51, 47,144, 36,121, 32, 45, 45, 45,253, 83,222,117,104,154,222, 75, 16,196,100,154,166,
-247,233,241, 61, 69,159,117,240,120,188, 76,137, 68, 98,175,254,157, 37,145, 72, 28,254,174,237,249, 39,215,245, 15,189,127, 79,
-186,114,231, 69, 31,237, 73,189, 58, 55,171,228,142, 66, 52,187,114, 39,166, 75,249,118,158,170, 42,238,129,  4, 77,211, 88,185,
-114, 37,177,106,213,170,113,110,110,110,141, 72,146,124,185,124,249,242,114,169,111, 42,206,211,186,206, 13, 98,203,128,207, 21,
-250, 21,149,174, 17, 77,253, 77, 32,161,253,  1, 98,108,215,182, 45, 59, 79, 25,221,159,160, 25, 60,140,152,180, 80,169, 55,151,
-235, 88, 46, 24,226, 53,222,205, 26,207, 29,210,191,  7,217,198,179, 30,248,118, 22,  0,201,194,222,139, 73, 54,193, 65,203,118,
-  3,240,169, 69, 47, 87,188,137, 56,102, 47, 40, 80,129, 32,  0,130,  0, 72,  2, 40,150, 80,232,245,245,152, 21,  0,126,210,243,
-174, 68, 90, 26, 19,152,123, 76,  2,  0,140,143,112, 80,234,217,217,217,141,155, 61,123,182,137,167,167,167, 37,143,199,227, 72,
- 36, 18,135,132,132,  4,187,101,203,150,121,138,197,226,243,  0, 30,233,201, 89,183,161,179,211,201,224,185, 19,218, 53,111,224,
- 10,150,172, 24,148, 84,228,242, 42,225,117,135,169,187, 79, 77,138,201,147, 12, 71, 45, 74, 38,228,228,228, 16,  0, 96,107,107,
- 75,151, 23, 89,237,199,110,157,215, 11,115,183, 92, 65,137, 68,118,164, 58, 14,235,122, 45, 70,125,243,205, 64,191,181, 63,204,
- 52, 77,203,149, 35, 58, 81, 12,107, 83, 54, 86,204,159,198,145, 74, 21, 29,118,255, 26, 50,121,231,134,133,251, 85, 42,213, 23,
-  0,218,168, 84,170,199,  0,126, 93,185,114,101, 85, 55,223, 85,  0,150,168, 79,232,163, 12,  6,227,106,183,110,221,234, 79,156,
- 56,145,104,221,186, 53, 34, 35, 35, 27, 28, 59,118,172,199,133, 11, 23, 18, 85, 42,213, 51,  0, 47,161, 46,123,162,  3, 88,  0,
- 26, 51, 24, 12,239,127, 51, 39,159,207, 55,146,201,100, 99,156,157,157, 39,119,236,216,209,187,127,255,254, 68,227,198,141, 17,
- 31, 31,223,250,210,165, 75, 43,194,195,195,159,165,166,166,238,227,112, 56,135,  5,  2,129,248, 31,127,142, 19,196,100,  0, 78,
-106,157,188, 82,135,239,116,148,230,146, 18,232,186, 14,137, 68, 98,175, 41, 97, 67, 16,132,253,223,185, 61,122,174, 43,150, 32,
-  8,107,117, 91, 84,247, 77,146, 36,148, 74,165, 72,165, 82,185,213,192,217, 88,253, 34,165,179,214,  5, 80, 93, 34,104, 35,  0,
-232,213,169, 89, 30,  8,196,148, 89,180,222,127,201,140, 41, 19, 96, 52,154, 93,185, 27, 99, 93,206, 10, 86,241, 45,118,229, 74,
- 98,197,138, 21,  8, 12, 12,236, 15,192,151,162,168,112, 15, 15,143, 29,229, 40, 41,170,108,222,138, 21, 43,182, 87,115,157, 27,
- 96,192,231,  2, 63,232, 83, 84,186,202,247, 31,183,193, 93,160,194, 88, 87, 27,123,255, 89, 19,135, 26,121,122, 52,132,  4,166,
- 72,202, 81,225, 98,216, 37,  0, 56,161,159,213,105,104, 27, 38, 83,114, 56, 40,112,126, 19,223,118,158,120,158,166,192,227, 52,
- 21, 74, 18, 21, 96,144, 10,168, 40, 26,160, 33,169,237, 86,167,230, 43,113,231,165, 12, 36,  1, 48, 72,128, 36,  9, 48,200, 90,
-146, 81,178, 87,171, 15, 69,121,230,100, 82,  0, 37,123,245,129,  7,164,153,187,187,251,168, 85,171, 86, 89,102,100,100,152, 68,
- 70, 70,130,203,229,194,202,202,138,193,231,243,157,182,108,217, 34,158, 53,107,214, 87,114,185, 60,  9, 64,142,142,156, 30,125,
-219,120,223,219, 23,180,218, 66,241,224, 18, 10,142,255,  6,  6, 73,131,109, 98,138,250, 70, 70,184,244, 77, 67,107,255,176,196,
-211, 15, 51, 69, 30,  0,210,106, 34,139,139,139, 99, 72,165,210,225,230,230,230,237, 89, 44,150,  3,207,170, 30,149,206,108,147,
-155, 77, 52,120,155,101, 95,210,101, 94, 15,135, 62,155,231,116,195,220, 45, 87,176,237,216,253, 95, 90, 33, 99,121,117,121,179,
-141,141, 77,167,204,154, 62,209, 52, 53, 71,142, 53,167,115,112,232,118, 33,198,248,154, 97,238,151, 22,  8, 24, 49,204,228,212,
-111,161, 83,  0,236,215, 90, 36,222,195,195,131,136,139,139,171,236,230,107,  5, 96,161, 76, 38, 35,217,108, 54,193,227,241, 70,
-173, 93,187, 86, 62, 98,196,136, 84, 77,  3, 95, 95, 95,248,250,250, 18, 69, 69, 69, 13,110,220,184,209, 32, 36, 36, 68, 25, 17,
- 17, 17, 11,224,108,213, 22, 11,163,119, 18,137,216,133,103,100, 84,242,211,238,221,155,187,116,233, 66,113,185,127,165,159,170,
- 13, 39,  0, 88, 88, 88,236,183,183,183, 39, 22, 47, 94,156,254,177, 56,235,213,171,119,165, 93,187,118,221,122,245,234,197,236,
-212,169, 19,156,156,156,202,230,217,218,218,194,215,215,151, 72, 73, 73,105, 30, 30, 30,190,251,202,149, 43, 59,158, 60,121,114,
- 35, 41, 41,169,215, 63,108,209,218,167, 22, 19,  2, 61,219,127,246, 32,  8,194,116,239,222,189,246,154,154,140, 10,133,  2, 42,
-149,170,236, 91,243,161, 40, 10, 42,149, 10,107,215,174, 85,137, 68, 34, 93,246,145, 72,235,173, 89,243,161, 42,251,230,112, 56,
-182,154,132,189, 53,220,217, 99,248,220,130,166, 38, 38, 38,174,  0,250,194,174,209,194,242, 13, 74,223,159, 69, 34, 81,178, 64,
-106, 25,  3,160, 75, 53,108,150,171, 86,173, 26, 19, 24, 24, 56, 80,203, 74,235, 61,100,200,144,138,101,175,188,213,223, 34,130,
- 32,110,146, 36,121, 30,192, 33,124, 68,171,187,  1,255, 45,208, 52,221, 22,128,157,214, 36, 25, 74, 71,133,160,126, 78, 18,  0,
-108, 42, 76,215,110,167,249,206, 86, 79,183, 83, 47, 71,107,241,102, 19,  4,241,168,150, 93,188,133, 42,252,180,152,  0, 16, 22,
- 22, 70,247,235,215,143,208,124, 87, 46,138,252, 47, 78, 24, 49,160,207, 87,221, 59,130,228, 89,225, 85, 22, 16,241,142,  6,147,
- 84,128,  4,141,  7,119,111,208, 96, 82,135, 43, 44, 85,181,245,164,222,224,239,188, 61, 61, 54, 30,  8,154,205,136,205, 98,226,
- 80,120,  9,228,146, 98,100,103,188, 67, 86,122, 50,  4,169,111,145,246,238,237, 51,128, 88,161, 51,231,123,  7,  6, 80, 81,234,
-119, 64, 10,168, 38,242,178,102, 78,185, 40,174, 65, 99, 79,207,124,142, 10,144,139,226,116, 88,125, 85,156, 94,141, 26, 53, 26,
-241,195, 15, 63, 88,191,120,241,194,168,164,164, 68,122,233,210,165,248,164,164, 36,115, 62,159,159, 55,109,218,180, 70, 78, 78,
- 78,230,131,  6, 13,226, 28, 63,126,252,107,148, 15,107,173,138,211,115, 64,251,150, 17,  7,119,108, 53,201, 61, 21, 12, 89,194,
- 83, 92, 20,136,112, 55,179,132,110, 96,193, 37,190,109,110,  7, 83, 46, 19,171, 59, 57,153,246, 61,147,176, 81, 65, 81,  1,213,
-113,222,187,119,143,111,108,108,188,101,228,200,145,252,153, 51,103,114, 85, 76, 75,102,104, 68,174,197,194,221, 17, 78, 37, 82,
- 57, 99, 68,183,122,152, 55,210, 27,243,182, 93,215,136,172,201,245,235, 23, 80, 81, 81, 85,115, 42,228,242,250,206,246,230,136,
- 78, 18,227,208,237, 66,252,249,131, 19,186,175, 77,199,160, 86, 76,120,212, 53,133, 82,174,104, 60,100,200,144,195,234,183,246,
- 71,  0,190, 30, 50,100, 72, 19,  6,131,113, 29,192,239, 53, 29, 35, 30,175,242,234, 41, 86, 86, 86,232,218,181, 43, 60, 60, 60,
-152, 93,186,116,241,174, 32, 96,202,113,202,229, 50, 62, 69,209, 48, 51, 51, 51,178,177,177,177, 50, 51, 51,203,173,236, 65,165,
- 15, 39,  0, 88, 91, 91, 15,238,218,181, 43,243,216,177, 99, 57,137,137,137, 15, 70,140, 24,241,214,220,220,188,156,245,215,196,
-196,  4,141, 26, 53,194,178,101,203,152,125,250,244,169,145,211,193,193,161,103, 72, 72,  8,  8,130, 40,123,104,191,103, 44,118,
-117,133,163,163, 35,250,246,237,203, 28, 60,120,112,207,164,164,164, 90, 93, 71,122,224, 90, 37, 22,173,149, 21,142, 83,149,195,
-111,149,181,215,225,184,103,105,172, 75,106, 62,124,192,181, 89,237,112, 39,143,199, 43,179, 66, 85,178,174,247, 56, 73,146,196,
-210,165, 75, 65, 16,  4, 88, 44, 22,216,108,118,165,223,126,126,126,250,246, 51,133, 32,  8,146,205,102, 47,100, 50,153, 19,165,
- 82,169, 51,143,199, 75, 87,169, 84,191, 72,165,210,181,  0, 20, 52, 77, 91, 86, 33,178, 42,229, 52, 49, 49,113,125,245,234,149,
-123, 85, 29,145, 74,165,240,246,246,  6,164,136,173,142, 51, 33, 33,193,213,205,205,173, 49,  0, 77,137,182,219, 52, 77,119,209,
-250,175,141,219, 52, 77,127,169,254,253,242,205,155, 55,174, 13, 27, 54,204,255,167,206, 79,  3,231,191,143,179,  6, 45, 98, 71,
- 16, 68,152,113, 48, 25,151,  0,  0, 32,  0, 73, 68, 65, 84,214,181,218, 79,243,127,209,162, 69, 75,214,175, 95,255,130, 32,136,
- 48,237,233,218,237,180,191,213,247,155, 48,154,166,251, 45, 94,188,216,115,195,134, 13,235, 52,109,255, 14,145,168,143, 69,203,
- 60, 91, 98,130,240,119,230, 96, 50, 84, 96,146,  4,152, 12,  0, 52,129,228,164,  4, 20, 21, 22,220, 65,226,233, 68,221, 44, 89,
-254,157, 90,180,240, 10, 58,186,109,  1,249,115,120,  9, 10, 68, 18,196, 61,185,137, 71, 55,127,207, 80, 41, 85,191,131,160, 31,
-  3,100, 36,222, 82,241, 64,104,237,106, 92, 16, 52,179, 84,104,169,197, 85, 57,177,245,201,208,188, 73,147, 38,195,150, 45, 91,
-102, 27, 21, 21,197, 19, 10,133, 69, 71,143, 30, 77,151, 74,165, 73,  0, 46, 39, 39, 39, 55,217,190,125, 59, 39, 40, 40,200,203,
-203,203,139,127,242,228, 73, 89, 37,229,140,222,227,156, 63, 54, 32, 98,226,172, 57,188,216,147,187,192,137,141,196,210,167, 57,
-170, 63,  5, 37, 63,  0,216,134,148,226, 78,217, 18,229,213,173, 93, 93,200,122,102,108, 52,180,228,248,197,229, 73,170,181,100,
- 25, 27, 27,111,  9,  9,  9,113,109,219,182, 45,  9,  0,225, 47,149,220,133,187, 35,156, 46,175,239, 68,116,106,102,131,172,  2,
- 41,102,239,138,198,165,136,172, 63, 52, 34,171,166, 78,154,153,153,101,167,102, 21, 58,216,152,242, 48,186,179, 41,186,175, 77,
-135,127, 27, 46,184,108,  2,241,137, 25,104,232, 86,143,136,190,115,182,141, 90,100,181, 21,  8,  4,  0,208,  6, 64, 98, 74, 74,
- 10,223,199,199, 71,168, 69,151, 15, 96, 35,135,195, 89, 74, 16,  4,221,182,109,219,104, 47, 47,175, 98, 43, 43, 43,136,197, 98,
- 72,165, 82,176,217,108,136,197, 98, 36, 39, 39,227,193,131,  7,176,178,178,210,235, 64, 21, 23, 23,195,204,204, 12, 20, 69,125,
- 48,167, 74,165, 34,246,236,217, 99,242,226,197, 11,147,208,208, 80,135,185,115,231,230, 54,109,218,244,241,176, 97,195, 94,219,
-219,219, 75,159, 62,125,138,123,247,238, 33, 63, 63, 31,237,219,183,215,137, 83, 38,147,129,201,100, 66, 44, 22,131,203,229,130,
-201,100, 66,169, 84,130,162,168, 50,241, 85, 92, 92,140,188,188, 60,176,217,108,200,100,178, 79,241,  6,250,158,133,170,186,225,
-183,218, 88,180,180,133,154,142, 34,171, 38, 75, 84,149,195,157,  5,  5,  5, 70,150,150,150, 11,  1,  8,106, 90, 23, 65, 16, 96,
- 48, 24, 96,179,217, 32,  8,  2, 93,186,116,193,132,  9, 19,208,170, 85, 43, 36, 36, 36,224,248,241,227,120,244,232, 17, 88, 44,
- 86, 89,123,157,199, 39,252,252, 24, 60, 30,239,222,128,  1,  3, 60,127,248,225,  7, 94,189,122,245, 16, 27, 27, 91,119,195,134,
- 13, 11,175, 93,187, 54, 80, 36, 18,181,209,220,237,170,183,210,171,135,  4, 75,135, 11,251, 74,165, 82,196,198,198,234,179,204,
-123,104,216,176, 97, 50, 73,146,175, 41,138, 10,  7,224, 77,211,116, 23,130, 32, 46,161,212, 47, 81, 27, 34,154,166,191, 36,  8,
-162, 16,192, 51,146, 36, 95, 82, 20,149,108,176,219, 24,160,195,125,165, 95,197,255,  4, 65,132,173, 95,191,190, 95,101,226,170,
-146,107,179,220,244, 13, 27, 54,172,211,250,255, 33, 22,213,174, 40,239, 12,239,167,182,114,253, 37,180,194,194,194,170, 87, 32,
- 20,  6,133,157, 62,118,191,187, 28,174,158,173,125,181,172, 67, 52, 34, 31,220,  3, 64,255,162, 83, 87,248,253,140, 72,  6,243,
-151, 61,235,102,146,123,111,150, 32, 37, 61, 11,247, 46,254,130,108, 65,210, 33,128,158,139,196,208,194, 15, 62, 18,245,  6,121,
-217,219,216, 90, 74,228, 52, 40, 26,192,123, 98,235,147,160, 85,227,198,141,  7, 71, 68, 68,216, 74, 36, 18,222,157, 59,119, 74,
- 66, 66, 66, 50,228,114,249, 77,  0,119,213,109,162,178,179,179,135,168,133,  9,131,201,100,114,228,114,121,117,190, 11,173,230,
- 79, 28,115,103,227,158,131,188,215,207,163,177, 61,244, 34, 10, 74, 74, 84, 55,179,196, 95,  3,208, 40,250,235, 81, 57,226, 52,
- 26,180, 11,139, 36,192, 55, 97, 57,198,229, 73,120, 64,229, 67,178, 82,169,116,196,200,145, 35,249, 26,145,  5,  0, 57, 69, 10,
-102,137, 84,193,232,212,204,  6,173,187, 13, 65,228,141, 83, 56,121, 59, 13,110,118,198,183,235,155, 20,232,180, 71,179,179,  4,
-123,182,  6,239,221,186,113,229,124,206,188,190, 22,240,111,195,  2,143, 77,192,220,152,133,181, 59,246, 43,162, 30,220,126,202,
-231,243,195,  0,124, 45, 16,  8,192,231,243,139,  1,188,100, 48, 24,137, 42,149,170, 50,167,238,229,  0, 28, 14, 31, 62, 76, 42,
- 20,138,226,132,132,  4, 56, 58, 58,194,193,193,  1, 22, 22, 22,136,139,139,195,159,127,254,137,248,248,120, 80, 20,133, 22, 45,
- 90,232,117,176,114,115,115,241,244,233, 83,244,237,251,213,220,236,236, 44,115, 43,107, 27,209,157,240,219,155,106,195, 73, 81,
- 20,  1,  0,158,158,158,240,244,244,228,165,165,165, 57,135,133,133,217,175, 89,179,230,157,171,171,235, 81,177, 88, 92,206,114,
-160,171,208,210,136, 11,141,  8,228,241,120, 96,179,217, 40, 44, 44, 68,102,102, 38,138,138, 74,131, 54, 45, 45, 45, 63,137,208,
-170,194, 66,245,209,218,255,205,226,240,189,225, 78, 75, 75,203,145,  0, 22,234,184, 45, 80, 42,149, 96,179,217,240,241,241, 65,
-112,112, 48, 30, 61,122,132,223,127,255, 29,117,235,214,197,216,177, 99, 65,146, 36, 94,188,120,161,111, 23,169,136,136,136,133,
- 95,127,253,181,231,225,195,135,121,201,201,201,136,143,143,135,165,165, 37,130,131,131,185,147, 39, 79,110,120,227,198,141,229,
- 40, 13,126,169, 30, 90,209,133, 34, 35,254, 80,111,111,239,247,154, 56, 58, 58, 90, 92,190,124,217,190, 76,128, 85,140, 72,124,
- 31,  5,203,151, 47,223,234,225,225,177, 77, 61, 92,232, 11,192,132,166,105,191,208,208, 80,  2,  0,252,253,253,105,130, 32, 52,
- 15,164,103,167, 78,157,234, 22, 23, 23, 71,  7,  6,  6, 26,124,180, 12,168, 74,139, 76,214, 92,147, 85,  9, 40,125,132,154,182,
-197, 75,131,197,139, 23,123,174, 95,191,254,225,  7,138, 44,237, 55, 38, 90, 35,182,202, 30,166, 85, 14, 25,150,217,190, 72,190,
-163,189,141,245,162,177,157, 64, 81,128, 82,  5, 40, 85, 52, 68, 37, 98,196, 62,127, 84,  2, 30, 17,170, 83,119,184,156,160, 53,
- 63,204,105, 16,157, 74, 34, 61, 95,142, 91,103,247,210,217,130,164,193, 72, 60, 53,254,227,136,172,161,222,142, 14,246,183,142,
-237, 93, 77, 62,122, 43,131,138, 42,213, 89, 20, 69,151,253,254,  4,112,180,179,179, 11,184,127,255,190, 29,151,203,229,189,122,
-245,138, 58,117,234, 84,190, 92, 46,191,166, 37,178,  0,160, 83,155, 54,109,148,166,166,166, 16,137, 68,114,185, 92, 46,169, 70,
-100, 57,251,181,106,126,123,227,158,131, 60,137, 76,  6,161, 88, 10,134,141,125, 69,145,  5,  0, 29,187,185,215,169, 67,240,204,
- 64,  3, 72, 42,148,167, 87, 37,178,  0,128,203,229,246,152, 57,115,102,185,186,120,182,102, 44,165, 49,151,165,186, 27,147, 67,
- 69,222, 56,133,240, 23, 57, 20,143,205, 80,217,209,111, 27,232,186,  3, 10, 82, 99,246,252,126, 46,236,234,119,203,130,138, 75,
- 68, 69,112,115, 50, 66,113,145, 16,107,215,111, 84, 68, 68,132,223, 92, 56,119,106,135, 83,167, 78,109, 64,169, 51, 56,  0,188,
- 60,117,234,212,152,101,203,150,253,138,191,210, 60, 84, 68,122, 64, 64, 64,106,179,102,205,132, 30, 30, 30,194,220,220, 92,196,
-196,196, 32, 63, 63, 31,219,183,111, 71,108,108, 44, 52, 22, 65,157,124, 85,222, 23, 72,200,207,207, 51,165,105, 26,249,121,185,
- 38, 63,252,240,131, 69,109, 56, 85, 42, 85,185,107,171, 78,157, 58,152, 54,109, 26,187,164,164,196,242,221,187,119,230,218,243,
-116,229,148,201,100,208, 88,134,104,154,134, 76, 38,131, 80, 40,132, 76, 38,195,235,215,175,203, 68,150,122,253,159,204,162,165,
-249,205,227,241, 50, 53,231,178,102,  8,142,199,227,101, 85,213,254, 67,160,181, 46, 90,253, 91, 95,113, 88,227,246,232,120,220,
-193,102,179, 49, 97,194,  4, 60,124,248, 16,  9,  9,  9, 96, 48, 24, 16,137, 68, 40, 41, 41, 65,207,158, 61,193,225,112,244,181,
-104,209,108, 54,123,228,146, 37, 75,120,137,137,137,200,201,201,209, 56,211, 67,165, 82, 97,238,220,185, 70, 92, 46,119,164,190,
-166,123,129, 64,208,251,245,235,215,141, 43,126, 50, 50, 50,132,218, 62,133,181, 69,104,104, 40,225,239,239, 79,251,251,251,211,
- 26,193,101,128,  1,149,161, 10, 45,178,175, 42,139,214,199,176,138,105, 44, 91, 80,  7,136,212,  2, 26,145,213, 85, 75,120, 17,
- 26, 11,151,110, 67,135,110, 67, 91, 58,216, 88,223, 56,188,107,149,105,216,115,  2,169, 41, 73,200, 22, 36,163, 77,  7, 63,196,
- 62,143,  6,165, 80,157,198,235,208,154, 61, 57,235,249,187,123,120, 52,157,222,181,131, 23,130,194,138,241, 42,242, 50, 10,178,
-  5, 59,145,116,234,244, 71, 57, 66,174,254,205, 29,236,173,111,252,186,107,149,229,165, 24, 18, 41, 41, 73, 56,251,235, 86, 90,
- 33,151, 22,160,124, 36,151,222,111,205, 70,148,140, 83, 92,144,  9, 89,145, 10, 60,178,132,167,231, 32, 69,  6,128,240,173, 91,
-183,118,111,223,190, 61, 39, 32, 32, 32, 35, 63, 63,255, 44,128,251, 90,109,154,185,187,187,247, 13, 14, 14,118, 72, 73, 73,193,
-181,107,215, 50, 80, 26,250, 95, 21, 82,111, 71, 63,223,253,231,175,251,231, 27, 53,104,130,237, 75,190, 83,134, 62,138, 25,  0,
-224,146, 86, 27,143, 30,222,238, 97,107,190,159, 65, 82, 81,127,224,105,114, 38,222, 10,165,127, 86, 69,152,147,147, 67,148,148,
-148,184, 90, 90, 90,106,159,144,224,155,136,164, 11,134,186,167,247, 92,120,199, 73, 34, 87,129,203, 34,233,217,  3, 93,211, 31,
-158, 13,181,201,145,228, 16,154,104,196,154, 48,105, 88,143,129,187, 66,206,140, 14, 11,187, 48, 93, 46,149,120, 53,105,210,152,
-126, 28,113,227,233,194,185, 83,251,212,242,136,155, 62,124,248,144,100, 48, 24,229,  4,186,182,133, 72, 95, 75,145, 62,208,149,
-179,162,208,210, 64,169, 84, 18,181,229,148, 74,165,101, 66,171,226,195,189, 50,193,248,119,108,191, 62, 22, 42,237, 33, 67,141,
- 63,157, 68, 34,177, 87,251,108, 57,124, 76,139,214,135, 68, 34, 86, 55,124,169, 79,255, 72,146,  4, 69, 81, 96,179,217,104,209,
-162,  5,194,194,194, 96,109,109, 13,115,115,115,152,155,155,195,200,200,  8, 54, 54, 54,101, 66,139, 36,117,142,210,161,165, 82,
-105,221,186,117,235,226,245,235,215,224,241,120,101, 31, 46,151, 11, 79, 79, 79,136, 68,162, 58,248,148,182,123,  3, 12,248,123,
-239, 43, 97,218, 98,137, 32,136,176, 69,139, 22, 45,169, 45,223,162, 69,139,150, 84,102,225,250, 64,193, 85,206,186,197,212, 86,
-144,149, 42, 73,181,200, 58,180,115,165,249,153, 39, 64,106,106, 34,174,158,220, 81,164,144,203,242, 41, 74,225,250, 54, 62, 26,
- 32,241,139, 78, 93, 32,233,118,  3,251,118, 35,174,190,144,161,176, 32, 27, 47, 31, 95, 78,130,152,179,248,163,137, 44,  7,219,
- 27,135,119,173,180, 60,255,156, 64, 74, 74, 18, 46, 29,219, 94,168,144,203,123, 32, 49,244,241,135, 80,143,100,179,  7,178, 93,
-222,245,155,232,155, 14, 21,161,194,200,216,184, 47,179, 50, 48, 80,112,167,250,200, 48,109,100,103,103,159,221,186,117, 43,241,
-227,143, 63,118,149, 72, 36,191,  1,208, 54, 81,122,185,185,185, 13,223,183,111,159,117, 74, 74, 10,235,206,157, 59,162, 27, 55,
-110,208,  0,206,215, 96,113, 89,208,115,252, 52, 70,171,122,117,102, 70, 37,165, 13,  0,240,135,214,108,207,126,173,155,221, 61,
-184,126,185,153,226,110, 40,138,  5, 41, 88,124, 55,181, 16,128,206,251, 91,161, 80, 64, 40, 20, 66, 81,156,171,108,195, 23,  9,
-  3,135,216, 75, 51,243, 37, 76, 22, 85,162,244, 48,207,146,222,200,125,203, 48, 54, 54,214,107, 95,238, 90, 63, 63,  4, 64,200,
-144, 33, 67, 14, 63,139,184,208,134,207,231, 95,240,240,240, 32,  0,160,138,  8,195,170,176, 10,192,220,142, 29, 59, 18, 62, 62,
- 62, 15,182,109,219,118,165, 58,177, 82, 27,139, 86, 77,208,149,147,162, 40,178,138,253, 75,212,150, 83,219,162, 85,147,208,250,
-148, 22,173,202, 68,139,182, 72,212, 22, 66,255,134,168,195,234,196,148, 62,253,211,248,201,177,217,108, 68, 71, 71,195,197,197,
-  5,114,185, 28,102,102,102, 48, 51, 51,131,169,169, 41,138,138,138,192, 98,177,160,231, 54, 83, 60, 30,239, 93, 76, 76, 76, 99,
- 59, 59, 59,168, 84,170,114, 98,235,213,171, 87, 48, 49, 49, 73,211,215,162,197,231,243, 47,171,163, 14,203,193,209,209,209,226,
- 99,236, 87,109, 75,150,191,191,191, 97,136,208,128,106,173, 89, 85, 88,181,178, 43, 88,162,100, 90,255,179, 81,154,195,173,159,
-250, 55, 42,249, 45,171,100, 90,238,250,245,235,111,104,249,119,101,127,224, 38,104, 82, 60,148,139,112, 97,214,100,201,178,183,
-182,186,113, 96,123,160,249,201, 72, 32, 45, 37, 17,183, 78,  7, 11,149, 42,249, 23,160,104, 65,196,181,211,161, 32, 80,130,183,
-161,183,116,187, 69,160, 85,171,166,174,248,253,133,  2,217,169,175, 64,211,212, 33,100,133,148,124,240,209,113, 27,212,194,222,
-218,246,198,161,224, 64,139, 51,209,  4, 82, 83, 18,113,245,100,112,161, 82, 81,210, 29,137,167, 35,107, 75, 59,  1,176, 98,152,
-240,118, 15,246,107, 53,212,213,205, 25, 20,173,  0,197,166, 49,104,129, 45,243,101, 84,201,239,225, 60,225, 73,170,152,154,158,
-118, 95, 55,  7,186,226,226,226,223,  1, 60, 70,249,244, 10,205, 27, 53,106, 52,116,247,238,221,118,169,169,169,188,168,168, 40,
-241,222,189,123,179, 40,138, 58,  3, 64,151,161,212,239,162,146,210, 14,160,124,190,156,230,243,199,  7, 68,  4,140,155,200, 75,
-188, 22,  2,171,196, 88,124,127, 55, 93,245, 50, 95, 54, 66,109, 93,171, 20,182,182,182,116, 78, 78, 78,114, 65, 65, 65, 99, 19,
- 19, 19,228,230,230, 34, 47, 47, 15, 66,161, 16,210,194, 60,165,141,170, 64, 68, 40,243,192, 98,177,144,149,162,128, 74,165,202,
-208,213,154,  5,192,106,213,170, 85,147, 40,138,210,100, 68, 44, 23, 93,168,213, 78,115, 62, 52, 30, 50,100,200, 97,173,168, 67,
-109,103,120, 77,122,  7, 66,157,222,161,253, 31,127,252, 17,215,167, 79,159,212,202,196, 10,151,203,213,219, 81,186,170, 40,198,
-218,112, 86,101,209,170, 56, 93, 31, 78,205,240,165,198,  9,190,226,116, 13, 24, 12,  6, 40,138,130, 14, 65, 21,127,171,104,209,
-142, 14,172,141,200,169,112,108,170, 77, 28, 90,203, 72,196,143,106,209,210, 28, 11, 54,155,141,115,231,206, 97,220,184,113, 80,
-169, 84, 48, 54, 54,134,169,169, 41, 76, 76, 76,112,250,244,105,104,210, 63,232,163, 95, 21, 10,197,145,245,235,215, 47,217,179,
-103,143, 17, 77,211,224,112, 56,101, 66, 43, 48, 48, 80, 44,151,203,143,232, 36,180, 52, 25,223, 41, 58,198,196, 68, 89,109,212,
- 97,101,203, 84,225,175,101,185,106,213,170, 49, 20, 69, 13, 68,133, 20, 14, 21,218,149, 75,253, 96, 72,239, 96,128, 14,247,147,
- 71,255,226,238,105,  4, 22,161,101,201, 42, 19, 92,100,117,226,197,206,202,242,198,254,237,129,230, 71, 31, 17, 72,124,251, 22,
- 55,127,219, 81, 42,178,222,156,124,130,228,208, 76, 36,134,118,198,219,208,222, 58,191, 61, 17, 68, 43, 39,123, 75,228,137, 40,
- 20,230,188,  3,104, 68,125, 12,145,101,103,101,119,227,231,224, 64,139, 83, 79, 72, 36, 38, 38,226,234,201, 29, 66,165, 82,242,
-197,135,136,172,145,108,246,192, 70,238,206,  9, 75, 39, 13, 28,234,211,208, 17, 54,239,226,112,126,236, 80,172, 62,254, 13,204,
-236, 24,104,215,215, 12, 19,214, 58, 14,229,123,114, 95,243, 59, 99,160, 30,212,218, 34,171, 85,253,250,245,135,222,191,127,223,
-214,219,219,155, 23, 31, 31, 47,217,187,119,111,150, 88, 44,190,  2, 32, 90, 15, 78,109,145,213,106,209,228,177, 17, 27,247, 31,
-230,145,108, 14,130,142,156,199,172,219,169,170, 11,201,133, 67, 80,126, 88,177, 82, 72,165,210,107,193,193,193, 82,146, 36,145,
-151,151,135,156,156, 28,100,101,101,149,125, 23, 20, 20,128,193, 96,224,250,245,235,178,194,194,194,251,186,118,240,222,189,123,
-245,211,210,210, 60,  4,  2, 65, 27,245, 39, 30,165,209,133,166, 90,211,218,  8,  4,130,174,  0, 30,105,166,167,166,166,214,123,
-240,224,  1,191, 38,126, 51, 51, 51,176,217,236,114, 22, 45, 46,151, 11,  7,  7,  7, 40,149, 74,156, 56,113,  2,  0,242,170,227,
- 96,179, 57,  2,146, 36, 64,209,148,148,199,227, 81,124, 62,191, 82,129,165, 15,167, 26,169, 95,126,249,165, 36, 50, 50,178, 82,
-139, 86,109, 56,105,154, 46,233,213,171, 23,210,211,211,193,227,241,202, 30,214, 26, 65, 69,146, 36,184, 92, 46, 50, 50, 50, 48,
-101,202, 20,208, 52, 93,242, 79,223,121,180,125,154,212, 98,136,  0, 64,168,133,208,123,126, 90,186,250, 64,105,134,  6,105,154,
-134, 70,112, 85,152, 95,182, 46, 93,178,183, 87,240,233,154, 92, 80, 80,176,177,180, 59,244,222, 10,223,251,244,120, 40,148,  9,
-173,216,216, 88, 28, 62,124, 24,  5,  5,  5,224,112, 56,200,207,207,199,193,131,  7, 17, 19, 19,  3, 14,135,  3,205,190,208, 85,
-191,249,248,248,108, 12, 15, 15,143, 25, 49, 98,132, 56, 58, 58, 26, 98,177, 24,209,209,209,232,221,187,183,228,238,221,187,  9,
- 98,177,120, 21,116, 25, 58,212,100,124, 87,151,215,145, 74,165,136,138,138,170,244, 83,213, 50, 21,145,144,144,224,170, 82,169,
- 26,211, 52,237, 75,211,180, 57,212, 41, 28,212,255,181, 63, 95,170,231,153,211, 52,237,171, 82,169, 26, 37, 36, 36,184, 26,228,
-132,  1,159, 41,110,105,137, 45, 90, 75,100,221,170,222,162, 69,145,193,  7,118,172, 52, 63,242,144, 68, 74,114,  2, 30, 95,220,
- 45, 84, 81,138, 47,244, 44,135,211,  3, 90,185, 54,120, 70, 38, 94, 20, 81, 26,206, 92,152,147,  2,208,140,218,  8,173,114,156,
-160,200,224,131, 59,  2, 45,142, 61, 38,144,158,242,  6,119,207,238, 18, 42,149,210,238,120, 27, 26, 85, 27,206,145,108,246, 50,
- 22,131, 88,218,171, 83, 75,118,231,150,238, 48,201, 74, 66, 70,106, 58, 78,196,102,231, 37,228, 75, 39,222, 37,228, 72,126, 35,
- 61,208,119,146,181,181,149, 35, 11,253,166,218, 88,223, 63, 95,248, 59,193, 18,201,105, 57,189, 94,112,183,172, 44, 69,249,126,
-190, 15, 71, 51, 51,179, 17,143, 31, 63, 54,231,241,120, 70,143, 31, 63,166,246,238,221,155, 43, 22,139, 47,  2,136,208,105,219,
-223,135,115, 91,119,183, 91,235,118,237,231, 21,139, 74, 32,146,201,193,117,224,171,206, 68, 60, 31,140,170, 19, 96,150,227,228,
-114,185,199,142, 29, 59,214,183, 75,151, 46,174, 94, 94, 94,100, 94, 94, 30,138,139,139,203,156,171,237,236,236, 16, 27, 27, 75,
- 37, 38, 38,166,115,185,220,227,186,246,179, 99,199,142,137, 36, 73,198,171,135,209,226, 81, 33,186, 80,171,105, 99,129, 64,208,
-150,207,231,223,  2, 96,172, 21,117,168,205,169, 73,239,176,  4,  0, 73, 16,196,163,232,232,232,226, 62,125,250,192,200,200,  8,
- 34,145,  8,117,235,214,133, 82,169,196,197,139, 23, 17, 25, 25, 41,162, 40,234, 86, 37,226,181, 92, 63, 37, 18,113, 93,  0,164,
-184,164,164,197,152, 49, 99,186,206,155, 55,175, 92, 72,186,189,189, 61,172,173,173,245,226,  4,128,188,188,188,166,127,252,241,
-199,156,232,232,232,239,250,246,237,107,177,100,201, 18,110,253,250,245,161, 82,169,200,218,114,230,231,231, 91, 68, 69, 69,109,
-234,220,185,243,140, 62,125,250, 48,215,173, 91,  7, 11, 11, 11,168, 84, 42, 24, 25, 25,161,176,176, 16,171, 86,173,194,157, 59,
-119,148, 52, 77,239, 18, 10,133,223,235,121, 46,225, 67,175,205,170, 44, 64, 85,165,100,168,162,253,223,222,207, 10, 62, 93, 80,
-167,112, 88, 88, 69,  6,123,232,122,206,107,132, 22,131,193, 64, 82, 82, 18,246,238,221,251, 94, 30, 45, 77,250,135, 42,184, 43,
-219,118,250,230,205,155, 42,130, 32, 58, 60,126,252,120,225,232,209,163, 39,138, 68, 34,103, 19, 19,147,116,133, 66,241,139, 88,
- 44, 94,139, 82,127, 84,182, 62,247, 16,145, 72,148, 92, 89,212, 97,197, 54,128,101,181,156, 21,210, 59,148, 75,225, 80, 97,153,
-114,169, 31, 42, 73,239,240,183, 31,119,  3,231,191,146,243,115, 23, 91, 85, 39, 44,125, 15,173, 38,179, 88, 98,133,119,120,  2,
-241, 33, 34,235,125,107,137,164, 36, 97,249,177,119, 45,101, 82,  9, 68,194,204,151, 72, 58,145,245, 65,155,165,238,231,237,  4,
-  2, 73,137,111,240, 48,108, 87,105, 63,223,134,214,186,159,  4,176,248,167, 75,161,108,194,194, 26, 79,231,140, 67,122,129,  8,
-151,222,230,159,164, 75,164,211,143,  0,249,184,  3,144, 74,105,248,193, 31, 50,118,251, 14,178, 24,106, 91,135,133, 45,243,127,
-  1,111,145, 13,187, 93,247, 46,250,212, 64,204,224,241,120,225,219,183,111,239,225,235,235,203, 29, 50,100, 72,101, 14,242,250,
- 34,245,209,171, 55, 63, 93,216,179,121,190,141,119,123,236, 92,182, 64,117, 44,226,121,197, 40,196,106,225,225,225,161,186,119,
-239,222,188, 41, 83,166,108,233,209,163,135,211,128,  1,  3, 56,117,235,214,  5,151,203,197,155, 55,111, 16, 30, 30, 46,123,251,
-246,109,122, 73, 73,201,188,230,205,155,235,147,227, 44,127,249,242,229, 27,213,235, 32,212,195,133,109,160,142, 46,212, 52, 82,
- 39, 45,109,  3,192, 56, 48, 48,112, 52,  0, 84, 17,246,189, 28,192, 30,  0, 76,154,166, 51, 66, 66, 66, 58,156, 61,123,182,195,
-220,185,115,217,125,251,246,197,253,251,247,113,245,234, 85,185, 92, 46,143, 80, 11, 87, 93, 75,229, 80,  0,162,148, 74,229,243,
-160,160,160, 14, 12,  6, 99,185,102, 70, 76, 76, 12, 14, 29, 58, 84, 27, 78, 37,128, 77,153,153,153, 63,133,132,132, 44,191,118,
-237,218,248, 49, 99,198,152, 43, 20, 10,196,198,198,226,231,159,127,174, 21,167, 80, 40,156, 99,107,107,187,244,226,197,139,191,
- 92,185,114,229,235, 81,163, 70,145,179,102,205, 66,112,112, 48,126,251,237, 55, 74,165, 82,157,101,177, 88, 99,114,114,114, 68,
-159,226,174,163, 30,134, 75,215,179,214, 97,141,188, 31, 50, 52,168, 35,  4, 31, 74,160,217, 14, 63, 63,191, 50, 43,163,198, 10,
-167,221,134, 32,  8,189,135, 14,  1, 88,210, 52, 77,  1,216,133,210,250,162,218, 89,225, 25,248, 43,115,188,174,140,205,  4, 82,
-203, 24, 72, 17, 91,125, 81,105, 75,128, 70,179, 26,216, 10,150, 47, 95,190,117,197,138, 21, 91, 43,166,112,208,110, 84, 49,245,
-195,202,149, 43, 97, 72,239, 96,192,127, 21,149, 11,173,168,125, 10, 69,131,193, 75,182,175, 91,176, 66,169,144,  9,105,200,253,
-241,230,116,244,135,174,140,166,232, 69,215,143,  6,  6,131, 70, 62,173, 82, 46,252,224,222,255, 77,253, 36, 44,172, 81,180,106,
- 26,126,123,145, 78,103,136, 20,223, 28,145,203,203, 89,131, 74,125,178,168, 97, 55, 36,249, 39,172,156, 88,103,230,124, 97, 67,
- 92,200, 27,173,247,122,178,178,178,206,109,221,186,149,220,188,121,115,215,146,146,146,138, 14,242,181,197,130,254, 51, 23, 49,
-218, 53,114,157,249,240,117,242, 64,232, 48, 92, 88, 17, 29, 59,118, 20,196,197,197,  5, 92,185,114,101,196,237,219,183,123,136,
- 68, 34, 87,130, 32, 96,108,108,156, 44,149, 74,175,113,185,220, 99,122,138, 44,  0,192,138, 21, 43,232,149, 43, 87, 18,113,113,
-113, 52,131,193,248, 19, 64, 34,131,193, 72,210,118,130,215,158,174, 89, 38, 48, 48, 80,151,  7,226,237,226,226,226,200, 85,171,
- 86,117, 89,181,106, 85, 11,181, 85,232, 54,254,242,249,210, 23, 10,  0,183,217,108, 78, 58, 65, 16,206,108, 14, 87,116,239,222,
-189,107, 31,200, 89, 34,151,203, 23,166,164,164,108,217,178,101,203, 90, 19, 19,147,182, 49, 49, 49,127,126,  8,167, 90, 68, 13,
-182,182,182,118, 58,124,248,240,169,131,  7, 15,182,103, 50,153,247,  9,130, 24, 34, 20, 10, 63,105, 81,105,117,129,232,149,122,
-212, 58,212,137,247, 99, 39, 41,253, 59,132,155, 74,165, 42, 94,186,116,105, 86, 69,225, 85,209,122,165,249,175, 78,229,162,203,
- 62,213, 39,138,178,  6,225, 66, 20,  3, 64,105,237,194,210,178, 58,186, 22,149,  6, 32,174,233, 58, 39, 73,242, 44,128,151, 36,
- 73,190,174, 24,232,162, 61,111,229,202,149, 53, 93,231,  6, 24,240, 89, 67,135, 59, 91, 32,  9,  4,214,214,147,246, 31, 52, 87,
-126,156,126,  6,176,217, 43, 73, 96, 62,  0,130,  6,182, 28,145,203,127,168,110, 65,199,142, 88, 75, 19,152,171,222,153,235, 50,
-238, 98, 77, 45,182,189, 14,116,168, 63,168, 39,103, 19, 84, 95, 80,246, 61, 78,127,127,127, 70, 21, 15,243,114, 69,165,171, 66,
-104,104, 89, 22,255,170,250,169,125,190,153, 61,120,240,192,201,199,199, 71,128,242, 78,255,149, 77,167,245,220,118,  6,  0,213,
- 71,222,159,159,  5,167,155,155, 27,231,205,155, 55,178,127,215,181,105,224,252, 87,114, 90, 54,117,  1,129, 73,208,206, 29, 84,
-173, 69, 75, 75,160,209,244,207, 40,136, 77,169,162,159,154,235,220, 50, 33, 33,193,181, 97,195,134,201,  0, 10, 42,244,163,178,
-121,180,225, 24,253,223,115, 86,134,201, 40, 95,138,206,128, 74, 14,132,129,211,192,105,224, 52,112, 26, 56, 13,156,  6, 78,  3,
-103,109,133,214,103, 13, 18,  6, 24, 96,128,  1,  6, 24, 96,128,  1,  6,252, 45, 32,170, 81,165,250,152,  4,107,163,108,175, 25,
- 56, 13,156,  6, 78,  3,167,129,211,192,105,224,252,191,227,172,137, 91,123,249,207,117,232,240, 31,235,183,193,172,106,224, 52,
-112, 26, 56, 13,156,  6, 78,  3,167,129,243, 67,  4,203,103, 13, 38, 12, 48,192,  0,  3, 12, 48,192,128,207,  6, 61,220,193,103,
-170, 64,254,241, 70,167, 32,170, 26,209,199, 13,117,  0,224, 99,241,253,159,130, 15,224, 43,173,255, 23,160,142,140, 55,  8,173,
-207, 23,141,  0, 44,  1,160, 93,139,236, 33,128,245, 21,218, 29,  5,160, 93,144, 80,132,210, 58,129,175,245, 89, 25, 73,146,235,
-187,116,233, 50,253,206,157, 59,155,149, 74,229,170, 90,244,215,149,207,231,111, 36,  8,162, 53,  0, 22, 65, 16,111, 50, 51, 51,
-215, 43,149,202, 15,137, 90,105,224,232,232,184,  1, 64, 75,146, 36, 89,  4, 65, 36,100,102,102,174, 81, 42,149, 55, 63,128,211,
-204,193,193,161, 19, 77,211,142,  0, 24, 44, 22, 43, 55, 45, 45,237,  1,106,153, 91,201, 63, 48,150, 93, 40, 82,178,  0,192,220,
-132,169,  8, 13,108, 42,215,117,154,225, 20, 55,192,128,255,111,208,165,145,201,229,208,219, 13,107,105, 37,190, 87,  1, 68,175,
-250,216,113, 57, 17,223, 87,181, 60, 81, 73, 84,115, 69,206,222,110, 88,171,162, 75, 57,122,185, 97,211,229, 55,168, 54,210, 94,
- 23, 78, 13,246,  1,228,100, 29,170, 20, 16,186, 69, 95,255,219,241, 21,202, 15, 21,150, 13, 29, 86, 43,180,134,185,131,175, 98,
-130, 25, 26, 11, 77, 24,175, 25,128, 22,234,135,252,107,148,230, 42, 42,250,192,206,125, 46,156,255, 54, 44,167,105, 58,160,220,
-201, 90, 73, 30,162, 47,190,248, 98,192,149, 43, 87,140, 53,245,238, 40,138,130,145,145,145, 18,192, 88, 61,214,101, 63,108,216,
-176, 69,  7, 14, 28,192,208,161, 67,151,134,133,133,109,  5, 80,172,235,194, 86, 86, 86,254,150,150,150,193,251,247,239,183,107,
-223,190,  3,193,225,112,240,230, 77,130,243,148, 41, 83,188,226,226,226,206,102,101,101, 77,212,119,227,173,173,173, 71, 90, 90,
- 90,110,217,187,119,175,109,231,206,157, 65, 16,  4, 34, 35, 35,157,231,204,153,211,226,221,187,119,199, 51, 51, 51,103,232,203,
-105, 99, 99,227,110, 97, 97,209,109,231,206,157, 70,157, 58,117,  2,143,199, 67,116,116,180,233,212,169, 83, 29,211,210,210, 98,
- 51, 51, 51,111,233, 43,178,158, 69,158,255, 90, 41,151,  6,  1,  0,147,205, 93,208,126, 75,196,249,103, 55,206,247,175,105,154,
-127, 96,236,239,  6,177,101,128,  1,  6,104, 99,164, 19, 28,105, 26,243,175,252,188,140,  4,128, 94,227, 87,207, 26,233,132,205,
- 71,210,171,174, 97,171, 39,223,247, 99,234, 32,248,112, 26, 50, 63,164,159,251,  0,114, 14,147, 57,171,157,143,143,237,183,119,
-239, 38,200,129, 95,254, 79, 14, 81,165,195,156, 85, 10,173,193, 77,177, 74, 89,106, 49, 33,250, 52,196,241,171,137,140,240, 47,
-190,248,162,225,132,  9, 19,136, 86,173, 90, 33, 50, 50,210,253,248,241,227, 95, 93,184,112, 33, 65,165, 82, 69,  2,120,  1,221,
-179, 90,179,  0,120, 50, 24,140,214,255,114,206,127, 51, 76,212,226, 42, 19,127, 37, 58,125, 47,225,233,245,235,215,207, 49,153,
- 76,141, 69,171,157, 72, 36,114,168, 96,  5,211,  5,245, 20, 10,  5,226,227,227, 65,146, 36, 11, 64,125,188, 95, 82,163, 42, 56,
- 27, 27, 27,239,142,120, 24,105, 67, 48,141,144, 47,  1, 32,145,131, 99,234,128,  3,135, 66,172,231,205,158, 49,248,230,205,155,
-225, 69, 69, 69,191,234,209,159,250, 38, 38, 38, 91,159, 62,125,106, 99,108,108, 12,138,162, 80, 84, 84,  4, 71, 71, 71,236,223,
-191,223,114,222,188,121,  1,133,133,133, 55, 37, 18,201,111,250,136,115, 11, 11,139,110,207,159, 63, 55,210, 20,148,150,201,100,
-112,118,118,198,209,163, 71,185,179,102,205,106, 90, 80, 80,144, 42,147,201,222,234, 74, 88, 40, 82,178,148,114,105,208,225, 93,
-129, 46,  0, 48,102, 70, 96, 16,167,200,252,162, 46,211, 10, 69,202, 11,  0, 12, 66,203,128,127, 26,173,109,109,109, 67,115,114,
-114,110,  1,152,136,143, 99,105,112,231,241,120,205, 41,138,114, 36, 73, 18, 12,  6, 35, 67, 36, 18, 61,  5,240,170,182,132, 54,
-110,126,253,193, 53, 30,  7,154,106, 65,  2, 32, 72, 50, 90, 37, 47, 57,148,251,234,230,249, 15,226,228, 24,141,  7,232, 22, 36,
- 64, 17, 36,249,148, 82,150,236,207,137,191,121,233,223,114,112,238, 11,209,216,205, 81,247,194,152, 31,131,111,120,  3,240, 73,
- 10,228,209, 36,221,135, 21,103,  2,125,103,207,158,237, 56, 99,250,116, 98,220,216,177,141,110,221,185, 67,116,213,167, 90,193,
-231,137, 42, 29,223, 43, 21, 90,254, 77, 97, 69,  3, 11,143,  7, 47, 33,153, 12,  6, 49, 98,246,250,128,131,187, 54,145, 61,251,
- 15, 41, 27, 62,241,245,245,133,175,175, 47, 17, 20, 20,212,232,207, 63,255,108,116,244,232, 81,101, 68, 68,196, 83,  0, 39,170,
- 90, 89,111, 55,136, 41,128,199,102, 49, 69, 35,150,253,186,215,199,199,  7, 92, 46, 23, 31,194,  9,  0, 61, 27,146,111, 89,214,
- 13,158,142,152,185, 60,185,125,251,142,244,199,224,252,140,240, 16, 40, 43,106,109,229,226,226,210, 73,169, 84,242,  0,128,201,
-100, 74, 82, 82, 82,102,162,180, 54, 32,  0,156,165, 40,106,128, 30,220, 36,128, 21,  3,  6, 12, 88,250,237,183,223,162,110,221,
-186,152, 53,107, 22, 20, 10, 69,228,165, 75,151,150,  3,216,128, 26, 46, 30,123,123,251,229,187,119,239,182,102,114, 76,208,106,
- 97, 34,  4,  5, 74,  0,128, 41, 23, 56, 55,141,198,172, 89,179,204, 31, 63,126,188, 70, 31,161,101,111,111,191,106,255,254,253,
-214,198,198,198,160,105,186,172, 22, 99,113,113, 49,138,139,139, 49, 99,198, 12,243,216,216,216,141,250,  8, 45,  7,  7,135, 78,
- 59,119,238, 52,226,241,120, 40, 46, 46,102,203,229,114,162,168,168,  8, 37, 37, 37,180, 76, 38,147,207,156, 57,147,251,226,197,
- 11, 63,129, 64,240, 22,  6,252, 91,192,  0,240, 13,139,197, 26,212,176, 97,195, 54,175, 95,191,126,162, 84, 42, 79,  3, 56,253,
- 17, 94,166,186, 59, 57, 57,173, 77, 79, 79,223,  9, 32,228,255,101,135, 58, 56, 56,156,190,119,239,158,203,238,221,187,199,110,
-222,188,249, 34,128,223, 62,128,142,205,102,179,  7,119,237,218,213,101,204,152, 49, 28,  7,  7,  7, 72,165, 82, 36, 38, 38,154,
-159, 60,121,210, 53, 58, 58, 58, 85, 93, 17, 67,231, 23, 10, 27,247,142,166, 96,154, 31,239,208,177, 83,231,161,131,191, 49,115,
-176,177,128, 88,166,194,235,100, 65,221, 63, 46,158,235, 26,199, 54,186, 39,151, 11,135,231,190,186, 87,172, 47,103,183,110,221,
- 59,247,232,222,221,204,194,210,  2, 66,145, 28,111,146,210, 92,111, 92, 61,239,203,100, 26,221,166,  8,197,168,172,231, 87, 75,
- 62,229,177,153,  5, 48, 69, 60,155,230, 45, 58,182,122,220,107,194,154, 54, 52, 77,131,164,177,163,162, 53,107, 22,192,220, 81,
- 90,246, 75, 47, 62,208, 52, 77, 16,216,164,109,205,234,237,134,181, 52,141,239, 65,130,232, 93,195, 48,165,  6,189,  0,174,165,
-181,181,207,212,201,147,137,162,194, 66, 68, 71, 71,151, 84, 20, 89, 91,235,128,125,155, 68,189,179, 41,181, 23,219,255, 82,107,
- 86,165, 67,135, 58,231,209, 50, 54, 54,174,116,186,133,133,  5,186,117,235,134,245,235,215, 51,  1,180,174, 48,187,124,145, 85,
-128, 27,182,103, 49, 44, 76,184,100,221,186,117,205,204,205,205, 63,152, 19,  0, 64, 83,245, 59,214,165,191,124,244,235,146,177,
-215,142,110,241, 20, 21, 21,176, 42, 54, 49, 53, 53, 69,227,198,141,177,116,233, 82,221, 56, 63, 28,255, 40,167,163,163, 99, 19,
- 95, 95,223,214,215,111,221,178, 76, 79, 79,231,166,167,167,115,175, 92,191,110,217,161, 67,135,214,142,142,142, 77,202,118, 21,
- 77,235,211,207,213,187,118,237, 90,126,246,236, 89,210,215,215, 23, 86, 86, 86,232,214,173, 27, 46, 94,188,200,220,188,121,243,
- 58,  0, 75,107,234, 39, 73,146,157,125,125,125,  9,208, 52, 50,132, 74, 60, 88,223,  4,209,155, 60, 80, 36,161,145, 39, 44,132,
- 88, 44,129,177,177, 49, 15,165,195,189,186,110,123,199, 14, 29, 58, 16,  0,202,196, 85, 81, 81,233,167,184, 88,  4,153, 76, 14,
- 46,151,107,  6,128,167, 43, 39, 77,211,142,157, 58,117,  2,  0,200,229,242,178, 55,188,130,130,  2, 66, 40, 20, 66, 38,147,129,
-197, 98,177, 81,179, 95, 99, 25,167,185,  9, 83,193,100,115, 23,140,153, 17,152, 50,102, 70, 96, 10,147,205, 93, 32, 51, 43, 84,
-233, 50,205,220,132,169,248,196,231,167, 29, 73,146, 63,187,185,185,197,146, 36,121, 24,128,227,  7,114,182,  5,176,206,200,200,
-232,154,135,135, 71,138,177,177,241,117,181, 80,239, 80, 75, 78,142,177,177,241,245,117,235,214,157,122,242,228,201,208, 63,255,
-252,179,254,179,103,207,  6,  7,  5,  5, 29, 55, 53, 53, 13, 71,121,191, 68,189,175,205,250,245,235, 31,124,240,224, 65,219,142,
- 29, 59, 30,  0,192,253, 72,215, 59,  3, 64, 75,232, 84,145,227,147, 28,119,167, 86,173, 90,185,240,120, 60,244,232,209,  3,  0,
-252, 62,132,147,205,102, 15, 94,186,116,169,219,178,101,203, 56,  2,129,  0,215,175, 95,199,195,135, 15,161, 84, 42, 49,109,218,
- 52,238,152, 49, 99, 26,152,153,153, 13,214,171,159, 76,243,227,179,231,204,237, 51,127,214, 36,179,167,239,228, 56,116,237, 29,
-126,143, 16, 32,171,132,131,254,131,199, 88,244, 30, 56,172, 55,135,107,113, 92, 95,206, 69, 11, 23,246,153, 60, 62,192, 44, 70,
- 64,225,220,253, 12,220,143, 23, 66,201,178, 68,223,193, 19,173, 90,116,234,243, 21, 19,172, 95, 62,245, 49,218, 15,180,159, 61,
-123,182,221,130, 77, 71,238, 58,181,253,102, 71,118, 62,124,181,133,143, 59, 96,105,109, 98,242, 77,124,215,174,147,140, 74,235,
-197, 86,203, 89,142,175,245,192,224,172,124,116,209,246,207,234, 98,141, 70,234, 97, 69,198,149,159,151,145, 52,129, 89, 35,157,
-202,221,  7, 42,237,231, 77, 96,232,236,185,115, 89, 22, 86, 86,216,181,107, 23,164, 34, 81, 57,159,217,238, 46,232,115,205,152,
-153,218,192,195, 57,182,155, 43, 17,254, 31,124, 95,153, 92,165, 69, 43, 44, 44,140,238,215,175, 31,  1,  0,161,177,200, 31,220,
- 20, 27,135,125,187,110, 41, 65, 18,116, 61,207,142, 49,117,220,154,137,108,108,108, 80, 82, 82,  2,169, 84, 10, 54,155, 13,137,
- 68,130,119,239,222,225,254,253,251,176,178,178,210,171, 39,133,133,133, 48, 53, 53,133,169,169,233, 71,225, 92, 60,182,  7,247,
- 77, 74, 54,247,242,253,155, 93,183, 79,255,173,189, 91, 75,191,103,221,135,205,122,110,110,231, 36,121,246,236, 25,238,221,187,
-135,252,252,124,248,248,248,252, 87, 14,230, 67,181, 79,214, 67,  0, 86, 13, 27, 54,116,190,124,237,182, 85,177,132, 50, 79,202,
- 84,176, 40,138,130,177, 49, 95,121, 34,244,156,112,232,224,254, 68, 70, 70, 70, 22,128,135,106,113, 91, 83, 77, 69, 30,128, 38,
-254,254,254,139,166, 79,159,142,132,132,  4, 76,154, 52, 73,252,240,225,195,220,142, 29, 59,218,236,223,191,223,104,222,188,121,
-184,117,235,214,138,176,176,176, 51,  0, 18,  1, 84, 90,171,141,166,105, 54,155,205,134, 82, 45, 27,228, 42,170, 76,223, 23, 22,
- 22,130, 22,231,131,205,102, 51,  0,216, 65, 71, 63, 58,138,162,216, 44, 22,171, 76,100,189,203, 44,196,187,172, 18, 20, 22,203,
- 32, 22, 43, 33, 19,211, 96, 24,219, 48,129, 36,  7,  0, 73, 80,170, 87,  0,  0,  0, 32,  0, 73, 68, 65, 84,186, 90, 71,120, 60,
- 30,148, 74, 37,138,138, 74,187,161,177,148,201,100, 50,  8,133, 66, 48, 24, 12, 83,  0,230,  0,242,116, 33, 84, 59,185,255,174,
- 30,  6,196,163, 35,  3,108, 95, 95, 88, 92,110,154,185,  9, 83, 17, 58,175, 41,195,198,185,197,157,150, 67,127,241, 40,155,246,
-105,253,179,184,118,118,118, 55, 78,157, 58,213,180, 81,163, 70, 72, 76, 76,244, 24, 50,100,136,143, 64, 32,104,  9,253,107, 50,
- 26,147, 36,185,113,204,152, 49,211, 71,140, 24, 65,184,187,187,131,201,100, 66,169, 84, 58, 39, 36, 36,116, 59,121,242,228,194,
-131,  7, 15,238, 87,169, 84,223, 65,119,191, 63,146,195,225,156,216,187,119,111, 23, 31, 31, 31, 28, 62,124, 24, 15, 31, 62,164,
-218,182,109, 75,142, 30, 61, 26,174,174,174, 62,163, 71,143,254, 93, 42,149,246,173,165,101,203,181, 67,135, 14, 46, 12,  6,  3,
- 29, 59,118,100,223,187,119,175, 21,128,123, 31,184, 79, 77,157,157,157,111,249,249,249,181,188,118,237, 90, 84, 70, 70,134,159,
- 30,219, 11,  0,  3,157,156,156,130, 44, 44, 44,172,244,184,199,150,164,165,165,125, 15, 32, 84,199, 69,218,183,110,221, 26,201,
-201,201,104,210,164,  9,216,108,118,  7,185, 92, 62,  5, 64, 31,  0, 63,  0,136,213,163,191,238,221,187,119,119,241,243,243, 35,
- 66, 67, 67,203,252, 67, 73,146,132, 82,169,  4,155,205, 70,251,246,237,201,200,200,200, 58,143, 30, 61,114,135, 14,195,136, 54,
-110,126,253, 59,118,238,218,185,139, 79,115,114,115,232,107,168, 40, 21, 24,132, 18, 76,130,  2,165,224,130,203,102,192,221,179,
- 13, 35,254,197, 83, 31,153, 84,222, 63,247,213,181,243,186,112,246,233,213,211,183,105, 19,119,114,251,239,111, 80,144, 22,171,
- 74,139,187,157, 67, 50, 72, 52,109,253,133,173,123,179,150,140,150, 62,126,172,244,196, 23,221, 36,146, 46, 61,242, 19,110, 95,
-251, 20, 23,228, 74,128,225, 92,199,246,155,126, 61,253,216,130,244,116,209,201,208,243,207, 75, 20,184, 15,  0,183,  0,162, 47,
-208,220,187, 93,187,174,251, 55,108,176,225,243,249,172, 81, 35, 70, 40,247, 69, 69, 69,161,138,161,223,149,  0,195,214,209,177,
-199,212,169, 83, 25,130,244,116,250,228,233, 11,207, 52,124, 40,125, 75,241,110,238,236,209, 15,162,120,189,134, 41,251,  3, 28,
-  7, 71,199,166, 83,166, 76, 65, 70,122, 58, 14,135,132, 20, 75,128,  8,141, 21,235, 28,  3, 59,155,185, 57,142, 91, 48,113,  0,
-225,194,183,197,212, 21,251, 58,116,147,103,185, 65,240,215,241,215,214, 34,159,177,200,154, 92,169,208,170,136,223, 98,177,220,
-140,141,250, 39, 79, 30, 35,179,139,228,162,132,132,  4,216,218,218,130,207,231,195,194,194,  2, 49, 49, 49,184,126,253, 58, 94,
-190,124,  9,138,162,208,162, 69, 11,189,122,147,147,147,131,167, 79,159,194,202,202,234,163,113,186,185,216,225, 91, 23, 59,118,
-102,110, 33,251,218,195,151, 62,251, 22, 15,110, 70,122, 12, 62,168, 93, 36, 86, 38,147,225, 63,130,178,232, 66, 23, 23,151, 78,
-135, 14, 29, 98, 75,149, 48,115,159, 18,241,163, 72,162, 50,  1,  0, 19, 30, 67, 20, 25,212,248,187,213,171, 87,139,198,143, 31,
-239,145,146,146,178, 94,  7, 91,255,218,238,221,187,207,167,105,154, 53,123,246,108,  0,192,152, 49, 99, 10,239,223,191,239, 14,
- 32,235,250,245,235, 78, 19, 38, 76,120,117,227,198, 13,227,185,115,231, 50,148, 74,101, 12,147,201,164,195,194,194, 86,  1,  8,
-124,239,137, 72,146,143,163,162,162,234, 57,185, 54,134,171, 13,  9,223,165, 47, 75,111,112,198, 20, 82,147,222, 32,238,217, 67,
- 56, 58, 58, 90,240,249,252,216,212,212, 84,121, 90, 90,218, 66,145, 72,180,187,134, 62, 70, 71, 70, 70,242, 93, 93, 93, 81, 92,
- 92,140,212,236, 18,204, 58,109,140, 66,113,169, 17,131,  5, 49, 90,186, 52, 54, 51, 34,101, 15,179,178,178,228, 50,153,108,153,
- 80, 40, 60, 84, 29, 39,139,197,202,125,246,236,153,105,221,186,117, 33,145, 72,232,188,188, 60, 66, 36, 18,161,168,168,136,184,
-112,225,194,215,  2,129,160,109,253,250,245,  9,103,103,231, 85,  2,129, 64,156,150,150, 54, 73,151,161, 73,181, 96, 82, 49,153,
-204,205,147, 39, 79, 30,122,230,204,153,199,161,129, 77,  7,106, 13,151, 88,120,122,122, 94,110,222,188,153, 83,200, 38,239, 29,
-  0,126,252, 23,156, 91,227,150, 44, 89,210,212,218,218, 26, 83,167, 78,197,202,149, 43,177,124,249,242, 70, 83,167, 78,157, 12,
- 96,171, 30, 60, 70,142,142,142,143,182,111,223,238,209,169, 83, 39, 92,188,120, 17,199,142, 29,195,219,183,111,149,245,235,215,
-103,250,248,248, 96,197,138, 21,232,221,187,247,164,153, 51,103,118, 77, 79, 79,111,165,163,248, 24,191, 98,197,138,129,157, 59,
-119,198,216,177, 99,165, 55,111,222, 28, 10,224,202,213,171, 87,191,184,117,235, 86,232,145, 35, 71,140,214,173, 91,215, 99,222,
-188,121, 83,  1,  4,215, 98,251,191,238,210,165,180,134,114,231,206,157, 17, 20, 20,212,251,  3,133, 22,199,198,198,230,194,225,
-195,135, 91, 54,110,220, 24,163, 70,141,106, 53,116,232,208, 11,249,249,249, 61,  1,232,116, 67,170, 83,167,206,198,179,103,207,
- 54,172,106,100,161, 50, 72,165, 82,235,111,190,249,102, 67, 82, 82,146, 94, 66,235,232,209,163,248,254,251,239,209,162, 69,139,
-230,237,219,183,223, 51,101,202, 20,248,251,251,119,143,137,137,113, 64,105,212,114,141,224,241,120,205,135, 15, 31,206,121,240,
-224,  1,  0,192,211,211, 19, 45, 91,182, 68,114,114, 50, 30, 63,126, 12,169, 84, 10,  7,  7,  7, 12, 26, 52,136,151,148,148,212,
- 60, 39, 39,167, 70,161, 69,114,141,199, 13,236,215,215,236,220,125,  1, 84,148, 18,109, 26,154,195,199,195, 30,241,169,133,136,
-140, 77,133, 74,198,134,185,181, 13, 58,116,237,101,157,145,246,118, 92, 46, 80,179,191, 22,215,120,220,160,129, 95,153,158,139,
- 72, 71, 65,122, 28,253,250,225,153,235, 10,137,104, 18,  0, 60,254,243,248, 30, 71, 27,163,158,238,173,219, 48,252,122, 14,176,
- 58,125, 44, 99, 92,254, 63, 83,219,239, 61,220,114,193, 94, 87, 86,206,152,  5,  1,190, 52,203,202,249,161,153, 66,177, 83, 51,
-175, 55,208,107,225,146, 37,237, 39, 78,158,204,163, 40, 10, 71,126,253,181,240,105, 84, 84,252,100,128,154, 82,  5,223, 78,192,
-117,232,192,129, 92, 51,115,115,204,153, 53, 11,102, 10,197,141,178, 93,  2,116,159, 51,127,126,167, 25, 51,102, 24,237, 89, 53,
-253,113,239,  9,107, 90, 83, 52, 77,104,134, 41,143, 86,111,138,107, 59, 97,224, 64,152,153,155, 99,246,236,217, 32,228,242,203,
-101,  2,138,137, 27,227,191,246,245,  9,232,223, 25,  4,  8, 28, 11,187,131,215,201,217,207,110,  8,240,230,115, 85, 85, 21, 80,
-165,143, 86,181, 67,135, 69,114,100,118,255,106,176,192,221,221,189,168, 81,163, 70, 69,185,185,185,120,254,252, 57,242,243,243,
- 17, 28, 28,140,184,184, 56, 80, 20, 85,107,  1, 67, 81, 20, 62, 54, 39,  0, 56,216,152, 99, 84,223,118, 76,169, 68,196,203,206,
-206, 46, 55,124,244, 31, 18, 90,101, 80, 42,149,188,250,245,235,131,  4,  8, 97,137,194, 52,227,104, 23, 34,227,104, 23, 66, 88,
-162, 48,149,201,100,164,169,169, 41,164, 82, 41, 79,  7, 42,214,151, 95,126, 57,255,204,153, 51,172,181,107,215,194,203,203, 11,
-114,185, 28,247,239,223, 79,  5,144,165,110,147,126,251,246,237,116,141, 16, 94,191,126, 61, 78,159, 62, 77,244,232,209, 99, 97,
-101,231,147, 64, 32,216, 56,101,202,148,188,146,162, 60,236, 29, 38, 70,232,168,108,252, 60,240, 45, 70,216,156, 66, 94,230, 59,
-236,219,183, 15, 87,175, 94, 35,174, 92,185,202,190,121,243,166,201, 87, 95,125,181,163, 78,157, 58, 97,213,117, 50, 61, 61,125,
-237,140, 25, 51, 10,138,138,138, 80, 84, 84,  4,177, 88,130, 60, 17,240,108, 75, 83, 60,219,210, 20, 18,202,  8,187,118,238, 38,
-159, 61,123,102,251,246,237, 91,167,254,253,251,111,225,243,249,  7,171,227, 76, 75, 75,123,240,237,183,223, 74, 10, 11, 11, 33,
-147,201,228, 42,149, 74, 38, 22,139, 21,199,143, 31,159,107, 99, 99,211,225,226,197,139,172,171, 87,175, 49,111,222,188,197,190,
-126,253,186, 69,183,110,221, 78, 56, 56, 56,252,162,139,165,140,193, 96,108, 11,  9,  9, 25,183,107,215, 46,  7, 31, 31,159,102,
- 21,134,162,248, 61,123,246,172,247,235,175,191,214,  9, 10, 10, 90,136,210,  0,148, 79, 10, 91, 91,219,153,  3,  7, 14,196,174,
- 93,187,112,254,252,249,121, 59,118,236,192,151, 95,126,  9, 39, 39,167,111,161,251,176, 23,  0,252,184,117,235, 86, 15, 15, 15,
- 15,140, 25, 51, 70, 54,105,210,164,239, 14, 29, 58, 84, 63, 60, 60,156,253,203, 47,191,212,155, 58,117,234,236,128,128,  0, 73,
-131,  6, 13, 16, 28, 28,220,144, 36,201,109, 58, 93,223, 14, 14,115, 71,140, 24,129, 77,155, 54,225,230,205,155,131, 81,250, 64,
-149,  1,184,116,247,238,221,254,235,214,173,195,224,193,131,225,236,236, 60,187, 54,150,167,166, 77,155, 46,235,211,167, 15,194,
-195,195,209,170, 85, 43,116,232,208, 97, 30,  0,219, 90,238, 78,210,212,212,244,196,161, 67,135,124,235,213,171,135, 53,107,214,
-192,205,205, 13,  7, 15, 30,244, 53, 49, 49, 57,  1, 29,221, 55, 44, 44, 44, 76,141,141,141,177,112,225, 66,122,240,224,193,121,
- 53,125,230,205,155, 71,115,185, 92, 88, 89, 89,233, 26,248, 98,196,227,241, 58,122,121,121,225,254,253,251,184,122,245, 42,150,
- 46, 93,138,185,115,231, 34, 59, 59, 27,195,135, 15, 55,  6,224,175,199,118,219,219,217,217,161,176,176,180, 46,188,151,151, 23,
-158, 60,121,130,236,236,108, 56, 59, 59, 35, 35, 35,  3, 54, 54, 54,104,220,184, 49, 40,138,178,215,141,146,246,178,181,182, 64,
- 86,190, 20, 76, 40,209,218,221, 22, 55,158,231,226, 93,182, 12,246, 54,150,200,200,202, 70, 29, 27, 30, 92, 92,234,130,166, 41,
- 47,157, 20, 48,131,108,205,229, 25, 33,175, 72,142,180,216,155,185,114,149,116, 74, 65,226,221,148,130,196,187, 41,114,169,100,
-202,227, 59, 87,115,235, 57, 24,193,197,197,  5,  4, 77,181,251, 20,215,227,144,186,112, 49, 49, 98,142,185,250,243, 50, 34,108,
-255, 98, 66,154,251,174,109, 31,135, 82,203,178, 29, 80,127,200,240,225, 29,191,251,238, 59, 94,102,102, 38, 21, 48,108, 88,222,
-218,192,192,107,127,212,240, 98, 80, 12, 52,234,217,179, 39, 72,  0,127, 92,185, 34,202,  0, 82,  1,192,  1,112, 25,240,205, 55,
- 93,150, 44, 90,100,148,147,155, 75,221, 79, 40, 62, 23,151, 69, 15,178, 86,161,190, 46,254, 89, 42,192, 91,195,123,249,242,101,
- 90, 12, 60,  6,  0, 63, 23,124,219,171,147,167,207,232,129, 93, 32,200,202,199,236,181, 63, 99,207,201, 91,151, 45, 20,244, 23,
-255,161, 71,241,228, 90,  9, 45,245,208,207,123,211, 74, 74,222, 31, 61,248, 80,  1,243,119,112, 86,134,255,162,208,210, 64,161,
- 40, 29, 37,145, 41, 40,200, 20,148,230,173, 22, 98,177, 88,103,138,203,151, 47, 31,158, 53,107, 22,182,108,217,130, 87,175, 94,
-129,205,102,195,203,203,139, 15,192, 84,115,207,111,221,186,181, 61, 73,146,136,143,143,199,230,205,155, 49,126,252,120,250,222,
-189,123,  7, 81,121,190,148, 39,121,121,121, 59,167, 76, 26, 95,144,159,249, 14, 10,113, 62,178,210,222, 64, 42, 42,192,154,245,
- 27, 81,162, 96, 34, 67, 40, 71,134, 80, 14,146,107,141, 61,251, 15, 49,154, 54,109,218,135,193, 96,244,171,166,159,247, 51, 51,
- 51,247, 79,155, 54,173, 32, 35, 35,163,108,251,100, 10, 26, 50, 69,249,243,213,216,216, 24,219,182,109,179,112,119,119, 31,200,
-100, 50,187, 85,195, 41, 72, 73, 73,137,155, 54,109,154, 44, 51, 51, 19, 66,161, 16,231,206,157,235, 95,175, 94, 61,171, 13, 63,
-110, 33, 68,114, 38, 50, 10,228,200, 40,144,131, 99,106,143, 19,161,103, 24,141, 27, 55, 14, 96, 50,153, 29,106, 18, 89, 71,142,
- 28, 25, 61,108,216, 48,179, 31,127,252, 49,239,236,217,179,187,  0,104, 31,144,248,109,219,182,157, 60,113,226, 68,209,252,249,
-243,173,131,130,130,230,125, 98,177,213,109,216,176, 97, 77, 40,138,194,169, 83,167,158,  1,216,122,230,204,153, 71, 82,169, 20,
-195,135, 15,175,175, 30, 70,210,  5,109,  3,  2,  2,166,251,250,250, 98,206,156, 57,242,107,215,174,181,  6,176,  5,165, 67,185,
- 52,128,100,  0, 59,110,221,186,213, 98,230,204,153,210,118,237,218, 97,236,216,177,227,  1,248,214,192,219,113,196,136, 17, 30,
- 20, 69,225,248,241,227, 79,  1, 92,172, 48,255,122,104,104,232,125,153, 76,134,145, 35, 71, 54,  0,160,207,141,156,205,229,114,
- 79,173, 94,189,218, 50, 45, 45, 13,163, 71,143,150,198,199,199, 35, 48, 48,208,200,194,194,226,162,214, 53,160, 51,184, 92,238,
-190,159,126,250,105,160,183,183, 55,166, 77,155, 38,219,189,123,247,172,233,211,167,203, 90,183,110,141, 93,187,118, 13,228,112,
- 56,122,149,232, 72, 79, 79, 47,136,141,141,181,169,233,147,154,154,170,107,120,190,177,169,169,105,132,167,167,103,161,151,151,
- 87, 27,165, 82,137,152,152,152, 55,135, 15, 31,166,188,188,188,176,115,231, 78,  4,  5,  5,161, 95,191,126, 96, 48, 24, 58, 11,
- 45,  6,131,  1,185, 92, 14, 99, 99, 99, 48,153, 76,188,121,243, 70,147, 90,  6,108, 54, 27,  0, 96, 98, 98,  2, 35, 35, 35,144,
- 36,169, 83, 52, 26, 65,128, 46, 44, 81,128,197, 34,193, 36, 41,196, 37, 11, 33, 87, 80,224,177, 25, 96, 49,  9,128,166, 96,105,
-194,  2,143,195,  0, 73, 16,148,142,156, 16,138,228,224,176, 73,176,216, 28,130, 84,170,140,202, 30,142, 76,149,145,145, 17,135,
-176, 53,231,130,199,254, 23,149,  5, 38, 74, 29,203,199,  1, 44,147,186,117,135,110,218,188,153, 83, 88, 92,140,193,131,  7,231,
- 37, 61,122, 20, 34,  6, 30,117,173, 33, 72,137,100, 50,221,253,186,118, 69,100, 84, 20,138,242,243, 95,  3,165,206,241, 28, 39,
-167, 97,219,182,109,227,136, 37, 18, 12, 30, 52,168,224,213,157, 59, 71, 82,138, 17,118, 60,185, 84,136,213,120,220,217,108, 71,
- 13,175, 48, 63, 63, 31, 40, 77, 33,225, 96,103,186, 97, 70, 64,111, 20,149, 72,176, 96, 99,  8, 21, 21, 39,248, 54, 60, 21, 95,
-157, 73,135,240, 63,246, 24,158, 92,225,  3, 64,135,132,165, 26,235, 82, 77, 98, 69, 42,149,126,116,  1,244,161,156,149,137,196,
- 15,229,252, 55,130,201,100, 74, 94,190,124,201, 49,183,113,162,108,204, 88,249,245,198,223,177,  0,  0,107, 83,166, 80,174, 82,
- 80,233,233,233,224,114,185, 18, 29,135, 27, 38,237,219,183,111, 13,128,102, 76, 38, 51,236,208,161, 67, 68, 72, 72,136,213,136,
- 17, 35, 18, 98, 99, 99,211, 60, 61, 61, 93, 15, 29, 58,100, 14,  0, 59,118,236,160, 79,156, 56,209, 27,165, 41, 51,170,204,227,
-146,153,153, 25,152,155,155,123,111,198,140, 25,193, 28, 14,199,202,196,196,196, 38, 60, 60,156,144,200,105,180, 93,146, 92, 22,
-137,104,110, 68,226,246, 98,115, 76,158, 60,153, 17, 27, 27,187, 62, 45, 45, 45,172, 26,206,133,  5,  5,  5,225,175, 94,189,218,
- 98,225,220,210,206,196,117,137,133,207,226,120,  0,128,171, 45, 11,164,250,190, 88, 80, 80,128,236,236,108, 76,159, 62,221, 42,
- 33, 33, 97, 97, 90, 90,218,141,106,172, 90,183,114,114,114, 82, 95,188,120,225,199, 98,177, 56, 38, 38, 38,109, 35, 34, 34,  8,
-137,140, 66,243,133,201,200, 43, 46,237,167,181, 41, 19,143, 87, 59,224,219,111,191,101,190,126,253,122,163, 64, 32,232, 92,233,
-205,140, 36,131,180, 69,214,130,  5, 11,162,  1, 52,  0, 80,110,104, 84,165, 82, 17, 35, 71,142,124, 14,192,107,254,252,249,214,
- 52, 77,207, 91,184,112, 97, 30,128,189,255,244,185,100,110,110,190, 97,202,148, 41, 56,113,226,  4,242,243,243,183,  1, 64, 97,
- 97,225,214,163, 71,143, 30,159, 52,105, 18,126,253,245,215, 13,217,217,217,127,160,230, 80,237, 47,135, 15, 31,142, 75,151, 46,
-225,207, 63,255, 92,  6, 32,166,138,118,175,194,195,195, 23,158, 61,123,118,251,136, 17, 35,240,243,207, 63,247,  1, 80,157,131,
-108,207,222,189,123,227,226,197,139,200,205,205,221, 85, 89,131,130,130,130,221,231,206,157,107,223,187,119,111,172, 95,191,190,
- 39,128,235, 58,108,186,135,133,133,197,161,237,219,183,183,245,246,246, 70, 64, 64,128, 68, 46,151,247,153, 63,127,254,249, 99,
-199,142,153, 29, 62,124,184,205,228,201,147, 31,168,115,190,221,215,201,148, 69,146,235, 54,111,222, 60,193,207,207, 15,243,230,
-205, 83, 94,190,124,121,  0,128, 43,127,252,241, 71,194,130,  5, 11, 46,108,222,188,153,177,105,211,166,  9,179,103,207,206,166,
- 40,234, 83,137,235,213, 59,118,236,104,223,171, 87, 47,188,121,243,  6,247,239,223,135, 92, 46,255, 53, 34, 34,226,118,163, 70,
-141, 86,203,100,178,243, 38, 38, 38, 99,204,204,204, 60, 91,182,108,249,197,227,199,143,141,161,155,159, 94,102, 98, 98,162,165,
-133,133,  5,148, 74, 37,158, 61,123,134,186,117,235, 66, 46,151,227,237,219,183,240,246,246,  6,155,205, 70,102,102, 38,180,172,
-229, 53,136, 34,242, 89, 66, 82,122,  3,107, 51, 19, 64,197,195,147,248, 84,216,217, 90, 65, 69,144,200,200, 16,160,101, 19,103,
- 16,  4,129,130,220, 12, 16,  4,241, 92, 23, 78, 21, 77, 69,190, 75,207,170, 99, 99,198,133,119,251, 94, 54, 17,127,100,135,152,
- 55,232, 52,153,201, 32, 24, 28,174,233,222,  9, 99,199,218, 82, 20,141,130,220, 76, 48, 73,242,225,167, 56, 64,167,222, 33,165,
-171, 27,239, 73,175,  9,107, 90, 18, 52,104,177, 28,135,127,206, 68,190, 49,208,114,199, 15, 63, 88,218,216,218, 34, 32, 32,128,
-202, 77, 75,187, 86,162, 99, 98,229,  6,141, 26, 57,152,154,153,225,238,221,187, 96,148,250,216,226, 32,224, 17,180, 96,129,141,
-189,163, 35,198, 79,152, 64,101,190,123,119, 93, 12,164,235,211,215,  6,110,110, 44, 13, 47,169,230, 21, 48, 48,107,254,  0, 95,
-174,137, 17, 23,235,246,156, 65, 74,142,232,120,132,  0,123,254,163,246,142,125,213, 90,180,170,114, 62, 43,117,170, 54,174, 86,
-172,240,120,188, 50,107,138, 30,111,122, 31,157,179, 38,252, 29,156,159, 16,139,  1,156,  5,176, 56, 37, 37, 37,110,194,132,  9,
-114,165, 92, 90,116,111, 77,131, 69, 81,235,235, 77,139,  8,228, 79,251,125,150,197,162, 18, 97, 94,209,142, 29, 59, 20, 41, 41,
- 41,113,218,203,212,192,253, 14,192,197, 95,126,249,101,247,169, 83,167,224,229,229,133,152,152, 24,123,145, 72,212,234,249,243,
-231,214, 30, 30, 30,  8,  9,  9,193,137, 19, 39,182,  0,184, 90,157,200,210, 64,169, 84, 94,203,200,200,104,156,156,156,220,208,
-210,210, 82, 97,105,105,137,138,145,136,133, 98, 10,185,  5, 66, 88, 91,219,192,220,220,188,190, 14,226,252, 98, 70, 70,134, 59,
-101,213,164,139,123,206, 54, 97,228, 58, 23, 68,174,115,193,197,133, 78,224, 91,114,144,159,159,143,236,236,108,100,103,103,131,
- 32,  8, 40, 20,138,166, 58,112,190, 21,  8,  4,  7,222,189,123,119,214,193,193,  1,102,102,102,160,  1,100, 20, 40, 16,189,201,
-  3,209,155, 60,144, 81,160, 64, 97, 81, 17,234,213,171,  7, 51, 51,179,170,134, 40,200, 58,117,234,244, 29, 54,108,152, 25,  0,
-168,  5, 84,119,154,166,167, 85,242,153,170, 84, 42, 59,105,218,126,255,253,247,214,  0,122,255,195,231, 19,  3,192,140, 73,147,
- 38,181,225,241,120,216,185,115,231, 91,  0, 71, 52,247,250,221,187,119,199,  3,192,172, 89,179, 60,  1,204, 67, 21,153,160,203,
- 76, 67,108,118,235,166, 77,155, 34, 34, 34,  2,  0,206,212,176,238,208,123,247,238,161, 81,163, 70,224,241,120,109,107,104, 91,
-223,197,197,  5,241,241,241,  0,240,164,138, 54, 79,226,227,227, 75,135,123,  8,162,190, 14,219, 62,176, 87,175, 94,207,110,220,
-184,209,182, 99,199,142,152, 48, 97,130,236,193,131,  7,125,  1,220,126,242,228, 73,183,145, 35, 71,138,220,221,221,113,235,214,
- 45,143,145, 35, 71,222, 35, 73,114,141, 14,156,227, 87,173, 90,181,248,235,175,191,198,170, 85,171,232,147, 39, 79,  6,  0,184,
-162,158,119,249,248,241,227,163,215,174, 93, 75, 15, 26, 52,  8, 43, 87,174, 92, 12, 96, 90,117,100, 34,145, 72,168, 82,169, 32,
- 18,137,116, 50,201,235,218,222,214,214,246,203, 94,189,122, 97,233,210,165,168, 83,167, 14,206,159, 63, 79,  3,  8,  3, 16, 46,
-147,201,186,  0,216, 44, 18,137,126,143,136,136, 64,207,158, 61,217, 40, 95, 98,164,186,245, 63, 59,122,244,168,212,194,194,  2,
-174,174,174,104,208,160,  1, 50, 50, 50,144,148,148,  4,111,111,111,180,110,221, 26, 74,165, 18,  7, 14, 28,144, 20, 21, 21,233,
-148,147, 79, 41, 19, 29,190,122,225,180,208,198,140, 11,103,123, 11,212,171, 99,141,226,130, 28,100,103,164,163,117,211,186,232,
-218,186, 30,114,132, 50, 92, 14, 59,157, 95, 84, 84,114, 88, 39, 19,190,180,228,208,181, 63,206, 11,173,204,216,104,220,196, 19,
- 35, 39,204,106,217,178,149,207,213,118,237, 58, 93,254,113,195,186,230,221, 59, 52, 37, 82,115, 36,184, 20,118, 38, 95, 88, 88,
-120,232, 83,220,232, 87,  2, 12,137,133,251,237, 93,103, 35, 15, 52,235, 51,233, 64, 92, 42,182,  1,128,130,193,240,232,251,229,
-151, 72, 77, 77,197,233, 83,167,  4, 37,192, 83, 93,249,140,140,140, 72,  0, 16, 10,133,224,170,253,238,148, 64,147,175,190,250,
- 10,217, 57, 57, 56,122,228, 72,246, 37, 32, 74,159,126,246,  7, 56,198, 70,165,  6, 65,161, 80,  8,  2, 40,  4,  0,130,137,190,
-237,188, 26, 33, 59,175, 16, 55, 30,198, 21,215, 19, 99,122,117, 60,159,177, 35,124,237,124,180,  0,228,204,155, 55, 15, 92, 46,
- 23,124, 62,191, 76, 28,105,196, 10,135,195,  1,159,207,135, 82,169,196,241,227,199,  1, 32,167,218, 55, 60, 64, 58, 96,218,122,
- 74,170,160, 75, 88, 44,214, 71,225, 84,191, 57, 74,  7, 47,248,153,250,227, 94,229, 65, 49,181,225,252, 12,208, 78,157, 19,171,
- 29,128,252,164,164,164,212,161,131,  7,  8,147, 19, 94,100,136, 10,210,  5,133,185, 41,130,148,183,207, 51,150, 44,156, 39, 76,
- 77, 77, 77, 65,105, 46,173,118,233,233,233,154,101,116,193,188,161, 67,135,254, 52,105,210, 36, 58, 58, 58, 26,  0, 16, 25, 25,
-137,177, 99,199,210,163, 71,143,222,  6, 96, 81, 45,250, 45, 18,139,197,229,172, 33,114, 21, 85, 54,228, 87, 88, 88,136,244,244,
-116,200,100, 50,157, 21,241,171,203,155, 94,230, 37, 61, 86,120,186,154,192,211,213,  4, 30, 46,198, 32,148,197,101, 34, 43, 59,
- 59, 91,243,230, 44,209,163,159,133, 82,169,180, 92, 63,181,135, 38, 11, 11, 11,145,145,145,  1,149, 74, 85,213,131,140, 74, 75,
- 75,187,124,226,196,137, 34,  0,248,241,199, 31,243,  8,130,248,147, 32,136,159, 42,249,236, 97, 50,153,119, 53,109, 55,109,218,
-148,135,247,135,196,254, 78,124,237,237,237,157,191,120,241,226,157,179,103,207,198,158, 61,123, 32, 16,  8, 22,225,175, 92, 60,
- 84, 78, 78,206,130, 93,187,118, 97,220,184,113, 88,190,124,249,166, 86,173, 90, 21,  2, 24, 89, 21,161,157,157,157, 51,147,201,
- 68, 84, 84, 84, 33,128, 55, 53,172, 63, 35, 42, 42, 42,147, 32,  8,240,249,124,183,234, 26, 90, 91, 91, 55, 52, 51, 51, 67, 90,
- 90, 26,160,126, 99,174,  4, 73,233,233,233, 52,135,195,129,147,147, 83,163,154, 54,222,202,202,106,193,129,  3,  7,152, 47, 94,
-188, 64,247,238,221, 83,111,221,186,213, 19,128, 38, 36, 61, 42, 50, 50,210,183, 91,183,110, 47,175, 94,189,138,141, 27, 55, 18,
- 45, 90,180,152, 86, 19,167,171,171,235,212,241,227,199, 35, 56, 56, 24,123,247,238,157,  6,224, 84,133, 38,199,118,237,218, 53,
-107,239,222,189,152, 48, 97,  2,234,215,175, 63,178, 58,190,228,228,228,133,126,126,126,145,175, 94,189,210,169,226,129,142,237,
-187,249,248,248, 52, 20,139,197, 56,116,232,208,155,134, 13, 27, 62, 58,117,234,212, 60,188,255,192,254,253,244,233,211, 24, 53,
-106, 20, 90,180,104,113,  8,192,  8, 93, 46,203,216,216,216,148,235,215,175, 83,108, 54, 27,174,174,174,232,215,175, 31,  2,  2,
-  2,208,188,121,115,200,229,114,156, 62,125,154,122,254,252,121,170, 76, 38,211, 41,151, 82,238,171,155,231, 19, 19,255,199,222,
-121,135, 55, 85,253,127,252,125,179,119,210,180,105,210, 69, 75,129,210, 77,161, 64,217,163, 80,138, 64,153,162,136, 40, 34, 10,
-200, 16, 21, 21, 84,134, 32, 75,217, 32,171,130,130,  8, 10,136,128,148,165,226, 23,100,211,  2,165,133,178,186,103,210,189,146,
-102,159,223, 31,180,252, 74,237, 72, 90,220,247,245, 60,247, 73,114,110,238, 59,231,174,115,223,249,156,117,239,194,245, 43,231,
- 76, 44, 38,  3,158,174,142, 24, 29,209,  9,175,141,237,133,206,254,238, 72,215,232,112,230,204, 79,166,212,212,228, 75,182,244,
- 56,172,209, 76,186, 29,127, 49,241,250,121, 51,155, 69,193,223,175, 61,230,127,248,190,124,217,162,185, 14,237,219,122, 34, 62,
-165, 20, 63,157, 62, 97,202,201,202,252,245,175,234,113,120, 22,224,136,121,148,136,201, 96,192,194,224, 85, 50,171, 59,210,  4,
-  7,  6,250,170, 92, 92, 16, 19, 19,  3,134, 29, 61, 66,207,  2, 28,177,248, 81, 45,120, 69, 69,  5,106,244,218,249,249,249,121,
-122,121,225,120, 76, 12,152, 86,235,157,126,118, 14, 48,122,247, 81, 53,244, 99, 93, 10,168,154,222, 10,146,118,173,148,126,114,
-153,  8, 87,226, 31, 64,111, 34, 87,191, 41,198, 95, 58, 30,217, 31,200, 20, 52,179,234,112,213,182,109,219,194,118,236,216, 49,
-232,157,119,222, 17, 79,156, 56, 17,124, 62, 31, 90,173, 22, 30, 30, 30,176, 88, 44, 56,121,242, 36, 98, 99, 99, 43,172, 86,235,
- 79,248,253,176,  1, 17,168,213, 75,227, 84, 50,  4,143,252,150, 54,236,200,115,207, 61, 21, 77,  0, 16, 63,176, 74, 11, 91, 27,
-246,108, 60,112,126,204,222, 83,215,169,183,198,247, 99,116,246,107,  5,  0, 80,169, 84,144, 74,165,118,107, 62,  5,254,112,205,
-218,213,186,121,121,121,119,243,242,242, 52,175,191,254,186,127, 77,195,119, 30,143, 87, 85, 29,201, 42,174,111, 27, 27,242,105,
-  4, 48,125,199,142, 29, 71, 75, 75, 75, 79,189,247,222,123, 88,182,108, 25,126,252,241,199, 62,  0, 46, 52,115,223, 45,197,197,
-197, 37, 87,175, 94, 85,249,  4,132,162,141,146,141,190, 11,238,131, 16,  2, 39, 33, 65,121, 73, 17,110,220,184,142,242,242,242,
- 43,246,228,211,104, 52,150,104, 52, 26,133, 82,169, 68, 81, 81, 17, 10, 10, 10, 30,155,172,226,226, 98, 20, 21, 21, 17,138,250,
-221,152, 45,141,105, 86,106, 52, 26,109, 82, 82, 18, 87,213,202,  7,109,149, 28,116,251,240, 46, 64,  8, 60, 29, 25, 40, 47, 43,
-193,165, 75,151, 80, 90, 90,250,191,134, 52,173, 86,235,156,  9, 19, 38, 48,  1,188,252,222,123,239, 57,  2,232,248,254,251,239,
-255,132, 58, 61, 11, 89, 44,214,186, 61,123,246,  4,215, 84, 49,206,157, 59,119, 45,128, 29,127,214,181,228,228,228, 52, 39, 38,
- 38, 70, 98, 52, 26,177,113,227, 70,172, 93,187,118, 39,126, 63, 80,101,204,231,159,127,190,153,193, 96,204,152, 57,115, 38,166,
- 78,157, 42,236,210,165,203, 59,185,185,185,223,212,167,153,157,157, 61,191,115,231,206, 11, 53, 26,205,114,155,204,242,253,251,
- 83, 58,119,238, 60, 95,163,209,124,214,216, 57, 18,137, 68, 34,139,197,130,212,212,212, 98,160,193,246, 29, 85,169,169,169,217,
- 22,139,197, 67, 40, 20, 58, 54,117,125, 22, 23, 23, 47,239,210,165,203,199,106,181,250, 52,128,165,245, 24,242,155,185,185,185,
- 65,179,103,207,158,181,114,229,202, 49,121,121,121,223, 54,165,153,158,158,190, 60, 60, 60,124,193,189,123,247,118,161,225, 42,
-224,207, 23, 47, 94,108,220,179,103,207, 27,169,169,169, 43,154,208, 60, 86, 80, 80,112,204,142,243,219,208,247, 31,107, 50,153,
-204,247, 87,174, 92,201,216,182,109, 27,  8, 33,171, 45, 22, 75, 67,249,140, 63,124,248,240,238, 94,189,122, 77, 60,112,224,  0,
- 63, 40, 40,104,170, 94,175,223,215,212,245,169,213,106, 15, 29, 56,112, 96, 76,124,124,188,199,196,137, 19,249,190,190,190, 48,
- 26,141,200,205,205,197,182,109,219,170, 18, 18, 18,178, 74, 74, 74, 14,217, 83,134,152, 13,101,227, 47,158, 57,178, 47,237,126,
- 66,143,254,207,140,148, 27,140, 30,224, 21, 50, 81, 82,152,135,147,199, 14, 21,167,166, 38, 95,210,106, 75,198,219,163,105,212,
-151,190,112,233,215,163,223,102,165, 38,117,239, 27, 62, 84, 94,101,240,  2,143,195, 64,161, 58, 27, 39, 99,142, 20,165,166,166,
-252, 86,101,210,191,242, 87,149,243, 76,111, 44,101,230,197,190, 62,109,120, 39,  8,228, 30, 55,216,192,198, 94,128, 64,161, 82,
-113,170,239, 29,136, 31,181,121,180, 73, 83, 13,112,125,170,107,169,180, 90, 45,216,128, 97, 18,192,118,118,118, 22,  0,192,189,
-123,247, 32,124, 84,171, 97, 87, 62, 43,  0,145,176,150, 46,  3,208, 22,178,224,222, 78, 42,162,  0, 32, 43,175, 16,  6, 83,163,
-207,141,127, 58,209,181, 12, 87,116,115,  4, 56,  0, 34,196, 98,241,178,133, 11, 23,174,190,114,229,202,234,168,168,168,213, 60,
- 30,111, 89,245,193,230, 52,114, 34,254, 52,205,174,110,112, 12,111, 75,157,139,108, 71, 89,167,245,145, 91, 94,233, 38, 50, 12,
- 24, 48, 96,115, 11,243,217,146,155,229,143,212, 60, 98, 50,153,  8, 30, 85,219, 29, 65,195, 85,130, 31,212, 90,159,151,145,145,
- 65,170,223,219,147, 79,197,184,113,227,172,229,229,229,228,249,231,159, 39,104,122, 10,159, 70, 53,121, 60, 94,120,223,190,125,
- 77,234,252, 34,114, 55, 37,155, 92,142,187, 77, 78,157,185, 72,190, 61, 20, 67, 54,109,222, 78, 66, 66, 66, 12,  0,188,236,209,
-100,177, 88,  3,194,195,195, 11,213,106, 53, 73, 74, 74, 34,231,206,157, 35,  7, 15, 30, 36,219,183,111, 39, 91,183,110, 37,173,
- 90,181, 82,  3, 80,217,163, 41, 16,  8, 70, 14, 25, 50,196, 84, 82,166, 37,169,217,133,228, 86, 82, 42,185,112,245, 22, 57,121,
-230,  2,249,102,223,  1, 18, 24, 24, 88,101,131, 38,147,201,100,110,250,246,219,111,203,  8, 33,100,228,200,145, 89,120,114, 32,
-213, 54,115,230,204,209, 16, 66,200,103,159,125, 86,136,250, 27,194,255,209,215,210, 51,238,238,238,119, 57, 28, 78, 12,128,151,
-155,216,238,  5, 22,139,245,163,139,139,203, 53,  0,163,255,130,251, 40, 74,169, 84, 94,  6,208,212, 12,  7, 53,223, 27,245, 47,
-185,223,255,  8,205,  1, 44, 22,235, 28,208,248, 36,194,181,202,235, 79,152, 76,230,113,  0,  3,237,204,103,123,133, 66,241,188,
- 92, 46,127, 75, 46,151,191,165, 84, 42,159,231,114,185,237, 91,178,239, 78,237, 35,134,123,134,142, 56,220,170,227,176,116,207,
- 78, 81,233,222,157, 71, 30,118,106, 31, 49,188,165,154, 94,157, 71, 30,241,236, 20,149,225,217,105,120, 90,155,174, 35, 15, 43,
-252, 34,134,252,149,231,232,101,119,184, 13,106,  3, 51, 57,183,128,144,115, 11, 72, 68, 27, 88,123, 56, 32, 48, 12,144, 12,142,
-136, 88, 67, 44,150, 53, 99, 70,141, 90,227,  3, 56, 17,128, 89,119,169, 79, 51, 20,144, 62,222,118,228,200, 53,109,  1,197, 32,
- 64,216,175, 79,159,213,196, 98, 89, 51,225,133, 23,214,120,  2, 46,245,233, 53,164, 73,  0,166, 59,224, 86, 91, 87,  1,180, 27,
-235,141,160, 15,134,123, 19,114,110,  1, 89,252,156, 47,233,172,194,203, 77,104, 54, 20, 41,250, 71, 71,180,236, 69, 84, 93,184,
-174,168,126, 21, 61,133,139,240,169,107,118,119,133,111, 68, 59, 42,105,168, 31,171,  8,143,186, 36,139,254,133,133,228, 46,131,
-193, 64,170,170,170,136, 86,171, 37, 21, 21, 21,117, 13,212, 99, 67,150,147,147, 67,178,178,178, 72, 70, 70,  6, 73, 75, 75, 35,
-248,255,182, 55, 54,231, 83, 42,149,238,120,238,185,231, 44,108, 54,123,211,211,216,119, 71, 71,199, 21,221,186,117, 51,110,216,
-176,129, 28, 62,124,152,124,241,197, 23,100,230,204,153, 36, 56, 56, 88,239,224,224, 48,190, 57,154, 46, 46, 46,243,253,252,252,
- 10,119,238,220, 73,190,249,230, 27,178,126,253,122,242,209, 71, 31, 89, 60, 60, 60,242, 36, 18,201,224,230,104, 42,149,202,232,
-222,189,123, 27,163,163,163,201, 79, 63,253, 68,246,238,221, 75,230,204,153, 67,252,253,253,245, 34,145,232, 89, 27, 53,153, 44,
- 22,107,205,180,105,211,242,220,220,220, 98,234,172, 19,  6,  6,  6, 94,155, 48, 97, 66, 14,128,185,255,162,235,147,214,164, 53,
-105,205, 63,192,104,189,232,  6,119,  2, 48,133, 28,206, 11,253,250,244, 89,205,  1, 94,176,215, 20,241,153,204,177,189,186,117,
- 91,205,  1,198,215,124,151,207,100,142,237,215,167,207,106, 54,147,249, 82, 67,122,141,105, 18,128,201, 97,177,230,246,234,209,
- 99, 13, 11,248,176, 38,109, 64, 27,234,206,156,103, 90,145, 62, 94,212,131,151,148, 16,254,139,141,214, 83,135,245,  7, 92,132,
-255, 20,205,191,203, 77,237, 83,109,152,142,216, 17,209, 58,130, 71,179,168,251, 52, 51,159,130,167,188,239, 29, 20, 10,197,  9,
- 31, 31,159,252,214,173, 91,231,200,229,242,125,  0, 60, 90,168, 25,228,226,226,242,181, 74,165,186,239,234,234, 26,175, 80, 40,
-214,225,209,168,243,205,214,100,179,217,221, 84, 42,213,255,188,189,189, 75,188,188,188,212, 10,133,226,219,122, 34, 89,182,104,
-186,162,254, 66,133, 83,189,142,126,232,208,154,180, 38,173,249,132,129,137,108,139,149,131,218,192, 60,168, 13, 44,145,222, 88,
- 87,219,160, 68,  1,130,230,154,162, 87,  0, 94,221,239, 55,165,215,148, 38,  1,152, 61,  1,113,221,109,134,122, 32,208, 70,205,
-127,122, 68,171,166,156,183,111,120,135,  6, 48,255,  1,153,252,167,104,254, 93,120,128, 70, 26, 35,215, 98,197, 83,252, 77,221,
- 83,222,135, 91,  5,  5,  5, 67, 10, 10,158,106,223,132,196,188,188,188,151,159,166,160,201,100,186,162, 86,171,251, 63,  5,169,
-134,186, 94, 27, 97, 99,183,108, 26, 26,154,255, 14, 20, 96, 65, 50,230, 69,180,199, 70,150,  5,140,147, 41,200,174,211, 37, 79,
- 71, 53, 71,243, 17,150, 93,245,148,241, 84,115,243,249,255, 84,252, 78, 35, 11,183,169,255,206,105,203,197,163, 54, 90, 45, 54,
- 90, 52, 52, 52, 52, 52, 52, 52,127,  2, 63,223,167,255,136,253,  3,136,193,147,209,183,152, 90, 70,180,193,208,167, 61, 61, 41,
-154, 19, 62,253,153,214,164, 53,105, 77, 90,147,214,164, 53,105,205,255,156,102, 13, 13,205,157,122,183,206,231,102,245,226,251,
-175, 64,215,179,211,154,180, 38,173, 73,107,210,154,180, 38,173,249,111,167,217,227,104,209,208,208,208,208,208,208,208,208, 52,
- 78,131, 81, 55,218,104,209,208,208,208,208,208,208,208,180, 12, 87, 60,154,162, 42,  6,255, 63, 85, 85, 52,208,244, 20, 60, 79,
-176,114,229, 74,134,143,143,143,152,203,229,  6, 39, 39, 39, 51,166, 79,159,222,226,142,  4,171,215,109, 98,120,121,121,137,  1,
-  4, 23, 22,151, 51, 94,125,237, 61,138, 62, 95, 52, 52, 52, 52, 52, 52, 52,255, 32,134, 85, 27,171,154,215,199, 17, 46,187,140,
-214,210,165, 75,145,145,145, 33,  2, 48, 46, 40, 40,136,187,101,203, 22,178,127,255,254, 22, 25,163, 15,231,206, 65,122,122,186,
-  8,192, 56,165,194,129,251,229,142, 85,228,192,143,231,159,186,217, 82, 40, 20, 78,127,230,118, 52, 52, 52, 52, 52, 52, 52,255,
- 41,166,212,122,157,210, 44,163,197, 98,177,152, 92, 46,183, 45,131,193, 24,194,231,243,187,  2, 64,245,148, 44,205,134,197, 98,
- 49,185, 60, 94, 91, 38,147, 57,132,199,123,164,249,220,240,222, 45,213, 28, 40, 18,137, 50,133, 66, 97, 44,  0,129, 68, 34,185,
-110, 52, 26,111, 75, 36,146,139,246,232, 72, 36,146,139,213,219, 93,  7, 32, 16, 10,133,177, 34,145, 40,147,197, 98, 13,164,175,
- 39, 26, 26, 26, 26, 26, 26,154,106,162,235, 89,126,207,177, 99,199, 26, 52, 56, 92, 46,151, 17, 20, 20,212,219,203,203,235, 66,
- 64, 64,128,193,195,195,227,160, 80, 40, 20,181, 48, 99, 12, 31, 95,255,222,110,174,170, 11,157,218,186, 26,148, 74,229, 65, 54,
-155,221, 18, 77,166, 68, 34, 89, 31, 25, 25, 89,122,225,194,  5, 34,149, 74,213,  0, 28,156,157,157,115,  8, 33,196,197,197,197,
-106,143,152,139,139,139,149, 16, 66,156,157,157,115,  0, 56, 72,165, 82,245,133, 11, 23, 72,100,100,100,169, 68, 34, 89,143,166,
- 71,180,165,161,161,161,161,161,161,177,131,198,188,200,223,152,154, 40,150,107,179,119,142,203,229,134, 42, 20,138,132,183,223,
-126,219, 18, 29, 29, 77,188,188,188,174, 42,149,202, 30, 10,133,226,137,  6,245,147, 38, 77,178,167,218, 47, 84, 34,149, 37,236,
-154,253,140, 69,247,229, 72,226,238,170,188,234,224,224,208, 67, 42,149, 62,161, 57,225,213,169,182,104,186,156, 17,217,210,  0,
-  0, 32,  0, 73, 68, 65, 84,201,100,178,248,149, 43, 87, 86,149,148,148, 16, 66,  8,145,201,100,106,  0,114,149, 74,149,147,146,
-146, 66, 20, 10,  5,129,237, 81, 60,134, 66,161, 32, 41, 41, 41, 68,165, 82,229,  0,144,203,100, 50, 53, 33,132,148,148,148,144,
-149, 43, 87, 86,201,100,178,120,  0,110,244,109, 65, 67, 67, 67, 67, 67,243,159, 54, 90,117, 13,151,109, 85,135, 93,187,118,229,
-169, 84,170, 30, 18,137,100,148, 88, 44,222, 60, 98,196,136,160, 49, 99,198, 48,244,122,189, 37, 40, 40,200,205,219,219,123,150,
- 92, 46,127,153,207,231,135,112,185,220,151,164, 82,169,235,190,125,251,124, 26,211,236,208,177, 11,207,193, 65,222,131,203,229,
-141, 18,139, 37,155,167,141, 29, 16,244,242, 59,207, 50, 56,134, 52,203,128, 16, 79,183,224,182,174,179, 92,228,162,151, 89, 76,
- 70,  8, 69, 81, 47,241,249,124,215,111,190,220,238,211,196,142,181,117,115,115,187,190,111,223,190,224,113,227,198,241,146,146,
-146,  0,  0, 22,139,133, 11,192,196,100, 50,193,227,241, 96, 52, 26,139,  1,216,122,  2,137,209,104, 44,230,241,120, 96, 50,153,
-  0, 96,170,214, 67, 82, 82, 18,198,141, 27,199,219,183,111, 95,176,155,155,219,117,  0,109,233, 91,131,134,134,134,134,134,230,
- 63, 75,141,185,138, 65,157,170, 67, 86,141,123,140,138,138,122, 34,106,196,229,114,183,220,187,119,175,151,163,163, 99, 91, 54,
-155,109,121,225,133, 23,120, 19, 38, 76, 64,126,126,190,181,162,162,130, 25, 26, 26,170,186,118,237,218, 16,179,217,220,199,193,
-193, 65, 91, 82, 82,162,208,235,245, 15,  0,204,106, 36, 35, 91,238,223, 77,232,229, 36,119,108,203,101, 51, 45, 51, 39, 79,224,
-125, 56,247, 25, 80,250, 56,171, 69, 83,200,252,164,179,131,106,221,197,202, 33,247,140,150, 62,149, 50,190, 54,175, 84,223,164,
-166, 66,161,232,204,225,112, 98, 79,156, 56,  1,161, 80,136,210,210, 82,112,185, 92,  0, 64, 69, 69,133, 12,  0,139,162, 40,112,
-185, 92,148,149,149,201,237, 57,106,101,101,101,114, 46,151, 11,138,162,  0,128, 85,173,  7, 46,151,139,210,210, 82,248,248,248,
- 80, 39, 78,156, 80, 14, 25, 50,228,161,209,104,236, 82, 80, 80, 16, 71, 95,107, 52, 52, 52, 52, 52, 52,246, 83,159, 23,249,  7,
-209,228, 56, 90,253,171, 67,117,181, 39,206,221,237,236,236,236, 34, 22,139,  3,166, 76,153,194, 80, 40, 20,136,141,141,181, 86,
- 86, 86, 50,216,108, 54,216,108, 54,115,192,128,  1, 98,179,217, 44, 60,126,252, 56,245,240,225,195,124,147,201,244, 73, 97, 97,
-225,181, 70, 50,178,187,157,  3,207, 69,224,192, 13,248,241,189,190, 12,103,159, 66,224,212, 98, 43,169,208, 48, 88, 86,  2,133,
-200,202, 92,211,135, 18,231,201,188,133, 51,191,205,167,126,123, 88,146,111, 50,153, 62, 41, 47, 47,111, 76, 51, 27,  0,170,243,
-  4,169, 84, 10,139,165,246,252,150, 32, 12,  6,  3, 60, 30,175, 89, 71,142,199,227,129,193, 96,  0,181, 34, 97, 50,153, 12, 76,
- 38, 19, 12,  6,  3,108, 54,251,137,124,208,208,208,208,208,208,208, 52,139,250,188,200, 63,133,218,227,104,217, 54, 55,165, 74,
-165,162,164, 82,169,107,199,142, 29, 63,142,140,140, 76, 25, 61,122,180,118,195,134, 13,100,237,218,181,100,205,154, 53,100,231,
-206,157,150, 95,127,253,213,244,218,107,175, 85,181,111,223,254,193,230,205,155,  3,  0, 96,232,208,161, 13, 86, 71, 58,200, 29,
- 41, 49,151,229, 26, 24,208,225,227, 23,251,  7,167, 44, 24,229,171, 53,238, 10, 37,214,133,173,136,101,147, 55,177, 28, 24,104,
- 33,247, 86,153,150,191, 62,176,170,181, 87,235,  7, 91,119,126, 23,  0,  0, 17,145, 67, 27,173,226, 84, 40, 20, 93, 61, 60, 60,
-212,167, 79,159,182, 22, 23, 23,147,194,194,194,154, 54, 90, 37,  0,100, 94, 94, 94, 57,102,179,153,200,229,242, 34,123,142,154,
- 92, 46, 47, 50,155,205,196,203,203, 43,231,145,191,146,149, 16, 66, 72, 97, 97, 33, 41, 46, 46, 38,167, 79,159,182,122,120,120,
-168, 21, 10, 69, 87,250,254,160,161,161,161,161,161,249,207, 50,165,206,107,211,244,234,213,139,146, 74,165,140, 14, 29, 58,136,
-221,220,220,186,187,185,185, 93, 89,183,110, 29, 89,187,118,173,121,219,182,109,228,235,175,191, 54,191,242,202, 43,101, 34,145,
- 40,134,203,229,202,  1,192,219,219,187,209,144, 95,215,238, 61, 40,  1,159,199,240,243, 11, 20, 43,156,156,186, 59, 59, 57, 94,
- 49,174, 13, 38,100,177,187,153,236,232, 68,200,129,103,204,171,158, 15, 43, 99,179, 57, 49,  0,228,  0,224,225,230,106,107, 24,
-209, 77,169, 84,198, 47, 94,188,184,210,104, 52,146,234, 94,134,106,  0, 14, 94, 94, 94, 57,132, 16,226,225,225,145,  9, 64, 97,
-163,158,194,195,195, 35,147, 16, 82, 99,180, 28, 92, 92, 92,212,132, 16, 98, 52, 26,201,226,197,139, 43,149, 74, 37,221, 24,158,
-134,134,134,134,134,134,166,193,185, 14, 27,140, 20, 93,184,112,129,148,149,149, 89,179,179,179, 45, 21, 21, 21,210,208,208, 80,
- 57,147,201,132, 74,165, 98, 50,153, 76,107,101,101, 37, 83,161, 80,228,176,217,236,111, 12,  6, 67,241,168, 81,163,168,212,212,
-212, 70, 27,154, 95,187,124,137,232,170,244,214,172,172, 76,139,182,162, 76,250,114,136,163,156,101, 54,194, 26,218,139, 89, 38,
-104,111,181,234,138,153,254,174,188, 28, 14,135,253, 13,128,226,209, 81,195,168,172,156, 92, 91, 27,175,231,104, 52,154,208, 45,
- 91,182,236,232,219,183,111,177, 86,171,173,105, 91, 85,119,  8,  6,  7, 27,245,234,126,143, 73, 81, 20,180, 90, 45,250,246,237,
- 91,188,101,203,150, 29, 26,141, 38, 20, 64, 14,125,125,209,208,208,208,208,208,252,167,105,112, 28,173, 38,135, 58,208,106,181,
-114, 14,135, 19, 17, 22, 22,214,186,178,178,210,186,116,233,210,204, 13, 27, 54,236,121,240,224,129,201,193,193,161,173, 64, 32,
-120,107,220,184,113,138,195,135, 15,147, 62,125,250,212,141, 62,213, 59,187,183, 78, 87, 33,231,113,216, 17,111,117,147,180,206,
- 52,202,173,  1,111, 93,205,236,183,240,226,158, 31, 18, 89,166, 14,142,186,182,142, 92,234,173,113,227,158, 87,252,112, 44,134,
-244,232,209,221, 38,205,106, 44, 26,141,230,173,216,216,216,231,219,180,105,147,101, 50,153,178,  0, 20,234,116, 58,181,155,155,
-155,198,104, 52,102,  1, 48,214,179, 93,125,154, 70,163,209,152,229,230,230,166,209,233,116,106,  0,133, 38,147, 41,171, 77,155,
- 54, 89,177,177,177,207,107, 52,154,183,  0, 88, 26,201, 11, 61,171, 59,173, 73,107,210,154,180, 38,173, 73,107,254,119,248, 93,
- 52, 11,176, 97, 82,105, 30,143,215,215,211,211,179,119, 98, 98,162,229,210,165, 75,165, 12,  6, 99,235,208,161, 67, 15, 30, 58,
-116,168,155,163,163,163,178, 85,171, 86,170, 95,126,249, 37, 28,192,254,223,126,251,205,166,232,147,128,199,233,219,201, 67,214,
- 59,250, 38,177,124, 25,123,191,212,194,228,109, 29,240,236,179,  7,223,220,179,183,155,155, 66,162,236,228, 42, 85, 29, 63,126,
- 50, 28,192,254, 75,151, 46,219, 61,158,134,217,108,254, 69,163,209,180,170,249,156,159,159, 31,170, 80, 40,  2,240, 40,250, 84,
-106,163, 76,186,213,106, 29,106,181, 90,221, 10, 10, 10,238,  0, 64, 65, 65, 65, 23,250, 58,162,161,161,161,161,161,161,169,199,
-100, 69,215,247,185,209,136, 22,151,203,117,103, 50,153,129, 89, 89, 89,233,199,143, 31, 79,236,218,181,235,144,244,244,244,149,
-132,144, 52,161, 80, 56, 37, 51, 51,243,126,102,102,166, 65,167,211, 77,179, 35, 51,238, 96,112,  2, 99,115,116,233,159,254,114,
- 59,177, 67,143,193, 67,242,242,114, 86, 90,  8, 73,227, 10,165, 83,238,101,228,223,191,172,209, 27,170,170,236,210,108,146,130,
-130,130, 59,  5,  5,  5,165,118,110, 83, 90, 99,178,104,104,104,104,104,104,104,104,236,165,169,136,150,209, 98,177,172,210,235,
-245,242, 31,126,248, 33, 59, 50, 50, 82, 15,  0, 91,182,108,177, 78,158, 60,249,124,114,114,242,192, 59,119,238, 12,113,113,113,
- 57,  3,128, 74, 73, 73,177, 37,250,100,180, 90, 45,171, 12,  6,189,252,151, 95,227,178,251,246,238,160,  7,128,109,159,111,180,
-190, 48,101,246,249,228,164,196,129,247, 18,174, 15,113,113,113, 57, 99, 49,179,168,220,188, 52, 66,159, 38, 26, 26, 26, 26, 26,
- 26,154,191, 49,209,120,178,202, 48,218, 38,163,101, 48, 24,242, 13,  6,  3,  0, 20, 71, 70, 70, 62,177,110,231,206,157,  4, 64,
- 37,128,  3,133,133,133,246,100, 38, 95,167,211,  1, 64,113,223,222, 29,158, 88,241,109,244,134,199,154, 21,229,101,244,105,163,
-161,161,161,161,161,161,249, 39,153,173,223,193,160,143, 11, 13, 13, 13, 13, 13, 13, 13, 77,139,152,210,208,103, 10, 13,247, 28,
-248,217,142, 31,104, 78,239,131,159,105, 77, 90,147,214,164, 53,105, 77, 90,147,214,252,207,105, 54,165,253, 51,254,121, 52,216,
- 24,254,143,134,238,250, 74,107,210,154,180, 38,173, 73,107,210,154,180,230,191, 29, 87, 60, 57,188,131,107,205, 10, 22,125,108,
-104,104,254,217,144,  3, 96,162,216,207, 27,132,184,129,201,205, 69,238,173,100,234, 99, 88, 91,172,169, 14,244,130,192,164,130,
-153,159, 15,117,124, 74, 75, 53,105,104,104,254,125,184,244,156, 62,154, 98, 48,183, 82,196, 10,157, 58,137,199,209,165,  9, 53,
-185,233,255, 69,111,145,139,  6, 34, 88,180,209,162,161,249,167,147,239,239, 11, 22, 86,128,  1, 87, 16,227, 67, 56,  7,174,  0,
-110, 39,180, 88,147, 99, 93, 10, 11,195,  3,196,120, 15, 74,191,149,192,221,219,244,193,254,247, 49,107,230, 27,228, 78,194, 21,
-100,100,228,160,109, 59, 87,248,250,247,196,134,141,155, 41,250,200,208,216,246,175,140,138,142, 24, 62,193, 81, 32,148,  0,  0,
-172,102, 19,118,190,211,233, 39,179,217,188, 27,192, 97,  0,186,255,250, 33,250,211, 27,195,179,217,108, 53,  0, 43,159,207, 63,
-132, 90,161, 53, 26,154, 63,  0,215,234,235,204, 90,125,221,217,131,152,197, 98, 45, 20, 10,133,191,242,120, 60, 13,143,199,211,
-136, 68,162, 95, 89, 44,214, 66,  0,226,191, 77, 25,247,117,176, 16, 12,203, 16,131,201,234,126,242, 86,137, 82,171,183,248,130,
- 97, 30, 74,118,182, 23,183, 72,147, 69, 69, 86, 25,173,158,223, 92,213,170, 42, 13,230,  0, 16,180, 72,179, 22, 14, 28, 14,231,
- 36,108,159,115,148,230, 15, 38, 61, 37,  1,199,143,173,193,210, 37, 19,241, 85,244, 52,220,189,115,185, 69,122,  1, 64,151, 46,
- 44,214,187,254,192,  0, 60,106,  7, 76,243,111,134, 34, 83,126,254,241,155,252, 31,247,125,158,255,221,154,105,228,200,138, 40,
-108,220,184, 49, 98,226,196,137,223,120,122,122,230,  3,120,142, 54, 90,127, 50, 38,147, 73, 89, 80, 80, 64,237,222,189,123,132,
- 76, 38,123,200, 98,177, 62,  0,192,249,175, 28,112,177, 88,124, 81, 42,149,170,101, 50,153, 90, 42,149, 94,111, 42,253, 95,138,
-175,179,179,115,186,163,163,227,189,218,137,206, 33,163,123,250,244,122,121,145, 83,224,200,126, 45,212,231,176, 88,172, 15,100,
- 50,217,195,221,187,119,143,200,206,206,166, 76, 38,147,210,142,237,251,202,229,242, 59, 87,174, 92, 89, 80, 80, 80,208, 47,243,
-242, 78,231,188, 43,219,157,211,255,183,166,127,236,241, 77, 11, 28, 28,100,183,  1,244,253, 91, 28,201, 42,171, 10, 12,102,120,
- 98,174, 86,152, 91,102, 82,197,165,105, 37,  0,179, 63, 12, 45,248, 19, 83,106, 85,  1,100,192,205, 44,157,232, 98,145,179,234,
-183,100,189, 20, 12, 70, 56,170, 40,151, 22, 23, 56, 12,198, 27, 86,171,117, 16,135,195,121,139,126, 66,253, 61,224,241, 56,  0,
- 33, 16,139,248,  0,  8, 24, 45,180, 70, 92,  6,163,215,197, 17, 35,150,206, 13,  9,153,229, 15, 12,111,192,108, 81,  0,222,244,
-247,247, 63,  1,224,133,167,184, 59,159,250,249,249,101,  3,152,253,180,202,165,206,157, 59,247, 12, 15, 15, 95,212,169, 83,167,
-126, 79, 75,243,223, 68,222,197, 45, 63,228,158,223,164,204,185,176, 89, 89,146,114,238, 77, 87,149,220,154,146,146,130, 97,195,
-134,225,243,207, 63, 23,  6,  5,  5,237,  1,224,246, 31,184,149, 66,107,254,224,163, 78, 27, 45,155,141,214, 88,111,244, 26,223,
-  6,103,159,247, 70,249,184, 54,168,120,169, 13,206, 63,235,141,  1,205,201,141,147,147, 19,250,246,237,203,204,206,206, 22,204,
-153, 51,103, 17,159,207, 79,  5, 48,184, 57, 90,  2,129, 32, 86, 40, 20,102,178, 88,172, 39,242, 34, 20, 10, 99, 69, 34, 81, 38,
-139,197, 26, 88, 59, 93, 34,145, 92,148, 74,165,106,137, 68,114,189,  1, 35, 20, 43,149, 74,213, 98,177, 56,182,118, 58,139,197,
- 26, 40, 22,139,179, 36, 18, 73,221,244,  1, 18,137, 36,179,110,122, 67,176,217,108,143,204,204, 76,101, 86, 86,150,146,203,229,
-170,106,167,103,100,100, 40, 51, 51, 51,159, 72,183,  7, 22,139, 53, 64, 36, 18,101, 10,133,194,216,250,210,235,238, 83, 67,212,
- 58,118,  3,108, 73,183,183,224,137,140,140, 60,159,155,155,235,233,224,224,240,196,196,221,142, 50,135,193, 95,239,220,252,206,
-200,161,145,111, 56,  7,140,234,208, 76,253,193,124, 62, 63,117,206,156, 57,139,178,179,179,  5, 61,122,244, 96, 50, 24,118,253,
-159,136, 24, 57,114,228, 17,181, 90,237,222,177, 99, 71,166,217,108, 70,226,209,133, 16,198,191,  5,126,234, 54,180, 18,228,179,
- 30,254,180,210, 35,178,127,151, 35,248,139, 27,131,146,  3,  1, 28, 80,214,190, 86, 66,156,239,100, 87, 57, 15, 27,241, 28,235,
- 70,166,206,217,100,177, 56,  2,204,254,228, 43, 47, 94,179, 52, 89,166, 62, 86, 66, 84,191,164,177,157,195,159,159,197, 60,147,
-198,114, 54, 89, 44, 78, 96,160, 95,115, 52,107, 95,254, 76, 38,243,157, 53,107,214, 48,  0,204,  4,192,253, 47, 25,154, 48, 55,
-184, 15,104,199,188, 26,234,138, 94, 79, 81, 54,168,250,126,247,109,169,208,142,175, 78, 96,242,212,104,180,247,239,222, 34, 29,
-131,213,122,247,219,148,148, 83, 47,181,107, 23, 53, 55, 36,100, 82, 61,102,139,  2, 48,119,229,202,149, 47, 39, 38, 38, 58,183,
-105,211,102,234, 83,250,211,191,126,229,202,149,239, 39, 38, 38,186,121,123,123, 47,182, 83,179,193,114, 73, 46,151, 15,222,177,
- 99,199, 59,195,134, 13,123,163,115,231,206, 29,158,134,230,191,152,207,111,222,188,233,185,102,205,154,121,147, 39, 79, 46,  3,
-128,129,  3,  7,114,  0,244,104,113,121, 71,  8,151, 16, 18, 78,  8, 25, 70,  8, 25, 72,  8,  9,171,126,223,181,122, 25, 70,  8,
-137,168,243,218,181,122,219,154,245,221, 26,208, 24, 86,119,187, 90,219,212,253,252,196,251,122,140,214, 48, 60,106,171, 53,236,
-137, 29, 56,118,236, 24,169,253, 90,151,113,222,248,120, 86, 79,119,237,157, 31,247,146,138,204, 20, 82,156,116,131,220,136, 94,
- 78,102,117,117,214,190,216,  6,159,218,127,188,  8,185,112,225,  2, 73, 76, 76, 36, 21, 21, 21,228,254,253,251,164, 91,183,110,
- 58,161, 80,248, 11,  0,111,123,196, 36, 18,137,250,151, 95,126, 33,145,145,145,165, 98,177,120,117,205,205, 37,149, 74,213, 23,
- 46, 92, 32,145,145,145,165, 18,137,100, 61,  0, 38,  0, 60,251,236,179, 26, 66,  8,113,118,118,206,169, 79,111,228,200,145,197,
-132, 16, 34,147,201,106,170,154,152, 18,137,100,253,140, 25, 51, 42,174, 93,187, 70,228,114,121, 77, 58, 67, 42,149,174,158, 57,
-115,102, 69, 92, 92, 92,237,244, 70,113,116,116,204,180, 88, 44,228,199, 31,127, 36, 74,165, 50,167,214,205,156,105,177, 88,200,
-145, 35, 71, 26,204, 91, 99,129,  2,177, 88,188,234,165,151, 94, 42, 79, 75, 75, 35, 78, 78, 78,234, 90,233,171, 39, 78,156, 88,
-158,145,145, 65, 20, 10,133, 77,121,116,114,114, 82, 95,188,120,145,140, 25, 51,166,172,246, 49,117,114,114, 82, 95,186,116,169,
- 38,125,149, 45,  5,153,155,155,219, 84,165, 82,153,163, 84, 42,115, 28, 28, 28,150,185,186,186,230,229,231,231, 19, 66,  8,105,
-219,182,173,166,118, 36, 75, 25, 52,226,237,109,  7, 46, 93, 57,151, 80,152, 31, 50,232,141, 85,178,144,145, 50, 59,142,129,183,
- 80, 40,252,165, 95,191,126,186,204,204, 76, 82, 89, 89, 73,226,227,227,201,133, 11, 23,200,131,  7, 15,  8,  0, 91,102, 24,144,
-136,197,226,108,189, 94,111,213,235,245,214,252,252,124,139, 70,163,177, 36,173,118, 37,228, 75,246,227,165,228,200,112,146,119,
-110,133, 85, 42, 22,102,  1,144,252,101, 70,107,115,160,  7,217,238,247,237,237,133,158, 73,231, 86, 62, 99, 34,105,103,200,222,
- 73,206,166,179,111,187, 63, 36, 91,253,191, 39,219,  3, 90, 53, 75,115,107,192,222,248,143, 60,239,110, 90,252,166, 41, 61, 61,
-157,188, 59,241, 25,243,233, 89,238,201,100,155,255,129,230,104,214, 98,252,232,209,163, 43, 50, 50, 50, 72, 96, 96, 96, 37,147,
-201,156,252, 95, 50, 89, 17,190,220,236,248,111,222,181, 14, 15, 18, 22, 62, 37,179, 21,164, 84, 42, 11,118,237,218, 69, 36, 18,
-137,166,185,102,107,236,168,254, 68, 87,250, 11, 25, 21, 21,214,232, 61,242,252,243,207,147,240,240,112, 50,107,214,172,166,238,
- 37,202, 31, 24,177, 59, 36,228,136,117,236, 88,203,238,144,144, 35,254,192,136,106,131, 69,  1,152,247,217,103,159,197,153, 76,
-166,184,175,190,250, 42,110,196,136, 17,113,  0,222,109,225,177,216,240,233,167,159, 18,147,201, 68,190,250,234, 43, 50, 98,196,
-  8,  2, 96, 99, 75,202,165,154, 72, 86,104,104,232,219,135, 15, 31,190,114,247,238,221,252,168,168,168, 85, 33, 33, 33,178,230,
-106,254, 29, 17,139,197, 62, 29, 58,116,216, 19, 24, 24,152,209,177, 99, 71, 67, 64, 64, 64,149,175,175,111, 90, 80, 80,208, 46,
- 30,143,231,221, 76,217,238,189,122,245,178,156, 61,123,150,140, 30, 61,154,212, 50, 33,141,210,152, 23, 33,132,132,205,155, 55,
-239,  3,  0,100,222,188,121, 31, 16, 66,134, 85,251,137, 97,181,223,215,125,173, 49, 79, 53,159,235,211,168, 89,234,211,172,239,
- 55,234,252, 14, 26,136,100, 77,249,221,206, 29, 59,118,172,223,177, 99,199,206,214,221,185,231,218,160,231,172,158,238, 58, 93,
-126, 46, 73, 88,254, 22,249, 53,220,131, 92,232,239, 66,238,189, 51,154,228,126,179,158, 76,239, 36,215,142,109,131,112,123,141,
- 86, 92, 92, 28,137,139,139, 35,215,175, 95, 39,169,169,169,164,180,180,148,124,247,221,119, 22, 39, 39, 39, 29,143,199, 91,  9,
- 64, 96,139,152, 84, 42, 85, 19, 66,136, 94,175, 39,203,150, 45,171,170,142, 84,169,100, 50,153,154, 16, 66, 74, 74, 74,200,202,
-149, 43,171,100, 50, 89, 60,  0, 55,133, 66,145,153,146,146, 66, 84, 42, 85,189,102, 70, 46,151,171,239,222,189, 91, 99,156,220,
-229,114,121,194,209,163, 71,141,132, 16,146,149,149, 69, 28, 29, 29,213,  0, 84, 78, 78, 78, 55,142, 29, 59,102, 36,132,144,156,
-156,156,154,116,155,140,150, 78,167, 35,167, 79,159,126, 34, 15, 53,233, 39, 78,156,120,194,128,217,128, 74, 38,147,197,125,247,
-221,119,  6,139,197, 66, 18, 18, 18,106, 76,162,202,193,193,225,250,129,  3,  7, 12, 22,139,133, 36, 37, 37,217,108,  6, 91,183,
-110,173, 33,132, 16,179,217, 76,182,109,219,166,175, 57,166, 53,233,  6,131,129,108,217,178, 69, 47,149, 74,227,  0, 52, 26,125,
- 83, 40, 20, 57,  6,131,129,148,148,148,144,110,221,186, 85, 92,184,112,129,148,149,149, 17, 66,  8,105,221,186,181,  6,  0,252,
-250, 77,254,228,202,253,138,178, 87,223,223,188,223, 59,236,197,229,167,174,102,103,237, 56, 28, 27,167,  8, 26,249,140, 45, 65,
- 77, 30,143,183,210,213,213,181,234,183,223,126,179, 24,141, 70,146,145,145, 65,174, 95,191,254,248, 26,187,117,235,150, 77, 70,
-139,197, 98, 45,188,114,229,138,209, 98,177, 88, 11, 10, 10, 44, 26,141,198,162,209,104,204,117,141, 22,249,146, 77, 10, 78,188,
- 78, 98,162,103, 27, 56, 28,206,194,191, 38,154,  5, 38,217,238, 55,146,108,247,139,219,245,146,162,160,252,250, 62, 66,126,154,
- 77,146, 63,105, 67, 22, 62, 35, 41,183,110,247,139, 35,219,253,199,146,143,251,177,236,210,140, 14, 24, 78,182,251,197,125,250,
-156, 87,225,141,184,107,228,236,217,179,100,203,250,207,200,172,  8,247, 74,235,118,191, 56,178, 53, 96,140, 61,154,181,225,241,
-120,247,207,159, 63, 79,206,157, 59, 71, 22, 47, 94, 76,132, 66, 97,198,211,136,234,145,173,190, 94,228, 11,223,126,100,103,123,
- 87,242,191,126,127,187, 14, 62, 97,110,112, 31,228,203,205, 42,184,113,152,144,162,  7, 36,111,117, 32,121,198,143,221, 82,179,
- 21,164, 84, 42,243,211,210,210, 72, 94, 94, 30, 89,187,118, 45,145, 74,165,205, 50, 91, 99, 71,245, 39,186,146,159, 27, 53, 90,
- 35, 71,142, 36,235,214,173, 35, 38,147,137,116,239,222,221,150, 63, 45,191, 51, 91,126,192, 72,  0, 31,172, 90,181,234,177,201,
-218,188,121,115,220,173, 91,183,226, 60, 61, 61,143,183,224, 88,108, 92,181,106,213, 99,147,181,121,243,102,114,235,214, 45,226,
-229,229,149,217,146,114,105,208,160, 65,159,164,166,166,150,205,159, 63,127,127,223,190,125,151,223,184,113, 35, 43, 38, 38, 38,
- 46, 52, 52,244,153,230,106, 62,133,168, 14,171, 58,178,195, 37,132,176,  9, 33, 53,230,149,  5,128, 93, 19, 80,176,133,151, 94,
-122, 73,216,179,103,207,184,  9, 19, 38,104,119,237,218, 69,210,210,210, 72,124,124, 60, 89,181,106, 21, 89,180,104, 17,249,242,
-203, 47,201,152, 49, 99, 42,187,117,235,118,101,236,216,177,124, 59,178, 25,232,237,237, 93,122,228,200, 17,178,119,239, 94,194,
-225,112, 98,108,221,176, 49, 47,210,144,153,106,200, 96,213, 93,215,136, 17,107,212,176,217,240,123,191, 55, 85,117, 35, 33,181,
-222,255, 47, 42, 42,170,223,239, 30, 62,  4, 75,166,204,249,132,159,186,107, 45,212,223,125, 14,102,137, 26,236,242, 66,232,207,
-199,192,116,254, 40, 94,238,209, 67, 32,160,168,165,246, 94, 48, 92, 46, 23, 92, 46, 23, 28, 14,  7, 90,173, 22, 57, 57, 57,232,
-221,187, 55,227,250,245,235,252,169, 83,167,206, 22,  8,  4, 25,  0, 70, 53,121, 55, 83,143, 34,210, 23, 47, 94,196,235,175,191,
-206,219,179,103, 79, 71,103,103,231,155, 22,139,133, 11,  0, 73, 73, 73, 24, 55,110, 28,111,223,190,125,193,110,110,110,215,141,
- 70,163,144,199,227,129,201,100, 54,168,199,229,114, 97, 50,153,120,237,219,183,143,191,121,243,102, 80, 84, 84, 20, 59, 61, 61,
- 29, 41, 41, 41, 48,153, 76, 92, 95, 95,223, 91,215,175, 95,239, 56,108,216, 48,118,102,102, 38,210,211,211, 31,231,195,150,252,
- 26, 12,  6,240,120, 60,212,174,210,162, 40, 10,122,189, 30, 92, 46,215,102, 45, 22,139, 53,192,223,223,255,214,205,155, 55, 67,
- 71,142, 28,201,185,118,237, 26,178,178,178, 96,177, 88,184,  1,  1,  1,183,110,222,188,217,105,196,136, 17,156,248,248,120,168,
-213,106,216, 90,133, 86,243,189,155, 55,111, 98,194,132,  9,220,147, 39, 79,118,114,117,117,141, 55,155,205, 92,  0,184,117,235,
- 22,198,141, 27,199, 61,117,234, 84,104,171, 86,173,226,155,168, 74,100,  2,128,201,100,194,212,169, 83, 69, 82,169, 20,153,153,
-153,176, 90,173,176, 88, 44,  0,128,194,226,194, 91, 55,111, 37, 36,189, 60,254,185,126, 58,163, 94,127,233,106,236,157,182,173,
-189, 60, 40,138,180,110, 34,171,163, 68, 34, 81,198,234,213,171,223, 78, 75, 75,227,249,251,251, 51,146,147,147, 81, 94, 94, 14,
- 14,135,243,248, 26,179,117,191,185, 92,110,255,192,192, 64, 86, 85, 85, 21,172, 86, 43,  0, 16,  6,163,254, 22, 43,252,146,243,
-  8, 80,153,217,  2,129,160,255, 95,242,244, 46, 11,116,130, 21,131,210,243, 13, 60,158,131,135, 68,236,234, 11,100,156, 67, 27,
-103, 30,152, 12, 38,255, 90,138, 86,  4,144, 65,240, 44,112,178, 79,211, 58, 40, 69, 99,224,153, 28,131,197,110, 30,158, 40, 44,
- 44, 68,171,182,254,168,226, 58,115, 47, 62,168, 20,131,178, 83,243,255,233,211,190,125,123, 23, 31, 31, 31, 20, 20, 20, 32, 52,
- 52, 20,114,185, 92, 14, 96, 80,179, 31, 58, 95,121,241, 80,134, 94,  0, 99, 53, 44,212, 98,152, 88, 43,240, 32, 63,148,108, 15,
-101,255,157, 76,150, 84,204,189,188,239,219,239,220,157, 60,  3,128,152, 87,161,114,224, 97,231, 27,161,142,206, 50,222,145,102,
-154,173, 32,149, 74,117,230,202,149, 43, 10, 62,159,143,235,215,175, 35, 48, 48, 16,107,215,174,117,150,203,229,231,154, 23,217,
- 34, 32, 84,195, 38,171,111,223,190,152, 57,115, 38,246,236,217,  3, 71, 71, 71, 76,152, 48,161, 41,179, 69,146,128, 31, 63,141,
-143,255,106,207,195,135,199, 94,106,215, 46,106,130,175,239,178,105, 47,188, 48,249,205, 55,223,196,103,159,125,134, 35, 71,142,
-160, 87,175, 94,152, 50,101,138, 41, 35, 35, 99,119,115,171,170, 86,175, 94, 61,107,246,236,217,117, 53,141,233,233,233,159,182,
-168, 92, 42, 44,188, 21, 31, 31,159, 52,126,252,248,126, 85, 85, 85,250,171, 87,175,222,241,246,246,246,  0,208,186,185,154, 45,
- 48, 88, 20, 33,132, 15, 64, 88,189,136,  0,  8,247,237,219, 39, 27, 57,114,164,180, 58, 77, 80,189, 52, 89,189, 31, 24, 24,232,
-113,255,254,253,236,119,222,121, 39,116,207,158, 61,  2,161, 80,136,146,146, 18,124,241,197, 23,248,224,131, 15, 64, 81, 20,  8,
- 33,248,242,203, 47,133,147, 38, 77, 10,123,248,240, 97,182,151,151,151, 45, 77, 90,120, 98,177,248,192,178,101,203,164, 86,171,
- 21,115,231,206, 45, 48, 26,141, 51,171,215,205,119,112,112,184,140, 71,134,187, 49,234,245, 34,181,158,149,199,234, 28,155,168,
-186,105,117,215, 17, 66,162, 26,211,176,243, 92,212,247,123, 49,141,153,173,218, 79,160,254,245,186, 72, 32,196,197,219, 15,165,
- 63, 29,128,128, 69, 65,192,172, 94, 88, 20, 24,201,183,208,138,207,134,137,144,160,230, 26,173,154,133,205,102, 67,171,213,194,
- 98,177,224,131, 15, 62,224,157, 62,125,218,137,193, 96,124,223,148, 78,109,195,116,239,222, 61,  4,  4,  4, 80, 63,254,248,163,
-106,230,204,153,130,154,223, 41, 45, 45,133,143,143, 15,117,226,196,  9,229, 71, 31,125, 36,110,204,204, 80, 20,  5, 14,135,131,
-217,179,103, 11,174, 94,189,234,232,230,230,134,228,228,100, 20, 21, 21, 65, 44, 22, 99,246,236,217,130, 43, 87,174, 56,187,185,
-185, 33, 45, 45, 13,165,165,165, 16,139,197,118, 27, 45, 14,135,243,196, 54, 20, 69,193,104, 52,218,101, 12,100, 50,217,222,184,
-184, 56,103,153, 76,134,248,248,120,152,205,102,200,100, 50,204,154, 53, 75, 16, 23, 23,231,236,224,224,128,164,164, 36, 16, 66,
- 32,149, 74,237,202, 35,  0, 88,173, 86, 36, 37, 37,161,117,235,214, 56,119,238,156,114,218,180,105,252,154,244,  7, 15, 30,192,
-195,195,  3,231,206,157, 83,138, 68,162,189, 13,105, 89,173, 86,228,230,230, 34, 49, 49, 17,201,201,201,200,207,207, 71, 65, 65,
-  1,202,203,203, 97, 54,155,  1,  0,194,242,178,152,125,251,127,188, 41, 16,  8,132,129,190,237, 61,111, 37,220,214,  8,  4,  2,
-161,151,167,167, 47,240, 49,163, 17, 67,248,125,122,122,186,211,164, 73,147, 56,121,121,121, 40, 46, 46,  6,139,197,250,221,181,
-197,229,218,214, 20,200,108, 54,  7,240,249,124,202,104, 52, 62,142,128,113,185, 92,188,189, 87,139,192,133,120, 98,121, 97,189,
-  6,196, 98,130,193, 96,  8,248,211,163, 89,  0,  5,202,208, 30, 20, 21,122, 57,185,210,177, 79,212,120, 14, 82, 78,  2, 86, 19,
-192, 96,161,127,136,  7,235,200,173, 74, 21,  8, 66,160,135, 63, 33, 77,247,252, 34,  0,  5, 24,125,  0,170,203,233,251,102,167,
- 94,163,223,224,100,103,103,131,195,225,128,199,227, 33,116,192,179,172,125, 55, 77, 46,160,208, 17, 70,248,217,162,249, 68,216,
- 81, 32, 88,176,104,209, 34, 81,109,205,201,147, 39,139,100, 50,217,162,102,155,172, 74, 97, 15,152,201,236,196,108,109,235,101,
- 49,121,  1, 15, 53, 58, 63, 16,242, 14, 96,234,244, 20,204, 86,127, 30,143,151,  2,160,119,139, 76,150,132,123,233,219,111,191,
-115,119,108,245,200,100,193, 92,  5,176,  5,112,113,118,192,206,183,195, 29,157, 29,  4,246,154,173, 32,149, 74,245,203,229,203,
-151, 21,124, 62, 31,113,113,113,224,112, 56,224,243,249,232,208,161,  3,182,111,223,238,236,232,232,104,183,217, 34, 32,245,198,
-124, 71,141, 26, 69,250,246,237,139, 25, 51,102, 96,247,238,221, 48, 24, 12, 88,182,108, 25,210,211,211,109,146, 77,  2,126, 92,
- 25, 31,191,107, 69, 98,226,189,121, 65, 65,254,163, 68, 34,199, 25, 19, 38,200, 62,250,232,163, 99, 71,143, 30,253,106,216,176,
- 97,  5, 87,175, 94, 93,  7,224,128,157,135,151,  2,176,121,205,154, 53, 51,106,140,219, 71, 31,125,244,229,209,163, 71, 87, 12,
- 27, 54, 44,247,234,213,171,239,  0,216,220,146,114,201,106,181,198,124,255,253,247, 55,  5,  2,129,208,207,207,207, 51, 33, 33,
- 65, 35, 16,  8,132,158,158,158,190,253,250,245, 99, 52, 71,179, 57, 40,149,202,129,151, 47, 95, 14,196,163, 78, 99,188, 26,163,
-149,144,144,224, 80, 86, 86,230, 32, 22,139, 29, 92, 93, 93, 37, 53,102,107,244,232,209, 14, 44, 22,171,209,235,182,162,162,226,
-232,252,249,243,101,163, 71,143,174,249,140,243,231,207, 99,247,238,221, 16,137, 68, 79,124,119,196,136, 17,120,253,245,215,229,
-  6,131,225,123, 27,178, 59,113,234,212,169,126, 42,149, 10, 11, 22, 44,208,103,103,103, 15,  4,144, 14, 64, 22, 17, 17,241, 73,
- 66, 66, 66,183,176,176,176,253,  0, 58, 55,118,239,213,231, 69,106, 27, 29, 91,210,154,251,125, 91,205, 86,157,164,  6,199,208,
-122,194,104, 69, 69, 69,157, 69,  3, 61,169,140, 69,106,240, 96,129,128, 73, 65,200,172,101,182, 96,  5,171, 84,  3,170, 25,189,
- 84,234,123, 24,114,185, 92, 48,153, 76, 24, 12,  6,216, 58, 81,117,141, 41,144, 74,165, 16,139,197,208,233,116, 48,155,205,224,
-243,249, 53,102,  4, 82,169, 20,108, 54, 27,108, 54, 27,124, 62,255,119,209,164,186,209, 28, 14,135,  3,145, 72,132,220,220, 92,
-164,167,167,195,106,181, 66, 44, 22, 67, 36, 18,129,203,229, 34, 39, 39,  7, 57, 57, 57, 32,132, 64, 36, 18, 65, 36, 18,193,158,
-  6,215, 22,139,165,222,135,191,201,100,178, 43,162,101, 54,155,113,231,206, 29,100,100,100,128,207,231, 63,222, 87, 30,143,135,
-  7, 15, 30, 32, 47, 47, 15, 66,161, 16, 82,169, 20, 50,153,204,102,221,154,125,145, 72, 36, 16,  8,  4, 40, 46, 46,134, 86,171,
-125,124, 76,165, 82, 41, 68, 34, 17, 74, 75, 75,161,209,104, 26,221,119,139,197,130,156,156, 28,228,231,231, 35, 51, 51, 19,  5,
-  5,  5,143, 11,160,234,168, 81,203,  2, 59,101,101, 40, 44, 44,124, 28,137,108,104,177,  5,171,213,138,242,242,114, 92,190,124,
-153,178, 90,173, 40, 41, 41,177,230,231,229, 89,166,231,112,113,228,227,173,228,187,147, 55,170,246, 29,143,211, 29,250, 37, 81,
-183,249,208, 45, 29,191,219, 98, 51,254, 10,182,  4,201, 96, 98, 71, 22, 84,152,120,249, 70,142, 76, 21, 20,  1,164,156,  0, 24,
- 44,128, 47, 71,247,224, 54, 72, 47,182,136,238,170, 13,124, 80, 24,140,205,190,114,155, 52, 45,236, 65,249,229, 38, 94,154,209,
- 89, 26, 16,210, 25,106,181, 26, 60, 30, 15, 60, 30, 15, 93,122, 69, 32,165,208, 34,188,157,173, 19,130, 32,210, 38,205,255,167,
-173, 88, 44,238,209,187,119,111,170,182,230,208,161, 67, 65, 81, 84,  7,  0,254,118, 21,114, 27,219,114, 97, 20,118,  7,139,204,
-190,157,171,117, 59,146, 80,229, 59,124,212,179,142, 27,126,214,  4,220,201,211,123,131,152,230,128, 24, 59,183,192,108,245,147,
- 72, 36,199, 54,109,218,228,205,231,243, 79,  0,232,211, 28, 17,177,128,185,109,193,140,241,238,242, 26,147,101,210,  2, 44,  1,
-192, 22,  0, 44,  1, 92,148, 10, 44,125,125,144,163,144,207, 62,100,135, 97,221,183,121,243,102,231,186, 38,171,102,  9, 13, 13,
-197,194,133, 11,157, 29, 29, 29,247,218,162,183,122,213,103,164,164,180, 20, 32, 64, 89, 89,  5, 86,175,250,172,184,102,221,232,
-209,163, 73,159, 62,125, 48, 99,198, 12,172, 88,177,  2,199,143, 31, 71,247,238,221, 49,101,202, 20,132,133,133, 53, 37, 29, 41,
-147,201,246, 68, 68, 68, 92,206,145, 72, 94,207,237,220,153,251,139, 76, 86, 58,176,180, 84,230,149,144, 96,244,  3,110,  1,216,
-146,149,149,245,140, 29, 38,235,  5,169, 84, 26, 55,112,224, 64,163, 68, 34,201, 88,187,118,237,244,153, 51,103,226,179,207, 62,
-195,252,249,243,191,  0,240, 26,128, 15,179,178,178,220, 26, 51, 89,127, 84,185,244, 71,149,117, 22,139, 37,243,192,129,  3, 97,
- 70,163,209,163,186,122,144, 87, 82, 82, 34, 45, 42, 42,146, 24,141, 70,145,213,106, 21, 57, 56, 56,136,  1,  8, 95,126,249,101,
-214,237,219,183,  3,204,102,115,118, 99,154,121,121,121, 47,206,157, 59,183,160,160,160,  0,  0,208,161, 67,  7,148,148,148,224,
-221,119,223,197, 91,111, 61,234, 16,220,169, 83, 39, 16, 66,160, 86,171,177,122,245,106,117, 94, 94,222, 43, 54,100,183, 93,251,
-246,237,145,144,144,128, 59,119,238,252, 12,192,138, 71,237, 88, 75,111,220,184,113, 51, 63, 63, 31,123,247,238,229,184,187,187,
- 31, 69,  3, 67,188, 52,230, 69,154,  3, 69, 81, 49,205,217,174, 38,114, 85, 95, 68,172,  1, 26,143,104, 69, 69, 69, 81,181, 95,
-159,136, 24, 81,136,207,136, 61,  7,199,160,206, 79, 68,179,132, 76, 10,  2,169, 12, 41,153,233,224,128, 74,124, 90, 70,171,184,
-184, 24,211,167, 79,215,189,248,226,139,133, 86,171,245, 89, 91, 77,129, 76, 38,131, 76, 38,195,237,219,183,201,152, 49, 99,212,
-107,215,174,213,213, 54, 90,247,238,221, 35,145,145,145,154, 69,139, 22, 85, 52,102,180,106, 34, 90, 43, 87,174,212,245,239,223,
- 63, 63, 49, 49,145,212,152, 41,177, 88,140,213,171, 87,235,194,195,195,213,215,174, 93, 35, 53,105,246, 68,180, 24, 12,198, 99,
-163, 85,123, 27,  6,131,  1,171,213,106,151,209,170,172,172,124,113,216,176, 97,234,164,164, 36, 82,179,159, 50,153, 12,107,215,
-174,213, 13, 26, 52, 72,157,152,152, 72,106,210,164, 82,169,205,102,176,230,247, 37, 18,  9,164, 82, 41,110,223,190, 77, 34, 35,
- 35,213, 27, 55,110,172,170,157,126,231,206, 29, 50, 98,196,  8,117,121,121,249,139,141,153,151,154,234, 60,179,217,140,170,170,
- 42, 20, 20, 20, 32, 51, 51,243,113, 56, 93, 39,146, 62, 51,254,249,225, 29,117, 58,157,246,246,189,251, 25, 29,130,  3,149, 58,
-157, 78,155,158,145,113, 15,248,216,218,136,246,179, 65, 65, 65,133,211,167, 79,215, 21, 23, 23,183,216,104,113,185,220, 36, 22,
-139, 69,250,244,233, 67, 12,  6,  3,201,204,204, 52, 21, 20, 23,155,253,151, 47, 39,137,111,191, 77,  9, 98, 99,121, 98,177,152,
-170,214,100, 36, 39, 39, 91,  5,  2, 65,210,159,110,180, 24, 86, 23, 80,164,247,111,247, 43, 28,  6, 13, 31,199,165,242,174,  2,
-198, 10,128, 39,  7,120,114,176, 68, 78, 24,210,167, 19,115,215,229, 50, 23, 16,107, 79,112,120, 30, 77,106,178,137, 10,176,246,
-249,233, 94,149,188,247,216, 89,220,162,162, 34, 48,153,204,199,166, 72, 40, 18, 97,224,168,151, 25, 95, 94,213,187,  0,164, 23,
- 40,166,135, 29,247,250,251, 11, 22, 44,224, 20, 23, 23,131,193, 96,252,191,166, 80,136,105,211,166,241,164, 82,233,124,155, 11,
-191,  3,  1, 28,176,121,221,  1,242,214,221,188, 42,183,163,183,116,126,115, 86,238, 20,  4,117, 10,195,212,254, 74,193,202, 24,
- 77,208,205, 76, 93, 27,192,242, 54,204,134, 46,205, 48, 91,125, 36, 18, 73, 76,108,108,172,112,232,208,161, 88,189,122,181, 72,
- 32, 16,156,104, 78,193, 95, 89, 97,153,185,100,227,215,234,248,117,131,  1, 99,229, 35,131, 85,107,209, 84, 88,177,112,231,153,
- 82,147,137,140,183, 85, 83,167,211, 77,124,237,181,215, 10, 15, 29, 58,244, 59,147,197,231,243,145,154,154,138,101,203,150, 21,
- 21, 21, 21, 53,249, 80, 92,187,102,117, 92,194,205, 95,241,229, 23, 75,  0, 16,108, 90,251,  6, 46,253,246,173, 67,255,126,125,
- 73,235,214,173, 73, 88, 88, 24,166, 79,159,142,165, 75,151,226,238,221,187, 80, 40, 20,120,227,141, 55,208,175, 95, 63,172, 89,
-179,166,177, 66, 42,114,230,204,153,203,178,178,178,252,126,250,233, 39, 86,126,126,190,114,205,142, 29,165,  7, 75, 75,139, 86,
- 36, 36,220,253, 48, 56,184,253,188,144,144, 87, 26, 25,250,161, 94,147, 53, 99,198,140,125, 89, 89, 89,161, 63,255,252, 51, 59,
- 63, 63,223, 99,198,140, 25, 88,181,106, 21,230,207,159,191, 29,192, 84,216,214,225,197,230,114,137,201,100, 62,243,236,179,207,
-118,212,233,116,218,187,119,239,102,  4,  7,  7, 43,117, 58,157, 54, 35, 35,227,222,217,179,103,173,205,209,108, 14,133,133,133,
- 15,247,238,221,123,111,214,106, 89,229, 44,  0,  0, 32,  0, 73, 68, 65, 84,172, 89,161, 89, 89, 89,  1,  0,156,202,203,203, 69,
-229,229,229, 60,131,193, 32,144,203,229,242, 78,157, 58, 41,166, 76,153, 34,190,113,227, 70, 64, 86, 86, 86, 69,117, 20,169, 65,
-140, 70,227,221,226,226,226,168,193,131,  7,151, 20, 23, 23, 35, 36, 36,  4,195,135, 15,135,139,139, 11,220,220,220, 48,114,228,
- 72,248,250,250,162,176,176, 16,227,199,143, 47,202,207,207, 31, 12, 32,217,134,236, 62,204,203,203, 67,207,158, 61,177,100,201,
-146,168,231,158,123, 46,177, 79,159, 62,101,193,193,193, 90, 15, 15, 15,255, 13, 27, 54,192,221,221, 29,  7, 14, 28,112,229,241,
-120,123,235, 49, 89, 13,122, 17,  0,249,213,134,199, 80,231, 53,191,137,117,182,110, 91,239,123, 27,190, 87,215,108,213, 94,126,
- 87,117, 88,255,  9,  1, 22,238, 62,176,171,138,235,233,  3,153, 95, 71,  8,249,124,  8,184, 92,  8,228, 78,208, 91,173,216,145,
-154,167,173, 36,100,190,189, 23, 79,221,  7, 33, 69, 81,248,252,243,207,205, 61,122,244,168, 58,115,230,204, 38,157, 78,231,137,
- 71,163,202,218,108, 10, 54,110,220,168,157, 61,123,246, 77,141, 70,211,145,207,231, 27,106,210, 55,109,218,164,125,249,229,151,
- 19,178,178,178, 66,133, 66,161,182,161,246, 89,181,141, 22,143,199,211,107, 52,154,176,201,147, 39, 39,109,217,178,165, 82, 40,
- 20, 66, 36, 18,129,199,227, 25, 52, 26, 77,199,233,211,167,223, 92,181,106,149, 86, 32, 16, 64, 36, 18,217, 85, 45, 71,  8,249,
-157,161,170,157,110, 43,102,179,249,140, 70,163,233, 56,123,246,236, 27, 27, 54,108,168,172, 49, 64,181,243,184,102,205, 26,173,
- 88, 44,182, 43,162, 85,243, 61,145, 72,132,245,235,215,107,103,205,154,117, 83,163,209,116,228,241,120,134, 90,233,149, 51,103,
-206,188,161,209,104, 58,154,205,230, 51,141,252, 27,179,148,149,149,129,197, 98, 33, 33, 33, 65,207,225,112,192, 96, 48,240,224,
-193,131,199,133,143,163,163, 99, 96,199, 14,193,254, 95,239, 59,112, 86,192,225,241,122,132,117,  9, 72, 78, 75,207, 34,132, 74,
-107, 34,171,135,117, 58,157,231,153, 51,103, 54,245,232,209,163,234,243,207, 63, 55, 55, 20,217,178,  5,189, 94,127,246,250,245,
-235, 38, 62,159, 79,229,230,230,154,153, 76, 38, 44, 22, 11,209,135,133,233, 59,108,216, 64,110,207,155, 71, 73, 69, 34, 22,135,
-195,129, 80, 40,164, 78,158, 60,105,208,106,181,103,255,124,163,  5, 33, 40,  8,238,107,244, 18, 62,195, 76,225,222,225, 71, 38,
-139,239,  0,240,229,  0, 95, 14,119,119, 15, 92, 77,213, 74,192,  0, 23, 22, 27,198, 16, 35, 68,  4, 10,194,  4, 53, 36,108,174,
-128,202,203,203,123,108,136,106, 22,111,159,  0, 92, 79,175, 16,131, 34, 60, 48, 97,207, 16, 36, 81, 78, 78, 78,172,220,220,220,
-223,105,  6,  6,  6, 50, 77, 38,147,237, 67,187,228, 88, 92,  1,235,140,123,121, 85,174, 63,220,172,244,123,123,197,151,  2,129,
-165,  4,136,221,136,160,182,110,120,123,108, 39,238, 71, 71,243,131,174,165,105,219,130, 73,166,194, 90,225,108, 71, 62,123, 75,
- 36,146, 19,215,174, 93, 19, 74, 36, 18, 36, 39, 39, 35, 44, 44, 12,209,209,209, 66,161, 80,120, 28,128, 93,237,241,174,168,145,
- 94, 81,110,233,241,254,129,140,188,248, 92,243, 19, 38, 43,191,146,224,181, 79,143,150, 20,151, 85, 61,123, 57,179,225,251,167,
- 30,110,148,148,148, 68,206,159, 63,191, 48, 63, 63,255,  9,147,149,158,158, 94,243, 80,236, 15,160,201, 63,191,255,251,245, 84,
-232,242,165,179,113, 45, 54, 17, 67,162,222,194,245,248,135,248,112,238, 40, 56, 72,  5, 56,115,230, 12, 70,143, 30,141, 37, 75,
-150,224,193,131,  7,248,238,187,239,168,232,232,104,234,242,229,203,212,167,159,126, 74, 53,209,164, 97,194,138, 21, 43,112,237,
-218, 53, 12, 29, 58, 20,231,206,157, 67, 81, 81, 17,190, 61,113,226,254,222,251,247, 63,172,105,179,213,192,208, 15,245, 34,149,
- 74,231,172, 88,177,  2,177,177,177,143, 53, 11, 11, 11,177, 98,197,138, 44,  0,111,216, 99,178,236, 41,151, 66, 66, 66,252,247,
-237,219,119,150,207,231,243,194,194,194,  2, 82, 83, 83,179,  0,164, 53, 67,179,172, 37, 53, 85,  5,  5,  5, 23,163,163,163, 47,
- 15, 24, 48, 64, 56,113,226, 68,231, 35, 71,142, 56,105,181, 90, 55, 30,143,167, 52, 24, 12,220, 59,119,238, 48, 15, 30, 60,232,
-114,251,246,237,212,170,170,170,171,182, 28, 15,141, 70,115,245,238,221,187,131, 67, 66, 66,238,108,218,180, 41,203,213,213,213,
- 58,101,202, 20,188,246,218,107,112,118,118,182,172, 95,191, 62,163, 79,159, 62,  9, 15, 31, 62,140,208,106,181,183,108,204,235,
- 87,203,151, 47,191,176,111,223, 62, 12, 31, 62, 28,159,126,250, 41,190,253,246, 91,252,250,235,175,130,223,126,251,141, 27, 29,
- 29, 13, 14,135,131,238,221,187, 35, 50, 50,114, 96,117,117,167,173,207,165,107, 20, 69,197, 80, 20,245,115,157,215,107,141,173,
-179, 99,219,134,222, 55,250,189, 58,217,140,174,179,216,206,132,182,248,120, 90,176, 68,123,241,165,238, 36,111, 74,111,162, 30,
- 23, 64,206,247,115, 36,147,219, 81,149, 19,155, 57,188,131, 78,167,123,188, 28, 58,116,136,184,184,184, 84, 74, 36, 18,187,135,
-119,112,113,113, 81,151,149,149,145,174, 93,187, 22, 57, 59, 59, 63, 30,138,192,213,213, 85, 93, 89, 89, 73,186,119,239, 94,164,
- 84, 42, 31, 15,239,224,225,225,145, 73,  8, 33, 94, 94, 94, 57, 13,233,153,205,102,226,226,226, 82,211, 67,143,237,232,232,184,
-181, 91,183,110, 69,106,181,154,184,186,186, 62, 30, 58,193,217,217,121,117, 88, 88, 88,221,244,166,242,155,153,149,149, 69,178,
-178,178, 72,171, 86,173,114,106,167,167,167,167,147,244,244,116,226,225,225, 97,247,240, 14,206,206,206,171,234,201, 75,179,242,
-232,233,233,169,214,233,116,164,103,207,158, 79, 28, 83, 79, 79, 79,117, 85, 85, 85, 77,186, 77,195, 59,  8,  4,130,169,124, 62,
- 63,135,207,231,231,240,120,188,101,173, 91,183,214,236,223,191,159,172, 95,191,190,166, 75, 58,156,  3, 71,244,240,233,249,202,
-135,206,129, 35,231,180,100,120,  7,137, 68,242,139,139,139, 75,229,161, 67,135,158,184,190,116, 58,157,205,195, 59,  8,  4,130,
-172,138,138, 10,171, 90,173, 54, 93,184,112, 65, 27, 27, 27,171, 77, 72, 72,208,166,166,166,234, 10, 53, 26,163, 90,173,214,149,
-150,150,234,111,222,188,169, 23, 10,255,154,225, 29, 72,180,175, 15,217,234,127,244,225, 18,239,219,179,251, 10,171,110, 45,237,
- 72,200,247,163,  9, 57,254, 26, 33,103,222, 39, 87,183, 79, 33, 61,189,121,150, 11,239,182,186, 71,182,249,253, 96,203,144, 12,
- 36,186,131, 15,217,234,127,252,254, 98,239,219, 19,251,184, 85,237,216,178,158, 92,185,114,133, 36, 36, 36,144,228,228,100,114,
-252,240,126,210,179,173,240,145,230, 86,255,163,118, 14,243,208,139,199,227, 85,172, 93,187,150, 92,190,124,249,177,230,209,163,
- 71,137, 80, 40,212,  2,182,245, 90, 38,  0, 69,182,  6,142, 50,111,241,251,237,163, 65,226,242,194, 99,239, 19,114,107, 23, 33,
-209, 65,132,124,213,141,144,253,195,  8,249,241, 21,114,121,253, 88,210,203,155, 99, 34,219,252,206,145,237,129, 54, 55,182,103,
-179,217,101,135, 14, 29, 34, 57, 57, 57,228,220,185,115, 36, 54, 54,150, 36, 37, 37,145,140,140, 12, 18, 19, 19, 67,216,108,118,
- 21,154, 49,109, 89, 55, 21,188, 34,218,115,114,111,174,236, 69,200,145,241, 36,127,239,  4, 18, 21, 44, 41,234,222,170, 69,227,
-209,117,114,114,114, 42,136,137,137, 33,169,169,169,228,236,217,179, 68,169, 84, 22,  0,176,185,189,108,212,144, 62,132, 24,110,
-146,240,190,193, 36, 36, 36,152,244,235,213,158,100, 63,220, 72,194, 58,183, 38, 91,183,110, 37,106,181,154,180,110,221,154,216,
-155,177,136,136,136, 43,132,144,184,161, 67,135,198,  1, 56, 25, 17, 17, 17,151,146,146, 18, 23, 22, 22,118, 25,141, 15,253,208,
- 32,  3,  7, 14, 52, 18, 66,200,208,161, 67,  9,128,156,136,136,  8,146,146,146, 66,194,194,194, 12,205, 57,120,182,148, 75,161,
-161,161, 61,  6, 12, 24,240, 97,104,104,232, 28, 91,134,119,104, 66,243,105, 13, 66,205,196,163,193, 63,  3,  1,116,169, 94,  2,
-170,211,152, 45,208,124,133,205,102,239,112,116,116,252, 85, 46,151,159, 97, 50,153,209,  0, 94, 66,243,198, 55, 99, 84, 71, 24,
- 79, 59, 59, 59, 63,  8,  9,  9,209, 13, 30, 60,152, 12, 25, 50,132,204,152, 49,131, 88,173, 86,178,127,255,126,178,100,201, 18,
-210,206,201,201,188, 30, 40,216,  6, 76,  2,205,163,  1, 75, 39,181,165,206,190,216,  6,229,227,219,160,226,213,118,148, 45,  3,
-150, 70, 52,100,180,172, 86, 43,185,119,239, 30,  9, 15, 15,175, 20,137, 68,217,176,125,192,210, 39, 52, 21, 10, 69,172, 82,169,
-252,221, 32,154,181,210,159, 24,176, 84,169, 84, 94,116,117,117, 85, 59, 59, 59, 95,175, 79, 83,161, 80,196,186,186,186,170, 21,
- 10,197, 19,131,123, 50,153,204,161, 10,133, 34,187,110, 58,139,197, 26,160, 84, 42, 51,235,166, 55,176,239,112,113,113,201,204,
-201,201, 33,249,249,249,196,211,211, 51,167,174,  1,203,203,203,123,194,128,217,162,217, 84, 94, 26,201, 99,189,154, 54, 28,211,
-230,156,247, 26,124,221,221,221, 53,107,214,172, 33, 98,177,248,137, 46,207,126,125, 95, 93,112,229,126, 69,217,107,115,183,238,
-175,103,192, 82, 91,  7,  7, 29, 44, 18,137,178,195,195,195, 43,239,221,187, 71,172, 86, 43,177, 90,173, 13, 25,173,250, 52,159,
-233,210,165, 75, 97, 65, 65,129,165,188,188,220,156,153,153,169, 79, 73, 73,209, 45, 93,186,212,152,159,159, 95, 85, 81, 81, 97,
-136,143,143,215,187,186,186,230,  3,120,198,222,115,212, 76, 34,234, 86,159,145,237,  1,189,200,182,128,152,164, 69, 94,119, 94,
-233, 38,210,199,173, 25, 74,200,153,247,201,229,173,175,145, 30,222,220, 71,134,104,187,255,  9,242,165,111, 95,178,177, 45,215,
- 38,205, 29,237,250,144,237,254, 39,110, 47,244,186, 51,186,179,179, 97,223,174,237,228,193,131,  7,228,232,193,189,164,123,155,
-106,147,181, 45,224, 52,217, 26, 16,110,139,102,125,102,107,231,206,157,228,193,131,  7,228,135, 31,126,176,213,100, 69,212,103,
-180, 62,136, 16,151,188,214,141,175, 31,223,137,107, 24, 25,196, 49, 70,250,112,204, 61,189, 88,150,142,174, 12,107,128, 51, 72,
-164,159, 64, 79,182,249,157, 35,219,  2,  6,219,154, 79, 46,151,155,129, 90, 99,234,212, 93,120, 60, 94,126, 35, 70, 43,162, 73,
-179,229,203,203,253,101,201,  0, 50, 60, 68, 82,104,163,201,106,234, 90,234,164, 80, 40, 10,190,250,234, 43,162, 82,169,242,109,
- 52, 89,143, 53, 71, 68, 69,146,244,135,199,201, 15,251, 87,144,240,190,  1,100,207,206,217,228,202,185, 69,100,216,144,112, 18,
- 17, 17, 65, 10, 10, 10,200,128,  1,  3,136,189,249,148,201,100,123, 42, 42, 42,226, 78,157, 58, 21, 23, 17, 17, 17,183,103,207,
-158,184,243,231,207,199,  9,133,194, 61, 53,193,137,186,102, 43,224,247,229,127, 68,157,136, 86, 92,121,121, 57, 57,117,234, 20,
-137,136,136, 32,123,246,236, 33,231,207,159, 39, 66,161, 48,174,185,247,145,173,229,210,160, 65,131, 22,164,166,166,150, 45, 92,
-184,112,127, 61,  3,150,218,170,249,224, 41,229,243,169,148, 33,127,129,166, 68, 32, 16,196,221,188,121,147, 20, 23, 23,147, 96,
-149,138, 44,103, 50, 73, 22,135, 67,114, 56, 28,178, 21, 40,250, 23,216,164, 41, 13, 85, 29,254,209,212,107,180,170,170,170,200,
-187,239,190,107,224,243,249, 90, 14,135, 99,239, 20, 60,255,232,139, 80,161, 80, 92, 84,169, 84,106,149, 74,245,132,217,171,157,
-174, 80, 40,174,255,203,111, 64, 95, 14,135,147,206,102,179,159,156,130, 39,112, 68,143,118,189, 38,206, 87,  5,141, 24,210,194,
-124,114, 56, 28,206,  7,124, 62, 95,251,238,187,239, 26, 42, 42, 42,236, 49, 90,  0, 48, 72, 40, 20,102,239,222,189, 91,119,255,
-254,125, 83, 81, 81,145,249,202,149, 43,166,216,216, 88,195,199, 31,127, 92, 46, 20, 10,179,209,240,176,  4,127,202,241, 36, 27,
-219,114,107,204,214,173,249, 94, 73,195,131,133,198,232,119, 34, 73,143,214,117, 76, 86,195, 35,185,215,175, 89,109,182,110,124,
-228,153, 20,238, 43, 54,175,152,255, 54,233,222, 70,240,164,201,178, 67,179,174,217, 18, 10,133,229,139, 22, 45,178, 39,146,245,
-164, 33,220,225,231, 73,182,251,239,121,100,162,154, 88,182,250,125, 65, 62,247,243,252,187,220, 71,221, 84,240, 26,232,203, 75,
-180, 35,146,101, 75, 62, 59,201,229,242, 59,118, 68,178, 30,107,126,254,249, 38, 50, 97,220, 32,242,240,206, 33, 82, 81,120,156,
- 92,191,180,150,140, 25, 17, 74,186,119, 15, 35,219,183,111, 39,119,239,222, 37, 93,187,118, 37,205,200,103,228,180,105,211,226,
- 82, 82, 82,226,146,147,147,227,206,159, 63, 31, 55,106,212,168, 56,  0,145,181,107,130,106,204,150,113,204, 24,125, 39,  6,227,
-237, 38, 52, 95,152, 54,109, 26, 73, 73, 73, 33,201,201,201,228,252,249,243,100,212,168, 81,  4,246, 77,223,211,172,114, 41, 52,
- 52,180, 71,120,120,248,252,206,157, 59, 15,121, 90,154,255, 65,163, 37, 26, 61,122,180,213, 98,177,144, 33, 67,134, 88, 54,  0,
- 37,209, 20,165,142,166, 40,245,118, 32,255,223, 30,209,250,163, 39,252,140,  0,240,115,237,  4, 62,159,175,174,170,170,114, 22,
-139,197,135, 43, 42, 42,102,225, 81,183,200, 22,105,254, 17,249,164, 53,255, 21,154,174, 98,177,120, 83, 69, 69,197, 40, 62,159,
-159, 95, 85, 85,165,178, 67,211,129,199,227,189,205,231,243,195,181, 90,173, 47,  0,136, 68,162,123,122,189,254, 87,157, 78,183,
- 14, 64,201, 95,189,239,100, 99, 91, 46,184,220, 46, 32,152, 23,151, 81,217,102,197,169, 34,175,119,  6,200, 51,122,182, 19,165,
-130,109,253, 20,148,254, 42, 53, 41, 93,111,183,166,128, 10,131,133, 61,239,106,154,182,245,167, 63,149,123,205,  9, 23,103,244,
-108, 43,206,  0,193,167,224,105, 47,217,171, 89,215,108,137, 68,162,221,149,149,149,175,  3,248,213,222,125, 39,  7,  2, 56,168,
- 52,185,195,196, 12,  6,105,100, 10, 31, 66,180, 96, 48, 19,144,  7, 53,245,241, 29, 35,125, 31,213,175,185,101,203,102,242,243,
- 79,199,161,215, 22, 33, 87, 83,134,  9, 47,189,138, 78,157, 66,161, 80, 40,176,124,249,114,248,248,248, 96,201,146, 37, 84, 51,
-242, 25, 41, 22,139, 39,248,251,251,183,189,125,251,118,178, 86,171,253,  6,192,233,186,207, 31,127, 32, 92,200, 98,117,212,153,
-205,231,238,  0,177, 77,104,190, 32, 22,139,231,248,251,251,  7,221,190,125, 59, 81,171,213,174,  1,240, 45, 93,214,253, 51, 52,
- 25, 12,198, 58, 47, 47,175, 49,169,169,169,243,  0,236,195,127,136, 63,221,104,209,154,180,230, 63, 80,179,230, 62, 33,127,183,
-124,254,191,217,178,206,  2,133, 54, 32, 84, 22, 56,214,245, 77,152,172,166, 53,  5, 84, 24,204,172,183, 64,161, 21,  8,242, 64,
- 24,235,154, 48, 89,127,174,201,  4, 40,124,220, 72,249,245, 49,  8,213,240,249,162,175,249,122, 88,176, 96,  1, 57,121,242, 36,
-132, 66, 33,116, 58, 29,  6, 15, 30,140, 79, 62,249,132,162,203, 16, 90,243, 79,212,252, 87,194,162, 15,  1, 13, 77,147,144,191,
-107,198,168, 55,147, 13,228, 64,192, 53, 20, 48,223,  5,  3,109,  0,115, 58, 42,205,121,212,155,233,134, 22,106, 94, 65,  1, 53,
- 27, 76,248,130,107,126,136, 10, 67, 30,245, 70,243, 53,255,128,127,136,  4, 31,255,125,207,203, 63,145,186,166, 42, 54, 54,150,
- 62, 40, 52, 52,182, 51,  5, 79,246, 52,124,252,153, 54, 90, 52, 52,255,112,168,231,238, 24,  1,100, 85, 47,127, 91, 77, 26, 26,
- 26,154,255,160,225,  2,133,134, 27,180,217, 19, 18,108, 78, 67,187,159,105,205,102,105, 50,  1,200,  0, 56,224,209, 24, 36, 53,
- 93,122,155, 26,102, 99,  8,  0, 19,125, 60,105, 77, 90,147,214,164, 53,105,205,191, 88,179, 41,237,127, 98,149,100,125,189, 12,
-163,255,140, 31,142,160, 53,159, 42,131,255, 53,251, 78,208, 17,  4,235,171,151,142,244,121,167, 53,105, 77, 90,147,214,252,207,
-107,254, 43,161,171, 14,255, 89,240,255,177, 57, 39,196, 21, 64,205, 32,151,  9,168,162,252,193,199,108,  0, 64, 57,174, 19,130,
-251,  0,130,171,215,103, 82,148,221,189, 81,105,104,104,104,104,104,254, 42, 66,  1, 92,  7,224, 10, 96, 24,128, 24, 84,143,170,
-240,151, 26, 45,129, 83,123, 87,176, 24, 33,148,149,248,  3,  0, 97, 80, 73, 48, 91,227,117,133,247, 91,252,144, 21,187,249, 58,
- 18,112, 15, 80, 48, 60, 87,145,115,175,197,131,161,  5,251, 74,199,168, 20,146,  9,121,133,165,187, 19,239, 86, 28,177,103, 91,
-153,204, 75,198,119,148,143,213, 27, 77,193, 92, 14, 39,195, 88, 82, 22, 93, 92,156, 92,222,140,108, 56, 54,182,242,227,143,  9,
-117, 44,247, 58,197, 17, 26, 25, 78, 82, 14, 85,129, 10, 82,145, 43,182,122,151,164,146,131,  7,159, 35,246,158, 27,138,129,254,
- 34,137,164, 51,143, 47, 12, 19, 74,228,237,173,  4, 40, 82,103,167, 25, 76,230,243, 22,131, 54,142, 88,241, 63, 59,206,213,203,
-  0, 86,  0,  0,  6, 12,248, 25,193,144, 98, 93, 77,198,241,198,128, 91,120,249,204, 25,212, 12, 46,251,  1,128,149,118,100,215,
-  1,128, 23,128,210,224,224, 96,109, 66, 66, 66,254,211,186, 70, 91,114,222, 27,131,199,227, 11, 76, 38,163,209, 98,177,180,120,
- 98,106,158, 80,186,232,119,211, 43, 81, 12, 84, 85, 20, 47,166,203, 62, 26, 26, 26,154, 63,213,104, 13,195,163, 42,195,166, 27,
-195,123,  5,246,190,198,231, 11,188,  1,192, 74,  8,172,  4,168, 44, 43,137,203, 75,142, 29, 12,  0,138,214,161,167,216,124,105,
-103, 43,121,180,222, 98,  5,204,198,170,212,178,244, 43, 93,109,201,145,200,217,119,244,128,136,129, 99,162,162,134,249,117,  8,
-238,208, 14,  0,110, 37,220,122,120,236, 88,204,221, 51, 63, 83,135, 42,243,239,253,208,162,  0, 10,248,159,116,233,210,169,119,
-108,236,245, 37,  0,102,180,244,  8, 58, 57,137,103,157,254,254,221,190,  3,199,172, 22,  1,246, 61,112,249,142,242,177, 35,135,
- 63,211,233,189, 55,167, 49, 94,123,119,185,247,181, 11,255,251, 76,236, 26, 84, 66,172,166,211,149,234,113,191, 53, 54,113,114,
- 93,255,216,144,193,250,166,232, 36, 99,253, 87, 61,228,186,162,135,227,136,213, 50,142,162, 40, 48,185,194,131,206,109,123,239,
-119,232,255, 78, 49,  0,155,123,140, 73, 93,  3, 35,148,174, 30,135,198,189,250, 54, 95, 40, 83,177,192,228,  0,160,144,147,118,
-  7,103,190, 93, 33,127,107,241,206,208, 11,241,233,230, 95,190,223, 92, 69,113,216, 99,180,185,183,155,174, 79, 79, 79,119,128,
-151,215,163,247, 95,124,177,  0,222,109,110,225, 81, 91, 51, 96, 45, 74,191,206, 65, 48,240,200,104,165,165, 65,110,107, 94,  7,
- 15,125,126, 80, 70,250,253, 37, 57,217, 25, 71, 24, 44,150,181,184,180,242, 29, 39, 39,101, 69, 97,161, 38, 28,213, 13,185, 21,
- 10,133,168,160,160,192,  8,192,248,103,158,247,177,147, 62,249,226,224, 87, 11, 94,175,111,221,244,183, 62, 89,231,229,225, 32,
-122,115,198,228,122, 39,228,238,247,204,228,247,206,158,220,185,170, 73, 67, 44,146, 44,122,246,245,249, 31,247, 31, 16,249, 68,
-250,149, 75,231,177,247,243,  5,168, 44,167,205, 22, 13, 13, 13,205,159, 64, 76,181,185,138,169,187,162, 65,163,197,231, 11,188,
- 47,255,239,152,227, 15,231, 51,  1,  0, 17,161, 46,248,112,233,166,200, 61, 27, 99,239,  2, 64,143,  1, 81,190, 75, 62,120, 19,
- 23, 19, 53, 32,132,160,147,143, 19,134,140,124,206, 54,227,161, 10,232, 58,118,236,179, 47,190,251,238,156, 17, 15, 30, 60, 72,
-219,183,111,223,111,  0,208,167,111, 95,159,229,203,151, 63,191, 90,238,200,251,238,224,247,217, 85,234, 59,215,154,179,183,124,
-183,182,238,126,237,219, 76,248,238,203, 77,140,254,131,159, 29,159,134,202, 21, 85, 57,201,217,182,108,171, 80, 40,102,179,217,
-108, 25,240,104, 54,246, 26,140, 70,226,  2,  0,102,139, 85, 34,119,243, 43,103,114,248, 22, 30,143,115,187,188,162, 98,119, 89,
-246,157, 29,141,105,234, 77,166,160,183,222,152,196,184,145, 92,  8,239,160, 62,204,245, 43, 62,130,213, 98,146,191,253,193,210,
-177,177, 87,190, 67,165, 26,103,109,220, 53,118,221,  4,119,247,238,204, 79, 86,136,  7, 81, 20, 94,241,234,241,234,168, 37,187,
- 14,178,187,248, 72,161, 55, 89,113, 34,174,176,199,214,117,159,172,186,176,117,216,143,  0,182,  3,248,  5, 64,147,166,206,209,
-201,241,155,217,243,215,137, 43, 13,255, 31, 37,169, 54, 89,248, 98,247,  1,220,204,180,194,223,207,159,229, 50,251, 51,241,246,
-165, 83,118,105, 31,205,179, 85,159,221,109, 11,160, 23,144,228,136,169,139,  7,226,235,149,203,160, 84, 86, 66, 34,201,  0,  5,
- 21,128,246,213, 95,188,207, 45, 64, 38,128, 15, 52, 26,136,150, 76,195,224, 27,192,220,142,128,  6,192,  5,170,177, 89,227,137,
-121,197, 91,243, 86,  5, 59,183,  9, 14, 75,184,155,141,203, 49,155,145,159,151,238, 80, 92, 92,176,187,149, 79, 71, 34,146, 57,
-135,150,228,165, 64,234,128, 20,138, 88, 70,150,150, 22,231,  1,176, 41,138,228,226,226,178,200,221,179, 91,223,154,243,238,232,
-213,169,184,102, 29,131,201,250,166, 32,229,218,155,141,109,239,229, 63,124,242,138,205,125,194,147,110,158, 58,144,145, 28,119,
-222,108, 50,234,219,251,133,116,153,244,202,248,231,147,178, 21, 29,243, 75,244,184,121, 43,177,211,202,149,159,174, 76, 76,184,
-117, 75, 34,113,144,183,241,237,216,205, 63,100,232,248, 34,131, 99, 91, 91,140,150,217,108,129,147, 75, 91,176,249, 18,120,168,
-100, 40, 41,215,163, 82,111,134,194,165, 13,204,102, 51, 93,244,209,208,208,208,252, 57,228,226,201,198,239,209, 77, 26, 45,  0,
- 16, 11, 88,184,155,146,  7,  0,112, 16,  0,179,166, 78, 68, 97, 65,190,175,193,108,197,171, 19, 95,194,245,164, 92,220, 77,205,
-  7, 33,  4,190, 30, 54, 79,194, 13, 38,172, 93, 94,157,252,106,191, 83,167, 79, 95, 93, 48,127,193,215, 20,133, 75,  0,176, 61,
-250,139, 30, 11, 23, 45,124,253,165,137, 47, 13, 58,120,240, 96, 34,128,102, 25, 45, 22, 37,217,180,106,229, 50,110, 86, 65, 85,
-213,236,119,231, 89,231,188, 51,123, 61,128,103,109,114, 50,108,182, 44, 43, 43, 75,204, 96, 60, 57,151,230,167,203,230,157, 27,
- 52,102,245,253,180,140,146, 27,167,142, 30,237, 26, 24, 24,136,172,236,188, 94,159,109,216,214,241,196, 41,193,164,242, 50,221,
- 24,109,193,157,122, 39,109,230,177,217,137,139, 63,219,218,201,234,224,195,248,240,245,161,  8,106,231,134,108, 77,  9,250, 14,
- 30,193,138,187,118, 45, 18,176,217,104,213, 29, 60,112,172,193,170,233,184,124,247,149,129,163,122,186,117, 97, 48,152,168,208,
-153,144, 95,170,135,197, 10,244,  9,144,225,153, 61, 27, 88, 69,149,166,209, 75,191,207, 28,125,105, 99,148,186,170, 52,103, 38,
-128, 67, 77,196,  3, 29, 61,148, 82,220,205, 44,175,215,100, 85, 86, 61,122,128,115,152, 22, 80, 32, 78,141,  8,245,  2,240, 21,
-224, 15,252, 52,243, 69,168, 84,251, 84, 42,213, 88,165,202, 37,206,247,197, 73,148,187,119,128,164, 66,103,196,237,196, 91,229,
-129,157, 19, 72,121,145,230,237,170,202,226,131,119,128,  4,127, 96,127,181,198, 36, 52, 98,180,238,223,191, 83, 50,233,133,112,
-214,141,135,229, 72, 22,137, 16,212,115, 20, 74,243,179,216,207, 76, 90,220, 77, 87, 94,202,119, 82,121,225,206,197,  3,200,207,
-120,208,169,202,160,255,193,209,179, 71,248,143, 95,205, 53, 52, 21,221,114,113,113, 89, 52,117,234,212,143,243,115,147, 62, 25,
- 52,102,117, 72, 90, 70,201,141, 23, 23,255,218,117,250,104, 31,156,136, 47,195,178,201,225, 19,  0, 52,106,180,152, 44, 98,225,
-139, 93,188,199,188, 48,115,158,155, 51,127,158, 80,192,128,131,136,139,211, 87, 52,248,238,116, 38, 76,102,130,238, 33,237,125,
-103,189,183,110,151,171, 19, 23,185,  5,  6,100,231, 87, 65, 93, 80,133,138, 66,173,222,166, 11,130,162,160,201, 47, 68,204,143,
- 49,160,216,124, 80, 12, 10, 38,163, 17, 44,  6,  3, 20,131,162,139, 62, 26, 26, 26,154, 63,135,  6,123, 29,178,  0,224,216,177,
- 99, 36, 42, 42,234,119,165,178,197, 66,112, 55,245, 81, 19, 28, 38,147,137, 97,189,125,176,254,179,197,208, 25,204,184,153, 82,
-138, 31, 46,102,194, 80, 89,  2, 66,  8, 10,130,148,245,253,240, 19, 85, 74,171, 87,  8, 66,153, 60,246,184, 11, 87, 68,173, 29,
-229,114,249,253,196,175, 43, 23,190,163, 14, 96, 17, 99,220,210, 79,125, 82, 56,142,172,158,  7, 14,236, 15, 28, 30, 21,197, 21,
-139, 37,239, 19, 86, 71, 15,118, 37,153, 83, 90, 26, 95,218,144,102, 93,  4, 74,255, 17, 35,134, 61, 51,192,197, 69,101,125,113,
-249,149,164, 77, 51, 67, 61,219,251,180,239,117,215,164, 27,161,211,220, 63,218,192,102,143, 53,173, 86, 43, 24, 12,  6,212,106,
- 53, 44, 22, 11,244,122, 61, 76, 38, 19, 50, 51,211,212, 86, 66, 60, 44,176, 50, 92, 93, 61,192, 98,113,225,221,218, 11, 91,215,
-175, 16,238,249,238,104,216,220,  5,159, 28,209, 22,160, 59,254,127,112,203,199,154, 85, 69,197,  7,143,159, 60,237, 76,112,198,
-237,195,215,135, 50, 53,197, 21, 56,115,237,  1,174,223,206,180,247, 68,214, 29,194,161,117,118,250,131,178,213,171, 87, 51,151,
-156,120,144, 57, 96,200,179, 22,175,118, 33,173,245, 22,  2,128,  2,143,195,  2,135,197,128,151, 51, 31,135,231,  5,227,202,200,
-120, 85,100,168,243, 58, 66,200,161,198,142,167, 94,111,178,244,246, 23, 49, 59,182,149, 33,254, 97, 49,174,158,184,132,217,243,
-215, 33, 54, 69,143,242, 10, 45, 40,139, 30, 76,162, 71, 65,122, 50,204, 22, 11,105,234,188, 63, 34,180, 24,  0,120, 60,222,  7,
- 63,252,120,210, 77,111,229, 35,175, 68, 15,117,177, 30, 62,221,199,136,210,179,243,241,213,226,231, 63,  0,112,208, 31, 40,183,
- 65,147,  7, 32, 60, 45,229,158,201, 96,176, 88,171,140, 22, 70,144,167, 12, 59,126,186,134,224,240, 23,170,184, 76,166, 64, 34,
- 83,  0,  4,  8,234,251,  2,174, 30,249, 28, 98,  6,179,179, 64,202,235,  8,224,106, 99,215, 82,141,201, 90,180,104, 17,102, 76,
-125, 30, 86, 66,216, 22, 88, 25,  0,176,229,135,  7,240,242, 86, 54,118,142,254,127,186, 24, 11,131, 50, 26,  9,202, 43, 76,200,
- 47, 49, 64,194,103,225, 94, 70, 37, 30,164, 87,224,249,193,238, 24, 51,208, 21, 22, 43,193, 75,239, 95,199,179,145,174,120, 49,
-202,  3,160, 40, 20, 20, 27,160, 55, 88, 26,220,119,  6,131,209,134,201,100,134, 90, 44,150,235,143, 62, 51, 97,  1, 80, 86, 92,
-  0,189, 94, 15, 38,147,  9,185,163, 51,  0,234,137,239, 90,173,214, 20, 91,239,163,102, 66,107,210,154,180, 38,173,217,108, 26,
-242, 34,255, 16, 26, 28,202,129,209,216, 86, 15, 51,139,112, 55, 37, 15,157,253,221,209,174,181, 43,174,222, 43,198, 55,103, 50,
-177,243, 84, 58,206,220,204,135,149, 37, 65, 94, 25,112, 63, 77,141,251,233,  5, 77,142,159,205,228,177,199,189,245, 86,233,187,
- 29,  2,203,186,255,239,196, 44,184, 59,223, 15,156, 59,183,100, 22,147,199, 30, 39,111, 37,217, 55,239,221,183, 39, 72,132, 66,
-174, 65,111, 64,219, 54, 94,252, 55,103,206,154, 68,201,121, 54,207,137, 36,113, 15,144,243,  4,130, 29, 75, 63,126,159,183,238,
-135,251, 25,149,  6, 84, 30,186,164, 78,158, 51,111, 97, 17,139,205,223, 42,113, 15,176,185,237,143,201,100,130, 94,175,135,193,
- 96,128,209,104, 68,118,230,157, 17,191,252,240,222,224, 54,173, 28,  7,243,248,124, 16,  0,101, 58, 51, 82,114,181,  8, 31, 56,
-136,217, 57, 52, 52, 72,236, 26, 48,185, 62,173,210,210,244, 82, 43, 97, 74,142, 29,222,203,220,255,211, 13,124,125,236, 26,142,
-252,122,  3, 87,207,158, 48, 19,171,233,241,252, 95, 98, 87, 31, 95,177,107,135,116,177, 91,136,250,241,226, 30,220,232,240,204,
- 76, 38,131,132, 15,140,248,121,234,140, 55,255,167, 45, 47,212,236,216,180, 56, 59, 63, 39,237, 14,143, 67,153,133, 60, 38, 42,
-170,204,216,245, 75, 14,198,174,184,137,219, 25, 21, 32,132, 52, 57,129,183, 21,120,103,220,228,247, 44, 38,163, 17,126,158, 98,
-236,141, 94,137, 17,225, 29, 49,160,131, 28, 93,219,137, 32,100,233,145,152,116, 23,223,238,221,101,182, 90, 25,115,154,184, 17,
-159,169, 94,226,  0,160,162,162,226,189,185,239,207,201, 55,152,173, 48,154,172, 48, 86,191,254,242,237,167,249,150, 42,237,123,
-213,219,197,213,218,174,161,155,121,227,107,211,231,134,239,248,230,231,255, 99,239,187,195,163,170,214,238,215, 41,211, 75,122,
- 38,  9, 33,  9, 36, 64, 66,239, 16, 80, 64,122, 64,186, 32, 69, 64, 65,154, 10,138,162,130,162,130,212, 75,175, 42, 40,136,244,
-222, 59,132,170, 32, 29, 18, 32,129,144,222, 39,109,122, 59,237,247,199, 36, 16, 32,101,  2,222,251,221,223,247,101, 61,207, 60,
-147, 57,156,243,178,219,217,123,237,245,190,123,239,238,251, 46,102,145, 57,249, 14, 68,159,216,131,128,160, 48,136, 41, 82, 14,
-  2,  0, 65,  0,  4,  1, 65, 16,224, 27,210,  0, 86,158,199,222, 95,190, 13, 68,  5,241,106, 37, 36,107,252,248,241,120,240,224,
-193,115,245,158,240, 56,  9,  9,143,147,112,230,228, 85,  0,128, 87, 72,243, 66,175,144,230,133, 62,161,173,215,149,101,203,206,
- 49,188,133,229,144, 93,100,133, 66, 70, 34, 56, 80,129,129, 93,  2,176,250,155,166, 24,209, 59, 16,233, 57,102,140,159,115,  7,
-126,126, 34, 28,184,152,133, 85,219, 19, 80, 47, 68,137,  1, 93,106,224,253,190, 53,203, 86,107,105,186,151, 72, 36, 26, 62, 96,
-192,192,217, 82,153,114,193, 39,115,182,206,146, 75,233, 18, 53, 22, 20, 69,129, 97, 24,144, 36,129,161,159,174,158, 37, 85,168,
- 23, 12, 24, 48,112,182, 72, 36, 26, 78,211,116,175,234, 73,103, 53,170, 81,141,106,252,219, 20,173,146, 79,192,115,253,118,121,
- 79, 88,173,150,164,119,134,142, 68,128,198, 95,213,255,173,247,197, 55, 19,138,160,205, 74,193,227,248, 24,152,173, 12,196,158,
-161,128,204, 31,181,106,135,224,110,220, 65,199,170,197, 71,141, 60,107, 75, 42,207, 94,191,126,  1, 53, 31, 63, 36,200,197,139,
-130,175,198,199, 21,182,220, 54,243,119,140, 24,161,242, 89,188, 40,248,106,242, 19, 37,169,144,  9,237, 63, 24, 61,156, 32,  9,
-  1, 95,127, 61, 13,253,251, 68, 97,204,  7,163,136, 63,254,216, 20, 89,228, 98, 46,121,136,214,204,248,118,182, 36,167,136,181,
- 95,139, 55,218, 20, 74,185,252,207, 71, 70, 83,163,218,193,242,222,131,222,207, 60,186,251,183,229,  0, 70,187, 98,171,132, 96,
- 49, 12,  3,135,195,  1,  0,156, 83, 61,112,126,231, 27,236,200, 45,178, 33,167,200,  6,150,227, 49,104,232,104,249,245, 27,119,
- 70,  3, 40, 39, 94,139,231, 25,150,193,190,211,183,144,113,125, 15, 79,144,148,174, 84, 48, 60, 84,  1,117,195,253,253,131, 47,
-246, 25, 52,202, 87, 34,115,186, 97, 13, 38, 27,254,248,101, 81,133,233, 36,  9, 66,224, 57,182,136,101, 24, 83, 88,104, 88, 70,
-253,134,205,100,151,207,159,236,247,231,153,125, 70, 54,108,148, 71, 66,114, 22, 40,145, 20,148, 88,  6,155,195,181,133,135, 57,
-143,175,174,  5, 64,140,253,104,218,138,169, 95,126, 67,125,190,234, 18,236, 86, 51,108, 22, 19,244,186, 66,200,105,  6,177,127,
- 29, 98,  5,142,153,106,202,186,189,182,124, 75, 68, 38,128,204,210, 87, 10, 10, 10,162,255,186,116,241,240,223,127, 93, 26,227,
- 31,214,146,180, 51, 60, 30,199,252,205,103, 60,186,113,216,102,211, 71,  3,  0,  1,228,  3, 56, 89,145,112,169,118,243,112, 31,
-243,241,151, 99, 61,228, 74, 50, 38,189,  8, 41, 89,122,112,242, 64,248,215,172,243,204,191,202, 59,243,219, 38,194, 23, 61,154,
-189,139,203,247, 82,185,147,187,214,118,  7,112,  8,128,185, 34,146,117,243,230, 77,136,197,226,231,234,189, 78,221,218, 40,113,
- 29, 22, 21, 76,246,216,180,248,125,  0, 64,151, 55, 59,142,  7, 48,225,165,137, 74,182, 30,222,118, 22,109, 27,120, 33, 34, 84,
-133,140,124, 59,  4,130,198,238,179,121,120,148,110,194,233,107, 90,  4,120, 73,192,219, 73, 80, 82, 96,223,229, 12, 92,142,205,
-195,200, 94, 65,120,152, 88, 80, 14,177,166, 90,124,254,197,180, 31, 87,174, 92,117,238,157,143, 22, 15,238,208, 34, 12,122,131,
- 17, 25,  5, 12,140, 38,  3, 76, 70, 19,228, 10,  5,164, 18,  9, 40,154, 70,175, 15,230, 13, 62,246,251,183,231, 63,255, 98,218,
-143,203,150, 46,249,158,101,217,227,213,253, 97, 53,170, 81,141,106,252, 91, 21,173,241,165,175,149, 75,180, 82,238, 95,110, 13,
-  0,225,173,122,228,171,100,180, 23, 77, 18,200, 73, 79,192, 31, 75, 62,  5,207, 11,232, 61,110, 49,212,181,253, 33, 23, 83,176,
- 25,243,141,  5,  9, 23, 42,138,213,  1, 65, 48,221,215,174,203,168,253,209,164, 48,183,109,219,140, 34,  0,216,182,205, 40,154,
- 52, 49,200,237,167,117, 73,181,219,190,217, 18,  2,199,161, 79,255,119, 48,116,216, 80, 36,103,155,177,247, 98, 42, 76, 22,187,
- 75,171,229,228, 62,245,155,249,120,251, 70,125,246,126,148,146,166,  8,162, 94,136, 59,149,166,101, 88,138, 18,113,135,175,235,
- 50,  7, 13, 26,230, 19,125,108, 87, 23,206,167,126, 51, 75,222,195, 59,149,217,179,217,108,207,185, 14,189,124, 66,143,117,127,
-103, 73,122, 86,182,225,104,118,161,181,173,137, 97,145, 83,100, 67,110,145, 13, 69, 38,  7,252,213,158, 96, 25,123,147,242,236,
-  9,130,176,121,192, 59, 35, 71,  1, 32,  9,146,253,221,152,245, 48,222,249, 47,207, 72, 86, 84,255, 17,190, 23,111, 38,224,241,
-141,227,133,  2,207, 58,119,113, 39,248,244,138,203, 21,  2, 69,128, 23,211,  4, 67,145, 36,239,112, 24, 25,141,198, 55,250, 66,
-244,137,190, 86,246,  9, 40,177,244,233,189,150,231,221, 81,149,145,173, 53,  0,176,114,213,138,165,237,187,143, 16, 95,184,149,
-  4, 11,  3,180,107, 17,142,  3, 59,127,181,  9,  2,243,165, 41,235,246,154, 42, 52, 66,143,160,160,160, 79, 69, 18, 73, 23,185,
- 66, 29,228, 27, 16, 76, 58, 88, 14, 14,134,131,210, 59,144,148,170,188,186,243,164,248, 50,235,176, 71, 59, 76,218,149,  0,202,
-229,215,167,175,222,239,242,203,202,165,131,  3,188,149,  8,242, 17,227,240,133, 66,142,161,121, 82, 19, 18, 65,  0, 64,176,198,
- 13,247,111,157,199,221,187,247,208,164, 93, 20,188,213, 53,161, 18,115, 66,222,227, 63, 11,252,252,  3,155,231,100,103,136, 95,
- 36, 90,254,254,254, 63,140, 28, 57,114, 86, 64, 64,  0, 86,172, 88,241,244,122,233,122,111, 12,180, 45,237, 58,252,105,255,227,
- 10, 51,252, 65,159, 90,120,179,153,  6, 60, 15, 76, 89,126, 23, 49,  9,122,172,159,209,  2,131, 58,  7, 98,221,193, 36, 52,173,
-167,132,209,194,195, 97,231, 32,150,144,104, 16,170,130, 84, 76,225,220,173, 60, 24, 76,166, 10,109, 19,148, 20,221, 59,183, 67,
- 94,145, 25,190,238, 18,132,  6,249, 66,165,  8,133,193,194, 34, 37, 91,  7,157,137, 65, 94,161,  9,111,180,107,131, 83, 91, 36,
-213, 93, 96, 53,170, 81,141,106,252,103, 84, 45,160,212, 30, 90,207, 17,173, 35, 71,142,  8,  0, 80,150,127, 52, 35,167,  0,222,
- 42, 26,190, 53,106,227,189, 79,151, 98,243,242,207,193,113, 12,  4,  1, 96, 57,215,118, 38, 16,  4,209,233,143, 39,213,174, 95,
-171, 54,229,251,222,  8,133,101,235, 54,179,252,189, 17, 10, 75,227, 38,222,186,143, 39,213, 78, 50, 88,131,223, 96, 57, 14,127,
-198,230, 34, 38, 73,135,152,100, 61, 84,114,215,183,249,162, 36,226, 73,139, 22, 46, 16,211, 20, 65,196,166, 24,141,233,249,172,
-145, 18,137, 28, 10,185, 68,176, 11,180, 45, 57, 79,200,239, 58,224,  3,203,225, 45, 43,199,  2,248,164, 92, 85,172,120,165, 97,
-137,146, 85,242, 45,  8,130, 64,  0, 60, 79,112, 92,122,158, 21, 70,  7,131,156,194,103, 68,139, 96,203,247,156,170,  2,234,134,
-187,169, 85, 39, 40,138,146, 10,  2,192, 56,216,119, 17, 80,183,167, 49,235,113,124,105,146,117, 53, 54, 19,  9,183,207,228,112,
- 14,243, 72,115,110,220, 89, 87,243, 78, 16, 16, 40, 10, 60, 69, 18, 60, 65,128, 23,145,130, 29,130,192,191,152, 34,115, 21,136,
- 86,  9,217,146,136,168,153,167,118, 44,215,140,121,187,  1,118, 94,116,114, 62,171, 65,171, 55,101, 84,137,100,193,219,219,123,
-244, 87, 95,125,245, 67,191,119, 70, 64,103, 37,144, 83,232, 84,  3,237, 12, 15,177,210,  7,221, 63,222, 24,148,165,213,  7, 61,
-190,118,248,141,188,219,219,116,140, 85,183,162,220,116, 37,100, 94,179,152,139,252,161,230,  0,  0, 32,  0, 73, 68, 65, 84, 77,
-208, 91,156,249,153, 54, 58,130,250,110,237,105,176,  2, 13, 47,223, 64,248,186,137,241,254,187,189,112, 49,164, 22, 30, 60,124,
-136,153,179,143,194,207,195, 45,230,202,249, 67,117, 90, 68,118, 88,118,108,255,246,151, 72, 92,118,118,246,236, 45, 91,182,160,
- 89,179,102,179, 90,182,108,137,236,236,236, 18,130,252,180,222, 19, 30, 59,  5,219, 18,162,117,235,214, 93,180,104,209,180,220,
- 60, 55,169,227,134, 61,231, 50,177,241, 72, 50,228, 82, 10,181,  3,101,152,180,232, 54, 58, 55,247,193,228, 33,161, 80,201, 67,
- 80,100, 96, 96,103,120, 88,108, 44,242,245, 14,100,228, 91,145,150, 99,129,131,169, 56, 22, 94,128,128,152,248,116,216,108, 86,
-120,122,122, 66,165,176, 66,230, 17, 12,128, 66, 97,142,206,185,250,208,108,133, 66, 46,173,238,250,170, 81,141,106,252,127,131,
-138,184,200,255, 71,170,214,203,138, 86, 69, 25, 18,  4,224, 81, 74, 30,106,213,244, 69,205, 90,117, 16,255,224,110,169,206, 30,
- 96, 57,215,220, 81,135, 14,101,165, 47, 93,234,198,127,254,185,174,221,162, 69,193, 87, 38, 77, 12,114,111,220,196, 91,247,213,
- 87,169,237,150, 45,115,191,114,250,170,136, 19,138,247,235, 42,217,155, 75, 16,170,178,199, 38,217,166, 89,195, 80,106,246,182,
- 71,169,103,239, 25,114,197, 98, 49,227,239, 41, 35,212, 42,  9, 69,145, 34,137,141, 33,109,225,141, 90, 80,135, 73,162, 69, 69,
- 86, 74,136,214,139,174,195,124,109, 66,191, 83,123,167, 53,126,107,192, 98,175, 12,173,  5, 58, 59,245,212,117, 72,145,  4,238,
- 61, 72,  1, 40,113, 76, 89, 54,221,212, 94, 39,183,111,221, 28,188,108,209, 60, 56, 88, 14, 31,127,254, 29, 62, 24, 61,242, 36,
-  2,234,246, 12,174, 29,113,243,210,225,223, 21, 61, 39,254,140,148,184, 27,217,172, 77,191,163, 42, 36,235, 41,217,  2,  4, 78,
-224,201,130, 66,189,202,198, 66,134, 50,120,159,205,193,191, 82,203, 49, 90, 88, 28,254, 59, 27, 71,246,239,128,187, 90,249, 74,
- 54,220,221,221, 27,116,236,216,  9,  4, 45,129,157,177,193,206,242,176,151,138,209,114, 48, 60, 24, 65,  4, 69, 64, 83, 20,220,
- 63,208,  0, 86, 93,185,182, 70,141,234, 81,208,176, 73,203,221,223,126, 62,110,200,144,247,198,160,109,228,155,136,187,251, 23,
-252,130,234, 67,229,225, 35, 92, 73, 42,100,219,213, 15,166, 71,247,111, 77, 68,215, 12, 67,237,  6,237,241,232,254,245, 38, 98,
-177,248, 94,234,227,135,229,186, 36,179,179,179, 75,246,156,154,213,178,101, 75,164,166,166,162,160, 84,189,215,169, 91, 27,  0,
- 16,255,208,185,136,161,132,100,241,124,217,237,116,252,130,219,208, 91, 56,248,120, 74, 64, 17, 36, 32,  8,168, 21, 32,199,141,
- 71,  5, 24, 57,187, 16,145, 13,189, 16, 28,160,  0,  4,  1, 70, 43,  3,187,157,135,131,  7,236, 86, 22, 20, 89,238,146, 65,142,
-227, 56,142, 20, 24,234, 86, 76, 60, 36, 98, 17,220,139, 76,144,203,229, 16,139,243, 64,144, 36, 88,150,135,131, 97, 96, 49, 91,
-176,251,198, 85,  8,156,131,226, 56,142, 67,177, 27,180, 26,213,168, 70, 53,254, 27,241,255,113, 32,124,105,114, 85,190,162, 85,
- 17, 66,106,250,225,239,152, 36, 52,169, 31, 10,119, 55, 53, 30, 38,164,131, 34, 69, 32,  9,128, 97, 93, 39, 67,130,131,217,185,
-108,153, 59, 82,146,148,228, 79, 63, 39,213,254,120, 82,237,164,101,203,220,175,  8, 14,102, 39,128,145,130,  0, 56,201,150,147,
-112,113, 85,224,  5,  2,207,  4,249,121, 41,168, 27, 79, 76,249, 36, 73,217,188,221,101,188,183,187,148,244, 86, 75, 68, 98, 17,
-197,179,  2,233,168,169,169,109, 21,120,222,149,115,245,158,115, 29,114, 28,  7,130, 32,185, 98, 34,166, 76,203,183, 64,103,165,
-144, 83,100, 67,161,193,129,122,129, 74,156,137,222, 99,230, 24,203,182, 50,213, 54,145,216,189, 78,237,154,248,102,206, 50, 88,
-108, 28, 30,101, 24, 33,150, 74,253,253,252, 27,221, 25,249,209,116,233,148,245,  9, 24,219,197, 27,159, 95, 74,200, 48,231,200,
-166, 87,165,102, 57,142,131,197,106, 23,231,228, 21,122,234, 13, 38, 55,185, 76,106,241,245,114,207, 43,235, 94,171,253,213,198,
- 89,133,140, 70,223, 72,127, 88, 29,195, 97,177,177,248,235,236,190, 87, 49, 19,234, 87,163, 38,140,246, 82,228,170,152,108,149,
- 38, 93, 34,149, 47,  0, 34,180,178,108,223,191,119,243,221,251,247,110,254,120,253,202,133,237,139,126, 59,219,120,203,154,239,
-177,250, 96,  2, 40,138, 34,  4,134, 21,173, 60,152,132,154, 30,148, 96,100, 68,132,149, 35, 96, 42,208, 34,162, 77,175, 70,219,
-215,126, 59, 29,206, 45, 35,108,174,144,173,194,156, 27, 79,235,253,196,241,167,235, 22, 80,120,103, 83, 81,194,185,213, 78,138,
- 79,209,123,202,102,237, 14,187,198, 93, 34,112,172,131, 47,189,163,149,187,156,128,192,  3,215, 99,115,112, 43,158,132,183,155,
- 24, 42,185,  8, 12,203,195,108,103, 97,177,114, 36,207, 58,108,229,212,247,173,149, 43,150,127, 63,124,248,240, 73, 59,118,205,
- 58,212, 44,234,179,126,250,162,124,136, 36,114,136,105, 49, 72,138,  4,203,113,176, 91, 77, 40, 44, 42, 64,210,159,127, 28, 26,
- 58,100, 96,139,149, 43,150,127, 95,178, 74,177, 26,213,168, 70, 53,170,241,111, 83,179, 94,130, 75, 68, 75,165,144, 65,160,100,
-184,116, 51,  1, 17, 13,155, 98,211,161,107,168,219, 36, 18, 89,  6, 22,  2,200, 74, 87, 27,150, 96,218, 12,203, 45,  0,183,250,
-245, 83,212, 28, 56, 48,176,187, 32,136, 78,255,188, 78,159, 14,  0,161,141,157,102,120, 94,128, 32,  0,  2,239, 36, 92,174, 75,
- 58,116, 74, 82,150,190, 86,109,127, 37,238,167, 59,108, 74,169,152,244, 84, 74, 40, 95,119,137, 88, 76,211,224,  4,194,150,149,
-149, 96, 35,128,100, 87,204,189,232, 58, 84,168,  2,142,117, 29,176, 88,155,156,170,187, 81,175,192,220, 76,231,144, 64, 16,128,
-122,129, 74,196, 92, 61,202,229,100, 60,126,100,201,137,251,165,108,149, 12,148,131,229,113,231,137, 14, 69, 38,  6, 69, 70,  7,
-222,232,220, 87,252, 70,183,126,184, 20,147,  7,158,101,176,232,215,163,  6, 78, 96,134,  2, 15,152, 42,100,154,252,251, 86,108,
- 77,109,161, 73, 42,162,233,162,250,117, 67, 18, 37, 98, 17,171,215,235, 37,207,223, 69, 65, 41,151,160,192,200,  0,  0, 83,213,
-214,163, 51, 49, 56,116, 53, 27,135,247,109,135, 92, 46,135,240, 10, 45, 80, 44, 22,123,136,196, 50, 56, 76, 78,119, 97,201,199,
-241,194,135,164,165,  0, 73,123,184,104,246,129,221,110,249, 43, 41,238,106,  3,174,115, 93,106,116,183,218, 24, 53,126, 42,  2,
-235, 52, 65,223,190,  3,209,180,182,154,216,119, 37, 21, 12,195, 26,252,195, 26,169,  5,231, 42,219, 71,  0,154,  1,184,234,138,
-178,165, 46, 85,239, 13,222,  8,107,246,140,104,  1,  5, 41,183, 43, 92,197,202,217,243, 51,204,118,146, 20,  4,190,204, 41,131,
-  8,128, 96,  7,114,178,  4,100,  3,160, 73,128,166, 72,128, 32, 40,142,227,202,172, 39,150,101, 79,241, 60,159,179,117,235,214,
- 28,142,227,110,221, 60,186,244, 78,157,183, 38,206,  2, 91,  0,134,113,134, 51, 74,164, 10,240,  4,137,132,139, 27,103,113, 14,
-203,193,173, 91,183,150,108,239,112,175,186, 47,172, 70, 53,170, 81,141,127, 11, 74,159,113,248,118,105,242,229, 18,209,226,120,
-  1, 62,222, 94, 96,  4, 26, 73, 57, 58,152,  8, 13,172,102,  1, 28, 71,128, 19,132,138,182, 26,239,134, 50,150,231, 31, 58,148,
-149, 14, 96,195, 11,154,212, 83, 37,235,233,119,217, 46,153, 50,109, 18,  2,119,230,208,241,243, 67,250,117,232,226,249, 48, 43,
- 59, 93, 44, 34,105, 90, 76,137,196, 52, 73,136,105,210,238, 38,167,169, 61,235,118, 72,  4,  2,231, 43,179,105,181, 90,209,173,
-219,243,  7,147,199,197, 94,209, 20,228, 62,178, 11,  4,207,251, 74, 12,240,113,247, 69, 98,114, 42,206, 30,223,103,206,201,120,
- 28,199,217,172,253,241, 60,229,124,102, 83, 16,248,  2,157, 13, 86,  7,135, 66,163,  3, 69, 38,  7, 88,223,118, 56,240, 87, 38,
-100, 98, 10, 57,119,246, 88,180,217,233,159,218,114, 31, 39, 85, 82, 21, 95,227,185,189,180,132,244, 15,199,140, 22, 45, 95,178,
-200,214,162, 69, 75,161,160,160,  0, 70,163,241, 89,153, 16,  4,100,110, 26,168,229, 52, 30, 95, 63,134,199,103,151, 89,  0,124,
-235, 74,121,150,134,155,130, 70,191,182,254,176, 57,134, 35, 79,103,195,245,243,  7, 42,107, 50, 47,217, 84, 40, 20,242, 18,245,
-170,244,182, 14,246, 82,170, 22, 87, 92,223, 36, 45,149,151, 97,179, 59,128,211, 47, 94,212,235,116, 71,111, 93, 57, 51,201, 58,
-126, 20,114,138,108,176,228, 39,224,143,  3,191,156,117, 24, 30,117,238,177,124,  9, 57,181,127, 29,156,189, 85,160,190, 71, 83,
-  0, 15, 68, 13,159, 54,248,196,246, 37, 91, 42,203,123,  9,217,234,212,161,245, 44,146, 34, 14, 11,196, 51,178,148,153,153,233,
- 82,222,117, 57,143,139, 21,164, 42,249,192, 65, 16, 36, 37,240,207,157,129,248, 92, 58,121,158,191, 87, 66,154,104,130,232,175,
- 86, 40,144,167,213,161,100,147, 93,171,197,  0, 47,159, 26, 32,  9,  2, 76,169,123,171, 90,239,175,128,106,155,213, 54,171,109,
- 86,219,252,191,138,151,206, 56,172,130,162, 37, 32, 44, 64,137,186,129, 74, 88, 29, 26, 88,237, 28, 76, 86, 14,122,179,  3,122,
- 51,131,164,108, 51, 98, 14,189,126, 10,157, 42,150,115,235,115,193,185,223, 38, 56, 94,112, 89, 61,145, 56,236,115,150, 46,154,
-255,238,142, 22,205,237, 83,222, 14,  8,186,155,100,207, 36,  8,210, 66, 82, 52,227,165,166, 69, 15, 31,222,213, 94,185,120,172,
-163,140,229, 70,153, 43,176,195,178,172, 46, 48, 48,176,100, 64,123,122,189, 65, 29,121,255, 63,143,126, 29,218,169,223, 34,223,
-229,243,166,153, 73, 74,204, 19,180, 56,134, 99, 44,219, 45, 57,113, 63,163,  2, 93,143, 20,203, 30,252,125,251,126,164,135, 87,
- 16, 30,103,152, 96,178,178,112,176, 60, 60, 85, 98,164,223, 59,233, 72,122,120, 99,151, 49,243,238,166, 87, 40,182,109,241, 15,
- 98,106, 70, 69,245,124, 39, 50,178, 29,245,253,247,223, 33, 34, 34,  2, 22,139,  5, 36, 73, 34,168, 86, 29, 36,197,223,198,213,
-163,115, 56,115,126,242, 47,  0,126,  4, 80,229,  3,151,243,244,118, 28,191,145,139,163,251,119,130, 18,189,210, 10, 54, 82, 46,
-151,203,202, 34, 87,165, 73,215,211,155, 69, 18, 25,156,234, 19,255, 92, 67, 44, 27, 39, 18,226,239, 63,120,255,189, 97, 13,212,
-238, 30,232, 61,112,104,238,149, 75,103,251,236,255, 99,221,138,252,228,180,119,191, 91,176,202,173,123,171,  0,194, 75, 37, 65,
-145,137,199,182,148,  7, 97,112, 81,131,205,206,206,158,157,150,116, 99,228,159, 71,191,238,219,169,223, 34,223, 27,123,103, 62,
- 13,162, 39, 41,122,107,101,207, 23,164,221, 60, 91, 85,146, 85, 66,181,  4, 65,112,201,113, 46,  0, 16,137, 37,208,104,  2, 64,
- 16,  0,195,242,176, 51, 44,104, 81,245, 74,195,106, 84,163, 26,213,248, 15, 99,252, 11,223,174, 41, 90, 86,171, 53,233,205,110,
-125,193,243,  2, 56,  1,224,185, 98,229,137,127,166, 62,113,140, 53,233,117, 83,199,243,220,181, 53,235, 55,244,110,209,166, 19,
-213, 48, 88,  5,125,126, 54,174,254,121,142,  5, 47, 92,113,229,249,252,252, 71, 70,185, 95,221,119,222, 29, 60,112,247,232, 49,
- 19,139, 58,118,238,172,212,104,252,109,233, 25,233,230,141, 91,182, 50, 39,143, 29,236,200,131, 29,150,159,255,216, 88,145, 29,
-157, 78,183,178,172,235, 82,137,234, 13,  0,161, 20, 77,216, 45,218, 71, 85,138,  8,207,203, 72, 27, 52,127,206,172,228, 17,227,
-166, 74,194,  2,235, 32, 87, 71, 33, 41, 61, 27, 15, 47, 30,180,101,196, 95,223,175, 79,191, 53,214, 69, 83, 89,101, 92, 75,  7,
-176,252,234,213, 43,141,162,162,162,122,118,233,210, 69, 24, 63,126, 60,  4,  1, 56,187,126,146, 80,144,116,117, 79,177,138,245,
-228, 21,235, 37,229,226,149,219, 94, 67, 58,182,162,189,213, 99,177, 97,231, 49,  6,  2,159, 82, 69, 51,126, 53,131,107,209, 78,
-119,161,115, 75,135, 23, 63,118,230, 89,252,152, 88,229, 71,155, 17,227, 87, 78,126, 95,226, 26,143,227,239, 55,121, 28,127,127,
- 12,128,220,221, 91,127, 61, 12,  0, 54,139,101, 98,244,217, 67, 41,247, 99,111,140,234,247,222, 23,117, 26, 53,107, 77,239,217,
-180, 28, 14,171,105, 31,  0,151,219,171, 84, 66, 37,151,212,123,101,174,194,151,234, 61,249,234, 49,130,164,104, 87, 73, 83, 41,
- 37,146, 20,120,222,165,128, 58,129,231,144,241,228, 30,188,252,131,161, 86,187,131, 23, 28,128,221,  6,109, 90, 28, 56,174,250,
-172,195,106, 84,163, 26,213,248, 15,225,213, 99,180,210, 30, 56,247,211,250,119,195,144,157, 59,114,211,166,205,115, 55,111,217,
-241,134,213,110, 15, 20, 32, 78,227, 88,251,  5, 35,135,239, 93,181, 97,201,121,124,195,219,187, 94,227,141,191,174,249,118,227,
-134,159, 58,129,231,234, 19, 64,178, 64,224,188,140,225, 70, 87, 70,178, 42, 28, 52,243, 12,235,186,191,179,196,146,159,111,220,
- 92,213,103, 45,249,113,217, 36,229,  8, 90,183, 98,206, 98,146,164,122,112, 28, 47,226, 57,230, 49,231,176,254,203,162,141, 59,
-  4,151,163,220, 80, 80,193,191,197,  2,136,141,142,142,238, 16, 29, 29,221,  6,192, 74, 56,207, 80,188,241, 58,245, 98,203, 55,
-116,253,114,218,151,103,191,  0, 17,194,243,  2, 88,142, 79, 17, 91,204, 93,171,104, 38, 40, 44,172,142,194,193,112, 47,  5,192,
-151, 14,132,127, 74,180,220,107, 42,  0,  4,185, 72,180,  0,231,106,186, 95, 95,186,200,178, 11,179, 50,211,118,254,252,175, 79,
- 39,  0,168, 13,224, 50,128, 53,255,169,122,119, 88,245,121,255,238,247,134,117,216,102,167,223, 61,132,204, 88,113,  0, 65, 59,
-183,114, 16, 56, 59,120,214,158,197, 50,142,217,213,125, 95, 53,170, 81,141,106,252,199,212,172,245,101,253,166,255, 91, 82, 88,
- 88,248,196,128,194,138, 15,233,117,  5,249,249,143,140,  0, 94, 90,185,103,126, 77,187, 49,143,244,123,241, 72,191,247, 85,159,
- 55,229, 38,106,129,196,209,175,153, 12, 87,  2,217, 47, 21,127,254, 17,228,229, 61, 48, 33, 15,109, 95,183, 90,182,109,221,242,
-112,199,142,157, 34,129,164, 68,188, 64,137, 89,129, 16,177, 60, 33, 98, 24, 30, 54,  7,195, 56, 88,150,  1,199, 58,192,115,140,
-192, 59, 24, 56,119,135,255, 39,144,  2, 96,198,255, 84,189,255, 39,192, 50,142,217, 96, 28,  0, 76,213, 93, 93, 53,170, 81,141,
-106,252,119, 17,174,255, 30,162, 85,141,255,213,120,146,240, 56, 62,178,186, 24,170, 81,141,106, 84,163, 26,255,203, 73, 86,233,
-111,  0,206,216,243,110,229, 60, 80,149,213,  4,221, 94, 33, 65,103,170,109,190,182, 77, 17,  0,  9,  0, 21,128,202, 92, 91, 61,
- 81,245, 13, 43,255, 39,242,254, 53,128,219,213,245, 94,109,179,218,102,181,205,106,155,255,107,109, 86,102,187,122, 53,227,191,
-153,128, 85,219,172,182, 89,109,179,218,102,181,205,106,155,213, 54,255,239,217,252,255, 25,227,203,248,  0,168,118, 29, 86,163,
- 26,213,168, 70, 53,254, 15,194,219,187,158, 10,120, 26,215, 91, 41, 20, 62, 13,252,  0,192,156,247, 32,167,186,244,170, 81,  6,
- 74,159,115,248, 92,140, 22,249,138,  6, 69, 36, 45,249, 82,161,246,126,160,116,247,206,248, 63, 94,184, 68,120, 45,229,228,238,
- 29,107, 31,136,  8,149,247,175,202,131, 10,223,240,223,253,235,180, 77, 85,106,194, 39, 35,160,133,252,117, 18,161,212,132,250,
-170,130, 90,253,169, 14,108,212,235,223,144, 71,105,195,134, 13,219, 53,108,216,176, 29,128,127,228,148, 98,133, 38,124,120,205,
-186,145, 23, 53, 97,205,207, 41,253,234, 13,254,167, 19,172, 10,168,235,173, 10,106,185, 87, 85,163,105,161, 42,160,169, 94, 85,
-179,229,  5,181, 79,131,176,202,158, 11,234, 55,191,254,236,237, 49,219,131,250,205,175, 95,214,191,123, 70,173, 82,255,176,227,
-209, 60,239,190,255, 82, 85,247, 43,175,134,160, 55,134,123,  4,116,250,194,187,170,207,  5,134, 71,198,214,106,212, 33,183, 70,
-189,182, 49,174, 62, 83, 51,162,221,173,144,134,111,228,212, 12,111,119,163,186,228, 93,131,204, 55,180,157,204, 51,248,168,212,
- 51,248,152,212, 43,180,243,235,218, 11,  8,  8,144,215,175, 95, 63, 42, 50, 50,114, 66,215,174, 93, 63,107,222,188,249,248,144,
-144,144, 30,255,147, 19,125,133, 38,124,134, 77, 68,228,217, 68, 68,158, 66, 19, 94,233, 98, 25,165, 38, 98, 46, 65,114,153,  4,
-201,101, 42, 53, 17,115,255, 91,234, 74,234, 23, 30,162,208,132, 47, 83,251, 55,188, 38,215,212,235, 91,213,231, 61, 61, 61,123,
-248,250,250, 14, 40,249,120,122,122,246,168,126,  3, 94, 25,165, 85,172,215, 86,180, 40,145, 84,113,121,196,152,143, 27, 47,156,
- 53, 93,182, 98,195,  1,172,152, 55,237,190,205, 84,212,240,191, 49,231, 62,161,109,110, 80, 36, 85,179,244, 53,142,231,210,243,
- 18,175,181,250, 39,236, 71,212,146,143,253,246,171,145,159, 15,127,183, 91, 72,183, 62,159, 18,113,137,150,131,174, 83, 52, 52,
-219,181,119,127,208,197,243,231, 86,109,216,176,254, 71, 45, 27,177, 76, 36,165,215,232,211, 98,139,170,146,  6, 55,223,176, 80,
- 90,233,115,241,205,254, 31,251,223, 60,179,117, 19,103,231,187,155,243, 74,157,254,253,234,240,173, 83,167, 78,107,138,162,188,
- 39, 79,158, 44,  6,128,229,203,151,215,229, 56, 46, 63, 33, 33,225, 58, 94, 97,243, 83, 39,193,140, 24,185,114,241,236,205,189,
-122,245, 70,102,158,  9,139,150,173,125,235,196,145, 93, 67, 76, 57,143,246,252, 19,117,226,225, 81,219, 13, 98,245,189, 79,191,
-250, 81, 19,245, 86,107,202,104,101,113,226,226,237, 14, 91,215,254,120, 13,104,208,198,144,247,160,220, 61,197,120,179,110,166,
-159, 74,136,226,205, 58,  0, 24,254,210, 96,175, 98,186,249,202,185,168,  0, 41,125, 59, 31,168,244,208, 71,143, 90,111,156, 20,
- 73,165, 33, 36, 73,130, 36,  0,146, 36, 64, 17,132,243,156, 80,135, 37, 37,227,225,165,158,255, 13,239,137, 58,184, 77, 54, 40,
-218,155, 36,158,165,143, 32,139,191,  5, 65,159,253,232,178,247, 63,240,223,184, 55,174,235,209,232,141,186,166,141, 23, 18, 11,
-148,116,199,207,142, 18,  2,249, 83,234,165,101,119, 92, 34,  0, 50,153,231,225,195,135,125,163,162,162,220, 53,141,250, 95,112,
-229, 25,  9,101,108,120,228,200, 33,113, 84, 84,207, 42,180,207,240,238, 32,201, 45,  4, 32,226,121, 97, 57,197, 11,187,140,249,
-241,  9, 64,213, 78,159,146,107, 34,198,146, 16, 92,238,103,120, 16, 55, 44,185,113, 27, 94,181,112,105,169, 91, 87,145, 88,252,
- 89,104,120,147, 22, 25,201,143,111,152,140,134,101,172, 77,119,161,202,134, 24,246,203, 51,151,110,246,162, 69, 34, 34,170,107,
- 91,202,  6,156,123,157, 74,247,243,243, 27,176,122,245,234,176,118,237,218,  1,  0, 88,150,117,219,189,123,183,255,156, 57,115,
-148,241,241,241,251, 94,209,108,160,175,175,111,176, 68, 34,  9,  4,  0,187,221,158,161,213,106, 83,  1, 84, 58,241, 87,250,133,
-249, 64,192,143,151, 46, 94,164,  1,160, 67,135,142,115,131,223,252,196,147, 18,171, 44,101, 22,135,221,160, 44, 74, 56, 55,245,
-234,223, 87,  8,  0,136,108,219,110,186,194,167,193,154,255, 73,101, 75,166,137,104, 75,  2,159, 71,118,232, 54,104,232,176,145,
-100,163,122,193,232,209,189,203,215, 22,224,112,149,218, 12, 77,203,175, 93,187, 86,135, 36, 73,138,101, 89,107,100,100,100,234,
-235,164,171, 70,120,187,191,  8,144, 65, 14,214,254,171,246,201,141,185,192, 75,  7,199, 80,238, 65, 45,190,  5, 69,143,227,121,
- 62,205,144,122,163,253,255, 66, 69,235,229,114,174,170, 37,146,150,124, 54,252,131,143, 26, 79,253,226, 27,217,167, 43,162,113,
-116,237,244,188,255, 86,146,  5,  0, 20, 73,213, 60,121,234,164, 70, 33,161,  0,  0, 70, 43,139, 94, 81, 81,149,143,  8,181,218,
-156, 39,  9, 34,162,228, 40,113,142,117,200,104,145,196, 74, 56,  9, 18,  8,  0, 62, 53,106, 69,251,177,151, 21,195,223,237, 22,
-178,101,199,233,244,212,244,252, 42,119,106,  4, 37, 70,100,199, 30,232,214,189,167,251,181,191,255,250,113,253, 47, 63,207, 96,
- 29,204,207, 60,195, 47,179, 22, 60,206,172,180, 51,247,175,215, 82,162,242, 57, 49,104,194, 28,111, 43,233,133,239,231,173,244,
-185,120,124,219,133,140,180,102,124, 74, 74,154, 85, 32,136,251,133,  5, 89,159,153,178, 19,226, 92, 45, 50,149, 74, 21,166, 82,
-169,154, 53,109,218, 84, 54,109,218, 52,209, 91,111,189,245,140,178,143, 31, 47, 62,127,254,124,192,146, 37, 75,122,223,189,123,
-215,106, 52, 26,239, 24,141,198, 39,168, 66,160,189,191,191,239, 39,239, 12,236,139, 46,131, 62,  6,199, 19, 24,255,209, 84,156,
- 60,190,111, 34,128,127,132,104, 49, 10,183, 57,227, 38, 76,243,141,108,221,156,250,113, 91, 28,228, 18, 26, 61, 91, 69, 16, 31,
- 76,158,233,177, 97,213,143,191, 33, 15,157,202, 82,178,120,179,110,102, 99, 31,251,176,126,237, 66,113,104,187,125, 24,186,126,
-  5, 82,225, 62, 55,237,208, 55, 15,  1, 32, 44,106,178, 90,202,105, 87,215,240,160, 52, 82, 78,187, 58, 44,106,242,153, 39, 39,
- 86, 27, 42, 74,139, 72, 42, 13,217,190,109, 91, 61, 79,181, 24, 52, 73,128,162,  8,208, 20,  9,171,157,195,144,119,135,253, 99,
-205, 92,174,169,215,155,116, 30,150, 13, 30,248,221,146,251,232, 88, 85,234,132,160,196,222, 71, 14,237,167, 53,238, 82, 80, 20,
-  1,138,  4, 40,146, 64,114,142,  5, 99,199,126,224,254,186,132,189,215, 27,154,214, 95, 14,141,232, 25,217,216,171,233,206, 43,
-132,123,100,175,161,222,121, 86,197,251, 59, 14,158, 27, 38,116,152,250,183, 32,240,139,211, 47,175, 60, 85,145, 17,155,205,150,
-211, 51,170,151, 27, 65, 43, 21,103, 14,108,234, 72,147,  4, 24, 78,  0,203,  9,224,138,207, 70, 37,138,103, 48, 36, 73, 64,224,
-  5,140, 27, 55, 22, 61,163,122,153,121,150, 79,119,189,147, 35,183,156, 56,243,167,175,141,225,177,100,245,134, 31, 77, 58,237,
-143,137, 15,189,147,141,186,188,169,150,220, 71, 46,159,131, 65, 66,104,149,246, 36,102,194,182, 35, 87,209,184, 97,  3,112,188,
- 51,157, 17, 53,149,216,118,244, 42,234, 71,212,119,166,155, 23, 16, 30,164, 66,235, 86,173,129,151,142, 38,115,149,100,169,191,
-239,244,246,200,217,125,134,140,129,198,215, 23,164,192,244, 57,115,116, 91,159,223,127, 90,252, 37,107,213, 47,169,146, 49,129,
-123, 58, 46,  8, 60,255,218,170, 83,141, 26, 53,124, 91,183,126,182, 29, 35,203,178,168, 93,187, 54, 50, 50, 50, 34, 94,101,158,
- 22, 16, 16,240,246, 15, 63,252,160,233,221,187,183,200,223,223, 31,  0,144,157,157, 29,120,226,196,137, 22, 63,252,240, 67,110,
- 86, 86,214, 81, 84,176,163, 15,199,144, 98,146,  6, 37,147, 41,156,121,  4, 65, 78,251,100, 84, 83,191,128, 26,101, 30,228,174,
-213,102, 75,190,250,248, 28, 65,211,226,226,251, 65, 10,  2, 79, 84,160, 18,117, 19,137, 68,101,122, 40, 28,148, 91,164, 32,114,
-255,144,164, 72,103, 99,101, 25,109, 97,234,173,  6, 85, 80,226, 26,137, 36,226,159,223, 25, 58,166,253,224, 65,253, 17,224,235,
-142, 51,151,239, 98,226, 39,159, 51,172,131, 89,246, 74,157,  7, 69,209,185,185,185,201,158,158,158,254,175, 63,222, 18,161,167,
- 79, 30,215,156, 57, 27, 61,125,233,138, 85,147, 28,118,150,225,  5,225,233, 57,198,114,185, 84,212,189,207,187,110,154, 58,145,
-178, 85, 63,124, 40,250, 95,168,104,173,255, 71,136,150, 68,174,126,247,187,175, 38,203,230,108,189,138,163,107, 39,230,153,245,
-121,190, 79,103, 10,110, 30,183, 76,250,162, 22,175,146, 66,149,111,120, 59,130,162, 39, 16, 20,165, 36, 72, 66,194,115,124, 26,
-107,183,207,181,228, 63,202,122,221,220,243,188,128,189,127,229, 86,141,  0,  9,168,187,101,231,126,141,159,135, 20, 86,  7,135,
-161,195, 71, 98,243,230,205,106, 95,119,  9,172,118, 22,139,151, 46, 53, 24,147,143,106,146,211, 10, 51,186,245,253,252,212,147,
-164,220,152,212, 44,235,174,170,166,205,230,224,160, 55,179, 48,219, 72,212,107,212, 26,139,151,213,151,165,166, 36,126,190,233,
-247,223,166,220,191, 79,109,230, 41,114,182, 53,235, 65, 90,153, 47,157,127,227,158,110,158,222,219,  7, 78,152,231,241, 40,151,
-134,  0,  7, 18,220,100,120,247,253, 41,110, 97,254,114, 40,101,148, 71, 98, 74, 70,192,180, 47,191,188,252,132, 19,218,232,181,
- 79, 18, 43, 75, 79,173, 90,181,  6,245,233,211, 71,241,197, 23, 95,136,130,130,130,240,251,182,221, 33, 29,122, 14,233,155,153,
-149, 19, 36,  8,  2,252, 52,154,180,113, 31, 12, 57,124,236,216,177,148,180,180, 52,209,162, 69,139,218,238,223,191,191, 97,118,
-118,182,203, 51, 83, 78, 16, 96,181,113,224,138,  7, 72,173,206, 86,101,126, 26, 24, 24, 40,205,200,200,176,149, 82, 25,136,103,
- 66, 33,209,179,107,167,182,244,186,227, 73, 48, 90, 57, 40,101, 34, 36,229,152,209,170,121, 19,226, 87,142,109, 86,150,193,177,
-239,190, 61,211, 79, 37, 68,245,107, 23, 10,141,167,  2, 27,215,204,195,161, 43,137, 81, 57, 70,  2,171,  5,106, 66,128,148,238,
-174,228,179, 86,191,213,170,142,127,151,150, 33,184,222,170,142,255,197,155,113,241,242, 33, 75, 39,103, 24, 69,103, 10, 79, 76,
- 49,148,221,241,144,240, 82,139,177,225,100, 10, 20, 50, 26, 74, 25, 13,165,212,249, 77,146,196,235,205,106,  3, 26,  4, 81, 60,
- 55,150,162,232,177,195,222, 29, 82, 99,196,176, 33,  2, 40, 18,187,247, 30,238,191,117,235,150, 44,198, 97,255,141, 35,169, 13,
-229,181,159,231, 10,148,  4, 52,238, 18,124,249, 91, 12,220,228, 34,168, 21, 34,184, 41, 68,232,210,212, 23, 20,249,202, 73,244,
-156,216, 63,172,247,196,129,181, 58, 71,  4,171,234,221, 73,208,221, 31, 59,247,198,138,243, 69,157, 63, 91,179,188,161,183,177,
-200, 78,127, 63,109, 28,157,158,153,217,121,247,225, 11, 93, 56,251,152, 56,214, 97,250, 70,123,119,119,153,170,112,122,220,149,
- 22,129,145,131,101, 14, 35,115,239, 78, 92,122,157, 66,155, 20,177,201,122, 40,101, 52, 84, 37,101, 43,163,161,148,137,160,146,
-209,200, 76, 79, 66,129,137,186,156,225, 77,118,198,133, 43, 85,218, 38,223,234,224,112, 59,209,136, 90, 17,205, 17, 16, 80,  3,
-246,222,239,213,250, 59,122,239,193,107, 23, 14, 44, 48,103, 63,252,198, 85, 59,219,142, 92,197,244,169, 19,110, 18,192,173,226,
- 65,186,197,247, 11,215,182,252,113,250,199,207, 93,155, 54,123, 85,203, 87, 87,178,212, 51,187, 12,252,104,118,135,238,  3, 97,
- 40,200,193, 95,167,118,161,103,159,119,240,222,152, 79,225,225,225,179,120,217,220,175,238,176, 54,125,244, 75,125,174,127,253,
- 55,155, 52,110,176, 53,176, 70,141, 32,158,119,158,242, 33,  8,128,209,160,195, 87,159,141,  3, 47,  8,104,214,162, 77, 23, 89,
-135,238,130, 80,124, 26, 72, 94,126,158, 41,238,225,253,110,214,220,184,191, 93, 46, 75,171,149,209,106,181,184,125,251, 54,226,
-227,227, 17, 27, 27,139,252,252,124,184,187,187, 27, 77,166, 42,237,253,230,214,180,105,211, 17,209,209,209, 50, 79,207,103,135,
- 52,216,237,118,168,213,106,140, 24, 49, 66,212,163, 71,143,192,183,223,126,123,116, 76, 76,204, 54,  0,250, 50,211, 83,240, 56,
- 83,237, 23,241, 75,167,183, 58, 77,  2,  0,185, 91, 64,226,234,223, 15,199, 86, 56,161,117,175, 17,210,190,253, 27,117, 32,  8,
- 32, 32,172, 52,231,199,103, 87,160, 18, 41,175, 94,189, 26, 70, 81, 20,253,108, 12,226,241,211,198,157,245, 79, 95,186, 55,104,
-225,226, 37, 50, 55,165, 20, 90,157, 29, 31,190, 55,208,229, 49, 88,238, 23,209,187,125,251,142,  7,127,156,253, 29,173, 82, 42,
-113,234,239, 39,152,252,217,151,214,172,228,152, 37,  2, 47, 90,107,214,198,231,190,230, 80, 41,224, 31, 64,189,154, 42,168,251,
-245,148, 77, 28,213, 79,102,103, 56, 20,153, 24,216, 28, 28, 56, 94,128,206,196,224,126,170,  1, 62,110, 85, 63, 34, 76, 16,132,
-214,  0,124,  1,104,  9,130,184, 94,250,119,201,132,174,132, 27,191,240, 59,175,120,124,240,  6, 96,135,115,165,254,211,230, 83,
-252,187,188,235, 37,207,223,  7,208,160,216, 38,  7,224, 26, 65, 16,133,229,144,173,151, 84, 46,250,200,145, 35, 66,159, 62,125,
-158,246,248, 47,254,126, 17, 82,177,168,134,210,221, 23,130,240,  0,  4,241,236, 54,141,127, 96,254,146,101, 43,188, 62,249,104,
- 66,138,190,168, 32,164,248,242, 25, 87,  6, 11,154,160,150,117,122, 35,178,199,164,143, 62, 66, 68, 88, 77, 49,199,113, 66, 76,
-124, 34,179,105,195,198,247, 47, 94,145,172,208,167,199,204, 44, 37, 65, 86,105,217, 39,199,115,233, 47, 42, 88, 28,207,189, 56,
-187,125,249,144,106,  2,240, 80, 73,240,203,241, 36,  8,  2, 64, 64,128,187, 82,132, 29,231,211,145,120,115,159,190, 79, 51,189,
-105,196,194, 89, 93, 58,247,158, 18,125, 63,193,186, 43, 55,215,122, 18, 64,118, 69, 54,203,238,208,121,216, 28, 28, 24,150,197,
-158,195,135, 17,213,165, 45,218,183,111,139,142, 29,218,211, 55,110,222, 29,243,209,164,113, 65,120,182,186,227,169, 77,153, 95,
-221,214, 42,119,159, 93,131, 38, 45, 82,223, 75,103, 65, 83, 64,168,191, 28, 94,106, 49,236, 44,129,100,173,163,248,205,241,192,
-228,105,179,189,166,127, 62,233,152, 94, 43,105, 12, 60,112, 84,148,119,179,217, 44, 25, 57,114,164,136, 97, 24,199,136, 15, 63,
-237,145,157,173,237,255,211,202,127, 73, 53, 26, 63,152,173, 44,110,198, 62,110,240,227,143,179, 67, 15,159, 56,127, 96,214,151,
- 19, 15, 70, 69, 69,185,239,220,185,147,175,172, 60,159,155, 33,230,228,173,217,184,117,207,230,229, 75,230, 35, 46,165, 16, 27,
-214,173,133,192,177,191, 84, 82, 84,165,109, 10, 35, 71,142,148, 31, 56,112,160,102,122,122,186,222,108, 54,107,159,211, 35, 72,
-130,206, 41, 48,195, 71, 45,129,152, 38,225,231, 41,131,198, 93, 10, 17,  5,144,  4,193,149,101,115,195,174,163,115,121,179, 14,
-135,182,219,135,109, 92, 51, 15, 99, 62,249, 22, 49,121,146, 19,164,194,125,238,199,195,  6, 77,247,149,115, 81, 53, 60, 72, 77,
-151,150,181,160,148,137, 49, 99,202, 72,180,185,153,172,201, 40,226,191,213, 90,168,230,179, 79, 60, 61,172,251,204,243,226,136,
- 83,193, 82, 43, 68, 56,177,117,113,174, 73,167,213,149,184,228,236, 54,107,138,139,205,248, 76, 25, 51,219,233,205,155, 52,154,
- 55,105,252, 88,242,141,118,109,  4,146, 20, 33,207, 96, 39,  4,  1,248,108,242, 68,124, 60,113,156,127, 90,102,238,247,107,215,
-254, 50, 51,250,180, 48,199,164,125, 56,171, 34,155, 36,225, 84,129, 84, 50, 26, 42,185,147,184,168,100, 52,172,118, 14,  4,  1,
-202, 35,184,133,142,112, 42,185,153,  5, 41,229,206,192,159,179,233, 21,220,232,236,233, 68,117,253,194, 93,133, 87,146, 50, 99,
-231,222,188,155,115, 13, 64, 65, 80, 71,143,209, 14, 86,128,209,202, 34, 41,199, 12,214, 33, 16, 99,122,133,160,246, 96, 34, 98,
-254,198, 91,155,143,223,133, 91,169, 78,255, 57,155, 25, 87,247, 88,189, 27, 15, 28,186,124,213,186,235, 75,230,125, 75,229,233,
-236,224,  5,  1, 50,  9,  5,185,132, 46,254, 80,176,152,116, 88,251,243,175,217, 44,136, 65,184,112,129,173, 74,251,  4, 47,188,
- 55,176,119,199, 29,  4, 32, 33, 72,113,122,141,144, 90, 33, 93,251,190, 47,235,218,111, 36, 56,214, 62,253,230, 37,225,156, 57,
- 55,238,172, 43, 54, 27, 55,108,  0,  2,184,101,202,141,159,  8,  0, 74, 77,248, 47,245, 35,234,183,124,241, 90,221,186, 17, 45,
- 93,169,247,167, 74,169, 76,253,137,167,151,239,183, 17,141,154,107,114, 10,109,132,218,187, 38,146, 30,221,198,246,159,191,223,
-194, 91,237,179,207, 30,221, 53,111,197,134,253,239,118,141, 26,136,141, 63,253,107, 70,126,214, 83,162,117,166,148, 90,245,222,
-166,223,214,  7,137, 36, 82, 48, 44, 15,134, 19,156,223, 44,135,130,130, 66, 48, 44, 15,153, 66, 13,150, 39,192,112, 60, 24,150,
-135,205,206, 42, 39,142,124,251, 35, 43,240,119, 89,233, 12,172,223,233,164, 88, 42, 13, 17,224, 60,187, 86, 16,  4, 36,101, 91,
-200,128,128,128,109,  0, 32,149, 74, 33,149, 74,193,243, 60,110,198,105, 63,241,137,  8,159,132, 98,130,199, 57,236, 41, 69,201,
-127,246, 44, 47,239,254,254,254,125, 95, 36, 89, 86,171, 21, 70,163, 17,151,174, 92,119,255,109,243,158,168,164,148,244, 48, 94,
-112,183,169, 53, 97, 61, 13,185, 79,250,150, 87,158,134,156,184,143,220, 34,199,145, 95,124, 60,186,238,170, 77, 71,174, 61, 62,
- 57,183,194, 56,173,218, 93,191,182,127, 49,225,157, 86, 11, 87,110,120, 84,248,231, 47, 83, 43,171, 35,154,166, 69, 90,173,246,
-233,251,189,250,215,237,173,110,197,101, 12, 88,177,124,133,236,230, 19,  3,238, 37,101, 98,116,183, 96,231, 12,199,133,122, 87,
-250,133,249,132,214,169,179,109,237,202,133,244,163, 76, 43,214,236,187,134,232,131,191, 92,202,206,253, 59, 10, 57, 89,150, 87,
-233, 67,254,  1,162, 85,174,205,115,119,243, 96,180,178,176,217, 89, 48,188,  0,189,153, 65,110,145, 29,122,179,  3, 70, 11,139,
-209,221,131,203,124,174, 18, 62,226, 75, 16,196, 17, 65, 16,250,  8,130,208, 13,128,164,228,183,115,204, 38,142, 20, 19,178,231,
-126, 79,159, 62,253,155,  5, 11, 22,196,150,220, 91,114,189,228,222,138,174,151,122,222,123,198,140, 25,141, 23, 46, 92, 56,191,
- 93,187,118, 59,254,250,235,175, 68,  0,133,174,186, 15,233,210,153, 57,114,228, 72,101,  5, 29,230, 96, 28, 82, 55,185,  8,161,
-181,131,241,193, 55, 27,125,254, 88, 56, 54, 87, 38,161,169,227,199,143,123,229,219, 85, 32, 73,202,229, 41,138,202,183, 94,123,
-177, 88,114,116,233,210,165, 24,214,183,131, 60, 53,143, 49,222, 77,181,228,152,236, 96, 53,190,225,146,185,243, 23,170, 22, 46,
- 90,252,241,145, 67,124,145, 49,231,254,226,178, 93,124,173,110, 80, 68,169, 24, 44,130,128,192,115,233,133,201,215, 91,  1,192,
-235,196, 98, 25,173, 12,168,226,216, 26,130,  0,204, 86, 22, 20, 69,228, 22,197,237,186, 63, 98,206,220, 46, 91,118,156,206, 20,
- 72, 15,131,201,148,164,128,243,204,193, 42,195,106,231, 96, 99, 56,196,222,185,137,142,145, 13,209,190, 85,125,152,173, 28,204,
- 54, 22,181,235, 68,  0,128, 79,153, 21, 71,145,137,  2,199, 88,  5,129, 83,247,105,237, 11,141,135,  4,  1,158, 82, 72, 37, 52,
- 24, 22,176,216,121, 88,237, 28,146,115, 45, 48, 88,228,104,210,105, 72,168,119,192, 13, 91,118,178,252, 64, 65,234,141, 65, 21,
-146, 83,142,195,166,109,123,234,102,102,230,244, 63,118, 96,171, 84,171,103,112, 55,217,132,220, 34, 27, 64,249,226,135,249,107,
-164, 95, 79, 29, 63, 96,211,246,189, 41, 93, 59,180, 77,169,106,158,205,218,184, 45,187,118,239,249,165, 79,159,  1,242,216,191,
-143,225,209,237,179,243, 76,185, 85,138,207, 34,155, 53,107,198,142, 31, 63,222, 48,127,254,252,160, 67,135, 14,213,214,106,181,
-183,  1, 48, 30, 30, 30,245,195,235,134,220, 57,117,226,120,224,219,  3,134,136,210,243, 44,112, 87,136, 17,162, 81,224,202,165,
-147,140, 68, 34, 42, 51,222,164,216, 61, 56, 28, 93,191,194,161, 43,137, 81,177,249,178,243,227,198,142, 78, 57,117, 49, 46,127,
-245,230, 83,255, 10, 84, 49,183,101,188,118,245,141, 86,117,252,167, 79, 30,137,  5,171,182,224,194,205,184, 92, 19, 25, 48, 47,
-203,198,158, 46, 95, 74,  7,104,138,128, 90, 46,130, 73,175,213, 37,220, 58, 17,254, 15,201,212,163, 79, 29,216, 66, 22, 24, 24,
-164,229, 89,137,204,  2,  3, 56, 94,128,135, 66, 12,150, 23, 80, 84,144, 71,108,221,178, 25,215,175, 95, 33, 65,145, 31,  2,152,
- 85, 97,129, 18, 78, 87,161, 74, 38,114, 42, 66,114,231, 55,195,241,136,168, 91,  7,235, 87, 47,115,243,209,248,225,205,142,174,
-199, 70,171,189, 67,154,237,248,125, 53,206,255,117,235,173, 11, 43,214,180, 86,213,240, 93, 69, 16,220, 18,  8,176,218, 28, 28,
-116, 69,133,144,216,211,208, 38, 80, 11, 47,  5,135,100,125,  0, 98,178, 31,169, 42,235,240,243, 99,246,223, 38,132,  1, 51,247,
- 28,142, 94,208,179,251, 91,136, 73,214, 67, 46,161, 33,147, 80,144, 73, 40,136,  8, 14,203,126,254,133, 41,212, 25,250,228,199,
- 30,204,123,133,246,121,166,120,246,235, 36,119,156,209,119,203,170,153,127,140,251,106, 81,207,168,129,239, 19, 49,215,207,125,
- 99,  6,206,186, 54,209, 19, 92,186,198,243,174,143,113, 50,181,207,202, 41, 95,207,157,210,163,207, 16, 80, 20, 13,134, 97,255,
-137,233,136,  0,  0, 32,  0, 73, 68, 65, 84,176,119,231, 22,252,190,230,135,135,118, 99,254,251,  0,120,123, 46, 53,126,215,150,
-159,135,124,245,253, 50,162,113,179, 54,109,207,101,189,124,188, 39, 79, 17,235, 70,141,157, 48,212,207,207, 79,253, 76,209, 18,
- 16, 30,209, 16,189,251,189,131,147,  7,247,227,126,236, 93,240,130,147, 48,241,188,128,162,194,252,108,150,177,111, 42,215,227,
- 33,147,133,108,252,125,115, 61,146, 36,158, 30, 32, 63,245,163, 15,236, 19, 63,251,230,205,222, 61, 58,197, 74, 40,232,147, 83,
-179, 60,174,220,122,208,132, 23,169,130,198, 78, 91, 38,182,218, 56,232,204, 12,142,109, 40,159,235,200, 60,131,219,213,106,217,
-123,236,196,239,214, 75,165, 20,233,104, 20, 30,148,216, 41,178, 81, 90,112, 13, 31,195,143, 11,215,180,185,252,247,173,222,239,
-142, 24, 43, 27, 93,191, 37, 81,195, 91,174,254, 96,196,192,166, 28,235, 24,101, 46, 72, 43,119,127, 65,145,194,179, 40,184,118,
- 93,243, 51,197, 40,124, 31, 33, 32,244, 57,230, 65, 32,209,146, 19, 63,  8,  0,  2,106,  4, 91, 69, 82, 55, 67, 21, 20, 24,  1,
-  0, 86,253,186,189,213,157,248,204,113,203,151,175, 80,220,124, 98,192,237, 39, 58, 72,197, 36, 28, 12, 15,194, 69, 81,155, 23,
-168,  9,223,206,152,238, 86,104,226,112,254,174, 22,177, 55,206,  9,118,163,117,132,130,117, 27,  4,141,122, 20,128, 58,  0, 18,
-  8, 66, 88,103,202,241, 63,  8, 92,168,242, 65,167, 60,239,156, 47,187,249,134,133,114,180,180,183, 72,162,108, 71, 16, 66, 35,
- 66,128, 39, 32,100, 20, 20,143,169,174, 50, 53, 83, 78, 60, 22,205,255, 30, 43,127,219,143,204,124, 43,220,185, 52, 28,220, 48,
- 23, 95, 44,216,  6,139,173,252,168,134,202,248, 72, 89,196,232, 69,194, 85,242,119,201,125, 11, 22, 44,232,243, 66,221,244, 41,
-167,206, 94,186,175,228,249,133, 11, 23,206, 47,245,239,102, 87, 73,214, 83,162, 85,146,169, 74,200, 86,184,111, 64,200, 95,  7,
- 15,236,243, 44, 52, 58, 32, 19, 83,  8,174, 93, 23,179, 86, 31,244,237,213,202,  7,121, 14,119,108, 95,191,164,192,106, 54,236,
-116,169,179,208, 68,180,149,171,148,199,246,237,221,143,176, 96,141,120,235,165,130,164, 91,137,150,167, 82,175, 94,155, 34,169,
-237,102,166,  7, 13, 28,168, 56, 27,125,238, 51, 35, 80, 38,209,162,  8,170,230,175,155,247,106,212,114, 17,  8,  2, 48, 88, 88,
-140, 27,245,206,235, 15, 99,  2, 79,141,125,127, 52,136, 98,146,165,207,207,198, 55, 95,127,100, 85, 50,143,238,167, 38,167,102,
-116,235,251,197, 89,189,145,176, 14, 29,249,209,245,251,241, 11, 10,205,230, 87, 59,228,199,102,231, 96,115,240,120,242, 36,  1,
- 83, 71,119,135,136, 34, 65, 81,188, 51, 88,154, 45,191, 49, 26, 51,227, 11,224, 47, 30,188,101,233, 39,191,214,240,211,120,171,
-148,114, 65,165,144, 18,141,234,215, 19, 71, 70,182,151,212,142,104, 42,190,244,192,130, 84,173,  5,137,153, 58, 72,253,154,211,
-195,186,244,194,150, 21,211,222, 42, 72,189, 65,226,229, 32,197,231,112,250,252,213,190,191,253,188, 92,154, 83,228,192,195, 84,
- 35,178, 11,173,200, 42,180, 33,187,192, 10,149, 92,132,142,253,198, 75,143, 30, 92,215,183,107,135,182,171, 94, 37,223,137,137,
- 73, 71,147, 51,178,134, 52,109,209,  6, 91,254,248,189,131,135, 71,109,183,162,162, 36,189,171,181, 51,119,238, 92,201,194,133,
- 11,233,213,171, 87,235, 35, 35, 35,253,103,204,152,209, 51, 55, 55,247, 90,173, 90,181, 34, 78,238,219, 20,221,188, 99,255,214,
-224, 29,190, 29, 58,117, 22, 75,121, 26,167,142, 28,113,236,218,185, 53,223, 98, 49, 76,172,144,112, 40,220,231,230, 24,  9,248,
-  6,  6,198,170, 36, 92,119,154, 44,138, 47, 60, 49,101,115, 33,176, 47, 44,106,242,153,115, 55,226,226, 91,221, 76,214, 68,223,
-124,156, 91, 96,118,132, 63, 57,241, 69,133, 29, 47, 69, 16, 16, 81, 36,212,114, 26,100,113,175,170,170,209,244, 49,  8,194,183,
- 68, 57, 37, 64, 20,127,  3,  4,129,204,194,212,219, 46,196,108, 16,  2, 47,  0,113,233, 38, 24,173, 78,105,190,166,143,  2,218,
-156,116,252,180,106, 19,110,221,184,142, 30,189,250, 97,237,175, 91, 49,110,212, 16,107,101,179, 31,146, 44, 86,180, 74,169, 89,
- 42, 57, 13,128, 64,145,137,193,222,203,105,168, 19, 74,186, 60, 48,  0,128, 90,165,128,206, 96,  1, 41, 86, 35,225,230, 49,197,
-241,115,127,207,152, 57,103,249,151,133, 89,119, 83, 31,223,187,132,  8, 31, 29, 66,  3, 29,136,205,118,195,141,252,218,136,168,
- 27,  6, 82,124,221, 37,219,121,177, 77, 22, 29, 36,247,246,105,213,188, 97,187, 16,141,  7, 44,118,174, 88,213,162,240,251,198,
-205, 72, 78, 74, 31,155,127,255,224,173,127,130,209,154,114, 19,181, 82, 77,221,143,239,253,125, 54,113,224,136,143, 17, 16, 24,
-220,172, 40,245,182,139,131,151,107,164,138,115,145,104,137, 21, 30, 51,166,126,251,175, 41, 61,222, 30,140,171,151,206,226,118,
-108,  2,218,182,109,141, 94,  3,134,193,160, 47,168,191,123,243,138,238,172,217,112,146,150,178, 83,218,180,239, 66,240, 28,135,
- 71, 15, 99, 18,202,178,101,201,138,187,125, 37, 43,206,237, 57,247,148, 79,253,102, 42,119,175,219, 54,  7,135,140,140,116,252,
-249,215,249, 22,150,172,184, 42,109, 32, 44, 21, 83, 56,117, 43, 23,142,226, 51, 76, 59,118,234,110, 23,147,182, 14,243,150,111,
-140,204,202,204, 34,149,110, 62,188, 87, 96,  3,113,128,212, 97,187,243, 68, 39,118, 48, 60,194,106, 40, 43,180,233, 91,163,238,
-252,105,211,166, 54,160,196,114, 24, 76, 54,123, 86,102,134,255,250,237,231,140, 15, 30,222, 11,172,169,113,119,251,215,138,117,
- 98,189,149, 64,174,206,134,  2,131,158, 24, 49,225,171, 26,191,173, 89,240, 94, 69, 68,171,140,112,145,208,163,167, 46,213,247,
- 84,139,  9,163,149,229,243,245, 14,110,196,128,215, 91,116, 89, 76,178,198, 47, 95,182, 66,113,235,137,  1,119,158,232, 32, 19,
- 83,144,136, 73,216, 25, 30, 46,190, 78,164,191,198,127, 98,251, 86, 77,112,242,118, 30, 40,138,132,197, 80,104,166,145, 31,223,
-234,173, 30,138,150,109, 34,209,249,173, 78,120, 28, 31, 23,124,228,208,222,174, 87,254,188,144,205, 58,194, 63, 49,105,227,247,
- 87, 73, 88, 48,155, 41, 70,226,255, 65, 64, 96,173, 55,  6, 13,251,192, 61, 36, 56,144,208,248,120,131, 21,104,140, 31,245,142,
-203,111,190,147,152,  3, 11,231,204,128,205,102,135,175,135,  4,130,  0,108, 92, 53, 11,118,187, 29, 53,188,165,208,153,202, 63,
- 77,174, 50, 62, 82,158, 10, 85,165,216,147, 82,100,172,162,235,  4, 65, 28,153, 62,125,250, 55,  0,132,233,211,167,127, 83,242,
-123,193,130,  5, 22,  0,153,149,184, 14,215, 63, 71,180, 74, 50, 87,254,219, 45,142,240,241, 14,184,114,234,228,  9,247,  3,119,
-120, 92,221,127,  3,111,183, 13,128,152, 38,161,112,175,129, 59, 73, 58, 28,221,247,115,209,193, 29,235, 50,108, 54,219,226,202,
-125,205,117, 91,169, 20,202,147,127,108,217,201,251,120,123,147, 63,157,210, 62,201, 55,176, 79, 93, 90,241,127, 31,226,111,156,
- 92, 31, 32,128, 56, 33,147,201,234,218,237,118,207,202, 42,118,227,169,148,226, 32, 94,226,159,232, 91, 65, 80, 20,183,101,235,
- 22,248,184, 73, 96, 99,120, 76,255,242, 83,203,232, 30,170,162, 17,239, 14,235,210,185,247,148,104,145,178,222,217,246, 45,234,
-  9,205,155, 55, 47,162, 40,202,165, 80, 10,141, 70, 51,139, 36,201,225, 18,137, 68,109,183,219, 13,118,222,170, 48, 89,237,176,
- 58,  0,179,217, 10,145,216, 73, 22, 69, 20,  1,139,213, 14,179,197, 94,241,139,145, 29,115, 25, 64,184,190,148,166,116,246, 65,
-152,100,219,238,131,159, 14,126,119,232,204,192,102,  3, 84, 73, 89, 58,136,  9,  7, 90, 55,  8,192,185, 19,251,133,244,228,248,
-169,149,145, 44,  0,200,213, 22,  4,249,250,250,225, 86,162, 17, 25,249, 22,100, 23,147,172,172, 66, 27, 12, 22,  3,154,134,212,
- 64,145, 78, 23,244,202,229, 11,236, 63,121,242,228,144,222,253,135, 98,202,151,179,223,220,240,243,146,187, 74,137,104,140, 41,
-231,209,121, 87,136, 86, 76, 76, 76,193,215, 95,127, 93,231,215, 95,127, 37,223,123,239, 61, 75,147, 38, 77,100, 35, 71,142,124,
-115,243,230,205, 50,133, 66,102,185,115,233,208,204, 15, 39, 79,239,191,126,229,220,102,133,133,133,  4,203, 48,199, 29,133,133,
-211,141,149,144,185,180, 67,223, 60,252,225,137,227,253,238, 29,124, 15,121, 41,200, 70, 82,193, 62, 12, 13,102,237,196,131, 89,
-142, 39, 39, 86, 27,228, 67,150, 78,206, 44,226,191,181,146,154,121,149,145, 44,  0, 32, 41,  2,118,150,131, 90, 46,  2, 73,146,
- 37, 36, 62,224,247,157,199, 21,190,238, 18,136, 40, 18, 52, 69, 64,111,102,144,167,119,224,227, 15, 92,221, 33, 68,224, 89, 78,
-128,197,206,194, 92, 60, 59, 52,232,243, 48,227,203,207,209,171,239, 64,124, 56,241,115, 20, 90,128, 27,137,  6, 56, 24,166,210,
-151,130, 36, 72,152,109, 44,198,244,  8, 65,129,209,  1,147,133,133,157,229,161,144,208, 16,209, 36,148, 50, 26,110, 10, 17, 32,
-  8,226,146,206, 68, 36, 18, 89, 25,134,217, 82,193,140, 30,181,131,252, 96, 97, 72,180, 25,186,  4,221,218,133, 35,246,242, 94,
-250,194,213,123,161,159,125,249, 45, 62, 29,215, 23,123, 30,214,129,151, 38,  4, 42,165, 28,140, 64,  2, 16, 92, 12,216,155,197,
-147,142,129,195,127,249,117, 99,220,143,223, 79,151, 21,153,  8, 72,197, 20,162,207,158,193,149,191,111,172,204,187,127,112, 11,
-254, 65,136,  4,210,207,205,205, 13, 50,  9,  5,187,195,102,119, 61,116, 65,128,  0,180, 80,106,194,127, 41,158,241,183,224,120,
-148,113,173,114,162, 69,203,220,166,127,242,229,143,243,123,188, 61, 24,167,142,236,193,238, 61, 59,185,118, 81, 99,169,173,191,
-255,140, 55,187,245,195,155, 61,134,226,248,254,205,159,155,120,162,225,248, 41, 51,231,116,236,210, 27,167,142,238, 65, 78,118,
-250, 82, 87,211, 75,137,136, 41, 93,186,247,133,213,206,161, 67,215, 62, 56,113,120,255,100, 20, 47,178,112,125, 16,123,161,127,
-  6,201,126, 62,117,138, 40,183,200, 46,210,234,237, 72,215,154,145,148, 99,198,193, 29, 27,  4,215,251, 11,123,235,142, 77,107,
-138,198, 47,138, 78, 11,170, 25, 96, 19,217, 44,242,248,132, 39,245, 63,252, 96,180, 40,180,110,125, 50, 87,103,131, 86,103, 67,
-158,206,  6,163,149, 69,221,154,245, 72,134, 37,218, 85,181,158,125,220, 37,162,181,135, 19,225,166, 20,161,125,253, 87, 95,104,
-203,243,252, 51,146,181,220, 73,178,238, 38,234, 32, 21, 83,144,138, 73, 72,197, 20, 88, 78,112,105,226, 34,215,132,247,254,248,
-147,143,106,216, 89, 32, 95,103,  7, 77, 17,208,248,120, 42, 91, 55, 27,142,141, 75, 38,  3,  0,198,125,253, 19, 62, 28, 51, 18,
- 13, 26, 53, 65, 81, 97,161,255,240,193,189,151,  3,216,239,106, 90,143,157, 58, 31,124,234,226,173,175, 63,158,246,131,234,221,
-190,157,169,219, 79,116,200, 42,176, 33, 33,222, 80, 37,229, 13,  0, 88,142,135,  0,  1,155,118, 30,129, 92, 66, 67,171,115, 64,
- 16,  4,204, 93,189, 11,106,185,  8, 89,133, 78,119,127, 69,168,144,143, 84,160, 72, 85, 65,109,236,  3,103, 44,151,175,171,138,
-214,130,  5, 11, 98, 23, 44, 88, 80,166, 66, 86,138,100,189,218,161,210, 98,177,178,190,155,183,207,213, 83, 39,142,169,247,223,
-225,112,238, 78, 62,  6,119,168,  9, 99, 65, 42, 22,127,249,110,  1,  1,193, 78, 82, 84,145,205, 98,222,103,177,152,230,  1,112,
- 84,216,104,252,195, 91, 40,101,170, 51,107,215,255,193,250,104, 52,216,114,169, 32,189,208,196, 50,207,220, 86, 12,113,227,228,
-250, 80,150,103,162,172, 57,143,175, 87, 54, 19,231,  5,136, 23,252,124, 16,128,  0,158,231, 33,240, 60, 68, 50,149,210, 39, 44,
- 50,167,184,163,147,209, 36, 97, 45,221,  3,  8, 60,155,158,151, 88,177, 12, 74,  0,112, 87,136,176,243, 66,  6,  0,228, 80,134,
-155, 15, 70,188,235,116, 23, 90,237, 50,125,163, 58,117,132,214,173, 91, 23,201,229, 46,109,127, 69,249,249,249, 93,155, 57,115,
-102,253, 15, 63,252, 80, 42,145, 72,192,178,172,215,186,245,235,249,245,243,198, 97,208,228,181, 16, 75,164,176, 88, 29, 16,137,
-104, 20,234,140, 40,210,155, 97, 48, 51, 85,111, 65, 79,158,216,181,192,162,  3,251, 37,  3,123,170,154,182,145,144, 98,180,140,
-  8,192,185,147,  7,132,171, 39, 54,142,179,228,198,255,225, 98, 67,132,209,202, 32, 51,223,138,140,124, 43,178, 11,173,200, 46,
-176, 33,187,208, 10,130, 32, 96,181,179,175, 53,112,153,114,227,118,111,249,227,183,126, 54,  7,134,117,236, 49, 16,159,255,176,
- 54,100,203, 47, 11,207, 36, 10,228, 27, 46,  6,218,114,177,177,177,201, 31,124,240, 65,179,237,219,183, 83,141, 27, 55,182, 60,
-120,240, 64, 81, 76, 34, 29, 42,149, 66,190, 97,205,130,147,109,218,180,217,153, 17,255,240,108,177, 63,189,210,142, 61,164,211,
-251, 82,185,227,214,248, 96,101,251,158, 97,254, 10,  4, 43, 13, 61,235,171,238, 44,206,239,242,233,124,109,244,202,220, 44, 27,
-123, 90,107,161,154,103, 24, 69, 46,197,224, 49, 54,107,202,160,193,195, 64, 17, 36, 28, 86,115, 74, 73,227,210,184, 75, 48,107,
-235, 67,168,100, 34,168,229, 52, 84,114, 17,222,108,232,133, 42,244,103,  2,195,241, 48,219, 56, 88,108, 44,172,118, 22, 62, 65,
-158,248,117,203,110,164,230, 90,112,240,122, 30,226, 82, 12,168, 87, 83,  9, 65,168,188,155,228, 57,198,212,247,157,247,212, 20,
- 73,128, 34,  9,178, 97,253,112, 20, 24, 29, 16,211, 36,196, 50, 57,148, 82, 26,110,114, 17,196, 98, 17,114,115,115, 97,179,217,
- 16, 28, 28, 44,171,152, 10, 10, 80,171,228,168, 23, 90,  3, 14,134,197,177,139,247, 49,111,234, 32,116,239,216, 10,132, 72,133,
-135,182, 22, 80,123,169,193,147, 36, 28, 44, 15,187,131,  3, 64, 90,203,179, 23, 20, 20,212, 69,169, 84, 42,205,102,179, 33, 53,
- 53,245,124,118,220,254, 84,142,234, 63,254,196,169,232, 45,125,122,117,199,173,187,177,216,179,255,208,165, 60,111,221,180,146,
-103, 26, 53,106, 20,233,227,227,163,202,207,207,215,199,196,196, 92,123,213,121,129, 64,146,159,181,123,243, 45, 24,139,114,145,
-147,150,228,242, 44,186, 65,136, 26,223, 45, 88,219, 50, 34, 60,162, 37, 39, 56,137, 87,195, 96, 53,190,248, 97, 85,203, 58,245,
-194, 91,150, 44,  8,105, 16, 92,241,182,108,180, 66,221, 99,212,135,159, 47,232, 55,248,125, 68,159, 58,132,101,243,190,220,162,
-116,247,109,224,229,233,222,188,113,100, 15, 92, 58,115,  8, 50,181, 63, 60,189,253,223,124,111,204, 39,221,  6,191, 55,  1, 87,
- 46,157,193,202,133,223,108,230,108,134,109,174,164, 85,169,  9,245,109,214,162,205,  8,181,151, 31,138,116,  6,168, 61, 53,104,
-208,180,245,136,251,119,108, 95,155,114, 19,181,175, 76, 58,  4,  1, 54,135,128, 66,163,  3,105, 90, 11,146,179,157, 68,139,231,
-171, 16, 19,196,241,132, 74, 70,211, 94,204,227,224,123,103,162,133,144, 32, 63, 98,209,156, 47, 41,  7,100,208, 22, 57, 73,150,
- 86,111,135, 86,103,135,209,202,192, 75, 73,131,231,248, 42,207,186, 11,141, 14,168, 21, 34,184, 43,196, 46,171,140,101,225,231,
-223,119, 70,220,137,207, 28,176,108,217, 10,197,237,196, 82, 36, 75,228, 84,179,164, 98, 10, 28,207,  3, 46,188,241, 34, 90, 52,
-165,127,239,110, 72,203,179, 56, 87, 45,147,  4,234, 53,105,  3, 31, 57,143,174, 67,167,  3,  0,250,246,118,134,182, 37,102,153,
-112,248,170, 22,120, 62,176,187,226,190,216, 98,161,214,111, 61,250,217,238, 93, 59,220,173, 28,141,117,199,147, 97,182,177,144,
-137, 41, 72,197, 20,228, 98,234,185,120,236,202,137,150, 51,230, 46, 53,143,129,217,106,133,222,194, 64,  0,112,237,177, 17, 22,
- 59, 11,157,137, 65,100,125,207,215, 19, 66,  8,226,168, 32,  8,111,191, 72,136, 94, 36, 75,165, 20,169,178,108, 92, 47,109,163,
-228,254,242,136, 92,233,152, 45,  0, 85, 90,193, 69,191,200, 28, 75,255, 22, 43, 61, 27,184,171,221,175,158, 56,126, 68,181,255,
- 14,143,243,119,157, 36,139,177,228, 97,233,215,195,211,245, 69,121,157,  1, 60,113,245, 63, 83,248, 52,104, 42,147, 72,163,255,
-181, 98,157, 67,227, 23,200,239,187, 90,148,171, 51,115,207,177,  9,206,102, 35,  5, 94, 16, 91,115, 30,187,228, 67, 32, 73,194,
-241,195,228,129,224,  5,  1,179, 86,236,198,252,105, 67,161,146,191,167, 32,  8, 66, 97,178,178,152, 58,251, 55, 44,253,110,172,
- 90, 33,165, 65, 16,206,152,168, 81,195,  6,186,214,  0,173, 44, 18,254,222,110, 52, 36, 30,121, 80,218, 93,216,246,205, 94, 55,
-218,182,109, 91,228,233,233,  9,185, 92,254, 76,169, 40,  7,126,126,126,223,253,240,195, 15, 17, 19, 39, 78,124,186,217, 39, 77,
-211,248,248,163,143, 72,142, 19,112,252,248, 70,248,214,106,129, 67,167,175, 34,170, 75,107, 24,205, 86, 20, 20, 25,192,131,122,
-229,134,104, 40,202,139,206, 78,190,215,230,141,206,125,113,254,228,  1,225,234,241, 13,227,170,178, 71,143,167,151,103,218,205,
-123,  9, 13,  8,194,203,169,104, 21,147, 44, 59,195, 35,196, 79,129,180,228,  4,120,184,187,167,185,106, 79,238, 27,209,159, 32,
-133,137,  4,132,141,166,156, 71,187,  1,  8,166,172,  7,195,119,111, 91,127, 55, 54,230,246,188, 62, 35,166,208, 61,  6,127, 68,
-253,178,224,147,111,  0,184,186,241,158, 35, 46, 46,238,254,216,177, 99,219, 95,185,114,133,  3, 96, 38,  8,130,161, 40, 74, 97,
-183,219,197,157, 59,119,214, 61,124,248,240, 60,202, 14, 90,124, 14,111,126,176,219,135,144, 26,122, 73,120,199,240, 16,181,161,
-123,231, 14,237,208,174, 81, 16,210, 58,180,  3,128, 41, 41, 70, 85,132,181,206,111, 59, 25, 86,126,236,151,223, 15,207, 31, 55,
-180,219,212, 45,244,172,101, 89, 71,102, 85, 24,136,154,246,224, 66,207,178,104, 60, 77,145, 80,203, 69, 80,201,105,168,229, 34,
-168,101, 34, 48,172, 80,149,153,163,192,176,188, 83,209,178,179, 48, 90, 88, 68,223,206, 65,182,206,142, 34,131,  3, 22,  7,  7,
-  1,130,115, 54,234, 66,111,174,125,252,167, 71,201, 72,234, 17,220, 66,183,126,245, 18,183,189,151,211,159,174,232,115, 87, 72,
-160, 86, 56, 87, 99, 95,188,120, 17,222,222,149,207,246,121,158,199,158, 19,215,176,108, 83, 52, 78,108,252, 10, 50, 49,133,166,
-253,103,227,253,  1,109,193, 11, 60, 18,226, 98,115,234, 53,108,230, 71,146,114,144,  4,  1, 27,195,  3, 16,202, 45, 79,187,221,
-238,157,154,154,170,175, 91,183,174,127,141, 26, 53,  6, 83, 20, 37,192,112,219,118, 96, 71,129,249,236,145,109, 10,147,197,198,
- 41, 88,221,198,186, 89,150,183, 81,183, 46,  8,130, 16,220,220,220,196,209,209,209,198, 38, 77,154,248,190,226,171, 68,202, 53,
-225, 43, 63,156,244,217,224, 58, 97, 97,216,189,109, 35,  4,129,216,235,234,195, 91, 15, 95,193,156, 25,207,175, 48,252,226,135,
- 85, 45,151,206,158,242,220,181, 73, 51,150, 85,184,234, 80, 46, 85, 77, 27, 52,124, 60,110, 92,251, 11,139,103,127,177,195,102,
- 44,120,159, 97,153, 33,  5, 89,137, 59, 66, 27,182,133,224, 48,224,212,174, 37, 24, 58,114,156,180, 71,159,193,184,114,233, 12,
-230,127, 51,105,171,185, 40,247,  3,184, 24,228,204, 11,162,137,157,123, 14, 16, 89,108, 14,172, 90,244, 61, 38, 76,155,135,200,
- 46,125, 69, 49,183,175, 78,  4,240,163,203,225, 16, 14, 14,157,155,248, 56,201, 51,195,227, 80, 34, 69,151,213,  2,105,138, 32,
-155,135,121,192, 98,103,161,175,100, 82, 73,139, 69,217, 69, 58,125,173, 53,243, 63,163, 76, 86, 22, 90,157, 29,185, 58, 27,242,
-138,158, 17,172, 60,157, 13, 90,157, 29, 34,154, 64,252,147, 20,144, 34,186,202,241,121,133, 70,  6,109,194, 61,157,239,232, 43,
-122, 71, 24,218,173,237,137, 11,119,  6, 45, 91,182, 92,118, 39,201,128,187,137,250, 98, 37,139,130, 84, 68, 66, 82,252, 55,199,
- 59, 99, 35, 43,130,155,111, 88,232,232, 81,239,117,117, 83,201,145,249, 40, 23, 52,229,220, 34,198, 93, 19,  4,119,169, 21,159,
- 76, 26, 15, 31,111, 15,164,230,217,176,114,127, 60,238,222,127, 12,222, 82,181,108,175, 90,183, 35,234,195,143,191,240, 32, 69,
- 18,108, 62,153,228, 76, 39,197,225,225,213,195,214,204,132,123, 38,163, 62, 95,128,192,185, 24,131, 76,  8, 44,231,108,110,243,
-103, 77,199,142, 77, 63,225,228,205,220,167, 45,240,242,222,165,248,108,198, 92,228,233,237, 40,171, 93, 86,196, 71,  0,104, 75,
- 41, 81, 47,253, 46, 69,142,202,250, 77, 20,255,182,151, 99,195,254,  2,185,178,191,112,221,254,130,189,178,246,254, 91, 95,169,
-235,240, 37, 82,228,225,219, 88, 33, 83,254,117,252,248, 97,229,129,187,194, 83,146,229, 48,231,  9,243,166,244, 77,215, 23,105,
-123, 84,137,100,249,214,107, 44, 85, 72, 47,204,156,187,210,230, 23, 88,139, 61,118, 91,159,111,176,114,236,203, 49,  8, 74, 78,
-233,238,107,165, 37,210,101, 34,139,253,251,188,188,  7,166,202,148, 39, 94, 16,112,228,239,108,  8,130,115,138,180,235, 98,  6,
-138,103,230,224,120,167, 91,229,244,237, 92,208,197,113, 40,174,202,223, 63,175,251, 73,255,118, 19,157,105,196,252, 89, 79,221,
-133,145,205,156, 74,150,155,155, 27, 60, 60, 60,160, 82,169, 80,153,235,144, 32,136, 81, 31,126,248,225, 75,179,255,220,220, 92,
-116,235,218, 25,171,127,250, 21,205,186,142,198,233, 63, 79,194,193,240,104,218, 48, 12,181,106,120, 34, 45,199,240, 74, 47,186,
-210, 47,226,227, 54,157,  7,124,243,102,151,190,136, 62,177, 79,184,122,226,247,241, 85,221,  8,241,237,110,237, 15,207,153, 51,
- 43,116,230,188, 53, 82,181,140,198,  3,163, 29, 36, 65, 32,196, 79,  1,111, 37,137,243,  7, 54, 91,135,246,109,239,242,230,120,
- 65, 65,129, 91,150,174, 94,175, 92,186,112,118,231, 27, 55,137,104, 99,102,124,  1,  0,152,115,226, 22, 61,  4,238,215,252,235,
-212,177,102,157,  6,194,175, 70, 88,247,196,156,135, 46,147, 13,  0,230, 39, 79,158, 36,206,156, 57, 51, 98,225,194,133,  2, 69,
- 81, 60,  0,233,138, 21, 43,204,143, 30, 61,186, 13,231,210, 92, 84, 54,216,116,237,222,104,170, 74,194, 69,122, 41,200, 70, 97,
-254, 10,180,107,228,244,138, 14,125,251, 77,  4,  5,  7,227, 73,182,185,121,129,153, 23, 25,237, 84,216,218,117,119,175,215,246,
-161,198,177, 22,251,125,  0,  7,171, 90, 63,  4,158,  5,200,151,168, 89,106,185,  8,188,179,173, 84,137,104,217, 28, 28, 44, 54,
- 14, 22, 59, 11,147,157,131,217,206,129, 23,156,239,  4, 65, 16,112,176, 60, 92,154, 54,191,208,246,221,188,124, 16, 86,155,128,
-155,194,153, 54,183,226,237, 30,  8,  0,222,222,222,208,104, 52, 46,169,162,118,135,243, 21,183, 51,252, 83,183,190,221,193, 66,
- 16,  4,196,199,199,125,149,156,152,216,191,110,189,186, 29, 27, 54,109,230,165,144,146,  0, 80, 46,209, 50,155,205,156, 90,173,
-214,120,121,121,145, 25, 25, 25, 79,201,115,221,230,157,217,253,251,246, 98,208,160,129,198,  7,215,238, 60, 93,226,110,177, 88,
-136, 55,222,120,195, 45, 40, 40,136,180,217,108,250,170, 86,147,210, 55,124,128,167,183,215,188, 81, 31, 76,  8,239,220, 45, 10,
-231,206,158,194,193,125,219,255, 48,107,227, 79,185,106, 36, 34,162,254, 75,171, 14,235,212, 11,127,105,213, 97,173,208,122, 21,
- 18,173,134, 77, 91,183, 21,  8, 26, 39,143,236, 18,172,164, 99, 18,  0,158,179, 26,118,237,252,249,187, 31,135, 79,156, 81,167,
-119,191,225, 24, 53,242,125,208, 52,133,243,167, 15, 99,233,236,207,143, 26,117,185,163, 93,  9, 19,112, 74,111, 13,196,129,242,
-160, 79,131,235, 52,198,205,171,151,144, 16, 31, 19,123,231,250,149, 70,117,155, 68,194,183, 70,200,167, 41, 62,212, 66, 60,120,
-224,168,204,140,221,106, 77,121,127,244, 72,148, 94,117,216,174, 69,132, 55,241,226, 11,  0,192,108,200,117,108, 88, 50,245, 81,
-201,170, 67,222, 97, 79, 41,207,174,174, 80,187,231,252,159,127, 79,235,255,118, 20,153,167,183, 59, 21, 44,157,189,248, 99, 67,
- 94,201,223,122, 27,234,213, 80, 33, 46,246, 38,111,213,229,237,173,226,123,105,125,127, 72,207,251, 37,109,151,231,  5, 16,128,
-181,202,110, 41,145,219,248, 69,139,151,201,238, 36, 26,113, 55, 73,239,116, 21,138, 40, 39,193, 18,145, 79, 73,151,115, 53,123,
- 37,234, 16, 65,205, 31, 51,122, 24,242,244, 14,240, 60, 64, 83,100,241, 71,140, 84,  3,129, 52,131, 25,121,133, 90, 36, 38,167,
-160, 40, 59,  1, 36, 73,194,167, 70,184,203, 59, 73,115,130, 36,192,108, 23,154, 12,126,187, 35,189,239,175, 44, 40,164, 52,108,
-134, 28, 28,223,185, 68,107, 51,234,231, 89,204,198,125,174,236,231,248, 44,  4,129,208,234,141, 86, 63,169,136,194,238, 77,107,
- 48,228,253, 73,207,245,190, 95,125, 59,  7, 32,  9, 20, 20, 26, 64, 16,132,182,106,253, 18,113,189,162,223,175,168,140,189,182,
-141, 50,200,214,203, 19,133,242,103,163,194,241, 83, 39, 14, 43, 47, 39, 75,113, 45, 46,171,152,100,105,249,185,147,223, 78, 55,
-232, 10,122,  2,136,175,218,188,144,236, 57,116,204,180,216,176,240,134,182,115, 49,198,164, 34, 19, 83,110,156, 67,187,193, 51,
- 99,111, 28, 93,221, 91,199, 60,249, 72, 25,208,144,227, 89,118,145, 69, 27, 63,187, 28,215,161,100,246,202,221, 79,221,134, 95,
- 47,220,236,252,155,227,192,  9, 60,  4, 30,248,228,187,159,193,242, 28,120,142,  3,207,  9, 96, 56, 65, 81, 89,114, 53, 53,106,
-237, 43,124,184,171,254,136, 31, 95,118, 23,122,120,120,192,219,219, 27,222,222,222,112,115,115,171,148,104,137, 68, 34, 21, 77,
- 63, 95,212, 41, 41, 41, 72, 78, 78,134,155,155, 27,  4,158,129,157,  1, 26, 71,246,192,189,132, 24,156,185,124, 27,  2,207, 65,
-169,170,250, 41, 47, 74,191,136,143, 90,191,213,127, 77,151,126, 99,113,122,223, 58,225,250,197,195, 19, 44,185,241,191,185,172,
-208,115, 28,193, 48, 12,222,238,241, 86,202,173,216,199, 39,190,157, 54, 49,170,125,159,  9,210,118, 17,129,176,218, 57,164, 39,
- 39,224,252,129,223,173,225,161,  1, 39,187,118,104,155,194, 48, 12, 56,142,171,116, 32,183,218, 29,121,148, 72,174, 28, 54,108,
-132,232,250,181,107,123,149,190,245,118,115,  4,121,135, 16,248,166,132, 32, 12,106,218,180,  1, 28, 12, 15,179, 89, 95, 88,213,
- 60, 27, 12,134,196,141, 27, 55,134,142, 30, 61, 90,209,176, 97, 67, 81, 66, 66,  2,150, 46, 93,154,111, 48, 24, 18, 93,181,113,
-234, 98,220, 10,154, 40,124, 84,162,104,165,190,217, 14,195,250,188,137, 29, 71, 47,227,252,165, 43, 72, 49,170,110, 27, 89,250,
- 64, 90, 74,166,173,145,151,126,111,191,118,181,168,221,155, 10,247,198,190, 53,253, 93, 65,144,158,202,187, 48,203,228,250,203,
- 13, 24, 44, 12,220, 20,206,253,158, 74,148, 45,138, 32, 92,102, 68,  4,144,120,233,202,205,198,173,234, 53,196,173, 68, 29,114,
-139,108,176,216, 88,240,188,  0, 30,  2,188,213, 18,200,196, 36, 82,147, 19,193, 11,142,164, 42, 14, 21,218, 78, 29, 59,209,  0,
-  1,130, 16,104, 17, 77, 67,128,115,127, 69,185, 92,110,212,104, 52, 46, 41, 90, 14,150,197,160,168,182,136,108,221, 20,253, 39,
- 56,247,204, 60,251,199,116,120,170, 68,216,177,229, 55,164, 93, 92,177, 37,180,221,196, 83, 49,247, 98,223,137,189,245,215,136,
- 94, 45,229,205,253,233, 76,113,121, 50,169,201,100,218, 11, 64, 34, 22,139,163, 58,118,236,232,181,119,239,222, 34, 31, 31, 31,
- 94, 34, 22,107,251,245,237,195,139,196,226,130,146,123,255,252,243, 79,209,132,  9, 19,212,133,133,133,169, 57, 57, 57, 87,  0,
- 48, 21, 79,  4, 35,186,129,196,118, 16,132, 76, 37, 87,164,212,174, 29, 86,163,117,100, 91,247,  1,131,134, 64, 42,145,226,244,
-169, 19, 88,181,124,225, 46, 99,214,131, 49, 85, 41,201,127,106,213, 97,122,106, 82,162,217, 98,107,210,184,213, 91,196,165, 83,
-  7,166, 56,224,179,156,146, 58,150,116, 27, 52,169, 78, 98,166, 17,171, 22,124,  5, 79,119, 37,146, 18, 30, 90, 30, 61,184,247,
- 51, 99,213,127,229, 50,201,  2,160,200,231,222,105, 55, 50,202,211,230,224,112, 49,250,168,149,103,249,168, 43, 23,142, 37,212,
- 12,111, 45,107,220,186,171,103,222,193,223,  6,153,129, 29,149,217,201,120,248,178,130, 43,216,139,146,206, 70,159,113,247, 11,
-105, 68, 17, 32,224,176, 89,161,125,114,157, 53,231, 60,212,235, 51, 98, 92, 90,133,155,159,134,239,102,252,240,175,143, 90,183,
-106,165, 20, 32,123, 78,193, 42, 33, 88,121,122, 59,124,212, 18, 88,244, 90, 60,186,126,194,106,214, 82, 21,238,119,198,218, 77,
-138,188,220, 28,201,179,112,134,248,200,138,238,207,203,205,145,176,118,147,162,242,161,142,130,155, 82,130,123, 73, 25, 79,  3,
-223,165, 34,103,108,150, 68, 68, 61,141,211, 42,233, 11, 42,193, 91, 98,153,  7, 50,242,173, 32, 32,128,231, 88,176,140, 29,  6,
-189, 30, 25,153,217,200,201,206,129,193, 80,  4,133,202, 19,141,155,183,129, 90, 41,195,157,243,187, 32,  8,130, 75,251, 26, 50,
-132, 40,162,117,100,  7,105, 76,178, 51, 22, 75, 38, 18,112,120,251,194,124,163, 62,183,131, 49,235,209,163,170,246,197, 44,199,
-157,185,123,255, 81,163,154,  1,181,137,219,  9, 58,108,249,117, 53,236,197,202, 38,195,112,136, 73, 53, 33,171,192,140,212, 39,
- 15,  4,158,227,206,224,255,  8,232,242,  5, 64,208, 77, 27, 55, 64,143,247,  6,224,167,159,126,198,147,196,100,126,222,148,222,
-169, 70, 67, 81,175, 42,144,172,110, 40,222,107,195,156, 19,183,200,226,217, 58,253,208,173,  2,210, 98, 23, 42, 12,240,145,249,
-134,160,195,152,165, 39, 45,134,  2,  9,103, 51,211,135,183,140,217, 94,150, 77, 39,131,134,125,222, 23, 67,161,146,211, 32,  8,
-  2, 37,238,194,181,115,198, 67, 33,117,250,150, 45, 54, 22,239, 77, 93,134, 45,203, 62,135,  0, 96,248,144,203,230,242,210,  9,
-231,217,133,159,  4,224, 90,205,148,228,220,140,110,125,191, 56,107,117, 72,109,125,  6,142,190,209,170, 85,171, 34,185, 92, 14,
-185, 92, 14, 55, 55, 55,120,122,122,194,195,195,163,210,188, 51, 12, 99,180,219,237,222, 18,137,  4, 60,207, 35, 41, 41,  9, 73,
- 73, 73,208,233,116,208,106,181, 48, 25,245,236,181,179,187,233,198,237,122,163, 70, 88, 19,132,212,107,  6, 17, 69,128,166, 73,
-156, 63,244,107,121,233, 44,155,100,117,234,183,182,107,255, 15,113,122,223,122,225,250,197,195, 19, 45,185,241,191,186, 90, 71,
-197,238,158, 59,131,  6, 13,106, 50, 97,194,  4,241, 15,211, 38,156, 60,122,234,124,252,238, 35,235,251, 22, 22, 22,  5,  9,130,
-  0, 15,119,247,180,161,125,219, 31,238,252, 70,235,148,179,103,207,242,219,183,255, 63,246,238, 59,174,234,234,255,  3,248,235,
- 14,184,131, 11, 92,246, 30, 38, 67, 92,160,104,166,162, 56, 83, 75, 83, 83, 83,115,102,206,242,167, 13,115,164,137,166, 86,106,
-238,180, 52,247,200,189,194,109,185, 35,149,139,226,  6,  4,  1,145, 61, 46,151,187,231,249,253,193,200,148,233,248,182,222,207,
-199,227, 62,224,194,189, 47, 62,235, 94,222,247,124,206,231,156,159,116, 28, 14,231, 70,117,153,165,111, 82,185, 91,126, 57,253,
-235,156,246, 29, 58, 98,253,230,159, 58,220,186,125,167,195,253,251,137,240,245, 15,192, 43,245,131,161,230, 56,226,215,115, 23,
-160,148,231,110,169,205,114, 62,209,170,197, 41, 42, 42,250,109,208,160, 65,221, 46, 94,188,200, 29, 52,104,144, 58, 63, 63,255,
-210, 99,173, 88,172,166,204,152, 31,222,206,  3,176,197,191,195,200,221,143, 12,242,201,  0,190,241,243,247,195,217, 11, 49,136,
-185,120,249,251,124, 27,191,185,163,134,190, 55,182, 94,111,222,232,222,109,234,241,220, 28,109,176, 99,221, 18,222,225,152,212,
-165,169,  5,230,245,223,156,155, 51,175, 54,251,168,226, 31, 71,137,  1, 17,141,156, 96, 52, 51, 88, 88,233, 27,174,157,200,170,
-170, 55,222,167, 50,249,122,225,168,241,227,198,221,111, 26,214,252,163,161,239,141,183,110, 30,224,139, 43, 73,114,128,195,129,
-147,135,  4, 89, 89, 89, 56,191,119,157,169,232,209,221,239,121, 60,203,151,117,216,158, 40, 74,187, 22,244,216,221,177,249,249,
-249, 56,123,246, 44,202, 11, 44, 87, 87,215,170, 10,173, 63,101, 22,228,100, 94,154,183,120,109,196,152,225,111,163, 87,199, 38,
- 56,119,245, 62,244,101,227, 53,149, 95, 74,158, 18,243,131, 96,242,160,  0,253,  7,253, 26, 40, 52, 70, 65,234, 23, 15,138,207,
-163,116, 14, 86, 75, 21,203,169, 47, 44, 44, 60,124,239,222,189,118,205,154, 53,171,119,244,232,209,194, 91,151, 79, 76,122,124,
- 33, 62,253,244, 83,219, 53,107,214,216, 48,198, 46,233,245,250,228, 90,173, 59, 23, 59,100,177,177,206,  6,163,  5, 23, 46, 95,
-111,212, 37,162, 57, 44, 12,184,122,245, 42,214,111, 88,175,189, 17,127,237, 91, 85,142,199,151,213, 20, 47,149,110, 79,243,243,
- 93,117, 88,145,153,245, 40,245,219, 83, 71,246,110,123,181,195, 91, 24, 50,241,203, 47,207, 30,249,105, 78,139,246,189,184,141,
- 94,237,  6, 89,204,175, 56,125,244,248, 66,131,178,112, 14,106,238, 59, 82,233,114, 10,197, 54,255,215,184, 69,  7,164,167,165,
-226, 65,226,205, 45,218,194,164,204,180,251,188, 45,153, 25,105,227,235, 55,137,192,197, 19, 59, 39, 85, 83,104, 85,123,204,251,
-186,138,215, 29,141, 62, 60, 56, 35,227,  7, 15,149, 70, 43,100,140,105,133,  2,126,182, 45,183,100,151,162,214,203,121,199,144,
-151, 89,175,223, 59, 67,199, 31, 89,185,114,153,149,187,131, 13,178,139,180, 80,104, 12, 40, 81, 27,192,229,112, 16,228, 37,129,
-186,164, 16,231,246, 46, 54,234,149, 69,131,128,251,134,170, 50, 37,110, 33,243,139,146,126,157,248,233,132, 51, 16, 72,125,189,
- 94,233, 60,163,218,214,186,146, 71,215,222,250,116,194,207, 33,140,177, 46, 18,183,144, 18, 85,238,189, 89, 85,173, 59,135, 83,
-250,250, 30,210,201, 23,  6, 83,233,248, 99, 38, 11, 96,182, 88,202, 90,249,  0, 86,113, 62,159, 83,195,186,115, 44,187,142, 92,
- 66,102,142, 28, 26,189, 17, 58,189,  9,  6,163, 25, 92, 30, 15, 14,142, 14,  8,126, 37, 28, 82,  7,123,228,100,103, 34,230,151,
-195, 72,136, 63,119,137,195, 48, 87,147,151,248, 75,109,246,145,181,216, 33,196,211,203,131,155,165,208, 67, 44,224,225,218,185,
-163,  6,163, 94,247,109, 45,139,172,167, 50,229,  5,133, 75, 63,154,242,217,187,155, 54,110,246,  8,173,111,143,140,124, 13, 50,
-242,180, 40,209, 26,203, 10, 49, 11,116,202,124,196,255,186, 57,219,172, 45, 89,138,255,136, 42, 11, 45,147, 65, 91,178,239,248,
- 21,231,233,115, 22,243,146,238, 39, 27,231, 79,238,153,161, 81, 42,222,172,115, 75,214, 99, 54,125, 88,127,231,203, 88,137,167,
- 78, 23, 50, 11, 44,140,225,231,203,217, 21,167, 11, 45,101, 61, 47,227,238, 87, 63,141,224,227,115, 23,118,124,115,210,169,248,
-123, 37,219, 53,154, 28,233,221,164,111,139,  0,128,199,227, 85,220,202,251,102,105,181, 90,125, 13,167, 80,182,254,248,227,143,
-211,198,143, 31, 47,124,248,240, 33,238,223,191, 15,185, 92, 14,145, 72,132,227,199,143, 27, 97, 49,125, 27,127,241,192,131,123,
-178,147,179, 67, 90,118,243,  9,109,243, 38,108,108, 36,224,179,218,119,198,180,113,107, 48,184,101,135,222,223,117,233, 59,  6,
-167, 15,252,200,174,158, 59, 60, 65,147,151,176,174,174,219, 82, 46,151,223,  2,144,248,237,183,223, 54, 95,191,126,125,253, 41,
- 83,166, 36,111,253,110,206, 74,  0, 40, 40, 40,  0,  0,196,197,197,177,  9, 19, 38,232,180, 90,109, 74, 81, 81,145, 12, 53, 92,
-  0,  1,  0,154, 60,155,175,214,175,254,166,233,195, 71, 89,111,  7, 52,109,  5,215,250,173,224, 17,244, 26,138, 74, 12,184,146,
-148,137,228, 59,191,224,206,133,189, 71,213,182,166, 57,168,227,248,198,205,154, 53,243,229,114,185,175, 40,149, 74,143,198,141,
- 27, 55,147, 72, 36,113,205,154, 53, 11,231,243,249, 25,177,177,177,169,117,201, 74, 59,183, 89,231,223, 97,228,138,180, 18,187,
- 78,201,217,234,240,180, 18,187, 56,181, 80,250, 73,222,175, 43,116,155,120,222, 75,153, 33,255,214,158,205,138,125, 59,214, 45,
-225, 13, 29,251,169,249,102,177,227,100,190, 88,112,170,110,205,213,220,172, 15, 70,244,249, 99,120,135,178,150,172,178,239,107,
-213, 76, 95, 92, 28, 95, 12, 96, 90,252,109,171,239,110, 78, 30, 55, 47,236,213,136, 97,145,111, 12,226,154,172,109,113,226,192,
- 15, 44, 37,254,215, 61,124,102,158,169,169, 69,170, 17, 16,  0,  0, 32,  0, 73, 68, 65, 84,197,108,  0, 53,158, 14,210,235,107,
- 83,100, 61,189,140, 15, 37, 29,247,252,180, 97,228,190,  3,251,191,238,219,187,143,243,234, 47,  6, 98,241,218,131,144,136,133,
- 96, 22, 11,  6,118,242, 29, 48,123,116,195,183,124,221, 69,222,251,206,100,156,159,184,236,230, 52,181,218,144, 80,139,150, 24,
-150,159,159,127,193,214,214, 54,175, 93,187,118,173,133, 66, 33, 39, 63, 63,159,239,230,230,102,146, 74,165,250,140,140, 12,181,
- 78,167,219,  7,160, 78,195,142, 27,140, 22, 60,200,209,226,208,254,125,184,126,249, 23,220,185,115,175,228,206,237, 59,171, 56,
-124,182, 76,149,147, 88,  8,212,249,  3, 62, 44,149, 94,117,200,234,124,213,161, 89, 87,178, 99,235,247,243, 59,171,181,186,145,
-205,218,246, 68,189, 70, 17, 92,131,209,140, 27, 87,207,224,204,222,101,139, 13,202,194,233,207,179,143,189,124,234,  7, 51,158,
-  0,191,157, 61,  2,102,177,124, 15,  0,204, 98,249, 62,238,226,209,241,175,189, 57, 26, 78,110,245,154,201,211,227, 56,120,134,
-209,195,173,249, 92,213,177,125,155, 14, 60,120,240,  0,119,239,222, 69, 82, 82, 18, 10, 11, 11,177, 99,199,131, 58,237, 31,117,
- 81,234,169,132,219,220,238,253,  7, 14,249,121,192,224,225,162,250,193,161,220, 16, 31, 71, 56,219,242,113, 47, 41, 21,  9,177,
-241,150,123, 87,142,106, 13,138,220,190,154,162,212, 42, 11, 63, 27,151, 70,238,128,121,122,249,220,133,109,218, 68,132,124,182,
-224,235,214,206,174,110,149,190,143, 23,228,229, 10,166, 78, 60, 28, 18,243,251,111,181,154,235,208, 98, 54, 23,140, 29, 57,200,
-194, 43,157, 40, 20, 21,237,212,101, 91,175,244,195, 84,233,207,153,197, 84, 99, 11,254,123,111,183,135,201, 98,129, 74, 99,128,
- 66,165, 67,113,137, 22, 89,185,  5,184, 30, 31,143,115, 63, 31,198,253,123,215, 83,140,122,253, 73, 46,151,179, 87,147,147,112,
-174,110,103,154,248,245,157,157,156,144, 82,168,132, 72,192, 71,106, 66,172, 78,165, 40,222,254,172,199,145,166, 32, 49, 43,151,
-199,233, 54,104,208,224,227,157,187,247,150,190,218,182,171,141,139,189,  3,172,249, 12,137, 15, 50, 33,187,116, 92,149,124,253,
-188,194,168, 87,246,120, 17,179,190,252,205,213,124,213,161, 65,167,122,235,221, 62, 29,246,243,120,124,129,197, 98,210, 25,244,
-186,254,207, 83,100,189, 44,140,153, 51, 70,190,251,246,159, 62, 27,152, 44, 76,252,238, 59, 39, 52,143,127, 86, 48,154,153,205,
-187,239, 92, 82,151,190,129, 84,221,177,207,211,211,169,103,249,220,133,105,105,  5, 87, 11, 11,117,103,  0,100,104,181,218,103,
- 94,198,156,156,156,121, 11, 22, 44,232,165, 86,171, 27,118,236,216, 81,104,111,111,143,130,130,  2,156, 60,121,210, 24, 29, 29,
-125, 59, 55, 55,119, 54,144,107,210, 32,124, 75,188,246,192,136,123,177, 39,103, 55,108,217,221, 39,180,237,155,181,127, 51, 19,
-138,199,116,238,253, 62,231,244,193, 31,217,149,179,  7, 63,208,228, 37,174,125,142,205,106,208,106,181,151,181, 90,237,205,153,
- 51,103,190,234,238,238,238, 62,123,246,108,145, 66,161,176, 90,189,122,181, 54, 63, 63, 63, 91,161, 80,196,160,154,254, 52, 79,
-139, 51, 22, 63, 66,191, 99,251,126,236,196,246,253,248,186,131,139,119, 55,169,171, 79,160, 60,239, 81, 74,113, 94,230, 73,  0,
-167,203,  6,138,172,147,230,205,155,  7,112, 56,156, 65,  0,154, 74, 36,146, 32, 91, 91, 91, 33, 99,172, 33,135,195,185,101,177,
- 88,226, 27, 55,110, 28,125,251,246,237, 58, 13, 38,155,118,110,179,206, 55, 36,226,167, 66,181,197, 90,207,181,254, 41,237,220,
-102, 29,  0,228,158,250, 76, 13,224,208,237,142,211,250, 29,142, 73, 93,121,171, 72, 58, 41,239,236,215,135,235,186,204,197, 25,
-215,131, 94,212,241,175,205,186,157,  1, 96,100,124, 44,150,220,136,139,137,226, 48, 88,153, 97,154,175,201, 77,138,125, 17,249,
- 86, 86, 86, 90,111,111,239, 74,175, 46, 20, 10,133, 90,157,174,186,  6,148,115, 38,101, 22,214,  3, 29, 54,239,223,189,121,228,
-193,195,135,190,142,236,210,215, 89,228,227,131, 87,220, 56,216, 60,189,197,164, 95,226,242,174,244,254,236,252,154,228, 76,109,
- 60,234,216, 31, 70,169, 84, 38,  0, 40, 82, 42,149,125, 24, 99, 15, 57, 28,142,111, 81, 81,209, 53,163,209,120,163,206,  5,129,
-  5, 67,218,180,105,181,131,195,225,240,153,201,178, 40,198,138,247,147, 54,235, 78,  6,158,115, 90,146,208, 87,236,241,241,236,
- 21, 45,  2,131, 26,180, 40,159,235,176, 73, 61, 59,140,155,182,164, 69,189,250,193, 45,254,152,255,176,198,110,  2,204,168, 46,
- 26,181,127,195,162,243,113,191,159,249,220,197,179, 94,189,236,140,228, 59, 15,147,174,205, 51,107, 21,251,159,119, 63, 63, 72,
-186,181,108,253,183,211,166,100, 61, 74, 89,175,206, 75,188,  9,  0,234,188,196,155,119,100,248, 34, 63, 59, 99, 74, 65,110,242,
-183,207,186, 45, 84, 42, 85,230,246,237,219, 29, 34, 34, 34,184,238,238,238,200,203,203,195,153, 51,103, 44, 22,139,229, 81,157,
-179, 10, 83,206,168, 10, 57, 78, 91,214,126,183,200, 90, 98,247,166,201,100,242, 98, 12,224,243,249, 89,122,181,226,120,  9, 87,
-242, 25,138, 82,181,213,255,207,176,112,  0,112,203,231, 46,180, 88, 44,156, 69, 43, 55,167, 90,137,236, 42, 29, 12,209,168, 45,
-177,177, 88, 44,181,158,235, 80,158, 46, 11,124, 81,175,111, 14, 99,115,155,181,108,253,185,209,104,208,150,189, 62,180,  0,180,
-140,161,128,203,229,156,227, 89,140, 39, 20,207,241, 97,138,195,129, 61,227,240, 97, 39,230,131,  3, 14,148,197,133,172, 46,125,
-178, 42, 45,136,115, 19,110,169,115, 59,248, 31,211,239, 30,241,235,169,163,239,152,205,230, 87,202,218, 12, 30,232, 52,170, 61,
-202, 44,199, 45, 64,172,  9,255,126, 71,202,139, 45,206, 75,254, 67,181, 58,141,242,119,202, 12,169, 47,238,227,227,237, 62,226,
- 65,106,238,149,228,135,234, 45,248,243,180, 58,207,179,156, 60,119,119,247, 47, 56, 28,206, 48,129, 64, 96,171,215,235, 85,140,
-177,173, 57, 57, 57,243,240,212,228,191,225, 86, 98, 55,205,  8,129,200,102,150, 65,171,250, 77,157,155, 48,164,166,117,183,113,
-109,208, 77, 36,145, 76,211,106, 84, 91,213, 57,  9,155, 95,240,246,148, 10,133,194,112, 91, 91, 91,171,252,252,252,203,  0,138,
-255, 78,251,189, 89,179,102,126, 92, 46,247, 21,139,197,226, 14, 64,138,210,171, 66,242,249,124,254,163,178, 22, 45, 86,215,204,
-118,239,237,113,233,242,122,147,143, 79,158,191,183,188,236,180, 98,  5,239,  1, 75, 69,195,222,236,244,233,150,253,135, 42,187,
-234,240, 31,119,204,255,239, 50, 59,240,109, 61,243, 71,114,  5,210,249, 93, 66,180,234,252,204, 71, 19, 46,220,200,187, 12,160,
-228,121,150,211,218,218,122,168,193, 96, 16, 91, 91, 91,107, 12,  6,195,246,191,203,186,139,221, 66,222,231,130,213,122,102, 10,
- 11, 56,177, 79, 92,180,242,111, 57,150,120,161,161,161,237,173,173,173,253,204,102,179,141, 94,175, 87,107, 52,154,  7,169,169,
-169,191,161,234,137,207, 95,234,114, 74,220,130,151, 89, 91, 11, 39,  3,128,193,160, 91,161,202, 77,252,184,186, 39, 86,243,248,
-127,244, 62,114,121,165,101, 34,159,103,229,138,178,129,185, 45, 38, 83, 94, 78,202,213,224,191,112, 57,201, 51,238, 92,202,164,
- 76,202,164,204, 39,113,105,123, 82,230, 95,153, 41,242,108,228, 43,242,108, 84,235, 65,151,171,120, 60,109, 79, 82,110,108, 37,
- 55,  0,181, 24,176,148, 16, 66, 94,  2, 11,109,  2,242, 87,210,102,221,121,248, 50, 31, 79,254,115,170,236, 19,205,169,166, 42,
-173, 75,147,224,179, 84,182,167, 41,147, 50, 41,147, 50, 41,147, 50, 41,243, 63,151, 89, 83,246, 63,241,148,228,216, 39,238, 31,
-  1,240, 63,233,240, 79,205,170,148, 73,153,148, 73,153,148, 73,153,148,249, 95, 83, 81,120,113,105, 91, 16, 66,  8, 33,132,188,
- 28,212, 71,139, 16, 66,  8, 33,228,249, 84,118,234,144, 10, 45, 66,  8, 33,132,144, 23,160,202,206,240,116,234,144, 16, 66,  8,
- 33,228,249,148,183,104,121,226,137,225, 29,168,208, 34,132, 16, 66,  8,121, 49,178, 80, 89,235, 86,116,116, 52,171,236,123, 66,
-  8, 33,132,144,255,133,127,120, 45,242,120, 75,214,216,178,251,  0, 30,107,209,162,  2,139, 16, 66,  8, 33,127,151, 98,235, 31,
-166,188, 37,171,252,150,245, 84,161,213,171, 87, 47, 14, 21, 91,132, 16, 66,  8,249,171,252, 27,107, 17,238,147, 43, 72,187,153,
- 16, 66,  8, 33,127,101,177,245,111, 90, 31, 26,222,129, 16, 66,  8, 33,228,249,120,  2,232,249,216,253,255,217, 20, 60,132, 16,
- 66,  8, 33,255,118, 99,171,186, 79, 45, 90,132, 16, 66,  8, 33, 47,190,216, 34,132, 16, 66,  8, 33,255,100, 52,179, 57,101, 82,
- 38,101, 82, 38,101, 82, 38,101,254,219,149,143,163,  5, 84, 53,142, 22, 33,132, 16, 66,  8,121, 38, 61, 81, 58,126,214,216,178,
-175, 61,169,208, 34,132, 16, 66,  8,121,177,158,154,126,135, 10, 45, 66,  8, 33,132,144, 23, 91, 96,173,163, 66,139, 16, 66,  8,
- 33,228, 37,163, 66,139, 16, 66,  8, 33,228, 37,225,160,234, 43,  7, 78,215, 33,231, 89,174, 62, 56, 77,153,148, 73,153,148, 73,
-153,148, 73,153,255,185,204,154,178, 79,227,159,167,124,100,248, 35,248,163, 35,252,186,255,197, 31,166, 75, 95, 41,147, 50, 41,
-147, 50, 41,147, 50, 41,243,223,110,236, 19, 95, 43,208,169, 67, 66,  8, 33,132,144, 23, 91,108,209, 20, 60,132, 16, 66,  8, 33,
- 47, 72,149,167,  9,169, 69,139, 16, 66,  8, 33,228,249, 84, 57,169, 52, 21, 90,132, 16, 66,  8, 33, 47,167,224,162, 66,139, 16,
- 66,  8, 33,228,  5, 22, 89, 99, 43,253,109,116,116, 52,163,109, 68,  8, 33,132,144,191,202,191,182, 22, 41, 95, 49, 42,182,  8,
- 33,132, 16, 66,181, 72,157,121,226,143,171, 13,199,150,221,  7, 64, 87, 29, 18, 66,  8, 33,132, 60,175,158,248,243,149,135, 99,
-203,239, 83,161, 69,  8, 33,132, 16,242,252,198, 86,251, 91, 58,109, 72,  8, 33,132,144,191,210,191,177, 22,225,208,110, 37,132,
- 16, 66,  8,121, 46,149,181,102,173,163,205, 66,  8, 33,132, 16,242,114, 11, 46, 66,  8, 33,132, 16,242, 50,138,172,151, 61, 96,
- 41,205,108, 78,153,148, 73,153,148, 73,153,148, 73,153,255,149, 34,235,241, 33, 30,  0,208, 85,135,132, 16, 66,  8, 33,207,139,
- 38,149, 38,132, 16, 66,  8,121, 73,104, 82,105, 66,  8, 33,132,144,255,113,193, 69,133, 22, 33,132, 16, 66,200, 11, 44,178,254,
- 84,108, 81, 31, 45, 66,  8, 33,132,144,231, 83,101, 31, 45, 14,170,190,114,224,116, 29,254,192,179, 92,125,112,154, 50, 41,147,
- 50, 41,147, 50, 41,147, 50,255,115,153, 53,101,159,198, 63,223, 88,252,143,  6, 44,165, 75, 95, 41,147, 50, 41,147, 50, 41,147,
- 50, 41,243,191,134,134,119, 32,132, 16, 66,  8,121,209,133,213,147,168,208, 34,132, 16, 66,  8,121, 62, 52,142, 22, 33,132, 16,
- 66,200, 75,226,137,210, 86,173,242,175,225, 84,104, 17, 66,  8, 33,132,188, 24, 61, 81,218,170, 85,254,149, 10, 45, 66,  8, 33,
-132,144, 23,168,210,113,180, 56,  0, 16, 29, 29,205,202,238,119,236,213,171,215, 57,218, 86,132, 16, 66,  8,249, 95,250,183,214,
- 34, 21, 45, 90,189,122,245,226,  0, 56, 75,187,154, 16, 66,  8, 33,127,133,127, 99, 45,194,125,162,146,236, 72,187,153, 16, 66,
-  8, 33,127,133,127, 99, 45,194,127,162,138, 36,132, 16, 66,  8,249, 75,252,131,107, 17, 79,148,118,132, 63, 82,246, 21, 40, 27,
-242,129,198,209, 34,132, 16, 66,  8,121, 62,229, 87, 27, 62, 53,245, 14,181, 98, 17, 66,  8, 33,132, 60,159,202, 70,134, 95, 71,
-155,133, 16, 66,  8, 33,228, 37,162, 22, 45, 66,  8, 33,132,144,231,247,120,171,214,255,172, 53,139,102, 54,167, 76,202,164, 76,
-202,164, 76,202,164,204,255, 82,145,245,167,251, 52, 50, 60, 33,132, 16, 66,200, 75, 66, 87, 29, 18, 66,  8, 33,132, 60,159,242,
- 43, 14, 31,191, 79,133, 22, 33,132, 16, 66,200, 11, 44,182,158, 66,167, 14,  9, 33,132, 16, 66,158,207,216,170,126, 65,133, 22,
- 33,132, 16, 66,200, 75, 42,184, 56,168,250,202,129,211,117,  8,126,150,171, 15, 78, 83, 38,101, 82, 38,101, 82, 38,101, 82,230,
-127, 46,179,166,236,211,248,231,249,203,  6, 44,165, 75, 95, 41,147, 50, 41,147, 50, 41,147, 50, 41,243, 63,139, 78, 29, 18, 66,
-  8, 33,132,252, 13, 10, 45, 87, 62,159,255,185, 88, 44, 94, 35, 22,139,215,242,249,252,111,  1, 56,214,245, 15, 74, 36,146, 73,
- 30, 30, 30,119, 61, 60, 60, 50,252,252,252,142,218,217,217,124, 20, 32, 68, 36,  0,171, 23,180, 62, 33,  0, 62, 18,139,197,119,
- 68, 34, 81, 42,128,109,  0, 62,  2,224,242, 60,193,243,188,208,255,230,228, 62,  7,231,121,161,255, 19,191,234,233,238,238,126,
-  1, 64,183, 23,181, 83,  6,219,160,235,  0,  9,210,  7, 72,144, 62,216,230,217, 63, 53,216,217,217, 13,243,244,244,140,113,118,
-118,126,228,233,233,121, 73, 36, 18, 13,168, 99,132,155,187,187,251, 98, 95, 95,223,  4, 47, 47,175,229, 40,157,157,252,111,171,
-189, 16,237, 91, 11,145,215, 70,128,146,  8,  1,214,180, 17,224,245,215,  1,155,103,140,107,  7, 96,175,189,189,253, 53, 62,159,
- 31, 13,160, 95,217,241,213,143,207,231, 71,219,219,219, 95,  3,176,183,236,113,207,114,156, 46,  6,240,  8,192, 87,101,247,255,
-207,215,215,183, 36, 44, 44, 44, 53, 44, 44,108, 83, 80, 80,208,240,218,134,217,216,216,188,238,235,235,187,207,207,207, 47,181,
- 77,155, 54,133,222,222,222,247,124,124,124, 54, 11,133,194,142,244, 22, 71,  8, 33,127,127,111,  1,248, 26,192,170,248,248,120,
- 25, 99, 76,198, 24,147,197,199,199,203,  0,172,  1,240, 13,170,110, 66,252,211,207,157,157,157,231,206,159, 63, 95,155,149,149,
-197,242,242,242, 88, 66, 66,  2, 91, 54,107,154,165,187, 19,159,  5,184, 58,170, 61, 61, 61,239,251,251,248,236,108, 98,203,157,
-  6, 32,176, 54,153,143,113, 20,139,197,151,103,205,154,165,188,112,225,130, 82,175,215, 43, 45, 22,139, 50, 51, 51, 83,121,250,
-244,105,101, 68, 68,132, 18,192,199,  0,120,117,200,172,240,165, 23,206,177, 13, 95,176, 47,189,112,238,241,159, 55,108,216,240,
-182,197, 98, 97,253,251,247,215,  1,240,174, 75,230,147,188,  1, 81, 19,123, 56, 12,176, 69,142,105,243, 60,198, 86, 79, 97,  3,
- 36, 72,127,150, 76, 55, 55,183, 67,147, 38, 77, 82, 60,122,244,136,233,116, 58,150,158,158,206,198,141, 27, 87,236,230,230,182,
-189,150,235,238, 28, 26, 26,154, 19, 19, 19, 99,145,203,229,236,236,217,179,150,166, 77,155,230,212,178,216,234,250,196,178,172,
-243,242,242, 58, 90,151,155,155,155,219,250,186,238,163,215,132, 72, 55,200,206, 48,118,245, 36, 59,220,191, 13, 91,214,210,135,
-245,115, 18,200,219,  9,240,127, 29, 42, 31,202,164,170,204,119, 58,116,232,160,186,113,227,134,185,160,160,128,221,190,125,219,
- 50,102,204, 24, 45,128, 91, 99,198,140,209,222,190,125,219, 82, 80, 80,192,110,220,184, 97,238,208,161,131, 10,192,232, 58, 44,
- 39, 23,192,198, 57,115,230, 48,198, 24,155, 63,127, 62, 11, 11, 11, 99,157, 59,119,102, 74,165,146, 49,198, 82, 25, 99,155, 76,
- 38,211,200,218,100, 74,165,210, 97,147, 38, 77, 82,170,213,106, 86,206, 98,177, 48,185, 92,206, 86,173, 90,165,242,240,240, 56,
- 90,197,135, 12, 58,229, 65,153,148, 73,153,127,183,204,127, 50, 79,148,246,211, 42,191,213,186, 97,226,221,105,211,166,149, 23,
- 85,199,218,181,107,119,101,228,200,145,178,145, 35, 71,202,218,181,107,119, 22,192,137,216,216, 88,217,212,169, 83,101,  0,222,
-173, 97, 71, 56,182,109,219, 86,158,157,157,205,130,131,131, 89,189,122,245, 88,118,118, 54, 99,140,177,171,239,180, 96,191, 52,
-  2,123,120,254, 24, 59,121, 96, 47, 27,227,201,103,237, 61,165, 70, 79, 15,143,  2, 23, 23,151,  5,248,243,156,140,149,237,220,
-183, 27, 53,106, 84,114,235,214, 45,101, 98, 98,162,114,238,220,185,202,206,157, 59, 43, 67, 67, 67,149,253,250,245, 83,174, 92,
-185, 82,105, 48, 24,148,235,215,175, 87,218,219,219,223,170,164,216,122,230, 66,139,207,231,175,136,143,143,103,247,239,223,103,
-101,173, 20, 85,101, 74, 29, 28, 28,122, 56, 58, 58,126,236,224,224,208,  3,128, 20,  0,130,  1,219,102, 82,248,253, 95,179,128,
-134,209,239,118, 13, 92,213,245,213, 22,  3,236,184,114,227,119, 83, 24,235,239,247, 76,133,150, 84, 42, 29,246,209, 71, 31,149,
-232,116, 58,166, 86,171,153, 82,169,100,106,181,154,149,148,148,176,119,223,125, 87, 33, 18,137,222,174, 41,211,197,197,101,222,
-249,243,231, 77,217,217,217,236,252,249,243,236,232,209,163,108,245,234,213, 22, 55, 55,183,165,117,125,  1,122,120,120,156, 58,
-121,242,164, 44, 46, 46, 78,118,249,242,101,153,209,104,148, 25, 12,  6,153,193, 96,144, 69, 71, 71,203,246,239,223, 47,219,181,
-107,151, 76,175,215,203,244,122,189, 76,167,211,201,234,215,175,127,188,174,251,168,149, 16, 15,245, 23, 14, 51,182,244, 67, 86,
-188,112,  2,147,127,242, 38,203, 29, 23,201,214,188,234,195, 34,197,248, 25, 79,207,237, 89,105,166,149,149,213,185,212,212, 84,
-203,140, 25, 51,244,141, 27, 55, 46, 30, 53,106,148, 86,167,211, 49,198, 24,211,233,116,108,212,168, 81,218,198,141, 27, 23,207,
-152, 49, 67,255,224,193,  3, 11,159,207, 63, 93,135,229,252,166,188,200, 58,119,238, 28,123,156, 82,169,100,157, 59,119, 78, 13,
- 11, 11,219,244,202, 43,175, 12,169, 41,211,214,214,182,207,244,233,211,149,172, 18, 70,163,145,149,148,148,176,  7, 15, 30, 88,
-234,213,171,151,  9,192,153,222,204, 41,147, 50, 41,147, 10,173,151,102,108, 13,247, 43,223,136, 83,167, 78,149, 49,198,100, 51,
-103,206,148,149,181,108, 89,  3,176, 45,187,241,  1, 12,158, 62,125,186,140, 49, 38,155, 54,109, 90,249, 99,170,218, 17,111,237,
-217,179,199,176,124,249,114,230,238,238,206, 60, 60, 60,216,138, 21, 43,152,197, 98, 97,217,209,219,217, 47,141,192,238,124, 62,
-130, 49,198, 88,194,130,137,236,151, 70, 96,201,223,127,201,134, 14, 29,170,182,177,177,121,183,154,157,235,212,162, 69,139, 18,
-141, 70,163,220,188,121,179,210,198,198,230, 42,128,198, 40, 61, 21,201, 41, 91,214,225,141, 27, 55, 86,220,188,121, 83,249,211,
- 79, 63, 41,  1,204,173,229,  1, 19,  8,160,147, 68, 34,233, 55,221,219, 42,145,109,248,130, 77,119,199, 13,  0, 77,  1,184,150,
- 61,198,107,218,180,105,140, 49,198,124,125,125,207, 87,145, 41, 13, 13, 13,157,150,152,152, 24,101, 52, 26,163,226,226,226,162,
- 26, 52,104, 48,163,119,125,207, 54,  7,223,125, 61,188,248,203,  9,225,108,201, 39,161,223,190,209,170,235,206, 65, 29,223,125,
-239, 21,151, 11,163,220, 68,234,129, 82, 94,201, 19,167, 14,107,117, 96,123,123,123, 95, 78, 79, 79,175, 40,174, 74, 74, 74,216,
-163, 71,143, 88, 74, 74, 10,187,112,225,  2,243,244,244,252,165,166, 76, 15, 15,143,219,233,233,233,236,251,101,203, 88,255,166,
- 13, 89,164,131, 29,235,224,104,199, 90,218,138, 84,141,128,150,117, 45,180,174, 93,187, 38,  3, 32,  3, 32, 43, 40, 40,144, 21,
- 20, 20,200,138,138,138, 42,126,  6, 64, 86, 92, 92, 44, 43, 46, 46,150,233,245,122, 89, 64, 64, 64,157, 11,173,  8, 17, 34, 94,
- 19,161,176,141, 16,154,183,188, 93, 50, 39,212,119, 49,255,254,110, 27, 86,244, 97,103,182, 60,220,155,181, 19,224,255,106,153,
-249,150, 64, 32, 56, 11, 96, 74, 89, 81, 62,162, 71,143, 30,106,198, 24,235,209,163,135, 26,192,136,178,159,127, 84, 86,100,245,
-168,229,114,114,131,130,130, 84,229, 45, 89,  0,126, 11, 10, 10, 82,133,133,133,177,176,176, 48,230,235,235, 91, 82,150, 93,171,
- 55,180,192,192,192,  4,141, 70, 83, 81,  0,202,229,114,150,153,153,201,146,147,147,217,173, 91,183,216,213,171, 87, 89,106,106,
- 42,219,189,123,183,217,193,193,225,  8,189,153, 83, 38,101, 82, 38, 21, 90, 47,181,208,122,242,246,103,209,209,209,236,137, 31,
- 45,140,141,141,149, 77,159, 62, 93, 86, 67,101, 54,118,230,204,153,229,173, 94, 95, 87,243,207,127,125, 66, 66,  2, 27, 49, 98,
-  4, 11,  9,  9, 97, 33, 33, 33,108,228,200,145,172,184,184,152, 41,147,110,178, 95, 26,129, 93, 29,216,146, 49,198, 88,201,157,
- 56,246, 75, 35, 48,217,208,182,236,250,245,235,204,199,199,231,100, 53,127,255,231, 75,151, 46,229,109,223,190, 61, 27,165,253,
-177,172,  0,180,  6,176, 66, 44, 22,111, 68,233,233,194,122,  0, 28,131,131,131, 11,213,106,181,178,127,255,254, 74,  0,126,213,
-100,118,  8,  9,  9,185,191,126,253,122,150,155,155,203, 10, 11, 11,217,162,136,  6,140,109,248,130,205,111, 89,207,242,253,247,
-223,235,166, 76,153,162,114,114,114,138,  6,224,213,191,127,127, 19, 99,140, 69, 70, 70,230, 84, 22,230,224,224,208, 35, 49, 49,
- 49, 74,171,213, 70,201,229,242,168,194,194,194,168,195,  7, 15, 70,117,111,218, 96, 68,241,151, 19,194, 15,190,251,122,248, 27,
-222,142,253,150,118,123,117,252,163, 25,163,251,207,108,219,248,142,246,155,201,103,222,169,239,190,248, 89,246,182,171,171,107,
-150, 78,167, 99,  0,158,186,221,191,127,159, 57, 59, 59,167,215,148,225,228,228, 52,243,163,193,131,204,111,215,243,102,247,151,
-207, 98,198, 83, 63, 49,227,209,205, 44,105,225, 39,172,183,135,139,162,181, 53,119,122,109,151,199,195,195,227,212,229,203,151,
-255, 84,104, 21, 21, 21, 85, 90,104, 41, 20, 10,153, 94,175,151,  5,  5,  5, 29,127,222,163,190,181,  0,  1, 29,196,188,171,113,
- 35,218,179,188,  9,157, 89, 15,169, 85,234,115,196, 13,  6,112, 22,192,208, 58, 62,143, 11,224,155,242,130,106,225,194,133,140,
- 49,198,130,130,130, 84,120,190,139, 81,164, 13, 27, 54, 76, 25, 61,122,180,169, 81,163, 70,185, 17, 17, 17,242, 43, 87,174,176,
-115,231,206,177,163, 71,143,178,189,123,247,178,155, 55,111,178, 71,143, 30,177,132,132,  4,214,179,103, 79, 57,128, 14,244, 94,
- 72,  8,249, 59,171,164, 22,249,199,227,150,175, 88,175, 94,189, 56,143,173,160, 20,128,168,101,203,150,121,223,124,243,205, 18,
-148,142,  5,193,  9,229,225,157,206, 98,254,245,206, 98,254,245, 80, 30,222, 41,107, 49, 90,183, 96,193,130,121, 97, 97, 97, 89,
-  0,196,  0, 60, 42,251, 67,140,177,246,206,206,206, 72, 79, 79,135, 84, 42,133, 84, 42, 69,122,122, 58, 24, 99, 48, 49,192,200,
-  0,157,193,  0,141, 70,  3,173,133, 65, 99,  1, 20, 74, 37, 60, 60, 60, 96, 48, 24,  2,170, 88,254,102,  3,  7, 14, 12,  8, 13,
- 13,205,155, 58,117,106, 38, 74,251,202,108,124,255,253,247, 79,253,246,219,111,161, 74,165,178,240,214,173, 91,218,166, 77,155,
-246,  0,224,145,152,152, 56,108,213,170, 85, 24, 49, 98,  4,170,249,167,211,180,103,207,158, 71,111,222,188, 25, 48,116,232, 80,
-156, 61,123, 22,139, 22, 45, 66,126,126, 62,  3,  0,157, 78,199,204,102,179,161,109,219,182,134,229,203,151,183,138,140,140,188,
- 92,191,126,125, 30,  0,164,164,164, 36, 85, 22,200,225,112, 26,248,251,251, 67,167,211, 33, 47, 47, 15, 55,111,222,132,157, 84,
-138,248,204,124,247,142, 75,191, 47,248,252,224, 41,171,193,173, 66,157, 62,126, 61, 66,247,213,201,179,193,141,189,220,221,245,
-  6,163, 71, 66, 86, 78,230,179,236, 84,107,107,235,244,252,252,124,232,245,122,104, 52, 26, 40, 20, 10, 20, 20, 20, 32, 63, 63,
- 31,153,153,153,176,182,182,190, 95, 83,134,125, 97,225,249,148, 75,231, 56,187,127, 88,136,  0, 83, 33,248,251, 86,128,127,104,
- 13,  2,245,121, 88, 59,107,156,157,222,217,117,142,189,157, 93,145,131,131,195, 58,  0, 65, 53,229,133,135,135,163,160,160,  0,
-  5,  5,  5,112,118,118,134,163,163, 35, 28, 29, 29, 33,151,203, 81, 92, 92, 12,133, 66,129,224,224, 96, 52,107,214, 12, 91,183,
-110,125, 33,  7,247,239,122, 36,155, 96,158,112,234, 94, 38,172, 37, 18,212,119,180,245,127,213, 22, 78,213, 60,165,179,149,149,
-213, 30, 39, 39,167,147,  0, 62,  4, 32,  1,240,161,147,147,211, 73, 43, 43,171,190,  0,230,  3,216, 94,199,197,248,106,206,156,
- 57,211, 18, 19, 19,109,174, 95,191,142,169, 83,167, 98,238,220,185, 72, 74, 74,250, 14,128,165,236, 49, 31, 56, 59, 59, 71,115,
-185,220, 31,  1,188,  9,160,135,167,167,103,151, 26,114,251, 78,153, 50, 69,219,162, 69,139,132, 59,119,238,244,189,116,233, 82,
-203, 79, 62,249,164, 56, 45, 45, 13,  9,  9,  9,240,244,244,132,175,175, 47,148, 74, 37,138,138,138,208,183,111, 95,169,189,189,
-253,187,244, 54, 78,  8,249, 59, 23, 89, 79,212, 34,255,180, 22,173, 74,239, 87,250,137,218,198,198,102,142, 76, 38,107, 19, 22,
- 22,198,  7,176, 27,  0, 66,121, 24,208,183,109,243,141,  7,215, 45, 12,219,191,124, 86, 88,247,176,224,141,161, 60,148, 95,197,
- 22,221,178,101, 75, 71,153, 76,214, 86, 40, 20,254, 95, 21, 11,193,  0,192,209,209, 17, 82,169, 20, 14, 14, 14,112,116,116,132,
-197, 98,129, 82,173,133,202, 12,148,104,245, 40, 46, 46, 70, 73,217,125,165,206,  0,149, 74, 85,241,220, 74,116, 28, 61,122,116,
-222,170, 85,171,114,179,178,178, 22,  2,104, 58, 98,196,136, 62, 43, 87,174,196,175,191,254,170,125, 51, 36,208,121, 65,251,230,
-243, 26,103, 37, 69,133, 88, 97, 12,128,243,231,207,159, 71,219,182,109,193,225,112,  6, 85, 22, 40, 22,139,215,236,220,185, 83,
-124,235,214, 45,  4,  6,  6,222, 26, 52,104,208, 59, 11, 23, 46, 12,144, 40, 11, 47,  2,128,169, 32,251,214,196,137, 19,191, 88,
-176, 96, 65, 94, 94, 94,158, 65,173, 86,187,245,238,221, 27,233,233,233,120,244,232,209,111, 85, 20,153,  9,113,113,113,172,184,
-184, 24,201,201,201,136,139,139, 19,127,241,197, 23,173,204, 92,110,159, 12,216,189, 55, 34,162,101,171,161,173,155, 99,123,204,
-117,235, 11,247, 82, 28, 90,214,243,118,188,246, 48,235, 21, 35,  7,247,159,101,111,151,148,148,172,152, 55,111,158, 82,169, 84,
- 34, 35, 35,  3, 55,110,220,192,157, 59,119,144,154,154,138, 69,139, 22, 41, 11, 11, 11, 87,214,148,225, 37,226,127,186,248,147,
-247, 57,252,219,191,  1,215,207,  1,234, 18, 64,163,132,238,174, 12,155,238,102, 99,245,190,  3,130,180,244,116,135, 93,187,118,
-141,246,243,243,147,  1,  8,174, 46,143,177,210, 93,200,229,114,159, 44, 66,193,229,114, 75,  0,100, 75, 36,146,135,118,118,118,
- 15,185, 92,110, 54, 99, 76,245, 66, 62, 73,152, 96,  0,143,  7,  8,196,224, 90, 85, 59,181,231, 59,131,  6, 13,218,249,240,225,
-195,238,201,201,201,109, 86,174, 92, 57, 79, 36, 18,197,175, 92,185,114, 94,114,114,114,155,135, 15, 31,118, 31, 52,104,208, 78,
-  0,195,235,242,247,131,130,130, 38, 70, 69, 69, 97,209,162, 69,104,214,172, 25,130,131,131,213,115,230,204, 89,  1, 96, 22,128,
-255, 11, 10, 10,186, 56,113,226,196, 81,185,185,185, 30, 25, 25, 25,205,190,251,238,187,113, 43, 86,172,120, 53, 51, 51, 83, 84,
- 67,116,187,110,221,186,225,216,177, 99,  0,144,  5, 32,185,160,160,192,148,153,153,137,134, 13, 27,162, 85,171, 86, 80, 42,149,
- 80, 42,149,144,203,229,240,247,247,135,197, 98,105, 67,111,229,132, 16,242, 63, 45,184, 42, 47,180, 68, 34,145, 99,120,120, 56,
-234,215,175,239,136,178,171,181,156,  5,252, 25, 31,143, 30,108, 99, 43, 59, 14, 78,220, 47, 24,212,190,137,141,179,128, 63,163,
-236, 41,124,127,127,127, 97,120,120, 56, 36, 18,137,119, 21,127,252,108,118,118, 54,194,195,195,225,224,224,  0,169, 84,138,240,
-240,112, 24, 12,  6, 20,151,148, 64,101,  6,212, 70, 11,138,139,139, 81,152,151,  3,181, 25, 48,217, 57, 35, 53, 53, 21, 60, 30,
- 47,165,138, 76,207,192,192,192,188,248,248,248, 60,  0,231,  1,140,159, 59,119, 46,166, 79,159,142,217,179,103,239,180,201,122,
-208,109,231,177, 67,206, 59,230,124,224, 26, 44,224, 12,  6, 96,120,248,240, 33, 28, 28, 28, 32,145, 72, 42, 45, 12, 34, 35, 35,
- 91, 72, 36, 18,108,222,188,153,101,100,100, 68,160,244, 18,254, 20, 14,167,180,216, 19,115, 81, 12, 96,133, 76, 38,123,237,139,
- 47,190,184,215,181,107, 87,171,214,173, 91, 99,254,252,249,  0, 16, 93, 89,166, 92, 46,255,125,248,240,225,250, 51,103,206,224,
-238,221,187,146,131,  7, 15, 14,152, 63,127,126,147,180,180, 52,225,207, 71,143,191,177,237,161, 98,192,194,147, 23, 68, 11, 78,
-156,253,221,197, 94,210,248, 21, 23, 39,196,165, 61,178, 54,243,112,165,166, 61,250,154, 21,111,116, 71, 17, 63,174,189,144,155,
-213, 81,196,151,189,106,197,123,191,164,164,100,215,225,195,135, 79,124,242,201, 39,202,220,220, 92,216,217,217,161,160,160,  0,
- 95,125,245,149, 50, 46, 46,110,159, 94,175,255,185,166, 92,179,133,181,240,173,231,  7,220,143,175,248,153,193,194,112, 69,111,
-141, 94,227, 39, 35,164, 97, 67,232,245,122, 52,109,218,148, 51,119,238, 92,137, 84, 42,253,172,198,162,135,251,212,225,102,226,
-112, 56,217,140,177, 71, 74,165, 50, 67, 44, 22,167, 89, 91, 91,167, 21, 22, 22,102, 48,198,114, 94, 68,157,197,184,248,180,109,
-211, 32, 64, 40, 70, 90,129, 50,243,170, 18,133,149, 61,208,206,206,238,253,213,171, 87,139, 54,108,216, 96,156, 56,113,162,110,
-220,184,113, 86, 26,141,198,109,220,184,113, 86, 19, 39, 78,212,109,216,176,193,184,122,245,106,145,173,173,109,191,103, 89, 16,
-163,209,136,248,248,248,133, 73, 73, 73, 18,148, 14, 55, 50,121,206,156, 57, 35, 18, 19, 19, 69,171, 86,173,194,222,189,123,177,
-119,239, 94,244,233,211,  7,147, 38, 77, 66, 84, 84, 84,117,113, 54, 97, 97, 97,225,206,206,206, 56,119,238, 92, 38,128, 52,  0,
- 45,108,109,109,237,250,244,233,131,238,221,187, 67,171,213,194, 96, 48, 84, 20, 90, 60, 30, 15, 14, 14, 14,206,244, 30, 72,  8,
- 33, 47,189,200,250, 83,177,197,  7,128,242,166,186, 94,189,122,113,170,251,199,104, 46,202,133, 92,165, 70,106,177, 26,233, 69,
-150, 63,253,206, 98,177, 84,251,215, 51, 51, 51,127,142,137,137,121, 63, 60, 60,156,159,153, 89,122, 70, 44, 60, 60, 28,106,181,
- 26,153,215, 47, 67,101,  1, 36,129,161, 80,169, 84, 40,186,115, 13,182, 97,109,224,220,115, 40,150,174, 90,165, 43, 40, 40,248,
-161,178, 76,129, 64, 96,229,227,227,147,151,146,146, 98,  2, 80, 40,149, 74,187,249,249,249,225,236,217,179,  0,176,157,  1,139,
- 17,119,  6, 56,183, 31,172,180, 73,197,214,223,223, 31,185,185,185, 80, 42,149,103, 43,203,140,137,137, 73, 52, 26,141, 77,123,
-247,238,205,217,178,101,203,110,133, 66, 49, 27,192, 13,157,  5,188,235, 15,115,160, 50, 67,  4,224,117, 71, 71,199,143,162,162,
-162,186, 76,156, 56, 17,135, 15, 31,198,201,147, 39, 13, 40,237, 11, 22, 83, 73,108,113,114,114,242,218, 41, 83,166,180,230,114,
-185,227, 79,157, 58,101, 10, 14, 14, 86, 24, 12,  6,115,131,144, 16,238,236,185, 95, 90,127, 56,126,172, 67,129, 26,183,187, 55,
-240,108,203,225,  0,183, 31,229,166, 37, 41, 81, 80,221, 54,141, 20,240,162,251, 70,132, 69,190, 63,232, 45, 91, 73, 96, 99,168,
-110, 94,246, 88,187,231,232, 82,113, 92, 98,175,115,185,185,125, 14, 31, 62, 60,224,236,217,179, 31,234,245,250,250, 66,161,240,
-190, 92, 46, 95,174, 84, 42,107, 44,178,120, 60, 94, 79,157,167,143,163,188,176, 16,162,178,150, 40,133,209,130,124,157,  9,119,
- 29,130,241,174,143,111,197,105,208,236,236,108,120,120,120,112,204,102,243, 91,213,101,158, 60,121, 18,189,122,245, 42, 47, 60,
-193,225,112,192,225,112,242, 67, 66, 66,114,132, 66, 97,129,181,181,181, 98,241,226,197, 90,173, 86, 11, 62,159, 47, 50,155,205,
-188,231, 57,218, 91,217,192, 77,200, 56,107,198,245,238,212,181, 89,227,134,236,252,213,235,156, 34,181,118, 83, 53,173,128,223,
-  5,  5,  5,241, 11, 11, 11,127,  6,112,215,104, 52,238,216,189,123,183,104,216,176, 97,218, 61,123,246, 12,  1, 16,176,100,201,
-146,  1, 74,165,178, 78, 83, 42, 36, 37, 37,125,183, 96,193,130,105, 51,103,206,196,214,173, 91, 39, 38, 37, 37, 77, 47,107,233,
-234, 19, 21, 21,133,197,139, 23, 99,235,214,173,150,187,119,239, 30,181, 88, 44, 73,159,124,242, 73,152,187,187,123,126, 86, 86,
- 86, 82, 53,177, 45,123,244,232,161,187,120,241,162,160,164,164,228,  2,128,143, 38, 76,152, 48,250,181,215, 94, 83, 12, 26, 52,
-200,182,176,176, 80,110, 99, 99, 35, 88,191,126,189, 35,159,207,135, 74,165,  2,135,195, 65, 73, 73,137,158,222,  7,  9, 33,127,
- 87, 85,213, 34,255, 16, 85,254,111,224, 87,182,130,106,181, 58, 39, 61, 61,189,225,163, 71,143, 76,  0, 76,  0, 80,160, 55,125,
-189, 96,253,254, 13,253, 90,  7, 73,178,140, 70, 28,188,122, 75, 93,160, 55,149,119,126, 55, 61,122,244,168, 36, 45, 45,205, 78,
-163,209, 40,171,248, 91,191,173, 89,179, 70,115,230,204, 25,187,228,228,100,152,205,102,180,104,209,  2,  9,  9,  9, 40,186, 27,
- 15, 73,195, 22,144,116,232,133, 91,178,171,136, 59,121, 26, 15,148,122,211,189, 89, 11,138,149, 42, 85,148,193, 96, 56, 88, 89,
-160,149,149, 85, 33,  0,198, 24, 51,  3,128, 66,161,184,161, 84, 42,219,187,187,187,227,246,237,219, 18,149, 25,147,  6,204, 88,
-186,146, 49,102,182, 46,189,154,235,227, 65,131,  6, 33, 54, 54, 22,  0, 98, 43,203, 84, 40, 20, 19,199,140, 25,115,102,243,230,
-205,252,228,228,228,238, 27, 54,108,232,126,239,222, 61,198, 41, 76, 55, 95, 84, 91, 33, 96,196,164, 87,191,247, 15, 57,217,171,
- 87, 47,120,122,122, 98,253,250,245, 88,190,124,185,241,131, 15, 62, 72, 92,190,124,249,171,185,185,185, 59,170, 88,255, 98,185,
- 92,126,220,217,217,249,195, 38, 77,154,148,168, 84, 42, 20, 20, 20, 32, 51, 51, 19, 78,206,206, 92, 19,184,109, 93, 29, 28,118,
-252,156, 93, 34,225, 31,255, 29,151, 51,178,170,109,205,106,109,197, 27,222, 47,178,121,228,255,205,156, 97,139,139,  7,193, 25,
- 19,  5,182, 97, 30, 38,143, 28, 96,167,213,237,232,160,186,158, 58, 76,166, 80,108, 83, 40, 20,123,235,120,176,244,104,219,182,
-237,206,  5, 11, 22,136, 63, 95,180,  0, 75, 26,122,195, 84, 80,128, 60,157, 25,249, 58, 19, 20, 69,119,113,251,246, 45, 56, 59,
-187,224,193,131,  7,208,106,181,184,115,231, 14,227,241,120, 63,215,212,162, 83,238,177,211,133,114,161, 80, 88, 96,101,101,149,
-195,231,243, 11,147,147,147, 85, 90,173, 22, 92, 46, 87, 98, 54,155,197,181, 88, 86, 31, 23, 23,151, 79, 80, 58,152,232,225,146,
-252,252, 21,225, 86,112,  0, 31, 29,253, 93,156,223,152, 53,110,152,139,159,151,155, 60, 57,241,190,241,135, 19,151,242,181,186,
-170, 47,214,  0, 16, 93, 88, 88, 88,209, 34,185,103,207,158,201,123,246,236, 25, 13, 96, 35, 74,231,221, 58, 45,151,203,191,127,
-134, 23,223,172,125,251,246, 77,155, 57,115, 38,196, 98,113,197,224,169, 98,177, 88,  4,  0, 63,253,244, 19,110,223,190,253, 26,
-202,250,107, 89, 44,150,157, 89, 89, 89, 53,101,  6,132,134,134, 38,239,223,191, 95,  0,192,107,194,132,  9,109, 86,174, 92,137,
-145, 35, 71,230,221,186,117,171, 53,128, 20,  0,  1,227,199,143,191,178,117,235, 86, 71,139,197,130,162,162, 34,232,245,250, 20,
-122, 43, 39,132, 80,177,245, 82,132,  3,136, 67,233,248, 89, 61,  1, 28, 65,105,183,142, 42,249,150, 85,103, 39,  0,244, 46,255,
-255, 88, 69,103,120,160,244,138,172,227,  0,126,  4,224, 94, 85,168,179,179,243,103, 35, 70,140, 48,102,100,100,176,236,236,108,
-182,119,239, 94,246,241,251, 35,204,175,  7,122, 89,  2,189,220, 85,174,174,174,  9,158, 46, 78,155,154,219,224, 99,  0, 62,181,
- 88,177, 17,247,238,221, 27, 59, 98,196,136,247,203,254,238,251, 59,119,238, 84,158, 58,117, 74,201,227,241,162, 81, 58,180, 67,
-121, 65, 57,252,173,183,222, 82,234,116, 58,101, 72, 72, 72, 33, 74, 59,238, 87,101, 64,199,142, 29,139,142, 29, 59,198,204,102,
-243, 83, 99, 20,229,229,229,177,147, 39, 79,178,136,136,  8, 57,128, 97, 93,186,116, 57,123,233,210,165,179,237,218,181,219, 87,
-211,  2,187,184,184,204,184,126,253,122,108,106,106,170,236,200,145, 35,178, 29, 59,118,200,198,143, 31,127, 35, 44, 44, 76,147,
-152,152,104, 49,153, 76,236,250,181,107, 44,164, 65,  3, 21,  0,255,170,114, 58,139,249, 87, 20,235,231, 49,237,252,145, 76,219,
-215,151,  1, 96, 37, 75, 63, 99, 57, 19,187,178,132, 15,223, 96,157, 68,188,152,103, 57, 82,125,108,111,173,  0,  0, 32,  0, 73,
- 68, 65, 84,156,156,156, 78,196,198,198,178,146,146, 18,118,243,230, 77, 54,188, 87,119, 22, 51,186, 43, 59,222, 61,136,109,237,
-240, 10, 91,218, 45,140,117,239,208,158,173, 89,179,134,237,223,191,159,205,152, 49,195,226,226,226, 82,130,106,250,104,121,120,
-120,156,218,189,123,183, 12,128,140,199,227,201, 20, 10,133,172,164,164,228,231,135, 15, 31,174, 14,  9,  9,153,214,164, 73,147,
- 33, 13, 27, 54,236,220,233, 21,255,105, 93,236,132,  9, 93,237, 69,247, 27,216,218, 44,197,211,227, 94, 85,144,  2,254,129,  1,
-  1, 37,231,206,157,179,232,116, 58,118,225,194,  5, 75,163,  6,193,218, 37,  3,123,236,123,176,254,155,125,218, 99, 91, 78,168,
- 15,173,187,180,231,189, 94,241, 29,109,184, 91,218, 72, 42,134,227,120, 86,131,  1, 28,196, 31, 87, 29,142,  0,112,  8,213, 95,
-133,200,  5,176,113,254,252,249,143, 95,105,  8,  0,220,176,176, 48, 25, 99, 76, 22, 22, 22, 38,171,235,130,216,216,216,124,114,
-248,240,225, 57,126,126,126,139,  6, 13, 26,180, 94, 46,151, 31, 25, 50,100, 72, 60, 74, 47,  6,225,160,116,118,132,183,124,124,
-124,242,226,226,226,216,217,179,103, 89,255,254,253, 75,172,173,173,135,210,219, 56, 33,132,188, 20, 99,171,248, 90,173,  5,241,
-241,241,229, 99,104, 77,168, 46,124,250,244,233,178,216,216, 88, 25, 74, 71,137,175, 22,159,207, 63,240,193,  7, 31, 48,119,119,
-119,165,155,155,219,  1, 43, 30,111,180,175, 24,225,120,182, 75,221,219,111,219,182,173,207,119,223,125,215, 19,192,107,  0,172,
-188,189,189, 51,179,179,179,149,151, 46, 93, 82, 70, 68, 68, 40, 93, 92, 92,114, 67, 67, 67,149, 75,150, 44, 81, 26,141, 70,229,
- 39,159,124,162,196,211,227,125, 85, 70,  4,224, 67,129, 64,112,160, 81,163, 70,241,179,122,119, 54, 46,154, 52,154,141,  8,114,
- 85,  2,248, 14,192,  7,  0, 28,  0, 88, 13, 24, 48,224,151, 59,119,238,156,  8, 13, 13, 93, 91,139, 92,175, 38, 77,154,252,186,
-115,231,206,216,253,251,247,203, 62,251,236,179, 88,103,103,231,140,196,196, 68,139, 86,171,101, 69, 69, 69, 76, 46,151,179, 35,
- 71,142,152,157,156,156, 86, 85,185,226, 66, 94, 22, 59,185,189,210, 33, 28, 30,206, 28,202, 34,  4,220, 71,207,114,164, 72, 36,
-146,194,130,130,  2,150,157,157,205,146,147,147,217,190,125,251, 88,143,182,173,216,174,241,253,216,246,247,251,176,197, 61, 90,
-177,215,236, 68, 42, 15, 59,219, 88, 59, 59,187,220,218, 92,117,232,225,225,113, 74,167,211, 85, 12,223,224,227,227, 35, 11,  9,
-  9,217, 31, 26, 26,186,244,240,225,195,147,151, 45, 91,214,167,211, 43,254,211,190,234,222, 86,163, 62,189,135,149,236,254,142,
- 77,111, 17,172, 45, 43,230, 43,229,237,236,180,237,220,217,179,150,242,226,215,100, 50,177,131,  7, 14,176,129,111,188, 30, 95,
-124,252,167, 31, 47, 68, 77,220,249, 73,139,224,131, 17, 34, 12,174,174, 96,171,248, 40, 98, 11,231, 72,123,238,234, 55,253,156,
-178,218, 75,185,223,181,182,251,211,244, 82,  3,131,131,131,147, 25, 99, 89, 13, 27, 54, 76,  6,176,189, 97,195,134,143,223,127,
-175,138,216,138,193, 73,231,204,153,195,202, 94, 31, 92,  0,179, 23, 44, 88, 32, 99,140,201,130,130,130, 46,  2, 64, 51,  9, 92,
- 58, 72,185, 63,246, 14,112, 47,232, 32,229,254,216, 76, 82,249,148, 81,254,214,104,208,222,213,230, 66,159, 32,207,146,142,222,
-210,243,219, 55,109, 88,244,230,155,111,174,  7,176, 10,192, 60,103,103,231, 11,131,  7, 15,190,189,117,235,214,219, 75,150, 44,
- 49, 36, 38, 38,178, 81,163, 70,169,132, 66,225, 60,122, 31, 36,132,144,151,166,124,100,120,207,186, 20, 90,111, 77,155, 54, 77,
-198, 24, 43, 31, 75,107, 88, 37,143,233, 61,115,230, 76, 25, 99,172,124,116,248, 39,  7, 48,171,108, 64,179, 57,171, 87,175,102,
- 66,161,240,199,103, 92,153,199, 51, 61,250,246,237,219, 90,161, 80,188,234,238,238,254,106, 89,203,149,175,139,139, 75,242,142,
- 29, 59,148, 26,141, 70,201, 24, 83,154, 76, 38,101,108,108,172,178, 99,199,142,202,199, 62,245,215,180,156,127,242,185,  7, 46,
- 94,157,245, 62,251,220,  3, 23,159,248,213,208,141, 27, 55, 30, 75, 73, 73,249,217,222,222,126,106, 45, 51,125, 93, 93, 93,103,
- 59, 57, 57,157,112,113,113,249,220,201,201, 41,203, 96, 48,176,162,162, 34,150,144,144,192,206,158, 61,203, 98, 98, 98,152,147,
-147, 83, 70, 85,203,217, 69,204,255,189,104,209,135,204,178,113,  1,211,175,156,193,  0, 48,249,178,233, 44,127,205, 92,118,117,
- 76,119,214, 81,196,251,237, 25,182, 39, 28, 28, 28,214, 29, 56,112,192,146,148,148,196,162,163,163,217,145, 35, 71,216,164, 73,
-147, 88,  3, 47, 79, 93,107,  1, 55,167,189,144,127,226, 89,  6, 44,213,233,116, 50,133, 66, 33, 83, 42,149,178, 70,141, 26,201,
- 90,181,106,181,191,117,235,214, 75,247,236,217, 51,249,171,175,190,234,211,197, 78,152,160, 62,189,135,177,207,222, 96,236,195,
-118,236,254,232,142,172,179,152,127,189,202, 76,119,247,140,242,209,218, 85, 42, 21, 59,127,254, 60,251,245,215, 95,153,135,139,
-139, 34, 82,204, 27, 27, 33, 68,135,  8,123, 56,212,118, 57, 59, 73,185,155,126, 95,243,181, 89,115,108, 43,251,105,196, 27,166,
-142, 14,220,213,143, 61,110, 23, 99, 44,171,127,255,254, 15, 24, 99, 89,251,246,237,123,200, 24,203,234,215,175,223,  3,198, 88,
- 22,128,157,149,101, 62, 49, 56,233,198,178, 34,235,195, 57,115,230,200, 24, 99,178, 57,115,230,200,128,210, 65, 84, 59, 72,185,
-155, 47,175, 93,108,209, 29,217,204,246,140,234,105,238, 32,229,110,174,116, 57, 29,248, 63,199,109, 92,198,244, 39,182,179,  3,
-147,134,152,219,121,216,159, 11, 14, 14, 94, 60,121,242,228,253, 49, 49, 49, 55,204,102,243,237,228,228,228,219,171, 86,173,186,
-221,166, 77,155,139,206,206,206,241,  2,129,224,131,154,246,209, 11, 66,153,148, 73,153,148, 73,158,108, 96,170,230,119, 63, 47,
- 92,184, 80,194, 24,251,100,192,128,  1,248,230,155,111,  6, 54,105,210,100,176,183,183,183, 43,  0,100,102,102,170,111,222,188,
-169, 24, 48, 96,  0,102,207,158,141, 69,139, 22, 45, 69,105, 95,150,255,165,236,131,  7, 15,250, 76,156, 56, 49,247,171,175,190,
-178,140, 26, 53,170, 33,128,155,249,249,249, 13,134, 12, 25,242, 33,159,207, 31,224,239,239, 31,154,149,149,149,167,209,104,182,
-  3, 88,139, 26,206,153, 86, 69,200,133,185,101, 61, 79,156,224,194,252,216,143,223,152, 61,123,246,160,126,253,250, 25,150, 45,
- 91,102, 82, 40, 20,135,107, 25,247, 48, 47, 47,239,203,242, 59, 78, 78, 78, 30,215,175, 95,255,192,205,205,141,155,156,156, 12,
-157, 78,135,164,164, 36, 11, 74, 79, 77, 85, 74,105, 98, 43,190,223,119, 42,228,147,161,189,236,213,119,175,193,154,199,131,209,
- 74,128,236,223, 79, 96,227,249,187, 10,149,  1, 43,159,101, 61,229,114,249,183,147, 38, 77, 26, 50,117,234, 84,145,191,191, 63,
-231,183,223,126,195,238,221,187,117,185,185,185, 61,  0,156,251, 99,232,167,186,177, 88, 44, 16,  8,  4,  0,128,233,211,167,131,
-203,229, 90,229,230,230, 10, 56, 28,142,144,195,225,216,112, 56, 28,158, 49,229, 54, 44,138, 34,228, 20,201,241, 48, 71, 94,109,
-158,217, 98,217,125,249,242,229,143,155, 55,111,206,189,122,245, 42,242,242,242,144,148,148,196,204,140,237, 60,175, 49,151,118,
- 74,212,213,126,249,108,156,156,251, 54,115, 20,114,  5,155,102, 35, 82,207,229,253, 96, 65,127,148,142,165,  5,  0, 27, 57, 28,
-142, 53,128,130, 70,141, 26,117,186,115,231,142,184, 81,163, 70,154,187,119,239, 30,227,112, 56,222,  0, 54, 87,150, 41, 22,139,
-243,  1,228,239,219,183, 15,  0,198,160,116,227,181,136,138,138,202, 58,127,254, 60,230,204,153,147,  3, 96, 53,  0,216, 58, 58,
-247, 14,149, 90,115,  4, 91,230,160,141, 14,220,149, 22, 86,105,171,171,173,155,123,231, 38, 18, 46,172, 54,124,129, 87, 61, 66,
-184,  2,147,161,233,220,185,115,207, 43,149, 74,221,174, 93,187,244,239,189,247, 30, 47, 49, 49,241, 10,128, 11,  0,246,161,172,
-143, 37, 33,132,144,151,234,201, 22,172, 26,251,104, 61, 89,181,126,  3,224,251,123,247,238, 85, 76, 42,125,239,222, 61, 25,128,
- 31, 80, 58, 26,252, 91,117,168,120,103,149,181,104,173,125,198,149,121, 50, 83, 20, 30, 30, 46,190,115,231,142, 53, 42,159,196,
-145,243, 12,153, 79,169,108,174,195,224,224,224,229, 70,163,113,255, 15, 63,252,176,135,199,227, 13,121,142,106,223, 63, 40, 40,
-168,104,199,142, 29,150,232,232,104, 54,107,214, 44,179,167,167,103, 17,158,238,163,245,167,204, 72,  1,111,239,148,134,222,138,
-216, 97,237,216,253,201,189,217,133,161, 29,217, 88,111, 91, 69,164,136,183,251, 57, 63,149,  4, 73,165,210,141, 98,177, 88, 97,
-111,111,127, 10, 64,219,231,217, 71,206,206,206, 91, 61, 60, 60, 78, 61,126,115,119,119,223,239,234,234,250,157,139,139,203, 44,
-  7,  7,135,113,  1, 34,193,178,201, 13,188,180,241,125, 27,177,211, 17,174,108,168,139,224,201, 83,135, 79, 46,167,103, 64, 64,
- 64,193,182,109,219, 44, 63,255,252, 51,155, 49, 99,134,165, 94,189,122, 10, 84,211,175,173,218, 22, 45,  7,222,238,189,253, 90,
- 91,114,122,122,179,111, 26,218, 89, 58, 57,242,170,186, 66,113,104, 89,  1, 60,162,166,204,192,192,192, 31, 24, 99,155,230,207,
-159,191,  9,127,204,  5,250,250,220,185,115,163, 24, 99, 81,115,231,206,141,  2,208, 29,  0, 34,165,220,109,219,251,180, 52,103,
-190,233,197,190,110,104,107,142,148,114,183, 85,218,146,233,196, 63,120,104,116, 79, 75,214,232,  8, 54, 59, 72, 98,110,237, 36,
-252, 69, 32, 16, 76, 70,105,139,115, 43,  0,  2,250,212, 76,153,148, 73,153,212,162,245,183, 43,188,106,197,195,201,201,105, 99,
-253,250,245,247,248,251,251,239,177,181,181, 93,138,210, 78,243,117,221, 17,  1, 11, 22, 44, 80, 72,165,210,102, 47,112,231,186,
-  1,240,198,211, 19,231,190,176,  3,230, 75, 79, 76, 76,156, 58,240,250,151,158,152,248,216,143, 91, 53,108,216,240,107,148,142,
-230,253,188,  7,161,191,147,147,211, 42, 39, 39,167,140,178,190, 89,254,181,201,108,201,227, 13,233, 36,226,253,214, 86,192,205,
-238, 36,226, 95,122,149,199,123,247, 31,250,  2,172,238, 98,139,170, 50,125, 92, 92, 92,150, 57, 57, 57,101,186,184,184,172,170,
- 99,145,245,167,204,102, 98,120,118,118,224, 29,108,107,199, 81,117,150,242,246,181,180,169,250,162,142, 58,172,123,248,156, 57,
-115, 70, 50,198, 70,122,121,121, 13,120,172,240, 15,157, 61,123,118, 47,198, 88,175,242, 17,224, 91,217,192,173,163,  3,111, 71,
-132, 61, 71,222,209,129,183,163,149, 13,220,170, 90,206, 78, 14,188,221, 17,246, 28,121,164, 61,119,135,159, 16,245,232,205,156,
- 50, 41,147, 50,169,208,250,119, 20, 90,116,192, 80, 38,101, 82, 38,101, 82, 38,101, 82, 38, 21, 90,149, 23, 86,143,223, 42,206,
-176,241,105,219, 16, 66,  8, 33,132, 60,151, 42,  7, 44,229, 84, 83,149,214,165, 99,251,179, 84,182,167, 41,147, 50, 41,147, 50,
- 41,147, 50, 41,243, 63,151, 89, 83,246,255,250,194,186,127, 52,106, 86,165, 76,202,164, 76,202,164, 76,202,164,204,255, 44, 46,
-109,  2, 66,  8, 33,132,144,231, 18, 94,246,245,201,129, 75, 43,239,163,197,111, 53, 63,199,100, 50,185,  1,  0,159,207,207, 53,
- 94,153,229, 89, 93,186, 21,208,197, 84, 58,253, 14,248,192, 24, 19,112,170,146,204, 83, 38,147,201,177, 44,179,200,120,101, 86,
-247,106, 51, 91,205, 63,241,248,227, 77, 87,102,189,254,228, 99, 24,192,179,106, 53, 63,243,137,101,245,170,237, 86,225,224, 79,
- 99, 98,189,180,229,252,167,100,254,151, 89,189, 54, 63,199,104, 44, 61,142,172,172,248,185,134,203,213, 31, 71,214,175,205,207,
-124,252,241,198,203,179,220,171,203,180, 17, 11, 11,  2,189, 93,151, 86,151,153,156,153,255,137, 74,173,117,174, 46,179,174,175,
- 77, 95, 79,207, 46,230,178,215, 38, 15, 24,147,145,149,117,234,111,118, 44,181,  4, 48, 11,128,253, 99, 63,139,  7,240, 17, 29,
-149,132,144,127, 88,161, 21,135,210,121, 14,215,149, 21, 91,235,170, 44,180, 76, 38,147,155,236, 64, 20, 84, 58,160,203,240,249,
-110,  1,125,215, 62, 53, 81,178, 73, 91, 36,144,223,218, 21,202, 51, 42, 28, 93,249,  6,251,204,204, 76, 14,  0,112, 56,156, 31,
-  1,248, 85,146,233, 40, 59, 16,  5,181, 30,136, 28, 60,215,209, 15,176,207,179,182,254, 84, 44,145,116,210,104, 52, 77,  0, 64,
- 44, 22,223,210,168, 84,103, 92, 13,134, 37, 79, 62,190,170, 53,123,124, 89, 59, 15,155,239,214,176,239,218, 73,102,139, 69,240,
-232,234, 15,145,218,252, 68,190,149, 73,183,250,115,224, 88, 84, 37, 69, 85, 21,121,127,252,221,119,102, 56, 91,  1,157,  5, 34,
- 81, 51,  7, 71,199,246, 22,198, 26, 89, 44, 22,142,217,100,186,173, 40, 46,190, 96, 49,153,174,155,244, 42,103,217,225,175, 45,
-213, 45,231,147,235,242, 14,192, 63,  0, 12,144,216,218,118,226, 89, 89,181,  5,  0,179,209,248,155, 74,169, 60,243, 54,176,183,
- 54,235, 94,219,237,243,172,143,255,175, 49, 26, 77,110, 41, 39,162,160, 51,  2,225,253,191,118, 11, 27,178,101,  7,  0,232,115,
-175,187, 43, 19, 15,191,  6,  0,146,192, 94,151,133, 30,225, 57,  0,192, 79,203,114, 75,136,158,  9,157, 17,104,212,107,174, 91,
- 77,153,239,205,222,237, 60,117,108, 63, 33,  0,156,220,247, 93,131, 95,247,127,255,  6,  0,116,238, 55,225, 88,183,254, 19, 19,
-  0, 96,209,186,253,206, 59,191, 30, 88,109,102,237, 94,155,197,214,197,137,209, 65,122, 69,150,131,175,132,239,145,152,152,200,
-  5,  0, 47, 47,175, 90,189, 54,125,  0,105, 22,240, 33,151,199,107, 31, 24, 20, 20, 14,128, 37,223,191, 31,103, 54,153, 46,122,
-  2,171, 95,240,177, 52,137,177, 63, 15,206,202,225,112,232,128, 36,132,252,211, 28, 41, 43,174,142, 60,245, 97,182,170,103,168,
-116,192,185, 36,160, 67,235, 48,140, 29,242,166,237,227,191,219,187,118,174, 95,226,213, 67, 13, 55,108, 89,194, 13, 11, 11, 67,
- 74, 74, 74,173,150, 66,173,  7,206, 38,  2,144,223,177, 43,146, 72,238, 47, 91,188,216,254,245,215, 95,231,123,121,121,129,195,
-225, 32, 59, 59,187,245,233,211,167, 91,126,252,241,199,227, 33,191, 83,164,214,163,228,108, 98,205,185,229,203,218,164, 65, 61,
-204,154, 56, 80, 10,  0,159, 15, 95,221,242,234,189, 28,167,251,247,239,119,153, 54,109, 90,  1,239,204,153,239, 93,128, 77, 57,
-192,195,218, 44,231,214,159, 47,139,164, 89, 63,  5, 12,157, 56,113, 95, 80, 80,144,173,191,191, 63,199,206,206, 14, 60, 30, 15,
- 69, 69, 69,126, 55,111,222,124,227,202,149, 43,170,211,231,126, 20,196, 94,233,157,156, 43,122, 77, 91,171,117,215,100,138, 78,
-218,217,221, 26,246,246,219, 62,  3,  7, 14, 20,  5,  6,  6,  2,  0,238,223,191, 31,188,119,239,222,193,251,246,237,155, 13, 77,
-166, 73,173,135,182,166,117,175,200,  4, 32,  2,218, 58,184,185, 13,229, 89, 89, 53, 49,153, 76,222,101,173, 13,143,204, 70,227,
- 45,121,110,238,246, 39, 31, 79,158,166, 51,  2,119,178,128,174,237,195, 49,172, 95, 87,  9,  0, 76, 27,180,160,117,218,131, 36,
-107,189, 94,143,  6, 33,141, 34,230,125,189,244,  4,184, 92,108,219,127,186,226,241,181,201,140,191,147,130,168,121,203,144,121,
- 99,111,107,115,113, 82,167, 18, 69, 49, 15,  0,236,165,210,126,123,119,253,116,198, 43,116,192,239, 73,249,134, 90,101, 86,247,
-218, 60,190,107,149,103,198,205, 51,141,215,156,220,104,229,231,231,135, 27, 55,110,212,237,181, 89,124,207,206,226,233,121,123,
-201,103,159,121, 68, 70, 70,194,214,214, 22,124, 62, 31, 38,147,169,235,197,139, 23,187, 70, 69, 69, 77, 64,241, 61, 85,109, 95,
-155,181,176,132,195,225,116,122,111,236, 36,207, 55,251, 12, 64,191, 30, 17,116, 32, 18, 66,254,105,202, 91,175, 30,191,242,112,
- 93,181,133, 22,159,207,207,125,125,196, 87,110,237, 95,107,138,171,215, 19,138, 83,211,179,148,229,191, 43,188,181,183, 65,159,
-  8,239,198,231,207,159,131, 78,167,195,111,191,253,134,235,215,175,227,193,131,  7, 24, 55,110,156,174,236,212, 97,101,153, 69,
-145,131,231, 58,162, 56,209, 54, 88,112,239,149,211,119,239,242,180, 90, 45,206,159, 63,143,162,162, 34,  8,  4,  2,248,248,248,
-160, 91,183,110,252,187,119,239, 58,117,121,189,135, 52,178,199,187, 41,144,  6, 43,249,124,126, 81, 85,243,136,240,249,252,220,
- 46,195,231,187, 53, 14,174,135,251,169,153,197,179,190,222,160,180, 88, 24, 63,249, 65,154,225,220,185,115,  8, 15, 15,199,169,
- 83,167,156, 11, 11, 11,191, 88,189,122,245, 44,171,133,107, 86, 24,245,  5, 83, 80,117, 94, 81,228,224,185,142,206,185,123,252,
-127, 61,126,208,250,214,173, 91,214, 63,252,240,  3, 10, 10, 10, 32, 16,  8,224,224,224,  0, 15, 15, 15, 52,104,208,128,243,249,
-231,159,219,246,234,117, 11,255, 55,102,128,191, 33, 96,244,189,170,150,179, 98,221,149,105, 54, 46,138,147,129,251,143, 28,225,
-182,107,215,238, 79, 31,219,235,215,175,143,238,221,187,139,134, 14, 29, 26, 56,112,240, 16, 75,100,207,247,238,195,214, 95, 93,
- 99,166,234,161,216, 89, 29,227,213,117,240,224,195,115,231,206,117,240,240,240,128, 68, 34,  1,  0, 20, 23, 23,251,164,166,166,
-182,158, 61,123,118,255,203,241,187,248,145,189, 30,102, 66,226,171,169,110,123,254, 87, 89, 89,241,115,203, 91,145,236, 36,226,
-162,135, 25, 57, 42,  0,208,235,245,208,235,245,208,233,116,248, 96,194, 56,222,152,254,173,130,252,219, 79,186,246,224, 81, 78,
- 97,163,211,191, 59,149, 63,215, 88, 67, 38, 95,253, 64, 46, 79,255,101, 76,212,103,159,121,184,187,255,113, 70,112,219,214,173,
-188,194,194,194,174, 81, 81, 81,141,153, 77, 71,121,163, 94,115, 29,170,203,172,238,181, 41, 79, 56,242,202,188,137,221,155,173,
-253, 58, 26,102,179, 25, 49, 49, 49, 56,127,254, 60,150, 46, 93,202,142, 29, 59, 86,108, 47,145,140, 65,181,175,205,123,118,237,
- 60,179,  3, 22, 46,220,199, 17, 10,133, 56,116,232, 16,238,222,189, 11, 46,151,139,176,176, 48, 12, 27, 54, 12, 93,187,118,245,
- 24, 59,118, 28,139,236, 49, 40, 25,210,144,146,231, 60,150,184,  0, 38,205,136, 90,232, 57,124,244,135, 88, 52,239,115, 42,180,
-  8, 33,255,228,214,172, 42,135,120, 64,116,116, 52, 43,187,117,  0,  0,  6,112,235,247, 93,187,115, 79,172,229, 72,253,190,107,
-119, 50,128,203,  0,174, 61, 80,175,121,243,230, 70,185, 92,206,174, 92,185,194, 62,248,224,  3,213,138, 21, 43,206, 28, 57,114,
-100,175,201, 96, 88,239,229,233,249, 45,171,162,131, 61,  3,184,254,128,212,198,198, 38, 47, 61, 61,157, 29, 61,122,148,205,153,
- 51,135,109,223,190,157, 29, 59,118,140,157, 62,125,154, 29, 59,118,140,237,220,185,147,197,199,199,179,132,132,  4, 38,145, 72,
-242,252,  1,105, 53,153, 60,  6,240, 26,244,253, 97,202,190,171,198,185, 33,125,215,126,204,  0,158, 35,208,176,121,243,230,230,
-189,123,247,178,109,219,182,177, 45, 91,182,176,248,248,120,150,159,159,207,248, 66, 73, 94,249,243,170, 90, 78,  6,112,189,189,
-189,243,228,114, 57,243,245,245,101,  2,129,128,185,187,187,179,  6, 13, 26,176,214,173, 91,179, 55,222,120,131, 13, 25, 50,132,
-125,241,197, 23, 76, 46,151, 51,145, 72,148, 83,254,188,170, 50,195,  1,177, 68, 34, 73,151,201,100,172, 42, 26,141,134,229,231,
-231,179, 19, 39, 78, 48,137, 68,146, 30, 14,136,171,203, 20,  3, 45, 66, 67, 67,243,242,243,243,153,193, 96, 96,233,233,233,236,
-230,205,155,236,238,221,187, 44, 61, 61,157,105, 52,154,138,236,132,132,  4, 22, 16, 16,144, 39,  6, 90, 48,186,  8,162,202, 99,
-233,201,155,159,187,251, 27, 30, 30, 30,154,125,251,246,177, 71,143, 30,177,205,155, 55, 51, 46,176,224,201,199, 85,151, 41,  0,
-186,181,107,215,206, 28, 19, 19,195,174, 93,187,198,166, 79,159,206,186,119,239,206,122,244,232,193,162,162,162, 88, 70, 70,  6,
-203,200,200, 96,111,188,241,134, 89,  0,116,171,233,248,172,236,181, 41,  5,252,122,245,234,165, 49, 24, 12, 44, 57, 57,153, 53,
-105,210, 36,131,  7, 12,149,  0,141, 59,  0,194,154,142, 79,111,192,209,211,211, 51, 43, 38, 38,134,237,223,191,159,249,251,251,
-231,241,128,247,236,129,250,246, 64,125, 30,240, 94,253,250,245,243, 98, 98, 98, 88, 65, 65,  1,243,243,243,203,242,  6, 28,159,
-227, 88,226,  2,216, 56, 35,106, 33,187,151,161, 98, 51,162, 22, 50,  0,233,140, 49,134, 74,250,120, 18, 66,254,253,158,172, 69,
-254, 45, 42,222, 36,123,245,234,197,  1,112,182,186,  7,107,120,188,175, 22, 45, 90,196,215,106,181,216,176, 97, 67,201, 59,253,
-251,239,233,208,190,125,242, 43,254,254,114, 14,151, 91,227,108,195,121, 66,225,228, 69,139, 22, 57,232,245,122,196,198,198,162,
-101,203,150,240,240,240,128,173,173, 45,108,109,109,225,230,230,134,144,144, 16,228,230,230,194,206,206, 14, 83,167, 78,149,230,
-  9,133,147,107,202,181, 88, 24, 31,  0,204, 22,139,192, 26, 24, 27,240,234,171,177,179,103,207,230, 58, 59, 59,195,201,201,  9,
-182,182,182,184,123,247, 46,244,122, 61,108,196, 54,181, 26,164,149,203,229,114,109,109,109,241,235,175,191, 98,210,164, 73,104,
-219,182, 45, 28, 28, 28, 96,103,103,135, 38, 77,154,160, 91,183,110, 24, 51,102, 12,146,147,147,193,169, 69,167,146,219,124,254,
-135, 99,198,140,113, 11, 15, 15,175,244,247, 90,173, 22,114,185, 28,121,121,121,240,241,241,193,128,  1,  3,220,110,243,249, 31,
- 86,149,231, 12,120,248,  4,  7, 31,190,114,229,138,139, 68, 34,193,182,109,219,112,240,224, 65, 28, 63,126, 28, 71,143, 30, 69,
-116,116, 52, 14, 29, 58,132,188,188, 60,  0, 64,112,112, 48,118,239,222,237, 98,235,230, 22,237, 12,120,208, 75,186,118,210,114,
-114, 78, 54,201,206,118, 25, 58,100,200,  5,165, 82,137,161, 67,135,226,171,111,190,249,220, 10,248,184, 54,207, 15,  1,164, 78,
-158,158,155, 22, 46, 92,200,205,206,206,198,219,111,191,157,191,228,155,111,222,143, 59,113, 34, 80,118,252,120,224, 87,115,231,
-190,223,161, 67,135,252,140,140, 12,108,221,186,149,235,238,231,183, 41,  4,144,214,117, 57, 75,128, 73,203,151, 47, 23,105,181,
- 90,188,254,250,235,201,150, 91,183, 66, 76,192, 79, 74,224,238, 89,192, 80,211,243,179,128, 15,167, 78,157,234, 33, 20, 10,241,
-233,167,159,230,171,211,210,154,154,128, 45,197, 64,106, 49,144,106,  2,182,148,164,164, 52, 29, 62,124,120,190, 80, 40,196,178,
-101,203, 60,178,254,152,116,187,182, 90,  2, 56, 12,224, 28,128,204,247,198, 78,122, 47,188, 85, 27,108, 93,191, 26, 95,207,157,
-182,  9,192, 59, 28, 14,103, 59,128, 41,116,228, 17,242,223, 84,155, 90,228,111,170,202, 41,119,248,143, 87,146,  0, 58, 86,151,
-226,232,236,220,178,105,211,166, 56,127,254, 60, 66, 67, 67,175, 56, 56, 56,152,172,133, 66, 88, 89, 89,129, 89,106,172,179, 32,
-150, 72,186,116,237,218,149,255,251,239,191, 35, 32, 32,  0, 98,177, 24, 86, 86, 86,127,186, 89, 91, 91,195,211,211, 19, 10,133,
-  2, 93,186,116,177, 90,185,114,101, 23,232,116,243,106,252,135,152,120,211, 54,239,247,133, 67,126,220,188,169,126,100,100, 36,
-138,139, 21,176, 88, 44,176,177,177,129, 94,175,  7,159,207, 47, 61,  5,100,100,138,218,108, 49,179,217,108,230,241,120,  8,  8,
-  8,192, 87, 95,125,  5,173, 86, 11,107,107,107,  0,128, 66,161,128, 92, 46,199,205,155, 55,145,154,154,138,178, 79,225,213,178,
-147, 74,223, 28, 56,112, 96,165, 19,254,234,116, 58, 20, 23, 23,163,184,184, 24,114,185, 28, 90,173, 22,109,218,180, 17, 28,137,
-142,126, 19,  5,  5, 75, 42,125,142, 72,212,127,235,214,173,110,  2,129,  0, 26,141,  6, 37, 37, 37,120,248,240, 33,210,210,210,
-180,185,185,185, 38, 59, 59, 59,174,191,191, 63, 87, 40, 20, 10,251,246,237,203, 81, 40, 20,224,112, 56,232,213,171,151,243,142,
-109,219,  6, 66,175, 95, 74, 47,233,218, 57,  9,232, 90,232,245,111,189,214,170,213,175, 87,174, 94, 13,159, 60,121, 50,226,227,
-227, 23,218,236,218,117, 78, 13, 92,175,238,185,201,192,135,223, 62, 86,192,176,180,180, 80,  3,144,247,216, 67, 82,253, 83, 82,
-142, 15, 31, 62,252, 70,124,124,188,203,178,101,203, 60,222,121,251,237, 15,  1, 44,168,203, 50,218, 73,165,175,122,122,122,226,
-216,177, 99, 72,127,240, 96,154,  9,208,212,233, 19, 23,143,215, 46, 50, 50, 18,135, 14, 29, 66, 70, 90,218, 52,211,159,151,177,
-244,131, 18,144,199, 79, 78,158,182,105,211,166,141,163, 70,141,  2,143,207,111,  7, 83,157, 78, 28, 62,213,241,125,212,184,201,
-216,180,110,229, 38,  0,163,  1, 88,  0, 92,161, 35,142,144,255,118,171, 86, 77,181,200, 63,168,216, 90, 87,231, 22, 45, 55, 55,
- 55,111, 91, 91, 91,100,102,102,162, 81,195,134,185, 66,161, 16,  2, 43, 43,136,  4,130, 90, 45,129, 90,173, 14,245,242,242, 66,
-113,113, 49, 92, 92, 92, 96,109,109, 93,113, 19,  8,  4, 21,223,219,217,217,129,203,229,194,207,207, 15,106,181, 58,180,198,220,
-156,155,110,187, 86, 78,248, 32,230,220,177,250,111,191,221, 15,142,142, 78,240,245,245,129,155,155, 27,196, 98, 49,124,125,125,
- 17, 24, 24,200,150, 44, 89,  2, 27,183,176, 90,189,145, 63, 94, 60,241,249,124,152,205,102,228,228,228,224,222,189,123,136,143,
-143, 71, 76, 76, 12,174, 93,187,134,146,146, 18,212,162,206,130, 90,163,105,198,231,243, 43, 45,178,228,114, 57,228,114,121, 69,
-161,149,151,151,135,212,212, 84, 40, 85,170,230,213, 20,189,253,154, 54,109,202,  3,  0,177, 88,140,230,205,155, 99,237,218,181,
-166,159, 15, 30, 28,212, 56, 38,198,201,247,196,  9,135, 31,127,248, 97,208,128,  1,  3,204,191,255,254, 59, 20, 10,  5,238,220,
-185,  3, 87, 87, 87,190, 64, 36, 26, 72, 47,231,186,145,  1, 42,151,146,146, 30,109,219,182, 77, 41, 46, 46,198,226,197,139,185,
- 86,118,118,235,230, 86,113,138,175,  2,143, 23, 17, 25, 25,137,195,135, 15, 35, 51, 45,109,122, 90, 37,  5, 76, 26,144,151,158,
-156, 60,125,211,166, 77,232,214,173, 27, 56,124,126,157, 59, 42,181,110,221,186,169,197, 98,193,141, 27, 55,224,  0, 92,174,235,
-243,  3,131,130,194,203, 91,126, 37,192,133,170, 30, 39,  1, 46,196,197,197, 65, 44, 22,163, 81,227,198, 45,234,248,103,150,112,
- 56,156,172, 81,227, 38, 99,255,241, 75,  0,128, 77,235, 86,230, 60, 86,100, 17, 66,168, 69,235,159,218,162, 85, 94, 88, 61,126,
-195,159, 10,173, 90, 22, 31,  0,  0, 43, 43, 43,  8,132, 66,  8,  4,130,210,  2, 73, 40,172,117,  6,135,195,129, 72, 36,170, 40,
-172, 30, 47,176, 30,255,222,198,198,166, 86,  5, 12,  0, 20, 37, 29,111, 63,250,253, 81,  2,161, 80,  8,189, 94,  7,198, 24,132,
- 66, 17, 28, 28, 28, 16, 16, 16,  0,133, 66,129,182, 17, 29,116, 15,229,214,209,206,141,250,198, 63,203,214, 51,153, 76, 80,169,
- 84, 40, 42, 42, 66, 97, 97, 33, 20, 10,  5, 52, 26, 77,173, 47, 69,183, 88, 44,188,135, 15, 31,226,167,159,126, 66, 65, 65,  1,
-128,210,142,214,229,197, 85,249,215,148,148, 20,108,219,182, 13, 15, 30, 60,168,211,254,105,223,190, 61,162,163,163,121, 29,187,
-116, 89,127,202,223, 63,243,148,191,127,102,199, 46, 93,214, 31, 62,124,152,231,237,237,141,212,212, 84,196,198,198,162,168,168,
-  8,140, 49,186,126,254, 25,220,  7,138,212,133,133,163, 62,255,252,115,102,107,107,139,197,223,126,219,108,  1,240,110,109, 11,
- 24,105, 53,  5,140,244,249, 10, 24, 48,198, 96,177, 88, 96, 54,155,159,105,221, 56, 28, 14,199,202,202,170,174, 67, 43,212,229,
-193, 21, 29,223,167,126,241, 21,142, 30,218, 91,254,243, 68, 42,178,  8, 33,255,  2, 85,118,132,231, 63, 86, 65, 86,124,173, 74,
- 78, 78,206, 35,149, 74, 85,223,223,223, 31, 25, 25, 25,110,126,126,126,105,  2, 43, 43, 88, 11,  4,224,112,107,174,  9,108,108,
-108,110,100,102,102, 70,120,123,123,195,100, 50, 85, 20, 85, 79,158, 58, 44,111,165,185,118,237, 26,108,108,108,110, 64, 91,237,
-200,  9, 48,235,139,234,181,104,209,162,162,101,200,193,193,  1, 14, 14, 82,  8,133, 34,204,156, 57,211,178,108,201,146,213,126,
-157,231, 22,143,252,248,115,246,249,130,245, 47,116,203,214,246, 31,147,141,141,205, 13, 95, 95,223, 54, 82,169, 20,251,247,239,
- 71,106,106, 42,138,138,138,160, 86,171,161,211,233,160, 86,171,161,215,235, 33, 18,137,208,184,113, 99,216,219,219,227,244,233,
-211, 55,160,211, 85, 94, 92, 22, 20,236,191,113,227, 70,155, 86,173, 90, 85,180,168,116,234,212,137,211,169, 83, 39,151,138, 86,
- 52,181, 26,249,249,249,184,114,229, 10, 78,159, 62, 13, 14,135,131,196,196, 68,179, 78,163,217, 73,175,137,103,163,  5,126,227,
-109,218,180,113,252,248,241,239, 71, 68, 68,192, 12,188,  1, 96,219, 95, 88,192,  0,  0, 98, 98, 98,110,154,205,230,136,  6, 13,
- 26, 64, 14,188,  6,224, 80,157,138,200,164,164, 56,147,201,212,165, 89,179,102,216,191,103, 79,123,  0,169,149, 61, 78,  5,180,
- 15, 15, 15,135, 70,163,193,157,219,183,101,117, 40,178,214,207,136, 90,248,222,240,209, 31, 98,235,250,213,216,180,110,229,195,
-141,107, 87,248,162, 22,253,199,  8, 33,255,169,214,172, 26,107,145,191,169,177, 85, 21, 95,252,186,164, 20, 23, 21,201,226,226,
-226,234,183,104,209,  2,235,215,175,111,213,182, 77,155, 71,214,  2,129, 73, 96,109, 13,110, 45,254,145,104, 84,170, 95,126,249,
-229,151,215,250,246,237,203,255,253,247,223,225,225,225, 81, 81,104,149,127,229,243,249, 96,140,193,198,198,  6,  7, 14, 28, 48,
-104, 84,170, 95,106,108, 45, 50, 91,204,220,178, 66,143, 49,  6,185, 92, 14,107,107,107, 44, 93,186, 12,171,150, 44, 25, 98,  6,
-246,  6, 75, 92, 63,  3, 32,250,203,254, 65,171,213,191, 30, 61,122,180,229,236,217,179,173,124,124,124, 32,151,203, 81, 84, 84,
-132,130,130,  2, 40, 20, 10, 40, 20, 10, 20, 21, 21, 65, 46,151, 67, 36, 18, 33, 62, 62,222,168, 85,171,127,173, 42, 79,168,213,
-238, 27, 49, 98,196,212,184,184, 56, 79, 62,159, 15,163,209,  8,139,197,  2,139,197,  2,131,193,128,164,164, 36,220,186,117, 11,
-119,239,222, 69, 97, 97, 33,172,172,172,192,227,241,112,237,218,181, 34,137,209,184, 71, 79,175,233,103,102,  5,236,191,120,241,
-226,251,195,134, 13,131,151,143, 79,  7,100,100,212,170,128, 57, 88, 77,  1, 83,252,108,  5,204, 31,  5, 80, 73,201,213,148,148,
-148,136,142, 29, 59,194,211,199,103, 97,227,140,140, 83,183,235,208, 79,203,108, 50, 93,184,120,241, 98,151,225,195,135, 99,253,
-250,245, 11, 93, 83, 82,142,231, 61,113,154,211, 21,112,125, 37, 48,112,225,123,239,189,135,147, 39, 79,194,108, 50, 93,168, 38,
-242,241, 17,223,235,189, 55,118,146,239, 19, 29,223,215,114, 56,156,137,  0, 22,211, 17, 69,  8,249, 55,183,104,213,233,212,161,
-216,108,158, 49,101,202, 20, 35,151,203, 69,191,126,253,236, 14, 29, 62, 60,224,218,245,235,  1,185,185,185, 14,102,179,185,198,
- 44, 87,157,110,197,148, 41, 83,228,122,189, 30, 33, 33, 33, 40, 44, 44,132,217,108,  6,159,207,  7,159,207,  7,135,195,  1,151,
-203,133,173,173, 45,226,226,226,176,113,227, 70,133,171, 78,183,162,198,127, 18,102,243,141,109,219,182,129,199,227, 49,145, 72,
-  4, 14,135,  3, 62,159,143,101,203,150,229,174,  2,246,  3,  0,143,203,213,  3,  0,151,203,169,109,239,221, 26,207, 91, 10,  4,
-  2, 88, 74, 47,  2,168,241,177,142, 58,221,242, 69,139, 22,149,220,185,115,  7, 42,149,170,162,245, 77,169, 84, 86,116,174,151,
-203,229,224,112, 56, 80,169, 84, 56,124,248,112,137,163, 78,183,188,170,188,  2, 32, 59, 35, 49,177,119,171, 86,173, 10, 82, 82,
- 82, 80, 92, 92,140, 27, 55,110,224,244,233,211,216,189,123, 55, 78,158, 60,137,164,164, 36,152, 76, 38,120,123,123,131, 49,134,
-131,  7, 15, 22,155, 74, 74,222, 40,  0,178,233, 53, 81,181,122, 30, 30, 93,220,221,220,210, 93, 93, 92, 50,234,121,120,116,121,
-242,247, 82, 32, 33, 33, 33,  1, 38,147,  9,  1,  1,  1, 78,213,245,211, 98, 38,211,197,139, 23, 47, 98,248,240,225,240,173, 95,
-255, 27,127,192,245,201,199,248,  3,174,254,129,129,223,148, 23, 48,204,100,186, 88,215,101,182,  3, 86,126,246,217,103, 26,107,
-107,107,236,218,181, 43,192, 24, 20,116,151, 15,188,107, 11, 52,236,  8, 88,215,244,124, 79, 96,245, 23, 95,124,145,205,225,112,
-176,125,251,118, 23,105, 96,224, 77, 62, 48, 66, 10,212,147,  2,245,248,192,  8,105, 96,224,205, 93,187,118,185,152, 76, 38,124,
-252,241,199,217,158,192,234,106, 34, 39, 49,198,222, 98,140, 69, 50,198,124, 55,174, 93,129,163,135,246,150, 23, 89,163, 81,218,
-233,125, 24,128,155,116,196, 17, 66,254,205, 42,109,134,226,183,154,159,  3, 48,183, 14,173,195,112,245,250,189, 98, 23, 71,251,
- 19,229,191, 43,188,181,183, 65,231, 80,251,176, 53,107,214,192,202,202, 10, 15, 31, 62,196,237,219,183, 97,111,111,143, 33, 67,
-134,232, 52, 37, 37,189, 31,155,235,176, 43,128,211,101,153,165,243,169, 21, 39,218,  6,242,227,235, 31, 63, 26,205,147, 74,165,
- 80, 42,149,224,114,185, 16,137, 68,176,177,177,129, 88, 44, 70,108,108, 44,122,190,213,199,156,103, 19,249,199,128,165,127,204,
-167, 86,145, 89, 62,214,208,107,128, 77, 28,240,169,155,151,215,148, 89,179,102,137,187,119,239, 14,107,107,107,248,212, 11,206,
- 14,232,177,120, 37,151,203, 49,101, 20, 40,102,  6,214,243,146,222, 78, 76,  5,192,201, 53, 94,153,229,245,216, 92,135, 79, 45,
-167,159,254, 92,192,129, 45, 75,236,155, 55, 47,237,143, 46,151,203,145,147,147,131,220,220, 92,200,229,114,168, 84, 42,  0, 64,
-116,116, 52,142,158,191,171,208,248, 12, 72,174,106, 57,255, 88,247,123,118, 94,134,203,175,236,216,182,133,231,234,234,138,156,
-156, 28,228,229,229, 65, 46,151, 67,163,209,192,108, 54,163,176,176, 16, 27, 54,109, 49, 23,216, 70, 62,168, 24, 16,178,186, 76,
-213, 67,177,147,242,146,119,120, 99,127,246,254,251,239,219,217,219,219,195, 98,177,160,168,168,  8,233,233,233, 72, 73, 73,193,
-249,243,231, 85,185,114, 61, 84, 46,175,103, 84, 12, 88, 90, 73,230, 11,244,143,203,124,124,220, 42, 47, 79,207,204,180,180, 52,
- 55,179,217, 12,111,111,111,147,188,176,240, 27,  1,112,210, 14,200,250,127,246,174, 59, 44,138,107,125,191, 51, 59,219,119, 89,
-250,210, 81, 68, 64,186, 34,150, 24, 75, 20,236,216, 75, 52, 26, 77,108, 49, 49,177,196, 36, 26, 19, 91,212, 24, 99,162,166, 89,
-163,198,146,216,176,  4, 59,138, 98,185, 54,176,208, 65,  4,  1, 41, 75,221, 93,182,183,249,253, 33,112,209,  0,187,152,228,222,
- 27,127,251, 62,207, 62, 44,187,179,239,156,115,230,204,153,247,124,231, 59,223,  7,128,174,  0, 62,219,248,221,119,111,143, 24,
- 49,  2, 93,186,116, 41, 44, 45, 43,243,105,170, 47,209,  0,163,  3, 96,171,244,244, 76,189,117,235,150,107, 65, 65,  1,222,124,
-243,205,138,199, 15, 31, 46,170,247,215,146,  2,189,218,180,111,191,246,192,129,  3, 78,237,218,181, 67, 88, 88, 88, 41,183,160,
- 32, 36, 19,144, 54,211, 63,155,189, 55,107,178, 78,250,204, 30, 21,218,229,221,119,223,133,193, 96, 64, 98, 98, 34,110,222,188,
-137,199,143, 31,227,218,181,107, 53, 34,129,224,245, 70,185, 14,155,236,159,131,253, 21,190,251,246,237, 37, 88, 44, 22,118,237,
-218,133,228,228,100,  0, 64, 68, 68,  4,222,122,235, 45, 24, 12,  6, 76,154, 52,153, 62,153,201,203,109,169,127,  2,  8,  5,176,
- 30, 79, 69, 94, 23,154,166,185,  4, 65, 20,  3,240, 66,235,124,178,172,253,211,202,105,229,252,255,195,249, 82,194,108,174,195,
- 85,155, 97,251,108,154,143, 25,197,135,183,174,160,122,246,234, 29,184, 98,249, 50,178,107,215,174,240,242,242, 66, 68, 68,  4,
- 10, 10, 10, 56,118,118,118,230,242,169,213,246, 30, 52,241, 81,120,120,184,221,162, 69,139,108,  7, 12, 24,192,244,242,242,  2,
- 77,211, 72, 78, 78, 70,108,108,172,110,199,142, 29, 50,165,203,176,154,164,132, 95,107, 45,201,167,118, 19, 80,  2, 88,233, 89,
- 92,188,237,189,217,179,151,117,234,220,121,218,242,229,203, 73, 33,159,199, 92,179,100, 58, 23,  0, 86,253,112,208,118,196,216,
- 55,176,209,237,243,221,133,  0,  0, 32,  0, 73, 68, 65, 84, 15,232, 51,177,233, 60,114,141,203, 89, 80, 52,227,241,144, 81, 81,
-126, 31,206,121,219, 56,126,252,120,129, 72, 36,130,151,151, 23,236,237,237,145,155,155,139,162,162, 34,250,247,223,127,175,253,
-215,221, 44,230,177,115,183, 31,115,109,221, 44,201, 75, 40,239, 61,112, 92,222,144, 33, 67,236,167, 76,153, 98, 19, 25, 25,201,
-228,112, 56,224,112, 56, 40, 43, 43, 67, 78, 78,142,238,247,223,127,175, 85,138,  7, 87, 39, 37, 28,144, 91,152,235, 80,213,123,
-194,138,156, 43,231,151,207, 79,125,240, 96,178,  9,232,168,211,233, 60,140, 70, 35, 65,146,100,137,201,100,122,160,147,203,119,
-106, 34,150,111,176,230, 58,180, 12, 70,163,145,101, 52, 26, 81, 83, 83,131,243,231,207, 83, 15, 31, 62,252,236,222,189,123,159,
- 21, 23, 23, 67,175,215, 99,204,152, 49,136,136,136, 64, 66, 66,  2,202,203,202,126,111,137, 43, 19,144,114,138,138,222,154, 49,
- 99,198,233,189,123,247,146,247,238,221,115,218,181,107,215,207, 77,  9,152,201,147, 39,155,202, 10, 10,222,210,  0,210, 22,250,
-103, 75,247,102,197,153,  3,223,223, 27, 57,122,108,240,242,165,159, 49,123,244,232,  1, 39, 39, 39,244,234,213, 11, 58,157,206,
- 46, 40, 40,200,220,189, 41,239, 61,232,245,220,142, 29, 59, 10, 54,108,216,224,250,246,219,111, 99,206,156, 57,  0,  0,149, 74,
-133,115,231,206, 97,254,252,249,165,  5, 84, 55,133,185,254, 89,103,169,170, 23, 96,151,  1,244,  6,144, 11,171,227,187, 21, 86,
- 88,241,114,162, 62,169,180, 27,158, 38,150, 62,137,167,147,115,243,185, 14,175,220, 76, 65,227, 52, 31, 79,225,150,102,240,158,
-242,112,214,194,181, 97, 12,189,204,158, 73,168, 69,217, 89, 89,132,185,156,135, 13,249,212,108,253,107, 29, 31,253,214,117,205,
-170, 85,115, 55,110,220, 24, 85, 31,194,129,207,231, 63, 80, 41, 20, 23,156, 53,154, 77, 74, 91,255, 11,173,205,205, 87,  4,148,
-  1,152,109,159,148,244, 93,204,136, 49,235,184, 14,190,204, 79, 87,239, 80, 51, 72, 82,155, 83, 92,142,141,126,128,192,130, 13,
-146, 74, 45,144, 90,227,102, 40,115, 28,155,249,249, 71, 31,125,184,106,229,202,174, 66,161,176,143,206, 96,240, 55,153, 76,128,
-201,148,173, 84, 40, 46,211, 58,221, 45, 77,196,210,111,184,182,110,180,197,121,  9,237,130,228, 14,121,135,187,238,222,185,243,
-131, 67,135, 14,253,161,238,142, 26,205,119, 74,187,160,120, 75,234,222,248, 24, 53,112, 29, 18,201,245,150, 76,151,214, 92,135,
- 22,206, 62, 76,166,153,246,246,246,123,162,162,162,184,209,209,209, 24, 58,116, 40,122,244,232,  1,147,201,  4,154,166, 33,151,
-203,113,240,224, 65,172, 91,183, 46,219,  7, 88,105,142, 79,  3, 92,224,156, 58, 53,184, 99,199,142,187, 90, 18, 48,117, 34,203,
-172, 79, 98,203,247, 38, 39,219, 96, 59, 60,127,194,123,107,252,180,178, 18, 59, 71,190,193, 53, 53,229,  1,105,249,189,217, 65,
-110, 76, 62,216,109,204,168, 81,239, 49, 40,170, 87,221, 14, 72, 58, 61, 45, 45,169, 62,169, 52, 34,222, 58,223,202,190, 84, 31,
-187,206,234,248,110,133, 21, 86,188,236, 66,107, 40,158,250,107, 53,164,228,105, 54,215, 97,189,213,135,162, 40, 73,238,177, 89,
-111,180,196,206,  4,162,234, 44, 89, 48,155,235,176,238,125, 62, 32,135, 70,243,197, 51,193, 72, 27,237, 46,100, 62,119,124,107,
-194, 34, 86,  3,153, 48,104, 98, 32, 73,  3, 78,204,126,202,215,117,213, 39,141,235,212,236, 67,246,153,243,178,170,212,192, 21,
-212,214, 94, 65,109,109,147, 78,187, 76,138, 85,101,174,156,207,215,189,  0,144,253,217,186, 63,207,105, 86, 60,252,137,246,252,
-255,134, 39, 21, 21,199,  0,  8, 61,227,226, 92,206,196,197,141,255,112,193,130, 49,110,238,238,237,157,156,156,236,109,108,108,
-200, 27, 55,110, 60, 50,168,213,223,117,  2,118,215, 89, 83,205, 66,  3, 92,232, 80, 80, 16, 50,110,212,168,247,  8,138,234,217,
- 88,192,208,  6,195, 53, 95,224,199,150, 44, 89, 47,122,111,122,113,220,162,234, 44, 89, 96,  0, 51, 44,233, 27, 69, 79,203,177,
- 26,  6,195,106,220,191,223, 68,159,111,117, 95, 90, 69, 16,132, 28, 86,199,119, 43,172,176,226,229, 69,125,190,195,147,255,233,
- 19, 71, 91, 57,173,156, 47, 17, 39,  3, 79,119,209, 89,219,211,202,105,229,180,114, 90, 57,173,176,  8,148,181,  9,172,176,194,
- 98, 24,241,239,101, 48, 43,172,176,194, 10, 43,172,168, 71,189,111, 86, 99,108,  3,158,186,238, 52,167, 74, 91,179,155,224, 69,
-148,109,188,149,211,202,105,229,180,114, 90, 57,255, 43,156,124,252,113,217,219,218,158, 86,206,255, 20,167, 57,238,127,226,110,
-198,122,159,172,  6,223,172,255, 20,172,102, 85, 43,167,149,211,202,105,229,180,114, 90, 57,173,156, 47, 59,220,234, 68, 86,227,
- 23,128, 86,  6, 44,181,194, 10, 43,172,120, 89,177,124, 57, 72,154,  6, 65,211,203, 73,154, 62,196,160,233,177, 12,154,198,159,
- 74,  5, 50,118,108,211,193,108,223,127,195,222,198,218,226, 86, 88,241, 82,161,  4,205, 36,149,182,250,104,253,119,225,237,234,
-234,186, 21,  0, 81, 90, 90, 58, 19, 64,129,181, 73,254,247,224,224,224, 16,101, 48, 24, 32,147,201, 46,188,140,245, 11,110,143,
- 81, 52,137,160,134, 15,104, 20,164,231, 96, 79, 83,199,  6,249,225, 77, 16,255,142,197, 69,152,144,158,246, 16, 71, 91,113, 58,
-114,112,180,215,143,  0,112, 58,190,240, 61,252, 61,113,181,  2,156,157,157,207, 82, 20, 69, 25,141,198,217, 18,137, 36,174,121,
- 33, 52,150,  1,  0, 76, 58, 97,113, 77,169,120,209,188,119,  8,166, 82,179,179, 70,163, 82, 72, 25, 76, 70, 30,135,233,122,117,
-214,219,228,233,234,218, 87,210,154,250,253,225,195,135,155,205,226, 29,226,135,193,164, 49,120, 88, 68,232,163,220,245,155,186,
-110,236,227,235,196,124, 84,120, 87,248,213, 22,233, 86,182, 93,155, 97,111,142, 39,226, 40, 62, 49,121,231,206,202,218,151,245,
-222, 89,  3,144,122, 38,179,  3, 97, 50,249,130, 32,248,  4,  0,218,100, 50, 17, 36,249,136,107, 48,100, 45,  4,106, 95,128,211,
- 65,  7,132, 49, 57, 28, 47,163,193,224, 66,  0, 52,131,162,202,244, 26, 77, 33, 11,184,191, 24,168,121,217, 57, 89, 28,142,167,
-209, 96,112,  1,128,255,197,114, 90,241, 44,154, 21, 90, 66,161,240, 14, 73,146,158,141,147,225,214,231, 19,172,255,172,241,119,
-  4, 65,192,104, 52, 22, 85, 87, 87, 71,182,226,252, 34,  0,227,  1,212,111, 81,223, 15,224, 32, 94,220,225, 88,196, 98,177, 22,
- 10,  4,130,126, 42,149, 42,  4,  0,120, 60, 94,170, 66,161,184,168,211,233,214,191, 32, 47,  5, 96,156, 80, 40,236, 75,146,100,
- 95,154,166,  9,154,166, 19,106,107,107, 47,  2, 56,  4,224, 69, 34, 37,240,196, 98,241,106,  7,  7,135,137,139, 23, 47,174,116,
-116,116,236, 48,127,254,252,219, 85, 85, 85,191, 86, 84, 84, 44, 65, 43,114,212,253,205,104,239,234,234,186,159,201,100, 50, 10,
- 11, 11,251,  2,128,151,151, 87,130, 86,171, 53, 74, 36,146, 55,  0, 60,108, 37,159,  0, 64,119,161, 80, 24, 41, 20, 10,123, 27,
-141,198,160,186,252,140,233,181,181,181,137, 58,157,238, 14,128, 27,  0, 20,255, 67,247,136, 13, 69, 81,123,235,250,186, 63,  0,
-249,203, 54,  8,208, 36,130,210, 82, 51, 58, 52,  8,175,144,192,230, 15, 38,224,221,196,177, 22, 11,173,126,125,220,134, 13, 31,
-222,159,  4,  0,173,254,244,176,139,151, 75,142,255,197,213,  9, 24, 61,122,244,245,189,123,247,218,107, 52, 26,204,156, 57,115,
-127,124,124,252,143, 50,153,108,113,139,  3,135,208,126,254,215, 27,206,241,  9,130,  4,  0,177,201,100, 20, 63,121,242,208, 63,
- 45,229,250,160,212,212,127,173, 81,101, 92,188, 97, 34,152,179,116,232,149, 97, 73, 33,130,124, 17, 51,108,204,168,161, 43, 87,
- 46,199,196,215, 39,182, 77, 77, 85,243, 60, 68,185,236, 42,149,192,207,209, 89, 60,124,229,170,195,196,213, 43,199,134,239,221,
-181,226,226,219,111, 59,246,123,  9,197, 22,177,140,205,246,214, 27,141,131, 72,160,132,178,177,201,  5,139,165,  4,  0,210,104,
-100,104,101,178,246, 74,138,154,244,  5,112,235,115,131,225,174,165,156,171, 40,170,187,173,159, 95,239,215,143, 29,131,208,203,
-139,162, 56, 28, 18,  0, 12, 26,141, 87,109, 97,161,219,129,225,195,187, 45,207,202,186,180, 28,184,105,229,252,175,112, 90,209,
- 26,161, 69,146,164,231,147, 39, 79,196,  2,129,224,233, 96, 76,211, 48, 26,141, 48, 26,141, 13,201,139,105,154,110,248,107, 48,
- 24, 16, 24, 24,104,209,140, 22, 64, 63,  0, 83, 95,123,237,181,177,235,215,175,103,134,133,133,213,167, 12,233,245,233,167,159,
-254,144,156,156,124,  4,192,110, 60, 13,222,104,233,140,119,160, 64, 32,216,247,245,215, 95,139,250,247,239, 79,185,187,187,131,
- 32,  8,148,150,150,118,143,143,143,143,156, 63,127,254,108,133, 66, 49,  9,192,217, 86,180, 79,168,141,141,205,225, 81,163, 70,
-121,246,233,211,135, 27, 28, 28, 12,163,209,136,187,119,239,190,125,231,206,157,  9, 71,142, 28, 89, 38,151,203,199,194,242,124,
-109,132, 80, 40,156, 34, 18,137, 86, 47, 93,186,212, 97,210,164, 73,236,148,148,148,106, 95, 95, 95,226,234,213,171,206,  7, 15,
- 30,156,189,118,237,218,113, 50,153,108, 73,109,109,237, 47,176, 32,135,162,141,141,205, 29,146, 36, 61, 45, 17,194,  0, 90, 35,
-134, 59,249,248,248, 28,188,114,229,138, 79,126,126,190,113,228,200,145,123,  0,224,226,197,139, 97,122,189,158, 24, 48, 96,192,
-233,162,162,162,241,  0, 44, 29, 36,195, 29, 28, 28,142, 79,156, 56,209,161,125,251,246,124, 31, 31, 31, 66, 32, 16,128,193, 96,
- 64, 42,149,186,167,164,164, 68,223,188,121, 83, 21, 31, 31, 95,165,209,104,134,  3,184,223,138,235,212, 67, 44, 22, 79,102, 50,
-153,161,  6,131,193,  3,  0, 40,138,122,162,215,235, 83, 36, 18,201, 94,  0,215, 95,244,  6,113,113,113,249,126,245,234,213, 78,
- 18,137,132, 94,187,118,237,247,114,185,124,202,203, 58, 24,236,255,245, 16,238,220,190,  9, 60, 77,155, 67, 52,209,255,  8,  0,
-172,121,243, 22, 32,178, 75, 55,188, 49,113,156, 89,206, 33, 81,158, 95, 51,217, 44, 71,181, 90,125, 93,170,212, 28, 18,240,185,
-227, 39, 78,136,201,  6,128,211,103, 46,141,239,218,213, 62,193,150,207, 25,199,229,114,123,232,181,186,202, 83, 23,138, 62,106,
-141,168,242,240,240, 56,107,111,111,207,175,170,170, 42, 45, 47, 47,223, 60,108,216,176, 85,187,119,239,182,127,244,232, 17, 10,
- 11, 11, 49,119,238, 92, 97, 81, 81,209,123,247,239,223,255,151, 86,171,109,214,178, 37,151, 87,109,250,116,209,136,165,182,182,
- 78, 12,  1, 95,  4, 27, 91,  7,248,182,239,136,238, 61,134, 97,240,208,105,200,201, 78,238,190,123,215,202,228, 39, 79,226,191,
- 20, 58,180, 91, 85, 83,227,211,236,184, 20, 28,128, 62,195, 71, 61, 21, 89, 75,151, 46, 71, 86, 70,134, 60, 63,143,124,255,228,
- 49,138, 63, 56, 42,144, 99,208,150,230, 95,189,114,204,167,103,175,145,  0, 16,185,119,215,138,139,239,191, 97, 31,245,253,254,
-234,151, 69,196, 19, 43,153,204, 80, 24, 12,  1,142,110,110,  7,212, 38, 19,173,151, 74,189, 76, 74,165, 27,  0, 24,152, 76,173,
- 64, 40,124,224,238,231,151,152,149,148,212,251, 11,138,234,245,121,203,  9,202,235, 57,167, 12,220,176, 65, 28, 49,123, 54,171,
- 54, 47, 79,151,187,101,139,178, 44, 49,209, 72,113, 56,180,215,160, 65,132,115,223,190,220,217,233,233,172,107,107,215,246,102,
-174, 88,225,187, 68,167,219,103,229,252,143,114,254,127, 71,189, 19,124,227,221,135,219, 90, 20, 90,  4, 65, 64, 32, 16,224,192,
-129,  3, 96, 50,153,160, 40, 10, 76, 38,179,217,247,222,222,222,150, 20,100,180,171,171,235, 15, 63,254,248,163,203,192,129,  3,
-193,229,114, 27,190, 96, 48, 24,232,223,191, 63,162,163,163,153,197,197,197, 19, 14, 28, 56, 48, 97,205,154, 53,101, 53, 53, 53,
-115, 80,151, 24,186,  5,244,237,208,161, 67,236,185,115,231,120,106,181, 26,137,137,137,168,174,174,  6,155,205,134,167,167, 39,
-  6, 12, 24, 64,101,100,100, 56,244,239,223, 63, 54, 43, 43, 43,  6, 64,130,  5,101,141, 20,139,197,151, 15, 29, 58,196,237,216,
-177, 35,145,147,147,131,136,136,  8,  0,128, 84, 42,197,200,145, 35,185,147, 38, 77,106, 63, 97,194,132, 27, 18,137,164, 15,128,
- 59,102,248, 58,187,186,186,254, 50,106,212, 40,247, 53,107,214,136,108,108,108,144,159,159, 95,226,234,234,234, 95,223,222, 19,
- 38, 76, 96, 15, 27, 54,204,109,221,186,117,155, 14, 31, 62,252,145, 68, 34,153,  2, 32,169, 69,213, 90, 39,136,249,124, 62,202,
-202,202,176,127,255,126,188,247,222,123, 96, 48, 24,144, 72, 36, 56,120,240, 32,222,127,255,253,122, 65, 99,145, 24,230,243,249,
-209,126,126,126, 63, 95,188,120,209,211,206,206, 14,238,238,238,228,231,159,127, 30,234,235,235,203,107,219,182, 45,163,164,164,
-  4,177,177,177,190,147, 39, 79, 62, 94, 80, 80,240,182, 70,163, 49,187,164,230,226,226,178,243,228,201,147,222,169,169,169,216,
-178,101, 11,170,170,170,192,102,179, 97,103,103,  7, 87, 87, 87,248,251,251, 19,139, 22, 45,226, 15, 27, 54,140, 63,103,206,156,
-157, 90,173,182,147,  5,215,168,163, 88, 44,222,218,183,111, 95,223, 21, 43, 86,216,185,186,186,162,126, 98, 32,149, 74, 61,243,
-243,243,187, 47, 93,186,116,236,157, 59,119, 30, 73, 36,146, 89,  0,238,181,242,198,233, 20, 28, 28, 28, 51,114,228, 72, 70, 73,
- 73,  9,246,238,221, 27, 35,151,203, 59,181, 66, 92,254,163,112,231,246, 77,204,124,119,110,173,187,151, 23,235,220,217,159, 71,
- 31, 62, 26,112,219,142,247, 52, 33,117,141, 10,186,177,163,178,186, 12, 24, 56,141, 53,100,232,200,218,109, 63,109, 18, 90, 34,
-180,152,108,150,227,254,125,223, 22, 92,185,122, 39,244,124,252,205, 65,163,135, 15,167, 89, 44, 59, 95,  0,248,104,254, 60,102,
-236,137, 19,187,250, 71,119, 43,238,213, 51,178,224,141, 73, 11,188, 91, 81,220,128,128,128,128, 75,201,201,201, 46, 28, 14,  7,
- 85, 85, 85,142,219,182,109,251,182,103,207,158,100,110,110, 46, 50, 50, 50,144,151,151,  7,169, 84,138,254,253,251, 11,147,146,
-146, 54,  3,104, 86,104,233,200,126,171,221,219,234,191,115,228,  9,124,116, 70,153,152,214,151,  4,159, 63,121, 62,252,183,189,
-170,  8, 23,183, 64,255,169,111, 45,195,202, 85, 71,152,191,238,255,106,233,133,248,223,  0,210,167,249,140,  0, 52,122,124,186,
-100, 49,100,114, 13, 38, 77,156,129,201, 19,103, 56,210,208,186,209, 70,181, 64,171,170,182,179, 97,165,199,253,184,227,219, 81,
-  0, 60, 27,137,173, 11, 47,139,216, 90,201, 98,249,192,100,242,245, 31, 57,242, 88,238,153, 51,237,104,157,206,137,193,102, 23,
-217, 56, 56,148, 25, 52, 26, 90,175,211,177, 84, 42,149, 71,110,106,170, 91,207, 69,139, 46, 92, 93,187,182,207, 23, 12, 70,151,
-207,141,198,219,205,114, 82, 84,183,152, 31,126,112, 14,157, 62,157,115,111,197, 10, 69, 69, 98,162,202,111,200,144,234,136,119,
-222,209,  0,128, 60, 47,143,149,181,108, 25,223,185,119,111,222, 43, 11, 23,218, 27,181, 90,215,149, 43, 87,118, 93,250, 52,121,
-121,171, 56,189,199,143, 55, 46,221,181,171, 75,226,130,  5,175, 17,122, 61, 99,208, 43,175,220, 93,187,119,239,147, 63,195,249,
- 87,150,179,248,242,101, 77,149,175, 47, 34, 70,142,172,244, 22,139, 53,127,101,221,255, 76, 57,173,104, 64,189,175,214,204,198,
- 51, 84,196,197,197,245,  1,112,  9,192,138,152,152,152,229,  0, 96,107,107, 91, 86, 83, 83, 35,142,141,141, 53, 43,178,152, 76,
- 38,220,220,220,224,239,239, 47,145, 72, 36, 46, 45, 20,160,208,100, 50,121,210, 52,221, 96,125,105, 14, 26,141,  6,217,217,217,
-  8, 15, 15, 47,194,211, 68,180,205, 26,117,248,124,126,110, 70, 70,134, 83, 90, 90, 26,238,220,185,  3, 95, 95, 95,216,219,219,
-131,201,100, 66,175,215, 67, 38,147,161, 67,135, 14,224,112, 56,232,220,185,115,133, 66,161,240, 53,179,  4,196, 17,  8,  4,217,
-151, 47, 95,246,138,136,136,192,173, 91,183,224,229,229,  5, 87, 87, 87,  0, 64, 94, 94, 30,174, 94,189,138, 33, 67,134, 32, 57,
- 57, 25, 99,198,140, 41, 84, 40, 20,254,  0, 52,205, 17, 58, 56, 56,148, 92,188,120,177, 40, 44, 44, 76,173, 80, 40,200,178,178,
- 50,102, 98, 98,162, 65, 46,151, 11,165, 82, 41,179,166,166,134, 41,147,201, 40,133, 66,193, 36, 73,146,165, 82,169,152, 23, 46,
- 92, 96,232,116,186, 22,  3,100,214, 95,167, 19, 39, 78, 32, 44, 44, 12,177,177,177,248,240,195, 15,113,237,218, 53,120,121,121,
-225,208,161, 67, 88,184,112, 33, 50, 51, 51,225,228,228,132,224,224, 96,115,215,  8,237,219,183,207,121,240,224, 65,123, 22,139,
- 85,159,215,177, 62, 95, 30,202,203,203,241,240,225, 67, 60,121,242,  4,126,126,126,152, 56,113,226,195, 39, 79,158,248,153,235,
-121, 30, 30, 30,229,169,169,169, 78,225,225,225, 40, 43, 43,131,157,157, 29,108,109,109, 97,103,103,215,240,222,215,215, 23, 11,
- 22, 44,128,171,171,171, 68,173, 86,187,152, 19, 65, 97, 97, 97,103, 47, 92,184,224, 36, 18,137, 80, 90, 90, 10,153, 76,  6,138,
-162,192,231,243,225,228,228,212, 32,228,179,179,179, 49,116,232,208,138,220,220,220,129,173, 16, 73,164,139,139, 75,198,253,251,
-247,253,105,154, 70, 65, 65,  1, 50, 51, 51,241,238,187,239,102,171,213,234, 64,188, 68, 57,251, 26,249, 93,177,166,188, 53,147,
- 53,106, 68, 15,109,122,106, 28,193, 49,101,162, 83,168, 72, 10,  0,119, 83,100,182, 26,178,  3,130, 66, 98,232,163,199,175,179,
-127,217,189,141,  9, 19, 92, 64, 32, 51, 61, 27, 95, 52,199, 61,160,175,219,244,121,243,222, 14,125,173,103, 31, 82,174, 80,136,
- 55,111,222,208, 57, 55, 55, 93, 12,  0,190,190, 65,146,217,179,231, 39,217,  8,  4,146, 75, 87, 47,155, 54,110,220,153,114, 46,
-161,100,135,  5, 69,246,245,247,247,255,215,137, 19, 39,156,196, 98, 49,108,109,109,161, 80, 40,160,211,233,144,150,150,166, 62,
-112,224,128, 94, 36, 18,217,148,150,150,162,166,166,  6,  4, 65,224,196,137, 19,  5,  0,218, 60, 79, 84,239,163,  5,  0,239, 14,
- 14, 98,  6,247,243,183,103,113, 12, 60, 30, 51,203, 13,132,145, 67,208, 66,151,211,103,239,134,159, 62,127,235,141, 81,163, 63,
-116,238,213,103, 20,150,126, 54, 86, 95, 92, 92, 16,161, 67,175,140,166,124,180,  2,253,208,111,228,152, 81,227, 86,174, 92,142,
-229, 75, 87, 32,238,196, 49,169, 80, 64,106, 68,118, 76,219,222,221, 95, 85, 47,120,111, 68, 97,109,109,177,215,202,117,  7, 38,
- 14, 29,177,192,179,103,175,145,184,122,229, 24,246,238, 90,113,135,224,209,255,232,101,196,101,  0,139,164,168,105,238, 62, 62,
-251, 36,197,197, 30,124,161,144, 57, 55, 62, 94,108, 52, 26,111,143, 91,184, 80,126,244,194,133,  6, 43,233,231, 36,233,206, 96,
- 48,220,253,135, 14,189,159, 19, 23, 55,141, 99, 48,196,126,  2,148, 63,207,185, 28,176,183,243,245,157,245, 65,118, 54,235,222,
-242,229,181,134,226,226,234,200,249,243, 43,154, 58,127,209,249,243,  2,182,187,187,200,126,248,112,135, 77,109,218,208,122,137,
-100,107, 83, 62, 70, 77,113,198, 11,133,118,191,157, 62, 29, 69, 51,153,125, 62,254,228, 19, 94, 76, 76, 12,100, 50, 25,142, 28,
- 57,130,173, 91,182,104,220,220,220, 30,184,167,164, 36,135,202,100,159, 89,202, 25, 57,127,126,133,209,104, 36,198, 45, 92,216,
- 63, 53, 47,175, 95,169, 68,210, 22,  0,220, 28, 28, 10, 35,125,125,239,236,140,139,203,252,222,199,199,100,105, 57,183,159, 57,
-227,114, 56, 63,127,186,131,131,  3,175, 76, 34,161, 56,108,118,101,247,224,224, 67, 63, 45, 89,114,201,112,255, 62,139,235,233,
- 41,178,141,137,105,117,221, 35,231,207,175,168,146,203,169, 15, 86,173,122,245,113, 89, 89,219, 90,141,198,175, 70, 46,119, 53,
-234,245,164,136,207,175,108,215,161,131, 68,149,152, 88,210, 78,169,156,187,  3,144,252, 93,253,167, 41, 45,242, 15,194,243,113,
-180,254,144,235,240, 82, 76, 76,204, 31,118,215,208, 52,109,145, 53,139,201,100, 62,179, 76,213,  2, 88,  4, 65, 32, 41, 41,  9,
-142,142,142,112,117,117,  5,135,243,108,242,193,242,242,114, 92,187,118, 13,233,233,233,232,216,177, 99,253, 50, 70,243,138,136,
-195,153,183,110,221, 58, 59,173, 86,139, 59,119,238, 32, 50, 50, 18, 28, 14,  7, 44, 22,235, 25, 17, 40,145, 72, 16, 18, 18,130,
-143, 63,254,216,118,205,154, 53,243, 52, 26, 77,179, 51, 82,138,162,230,204,152, 49, 67, 92,111,193, 42, 44, 44, 68,231,206,157,
- 27,190,119,118,118,198,221,187,119, 17, 25, 25,  9, 79, 79, 79,140, 29, 59, 86,188,119,239,222, 57,  6,131, 97,125,115,156,108,
- 54,155, 12, 11, 11,235,  2,  0,  2,129,  0, 36, 73,102,137, 68, 34,103, 23, 23, 23,129, 72, 36,250, 67, 29,119,237,218, 85, 67,
-146,164,222,172, 26, 32, 73,148,150,150, 34, 52, 52, 20, 82,233,211, 12, 46, 10,133,  2,126,126,126,144,201,100, 13,162,213,221,
-221, 29, 42, 85,203,174, 95,225,225,225,203,  3,  3,  3,  7,  8,  4,  2, 14,147,201,196,189,123,247, 16, 17, 17,129,  3,  7, 14,
-192,219,219, 27,124, 62, 31,217,217,217,  8, 11, 11,195,229,203,151,225,236,236,140,144,144, 16,142, 88, 44,190, 82, 85, 85,149,
-240,248,241,227,229, 45,148,147, 20, 10,133,184,124,249, 50,118,238,220,137,188,188, 60, 20, 23, 23,195,198,198,  6,157, 58,117,
- 66,112,112, 48,122,244,232,129,236,236,108, 16,230, 59,147,171,191,191,127,220,173, 91,183,156,104,154,198,222,189,123, 81, 91,
- 91, 11,173, 86, 11,146, 36,193,229,114, 97,111,111,143,126,253,250,193,217,217, 25,254,254,254, 56,120,240,160,211,224,193,131,
- 79, 73, 36,146, 78,  0, 74,205,181,171,189,189,253,220,101,203,150,121,137,197, 98,228,231,231, 67, 42,149,194,197,197,  5,175,
-189,246,154, 71,124,124,252, 92,189, 94,191,225,101, 17, 90,141, 28,223,137,115,103,127, 30,237,223,174, 58,172, 99,  7,190, 87,
-108,156,139,215,129, 56, 73,  8,  0,132,  6,185,164,142,142,225, 23,222, 75,141, 43, 60,119,246,216,157,244, 44,196,194,130,165,
-109,169, 82,115,232,124,252,205, 65, 17, 29, 59,155,214,125,181,112,232,123,239, 78,231,136, 93,166,161,172,224, 24,226, 47, 38,
-121, 47,252,112,134,243,250,111,182,159, 62, 31,127,147,148, 42, 53,159, 89,102,202,242,254,126,247, 79, 61,156,228, 21,135,145,
-147,193,  6,207, 38, 20,190,190,  1,144,201,100,224,114,185,220,137, 19, 39, 26, 23, 47, 94,172, 20,137, 68,124,130, 32,144,144,
-144, 32,  1, 48,208, 28,175, 90,108, 79, 27,117,122,  3,205,102,152,104,194, 70, 69, 24,171,216, 41,105,143, 48, 32,186,111, 89,
-207,110,161,107, 22,175,252,230, 83,255,128,  8,231,183,167,175, 96,174, 90,254,198, 22, 16,232,213, 20, 79, 70, 14, 46, 18,135,
-142,242,  0, 12, 93,249,197,114,228,230,102,219,207,156, 90,179,130,226,240,220,  3,219,188,106,179,101,103,194, 32, 63, 63,159,
-182, 11,230,140, 61,249,237, 15,223, 14,109,108,217,218,189,107,217,113,  0, 81,150,180,237,255, 34, 72,138,234, 64, 18, 68,161,
- 76,169,100,208, 58,157,211,220,248,120,213,185, 27, 55, 46,220,159, 57,211, 38,156,197, 10,  8,103,177,192,208,233, 42,151,  0,
- 21, 95,152, 76,197,203, 40, 74,244,232,248,113,119,138,205, 78, 86,155, 76, 97, 48,153,154,138,159, 20, 62, 57, 46, 14,181,  5,
-  5,250,170, 43, 87,212, 81, 63,252, 80,225, 53,112,224,  6,173, 78,231, 84, 63, 84,144,  4,  1,162,222,117,194,100, 34,168,143,
- 63, 38,105,138,130,222,222,126, 42,170,171,  3,204,113,126, 88, 82, 50,250,141,233,211,135, 30, 63,115,  6, 62, 62, 62, 13,207,
- 51, 59, 59, 59, 44, 92,184, 16,243,231,207,231,220,189,123,183,235,225,195,135,187,174,255,250,107, 23,  0,163, 45, 41,231,185,
- 27, 55,236,223, 89,185,114, 73,199,200, 72,239, 61,251,247,115,218,183,111, 15,  0,120,248,240,161,255, 87,107,215,182,  9, 13,
- 11, 43, 91, 51,111,222,238,212,197,139, 67,  0, 92,105,137,179, 52, 49, 81,123, 56, 63,127,250,197,132,  4,187,208,208, 80,  0,
- 64,102,102,166,120,211,166, 77, 51, 66,198,142,157,180,114,246,236,207, 98,212,234, 26, 81,121, 57, 39,230,251,239,169,223,198,
-141, 51,203, 89, 95, 78,  0,120,237,237,183,231,245,234,219, 55,120,244,244,233, 14,222,222,222,132, 80, 40,132, 78,167, 67,113,
-113,177,125,106,106,106,251, 56,185, 92,118,244,198,141,189, 48, 26,251,255,141, 93,168, 73, 45,242, 15,179,100,253,241,190,168,
-251,251, 90, 92, 92, 28, 93,167, 38, 27, 30,224, 70,163,209, 34,145, 69, 81, 20,  8,130,176, 84,108,129,166,105, 84, 84, 84, 32,
- 37, 37,  5, 15, 31, 62,132, 66,161,192,163, 71,143,176,109,219, 54,124,245,213, 87,184,125,251, 54,244,122, 61,116, 58,243, 57,
-104,  5,  2, 65,116,116,116, 52,117,227,198, 13,248,250,250,130,199,227,129,205,102,131,197, 98, 53,188,184, 92, 46,220,220,220,
- 32,147,201, 16, 21, 21,197, 20,  8,  4,209,102,172, 68, 67,198,143, 31,207,174,255,191,182,182, 22, 12,  6,163, 65,180,212,214,
-214,162,170,170, 10, 53, 53, 53, 40, 41, 41,193, 43,175,188,194,182,181,181, 29, 98,233,213, 80, 42,149,181, 18,137,196,174, 87,
-175, 94,246,233,233,233,127,200,246,123,233,210, 37,181, 90,173,102,146, 36,105,145,163,253,190,125,251, 16, 27, 27,139, 11, 23,
- 46,160,168,168,  8, 91,182,108,193,158, 61,123,112,226,196,  9,100,103,103,227,187,239,190,195,230,205,155,177,123,247,238, 22,
-175, 81, 96, 96,224,224,189,123,247,118,235,222,189, 59,159,193, 96, 32, 51, 51, 19, 11, 22, 44, 64, 77, 77, 13,156,157,157,  1,
-  0,101,101,101,216,176, 97,  3, 52, 26, 13,132, 66, 33, 60, 60, 60,184, 43, 87,174,236,233,236,236, 60,160,165, 50, 26,141, 70,
- 35,131,193, 64,155, 54,109,176,116,233, 82,108,222,188, 25,103,207,158,197,161, 67,135, 48,123,246,108,  4,  7,  7, 35, 57, 57,
- 25,183,111,223,  6, 77,211, 45, 62,100,184, 92,238,216, 61,123,246,136,217,108, 54, 76, 38, 19,228,114, 57, 10, 10, 10,112,243,
-230, 77,245,177, 99,199,106, 79,158, 60,169,188,114,229,138,250,250,245,235, 52,128,  6,193, 25, 19, 19,227,200,102,179, 95,183,
-160, 73,157, 93, 93, 93, 63,157, 49, 99,  6,183,113,159, 45, 45, 45,197,232,209,163,249, 60, 30,111, 49,  0,231,151,208,228, 77,
- 31, 62, 26,112,155, 99,202, 68,108,220, 19,175,199, 69,198, 87, 23,126,244,141,195,194,143,190,113,120, 92,100,124, 53, 54,238,
-137, 23,199,148,137,195, 71,  3,110, 91, 32,  4,200,126,125,220, 70,184, 56,218,109, 29, 61,124, 56,189,121,243,134,206,239,189,
- 59,157,211, 38, 96, 33,184,182, 19,225,225,251, 14,162,122,123, 19,225,193, 36,119,243,230, 13,157, 71, 15, 31, 78,187, 56,218,
-109,237,215,199,109,  4,204,132,157, 17, 59,114, 61,248, 28,  5,218,251,  7,227,181, 62, 29,193, 36,114,112,228,208, 78,148,148,
-148,160,184,184, 24,101,101,101,130, 97,195,134,161,180,180, 84,157,144,144, 32, 81,169, 84,125,  0,100,153,171,124, 81, 81,154,
- 73, 93,107,212,153,140, 76,131, 92,202, 82,206,158,123, 56,250,118, 42,235,173,210, 26,143, 97,108,142, 61,123,112,255,174,251,
-119,238, 88,138,118,237, 66,209,165,235,128, 87,236,133,255, 10,110, 86,188,230, 34,238,247, 35, 71,143, 79, 28, 63,209,144,247,
- 40,255, 81,128, 11, 87, 75,211,180,126,238,162,237,253,153,  2,175,240,246, 65,189,157,211,115,140,110, 75, 63,126,253,215,147,
-199,191, 45,186,122,229, 24,122,246, 26,  9, 15,119,255, 62, 83,167,130,253, 79,237, 64,  4, 77,251, 50,133,194, 92,189, 84,218,
-134,226,112, 10,140, 70,163,211,173, 89,179,236,116, 44,150,155, 81,167, 43, 54,234,116,197, 58, 54, 91,244, 99, 80,144, 39, 77,
-211,142,118,158,158, 79,104, 54,219,219,160,211,229, 16, 36,217,174,201,217, 57,135,227, 41,108,211,134, 42, 61,119, 78,235, 59,
-108, 88, 53,  0,104,117, 58,167,188,252,124,219, 50,137,196,182,180,172,204,246,113, 97,161,109,238,163, 71,182,217, 57, 57,182,
- 25, 57, 57,162,  7, 41, 41,194,187, 15, 30,  8,  9,  6,195,197, 18,206,188,226,226,240,143, 63,254, 24, 60, 30, 15,  6,131,161,
-169, 49, 27, 10,133,  2, 83,167, 78,133, 18,232,110,  9,167,209,104, 36,222, 89,185,114,201, 39, 75,150,180,143,141,141,229,116,
-235,214, 13, 14, 14, 14,112,112,112, 64,183,110,221,112,248,200, 17,246,236, 57,115, 60, 63,221,177, 99, 42,201,225,120,153,227,
-172,240,243,131,131,131,  3,175, 94,100,  1, 64,135, 14, 29,176,101,203, 22,206,153,179,103,109,191,248,249,231,111, 86, 92,191,
- 30,166,121,252, 88,225, 24, 16, 64,179, 57, 28, 79, 75,219, 19,  0,228,106,117,232,134, 77,155, 28,157,156,156,136,178,178, 50,
-228,228,228,224,241,227,199, 48, 24, 12,232,210,165, 11,113,232,200, 17, 91, 45,131,209,245,111,238, 66,127,208, 34,255, 32,204,
- 68, 51,113,180,168,186,  7,208,101,  0, 68, 92, 92, 28, 93,191,156, 88,247,112,108, 16, 83,150,  8,173, 23, 65, 77, 77, 13,106,
-106,106,176, 99,199,142,  6, 97, 84, 15,173, 86,107,137,104,  9,115,119,119,135, 84, 42, 69, 64, 64,192, 51,150, 44, 22,139,  5,
-138,162,192, 98,177,192,225,112,160,209,104,224,237,237, 13,165, 82, 25,214, 18,167, 74,165,234,228,224,224,208,240,128,213,104,
- 52, 13, 34,171,190,188, 90,173, 22,213,213,213,168,173,173,133, 92, 46,135, 66,161,136,176,164,190, 38,147,  9, 41, 41, 41, 15,
- 59,116,232,208,137,193, 96, 64, 40, 20, 10, 20, 10, 69,131,111, 81, 85, 85, 21,126,249,229, 23,197,155,111,190,233,116,226,196,
-  9,179,  9,139,  9,130,192,251,239,191, 15, 14,135,  3,165, 82,137,205,155, 55,227,131, 15, 62,  0,139,197,130, 92, 46,199,150,
- 45, 91,176, 96,193,  2, 80, 20,  5,173, 86,139, 77,155, 54, 53,203,149,150,150,150,119,227,198,141,136,206,157, 59,219, 31, 61,
-122,180,188,127,255,254,206,  3,  7, 14,  4,143,199,131, 74,165,130, 94,175, 71,247,238,221, 17, 24, 24,  8,137, 68,130,211,167,
- 79, 87,248,251,251, 59,221,188,121,211, 84, 90, 90,250,216,140,184,166, 27, 89, 12, 97, 52, 26, 81, 86, 86,134,154,154, 26,148,
-151,151,163,184,184, 24, 69, 69, 69,160, 40, 10,102,116, 22, 28, 29, 29,199,132,134,134, 50,  0,128,199,227,161, 83,167, 78, 88,
-178,100,137, 65,165, 82,141,  7,112,186,238,176,193,219,183,111, 63,122,245,234, 85,202,221,221, 29, 25, 25, 25,112,118,118,166,
-184, 92,238,235, 90,173,182, 69,107,148,171,171,235,174,223,127,255,221,161, 94, 92,215,183,179, 82,249,244,114,140, 30, 61,218,
- 97,207,158, 61,187, 12,  6,195, 16,188,100,176,227,129,213, 41, 84, 36, 61, 16, 39,  9, 89,248,209, 55, 84, 96,232,211,201,235,
-204, 89,160,214,127,253, 97,200,164, 17,162,147,118, 60, 25,203, 28,207,224,104,175, 31,135, 15,239, 79, 78,156, 16,147,205, 98,
-217,249,110,221,182, 66, 44,118,153,214, 72,134,137,224,232, 36,130,111, 27, 54,113,248,100,186,120,209,226, 47, 52,251,246,124,
-155,251,235,111,113,131,216,204,243,  3, 78,199, 23,206,110,142, 59,235, 97,205,  9,165,134, 27, 36,171,188, 79, 56,184,188,138,
- 78, 29, 59, 64,236, 92,141,237,187, 14,192,167, 93, 23,104, 52, 26,136, 68, 34,190,209,104,212, 49, 24,140,125,150,136, 44,  0,
-184,112,161,198, 20, 18, 82,163,101,200, 77,134,247, 62, 88, 63,170,255,224,225,193,253,250, 69,155,206,157, 63,167,123, 53, 66,
- 87, 50,120, 96,167,178, 51,231,127,204, 46, 41,126,228, 31, 18,214, 19,105,169,  9,131,104, 26, 41,  4,209,180,232, 76,205,193,
- 25,181, 41, 45,225,192,129,153, 38,149, 41,153,183,106,245,131,193, 67,135, 78,  9,237,221,171,183,233,124,252, 69, 45, 27, 21,
-233,162,158, 61,158,188, 55,125,240,209,159,247,109, 26,112,230,244, 46, 63,169,236,113,220,238,221,205,187, 32,252,207, 43,117,
-130,112,182, 17,  8,202, 43,229,242,142, 99, 86,172,144,141, 91,184,240,108, 56, 69,  5, 27,117,186, 71, 43,  0, 21, 77,211,132,
-201, 96, 88,252, 96,255,126,198,114,130, 88,180,  2, 48,173,102, 48,152, 69, 38,147,210,131, 36,249,203,  0,106,197,115, 59,185,
-141,  6,131, 11,197,225,144,229,  9,  9,134,176,105,211, 52,245,247, 35,159,207,199,241,227,199,193,102,179, 27, 94, 44, 22,171,
-225,189,139,139, 11,136,186,109,164,127,152,248, 53,193,  9,  0, 37, 37, 37, 40, 45, 45,133,173,173, 45,156,157,157, 81, 90, 90,
-138,235,215,175, 35, 43, 43, 11, 76, 38, 19,131,  6, 13,  2,217,140,111,243,243,156,227, 22, 46,236, 31, 20, 22,230, 61,107,214,
- 44,242,249,231,163, 78,167, 67, 85, 85, 21, 70,140, 24, 65,158, 62,125,218,245, 76, 65,193,112,  0,251, 90,226,140, 24, 58,180,
-178,236,240,225, 38,207,221,185,115,103,226,218,181,107,156, 65,  3,  7,206,255,112,245,234, 31,191,223,179,167,208,104, 48,184,
-182,166,238, 36, 73,146,  4, 65,192,203,203, 11, 85, 85, 85,168,173,125,186,130, 45, 20, 10, 97,111,111, 15,189, 94, 15, 19, 77,
- 51,255,206,254,211,156, 22,249,135, 96, 91, 35,193,245,140,101,139,170, 91, 23,173, 31, 40, 94,107,252, 96, 49,153, 76, 22,137,
- 44, 38,147,105,214,231,202, 18, 43,215,243,176, 68,104,213,151,149,203,229, 62, 99,201,170, 23, 88,245,229, 36, 73, 18, 12,  6,
-195,236, 67,188, 78, 12, 49,228,114, 57,142, 28, 57,130, 62,125,250, 52, 44, 75, 73,165, 82,212,212,212, 64, 42,149, 66,173, 86,
- 35, 47, 47, 15, 23, 46, 92,128,159,159, 31, 96, 97,240,215,220,220,220, 59, 62, 62, 62,145,245, 15,241,190,125,251,122,238,222,
-189,187,120,200,144, 33,238, 52, 77,227,179,207, 62,171,232,222,189,187, 83,227,135,188, 57, 48, 24, 12, 92,191,126, 29,126,126,
-126,160,105, 26, 44, 22, 11,153,153,153, 16,139,197, 48,153, 76,160, 40, 10,229,229,229,176,177,105, 57, 70, 98, 74, 74,202, 91,
-111,191,253,118,177,173,173,109,120,101,101,101,  9,135,195,233,149,152,152,232,165,211,233, 32, 18,137, 32, 18,137,112,234,212,
- 41,216,217,217, 97,222,188,121,  5, 42,149,234,186, 64, 32,112, 81,169, 84,247, 75, 75, 75, 63,107,205,245, 54, 24, 12, 80, 40,
- 20,168,174,174, 70, 85, 85, 21,100, 50, 25,212,106,181,217, 50, 54,133, 94,189,122, 33, 46, 46,142,241,229,151, 95,254,156,155,
-155, 11,  0,240,245,245,197,188,121,243, 24, 30, 30, 30,200,203,203,195,157, 59,119,160,211,233, 64,211,116,139, 55, 47, 69, 81,
-125,223,124,243,205,158,222,222,222,132, 78,167,131,201,100,130, 70,163, 65,253,251,130,130,  2,  4,  5,  5,145,109,218,180,121,
- 37, 55, 55,183, 47, 44,219, 88, 97,  5,128,178,130, 99,240, 96,138,  1, 82,  4, 90,117, 12,149, 21, 47, 22,197, 69, 34,145,172,
-254,248,243,107,211,190, 95,167,115, 41, 42,  1, 58,132,142,132,127,112, 20,222,154,108,192,151, 95, 31,129,119,155, 14,120,252,
-248, 49,250,246,237,203, 42, 46, 46,126,187,182,182,118,161,165,220,231,207,223, 48,158, 59,117,122,236,184,215,167, 68, 70, 71,
- 15, 49,156, 61,123, 10, 41,247,207,166,190,253,250, 24,  9,109,170, 37, 28,236,120,201,153, 25,183,253,195, 59,189,  6,173,193,
-216, 11, 88,190, 14, 88, 78, 55,127,191, 67,123,242,164, 27,121,242,216,174,201, 19, 39, 77,237, 24, 21, 53, 64,127,246,252,239,
-184,243,175,243,247,190, 89, 55,227,242,151,155, 14,246,237, 63,104, 76,136,179,203,245, 83,161,  1,154,233, 94,142,182, 15,183,
-239,174,250, 39, 95,102,138,197,229, 26,  0,144,118,109,218,120, 30,189,112, 33,191, 19,147,201, 16,  1, 70,154,166, 59,  0,112,
- 34, 41,234,211, 19,211,167, 71,  4,213, 61, 72, 13,128, 41,  8, 32,165,128, 86,  0,176,209, 76,200, 28,138,203, 53,161,110, 92,
- 36,  9,  2, 52, 77, 63, 35,178,158, 23, 90, 36, 73,154, 53,  0, 52,230,108,252, 44,170,159, 80,111,221,186, 21, 28, 14,  7,108,
- 54, 27, 76, 38,211,172,251, 69, 99,206,212,188,188,126,191,236,219,199,105, 74,100, 85, 86, 86,162,178,178, 18,181,181,181,152,
- 48, 97,  2,107,197,237,219,157, 81,231,250,209, 28,167,183,155,155, 70,192,227,149,165,165,165,185,  7,  7,  7, 63, 83, 94,153,
- 76,  6, 30,143,135,125,251,247,179, 98,134, 14,125, 55,234,212,169,111, 96, 38,254, 85, 83,117, 39,  8,  2, 98,177, 24,246,246,
-246, 32,  8,  2,  6,131,  1,165,165,165, 72, 77, 77,197,237,175,151, 40,128,  0,  0, 32,  0, 73, 68, 65, 84,219,183,193, 32,  8,
-195,223,217,121,154,210, 34,255, 64,171,214, 31,150, 15,235, 45, 90, 68,115,214, 23, 75,133, 22,131,193,120, 97,171, 86,115,176,
-100,233,144,207,231, 63, 40, 46, 46,126,213,195,195,  3,  6,131,161, 65,104, 53,182,196,213, 91,201,120, 60, 30,238,222,189, 11,
- 62,159,255, 64,173, 86,183,200, 73,211,244, 43, 93,187,118, 69,108,108, 44, 18, 18, 18,240,232,209, 35, 40,149, 74,104, 52, 26,
-168, 84, 42,164,166,166,194,100, 50, 33, 52, 52, 20,  2,129,  0,124, 62,255, 65,189,229,171, 57, 40, 20,138, 18, 38,147,217,129,
-199,227, 53,124,230,230,230,134,202,202, 74,147, 94,175,199, 47,191,252, 34,115,117,117, 21,240,120, 60,139,133, 43, 65, 16,144,
- 72, 36,240,244,244,108,240,209,146,203,229, 16,139,197,245,194,  2, 26,141,  6, 54, 54, 54,160,105,218,220, 53, 82,231,228,228,
-124,216,232,255, 46,227,198,141,251,245,192,129,  3,237,226,227,227,113,243,230, 77, 56, 59, 59, 99,205,154, 53,143,242,243,243,
- 39,  2,184, 45,145,252,181,126,145,150,244,161,202,202,202, 35, 15, 30, 60,120,165,107,215,174, 13,163, 68,223,190,125,137,190,
-125,251, 58, 53, 54,245,151,151,151,227,214,173, 91,136,143,143,  7, 65, 16,200,206,206, 54,170, 84,170, 95, 91,160,102,121,120,
-120,236, 94,178,100,137,208, 96, 48, 52,244,109, 30,143,  7, 46,151, 11, 22,139,  5,  6,131,129,252,252,124,140, 24, 49,194,246,
-135, 31,126,216,165,209,104,218,  3,208,225, 37, 65,141, 10,186,187, 41, 50,219,208, 32,151,212,109, 91,191,124,117,230,172,167,
- 99,196,182,173, 95, 26, 66,131,196,169,119, 83,202,108, 35,197,230,235,123, 58,190,240, 61,173,254,244,176,211,103, 46,141,255,
-104,254, 60,166,175,111,144, 36,254, 98,146,119,148,225, 11,194,209, 73,132,202, 10, 25,242, 11,202,144,251, 88, 75,251,250,  6,
- 73,238,220,122,192,249,122,195, 70,127,133, 82,125,240,226,229,146,223,205,208,171,175, 92,127, 52,242,155,239, 56,151,167,188,
-221,133,205,227,185,163,170,226,  1,188,189,157, 49, 34, 38, 28, 59,247, 92,135,173,173,  3, 92, 92, 92, 64,146,164,192,210,186,
- 87, 84, 84, 16, 71,126,187, 50,237,205,169, 51,186, 15, 28, 48,212,112,230,236, 73, 42,225,220,137,235,187,182,125,122,148,102,
- 40,248,  4, 45,231,181,245,113,189,255, 48,231,238,196,126,209, 19,192, 99,217,248,  1,129, 77,118,216,134, 13,  6, 52, 10, 98,
- 15, 44,231,190, 57,117,102,143,129,  3,135, 27,206,158, 61,134,179,167,246,220, 88,182,172,237,169, 71, 79,246,179,254,117,187,
-136, 59,114,236,236,234,184,211,233,218, 49,195,124,178,220,  5,157, 84,192,163,127,108,255, 33,  9, 66, 86, 81, 94, 46, 98, 50,
-153,170, 93,111,188,145, 13,  0,122,138,170,148, 51, 24,206,  4, 65,100,  2,200, 92, 13, 56,129,205,150,142, 51, 24,140, 11,189,
-189, 89, 84, 73,  9,163,218,104, 52, 50,  0,246, 71,127,204,191,  8,  6, 69,149, 25, 52, 26, 47,207,129,  3, 25,202,199,143,153,
- 66, 23, 23,  3,  0,232,245,122,179, 66, 11,205,108, 90,121,158,211,210,250, 41,149, 74,152,154, 17,130,207,115,150, 74, 36,109,
-235, 38,225, 13,208,235,245, 13, 34,171,178,178, 18, 53, 53, 53, 16,  8,  4, 40,215,104, 92, 44,225, 28,208,173,219, 47, 43,150,
- 47, 95,120,248,200, 17, 86, 99,145, 85,255, 98, 50,153,248,106,221, 58,214,  7, 31,125, 52,251, 93,138,154,139, 38,150, 65,155,
-107,207,250, 73, 59,131,193,  0, 69, 81,120,252,248, 49, 10, 10, 10,240,248,241, 99, 60,126,252, 24, 60, 30, 15,244,223,188,  9,
-232, 31,236,159,133, 70, 75,133, 51,159,183,114,181, 24,222,161, 53,206,240,150, 10,  3,163,209,248,151, 10, 45,133, 66, 17,127,
-225,194,133,110, 35, 71,142,164,110,220,184,  1, 87, 87,215,  6,161, 85,255,183,126, 57,138,207,231,227,232,209,163, 58,133, 66,
- 17,111,230,102,186,112,234,212,169,200,165, 75,151, 50,223,122,235, 45,164,165,165, 97,214,172, 89,168,169,169,129, 76, 38, 67,
-101,101, 37,148, 74, 37,186,117,235,  6, 46,151,139,251,247,239,235,149, 74,229,  5,115, 75,103, 18,137,164,214,217,217,217,237,
-249,239,198,142, 29,235,242,211, 79, 63, 41, 51, 50, 50,244,175,190,250,170,200, 82,193, 81,143,223,126,251,173,193, 82,151,149,
-149,133,159,126,250,  9, 52, 77,131,166,105, 36, 37, 37, 97,253,250,245, 13,177,207, 90,137,219, 21, 21, 21,  6,189, 94, 15, 63,
- 63, 63,120,120,120, 64,173, 86, 99,227,198,141,  6,  0,183,255, 91,189, 89,173, 86, 31,158, 50,101,202, 39,201,201,201,110, 20,
- 69, 61, 53,105,215,213, 79,167,211, 33, 39, 39,  7,169,169,169,200,200,200, 64, 85, 85, 85,195, 68,224,238,221,187,213,122,189,
-254, 96,115,188,206,206,206,159,237,220,185,211,149,207,231, 63,211,159,235,173,161,245, 86,210,242,242,114,216,217,217, 33, 42,
- 42, 74,124,225,194,133,207, 52, 26,205,210,151, 68,103, 17, 99, 71,101,117,249,224,189,145, 24, 29,195, 47,140,141,123,114,109,
-253,215, 31,214, 57,195,139, 83, 71,199,120, 20,222,203,180,195,216, 81,199,186,  0, 40, 66,203,126, 90,166,139,151, 75,142,119,
-237,106,159, 16,123,226,196,174,197, 31,207, 79, 90,248,225, 12,103,165,234, 33,215,183, 13,155,  0,128,220,199, 90,250,126,154,
- 73,189,254,155,249, 73, 95,174,251,129, 44,171,172,153,117,235, 86,243,225, 13, 26,139, 23,146,  4,215, 55,176, 79,177,127, 64,
- 79,159, 27,215,247, 65,200, 87,161, 67, 96, 23, 12, 28,240, 10, 18, 46,221, 69,105,185, 26, 37, 37, 37,208,104, 52, 45,134, 75,
-200,184,127,116, 50, 77,208,222,  4, 77, 20, 16, 36,205,157, 60,101,122,175,161, 67,135,211,113,113, 39, 12,199,142,238,187,122,
-112,239,119,135, 73, 22,147, 82,105,109,181,  4,161,150,130, 76, 73,171, 85, 60,157,208, 48, 57,172,230,205,175,117,129, 93,131,
- 67,  2, 93, 39, 79,153,101, 59,100,240,  8,250,212,169, 99,166,131,  7,126, 73, 56,184, 35,108,159,137,148,177, 74, 10,149, 28,
-169, 76, 47,165,  9,182, 93,173,204,164, 44,203,109,175,118, 31, 58, 86,  7, 28,254,199,118, 32,218,100,122, 76,107,181, 62, 96,
- 50, 11,105,131,193, 21,122,125,213, 10,181,250,201, 23,108,118,219,101, 20,213, 25,  4, 97,210, 17,132,  2, 90,109, 46,  0, 56,
- 20, 20,184,105, 69,162, 82,134, 90,221, 30, 70, 99,147,  1,144,117, 26, 77, 81,109, 97,161,155, 67,159, 62,156,156,229,203,249,
- 46,221,186,169,137, 58, 31,226,150,132, 22,131,193,  0, 72,210,100,  9,167,165,245, 83,169, 84, 48,  1,250, 23,225, 52, 24, 12,
-207,136,172,122,161, 85,127,191, 88,194,185,109,217,178, 27,222,  3,  7, 86, 93,186,116,201,229,181,215, 94, 35,228,114, 57,228,
-114,249, 51, 98,203,221,221,157,  8, 14, 13,229,255,150,144,224,107,105,123, 90, 36,162, 73,242,111, 23, 90,255,112, 52,155, 72,
-154, 50,179,132,102,177,208,178,208,162,165,215,235,245, 16,139,197,168,168,168,104,246,193, 79,146, 36,120, 60, 94,253, 26,113,
-139, 59,239, 52, 26,205,198,133, 11, 23,206, 25, 60,120,176, 83,135, 14, 29, 80, 94, 94, 14, 23, 23, 23,112,185,220,  6,223,177,
-122,190,164,164, 36,236,220,185, 83,166,209,104, 54,154,225,220,176,110,221,186,247, 70,143, 30,237,224,234,234, 10,123,123,123,
-220,191,127, 31,246,246,246,144,201,100,200,204,204,132,141,141, 77,131,223,206,137, 19, 39,228, 26,141,102,131, 25,241, 70, 39,
- 38, 38,234,108,108,108,238,151,151,151, 51,170,170,170,168,234,234,106, 74, 38,147, 49,165, 82, 41,243,204,153, 51, 78,182,182,
-182,202,139, 23, 47,150,123,123,123, 51, 30, 61,122,196,208,235,245,102,213, 43, 65, 16,152, 59,119, 46, 88, 44, 22, 52, 26, 13,
- 54,110,220,136,133, 11, 23, 54,248,100,173, 91,183, 14, 75,150, 44,105, 16,206,219,183,111,111,221,192, 73,211,208,233,116,208,
-235,245, 22,111, 80,248, 83, 51, 98,203,  4,123,105,118,118,118, 76,215,174, 93,207, 29, 58,116,200,177, 46, 38, 25,202,202,202,
- 80, 86, 86,134,242,242,114,212,214,214,194, 96, 48,192,195,195,  3,101,101,101, 56,118,236,152, 84, 46,151, 15, 68, 11, 59, 14,
- 25, 12,198,148, 94,189,122, 81,207,151,161,126,150, 87, 47,222, 57, 28, 14,138,139,139,209,183,111, 95,246,165, 75,151,166,  0,
-248, 71, 11,173,198,225, 29,  6, 12,156,198, 10, 10,233,161,189,151, 26, 87, 24,232, 83, 86, 56,105,132,232, 36,  0,220, 77, 41,
-179,189,151,105,135,160,144, 24,122,192, 64,251,200,178,210,109, 97,  0,116, 45,165,235,  1,  0, 91, 62,103, 92,255,232,110,197,
- 54,  2,  1,185,254,155,237,167, 55,111,222,208,249,240,201,127,135,119, 88,255,205,211,240, 14,253,163,187,153, 50,210, 51,198,
-  1,216, 97,169,120,137,137, 25,150,188,115,247, 78,100,164, 94,116,255,100,110, 56,187,170, 76, 15,158,208, 11,145,157, 92,176,
-109,247,  3,220,187,119,175, 84,171,213,246,109,177,127, 19,180,119,106, 90, 74, 64, 88, 72,176,235,228, 41, 51, 69, 49, 49, 35,
- 16, 23,119, 28,123,127,217,145, 56,102,194,232,159,159, 84,203, 24, 98, 38,159,197,167, 77,108,  6,203,150, 98,113,120, 18,173,
-246,105,  4,  2, 38,147, 43,  2,198,181,248,224,121,103,230, 36,219,126,209, 35,112,242,212,113,236,253,101,219,229,207, 67,198,
-238,240,137,  8, 34,186,117,254,122,182, 79, 59,159, 54,138,218, 50, 25, 73,176,117,106,181,201,230,235, 95,242,191,205, 93, 50,
- 37, 23,192, 55,248,135,238, 58,100, 27,141,247, 52, 58,221, 36,175,200,200,219,197,183,111,135,173,209,235, 29, 62,  5,170, 62,
-215,106,243, 15,  1,133, 53,  0, 57,171,110, 76,255,  6,224,170, 40,202,205,150, 36,239,202,141,198,193, 96, 48, 82,209,244, 68,
-252,254,222, 33, 67,186,126,240,240, 33,203,185,103, 79, 94,113, 66,  2,191, 46, 19, 73,139, 66,139,162, 40,208,205, 47,117, 61,
-195, 73,236,217, 67,  2,  0,139,197,106,118,140, 99,177, 88, 80, 42,149,208, 55,111,193,126,134,211,237,236,217,194,135, 15, 31,
-250, 59, 56, 56, 60, 35,178,170,170,170, 26,222,171,213,106, 40,149, 74,240,120,188, 84, 85,211, 43, 34,207,112,150, 37, 38,170,
-215,206,157,187,116,226,132,  9,223,197, 95,184,192,117,116,116,132, 84, 42,125, 70,104,105,181, 90,244,139,138, 98,173, 75, 78,
-158, 12,153,108,153, 37,237,233,210,183,175, 89,127, 96,  6,131,  1,211,223,188,116,248, 18, 96,102, 83,194,139, 52,183,132, 99,
-233,174,195,102, 30,144,207,239,238, 91, 18, 25, 25,169,206,202,202,130,183,183,119,131, 88,105,124, 78,145, 72,  4, 59, 59, 59,
- 36, 37, 37, 97,245,234,213, 42,  0, 75,204,112,202,149, 74,229,235,253,251,247, 87, 81, 20,133,192,192,192,134,248, 89, 38,147,
-  9,108, 54, 27,  2,129,  0,201,201,201, 24, 54,108,152, 82,169, 84,190,142, 63,198,208,122,158, 83,170, 84, 42,223, 24, 48, 96,
-128, 50, 45, 45, 13,189,122,245,194,189,123,247, 80, 91, 91,139,218,218, 90,228,229,229, 33, 56, 56, 24, 74,165, 18, 63,253,244,
-147, 74,169, 84,190,  1, 64,218, 18,167, 92, 46, 31,182,112,225, 66,198,175,191,254,234,227,225,225, 17,210,165, 75,151, 14, 81,
- 81, 81,237, 71,141, 26,213,102,200,144, 33,110,254,254,254,234,129,  3,  7, 58, 15, 30, 60,216, 89,169, 84, 50,175, 93,187, 86,
-162,215,235,  7,155, 41,103,131, 56,201,202,202,106, 88, 42,164, 40, 10, 21, 21, 21, 13,145,251,235,  7,165,102,132,112,180, 57,
-177, 93, 47,176,234,  5,151,  5,126,110, 77,113,154,253, 17,155,205,174,183,120,210, 22,112,222, 77, 79, 79,239,223,167, 79,159,
-187,211,166, 77,147,151,150,150,194,198,198,  6,190,190,190,  8,  8,  8,128,147,147, 19,116, 58, 29,142, 30, 61,170, 56,118,236,
-216,  3,169, 84,218, 23,127,140,161, 21,253, 92, 59,230, 53, 53,200,214, 91,179,234,133, 22,151,203,133,135,135, 71,125,219,230,
-181,166, 61, 95, 16,127, 47,103,157,128,137,234, 55,176,221,144,161, 35,109,143, 30,191,206,254,238,199, 99, 15, 34,163,177,221,
-177,173,236,132, 99, 91,217,137,200,104,108,255,238,199, 99, 15,142, 30,191,206, 30, 50,116,164,109, 84,191,129,237,210, 82, 51,
- 58, 52,206,123,216, 84, 57,185, 92,110,143, 94, 61, 35,171, 47, 93,189,108,250,114,221, 15,100,191,190, 99,146,119,252,124,244,
-232,142,159,143, 30,237,215,119, 76,242,151,235,126, 32, 47, 93,189,108,234,213, 51,178,154,203,229,246,176,164,238,239,204,156,
-100, 59,116,200,  8,196,197, 29, 53, 28,254,237,167,117,  7,142,100,247,153, 62, 39,177, 44, 43,235, 30, 45, 41, 58, 11, 38,249,
- 24,233,233,233,210, 58,145,149,101,  9,231,172, 25,147, 26,139,172, 43,142,174,189,182,167,167,195,120,254,252,239,250, 11, 23,
-146, 85, 87,238, 74,164,119,210, 42,170,138,203,171, 30,201,100,149, 90,147,201,  8,163,209,200, 88,177,162,193, 97,183,201,107,
-244,234,171,175,225, 98,252,126,252,178,123,171,212,100,130,122,220,225,195,198,113,227,150,211,109,218,182,109,179,239,183,253,
- 68,204,240,145,182, 52, 96, 26, 54,122,132,221,175,  7,126, 37,218,249,181,107,235,235,219, 16,210,230, 31,215,151, 62,  1,106,
-  9, 32,189,228,214,173, 46,194, 94,189,238, 27,152,204,128,149, 44, 86,251, 77,  0,123, 28, 96,156,  5,232,151,  1,228, 50,192,
- 67, 69, 81, 29,121,  6,195, 61,185, 82,233,  9,  0, 95,208,244,163,166, 56,151,  3,213,178,199,143, 47, 39,253,240,131,198,229,
-245,215, 29,216, 46, 46, 34, 24,141, 68,253,248,222,220,139,162,168,231, 45, 48,205,114,122, 56, 57, 61, 57,113,226,  4,  2,  2,
-  2,224,225,225,129,198, 62,178,245,  1,185, 29, 29, 29,113,228,200, 17,208,207,  6,167,110,150, 51,194,199, 39,233,171,181,107,
-181, 38,147,  9,213,213,213,127,176,102, 85, 87, 87,195,100, 50,225,212,201,147, 90,217,211, 76, 32, 22,213,189, 47,131, 81, 59,
-177,119,239, 47,135, 14, 29,170,123,248,240, 97,195,206,235,122,203,150, 68, 34,129, 80, 40,132, 90,163,241,  2,192,183,132, 83,
-114,230,140,  0,102,198,245, 38, 44, 90,127, 71, 95,250,167,139,172,198,  9,165,103, 90,100,209, 50, 24, 12,240,242,242,122, 38,
-165, 11, 73,146,207,188, 90,185,227,112, 79, 90, 90,218,217,129,  3,  7, 46,237,222,189,251, 59, 75,151, 46,101,116,232,208,  1,
- 82,169, 20,246,246,246, 16,139,197,200,204,204,196,137, 19, 39,140, 21, 21, 21, 91,  0,172, 68, 19,  1,236,154, 64, 66,118,118,
-118, 76,120,120,248,129, 69,139, 22,217, 14, 24, 48,128,233,229,229,  5,154,166,145,156,156,140,216,216, 88,221,142, 29, 59,100,
-117, 34,203, 82,231,229,115,197,197,197, 99,  6, 15, 30,188,111,202,148, 41, 54, 70,163,145,153,151,151,  7,141, 70,  3,189, 94,
-143,130,130,  2, 93, 92, 92, 92,173, 82,169,156,  4,224,156,  5,124, 73, 53, 53, 53,193,231,207,159,159,114,237,218,181,213,211,
-166, 77,115,140,138,138, 98, 25, 12,  6, 92,189,122,181, 60, 34, 34, 66, 44,145, 72,116, 71,142, 28,169, 84,171,213, 75,140, 70,
-163, 69, 41,120,  8,130,128, 76, 38,131,147,147, 19, 52, 26, 13, 76, 38, 19,180, 90, 45,132, 66, 97, 67,218, 36,154,166,209, 26,
-231,250,231,250,  0, 67,167,211, 97,194,132,  9, 48,153, 76,216,184,113, 35, 12,  6, 67,171,201,108,109,109,239,220,189,123, 55,
-166, 83,167, 78, 13,226,165,190, 15,113, 56, 28, 56, 57, 57,193,209,209, 17,113,113,113, 96, 50,153,119,204,249,187,213,225, 94,
- 69, 69, 69,196,249,243,231,123, 60,120,240,224, 77,  0,157,116, 58,157,135,209,104, 36, 72,146, 44,161,105,250,190, 76, 38,251,
- 25, 22,166,224,145, 72, 36,171,167, 78,157, 26,177,127,255,126, 33, 69,253,251,214,160, 40, 10, 28, 14,  7,245,193, 49,105,154,
-134, 86,171,197,103,159,125, 38, 83, 40, 20,171, 95,150, 81, 34,178, 75, 55,108,251,105,147,240,194,197,179,229,233,217,136,181,
-183, 79,127,190,255, 21,149,149,110, 11, 43, 46, 44, 20, 70,118,233,102, 17,167, 94,171,171,124, 99,210,  2,239,186, 20, 60,159,
-229,229,229,111,221,183,231,219, 92,  0,248,122,195, 70,255,178,202,154, 89, 25,233, 25,227,182,110,253,173,135, 94,171,171,180,
-132,243,223,226,101,159, 20, 52,212,  0,110, 38, 63, 40,243, 25,246,250,153, 37,126,237, 68,195, 37,149,170, 39,181,181,202,247,
-  1,228, 90, 90,247,158,175,246,193,197,115,191, 98,239, 47,251,100,180,137,161,118,114,114,162,  1, 32, 61,221,137, 78, 79,175,
-161,255,237, 87,108,167, 96,210,247, 86, 46,120, 63,106,129, 84, 86,181, 97,227, 79, 45, 47,165,132,119,236,142,240,142,221, 49,
-231,253, 79,109,131, 67,  2,189,  1,224,240, 97, 24, 67,252,210,126, 95,250,249,242,225, 43, 87, 46,135, 76,174, 65,125,186,158,
-204,148,180,147,185,185,208,254,147,251,209, 82,131,225,234, 74,154, 30,165, 76, 76, 12,235,241,209, 71,183,174,172, 95,239, 35,
-101, 48, 94, 93,  1,152, 72,130, 48,130,166,121, 36, 73,150,  8,244,250,100, 57,155,237, 70,152, 76,157,109,140,198,163,122,163,
-145,110,129,243, 38, 22, 44,240, 87, 86, 85, 57,247,252,228, 19, 39,234,163,143,200,150,156,225, 27,223,191,150,112,222,190,127,
-255,228,172,233,211,159, 44, 91,186,116,224,150,173, 91,121, 97, 97, 97, 40, 45, 45, 69, 96, 96, 32, 60, 60, 60,112,254,252,121,
- 28, 57,120, 80, 81, 35,151, 47,  1,176,217, 18,206, 61,167, 78,101,118,  8,  9,169,216,186,117,171,251,208,161, 67,  9,133, 66,
-  1,169, 84, 10,169, 84, 10,141, 70,131,186,128,208,116, 86,118,118,186, 94,175,223, 98,105,221,141,229,229,220,149,221,186, 21,
-177, 76,166,175,198,140, 30,189,112,229, 23, 95,112,218,181,107, 71,104, 52,154,  6,171,150, 78,167,131, 80, 40,212,105,181, 90,
- 71, 52,225,247,214, 20, 39,103,199, 14, 67,121,121, 57,156,157,157, 27,194, 53, 53,142, 75, 40,151,203, 65,211,244, 75,155,  0,
-253,239, 68,179, 10,201,222,222,254, 14, 69, 81,158,141,173, 91, 77,229,206,107,252,153, 94,175, 47,170,168,168,136,124, 78,241,
- 54,231, 15,229, 11, 96, 77,191,126,253,198,124,248,225,135,196,165, 75,151,112,236,216, 49, 58, 55, 55,247,112,157, 21, 43,183,
-133,217, 83,115,156, 54, 28, 14,103,158, 64, 32,136,174, 15,225,192,231,243, 31, 40, 20,138,248,186,229, 66,249, 11,112,138, 56,
- 28,206, 92,129, 64,208,191, 46,253, 10,108,108,108,238, 42, 20,138,243, 26,141,102, 19,154, 79, 84,221, 18, 39,207,214,214,118,
-181,147,147,211, 27, 31,125,244,145, 99, 98, 98, 98,201,197,139, 23, 89, 53, 53, 53,251,181, 90,109, 75, 73,165,255,192,233,224,
-224,112,135,193, 96,120,254, 77,215,  8,225,225,225,113,195,134, 13, 27, 58,105,210, 36,232,245,122,108,222,188, 25,231,207,159,
- 63,153,147,147, 19, 99,102,134,251, 60,167,147,167,167,231,165,119,222,121,167,205,132,  9, 19,248,246,246,246,160, 40, 10, 10,
-133,  2, 57, 57, 57, 72, 78, 78,166,143, 31, 63, 94,155,148,148, 84,164, 84, 42, 95,  3, 80,209,138,246,252, 51, 51,241,103, 56,
- 41,138,234,227,229,229,245,219,178,101,203,108,250,247,239,207,115,116,116,  4,131,193,128, 94,175, 71, 73, 73,  9, 82, 82, 82,
-112,246,236, 89,197,225,195,135, 21,149,149,149, 19,  0, 92,254,111,148,243,175,228, 12,242,199,231,207, 37,138,110, 54,218,187,
-153, 99,205,150,179, 95, 31,183, 17,227,198, 12, 30,  4,  0,135,142,156, 62, 99, 65, 82,233,102,203,105,174,172,150,112,  6,250,
-145,203, 82,211, 82,158,  9,104, 25, 18, 28,154, 21, 20, 54,122,149, 37, 68,141, 34,195, 63, 83,247, 70,203,177,141,109,186,207,
- 44,179,  6,249, 34,102,196,184, 81, 67, 63, 93,178, 24,107, 86,127,137,227,135,142,158, 76,207,125, 38, 77,208, 63,174, 47, 53,
-126,182,172, 96, 48,250,145, 36,233, 69,176,217,183,244, 10, 69,182, 13,192,148,  3,140, 21,128, 98, 37,139,213, 30, 70, 99,  8,
-104,154,146, 19, 68,220,122,163,209, 30, 64,177, 57,206, 85, 20,213,157,239,230,214,123,163,201,180,248, 94, 74,138,176,241,132,
-173,222,242,220,120, 82,233,238,238, 46, 41, 41, 41,113,177,132, 51,230,251,239,117, 74,129,128,179,248,171,175,250,212,170,213,
-125, 86,174, 92, 73,221,190,125, 27, 63,253,240,131, 65, 93, 84,180,175, 28,152,219,204,106, 72,179,156,109,230,206,229,126,252,
-211, 79,111,249,250,249,137,223,124,243, 77, 38,147,201,132, 66,161, 64, 97, 97, 33,206,157, 61,171, 77, 75, 79, 79,147,201,100,
-195, 91, 83,247,152,239,191,215,217,249,250,130,239,236, 76, 95, 72, 72,176,157, 53,111,222, 59,109,125,124,108,  7, 14, 26,196,
- 20,137, 68,168,174,174, 70, 94, 94, 30,142, 30, 61, 42,169,173,173,117,  7, 96,180,132,115,223,181,107,225,167, 46, 95, 30,187,
-106,213, 42,118,104,104, 40,108,109,109, 33,151,203,145,146,146,130,203,151, 47,107,182,108,217, 34,149, 74,165,239, 24,141,198,
- 19,127, 99, 95,122, 41,151, 14,255,110, 15,127, 75, 46, 68, 36,128,207,235,222,127,  1,243, 57,  3,255,201,131,207,243,240,118,
-112,112,216,166, 86,171,105,149, 74, 53, 11, 64,193,255, 96, 57,169,200,200,200,159, 36, 18, 73, 15,154,166, 97,107,107,123, 61,
- 53, 53,245, 93, 52,179,243,198, 12, 39,  3, 64, 15,161, 80,216,205,198,198,166,143, 70,163,  9,170, 91,126, 75, 87, 40, 20,151,
-117, 58,221,205, 58,235,147,241,191, 92,119,  6,128,254,238,238,238,211, 77, 38,147, 31, 65, 16,118, 70,163, 17,122,189,190,198,
-100, 50,229, 72,165,210, 29,  0,206,255, 15,148,243, 47,225, 12,110,143, 81, 52,137,160,230,  4,193, 51, 66,235, 57,  1, 65,152,
-144,158,246, 16, 71, 91, 81, 78,114,112,180,215,143,192,211,157,137, 48,239, 92,251,111,161,101,129,120,105,181,200,108,207,152,
- 74, 19,244, 51,156,  4, 77, 20,  4,134,143,218,251,103,132,150,165,  8, 14, 64, 31,208,232, 97,162,113, 51, 35,  7, 23, 95,182,
-177,110, 25,224, 66,146,100, 87,130, 36,219,211,128,130, 32,  8,  3,104,218,  1, 52,253, 16, 12, 70,234, 82,157,238, 33,154, 78,
- 96,222, 44,231, 26,192,225,  7,123,251,235, 36, 69,185,  2, 32,235,172, 47, 38, 19, 65, 24,105,130, 48, 52, 94,222,122,110, 98,
-217, 34,167, 14,  8, 99,114, 56, 94, 70,131,193,165, 20, 16,158, 50, 26, 59,171,105,186,214, 19,248,252, 46,144,217,218,186,215,
-115, 50, 56, 28,239, 83, 52, 61,162, 92, 32,  8,151,168, 84,206,  0,104,161, 64,144, 46, 83, 40,126, 81,171,213, 63,182,182,238,
- 58, 32,140,197,225,120, 26, 13,  6, 23,  0, 32, 41, 74,114, 64,163,241, 42, 18,137,222, 84,107, 52,109,132, 66,161, 94,171,213,
-202,212,106,245, 36,131,193,112,161, 53,117,207, 49, 24,130,175,145,100, 47,157, 64,224,168, 35,  8,129,214, 96,208,105,117,186,
- 66,181, 90,253,  0,192,183,  0, 30,254,205,125,201,138, 23,188,  1,173,156, 86, 78, 43,167,149,211,202,249,255,156,115, 45, 32,
- 90,  3, 56, 88,219,243,111,229,228,  3,240,174,155, 44,254, 19,235,254, 82, 90,183, 40,107, 91, 88, 97,133, 21, 86, 88,241,119,
- 99, 81,243,110, 22, 86,252,117, 80,162,  9,159, 44, 43,254,187, 32, 90, 80,165,173, 49,  9,190,136,178,141,183,114, 90, 57,173,
-156, 86, 78, 43,167,149,211,202,249,255,142,211, 28,247, 63,113, 73,114,102, 19,159,109,251, 79,156,216,106,254,181,114, 90, 57,
-173,156, 86, 78, 43,167,149,211,202,249,255, 22,164,181,  9,154,133, 75,221,235,175, 62,214,138,151,187, 47,252, 39,224, 81,247,
-106,205,241,110,214,203,104,133, 21, 86, 88,241,255, 67,104, 89,250,208,250, 51, 15,183, 63,251, 96,252,146, 32, 80, 76, 16, 40,
-  6,240,229, 95,120,172, 57,184, 59, 57, 57,125, 16, 28, 28,188,207,197,197,101, 14,  0,113, 43,127,239,207,231,243, 55,  9,  4,
-130, 75,  2,129,224, 18,159,207,223,  4,192,255, 47,186,110,  4,128, 89, 28, 14, 39,193,205,205,237,  9,155,205, 78,  0,240, 14,
- 94,124,231,106,  7, 60,141,147,246,  5,128,240,214,252, 80, 28, 50,226,160,115,200,136,251,206, 33, 35, 82, 28, 67,135,249, 59,
-135,140, 72,113, 14, 25,113, 95, 28, 50,226,224,223,208, 95,255,202,235,251, 87,149,167,128, 32, 80, 96, 97,121,190, 37,128, 66,
-130, 64,209,255, 72,249,173,176,194, 10, 43,172,104, 86,  5,184,187,143,113,115,115,139,119,115,115, 59,239,238,238, 62,198,130,
-159, 68, 55,241,144, 48, 18,  4,140,102,  6,253,150,142, 51,103,174,108,252,219,245, 22, 86,173, 49,167, 11, 65,192, 72,215,129,
- 32, 96, 18,139,197,223,185,185,185,125,249,252, 75, 44, 22,127, 71, 16, 48, 53, 58,214,216, 72,224,181,214,172,234, 50,121,242,
-228, 67,213,213,213,113, 90,173, 54, 46, 59, 59, 59,238,181,215, 94, 59,240,156, 37,162, 89, 78, 46,151, 59,177,107,183, 30, 73,
-151,175,222,204,206,202,201, 47, 78,203,124,148,255,251,153, 11,183, 67,195,194,111,113,185,220,137,173,184, 70,  4,128, 89, 20,
- 69, 37,  8,133,194, 34,138,162, 18,  0,204,102, 48, 24, 39,214,174, 93,155,159,154,154, 90,118,237,218,181,154,203,151, 47, 63,
-153, 54,109, 90, 14, 65, 16,191, 55, 33,216,163, 45,176,192, 44,125,252,248,241,153,146,146,146,179, 60, 30,111,181,  5,199, 55,
-112, 58,135,140,184, 47,145,234,104,137, 84, 71, 59,135,140,160, 27,189,191,223,202, 54, 55,119,141,254,208, 23, 56, 28,142,183,
- 25, 65,255,119,154,232,255, 80, 30,  0,174,117,223, 69,  2,248,190,238, 85,191,157,221,149,203,225,252, 85,253,243,175,104, 79,
- 43,167,149,211,202,105,229,124, 89, 17, 81,247,215, 13, 79,253,181, 26,158,221,173,221,117,248, 94,118,118,182, 16,  0,  2,  2,
-  2,222,  5,112,164, 53, 66,130, 32,240,177,201, 68,147,  0, 64,146,196, 39,125,251,246,139,224,241,120,207, 68, 65, 86,169, 84,
-236,132,132,139, 81, 38, 19, 77,212, 29,247, 49, 77, 99, 19,128, 50, 75,207,161,213,106, 72, 38,147, 13,146, 36, 22,132,134,134,
-181,173,168,168, 72, 36, 73,114,223,147, 39, 79,170, 91,109,198, 33,  8,108,223,190, 61,192,205,205,237, 15,209,154, 75, 74, 74,
-216, 35, 70, 12,111, 21,223, 84,128,163,225,112,186,177,  8,194,205,104, 48,216,  1,  0, 69, 81,213,183,217,236,200, 53,171, 86,
-241,  9,130, 48, 85, 86, 86, 66,165, 82, 97,254,252,249,188,180,180,180,145, 21, 21, 21, 63,154,161, 13,  8,239, 24, 49,255,236,
-217, 51, 65,178,170,106,245,246, 13, 91,147, 84, 20, 75,233, 19, 28,200,250,105,219, 47,246, 51,223,154,244,126, 70, 70,234, 93,
- 52,157,142,164, 49, 72,  0, 71,231,205,155, 23, 18, 19, 19,195,150,203,229, 92,149, 74,213,118,223,190,125,159, 69, 70, 70, 10,
- 59,117,234,196,254,237,183,223,  8,169, 84, 10,154,166,249,129,129,129,244,248,241,227,213,  7, 14, 28,152,  3,224,187, 22,132,
-239,199, 79,219,146,220,216,161, 67,135,101,  0,144,157,157,205,106,212,198,204,160,160, 32,  1,  0,100,102,102,174,160,105,211,
- 60,  0,160,105,172,  3,176,184,  9,211, 90,118, 72,207,113,  0,  1,191,212,171,135,184, 33,189,198,169, 65, 35,135,  0,178,235,
- 38,  4, 43,129, 70,113,161,158, 69,122,113,113,241, 11,229, 38, 28, 58, 52,134, 32,  8,226,112, 82, 82,210, 17,137, 68,226, 99,
- 50, 25,103,180, 84,206,230,174,149,179,179,243, 89,163,209,168,169,170,170,106,  8,148,233, 28, 62,170,135,163,141, 32,170,188,
- 90,158, 88,153,118,252,178,133,125,147,112,116,116,156, 90, 81, 81,241, 37,128,233,233,233,233, 17,  0, 16, 20, 20,196,  2,112,
- 71, 36, 18,189,170,211,106,  9,235,248,103,133, 21, 86, 88,241, 31, 17, 90,201,  0,134,226,223, 41,120,182,189,136,208, 98,  3,
- 64, 98, 98, 34,  0,112, 94,160, 32, 68, 99,  1, 51,119,238, 92,184,185,185, 61, 47, 94,112,233, 82,194,159,169,236, 51,231,248,
-226,139, 47,132, 53, 53, 53,209, 63,255,252,115,111,154,166,215, 23, 23, 23,223, 48,243,251, 50,154,198, 58,146, 36, 62, 33,  8,
-  2, 28, 14, 55,235,157,119,222, 73,174,251,174,237,239,191,255,206, 31, 54,108,152, 18, 64, 62,  0,112, 56, 92, 15,  6,131, 12,
-160,105,186,254,129,219,172, 32, 28, 11,248, 26,216,236,126,179,190,255,222,208,121,216, 48, 74,224,236, 76,  0, 64,126, 70,134,
-227,186,175,191,126,181, 58, 55,151,173,114,116,172,172, 84, 40, 84, 89, 89, 89,224,112, 56,  4,131,193,232,108,174,194,  2,129,
-224,131, 85,107,190, 18,200,170,106, 84,106,153, 92,203, 48,232, 53, 54, 60,190,177,172, 84, 82, 41,228,  9,148,159,124,190,156,
-253,222,140, 41, 31, 40, 20,138,119,205, 80,205, 89,176, 96, 65, 80,215,174, 93, 61, 14, 30, 60, 72, 72,165, 82, 80, 20, 37,236,
-212,169, 19, 34, 35, 35,141, 23, 47, 94, 36,124,124,124, 16, 26, 26,138,171, 87,175,226,250,245,235, 68, 68, 68,  4, 63, 54, 54,
-118,178, 94,175,255,206,156,184,102, 48,200,249,129,129,129,157,  4,  2,129, 54, 32, 32,  0, 51,102,204,  0, 77,211,136,142,142,
- 14, 21, 10,133, 71, 20, 10,  5, 59, 51, 51,163,183, 57,145, 45, 73, 61, 62,190,222,178,  5, 32, 12, 52,114,202, 83,143, 55, 94,
-126, 12,202,204,204,236, 94, 93, 93,141,167,215,133,110, 72, 96,222,187,119,239,214,244,165, 50,154,198,186, 97,195, 98, 62,  1,
-  8, 34, 58, 58,186,102,206,156, 57,100, 70, 70,198, 27,163, 70,141, 12,205,206,206, 65, 43, 39,  3,  1,  3,  6, 12,184,122,234,
-212, 41,199,128,128,128,242,170,170,170,134, 47, 92, 29,237,  6, 94,142,221,248,193,234, 77,251,  2,247,208, 68, 77,121,250,177,
-  7,102,250, 38, 49,117,234, 91,101, 66,161,112,244,225,195,135, 51, 75, 74, 74, 40, 22,171, 65,187, 50,196, 98,177,115, 64, 64,
-192,108,  7,  7,  7,  9,131, 36,197, 52,104,218, 92,255,180,194, 10, 43,172,176,226,133,113,178, 78, 92,157,124,254, 11, 10,  0,
-226,226,226, 26, 34,211,198,196,196, 52, 59,  3,166,105,186,236,222,189,123, 94, 74,165, 18, 52, 77, 91, 50, 96, 55,222,162, 89,
- 70, 16,228, 79, 36, 73,188, 75, 16,  4, 66, 67,195, 30,109,220,184,177,169,156, 94,218,208,208,176, 71, 12,  6,217,142,166,105,
- 16,  4,185,153,166, 77,101,205,112, 54,249, 32, 98,179, 57, 31,  3,128,171,171, 91,238,233,211,167,181, 99,199,142,197,215, 95,
-127,205, 90,180,104,209, 66,138,162,230, 20, 20, 20,148,182, 80, 78,  0, 88,236,236, 44,230,111,223,190, 61,224,157,119,222, 73,
- 46, 41, 41, 89, 12,  0,110,110,110, 95,  2,  8,  6,144,223,232, 51,108,217,114,224,201,140, 25, 51,178, 36, 18,201,226,230, 56,
- 71,  3,237,189,  2,  3,251,173, 76, 76,164, 73,141,134,168,184,114, 69, 86, 94, 86,166,127, 88, 94,206,223,125,231, 78,204,103,
- 95,126,201,244,242,246,198,165, 19, 39,156, 42,148,202,114,169, 70,163, 46, 43, 43,163, 13,  6,195,117, 11,234, 30, 34,118, 22,
-243,183,126,187,249,182, 13,147, 97, 18,123,122, 16, 76,  7,  7,138,228,139,216, 12,138,212,180,107,235,207,  6, 16, 98,238, 26,
-177, 88,172,201,  3,  6, 12,224, 31, 56,112,128,  8, 13, 13,133,157,157, 29,174, 92,185,130,187,119,239,162,186,186,154,212,235,
-245,232,210,165, 11,190,250,234, 43,120,123,123,163,166,166,  6,  5,  5,  5, 78,108, 54,219, 89,175,215, 55,215,158,207,244,167,
-143, 63,254, 24,110,110,110, 48, 24, 12,168,170,170,130,193, 96,128, 80, 40,  4,  0, 20, 21, 21,225,196,137,227,150,244, 37,179,
-160,105, 26,175,188,242,138,156, 32,136,244,231, 45, 90,173,225,244,240,240,248,173,188,188, 98,112,191,126,253, 80, 93, 93,173,
- 95,190,124, 57,194,195,195, 17, 16, 16, 96,182,156,238,238,238,179, 12,  6,195, 82,  0,208,233,116,187,185, 92,238,219,123,247,
-238,117,108,156, 34,164,222,146, 85, 38,169,172,190,126, 59, 53,115,193,172,177,175, 37,222, 72, 41,212, 49, 71, 20, 72,239, 31,
-151, 54, 81,206,197, 44, 22,251,231, 54,109,218,124, 59,119,238, 92, 55,  7,  7,  7,104, 52,154,207, 74, 75, 75, 49,123,246,108,
-  0,192,144, 33, 67,194,153, 76,230,233,105,211,166,193,199,199,231, 73, 85, 85, 85, 65, 82, 82,210, 12,165, 82,153,242,162,237,
-105, 33,172,156, 86, 78, 43,167,149,243,133, 97,169, 22,249, 31, 69,  9,158, 13,231,176,237, 25,161, 21, 19, 19, 67,196,197,197,
-209, 22, 84,172,210,211,211,211,139,199,227,  1, 64,101,107, 75, 97, 50,153,230, 56, 58, 58, 74, 22, 47, 94,220, 51, 32, 32, 64,
- 59,103,206,156,148,252,252,252, 37,141,143,105,219,182,237,234, 31,126,248,  1, 89, 89, 89,249, 95,126,249,229,213,202,202,202,
-214,230, 49, 91, 68,211,216, 88,103, 29,171, 56,113,226, 68,120, 98, 98,226,187, 27, 54,108,112,126,239,189,247, 88, 31,124,240,
-193, 36,  0, 95,155, 35, 97, 48, 24,202,166,150, 11,155,130,155,155,155,150,193, 96, 52, 27, 36, 46,  6,224,113,217,236,190, 43,
- 19, 19,105,109,126,190,114,231, 55,223,216,108,189,117,107,153,158,166, 93,196, 98, 49,122,189,250,106, 45,151,193,168,144,148,
-150,154,196,237,219, 51,242, 78,159,118, 82,177,217,197,  7, 14, 28,144, 86, 86, 86, 30, 51,107,194, 35,  8,153,137,166,181, 66,
- 79,111,253,216,145,253, 67,111,223,188,155, 97, 35,118, 34, 35, 58,133,134,103,100,229, 39,193,100,210, 17,  4, 97, 54, 88,160,
-173,173,109, 64,101,101, 37,100, 50, 25,156,157,157,177,113,227, 70,184,186,186, 66,169, 84, 34, 53, 53,149,246,244,244, 36, 18,
- 19, 19,225,233,233,137,242,242,114,104,181, 90,200,229,114,137, 70,163,105, 46, 55, 99, 25, 73, 50,118,145, 36,241, 22, 65, 16,
-104,215,206,247,241,143, 63,254,168, 53,153, 76,  8, 10, 10,194,168, 81,163, 16, 27, 27,139,212,212,212,122,203,147,182, 77,155,
-182,143, 73,146,104, 83,167,149, 94,216,  2, 83,159,218,167,184,184,120,244, 11,222, 52,164,187,187,251, 36, 63, 63,191,119, 39,
- 78,156,168,103,179,217, 80, 40, 20,245,109,161, 31, 60,120, 72,205,176, 97, 49,182, 39, 79,158,108,182,156, 58,157,110,233,147,
- 39, 79,220, 84, 42, 21,  6, 13, 26,244,193,250,245,235,  5,108, 54, 27,  0, 96, 52, 26,159,177,100,173,218,176,231,236,188,165,
- 63, 38,156,253,237, 43,247, 85,139,222,126,109,210,156,213,  9,  0,206, 52, 85, 48,173, 86,155, 43,149, 74,167, 47, 88,176, 96,
-223,150, 45, 91,236,151, 44, 89,  2,147,201,  4,154,166, 97, 48, 24, 26, 18,137,155, 76, 38, 28, 61,122, 20, 15, 31, 62, 92,253,
-156,200,178,194, 10, 43,172,248,159, 67, 43,180,200,255, 34,220,240,116,217, 16,207,139,173,255,120,100,120,  6,131,177,245,220,
-185,115,157,122,247,238, 77, 69, 69, 69,133,158, 57,115, 38,244,201,147, 39, 41,117,214,131,208,168,168,168, 80,177, 88,140, 77,
-155, 54, 41, 25, 12,198,214, 23, 60, 77,195, 67,175,180,180, 52, 25,192,250,216,216,216,117,179,102,205,130,171,171,107,112, 73,
- 73,201,127,180,206, 34, 14, 39, 98,218,198,141,  6,166, 94, 79,126,191,126,189,232,155,132,132,117,  7, 15, 29,162, 94,121,229,
- 21,130,166,105, 60,184,127,159,247,213,119,223,241, 39,140, 28,153,159,153,155,107, 56,126,246,172,190,236,201,147,170, 39,229,
-229, 75,  1, 84,153,227,215,235,245,255,202,206,206,118,239,213,231, 21,143,203,183, 82,238,142, 29, 57,164, 31,147, 34,137,156,
-252,162, 59,110,174, 78,182,151, 18,226, 85,122,189,254, 95,230,120, 20, 10, 69,158,193, 96,112,160,105,218,249,210,165, 75,112,
-118,118, 70,117,117, 53,244,122, 61,180, 90,173, 86,169, 84,114, 43, 43, 43,161, 86,171,161,209,104, 32, 18,137,240,224,193,131,
- 50,131,193,112,177, 57, 78,163,209, 56,141,195,225,124,193,100, 50,217, 44, 22,171,248,206,157, 59,144,201,100,109,237,236,236,
-190, 54, 24, 12, 40, 46, 46, 70, 98, 98,226, 71, 34,145, 40, 31,  0,184, 92, 46,216,108,142,163, 70,163, 49,  0,120,242,162,109,
- 78,211,244, 11, 95, 47, 87, 87, 87,111, 30,143,183,242,147, 79, 62, 14,234,216,177, 19,202,203,203, 97, 50,153, 32, 16,  8,160,
- 84, 42, 33, 18,137,208,163, 71,143,188,149, 43, 87,150,208, 52,102,182, 32,  6, 25,117,215,  7,179,102,205, 18,136, 68, 34, 20,
- 22, 22, 34, 48, 48,176, 65,104,149,148, 87, 62,184,118, 59, 37, 99,193, 59,227,250,236, 63,145,144,126,246,210,157,244,145,131,
- 94,237, 72, 16,116,219,150,202, 40,145, 72,202, 41,138,154, 51,107,214,172, 47,  2,  2,  2,218,209, 52, 13,127,127,127, 12, 24,
- 48,  0,167, 79,159, 70, 86, 86, 22, 20, 10,133,241,198,141, 27,191,150,148,148,252,110, 29,194,173,176,194, 10, 43,254, 86,252,
-193, 55,235, 25,139,214,127, 18, 18,137,164, 60, 35, 35,227, 76, 82, 82, 82,204,248,241,227,113,233,210,165,241,103,103,  1,  0,
-  0, 32,  0, 73, 68, 65, 84,169,  0, 22,  0,  0,135,195,153, 58,126,252,120, 36, 37, 37, 33, 35, 35,227,140, 68, 34, 41,255, 43,
-206,201,102,179,213, 90,237, 83,227, 20,151,203,229,182,242,231,109,235,150, 12,  1,160,109, 11,159, 53,111, 26,161, 40,183,176,
- 65,131,168,234,187,119,101,219,111,222,252, 98,223,190,125, 84,207,158, 61,  9,189, 78,  7,163,201,  4, 95, 95, 95, 34, 42, 58,
- 90,176,107,223, 62,  7,163, 66,145,184,234,147, 79,174,108,155, 54,173, 54,187,206, 15,204, 28, 52, 26,205,119,239,206,158, 30,
-157,112,233,138, 71,112, 96,123,135, 51,231, 18,146, 29, 29,109,249,  1,126,126,130,202,234, 42,227,146, 69, 31, 81, 26,141,230,
-123,115, 60, 42,149,234,104,124,124,252, 72, 47, 47, 47,231,148,148, 20,104,181, 90, 24,141, 70, 68, 69, 69,129,166,105, 14,  0,
- 19, 69, 81,200,200,200,128, 78,167,147,100,103,103, 23,231,228,228,112,  0,172, 53, 83,190,199, 26,141,  6,233,233, 79, 87,237,
- 60, 61, 61,251, 15, 29, 58, 20,  6,131,  1,131,  6, 13,194,241,227,199,251,167,167,167,127,211, 88,243,253,217,107, 94,103, 33,
- 11,114,119,119,143,173,251,200, 34, 39,120, 15, 15,143, 80, 95, 95,223, 45,107,215,174,101,121,122,122,130,166,105,216,219,219,
- 65,169, 84,162,162,162, 18,193,193,193,240,242,242,194,218,181,107,  1,224,215,150, 44,110, 38,147,  9, 37, 37, 37,200,203,203,
- 67,110,110, 46,188,188,188, 64, 16,  4,228,114, 57, 12,134,167, 57,185,249,114,217,201, 31,118,253,222,247,208,150,165, 33,221,
-194,252,189,111, 38,167, 73, 38,143,238,207,247,247,241, 14, 40, 79, 89, 78,  2,203,155, 77,186, 92, 92, 92,156, 83, 92, 92, 60,
- 94, 34,145,176,106,106,106, 34,251,247,239,191, 41, 58, 58, 26,201,201,201,184,114,229,202,  4, 14,135, 35,209,233,116,  6, 87,
- 87,215,153,  4, 65,136,116, 58,221,254,202,202,202, 18,235,120,104,133, 21, 86, 88,241,151,163,222, 71, 11,141,254,182,206,162,
-245,127,236,157,119,120, 20, 85, 27,197,207,108,223,108,122,217,144, 66,  2,132,146, 16,  2,  4,164, 72, 15,  8,210,130,116, 80,
- 41,130, 74, 19, 69,164,  8, 22, 64, 44,128, 74, 83,145,170,210,123,211,128, 64,162,180, 72, 64, 58, 36, 36,129,  4, 82,119,211,
-203, 38,219,167,220,239,143, 20, 19, 72,217, 77, 98,129,111,126,207, 51,207,236,206,206,156,185, 83,246,206,153,247,182,192,192,
- 64,219,164,164,164, 73, 77,155, 54,149,  2,128,141,141, 77,155,230,205,155,207, 79, 76, 76, 44,178, 54, 53, 58,157,238,192,238,
-221,187, 95, 92,179,102,141,100,200,144, 33, 45,142, 28, 57,210,  5,  0,134, 12, 25,210,194,222,222, 30,187,119,239, 54,235,116,
-186,  6,235, 19,137,166,233,222,157, 59,119, 70, 94, 94, 30,146,146,146,172, 42, 66,249,229,151, 95, 20, 40,169,151, 85,227,178,
-154, 96, 76, 38,103, 39,111,111, 65,250,217,179,230, 60,141,198,179,119,159, 62, 20,109, 54, 67, 32, 16, 32, 55, 55, 23, 41, 41,
- 41,112,116,114,162, 98,239,223,183,219,182,112,225, 47, 77,131,131,165,172,201,228,106, 69, 50,181, 57, 89,153, 83,222,158,253,
-214,209, 61,123,246, 42, 11, 52,154,  4, 27, 27,133, 81, 38,147,120,204,121,251,109, 54, 47, 47,111, 50,128, 98, 11,116, 86,238,
-217,179,103,208,160, 65,131,110,251,250,250,186,103,103,103,123, 20, 20, 20,176,121,121,121, 66,148,212,181,162,  0,224,236,217,
-179,208,104, 52, 12,203,178, 23, 80,210, 23,150,201,210,132, 54,105,210,196,177, 83,167, 78, 33, 74,165, 18,133,133,133,112,117,
-117, 69,135, 14, 29, 66,132, 66,225, 15,201,201,201,133, 13,121,215,135,135,135,219, 19, 66,158, 39,132, 96,208,160, 65, 22,109,
-195,178,236,212,161, 67,135, 74, 40,138,130, 94,175,131, 92,110,  3, 91, 91, 59,216,219, 59,192,223, 63,  0, 42,149, 10,  3,  7,
- 14, 52, 37, 36, 36,124,175, 86,171, 15,212,162,  5,149, 74,133,236,236,108,164,164,164, 32, 39, 39,  7,  0,144,147,147, 83, 94,
- 57,191, 33, 40, 44, 44, 28,222,189,123,247,121, 51,103,206,  4,195, 48, 24, 62,124, 56, 82, 83, 83, 87, 63,122,244,104,191,151,
-151,215,132,169, 83,167, 42, 93, 93, 93, 49,111,222, 60, 27,  0,159,240,249, 33, 15, 15, 15, 79,131,243,120, 29,173, 39, 35, 90,
- 53,149,137,122,120,120,244,162, 40,234, 35,189, 94, 47, 45, 43,146,161, 40, 74,170, 84, 42,143,235,245,250, 21,106,181,218,170,
- 74,113,  5,  5,  5,154,135, 15, 31, 30,143,138,138, 26, 59,106,212, 40,132,135,135, 79,  6,128, 81,163, 70, 33, 42, 42, 10, 15,
- 31, 62, 60, 94, 80, 80,208, 32,  3,144,122,123,123, 15,238,211,167,207,168,206,157, 59, 35, 44, 44, 12, 44,203, 94,178,102,251,
-138, 45, 12, 81, 69,171,195,178,101, 22,137,  9,133,160, 40,170, 60,154,145,147,157,141,248,184, 56,228,229,231,195,104, 48, 64,
-171,211,177,254,205,154,233, 11, 77, 38, 49,  5, 88, 91,246,149,124,253,234,229, 20,157, 86,235,238,234,236,162, 87, 40,100, 40,
-208, 20, 74,174, 93,189, 92, 12, 32,193, 66, 13, 19, 33,164,207,175,191,254,186, 68, 40, 20,142,179,179,179,195,172, 89,179,132,
- 33, 33, 33,144, 72, 36, 48, 26,141, 40, 40, 40,192,238,221,187,179, 89,150,245, 43,221,198, 78,161, 80,236, 16, 10,133,105, 69,
- 69, 69, 31,213,186,  3,147,105, 72,104,104,168,200,100, 50,225,179,207, 62,195,210,165, 75, 49,104,208, 32,209,213,171, 87,135,
-  0,216,211, 80,119, 60,199,113, 24, 48, 96, 64,197,202,240,247, 44,217, 78, 44, 22,183,109,217,178, 37,178,179,179,145,157,157,
- 13,165, 82,  9, 47, 47, 47,120,120,120, 96,245,234,213,100,253,250,245,167,204,102,243,247, 57, 57, 57,153,150,164, 33, 49, 49,
-177, 60, 50,104, 48, 24,160,213,106,145,154,154, 90, 94,116,168,183,117, 24, 52,123,202,176, 96,173, 94,175,187,114,231,126,202,
- 71,239, 76,232,166,213,235,117,247, 31,165,196,  3,223,112, 22,220,223,211, 38, 79,158, 60,109,236,216,177, 40, 46, 46, 70, 84,
- 84, 20,122,244,232,129, 47,191,252,210,243,194,133, 11,239,117,238,220, 25, 98,177, 24,231,206,157,  3,195, 48,169,124, 94,200,
-195,195,243, 95,230, 41,173,159, 85, 35, 53, 70,180,124,124,124,156, 88,150, 93, 48,116,232,208,  1, 35, 70,140,192,192,129,  3,
- 43,253,190,103,207, 30,251,195,135, 15,175,248,230,155,111,  6,153,205,230,149,214, 20,245,113, 28,119,116,207,158, 61, 67,186,
-117,235,166,232,219,183,111,115,  0,144,201,100,166, 61,123,246,232, 56,142, 59, 90,135, 99, 41,235,136, 49, 19,  0,188,188,188,
-218,139, 68,162, 81,131,  7, 15,110, 63,101,202, 20, 68, 71, 71, 99,247,238,221, 15,252,253,253, 35, 51, 51,173,170, 95,157, 84,
- 75,171,195, 21,181, 69,183,132, 82,105,110, 65, 70,134,147,157,175,175,216,217,222, 94, 29, 22, 22,230,211,191,127,127, 42, 53,
- 53, 21,249,249,249, 48, 24, 12,184,122,245, 42, 39,  2,146, 69,206,206, 84,114, 84, 20, 37,148, 74,115, 81,185, 37, 95,173,248,
-120, 58,183,250,120,209,140,166,  6,163, 33,168,176,176,144, 17,137,197,226,198, 30, 78,169,113,  9, 86,149,196, 25, 21, 10, 69,
- 39,  0, 34,142,227,116, 46, 46, 46,138, 51,103,206, 64, 42,149,130,162, 40,180,107,215, 14,114,185, 92, 66,  8, 73,  1,  0,123,
-123,123,233,230,205,155, 29, 39, 76,152,112,177, 54,225,142, 29, 59,138,101, 50,217, 75,254,254,254,136,138,138,194,221,187,119,
-147,163,162,162,154,116,236,216, 17,190,190,190, 47,121,122,122, 30,188,113,227,  6,221, 16, 55,118, 73,139, 85,235, 43,195,179,
- 44,203, 81, 20,  5,129, 64,  0,142,227,144,157,157, 13, 63, 63, 63,108,216,176,  1,235,214,173,251, 76,173, 86,255,108,133, 22,
-171,209,104, 96,107,107,139,187,119,239, 26,135, 14, 29, 42, 19,  8,  4,120,240,224, 65,185,209,114,119,115,105,211,163,115,219,
-214,159,173,221,121,218, 86, 38,147, 13, 12,233, 20, 24,115, 63, 57,141, 16,170,214, 98,227,192,192, 64,137,159,159,223,228,177,
- 99,199, 34, 49, 49, 17, 43, 86,172,200, 81,171,213,103, 79,159, 62, 61,122,230,204,153,194, 30, 61,122, 32, 55, 55, 23, 63,253,
-244, 19,115,237,218,181, 31, 51, 50, 50,118,242,217, 56, 15, 15, 15,207,127,196,104,249,248,248,140,149, 72, 36,243,198,143, 31,
- 47, 12,  8,  8, 64,102,102, 38, 28, 28, 28,104,138,162,196,  0,224,228,228, 68,219,216,216, 96,198,140, 25,  8, 14, 14,238,181,
-112,225,194, 30, 34,145,104,131, 74,165,218, 97,201,142,179,178,178,116,  2,129,224,208,172, 89,179, 86,222,188,121,195, 15,  0,
-254,252,243,207,135, 42,149,106, 81, 86, 86,150,206,202,227, 40,235, 20,147,146,201,228, 87, 90,181,106,245,168, 83,167, 78, 14,
- 35, 70,140,128, 82,169,196,245,235,215,177,106,213,170,251, 38,147,105,201,249,243,231,153,127,250, 36, 51, 70, 99,198,181, 99,
-199,236, 67, 94,125,213, 97,206,208,161, 95,191, 53,107,214,154,143, 63,254, 88, 20, 16, 16, 64,233,116, 58, 92,185,114,133, 28,
- 62,124,152,254,233,211, 79,215,193,214, 86, 28,117,248,176,212,100, 50, 37, 91, 25,185,235,211,179,119,175,128,175,215,124,  3,
-131,190, 24, 87, 46,157, 64,126,126, 54, 54,111, 57, 18,224,237, 77,250,164,167,167,159,183, 84,139,162, 40,255,240,240,112,119,
- 66,  8,164, 82, 41,150, 47, 95, 14, 47, 47, 47, 56, 56, 56,160,168,168,  8,239,189,247,158,227,187,239,190,235,  8,  0,209,209,
-209,229,221, 51,212,134, 74,165,234, 62, 99,198, 12,123,134, 97,112,234,212, 41, 19, 69, 81, 31, 69, 68, 68,252,208,174, 93, 59,
-105,175, 94,189,236,119,238,220,217,  3,192,185,134, 50, 90,117,220,238,193,153, 51,103, 58,143, 27, 55,142,136,197, 98,170,160,
-160,  0, 78, 78, 78,216,176, 97,131, 86,173, 86,159,176, 82,107,249,162, 69,139,150,148,126,222,254,209, 71, 31,189,177,114,229,
- 74,101, 70, 70, 70,121, 84, 51, 43, 39,239,247,238, 67,223,102,115, 11, 10, 77, 63,174, 93, 56,198, 70, 46,147,126,180,242,199,
-115,180, 16,151,107,189,175, 24, 70,170, 80, 40,164,132, 16, 28, 58,116,  8,201,201,201, 83,115,115,115, 51, 88,150, 61,178, 96,
-193,130,249,  1,  1,  1,205,226,226,226,146,139,138,138,190,204,202,202,122,196,103,119, 60, 60, 60, 60,127, 27,101,149,224,203,
- 90, 31,158, 64, 73,113, 98,245, 70,139,101,217, 25,167, 79,159, 22,114, 28,135, 45, 91,182,224,218,181,107, 68,161, 80,124,164,
- 80, 40,190,179,177,177, 97,245,122,253,244, 55,223,124,115,194,210,165, 75,  5,189,122,245, 66, 84, 84,148,192,207,207,111, 50,
-128,138, 70,171, 63,106,232,107,163,176,176,240,106,102,102,134, 95,133, 14, 42,253,100, 50,249,213, 90, 14,230,113,205,199, 59,
-197,236,186,124,249,114,173,167,167,167,233,238,221,187,216,180,105, 19,119,237,218,181,179, 82,169,116,179, 90,173, 54, 90,168,
-217, 16,148,107, 74, 25,230,250,174,249,243,  3,159, 27, 62,156,123, 99,222,188, 98,137,141,205, 59, 95,127,243,205,194,130,162,
- 34, 47, 80, 20,113,117,116, 76,222,178,124,249,138, 65, 47,189, 84, 28,125,254,188,252,102,120,184, 88, 73,211,183,172, 73,103,
-122,122,250,249,115,231, 46, 98,251,214, 53, 48,155,141, 80,167,151,248,180,156,220, 66,212, 98,178,158,208,100, 24,166,112,244,
-232,209, 18,  0, 54, 19, 39, 78,148,102,101,101,161, 69,139, 22,  0,  0,141, 70,131, 19, 39, 78,160,117,235,214,  0,128, 59,119,
-238,148,127,174, 45,157,182,182,182, 47,245,232,209,  3,201,201,201,136,142,142,254, 77,173, 86,231,  2,248, 45, 53, 53,117, 72,
-231,206,157,113,244,232,209, 97, 53, 24, 45,171,174,145,133, 70,235,  9, 77, 27, 27,155, 69, 71,142, 28,153,122,233,210,165,113,
-243,231,207, 23,191,240,194, 11,  0,128,162,162, 34, 29,  0,214, 26, 77,189, 94,191, 25, 64,121,203,217,164,164,164, 93,243,230,
-205,187, 48,119,238, 92,101, 89,250,178, 99,126,142,202,  6,162,130, 66,166,126,220,189,115, 80,192,231,235,119,159, 78, 73,205,
-220, 93,120,239,120,161, 37,199, 78,  8,  1, 77,211,224, 56, 14, 46, 46, 46,218,220,220, 92,100,101,101, 61,202,202,202,154,149,
-144,144, 96,213,177, 55,228, 61,207,107,242,154,188, 38,175,249,127,138,229, 61,195, 19, 66, 24,142,227,112,238,220, 57, 28, 57,
-114,132, 53,155,205,211,212,106,117,197,222,170,191,185,126,253,122,248,232,209,163,119,196,197,197,  9, 99, 98, 98, 64,  8, 97,
-173, 73,141,193, 96,160, 41,234,201,101,245, 61,202,237,219,183, 35, 35, 35,195,156,154,154, 26,193, 48,204,209,122,182, 94,172,
-119,171,195,237,128,241, 21,147, 41, 98,105,207,158,  3,150,132,135,203,222,248,224,  3,227,107, 83,166, 44, 96, 77, 38, 90, 40,
-145,112, 82, 91, 91,  1, 43,147,137,163,207,159,151,175,159, 57,211, 69,111, 52,158,218,109, 69,  5,243,178,136, 86, 72, 72, 47,
-188,246,198, 92,232, 43, 68,180,162,174,198,195,104,134, 85, 17, 45,163,209, 24,164, 86,171, 33,151,203, 83,  0,120, 76,154, 52,
-  9, 28,199, 65,175,215,163,168,168,  8, 42,149,170,112,202,148, 41,108,169,121, 18,141, 26, 53,202,193, 18,221,230,205,155,123,
-137,197, 98,156, 58,117, 10, 98,177,248,  4,  0,136,197,226, 19,225,225,225, 67, 94,126,249,101,120,123,123, 55, 79, 76, 76,164,
- 80, 75,253, 52,247,160,225,  7,  8,208, 10, 20, 90,150,132,224,208, 82, 25, 52,252, 54,  5,220, 47,237, 53,254, 94,199,142, 29,
-  1, 11,235,101, 85,164,180,113,199, 58,154,166, 15, 46, 92,184,112, 86,215,174, 93, 95, 92,186,116, 41,133,210,174, 26,234, 73,
-124,122,122,122,239,197,139, 23,159, 38,132, 84, 50,253, 89, 57,121,191,119, 11,157, 77, 10, 10, 10,111,102,223,251,249,142, 85,
- 17, 83,134,169, 87,119, 22, 60, 60, 60, 60, 60, 13, 22,213,122,130,106,141, 22, 69, 81, 91,250,244,233, 51, 13,128,144,162,168,
- 77, 42,149,234,137,204, 95,173, 86,199,123,121,121,125,213,172, 89,179,233,  0,  8, 69, 81, 91,172, 76, 84, 38, 33, 88, 37, 16,
- 80, 11, 75,204, 93,157, 58,168, 44, 27,150,100, 33,  0, 74, 32, 16,238,184,113,227,198,  7, 41, 41, 41,217, 22, 70, 32,106,164,
- 33, 90, 29,  2,192, 94,224,209,248,228,228,211,243,218,182,237, 63,104,230, 76,180, 31, 52,200,193,171, 73, 19, 86,111, 54,115,
-119, 34, 35,169, 75,135, 14, 73,110,134,135,139,245, 70,227,169,163, 64,138,181,233, 76, 79, 79, 63,255,251,217,243,103,198,140,
- 26,242, 98,243,102, 94, 37,166,225,145, 10, 57,121,133,103,172, 49, 89,143,153,222,225, 27, 54,108,248, 89, 34,145,136, 42, 14,
-101, 99, 54,155,243,140, 70, 99, 16,  0,228,231,231,123,109,217,178,101,159, 64, 32, 72,174, 77, 47, 38, 38,230,248,146, 37, 75,
- 70, 37, 37, 37,157, 73, 77, 77, 77,  2,128,148,148,148, 36,154,166,119,168,213,234, 81,201,201,201,135, 97, 65, 35,  0,  2,180,
-138,142, 60,216, 14,  0,130,122,142, 69,116,228, 65, 57,128,118, 65, 61,199,  2,  0,234, 58,150, 97, 69, 74,187, 65,248, 40, 42,
- 42,106,207,139, 47,190,248, 38,234,209,167,215,227,102,203,108, 54, 55,121,124, 97, 89,100,203, 26, 33,147,201, 68,235,245,122,
-134,101, 89,145,217,108, 38, 38,147,137,230,243, 57,158, 90,224,199,190,228,121,106, 33,132,116,  6,160, 44,203, 54, 75,231,202,
-199, 62,155, 80, 58, 92, 96, 89, 86, 89,250, 61,155,162,168,171, 21, 52,202,151, 91,176, 45,  0,228,  0,184, 77, 81, 84,117, 65,
-144, 45,213,125,175,214,104,169, 84,170,195,176, 96,208,104, 75,215,171,129,197,165,227,196,  1,117, 31,135,173, 92,131,101,217,
-204,148,148,148,122, 95, 80,129, 64,240,104,216,176, 97, 86,173, 95,219, 58,251,129,228,183,141,198,157, 97,223,126,219,225,212,
-166, 77,222, 44,195,184, 82,  0, 17, 74,165,185, 38,147, 41, 73, 73,211,183,172,141,100, 85,138,198, 60, 76, 31,152,248, 48, 29,
- 45, 91,182, 36, 15, 30, 60,104,136, 76,245,150, 86,171,245,169,237, 22,208,233,116,189, 44, 52,131,123,211,211,211,247, 86, 97,
-216,247,169,213,234,125, 86, 60, 41,238,151,154, 42,  1, 71,113, 99,130,122,142, 61,  4,128, 43, 27, 84,186, 33,201,200,200,136,
- 67,105, 63,111,255, 53,146,147,147,141, 20, 69,237, 90,181,106,213,196,155, 55,111,238, 87,169, 84, 70, 62, 43,230,225,225,121,
-150, 77, 22, 69, 81, 97,165,223, 67, 75,131, 66, 97,143,127, 46, 91,167,108,189,138,235,148,105, 60,190,188,166,109,  1, 96,209,
-162, 69, 31,172, 88,177, 66,  1,192,210,193,152,235, 60,168,244,223, 69,230,127, 68,163,162, 41,216,250,119, 28,232,183,128,  9,
- 12,115, 25, 76,133, 58,249,116,195,  6, 34, 30, 60,120,240, 76,191,181,150, 13, 42, 93,129,182,255,175,153, 79, 82, 82,210,  6,
- 95, 95,223,205, 42,149,138,  1, 15,143,  5,207, 43,254, 20,240, 60,165, 40,171, 50, 70,213,152,178,208,154,126,175,244,226, 94,
-197,122, 85,125,167, 40, 42,108,197,138, 21,161, 86,164,183, 60,162, 37,224,175, 29, 15,207,211,205,191,209,146,150,135,135,135,
-231,153,120,243,120, 44,138, 85,102,190, 30,255,190,104,209,162, 15, 80,115,137,147, 39, 74,162, 88,158,165,223,203,235,107, 81,
- 40,105, 57, 80, 21,214,180, 38,232, 95,135,227,139,224, 53,121, 77, 94,147,215,228, 53,121, 77, 94,243,255, 78,179, 54,237,136,
- 42, 12,209,208,234,138,250,106, 42, 70,124,252,115,109,219,214,182, 46, 69, 81,213,117,243, 83, 86, 84,248,248,252,111,167, 63,
-175,201,107,242,154,188, 38,175,201,107,242,154,188,102,125, 32,132,116, 38,132, 12, 69, 73,241, 55, 33,132, 12, 37,132, 12, 90,
-180,104,209,226,178,101,139, 22, 45, 90, 76,  8,121,161,108,189,210,117,202,183, 41, 91,246,248,252,241,101, 53,173, 91, 67, 18,
-167, 61,246,185,252,251,127,165,142, 22, 15, 15, 15, 15, 15, 15, 15, 79,149,148,181, 24,172, 16,109,202,  6,112,103,197,138, 21,
-249, 21,234, 78,101,  3,184,  5, 32,184,116,189,236, 82,147, 86,177,110,149,169,244,187,169,138,117, 76,150,172, 91, 13, 91,170,
-249,204, 27,173,234,  8,246, 16,124,234,219,216,189, 83,233,  5,  0, 41, 29,  4,152, 43,237,175,136,148,117, 92,196,113, 32,132,
- 64,149, 85,112,253, 78, 22, 62,174,235,254,252,189,224,226, 46,151,175,227,  8,233, 89,186,232,124, 97,174,113,110,180,  6,  5,
-150,106,180,110,132, 64,185,  0, 11, 56,130,246,  0, 32,160,112,219,192,225,171,216, 76,235,251,147,170,234, 62, 15, 82, 98,154,
-212, 70, 49,222,209,201,185,101,126,126,206,125,179,193,120, 48, 38, 27,155, 81,135, 10,182,205,157,241, 60, 71,240,  1,  0,129,
- 88,128,213,247,243, 44,110,201,193,195,195,195, 83,223,232, 72,189,250,197,163, 40,138,173, 66,147,170,167, 38,223, 80,193,  2,
-179, 85,197,226, 63,171, 88,118,245,191,148,110,171,140, 86, 27, 37,102,130,194, 50,  0,  4,  4,159,196,100, 99,163, 85,219,123,
-162,191, 92, 40,220,  6, 64,104, 48,179,243,  8,135, 11, 85,158, 76,  1,122,203, 37,194,213,  0, 56,  3,203,190, 30,163,182,188,
-190, 88,144, 55,  6,137, 56,193, 46,142, 16, 49,203,145, 29, 32,  8,179,147,224,143,203,233, 48, 88,147, 86,223,198,238,157,142,
-253,169,126,241,236,198, 57,232,218,190,  5,  8,203,  0, 28, 13, 69,175,  5,248,109,237, 36,116, 13,244,  5,225,104,128, 99, 96,
- 55,248,107, 12,110,235, 72,238,100,213,109, 28,108,127, 47,184, 52,113,115,191,187,117,235, 54, 15,175,230,109, 40,142, 49, 35,
-238,207, 51, 19,222, 93,184,164, 95, 16, 10,219, 90, 98,182,218,123,226, 13,223,166,  1, 11,230, 46, 91, 35,244,244,242,177,229,
-104, 35,147,241,232, 94,199,111,190, 92,114, 88, 34, 72, 94,125, 91,141,109,150,222,203,109,148,152, 46,146, 73,199,218,200,109,
- 91,234,116, 69, 15, 88, 51,125, 80, 32, 22, 13,250,234,235,117, 29, 66,  6, 12,177, 99,139, 50,  4, 52,135, 54,  7,246,239,107,
-242,237,134,239,135,220, 85,179, 47,  1,224,172, 57,102,142, 96, 97,252,206,105, 67,196, 34, 33, 21, 56,117,171, 16, 96,234,100,
-180,  2,221,241, 10, 69, 80,107,247, 18,132,194,197,123, 89,216, 91,151,125,180,118,199, 15, 20,129, 63, 40, 28,162,  8,246,197,
-100, 35,139,207,242,120,120,158, 45,  4,  2,193, 89,142,227,250, 54,176, 49,120,158, 16,114,153, 63,187,255,223, 88, 23,209,162,
-240, 89,116, 66,170, 51, 88, 51,130,252,155,127, 10, 88,103,180,228, 66,225,142,171,247, 51, 61,192,152,177,245,243, 89,251, 77,
- 52,192,208,102,176, 12, 13,150,161,193, 48,102,176, 52, 13, 66, 27,177,228,199,179,128,169,  8,157,218,182,218,  1,176,158,150,
-238, 67, 76,  4,187,174, 71,158,113,161, 76,133,216,187,113,197,219,169,217,197,111, 71,220, 86,229,180,113,215, 47,142,201,194,
- 79,214, 24,130,179,155,230, 96,247,209, 19,105,235,127,208,198,114,132,192,197,193, 38, 96, 66,104,180,207,206,227,103, 83,215,
-237, 48,196,  2,128,163,173, 52, 96,242,237,251,190,245,185,  8,238,114,249,186,205,223,127,235,225,233,106, 67, 49,151, 86,130,
- 97, 89,248, 52, 25, 42, 92, 60,123,130,231,103,107,183,173,133,198,248, 90, 77,219,  7,184,163, 77,211,102,129,243,118,156,184,
-228,171,213,100,153,206,236,249, 32,  1, 70,208, 30,222,129,226, 79, 87,172, 17,126,248,254,156,247, 76,108,218,149,184, 44,196,
-212,150,215,  4,186,227,248,138,149, 95,183,239, 55, 56,212,142, 43,206, 22, 26,180,197,254, 91,127,220,182,172,117,251, 46,138,
- 94,109, 27, 75,178, 14,206,160,244, 69,121, 48, 11,228,178,126, 65,253, 29,244, 19, 95,166,183,110,223, 61, 59, 38, 11,223, 88,
-115,204, 44,249,235,222,227,184,186,247,186, 78, 17,244,186,121,249,236,116, 86,117, 21,132,165,  1,214, 92, 62,  7, 75,131,112,
- 37,243,174, 51,126,  4, 80, 55,163, 37, 32,120, 49, 34,242,170,103,102,134,186,243,218,175,191, 88, 76,174, 94,253, 21, 44,118,
-221,203,195,121,107, 13, 38,  0,127, 63, 87,225,105,154,133, 49,181,128,245, 47, 91,216,207, 95,214,221,211,142,122, 33,165,144,
-186,112, 49, 65,127,158,207,154,120,120,254,149,136,  9, 67,  8, 17, 53,176,230, 16, 66,200,201,122,202, 44,  0,240, 70,233,231,
-109,  0,190,106,128,164, 53,  6,224, 81,250, 57,  3, 64, 26,127,  7,212,139,199, 43,191,215,185, 31, 45, 57,  8,  7, 28, 26,  1,
-  0, 54,214,166,130,  0,114, 80, 66,128,214, 98,248,224,  1,112,115,247,  0,104, 29, 96,214,  1,180, 30,160,181,  0,173, 71,142,
- 58, 25, 48,107,129,196, 95,193, 16, 34,179,250,112,141,133, 64,252, 65,188,208,209, 23, 74, 71, 57,230, 12,111,227,182,229, 84,
-252,182,109,103,226,250,199,100, 97,188, 69,105, 37,  4, 93,219,181,196,250,109,218,216, 95,110,100, 15,  4,128, 33,193,174,167,
-186,182,105,226,179,110,135, 33,246,228,157,252, 65,  0, 48, 40,200,225,215, 46,  1,158,190, 92, 61,186,167,225,  8,233,229,213,
-180, 37,197,222,220, 12, 78,147,  6,141, 70,143,180, 71, 59,225,236,253,156,128,229,208,167,182,237,109,132, 88,244,206,135,171,
-196, 58, 77,166,137, 51,103,179, 74, 97,190, 80, 36,229, 40,164,159, 55, 22,115,  5,236,220,105,147,152,121, 31,127,190,  8,192,
-132,154,116,218,184, 99,246,234,213,235,218,245,232,212,218, 61,227,240, 28,170, 56, 63, 19,140, 80, 33, 27,222,173,  7,156, 90,
-181,225, 50,207,173,166,164,205,251,195,201,181, 57,210, 47,237, 65,210,229, 35, 84,207,142,163,100, 63,237,149, 76,  4,204, 85,
- 26,173,150,110,232, 57,176,119,151,253,205,125,189, 60,  9,225,192,113,  4,132, 99, 81,108,160,177,248, 64, 34, 88,150,197,232,
-129, 61, 95,176,149, 82,132,227, 56, 16,194, 33, 53, 35, 87,247,251,149,216, 23, 18,243,113,197,146, 72, 85,240,243,125,123,222,
-190,126,185, 53, 29,255, 11, 58, 77, 88, 17, 75,  1,145, 21,238,185,158, 55, 78,255,212, 26,248,177,238, 94,142,  2,155,116,106,
- 37,124,123, 79, 19,110,222,123, 74, 89,152,157, 62,249,240,206,239,199,108,220,188,121,119,108, 22,102, 88, 99,178,222,237, 45,
-141, 92,251,187,198,181, 91,115,219,236,212, 10,113, 74, 63,103,193,192, 77, 39, 99,222,137, 90,222,181,245,135, 39, 72,193,133,
-  4,195, 29, 62,223,226,225,249,103, 33,132, 52,184,217, 74, 78, 78, 86,213,199,108,121,123,123,247, 78, 79, 79,255,178,172,182,
- 10, 69, 81, 95, 54,109,218,116,201, 95, 47,170,149,222,245, 10, 89,150,157,144,158,158,126,161, 38,205,161, 67,135,122,157, 56,
-113,162, 89,  5,205,102,  0,154, 85,181,174,147,147, 19,219,189,123,247,164, 19, 39, 78,168,248, 59,164, 78,134,203,106,163, 21,
-155,114,112, 78, 71,163,186, 24,  0, 98, 45, 88,191, 82,145,159,129,102, 87,110, 95, 54,105,101, 80, 83, 23, 20,105, 77, 56,115,
- 45,  9, 44, 75,131,101,152,210,200, 22,  3,150,161, 49, 48,216, 13,221, 13, 51,240, 77, 88, 28, 24,150, 91, 81,147,230,227,152,
-  9,247, 74,135,254,227, 14,112, 28,145,202,196,130, 66,127, 31, 87,247,121,163,131,  5,115,134,  7, 65,111,102,198,237, 57,151,
-240,251,189, 44,108,181, 72,147,123,178,123, 34, 82,213, 50,150,169,245,216,107,136, 70,117,237, 31,210,203,129, 24, 11, 65,231,
- 36,162, 72, 71, 35, 49,151, 70,134,161,  0, 50, 74,109,145, 38, 71,208,190,177,183,167,226,143,253,239, 63,114, 21,106, 68,238,
- 66, 70, 34, 21, 48, 96, 57, 34, 36,  5, 49, 70,151,214,  3,196,101,245,182,106, 74,167,141,194,126, 82,239, 23,135, 58,166,236,
-153, 70,217,248, 15,132,123, 71, 31, 60,186,176, 29, 89,215,194,144,171, 74,162, 28, 12,  5,104,228,218,  2,131, 39,140,199, 87,
-227, 59,163, 72, 83,  4,161, 58,193, 81, 42,150, 57,  1,230, 42, 53,  9,139,  9,171, 87,125,238, 41, 18, 10, 74,206,103,217,196,
-210,208, 27,141,  0,203, 64, 46,226, 64,145,178,223,104,176,180, 89,209,126,212,251,179,  0,246, 74,109,199,126, 47, 11,123,219,
- 40,209, 11, 28,221,154,208,122, 80, 64,100, 76,246, 95,230, 39,208, 29,175, 60, 55,112, 74, 47, 66,225, 98, 93,174, 81, 91, 87,
-132,118,106,102,103,107,171,137, 69,218,161,183,145,  0, 57,105,212,227, 13,188, 50,117,182, 98,203,150, 45,195,  0, 50, 19,149,
-235,168,149,107,182,110, 36,156, 78,179, 88,  2,  0,122,154,108,183,151, 82, 83, 87,239,139,114,133,240,175, 17, 30,202, 34, 89,
-  9,185, 92,190,249,236, 71,113,207,207, 11, 11,105,119, 51, 36,149,162,100, 41,231, 31, 24, 11,173,185,151,172,132,215,228, 53,
-255,118, 77,  7,  7,  7,191,166, 77,155, 46,161,105,186,183, 68, 34,105,100, 54,155,193,113, 92,134, 84, 42,189,152,148,148,180,
- 92,163,209, 60,252,175, 29,251,237,219,183,173, 49, 91,181,106,138,197, 98,196,197,197, 61,176,194,108, 69, 60,182,253,174,200,
-200, 72, 28, 56,112,  0,  0, 16, 31, 31,143, 86,173, 90,217, 86,181,225,163, 71,143,108, 67, 66, 66,118,  1,240,169, 73,243,206,
-157, 59,126,191,252,242, 11, 14, 29, 58,  4,  0,136,139,139,131,191,191,127,149,137,137,140,140, 20,190,250,234,171,126,  0, 84,
-255,192, 53,122, 22, 76, 86,197,249, 95, 70, 43, 44, 44,140,132,134,134, 82,143,127,174,130, 68, 95,103,105, 71, 24, 88,  0, 72,
-180, 54,  5,247, 50,177,106,253,206,211,131,126, 59,180,161,183, 92, 34,192,210,173,243, 82,179,243,138,158, 23, 81, 37,197, 47,
- 12,129,192,217, 78, 26,181, 98,114,176,111,126,177,  1, 63,255,153,126, 33, 38,203,186, 16,105,140, 26,225,  0,231, 84,242,141,
-133, 65,159,229, 63,249,171,240,125,251, 22, 13,106, 63,119,120,123, 28,191,148, 52, 23, 96,106,237,245,157,112, 28,  8,199,148,
- 87,126, 47,125,117,  0,184,202,  3,248,114, 32, 37,203, 56,235, 34, 90,125,  0, 81,190, 59,  6,219, 43,164,223, 77,159,254,166,
-  3,157,125, 31,121, 38,  9, 82,243, 13,200,208,139, 81, 44,114, 71,122,236, 29, 86, 64, 33,188,214,144, 11,  5, 13, 97, 12, 78,
-206, 82, 59, 65,219,  1,179,188, 53,167, 62,200,151, 82,140,208, 97,228,103, 78, 57,191,173, 73, 98,180,217, 90,138, 66,173,221,
-207, 59, 58, 58,181, 50,228, 38,  9, 11,243,115,224,228, 17,132, 65,227, 66,241,201,208, 54, 40,210,104,145,157, 23, 69, 90,122,
- 58, 80,201, 23,119,227,195,193,129,200,205, 84,195, 72,  3,148,214,152,103, 48, 25,138,171, 61,143,  2,108,126,119,254,194, 87,
-154,120, 42,109,203, 26, 21, 16,142, 69,112, 96,115, 12,232,221, 21,225,145,127,224,234,157,120,112,165,141, 10,  8,199, 33, 45,
- 43, 63,211, 96,102,183, 91,117, 66, 89,  6,132, 54, 84,105,196, 80,135, 34,195,182,238, 80,176,192,199,157,253,236, 95, 95, 20,
-218,196,222, 86, 70,193, 64,179, 48,152,104, 20,253,241, 29, 92,155,182,131, 66, 46,167, 58, 66, 47,186,129,170,207,173,129,198,
-146,135,234,  2, 79, 20,103,224,213,  1, 65,239,236, 88,241,150, 45, 37, 47,185, 53,105,182,114, 36,235,143,101,157, 79,191,250,
-233,177,179,  7, 14,190,236,245,213,130, 73, 33,  3,223,219,126, 22,192, 41, 62,223,226,121, 26, 25, 51,102,140, 60, 51, 51,243,
-156,143,143, 79,155,  1,  3,  6, 40,122,245,234,  5,173, 86,139, 51,103,206, 64,171,213, 54,241,241,241,105,114,230,204,153, 81,
- 41, 41, 41, 49,141, 27, 55, 14, 57,116,232,144,197,117,104, 75, 13,144,176, 60, 11,  6, 24,138,162, 80,186,140, 42, 93, 86,231,
-113,110,165, 82, 41,146,147,147, 27, 60,178,149,158,158,254,160, 46,145,173,226,226, 98,137,183,183, 55,148, 74, 37, 88,150,133,
- 86,171,197,177, 99,199, 80, 88, 88,  8,142,227, 96, 99, 99,131,207, 86,111, 69,236,141,115,184,114,229, 10, 10, 11, 11, 37,181,
-105,166,165,165, 81,193,193,193, 48, 26,141, 96, 24,  6,  6,131,  1, 17, 17, 17,229,223, 69, 34, 17, 22,126,186, 22,241,215,206,
-225,230,205,155, 72, 75, 75,251, 71, 70, 27,177,194,139,252, 23,169,182,207,172,127,188,213, 33,203, 50,139,183,236,216, 23,181,
-120,198,120,204,126,185,191,207,242, 13, 71,250,223,203,193, 14,  0,  8,116,195,228,137,125, 91,250, 58, 41,196,248,100,207, 53,
-128,144,197,245,221, 95,116, 30,226,219, 52,226,230, 30,189,146,124,238,131,241, 29,209,220,211,161, 85,190, 52, 79,154,152,104,
-193,152,130, 28,  3,103, 59, 89,192,144, 96,215, 83,224, 56, 56,217,203, 90,131,101,224,100, 39, 11, 24, 20,228,240, 43,  0, 56,
- 40,196,173,171,138,124, 85, 71, 39, 31,241, 52,133, 76, 52,205,214,222,201,247,181, 97,  3,108,134, 12, 27,101, 99, 39,102,144,
-123,229, 12, 52,226,198,160, 93,154,192, 72,231, 33,237, 97,  2,251,219,229,123,233, 57, 69,198,121,181, 38,147,224, 66,250,195,
- 56,165, 95,251,  1,206, 57, 97, 31,102,249, 77,217,211, 76,  0, 78, 80,180,123,100,166,173,123, 23,155, 63, 19, 31, 22,115,164,
-202,136, 78, 37, 52,133,133, 73, 52, 11, 79, 61, 43,178, 79, 56,251, 19, 22, 13,110,135,252,188, 44, 24,204, 12, 10,245,140,217,
-195, 73, 46, 51, 62,188, 11,163,153,129,137,230, 32,118,242,198,153,168, 59, 57, 28, 77,255, 90,157,102, 98, 46,110, 38, 30,187,
-105, 87,113, 89,115, 55,  4,191,239, 96,115, 19,180, 30,201,105, 42,236, 56, 17,213, 49, 49, 23, 55,235,115,157,  9,199,148, 20,
- 63, 87,136,100, 81,  4,189,234, 82,  9,190,181, 59,186, 72,228,146,111,191,156,251,106,155,110,254, 46, 50, 46, 45, 10, 20,103,
-134, 45, 43,130, 94,202,194,209,167, 57, 56, 83, 17,209, 25, 12,  5,209, 64, 77, 23, 95,  8,  0,196,172,197, 87,147,130,108, 41,
-231,230, 96, 19, 79, 65,212, 97, 26,232,210,104,127, 66, 46,119,199,124,246,163,216,238,243,127,233,243,105,120,223,123,170, 19,
- 75,239,121,143,249, 46, 24,216,222,148,127, 92,243, 60,141,  4,  4,  4,120,164,167,167, 71,207,159, 63,223,101,228,200,145, 56,
-122,244, 40, 52, 26, 13,182,111,223,142,117,235,214, 97,217,178,101,160,105, 26, 91,182,108, 81, 28, 62,124,184,203,247,223,127,
-159,230,235,235, 27,148,146,146,146, 81,139,193,162,  0,200,  0,136, 75,159, 93, 20,  0,238,228,201,147, 24, 50,100,  8, 78,158,
- 60,201,149, 46, 99, 81,242,242, 83,167,177, 63,165, 82, 41,164, 82, 41, 10, 11, 11, 27,196,108,137,197, 98,216,217,217, 65, 42,
-149,162,168,168,200,106,179,197, 48,140, 48, 45, 45, 13,133,133,133, 24, 48,108, 24,214,174, 88,129,190,125,251, 98,192,128,  1,
- 32,132, 32, 34, 34,  2,253,123,180,197,248,151, 66,112,239,222, 61, 48, 12, 99, 81,122, 51, 50, 50,144,153,153,137, 65,195,134,
- 97,235,247,223,163,107,215,174,  8,  8,  8,  0,195, 48, 56,119,238, 28,198, 12,236,  1,249,136,254,136,143,143,231,111,106,203,
-163, 89, 13, 82, 71,171,222, 68,103,227, 50,119,252,124,216,203,  3,187,132, 14,235,217,  6, 91,247,255,246, 57,148,154,125,  0,
-224,106,148,125, 54,169,111,115,196,164,228,227,183,155,170,176,123, 57,104,144,214, 26, 28, 11, 55, 87,  7,  5, 32,148, 66,111,
-230, 24,135,196,218, 43, 48,115,132, 64,209,251,125, 76, 28, 22,227,211,181,141,143, 79, 89,171, 67,187, 33,107, 48,249,206,  3,
-223,206,  1, 30,190, 96,105,128,165,225, 48,126, 15,240,169,109,173,233,232,209, 76, 26,254,238,156, 57,221,  7,143, 24,103, 35,
- 85, 56,130,213,164,130,206,184,131,220,251, 23,160, 85,180, 66, 70,114, 34, 14,156,190, 82,120, 63, 45, 87, 35, 16,224, 76,102,
-161,113, 65, 98, 62,138,107,211, 53,208, 88,177,228,195,121, 67, 15,236,219,111, 47,107,222,147, 74,248,110, 72,161, 84,196,200,
-148,205,158, 19,232,228,110,228,139,237,251, 29,180, 38,172,172, 77, 71,167,213, 28,137, 56,115,106,124, 75,191,158,246,143,174,
-158,128,222, 96,132,145,  6,130,186,132,128,101,137,148, 18, 80,156,131, 80, 72,101,229,230,131,162,217,204,139,183, 30,169, 35,
-111, 37, 10,141,246, 88, 89, 99,239, 34,143,187,123, 74,248,206,176,144, 14,  0,173,199, 75,189,219, 97,237,238,223,222,  6,216,
- 41,245,187,200, 37, 17, 45,  2,244,108,163,196, 38, 66,208,243,218,177,117,173, 59,141,120, 23,214, 68,180,130,220, 48, 56,208,
-207,235,167,181,159,189,239,226,218,184,149,144,226,104, 16,143,246,128, 38,141, 80,105, 81,112,244,238, 10,214,171,  7,182,124,
-243,117, 49,199,145,125,168,161,107, 11,150,  3,184,148,243, 96, 99,143, 34, 49, 49, 17,110, 77,174,  1,148,  0,164,233, 35,152,
-153,146,205,140,102,114, 98,253,246, 95,250, 46,232,183, 34,104, 88,107,145,111,212,173,132,172,113, 83,189, 20,207,251, 10,253,
- 99,212,182,130, 28,173,150,227,243, 47,158,167,  9,131,193,112,100,213,170, 85, 46,161,161,161,101, 17, 25, 68, 69, 69, 97,219,
-182,109,176,181,173,156, 79, 14, 25, 50,  4,132, 16,151,165, 75,151, 30,  1,208,173, 58,205,238,221,187, 15,187,121,243,166,170,
- 67,135, 14,137,165,102, 75,  2, 64,112,247,238, 93, 65,106,106, 42,229,236,236, 76,188,188,188,104,149, 74,197,  1, 96,167, 78,
-157, 42, 60,120,240, 96, 75,173, 86,123,190,174, 70, 75, 42,149, 54, 72,157, 45,177, 88, 12,138,162, 32,149, 74, 33,145, 72, 64,
-  8,177,202,108,177, 44, 43, 58,121,242, 36,174, 93,187,134,101, 29, 58, 96,174,183, 55, 92, 92, 92,112,238,220, 57, 16, 66, 96,
-107,107,139,188,188, 60,236,219,183, 15,253,250,245,  3,195, 48, 18, 75,116, 15, 29, 58,132,235,215,175,227,211, 78,157, 48,215,
-209, 17,118,118,118,136,136, 40, 41, 13,148,201,100, 72, 78, 78, 70, 68, 68,  4, 66, 66, 66,248,155,186,158, 88,124,243,244,  1,
- 68,121, 20, 60,204, 38, 61,  8, 67,  0, 10, 94,129,129,144,220,187, 87,185,114,142, 37,  8,  4,248,240,155, 29, 97, 67,215,188,
- 59,140,154, 54,188,163,215,242,159,206,206,  4,128,215, 71,251,123, 43,100, 34,172, 63, 30, 67,  4,  2,124,216, 16,  7, 24, 24,
-  8,  9,149,139,153,  3,186,  6, 64, 85, 96, 66,130,170,224,247,123,128, 69,163, 56,255,182,102, 34,118,254,124, 46,117,221, 78,
- 67, 44, 33,  4, 78,118,178,128,201,183, 19,124,127, 58,121, 61,101,245,  1, 67, 44,225,  8,156, 20,226,214, 83,238,245,168,181,
-213, 97, 39, 31,241,180,247,230,205,235, 49,124,202,124, 57, 19,123, 16,166,132,211,224,204,122,104,204, 18, 20,  8, 61,144,150,
-146,130, 47,182,132,165,106,180,166,241,209,217,214, 25,204,251,185, 40, 22, 81,154,145, 95,124,242, 65,248,138,207,150,218,233,
- 19,207, 21, 11, 41, 70, 47,108,218, 71,244,217,178, 53, 84,145,209, 52, 46, 49, 31, 69,181,233, 24,237,177,114,213,234,111,134,
-190, 57, 97, 84,172,127,171, 62,174,172,234,161,171, 65,163,201,218,115,234,186, 71,233,155, 34,  5,  0,  9,105,185,200, 46,212,
- 50, 44, 67,159,183, 23, 99, 63,250, 14, 83,  0,  0, 32,  0, 73, 68, 65, 84,121,140, 37,209,193, 82,252,220,161, 12,237, 25,244,
-170,210, 94,  2,125,113,  1,220,237,197, 24,216,181,197,171,244,159,241,239, 63,204,178,198,174, 61,110,180,104, 16, 90,143,203,
- 43,251,181, 38, 44,221, 26, 44, 13,243,237, 93,214, 71,198, 40,204,157,221,219,206,193,217,244, 72,  0,173, 45, 96,227,  6,202,
-161,  9,224,216,140, 18,  7,142,131, 42, 49,154,121,251,213,  9,185, 15,147,210,126,112,179,169,185, 88,155,230,  8,184,164,115,
- 40,206, 76,192, 93,149, 25, 65, 89, 37,165,237, 14,153, 55,192,242, 61,230,240, 60,163, 36, 39, 39, 79, 90,188,120,113,100,215,
-174, 93, 27,185,185,185,161, 93,187,118,248,249,231,159, 49,127,254,252,242,117, 58,116,232,  0, 66,  8,242,242,242,176,106,213,
-170, 12,149, 74, 53,169,198, 23,244,232,232,216,157, 59,119,246,110,211,166,141, 89, 34,145, 20,  0,144, 21, 20, 20,200,243,242,
-242, 40,131,193,  0,142,227, 56, 71, 71, 71, 86,165, 82,209,227,199,143, 55, 94,186,116,169,133, 86,171, 77,174, 79, 68,203,199,
-199,231,110,110,110,110, 33, 69, 81,245,238,250,161,204,100,185,185,185, 41,139,139,139, 57,  0,249,117,233,250,129, 97, 24,116,
-234,212,  9,167, 47,220,192,201,223, 46, 65,163,138,195,204, 55, 39,161, 93,187,118, 56,125,250,116,157,175, 89,112,112, 48, 78,
- 69, 68, 34,242,218, 45, 36,199,223,198,219, 51,223, 68, 80, 80, 16, 78,157,226,107, 47, 88,193,  9, 84,174,155,117,226,113,163,
- 21, 18, 22, 22, 86,150,245, 63, 97, 95, 91,187, 33, 88,236, 36,221,181,116,112,139, 64,241,128,165,160,196, 54, 56,216,234, 84,
-143, 15,191,248, 46, 86,232,158, 60,225,110, 86,237,173,195, 42,253,105,178, 16, 77,174,196,238,189,117,175,245,171, 47,117,245,
-193,214,159, 21, 31,  3,192,184, 94,126,248,243,126, 54,174,196,103,237,141,201, 70,116,125,143,186,173, 59, 20,108, 14,246,174,
-122,103,120, 72,147,198, 30,216,118, 52, 18, 20,133, 35, 22, 61,112,  9, 33, 93,219, 52,193,186,157,143,183, 48,244,240, 93,125,
-192, 16,123, 38,186,104, 48,  0, 12,104,173,248,181,115, 11,103, 95, 82,177,226, 86, 21,216, 72, 69,211,  7,143,154, 40,103,226,
-127,  6,146, 34, 64, 49, 70,232,205, 28,212, 57, 69,208, 57,250,224, 92,212, 45,125,161,193,244,110, 76,118,221,162,120,247,114,
-144, 40,185,122, 43,165, 88,171,247, 84, 40, 91, 24,132,  2,142, 43, 54, 18,252, 25,147,164,137,201, 64,156, 37, 26,137,137, 48,
- 61,239,205,244,218,180,227,192, 18,177, 68, 58, 78, 72,129,114,119,178, 85,110, 90,243, 41,236,237,237,192,153,138,  1,109, 54,
- 70,190,245, 69,246, 93, 21,237,  7,  0,173, 92, 97,215,203, 79,188, 67, 36,160,210,206, 38,152, 63,170,109, 31, 20,141, 25, 19,
-  6,118, 16,115, 38, 45,222, 89,181, 31,155,223, 31,142,137, 47,  4,138, 79,252, 17, 63,  3,192,242,186, 94,107,194, 50, 32,180,
- 30,221, 62,184, 16, 75,  1,145,  4,232,121,237,192,103,173,129, 27, 22,107,116,  4,196,172,136, 10,108,239,107, 43,225,210,254,
-  0,151,246,  7, 17,250,244,  0,229,219,155,162, 60, 58,145,111,191, 92,166,221,186,117,219, 25, 78,128, 79, 44,232, 42,  3, 44,
-  7,228,196, 71,194,100, 50,129,102,  1,131,193,  0,173, 86, 11,219,132, 83,229,117,180, 36, 98,106,208,156,215,134,  5,147, 98,
-149,238,151, 88, 38,101,219,155,173,187,145, 98,149,238,114, 10, 27,159,163, 53,242,209, 44,158,167,145, 68,149, 74, 53,104,200,
-144, 33,191,157, 62,125,218,165,109,219,182,  0,128,107,215,174,149,188,116,118,234,  4,127,127,127,100,102,102,226,229,151, 95,
-206, 81,171,213,131, 80, 75,157,223,162,162,162,135,135, 14, 29,106,164,213,106, 59,124,244,209, 71, 89, 77,154, 52,209, 24, 12,
-  6,170,160,160,128, 99, 24,  6,206,206,206,210, 14, 29, 58,160,123,247,238,197, 81, 81, 81, 77, 83, 83, 83,139,  0, 36,213, 37,
-241,195,135, 15,199,133, 11, 37,141,246, 26,162, 95, 45,137, 68,130,182,109,219,122, 39, 38, 38,166,151, 62, 91,172,206,227, 43,
- 62, 94,110,221,186,133,243, 55,210, 32, 50,233, 33,205, 86,225,242,209, 67, 24, 54,125, 22, 24,166,238, 99,203,223,186,117, 11,
-199, 34, 46,195, 86, 38, 66, 92, 92, 52, 14, 29, 58,132,153, 51,103,214, 75,179,142,212,232, 69,254,227,168, 81, 77, 61, 45, 17,
-  0,132,134,134,158, 47,139, 86, 84,164,121,115, 72,101,197, 88, 58,160,163,247,194,113, 61, 91,  8,105,141, 10, 28,203, 65, 40,
-  6,220,221, 28,176,107,215, 94,191,189,251,247, 71,125,191,225,251,111, 56,134,249,240,110, 22,116, 86, 36,106,233,154,253,145,
-227,118,205, 11, 17,205, 28,220,218,  5,  0, 36, 34,  1,214,255, 28,205,  0, 88, 90,159,163,125,222, 27,242, 98, 26,211,220, 93,
- 29, 63, 94,252,198, 80,151,144, 78,254, 56,127,229, 46,190, 57, 20,117, 65,154,133,157, 22,223,220, 28,141,199,253, 83, 85,173,
- 14,193,213, 94,239,146,101,137,135,196,214, 25,230,164,179,128,217,  0,131,209,140,212, 92, 22,169,121,  6,136, 20, 18, 92,139,
- 79,211,187,102, 32,172, 30,135, 77,217, 42,228, 94, 75, 62, 95,221,216,160, 47,102, 52,249, 57,140, 68,122, 89,172,176,145,169,
-173,169,170,112, 57, 29,134,222,205,196,207,  1,156, 80, 42, 39,186, 15,222,123,205, 54, 61,230, 52, 90, 10, 84,160,  8,129, 77,
-224, 80,216,219,  8, 37, 61,155,138, 83,  0,192,214, 86, 33, 93,245,201,124,199,119,223,255,164,214, 58, 96,129,128,196,191,185,
-199,187,109,155, 56,227,194,245, 88, 92,184,147, 28,125,225, 90, 92, 80,223,118, 94,240,111,236, 52, 71,154, 95,176,242, 30,172,
-143,144,150, 92, 24,  6,160, 13,229,173, 14,  3,221,241, 74,231,113, 31, 85,215,218,176, 74,154,  1, 92, 60, 75, 64,  9,133,  0,
- 37, 40,105,  1,153,250,  7, 68, 78,205,201,222,  3,199,116,219,182,237,252,244, 94,142,229,141, 51,104, 22,172, 70,163,129,173,
-173, 45, 78,197, 51,198,137,  3, 37, 50,129, 64,128,212,248, 27,127, 85,134,119, 17,180,145,244,253,172,245, 31,203, 58,159,182,
-151, 82, 50,175,161,159,  4, 50,119,118,166,213,245, 33,193,195,243, 95,160,176,176,240,246,189,123,247,  6,182,111,223,126,251,
- 59,239,188, 99, 63, 97,194,  4,175, 55,223,124, 83,  0,  0,153,153,153,220,186,117,235, 84,223,126,251,109, 97, 78, 78,206, 20,
-154,166, 45,233,202,132,168,213,234, 75, 63,252,240, 67,246,197,139, 23,131,186,116,233, 34,123,238,185,231, 56,103,103,103,145,
- 76, 38, 99, 77, 38,147, 33, 62, 62,158, 77, 76, 76,244, 44, 40, 40,120,  0, 32,  1,117, 24,177,162, 52,122,181, 92, 40, 20, 46,
- 33,132,180,109,136, 58, 90, 10,133,194, 11,192,  3,138,162, 90, 90, 91,108,248,196,  3, 91, 36, 66,126,126, 62,116, 25,209,144,
-167,221, 71,123, 91,  1,218, 56,219,193,193,193,161, 94,166,168,176,176, 16,208,166, 35, 50,242, 22,192, 48,112,116,116,132,163,
-163,227, 63,110,180,170,243, 34, 79,  9,211,170, 88, 86,115, 29,173, 54, 74,204,180, 49, 97,221,244,161, 45, 36,205,124, 27,195,
-152,118, 13,183, 82,139,241,225,243, 93, 98,132, 50,123,195,244, 73,195, 59,141, 26,211, 20, 33,221, 59, 83,205, 60, 29,231,172,
- 92,179,241,173, 54,200,153, 31,147,133,245,150,164, 40, 38, 27, 15, 57,100,109, 59,123, 59,109, 70, 99,133, 30, 28, 71,112,246,
-142, 26,119,146,242,183,197,102,227,161, 53, 71,215,198, 19,253, 69, 16,236, 39,132,200, 29,109,109,139,218,248, 55,118,235,223,
- 45, 88, 48,168, 79, 39, 72,132, 64,228,159,183, 48,119,205,145,203, 28, 71,134,222,176,176,216,176,164,133, 97,101,  3, 85,210,
-194,144,174,212,194,144, 16, 66, 74, 90, 29,214, 28,124, 16, 10,169, 12, 93,242, 85, 15,177,107, 43,232, 19,206, 34, 41,159, 67,
-114, 86, 17, 52, 34, 15, 24,211,211,  1,194,165,156,175,185, 98,117,141,184,185,185,185,251,181,241,111,241,221,142, 67, 48,235,
- 10,241,240,220,118, 20,231,171,241,217,166,159, 91,120,123,187,246, 73, 79, 79, 63,111, 69,102,227,255, 91,216, 94,119, 16, 64,
- 40,150,225,196,247,  7,144,227,106,  3, 55,133,  4,156, 62, 27,211,223,157,224, 56,120,192,  4, 71,  0, 72,142,187,137, 38, 10,
-189, 69,186,102, 87,140, 26,215, 55,192,  9,180, 30, 59, 78,221, 52,  8,128, 65, 59,207, 68, 39,244,109,237, 36, 31,215,179,137,
-243,114, 85,193,104,228,214,173, 83,209,178,136, 86,121,132,175, 14,173, 13, 15,  1,108,107, 14,  9,251, 47,101,217,142, 25,240,
-156, 66, 34,162, 40, 82,156, 14, 98,227,134,141, 59, 14, 22, 75,105,235, 70, 98,231,128,229, 93, 87, 60, 92, 82,114,159, 96,251,
-224, 21,215,222,  8,255,248,121,101, 70, 70,  6,204,165,101,135, 15,243,184,223, 39, 13,104,195,166, 21,114,166, 51, 43, 71,142,
-161,108,148,210,  5, 95,237, 60, 71,  0,190, 55,105,158,167, 26,189, 94,127, 93,175,215,183, 91,176, 96,193, 43, 31,124,240, 65,
-111, 91, 91, 91, 63,  0,208,106,181, 15,105,154,190, 80,250,255,180,166,117, 32,  1,240, 32, 33, 33,225, 97, 66, 66, 66,163,221,
-187,119, 59,  1,144,151,254,102,  0, 80,  0, 32, 19,245,104,113, 88,102,170, 40,138, 90,210, 80,231,161,204, 84, 81, 20,213,178,
- 46,219, 11,  4,  2,150,162, 40, 80, 20,  5,153, 76,134,139, 23, 47, 98,236,208,  1,184,119,162,  0,109,157,236,208,101,202,116,
-236, 15, 15,135, 80, 40,  4, 69, 81, 16, 10,133, 86, 61, 71, 68, 34, 17, 34, 35, 35, 49,241,229, 49,144,137,  0, 71, 71, 71, 44,
- 88,176,  0,199,143, 31,135, 72,196,143,210,103,  5, 91, 42, 24, 46, 11,251,209,162,176, 60,124,251, 23, 18,176, 52,126,217,254,
- 53,194,238, 22,155,226,178,241, 97, 64, 54,214, 29, 66, 17,151,189,102,231,140,240,200,187, 95, 77, 29, 31,170,232,215,119,  0,
-250,133,244, 21,  5,117,238,243, 49, 80,201,104,245, 71, 13,125,109,176, 28, 62,221,114, 42,118,250,254,115,241, 20,204, 69, 24,
-255, 98,103,194,114,248,180,150,131,121, 66,211,209,198,110,127,100, 84,148, 51,204,197, 72,186,249,187,188,169, 95, 11,128, 53,
-227,193,131,251,248,118,199, 81,238,220,159,113,187, 76, 12,222, 73,204,135,214, 82,205,146, 39, 37,  3, 71, 91,105,192,160, 32,
-135, 95, 57, 16, 56, 41, 36,173,  9,199,194, 73, 33,110, 61,160,181,226, 87, 66,  8,177,183, 17,183, 38, 44, 93,171,166,222,196,
-108,222,241,227,182,213,175,191,254,186,109, 78, 90,  6, 84,154,187, 40,150,122,131, 86,248, 32,225,230,  5,189,206,200, 88,242,
- 16,175,246,124,230,228,228,100, 93,191,146,135,253,155, 86,128, 54, 25,145,149, 86,226, 85, 85, 57, 26, 56,184,121, 71,165,167,
-167, 91,172,105,102,184,194, 81, 19,166, 73,108,236, 97, 51,113, 84,168, 52, 33,215,136,142, 94,246, 37,153, 70,113, 54,238, 69,
- 68, 34,164,180,142,105, 98,170,  0, 77,130,189, 44, 74,167,189, 92,242,206,224,231,188,241, 48, 69,141,139,209,233, 59, 30,230,
- 65,197,198,170,119, 36,168, 10,102, 12,127,222, 23,107,143,199,188, 13,208,123,173, 57,246, 64,119,188, 66,  8,122,150, 84,134,
-215,131,  0, 61,  3,221,241,138,133, 45, 13,159,208, 20, 73,240,234,234, 95,147, 63, 58,120, 53,103,248,194, 87,123, 57,116,239,
- 62, 68, 10,198,132, 34,189,145,190, 87,  0,141, 53,154, 26, 61,183, 25,192,230,178, 31,174,167,113,187,122, 45,141,186,176,247,
- 77, 31,101,153, 87,191,144, 96,140,  2, 16, 53,181,171,205,199,146,190,159,  5, 68, 45,239,122,250,142,154,219,125, 33,161,188,
- 15,173, 90,255, 71,117,132,215,228, 53,255,  9, 77, 22,192, 46,154,166,119, 21, 20, 20, 52,164,166, 10, 79,246,235, 84,175, 99,
-175, 88, 76, 72,  8, 17,149, 70,179,106,171, 12, 95,163,102,197, 98, 66, 66,200,201,210,104, 86,109, 81,173, 74,154, 28,199,169,
- 58,117,234,228, 50,108,216, 48,176, 44,139,251,247,239, 35, 57, 53, 21,253,103,188, 13, 39, 39, 39, 92,184,125, 27,113,113,113,
- 88,178,100,  9,104,154,198,177, 99,199,210,106,211, 20,137, 68,230, 22, 45, 90, 72, 70,140, 24,  1,134, 97,144,152,152,136,244,
-244,116,204,157, 59, 23,142,142,142,184,126,253,122,185,102, 78, 78, 14, 68, 34,145,185,138,232,214,223,113, 47, 61,237, 60, 97,
-178,106, 54, 90,  0, 11,150, 70, 97,248, 82,172,191,  8,179,153, 70,235,152,108, 60,138,249, 43, 34,181, 81,120,229,246, 47,183,
-239,198, 62,188,254, 71, 63, 41,178,238,192,218, 55,137,251,185, 80,219,203,139,138, 96, 46,114, 64,226,175,120,148, 89, 84,124,
- 63, 23,106,171,223, 24, 56,150,130, 89,  7,168,175,225,210,133,243, 56,119,249, 22,174,222,137,101, 47, 93,143,223, 47,224,240,
-233,189, 92,220,175,195, 91,  8,236,134,174,197,107,119, 30,248,118,246,111,228, 11,150,  1,225,104, 56,142,223,139, 41, 49,221,
-125, 59, 55,119,242, 45,137,100,209,112,126,227,119, 96,181,188, 70,189,107,169,244, 22,233,241,211,163,139, 10,114,159,127,161,
- 79, 55, 91,199,192,193,200,121, 16,143,251,183, 34,245,215,239, 38, 92,186,150, 74,111,169,207,213,245,246,246,238,253, 66,159,
-  0,140,159,190, 24,102, 93, 33, 18,207,253,136,226,188, 12, 92,140,178, 67,172, 70,211, 13,128,197, 17,173,168, 20, 38,  8, 41,
-249,232,209, 84,156, 98, 15,163,199,164,208, 97,144, 81,  6,112, 70, 13, 40, 93, 14, 18,210, 77,133,163, 55,165,178,  0,160,144,
- 81, 34, 91, 82,232, 96, 81,228,177,137,107, 43,133,144,198,206,240,104,112, 92,201,240, 77, 28,135,141, 59,127, 79,152,241,233,
-196,142,104,227,235, 28,124, 51, 61,139,130, 21, 33,127,138,160,215,213,253,159,180, 54,252,246, 49,192,153, 17, 57,199,165,117,
-175,245,121,189, 80,199,225,118,238,170,144, 14, 96,  6, 68,186,205,115,214,159,250,184, 83,120, 76,207,121,111, 12,119,  0,105,
-144, 22,186,241, 49, 25,108,239,174, 43,147, 79,115,164,114,121,110, 73,100, 43,144,168, 52,228,230,133,  4, 35,223, 43, 60, 15,
- 15, 15,  0,160,184,184,120,250,148, 41, 83, 54,139,197, 98, 37,  0,138,227, 56,112, 28, 39,250,234,171,175,196, 44,203, 10,  4,
-  2,  1, 43, 20, 10,153,147, 39, 79,210, 44,203,102, 27, 12,134,233,181,105, 50, 12,147, 48,107,214,172, 22,181,181, 80,220,183,
-111, 95,153,201, 74,224,175,132, 69, 38,171,226,188, 60,202, 37,170, 33, 72,251, 73,143,137, 75,151,  2,160, 64,176, 44, 38, 27,
-143, 30, 95,229, 78, 30, 84,109,132,230,185, 65,157,251, 44, 45,219,198,218,148, 25, 88,118, 76,231,118,254,251,  0,192, 72,216,
-137,117, 57, 58,141, 81, 63,174, 67,231,110,251, 57, 66, 68, 12, 33,219,  4, 28, 14, 27, 24,220,179,164,165, 93,117,168,178, 10,
-174, 15,110,235, 72,128,146, 34,195,242,226,194,210,110, 28,  8, 33,164,188,184,240,107, 57,114, 10,141,181,246,  3,245,199, 35,
-211,  0, 19,115,117,218,153, 63,110, 78,103, 89,226, 33, 20, 82, 25,122, 19,179,185,190, 38, 11,  0,210,211,211,207, 71,132,167,
-159,185, 29,220,232, 69, 55, 69,105,148, 75,  7,228,232,112, 38, 61,187,248,124, 93, 52,243,181,244,240, 15,214, 29,255, 89, 42,
- 22,138, 64, 72, 73,135,162,132,192, 96,102,243,162, 82,152, 32,  0,104,231,  2,175,  5,199,152,125, 66, 33,149, 92,155,222,149,
- 56,245,218,241, 43, 35,230, 71, 39,229,111, 75, 42,192, 93,  0, 72, 42,192,221,  3,145,143, 62, 78,200, 40,154,127, 55, 57,255,
-107, 88, 89,175,130, 80,184,216,121,252,210, 39,150,213,247,124,198,170,113, 11,192, 72, 32,109,192,248,121,223,206,163, 40, 52,
-212,240, 19,241,122, 51,105,242,248,194,178,200, 22,159, 87,241,240,252, 55, 40,139,106,  9,  4,130,229, 13,168,121,146,162,168,
- 33,  0, 30, 88,177,217,149,226,226,226,118, 13,124,120,185, 12,195,228, 90,178,226,191, 80, 33,254,105,101,203,191,181,227,254,
-188,230, 63,175,217,178,101, 75, 98,133, 97,225,207, 39,175,201,107,242,154,255, 87,154,132, 16, 97,125,166,106, 52,169,250, 76,
-252, 53,122,234,153, 86,221,119,190,166,219, 51,200,131,  7, 15, 40,254, 44,240,240,240,240, 84, 13, 69, 81,236,223,160,201,247,
-142,199, 83,102,176, 42, 69,183,  4,252, 57,225,225,225,225,225,225,225,225,105, 16,147, 85,113, 94, 98,194, 81,125,248,207,154,
-214,  4,117,  9, 33, 70,240,154,188, 38,175,201,107,242,154,188, 38,175,249,127,167, 89,155, 54,223,154,241,111, 54, 96,188, 38,
-175,201,107,242,154,188, 38,175,201,107,254,255,105, 62,205, 84, 91, 71,139, 47, 58,228,225,225,225,225,225,225,225,249,155,224,
- 43,195,243,240,240,240,240,240,240,240,212,143, 90,  7,149,230,225,225,225,225,225,225,225,225,169, 27, 53, 15, 42,205,195,195,
-195,195,195,195,195,195, 83,103,172, 31, 84,154,135,135,135,135,135,135,135,135,199, 34,182,240,167,128,135,135,135,135,135,135,
-135,231,159,161,114,171,195,176,176, 48, 82,113,206,195,195,195,195,195,195,195,243, 79,242,172,122, 17,190,232,144,135,135,135,
-135,135,135,135,167,126, 76,227,141, 22, 15, 15, 15, 15, 15, 15, 15,207,223, 67,181,117,180,202, 58, 44, 13, 41, 13,213,133,240,
-231,138,135,135,135,135,135,135,231, 95,224,217,246, 34,124,253, 44, 30, 30, 30, 30, 30, 30, 30,222,139,240,240,240,240,240,240,
-240,240,240,252,151,224,199, 58,228,225,225,225,225,225,225,225,249,135, 13,215,223,110,180,248,145,205,121, 77, 94,147,215,228,
- 53,121, 77, 94,147,215,252,127, 50, 89,149,204, 22,223,234,144,135,135,135,135,135,135,135,167,126,212,218,234,144,135,135,135,
-135,135,135,135,135,167,110, 76,  3, 16, 90,250, 57, 20, 21,162, 90,124, 68,139,135,135,135,135,135,135,135,167,126,108,  1,224,
- 89,106,176, 78,  0, 80,243, 70,139,135,135,135,135,135,135,135,167, 97,168, 88, 47,107,104,  5,243,197, 27, 45, 30, 30, 30, 30,
- 30, 30, 30,158,122, 82,109, 29, 45, 10,213,183, 28,136,176, 98,  7,117,105,125, 16,193,107,242,154,188, 38,175,201,107,242,154,
-188,230,255,157,102,109,218, 17,120,250,152,102,141,249,106, 72,248,166,175,188, 38,175,201,107,242,154,188, 38,175,201,107,254,
-223,210,224,173, 14, 59,  2, 54,252,105,125, 38,105, 84, 58,241,240,240,240,240,240,240,212,204,223,211,234, 48, 16,120, 99, 66,
- 91,229, 38,250,110,182,195, 93, 64, 87,211,186, 74,165,114,179, 66,161,152,160,211,233,180, 20, 69,113,101,203,  9, 33,  0, 80,
-113,172,163,196,236,236,236, 94,181,237, 91, 42,149,174,107,212,168,209, 27,197,197,197, 58,138,162,  8, 69, 81,160, 40, 10,  0,
-158,152,179, 44,155,150,155,155,219,233,169,190,132,132,  8,221, 26, 53,250, 83, 44, 20,122, 91,187, 41,203,113,143,178, 50, 51,
-187, 89,177,201, 10,138,194,194,146,221,226, 75,  0,139,159,181,127,  4,  1,132,150,172,215, 22,176,143,  7,198,179,  2,193,219,
- 98, 96,131,145,227, 54,  1,  0,  5,176,117,221,183,241, 10, 90, 80,  4,193, 20,  5, 71, 66, 80, 72, 40,220,146,117, 69,194,191,
-116, 42, 70,137,197,226,225, 14, 14, 14,118,185,185,185,231,  1,236,  3,240,178,171,171,107, 31,141, 70, 83, 76,211,244,113,  0,
- 71,234, 34,220, 43, 24,239, 75, 37,226,169,  6, 51,189,234,143, 91,248,177, 79, 71,184, 50, 28, 86,202, 37,162, 94, 70, 19,243,
-101,228,109,108,179, 82,146, 42,157,202,242, 12,171,199, 72, 59,104,225,117,  7,128, 99,206,206,254, 50,165,195,111, 98,169,240,
- 81, 65,102,241,132, 49, 89, 89,169, 99,235,113,221,255,139,184,185,185,189, 38, 16,  8, 62, 39,132,128,101,217, 15,243,242,242,
-182, 55,144,244,135,  0,156, 74, 63, 23,  0,248,188,158,122,201,  0,124, 75, 63,167,  0,104,194, 63,215,235,204,198,163, 71,143,
-206,232,219,183, 47,214,174, 93,139,141, 27, 55, 38,101,103,103,175,  4,176,  3,128,233, 95,208,225,169,142, 54,192,144,175,  6,
-118,101,233,159, 62,229, 42, 44,238, 95,205,159,249,135, 73,147, 38,153,  9, 33, 36, 46, 46,142,152, 76, 38, 66,211, 52, 97, 24,
-134, 48, 12, 67,104,154, 46,159,188,189,189,211, 31,219,252,  9, 77,129, 64,176,126,244,232,209, 69,132, 16,114,237,218, 53,162,
-215,235,137,209,104, 36, 38,147,137, 24, 12,  6,162,215,235, 43, 77,141, 26, 53,202,172, 73,211,193,193,225,154,179,179,115,166,
-179,179,115,166,139,139, 75,166,139,139, 75,166,171,171,107,249,228,230,230, 86, 62, 41,149,202, 76,165, 82,153,233,226,226,114,
-173,182,116,150, 50, 16,192,121, 11,166,129, 85,108,219,191,162,209,242,244,244,204, 36,117,160,113,227,198,169, 22,164,179,140,
- 70, 20,  5,182,108, 91,138,  2, 39,147,201,124, 43,254,142, 39, 35, 93,181,134,148,189,188,188, 70,123,122,122, 70,120,122,122,
-134,123,121,121,141,182,224, 22,171,164,105,111,111,127,205,205,205, 45,211,195,195, 35,171,108,242,244,244,172, 52,121,121,121,
-149, 79,141, 26, 53,202,116,118,118,174,246, 26, 17, 64, 88,221,116, 14, 16,201,128,126, 34,161, 48,172, 81,163, 70,154, 59,119,
-238,176,132, 16, 34, 16,  8,210,203,214,177,230,216, 31, 55, 89,186, 72,124,152,115, 86,118,165,248,209,202,194,156,179,178, 43,
-186, 72,124,104,188,130, 22,117,213,180,144,170, 52, 39, 79,158, 60,249, 86,102,102,102,122, 65, 65,129,122,211,166, 77,241,114,
-185, 60,114,211,166, 77,241,  5,  5,  5,234,204,204,204,244,201,147, 39,223,  2, 48,203, 10, 77,  0, 64,183, 96, 60,255,250, 40,
- 79,221,173, 99, 19,117,253, 58,139,110,246,104,139,208,  1,221, 36,233,223, 45, 10,212, 93,216,218, 83,215,247, 57,193, 93, 43,
- 53, 41,145, 72,212,221,215,215,119,170, 82,169,156, 84, 58, 77, 44,155, 60, 60, 60, 38,122,120,120, 76,116,118,118, 30, 91,147,
-230, 65, 64,104,201,228, 35,151,119, 31,235,231,171, 75, 94,190,140,220,121,247,109, 50,181,185,143,102,140,187,123,211,127,225,
- 26,253,173,154,238,238,238, 42,154,166,137,217,108, 38,174,174,174,170,  6, 76,231,215,132,144,175,  9, 33, 95,  3,248,186,  1,
- 52,203,243, 51, 43, 12,118, 77,154,114,145, 64, 48, 79, 33,149,134,203, 68,162, 44,153, 72,148,165,144, 74,195, 69,  2,193,124,
-  0,242,255,210, 53,250, 27, 52,237,148, 74,229,195,117,235,214, 17,157, 78, 71,116, 58, 29, 89,183,110, 29, 81, 42,149, 15,  1,
-216, 89,161, 89, 87,157,103, 41,130,245,248,212,112, 17,173, 64,160, 83,191,224,150,135,231,188, 54, 30,220,161,117, 84, 45,111,
- 76, 63,116,235,212,105,234,142, 29, 59,  0,  0, 19,134, 15,199,139, 93,186,192,222,206, 22, 82,105, 73,114, 40, 66, 65, 34,150,
- 96,196,220,247, 44,217,253,151, 35, 70,140,120,245,208,161, 67,118,  0,176,113,227, 70,140, 26, 53, 10, 46, 46, 46, 80, 40, 20,
-144, 72, 36, 16,139,197,149,230,181, 33, 20, 10, 27,167,167,167,187,203,229,242,242, 40, 27,199,113,149, 38, 66, 72, 89,244, 13,
- 12,195,160, 85,171, 86,150,158,174, 69,133,133,133,189,181, 90,109,185, 70, 85,147,159,159, 31,  0,156,182, 68,240,243,207, 62,
-  5,199,104, 33, 18,  1, 12,  3, 24,205,  2,112,164, 74,115,131, 89,179,102,149,167,187, 46, 12, 29, 26, 74, 81, 20,117,232,250,
-245,235,135,179,178,178,154,113, 28,251,102, 29, 35, 93,111,221,191,127,223, 14,  0,252,253,253,103,  1, 56,108, 77, 58, 68, 34,
- 81,227,219,183,111,187,203,100,178,106, 35,151, 21, 34,152, 48,155,205,232,216,177, 35, 99,205, 62, 26,  1,190,121,  2,193,155,
- 29,158,123,110,218,210, 17, 35,228,127,254,249,167, 92, 32, 16,128, 97, 24,124,245,213, 87, 12, 33,196,169, 13,224, 16,  3,104,
-106,144,249,  0,192,107,165, 15,131,109,  0,190,170,228, 22,  8,130,245,180, 44, 52,177,120, 68,151,174, 77,223, 71, 76,244,157,
- 46,205,237,142,193, 94,100, 76,  0,254,217,168,150,131,131,195,240,181,107,215, 42,183,109,219,166,137,139,139, 51,111,218,180,
- 73, 57,125,250,116,123,179,217,140, 25, 51,102,100,  7,  4,  4, 72,214,174, 93,171, 60,114,228, 72, 63,173, 86,251,189, 85,215,
-139,194,167, 47, 15,127, 17,  6, 90,  0,154,102,148,158, 74,251, 93,115, 38,135,136,  9, 49, 97,231,241,235,160, 25,238, 71, 43,
- 35, 89,221,198,140, 25,211,124,239,222,189,162,216,216, 88, 81,235,214,173,193,113, 28, 88,150,  5, 77,211,  0,  0,142,227,208,
-178,101,203,122,159,151,169,128,191, 91, 35,151,240,110, 67,  6,219,120,202,101,112,201,207,198,235, 18,145,253,118,133,113, 55,
-128,238,207, 84,100,151, 16,136, 68, 34,164,166,166,194,221,221,221,134,227, 56, 53,128,101,249,249,249, 91,240,236,210, 69, 42,
- 18, 29,222,249,227,122,143,174,221,187, 11, 27,121,186, 35,254,126, 10, 68, 20,219,255,246,213,235, 33, 83,103,206,155, 99, 98,
-152,209,  0,254,124,214, 14,220,163,251,172,145,148, 64,184,145, 34, 28, 62,249,238,231,162, 21, 95,174, 83,204,120,115,178,112,
-238,220,185,240,241,241,105, 54,114,228,200, 47,  1,204,172, 85,167,235,172,145, 16, 10, 54,130, 16, 44,253,246,231,162, 47,190,
- 92,167,152, 89,  7,157,167,156,106,255, 35,245, 54, 90,129, 64,243, 32, 31,247, 51, 43, 22,206, 20,147, 95,127, 18,232,114,179,
-170, 93, 87,169, 84,110, 30, 52,104,208,132,237,219,255,138, 70,119,107,219, 22, 35,251,245,132,187,171, 35, 20,182,210,146,199,
- 17, 71,225, 86,220, 35,139, 12,129,143,143,207,140,195,135, 15,219, 85, 52, 19, 18,137,164,124,170,104,178,202,166,178,  7,112,
- 77,200,229,114, 68, 68, 68, 64, 36, 18, 65, 40, 20, 66, 36, 18,149, 79, 21,191, 11,133, 66, 52,106,100, 85,213,165,149,142,142,
-142,237,139,138,138, 28, 10, 10, 10,224,235,235,171,  1,112,187,194,239,237,179,179,179, 29,172, 17,228, 24, 45,230,190, 30,  8,
-177,233, 50, 76,226, 46,208,139,122,224,210,213,123,  8, 59,125, 30,233,170, 12,244,124,190,  3, 38,189, 50,  6,225,225,225, 96,
- 89,171, 75, 58, 50,  9,193,151,195,134,133,190, 15, 80, 84,255,254,253, 11,102,207,158, 45,136,141,141,125,117,228,200, 17,109,
-239,223,127, 80, 26, 85,164, 22, 18,130,245,  0, 50, 45,212,149,  2,192,133, 11, 23,  0, 64, 86,151,123, 79, 38,147, 33, 42, 42,
- 10,101,197,196,  2,129,  0,  2,129,  0, 66,161, 16,191, 60,112,131,214, 36,128, 46,243, 46,222, 14,245,133,159,159, 31,  4,130,
-218,171, 36,134,  0,242, 75,192, 72, 74, 44,158,235,233,229,213,172, 79,243,230,138,136,136,  8, 33,  0, 52,105,210,132,168,213,
-234,130,227,199,143, 23,137,128,141, 77,  8,217, 81,147,201,242,241,241,233,145,158,158,254,121,217, 57,167, 40,234,203,166, 77,
-155, 46, 41,191,110, 28,135,101, 63,106,197,115,230,188, 43,233, 26,242, 17,  0,160,235,176,189,208, 36,174,  8,164,242, 62,112,
-252,167,115,  9,141, 70,179,191,101,203,150,194,220,220,220, 75,  0,146,105,154, 94,180,107,215, 46,247,215, 95,127, 61,107,247,
-238,221, 43,  1,120,173, 90,181, 42, 68,171,213, 30,176, 70,183,103,123, 12,121,174,125,219,231,125,125,124,112,254,210,159,144,
- 72,197, 78,179, 94, 11,133,157,157,  8, 95,111, 59,193, 37,167,229,205,142,188,141, 29, 86,152,172, 46, 99,198,140,105,182,119,
-239, 94, 41,  0,220,190,125, 27, 25, 25, 25, 80, 42,149,176,177,177,129, 88, 44,134, 80, 40,132, 88, 44,110, 16,147,229,232,227,
-122,229,216,177,227, 54, 46, 46, 78,248,238,189, 57,152,148,149,  9, 39,123, 59,208,197,218,102,207,216,131,194,191, 87,175, 94,
-114,150,101,161,213,106,113,238,220, 57, 71, 27, 27, 27,199,198,141, 27, 47,133, 21,173,167,228,114,121,166,193, 96,112, 47,253,
-156,101, 48, 24, 26,  1,208,200,100,178,178,124,186,184,116,110,105,113, 98, 50,158, 44, 38, 76,161, 40,170,226,178,186,210,185,
- 75,231,246, 17, 71, 14,237,177, 43, 44,202,128,147,115, 22,  4, 40,196,150, 45, 27, 96, 99,227,128,165, 75, 63, 16, 61,234,223,
-207,123,224,144,209, 17,209,247,226,251, 63,115,102,139, 80, 91,250, 15,155,224, 98,163,176, 47,125,150,208,216,190,117, 14,  4,
-  2,  1,150, 44, 89,130,160,160,160,105,209,209,209, 31,  1,200,171, 89,  6, 91,218,245, 30,231, 34,149,151, 92, 98,142,165,177,
-105,223,252, 18,157,197,211,241,242, 48,191,105, 11,198, 60, 60, 21,212, 28, 69,165, 47,230,122,177,  0, 41, 84, 87,148, 27,134,
-176,176,176, 62,161,161,161,231,171,251,254, 20,224,137,191,250,207,170,100,190, 68, 97, 97, 97, 36, 52, 52,148,170,112,112,149,
-190,215, 68, 48,224,230,236,168,136,216,184,108,142,157,232,242,  9,161, 62,229,  1, 84,134, 74, 15,242, 74, 77, 52, 21, 10,197,
-132,237,219,183, 87, 10, 41,249, 54,114,135, 68, 34,134, 88, 66,193,169, 87, 73,239,245,  5, 23,195, 64, 81,213,154,172, 74,154,
- 90,173,214,112,243,230, 77,187,109,219,182,193,221,221, 29,205,154, 53,131, 66,161,128, 92, 46,175,100,174, 42, 26,174, 42,140,
- 86, 37,205,178,223, 69, 34, 17,  4,  2,  1,194,195,195,193, 48, 12,198,140, 25,243,132,201, 18,137, 68,213, 25,183,234,154,167,
-158,  6,112,155, 16,210,187,244,  1,124, 27, 64,159, 10,191, 15, 84, 42,149,139,  0,172,180, 84, 83, 40, 36, 16, 26, 46,129,107,
-188, 14,162,212, 57, 48,137,131,113, 54,242, 58,182,111, 94, 11,  0,104,214,186, 51,198,142, 12, 45,143,198, 89,152,206,114,188,
-189,189,247,101,103,231, 12,238,215,175, 31,242,243,243,233,101,203,150,161,125,251,246,240,247,247,183,232, 26, 85,243,230,156,
-121,251,246,109, 31,189, 94, 15, 66,136, 37,230,236,  9, 77,138,162,176,107,215, 46, 24, 12,134, 39, 86,118,238,243,  5,230,143,
-106,130, 41,111,239,192,151,113,  7,240,253,247,223,215,120,236, 10,160,189,193,177,229,122,169,144,105,191,242,131,183,100,147,
- 38, 77, 18, 78,153, 50,  5, 41, 41, 41,120,253,245,215, 13,225,225,225,166, 12,181,250,184,148,227,190, 51, 87, 54,198,213,106,
-202,100,178,157,167, 79,159,198,129,  3, 37,190, 36, 62, 62, 30,173, 90,181,178,173,100,146,243, 14,162, 40,249, 59, 92,249, 37,
- 22, 93,135,237,197,149, 95, 94,  1, 91,112, 66,220,169, 21, 10,173, 57,159,117,160, 42,205,  3,185,185,185,229, 38,106,247,238,
-221, 54,187,119,239, 30,  1,224,103,  0,  7,  0, 32, 47, 47,111,141,149,154,  0,133, 41,227, 70,141,128, 72, 98,143,216,  7,105,
-232,211,173, 35, 26,185,187,227,246,189,  4, 36,167,231,101, 82, 20, 94, 27,216, 93,186, 82,175, 55,125,116,241, 22,126,168, 69,
-147,106,220,184,177,255,193,131,  7, 37, 21, 34,208,229,255,113,161, 80, 88,254,189,204,120,215,229,254, 44, 51, 89,246,141,237,
-174,124,186,161,135,237,149, 59,187,209,170,201, 16, 56, 15,  9,197, 15,103,206,224,126,116,140,193,164, 99, 94,248, 23,174,209,
-223,165,233, 63,106,212,168, 75,123,246,236,113, 74, 77, 77,197,133, 11, 23,208,172, 89, 51,232,116, 58, 75, 94,120, 43,105, 26,
- 12,  6,247,178,109, 40,138,114, 47, 11,188,155, 76,166,178,139, 81,246, 71,116,170,176,158, 83, 13,154,190, 21,214, 43, 51, 87,
- 77, 26,224,216,165,114,137,228,224,177, 35,251,236, 98, 98, 47,160, 67,240,243,176,115,108,  3,142,205, 64,110, 94, 49,242, 31,
-168,240,217,103, 95, 98,233,178, 15,241,243,209, 67,118,  1,129,193,135, 77, 12,211, 18,128,225,153,185,238, 20,153, 22,241,203,
-238,141, 20,225,160,207,140,149,137,181, 15, 21, 19, 94, 25, 45, 28, 63,126, 60,126,254,249,103, 68, 71, 71,111,172,193,100, 69,
- 84,136,204, 79,187,123,225,192, 70, 16,  2,125, 86,172, 76,162,127,168,152,252,234, 88,225,164,151, 95,196,229,223,215,227,197,
- 14, 15,239,122,185, 99,100,126,169,197, 22,  9,145, 43,147,227, 15,114,  5,151, 43,152,173,115,  0,168, 10,  6,235, 28,254,170,
-131,249, 52, 48,180,212, 88, 77,123,252,197, 68, 84, 23,131,  5,  0,173,  0, 59, 74, 42,185,178,125,233, 91, 94,138,148,104,145,
-241,110, 20, 84, 70,142,108, 74, 98,184,142,128,205, 13, 64,255,248, 54, 58,157, 78,155,144,144, 96,243,218,200,145,232,222,182,
- 45, 60, 93, 93,209,178,113, 99,216,200,164,144, 74,196,149, 94, 89, 45, 46, 67,160, 40, 18, 16, 16,128, 97,195,134, 65, 44, 22,
- 67,161, 80,192,206,206, 14, 82,169,180,202,104,150,165,111,185,132, 16,  8,133, 66,220,189,123, 23,201,201,201,112,114,114,194,
- 31,127,252,129, 23, 94,120,225,137,168, 86, 69,115,102, 77,136,190,138,  7,127,153, 17, 59,109,141, 22,203, 82, 40, 38,193,144,
- 39,205,134,142,234,  8,163,145,129,209,104,196, 15,145,102,252,153,160,133,217,108,130,209,104,172,105,159,213, 33,240,242,242,
-154,208,178,101,203, 89,175,188,242, 10, 45,149, 74,161,213,106,161,211,233, 16, 29, 29, 77, 15, 30, 60,164, 96,216,176, 80,199,
- 19, 39, 78,144,210,162,195, 76, 43,180,115,189,189,189,125, 74,139,103,115,235,114, 87, 83, 20, 85,110, 98, 30,231,181, 53, 49,
- 16,  9, 75,174,201,198,141, 27,193,178, 44,  8, 33,213, 94, 36,  3, 69,253,182,236,139,213,142,171,214,253,  8, 71,151, 70, 56,
-127,254, 60,123,234,212,169, 34, 10,136,191, 31, 29,189,230, 37,224,228, 65,192,108, 77,250,242,243,243,109,154, 53,107,134,198,
-141, 27,131,227, 56,208, 52, 93, 30,125,201,205,205,133, 94,175,135,139,109,  1, 90,184, 54,  6, 83,116, 14,234,187,159,192,211,
- 46, 22, 59, 78,155,232,231,252,113,235, 63,144,113,252, 84, 58,213,243,173, 25,222,238, 30, 62, 16, 16, 26,170,172, 92,140, 24,
-250, 34,132, 18, 59, 60, 74,205, 65,112,155,230,158,175,190,212,195, 83, 72, 49, 88,184,114,239, 44,128,251,161, 54,185,226,226,
- 98, 54, 54, 54, 22,183,111,151,248, 93,  7,  7,  7,216,218,218, 86,250,143, 11,  4,130,122, 69,180,202, 76,214, 23, 27, 95,176,
- 21,136,181,208,176, 17,216,182,235, 58,130,  3, 66,177,233,202, 85,  3,155,153,215,255,107,131, 33,126,223, 83, 28,204,240,240,
-240,152,206,113,220, 82, 66, 72, 65,207,158, 61, 27,237,221,187,215, 57, 61, 61, 29,215,175, 95,199,146, 37, 75,178, 89,150,101,
-  8, 33, 20, 33,228,147,  6,216, 29, 87,193, 96, 53, 36, 98,133, 28,111,187, 57, 80,195, 69,  2,135,102,140,166,248, 81,142,137,
- 28,215, 49,220,183,  0,232, 26, 51, 55,129,224,141, 67,251, 55,122,185, 41, 57,132, 40,251, 65,157,105,198, 23,239, 77, 70,110,
-110, 17,126,216,186,  2,128, 20,102, 70,136,222, 33,163,225,238,238,141,105,111, 78,243,216,184,121,211, 91, 12,199,125,141,103,
-132,140, 75,223, 31,  5, 16,161, 84, 42,163,223,154, 54, 77,217,172,217, 68,200,229,114,236,219,183, 15,123,191,251,142, 93,  7,
-140,149,  1,103,103,  0, 71,107,212,185,242,151,206,156, 25, 51,148,129,129, 51, 32,147,201,240,251,169,159, 96,200,216, 85, 52,
-180, 59,204, 58,  3,134, 54, 29, 70, 92,146,126,161,242,196, 98, 60,  0,  0,177, 28,106,  0,143, 23,131, 61,109,  6,171,140, 19,
-248,171, 94,214,180, 74, 17,173, 58,231,157, 98,233,157,173,239,190,220,164, 17,140,148, 41,242, 23,164, 27, 57,118,213,125,179,
-240, 70, 33,153,127,175, 10,147, 85,122, 99,115,190,190,190,232,215,169, 19, 70,246,234,  5,145, 72,  4,185, 84,  2,123,185, 13,
-  8, 91, 18,201, 42, 43, 58,172,225,153,136,170,162, 79,174,174,174,144, 72, 36,229,  6,203,138,104, 86,149,154, 28,199, 65, 36,
- 18,225,246,237,219,232,217,179, 39,124,124,124,112,224,192,  1, 12, 28, 56,240,137,162, 68,107, 77, 86,153,209,122,172, 24,111,
- 32,128,178, 72,150, 85, 70,203, 96,162,144, 99, 10,  6, 69,181,  5,195,  0, 44,  1,140,  6,  3,  8,  1,  8,  1,104,179,  9,  6,
-131,161,124,159,150, 20,201,122,120,120,248,218,216,216, 44,127,255,253,133,129,193,193, 29,144,157,157, 13,142,227, 96,107,107,
- 11,157, 78,  7,  7,  7,  7,116,239,222,253,209,242,229,203,213,132, 96,154,149, 38,171,222,148,157,243, 51,103,206, 84, 42, 54,
- 44,155,180,234, 52, 76,121,103, 55,164,162,146,162,165,178, 58, 60, 53,229,187,125,123,247,192,165, 27,241,204, 27, 11,215, 27,
-197,185,215, 87,122,112,220,246,180,122, 28, 23, 33,  4, 57, 57, 57,200,204,204,196,240, 17, 35,176,119,207, 30, 36, 37, 37,161,
- 77,155, 54,232,219,183, 47,220,221,221,145,148,148,132, 63, 47, 26, 97,204,207, 67,158,233, 58, 20,246, 93,113,236,124,130,113,
-201, 70,115,194,191,152, 97, 12,  7, 48,217,193,193,193, 79,167,211,169, 25,134, 57,  8,224, 32,128,177, 34,145,104,172, 66,161,
-240,212,104, 52, 15, 81,210,154,232,120,109, 98, 54,114,185,171, 76,238,  0,142, 49, 66, 36, 18,193,199,167, 25,  8,107, 66,190,
- 70,143,215,198, 15,195,141,219,247,112,234,236,101,134,166,185,111, 44, 57,165,223, 22,203,  0,  0, 32,  0, 73, 68, 65, 84,173,
- 66,161,144,248,251,251, 35, 43, 43, 11, 98,177, 24, 54, 54, 54,176,179,179,195,226,197,139,241,221,119,223,149,155,172,186, 26,
-173,169,128,191,131,175,221,229,207, 55,148,152,172, 12,149, 26,153,105, 98, 40, 93, 27,225,155,239,214,105,243,147, 50,186,254,
-  8,196, 63,237, 15, 89,142,227, 62, 73, 79, 79,119, 23,137, 68, 30, 12,195, 32, 53, 53, 21,215,174, 93,195,236,217,179, 51,115,
-115,115, 67, 80,199, 99,148,203,229, 89,101,145,172,210,162,195,234,138, 19, 11, 42, 68,178, 10,106,144,172,174,152,176,121,179,
-198,246,225, 91,215,206,245,237,220,181,187, 64, 33,114,200, 47,126,144,209, 51,242,194,249,238,179,215,254,240, 86,114,126,241,
-139,  0, 18,171, 19,149,137,197,131,159,239,209, 67,  4,146,  9,145,180, 39,190, 92, 53, 30,217, 57, 26,228,231, 21, 65, 34,177,
-133,137, 22,130,229, 40,116,239,217, 11, 63,237,216,143,160, 55, 95, 23, 74,197,226,  1,140,201,244,204, 24,173, 82, 86,124,251,
-237,183,190,  1,  1,  1,216,190,125, 59,206,238,220,137, 73,133,133, 56, 47, 16,  8,105,177,216,237, 36, 77,111, 65, 45, 70,171,
-162, 78, 80, 80, 16,126,252,241, 71,236,218,181, 43,101,194, 11, 89,135,231, 78,128,187,217,140, 65,215,227,224,210,116, 24,112,
- 61, 14, 46,207,  5,160, 37, 35,194,  3,138,170,220, 29, 84, 88, 88, 88,159,138,243,167, 12, 53,170, 41, 98, 23,  1,  8,  9, 11,
- 11, 35, 21,231,181,102,156,202, 86, 51, 86,188,232,215,164,109, 11, 95,138, 62,176, 30,169, 90,198,244, 81,156, 89,122,191,152,
-204,189,  7,172,171,225, 13,130,  8,133, 66,216,219,216, 64,233,228, 84, 18,230, 23,  8,  0, 14,224,104,128, 98, 75, 12,  0,225,
- 40, 16,214,170, 12,  3, 82,169,180,202,138,239,214,214,205,170,168, 89, 84, 84,132, 71,143, 30, 97,218,180,105, 80, 40, 20, 37,
-206, 61, 35,  3, 77,154, 52,129, 72, 36, 66,122,122, 58,126,255,253,119,248,249,249, 65, 38,147, 89,229,182, 42, 68,151,218,163,
-164,149, 97,123,181, 90,237,224,233,233,  9,171, 35, 90, 28,129,206, 72,193,100, 98,113,255,254,125,168, 84, 42, 60,122,248,  0,
-157,181, 26, 16,  8, 65,  8,177, 42,162,229,237,237,221,182,121,243,230,155, 86,174, 92, 41,105,220,184, 49,  8, 33,112,118,118,
-130, 78,167, 67, 78, 78, 46,218,180,105,  3, 31, 31, 31,172, 92,185, 18,  0,246,254,211, 38,235,177,123,170,220,104, 85, 52, 92,
-239,188,228,139,188, 60, 59,  8,133,130,114,227, 92, 75, 29, 45,  9,  0,132,188, 56, 74, 20,126,234,164, 45,  3, 44,207, 16, 10,
-151,139,106,191,142, 52,203,113,138,234,126, 79, 77, 77,133, 88, 44,198,161,131,  7,145,151,153,137,224,224, 96,116,233,210,  5,
- 15, 30, 60,192,141, 27, 55,224,234,234, 10,101,227,110, 56,255,208,140, 24,149, 30,142,142,142, 72, 72, 19,252,155, 93,  6,188,
-217,191,127,255, 37,107,214,172,113,247,240,240, 16,103,103,103,  7,108,216,176, 33,120,195,134, 13,115,222,122,235,173, 70,111,
-189,245,150,179, 82,169, 20,101,100,100,248,191,247,222,123,207, 69, 68, 68,248,  1, 88, 93,147,160,173,173,189,139, 80, 98, 11,
-138, 18,193,201,209, 25, 34,169, 45, 56, 70,  4,150,  3, 28, 28,149,184,116,227, 16,254,184, 83, 52, 61, 43, 23,  7, 45,138,143,
-149, 94,119, 87, 87,215, 39, 34,213,179,103,207,198,214,173, 91,203,139, 17,235,106,178,190,216,240,130, 29, 85,106,178, 50, 82,
- 69,160,140,126,248,229,104, 84, 65,126, 82, 70,207,103,193,100,149,229,113,132, 16, 60,124,248, 16, 58,157, 14, 23, 47, 94,196,
- 39,159,124,146,253,184,201,114,119,119,127,211,193,193, 97, 89,113,113,241,151, 25, 25, 25,235,107,125,241, 43, 49, 81,101,159,
-203,230, 85, 22, 39, 90,152,212, 38, 85, 69,178,124, 60,229,167,111, 92,220,221,196,145,220,162,144, 60, 13,184,175,137,182,191,
-226,222,123, 72,231,161,130,142,223,127,218,180,203,244,197,167, 83, 53,134,128,234, 34, 91, 28,203,118,180,181,179,  7,144,133,
-235,215,206,149,155,172,220,188, 66, 24,205, 66, 24, 77, 20, 12,102,  1,250,245, 31,132,239, 54,237, 66,122, 86, 30, 88,150,109,
-247,140,153, 44,151,182,109,219,206, 24, 59,118, 44,150, 47, 95,142,136, 53,107, 76, 51, 41, 74, 35,  2,200,  9,150,  5, 71,  8,
- 37,176,172, 18,123, 37,157,175,191,254,250, 40,128,151, 87,206, 70,183,252, 98,188,230, 53,140,184, 52, 29, 86,178,226,152,247,
-  9,  0,184,100, 71, 84,126,100,134,134,134, 82,101, 37,107,214,150,176,253,215, 17,133,134,134,158, 15, 11, 11, 67,197,121, 77,
- 27,216, 55, 10, 24,178, 96,222,172, 85,157,  7,246,162,212,243,  6, 32, 79, 99, 96, 62,136, 49, 75,211,244, 53,155,172,138, 44,
-216,176,  1, 55,226, 75,254,199,141,221,221,177,240,213, 87, 65, 24,224,143,232, 24,236,143,136,192,248,254,253, 97, 43,151, 91,
- 28,217,224, 56,174,202, 40, 86,197,104,150,181, 81,167,130,130,  2, 28, 60,120, 16, 93,186,116,129, 66,161,128, 72, 36, 66,251,
-246,237,113,239,127,236, 93,103, 88, 20, 87,219,190,103,182,194,178,244,222, 85, 20, 12,138,189, 37, 98,236, 45,182,168, 81,177,
-188,246, 26, 11,106, 84,108,177,196, 26, 53,246,138, 49,118,236, 26, 43,118, 44,216,  5, 65, 17,164,151,101,233, 44,176,125,118,
-118,230,251, 65,121, 81, 41, 11,166,188,201,231,115, 93,123,205,206,206,238,189,103,230,204,156,115,159,167, 70, 69,193,195,195,
-  3,  4, 65,224,252,249,243, 24, 56,112, 32,226,227,227,241,229,151, 95,138,147,147,147,107, 76,180,222,188,121, 99,198,178,236,
-215,165,218,143,218,138, 70,163,193,219,183,111,209,175, 95, 63, 88, 90, 90,194,217,249, 56,110,  6, 31,133,200,231, 63, 32,  8,
-212,136,104,233,245,250,113,125,250,244,225, 19,  4,  1,149, 74,  9, 35, 35, 99,152,152,136, 97,106,106,  6, 47,175,134, 72, 79,
- 79, 71,207,158, 61,181,113,113,113,187,164, 82,233,201,154,182,213,219,219,219, 36, 41, 41,233, 63,117,234,212, 17,  0,128,177,
-177,113, 35, 15, 15,143, 31,226,227,227,139,106,170,213, 42, 37, 88,  4, 65,128,195,225,148, 17, 45, 46, 73,194,209,193,174,108,
-191,196, 63,141,168,  2,171, 80,146,171, 17,  2,128,155,155, 27,118,236,253,157,236,211,167, 15,102,205,154,  5,157, 78,135, 93,
-187,138,131,236,134, 15, 31, 14,138,162,112,230, 76,113,144, 36,151,203,173, 82,109,242,252,249,115,188,120,241,  2, 58,157, 14,
-  5,  5,  5,184,122,245, 42, 66,238,221, 67,208,249, 91, 72, 74,136, 69,211,134,238, 24, 63,126, 28,120, 60, 30, 14, 29, 58,  4,
- 95, 95,223,191,117, 64,224,241,120, 35,  3,  3,  3, 29, 15, 30, 60, 40, 59,127,254,188,162, 93,187,118,194, 45, 91,182,216,237,
-216,177,195, 86,171,213,194,223,223, 63,235,241,227,199,154,111,191,253,214,100,223,190,125,142,245,235,215,239, 78,211,116, 69,
- 68,203,  4,192, 48,  0,163,242,139,180, 92, 89,145, 10, 12,173, 69, 66, 82, 34, 10,228, 90, 48,122, 10, 41,105,233,144,171,245,
-200,205, 43, 66,211, 22, 61,182,223,189,123,119, 49, 69, 81,139,  0, 92,170,174,157,175, 95,191,198,227,199,143,145,148,148,132,
-132,132,132,247,153,226,196,137, 56,114,228, 72,141, 53, 90, 21,147, 44, 14,  8,141,  7, 46,157,127, 34,203,138,149,254,107, 72,
- 86,201, 24,180,204,209,209,113,153,163,163,163,209,245,235,215,205,235,212,169,  3,154,166,181, 31,106,178, 58,117,234,180, 36,
- 48, 48,208,209,195,195, 99, 58,128,173,255, 11,109, 39, 73, 76,252,121,247, 20, 27, 83, 65, 74, 58,222,109, 42,201, 37,200,  1,
-148,133,192,221, 99,224,182, 95,154, 56,253,219,  5,150,  1,  7, 87, 78,100,192, 84, 26, 33, 27, 23,159,138,221,187,119, 96,182,
-255, 24,252,246,235,207, 96, 24, 46, 52, 58, 14,220,234,182,131,134, 98, 64,144, 92, 52,107,209, 10,119,238,222,  7,143,  4, 78,
- 29,220,253, 47,227, 89,200,139,140,140,220,117,254,252,249, 25,179,102,205,  2,195, 48,130,229,187,119,171,178,179,179,215,162,
-102,249,175, 62,196, 25,184,123,247,238,152,128, 29,217,231,102,143,  4, 39,233, 34,145,247, 34, 26, 86,223, 45, 96,113,122, 61,
-129,150, 13,145, 39,170,120,138,191,247,193,246,223, 65,180, 74,153,100,249,109, 69,210,194,179,222, 79,230, 86,150,227, 72, 83,
-103,155,249,179,166,114,227, 51,212, 56, 83,103,132,252,246,225,109, 38, 25,180,112,123, 28,212, 91,106,242,199, 39,110,223, 46,
-123,191,225,248,241, 10,143, 73,191,251,206,224,149, 89,101, 90,172,154,106,178,  0, 64, 36, 18, 89,116,239,222, 29, 93,187,118,
-197,224,193,131,203,124,178,154, 55,111,142,160,160, 32, 12, 26, 52,  8, 97, 97, 97,112,116,116,196, 23, 95,124,129, 47,190,248,
-  2, 87,174, 92,169,233, 32,  7,189, 94, 15, 31, 31,159,210,168,195,166,105,105,105,102,181,237, 72,141, 70,131,220,220, 92, 88,
- 89, 89, 65, 32, 16,160,109,219, 54,152, 49,179, 45,108, 28, 15,192,199,187, 33, 20, 10, 69, 89,248,187,  1,147,173, 79,131,  6,
- 13,144,157,157,141,236,236,108,216,218,218,194,201,201,  9, 14, 14, 14,216,180,105, 19,187,117,235,214,107, 20, 69,237,202,201,
-201,169,177, 38,203,193,193,161,  3, 65, 16, 75, 84, 42,149,160,220, 10, 87, 96,107,107,123, 65,165, 82,173,149, 74,165,  6, 59,
-130, 18,  4,  1,138,162, 64, 16,  4, 46, 39, 56, 65,161, 37, 80,152,246,  2,179,250,187,191, 71,188,120, 60, 94,181,230, 82,150,
-101, 21,126,126,126,118,174,174, 46, 72,141,123,141,211,167, 89,252,242,203, 47,165, 81,145,136, 41, 89, 24,148,238,119,238,220,
- 25,117,235,214,  5, 91,131, 92, 25, 12,195,224,213,171, 87, 56,126, 33,  4,142,238,222, 72,121,247, 22, 47,175, 92, 68, 29, 91,
- 43, 52,110,209, 10, 58,157,238,147, 82,111,252, 17,162,211,233,246,123,122,122,178, 90,173, 54,  4,192,142,136,136,136, 49, 82,
-169,212,255,247,223,127,119, 26, 50,100, 72,250,197,139, 23,183,  0, 56, 24, 17, 17, 49,101,213,170, 85, 93,105,154,174, 48, 90,
-144,195,225,252, 54,103,206,156, 78, 67,134, 12, 33,248,164, 78,123, 61,248, 16,151,166,117,196,188, 69,251,245,119, 31,132,144,
- 52,173, 35,  6,251,205, 97,174,220,142, 32, 39,207,220,160,111,222,174, 15, 34, 35, 35, 29,250,246,237,187, 74,167,211, 85, 73,
-180, 74, 53, 85,149,105, 40, 57, 28, 14,198,140, 25,131,160, 32,195, 61,168,198,  3, 30,102,238,226,199,107,118,118, 19, 19, 92,
-121, 57,146, 85, 31,151,206, 63,145,101,190, 75,255, 87,145, 44,  0,200,205,205,221, 11, 96, 47,195, 48,153, 38, 38, 38, 40, 42,
- 42,170,232,254, 51,138,136,136, 48, 18,  8,  4,232,209,163,135,213,205,155, 55, 99, 72,146,220,154,158,158, 94, 41,227,168,200,
- 76, 88,145, 57, 17,159, 16,117,104,105,139,190,109, 59,180, 48,141, 54, 95,105,106,196, 85,135,213,137, 49, 50, 35,  0, 20,104,
-236, 19, 66,147,135, 21, 18, 89,194,230,173, 58,183,132, 25,215,164,175,140, 46,170,144,104,145, 28,206,203,130,124, 89,239,194,
- 34, 45, 30, 60,140,132,223,176,  6,208, 80,  4, 24,134,132, 92,161,  1, 56, 60,144,  0,134,143, 24, 13,150,224, 34, 47, 51, 29,
- 28, 14, 39,  2, 52,141,127,153, 44,156, 50,101, 74,239, 69,139, 22,213,155, 63,127, 62,230,207,159,239, 30, 24, 24,184,119,205,
-154, 53,243,179,179,179,155,160,154,228,227, 85,224,212,185, 24,180,116,238,133,251,123, 10,250,124,165,122,215,178, 97,177,230,
-171,101, 67,228,241,120,136,229,114,144,203,178,239,187, 25,245,237,219,183, 99,249,237, 63, 76, 62,116,130, 47,219, 55,200, 71,
-171, 65, 61,231, 94, 45,154,251,204, 92,188,104,177,105, 84,232, 93,  4,252,180,131,245,108,213,189,104,239,253,151, 90,185, 73,
-221,222,242,156,216,135,134,242, 11,  0,232,213,101, 16,154, 54,106,243,209, 65,223,206,197,201,218, 31,220,121,142,204,108,137,
-193,147,109,  9, 57,168,208, 39,203,144,144,254, 15, 69,165, 82,201, 34, 35, 35,237,210,210,210,222,115,124,175, 91,183, 46,  8,
-130,192,147, 39, 79,240,248,241, 99,248,249,249,129,203,229,130,199,227, 33, 36, 36,164, 70,218,152,114,218,165,210,168,195,158,
- 46, 46, 46,149, 69, 27, 86,139,165, 82,169, 80, 80, 80,128,224,224, 96, 52,104,208,  0,107,214,172,129,147,163, 61, 22, 47,158,
- 11,134, 97, 80, 88, 88,  8,189, 94,111,168, 70,139, 41,213, 22, 49, 12,131,236,236,108,212,171, 87, 15, 59,119,238,196,150, 45,
- 91, 86, 73,165,210,223,107,218, 70, 87, 87, 87, 11,189, 94, 63,175, 79,159, 62,221,191,253,246, 91,244,236,249,126, 62,214, 99,
-199,142,153,158, 57,115,102,237,182,109,219,122, 81, 20,181, 46, 43, 43, 43,219, 16,220,  3,  7,138,211, 47,137,218, 45, 67,192,
-144, 58, 24, 53,237, 16, 54,109, 58, 11,161, 80,248,222,196,187,114,229,202, 42, 73, 12,195,178,158,252,156,208,244,185, 11, 54,
-218,173, 93,123, 19, 55,111,102,129, 36, 73, 56, 58, 58,130, 36, 73, 36, 38, 38,130, 36, 73,184,187,187,131, 36, 73, 72, 36,146,
- 82,159,192,124, 84, 16,245, 88,241, 42,156,132, 90,173, 70,106, 74, 18,210,226, 98, 32, 46,204,128,173,153,  8,249,175, 95,161,
-233,248,137,101,249,159,254,102, 57,162,213,106,143,148,219,223,120,241,226, 69, 45, 65, 16,131, 81,236,167, 81,170,209, 88, 69,
-211,244,170,202, 64,218,181,107,215,124,209,162, 69,188,210,116, 27, 78,110,171,105,138,162, 24,  0,104,216,244,235,247,216,126,
-108,108, 44, 54,109,218,  4,133, 66,  1, 62,159,207, 55,228, 58, 48, 12, 83, 22, 97, 88, 17,  9,171,  9,201,  2,  0,107,119,151,
-237, 79, 94,132,232,195,227,246,168, 34,162,175, 26, 75, 83, 72,144,218,127, 47,201,250, 80,179,229,226,226,178,140, 97, 24,150,
-101,217,165,229, 14,  9,221,220,220,238, 95,191,126,221,154,166,105,108,219,182,205, 34, 35, 35,195,226,235,175,191, 14,  0, 80,
- 41,209,170,200, 76, 88,145, 57, 17,229,162, 14,133, 66,161,149, 86, 91,169,242,228,163,168, 67,189, 30, 94,102,166, 22,200, 71,
- 26, 52, 54,186,230, 50,107, 58,239,134,116, 98,152, 83,114,139, 70, 38,122, 93, 61,178, 80, 11,103,145,  5, 24,150,173, 52, 52,
- 90,163,211, 93, 13,123,241,178,135,155,107,  3,206,239,151,238, 97,192,192, 33,208,104, 72,168,117,  4,  8, 14, 15,  4,135,143,
- 38, 77, 91,224,139,198, 77,193,  2,120,254, 52,148,214,234,116, 55,254, 77,125,239,216,126,134, 31, 65, 96, 43, 88,134,173, 32,
-143, 86,189,129,  3,  7,174,  5, 48,179, 58, 28,187,118, 51,252, 72,178, 24,167,124, 30,173, 57, 51,166,224,245, 83,158,249,189,
- 23,235,249, 61,219,225,114,246, 77,  2, 34,163,255, 70, 29,242,200, 79, 74,205,241, 79, 33, 92,213, 19, 45, 87, 87, 87, 11, 51,
-161,209,129,239,199,143, 51, 77, 14,127,132,140, 55, 79,240,240, 94, 76,254,137, 51,103,243, 20,185, 89,227,107, 64,178,202,204,
-124,214, 14,117, 80,215,251, 99,162,101, 36,182,  5,  0,212,245,110,  3,142, 73,205,210,  8, 85,164,205,170, 13,201, 42, 63, 96,
- 87,148, 67,107,242,228,201,  8, 12, 12, 68,251,246,237,225,233,233, 89, 54,216,215, 84,107, 86,129,118,169,198,209,134,229,165,
-168,168,  8,238,238,238,216,183,111, 31, 34, 34, 34, 96,106,106, 10, 63, 63, 63, 20, 21, 21,149, 17, 44, 67,157,225, 89,150,141,
-189,126,253,122,235,161, 67,135,178, 60, 30,143,144,201,100,176,176,176,192,206,157, 59, 21, 82,169,244,114, 45, 72,214, 16, 62,
-159, 63,119,216,176, 97,156,134, 13, 27, 34, 51, 51, 19,102,102,102, 58,130, 32,120,  0, 96, 97, 97,161, 51, 54, 54,198,148, 41,
- 83,208,172, 89,179, 14,243,231,207,111,207,229,114,119,166,167,167, 31,170,234, 94, 34,  8,162,108, 66, 29,191,245, 45,180,218,
-226,  9,122,215,174, 93, 40,241,117,251,175,137, 32, 46, 14, 48, 32,146, 69, 44, 22,195,211,211,179,194,190,239,208,161,  3,158,
- 63,127, 94,108,154,228,114, 97,103,103,135,135, 15, 31, 26, 20, 73, 85,154,  8, 50, 50, 50, 18,222,117,109, 16,113,243, 58,108,
- 68, 60, 52,115,114,128, 75,135,142,136,137,137,249, 59,181, 89,  4,138,253, 48,186,149,220,131,251,  1, 76, 46,183,191, 19,192,
-246,154,  0,210, 52,205,146, 36, 73,164,166,166, 82, 34,145,136,176,178,178,226, 10,133, 66,104, 52,154, 50,194, 21, 27, 27,139,
- 75,151, 46, 33, 45, 45, 13, 86, 86, 86,164,185,185, 57, 40,138,202, 55,  4,223,203,203, 11, 14, 14, 14,239, 57,190,143, 31, 63,
-190, 86, 36,107, 12,224, 19,184,122, 93, 29, 33,201, 49,247,182,233,133,132,183,137,106, 82, 11,163,255, 15, 36, 11,  0,100, 50,
-217, 94,  0,123, 75,247,109,108,108,198,114, 56,156,197, 26,141,198, 60, 36, 36,196,194,214,214,150, 56,116,232,144,110,233,210,
-165, 50, 14,135,147, 79, 16,196,230,191,159, 28,226, 77, 78, 65,156, 59,207,210,137,  9, 87,179,161,254,169,  1, 95,228,243, 26,
-216, 18,141,125, 48, 48, 43,234,193, 88, 58,238,171, 76,105,  6,201,130,121, 83,197, 24,188, 63, 96,209,202,121, 49,111, 95,186,
- 25,153, 25, 97,242,148, 69,184,124,237, 14,  8,146,135,251,161, 79,160,165,244,200,201, 43,192,176,225, 35,225,226,104,131, 55,
-143,131,179,105,134,217,249,239, 34,217,204,142, 30,  3,198, 90, 10,141, 69, 37,215, 68,143, 35,191,206,  5, 73,110,197,143, 63,
-254,  8, 31, 31,159,105,145,145,145, 43, 80, 77, 30, 45,130, 96,118, 52,233, 56,220,146, 47, 44,198, 97, 25, 61,246,157, 10, 40,
-201,163, 53, 27, 59,247,158,105,210,184,110,194,242,170,242,104,253,139, 72, 86,249,109,213, 68,203,221,221, 93,104,194,195, 36,
- 30,135, 59,255,251, 17,223,218,102,197,189, 70, 90,212,203, 98,243,  2,165,162, 50,222, 69, 25,146, 10,189, 27,222,207,223,193,
- 86,101,186, 82,171, 13, 90,209,191,135, 89, 58,225,126,168,205,170, 33,201,250,  8,179, 60,217, 42,159, 55,203,213,213, 21,107,
-215,174, 53, 36,143,214,135,231, 94, 42, 61, 81,236,  0, 95,222, 25,190,167,129, 36,171, 66, 76, 91, 91, 91,228,230, 22,103, 72,
-232,212,169, 19, 58,117,250,111, 60,  3, 69, 81,101, 90, 44, 83, 83,211,138, 52, 90, 31, 97, 26, 27, 27,  7,156, 61,123,118, 92,
-104,104,232,208, 31,126,248,129,215,181,107,215, 82, 50,167,132, 97,181,221,222,195,212,235,245, 83,130,131,131, 57, 12,195, 96,
-223,190,125,120,254,252, 57, 43, 18,137,150,136, 68,162, 29,198,198,198,122,149, 74, 53,121,226,196,137, 35,151, 47, 95, 78,118,
-232,208,  1,143, 30, 61, 34,235,213,171, 55, 26,120, 47,137,101,133,231,254,228,201, 19,144, 36,  9, 58, 47,  5,211,  2, 78,192,
-196,152,139,183,111,223, 34, 47, 47,239,163, 36,166,134, 92,207,242,154,146,210, 87,135, 14, 29,202,204,144,109,219,182,  5,135,
-195, 65, 88, 88, 88,101,102,216,242,152,172,181,181,117,217,253,193,231,243,113,231,206, 29,252,244,211, 79,112,179,178, 64,126,
- 84,  4, 28, 58,117, 65,247,113, 19,225,231,231,  7, 14,135,  3, 43, 43,171, 50,205,175,  1,247,210,167, 72,121,204,113,222,222,
-222,163,223,188,121,227,210,164, 73, 19,199,200,200,200,206, 62, 62, 62,238, 17, 17, 17,165,251, 66, 24,230,155, 83,134,249,236,
-217,179,211, 59,118,236,152, 50,102,204, 24, 62,195, 48,250,228,228,100, 29,  0,194,193,193,129,243,236,217, 51,230,247,223,127,
-135, 74,165,130,139,139, 11,233,236,236, 76,220,184,113,131,137,138,138,122,194,178,236, 34, 67,206, 93,175,215,191,151,198,161,
-244,253,177, 99,199,106,252,188,215,249,194,107, 77,215,175, 27,186,230,164,135, 65, 42,137,131,190,192,150,186,116,254,162,166,
-134, 36,235,207,238,163,191, 18,115,229,187,119,239,156, 53, 26, 13,  4,  2,  1,118,237,218, 69,173, 93,187,246, 77, 78, 78,142,
- 47, 42,142, 40,127, 15,179,150, 81,135,121, 85, 96,126, 20,117, 88,144,139,203,231, 47, 60,107, 45, 30,184, 31,211,210,179,203,
- 28, 27, 89,130,176, 58,107,223,200, 87,212,166,137,132,188,178,140, 44,210, 43, 47, 87,113,238, 90,149, 86, 59,100,224,160,225,
-183,130,130,142,139,151, 46, 91,134,135, 79, 34,144, 43,147,131, 97, 57, 96,  8,  2,139, 23, 47,133,131,141, 21, 10,211,223, 41,
- 53, 20, 53, 16,239,231,208,250,199,247, 59, 65,144,211,111,252,126,104, 43, 73,128, 81,100, 70, 11, 57, 69,113,162, 81,126,  3,
-185, 67,134, 12,193,217,179,103, 17, 25, 25,185,167, 10,146, 85,134,201,178,228,244,136,144, 19, 91,  9,128, 81,101, 71, 11,185,
-242,  4,209,232, 17,  3,185,126,126,126, 56,119, 41, 20, 65, 23, 19,118,  7, 93,196, 69,252,187,165,230,153,225, 77,185,136,244,
-109,228,225,220,161, 69, 99, 35,174, 94,133,180,168, 56,228, 41,212,184,241, 58, 89, 70,178,100,173,115,235, 20, 15,144,124,164,
-164,188,171, 96,101,101, 84, 50,161,171,107,132, 73,146,228,123,218,172, 79,209,100,149,111,167,189,189,253,123,229, 92,202, 79,
-220,165, 62, 64,181, 72,237, 16,144,146,146, 98,150,146,146,  2,150,101,241,228,201, 19,179,182,109,219,  6,124,138, 54,107,238,
-220,185,101, 90,171, 15,183, 21,125, 86,157,148, 56,165,111,209,233,116,167,230,207,159, 63,173,109,219,182, 61,150, 45, 91, 70,
-160,  6,  5,120, 63,208,230,208, 12,195,224,238,221,187, 56,123,246,172,158,162,168, 73, 82,169, 52,162,220, 87,182,189,120,241,
-226,198,160, 65,131, 14, 69, 71, 71,115,222,188,121,  3,150,173, 62,238, 84,165, 82,193,211,211, 19, 52, 77, 99,253, 52, 87, 20,
- 21, 53,  1, 77,211,208,235,245, 48, 49, 49, 41,211,226,149, 39,207,213,221, 71,122,189,254, 35,162,245,228,201, 19,112, 56, 28,
-248,250,250,226,229,203,151,101, 26,173,234, 52, 80, 20, 69,165,216,219,219,219,175, 92,185,178,172, 93,217,217,217,184,126,253,
- 58,218,125,249, 21, 26, 77,154,140,244,244,116,108,222,188, 25, 78, 78, 78, 88,179,102, 13,242,242,242, 64,211,244, 95,173, 78,
-239,253,230,205, 27,151, 17, 35, 70,100, 69, 68, 68,184, 92,186,116,201,162,111,223,190, 38,195,135, 15,207,138,136,136,112, 33,
-  8,226, 43,212,208,  9,154, 97,152,133,139, 23, 47,190,182,102,205,154,128,153, 51,103,182, 29, 51,102, 12,143,199,227, 49, 18,
-137,132, 62,126,252, 56,225,233,233, 73,242,249,124, 34, 56, 56,152,121,250,244,233, 99,154,166,215,  3,184, 95, 19,141,115,121,
-146,197,225,112, 12, 37, 89,239,137,191,157,112,180, 41,153,237,187, 99,215, 90,178, 97, 93, 23,234,240,241,235,169,247, 31,189,
-139,231,104,104,255,  3, 85,164,  6,248, 55, 11,135,195, 57,233,237,237, 61,118,250,244,233,198, 61,123,246, 20, 46, 95,190,188,
-160,168,168,168, 50,146, 85,193,130,249, 47,137, 58,252,117,225, 15,151,252,231, 52, 25,235, 49,193,161, 14,110, 42,178,144,207,
-229,144,102, 22, 36, 90,184,115, 80,148, 19,107,123,241,214,193, 68,  0,213,229,101,123,246,226, 85,100,183,198, 77,154,159, 89,
-191,102,189,221,146,  5,243,121,103, 46, 93,  5, 75, 83,120, 18, 18,  2, 49, 95,207, 70,189,184,153,169,161,180,223,226, 95, 88,
-130, 71,250,112,123, 16,128, 11, 86, 86, 86,225,227,198,140,241,244,246, 30, 14,145, 72,132,211,167, 79,227,200,182,109,250, 45,
-192, 80, 33,240,114, 74, 53,249,244,178, 30,151,225,132, 77, 28, 55,206,171, 69,139,  9, 16,137, 68, 56,117,234, 20, 14,109,217,
- 98, 48,206, 63, 92, 74, 51,195, 95,198,127, 51,196, 87,227,163, 69, 18, 69,143,223, 37,203,159,188, 75,150,131, 97, 89,134,101,
- 53, 36,137, 84,  5, 69,173,121,151, 32,169, 21, 41, 40, 53, 29,174, 90, 61,253,143,179,121,148, 35, 63,181, 13,233,174,128,100,
-165,149,175,145, 86,126,146,174,236,189, 78,167, 75, 51, 16,126,157,155,155,219, 71,159,213, 94,245,203,214,136,100, 25,154, 71,
- 11,  0,114,115,115,165,  0,150, 60,122,244,232, 88,143, 30, 61, 38,  2,144,212,178,143,246,117,236,216,113, 18,  0, 14, 65, 16,
-123,210,211,211, 35, 62,122,224,165,210, 24, 39, 39,167, 13,117,235,214,157, 92,188, 48, 37,246, 85, 51,145, 39, 52,105,210,132,
-170,168, 47, 42,219,103, 24,166,218, 62,146,201,100,104,211,166,205, 71, 53, 45, 89,150, 69,114,114,114,169,198,169,236,218, 87,
- 69,224,228,114,249,228, 25, 51,102,236,229,241,120,110,  0,136, 82,146,171,215,235, 57,219,183,111, 55,210,235,245, 28,  0,  4,
- 73,146, 52,143,199, 83,159, 61,123,150,166,105, 58, 69,163,209, 76,254,139,  7,136, 83, 68,113, 41,  6,197,155, 55,111, 26,150,
-104,178,210, 34, 35, 35,195,130,130,130,108,  1,156,168, 37,238,125,165, 82,121,127,237,218,181, 29,118,237,218,181,112,242,228,
-201,109,252,252,252,184,157, 58,117,194,229,203,151,245,119,239,222,125,162, 82,169,214,213,132, 96,149,244,101,129,171,171,107,
- 25,225,170,230, 89,174,210,145,215,218, 93,184, 99,228, 84, 39,163,125,235,174,203,115,210,181,161, 58,185,118,209, 65, 32, 18,
-255,143, 37, 51, 51,243,  7,  0, 75, 55,111,222,156,222,172, 89, 51, 33,159,207,215, 26, 74,178,254, 66,161, 25,153,252,155, 95,
-186,127,119,161,227,226, 25,117,187,119,246, 21,185,214,177,115,142,138,203, 68,236,163,203,138,240,139,171,147, 88, 77,254,  0,
-  0,134,120,174, 63,213, 80, 84,131,185,243,231, 78, 19,240,120, 61,244,122,125,211,174, 55,206,179, 28, 14, 39, 66,171,211,221,
- 40, 49, 23,170,255,197, 93,190,106,195,134, 13,158,222,222,222, 56,125,250, 52,110, 28, 61,138, 97, 57, 57,184,195,225,112, 72,
- 62,223,250, 34, 69,109,132, 97,  4,105,213,166, 77,155,188,124,124,124,112,242,228, 73,  4, 31, 58,132,161,181,195,169,108,174,
-107, 13,192,182,100, 55,  7, 64, 52,128,150,  0,140,  1,104, 80, 92,218,201,166,252, 20, 86,114,172,244,248, 61,130, 32,254, 76,
- 71,216,234, 51,195,127, 40,145,177, 73, 45,255,232, 86,168, 84,170, 60, 79, 79,207, 26,197, 92,235,116,186, 42,109,184, 52, 77,
-167,121,120,120, 24,172,181, 48,132, 20,229,229,229,181,250, 19, 59,227,147,124,177,222,155, 68, 24, 38,201,209,209,145, 41,157,
-244, 43, 34, 97, 21,125,198,  2,137, 53,249,159,140,140,140,104,  0,115,106,219,206,244,244,244, 51, 48,160,104,180,161,223,  3,
-128,252,252,252, 63,188,152, 47,193,178,146,229,203,151,215,136, 96,131,101,171, 34,159, 17,114,185,188,173, 33,255, 77, 81, 20,
-254, 70, 57, 89,242, 34, 35, 35, 35, 39, 18,  4,209, 19,197, 38,129, 61,248, 99,178,121,223, 47, 44, 44,188,255,243,207, 63,119,
-216,183,111,159, 63,203,178, 40, 44, 44,220, 82, 83,130, 85,182,122,206,202,186,252, 71,157,120, 94,166,246,246,241, 61,105, 93,
- 84, 50,202, 63, 80,174, 61,132,207, 82,166,140, 98, 89,246,183, 81,163, 70,181,  3,112,240, 83,193, 42,137, 58,252, 84, 73,100,
-242, 11,154,221,153,251,211,184, 59, 22,166,125,160,231, 54,132,150,188,  8,109,238,101,  0,  7, 96,152,155, 67,217,249,210, 12,
-179,137,214,106, 55,149,155, 92,254, 63,244,179,149,143,143,143,255,216,177, 99,177,116,233, 82,  4,111,220, 72, 77, 37,136,  2,
- 30,192, 94, 43, 94,104,146,  4,176,192, 80,156,209,163, 71, 99,233,210,165,184,178,126,125,109,113,170, 18, 91,130, 32, 46,  1,
- 64, 64, 64,192,162,181,107,215, 90, 46, 92,184,176,233,186,117,235,214,148,236,191, 46, 61, 94, 50,215,245, 93,184,112, 97,227,
-114,199,139,  0, 60,251,147,175,103,133,153,225,255,108,233,246, 25,243, 51,230,103,204,207,152,159, 49, 63, 99,126,198,252,140,
-249, 41,194,178,108,159,226, 77,229,219,202,222,151,219,254, 45,194,197,103,249, 44,159,229,179,124,150,207,242, 89, 62,203, 63,
- 80,202,107,177,106,115,252, 15,148, 82, 31,173,242,178, 15, 40, 14,235,174,140,149,214, 36,234,161, 54,204,246,230,103,204,207,
-152,159, 49, 63, 99,126,198,252,140,249, 25,243,255, 29,102,117,216, 31,253,158,101,217, 62,  4, 65, 92, 98, 89,182,111,101,219,
- 82, 98,245,225,251,114,219, 63,204,237,160,  2, 41,245,205,250,200, 71,235,207,150,207,106,213,207,152,159, 49, 63, 99,126,198,
-252,140,249, 25,243, 51,230, 39, 73,169,  9, 16,  0, 27, 16, 16,176,240,127,208,116,232, 88, 66,178,202,191,  0, 84, 97, 58,100,
-217, 83, 28,137,  4,102,  2,129,136, 15,  0, 90,173,146,114,118, 70, 33, 65, 12,249, 59, 11,222,126,150,127,166,148,134,123,103,
-254,193,223,253, 44,159,229,179,124,150,207,242,255, 67,178, 75, 53, 85,  0,178,  1, 16, 37,251,218,146,109,118,  9, 33,251,240,
-253,123,199,255, 68,145,162, 18, 77, 22,183, 50,146,149,147, 35,178,225,114,243,189,244,122,245, 23,  0,192,229,146,111,115,114,
- 44, 99, 88,246, 84, 78,109,200,150,141,157,221, 11, 30,135,227,108,200,119,117,122,189, 36, 39, 51,243,253,212,241,  4,241,111,
- 32,120,134,146,136, 79, 33, 27,127, 58, 81,177,177,177,177,183,183,183,239,111,102,102,246,165, 76, 38,123,154,157,157,125,174,
-138,186,135,107,  9,  2,243,139,239, 43,252, 12, 96, 97, 21,208, 53,249,238,135,226, 41, 18,137,166, 17,  4,225, 83,242,128, 69,
- 42,149,202, 93,  0,222,253, 63, 28,144,140,  1,124,203,229,114, 71,219,216,216,180,201,200,200, 88, 14,160,182,217,188,185,  0,
-230, 90, 88, 88, 12,179,176,176,240,200,203,203,139, 47, 44, 44, 60,  9, 96, 19,128,106, 67,165,151,207,116,252,178, 83,207, 78,
- 75,238,  6,223, 93,181,124,155,244,209, 71,199,231, 58, 90,247,232,222,126,233,221,139,161, 43, 23,237, 76,207,171, 97,219,200,
-146, 23, 80, 28, 29,201,226,227,100,175,159, 42, 60,  0,253,  0,116,  2,112, 23,192, 69, 67,206,187, 18,105,  7, 96, 81, 73,155,
- 55,  1,184,243, 63,126, 31,153,216,219,219,175,  7,208,143,203,229,190,145, 72, 36,147,  0,164,253,205,109,226,  2,104, 13,192,
-  7,197,105, 56,158,193,176, 20, 14,213,138,181,181,117, 95, 46,151, 59,173, 36,181,203,174,220,220,220, 75,255,171, 29, 35, 16,
-  8,182, 56, 56, 56, 76, 80,169, 84, 74,130, 32,216,242,249, 30,105,154, 78,203,201,201,105,245,111, 27,212,  8,130,120,246, 63,
-222,196, 73, 21,124, 86,121, 30, 45,137,  4,102, 92,110,190, 87, 86, 70,196,176,116,233,171,161,  0,224,228,216,244,164,157, 67,
-147, 19, 18,137,128,114,104, 56, 80,204, 19,113,119,113, 56,188,230,106,173,198,134,199,229,229, 80,180, 46,140,212,178,211, 50,
-162,207, 85,152,108,145,199,225, 56, 39,197,220,177,163,169, 60,240,140,156,192, 51,118,171,180,181, 78, 78, 78,181, 58, 75, 75,
- 75, 15, 83, 74,104,228,207,227,113,186, 51, 44,237,195, 50,  0, 73,240, 34,105,189,238, 22, 95,163,249, 37, 63, 63,190,168,182,
- 87,176,161, 53, 28, 88,192, 15,  4,186,131,197, 13,  2,  8,138,206, 69, 70, 13, 32, 12, 37, 17,159, 66, 54,202,255,118, 51,128,
- 31,254,232, 59,201,217,217,217,178,111,223,190, 91,126,250,233, 39, 99,177, 88, 76,164,164,164,244, 92,176, 96,193,215,207,159,
- 63,159, 35,145, 72,210, 63, 36,125,  4,129,249, 12,195,146,  0, 64,146,196,  2, 91, 91, 59, 17,135,195,249, 40,183,145, 94,175,
- 23,101,103,103, 77,103, 24,150, 40,249,238,124,150,197, 86, 67,  8,163,145,145,209,112,159, 38,205,231,172,223,176, 73,108,111,
-103,103, 66,235, 25, 42, 49, 57, 73,180, 36,224,135,182,113,177,239,182,170,213,234,227,181,121,174, 57, 28,206, 48,161, 80,216,
- 23,128,119,201,103, 81, 26,141,230,146, 94,175, 63, 97,232,132,110,111,111,127,143,195,225,212,169,201, 31,235,245,250,148,204,
-204, 76,223, 90,118,209, 16, 55, 55,183,  3, 29, 59,118, 20,181,105,211,  6,  2,129,  0, 75,151, 46,157, 43,149, 74,171, 35, 90,
- 92,  0,115, 69, 34,209, 48, 19, 19, 19, 15,185, 92, 30,167, 82,169,206,  8,  4,130,110, 91,183,110,117,109,223,190,189,105,102,
-102, 38,193,225,112,236,175, 92,185,242,159, 45, 91,182,244,164,105,186,107,117,147, 92, 65, 28,187, 68,216,207,187, 67, 65,220,
-157, 37,  0,122,127,120,156, 86, 27,141,102, 57,174,125, 85,236,203,212, 18,242, 97, 48,201,226,241,120, 91, 29, 28, 28,198,170,
-139,115,  5,176, 31, 78, 56,  0,160,213,106,243,101, 50, 89,195,218, 60,242,  0,198, 91, 88, 88,140,157, 55,111,158,101,239,222,
-189,113,244,232,209,239,  3,  3,  3,243, 11, 11, 11,127, 67,113, 34,204,232, 26, 98,206,207,200,200,248,134,199,227, 17,174,174,
-174, 28,149, 74, 85, 19,162,229,133,226, 34,204,207,  0,236, 66,113,234,130,206, 64,241,243, 14,224,231, 82,226, 70,146,228,174,
-134, 13, 27,246,143,138,138,218, 13, 96, 85,109,159,117,  7,  7,135,189, 59,119,238, 28, 58, 96,192,  0, 78,118,118,182,115,179,
-102,205,142,101,100,100,116,248,  3,134,145,113, 66,161,112,118,211,166, 77, 27, 69, 71, 71,199, 20, 22, 22,110, 42,185,158, 85,
- 61, 83, 46,  0,186, 89, 88, 88,116, 93,188,120,177,184,111,223,190,216,183,111,223, 55,129,129,129,242,162,162,162, 91, 40,246,
-233,249, 36, 18,200,229,114,167,165,165,165,217,176, 44, 11, 71, 71,199,105,  0,254, 39,137, 22, 73,146, 91,  7, 13, 26, 52,246,
-216,177, 99,162,164,164, 36,145,179,179,115, 89,242,108,130, 32,106, 61,127,126,150, 79,150,125,229,  8, 87,245,121,180,  4,  2,
- 17, 95,175, 87,127,145, 46,125, 53,244,235,142,219,205,  1,224, 94,200,140,161,118, 14,141, 35,  5,  2, 81,140,208,204,232,236,
-160,126,221,154,127,215,183, 35,225,226,104,135, 52,105,150,253,175, 65,193,189, 46,  5,223, 57,139,226,  4, 98, 21, 10, 77,229,
-193,152,186,137,232,  7,219, 96,211, 41, 29, 59,174,164,225, 81,120, 34,148,  5, 57,168,227, 96,140, 13,254, 61,224, 96, 41,170,
-221,210,203,206,179, 51,205, 21,158, 24, 49,124,148,121,255,111,189,121,238, 14, 14, 96, 89, 33, 98,226,228, 95, 93,189,126,167,
-245,153, 83,199,167,153,240, 60,135, 41,178,222, 25, 60,184,181,112,132,177,130,194,183, 92, 14,241,159,246,173, 26,117, 29,254,
- 77,  7,178,145,119,  3,188,121, 29,213,227,194,237, 39, 27,200,208,215,183,104, 61,123,216,132,143,243, 47,165, 85, 38,244,251,
-136,112,116,237,218,173,131, 80, 40,124, 47,121,146, 70,163,225,223,186,117,179, 93,109,200, 70,233,127,104,181, 26,146,199, 19,
-128, 36,137, 57, 62, 62, 77,188,115,114,114,238, 16,  4,113, 32, 61,189,102,218,130, 25,128, 32,159,203,109, 73, 10,133,142,122,
-173,214, 26,  0,  8,129, 32, 63,145, 36,155, 44, 94,180, 72,204,225,112,152,220,220, 92, 40,149, 74, 98,226,196,137, 70,113,113,
-113,131, 36, 18,201,182,106, 86, 36,  8, 12, 12,244,114,116,116,252,168,122,172, 84, 42, 21, 12, 24,208,191, 54, 93,239,213,180,
- 89,139,217,193,193,215,188, 11,243,242,213,129,155,247,190,208, 25,137, 52,245,188, 27,242,118,237, 59,100, 62,105,236,200, 25,
-111,223,190, 14, 67,205,234,213,185, 25, 27, 27,159,221,184,113,163, 79,231,206,157,121,118,118,118,200,204,204, 68, 84, 84,148,
-207,237,219,183,191, 61,116,232,208, 92,149, 74, 53,  8, 48,168, 32,170,231,173,195,  7,236, 76,172,172,161,215,233,224,212,180,
- 69, 89,126,179,216,219,215, 65, 83, 20, 24,157, 14,222,125,191, 45,209, 38,179,240,246,246,174,109,214, 93,167,198,141, 27, 31,
- 89,179,102, 13, 95,163,209,224,201,147, 39,184,115,231, 14, 35,149, 74,171, 75,136,203, 37,  8,226,250,178,101,203, 92,124,125,
-125, 77,115,114,114,160,215,235,109,206,159, 63, 63,173,121,243,230,102,174,174,174,130,195,135, 15, 67, 46,151,131,166,105, 43,
- 15, 15, 15,171,225,195,135,107, 15, 31, 62, 60, 23,192,250,202, 52, 89,133,113,236, 18, 41,225,209,171, 97,203,209,200, 32,174,
-245,154,221, 11, 87,205,234, 19,101,154,173, 94, 30, 30,166,133, 18,209,  2,177, 89, 19,171, 66,201,205,  5,189, 60, 60,  2,175,
-197, 27,180, 24, 34, 75, 38,155, 17, 65, 65, 65,162,168,168, 40,145,183,183, 55, 24,134, 41,203,192, 95,154,112,214,211,211,179,
- 54,215,113,221,148, 41, 83, 22, 12, 29, 58, 20, 77,155, 54, 45, 75,138,250,227,143, 63, 98,193,130,  5,150,247,238,221,155,123,
-252,248,241,185,231,206,157, 91, 15, 32,160,134,218,152, 82,169,105, 31,175, 72, 72, 72, 24,114,246,236,217,145,243,231,207,247,
-  4, 48, 29,192,210,220,220,220,142, 37,218, 24, 65,  9,209, 26, 55,119,238,220,169,  1,  1,  1,248,230,155,111,150, 62,121,242,
-100,117, 45,181,124, 28,154,166,191, 25, 48, 96,  0, 71,167,211,193,196,196,  4, 58,157,174,254,167, 42, 37,  0,236,156, 60,121,
-242,212, 41, 83,166,192,210,210, 18, 58,157,206, 43, 40, 40, 40,112,233,210,165, 95,  2, 24, 95, 73, 91, 71, 79,157, 58,117,129,
-137, 32,113,  0,  0, 32,  0, 73, 68, 65, 84,240,168, 81,163,208,170, 85, 43,112,185,197,151,113,227,198,141, 88,185,114,165,248,
-250,245,235,223, 30, 62,124,248,219, 11, 23, 46,156,193,251,101,187,106, 36, 12,195,128,203,229, 34, 53, 53, 21,118,118,118, 66,
-134, 97,130,  9,130,216,151,151,151,119,238,127,104, 50,255,121,200,144, 33, 35,142, 29, 59, 38,  6,128, 13, 27, 54, 96,246,236,
-217,176,183,183,135, 88, 44,254, 76,117,254,119, 52, 90,147,170,213,104, 85, 39, 74,165,178,197,194,153,255,  1, 73, 22,175, 26,
- 27,212,115,195,218, 69,147,136, 11,151,130, 91, 84,169,131, 55,114, 66,244,131,109, 16,186,250, 67,163,163,241, 56, 60,  1, 55,
- 54,244, 44,158, 45,123, 47,134,134,234, 90, 58,217, 88,  9,140,141,127,214,234,245, 15,225,224,240,  4,201,201,217,213,145, 44,
- 91,  7,251, 75,123,246,172, 55,246,169,223, 16, 20,173,131, 36, 75,  2,130, 16,194,197,217, 20,227, 70,247,230,117,236,232,100,
-179, 98,197,222,203, 25, 12,  6, 42,115,222, 85,155, 48,212,203,  6,  7, 91,248,120, 14, 29,222,199, 87,216,196,167, 49,248, 66,
-227,178, 99, 45, 91,181, 66,203, 86,173,200,  0,121, 81,247,167,207, 94,116, 63,125,253,177, 70,169, 75, 62, 25,147,131, 49,213,
- 12, 50,101,132, 99,214,172, 89,176,183,183,127,239, 11,153,153,153,184,125,251, 86,133,191,169,193, 64, 86,246, 31,171, 87,175,
- 54,205,207,207,239,189,127,255,254, 46, 12,195,172,206,200,200,120, 96,  8,200, 40,160, 78,129, 80,216,117,236,166, 77, 76,243,
-254,253, 57, 22, 14, 14, 36,163,215, 19,233,241,241,214,155,183,109,235,148, 23, 27,107,172,176,178,202,203, 87,169,148, 49, 49,
- 49, 48, 50, 50, 34,184, 92,110,235, 10,160, 50, 89, 22, 63,147, 36,177,128, 32,  8,  8,133, 70, 49, 83,166, 76,121, 89,114,172,
-206,197,139, 23, 69,253,250,245, 83,  2, 72,  2,  0,161,208,200,153,195, 33,189,138, 51,177,227,103, 67,  8,166,137,137,201,204,
- 85,107,214,155, 20,230,201, 84,148, 66,161,179, 53, 19, 19,132,216,148, 83, 88, 80, 84, 36,145,102,107, 22, 47, 95,201,153, 60,
-110,212, 76,133, 66, 49,205, 80,146,213,172, 89,179,167,103,207,158,181,179,182,182,134, 76, 38, 67,110,110, 46,158, 62,125, 10,
-134, 97, 48,104,208, 32,225, 87,109,219,180, 88,180,120,201,163, 84,137,228, 75, 67,200,150,137,149, 13, 54,248, 54, 47,158,172,
-147,114,203,250,103,223,144,190,101,223, 89,153, 86, 80,170,157,251,148, 18, 82, 95,118,237,218,149, 15,  0,227,199,143, 47, 44,
- 42, 42, 90, 11,224, 24,170,207,232, 63,119,201,146, 37,206,245,234,213,115, 63,118,236, 24,228,114, 57,  0,216,213,171, 87, 15,
- 94, 94, 94,250,187,119,239,194,203,203, 11,166,166,166,184,119,239, 30, 30, 61,122,132, 86,173, 90,153,242,249,252,161, 20, 69,
- 85, 72,180, 58,245,236,180, 68,216,207,187, 67,195,150,163, 33, 54,115, 68,224,241, 19,136,126,113,168,131,134,138, 90,194,215,
-135,140, 82,177,194, 49,217, 41,226,128, 58,173, 58, 90, 55,104,220, 31,238, 45, 95,218,168,245,247, 19,150,116,175,183,142,107,
-164, 62,180,124,147, 52,183, 50,146,  5, 96,195,160, 65,131,134,  4,  5,  5, 89,  0, 64, 68, 68,  4, 50, 51, 51, 97,107,107, 11,
- 35, 35, 35,240,120,188,178,250,164,181,148, 49,187,118,237, 42, 35,109, 52, 77,151, 85,  1, 16,137, 68,248,250,235,175,209,188,
-121,115,156, 59,119,110, 76, 37, 68,203,183,109,219,182, 71,221,221,221, 93,203,127,168, 80, 40,224,231,231,  7,  0,232,216,177,
- 99, 87, 99, 99, 99,182,148, 16, 74,165, 82,249,179,103,207,186,  3,120, 82,  9,179, 84, 73, 36, 18,204,155, 55, 15,137,137,137,
-223,239,217,179, 39, 25,128,145, 64, 32, 40, 91, 31,  3,240,106,220,184,241,214,217,179,103, 35, 46, 46, 14,111,222,188,121,138,
-218,155, 82,245, 38, 38, 38,177, 58,157,174, 21, 77,211, 80,169, 84, 24, 56,112,160,209,153, 51,103, 50, 57, 28,206,219,156,156,
-156,145, 40,246, 73, 49, 84,140,  0,108,154, 50,101,202,212,249,243,231,227,214,173, 91,184,112,225,  2, 70,141, 26,  5,127,127,
-127,136,197,226,177,254,254,254,143, 80, 92,208,252, 67,233,186,107,215, 46,232,245,250,143,158, 13, 35, 35, 35,248,250,250,162,
- 81,163, 70,184,112,225, 66,215, 79, 32, 90,238,190,190,190,  2,134, 97,160, 80, 40,112,247,238, 93,177,177,177,177,216,197,197,
-101, 34,128,255, 25,162,229,238,238, 62, 37, 40, 40, 72, 92,222,250, 35, 20, 10, 81,238, 62,248, 44,127,191, 70,171,202, 21, 86,
-153,104,181, 74,138,203, 37,223, 58, 57, 54, 61,121, 47,100, 70,153,233, 16, 32,223,106,181, 74, 10,  0,244, 12,139, 66, 37, 13,
- 99, 33,137,164,140, 34,188,142,207,169,  8,234,189, 16, 77,158,177, 27,132,109,146,192,178, 44,180,148, 30,154,130, 12,172,189,
-172, 68, 84,154, 26, 90, 69, 62,180, 84,177, 27,150,141,141, 13, 55, 56,248,234,236,155, 55,111, 79,253,237,183,223, 56,105,230,
-230,111,138,128, 22, 21, 97, 90, 90,122,152, 50,  2,193,201,221,123,150, 26,179,156,120,196,164, 40,208,192,165, 13,108, 44, 92,
-145,145,163,192,195, 55, 87,240,246,221, 37,212,115,116,135,255,204, 94, 70,171,214, 28, 59,193,167,235,186,201,100,137,133,149,
-181,179,116, 21,181,247, 90, 12,232,188,120,232,115,227,160, 47, 74,255,232, 11, 98, 91, 55,180,236,236, 12, 91,215,250,194, 49,
-254, 43, 71,  3,239, 17,173,242,152,153,  4, 65,238, 38, 73, 98, 42, 65, 16,104,218,180, 89,218,166, 77,155, 42, 74,  5, 78, 53,
-109,218, 44,141,195, 33, 93,138,  7,118,114, 23,203, 50,153,213,180,243, 61, 82, 35, 16,  8,231, 23,171,253, 29, 83, 47, 95,190,
- 76, 13, 25, 50,  4, 27, 55,110, 20, 44, 88,176, 96, 49,135,195, 25, 95,129,121,239, 61,204,129,128,155, 69,253,250, 61, 86, 63,
-124,200,242,116, 58, 34,239,233,211, 66,153, 84, 74,103, 20, 21,  9, 78,189,125,251,205,132, 31,126, 16,184,186,186,226,193,165,
- 75,214,217, 10,  5, 43,211,104, 84, 50,153,140,165,105,250,105, 37,152, 11,109,109,237, 68,129,129,129, 94, 83,166, 76,121, 41,
-149, 74, 23,  2,128,163,163,227, 90,  0,141,  0, 36,149,251, 12,123,246,156,144, 76,156, 56, 49, 38, 43, 43,107, 97, 85,237, 44,
- 39,141,237,108,237, 68,199,247, 30,126,101,101,106, 76,218,186, 56,145, 60, 11, 11, 46, 45, 48,230, 51,128,170,158,107,125, 19,
-  0,141, 43,249,237,135,152,132,177,177,241,217,223,127,255,221,142,199,227, 65,175,215,195,214,214, 22,137,137,137,144,201,100,
- 40, 42, 42, 66,194,219, 40,212,117,117,197,138,128,  5,142,211, 23,  4,156, 85, 42,149,173, 62,152,204, 62, 46,128,172,163, 62,
-210,236, 85, 84,197,224, 67,179,151,129,253, 94, 94, 18, 83, 82, 82, 32, 22,139,225,227,227, 35,126,248,240,225,253, 42, 72, 86,
-249, 34,192, 67,219,183,111,111,122,236,216, 49,180,106,213, 10,230,230,230,184,123,247, 46, 34, 34, 34, 64, 81, 20, 41,151,203,
- 33, 22,139,177,110,221, 58,184,185,185,161,168,168,  8, 73, 73, 73,214, 60, 30,207,230,131,140,246,101,152,119,131,239,174, 42,
-136,187,179, 36,131,184,214, 43,240,248,  9, 76, 28, 62, 12, 14,108,252,125,243,250,196,170, 30,253,218,255,200,114, 92,251,154,
-152, 54,181,244,244,233,  7,190, 64,140,233,243, 87, 34, 38,242,162,165,178,232,213,247,132, 62,213,117,249,166, 83,179, 42, 56,
-119,  2,  0,233,234,234, 58,225,212,169, 83,166,101,170, 23, 14,167,172,230, 97,249, 34,240, 85, 20,124,175,246,122, 18,  4,129,
-196,196, 68,216,217,217, 65, 44, 22,151, 21, 16,143,138,138,194,227,199,143, 81, 90,141,162, 18,204,145, 55,111,222,116, 53, 49,
- 49,121,239, 11, 44,203, 34, 39, 39,  7, 52, 77, 67, 36, 18, 65,175,215,131,162, 40,232,116, 58,168,213,106,113,163, 70,141,166,
-233,116,186, 39, 21, 97, 50, 12, 51,103,232,208,161,237,159, 60,121,226,177,109,219, 54,104,181,218, 13, 25, 25, 25, 24, 60,120,
- 48, 24,134, 65,215,174, 93,219,177, 44, 27,189,120,241, 98,  0,192,236,217,179,117, 10,133, 98, 74,109,206,189, 68, 26,181,108,
-217,210,227,214,173, 91,232,208,161,  3, 52, 26, 13, 54,110,220,104,182,103,207, 30,179,195,135, 15,219,206,159, 63,255, 64,118,
-118,118,207,106, 48,  9,  0, 27, 28, 28, 28,166,118,234,212,201,184,164,134, 41, 14, 29, 58,132, 21, 43, 86,  4,  1, 88,124,245,
-234,213,101, 23, 46, 92, 24, 61, 97,194,  4,172, 88,177,194, 95, 38,147,237,175, 12, 51, 33, 33,  1,182,182,182, 48, 51, 51, 43,
- 30, 44, 41, 10, 97, 97, 97,184,113,227,  6,190,248,226, 11, 67,206,169,178,118,186, 15, 26, 52,232,192,241,227,199, 77, 83, 83,
- 83,113,239,222, 61,212,173, 91, 23, 74,165,210,144,218,176, 55,255,132,  9,187, 82, 76,149, 74,165, 78, 73, 73, 17,175, 95,191,
- 30,142,142,142,112,119,119,135,145,145, 17,  8,130,128, 78,167,171,170,188, 90,181,237,236,216, 17,220, 28,137,229,  0,115, 11,
-203,239, 89,150,229, 22, 20,228,239,165, 32, 59, 29, 31, 15,237, 95,120,238,255,100,105,  1,224, 37,222,175,121, 40, 45, 35, 90,
-151, 46, 93, 98,251,246,237, 75,148,110,157,157, 81,152,147, 99, 25, 99,231,208,228,132,157, 67,227,146,186, 95,228, 91, 14,199,
- 50,198,222, 94, 89,  8,  0, 20,205, 34,244,173, 12,175, 98, 51, 16, 17,155,  1, 19,161, 97,202, 23, 13, 69, 23,123,172,178, 44,
-212,242,255, 46, 90, 41,101, 62, 52, 84,177,187,135, 86,163, 68, 65,246, 27, 98,200,192,238, 70, 83,167, 78,134,163,163,179,109,
-101,120,148,208,200,127,250,236,111, 44,172, 44,120,184,244,240, 26,218,125, 49, 16, 70, 66, 30,114, 11,212,  0,  1,188,139,191,
-  1, 48,166,136,140, 73, 65,219,198, 34,244,236,225, 45, 62,119, 58,250,  7,  0, 75, 13,105, 47,157,246, 20,124,207,222,224,233,
-117,208,229, 68,131,145, 37,  3, 38, 14, 80, 17, 98,228, 74,147,241,246,254, 25,131,214,140, 12,195,124,111, 99, 99, 35, 91,188,
-120,113,167,  6, 13, 26, 80,211,166, 77, 11, 79, 78, 78,158,243,193,106,229,151, 93,187,118, 33, 54, 54, 86,178,122,245,234,187,
- 57, 57, 57, 75,106,216,209,  1, 44,139, 45, 37,166,184,156,243,231,207,183, 12,  9,  9,241,223,178,101,139,253,140, 25, 51,  4,
- 51,102,204, 24,  7,224,167,170,204,133,133, 66, 97,183,213,247,238,177,116, 90,154,230,200,246,237,130,157,161,161,139, 41,134,
-113,178,177,179, 35,190,106,219, 86, 33, 34,201,156,220,204, 76,218,214,195,131,147,120,227,134, 53,107,108,156,126,245,234,213,
- 66,185, 92, 94,105,233, 28, 14,135,163,172,200, 92, 88,145, 56, 58, 58,106, 43,242,225,170, 98, 66, 44,100, 88,150,178,168, 87,
-143,237,209,245,203,  6,177,209,241,241, 70, 22, 22, 28,207,  6,117, 27,190,126,155,248,148,213,235,213,  4, 65, 20, 26,100, 43,
-225,112,134,109,217,178,165,137,153,153, 25, 24,134,129,185,185, 57,178,179,179,161,213,106, 81, 88, 88,  8,109, 81,  1,180,  5,
-  5,136, 72, 78, 68,251, 78,157, 48,164, 87, 15,239,195,231,127, 31,166,215,235,131,170,180,231, 53,109, 81,166,201, 90, 89,199,
-250,191,182,160, 84, 89, 25,233, 90,223,194, 19,124,177, 24,221,231,  4,124,202,131,254,242,242,229,203, 87,  6, 13, 26,244,205,
- 15, 63,252, 64, 74,165,210,107,137,137,137,237,  1,188,169,234, 71, 98,177,184,126, 78, 78, 14,228,114, 57,204,205,205,177,101,
-203, 22,216,219,219, 67,169, 84,226,217,179,103,172,139,139, 11,113,247,238, 93,184,184,184, 32, 55, 55, 23, 20, 69, 65,165, 82,
-101,104,181,218, 74,205,229, 37,230,193,222,179,123,225,106,244,139, 67, 29,156,137,132,103, 67,231,118,140,141,142,120,155,114,
-253,198,195,159,104,181, 81,170, 44,237,230,130,122,173, 95,218,124, 63,111,  5,118,108, 88,134,232, 39,247,242,236,221, 10,119,
- 26, 19,154,131, 85,181, 87,161, 80,168,223,190,125,107, 26, 30, 30, 14,130, 32, 96,110,110, 14,145, 72, 84, 33,217,170,133,144,
-229, 53, 80, 10,133,  2,124, 62, 31,214,214,214,216,191,127,127,217,196, 91,183,110,221,170, 48,246,118,239,222,125,152,155,155,
-155,105,249, 15, 91,183,110,141,201,147, 39, 99,247,238,221,  8, 13, 13,125,175,158,102, 70, 70,134, 84,167,211, 85,117,222,178,
-204,204,204, 94,  3,  7, 14,124,113,255,254,125,179,253,251,247,131,166,233, 10, 95,129,129,129,120,252,248,241, 82,  0,111,107,
-121, 31,125, 49,120,240,224,123, 71,143, 30,181,200,206,206, 70,233,189,161, 80, 40,160,215,235,209,176, 97, 67,130,166,233,234,
-252,222, 72, 14,135,115,126,251,246,237,253, 38, 78,156,  8, 46,151, 11,173, 86,139,237,219,183, 99,193,130,  5,153, 37,139, 82,
- 10,192,226,131,  7, 15,142,238,223,191, 63,154, 53,107,230,125,231, 78,229,158, 29,114,185, 28,114,185, 28, 60, 30, 15, 14, 14,
- 14, 88,181,106, 21,180,218,226, 97,197,203,203,171,236, 49,  6,176,215,203,203,171, 95, 76, 76,204, 70, 20,251,174,125, 36, 14,
- 14, 14,  3, 89,150,157,164,215,235,139, 58,116,232, 96,125,252,248,113, 83,137, 68,130, 23, 47, 94, 96,233,210,165,249, 12,195,
-232, 25,134, 33, 84, 42, 85,130,157,157,221, 11,161, 80,104,172, 84, 42,243,114,115,115,215,  0,184,246,119,205,228,  4, 65, 16,
- 60, 30, 15,227,199,143,  7,151,203,133,177,177, 49,212,106, 53,116, 58, 93, 25,153, 71, 13,205,210, 13, 26,136,173,185,224, 79,
-180, 52,109,228, 63,100, 86, 95, 91, 71, 39,103, 88,152,  9, 17, 21,245,166,253,237, 91, 55,182, 11,184,209,123, 24,173,110, 79,
-116, 82,193,159, 94,236,254, 67, 46,242, 15, 37, 90, 31,213, 60,228, 86,220,153, 67,244, 44,123, 42, 71, 34, 17, 80,  2,129, 40,
-166, 84,203,101,111,175, 44, 36,136, 33,122,219,198,  3, 64, 83,186,146,129,130, 45,121, 25, 72,180,116,122,196, 70, 71,226,254,
-245,223, 97,163,148, 32, 39,161, 57,192,111,  2,173,170,  0,106, 45, 85, 66, 74,244,  8,127,113, 11,133,  5,121,240,105,213, 23,
- 32,201,199,149,225,153, 91, 19,125,191,106,217,148, 19,155, 18,137,214, 94,223,193,195,165,  3,146,165,133,144,201, 53,200, 47,
- 84,163,185, 79,  0,178,243, 85, 40, 84,170,241, 38,246, 48,156,157, 60, 72,130, 27,223,213, 80,162,165,121,115, 22,154,183, 23,
-192,119,111, 15, 65,195,254,224,184,251, 34,229,213, 29,132, 95,221,140,180,215, 15,192, 50,122, 56,122,181, 49,244, 33,217,126,
-237,218,181, 54,237,219,183,231,118,235,214,173,217,149, 43, 87,154, 73,165,210,240, 18,130,209,172, 91,183,110,205,108,109,109,
-177,117,235, 86, 21, 65, 16,219,107,217,217,101, 26,176,172,172,172,167,  0, 86,159, 61,123,118,251,228,201,147, 97,103,103,215,
- 36, 61, 61,189,210, 31,102,243,120,205,198,172, 89,195,242, 56, 28, 54,104,199, 14,254,138,107,215, 54,253,118,240, 32,191, 75,
-231,206,  4,203,178,  8, 11, 11, 19,173,223,177, 67, 52, 98,192,128,164,228,172, 44, 58, 36, 52,148,146,166,165, 21,101, 41, 20,
- 43,164, 82,105,198,223,113,103,235,116,186, 71,  9,137,  9,206,173,218, 54,183,125, 25,149,240,186,103,151,175,190, 34, 73,146,
-140,142, 79, 14,181,181, 53, 19,221,184,126,131,210,233,116,143, 12,193, 18, 10,133,125,187,116,233,194,205,207,207,135,147,147,
- 19,178,179,179, 33,145, 72,138, 53, 14,  5,249,160, 10, 10,160, 43,148, 65,175,144, 35,225,217, 83, 52,247,168, 39, 60, 37, 20,
-246, 85, 42,149, 85, 18,173,210, 85,102, 69,133,174, 75, 63, 19,152,154, 66, 32, 22,131,168,185,217,112,128,133,133,197,  2,153,
- 76,118,  5,192, 42,138,162,166, 47, 88,176,160,245,182,109,219,108, 86,175, 94,109, 54,105,210,164, 83,114,185,188, 57,138,139,
-170, 86, 54,129,197,209, 52,109, 13,192,254,214,173, 91,176,179,179, 67, 65, 65, 65,169,166, 69,171, 84, 42,141,114,115,115,161,
-209,104,160,213,106, 97,102,102,134,231,207,159,231,209, 52,125,177,186,198,153,213, 39, 86,105,168,168, 37,214,222, 38,233, 20,
-109,217, 49, 43,143,201, 95,190, 73,186, 18,192,166, 94, 30, 30,129, 20,115, 47,225, 93,228, 69,203,196,103,119,243,210,223, 41,
- 60,246, 95, 73,168,202, 71,139,  5,192, 16,  4,193,122,121,121, 33, 59, 59, 27, 28, 14,  7, 34,145,  8, 98,177, 24, 11, 23, 46,
-196,246,237,219,107, 67,180,140, 76, 76, 76,214,144, 36, 57,140, 36, 73, 91,189, 94,143,128,128,  0,244,235,215, 15,  2,129,  0,
- 20, 69,149,105, 52, 75,181, 84,213,104, 58,194, 30, 63,126,108,246,248,241,123,195, 86,103, 27, 27,155,219, 26,141,  6,241,241,
-241, 56,127,254,124, 39,  0, 33, 53,236,235,248,176,176,176, 94,190,190,190,135, 90,182,108, 89,159,101, 89, 52,105,210,  4,126,
-126,126, 56,124,248, 48,194,195,195, 81, 80, 80,192,220,184,113,227, 55,  0, 27,107, 58,135,151, 92,223,134,131,  7, 15,126,112,
-236,216, 49,203,220,220, 92,168, 84, 42, 40, 20, 10,156, 58,117, 10,237,219,183,135,141,141, 13,142, 30, 61, 74,179, 44, 91, 85,
-223,147, 36, 73,238,223,179,103, 79,191,  9, 19, 38, 96,231,206,157,  8, 10, 10, 66,255,254,253, 49,108,216, 48,100,103,103,219,
-111,216,176, 97,116,137,153,112,153,159,159, 31,228,114, 57,158, 61,123, 22,101,224, 51, 15,153, 76,  6,153, 76,  6, 99, 99,227,
-242,207, 24,  1,224,240,230,205,155,135,251,251,251,195,195,195, 99, 89, 66, 66,194,102, 84, 16, 37,202, 48,204, 20,137, 68, 98,
-201,229,114,173,105,154, 70,106,106, 42,158, 63,127,142,239,191,255, 62, 47, 47, 47,111, 50,128,100,  0,139,199,143, 31,191,106,
-206,156, 57,101,247,210,156, 57,115, 46, 93,185,114,165,215, 95,173,205,241,242,178,104, 44,224,  8,103,229, 23,113,172,243,243,
-243,203,198, 14,173, 86, 11,141, 70,243,158, 38,139,207,231, 89,183,110,238,118, 89,165, 44, 90,244,230,157,172,210,  2,233,222,
-245,205,155,138, 76,204,253,219,119,232, 50,178, 71,175,111, 57,180, 78,135,224,224,139,248,245,215, 93,232,236,235,  5,143,  6,
- 77, 48, 99,230, 44,115,141,150, 14,184,113,227,218,  2,139,199,247,175, 21, 21,202, 22, 86,133,249,255, 92, 46,151,144,171,203,
- 21,154, 14, 43, 98,144, 37, 41, 28,242, 75,118,109, 44, 45, 45,119,232,245,250,206,102,102,102, 96,100, 49,120,243,252,  9,242,
-242,121,208,168,244, 96,216, 98,178,101, 16,113,209,104,113, 47,248,  2,182,108,222,132,220,220, 92,248,126,221,  9,114,174, 43,
-220, 92,221,160, 86, 41, 75, 30, 26,128,210,234, 96,107,239,142,151, 47,195,117,133, 10, 69,165,  3, 18,223,136,242,118,179,247,
-130,134,250, 18, 70,  2,  1, 10,138,180,200, 47, 33, 89, 71, 79, 15,133, 70,169,  2,173,165, 64,107,117,176,117, 27,140, 47,236,
-187,128,209, 95,108, 92,163,203,199,232, 65, 37,222,  3,149,120, 15,198, 95,206,196,239,107,135,127, 48,145, 26, 86,119, 55, 59,
- 59, 59,235,245,235,215, 23,195,194,194,  6, 14, 29, 58, 20,119,238,220,153,  4, 96,106,137,249,102,210,208,161, 67, 17, 22, 22,
-134,215,175, 95, 95,204,206,206,206,250, 35,122, 94, 32, 16,168, 52,154,226, 57, 86, 36, 18, 25, 85,243, 93,231,214,131,  6,145,
-  5, 47, 95, 22,110,126,248,112, 89,224,254,253,252,110, 93,187, 18, 58,154,  6,163,215,163,129,167, 39,209,163, 71, 15,147,195,
- 39, 79, 90,115,116,186,199,243,166, 79,191,181,123,212,168,162,167, 10,133,161,142,230,117, 74, 76,134,  0, 80,167,138,207, 12,
- 22,141, 70,179,109,202,196,177,221, 66,238, 61,112,117,115,117, 54, 11,190, 17, 18, 46, 52, 22,144, 30,117,235,115,242, 11,242,
-184, 43,151, 45, 50,214,104, 52,134,146, 86,111, 27, 27, 27,100,100,100, 32, 54, 54, 22, 26,141,  6, 58,157, 14,140, 82,  1,109,
-190, 12,218,130, 60, 16,106, 21,132,122, 61,212, 57,153,168,227, 81, 15,248,111, 68, 98,181,166,168,138,136, 86,233,214,200,204,
- 12,124, 19, 49, 72, 30,207,224,226,232,  0, 90,182,105,211,230,228,153, 51,103,248,227,198,141,107,123,243,230,205, 29,  0,146,
- 37, 18, 73,215,165, 75,151, 62,221,177, 99,135,112,242,228,201, 13, 55,110,220, 56, 26,192,222,202, 64,212,106,245,201,203,151,
- 47,143,112,119,119,183,143,136,136,128, 90,173,  6,195, 48,232,221,187, 55, 80,236, 91,  3,  0,136,142,142, 86,169,213,234,172,
-200,200,200,194,228,228,100, 10,  6, 68,  9, 46,223, 38,125, 84,152,113,111,144,189,131,243, 99, 35,227, 58,117, 89,249,203,129,
-179,191,115,222,176,249,180, 68,125, 45, 62,190,104, 73,247,122,235, 20, 69,175,190,183,112,145,239,188,118, 41,193, 16, 71,248,
-178,232, 66,107,107,107,112,185, 92,240,120, 60,240,249,124, 16,  4,129,153, 51,103, 98,223,190,125,213,153, 14,223, 35, 89,166,
-166,166,175, 87,172, 88,225, 50,121,242,100,190,145,145, 17,242,243,243,113,244,232, 81,140, 31, 63, 30,191,254,250,107,133,254,
- 47,  6,152,148, 62,212,150,250,143, 26, 53, 10, 90,173, 22,126,126,126,  8, 12, 12,244,215,235,245, 33,181,120,164, 31,135,135,
-135,123,134,135,135,155,  1,232, 63,108,216,176,131,131,  7, 15, 70, 72, 72,  8, 46, 94,188,216,  9,197, 65, 31, 42,  0,107,  1,
-216,149,108,171,122, 62, 77,236,237,237,119, 49, 12,211,223,214,214, 54,220,203,203,203,231,216,177, 99, 22, 89, 89, 89,165,193,
- 15, 72, 76, 76,196,129,  3,  7,164,251,247,239, 47,212,235,245,214, 36, 73, 94,150,201,100, 11,171, 32,108,251, 55,111,222, 60,
-182,196, 28,136, 51,103,206,176,155, 54,109, 34,150, 46, 93,138,252,252,124,116,238,220, 25,123,246,236,153, 37,151,203,155,109,
-218,180,105,226,144, 33, 67,176,114,229, 74, 40, 20,138,205,213, 45, 86,170, 32, 95,  4,128,175, 54,111,222,236,238,239,239,143,
- 51,103,206,160,101,203,150,198,  9,  9,  9,187,  1, 76,168,168,255, 88,150, 69, 66, 66,  2,148, 74, 37, 30, 60,120,128,101,203,
-150,229,151, 35, 89,179,166, 78,157,186,106,214,172, 89, 88,179,102, 13, 27, 17, 17,145, 53,120,240, 96,251,125,251,246,113, 26,
- 52,104, 48, 75,169, 84,254,101, 68,171, 97,  3,171,117,173, 91,118, 88,224,232,220,  0, 71,143, 29, 71, 94, 94, 94,217, 53, 41,
-189, 46, 44,203,162,168,168,  8, 25, 25, 25, 48, 55, 51,197,134,141,171,190,153, 54,105,172, 43,138,211, 96,124,172,178,244,176,
-220, 56,120,216,184,185,126, 35,198, 34, 34,252,  5, 14, 31,220,139,200,136,176, 50, 60, 90, 71, 33, 38,234, 57, 98,162,158,195,
-222,193, 29, 61,186,117, 34,134, 15, 31,222,123,212,136, 97,182,  0,254,180,212, 17,255, 96,109, 22,240,113, 30,173,125,239, 17,
-173,106,212,117, 54,150,150,150,175, 79,156, 56, 97,237,235,235,203,161,105, 26,215,130,131,241,253,212,255, 96,244,168,  0, 80,
-176,  4,173,229,131,225, 27, 25,212, 18,149, 74,  9, 22, 44, 20, 10,  5, 66, 67, 67,193, 50, 52, 14,239,219,  4,150,101,202,136,
- 22,192, 66, 75, 81,112,118,107,136, 93,129,171,105,240,120, 79,161,171, 56,117, 77, 97, 46, 71,175,163, 89, 72,178, 82,144, 34,
-141,132,185,169, 27,184, 60, 55,228,202,148,224,146, 14,208,169,163,161, 47,249,173, 82,145,  6, 21,245,105,253,167,175, 64,123,
-202,214, 96,208, 85,169, 84, 71,142, 28, 57,242,205, 47,191,252, 34,232,211,167,143,215,233,211,167,191,  2,128, 62,125,250,120,
-153,153,153,225,200,145, 35, 90,149, 74,117,228, 15,212,248,116,105,211,166, 13,242,243,243,145,152,152, 24, 94,229,185,105,181,
-214, 98, 59, 59, 78,214,157, 59,186,236,252,124,215, 46, 93,186, 16, 58,154,  6, 73, 16,200, 43, 40, 64,114, 82, 18, 44, 44, 44,
-136,215,209,209,226,237, 51,102,156,243,242,241,225,150, 70, 36, 26, 34, 23, 47, 94, 20,161,216, 47,171,202,207,106, 40,138,172,
-204,140,177,211,167, 79, 63,119,228,200, 81,243,204,172,204, 24,161, 64, 64,139,197, 70, 78,163, 70, 78,227,202,100,178, 17,  0,
-228,134,130,229,231,231, 35, 33, 33,  1,198,198,198,224,243,120, 96, 84, 74,232, 21,114,168,243,178,193,161,180, 16,232,245,176,
- 18,  9,225,106,111, 15, 55, 91, 27,131, 48, 99,111, 95, 47,115,124, 47,111, 46,220,208,198, 27,  2, 19, 49,  4,166, 98, 76,187,
-116,183,100, 53,202,  7,150,254,100,  8,172,141,179,179,243,239,199,142, 29,227,103,103,103, 35, 44, 44, 44, 28, 64,  1,  0, 83,
-  0, 76, 84, 84,212,205,200,200,200,190, 37, 81,119,213, 69,139,109, 58,123,246,108,119, 95, 95, 95,186,110,221,186, 38, 89, 89,
- 89,174,249,249,249,140, 84, 42,125, 79, 37,116,253,250,117, 97, 81, 81,145,130, 97,152,115, 37, 36,171,218,252, 69,179,191,115,
- 54, 10,125,137,153, 29,123,214,105, 98,102,211, 20,121,244,203, 38,143,195,165, 51,103,127,231,188,109,243,105,137,218,152,208,
- 28, 36,244,169,174, 92, 35,181,161, 78,204, 44, 80,236, 43, 21, 26, 26,138,228,228,100, 36, 36, 36,188, 71,168, 38, 77,154,132,
-195,135, 15, 27,164,209, 50, 49, 49, 89,179,124,249,114, 23,127,127,127,126, 57, 82,132,233,211,167,163,160,160,  0,129,129,129,
-152, 62,125,122,141, 39,254, 15,164, 94,151, 46, 93,250, 56, 58, 58, 34, 55, 55, 23, 14, 14, 14,240,245,245,237, 23, 18, 18, 82,
- 23, 64, 98, 45,239,251,105, 61,123,246, 92,181, 98,197, 10,232,116, 58,140, 31, 63, 30,239,222,189, 59,249,238,221,187, 45,110,
-110,110, 51,231,207,159,111,111,111,111,143,161, 67,135,154,208, 52, 61,168, 50, 16, 43, 43,171,181,123,247,238, 29,209,167, 79,
- 31,146,162,168,175,111,223,190,141,164,164, 36,104,181, 90,208, 52,141,184,184, 56, 76,159, 62, 93, 90, 18,221, 24,103, 64,187,
-198, 45, 94,188,120,236,204,153, 51,177,126,253,122, 44, 95,190,252, 55,115,115,115,159,230,205,155,183, 88,190,124, 57,230,205,
-155,  7,119,119,119, 88, 91, 91,127,177,116,233, 82,239, 57,115,230, 96,219,182,109, 88,182,108,217,111,  0, 14,212,230, 66, 48,
- 12, 67,172, 91,183,174,217,230,205,155, 29, 75, 73, 22, 73,146, 56,113,226,  4, 94,190,124,217, 47, 62, 62,190,162,223,236,113,
-112,112,152,228,232,232, 40,184,113,227,134,216,221,221, 29, 52, 77,235, 74, 72,214,118, 55, 55,183,239,227,226,226,208,167, 79,
- 31,196,199,199, 31,  1, 48,218,220,220, 92, 49,103,206, 28,145,177,177,177,185, 82,169,252,171, 38,111,112, 72, 98,204,154,149,
-243,240,236,101, 52,206,158,229,227,217,179,103,176,183,183,135, 80, 40,  4,203,178,208,104, 52,200,206,206,134,142,210,160, 73,
-227,122, 56,180,127, 29,178,178,178,  1,146,168,212,229,134, 32,137,145, 99,255, 51, 16,247, 31,  4, 99,247,238,189,144,203, 21,
-149, 44,190,141,208,192,203, 27,206, 78,118, 72, 77, 75,  5, 65,194,230,207, 60,215,127,184,233,176,108,  8,130, 33,233, 29,202,
-139,133,133,197,150,160,160, 32,235,206,157, 59,115, 20, 10,  5, 24,134, 65,  7, 95, 95,204,244,247,199,197, 99,199,224,217,214,
- 15,132, 86, 12, 90,100, 88,212,131, 90,165, 68,163, 22, 95, 97,200,208, 97, 72, 73, 78, 70,207,190,131,161, 86, 43,203, 86, 24,
-165, 26, 45,173,150,130,141,157, 43,174, 95,191,206,193,248,241,111,176,189, 98,165,132,158, 18,188,138,137, 83,183,151,169, 94,
- 34,244,217, 97, 80, 26, 10, 77,154, 44,  5,197, 88,195,206,101, 18,116,186,243, 40,204,190, 93,108,198,176,238,140,180,148, 20,
-144, 28,254,235,218, 94, 65, 70,145,253, 73,131,110, 65, 65, 65, 65, 66, 66,194,233,208,208,208,145,131,  6, 13,194,245,235,215,
- 39,  2,192,160, 65,131, 16, 26, 26,138,132,132,132,211,  5,  5,  5,  5,127, 68,111, 59, 58, 58,246,239,212,169,147, 95,235,214,
-173,113,233,210, 37,176, 44,123,223,160,  7,155,199, 99, 73,146,  4,195, 48, 32,  0,228,202,100,120,247,238, 29,114,115,114,160,
-211,233,160,144,203, 25,111, 47, 47, 57,203, 48,166, 53,105, 79,249,  8, 67, 84, 16,117, 88,250, 89, 45, 78, 53,249,233,227,135,
- 41, 69,114,185,173,165,133,101,145, 64, 32,208,231,203,100,  5,111, 94, 71,104, 13,156, 28, 74, 37, 42, 50, 50,210, 39, 61, 61,
- 29, 41, 41, 41,160, 21, 69,224,104,180, 32, 53, 74,116,253,234, 75, 24,131,133, 17, 24,240, 24, 29,120, 28, 30,138,138,163,243,
-170, 53,119,232,203, 45, 18, 74, 73, 22, 65, 16,197,230, 66, 19, 19,  8,196,166,239,105,184, 12,185,159,132, 66,225,177, 83,167,
- 78, 57, 58, 59, 59, 99,229,202,149,112,113,113,249,194,201,201, 73,105,110,110,110,108,111,111,143, 70,141, 26,225,171,175,190,
-194,213,171, 87, 97,192, 53,160, 89,150,237,113,255,254,253,185, 15, 31, 62, 28, 98, 98, 98, 66,204,152, 49,131,219,187,119,111,
-  8,133, 66, 40,149, 74,228,231,231,227,248,241,227, 57, 12,195,148,  6,165, 88,139, 68,162,  3,  4, 65, 36, 42, 20, 10,255, 15,
-  1, 15,253,210,196, 41, 43,143, 25,207,202, 69,  3, 59,246,172,211,164, 75,207,110,168,231,217,  5, 93,122,166,  0,192, 58, 43,
-110,146,223,207,139, 45,206, 89,152, 18,  7,174, 95,187,177,204,183, 99,151,197, 11,228,119, 86,173,223, 39,171,214,159,142, 32,
-  8, 48, 12,243, 94,238,160, 15,143,143, 30, 61, 26, 39, 78,156,168,246, 58,146, 36, 57,108,242,228,201,252, 15, 52,207,144, 72,
- 36,232,219,183, 47,  6, 13, 26,244, 30,209,178,177,177,129,131,131,  3,146,146,146,  0, 32,215,192,251,106,230,184,113,227,  8,
-149, 74,133,  9, 19, 38, 32, 48, 48, 16,126,126,126, 68, 72, 72,200, 76,  0,254, 53,189,217, 73,146,220, 48,127,254,252,185,211,
-167, 79, 71, 94, 94, 30,174, 92,185,130,222,189,123,227,196,137, 19,182, 87,174, 92, 89,211,185,115,103,112, 56, 28, 92,186,116,
-  9, 52, 77, 87,153,235,139,207,231,247,239,211,167, 15,153,154,154, 10, 62,159,143, 86,173, 90, 33, 45, 45, 13, 74,165, 18, 18,
-137,  4,179,102,205,202,200,205,205,237,100,232,115,196,231,243,253,103,206,156,137,160,160, 32,  4,  4,  4, 28,  4, 48,161,160,
-160, 96,200,195,135, 15,131,  6, 12, 24,  0,137, 68,130,115,231,206, 97,217,178,101,196,232,209,163,177,115,231, 78,204,154, 53,
-235,183, 18,173, 83,101, 55,126, 81, 86, 86,150,121,253,250,245,145,153,153,  9,185, 92,142,115,231,206,217, 93,189,122,181,174,
-179,179,179, 89, 66, 66,130,254,167,159,126, 18,248,251,251, 99,203,150, 45,  8, 11, 11,195,225,195,135,209,165, 75, 23, 58, 62,
- 62,190, 66, 45, 89, 73,202,134,115, 44,203,222, 48, 49, 49, 65, 81, 81, 81,233,115,247, 67, 64, 64,192,244,181,107,139,149,236,
-233,233,233, 24, 51,102,204,168, 91,183,110, 49,157, 59,119, 22,241,249,124,168,213,106,197, 95, 57,107, 51,122,  6,  0,131,186,
-174, 98,  4, 95,220,143, 23,225,241,120, 17, 30,  9,129,176,216,  9, 94,165, 82,162, 69,147,  6,104,219,170, 13,210,165, 18, 28,
- 57,188, 31, 86, 54,206, 85,142, 35, 44,203,130,207,213,195,219,203,  1,199, 14,239,197,165, 43,183,112,248,200,241, 50,159, 55,
- 46,151,135,230, 45,218,162, 85, 43, 95,196, 39,196, 97,255,254,221,176,181,115,253,108, 28,172,165,148,153, 14,203,111, 63, 96,
-254, 93,124,125,125, 57,114,185, 28,106,181, 26, 25, 25, 25, 72, 74, 74,130,133,165,  5,226,211, 19,209, 73, 68, 33,131, 41, 68,
- 84,248,107, 61,193,225,133, 85,247,135,125, 58, 54,  7, 58, 54,199,247,227,252,170, 88,178,178, 48, 49,179, 41, 54,221,208,116,
- 44,182,109,163, 43, 35, 90,180, 94,119, 51,248,198,237, 54,227, 70,247,231, 93,191, 29,  8,157,150,129, 74,103, 14,133, 90, 11,
-  5,197,  3,105,222, 27,200,  9,  1,135, 43, 68,187,102, 13,112,238,236, 85,138,165,117,183, 12,190, 64,246, 62,160, 51, 35,203,
- 17,173,172, 15,236, 14, 86,  6,155, 14,203, 38, 94,189,254,196,209,163, 71,191,253,242,203, 47, 69,157, 59,119,174, 95, 50,113,
- 82, 71,143, 30, 85,150, 36,195,172,169,188,151, 13,222,193,193,161,  5,159,207,247,235,221,187,119,139,177, 99,199,226,205,155,
- 55, 56,114,228, 72, 76,131,  6, 13,238, 72,165,149, 71,100,115,  4,130, 92,121, 86,150,133,184,110, 93,174,165,169,105,250,213,
- 43, 87,220,187,117,239, 78,164,164,164, 32, 55, 55, 23,106,181, 26, 97,225,225, 44,143,195, 73, 35,204,204,200,232,151, 47, 73,
-142, 64,144, 91,153,182,177,  2, 73,170, 38,234,112,109,109,181, 91,174,142,150,245,151,  5, 76,169,167,214,168,125, 10, 11, 11,
-105, 46,143,199,115,113,176, 72,142,142, 51,124, 76,212,104, 52,151,110,222,188,249,109,183,110,221,132, 49,175,194, 64, 23, 20,
- 64, 91,144, 15, 62,163,135, 85,139,102,224, 80, 26, 64,171,131,179, 55, 11,181, 76,132,144, 39,209, 58,141, 70, 83,109, 82,195,
- 82,162, 69,126, 64, 12,  4, 98, 49,132,166,102, 16,138,197, 31, 18,134,234, 86,114,162, 30, 61,122,116,109,215,174, 29, 88,150,
-197,190,125,251, 64, 81,148,128,162, 40,104,181, 90, 80, 20,133,194,194, 66, 28, 62,124, 24,187,118,237,122,  8,224, 55,  3, 78,
-159, 54, 54, 54, 30, 64, 16,132, 29,151,203, 85,218,218,218,154,156, 56,113,162, 44,221, 68,243,230,205, 97,106,106,202, 71, 73,
- 82, 72, 59, 59, 59,222,175,191,254,106,209,175, 95,191,123, 21,154, 59,154,124, 49,175, 30,109,217,209,200,184, 78, 93, 51,155,
-166,168,231,217,  5,  0,208,189,239, 56,212,107,224,134,194,156, 87,117,213,170,164,129,124,110,190,229,235,109,146, 55,198,125,
-124,198, 42,178,238,190, 67,197,225,253, 21, 78, 20, 36, 73, 86,106,142, 53,132,100, 21,115, 22,210,182,212,207,  7,  0,114,115,
-115, 33,149, 74, 17, 21, 21,133,134, 13, 27, 34, 47, 47, 15,206,206,206,208,106,181,104,221,186, 53, 84, 42, 21, 54,111,222,140,
-  7, 15, 30, 60,  4, 48,203,128,255, 48,246,244,244, 28,211,162, 69, 11, 92,185,114,  5,207,158, 61,147,  4,  7,  7, 59,251,250,
-250,162,110,221,186, 99, 19, 19, 19, 23,149,152,250, 12, 21, 19, 95, 95,223, 25,211,167, 79, 71,100,100, 36,166, 76,153,146,155,
-154,154,122,238,228,201,147, 19,150, 45, 91, 70,246,236,217, 19, 82,169, 20, 27, 54,108,208, 63,120,240, 96, 35,128,149,213, 92,
-199,183,169,169,169, 46,106,181, 26,121,121,121,160,105, 26, 74,165, 18, 87,175, 94,197,225,195,135, 51, 75, 72, 86,172,161,141,
-107,214,172, 89, 35,146, 36, 17, 20, 20,  4,  0, 75, 80,156,177,255,220,192,129,  3, 37, 63,253,244,147,243,194,133, 11, 49,113,
-226, 68, 80, 20,133,245,235,215, 99,225,194,133,151, 75, 72, 86, 85,131,232, 47, 14, 14, 14,147,166, 76,153,242,197,156, 57,115,
- 16, 26, 26,106,247,252,249,243, 86, 97, 97, 97,112,117,117, 69,110,110, 46,215,218,218, 26, 91,182,108,193,236,217,179,207,  0,
-200,121,244,232,209,176,132,132,132,181,  0, 54, 84, 67,218,247, 56, 59, 59, 79, 98, 89,150, 85, 42,149, 73,  1,  1,  1, 27, 86,
-175, 94,141,217,179,103,227,245,235,215, 40, 40, 40,128,169,169, 41, 49,127,254,252, 49, 75,150, 44,193,248,241,227, 89,133, 66,
-177,235,175,158,168, 89, 86, 15,101,126, 36,244, 26, 75, 52,111,210, 16,205,125,234, 32,248,246, 11,  0, 64,215,193,190, 80, 42,
-138,112,240,224, 62,196,198,190,  3,151,199,131,133,149,131, 33,154, 64,104, 11,223, 66, 70, 73,209,173,115, 43,244,238,217,  9,
-191, 29, 58,  1, 90, 71, 97,194,184, 17,200,151,201,112,232,208,126,196, 39,196,129,203,227,193,218,230,207, 79,132, 90, 21, 23,
-249,199, 19, 45,  3,204, 79, 96, 24,  6, 18,137,  4,207,159, 63, 71, 98, 98, 34, 68, 34, 17, 84,180,158,217,125,243,  1, 67, 16,
-252, 52,134,101, 31,178,116, 89,150,226,143, 49,244,122, 73,185,140,181,230,150,150,150,  2,141, 70,  5,154,214,149,155, 85,  8,
-128,  0,248, 92,192,209,169, 30, 82, 83, 82, 89,181, 90,125,183,202, 21,148, 70,189,229,194,185, 83,211,191,106,239,107,211,187,
-235, 10,156, 59,191, 20,249,133,133, 80, 83, 60, 40,212, 20,148,106,192,194,202, 11,173,155, 52, 69,122,122, 46, 94, 61, 11,145,
-115, 53, 74, 67, 28, 69,223,109, 95, 60,206,115,220,247,243, 96,236,222, 30,154,168,115, 96,228,153,101, 26, 45, 35,177, 37,172,
-220,188, 33, 83,104,112,234,214, 11,160,  6,165, 94,178,178,178,148, 28, 14,231,232,244,233,211,215,191,120,241,220,  5,  0, 94,
-188,120,145, 38,149, 74, 23,100,101,101,213, 84, 39, 93,154, 13,158, 48, 50, 50,126,209,160, 65,131,244, 86,173, 90,153, 15, 28,
- 56, 16, 54, 54, 54,  8, 11, 11,195,218,181,107,223, 82, 20, 53, 47, 36, 36,164, 74, 83,143, 86,171,149,188, 56,127,222,172,211,
-127,254, 99, 49,175, 95,191, 13,211,167, 79,223,178,114,229, 74,158,167,167, 39,161,163, 40, 68, 68, 68,176,199,142, 30,213,237,
- 90,184,112,179,192,196,132,251,244,194,  5, 58, 60,122,154,  0,  0, 32,  0, 73, 68, 65, 84, 30,173,209, 72,254,238,155,216,217,
-217,185,163,239,215, 29,188, 55,254,178, 13,106,149, 28, 79, 66, 47, 35, 63, 63, 27,123,247,157,245,118,118,102, 59, 74, 36,146,
- 16, 67,  9,240,129,  3,  7,230,182,109,209,162,133,135,171, 43, 34,146, 19, 33, 96,244,224,211, 52, 56,148,  6, 36,173,134,171,
- 15, 11,130, 52,133, 52,163, 16,171,131, 78, 71, 26, 66,140,191,248,166, 63, 86,166, 21,128, 32,  8,108,250,210,  7,  2, 83, 49,
-248, 38, 98, 76,251,253,118, 25, 49,184,180,114, 33,  4, 98, 49,234,183, 53, 40, 33,188,242,206,157, 59,207, 35, 34, 34, 90,251,
-248,248, 96,238,220,185, 72, 74, 74,  2,195, 48,200,204,204, 84, 75,165, 82, 73,118,118,118, 18,138,243,255,  4, 86, 51,137,149,
-103, 29,206, 33, 33, 33,101,230,134, 91,183,110,193,201,201,  9,230,230,230, 40, 44, 44,196,228,201,147, 45,126,252,241, 71,  0,
-192,243,231,207, 81,158,160,124, 40, 17, 47,162, 54,202,138,216,124, 86,254,114, 96, 30,253,178, 73,151,158,169,232,222,119, 44,
-110, 92,250, 13,183,131,111,194,138,155,148,  8,147,162,171, 57,137, 57,133,105, 10,207, 61,222, 45, 39,112,164,138,224, 61, 51,
-250,199,112, 28, 29,153, 83, 11,119, 23,202,170,106,171,167,167, 39,236,237,237,203,124,180,184, 92, 46,198,143, 31, 15,150,101,
- 13, 37, 89, 37,115, 13,147,173, 86,171,237,141,140,140,144,145,145,129,184,184, 56,196,199,199,151,165, 14, 96, 24, 70,247,195,
- 15, 63,240,102,204,152,129,221,187,119,227,238,221,187, 15,  1,172,  0, 96,232, 98,109,196,208,161, 67, 77,181, 90, 45,142, 31,
- 63, 78,  3,232,123,234,212,169,231,173, 91,183,230,246,234,213,203,116,231,206,157, 35, 74,250,200, 96,162,101,102,102,198,167,
- 40, 10, 59,119,238, 68,106,106,106, 71,  0, 81, 79,159, 62,221, 51,116,232,208, 93, 62, 62, 62, 13, 34, 35, 35,223,201,229,242,
-105,  0, 94, 85,  7,150,153,153, 57,174, 85,171, 86,167, 24,134,113,239,214,173,155,201, 47,191,252, 98, 22, 29, 29, 13, 23, 23,
- 23, 48, 12, 19,129, 26,150,176,122,247,238, 93,148, 84, 42,245,238,212,169, 19,174, 94,189,186, 78,175,215,175,  1,176,126,234,
-212,169,206,201,201,201,104,209,162,  5,172,172,172, 16, 29, 29, 93, 36,149, 74,119,161,184, 36, 81,117, 42,220,  4,  0, 11,246,
-236,217,211,116,207,158, 61,126, 86, 86, 86,237,194,194,194,112,255,254,125,108,220,184, 17, 63,254,248, 35, 58,116,232,128,185,
-115,231,230,  0,240,  3, 64, 39, 36, 36, 24,148, 55,175, 84,179,  5,  0, 45, 91,182, 76, 95,187,118, 45, 38, 76,152,192,254,250,
-235,175, 91,143, 30, 61,234, 63, 98,196,136,178, 57,112,204,152, 49,236,145, 35, 71,198,160,184, 12,211, 95, 41, 58,138,210,194,
-204,170, 30,228,178, 20,100,167,134, 66,100,234,128,158, 93,154, 65,169,210,226,226,133, 51,120, 21, 17, 14,146, 36, 97,239,224,
- 10, 11, 75, 27,196,196,188,  3,170,142, 54,214, 81, 20,  5, 83,203, 58,144, 23,164, 66,155,245,  2,198, 98, 59,140,253,207, 64,
- 40, 85, 20,206,158, 59,131,200,200, 87,224,112, 56,112,112,116,133,185, 69, 49, 38,193, 86, 29,193,252, 89,  0, 84,144, 79,171,
- 90,162,197,225,112,238, 92,187,118,237,187,182,109,219,114, 99, 99, 99, 17, 27, 91,188,184,201,207,207,167,  9,232, 79,103, 69,
- 92, 24, 94,197,207,187,161, 36, 58,163,124,237, 66,177,169,169, 36,250,109,148,125,126, 94, 38,194, 95, 62, 64,108, 76,  4, 18,
-227,163, 64, 81,106,112, 72, 18, 36,135, 68,157,122,141,241,224, 97,168, 86, 77,211,161,149, 97, 22,183, 35,190,200,196,206,115,
-216,170,149,139, 46,205,158,183,220,120,200,119,187,241, 42,250, 13,228,180,  3, 88, 22,112,176, 54, 65,115,143,249,144,164,103,
- 35,232,183,157, 74,134,162, 70,126,144, 67,235, 35, 76,  0,176,207, 65,163, 93,251,126, 27, 31,120,248,216,242,121, 51, 38,219,
- 15, 24, 52, 18,130,188, 55,208,165,191, 64,189,214,189, 65,  8, 45,112,229,250,109,132, 60,127,147,201,232,217,229,246,185,248,
- 53,166, 26,204,242, 34,147,201, 30,101,100, 72, 93,202,101,129,119, 17, 10,141,170,139,142,251, 16,243,189,140,243, 28, 14,217,
-114,213,170, 85, 58,123,123,123, 42, 50, 50, 18,187,119,239,102, 94,188,120,113,157, 36,201,237, 82,169, 84, 93, 29,166,173, 78,
- 23,126, 44, 32,160, 81,155, 65,131,216,225, 51,102, 40, 33, 20,206,220,176,105, 83, 64,118,126,190, 19,203, 48,176,181,178, 74,
-219,176,112,225,218,239,134, 14,205,127,253,224,129,113,232,249,243,198,  2,154,126, 97, 64, 59,255,  8,169, 20, 83, 34,145,132,
-220,189,123, 31,  7,  3,127,  1, 69,105, 32,149, 36,  3,  0,114,114, 11, 80, 13,201,250, 16,147, 85, 42,149,131,150,252,248,227,
-227, 37,179,253, 29,190,238,218, 13, 41,225, 97,160,242,178, 65,232,104,240,  8, 46, 20, 89, 34,100,101,202,177,224,200,201, 44,
-185, 82, 57,168,130, 73,162,194,118,150,106,172,132,102,166,224,155,136, 33, 16,155,190,167,197, 50, 50, 51,131,192, 68, 12,174,
- 64, 80,145,  3,247, 71,152,114,185,124,240,119,223,125,247,234,233,211,167,150, 19, 38, 76,192, 87, 95,125,245, 82,165, 82,117,
-  6, 80, 84,219,235,201, 48,140,228,235,175,191, 38,  9,130, 16,143, 28, 57, 82,152,157,157, 93,150, 89, 93, 46,151,227,234,213,
-171,104,216,176, 56,170,255,245,235,215,104,220,184,113,165,152, 19, 23, 68, 74,  0,172,156,253,157,243,134,199,225,210,153,  0,
-214,213,107,224,138,219,193, 55,113,255,118,104, 64, 59, 31,102,219, 55, 35, 91,255, 36,234, 60,116,158,119,203,  9, 28,177,153,
- 35, 14,157, 61,195,137,122,177,127,181, 82, 25, 81, 31,187,207,253, 80, 89, 59,  9,130,  0,203,178, 31,165,114,224,112, 56, 56,
-122,244,104, 77,207,253,100, 96, 96,224,212, 41, 83,166,240,165, 82, 41,222,190,125, 11,133, 66,  1, 35, 35, 35,  4,  7,  7,211,
-  0,118, 30, 61,122, 52,248,232,209,163,189, 80, 28, 77,116,171, 38,247,167,137,137,201,244,158, 61,123,226,237,219,183,120,246,
-236,217, 25,  0,175, 94,190,124,121, 38, 54, 54,118, 88,135, 14, 29,240,219,111,191, 77, 87,169, 84,129, 53,193,100, 24,166,124,
-206,164,210,138, 15,225,114,185,188, 93,104,104,104, 77,251, 93,154,155,155,219,190,132, 88,167,218,219,219,155,133,135,135,195,
-205,205, 13, 20, 69,181,173,233,189, 84, 80, 80,240,203,246,237,219,127, 29, 55,110, 28,126,250,233,167,145, 39, 79,158, 28,249,
-205, 55,223,160, 79,159, 62, 56,112,224,  0, 94,189,122,181, 14,134,149, 21,171,232,220, 95,  1,120,101,111,111,255,189,171,171,
- 43, 54,110,220,136,136,136,136,181, 43, 87,174, 92,248,234,213, 43, 52,108,216, 80, 24, 21, 21, 69,215,102, 12,  1,  0, 51, 51,
- 51, 51,157, 78,135,243,231,207, 63,  1, 48,123,228,200,145,118, 91,182,108,241, 19,139,197,200,203,203, 83, 69, 70, 70,142,  0,
-112,225,175, 30,235, 88,130, 88, 60, 97,226,204, 61, 19, 39,140, 48,106,213,178, 57,148,133,105, 80,201, 51,161, 44,202,192,246,
-192,235, 32,  8, 18,182,182,142,176,115,112, 65,114,114, 10, 30, 94,190,162, 85, 40, 85, 91,  4, 58,102, 93,213,152, 51,138, 49,
- 91, 20, 99, 42, 21, 89, 80,201,179,202, 48,237,236,156, 74, 48,147,241, 32,244,138, 90,165, 80,252,162,101,137,159,255,228,115,
-255, 39, 75,205,106, 29,150,151,252,252,252, 89,147, 39, 79,238,188, 96,193,  2,107,154,166, 57, 86, 86, 86, 72, 78, 78,166, 79,
-159, 62,157, 39,151,203,103,213,166, 53, 92, 30,239,149,167, 87,195,206,  3,  6, 12,160,251,247,239,199, 31, 53,174, 23,215,214,
-206, 14,  5,178, 92,196,188, 13, 67,244,155, 23,240,108,216, 12,203, 86,110,  6, 44, 44,170, 45, 36, 89, 82, 86,167,239,138, 37,
- 63,156,104,223,177,135, 89,195,198,205,248,205,235,155,131,210,209, 72, 75, 75,195,133,243,225, 84,228,243,251,133, 12,173, 29,
-166,204, 49,172,  4, 79,  8, 64, 35, 23,123,125,236,168,163,107, 54,108,159,187,115,239,193,121, 11,102, 78, 48,233,224,219, 29,
- 17, 55,127,195,153, 75, 39, 20,106,141,118,  3,159,131, 77,145,185, 80,198,212,240, 26,168,213,106,234,195,249, 84,173, 86, 83,
-159,218,211,  7, 14, 28, 64,102,102,166, 54, 41, 41,233, 26, 77,211, 39,171, 40,246,252,145,108,  7,180,  3, 53,154,155, 75,124,
-125,123, 45,  9, 14, 54, 26, 51,127,190,118,228,168, 81, 63, 64,163,161, 32, 16,176, 92, 19, 19, 18, 66, 33,239,245,131,  7,198,
- 91,167, 78,181, 34,180,218, 27,  7,171, 72, 27, 80,129,252,225, 81,135,165, 26,173, 78,157, 58, 96,204,132,217, 80,149,211,104,
- 61,122, 22,  3, 13,  5,131, 53, 90, 37,146,146,148,154,218,110,230,226, 37,103,135,245,236,234,237,227, 94,231,255,216,187,238,
-176, 40,174,245,253,206,204,246, 93,138, 72, 71, 20, 43, 74, 81, 80,108,216, 16, 75,236,137, 53,118, 81, 19,141,221, 88, 34,234,
- 53,150, 68, 33,154,216, 53,106,212, 88,110,236, 45, 98, 23, 13, 26, 27, 42, 74, 81, 68, 69,  4,  4, 68,122,221, 58, 51,231,247,
-  7, 69, 68, 88, 22, 52,191,155,155,187,239,243,204,179, 59, 59,103,190, 61,115,206,204, 57,239,188,231, 59,223,145, 88, 55,168,
- 15, 19, 59, 59,100,164,165,225,207,187, 79,116, 43, 14, 29,143, 44, 38, 89,  6,197,149,225,121,190,200,201, 29, 64,247, 89, 11,
- 64, 49, 12, 80, 28,198,161,100,230, 80,131, 54, 29, 64,  9,  4,224,  8, 15,181, 90,109,136,211,223,171,231,207,159, 15, 25, 61,
-122,116,112, 80, 80, 16,221,171, 87,175,150, 39, 78,156,224, 63,228,222, 81, 42,149,237,  1, 64, 42,149,198,213,170, 85,171,206,
-132,  9, 19,160,211,233, 80, 88, 88,136,156,156, 28,188,122,245, 42,123,194,132,  9, 90,  0,144,201,100,226,161, 67,135,154, 85,
-101,115,221,209, 36,213,215, 67,235,108,172, 45,120, 57, 34, 55, 61,188, 65,109,193,203,184,246,205,249,141,235,142, 38,169,204,
- 28, 10,190, 79,127, 25, 18,147, 82,112, 97,219,222,227,199,152,113,131,134,112,142, 38, 79,253,165, 54,228,104, 85,118, 41,138,
-122, 47, 56,169,129, 36,235, 29,228,229,229, 45, 92,178,100, 73,191,172,172, 44,199,222,189,123,139, 92, 93, 93,113,251,246,109,
-  4,  5,  5,177,183,110,221, 74, 44, 40, 40, 88,  4, 64,  5,224, 98, 77,202,180,105,211,166, 13,  4,  2, 65,201, 80,218,230,226,
-159, 55,159, 56,113, 98,248, 23, 95,124,129,250,245,235,187, 61,126,252, 88,130,106, 60, 71,132,144,210, 81,134,143,  9,138,162,
- 98, 55,108,216, 80,199,206,206,142, 58,119,238, 28,203, 48, 76, 77,148,155,221, 59,119,238,108,167,211,233,190,156, 52,105, 18,
-124,124,124,192,178, 44,246,239,223,143,157, 59,119, 26, 74,178,244, 34, 38, 38,230,126, 98, 98, 98,151,121,243,230,225,199, 31,
-127, 92, 56,111,222, 60, 36, 38, 38, 34, 38, 38,230,193,135,216,205,205,205, 85, 38, 36, 36,200,189,189,189, 91, 71, 70, 70, 70,
-250,250,250,186,127,241,197, 23,  8, 12, 12, 36,127,252,241,199, 80,  0,231,254, 19,189,247,147,103,153,251,132,156,224,194,138,
-239,215,126,219,184, 81,131,175, 38,142,255,156,105,234,236,142,130,156, 87,176,180,178,133, 99,221,134, 72,123,147,142,243,231,
-207,113,233,233,217,187, 57,154, 90,254,236, 89,102,242,135,216,172,227,216, 16,111,222,188,193,217,179,103,185,236,172,220, 29,
-208,209, 43, 30,199,103,167,194,  8, 67,148,172, 73,208, 19, 37, 94, 31,172, 44, 44, 44, 14,152,153,153,165,154,153,153,165, 90,
- 88, 88, 28,  0, 12,154,125,208,163, 76,235,192,188,179, 13, 29, 42,133, 84,218, 30,  2,193,156, 90, 22, 22,231,204,205,205, 51,
-186,118,237,170,217,182,109,155,234,241,227, 40, 62, 41, 41,145,152,155,155,231,148,166,175,200,102, 57, 88, 88, 52, 50, 85,216,
-187,127,107,238,216,242, 79, 19,123,183, 60, 19,123,183, 60,115, 71,207, 27, 10,123,183,101, 22, 22,141, 76, 13,202,103, 37,104,
-104,  3,107,103, 43,108,105,102, 77, 41,157,173,176,165,161, 13,172, 13,190,118,253,195,126, 28, 69,129, 67,209, 52,108,212,192,
-102,137, 13,158, 97,152, 61,142,142,142,246,168, 94,192,186,247,108,142,  1,234,143,145, 72,190, 60,226,239,239, 23,247,199, 31,
-163,115, 95,188, 24,153, 19, 27,251,249,131, 67,135,134,111, 30, 62,124,204, 72,137,100,210, 80,160,145,161, 54,237,237,237,  3,
-238,223,191, 31,100,232, 86,134,120, 25, 92,158,141, 26,214,185,208,171, 71, 59, 50,125,242, 96, 50,125,242, 96,210,171, 71, 59,
-210,168, 97,157, 11, 31, 80, 71, 20,195, 48, 35,228,114,249,  1,133, 92, 30,161,144,203, 35,228,114,249,  1,134, 97, 70, 64,191,
- 15,213, 59, 54, 45, 45, 45,239,217,218,218,166, 86,103,179,178,178, 10,171, 70, 62, 71, 54,104,208, 32,145,166,233,117,213,124,
-166,245,217,116,150,201,100,177, 10,133,226, 85,217, 77, 38,147,149, 13, 12,101, 41,151,203, 79, 43, 20,138,245,134,216, 92,189,
-216,253,219, 27, 23,167,133,175, 94,236,254,109,249, 99, 51,  6, 90, 76,184, 29,188, 60, 99,198, 64,139,  9,134,228,211,198,198,
-230, 15, 27, 27,155, 20, 27, 27,155, 20, 91, 91, 91,189,155,149,149,213, 61,  3,108, 74, 77, 77, 77,215,155,154,154,166, 42, 20,
- 10,206,196,196, 36, 85,161, 80,172, 67,153,208, 22, 53, 45, 79,154,166,  3,221,220,220, 84, 12,195,236, 42,119,232,199,198,141,
- 27,171,  4,  2,193,154,106,218, 52,235,220,185, 51,247,240,225, 67,226,227,227, 67,  0, 88,124,196,122,183,179,176,176, 56,103,
-102,102,150, 96,106,106,186,  9,128,162,134, 54, 41,  0, 35,234,212,169,243,160, 91,183,110,133,117,234,212,185,  9,224,179,143,
-152,207,126,  3,  7, 14,228, 19, 18, 18,  8, 33,132, 36, 36, 36,144,129,  3,  7,242, 40, 10, 20,249, 33,109,242,226, 41, 83,166,
-144, 91,183,110,145, 91,183,110,145,155, 55,111,146,126,253,250,241,  0,198,126, 96, 59,143,143,117,237,174, 13,173, 26,185, 52,
-177, 56, 60,106, 72, 39,254,226,169,117,100,233,162,175, 72, 79, 31,119,210,172,177,197,113,103,103, 75,231,143, 97,243,219, 69,
-147, 73,143, 46,110,188,107, 35,139, 67,174, 13,173, 26,253, 63, 95,251, 63, 81,213,194, 95,237,112,246, 86, 90,124,151, 44, 85,
- 12,  7,  7,  7,100,100,180,147, 10,  4,157, 36, 18,137, 47,205, 48, 87, 51,211,210,102, 23,191,110,113,255, 95, 82,173,222, 14,
-189, 17,196,122,150, 36,168,137,205,119, 28,217,107,104,179, 58, 54, 12,178, 89,217,162,210,188, 90,157,108,201,178,247, 54, 65,
-111, 25,188, 99,179, 78,157, 58, 95,242, 60,223,192,208, 12,209, 52, 29,151,148,148,244, 75, 77,202,179, 73,147, 38,164,120,120,
-155,250,152,245,254, 87,220, 75,255, 75, 54,247,174,109,225,208,172,133,203,252,136,251,143,127, 44, 30, 86, 44,197,178, 25, 22,
-166,157,186,117, 93,242,231,149, 63,190, 91,182, 41, 43,239, 63,124,237, 52, 12,244,105,251,  8, 54, 75,130,132, 86,203,166, 80,
- 40,220,214,182,109,219, 47,111,223,190,189,139,227,184, 73,255,163,247,103, 63,134, 97,230, 53,109,218,180,101, 76, 76,204,  3,
-142,227,126, 68,  5,129, 34,107,144,207, 69, 13, 26, 52,152, 42, 18,137, 36,249,249,249, 89,201,201,201, 75,  0, 28,254,187,149,
-167,107,147,218,173,  9, 41, 13,186,189, 50,250,121,102,232, 71,179, 73,120,142, 39,204,247, 49, 47, 50,194,254,  3,245,254, 79,
- 35, 89, 59,254, 63,254,184,135,209,166,209,166,209,166,209,166,209,230, 71,183, 41, 51,150,167,209,230, 63,208,230, 63, 18,  2,
- 99, 17, 24, 97,132, 17, 70,252,215, 65,105, 44,  2, 35,140,248,219,161,172,170, 85,170,102, 81,122, 88,105,117, 36,193,154, 48,
-219,203, 70,155, 70,155, 70,155, 70,155, 70,155, 70,155, 70,155,255,115, 54,255,169, 36,107,135,158,253,191, 12, 70, 89,213,104,
-211,104,211,104,211,104,211,104,211,104,211,104,243,127,129,104, 85,184,111, 28, 58, 52,226, 47,199,198, 65,168,  3,  0, 51, 79,
- 32,233,175, 72,111,132, 17, 70, 24, 97,132, 17,255, 97,236, 64, 37, 67,135,127,  7,162,229,  0,160, 61,138, 22,190,125,  2,224,
- 58,128,172, 15,176,103,  5,224,115,138,162,134,  1,  0, 33,228,  8,138,102,141,164, 27,114,178, 84, 42, 77, 85,169, 84, 54,197,
-223,223,168, 84,170,178,107, 25, 80,120,127, 54, 27, 41,179, 85,136,  6, 13, 26,164,170,213,106, 27,  3,254, 62,135, 16, 18, 78,
-211,116,132,137,137,201,149,152,152,152,160,234, 92,184,175,175,175, 31,195, 48, 43,  1,128,227,184,197, 87,175, 94,221,243, 23,
-214, 91,187,186, 14,118,191,106,117, 90, 54, 53, 45,115,  9,222, 15,228,  7,  0,216,210, 31,  1, 20,139,249,197,223,215, 76, 11,
-210, 31, 71,167,186,233,245,160,181, 80, 40,156,110,107,107,219,231,213,171, 87,247,  0,124,  3, 84, 29,213,184,110,221,186, 99,
-  5,  2,193,104,142,227, 26, 49, 12, 19,203,178,236,191, 19, 19, 19,247, 25,219, 16, 35,140, 48,194,  8, 35, 12, 32, 91,239,161,
- 90, 68,171,153, 37,236,  8, 48,  2, 20,122,130,224, 18,  5, 28,124,146,129,215,134,158,223,183, 25,116, 58,182,232, 63, 69, 52,
-184,115,207,233, 29,125,250,244,113,156, 49, 99,  6, 58,116,232,128,219,183,111,123,239,222,189,123,194,225,195,135,195,121,158,
-191, 10,224, 54, 96, 80, 40,  5,  5,138,226,180,140,234,211,167, 79,143,149, 43, 87, 50,238,238,238, 80, 42,149,248,227,143, 63,
- 58,173, 89,179,102,253,141, 27, 55, 46,  3,248,173,152, 16, 84,186,  0,158, 74,165,178, 41, 89,140,147,162, 40,155,161, 67,135,
-134,150, 37, 87,197,235,171, 81,132,144, 91, 20, 69,221,228, 56,238,246,209,163, 71, 19,155,  1,237, 38, 55, 16, 29,157, 29,167,
-117, 44,111, 83,173, 86,219,156, 92,189, 10,  2,137,  4,234,188, 92,120,143,127, 75,122, 47,125, 59, 31, 20,207,130,  1,201,242,
-253,126,125, 56,128,136,228,228,228,112, 31, 31,159,184,234,214, 48,195, 48, 43,207,159, 63,111, 79,  8, 65,175, 94,189, 86,  2,
-248,171,136,150,164,125,107,207,171,167,143, 29,144,230,103,166,162,247,103,195,255,253, 52,241,141, 31,128, 99,239,144,166, 62,
-176,165, 40,204,159,178,234, 55,  6,  0,182, 46, 26,245,205,186, 79,176,241,235,139,120, 13,192,183,152,252,  0,192,106,  0, 87,
-183,244,129, 45,128,  5, 83, 86,253, 70,  1,192,207,139, 70,205,223,210,  7, 27,166,157,171,118,216,138,169,126,126,126, 27, 87,
-174, 92,201,216,219,219, 35, 41, 41,169,183,155,155, 91,211,220,220, 92, 55,232,113, 34,174, 95,191,254,161,206,221,  6, 52, 28,
- 60,108,132,220,218,202,  2,201, 41,233,102,135, 14,236,154,204,220,250,163,207,203,151, 47,135, 27,219, 16, 35,140, 48,194,  8,
- 35, 42, 65,205, 35,195,183,178,135,172, 64,139,129,  2,134, 26,219,177,181, 91,247,145,125, 59,211,110,174, 77,240, 40,234,241,
- 39,167,174,220, 89, 67,223,140, 10,102, 57,178, 79, 33,194,201,176, 20,253, 51, 97,116, 44,  4, 23, 79,254, 86,212, 19, 78, 24,
-197,132,134,134, 54,241,242,242, 42, 93, 26,166,123,247,238,232,222,189, 59,181,117,235, 86,207,139, 23, 47,122,238,220,185, 83,
- 27, 28, 28,252, 43,244,199, 71,153,222,184,113,227, 53, 27, 55,110,148,248,248,248, 64, 34,145,148, 30, 48, 49, 49,193,128,  1,
-  3, 48, 96,192,  0, 38, 57, 57,185,215,233,211,167,123,173, 94,189, 90, 19, 31, 31, 63, 15,111,163, 52,235,197,146, 37, 75, 90,
- 87,240,243,121,138,162,158,179, 44,251,192,211,211, 51,177, 41,208,100,114,223, 14,151,166,118,116, 86,204, 94,184,187, 66, 59,
-  2,177, 24,123,253,138,250,234,178, 68, 43,238,202, 57,152,152,153,102,200, 77, 77,195,  1, 68,  0,  8, 39,132, 68,196,198,198,
- 62,118,  1, 60,219, 91,208,191,238,202,226, 61,170, 65,182,144,152,152,  8,115,115,115,153,143,143, 79, 10, 69, 81,203,254,248,
-227,143,143,237,144,215,110,217,252,169,162,172,151,225,120, 29,125, 11,115,134,117,146,207,222,244,251,119, 42,141,238,152,190,
-147, 40,138,166, 87,223,228,253, 81,180, 24,239,146,140,140, 12, 31,  0,176,180,180, 20,  3,184,186,238, 14,250,126,221,145,250,
-144,216,110, 34,134, 97,182,236,222,189,251,139,177, 99,199, 22, 45, 29,241,231,159, 48, 49, 49,193,138, 21, 43,234,207,157, 59,
- 55,128,101,217, 89,149, 41, 89,157,187, 13,104,184,225,199,239,220,242, 50,115,212,219,183, 28,190,235,208,188, 25, 61,101,250,
- 92,211, 13, 90,181, 29,199,113, 99,141,202,150, 17, 70, 24, 97,132, 17,213, 81,179,170, 36, 90, 77,173,176,167, 85,115,231,207,
- 71,246,235, 36,105,209,220, 29, 34,201,219,208, 45, 94,173, 91,195,171,117,107,218, 63, 63,175,103,232,221,251, 61,143, 94,188,
-173, 46,212,197, 31,142, 73,135,159,161,185, 42, 89,148,118,229,103,182,221, 10,178,223, 72,  1, 64, 81,203, 70,181,232,228,235,
- 43, 29, 59,118,132,163,163,163, 40, 56, 56,120, 98, 21, 68,107,209,147, 39, 79, 36, 12,163, 63, 30,170,131,131,  3,134, 14, 29,
-138,102,205,154,137,187,118,237,186,168, 50,162, 37,149, 74,223, 80, 20,101,  3,  0,181,107,215,230,150, 45, 91,246,128, 20,  1,
-  0,  8, 33,228, 22, 77,211,183,121,158,191,243,251,239,191,191,114,  3,108,122,123, 53,187, 62,117,204, 80, 57, 57,186,190, 82,
-146,160,202,205,173,240,119,185,137, 34, 77,166, 80,132, 75,228,210,  8, 20,173,229, 21,225,232,232,248,216, 13,112,108,219,172,
-193,197,173, 95,143, 50,221, 53,233,187, 42,203,178, 85,171, 86, 77, 61, 60, 60,164, 28,199,161,160,160,  0, 63,255,252,179,185,
- 76, 38, 51,239,211,167,207,210,178, 55,128, 43,208, 98,136,  3, 51,105,121, 50, 55,173,  6, 55, 82,173,206,222,173, 95, 14, 29,
-208,199,172,117,251,206,120,122,117, 63, 50, 51,243,144,147,157, 15,158,231,223,139,235, 51,237, 28, 82,183,244,199,154,173, 11,
- 71, 45,160,104,154,242, 28,244, 13, 62,181,203,153,185,109,219,182, 40,  0, 66,177, 88, 92,246, 62,116,144,213,105,190,166,201,
- 39,157,241,243,226, 49, 32, 60, 79,  0,172,169,134,154,101, 99,106,106,122,234,226,197,139,237,218,180,105,131,219,183,111,227,
-197,139, 23,152, 58,117,170,102,218,180,105,162,113,227,198, 81,115,230,204,153,177,122,245,234,163,  0,110,188,247, 32,  8,  4,
-163, 63, 27, 60, 92,156,159,157,171,210,168,181,154,218, 86,181,120,117,129,170, 48, 61, 43, 87, 53,124,212,151,154,168,176, 59,
-163,  1,188, 71,180, 62,176, 60,141, 48,194,  8, 35,140, 48,  0,132,144, 54,  0,172,  1,164, 81, 20,117,183,236,126,113,146,146,
-213, 90,202,239,167,163,104, 84,202,178,140,185,116, 20,185,251, 88,  3,224,  0,132, 82, 20,149,245,129, 89,212, 63,203, 48, 40,
- 40,136,148,253, 44, 67,180,  8, 33,132,232, 50,158, 19,117,204, 57, 82,120,247,151,247, 54,101,212, 49,146, 18,122,152,220,249,
-237, 91,210,212, 74,255, 42,236,125,155, 65, 55,202,  3,100, 74, 27,144, 89, 93,107,169, 66, 67, 67,131,121,158, 15,242,239, 12,
- 66, 30,253, 70,200,163,223,200,215,222, 32, 71,143, 30, 61, 31, 16, 16, 16,180,111,223,190, 32,  0, 85,249, 41,165,230,221,189,
- 73,238,216,128, 84,134, 39, 79,158,144,109,219,182,145,133, 11, 23,146, 93,187,118, 17, 84, 17, 65,189, 87,175, 94,127, 68, 70,
- 70,146,113,227,198, 61,128,158,192,128,174,128, 98,116,125,187,104,245,161,245, 90,205,216, 22, 36,171,139,180,194,235,183,183,
-183,127, 39, 63,129,206,118,100,115, 91,103,178,167,167,215,107, 66,200,121, 66, 72, 32, 33,100, 56, 33,164, 25,  0,180,  2,204,
- 62,179,183,124,166, 58,188, 65,169,153,212,190,202,117,239, 90,181,106,213,116,222,188,121,153, 26,141,134,196,197,197,145,237,
-219,183,147, 75,151, 46,145,147, 39, 79,146, 78,157, 58, 37,151,201,175,237,132,102, 78,169,154,157,203,213, 53,185,139,132, 12,
-179,249,238,165,163,228,217,245, 35, 36,244, 96,  0,249,247,191, 70,146, 25,159,181,211,154,201, 36, 42,  0,221, 42, 59,111, 90,
- 71, 52,105, 86,223, 58, 38, 62, 62,158,104,181, 90, 50,126,252,120,210,171, 87, 47,242,201, 39,159,144, 30, 61,122,144,238,221,
-187,147,110,221,186,145, 43, 87,174,144,228,228,100,210,163,179, 87, 65,127, 87,180,174, 70,214,154, 59, 57, 57,189,142,139,139,
- 35, 90,173,150,  4,  7,  7,147,253,251,247,147,224,224, 96,226,239,239, 79,  0,236,153, 50,101,138, 50, 43, 43,139,244,234,213,
-235, 21, 42,136, 26,239,228,228,244, 56, 50, 38, 49,113,221,170, 95,174,236,221,124,224,202,241,163,151,174,156,186, 16,122,230,
-228,133,187,135,239, 60,140, 61,233,228,228,244,184,130,250,255,160,242, 52,194,  8, 35,140, 48,162,106, 46, 82, 76,180,250, 21,
-139, 29,253,  8, 33, 61,202,237,247, 43, 38, 78,239,237,251,251,251, 47, 44,187, 95,146,198,223,223,127, 33,  0,226,237,237,125,
-128, 16,210,228, 35,100,127, 82,  5, 91,213,138, 86,  9,216, 87,161, 16, 57,247,129,144,211, 65,151,254,  4,124,118, 60,160,176,
-131,146, 50, 65, 70, 74, 60,162,175, 31,211,191,144, 68, 49,206, 62,129, 16, 64,240,227,199,143, 17, 29, 29,141,196,196, 68,200,
-229,242,247,210,253,249,231,159,144,201,100,176,183,183, 55,140,233,106,222,237,231,194,189,156, 96,226,237,131,244,145, 95, 33,
- 56, 56, 24,111,222,188,129, 72, 36,130, 88, 44,  6,203,178, 85,218,163,233,162, 21,127, 75, 84,172,138,210,248,  0,  2, 73,109,
-147,211, 91,151,206,106, 64,223, 10, 18, 42, 19,158, 33, 89,197, 25,166,228,153, 40, 32, 87,200, 83,100, 50,121,233,112, 33,128,
-  8,138,162,158,182,  2,132, 10, 19,233,233, 95,191,159, 99,199,132,  5, 75,149,207,194, 43,180,209,163, 71,143,201,  0,150, 18,
- 66,178, 61, 60, 60,108, 87,174, 92,105,145,148,148,132, 71,143, 30,225,240,225,195,105,108,209,133, 82,132,144,229,  0,208, 30,
-144,214,178,174,117, 97,243,183,179, 76,113,245,144,184, 38,119,145,185,235,128, 51, 67,198, 77,153,182,113,214,  0, 20,228, 41,
-241,219,165, 48,156,191,255,252, 83,  0,127, 66,143,223,219,150, 27,120,  6,164,117, 31, 60,120,240,131,107,215,174, 89,237,220,
-185, 19, 44,203, 86,184,237,220,185, 19,151,175,223,159,  9,224,158,129,217,114,104,208,160,193,229, 59,119,238, 88,203,229,114,
- 92,186,116,  9,217,217,217,165, 74,150,159,159, 31,149,157,157, 61,226,231,159,127, 30,242,242,229,203, 31,175, 95,191,158,129,
-162,181, 32,223,185, 17, 24,134,121,206,178, 90, 23,123,215, 38,130, 97,  3, 58,119,206,207,  8,135,137,165,  7,110, 61,124,126,
- 58, 59, 43, 67,201, 48,204,243,178,233, 63, 70,121, 26, 97,132, 17, 70, 24, 81, 61, 80, 20, 21, 68,  8,233, 79, 81, 84, 80,249,
-223,202,127, 47, 73, 23, 16, 16, 80,186, 95,114, 78, 96, 96,224,170, 50,251,133, 31, 41,123,122,157,225,187, 22, 51,200,174, 21,
- 37, 82, 63, 58, 14,117,244, 41,136,156, 58, 66,220,236, 83, 48, 78,157,144, 16,126, 21, 15,207,173,195,171,168, 63, 65,120, 14,
-246, 77,219, 26,154, 17,149,139,139, 11, 84,170, 34,215, 44,181, 90, 13,145,194, 66, 53,103,210, 40, 41,  0,240,  2,169,186, 12,
-131, 53,200,160,105, 71, 95,180, 77, 37,  8,181, 45, 18, 42,218,166, 22,157,247,253,248,241, 16,137, 68, 16,137, 68,160,138, 93,
-127, 12, 33, 90, 84,113, 98,190,104,248,170,162, 76, 80,133, 18,225,111,  7,151, 78,111, 43,121, 25, 33, 86, 71,222, 66,178,154,
- 39,167, 83,185, 51,134,228, 87,174,144, 39,201,228,242,  8,153,137,162,148,104, 81, 20,245, 28,  0,136, 80,184,111,255,242,233,
- 30,138,212, 88,133,234,110, 48, 82, 84,188,182, 18, 51,203,207,157, 59,103, 35, 16,  8,236, 56,142, 67, 66, 66,  2,162,162,162,
-176, 97,195,134,212,188,188,188,174, 97, 97, 97, 49,101,185, 35, 39, 19, 31,222,183, 98, 86, 67, 65,120,136, 84,253, 60,178,218,
-119,143, 85,243,129,189, 62,237,234,121,102,242,152,197, 24,216,247, 19,140,235,234, 70,226,146, 51, 85,  0, 46, 21, 75,175, 85,
- 33, 41, 44, 44,172,103,151, 46, 93,254,221,178,101, 75, 87, 66,  8, 90,180,104,129, 17, 35, 70, 96,223,190,125,120,248,240, 33,
-114,115,115,181, 23, 47, 94, 92, 15, 96,183,129,217,146, 91, 88, 88,156,191,114,229,138,181, 92, 46,199,197,139, 23,161, 84, 42,
- 97,111,111,143,105,211,166,137,  3,  3,  3,247,230,230,230, 14, 11,  8,  8,144,198,197,197,109,190,112,225, 66,125, 20,173, 59,
-247,222, 77,160,209,104,118,252,182,111,207,198,105,211,103,212,185,114,251, 81,176, 58, 63,207,220,201, 41, 49,215,218,194,196,
-116,253, 15,203,235,105, 52,154,201, 21,151,231, 31, 53, 42, 79, 35,140, 48,194,  8, 35,222,131, 94, 46, 82,150, 60,149, 39, 91,
-213, 33,105,  0,148,254,254,254,139, 40,138, 10,242,247,247, 95, 20, 16, 16,160,  4,144,252, 87,144,172, 82,162,213,191,127,255,
-144,160,160, 32,244,239,223, 63,164, 82, 19, 60,  7,109,220, 53,104,227,174, 65,230, 61, 19,191,  7,140, 44,119,241,124,141,115,
- 55, 96,197,165, 43,106,181, 90,176,103,207,158, 82,191, 45,  0,224, 56,238,163,215, 98,117,136, 86, 49,209,123, 47, 19, 13, 36,
- 38, 33, 59,190, 30,214,222,146, 43, 20,106,254, 60,141, 36, 53,207,254,248, 76, 91,120, 55,155,172,174,204,230,201,217,147,145,
-120,253, 50,228, 38, 38,137, 95, 92,139, 40, 85,177,138, 73,214, 11,  0,168, 47, 49, 13,222, 54,107, 96, 39, 59, 17, 68,154, 51,
- 71,144,172,230,213,219, 94,234,118, 87,114,179,129, 16,130, 23, 47, 94,160,176,176, 16, 55,111,222,196,177, 99,199,210, 42, 32,
- 89,104, 32, 49,249, 99,215, 55,163,219,153,229,189, 22,105,238, 94, 70,178,154, 55,104,168,203,170,197,192,142, 34,154,186, 72,
-209,140,172,123,251,166,152,253,229, 32,172,219,245, 59,171,177,233,220,127,227,169,179,159,231,171,181,139, 12, 36, 89,165, 98,
- 99, 88, 88,152, 91, 88, 88,152,  4,128,239,136, 17, 35,206, 14, 25, 50,  4, 33, 33, 33, 56,125,250,180, 51,128,148,226,116, 43,
- 80,180, 80,246,106,  0,177,149,  9,143, 34,145,232,224,229,203,151,221, 29, 28, 28,112,249,242,101, 40,149, 74, 76,153, 50, 69,
- 51,125,250,116,145,159,159, 31,149,147,147, 83,170,100,221,188,121, 51,163, 50,146,  5,  0, 73, 73, 73,231,142, 29,222,223,161,
- 75,151, 46,131, 26, 58, 55, 51,139,205,203,125, 35,151, 75,101,215, 67,174,138,238,222,185,177, 57, 41, 41, 41,180,226,242, 12,
- 54,184, 60,141, 48,194,  8, 35,140,168, 28,  6,113,145,114,202, 84,117, 80,230, 60, 97, 64, 64, 64, 84, 64, 64,192, 59,138,215,
-  7,162,252,172,195, 51, 37,125, 90,141,226,104,113, 57,  9,239, 95,  0,207, 87,231, 98,223,251,205,194,194,130,149,201,100,239,
- 16, 45,222, 64,155,153, 39, 14, 32,118,234,168, 82, 37,171, 68,217, 66,111,191, 15, 34, 90, 60,207,223,  4,240, 78, 38,228, 54,
- 77, 71,174, 31,224,218,209,173, 97, 29, 90,119,120,  3, 94, 21,178,170,165, 79,180,170,232, 60,242,233,227, 10,156,172, 75,109,
-178, 58, 72, 21,178,120,153,137,162, 60,201,122,  9,  0, 10, 91,231, 33, 63,246,105,214,213,179, 89, 99,154, 61,180, 22, 73,133,
-186,124,255,199, 90,109,108,  1, 57, 94, 73, 25, 46,253,228,147, 79,150, 90, 90, 90, 74, 55,110,220,104,238,228,228,  4,150,101,
- 53,229, 73,150,220,166,233,200, 13,  3,155,119,108,106,103, 65,235,142,110, 66,162,146, 43,220, 16,171,219,107,  8,201,178, 50,
- 55,185,176,109,213, 84,153, 92, 34,132, 74,165, 66,224,214,163,184,120, 35,178,127,122,228,201, 11,  0, 46,124,192, 13,249, 69,
-255,254,253,215,173, 88,177,  2, 58,157, 14, 19, 39, 78,196,243,231,207, 47, 62,121,242,100, 67,189,122,245,230,125,243,205, 55,
- 14,118,118,118,248,252,243,207, 69, 58,157,206,175, 18, 27, 63,252,246,219,111,253, 61, 61, 61, 17, 18, 18,130,236,236,108,216,
-219,219, 99,250,244,233,226,128,128,128,189,185,185,185,195, 86,173, 90, 37,125,241,226,133, 94, 37,235,157,251,154,227,190,223,
-190,110,234,188, 54,237, 59,209,207,158,197,176,  9,109,125,232,171,151, 79, 95,179,180,180,220,155,144,144,240,182, 60,  7,181,
-168,118,121, 26, 97,132, 17, 70, 24,241,113, 64, 81,212,153, 98,191,171,119, 84,174,242, 36,172, 68,177, 42,187, 95, 62,125,241,
-241,143,241,178,188,163,  2,226,245,110,120,135,254,253,251, 27, 60,173,158, 47, 72, 51,136, 60,149, 71,223,102,208,213, 49,129,
- 96,145, 15, 13,145,194, 66, 53, 96,197,165, 43,149,165, 85, 40, 20,  6, 43, 90,188, 90, 85, 85,165, 84,139,104, 21,251,104,157,
- 39,132,188, 67,180,204,109,155,250, 44,248,102,214,250, 78, 67,122,211,169, 95,122, 35, 59, 95,173,254,230, 17,203,191, 42,212,
- 79,178,138,122,113, 93,156, 92, 97, 18, 33, 85,200,203,146,172,  4,  0,144,218, 52,110, 59,127,246,180,173,221, 70, 14,160,210,
-166,116, 66, 86,182, 82, 61, 47,138,165,146,148,100,216, 99,224,106, 69,230,174, 92,185,178, 29,192,118, 31, 31,159, 84,133, 66,
-129,252,252,252,247,234,160, 36,191, 29,135,244,166, 83,191,104,135,204,  2,173,250,155, 40, 22,201, 74,254, 96, 85, 36,203,186,
-150,233,133,109, 43,167,202,147, 95,189,132, 72, 36,130,137,137,  9, 46,253, 25,129,244,168, 83, 31, 66,176, 64,211,244, 50,127,
-127,255,165,211,166, 77, 67, 70, 70,  6, 78,159, 62,141,190,125,251,226,192,129,  3, 78,103,207,158, 93,231,235,235, 11,134, 97,
- 16, 20, 20,  4,157, 78,247,180, 18, 51,131, 38, 77,154, 52,111,200,144, 33,  8, 13, 13, 69, 74, 74,202, 59, 74, 86,118,118,246,
-136,173, 91,183, 14,137,139,139,171, 82,201, 42,135,182, 13, 26,183, 18, 45, 92,242, 19,212,133,111,  4,105, 73,183, 67,130, 47,
-209,183, 50, 51, 51,229,  0,114,106, 90,158, 70, 24, 97,132, 17, 70, 24,172,106, 85,198, 69,210,138, 73, 84, 90, 69,251,101,  8,
- 86, 69,251, 84, 57, 21, 76, 83,238,248,195,191,242,154, 12, 82,180,  4,182,205,193,166, 70,150, 33, 90,111,222, 57, 46, 53,173,
-109,208,208,161,142,133, 96,219,238,210, 56, 90,210,140,140, 12,169,149,149,149,170, 44, 65,144,203,229,112,112,112, 64, 86, 86,
- 22,118,236,216,  1, 84,237, 20,205,154, 13, 25,131,182, 35, 39,226,174,163, 24, 68,167, 45, 85,182,182,141, 31,255, 14,217, 18,
-137, 68, 37,190, 97, 85,117,186,119,138,149,166, 91,  0, 72, 43,231,134,223, 73, 21,138,241, 82,171,186, 86,179,167,126, 33,140,
-123,163,198,149, 78, 11,179,143,254,176,192, 36,145,152, 76, 75, 64,206,141, 42,236,197,126,246,243,254,242, 74,214,171,150,206,
- 13, 23, 75,229,210, 47,197,181,235,219,249,207,153, 42,140, 75, 85, 83, 87,218,126,147,123,108,245, 55,242, 23, 48,157,247, 10,
-217, 87, 13,168,158,165,125,251,246, 93, 74,  8, 33, 60,207, 47,  1,128,178,249,157, 51,253, 75, 97,236,107, 21,130, 59, 45,206,
- 58,246,195,  2,211, 68,232,207,175, 85,139,129, 29,109, 45,204, 46,108, 91, 53, 77,158,146, 20, 15,137, 68,  2, 83, 83, 83, 36,
-166,230, 64, 40, 96,148, 31,120,191, 73, 58,119,238,188, 96,234,212,169,136,136,136,192,148, 41, 83, 82, 18, 18, 18,142, 31, 58,
-116,104,202,183,223,126, 43,232,213,171, 23, 82, 82, 82,176,102,205, 26,221,159,127,254,185, 10,192,154, 10,239, 71,129,224,139,
-239,190,251,142, 36, 39, 39, 83, 47, 94,188,128,189,189, 61,102,204,152, 33, 94,181,106, 85,169, 79, 86,117,148,172, 18, 36, 37,
- 37,133, 92,188,124, 11,159,158, 91, 15, 86,167, 14,201,206, 72,184, 22, 29,155, 21, 82, 91, 44,158, 91,167, 85,139, 26,149,167,
- 17, 70, 24, 97,132, 17, 31, 69,197,186,171,111,255,111,128,138,134, 14, 13, 34, 90, 79, 55, 45,158,224, 60, 97,218,124,200,156,
- 58, 66,253,248,  4,248,252,212, 82, 69, 75,106, 98,129,218,245, 92,145, 93,160,198,145,224,251,  0,240,180, 58,185,202,203,203,
-131,151,151, 23,182,248, 53,237,166,202,203,144,202,  0,168, 37,102,170,147,226,206, 87,206,158, 61, 91,200,243,252, 65,  0,103,
-171, 48,179,204,221,221,125,243, 79, 63,253, 36,118, 29, 57,  1,249,183,175,151, 87, 80, 32,147,201, 32,145, 72, 16, 30, 30,142,
- 43, 87,174,104,  0, 44,171,162, 66,239,176, 44,251,240,208,161, 67,175,154, 52,172,211,219,171,165,199,204, 69, 11,253, 77, 31,
- 93,191,136, 37,171, 54,243, 77, 90,247,202,  9, 60,112, 50, 47,199,164, 94,119,101,202,147,  7,  6, 92,234,195,114, 36, 43,217,
-165, 65,221,110, 45,155,187,207, 95,178,100,177, 89,212,245, 75,248,118,245, 54,226,236,217, 35,103,245,177, 83,185,233,242,250,
-159,168,222, 68,135, 26, 82,134, 33, 33, 33,219,  1,108, 47,217, 47,159, 95,255, 21, 27,248, 12, 99, 47,114,  0,  0, 32,  0, 73,
- 68, 65, 84,166,109,122,103,  5, 30, 56, 86,144,107, 90,175,135,190,252, 90,187, 14,234,224,104,109,113, 97,211,247, 95,201, 95,
- 39, 37, 64, 34,145,192,196,196,  4,  9, 41,217, 88,186,254,112,129,150,231,123,127, 40,209, 50, 53, 53,149,104,181, 90,108,217,
-178,  5,  9,  9,  9,222,  0, 18,238,221,187,183,109,248,240,225, 27, 91,180,104,225, 18, 21, 21,245, 52, 63, 63,127, 26,128,232,
-202,140,212,170, 85,203,219,218,218,154,186,117,235, 22,190,250,234, 43,205,140, 25, 51, 68,227,198,141,163,178,178,178,106,170,
-100,  1,  0,234,212,169,227,211,179,123,123,116,236, 57, 37, 68,163,202,190, 22, 23,189, 55,132, 38, 55,164, 53, 45, 79, 35,140,
- 48,194,  8, 35,254,103, 80,179,192,224, 62,128,160,169, 37, 38,187,215, 17,189,222,247,195, 12,146, 23,123,147, 40, 67,183,147,
-220, 19, 95,146, 51,107,198,145,179,155,102,147, 41,253,220,137,139, 13,245,186,169, 37, 38,251,188, 79,220,222, 89,221,187,111,
- 51,232,122, 54,  6,233,217, 24,164, 95, 83,232,  0, 44,106,213,170,213,201,233,109,223,198,209,154,222, 22,  4,192, 87,  0, 76,
- 42,201, 86, 69, 43,134,219,  3,216,225,229,229,197, 94,189,122,149, 60, 25,214,131,132,185, 88,145,105,211,166,145,111,191,253,
-150,140, 26, 53,138, 88, 91, 91,179,197,  5, 97, 95,149,205, 79, 63,253,212, 17,  0,234,214,173, 91,171,181,107,147,215,225,193,
-167,201,181,125, 27,201,174,233,131, 73,187, 22,174,233,118, 46, 93, 30,202,236,155,181,172,162,248, 74,109,218,217,217, 45, 36,
-132,244, 38,132,216,  3,128,179,179,165, 73, 43,151, 38,201, 15, 47,159, 38,215,247,111, 38,187,166, 15, 38,237, 61,220, 50, 28,
- 93,125,163,165, 54, 46,109, 13,177, 89, 17, 42,204,111,115,151,116,219, 38, 29, 30,232,201,111,169,205,134,109, 63, 63,245, 42,
- 57,149,220,185,115,135,156, 61,123,150, 92,191,126,157,236, 59,116,138,212,107, 51, 44,223,170,197,192,142,213,184,117, 42,203,
-167,121,191,126,253,200,211,167, 79, 73,159, 62,125,  8,  0,243, 26,218, 60, 25, 23, 23, 71, 34, 35, 35,201,162, 69,139,  8,128,
- 61, 83,167, 78, 85,230,228,228,144, 30, 61,122, 36, 20, 19, 44, 65, 77,242,217,168, 65,157,192, 65,  3, 58, 47,155,254,213, 16,
-159, 15, 45,207,143,  8,163, 77,163, 77,163, 77,163,205,255,  5,155,255,205,176, 47, 86,181, 74, 62, 91, 25,164,104,133,  0, 44,
- 50,176,189,185,141,246,223,171,214,108,154,187,101,251,158,249, 11,102,126,161,232,220,169, 39, 34, 46,255,138, 99, 65,135, 10,
- 84,106,205, 26, 17,131,159, 34, 51, 80, 24, 83, 69, 46,138,227,104,189,131,176,176, 48,121,237,198,111, 99, 48, 61, 43,138,205,
-186,173,154, 23,152,  2, 96,210,253,251,247,127,242,245,245, 93,249,101,199,182,131,167,119,232,  6,157, 78,135,125,251,246, 33,
- 62, 62,254, 56,128,197,134, 42,110, 17, 17, 17,233,110,141,157,102,  9, 25,193,252,105,163,  6, 89,167, 61,127,132, 87,143,195,
-  0,  0,106,181, 82,247,250,233, 53,207,234,100, 78, 38,147,221,177,182,182,126, 98,109,109,157,213,180, 97,221, 73, 18,  8,151,
- 76, 25,241,153, 77, 70, 92, 52, 18,163,138, 70, 70,213,170, 66,237,171,167, 87, 93,106, 82,187, 78, 78, 78, 18,133, 16,147, 43,
-204,175, 70,165, 75,125, 22,221,210, 16, 59,133,106,205,170,229,235,246,125,242,253,252,241, 18, 51, 51, 51,220,143,124,134, 37,
-107, 15, 20, 40, 53,186,222,233, 17, 39, 63,202,240, 24, 33,  4, 58,157,206,224,137, 14,149, 96,129,167,167,103,179,149, 43, 87,
- 58,251,249,249,225, 67,149,172,178,136,141, 75,242,175, 83,183,145,219,179, 39,247,125,107,203, 68,255,254,144,242, 52,194,  8,
- 35,140, 48,226,127,  6,253,138,197,156, 73,101, 62,195,170, 36, 90, 37,136,124,131, 66,  0, 43, 26, 50,249,219, 22,174, 92,183,
-148,166,214,143,231,  9,249,149,165,177,252, 69,  6,210, 62, 48,115,133, 66,  1,216, 79,  6,142, 18,  0,128, 80, 80,179, 14,178,
- 24, 79,  1, 12,249,229, 70,104,155, 95,110,132,254,171,248,183,239,  1, 84,107, 44,215, 84,128,200, 78,110,141,234,116,110,229,
- 46,101, 56, 37, 94, 61,126,142,204,  2, 21, 46, 69,197,103,211,132,254,181,186,153,122,241,226,197, 31,  0, 96,107, 46,127,220,
-217,173,113,189, 46, 94,238,114, 33,165,193,171, 71,247,145,163,212,224, 98, 84,124, 14, 40,170,198, 14,213, 31, 43,191,169, 17,
-167,238,254, 14,170,  7, 69, 81,151, 23, 77, 31, 41, 89,186,246,224, 71, 37, 89,  0, 10,147,146,146, 50, 10, 11, 11, 45,147,147,
-147, 53,168,121,144,184,103,185,185,185, 45,102,207,158,189, 98,222,188,121,243,127,248,225,  7, 81, 77,124,178, 42, 67, 86, 82,
-252,137, 46,238, 31,175,254,141, 48,194,  8, 35,140,248,159,192,164,114,159, 48,152,104,149, 18,134, 55, 72,  3, 48,173, 81, 35,
- 50, 39, 54, 22,154,143,149,179,138,148,174, 15,196, 93,  0,  3,106,124, 54, 77,229,221,126, 26,159,127,231,105,124, 62,120, 66,
-120, 66,212, 52,141,196,  2,173,118,213,211, 23, 73, 53,159,117, 71, 81,220,221,103,  9,202,123,207, 19, 85,132,231,  9, 79,136,
-134,162,240, 90,167,227, 87, 69,189,136, 63,245,119,200,111,122,196,201, 27, 65, 44,213,249,198,157,200, 57,  5,  5,218,205,233,
-143, 79,222,252,136,245,162,139,136,136, 24,237,237,237, 61,129,227,184,109,  0,116, 31, 96, 75,195,178,236,130,192,192,192,227,
- 17, 17, 17,135,111,222,188,153,242, 49, 72,214, 95, 90,255, 70, 24, 97,132, 17, 70,252, 83, 81,179, 69,165, 43,195,199, 36, 89,
-127, 71, 68, 62,123,233,245, 87,216,141,122,246,178,249,127, 67,126, 83, 31,159,184,151, 10,140,248,139,138,247, 34,199,113, 23,
- 63, 38,169, 62,127,254,124,  3, 84,176,172,206,223,173,254,141, 48,194,  8, 35,140,248,199, 98, 82,101,228, 75, 96, 44, 27, 35,
-254,  1, 32, 31,139,100, 25, 97,132, 17, 70, 24, 97, 68, 13, 80,169,162, 69,161,242,153,  3,151,171,241,  7, 53,153,125,112,217,
-104,211,104,211,104,211,104,211,104,211,104,211,104,243,127,206,230, 63, 17,246, 40,114,136, 63, 83,252,169,151,124,125, 76, 24,
-167,190, 26,109, 26,109, 26,109, 26,109, 26,109, 26,109, 26,109,254,211, 81,161, 35, 60, 80,228, 60,108,132, 17, 70, 24, 97,132,
- 17,255, 77,144, 20,111, 53, 61,110,132, 17,127, 53,217, 42, 37, 92, 53,241,209,106, 82,252,249,236, 47,204,236,116,123,123,251,
- 73, 30, 30, 30,174, 34,145,136,206,203,203, 91,126,245,234,213,101,229, 19,117,118, 19,220, 99,104, 56,190,253,133,  2, 40,  6,
-160,105,112,  4,175,174,135, 43, 91, 27,235,253,111, 13, 39,153,153,245,239, 20,205,136, 57, 86, 11, 78,167, 69,145,187, 85, 17,
-120,158,141,231,180,234, 94,149,157,108,231, 57,168, 30,203,241, 63,  0,100, 11, 64, 79,  5,248,173, 20,  4, 83,  8,216,159, 41,
- 48, 95,129, 33,171,193, 81,223,  8,132,204,194,148,176,163,137,255,132,  2, 59,114,228,  8,243, 33,231, 15, 27, 54,172,194,  5,
- 68, 29, 28, 28,130,228,114,121,227,202,206, 43, 40, 40, 72, 73, 73, 73,241,253,135,223,143, 93,  0,108,  2,224, 94,238,247,104,
-  0,179,  0,  4,127,232, 31,248,  0,  2, 91, 96,178,  8,248,  6,  0,180,192,234, 84, 96,123,200,223,200,199,208,218,218,250,154,
- 64, 32,112, 46, 40, 40, 40,200,203,203,107,100,106,106, 26,171, 80, 40, 20, 44,203, 62, 77, 75, 75,235,162,239, 92, 82, 52, 41,
-165, 74, 52,  7, 76, 99,128,225, 28, 77,207, 16,  2, 91,212, 60,191,173,184,  5, 55,100,129,219,169,120,187, 60,215,124,  0, 91,
-171,121,220,  8, 35,254, 10,124,208,172,195,166, 69,237,  3,124,  0,116,105,211,166,141,109, 65, 65,  1,162,163,163, 83,  1, 92,
-  3, 16, 82,188,197,124,140,156,210, 52,253,227,186,117,235,230,206,152, 49,163,116, 49,232,240,240,112,120,122,190, 31, 35,148,
-161,225,120,245,244,101,155,187, 17, 49,104,211, 99,104, 49,209,162,129,130, 20,248,246,108, 91,211, 44,152, 90, 88, 88, 44,167,
- 40,106, 24, 77,211, 85, 54, 26, 60,207,115,132,144, 35, 89, 89, 89, 75,  1,228, 85,231,143, 20,114,137,142,229,184, 10,255, 67,
-192, 48, 92, 65,161,186,210,176, 23,181,107,215,190, 73,211,116,195,178, 11,102,  3,239, 46,160, 93,217, 49,150,101, 95,165,167,
-167, 27, 66, 66,165,180, 64, 52,139,162, 68, 61, 65,243, 77,  1, 10, 20,232, 24,158,211, 92,226, 89,237,  6,  0,170, 15, 33, 89,
-246,117, 27, 93,255,122,113,160, 99,228,227,104, 44,154, 62, 10, 63,108,218,131,133,179, 38, 96,195,142,  3,152, 53,105, 36,220,
-220,220,245,182,186, 60, 68,171, 22,207, 28,214, 35, 96,203,225, 78, 11,167, 13,147,  4,108, 57,210,121,209,244,225,226, 85,155,
- 15,119, 94, 52,253,115, 73,192,230,195,157, 22,206, 28, 38, 91,181,245, 40, 15, 96, 76, 77, 50, 57,210,217,161,128, 98,217, 10,
-223,140,137, 64,160, 62,240, 52, 89,241,159,120,162,253,252,252, 60,148, 74,229,253, 81, 61, 91,  5,182,108, 90, 39,169,162, 52,
- 25,175,147,234,196, 62,  9,243, 23,138,100, 94,159,249,239,  9,215, 43, 15, 72, 36, 13,163,163,163,157,121,158,  7,199,113, 96,
- 89,182,244, 83,163,209,160, 75,151, 46, 31,107,226,204,  0,  0,203,139, 30, 86,  4,  0, 56,252,  1,182, 76,  4,  2,193,215, 98,
-177,216,135,101, 89, 87,  0, 16, 10,133,143,213,106,117,  8,203,178,235,  0,228, 87,211,222,250,164,164, 36, 55, 19, 19, 19,104,
-181,218,210,  5,232, 25,134,113,169, 87,175,222, 22,149, 74,229,252,161, 23,111, 11, 76,238,208,169,211,134,113,115,231, 50,202,
-107,215,176, 97,247,238,245,200,205,  5,128, 45, 85,157, 43, 22,139, 47,208, 52,237, 84,157,255,227,121, 62, 94,163,209,244,170,
-206, 57,  2,129,192, 57, 57, 57,217,198,193,193,  1,121,121,121, 80, 40, 20,138,146,253, 15, 65,  8, 64,245,  6,186,176, 12, 51,
-219,210,202,170,243,253,139, 23, 21,205,155, 55,167, 25,134, 89,  8,195,131, 84, 75,  0,172, 33,132,200,138,251,139, 13,237,219,
-183,247,166, 40,138,  5, 64,120,158,167,239,220,185, 51,146,231,121, 65,113,155,183,  6,192,110,  0,106, 35, 15, 48,226,255, 65,
-205,218, 81, 93,162,117, 22,128, 79,155, 54,109,100, 35, 70,140,128,143,143, 15,156,157,157, 33,149, 74,139, 26,241,140, 12,219,
-  7, 15, 30,124,126,237,218,181,207, 79,159, 62,141, 71,143, 30, 41,  1,252,  9,160,194,135,186,123,255, 78, 51,164, 38,146,141,
-  0,144,246, 42, 35,229,213,139, 55, 27, 83, 82, 82,214,  0, 40, 27, 34,188,209,152, 49, 99,230,204,156, 57, 19, 65, 65, 65, 56,
-112,224,  0,212,106, 53,242,242,244,240,151,194, 55,200,186, 18,  8, 40,226,128,132, 16, 64,110,  3, 40,108,107, 92, 82, 22, 22,
- 22,203,103,205,154, 53,219,205,205,173, 52,138,185, 78,167,  3,203,178,208,233,116,200,202,202,194,156, 57,115,138, 58, 90, 66,
-192,243, 60,206,157, 59, 55, 99,210,164, 73,200,202,202,250,186, 34,155,237,189,234,222,163, 41,218,177, 68,171, 33, 28,247,234,
-246,131, 87,173, 89,142, 99, 84, 42,109,133, 43,149, 75,165, 34,189, 36, 79, 40, 20, 58, 62,250,253,119, 27, 90, 44,  6,225, 56,
-128,231, 65,120,190,184, 56,139, 55, 82,244, 27,225,120, 16, 29,  7,158,229,193, 42,213,104, 59,117,170, 33, 69,209, 65, 40,150,
- 29, 24,253,229, 92,187,118,237,219, 11,235,215,117,  0,203,241,120, 30,247,202,238,254,189,219, 29,143,236,221, 50, 69,163,204,
- 27,  9,160, 70,113,182,196,114,179,139,155,127,254,197,241,238,131, 72,  4, 95,189,134,203, 87, 66,  0,  0, 23,174,222, 44, 33,
-220, 85, 86, 21,216,252, 22,179, 38, 14,148,  4,110, 62, 40,156, 53,113, 16,243,195,230, 67,194,153, 19, 62, 99,  2, 55, 30, 16,
-205,156,240, 25, 19,184,233,128,104,230,196,129, 76,192,134, 93, 30,  0, 44,  0,100, 85,102,172,178, 58,162, 88, 86,242,239,216,
- 84,  6,  0,210,182,109,131,238,205, 27, 56, 44, 93, 10,  0, 24,221,200,214,224,161,  9, 43, 43,171,123, 66,161,208,177,170,116,
- 58,157,174, 74, 18,236,231,231,231,169, 84, 42,239,177, 44, 75,  4,  2,129,255,168, 65,159,156,236,221,217, 51,163,108,154,240,
-240,135,150,171, 86,253, 62,240,240,253, 60,242,185,151,233,253,160, 31,253, 90,247,159,183,231,161,158, 14,153, 86,171,213,120,
-250,244, 41,202, 46,242, 94,  6, 92, 13, 31, 41, 26,192,  6, 75, 75,203,118, 25, 25, 25,163,  1, 44,202,205,205,245, 96, 24,  6,
-181,107,215, 94,164,209,104,158,155,155,155,239,204,201,201,185, 89,172, 26, 25,186,100, 64, 23, 51, 51,179,125, 39, 78,156,176,
-104,213,170, 21,157,158,158,142,  6, 13, 26, 32, 51, 51,179,237,181,107,215,188, 38, 78,156, 56, 49, 47, 47,111,108,241,203,160,
-161,104, 38,151,203,201,184,113,227, 40,142,123,123,185,187,118,237, 66,175,230,108, 99,235, 90,242, 66,149,134,228,  4, 63, 53,
-255, 74, 36, 18,253, 25, 31, 31,159, 83,221,194, 16,  1,223,140,155, 59,151, 49,121,249, 18, 38, 15, 31, 98,116,110,174,224,135,
- 34,117,171, 74,162, 69,211,180,211,190,  3,191, 58,139,197, 98,176, 44, 91, 74,  6, 75,218, 40,157, 78,  7,173, 86, 11,157, 78,
-  7,142,227,160,211,234, 16,240,253,234, 26,183,133,114,185, 92,110,111,111,159, 42,151,203,229, 31, 72, 46,235,101,210,244,151,
- 45,189,188, 38, 45, 29, 56, 80, 26, 26, 26, 42,165,105, 26, 44,203, 98,205,154, 53, 44, 33,164,150, 27, 96,246,  8,200,173,174,
-109,137, 68, 34,216,187,119,239, 72,177, 88, 12,  0,208,104, 52,104,222,188, 57,101,236,243,141,248, 15,146,173,247, 84, 46,125,
- 68,171, 79,110,110, 46, 56,142,131,169,169, 41, 24,230,221,126,223,210,210, 18, 61,123,246, 68,151, 46, 93, 48, 98,196,  8, 60,
-122,244, 72, 54, 98,196,136,158,149, 25, 27, 53,183, 63,234, 58,219, 22,119, 38,188,253,141, 51, 15,  2,119,125,119,212,250,245,
-235,215,115,203, 36,155, 56,121,242,100, 42, 35, 35,  3,195,134, 13,187,166, 86,171, 63,133,158,135,143,227,241,202,119,196,104,
-240,132,146,173,187,243, 11,165, 81, 41,  9, 77,211,202,146,161,195,154,148, 18, 69, 81,195, 28, 28, 28,112,240,224, 65,104, 52,
-239,135, 11, 51, 51, 51, 67, 84, 84,212, 91, 85,141, 97,208,190,125,123,134,162,168, 97,  0,190,174,216, 38,237,120,227,238, 75,
-155,146,253,254, 61,221, 69,237,189,232,212,228,212,  2,  2,128, 90,188,120,113, 41,113,  3,128,229,203,151, 27,146, 79,208, 66,
- 33,210, 66, 66,222, 54,196,  2, 26,180,136,  2, 37,  4,104, 65,209, 40, 42,  8, 64, 56,128,103,  1, 94,  7, 72,237,235, 26, 82,
- 12,109,235,212,115, 14, 90,181,118,107, 45,181,142,224,224,169, 96,196,197,189,  0, 67,211,104,212,216, 25,159,116,237, 44,244,
-106,227, 93,119,245,178,185,167,147, 19,158,245,  1, 16, 90,237,130,230,137,180,113, 61, 43,236,220,117, 31,214, 22, 38, 24, 54,
-176, 47,100, 82,  9,126,216,244, 43,190, 95, 56, 29,206,141,156,176,125,253,202, 74, 79, 55, 55, 55, 95,225,234,220,216,105,235,
-222, 51,112,117,113, 97,182,238, 59,  3, 87,183,226, 79,119, 87,102,235,190, 51,112,115,119, 99,182,238, 59,  3, 15,247,102,245,
-239,165,220, 89,145,153,153, 57,189,242,242, 44, 87, 71,159, 20,213,145, 48,159, 47,109,180, 95, 78,153,  2,  0,165, 68,171, 58,
- 16, 10,133,142,201,201,201, 54, 85,165,171, 74, 53, 40, 86,178,238,177, 44,139, 55,111,222, 80,217,217,217,164, 86,173, 90,  3,
-207,111, 95,116,162, 87, 39,207, 76,  0,120,248,240, 97,237,128,128, 85,  3, 15,221,203,133,242,246,102,234,223,191,135,240,163,
- 63,245,185,119, 42,208,207, 11,197, 75, 66,148,135, 90,173,142,107,217,178, 37, 41,254, 94, 71, 34,145,136,202,221,111, 14, 77,
-154, 52,121, 79,181, 54, 96, 72,113,195,173, 91,183,166,187,185,185,193,197,197,229,102,187,118,237,204, 20, 10,  5,206,159, 63,
- 15, 87, 87, 87,119, 51, 51,179, 59, 71,142, 28, 17, 46, 88,176,192,115,247,238,221,  0, 48,195,128,226,236,225,235,235,123, 48,
- 40, 40, 72, 42, 18,137,160, 84, 42, 17, 21, 21,  5,115,115,115,136,197, 98,124,246,217,103, 76,199,142, 29, 45,187,118,237,122,
- 44, 38, 38,102, 36,170, 49,  3, 74,165, 82,145, 69,139, 22, 65, 46,151, 67, 46,151, 67,161, 80, 64,161, 80,192, 68, 10,106,219,
-172,122,178,153, 59,178,101, 95, 47,221, 22,184,111,235,178,171,117,235,242,223, 38, 38, 38,102, 87,247, 94, 80, 94,187,  6,147,
-135, 15,129, 50,207,174,161, 48, 87,212,134,191,191,127, 85,138, 20, 68, 34, 17, 58,116,232, 80,165,189,218,181,107, 31, 23,  8,
-  4,239,188,153,178, 44, 43,245,247,247,231, 98, 98, 98, 20, 52, 77, 43,120,158,135,191,191, 63,199,178,172,212,198,198,230, 38,
-207,243,169,233,233,233,131,245,217,237, 10, 72,111,  2,131, 40,161,240,107,123,  7,135,  6, 62,141, 26,201, 47, 95,190,204,  0,
-128,147,147, 19, 73, 73, 73,201, 62,117,234, 84,158,  0,248,217,137,144,189,213, 32, 89,106,  0,243,105,154,222, 32,145, 72,  4,
-245,235,215,143, 95,178,100,201,173, 98,133, 20,132, 16,186,126,253,250,109,101, 50,153,147, 90,173,102, 81, 52,116,104, 84,179,
-254,  1, 32,132,120, 21,241,246, 82,104,  0,136, 75,  4,252,162,222, 14, 86,229,126,  7,128,244,226, 23, 69,219, 74,246, 51,  0,
- 60,  2,208, 12,128, 77,241,177,187, 20, 69,101,214, 32,155,149, 43, 90, 65, 65, 65,165,175,176,253,251,247, 47,237, 88, 76, 77,
- 77,113,247,238, 93, 80, 20,  5, 83, 83, 83,152,153,153,193,220,220, 28,185,185,185,120,244,232, 17,162,163,163,241,242,229, 75,
- 80, 20,133, 70,141, 26,161,228,102, 47,131,210,  6,238,183,159,130, 32, 53,145,128,162,128, 86,221, 60,224,209,165, 57,218,132,
-198,206,186,119,153,218,145,146,146,242, 20,128,160,121,243,230, 19,219,183,111,143,181,107,215, 66,173, 86,175,173,132,100,149,
-218,188,254,136,109, 13,  0,246,246,246,243,246,159,127, 46, 31,211,187,113, 97, 74, 74,202,143, 53, 40,156,119, 26,226,244,244,
-116,131,215,226,227,121, 30, 89, 89, 89,122,109,150, 87,  8,214,109,216, 92, 43, 47, 39, 21,223,253,176, 31, 58,157, 14,115,231,
-206,  5,207,243,165, 91,118,118,182, 65,249, 36, 28,247,190,118, 64, 23,141,158, 82,  2,160,222,240, 34, 94,145,112,112, 51, 40,
-  2, 80, 28,128,247,175,171,124, 39, 36,101, 68,178, 67,203,126,216, 88, 43, 44,250, 21, 78,  5,135, 65,155,155,132,148,135, 39,
-138, 36,199, 14, 35,113, 88,205,160,157, 71, 99,204, 94,188,218,226, 95,179,199, 30,210, 40,243, 92,240,238, 48,226,229,170, 31,
- 26, 14,223,173, 88,129, 29, 27,215, 98,245,218,141,200,205,201,134, 80,104, 85,220,208,115,224, 56, 78,255,181, 19,210,219,127,
-214,120,234,135,159,143,163,173,155, 61,142,157, 15, 69,167,150, 78, 56,113,241, 30,186,120, 53,192,169,203, 97,232,214,174, 49,
-206,134, 68, 98,246,228,145,212,200, 11,187,123, 87,167,142,214,175,223, 92, 43, 47, 55, 21, 65, 43,247,226,205,150, 45,136,159,
- 62, 29,109,139,211,132, 82, 20, 68,142,142,128,168,234, 58, 42,143,199,143, 31, 67,173, 86, 87,244,102, 14, 87, 87,215, 42,235,
- 93,169, 84,222,103, 89,150,164,166,166, 82,169,169,169, 80, 40, 20, 84, 84, 84, 36,231,238,222,124, 16,137, 62,250, 11,  0,  4,
-  4,172, 26,116,248,126, 46, 10,111,110,132,242,214, 38,136, 26,132,211, 59,150, 79,214, 78, 90,186,253,126,153,103,244,157,124,
-190,126,253,186,207,235,215,175,  1,  0, 13, 27, 54,140,142,137,137,105, 86, 50,212, 92, 60,132, 40, 98, 89,214,185,100, 56,145,
-101, 89,168,213,106,244,232,209,131,209,119,237, 22, 22, 22,237, 93, 93, 93, 17, 22, 22,134,141, 27, 55,214,246,245,245,197,179,
-103,207, 64, 81, 20, 86,173, 90, 69,185,185,185,  9,211,211,211,209,171, 87, 47, 28, 63,126,188, 67,110,110,110, 85,229,105,170,
- 80, 40,118,159, 62,125, 90, 74,211, 52,242,242,242,192,243, 60, 58,118,236,  8,154,166, 17, 25, 25,137,197,139, 23,227,248,241,
-227, 56,121,242,164,204,203,203,107,119, 97, 97,161, 43,222, 29,214,175,172,142,136, 74,165, 34, 18,137,  4, 18,137,  4, 82,169,
- 20, 82,169, 20, 98,177, 24,249, 42, 96,210,186,120, 53, 35,181,226,221, 91,118,106, 60,126,230, 42,250,199, 37, 19,174,  0, 56,
-101,232, 61, 15, 20,249,100,109,248,245,215,141,163,115,114,104,  0,216, 73, 81,188,150,144,213,134, 60,239,  0,144,175,202,129,
- 83, 35, 71, 28, 59,116, 18, 67,134, 15,172,144,100,  9,133, 34,136,132, 66,152,213, 86, 84,105, 83, 36, 18,217, 70, 71, 71, 91,
- 10,133, 66, 16, 66,192,113, 28,180, 90,109,234,191,254,245, 47,235,126,253,250,153,158, 59,119,142,238,215,175, 31,111, 97, 97,
- 81, 16, 26, 26,250,134,101, 89,203,206,157, 59, 87,106, 83, 14,120,168,204,155,108, 16, 51,172, 71,224,162,105,146,177, 99,199,
- 50,227,199,143, 71, 66, 66,  2, 38, 78,156,168,186,116,233,146,230,117, 74,202, 41, 49,207,111,214,  2,225,134,182,201,229,176,
-213,195,195,163,213,137, 19, 39, 38,248,251,251,223,155, 55,111,222,119,101, 15,174, 89,179,102,197,217,179,103,157,  6, 13, 26,
-180,239,225,195,135, 91,171,211, 46,125,104,223, 97,180,249, 97,168,140,139,148,136,163, 20, 69,  5,149,105,179,251,151,236,251,
-251,251, 47, 10,  8,  8,136,162, 40, 42,168,236,239, 37,233,138, 95, 22,131, 42,218, 47, 62,183,246,194,133, 11,155,  7,  6,  6,
-174,242,246,246, 62,120,243,230,205, 23,  0,170, 75,180,244,251,104,149, 92, 80,217,139, 44,215,169, 33, 55, 55, 23,185,185,185,
- 72, 76, 76,196,182,109,219,138, 31,104, 33,  4,  2,  1,  4,  2, 65,169, 63, 67,101,  8, 14,250,115, 19,128, 77,173, 90,181, 18,
- 70,220, 58,114,238,155, 29, 51,187,183,238,209,138,185, 31, 28, 49, 20, 69,235, 17,246, 25, 55,110,156, 21,  0,236,221,187, 55,
- 29,192,185,255, 16,107, 62,242,244,233,211,217,246,246,246,165, 62, 42,101,135, 15, 89,150,133, 84, 42, 69,137, 47,139, 74,165,
-194,182,109,219, 88, 66,200, 17, 61, 54, 17, 19,117,  5, 79,163,174, 22,157,199,243,224,185,183,231, 47, 91,182, 12,132,144,210,
-206,126, 74,177,114, 82, 37,201,171,168,204, 73,185,207,114,191, 19,142,171, 98,120, 66, 52,115,232,216,233,246, 60, 37,192,239,
- 87, 30, 64, 40, 20,130, 47,163,102, 10,153,162,183,229,168,103,201,112,176,117,199,167, 35, 39,219,157,216,183,121, 38,171, 85,
-253, 80,221,178,118,241,240,198,172,217,179,241,203,142, 29, 88,188,116, 69, 41,  3, 96, 57, 14,108,149,249,164,233, 30, 29,155,
-131,205, 79,  6,195, 48,232,214,182, 49, 24,134, 65, 79,239,166, 96, 24,  6,189, 58,186, 64, 32, 16,160,119, 39, 55, 52,105,210,
-  4,  2,129,128,174,162,222, 17, 19, 21,140,167, 81,127,148, 33,189,  4,  4,128, 54, 37,229,189,244,186,148, 20,144,122,150,213,
-189,183, 48,113,226,196,236,196,196, 68,109,249, 99,117,235,214, 21, 93,187,118,173, 86, 37,195,118,165,144,201,100, 94,  2,129,
-224,126,102,102, 38, 47,151,203,105,158,231,120,119,247,230,204,249,237,139, 78,148,164, 89,184,112,209,137,207,189,204,  6,237,
- 63, 18, 68, 68,245, 59, 81,148, 80,194,126,185,116,187, 72, 40,146,121,  1, 74, 67, 94, 30,104,181, 90,141, 39, 79,158,160,170,
-252, 16, 66,244, 14,211,100,101,101,141,115,117,117,189,182,105,211,166,218, 20, 69,225,250,245,235, 96, 24,166,116,139,141,141,
-  5, 77,211,248,230,155,111,180,185,185,185, 95, 84,149, 55,129, 64, 48,251,216,177, 99,230, 98,177, 24,121,121,121,165,207, 13,
-195, 48,136,142,142,198,143, 63,254,136,113,227,198, 33, 33, 33,  1, 14, 14, 14,152, 59,119,174, 73, 96, 96,224,108,173, 86,187,
-194,128, 42, 10,215,104, 52,173,229,114, 57,164, 82, 41, 74,  8, 23,  0, 92,140, 18, 70, 42,149,202, 22,150,150,133,118,214, 33,
- 65,191,119,240,253,212,211,210,218,222, 59, 37, 37,165, 90, 75,103, 61,  7,118,196,113,220,191,250,156, 56, 97,115,227,196,  9,
-254,246,233,211,175, 36,121,121,219, 13,190,135,116, 52,226, 99, 95,193,203,203, 11,247,239,223,135,151,151, 87, 89,210,  4,177,
- 88, 12,145, 72,  4,145, 72,  4, 43, 11,131, 92, 40,  8, 77,211,184,113,227,  6, 56,142,131, 70,163,129, 70,163,129,155,155, 91,
-230,213,171, 87, 77,  0, 32, 54, 54,150,140, 25, 51, 38,251,206,157, 59,104,217, 82,255,122,234, 42,138, 10, 94,182,234, 39,243,
- 31,214,239,134,121,109, 91,132,132,132,112,231,207,159,207,163,128,152,167, 81, 81,107, 63,  5,206, 30,  1,180,213, 41, 51, 91,
- 91,219,107, 12,195,212, 47,251, 91, 70, 70,134,197,224,193,131,145,149,149,213,119,240,224,193,157,138,219,132,164,163, 71,143,
-142,  1,  0,177, 88, 12,154,166, 57, 24,241, 95,133,170,184, 72, 89,162, 84,158,112,  5,  4,  4,244, 47,255, 91, 89, 82, 85,209,
-247,178,231,  6,  6,  6,174, 42, 99, 91, 89,131,236, 87,237,163, 21, 20, 20, 68, 42, 96,144,  6,163, 42,162, 85,130,176,176, 48,
-157,131,131,195, 47, 79, 31,188,236,222,216,163, 17,100, 10,201, 39,  0, 54, 73, 36,146, 57, 99,199,142,197,237,219,183, 17, 25,
- 25,185, 11, 31, 56, 11,167,121,243,230, 23, 36, 18,137, 83, 37,195, 36,241,145,145,145,189, 42,233, 24,150,158, 62,125, 26,250,
-156,225,175, 92,185, 82,182, 83, 42,235, 12, 95,241,141,193, 19,232,180, 58, 20, 20, 42,223,118,226,197, 68,171,160,160,  0,195,
-135, 15,127, 71,209,122,243,230, 77,149,215, 71, 81, 20,126, 60,117, 10,151,142, 28, 65, 95, 79, 79, 28, 15, 13, 69,224,216, 81,
-112,113,170,  3,194, 81, 32, 20,144,112, 96, 51, 50,114,243,241, 91,240, 13,100,230, 21, 98,116,231,206,112, 54,179,210,111, 87,
- 40,234,217,182,189,183,232,242,205, 71, 16, 10,  5,160,193,131,232, 10,225,224,218, 21, 12, 77,195,220,182,  1, 68, 66, 33,132,
- 66,  1, 98, 19,211,225,218,188,141, 56, 72, 44,237, 89, 19,162, 85,215,169,  1, 56,142,195,184,113,227,112,240,224, 65, 88,218,
- 57,193,188,110,115,124,191,118,  7,250,246,232, 92,229,245,151,188,193, 11,  4,  2, 48, 12,243,222,103,201,119, 67,212, 73,194,
- 19,104,203,215, 17, 79,  0, 66,224,184,114, 37, 28, 87,174, 68,104,241,127,186, 21, 20, 64,169, 84,  2,237,220,171, 69,178, 52,
- 26, 13, 18, 19, 19,181,175, 95,191,182,173,224,120,170, 70,163,169,146,216,236,217,179, 39,220,207,207,175,117,237,218,181,239,
-133, 63,124,168,243,240,244, 20,158,219,182,232,100,201,176, 33,  0,120,122,122,102, 46, 90,180,232,228,152, 97,253,  7,110,245,
- 31,193, 77, 93,177, 79, 32,145,201, 90,247,159,183, 39,252,192,176, 97, 85,143,205,168,213,113, 30, 30, 30,196,144,235, 42, 44,
- 44,124,173,231,240,  0,  0,203, 91,181,106,101,230,235,235,139,107,215,174, 97,200,144, 33,106,173, 86,251, 20,  0,250,245,235,
-215,244,183,223,126, 19, 63,122,244,  8,214,214,214,194,248,248,248,221,168,194, 65, 94, 44, 22,119,109,211,166, 13,173, 86,171,
-223, 35, 89,129,129,129, 24, 57,114, 36,154, 54,109, 10,158,231,145,159,159, 15, 95, 95, 95,225,198,141, 27,187, 26, 72,180,102,
-185,184,184,252,136,162, 89,135,101,219,194,199,197, 67, 80,200,200,200,120,253,224, 78,112, 84,231, 30,131, 91,215,111,210,220,
- 62, 50,252,190, 94,131, 54, 54, 54, 11,105,154,254,156,231,121, 38, 55, 55, 55,241,129, 70,211,196,205,201,201,182,227,192,129,
-200, 17, 10,153, 13,193,193,116,106, 94,158,  9,  0,131,134, 32, 85,186,  2, 56, 53, 42,114,245, 27, 50,124, 32,238,223,191,143,
-161, 35,  6, 65, 36, 18, 65, 32, 16, 22, 61,155,162, 34, 69,171,150,149,153, 65,247,166, 78,167, 43,109,195, 75,252,188,180, 90,
- 45, 74, 92,179,228,114,121,233, 49,181, 90, 13,138,162,244,221, 27,180,111,151,142,184, 25, 22,195,126,241,205,  6,181, 48,227,
-126,160, 29,207,239,121,  5,164,126, 64,115,238,124,120,197, 18, 27,153,153, 57, 56,157, 14,238,  3,135,150, 62, 39,119,118,110,
-149,129,231,101,217,241,113,152,113,228,244,199, 94, 51,215,136,255,  0,170,226, 34,101,137,210,135,130,162,168, 32,127,127,255,
- 69,  0,136,191,191,255,162,146,253,128,128,  0, 37,128,164, 26,146,173,247, 84, 46,193,199, 32, 89, 37,195, 11,250,224,235,235,
- 59,195,212,212,116, 99,201,126,226,237, 36, 36,222, 78,130,107, 51,247,142,173, 60, 91,231,140, 28, 57, 18,150,150,150,152, 55,
-111, 30,  1,176,171,186,255, 31, 27, 19,101,  2,128,216,219,219,207, 43,110,144, 61, 67, 67, 67,173,239,222,189,139, 54,109,218,
-188,149,238,181, 90,116,234,212, 73,159,169,188, 98,167,246,175, 63,158, 74,198, 67,171,213,162,176, 80,  9,141, 70, 11, 86,199,
-131,101, 89,120,185,155, 98,223, 14,255,162,223,216, 18,245,172, 72, 53,115,180, 51,133,169,137, 80, 71,211,148,242, 94,248,235,
- 10, 91, 76,141, 70,131,240,248,120, 60,124,249, 18,  0,240,105,128,126,199,215,125,193,215,224,230,230, 86, 85,110, 27, 59, 58,
-216, 33,249, 82,120, 81,227,173, 76,196,221, 63, 15,195,212,212,  4,  0,224,238, 51, 26, 34, 81, 17,209, 42, 80,106, 97,213,172,
- 46, 40, 66, 42, 13, 11, 32,183,176,187, 32, 16, 73,157,  8,199,131, 16, 30,132,231, 64,  8, 15, 70, 40,146,207,152, 50,  1, 60,
-207,161,109,219,182,160, 24,  6,156, 78,141, 97,  3,122, 34, 43, 39, 15,150,181, 12,235, 36, 68, 34, 17,124,124,124,100,149, 29,
-127,246,236,153,178, 44, 49,211, 95, 71, 58, 20, 20, 40,161, 86,171,161,213,176,208,234, 88,112, 13, 69,248,238, 95,163,192,106,
- 89, 20,142,240,134, 86,199,130,159, 61,  8, 90,141, 14,  9,114,154,246,112,181,210,209,160,148, 15, 30,167,153, 85, 69,180, 74,
-200, 65,101,168,200, 39,176, 18,178,245,208,207,207,207,203,195,211,243,254,231, 61, 60,127,138,136,140, 74,142,136,140,122, 47,
-157, 83, 83,207,184,169,129,  7,231, 10, 69, 50,175,254,243,244,207, 58, 44,139,178,195,136, 31,136, 69,121,121,121, 30, 38, 38,
- 38,136,137,137,  1,195, 48,160, 40,234, 25,  0, 15,  0,176,183,183,127, 46, 16,  8, 26, 49, 12,131, 45, 91,182, 80,  2,129,160,
-133,183,183,247, 34,149, 74,117, 88,207, 11,157,171,169,169,233, 59,106,150, 72, 36,130,191,191, 63,198,140, 25, 83, 74,178, 68,
- 34, 17,246,236,217,131,214,173, 91, 67,163,209,184, 26,152,223,187,  0, 58, 27,160,248, 81,197,228,188, 74, 50,202,178,172, 95,
-198,231,159, 55, 65, 72,  8, 58, 54,106,228,230,229,229,  5,173,246,173,160,211,168, 81,163,186,121,121,121,175,149, 74,229,191,
- 81, 20,134,224,129, 94, 82,164,226, 17, 31, 91,228,126,122,255,254,125,180,109,219,182, 84,193, 42,171,102,137, 68, 34,200,196,
- 38,213, 34, 90, 60, 95,212, 46,229,229,229,209, 33, 33, 33, 86, 46, 46, 46, 20,  0,184,184,184, 80, 15, 30, 60,168, 45,151,203,
-211, 27, 55,110, 92,213, 11,176,  8,  0,186,126, 50, 88,112,233,252, 89,  5, 11,172,120,205, 48, 43,  4, 85,182,145, 68,199,241,
-124,165, 78,247, 50, 51,115,236,241, 27, 14,  0,248,182, 71,239,210,151,173,243,203, 23, 65, 40, 20,162,251,188, 69,239, 61, 75,
- 60,207, 51, 48,226, 31, 69,178, 42, 82,180, 62,172,111,126,171,104,  5,  4,  4, 68,  5,  4,  4,188,167,142, 85, 19, 85, 43, 90,
-101,165,187,234,162,228, 97,173, 12,107,215,174, 69,139, 22, 45,244,118, 68, 27, 55,110,196,254,253,251,215,  2,136,173,182,228,
-216,189,149, 59,214,157,136,106,212,212,157,  2,128, 21,179,  7,208,  5,  5,  5,184,113,227,  6,204,205,205,241,236,153,193, 97,
-191, 76,205,205,205,151,211, 52, 61,140, 41, 63,  3,160, 98,130,201,241, 60,127, 36, 39, 39,167,210,240, 14,132,  0, 90, 29,139,
-130, 66, 21, 52, 26, 13,102,127,179,185,202, 76,  4,  0,148, 86,147, 39,240,233,226, 45,171, 76,209,105,219,162, 43,166,141, 53,
-121,175,243,102,104,128,166,129,150,109,139, 20,151,  7,161, 81,224,121,128,227,  1, 43, 27, 11,236, 58,240,147, 94,146,207,114,
-124,241,219, 49,135,124, 53,  7,215,246,253,241,234,113, 72,169,130, 36, 22, 21, 13, 25,139,132, 66,240,132, 42,138,250, 80, 89,
-171, 43,150, 57,101,165,196, 58,239,  8,138,192,164,254, 45,112,244,114, 56,134,246,240,192,213, 59,143,224,219,206, 13, 81, 79,
- 95,194,221,185, 62,182,236, 62,  2, 66,144,247,243,186,239, 95,191,237,208,216,120, 67, 20,173,219,183,111, 43,203,171, 88,101,
- 63, 73,213,253, 33,  8,121,171,104, 41, 85,106,204, 91,104, 80,232,157,162, 58,234,220, 94,102, 72, 98,125,138,149, 33, 68,172,
-188,178,133, 42,194,179, 52,  4,208, 26, 88,240,159,108, 56, 57,142,195,153, 51,103, 74,235,163,162,122, 44, 91,119,  6,144, 28,
-196,199,199, 35, 42, 42, 10,237,219,183, 71, 78, 78, 14,132, 52,141,185, 17, 17,112, 27, 59, 22, 26,145,  8, 60,207, 67, 44, 22,
- 99,242,228,201,  6,151,103, 53, 91,231, 98,199,107,174, 42,227, 63,121,123,123, 55,137, 41, 40, 64, 84,116, 52,122, 44, 91,  6,
-  0, 56,123,246,236, 59,247,196,156, 57,115,196,143, 30, 61,154,120,239,222,189,137,201,201,201,107,  1,204,173,180,157, 37,234,
- 82, 31,173,207, 71, 13, 65, 19,151,134,216,255,235,129,210,227,115,230,207,130, 80, 40,130, 80, 36, 68, 45,243, 90,  6, 93,141,
- 78,167, 43, 37,173,133,133,133,244,217,179,103, 29,123,246,236, 41,154, 53,107, 22,  5,  0,251,247,239,167, 55,109,218,164,184,
-116,233,146,168, 78,157, 58, 41, 85, 40,  4,185, 73, 25,106,  9,  0,212,171, 87, 15,155,183,255, 78,247,235,215, 15,179,102,205,
-130, 78,167,195,214,173, 69,207,213,200,145, 35,161,213,106,113,236,216,177,146,231, 88,175, 26,197,106,181,239,221, 55, 20, 69,
- 65, 40, 20, 66, 36, 22,  1, 60, 15,138,162, 20,107,214,172, 89, 17, 21, 21,213,198,197,197,  5,106,181,122, 44,138, 38,127, 24,
-227,104,253,151,145, 45,125, 92,164, 34, 95,171, 98, 85,170, 50,164,149,245,219,170,140,168,149,245,217, 66,205, 38, 80, 24,230,
-163, 85, 17, 24,134,169, 82,173, 42,153,170,171, 15,115,230,204,129,169,169,105,101, 29, 16,137,136,136,120,148,146,146,178,  3,
-192,230, 26, 85, 78,112, 88,212,242,175,  7,229,161,120,108,181, 86,173, 90,233,221,186,117,203,  7,160, 61,124,248,221, 23,100,
-181, 90, 93,105,  7,110,110,110,190,124,231,206,157, 51,  7, 14, 28, 72,151, 15, 49, 80,118,120,175,100,211,233,116, 56,124,248,
-240,204,  5, 11, 22, 32, 39, 39,231,107,125,157,120, 97,129, 18,202, 98, 71,232,231,145, 71, 13,109,212, 43, 61,100, 82,203, 30,
-142, 13, 61, 42,237, 76,104, 81,145, 15,145,109,189,183, 29,152,169,169, 20,156, 30,155, 20, 69,199,190, 76, 72,174, 83,215,174,
- 54,158, 39,166,193,182,126, 11,100, 37,189, 45,  7,129,128,129,176,120,232,176,150,153,  2,105,111,222,128,166, 25,189,196,248,
-251,223,194,112, 39,242, 37,142, 93,126,  0,173,170,  0,235,246,158,135, 86,157, 15,173,170,  0, 90, 85,209,231,170,  5, 95,130,
-162,240, 90,167, 46,104, 90,157,122, 23,  8,  4,104,215,174, 93,165, 68, 39, 41, 41,201, 64, 69,139,148, 42, 90, 74, 85, 53,235,
-200,176, 55, 39,189,138, 85,201,241,154, 18,131,146,144, 15, 50,153,172,245,158, 61,149,135,113,168,  8,118,118,118,231, 76, 76,
- 76, 26, 24,154,190, 26,193, 75, 87,213,170, 85,107,185,139,139,139,235,186,117,235,132, 12,195,160,123,247,238, 77,237,236,236,
-226,  1,192,221,221,221,161,164,141,153, 58,117, 42,185,125,251,118,100,209, 59, 70,229, 16,139,197,209,230,230,230,173,125,125,
-125,145,147,147,131,196,196, 68, 40, 20, 10,184,253,244, 19, 34,166, 78,133,231,182,109,160,187,117,  3, 69, 81, 16,139,197,136,
-136,136,128, 76, 38,139, 86,169, 42, 13,249,214, 14,192,106,  0, 29,241,118,184,144,  0,184,129,162,176, 11,119, 42,104,239,104,
-  0,224,120,190,170,202, 26, 53,111,222, 60,100, 11,133, 64,191,126, 16,197,198, 66,171,213,162,125,251,246,165, 42,123,251,246,
-237, 33, 16,  8,224,225,225,  1,  7,  7,  7,108,217,178,101,148, 62,162,165,202,215, 34, 62,246, 21,188,189,189, 75,149,171,126,
-253,250,149, 42, 90, 66,161,176, 84,217,162,184,170,137, 43, 69, 81,164,236, 75, 50,199,113,148, 64, 32, 16,124,253,245,215,212,
-144, 33, 67,136, 70,163,225,197, 98, 49,125,236,216, 49,234,234,213,171,130,130,130,130,170,212,134,130, 17, 35, 70,216,212,173,
-235,136,196,231, 81, 56,122,148, 96,237,218,181,184,118,173, 40,202, 70, 76, 76,209,196,213,146,125, 95, 95, 95, 52,104,208,  0,
-164,138, 27,185,181, 22,192,  0,  0, 32,  0, 73, 68, 65, 84,191,249,160, 97,248,182,103,159,162,246,164,129, 53,132, 34, 33,196,
- 34, 17,230, 69,191, 42,173,107,179, 61,  7,197,129,129,129, 67, 93, 92, 92,138,134,246,  1,129, 49,142,214,127, 23,170, 16,122,
-210,202,145, 36, 77,153,253, 52,  0, 84,241,126, 90, 25, 66,149, 70, 81,212, 93, 66, 72,155,114,105, 75,142,107,202,125,150, 28,
-127, 88,131,236,151,172,117,248, 30,249,210,247, 70,252,244,214,173, 91,206, 94, 94, 94, 72, 72, 72,120,111, 38, 92, 73,199,165,
- 80, 40, 32,147,201,112,243,230, 77,  0,120, 90,153,177,171, 87,175,110, 66, 81,212,101, 20, 15, 27,120,251,126,222,245,102,219,
-222,109,240, 91,192,129,156,148,148, 20, 15,188,141,161, 67, 57, 56, 56,140, 17,138,  5,195, 27, 53,175,231,  3,158, 95, 29,124,
-250,198, 50,125, 87,216,168,169,123, 62,  0,101,201,172,195, 26,206, 62,  4, 77,211,195,  6, 14, 28, 72, 63,122,244,  8,195,135,
- 15,199,254,253,251, 43, 77, 59,102,204, 24, 28, 60,120, 16,  3,  7, 14,164, 23, 46, 92, 88,105,120,135,119,213, 18,205, 71,187,
- 41, 99,158, 61,196,190,131, 59, 43,245, 65,178,177, 41,242,199,122,243, 38,189,244,183, 54, 94,250, 71, 70,120, 86,115, 41,236,
- 94,168,119,135, 46,221, 69,137,169,217,224, 89, 53, 84,121,111,207, 47,204, 78,  5, 97, 85, 16,201,107,195,206,202, 28,247,111,
- 93,212,104, 53,170, 75,250,108,206, 28,232,142,169,  3, 92,  1,194, 99,208,220, 93,  8,218, 60,163,244, 13,186,211,144, 89,  8,
- 62,188,193, 96, 31,191,242, 16, 10,133,136,136,136, 80, 86,166,102, 49, 12, 99, 72, 76,174, 98,213, 81,135,194, 66, 37, 10,149,
-170,143,217,118, 88,219,218,218,254,108, 97, 97, 33,173,132, 72, 89, 91, 91, 91,255,108,105,105, 41, 53,116,232,176, 50,146, 85,
- 28, 87,235,158,159,159, 95,181,200,150, 68, 34,105,240,244,233,211,210, 96,165,250, 62, 53, 26, 13,124,125,125, 13, 13, 94,122,
- 26,192, 11,123,123,251, 27,110,110,110,230,207,159, 63,199,129,  3,  7, 68, 66,161,176, 94, 73,251,145,151,151,  7,134, 97,240,
-230,205, 27, 29,128,  9,168, 98,232, 76,173, 86,135,132,132,132,180, 28, 48, 96,  0, 19, 29, 29, 13,134, 97,138,242,229,237, 13,
-207,109,219, 16,249,245,215,240,121,249, 18, 42,173, 22, 82,169, 20, 23, 46, 92,208, 22, 22, 22,134, 84,102, 79, 38,147,237,136,
-139,139,115,151, 74,165,208,106,181,224,121, 30, 52, 77, 83,  2,129,160, 83,173, 90,181, 54,  2,104, 83,174,178,108, 60,219,248,
- 54,227, 88,150, 75, 73,120,158, 86, 85,  1,100,100,100,224,244,233,211,104,223,190, 61,124,124,124,144,148,148,132,216,216, 88,
-244,237,219,183, 52,205,195,135, 15, 17, 22, 22,134,198,141, 27, 87,173,232,209, 58, 52,110,214,  0, 34,145,168, 72,205, 17,138,
-138, 95,124,132,165, 74,150, 72, 40,130, 80, 32,132, 84, 38, 53, 88,209,162, 40, 10, 52, 77,131,162, 40,200,100,178,146,151,108,
-222,209,209, 49, 37, 51, 51,211, 30,  0, 35,147,201,192,113,156,222,151, 22,158, 16,103, 81,250,205,228,185, 11,126,180,  9,  8,
-184,140,203,151,223,128,166,105,216,219,219,131,166,105,196,197,197,129,166,105, 56, 57, 57,129,166,105, 36, 37, 37,149,144,196,
- 44, 84, 78,134, 75,159, 27,138,162, 74, 73,150, 72, 44, 42, 85,182,  0, 32, 59, 59, 91, 53,112,224,192,127,171,213,234,241,168,
-217,170, 39, 70,252,141, 65, 81,212,221,255,196,185,213, 64,191, 98, 98,245,158, 83,188,190,155,177,111,135, 14, 29,182,141, 28,
- 57,178,251,250,245,235, 97, 98, 98,130,148,148,148,210, 14, 81, 44, 22,163,110,221,186,200,204,204,196,246,237,219,241,234,213,
-171, 43,  0, 38, 27,154,163,148,148,148,219,207, 30, 60,205,240, 29,218,193,210,189, 67,179, 90,137, 79, 95,181, 79, 73, 73,185,
- 89, 76,178,118,141,156,211,119,188,239,224,182, 16,137,133, 72,124,246, 26,193,167,111,252,191, 84, 38,195, 48, 12, 69, 81, 24,
- 62,124,184, 65,233, 71,140, 24,129,144,144, 16,232, 27,102,228, 75, 20,173, 66, 21, 10,148, 31,239,197,106,218,140, 49,152, 54,
- 99, 76, 41,153, 48,100,232,  5,  0, 28, 28, 14,233, 33, 90,218,245, 65,135,182, 79,106,213,214,219,169,181,123,  3,220,185,247,
-  0,191,109,123, 43, 50,236,222,180,  2, 63,236,190,130,186,182, 22,208,170, 11,112,238,232, 47,175,181,234,194,245, 53, 20,229,
-138,200, 45, 69,129, 16,190, 90,215, 94, 66,158,132, 66, 33,154, 55,111, 94,169,162,149,153,153,169,172, 74,205, 42,173, 35,141,
- 14,249,  5, 74, 40, 11, 63, 26,209,242,236,212,169,211,165, 35, 71,142, 88,218,216,216, 32, 57, 57,185, 60,209,242,236,216,177,
-227,165, 35, 71,142, 88,218,218,218, 34, 49, 49,209,224,176, 34, 21,144, 44,164,165,165, 81, 89, 89, 89,188,133,133, 69,181,200,
- 22, 77,211, 80,171,213,120,252,248,177,161,127,107,240,108, 46,115,115,243, 61,  7, 15, 30, 52, 79, 79, 79,  7,195, 48,120,252,
-248,241, 59,179, 14, 75,182, 93,187,118,137,  6, 13, 26,180, 51, 59, 59, 91,239,180, 54,150,101,215,142, 25, 51,102, 98, 82, 82,
-146,133,141,141, 13, 82, 82, 82, 32, 22,139, 65,  8,  1,229,235,139,206, 47, 94, 64,203,113,144,201,100,136,137,137,193,142, 29,
- 59, 10,138, 67,197, 84, 40,144, 81, 20,229, 44, 18,137, 48,122,244,232,119, 14,236,221,187, 23,159,182,102, 90, 91,155, 11,242,
- 89, 72,213,169,178, 62,231, 24,134,161, 60,219,117,107,218,174, 75,191,230, 79, 34,239, 60, 79, 75,125, 85, 85,163,164,211,104,
- 52,112,113,113,193,221,187,119,113,249,242,101,116,235,214, 13, 62, 62, 62,  8, 15, 15,199,197,139, 23, 17, 22, 22,  6,138,162,
- 96,105,105, 89,226,126,161,215,  7, 67, 83,200,226, 77,114,198,123,234, 85,249,125,145, 72,  4,181,210,176,201,125,209,209,209,
-184,123,247,110,105,104, 25,134, 97,216,177, 99,199,130, 16, 66,226,226,226, 96,106,106, 74,252,252,252, 56,129, 64,192, 38, 37,
- 25,230, 31,108, 98, 98,  2,103,103,231,119, 94,124, 74,182,206,157, 59,227,222,189,123,160,105, 26,  2,129,  0, 54, 54, 54,184,
-113,227, 70,149, 55,126,  9,169, 42, 33, 89,  2,145,240, 29,210,199,243,124, 94,120,120,248, 36,  0,225,197, 74, 22, 96,140,163,
-101,196,255, 31,206,224,253,133,165,171, 84,180, 94,  0,232,113,224,192,129, 81, 39, 79,158, 92,187,113,227, 70,235,254,253,251,
- 35, 43, 43, 11, 78, 78, 78,176,183,183, 71, 80, 80, 16,206,158, 61,155,206,113,220, 92,  0, 21, 73, 63, 61,160, 39,102, 77,210,
-243,148, 35,234,252,252,169, 94, 62,174,184,114,248,122,128,157,157,221,100,134, 97,102,251, 45,250,108,124,215,129,109, 16, 19,
- 22,135,219, 23, 35,144,154,144, 94,165,205,242,206,240,181,106,213,154, 40,151,203,197,168, 96, 42,113,  5,179, 14, 75,109,114,
- 28,199,105, 52, 26, 28, 58,116,200, 32,178,117,224,192,  1,168, 84, 42,112,239,143,175,150,218, 36, 60,161,  4, 66,  9, 28,234,
-186, 64,171, 45,  0,207,215,120, 66,101,169,205,146, 55,208,231, 98, 49,108,210,211,113,231,206, 29,195, 40,119,191,126, 85,213,
-145, 74,163,202, 27,189, 97,229,188,160,233,254,171,107,117,235,208, 18,223,254,180, 23, 90,237,110,208, 12, 13,153, 68,  4,175,
-182, 29,193, 64,141,159,  3,231,103, 23,230,102,141,198,251, 75,241,188, 99,147,232, 27, 97, 33,  0,199,243,184,124, 45,212,224,
-107, 47, 51,204,  1,129, 64,128,103,207,158, 41, 43,154,109,200, 48, 69,195,156, 37,111,234,250,108, 18,158,167,132, 34, 41,234,
- 58,185, 65,163,206,255, 40,117,100, 99, 99, 51,255,196,137, 19,150, 37,161, 18,194,195,195, 65, 81,212,227,183,138, 99,209,113,
-165, 82,137,200,200, 72,132,135,135,  3, 69, 51,220, 12,126,142, 74,148,172,180,180, 52, 42, 37, 37,  5,114,185,156, 14, 15, 15,
- 87,123,120,120,220,171,226,249, 46,181,169, 82,169, 94, 86,230, 63,169, 82,169,234, 72,165, 82, 97,185, 14,207,161, 73,147, 38,
- 49, 21, 12, 33,190,151,207,156,156,156, 59, 11, 22, 44,240,234,221,187, 55,230,207,159,159,105, 97, 97, 97,250,243,207, 63, 11,
- 24,134,161,166, 79,159,206,189,121,243, 38,255,151, 95,126, 49, 63,121,242, 36,178,179,179,111, 26,112,237,121, 42,149,106, 82,
-135, 14, 29,246,158, 63,127, 94,238,236,236,140,220,220, 92, 16, 66,176,103,207, 30, 76,159, 62, 29, 82,169, 20, 49, 49, 49,248,
-244,211, 79, 11, 11, 11, 11, 39,225,125,223,201, 18,155, 20, 69, 81,132,231,121, 44, 89,178,164, 52, 56,105, 73,176, 82, 83, 25,
-133, 29,115, 26, 42,102,253,146,163, 24,245,237, 47, 99,  1,128, 99, 89,238, 73,228,157,231,123, 54,127,123, 85, 36, 18, 93,171,
-162,142, 22,207,154, 53,235,231,126,253,250,201, 76, 76, 76,144,153,153,137, 27, 55,110,224,214,173, 91,184,125,251, 54, 52, 26,
- 13, 44, 45, 45, 97, 97, 97,129,148,148, 20, 68, 71, 71, 43,  1, 44,214,103, 83, 44, 23,162, 81,211,146,153,191, 69, 10,150,176,
-204,108,195,178,234,150, 72, 40, 52,232, 57,234,210,165, 11,218,181,107, 87, 66, 86,184,248,248,248, 20,181, 90, 77,149, 33,253,
- 73, 37,132,188, 94,189,122,236,254,253,251, 73, 85, 54,121,158,127,143, 76,119,238,220,185,244,165,176, 93,187,118, 96, 24,  6,
- 15, 30, 60,168,204, 53,229, 29,155,183,119,108,193,249,239, 22, 67, 44, 18, 97,238,227,196, 82,210,181,183, 91, 43,  8,197, 34,
-184, 14, 24, 82,246,220,173, 40, 26, 46, 68, 57,146,165,175, 63,250,224,231,221,104,243,127, 30, 41,168,193, 18, 60, 37,248, 77,
-165, 82,157,251,242,203, 47,  3, 61, 61, 61,191, 92,183,110, 29, 37, 18,137,176,108,217, 50,146,156,156,252,107,241, 27, 67, 86,
- 77,114, 69,  8,249,245,143,227, 55,167,140,243, 31, 72,205, 89,239,215,233, 94,112,100,116,139, 14,206,104,209,193, 25,247,174,
- 60,194,230, 69,  7,246,115, 58,110,201,235,215,175, 19,170, 48,165,238,209,177, 89,121,103,120,203,144,171,193,150,213,157,117,
-200,243,252,145,  3,  7, 14,204, 28, 60,120, 48, 29, 26, 26,250,158, 79, 86,201,178, 59, 60,207,227,210,165, 75,208,106,181,248,
-245,215, 95,121,158,231, 43,143,163,  5,114,106,195,250,192,113,191,238, 59, 37, 22,139, 40,220,186,118, 12, 57, 89,250,103,117,
-137, 68, 66,236,218,115, 92, 43, 18,  9,159, 84,116, 92,171,213, 38,  6,  7,  7,219,246,226, 56, 33, 77,211, 21, 17,168, 10,113,
-228,200, 17, 29,207,243,241, 85, 36,187,153,250, 42, 97,192,247,243, 39, 28,232,247,249,151,182, 29, 58,116, 18, 90,217,216,130,
-162, 40,188, 73,125,131,152,200, 80,221,185, 99, 59, 83, 11, 10, 13, 91,130,103,194,143,127,148,250,100,  1, 64,255,233, 27, 75,
-253,179,  0, 96,128,223,  2,248,182,119,  7,101,136,244,244,150,100,241, 44,203, 66,161, 80,128,101,217, 10, 67, 60,152,155,155,
-203, 84, 42,149,178, 56, 16,163,222, 55,102,  2,124,244, 58,226, 56,206, 53, 43, 43, 11,  5,  5,  5,184,117,235, 22, 89,185,114,
-101, 90, 90, 90, 90,169,211,166, 78,167,115,205,204,204, 68,126,126, 62,110,222,188, 73,  2,  3,  3,211, 50, 50, 50, 22, 85,231,
- 25,146,201,100,173,  5,  2,193,189,172,172, 44, 94, 46,151,211, 58,157, 78,231,225,225, 33,145,201,100,  6, 47,168,158,146,146,
-210,187,178, 99,141, 26, 53,122,250,244,233,211, 38, 28,199,149, 93,  3, 81,164, 82,169,156, 59,116,232, 96, 72,251, 49,107,247,
-238,221, 56,126,252,120,219,220,220,220, 49,241,241,241,123,  1,180, 21,  8,  4,120,240,224,193, 99,149, 74, 53,114,240,224,193,
-123,178,178,178,238,160,104,  9, 30, 67,112, 62, 38, 38,102,180,171,171,235,238,229,203,151,155,248,248,248,  8, 28, 28, 28,208,
-166, 77, 27,196,196,196,224,204,153, 51,186,173, 91,183, 22, 20, 22, 22, 78,  0,112, 73,127,181,131, 98, 89, 22, 98,177,184,116,
-147, 72, 36, 16,137, 68,200, 83, 18,124,241, 83,172,146,133, 76,185,118,217,164, 51,  4,160, 94, 39,198,166,191,121,157,120,135,
-162,168,107, 41, 41, 41, 57,149,148,153, 88,165, 82,181, 36,132, 48, 20, 69,173,215,106,181,126, 51,102,204,176, 95,181,106, 21,
-154, 53,107,134,244,244,116, 40, 20, 10, 56, 59, 59, 35, 45, 45, 13,161,161,161, 92, 97, 97,225, 54,  0, 43, 80,236, 63, 82, 25,
-178,211,115,225,104, 87,239, 29,229,147, 16,  2,194,  1, 58, 53,  7, 78, 75,160,161,116, 16, 10,117, 16,137, 68,134, 12,169, 16,
-158,231,145,101,111, 15, 62, 50, 18,183,111,223,  6, 33,164, 82, 85,205,197,197,197, 32,133,148,227,184,247,136,214,157, 59,119,
-192, 48, 12, 58,117,234,132,176,176,176, 82, 69,203, 32,191, 68,194, 67, 44, 17,191, 51, 92, 72, 81, 20, 68, 98, 49,132, 98, 81,
- 69,179,113,140, 42,150, 17,127, 27, 24, 58,142,157, 13, 96,242,195,135, 15,247,118,237,218, 53,136, 16, 34, 68,209,120,228,245,
- 15,249,243,215,175, 95,223,191,121,230,254, 66, 91, 71,139,192, 62, 99, 58,161, 89, 75, 39,112, 44,135, 27,103, 31,224,215, 85,
- 39, 15, 38, 37, 38,249,193,128,181,207,120,158,191,218,177,117, 51, 26,101, 98,117, 59, 56, 56,240, 53,153,117,152,147,147,179,
-116,238,220,185,152, 63,127,126, 77,102, 29, 86,136,136,232,180,201, 20,136,227,128, 62,157,123,129,162,137, 70,163,214,211,240,
-161, 52,114,169, 72, 36,124,114, 55, 60,197,163,162,116,105,105,105,189,198,143, 31,127, 73, 32, 16, 52,168, 78,153,243, 60, 31,
-159,154,154,218,189,234,148,236, 13,181, 50,215,249,244,193,237, 95,159, 63,190,187, 23,207,115,141, 41,  0,140, 64,244, 92,167,
-213, 94, 80, 43,115,215,193,192, 69,165,215, 76,246,198,172, 13, 23,177,101,254,  0,204,  8, 60,140,157, 75,190,192,194,159, 14,
- 96,245,252, 89, 88,185,241,223,248,118,214,104, 12, 29, 53,158, 39, 20,253,167,161,215,193, 48,204,249,237,219,183,143,251,226,
-139, 47, 74, 39, 45, 16, 66,222,105,132,117, 58,157,146,231,121,108,219,182,141,  7,112, 94,159,189,119,235,136, 34,250,252,165,
- 12,173,163,220,220,220,  9,222,222,222,123,  0, 72,  8, 33,207,178,178,178,190,  2,222, 46, 13,149,159,159, 63,161, 67,135, 14,
-123,  8, 33, 18,138,162,222, 59,110,  8,138, 67, 61,180,182,176,176,184, 87,172,100, 73,106,226, 16,175,175,168,245, 12, 43, 26,
- 50,132,248,127,236, 93,119, 92, 20, 87,219, 61, 51,219,151, 93,202,210, 89,138,  2,138,130,162, 66,108,216, 91, 36, 42,214,136,
-198, 40,150,152,152,188,182,168, 73,  4,163,177,151, 36,182,168, 49,106,236, 70, 99,195,168,136, 53, 88, 18,141,177,128,136,160,
-210,123, 91,150,178,192,246,157,153,239, 15, 74, 16, 41,139, 38,239,151, 55,217,243,251, 45,187,195,204,156,189,247,238,157,185,
-103,158,251,220,231,161,  1,204,173, 19,241,125, 93,247,238,221,235, 38,149, 78, 40, 41, 41,233,250, 10,229,186,170, 82,169, 58,
- 46, 91,182,108,129, 64, 32, 24,168, 84, 42,219,  1,128, 72, 36,122,174,209,104,174,171, 84,170, 45,104, 62, 54,149,150,166,233,
-231,  6,131,193,215,206,206,174,106, 69,109,181,216,  2,128,115, 15,168,  7,  0,213,173,202, 40,126,212,232,130, 69, 70, 70,182,
-150, 72, 36, 67,  9,130, 24,207, 48,140,119,121,121,185,102,217,178,101,119, 78,158, 60, 89,230,238,238, 62,108,196,136, 17,132,
-181,181, 53,238,223,191,207,200,229,242,211,  0,150,192,136,149,214, 52, 77,103,124,253,245,215,104,233,245,222,212,126,157, 78,
-151, 31, 25, 25,105,251, 86, 97, 33,155,166,105,140, 28, 57,242,  5,  1, 87, 31,207,158, 61,131, 70,163,105, 54,152, 99,105,105,
- 41,186,119,239,254,194,  3,106,205, 43, 35, 35,  3,214,214,214, 47,124, 79,115,207, 88,154,178, 18, 12, 90,176, 24,168, 94, 81,
- 90,131, 42, 75, 22,  3, 70,107,210, 85, 38,252,125,241, 87, 39,223, 52,202,180,232,228,228, 52, 81, 32,226,207,110,213,206,169,
-115,110, 74, 97,124,121,153,242, 72, 94, 94,222,238, 70,110,228, 70,113,182, 48, 96,169,201,252,251, 23,113,254, 17, 71,139,  2,
-195, 80, 96,104,  6, 12, 67,131,166,169,170,132,215, 12, 13,134,162,  8,130,192,175, 90, 85,147,145,193,235,151, 83, 98,107,107,
-187,138, 97,152,183, 88, 44, 22, 89,247, 70, 93,247,115,181, 37,235,146, 76, 38,251,162,  1,203,235,255, 92,123,158, 60,121,178,
- 65,241,111,236,170,195,224,224, 96,170,133,215,230,117,145, 72,228,212,208,190,202,202,202,204,188,188,188,161,127,147,246,172,
-187, 98,176, 37,156, 45, 94,117,216, 28,103,171, 86,173,248, 58,157,206, 31,128, 23, 65, 16, 86,  0,138,117, 58,221,229,162,162,
-162,  2,  0, 93,  1, 44,171, 62,103, 53,128,  7,255,207,215,187,208,214,214,118, 63, 73,146, 46,198,156,108, 48, 24,180,197,197,
-197, 83,235, 61, 16,252, 49,  5, 15,176,  4, 92,238, 61,144,164,115, 67,215, 99, 99,159,193, 48, 57,149, 42, 85,119,226,143,123,
-126, 45,167,141,141,205,  3, 54,155,237, 98, 68,217,178,229,114,121, 87,211, 61,249,127,154,243,127, 25,245,157,224, 27,141, 20,
-255, 87,  8, 45, 19,167,137,211,196,105,226, 52,113,154, 56, 77,156, 38,206,127,186,208,106,112,219,180,  4,214,  4, 19, 76, 48,
-193,  4, 19, 76, 48,225,245,112,161,158,216,186, 80,243,129,104, 66,149,182,196, 36,248, 42,202,246,154,137,211,196,105,226, 52,
-113,154, 56, 77,156, 38,206,127, 29,167,  9,127, 34, 76,102, 85, 19,167,137,211,196,105,226, 52,113,154, 56, 77,156,255,116, 52,
- 58,117, 72,154,218,198,  4, 19, 76, 48,193,  4, 19, 76, 48,225,175,129,209, 66, 75,228,224,237, 99,219,170,243, 65,137, 75,167,
- 88,137, 75,167, 88,219, 86,157, 15,138, 28,188,125,254,165,237, 38,  4,240, 46,155,205,190,234,232,232,168, 64, 35,169,119,254,
-  1,176,  0, 48, 30, 85,241,125,198,  2, 48,251, 51,201,251,  3,236,137,192,236, 16, 32, 51,  4,200,156,  8,204,238,255, 15,244,
- 27, 92, 49,207, 41,224,214,197,119, 47,174,152,231, 20,208,224,254, 69, 78, 54,119,175,  4,127,179,110,182,212,250, 79,250, 74,
-115,123,123,251, 61, 14, 14, 14,233,246,246,246, 25,246,246,246,251,  1, 88,154,110,119, 38,152, 96,130,  9,127, 25,106,124,180,
-106, 94,181, 62, 90,108,  0,136,136,136,232, 15,224,  6,128,  1, 65, 65, 65, 55,235,159, 45,113,243,157,217,198,163,205,167,107,
- 86, 44, 33, 28,237,109,205, 12, 20,173, 75, 75,207,234,176,124,205,134, 83,185, 60,246,230,146,204,184,189,175, 80, 40,130,197,
- 98, 77,228,243,249, 65,  0,106,  4, 91,130, 70,163,137,160, 40,234, 56,140, 91,166, 13,  7,  7,135, 91, 44, 22,171,117, 75,190,
-152,162,168,204,130,130,130, 62,175,216,152,193,110,110,110,251,251,247,239,111,214,189,123,119,240,120, 60, 44, 91,182,108, 81,
- 94, 94,222, 22, 99,  9, 36, 18, 79,115, 29, 95,240, 49,155,199,123,147,209,107,125, 25, 48,  0,201,143,163, 13,154,159,185, 26,
-205,230,146,146,148,114, 35,169,150,  0,152, 86,221, 86,123,  1,124,253, 58,189,100,170, 31,244,122,170,170, 79,112,217,160,206,
-166, 90,222,248,252,243,207,217, 65, 65, 65,216,187,119,111,159, 61,123,246,124, 80, 94, 94,254, 51,128,115,  0,146, 95,183, 87,
- 58,  0,179,122,245,233,243,205,212, 69,139, 88,170, 91,183,240,205,254,253, 91, 81, 21,111,233,219,150,246, 37, 46, 23,227,109,
-109, 57, 65, 12,  3,127,  2, 32,  8, 32, 70, 38,167, 35,117, 58,234, 56,140,136,197,214,  4,222,197,139,203,241,143,182,148,160,
- 44,153, 89,202, 31,233,211,183, 44,249,250, 82,  0,195,234,239, 55,168,  5, 83, 25,150,107,144,138,137,206,  2,176,233, 53,155,
-213,204,206,206, 46,246,236,217,179, 46,221,187,119,103,  3,192,131,  7, 15, 66,130,130,130,  6,201,100, 50, 95,  0,138,255,167,
-155,144,128, 77,146,179,121, 28,206,155, 20, 69,117,  2,  0, 22,139,245, 88,171,215, 95, 53,208,244,183, 48, 50, 38,155,  9, 38,
-152,240,207, 69,115, 90,228,111,142, 70, 35,195,215, 84,142,169,251, 94, 23, 34,251,246, 29,122, 14,126,251, 89, 89,185, 82,157,
-158,158, 83,178,112,246,218,171, 31,204,223,248,211,166,239, 35, 34,111,254,158,112,215,167,251,208,120,145,125,251, 14,141, 80,
- 55, 54,135,235, 38, 20, 10, 31,238,220,185, 83,247,252,249,115,166,180,180,148,121,246,236, 25,115,250,244,105,230,163,143, 62,
- 82, 11,133,194,135,  0,220,140,225,116,112,112, 40,120, 22,117,133,201,142,141,102, 50, 30,252,206,232,245,122, 70,167,211, 49,
- 58,157,142,137,191, 20,193,196,158, 11,103, 98, 78, 31,103,180, 90, 45,163,213,106, 25,141, 70,195,120,120,120,228, 26, 89,206,
-250,144,118,236,216, 81, 27, 17, 17,193,156, 58,117,138, 89,180,104, 17,211,165, 75, 23, 10,192, 28, 99,235, 46,178,247, 26,104,
-238,220, 89, 54, 51,244, 91,221,133, 59,151,153, 39,169, 49,204,147,212, 68,230,228,181,  4,102,218, 39,219,116,230,206, 93,100,
- 34,123,175,129,205,213, 93, 34,145,244, 36,  8,130,169,  1,  0,166,117,235,214, 21,117, 95,110,110,110, 47,188, 92, 93, 93, 43,
-220,221,221,147,109,108,108,252, 27,226,156,212,  9, 12, 19,127,148, 97,226,143, 50,159,247,  3,243,228,201,147,187, 12,195,220,
-168,121,169, 84,170, 27,103,206,156,185, 49,122,244,232, 27,  0, 70, 53,209, 78, 70,181,103,  8,144, 89,126,246, 44,195,108,217,
-194, 48,253,251, 51,  9,  0, 19,  2,100,182,144,211,195,209,145, 19,179,241,235, 15,180,103,207, 30, 96, 46, 94,188,192, 68, 70,
- 70, 48, 63,157,217,207,108,221, 50, 91,231,224,192,137,  3,208,182,  5,156,108,  0,107,  1,108, 70,149,229,242,185, 76, 38, 99,
-242,243,243, 25,  0,207,171,255,183,217,206,206,110, 19, 26,182,190, 13,169,107,201, 90,240,150,227,197,  9,195,250, 48,229,101,
-185,204,132, 97,125,152,  5,111, 57,190, 96,217,122,203,211,211,124,238,200, 78,178, 39, 15,142, 80,115, 71,118,146,189,229,233,
-105,254,138,237, 73,160, 42, 79,232,206,168,168, 40,  3, 83,  7,122,189,158, 57,116,232, 16, 37,145, 72, 14,180,128,179,157,157,
-157, 93,134,181,181,245,243,186,255,180,235, 60,182,151,119,223,144,229, 54, 29, 70,247,111, 65, 57,187, 11,184,220,236,171, 39,
-190,163,228,153,143, 25,173,170,128, 41, 75,138,102,178, 19,238, 50,135,118,111,214,243,216,236,108,  0,221, 95,167, 47,181, 16,
- 38, 78, 19,167,137,243,111,200,217,148, 22,249, 95,  6,187,126,  5,235,131,207,231,133, 46,255,124, 49, 81, 42, 47, 85,169, 21,
-229, 90,189, 90,173, 38,185,140,250,113,124,106, 33,201,102,149, 46,152, 63,207, 60, 52,236,243,208, 74, 96,178,145,223,233,214,
-165, 75,151,123,225,225,225,246,214,214,214, 40, 43, 43,131, 92, 46,199,189,123,247,192, 48, 12,198,141, 27,199,239,209,173,155,
-255,210,101,203,126,203,206,201,  9, 64,227,  3,239, 31,226,197,218, 22, 95,247,169,202, 69,251, 69,186,188,106,212, 33,  8,236,
-  9, 14,170, 61,102, 85,118, 85,182, 12,129, 64, 80,155,144,248, 21, 16, 48,120,240, 96, 46,  0,188,247,222,123,138,242,242,242,
-245,213, 22, 14,163, 50,173,138,236,189,  6,218, 58, 73, 35,190,219,245,181,176, 83, 27, 47,232,244,  6,100,228,231,130,205,177,
-130,139, 11, 23,211, 39,191,201,233,215,203,218,118,237,234, 61, 23,242,105,140, 85, 22, 37, 94,110,140,203,202,202,234,208,241,
-227,199,113,226,196,  9,  0,192,243,231,207,225,229,229, 37,106,174, 12,113,113,113,158,163, 70,141,250, 81, 46,151,183,109,238,
-216,250,129,241,249,124, 62,250,244,233,131, 14, 29, 58,224,236,217,179,  3,170, 45, 91,175,  5,213,173, 91, 16, 63,122,  4,220,
-124,165,135, 23,143, 55,222,104,117, 55,242,194, 17,219, 11,145,  9,216,180,105, 63,146,147,171, 12,109,158,158,158,120,119, 82,
- 48,231,241,227, 59, 29,199,143,127,247,206, 47,191, 36,247,169, 22, 74,205, 97,229,247,223,127,191,196,221,221, 29,227,199,143,
- 15,238,216,177,163,163,133,133,  5,118,239,222, 13, 39, 39, 39, 79,173, 86,155,116,246,236, 89,105,126,126, 62,230,205,155,135,
-130,130,130, 69,141, 17, 13,  8, 28,176,148, 63,210,167,111,251, 55,166, 66,108,225,132,239,143, 29,199,179,135,135,250,106,116,
-  9, 75,185,212,205, 41, 42,134, 63, 77,150, 41, 14,109,221,181,191, 77,219,142,163,208,234,141,104, 91, 53,245, 75,234,210, 55,
- 61, 54,176,  5,234, 67, 43, 54,229,201, 95, 34, 29,127,146,229,171,120,106, 29,119, 21,114, 96,  5, 93, 35,176,106,173,181, 12,
- 70,245,235,215,175,246,135, 75, 79, 79,135, 70,163,129,143,143, 15,169,213,106,  7, 26,217,174,237,134, 14, 29,250,107,100,100,
-164, 77,187,118,237,100,197,197,197,181, 59, 28,109,172,  2,111,134,111,157,183,246,155, 31,188, 15, 51, 68,169, 44,225,167,199,
-205,112,117,239,221,243,141,107, 23,195,143,136,137,138, 44,240,172,138,  0, 90,142,148, 31,247,129, 48,179,198,196,143, 22,178,
-  7, 14, 30,228,252,230,176,183,175, 61, 75, 76, 30, 12,224,190,233,185,222,  4, 19,254,213, 86, 45,230,159, 86,167, 90,161, 21,
- 20, 20, 68, 52, 84, 65,154,161, 59, 59,216,219,  8,183,110, 60,120,159,165,211,106, 69, 86,150, 90,142,165,  5, 77,152, 91,178,
-116, 90,125, 69, 43,207, 86, 60,154,161, 59, 55,194, 95,127,137, 39, 33, 20, 10,195,207,157, 59,103,207,225,112, 64,211, 52,236,
-236,236,144,150,150,134,210,210, 82,148,151,151, 35, 57, 33,  1,238,110,174, 88, 17,186,216,105,222,226,208,112,165, 82,217, 21,
- 47, 78, 35,190,180,108,148,210,191,152, 55,186, 38,  5,203, 75,143,252,213,255,107, 96,159,177, 75, 81,211, 50, 51, 51, 33, 22,
-139,225,235,235, 43,190,125,251,246, 47, 77,136,172, 23, 56, 37, 18, 79,115,154,207, 59,177,243,187,101, 66,157, 62, 14,241, 41,
-197,104,239,222, 23, 14, 54,110,200, 45,214,226,238,189,115,136,139, 61,138, 54,206,110,152,243,209, 32,193,134,175, 79, 29,231,
- 26,220,221, 74, 75,211, 20, 13,113, 42, 20, 10,177,135,135,  7,220,220,170,242,158, 81, 20,133,248,248,120, 80, 20, 85,187, 93,
-247,253,224,233, 40, 24, 20, 25,152, 26, 18,  2,185, 92, 46,110,136,147,195,130, 97,225,  7,239,178,133, 28,128, 39,178,214, 86,
- 84, 84,212,166,225,208,233,116,136,137,137, 65, 64, 64, 64,255,147, 39, 79, 54,167,138,140,106, 79, 29,240,213, 55,  7, 14,108,
-155, 92, 86, 70,  2,192, 94,130,160,117, 12,243,149,177,125,201,222,158,115,250,210,197,195,182, 44,242, 41,172, 45,191,196,189,
-123, 25,208,233,170,202, 43,151, 23, 98,238,108,  5,184, 28,115,156, 61,251,131,141,143, 79,159,211,249,249, 58, 95,188, 56,141,
-216, 80, 57,  5, 23, 47, 94,196,220,185,115, 17, 31, 31, 47,173,201,209, 38, 20, 10,177,113,227, 70,150,143,143,143, 84, 36, 18,
-225,210,165, 75, 40, 40, 40, 32,154, 42,231,141,203, 55,214,148, 37, 95, 95,154, 79, 92,122,235,251, 99,199,241,254,164,137,112,
-100, 82,126,177,108, 67,172, 25, 58,178,247, 23, 12,203, 53, 72,100,222, 89,226,229, 59, 18, 92,158, 24,115, 62, 91,133,231,113,
-231, 37,202,242,216,217,  4,149,229,186, 98,211,201,249, 47,149,243, 84, 48,245,222,209,219,111, 92,117,187,223,234, 81,204,  7,
-191,231, 69,239,137,253, 67,104,121,178,  9,146,178,  4,170,210,154, 36, 37, 37, 33, 57, 57, 25,108, 54, 27, 42,149, 10,  6,131,
-161,193,114, 74,165,210, 89,  6,131,225,139,234,223,249,160, 64, 32,152,113,228,200, 17,155,186, 66,219,174,243,216, 94, 54,230,
-162,193,  5,133,242,146, 59,247,159, 60, 91, 56,107,252,128, 91,119,227,178,116,156,209,153,101,177,103,203, 26,105, 79,129,144,
-199, 59,125,233,204, 15, 98,125,106, 20, 68, 62,  3,192, 17,123,129,210,231, 64, 89, 82,137,242,228, 60,104,190,219,  1,191,217,
- 11,112,254,167, 83,226,142,157,186,158,212,232,245, 94,  0,180,175,112,109,182,  4, 38, 78, 19,167,137,243,239,201,217,168, 22,
- 97, 24,230, 13,  0, 14,213,155,242,106, 93, 96, 11,160,  8, 85, 25,  5, 28,170,239, 29,188, 58,167,213,223,174,123,108,253,237,
-186,159,229,213,159,237,171,223,239, 19,  4, 81,220, 76,209,157, 80,149,154,240, 66,245, 59, 80, 61,149,216,172,227, 49, 65,144,
- 10,138,162,249, 92, 59,123,245,123, 19,  6,119,186,114,237, 65,140,153,173,  5, 59,112,128,127,255,123,143, 83,127, 35, 72, 66,
- 79, 16,164, 81,126, 31, 44, 22,107,226,214,173, 91, 59, 89, 88, 88,128,166,105, 88, 90, 90, 66, 38,147, 65,171,213,162,172,172,
- 12,154,114,  5,116,229, 10, 60,202, 74, 71,239,254,  3,240,246, 91, 67,125,126,248,233,220, 68,138,162,126,108,138, 87,218,217,
-191,214,146,181,170,181,205, 31,166,137,172,210, 90,209,245,165,191, 23,184, 98, 49,222, 92, 24,250, 58,125, 32,250,194,133, 11,
- 23,199,141, 27, 55,236,147, 79, 62, 33,243,242,242, 46,165,165,165,245,  6, 16,223,172,168,224, 11, 62,254,207,199, 65, 18,137,
-152,193,201,171,231,208,207,127, 18,204,120, 44,200, 21, 58, 16,  4,144,240, 36, 28,  4, 97,141,216,231,121,232,235,103,129,161,
-129, 62,226,159, 78, 37,124,130, 63,252,131, 94,250,105, 74, 74, 74, 80, 88, 88,  8,189, 94, 15,189, 94,143,241,193,193, 56,124,
-232, 16, 42, 43, 43,161, 82,169,160,213,106, 65, 81, 20, 72,146,196,213,136,147,200, 74, 77, 64,175,128,  0,160,145,212, 75,135,
- 98,192,  1,112,247,217,179,103, 72, 72, 72, 64,118,118, 54,  4,  2,  1, 28, 29, 29,177,106,213, 42,104, 52, 85,249,196,130,131,
-131,251,  3,120,252,186, 23, 84, 50,176, 39,141,162,150, 14, 59,115,198,254,246,153, 51,244,221,243,231,179,249,229,229,187,141,
- 57,151,203,197,248,175,191,250,168,189, 72, 36, 66,118,230, 86,120,123,115,177,104,129, 13,214,127, 89,  4,  0,152, 55,215,  5,
-221,186,218, 66, 81,122, 10,182,246, 75,176,109,219,252, 54,211,166,109, 14, 81, 42,169,131,205, 80, 47, 61,119,238,220,219, 94,
- 94, 94,206,209,209,209,  4,143,199,131, 80, 40,132, 80, 40,132, 64, 32, 64, 97, 97, 33,210,210,210,152,175,191,254, 58,  7,192,
-210,166,136, 86,108,203,251, 13,192,176,  5,111,225,226,179,135,135,250, 58,179, 82, 31,189, 61,167, 79,122,236,221,232,242, 43,
- 87,111,175, 54,168,  5, 89,165,217,215, 22,123,116,139,182,157,253,233, 74,236,248,122, 57,158,253,126,171,216,193, 77,241,173,
-144,208, 52, 88,206,254,253, 87,176,157, 28,172, 13,179,166,189,109,117,222,225,206,172, 72, 54, 33,203, 47,122,184, 17,105,209,
- 42,126, 91,255, 41,237, 60, 73,109, 84, 84,148,176, 95,191,126, 80,171,213,181,150,201, 35, 71,142,208,  6,131,225,122,131,125,
- 83,167,251, 34, 39, 39,199, 73,165, 82,225,173,183,222,154,183,113,227, 70, 81, 77, 62, 57,138,162, 94,176,100,173,217,114,248,
-242,199, 95,124,123,253,242,143, 95, 74,215,132,206, 24, 48,121,206,218,235,104, 36,143, 36,155, 36,103,159, 63,179,223, 81, 32,
-209, 67,104, 61, 20,234,  2, 21,158,237,121, 31, 74,133, 26,221,214,172,  4,192,131, 86, 79, 98,247,200,241,224,216, 72,177,124,
-230, 12,233,231,187,191,255,136,166,233,173,166,231,122, 19, 76, 48,161, 30, 28,  8,130,136,  0,128,208,208,208, 37,235,215,175,
-127, 66, 16, 68,  4,195, 48, 65,213,  6,148,  8,134, 97,130,106,142,169, 22,103, 47,109,215, 28, 91,127,187,254,231,176,176,176,
-142, 27, 54,108, 88, 23, 16, 16,240,227,157, 59,119, 82,  1, 52, 39,180, 70, 84, 11,171,151, 82,239,144, 53, 10,178,238,251, 11,
- 22, 45,154,190,149,148,154,174, 28, 58,164,135, 75,196,205,199,247,167, 79, 31, 49,120,226,200,126,129,105,153,242,132, 54,173,
- 28,109,159, 60,121,108, 65,211,244, 45, 99, 90,137,207,231,  7, 13, 26, 52,136, 93, 82, 82,  2, 51, 51, 51,200,100, 50,228,228,
-228, 64,167,211, 65, 93, 86, 10, 77, 89, 41,212,165, 37,208,149,149, 32,249,193, 61,116,110,227,201,175,118,150,111, 18, 53, 86,
-151,250,150,170,186,150, 45,158,185, 57,248,230,230, 32, 90, 62,109, 56,218,202,202,234,110,205,160,170,211,233,102, 47, 94,188,
-184,136,166,105,172, 93,187,214, 66, 44, 22,159,  4,192,111,142,196,220,142, 21, 20,224,231, 75, 62, 77,139, 69,159, 46, 83,209,
-206, 99, 56,210, 10, 84, 40, 42,215,161,176, 84,135,110,253,182,163,117,151,149,112,245, 91,143,132,140, 98, 72,157,189, 72,176,
-249, 77, 38,127,206,202,202,122, 97,251,199, 99,199,160, 84, 42,209,166, 77, 27, 76,154, 52,  9,139, 23, 47,198,164, 73,147, 32,
-149, 74, 49,121,194, 40, 44, 95,190, 28,249,249,249,205, 21, 85,211,174, 93, 59, 77,171, 86,173, 52,173, 90,181,210,232,116, 58,
- 84, 84, 84,160,180,180,180,126,123,207,111,105, 67,218,219,219,135, 57, 58, 58,198,218,219,219, 63,225,243,249,145, 49,  4,241,
- 84,221,170,149, 67,239, 49, 99,136, 14, 19, 38,176, 50,132, 66,226, 38, 32, 54,134,203,214,154, 51, 98,224,160, 97,188,210,146,
-253,181, 70,170, 25,211,237,240,235,205,142,184,253, 75, 87,204,157,221,  6,  4, 41,  0, 65,242,160,172,140, 66,143,238,  1, 92,
- 43, 43,162,185,190,244, 46,128,152,222,189,123, 75,231,204,153, 67,240,249,124,204,155, 55, 79, 55,115,230,204,196, 73,147, 38,
- 37,254,252,243,207, 84,171, 86,173,224,234,234, 74,184,186,186, 58,  1,136,169, 62,167, 73, 88,180, 33,214,104,116,  9,191, 88,
-121,137, 82, 41,216,246,170,208,243,199,175,216,148, 39, 95,179, 51,117, 83,218, 51,165,231,179,223,111,201, 19,227,206,211,105,
-247,111, 20,229, 38,150,123,174,217,153,186,105,201,183,185, 13, 94,212, 55,111,130, 14,143,184,169, 83, 86, 42,217, 99, 70, 14,
- 84,206,122,111, 98, 59,107,113,199, 35,112, 30,218,165,181,155,203,228,229,235,182,233,102,126,244,177,110,239,190,253, 76,121,
-121, 57, 20, 10,  5,182,109,219,102, 56,127,254,124, 14, 69, 81, 31, 55,246, 12,  4,  0,122,189, 30,179,102,205, 18, 89, 88, 88,
- 32, 43, 43,171,214, 34, 10,  0,121, 50,249,227,219,247,227,158, 46,252, 48,184,127,165, 70,163,185,124,227, 65, 66,  7,175, 86,
- 46,  4,193, 52,186, 16,133,199,225,188,217,181, 71, 15, 22,195,148,130, 96,187, 33,249,208,215, 80,228, 23, 67, 81, 88, 12, 22,
- 71,  4,  3,248,208,211, 60, 88,117,238,142,231,247,163,225,108,231,192,230,115, 56,129,166,241,196,  4, 19,254,157,104, 74,139,
-212, 21, 75, 27, 54,108, 88,215,212,254, 58,239,218,122,219,181, 66,170,190,  8,171,251, 25,  0, 54,108,216,176,142, 97,152,160,
- 59,119,238, 28,  3,160, 50,178, 10, 31,212,121, 55, 62,142, 22, 75,173, 93,255,201,226,165,144, 88, 10, 45,187,251,123, 57,158,
-189,116,243,193,173, 59, 15, 18, 90,187,218,218, 49,122,173,228,171,205, 59, 92,  8,165,106,131,145,133,240,177,181,181,133, 78,
-167, 67, 82, 82, 18,178,179,179,161,211,233, 96,168,172,132,166,180, 20,234,146, 18, 80,149,229,224, 82, 20, 84,178, 66,216,152,
-  9,128, 63, 86, 36, 54, 99,121, 35, 26, 20, 90, 53,239,  2, 11, 11,240,205, 45, 64,114, 56,205,102,138,175,131, 55,186,119,239,
-126, 34, 46, 46,174,199,144, 33, 67, 86,163,106,137,124, 70, 78, 78,206,224,101,203,150,105, 28, 28, 28, 48,107,214,172,246,  0,
-166, 54, 43, 50,121, 90,159, 86,142,237,209,206,115, 42, 90,187, 14, 66,105,165, 30, 50,133, 30,133,165, 58,236,222, 30,128,211,
-123,187,227,215,211,125, 17,119,249, 77,148,234, 29, 33,150,142,  6, 67,105, 59, 54,197,121,245,234, 85,172, 90,181, 10,171, 87,
-175,198,218,181,107,177,122,245,106,228,228,228,192,215,215, 23,153,153,153,184,120,241, 34,242,242,242, 96,107,107,139,123,247,
-238, 97,203,150, 45,248,245,215, 95,155,173,116,141,112, 53,226,152, 22,205,165, 27, 12,134,105,121, 99,198,116, 42,176,182,238,
-224,239,239, 63,108,222,188,121,158,189,123,247,174,221,239,233,233,233, 38, 20, 10,243, 81,181,130,210,175, 41, 46, 26,240,183,
-179,243,133, 86,243,180,250, 55,230,128, 32,  4, 24,244,102,  2,122,247,125,  0,157,158, 11,146,224,131, 36,  5, 48, 24,228,144,
- 72,164, 96, 24,194,183,153, 34, 46,147,201,100, 94,215,174, 93, 35,211,210,210, 32, 16,  8,  0, 32,125,197,138, 21, 59, 54,109,
-218, 20,111, 99, 99, 67, 69, 68, 68,224,167,159,126, 66, 80, 80, 16,107,230,204,153, 94,174,174,174,187,154,171,247,138,109,121,
-191, 29,221,124,241, 29,142, 94,226, 39, 16,182,118, 71,165,120,244,127,250,219,138,  0,224, 82, 74, 74,185,189,155, 98, 67,101,
-121,108,166,149, 75,197,151,151, 82,154, 91,113,186,130,126,152,248,244,238,209, 51,151,202, 10, 11, 74, 56,254,157, 58,170,214,
-175,250,148,219,218,189,237, 87,203, 23,127,232,152,163, 16, 44, 42,  9, 57,  0,  0, 32,  0, 73, 68, 65, 84,148,190, 57,239,226,
-211,240, 75,247, 42,166, 76,127,223,240,222,  7,115,212, 23, 47, 93, 61, 67,211,116, 39, 52,178,226,144,166,105,228,229,229,225,
-201,147, 39, 72, 73, 73,129, 76, 38, 67, 81, 81, 17,202,203,203,107,167, 27,205,202, 21, 23,118, 28, 56,255, 72, 36, 20,154,245,
-232,228,229,246,123,116,124,161, 72, 40, 52,243,114,119,107,  7,172,104,240, 62, 66, 81, 84, 39,129,153, 16,  0,129,210,184, 91,
-168, 40,169, 64, 69,105,  5,202,139, 43,160,209,177,160,214,144, 80,105, 73,180,234, 63, 20, 21,149,106, 84,200,203, 64, 83, 84,
- 23,211,112, 99,130,  9, 38, 52, 49,214, 71,132,134,134, 46, 49,242, 88,163,167, 55,235, 11,175,208,208,208, 37,  4, 65, 68,132,
-133,133,117, 68,227, 11,170,234, 98, 79,  3, 47,  0, 70,132,119,144,203, 19, 43,204,  9,159,113, 11, 62,251,226,226,177,125,219,
-237, 53, 26,101,166,141, 68, 76,137,205,120,182,239,205, 90,139,242,138,146,177,149,198,135, 35, 64, 73, 73,  9, 82, 83, 83, 33,
- 20, 10,193,229,112, 64,169, 84,160, 84,149, 80,149,200, 65,234, 52,224, 82, 20,172,205,132,104, 37,117, 68,107,  7, 71,163, 56,
-147,162,174,212, 58,190,215,157, 46,252,186,187, 15,120, 34, 49,120,230, 98,252, 39,226,  6,  0,128,203,229,  2,203, 86, 27,101,
- 52,113,118,118, 62,119,244,232, 81,174, 76, 38, 67, 76, 76,204, 35,  0,101,  0,204,  1,208,  9,  9,  9,215,226,226,226,130,188,
-188,188,  0,160, 77,115,100,138, 34,146,210, 27, 24,100,229,167, 35, 45, 59, 26,214,150, 30,224,152,181, 67, 97,169, 14,124,161,
-  7,244,154, 63,102, 31,213,138, 12,168,116, 44,163,234,174,213,106, 97, 48, 24, 96, 48, 24,160,213,106,241,193,  7, 31,224,246,
-157, 59,248,241,167,159,145,154,252, 28,237,221, 29, 17, 18, 50,  5,221,187,119,199,157, 59,119,154,228,154,234,  7,189,179, 24,
-236,205,195, 72,240,196, 54,154,158,139, 47,255,222,156,216, 34,  8,130, 65, 35, 83,145,245,176, 41, 32, 32,160,237,243,202, 74,
- 60,121,250, 20, 67, 86,172,  0,  0, 68, 70, 70,190, 80,151,133, 11, 23,242,226,227,227,223,123,240,224,193,123,185,185,185,155,
-  1, 52,236,108,206,  0, 23, 46,252,134, 15, 63,140,135, 76, 38,  3,  0, 28, 63,246,135, 46, 77, 75,213,225,173, 17, 85, 51, 90,
- 86, 86, 86,216,188,217,215,168,246,164, 40, 10,123,246,236,169,157, 46,  4,  0, 54,155,221,123,225,194,133,227, 26, 58,190,109,
-219,182,220,230, 56, 23,140,119, 22,252,250,136,153,109,217,182,117, 71, 11,219,206,144,235,163,125,163,115,242,230, 46, 24,239,
-188,117,203,169, 28,181,144,208, 28, 36,168, 44, 87,182, 64,125,200,152, 50,166, 92,218,174,149,183,154,118, 40, 95,166,248,124,
-206,251,239,218, 88, 88,217, 87,238,221,177, 94, 66,178, 72,230,220,  3, 93,105, 71, 79, 27,171,209, 61,191,169,248,112,193,178,
-104,173, 33,107, 14,178,206, 61, 71, 19, 33, 46, 40,138, 66,110,110, 46,100, 50, 25, 50, 51, 51, 81, 84, 84, 53,253, 90, 84, 84,
-  4,154,166, 95,231,134,  8, 85,102, 38, 50,206,236, 69,235, 41, 83,208,109,245, 42, 80, 52, 27, 42, 37,133,205,189,  6,163,164,
- 76,  5, 13, 77, 64,250, 70, 47,188, 31,249, 11, 72,134,  2,118,127,107, 26, 73, 76, 48,225, 95, 10, 99,194, 59,212,  8,162,245,
-235,215,  7,253,217,223, 95, 87,108,173, 95,191,254,201,250,245,235, 91,242, 93,245,167, 12,107,183,107,124,180,110,212,113, 64,
-123,105,208, 44, 47, 74, 72,137,143,103,231, 86,170, 42,205, 28,236,237, 52,102,  2, 62, 93,166, 40,103, 69, 63,126,164,171,204,
- 79,126,214,130,122, 36,196,197,197,249,230,230,230, 34, 51, 35,  3,  6, 85, 37, 72,141, 22,140, 90,137, 33,125,122, 65,  0, 64,
- 64, 18,224,210, 58,176, 89, 60,148, 87, 40,  0, 32,161,217,193, 81,175,127,201,178, 69, 16,  4,120,230,230,224,137, 68,224,137,
-205, 95,176,112, 25, 99,177,225,243,249, 71, 79,158, 60,233,228,236,236,140, 85,171, 86,193,197,197,197, 91, 42,149, 42, 45, 45,
- 45,133, 14, 14, 14,232,208,161,  3,122,245,234,133,139, 23, 47,  2, 70,196,148,210, 27,  4,177,207,210,209,187,168,248, 14,126,
-185,241, 29,180, 42, 13,252,251,127,  7, 29,187, 53,236, 58,174,  4,157,116,  4,202,252,179, 85,214,  3,199,145,200,206, 76,  7,
-193,226, 61, 49,214,242, 84,243,249,209,163, 71, 56,118,246, 38,156, 90,249, 32, 51,241, 41,158, 94,191,134,219,118, 54,104,229,
-211,161,118, 26,168,209, 50, 82, 96,175,249,182, 42, 76,212,210,217,239,242,139,139,139,249,214,214,214,154,154,182,115,114,114,
-122, 29,177,245,238, 39,159,124,130, 82, 14,  7, 24, 49,  2,220,148, 20,232,116, 58,244,236,217, 19,221,186,117,  3,  0,244,236,
-217, 19,108, 54, 27,157, 59,119,134, 84, 42,197,183,223,126,251,110, 99, 66,139, 36, 16, 99, 48,200,189, 61, 61, 61,107,133,214,
-161,195, 50, 68, 63,120, 19,  4,120,216,182, 35,169,246, 88, 55, 55, 55,228,231,165,128, 32,152,184,102,202,184,218,209,209,113,
-153,147,147,147,231,166, 77,155, 88,  2,129,  0, 31,125,244,145, 71, 69, 69, 69,235,106, 83, 50,194,194,194,  0,  0,203,151, 47,
-199,138, 21, 43,160,209,104,148,141,145, 29,218,220, 73, 90, 88, 76,191,199, 84,152,141, 29,104,219,186,211,160,192, 33,240,240,
- 26,132, 65,129,153,  0,176,206,154,157, 62,225,171,207,173,206, 88,153, 19,251,175, 92,186,186,188, 79,255, 65,159, 47,174,184,
-190,230,203, 61,165,205,250, 60,150,101, 28, 44,127,198,155,184,101,251,174,195, 91,190,  8,155, 47,200,148,105, 75,114, 74,152,
- 10, 49,159, 45,110,227, 64,136,231,126,182, 58, 53, 55, 55,101, 17,178, 46, 53,187,210,146,166,105,164,164,164,212,250,244,169,
-213,106, 84, 86, 86, 34, 43, 43,171,182,207,168, 68, 22,111,205,153, 62,178, 75,165, 74,165,252,253,113, 98,230,210,121,147,  3,
- 42, 85, 42,101, 98, 90,230,115, 96, 91,131,106,140, 36,201,199,202,114,229, 16,101,169, 26,178,152,103,112, 25,220, 10,122,  3,
-  1,173,129,130, 76, 94, 14,141,  1,160, 72, 14, 58, 78,  8,  1, 69,176, 81,148,155,  3,146,197,122,132, 23,157,246, 77, 48,193,
-132,127, 15,154,212, 34, 53, 22,173,128,128,128, 31,235, 90,157,106, 62,  3,208,160,105, 87, 30, 89, 93, 49, 85, 51,157,216,216,
-247,212,227, 53, 22, 47,249,104, 53, 27,222,161,230, 59, 93, 45, 21,210,175,151, 79,118,161, 13,134,246,133, 69,  5,  6, 54,155,
-207,113,181, 84,229, 21,103, 26,255,237, 26,141, 38,226,218,181,107, 99,222,124,243, 77,126,226,227, 71,208,150,149, 65, 91, 86,
- 10, 14,109,128,181,176, 43, 72,157,  6,132, 86, 11,103,111, 26,234,114, 33,110,222,142,211,107, 52,154,  8, 99,133, 22,201, 98,
-189,232,151, 37, 22,131,111,110,  1,190, 88, 92,127,106,177, 57, 81, 96, 54,116,232,208,193, 61,123,246,  4,195, 48,216,179,103,
- 15,116, 58, 29, 79,167,211, 65,171,213, 66,167,211, 65,161, 80,224,240,225,195,216,185,115,231,109,  0,  7,154, 29,204, 12,218,
-107,151,175, 70,117,159, 49, 57,136, 19, 25,177, 25,  6, 45,  5, 21,225,130,202, 74, 61, 42,180,102,160,108,166,  0,  5, 23,192,
- 98, 11, 16,208,217,  3,103, 79,133,235, 96,208,252,108,164, 10,127,193, 42,148,149,153,142,236,228,231, 16, 43,242, 97,103, 97,
-  6,101,202,115,248,135, 76,125, 37,235,132,171,171, 43,104,154,198,192,129,  3,107,157,171, 95, 85,108,201,229,114,156, 63,127,
- 30, 61,123,246, 68,255,254,253,145,147,147,131,148,148, 20, 12, 31, 62,188,246,152, 71,143, 30, 33, 58, 58, 26,109,218, 52,109,
- 36, 44, 42,214, 71,102,103,197,  4,143, 30, 61,154,123,247,238, 93, 48, 12,  3, 47, 47, 11, 88,152,139, 64,144,124,248,248,216,
-  3,168,122,  6, 24, 48, 96,  0, 20,138, 20, 67, 73,  9, 19,217, 76,117,143,  2,248, 73,171,213, 38,245,235,215, 79,154,156,156,
-140,  5, 11, 22,176,143, 31, 63, 94, 99, 74, 70,104,232,139,139, 41, 84,170,198,167,238,219,119,242,254,212,195, 32,233, 47, 16,
-182,118,183,176,237, 12, 15,175, 65,  0,128, 55,131,102,192,163,173, 27, 20, 69,177,238,106, 85,250, 88, 46,187, 68, 18,187, 45,
- 39, 94, 56,194,119,186,186,240, 70, 34,170,166, 78,155,253,217, 85,137,199, 11, 50, 57, 83, 78,252,116,238,226,172,225, 65,163,
- 56,122,202, 96,240,109,197,177, 58,121,230, 66, 97, 78, 70,230, 55,200,188, 20,247,135,253,175, 73, 43, 30,165, 80, 40, 32, 18,
-137, 16, 23, 23,167, 25, 49, 98,  4,159, 36, 73, 36, 37, 37,213, 10, 45,123, 91,235, 14,189,187,249,122,175,217,114,248,178,136,
-207,231,  7, 14,232,234, 19,159,152,145,205, 48, 68,122,163,214, 86,189,254,234,227,152, 71,  3,237,164,109, 89, 41, 55,238,194,
-166,239,112,104, 52, 36, 84, 90, 26, 26,  3, 96, 96,113,225,228,215,  3, 86,109,124,192,  0,184,127,247,182, 94,163,215, 95, 54,
-141, 53, 38,152,240,175,182,106, 49, 77,137,164,234,207,197,  0,210,215,175, 95, 95, 84,199,218, 36,  3,240,  8, 64,151,234,227,
-100,245,206,147, 17,  4,113,159, 97,152,110,117,120,100,117,  4, 87,221,207,218,122,199, 60,106,129,200,170,251,254,162,208,106,
-108, 73, 37,  0,216,218,218,218,251,251,119,109,243,253,190, 19, 96, 24,  6,207,162, 55,162,164,240, 41,150,173,251,173,141,179,
-179,115,255,156,156,156,155,198,148,128,162,168,227,251,247,239, 95,212,227, 13,127,127,119, 23, 23, 60, 74, 79,  3,151,161,192,
-165, 40,144, 58, 13,216,148, 22, 46,190, 20, 72, 66,140,220,220, 50,108, 56,122, 34,174, 58, 74,124,147,240, 30, 62, 10,171,178,
-203, 64, 16,  4, 54,  5,248,130,103, 46,  6, 87, 36,198,127,206, 69,213,138,171,136, 85, 97,224,137,197,104,211,195,168,128,240,
-202,235,215,175, 63,120,252,248,113, 55, 95, 95, 95, 44, 90,180,  8,233,233,233,160,105, 26,  5,  5,  5,234,188,188,188, 28,153,
- 76,150, 14,224, 12,128,239, 97, 68,228,113,174, 70,189, 53,226,244,161, 57,  1,125,250,219,142, 30,187, 19, 63,157, 90,136,210,
- 50,  5,148,  6, 33, 42,213,  6, 84,106, 88,176,182,233,132, 30,157, 59, 35, 55,167, 16, 79,238, 94,174, 96,107,148, 27, 91,210,
- 65,  9,130, 64,116,116, 52, 60,165,230,120,254,203, 77,216,154,113,208, 69,234,  8,105,239, 62,181,241,165,154,  2,135,  5,195,
-187,239,190, 91, 27, 25,126,232,208,161,105, 83,166, 76,113, 90,184,112, 33,246,237,219,135,219,183,111,191,228,160,221,191,127,
-127,220,186,117,107, 37,128,229,205, 25,245,180, 90, 45,188,189,189,113,255,254,125, 92,187,118, 13,131,  6, 13, 66,255,254,253,
- 17, 27, 27,139, 43, 87,174, 32, 58, 58, 26,  4, 65,192,198,198,  6,250, 42,241,172,111,140, 76,167,195,201, 47,191,218,191,100,
-203,150,157, 29, 39, 79,158,140,211,167,127,196,140,233,237, 65,144,124, 16,  4, 31,163, 70,182,199,170,213,247,209,163,199,  0,
-216,218,114,176,101,243,217, 84,149,138, 58,108, 68, 51,174,185,114,229,138, 84,173, 86,163,180,180,148, 17,139,197,132, 92, 94,
-181,162,181, 33,139,150, 82,169, 20, 52, 70,244,248, 97,194,198,210,114,166,132,169,136, 30, 91,108,136,238, 52, 40, 48, 11,111,
-  6, 77,199,213,136,  3,136,186,124, 13,214,236,244, 52,136,202, 47, 22,165, 21, 41,242, 42,189,118,249,188, 49,147,149, 93,121,
-121,215,220, 81,207, 89, 78, 78,244,201,176,239, 20,165, 77,  9, 45,  0, 68,113,252,145,115,103, 24,140,234, 21,208,163,173,175,
-155, 19,175,164,168,144, 57,117,246, 98,156, 46,237,244,249, 58,  2,139,105, 70,168,175, 10, 13, 13,253,162,250,243,193,165, 75,
-151,206,220,176, 97,131, 93,126,126,126,173,143, 86, 97, 81,113, 84,175, 17,115, 41,121,105,153,118,255,150,207,198, 11,  5,124,
-222,210, 13,251,111,232, 89,184,219, 24,175,129,166,191,157,176, 96,217,252,196,103,209,206,173,133, 60,156,253,108, 57, 30, 93,
-185, 14, 61,201,197,135,215,126,135, 70, 71,161,180, 72,142,159,223,155, 13,177,131,  4, 59,111,156, 46,160,105,250, 59,211, 80,
- 99,130,  9,255, 94, 52,166, 69,  8,130,104, 40,198, 94, 65,  3,255,187,223,212,121,141,240,252, 25,104, 52, 42,188, 81, 75,240,
-138,138,138, 10,111,221,250, 29, 55, 34,214,224,102,196, 26, 60,137,126,132,220, 28, 45,114, 10,212,176,176,176,248,173,137, 83,
-235, 71,142,101,148, 74,229,184,165,203,190,200, 23,  8,205,208,111,240, 96, 56,218,217,195,140,203,  1,203, 64,131, 69,112, 80,
- 33,179,194,243, 88, 37, 22,239, 63, 82, 88,161, 84,142,107, 96,144, 24,210,152,200, 32,  8,  2,124, 11,115,240,196,230,224,155,
- 91,188, 48,141, 40,176,176,128,192,220,  2,108, 30,175, 33,103,248,151, 56, 43, 42, 42,222, 30, 63,126,124, 73, 89, 89, 25,102,
-206,156,137,155, 55,111, 70, 95,190,124,217, 34, 54, 54, 86, 40,147,201,218,  2, 24, 10, 96,119, 19, 34,235,  5,206,146,146,148,
-114,198,160,153,184,254,139,143, 85,106,131, 13,130,167, 30,135,136,204,130,129,162,193,  0,144, 90,243,208,123,200,106, 20,106,
-123,225,248,174,181, 74, 90,167,158, 92, 47,134,214, 11,156, 12,195, 48, 14, 14, 14, 47,181,193,181,107,215, 16, 60,254,109,  4,
-142, 29,  3, 59,119, 79,216, 15, 25,142,192,153, 31, 98,215,174, 93, 32, 73, 18,182,182,182,245,  7,222, 90,206, 67, 49,224, 28,
-123, 12,226,216, 99, 16,  7,163,193,  6, 16,114,228,200,145, 47,187,116,233,114,253,246,237,219, 27,  1, 76,172,251, 93,117,176,
-162,158, 53,171,161,223,232,243,249,243,231,171, 18, 19, 19, 33, 18,137, 96, 48, 24,112,251,246,109,236,220,185, 19,155, 54,109,
- 66,116,116, 52,108,108,108,208,166, 77, 27,104, 52, 26,220,191,127, 95,  5,224,243, 38, 56,105,153,204,240,246,182,109, 27,228,
- 65, 65,125,177,127,255, 14, 56, 58,246,  2,135,237,  8, 54,199, 14, 34,177, 55,246,126,255, 37,134, 13,243,199,185,179, 39,138,
-139,228,134,183,  1, 24,140,232, 75,234,223,127,255, 29,187,118,237,194,248,241,227,115,130,131,131,169,178,178,178, 90,139, 22,
-195, 48, 96, 24,  6, 43,170,125,204, 52, 26, 13,191, 49,206,247, 23,199,229,124,182,246,201,170,130,252,156,158, 55,175,255,246,
-110,212,229,107, 72, 77,140, 66,212,229,107,248, 37,234, 78,104, 65,126, 78, 79,255,238,237,184,227,102,206,249,244, 80,248,105,
-150,216,194,  9,135,194, 79,179, 38,205,253,120,109,215,192, 65,159, 55,215,231,171,127, 71,166,162,176, 32,108,221,198,237, 21,
-  6,157,154,252,250,155,111,115, 85,178,188,207,235,244, 75,166,185,254,169, 82,169,118,171,213,106,169, 90,173,150,106, 52,154,
-207,211,211,211,251, 45, 90,180, 72, 70, 81, 84,173,181, 84, 22,127,238,183,167,191, 30, 92,103,111, 43, 17,246,234,214,177,253,
-230,221,167,110,100,102, 21,252, 80, 39,134, 86, 67,229, 84, 87,168,212,111,143, 25, 55,165,178,180, 68,131,128,143, 67, 65, 11,
-196,208, 80,128,158, 97,193, 64,176,241,120,205,102,  8,173,205,113, 52,237,161,178, 76,175,123, 27, 47,198,208,106,170,238,175,
-  3, 19,167,137,211,196,249,247,228,252, 95,134, 19, 94,204,117,232,244,130, 69,171,185, 37,149,206,206,206,253, 70,143, 26,130,
-  1, 65, 75,193, 48, 12,158, 62,252, 10, 37,178,103,112,118,228, 35, 37, 83, 17,  0,224,102, 11, 10,147,153,158,149,213,115,254,
-231, 75,195,131,135, 14,246,241,117,119,231,183,110,221, 10, 34,123,123, 20, 21,201,240,235,221,120,253,218, 99, 39,227,170, 69,
-150, 81, 19,147, 52, 77, 87, 57,185,  3, 24, 60,127, 49,  8, 22, 11,168, 14,227, 80, 51, 48,186,119,235,  5,130,205,  6,197,208,
-208,104, 52,198,172,150,203, 78, 78, 78,126,123,242,228,201, 63, 71, 68, 68,144,129,129,129,126,103,206,156,121,157,156,121,168,
- 44, 76,188, 14, 32,104,109,216,172,227, 61,  7,141,177,240,234,216,149,219,181, 53, 11, 58, 61,129,220,156, 12, 68,132,223,211,
-197,255,126, 89,193, 24,212, 19,149, 69,137,215,155,226,210,233,116,153,109,219,182,117,216,181,107, 87,173, 51, 60, 69, 81, 40,
- 42, 42,194,111,191,253,134, 78,221,122,192,103,250,123,144,201,100,216,182,109, 27,220,220,220, 48,114,228, 72, 20, 23, 23,195,
- 96, 48, 24, 59,225, 75,  1,184, 92,253, 66, 61,145, 69, 84,167,  0,106,114,218,208,211,211,147,167, 86,171,253, 24,134, 97, 17,
-  4,177, 85,171,213, 78, 11, 11, 11,115, 90,183,110, 29,218,183,111,143,162,162, 34,136, 68, 34,120,121,121, 65, 38,147,225,222,
-189,123,148, 82,169,220,133,170, 68,214,178,102,202,151,116,239, 94, 90,207,121,243,254, 19,254,229,134, 89, 94,106,205,  0,158,
-181,117, 31, 48,140,  1, 50, 89, 58,202, 21,183,117,171, 87, 29, 72, 46, 40,212,143,  3,144,104,100,157,151,207,153, 51,  7,  0,
-  4,  0,150,166,164,164,196,248,248,248,120, 53,102,209, 50,  6, 91, 78,229,168,  1, 28,123, 59, 80,186, 64, 81, 20,235,101,205,
- 78, 79,235,233, 75,111,219,114, 42, 71,109, 33,173, 92, 83,148,126,243,121, 94,229,229, 93,135,194, 79,179,166,142,125,155,114,
- 17, 39,134, 10,236,153, 83, 70, 80, 51, 93,186,116,113, 37,136, 98,143, 66,249,179,  7, 51,102,206,154, 96,201, 85, 69,118,113,
-145,183, 33,221,252,  5,209,209,209,105,104,225,202,208,106, 60,207,201,201,233, 23, 22, 22,118,153, 97,152, 23,124, 19, 10,139,
-138,163,  2,130,230, 48,165,165,101, 49,178,132,115,198,196, 82,187,119,239, 97,244, 96,223, 78,254,167,191, 92,183,193, 97,192,
-252, 69,236,231,215,111,  0,148, 30, 25, 55,111,128,226,107,233,205,119,174, 22,148,233,116, 99, 97,138, 10,111,130,  9,255,122,
-107, 86, 83, 90,228,111,142, 17,104,196, 25,222,232,202,120,122, 56, 95,110,239,213,122,168,155,139, 29,  0, 32, 37, 45, 23, 41,
-105, 57, 87, 82, 82,115,  2,155, 81,188,141, 45,175,172, 77, 42, 77, 84,135,112, 96,140, 75, 42,253,  2,167,141,141,205,  3, 54,
-155,237,210,146,214,160, 40, 42,183,168,168,200,223,200,114, 78,114,119,119,223,144,145,145, 17, 78,211,244,130, 22,170,253,  6,
- 57,107,146, 74,147,108,222, 16,198,160,237,  4,  0,  4,155,103, 76, 82,233,186,156,157,196, 98,241,110, 14,135,227, 86,243, 59,
-214,248, 96, 81, 20,197,210,233,116,  2,138,162, 88,  0,  8,146, 36, 13, 28, 14, 71, 77, 16,132,193, 96, 48,100,106, 52,154, 89,
-248, 35,224,104, 83,117,111,118,160,175, 22, 90,104,192,162,117, 13,  0, 18, 19, 19,219, 73, 36,146,137,  4, 65,140,103, 24,198,
-187,188,188, 92,179,108,217,178,232,147, 39, 79, 42,220,221,221,223, 26, 49, 98,  4, 17, 27, 27,139,184,184, 56, 70, 46,151,159,
-170,182, 98,165,180,176, 47,145,124, 62,235, 29,107,107,114,  4,195,160, 11, 24, 16,  4,137,199,101,101,116,164, 82, 73,253, 80,
- 45, 24, 91,218, 63,107,240,110,235,214,173, 15,164,165,165,113, 26,179,164, 54, 86,247,250,248,234,243,142, 75,  3,250,246,125,
-251,183, 95,126, 57,243,217,218, 39,171,234,238,155, 59, 70, 50, 99,210,236,249, 95, 29,251,246,155,207,182,255, 84,178,223,152,
-114,250,249,249,121, 18,  4, 49, 17,128, 47,195, 48,109, 25,134, 16, 16,  4, 83, 66, 16,196, 19,  0,177, 90,173, 54, 34, 62, 62,
- 62,251, 53,234,254, 42, 79,184,141,113,214, 38,149,  6, 69,117,166,  0,198,200,164,210,255,237,114,154, 56, 77,156, 38,206,255,
- 63,206,255,101,124,208,192,255,140,139, 12, 95,131,148,212,156,192,148,212, 28,180,109,219,150, 73, 74, 74,106,145, 72,107,108,
-144,166, 40,234, 71,165, 82,249,227,235,144,200,229,242,174,127,113,227, 29, 75, 75, 75, 59,246,103, 18, 86, 11,169, 85,213,175,
- 87,197,227,138,138,138, 30,198, 30,172,211,233,254,138,182, 33,170,173, 89, 43, 27, 59, 96,232,208,161, 25, 58,157,238, 26,128,
- 44,130, 32,172,  0, 20,235,116,186,203,  6,131,161, 32, 41, 41,169,235,230,205,155,107, 34,223,175,  6,240,224, 21,203, 65,107,
- 52,212,209,220, 92,234,232, 95, 80,199,163, 90,173,118,161,141,141, 77, 27,181, 90,205, 83,171,213,220,186,139, 15,132, 66,161,
-172, 41,135,248,186,176, 50, 39, 14,114,217, 37, 54, 86,230, 68,125, 33,  5,107,103,156, 86, 85,198,181,183,118,198,105, 99, 11,
- 22, 19, 19,147,210,165, 75,151, 35, 36, 73,186, 51, 12,227,  0, 48,150, 12,  3, 25,195, 48, 69,108, 54, 59, 39, 62, 62, 62,231,
-111,116, 19, 82, 27,104,122,163, 65,171,253,195,239,208,180,186,208,  4, 19, 76,248,231,160, 81, 31, 45,118, 75,153,146,146,146,
-  8, 83,123,154, 80, 87,108, 53,181, 51, 35, 35, 67,  3,224, 78,245,171, 62, 30,  0, 24,249,119,175, 96, 94, 94,158,127, 99,251,
-140, 21, 89, 64,149,207, 22, 16,215, 96,116,246, 21,219, 75,202,177, 61,252,211,150,150,237,209,163, 71,153, 48,114,138,221,  4,
- 19, 76, 48,193,132,191, 12,175,111,209, 50,193,  4, 19, 76, 48,193,  4, 19, 76, 48,161, 65,236,169, 35,184, 94,176,110, 17,104,
-124,229, 64, 75,230, 94, 95,101,245,193, 53, 19,167,137,211,196,105,226, 52,113,154, 56, 77,156,255, 58,206,127, 42, 94, 18, 89,
-255, 13,152,150,190,154, 56, 77,156, 38, 78, 19,167,137,211,196,105,226,252, 55,136,172,250, 47,  0,166,169, 67, 19, 76, 48,225,
- 95,140,147, 39, 79, 26,149, 84,244,157,207,246,  6,137,197,146,101, 21,138,178, 13, 63,110,156,113,166,230,255,193,193,193,148,
-169, 21, 77, 48,193,  4,188,138, 51,188,135,135, 75,  7,146,162,123, 51, 12,201, 98, 72, 70, 79, 40, 84,199, 83, 74, 74, 94,  8,
- 59,224,234,234,106,197, 33, 49,146, 96, 24, 17, 65,208, 20,205, 34,111,167,166,102,199,183,160, 96, 60,137, 68, 50,135,203,229,
- 14,209,106,181, 46, 36, 73,102,107, 52,154,107, 74,165,114,  7, 94, 14, 92,248,255,134,118,237,218, 77,186,113,227,134, 85,159,
- 62,125, 52, 66,161,208,160, 82,169,216,151, 46, 93,226, 15, 27, 54,172, 52, 57, 57,249,149, 86, 36, 74,165,210, 65,123,247,238,
-245,  8, 12, 12, 68,219,182,109, 43, 39, 78,156,200, 13,  8,  8,224,206,156, 57, 51, 53, 55, 55, 55,170,133,116, 29,  8,130, 56,
- 76, 16,  4,139,166,233, 16,252, 17,186,225,207,  6, 73,146,228, 44,130, 32,198, 50, 12,227, 73, 16, 68, 10,195, 48,103,104,154,
-110, 42,112,107, 83,120, 27,192,112,146, 36,253,  1,128,166,233,104,  0,145,128,241, 43,239,254,155,156,102,102,102,126,  0,160,
- 84, 42, 99,254, 44, 78,130, 32,252,  0,128, 97,152, 87,229,156, 46, 20, 10,223,  7,  0,149, 74,245, 61,140, 72,  7, 85, 31,204,
- 46,111,198,127,229, 83,  0, 64,244,114,111,  0, 64, 75,182,137, 15,159, 18, 45,249,174,134,248, 90,194,209,  0,134, 79,158, 60,
-121,221, 15, 63,252,176, 28,192,217,191,162,227, 59, 58,186,238,216,244,205, 30,233,199,115,222,219,128,170,140, 16, 77, 95,144,
-192,155, 60, 22,107,148,150,162,126,137,  7, 78,  2, 96, 91, 91, 91, 79,226,241,120,253,180, 90,173, 19,155,205,206,211,106,181,
-183,202,202,202,142,161,137, 12,  8, 70,183,107,  2, 36, 58, 37, 28,  9,250,143, 60,111, 12,  9, 13,215, 12,249,132, 15, 74,254,
-  6,183, 81, 18,192,252,234,186,238, 67,227,225, 60,154,186,249,124, 44,149, 74,199, 42, 20, 10, 37,139,197, 98, 80,181,234,185,
-234, 79,213,126,130,166,233,194,226,226,226,144,230,184, 68,110,104,207, 19, 17,135, 41, 61, 84,  6, 13,243, 81,101, 22,158,138,
- 93,209,139,  1, 66, 24,192,157,100,145,118, 52, 77,231,  1,136, 34, 13, 56, 95,145,139,164,191,233,224,222,170,186, 93, 91, 87,
-111,115,  0, 56,  0,136,  5,240, 49,128, 10,147,254,249,175,161,190, 51,252,  5,  0,121,181, 66,171, 78,184,251,  1, 65, 65, 65,
- 55, 61, 60, 92, 58,140, 31, 51,110,221,135,179, 62, 34, 88, 44, 18,113, 79,158,176,223, 13,153, 62, 84, 34,145, 56,139, 53, 26,
- 31, 16,  4,173, 20,  8,226, 20,138,178,156,147,199,126, 48,247,110,223,158,162, 40, 26,187,118,127, 55,236,212, 79,225, 75,140,
- 20, 91,237, 28, 29, 29, 15,135,134,134, 58,142, 26, 53,138,229,232,232,136,244,244,116,171, 31,127,252,177,253,246,237,219, 39,
-148,148,148,132,  0,120,254, 10,149,237,235,104, 77, 14, 53, 23, 18,131, 81, 78,161, 92,143,159,243, 85,184,  2,224,151, 87,109,
- 61,165, 82, 57, 87,169, 84,246,232,214,173, 27,179,111,223, 62, 98,218,180,105, 12, 65, 16,132, 74,165, 58,  8,224,149,132,150,
- 72, 36,250, 54, 48, 48,208,203,203,203, 43, 37, 57, 57,121,248,137, 19, 39, 34,167, 78,157,234, 41, 18,137, 18,  1,180,107, 33,
-221,  1,185, 92,222, 69,165, 82,193,197,197,101, 31,128, 55,254,130, 78, 68,176, 88,172, 51,206,206,206,204, 87, 95,125,117,182,
- 75,151, 46, 14,197,197,197,134, 79, 63,253,116,200,221,187,119,135, 81, 20, 53,170,  5, 98, 75, 66, 16,196,110,  7,  7,  7,219,
- 13, 27, 54, 36,117,237,218, 53,150,207,231,243, 18, 19, 19,205, 22, 46, 92,184,224,249,243,231, 19, 24,134,153,  5,180,104,128,
-144, 16,  4,177, 91, 42,149,218,174, 91,183, 46,221,223,223, 63,142,203,229,114, 19, 19, 19, 69,139, 23, 47,254,248,233,211,167,
-175,196, 73,146,228,174, 30, 61,122, 72,150, 47, 95,158,208,190,125,251, 59, 44, 22,139,151,157,157, 77,174, 88,177, 98,206,213,
-171, 87,131,105,154,254,240, 85,202,105,111,111, 47, 89,177, 98, 69, 66, 64, 64,192, 93, 46,151,203,125,246,236, 25, 25, 26, 26,
- 58, 39, 41, 41,201,232,114, 90, 91, 91, 15, 36,  8, 98, 79,126,126, 62, 27,  0,156,156,156,186, 91, 88, 88,108,175,155,211,178,
- 38, 20,133, 94,175, 47, 87,171,213,147,139,139,139, 27, 12,132, 59, 45,108,219, 72,  0,216,174,171,217,174,122,111,110, 27,216,
-117,222,152, 74,251, 57, 86,197,197,219, 84, 57, 99, 12,  0, 76,170, 78, 21,190,169, 18, 96,179,217,180,159,227,199, 76, 76,126,
-139, 66,198,140, 30, 52,104,208,138,168,168,168,239,  6, 12, 24,176,248,200,145, 35,246, 89, 89, 89, 95,254,242,203, 47,174,239,
-188,243,206,180,159,127,254,121,125, 81, 81,209,169, 63,171,243,243,184,124, 62, 65, 18, 16, 10,204, 44,140, 57,158, 67,146, 65,
-119, 70,143,126,255,251,103,207,252,183, 63,125,234, 81,233,228,212, 99,222,188,121, 14,227,198,141, 35, 93, 93, 93,145,148,148,
-100,115,228,200, 17,159,239,191,255,126,108,105,105,233,124,  0, 25,175, 35,178, 42, 75,209, 73,163,133, 63,195,192,170,246,130,
- 37, 80,202,215, 33,154, 73,192,227,191,129,216,250,226,192,129,  3,203,147,146,146,176,126,253,122,  0,216,209,194,243, 23,142,
- 30, 61,122, 68,120,120,184,240,228,201,147,194,110,221,186,193,209,209, 17,213, 15, 83,181,129,169, 61, 60, 60,140,107, 51, 26,
-155,182, 70,206,120, 35,174,248, 34,190, 29,151,191, 94,232,  2, 67,175,209, 94, 99,131,166,249,195,210,206, 12,  2, 49, 27,165,
-114,133,239,179,232,172,192,235, 39,146,190, 76,122, 40,219, 80,153,137, 47,208,120, 76,190,255, 23,216,216,216,236, 75, 77, 77,
- 29, 40, 18,137, 94,248,127, 74, 74,138,159,151,151, 87, 25,128, 69, 45, 21,110,118,118,118, 71,105,154,214,200,229,242,247,  0,
-192,220,220,252,  7,145, 72, 36,201,203,203, 91,242, 87, 61,200,212,160,190, 22,249, 31,183,104,213,250,107, 53,148,235,144, 32,
- 41,186,247,135,179, 62, 34, 38, 78,122, 39, 63, 41, 37,149,102,115,120,147, 46, 93,190,108,214,161, 67,  7, 82,179, 99,  7, 12,
- 50, 25,244, 11, 22,244,186,118,237,154, 62,120,210, 20, 21,135, 69, 28,240,244,112, 55, 59,126,236, 71,199,240,211,167,122,  3,
-104, 78,104,241, 28, 29, 29, 15,223,184,113,195,217,195,195,  3,165,165,165, 72, 79, 79, 71,101,101, 37, 38, 76,152,192,233,221,
-187,183,243,248,241,227, 15,151,149,149,245,105,129,101,203,161,173, 11, 59, 98,214,244,113,237,134, 13,237, 45,114,118,109,  3,
- 38, 95,141,172,228,167,221, 34,110,220,157,119,224,116,228,243,164, 50, 38,  8, 13,231, 70,106, 18, 69, 69, 69,159,141, 29, 59,
-246,244,192,129,  3,237,248,124, 62,164, 82, 41, 49,106,212,168,194,220,220,220,149,175,172, 90,170, 83,216,144, 36, 73,213,125,
-111, 32, 61,144, 49,112,145, 72, 36,144, 72, 36,  0,224,252,186, 79,158, 86, 86, 86, 59,204,205,205,199, 43, 20, 10, 21, 73,146,
- 12, 65, 16,140, 86,171, 21, 74, 36,146, 71,  9, 79,159, 75, 53, 26, 77,219,141, 91,191,255,102, 80,223, 46, 22, 87,175, 94,197,
-184,113,227,152, 43, 87,174,204, 50, 54, 79, 29, 65, 16,187,199,142, 29,171, 92,182,108,153, 58, 41, 37,221, 57,225,121, 10, 33,
- 18,240,104, 91, 91, 91,206,189,123,247,216, 91,182,108, 17,172, 88,177, 98, 55,195, 48,227, 91,208,158,187,223,121,231, 29,221,
- 39,159,124,146,247, 44, 41,213,254,113, 66, 18, 35, 22,112, 12,182,182, 54,172,187,119,239,210,175,194, 73,146,228,174,207, 62,
-251, 76, 49,107,214,172, 18,121,113,153, 99,137,162,130,225,115, 88,122, 71, 71, 71,246,217,179,103, 53, 71,143, 30, 37,223,127,
-255,253, 93, 52, 77,  7,183,160,125,119,141, 26, 53,170, 60, 52, 52,180, 52, 49, 37,205,241,113,252,115,152,241, 57,122,  7,  7,
-123,214,253,251,247,117, 27, 55,110, 36,215,172, 89, 99, 84, 57, 69, 34,209,161, 19, 39, 78,176,207,158,173,186,247,253,246,219,
-111,164,167,167,167, 89,221, 99, 84,106, 13, 72,  2, 40, 42, 42, 50, 11,  8,  8, 56,  4,224,165,224,190,254, 43,159, 98, 90, 24,
- 48,119,238,220,188,150,118, 22,127,167,121,205, 30, 67,125,231,205,108, 81,206, 24,195,102,179,233,247,223,127, 63,191,254,126,
-181, 90, 77,  0, 24,133, 47,141, 23, 91,195,135, 15,255,252,194,133, 11,109,142, 28, 57,178,249,232,209,163, 90,  0, 16,  8,  4,
-182, 63,254,248,227,250,  9, 19, 38, 96,194,132,  9,203, 78,157, 58,245,167,  9, 45,138,161,116,  0,192, 23,240,249, 79,159, 62,
- 37,188,189,189,155,140,184,175,163,233,  7,223, 63,123,214,245, 63,222,222,221,138,105,186, 45,119,216,176,138,133, 11, 23, 22,
- 41, 20, 10,164,167,167, 67,167,211, 97,218,180,105,172,  1,  3,  6, 72, 39, 76,152,176,173,188,188,252,109,  0, 58, 35,250,228,
- 70,103,103,231, 15,202,202,202, 42,106,172, 58,125, 66, 40,118, 63, 63,  3,191,115, 91, 61,143,203, 50,112, 71, 46,160,137, 43,
- 59,136, 74,111, 15,252, 10,  0, 92, 37,100, 45,124, 24,104, 16, 22, 46,240,160, 56, 88, 99,231, 34, 28, 36,203, 80,173,170,204,
-108, 82, 44,189, 45, 18,137,198, 84, 86, 86,158,170, 30,156,219,  5,  5,  5,225,238,221,187,  0,208,187, 90,104, 13, 34, 73,242,
- 93,154,166,247,  2,104, 42,149,219,188,209,163, 71,191, 25, 30, 30,110, 14,  0,167, 78,157,130, 94,175,135,167,167, 39,184, 92,
- 46,120, 60, 30, 56, 28, 78,109,118, 16, 35,225,100,103,103, 11, 91, 75, 14, 36,214,162, 97,139,119,142,102,187,117,176, 64, 33,
-245,  4,197, 76, 41, 12,140,  6, 92, 27, 17,218,  7, 90,193,127,232, 32,242,252,174,184, 37,231,191, 77,232,170, 36, 49, 18, 25,
-208,252, 93, 70,118,146, 36,249,177,177,177,144, 74,165, 47,252,159,197, 98,  1, 64,191, 87,160, 92,150,146,146, 18,240,240,225,
- 67, 12, 28, 56,112, 89,167, 78,157,222,186,121,243,166,163, 92, 46,199,192,129,  3,183,101,103,103,159,253,171,235, 84, 87,139,
-252, 83, 76, 93,100, 61, 37, 57,160,234, 41,152,100,177, 88, 36, 82, 83,210,245,  3,  7, 14,158,154,153,153, 41,238,209,163,  7,
-201,225,112, 80, 25, 21,  5,245,253,251, 16,139,197, 24, 59,118, 44,231,214,173, 91, 22, 22, 98,139,153,105,169,105,229, 44, 22,
-  9,134, 33,155,245,121,144, 72, 36,115,150, 44, 89,226,232,229,229,  5,131,193, 80, 27,209,220, 96, 48, 32, 43, 43, 11, 98,177,
- 24, 33, 33, 33,246,102,102,102,115,140,172, 71,235,118,158,246,209, 55, 34,119,191,177,240,195,225,162,118,102, 87, 33,202,154,
- 15,241,169,255,192, 39,247, 18, 66,199,244, 16, 93,249,118,153,127, 27,169,117,116, 29, 19,171,209,208,104, 52,191,198,197,197,
-205,188,121,243, 38, 13,  0,215,175, 95,103, 18, 18, 18,102,189,206, 83, 40, 77,211, 40, 45, 45,  5, 77,211,172,234,237,154,247,
-255,215,254, 96, 97, 97,177,235,173,183,222,122, 39, 35, 35, 67,120,241,226, 69,155,204,204, 76,219,180,180, 52,187,118,237,218,
-177,215,175, 95,127, 65,173,209,177,244, 20,163, 53, 80,250,242,188, 39, 79, 82, 74, 10, 10,162,247,239,223,175, 34,  8, 98,172,
-145,223,241,182,147,147,147, 77, 88, 88, 24,  8,142, 89,247,246, 62,157,188, 88, 28,161, 37,201,225, 89,170, 84,106, 42, 53, 53,
- 53, 43, 44, 44,204,189, 75,151, 46, 82, 84, 77,175, 25,197, 41,149, 74,109, 63,249,228, 19,176,249,230,126,157,187,248,183,225,
-241, 69,230, 44,142,208,188, 71,143, 30,  3, 82, 82, 82,114, 67, 67, 67,157,186,117,235,214, 34,206,110,221,186, 73,222,127,255,
-125,131, 64,104, 30,224,225,225,233,211,185,163,207,136,118,237,218,141, 97,179,217,  6,153, 76,150, 17, 18, 18,226, 52,114,228,
- 72,135,150,112,218,219,219, 75, 66, 67, 67, 13,174,173, 60,  3,  3,223, 28,218,147, 43, 52,183,100,243, 68, 86, 74,165,154,122,
-246,236, 89,198,210,165, 75,157,252,252,252,236,141,225, 84, 42,149, 28, 91, 91, 91,248,250,250,162,131,167, 39,202,202,202, 16,
- 30, 30,142,  3,  7, 14, 96,239,222,189, 56,118,236, 24,186,246, 25, 10,115,115,115,228,230,230, 66,161, 80,112,254,219, 29,138,
-250,206,155,217,174,253, 96,212, 71, 31,125,148,251,254,251,239,231, 11,133, 66,186,254,203,218,218,154,154, 60,121,114, 65,200,
-226,173,163,106,166, 22,155,177,100,197, 70, 70, 70, 38, 31, 57,114,  4, 29, 58,116, 64, 96, 96, 32, 15,  0,230,204,153,195,155,
- 48, 97,  2, 78,156, 56,129, 83,167, 78,197,123,121,121,221,  6, 48,218,152,114,134,132,132,244,  9, 14, 14,254, 37, 56, 56, 56,
-102,226,196,137,123,102,205,154,245,194,200,149,151,155,253, 64,171,213,162,139,127, 55,179,213,251,126,159,220, 28, 95,  2,112,
-100,207,211,167,  7, 54, 60,121,146,177,172, 67,  7,171, 86,105,105,214,  7, 55,110,180,173, 73,210,173,215,235,145,149,149,  5,
-137, 68,130,201,147, 39,219,242,249,252, 16, 35,138,185,101,244,232,209,211, 51, 51, 51,197,223,127,255,189, 83, 76, 76,140, 52,
- 47, 47,207,233,231,107,151,237, 62, 93, 52,199,220, 82,204,227,229,202, 24,  2,  0,210,114, 33,122,154,138, 62, 12,  3,171,186,
-211,137,175,  4, 39,  8,133, 46,216,222,166,143,213,243, 79, 78,248, 77, 12,141,240,183,149, 56,241,195,154, 56,163,243, 87, 95,
-125,117,242,252,249,243,147,250,244,233,115, 26,128,176,129, 99,  4, 93,187,118, 13, 63,113,226,196,244,190,125,251,254, 10,192,
-183,209,167, 72, 23,151,177, 63,253,244,147, 77,205,182,173,173, 45,  4,  2,193, 75, 34,139,203,229,130, 36,201, 22, 87,111,237,
-143,147,216,214, 62, 26,196,149, 68,226,196, 87,177,248,106,216, 51,122, 93,175, 52,205,142,144,167,184,114, 34, 22,133,136,197,
-240,255,180,193,164,165, 93,134,152, 81, 88,243,119, 26,192,101, 50,217,187,253,250,245, 59, 57,124,248,112,205,195,135, 15, 33,
-147,201,224,236, 92,251,172,157,255, 10,148,214,102,102,102,112,117,117,133,151,151,215,164, 91,183,110, 57,234,245,122,164,165,
-165,161,176,176, 48,250,191, 81,167,186, 90,228,127, 12,245, 29,225, 47,188, 36,180,170,115, 11,221,  0,  0,134, 32, 42, 99,227,
-226, 56, 44, 30,111,202, 15, 71,143,242,185, 92, 46, 50, 50, 50, 16, 31, 31, 15,229,207, 63, 67,117,231, 14, 10, 10, 10, 80, 81,
- 81,  1,  7,  7,  7,236,222,183, 79,164,165,152, 25,207,158, 63,103, 49, 36, 83,215,223,160,193, 37,158,124, 62,127,200,184,113,
-227, 26, 21,100,185,185,185, 24, 62,124, 56,135,197, 98, 53,180,170,161, 62, 39, 33,181, 35,206,255,124,122,181,147, 19, 47, 30,
- 72, 90,  8,148, 71,  3,140,  6, 48,104,129,156,199,192,133,149,104, 85,241,148,184,188,122,170,163,179, 25,251,124,  3, 74,185,
-185,165,168,158,222,222,222,123,167, 76,153, 66,  2,192,160, 65,131,  8,111,111,239, 61,  0, 60,155, 56,231, 90, 51,131,228,221,
-146,146, 18, 76,152, 48,193,166, 77,155, 54,215, 38, 76,152, 96, 83,243,255, 87,229,172,177, 38,119,232,208, 65, 46, 16,  8,142,
-  1, 70,221, 96,107, 57,173,172,172,118, 12, 31, 62,124,252,209,163, 71,185,  0,112,227,198, 13,156, 63,127, 30, 79,158, 60, 65,
- 98, 98, 34,237,239,239,111,183,117,239,201, 93, 59,190, 59,180,101, 76,239, 46,210,  1,221,253,125,196, 21, 37, 21, 14, 14, 14,
-189, 25,134,241, 52,178,156,195, 87,174, 92, 25,159,144,156, 97, 73,178, 57,108, 46,135,205,183,176, 16, 57, 54,112,168,183,  0,
-  0, 32,  0, 73, 68, 65, 84, 72,204, 69, 46,214,102,  2,103, 62, 73,136,149, 74,101,254,177, 99,199,104,  0,195,141,229, 92,189,
-122,117,106, 66, 82,134, 21, 65,178,217, 28, 54,135, 43, 22,155, 89, 13, 11, 28,216, 13,  0,184, 96,184, 10,133,162,224,192,129,
-  3,186,150,112, 46, 95,190, 60,174,184,180, 66,194,230,112, 56,108, 54,171,182, 45, 69, 66,161,157, 25,159,207,211,104, 52, 57,
-223,124,243,141,170, 37,156, 43, 87,174,140,127,150,156,105, 77, 18,  4,139, 32, 72,182,133,185,200,198,198,210,204,206, 78, 44,
-180, 53, 99,179,120, 10,133, 34,231,240,225,195, 70,113,234,116, 58,110, 65, 65,  1, 18, 18, 18,224,218,173, 27,174, 94,189, 10,
- 55, 55, 55, 76,152, 48,  1,239,188,243, 14,132, 66, 33,  6,  5,116, 66, 88, 88, 24,146,147,147,161,211,233,248, 13,113,214,248,
- 73,213,135, 84, 42,125,216, 92,231,169,119,238, 11,229,244,115,  4,179, 93,251,193,168,186,  2,171, 49,126,107,107,107,170, 33,
-107, 87,125,206,225,195,135,127,254,243,207, 63,183, 57,124,248,240,168,144,144,144, 95, 15, 31, 62,140,158, 61,123, 34, 33, 33,
-  1,238,238,238, 56,120,240, 32,222,121,231,157, 95,183,109,219, 54,234,225,195,135, 93, 60, 60, 60,150, 52,199, 57,113,226,196,
-217,126,126,126, 81,249,249,249,  1,197,197,197,190,225,225,225, 51,198,142, 29,155, 58,105,210,164,193,181,130, 81,175, 63,122,
-225,220,105,140, 24, 53, 14,237, 59,250,238,154,182,228, 72,167,102,174, 77,230,  9,176,231, 64, 94,158,236,168, 90,173,156,192,
-225,152,153,253,254,187,245,169,239,190,179,173,155, 89, 32, 39, 39,  7, 35, 71,142,228,112,185,220,190,205,148,243,171, 49, 99,
-198, 76,  8, 15, 15,151,212, 88,117,238,220,185,131,199,143, 31, 35, 61, 61, 29,165,165,165, 24, 60,171,  2, 31,173,175,226,254,
-104, 61,131,161,115, 24,209, 43,222, 67,106, 33,116,131,163,141,  5,251,246,140,111,218,207,249, 96, 87,  7,182,216,154,131, 31,
- 22, 39,162, 40, 77,115,170, 17, 78, 34, 32, 32,224, 72,112,112, 48,161,213,106,161,213,106,181,  0, 26,140,234,235,236,236, 44,
-232,220,185, 51,102,205,154, 69, 90, 88, 88,108,107,172,156,149,149,149,154,200,200, 72,132,132,132, 96,254,252,249,104,219,182,
- 45, 36, 18,  9, 56, 28, 14, 14, 29, 57,110,251,206,140, 15,219,189,209,167, 95,151, 14,111,244,236, 92,174, 97,117,227,  8, 37,
-239, 55, 98, 13,105,176,238, 21,246, 15, 17,151,246, 27,182,143,202,166,239, 29, 84, 86,124,250,238,215, 79,159,221, 44,120,178,
- 36,120, 79, 28,243, 91,175,162, 35, 31,103,162, 64,159,128,190, 19, 90,193,195, 79,178, 64,228, 10,239, 87,109, 79, 35,209, 34,
-206, 78,157, 58,245,185,119,239, 30,191, 95,191,126,200,200,200,  0,135, 83,251, 60, 69,189, 78, 57, 87,174, 92,201, 87,171,213,
-120,244,232, 17,166, 78,157,154,163,211,233, 22,188, 78, 57, 91, 98,209,170,209, 34,255, 99,216, 83,239,149,215,152, 69,107, 37,
-  0,232,105,156,159, 50,117,134, 50, 34, 34,194,140,199,227, 33, 35, 35,  3,121,121,121, 56,116,224,  0, 53,200,222,190, 60,208,
-217, 89,113,232,192,  1, 70,171,213,130, 97, 24,120,123,123, 99,252,248,241,194,183, 39, 76, 42, 36, 20,170,227, 70, 76,243, 56,
-213,204,175,207,152, 49,227,165,253,159,126,250, 41, 44, 44, 44, 64, 16,132,163, 17,149, 11,158,183,114,140,139,196,195,170,128,
-201, 63, 84, 12,150,  0, 96,155,  3,108, 11, 64, 96,  9,240,205,  1,158, 25, 52, 15,163,138, 73, 38, 48,125, 92,223,247,156,  1,
-180,100,170,  7, 82,169,116, 89, 84, 84,148,221,195,135, 15, 25,133, 66,129,188,188, 60,102,221,186,117,118, 82,169,116,217,171,
-254, 34,185,185,185,171, 71,140, 24, 81, 48,117,234, 84,203, 75,151, 46,185, 78,157, 58,213,114,196,136, 17,  5,185,185,185,171,
- 95,231,151,230,114,185,172, 39, 79,158, 88,175, 89,179,230, 29,  0, 15, 58,118,236, 40,119,118,118,126,128, 42,167,201, 38, 97,
-110,110, 94, 43,178,106,172,107,108, 54, 27, 28, 14,  7, 82,169, 84, 91, 92, 92, 76,245,125,195, 83,232,109, 73,234,165,124,174,
-208, 90, 40,112, 49,183,176,236, 33,151,203, 99,  9,130, 72, 49,114,138,207,175,123,247,238, 28,138,225,208, 31, 77, 25, 36,157,
- 51,125,160,253,206, 53,239,187,125,179,250,  3,231,175, 86,204,244, 94,253,217,228,129, 36, 77,171,221,221,221, 29,107, 28,218,
-141, 48,159,251,119,237,218,149, 77,131,131,132,231,233,  5, 25,217, 57,229,111, 14,  8,168,181, 92,118,240,243, 15,180,179,179,
-235,231,237,237,221,149, 32,  8,163,150, 36, 11,133, 66,191,246,237,219,179, 73, 22,135,176,145,152,187,154,139,133, 14,181, 83,
- 40, 86, 86,189,172,237,236,130, 73,134, 41,115,114,114,178, 23, 10,133,126, 45,168, 59,155,  6, 23, 14,246,214,150,118,182, 86,
-226,192,129,189,219,  6,244, 10,104,215,169, 71,207,128,142,111,116,125,155, 48, 24, 20,158,158,158,246, 53, 78,242,205, 88, 90,
-  5, 71,143, 30,197,154, 53,107,208,185, 85, 43, 56, 59, 59,195,222,222, 30,119,238,220,193,189,123,247, 32,145, 72, 80, 88, 88,
-136,141, 27, 55,226,204,153, 51,208,233,116,230, 45,237, 79,198,136,173,166, 96, 48, 24,200,250,  2,171, 49,126,161, 80, 72,215,
- 56,201, 55,134,200,200,200, 35, 53,150,172,143, 63,254,184,207,214,173, 91,127,125,250,244, 41,196, 98, 49,238,221,187,135, 25,
- 51,102,252,186,109,219,182, 62, 31,126,248, 33, 14, 28, 56,128,212,212,212,125, 77,241, 77,156, 56,113,197,204,153, 51,191,185,
-121,243, 38,233,224,224,  0,137, 68,130, 49, 99,198, 96,223,190,125,108,131,193,176, 63, 56, 56, 56, 38, 56, 56, 56,134,202,186,
-242,249,201,189,235,238,196,197,198, 96,246,188, 79,120, 90,131, 62,212,136,234, 51, 42,177,184,220,208,175, 95,241,  9,189, 94,
- 57,145,203, 53,179,140,137,177, 62,191,127,127,173,216, 10, 11, 11,131,165,165, 37, 80,229,192,140, 38,172, 58, 31,156, 57,115,
-166,246,126,104, 99, 99,  3, 30,143,  7, 46,151, 11, 14,135,  3, 22,139,133,107,187, 68,248, 46,172, 74, 95,124, 23, 70,224,202,
- 14,162,242,117,126, 59, 51,103,248, 74, 28,120, 49,255, 57,216,177,139,239, 96, 27,220,249, 49, 31,235, 70, 60,204,190,119, 66,
-182, 80, 93,136, 77,141,156,246,198,167,159,126,218,161,176,176, 16,247,239,223,199,253,251,247, 27,179,  0,169,207,157, 59,247,
-101, 69, 69,  5, 60, 60, 60, 48,122,244,232,126,  0,186, 53,114,221,160,107,215,174, 24, 57,114, 36,  6, 14, 28,136,206,157, 59,
- 67,171, 51,112,130,167,124,208,254, 73,170,204,121,221,198,117,102, 81,215,195,201, 95,127,189,201, 58,114,250,138,101,192,192,
-161,223,112,205,157,238, 66,104,227,100, 76, 61,149,148, 28,126, 78,195,176,231,231,121,228,246, 27, 83,197,135,206,111,247, 52,
- 55, 55, 39,162,239,199,232, 15,125,123, 34,211, 87, 52,186,240,238,143,114, 40,137,124, 12,158,238, 65,210,192,248,191,203,200,
- 46, 16,  8,182,222,188,121,211, 81,167,211, 33, 46, 46, 14,243,231,207, 87,191, 38,101,173,  1,196,213,213, 21, 55,110,220,192,
-228,201,147,213,  5,  5,  5,191,253,183,234, 84, 87,139,252, 83,192,174,163, 32,107,145,149,149, 85, 42,145, 72,156,219,183,111,
- 79,106,181,218,170, 41,137, 83,167,168,189,251,247, 95, 80,171,213,243,  0,112,119,236,220,185,203,217,197,101,224,148,144, 16,
- 66,175,215, 99,196,136, 17,188,136,136,  8,155,148,194,194,114, 35,  6,156, 23,190,111,218,180,105,216,186,117, 43,  0, 96,238,
-220,185,181,166,117,194,  8,135, 37,177, 37,134,  7,  6,117,181,200, 18,109,183,208,245,210, 87,180, 78, 54,191, 43,170, 16,118,
-  5,201, 99, 67,192,  2,173,211, 27, 18, 11,199, 62, 72, 78,244,233, 32, 44,150,187, 15,233,216, 31,123,175, 30, 30,174,164,212,
- 39,140,190,225,152,153,117, 23,139,197,120,240,224, 65,113,215,174, 93, 75, 25,134,177, 92,189,122,181,173,153,153, 89,247,215,
-104,251,180,231,207,159,247,235,221,187,247, 28,146, 36,135,208, 52,125,173,160,160, 96,  7,128, 52, 35,207,255,  8,192,114,  0,
-181, 79,150, 90,173, 22, 36, 73,130, 97, 24, 76,156, 56, 17, 97, 97, 97, 29, 30, 63,126,140,168,168, 40,235, 33, 67,134,220,  5,
- 80, 10,224, 61,  0, 13, 90,205, 20, 10,133,234,222,189,123,194,168,168, 40,208, 52, 13,107,107,107, 88, 88, 88,128,207,231, 99,
-204,152, 49,226,208,208,208,193,151, 47, 95, 46, 84,180,118, 99,  9,242,114, 42,249, 98,177, 57, 28,157,251,126, 56,233,221,167,
- 12,195,156,105,193,205,129, 39,100, 27,212,  4,165, 33,191,250, 98, 27,105,198,229, 18,  2, 46, 27,124, 90,137,207,191, 92, 75,
-112, 25,138,141, 22,206,207,115,185, 92,174, 57, 31, 90, 22,143,165, 55, 35,192,252, 25, 23,  7,139,197,226,  9,184,141,251, 99,
-112, 72,146, 36, 73,146, 11,192,232,164,125,124, 62,159,107,206,103, 26,229, 20,178,  8, 22, 65, 16, 60, 52,178, 18,205,207, 17,
- 76,141, 21,137, 55, 47, 69, 83, 87, 20,247,237,219, 23, 23,162, 30,224,212,249,107, 40,202,136,197,210,197, 31,163, 91,183,110,
-136,136,136,104,178, 76, 53, 62, 90,141, 89,151,165, 82,233,195,220,220,220, 55, 26, 59,183,169, 41,195, 70,172, 84, 47,243,127,
- 97,  9,255,149, 79,209,140,143,214,232,190,125,251,206, 62,122,244,168,246,173,183,222,226, 77,156, 56, 17,190,190,190,125,166,
- 79,159, 14,  0, 24, 50,100,  8,182,110,221,218,103,250,244,233, 56,126,252, 56,194,195,195, 53,  3,  6, 12, 88,124,227,198,141,
- 28, 84,173,232,124,  9, 52, 77,143,220,189,123,119,125, 75, 33, 12,  6,  3,244,122,189,147,193, 96,112,170,190, 23,225,155,111,
-182, 21, 93,185, 28,129,197, 75, 86,194,222,206,209,207,200, 62, 68, 76,251,228,147,162,131, 27, 55, 98,227,241,227,248,196,221,
-221,236,112,124, 60,174,168,213, 56, 17, 21, 85, 84,253, 61,205,250,102, 86, 86, 86,170, 34, 35, 35, 45, 78,156, 56,  1, 43, 43,
- 43,180,109,219, 22,214,214,214,224,112, 56, 32, 89, 66,176,184, 18,180,239,216, 29,192, 61,  0,128,187, 20,149,222, 30,248,149,
- 32, 80,202,144, 45,247, 41,226,187,161,181,173,139,224,230,236,  3,190, 86, 22,246, 92, 92,218,145,137,203,219,179,206,168,139,
-176, 25,  6, 60, 67,227, 62, 95, 93, 61, 60, 60, 80, 88, 88,136,200,200,200, 74,160, 81, 65,  6,154,166,191,220,185,115,231,167,
- 75,150, 44,225,123,123,123,  3,128, 31,128,251, 13, 29, 43, 18,137,224,236,236, 92, 43, 44, 39, 78,253,208,115,214,194, 15,133,
- 99,135, 14,  4,155,109,139,210, 74, 61,228,229,122, 72,108,197, 88,188, 48, 88,112,173,171,115,183,221,219,126, 56,167, 82,161,
- 27,240,242,253,128, 32,112,255,247,216, 95, 59,  9,188,  1,130,  4,178,200,235, 32, 64,160,130,208,131, 96,177, 24,138,162,144,
-153,153,  9,134, 97, 48,121,236,140,172, 15,214,133,219,247,153,172,128,107,123, 41,  8,  6,253,255, 46, 66,192,198,198,198, 79,
- 46,151, 35, 45, 45, 13, 83,167, 78,205, 41, 42, 42,186, 90, 89, 89, 57, 35, 55, 55, 23,  0,138, 95,129,178, 86,204,251,249,249,
-161,123,247,238,152, 48, 97,130, 64,169, 84,  6,123,122,122, 58,203,100,178, 94,127,101,125,234,107,145,127,148,208,106,240, 66,
-211,235,219,107,118,237, 66,229,181,107,224, 93,185,130, 19, 82,105,133, 90,173, 94,  4, 32,171,250,194,255,248,192,193,131,183,
- 71,253,246,155,133,246,233, 83,120, 62,126, 12,142,149,149, 95, 75, 11,176,127,255,126, 40, 20, 10,148,149,149,  1,  0,182,111,
-223, 14,133, 66,  1,131,145,  9,103,217, 92,244,113,180,119, 71, 62, 18, 65,179, 73,113,122,123,101, 79,177,218, 60,215, 57,211,
-161,178,140,116,198,211,140, 30, 34,149, 92,219,147, 96,105,161, 46, 82,194,185,119, 91,176,193,238,211,146, 50,214,204,251,179,
-217,236,226,231,207,159,143,108,215,174,221,121,  0,182,175,226, 15, 80, 15, 73,  5,  5,  5,243, 94,229, 68, 22,139,181, 60, 53,
- 53,213,126,223,190,125,115, 86,175, 94,205,212, 21, 90, 53,159,217,108, 54, 24,134,129,165,165, 37, 56, 28,142,195,157, 59,119,
- 28,122,244,232,241, 45, 77,211,126,141,212,147,241,245,245, 69,106,106, 42,216,108, 54, 44, 45, 45, 65, 27,116, 88,185,240, 67,
- 80, 44, 62,251,179,207, 62,243, 27, 55,110, 92,220,190,125,251,244, 22,  1,189,123,201,229,242, 39,179, 39, 79,137, 59,123,246,
-172,182, 58,196, 67,243,143,248, 12, 19,147,152,152,200,114,145, 58,176, 24,131,146, 22,113,  1, 65,236, 55, 12, 79,236,  8,  1,
-155,197,112,  9, 18,124,129,208, 50, 45, 59, 91, 78,211,116,130, 49,156, 52, 77, 71,167,166,166, 10, 29,236,109,216, 74,149,182,
- 66,200, 97,120,233,209, 15, 82, 90,251,119,245,  4,  0,117,244,189, 27,252,246, 62,194,244,  2,153,200,221,221,221, 40, 78,149,
- 74, 21,147,147,147,195,114,112,112, 96,103,100,101,159,179, 18,139,236, 44,172,172,122,  2,128,174,188,236, 30,169,209,200, 88,
- 28,182,131, 76, 46, 47, 86,169, 84,169,198,214, 61, 57, 57,153,237,228,100,207,186,116,229,231,243, 14,102,124,123,115, 30,219,
-130, 79, 16,132, 25,139, 80,112, 13,116,145,192,204,204, 62, 45, 59,187,152, 97,152, 70, 45,132, 27, 74,167,140,173,250,189, 86,
- 30,175,195,141,216,216, 88, 92,252, 53,  1, 34, 70, 11, 66, 93,134, 43,  7,190,199,228,207,150,188,182,223, 95,115, 98,235,149,
-172, 89,187,125, 30,214,227, 71, 94, 51,142,240,147, 39, 79, 94,121,228,200,145, 90,  7,148,132,132,  4, 12, 26, 52,168,102,154,
-  3,129,129,129,232,209,163,  7, 18, 18, 18,224,229,229,133,168,168, 40, 62,139,197,226, 79,153, 50,101,221, 15, 63,252, 16,217,
-172,221,127,207, 30,204,152, 49,163, 33,199,234,100,  0,106, 66,226, 93, 17,182,225,144,109,177,188,  8,133,178,252, 24, 99,219,
-129, 32,  8, 76,251,228,147,162,221, 90, 45,142,254,254, 59, 66, 68, 34,179,131, 73, 73, 24,209,163,  7, 58, 13, 26, 84,100,204,
-189,174,198,170,163, 86,171,193,225,112, 96, 97, 97,  1, 27, 27, 27,112,185, 92,176, 56, 82,176,121, 93, 64,114,185,240,239,219,
-  5, 27, 23,137,148, 83,135, 97, 27, 65,160,148,207, 67, 52,215,172, 81, 95, 29, 66,228,134, 49, 12,  3,133, 50, 11,215,107,  4,
-137,101, 43, 88,114,204, 57, 87,102,126,235,109,101, 97,207,197,197,109, 25,184,242,109,246,105,117, 62,150, 86,183,  5,221,196,
-131, 68, 39, 43, 43, 43,100,101,101, 33, 51, 51, 51, 30, 77, 59,248, 43, 19, 18, 18, 82,248,124,126,  7, 59, 59, 59,  0,240,104,
-236,193,156,166,233, 90, 63,172,195, 71, 79,218,250,245,243, 20,188,217,167,  3, 14,157, 95,139,255,  4,111,  3,135, 69,128,162,
-116,216,188, 53,  8,148,166,  2,193,163, 62, 32,250, 15,241,234,114,237,188,118,166, 94, 85,242,253, 75, 15,  2,108,172,249,250,
-157, 59, 86,124, 49,217,  9, 52, 97,101,107,107, 47,226,114,185,176,177,112,210, 46,153,181, 32,143, 97,152,218,235,134,195,226,
-234,201,114,107,149, 60,191, 66,104,197, 81,  1, 12,217,250,213,162,217,252,249,200,206,206,158,215,175, 95,191,117,229,229,229,
- 37,149,149,149,147,  1,192,195,195,163, 21, 73,146,124,  0, 77,205,142,180, 66,195, 97, 33,184,143, 31, 63,134,185,185, 57,114,
-114,114,234, 26, 95, 64,211,244,223,102, 17,192,223, 20,254,  0,162,  1, 56,  1, 24,129, 58,225, 29,200,106, 83, 93,255,136,136,
-  8, 38, 34, 34,162,127,237,224,197, 48,180,161,184, 24,140,166,170,109, 57, 28, 14,  3,160,238,138, 38, 51, 43, 43, 43,130,227,
-226,  2,130, 95,229,250,193,252,137, 75, 95,245,122,227, 66,203,208, 20, 88, 32,116, 96,234, 60,180, 84, 10,  8,172,181, 29,140,
-121,188,101,200,231, 89,213, 29,233,  0,  3,  3, 10, 52,171,133,197, 97, 42, 43, 43, 97, 48, 24, 36,109,218,180,185, 96, 48, 24,
- 36,213,131, 27,243,255,245,139, 82, 20,149,194, 98,177, 48,103,206, 28,212, 88,127,180, 90, 45,242,243,243,161,209,104,160,213,
-106,145,154,154,138,178,178, 50,104,181, 90, 60,121,242,  4, 30, 30, 30, 96,177, 88, 78, 77,220,204, 25,134, 97,224,234,234,138,
-214,173, 91,131, 69, 48,216,251,213, 10,124, 62,255, 67,188,227, 65, 99,255,142,205, 24, 48, 96,128,143,187,187,123,  0,155,205,
-166, 28, 29, 29,185,225,225,225,231, 40,138, 26,  3,227,239, 60,145, 97, 97, 97,173, 59,118,236,104,111,101, 97,174,231,243, 88,
-224,233, 43, 25,190, 70,206,176,149, 69,112,117,109,101,128,208,204, 43, 36, 36,132,106,204, 10,209, 16,231,162, 69,139,156,188,
-189,189, 45, 37, 86,230,149, 60, 14,171,144, 11,166,168, 44,246,254, 93,  0,224,217,217,171, 33, 48,235, 48,117,234, 84, 67, 75,
- 56,151, 45, 91,230, 97,103,103,103, 69,130, 41,167,116,186, 63,230,219, 53, 90, 57,193,225,168,192,229,117,157, 59,119, 46,209,
- 18,206, 79, 63,253,212,189, 67,135, 14, 86, 86, 22,162, 10, 54,135,149,199,165,233, 60,  1,232,124,142, 86, 87, 34,176,179, 85,
-194, 76,236, 31, 18, 18,210, 40,103,141, 53, 43, 52, 52, 52,171,158,240, 70,113,113, 49,212,249,113,224,230, 60, 69, 23, 49,  7,
-221,236, 36,224,243,249,181, 75,223, 27,235,174,141,249,104, 53, 36,182,140, 61,183,235,170, 38,166,  0,119,251, 60,172, 31, 55,
- 43, 55, 55, 23, 78, 78, 78, 77, 94, 79, 63,252,240,195,146,129,  3,  7, 22,  6,  6,  6,106, 47, 92,184,  0,130, 32, 16, 21, 21,
-133,156,156, 28,  4,  6,  6,130, 97,152,154, 85,109,136,137,137,193,144, 33, 67,254,143,189,235,142,111,170,122,223,207,189,217,
- 77,154,116,143,116,208, 66,161,165,180,133,  2, 66,217, 67, 80, 16, 80,148,249, 69,144,189,  5,  1, 21, 17, 80,145, 13,162, 40,
-178,  5,  4, 28,200, 20, 40,  2, 50, 75, 89,  5,202, 42,165,180,172,210,221,210, 38, 77,154, 52,251,222,251,251,163, 73, 12,165,
- 35, 41,160,226, 47,207,231,115, 63,201, 29,121,114,238,185,247,156,243,156,247,156,243,190,250, 78,157, 58,229,154,253,107,213,
-138, 81,163, 70,193,104, 52, 66,165, 82, 65, 38,147, 33, 62, 62, 30,177,177,177,140, 80, 40,236,199, 10,126,125,209,192, 49,179,
-219,197, 52,107,142, 53,171, 86,232,121,108,206, 82, 71,202, 43, 65, 16, 24,254,225,135,197,138, 22, 45,100,219,213,234,242, 17,
- 18,137,176, 97,118,182,231,149,163, 71,189, 13,  6,131, 93, 28, 22,171, 78, 80, 80,144, 85,100,113,185, 92,176,121, 62, 96,137,
-154,130,231,213,  3, 66,255,126, 56,117,149,175,115, 19, 97,159,216, 21, 71, 68,238,213,187,118, 16,  6, 99, 81,187,193,210,189,
-237,255, 39, 61, 33,172,135,205,230,246,128,100,216,196,222,145,223, 68, 52,244,  9,117,193,133, 93,  5,248,115, 77,206,239,218,
-  2,204,  3,112,183,182,114,110, 48, 24,180, 20, 69,129, 36, 73,176,217,108,219, 57,129,231,126,255,253,119, 92,185,114,  5,176,
-113,219, 83, 86, 86, 70,177, 88, 44,  8,  4,  2,  0,112,173,161,190,  3,135,195,  1,135,195,193,233,139,103,188,254,215,191, 15,
-113,254,250, 49,180,143, 29,130, 18,149,  1,133, 10,  3, 74,203,129,232, 86,115, 17,211,125, 31,110, 60, 40, 67,243,102, 49, 44,
- 22, 79, 52,188, 42, 62,237, 67,100,171,179, 48,160, 36,149,110,164,207,113, 57,124, 97,255,237,212, 51,187,111,220,218,177,246,
-224,221,118,173, 58,169,205,198,  4,168, 84, 42,134, 32,  8,102,250,216,217,247,183,143,146, 83,171,134,222,160,217, 58,193,189,
-191,177,170, 15,241,241,241, 57,239,229,229,117,210, 44,142, 66,196, 98,241, 57,169, 84,154,134,138,133, 30,251,243,243,243, 35,
-213,106,117,123, 84, 44,206,122, 84, 82, 82,242,170,217,242,244,168,  6, 75,216,102,165, 82, 57,141,162,168,183,204,219, 27, 20,
- 69, 53,207,200,200,136,106,222,188,121,106, 88, 88,216,181,176,176,176,195, 97, 97, 97,  7,194,194,194, 14,116,237,218,245, 91,
-139,187,135, 23, 60,108,248,148, 22,121,201,132, 22,204, 34,107,163,249, 19, 86,161,  5,224,116,229,  9,104, 38, 62,255,150,105,
-242,100,184, 31, 56,  0, 78, 70,  6, 70, 14, 31, 46, 17, 10,133,171, 80,225,163,169,189,171,171,235,154,121,243,230,137,189,151,
- 44, 65,192,153, 51,200,140,143,135,145,195,185, 92,151,212,105, 52, 26,176,217,108,171, 37, 70, 36, 18,129,162, 40, 84,101,242,
-125,170,  0,154,112, 33,183, 48, 13, 60,132,130,  6,163, 58,162,236,148, 52,228,254, 92,223,120,101,131,240,187,106,110,248,124,
-159, 54,190,171, 66, 58, 36,169,  9,182,138,231, 46, 64, 86, 86, 54, 40,208, 14,141, 55,107,181, 90,133, 90,173, 70,243,230,205,
-189,174, 92,185,210, 48, 54, 54,214,211,124,252,210, 51, 62,152,182,  1,  1,  1,187,  2,  3,  3, 31,  6,  4,  4,236,  2,208,214,
-129,223,110, 78, 76, 76,  4,139,197,194,188,121,243, 80, 86, 86,  6,131,193,128,146,146, 18,100,101,101, 65,175,215, 35, 39, 39,
-  7,119,238,220,129, 94,175, 71,102,102, 38,116,186,218, 59, 36, 52, 77, 67, 34,145, 64,171, 81, 97,221,162, 57,248,108,214, 12,
- 40,238, 37, 35, 39,175, 16,238,110, 34, 76,157, 58,149,229,225,225, 65,211, 52, 29, 74, 81, 84,119,154,166,215,219,243,156,108,
-222,183,179,193,193,193, 49,203,151, 47,143,154,179,104, 61, 87,194, 86, 49,124,177,128,230,137,249, 12,175, 73, 27,140,154,187,
-138,251,221,202,175,211, 47, 92,184,144, 11,251,156,119,146,  0,206,182,104,209, 34, 34, 55, 55, 55, 54, 50, 50,178,177,119, 72,
-125, 62, 95, 26, 88,202,149,214, 83, 50, 58,109, 18, 17, 88,175,227,250,245,235, 83,206,157, 59,151,231,  8,167, 72, 36,106,178,
-109,219,182, 24, 63, 63,191, 24,142,139,139,160, 92,161,216,105, 42, 87,239, 98,185,123,  8, 72,137,251, 27,251,246,237, 75,222,
-179,103, 79,129, 35,156,225,225,225,145,139, 22, 45,138,110,218,180,105,180,127,131,134,124,151,192,224, 18, 65, 80, 72,137, 75,
-211, 88, 62,130, 66,123,174, 89,179,230,218,133, 11, 23,236,226,100,177, 88, 38,146, 36,193,225,112, 32, 20, 10,113,228,200, 17,
- 76, 30, 51,  4,193,129, 94,104, 28, 25,137,110,147,166, 97,207,158, 61,214, 57, 60, 44, 22,171,218, 22,125,235,146,169,  7, 91,
- 72,137,100,108,104,146,140, 13, 77,146, 91, 72,137,228,106,197,150,249,124, 85,215,216, 85, 27, 85, 51,220,104,135,216,250,227,
-244,233,211,203, 70,140, 24,193,235,213,171, 23,146,146,146, 48,106,212,168,179,123,247,238,  5,  0, 36, 37, 37, 97,250,244,233,
-103, 79,156, 56,129,  9, 19, 38,224,213, 87, 95,229, 37, 38, 38,174,129, 29,190,127, 76, 38, 19,182,108,217,  2,147,201,  4, 87,
- 87, 87,120,122,122,162, 79,159, 62, 72, 73, 73,153,240,227,143, 63,166,177, 56,156,119,123,191,213, 31,135, 14,236,197,157, 91,
- 41, 19,182, 46, 30,230,176, 83, 96,146, 36,209,107,248,240,226,226,232,104,217, 86,165,178,124,180,135,135, 48,178,160,192,243,
-212,174, 93,222,118,  8, 53,130,162, 40,171,184,178,136, 14,203,198,230,249,128, 45,138,  1, 91,220, 10, 55,238,114,141,220, 56,
- 92,229,181,194,237,154,252,103,113,120,228,168,126,115, 26,160,223,156,  6,232, 59,179,254, 72, 97, 61,108, 18,213,195,196, 94,
- 31,132,118, 13,107,229,  6,101,145,  1,241,223,100, 62,210,150, 96,  9,128, 59,246,148,115,154,166, 83,115,115,115,193,227,241,
- 80,175, 94,189,  8,  0,150,121,129,155,199,142, 29, 59,101,254,252,249, 51,  0,204, 55, 31,115,237,218,181,107,180, 74,165, 66,
- 70, 70,  6,  0, 92,169,193, 26,108, 93,101, 40, 83,102,242,235,  7, 52, 69,108,147,241,240,240,104,134, 92,153, 30,121, 50, 61,
- 54,173,123, 27,201,137, 11,113,229,207,247,240,168,160,  0, 46,254,239,128, 50,233, 98,236,232,212,  7, 92,191,126,157, 72, 76,
- 76, 36,104,154,134,209,104,100,202,148, 74,230,234,217,179,208, 36, 36, 16, 18,137,132,232,208,186,147,106,235,194, 67,151,246,
-173, 62,123,197, 80,238,112, 71,253, 89,240,217,253,251,247,219,238,218,181,171, 43,128,207,154, 54,109,122, 33, 43, 43,171,221,
-153, 51,103, 26,  7,  5,  5,173,170, 43,169,197, 45, 68,102,102,230, 19,155,217, 45,132,222, 44, 26,122,153,197, 92, 95,  0,211,
-241, 12,171,236, 29,192,233,151,120, 50,252, 33, 84, 90,109, 88, 89,104,217, 58, 10, 67,152,135,135,216,104, 52,228, 28, 59,118,
-204, 64,146, 36,132, 66, 33, 70,140, 26, 69,174, 91,187,182,227,144,182,109, 79,142,123,237,181,195, 39, 79,156,104, 17, 23, 23,
-  7,134, 97, 64,146, 36,126,251,237, 55,141, 86,171, 41,  9, 14, 14,118,183,167,210,176, 45, 64, 74,165,210, 42,180, 20, 10,  5,
-252,252,252,236, 30, 58, 84, 43,113,252,196,145,100, 57, 67, 77,202,234,117,119,165, 97,105,193,219,113,165, 52,197, 86, 80, 70,
- 40, 52, 12,202,180, 96, 39,145,158,113, 35,194,223, 49, 60,232, 30,119, 39, 33,237,124,137,150,210, 58,180, 90,162,168,168,104,
-206,192,129,  3, 75,164, 82, 41, 33,145, 72, 16, 24, 24, 72,246,237,219,183, 56, 59, 59,123,126, 93,159,136,151,151,215,255,186,
-118,237,122, 48, 55, 55,119, 64, 66, 66, 66,232,153, 51,103,  6,116,237,218,245,160,151,151,215,255,236,164,216, 57,123,246,108,
- 53,143,199, 67,155, 54,109, 80, 86, 86,  6,243, 42,159, 26, 55,123,134, 72,185, 92, 46, 54, 44,255,  2,159,205,154,  1, 89, 90,
- 18,110,156, 61,134,211,  5,  4,230, 46,250, 26, 92, 46,183, 78,190,190, 26,249,  8,155, 54, 13, 16,223,158, 62,106,112,222,167,
-179,102,137,175, 93,187,198,153,242,193,116, 38, 51, 95,  6, 94,175, 21, 44,116,158, 67, 94, 87,251,160,247, 27,221, 48,239,179,
-143,154,154,157,118,214,136, 38, 62,194,166, 49,  1,226,212,143,198, 13,185,255,193,  7, 31,184, 44, 93,186, 84,219,182,109, 91,
- 77, 97, 97,161,139,200,195, 51,146,237,230, 30,147,153, 95,224,218,182,109,219,  7,147, 38, 77, 42,117,148,115,238,220,185,194,
-163, 71,143,178,  7, 14, 28,104,146,203,229,174, 28, 23,151,230,  4, 95,208,250,177, 92,238, 54, 96,224,192,187,  3,  6, 12, 40,
- 55, 59, 44,181,155,243,243,207, 63, 23,222,185,115,135,221,182,109, 91, 99, 65, 65,129, 88,228,229, 29,203,114,247,108,245, 48,
-191, 80,210, 58, 46,238,222,148, 41, 83,212, 53,165,211, 86,164,136,197,226,220,246,237,219,227,155,111,190,193,119,223,125,135,
-158, 61,123, 34,229, 86, 10,122, 79,153,129,168,137,211,113,224,252, 69,228,230,230, 98,193,130,  5,136,141,141,  5,151,203,189,
- 83,101,121,156,144, 70, 92, 43,  0,113,173,  0,  4, 49, 33,141,176,236, 87,107,217,154,175,128,237,245, 85, 93,119,229,243,170,
- 45, 93, 45,164, 68,114, 77,243,176,106, 19, 91,  3,  6, 12,152,108,113,225, 48,122,244,232,179,171, 86,173,234, 48,122,116, 69,
- 71,187, 77,155, 54, 88,184,112, 97,135,185,115,231,158, 93,180,104, 17,186,117,235,134,176,176,176, 90, 23,190, 80, 20,  5,147,
-201,132, 33, 67,134,192,100, 50,225,241,227,199, 72, 79, 79,199,198,141, 27,193, 48,140,  0,  0,164,  1, 65,175,240,120, 60, 92,
-191,122,185,252,179,209,113, 63, 59, 96,201, 34,108, 59, 49, 42,149, 10,  3, 38, 78, 44,206,105,212, 72,182,190,184,184,124,140,
-135,135,176,254,163, 71,158, 98,189, 62, 16, 53,204, 75, 36,  8,  2, 52, 77, 91,133,149, 69,112, 85,222,204, 13,165, 93, 48,148,
-211,127,156,249, 41, 15,  0,208,105, 88,  0,250,206,172, 63, 82, 26, 46,252,190,227,208, 10,163,247,158,133,247,153,178, 60,106,
- 41,140, 72,117,192, 98,157,148,148,148,  4,119,119,119, 12, 28, 56,144, 79,146,228, 18, 75,127, 21, 21,190,179, 86, 90,184,248,
-124,254,138,247,222,123,143, 44, 45, 45,197,141, 27, 55,  0,224, 68,117,245, 18,195, 48,214,123, 87,201,  8, 80, 52, 15,231,174,
- 30,193,159,103,118,227, 97,238, 99, 60, 42,210,  2,108, 55,104,213, 57, 48,104,114,161, 47,189, 10,165, 78,104, 87,130,185, 92,
-238,227,166, 77,155, 50,173, 90,181, 98, 24,134,193,189,123,247, 76,153,143, 30,153, 46,127,251, 45,115,115,252,120, 66,156,158,
-206,117,113,113, 33, 26, 52,104,  0,129, 64, 64, 11,  4,130,146,191,177,241,126, 33,238, 22, 94,128, 91,136,231,105,213, 98,240,
-114, 34, 31, 79,174, 54,180, 58, 48,173,202, 97, 41, 24,137,203,224,221,107,214,185, 13, 28, 50, 76, 29, 27, 27,235, 17, 24, 24,
-  8,130, 32,240,246, 59,239, 16, 93, 19, 18,196,156,128,  0,120,181,108,105, 29,142, 56,126,236, 24,142, 28, 57,162, 62,244,251,
-190,192, 81, 99,198,188,  9, 96, 91, 13,137, 97,243,249,124,235,255,230,231,231,131,207,231, 91,231, 68, 40,149, 74,248,248,248,
- 32, 63, 63, 31,118,142,204,109,255,116,214,197, 89, 69,113,115, 26,196,137, 57,196, 97,117,  1, 40,134,  1,135,160,  0, 13,  3,
- 35,  5,232,140, 12, 94,169,207,242,252, 83, 99,242,136, 79,218,251,  0,192,118, 71,114, 79,167,211,157,186,118,237,218,120,154,
-166,119,  3, 32, 19, 18, 18,232,212,212,212,201,176,127,226,250,211,102,123,161,112,230,201,147, 39, 61,103,206,156, 41,143,143,
-143, 87,244,233,211,199,109,227,198,141,158,175,190,250,234,204,146,146,146, 29,246, 24,  2,179,178,178,182,101,103,103, 79,110,
-213,170, 21,100, 50, 25, 12,  6,  3,146,147,147, 17, 30, 30,142, 43, 87,174, 32, 34, 34,  2,151, 47, 95, 70,227,198,141, 65, 81,
- 20,180, 90, 45,104,154,166,106,171,204,101,197,143,129,146, 44,228, 37, 29, 70,250,205,100,156,204, 35,176,122,199, 65,212, 11,
-109, 80, 39, 63, 53, 17,190,194,104,169,143,215,159, 75,191,252,220, 55,243,212,111,216,187,101, 53,125,250,240,225, 40,158, 24,
-227, 59, 15,153,214, 95,111, 68,  8,  0, 94,187,184, 86,232,229,113,135, 18,134,162,224,100,106,205, 14, 22, 35,124,133,209,126,
-222, 94, 71,191, 90, 50, 95,124,239,200, 86,236,220,240, 13,179,231,167, 95, 99,181, 64, 92,116,116,116, 47,146, 36,221,  1,104,
-205,243,188,236, 10,109, 83, 21,231,241,131,  7, 91,104,129,184,253,251,247,247, 18, 10,133,254,  0,140,229,229,229,247,159,133,
-243, 68,124,124, 11, 75, 58,  9,130,240,  5, 96, 96, 24,230, 30, 28, 12,193, 51,104,208,160,133,211,167, 79,159, 69, 81,148,143,
- 77,239,156,181, 98,197, 10, 54, 77,211, 44,134, 97, 12, 36, 73, 26,142, 30, 61, 74,153, 76,166, 60,173, 86, 59,241, 89,106,145,
-254,253,251,227,226,197,139, 95,162, 98, 17,134,189,214,234, 39,230,105,153, 67,246,212,153, 63, 33, 33, 97,193,187,239,190,251,
-233,142, 29, 59,210, 87,173, 90,245,214,132,  9, 19,240,219,111,191,161, 81,163, 70,184,126,253, 58,230,204,153,  3,  0, 29,230,
-206,157,123, 96,243,230,205, 97,153,153,153, 43,236,176,104,192,100, 50,225,215, 95,127,197,219,111,191, 13, 31, 31, 31,  4,  4,
-  4,128, 32,136, 83, 99,198,140, 89, 11,  0, 44,130,197,  5,  0,157, 86,167,139,140,108,101,183,  5,151,203,229, 90,235,186,130,
-130,  2,235, 74,193,215,223,125,183,120,211,210,165,248, 89,163,193, 24, 15, 15, 97, 78, 80,144,244,192,189,123,227,110, 85, 84,
-206, 76, 77, 86,157,218, 68,150,189, 83, 26, 52,249,152,253,251,226,135,254,  0,122,118, 26, 22,128, 78,195,  2,208,170,175, 47,
- 65,178,  8,220,252,179,  4, 41,199,101,123,140, 74,156,130, 99,225,114, 82,151, 44, 89,114,160,115,231,206,111, 53,105,210,  4,
- 99,199,142,157,180,101,203, 22,174,209,104,252,  0,127,185,121,112, 35, 73,114,254,134, 13, 27,198,121,122,122, 34, 49, 49, 17,
-103,206,156, 57,  5, 32,171,186,122,  9,128,213,103, 86,189,224,  8,237,157, 76,149,176, 40,247, 28,206, 38,254,142, 70,177,211,
-224,226,255, 38, 60, 35, 23,193,144,246, 29,244, 37,127,194, 51,184, 15,114, 50,239,129,197,230,167,212, 54,  9,133, 97,152, 91,
- 57, 57, 57, 97, 97, 97, 97,196,195,135, 15, 77,  0, 24,138,162, 24, 67,199,142,198,168,165, 75, 57, 41,147, 38, 17,237,238,220,
- 97, 49,  4, 65, 39, 39, 39,  3,192,237,127,162, 21,183,184, 91, 72, 73, 73,169,206,221,130, 67,104,218,180,105,135, 51,103,206,
-240,181, 90, 45, 78,159, 62,141,214,173,173,107,187,254, 81,239,247,182, 90,228, 37,195,184, 42,142,109,124,194,162,245,196,139,
- 77, 19,156,198, 17, 17, 20,151,196,143,111,191,249,102,249,181,107,215,172,189, 62,237,165, 75, 80, 31, 57,  2,138,162,192, 48,
- 12,206, 36, 36,224,189, 97,195, 84, 28, 22,177,169,126,253, 80,134, 96,158,240,221,210,189,138,222,195,192,129,  3,  7, 90, 43,
-159,236,236,108,136, 68, 34,240,120, 60,208, 52, 13,147,201,  4, 22,139,  5, 55, 55, 55,152, 76,166,170, 76, 48,149, 57,141,148,
- 76, 61, 96,115,239,161,249,  1, 42,  3, 51,222,189, 62, 66,184, 46,214,194,233, 47, 33,240, 86, 44,  7,222,236, 34,230,196,138,
-215,242,104, 93,201,  0, 60,189,162,171,182, 37,255, 17,205,154, 53, 91,251,222,123,239,145,  0,208,189,123,119,178, 89,179,102,
-223,163,230, 80, 57, 53,114, 10,  4,  2, 62,  0, 28, 60,120, 80,150,158,158,222,243,224,193,131, 50,219,227,118,114,110, 92,190,
-124, 57,132, 66, 33, 76, 38, 19,244,122,189,117,126,150,237,167,193, 96,128,183,183, 55, 14, 29, 58,  4,138,162, 14,213,150,206,
-224,144, 80, 16, 62, 13,177,237,224, 73,156, 41,230,214, 69,100, 89, 57, 27,250,139, 26,251,123,123, 29,251,106,241,  2, 31,249,
-221,100,228,228,228, 48, 71,143, 28,186,160,  5,114, 21,101,248,172, 84,141,198, 26, 61,  4,173,195,144,117,108,195, 39,204,220,
- 78, 48,162,234, 85,131, 86,206, 40,127, 81,227, 64, 31,175,163, 95,127,181, 88, 92,122, 55, 25,249,  5,  5,248,227,208,193,107,
- 90,192, 50,220, 56,146,166,233, 24,154,166, 99,  0,140,172, 65,188, 56,196, 89, 94, 94,222,180,188,188,188,233,243,228,100, 24,
-166, 41,195, 48,118,115,218,206,137, 90,185,114,101, 90,126,126,254,123, 69, 69, 69, 61, 44,155, 92, 46,239,174, 82,169,186,148,
-151,151,119,212,172, 12,117, 43, 47, 47,247, 85,169, 84, 82,173, 86,251, 10,128,100,  7,222,121, 43,108,189, 78,231,231,231,207,
-203,207,207, 39,106, 75, 39,107, 98, 26,241,203,215, 31,253,190, 97,195,  6,233, 51,242, 63,145,206,226,226,226,221, 59,118,236,
-104,222,160, 65,131,176,145, 35, 71, 98,253,250,245, 88,181,106,149, 14,  0, 54,111,222,172,179,177,100,  5,103,102,102,182,170,
-102,216,176,187,141,181,100,251,235,175,191,206,156, 57,115,  6,111,191,253,182,213,145,232, 15, 63,252,  0,147,201,164,236,214,
-173, 27, 13,  0, 26,109,185,146,161, 25,232, 13,213,142,191, 63,149,159, 60, 30,239, 13, 91,127,129, 22,103,204, 60, 30, 15, 12,
-195,160,113,135, 14,197,165,177,177,178, 45, 10, 69,249,188,166, 77, 37,227, 34, 35, 71, 54,  1,134, 85,197, 73, 16,196, 19, 86,
-157,202,155,  3,150, 44,219,116, 22,105,242, 48,246,247,197, 15,143, 88, 44, 91,  2, 87, 54,180,101, 38,236, 91,250,240,177,246,
- 49,126,168, 78,252,212,116,239, 50,153,108,202,210,165, 75,117, 30, 30, 30,232,223,191, 63, 22, 45, 90, 52,166, 67,135, 14, 10,
- 95, 95,223,139,141, 26, 53,186, 57,120,240,224,252,228,228,228, 41, 93,187,118, 69, 70, 70,  6,190,254,250,235, 82,185, 92, 62,
-180, 38, 78,130, 32,172,150,188,190,189,187,203,214,125,255, 13,221,173,243,100,  8, 93, 36, 48,114,130, 33, 83, 25, 33, 87, 51,
-208,243,227,192,227,242,209,163,109, 52, 46, 30,221, 90, 78,233,213,219,106,123,231, 85, 42,213,158, 17, 35, 70, 40,185, 92, 46,
-244,122, 61,195,225,112,192,175,152,119, 76,115,122,246, 52,180, 75, 77, 53, 81, 12, 67, 19,  4,129, 15, 63,252, 80, 45,151,203,
-119,212,165, 28, 57,  0, 91,206,231,229,110,161,123,165,246,231,121,184,133,120, 17,247,254, 50, 99, 99, 21,219, 95, 22, 45,203,
-146, 74,203, 39, 65,208, 20, 69,209,168,223,160,190, 56,243, 97,214,234, 65,131,  6,142,238,213,171,183,176,119,239,222,130,232,
-180,138,222,232,193,131,  7,177,119,239,222,242, 63,255,252, 83,201,231,176, 54,  7,215, 11,246,163, 40, 26,  4, 65,215,168,134,
-197, 98,241,  7,179,103,207,118, 81, 40, 20, 88,181,106, 21,221,188,121,115, 82, 36, 18,193, 96, 48, 96,243,230,205,198,232,232,
-104, 14, 73,146, 80, 40, 20, 32, 73,242,142,157, 55,120, 67,145,149,219, 99,109,215,126,123, 91,189, 63,202, 43,170,107, 59,143,
- 46,193,129, 48,182,100,144,151,253, 16,233, 39,254,148,223, 58,250,109,  9,180,133,253, 80,123,120,160,170, 26,130, 47,254,252,
-243, 79,223, 41, 83,166, 48, 90,173,150,200,202,202, 98, 22, 47, 94,236, 59,118,236,216, 47,242,242,242,254, 87,199,135, 66,148,
-150,150,130, 32,  8,218, 92,114, 30,194, 56,  0,  0, 32,  0, 73, 68, 65, 84,145, 88,122,253,142,140,203,165,108,219,182,109,255,
- 59,239,188,211,183, 91,183,110, 72, 75, 75,179, 14, 17,218, 10, 45,203,234,195, 37, 75,150,148,  2,248,180, 54, 82, 14,135,131,
- 85,219,118,163, 84, 94, 12, 63,191,  0,  8, 92, 92, 80,215, 21,150, 60,146,156,183,108,193,231,190,197,183, 47, 18, 41, 23, 78,
-210,187,110, 20, 22,153, 40,166,106,143,255,101,121,140, 89,253,215,220,155, 33, 89,243,150, 45,158,239,102, 25,214,220,113, 53,
- 95, 73, 80,204,148,103, 42, 34, 47, 11,231,223,140,128,128,  0,228,231,231, 19,  1,  1,  1,140,121,142, 22, 83,131,208,122,242,
-  5,175, 24, 46, 35,106, 26, 54,172, 43,255,131,  7, 15, 22,183,108,217,242,163,140,140,140, 93, 81, 81, 81, 19,  0,212,211,233,
-116,165,115,231,206,253,106,243,230,205,163,237,177,100,  1,192,111,191,253,246,237,168, 81,163,142,188,249,230,155,159,208, 52,
-221,204,166, 97,127,224,235,235,107, 29,194,125, 92, 88, 48,107,252,232, 33,179, 84, 42,185,221,126,238, 92, 93, 93,199,205,157,
- 59, 87,160, 86,171,177,102,205, 26, 58, 58, 58,154,180,116,138,126,250,233, 39, 83, 68, 68,  4,123,224,228,201,197, 43, 11, 10,
-176, 48, 49, 81, 61, 43, 38,166,249,150,244,244, 87, 64,211,219,171,179,234, 84,101,201,178, 76,187,168, 35,242,204, 98,235,  7,
-  0, 61,219, 13,242,199,254,229, 15, 33,207,212,127,  5, 19,238,193,142,176, 64, 85, 32,103,207,158, 61, 61, 10, 11, 11,247,127,
-254,249,231,110,175,188,242, 10, 98, 98, 98, 56,174,174,174,113, 22,119, 49, 10,133,  2,199,143, 31,199,250,245,235,245,183,110,
-221,122,167,166,225, 42,138,162,138, 34, 34, 34, 44,249,192, 16,  4, 81,162,212, 17,110, 59,155,196,185,142, 28,191,139, 56,123,
-249, 60,242, 12, 52,116, 70, 26,245, 27,180, 64,151,158, 43,113,224,240, 77, 42, 47, 51, 53,213,168,145,111,178, 35,189,247,238,
-222,189,187,111,193,130,  5,131, 62,249,228, 19,151,226,226, 98, 74,167,211,209,187,119,239,102,141, 28, 57,146, 98,216,108,154,
-203,102,227,131, 15, 62,208,148,150,150,254, 14,252,173,  1,166, 95,136,187,133, 23,224, 22,226,185, 89,179,108, 63,255, 43,168,
-178,132,210, 44,242,220,250, 13,235,222,248,237,215, 29,254, 44, 22,233,127,239,254,253,203,111,245, 27,144,123,236,216, 49, 79,
-174,155, 91,107,  0,180,126,194,132, 11,  6,157, 70, 22,191,127,127, 72,253,250,161,177,230,160,210, 12,205, 34,207,213,244,135,
- 42,149, 74,157,152,152, 88,254,233,167,159, 18,217,217,217,191,248,249,249, 13, 62,124,248,176,107,191,126,253, 52,105,105,105,
-123,252,253,253,251,118,237,218, 85,252,209, 71, 31,233, 84, 42,149, 35,129, 71, 83,153,199,242, 38,151, 62, 95,241,238,165,229,
-235, 94,  3,155,213, 30, 58, 14, 64, 27,207,193, 80,118, 12,192, 47,112,192,223,145, 45, 68, 34, 81,172, 80, 40,196,181,107,215,
-228,113,113,113,122,173, 86,203, 93,180,104,145,151, 72, 36,138,173,107,198, 51, 12,195,200,229,114,208, 52,205,  6, 64,152, 63,
- 65, 59,190, 22,255,127,111,189,245,214,254,157, 59,119,190,222,187,119,111,132,133,133,193,104, 52, 34, 34, 34,  2,122,189, 30,
-225,225,225,208,233,116,248,242,203, 47,161, 80, 40,102,160,134,152,103,  4, 65,192,100, 50, 89, 39,219,  6,  6,133, 84,248,233,
-121,  6, 55, 22, 34, 14, 25,118, 39,126, 11,138, 74,138,233,157,215, 11, 11,203, 13, 84,143,187,143,203,111, 85,190,174,156,130,
-186,235,200,169,185,  0,160,163,107,142, 56, 47,226, 33, 44,253,208, 15, 40, 44, 42,198,111, 87,243, 75,213,  6,186,103,122, 21,
-156, 14,165,243, 37,225,108,241,101, 26,  6, 76,181,255,218,103,129,189,130,170, 58, 92, 43,  0,113, 69,184,133,193,134, 45, 85,
-250,200,122, 70,254,253, 25, 25, 25,251,  1, 32, 53, 53, 53,123,200,144, 33,179, 30, 62,124,184,  0,192, 31,153,153,153, 27, 28,
- 33,218,178,101, 75,  6,128, 81, 53, 93,179, 99,197,168,125,  0,246, 57,194, 91, 86, 86,166, 77, 78, 78,214,126,244,209, 71, 68,
-118,118,246, 97,127,127,255,215,143, 28, 57, 34,236,215,175,159, 46, 37, 37,229, 68, 64, 64, 64,167,238,221,187,187,254,145,148,
-148, 91,126,239, 94,124,252,195,135, 65, 70,154,142,175,169,124, 62,103,145,245,132,216,218,183,240,225,178,253,203, 30,118,167,
-117,216,163,151,227,  2,128,156,103,224, 60,115,238,220,185,168, 97,195,134,237,236,211,167, 79,187,168,168, 40,212,171, 87, 15,
-233,233,233,120,252,248, 49,110,220,184,129,131,  7, 15, 30,212,106,181,181,  6,212,150,201,100, 79,135, 39, 18,120,  6,108, 93,
- 51,239,224,229,179,173, 35, 58,246, 30,225, 18, 19, 64, 67,111, 96,144,253,232, 30,190,252,108, 83,121,254,163,140, 84,131,201,
-240, 14,236, 92,168,163,209,104, 54,126,247,221,119,156,248,248,248,222,171, 87,175, 22,135,132,132,176,184, 92, 46,  9,128,185,
-114,229, 10, 51,117,234, 84,117,113,113,241, 33,165, 82,185,241,111,110,163,207,220,191,127,191,  5,139,197,122,174,238, 22,158,
-193, 45,132, 19,207, 19, 13, 26,  4, 69, 53, 12,  9,152, 16, 86, 47,104,114,131,144,224,225, 85, 77,114, 15,243,240, 16, 55,  8,
- 13, 28, 23, 86, 47,104,114,195,144,128,  9, 13, 26,  4, 69,217, 97, 90, 12,147, 72, 36,135,165, 82,105,115,  0,112,115,115,235,
-235,238,238,126,203,205,205,173,175,185, 23,216,215,213,213,245,118,116,116,244,216,191,209, 92, 89, 35,103, 68, 68,196, 16,149,
- 74, 53, 41, 34, 34, 98,136,101,255,222,189,123,214,253,186,112,  6,  7,  7,119,187,114,229,202,255, 86,172, 88,209,191, 81,163,
- 70,125, 23, 47, 94,220,255,247,223,127,255, 95, 80, 80,208, 43,117,224,228,  3,248,153,195,225, 20,242,120,188, 34, 14,135, 83,
-104,217,216,108,118, 33,139,197, 42,  4,176,161, 26,107, 89,119,155, 94,206, 89, 63, 63,191, 76, 63, 63,191, 76,127,127,255, 76,
-127,127,255, 76,169, 84,250,212,230,237,237,125,214,222,252,140,244,119,237, 16, 87, 79,124,174,169,212,245,108, 19, 63, 81,228,
-243,120, 70,145,254,174, 29, 90,215,115, 59,215, 84, 42, 78,252,255,198,217,220, 31, 12,179, 62,146, 97,214, 71, 50,205,253,193,
-212,182,255, 60,205,254, 82,169,148,145, 74,165,243, 94,212, 80, 66, 53,252,127,123,121,127,142,156, 97, 98,177,120, 71,189,122,
-245, 44,117,221,155, 18,137,228,148,171,171,235,155,230,186,238, 77,145, 72,148, 16, 29, 29, 61,162, 54, 78, 79, 79,207, 43,190,
-190,190,  5,230, 45,223,207,207, 47,223,207,207, 47,223,215,215, 55,207,215,215, 55,207,199,199, 39,215,178,185,187,187, 95,172,
-227,189,251,  2,104,  3,224, 21,  0,146,231,152,159, 13,  0,140, 55,215, 65, 75,  1,140,  5,208,236, 57, 60, 35,130,227,226, 57,
-145,239, 30,124,142,227,234, 83,198,113,245, 41,227,187,  5,157,171, 33,  4,143, 61,156,141, 61, 61, 61, 23, 73, 36,146,223,197,
- 98,113,162, 88, 44,222,239,237,237,189, 24, 64,227,127,232, 93,114,  5,176, 25, 21,254,153,254, 64,197, 80,248,126, 84, 44, 42,
-  8,249, 23,190,243,255,159, 49,238,159,250,227,238, 78, 78, 39,167,147,211,201,233,228,116,114,190,132,156,164, 51, 63,157, 66,
-203, 65,161, 85,121,  3, 80,131,103,120, 39,156,112,194,  9, 39,156,248,127, 12,218,153,  5, 78, 56,136, 42,135,150,137, 26, 84,
-169, 35,190,166,234,162,108,143, 59, 57,157,156, 78, 78, 39,167,147,211,201,233,228,252,127,199,233,196,115,132,211,172,234,228,
-116,114, 58, 57,157,156, 78, 78, 39,167,147,243,191, 14,231,208,161, 19, 78, 56,225,132, 19, 78, 56,225,196, 11,194, 70, 27,193,
-245,196, 16,162, 83,104, 57, 14, 18,192, 36,  0,  3,  0, 52, 68, 69, 52,251,221,  0,214,162,110, 99,250, 18,  0,179,  0,180, 71,
-197,234,156,  7,  0, 18, 81,177, 58, 71,229,204,238,170,225,237,237, 61,155,195,225,184,  3, 21,161, 77, 44,159,182,223, 41,138,
- 42, 85, 42,149,139, 95, 80, 18, 88,176,211,131,178, 37,173,182,105,179,253, 52, 26,141, 47, 50,157, 78,252, 59, 17,225,233,233,
-249,179, 76, 38, 27, 10,155, 32,203, 78, 56,241, 95,128,143,143,207,  4,131,193, 48,151,203,229, 46,122,252,248,241,186,255, 71,
-183,254,148,200,122, 66,104,197,199,199, 39,  0, 64,159, 62,125, 58,  3,128,187,187,251,121,146, 36, 27, 56,242, 15, 52, 77, 63,
- 40, 45, 45,173,214,129,154,187,187,251,121, 22,139,245, 20,167,209,104, 20,179,217,236,178,170,126, 99, 50,153,114,148, 74,229,
- 43,255,146, 76, 36,  0,196,123,120,120,104, 23, 44, 88,176,182, 75,151, 46,193,121,121,121,166,153, 51,103,118,186,126,253,122,
-111,  0,111, 56, 40,182,218, 18,  4,177,181,121,243,230,251,134, 15, 31,190, 51, 46, 46,142, 87, 82, 82, 34,222,189,123,119,224,
-182,109,219,146,105,154, 30,138, 26,  2,173,254,127,  6,135,195,113,207,201,201, 17,  3, 21,161, 73,204,194, 10, 70,163, 17, 70,
-163, 17,106,181, 26,177,177,177,207,253,127,253,253,253, 91, 16,  4,177,218,213,213,245, 21,149, 74,117, 25,192,228,252,252,252,
-235,142,164,213,100, 50,129, 97, 24,107, 58,163,162,162,156, 15,212, 49,140,225,241,120, 61,195,195,195, 91,235,116, 58,249,131,
-  7, 15, 46, 81, 20,245, 57,158, 95,140, 54, 55,  0,159,243,249,252,184,134, 13, 27,  6,103,100,100,100, 27, 12,134, 36, 84,  4,
- 67, 86, 60, 15,145,213,185,115,231,179,107,214,172,241,154, 56,113,226,217,196,196,196, 14, 78,177,229,196, 63,133,224,224, 96,
-119,181, 90,189,  9, 64, 11, 14,135,227, 47, 16,  8,224,226,226, 82,192,231,243,175,185,184,184,140, 62,119,238, 92,169,163,156,
- 20, 69,125,158,153,153,233,223,166, 77,155,229,190,190,190, 95, 22, 23, 23,107, 13,  6,195,  9,185, 92, 62,  3,128,178,166,223,
- 86,214, 34, 47,153,200,178,253,132, 69,116,177,205, 55,198,  0,232,242,132,  2, 99,179,131, 30, 61,122,228, 43, 16,  8, 64,211,
-180,181, 49,171,188, 89,142,235,245,122,196,196,196, 24,106,105,112,130,179,179,179,125,121, 60,158,245,152, 94,175, 71, 96, 96,
- 32,157,147,147,227,107, 14,123, 96,133, 78,167, 67, 80, 80,208,191, 41,230,209, 36, 79, 79, 79, 69, 86, 86,118,172, 86,103,152,
- 63,118,202,167,179,135, 14,120,205,227,252,249,243,244, 27,111,188,161, 75, 72, 72,152,132,138,192,169,118, 85,230,  4, 65,108,
-155, 57,115,230,151,  2,161,196,235,228,249, 84,221,182,221,135,114,155, 71,212, 39,102,204,152,193,154, 58,117,234,153, 22, 45,
- 90,252, 76,211,116, 75, 56, 96,217,242,240,240, 56,194,231,243, 67,205,249,151, 37,151,203, 95,255, 23,190,144,108, 60,237, 60,
-182,170, 99,181,162,164,164,  4, 26,141,230,169, 45, 42, 42,202,222, 88,153, 14,165,155,195,225,236, 95,178,100, 73, 96, 65,126,
- 62,190, 89,185,178, 13, 42, 44,153,109,236,249,113, 81, 81,209, 83,233,140,140,140,132, 19, 14, 97,214,151, 95,126,185,228,221,
-119,223,  5, 69, 81,208,104, 52,  1,119,239,222,141,158, 59,119,238, 59,247,238,221,107, 13,224,254,179,118,198,195,195,195,211,
-166, 77,155,230,217,186,117,107,152,163, 84,  4, 36, 38, 38,182,217,188,121,243,123, 89, 89, 89,145,  0, 30, 63,203, 31,120,122,
-122,254,252,195, 15, 63,120,  9,133, 66, 28, 56,112,192,171, 91,183,110,137, 87,175, 94,237,248, 12, 98,139,244,242,242,154, 10,
-224, 85,154,166,121,  0,146,228,114,249, 66, 56,238,213, 93,234,234,234,186,135, 36,201,250,192, 95,222,232, 73,146,244, 38,  8,
-162,216,114,140, 32,  8, 95,154,166, 47,200,100,178,118,206,215,241,229,134,151,151,215,152,194,194,194, 53,124, 62,159,235,225,
-225,  1,161, 80,  8, 54,155, 13, 54,155, 93,143,207,231,215,227,243,249,189,186,118,237, 58,249,212,169, 83, 53,122,216,111,219,
-220,111, 36, 72, 98, 62,139, 32, 89,  0, 64,114, 68, 18, 55, 55, 55,204,159, 63, 95,212,183,111, 95, 17,  0,156, 61,123,118,248,
-136, 17, 35,186,229,228,228,196, 84, 39,182,170,210, 34, 47, 17, 54,214,212,224,193,172, 30, 19,158, 40,185, 36,  9, 30,143,135,
-139, 23, 47,194, 30,103,229,150, 16,  9, 53,214,  6,102, 15,227,215,175,255,101,  0,176, 52, 52, 60, 30, 15,231,206, 61,233, 84,
-190,109,219,182,214,194,254,119, 97, 64, 84,133,147,199, 93,239, 87,164,107,224,234, 10,239,218,187,222,143, 68,167,175, 31, 97,
-192,212,121,131,203,181,134, 86,  0,212,165,114,185,252,242,222,189,121,205, 35, 34,184, 63,255,252,115,235,192,192,192,  1, 14,
-  8,173, 89, 45, 91,182,220,195,114,113,243, 30, 62, 98,228,240,209,108,210,240,222,248,143, 22,101,231, 23,171,199,141, 27,183,
-247,192,129,  3,195,151, 45, 91,118,251,227,143, 63,158,  5, 96,142,189,233, 23,  8,  4,161,119,238,220,  9,167, 40, 10, 81, 81,
- 81,255,198, 48,  6,205, 81,225,124,239, 93,  0,191,154,143, 13, 65,133,231,254, 22,  0,174, 57, 66,102,177, 96, 85,181, 61,111,
-  4,  6,  6, 70, 14, 27, 54,204, 91, 86, 92,140,111, 86,174,180, 28,126,  5,181, 12, 35, 90,202,143, 94,175, 71,255,254,253,135,
- 81, 20,197,182,136, 64,157, 78,167, 87, 40, 20, 90,252, 53,177,244, 49,128,215,236, 72, 78,  3,145, 72,244, 21,128, 22, 26,141,
- 38, 16,  0, 68, 34, 81, 46, 77,211,251,212,106,245, 28,252, 21,192,215,225, 14, 46,128,104, 84, 31, 10,138, 89,178,100, 73,198,
-167,159,126,122,255, 31,224, 12,245,243,243, 91, 60,112,224, 64, 28, 58,116,  8,127,252,241,135,209,197,197,133, 61, 98,196,  8,
- 98,242,228,201, 30,211,166, 77,235,  5,224,187,103,124,204,189,190,252,242, 75,207, 38, 77,154, 96,247,238,221,184,113,227,134,
- 38, 60, 60,220,165, 75,151, 46, 96,179,217,158,179,103,207,126,  3,192,214,103,249,  3,153, 76,182,240,163,143, 62,218,246,235,
-175,191,138, 31, 60,120,128,213,171, 87,123, 15, 30, 60, 56, 33, 43, 43,171,179,  3, 98,139, 15, 96, 42,128,174, 44, 22,171,227,
-136, 17, 35, 76, 83,166, 76,225,144, 36,105, 92,185,114,165,207,230,205,155,  7,115, 56,156, 22, 37, 37, 37,246,116,210, 72,  0,
-243, 71,143, 30, 61,234,212,169, 83, 30,151, 46, 93,226,121,121,121,129,162, 40,171,165,152,166,105, 95,203, 59,107, 50,153, 16,
- 25, 25, 25,100,243,123,151,151, 85,104,144, 36,105,160,105,154,  3, 64,  0, 64, 87,219,254,127, 73,100,121,122,122, 78,148,201,
-100,107,253,253,253,225,231,231,247, 84, 91,171,211,233, 32, 16,  8,184,254,254,254, 63,244,237,219,151,179,127,255,254,106,135,
-  0,  9, 22,241,249,129, 29, 11,  2, 61, 61,196,  0,128,111,215, 31, 45,  7,128,223,127,255, 29,121,121,121,240,240,240, 64, 76,
- 76, 12,107,193,130,  5,210, 25, 51,102,124, 35,151,203, 71, 87,199, 85, 89,139,188,100, 22,173,141, 85,237,215, 56, 71,139, 97,
- 24,107,156, 60, 59, 95,218,202,135,142, 87,226, 35,244,122, 61, 42, 91,180, 44,133,151,195,225, 84, 54, 63,130, 32,  8,166, 38,
-206, 42, 48, 66, 36, 18,197,170,213,234,239, 29,232,221, 90, 57,119,189, 31,137,109,252,153, 67, 44,145, 72,123,125, 84,241,185,
- 13,192,249,135,163, 87,175,233,220, 57,112,234,103,171,230,105, 74,242,138,103, 15,123, 51, 52,220,223,203, 69, 84, 90,164,240,
-108,220,184, 71, 37,139, 76,109,233,236, 52,124,248,240,237,127, 94,204, 36,  4,  2, 46,151,205, 98,113, 58, 52,141,240, 10,118,
- 99,185,137,  1,183,236,251, 25,231, 71,142, 28,217,244,227,143, 63,238,232,  0, 39,204, 13, 46,126,250,233, 39, 16,  4, 65, 58,
-114,239,207, 17,199,107, 18, 89, 12,195,128, 32,136, 95,108, 26,149, 95,204,199,174,218,136, 45,118, 77,249,105,177,166, 90, 68,
-213,136, 17, 35,134,153, 76, 38,182, 77, 37, 81, 89,192, 84, 37, 98,236,186,119,169, 84,250, 39,128,215,  8,130,128, 94,171,213,
-127,245,245,215,182,167,175, 84, 18, 89,199,171, 43, 75, 70,163, 17, 20, 69,177,175, 94,189,202,177,121,215, 57,  0, 68,  0,188,
- 25,134,  1, 73,146, 55,237,200,207, 72,161, 80,120,254,224,193,131,146, 87, 94,121,133,224,241,120, 48,153, 76, 72, 73, 73,  9,
- 94,182,108,217,248,227,199,143,191,161, 86,171,163,240,116,240,116,123,158, 81,116, 98, 98,162, 58, 44, 44,172, 74,225,168, 84,
- 42,217, 17, 17, 17,157,171, 17, 69, 47,154, 51,167,176,176,240,237,215, 94,123,109, 66, 65, 65, 65,154,201,100,250,  4, 64,140,
-183,183,247,213,126,253,250,193,197,197,165,171, 70,163,249,238, 89,222,121, 95, 95,223,190,237,218,181,195,234,213,171,177,108,
-217,178,238,  0, 78,  0,232,166, 84, 42,143,191,245,214, 91,112,119,119,127,187,180,180,116,235, 51,148,163,136, 78,157, 58,253,
- 48,127,254,124,241,161, 67,135, 16, 30, 30,142,178,178, 50,124,248,225,135,190, 95,124,241,197,233,210,210,210, 46, 54,229,162,
- 58,206, 40, 62,159,191,245,215, 95,127,117, 13, 11, 11, 11,227,114,185,100, 88, 88, 24,100, 50, 25,180, 90, 45,127,209,162, 69,
- 77, 93, 92, 92,174,127,247,221,119, 91,  1,244,171, 37,157, 36,128,133, 27, 54,108,152, 48,110,220, 56,247, 97,195,134, 81,122,
-189, 30, 59,119,238,  4,139,197,  2,135,195,129, 80, 40,180,  6,175,230,114,185,104,220,248, 41, 39,233,  7,106,184, 95,  5, 42,
-230,161,186,195,177, 97,215,227, 53,240, 89,135, 62, 56, 28, 14,  4,  2,  1,  4,  2,  1,248,124, 62,238,220,185,243,153, 64, 32,
- 88, 73, 16,132,201, 30, 78,226, 47,117, 17, 11,224, 82,109,251,120,122,106,200,223, 89,127, 90, 16, 68, 16,196,183,  0,186, 86,
- 52,187,100,130,183,183,247,  7,133,133,133,143,236,229,148, 74,165, 94, 37, 37, 37,223, 73,165, 82,248,249,249, 89,219,239,192,
-192, 64, 24,141, 70, 20, 22, 22,130, 97, 24,148,150,150, 66, 40, 20, 34, 32, 32,224,187,113,227,198,237,222,184,113, 99, 73,149,
-156, 52,150,189, 53,120,238,231, 44, 22,139,  4,  0, 22,219,213,117,218,167, 64,104,104, 40, 58,116,232,  0,173, 86, 11,133, 66,
-129,232,232,104, 54, 65, 16,195,  9,130,144, 48, 12,179, 14,192,201,255,160,161,176,218,201,240, 95, 86, 30, 23,181, 68,139,231,
-114,185,118,  9, 45,243,245,181, 89, 80, 72,163,209,  8, 46,151,251,132, 69,130, 32,  8, 80, 20,245,196,113,139,208,170,139, 80,
-159, 60,121, 50,253,195, 15, 63, 76,144,203,229,235, 81,199,161,132,225,195,135, 63, 53,223, 99,198,140, 25, 57, 69, 69, 69, 76,
-255, 30,177,162,180,195,121,249, 13, 61, 92, 93,124,196,226,250,  2, 15, 79,247,146,146,146, 11,230,202,196, 94, 52,106,217,178,
-165,203,182,189,137, 57, 99,167, 47, 89,240, 74,152,151,164, 89,144,183,135,191,155, 11,207,149, 36,212,  2,147, 49,199,211,211,
- 51,220,209,116, 91,234,  5,161, 80,  8,146, 36,255, 77, 22, 45,182, 69,100,201,100, 50, 28, 58,116,  8,189,123,247,190,106, 17,
- 33, 74,165, 18,249,249,249,144, 74,165, 87,205,150,143, 90,135, 17,105,154,134,193, 96,128,193, 96,176, 10, 24,155,119,200, 42,
- 96, 44,215,178, 88,172,155,117, 76,251,  2, 15, 15,143, 78, 93,187,118,229,237,216,185,147,199, 48,140, 26, 21, 49,212, 84, 12,
- 83, 77,128,236, 74, 48,153, 76, 86, 43, 27,135,195, 65, 86, 86,150,181,225,178,196,150, 20,  8,  4,246,153, 50,248,252,143,126,
-251,237, 55, 73,235,214,173,137,146,146, 18,208, 52,109,173, 36,215,174, 93, 43, 24, 48, 96, 64, 96,114,114,242,108,157, 78,247,
-101, 29,238,149,168, 78, 16,  1,128, 68, 34, 49,193, 62,143,217,181,114,154, 76, 38,162,125,251,246, 31, 23, 23, 23, 55,213,104,
- 52,139,236,201, 70,  0,  7,114,114,114,108, 27,246,235,105,105,105,154, 65,131,  6,185,212,175, 95, 63, 46, 53, 53,245,153, 94,
-210,136,136,136,182, 28, 14,  7, 73, 73, 73, 58,  0,150,158,117,194,141, 27, 55,116,253,250,245,227,  7,  7,  7,183, 45, 45,181,
-123,202, 74, 68,100,100,228, 49, 95, 95, 95, 23, 75, 29,234,227,227,195,217,184,113,163, 56, 55, 55, 23,  6,131,  1,179,102,205,
- 66,159, 62,125,224,237,237,141, 25, 51,102,248, 45, 95,190,252,103,149, 74,213,178, 38,163, 53,143,199,219,126,247,238,221,112,
-169, 84,234,114,241,226, 69, 52,107,214, 12,197,197,197, 40, 40, 40,128, 74,165, 66, 65, 65,  1, 70,143, 30,237,251,205, 55,223,
-  4,216, 97,201,178,138,172,141, 27, 55,150,238,217,179,135,181,105,211, 38, 49,135,195,177, 10, 45, 54,155,109, 21, 90,150,216,
-138,117, 24,105, 40, 53,139, 54,119,133, 66,241, 44,243,220,248,  0,120,182, 34,139,207,231,131,207,231, 67, 32, 16, 60, 83, 92,
-214,151,  4,129,  4, 65,164,114,185, 92,190, 80, 40,228,146, 36,  9, 62,159,223,195,211,211,243, 86, 76, 76, 76,204,177, 99,199,
- 50,237, 33,209,106,181,219,249,124, 62,199,215,215, 23,  0, 16, 30, 30,142,102,205,154, 65,173, 86,211, 10,133,  2,238,238,238,
-228,163, 71,143,160,209,104,144,159,159,143,144,144, 16, 14, 73,146,219, 81, 49, 15,249, 41,156,191, 90,176, 30,192,122,203,190,
-183,183,119,161,173,165, 83, 32, 16, 32, 48, 48, 16,185,185,185, 16,139,197,172, 47,190,248,162,223,206,157, 59,223, 57,127,254,
-252,112,  0, 63,217, 80,125,249, 18,207,209,178,136, 44,219,207,191,132, 86,159, 62,125,230,197,199,199,119,174,170, 23,206,225,
-112,158,219, 92, 23,139,160,146, 72, 36,149,173, 86,160,105,186, 58,139,150,195,255, 35, 16,  8, 92, 38, 78,156, 88,182,110,221,
- 58,135,197,214,192,213,105, 86, 43,214, 83,221,200,168,168,243,179,103,207,238,123,234,212,169,220, 87,194,234,179, 69,121,143,
- 84,  2,137,187, 59,130,234,245, 30,241,118,191, 27,168, 88,125,104, 47,238,150,149,149,185, 52, 12, 18,234, 73, 82, 75,212,227,
-179,197, 82, 17,151,239,239,225, 17,200,213,235,138, 36, 30, 30, 60,157, 78, 87,138, 26,130, 64,  3,128,159,159,223, 81, 23, 23,
-151, 16,203,190,135,135,135, 27,195, 48, 16, 10,133,144, 74,165,174, 44, 22, 43,221,166,112, 61, 42, 44, 44,236, 81, 91,194,220,
-221,221,143,242,249,252, 16,146, 36, 65, 16,  4, 88, 44, 22, 72,146,  4, 73,146,214,239, 44, 22, 11,  4, 65,160,188,188,252, 81,
-102,102,102, 15, 59,238,215,  4,160,  5, 65, 16, 87, 15, 29, 58,132,184,184, 56, 28, 62,124, 24, 61,123,246,132, 66,161, 64, 74,
- 74, 10, 58,117,234,  4, 84, 12, 41,218,  5,219,201,239,150, 78,193,157, 59,119,172,194,197,118, 19,139,197,207, 98, 98, 63, 59,
-112,224, 64,252,240,195, 15,140,185, 51, 33, 34,  8,162,153,155,155,219,157,219,183,111,219, 53, 15,134, 97, 24, 24, 12,127, 93,
-106,105,188,204,243, 33, 28, 10, 14,204, 98,177,122,180,108,217,146, 80, 40, 20, 22,  1,  9, 54,155, 13, 22,139,  5, 22,139,133,
- 53,107,214,184,180,110,221,122, 46,159,207,255,152,203,229, 42,141, 70,227, 14,173, 86,187,  8, 64,233,191,169, 70,234,216,177,
-227,244,236,236,236, 62, 33, 33, 33,  7,159,129,134, 49, 26,141,122,  0, 46, 44, 22,139,243, 28,234, 40,150,249,221,210,218,136,
-125,147,121,159,143,138, 97, 98,187,224,237,237,253,243, 31,127,252, 17, 20, 18, 18,  2,163,209,  8,147,201,  4,149, 74,133,132,
-132,  4,232,116, 58,152, 76, 38,132,135,135,227,243,207, 63,215,126,240,193,  7,130, 13, 27, 54, 20,169, 84,170,161,181,208,126,
-176,123,247,110,145, 84, 42,117,209,104, 52,184,127,255, 62, 90,182,108,137,178,178, 50,168,213,106,148,151,151,195, 96, 48, 64,
-169, 84,186, 83, 20,165,175,133,235, 51, 91,145, 53,126,252,248,155, 60, 30,175,229,148, 41, 83,144,147,147, 99, 45,243, 99,199,
-142,133,159,159,159,181, 44,153,235,100,135, 42,102, 54,155, 13, 62,159, 15, 46,151, 91, 90,175, 94, 61, 16,  4, 33,120,244,232,
- 81, 93,134,226, 36,  0,148, 28, 14,135,103, 43,176,248,124, 62,146,146,146,102,243,120,188,234,172, 89,213,149, 75,198,145,253,
-127, 26,  4, 65,124,203,229,114,249,158,158,158, 92,155, 14, 39,215,213,213, 21,190,190,190,171,  1,244,178,243,190,155,123,122,
-122, 90,235,247,216,216, 88,100,103,103,239, 83, 40, 20,239, 21, 21, 21,129, 36,201,237, 36, 73,190, 99,233,164,202,229,114,  4,
-  7,  7, 55,175,142,175, 93, 11,255,  9, 32,152, 39, 44, 90,149, 58,104,144, 72, 36,120,248,240, 33,212,106, 53,147,145,145, 65,
- 76,156, 56,145,208,235,245, 63, 38, 39, 39, 95, 64,197,106,251,106,181,200, 75,  2,199,231,104, 89, 44, 90,246, 54,  0,  4, 65,
-212,218,155, 48, 26,141,174,209,209,209, 85, 77,248, 34,170, 18, 90,230,225,164, 58,189,232, 28, 14, 71, 92, 87,177, 85, 25,  7,
-247,252,234,183,236,243, 89,159,123,  6,212,111,248,241,199,159,177,223,124,243,205,139,219,182,109,163, 60,155,244,234,118,242,
-232, 79,126,223,125, 56,243,240, 31,127,252,  1, 84, 76,140,182, 23,103,227,227,227,253,103, 76,157,140,207, 63,250,224,136, 36,
-220,155,231, 74,120,138,  4, 58,245, 99, 87, 48, 26,126,163,200, 62,123, 15, 30,204,  7,144, 92, 19,137, 80, 40, 12, 73, 77, 77,
- 13,183, 93, 72,160,215,235, 33, 20, 10,113,242,228, 73, 31, 23, 23, 23, 31,  0,208,104, 52,136,137,137,177,215, 98, 18,146,158,
-158, 30, 46, 22,139, 81, 94, 94, 14,157, 78,  7,163,209,  8,154,166, 65, 16,  4, 56, 28, 14,120, 60, 30, 68, 34,145,163, 43,251,
-174,  1,120,183,119,239,222,191, 28, 62,124, 24,209,209,209,144,203,229, 72, 75, 75,179,136, 44,135,230,104, 89,172, 68,182,243,
-177,216,108, 54,126, 14, 11,195,216,188, 60,171,128,249,214,205, 13,159,211,117,139,166, 17, 19, 19,195,156, 61,123, 22, 71,142,
- 28,193, 91,111,189, 69,236,223,191,223, 64, 81, 20, 55, 47, 47,239,102, 94, 94,158, 93, 28, 52, 77, 91,211,106,169,183,109,  5,
-150,163, 66,203,100, 50,137,121, 60, 30,180, 90, 45, 44,150,  7,219,173, 65,131,  6,144,201,100,108,165, 82,201,206,203,203, 19,
- 46, 92,184,112,202,233,211,167,165,101,101,101, 67,254,201, 90,104,221,186,117, 33, 99,199,142,205, 98,179,217, 76,207,158, 61,
-135, 61,122,244,232,109,169, 84,122,226,212,169, 83, 95,  3,136,112,148,207,219,219,251, 10,155,205, 14, 82, 42,149,220, 93,187,
-118, 25,203,202,202,184, 62, 62, 62,133,150,186,195,146,215, 70,163,209,174,149,203,222,222,222, 87,138,139,139,185,223,127,255,
-189,177,164,164,132,235,231,231, 87,104,225, 41, 45, 45,229,238,218,181,203,168, 84, 42,185,110,110,110, 87, 20, 10, 69,173,124,
-197,197,197, 67,135, 15, 31,158,120,226,196,  9,111, 22,139,133, 71,143, 30,161,164,164,  4,238,238,238,216,190,125, 59, 66, 66,
- 66,176,123,247,110,153, 76, 38, 27,243,213, 87, 95,205, 53,139,172,218,230,104,117,138,139,139, 11, 41, 45, 45,133,187,187, 59,
-212,106, 53,174, 92,185,130,168,168, 40,228,229,229,129, 36, 73,184,187,187, 99,237,218,181,229,  4, 65,200,106, 34,114,113,113,
-121,123,220,184,113,238,  0, 48,110,220, 56,247,113,227,198, 85,217,192,181,109,219, 22,171, 87,175,174, 44,180, 28,233, 24, 88,
-173, 78, 54,226, 72,219,166, 77, 27,156, 62,125,122,166,131,226, 72,111, 17,109,149,173, 89,124, 62,223,225,197, 52, 52, 77,115,
- 81, 49,165,129,176,103,255, 95,128,206, 46, 46, 46,220,202,  7,203,203,203,185, 82,169,180,163,  3,194,215,203,197,165,194,224,
- 20, 18, 18,  2,133, 66, 65,233,245,250,193, 63,253,244,147, 17,  0, 90,180,104, 49,152,162, 40,173,201,100, 98,241,120, 60,168,
-213,106,248,250,250,122,213, 96, 27,253,228,192,142,133,254,149,231,104, 73,165, 82,180,104,209,  2, 58,157, 14,249,249,249, 72,
- 72, 72, 48, 82, 20,245,203,186,117,235,104, 31, 31,159, 81,253,251,247,103, 37, 39, 39,191, 15, 96,122,117, 90,228, 37,179,102,
-109,172, 86,104,153, 21,228,105,  0, 93, 42,223,100,101,241, 83,147,208,170,109,232,144,199,227,149,102,101,101,137,108, 27, 21,
-147,201,132,128,128,  0,154, 97, 24,162, 42,161,245, 44,166, 96, 14,135, 35,254,244,211, 79, 75,215,173, 91, 55,244,225,195,135,
-243,236,249,205,174,247, 35,177,173,146,200, 90,191,108,254,234,239,151, 45,244,188,119,228, 71,108, 90,181,130,162, 40, 36, 55,
-109,218,180,163, 74,165, 98,187,137,140, 40, 46,197, 97,179,200,178, 87, 20,146,  0,182, 92,186,116, 41,185, 87,175, 94,231,182,
-252,182,215, 51,239,254,253, 11,124,101,113,190,164, 81, 56,155, 27, 24,242, 78,153, 86,203, 29, 60,120,176, 15,128,254,181, 85,
- 98,165,165,165, 40, 40, 40,168, 44,192,112,231,206,157,167,174,181, 43,113, 36,  9,138,162,176,103,207, 30,  8,133, 66,136, 68,
-162, 39, 54,139,200,170,227, 66,133,116,  0,232,217,179, 39,100, 50, 25, 92, 93, 93,237, 78, 87,101,241,194, 48, 12,244,122, 61,
-244,122, 61, 12,  6,  3,  5,128,195,102,179, 49, 58, 39,199,106,229,113, 68,192, 84, 70,211,166, 77,153,243,231,207,227,220,185,
-115, 80,171,213,248,254,251,239, 33,149, 74, 95,  5,240,153,163, 92, 54,147,244, 41,165, 82,201, 81, 42,149, 86,235, 32,135,195,
-177, 90, 15,236,180,228,113,217,108,182,181, 55,106,217,108,173, 90, 44, 22, 11,126,126,126,240,247,247,199,250,245,235,185,245,
-235,215,239,243, 79,214, 64,203,151, 47,111,244,237,183,223,110,222,182,109,219,225,161, 67,135,238, 76, 73, 73, 25,233,230,230,
-118,243,228,201,147, 11,249,124, 62, 93,199,242, 29,148,151,151,231,107,123,136,166,105,161,201,100,178, 10,219,242,242,114,187,
- 59, 24, 28, 14, 39, 40, 53, 53, 85,  8,  0, 11, 23, 46,228,  0, 16, 90, 38,131, 91, 56,203,203,203, 57, 81, 81, 81, 65,246,190,
-235,137,137,137, 29,187,119,239,126,254,216,177, 99, 30, 33, 33, 33,200,205,205, 69,110,110, 46, 26, 53,106,132,197,139, 23,171,
-149, 74,101,123,  0,233, 42,149,106,191,157,156,  1, 30, 30, 30,156,172,172, 44,152, 76, 38, 52,111,222, 28,107,215,174,197,224,
-193,131, 17, 19, 19,  3,165, 82,137,212,212, 84,108,221,186,213,131,203,229,214, 88,119,104, 52,154,253, 27, 55,110, 12,174,108,
-209, 26, 54,108,152,168,176,176,208,250, 78,206,159, 63,255,137, 33, 68, 71,234,100,243,208, 86,181, 91, 93, 96, 50,153, 36,  2,
-129, 64,201,231,243,121,150,249, 89,  9,  9,  9, 14, 91,179, 42,117,  0, 29,217,255,199, 96, 17,173, 85,180,173,240,247,247,183,
-155,135,207,231, 19,150,186,209,100, 50, 65,161, 80, 80, 82,169,212, 58,188,127,245,234, 85, 42, 52, 52,148, 98,177, 88, 44, 30,
-143,  7,130, 32, 32, 20, 10,171,173,240, 25,138,153,255,230,224,207,158, 88,117, 56,237, 83,192, 96, 48,224,234,213,171, 48, 24,
- 12, 72, 72, 72, 48,126,245,213, 87,121,165,165,165,211,  0,176,143, 30, 61, 58,124,230,204,153, 44, 95, 95,223,238, 69, 69, 69,
-168, 77,139,188, 68, 98,235, 41, 43,151,165, 21, 58,221,167, 79, 31,194,188,180,146,176,  8, 39, 71,132,150,185,240,213,218,242,
- 18,  4,129,252,252,124,235,190,175,175,175,195,255,101, 47,188,188,188,212,109,219,182, 21, 23, 23, 23,239, 95,190,124,121,157,
- 44, 89,235,151,205, 95,189,100,193, 23,158,178,219, 23,145,147,151, 15, 89,145, 49,249,236,205,135,251,  0,236,  3,  0,108,104,
-114,154,152,144,182,198, 94,206, 72,111,151, 88, 14,151,189,239,181, 94,125,130,  7,141,155, 78, 78,154, 52,169,195,240,225,195,
- 21, 67,135, 14,157,234,234,234, 26, 97, 48, 24,228,123, 15, 29,202, 28, 52,104, 80,125,138,162,134,163, 22,159, 35, 26,141,230,
- 81,151, 46, 93,108,243, 83,114,252,248,113,191,204,204, 76, 76,158, 60,249,113,110,110,110,169,237,181,246,164,209, 96, 48, 60,
-138,141,141,173,118,184,208, 50,164,  8,  0,101,101,101,143, 28,200,210, 33, 48, 79,124, 47, 41, 41,193,157, 59,119,192,102,179,
-209,166, 77, 27,156, 61,123, 22, 29, 58,116,184,234,136, 85, 75,171,213, 34, 36, 36,  4, 90,173, 22,106,181,186, 28,  0,127,123,
-253,250,  0,128,247, 75, 74,112,229,171,175,112,113,201, 18,216,190,207,246,162, 89,179,102,204,197,139, 23,113,243,230, 77,232,
-116, 58,140, 25, 51,  6,  0,  8,243,187,235,136,203,140, 48, 22,139,213,179, 87,175, 94,  1,  0,160, 86,171,137, 75,151, 46, 65,
- 32, 16, 88,203,194,193,131,  7,145,155,155, 11,130, 32,224,225,225, 17, 36,151,203,235,  3,120, 88,131,217,159,120,248,240, 33,
-150, 46, 93, 10,154,166, 49,115,230, 76,132,135,135, 91,  5,214,163, 71,143,176,112,225, 66, 80, 20,133, 47,190,248,  2,141, 26,
- 53,130,209,104, 20,160,142, 46, 52,158,  7,102,204,152,113,111,223,190,125,135,179,179,179,223, 88,182,108, 89,103,130, 32,232,
-143, 63,254,120,169, 68, 34,161,158,133, 87,174, 40,195,157,187,143,172, 66,168,242,230,227,237,233, 48, 95,198,253,108,235,239,
- 41,202,150,143,130,151,167,135,163, 73, 44, 55, 26,141,234,119,222,121,199,125,207,158, 61, 68,163, 70,141,240,224,193,  3,139,
-101,168, 28,142,187,116,200,149,201,100,225, 44, 22,139,123,247,238, 93,132,134,134, 34, 46, 46, 14,139, 22, 45, 66,113,113, 49,
- 76, 38, 19,124,125,125,105,163,209,120,213, 96, 48,156,169,133,107,254,248,241,227,185,  0, 38,152, 45, 91, 77,167, 77,155, 70,
-175, 88,177,  2, 87,175, 94,181, 90,176,108, 39,195, 59, 58,116,104,107,117,178,221, 18, 18, 18,102,242,120, 60,  6, 64, 18, 28,
-119,244,172,175,108,209,170,139, 53,235, 69,225, 69,174,100,148, 74,165,  9, 98,177,184,143, 92, 46,127,194,170,213,190,125,123,
-131,159,159, 95,162,189, 60,174,174,174,114, 22,139,229,  5,  0,185,185,185, 16,137, 68,220,251,247,239, 47, 65,133,243,108,212,
-175, 95,127,137, 76, 38,227,214, 55,215,167,254,254,254,208,235,245,213, 78, 99,185,112,173,240, 71,  0, 63, 90,246, 61, 61, 61,
-243, 21, 10,133,203,138, 21, 43, 84, 75,150, 44,209, 80, 20,165,  3,112,178,180,180,212,234, 71,171,160,160, 64,193,225,112, 60,
-221,221,221,  3, 45, 66,171, 42, 45,242,146,161,122,139,150, 89, 73, 50,149,  5, 17, 65, 16, 79, 77, 80,175, 69,104,213, 42,178,
- 40,138,122,194,202, 96,153,240, 94,213,127,153, 27,245, 58, 13, 29,154, 69,150, 96,239,222,189,219,151, 47, 95,158,100,239,239,
-108,231,104,109,248,122,193, 50,139,200,186,113,238, 24,246,167, 41,138,103, 46, 89,249,109, 93,159, 64, 19,111, 97, 51, 63, 63,
-175,211, 95, 45,158, 47,185,119,100, 43,118,110,248,134,185,113,249,114,235,203,151, 47,191, 55,121,242,228,122,230, 23, 75,  6,
-224, 58,128, 65,176, 99,149, 78,110,110,110,143, 74,141,112, 58,151,203,245, 19, 10,133,200,205,205, 85,101,100,100, 56, 60, 36,
- 83, 92, 92,220,227,  5,188,128,108,139,200, 42, 46, 46, 70,106,106, 42,186,118,237, 10,  0, 56,123,246, 44,218,183,111,143,228,
-228,100,180,108,217,242, 42,128, 86,168,197, 81,171,209,104, 44,109,210,164,137,213,186,165, 80, 40,104,  0, 24,151,159,143,141,
- 82, 41,216,108, 54, 46, 46, 89,130, 57, 70, 35, 22, 57, 40,224, 99, 99, 99,153, 75,151, 46, 33, 51, 51, 19, 38,147,  9,125,251,
-246, 69, 29, 11,125, 76,100,100,228,241,147, 39, 79,250,184,186,186, 66,173, 86, 67,165, 82, 97,196,136, 17, 24, 60,120, 48,116,
- 58, 29,118,237,218,133,  3,  7, 14, 64, 44, 22, 67,173, 86, 67,173, 86,123,244,238,221,251,124,122,122,122, 39,  0,119,171, 17,
- 90, 76,143, 30, 61,144,152,152,  8, 22,139,133,214,173, 91,163,164,228,175,197, 64,126,126,126, 85,157, 99,253,147, 66,139,205,
-102, 51,  9,  9,  9,203, 58,119,238,140,236,236,236, 55, 90,182,108,249,253,200,145, 35,115,159,149,215,195, 77,140,216,168, 48,
-232,116, 58,232,116, 58,  4,  4,  4,160,172,172, 12,247,238,221,131, 78,167,131,159,175,187,195,124, 45, 98, 26, 89,249,124,125,
-125,161, 86,171,241,240,225, 67,232,245,122,120,123, 59, 36,180,130,123,244,232,113,234,151, 95,126,241,218,186,117,171,190, 75,
-151, 46,188,239,191,255,158,144, 72, 36,176,105, 88, 28, 69,194,217,179,103, 67,186,119,239,222,248,246,237,219, 72, 72, 72,128,
- 94,175, 71,139, 22, 45,144,145,145,129,182,109,219, 66,165, 82, 37, 93,190,124,249,128, 61,134, 97,  0,115,199,143, 31, 15,139,
-216, 74, 76, 76, 68,126,126, 62,196, 98,241, 83, 66,203, 50,247,209,188,106, 60,192,158,196, 90,  4,145,141,229,105,142,187,187,
-187,  1,192,183,117,180, 62,  1,  0,178,179,179,249, 77,155, 54,213,  9,  4,  2,158, 89,180,173,124, 22,190,231,137,231,176,146,
-177, 90,248,251,251, 79,243,246,246,238,222,160, 65,  3, 20, 22, 22,114,121, 60, 30,218,183,111,111,104,213,170,149,193,223,223,
-255,125,123,121,248,124,254,109, 46,151,219,169,162, 51, 65, 33, 43, 43, 11, 66,200, 69,216,  0,  0, 32,  0, 73, 68, 65, 84, 12,
-195,204,140,137,137,249,160,172,172, 12, 37, 37, 37, 60,137, 68, 98,237, 84, 55,110,220, 24, 58,157,238,182,  3,150,183,249,161,
-161,161,115,185, 92,238,162,226,226,226,170,220, 66,240,220,221,221, 37, 92, 46, 23,  6,131,225,  9,177, 89, 89,139,188,236, 34,
-235,  9,161,101,163, 34,159, 16, 58,142, 88,180,236,177, 26, 88, 38,216,219,238, 91, 68, 93,229,255,170,171, 15, 45, 55, 55, 55,
-157, 69,100, 45, 90,180, 40,169, 46, 28,187,127,249, 73,234, 70,151,  7,231, 37,253,129,244,155,201,216,151, 90, 90, 60,115,201,
-202,169,111,246, 31, 82, 88, 89,152,217,131,112, 31, 97,140,159,175,215,233,175,151, 47,145,200,110, 95, 68,126, 65,  1,254, 72,
-186,156,108,  0, 82,  1,204,124,158,166,101,160, 98,232,144,197, 98,253,155, 94, 88,235,100,248,252,252,124,139,200,106,  1,  0,
- 29, 58,116,184,106, 22, 89,176,215,162, 85, 90, 90, 90, 57,100, 77,119,  0,222,150,251,103,179,217,104, 63,119,174,195, 34, 11,
-  0,147,156,156, 12,153, 76,102,233, 41,214, 85,100,193,223,223,255,163,147, 39, 79,250,108,217,178, 69,185,109,219,182, 18,154,
-166, 57,177,177,177, 65,175,188,242, 10,177,125,251,118,  0,192,160, 65,131, 48,115,230, 76,220,186,117, 11, 34,145,  8, 29, 58,
-116,160,230,205,155,231, 59,109,218,180,247, 11, 11, 11,167, 86,217, 58,210, 52, 87, 32, 16,156,  0,240,234,237,219,183,  1,224,
- 60, 42, 66, 56, 89,172,  8,213,158,179,167,241, 45, 43, 43,227,136,197,226, 42, 93, 67,112, 43,122, 67,142, 90, 32,172,156,231,
-206,157, 91,250,245,215, 95,239,251,240,195, 15,239, 62, 35,103,149, 22,173, 62,125,250, 64,163, 51, 32,167, 80,  1,138, 50, 65,
- 99, 40,114,152,207,214,162,213,167, 79, 31,148,107,245,200,202,151,193,100,162, 80,166,177,187, 45, 23,190,246,218,107, 71,119,
-236,216,225,127,225,194,  5, 80, 20, 69,103,100,100, 60,124,231,157,119, 36, 31,127,252,177,215, 51, 44, 50, 90, 53,100,200,144,
-  1,231,206,157,147, 53,110,220,216, 51, 41, 41,  9, 69, 69, 69, 48,153, 76,120,245,213, 87,193,227,241,178,150, 44, 89,194,  5,
-176,202,222,103, 99, 22, 91,134,203,151, 47,143,189,120,241,162,167,167,167, 39,143,142,140, 68,254,177, 99,216,179,103,207, 83,
- 63,216,176, 97,  3, 96,167, 23,126,139,197,233,210,165, 75,207, 69, 96, 61,209, 82,243,120,117, 30,126,124, 89,113,233,210,165,
-220, 73,147, 38, 69, 73, 36,146,111, 59,118,236,216,213,203,203,139,244,240,240, 72,  8, 12, 12,252, 32, 54, 54,214,238,209,  5,
- 14,135, 51, 82, 36, 18,221, 51,153, 76, 44,149, 74,  5,181, 90, 93, 81, 73,155, 76, 60,146, 36, 81,191,126,125,107, 91,210,186,
-117,107,248,251,251, 83,105,105,105, 35,237,229,127,252,248,241, 19,171, 16,171,192,248,246,237,219,179,117, 58, 29, 50, 51, 51,
-207,218,158,168, 74,139,188, 36, 24, 87,163,248,178,220,148,237,205,  5,  6,  6,102, 27,141, 70, 38, 21, 96,174, 95,191,206,140,
- 27, 55,174,198, 77,171,213, 50,190,190,190,249, 85, 52,126,176,229,212,233,116, 79,252, 78,167,211, 49,126,126,126,148, 70,163,
-121,138, 83,163,209, 48, 65, 65, 65,185, 53,113, 86,129, 17,215,174, 93, 91, 55,103,206,156, 56,  7, 50,200,202,201,172,143,100,
-182,110,221,250, 63,134, 97, 58,119,140, 10,185, 57, 48,214,143,105, 31,238,155,119, 96,247, 47,131, 25,134,233, 92,121,179, 56,
- 56,173,137, 51,210, 79,212,164, 91,116, 61,249,141, 35,191, 50, 39, 87, 76, 97,190,238, 27,206,180, 12, 18,151, 70,122,187, 56,
- 26, 35,166,214,104,233,209,209,209,233, 52, 77, 51,122,189,158,137,142,142,206,120, 30,156,117, 64, 77,156,205, 81, 49,151,109,
- 72, 21,199,154, 63, 67, 58,111, 48, 12,195,200,100, 50, 70,165, 82, 49, 58,157,142,161, 40,138,177,  5,128, 27,118,112, 50,  6,
-131,129,145,203,229, 12,236,159,115, 87, 37,167, 84, 42,125,120,255,254,125,166, 97,195,134,217,102,115,252, 52,181, 90,205, 84,
-134, 90,173,102,186,118,237,202,100,100,100, 48,161,161,161,218,140,140, 12, 70, 42,149,222,169, 37,157, 13,130,131,131, 79,120,
-123,123, 39,  0,  8,119,224, 92,141,249,185,107,215,174, 48,134, 97,198, 48, 12, 51,174,154,109, 12,195, 48,145,255, 52,167, 57,
-127, 11, 25,134, 97,202,203,203, 25,153, 76,198,228,229,229, 49,229,229,229,140, 74,165, 98,174, 93,187,198, 92,184,112,129,185,
-121,243, 38,227,233,233, 89,104, 15,167,133, 79,175,215, 51, 74,165,146, 41, 42, 42, 98, 52, 26, 13,163, 86,171,153,148,148, 20,
-230,202,149, 43,204,237,219,183,171,226,123,138,211,203,203,107, 67, 65, 65,129,234,252,249,243,229,235,215,175, 47,247,247,247,
-191, 13, 32,  4, 64,132,135,135, 71,193,148, 41, 83, 24, 87, 87,215, 71,117, 44, 71, 81, 28, 14,231,218,178,101,203, 46,197,199,
-199, 23, 30, 56,112, 64,191,121,243,230,156,201,147, 39,159, 97,179,217,215,  0, 68,213,177, 28,249,186,187,187,159, 79, 74, 74,
- 50,201,229,114,166,180,180,148, 81, 42,149,140, 90,173,102, 52, 26, 13,163,215,235, 25,163,209,200,156, 57,115,134,241,243,243,
-179, 29,150,252,164,134,142,245,116,134, 97, 62, 98, 24,134,253,188,235, 58, 27,238,142,207,139,243,121,212,117, 36, 73, 26,204,
-117, 71,155,138,221,154,247,255,169,116,118,235,214,237,139,193,131,  7, 51, 61,123,246,100, 90,180,104,241,212,214,178,101, 75,
-102,226,196,137, 76,124,124, 60,243,213, 87, 95,125,241, 28,210,201, 70,197,162,151,197,221,186,117, 51, 38, 38, 38, 50,131,  6,
- 13, 98,  0,244,168, 73,139,252, 23,  4,151,197,189,  3, 97,251,  9,  0,  6,131, 33, 59, 61, 61, 93,218,216,100, 98,  1,192,154,
- 53,107,158,178, 76,217, 34, 49, 49,209, 68, 16,196,189,154,254,221, 96, 48,100,159, 60,121,210,111,245,234,213, 28, 27, 19, 48,
- 76, 38, 19,157,151,151, 71,126,255,253,247, 79, 92,127,250,244,105,147,201,100,202,114,240, 38,183, 54,111,222,124,235,243,200,
-173, 51,183, 50, 63, 56,250,199,239,222,109,226, 58,150, 74, 60, 61,171,236,133,237,122, 63, 18,196,132,154,173, 90,  4,155, 92,
-180,108,241,124,119,203, 16,228,111, 87, 11, 74,181, 58,170,107, 90,177,230,198,243,126,194, 42,149, 42,211,178, 18, 80,173, 86,
-103,253, 11, 95,194,107,168,240,113,101,170,116,172, 21,158,113,210, 41, 77,211,112,115,115,179, 90, 67,235, 96, 17,101, 44, 22,
- 86,203,163,123,150,244, 48, 12,115, 46, 37, 37, 37,116,196,136, 17,226,109,219,182,221,167, 40,138, 51,122,244,104,131,191,191,
- 63,247,236,217,179, 70,  0, 68,231,206,157,217,  5,  5,  5, 76,110,110,174,236,173,183,222, 42, 27, 59,118,172,215,245,235,215,
-121, 52, 77,215,230,180,240, 65,118,118,118,183, 58,156,171, 17,  3,  7, 14,188,143,103, 15, 99,243,194, 57, 45,144,149, 42,113,
- 63, 51,215,236,193,156,  6,245,168,208, 58,175,202,104, 52, 65,166, 44,113,216,162,117,239, 97,174, 57,196, 24,  5,138,202, 51,
-243, 85, 76,136,103,228,229,181,183, 38,108,118,135,121,243,230,245, 34, 73,146,188,120,241,162,110,249,242,229,217,143, 31, 63,
-238, 11, 32, 11,  0,228,114,121,151,173, 91,183,254,108,135, 43,135,234,144,106, 52, 26,219,126,242,201, 39, 83,  1,116,  0, 80,
-207,204,125,214,108,201,170,171,  7,243,162,210,210,210,215,123,245,234,117,140,197, 98,213,183, 41, 71,222,  0,138, 45,229,130,
- 97, 24,223,194,194,194, 55,236, 33, 36,  8, 98,229,139,170, 72, 94, 36,247, 51,214, 67, 47,197, 74,198, 19, 39, 78,124,217,183,
-111, 95,118, 72, 72,200,236,144,144, 16, 82, 46,151, 67,165, 82,129, 36, 73,248,251,251, 35, 58, 58, 26,254,254,254,244,237,219,
-183, 23,207,154, 53,171, 86,159,124, 77,154, 52,  9, 51, 26,141, 13, 73,146, 12,  3, 16,198, 48, 76, 24, 65, 16, 97,  0, 60,  1,
- 64, 34,145, 72, 66, 67, 67,217,109,218,180, 65, 92, 92, 28, 78,159, 62,141,221,187,119,255,  8,224,168,173, 53,171,178, 22,249,
- 55, 32,181, 57,152,168,107, 32,110,181, 68,103,130,198,105,134, 68,151,232,100,171,159,189,202, 34,171,250,160,210, 85,152,254,
-122,188,250,234,171,214,  2,103, 71,163,146, 89, 91,225,123,252,248,113,143,145, 35, 71, 62,193, 73, 81,148,174,164,164,100, 82,
-187,118,237,214,178, 88, 44,126,165, 23,246, 81, 81, 81,209,223, 26,171,175,178, 31,173, 30,189,222, 46,126, 86, 78, 87, 46,217,
- 48,253,208, 15, 40, 44, 42,198,111, 87, 11,228,101,122,170, 75, 70,113,121,202,139, 72,255,163, 71,143,122,190,  4,138,191, 42,
-209,250,172,193,179, 31,219,225,144,180,182, 24,117,132,217,157,200,115, 41,228,  5,  5,  5, 43,230,206,157,251,250,226,197,139,
-125, 14, 31, 62, 44,177,116, 80,250,245,235, 87,148,146,146,210, 17,  0, 95,171,213, 30, 95,188,120,177,207,252,249,243,189,  0,
-120,  1, 64,239,222,189, 11, 11, 11, 11, 87,195,137, 26, 97, 52, 26,115,162,155, 52,182,118,252,108, 93, 58,216,126, 55,153, 76,
- 57,142,240, 85,197, 99,187, 79, 81, 84,141,124, 44, 22,235,195,184,184, 56,214,135, 31,126, 88,120,248,240, 97, 75, 32, 93, 91,
-133,150, 94,139, 83, 82,123,160,  3,176,220,188, 61, 79,168,101, 50, 89, 91,  7,127, 67, 57,223,198, 42, 59,148,142,236,255, 35,
-216,191,127,255,103,131,  6, 13,218,234,233,233,249, 83, 88, 88, 88, 99, 63, 63, 63,137,139,139, 11,116, 58, 93,153, 94,175,191,
-147,158,158, 62,244,179,207, 62,123, 96,151,133, 99,235, 86, 22,  0, 46, 77,211,  2,146, 36, 69,  0, 36,  4, 65,120, 88,132, 22,
- 65, 16, 48, 24, 12,200,204,204,196,156, 57,115,168, 19, 39, 78,124,  5,224, 11,  7, 58,174,173,  0,248,216,212,227, 62,  0,244,
-168,112, 96,251,152, 32,136,203, 47, 58,191,  8, 26,167,163,174,129, 72,109,142,170,218,137,154,131, 74, 87, 87,224, 30, 63,126,
-220,246,121, 23,226,234, 56, 31, 63,126, 28,242,111, 41, 33,195,117,203,127,197,134,229, 79,196, 57,180,136,176,170,246,107,131,
- 66, 99,154,188,234,232,173, 21, 58, 19, 67, 27, 76,244,168,140,199,229,169,206,122,232,185,227,181,231, 85,150,158, 99,154, 82,
-210,210,210,218, 77,158, 60,249, 51,161, 80,216, 26,  0,202,203,203, 47,230,229,229, 45,128,121, 85, 97,109,231,157,168, 30,197,
-197,197,175,252, 27,249,244,122,253,  7,237,218,181,251,142,162,168,175, 77, 38,211,217,255,  7,143, 66,235,124, 27, 95, 94,236,
-220,185,243,  1,128,182,  0, 48, 96,192,  0, 22,  0,236,222,189,219, 97,241, 60, 98,196,  8,138, 97, 24,131,249,125, 80,163, 98,
-117,161,220, 82,167,170,213,106,121, 94, 94,222,109,138,162,110,  3,248, 25,142,175,184,245, 33,  8, 34,158, 97,152, 62,102,225,
- 22,207, 48, 76, 31,219, 99, 47,218,170, 85,203, 37,181, 79,134,119,162,  2,187, 83, 65, 84, 30, 10,172,109,191, 54,164, 23,170,
- 19,  0,180,116,230,238,255, 75,220,207,203,203, 27,254, 12,231,157,120,249,144,165,215,235,251,254, 63,186, 95,133,243,145,255,
- 71,218,191, 58,  8, 44, 11,110,223,190,253,194,166,  8,252,211,136,186,246,100,  7,188,242,190, 13,198, 85, 37,188,156, 66,203,
-  9, 39,156,112,194,137,103, 65,169, 51, 11,156,248, 47,195, 50, 55,203,178, 95,205, 28,173,202,243,179,172,251,  4,170, 95, 57,
-224, 72, 84,242,186,172,146, 56,238,228,116,114, 58, 57,157,156, 78,206,127,156,211, 29, 64, 40,128,101,181, 92, 87,121,117, 97,
- 33,128, 98,  0, 70,103,126, 58, 57,159, 65, 63,216,  5,134, 97,122,215, 52,116, 72, 16,196,161, 23, 37,180,172,147,225,155, 99,
- 94,244, 53,204,179,236,219, 43,180, 94, 52,186, 59, 57,157,156, 78, 78, 39,167,147,211,201,233,228,116,114, 62,163,208,234, 58,
-107,214,172, 79, 81,225, 26,131,153, 53,107,214,167, 12,195,244,174, 56,197,244,126,145,255,125,171, 37, 58,167, 54,  7, 99,217,
-110,181, 68,231,106, 46, 29,103,179, 89,225, 28, 58,116,194,  9, 39,156,112,194,  9, 39,254,237, 56,191,100,201,146,242, 37, 75,
-150, 88, 38,190, 63,  6, 64,152, 45, 92,143, 95,228, 31,155,135,  9,237, 89, 40, 85,115,  8,158,127,  0,  1, 36,155, 59,140,195,
-229,119,  5, 67, 71,  3,  0, 72,214, 45, 74,175, 61,101, 50, 25,126,  2,144, 87, 87,226, 72,160, 73, 35,119,151,  3, 58,138,226,
-102,151,233,  7,164, 85,132, 57,112, 24,  3,128,246,124, 30,239, 79,190,187,187, 75, 85,231,117,165,165, 26,157, 94,255,250,110,
-224,156,179, 12, 56,225,132, 19, 78, 56,241,146, 64,228,225,225,113,130, 36,201, 16,203,  1, 91,191,131,149,125, 16, 82, 20,149,
- 47,147,201, 94, 71,197, 80,241,223,201,105,251,123, 61,234,216,150, 63,111, 56, 58,116,200,  6,158,240,194,250,183, 68,204,102,
-113,248, 99,197,110,238,139,254, 55,242,  3,175,240,136,198, 68,112,112, 32,192,  0, 89,217, 57,126,247,238,102,116,219,185,109,
-213, 12,165, 66, 54,199,168,211,253,224, 40,119, 19, 64, 84,207,149,127,246,135, 89,239,186,179, 97,194,144,133,191, 28, 33, 84,
-134,224,219, 21,203, 77, 29, 18, 89,238, 94, 94, 71,151, 28, 63,238,226,209,172,217, 19,231, 24,134,169,136,175,119,227,134,203,
-236,215, 95, 63, 58, 64, 38,235,225, 20, 91,255, 73,248, 75, 36,146,105, 28, 14,167,139,193, 96,  8,225,241,120,217, 20, 69, 37,
-200,229,242,111,  1,228, 58,179,231,191,141,198,254,162,142,141,195, 66,126,201, 43, 40,188,170,212,234, 71,167,231,169,100,206,
- 92,113, 24, 53,197,215,252,199, 98,111,  2,128,171,171,235, 21,146, 36,131,108, 69,128, 37,102,175,101,191,242, 39, 77,211, 15,
-100, 50, 89,187, 26,104,195, 60, 61, 61,215,  2,104, 85,155,195,100,179,111,182,203, 50,153,108, 18,170, 95,173, 39,246,240,240,
-248,146, 32,136,129, 36, 73,178,106,187, 39,154,166, 41,134, 97,118,201,229,242, 47,  0,148, 85,119,157,135,135,199,241,180,180,
-180, 86,190,190,190,181, 90,105, 76, 38, 19,178,178,178,124, 90,183,110,125, 70, 38,147, 69,190, 72,206,191, 91,139,212, 21, 53,
-172, 58,172,246, 69,  7,240, 68,124,161, 23,234,145,149, 43,112, 61,208,182, 83,143,174, 19,167,126, 40,186,150,114,  7,127,158,
-190,  0,165, 90,  7, 22, 73,194, 93, 44, 68, 68, 68, 67, 98,229,198, 61,222, 63,174, 95,249,245,197,196, 99,189,181,106,197, 91,
- 14,201,116, 33,123,206,204,119, 90,139,188, 60, 41,128,166,240, 81,175, 88,209,236,248,171,115, 80,110,250,212, 97,145,117,226,
-132,176,168,176, 16,243,  3,  2,192, 54,153, 32, 32, 73,  8,  8,  2,  2,146,132, 72, 32, 64,207,205,155,177,224,240, 97,225,103,
-111,188,225, 20, 91,255, 49,184,186,186,142, 12,  8,  8, 88,190,105,211, 38,175,  6, 13, 26, 64, 36, 18, 65, 38,147,121,167,167,
-167, 55,159, 62,125,250,240,252,252,252,185, 74,165,114,131, 51,167,254,187,160,105, 12,219,178,104, 82, 96,254,163,187,129,227,
- 23,255, 26, 65,120, 81, 93,238,148,104, 10,156, 57, 99, 55,154,  3,184,138,170,227,151,214,116,174, 90,  8,  4,130, 66,173, 86,
-235, 91,211, 53, 60, 30,175, 72,175,215,251,213,198, 69,146,100, 80,110,110,174,175, 80, 40,  4, 69, 81,230,104,  0,180,181, 35,
-109, 27,253,196,236,168, 22,145,145,145,134,154, 56,197, 98,241,154,162,162,162,238,150, 56,129, 54,130,170, 74,228,230,230,118,
-143,138,138, 90, 83, 86, 86,246,122, 53,226,229,203,169, 83,167, 78,139,137,137,177, 88,129,204, 81, 16, 42, 62,139,139,139, 49,
-121,242,100,235,127,208, 52,141, 99,199,142, 77, 29, 57,114, 36,228,114,249,244, 26,238, 61,196,215,215,151, 48,  7, 20,175, 22,
-243,230,205,195,188,121,243,176,106,213, 42,130,195,225,184,215,146,159,207,133,243,239,210, 34,117,177, 96,213,226, 25,254, 16,
-158,156,155,117,232, 41,161,245,119,128,197,225,143,106,213,174,123,151,201,211,102,138,126,253,253, 36,210,111,223, 64,218,217,
- 29, 79, 92,243,202,235, 35, 81, 80, 92,134,145, 19, 63,114, 37, 88,236, 46,137,199,247,143, 50,234, 52, 91,236,180,102,249,133,
-240,121, 83,218,180,142,230,228,186,164,195,223,195,  5, 29, 90, 54,226,  4, 31,189, 57, 69, 13,211,119,183, 43, 86,201, 56, 36,
-178, 54,189,251, 46, 58, 26,141,240,101,177,192, 34,  8,176,  0,144,  4,  1,173, 78,135,203,195,134,161,245,246,237,248,226,224,
- 65,225,151,111,190,233,144,216, 18,137, 68,215,  8,130,240, 80,169, 84,189, 81, 17, 88,250,101, 64,148,171,171,235, 33,134, 97,
-228,106,181,186,249,191, 40, 93, 82, 84,140,209, 87,238, 29,115, 81,177,162,202,161,200,194,124, 62,127,236,128,  1,  3, 86,174,
- 94,189, 90, 88, 88, 88,136,188,188, 60, 80, 20,  5,129, 64,128,240,240,112,226,248,241,227, 94, 51,103,206, 92,113,232,208, 33,
-126, 89, 89,217,119,142,116,108, 56, 28,206, 70, 79, 79,207, 55,252,252,252, 68, 69, 69, 69,229,165,165,165,199,116, 58,221, 88,
-212, 61,108, 10,201,225,112,134,134,134,134,190, 29, 16, 16,224,151,155,155, 91,156,147,147,115, 64,167,211,253,136, 58,  6,106,
-182,201,211,102, 48,123,171,  7,144, 31, 26, 26,122, 43, 51, 51,179,232, 57,114,230,133,134,134,166,214,129, 83,  4, 96, 39,128,
-128, 90,174,203,  3, 48,  8, 14, 90,179,173, 25,203,208,127, 44,252,118,211,232,249, 35, 58, 16, 91,166,119, 15,159,176,234,248,
-  5,146,203,116,186,157,175,205,118,106, 40,251, 68,150, 57,164, 85,101, 65, 85,211,185, 26,161,211,233,124, 12,  6,  3, 56,213,
-  4,139, 87,171,213, 16,139,197, 62,246, 38,210,197,197,  5, 59,118,236,  0,135,195,  1,135,195,129, 92, 46, 71, 80, 80,144,117,
-159,203,229, 90,191,215,171, 87,175, 86, 62,138,162, 90,179, 88, 44,168, 84, 42, 80, 20,101,221, 74, 75, 75,193, 48, 12,248,124,
- 62, 40,170, 34,156,147,205,249,214,213,241, 17,  4, 49, 48, 32, 32,  0,191,254,250, 43,244,122,253, 83,231, 37, 18,  9, 82, 82,
-254, 10, 50,194, 98,177, 16, 23, 23, 71, 18,  4, 49, 16,192,244, 26,120, 25,  0, 24, 55,110, 28, 88, 44, 22, 88, 44, 22, 72,146,
-180,126,183,108, 20, 69, 97,222,188,121,168, 20,154,236,111,227,252,183,161, 22,207,240,249,168,102,142, 22,249,130,211,101,187,
-196, 51, 64, 40,146, 44,157,244,193, 71,174,135,206,220, 68, 86,118,214, 83, 34, 11,  0,174,252,249, 35,242,243,114,113, 53, 45,
-  7, 67, 71,189,239, 42,145,184, 47,173, 84,161, 86,187,108,212, 77,204,253,106,214,160, 14,  2,149, 49, 15,101, 30,  0, 43,140,
-  7,142, 80,141,153,125,154,241, 37, 98,238,114,123,210,201,231,241,254, 92,114,252,184, 85,100,181,215,233,192,167, 40,152, 40,
-202, 42,178,244, 38, 19, 52,122, 61,164, 42, 21,238,141, 28,  9,198,104,196,220,125,251,132,124, 30,239, 79,123,210,  9,  0, 92,
- 46, 87,122,224,192,129,122, 77,155, 54, 61, 13,251,157,153, 30,127,193,207,168, 38,180,140,141,141, 77,216,190,125,123, 61, 46,
-151, 43,125, 30,156,  2,129,160,191, 72, 36,122, 44, 16,  8,250,215, 49,157, 36,128,133,163, 71,143, 78,110,216,176,225, 73,179,
-176,178,138,154,134, 13, 27, 30, 31, 61,122,244, 53,  0,243,170,121,215,171,226, 12, 12,  8,  8, 88,180,122,245,106, 97, 70, 70,
-  6,114,115,115, 97, 52, 26, 49,100,200, 16, 80, 20,  5,141, 70,  3,189, 94,143,101,203,150,137,188,188,188,230,160, 34, 80,176,
- 61,247,206,117,115,115,203,216,182,109,219,128,135, 15, 31,186,158, 60,121,146, 72, 73, 73, 17,173, 88,177,162,175,151,151, 87,
- 58,  0,126, 29,242,147,148, 74,165, 91,246,239,223, 63, 41, 37, 37, 37,104,239,222,189,156,139, 23, 47, 74,215,175, 95, 63, 70,
- 42,149,110,  7,192,170,227, 51,106, 46, 20, 10,187,125,252,241,199,244,249,243,231,115,207,159, 63,159,187,114,229, 74,116,236,
-216,177,253,252,249,243, 91,212,145,179,165, 88, 44,126,245,227,143, 63,166, 19, 19, 19,243,146,146,146,114, 86,172, 88, 65,190,
-250,234,171, 29, 22, 45, 90,212,204, 65,206,157,231,207,159,239,156,157,157,221, 32, 39, 39,167,126, 78, 78, 78,104, 78, 78, 78,
-104,110,110,110, 72,126,126,126,189,130,130,130,224,162,162,162,224,132,132,132, 14,  0,126,177,135,179,177,159,104,210,244, 33,
-221,203,231,140,234,197,124,250,222,107,204,204, 33,157,153, 55, 58, 53,253,157,197,102, 19, 73,169, 89,  8,114,  3,126,156,220,
- 42, 36,216, 91,148, 18,237,233, 26,241, 47, 43,155,255, 54, 78,182, 69, 72,201,100, 50, 28, 58,116,  8,102,235, 85,115, 91,145,
-165, 84, 42,145,159,159,111, 57,199,182, 39,157, 18,137,228,196,166, 77,155, 24,173, 86, 11,133, 66,129,162,162, 34,100,103,103,
-227,222,189,123, 40, 41, 41,193,157, 59,119, 32, 20, 10, 79,216,147, 78,130, 32, 64, 81,148, 85, 72, 29, 59,118, 12,163, 71,143,
-134, 76, 38,179, 30, 99,179,217,214,239,150,223,212,198,105,177, 60, 81, 20,133,164,164, 36,140, 31, 63, 30, 43, 87,174,196, 47,
-191,252,130,248,248,120,200,100, 50,171,216, 50,153, 76,181,114, 22, 23, 23,131,166,237,235, 51, 49, 12,  3,133, 66, 97,247,115,
-183, 21, 64,108, 54,251, 41, 81,100,217, 28,121,151,158,145,243, 95, 11, 59, 60,195, 87,223,195,182,124, 49,155,234,186,188,168,
- 68,146,108,238,208,129, 35,166,122,229, 20, 41,145, 91,168,  0,139,252,171,221,107,209,125,  4,216, 44, 18,151,142, 86, 24,174,
- 72, 22, 11, 10,181, 14,165, 42,  3,  6,140,152,230,249,195,202,207,135,154, 12,218, 26,125,188,196,  0,225,209,174,174,239, 68,
- 69,213, 35,111,243,211,208,226,141,179,160,104,128, 73,124, 19,205,229,190,172,200, 63,121,239,168,203, 12,139, 82,128,140, 26,
-173, 25,238,238, 46, 30,205,154, 97,126, 64,  0, 58, 25,141,224, 50, 12, 94, 43, 44,196,141,105,211,160,219,179,  7, 36,  0,110,
-255,254,232,250,237,183, 56, 19, 16,  0,127,141,  6,165, 51,102,192,231,200, 17,112, 37, 18, 23, 60,182,111,241,  3, 65, 16,232,
-210,165, 11,142, 31, 63,238,213,179,103,207,163, 55,111,222,236,103, 50,153,206,212, 37,111,221,220,220,174,176,217,236,160,218,
-174, 51,153, 76, 57, 10,133,194,225, 48, 35,108, 54,187, 83, 92, 92,220,190,189,123,247,122, 24, 12,134,231,210, 11,225,241,120,
- 61,251,246,237,187,105,221,186,117,146, 49, 99,198,108,138,143,143, 47,215,235,245, 71, 28,121,165,  0, 44,220,176, 97,195,132,
-113,227,198,185,143, 25, 51,134,185,119,239,158,173,245,202,167, 99,199,142, 13, 55,109,218,228,223,170, 85,171,169,227,199,143,
-231,  2,152, 91,155,149,199,213,213,117,226,166, 77,155,188,139,139,139,161, 82,169,172,149,108, 78, 78, 14, 92, 92, 92, 64,146,
- 36, 72,146,  4,135,195,193,210,165, 75,189, 38, 78,156, 56, 77, 38,147, 77,179,195, 74,182,113,237,218,181, 62,175,191,254, 58,
-249,240,225, 67,144, 36,  9,129, 64,128,119,223,125,151,212,104, 52, 30,243,231,207,223,170, 86,171,  7, 59,146,135, 28, 14,103,
-232,198,141, 27, 35,218,183,111,207, 78, 75, 75, 67,219,182,109,113,233,210, 37,244,239,223,159, 83, 86, 86, 86,127,230,204,153,
-163,117, 58,157,163,126, 92,164, 66,161, 48,230,212,169, 83,217,193,193,193,214,138,165,126,253,250, 84,239,222,189,101,105,105,
-105,141,207,159, 63, 95,210,174, 93, 59, 71,  2,150,  7, 10,133,194,200, 63,254,248, 35,127,254,252,249,221, 54,108,216,208, 23,
-  0, 90,183,110,125, 96,193,130,  5, 39,101, 50, 89,244,153, 51,103,100,157, 58,117,202,177,147, 47, 64, 42,149, 82,147, 39, 79,
-118,173,233,162,205,155, 55,151,162, 34,224,114,  3,  0, 53,198,107,107, 28,234, 63,103,249,180,129, 46,160, 12, 96,140, 26,192,
- 80, 14, 24, 84,160,245,229, 32,184, 46,128, 81,  3, 31,190, 12, 59, 39, 54,150,124,242,235,253,219,212, 29,162,119, 90,113,217,
- 17, 56, 81,101, 85,  3,160,  5, 65, 16, 87, 15, 29, 58,132,184,184, 56, 28, 58,116,  8,189,123,247,190,106, 43,  6, 82, 82, 82,
-208,169, 83, 39,152, 45, 90,118,205,213, 82, 40, 20,179,230,205,155,151, 56,116,232, 80,225, 19,149,  1, 73,194,221,221, 29,189,
-122,245,210,170,213,234, 89,246, 38,148,162, 40,176,217,108,228,228,228, 96,243,230,205, 88,188,120, 49,194,195,195, 97, 52, 26,
-159, 18, 91,230,122,207,174,202,207,100, 50,225,242,229,203,248,105,251,118,204,157, 51,  7, 98,177, 24,  0, 96, 48, 24, 32,147,
-203, 33, 16,  8,172, 98,172, 22,225,180,235,238,221,255,107,239,218,195,154,186,178,253,111,159,115,242,132, 64, 32, 16, 16,  4,
-100,116,172,180, 87,171,131,232,197,199,248,168,212, 50, 90, 71,107,125,116, 20,116, 70,138,218,250,205,168,157,142, 95,191, 78,
- 91, 95, 51, 78,123,117,208,218,218,150,145,106,107,181, 29,139,218, 58, 85,219,218, 14, 62,166,222,170, 80, 91,161,248,192,  7,
-162, 16, 72,  8,132, 16, 66,158,231,220, 63,200,137,  1,  9, 36,112,162,216,203,250,190,243,145,199,225,151,181, 95,103,255,246,
- 90,107,175,125,121,121, 92, 92, 92, 43,151, 33,255,215,245,204,  2,203,178,112, 56, 28,104,110,110, 70, 78, 78,142,131,227,184,
-189,157,205, 63, 60, 41, 90,190,124, 57, 44,150,219,  6,245,161,174,152,228,196,196, 68, 12, 27, 54,204,253,158,162, 40,206, 87,
-204,127,140, 30,  2,179,199,221, 73,171, 55,  2,  0,226,226,226,144,148,148,132,152,152, 24,175,152,129,230, 34, 93, 17, 63, 50,
-195,123, 39, 90,119,227,164,108,145, 88, 54,113,192,192, 65,228, 70,149, 30, 12,195, 32, 88, 25,137,209, 51, 86,128,166, 41, 40,
-194, 34, 65,156,230,219,140,152,162,193,208, 12,244, 70, 51, 18,251, 15,164,164, 50,249, 68, 83, 39, 68, 43, 84, 41,218,246,252,
-220,209,178, 90,199, 77,200, 19,100,112,242,211,105,172,  4, 84,132, 17,207,165, 63, 32,207,254,244,135,109, 48,216, 31,241, 69,
- 95,218,225, 64, 20, 77,195,198,113,248,126,249,114, 36,231,230,162,136, 39,134,185,185, 40,202,206,134, 74, 36,130,148,162,192,
-217,237,119,248,244,125, 33, 90,  0, 80, 81, 81,129,252,252,124,213,236,217,179,247,159, 63,127,126,190,159,100,131,199,138,252,
-246,219,111,163,250,247,239,239,245,158,171, 87,175, 34, 37, 37,197,111,247,148, 68, 34, 73,127,228,145, 71,246,228,231,231, 43,
- 75, 74, 74, 16, 21, 21,213,109,162, 37,149, 74,199,165,165,165,237,121,239,189,247, 66,181, 90, 45,114,115,115, 67,167, 77,155,
-182,187,176,176,112,134,197, 98,241,133,108,182, 34, 89,185,185,185,245,121,121,121,255, 64,107, 23, 97, 85, 94, 94,222,187, 35,
- 70,140,120, 38, 59, 59, 59, 12,192, 18, 87,236, 64,135,100, 75, 42,149, 78, 24, 48, 96, 64,171, 85,173, 84,218, 98,108, 10, 14,
- 14,134, 82,169,132, 88, 44,134,197, 98, 65,114,114, 50,145, 72, 36, 99,125, 41,115, 72, 72, 72,218, 19, 79, 60, 65,157, 60,121,
- 18, 26,141,  6, 97, 97, 97, 80, 40, 20,112, 58,157,200,202,202,162,115,114,114, 38,152, 76,254,121,184,226,227,227,167, 79,154,
- 52,137, 41, 46, 46,198,181,107,215, 96,177, 88,112,241,226, 69,132,134,134, 34, 51, 51, 83,252,218,107,175, 77,187,117,235,150,
-191, 68,107, 72,118,118,118,181, 39,201,226, 37, 56, 56,152, 12, 26, 52, 72, 31, 17, 17, 49, 28,128, 63, 68,107,200,178,101,203,
-106, 54,108,216, 48,238,232,209,163,238,164,151, 71,143, 30,253, 19,  0,108,217,178,229,132, 90,173, 30, 14,192, 87,162,  5,142,
-227,216,167,158,122,170, 92, 34,145, 64, 36, 18, 65, 34,145,180,186,196, 98, 49, 40,138, 10,225,135,115,103,120, 63, 94,211,188,
-154,245,167,141, 27,131,101,180,232, 15, 51, 30, 70, 66,152, 24,144,171, 32, 30,183, 10, 36,172,197,104,201,233,175,  2, 95,172,
-194,166, 39,244, 84,246,  7,205,  7,108,206,112,245,149,186, 58,227, 61,158,  3, 70,  0,248, 59, 90, 14,215,125, 17,192,183, 61,
-100,110,250, 14, 64,242,212,169, 83,221,100,235,240,225,195, 72, 79, 79, 71,125,125, 61,138,139,139, 61, 73,150, 63,  7, 44,127,
-103,183,219,207,125,248,225,135,163,103,207,158, 77, 60,198, 23, 74, 74, 74,112,225,194,133, 34, 95,241, 40,138,  2,203,178, 16,
-137, 68,216,184,113, 35,108, 54, 27, 62,248,224,  3,124,252,241,199,160, 40, 10,132, 16, 16, 66, 16, 26, 26,138,215, 95,127,221,
-175,231,158,211,233,196,206,157, 59,177,234, 79,127,114,147, 44,151, 39,  3,125,162,163, 17, 17, 25,137, 43, 87,174,116, 74,180,
-234,234,234, 94, 57,120,240, 32, 58, 10,134, 63,120,240,160,251,117,155, 96,248,206,231, 57,154,134,197, 98,193,163,143,222, 62,
- 42,118,217,178,101,238,215,122,189, 30, 52, 77,243,117, 65,124,197, 52,115,192, 12,217,237,207,166, 60,247, 92, 43, 11,157, 55,
-204,187,193, 69,132,178,110,181, 67,182,146, 93,214,217, 24,  0, 83,209, 18,163, 85,  5,220,197, 24, 45,142, 99, 31,140,235, 27,
-139,115,101,231,193,208, 52, 36,202, 72, 40, 85,209, 96, 29, 86, 24,106,174,161, 96,223,155,  0,128,119,118,238,  5, 69, 81, 96,
- 24, 26, 22,171, 19, 15, 36,196,130,101,217,  7, 59,194,126,  8, 24, 61, 33, 58,242,191,227,251,133,145,226,240,107, 24, 20, 21,
-209,198, 17, 34,197,  3,149, 10, 50, 74, 33, 31, 89,103,104, 24,253, 35,240, 77,167,100,128,162, 64, 17,130, 32,177, 24,150,252,
-252,150,168,205,220,150, 57,171, 40, 59, 27,212,129,  3,  8,145, 74, 65, 19,  2,198,101,130,238,138, 52, 52, 52,128, 16,130, 93,
-187,118,133,103,102,102,238, 46, 46, 46,206,110,110,110,206,247,  7,163,190,190,126,234,152, 49, 99,190,222,185,115,167,186, 79,
-159, 62,119,124,175,209,104,176,112,225, 66,109,125,125,189, 95, 73,221,100, 50,217,147,211,167, 79,223,190, 99,199,142,208,203,
-151, 47,163,177,177, 17,106,181,186,187, 93, 97,120,106,106,234,254,252,252,124,165, 70,163,129,193, 96,128,197, 98,193,174, 93,
-187,194,166, 76,153,146, 95, 90, 90,154, 14,160,176, 19,140,151, 60, 73,214,226,197,139,127,  0, 16,  5, 96, 91, 91, 14,234,250,
-238, 97, 15,178,101,  0,240, 90,  7, 43,209,126,193,193,193,168,169,169,193,194,133, 11,113,233,210,109,  3,104,108,108,172,123,
-165,119,229,202, 21,168,213,106, 16, 66,162,124, 41,180, 90,173, 86, 88,173, 86, 44, 90,180,  8, 21, 21, 21,173, 48,111,222,188,
-  9, 66, 72,144,191, 21, 25, 29, 29, 29,109, 54,155,241,203, 95,254, 18,205,205, 45,231,250,206,153, 51,  7, 34,145,  8, 53, 53,
- 53, 16,137, 68,145, 93,104,159,200,169, 83,167,122, 77,173, 18, 26, 26,106, 11, 15, 15,127,200, 79,204,136,105,211,166,221,202,
-205,205,189, 99, 99,203,233,211,167,127,173, 82,169,142,170, 84,170, 65,126, 98,178,158,164, 74, 44, 22,183, 34, 90, 34,145,  8,
- 20, 69,249, 28,163,118,169,198,244,  6, 67,170,134,109,120,118,242,194,132, 40, 37,184,198,106,136, 31,121,  5,231,180,114,108,
-204, 57,  4,  0,248,227,188, 20, 12, 77, 91, 15,235,142,201, 88, 62,138,150,100,220,180, 60, 15,224,165,123,252,204,255, 31,  0,
-252, 46,184,183,  0, 12,235, 65,243,145,155,108, 29, 62,124, 24,131,  7, 15, 70, 93, 93, 29, 74, 75, 75,187, 74,178,248,231,221,
-170, 53,107,214,124, 49,115,230,204, 96,126,209, 42,151,203,177,114,229, 74,115, 99, 99,227, 42,191, 58, 17,203,130, 97, 24,247,
- 34, 89, 38,147, 33, 57, 57,217, 77,178,  8, 33,104,106,106,  2,195, 48,252,142, 68,226,163,142,136,233,211,  7, 33, 33, 33, 24,
-248,192,  3,184,236,122,142,240,175,165, 82, 41,  8, 33,112, 56, 58, 53,228, 25, 93, 65,237, 43,132,158,146,121, 82,212,161,233,
- 56, 54, 22, 44,203,242, 36,147, 19,  2, 51, 50, 50, 18,141,141,141,190, 98,246, 72,241, 98,209,226,137,214, 84,180,196,106,221,
-145,222, 97, 60,128,  2,  4,112, 75, 37,  1, 71, 88,142,  3, 67, 83, 46,223, 45, 13,154,166,160,215, 86, 97,243, 43, 75, 92, 36,
-235, 99,124,118,162, 20,113,  3,  6,223,246,227, 18,  2,112, 29,119,110,181, 82,156,187,116,102,170,188,154, 84, 33, 44, 54,  8,
- 50, 89, 27,254, 24, 46,  6, 73,164,240,236,132,184,160, 51,  7,155,115,127, 52,216, 58,157, 40,100, 20,213, 18,252, 78, 72,187,
-193, 61,148,235, 59,154, 16,112, 28,  7,142,245, 47,238,152, 39,242,114,185, 28, 54,155, 13, 52, 77, 99,235,214,173, 97,105,105,
-105,219,252, 37, 90,  0, 74,170,171,171,167,100,101,101, 29,222,187,119,111,100,100,100,100,171,213, 67, 86, 86,150,174,186,186,
-122, 10,252, 12,186, 23,137, 68,219,222,122,235,173,208,235,215,175,163,169,169,  9,114,185,220,253,240,233,106,255, 28, 57,114,
-228,231, 71,142, 28,  9, 55, 24, 12,176,217,108,144,203,229,224, 56, 14, 52, 77,227,163,143, 62,138,120,252,241,199, 15,221,184,
-113,227,145,142,116,149,203,229, 51, 92,196,  9,217,217,217, 97,217,217,217,227,  1,175,153,122,221,146,157,157, 29,182, 98,197,
-138,105,102,179,249,181, 14,202, 92,161,215,235,251,200,229,114,236,219,183, 15, 10,133,  2, 65, 65, 65,136,141,141,133, 94,175,
- 71, 80, 80, 16, 56,142,131,221,110,231, 31, 22,181,190, 20, 92,171,213, 54, 58, 28, 14,229,225,195,135, 81, 91,123,251, 95, 18,
- 18, 18, 80, 95, 95, 15,150,101,155,252,173,204,202,202,202,106, 66, 72,252,185,115,231,112,253,250,117,164,167,167,227,192,129,
-  3, 72, 73,105,241, 14, 91,173,214,174, 36,241,115,210, 52,205,117,208,111,  9,128,112, 33, 49, 93,147,151, 95,152, 44,203,178,
- 60,201,242,252,235, 73,190, 58,249,205, 86,195,249,161,104, 69,222,134,165,147, 22, 78, 30, 28,  9,179,246, 26,100, 33,145, 32,
- 97,137,216,152,115,  8,197, 87, 91,218,107,227,238,179,216,179,118, 10, 32, 87, 33, 73,169, 67,159, 16,230,137, 11, 53,247,156,
-104, 41, 61,215,  9, 61,117, 98, 74, 79, 79,135, 94,175,135, 66,161, 16, 34, 62,231,148,217,108,190,248,201, 39,159, 12,159, 58,
-117, 42, 36, 18,  9, 46, 94,188,136,194,194,194, 82,  0,167,252, 37, 90, 34,145,  8,107,214,172,193,146, 37, 75, 16, 29, 29,141,
- 85,171, 86,129, 97, 24,247, 69,  8,113, 91,184,252,145,168,232,142, 55, 62,242,  1,241,157, 25,195,149, 74,229, 26,138,162,102,
-211, 62, 84,156,211,233,116,178, 44,187,215, 96, 48,116,152,222,129, 15, 92,247,165, 45, 60,235,160,147, 57,173,219,152,119,131,
-139,116, 69,218,238, 54,244, 98,209,226,119, 29,222,113, 20, 16, 95,202,  2,151,201,174, 32, 80,138, 18,138,190,112,243, 86, 37,
- 34,194, 21, 46,146,229,186, 40, 10, 67,  7,183, 44,102, 63, 59, 81,138,184,254,131,193,208, 52, 24,154,134, 66, 46, 69,181,166,
- 10, 12, 67, 93,240,134, 59,132,198,204,153,131,226, 19,195, 35, 68,208,169,173,136,137,246, 98, 24, 24, 30,130,184, 24,  9, 30,
-139,144,245, 27, 66, 99,102,199,214, 55,206, 77,180,108, 14,  7,196, 79, 62,233,118, 23, 22,101,103, 35, 57, 55, 23,206,233,211,
- 97,178,217, 90,153,138,187, 74,180,228,114, 57,140, 70, 35,230,207,159,175,183,219,237,207,116,177,138, 11,107,107,107,103,101,
-100,100,212,242,  4,198,102,179, 33, 35, 35,163,182,182,182,118,150, 15, 86,162, 59,196,110,183, 63,147,146,146,162,215,233,116,
-110, 61,187,242,192,225, 69,165, 82,125,150,151,151,167,178, 88, 44,112, 56, 28,110, 76,185, 92, 14,154,166,161, 86,171,177,103,
-207, 30,181, 74,165,234,240,204, 42,179,217,252, 73,110,110,110, 61,  0,228,230,230,214, 19, 66,142, 17, 66,222, 38,132,188,213,
-230,122,155, 16,114,204,243, 94,179,217,188,191, 35,108,171,213,122,172,180,180,148, 11, 10, 10,  2, 77,211,176,217,108,144,201,
-100,110,147,120, 67, 67,  3,204,230, 22, 55,119, 97, 97, 33,236,118,251, 73, 95,202,110, 52, 26,191,218,185,115, 39,155,144,144,
-128,193,131,  7, 35, 57, 57, 25,169,169,169,232,215,175, 31,214,173, 91,231, 52,153, 76,126,143,189,202,202,202,207,254,249,207,
-127,218,227,227,227, 49,124,248,112, 72,165, 82, 12, 29, 58, 20,177,177,177,248,235, 95,255,106, 53, 24, 12,135,187,208, 76, 55,
-206,159, 63, 79,119, 64,114, 67,225,195,238,221, 54, 82,113,230,204, 25, 58, 53, 53,245,211,182, 95,140, 28, 57,242, 83,133, 66,
-161,228, 77,236,254,172,200, 61,201,149, 84, 42,117, 95,252,231, 12,195,248,178,250,161, 30,138, 86,228,253,109,201,196,133,147,
-  7,135,227,211,175,190,133,216, 86, 15, 88, 59,240,  8, 58,237, 32,226, 96, 68, 43, 69,113, 61, 96, 14, 88, 14,224,  7,180,228,
- 97, 90,133,158, 37,238,192,247,218,218, 90,148,150,150,162,176,176, 16,169,169,169, 56,121,242, 36,112, 59, 64,222,111, 49, 24,
- 12,171,214,174, 93,107,226,119,242,189,248,226,139,102,163,209,184,202,223,103, 48,199,113, 16,137, 68, 72, 74, 74,194,138,112,
- 76,117,201,  0,  0, 13, 69, 73, 68, 65, 84, 21, 43,112,232,208, 33, 92,188,120, 17,118,187,221, 77,132,248,152, 76,127, 44, 90,
- 98,177, 24,209,209,209,176,219,237,110,107, 22,  0, 92,190,116,  9, 12,195,128,101, 89, 88,173,214, 78, 45, 90, 74,165,114,205,
-246,237,219,127,175,211,233, 98,180, 90,109,148,231, 85, 93, 93, 29, 85, 85, 85, 21,117,235,214,173,168,138,138,138,168,242,242,
-242,168,107,215,174,197,188,250,234,171,191, 87, 42,149,107,124,209,147,166,105, 12, 29, 58, 20,203,150, 45,115, 95,111,188,241,
-134,251, 42, 40, 40,240, 59,120,157,166,105, 36,173,222,136, 41, 90,206,125, 29, 82, 19,247, 85,252,199,197, 29, 97,  6,156,139,
-116,137,191,184,118, 27,122, 30, 44,221,142,240,187, 14,249,103,153, 59,108,163,109, 48,124,192,196, 97,109,254,250,106,217,165,
-137, 73, 67, 70, 80, 26, 93, 99,171,237,159,201, 19,102,129, 16,130,190,253,  7,131,102, 24,208, 52,  5,134,166, 17, 22, 42, 67,
-233,185,115,172,197,108,254,186, 61,204,241,  0, 35,145, 75,222,152,247,216, 80, 89,165,164,  6,234,152, 96,136, 69, 45,220,145,
-187, 58,171,205, 12,193,  0, 67, 66,240,219, 91, 17,242,175,171,155,223,  8, 55,217, 62, 61,230,101,  5,200,178, 44, 20, 82, 41,
-154, 45, 22,152, 29, 14, 76,216,188,217,237, 46,164,  8,193,119,  0, 30,222,188, 25,223,228,231, 35, 84, 34,  1,164, 82,159,119,
-133,180, 71,180,116, 58, 29, 22, 44, 88, 80, 91, 85, 85,149,217,149, 24, 45, 94, 44, 22,203,113,141, 70,147, 57,107,214,172, 93,
-251,246,237, 83,205,154, 53, 75,175,209,104, 50,125,140,123,186, 67,154,155,155,243, 43, 42, 42,154, 22, 44, 88,240,254,238,221,
-187, 35, 34, 35, 35,221, 43,145, 46,117, 86, 66,116,147, 38, 77,146,250,114, 95, 39,183,172,117,  5,183, 47,113, 89,182, 30, 94,
-188,120,241, 55,104,137,191,242,148,213,239,188,243,206, 28, 15, 23,227,219,  0, 54,119,  4,220,208,208,240,214,138, 21, 43,126,
-119,252,248,241, 72,153, 76,  6, 66,  8,196, 98, 49,  6, 14, 28,232,222, 69, 35, 18,137,192,113, 28,158,123,238, 57, 93, 77, 77,
-205, 22, 31,219,102,241,218,181,107,199, 53, 55, 55,135, 47, 88,176,128,150,201,100,168,174,174, 70, 78, 78,142,115,199,142, 29,
-245, 38,147,105, 97, 23,136,240,206,151, 95,126,121, 66, 99, 99, 99,255,172,172, 44,177,193, 96,128,217,108,198,243,207, 63,111,
-125,247,221,119,111,154,205,102,191, 19,254,142, 26, 53,170,172,188,188,124,108, 83, 83, 83, 93, 80, 80, 80, 91,107, 31,  9, 14,
- 14, 30,  1,224,125,127, 48,147,147,147,175,220,184,113, 35,117,253,250,245,199,236,118,187,232,244,233,211,238, 96,248,173, 91,
-183, 22,200,100,178, 73,240,243,240, 85, 66,  8, 43,149, 74, 91, 89,176,218,190,102, 24,166,211,103,218,131,125,130,214,255,237,
-233,113, 11, 31,125, 72,137, 79,190, 58,139,181,251,175, 94,120, 96,161, 58,233,231,225, 90,176,218, 82,252,113, 94, 10, 54,238,
- 62, 11,160,197,117,200,214, 20,131,171,187,  2, 46, 36, 30,215,244,186,202, 30, 48,  7, 20,160, 37,101, 70, 79,147, 86, 36,171,
-184,184, 24, 19, 39, 78,  4,  0,156, 60,121, 18, 99,198,140,193,201,147, 39, 49,118,236, 88,191,115,105,185,228,223, 13, 13, 13,
-229,  5,  5,  5,255, 21, 31, 31,143, 83,167, 78, 93,  3,240,111,127,149,228,137, 22,195, 48,248,205,111,126,131,180,180, 52, 36,
- 36, 36,180,218,109,200,191,246,135,108, 56, 28, 14, 12, 25, 50,  4, 22,171, 21, 98,177,216,237,154,100, 24,  6,234,168, 40,148,
-149,149,249,100,209,162, 40,106,246,140, 25, 51,168,146,146, 18,204,157, 59, 23,187,118,237,242,122,111, 70, 70,  6, 62,252,240,
- 67,204,152, 49,131,122,225,133, 23, 58, 76,239,192,  7,161,251, 82, 38,126,158,238,236,185, 47, 20,102,160,185, 72,119,196, 35,
-181, 67,187, 78,147,118, 62,203,109, 69,180, 60,146,132,  5,134,104, 57,108,187, 14,124,240,230,138,212,109, 99,213, 49, 81, 74,
-232, 13,102, 55,217, 42, 42,248, 24,  0, 48,115,241, 95,192,208, 45, 46,197, 80,133, 12,114, 49,141,252,247,182,232,108,182,230,
-118,123,151, 81, 68, 45,121, 97,244, 64,165, 36,216,142,134, 62, 28,  6,171,111,159,148, 67,250,127,124, 39,225,250, 69, 56, 34,
-139,235, 48,239,231,138,208, 45, 37,245, 75, 96,103,223,184, 99, 66,172,175, 55,215,159, 59, 39, 79,223,190, 29,167, 51, 51,209,
-215,233,196,177,216, 88,168, 68, 34, 40,165, 82, 80,132,192,252,175,127,225,155,125,251, 16, 45,149,  2, 33, 33,112,172, 91,  7,
- 75,105, 41,236, 70,163,185, 11, 43, 51,204,153, 51, 71,167,211,233,102, 89,173,214,227,221,173,103,179,217,124,164,162,162, 98,
-201,168, 81,163,182,217,237,246,103,204,102,115,183,118, 70, 89,173,214, 35, 26,141,230,201, 57,115,230,124,188,127,255,254,200,
-176,176,176, 46, 99,213,214,214,166,  8,212,157, 88,  0,127,118,  5,183, 47,201,206,206, 14, 59,115,230,204,239,242,242,242,182,
-121,172, 38,162, 22, 45, 90,244,116, 27,146,213,233,174, 67,  0, 55,106,106,106,214,173, 92,185,242, 47,155, 54,109, 82,240,129,
-239,223,127,255, 61, 28, 14,  7, 68, 34, 17,156, 78, 39, 22, 45, 90,212, 88, 91, 91,187, 17,222, 51, 58,223,209,181, 26, 26, 26,
-  6,174, 95,191, 62,111,243,230,205,105, 52, 77,  7, 59,157, 78, 83, 83, 83,211,177,230,230,230,133,232, 90, 30, 45, 86,171,213,
- 46,120,233,165,151, 22,228,228,228,204,160, 40, 42,202,225,112,232,140, 70,227, 65,179,217,252, 46,186,224, 74, 58,117,234,148,
-118,222,188,121, 87,181, 90,237,131,113,113,113,  6,133, 66, 97,181, 90,173,180, 92, 46, 15, 13, 14, 14, 78,  6,112,138, 16,242,
-163, 63,152, 69, 69, 69,154,172,172,172,235, 22,139, 37,233,237,183,223, 62, 17, 26, 26,250, 21, 33,132,136,197,226,112,185, 92,
- 62, 17,192, 49, 66,200,101,127, 48, 41,138, 98, 61,173, 87,109,227,179, 36, 18,137, 79, 49, 90,253,213, 65,191, 77, 27,200,224,
-147,175,207, 98,237, 39, 55,118, 58, 57,110,223,190,162,186,127,173, 26,  3,216,246,206,195,208, 89,239,183,184, 11,  1,176, 53,
-197,176,237,205,  0,  9,138,196,137, 91, 34, 24,204,182,207,208, 43,237,137, 59,189,131, 78,167, 67, 73, 73,  9, 79,178,146,  1,
- 96,236,216,177, 69, 60,217, 42, 44, 44,196,240,225,195,139,  0,136,252,237,175, 13, 13, 13, 43,231,207,159,127,196,181, 56, 94,
-217,133,133,159,155,104,241,132, 42, 33, 33,193,253,222,243,242,136,209,242, 73,156, 78, 39,196, 98, 49, 24,134, 65, 76,108,172,
-251,183, 56,142, 67, 89, 89, 25,244,122,189, 79, 68,139,166,105,154, 16,130,185,115,125,219,144,252,212, 83, 79,225,216,177, 99,
-160,125,100,133, 52, 77, 35, 49, 49,177,211,123,120, 94,234, 43,102, 92, 92, 92,151, 49,  3,205, 69,186, 74,176,218,123,221, 30,
-169,242, 54, 32,238,150, 84, 54, 54, 26,254,252,222,246,173,155, 22, 45,125, 78, 81,124,165, 26,134, 70, 11,104,154,242,124,120,
-130, 97,104,132,  6,203, 16,223, 71,137,221,255,248,187,209,216, 80,255, 18,188,156,123,152, 16, 34, 94, 60,105,196,207,165,226,
- 24, 19,146, 30,158,  3, 90,118,155,  4,112, 26, 47,222,193, 49, 95,224, 87, 55, 76,178,  3, 55, 76,139,191,171,179,222, 73,180,
-172,214,201, 47, 62,246,216,231,107, 15, 29, 10, 26,185,115, 39,174, 44, 90,132, 88,179, 25, 82,151, 43,145, 34,  4, 10,177, 24,
- 10,177,184,133,100,229,228,192,236,112, 96,115,102,102,147,197,106,125,204,159, 65, 94, 91, 91,139,233,211,167,107, 43, 43, 43,
-167,160, 11,174, 61,111, 98, 50,153,242,  1,228, 11,133,103,177, 88,142,223,188,121,243, 87,211,167, 79, 63,116,228,200, 17,117,
- 15, 73, 50,199,147, 45,219,153, 51,103,158, 62,113,226,196, 21,180, 62, 88,180,254,196,137, 19, 87,178,178,178, 72, 94, 94,222,
-187,  0, 94,134,143,  9, 60, 77, 38,211,214, 47,191,252, 18,227,198,141,123,121,195,134, 13, 17, 41, 41, 41,136,138,138,130,209,
-104, 68, 97, 97, 33,150, 47, 95,174,111,104,104,216, 80, 95, 95,191,201, 79,157,109, 22,139, 37,195,115, 43,181, 16,245, 96,177,
- 88,118, 84, 85, 85,237, 16, 10,240,217,103,159,253,190,172,172,172, 86,173, 86,255,183, 88, 44,126, 24, 45,113, 64, 26,  0,239,
-250, 75,136,120, 89,186,116,233,185,178,178, 50, 93,223,190,125, 83, 93,152, 97,104, 57,198,104,123, 23, 48, 43,207,158, 61, 27,
- 55, 98,196,  8, 74, 36, 18,113, 52, 77, 67, 36, 18,113, 12,195,112,174,184, 26, 14,  0, 14, 30, 60, 40,  5,208,225,177, 57, 87,
-106,204,235, 51,254,254,159, 23,126,212, 52,239, 43,173,110, 90,  1,128,219, 91, 28,244,197, 80, 53, 61,121,242,160,155,176,228,
-142,  5,  9,109, 73, 84,201, 53, 86,129,  4, 71,227, 38,219, 23,171, 63,189,160,113,128,188,214,203,169,218, 95, 87,195,149,222,
-161,170,170,202,147,100,241, 86,171,228,177, 99,199, 22,185, 72, 22,255, 93, 87,226,203,142,178, 44,219,173, 57,140,227, 56,172,
- 93,187, 22,239,188,243, 14, 58,203,104,238,218,221, 71, 58,195,227, 45, 90, 78,167, 19, 54,155, 13,197,197,197,238,156, 93,188,
-187,144, 79,237,224,112, 56, 58,220,173,238,116, 58,157, 86,171, 21, 31,125,244,145, 79,100,107,207,158, 61,104,110,110,134,179,
- 19,  6,231,153,138, 97,216,176, 97,208,235,245,238,205, 62,201,201,183, 83,229,217,108, 54,191,136, 43,143,153,148,148,  4,157,
- 78,  7, 62, 94, 56, 62,243,182,177,199, 97, 50,253, 84,251,189, 87,139,214, 93,159, 49,165, 65,161, 71, 82, 70,167,141,201,124,
-122,121,112,163,197,137,235,215,203,161,173,169,  2, 69, 40,196,244,141, 67,191,126,137,144, 75, 40,236,202,221,100, 42,250,230,
-171,255, 52, 26,235,210,189, 97, 77, 85,138,191,201,121,114, 76,234,128,  1, 33,  4, 14, 59,224,180,  3, 14, 59,192,186,254,242,
-159,177,173,251, 92, 73, 73, 61,247,194,119,250,255,253,204, 96,107,247,204,170, 89,192,152, 48,149,234,243,213,  7, 15,  6,177,
- 54, 27,106, 87,174, 68,144,195,  1,153,107, 85,210, 82, 16, 41, 28,235,214,181,144,172,140,140, 38, 67,125,189, 95, 71,240, 68,
- 70, 70,158, 37,132, 68,106,181,218,251, 42, 51,188, 90,173,254,140,227, 56,157, 78,167, 75,233, 65,122, 69,  1,168,  7, 96,107,
-103, 33,161,134,255,241, 63,188, 36,170,213,234, 23, 40,138, 26,197,113, 92,  4, 69, 81,117, 44,203,158,170,169,169,121, 21, 64,
- 89,239,124,122,207,132,207, 12,255,179, 78,238,171,  1,240,  7,180,  4,  5, 95,247, 21,124,168, 82,169,180, 72,236,251,127, 61,
- 88, 58, 97,118,178, 18,253,251,132, 64, 36,150,161,178,193,129,163, 63, 54, 96,123,129,166,194,108,119, 62,126, 73,219,116,190,
-183, 41, 58, 20,193,143,224, 17, 82, 84, 42,213,183,159,127,254,121, 74,255,254,253, 41,207,128,119, 62, 87, 30,239,222, 98,152,
- 22, 46,119,252,248,113,199,220,185,115, 79, 85, 87, 87,143,243,134, 25, 18, 18,242,197, 15, 63,252,240,168,193, 96,184,131, 80,
-121,102,138,231,223,155, 76, 38, 44, 93,186,244, 75,111, 71,240, 40,149,202,156, 77,155, 54,253,126,230,204,153, 20,159,142,194,
-243,226,143, 11,226, 47,155,205,134,247,223,127,159,221,178,101,203,235,  6,131,193,171,235, 48, 38, 38,166,162,178,178, 50,142,
- 79,181,224, 75, 82,209,196,196,196,170,242,242,242,216,187,137,121, 31, 19,174, 86,214,173,123, 98,154, 16,201,229,207,134, 40,
-194, 95,153, 57,127, 89, 68,226,128,  7, 72,116, 76, 95, 16, 80,168,214,220, 66,249,213, 75,220,254, 15,222,172, 53, 53,232,215,
-152,205,166, 55, 59,194,121,  8, 24,240,179, 80,241, 94,137, 19,131,192, 19,160, 54,231, 83,221,177,226,  0, 96, 19, 81, 23,174,
- 27,237,115,126,236,192,237,195,147,173, 63,239,223, 31, 36, 25, 52,232,142, 68,113, 44,203,194, 82, 90,138,205,153,153,126,147,
-172, 94,233,149, 94, 17, 68,250,163,243, 28, 89,118,180,228,231,242,215, 98, 66,146,162,130,231,112,192,108, 10,236, 16,138, 16,
-137,131,195, 69,112,248, 34,136,105,218, 86, 84,  5,115,111,245,251, 36, 61,246, 80,105,  0,193, 42,149,234, 43,154,166,251,241,
- 22, 25, 79,107,125, 59,  7, 74, 95,175,174,174,158,  4,160,163, 29,194,  3, 66, 66, 66,222,116, 58,157, 35,125, 57, 84,154,166,
-233,211, 70,163,241, 89,116,112,168,116, 32,118, 29, 70, 68, 68,148,149,151,151, 15,224,119, 81,123,206,149,237,237, 44,191,124,
-249, 50,198,143, 31, 95,174,209,104, 18,239, 38,102, 79, 21, 47,187, 14,123,142, 69,203, 67, 98,197, 82,197,  2,137, 92,246,  8,
-107,119, 36,129,  0,140, 72,116,193,218,108,254,218, 98,110,124, 15, 94,220,133,119, 83,102,  1, 99,164, 18,201, 23,226,208, 80,
-121,123,164,205,110, 52,154, 45, 86,235,228, 94,146,213, 43,189,210, 43,189,210, 43,247,145, 12, 82,169, 84,159,139, 68, 34,169,
- 39,153,108,251,154, 23,135,195,209,172,213,106,211,  1, 92,188,203,152,255, 63,197,207, 32,181, 52, 95, 49, 93,215,248,158,142,
- 25,192,178,115,  2, 98,142,119, 97,174,190, 79,244, 28,223, 83, 49,249,242,250,129,155,230, 79, 63, 18,170, 62, 61,244,228,132,
-214, 51, 80,152, 66,141,163,118,244,228,  2,208,238,171,239, 19, 61,199,247, 52,204,182,253,199, 71, 92,191, 48,125,236, 83,254,
-234,201,  9,173,103,160, 48,187, 59,142, 58,208,147,235,110, 95,242,210,246,171,113, 31, 74,201, 47,192,149,252,  2, 92,241,240,
-118,243, 54,102,123,251, 63,191,  2,  9,  3,181, 19,128, 79,187,239,194, 39, 61, 21,211,179, 30,132, 60, 42, 32,  0,199, 14, 20,
-  8,141,217,166, 62,133,146,213,174, 29, 38,199,224, 67,194, 81,127,202, 46, 68,187,183, 41,171, 32,184, 93, 32, 89,126, 97, 10,
-213,239,  3,141, 41,212, 88,106,139, 41, 68,191,111,175,221,  3,216, 70, 66,233, 41,200, 88, 10, 68,159,111,167,255,116, 27,183,
- 45,166, 16, 99,169, 45,166, 16,253,254,110, 96, 10, 49,150,218,195, 20,162,223,123,107,251,251,213,208,196,187, 11, 93, 41, 30,
-136, 15,100, 43, 23,  0,168,174, 84, 90,  0, 45,101, 19,132,198, 20, 90,231, 64,144, 77, 63, 44, 48,247, 28, 83,224, 54, 90,237,
-194, 20,114,117, 51, 65,168, 54, 10, 68,127,247,196, 20, 10,191, 45,142, 16,237,212, 30,102,119,245,245,162,167,224,101,239,110,
-191,191, 91,152,  2,183,145, 32, 99,169, 13,230,  4,129, 23,  3, 19, 60,222,175, 22, 18, 83,168,177,212,142,158,221,110,167,246,
- 48,187,171,175, 23, 61,  5, 47,187, 16,115, 72,160,112,239,165, 69,139,163,188,246,137,220, 54,215, 93, 33, 26,247,204, 37,231,
- 39,246, 79, 10,211, 79,247, 76, 90,  0,218,254,158,234, 41, 36,102, 91, 29,133,116,247,  4, 82, 79, 33, 49,253,208,245, 39,135,
-121,191,181,123, 79,172, 79,111,120,221,113, 75,121,179,142,  6, 66, 79, 33, 49,125,196,254, 73, 96,118,163,237,127,114,194,244,
- 20, 69,248,138, 23,120,101,  2,129, 45, 48,  1, 43,183,192,122, 78,  8,132,133, 48,  0, 34,184,158,174,149,242, 43,  1, 40,251,
-253, 82,167,189, 99,169,119, 44,245,184,177,212,166, 79, 78, 16,208, 82, 36,168,229,185, 45,166, 16,191,225,137, 33, 84, 31, 13,
-116,217,133, 28, 75,129,104,251,251, 77,254, 15,176, 49,196,128, 26,186,125, 59,  0,  0,  0,  0, 73, 69, 78, 68,174, 66, 96,130,
+137, 80, 78, 71, 13, 10, 26, 10,  0,  0,  0, 13, 73, 72, 68, 82,  0,  0,  2, 90,  0,  0,  2,
+128,  8,  6,  0,  0,  0, 68,254,214,163,  0,  0, 10, 79,105, 67, 67, 80, 80,104,111,116,111,115,104,111,112, 32, 73, 67, 67, 32,
+112,114,111,102,105,108,101,  0,  0,120,218,157, 83,103, 84, 83,233, 22, 61,247,222,244, 66, 75,136,128,148, 75,111, 82, 21,  8,
+ 32, 82, 66,139,128, 20,145, 38, 42, 33,  9, 16, 74,136, 33,161,217, 21, 81,193, 17, 69, 69,  4, 27,200,160,136,  3,142,142,128,
+140, 21, 81, 44, 12,138, 10,216,  7,228, 33,162,142,131,163,136,138,202,251,225,123,163,107,214,188,247,230,205,254,181,215, 62,
+231,172,243,157,179,207,  7,192,  8, 12,150, 72, 51, 81, 53,128, 12,169, 66, 30, 17,224,131,199,196,198,225,228, 46, 64,129, 10,
+ 36,112,  0, 16,  8,179,100, 33,115,253, 35,  1,  0,248,126, 60, 60, 43, 34,192,  7,190,  0,  1,120,211, 11,  8,  0,192, 77,155,
+192, 48, 28,135,255, 15,234, 66,153, 92,  1,128,132,  1,192,116,145, 56, 75,  8,128, 20,  0, 64,122,142, 66,166,  0, 64, 70,  1,
+128,157,152, 38, 83,  0,160,  4,  0, 96,203, 99, 98,227,  0, 80, 45,  0, 96, 39,127,230,211,  0,128,157,248,153,123,  1,  0, 91,
+148, 33, 21,  1,160,145,  0, 32, 19,101,136, 68,  0,104, 59,  0,172,207, 86,138, 69,  0, 88, 48,  0, 20,102, 75,196, 57,  0,216,
+ 45,  0, 48, 73, 87,102, 72,  0,176,183,  0,192,206, 16, 11,178,  0,  8, 12,  0, 48, 81,136,133, 41,  0,  4,123,  0, 96,200, 35,
+ 35,120,  0,132,153,  0, 20, 70,242, 87, 60,241, 43,174, 16,231, 42,  0,  0,120,153,178, 60,185, 36, 57, 69,129, 91,  8, 45,113,
+  7, 87, 87, 46, 30, 40,206, 73, 23, 43, 20, 54, 97,  2, 97,154, 64, 46,194,121,153, 25, 50,129, 52, 15,224,243,204,  0,  0,160,
+145, 21, 17,224,131,243,253,120,206, 14,174,206,206, 54,142,182, 14, 95, 45,234,191,  6,255, 34, 98, 98,227,254,229,207,171,112,
+ 64,  0,  0,225,116,126,209,254, 44, 47,179, 26,128, 59,  6,128,109,254,162, 37,238,  4,104, 94, 11,160,117,247,139,102,178, 15,
+ 64,181,  0,160,233,218, 87,243,112,248,126, 60, 60, 69,161,144,185,217,217,229,228,228,216, 74,196, 66, 91, 97,202, 87,125,254,
+103,194, 95,192, 87,253,108,249,126, 60,252,247,245,224,190,226, 36,129, 50, 93,129, 71,  4,248,224,194,204,244, 76,165, 28,207,
+146,  9,132, 98,220,230,143, 71,252,183, 11,255,252, 29,211, 34,196, 73, 98,185, 88, 42, 20,227, 81, 18,113,142, 68,154,140,243,
+ 50,165, 34,137, 66,146, 41,197, 37,210,255,100,226,223, 44,251,  3, 62,223, 53,  0,176,106, 62,  1,123,145, 45,168, 93, 99,  3,
+246, 75, 39, 16, 88,116,192,226,247,  0,  0,242,187,111,193,212, 40,  8,  3,128,104,131,225,207,119,255,239, 63,253, 71,160, 37,
+  0,128,102, 73,146,113,  0,  0, 94, 68, 36, 46, 84,202,179, 63,199,  8,  0,  0, 68,160,129, 42,176, 65, 27,244,193, 24, 44,192,
+  6, 28,193,  5,220,193, 11,252, 96, 54,132, 66, 36,196,194, 66, 16, 66, 10,100,128, 28,114, 96, 41,172,130, 66, 40,134,205,176,
+ 29, 42, 96, 47,212, 64, 29, 52,192, 81,104,134,147,112, 14, 46,194, 85,184, 14, 61,112, 15,250, 97,  8,158,193, 40,188,129,  9,
+  4, 65,200,  8, 19, 97, 33,218,136,  1, 98,138, 88, 35,142,  8, 23,153,133,248, 33,193, 72,  4, 18,139, 36, 32,201,136, 20, 81,
+ 34, 75,145, 53, 72, 49, 82,138, 84, 32, 85, 72, 29,242, 61,114,  2, 57,135, 92, 70,186,145, 59,200,  0, 50,130,252,134,188, 71,
+ 49,148,129,178, 81, 61,212, 12,181, 67,185,168, 55, 26,132, 70,162, 11,208,100,116, 49,154,143, 22,160,155,208,114,180, 26, 61,
+140, 54,161,231,208,171,104, 15,218,143, 62, 67,199, 48,192,232, 24,  7, 51,196,108, 48, 46,198,195, 66,177, 56, 44,  9,147, 99,
+203,177, 34,172, 12,171,198, 26,176, 86,172,  3,187,137,245, 99,207,177,119,  4, 18,129, 69,192,  9, 54,  4,119, 66, 32, 97, 30,
+ 65, 72, 88, 76, 88, 78,216, 72,168, 32, 28, 36, 52, 17,218,  9, 55,  9,  3,132, 81,194, 39, 34,147,168, 75,180, 38,186, 17,249,
+196, 24, 98, 50, 49,135, 88, 72, 44, 35,214, 18,143, 19, 47, 16,123,136, 67,196, 55, 36, 18,137, 67, 50, 39,185,144,  2, 73,177,
+164, 84,210, 18,210, 70,210,110, 82, 35,233, 44,169,155, 52, 72, 26, 35,147,201,218,100,107,178,  7, 57,148, 44, 32, 43,200,133,
+228,157,228,195,228, 51,228, 27,228, 33,242, 91, 10,157, 98, 64,113,164,248, 83,226, 40, 82,202,106, 74, 25,229, 16,229, 52,229,
+  6,101,152, 50, 65, 85,163,154, 82,221,168,161, 84, 17, 53,143, 90, 66,173,161,182, 82,175, 81,135,168, 19, 52,117,154, 57,205,
+131, 22, 73, 75,165,173,162,149,211, 26,104, 23,104,247,105,175,232,116,186, 17,221,149, 30, 78,151,208, 87,210,203,233, 71,232,
+151,232,  3,244,119, 12, 13,134, 21,131,199,136,103, 40, 25,155, 24,  7, 24,103, 25,119, 24,175,152, 76,166, 25,211,139, 25,199,
+ 84, 48, 55, 49,235,152,231,153, 15,153,111, 85, 88, 42,182, 42,124, 21,145,202, 10,149, 74,149, 38,149, 27, 42, 47, 84,169,170,
+166,170,222,170, 11, 85,243, 85,203, 84,143,169, 94, 83,125,174, 70, 85, 51, 83,227,169,  9,212,150,171, 85,170,157, 80,235, 83,
+ 27, 83,103,169, 59,168,135,170,103,168,111, 84, 63,164,126, 89,253,137,  6, 89,195, 76,195, 79, 67,164, 81,160,177, 95,227,188,
+198, 32, 11, 99, 25,179,120, 44, 33,107, 13,171,134,117,129, 53,196, 38,177,205,217,124,118, 42,187,152,253, 29,187,139, 61,170,
+169,161, 57, 67, 51, 74, 51, 87,179, 82,243,148,102, 63,  7,227,152,113,248,156,116, 78,  9,231, 40,167,151,243,126,138,222, 20,
+239, 41,226, 41, 27,166, 52, 76,185, 49,101, 92,107,170,150,151,150, 88,171, 72,171, 81,171, 71,235,189, 54,174,237,167,157,166,
+189, 69,187, 89,251,129, 14, 65,199, 74, 39, 92, 39, 71,103,143,206,  5,157,231, 83,217, 83,221,167, 10,167, 22, 77, 61, 58,245,
+174, 46,170,107,165, 27,161,187, 68,119,191,110,167,238,152,158,190, 94,128,158, 76,111,167,222,121,189,231,250, 28,125, 47,253,
+ 84,253,109,250,167,245, 71, 12, 88,  6,179, 12, 36,  6,219, 12,206, 24, 60,197, 53,113,111, 60, 29, 47,199,219,241, 81, 67, 93,
+195, 64, 67,165, 97,149, 97,151,225,132,145,185,209, 60,163,213, 70,141, 70, 15,140,105,198, 92,227, 36,227,109,198,109,198,163,
+ 38,  6, 38, 33, 38, 75, 77,234, 77,238,154, 82, 77,185,166, 41,166, 59, 76, 59, 76,199,205,204,205,162,205,214,153, 53,155, 61,
+ 49,215, 50,231,155,231,155,215,155,223,183, 96, 90,120, 90, 44,182,168,182,184,101, 73,178,228, 90,166, 89,238,182,188,110,133,
+ 90, 57, 89,165, 88, 85, 90, 93,179, 70,173,157,173, 37,214,187,173,187,167, 17,167,185, 78,147, 78,171,158,214,103,195,176,241,
+182,201,182,169,183, 25,176,229,216,  6,219,174,182,109,182,125, 97,103, 98, 23,103,183,197,174,195,238,147,189,147,125,186,125,
+141,253, 61,  7, 13,135,217, 14,171, 29, 90, 29,126,115,180,114, 20, 58, 86, 58,222,154,206,156,238, 63,125,197,244,150,233, 47,
+103, 88,207, 16,207,216, 51,227,182, 19,203, 41,196,105,157, 83,155,211, 71,103, 23,103,185,115,131,243,136,139,137, 75,130,203,
+ 46,151, 62, 46,155, 27,198,221,200,189,228, 74,116,245,113, 93,225,122,210,245,157,155,179,155,194,237,168,219,175,238, 54,238,
+105,238,135,220,159,204, 52,159, 41,158, 89, 51,115,208,195,200, 67,224, 81,229,209, 63, 11,159,149, 48,107,223,172,126, 79, 67,
+ 79,129,103,181,231, 35, 47, 99, 47,145, 87,173,215,176,183,165,119,170,247, 97,239, 23, 62,246, 62,114,159,227, 62,227, 60, 55,
+222, 50,222, 89, 95,204, 55,192,183,200,183,203, 79,195,111,158, 95,133,223, 67,127, 35,255,100,255,122,255,209,  0,167,128, 37,
+  1,103,  3,137,129, 65,129, 91,  2,251,248,122,124, 33,191,142, 63, 58,219,101,246,178,217,237, 65,140,160,185, 65, 21, 65,143,
+130,173,130,229,193,173, 33,104,200,236,144,173, 33,247,231,152,206,145,206,105, 14,133, 80,126,232,214,208,  7, 97,230, 97,139,
+195,126, 12, 39,133,135,133, 87,134, 63,142,112,136, 88, 26,209, 49,151, 53,119,209,220, 67,115,223, 68,250, 68,150, 68,222,155,
+103, 49, 79, 57,175, 45, 74, 53, 42, 62,170, 46,106, 60,218, 55,186, 52,186, 63,198, 46,102, 89,204,213, 88,157, 88, 73,108, 75,
+ 28, 57, 46, 42,174, 54,110,108,190,223,252,237,243,135,226,157,226, 11,227,123, 23,152, 47,200, 93,112,121,161,206,194,244,133,
+167, 22,169, 46, 18, 44, 58,150, 64, 76,136, 78, 56,148,240, 65, 16, 42,168, 22,140, 37,242, 19,119, 37,142, 10,121,194, 29,194,
+103, 34, 47,209, 54,209,136,216, 67, 92, 42, 30, 78,242, 72, 42, 77,122,146,236,145,188, 53,121, 36,197, 51,165, 44,229,185,132,
+ 39,169,144,188, 76, 13, 76,221,155, 58,158, 22,154,118, 32,109, 50, 61, 58,189, 49,131,146,145,144,113, 66,170, 33, 77,147,182,
+103,234,103,230,102,118,203,172,101,133,178,254,197,110,139,183, 47, 30,149,  7,201,107,179,144,172,  5, 89, 45, 10,182, 66,166,
+232, 84, 90, 40,215, 42,  7,178,103,101, 87,102,191,205,137,202, 57,150,171,158, 43,205,237,204,179,202,219,144, 55,156,239,159,
+255,237, 18,194, 18,225,146,182,165,134, 75, 87, 45, 29, 88,230,189,172,106, 57,178, 60,113,121,219, 10,227, 21,  5, 43,134, 86,
+  6,172, 60,184,138,182, 42,109,213, 79,171,237, 87,151,174,126,189, 38,122, 77,107,129, 94,193,202,130,193,181,  1,107,235, 11,
+ 85, 10,229,133,125,235,220,215,237, 93, 79, 88, 47, 89,223,181, 97,250,134,157, 27, 62, 21,137,138,174, 20,219, 23,151, 21,127,
+216, 40,220,120,229, 27,135,111,202,191,153,220,148,180,169,171,196,185,100,207,102,210,102,233,230,222, 45,158, 91, 14,150,170,
+151,230,151, 14,110, 13,217,218,180, 13,223, 86,180,237,245,246, 69,219, 47,151,205, 40,219,187,131,182, 67,185,163,191, 60,184,
+188,101,167,201,206,205, 59, 63, 84,164, 84,244, 84,250, 84, 54,238,210,221,181, 97,215,248,110,209,238, 27,123,188,246, 52,236,
+213,219, 91,188,247,253, 62,201,190,219, 85,  1, 85, 77,213,102,213,101,251, 73,251,179,247, 63,174,137,170,233,248,150,251,109,
+ 93,173, 78,109,113,237,199,  3,210,  3,253,  7, 35, 14,182,215,185,212,213, 29,210, 61, 84, 82,143,214, 43,235, 71, 14,199, 31,
+190,254,157,239,119, 45, 13, 54, 13, 85,141,156,198,226, 35,112, 68,121,228,233,247,  9,223,247, 30, 13, 58,218,118,140,123,172,
+225,  7,211, 31,118, 29,103, 29, 47,106, 66,154,242,154, 70,155, 83,154,251, 91, 98, 91,186, 79,204, 62,209,214,234,222,122,252,
+ 71,219, 31, 15,156, 52, 60, 89,121, 74,243, 84,201,105,218,233,130,211,147,103,242,207,140,157,149,157,125,126, 46,249,220, 96,
+219,162,182,123,231, 99,206,223,106, 15,111,239,186, 16,116,225,210, 69,255,139,231, 59,188, 59,206, 92,242,184,116,242,178,219,
+229, 19, 87,184, 87,154,175, 58, 95,109,234,116,234, 60,254,147,211, 79,199,187,156,187,154,174,185, 92,107,185,238,122,189,181,
+123,102,247,233, 27,158, 55,206,221,244,189,121,241, 22,255,214,213,158, 57, 61,221,189,243,122,111,247,197,247,245,223, 22,221,
+126,114, 39,253,206,203,187,217,119, 39,238,173,188, 79,188, 95,244, 64,237, 65,217, 67,221,135,213, 63, 91,254,220,216,239,220,
+127,106,192,119,160,243,209,220, 71,247,  6,133,131,207,254,145,245,143, 15, 67,  5,143,153,143,203,134, 13,134,235,158, 56, 62,
+ 57, 57,226, 63,114,253,233,252,167, 67,207,100,207, 38,158, 23,254,162,254,203,174, 23, 22, 47,126,248,213,235,215,206,209,152,
+209,161,151,242,151,147,191,109,124,165,253,234,192,235, 25,175,219,198,194,198, 30,190,201,120, 51, 49, 94,244, 86,251,237,193,
+119,220,119, 29,239,163,223, 15, 79,228,124, 32,127, 40,255,104,249,177,245, 83,208,167,251,147, 25,147,147,255,  4,  3,152,243,
+252, 99, 51, 45,219,  0,  0,  0,  6, 98, 75, 71, 68,  0,255,  0,255,  0,255,160,189,167,147,  0,  0,  0,  9,112, 72, 89,115,  0,
+  0, 13,213,  0,  0, 13,213,  1, 61,214, 88,241,  0,  0,  0,  7,116, 73, 77, 69,  7,220,  3, 15, 13, 43, 47, 99,146, 79, 17,  0,
+  0, 32,  0, 73, 68, 65, 84,120,218,236, 93,119,120, 20,197,  3,125,187,183,215,239,114,233, 61, 16,146, 64, 32,148,132, 80, 20,
+144, 94,  5,162,168,  8,  2, 34, 69, 44,136, 40,160, 40,168,136, 72, 87,233, 42, 32, 42, 77, 65,176,  1,  1, 41,145, 18, 72,  2,
+132, 38, 61, 65, 18, 72, 35,237, 82,175,183,221,223, 31,201,157,151,203,181, 64,162, 63,116,223,247,237,119,119,123,187,111,103,
+103,103,102,223,188,105,  0, 11, 22, 44, 88,176, 96,193,130,  5, 11, 22, 44, 88,176, 96,193,130,  5, 11, 22,255,106, 36, 38, 38,
+ 50, 13, 56,124,160,187,156,181, 91,159,255,119,206, 38,188,119,166, 17, 57,251,212,114,126,244,144,132,179,207,255, 43,167,249,
+126, 27,192, 59,176, 33,233,168,177,226,211, 42,156, 76, 99,135,179,169, 56, 27, 43, 31,217,  9, 39,211,  4,207,253,163,135, 36,
+156,125,254,223, 56,109,211,143,155,188, 13,226,116, 51, 77, 53, 52,156, 76, 99,135,179,169, 56, 31, 52, 31, 57,  9, 39,243,160,
+105,201,193,179,255,  8,255, 33, 80, 77, 40,178,220, 70, 66, 66,  2, 97,197, 79,252,191,114, 90,199,131,153,191, 49,195,218,136,
+ 56,222,216,156, 54,241,217, 88,248, 40, 33, 33,129, 72, 76, 76, 60,  1,160, 79, 99,222,123, 99, 60,119,155,123,109, 20,222,251,
+ 16, 89, 13,226,108,172,116,223,212,156,141,149,151,108, 57, 27, 35,221,219,123,238, 77,248,140, 26, 43,156,141,146,151,154, 34,
+205,219, 73, 63, 15,204,107,203,217, 24,121,201,150,179, 49,210,253,223,193,217, 24,121,201, 30,103, 99,164,123, 71,207,254,191,
+102, 80,145,255,176, 32,176,205,224,125,255,159,  5, 81, 83,137,205,  6, 56, 48,255, 56,103, 35, 63,163,143,106, 57, 27,179,118,
+211,183,177,158, 81, 83,164,119,107,206,198,226,183,229,105,140,231,100,143,243, 65,195,235, 32,156,141,126,239, 15,154,238,255,
+ 46,206, 70,126, 70,141,146,151,108, 56,251, 54,114,101,160,175,213,239,143, 26,147,179,177,242,146,157,112, 62,240,115,178,199,
+249,160,225,117, 16,206, 70,191,247,198,120,135, 52, 21,239,191, 26, 77,213,124,214,216,156, 13,228,254, 87,113, 54,176,121,102,
+ 96, 19, 60,251,127, 52,156,141,201,105, 27,198,198,108,238,105,202,112, 54, 38,103,  3,194,250,175,227,124,216,158,251,255, 99,
+124, 58,226,123,144,102, 41, 71,238,104, 83,132,179, 49, 57,221,228,254, 87,112, 62,192,179,255,215,129,250,127,  9,136, 57,226,
+ 27,185,102,130, 70,118, 96,154, 82,184, 54,102, 56,251, 54,133, 67,216,  4,104,244,112,214,214,148,231, 55,193,189, 63, 44,113,
+202,230, 37, 54, 47,253,223,229, 37,155, 52,217,183, 17,157,162, 70,117,158,109, 57, 27,227, 26,214, 28,141,149, 70,155,250,222,
+ 27, 51, 47, 53,197,179,103,241,  0, 46,  4,203,201,114,178,156, 44, 39,203,201,114,178,156,255, 89,206,127, 37, 72, 54, 10, 88,
+176, 96,193,130,  5, 11, 22, 44, 88,176, 96,193,130,  5, 11, 22, 44, 88, 60, 84,112,216,190, 27, 18, 18,146, 40, 22,139, 91, 58,
+250, 95,169, 84,222,187,119,239, 94, 63, 54, 10,255, 57,176,207,136,197, 67,  4, 18,127, 57,232, 52,  0,166,118, 99,193,130,  5,
+139,127, 53, 28,118,134, 23,  8,  4,145, 55,110,220,136,166,105, 26, 38,147,  9, 70,163,209,242,169,211,233,208,187,119,239,  6,
+119,164, 15, 12, 12, 76,230,112, 56, 45, 26,114,142,201,100,202, 41, 42, 42,234,233,228,144, 84,  0,145,  4,241,151,102, 52,127,
+119,244,  9,160,192, 96, 48,116,114,198, 73, 16, 68,164, 45,159,  3, 46,243,119,167,156,158,158,158,231, 40,138, 10,179,199,229,
+232, 59, 77,211, 89, 37, 37, 37, 61,254,206,103,244, 95, 70, 96, 96, 96, 50, 69, 81, 13, 78,159,133,133,133, 14,211,103,112,112,
+240, 69,146, 36, 67, 26, 64,201,161,105, 58,227,222,189,123, 61,157,  8,145, 84,  0,145, 78,107, 80, 54,233,137, 32,136, 60,147,
+201,212,197, 85, 62,114,198,101, 39,141,186,226,180,136, 44,138,162,150,  5,  4,  4, 76, 85,169, 84, 26,  0, 12,135,195, 97,172,
+194,  6,  0, 48, 26,141, 37, 21, 21, 21, 29,216,148,200,130,  5,139,255,132,208,162,105,154,212,106,181,200,204,204,  4,195,216,
+ 45,239, 77,247,113,189,232,243,191, 31,  9,240,  8,  8,132, 81,175,135,196,207,223,194, 93,116,253, 42,140,  6, 61,140, 58, 29,
+154,119,237,102, 14,  3,218,182,109,203,113,193, 25,182,124,249,242,  0, 15, 15, 15,104, 52, 26,104, 52, 26,104,181, 90,104, 52,
+ 26,232,116, 58,232,116, 58,232,245,122,232,245,122, 24,141, 70,104,181, 90, 36, 37, 37,153, 12,  6,131, 83,206,197,139, 23,  7,
+200,100, 50, 11,159,121, 51,115,154,121, 13,  6,  3, 52, 26, 13,142, 30, 61,234,148,147,162,168,176,130,130,130,  0, 30,143,  7,
+134, 97, 64,211, 52, 24,134,169,179,217, 34, 42, 42, 74,239, 44,144, 77,244,140,254,203,136, 94,188, 99,127,128,167, 72,  0, 35,
+ 77, 35, 33, 46,202,242, 71,214,215,187,193, 24, 77,160,141, 70,180,122,125,188,101,127, 76, 76,140,211,244,201, 48, 76,248,226,
+ 29,251,189,220,229,148,203,229,234, 54,109,218, 20,160,198,109,118, 36,180,194,212,106,117, 64, 45,127, 61, 65, 68,146,100,157,
+237,208,161, 67, 72, 72, 72,112,117,239, 97, 51,103,206, 12, 48, 24, 12,208,233,116,208,106,181, 48, 24, 12, 48, 26,141,150,205,
+100, 50, 89, 54,157, 78,135, 51,103,206,184,235,100, 45, 31, 52,104,208,228,253,251,247, 75,126,253,245, 87, 73,139, 22, 45,192,
+227,241,192,225,112,192,225,112, 64,146, 36, 40,138,194,163,143, 62, 74,176, 73,144,  5, 11, 22,255, 25,161,165,213,106,179,227,
+227,227,153,218,239,161,  2,129,128,103, 83,203, 13,105,213,170, 85,134,237,121,174,154,171, 60,  2,  2, 49,183,153, 15,  0,224,
+195,187,114,203, 11,226,147, 30, 29, 45,199,124,156, 95,  9,  0, 16,137, 68, 32,172,171,209, 14, 32,145, 72, 48,104,208, 32,240,
+249,124,116,233,210,  5, 92, 46,215,238,198,227,241,192,229,114, 93, 70, 10, 65, 16,144, 74,165, 88,176, 96,129, 89, 36, 65, 34,
+ 20, 96,122,143, 46, 16,130,193, 87, 87,111, 65, 71, 51,160, 40,202,178,185,195,201,227,241,112,229,202, 21, 80, 20,  5, 14,135,
+ 99,249, 52,127,223,187,119, 47,158,125,246, 89, 80, 20,  5,145, 72,  4,184,152, 57,216,250, 25,233,116,186, 96, 62,159,175,  7,
+ 96, 22,103, 60,130, 32,130,238,231, 25,253,151,225, 41, 18, 96,194,250, 95,  0,  0,185,171, 94,183, 60,187, 51,175,125,104, 57,
+ 38,252,229,209, 32,  8,  2, 92, 46, 23, 36, 73, 54, 26,103, 89, 89,153,122,204,152, 49,167, 60, 60, 60, 14, 85, 85, 85,193,133,
+128, 67,110,110, 46, 40,138,114,152,222, 73,146,196,202,149, 43,241,231,159,127,186,117,239, 26,141,  6,155, 54,109,130,201,100,
+170,195,107,254,110,187,207, 77,145,181,104,240,224,193,227,247,239,223,239, 77, 16,  4, 62,255,252,115,240,120, 60, 12, 27, 54,
+ 12,190,190,190, 56,124,248, 48,120, 60, 30,222,121,231, 29, 54,241,177, 96,193,194, 89,153,199,  5,208, 17,128,127,173,137, 80,
+ 13,192,203,234,144,146,218, 79,127,243,111,130, 32,210,237,240,116,173, 61,166,132, 32,136,116,171,223, 58,  0,124, 59,251,229,
+  0, 68,181,155, 22, 53,238,127,123,171,235,152,207,131,163,235, 82, 64,205,250, 67,  0,142,  3,232,155,144,144,112,  2,  0, 10,
+ 11, 11,135, 22, 22, 22,  2,  0, 34, 35, 35,111,100,100,100,180, 49,107,158,218,230, 41,158,209,104,140, 54, 55, 85,153,221,162,
+129,  3,  7, 58,173,225, 27,245,250,122,  2,196,158,150,178,215, 92,225, 72,192,232,245,122,140, 30, 61, 26,  0, 28,190,116,172,
+ 55, 55,180, 27,116, 58, 29, 40,138, 66,235,102,254,152, 55, 36, 30,143, 48,  6, 40, 21,  4,140,149, 74,140,144, 26,112,163,109,
+ 39,108,204, 41,193,221, 42,  5, 40,138,114,139,147,166,105,135, 34,139,195,225, 96,253,250,245, 24, 51,102, 12, 56, 28,142, 91,
+124,214,207, 40, 34, 34, 98,127, 70, 70,134, 47, 65, 16,218,218,103, 36, 48, 26,141, 50,163,209,232,107, 50,153,124, 27,242,140,
+254,203, 48,210,180,221,116,232, 40,205,186,243,156,220,225, 44, 43, 43, 83, 39, 36, 36,156, 22,  8,  4, 91,  3,  3,  3, 11,242,
+242,242, 92, 10, 45, 91,241, 99, 91,169, 88,177, 98,  5,214,174, 93,139,126,253,250,185, 21, 78,173, 86, 11,130, 32,176,113,227,
+198,122,255, 45, 92,184,176,222,245, 92,112, 18,  0,200,144,144,144,215, 14, 30, 60, 40, 51, 31,235,231,231,  7, 46,151,139, 14,
+ 29, 58,192,195,195,  3,167, 78,157,130,201,100,114, 59, 95,178, 96,193,226,223, 11,123, 90,196, 10,189,231,206,157,219,101,217,
+178,101, 75,186,119,239,190, 51, 53, 53,117,  7, 65, 16,137, 86,101, 98, 66,109,249,154,104,254,205, 48, 76, 87,107,209, 83, 43,
+214,252,  9,130, 72, 52, 31,111,253,219,252,201, 48,204, 64,  0,124,243,239,185,115,231,182, 95,182,108,217,146, 57,115,230,188,
+183,116,233, 82,222,220,185,115, 99,151, 45, 91,182,196,124, 29,123,225,176,231,104, 57, 93,123,202,220, 68,117,243,230, 77, 71,
+ 77, 84,214, 47,  0,167,165,165,196,207,223,226,100,125, 28,238,107,217,191, 32,175,194,242,  2, 91,215,185, 37, 36, 18,  9,134,
+124,252,169, 91, 78,145, 78,167, 67,113,113,177,197,101,112,181,185,203, 41, 22,  9,145, 52,179,  3,114,229,124,124,148, 86,134,
+253,151,254,  4,151,203,197,227,109, 59, 96, 40,207,  3, 31,132,243, 49,243,214, 29, 24, 24,247,250,244, 50, 12, 99, 87, 96,153,
+191,155,155, 80,220, 21, 90, 54,207, 40, 87,163,209,200, 51, 51, 51,213,116,205,139, 93,196, 48,140, 55, 65, 16,213,181, 46, 87,
+176,187,207,232,191,140,132,184, 40,139,235,116,198, 99,128,101,255,179,202, 43,150,103,242,214,250, 79,  0,  0,253, 58, 61,234,
+ 50, 63,184,195, 41,151,203,213, 61,  7,244, 61, 97, 82,235,182,140, 31, 63, 62,251,216,177, 99, 34,119,194,106, 79,104,153, 93,
+ 91,179,200,162, 40, 10, 58,157,206,173,123,215,233,116, 14,243,  7,143,199,187, 31, 71, 11, 74,165, 82,183,103,207, 30,172, 91,
+183, 14,190,190,190, 24, 60,120, 48,130,131,131,177,123,247,110, 48, 12,131,215, 95,127, 29, 34,145,200,236, 94,179,  9,144,  5,
+139,255, 54,156,105, 17,193,178,101,203,150,216, 10, 25,235,223,214,  2,202, 70, 76, 89,139,181,246, 46,222,255,137,182,226,201,
+124, 93,130, 32, 18,151, 46, 93,154,224, 34, 28, 37,142,132,150,211, 41,241,181, 90,109,118, 92, 92,156, 91,106, 66,165, 82, 21,
+186, 18, 27,246,106,245,214, 46,129, 84, 42,133, 68, 38,  5,233,102,185,107, 48, 24, 44, 66,229,200,145, 35, 16,137, 68, 24, 54,
+108,216,  3, 57, 90,122,189, 30,124, 30, 23,164, 95, 32, 38,172, 58,  6,121,181,218,242,130, 57,158,149,141, 11, 69,197,152,217,
+125,  0, 36,162, 98, 40,116, 58,183,156, 55,154,166,235,137, 44,138,162, 48,122,244,104,139,155, 96,221,111,  5, 78,154, 14,125,
+125,125,207, 81, 20, 21,102,245,140,132,145,145,145,192, 95,253,122,  8,154,166, 21, 94, 94, 94, 63,  3,  8, 97, 24, 38, 12,128,
+135, 59,207,136,133,253,244,105,187,159,182,113,170,238,135, 83, 46,151,171, 19, 18, 18, 78,155,212,186, 45,249,249,249,167,  1,
+  8, 31,121,228,145,  6, 11, 45,179,192,226,114,185, 88,185,114, 37,214,174, 93,107,249,223, 93,161,101, 52, 26,235,  8,168, 91,
+183,110,213,185,150,173,176,115,209,108,202,160,102,116, 33, 29, 25, 25,105, 57, 39, 40, 40,  8, 94, 94, 94,160,105, 26, 52, 77,
+ 67, 40, 20, 66, 36, 18,129,199,227,177,137,142,  5, 11, 22,206,180,136,122,206,156, 57,239, 17,  4,145, 88,235, 44, 93,117, 34,
+168,236,105,143,174, 54, 98,173,196,193,113,  9,246,196,150,245,119, 51,230,206,157,219,222, 54, 28,246,154, 43, 45,165,170,205,
+180,251,117, 96,221, 68,213, 88, 47, 49,103, 47, 50,169,151, 12, 34,137,  4, 28, 14,  9,130, 32, 24, 87, 92,122,189,222, 82,240,
+ 79,157, 58,213,105,191, 21,119,251, 83,233,245,122,144, 20,  7,247,130, 34, 96, 34, 79, 90,206, 53,111, 36,197,197,221,160, 54,
+224,220,188,  8,174,155, 47, 92, 91, 71,235,245,215, 95,199,166, 77,155, 64,146,164, 37, 78, 40,138, 66,171, 86,173,144,157,157,
+237,148,139,162,168,176,187,119,239,  6, 88,199,163, 89,196, 50, 12,  3,147,201,132,168,168, 40, 77,102,102,230,155,108,214,125,
+ 48,145,229,104,191,201, 68,187,237,194,216, 59, 78, 46,151,171, 71,141, 26,117,162,178,178,114, 75,187,118,237,110,161,238, 20,
+  8, 46,249, 40,138,170, 35,176,204, 34,107,205,154, 53,117, 68,145,193, 96,112,171, 34, 96, 48, 24,234,  9,158,207, 62,251,172,
+206, 39,  0,244,232,209,195, 45,103, 24,  0, 67,146, 36,195,227,241, 48,104,208, 32,196,198,198,226,215, 95,127,  5, 77,211,152,
+ 54,109, 26, 68, 34, 17, 86,175, 94, 13,163,209,136,229,203,151,179,142, 22, 11, 22, 44,156,105, 17,237,210,165, 75,175, 46, 93,
+186,212,226, 44,217, 58, 90, 14,222,187,195,107, 69,149,191, 89,164,  1,208,218, 19, 68,246, 92, 50, 91,  1,102,189,111,217,178,
+101, 75,108,195, 97,219, 92, 89, 71,104,253, 93, 40,188,118,  5,159, 62, 22, 15,160,110,115,225,250, 71,219, 64, 34,149, 64,226,
+ 33,197,168,189, 39,  1,160,182,208,159,227,150,163,101, 22, 90,114,185,220,169,200,106,136,163, 69,242, 41,252, 24, 86, 14,134,
+207,  5,165, 51,212, 17, 90, 28,138,139, 92,223,  8,144, 92, 30, 40,147,209, 45, 78,134, 97,234, 53, 21, 78,156, 56, 17,  4, 65,
+ 88, 70,136,197,197,197, 89,115, 17,174, 94,142,179,125,106,250,224,217, 54,199, 46, 47,213,176, 57,246,126,210,231,185,175,113,
+227,167,215,  0,  0, 61,149, 74,203,179, 88, 28,247,215,216,129, 85, 87, 78, 88,220,199,143,241,246,125,113,202,229,114,245, 35,
+ 49,237, 79,243,124, 60,183,228,228,228,156,  6, 64, 62,247,220,115, 94,113,113,113,110,229, 73,243,224, 10, 91,145,101,237,100,
+153, 63, 93,140,176,181, 18,142, 38,183,  4,148,185, 25,209,141, 52,207,152,211,182, 76, 38,131, 84, 42,181,140,184, 21, 10,133,
+ 16,139,197,150,254,157,110, 10, 55, 22, 44, 88,252,119,225,109, 22, 58,181, 98,169,142,211, 84,219,183, 42,193,250,183, 61,199,
+171,214,129, 74,118, 81,190,238,175, 21,104,118, 97,118,214,108,206, 73,116, 36,210, 40,179,130,180,254, 12, 10, 10,250, 77, 42,
+149, 70,184,123,247, 13, 25,197,102, 50,232,235, 57, 91,  4, 65, 64,234, 33,133, 72, 42,129,200, 67,234,208,245,114, 38,180,204,
+ 78,145,249,165,179,117,235, 86, 72,165, 82, 76,154, 52,169,193,125,180, 44, 66,139, 71,226,176,224, 40, 56,124,170,142,200,162,
+ 40, 10, 28, 46, 23,133,210, 96,144, 92, 46, 40,163,123, 46, 89,101,101, 37, 40,138,194,188,121,243, 44, 53,120,107,145,213,144,
+123,118,  6,146, 32,204,238,150,160,101,203,150,111, 19,  4, 17, 14,160,133, 82,169, 20,220,187,119,175, 63,155, 95,157, 40,  3,
+147,161,158, 11,229,200,125,189, 95, 78,179,147,197,243,241,220,210,166, 77, 27,139,147, 37, 22,139,205,163, 77, 93, 63, 99,146,
+180, 43,178,108, 71,  8, 82, 20, 85,147,150, 93,140,142,180,118,180,150, 46, 93,106,225,181,118,178,204,104, 72, 62, 50,135,245,
+196,137, 19,184,112,225,  2,166, 78,157, 10,145, 72,132,181,107,215,194,104, 52, 98,225,194,133, 16,137, 68,224,243,249,108,226,
+ 99,193,130,117,179,234,104, 17, 27,148,216,244,131, 34,108, 68, 77,137, 61,129,101,221, 76,104,254, 78, 16,132,193, 14,175,206,
+166, 73,209,118,191,249, 83,190,116,233,210, 99,102, 39,203,106,127,157,112,184,116,180,  4,  2, 65, 68,102,102,166,101, 34, 76,
+103,159, 58,157, 14,253,250,245,115,219, 25, 51,143, 58,164, 40, 78, 29, 97, 33,246,144, 66, 44,243,128, 72, 42,181, 21, 28,132,
+171, 66,220, 92, 35,182, 22, 90,243,231,207,  7, 69, 81,216,180,105, 19,  0,224,237,183,223,118,187,143,150,153, 19, 38,  2,121,
+204,109,196,175,122, 22,186,239, 12, 40, 74,249,  3, 20, 69, 33,160,219, 80,208,143, 60, 11,149, 72, 10,202,100,116,123,212, 97,
+ 89, 89, 25,178,179,179,193,225,112, 48,107,214,172, 58,115, 29,217,142,100, 59,114,228,136,203,123,183,231,100,205,207, 41,179,
+240,136, 68, 34,242,143, 63,254,136,160,105, 58, 82,173, 86,183,236,209,163,  7,205,102,101, 23,162,136, 54,186, 37,170,220, 77,
+159,182,156,230, 62, 89,149,149,149, 91,114,114,114,206,  0, 32,199,143, 31,239, 37, 22,139,241,205, 55,223,168,  0,240,119,239,
+222, 45,114, 37,138,204,233,198,149,200,226,114,185, 53,105,217,157,123,103,234, 78, 89,226,170, 99,188, 59,105,222, 28, 86,130,
+ 32, 96, 50,153, 32, 18,137,234, 56, 89, 66,161, 16,  2,129,128, 77,120, 44, 88,176,112, 85,150,164,187, 93,142, 51, 76, 87, 43,
+ 81,149,126, 63,188, 13,185,158, 43, 80,142,132,134, 86,171,197,245,235,215,221,229,113,123, 98,204,102, 93, 30,197,199,249,149,
+ 32,  8,  2, 95,245,104,  7,137, 76, 10,177, 68,130,145,191,158,176, 20,220, 87,150,188, 13,129, 68,138,144, 94,131,221, 42,200,
+205, 77,135,214, 66,171,162,162,  2, 92, 46, 23,139, 22, 45,  2, 73,146, 88,190,124, 57, 66, 67, 67,113,239,222, 61,236,222,189,
+219, 45, 71,139, 99,226, 32,248,133, 24,136, 39,122, 66,246, 66,111,120, 15,154,143,124, 29,133, 84,141, 24,189, 53,215,192, 63,
+188,  6, 58,218,228,246,  8, 44,163,209,136, 19, 39, 78,216,118,120,183,244,169, 50, 26,141, 48, 24, 12,208,235,245, 88,190,124,
+185, 59, 35, 60,235, 61, 55,115, 28,214, 78,130,202,201,200,200,240,103, 24,198,  7,128, 39,128, 82, 54,187, 58, 71,112,183,215,
+225,223,229, 85,  0,192,222,165, 47, 90,246,207,187,242, 87,250, 92,249, 93,205,  2,  0,109, 90, 12,110, 16,167, 92, 46, 87, 63,
+222,175, 71,178,134,230,110,238,208,161, 67, 29, 39, 75, 40, 20, 18,181,191,221,178,203, 72,146,  4,135,195,169,215, 92,232, 72,
+108,185,211, 71,203,104, 52, 90, 38, 18,117,214,159,241,126, 28,173, 23, 95,124, 17,193,193,193, 22, 39,235,227,143, 63,134, 72,
+ 36,194,220,185,115, 97, 48, 24,176,102,205, 26, 54,241,177, 96,193,226,111, 23,101,127,  7,236,150,164, 26,141,230, 78,108,108,
+ 44, 28,252, 23, 42, 20, 10,185, 54, 55, 21,210,170, 85,171, 12, 59, 77,136,  3,  1, 36,217, 43,212,  9,130,128,135,204,  3, 66,
+169,  4, 98, 27, 23, 75,232, 33,131, 64, 42,  5,201,179, 91,152,215,227, 52,247, 45,177, 22, 90,230,173,178,178, 18, 92, 46, 23,
+235,214,173,131, 76, 38,131, 86,171,117,201,105,126,233,112, 56, 28,168,114,171,113, 99, 73, 18,248,194, 84,180, 28, 60,  6,193,
+ 92, 17,120,167,126,134,218,100,112, 53, 97,105, 61,206,232,232,104,124,248,225,135,245,166,117,112,132,208,208, 80,151,247,110,
+235,100,173,108,215, 28, 60, 62, 15,111, 93,203,133, 86,171, 37,198,140, 25, 67,  3, 80,  3, 40, 81,171,213, 57,238,196,103, 35,
+224,161,231,116, 54, 42,214, 12,154, 49,217, 19, 48,118, 57,205, 78,150,134,230,110,206,206,206, 54, 59, 89,158, 98,177, 24, 27,
+ 54,108, 80,  1, 32, 23, 46, 92, 40, 14, 15, 15,231,184,147,150, 56, 28, 14, 86,173, 90,101,183, 79,150, 61,209,213,144,124,100,
+125,110,159, 62,125,236, 78, 88,234, 64,188,213,227, 52,135,213,215,215,215,226,100,153, 76, 38,203,104, 67,243,236,243, 78, 42,
+ 21,108,250,100, 57, 89,206,255, 14,231,191, 18,118, 75,224,123,247,238, 61,238,232,132,168,168,168,204,204,204,204, 86,230,165,
+ 56,106, 11, 78,158, 70,163,137,238,209,163,135, 75,107,135,166,105,  8,  4,  2, 48, 12,131,254, 31, 46,  3, 65,  2, 36,234,190,
+196,  2, 30, 27,  0, 14,135,  2, 93,179,212,135,203, 81,135,106,181,186,206,203,193,222,166, 80, 40,160,213,106,221,158,205, 91,
+163,209,212,153,130,129, 96,104,220,253,125, 87,189,209,135,230,205,221,126, 59, 66,161,176, 78,211,143, 11,199,138,112,199,209,
+178,110,122,228,241,121,160,120, 92,179,163, 85,125,235,214,173, 81,108, 50,119, 31,230,  1, 11,  0,208,186,199, 48,208,180,  9,
+140,201, 84,103,153,164,152,136,199, 65, 51, 38,232, 13, 42,104,181, 90, 87,211,158, 16,165,165,165,234, 81,163, 70,157,  0,240,
+237,136, 17, 35, 50, 80, 51,187, 48, 35,149, 74,  5, 92, 46,151,  6, 80,  6,128, 41, 47, 47,247,204,207,207,167, 53, 26, 77,115,
+ 87,225,220,191,127, 63,174, 95,191,142, 94,189,122,213, 89, 14,202,236,138, 90,207,238,238, 78,250, 52, 55,151,219,155, 17,222,
+145,144,115, 23, 28, 14,  7,158,158,158,224,241,120, 88,180,104, 17,120, 60, 30,196, 98, 49,  0, 96,205,154, 53,150,201, 87, 89,
+176, 96,193,226, 63, 35,180, 92,149,155, 78,154, 21,157, 54, 33, 26,141,198,188,240,240,240,  6, 93,204,100, 50, 21,185, 16,110,
+121,187,119,239,230, 89,187, 16,174, 62, 25,134, 41,114,241,178,205,219,187,119, 47,207,158,187,225,104,129,105, 87,156, 38,147,
+ 41,175, 69,139, 22, 14, 29, 19,123, 48, 24, 12,249,174, 68,235,178, 18,117, 29,145,240,214,181, 92,135,107, 39,178,112,153,214,
+156,164,207,247,239, 55,125,222,106,221,186,117,190,151,151,215,129,192,192, 64,121, 74, 74,138,111,215,174, 93,125,173,143,233,
+218,181,107,176,205,105, 58, 56, 94,231, 16,  4, 65,228,141, 24, 49,194,110,154, 55,139, 38, 59,233, 51,207, 85,154, 63,123,246,
+ 44,207,250,124, 71,252, 86,249, 40,207, 13,225,122, 55, 62, 62,158,180,230,113,148,246, 13,  6, 67,  9,155, 10, 89,176, 96,241,
+159, 23, 90,106,181, 58, 55, 54, 54,214,232,224,191, 28,103,231,202,229,242, 46,141,125,  3,  6,131,161,199,195,192, 89, 90, 90,
+218,168,247,110, 52, 26,243,106, 39, 40,117,122, 12,155,196,255,185,103,  4,  0,197,197,197,143,  0,128, 82,169,132,171,101,117,
+ 26, 32,  8, 27, 61,125, 26,141,198, 30, 77, 17,167,101,101,101,221,217,148,197,130,  5, 11, 86,104, 53,  0,236, 98,196,255, 31,
+104, 10,209,202,130,  5, 11, 22, 44, 88,176,104, 92,144,108, 20,176, 96,193,130,  5, 11, 22, 44, 88, 52, 13,  8,212,140, 28,176,
+135,134,140, 38, 24,120, 31,215, 78, 98, 57, 89, 78,150,147,229,100, 57, 89, 78,150,243, 63,199,233,138,155, 29,205,216,196,  2,
+140,229,100, 57, 89, 78,150,147,229,100, 57, 89,206,255, 30,231,191, 18,108,211, 33, 11, 22, 44, 88,176, 96,193,130, 69, 19,129,
+ 98,163,224, 31,  3,  7, 13,152, 81,223, 21, 24,134,241,  6,224,104,193, 56, 29, 65, 16,229,247,193, 73,  0,224,213,110,230,137,
+142, 12,  0,244,  0,244,  4, 65, 48,174, 57, 62, 34, 11, 10,188,219, 51, 38,110, 87,134, 32,184, 52,141, 75,205,155, 55,187, 72,
+ 16, 67,117,  0, 32,  9,140,105, 43,149,136,  6,106,245,186,  8,  1,151,127,189, 66,169, 56,162, 45,206,188,195, 38, 15, 22, 44,
+254, 17, 60,  1, 96,  1,106,186,149, 44,  5,176,139,141, 18, 22, 44,154, 72,104, 73,165,210,115, 36, 73,134,185,154,159,199,140,
+218,181,204,242,202,203,203,187, 52,224,218,163,164, 82,105, 63, 46,151,251, 24,  0, 24, 12,134, 20,133, 66,113, 12,192,110,  0,
+198,251,188, 39, 25,128,209,  0,198,213,254,254,190,182,176,168,186, 79,190, 88, 79, 79,207,159,184, 92, 46, 83, 90, 90,218, 13,
+  0,124,125,125, 79, 27, 12,  6,162,170,170,106, 36,128,203, 13,228, 35,185, 92,238,202,110,221,186,245, 62,121,242,228,183,  0,
+214, 53,210,179, 20,144, 36,105, 87,160,208, 52,221,226, 62, 68, 22, 15,128,231,186,117,235,124,183,111,223, 30,159,151,151,215,
+  1,  0,194,194,194,174,140, 31, 63,254,226,244,233,211,229, 12,195, 84, 18,  4,161,119,198, 83, 80,224,221,190,184, 48,107,106,
+ 81,241,245,209,  0, 16, 20,220, 97, 23,135, 67,242, 24,230,124,154,216,111,156, 95,171,150, 45, 94,221,249,205, 58, 94,139,136,
+102, 56,154,122,161,227,244, 55,223,107,159, 15,172, 96,197,214,223,  7, 15, 15,143,115, 36, 73,134, 57,203,227,246,242,188,201,
+100,202, 43, 43, 43,235,226,136,147,162,168, 48,103,229,133,189,125, 52, 77,103,149,150,150,218,157,106, 66, 38,147,165, 81, 20,
+ 21,225, 46,151,249,211,104, 52,230, 57, 26,165, 43,147,201,206,113, 56,156, 48,103,247,105,239, 63,154,166,179, 74, 74, 74, 28,
+133,179,222,189, 55, 70, 56,239,135,211, 89, 56,205,229, 17,128, 53,190,190,190,143,202,229,242,231,  1,188, 87, 85, 85, 21,199,
+225,112,224,227,227,243,158, 78,167,251,211,211,211,243,235,202,202,202, 84,  0,111,  2, 96,215, 75,101,193,162,177, 32,147,201,
+138, 20, 10,  5, 99,  6, 77,211,140,193, 96, 96,180, 90, 45,163, 86,171, 25,165, 82,201, 40, 20, 10,166,170,170,138,169,172,172,
+100,228,114, 57,227,239,239,111, 59,121,163,163, 54,220, 14, 50,153, 44,115,217,178,101,218,236,236,108, 70,175,215, 51,122,189,
+158,185,115,231, 14,243,233,167,159,106,101, 50, 89, 38,128, 14, 14,206, 29,232,160,176, 24,  4, 96, 71,124,124,188,110,255,254,
+253,140, 70,163, 97,148, 74, 37,179,107,215, 46,166, 93,187,118, 58,  0, 59,106,143, 33,221,228,  4,128,158, 65, 65, 65,121,183,
+111,223, 54, 29, 57,114, 68,239,233,233,153,228,233,233,153,116,231,206, 29,211,237,219,183,105, 63, 63,191, 60,  0, 61, 27, 16,
+ 78,  0,120,246,173,183,222, 42,186,115,231, 14,211,167, 79,159, 75, 86,251,  9,184, 94,231,110,160, 61, 39,139, 97,152, 32,134,
+ 97,130, 81, 51,201,101,189,141, 97,152,224,218, 99,188,221,228,148,100,101,101, 53, 11, 12, 12, 92, 70, 16,132,206,150,143, 32,
+  8, 93, 96, 96,224,178,172,172,172,102, 12,195, 72,156,113,230,229,172,127,233,192,254,  1, 21,202,242,155,140,178,252, 38,243,
+237,230,190, 85,175, 76,127,126, 71,112, 84,167, 77, 94, 97,237,215, 93,191,121,107, 35,195, 48, 27,143,165,103,110,156,255,229,
+111, 27,159,158,190,122,131,111,120,252, 43, 13,136,207,  7,  1,203,  9,192,203,203,171, 80,169, 84, 50, 12,195, 48, 38,147,137,
+209,235,245,140, 86,171,101, 84, 42, 21,163, 80, 40,152,234,234,106, 75, 62,175,172,172,180,124, 15,  8,  8,112,152,223,189,189,
+189,139,212,106,117,157,178, 67,167,211, 89,202, 15,149, 74,197,168, 84, 42, 70,169, 84, 90, 54,133, 66,193,132,132,132,228, 58,
+  9,231, 61,115, 56,105,154,102,140, 70, 35,163,215,235, 45,188, 26,141,166,206,166,213,106, 25,173, 86,203,132,135,135,187, 29,
+ 78,119, 56, 53, 26, 13, 19, 22, 22, 86,224,136,211,199,199,167, 72,163,209,212,225,180,190,127, 91, 94,243,239,160,160,160,194,
+134,112,186, 19, 78,103,241, 89,139,117, 25, 25, 25,140, 90,173,102, 66, 67, 67,229, 35, 71,142, 52,152, 76, 38,102,255,254,253,
+ 76,124,124, 60,221,183,111, 95,125,105,105, 41, 51,105,210, 36,198, 73,165,144,205, 71, 44, 39,139,251,113,180,  8,130,128, 68,
+ 34,193, 15, 63,252,224,112, 57, 14,235,239,205,155, 55,119,247,154, 93, 34, 34, 34, 78,156, 58,117, 74, 20, 28,252,215,132,216,
+ 58,157, 14,222,222,222,152, 54,109, 26,255,137, 39,158,104, 53,120,240,224,211,119,239,222,237,  3,224,156, 11,190,103,252,253,
+253, 63,159, 55,111, 94,224,115,207, 61,  7, 95,223, 58,147,110, 99,212,168, 81, 24, 57,114, 36, 47, 35, 35, 99,204,214,173, 91,
+199,172, 95,191,190, 80,161, 80, 76,  7,240,179, 51, 82,145, 72, 52, 34, 36, 36,100,195,169, 83,167,  2,  2,  2,  2, 16, 25, 25,
+ 73,190,243,206, 59,173,162,163,163, 69, 97, 97, 97,228,189,123,247,240,235,175,191,134,142, 29, 59,246,199,162,162,162, 87,245,
+122,253, 30, 55,238,157,239,235,235,251,222,171,175,190,234, 87, 85, 85,101, 60,127,254,124,166,121, 63,159,207, 95,216,189,123,
+247,174,199,143, 31,255, 14,192,215,247,227,100, 49, 12, 83,133,191,154,248,204, 48,152,255,119,199,217, 98, 24,134,127,233,210,
+ 37,159,238,221,187,255,172,213,106, 59, 77,157, 58, 53,103,201,146, 37, 34,153, 76, 38,  3, 64, 84, 85, 85,149, 47, 88,176, 64,
+183,122,245,234,119,219,182,109, 59, 32, 45, 45,237, 25,134, 97, 12,181,130,172, 62, 31, 65, 88,194,147,155, 95,130, 19,169, 52,
+255,195,185,111,135,125,178, 56,226,110,250,181, 92,154, 18,201,176, 47,249, 42,138,228, 10,252,150,118, 13, 65,190, 30,  4, 79,
+192,109,239, 25,218,174, 79,101,254,181,100, 56,153, 33,157, 69,227,128, 32,  8,136,197, 98,236,219,183,175,222,210, 85,246,150,
+181,162, 40, 10, 94, 94, 94, 46, 87, 55, 16, 10,133, 56,114,228,136,221,181, 23,237, 45,233,227,233,233,  9,103,149, 13,130, 32,
+ 32, 20, 10,145,146,146,  2,146, 36,237, 46, 13,100,187, 79, 34,145,128,116,178,214,149,153, 51, 57, 57,217, 37,151,249, 83, 42,
+149,  2, 53, 77,255,142, 51,165, 64,128, 83,167, 78, 57,188,103,219,239,210,218,245, 94, 93,113,166,164,164,212, 89,250,203,118,
+ 73, 48,235,223, 18,137,  4,132, 11, 82,111,111,239,110, 97, 97, 97, 56,123,246, 44,118,239,222,237,211,190,125,123,220,186,117,
+ 11,  4, 65, 96,201,146, 37, 68,187,118,237,184,133,133,133,232,213,171, 23,126,249,229,151, 30, 85, 85, 85,108,134, 97,241,143,
+128, 97, 24, 46,128,142,  0,252, 81,211,237,166, 26,128, 23,106, 86,210,224,  3,144,  3, 16,213,110, 90,  0, 10,  0,126,181,167,
+151,214,150, 45,214,  2,161,196,122,241,105,134, 97,186,214,114,155, 87,168,240,183, 58,214,124, 13,219,223,182,159,118,185, 41,
+  0, 72, 76, 76, 52,191,204,250, 38, 36, 36,156,176,190, 57,119, 68,150,121,157, 50, 59,121,218,118,136,166, 64, 34,145,252,116,
+250,244,105,145,191,255, 95,247,160,213,106, 81, 93, 93, 13,133, 66,129,234,234,106,120,120,120, 96,247,238,221,162,  1,  3,  6,
+252, 84, 93, 93, 29, 93, 27,105,142, 56, 87,221,187,119, 47,208,104, 52,130,207,183,223, 69,137, 36, 73,196,196,196,224,189,247,
+222,195,144, 33, 67,130,250,245,235,183,202, 70,104,213, 27, 74, 42, 22,139, 55,156, 63,127, 62, 64, 44, 22, 35, 51, 51, 19,121,
+121,121,120,235,173,183,154,209, 52,141,220,220, 92,220,186,117, 11,249,249,249,216,186,117,107,192, 83, 79, 61,181,193,142,208,
+178, 55, 60,117,234,204,153, 51,219,120,123,123,147,159,126,250,105,133, 82,169,252,162,118,255,135,107,215,174,125,161,119,239,
+222,  1, 83,166, 76, 97, 82, 82, 82,182,215, 62, 56,135,241,105,221, 39,171,182,153, 15,181,137,239,134,205, 57, 49, 86,255,131,
+ 97,152, 32,  0, 90,130, 32, 42,236,112, 18,  0, 60,  7, 15, 30, 60, 75,171,213,118, 58,117,234,212,159,143, 61,246, 88, 56,128,
+123,230,196,231,233,233, 41, 89,181,106, 85, 96, 66, 66, 66, 70,255,254,253, 59, 13, 30, 60,120, 86, 73, 73,201, 18,134, 97, 74,
+172,250,108, 89, 56,105, 26,151,130,130, 59,236, 74, 78,155, 62,250,120,138,142,247,246,155,243,115,154, 55,107, 81,121, 41,179,
+204,116, 45,171,  4,213,106, 35,158,238, 95,179,128,121,183, 14,205,241,249, 15,167, 48,109,198,251,220,159,119,109, 27,249, 39,
+  3,137,162,224,218,126, 39,241,249,160, 96, 57, 97,105, 98,  2,151,203,197,208,161, 67, 65, 16, 68,189,181, 60,185, 92, 46,210,
+210,210,208,191,127,127,112,185, 92,188,248,226,139,110,113, 82, 20,133,193,131,  7, 91,214, 81,180,230,179, 21, 13, 14, 52, 65,
+146, 77, 97, 11,138,162, 64,146,164,195,133,180,109, 57, 93,149, 75,230,112, 58,227,178,254,207, 85, 56,107,151, 60,114, 91,100,
+185,203,105, 14, 39, 69, 81,232,209,163,  7, 46, 94,188,232, 84,116, 57,208,151,117,238,189,188,188,124, 66,116,116,116,242,186,
+117,235,124,  0, 64, 46,151, 91, 22,188,231,112, 56,184,121,243, 38,116, 58, 29, 62,250,232, 35,125, 85, 85,213, 20, 54, 31,177,
+156, 77,201,233, 76,139,  0,232, 61,119,238,220, 46,203,150, 45, 91,210,189,123,247,157,169,169,169, 59,  8,130, 72,100, 24, 38,
+193,252, 57,119,238,220,246,203,150, 45, 91, 50,103,206,156,247,150, 46, 93,122,149, 32,136, 68,  0,176,253, 93, 91,150, 36,216,
+136, 56,127, 51, 79,109,158,171,115,172,189,223,182,159,246,184,235, 56, 90,  9,  9,  9, 68,237, 77, 18,214,133,154,187, 66,203,
+157,181,251, 40,138,122,125,201,146, 37,129,206, 68,150, 66,161, 64, 65, 65,  1,194,195,195,241,226,139, 47,  6,174, 91,183,238,
+117,163,209,248,153, 19, 90, 30,135,195,193,217,179,103, 81, 92, 92,140,216,216, 88, 68, 68, 68,212, 57,224,246,237,219, 56,112,
+224,  0, 42, 42, 42,208,185,115,103,160,166,115,183, 93,196,197,197,125, 20, 19, 19, 51,152, 36, 73,163, 72, 36,194,165, 75,151,
+208,169, 83, 39,252,240,195, 15,104,222,188, 57,196, 98, 49, 50, 50, 50, 16, 27, 27,139, 19, 39, 78,192,223,223, 31,241,241,241,
+198,170,170,170,147,101,101,101,199,238,222,189,251,145,163,112,134,134,134,206,127,229,149, 87,248,  5,  5,  5,244,150, 45, 91,
+ 78,  1, 56,  5,224,245,247,223,127,127,242,144, 33, 67,  2, 46, 92,184, 80,153,158,158,126,198,129,200,114,199,201, 50,218,190,
+148, 76, 38,147, 86,173, 86,235,180, 90,173,129, 36,201, 59,  4, 65,232, 76, 38, 83,180, 35, 19, 98,226,196,137, 81,165,165,165,
+211,102,204,152,145, 93, 43,178,110,162,166,  3, 60,  0,192,104, 52,106, 21, 10, 69, 85,247,238,221,195,199,142, 29,251,231,142,
+ 29, 59,166, 77,156, 56,113,247,150, 45, 91, 20,  0,212,182,132,205,155, 55,187,200,225,144, 60,101,181, 79,214,143,187,191,158,
+121, 96,239,235,205,114,115,243, 91,249,250,249, 43,121, 82,255,130,221,223,111, 62,  7, 64, 87, 80, 82,133,203,183, 11,193,229,
+114,112, 61,183, 18,189, 31, 31,197,253, 51,115,113, 79,  0,251,217,186, 92,211, 87, 22,205,139, 80, 31, 63,126,220,169,163,149,
+150,150,  6, 46,151, 11,145, 72,132,213,171, 87, 59, 37, 53, 11,  3,179, 91,228, 74,204,152, 23, 71,119,230, 62,209, 52,109, 89,
+232,221,118,251,226,139, 47, 48, 99,198,140, 58,215,168, 21, 27,132, 43, 78, 71,225, 11,111,209,  2,197, 69, 69,117,246,185,179,
+ 40,189,201,100,  2,151,203,197,166, 77,155,144,144,144,128,196,196, 68,167,159, 67,135, 14,  5, 73,146,140, 59,241,217,163, 71,
+ 15,232,245,122, 75,152,111,222,188,105,151,119,253,250,245,174,130,249,  4,128,  5,157, 58,117,146,245,235,215, 15,201,201,201,
+ 24, 57,114,164, 86,175,215,103,  2,192,240,225,195, 91,175, 91,183,142,127,254,252,121,248,250,250,114,115,114,114,190,  5,219,
+ 65,158, 69, 19,195,158, 22, 49,191,243,150, 45, 91,182,196, 86,196, 88,195,252, 63, 65, 16,137, 75,151, 46, 77,176, 22, 69,214,
+191,205,174,147,141,136,107,111,237, 72, 89,139, 40, 71,  2,202,230,125,107,125,124,137, 93,161, 85,123, 99,125,173, 93, 32,115,
+225,235, 74,100, 57,169, 57,214,129,167,167,231,176,167,159,126,218, 34,114, 52, 26,141, 69, 96,153, 69,150,249,119, 70, 70,  6,
+186,116,233,194,243,244,244, 28, 38,151,203, 63,115, 67,196, 33, 36, 36,  4,165,165,165,184,114,229, 10,194,195,195, 97, 48, 24,
+112,232,208, 33, 84, 86, 86,130,203,229,130,199,227, 65,175,119,218,119, 27, 49, 49, 49, 67,183,111,223,222,101,219,182,109,229,
+230, 26,221,247,223,127, 15,134, 97,224,239,239, 15,149, 74,133,162,162, 34, 28, 59,118, 12, 70,163, 17, 82,169, 20,145,145,145,
+252, 17, 35, 70,244, 92,176, 96,  1,215,137,208,234, 49,114,228, 72, 79,153, 76,134, 55,223,124,147,209,235,245, 75,107,247,205,
+159, 62,125,186,239,157, 59,119,116, 47,189,244,210, 89,189, 94,255,169,217, 76,180, 22, 56, 14, 30,172, 67, 39,203, 96, 48,152,
+227, 52, 91,161, 80,192,207,207, 47,220,218,217,114, 36,  6, 83, 82, 82,122,  0,224, 44, 92,184, 80,  8,160,200, 58, 12, 58,157,
+ 14, 10,133,  2, 74,165,210, 80, 89, 89, 89, 60,123,246,108,227,142, 29, 59, 56,181,231, 92,183, 39,180,  8, 98,168, 78, 38, 19,
+243, 25,134,243,254,198,141, 27,165, 67,134, 12, 33,165, 82, 41,170,171,171,101,191, 29, 60, 40, 29,208,175,103,228,146,101,159,
+ 28,150,133,197, 22,165, 92,202, 66,126, 97, 37,116,  6,  3, 34,131, 61,107,252, 48, 22, 77,142,218,129, 44, 22, 71,203, 90, 84,
+ 36, 39, 39,227,241,199, 31,183,228,117, 30,143, 87,199,249,114,197, 73, 81, 20, 30,127,252,241,122, 14,207,241,227,199,237,186,
+ 79,174, 96, 45,138,108,197,145, 61,  1, 70,146,164,203,  5,214,205,110,158, 61,177,101,237,234,219,136, 55, 87,205, 28,160, 40,
+ 10,211,167, 79,  7,151,203,197, 59,239,188,  3,138,162, 16, 31, 31, 15,138,162,208,189,123,119,112,185, 92,244,239,223,191,193,
+247,126,250,244,105,116,234,212,201, 18,166,248,248,120,116,237,218, 21, 20, 69,161, 87,175, 94,224,114,185, 24, 60,120,176, 59,
+156,239, 85, 87, 87,199, 73, 50,  7,  8,223,  0,  0, 32,  0, 73, 68, 65, 84,165, 82,100,100,100,128,195,225,128, 32,136, 91,  0,
+226,  0, 32, 56, 56,248, 79,149, 74, 21,165,209,104,240,202, 43,175, 16, 58,157, 46,246,157,119,222,121, 95,163,209,176, 66,139,
+ 69,147,193, 86,139, 88, 65, 61,103,206,156,247,  8,130, 72, 52, 59, 84,182,206,147,189,223,118,202, 38,179,  3,149, 94,155, 87,
+187,218,136,184, 18,130, 32,210, 25,134, 25,238,232, 92,  0, 58, 27, 97, 85,167,233,208,186,217,208,165,163,101, 46,124,221, 21,
+ 90,174,160,209,104, 58,  6,  4,  4, 56, 20, 89,214,159, 58,157, 14, 17, 17, 17,208,104, 52, 29, 27,250,210,  8, 14, 14,134, 94,
+175,199,215, 95,127, 13, 30,143,  7, 30,239, 47,125,161,211, 57, 55,139,174, 93,187,150,125,250,244,233, 78,157, 59,119,246,254,
+229,151, 95, 74,250,244,233,227, 63,100,200, 16,136, 68, 34,168,213,106, 24, 12,  6,116,235,214, 13, 49, 49, 49,200,203,203,195,
+111,191,253, 86, 26, 29, 29,237,119,230,204, 25,186,176,176,240,174, 19,234, 65,  3,  6, 12,  0, 65, 16, 56,120,240, 96, 41,128,
+116,129, 64,112, 96,241,226,197,222, 58,157,142, 30, 63,126,124, 78, 89, 89,217, 12,  0,122, 62,159,191,182, 79,159, 62,221,147,
+146,146,190,163,105,122,117, 67, 19,170,109,220, 42,149, 74,  8,133, 66,119,166,146,224,150,149,149,117,  0,  0,137, 68,226,  3,
+224, 79, 75, 10, 87,171,235,136, 97,157, 78,167,241,241,241,145,  0, 64,237, 57, 92,  7,156,254, 70, 35,126,188,123, 55,203,195,
+186,255,156,151,151, 23,198,141, 29, 75, 62,214,163,  7, 63,174, 99,199,193, 31,172,216,246, 67,136,175, 76, 23, 25,226, 11,131,
+201,128,164,195,135,104,134, 54, 28,102,139,157,191, 71,104,153,197,134,173,163,197,229,114,113,226,196,137,122,251,120, 60, 30,
+190,250,234, 43,183,132,129, 89, 84, 57,106, 58,179,105,234, 34, 92,  9, 24, 46,151, 11, 14,135,131, 77,155, 54,129,166,105,204,
+156, 57,179, 78,115,162, 53,191, 91,118,158,149,  8,140,153, 79,  3,208, 33,111,165,192,114,190,109,120,107,207,113,203, 37, 91,
+183,110,157, 91,142,214,240,225,195, 93, 10, 87,235, 22,  6,235,112, 93,188,120,209, 46,239,198,141, 27, 93,198,167,201,100,194,
+254,253,251, 45, 34,213,140, 15, 62,248,224, 21, 62,159, 31,120,242,228, 73, 20, 22, 22, 66,169, 84, 66,161, 80,160, 91,183,110,
+145, 36, 73, 94, 42, 44, 44,188,115,253,250,245,167,217,220,195,226,111,116,180,180, 75,151, 46,189,186,116,233, 82,187,142,149,
+173,179,228,204,121, 50, 11,172, 90, 65,228,111, 22,111,168,233, 86,147,238,234, 92,  0,124,219,166, 67,167, 70,144,141,138, 92,
+ 96,175,240,117,167,249,208, 77, 59,157, 34,  8,  2, 26,141,198,174,192,178, 22,  7,122,189, 30,101,101,101, 48,153, 76,247, 61,
+215,151,189,154,172, 43,161,117,229,202,149, 73,147, 39, 79, 46,240,244,244,140, 43, 41, 41, 41,166,105,186,127, 90, 90,154, 63,
+ 69, 81,144,201,100,144,201,100, 56,112,224,  0,196, 98, 49,166, 79,159, 94,108, 50,153,146, 61, 60, 60,124,213,106,245, 31,133,
+133,133, 31, 56, 84, 48, 92,238,224, 94,189,122,225,252,249,243, 40, 47, 47, 63,  2, 32,254,249,231,159,127,188, 89,179,102,196,
+226,197,139, 53,183,111,223, 94, 13,160, 88, 34,145,108,223,190,125,123,191,206,157, 59,123,140, 31, 63, 30, 39, 78,156,216,  8,
+ 64,227,238, 61, 43,149,202, 58,  2,171,170,170, 10,213,213,213,144, 72, 36, 70, 55,227,140,139,191, 70, 24,130, 97, 24,203,179,
+169,117,179,204,207,135,161, 40,202, 60,170,209,145,200,130, 68, 34, 89,184,109,219, 54,145,237, 32,  5,147,201,132,162,162, 34,
+200,100, 50,204,251,224,  3,222,199,111, 77,233,196,145,  6,166,145, 36,  1,157,158,169, 96,104,221, 33,101,209,115, 39,129,143,
+216,146,231,111,128, 89, 24, 60,249,228,147,245,154, 11,121, 60, 30,142, 28, 57,130,167,158,122,202, 82,113,233,220,185,179,203,
+202,149, 89, 24, 60,241,196, 19, 22,103,232,208,161, 67,118,155,253,204,142,148, 59,130,208,124,236, 27,111,188,  1,138,162,240,
+249,231,159, 99,214,172, 89, 32, 73, 18, 43, 87,174,  4, 73,146,248,240,195, 15,221, 22,153,214,  2,230,206, 39, 53,159, 97,179,
+170, 32, 95, 31,  8,  0,240,144,201,204, 55,212,160,178,135,162, 40,139,147,213,177, 99, 71,112,185, 92,116,239,222, 29, 20, 69,
+ 89,156,172, 97,195,134, 89,199, 35,227, 14, 39, 69, 81,200,204,204,180,132,185,123,247,238,117,156, 44,138,162, 48,124,248,112,
+119,130,185,196,203,203,107, 65, 76, 76, 76,219, 85,171, 86,113, 57, 28, 14,  6, 12, 24,208, 58, 40, 40,232,174,209,104,244, 93,
+184,112,161,216,206, 57, 34,  0,113,109,219,182,149,176,185,134, 69, 19, 58, 90, 11,236,252,229,109,221,231,170,  1, 21,201, 68,
+235,227,205, 28,182,226,168,214, 33, 75,118,197,101,239, 92, 87,160,204, 10,210,153,165,238,142,208,170,181,157,157, 94, 76, 44,
+ 22, 95, 46, 46, 46,238, 46, 18,137,234,136, 44,123,130,139,195,225,160,176,176, 16, 98,177,248,178, 86,171,109,180,135,232,170,
+233, 16,128,230,214,173, 91,111, 89,253, 30, 56,108,216,176, 45, 71,142, 28,  9, 78, 74, 74,194,153, 51,103,224,239,239,143,117,
+235,214,221, 43, 42, 42,154,  4,224, 72,105,105,169,203,235, 70, 69, 69,117,144, 74,165, 72, 73, 73,  1,128, 19,  0,166, 76,155,
+ 54,141, 48, 24, 12, 88,191,126,189, 18,192, 65, 47, 47,175,253,187,119,239,238, 20, 23, 23,199, 79, 74, 74,170, 58,115,230,204,
+239,110,138, 44, 19, 77,211,245,  4,150,117,156,122,120,120,184,227,104, 25, 60, 61, 61,175, 84, 85, 85,141, 82,171,213, 85,  2,
+129,192,163,170,170, 74,107, 45,176,204,252, 20, 69,113, 51, 51, 51, 11,  0, 68,122,122,122, 94,129,131,102, 78,138,162,  6, 12,
+ 24, 48,128,178,125,  6, 69, 69, 69, 40, 44, 44,132, 94,175, 71,231,206,157,  9, 14, 97,224,148,231, 94,182,153,214,129, 21, 89,
+127,147,163,197,152,243,186,121,148,160,189,145,134,135, 14, 29,178,252, 38, 73, 18,155, 55,111,118, 75, 20, 29, 57,114,196,105,
+135,117,155,166, 67,151,214,184,249,248, 47,191,252, 18, 12,195, 88,156, 44,146, 36, 49,103,206, 28,  8,  4,  2, 44, 94,188, 24,
+115,230,204,  1, 69, 81, 46,155, 14,173,  5, 76,139,119, 84,214,149,163,154, 76, 81,219, 31,138, 32,  8,107,177, 69,184, 43,222,
+156,185,121,238,180,  4, 88,115,154,207, 19, 10,133, 14, 59,194,219,112, 58,187,192, 62,  0, 89,193,193,193, 41,221,187,119,247,
+ 60,119,238, 28, 86,174, 92,201,211,106,181,205,147,146,146, 44,215,181, 23, 95, 74,165, 82,196,230, 28, 22, 77,225,102, 57,249,
+187,196,166,127, 21, 97,221,140,231,228,211,246,120, 88,237,179,230, 45, 33,  8,194, 96,231,122, 37,118,196,149,237, 53,172,143,
+ 41,113,232,104,185, 42, 44, 92,  9, 46,119, 28, 45,149, 74,245,251,193,131,  7,187,142, 29, 59,150,114,214,108,168, 84, 42, 17,
+ 24, 24,136,171, 87,175, 26, 85, 42,213,239,110, 56,101,141, 41,180,108,145, 84, 92, 92,204, 49, 24, 12,104,213,170, 21, 66, 67,
+ 67,161,209,104, 80, 81, 81,193,  1,112,196, 77, 14,158, 68, 34,225,  0, 64, 69, 69,  5, 80, 51,212,180,117,116,116, 52,206,159,
+ 63,143,178,178,178,159,  1, 12, 89,176, 96, 65,231,110,221,186,241,126,248,225,  7,213,212,169, 83,127, 54, 24, 12,110, 41, 13,
+154,166,117, 70,163, 49,130, 36, 73,125, 69, 69, 69,190,117,124,  6,  6,  6,250, 72, 36, 18,162,168,168,200,224,142,208,138,139,
+139, 59,155,147,147,131,133, 11, 23,150, 44, 89,178, 36,186,186,186,186,188,178,178,210,104, 45,182, 52, 26, 13,233,231,231, 39,
+ 88,191,126,189,  8,  0,226,226,226,206, 58, 18, 90, 74,165,178,153, 88,252, 87,197, 88,171,213,162,176,176, 16,133,133,133, 40,
+ 42, 42, 66,117,117, 53, 34, 35, 35,161, 82,169,194,217, 98,230, 31, 19, 90,117,154,207,172,243,183,245,139,188, 33,121,221, 90,
+192, 60,249,228,147,150,190, 93,102,135,204,188,253,248,227,143,182, 29,204,221, 18, 90, 95,126,249, 37,222,120,227, 13,  8,133,
+ 66,172, 90,181,170, 78,211,161,173, 56,160,105,154,112,231,222, 35,222, 85,163,112,173, 15,184, 92, 46,124,167, 22,213,105,162,
+179, 35, 56,220, 10,231,146, 37, 75, 26,165,233,208,154, 51, 60,188, 38,171,108,218,180,  9,163, 70,141,194,201,147, 39,239,187,
+233,176,125,251,246,223, 39, 38, 38,122, 94,187,118, 13, 85, 85, 85, 40, 41, 41,129, 86,171, 69, 94, 94,158,195, 86,129,218,178,
+ 92,200,230, 28, 22,127,115, 57,149,254,119,242, 54,230,245, 40, 23, 47,112,183,133,150, 59,142,150, 86,171, 93,245,230,155,111,
+ 78, 27, 56,112,160,143,135,135,  7, 10, 10, 10,234,137, 44,133, 66,  1,169, 84, 10,181, 90,141,189,123,247, 86,105,181,218, 85,
+174,196,129,193, 96, 64, 64, 64,  0, 74, 75, 75, 65, 59,232, 63, 77,146, 36, 68, 34, 17, 20, 10,  5,224,162,147,185,189, 23,134,
+ 94,175,135,193, 96,128,193, 96,128, 94,175,119, 89, 75,182, 53,243, 36, 18,137, 89,120,  0,128, 50, 36, 36,164,149, 80, 40, 68,
+118,118, 54, 80, 51,178,111,224,227,143, 63,206,149,203,229,204, 75, 47,189,116,138, 97,152, 87,224,124,118,124, 93,114,114,114,
+  4,  0,136, 68,162, 12,  0,200,203,203, 51, 84, 84, 84,212,113, 10,197, 98, 49,243,212, 83, 79,  5, 51, 12,131,228,228,228,  8,
+ 30,143,199,192,241,168, 70,205,158, 61,123,174,121,122,122,238, 88,182,108,217,216,132,132,132,171, 29, 58,116,136, 80, 42,149,
+197,106,181, 90,173,209,104, 24, 14,135,195,243,246,246, 22, 30, 62,124,248,207,180,180,180,129, 50,153,108,199,158, 61,123,174,
+ 57,114,222, 36, 18, 73,158, 74,165,106, 97,126,166,214, 34,171,176,176, 16, 12,195, 32, 43, 43, 11, 98,177, 56,199, 85,179, 46,
+139,166,131,185, 82,101,235,188,216,238,115, 87,100, 89, 11,131,195,135, 15, 59,157, 67,203, 93, 78,107, 81, 52,107,214, 44,172,
+ 93,187,182,158,163,181,120,241, 98,  0,192,  7, 31,124,224,118, 31, 45,179,123, 85,184,214,  7, 65,111,148,213,  9, 59,  0, 16,
+230,240, 53, 44,207,131,162, 40, 44, 92,184,176, 94, 39,117,235,166, 61, 55,155,248,234,132,179,184,184, 24, 20, 69,193,199,199,
+  7,227,198,141,195,224,193,131, 45, 77,144, 13,229,189,113,227, 70,202,187,239,190, 27,219,190,125,123, 44, 90,180,168,204,203,
+203,203,227,229,151, 95,166, 42, 42, 42,  8,103,142, 22, 43,180, 88,176,104,  4,161,101,206, 96,238,142, 58,116, 80, 88, 14, 68,
+221,185, 54, 42, 85, 42,213,184, 65,131,  6,253,178,107,215, 46, 81, 84, 84, 20,110,220,184,129,178,178, 50,232,116, 58,240,120,
+ 60,  4,  7,  7,163,162,162,  2,155, 55,111, 86,171, 84,170,113,  0, 42, 93,112,190,223,165, 75,151, 13,159,125,246,153, 48, 62,
+ 62, 30,101,101,101, 80, 40, 20, 22, 33, 68, 16,  4,100, 50, 25, 68, 34, 17,206,158, 61,139, 67,135, 14,169,  1,188,239,130,211,
+158,154,131, 94,175,183,  8, 46, 55,132,150, 53,167,196,236,234,168, 84, 42,  0, 48, 52,107,214, 44,  8,  0,178,178,178,  0,224,
+ 78,100,100,228,130,168,168, 40, 98,251,246,237, 12,195, 48,135, 28,136, 44, 11, 39, 65, 16,101, 12,195,148,  3,  8,210,233,116,
+ 60,  0,168,172,172,212,251,249,249,  5,  8,  4,  2, 90, 36, 18,209, 66,161,144, 46, 40, 40, 48, 26,141, 70, 30,  0,244,234,213,
+ 75,  7,160,208,102,141, 66,107, 78,154, 97,152,170,141, 27, 55, 46, 24, 63,126,124,247, 30, 61,122,180,127,237,181,215,174,188,
+244,210, 75,100,104,104,168,119,117,117,181,230,214,173, 91,229, 43, 86,172,168, 62,125,250,244, 64, 46,151,123,119,227,198,141,
+ 11,  0, 84, 17,  4, 65,219,227, 52, 26,141,191, 39, 37, 37, 77, 74, 72, 72,160,242,243,243, 81, 84, 84,100, 17, 89, 69, 69, 69,
+136,137,137, 65, 90, 90,154, 73,175,215, 39, 53, 32, 62, 27, 11, 44,103, 77, 37,132, 49,231,117, 71,  2,203, 92,153,114,151,211,
+ 90, 20,141, 26, 53,170,142,139,197,227,241,240,211, 79, 63,217, 45, 55,236,228,171, 58,247,110, 61,199,215,187,239,190, 91, 71,
+180,205,155, 55,207, 97,113,230, 42, 62,205, 60,149,155, 66,235,142, 58,116,144,207,157,133,211, 92,118,114,185, 92,204,155, 55,
+207,109, 71, 11,245,251,104,213,227, 52,223,123,159, 62,125,160, 82,169, 44, 66,214,145,163,229, 42, 62, 77, 38,211, 27,107,215,
+174,101,100, 50,217,163, 85, 85, 85,207,231,228,228,108, 85,169, 84,143, 84, 86, 86, 58,117,180,180, 90,173,128,205, 71, 44, 39,
+154,102,126,174,255,142,208,170,125, 73,162, 89,179,102,117,214,206, 34, 73,178,206,214,144,126,  6,181, 56,156,153,153,249,204,
+ 99,143, 61,246,221, 27,111,188,225, 17, 31, 31,207,109,209,162,  5,148, 74, 37,178,179,179,113,245,234, 85,227,158, 61,123,170,
+ 84, 42,213,243,  0,220, 25,117,182,237,218,181,107,135,134, 12, 25,242, 97,183,110,221, 94,157, 63,127, 62,167,117,235,214,168,
+172,172,132,183,183, 55,  2,  2,  2,112,243,230, 77,236,221,187,215, 84, 90, 90,186,  1,192,199,176,211,134,234,170,194,175,215,
+235, 49,102,204, 24,208, 52,141,213,171, 87,195,157,  5,149,173,160,215,235,245, 12,  0,162,182, 63,151,170,118,118,105,220,186,
+117, 11,  0,238, 70, 68, 68,120,  0, 64, 82, 82, 18,129,154,249,181,220,169,225, 51, 12,195, 88,156,173,152,152,152,108,219,194,
+209,236,100,153, 93, 48, 87,225, 38,  8, 66,195, 48, 76,177, 74,165, 26, 50,107,214,172, 15,191,252,242,203,177, 95,126,249,101,
+189,227,100, 50,217,142,149, 43, 87,126, 60,122,244,232, 98,130, 32, 28,246, 35, 83, 42,149, 31, 76,152, 48, 97,244,229,203,151,
+ 61,132, 66, 33,148, 74, 37,228,114, 57,244,122, 61, 34, 35, 35, 81, 92, 92,140,109,219,182, 85,171,213,234,143,216,236,248,207,
+192, 90, 24, 56,114,181,220, 16, 89, 14, 93,157,125,251,246,217,157,163,170,161,156,182, 98,195,221,185,173,156, 85,138,204,211,
+210,216,155, 50,162,129,229, 90, 61, 94,138,162,240,233,167,159, 90, 38,109,181,231,100, 53,196,209, 50,115,250,248,248,212,216,
+228, 98, 49,104,154,198,240,225,195, 31,132,151,  6, 48,221,106,198,247, 37,179,103,207, 94, 16, 19, 19,211, 26,128,192, 58, 14,
+ 26,232,226,179, 96,193,194,149,208, 50,153, 76,121,109,218,180,169, 83,192,185, 90,204,212, 96, 48,228,185,121,221, 67, 74,165,
+ 50,114,229,202,149,111, 74, 36,146,129, 42,149, 42,182,182,224,184,172, 84, 42,147,180, 90,237, 26, 52,108, 17,232, 18,  0,175,
+159, 62,125,122,245,144, 33, 67, 22,247,239,223,255,217,183,222,122,139, 96, 24,  6,235,215,175,103,110,223,190,253, 99,173,139,
+117,251,126, 34,201,199,199,231,218,230,205,155,  3,127,249,229, 23, 24, 12,  6,172, 89,179,  6, 30, 30, 30,215,202,202,202,220,
+165, 40, 62,122,244,232,150, 30, 61,122,188,144,150,150,182, 13,192, 31, 39, 78,156,216,218,179,103,207,  9,105,105,105,223,  3,
+184,122,236,216,177,173,221,186,117,155,144,158,158,190, 27,192,197,  6, 20,190, 22,103,203,104,180,223,210,232,192,201,114,198,
+ 89,197, 48,140,126,242,228,201,111,141, 30, 61,250,235,244,244,244, 71, 42, 42, 42, 98,  1,192,203,203,235,114,215,174, 93,207,
+238,218,181,235,102,173,147,229,170,179,126,137, 82,169,124, 42, 54, 54,246,231, 69,139, 22, 73,218,183,111, 79,181,106,213, 10,
+119,238,220,193,149, 43, 87,140,223,126,251,173, 66,173, 86, 63,  9,160,156,205,142,255,156,208, 98, 24,  6, 94, 94, 94,117, 42,
+ 81,230, 33,255, 13,109, 46,180,126, 49,155,151,234,177,229,117,196,233,108,218,  4, 51,164, 82,169,101,114, 83,119,186, 44,208,
+180,243,249,216, 24,134,177,112,154, 55, 55, 68,150,203, 17,130,181, 75,224,184,205,233,206,244, 14, 18,137,  4,  6,131,193,194,
+235,198,200,207,134,170,197,125,  0,246, 25, 12,134, 91,  0, 90,178,226,138,  5,139, 38, 20, 90,229,229,229, 93,154,248,218, 85,
+ 90,173,246, 99,173, 86,251,177,121,135, 70,163,121, 80,206,219,  0, 70, 31, 61,122,244,179,163, 71,143,154,219, 17, 22,194,245,
+122,137, 78,113,227,198,141,  4, 46,151,251,213,142, 29, 59,186, 49, 12,  3, 79, 79,207,211,119,238,220,121,185, 33, 28, 38,147,
+105,114, 90, 90,218, 52,212,246,101,210,235,245,147, 83, 82, 82,222, 68,205,122, 76, 48,153, 76,147,207,156, 57, 99,249,221,192,
+ 23, 37,195, 48,140,150, 97,152, 16,  7,135,104, 27,232,192,153,157, 45,221,174, 93,187, 20,  0, 46,225,175,121,178, 12,181,155,
+198,166,185,208, 25,142, 41,149,202, 86,243,230,205, 91,194,225,112,  6, 40,149,202, 80,137, 68,146,107, 52, 26,127, 87,169, 84,
+239,163,102,141, 42, 22,255, 16,116, 58, 93,126,155, 54,109, 40,123, 21, 40,103, 47,114,103, 21, 43,147,201,148, 23, 29, 29,237,
+178,114,102,135, 51,223,137,104,184, 27, 25, 25, 73,186,203,101,134, 94,175, 47,118, 22,206,200,200, 72, 52,148,211,213,189, 71,
+ 68, 68,216,189,119, 23,130,208,225,189, 27,141,198,251,226,116, 22,159,206,160, 86,171,203,253,253,253, 21, 26,141,134,171,213,
+106,185, 70,163,177,142,253, 40, 18,137, 74,212,106, 53,155,121, 88,176,120, 16,161,245,144,227, 28,106,150,151,104, 44,104, 47,
+ 95,190,252,130,197,158, 42, 46,190, 95, 30, 91, 37,169,112,241,187, 33,194,168,209, 29,161, 90, 33,165,106, 36,186, 82,133, 66,
+241,146,249,135,185, 15,  8,139,127, 30,114,185,252,209,198,230, 44, 43, 43,107,244,138, 90,105,105,105,247, 38,184,247, 46,255,
+ 85, 78,103, 40, 40, 40,120,212,133, 16, 99, 51, 14, 11, 22,110,130,100,163,128,  5, 11, 22, 44, 88,176, 96,193,162,105, 64,160,
+102,228,128, 61, 52,100, 52,193,192,251,184,118, 18,203,201,114,178,156, 44, 39,203,201,114,178,156,255, 57, 78, 87,220,236,104,
+198, 38, 22, 96, 44,231,255, 63, 39,  7,  0, 33, 18,137,  8,161, 80, 72,136,197, 98,130,141, 79,150,147,229,100, 57, 89, 78,150,
+147, 69,125,252,227,125,180,252,253,253,147, 41,138,138, 86, 42,149,202,234,234,234, 40, 15, 15,143,219, 18,137, 68, 98, 52, 26,
+ 51, 75, 74, 74,122, 63, 32,253,100,129, 64, 48, 51, 46, 46,174,221,205,155, 55, 51,170,170,170, 86,  0,248,  6,246, 71, 12,113,
+109,246, 19,  0,226,155, 55,111,190, 85, 40, 20,138, 51, 50, 50,230,  0,248,222,141,120, 36,224, 98, 68,146, 53,188, 37, 60, 46,
+106,250,147,245,  5,112, 28,192,190,114,165,222,240, 32, 55,125,191,156, 82,169,212,167,101,203,150,235, 35, 34, 35, 35, 25, 64,
+203, 48, 53,243, 15, 25, 13,122,222,213, 43, 87,146,239,220,185,179,161,127,255,254, 95,135,133,133,  5,114,185, 92,131,121,212,
+151, 74,165,226,109,219,182,173, 21,155,157, 88,176, 96,193,130,  5, 11, 55,133,150,164, 57,218,240, 37,196, 54,147,  1,106,163,
+150,153,170,204,197, 13,105, 51,244, 96,128, 23, 24, 32,130,228,144,254, 38, 19, 93, 72,107,  8, 35,215, 32,138, 38, 25, 74, 88,
+ 85, 85, 21,218,224,  0, 80, 84,116, 65, 65, 65, 64, 72, 72,136,121,241, 99,137,249,247,  3,128,  0,240,197, 43,175,188, 50,245,
+213, 87, 95,133,183,183, 55, 12,  6, 67,235,157, 59,119,110,154, 55,111, 94,119,  0, 47,218, 17, 67, 12,234, 78, 18,218, 58, 54,
+ 54,118,127,106,106,170,111, 69, 69,  5, 58,119,238,188,162,184,184,216,145,208, 50, 54, 52,128,222, 18, 94, 27,  0, 47,  6,121,
+  9, 38,125, 51,171,191,119,139,  1,175,225,202,143, 11,166, 77,255,230,114, 57,128,205,  0,190, 41, 87,234,111,254, 93,156, 30,
+ 30, 30,  1,109,162,163,119,253,248,243,207,189, 79, 31, 59,  6, 31,  1, 31, 18, 17, 31, 96,128,192, 86,109,240,218,236,217,198,
+ 71, 30,121,164,223,119,223,125, 23,151,158,158,142,208,208, 80,136, 68, 34,136,197, 98,200,229,114,108,219,182,237,190,211, 17,
+ 77,211,247,  0, 28, 37,141,216,167, 40,192, 45, 54, 91,178, 96,193,130,  5,139,127,189,208, 98,104,172, 88,125, 96,114,231, 43,
+101,191,225,139,103, 10,151,138,194, 96,236, 49, 34,250,233,132,137,157,224,233, 47,134, 80, 74,161, 66, 94,213,225,230,133, 92,
+ 28,223,253, 39,188, 13,173,145,246,251,249,235, 42,149,170,237,253,  4, 68, 44, 22,139,131,131,131,139,196,214, 11,227,221, 31,
+132,  0, 86,188,250,234,171, 83,223,121,231, 29,252,254,251,239,216,179,103, 15,198,143, 31,143, 25, 51,102, 64, 42,149, 78,154,
+ 49, 99, 70, 26,128,175,157,112,180,142,141,141, 61,149,154,154,234,171, 86,171,113,229,202, 21,148,149,149,253,209, 88,145,238,
+ 45,225, 45, 91,255,114,220,187,221,158,158, 14,255,246,131, 64,144, 53,143,161,215,236,189,184,248,166,218, 59, 47,229,187,183,
+246,252,248,253, 91,203,247,220, 90, 94,174,212,207,249, 59, 56,163,162,162,214,237,250,233,167,222, 97, 97, 97,216,159,125, 27,
+ 45, 35,130,209,172, 77, 39, 84,102,223, 70,201,221, 44,232,244,122,244,237,219, 55,238,212,169, 83, 40, 40, 40,128,159,159, 31,
+ 52, 26, 13,210,211,211, 33, 20, 58, 94,141,163,  1,233,104,200,177, 93,183,150,223, 58, 95,178, 76,153,131, 15,  1,152,216,236,
+249,175, 65,235,102,205,154,253, 44, 18,137,100, 25, 25, 25, 31,  0,216,210,132,215, 26,215,173, 91,183, 53,151, 46, 93,186,160,
+213,106,223,  4,144,193, 70, 63, 11, 22, 44,254, 73, 56, 27,117, 24,236,239,239,  7,191, 72, 46,188,125, 36, 67,151,255,244,252,
+211,175, 45, 29,  0, 94, 84, 62,202,164,103,112,151,249, 29, 26,223,155,104, 51,132,135,183,191,233,  7,223,238,114,192, 71, 85,
+128,112,  8, 28, 17,250,248,248,252, 28, 16, 16,144,106,189, 25,141, 70,225,156, 57,115, 76, 25, 25, 25,146,130,130,130,128,140,
+140, 12,201,156, 57,115, 76, 70,163, 81,232, 31,232,115,193,163, 57, 47, 47,162,183,168, 68,210, 28,175,187,112,176, 62, 11, 10,
+ 10, 82,141, 29, 59, 86,221,161, 67,135,169, 12,195, 96,235,214,173,120,249,229,151,119,254,246,219,111, 17, 99,198,140,217,122,
+244,232, 81, 76,153, 50,  5, 94, 94, 94, 51,220, 21, 89, 23, 46, 92,192,132,  9, 19, 74,140, 70,227,140, 70,140,247,137,163, 86,
+156, 65,200, 35,207,130,195, 19, 89,214, 82, 35, 72, 18, 92,145, 12, 97,143, 61,143, 87, 22,127,  7,  0, 19,255, 46,206,200,168,
+168,150,231,146,147,241,237,194, 69,104, 29, 16,128,208,102,161,240,105,211,  1, 30,254,126,160, 40, 10, 12,  3,134,207,231,211,
+229,229,229,144,203,229,144,203,229,200,206,206,198,241,227,199,113,239,222, 61, 52, 70, 58,154,253,109,127, 50,225,181,182,239,
+137,155,225,160,179,116,196,226,225, 18, 89,177,177,177,167,110,220,184, 17,147,148,148, 20, 18, 26, 26,250, 73, 83, 94,172, 75,
+151, 46,203, 79,158, 60,233,115,240,224,193, 65, 65, 65, 65,201,  0, 90,223, 79,152,155, 55,111,126,189,117,235,214,121,  0,198,
+ 53,114, 16, 39,118,239,222,189,140,207,231, 31,186,207,176,177, 96,241, 48,161,  3,128, 88, 86,104,185,129,197, 59,199, 82, 62,
+109,181,184, 82,126,  0,187, 62,249,  3,159, 12,189, 73, 47,238,158, 77,127,254,194, 13, 28,222,245,  7,138,241,  7,134,189,214,
+ 18, 99, 63,232, 56, 80,108,194, 34,153, 76,118,193, 30, 15,143,199, 11,204,200,200,240,205,202,202,242,189,125,251,182,111,102,
+102,166,239,181,107,215,138, 42, 42, 42, 20,195,135, 15,167,  1, 96,248,240,225,244,221,156,187,170, 65, 79,247,161,195,  7,160,
+227,172,159,218,133,206, 73,236,228,231, 29, 44,152,235,232, 30, 56, 28,206,158, 47,191,252,242,173,220,220, 92,209,247,223,127,
+143,244,244,116, 68, 69, 69, 97,209,162,133,229, 35,122,180,237,245, 72,148,239, 42, 79, 17,247,179, 45, 91,182, 64, 44, 22,163,
+ 99,199,142,142, 92,183, 22, 29, 58,116, 72, 49,139,172,139, 23, 47,226,249,231,159,215,203,229,242,171,  0,150,  1,216, 67,145,
+ 68,178,191,167,164, 66, 34,160,238, 18,  4, 14,160,166,207, 87,120,195,163,158, 64,229,221, 75, 48,233,213,160,  4, 18,112,120,
+ 66,144, 20, 31,101,183,210,144,241,235, 66, 84,100,221,207,194,225, 15,192, 73,146, 26, 79, 46, 23,113,126,190,136,141,136,132,
+143, 80,  6, 85,218, 49,160, 66,  1, 30, 79,  0,128,129, 64, 32, 64,117,117, 53, 46, 92,184,128,235,215,175,227,220,185,115, 56,
+123,246, 44,138,138,138,112,191,233,104, 73,143,108,173,163,116,196,150, 81,255, 14,145,149,154,154,234,171,209,104,112,227,198,
+ 13,148,148,148, 92,108,202, 11,102,100,100,148,167,166,166, 34, 44, 44, 12,223,127,255,189,127, 68, 68,196,201,  6, 10,154,214,
+177,177,177,167,174, 95,191, 30,147,148,148, 20, 26, 16, 16,176,162, 49,195,247,200, 35,143, 44, 62,121,242,164,247,225,195,135,
+  7,251,251,251,223,175, 16,100,193,226,255, 25,  2,  0, 47, 16,  4,113,182, 67,135, 14,151,219,183,111,255,  7, 65, 16,105,  0,
+ 70,225,223, 59,119,167, 83, 88,110, 58, 49, 49,241,  4,  0, 36, 36, 36,244,177, 61, 72, 17,112, 30,249,217, 69,216, 60,177,152,
+ 86,151,160, 98,209,123,159,237, 57,127,250,226, 83,111,206,120,211,123,245,198,229,216,158,118,  0, 99, 86, 24,209,107,116, 59,
+156,217,159,243,214,196,126,115,241,214,140,217, 64,253, 33,154, 12, 73,146, 72, 73, 73,129,201,100,130, 78,167,131, 78,167, 67,
+187,118,237,202,142, 29, 59, 38,  5,128,204, 63, 51, 24,174,175, 78, 48,240, 29, 25,111,202,128, 24, 40,228,122,124,247,110, 38,
+ 74,179,181, 63,214,114, 36,213,145,  7, 36,249,245,134, 13, 27,158,152, 50,101, 10,190,248,226, 11,236,220,185, 19, 79, 62,249,
+ 36,158,123,238, 57,148,148,148,120,135,226, 30,  6,180,243, 11,233, 59,125, 67,159, 49, 99,198, 64,161, 80, 32, 61, 61,253,186,
+ 77,184,146, 80,211, 25,254,245,227,199,143,251,168,213,106, 84, 87, 87,163,111,223,190,144,203,229, 60,  0,253,237,196,157, 39,
+128,230,106,181, 26, 45, 90,180,104, 93, 82, 82,210,195, 14,103, 61,120, 75,120, 22,113,171, 87,150, 67,175, 44,  7,135, 39,132,
+208, 59, 12, 87,191,155,  1,134,174,105, 49,243, 12,239,104,239,244, 38,227, 20, 11,  4, 72, 76, 77,193,241,196,125,104, 27, 25,
+137,158,177,177, 56,117,249, 10,120, 36,129,145,147, 38,  3, 52, 19,144,146,146, 66,148,148,148,224,242,229,203, 88,184,112, 33,
+114,114,114,112,224,192,  1,152, 76, 38,183,194,105,147,142, 84,139,222,251, 44,123,236,179,207,223, 60,120,228,183, 59,137,191,
+255, 52,104,123,218,209,248, 49, 43,140, 68,175,209,237,112,246, 64,206,204,108,162,252, 91,101, 46,110, 56,227,124, 64,176,156,
+ 77,199,217,190,125,251,246,167, 83, 83, 83,197,106,181, 26,187,119,239,198,252,249,243, 13,122,189,158,  2,176,199,206,185,233,
+  0,190, 64,253,165,183,236,133, 83,  6, 96, 26,128,174,245,210,152, 66, 81,242,204, 51,207, 24, 22, 44, 88,192,125,252,241,199,
+177,111,223, 62,191,145, 35, 71, 94,204,200,200,136,199, 95,205,136, 73,174,132,225,125,116, 25,112, 43, 62,107,133, 96,112,104,
+104, 40,182,111,223,238, 63, 97,194,132,228,162,162,162,222,176,223,196,201,166, 37,150,243, 97,226,108,  1,224, 85,169, 84, 58,
+165,111,223,190,222, 79, 62,249, 36,124,125,125, 97, 52, 26,145,155,155,219, 45, 49, 49,177, 91,106,106,106,129, 78,167, 91, 11,
+ 96, 19,128, 10,123,164,206,180,200, 67, 45,180, 18, 19, 19, 25,212,140, 80,179, 11,149, 73,142,248,224,161,232,246,187,148,172,
+ 40,171,210, 47, 24,185,244,104, 69,142,254,169,175,190,250, 10,207, 61, 49,  1,251,126, 23,227,244,206,189, 24, 56,190, 16,  3,
+ 39, 71,226,207,147,142,187, 69, 24, 12, 53,131,223,140, 70, 35, 12,  6,  3,244,122, 61,244,122, 61,196, 98, 49,174,221,188,  2,
+163,119,  9,231,249, 53,173, 56,161,109, 36, 72,221, 89,136,  3,171,115,116,138, 98,195, 92, 93, 57,126,170,103,223,  0, 95,175,
+ 90,181,106,210,148, 41, 83,176, 96,193,  2,252,244,211, 79,204,138, 21, 43,136,121,243,230,161,188,188, 28,253,250,245,195, 43,
+147,159,199,181,184, 16,188, 59,127,177,108,212,168, 81,248,248,227,143,161, 84, 42, 87, 57,  8,158,151, 78,167,179, 44,118,155,
+151,231,122,233,198,156,156, 28, 48,206,151, 82,131,183,132, 39,244,146,240,150,112, 72,226, 57, 14,  1,127,131,137,193,241,  5,
+189,192,137, 25,137,249,107,119,194, 68, 51, 24,247,212, 32, 68, 42,170, 32, 18, 75,106, 20, 41,109,186, 47,206,232,161,111,130,
+228, 10, 97,210,107,176,101,203,102,236, 57, 84,  1,157,252, 14, 94,123, 60, 10,129, 78, 56,141, 70, 35,211,188,121, 27,180,108,
+175,  3, 35,224,225,216, 93, 45, 98,251, 36,224,198,181,219,200,175,212, 35, 46,182,125,139,201,147, 95,132, 64, 32,192,237,219,
+183,177,100,201, 18, 40,149, 74,119,215,133,179,151,142,164,171, 95, 91, 43,124,245,197,215,222,187,144,126, 49,119,235, 23,187,
+126,153,246,238,148,175, 79,239, 60, 24, 59,112,124, 33,  6, 76,138, 36, 55, 92, 42,127, 22,192,  2,182,130,248, 80, 98,195,153,
+ 51,103,196, 42,149, 10,213,213,213,120,249,229,151, 49,109,218, 52,174,189, 74, 75,113,113, 49, 82, 82, 82,158,156, 62,125,250,
+152,194,194,194,222,112,190,238,165,119,167, 78,157, 82,143, 29, 59,214,218,195,195,195,178,147,166,105,232,245,122, 75,153,162,
+213,106,161,213,106, 33,147,201,144,154,154, 42,244,241,241,217,  5,231, 77, 24,127, 71,151,  1, 84, 85, 85, 61, 59,106,212,168,
+228,109,219,182,249, 71, 70, 70,226,251,239,191,247,127,241,197, 23, 79,222,189,123,183, 23,216,254,100, 44, 30, 94,204,121,230,
+153,103, 22,  7,  6,  6,146, 29, 58,116, 64,112,112, 48,180, 90, 45, 42, 43, 43,193, 48, 12,252,252,252, 48,105,210, 36, 60,245,
+212, 83, 33,201,201,201,203,143, 29, 59,182,160,188,188,124, 51,128, 53,  0, 50,173, 68,150, 83, 45,242,208, 59, 90,  9,  9,  9,
+ 39,234,168, 24,  2,233,103,254, 56, 21, 43,140,  1,  8, 18,200, 37,143,129,  0,129, 10,131,158,103,168, 34,215, 30, 62,124,216,
+ 91,169, 84, 66,161, 80, 96,104,223, 17,152,187,225, 23,244,124,190, 10,205,218,132, 96,245,135,  7, 12,174,132, 22, 77,211, 48,
+ 26,141,168,174,174, 38, 79,156, 56,225, 23, 30,209,140,120,254,173, 33,152,254,125, 59,200,  2,120, 56,248,121, 14,202, 83, 67,
+148, 76,105,197, 29, 93,121,217, 86, 59,133,239,228,247,223,127,127,210, 27,111,188,129,229,203,151, 99,217,226,143, 79,135,  4,
+  5, 62, 18, 31, 31, 79,124,244,209, 71,152, 61,123, 54,194,195,195,193, 17,120,160,101,223,231, 49,107,214, 44,172, 93,187, 22,
+ 95,173, 94,170,111,231, 35, 77,187, 86, 86,111,181, 27,  3,128, 69,  3,  6, 12,120,226,240,225,195, 62, 66,161, 16, 87,175, 94,
+197,248,241,207, 67,204,  5,184, 28, 18, 96,104, 48, 52, 13,130, 96,224, 47, 19,192, 91,196,129,191,  7, 23, 49,126,116,251,114,
+ 70,218,250,106,153, 34,195,158, 32,242,245,224, 95,221,241,193,136,176,216, 73, 95,240, 40,129, 20,218,202, 66,252,182,102, 26,
+ 22, 45,254, 26,167, 82, 79,163,162,162,  2,131,  7, 14,192,154, 81,126,127, 89,127, 78,196,155, 35,206, 27,187,222,195, 43, 83,
+167, 99,227,250,117, 32,185, 66,252,118,226, 28, 14, 31, 61,137,148,148, 20,188, 52,113, 44, 62,143, 46,116,200,105, 50, 25,224,
+ 31, 16,142,199,250, 68, 65,234, 33,  5, 73,  0, 45, 34,252,225,231,155,135,160, 32,  2,105,167,143, 34, 57, 57, 25, 30, 30, 30,
+136,136,136,192,218,181,107,145,157,157,141,151, 95,126, 25,124, 62,223, 33,175,163,116,164, 32, 12, 32, 76,252, 86, 30, 30, 30,
+ 59,116, 58,221, 42,189, 94,191,247,249, 81,147,119,188,188,228,231,118, 61,159,175,226, 52,107, 19,  2,130, 65, 31, 86,104, 61,
+180,144, 24, 12,  6,152,215,115,206,205,205,117,122,112, 92, 92, 28,182,108,217,210,110,226,196,137,201,133,133,133,143,193,254,
+162,242,178, 78,157, 58,165, 38, 39, 39,183,214,104, 52,200,202,202,114, 43, 32,181, 11, 35, 43,157, 28, 98,238, 50,224, 99,221,
+101,160,172,172,204,220,101,192, 30,202, 80,179,142,234, 93, 59,255,133,  3,120,179,182,134, 15, 59,194,242,234,248,241,227,123,
+110,223,190,157, 23, 21, 21,133,125,251,246,249,141, 26, 53, 42, 37, 35, 35,163, 43,128,108, 54,233,176,120,  8, 49,113,225,194,
+133,164,201,100, 66,105,105, 41,180, 90,109,189, 60,200, 48, 12,196, 98, 49,134, 14, 29,138, 33, 67,134,  8,206,159, 63, 63, 53,
+ 41, 41,233,213,172,172,172,249,181,121,201,174, 22,249, 87,  9,173,122, 47, 94, 10,139, 62, 29,147,234, 37,144,146,177,160,  9,
+ 47, 63,191,  0,  9,151,203, 37,188,196,129, 94,171, 86,206, 46,187,121,243,230,189, 93,187,118,  5,119,239,222, 29, 96,128, 78,
+205,  6, 67, 94,120, 26, 94, 92, 53, 74,229,165,142,230,145, 98,126, 61,176, 91, 82, 94, 94, 73,183,137,108,167, 86,169, 84,228,
+129,  3,  7,194,122,245,238,201,219,155,250, 29,241,236,178, 96,200,  2,120,248,109,237, 93, 92,252,222, 64, 79,155, 56,162,242,
+207, 75,107,170,237,213,112,121, 60,222,140, 55,222,120,  3, 59,119,238,196,156, 57,115,182, 60,213,173,229,160,103,134,245, 37,
+ 83, 82, 82, 48, 98,196,  8,228,231,231,227,151, 95,126,193,252,249,243, 49, 97,194,  4,124,241,197, 23,184,240,227, 39,184,190,
+164, 43,111,238,206,219,215,232,155,196,240, 27,165,213,  7,109,104,179,111,220,184,241, 88,255,254,253, 79,238,221,187,215, 47,
+ 38, 38,  6,219,182,109,199,204,215, 95,197,143, 11, 70, 33, 58, 80, 12,232, 21,160,117, 42, 16, 60, 17, 96, 80,131, 41,191, 11,
+189, 94, 45,125,119,199,237,235, 38, 59,156, 94, 18,222,146,239,223,127, 34,172,211,212,109, 60,243,190, 91,183,239, 96,237,241,
+114,156, 74, 61, 13,115, 19, 69, 72,128,183,109, 84, 57,124,104,246, 56,  9,146, 66,199,151,190,198,220,170,  4, 28,218,188,  4,
+ 67, 95, 94,  8,121,105, 49, 82, 83, 83, 17, 26, 26,138,207, 55,110,198,140,233, 83, 97,162, 25, 71,207,156,215,166, 77, 36, 56,
+156,  2,240,  5, 52,  8,  0,122,125, 57,252,252, 40, 52,107,230,  7,128,176,184, 87,  4, 65, 96,216,176, 97,122,134, 97,138, 52,
+ 26, 77,233,174, 93,187,  8,103,233,232,147,209,169,161,124, 49,249, 40,  1,210, 51, 32, 32,144, 16,  8,  5,  8,244,142,192,  7,
+111,190,  6,197, 11,234, 71,183,109,219,182,235,219,111,191, 45, 72, 77, 77,221, 78,  8,124,110,203, 11, 21,209, 94, 92, 53,192,
+144,205,  1,154, 45,194, 30, 78,140,126,228,145, 71, 46,254,246,219,111, 66, 62,159,143,189,123,247, 98,254,252,249,134,178,178,
+178,147,182,162, 39, 48, 48,176,253,214,173, 91, 35, 34, 35, 35,177,110,221,186,118, 35, 71,142,156,  6, 96,137, 29,206,105,199,
+142, 29,107,173,209,104,112,241,226, 69, 76,152, 48, 33,187,168,168,232,170,173,192,139,136,136,232,181, 98,197, 10,110,231,206,
+157, 81, 85, 85,133, 65,131,  6,169,  0,188,234, 36,172, 13,233, 50,  0,160,102,173, 63,  7, 93,  6,224,235,235,251, 77, 78, 78,
+ 78, 63,145, 72,228, 52,130,244,122, 61,242,242,242,224,229,229,133,196,196, 68,159,150, 45, 91,126,  0, 96, 50,155,116, 88, 60,
+140,208,233,116,216,185,115, 39, 58,117,234,132,182,109,219, 66,161, 80, 88, 68,151, 78,167,131,209,248,215, 44, 72, 36, 73,162,
+107,215,174,136,142,142, 38,102,206,156, 57,206, 90,104,253, 27, 97,126,233, 46,176,109, 23,213,100, 35, 23,192, 56, 90, 36,120,
+ 95, 40, 20,142, 14,111, 30,139, 54,109,218,  8,159,126,250,105,190, 78,167,147,158, 56,154,252,103,207,158, 61, 81, 86, 86, 22,
+ 60,103,206,156,178,176,102, 97,116,242,164,114, 95,130, 41,  7, 71,199, 79,  1,234, 47, 58,170,229, 84, 55,223,251,231,242, 96,
+  0, 56,158, 22, 81,253,204,160,177,165, 28, 14,135, 58,125,227, 24,209,123,  6,  5,255, 22, 34,164,237, 46,  4, 63,187, 51, 34,
+  3, 43, 33,147,201, 28,206, 79,213,177, 99,199,118, 36, 73, 98,231,206,157,  0,240,193,141,236,194, 75,146, 35, 39, 62,219,179,
+120, 11,247,221,247, 63,196,220,185,115,241,210, 75, 47, 65,175,215, 99,249,242,229, 72, 77, 77,197,175,191, 28,135, 49,105, 46,
+ 86, 60, 93, 70,190,252,157,230, 87,189,201,219,255,118,121,121,181, 13,117,198,173, 91,183,122, 13, 29, 58,244,228,238,221,187,
+253, 90,183,110,141, 21,107,191,196,248, 55,167,224,236,210, 65,128,200,  7,188,222,239,130,240, 10,175,145, 67,101, 89,192,225,
+119, 29,114,114, 72,226,185,216,137, 95, 88,  4, 81, 70, 70,  6,166,207,122,  7,191, 29, 60, 12,115, 19,197,204, 55,167, 99,235,
+218,143,161, 60,179,  1, 66,159,102,144,  4, 68,161,234,238, 37,  0,144,219, 28, 42, 43,123,  0,  0, 32,  0, 73, 68, 65, 84,187,
+119, 91, 78,  0, 80,203,239, 66,113,239, 38, 34,135,188,137, 15,198,141,199,208,151,129,181,139,222,193, 11, 19,198,224,243,141,
+155, 17, 25, 25,137,207,215,111,194,228,201,147,100, 85, 57,185,173, 97,211, 76,113, 46,253,194,141, 85,171, 23,138, 85, 42,165,
+ 39,143,207, 15,  2,195, 32, 56, 56, 24, 85, 85,213, 48, 24, 12, 80, 42, 85, 32, 73, 18, 36, 73,130,195,225, 96,196,136, 17,188,
+228,228,228,102,127,252,241,135,127,173,  5, 28,109,109,  1,155,161,201,198,216,103,158,121,102,112, 96, 96, 32,233,235,235,139,
+ 62,125,250,192,100, 50, 65,171,213,130,166,105,240,249, 38,139,165,124,242,228,201, 57,122, 83,184,113,203,132, 36, 13,135, 40,
+215, 82, 90, 97, 82,227,173,105,205,226,111, 70, 70,102,102,102,252,192,129,  3, 79,254,248,227,143,126,195,134, 13, 67,203,150,
+ 45,185, 79, 63,253,180,191, 74,165, 26, 96,125, 96, 81, 81,145,247,132,  9, 19,206,229,230,230, 70,212,238,234,234,128,179,171,
+135,135,  7,178,178,178,204, 34,171,139,109, 37,140,207,231, 31,186,116,233, 18,151,207,231, 35, 61, 61, 29, 19, 39, 78, 44,205,
+206,206,118,213, 44,119, 95, 93,  6,104,154,214,218,251,143, 36, 73,193,249,243,231,225,106, 46, 64,146, 36,193,227,213,201,198,
+ 21,108,178, 97,241,144,194,160,211,233,208,165, 75, 23,100,103,103,227,252,249,243, 22,193, 85, 90, 90,138,130,130,130, 58,  7,
+159, 61,123, 22, 23, 46, 92, 64,239,222,245,230, 36, 95,240,111,236,163,101,113, 34, 18, 19, 19,251,216,216,118,124,137, 68,114,
+246,185,231,158,107,246,244,211, 79,123,113, 56, 28,104, 52, 26, 24,141, 70,164,165,165,161,109,219,182,170,118,237,218, 85, 12,
+ 31, 62,156, 40, 45, 45,237,127,245,234,213,172,210,210,210,120,153, 76,150,245,216, 99,143,105, 52, 26, 77, 61,165,229, 21, 69,
+233,150, 95,236,198,  3,128,228,237,  5,200,217,239,163, 48,168, 77,226,200,145,149,100,159,  9, 33,168, 42,214, 99,245,179, 55,
+240,235,166,163, 88,241,217, 10, 83,239,222,189,243, 22, 47, 94, 92, 80, 80, 80,240,152, 45,151,167,167,231,181,228,228,228,182,
+ 71,143, 30,197,236,217,179,191, 51,153, 76,203,132, 92,206,193, 73, 47,189, 18,166,215,235,113,254,252,121,248,248,248, 32, 39,
+ 39, 23,188,128, 56,196,246,123,  1,111,143,235,138, 56,239,114,232, 54, 15,198,141,  2, 53,198,239,210, 46,186, 89,172,156,231,
+ 32,110, 90,135,134,134, 38,111,223,190,221, 63, 48, 48, 16,227,158, 25,134,180,247, 98,193, 27,186,  2,151, 74,196,248,236,251,
+115,  0,128,183,199,117,113,200,233, 45,225,145,  1, 50,190,225, 70,126, 53,  9,  0,119,238,220,193,132, 23,198,227,224,161, 26,
+145,117,241,226, 69,140, 27, 55, 14,237, 99,162, 33, 22,242,161,173, 44,  2,109, 50,224,110, 94, 33,242,203, 52,101, 70,154,190,
+202, 48,200,134, 85, 19,133, 45,231,221,187,119,177, 98,249, 98,220,186,126,  9,122, 69, 25,120, 18,111,164,157,191,130, 62,125,
+250,130,161,141, 40, 47,202, 69, 78,169, 10,155,183,108, 69, 84, 84, 20, 84, 42, 21, 70,141, 26, 85,230,164,153, 34,227,198,141,
+ 27,209,107,215,174,197,252,249,243,241,203, 47,191,192,100, 50, 65, 32, 16,128,162, 40,240,249,124, 68, 69, 69,225,250,245,154,
+241,  4, 52, 77,227,252,249,243, 72, 74, 74, 98,108, 45, 96,107, 62,147,201,132,146,146, 18,232,116, 58,168, 84, 42,168,213,106,
+ 48, 12,  3, 14,135,  3,134, 97, 44,181, 29, 14,135,131,172,172, 44, 92,190,124,153,217,183,111,223, 39, 12,195,204, 97,203,176,
+135, 26,173, 67, 66, 66,146,183,109,219,230, 31, 28, 28,140,126,253,250,229, 22, 22, 22, 54,183,115,220, 30,134, 97,158,204,202,
+202, 66, 84, 84,212, 94,  0, 35,238,231,152,240,240,240,146,244,244,116,191,107,215,174, 97,220,184,113, 37,181,125,190, 92,245,
+125,138,136,137,137, 73, 63,124,248,176, 15, 73,146,184,122,245, 42,198,141, 27,167, 47, 43, 43, 59,  5,199, 77,142,119, 80,211,
+191,228,174,157,255,194,  1,204,  3,224,227,224, 92, 73,116,116,116,207,115,231,206,241,  8,130,192,157, 59,119,204,121,178, 75,
+ 45, 47, 11, 22, 15, 27,158, 10,  9,  9,249,118,218,180,105,158,221,186,117, 67, 94, 94, 30,242,243,243, 81, 94, 94,142,248,248,
+120,180,111,223, 30,183,111,223,198,161, 67,135,112,225,194,  5,  8,  4,  2,132,133,133, 65,186, 99, 39,190, 34,112, 13, 64,123,
+ 39, 90,228,223, 35,180,108, 33, 16,  8, 62,152, 56,113,226,140,215, 94,123,205, 71, 32, 16,224,236,217,179,224,241,120,160,105,
+ 26,  3,  6, 12, 64,118,118, 54, 70,140, 24, 81, 86, 88, 88,248, 52,128,147,238, 92, 76, 22, 44, 40, 28,254,126,112, 96,239,241,
+ 53, 53,189,228,237,  5, 56,183,183, 24,179,118,117,  4,201, 33,240,205,244, 27, 48,101, 54,167, 91, 71,197, 48,  0,140,205,154,
+ 53, 43,220,186,117,171, 93,161,  5, 96,242,148, 41, 83,190,153, 60,121, 50, 78,156, 56,129, 93,187,118, 97,216,176, 97, 24, 62,
+124, 56,190,253,246, 91,120,201, 79,227,147, 95,175, 97,236,135,  7,112, 53,171,198, 24,106, 31,233,139, 29, 31, 15,131,230,243,
+120, 48,165, 25, 72,216, 73,221, 56,246,167,194,209, 84, 15,100, 11,111,209, 79,126,254, 94, 79,105, 24, 30, 94,237, 46,198,139,
+ 67,226,192, 31,181,189, 65,156,173,130,165,133,215,179, 10,  2, 41,129, 20,111,188,250, 34, 62, 90,242, 41, 76, 38, 19,170,171,
+171, 17, 22, 22,102, 91,163,173,135,218, 38,138, 52,235, 38, 10,107,206, 39,135, 63,142,157,187,127,134,187,205, 20,124, 62, 31,
+ 90,173, 22, 45, 91,182,220, 12,251,205, 20, 25,151, 46, 93,138, 94,188,120, 49, 54,108,216,128,125,251,246,193,104, 52, 66, 32,
+ 16, 64, 34,145, 64, 36, 18,193,207,207, 15,151, 47, 95,174,115, 82, 85, 85, 21,102,206,156,153,137,250,195,213, 51, 46, 93,186,
+ 20,237,204, 82, 54,247,219,179, 36, 74,130, 64,101,101,165, 35, 62, 22, 15,161,216,226,241,120,171,253,253,253, 59,230,231,231,
+207, 66,253,165,172,188,159,125,246,217,171, 63,252,240, 67,240,157, 59,119,220, 18, 90,143, 61,246,152, 93, 71, 11,192,196,160,
+160,160,143,171,171,171, 43, 85, 42,213, 40,184,223,193,188,117,171, 86,173, 78,238,221,187,215, 79, 44, 22,227,250,245,235, 24,
+ 63,126,124,137, 92, 46,239,141,198,237,164,222,186, 77,155, 54,167,206,158, 61,235,203,229,114,145,158,158,142,  9, 19, 38,148,
+178,157,225, 89,252, 11,224,  1, 96,118,100,100,228,219, 83,167, 78, 21,180,107,215, 14,121,121,121, 40, 41, 41, 65,121,121, 57,
+ 78,159, 62, 13,  0,  8, 13, 13, 69,104,104, 40,110,222,188,137,148,148,148, 42,133, 66, 49, 25,192, 47,255,230,136,113,216, 71,
+ 75, 44, 22, 63,247,194, 11, 47,248,152, 76, 38,244,238,221,187, 76,167,211,153,102,207,158,237, 31, 20, 20,  4, 15, 15, 15, 12,
+ 26, 52,168,188,170,170,170, 59,224,254,146, 41,  2,147,236,110,241,239,193,210,100, 20,136,123,143, 15, 65,239,241, 33,232, 58,
+ 34,  0, 36,135,192,229,195,114,240, 75, 91,170, 94,152, 50,165,178, 89,179,102,  6,146, 36,209,188,121,115,227,246,237,219, 29,
+117, 86,250,246,235,175,191,126,212, 96, 48,188,244,242,203, 47,163, 79,159, 62, 48, 26,141,216,190,125, 59,100,185,  7,176,240,
+249, 46,142,  3, 98, 50,128,224, 73, 16,232,105, 10,115, 36,178,218,  6, 74,191, 89,246,106,191,167,  6,117,240,197,222, 99, 23,
+ 49,172, 13, 23,208, 85,223, 15,231,174, 43, 91,223,152, 26, 59,233, 75, 94,105, 81, 30, 26,169,137,194,194,169, 85, 85,163,145,
+155, 41, 12, 58,157, 14, 18,137,  4, 92, 46, 23,  2,129,  0, 70,163, 17,  4, 65, 32, 62, 62, 30,205,155, 55, 71, 78, 78,142, 59,
+ 22,112, 99, 91,202, 44, 30, 94,100,232,245,250, 33,249,249,249,214,142,143,165,179,248,179,207, 62,219,101,251,246,237,193,133,
+133,133,248,227,143, 63,128,154,169, 30,236, 33,189,168,168,232, 73,177, 88,140,173, 91,183, 70, 76,152, 48,225,156, 85, 31, 45,
+115,231,244, 45,133,133,133, 91,238, 39,140,182, 93,  6,182,110,221,234, 63,106,212,168,221, 42,149,170, 67, 99, 69,132, 72, 36,
+ 90,115,230,204, 25, 95, 46,151,139,180,180, 52,140, 27, 55,174,196,201,244, 14, 44, 88, 60, 76,168,  6, 48, 47, 43, 43,235,243,
+183,223,126,251,131,118,237,218,189, 58,101,202, 20,170,109,219,182,200,207,207, 71,118,118, 54, 90,182,108,137,220,220, 92,124,
+247,221,119,186,146,146,146,213,168, 25,108, 82,249,159,141, 49, 47, 47,175,187, 59,119,238,100,130,130,130, 44,253,132,124,124,
+124,138,230,207,159,207,200,229,114,198,215,215,183,192, 13,154, 58,171,123,135,132,132,156,184,120,241, 98, 86, 79, 95, 40,199,
+125, 17,193,124, 85,221,147,249,170,186, 39,179, 38,191, 27, 19,209,195,219,248,218,180,215,242, 62,255,252,243, 91, 27, 54,108,
+200,252, 31,123,215, 29, 30, 69,181,183,223,153,237, 37,189,147,  4, 18, 32,244,208,139, 32, 29,129, 32,132,122, 85,138,128,162,
+126, 72, 64, 44,  8,  4,244,114, 17,145,  4, 68,165,233,  5, 47,150,  0,210,171, 20,169, 66,128, 80, 36, 32, 37,161,  5, 18, 72,
+207,166,111,175,115,190, 63,178,179,110,194, 38,187, 27,192, 58,239,243,204, 51, 59,237,221,211,230,156,247,252,206,239,156, 89,
+187,118,237,157,252,252,252, 59,225,225,225,103,234,224,164,  2,228,130,189,221,219, 69,145,231,  7, 63, 71,122,182,141, 32, 97,
+222,162,156,107,241,145, 68,187, 44,130, 88,138,210,201,229,219, 69,100,220,191, 15,144,113,255, 62, 64, 46,223, 46, 34,150,194,
+235, 68,179, 64, 76,212,203,155,145,103, 26,251,220,114, 20,206, 86, 33,178, 37,251, 23, 12, 35,134, 29,147,201,182,184,182,164,
+117,176,236,102,125, 57,125,229, 66, 73,179,  6, 30,247,206, 38, 12, 50,156,223,183,142, 60,211,181, 19,201,201,201, 33,121,121,
+121,228,240,225,195,196,207,207,207,  0,224, 56,170,214, 22,114,180,125,129,223, 22, 68,125,132,243,226,143, 95,147,151,134,245,
+ 37,189,163, 27,144,168, 16, 57, 35, 21,241,212,  0,246,219, 61,127,188,121,243,230,  6,165, 82, 73, 84, 42, 21,185,126,253, 58,
+105,209,162, 69,  9,126,155, 17, 53,208,129,  9,184,124,252,248,241,196, 17,146,147,147,201,181,107,215,200,212,169, 83, 73,231,
+206,157, 73,207,158, 61,201,184,113,227,200,255, 17, 16,  0, 55, 28,112,142, 10, 13, 13, 45, 95,178,100,  9, 57,121,242, 36,217,
+176, 97,  3, 89,178,100,  9,121,255,253,247,201,230,205,155,201,141, 27, 55,200,158, 61,123,156,241, 57, 10,231,147,  0,199,249,
+199,112, 30, 78, 75, 75,179,149, 41,139,197, 66,114,115,115,201,145, 35, 71, 72, 72, 72,200, 13, 84,173,147,229,136,211,171,117,
+235,214, 55,111,221,186, 69, 30, 62,124, 72,140, 70,163,141,227,230,205,155,  4,192,169, 39, 16,206, 22, 97, 97, 97, 69, 39, 79,
+158, 36,183,110,221, 34, 33, 33, 33,217, 79, 50,238,145,145,145, 69, 10,133,130,156, 56,113,130,  4,  6,  6, 22,161,110,139, 45,
+ 87,150, 56,206,191, 50,103, 36,128,141,157, 59,119,182,172, 90,181,138,188,249,230,155, 36, 34, 34,194,130,170, 69,190,195,240,
+ 15, 66,173, 22,173,242,242,242,136, 55,223,124,243,242,179,207, 62,219,181,160,160,128,237,141, 25,104,154, 38, 10,133,130, 49,
+ 26,141,185,238,254,153,209,104, 44,184,126,253,122,192,138, 35,151,139,102, 47,154, 25,148,140, 60,217,179, 47,133, 96,239,178,
+ 76,188,216,127, 74, 89,108,204, 40, 83,100,100,164,205,130,117,235,214, 45,232,245,122,109, 29,148,228,153, 38, 62,221,118,204,
+110,141,125,103,239, 98,209,181,226,239,229, 34,222,174, 93,151,203,246,207,237,  9, 24,183, 79, 64,251, 23, 54, 96,243,162,161,
+  0,  0,166,232,  6,140,219, 39,130,146,  5,224,116,174,  0, 21, 90,227,  1, 71,164, 77,  2,101,175, 14,108,198,199,222, 19,151,
+176,104,239,195,239, 45,132,212,155,179, 76,109,212,  1,136,158,178,250,124,  2,112,126,172,222,104,  9, 24,208,191, 31,246,253,
+184,159,110,213,170, 21, 54,109,218, 36,156, 56,113, 98,180, 59, 67, 20, 53, 57, 45, 12,  9,160,128, 98,  2,108, 17, 11,120,243,
+181,  6,139,142,109, 52,172,195, 20, 66,  7,195, 20,181,249,130,236,201,203,203, 59,113,225,194,133, 11,111,191,253,118, 11,137,
+ 68, 66,  9,  4,  2, 88, 44, 22, 48, 12,  3,139,197,130,242,242,114,220,186,117, 11,141, 27, 55,182,153,128, 15,120,122, 84,  2,
+170,255,212,198, 55,127,254,124,155, 73,185, 99,199,142,200,201,201, 65, 86, 86, 22, 46, 95,190,108, 51, 41,187,200,199,225,175,
+ 15,241,249,243,231, 33, 22,255,246,149,165,171, 87,175,226,173,183,222, 74,179,250, 84, 85,214,242, 92,101,122,122,122,207,161,
+ 67,135,158, 94,181,106, 85,107,251, 33,231,147, 39, 79,  2,128,254, 73, 88,223,114,115,115,251,196,196,196,172,244,247,247,239,
+ 80, 80, 80,176,224, 73, 70, 60, 43, 43,235,189,118,237,218, 45, 81, 42,149,149,110, 14,109,114,224,240, 87, 67, 22,128,137,169,
+169,169,203, 82, 83, 83, 63, 64,213, 84,250,197,  0,210,185,164,169,  5, 97, 97, 97,119,231,206,157,171,187,120,241,162, 37, 46,
+ 46,174, 68, 46,151, 79,171,135,226,149,  6,  4,  4,108, 13, 10, 10, 74,241,247,247,191,228, 17, 44, 82,200, 27,210, 70,207, 64,
+113,129,143,143,207,245,160,160,160,115,246,223, 65,244,243,243,251, 25, 64,120, 93,156, 45,131,229,211, 95,232,232,159,219, 42,
+ 68,182, 18, 85,159, 20,162, 90,  4,203, 14,239,158,224, 73, 52, 31,251, 17,205, 34, 47,162, 93,217,150,104, 87,182, 37,154,197,
+254, 68,187,162, 13,185,147,208,157,116,139,244,206,111, 26, 44, 15,248,189, 56, 89, 88, 87,113,111, 17, 25, 25,169,184,116,233,
+ 18,201,202,202, 34,  7, 15, 30, 36, 50,153,236,122,125,123, 16,246, 43,195, 87, 75,108,169,244, 72,101,101, 37,209,233,116,228,
+196,137, 19, 36, 56, 56,216, 81, 15,186,174, 94, 73, 16,128,213,109,218,180, 49,173, 88,177,130,236,221,187,151,172, 89,179,134,
+140, 26, 53,138,204,153, 51,135,140, 29, 59,150,  4,  6,  6,234,173,230, 95,111, 23, 56,235,203,199,245, 28,255, 94,156, 17,214,
+ 94,173,189,229,118,126, 13, 75, 86, 93,156, 94,214,251,107,179,252,114,121,196,113,114,156,127, 77,206,127, 46,  2,  3,  3, 63,
+ 93,176, 96,129,250,167,159,126, 50,206,156, 57, 83,213,160, 65,131,211, 79, 40, 35,130,  0,116,  7,208,165,150, 74,182, 94,153,
+219,222,219,219,187, 69,144,236,231,185,207,249,145,203,115,155,144,138, 21, 29,136,230,171, 30,228,110, 66, 87,242,229,203,205,
+ 73,135, 80,207,135,205,  3,101,109,255, 96,206,250, 12, 81,184, 85,176, 93, 28,166,112,133,211, 93, 19,240,211, 48, 41,115, 21,
+ 26,199,201,113,114,156, 28, 39, 39,180,254,190,104,214,172, 89, 70,187,118,237,238,199,197,197,165,253, 69, 50,151,106, 25, 36,
+ 31,219, 34, 72,190,187, 85,144,244, 94,155, 96, 89, 78,139, 32,217,177, 22,129,178,247, 59, 53,128,244, 79,194,217, 66, 36, 18,
+ 29,  9, 13, 13, 85,  0,120,229, 41,164,231,132,144,144,144,135, 86,107, 89,139, 39,192, 25, 13, 96, 43,128, 45,  0, 90, 63,129,
+112,186,202,199, 85,104, 28, 39,199,201,113,114,156,156,208,250,123, 98,218,180,105,124,174,192,112,156, 28, 39,199,201,113,114,
+156, 28, 39,199,201,  9, 45,247, 65,213,145, 88,199,158,114,130, 31,227, 56, 57, 78,142,147,227,228, 56, 57, 78,142,243, 31,199,
+233,140,251, 24, 56,112,202,156,227,228, 56, 57, 78,142,147,227,172,149,147,178,110,180,117, 99,143,255,204,113,167,254,196,113,
+255,167,112,254, 45,193,255,131,254,151,205,  8,  6,117,125, 61,153,195, 31,  9,251, 23,132,112,249,196,225, 79, 10, 15, 62,159,
+255,174, 72, 36,234,107, 54,155, 91,  3,128, 64, 32, 72,215,235,245,167,204,102,243, 23,  0, 84, 92, 18,253, 97,117,  7,207,174,
+177,181, 88, 55,252,  9,235, 18,123, 81,192, 60,102,187,244, 52,226,254, 79,230,252,219, 11,173, 14,114,185,252, 63, 34,145,168,
+  9, 69, 81, 22,181, 90,125, 77,175,215,175,  3,112,238, 49,255,243,155,224,224,224, 87, 74, 74, 74, 24,246, 35,197, 20, 69,129,
+166,105,  8,  4,  2,109, 69, 69,133, 87,125, 72,  3,219,142,122,159, 79, 81, 51, 45,196,178,174,232,250,190, 79,156,157,231, 80,
+247, 11, 35, 20, 10,199,248,249,249,249, 40, 20, 10, 66,211, 85,171, 71,240,120, 60,118,133,121,115, 69, 69,197,247,174,146,249,
+250,250, 94,244,243,243,243, 97,159,167, 40, 10, 37, 37, 37,229, 69, 69, 69,221,  0, 64, 34,145,156,149,203,229,254,124, 62, 31,
+ 60, 30, 15, 60, 30, 15, 26,141,166,164,164,164,164,231,239, 25,105, 95, 95,223, 20,154,166,155,184,243, 12,195, 48,247,203,202,
+202,158,229,138, 76,117,108,223,190,157, 23, 19,246, 90, 20,159,104,219,211, 52,241,102, 24,170,194, 76, 73,175, 30,206,253, 38,
+195,149,231, 95,124,241, 69,139, 11,183,245,241,242,242,218,176,123,247,110,223, 78,157, 58,209,197,197,197,104,220,184, 49, 74,
+ 75, 75,187, 37, 39, 39,119,126,237,181,215, 94, 83, 42,149,147,  0, 36,115, 57, 82, 55, 68, 34,209,138,224,224,224,215, 85, 42,
+149,134,162, 40, 66, 81, 20, 40,170,170,159, 85,115,111,177, 88,114, 74, 74, 74,186, 56,105,108,  5, 34,145,232,243,144,144,144,
+201, 26,141, 70, 99,229,115,200, 11,  0, 38,147, 41,167,184,184,184,139, 75,117,125, 96,224, 58,169, 84,250,178, 70,163, 81, 83,
+ 20,197,216, 95, 35,132,216, 55,230,247,138,139,139,123, 59, 19,  6, 34,145,104,101,112,112,240,171,214,184,219,194,249,184,113,
+ 15, 14, 14,158,172, 86,171, 93,226,172, 35,238,143,112, 62,141,112,254, 73, 57,255,254, 66,171, 99,199,142, 91, 46, 92,184,208,
+ 92, 32, 16,  0,  0,116, 58, 93,187,213,171, 87, 79,154, 59,119,110, 34,128,121,245,252,191,164,222,189,123,143, 75, 78, 78,166,
+247,238,221, 75,119,237,218, 21, 20, 69,193, 98,177,192, 98,177,160,109,219,182,210,250, 70,196, 91, 46,139,191,124,244,107, 73,
+135,129,111,204, 44,  2, 62,113,118,190, 46,129,  9,224, 67,  0, 77,220, 12,130,194,154, 46,151,127,175, 70,252, 41,  9,  3, 74,
+ 40, 20,254,171,119,239,222,222,199,142, 29,163,178,179,179, 41,169, 84,106, 91,172,212,100, 50,161, 77,155, 54,110, 89, 66,125,
+124,124,188,226,227,227,163,158,127,254,121,236,220,185, 19,147, 38, 77, 66,175, 94,189,238, 20, 21, 21,  1,  0,228,114,185,127,
+ 90, 90, 90,115, 63, 63, 63,104, 52, 26, 84, 84, 84, 96,208,160, 65, 40, 41, 41,121,236,  2,238, 21,142, 38, 22,  1, 22,  7,134,
+ 75,  7, 40, 30,104, 23,169, 31, 98, 77,109,247, 10,  4,130,240,  7, 15, 30,  4,137, 68, 34, 16, 66,192, 48,140,195, 61,251,219,
+104, 52,162, 77,155, 54,198,218,248,158,233, 24,190,152,162, 41,219,135,133,137,217, 82,122,225,106,222,135,143, 27, 39, 63, 63,
+191,203, 98,177, 56,216,169, 90,182,107,200,116, 58, 93, 97,105,105,105, 39, 39,143, 68,  2, 24,206,227,241,154,241,249,252,150,
+  0, 34,205,102,115, 48,  0,  8,133,194, 66, 30,143,151,101, 50,153,110, 25, 12,134,187,  0,126, 68, 29, 31, 64,142,  9,123, 45,
+138, 50,107, 94, 80,234,153,161,178,166,137, 45, 52,247,226,111,203,196,154,131, 49, 97,175,237,112, 85,108, 57,193,192,254,253,
+251,111,217,191,127,191, 68, 40, 20, 66,171,213,226,198,141, 27,240,246,246,134, 72, 36,194,200,145, 35,121, 61,123,246,244,239,
+215,175,223,206,219,183,111,143,135,123, 62, 31, 45,  0,108, 67,213,  7,165,223, 68,245, 47, 20,212,  7, 97,  0, 70,160,234,155,
+143,141,141, 70, 99, 49,128, 84,107,152,238,  0,136,  8, 12, 12,252,129, 97, 24,125, 73, 73,201,107,112,240,161,234,238,157, 27,
+ 94,162,105, 58,156,181,  9, 48,196,146,115, 62, 53,231,137, 52, 80, 52, 77,175,140,141,141,125,117,199,142, 29,178,212,212, 84,
+ 89,235,214,173,109, 29, 34,182,204,219,163,113,227,198,206,172, 26,124,154,166, 87,188,240,194, 11,227, 55,110,220, 40,123,240,
+224,129, 44, 52, 52,212,198,105, 47,182, 88, 56,251,132,152, 93,217,255,102,240,224,193, 19, 55,108,216, 32,216,183,111,159, 52,
+ 32, 32,  0,254,254,254, 14,191, 25,219,179,103, 79,198,121,212,233,149, 35, 71,142,156,184,117,235, 86,217,133, 11, 23,100,109,
+219,182,  5,143,199,123,236,184,143, 26, 53,106,252,150, 45, 91,100,215,174, 93,147, 53,107,214, 12,172, 81,161, 38, 31, 77,211,
+104,216,176,161, 75,156, 35, 70,140, 24,191,109,219, 54,217,229,203,151,101, 45, 91,182,180,165, 39, 91, 39,213, 39,156,127,114,
+206,127,132, 69, 75,100, 52, 26,113,234,212, 41,208, 52, 13, 63, 63, 63,188,242,202, 43, 56,122,244,104,252,137, 19, 39,246,215,
+195,178,245,141, 85,100,  9,  0, 96,215,203,163,112, 95,  0,188, 85,100,128, 80, 40,196,189,123,247,192,227,241,220, 54, 45,138,
+197,226,201,132,144,127,107,114,127, 17,107,181, 38,232,242, 46,201,164, 82,169,173,  1,208,228, 89,207,231, 95,146, 73,165,210,
+123, 60, 30,239, 99,149, 74,149, 84, 27, 95,179,102,205, 54,221,184,113,163,149,179,143, 61,215,132, 70,163, 65,163, 70,141, 34,
+ 74, 75, 75,155,253, 30,141,184, 51, 78,179,217, 12,137, 68,  2,214, 26,101, 48, 24,160, 82,169,156,113, 82, 66,161,112, 12, 43,
+178,  0, 96,243,230,205,  8,  9,  9, 65, 80, 80,144,237,163,210, 44,167,171,224,241,120,136,137,137,193,194,133, 11,145,152,152,
+136,217,179,103, 87,171,104,  5,  2,  1,252,252,252,240,211, 79, 63,193,203,203, 11, 17, 17, 17, 96,  5,126,173,  2, 42,130,166,
+ 76, 38,134,214,230,193,177,229,163,  1,164, 82, 30,150, 70,245,242,121,115,216,187,145,252,  6,205,101, 88, 60,248,210, 60,245,
+ 67,253,154,186,132,137, 80, 40,196,245,235,215, 31,169, 16, 28,222,207, 35, 48,136, 43,253, 26,247,145, 42, 28,137, 56,138,166,
+252,206, 93,122,104,179,208, 14, 25,208,138,255, 76, 39,254, 87,214,166, 18, 52, 13, 48, 76, 85,211, 73, 81, 32,102, 19, 83,118,
+233, 90,222,  2, 23,210, 51, 52, 43, 43, 43,200, 89, 26,177, 48,155,205,  8, 13, 13,229, 57,185,109,104,116,116,244,174,184,184,
+ 56, 97,179,102,205, 40,161, 80,  8, 62,159, 15, 62,159,207, 10,244,  8, 66, 72,  4,195, 48,253, 10, 11, 11,201,234,213,171,151,
+157, 60,121,114, 52,128,131, 14, 43, 22,162,109,175,212, 51, 67, 79, 95, 65,183, 23,  6,206,197, 79,219,227,187,245,238,200,192,
+ 83,166,205,  0, 80, 47,161,197,138, 13,139,153,161,238,100, 86,248,237,220,185,131,162,105, 90,175, 84, 42,193, 48, 12,122,246,
+236,  9,154,166,113,253,250,117,124,240,193,  7,216,181,107, 23,246,236,217, 35,237,220,185,243,183, 26,141,166, 53,170,190,197,
+230, 84,100, 69, 71, 71, 95,185,112,225,130,196,104, 52,162,123,247,238,231,111,223,190,221, 25,245, 91,193,221, 23,192,103,243,
+230,205,155, 24, 23, 23,199,243,241,241,129, 72, 36,130, 82,169, 68, 70, 70,198,228,239,191,255,158,172, 93,187,246, 75,  0,158,
+ 89, 89, 89, 61, 46, 94,188,136,254,253,251,191, 13,224,221, 71, 21,  1, 47,252,236,197,204, 32,246,120, 68, 76, 59, 97,143, 46,
+116, 97,149, 21,167,230,221,  4,140,133,201,185,248,107,174, 43, 66,108,217,168, 81,163, 38,236,216,177,195,  3,  0,254,251,223,
+255, 98,204,152, 49,240,243,243,131, 76, 38,131, 80, 40,132, 64, 32,168,182,119,210,216,242,  0, 44, 27, 59,118,236, 11, 27, 55,
+110,244,  4,128,141, 27, 55, 98,212,168, 81,240,247,247,135,167,167, 39, 68, 34,145,237,123,175,110,118, 48,190,233,213,173,219,
+148, 13, 27, 54,  0,  0, 62,120,231, 29, 60,255,204, 51,240,144, 73, 33,147,138,192,166,133,136, 39,192,144,183,102, 58,213,151,
+  0,150,143, 25, 51,230,165,173, 91,183,122,  2, 64,106,106, 42,138,138,138, 16, 28, 28, 12,169, 84, 10,145, 72,100,139, 51, 69,
+ 81,144, 74,165, 46,197,125,204,152, 49, 47,108,217,178,197, 19,  0,146,146,146, 16, 19, 19, 99,139,187, 88, 44,134, 80, 40,172,
+182,213, 20,157,142, 56, 71,143, 30,253,194,182,109,219, 60,  1,224,251,239,191,199,192,129,  3,225,235,235,107, 75, 79,150,203,
+157, 60,250,147,115,254, 51,132,214,149, 43, 87,254, 37,151,203, 19,  0,  4,138, 68, 34,159,241,227,199, 55,156, 50,101, 10,198,
+142, 29,139, 19, 39, 78, 76,117, 83,104, 81,193,193,193,175, 36, 39, 39,219, 90,104,  3,121, 68, 48,185,221,128, 91,241,239, 75,
+ 83,167,134, 36,102,168,112,254,226, 45, 72, 64, 83, 23,151, 47, 15,212,221,189, 11,139,193,128, 69,247,148, 85,231,205,132, 58,
+245,222, 91, 33, 29, 86,124,249,111,  0, 73,117, 52,182, 98,189, 94,143, 59,119,238,184, 21,136,236,236,108, 71, 31,127,174,119,
+ 35, 30, 17, 17, 81,215, 11,232,148,243,240,225,195,152, 53,107, 22,110,221,186,  5,246, 83, 37, 46,112, 82,126,126,126, 62,172,
+200, 98, 69,144, 84, 42,133, 64, 32,160,248,124, 62,197, 14,237, 89, 95, 46,151,132, 49, 77,211,216,180,105, 19,150, 46, 93,138,
+ 57,115,230, 96,221,186,117,104,223,190,253,111,133,144,207, 71,101,101, 37,124,125,125,225,235,235, 91, 77, 32,214,134,202,  7,
+ 12,  1, 28,139, 44,105, 35,132, 72,165,252,131, 99, 63,137,234,208,246, 57,127,168, 74,140,216, 52,247, 14,138, 51,245, 59,156,
+165, 39, 33,  4,237,219,183,  7, 69, 81, 54,161,193,110,  2,129,  0,124, 62, 31, 60, 62, 15, 58,170, 18, 77,122,  9,241,206,206,
+ 86,210,  6,205,101, 82, 71, 34,174,102, 54,127,254,197, 42, 25, 24, 82,229,  4, 66, 24,128,  1,  8,  8, 24,194,160, 48, 55,  3,
+255, 89,248,169,203,173,143, 64, 32,192,221,187,119,109,225,102, 45,195,172, 48,178,183, 26, 68, 70, 70, 58, 45, 75, 66,161,240,
+163, 61,123,246,136, 54,109,218,132,173, 91,183,130,162, 40,136,197, 98,200,229,114,248,248,248,192,223,223,223,182,133,135,135,
+ 83,223,126,251,173,176,125,251,246, 31, 85, 86, 86, 30,116,156,231,196, 91,214, 52,177,197, 11,  3,231,  2,  0, 94,152, 75, 80,
+118,231,147, 14,116,249,  2,239,250, 91, 94,170,196,198,226,197,139,241,241, 51,207, 64, 36, 18,145,138,138,114,  9,219,185,224,
+209, 60,164,165,221,192,138, 21, 43, 48, 97,194,  4,220,187,151, 65, 34, 34, 34,245,179,102,205,242, 72, 76, 76,124,199,104, 52,
+ 46,114, 38,178,218,181,107,119, 38, 37, 37, 69,162,209,104,192, 48, 12, 14, 30, 60, 40, 27, 56,112,224,233,204,204,204,222,238,
+138,173,200,200,200,125, 41, 41, 41, 61,  3,  3,  3, 81, 81, 81,129,202,202, 74,152, 76, 38,240,120, 60, 68, 68, 68, 96,217,178,
+101,212,200,145, 35,103, 76,158, 60, 89, 39,149, 74, 89,203, 70,164, 35,174,154,239,247,234, 53, 95,249, 16, 82, 85,126,  8, 67,
+170,237, 75,139,178,240,206,123,174,125,189,170, 97,195,134,111,238,220,185,211,195,222,178,100, 47,  2,236, 69, 22,187, 57, 17,
+  6,116,163, 70,141,166,252,240,195, 15, 54,206,128,128,128,106,239, 15, 77,211, 56,125,250, 52, 18, 62,154,  7,223,192, 80,172,
+ 90,243, 95,151,134, 11, 99, 98, 98, 94, 78, 74,250,173,234,110,215,180, 41,134,245,124,  6, 65,  1, 94,  8,240,245,172, 74, 39,
+134,194,213, 91,153, 78,219, 35,  0,116,195,134, 13, 95,219,190,125,187,135,125,135,144,141, 43,219,121,102,173,248,  6,131,  1,
+ 93,186,116,113, 41,238,246,156,172,181,141, 21,109,108,122,178,255,195,190,175, 78,194, 57,133, 21,194, 86,193, 89,141, 67, 32,
+ 16, 96,251, 79, 27,106,181,102,215,151,211,221,124,175,201,153,149,149,133, 37, 75,150,128,237,180,217,187, 10,133,133,133, 97,
+213,170, 85, 78,235,165, 26,239, 64, 87,  0,129,118,167, 12,  0, 68,118,123,  5, 69, 81,191, 56,184,143, 61, 47,176,142, 88,  5,
+ 90,219, 14, 37,  0, 31,  7,124,181,241, 20, 91,219,188,192, 26,247, 87,251,159, 90,133,214,254,253,251,217,183,184, 95,108,108,
+236, 41,235,239,114,177, 88,156, 45,147,201, 66,  0, 40, 15, 30, 60,136,255,251,191,255,131,213,180, 58,194,219,219,251,134,  3,
+171,206, 21,189, 94, 63, 23, 64,161,245, 20,107,174,167, 75, 75, 75,153,163, 71,143,210, 27, 71, 15,134,129,  0, 29,255,157,128,
+152,216, 88, 28, 14, 19,129,  7,160,219,205, 98,200,100, 50,126,101,101,165,201,222,111,203,129,239,214,177, 26,  5,138, 39,225,
+243,209,253,204,  1,204, 58,115,  0,221,228, 34,148,236,216,  6,229,217,100,208, 52,133, 62,242,  0,204,158,112, 20,207,122,137,
+ 33,210,171, 65,211,180,163,146,109,227,188,115,231,206,139, 94, 94, 94,  9, 53, 18,216, 21,220, 71,213,119,156, 80, 75, 56, 93,
+106,196,217,237,242,101,135, 35,144,181,114, 90,135,224, 32,151,203,113,252,248,113,219, 61,207, 61,247, 28,116, 58, 29,252,252,
+252, 92,226, 84, 40, 20, 36, 47, 47,143,218,184,113, 35,  4,  2,  1,252,253,253, 33,147,201,168, 13, 27, 54,204, 19, 10,133,225,
+ 58,157,142, 49, 24, 12, 16,137, 68,171,216,252,225,243,249,234,202,202, 74,255,218, 56,121, 60, 30,226,226,226,240,254,251,239,
+ 99,221,186,117,152, 58,117,234, 35, 22, 47,157, 78,135,128,128,  0,155,216,114,240,  2,186, 52,244, 35, 11, 67, 91,159, 96,209,
+145, 41,171, 90,  5,135,181,148, 35,101, 75,  1, 14,172,204,202, 81, 23, 90,190, 48,148, 97,167, 51, 78, 66,  8, 50, 50, 50,106,
+ 21,195, 37,101,197,120,255,227, 55,209,241, 53, 57,106, 17,113,191,113, 50,  4, 55, 46, 31, 70,218,181, 99, 96, 44, 12, 44, 12,
+  1, 33, 22, 48,102, 32,245,232,249,230,249,247,243,194,  8, 72,149,235, 45,  0,113,133,202,220,215, 95,212, 18,192,222, 83, 37,
+134, 21,206,226,206,231,243,161,211,233,176,103,207, 30,220,188,121, 19,  7, 15, 30,132, 86,171, 69, 64, 64,  0,124,124,124,240,
+204, 51,207, 96,242,228,201,136,140,140,116,154,239,132,144,164,236,236,236,142,189,122,245,162,202,203,203, 81, 94, 94, 14,173,
+ 86, 11,139,197,  2,179,217, 12, 62,159, 15,137, 68,  2,169, 84,138,224,224, 96,232,116, 58,162,215,235,147,106,227,100, 24,170,
+ 66,115, 47,254,246, 79,219,227,187,189, 48,151, 96,199, 82, 10, 81,141,196,154,227,151, 60,167,236, 61, 51,123, 16,  0,194, 16,
+155,105,129,152, 44, 76,241,251,243, 62,155, 81, 87, 56,217, 60, 73, 73, 73,193,140, 25, 51, 96,177, 88, 40,  1,159, 15, 66,  8,
+ 40,154,198,237,219,183,177,122,213,106,140, 27, 55, 14,205,162,162, 96, 48, 26,161, 82,169,208,191,127,127,193,170, 85,171,250,
+217,  9,173, 99,117,136, 44,127,173, 86, 11,165,178,202,248, 37, 18,137,176, 99,199,142,128,225,195,135, 39,231,229,229,213,245,
+ 61,210, 71, 56, 61, 61, 61, 35,120, 60, 30,174, 95,191,142,181,107,215,226,248,241,227, 40, 44, 44, 44, 11, 13, 13,245,238,215,
+175, 31,253,206, 59,239,160, 99,199,142,248,238,187,239, 36,206, 56,  9, 33,200,186,115, 26, 89,119,207,128, 97,170,132,101,213,
+230,248,119, 29, 61,160,106,225, 84,171,213,186, 43, 87,174,120,172, 95,191, 30, 65, 65, 65,104,220,184, 49,100, 50, 25, 36, 18,
+ 73,181, 70,214,190,225,117,246,110,106,181, 90, 93, 86, 86,150,199,150, 45, 91,224,239,239,143,200,200, 72,200,100, 50,136, 68,
+ 34,240,249,124, 80, 20,133,141, 27, 55, 98,243,194,  9,200,186,117, 13,163,134, 13,114, 26, 78,153, 76,246,114, 82, 82, 82, 53,
+ 19, 72,176,175, 47,248,  2, 26, 60,  1,  5,223,231, 70,  3,  0,202, 78,236,174,178, 85, 57,143, 59,165, 84, 42,117, 23, 46, 92,
+240,184,116,233, 18, 24,134, 65,100,100, 36, 52, 26, 13,188,188,188,108,241, 63,122,244, 40, 70,142, 28,137, 77,155, 54,161, 71,
+143, 30, 78,227,174, 82,169,116,215,174, 93,243,248,225,135, 31,224,231,231,135,134, 13, 27,218,226,206,110,  2,129,  0, 60, 30,
+ 15, 77,154, 52, 65, 69, 69,  5, 60, 60, 60,156,230, 81,106,106,170,199, 15, 63,252,  0, 95, 95, 95,132,135,135,219, 44,110,172,
+ 56, 90,250,213,194,106,  4, 18,170,193, 99,115,186,155,239, 53, 57, 71,141, 26,133,168,168, 40,120,121,121, 65, 46,151,219,184,
+235,226,172, 69,139,216,244, 54, 69, 81,251,237,222,137, 88,138,162,246,219,239,107,187,207,250,179,207,188,121,243,186, 36, 38,
+ 38, 46,233,209,163,199,150,148,148,148,205,181,241,213,198, 51,111,222,188,232,196,196,196, 37,246,247, 59,248,159,218, 45, 90,
+177,177,177,148, 53,146, 20,128,198,157, 59,119,254,229,196,137, 19,126,158,158,158,182,155, 31, 62,124,136,242,242,114,120,122,
+122,122,125,254,249,231, 94,253,250,245, 67,112,112,176,173,  7,112,231,206,157, 54, 45, 90,180,168,  4, 80,211,110,203,208, 52,
+141,103,159,125, 22, 55,172,163, 29, 49,177,177,  8, 15, 15,183, 57,121, 72, 36, 18,204,152, 49,131,154, 53,107, 22,159,181,102,
+ 16, 66,160,213,106,209,160, 65,  3,105, 93, 86,  8,  0,136,214, 22, 99,119,191, 62,160, 41, 64,115,249, 34,132, 34, 10, 52,143,
+ 66, 39, 82,130, 67,253,251,128,  2, 96,248,245, 28, 92,176,194, 92,  6, 48,232,105,152, 15,157, 53,226, 14,226, 69,213,151,147,
+181,104,164,164,164,192, 98,177,184,202, 73,104,154,134, 92, 46, 71, 72, 72,  8,164, 82, 41,100, 50, 25,181,101,203,150, 15, 27,
+ 55,110,220, 96,214,172, 89,116,101,101, 37,253,236,179,207, 98,204,152, 49,124,118,136, 51, 58, 58,218,105, 92, 78,157, 58,133,
+181,107,215, 98,234,212,169, 14, 45, 90, 20, 69, 33, 48, 48, 16, 94, 94, 94,245, 78, 95,113, 35, 68,  6,132, 75, 78, 77,255,174,
+173,143, 87,144, 16, 63,173,121,136,195,171,179,119,235,138,241, 57,204,184,  5,160,204, 85,139,150, 35,  1, 12, 30,  3,139, 95,
+  9, 94, 93,221, 28, 97, 45,189,145,178,165,  0,  7,191,120,104, 81, 41, 76,179, 29,136, 56, 48,  0,140,102, 19, 52, 42,173,109,
+ 72,215, 98,177,224,218,201, 95,155,223,255,245, 78,244,254, 45,155,  4,  0,160, 59,185,187,218,160,231,152,175,182,181,232,235,
+ 43,184,112,170,204,116,161,174, 50,207,231,243,241,202, 43,175, 32, 49, 49, 17, 47,191,252, 50, 14, 30, 60,136,  5, 11, 22,224,
+245,215, 95,127,196,170,229,172,231,104, 50,153,190,158, 52,105,210,212, 29, 59,118,180,156, 59,119, 46,205, 90,180,100, 50, 25,
+ 40,138,130, 78,167,131, 94,175,135, 86,171,197,173, 91,183,152, 55,222,120,227,182,193, 96,248,186,214,225, 74, 74,122, 85, 38,
+214, 28,108, 26, 78, 71,169, 51, 63,245,236,245, 76,164,150,146,118,174, 24,221, 98, 32, 25,250, 74,164, 47,  8,  1, 97,  0,134,
+  0,122,189, 26, 51,102,188,205,115,165,172,103,221, 57,141, 43,151, 47, 66, 42, 21, 67,165, 84,193,194, 88, 64, 24,  2,177, 80,
+128, 15, 63,152,143,113,227,198, 35,170,105, 83, 88, 44, 22,  8,  5, 66,124,255,253,247,232,210,165, 11, 12,  6, 67,107, 23, 44,
+ 89,254, 58,157, 14, 87,174, 92, 65,255,254,253,145,157,157,141,244,244,116, 52,111,222, 28, 27, 54,108,  8, 28, 63,126,124,114,
+ 81, 81,145,203, 31,127,191,118,237,218,188, 14, 29, 58,172, 84,169, 84,165, 42,149,106, 37,128,205,  0,202, 51, 50, 50, 90,103,
+100,100,172, 62,124,248,112,239,255,252,231, 63,188, 26, 62, 58,188, 90, 34, 15,147,201, 12,173, 86, 95,167,192, 98,143,  9, 97,
+ 92,122,103, 40,138, 34, 45, 91,182,196,240,225,195, 33, 16,  8, 32,147,201,224,225,225, 81,109,216,172,166,224,170, 43,139,  0,
+ 48, 20, 69, 33, 52, 52, 20, 67,135, 14,133, 80, 40,172,198,201,150,195,161, 67,135, 98,230,162,127,227,235,153,  3,176,118, 82,
+115, 12, 92, 92,232,204, 53, 67,245,243,207, 63, 75,223,159, 58, 21, 29,154, 53, 67,128,151, 23, 26,  5,  7, 66, 42, 22, 65,104,
+ 31, 38,202, 37, 35, 59,  1,192,240,120, 60,180,109,219, 22,133,133,133,200,204,204, 68,102,102, 38,104,154, 70,175, 94,189,108,
+ 86,152,187,119,239, 98,209,162, 69,208,235,245, 46,199,189, 89,179,102, 24, 48, 96,  0, 68, 34, 17,100, 50, 89,181, 33, 67, 54,
+ 77,149, 74, 37,162,162,162,176,119,239, 94,180,104,209,194, 41,103,171, 86,173,208,183,111,223,106,233, 41,149, 74,109,162,  8,
+  0,178, 47,168,108,255, 17, 22, 22,230, 22,231,145,139, 15,177,254,232,207,208, 27, 24, 84,106, 76,213,189, 48,  2,188,112,230,
+135,185, 46,197,157,229,252,223,255,254,135,242,242,114, 91,221,201,118,202, 89, 35, 74,195,134, 13,241,223,255, 58,182,100,214,
+208, 34,142,234,129, 88, 23,219, 91,246, 62,182,112,137, 19, 19, 19,151,212,124,222, 25,159,253,245, 26,207, 27,106,136,179, 66,
+183,134, 14,197, 98,241,252,159,127,254,217,175,162,162,  2,119,239,222,  5, 77,211,182, 49,117, 62,159, 15,163,209,136,123,157,
+170, 47, 17,  0,  0, 32,  0, 73, 68, 65, 84,247,238,193,207,207, 15, 69, 69, 69, 16,139,197,224,241,120, 48, 24, 12,  0,208,169,
+182,  6,156, 16,130,153,138, 42, 23,161,159, 66,133,200,  2, 48, 76, 81,245, 98,176, 14,241, 59,119,238,132,135,135,  7, 60, 61,
+ 61,109,123,103,195, 72,215, 50, 51, 80, 40,160, 64,159, 59, 13,138,  6,104, 10,160,120,  0, 77, 19,208, 20,  5,250, 92, 50, 40,
+ 10,144,251,251,186,219,118, 59,115,140,175,211,  1,222,157, 70,188,230,239,147, 39, 79,194, 85,206,168,168, 40,120,120,120,216,
+182,195,135, 15, 87,179,104, 89, 44, 22,248,251,251,187,194, 73,172,254, 56,  8, 10, 10,130, 64, 32,160, 54,108,216, 48,175, 73,
+147, 38, 13,222,123,239, 61,154,199,227,225,242,229,203, 72, 75, 75, 67,100,100,164,203, 62, 91,229,229,229,249,243,230,205,179,
+204,155, 87, 53,135, 34, 58, 58, 26,229,229,229, 69,182, 97,192,202,202,146,193,131,  7, 87,243,219, 40, 46, 46, 46,169,197,179,
+ 66, 32, 15, 71, 44, 33,168,212,100,227,103, 54,204,222, 17,240, 22,120, 10,142,188,254,101, 43, 31,175, 32, 33, 14,173,122,128,
+ 35, 95,230,236,212, 21,224, 67,171, 79, 16,227,106,166, 59, 26, 54,206, 45,200,198, 27, 31,142,198,164, 53,209, 96, 69, 28,239,
+ 78,123,144,146,242, 82, 67, 89,105,146, 35, 17,199, 48, 12,204, 70, 51, 52, 58, 29, 84, 74,141,205, 58, 84,148, 87,232, 51,119,
+214,187,130,229, 51, 94,  5,  0,204, 90,177,  6,202,117,191, 85,100,187,103,141, 11, 26,253,217,214,120,  0, 35,235, 10,167, 74,
+165,130, 78,167, 67,211,166, 77,145,146,146,  2,165, 82,137, 33, 67,134,128,162, 40,219, 12, 81, 55, 96,200,205,205,237, 25, 27,
+ 27,251,203, 23, 95,124,209,180,117,235,214,148, 90,173,134, 70,163,129,253,254,218,181,107,100,243,230,205,247, 53, 26,205,179,
+ 86,211,185, 67, 28,206,253, 38, 35, 38,236,181, 29,199, 47,243, 98,131,162,110,123,229,150, 53, 53,151,228,138,213,149,218, 91,
+ 58, 11, 73,  3,177,  0, 22, 48, 32,102,  6, 22,235,176,151, 11, 53, 39, 76, 38, 51, 44, 22,  6, 15, 31, 62, 68,122, 90, 26,218,
+181,109,  9,157,222, 12, 33, 95,128,153, 55,110,160,213,120,192, 32, 20,128, 97, 24, 80, 20,141,169, 83,167, 26,173, 67,  6,181,
+ 66, 42,149,174, 62,115,230,140,191, 78,167, 67,106,106, 42, 38, 78,156,104, 40, 46, 46, 22,  1,192,203, 47,191,108,216,184,113,
+163, 40, 42, 42, 10, 27, 54,108,  8, 28, 51,102,204,118,181, 90,221,214,197, 52,221,148,159,159,191,169,230, 73,127,127,255, 85,
+ 15, 31, 62,236,103,239,243, 99, 54,155,109,193,113, 24,117,  6, 48,153, 76,208,106,245,168,168, 80,194, 96, 52, 89,235, 76,  6,
+ 22,139,217,186,103, 96,182,214,163, 34, 33,223,179, 83,219, 16, 21, 33,  4, 52, 69,149,167, 94, 47,104, 88,151,104,119, 52,196,
+229,162, 53,171, 38, 44,236, 44, 51,127,127,127,  8,  4,  2,108,218,180,  9, 87,207, 30,134,136, 71, 96, 49,155, 96, 54, 25, 97,
+ 49, 25, 32,224,241,112,252,114, 38,  6,181,242,116, 73, 16,  6,  4,  4, 96, 88,143, 30,136,237,209,163,106,122, 27,159, 15, 15,
+177, 24, 50,161,164,202,146,  5,128, 88,104, 87, 23, 17, 96,216,112,  6,  7,  7,227,210,165, 75,152, 57,115, 38,150, 46, 93, 10,
+169, 84,106,155,253,124,243,230, 77,108,219,182, 13,131,  6, 13,114, 59,238,172,  5, 47, 62, 62, 30,121,121,121, 88,177, 98,  5,
+ 58,119,238, 12,129, 64,128,242,242,114, 60,251,236,179, 40, 44, 44,116,137,211,126,120, 79, 36, 18, 85,179, 62,177,  2,208,221,
+ 60,178,231,124,117, 84,  3,236, 59,187, 25, 20, 40,156,255,225,221,106,162,240,191, 91, 79,187,205,185, 96,193,130,106,225,116,
+197,154,229,178, 31, 82,117,171,147,211,251, 40,138, 74,101,141,173,241,241,241,243, 41,138,218, 31, 31, 31, 63, 63, 33, 33,225,
+134, 43,124,142,174, 83, 20,117,192, 42,194,134,217,157, 75,117, 75,104,201,100,178,110, 30, 30, 30,184,123,247, 46,134, 12, 25,
+ 98, 40, 41, 41,185, 45, 16,  8,154, 23, 23, 23,139,139,138,138,160,209,104, 84, 31,127,252,113, 38,  0,105,247,238,221,163,142,
+ 31, 63,142,236,236,108,108,220,184, 17,  0,118,215,230,167,195, 48,140,173, 80,212,236,182,241,120, 60,156, 59,119, 14,231,206,
+ 85,119,253, 90,191,126,189,211,  6, 99,204,158, 31,113,249,242,101,216, 47, 15,192,254,182, 63, 39,145, 72,128,186,103,120, 84,
+131, 51,199,120,103, 14,240,174, 54,226,181, 85,128,174, 22,196,220,220,220, 90,159, 63,119,238, 92, 53,139,150, 51, 78, 30,143,
+  7,139,197,  2,169, 84, 74,  9,133, 66, 74, 40, 20,134,179, 34,139,199,227,217, 94, 24,177, 88, 12,177, 88, 92,173,151, 90, 27,
+242,242,242,250,231,229,229,213,122, 93,161, 80,244, 84, 40, 20, 46,197, 85, 22,134,143,158, 29,219, 96, 30,  0,156,221,154,255,
+157,230, 33, 94,  7,  0,194,167,118,189,250,121,139,168,192, 72, 41,206,109, 47,192,145, 47,115,246,232, 10,176,208, 58,164,203,
+184,154,230,  7,142,238,197,155, 83,167, 65,204,147,217,249,100,209, 40,231,101, 99,250,198, 22, 96, 69, 92,234, 70,  3,246,111,
+253,  8, 41, 71,159, 55,213,101, 41, 51,154, 76,208,106, 12, 80,170,180,248, 40,225,187,170,147, 31,225,  2,128, 11, 61,223,156,
+137,184,152, 65,  3,220, 29,166,102,211, 59, 40, 40,  8,167, 78,157,  2, 69, 81,216,190,125, 59,188,189,189, 17, 19, 19,  3, 47,
+ 47, 47,196,199,199,227,197, 23, 95,116,183, 50,171, 40, 41, 41,233,249,206, 59,239,252,242,233,167,159, 54,106,216,176, 33, 12,
+  6,  3,140, 70, 35, 12,  6,  3, 50, 50, 50,176,121,243,230,108,141, 70,211, 19, 64,133, 51,178,195,185,223,100,236, 74,158,149,
+ 55,112,236, 24,237,205,194,159, 80, 80, 80,  2,179, 57, 23,140,197, 12,163,217, 82,101,225, 51,155, 97, 54, 91, 32, 20,242,188,
+ 62,253,228,221,163, 12,  8,104,154, 50,  0,120,190, 54,177, 17,209, 48,  8, 94,158, 94,104,221,170,  9, 78, 28, 90, 15,131,209,
+ 12,163, 65, 13,227,244, 24,164,103, 29,135,229,254, 49, 88, 24, 11,206,164,164,233, 77, 22, 34,144, 74,229, 84,195,  6,158,188,
+ 59,247,117, 14,195,233,227,227, 19,173, 80, 40,112,231,206, 29, 76,158, 60,185,160,164,164, 36, 29,192,115,  0, 80, 82, 82,114,
+102,226,196,137,173,147,146,146, 66, 26, 55,110, 12, 15, 15, 15, 47,181, 90,237, 44,234, 30,  0,226,  0, 12, 70,117,  7,252, 82,
+  0, 31,211, 52, 45, 78, 77, 77,125,100,166, 93,114,114, 50,  0, 92,112,220,  3,178, 90,180,116, 58, 40, 74,202,240,250,155, 31,
+254,214, 51,  2,169, 38, 46,  8,  8,166,189,  5,  9,  0, 20, 23,102,224,213,215,103,138,235, 84, 28, 12,227,176, 33,116,195, 71,
+167, 90, 71,141, 45,163, 30, 30, 30, 85,195,111,123, 55,227,192,103,111,  2, 22, 35,136, 73, 11, 24, 53,128, 81,  5,198,160,  1,
+ 37,148,  2, 38,173, 75, 66,203,195,195,  3, 30, 82, 41,130,124,124, 64,  8,  1,159,199,131, 64,192,  7, 99,  2, 40, 11,101, 43,
+ 35,140,197,165,178,110,235, 84, 74,165, 82,100,101,101, 33, 46, 46, 14, 70,163, 17,163, 70,141,130,193, 96,128, 78,167,131, 86,
+171, 69,147, 38, 77,160,209,104, 92,226, 99,103, 43,122,120,120, 64, 40, 20,226,221,119,223, 69,151, 46, 93,176,104,209, 34,204,
+153, 51,  7, 77,154, 52,193,180,105,211,176,121,243,102, 68, 71, 71, 59,227, 37,246,121,196,166, 39, 43,182,236,135,248,  0,184,
+157, 71, 53, 57, 41,138,174, 38,216,216,237,237, 73,207,185,205,153,152,152,  8,133, 66,241,136, 37,139,253, 29, 22, 22,134,175,
+190,250,170,190, 35, 67,172,245, 40,216,193,181, 97, 53, 45, 81,132,144,174, 86,223, 41,125, 66, 66,194,141,132,132,132, 88,138,
+162,246, 39, 36, 36,196,214,102,209,114,196,227,224,186,194,213, 48,243,107,140,141,246,179,191,200, 38,180,159,159, 31,175, 81,
+163, 70,180,151,151, 23,202,203,203, 17, 24, 24, 72, 20, 10,197, 88,153, 76,182,112,203,150, 45, 81, 42,149, 10, 55,111,222,196,
+170, 85,171, 46,  0, 88, 89,151,208, 58, 24,104, 53, 29, 91, 45, 89,246,199,195,135, 15, 71,227,198,141,171, 89,179,164, 82,105,
+157,133,135,189,102,107, 20,121, 60,180,104,209, 66,122,255,254,125,173, 80, 40, 68,120,120,184,180,160,160, 64, 43, 20, 10,221,
+158,233,226,204, 49,222,153,  3,188, 35,225,211,181,107,215,106, 22, 44,251,189,253,239,125,251,246, 57, 29, 58,100, 57, 91,183,
+110,109, 75, 47, 79, 79, 79,246, 89,  0,192,144, 33, 67,192, 48, 12,  2,  2,  2, 92,226,100, 69,173,213,  1, 30, 58,157,142, 81,
+ 42,149,116,106,106, 42, 68, 34, 17, 60, 61, 61,109,190, 58, 18,137,196,102,205,252,189, 32, 16,209, 83,198,124, 80,101, 96,244,
+111, 40,126,117,239,178, 76, 80,192,229,161,111, 71,246,111,218,213, 27,149, 69, 70,236,255, 60,235,129,174,  4,  9,  0,110,185,
+ 99,201,210,209,149, 94,235,206,188,131, 14, 47,139,208, 64,215, 11,159, 46,168, 42,202, 19,103,140,198,176,215,249, 96, 69, 28,
+125,167, 29,182,127, 55, 31,205,154, 53,  3, 33,132,170,189, 66, 96, 96, 48,153,160,213,106,161, 82, 85,173,155,153,113,189,250,
+  8,163, 81, 95, 89,255,180,176, 86,176,165,165,165, 56,124,248, 48,126,250,233, 39,116,233,210,197,161,168,118, 67,112, 41, 74,
+ 75, 75,123,205,158, 61,251,252,226,197,139, 67,253,252,252, 96, 52, 26,241,240,225, 67,124,251,237,183,121, 26,141,166,151, 59,
+ 21, 12,  8, 96, 50,153,161,211,232, 81, 81,169,196,194, 79,190,175,181,232,  1, 64,105,209, 45, 12, 31,241,162,168, 46,177,209,
+ 48,204,  7,201,201,201, 24, 52,176, 23,134,141,156, 92,171,216,120,115, 70, 53,177, 33,172,163, 35,240, 94,175, 94,189, 62, 81,
+ 42,149,229, 26,141,230, 69,  0,203,237,251, 83, 37, 37, 37,189, 71,140, 24,241,133,159,159, 95,231,162,162,162,249, 46,196, 58,
+ 62, 43, 43,107,126, 68, 68, 68,181,147,122,189, 30, 17, 17, 17, 45,138,138,138, 38,244,233,211,231,223,  0,252,236, 46,123,  2,
+ 56,  2,224,171,218,202, 18, 59,116,168, 82,105,225,229,211,  0,185,153,167,156,  6, 68,200,211,129, 48, 76,157,117,  8,219,  1,
+174,109,115, 50, 51,238,145,160,178,247,178, 13,246,243,255,154,132,231,227, 18, 33, 19,  0, 75, 94,237,137, 38, 62,  0,164,126,
+ 16,246,153, 11,202,199,154, 70,113, 63,186, 68, 62,103,237, 90, 92,182,214,199,225,129,129,152, 61,118, 44,136,  9, 72, 73, 75,
+195,214,159,127,198,216,254,253, 33,147, 72, 92,238,176, 48, 12,  3,161, 80,136,140,140, 12,164,164,164,160, 85,171, 86,184,123,
+247,110,181,101, 40,  8, 33,174,198,223, 22,119,177, 88, 12,129, 64,128,130,130,  2,196,198,198, 66, 40,172, 26,198, 62,117,234,
+ 20,102,207,158,141, 41, 83,166,160, 95,191,126, 72, 79, 79,119,137,147, 16,242,200,108,197,154,195,185,238,230, 81, 77,206,154,
+237,126,125,242,157,229, 92,188,120,177,195,  9, 21,174,112, 58,210, 34, 14,242, 46,213, 94, 12,177,150, 39,123, 97, 84,243, 24,
+128, 47,123, 46, 62, 62,126,190,171,207,217, 31,179, 22, 49,119,134, 48,109, 66, 43, 54, 54,182, 90,204, 75, 75, 75,207,159, 63,
+127,190,141, 92, 46,199,173, 91,183, 68, 94, 94, 94,109,216, 10,157,166,105,108,223,190,221,115,232,208,161, 71,151, 47, 95, 30,
+206, 48, 12, 10, 11, 11,241,254,251,239,171,204,102,243, 56,  0,230,218, 26,112,103,150,169, 31,127,124,244,101,219,187,119,175,
+ 75, 67, 32,172,144,226,243,249,240,245,245,213,106,181, 90,200,100, 50,248,250,250,106, 53, 26, 13,228,114, 57, 59, 86, 76,227,
+183,153, 10,206,172, 79,206, 28,227,107, 58,192, 59, 69, 90, 90,154, 75,247, 89,135, 90, 93, 42,229, 89, 89, 89,181, 86, 36,167,
+ 78,157,  2, 99,173,104, 93,229,180,246,242,  8, 43,252,100, 50, 25,252,252,252, 32, 22,139, 33,149, 74,171,137, 44,177, 88,236,
+244,197,113,182, 32,169, 68, 34,185, 40,151,203,125,216,235,  2,129,  0, 74,165,178,188,180,180,180,219, 35, 22, 34, 13,115, 48,
+121, 99,222,148, 62, 19, 67,209,103, 98, 40,  0,188,122,105, 95,209, 43,189, 95,174,114,254,220,185,248, 30, 81,230, 89, 18, 97,
+ 66,154, 59, 34, 11,  0,136, 72, 47, 27,243, 65,135, 42,235,194,198,243,152,187,248, 29,180,107,213,  1, 62,207,230,162,105,215,
+ 80, 84, 22, 25,241,235, 22, 11, 86,254,231,125,180,110,221,218,169,192,100, 64, 96, 54,154,161,213,234,160, 82,106,241,164, 97,
+ 48, 24, 32, 22,139,177,121,243,102,244,236,217, 19,221,187,119,127, 68,100,213,211, 60,159, 83, 90, 90,218,111,229,202,149, 23,
+ 62,255,252,115, 95,149, 74,133,239,190,251,174, 66,165, 82,245,  3,144,227, 86,154, 50,  4, 38,163, 17, 26,157, 30,106, 85, 85,
+ 26,220,187,177,179,158, 61,217, 42,177,209,179, 91,115, 76,159,254, 38, 50,239,103, 64, 85,126,247,177,197,  6,128,205,  5,  5,
+  5,155,235,184,126,207,108, 54,199,178,235,190,185,128,103, 34, 34, 34, 80, 80, 80, 80,237,228,131,  7, 15, 96,177, 88,244,168,
+ 90, 39,235, 53,123, 67, 50,106,153, 65,107,215,131,174,178,142,106,245, 80,169,170,172, 32, 58,117,241, 19, 41, 71,172,216,168,
+205, 39,171, 62,101,136,162, 40,155,211,247,140, 25, 51,112,237,234, 85, 60, 23, 90,137, 38, 33,158, 32,149,185, 16, 14,248, 15,
+126, 85, 72,177,252,139,131,110,115,111,179,115,129, 88,190,109,155,195,107,247, 70,142,116, 43,238,183,111,223,134, 84, 42,133,
+197, 98,121,164,189,113, 55,254,246,  2,230,139, 47,190,192,236,217,179,241,253,247,223,227,218,181,107,232,208,161,  3,  6, 14,
+ 28,136,162,162, 34, 92,189,122, 21,122,189,222,229,112,218,251,205,221,190,159,134, 99, 41,135,240, 32, 39, 19,121,  5,217,245,
+206,119,123,206,154, 66,107,215,177, 43,248,215,160, 78,245,226, 92,184,112, 33,138,138,138,170, 89,178,236,235,165,218, 44, 90,
+ 53,181, 72, 13, 20,215,240,133, 98,143, 13, 53, 68, 79,205,227,154,247,  3, 64, 17,  0,158,147,231,106, 30, 23, 39, 36, 36,156,
+100, 45, 97, 86, 94,158, 51,255,172, 90,135, 14,  1, 36,142, 28, 57,114,196,170, 85,171,  2, 37, 18,137,109,  6, 82,124,124, 60,
+102,207,158,141,166, 77,155, 34, 32, 32, 32,204,199,199,  7, 37, 37, 37, 88,186,116, 41,178,178,178,254, 15, 14, 22,218,171, 41,
+180,122,223, 87, 66, 36,250,173,195,202, 90,182,  0, 96,202,148, 41,143, 88,180,216, 12,170, 11, 38,147,  9,254,254,254,208,104,
+ 52,224,241,120, 24, 53,106, 20,239,250,245,235,150,152,152, 24,140, 30, 61,154,119,245,234, 85,203,176, 97,195,192,227,241, 48,
+ 96,192,128,202, 93,187,118,205,  2,240,153, 11, 98,235,137, 57,198,179,133,204,213,181,143, 92, 17,151,117,113, 82, 20,  5,141,
+ 70,  3,190,117, 86,150,171,156,236,208,161,253, 11, 72,211, 52,124,124,124,108,149,  7,107,209, 98,133,150, 51, 94,103, 11,146,
+202,100, 50,175, 91,183,110, 69,177, 19, 47,138,139,139, 49, 96,192,128, 59,165,165,165,143,112,105,243, 49,127,207,146,204, 16,
+  0, 67, 88,177,213,117,100, 16, 69,243, 40, 92, 59, 82,130,171,135, 74, 47,155, 42,209, 27,192, 90,  0,255,  5,176, 20,192, 92,
+  0,211,236,142, 31, 58,172, 32,117, 66,125,242,198, 60, 25,203,155,188,241, 28,190,220,181, 23,239,110,173,114,220,223,245,201,
+125, 76,125,105, 33,218, 69,183,115,109, 45, 32,  6, 48,154, 45, 80,105,117, 80,105, 53,120, 82, 96,223,135,117,235,214, 33, 61,
+ 61, 29, 58,157, 14,171, 87,175,182, 77, 42,176, 23, 89,143, 33,184, 50,164, 82, 41, 51,100,200, 16,156, 63,127, 30, 98,177,216,
+132,122,172,127,197, 16,  6, 70,179, 25, 58,173, 22, 42,231, 67,110, 78, 27, 48,163,201,  4,134,177,160,107,135,112, 92,191,118,
+ 13,114, 94, 49,254,132,176,169,234,244,244,116, 24, 12,  6, 44, 90,180,200,242,203, 47,191,156, 68,213,  2,168,172,  5,111, 66,
+223,190,125, 63,150,203,229, 62,  7, 14, 28,120, 27,192,247,117,197,221,100,182,138,246,199, 76,199,218, 70,  4, 28,249,100,213,
+103,201, 29,251,134,149, 97, 24,252,223, 27,111, 96, 96,104, 37, 70,119, 14,132, 58,255, 14,100,222,129,160,124, 34,177,252,139,
+131,184,113,223,229, 69,137,  9,  0, 12,233, 59, 18,237, 91, 61,186, 60, 88,175,231,170,250,100,103,142, 95, 68, 97,113,158,219,
+113, 87,171,213,181, 90,174,220,176,104,217,222, 57, 54,253, 58,118,236,136,230,205,155,227,228,201,147,232,212,169, 19,238,222,
+189,139,187,119,239, 34, 43, 43, 11,215,174, 93, 67, 89, 89,153,219,121,180,231,200, 86,148, 41, 75, 33, 18,138, 80, 90, 94,140,
+  7,185,153,  8,246, 15,121,236,124,103,209,114,216, 66,  0, 64,104,160,183, 91, 66,203,158,115,217,178,101,143,136,247,122, 46,
+223,100,207,127,177,174, 99,119,159,255, 61, 81,155,208,202, 84, 40, 20,221,199,142, 29, 27, 15,160,171,245, 92,  5,128,109, 71,
+143, 30, 29, 25, 20, 20,212,191, 71,143, 30,124,145, 72,132,148,148, 20,236,218,181,235,123,  0, 91,235,250, 35,145, 72,164,141,
+140,140,148,178,  5,145,125, 17,189,188,188,120, 75,151, 46,165,214,175, 95, 95,171,149,203, 89,  6, 85, 84, 84, 64,173, 86,195,
+219,219, 27, 70,163, 17, 67,134, 12,177,164,167,167, 67, 40, 20, 98,196,136, 17,150,180,180, 52, 91, 70,255,239,127,255, 11,215,
+106,181,207,254,244,211, 79,131,  1,244,113, 35,173, 88,199,120, 15,184,232,  0, 95, 91, 47,207, 21,184, 58, 28, 87, 27,231,204,
+153, 51,235,197, 41, 20, 10,205,236,202,239, 52, 77,195,104, 52,162, 83,167, 78, 40, 42, 42,178,189, 52,114,185,220, 38,178, 92,
+ 17, 90,206, 22, 36,229,243,249, 48, 24, 12,232,211,167, 15, 40,138,194,154, 53,107,234, 10,107,145, 54, 15,111,236, 89,146,249,
+ 63, 86,108, 73, 60,248,208, 41,205, 56,241,101, 25, 12, 37,240, 26, 51,102,204,248,157, 59,119, 98,233,210,165,211,226,227,227,
+149, 47,188,240,194,180,237,219,183,219,142,  1,196, 59, 34,150, 18,239, 74,205,249,230,178,100,220,129,157,136,  3, 43,226, 42,
+110,120, 34, 89,119,  6, 87, 83,175,  3,  0,214,174, 93, 11,212, 53, 20,203, 48,148,135,135, 63, 66, 67, 91, 32, 48, 72,  7,198,
+ 69,231, 17, 87, 49,103,206,156,106, 98,202,209,202,203,246, 67,140,245, 17, 54,246,251,122,113,  0,182, 33, 47,181, 90,247,216,
+ 66,139, 21, 27, 62, 94, 66,132,133, 53, 64, 69,129,253,176, 62,  5,118,170, 82, 85,152, 73,189, 29,110, 89,  4,  5,  5,117, 47,
+ 42, 42,218, 91,227,116, 41,128,143,235,232, 88,218, 50, 58, 59, 59, 27, 49, 49, 49, 56,116,232, 16,111,247,238,221,207,237,219,
+183, 47,237,206,157, 59,217,157, 58,117,106, 56,117,234, 84,113,159, 62,125, 80, 92, 92,140,206,157, 59,127,148,155,155, 91,135,
+208,178,166,163, 78, 15,181,250,201, 91, 71, 29, 89,179, 30,167, 97,100,211,125,193,130,127, 99, 96,131,114,140,234,224,141,164,
+253,103, 49,161,163, 20, 48,136,221,230, 99,195,226, 23,218, 24,145,209,221, 31,185, 46,246,170, 90,203, 53, 50,186, 59,232,236,
+187,110,199,221, 62,204, 53,203, 76,125,202,144,125,122,190,254,250,235,152, 59,119, 46,  6, 15, 30,140,187,119,239, 34, 57, 57,
+ 25,119,239,222,197,204,153, 51, 17, 29, 29,141, 14, 29, 58,184,197,185,239,216, 14, 84,170, 42, 64, 83, 52, 74, 43, 74,160,211,
+107, 49,103,218,130,199,206,119, 91,227,127, 44,161,106,116,224,232,229,122,115,126,240,193,  7, 40, 40, 40,168,102,201,122, 28,
+191,172,191, 58,234, 90, 45, 45, 19,192,255, 57, 24,174,240, 92,180,104,209,160,128,128,  0, 80, 20,133, 47,190,248,  2,126,126,
+126, 61,  1,220, 48, 24, 12,197,106,181,122,182,157,  8, 25,  8,235, 90, 27,133,133,133, 14,231,237,171,213,106,227,160, 65,131,
+  4, 13, 26, 52,168, 54,219, 80, 46,151,215,102,221,177,113,178,215,204,102, 51,230,204,153,131, 37, 75,150,160, 81,163, 70, 24,
+ 54,108, 24, 98, 99, 99, 65, 81, 20,134, 12, 25,130, 97,195,126, 27,202,245,241,241, 17, 30, 58,116,168, 47, 77,211,105,118, 13,
+ 72, 53, 78, 71, 96, 29,227, 77, 38,147,171, 14,240,213, 56,217,194, 54,115,230, 76, 44, 89,178,  4,243,231,215,237,234, 81, 75,
+ 35,254,212, 57, 75, 75, 75,171, 85,246, 50,153,108,205,232,209,163,249,217,217,217,213,196,149,253,230,160, 34,170,198,233,108,
+ 65, 82, 30,143,135,224,224, 96, 44, 94,188, 24,254,254,254,  8,  9,  9,113,180,144,159, 61,103,158,189,216,122,246,165, 16,236,
+ 93,150,137,231,187,141,197,237, 83, 43,245,110, 52, 16,213,194,105,177, 88,178,222,121,125,110,208,138,245, 75,121,172,216, 98,
+ 69,220,233,175, 85, 88,149,248, 45,250,244,238, 99, 51,179, 39, 39, 39,155, 29, 88,121,108,156, 22,194,164,126,154,248,239, 94,
+223,109,220, 39, 16,139,128,115,201, 59, 81, 89, 86,125, 56, 73,111,252,109, 42,181,168,211,115, 48, 92, 62,238, 82, 89, 98,197,
+244,194,133, 11,177,112,225,194, 58, 35,185,110,221, 58,167,156,174,138, 46,119,210,211,106,210,162,100,114, 95, 72,228,161,104,
+ 19,237, 11,134,152,221,173,163,108,156, 53,197, 70, 64,128, 63, 42, 10,170,203, 58,202,150, 70,117,106, 96,103,113,255,229,226,
+197,139, 35,252,253,253,145,147,147, 19, 40, 16,  8, 70, 84, 51, 87,105,181,136,140,140,108,161, 80, 40,158,117,198, 57,115,230,
+ 76,253,135, 31,126, 40, 30, 55,110, 28, 70,143, 30,141,113,227,198,137,133, 66, 97, 51, 66,  8,140, 70, 35,114,114,114,112,252,
+248,113, 40, 20,138,155,117,133,147, 33,132,146,202,124, 32,145, 55, 64,155,182, 62, 96, 24,115,125,235,124,135,117, 72, 77,107,
+150,155, 34,203, 97,249,  4,128, 95,142,239,197,130,119,219,226,251,  3, 23,176,234, 34,208,222,167,  8,109,  2, 21, 96, 20, 55,
+241,254,132, 46, 88,254,195,165,170,119,233,148,211, 60, 34,117,149, 65,157,214,248, 88,113,183,183, 92,217,255,143, 11, 62, 90,
+143,112,178,157, 68,165, 82,137,242,242,114, 36, 37, 37,225,213, 87, 95, 69, 81, 81, 17,178,178,178,112,231,206, 29,108,217,178,
+  5, 50,153,172, 94,121, 52,235,141, 15,240,225,242,247, 64, 64,208, 50,170, 13,226,227, 22,162,107,251, 30,143,157,239, 53,225,
+130, 53,171, 86,206, 21, 43, 86,212,183, 44,253,227,132,150, 67,  4,  4,  4,140,235,219,183, 47,116, 58, 29,  2,  3,  3,145,149,
+149,  5,154,166,155,  2, 85, 67,120, 97, 97, 97,219, 20, 10, 69, 83, 87,249,120, 60, 30,204,102,179,205,247,135,221,  0, 96,248,
+240,225,248,241,199, 31,157,246, 40, 66, 66, 66,208,176, 97, 67,188,243,206, 59,143,204,114,176,159,233, 32,149, 74,113,224,192,
+129,130,210,210,210, 82, 66,136,194,157,120,179,142,241,103,206,156,113,217,  1,222, 30, 70,163, 49,251,206,157, 59, 13,214,173,
+ 91,199,171,163,241,179,161,150, 70,252,169,115, 58,234,153, 18, 66,106, 21, 89,174, 44, 35,224,108, 65, 82, 62,159,143,219,183,
+111, 99,193,130,  5,160, 40, 10, 59,119,186,228,195,147,167,205,195, 27,187, 23,103, 46,221,147,144, 57,218, 84,  1,201, 73,245,
+202, 59,  0, 86,239,216,177,163,  3, 69, 81,236, 80,225,127,119,236,216,225,105,127, 92,171,169,172,168, 40,230,197, 23, 95, 60,
+ 74, 81, 84, 83,221,201, 10, 79,  0, 34, 86,196,229, 94,211,169, 94,158,240,178,129,207,231, 91,126, 51, 88, 49, 89,133,133,133,
+207,215,198,119,253, 86,201,122,154,166,125,135, 63,223,171, 29, 40, 10, 70,195,163, 35,213, 30,101, 42,155,200, 26,253,217, 86,
+236,158, 53,214, 21,209,147,113,250,244,105,191,117,235,214,241, 93,201,247,211,167, 79,155,  9, 33,110, 15,251,177, 13,142,209,
+104,132, 86, 91, 63, 43, 10, 33, 36, 37,225,147, 15,  7,109,216,116, 80, 64, 81,  6,156, 59,181, 19, 21,229,142,221, 25, 68,  2,
+ 62,214, 39,237, 50, 11,  5, 60,135, 78, 39, 79, 80,108, 56,195,151,163, 70,141, 26,183,122,245,234, 54,142, 46,186, 48,  9, 38,
+ 75,167,211, 33, 55, 55, 23, 26,141,102,199,188,121,243,140,  7, 15, 30,124,109,204,152, 49,232,208,161,  3, 26, 52,104,128,252,
+252,124,100,100,100, 32, 41, 41,137,156, 61,123,118,  7,128,233, 78,210,113,111,226, 39, 31, 78, 78,250,225,160,136,166,140, 56,
+151,188, 19, 21, 53, 68,251,163,214,105,  1,190,249,126,151, 81, 40, 20,220,114,102, 45,178,183,102, 61,201,134,113,196,196, 56,
+140, 94,185, 10, 77,187,198, 32,113,233, 64,124,243,201,139,248,124,136, 16,198,237, 19,208,254,133, 13,216,188,104, 40,  0, 32,
+244, 27, 23,173, 37,124, 33, 30, 58,176, 88,149, 87, 72,172,226,198, 61,171, 41, 27,247,186, 44, 87,238, 90,180,104,154, 70,227,
+198,141,209,180,105, 83,244,236,217, 19,157, 58,117, 66,255,254,253,113,245,234, 85, 92,189,122, 21, 51,103,206,172, 75,100, 57,
+205,163,126,207, 14,194,133,222,183, 30, 59,111,106,230,251,147,128, 43,101, 41, 46, 46, 14,  0,254, 81,214, 45,183,133, 86,101,
+101,229, 85,134, 97,218,121,123,123,179, 22, 41,219,181,  7, 15, 30,128, 97, 24,141,187, 25, 99, 48, 24,216,197, 49,171,173,203,
+196, 58,199,215,245,226, 19, 66, 44,165,165,165,232,219,183, 47,122,247,238,109, 27, 62,177,223,236,132,  9,118,239,222, 13, 66,
+ 72, 55,119,227,109,231, 24,175,130,155, 14,240,108, 35,222,167, 79,159,163,124, 62,223,165,175,104, 58,107,196,159, 22,167,163,
+252, 97, 24,166, 86,145,229, 74, 69,228,108, 65, 82, 62,159, 15,185, 92,142, 61,123,246, 32, 32, 32,192,157,224,229,233, 10, 48,
+ 11,192,151,168,154,132,113, 23,  0, 59,141, 47,206,254,221,174,113, 92, 27,212, 10,133,130,237, 26,134,238, 94,156,185,116,239,
+210,204,129,140, 30, 59,117, 10,252,  0, 40, 47,194,137,211,114, 77, 92, 77, 87, 44,171,235,122, 95,127,209, 41,  0,129,163, 63,
+219,250,240, 84,137, 49, 98,244,103, 91, 31,236,158, 53,182, 81, 93,207, 20, 20, 20, 12, 30, 59,118,236, 33, 87,243,221,108, 54,
+103, 22, 20, 20, 60,239,110,153, 37,132,224,214,173, 91,204,235,175,191, 94,172, 80, 40, 94,172, 79,  5, 19,191, 96,213,231, 75,
+ 62,154,225, 63,100, 80,247,174,160,  1, 67,237,206,191,132,  2,  8, 95,192,203,158, 61,127,197, 27, 47,190,248,226,239, 42, 54,
+106, 86,115,  5,  5,  5, 61,255,245,175,127, 77,199,111,174, 19,213,132, 20,106,153, 93,109,197,202,134, 13, 27,182,229,241,120,
+ 98,  0, 11,  0, 60, 56,123,246,236,151,103,207,158, 29, 12,224, 25, 30,143,215,192, 98,177,228, 90, 59, 61, 91,  1,252,234,188,
+ 28, 21, 77,  5, 97,194,135, 12,124, 38,  6, 20, 69, 12,  6,189,147, 14, 18,  8,  8, 33, 66,161,224,214, 47, 87,243,219,215,213,
+145,178,251,  2,199, 19,159, 65, 60,125,250,116, 76,159, 62,221, 86,158,214,172,233,141, 29,215,207,224,133,246, 57,208,127,221,
+ 11,148, 87, 35,151, 59,124,  0,240,193,191, 95,127, 98, 97,179,143,187,189, 69,203,209,123,224,142,143, 22,143,199, 67,113,113,
+ 49,110,223,190,141,194,194, 66,104, 52, 26,164,167,167,195,104, 52,162,172,172, 12,109,219,182,173,119, 56,159, 84, 30,253,145,
+156,255,196,225, 67,183,133,150,209,104,252, 79,227,198,141,  5, 18,137,164,141,197, 98,  1, 33,  4, 22,139,133, 88, 69,141,219,
+179,240,  4,  2,129,174,121,243,230,148,163,217,  9,236,111,185, 92,174,173,195, 90,146, 16, 25, 25, 57,143,162, 40, 94,109,189,
+ 16,246, 55,195, 48, 22, 62,159,159, 80,207,180,122, 92,199,120,251, 70,252, 73,225,105,112,214,204, 31,117,171, 86,173,108, 95,
+180,175,185, 38,138,245, 99,171,106, 39,226,188,206,  5, 73,213,106,117,126, 76, 76,140,197,254,186,253,130,166,206, 52,172,117,
+123,210, 96, 69, 92, 99, 59, 17,103,121,226,255, 66,145,  7, 67,199,189, 22,113,170,196, 24,  1,  0,172,216,  2, 33, 15,234,120,
+ 74, 91, 80, 80,208,247,105, 87, 14,247,239,223, 55, 60,243,204, 51,155,148, 74,101, 28,128,122,123,243,207,255,207,154,249, 79,
+ 34, 60, 79, 75,108,212, 86,108,  1, 44,169,103, 80, 31,148,148,148, 12,168,113,238, 87, 86, 80,177,235,218,185, 29,255,155,197,
+207, 63,233, 60, 54,155,205, 57, 77,155, 54,117,203,114, 99, 50,153,114,156, 93,175,185, 70,152, 61,110,192, 27,243,207,  3, 85,
+147,191, 75, 92,226,212,233,116,165, 61,122,244, 16,184, 25,183, 34, 87,227,222,160, 65,  3,132,134,134,218,246, 44,106,158,119,
+ 22, 78,179,217,156, 19, 30, 30,142,128,128,128, 90, 87,124,175,233,147,229, 10,231,147,206,163,186, 56, 67, 67, 55, 60,113,206,
+250,134,147,131,107, 24,200,113,114,156, 28,231, 95,150,147,199,165, 39,199,201,113,114,156,191, 35,231,223, 18,156,151, 26,  7,
+ 14, 28,106,131,133, 75,  2, 14, 28, 56,112,120, 60, 80,117,168,210, 99,110,240,212, 71,217, 30,227, 56, 57, 78,142,147,227,228,
+ 56, 57, 78,142,243, 31,199,233,140,251, 24, 56, 60, 85,  1,198,113,114,156, 28, 39,199,201,113,114,156, 28,231, 63,143,243,111,
+  9,110,232,144,  3,  7, 14, 28, 56,112,224,192,129, 19, 90, 28, 56,112,224,192,129,  3,  7, 14,156,208,226,192,129,  3,  7, 14,
+ 28, 56,112,224,192,  9, 45, 14, 28, 56,112,224,192,129,  3,  7, 78,104,113,224,192,129,  3,  7, 14, 28, 56,112,224,192,129,  3,
+  7, 14, 28, 56,112,224, 80,  5, 10,  0,246,239,223,111,251, 32, 96,108,108, 44,197, 37, 11,  7, 14, 28, 56,112,224,192,225,247,
+196,223, 90,139,216, 71,142,  3,  7, 14, 28, 56,112,224,192,129,211, 34, 79,  6, 52, 39,182, 56,112,224,192,129,  3,  7, 14,156,
+216,226, 34,198,129,  3,  7, 14, 28, 56,112,224, 68,214, 95, 10,213, 44, 90,156,224,226,192,129,  3,  7, 14, 28, 56,252,145, 98,
+235, 47,170, 69,136,117,179, 63,230,192,129,  3,  7, 14, 28, 56,112,224,240,152,  2,171,174, 61,  7, 14, 28, 56,112,224,192,129,
+  3,135, 39, 36,184,216,223,191,155,208,226,190,108,206,113,114,156, 28, 39,199,201,113,114,156, 28,231, 63, 22,124, 46,  9, 56,
+112,224,192,129,  3,  7, 14, 28, 30, 27,246, 86, 44,138, 19, 90, 28, 56,112,224,192,129,  3,  7, 14, 79, 78,100, 81,142,142,185,
+111, 29,114,224,192,129,  3,  7, 14, 28, 56, 60, 37,112, 22, 45, 14, 28, 56,112,224,192,129,  3,135,199,  3,  5,110,232,144,  3,
+  7, 14, 28, 56,112,224,192,225,169,138, 45,135, 39,107,155, 57,112,204, 13,242,250,204, 62, 56,198,113,114,156, 28, 39,199,201,
+113,114,156, 28,231, 63,142,211, 25,247, 49,252,245,208, 23,192, 73,  0,253,172,251, 90,133,215,147,  6, 55,245,149,227,228, 56,
+ 57, 78,142,147,227,228, 56, 57,206,191, 59,106, 93,168,148,115,134,231,224, 12,124,212, 61,196,236,236, 58,  7, 14, 28, 56,112,
+224,240, 79, 19, 91,196,190,145,116,132,102,  0,230,  3,240,182, 59,119, 17, 64, 66,141,251,126,  0, 32,179, 59, 86,  3, 88,  4,
+224,174,211,208, 16, 34,180,242,139,173, 27,  3, 64,  7, 64, 15, 64, 73, 81,148,137,203,179, 63, 28, 61,  0,196, 90,127,239,  7,
+112,206,205,235,127, 43, 52,104,208, 64,234,235,235, 59,248,242,229,203,162,244,244,116,156, 62,125,154,172, 95,191,222, 88, 86,
+ 86,118, 36, 63, 63, 95,203, 21,151,191,  5, 98,  0,196, 91,127, 39,  2, 56,252,152,124,148, 76, 38,155, 41,151,203,135,138,197,
+226, 80,179,217, 76,105, 52,154, 60,181, 90,125,212,108, 54,127,102,173,247,220,197, 72, 63, 63,191,215, 90,182,108,217, 44, 43,
+ 43, 43, 55, 47, 47,239,  7,  0,219,  1,188, 24, 26, 26, 58, 33, 50, 50, 50,236,214,173, 91,119, 75, 75, 75,191,  1,176,247, 15,
+ 12, 39,  7, 14,255, 36, 80,117, 89, 35, 28, 97,  1, 33,100, 66, 53,  6,234, 81,142,  1,  3,  6,140, 56,114,228,136,140, 97, 24,
+176,155, 84, 42, 53,  3,120,197,137,200,242, 79, 73, 73,137,136,139,139, 27,157,151,151,215, 69,169, 84,118,  3,  0,153, 76,118,
+ 33, 40, 40,232,151,149, 43, 87,110, 33,132,228, 80, 20,165,116, 51,162,124,129, 64,240,170,175,175,239, 80,179,217,220,137, 16,
+  2,129, 64,112,185,172,172,236,176,201,100,250,  6, 64,125,196,155,136,207,231, 79, 23,139,197, 49,102,179,185, 29,  0,240,249,
+252,107,122,189,254,176,217,108,254, 18,128,161, 30,156, 18,145, 72, 52,221,203,203,107,144,193, 96,104,  7,  0, 34,145,232, 90,
+101,101,229, 81,131,193,240,165, 85,112,254,209,224,  3,136, 37,132,  8,  0,128,199,227,141,236,214,173, 91,  4, 69, 81, 12, 69,
+ 81,132, 16, 66, 93,184,112,161,163,197, 98,161,173,229, 35, 22,192, 47,  0,204,127,197, 55, 36, 32, 32, 96,  9,195, 48,161,117,
+102,154, 68,210,229,242,229,203, 45,183,109,219,102,249,250,235,175,203,167, 76,153,226, 17, 23, 23,199, 95,179,102,205,151,249,
+249,249,111,215,188,223,223,223,255,115,154,166,  3, 92,249,127,134, 97,138, 75, 74, 74,222,251,163,226, 63,121,178,174,154,185,
+ 59, 41, 73, 18,  5, 32,167,158,229,251,233,113,234, 38, 19,  0, 72,146, 36, 69, 77,214, 77,206, 96,127, 63, 46,175, 29,226,191,
+ 58,166,236, 67,  8, 48,125,144, 39,253,184, 66, 43, 44, 44, 44,105,242,228,201,227,218,181,107,199, 39,132,192,100, 50, 65,175,
+215,183, 60,119,238, 92,191,157, 59,119,118, 81, 42,149, 47,186, 73,249,198,220,185,115, 23,127,252,241,199,  1,  2,129,128, 50,
+153, 76, 81,219,182,109,235, 52,117,234,212,119,214,173, 91,215,240,165,151, 94,242,100,207, 47, 88,176,160,107, 98, 98, 98, 19,
+  0,159,253,  1,225,228,192,225,159,134,190,168,238,163,245, 17,128,133,117,  9, 45,185,181,241, 44,180, 90,178, 96,183,183,225,
+196,137, 19,251,248,124, 62,107,209,234,166, 86,171,131,107, 88,193, 28,137,172,200,137, 19, 39,246,216,177, 99,199,146,151, 94,
+122,169, 64, 38,147, 53, 31, 51,102,140,146,162, 40,222,182,109,219, 58, 54,109,218, 84, 58,124,248,240,137,  3,  6, 12,152, 69,
+  8, 57, 77, 81,148,194,197, 72,182,241,243,243,219,181,108,217,178,136,152,152, 24, 97, 64, 64,  0,  8, 33,200,203,203, 11, 59,
+112,224,192,144,143, 62,250,104, 86,105,105,233, 40,  0,105,110, 36, 92, 87,169, 84,186,227,163,143, 62,106, 48,100,200, 16,126,
+ 72, 72,  8,116, 58, 29,210,211,211,  7, 30, 62,124,184,207,186,117,235,222,214,106,181, 47, 88,  5,134,171,232,230,237,237,189,
+243,187,185,115,131,187,191,250, 42,223,207,207, 15,132, 16, 40, 20,138,129,103, 54,108,232, 55,109,217,178,183, 43, 42, 42,254,
+229, 40,189,255, 72,136, 68, 34,122,227,198,141, 29, 68, 34, 17,  0,192, 96, 48, 32, 58, 58,154,250,187,188, 33, 20, 69,133,231,
+229,229,121, 11,133, 66,135,215, 45, 22, 11,250,244,233,211, 88, 40, 20,226,179,207, 62, 51, 21, 23, 23,119, 92,189,122,245,229,
+205,155, 55,  7,124,249,229,151, 47,  0,120, 68,104,209, 52, 29,144,147,147,227,144,211, 98,177,192,104, 52,194,108, 54,195, 96,
+ 48,160,117,235,214,127,104,252,147,146, 36,225,  0,222,155, 60, 89,247,174,245,212,103,  0,102,  1,184,143,122,126,179,235, 41,
+112,218,151,183,207,237,126, 63,118, 88,237, 16,  1,  0,  7,175,234,  0,192,239,113,211, 85, 46,151,183, 26, 63,126, 60, 95,161,
+ 80, 64, 32, 16,192,104, 52,162,160,160,  0,209,209,209,188, 77,155, 54,181,112,151, 47, 42, 42,106, 74, 98, 98, 98,224,193,131,
+  7,141, 27, 55,110, 52, 12, 26, 52, 72, 48,101,202, 20,175, 62,125,250,180, 14, 15, 15,167,191,253,246, 91,253,209,163, 71, 77,
+ 19, 39, 78, 20, 37, 36, 36,  4, 30, 56,112, 96,120, 90, 90,218,103,191,119, 56, 57,112,248,  7,226, 36,126, 91,226,129,221,215,
+ 41,180, 96, 39,174, 70,  2,128, 64, 32,232, 24, 28, 28,156,100, 54,155, 67,172, 86,157,130,194,194,194,207, 76, 38,211, 21,235,
+189,123, 25,134, 25,225,204,146, 53,113,226,196, 30,135, 14, 29, 90,126,238,220,185,138,146,146,146,144,125,251,246,233,102,205,
+154,149,  5,  0,247,239,223,111, 50,124,248,240,176, 25, 51,102,228, 12, 30, 60,120,101,255,254,253,223, 34,132, 28,165, 40, 74,
+237, 76,100, 69, 71, 71,167, 36, 39, 39,123,250,248,248, 84,187, 16, 25, 25,137,183,222,122, 75, 56, 98,196,136,166,207, 61,247,
+220,217,140,140,140,222,  0,174,187, 34,136,154, 53,107,118,236,196,137, 19, 30,190,190,190, 40, 47, 47, 71, 65, 65,  1, 52, 26,
+ 13,188,188,188,240,210, 75, 47,  9,251,246,234,217,112,198,204,183,143,229,228,230, 14,116, 81,108,117,235,217,166,205,177,205,
+  9,  9, 30,166,135, 15, 33,149, 74,161, 82,169,  0,  0,158,158,158,232,210,184, 49,255,210,134, 13, 97, 19,230,204, 57,246,203,
+237,219,  3,255, 32,177, 37,182,238,245,  0,246,243,120,188,145, 34,145,136, 30, 57,114, 36,142, 29, 59, 70,233,116, 58,190,213,
+186, 99, 30, 57,114, 36,164, 82, 41, 12,  6,135,200,170,  5,  0,  0, 32,  0, 73, 68, 65, 84,  3,131,170,161, 67,243, 95,249, 45,
+ 17,137, 68,200,200,200,168,118, 78,169, 84, 66,161, 80,160,164,164,  4,122,189, 30,229,229,229, 96, 24,134,146, 74,165, 10,134,
+ 97, 64,211,116, 77,  1, 80, 13, 66,161, 16,183,111,223,174,118,206,108, 54, 67,173, 86, 67,175,215,195,104, 52, 66,169, 84, 74,
+ 61, 61, 61,155,  5,  4,  4,228,  0,216, 91, 90, 90,250, 89, 97, 97,225,131,223, 57,250,197,172, 32, 74, 74,146,220,  3, 32,250,
+ 51,114,218, 89,178,194,172,199,191, 62,161,176,178,120,184,255,138,174,145,213, 58,150,249,  4,248, 24,  0, 56,125,250, 52, 10,
+ 11, 11, 81, 92, 92, 12,133, 66,129,240,240,112, 16, 66,220, 30,142,203,200,200,248,170,109,219,182,212,141, 27, 55, 14,  3, 88,
+179,109,219,182, 87, 74, 75, 75,227,103,207,158,237,247,233,167,159,150,206,153, 51, 39, 17,192,247,219,182,109,123,179, 85,171,
+ 86, 67,111,222,188,185,238,143,  8, 39,  7, 14, 79, 26,132,144,174,  0,  2,217,186,197, 90,239,250,219, 29, 95,165, 40,202, 96,
+119,159,193, 90, 55,212,220,179, 96,143, 21, 20, 69,253, 98,247,156,130,162,168, 95,234, 27,204, 26,251,170, 78, 55,  0,236,223,
+191,159,176,155,163, 39,131,130,130,102, 14, 24, 48, 96,121,106,106,106,235,252,252,124,223,252,252,124,223,212,212,212,214,  3,
+  6, 12, 88, 30, 20, 20, 52,211, 46, 33,106, 62,122,204,238,154, 48, 37, 37, 37, 98,215,174, 93,137,199,142, 29,171,232,216,177,
+163,225,196,137, 19,230,193,131,  7, 23, 89, 27,104,243,224,193,131,139,126,254,249,103, 75,247,238,221,165,135, 14, 29,202, 62,
+123,246,236,231, 59,118,236,  8, 38,132,240, 28,113, 90, 33,240,241,241,217,115,234,212,169, 71, 68,150, 61, 26, 54,108,136,253,
+251,247,123,249,248,248,236,  5, 32,172, 45,156, 86, 72, 36, 18,201,206,159,127,254,217,195,211,211, 19, 69, 69, 69, 16,  8,  4,
+  8, 10, 10, 66, 69, 69,  5, 10,242,243,241,224,206, 29,208,  6,  3,190,248,228, 99, 79,169, 84,186,195, 65,101,255,  8,167,183,
+183,247,206,205, 75,150,120,148, 28, 59,134, 95, 23, 47,134,209,104,180, 13,185, 26,141, 70,156,141,139,131,226,248,113,124,187,
+ 96,129,135,183,183,247, 78,  0, 18, 39,156, 79,  2,246,156,113,  0, 74,173, 91, 28,128,115,209,209,209,169,233,233,233,232,221,
+187, 55,182,111,223,222,126,246,236,217,113,179,103,207,142,219,190,125,123,251,222,189,123, 35, 61, 61, 29,209,209,209,169,168,
+238,159,245,180,195,249,212, 56, 45, 22, 75,181,141, 97,126,107, 99, 66, 67, 67,139,118,237,218,133,151, 94,122,137, 22,137, 68,
+249, 99,199,142, 21,159, 57,115,134, 88, 69,166,203,225,212,233,116,208,106,181, 80,171,213,184,127,255,190,116,217,178,101,189,
+ 22, 46, 92, 24,117,236,216,177,176,249,243,231, 79, 11, 12, 12,188, 28, 28, 28, 28,241, 59,199,221, 88,227,247, 23,  0,114,221,
+180, 16, 61,109, 78, 98,125, 30,147,117,147, 59,216, 85,176,238,242,214,149,158,  5,214,176,170,  1, 60,120,156,178, 52, 96,192,
+128,182, 81, 81, 81,193,219,110,248,162, 76,216, 18,140,208,  7,140,208,  7, 22,255,174,200, 16, 61,143, 70,141, 26,  5,123,120,
+120,244,112, 51,156, 27,111,220,184,241,140,181,167, 92,  2, 96,249,156, 57,115, 62,162, 40,234,244,156, 57,115, 62,  6,176,220,
+122,126,241,205,155, 55,187,  3,216,252,  7,133,243, 47,241,190,115,156,127, 46, 78, 39, 90, 36,144,162,168,253, 20, 69,237,159,
+ 55,111, 94,127,  0,254, 53,142,159,181,191, 15,128,200,209,158,221,236,206,  7, 18, 66,134,217, 61, 23, 88,207,224, 83, 14,182,
+223,132, 22,  0,196,198,198, 82,177,177,177,236,133,139, 20, 69,237,  3,112, 81, 32, 16,116,236,208,161,195,200,159,126,250,201,
+ 51, 48,240,183,255, 15, 12, 12,196,142, 29, 59, 60,219,180,105, 51, 82, 32, 16,116,  4,112,209,203,203,107, 95, 29, 86, 24,159,
+184,184,184,209,147, 38, 77,170,236,216,177, 35,  0,148,167,165,165,201,186,119,239,174, 54,155,205,148,217,108,166,186,119,239,
+174, 78, 75, 75,147,153, 76, 38,101,215,174, 93,229,207, 61,247, 92,214,123,239,189, 55,209,129,224,176,199,248,165, 75,151,134,
+251,250,250,214,165,132,161, 84, 42, 17, 28, 28,140,184,184,184, 16,129, 64,240, 90, 93,169,197,231,243,167, 47, 93,186, 52,200,
+199,199,  7,101,101,101,  8, 15, 15,135,193, 96,192,237,219,183,161, 83,171, 96, 82, 86,194, 84, 89, 14,197,189,187,240, 17,240,
+ 49,113, 68,108, 48,159,207,159,238,196, 90, 50,253,155, 57,115,130, 13, 89, 89,184,191,125, 59, 44,230, 71,141, 63,102,163, 17,
+215,254,247, 63,232,114,114,144,248,250,235,193, 34,145,104,250,239,108,201,250,148, 16, 34, 37,132, 72, 41,138, 90,217,163, 71,
+143, 77, 82,169, 52, 46, 33, 33, 33,230,200,145, 35, 67,146,147,147,251,153,205,102,129,217,108, 22,156, 62,125,186,183, 78,167,
+227,139,197, 98,240,249,124,130,191, 41,  4,  2,  1,132, 66, 33,164, 82, 41,122,245,234,117,111,253,250,245,166,240,240,112,193,
+206,157, 59,125, 67, 67, 67,229,107,214,172, 41, 87, 42,149, 75, 93,229, 51, 26,141,208,235,245,208,106,181,208,233,116, 56,113,
+226, 68,227, 25, 51,102,240,117, 58,157,101,248,240,225,165, 38,147, 73, 63,103,206, 28, 47, 63, 63,191, 89,191,103, 60, 39, 79,
+214, 49, 86,203,211, 77,171,104,201,196, 99,250, 60, 61, 13, 78,  0,  6,171, 79, 22,139,  0, 43,183,225,  9, 37,133, 25,128,202,
+ 42,180,244, 53,222,143,118,118, 22, 95,167, 40, 47, 47, 95,247,205, 55,223,132,211, 98, 31,156, 49, 12,197, 22,230, 35, 28,241,
+ 94,131,162,136,247, 17, 20, 30,133,113,227,198,  5, 17, 66,214, 60,129, 48,175,  6,208,  7,192,202,250, 60,252, 59,132, 51, 66,
+ 46,151,111,247,244,244, 60, 35,151,203,183,195, 58, 60,251, 56, 24, 20,133,129, 35, 90,209, 57,131,154,130,140,104, 69,231, 12,
+138,226,150, 26,248,187,160,134, 22,177,135,130, 16, 18, 75,  8,137, 77, 76, 76, 92, 98,215,190,179,199, 82, 23, 45, 99,177,132,
+144,216,106, 10,169, 74, 96, 61,182,209,205,193, 86,165, 41,236,149,164, 93,228,108,179, 11,131,131,131,147,146,146,146, 60,107,
+ 50,230,231,231,163,178,178, 18, 31,126,248,161,231,164, 73,147,222,206,201,201,153,236, 36, 16,162,130,130,130, 78, 19, 38, 76,
+144, 24,141,198, 50,134, 97,232,202,202, 74,190,183,183,183,133,189,193,219,219,219, 82, 81, 81, 33, 80,171,213, 60,139,197,162,
+159, 52,105,146,232,245,215, 95,239,  2,128, 87, 27,105, 96, 96,224,160,161, 67,135,214, 58,116, 96, 50,153,160, 86,171,161, 86,
+171, 97, 52, 26,209,171, 87, 47,241,250,245,235,  7, 23, 21, 21,253,183, 86,197, 33, 22, 15, 26, 52,104,144,160,180,180, 20,222,
+222,222,120,240,224,  1, 50, 51, 51,161, 87,169, 96, 84, 85,194,168, 82,194,172,172,  4,169,172, 64,201,221, 91,232,222,170,165,
+240,  7,177, 56, 70,173, 86,127, 94, 27,167,151,151,215,160,238,175,188,194,151,203,229,232, 55,161,106,158,193,161, 86,173, 64,
+ 44, 22, 48, 22, 11, 44,102, 51, 98,110,223,134,201,100,  2, 77,211,232, 90, 90,202,247,218,176, 97,144, 66,161, 88,254, 71, 20,
+118,177, 88,204,223,184,113,227,120,145, 72,  4, 66,  8,101, 48, 24,112,228,200,145,127,220, 75, 47, 18,137, 32,145, 72, 96, 52,
+ 26, 17, 25, 25,169,157, 48, 97, 66,202, 39,159,124,210,136,166,105,185, 80, 40,252,169,164,164,100, 73,126,126,254,125, 87,249,
+ 76, 38, 19, 12,  6,  3, 12,  6,  3,180, 90, 45,238,221,187, 23,210,184,113, 99, 42, 46, 46,206,162,209,104,154,172, 90,181, 42,
+227,200,145, 35,178,165, 75,151,142,  1,240,214,239, 29,223,201,147,117,173,  0,180, 74, 74,146,  8,173,150, 95,195,159,140,147,
+160,202,241, 29, 73,146,164,116,  0,138, 39, 40,178, 68,  0,188, 27,249,243,213,  2, 30, 84,  0, 60,173,162, 96, 12, 69, 81,221,
+ 91,183,110,237,155,158,158, 94, 70,  8, 57, 15, 96, 11,128,252,186,200, 24,134,161, 24,134,193,212,110,229,136,235,193,131,201,
+ 84,129,138,138, 10, 60,120,240,  0,105,105,105,184,112, 33,173,190,239,230,107, 30, 30, 30,131, 37, 18, 73,164,217,108,166, 85,
+ 42,213,  3,141, 70,115,140, 97,152,117,168,135,143,218,211, 10, 39, 11,185, 92,190,108,254,252,249, 61,189,189,189,113,229,202,
+149, 38, 91,183,110, 93,166, 86,171, 31,203,185, 94, 34,160,191,253,124,197,154,176,176, 32, 31, 92, 77,254, 49,108,201,218,109,
+223,  2, 76, 56, 39, 83,254,250,168,161, 69,236,197,208, 47,132,144, 97, 20, 69,237,175, 41,148,220, 50, 59, 61,230,243, 78, 44,
+ 90, 53, 63, 44, 93, 93,104,213,162, 32, 97, 54,155, 67,236, 45, 89,132, 16,228,231,231, 35, 55, 55, 23, 10,133,  2,190,190,190,
+ 48, 26,141, 33,174,212, 15, 74,165,178,155,191,191,191, 70, 32, 16,232,181, 90, 45,100, 50, 25, 35, 16,  8,136,245,127, 40,235,
+172, 69,139, 94,175,167,248,124,190,201,211,211,211, 67,175,215,183, 68, 29,190,100,132,144,110,254,254,254, 14,175,233,245,122,
+168, 84, 42,168,213,106,168, 84, 42,232,245,122,  4,  7,  7,195,108, 54,119,170,179, 75,107, 54,183, 11, 12, 12, 68, 94, 94, 30,
+164, 82, 41,114,114,114, 96, 80, 41, 97, 84, 42, 97, 86, 87,194, 82, 81,  1,166,178, 18,140,186, 18, 38,131,  6, 97,205, 91,129,
+157,145, 88,107, 55,220, 96,104,231,239,239, 15,181,250, 55,119, 51, 98, 21, 88,102,179, 25,102,171,115, 52, 59,156, 24, 16, 16,
+  0,118, 70,226,239,  4, 61,128,217, 52, 77,175, 20,139,197,252,105,211,166, 33, 63, 63,191, 90,153,152, 54,109,154,205, 39,171,
+ 79,159, 62,167, 37, 18,137, 89,161, 80, 64,175,215, 11,254,174, 47, 61, 69, 81,160, 40,170, 42,143,204,102,  4,  4,  4,168,139,
+139,139, 47,148,151,151,143,175, 15,159,201,100, 98,103,116, 65,171,213,130, 16,130, 43, 87,174, 64, 34,145,  8, 44, 22,203, 13,
+179,217, 44, 19,  8,  4,160,173,206, 95,191, 23,172, 51,  2, 63,  3, 16,110,181, 16,189,134, 42,135,243, 92,  7, 21,137, 75, 73,
+231, 34,167,251,194, 77, 55,153,181, 52,229,162,126,195,145,142,208,175,165,143,232,243,132,238, 65, 62, 29,134,203,213, 50, 17,
+ 79,205, 60,232, 16,249,221,167,105, 91, 39, 77,124,205,115,209,162, 69, 17,  1,  1,  1,146,140,140, 12,221,199, 31,127,220,120,
+227,198,141, 20,170,134,233,106,197,195,135, 15,119,207,159, 63,223,111,232,208,161, 77,196, 98, 49, 85, 81, 81,  1,133, 66,129,
+194,194, 66,100,102,102,146,171, 87,175,222,211,235,245,219,221,  9,100,131,  6, 13,214,143, 31, 63,126, 82,231,206,157,  5,172,
+133, 84,173, 86,119, 60,117,234,212,136, 67,135, 14,245, 86,171,213,110,151,203,236,236,236,237, 31,124,240,129,252,249,231,159,
+111, 41, 22,139,233, 39, 17, 78,123,208, 52, 29,236,225,225,129, 99,199,142,193,199,199,  7, 52, 77,  7, 63,110,121,213, 25,153,
+176,208, 16,127,232,206,126,142,150,129, 17,208, 25,153, 48, 78,162,252,125, 44, 90,181,180,245, 93, 89,139,148, 19,177,164,141,
+143,143,159, 79, 81,212,254,248,248,248,249,142, 44, 90,214,159, 22,251,251,236,238,215, 63,105,177,229,214, 66,147, 12,195, 32,
+ 55, 55, 23,121,121,121,200,205,205, 69, 73, 73,  9,104,154,  6, 33,196,149,217,103,132,162, 40,230,232,209,163,190, 41, 41, 41,
+234,174, 93,187,150,179,254, 47,102,179,153, 50,153, 76,148,213, 47,134,122,240,224,129,240,204,153, 51, 62, 55,111,222, 12,182,
+246, 86, 25, 39,166,192, 71,206,177,  2,203,126,211,233,116,144, 72, 36,174,169, 14,107, 67,120, 37, 53,181, 74,100,169,148,214,
+ 33,195, 10, 88, 42, 43, 64,212, 74,136, 44, 38,136, 64, 64,233, 52, 46,167,159, 61, 88,145,101,180, 10, 45,131,193,  0,147,201,
+  4,134, 97, 96, 54,255, 33,126,229, 95,181,111,223,190,211,238,221,187,167,228,230, 62,218, 22,142, 26, 53, 10,111,189,245, 22,
+102,204,152,113,115,216,176, 97, 87,127,252,241, 71, 76,159, 62, 29, 12,195,116,  0, 80,  1,224,208,223,237,165,215,235,245, 54,
+ 11,148, 78,167,131,209,104,  4,220,248,172, 66,205,178,201,230,173,217,108,102,185,169,221,187,119,225,244,233,211,116, 90,218,
+141,240,105,211,226, 88,135,251,223, 59,170, 57,168,154,185, 39,178, 86, 20,  6, 84,249, 63,213,182,164, 66, 83,212, 61,100, 71,
+234,226,124, 28,180, 95,219,254,165,119,223,125,119, 16,170,102, 56,223,127, 76,139,214,243, 34,154,250,122,102, 59, 63,201,172,
+246,254,106, 17,159, 82,221,254,122,190, 42,179,145,151, 58,184,161,204, 16,222,216, 39,116,201,146, 79, 26,220,188,121, 75,255,
+225,135, 31,166,143, 29, 59, 54,104,214,172, 89,173,119,238,220,217, 91,167,211,125,  3,160,188, 54,163,203,136, 17, 35,206,  7,
+  5,  5, 53, 94,187,118,109, 81,118,118,182,175,201,100,146, 27,141, 70, 70,173, 86,103,106,181,218, 99, 70,163,241, 24,128, 84,
+119,  2,235,233,233,217,254,149, 87, 94, 17,148,151,151,131,207,231,195,104, 52,162,168,168,  8, 61,123,246,228,237,219,183,175,
+ 77,125, 18,160,172,172,236,243,111,190,249,230,228,230,205,155,  7,123,121,121,117, 22,139,197, 33,  0, 44, 74,165,178, 80,173,
+ 86,255, 90,159,112, 86,171,231, 44,150,194,212,212,212,166, 94, 94, 94,120,248,240, 33, 44, 22, 75,225,227,150,  1,137,144,206,
+190,150,188,175, 97,171,128,198, 56,147,114, 30, 18, 33,157,205, 45,245,245,183,  7,235, 67,  5,123,  1,229, 64, 32,165, 36, 36,
+ 36, 72, 19, 19, 19,145,144,144,112,195,145, 69,139, 21, 92,  9,  9,  9, 55,216,251,236,238, 79,126,140, 48,214,110,209,170, 77,
+ 65,  2, 85,179, 11, 21, 10,133,175,143,143,143, 77, 96,229,229,229, 33, 47, 47, 15, 34,145,  8, 15, 30, 60,128, 72, 36,202,119,
+165, 19, 34,149, 74, 47,117,236,216,177,197,253,251,247,133, 31,127,252,113,195,212,212, 84,175,158, 61,123,182,149, 74,165, 22,
+ 66,  8,116, 58, 29,157,158,158,238,177,124,249,242,176,110,221,186, 25,186,117,235,118,121,219,182,109, 90,212,177,254, 21, 69,
+ 81, 23,243,243,243,155, 68, 70, 70,178,162,173,154,184,178, 23, 92, 64,213,144, 39,159,207,191, 92, 87, 64,249,124,254,181,219,
+183,111, 15,148, 73,196, 48, 40, 43, 97, 84, 85,194,172, 84,194,162,172,128,165,162,  2, 80, 87, 66,100, 54, 67, 96, 49, 65, 42,
+145, 32, 55, 39,  7,124, 62,255, 90, 93,156, 34,145,232, 90, 97, 97,225, 64, 31, 31, 31, 91, 35,106, 50,155,171, 54,139,  5,  6,
+179,217,102,209, 18,  8,  4,200,206,206,134, 72, 36,186,246,123,151,100,154,166, 45,236, 18, 14,181,196,  3,193,193,193, 76,247,
+238,221, 49,125,250,116, 88, 44, 22,107, 54, 80,253,  0,156, 65,149,127,203, 95, 18,142,196, 45,235,180,174,213,106,161, 82,169,
+ 80, 86, 86,198,151, 74,165, 45,194,194,194,206, 27, 12,134,237,102,179,249,219,204,204,204,202,218, 56,173,194,204, 38,186, 24,
+134,  1, 33,  4, 22,139,  5, 38,147,  9, 66,161,144, 57,117, 42, 25,203,191, 88,134,164,111, 55,146, 17, 35, 70, 80,251,246,237,
+  3,195, 48, 57,191,115,244, 13, 86,209, 82, 87,165, 81,115, 73,133,247, 81,247,146, 10,181,113,218,247,254,236,207, 81, 14,238,
+121,  4,239,190,251,238, 97, 84, 13, 25, 22, 91,197,220,227,112,126, 86,190,229, 19,  9,204, 22,181,254,212,102,213,166, 59,149,
+234, 69,155, 86, 92, 50,136,120,149, 93,250,  6,183,107,210,184,  5,207,199,199,151,254,239,186,149, 37, 63,108,220,145,241,240,
+225,195,202, 47,191,252,178, 71,139, 22, 45,188,127,253,245,215,176,218,132,150, 76, 38,107,246,218,107,175,189, 82, 86, 86, 38,
+ 76, 74, 74,218,150,159,159,127,  9, 85, 75,203,216,207,160, 30,  6,224,123,171, 16, 13,182,214,115,103,  0,124, 92, 87,127,141,
+162, 40,252,252,243,207,143,204, 14,100, 30, 79,157,251, 68, 69, 69,189,116,255,254,253,211,133,133,133,255,170,121, 81, 40, 20,
+ 46,106,222,188,121,204,141, 27, 55, 62,  2,112,208, 29, 98,141, 70, 51,103,199,142, 29,159,242,120,188, 80,139,197,146,247,255,
+236, 93,119, 88, 20,215, 23, 61, 51,219,151,222, 97,  5, 65, 65, 84, 20, 53, 63, 75, 52,177,160,177,196, 88, 18, 19,193, 30,141,
+ 49, 26,147, 88, 99,139, 93,212, 24, 53,177, 17,187,198, 32,177, 18, 75, 68, 77,212,216, 21, 27,  6, 27, 54,164, 73,  7,  5, 22,
+182,239,206,204,239, 15,118,201,178,236,194, 46, 26,141,102,206,247,237,183,187, 51,111,206,123,111,234,153,251,238,189, 79,161,
+ 80, 76,123,102,139,150,150, 30,181,100,253,238,205, 10, 53,229, 47, 22,112, 50,148, 90,250, 51, 86,135,188,190,214, 44, 61, 10,
+140,172, 81,  5,  0,  8,147,255,137,250,135,145,154, 97, 24, 67,217,  2, 35, 43,150,218,196, 10,102,110, 93,193, 51, 36, 75,103,
+ 44,221,227, 44, 89,180,190,  1,240, 38,128, 43,121,121,121,171, 63,254,248,227,239,119,236,216,225, 40,149, 74,145,151,151,135,
+252,252,124,112,185, 92, 56, 57, 57, 97,221,186,117,138,188,188,188,213,198,219,160,106,  6,121,  0, 80,122,120,120, 92,139,137,
+137,241,217,180,105, 19,119,248,240,225,233,189,123,247,110,188,110,221,186, 20, 62,159,207, 80, 20, 69,168, 84, 42, 98,204,152,
+ 49, 65, 43, 87,174, 76,227,112, 56,118,  3,  6, 12, 32,236,237,237,175,160,154,180,  1,  5,  5,  5,199, 15, 28, 56,240,225,228,
+201,147,133,106,181,218,172, 37,203,176,204,197,197,  5, 23, 46, 92, 80, 23, 21, 21, 29,171,193,138,113,252,247, 35,135, 59, 13,
+ 29, 56,144,175, 45,149, 66, 91, 42,133, 78, 42,  5, 85, 90, 12,162, 76, 10, 30,165,131,152, 79,195,199, 79,  4,157,194,  1,135,
+175, 38,106, 85, 42, 85,181,137, 13,165, 82,233,241,243,209,209,157,223, 12,  8,224, 94, 24, 63, 30, 26,173, 22,239,221,191, 95,
+ 33,174, 52, 26, 13, 14, 54,111, 14,138, 32,240,198,232,209,120,168,211,233,164, 82,233,241,127,227,197,112,227,198,141,252, 33,
+ 67,134, 36,208, 52,221, 18, 47,104,210,204, 23,  1,173, 86, 91,197, 26, 69, 81, 84,185,213,177,220,114, 32, 56,124,248,112,167,
+164,164, 36,254,173, 91,183,112,238,220,185, 55,118,236,216,241,141,191,191,127,243,140,140,140,220,154,196,155,185,164,191,208,
+251, 31,238,217,185, 23,159,127,254, 57,145,155,155,139, 93,187,118,161,166,228,169,255,  4,134, 15, 87,210,209,209,162,186, 48,
+241,123, 50,147, 82,225, 47, 88,153, 82,193, 18,167,114,120,185,149, 76, 20, 93,158,108, 84, 57,188,124, 56, 80, 20, 93,163,165,
+ 12,195,149,195,165,122,135,248,156,231,192, 41,131,142, 18,171,207,236, 44,235,125, 36,163, 52, 62, 71,177, 16,192, 31, 80, 82,
+204,195,235,204,141, 86,173, 92, 61,  0, 64,165,164,124,130,131,131,195,184, 92,174,  0,  0, 28, 28, 28, 90,185,187,187,175,123,
+242,228, 73,  7,115,199,180, 79,159, 62,237,188,188,188,254,119,244,232,209,196,156,156,156,219,  0, 46,155, 22, 10, 10, 10,154,
+125,247,238,221, 54, 60, 30,143,168,225, 28,  1,  0,132,133,133, 53, 18, 10,133,238, 71, 30, 56, 67,202,111,  0,134, 83,  2,112,
+ 69,160, 92, 90, 32,157,223,  4,126,126,151,220,139,138,138,222, 40, 41, 41, 73,180,241,208,119,249,240,195, 15,127,138,142,142,
+246, 11, 11, 11, 99,174, 95,191, 78,154,142, 34,  4,  5,  5,245,136,143,143,111,249,217,103,159,109,216,189,123,247, 23,168, 28,
+105, 91, 19,210,245,249,  6,159, 27,142, 39,227,  4, 64,  5,232,109,102,172, 66,249, 15,192,150,148, 11,207,144,158,225,153,154,
+104,209,128, 97, 97,249,155,250,156, 88,111,106,181,218,191,110,220,184,113,112,192,128,  1,101, 79,158, 60,129,187,187, 59,234,
+213,171,  7,130, 32,176,110,221, 58, 69,106,106,234,175,250, 92, 90,111,102,103,103,191,175, 23, 91,230, 80,186,102,205,154,221,
+219,183,111,119, 73, 72, 72,224,232,116, 58,167,198,141, 27,203, 47, 94,188,232,192,227,241, 24, 62,159, 79, 39, 36, 36,216,  5,
+  5,  5, 41,  9,130, 16,254,249,231,159, 79, 46, 93,186,228, 63,117,234,212,173,168, 28, 38,110,138,157,139, 22, 45,202, 74, 73,
+ 73,129, 74,165,130, 84, 42, 69, 73, 73, 73,197,167,184,184, 24, 37, 37, 37,224,241,120,200,205,205,197,190,125,251,114,244, 89,
+226,171,179,108,172,253,113,221,250,130,156,140,116, 56,217,137,161,147, 22,131, 42,121,  2,148,150, 64,160,213,192,158, 71,161,
+110,  3, 49, 68,118, 78,200,147,150, 33,250,226,213, 92,125,150,120,203,230,  2,181,122,237,184,149, 43,243,116,124, 62,  2, 34,
+ 34,160,209, 15, 21, 26, 11, 45,138, 32,224,223,181, 43, 72,103,103,124,251,235,175,121,250, 44,241, 47, 20, 52, 77,115,212,106,
+117,117,253,  0, 77,211,153, 73, 73, 73,187,  1,156, 38,  8,130, 33,  8,130, 65,121,178,182,178, 87,249, 66,214,106,181,152, 59,
+119, 46,248,124, 62,230,206,157,139,121,243,230,225,251,239,191,199,250,245,235,241,203, 47,191,224,240,225,195,245,207,159, 63,
+207, 63,123,246, 44,179,100,201,146,194,160,160, 32,206,232,209,163, 93,196, 98,241,164,234, 56,167, 77,155,  6, 71, 71, 71, 76,
+155, 54, 13,203,150, 45,195,150, 45, 91,112,240,224, 65, 92,184,112,  1, 28, 14,135,206,204,124, 12,165, 82,201,172, 89,179, 38,
+235,224,193,131,138,213,171, 87,131,203,229, 18, 47,233, 38, 49, 73, 47,168,140, 45, 65,166, 41, 21,158,  0, 88,133,154,125,163,
+ 44,113, 66, 20, 29, 93, 87, 47,142,146,141,  4,209, 33,  0,147, 81,125,120,181,129,227, 11,  0, 62,207,129,115,150,120,200,156,
+ 36,151,205,247, 30,197,231, 40,102,  1,248,221,208, 39, 39, 39, 39,241,254,253,  7,184,  0,240,107,236, 62,222,253,251,247,157,
+ 15, 28, 56, 32,242,242,242,194, 47,191,252, 34, 18,139,197, 94, 22, 56,169,131,  7, 15,170,  4,  2,129,251,168, 81,163,122,182,
+105,211,102,162,254, 69,180, 43,128,166, 40,143, 94,236,254,232,209,163, 59, 30, 30, 30, 15,142, 29, 59, 38,179,230,  0,149,150,
+150,110,253,249,231,159,235, 61,165,220,112, 68,246, 33,162,233,229, 56,236,242, 19,210,  3,230,193,174, 78,107, 12, 30, 60,184,
+ 14, 69, 81,155,109, 60,238,131,251,245,235,247,115,116,116,180,223,168, 81,163,114,175, 95,191,158,  7, 32, 26, 64,140,241,231,
+238,221,187,133, 31,127,252,113,206,230,205,155, 37,  3,  6, 12, 88, 15,160, 63,251,232,103,193,162,242,187, 16,106,138, 58, 52,
+243,192,173,248,157,159,159,191,166,168,168,232,194,195,135, 15, 39,168,213,106,  9, 65, 16, 12,159,207,207,205,203,203, 91,109,
+148,176,212,156, 95, 73, 55,232,115,109, 16,  4,161,101, 24, 38,179, 75,151, 46,147,186,118,237, 26, 21, 23, 23,167,236,220,185,
+ 51, 98, 99, 99, 61,186,116,233, 34,167,105,154, 57,114,228,136,199,187,239,190, 43, 63,125,250,180,108,204,152, 49,141, 27, 54,
+108, 56,122,218,180,105,  5,  4, 65,208,230, 56, 13,207,178,226,226,226,126, 61,123,246,188,240,235,175,191, 58,185,184,184, 64,
+167,211, 65, 46,151, 67, 46,151,131, 97, 24, 56, 59, 59,163,160,160,  0, 11, 23, 46,148,150,148,148,124, 96, 70,184,153,114, 42,
+149, 74,101,255, 47, 38, 78, 62,190,122,193, 92, 71,255,250,245,241,228,158, 18, 58,165, 28, 60,134, 68,221, 70,206,224, 11,196,
+120,120,191, 20, 83,118,239, 47, 85, 40,149,225,102,222,150,171,112,150,148,148,244, 31, 62,111,222,137, 13, 83,167, 58,252,207,
+219, 27, 28, 14,  7, 42,149, 10, 20, 69,129,199,227, 33,116,248,112,240, 61, 61, 49,123,247,110,153, 84, 42,237,143,170, 83,241,
+152,114, 62, 15, 24,115,126,113,227,198,141,143, 67, 66, 66, 48,118,236, 88,244,235,215,175, 82,193,  3,  7, 14, 96,253,250,245,
+ 80,169, 84, 31,  3,184, 14, 96, 29,202,135, 58, 96, 34,178,254,233,118, 62,119, 78,138,162,138,238,223,191,239,180,124,249,114,
+ 66,163,209, 96,193,130,  5, 48,  8, 78,195,121,253,229,151, 95,214,113,116,116,196,252,249,243,213,133,133,133,239, 44, 91,182,
+236,100, 76, 76,140,199,214,173, 91,  7,  3,152,102,202, 73,211,116,254,205,155, 55, 29, 55,108,216, 64,234,116, 58,172, 88,177,
+162,202,240,228,200,145, 35,161,209,104,193,225,112,213, 74,165,170,169, 88, 44, 78,118,119,119, 23, 51,149,157,187, 94,228,254,
+244, 69,121, 10,  3, 99,199,119,181,177,127, 22, 44,167, 84,176,133,179, 64, 20, 29,221, 89, 57,124,248,105,189, 32, 74,210,151,
+137, 53,152,244,109,224, 52,  8,194,218,112, 30,215,127,106,132, 82,169, 68, 65, 65,  1, 10, 11, 11,225,226,226,  2, 14,135, 67,
+ 88,106,167, 74,165,186, 53,101,202,148, 27,155, 55,111,238, 22, 31, 31,223,247,236,217,179, 93, 78,156, 56,161, 76, 79, 79,215,
+105,181, 90, 70, 34,145,112, 59,116,232, 32,234,213,171,151,189, 80, 40, 36,103,205,154, 85,184,120,241, 98, 15, 84,246, 97, 51,
+237, 59,135, 32,  8,124,221,169, 20,211,186,112,160, 86,107, 80, 92, 92,140,172,172, 76,220,185,115,  7,241,241,247,192, 48, 12,
+105,195,113,119,  7, 48,107,215,174, 93,190,  2,129,128,216,189,123,119,157,221,187,119,215,104, 73,221,177, 99, 71,157, 61,123,
+246, 68,234, 71, 47, 50, 95,197,235,157,229,252,215,114,190,202, 48,205, 12,143, 26,133,150,254, 62,255, 38,244,147,146,106,181,
+218, 43,102, 82, 56,124,  3, 96,174,145, 21,172, 38,115,158,148, 97,152,115,221,186,117,251,178,107,215,174, 43,123,244,232,145,
+147,147,147, 19,184, 98,197, 10, 63,157, 78,167,185,115,231, 14,153,156,156,156,126,237,218,181,  6, 13, 27, 54, 28,125,247,238,
+221, 51,  4, 65,104,172,232,224,157,228,228,228,246, 93,186,116,217, 55,122,244,104,255,118,237,218,  9, 92, 92, 92,192,229,114,
+145,146,146,130,196,196, 68,245,158, 61,123, 50,139,139,139,109,153,130,231, 74, 90, 86, 86,247,  1, 95, 77,248,117,116,191,190,
+ 30,109, 27, 55, 18, 72, 36, 18, 64,161,192,189,140, 92, 92,186,151,168,217,114,238, 82,129, 74,165,234, 15,235,167,224,185,114,
+237,225,195,110,239, 76,157,250,107,228,208,161,222,200,201,225, 74, 36, 18,  8,  4,  2,164,166,166, 34,153,166,117, 75, 55,110,
+204,211,139,172, 23,157, 21, 94,  8, 96, 57, 77,211, 92,  0, 16,139,197, 24, 55,110, 28,140,167,220, 89,191,126, 61, 20, 10,  5,
+  0,112,  9,130, 88, 14,224,167, 87,221,138,101,192,211,167, 79,103,191,247,222,123, 75,184, 92,174,197,172,183,174,174,174, 40,
+ 45, 45,133, 78,167,163,178,178,178,238,185,186,186,130,199,227,129, 97, 24,179,215,209,147, 39, 79,102,247,239,223,127, 17, 73,
+146,150, 44, 31,112,114,114, 74, 63,121,242,100,240,103,159,125, 70,110,219,182, 45,101,212,168, 81,194,147, 39, 79, 82, 12,195,
+236,123,209,251,160, 99,199,157,192,134,225,225,  0,194,129, 42, 14,239, 89,250,101, 54,165, 84,232,216,113, 39, 54,224,111, 78,
+227, 97, 60,131, 32,210, 91,161,154,136,162,163, 87,162,220,207,162, 90,238,142, 59, 59, 98,195,112, 60, 87, 78,107, 96,172,125,
+101, 50, 25, 40,138,170,206,154,247, 87,108,108,236,202,107,215,174,121,126,249,229,151,129, 67,135, 14,117,234,210,165,139,131,
+113,  1,133, 66, 65, 31, 58,116, 72,182,126,253,250,146,115,231,206,165,141, 28, 57,178, 93,117,237,204,200,200, 56,252,237,183,
+223, 58,247,234,213,171, 33,128, 10,255,172,130,130,  2,164,167,167,227,214,173, 91,233, 26,141,230, 55, 27,186,244,  4, 64,228,
+160, 65,131,150,111,223,190,189,206,168, 81,163,114,247,236,217,115, 11,229,  9,139, 77,225,210,175, 95,191,230,219,183,111,151,
+140, 26, 53, 42, 23,229,126,100,153, 96,193,130,133,  1,157, 81,213, 79,171,218,145,137,159,213,106, 53,163, 84, 42, 25,185, 92,
+206,148,149,149, 49, 48, 63, 11,252,193,236,236,108, 38, 51, 51,147,201,200,200, 96,210,210,210, 24,  0,191,152, 40, 94,115, 55,
+ 44,251, 29, 59,118, 52,240,245,245, 93, 96,103,103,247,  7,135,195,145,114, 56, 28,169, 80, 40,252,221,221,221,125,222,210,165,
+ 75,125, 25,134,225, 87,163,162, 45,129,203,227,241, 62,243,242,242, 58,232,230,230,150,233,234,234,154,233,229,229,117,144,199,
+227,125, 14,128, 87,131, 50,183,  4, 17,151,203,157, 98,111,111,127, 92, 40, 20,230, 11,133,194,124,123,123,251,227, 92, 46,119,
+ 10,170, 79,164, 90, 45,167, 64, 32,152,226,233,233,121,220,201,201, 41,223,201,201, 41,223,211,211,243,184, 64, 32,120, 22,206,
+103,121, 43, 49,  8, 45, 57,163,  7, 65, 16,218, 55,222,120, 99, 67,203,150, 45,215,181,108,217,114, 93,139, 22, 45, 54,233,173,
+146,140,222,218, 34,135,229,228,141,255,100, 59, 95, 26,103,104,104,104,204,246,237,219,233,217,179,103, 75, 27, 54,108,248,116,
+246,236,217,210,237,219,183,211,161,161,161, 49,181,229,244,246,246, 14,  8, 13, 13,125,186,121,243,102,221,253,251,247,153,205,
+155, 55,235, 66, 67, 67,159,154,100,134,127, 17,125, 39,  0,  4,233,173, 63,191,  1,216,139,114,231,119, 95,  0,196,112,229,112,
+ 70, 31,125,248,  7,128, 30, 22,142,189,181,156,126,202,225,195, 25,189, 79,213, 49,  0, 73, 70,255,195, 80,217,255,235, 69,112,
+154, 69,211,166, 77, 31, 50, 70, 80,171,213, 76, 65, 65,  1,115,255,254,125,230,220,185,115,140,159,159,223, 67, 43, 56,221,  1,
+140,  1,112,200,199,199,231,238, 91,111,189,149,209,190,125,251,140,128,128,128, 20, 30,143, 23,143,242, 12,239,161,250,207,114,
+  0, 13,107,224,124,203,197,197,229, 91, 63, 63,191,223,130,131,131, 47,212,171, 87, 47,222,205,205, 45, 78, 36, 18,125,135,191,
+ 51, 99,219,122,206,119,249,240,195, 15,211,203,202,202,168, 86,173, 90,221, 53,183, 81, 72, 72,200,249,178,178, 50,106,224,192,
+129,153,  0,250,252, 23,174,119,150,243,165,112,254,167, 16,172, 23, 76,  7,141, 62,223,152, 41,247,141, 73,153,159,245,219,214,
+120, 32, 24,134,225, 48, 12, 99,207, 48,140, 51,195, 48,110, 12,195,184, 48, 12,227,192, 48,140,176,  6,243, 55,123, 98,255,115,
+156, 95,232,  5,148, 92,255,219, 20, 53,173,127,173,247,167,175,175,175,107,155, 54,109,190,218,191,127,255,148, 71,143, 30, 77,
+217,191,127,255,148, 54,109,218,124,229,235,235,235,250, 44,237,244,246,246, 14,104,210,164, 73, 84, 72, 72, 72,102,147, 38, 77,
+162, 76, 68,214,139,236,187, 64, 47, 98, 66,244,159, 64,253, 50,  2,229,185,176,214,234,133, 77,144,133, 55, 53, 91, 56, 13,124,
+191,  1,120, 87,255,249, 77,191,204,239, 37,112, 86, 65,253,250,245,143, 54,111,222,252, 97,139, 22, 45,146, 91,180,104,241,176,
+105,211,166, 15, 27, 55,110,252, 48, 40, 40,232, 97,221,186,117, 31,122,120,120, 28,173,197, 49,114,  3, 32, 65,213,105,192, 94,
+246, 57,223, 57, 52, 52,244,146, 72, 36, 50,155, 27,140,203,229, 70,182,104,209,226, 38,202, 35, 37,217,251, 39,203,201, 10,173,
+127, 17,216,147,240,213,227, 20,162,250,105, 70,106, 90,207,238,207, 87,155,211,236, 92, 93,122, 33, 19,168, 23, 56,130,231,192,
+105,204,103, 56,167,130,140, 68,211,203,224,100,207, 37,150,147,229,100,133,214,115,  7,151,221,  5, 44, 76,160,122,198,245, 44,
+ 94,109,216,146, 19,235, 89, 56,205,241, 61,122,201,156, 44, 88,176, 96,241,188,238,157,157,  1,156, 49,188, 21, 90, 82,165,182,
+ 68, 19,212, 70,217,158, 96, 57, 89, 78,150,147,229,100, 57, 89, 78,150,243, 63,199,105,192, 74, 11,203,239,153,252,223,244,138,
+ 10,175, 23,146,166,135, 53,171,178,156, 44, 39,203,201,114,178,156, 44, 39,203, 89, 91,140,126, 69, 69, 86,152,225, 15, 59,116,
+200,130,  5, 11, 22, 44, 88,176, 96,241,252, 80,115, 30,173,189,123,247,114, 12,191,  7, 13, 26, 52,146,162,168,175, 12,255, 57,
+ 28,206,143,187,118,237,250,169,186, 26, 34, 34, 34,168,234, 56,205,161,166,122,204,113, 54,109,232, 52,214,221,217,110, 66,113,
+137,124, 85, 74, 54,117, 78,169, 84, 54, 49,172, 19,137, 68, 73, 63,253,244,211,131,231,221,206,145, 35, 71, 54, 52,173,167,158,
+ 31,175,179,155,163,104,220,211,226,178, 21,183, 31,150,109, 98,207,177,151,  2, 15,  0,125, 28, 69,252,247,155,186,240,223,186,
+245, 68,121, 81,166,161, 14,161, 60, 26,182,232,117,236,176,143,143, 79, 99, 39, 39,167, 97,  0,154,202,229,114, 47, 59, 59,187,
+124,  0,119,164, 82,105, 76,110,110,238, 61,107,121,194,234, 33, 29,128,191,254,111,198,153, 52,  4, 88,179,174, 38,244,  8,130,
+146,  1,132,  4,  1,205,177,228,191,157,209,223,109,  0, 37,205, 84, 93,222,163,  1,212, 12,  3, 62,  1,168,142, 61,130,232, 53,
+ 58, 84, 78,  0,186,163, 60,133,195, 13,148,167,159,144,179,151, 44, 11, 22,175, 21, 76,135, 10, 43,254,115, 45,136,137, 78,124,
+ 46, 17,197,128,113,  1, 24,119,149, 74,197, 19,  8,  4, 80,171,213,176,179, 19,175, 29, 51,106,228,  2,144, 40,214,234, 48,238,
+167,159,126,170,245, 76,215,182,212,  3,224,148,233,246,174, 78,226, 69,167, 15, 77,119,237,212,123,233,119,234,212,194,105,165,
+165,165,164, 80, 40,132, 74,165,130,179,179,115,251,177,163, 71,183, 34,121,140,154,207,183,191,184,114,229,202,220,218,182,115,
+210,164, 73, 62, 26,141,242,109,154,166,  5,106,181, 90,104, 90,143,179,157,253,210,211,135,166,219,133,245,249,110,  1,192, 10,
+173,151,  0, 65,128,171,253,153, 85,131, 58,135,188,213, 52, 24,244,157,179, 80,170, 53,239,159,206, 44,123,127, 94,124,246,228,
+204, 50, 77, 75, 60,135,132,149,255, 34,112,  2,  3,  3,191,244,244,244, 28,184,113,227, 70,126, 96, 96, 32, 68, 34, 17, 20, 10,
+133,228,209,163, 71,146,177, 99,199,134,137,197,226,221, 41, 41, 41,107, 97,221, 68,112,254,167,127,158,  3,  0,104, 63,108,161,
+ 63,202, 39,139,150,155,174,235, 60, 98,161, 63,128,169,168, 60, 49,114, 14,202, 83, 40,152,187,235,  8,226,182,127,143,247, 63,
+158,194,  5, 48,182,162,241, 36,240,251, 47,171,209,115,208,132, 74,203,  9,  6,220, 67,219,191, 71,159,143,167, 88,156, 71,241,
+221, 96, 66, 75,211,140, 69, 75, 60, 73, 18,186, 63, 30, 50,230, 38, 24,206, 67,121, 14,176, 42,148, 40,159,208,217,108,249,222,
+141, 57,121, 26, 45,101, 54,225, 44,159,199,201, 63,124,143,170,178,237,240,255, 65,171,165,202,239,173,124, 46,168,131, 41,206,
+167,103,205,154,197,237,211,167, 15,182,108,217,210, 97,211,166, 77,163, 75, 75, 75,255,212,239,183,100,246,242,101,193,226,181,
+ 22, 92,230,133, 22,151,131, 13,191,253,250, 83,131,188,252, 66, 12,255,236,107,236,220,185, 19, 69, 69, 69,112,117,117,133,128,
+207,231,173, 90, 62,199,199,201,201,222,103,248,232,105, 27,  0, 52,174,109,107,108,172, 39,216,116,123, 66, 63,149, 14,151, 67,
+242,  4,  2,  1,185,123,247,110, 20, 23, 23,195,197,197,  5,  2,  1,143, 92,249,221, 55, 98, 39, 39,  7,241,167, 95,204,232,128,
+242,252, 63,181,130, 90, 93,214, 97,255,206,159,156, 10, 10, 10, 48,226,243,105, 48,173,135,207,231, 83,134,  7, 11,123,142,189,
+ 20,204,218, 56,238,227,144,102,142,128,230,246,  5,240, 56, 28,216, 57,187,162, 59,151,  3, 14,129, 38,195,255, 72,155,  9, 96,
+222,235,210,217,192,192,192, 47, 35, 34, 34,  6, 46, 90,180,136, 79,146,229, 41,231,100, 50, 25, 20, 10,  5,124,125,125,113,250,
+244,105,254,236,217,179,  7, 30, 56,112,  0, 41, 41, 41,107,108,229,191,125,251,118, 61,127,127,127, 37,  0,244,109,238,104,186,
+ 46,192,176, 14,  0, 28, 29, 29,107,228,115,119,177, 87,221,190,125,169,169, 97,187, 47,187,250, 82, 22,150, 43,  1,216, 85,199,
+ 69,211, 12,247, 88,212, 88,139,235, 63, 91,180, 67,119, 99,239,185,198,129,129,129, 10,227,229, 14, 14, 14,150, 54,241, 46, 43,
+ 43,243, 55, 93,104, 40,175,209, 82, 94,150,234,235, 49,110,189, 89,  1,166,165,192,221,177, 99,  7,  0,224,135, 41, 67, 56,155,
+ 47, 23,114,185,220,242, 91,237,242,229,203, 17, 25, 25, 41,248,227,143, 63,122,109,223,190,189,215,193,131,  7, 87, 89, 18,170,
+ 44, 88,176,120, 37, 69,150,241,183,101,161, 69, 18,132,163,147,163,  3,194,  7,143,193,209,163,191,163, 83,167, 78, 21,235,234,
+215,175,143,136,254, 31, 96,215,207, 43,  1,192,241, 89, 90,244,172,245, 20,149,200,230,245, 28, 24,181, 48, 35,183, 44, 62, 46,
+ 46, 14, 29, 59,118,172,180,253,224,  1,225,248,101,235,114, 84,147,101,222, 42, 16, 12,201,119,116,178,199,160,225,159,195, 92,
+ 61,163, 71,244,139,123, 55, 98,117,183,188, 39,178,149,236,121,246,226,209,192,199,189, 71,243,144,198, 40,218,183, 22,137,197,
+ 74, 28,205, 86,226,211,238,109, 17,234, 38, 70, 71, 29,  5, 31,123,222, 59,185, 50,237,107,109,100,132,121,  0,  0, 32,  0, 73,
+ 68, 65, 84, 33,180,124,124,124, 26,123,122,122, 86, 18, 89,165,165,165, 40, 43, 43,131, 84, 42, 69,105,105, 41, 72,146,196,180,
+105,211,248,103,206,156, 25,232,227,227,115,194,138, 97,196, 12,189, 37, 11,224,240,202,230,206,157,171,242,242,242, 82,217,217,
+217, 49, 92,190,176,180,243,136,133,142,  0, 64,114,249,165,171, 86,173, 82,251,250,250, 42,185, 92,174, 96,194,132,  9,164, 53,
+109, 86,169, 84,140, 49,167, 90,173,170, 88,190,116,233, 82,181,183,183,183,202,206,206,142,209,104,172, 55, 58,222, 76,125, 10,
+ 33,159,  3, 33,159,  3,145,128,  7,199,122,109, 32, 44,186,  5,157, 78,135,101,203,150,105,124,124,124,212,118,118,118,140, 64,
+ 32,224,143, 31, 63,190,198,118,142, 28, 57,146,113,113,113,209,216,217,217,241, 35, 35, 35,171, 68, 10,157,188,145,  5,177,128,
+  7, 59, 33, 23,193,245,253, 32,100, 20, 86,183,149,195,169,236,141, 32, 20, 10,209,161, 67,  7, 52,109,218, 20,  7, 15, 30,236,
+204, 10, 45, 22, 44, 94, 11, 88,140, 48,228,  2, 64, 92, 92, 92, 24,202, 39, 68, 68,159, 62,125,136,242, 45, 24, 76,253,178, 63,
+ 62, 29, 49,  8, 20, 69, 87,204,243, 69,144,  4,190,248,164, 23,104,218,154, 17,137,154, 67, 60,107, 81, 79,  5, 39, 67,144, 28,
+  0,104, 16, 32, 97, 70,127, 58, 20, 20, 77,255, 61, 80,194,  1,198,140,232, 89,190,236, 57,180,147,  3, 10, 95,143,253,  8,230,
+234,105,220,160, 14,169,211, 40, 65, 84,158,236,241,159,152,108,147,229, 52,131,166,117, 37, 65, 90,133,  2, 74,165, 22,209,247,
+158, 42,142,103,201,188, 72,151,180,130,213,225,237, 68,156,130,108,  4, 56, 10,130,115,101,218,215,162,239, 78, 78, 78,195, 54,
+110,220, 88, 69,100,229,229,229,145,101,101,101,208,104, 52,116,105,105, 41, 40,138,194,140, 25, 51,120,179,103,207, 30,150,155,
+155, 27,105,208, 60,230, 56,245,126, 87, 83,111,223,190, 29, 48,107,214, 44,205, 59,239,188,147, 81,191,126,125, 25,135,195,129,
+ 68, 34, 89,221,189,123,119,183, 69,139, 22,105,122,245,234,149,198,225,112, 16, 28, 28, 44,187,117,235, 86,  0,  0,177,181,125,
+ 55,230,252,233,228,143, 12,  0, 16,  4,129,238,221,187,167,  7,  7,  7,203, 56, 28, 14, 30, 28, 90,202, 88,187, 63,121, 92, 18,
+ 13,125,157,245, 55, 17,  2, 16, 59, 84,120,226,117,239,222, 61,179,113,227,198,101, 36, 73,226,230,205,155,126,168, 58,173, 85,
+ 21, 78,177, 88,172, 29, 60,120,112,198,189,123,247,204,149,  7,151, 67,162, 93, 99,189,  1,203,183, 37,144,121,222, 98, 59,121,
+ 28,232,102,127, 57,132,235, 34,  2,132,142, 30, 42,169, 84, 10, 39, 39,167,114, 11,153, 70,131,191,254,250, 11,111,189,245, 86,
+216,222,189,123,207,176,215, 59,203,201,114,254, 13,115, 90,228, 21,180,102, 25, 79,116, 95,201, 71,235,180,105,167, 40, 74,135,
+250,254,222, 88, 58,103, 36, 40,138,  6, 69, 81,208,233,191, 41,138,130, 86,163,121, 46, 45,123,150,122, 92,157,196,139,126,223,
+ 61,206,245,157,126,203,187, 46,153, 53,226, 56, 69,  1, 52,173,133, 86, 11, 80,180, 22, 52, 69, 65,171,125, 62,174, 57, 90,154,
+ 70,128,159, 15,150,204, 26,  1,211,122, 98,118,237,237,123,242,183,105,118,157,250,124,247,245,131,116,249, 50, 86,216,191, 88,
+136,248, 66, 46,195, 21, 65,173,214,161, 84, 77,171,  1,200,148, 90, 90,195,216,123,136,  0,128, 75, 18,175, 83,116,109,211,192,
+192,192, 74, 34,235,251,239,191,247, 88,183,110,157, 47,  0,244,239,223, 63,171,107,215,174,133,247,239,223,135, 68, 34, 33, 10,
+ 11, 11,123,  3,152,160,223,118, 42,128,117, 22,120,101,254,254,254, 74, 79, 79, 79,149, 65, 16,145, 36,  9, 46,151, 11,127,127,
+127,165,151,151,151, 42, 56, 56, 88,198,231,243, 65,146, 36, 12, 66,207,170,215, 60,130,  0,135,195,129,129,211,212,218, 99,224,
+180,  5, 60, 46, 89,245,246,102,196, 73,146,164,217,250, 44,158, 67, 34, 17,  3,192, 98,121, 14,105,116,123,228, 86,239, 33, 16,
+253, 23,120,  0, 78, 51, 12,131,235,215,175, 35, 37, 37,  5,124, 62, 31, 62, 62, 62,136,140,140,132, 74, 85,174,119, 35, 34, 34,
+194,  0,220,100,175, 96, 22, 44, 42,112,250, 21, 20, 88,166, 86,173,234,125,180,226,226,226,194,250,244,233,115,198, 32,128,202,
+197,142, 25,241,163,213, 65,171,213,  0, 12,243, 92,132,150,165,122, 40,138,174,182, 30,131,143, 22, 77, 51, 92,179, 34,139,166,
+161,211,106,159,203,222,163, 41, 45,104, 90, 11,115,245, 16,  4, 73,233,111,248,124,246, 58,121,241,240,241, 15, 32,181,254,245,
+113, 78,167,132,175,187, 80,128, 66,  5,  2, 27,133,112,254,146,107,113,225, 70, 18, 60, 28,156, 94,155,227, 34,151,203,189, 68,
+ 34, 17,100, 50, 89,133, 37,107,221,186,117,190,106,181,154,  4,  0, 46,151,231, 87, 64,251,138, 40, 26,112,118,202, 65, 81, 81,
+137, 59,195, 48,132, 94,240, 44,  7,240, 19,170,201,238,207,231,243, 43,  4,138,177,  0, 18, 10,133,181, 18, 48,  6, 24,196, 25,
+159,207, 55,187,220,116,120,173, 38,240,141,133, 22,152,114,171,150,137,216,226,112, 56, 48,248, 70,213,  4,129, 64, 80,209,119,
+115,224,114,140,234,227,216,238,138,169,209,104, 80, 86, 86,134,226,226, 98,136, 68,229,  6, 51,134, 97, 64, 16,196,  4,  0, 19,
+217,171,152,  5, 11,243, 90,228, 21, 22, 91,230,133, 22,202, 77,118,  4,  0,232,180, 26,179,226,103,239,161, 11,200,200,149,193,
+199,227, 10, 24, 27,179,158, 14, 28, 56,240,103,137, 68,210,206,240, 95, 40,118,112, 31, 61,110, 62,116, 58, 13, 28,197, 36, 62,
+ 27,214,179,146,200, 42,183,104,169, 45,206,  9, 82, 84, 34,155,215, 51, 98,205, 66,103, 39,247,120, 83,241,179, 36, 58, 33,188,
+ 72,170,242, 35,201,171, 40, 34, 36, 84,196,152,249, 35,141,110,238, 55,118,175,159, 59,217,106,123, 32, 65,242,194,199,174, 30,
+205,112, 29,154,216,145,165,103,167,143,104,187,223, 88,204,185,185,185,197,245,  8, 95,213, 45,239, 41,235,163,245, 50,224,232,
+236, 66,250,181,238,140,214, 19,162,112,242,155,233, 12, 80,  4,119,137, 47,217,229,203,197,112,104,221, 23,151, 62, 27, 70,  3,
+ 79, 95,139,190,218,217,217,229,203,229,114,137, 66,161,128, 84, 42,133, 84, 42,173, 44,  8,120, 60, 98,244,231, 95,121,240,248,
+  2,104, 53,106, 28,141, 89, 92, 35,167, 33,133, 67,223,230,142,224,240,  4,165,119,  2,  3, 87,115,185, 92,144, 36,137, 67,107,
+167, 79,216,183, 98,156, 35,  0,220,136, 91, 43, 29, 52,237,199, 53, 36, 73, 66,165, 82,  9,109,105,247,227,199,143,253, 84, 42,
+149, 82, 47,208, 12,194, 15,169,169,169,117, 85, 42,149,194,120,185, 53, 16,219, 57,  2, 46,245,  1, 59,175, 42,214,179,180,180,
+180, 58, 90,173, 86,206,229,114,161, 86,171,173, 82, 69, 36, 73,242,111,222,188,233, 71,211,180,217,242, 77,131,234,  0, 62,205,
+  1,129,179,213,125,102,172,120, 17,213,139,173, 23,150, 65,154,  5,139, 87,197,178,245, 10, 94, 19,132,133,223, 21, 66,171,115,
+ 92, 92, 28, 99,252,134,168,211,106,245, 34,235,111,209, 67, 81, 52,178, 11,148,184,127,255,  1, 86,173, 90,133, 11,151,166, 56,
+ 47, 90,180, 72, 56,123,246,108,213,192,129,  3, 87,208, 52,221,130, 36,201, 27,248,123,168,162,178, 85,136,166,235, 38, 36, 36,
+  4, 26,254,107,181, 90, 56, 58, 58,194,209,209, 17,141,131,253,170,136, 44,138,162,160,169,102,232,208,224,163, 69, 48, 52,163,
+213, 82,160,104,186, 66,252, 20, 73, 85,126,191,157,184,222,192,168,120, 35,195,143, 14,109,154, 88, 22,131, 99, 35, 43,250,177,
+123,253,220,201,139,182,108, 17, 22, 81,158,227,  7,133,127, 26, 26, 49,104, 24,  6,127,244, 94,152, 74,173, 62,200, 33, 25, 90,
+ 91, 81, 31, 72, 48, 48,245,209, 98,241,130,144, 92, 44,211,242,132, 98, 56,248,212,195,131, 50,138,207,225,112,174, 60, 42,150,
+243, 73, 14, 23, 36,151,143, 59, 69, 74,237,107,212,221, 59,201,201,201,146,186,117,235, 66, 42,149, 66,167,211,209,253,251,247,
+207,226,114,121,126, 92, 30,143,232, 51,232, 43, 58, 55, 55, 91, 75,146, 28, 48, 12,133,247, 34,198, 18, 66,145,152,175, 81,171,
+117, 40, 31, 58, 52,103,205, 50, 78,225,224,216,189,123,119, 55, 67, 36,224,190, 21,227, 28,141,214, 57,181,106,213,202,205, 56,
+234,208, 74,107, 17, 49,112,224, 64,177,191,191, 63,  1,  0, 87, 99,102, 25,172,103, 68,223,190,125, 69,254,254,229,126,248,127,
+174, 29,103, 53,167,135, 29,  3,148,164,  2, 37,105, 85, 44, 89,125,251,246, 21,  6,  6,  6,218,116, 45,234, 29,224, 45,230,238,
+178,231,234,128,220,235, 86,113, 13,255, 31,180,190, 14,224,174,120,143,132,192,193, 93,213,110,250, 31,151, 89,177,197,130,133,
+ 85, 48,209, 34,175, 20,194,244,  2,177,179,254,187, 66,112,113,  1, 64,111,162, 35,140,116, 22,180, 58, 77, 21,145, 69, 81, 20,
+120,132, 10,171, 86,173,194,196,137, 19,  1,128, 63,121,242,228,253,139, 22, 45,250,144,166,233, 22, 12,195,116, 36,  8,162,186,
+183,198,211, 18,137, 36,143, 97, 24, 30, 73,146, 29,215,174, 93,235,214,171, 87, 47, 56, 58, 58,130,161,153, 42, 34,139,162,104,
+104, 52,106,139,211,220,186, 58,137, 23,253,190,119,188,235, 59, 31, 44,239, 74,209,244,113,131,200,162, 41, 10,160,203, 55,122,
+146,159,133, 99, 71, 15, 98,195,250, 13, 69, 32,152,187, 96, 64,235,197, 32, 44,136,193, 22,231,175, 38,117,236,208,166,  9, 22,
+109,217, 34,188,157,144,179,255,171, 73, 51, 67, 35,  6, 13,195,222, 93, 49, 32,117,197,215,141, 69, 22,165,165, 81, 82, 84,216,
+247, 20,235,163,245,178,224,118,236,248,113, 98,216,176, 97,116,105,105, 41,248,  2,  1,173,213,106, 57,111,191,253, 54, 53,113,
+226, 68, 50, 55, 55, 23,210,210, 50, 46,  0, 55,188,  6,102, 45,169, 84, 26, 51,118,236,216,176,179,103,207,242, 73,146,132, 84,
+ 42, 69,151, 46, 93, 10, 11,104, 95,209,232,207,191,242,200,206,206,210, 57,137,185, 42, 62,159,135,252,252,124, 58,172,215, 16,
+197,160,145, 19,235, 76,156,181,100, 99,206,197,245,235,172,169,195, 56, 18,208,116,221,230,205,155,213,190,190,190, 74,161, 80,
+ 40, 24, 49, 98,132, 85,227,135,106,181,154, 89,186,116,169,202, 52,186, 80,173, 86, 51,171, 86,173, 82,251,249,249,169,196, 98,
+ 49,163,213,214,236,247, 73,146,132,238,179, 69, 59,116, 58,157,174,146, 21,203, 32,178,180, 52, 81, 22, 21, 21,165,241,243,243,
+ 83,219,217,217, 49, 66,161,144,111, 77, 59,191,250,234, 43,198,213,213, 85, 99,111,111,207,159, 54,109,218, 51, 69, 29,106, 41,
+112, 23,173,173, 72,239, 32,116,116,116, 68,105,105,105, 69, 91, 37, 18,  9, 43,182, 88,176, 48,131, 42, 90,228,213,180,194, 89,
+151, 71,139,  6,202,242,242, 11,189, 60,188,235, 65,167,211,233, 63, 90,232,180, 90,140, 31, 51,  8, 43,214, 71,  1,128, 65,108,
+117,159, 60,121,242,126,  0, 53,222,204,118,239,222,189,112,242,228,201, 78,121,121,121,127,252,252,243,207,110, 67,134, 12,193,
+212,169, 83,177,124,249,114,240,  4, 34,184,121,214,173,168,199, 80,111, 97,193, 83, 48, 96,202, 44,216,233, 52,229, 55, 41,112,
+221, 61,  3,160,165,180,160,181, 90,104,181, 90, 16,156,242,174, 29, 59,122, 16, 67, 62,249, 10, 60,161,147,235,143,171,150, 41,
+ 66, 91, 75, 62,156, 61,106,148,202, 10, 35, 32,121, 59, 33,103,255, 87, 19,167,117, 55,136,172, 95, 99,214,223,253, 97,198,  7,
+ 59,133,  2,110, 69, 61, 90,154,  6, 73,114, 88, 31,173,151, 36,178,132, 66, 97,236,145, 35, 71, 30,182,108,217,146,144,201,100,
+208,106,181, 40, 44, 44,196,254,253,251,239, 48, 12,  3, 87, 87, 87, 28, 57,114,132, 30, 50,100, 72,172, 74,165, 10,127,213,197,
+ 86,110,110,238, 61,177, 88,188,123,230,204,153,131,102,204,152,193,163,105, 26,247,239,223,  7,  8,130,225,241,  5, 32, 73, 18,
+ 60, 30, 23, 37, 37, 82,218,206,193, 37, 71,195,112,236,120,124,  1, 72, 14,191,186, 48,225, 12,125, 50, 82,144, 92,126,169, 33,
+ 18,144,207,231,227,210,222,239,165,157, 71, 44,116,  2,  0,190, 80, 92,212,163, 71,143,244, 38, 77,154,200,174, 93,187, 22,128,
+170, 81,135,166,215,167,174,223,136,105, 28, 59,177, 72,214,189,123,247, 12,  3,103,218,241, 31,165,195,190,152, 69, 16, 28,129,
+172, 79,159, 62,233,161,161,161, 50, 14,135,131,164,131,203,164,253, 70, 76, 19, 17,213, 36, 89,253,227, 33,243,217,141,189,231,
+ 26, 47, 94,188, 88,219,171, 87,175,199,  6,127,177,180,180,180, 58,189,123,247, 22,174, 92,185, 82,219,187,119,239,204,102,205,
+154,149,145, 36,137,132,132,  4,191,234, 44, 85,  6,136,197, 98,237,167,159,126,154,113,235,214,173,218, 70, 29, 86,139,186,117,
+235,130,166,105,116,233,210,  5, 74,165,146,181,108,177, 96,241,122,194, 52,143,150,229,204,240, 90,157,246,171, 49, 19, 22,252,
+  8, 16, 14, 70,119,129,191, 13, 75, 12,136, 41, 83,190,182,  7, 32, 54,136,173, 73,147, 38,213, 56,205,137,145,200,106, 61,100,
+200, 16,124,243,205, 55,248,225,135, 31,168,229,203,151,115,238, 61, 72,213,140,248, 98, 94,177, 73, 61, 96,192,148,209, 90,250,
+ 43,115,124, 69, 37,178,121, 29,123,127,183, 32, 43, 79,126,126,196,216,217, 21,119, 47, 10,128,148,144, 80,  0,176, 97,253,122,
+ 25, 79,232,100, 31, 49,104, 24,  0,116,255,113,213,178,253,139,176,165,102,177,197, 16, 33, 95, 77,154,230,106, 16, 89,107, 87,
+ 46,190,229, 76,228, 69,141,251,250,142,214,184, 30,  0,112,115,196,254,142,189,191,123, 55,255,169,108, 53,123,158,189, 56,  8,
+  4,130,133, 39, 79,158,180,111,222,188, 57,241,228,201, 19, 80, 84,249, 17,209,104, 52, 40, 41, 41, 65,105,105, 41, 84, 42, 21,
+ 90,181,106, 69,174, 89,179,198,126,220,184,113, 11,213,106,245, 23,175,122,191, 83, 82, 82,214,254,246,219,111, 56,115,230,204,
+192, 25, 51,102,240,124,124,124,  8,103,231, 60, 66,171, 81,  3, 96,152,130,130,  2,218,206,193, 37,199,195,219, 47, 35, 59, 55,
+ 63, 68,171, 81,131,166, 52, 22,189,205,245,233, 29,166,220,190,125,187,222,247,223,127,175, 54,142,  4, 28, 52,237,199, 53,173,
+ 90,181,114,139,138,138, 82,247,233,211, 39,221,224,188,110,141, 51,252,177, 71,152,112,251,246,205,166,166,156,157, 71,127,191,
+213,192,105, 28,141,216,247,235,141, 91,131,131,131,221, 66, 67, 67,211,171,227, 13, 12, 12, 84, 72, 36, 18,117,227,198,141,203,
+120, 60, 94,185, 37, 75,171,149,  7,  6,  6,210,222,222,222,234, 38, 77,154,148,217,234,180, 47, 22,139, 25,131, 85,204, 28,108,
+137, 58,228,113,160, 27, 50,100, 72, 69,102,248, 41,193,193, 57,195,134, 13,147, 76,158, 60, 25, 91,183,110,197,133, 11, 23,170,
+136,253,176,176, 48,156, 61,123,118,  1, 94,163,196,186, 44, 88,252,199, 80,125, 30, 45, 83,108,219, 22,243, 39,140,124,154,204,
+ 97,209,162, 69, 66,189, 37,171,251,196,137, 19,161, 80, 40, 92,205, 20,235,  6,125,174, 13,115, 34,107,217,178,101, 59, 25,134,
+241,  3,208,129,162,232,203,155,183,108,235, 98,169,190,136,136,136, 42,156, 12, 65,114, 72,146, 40, 19,240,152,191,214,111,218,
+250, 75,165,242,229,206,239,141, 64,224,198,143,171,150, 41,  0,116, 55, 21, 91,248,123,154,145, 10, 78,  3, 62, 31,251,121,133,
+200,250,113,213,178,227,161,173,253, 63,156, 61,106,161, 89,113,182,112,222, 24,123,146, 36,222, 54,241,209,170,194,249, 28,192,
+114,254,141, 46, 67,134, 12,105,209,182,109, 91,210, 88,100,169,213,234,138,196,157,  6,103,241,172,172, 44,132,133,133,145, 45,
+ 90,180,104,118,229,202,149, 46,248,123, 58,167, 87,181,239, 84, 74, 74,202, 26, 31, 31,159, 19,115,231,206, 29, 86, 88, 88,216,
+187,168,168,216, 61,110,219, 66,244,140, 24, 75,132,245, 26, 44, 83, 51, 92, 81,102, 78, 94,227,211, 71,118,184, 29,221,189, 22,
+ 26,181,122, 12,128,187,248, 59,189,131, 41,167,220,144,198,161,113,227,198, 50, 99,161,226,239,239,175,172, 83,167,142, 42, 52,
+ 52,180, 98,185,133,104,190, 42,125,183,149, 83,239,255, 37,171,105,127, 26, 68,155,105,218,  8, 59, 59, 59, 24,196,151, 45,237,
+ 52,142,182, 52,123,163,172, 57,234,176,130, 83,159,222,161,146, 78,139,137,137,233, 22, 19, 19,211, 26,192, 95, 40,159,235, 80,
+ 11,148, 15, 37, 26, 57,205,207,215,127,216,235,157,229,252,175,114,190,202,  8,195,223,190, 89, 64,185,175,214, 25,139, 66,171,
+ 38, 24, 28,223,  1,144,147, 38, 77, 42, 82, 40, 20,174,195,134, 13,171,118,155,220,220,220,173,209,209,209,149, 68,214, 71, 31,
+125,244, 73,108,108,236,137,252,252,252, 90,245,202,213, 73,188,232,204,161,233,174, 97,125,190,155,  8, 96,185,  5, 67, 30, 29,
+218, 90,242,225,143,171,150,237, 55, 17, 91,219,  1,124,100, 73,149,246,120,239,  3,236,216,246,163,193,183, 75,124,235, 90,214,
+209,129,215, 35,205, 70, 43,186, 56,  8, 35,245,237,152,204,250,104,189, 24,240,249,252,206, 51,102,204,224,203,100,178, 42, 34,
+203, 84,104, 73,165, 82,220,184,113,  3, 35, 70,140, 16, 38, 38, 38,118,214,104, 52,167, 94,135,125,144,155,155,123, 79,159,140,
+116,130, 33,133,131, 80, 36,230, 15, 30, 57,209,175, 34,234,112,247, 90,168,148, 10,  0,224, 90,147,222,129,203,229,242, 19, 19,
+ 19,  3, 12, 86, 43,141, 70, 35, 52, 44,191,118,237, 90,128, 33,183,150, 82,169,180, 58,234,240,159,226,188,121,243,166,159, 33,
+ 58,210, 16, 93,200,229,114,249,  9,  9,  9,126,  6, 78,149, 74,101, 85,212,161, 64, 32,224, 39, 38, 38,250, 81, 20,245,220,162,
+ 14,141,133, 49,202,231, 89,172, 52,215,162,222,183,140, 32,  8,130, 97,135, 13, 89,176,120,229, 97, 26, 41, 89,253,164,210, 53,
+193,224,248,110,195, 38,220,186,117,235,246, 24, 52,104, 80, 37,145, 21, 30, 30, 78,237,219,183,239,180, 68, 34,201, 35, 73,242,
+158,173,237,168,240,209, 66,149, 55, 72,144, 36,121,163, 67,155, 38, 32, 73,242,198,236, 81,163, 84,139,176,165,146,216, 58,184,
+127,207,187,153, 69,119,204, 75, 51,  0,238, 94,190, 24,242,201, 87, 24,242,201, 87,174,  0,218,  3,150,163, 21,171,107,  7,139,
+127,  6,  4, 65,  8,234,212,169,115, 75,169, 84,130, 32,  8,168, 84,170, 10,129, 85, 90, 90,138,146,146,146,138,255, 26,141,  6,
+  5,  5,  5,240,247,247,  7, 65, 16,175,181, 31,157, 70,163,209,205, 88,240,125, 52,135,203,215,209,180,134,208,104, 52, 35,109,
+185,206,103,204,152, 65,194,140,239,213,184,113,227,204, 46,127, 89,156, 51,103,206, 52, 27, 37, 56,110,220,184,106,163,  7, 45,
+225,235,175,191,126,110, 81,135,214,223,190, 88,176, 96,241,154,193,108,232, 94,173,132, 22, 73,146, 55,204, 68, 23, 18,  0, 24,
+146, 36,111,152,201,114,160,203,200,200, 88,224,226,226, 50, 70, 38,147,253,254,209, 71, 31, 77, 10, 15, 15,167,128,114,  7,249,
+218,246,168,168, 68, 54,175,115,223,165,147,139,203, 84, 81,166,235, 76, 45, 79,  6,177,181,118,245,178,117,251, 99,119,133,231,
+102,103,174,179,212, 55, 75,130,202, 82,180, 98,137, 84,177,160,115,223,165, 19,139,164, 10,214, 71,235,  5,129,162,168, 99, 98,
+177,152, 48, 76,166,108,108,189,146, 74,165,144,203,229,208, 79, 73,  3,  0, 40, 43, 43,131,179,179, 51, 40,138, 98, 94,179, 93,
+161,  2, 48, 85,111,173,  2,128,169,169,167,215, 24,159,219, 55,141,215, 85, 99,205,202,177,102,130,104,115,219, 85,183,238, 31,
+224,204,171,102,130,232,234,144,103, 35, 95, 30,  0,240,121,156,124, 75,147, 71,243,121,156,252,106,252,246,109,124,111, 32, 24,
+  0, 11,216, 43,155,  5,139, 87,247,253,255,101, 85,220,141,229,100, 57, 89,206, 23,194, 41,212,127,172, 93,199,238, 79,150,147,
+229,100, 57,255,109,156,230, 48,250, 21, 17, 90,140,153, 15,128, 90, 90,180, 88,176, 96,241,175,131,170,150,235, 88,176, 96,193,
+130,197,179,163,202,100,210,198, 43, 44,169, 82, 91,162,  9,106,163,108, 79,176,156, 44, 39,203,201,114,178,156, 44, 39,203,249,
+159,227,172,137,219,120,251,209,  0, 54,189, 34, 98,235,165,  4,180,176,102, 85,150,147,229,100, 57, 89, 78,150,147,229,100, 57,
+107, 11,118,232,144,  5, 11, 22, 44, 88,176, 96,193,226, 63, 14,219, 18,150,178, 48,  3,255, 15,102,131,198, 76,253,238, 92,134,
+199,  7,231,191,110, 93, 12, 15, 15,231,216, 82, 62, 53,213,133,188, 14,201, 15, 78,246,252,190,101, 50,237, 15,244,245,121, 81,
+ 53,157,136, 30,129, 45, 63,182, 19,217,125,161, 86,171,235, 59, 56, 58,230, 63,125, 82,176,225,105,198,205,181, 70,101,156, 46,
+ 95,190, 44,105,219,182,109, 54,128, 82,163, 55,  5, 22, 44, 88, 60, 79,184, 52,169, 11,130, 24,  9, 48,127,135, 93,210,204, 29,
+148,220,221, 86,169,156,115,200, 39, 32,137,166, 70, 75, 20, 96,176, 25,197, 73,143,107,120,224,184, 36, 39, 39,  7, 52,104,208,
+ 32, 29, 64,177,105,237,102,214,177,215, 57,139, 87, 25, 97,168,156,176,180,226, 90,120,118,161, 21,252, 81,125,232,200,225, 96,
+ 48, 20,  4, 18,145, 26,219,191, 86, 60, 65, 31,250,130,230,190,  9,160, 37,192,180,180, 23,139,254,167, 80,107,242,105,134,249,
+ 24,143,246,252,101, 51, 95,253,240,177,176, 60,157,197,  2,164,198,174,183,137,143,102,102, 93, 61,187, 79,232, 98, 71,160, 65,
+171,143,166,161,114,  6,231,218, 66,  0,160, 35, 73,146, 77,237,236,236, 36,114,185,188,128,166,233,199, 40, 31,159, 46,170, 37,
+ 39,  9,224, 83,  7,123,251,158,  1,142,130,150, 25,133, 37, 89,165, 90,234, 28,202, 19,186, 22, 61,175, 51,170, 92,100,249,108,
+154, 56,184,237,136,101,227,187,193,165,243,210,105,114,160, 58,161, 69,248, 53,122,251,224,192, 65, 17,157,191, 28, 61,194,193,
+215,211,  1, 57,133, 50,247,245, 91, 99,190,143,137,217,209,103,212,192,238, 61,  1, 96,225,194,133,253,234,214,173, 91,143,195,
+225,164,206,153, 51,103,251,188,121,243, 24,194,242, 76,229, 18,253, 57,108,184,225,219,  3,  8,  5, 16,  8, 32,  5,192,109, 84,
+206, 50, 94, 27,188, 18,156,190,190,190,117,104,154, 30,229,237,237,221, 59, 47, 47,239, 48, 73,146, 91,178,178,178,178, 95,230,
+ 93,135, 97,152,141,  4, 65,140,102, 24,102,147, 13,223, 99,108,169, 67, 36, 18,229, 41,149, 74, 47,253,239,124,165, 82,233,253,
+ 79,245,231, 69,214,245,130,222,191, 63, 59,118,254,118, 79,227, 69, 61, 58, 52, 53,115, 71, 33,154, 30, 59,127,167, 83,229,114,
+161,148,133,123, 32,193, 48, 12, 22, 44, 88, 64, 68, 70, 70,126, 18, 20, 20, 20, 76,146,228,253,185,115,231, 86, 74,125, 99,186,
+206,232, 58,103,197, 22,139, 87, 21,182, 77, 42, 93, 35,154,132,219, 67,201,132,  3,196,136,176, 54,255,235, 48,230,227,190,  4,
+195, 17, 97,240,103,211,117, 54,115,  5,140, 16,130,163, 88,212,188,105,163, 73, 17,125,187,145,173, 67,235, 65,226,233, 12,144,
+ 60,108, 60,146,230, 30,181,108,206, 58,  0,109,107,209,202,121,143,226,119,122,229, 20, 83, 32,  8,128, 32,  0,146,  0,202,148,
+ 52,122,244, 27, 62, 15,192,122, 27,239, 74,164,139, 29,129, 73, 59,149,  0,192,121, 14,  7,165,158,167,167,231, 39, 19, 38, 76,
+176, 15, 13, 13,117, 17,137, 68,  2,165, 82,233,157,156,156,236, 57,103,206,156, 80,133, 66,113,  8,192, 85, 27, 57,253, 27,248,
+213,217, 19, 53,233,211, 55, 91,  4,  6,128,167, 46,  3,173,146,213,125,144,252,240,173,207,215,237,253,236,206, 83,229, 32,212,
+ 98,202,132,194,194, 66,  2,  0, 60, 60, 60,152,202, 34,171,221,136,149,147,123, 96,210,138, 99,144, 43,213,191, 84,199,225, 86,
+239,141, 97, 31,126,248, 65,231,197,179,198, 57,100, 61,209, 32, 49, 85,  1, 55,  7, 62,230, 77, 29, 43, 80,169,180,111,173,219,
+ 30, 51,250,199,239,166,111,166, 40,234, 29,  0,173, 41,138,186,  6, 96,251,130,  5, 11, 44,221,124, 35,  1,204,212,159,208, 59,
+ 56, 28,206,241, 46, 93,186,212, 31, 53,106, 20,209,170, 85, 43, 36, 36, 36,  4,238,220,185,179,219,225,195,135, 83, 41,138,186,
+  9,224, 62,244,211,158, 88,  1, 30,128, 70, 28, 14,167,249,191,153, 83, 34,145,136,213,106,245,112, 63, 63,191,209,111,191,253,
+118,243,190,125,251, 18,141, 26, 53,194,189,123,247, 90, 29, 61,122,116,222,185,115,231,110,102,102,102,110, 18,  8,  4,209, 57,
+ 57, 57,138, 23,254, 28, 39,136,209,  0,234,232,117,242,  2, 43,190,179, 81,158, 75, 42,199,218, 58,148, 74,165,151, 97, 10, 27,
+130, 32,188,254,201,254,216, 88, 87, 18, 65, 16,110,250,178,168,238,155, 36, 73,232,116, 58, 25, 69, 81, 65, 53,112, 54,210,191,
+ 72, 89,173,117,  1, 84,151,  8, 90, 12,  0, 61,218, 55,125, 10,  2,119, 42, 44, 90, 85, 95, 50,239, 84,  8, 48,  6, 77,143, 93,
+184,227, 86,201, 10,102,250, 22,187, 96,  1, 49,111,222, 60,204,159, 63,191, 47,128,142, 52, 77,159, 11,  9,  9, 89, 83,137,146,
+166, 43,214,205,155, 55,111,117, 53,215, 57, 11, 22,175, 10, 58,195,150, 73,165, 45,190,255,  4,245,239,  4, 10, 35,  2,220,189,
+194,199,143, 26, 32, 14, 13,105,  0, 37, 28,144, 86, 72,225, 72,220, 81,  0,216,109,155,213,105, 64,107, 46, 87, 25,189,108,254,
+212,198, 29,223, 12,197,173, 44, 45,174,101, 81,144,167,106,193, 33,181,160,104,  6, 96,160,172,109,175, 51,139,116, 56,127, 95,
+ 13,146,  0, 56, 36, 64,146,  4, 56,100, 45,201,104,245,131,133,219,174,135, 22,230,209,  0,173,126,240,140,  7,164,105,195,134,
+ 13,135, 69, 70, 70,186,228,230,230,218, 39, 36, 36, 64, 40, 20,194,213,213,149, 35,145, 72,234,172, 88,177, 66, 49,126,252,248,
+222, 26,141, 38, 13, 64,161,149,156, 33,189, 90, 55,191,184,105,217, 66,103,237,229,163, 40,222,245, 43, 56, 36,  3,190,189,  3,
+234,139,197, 56,250, 97,  3,183,240,184,212,125, 87,242,100, 33,  0,178,106, 34,187,123,247, 46, 71,165, 82, 13,114,114,114,106,
+199,227,241,188, 69,174,245,232,108,110,235, 39,  5, 68, 96, 74,190,151,188,211,228,110,222, 61,127,152,216,  5,147, 86, 28,195,
+170,157,151,126,110,137,220,185,213,229,205,182,179,115, 24, 51,254,139, 81, 14,153,133, 26, 44,218, 87,136,109,103,165, 24,222,
+209, 17,147,222,115,198,144,193,  3,237,247,254, 26, 59,  6,192,102,163, 77,238,133,132,132, 16,119,239,222, 53,119,243,117,  5,
+ 48, 93,173, 86,147,124, 62,159, 16,137, 68,195, 22, 47, 94,172, 25, 60,120,112,166,161, 64,199,142, 29,209,177, 99, 71,162,180,
+180, 52,240,212,169, 83,129, 49, 49, 49,186,248,248,248, 36,  0,  7, 45, 91, 44,196, 25, 74,165,162,174, 72, 44,150,175, 95,183,
+238,135, 78,157, 58,209, 66,225,223,233,167,106,195,  9,  0,206,206,206,155,189,188,188,136,111,190,249, 38,251,121,113,214,171,
+ 87,239,216,155,111,190,217,165, 71,143, 30,220,246,237,219,163, 78,157, 58, 21,235, 60, 60, 60,208,177, 99, 71,226,241,227,199,
+ 45,206,157, 59,183,238,216,177, 99,107,254,250,235,175, 83,105,105,105, 61, 94,176, 69,107,147, 94, 76,228,216, 88,254,149,  7,
+ 65, 16, 14, 27, 55,110,244, 50,204,201,168,213,106, 65, 81, 84,197,183,225, 67,211, 52, 40,138,194,226,197,139, 41,153, 76,102,
+205, 62,146, 25,189, 53, 27, 62,180,185,111,129, 64,224, 97, 72,216, 91,195,157,253,142, 68, 88,220,196,222,222, 62,  0, 64, 47,
+120,  6, 79,175, 92,160,252,253, 89, 38,147,165,231,168, 92,238,  0,232, 84, 13,155, 75,100,100,228,240,249,243,231,127, 96,100,
+165,109, 30, 17, 17, 97, 58,237, 85,115,253,183,140, 32,136,211, 36, 73, 30,  2,176, 13,207,209,234,206,226,245,  2,195, 48,109,
+  0,120, 26, 45, 82,163,124, 84,  8,250,231, 36,  1,192,221,100,185,113, 57,195,119,129,126,185,167,126, 59,198,136,183,128, 32,
+136,171,181,108,226, 25, 88,240,211,226,  2, 64, 92, 92, 28,211,167, 79, 31,194,240,109, 94, 20,133, 31,249,116,240,251, 61,123,
+119,125, 27,164,200, 21, 15,242,129,248, 12,  6, 92, 82, 11, 18, 12, 46, 95, 56,197,128, 75, 71,155,108,101,217,122, 82,175,255,
+215,205, 67, 67,150,110, 89, 54,129,147,148,207,197,182,115,114,104,148,101, 40,200,205, 64,126,118, 58,114, 50, 83,144,149,145,
+114, 19, 32,230, 89,205, 89,229,192,  0, 20,173,127,  7,164,129,106, 34, 47,107,230,212,200,238,  6, 54, 10, 13, 45, 18, 80,128,
+ 70,118,215,138,234, 45,113, 54, 11, 14, 14, 30, 60,107,214, 44,183,219,183,111,139,229,114,185,234,232,209,163,247,210,210,210,
+156, 36, 18,201,211,177, 99,199,  6,215,169, 83,199,233,163,143, 62, 18,236,218,181,171, 31, 42,135,181, 90,226, 12,125,191,221,
+255,226,183,174, 89,105,255,100,111, 20,212,201, 55,112, 36, 71,134, 11,121,114, 38,208, 89, 72,124,213,194, 19, 14, 66, 46, 22,
+182,175,227,208,107,127,242, 82, 45, 77, 15,169,142,243,226,197,139, 18, 59, 59,187, 21, 67,135, 14,149,140, 27, 55, 78, 72,113,
+ 93,184,177,241, 79,156,167,175,139,175, 35, 87,105, 56,131,187,212,195,228,161,205, 49,121,213, 73,131,200, 26, 93,191,126, 49,
+125,253,186,101, 78,173, 70, 83,223,207,203,  9,137,105, 10,108, 59, 43,197,159,179,234,160,235,226,108,124,212,146,139, 16,127,
+  7,232, 52,218, 70, 17, 17, 17,209,250,183,246,171,  0,250, 69, 68, 68, 52,230,112, 56, 39,  1, 28,168,233, 24,137, 68,230,103,
+ 79,113,117,117, 69, 88, 88, 24, 66, 66, 66,184,157, 58,117,106,110, 34, 96, 42,113,106, 52,106,  9, 77, 51,112,116,116, 20,187,
+187,187,187, 58, 58, 58, 62, 49,247,160,178,133, 19,  0,220,220,220,250,135,133,133,113,119,238,220, 89,152,154,154,122,121,240,
+224,193, 41, 78, 78, 78,149,172,191,246,246,246,  8, 14, 14,198,156, 57,115,184, 61,123,246,172,145,211,219,219,187,123, 76, 76,
+ 12,  8,130,168,120,104, 87, 49, 22,  7,  4,192,199,199,  7,189,122,245,226,246,239,223,191,123, 90, 90, 90,173,174, 35, 27,112,
+194,140, 69,107,129,201,113,178, 56,252,102,174,188, 21,199, 61,223, 96, 93,210,243,225, 25,174,205,106,135, 59, 69, 34, 81,133,
+ 21,202, 76, 93, 85, 56, 73,146,196,236,217,179, 65, 16,  4,120, 60, 30,248,124,190,217,239,206,157, 59,219,218,206,199,  4, 65,
+144,124, 62,127, 58,151,203, 29,165, 82,169,252, 68, 34, 81, 54, 69, 81, 63,171, 84,170,197,  0,180, 12,195,184, 88, 16, 89,102,
+ 57,237,237,237,  3, 30, 60,120,208,208, 82, 67, 84, 42, 21,154, 55,111, 14,168,144, 84, 29,103,114,114,114, 64, 80, 80, 80, 35,
+  0,134, 41,218,206, 50, 12,211,201,232,191, 49,206, 50, 12,243,158,254,247,253, 71,143, 30,  5, 52,104,208,160,232, 69,157,159,
+ 44,231,191,143,179,  6, 45,226, 73, 16, 68,156,209,181,218,199,240,127,198,140, 25, 51,151, 44, 89,114,155, 32,136, 56,227,229,
+198,229,140,191,245,247,155, 56,134, 97,250,124,243,205, 55,161,223,125,247,221,183,134,178,255,132, 72,180,197,162,229, 84,160,
+180,199,185, 12, 39,112, 57, 20,184, 36,  1, 46,  7,  0, 67, 32, 61, 45, 25,165,210,226,243, 72,221,151,106,157, 37, 43,188,253,
+ 27,111, 52, 91,182, 99,213, 52,242,167,115,114, 20,203,148,184,251,215,105, 92, 61,125, 32,151,210, 81,  7, 64, 48,215,  0, 50,
+  1, 41,244, 61, 32,182,118,115, 92, 16, 12,183, 92,104,233,197, 85, 37,177,245,210,208,162,113,227,198,  3,231,204,153,227,113,
+253,250,117, 81, 73, 73, 73,233,142, 29, 59,178, 85, 42, 85, 26,128, 63,210,211,211, 27,175, 94,189, 90,176,108,217,178,102,205,
+154, 53,147,236,217,179, 71,109,102, 58,163, 42,156, 83, 71, 12,137, 31, 53,126,162, 40,105,207, 90,  8,146, 18, 48,251, 70, 33,
+245,103,142,124, 22,128, 85,120, 92,214,190, 64,169, 59,190, 50,172, 46, 89,207,145,143,  6, 46,130,206,119,159, 42,171,181,100,
+217,217,217,173,136,137,137,  9,104,211,166, 13,  9,  0,231,238,235,132,211,215,197,215,249, 99, 73,123,162,125, 83,119,228, 23,
+171, 48, 97,109, 34,142,198,231,255,110, 16, 89, 53, 53,210,209,209,177, 32, 51, 95,234,237,238, 32,194,199, 29, 28,208,117,113,
+ 54,194, 91, 11, 33,228, 19,184,151,154,139,  6, 65,245,136,196,243,  7, 91,235, 69, 86,155,156,156, 28,  0,104, 13, 32,245,241,
+227,199,146,182,109,219,150, 24,209, 21,  1, 88, 42, 16,  8,102, 19,  4,193,180,105,211, 38,177, 89,179,102,101,174,174,174, 80,
+ 40, 20, 80,169, 84,224,243,249, 80, 40, 20, 72, 79, 79,199,229,203,151,225,234,234,106,211,129, 42, 43, 43,131,163,163, 35,104,
+154,126,102, 78,138,162,136, 13, 27, 54,216,223,190,125,219, 62, 54, 54,214,123,210,164, 73, 79,154, 52,105,114,109,224,192,129,
+ 15,189,188,188, 84, 55,110,220,192,197,139, 23, 81, 84, 84,132,118,237,218, 89,197,169, 86,171,193,229,114,161, 80, 40, 32, 20,
+ 10,193,229,114,161,211,233, 64,211,116,133,248, 42, 43, 43,195,211,167, 79,193,231,243,161, 86,171, 95,198, 27,104, 21, 11, 85,
+117,195,111,181,177,104, 25, 11, 53, 43, 69, 86, 77,150, 40,139,195,157,197,197,197, 98, 23, 23,151,233,  0,114,106,170,139, 32,
+  8,112, 56, 28,240,249,124, 16,  4,129, 78,157, 58,225,211, 79, 63, 69,203,150, 45,145,156,156,140, 93,187,118,225,234,213,171,
+224,241,120, 21,229,173, 30,159,232,220,153, 35, 18,137, 46,190,255,254,251,161,179,102,205, 18,213,171, 87, 15, 73, 73, 73,254,
+223,125,247,221,244, 19, 39, 78,124, 32,147,201, 90, 27,238,118,213, 91,233,245, 67,130,229,195,133,189, 84, 42, 21,146,146,146,
+108,217,166, 10, 26, 52,104,144, 78,146,228, 67,154,166,207,  1,104,206, 48, 76, 39,130, 32,142,162,220, 47,209, 24, 50,134, 97,
+222, 35,  8, 66, 10,224, 38, 73,146,247,105,154, 78,103,237, 54, 44,172,184,175,244, 49,253, 79, 16, 68,220,146, 37, 75,250,152,
+ 19, 87,102,174,205, 74,203,191,251,238,187,111,141,254, 63,139, 69, 53, 12,149,157,225, 59,235,173, 92,127, 11,173,184,184,184,
+234, 21,  8,141,143,226,246,237,188,212, 85,131,128,208, 86, 29,141,172, 67, 12, 18, 46, 95,  4,192,252,108, 85, 83, 36,125,196,
+ 36,135,251,243,134,111,199,145, 27, 79,203,241, 56, 59, 31, 23,143,252,140,130,156,180,109,  0, 51,  9,169,177,210,103, 62, 18,
+245, 62,106,230,229,238,225,162,212, 48,160, 25,  0, 85,196,214, 75, 65,203, 70,141, 26,245,143,143,143,247, 80, 42,149,162,243,
+231,207,203, 99, 98, 98,114, 53, 26,205,105,  0, 23,244,101,174, 23, 20, 20, 68,232,133,  9,135,203,229, 10, 52, 26, 77,117,190,
+ 11, 45,167,142, 26,126,126,233,134,173,162,135,183, 18,177, 58,246,  8,138,229,114,234,116,190,162, 31,  0,131,162, 63,121,189,
+ 80,145,197,128,169,203, 35,  9, 72,236,121, 62,119,159, 42, 69,128,249, 33, 89,149, 74, 53,120,232,208,161, 18,131,200,  2,128,
+194, 82, 45, 87,174,210,114,218, 55,117, 71,171, 46, 17, 72, 56,181, 23,123,206,102, 33,200,211,238,108,125,251, 98,171,246,104,
+ 65,126,206,134,149, 81, 27, 87, 46, 93, 48, 85, 48,185,151, 51,194, 91,243, 32,226, 19,112,178,227, 97,241,154,205,218,235,151,
+207,222,144, 72, 36,113,  0,250,229,228,228, 64, 34,145,148,  1,184,207,225,112, 82, 41,138, 50,231,212, 61, 23,128,119,116,116,
+ 52,169,213,106,203,146,147,147,225,227,227,  3,111,111,111, 56, 59, 59,227,238,221,187,248,243,207, 63,113,239,222, 61,208, 52,
+141, 55,222,120,195,166,131,245,228,201, 19,220,184,113,  3,189,122,245,158, 84, 80,144,239,228,234,230, 46, 59,127,238,236,247,
+181,225,164,105,154,  0,128,208,208, 80,132,134,134,138,178,178,178,252,226,226,226,188, 22, 45, 90,148, 17, 16, 16,176, 67,161,
+ 80, 84,178, 28, 88, 43,180, 12,226,194, 32,  2, 69, 34, 17,248,124, 62,164, 82, 41,242,242,242, 80, 90, 90, 30,180,233,226,226,
+242, 82,132,150,  5, 11,213,115, 43,255, 15,139,195, 42,195,157, 46, 46, 46, 67,  1, 76,183,178, 47,208,233,116,224,243,249,104,
+219,182, 45,162,162,162,112,245,234, 85, 28, 56,112,  0,254,254,254, 24, 49, 98,  4, 72,146,196,237,219,183,109,109, 34, 29, 31,
+ 31, 63,189, 95,191,126,161,209,209,209,162,244,244,116,220,187,119, 15, 46, 46, 46,136,138,138, 18,142, 30, 61,186,193,169, 83,
+167,230,162, 60,248,165,122, 24, 69, 23,202,196,146,  1,205,155, 55,175, 82,196,199,199,199,249,143, 63,254,240,170, 16, 96,166,
+ 17,137, 85, 81, 60,119,238,220,149, 33, 33, 33,171,244,195,133, 29,  1,216, 51, 12,211, 57, 54, 54,150,  0,128,240,240,112,134,
+ 32,  8,195,  3,233,230,222,189,123,187,220,189,123,151,153, 63,127, 62,235,163,197,194,146, 22, 25,109,184, 38, 45,  9, 40, 91,
+132,154,177, 60,104, 55,  9,  0,  0, 32,  0, 73, 68, 65, 84,197,203,128,111,190,249, 38,116,201,146, 37, 87,158, 81,100, 25,191,
+ 49, 49,  6,177, 85,241, 48,181, 56,100, 88, 97,251, 34, 37, 62, 94,238,110, 51, 70,180,  7, 77,  3, 58, 10,208, 81, 12,100,114,
+  5,146,110, 93,149, 67, 68,196, 90,213, 28,161, 96,217,162, 89, 19,  3, 19, 51, 73,100, 23,105,112,230,224, 70,166, 32, 39,173,
+ 63, 82,247,142,124, 62, 34,107, 64,115, 31,111,175, 51, 59, 55, 46, 36,175,166,168, 65,209,229, 58,139,166,153,138,223, 47,  1,
+ 62,158,158,158, 67, 46, 93,186,228, 41, 20, 10, 69, 15, 30, 60,160,247,238,221, 91,164,209,104, 78, 24,137, 44,  0,104,223,186,
+117,107,157,131,131,  3,100, 50,153, 70,163,209, 40,171, 17, 89,126,157, 91,182, 56,187,116,195, 86,145, 82,173, 70,137, 66,  5,
+142,187,151,169,200,  2,128,183,187, 52,244,245, 37, 68,142, 96,  0,164, 73, 53,217,150, 68, 22,  0,  8,133,194,110,227,198,141,
+171, 52, 47,158,135, 35, 79,103, 39,228, 81, 23,238, 20,210,  9,167,246,226,220,237, 66, 90,196,231, 80,158, 76, 74,160,181, 59,
+160, 56,243,206,134,  3,191,197, 29,255,122,206,178, 50,185,172, 20, 65,117,196, 40, 43, 45,193,226, 37, 75,181,241,241,231, 78,
+ 79,159,244,249, 91,123,247,238,253, 14,229,206,224,  0,112,127,239,222,189,195,231,204,153,179, 29,127,167,121, 48, 69,246,144,
+ 33, 67, 50,155, 54,109, 90, 18, 18, 18, 82,242,228,201, 19,220,185,115,  7, 69, 69, 69, 88,189,122, 53,146,146,146, 96,176,  8,
+ 90,229,171, 82, 85, 32,161,168,232,169,  3,195, 48, 40,122,250,196,126,214,172, 89,206,181,225,164, 40,170,210,181,229,235,235,
+139,177, 99,199,242,229,114,185, 75, 70, 70,134,147,241, 58,107, 57,213,106, 53, 12,150, 33,134, 97,160, 86,171, 81, 82, 82,  2,
+181, 90,141,135, 15, 31, 86,136, 44,125,253, 47,205,162,101,248, 45, 18,137,242, 12,231,178, 97,  8, 78, 36, 18,229, 91, 42,255,
+ 44, 48,170,139,209,255,182, 85, 28,214,216, 31, 43,143, 59,248,124, 62, 62,253,244, 83, 92,185,114,  5,201,201,201,224,112, 56,
+144,201,100,144,203,229,232,222,189, 59,  4,  2,129,173, 22, 45,134,207,231, 15,157, 57,115,166, 40, 53, 53, 21,133,133,133,  6,
+103,122, 80, 20,133, 73,147, 38,137,133, 66,225, 80, 91, 77,247, 57, 57, 57,239, 62,124,248,176,145,233, 39, 55, 55,183,196,216,
+167,176,182,136,141,141, 37,194,195,195,153,240,240,112,198, 32,184, 88,176, 48,  7, 11, 90,100,147, 37,139,214,243,176,138, 25,
+ 44, 91,208,  7,136,212,  2,  6,145, 21,102, 36,188,  8,131,133,203,186,161,195,160,  1,255,243,118,119, 59, 21,189, 54,210, 33,
+238, 22,129,204,199,105, 40,200, 73, 71,235,183, 58, 35,233, 86, 34,104, 45,181, 15, 15, 99,107,246,228,172, 23,222, 48, 36,164,
+201, 23, 97,111, 53,195,178,184, 50, 60, 72,248,  3,197,  5, 57, 63, 34,109,239,190,231,114,132,  2,194, 91,120,123,185,157,218,
+190, 54,210,229,232, 29, 18,143, 31,167,225,224,246,149,140, 86,163, 42, 70,229, 72, 46,155,223,154,197,180, 90, 80, 86,156,  7,
+117, 41,  5, 17, 41, 23,217, 56, 72,145, 11,224,220,202,149, 43,187,182,107,215, 78, 48,100,200,144,220,162,162,162,131,  0, 46,
+ 25,149,105,218,176, 97,195, 94, 81, 81, 81,222,143, 31, 63,198,137, 19, 39,114, 81, 30,250,111,  9,153,103, 19,111,173,251,115,
+251,230,169,226,192,198, 88, 61,243,107, 93,236,213, 59,239,  3, 56,106, 84, 38,164, 91,243,134,113,139,166,124, 73,210,215,127,
+199,141,244, 60,164,148,168,254,180, 68, 88, 88, 88, 72,200,229,242,  0, 23, 23, 23,227, 19, 18, 18,123,153,106,218,128,134,217,
+221,167,159,175,163,212, 80, 16,242, 72,102,194,  7,  1,217, 87, 14,198,186, 23, 42, 11,  9, 67, 52, 98, 77,248,108, 96,183, 15,
+214,198,236,255, 56, 46,238,240, 23, 26,149,178, 89,227,198,141,152,107,241,167,110, 76,159,244,121,207, 90, 30,113,135, 43, 87,
+174,144, 28, 14,167,146, 64, 55,182, 16,217,106, 41,178,  5,214,114,154, 10, 45,  3,116, 58, 29, 81, 91, 78,149, 74, 85, 33,180,
+ 76, 31,238,230,  4,227, 63,209,127, 91, 44, 84,198, 67,134,  6,127, 58,165, 82,233,165,247,217,242,126,158, 22,173,103,137, 68,
+172,110,248,210,150,246,145, 36,  9,154,166,193,231,243,241,198, 27,111, 32, 46, 46, 14,110,110,110,112,114,114,130,147,147, 19,
+196, 98, 49,220,221,221, 43,132, 22, 73, 90, 29,165,195,168, 84, 42,127,127,127,127, 60,124,248, 16, 34,145,168,226, 35, 20, 10,
+ 17, 26, 26, 10,153, 76,230,139,151,105,187,103,193,226,159,189,175,196, 25,139, 37,130, 32,226,102,204,152, 49,179,182,124, 51,
+102,204,152,105,206,194,245,140,130,171,146,117,139,107,172, 32,205, 42, 73,189,200,218,246,227,  2,167,253,127,  1,153,153,169,
+ 56,190,103, 77,169, 86,163, 46,162,105,109, 64,202,189, 68,128,196,207, 86, 53,129,100,222,252,160, 87, 23,226,248,109, 53,164,
+197,  5,184,127,237,143, 52, 40,  4,223, 60, 55,145,229,237,113, 42,122,237,  2,151, 67,183,  8, 60,126,156,134,163, 59, 87, 75,
+181, 26, 77, 55,164,198, 94,123, 22,234,161,124,254,  7,252,186, 25,125, 70,117,204,  6, 69, 80, 24,154,116,247,189,252, 92,124,
+144,115,190,250,200, 48, 99, 20, 20, 20, 28, 92,185,114, 37,177,124,249,242, 48,165, 82,249, 43,  0, 99, 19,101,179,160,160,160,
+ 65,155, 54,109,114,123,252,248, 49,239,252,249,243,178, 83,167, 78, 49,  0, 14,213, 96,113,153,214,125,228, 88, 78,203,122,190,
+227,174,167,101,189, 15,224,119,163,213,161,125, 90, 53,189,176,117,201, 92, 71,237,133, 88,148,229, 60,198, 55, 23, 50,165,  0,
+172,222,223, 90,173, 22, 37, 37, 37,208,150, 61,209,181,150,200, 74,230, 71,120,169,242,138,148, 92, 30, 45,215,133, 56,229,171,
+ 78, 61, 73,225,216,217,217,217,180, 47,215, 46,153, 26,  3, 32, 38, 34, 34, 34,250,102,252,225,214, 18,137,228,112, 72, 72,  8,
+  1,  0, 22, 34, 12, 45, 33, 18,192,164,183,223,126,155,104,219,182,237,229, 85,171, 86, 29,171, 78,172,212,198,162, 85, 19,172,
+229,164,105,154,180,176,127,137,218,114, 26, 91,180,106, 18, 90, 47,211,162,101, 78,180, 24,139, 68, 99, 33,244,111,136, 58,172,
+ 78, 76,217,210, 62,131,159, 28,159,207, 71, 98, 98, 34,234,214,173, 11,141, 70,  3, 71, 71, 71, 56, 58, 58,194,193,193,  1,165,
+165,165,224,241,120,176,177,207,180, 72, 36,202,184,115,231, 78, 35, 79, 79, 79, 80, 20, 85, 73,108, 61,120,240,  0,246,246,246,
+ 89,182, 90,180, 36, 18,201, 31,250,168,195, 74,240,241,241,113,126, 30,251,213,216,146, 21, 30, 30,206, 14, 17,178,168,214,154,
+101,193,170, 85, 96, 98,137, 82, 27,253, 47, 64,121, 14,183, 62,250,223, 48,243, 91,109,102,217,147, 37, 75,150,156, 50,242,239,
+ 42,120,198, 46, 24, 82, 60, 84,138,112,225,214,100,201,242,114,115, 61,181,101,245,124,167, 61,  9, 64,214,227, 84,156,217, 23,
+ 85,162,163, 52,239,128,102,114,226, 79,236,139,  5,  1, 57, 82, 98,207, 88,119,139, 64,203,150, 77,  2,112,224,182, 22,  5,153,
+ 15,192, 48,244, 54,228,199,200,159,249,232,  4,125,244,134,151,155,199,169,109, 81,243,157,247, 39, 18,200,124,156,138,227,123,
+162,164, 58,173,188, 43, 82,247, 37,212,150,246, 83,192,149, 99, 47, 90,215,191,115,203,  1,  1, 65,126,160, 25, 45,104, 62,131,
+143,166,121,112,239, 95,151, 31, 56, 39, 42,217, 67,151,209, 95,100, 93,178,206,129,174,172,172,236,  0,128,107,168,156, 94,161,
+ 69,112,112,240,128,117,235,214,121,102,102,102,138,174, 95,191,174,216,184,113, 99, 62, 77,211,251,  1, 88, 51,148,250,245,245,
+180,172, 45,168,156, 47,167,197,212,145, 67,226,135,124, 50, 74,148,122, 34,  6,174,169, 73,152,114, 33,155,186, 95,164, 30,172,
+183,174,153,133,135,135,  7, 83, 88, 88,152, 94, 92, 92,220,200,222,222, 30, 79,158, 60,193,211,167, 79, 81, 82, 82,  2,149,244,
+169,206,157, 42,150, 17,186,167,224,241,120,200,127,172,  5, 69, 81,185,214, 90,179,  0,184, 70, 70, 70,126, 70,211,180, 33, 35,
+ 98,165,232, 66,163,114,134,243,161, 81, 68, 68, 68,180, 81,212,161,177, 51,188, 33,189,  3,161, 79,239,208,238,247,223,127,191,
+219,179,103,207, 76,115, 98, 69, 40, 20,218,236, 40,109, 41,138,177, 54,156,150, 44, 90,166,203,109,225, 52, 12, 95, 26,156,224,
+ 77,151, 27,192,225,112, 64,211, 52,172,  8,170,248, 71, 69,139,113,116, 96,109, 68,142,201,177,169, 54,113,104, 45, 35, 17,159,
+171, 69,203,112, 44,248,124, 62,126,251,237, 55,124,242,201, 39,160, 40, 10,118,118,118,112,112,112,128,189,189, 61,246,237,219,
+  7, 67,250,  7, 91,244,171, 86,171,253,101,201,146, 37, 51, 55,108,216, 32,102, 24,  6,  2,129,160, 66,104,205,159, 63, 95,161,
+209,104,126,177, 74,104, 25, 50,190,211,204, 29,123,123, 93,181, 81,135,230,182,177,224,175,229, 18, 25, 25, 57,156,166,233, 15,
+ 96,146,194,193,164, 92,165,212, 15,108,122,  7, 22, 86,220, 79,174,254,139,155,103, 16, 88,132,145, 37,171, 66,112,145,213,137,
+ 23, 79, 87,151, 83,155, 87,207,119,218,113,149, 64,106, 74, 10, 78,255,186,166, 92,100, 61,218,243, 23,210, 99,243,144, 26,219,
+  1, 41,177,239, 90,253,246, 68, 16, 45,235,120,185,224,169,140,134,180, 48,  3, 96,112,253,121,136, 44, 79, 87,207, 83, 63, 69,
+205,119,222,251, 23,137,212,212, 84, 28,223,179,166, 68,167, 83,190,243, 44, 34,107, 40,159,255, 65,112, 67,191,228,217,159,125,
+ 48,160,109,  3, 31,184,103,220,197,161, 17,  3,176,112,215,135,112,244,228,224,205, 94,142,248,116,177,207,  0, 73,168,240,161,
+164,  3, 62,176,129,218, 88,100,181,172, 95,191,254,128, 75,151, 46,121, 52,111,222, 92,116,239,222, 61,229,198,141, 27,243, 21,
+ 10,197, 49,  0,137, 54,112, 26,139,172,150, 51, 70,143,136, 95,186, 57, 90, 68,242,  5, 88,246,203, 33,140, 63,155, 73, 29, 78,
+151, 70,160,242,176,162, 89,168, 84,170, 19, 81, 81, 81, 42,146, 36,241,244,233, 83, 20, 22, 22, 34, 63, 63,191,226,187,184,184,
+ 24, 28, 14,  7, 39, 79,158, 84, 75,165,210, 75,214, 54,240,226,197,139,245,179,178,178, 66,114,114,114, 90,235, 63,247, 80, 30,
+ 93,232, 96,180,172,117, 78, 78, 78, 24,128,171,134,229,153,153,153,245, 46, 95,190, 44,169,137,223,209,209, 17,124, 62,191,146,
+ 69, 75, 40, 20,194,219,219, 27, 58,157, 14,187,119,239,  6,128,167,213,113,240,249,130, 28,146, 36, 64, 51,180, 74, 36, 18,209,
+ 18,137,196,172,192,178,133, 83,143,204,247,222,123, 79,153,144,144, 96,214,162, 85, 27, 78,134, 97,228, 61,122,244, 64,118,118,
+ 54, 68, 34, 81,197,195,218, 32,168, 72,146,132, 80, 40, 68,110,110, 46,198,140, 25,  3,134, 97,228, 47,250,206, 99,236,211,164,
+ 23, 67,  4,  0, 66, 47,132,170,248,105, 89,235,  3,101, 24, 26,100, 24,  6,  6,193,101,178,190,162, 46,107,178,183,155,248,116,
+141, 46, 46, 46, 94, 90,222, 28,102,163,201,247, 38, 27, 30, 10, 21, 66, 43, 41, 41,  9,209,209,209, 40, 46, 46,134, 64, 32, 64,
+ 81, 81, 17,182,110,221,138, 59,119,238, 64, 32, 16,192,176, 47,172,213,111,109,219,182, 93,122,238,220,185, 59,131,  7, 15, 86,
+ 36, 38, 38, 66,161, 80, 32, 49, 49, 17,239,190,251,174,242,194,133, 11,201, 10,133, 34, 18,214, 12, 29, 26, 50,190,235,167,215,
+ 81,169, 84,184,126,253,186,217,143,165,109, 76,145,156,156, 28, 64, 81, 84, 35,134, 97, 58, 50, 12,227,  4,125, 10,  7,253,127,
+227,207,123,250,117, 78, 12,195,116,164, 40, 42, 56, 57, 57, 57,128,149, 19, 44, 94, 81,156, 49, 18, 91,140,145,200, 58, 83,189,
+ 69,139, 38,163,182,172, 89,224,244,203, 21, 18,143,211,147,113,237,200,186, 18,138,214,190, 99,227,116, 56,221, 96,148,107, 67,
+ 36,182,111, 70, 19,229,225,204,210,194,199,  0,195,169,141,208,170,196,  9,154,140,218,186,102,190,243,206,107,  4,178, 31, 63,
+194,133,131,107, 75,116, 58, 85, 87,164,196, 94,175, 13,231, 80, 62,127, 14,143, 67,204,238,209,254,127,252, 14,255,107,  8,251,
+252, 52,228,102,102, 99,119, 82,193,211,228, 34,213,168, 11,132,  6,233,143, 84, 91,122,125,230,230,230,234,195, 67,159,207,221,
+221, 46, 29,146, 30, 32,120, 50, 13,163, 97,150,228, 92,168,152,150,162,114, 59,171,194,199,209,209,113,240,181,107,215,156, 68,
+ 34,145,248,218,181,107,244,198,141, 27,159, 40, 20,138, 35,  0,226,173,234,123, 85,248,181,105, 24,116,230,219,181,155, 69,101,
+ 50, 57,100,106, 13,132,222, 18,106,127,252,173,254,176,156,  0,179, 18,167, 80, 40,220,185,115,231,206, 94,157, 58,117, 10,104,
+214,172, 25,249,244,233, 83,148,149,149, 85, 56, 87,123,122,122, 34, 41, 41,137, 78, 77, 77,205, 22, 10,133,187,172,109,231,219,
+111,191,157, 74,146,228, 61,253, 48,218, 61,152, 68, 23, 26, 21,109,148,147,147,211, 70, 34,145,156,  1, 96,103, 20,117,104,204,
+105, 72,239, 48, 19,  0, 73, 16,196,213,196,196,196,178,158, 61,123, 66, 44, 22, 67, 38,147,193,223,223, 31, 58,157, 14, 71,142,
+ 28, 65, 66, 66,130,140,166,233, 51,102,196,107,165,118, 42,149, 10,127,  0,164, 66, 46,127, 99,248,240,225, 97,147, 39, 79,174,
+ 20,146,238,229,229,  5, 55, 55, 55,155, 56,  1,224,233,211,167, 77,126,255,253,247,137,137,137,137, 95,247,234,213,203,121,230,
+204,153,194,250,245,235,131,162, 40,178,182,156, 69, 69, 69,206,215,175, 95,255,190, 67,135, 14, 95,246,236,217,147,251,237,183,
+223,194,217,217, 25, 20, 69, 65, 44, 22, 67, 42,149, 34, 50, 50, 18,231,207,159,215, 49, 12,179,182,164,164,100,138,141,231, 18,
+158,245,218,180,100,  1,178,148,146,193, 66,249,127,188,157, 38, 62, 93,208,167,112,152,110, 33,131, 61,172, 61,231, 13, 66,139,
+195,225, 32, 45, 45, 13, 27, 55,110,172,146, 71,203,144,254,193,  2,183,185,190, 51,167, 79,159,166,  8,130,120,235,218,181,107,
+211, 63,254,248,227, 81, 50,153,204,207,222,222, 62, 91,171,213,254,172, 80, 40, 22,163,220, 31,149,111,203, 61, 68, 38,147,165,
+155,139, 58, 52, 45,  3,184, 84,203,105,146,222,161, 82, 10,  7,147,109, 42,165,126, 48,147,222,225, 31, 63,238, 44,231,191,146,
+243, 85, 23, 91,150, 19,150, 86, 65,203,209, 60,158, 66,219,252, 92, 50,241, 44, 34,171,170,181, 68, 41, 79,158,187, 51,227,127,
+106,149, 18,178,146,188,251, 72,219,157,255, 76,221,210,183,243,108, 50,129,180,212, 71,184, 18,183,182,188,157, 41,177,181,110,
+ 39,  1,124,179,254,104, 44,159,112,118,195,141,137,159, 32,187, 88,134,163, 41, 69,123, 24,185,234,139, 95,128, 34,156,  7, 72,
+157,234,220,214, 89,185,235, 58,126,228, 60,192,195,151,135, 21, 83,127,134,104,134, 59,255,205,174,157,108,153,  3, 49, 87, 36,
+ 18,157, 91,189,122,117,183,142, 29, 59, 10, 35, 34, 34,204, 57,200,219,138,204,171, 15, 30,173, 63,188,225,135,169,238,205,219,
+225,199, 57,211,168,157,241,183, 76,163, 16,171, 69, 72, 72,  8,117,241,226,197,201, 99,198,140, 89,209,173, 91,183, 58,239,191,
+255,190,192,223,223, 31, 66,161, 16,143, 30, 61,194,185,115,231,212, 41, 41, 41,217,114,185,124,114,139, 22, 45,108,201,113, 86,
+ 52,119,238,220,165,250, 58,  8,253,112, 97,107,232,163, 11, 13,133,244, 73, 75, 91,  3,176,155, 63,127,254,199,  0, 96, 33,236,
+123, 46,128, 13,  0,184, 12,195,228,198,196,196,188,117,240,224,193,183, 38, 77,154,196,239,213,171, 23, 46, 93,186,132,227,199,
+143,107, 52, 26, 77,188, 94,184, 90, 59, 85, 14, 13,224,186, 78,167,187,181,108,217,178,183, 56, 28,206, 92,195,138, 59,119,238,
+ 96,219,182,109,181,225,212,  1,248, 62, 47, 47,111,125, 76, 76,204,220, 19, 39, 78,140, 28, 62,124,184,147, 86,171, 69, 82, 82,
+ 18,126,250,233,167, 90,113,150,148,148, 76,244,240,240,152,125,228,200,145,159,143, 29, 59,214,111,216,176, 97,228,248,241,227,
+ 17, 21, 21,133, 95,127,253,149,166, 40,234, 32,143,199, 27, 94, 88, 88, 40,123, 25,119, 29,253, 48, 92,182,141,115, 29,214,200,
+251, 44, 67,131, 86, 34,231, 89,  9, 12,253,232,220,185,115,133,149,209, 96,133, 51, 46, 67, 16,132,205, 67,135,  0, 92, 24,134,
+161,  1,172, 69,249,252,162,198, 89,225, 57,248, 59,115,188,181,140, 77,115, 84, 46,119,160, 66, 82,245,147, 74,187,  0, 12,154,
+214,192, 86, 60,119,238,220,149,243,230,205, 91,105,154,194,193,184,144,105,234,135,  5, 11, 22,128, 77,239,192,226,117,133,121,
+161,117,125,147, 86, 27,216,127,230,234,111,167,205,211,105,213, 37, 12, 52,225,120,180, 47,241, 89, 43, 99,104,102,198,201, 29,
+243,163,192,160,136,161,116,211,159,185,245,255, 80, 59,  9,103, 55,148, 70,142,197,175,183,179,153, 92,153,246,195, 95, 52,154,
+ 74,214,160,114,159, 44,122,224, 41,101,209,110,215, 58,188,253, 19,223,113, 39, 14, 63,253,216,230,122,242,243,243,127, 91,185,
+114, 37,249,195, 15, 63,132,201,229,114, 83,  7,249,218, 98, 90,223,113, 51, 56,111,  6,  7,140,187,242, 48,253,  3, 88, 49, 92,
+104,138,183,223,126, 59,231,238,221,187, 67,142, 29, 59, 54,248,236,217,179,221,100, 50, 89,  0, 65, 16,176,179,179, 75, 87,169,
+ 84, 39,132, 66,225, 78, 27, 69, 22,  0, 96,222,188,121,204,130,  5, 11,136,187,119,239, 50, 28, 14,231, 79,  0,169, 28, 14, 39,
+205,216,  9,222,120,185, 97,155,249,243,231, 91,243, 64, 60, 91, 86, 86,150, 16, 25, 25,217, 41, 50, 50,242, 13,189, 85,232, 44,
+254,246,249,178, 21, 90,  0,103,249,124, 65, 54, 65, 16,126,124,129, 80,118,241,226,197, 19,207,200, 41,215,104, 52,211, 31, 63,
+126,188, 98,197,138, 21,139,237,237,237,219,220,185,115,231,207,103,225,212,139,168,254,110,110,110,117,162,163,163,247,110,221,
+186,181, 29,151,203,189, 68, 16, 68, 68, 73, 73,201, 75,157, 84, 90, 63, 65,244,  2, 27,230, 58,180,138,247,121, 39, 41,253, 39,
+132, 27, 69, 81,101,179,103,207,206, 55, 21, 94,166,214, 43,195,127,125, 42, 23,107,246,169, 45, 81,148, 53,  8, 23,162, 12,  0,
+202,231, 46, 44,159, 86,199,218, 73,165,  1, 40,106,186,206, 73,146, 60,  8,224, 62, 73,146, 15, 77,  3, 93,140,215, 45, 88,176,
+160,166,235,156,  5,139, 87, 26, 86,220,217,230,147,192,252,218,122,210,190, 64,115,229,243,105,231, 16, 62,127,  1,  9, 76,  5,
+ 64, 48,192,138, 95, 52,154, 89,213,109,232,243, 54, 22, 51,  4, 38,233,119,230,183,185, 23,176,168, 22,125,247,133, 21,243, 15,
+218,200,217, 24,213, 79, 40, 91,133, 51, 60, 60,156, 99,225, 97, 94,105, 82,105, 75,136,141,173,200,226,111,169,157,198,231,155,
+227,229,203,151,235,180,109,219, 54,  7,149,157,254,205, 45,103,108,236, 59,  7,  0,245,156,247,231, 43,193, 25, 20, 20, 36,120,
+244,232,145,250,223,117,109,178,156,255, 74, 78,151, 38,117, 65,224, 51, 24,231, 14,170,214,162,101, 36,208, 24,230, 39, 20, 39,
+ 61,182,208, 78,195,117,238,146,156,156, 28,208,160, 65,131,116,  0,197, 38,237, 48,183,142, 97,143,209,127,158,211, 28, 70,163,
+242, 84,116, 44,204, 28,  8,150,147,229,100, 57, 89, 78,150,147,229,100, 57, 89,206,218, 10,173, 87, 26, 36, 88,176, 96,193,130,
+  5, 11, 22, 44, 88,252, 35, 32,170, 81,165,182,152,  4,107,163,108, 79,176,156, 44, 39,203,201,114,178,156, 44, 39,203,249,159,
+227,172,137,219,120,251, 87,117,232,240,133,181,155, 53,171,178,156, 44, 39,203,201,114,178,156, 44, 39,203,249, 44,130,229,149,
+  6, 23, 44, 88,176, 96,193,130,  5,139, 87,  6,221, 26, 66,194,165, 64,254,254,200,170, 32,170, 26,209, 51,  8,190,  0,240,188,
+248,254,163,144,  0,232,109,244,255, 48,244,145,241,172,208,122,117, 17, 12, 96, 38,  0,227,185,200,174,  0, 88, 98, 82,110,  7,
+  0,227,  9,  9,101, 40,159, 39,240,161, 45,149,145, 36,185,164, 83,167, 78, 95,156, 63,127,254,  7,157, 78, 23, 89,139,246,  6,
+ 72, 36,146,165,  4, 65,180,  2,192, 35,  8,226, 81, 94, 94,222, 18,157, 78,247, 44, 81, 43,129, 62, 62, 62,223,  1,248, 31, 73,
+146, 60,130, 32,146,243,242,242, 22,233,116,186,211,207,192,233,232,237,237,221,158, 97, 24, 31,  0, 28, 30,143,247, 36, 43, 43,
+235, 50,106,153, 91, 41,124,126, 18, 95, 42,211,241,  0,192,201,158,171,141,157,223, 68, 99,237, 50,246, 20,103,193,226,191, 13,
+166, 60, 50,185, 18,222, 13,194, 98, 70,135, 41, 20, 64,244,168,143, 53,127,164, 98,138,165,237,  9, 51, 81,205,166,156,239,  6,
+ 97, 49,197,148,115,244,  8,194,247,127, 60, 66,181,145,246,214,112, 26,176,  9, 32, 71, 91, 49, 75,  1, 97, 93,244,245,191, 29,
+189, 81,121,168,176, 98,232,176, 90,161, 53,176, 33, 36, 20, 23,220,216, 36, 24,194,120, 29,  1,188,161,127,200, 63, 68,121,174,
+162,210,103,108,220,171,194,249,111,195, 92,134, 97,134, 84, 58, 89,205,228, 33,122,231,157,119,222, 63,118,236,152,157, 97,190,
+ 59,154,166, 33, 22,139,117,  0, 70,216, 80,151,215,192,129,  3,103,108,217,178,  5,  3,  6, 12,152, 29, 23, 23,183, 18, 64,153,
+181, 27,187,186,186,134,187,184,184, 68,109,222,188,217,179, 93,187,183,  8,129, 64,128, 71,143,146,253,198,140, 25,211,236,238,
+221,187,  7,243,243,243, 71,217,218,121, 55, 55,183,161, 46, 46, 46, 43, 54,110,220,232,209,161, 67,  7, 16,  4,129,132,132,  4,
+191,137, 19, 39,190,145,145,145,177, 43, 47, 47,239, 75, 91, 57,221,221,221, 27, 58, 59, 59,119,249,241,199, 31,197,237,219,183,
+135, 72, 36, 66, 98, 98,162,195,231,159,127,238,147,149,149,149,148,151,151,119,198, 86,145,117, 51,225, 80, 63,157, 70,181, 12,
+  0,184,124,225,180,118, 43,226, 15,221, 60,117,168,111, 77,203,194,231, 39, 29, 96,197, 22, 11, 22, 44,140, 49,180, 14,124, 24,
+  6, 83,143,253, 52,135,  4,128, 30, 35, 23,142, 31, 90,  7, 63,252,146,109,121, 14, 91, 27,249,166, 12,247, 69, 84,116, 22,242,
+158,165,157,155,  0,114, 34,151, 59,254,205,182,109, 61,190,186,112, 33, 89,  3,252,252, 31, 57, 68,102,135, 57, 45, 10,173,254,
+ 77, 16,169, 43,183,152, 16, 61, 27, 96,215,241, 84,206,185,119,222,121,167,193,167,159,126, 74,180,108,217, 18,  9,  9,  9, 13,
+119,237,218,213,251,240,225,195,201, 20, 69, 37,  0,184, 13,235,179, 90,243,  0,132,114, 56,156, 86,255,114,206,127, 51,236,245,
+226, 42, 15,127, 39, 58,173,146,240,244,228,201,147,191,113,185, 92,131, 69,235, 77,153, 76,230,109, 98,  5,179,  6,245,180, 90,
+ 45,238,221,187,  7,146, 36,121,  0,234,163,234,148, 26,150,224,103,103,103,183, 46,254, 74,130, 59,193, 21,163, 72,  9, 64,169,
+129,192,193, 27, 91,182,197,184, 77,158,240,101,255,211,167, 79,159, 43, 45, 45,221,110, 67,123,234,219,219,219,175,188,113,227,
+134,187,157,157, 29,104,154, 70,105,105, 41,124,124,124,176,121,243,102,151,201,147, 39, 15,145, 74,165,167,149, 74,229,175,182,
+136,115,103,103,231, 46,183,110,221, 18, 27, 38,148, 86,171,213,240,243,243,195,142, 29, 59,132,227,199,143,111, 82, 92, 92,156,
+169, 86,171, 83,172, 37,148,202,116, 60,157, 70,181, 44,122,237,252,186,  0, 48,252,203,249,203,  4,165, 78, 71,172, 89, 38,149,
+233, 14,  3, 96,133, 22,139, 23,141, 86, 30, 30, 30,177,133,133,133,103,  0,140,194,243,177, 52, 52, 20,137, 68, 45,104,154,246,
+ 33, 73, 18, 28, 14, 39, 87, 38,147,221,  0,240,160,182,132,238, 65,157,251, 66,104,247,  9, 24,250, 13, 18,  0, 65,146,137,148,
+ 70,190,237,201,131,211,135,158,137, 83, 32, 30,  9, 48,111,144,  0, 77,144,228, 13, 90, 39,223, 92,120,239,244,209,127,203,193,
+185, 84,130, 70, 65, 62,214, 79,140,249, 60,248,  6,  5, 66, 66,210, 32,119,164, 89, 63,172, 56, 14,232, 53, 97,194,  4,159, 47,
+191,248,130,248,100,196,136,224, 51,231,207, 19, 97,182,204, 86,240,106,194,162,227,187, 89,161, 21,222,  4,174, 12, 48,125, 87,
+212, 76,146,203,225, 16,131, 39, 44, 25,178,117,237,247,100,247,190, 17, 21,195, 39, 29, 59,118, 68,199,142, 29,137,101,203,150,
+  5,255,249,231,159,193, 59,118,236,208,197,199,199,223,  0,176,219, 82,101,239,  6, 65, 65,  3, 34, 62,143, 43, 27, 60,103,251,
+198,182,109,219,254,159,189,243, 14,139,226,106,219,248, 61,219,251, 46, 11, 11, 75, 71, 84, 58, 54,136, 98, 87, 44,216, 80, 44,
+137, 93, 99,124,237, 45,209, 68, 99, 98, 52, 38,182,216, 98, 84,140, 26,107,236,250, 26,123, 47,177, 87, 80, 64,197, 74,103, 89,
+154,244,178,253,124,127,  0,126, 72, 40, 11,152,215,148,249, 93,215, 92, 11,103,103,238, 61,211,206,220,243,156,  6, 30,143,135,
+250,104,  2, 64,247,198,140, 24,182,101,195,136, 97,211,230,199,183,110,221,150,188, 11,205,191, 17,119,129, 55,147, 90,203,157,
+156,156,218, 25, 12,  6, 62,  0,176, 88,172,226,196,196,196,105, 40,153, 27, 16,  0,142,154, 76,166,126,181,208,102,  0, 88,208,
+175, 95,191,121, 83,167, 78,133,179,179, 51,166, 79,159, 14,189, 94, 31,118,250,244,233,249,  0,150,161,134,155,199,198,198,102,
+254,134, 13, 27, 44, 89, 92, 17,252,230,196, 34, 37,219,  0,  0, 16,243,128, 99,147,  8,166, 79,159, 46,189,127,255,254,162,218,
+ 24, 45, 27, 27,155,239,126,249,229, 23, 75,161, 80,  8, 66,200,155,185, 24,243,243,243,145,159,159,143, 41, 83,166, 72,159, 60,
+121,242, 67,109,140,150, 82,169,108,183,126,253,122,  1,159,207, 71,126,126, 62, 71,167,211, 81,121,121,121, 40, 44, 44, 36, 90,
+173, 86, 55,109,218, 52,222,163, 71,143, 58,167,164,164,196,128,230,175,  2, 19,192,  0, 54,155, 61,176,113,227,198, 31,188,120,
+241,226,129,193, 96, 56, 12,224,240, 59,120,153,234,106,111,111,191, 88,165, 82,173,  7,176,235,223,114, 64,149, 74,229,225,155,
+ 55,111, 58,109,216,176,225,227, 85,171, 86,157,  2,240,223,122,200,113, 56, 28,206,160, 78,157, 58, 57,141, 30, 61,154,171, 84,
+ 42,161,209,104, 16, 27, 27, 43, 61,112,224,128,203,195,135, 15,147, 74,103,196, 48,251,133,194,202,189,173, 24, 44,233,190, 54,
+109,219,181, 31, 60,104,128, 68,105, 37, 67,145,214,136, 23,241, 41,206,103, 78, 29,235, 20,205, 17,220,212,233,114,134,102, 62,
+191,153, 95, 91,205,192,192,174,237,187,117,237, 42,145, 89,200,144, 83,160,195,171,184,100,151,203,231,143,119, 96,177,  4, 87,
+ 77,148,126,100, 90,212,249,194,247,121,110,166,  3,172,  2,190, 85,179,230,109,253,238,  7,141, 93,244,  1, 33,  4, 12,130,181,
+ 21,163, 89,211,  1,214,218,146,105,191,106,165,  7, 66,  8, 69, 97,101,249,104, 86,143, 70, 88, 76,  8, 62,  7,  3, 84,143, 26,
+170, 41,203,  8,  2,120, 22,150,150,  1, 19,199,143,167,242,114,115,241,240,225,195,194,138, 38,235, 71,  7,112,174, 50,208,224,
+104, 98,221,205,246, 95, 52,154, 85,105,213,161,217,227,104,  9,133,194, 74,211,101, 50, 25,  2,  3,  3,177,116,233, 82, 22,  0,
+255, 10, 95,191, 61,201, 42,192, 59,177,113, 46,100, 34, 30,195,217,217, 89, 34,149, 74,235,173,  9,  0, 32, 38,215,182,206,164,
+215,189, 95,191,250,248,194,158,213,190,  5,121,217,236,138,171,136,197, 98,120,120,120, 96,222,188,121,230,105,214,159,255,169,
+166,173,173,173,103,135, 14, 29,252, 47, 93,185, 98,161, 82,169,120, 42,149,138,119,238,210, 37,139, 54,109,218,248,219,218,218,
+122,190, 57, 84,132,212, 38,159,223,135,134,134,206, 63,122,244, 40,163, 67,135, 14,144,203,229,  8, 12, 12,196,169, 83,167, 88,
+171, 86,173, 90,  2, 96, 94, 77,249,100, 48, 24,237, 59,116,232, 64,129, 16,168,115, 12,184,179,212, 19, 15, 87,122, 33,175,152,
+224,117, 78, 46,138,138,138, 33, 20, 10,249, 40,169,238, 53,119,223,219,182,105,211,134,  2,240,198, 92,229,229,149, 44,249,249,
+  5,208,106,117,224,241,120, 18,  0,124,115, 53,  9, 33,182,237,218,181,  3,  0,232,116,186, 55,111,120,217,217,217, 84, 78, 78,
+ 14,180, 90, 45,216,108, 54,  7, 53,183,107,124,163, 41, 21,177,244, 44, 14,111,246,232, 41,223, 38,142,158,242,109, 34,139,195,
+155,173,149,228, 26,205, 73,147,138, 88,250,247,124,125, 90, 51, 24,140,109,141, 26, 53,122,194, 96, 48,118,  2,176,173,167,102,
+ 75,  0, 75,  4,  2,193,  5, 47, 47,175, 68,161, 80,120,169,212,168,183,169,163, 38, 87, 40, 20, 94, 90,178,100,201,193,  7, 15,
+ 30, 12,190,120,241,162,107,100,100,228,160,229,203,151,239, 19,139,197,215,240,118,187,196, 90,223,155,174,174,174, 91,239,220,
+185,211,178,109,219,182, 91,  0,240,222,209,253,206,  4,208,  2,102,205,200,241, 94,206,187,189,159,159,159, 19,159,207, 71,183,
+110,221,  0,160,115,125, 52, 57, 28,206,160,121,243,230, 53,250,230,155,111,184, 41, 41, 41,184,116,233, 18,238,222,189, 11,131,
+193,128, 73,147, 38,241, 70,143, 30,221, 80, 34,145, 12,170, 85, 62, 89,210,125, 51, 62,253,172,231, 23,211,199, 73, 34, 18,116,
+216,126, 33,  1, 71,110,165, 32,173,144,139,190,131, 70,203,122,132, 12,233,193,229,201,246,213, 86,243,203, 57,115,122,142,255,
+100,184,228,113,138,  9,199,110,171,113,251,105, 14, 12,108, 11,244, 30,244, 31,121,243,118, 61,251,176,192,222,241,190,207,209,
+ 47, 64,235, 25, 51,102, 88,207, 94,185,251,134,125,203,  1,107,211,179,208,161,188,241,113,  7, 44, 44, 69,162,  1, 79, 59,117,
+ 26, 39, 40,153, 47,182, 90,205,183,244,252, 67,214,165,101,161, 99,249,246, 89, 29, 45,225, 86, 90,173,200, 60,183,237, 27,  6,
+161, 48,125,132,253, 91,229, 64,165,249,252, 29, 24, 60,227,179,207,216, 50,185, 28,161,161,161,208, 20, 20,188,213,102,182,171,
+ 19,122, 94, 16,178,146, 26,122, 57, 62,  9,116,161,174,253,  3,223, 87,198, 87, 25,209, 58,113,226,  4,  9, 14, 14,166,  0,224,
+208, 19,100, 13,242,198, 15, 67,166, 46,153, 71, 49, 40,210,192,183,237, 99,135, 70, 62,  5, 86, 86, 86, 40, 44, 44,132, 70,163,
+  1,135,195, 65,113,113, 49, 18, 18, 18,112,251,246,109,200,229,242, 90,229, 36, 55, 55, 23, 98,177, 24, 98,177,248,157,104,206,
+253,184, 27,239, 85, 98, 58,239,236,237,223, 59,253, 52,249,191,173, 27,181,232, 28,217,117,200,244, 40,169,181,125,113,100,100,
+ 36,110,222,188,137,172,172, 44,  4,  4,  4,252, 83, 78,230,221,210, 54, 89,119,  1,200, 27, 55,110,236,120,246,194, 85,121,126,
+177, 73, 26,151,170,103,155, 76, 38,  8,133,118,134,253,135,142,229, 12, 30,212,151, 82,171,213,105,  0,238,150,154,219,154,230,
+ 84,228,  3,240,252,240,195, 15,191,156, 60,121, 50, 94,190,124,137,113,227,198, 21,221,189,123, 55,179,109,219,182, 86,191,252,
+242,139, 96,230,204,153,184,114,229,202,130, 19, 39, 78,252,  6, 32, 22, 64,165,115,181, 17, 66, 56, 28, 14,  7,134, 82,219,160,
+ 51,154,222,248,251,220,220, 92,144,162, 44,112, 56, 28, 38,  0,107,152,217,142,206,100, 50,113,216,108,246, 27,147,149,144,154,
+139,132,180, 66,228,230,107, 81, 84,100,128,182,136,128, 41,180, 98,  1,113, 74,  0,113,230, 70, 71,248,124, 62, 12,  6,  3,242,
+242, 74,178, 81, 22, 41,211,106,181,200,201,201,  1,147,201, 20,  3,144,  2,120,109,142, 96,105, 35,247, 35,165,213,128,184,183,
+187,159,226,197,201,185,111,165, 73, 69, 44,253,161,153,222, 76, 43,199,230,215, 91, 12,222,225,245, 38,237,253,182,207,226, 89,
+ 91, 91, 95, 62,120,240,160,183,155,155, 27, 98, 99, 99,189, 62,250,232,163,128,148,148,148, 22,168,253,156,140, 66,  6,131,241,
+195,232,209,163, 39, 15, 27, 54,140,114,119,119,  7,139,197,130,193, 96,112,124,249,242,101,224,129,  3,  7,230,108,221,186,245,
+ 23,163,209, 56, 11,230,183,251, 99,112,185,220,253,155, 54,109,234, 24, 16, 16,128,157, 59,119,226,238,221,187,166,150, 45, 91,
+ 50, 70,141, 26,  5, 23, 23,151,128, 81,163, 70, 29,209,104, 52,189,235, 24,217,114,105,211,166,141, 19,147,201, 68,219,182,109,
+ 57, 55,111,222,244,  3,112,179,158,199, 84,236,232,232,120,165,115,231,206, 45, 46, 92,184, 16,174, 86,171, 59,215, 98,127,  1,
+ 32,196,222,222,126,185, 76, 38,147,215,162,140, 45, 76, 78, 78,254, 28,192, 33, 51, 55,105,237,239,239,143,248,248,120,120,122,
+122,130,195,225,180,209,233,116, 19,  0,244,  4,240, 53,128, 39,181,200,175,123,215,174, 93,157, 58,119,238, 76, 29, 58,116,232,
+ 77,251, 80,  6,131,  1,131,193,  0, 14,135,131,214,173, 91, 51,194,194,194, 28,238,221,187,231, 14, 51,170, 17,173, 26,117,238,
+219,182,125,167,246, 29,  3,154, 49, 86, 29,122,  1,163,201,  8, 38,101,  0,139, 50,193,164,231,129,199, 97,194,221,247,  3,230,
+211, 71, 17,  1, 90,141,174,111,230,243, 11,199,205,209,236, 25,212,189,131,183,167, 59,227,167, 35,175,144,157,252,196,152, 28,
+125, 53,131,193,100,192,219,191,139,194,221,167,  5,179, 69, 64,103,182, 42,246, 81, 96,113,113,199,110, 89, 47,175, 94,120, 31,
+ 55,228, 66,128,233,232,160, 24, 16,220,189, 51, 39, 69,165, 42, 56,112,232,120, 84,161, 30,183,  1,224, 10, 64,245,  6,154, 53,
+109,213,170,211, 47,203,150, 89,217,217,217,177, 71, 14, 27,102,216, 28, 30, 30,142, 42,170,126, 23,  2, 76,133,173,109,183,137,
+ 19, 39, 50, 83, 84, 42,114,224,240,201,200, 50, 61,148,188,165, 52,109,230,232, 21,140,130,167,181,170,166,236, 11,112,149,182,
+182,222, 19, 38, 76,128, 90,165,194,206, 93,187,242,139,129, 91,101, 81,172, 99, 76,172,247,105,100, 59,102,246,127,250, 81, 78,
+118, 10, 76, 92,176,185, 77,160, 46,173, 17, 82,254,255,252,151,247, 34,127, 99,147, 53,190, 82,163, 85,145,255, 62,193,124,  9,
+  7,174,  7, 14,236,101,164,231,233, 10, 94,190,124,  9,133, 66,  1, 59, 59, 59,200,100, 50, 60,126,252, 24,151, 46, 93,194,179,
+103,207, 96, 50,153,208,188,121,243, 90,229, 38, 35, 35,  3, 17, 17, 17,144,203,229,239, 76,179,145,147, 53,166, 58, 89,115, 82,
+ 51,115, 57, 23,238, 62, 11,216, 60,119,144, 15,195,107,208,214,242,147,196,106,181, 90,252, 67,120,211,187,208,201,201,169,221,
+246,237,219, 57, 26,  3, 36,238, 19,110,173, 40, 40, 54,138,  0, 64,196,103, 22,132, 45,247,152,245,253,247,223, 23,124,242,201,
+ 39, 94,137,137,137, 75,205,136,245, 47,238,218,181,235, 23,132, 16,246,140, 25, 51,  0,  0,163, 71,143,206,189,125,251,182, 59,
+128,180, 75,151, 46,217,143, 29, 59,246,249,229,203,151,133,159,125,246, 25,211, 96, 48, 60,102,177, 88,228,196,137, 19,223,  1,
+248,246, 15, 79, 68,  6,227,126,120,120,120,  3,123, 23, 15,184, 88, 49,208, 97,222,179,146,  2, 78,104, 66, 82,220, 43, 68, 71,
+222,133,173,173,173,204,206,206,238, 73, 82, 82,146, 46, 57, 57,121, 78, 65, 65,193,134, 26,242,248, 48, 44, 44,204,206,197,197,
+  5,249,249,249, 72, 74, 47,196,244,195, 66,228, 22,149,  4, 49,216, 40, 66, 11, 39, 15,137,128,161,189,155,150,150,166,211,106,
+181,223,228,228,228,108,175, 78,147,205,102,103, 70, 70, 70,138,157,157,157, 81, 92, 92, 76, 94,191,126, 77, 21, 20, 20, 32, 47,
+ 47,143, 58,121,242,100,255,148,148,148,150,174,174,174,148,163,163,227,119, 41, 41, 41, 69,201,201,201,227,204,169,154, 44, 53,
+ 76, 70, 22,139,181,106,252,248,241,131,127,251,237,183,251,135,190,245, 14, 41, 87, 93, 34,243,245,245, 61,219,172,153,143,253,
+174,149, 77,215,  2, 88,241, 23,184,182,198,124,245,213, 87,222,150,150,150,152, 56,113, 34, 22, 46, 92,136,249,243,231,187, 77,
+156, 56,113, 60,128, 31,107,161, 35,176,181,181,189,247,211, 79, 63,121,181,107,215, 14,167, 78,157,194,222,189,123, 17, 19, 19,
+ 99,112,117,117,101,  5,  4,  4, 96,193,130,  5,232,209,163,199,184,105,211,166,117, 82,169, 84,126,102,154,143, 79, 22, 44, 88,
+ 16,210,190,125,123,124,252,241,199,154,223,127,255,125, 48,128,115,231,207,159,239,114,229,202,149, 67,187,119,239, 22, 44, 89,
+178,164,219,204,153, 51, 39,  2, 88, 87,135,253,239,223,177, 99,201, 28,202,237,219,183,199,242,229,203,123,212,211,104,113,173,
+172,172, 78,238,220,185,179,133,135,135,  7, 70,142, 28,233, 55,120,240,224,147, 89, 89, 89,221,  1,152, 85, 32, 57, 56, 56,252,
+112,244,232,209,198, 85,213, 44, 84,134, 70,163,177, 28, 48, 96,192,178,184,184,184, 90, 25,173, 61,123,246,224,243,207, 63, 71,
+243,230,205,155,181,110,221,122,227,132,  9, 19,240,225,135, 31,118,125,252,248,177, 18, 37,189,150,107,132,207,231, 55, 27, 58,
+116, 40,247,206,157, 59,  0,  0, 95, 95, 95,180,104,209,  2,155,104,178,222,  0,  0, 32,  0, 73, 68, 65, 84,241,241,241,184,127,
+255, 62, 52, 26, 13,148, 74, 37,  6, 14, 28,200,143,139,139,107,150,145,145, 81,163,209, 98,240,132, 99, 66,130,123, 75,142,221,
+ 78,129,209,100,192,  7,141,165,  8,240,178,193,211,164, 92,132, 61, 73,130, 81,203,129,212,210, 10,109, 58,  5, 89,170,147, 99,
+198,100,  2, 53,183,215,226,  9,199, 12, 12,233, 35, 62,118, 75,133,108, 85, 52,121,113,247,183, 75,250,226,130,113,  0,112,255,
+226,190,141,182, 86,130,238,238,254, 31, 48, 59,119,239, 39, 63,188, 87, 61, 38,235,127, 51,183,223, 31,184,226,132, 77, 46,236,
+140,209,179,135,119, 32,108,185,227, 93,137, 94,191,190,236,187, 30, 64,208,156,175,190,106,253,159,241,227,249, 38,147,  9,187,
+127,253, 53, 55, 34, 60,252,233,120,192, 52,161, 10,189,245,128,203,224,144, 16,158, 68, 42,197,167,211,167, 67,162,215, 95,126,
+115, 72,128,174,159,126,241, 69,187, 41, 83,166,  8, 54,126, 55,249,126,143,177,139,252, 77,132, 80,101,213,148,123,170, 15,197,
+181, 28, 27, 18,  2,137, 84,138, 25, 51,102,128,210,233,206,190, 49, 80, 44, 92,254,164,127,135,128,225,125,219,131,  2,133,189,
+ 39,174,227, 69,124,122,228,229, 20,188,250,187,186,170, 10, 84,217, 70,171,218,170,195, 60, 29, 82,187,246, 25,148,226,238,238,
+158,231,230,230,150,151,153,153,137,168,168, 40,100,101,101, 97,221,186,117,136,142,142,134,201,100,170,179,129, 49,153, 76,120,
+215,154,  0,160,180,146, 98,100,239, 86, 44, 77,113,  1, 63, 61, 61,253,173,234,163,127,144,209,122,131,193, 96,224,187,186,186,
+130,  1, 80, 57,133,122,177,122, 79, 71, 74,189,167, 35,149, 83,168, 23,107,181, 90,134, 88, 44,134, 70,163,225,155, 33,197,238,
+213,171,215, 23,191,253,246, 27,123,241,226,197,104,210,164,  9,116, 58, 29,110,223,190,157,  4, 32,173,116, 29,213,213,171, 87,
+ 85,101, 70,120,233,210,165, 56,124,248, 48,213,173, 91,183, 57,149, 93, 79, 41, 41, 41, 63, 76,152, 48,225,117, 97,222,107,108,
+ 26, 82,132, 67, 35,211,177, 45, 36,  6,195,172, 14,226,117,106,  2, 54,111,222,140,243,231, 47, 80,231,206,157,231,252,254,251,
+239,162, 62,125,250,172,117,112,112, 56, 81, 93, 38, 85, 42,213,226, 41, 83,166,100,231,229,229, 33, 47, 47, 15, 69, 69,197,120,
+ 93,  0, 68,174,246, 70,228,106,111, 20,155,  4,  8, 93,191,129, 17, 25, 25,169,136,137,137,177,239,219,183,239,106, 59, 59,187,
+173,213,105, 38, 39, 39,223,153, 58,117,106,113,110,110, 46,180, 90,173,206,104, 52,106,139,138,138,244,251,246,237,251,204,202,
+202,170,205,169, 83,167,216,231,207, 95, 96,253,254,251, 21,206,165, 75,151,100,129,129,129,251,149, 74,229, 14,115, 34,101, 76,
+ 38,115,205,174, 93,187,198,132,134,134, 42,  3,  2,  2,124, 42, 84, 69,217,117,239,222,189,193,175,191,254,234,176,124,249,242,
+ 57, 40,233,128,242, 94, 81, 40, 20,211, 66, 66, 66, 16, 26, 26,138,227,199,143,207, 92,187,118, 45,122,245,234,  5,123,123,251,
+169, 48,191,218, 11,  0, 86,252,248,227,143, 94, 94, 94, 94, 24, 61,122,180,118,220,184,113,179,182,111,223,238,122,237,218, 53,
+206,142, 29, 59, 26, 76,156, 56,113,198,240,225,195,139, 27, 54,108,136,117,235,214, 53,102, 48, 24,107,204,186,191,149,202,207,
+134, 13, 27,134,149, 43, 87,226,247,223,127, 31,132,146,  7,170, 22,192,233, 27, 55,110,244, 93,178,100,  9,  6, 13, 26,  4, 71,
+ 71,199, 25,117,137, 60,121,123,123,127,211,179,103, 79, 92,187,118, 13,126,126,126,104,211,166,205, 76,  0,138, 58, 30, 78,134,
+ 88, 44,222,191,125,251,246, 14, 13, 26, 52,192,162, 69,139,208,168, 81, 35,108,221,186,181,131, 72, 36,218, 15, 51,155,111,200,
+100, 50,177, 80, 40,196,156, 57,115,200,160, 65,131, 94,215,180,204,156, 57,147,240,120, 60,200,229,114,115, 59,190,  8,248,124,
+126,219, 38, 77,154,224,246,237,219, 56,127,254, 60,230,205,155,135,207, 62,251, 12,233,233,233, 24, 58,116,168, 16,192,135,181,
+216,111, 27,107,107,107,228,230,150,204, 11,223,164, 73, 19, 60,120,240,  0,233,233,233,112,116,116,132, 90,173,134,149,149, 21,
+ 60, 60, 60, 96, 50,153,108,204,147, 36, 77, 20,150, 50,164,101,105,192,130,  1,254,238, 10, 92,142,202, 68, 66,186, 22, 54, 86,
+ 22, 80,167,165,195,193,138, 15, 39, 39,103, 16, 98,106, 98,150,  3,102, 50,252,121,124,  1, 94,231,233,144,252,228,247, 76,157,
+ 81, 51, 33, 59,246, 70, 98,118,236,141, 68,157,166,120,194,253,235,231, 51, 27, 40,  5,112,114,114,  2, 69, 76,173,222,199,253,
+248,145, 51,156, 68,  2,214,232,243,219,190,161, 78,252, 50,151,210,100, 38,180,236,169, 44,137, 44, 91,  3,174, 31, 13, 29,218,
+118,214,172, 89,252,212,212, 84,211,240, 33, 67, 94, 47,254,246,219, 11,103,106,120, 49,200,  7,220,186,119,239, 14,  6,128, 51,
+231,206, 21,168,129, 36,  0, 80,  2, 78,253,  6, 12,232,248,213,151, 95, 10, 50, 50, 51, 77,183, 95,230, 31,139, 78, 35,  3, 45,
+141,112, 53,167,125,150, 17,104, 90,166,123,246,236, 89, 82,  4,220,  7,128,206, 78,152, 26,212,206, 55, 96, 84, 72, 71,164,164,
+101, 97,198,226,109,216,120,224,202, 89,153,158,116,249,  7, 61,138,199,215,201,104,149, 86,253,252, 33,173,176,240,143,181,  7,
+245, 53, 48,127,134,102,101,252, 19,141, 86, 25,122,125, 73, 45,137, 86,111,130, 86,111, 42,123,171, 69, 81, 81,145,217, 18,103,
+207,158,221, 57,125,250,116,172, 94,189, 26,207,159, 63,  7,135,195, 65,147, 38, 77,236,  0,136,203,202,124,127,127,127, 27,  6,
+131,129,167, 79,159, 98,213,170, 85,248,228,147, 79,200,205,155, 55,183,162,242,241, 82, 30,188,126,253,122,253,132,113,159,100,
+103,165, 38, 64, 95,148,133,180,228, 87,208, 20,100, 99,209,210, 31, 80,168,103, 65,157,163,131, 58, 71,  7,  6,207, 18, 27,127,
+217,206,244,246,246,238,201,100, 50,131,171,201,231,237,212,212,212, 95, 38, 77,154,148,173, 86,171,223,236,159, 86, 79,160,213,
+191,125,189, 10,133, 66,172, 89,179, 70,230,238,238, 30,194, 98,177,  2,171,209, 76, 73, 76, 76,140,158, 52,105,146, 54, 53, 53,
+ 21, 57, 57, 57, 56,118,236, 88,223,  6, 13, 26,200,151,173, 88, 77, 21,232, 88, 80,103,235,160,206,214,129, 43,182,193,254, 67,
+191, 49, 61, 60, 60,134,179, 88,172, 54, 53,153,172,221,187,119,143, 26, 50,100,136,100,197,138, 21,175,143, 30, 61, 26, 10,160,
+252,  9,121,186,102,205,154,  3,251,247,239,207,251,226,139, 47, 44,151, 47, 95, 62,243, 61,155,173,192, 33, 67,134,120,154, 76,
+ 38, 28, 60,120, 48, 18,192,143,191,253,246,219, 61,141, 70,131,161, 67,135,186,150, 86, 35,153, 67,203,225,195,135, 79,238,208,
+161,  3, 62,253,244, 83,221,133, 11, 23,252,  1,172, 70, 73, 85, 46,  1, 16, 15, 96,237,149, 43, 87,154, 79,155, 54, 77,211,170,
+ 85, 43,124,252,241,199,159,  0,232, 80,131,110,219, 97,195,134,121,153, 76, 38,236,219,183, 47,  2,192,169, 10,223, 95, 58,116,
+232,208,109,173, 86,139, 17, 35, 70, 52,  4, 80,155,130,156,195,227,241, 14,126,255,253,247, 22,201,201,201, 24, 53,106,148,230,
+233,211,167,248,246,219,111,  5, 50,153,236, 84,185,123,192,108,120, 60,222,230,159,127,254, 57,164,105,211,166,152, 52,105,146,
+118,195,134, 13,211, 39, 79,158,172,245,247,247, 71,104,104,104,  8,151,203,173,213, 20, 29, 42,149, 42,251,201,147, 39, 86, 53,
+ 45, 73, 73, 73,230,118,207, 23,138,197,226, 91,190,190,190,185, 77,154, 52,249,192, 96, 48,224,241,227,199,175,118,238,220,105,
+106,210,164,  9,214,175, 95,143,229,203,151, 35, 56, 56, 24, 76, 38,211,108,163,197,100, 50,161,211,233, 32, 20, 10,193, 98,177,
+240,234,213,171,178,161,101,192,225,112,  0,  0, 34,145,  8,  2,129,  0, 12,  6,195,172,222,104, 20,  5,146, 91,168,  7,155,205,
+  0,139, 97, 66,116,124, 14,116,122, 19,248, 28, 38,216, 44, 10, 32, 38, 88,136,216,224,115,153, 96, 80,148,201, 76, 77,228, 20,
+232,192,229, 48,192,230,112, 41,134,193, 40,120,243,112,100, 25,  5,  2,  1,151, 82, 72,121,224,115,254, 66,211,  2, 83, 37, 13,
+203,199,  0,108,145,179,243,224,149,171, 86,113,115,243,243, 49,104,208,160,215,113,247,238,237, 42,  2,238,117,170,161,147, 18,
+131,197,114,239,220,169, 19,194,194,195,145,151,149,245,  2, 40,105, 28,207,181,183, 31,178,102,205, 26,110, 81,113, 49,  6, 13,
+ 28,152,253,252,250,245,221,137,249, 56,177, 47,190,196,136,213,120,222, 57, 28,219, 50,221,156,172,172, 44,160,100,  8,  9,165,
+181,120,217,148,225, 61,144, 87, 88,140,217, 63,236, 50,133, 71,167, 76,189,150,132, 62,191,169,144,243, 15,123, 12,143,175,176,
+  0, 48, 99,192,210,178,232, 82, 77,102, 69,163,209,188,115,  3, 84, 95,205,202, 76, 98,125, 53,255,138,176, 88,172,226,103,207,
+158,113,165, 86,246, 38, 43,  9, 59,171,193, 39,215,101,  0, 96, 41,102,229,232,140,122,147, 74,165,  2,143,199, 43, 54,179,186,
+ 97,220,230,205,155, 23,  1,240, 97,177, 88, 39,182,111,223, 78,237,218,181, 75, 62,108,216,176,151, 79,158, 60, 73,246,245,245,
+117,217,190,125,187, 20,  0,214,174, 93, 75,246,239,223,223,  3, 37, 67,102, 84, 57,142, 75,106,106,234,183,153,153,153, 55,167,
+ 76,153,178,142,203,229,202, 69, 34,145,213,181,107,215,168, 98, 29, 65,203,175,226,223,244, 68,148, 10, 24,184, 58, 87,138,241,
+227,199, 51,159, 60,121,178, 52, 57, 57,249, 68, 53,154,115,178,179,179,175, 61,127,254,124,181,204,177,133,181,200,229, 43, 89,
+192,220,167,  0,  0, 23,  5, 27,140,210,114, 49, 59, 59, 27,233,233,233,152, 60,121,178,252,229,203,151,115,146,147,147, 47, 87,
+ 19,213,186,146,145,145,145,244,232,209,163,206,108, 54,155, 43, 18,137, 90,222,186,117,139, 42,214,154,208,108, 78, 60, 94,231,
+151,228,211, 82,204,194,253,239,149,152, 58,117, 42,235,197,139, 23, 63,164,164,164,180,175,180, 48, 99, 48,150,151, 55, 89,179,
+103,207,126,  8,160, 33,128,183,170, 70,141, 70, 35, 53, 98,196,136, 40,  0, 77,190,248,226, 11, 75, 66,200,204, 57,115,230,188,
+  6,176,233,127,125, 45, 73,165,210,101, 19, 38, 76,192,254,253,251,145,149,149,181,  6,  0,114,115,115,127,220,179,103,207,190,
+113,227,198,225,215, 95,127, 93,150,158,158,126,  6, 53,119,213,238, 53,116,232, 80,156, 62,125, 26, 23, 47, 94,252,  6,192,227,
+ 42,214,123,126,237,218,181, 57, 71,143, 30,253,105,216,176, 97,216,182,109, 91, 79,  0,213, 53,144,237,222,163, 71, 15,156, 58,
+117, 10,153,153,153,161,149,173,144,157,157,189,225,216,177, 99,173,123,244,232,129,165, 75,151,118,  7,112,201,140, 93,247,146,
+201,100,219,127,250,233,167,150, 77,155, 54,197,240,225,195,139,117, 58, 93,207, 47,190,248,226,248,222,189,123, 37, 59,119,238,
+252, 96,252,248,241,119, 74,199,124,187,109, 86, 40,139,193, 88,178,106,213,170,177,157, 59,119,198,204,153, 51, 13,103,207,158,
+237,  7,224,220,153, 51,103, 94,206,158, 61,251,228,170, 85,171,152, 43, 87,174, 28, 59, 99,198,140,116,147,201,244,190,204,245,
+247,107,215,174,109, 29, 20, 20,132, 87,175, 94,225,246,237,219,208,233,116,191,222,186,117,235,170,155,155,219,247, 90,173,246,
+184, 72, 36, 26, 45,145, 72,124, 91,180,104,209,229,254,253,251, 66,152,215, 78, 47, 53, 54, 54,214, 66, 38,147,193, 96, 48, 32,
+ 50, 50, 18,206,206,206,208,233,116,136,137,137, 65,211,166, 77,193,225,112,144,154,154,138,114,209,242, 26, 76, 17, 35,242,101,
+156,170,161,165, 68,  4, 24,249,120,240, 52,  9,214, 10, 57,140, 20,  3,106,117, 10, 90,120, 58,130,162, 40,100,103,170, 65, 81,
+ 84,148, 57,154, 70, 98, 10, 75, 80,165, 57, 88, 73,120,104,218, 58,200,234,214,153,244, 93,210,134,237,198,179,152, 20,147,203,
+ 19,111, 26,251,241,199, 10,147,137, 32, 59, 51, 21, 44,  6,227,238,251, 56, 65,  7, 19,144,216,169, 17,255, 65,208,216, 69, 45,
+ 40,  2, 82,164,195,206,109,169,200, 18,  2, 45,214,126,253,181,133,149, 66,129,225,195,135,155, 50,147,147, 47, 20,154, 57,176,
+114, 67, 55, 55,165, 88, 34,193,141, 27, 55,192, 44,105, 99,139,173,128,215,242,217,179,173,108,108,109,241,201,216,177,166,212,
+132,132, 75, 69,128,170, 54,121,109,216,168, 17,187, 76,151, 81,170,155,194,196,244, 47,250,117,224,137,  4, 60, 44,217,248, 27,
+ 18, 51, 10,246,221, 74,193,198,127,104,188, 99,115,181, 17,173,170, 26,159,149, 52,170, 22, 86,107, 86,248,124,254,155,104, 74,
+ 45,222,244,222,185,102, 77,252, 25,154,239,145,185,  0,142,  2,152,155,152,152, 24, 61,118,236, 88,157, 65,167,201,187,185,168,
+225,151,225, 75, 27, 76,186,245,173,221,164, 35,211,101, 95, 22,230,188,206, 91,187,118,173, 62, 49, 49, 49,186,252, 54, 53,104,
+ 39,  0, 56,181, 99,199,142, 13,  7, 15, 30, 68,147, 38, 77,240,248,241, 99,155,130,130,  2,191,168,168, 40, 75, 47, 47, 47,236,
+218,181, 11,251,247,239, 95, 13,224,124,117, 38,171, 12,131,193,112, 65,173, 86,123,196,199,199, 55,182,176,176,208, 91, 88, 88,
+160, 98, 79,196,220, 34, 19, 50,179,115, 96,105,105,  5,169, 84,234,106,134, 57, 63,165, 86,171,221, 77,114,207,142,238, 25,107,
+114,194,150, 56, 33,108,137, 19, 78,205,177,135,157,  5, 23, 89, 89, 89, 72, 79, 79, 71,122,122, 58, 40,138,130, 94,175,247, 54,
+ 67, 51, 38, 37, 37,101, 75, 66, 66,194, 81,165, 82,  9,137, 68,  2,  2, 64,157,173,199,195,149, 94,120,184,210, 11,234,108, 61,
+114,243,242,208,160, 65,  3, 72, 36,146,170,170, 40, 24, 14, 14, 14,189,135, 12, 25, 34,  1,128, 82,  3,213,149, 16, 50,169,146,
+101,162,193, 96,104, 87,182,238,231,159,127,110,  9,160,199,255,248,122, 98,  2,152, 50,110,220,184, 15,248,124, 62,214,175, 95,
+ 31,  3, 96,119, 89, 89,191, 97,195,134,167,  0, 48,125,250,116, 95,  0, 51, 81,197, 72,208,111, 66, 67, 28,142,191,183,183, 55,
+110,221,186,  5,  0,191,213,240,219,135,110,222,188,  9, 55, 55, 55,240,249,252,150, 53,172,235,234,228,228,132,167, 79,159,  2,
+192,131, 42,214,121,240,244,233,211,146,234, 30,138,114, 53, 99,223, 67,130,130,130, 34, 47, 95,190,220,178,109,219,182, 24, 59,
+118,172,246,206,157, 59,189,  1, 92,125,240,224, 65,224,136, 17, 35, 10,220,221,221,113,229,202, 21,175, 17, 35, 70,220,100, 48,
+ 24,139,204,208,252,228,187,239,190,155,219,191,127,127,124,247,221,119,228,192,129,  3,195,  1,156, 43,253,238,236,190,125,251,
+ 70, 45, 94,188,152, 12, 28, 56, 16, 11, 23, 46,156, 11, 96, 82,117, 98,  5,  5,  5, 57, 70,163, 17,  5,  5,  5,102,133,228,205,
+ 93, 95,161, 80,244, 10, 10, 10,194,188,121,243,224,224,224,128,227,199,143, 19,  0, 39,  0, 92,211,106,181, 29,  1,172, 42, 40,
+ 40, 56,114,235,214, 45,116,239,222,157,131,183,167, 24,169,238,247, 35,247,236,217,163,145,201,100,112,113,113, 65,195,134, 13,
+161, 86,171, 17, 23, 23,135,166, 77,155,194,223,223, 31,  6,131,  1, 91,182,108, 41,206,203,203, 51,107, 76, 62,131,182, 96,231,
+249,147,135,115,172, 36, 60, 56,218,200,208,192,193, 18,249,217, 25, 72, 87,171,224,239,237,140, 78,254, 13,144,145,163,197,217,
+ 19,135,179,242,242, 10,119,154, 21,194,215, 20,110,191,112,230,120,142, 92,194,129,135,167, 47, 70,140,157,222,162,133, 95,192,
+249, 86,173,218,157, 93,177,108, 73,179,174,109,188,169,164,140, 98,156, 62,241, 91, 86, 78,110,238,246,247, 81,208, 47,  4,152,
+197, 50,247,171,161, 71,195,182,248,244, 28,183, 37, 58,  9,107,  0, 64,207,100,122,245,238,213, 11, 73, 73, 73, 56,124,240, 96,
+ 74, 33, 16, 97,174,158, 64, 32, 96,  0, 64, 78, 78, 14,120,165,237,238, 12,128,103,159, 62,125,144,158,145,129, 61,187,119,167,
+159,  6,194,107,147,207,190,  0, 87, 40, 40,  9,  8,230,228,228,128,  2,114,  1,128, 98,161,119,171, 38,110, 72,127,157,139,203,
+119,163,243, 27, 20, 97,114,117, 58,127,227,134,240,117,107,163,  5, 32, 99,230,204,153,224,241,120,176,179,179,123, 99,142,202,
+204, 10,151,203,133,157,157, 29, 12,  6,  3,246,237,219,  7,  0, 25,213,190,225,  1,154,126,147,150,154, 52,122, 82,200,102,179,
+223,137,102,233,155,163,102,208,236,109,166, 51, 55, 43,239, 20, 83, 23,205,191,  1,173, 74,199,196,106,  5, 32, 43, 46, 46, 46,
+105,240,160,126, 57,241, 47, 31,169, 11,178, 85, 41,185,153,137, 41,137, 49, 81,234,175,230,204,204, 73, 74, 74, 74, 68,201, 88,
+ 90,173, 84, 42, 85,217, 54,230, 48,115,240,224,193, 63,143, 27, 55,142, 60,124,248, 16,  0, 16, 22, 22,134,143, 63,254,152,140,
+ 26, 53,106, 13,128, 47,235,144,239,130,162,162,162,183,162, 33, 58,163,233, 77,149, 95,110,110, 46, 84, 42, 21,180, 90,173,217,
+142,248,249,217,149,207, 94,199,221,215,251,186,136,224,235, 34,130,151,147, 16,148, 33,255,141,201, 74, 79, 79, 47,123,115, 46,
+174, 69, 62,115, 53, 26,205, 91,249, 44, 95, 53,153,155,155, 11,181, 90, 13,163,209, 88,213,131,204,148,156,156,124,118,255,254,
+253,121,  0,176, 98,197,138,215, 20, 69, 93,164, 40,234,231, 74,150,141, 44, 22,235, 70,217,186, 43, 87,174,124,141, 63, 86,137,
+253,153,244,111,218,180,105,214,220,185,115,215,207,152, 49,  3, 27, 55,110, 68, 74, 74,202,151,248,255,177,120, 76, 25, 25, 25,
+179, 67, 67, 67, 49,102,204, 24,204,159, 63,127,165,159,159, 95, 46,128, 17, 85,  9, 90, 91, 91, 59,178, 88, 44,132,135,135,231,
+  2,120, 85,195,239,171,195,195,195, 83, 41,138,130,157,157, 93,163,234, 86,180,180,180,108, 44,145, 72,144,156,156, 12,148,190,
+ 49, 87, 66,156, 74,165, 34, 92, 46, 23,246,246,246,110, 53,237,188, 92, 46,159,189,101,203, 22,214,163, 71,143,208,181,107,215,
+164, 43, 87,174,116,  7, 80,214, 37, 61, 60, 44, 44,172, 67, 96, 96,224,179,243,231,207,227,135, 31,126,160,154, 55,111, 62,169,
+ 38, 77, 23, 23,151,137,159,124,242,  9,214,173, 91,135, 77,155, 54, 77,  2,112,176,194, 42,123, 67, 67, 67,167,111,218,180,  9,
+ 99,199,142,133,171,171,235,136,234,244,226,227,227,231,116,238,220, 57,236,249,243,231,102,205,120, 96,230,250,129,  1,  1,  1,
+141,139,138,138,176,125,251,246, 87,141, 27, 55,190,119,240,224,193,153,248,227,  3,251,200,225,195,135, 49,114,228, 72, 52,111,
+222,124, 59,128, 97,230,220,150, 79,158, 60, 73,188,116,233,146,137,195,225,192,197,197,  5,193,193,193, 24, 62,124, 56,154, 53,
+107,  6,157, 78,135,195,135, 15,155,162,162,162,146,180, 90,173, 89, 99, 41,101, 62,255,253,120,108,236,179, 27,225,119,174,234,
+ 89, 76,  6,156,237, 44, 49,160, 91, 11,252,231,195,118,240,247,114, 64,124, 90, 17, 46, 93, 58,175,143,141,125,117,203,156, 30,
+135,101,154,209,143, 35,110, 62, 10,191,110, 96,179, 40,120,121,186, 99,222, 87,179,229,139, 23,204,177,112,111,228,140,136,152,
+ 28,156, 63,119, 90,175, 74, 74,188,252,190,122, 28, 94,  1, 56, 98, 30, 37, 98, 50, 24, 48, 50,120,  5,204,210,142, 52, 77,124,
+124, 60,148,182,182, 56,121,242, 36, 24,181,232, 17,122,  5,224,136,197, 37,181,224,249,249,249, 40,211,107,236,233,233,233,236,
+226,130, 83, 39, 79,130,105, 50, 61,233, 84,203,  1, 70,159,150, 84, 67,191,209,165,128,226,201, 78,144, 52,118,178,241,148,203,
+ 68,184, 19,241,  2, 26, 61,185,187, 59, 11,239,117, 60,178, 63,145,241,168, 99,213,225,138,141, 27, 55,182,218,178,101, 75,247,
+153, 51,103,138, 71,143, 30, 13, 62,159,143,194,194, 66, 56, 58, 58,194,104, 52,226,204,153, 51,184,127,255,126,190,201,100, 58,
+143, 63, 14, 27,208, 13,229,122,105,156,125,  5, 65,137,223, 42,108,117,244,163,143,222,137, 38,  0,136, 95,152,164,153, 13,180,
+187,214, 30,188, 62,112,207,217,112,234,211, 97,157, 24,254,158, 78,  0,  0,165, 82,  9,169, 84, 90,107,205,119,192,159,174, 89,
+190, 90, 87,173, 86, 63, 85,171,213,105,227,198,141,243, 42,107,248,206,227,241,138, 75, 35, 89, 89,149,109, 99, 70, 62,117,  0,
+ 38,111,217,178,229, 88, 78, 78,206,217, 47,190,248,  2,139, 23, 47,198,241,227,199, 59,  0,184, 81,199,125, 55,102,101,101,101,
+223,189,123, 87,233,230,237,135,134, 54,108,116,252,230, 57,  8, 33,176, 18, 18,228,101,191,198,131,  7,225,200,203,203,187, 83,
+155,124,234,116,186,236,180,180, 52,133,141,141, 13, 94,191,126,141,140,140,140, 55, 38, 43, 43, 43, 11,175, 95,191, 38, 20,245,
+135, 49, 91,170,211, 44, 72, 75, 75, 43,140,142,142,230, 42,157,220,208,200,134,131,128,175,158,  2,132,192,217,146,129,188,220,
+108,220,186,117, 11, 57, 57, 57,191, 87,165,105, 50,153,102,141, 24, 49,130,  9, 96,212, 23, 95,124, 97,  9,160,249,236,217,179,
+207,163, 66,207, 66, 22,139,245,227,174, 93,187,154,148, 85, 49,206,153, 51,103, 53,128, 45,255,171,107,201,202,202,106,214,201,
+147, 39, 37, 58,157, 14,107,215,174,197,234,213,171,183,226,143,  3, 85,158, 92,191,126,125, 40,131,193,152, 50,117,234, 84, 76,
+152, 48, 65,248,193,  7, 31,204, 76, 73, 73,217, 93,153,102,114,114,242, 60,127,127,255,249,105,105,105, 75,204, 50,203,207,159,
+143,247,247,247,159,151,150,150,182,188,186,115, 36, 18,137, 68, 70,163, 17,177,177,177, 89, 64,149,237, 59,138, 99, 99, 99,147,
+141, 70,163,163, 80, 40,180,172,233,250,204,202,202, 90,242,193,  7, 31,124,155,154,154,122, 14,192,162, 74, 12,249,195,148,148,
+ 20,223, 25, 51,102, 76, 91,182,108,217, 64,181, 90,189,175, 38,205,248,248,248, 37,129,129,129,223, 60,123,246,108,  7,170,174,
+  2, 94,191,112,225, 66,221,174, 93,187, 38,197,198,198, 46,173, 65,243, 68, 70, 70,198,137, 90,156,223,170,214,127,163,201,100,
+ 50,103, 47, 91,182,140,177,113,227, 70, 16, 66, 86, 26,141,198,170,242, 25,113,228,200,145,157,237,218,181, 27,125,240,224, 65,
+190,175,175,239,  4,141, 70,179,183,166,235,179,176,176,240,240,193,131,  7,  7, 70, 68, 68, 56,142, 30, 61,154,239,225,225,  1,
+157, 78,135,148,148, 20,108,220,184,177, 56, 42, 42, 42, 41, 59, 59,251,112,109,202, 16,131, 54,119,216,205, 75, 71,247,198, 61,
+143,106,211,185,103,136, 92,171,115,  4, 47,147,137,236, 76, 53,206,156, 56,156, 21, 27,251,234, 86, 97, 97,246,176,218,104,234,
+ 52, 57, 67,111, 93, 62,182, 47, 41, 54,186,117,199,192,222,242, 98,173, 11,120, 28,  6, 50, 83,147,113,230,228,209,215,177,177,
+ 49,215,138,245,154,143,223, 87, 57,207,116,197, 34,166,250,254,184,137,125, 91, 64, 32,119,124,192,  6,214,182,  3,  4, 10,165,
+146, 83,122,239, 64, 92,210,230,209, 44,205, 84,128,235, 86, 90, 75, 85, 88, 88,  8, 54,160, 29,  3,176,173,173,173,  5,  0,240,
+236,217, 51,  8, 75,106, 53,106,149,207,124, 64, 36, 44,167,203,  0, 10, 51, 89,112,104, 44, 21, 81,  0,144,164,206,132, 86, 95,
+237,115,227,239,206,230,114,134,107,115, 93,  4, 56,  0,186,137,197,226,197,243,231,207, 95,121,231,206,157,149,193,193,193, 43,
+121, 60,222,226,210,131,205,169,230, 68,252,207, 52, 91,218,195, 50,176, 17,117, 53,168, 49,101,154,216, 65,110,252, 56, 64,164,
+237,210,165, 75,104, 61,243, 89,159,155,229,207,212, 60,170,215,235,  9, 74,170,237,142,162,234, 42,193,185,229,190, 87, 39, 36,
+ 36,144,210,191,107,147, 79,197,144, 33, 67, 76,121,121,121,100,240,224,193,  4, 53, 79,225, 83,173, 38,143,199, 11,236,216,177,
+163, 62, 53,253, 53,121, 26,147, 76,110,135, 61, 38,103, 47,221, 36,251, 14,159, 36,235, 66, 55,145,102,205,154,105,  1,184,212,
+ 70,147,197, 98,117,  9, 12, 12,204, 76, 77, 77, 37,209,209,209,228,234,213,171,228,208,161, 67,100,211,166, 77,228,231,159,127,
+ 38, 78, 78, 78,169,  0,148,181,209, 20,  8,  4, 33,189,122,245,210,103,231, 22,146,216,228, 76, 18, 25, 29, 75,110,220,141, 36,
+103, 46,221, 32,187,247, 30, 36, 62, 62, 62,197,102,104, 50,153, 76,230,186,125,251,246,229, 18, 66, 72, 72, 72, 72, 18,222, 30,
+ 72,181,225,172, 89,179,210,  8, 33,100,249,242,229,153,168,188, 33,252,159,125, 45,245,116,112,112,120,202,225,112, 78,  2, 24,
+ 85,195,118, 67, 89, 44,214,113, 91, 91,219,123,  0,  6,188,135,251, 40,216,198,198,230, 54,128,154,102, 56, 40, 91,175,255, 63,
+228,126,255, 51, 52,187,176, 88,172,171, 64,245,147,  8,151, 43,175,191,103, 50,153,167,  0,116,173,101, 62,221, 21, 10,197, 96,
+185, 92,254,169, 92, 46,255,212,198,198,102, 48,151,203,117,175,207,190, 91,185,119,235,235,236,215,239,136, 83,243, 62,241,206,
+ 45,130,227, 93,253, 67,142, 88,185,119,235, 91, 95, 77, 23,255,144,163,206, 45,130, 19,156, 91,244,141,107,216, 50,228,136,194,
+179, 91,175,247,121,142, 70, 57,192,190,123, 67, 24,200,213,111,  8,185,250, 13,233,214, 16,166, 54, 22,240,105,  5, 72,122,116,
+235,182,138, 24,141,171,  6,246,239,191,202, 13,176, 34,  0,179,226, 82,153,166, 31, 32,125,179,109, 72,200,170, 70,128,162, 59,
+ 32,236,212,161,195, 74, 98, 52,174, 26, 49,116,232, 42,103,192,182, 50,189,170, 52,  9,192,116,  0,236,203,235, 42,128,198, 31,
+186,194,119,110, 95, 87, 66,174,126, 67, 22,126,228, 65,252,149, 24, 85,131,102, 85,145,162,191,117, 68,171,182,136, 74, 11,215,
+165,165,159,162,119,112, 17,190,115,205,214,118,240,232,214,152,138,238,237,201,122,141,146, 46,201,162,127, 96, 33,185, 67,171,
+213,146,226,226, 98, 82, 88, 88, 72,242,243,243, 43, 26,168, 55,134, 76,165, 82,145,164,164, 36,146,144,144, 64,226,226,226,  8,
+254,191,237,141,217,249,148, 74,165, 91, 62,250,232, 35, 35,155,205, 94,247, 46,246,221,210,210,114,105, 64, 64,128,238,167,159,
+126, 34, 71,142, 28, 33,191,252,242, 11,153, 58,117, 42,105,210,164,137,198,194,194, 98, 88, 93, 52,109,109,109,231,121,122,122,
+102,110,221,186,149,236,222,189,155,172, 89,179,134,124,253,245,215, 70, 71, 71, 71,181, 68, 34,233, 81, 23, 77, 27, 27,155,205,
+237,219,183,215,109,222,188,153,156, 63,127,158,236,217,179,135,204,154, 53,139,120,121,121,105, 68, 34,209, 32, 51, 53,153, 44,
+ 22,107,213,196,137, 19,213,246,246,246, 39, 43,124, 39,244,241,241,185, 55, 98,196,  8, 21,128, 57,255,160,235,147,214,164, 53,
+105,205, 63,193,104, 13,183,135,  3,  1,152, 66, 14,103,104,167, 14, 29, 86,114,128,161,181, 53, 69,124, 38,243,195,118,  1,  1,
+ 43, 57,192,176,178,117,249, 76,230,135,157, 58,116, 88,201,102, 50, 71, 86,165, 87,157, 38,  1,152, 28, 22,107, 78,187, 54,109,
+ 86,177,128,175,202,210,186, 52,164,158,204,234,233, 68, 58,184, 80, 47, 70,218, 64,248, 15, 54, 90,239, 28,214,159,112, 17,254,
+ 93, 52,255, 42, 55,181, 91,169, 97, 58, 90,139,136,214, 81,148,204,162,238, 86,199,124, 10,222,241,190, 55, 85, 40, 20,167,221,
+220,220,210, 27, 52,104,160,146,203,229,123,  1, 56,214, 83,211,215,214,214,246, 87,165, 82,249,220,206,206, 46, 66,161, 80,252,
+136,146, 81,231,235,172,201,102,179,  3,148, 74,229,239,174,174,174,217, 46, 46, 46,169, 10,133, 98, 95, 37,145, 44,115, 52,237,
+ 80,121,161,194, 41,253,142,126,232,208,154,180, 38,173,249,150,129,  9,106,132,101,221, 27,194,208,189, 33,140, 65,174,248,177,
+188, 65,  9,  6,  4,117, 53, 69, 31,  3,188,138,235,215,164, 87,147, 38,  1,152,109,  1,113,197,109,122, 59,194,199, 76,205,191,
+123, 68,171,172,156,175,221,240, 14, 85, 96,248, 19, 50,249,119,209,252,171,240,  2,213, 52, 70, 46,199,210,119,248,155, 69,239,
+120, 31, 34, 51, 50, 50,122,101,100,188,211,190,  9,143,212,106,245,168,119, 41,168,215,235,239,164,166,166,118,126,  7, 82, 85,
+117,189,214,193,204,110,217, 52, 52, 52,255, 30, 40,192,136, 87,248,178,155, 59,214,178,140, 96,156,137, 65,114,133, 46,121, 69,
+ 84, 93, 52, 75, 48,238,168,164,140,167,234,154,207,255, 39,255, 15, 26, 73,120, 76,253,123, 78, 91, 10, 74,218,104,213,219,104,
+209,208,208,208,208,208,208,252, 15,184,240,156,126, 17,251, 27,112, 18,111, 71,223, 78,150, 51,162, 85,134, 62,107,211,147,162,
+ 46,225,211, 11,180, 38,173, 73,107,210,154,180, 38,173, 73,107,254,235, 52,203,168,106,238,212,167, 21,254,175, 83, 47,190,127,
+ 11,116, 61, 59,173, 73,107,210,154,180, 38,173, 73,107,210,154,255,116,234, 60,142, 22, 13, 13, 13, 13, 13, 13, 13, 13, 77,245,
+ 84, 25,117,163,141, 22, 13, 13, 13, 13, 13, 13, 13, 77,253,176, 67,201, 20, 85, 39,241,255, 83, 85,109,  6,106,158,130,231, 45,
+150, 45, 91,198,112,115,115, 19,115,185,220, 38,175, 94,189, 98, 76,158, 60,185,222, 29,  9, 86,254,184,142,225,226,226, 34,  6,
+208, 36, 51, 43,143,241,201,127,190,160,232,243, 69, 67, 67, 67, 67, 67, 67,243, 55,162, 79,169,177, 42,251,124, 19,225,170,149,
+209, 90,180,104, 17, 18, 18, 18, 68,  0,134,248,250,250,114, 55,108,216, 64, 14, 28, 56, 80, 47, 99,244,213,156, 89,136,143,143,
+ 23,  1, 24, 98,163,176,224,110,219,178,130, 28, 60,126,253,157,155, 45,133, 66, 97,245,191,220,142,134,134,134,134,134,134,230,
+ 95,197,248,114,159,227,235,100,180, 88, 44, 22,147,203,229, 54, 98, 48, 24,189,248,124,126, 75,  0, 40,157,146,165,206,176, 88,
+ 44, 38,151,199,107,196,100, 50,123,241,120, 37,154, 31,245,109, 95, 95,205,174, 34,145, 40, 81, 40, 20,222,  7, 32,144, 72, 36,
+225, 58,157,238,177, 68, 34,185, 89, 27, 29,137, 68,114,179,116,187,112,  0,  2,161, 80,120, 95, 36, 18, 37,178, 88,172,174,244,
+245, 68, 67, 67, 67, 67, 67, 67, 83,202,230, 74,150, 63,114,226,196,137, 42, 13, 14,151,203,101,248,250,250,182,119,113,113,185,
+225,237,237,173,117,116,116, 60, 36, 20, 10, 69,245,204, 24,195,205,195,171,189,189,157,242, 70,139, 70,118, 90, 27, 27,155, 67,
+108, 54,187, 62,154, 76,137, 68,178, 38, 40, 40, 40,231,198,141, 27, 68, 42,149,166,  2,176,176,182,182, 86, 17, 66,136,173,173,
+173,169, 54, 98,182,182,182, 38, 66,  8,177,182,182, 86,  1,176,144, 74,165,169, 55,110,220, 32, 65, 65, 65, 57, 18,137,100, 13,
+106, 30,209,150,134,134,134,134,134,134,166, 22, 84,231, 69,254,194,148, 69,177,236,234,188,115, 92, 46,215, 79,161, 80, 68,125,
+246,217,103,198,205,155, 55, 19, 23, 23,151,187, 54, 54, 54,109, 20, 10,197, 91, 13,234,199,140, 25, 83,155,106, 63, 63,137, 84,
+ 22,181, 99, 70, 79, 99,209,182, 16,226, 96,103,115,215,194,194,162,141, 84, 42,125, 75,115,196, 39, 19,204,209,180,151,201,100,
+ 17,203,150, 45, 43,206,206,206, 38,132, 16, 34,147,201, 82,  1,200,149, 74,165, 42, 38, 38,134, 40, 20, 10,  2,243,163,120, 12,
+133, 66, 65, 98, 98, 98,136, 82,169, 84,  1,144,203,100,178, 84, 66,  8,201,206,206, 38,203,150, 45, 43,150,201,100, 17,  0,236,
+233,219,130,134,134,134,134,134,230, 95,109,180, 42, 26, 46,243,170, 14, 91,182,108,201, 83, 42,149,109, 36, 18, 73,127,177, 88,
+ 28,218,175, 95, 63,223,129,  3,  7, 50, 52, 26,141,209,215,215,215,222,213,213,117,154, 92, 46, 31,197,231,243,155,113,185,220,
+145, 82,169,212,110,239,222,189,110,213,105, 54,109,254,  1,207,194, 66,222,134,203,229,245, 23,139, 37,161, 19, 63,236,226, 59,
+106,230, 32,  6, 71, 27,103,236,210,204,217,190, 73, 35,187,105,182,114,209, 40, 22,147,209,140,162,168,145,124, 62,223,110,247,
+182, 77,110, 53,236, 88, 35,123,123,251,240,189,123,247, 54, 25, 50,100,  8, 47, 58, 58, 26,  0, 96, 52, 26,185,  0,244, 76, 38,
+ 19, 60, 30, 15, 58,157, 46, 11,128,185, 39,144,232,116,186, 44, 30,143,  7, 38,147,  9,  0,250, 82, 61, 68, 71, 71, 99,200,144,
+ 33,188,189,123,247, 54,177,183,183, 15,  7,208,136,190, 53,104,104,104,104,104,104,254,181,148,153,171,147,168, 80,117,200, 42,
+115,143,193,193,193,111, 69,141,184, 92,238,134,103,207,158,181,179,180,180,108,196,102,179,141, 67,135, 14,229,141, 24, 49,  2,
+233,233,233,166,252,252,124,166,159,159,159,242,222,189,123,189, 12,  6, 67,  7, 11, 11,139,194,236,236,108,133, 70,163,121,  1,
+ 96, 90, 53, 25,217,240,252,105, 84, 59, 43,185,101, 35, 46,155,105,156, 58,118,  4,239,171, 57, 61, 65,105,194, 76,198,180, 76,
+230,247,254, 22,202, 31,111, 22,244,122,166, 51,118, 40,144,241, 11,213, 57,154, 26, 53, 21, 10,133, 63,135,195,185,127,250,244,
+105,  8,133, 66,228,228,228,128,203,229,  2,  0,242,243,243,101,  0, 88, 20, 69,129,203,229, 34, 55, 55, 87, 94,155,163,150,155,
+155, 43,231,114,185,160, 40, 10,  0, 88,165,122,224,114,185,200,201,201,129,155,155, 27,117,250,244,105,155, 94,189,122,189,212,
+233,116, 31,100,100,100,132,209,215, 26, 13, 13, 13, 13, 13, 77,237,169,204,139,252,141,168,113, 28,173,206,165,161,186,242, 19,
+231,238,180,182,182,182, 21,139,197,222,227,199,143,103, 40, 20, 10,220,191,127,223, 84, 80, 80,192, 96,179,217, 96,179,217,204,
+ 46, 93,186,136, 13,  6,131,240,212,169, 83,212,203,151, 47,211,245,122,253,247,153,153,153,247,170,201,200,206,198, 22, 60, 91,
+129,  5,215,251,248, 23, 29, 25,214,110,153,192,217,133, 38,146,159,198, 96,153,  8, 20, 34, 19,115, 85,  7, 74,172,150,185, 10,
+167,238, 75,167,174,189,204, 78,215,235,245,223,231,229,229, 85,167,153, 12,  0,165,121,130, 84, 42,133,209, 88,126,126, 75, 16,
+  6,131,  1, 30,143, 87,167, 35,199,227,241,192, 96, 48,128,114,145, 48,153, 76,  6, 38,147,  9,  6,131,  1, 54,155,253, 86, 62,
+104,104,104,104,104,104,104,234, 68,101, 94,228,239, 66,249,113,180,204,155,155, 82,169, 84, 82, 82,169,212,174,121,243,230,223,
+  6,  5,  5,197, 12, 24, 48,160,240,167,159,126, 34,171, 87,175, 38,171, 86,173, 34, 91,183,110, 53, 94,190,124, 89,255,159,255,
+252,167,216,221,221,253, 69,104,104,168, 55,  0,244,238,221,187,202,234, 72, 11,185, 37, 37,230,178,236,124,188,155,126, 59,188,
+115,147,152,111,250,123, 20,234,118,248, 17,211,124, 39, 98, 92,231, 74,140,  7,187, 26,201,179, 21,250, 37,227,186, 22, 55,112,
+105,240,226,231,173,251,189,  1,160, 91, 80,239,106,171, 56, 21, 10, 69, 75, 71, 71,199,212,115,231,206,153,178,178,178, 72,102,
+102,102, 89, 27,173,108,  0, 50, 23, 23, 23,149,193, 96, 32,114,185,252,117,109,142,154, 92, 46,127,109, 48, 24,136,139,139,139,
+170,196, 95,201,178,  9, 33, 36, 51, 51,147,100,101,101,145,115,231,206,153, 28, 29, 29, 83, 21, 10, 69, 75,250,254,160,161,161,
+161,161,161,249,215, 50,190,194,103,205,180,107,215,142,146, 74,165,140,166, 77,155,138,237,237,237, 91,219,219,219,223,249,241,
+199, 31,201,234,213,171, 13, 27, 55,110, 36,191,254,250,171,225,227,143, 63,206, 21,137, 68, 39,185, 92,174, 28,  0, 92, 93, 93,
+171, 13,249,181,108,221,134, 18,240,121, 12, 79, 79, 31,177,194,202,170,181,181,149,229, 29,221,234, 38,132, 44,116, 48,144, 45,
+ 45,  8, 57,216,211,176, 98,112,171, 92, 54,155,115, 18,128, 28,  0, 28,237,237,204, 13, 35,218,219,216,216, 68, 44, 92,184,176,
+ 64,167,211,145,210, 94,134,169,  0, 44, 92, 92, 92, 84,132, 16,226,232,232,152,  8, 64, 97,166,158,194,209,209, 49,145, 16, 82,
+102,180, 44,108,109,109, 83,  9, 33, 68,167,211,145,133, 11, 23, 22,216,216,216,208,141,225,105,104,104,104,104,104,104,170,156,
+235,176,202, 72,209,141, 27, 55, 72,110,110,174, 41, 57, 57,217,152,159,159, 47,245,243,243,147, 51,153, 76, 40,149, 74, 38,147,
+201, 52, 21, 20, 20, 48, 21, 10,133,138,205,102,239,214,106,181, 89,253,251,247,167, 98, 99, 99,171,109,104,126,239,246, 45, 82,
+ 84,172, 49, 37, 37, 37, 26, 11,243,115,165,163,154, 89,202, 89,  6, 29, 76,126,237,152,185,  2,119,147,169, 40,139,233,101,199,
+ 83,113, 56,236,221,  0,178,  6,  4,247,161,146, 84, 41,230, 54, 94, 87,165,165,165,249,109,216,176, 97, 75,199,142, 29,179, 10,
+ 11, 11,203,218, 86, 85, 28,130,193,194, 76,189,138,235, 49, 41,138, 66, 97, 97, 33, 58,118,236,152,181, 97,195,134, 45,105,105,
+105,126,  0, 84,244,245, 69, 67, 67, 67, 67, 67,243,175,166,202,113,180,106, 28,234,160,176,176, 80,206,225,112,186,181,106,213,
+170, 65, 65, 65,129,105,209,162, 69,137, 63,253,244,211,174, 23, 47, 94,232, 45, 44, 44, 26,  9,  4,130, 79, 81, 76,136,102,  0,
+  0, 32,  0, 73, 68, 65, 84,135, 12, 25,162, 56,114,228,  8,233,208,161, 67,197,232, 83,165,179,123, 23, 21,229,203,121, 28,118,
+183, 79,  3, 36, 13, 18,117,114,147,247,167,119, 19, 59,205,191,185,235,183, 71, 44,125, 83,203,162, 70,150, 92,234,211, 33, 67,
+  6, 43,126, 59,113,146,180,105,211,218, 44,205, 82,140,105,105,105,159,222,191,127,127,112,195,134, 13,147,244,122,125, 18,128,
+204,162,162,162, 84,123,123,251, 52,157, 78,151,  4, 64, 87,201,118,149,105,234,116, 58, 93,146,189,189,125, 90, 81, 81, 81, 42,
+128, 76,189, 94,159,212,176, 97,195,164,251,247,239, 15, 78, 75, 75,251, 20,128,177,154,188,208,179,186,211,154,180, 38,173, 73,
+107,210,154,180,230,191,135, 63, 68,179,  0, 51, 38,149,230,241,120, 29,157,157,157,219, 63,122,244,200,120,235,214,173, 28,  6,
+131,241,115,239,222,189, 15, 29, 62,124, 56,192,210,210,210,198,201,201, 73,121,241,226,197, 64,  0,  7,174, 93,187,102, 86,244,
+ 73,192,227,116,108,225, 40,107,191,249, 33, 49,110,187,255, 60,199,200,228,253,220,101,208,160, 67,211,119,237,  9,176, 87, 72,
+108, 90,216, 73,149,167, 78,157,  9,  4,112,224,214,173,219,181, 30, 79,195, 96, 48, 92, 76, 75, 75,115, 42,251, 63, 61, 61,221,
+ 79,161, 80,120,163, 36,250,148, 99,166, 76,188,201,100,234,109, 50,153,236, 51, 50, 50,158,  0, 64, 70, 70,198,  7,244,117, 68,
+ 67, 67, 67, 67, 67, 67, 83,137,201,218, 92,217,255,213, 70,180,184, 92,174,  3,147,201,244, 73, 74, 74,138, 63,117,234,212,163,
+150, 45, 91,246,138,143,143, 95, 70,  8,137, 19, 10,133,227, 19, 19, 19,159, 39, 38, 38,106,139,138,138, 38,214, 34, 51, 14, 96,
+112,124,238,171,138,226,127,184,248,248, 81,211, 54, 61,122,169,213,170,101, 70, 66,226,184, 66,233,248,103,  9,233,207,111,167,
+105,180,197,197,181,210,172,145,140,140,140, 39, 25, 25, 25, 57,181,220, 38,167,204,100,209,208,208,208,208,208,208,208,212,150,
+154, 34, 90, 58,163,209,184, 66,163,209,200,127,251,237,183,228,160,160, 32, 13,  0,108,216,176,193, 52,118,236,216,235,175, 94,
+189,234,250,228,201,147, 94,182,182,182,151,  0, 80, 49, 49, 49,230, 68,159,116, 38,147,113,133, 86,171,145, 95,188, 28,150,220,
+177,125, 83, 13,  0,108, 92,191,214, 52,116,252,140,235,175,162, 31,117,125, 22, 21,222,203,214,214,246,146,209,192,162, 82,212,
+113,132, 62, 77, 52, 52, 52, 52, 52, 52, 52,127, 97, 54,227,237, 42,195,205,102, 25, 45,173, 86,155,174,213,106,  1, 32, 43, 40,
+ 40,232,173,239,182,110,221, 74,  0, 20,  0, 56,152,153,153, 89,155,204,164, 23, 21, 21,  1, 64, 86,199,246, 77,223,250, 98,223,
+230,159,222,104,230,231,229,210,167,141,134,134,134,134,134,134,230,239,100,182,254,  0,131, 62, 46, 52, 52, 52, 52, 52, 52, 52,
+ 52,245, 98,124, 85,255, 83,168,186,231,192,133, 90,252, 64, 93,122, 31, 92,160, 53,105, 77, 90,147,214,164, 53,105, 77, 90,243,
+ 95,167, 89,147,246,  5,252,253,168,178, 49,252,159, 13,221,245,149,214,164, 53,105, 77, 90,147,214,164, 53,105,205,127, 58,118,
+120,123,120,  7,187,178, 47, 88,244,177,161,161,249,123, 67, 14,130,137, 44, 79, 87, 16, 98, 15, 38, 55,  5, 41,145,175,168,111,
+ 97,170,183,102,170,143, 11,  4,122, 37, 12,252,116,164, 70,196,212, 87,147,134,134,230,159,135,109,219,201,  3, 40,  6,243,103,
+138,152, 80,148, 26,205,227, 20,197,  9,211, 82,226,255,141,222, 34,  5, 85, 68,176,104,163, 69, 67,243,119, 39,221,203,  3, 44,
+ 44,  5,  3,118, 32,186,151,176,246, 89, 10, 60,142,170,183, 38,199,180,  8, 70,134, 35,136,238, 25,108, 60,151,  1, 79, 31,211,
+  7,251,159,199,180,169,147,200,147,168, 59, 72, 72, 80,161, 81, 99, 59,120,120,181,197, 79,107, 67, 41,250,200,208,152,247, 86,
+ 70,109,238,214,119,132,165, 64, 40,  1,  0,152, 12,122,108,157,217,226,188,193, 96,216,  9,224,  8,128,162,127,251, 33,250,159,
+ 55,134,103,179,217,169,  0, 76,124, 62,255, 48,202,133,214,104,104,254,  4,236, 74,175, 51, 83,233,117, 87, 27,196, 44, 22,107,
+190, 80, 40,188,204,227,241,210,120, 60, 94,154, 72, 36,186,204, 98,177,230,  3, 16,255,101,202,184, 95,155,  8,193, 48,246,210,
+234, 77, 14,103, 34,179,109, 10, 53, 70, 15, 48, 12,189,201, 86,119,113,189, 52, 89, 84, 80,177,206,228,188,251,110,161,178, 64,
+107,240,  6, 65,189, 52,203, 97,193,225,112,206,192,252, 57, 71,105,254,100,226, 99,162,112,234,196, 42, 44,250,110, 52,182,111,
+158,136,167, 79,110,215, 75,207, 27,248,224,  3, 22,235,115, 47,160, 11, 74,218,  1,211,252,147,161,200,248, 11,199,119,167, 31,
+223,187, 62,125,255,170,137,228,232,210, 96,172, 93,187,182,219,232,209,163,119, 59, 59, 59,167,  3,248,136, 54, 90,255, 99,244,
+122,189, 77, 70, 70,  6,181,115,231,206,126, 50,153,236, 37,139,197,154, 11,128,243,111, 57,224, 98,177,248,166, 84, 42, 77,149,
+201,100,169, 82,169, 52,188,166,244,127, 40, 30,214,214,214,241,150,150,150,207,202, 39, 90, 55, 27,208,214,173,221,168,  5, 86,
+ 62, 33,157,234,169,207, 97,177, 88,115,101, 50,217,203,157, 59,119,246, 75, 78, 78,166,244,122,189, 77, 45,182,239, 40,151,203,
+159,220,185,115,231,155,140,140,140, 78,137,183,183, 90,171,239,108,178,142,255,125, 85,231,251,167,214,125, 99, 97, 33,123, 12,
+160,227, 95,226, 72, 22,155,148, 96, 48,  3, 31,165, 20, 10, 83,114,245,202,176,184, 66,  9,192,236, 12,109, 61, 94, 98,114, 76,
+ 74,128,116,121,152, 84, 36,186,249,218, 90,121,237,149, 70, 10,  6, 35, 16,197,148,109,189, 11, 28,  6, 99,146,201,100,234,206,
+225,112, 62,165,159, 80,127, 13,120, 60, 14, 64,  8,196, 34, 62,  0,  2, 70, 61,173, 17,151,193,104,119,179, 95,191, 69,115,154,
+ 53,155,230,  5,244,173,194,108, 81,  0,166,123,121,121,157,  6, 48,244, 29,238,206, 15,158,158,158,201,  0,102,188,171,114,201,
+223,223,191,109, 96, 96,224,130, 22, 45, 90,116,122, 87,154,255, 36,212, 55, 55,252,150,114,125,157,141,234, 70,168, 77,118,204,
+213,233,118, 74,185, 41, 38, 38,  6,125,250,244,193,250,245,235,133,190,190,190,187,  0,216,255, 11,110, 37,191,178, 23,124, 84,
+104,163,101,182,209,250,208, 21,237,134, 53,196,149,193,174,200, 27,210, 16,249, 35, 27,226,250, 32, 87,116,169, 75,110,172,172,
+172,208,177, 99, 71,102,114,114,178, 96,214,172, 89, 11,248,124,126, 44,128, 30,117,209, 18,  8,  4,247,133, 66, 97, 34,139,197,
+122, 43, 47, 66,161,240,190, 72, 36, 74,100,177, 88, 93,203,167, 75, 36,146,155, 82,169, 52, 85, 34,145,132, 87, 97,132,238, 75,
+165,210, 84,177, 88,124,191,124, 58,139,197,234, 42, 22,139,147, 36, 18, 73,197,244, 46, 18,137, 36,177, 98,122, 85,176,217,108,
+199,196,196, 68,155,164,164, 36, 27, 46,151,171, 44,159,158,144,144, 96,147,152,152,248, 86,122,109, 96,177, 88, 93, 68, 34, 81,
+162, 80, 40,188, 95, 89,122,197,125,170,138,114,199,174,139, 57,233,181, 45,120,130,130,130,174,167,164,164, 56, 91, 88, 88,188,
+ 53,113,183,165,204,162,199,175, 91, 67,103,134,244, 14,154,100,237,221,191,105, 29,245,123,240,249,252,216, 89,179,102, 45, 72,
+ 78, 78, 22,180,105,211,134,201, 96,212,234,125,162, 91, 72, 72,200,209,212,212, 84,135,230,205,155, 51, 13,  6,  3, 30, 29,155,
+ 15, 97,196,167,224,199,110,132,147, 32,157,245,242,252, 50,199,160,206, 31, 28,197,123,110, 12, 74, 14,122,115, 64,153, 58,154,
+  8,177,126,146, 92,108,221,167,223, 71,172,  7,137, 69,214,122,163,209, 18, 96,118, 38,219, 93,120,117,210,100,233, 59,152,  8,
+ 81, 94,140, 99, 91,  7, 14,158,198,188, 20,199,178,214, 27,141, 86, 96,160, 83, 93, 52,203, 95,254, 76, 38,115,230,170, 85,171,
+ 24,  0,166,  2,224,254,155, 12, 77, 43,123, 56,116,105,204,188,235,103,135,118,239, 80,214,183,244,126,247,168,175,208,150,237,
+167, 49,118,194,102,184,123,181,174,151,142,214,100,122,186, 47, 38,230,236,200,198,141,131,231, 52,107, 54,166, 18,179, 69,  1,
+152,179,108,217,178, 81,143, 30, 61,178,110,216,176,225,132,119,244,210,191,102,217,178,101,179, 31, 61,122,100,239,234,234,186,
+176,150,154, 85,150, 75,114,185,188,199,150, 45, 91,102,246,233,211,103,146,191,191,127,211,119,161,249, 15,102,253,195,135, 15,
+157, 87,173, 90,245,229,216,177, 99,115,  1,160,107,215,174, 28,  0,109,234, 93,222, 17,194, 37,132,  4, 18, 66,250, 16, 66,186,
+ 18, 66, 90,149,254,221,178,116,233, 67,  8,233, 86,225,179,101,233,182,101,223,  7, 84,161,209,167,226,118,229,182,169,248,255,
+ 91,127, 87, 98,180,250,160,164,173, 86,159,183,118,224,196,137, 19,164,252,103, 69,134,184,226,219,105,109, 29, 10,159, 28,223,
+ 67,242, 19, 99, 72, 86,244,  3,242, 96,243, 18, 50,173,165,117,225,240,134,248,161,246,199,139,144, 27, 55,110,144, 71,143, 30,
+145,252,252,124,242,252,249,115, 18, 16, 16, 80, 36, 20, 10, 47,  2,112,173,141,152, 68, 34, 73,189,120,241, 34,  9, 10, 10,202,
+ 17,139,197, 43,203,110, 46,169, 84,154,122,227,198, 13, 18, 20, 20,148, 35,145, 72,214,  0, 96,  2,192,160, 65,131,210,  8, 33,
+196,218,218, 90, 85,153, 94, 72, 72, 72, 22, 33,132,200,100,178,178,170, 38,166, 68, 34, 89, 51,101,202,148,252,123,247,238, 17,
+185, 92, 94,150,206,144, 74,165, 43,167, 78,157,154, 31, 22, 22, 86, 62,189, 90, 44, 45, 45, 19,141, 70, 35, 57,126,252, 56,177,
+177,177, 81,149,187,153, 19,141, 70, 35, 57,122,244,104,149,121,171, 46, 80, 32, 22,139, 87,140, 28, 57, 50, 47, 46, 46,142, 88,
+ 89, 89,165,150, 75, 95, 57,122,244,232,188,132,132,  4,162, 80, 40,204,202,163,149,149, 85,234,205,155, 55,201,192,129,  3,115,
+203, 31, 83, 43, 43,171,212, 91,183,110,149,165,175, 48,167, 32,179,183,183,159, 96, 99, 99,163,178,177,177, 81, 89, 88, 88, 44,
+182,179,179, 83,167,167,167, 19, 66,  8,105,212,168, 81, 90,249, 72,150,141,111,191,207, 54, 30,188,117,231,106, 84,102,122,179,
+238,147, 86,200,154,133,200,106,113, 12, 92,133, 66,225,197, 78,157, 58, 21, 37, 38, 38,146,130,130,  2, 18, 17, 17, 65,110,220,
+184, 65, 94,188,120, 65,  0,152, 51,195,128, 68, 44, 22, 39,107, 52, 26,147, 70,163, 49,165,167,167, 27,211,210,210,140,209, 43,
+237,  8,217,198,126,179,100, 31,237, 75,212, 87,151,154,164, 98, 97, 18,  0,201,123, 51, 90,161, 62,142,100,147,231,190,199,243,
+157,163,175, 46,235,169, 39,113,151,200,158, 49,214,250, 43,159, 57,188, 36, 63,123,253,151,108,242,118,170,147,230,207,222,123,
+ 34,190,118,126,186,110,225,116,125,124,124, 60,249,124,116, 79,195,185,105, 14,175,200, 70,175,131,117,209, 44,199,176,  1,  3,
+  6,228, 39, 36, 36, 16, 31, 31,159,  2, 38,147, 57,246,223,100,178,186,121,112,147, 35,118,127,110,234,235, 43,204,124, 71,102,
+203,215,198,198, 38, 99,199,142, 29, 68, 34,145,164,213,213,108,125,216,191, 51, 41,202,185, 72,250,  7,183,170,246, 30, 25, 60,
+120, 48,  9, 12, 12, 36,211,166, 77,171,233, 94,162,188,128,126, 59,155, 53, 59,106,250,240, 67,227,206,102,205,142,122,  1,253,
+ 74, 13, 22,  5,224,203,229,203,151,135,233,245,250,176,237,219,183,135,245,235,215, 47, 12,192,231,245, 60, 22, 63,253,240,195,
+ 15, 68,175,215,147,237,219,183,147,126,253,250, 17,  0,107,235, 83, 46,149, 69,178,252,252,252, 62, 59,114,228,200,157,167, 79,
+159,166,  7,  7,  7,175,104,214,172,153,172,174,154,127, 69,196, 98,177, 91,211,166, 77,119,249,248,248, 36, 52,111,222, 92,235,
+237,237, 93,236,225,225, 17,231,235,235,187,131,199,227,185,214, 81,182,117,187,118,237,140, 87,174, 92, 33,  3,  6, 12, 32,229,
+ 76, 72,181, 84,231, 69,  8, 33,173,190,252,242,203,185,  0,200,151, 95,126, 57,151, 16,210,167,212, 79,244, 41,255,119,197,207,
+ 50,243, 84,246,127,101, 26,101, 75,101,154,149,253, 70,133,223, 65, 21,145,172,241,127,216,185, 19, 39, 78,116, 58,113,226,196,
+149,138, 59,247, 81, 67,180,157,214,214,161,168, 40, 61,133, 68, 45,249,148, 92, 14,116, 36, 55, 58,219,146,103, 51,  7,144,148,
+221,107,200,228, 22,242,194, 15, 27, 34,176,182, 70, 43, 44, 44,140,132,133,133,145,240,240,112, 18, 27, 27, 75,114,114,114,200,
+254,253,251,141, 86, 86, 86, 69, 60, 30,111, 25,  0,129, 57, 98, 82,169, 52,149, 16, 66, 52, 26, 13, 89,188,120,113,113,105,164,
+ 74, 41,147,201, 82,  9, 33, 36, 59, 59,155, 44, 91,182,172, 88, 38,147, 69,  0,176, 87, 40, 20,137, 49, 49, 49, 68,169, 84, 86,
+106,102,228,114,121,234,211,167, 79,203,140,147,131, 92, 46,143, 58,118,236,152,142, 16, 66,146,146,146,136,165,165,101, 42,  0,
+165,149,149,213,131, 19, 39, 78,232,  8, 33, 68,165, 82,149,165,155,101,180,138,138,138,200,185,115,231,222,202, 67, 89,250,233,
+211,167,223, 50, 96,102,160,148,201,100, 97,251,247,239,215, 26,141, 70, 18, 21, 21, 85,102, 18,149, 22, 22, 22,225,  7, 15, 30,
+212, 26,141, 70, 18, 29, 29,109,182, 25,108,208,160, 65, 26, 33,132, 24, 12,  6,178,113,227, 70, 77,217, 49, 45, 75,215,106,181,
+100,195,134, 13, 26,169, 84, 26,  6,160,218,232,155, 66,161, 80,105,181, 90,146,157,157, 77,  2,  2,  2,242,111,220,184, 65,114,
+115,115,  9, 33,132, 52,104,208, 32, 13,  0, 60, 59,141,253,254,206,243,252,220, 79,102,135, 30,112,109, 53,124,201,217,187,201,
+ 73, 91,142,220, 15, 83,248,134,244, 52, 39,168,201,227,241,150,217,217,217, 21, 95,187,118,205,168,211,233, 72, 66, 66,  2,  9,
+ 15, 15,127,115,141, 69, 70, 70,154,101,180, 88, 44,214,252, 59,119,238,232,140, 70,163, 41, 35, 35,195,152,150,150,102, 76, 75,
+ 75, 51, 84, 52, 90,100, 27,155,100,156, 30, 71, 78,110,158,161,229,112, 56,243,223, 79, 52, 11, 76,178,201, 51,132,108,242, 12,
+219, 49, 82,145,145, 23,190,151,144,243, 51,200,171,239, 27,146,249, 61, 37,121,166, 77,158, 97,100,147,215,135,228,219, 78,172,
+ 90,105,110,246,238, 75, 54,121,134,253,240,145, 75,230,131,176,123,228,202,149, 43,100,195,154,229,100, 90, 55,135,  2,211, 38,
+207, 48,242,179,247,192,218,104,150,135,199,227, 61,191,126,253, 58,185,122,245, 42, 89,184,112, 33, 17, 10,133,  9,239, 34,170,
+ 71,126,246,112, 33,191,120,116, 34, 91,221,237,200,239,157,254,114, 29,124, 90,217,195,161,187,  7, 55, 41,227,193, 17, 66, 94,
+191, 32,234,149, 62,164,167, 39,187,190,102,203,215,198,198, 38, 61, 46, 46,142,168,213,106,178,122,245,106, 34,149, 74,235,100,
+182, 62,236,223,153, 20,101, 95,168,214,104,133,132,132,144, 31,127,252,145,232,245,122,210,186,117,107,115, 94, 90,254, 96,182,
+ 60,129, 16,  0,115, 87,172, 88,241,198,100,133,134,134,134, 69, 70, 70,134, 57, 59, 59,159,170,199,177, 88,187, 98,197,138, 55,
+ 38, 43, 52, 52,148, 68, 70, 70, 18, 23, 23,151,196,250,148, 75,221,187,119,255, 62, 54, 54, 54,119,222,188,121,  7, 58,118,236,
+184,228,193,131,  7, 73, 39, 79,158, 12,243,243,243,235, 89, 87,205,119, 16,213, 97,149, 70,118,184,132, 16, 54, 33,164,204,188,
+178,  0,176,203,  2, 10,230, 48,114,228, 72, 97,219,182,109,195, 70,140, 24, 81,184, 99,199, 14, 18, 23, 23, 71, 34, 34, 34,200,
+138, 21, 43,200,130,  5, 11,200,182,109,219,200,192,129,  3, 11,  2,  2,  2,238,124,248,225,135,252, 90,100,211,199,213,213, 53,
+231,232,209,163,100,207,158, 61,132,195,225,156, 52,119,195,234,188, 72, 85,102,170, 42,131, 85,241,187,106,140, 88,181,134,205,
+140,223,251,163,169,170, 24,  9, 41,247,247,239,193,193,193,157,254,240,240, 33,248,110,252,172,239,249,177, 59, 86, 35,117,255,
+122, 48,179, 83,193,206,203,132,230,250, 73,232,175, 31,195,168, 54,109,  4,  2,138, 90, 84,219, 11,134,203,229,130,203,229,130,
+195,225,160,176,176, 16, 42,149, 10,237,219,183,103,132,135,135,243, 39, 76,152, 48, 67, 32, 16, 36,  0,232, 95,227,221, 76,149,
+ 68,164,111,222,188,137,113,227,198,241,118,237,218,213,220,218,218,250,161,209,104,228,  2, 64,116,116, 52,134, 12, 25,194,219,
+187,119,111, 19,123,123,251,112,157, 78, 39,228,241,120, 96, 50,153, 85,234,113,185, 92,232,245,122,158,187,187,123,196,195,135,
+ 15,125,131,131,131,217,241,241,241,136,137,137,129, 94,175,231,122,120,120, 68,134,135,135, 55,239,211,167, 15, 59, 49, 49, 17,
+241,241,241,111,242, 97, 78,126,181, 90, 45,120, 60, 30,202, 87,105, 81, 20,  5,141, 70,  3, 46,151,107,182, 22,139,197,234,226,
+229,229, 21,249,240,225, 67,191,144,144, 16,206,189,123,247,144,148,148,  4,163,209,200,245,246,246,142,124,248,240, 97,139,126,
+253,250,113, 34, 34, 34,144,154,154, 10,115,171,208,202,214,123,248,240, 33, 70,140, 24,193, 61,115,230, 76, 11, 59, 59,187,  8,
+131,193,192,  5,128,200,200, 72, 12, 25, 50,132,123,246,236, 89, 63, 39, 39,167,136, 26,170, 18,153,  0,160,215,235, 49, 97,194,
+  4,145, 84, 42, 69, 98, 98, 34, 76, 38, 19,140, 70, 35,  0, 32, 51, 43, 51,242, 97,100, 84,244,168, 97, 31,117, 42,210,105, 52,
+183,238,222,127,210,168,129,139, 35, 69,145,  6, 53,100,181,191, 72, 36, 74, 88,185,114,229,103,113,113,113, 60, 47, 47, 47,198,
+171, 87,175,144,151,151,  7, 14,135,243,230, 26, 51,119,191,185, 92,110,103, 31, 31, 31, 86,113,113, 49, 76, 38, 19,  0, 16,  6,
+163,242, 22, 43,252,236,235,240, 86, 26,216,  2,129,160,243,123,121,122,231,250, 88,193,132,238,241,233, 90, 30,207,194, 81, 34,
+182,243,  0, 18,174,162,161, 53, 15, 76,  6,147,127, 47,166, 80,  4,144,238,112,206,176,170,157,166,169,123, 76,154,150,167,183,
+108, 34,182,119,116, 70,102,102, 38,156, 26,121,161,152,107,205,189,249,162, 64, 12,170,150,154,255, 79,  7,119,119,119, 91, 55,
+ 55, 55,100,100,100,192,207,207, 15,114,185, 92, 14,160,123,157, 31, 58,219, 93,120,200, 69, 59,128,177, 18, 70,106, 33,244,172,
+165,120,145,238, 71, 54,249,177,255, 74, 38, 75, 42,230,222,222,187,111,191,131,149,179, 55,112,242, 19, 40, 45,120,216, 58,201,
+207,210, 90,198, 59, 90, 71,179,229,171, 84, 42, 47,221,185,115, 71,193,231,243, 17, 30, 30, 14, 31, 31, 31,172, 94,189,218, 90,
+ 46,151, 95,173, 91,100,139,128, 80, 85,155,172,142, 29, 59, 98,234,212,169,216,181,107, 23, 44, 45, 45, 49, 98,196,136,154,204,
+ 22,137,  6,142,255, 16, 17,177,125,215,203,151, 39, 70, 54,110, 28, 60,194,195, 99,241,196,161, 67,199, 78,159, 62, 29,203,151,
+ 47,199,209,163, 71,209,174, 93, 59,140, 31, 63, 94,159,144,144,176,179,174, 85, 85, 43, 87,174,156, 54, 99,198,140,138,154,186,
+248,248,248, 31,234, 85, 46,101,102, 70, 70, 68, 68, 68, 15, 27, 54,172, 83,113,113,177,230,238,221,187, 79, 92, 93, 93, 29,  1,
+ 52,168,171,102, 61, 12, 22, 69,  8,225,  3, 16,150, 46, 34,  0,194,189,123,247,202, 66, 66, 66,164,165,105,130,210,165,198,234,
+125, 31, 31, 31,199,231,207,159, 39,207,156, 57,211,111,215,174, 93,  2,161, 80,136,236,236,108,252,242,203, 47,152, 59,119, 46,
+ 40,138,  2, 33,  4,219,182,109, 19,142, 25, 51,166,213,203,151, 47,147, 93, 92, 92,204,105,210,194, 19,139,197,  7, 23, 47, 94,
+ 44, 53,153, 76,152, 51,103, 78,134, 78,167,155, 90,250,221, 60, 11, 11,139,219, 40, 49,220,213, 81,169, 23, 41,247,172, 60, 81,
+225,216,  4, 87, 76,171,248, 29, 33, 36,184, 58,141, 90,158,139,202,126,239,100,117,102,171,252, 19,168,115,165, 46, 18,104,102,
+235,234,137,156,243,  7, 33, 96, 81, 16, 48, 75, 23, 22,  5,198,171, 72, 56,241,217,208, 19,226, 91, 87,163, 85,182,176,217,108,
+ 20, 22, 22,194,104, 52, 98,238,220,185,188,115,231,206, 89, 49, 24,140,255,214,164, 83,222, 48, 61,123,246, 12,222,222,222,212,
+241,227,199,149, 83,167, 78, 21,148,253, 78, 78, 78, 14,220,220,220,168,211,167, 79,219,124,253,245,215,226,234,204, 12, 69, 81,
+224,112, 56,152, 49, 99,134,224,238,221,187,150,246,246,246,120,245,234, 21, 94,191,126, 13,177, 88,140, 25, 51,102,  8,238,220,
+185, 99,109,111,111,143,184,184, 56,228,228,228, 64, 44, 22,215,218,104,113, 56,156,183,182,161, 40, 10, 58,157,174, 86,198, 64,
+ 38,147,237,  9, 11, 11,179,150,201,100,136,136,136,128,193, 96,128, 76, 38,195,180,105,211,  4, 97, 97, 97,214, 22, 22, 22,136,
+142,142,  6, 33,  4, 82,169,180, 86,121,  4,  0,147,201,132,232,232,104, 52,104,208,  0, 87,175, 94,181,153, 56,113, 34,191, 44,
+253,197,139, 23,112,116,116,196,213,171, 87,109, 68, 34,209,158,170,180, 76, 38, 19, 82, 82, 82,240,232,209, 35,188,122,245, 10,
+233,233,233,200,200,200, 64, 94, 94, 30, 12,  6,  3,  0, 64,152,151,123,114,239,129,227, 15,  5,  2,129,208,199,195,221, 57, 50,
+234,113,154, 64, 32, 16,186, 56, 59,123,  0,223, 50,170, 49,132,255,141,143,143,183, 26, 51,102, 12, 71,173, 86, 35, 43, 43, 11,
+ 44, 22,235, 15,215, 22,151,107, 94, 83, 32,131,193,224,205,231,243, 41,157, 78,247, 38,  2,198,229,114,241,217,158, 66,248,204,
+199, 91,203,208, 53,105, 32, 70, 61,180, 90,173,247,255, 60,154,  5, 80,160,180,238,160, 40,191,219,175, 10, 44, 59,  4, 15,227,
+ 32,230, 12, 96,210,  3, 12, 22, 58, 55,115,100, 29,141, 44, 80,130,160, 25, 52,240, 34,164,230,158, 95,  4,160,  0,157, 27, 64,
+125,112,238,185,193,170,221,128, 73,156,228,228,100,112, 56, 28,240,120, 60,248,117, 25,196,218,251, 80,111, 11, 10,205,161,131,
+167, 57,154,111,133, 29,  5,130,111, 22, 44, 88, 32, 42,175, 57,118,236, 88,145, 76, 38, 91, 80,103,147, 85, 32,108,  3,  3,153,
+241, 40,185,176,193,226,147,106,239,151,105, 69,158, 32,100, 38,160,111,241, 14,204, 86,103, 30,143, 23,  3,160,125,189, 76,150,
+132,123,107,223,190,253, 14,150, 78, 37, 38, 11,134, 98,128, 45,128,173,181,  5,182,126, 22,104,105,109, 33,168,173,217,242, 85,
+ 42,149, 23,111,223,190,173,224,243,249,  8, 11, 11,  3,135,195,  1,159,207, 71,211,166, 77,177,105,211, 38,107, 75, 75,203, 90,
+155, 45,  2, 82,105,204,183,127,255,254,164, 99,199,142,152, 50,101, 10,118,238,220,  9,173, 86,139,197,139, 23, 35, 62, 62,222,
+ 44,217,104,224,248,178,136,136, 29, 75, 31, 61,122,246,165,175,175, 87,127,145,200,114,202,136, 17,178,175,191,254,250,196,177,
+ 99,199,182,247,233,211, 39,227,238,221,187, 63,  2, 56, 88,203,195, 75,  1,  8, 93,181,106,213,148, 50,227,246,245,215, 95,111,
+ 59,118,236,216,210, 62,125,250,164,220,189,123,119, 38,128,208,250,148, 75, 38,147,233,228,127,255,251,223,135,  2,129, 64,232,
+233,233,233, 28, 21, 21,149, 38, 16,  8,132,206,206,206, 30,157, 58,117, 98,212, 69,179, 46,216,216,216,116,189,125,251,182, 15,
+ 74, 58,141,241,202,140, 86, 84, 84,148, 69,110,110,174,133, 88, 44,182,176,179,179,147,148,153,173,  1,  3,  6, 88,176, 88,172,
+106,175,219,252,252,252, 99,243,230,205,147, 13, 24, 48,160,236,127, 92,191,126, 29, 59,119,238,132, 72, 36,122,107,221,126,253,
+250, 97,220,184,113,114,173, 86,251, 95, 51,178, 59,122,194,132,  9,158, 74,165, 18,223,124,243,141, 38, 57, 57,185, 43,128,120,
+  0,178,110,221,186,125, 31, 21, 21, 21,208,170, 85,171,  3,  0,252,171,187,247, 42,243, 34,229,141,142, 57,105,117, 93,223, 92,
+179, 85, 33,169,202, 49,180,222, 50, 90,193,193,193, 87, 80, 69, 79, 42,221,235, 84,240, 96,132,128, 73, 65,200, 44,103,182, 96,
+  2, 43, 39, 13, 84, 29,122,169, 84,246, 48,228,114,185, 96, 50,153,208,106,181, 48,119,162,234, 50, 83, 32,149, 74, 33, 22,139,
+ 81, 84, 84,  4,131,193,  0, 62,159, 95,102, 70, 32,149, 74,193,102,179,193,102,179,193,231,243,255, 16, 77,170, 24,205,225,112,
+ 56, 16,137, 68, 72, 73, 73, 65,124,124, 60, 76, 38, 19,196, 98, 49, 68, 34, 17,184, 92, 46, 84, 42, 21, 84, 42, 21,  8, 33, 16,
+137, 68, 16,137, 68,168, 77,131,107,163,209, 88,233,195, 95,175,215,215, 42,162,101, 48, 24,240,228,201, 19, 36, 36, 36,128,207,
+231,191,217, 87, 30,143,135, 23, 47, 94, 64,173, 86, 67, 40, 20, 66, 42,149, 66, 38,147,153,173, 91,182, 47, 18,137,  4,  2,129,
+  0, 89, 89, 89, 40, 44, 44,124,115, 76,165, 82, 41, 68, 34, 17,114,114,114,144,150,150, 86,237,190, 27,141, 70,168, 84, 42,164,
+167,167, 35, 49, 49, 17, 25, 25, 25,111, 10,160,210,168, 81,253,  2, 59,185,185,200,204,204,124, 19,137,172,106, 49,  7,147,201,
+132,188,188, 60,220,190,125,155, 50,153, 76,200,206,206, 54,165,171,213,198,201, 42, 46,142,126,251, 51,217,127,230, 65,241,222,
+ 83, 97, 69,135, 47, 62, 42, 10, 61, 28, 89,196, 15, 88,104,192,251, 96,131,175, 12,122,118, 80, 70,190,158,151,174,227,200,148,
+190,221,128,152,211,  0,131,  5,240,229,104,221,164, 33,226,179,140,162,167,169, 90, 62, 40,244, 64,168,135,220, 44, 77, 35,187,
+123,122,158,158, 23,167,179,150,122, 55,243, 71,106,106, 42,120, 60, 30,120, 60, 30, 62,104,215, 13, 49,153, 70,225,227,228, 34,
+ 33,  8,130,204,210,252,127, 26,137,197,226, 54,237,219,183,167,202,107,246,238,221, 27, 20, 69, 53,  5,224, 85,171, 66,110,109,
+ 35, 46,116,194,214, 96,145, 25,143, 83, 10,237,143, 70, 21,123,244,237, 63,200,242,167, 11,105,222, 79,212, 26, 87, 16,253, 44,
+ 16,157,127, 61,204, 86, 39,137, 68,114, 98,221,186,117,174,124, 62,255, 52,128, 14,117, 17, 17, 11,152, 27,191,153, 50,204, 65,
+ 94,102,178,244,133,  0, 75,  0,176,  5,  0, 75,  0, 91, 27,  5, 22,141,235,110, 41,228,179, 15,215,194,176,238, 13, 13, 13,181,
+174,104,178,202, 22, 63, 63, 63,204,159, 63,223,218,210,210,114,143, 57,122, 43, 87, 44, 39,217, 57, 57,  0,  1,114,115,243,177,
+114,197,242,172,178,239,  6, 12, 24, 64, 58,116,232,128, 41, 83,166, 96,233,210,165, 56,117,234, 20, 90,183,110,141,241,227,199,
+163, 85,171, 86, 53, 73,  7,201,100,178, 93,221,186,117,187,173,146, 72,198,165,248,251,115, 47,202,100, 57, 93,115,114,100, 46,
+ 81, 81, 58, 79, 32, 18,192,134,164,164,164,158,181, 48, 89, 67,165, 82,105, 88,215,174, 93,117, 18,137, 36, 97,245,234,213,147,
+167, 78,157,138,229,203,151, 99,222,188,121,191,  0,248, 15,128,175,146,146,146,236,171, 51, 89,127, 86,185,244,103,149,117, 70,
+163, 49,241,224,193,131,173,116, 58,157, 99,105,245, 32, 47, 59, 59, 91,250,250,245,107,137, 78,167, 19,153, 76, 38,145,133,133,
+133, 24,128,112,212,168, 81,172,199,143, 31,123, 27, 12,134,228,234, 52,213,106,245,240, 57,115,230,100,100,100,100,  0,  0,154,
+ 54,109,138,236,236,108,124,254,249,231,248,244,211,146, 14,193, 45, 90,180,  0, 33,  4,169,169,169, 88,185,114,101,170, 90,173,
+254,216,140,236, 54,118,119,119, 71, 84, 84, 20,158, 60,121,114,  1,128,  9, 37,237, 88,115, 30, 60,120,240, 48, 61, 61, 29,123,
+246,236,225, 56, 56, 56, 28, 67, 21, 67,188, 84,231, 69,234,  2, 69, 81, 39,235,178, 93, 89,228,170,178,136, 88, 21, 84, 31,209,
+ 10, 14, 14,166,202,127,190, 21, 49,162, 16,145,112,255, 42, 44,125,253,223,138,102,  9,153, 20,  4, 82, 25, 98, 18,227,193,  1,
+245,232, 93, 25,173,172,172, 44, 76,158, 60,185,104,248,240,225,153, 38,147,105,144,185,166, 64, 38,147, 65, 38,147,225,241,227,
+199,100,224,192,129,169,171, 87,175, 46, 42,111,180,158, 61,123, 70,130,130,130,210, 22, 44, 88,144, 95,157,209, 42,139,104, 45,
+ 91,182,172,168,115,231,206,233,143, 30, 61, 34,101,102, 74, 44, 22, 99,229,255,177,119,221,225, 81, 84,111,247,204,204,246,150,
+ 94, 73, 72,  8,161, 36, 64, 32,132, 22, 64, 80, 32, 64, 64, 58, 34,130,136,130, 34, 69, 68, 20, 17, 21,233,  2,210,155, 82, 20,
+ 69,105,  2,130,210, 17,  8, 85,105,  9, 45,148, 52, 72, 47,155, 77,207,246,221,153,185,223, 31, 73, 48, 64,202, 38,168, 63,245,
+219,243, 60,243,108,246,238,204,201,109,115,231,204,123,239,125,223, 21, 43, 12, 61,122,244, 80, 95,187,118,141, 84,164,213,197,
+162, 69,211,244, 35,161, 85,249, 26,154,166,193,243,124,157,132,150, 78,167, 27,253,226,139, 47,170,239,223,191, 79, 42,202,233,
+232,232,136, 85,171, 86, 25,122,247,238,173,190,115,231, 14,169, 72,115,112,112,176, 89, 12, 86,252,127,149, 74,  5,  7,  7,  7,
+220,189,123,151,244,233,211, 71,189,110,221, 58, 99,229,244,123,247,238,145, 65,131,  6,169, 75, 75, 75, 71,215, 36, 94, 42,166,
+243, 88,150,133,209,104, 68, 94, 94, 30,210,211,211, 31,153,211, 13, 10,135,200, 81, 47, 15, 12, 53, 24, 12,250,187,241,  9,105,
+173, 67, 90,122, 24, 12,  6,125,106, 90, 90, 60, 48,143,175,129,123,120,171, 86,173,242, 39, 79,158,108, 40, 44, 44,124,102,161,
+ 37, 22,139,239, 11,  4,  2,210,173, 91, 55, 98, 54,155, 73,122,122,186, 53,175,176,144, 13, 94,188,152,220,153, 62,157,146, 69,
+ 71, 75,148, 74, 37, 85,206, 73, 63,120,240,128,151,201,100,247,255,118,161, 69,243, 94,160,200,115, 23, 18,180, 78,189,  7,142,
+ 20, 83, 57, 87,  1,139, 22,144, 56,  3, 18,103,  8, 20,174,232,215,173, 45,179,237,114,137, 23,  8,223,  5, 34,137,111,173,156,
+ 66,226,  9,240,221, 78,198, 27,157,159,123,105,170,184,160,160,  0, 12,195, 60, 18, 69,114,133,  2,189,134,188, 70,127,123,213,
+228,  5,144,174,160, 24,223, 58,220,235, 51, 63,251,236, 51, 81, 97, 97, 33,104,154,254,131, 83, 46,199,196,137, 19, 37, 14, 14,
+ 14,179,109, 30,252,246,182, 16, 65, 40,  9,  7,200,123,113, 57,198,  6,  7,111, 27,130, 62, 88,186, 85,214,170,109, 71,188,253,
+130,135,108,233,145,220, 86, 55,211, 13,141,  1,110, 58, 88,115,251,122,136,173,110, 42,149,234, 72,116,116,180,188,127,255,254,
+ 88,177, 98,133, 66, 38,147, 29,171,207,192,175,211,114,239, 44, 88,247,131,250,214,234,190,128, 69, 87, 38,176, 42, 29,185, 90,
+ 30,115,182, 70, 21, 91,173,100,148,173,156,  6,131, 97,236,155,111,190,153,191,127,255,254,167, 68,150, 84, 42, 69,114,114, 50,
+ 62,255,252,243,130,130,130,130, 90, 31,138,171, 86,174,136,137,189,121,  6,223,126,189,  0,  0,193,250, 85,147,112,233,194,110,
+167, 23,158,239, 78, 26, 53,106, 68, 58,118,236,136,201,147, 39, 99,209,162, 69,136,139,139,131,155,155, 27, 38, 77,154,132,231,
+159,127, 30, 43, 87,174,172,105,144,234,243,206, 59,239,124,158,145,145, 17,116,242,228, 73,129, 70,163,241, 88,249,205, 55,197,
+251,138,139, 11,150,196,198,198,125, 18, 18,210,108, 86,155, 54,175,215,224,250,161, 74,145, 53,101,202,148, 93, 25, 25, 25, 97,
+167, 78,157, 18,106, 52, 26,223, 41, 83,166, 96,249,242,229,152, 61,123,246,102,  0,111,195,182, 13, 47, 54,143, 75, 12,195, 68,
+ 14, 31, 62, 60,212, 96, 48,232,227,226,226,210, 66, 66, 66, 60, 12,  6,131, 62, 45, 45, 45,254,220,185,115,124,125, 56,235,131,
+252,252,252,164,157, 59,119,198, 79,157, 58, 53, 44, 35, 35,163,  5,  0,215,210,210, 82, 69,105,105,169,196,108, 54,203,156,157,
+157,157,219,182,109,235, 54, 97,194,  4,229,141, 27, 55, 90,100,100,100,104,203,173, 72,213,194, 98,177,196, 21, 22, 22, 14,232,
+219,183,111, 81, 97, 97, 33,218,180,105,131,129,  3,  7,194,203,203, 11, 13, 26, 52,192,224,193,131,209,188,121,115,228,231,231,
+ 99,212,168, 81,  5, 26,141,166, 47,128,  7, 54,100, 55, 41, 39, 39,  7, 93,186,116,193,130,  5, 11,  6,140, 24, 49,226, 78,183,
+110,221, 74, 66, 66, 66,244,190,190,190,193,107,215,174,133,143,143, 15,246,238,221,235, 45,145, 72,118, 86, 33,178,170,213, 34,
+  0, 52,229,130,199,252,196,167,166,150,223,108,189,182,202,191,109, 56,239, 73,177, 85,249,120,106,234,176,234,  6,  1,230,124,
+191,119,155, 81,236,215, 20,142, 65,161,144, 75,165,144,137,197,144, 57,187,194,196,243,248, 38, 57, 71,175, 35,100,118, 93, 59,
+207,147, 15, 66,138,162,176, 97,195,  6,182,115,231,206,198,168,168,168,245,  6,131,193, 15,101, 94,101,109, 22,  5,235,214,173,
+211, 79,155, 54,237,102,110,110,110,168, 84, 42, 53, 87,164,175, 95,191, 94,255,218,107,175,197,102,100,100,132,201,229,114,125,
+117,235,179, 42, 11, 45,137, 68, 98,202,205,205,237, 56,126,252,248,251, 95,125,245,149, 78, 46,151, 67,161, 80, 64, 34,145,152,
+115,115,115, 67, 39, 79,158,124,115,249,242,229,122,153, 76,  6,133, 66, 81,167,105, 57, 66,200, 83,130,170,114,186,173, 96, 89,
+ 54, 42, 55, 55, 55,116,218,180,105, 55,214,174, 93,171,171, 16, 64,149,243,184,114,229, 74,189, 82,169,172,147, 69,171,226, 60,
+133, 66,129, 53,107,214,232,167, 78,157,122, 51, 55, 55, 55, 84, 34,145,152, 43,165,235,222,121,231,157, 27,185,185,185,161, 44,
+203, 70,213,240, 54,198,149,148,148, 64, 32, 16, 32, 54, 54,214, 36, 18,137, 64,211, 52, 18, 19, 19, 31, 13, 62, 46, 46, 46, 45,
+ 67, 91,135,  4,255,176,107,239, 57,153, 72, 34,233,220,177,125,139,  7, 41,169, 25,132, 80, 41,181,100,245,103,131,193,224, 23,
+ 21, 21,181,190,115,231,206,198, 13, 27, 54,176,213, 89,182,108,129,201,100, 58,119,253,250,117,171, 84, 42,165,178,179,179, 89,
+134, 97,192,113, 28, 49,117,236,104,106,189,118, 45,185, 59,107, 22,229,160, 80,  8, 68, 34, 17,228,114, 57,117,252,248,113,179,
+ 94,175, 63,247,247, 11, 45,200, 65, 65,150,144,107, 82, 73,105,150, 66,252,207,101, 34, 75,234,  4, 72,157,  1,169, 51,124,124,
+124,113, 53, 89,175,  2, 13, 49, 56, 27,124,136, 17,162,  0,  5,121,172, 26, 42,161, 88, 70,229,228,228, 60, 18, 68, 21, 71, 64,
+211, 22,184,158,170, 85,130, 34, 18, 48,168,139, 11,146,  1,174,174,174,130,236,236,236,167, 56, 91,182,108,201, 88,173, 86,219,
+ 93,187,100,113,222,  0, 63, 37, 62,199,232,125,224,166, 46,104,250,146,111,101, 50,174,  8,136, 94,135, 86,129, 13, 48,253,165,
+182,226, 79, 15,106, 90, 93, 75,209,  7,130, 33,111,131,215,186,215, 33,159,207,169, 84,170, 99,215,174, 93,147,171, 84, 42, 60,
+120,240,  0, 29, 59,118,196,150, 45, 91,228,114,185,252, 40,128, 58,173,199,187,162, 70,170,182,148,235, 60,115,111, 90,206,173,
+108,246, 49,145,165,209, 17,188,249,197,193,162,194, 18,227,240,203,233,213,223, 63, 85,224, 70, 81, 81, 81,159,217,179,103,231,
+107, 52,154,199, 68, 86,106,106,106,197, 67,241,  5,  0,181,190,252,158, 61,115, 34,108,241,162,105,184, 22,125,  7,253,  6,188,
+135,235,183,146,240,201, 71, 67,224,228, 32, 67, 84, 84, 20,134, 14, 29,138,  5, 11, 22, 32, 49, 49, 17, 63,254,248, 35,181,101,
+203, 22,234,242,229,203,212, 23, 95,124, 65,213,178,164,225,213, 37, 75,150,224,218,181,107,232,223,191, 63,206,159, 63,143,130,
+130,  2,236, 62,118, 44, 97,103, 66,194, 39, 21,107,182,170,113,253, 80, 37, 28, 28, 28, 62, 88,178,100,  9,162,163,163, 31,113,
+230,231,231, 99,201,146, 37, 25,  0, 38,213, 69,100,213,101, 92,106,211,166, 77,240,174, 93,187,206, 73,165, 82, 73,199,142, 29,
+ 91, 36, 39, 39,103,  0, 72,169,  7,103,201,179,204, 84,229,229,229,253,190,101,203,150,203, 61,123,246,148,143, 29, 59,214,253,
+151, 95,126,113,213,235,245, 13, 36, 18,137,135,217,108, 22,223,187,119,143,217,183,111,159,215,221,187,119,147,141, 70,227, 85,
+ 91,234, 35, 55, 55,247,106, 92, 92, 92,223, 54,109,218,220, 91,191,126,125,134,183,183, 55, 63, 97,194,  4,188,249,230,155,112,
+119,119,231,214,172, 89,147,214,173, 91,183,216,164,164,164,  8,189, 94,127,219,198,188,126,183,120,241,226,223,118,237,218,133,
+129,  3,  7,226,139, 47,190,192,238,221,187,113,230,204, 25,217,133, 11, 23,196, 91,182,108,129, 72, 36, 66,120,120, 56,250,244,
+233,211,171,124,186,211,214,231,210, 53,138,162,142, 80, 20,117,234,137,207,107, 53,253, 86,135,107,171,251,187,198,243,158,200,
+230,150, 39, 14,219,241,106, 32,230, 77, 12, 81,233,127, 31, 19, 78,114, 38, 60, 71,212, 35, 91,144,139,207,187,144,241, 77, 40,
+221,216,122,186,119, 48, 24, 12,143,142,253,251,247, 19, 47, 47, 47,157, 74,165,170,179,123,  7, 47, 47, 47,117, 73, 73,  9,233,
+208,161, 67,129,187,187,251, 35, 87,  4,222,222,222,106,157, 78, 71,194,195,195, 11, 60, 60, 60, 30,185,119,240,245,245, 77, 39,
+132, 16,127,127,255,172,234, 38,158,227,147,  0,  0, 32,  0, 73, 68, 65, 84,248, 88,150, 37, 94, 94, 94, 21, 59,244,132, 46, 46,
+ 46, 27, 59,117,234, 84,160, 86,171,137,183,183,247, 35,215,  9,238,238,238, 43, 58,118,236,248,100,122,109,249, 77,207,200,200,
+ 32, 25, 25, 25,164, 97,195,134, 89,149,211, 83, 83, 83, 73,106,106, 42,241,245,245,173,179,123,  7,119,119,247,229, 85,228,165,
+ 94,121,244,243,243, 83, 27, 12,  6,210,165, 75,151,199,234,212,207,207, 79,109, 52, 26, 43,210,109,114,239, 32,147,201,222,150,
+ 74,165, 89, 82,169, 52, 75, 34,145,124,222,168, 81,163,220, 61,123,246,144, 53,107,214, 84,108, 73,135,123,203, 65,157,155,118,
+121,253, 19,247,150,131, 63,120, 22,247, 14, 42,149,234,180,151,151,151,110,255,254,253,143,245, 47,131,193, 96,179,123,  7,153,
+ 76,150,161,213,106,121,181, 90,109,253,237,183,223,244,209,209,209,250,216,216, 88,125,114,114,178, 33, 63, 55,215,162, 86,171,
+ 13,197,197,197,166,155, 55,111,154,228,242,255,141,123,  7,178,165,121, 83,178, 49,248, 96,210,130,128,187,211,186,203,141,183,
+ 23,133, 18,242,211, 80, 66,142,190, 73, 72,212, 76,114,117,243,  4,210, 37, 64,194,253, 54,163, 97, 60,217, 20,116,192, 22,151,
+ 12,100, 75,235,166,100, 99,240,209,132,249,  1,119,199,118,107, 96,252,230,171, 53,228,202,149, 43, 36, 54, 54,150, 60,120,240,
+128, 28,253,121, 15,233, 18, 40, 47,227,220, 24,124,176,142,110, 30,186, 74, 36, 18,237,170, 85,171,200,229,203,151, 31,113, 30,
+ 60,120,144,200,229,114, 61, 96,219,174,101,  2, 80,100, 99,203, 33,236, 87, 65, 23, 62,237,173, 44,205, 63, 60,147,144,219,219,
+  8,217,210,138,144,239, 58, 17,178,231, 69, 66, 14,189, 78, 46,175,121,137,116, 13, 16, 89,201,166,160,243,100,115, 75,155, 23,
+219, 11,133,194,146,253,251,247,147,172,172, 44,114,254,252,121, 18, 29, 29, 77,238,223,191, 79,210,210,210,200,145, 35, 71,136,
+ 80, 40, 52,162, 30, 97,203, 58,121,194, 63,162,153, 40,251,230,210,174,132,252, 50,138,104,118,190, 74,  6,132,168, 10,194, 27,
+ 62,147, 63,186,182,174,174,174,121, 71,142, 28, 33,201,201,201,228,220,185,115,196,195,195, 35, 15,128,205,235,101,  7,244,235,
+ 70,136,249, 38,233,209, 61,132,180,105, 19, 66,158,239,218,140,100, 38,173, 35, 29,219, 53, 34, 27, 55,110, 36,106,181,154, 52,
+106,212,136,212, 53, 99, 17, 17, 17, 87,  8, 33, 49,253,251,247,143,  1,112, 60, 34, 34, 34,230,225,195,135, 49, 29, 59,118,188,
+140,154, 93, 63, 84,139, 94,189,122, 89,  8, 33,164,127,255,254,  4, 64, 86, 68, 68,  4,121,248,240, 33,233,216,177,163,185, 62,
+149,103,203,184, 20, 22, 22,214,185,103,207,158,159,132,133,133,125, 96,139,123,135, 90, 56,255, 44, 39,212, 12,202,156,127,182,
+  4,208,190,252,104, 81,158,198, 60,  3,231,235, 66,161,240, 27, 23, 23,151, 51,206,206,206, 81, 12,195,108,  1, 48,  6,245,243,
+111, 70,151, 91, 24,127,117,119,119, 79,108,211,166,141,161,111,223,190,164, 95,191,126,100,202,148, 41,132,231,121,178,103,207,
+ 30,178, 96,193,  2,210,196,213,149, 93,  3,228,109,  2,222,128, 29,101, 14, 75,223,  8,164,206,141,110,140,210, 81,141,161, 29,
+215,132,178,197, 97,105, 68,117, 66,139,231,121, 18, 31, 31, 79,122,244,232,161, 83, 40, 20,153,176,221, 97,233, 99,156,110,110,
+110,209, 30, 30, 30, 79, 57,209,172,148,254,152,195, 82, 15, 15,143,223,189,189,189,213,238,238,238,215,171,226,116,115,115,139,
+246,246,246, 86,187,185,185, 61,230,220,147, 97,152,254,110,110,110,153, 79,166, 11,  4,130,158, 30, 30, 30,233, 79,166, 87, 83,
+118,120,121,121,165,103,101,101, 17,141, 70, 67,252,252,252,178,158, 20, 96, 57, 57, 57,143,  9, 48, 91, 56,107,203, 75, 13,121,
+172,146,211,134, 58,173, 79,187, 87,160,185,143,143, 79,238,202,149, 43,137, 82,169,124,108,203,115, 80,247,113,159, 93, 73,208,
+150,188,249,209,198, 61, 85, 56, 44,181,213, 57,104, 95,133, 66,145,217,163, 71, 15, 93,124,124, 60,225,121,158,240, 60, 95,157,
+208,170,138, 51,178,125,251,246,249,121,121,121, 92,105,105, 41,155,158,158,110,122,248,240,161, 97,209,162, 69, 22,141, 70, 99,
+212,106,181,230, 91,183,110,153,188,189,189, 53,  0, 34,235,218, 70,245, 68,196,147,211,103,100,115,139,174,100, 83,139, 35,247,
+231,250,223,123,189,147,194, 20,179,178, 63, 33, 81, 51,201,229,141,111,146,206,  1,226, 50, 65,180, 57,248, 24,249,182,121,119,
+178, 46, 80,108, 19,231, 55, 77,186,145,205,193,199,238,206,241,191, 55,180,157,187,121,215,182,205, 36, 49, 49,145, 28,220,183,
+147,132, 55, 46, 23, 89,155, 90,252, 74, 54,182,232, 97, 11,103, 85, 98,107,235,214,173, 36, 49, 49,145, 28, 56,112,192, 86,145,
+ 21, 81,149,208,250, 56, 66, 89,244,102, 39,169,105, 84, 91,177,121,112, 43,145,165, 79, 83, 17,219,197, 95,192,133,122,211,124,
+ 11,119,144, 62, 65, 50, 19,217, 20,116,158,108,106,209,215,214,124,138,197,226, 52, 84,242,169,243,228, 33,145, 72, 52, 53,  8,
+173,136, 90,197, 86,115, 73,246,233,  5, 61,201,192, 54,170,124, 27, 69, 86,109,125,169,173,155,155, 91,222,119,223,125, 71, 60,
+ 61, 61, 53, 54,138,172, 71,156,131,  6,244, 33,169, 73, 71,201,129, 61, 75, 72,143,238, 45,200,246,173,211,200,149,243,115,201,
+139,253,122,144,136,136,  8,146,151,151, 71,122,246,236, 73,234,154, 79, 71, 71,199,237, 90,173, 54,230,196,137, 19, 49, 17, 17,
+ 17, 49,219,183,111,143,185,120,241, 98,140, 92, 46,223, 94, 97,156,120, 82,108,181,120,122,252,143,120,194,162, 21, 83, 90, 90,
+ 74, 78,156, 56, 65, 34, 34, 34,200,246,237,219,201,197,139, 23,137, 92, 46,143,169,239,125,100,235,184,212,187,119,239,207,146,
+147,147, 75,230,204,153,179,167, 10,135,165,182,114, 38,254, 73,249,252, 83,198,144,255,  1,167, 74, 38,147,197,220,188,121,147,
+ 20, 22, 22,146, 16, 79, 79,178,152, 97, 72,134, 72, 68,178, 68, 34,178, 17, 40,248, 15,200,164,  9,213, 77, 29,254,213,168, 82,
+104, 25,141, 70, 50, 99,198, 12,179, 84, 42,213,139, 68,162,186,134,224,249, 87,119, 66, 55, 55,183,223, 61, 61, 61,213,158,158,
+158,143,137,189,202,233,110,110,110,215,255,227, 55, 96,115,145, 72,148, 42, 20, 10, 31, 15,193,211,114, 80,231, 38, 93,199,206,
+246,108, 53,168,223, 51,230, 83, 36, 18,137, 62,150, 74,165,250, 25, 51,102,152,181, 90,109, 93,132, 22,  0,244,150,203,229,153,
+223,127,255,189, 33, 33, 33,193, 90, 80, 80,192, 94,185,114,197, 26, 29, 29,109,158, 55,111, 94,169, 92, 46,207, 68,245,110,  9,
+254,150,250, 36,235,  2,197, 21, 98,235,246,108,255,251,  3, 67,228,150, 45,239,247, 33,157, 27, 61, 33,178,170,247,228, 94, 53,
+103,185,216,186,241,169,223,253, 30,205,149,236,146,217,211, 73,120, 99,217,227, 34,171, 14,156, 79,138, 45,185, 92, 94, 58,119,
+238,220,186, 88,178, 30, 23,132,223,  4,249,145,205,193,219,203, 68, 84, 45,199,198,160,175,201,134, 32,191,127,202,125,212,201,
+ 19,254,189,154, 75,238,212,193,146,101, 75, 62,219, 58, 59, 59,223,171,131, 37,235, 17,231,134, 13,235,201,171, 35,123,147,164,
+123,251,137, 54,255, 40,185,126,105, 21, 25, 54, 40,140,132,135,119, 36,155, 55,111, 38,113,113,113,164, 67,135, 14,164, 30,249,
+236, 51,113,226,196,152,135, 15, 31,198, 60,120,240, 32,230,226,197,139, 49, 67,134, 12,137,  1,208,167,242, 76, 80,133,216,178,
+ 12, 27,102,106, 75,211,211,107,225,124,101,226,196,137,228,225,195,135,228,193,131,  7,228,226,197,139,100,200,144, 33,  4,117,
+ 11,223, 83,175,113, 41, 44, 44,172,115,143, 30, 61,102,183,107,215,174,223,159,197,249,255, 80,104, 41,134, 14, 29,202,115, 28,
+ 71,250,245,235,199,173,  5,138,182, 80,148,122, 11, 69,169, 55,  3,154,255,186, 69,235,175, 14,248, 25,  1,224, 84,229,  4,169,
+ 84,170, 54, 26,141,238, 74,165,242,103,173, 86, 59, 21,101,219, 34,159,137,243,175,200,167,157,243, 63,193,233,173, 84, 42,215,
+107,181,218, 33, 82,169, 84, 99, 52, 26, 61,235,192,233, 36,145, 72,166, 75,165,210, 30,122,189,190, 57,  0, 40, 20,138,120,147,
+201,116,198, 96, 48,172,  6, 80,244,191, 46, 59, 89, 23, 40,134, 88,220, 30,  4,179, 98,210,116,141,151,156, 40,240,127,191,167,
+115, 90,151, 38,138,100,  8,249, 47, 64,153,174, 82,111,164,154,234,204, 41,163, 58,130, 19,206,186,154,162,111,244,197,201, 82,
+255, 15,122, 40,211,186,  4, 42,211, 64,240,  5, 36,250, 75,117,229,124, 82,108, 41, 20,138,239,117, 58,221, 91,  0,206,212,181,
+236,100,111, 11, 17,116, 86, 31, 88,153, 16,144, 26, 66,248, 16,162,  7,205,196, 34,  7,106,106,222, 61,139,253, 62,170,154,243,
+171,175,190, 36,167, 78, 30,133, 73, 95,128,236,220, 18,188, 58,102, 28,218,182, 13,131,155,155, 27, 22, 47, 94,140,166, 77,155,
+ 98,193,130,  5, 84, 61,242,217, 71,169, 84,190, 26, 28, 28, 28,120,247,238,221,  7,122,189,126,  7,128, 95,159,124,254,  4,  3,
+ 61,228,  2, 65,168,129,101,207,223,  3,162,107,225,124, 69,169, 84,126, 16, 28, 28,220,234,238,221,187,119,244,122,253, 74,  0,
+187,237, 99,221,191,131,147,166,233,213,254,254,254,195,146,147,147,103,  1,216,133,255, 71,248,219,133,150,157,211,206,249, 47,
+228,172,184, 79,200, 63, 45,159,127,136, 45,126, 42, 40, 52,  6,161, 50, 32,226,215,212, 34,178,106,231,148, 81, 29,193, 10,222,
+  3,133,134, 32,200,  1,161, 87,215, 34,178,254, 94,145,  9, 80,152, 87,195,248, 53, 15,132,170,190,189,236,125,190, 10,124,246,
+217,103,228,248,241,227,144,203,229, 48, 24, 12,232,219,183, 47, 22, 46, 92, 72,217,199, 16, 59,231,223,200,249,159,132,192, 94,
+  5,118,216, 81, 43,200, 63, 53, 99,212,187, 15,204,100,111,139,107,200, 99,102,128, 70, 99,128, 77,133,142,205,161,222, 77, 53,
+ 63, 35,231, 21,228, 81,211,192,160, 57,196,108, 18,180,230, 28,106, 82,253, 57,255,130, 55, 68,130,121,255,220,118,249, 55,226,
+ 73, 81, 21, 29, 29,109,175, 20, 59,236,176, 29, 19,240,248, 78,195, 71,223,237, 66,203, 14, 59,254,229,160, 70,220,179,  0,200,
+ 40, 63,254,177,156,118,216, 97,135, 29,255, 15,  5, 23, 40, 84,191,160,173, 46, 38,193,250, 44,180, 59,101,231,172, 23, 39,  3,
+192, 17,128, 19,202,124,144, 84,108,233,173,205,205, 70, 63,  0, 86,123,125,218, 57,237,156,118, 78, 59,167,157,243,127,204, 89,
+ 27,247,191,113, 74,178,170, 93,134, 91,254,142,127, 28, 97,231,252, 83,209,247, 63, 83,118,130, 80, 16,172, 41, 63, 66,237,237,
+110,231,180,115,218, 57,237,156,255,239, 57,255,147,176, 79, 29,254,187, 32,253,215,230,156, 16,111,  0, 21, 78, 46, 99, 97,164,
+130, 33,197, 52,  0, 64, 41,174, 19,130,  4,  0, 33,229,191,167, 83, 84,157,119,163,218, 97,135, 29,118,216, 97,199,255, 10, 97,
+  0,174,  3,240,  6,240, 34,128, 35, 40,247,170,240, 63, 21, 90, 50,215,102,222, 16,208,109, 40,158,  4,  3,  0,161,169,251, 96,
+249, 91,134,252,132,103,126,200, 42, 27, 52,119, 33, 16,239,165, 96, 30,161,205,138,127,102,103,104, 33,205, 29,134,121,186,169,
+ 94,205,201, 47,254,254, 78,156,246,151,186, 92,235,232,232,239, 40,117,113,126,201,100,177,134,136, 69,162, 52, 75, 81,201,150,
+194,194,  7,165,245,200,134, 75, 77, 63,206,155, 71,168,195,217,215, 41,145,220, 66,187, 58,136, 40, 45,180, 68,155,173,228,  3,
+138,146,201,190,125, 35, 72, 93,219,134,162,241,130, 66,165,106, 39,145,202, 59,202, 85,206,205,120,  2, 20,168, 51, 83,204, 86,
+246, 34,103,214,199, 16, 30,103,235,208, 86,175,  1, 88,  2,  0,232,217,243, 20, 66,224,128,213, 21, 25,199,164,158,183,241, 90,
+ 84, 20, 42,156,203,126, 12, 96,105, 29,178,235,  4,192, 31, 64,113, 72, 72,136, 62, 54, 54, 86,243,103,245,209,103,105,247,154,
+ 32,145, 72,101, 86,171,197,194,113,220, 51,  7,166,150,200, 29,230, 62, 21, 94,137,162, 97,212, 22,206,183,143,125,118,216, 97,
+135, 29,127,171,208,122, 17,101, 83,134,181, 47,134,247,111,249,220, 53,169, 84, 22,  0,  0, 60, 33,224,  9,160, 43, 41,138,201,
+121, 16,221, 23,  0,220, 26,133,157, 16, 74, 29,218,241,164,236,119,142,  7, 88,139, 49,185, 36,245, 74,  7, 91,114,164,112,111,
+ 62,180,103, 68,175, 97,  3,  6,188, 24,212, 58,164,117, 19,  0,184, 29,123, 59,233,240,225, 35,113, 81,167,168,253, 58, 77,252,
+129,103, 50,160, 64,186,176,125,251,182,207, 69, 71, 95, 95,  0, 96,202,179,214,160,171,171,114,234,175, 63,205,232,222,107,216,
+ 10,  5, 80,183,  7,174,212,197,249,165,193,  3, 35,219,126,248,238, 68,250,205, 25,139,  3,174,253,118,118,153,210,187, 85, 17,
+225,173,191,234,212, 35, 47,212, 20, 56,249, 73,253, 88,157,192,218, 81,112,156, 94,243, 93,103,103, 67, 65,210, 72,194,115, 35,
+ 41,138,  2, 35,150,239,115, 15,124,110,143,211, 11,239, 23,  2,176,121,199,152,131,119,203,  8, 15,111,223,253, 35,199, 77,151,
+202, 29, 61,  5, 96, 68,  0, 40,100,165,220, 67,212,238, 37,206,239,205,223, 26,246,219,173, 84,246,244, 79, 95, 26, 41,145,112,
+152, 62,251,110,237,243,233,169,169, 78,240,247, 47,251,251,235,175, 63, 67, 64,227,219, 40, 91,107,  6,172, 66,241, 15, 89,  8,
+  1,202,132, 86, 74, 10,156,109,205,107,223,254, 47,247, 78, 75, 77, 88,144,149,153,246, 11, 45, 16,240,133,197,186,247, 93, 93,
+ 61,180,249,249,185, 61, 80,190,144,219,205,205, 77,145,151,151,103,  1, 96,249, 59,219,253,165, 55, 22,126,189,239,187,207,222,
+170,234,183,201,239, 45, 92,237,239,235,164,120,119,202,248, 42,  3,114, 63, 31, 57,254,195,115,199,183, 46,175, 85, 16, 43, 84,
+115,135,191, 53,123,222, 11, 61,251, 60,150,126,229,210, 69,236,220,240, 25,116,165,118,177,101,135, 29,118,216,241, 55,224, 72,
+185,184, 58,242,228, 15,213, 10, 45,169, 84, 22,112,249,236, 97,151,  3, 23,211,  1,  0, 17, 97, 94,248,100,209,250, 62,219,215,
+ 69,199,  1, 64,231,158,  3,154, 47,248,248, 93,252,126, 39, 23,132, 16,180,109,234,138,126,131, 71,216, 38, 60, 60, 91,116,120,
+233,165,225,163,103,204,248, 96, 80, 98, 98, 98,202,174, 93,187, 46,  0, 64,183,238,221,155, 46, 94,188,248,229, 21,206, 46,146,
+ 31,247,253,148,105, 84,223,187, 86,159,210, 74, 27,  4,250,  4, 53,107,252,234,143,223,174,167, 95,232, 59,124, 84, 10,116, 75,
+140, 89, 15, 50,109,185,214,205,205,109,154, 80, 40,116,  4,202,162,177, 87,192, 98, 33, 94,  0,192,114,188,202,185, 65, 80, 41,
+ 35,146,114, 18,137,232,110,169, 86,251,125, 73,230,189,111,106,226, 52, 89,173,173,222,155,244,  6,125,227, 65, 62,  2, 90,117,
+ 99,214, 44,249, 20, 60,103,117,158,254,241,162,151,162,175,252,  8,157, 26,231,108, 44,154,240,201,  4, 31,159,112,102,225, 18,
+101,111,138,194,235,254,157,199, 13, 89,176,109,159,176,125, 83,  7,152,172, 60,142,197,228,119,222,184,122,225,242,223, 54,190,
+120,  8,192,102,  0,167,  1,212, 42,234, 92, 92, 93,118, 76,155,189, 90,169, 51,255, 97, 37, 41, 23, 89,248,250,251,189,184,153,
+206, 35, 56, 40, 88,224, 53,109,153,114,243,162,  9,219,244,101,113,182,170,146,187,129,  0,186,  2,247, 93,240,246,252, 94,248,
+ 97,233,231,240,240,208, 65,165, 74,  3,  5, 79,  0,205,202, 79, 76, 16,231, 33, 29,192,199,185,185, 80, 44,152,136,190, 55,128,
+143, 66,129, 92,  0,191, 81, 53, 69,141, 39,236,146,247,102, 45, 15,113,111, 28,210, 49, 54, 46, 19,151,143,124,  9, 77, 78,170,
+ 83, 97, 97,222,247, 13,155,134, 18,133,163,123, 88, 81,206, 67, 56, 56,225, 33, 69,184,193,197,197,133, 57,  0,108,178, 34,121,
+121,121,205,245,241,235,212,189,162,221, 93,252,219, 22, 86,252, 70, 51,130, 29,121, 15,175,189, 91,211,245,254,193,  3,199, 47,
+249,178, 91,143,251, 55, 79,236, 77,123, 16,115,145,181, 90, 76,205,130,218,180,127,227,245, 81, 47,223,207,116, 11,213, 20,153,
+112,243,246,157,182, 75,151,126,177,244, 78,236,237,219, 42,149,147,115,227,230,161,157,130,219,244, 31, 85, 96,118,  9,180, 69,
+104,177, 44,  7, 87,175, 64,  8,165, 42,248,122, 58,162,168,212,  4,157,137,133,155, 87, 99,176, 44,107, 31,250,236,176,195, 14,
+ 59,254, 30,100,227,241,197,239, 91,106, 21, 90,  0,160,148,  9, 16,247, 48,  7,  0,224, 36,  3,166,190, 61, 22,249,121,154,230,
+102,150,199,184,177, 99,112,253,126, 54,226,146, 53, 32,132,160,185,175,205, 65,184,193,128,111, 63,110,252,184,231, 79,252,250,
+235,213,207,102,127,246,  3, 69,225, 18,  0,108,222,242,117,231, 57,115,231,188, 53,102,236,152,222,251,246,237,187,  3,160, 94,
+ 66, 75, 64,169,214, 47, 95,250,185, 56, 35,207,104,156, 54, 99, 22,255,193,251,211,214,  0, 24,110,147,146, 17, 10, 29, 51, 50,
+ 50,148, 52,253,120, 44,205, 47, 62,159,117,190,247,176, 21,  9, 41,105, 69, 55, 78, 28, 60,216,161,101,203,150,200,200,204,233,
+186,108,237,166,208, 99, 39,100,111,148,150, 24,134,233,243,238, 85, 25,180, 89, 34, 20,222,153,191,108, 99, 91,222,169, 41,253,
+201, 91,253,209,170, 73,  3,100,230, 22,161,123,223, 65,130,152,107,215,250,  0, 54, 11,173, 39,157,  7,190,100,230,115, 67, 23,
+127,127,165,215,144, 46, 13,218,211, 52,  3,173,193, 10, 77,177,  9, 28, 15,116,107,225,136,200,237,107,  5,  5, 58,235,208, 69,
+ 63,165, 15,189,180,110,128,218, 88,156,245, 14,128,253,181,216,  3, 93,124, 61, 28, 16,151, 94, 90,165,200,210, 25,203, 30,224,
+ 34,134,  3,  5,226, 90,  3, 81, 87,  0,223,  1,193,192,201,119, 70,195,211,115,151,167,167,231, 75, 30,158, 94, 49,205, 71,191,
+ 65,249,  4,180, 80,105, 13, 22,220,189,115,187,180,101,187, 88, 82, 90,144, 59,221,168, 43,220,119, 15,136, 13,  6,246,148,115,
+188,129, 26,132, 86, 66,194,189,162, 55, 94,233, 33,184,145, 84,138,  7, 10,  5, 90,117, 25,130, 98, 77,134, 48,242,141,249,157,
+ 12,165,197, 82, 87, 79,127,220,251,125, 47, 52,105,137,109,141,102,211,  1, 23,191,206, 61, 14,125,247,145,185, 54,235,150,151,
+151,215,220,183,223,126,123,158, 38,251,254,194,222,195, 86,180, 73, 73, 43,186, 49,122,254,153, 14,147,135, 54,197,177, 91, 37,
+248,124,124,143, 87,  1,212, 40,180, 24,  1,225,164, 74,175,128, 97,175,188, 51,171,129,187,116,150, 92, 70,195, 73, 33,198,175,
+ 87,114,241,227,175,233,176,178,  4,225,109,154, 53,159,250,225,234,109,222,174, 98,100,231,153,145,169, 49, 66,157,103,132, 54,
+ 95,111,178,169, 67, 80, 20,114, 53,249, 56,114,232,  8, 40,161, 20, 20, 77,193,106,177, 64, 64,211,160,104,202, 62,244,217, 97,
+135, 29,118,252, 61,168,118,215,161,  0,  0, 14, 31, 62, 76,  6, 12, 24,240,212,168,204,113,  4,113,201,101, 75,112, 24,134,193,
+139,207, 53,197,154,101,243, 97, 48,179,184,249,176, 24,  7,126, 79,135, 89, 87,  4, 66,  8,242, 90,121, 84,245,143, 31,155, 82,
+ 90,177, 68, 22,198, 72,132, 35,127,187,162,104,228,226,236,236,156,112,231,  7,221,156,247,213, 45,  4,196, 18,179,232,139,166,
+ 15, 69, 46,130, 46,123,247,238,105, 57,112,192,  0,177, 82,169,154, 73,  4,161,190, 66, 29,249,160,184,248, 86,113,117,156, 79,
+ 66,230, 17, 60,104,208,139,145, 61,189,188, 60,249,209,139,175,220, 95,255, 78,152, 95,179,166,205,186,198, 89, 13,131, 12,185,
+  9,  7,171,185,236, 17, 39,207,243,160,105, 26,106,181, 26, 28,199,193,100, 50,193,106,181, 34, 61, 61, 69,205, 19,226,203,129,
+167,189,189,125, 33, 16,136, 17,208,200, 31, 27,215, 44,145,111,255,241, 96,199,143, 62, 91,248,139, 62, 15,225,248,195,185,229,
+ 35, 78, 99, 65,225,190,163,199,127,117, 39,136,106,240,201, 91,253,153,220, 66, 45,162,174, 37,226,250,221,244,186, 54,228,147,
+ 46, 28, 26,101,166, 38,150,172, 88,177,130, 89,112, 44, 49,189,103,191,225,156,127,147, 54,141, 76, 28,  1, 64, 65, 34, 18, 64,
+ 36,160,225,239, 46,197,207,179, 66,112,101,240, 45,207, 62, 97,238,171,  9, 33,251,107,170, 79,147,201,202, 61, 23,172, 96, 66,
+  3, 29,113, 43,169, 16, 87,143, 93,194,180,217,171, 17,253,208,132, 82,173, 30, 20,103,  2, 67, 76,200, 75,125,  0,150,227, 72,
+109,237, 94,134,176, 66,  0,144, 72, 36, 31, 31, 56,116,188,129,137,151, 34,167,200,  4,117,161,  9, 77,195,135, 41, 82, 51, 53,
+248,110,254,203, 31,  3,216, 23, 12,148,218,192, 41,  1,208, 35,229, 97,188,213,108,230,120,163,133,163, 91,249, 57,226,155,147,
+215, 16,210,227, 21,163,152, 97,100, 42, 71, 55,128,  0,173,186,191,130,171,191,108,128,146,102,218,201, 28, 36,161,  0,174,214,
+212,151, 42, 68,214,220,185,115, 49,229,237,151,193, 19, 34,228,192,211,  0,240,213,129, 68,248,  7,120,212,212, 70,127,132,139,
+225,104,202, 98, 33, 40,213, 90,161, 41, 50, 67, 37, 21, 32, 62, 77,135,196, 84, 45, 94,238,235,131, 97,189,188,193,241,  4, 99,
+102, 94,199,240, 62,222, 24, 61,192, 23,160, 40,228, 21,154, 97, 50,115,213,150,157,166,233,198, 12,195,132,113, 28,119,189,236,
+ 59,  3, 14, 64, 73, 97, 30, 76, 38, 19, 24,134,129,179,139, 59,  0,234,177,115,121,158,127,104,235,125, 84, 79,216, 57,237,156,
+118, 78, 59,103,189, 81,157, 22,249,151,160, 90, 87, 14,116, 77, 87, 37,165, 23, 32,238, 97, 14,218,  5,251,160, 73, 35,111, 92,
+141, 47,196,142,168,116,108, 61,145,138,168,155, 26,240,  2, 21,114, 74,128,132, 20, 53, 18, 82,243,106,245,159,205, 72,132, 35,
+223,123,175,120, 70,235,150, 37,225,103,143, 77,133,143,123, 66,203,143, 62, 42,154,202, 72,132, 35,157, 27,170,118,205,154, 49,
+253, 85,149, 92, 46, 54,155,204,  8,108,236, 47,125,247,157,169,111, 80,206, 18,155, 99, 34,169,124, 90, 56, 75,100,178,111, 22,
+205,155, 41, 89,125, 32, 33, 77,103,134,110,255, 37,245,131, 15,102,205, 41, 16,  8,165, 27, 85, 62, 45,108, 94,251, 99,181, 90,
+ 97, 50,153, 96, 54,155, 97,177, 88,144,153,126,111,208,233,  3, 31,246,109,220,208,165,175, 68, 42,  5,  1, 80, 98, 96,241, 48,
+ 91,143, 30,189,122, 51,237,194,194, 90, 41,189, 91,140,175,138,171,184, 56,181,152, 39,140,234,240,207, 59,153, 61, 39,111,224,
+135,195,215,240,203,153, 27,184,122,238, 24, 75,120,235,163,248, 95, 74,239,166,205,149,222,173, 83,149, 13,218,168, 31, 29, 62,
+ 33, 53,186,103,102, 24,154,244,232, 21,113,234,237, 41,239,158,213,151,230,231,126,179,126,126,166, 38, 43,229,158, 68, 68,177,
+114,  9,  3,173,145,197,182,211, 89,120,105,201, 77,220, 77,211,130, 16, 82,107,  0,111, 30,120,127,228,248, 15, 57,171,197,130,
+ 32, 63, 37,118,110, 89,138, 65, 61, 66,209,179,181, 51, 58, 52, 81, 64, 46, 48,225,206,253, 56,236,222,185,141,229,121,250,131,
+ 90,110,196,200,242, 35,  6,  0,180, 90,237,135, 31,205,252, 64, 99,102,121, 88,172, 60, 44,229,159,167,119,127,161,225,140,250,
+ 15,203,175,139,169,116, 93,117, 55,243,186, 55, 39,127,212,227,155, 29,167,122,239, 63,159, 77,171,243, 45,136, 58,190, 15,222,
+ 13,  3, 33, 98,104, 25, 40,  0, 20,  5, 80, 20,  8, 33,112,247,111,  1, 35,207,227,167, 77,159,250,160,134,245,106, 21, 34,107,
+194,132,  9,184,119,239,222, 99,237,158,148,152,140,164,196,100,156, 58,113, 25,  0,224,226,223,182,208,197,191,109,161, 91,227,
+ 14,155,171,226, 50,115, 86,222,192,114,200, 41, 50, 66, 46,165,225,231, 35,199,208,158,222, 88,255, 73, 27,140,238,239,131, 12,
+181, 30, 19, 22,222,132,167,167, 16, 63,159,207,198,186, 93, 73,104,230,175,192,144,158, 13,240,250, 64,223,170,173,181,  2, 65,
+ 63,161, 80, 56,106,200,144,161,243, 37, 82,197,146,119, 22,238,152, 39,147,  8, 42,172,177, 96, 24,  6, 86,171, 21, 52, 77, 97,
+228,180,245,243, 36,114,213,146, 33, 67,134,206, 23, 10,133,163,  4,  2, 65, 63,251, 75,167, 29,118,216, 97,199, 95,102,209,170,
+ 56,188, 31, 27,183,171,187,194,104, 52, 36, 15, 31, 57,  6,222, 30, 94,202,193, 47,188, 46,138, 73, 42,130, 38, 59, 21,137,241,
+177,208, 27,173, 16, 57, 55,  6,164, 94,104, 20,224,143, 91,113,191, 88,214, 45, 63,162,229, 89, 83,114,117,124,131,  6,121,251,
+ 38,222,167,232,229,203,252, 46,199,199, 21,182,219, 57,251, 59,140, 30,173,116, 91,190,204,239,114,202,  3,  5, 45,151,146, 46,
+111,140, 29, 69,209, 20,193, 71, 31,205,192,224,  1,145, 24,247,198,107,212,247,223,111, 11, 47,178,177,148, 60,132, 27, 62,254,
+116,190, 88, 93,196,154,175,198,107, 77,114,133, 76,246, 91,130, 86,215, 42,192, 79,214,127,216,235, 89, 71,246,126,179, 26,192,
+ 88, 91,184, 42,  4,150,213,106,133,197, 98,  1,  0,174,204,122, 80,246,153, 95,106, 70,110,145,  9,234, 34, 19, 88,142,199,176,
+145, 99,101,215,162,111,142,  5, 80,205,122, 45,158,183,178, 86,236, 63,121, 29,153,215,246,241, 20,205, 20, 87, 90, 12, 15,165,
+119,211,230, 94, 94,126,231,  7, 12,123,205, 93, 44, 45,155,134, 45,213,153,240,253,166,101, 53,230,147,166, 40,194,115,108, 17,
+107,181,234,  2, 27,  7,102,  6,183, 12,149, 94, 60,123, 98,208,111,167,246,107,217,192,215,156,146, 82,178,193,  8, 37, 96, 68,
+ 82,152, 44,182,109, 60, 84, 39, 94,254, 18,  0, 53,126,242,140, 53,211, 63,252,132,121,127,221,  5,152,141,122,152, 12, 58,148,
+ 20, 23, 66, 38,176,226,206,239,  7, 89,194, 89,167,235,178,111,124, 89, 61, 19,149,  5, 32,171,114, 74, 65, 65, 65,212,239, 23,
+206, 31,186,242,251,133,113, 94,129,237,104,179,149, 71, 98,236, 21, 62, 51, 33,250,144,201, 84, 18,  5,  0, 20,144, 15,224, 68,
+ 77,134, 75,149,131,147,227,184, 41, 31,142,119,146, 41,232,216,140, 34,164,102,151,128,147,249,192,203,183,201, 31,243,171,124,
+ 89,121, 59,  6,185,163, 79,232,203,184,120, 59,141, 59,177,231,203,222,  0, 14,  2,208,215, 36,178, 98, 98, 98, 32, 18,137, 30,
+107,247, 38, 77,  3, 80, 49,117, 88, 84, 48,213,105,219,242,215,  1,  0, 61,159,235, 62,  1,192,219, 79,189,168,228,148,192,213,
+204,162, 83, 11, 23,  4, 53, 86, 34, 51,223, 12, 66,  9,176,247,116, 30, 18, 50,116, 56,121, 85,  3,111, 23, 49,120, 51, 13, 70,
+  2,236,191,152,137,139,119,242, 48,166, 95, 67,220,127, 88, 80,141,176,102,194,222,255, 96,198,130,181,107,215,157, 25, 62,121,
+249, 75,221,194,  2, 81, 82,170, 69,102,129, 21, 90, 93, 41,116, 90, 29,100,114, 57, 36, 98, 49, 24,129,  0,253,222,248,252,165,
+163,223,125,122,246,253, 15,102, 44, 88,181,114,197, 28,150,101,143,217,199, 67, 59,236,176,195,142,191,212,162, 53,161,114, 90,
+181, 66, 43,245,238,197, 14,  0,208,188,125,159,124,165, 84,224, 34,160, 41,168, 51,146,240,253,138,105,224,121,130,254,111, 45,
+135, 42,192, 11, 50, 17,  3,147, 54, 95, 91,144,116,174,166,181, 58,160, 40,107,239, 47, 55,103,  6, 76,158, 20,232,176,115,167,
+ 86,  8,  0, 59,119,106,133,147, 38, 54,116,248,106,115,114, 64,167,231,218,129,112, 28,  6, 12, 30,142,145,175,140, 68, 74,142,
+ 30, 63,157, 79,131,206, 96,182,105,183,156,204, 45, 56,212,205,213, 61,242,189,215, 35, 21,  2,134,162,154,249, 59, 50,233, 26,
+ 43,203, 48, 66,238,208,181,226,172, 97,195, 94,113,139, 58,186,167, 39,231, 22, 28,106,200,187,127,179, 54, 62,147,201,244,216,
+212,161,139, 91,227,163,189,135,175,200,200,206, 41, 61,146, 83,104,236,164,179,178, 80, 23,153,144, 91,100, 66,145,206,  2, 47,
+149, 51, 88,171,185,117,117,124,132,144, 31,134, 12, 31,243, 26,  0,154,162,217,239,180,217,247,227,203,126,249, 67,100, 69, 14,
+ 30,237,126, 62, 38,  9,137,209,199, 10,  9,207,150,121,113,167,248,140,154,235, 21,132,161,192,139,  4,148,149,161,105,222, 98,
+209, 90, 61, 60,220,163,206, 69, 29, 31,104,100, 31,128, 17, 73, 30,157,107,120,124, 58,170, 54,177,181,  1,  0,214,174, 91,179,
+178, 75,239,209,162,115,215,147, 97,176,  2,157,195,154,227,231, 31,191, 54, 17, 98,253, 80,151,125, 99, 67, 29, 58,161, 83,195,
+134, 13,167,  9,197,226,158, 50,185,170,161,187,183, 31,109, 97, 57, 88,172, 28, 20,174, 62,180, 68,233,210,155,167, 69, 23, 89,
+139, 57,202,162,211,172,  5, 80,173,190, 62,121,249,110,207, 77,107, 87,190,228,237,170, 64, 67, 55, 17, 14,157, 43,228,172,  2,
+158,246,240, 15,162,  0,192,207,195,  1,119,175,159,197,173, 91,183,209,186,115, 36, 92, 85,190, 80,138, 56,146,151,248, 91,129,
+167,151, 79, 91,117, 78,166,232, 73,161,229,229,229, 53,119,204,152, 49,243,188,189,189,177,102,205,154, 71,233,149,219, 61,  4,
+232, 84,121,234,240,171,  3,137, 53, 22,248,141,  1,141,240, 92,168,  7,120, 30,120,119,245, 45,196, 38,149, 96,203,199, 97, 24,
+214,195,  7,155,127, 73, 70,155,102, 10,104, 13, 60, 44,102, 14, 34, 49,141, 22,141,149,144,136, 24,156,185,158,135, 82,157,174,
+ 70,110,138,145,160,119,143,206,200, 43,210,195,221, 81,140,198, 13,221,161,148, 55, 70,169,129, 69,106, 78, 49,138,117, 86,228,
+ 21,234,208,181,115, 71,252,186, 93,108, 31,  2,237,176,195, 14, 59,254, 30,171, 22, 80,201,135,214, 99, 66,235,240,225,195,  4,
+  0,170,154, 31,205, 84, 23,192, 85, 41,128,123,131,  0,188, 58,109, 37,126, 88,253, 62, 56,206, 10, 66,  0,150,179,205, 51,  1,
+ 33,194,147, 83, 38,  5,  4, 55, 10, 96,220, 95, 29, 45, 55,236,216,169,151,189, 58, 90,110,  8,105,237, 90, 60,101, 82, 64,114,
+169,209,175, 43,203,113,248,237, 78, 46, 98,147,139, 17,155, 82,  2,165,204,118, 55, 95,140, 88, 52,105,217,210, 37, 34,  1, 67,
+ 81,119, 82,181,218,140,124, 86,203,  8,133, 22,185, 76, 76,204, 68, 96, 74,201, 35,249,189,134,188, 97, 56,180,125,237,120,  0,
+239, 84,107, 21, 43,223,105, 88, 97,201,170,248, 36,132, 16, 10,224,121,138,227, 50,242,140,208, 90,172, 80, 23,254, 33,180, 40,
+182,250,153, 83,165,119,211,230, 14, 42,229,113,134, 97, 36,132,  0, 86, 11,251, 50,188,155,246,213,102, 39,198, 87, 22, 89,151,
+239,100, 33,233,198, 41, 53,103,209,143,209,231,198,157,182,181,236, 20,  5,194, 48,224, 25,154,226, 41, 10,188,144, 38,102, 16,
+194, 63,153, 35,125, 29,132, 86,133,216, 18, 11,153,217,191,238, 94,237, 49,238,197, 22,248,241,124,153,230, 51,150,106, 74,116,
+153,117, 18, 89,112,117,117, 29, 59,115,230,204,185,131,134,143, 70,177,145,130,186,176,204, 26,104,182,242, 16, 41,220,208,123,
+202,183, 13,179, 53, 37, 13, 19,175, 30,234,154,119, 99,103,177,213, 88,188,166,218,124, 37,101, 93, 53,232,117, 40, 49,148,149,
+103,198,216, 32,230,179, 47, 79,130, 37,  2,184,184,251,192,221, 65,132,215, 95,238,135,243,254,141,112,239,254,125,204,158,127,
+  4,158, 78, 14,177,151,206, 30,108, 18, 22,222,109,213,209,  3,187,158, 18,113, 57, 57, 57,243,183,111,223,142,208,208,208,121,
+237,218,181, 67, 78, 78, 78,133, 64,126,212,238, 73,137,101,  6,219, 10,161,117,253,250, 45,132,133,181,169,182,204,173,155, 56,
+ 96,223,153, 44,124,123, 56,  5, 50,  9,131,  0, 31, 41, 38, 45,187,129, 30,109,221, 48,117, 68, 99, 40,101,254, 40, 42,181,194,
+108,229, 97, 48,177,200, 47,177, 32, 51,223,136,116,181,  1, 22,107,205,107,225,  9,  8, 98,227, 51, 96, 50, 25,225,236,236, 12,
+165,220,  8,169,147, 31,  0,  6,133,234,226,178,221,135,122, 35,228, 50,137,125,232,179,195, 14, 59,254, 53,168, 73,139,252,139,
+172, 90, 79, 91,180,106, 42, 16, 33, 64, 66,106, 30, 26,249,186,195,183, 81, 19,196,223,187, 85,105,176,  7, 88,206,182,233,168,
+131,  7,179, 51, 86,174,116,224,223,127,191,184,243,178,101,126,151, 38, 77,108,232, 24,210,218,181,120,230,204,180,206,171, 86,
+ 57, 94, 58,121, 89,200,145,114,127, 93, 21,190,185,  8,169,139,143, 77,186, 99,104,203,198,204,252,157,  9,105,167,111,151,230,
+138, 68, 34,171,151,179,148, 82, 41,197, 12, 67, 11,197, 38, 43,109,106,222, 42,140, 57, 68, 83, 97, 53,177, 84,  8,173, 39,167,
+ 14,243, 53, 73,131,126,253,105, 70,200, 11, 67,150,187,100,106, 12, 40, 54, 51,143,166, 14, 25,154,194,237,123,169,  0, 35,138,
+173,138,211, 65,229,114, 98,215,142, 31,252, 86, 45,251, 28, 22,150,195,148,247, 63,195, 27, 99,199,156,128,119,211,190,126,  1,
+ 65, 49, 23, 14,125, 39,239, 59,113, 35, 82,227,162,115, 88, 83,201,238,186,136,172, 71, 98, 11, 32, 28,225,233,130,194, 18,165,
+137,133, 20, 85,232, 62,147,133,175, 87,207,209, 26, 88, 28,186,146,131,195,  7,118,195, 81,165,168, 23,135,163,163, 99,139,238,
+221,159,  7, 37, 16,195,108, 53,193,204,242, 48, 87, 90,163,101,177,242,176, 18, 33,228,222,109, 80,112,247,231, 22, 48, 22, 87,
+203,245,218,107,125, 10, 90,182,110,183,247,211,247,223, 26, 49,226,213,113,232, 20,254, 28,226,110,253, 14,207,134,193, 80, 58,
+185,145, 75,201,133,108,231, 96, 63,193,216,193, 29,168, 40,223, 64,  4,180,232,130,132,187,215, 90,139, 68,162,219,105,137,247,
+171,157,146,204,201,201,169,240, 57, 53,175, 93,187,118, 72, 75, 75, 67, 65,165,118,111,210, 52,  0,  0, 16,127,191,108, 19, 67,
+133,200,226,249,170,251,233,132, 37, 55, 80, 98,224,224,230, 44,  6, 67,209,  0, 33,104,228, 45, 67,116, 66,  1,198,204, 47, 68,
+120, 75, 23,248,121,203,  1, 66,160, 53, 90, 97, 54,243,176,240,128,217,200,130,161,171,221, 50,200,113, 28,199,209,196,202, 92,
+143,141,135, 88, 36,132, 99,145, 14, 50,153, 12, 34, 81, 30, 40,154,  6,203,242,176, 88,173, 48,232, 13,216, 27,125, 25,132,179,
+ 48, 28,199,113, 40,159,  6,181,195, 14, 59,236,248, 39,226, 95,188, 16,190,178,184,170,222,162, 85, 19,252,125, 61,113, 37, 54,
+ 25,173,131, 27,195,209, 65,133,251, 73, 25, 96,104, 33,104, 10,176,178,182,139, 33, 98,177,254,184,106,149, 35, 82,147, 21,244,
+ 87, 27,147,  3,166, 76, 10, 72, 94,181,202,241, 18,177, 88,127,  4, 48,134, 16,160, 76,108,149,  9, 46,174, 14,186,128,240,214,
+134,158, 46,114, 38,250,129, 46,159,166, 25,147,171,163,148,119,117,148,208,174, 42,177, 80, 36,100,120,150,208, 22, 95,143,  0,
+ 35,225,121, 91,226,234, 61, 54,117,200,113, 28, 40,138,230,202,133,152, 34, 61,223,128, 98, 35,  3,117,145,  9,133,165, 22, 52,
+243, 81,224, 84,212, 62, 61,103, 53,236,172,210,218, 38, 20, 57, 54,  9,240,197, 39, 11, 87,193, 96,226,144,144,169,133, 72, 34,
+241,242,244,106,117,115,204,228, 89,146,119,183, 36, 97,124, 79, 87,188,127, 33, 41, 83,175,150,206,170, 75,203,114, 28,  7,131,
+209, 44, 82,231, 21, 58,151,148,234, 28,100, 82,137,193,221,197, 49,175,170,115,141,230,250, 61,103,229, 82,  1,  6,134,123,193,
+104, 25,  5,131,137,197,239,167,247,215,135,166,177,103,  3, 95,104,205,149,196, 85,185,216,170, 44,186,132, 74,119,  0, 84,227,
+218,138,125,247,118,204,203,119,111,199, 44,184,118,233,220,174,101,223,156, 14,217,190, 97, 14,214,255,146,  4,134, 97, 40, 98,
+101,133,107,127, 73,134,175, 19, 67,180, 86, 33,101,228, 40,232, 10, 52,  8,234,216,175,213,174, 47, 63,157,133, 50,151, 17, 38,
+ 91,196, 86,161, 58,250, 81,187, 31, 63,246,104,223,  2, 10,111,110, 43, 74, 58,179,190, 76,226, 51,130,125, 85,171,118,139,217,
+195, 81, 76, 56,214,194, 87,246,104,229, 40,163, 64,120,224,218, 29, 53,174,199,211,112,117, 16, 65, 41, 19,194,202,242,208,155,
+ 89, 24,140, 28,205,179, 22, 83, 53,237,125,125,237,154,213,115, 70,141, 26, 53,105,247,158,121,  7, 67, 35,223, 27, 84, 82,148,
+ 15,161, 88,  6,145, 64,  4,154,161,193,114, 28,204, 70, 29, 10,139, 10,144,252,219,247,  7, 71,142, 24, 26,182,118,205,234, 57,
+ 21,187, 20,237,176,195, 14, 59,236,248,203,172, 89, 79,193, 38,161,165,148, 75, 65, 24, 41, 46,196, 36, 33,168,101, 27,108, 59,
+120, 21, 77, 91,135, 35,187,148,  5,  1, 93,235,110,195, 10,204,248,216,112, 29,192,245, 65,131,228,190, 67,135,250,244, 38, 68,
+120,114,227,230,146, 12,  0,104, 28, 82, 70,195,243,  4,132,  0,132, 47, 19, 92,182,155,116,  4,169,201,217, 37,141,  2,188, 20,
+184,155, 97, 49, 41, 36, 34,218, 89, 33,102,220, 29,197, 34,145, 64,  0,142, 80,166,236,236, 36, 19,  5,164,216, 66,247,228,212,
+161, 92,233,125,180,215,144,229,154,148,180,226,232,102,  5,250,208, 98,139,179,110, 80,142,  0,  0, 32,  0, 73, 68, 65, 84, 24,
+132,  0,205,124, 20,136,189,124,132, 83,103, 38, 38, 24,212,113,155,170,182,146,129,177,176, 60,110, 62, 40, 70,145,206,138, 34,
+173,  5, 93,123, 12, 20,117,141, 24,132, 11,177,121,224, 89, 43,150,125,125,164,148, 35,214,145,192, 61,107, 29, 10, 77, 95,185,
+126,199, 87, 83,168,147,  8,  5,130,162,224,166,254, 15,197, 34, 33, 91, 82, 82, 34,126,252, 44,  6, 10,153, 24,  5, 90, 43,  0,
+ 88,235,218,123,138,117, 86, 28,188,156,131, 67,251,119, 65, 38,147,129,212,163,  7,138, 68, 34, 39,161, 72, 10,139,174,108,186,
+176,226,176, 60,113,208,  2,  9, 64, 11,156,108,164,189,103, 54, 27,126, 79,142,187,220,130,235,209,148, 25, 27, 17,128,215, 38,
+ 76,135, 79,147,214, 24, 56,112, 40,218,  4,168,168,253,151,210, 96,181,178,165, 94,129,173, 84,164,108,151,109,  2,128, 80,  0,
+151,109,177,108,169, 42,181,123,139,174,129,161,127,  8, 45,160, 32,245, 70,141,187, 88, 57,115,126,166,222, 76,211,132,240, 85,
+190, 50,  8,  1, 16, 51,160,206, 38,200,  1, 32,160,  1,  1, 67,  3, 20,197,112, 28, 87,101, 59,177, 44,251, 43,207,243,234, 29,
+ 59,118,168, 57,142,187, 30,115,100,229,205, 38, 47, 76,156,  7,182,  0, 86,107,217,114, 70,177, 68, 14,158,162,145,116,254,219,
+121,156,197,240,203,142, 29, 59, 42,220, 59,220,182,143,133,118,216, 97,135, 29,127,  9, 42,199, 56,124,177,178,248,178, 73,104,
+113, 60,129,155,171, 11,172, 68,128,100,117, 49,116,148,  7,140,122,  2,142,163,192, 17, 82,147,171,241,  8, 84,177, 61,255,224,
+193,236, 12,  0, 91,159,176, 73, 61,178,100, 61,250,172,122, 74,166, 74, 78,138,112,167, 14, 30, 59, 59, 98, 80,183,158,206,247,
+179,115, 50, 68, 66, 90, 32, 16, 49, 66,145,128,166, 68,  2,218,236, 32, 19, 48,251, 54,239, 22, 19, 10,103,107,227, 52, 26,141,
+136,136,120, 60, 48,121,220,157, 75, 30,  5,185,  9,102, 66,241,188,187,184, 20,110,142,238,120,152,146,134,211,199,246,235,213,
+153,137,113,156,201, 56, 24,143, 75,206, 63, 56,  9,225, 11,138, 77, 48, 90, 56, 20,106, 45, 40,210, 89,192,186,119,198,207,191,
+103, 65, 42, 98,160,190,185,207,160,201,201,152,102,202, 77, 76,174,165, 41, 62,194, 99,190,180, 72,198,155,227,198, 10, 87,175,
+ 88,102, 10, 11,107, 71, 10, 10, 10,160,213,106,255,168, 19,138,130,212,193,  3, 42,153,  0,137,215,142, 34,241,244, 42,  3,128,
+ 79,109,169,207,202,112,144, 11, 48,168,147, 23, 76,150, 81,200, 43, 54,225,218,217,159,107,235, 50, 79,113,202,229,114, 89,133,
+245,170,178, 91,  7,115, 37,171, 22, 87,222,222,180, 64, 34,171,130,179, 55,128,147, 79, 38,150, 20, 23, 31,185,126,233,212, 36,
+227,132,215,160, 46, 50,193,144,159,132,239,127,222,116,218, 82,154,208,163,207,234, 21,244,244,193, 77,112,250,122,129,234,182,
+128,  1,120, 32,114,212,140,151,142,239, 90,177,189,182,178, 87,136,173,231,187,117,152, 71, 51,212, 33, 66,253, 33,150,178,178,
+178,108, 42,123,177, 58,177,220,130, 84,167, 57,112, 80, 20,205, 16,254,177, 24,136,143,229,147,231,249,219, 21,162, 73, 64, 81,
+131, 85,114, 57,242, 52,197,168,112,178,107, 52,148,194,197,173,  1,104,138,130,181,210,185,117,109,247,122,192,206,105,231,180,
+115,218, 57,255,191,226,169, 24,135,117,176,104, 17,  4,122, 43,208,212, 71,  1,163,197,  3, 70, 51,  7,157,145, 67,137,222,130,
+ 18,189, 21,201, 57,122,196, 30,124,246, 28,150, 89,177,202, 92,159,147, 50,127,155,224,120, 98,179,245, 68,108, 49, 47, 92,185,
+108,241,203,187,195,218,154,223,125,209,187,225,173,100,115, 22, 69,209,  6,154, 17, 88, 93, 84,  2,225,253,251,183, 52,151,206,
+ 31,237, 46,101,185,215,244, 53,240,176, 44, 91,236,227,227, 83,241, 64,123,148,222,162,137,108,240,111, 71, 62,106,252,252,160,
+101,238,171, 63,159,161,167, 25, 17, 79,  9, 68,177,156,213,176,203,160,142,219,136, 26,236,122,180, 72,122,239,202,141,187,225,
+ 78, 46, 13,145,152,169,131,206,200,194,194,242,112, 86,138,144,113,251,132, 37,249,126,244, 30,109,214,173,109,245,168,182,157,
+241,247, 98,125, 35, 35,251, 14, 15, 15,239,204,204,153,243, 25,130,130,130, 96, 48, 24, 64,211, 52, 26, 54,106,130,228,248, 27,
+184,124,100, 33,167,207, 79,217,  4, 96,  1,128, 58,  7, 92,206, 43, 49,227, 88,116, 46,142, 28,248, 17,140,176, 94, 59,216,104,
+153, 76, 38,173, 74, 92, 85, 22, 93,143, 78, 22,138,165, 40,179, 62,241,143,117,196,170,113, 60, 41,254,238,189,215, 95,125,165,
+133,202,209,  9,253,135,142,204,189,116,225,244,128,  3,223,111, 94,147,159,146,254,242,103, 75,214, 57,244,110,239, 77,185, 40,
+197, 40,210,241,216,153,122, 47, 16, 54,218, 96,115,114,114,230,167, 39, 71,143,249,237,200, 71,  3,159, 31,180,204, 61,250,167,
+217,143, 22,209,211,140, 96, 71,109,215, 23,164,199,156,174,171,200,170,144, 90,132, 16,155, 38,206,  9,  0,161, 72, 12, 15, 15,
+111, 80, 20, 96,101,121,152,173, 44,  4, 66,251, 78, 67, 59,236,176,195,142,191, 25, 19,158,248,180,205,162,101, 52, 26,147,159,
+139, 24,  8,158, 39,224,  8,192,115,229,150, 39,254, 15,235, 19,103, 53, 38, 63,107,238,120,158,187,186, 97,203,214,254, 97, 29,
+159,103, 90,250, 41, 81,146,159,131,203,191,157, 97,193,147, 75,182, 92,159,159,159,160,149,121, 54, 29,254,242, 75, 67,247,142,
+ 29, 55,177,168,123,143, 30, 10, 15, 15, 47, 83, 70,102,134,254,219,237, 59,172, 39,142,254,210,157,  7,251, 74,126,126,162,182,
+ 38,158,226,226,226,181, 85,165, 75,196,202,174,  0, 26, 51,  2,202,108,208, 36,212,105, 69,120, 94,102,250,176,197, 11,231,165,
+140,126,107,186, 56,208,167,  9,114,139, 25, 36,103,228,224,254,249, 95, 76,153,241,215, 14,148,100, 92, 31,111, 35, 85,118, 21,
+105, 25,  0, 86, 95,190,124,169, 85,100,100,100,223,158, 61,123,146,  9, 19, 38,128, 16,224,244,150, 73,164, 32,249,242,190,114,
+ 43,214,131,122,182, 75,234,249, 75, 55, 92, 70,116,111, 47,112, 85,141,199,214, 31,143, 90, 65,248,212, 58,210,120,250,250, 53,
+ 18,148, 77, 23,150,185,116,120,242, 48, 91,255, 88, 63, 38, 82,122, 10,244,136,245,172,166,188, 79,105,141,196,248,187,173, 19,
+227,239,142,  3,144,187,119,199,215,135,  0,192,100, 48, 76,140, 58,125, 48,245,238,157,232,215,  6,189,250, 65,147, 86,161, 29,
+  4,251,182,173,134,197,168,219, 15,192,230,254, 42, 17, 51, 41, 21,237, 94,219, 84,225, 83,237,158,114,249, 40, 69, 51,  2, 91,
+ 69, 83, 37, 75, 36, 77,120,222,166,  5,117,132,231,144,249,224, 54, 92,188,252,160, 82, 57,130, 39, 22,192,108,130, 38, 61, 14,
+ 28,103,143,117,104,135, 29,118,216,241, 55,161,254,107,180,210,239,149,249,211,250,171, 81,154,147, 59,102,219,182, 31, 22,253,
+176,125,119, 87,163,217,236, 67, 32, 74,231, 88,243, 57, 45,135, 57,182,114, 24,212,137,209,174,174,205, 66,190,253,122,195,167,
+223,110,253,234,121,240, 92, 48,  5,164, 16, 10,103,165, 86,110,108,109, 34,171,198,135,102, 94,233,230,222,195, 87, 24,242,243,
+181, 63,212,245, 90, 67,126, 92, 14,205, 88, 26,110, 94,179,112, 57, 77, 51,125, 56,142, 23,242,156, 53,145,179, 24,191, 48,104,
+226, 14,194,230, 85,110, 40,168,225,183, 59,  0,238, 68, 69, 69,117,139,138,138,234,  8, 96, 45,202, 98, 40, 70, 63, 75,187,152,
+242, 75,123,125, 56,227,195,211, 31,128,242,231,121,  2,150,227, 83, 69,  6,125,175, 58,210, 52, 12, 12,108, 34,183, 88,185,167,
+ 22,192, 87, 94,  8,255, 72,104, 57,250,202,  1, 52,180, 81,104,  1,101,187,233,190,126, 42,145,101,151,102,103,165,255,184,241,
+139,105,111,  3,  8,  0,112, 17,192,134,191,171,221, 45,198,146,188,191,250,190, 97, 45,166,249, 25,183, 14, 34,235,142,200,155,
+ 18,148,185,114, 32,156, 25, 60,107,206,102,173,150,249,246,177,207, 14, 59,236,176,227,111,179,102,109,169,234,187,224,159,146,
+195,194,194,  7,165, 40,172, 57, 72,175, 45,200,207, 79,208,  2,120,106,231,158,254, 25,121, 99, 19, 74,126, 66, 66,201, 79,245,
+189, 94,151,251, 80,  3, 60, 28,251,140,217,176,101, 33,251,133,242,227, 79, 65, 94,222, 61, 29,242,208,233, 89,155,101,231,142,
+237,247,119,239,254, 81, 72,104, 70,200, 19, 70,196, 18, 74,200,242,148,208,106,229, 97,178, 88,173, 22,150,181,130, 99, 45,224,
+ 57, 43,225, 45, 86,148,121,135,255, 51,144, 10,224,227,255, 85,187,255, 29, 96,173,150,249,176, 90,  0,232,236, 67,157, 29,118,
+216, 97,199, 63, 75,112,253,115,132,150, 29,255,105, 60, 72, 74,140, 15,183, 87,131, 29,118,216, 97,135, 29,255,113,145, 85,249,
+ 19, 64,217,218,243,136,106, 46,168,203,110,130,136,122,100,232,148,157,243,153, 57,133,  0,196,  0,148,  0,106,155,218,234,139,
+186, 59,172,252, 95,148,253, 35,  0, 55,236,237,110,231,180,115,218, 57,237,156,255, 89,206,218,184,237,187, 25,255, 98,  1,102,
+231,180,115,218, 57,237,156,118, 78, 59,167,157,243,255, 31,231,191, 25, 19,170, 56,  0,216,167, 14,237,176,195, 14, 59,236,248,
+127,  8, 87,215,102, 74,224,209,186,222, 90, 33,119,107,225,  9,  0,250,188,123,106,123,237,217, 81,  5, 42,199, 57,124,108,141,
+ 22, 93, 79, 66, 33, 45, 16,127, 40, 87,185,222, 83, 56,186,102,254, 63,175, 92,170,121, 35,197,212,222,221,  3,126, 14,106, 44,
+ 27, 92,151, 11,229,238,205,191,243,106,210, 41, 77,225,209,124, 42,188,195,100,207,146,  9,133, 71, 99,119,101,195,246,191,169,
+124, 90,245,251, 11,202, 40,105,217,178,101,231,150, 45, 91,118,  6,240,167, 68, 41,150,123, 52, 31,229,219, 52,252,188, 71, 96,
+219, 51, 10,207,102, 47,253,217, 25, 86,122, 55,117, 85, 54,108,247,147,178, 65,155, 66,165,119,155, 18,165,111,187,115, 42,183,
+ 22,129,181, 93,215,112,208,226,224,249,187, 98,119, 53, 28,180, 56,184,170,223,157, 35,215,169,230,238, 78,248,220,117,224, 23,
+ 74,251,184, 82, 63, 52,236, 58,202,201,251,249, 15, 92,235,122,157, 79,243,240, 59,141, 90,117,203,109,208,172, 83,172,173,215,
+248,  6,117,190,238,223,178,171,218,183,121,231,104,123,205,219,  6,169,123,227,206, 82,103,191, 35, 18,103,191,163, 18,151,198,
+ 61,158,149,207,219,219, 91, 22, 28, 28, 28, 25, 30, 30,254,118,175, 94,189,222,107,219,182,237,  4,127,127,255, 62,255,203, 23,
+125,185, 71,243,143, 77, 66, 42,207, 36,164,242,228, 30,205,107,221, 44,163,240,  8, 90, 68,209, 92, 22, 69,115, 89, 10,143,160,
+ 69,255,148,182,146,120, 54,247,151,123, 52, 95,165,242,106,121, 85,230,209,108, 96, 93,175,119,118,118,238,227,238,238, 62,164,
+226,112,118,118,238, 99,191,  3,234,141,202, 86,172,103,182,104, 49, 66,137,252,226,232,113, 83, 66,150,206,155, 37, 93,179,245,
+103,172,249,124,198, 93,147,174,168,229, 63,177,228,110,141, 59, 70, 51, 52,227, 91, 57,141,227,185,140,188,135, 87,219,255, 25,
+252, 65,141,100,227, 63,157, 57,230,253, 81, 47, 71,248, 71, 12,152, 70,197, 61, 52,252, 98,187, 68, 67,232,158,159, 14, 52, 60,
+127,246,204,186,173, 91,183, 44,208,176, 65,171,132, 18,193,134,146,244, 59, 69,117,201,131,131,123, 96, 99,129,194,237,252,115,
+131,167,120,197,156,218,177,141, 51,243,189,245,121,149,162,127,215, 31,238, 77,154, 52,233,192, 48,140,235,212,169, 83, 69,  0,
+176,122,245,234,166, 28,199,229, 39, 37, 37, 93, 67, 61,156,159,150,  9,204,160, 49,107,151,207,255,161, 95,191,254,200,202,211,
+ 97,217,170, 47, 95, 56,126,120,207,  8,157, 58, 97,223,159,209, 38, 78, 78,  1, 14, 16,169,110, 79,155,185,192, 35,242,133, 14,
+140,214,200,226,248,249, 27,221,118,124,185,224, 42,208,162, 99,105,222,189,106,125,138,241,250,226,217,158, 74, 18,201,235,139,
+  1, 96,212, 83, 15,123,165, 53,194, 93,198, 69,122, 75,  4, 55,242,129, 90,131, 62, 58, 53,234,122, 66, 40,145,248,211, 52, 13,
+154,  2,104,154,  2, 67, 81,101,113, 66, 45,134,212,204,251, 23,250,254, 19,238, 19,149, 95,199, 28, 48,  2, 87,154,250, 35,127,
+ 20, 93,254, 73, 72, 73, 78,194, 69,215, 63,225,223, 56,134, 52,117,106,213,181,169,238,219,115, 15, 11, 20,130,238,239, 29,161,
+  8,253, 85,218,133, 85, 55,109, 18,  0, 82,169,243,161, 67,135,220, 35, 35, 35, 29, 61, 90, 13, 62,103,203, 53, 98, 70,219,242,
+240,225,131,162,200,200,190,117,232,159,205,123,131,166,183, 83,128,144,231,201,106,134, 39,123,180,249,241, 73, 64,221,162, 79,
+201, 60,130,198,211, 32, 54,143, 51, 60,168,104, 67,110,220,214,250, 86,174, 64,226,208, 75, 40, 18,189,215,184,121,235,176,204,
+148,196,104,157,182,116, 21,107, 42, 62, 87,103, 34, 43,251,225,169, 11, 49,253,  4, 66, 33, 21,217,171, 19, 99,  2,206, 60, 75,
+163,123,122,122, 14, 89,191,126,125, 96,231,206,157,  1,  0, 44,203, 58,236,221,187,215,107,225,194,133,138,248,248,248,253,245,
+164,245,113,119,119,247, 19,139,197, 62,  0, 96, 54,155, 51, 53, 26, 77, 26,128, 90, 95,252, 21,158,129,110, 32, 88,112,225,252,
+121,  1,  0,116,235,214,125,145,223,115,239, 56, 51, 34,165,161,202,234, 48,151, 42,138,146,206, 76,191,124,229, 18,  5,  0,225,
+157, 58,207,146,187,181,216,240,191,180,108, 73, 61,130, 58,209,192,251,225,221, 34,134,141,124,101, 12,221,170,153, 31,250,244,
+238,249,145,  1, 56, 84,167, 62, 35, 16,200,174, 94,189,218,132,166,105,134,101, 89, 99,120,120,120,218,179,228,171, 65,243,206,
+191, 83,160, 27, 90, 88,243,215,154,  7,209,139,128,167,  2,199, 48,142, 13,195, 62,  5, 35,120,139,231,249,244,210,180,232, 46,
+255, 65,139,214,211,245, 92, 87, 38, 90, 32,126,111,212, 27,147, 67,166,127,240,137,116,218,154, 40, 28,249,114, 86,222, 63, 85,
+100,  1,  0, 67, 51,190, 39,126, 61,225, 33, 23, 51,  0,  0,173,145, 69,191,200,200,218,159,  8,141, 58,158,165, 41, 42,168, 34,
+148, 56,199, 90,164,  2,161,216, 72,149,  9, 36, 80,  0,220, 26, 52,138,242,100, 47,202, 71,189, 28,225,191,125,247,201,140,180,
+140,252, 58, 15,106, 20, 35, 66,120,247, 62,136,232,221,215,241,234,149,223, 23,108,217,180,241, 99,214, 98,221,200, 91,249, 85,
+198,130,196,172, 90,  7,115,175,102,237,196, 74,183,227,195,222, 94,232,106,164, 93, 48,231,243,181,110,231,143,237, 60,151,153,
+ 30,202,167,166,166, 27,  9, 69,221, 45, 44,200,126, 79,151,147, 20,103,107,149, 41,149,202, 64,165, 82, 25,218,166, 77, 27,233,
+140, 25, 51,132, 47,188,240,194, 31,146,125,194,  4,209,217,179,103,189, 87,172, 88,209,255,214,173, 91, 70,173, 86,123, 83,171,
+213, 62, 64, 29, 22,218,123,121,185,191, 51,124,232, 64,244, 28, 54,  5, 28, 79, 97,194,228,233, 56,113,108,255, 68,  0,127,138,
+208,178,202, 29, 22,190,245,246, 12,247,240, 14,109,153,  5, 59,227, 32, 19, 11,208,183,125, 16,245,198,212,217, 78, 91,215, 45,
+248,  6,121,120,190, 42, 75, 22,175, 47,158, 29,226,102,126,101, 80,231,198, 56,184,203,252, 10,122,205,  4, 45,119, 92,148,126,
+240,147,251,  0, 16, 24, 57, 85, 37,225, 52,235, 27, 56, 49, 30, 18, 78,179, 62, 48,114,234,169,  7,199,215,151,214,148, 23,161,
+ 68,226,191,107,231,206,102,206, 42, 17,  4, 52,  5,134,161, 32, 96,104, 24,205, 28, 70,188,252,202,159,214,205,101, 30,205,250,
+211,101,193,178,193,  3,223, 25,114, 19,142,214,165, 77, 40, 70,228,122,248,224,  1,129,135,163,  4, 12, 67,129,161,  1,134,166,
+144,162, 54, 96,252,248, 55, 28,159, 85,176,247,235,234,209,225,195,145, 65,125,195, 67, 92,218,252,120,137,114, 12,239, 55,210,
+ 53,207, 40,127,125,247, 47,103, 94, 33,221,166, 95, 33,132, 95,158,113,113,237,175, 53,145,152, 76, 38,117,223,200,126, 14,148,
+ 64, 33, 63,245,243,182,238,  2,154,130,149, 35, 96, 57,  2,174, 60, 54, 42, 85,254,  6, 67,211, 20,  8, 79,240,214, 91,227,209,
+ 55,178,159,158,103,249, 12,219,  7, 57,122,251,241, 83,191,185,155,172, 60, 86,172,223,186, 64, 87,172, 89,240,240,190,107,138,
+182, 56,111,186, 33, 55,193,230, 56, 24, 52, 72,251,244,  7,177,111,239, 60,124, 25, 33, 45, 91,128,227,203,242, 25,228,171,192,
+206, 35,151, 17, 28, 20, 92,150,111,158,160,121, 67, 37, 58,180,239,  0, 60, 21,154,204, 86,145,165,154,243,252,139, 99,230, 15,
+ 24, 49, 14, 30,238,238,160,137,117,192,169, 35, 59,  7,124,247,213,242, 15, 89, 99,201,138, 58,145, 17,238,209,115,129,240,252,
+ 51, 91,157, 26, 52,104,224,222,161,195, 31,238, 24, 89,150, 69, 64, 64,  0, 50, 51, 51,131,234,243,158,230,237,237,253,226,220,
+185,115, 61,250,247,239, 47,244,242,242,  2,  0,228,228,228,248, 28, 63,126, 60,108,238,220,185,185,217,217,217, 71, 80,131, 71,
+ 31,206, 74,139,104,  1, 24,169, 84, 94, 86, 70, 80,244,140,119, 94,107,227,233,221,160,202, 64,238, 26, 77,142,120,230,148, 51,
+148, 64, 32, 42, 63, 31, 52, 33, 60, 85,131,149, 40, 66, 40, 20, 86, 57, 67, 97, 97, 28,194,137,208,241, 77,154,161,203, 58, 43,
+107,213, 20,166, 93,111, 81,  7, 75, 92, 43,161, 88,180,113,248,200,113, 93, 94, 26, 54, 24,222,238,142, 56,117,241, 22, 38,190,
+243,190,149,181, 88, 87,213,107,240, 96, 24, 65,110,110,110,138,179,179,179,215,179, 63,111,169,198, 39, 79, 28,243, 56,117, 58,
+106,214,202, 53,235, 38, 89,204,172,149, 39,228, 81, 28, 99,153, 76, 34,236, 61,224,101,  7,143, 38,225,210,117,115,223, 20,254,
+  7, 45, 90, 91,254, 20,161, 37,150,169, 94,254,108,230, 84,233,194, 29,151,113,228,203,137,121,250,146, 60,247, 71,111, 10, 14,
+ 78,215,117, 37, 69, 97,245,201,161,210,189,121,103,138, 17,188, 77, 49,140,130,162, 41, 49,207,241,233,172,217,188,200,144,159,
+144,253,172,165,231,121,130,159,126,207,173,155,  0, 34,104,186,253,199,  3, 30,158, 78, 18, 24, 45, 28, 70,142, 26,131, 31,126,
+248, 65,229,238, 40,134,209,204, 98,249,202,149,165,218,148, 35, 30, 41,233,133,153, 17,  3,223,255,245, 65,114,110,108, 90,182,
+113, 79, 93,243,102,178,112, 40,209,179,208,155,104, 52,107,213,  1,203, 87,  5, 75,211, 82, 31,190,191,237,187,111,222,189,123,
+151,249,129,103,232,249,198,236,123,233, 85,222,116, 94, 33,125, 29,156, 93,119, 13,125,251,115,167,132, 92,  1,  8, 44, 72,114,
+144,226,229,215,223,117,  8,244,146, 65, 33,101,156, 30,166,102,122,207,248,240,195,139, 15, 56,210,177, 68,243,224, 97,109,249,
+105,212,168,209,176,  1,  3,  6,200, 63,248,224,  3, 97,195,134, 13,241,221,206,189,254,221,250,142, 24,152,149,173,110, 72,  8,
+129,167,135, 71,250, 91,111,140, 56,116,244,232,209,212,244,244,116,225,178,101,203, 58, 29, 56,112,160,101, 78, 78,142,205,111,
+166, 28, 33, 48,154, 56,112,229, 15, 72, 77,177,169,206,250,212,199,199, 71,146,153,153,105,170,100,101,160,254, 48, 20, 82,125,
+123, 61,223, 73,176,249, 88, 50,180, 70, 14, 10,169, 16,201,106, 61,218,183,109, 77,125,205,177,161, 85, 17,142,127,249,197,217,
+158, 74, 18, 57,168,115, 99,120, 56,203,241,237,134,207,113,240,210,195, 72,181,150,194,122,194,188,237, 45, 17,244, 86,240,217,
+235, 95,104,223,196,171,103, 59,127, 92,107,223,196,235,124, 76, 92,188,108,196,202,169,153, 90,225,169,194,227,239,150, 86, 61,
+240,208,112, 81,137,176,245, 68, 42,228, 82,  1, 20, 82,  1, 20,146,178, 79,154,166,158,237,173,214,187, 69, 67,134,231,198, 51,
+140, 96,252, 43, 47,143,104, 48,250,149, 17,  4, 12,141,189, 63, 29, 26,188, 99,199,246,108,171,197,252, 13, 71, 51, 91,171,235,
+ 63,143, 85, 40, 13,120, 56,138,241,225, 55,177,112,144,  9,161,146, 11,225, 32, 23,162,103, 27,119, 48,116,189,179,232, 60,113,
+112, 96,255,137, 67, 27,245,  8,242, 83, 54,187,153, 84,124,119,252,162,232, 53,103,139,122,188,183, 97,117, 75, 87,109,145, 89,
+ 48,103,198, 91,130,140,172,172, 30,123, 15,157,235,201,153,199,197,177, 22,221, 39,154, 91,123,171,180, 10,103,196, 93, 10,243,
+  9,127, 73,106,209, 90,111,223,140,203,104, 82,104,146,224, 78, 74,  9, 20, 82,  1,148, 21,117, 43, 21, 64, 33, 21, 66, 41, 21,
+ 32, 43, 35, 25,  5, 58,230, 98,166, 43,221,  3,231, 46,213,201, 77,190,209,194,225,198, 67, 45, 26,  5,181,133,183,119,  3,152,
+251,191,218,232, 74,212, 79,191, 92, 61,247,243, 18,125,206,253, 79,108,229,217,121,248, 50,102, 77,127, 59,134,  2,174,151, 63,
+164,195,230, 44,253,178,221,130, 89, 83, 30, 75,155, 49,127, 93,187,250, 91,178, 84,179,123, 14,157, 60,191, 91,239,161, 40, 45,
+ 80,227,247, 95,247,160,239,128,225,120,117,220, 52, 56, 57,185, 45, 95,181,104,230, 77,214, 84, 18,245,212,152,235, 21,252, 92,
+235,144, 22, 59,124, 26, 52,104,200,243,101, 81, 62,  8,  1,180,165,197,152,249,222, 91,224,  9, 65,104, 88,199,158,210,110,189,
+  9, 41,143,  6,146,151,159,167,139,187,127, 55,194,152, 27,119,197,230,186, 52, 26,173, 26,141,  6, 55,110,220, 64,124,124, 60,
+238,220,185,131,252,252,124, 56, 58, 58,106,117,186, 58,249,126,115,104,211,166,205,232,168,168, 40,169,179,243, 31, 65, 26,204,
+102, 51, 84, 42, 21, 70,143, 30, 45,236,211,167,143,207,139, 47,190, 56, 54, 54, 54,118, 39,128,146, 42,243, 83,144,152,165,242,
+ 12,218,244,252, 11,207, 79,  2,  0,153,131,247,195,245,223, 29,186, 83,227, 11,173, 99,  3,255, 46, 93,186, 54,  1, 33,160, 64,
+214,234,243,227,115,106,176, 18, 41, 46, 95,190, 28,200, 48,140,224,143,103, 16,143,175,190,253, 49,248,228,133,219,195,150, 46,
+ 95, 33,117, 80, 72,160, 41, 54,227,205, 87,135,218,252, 12,150,121,  6,245,239,210,165,251, 47, 11,230,127, 38, 80, 42, 20,248,
+245,202,  3, 76,125,239, 67, 99,118, 74,236, 10,194, 11,191,212,107,226,115,159,241, 81, 73,240, 39,160,153,175, 18,170, 65,125,
+165, 19, 95, 27, 36, 53, 91, 57, 20,233,172, 48, 89, 56,112, 60, 65,177,206,138,187,105,165,112,115,168,123,136, 48, 66, 72,  7,
+  0,238,  0, 52, 20, 69, 93,171,252,189,226,133,174, 66, 27, 63,241, 61,175,252,249,224, 10,192,140,178,157,250,143,186, 79,249,
+247,234,210, 43,174,191, 11,160, 69, 57, 39,  7,224, 42, 69, 81,133,213,136,173,167,172, 92,130,195,135, 15,147,  1,  3,  6, 60,
+ 26,241,159,252,254, 36, 36, 34, 97,  3,133,163, 59,  8,185,  7,138,250,227, 52, 15, 47,159,252, 21,171,214,184,188, 51,249,237,
+212,146,162,  2,255,242,228, 83,182, 60, 44,  4, 20,179,234,249,174,225,125, 38, 77,158,140,160, 64, 95, 17,199,113, 36, 54,254,
+161,117,219,214,111, 95, 63,127, 73,188,166, 36, 35,118,118, 37, 19,100,157,182,125,114, 60,151,241,164,  5,139,227,185, 39,223,
+110,159, 14, 82, 77,  1, 78, 74, 49, 54, 29, 75,  6, 33,  0,  5,  2, 71,133, 16,187,207,102,224, 97,204,254,146,  1,161, 37,186,
+209, 75,231,245,236,209,255,221,168,187, 73,198, 61,185,185,198, 19,  0,114,106,226,172,122, 64,231, 97,178,112,176,178, 44,246,
+ 29, 58,132,200,158,157,208,165, 75, 39,116,239,214, 69, 16, 29,115,107,220,228, 73,111, 53,196, 31,187, 59, 30,113, 74, 61,155,
+118, 80, 58,186,237, 25, 54,105,153,234,118,  6, 11,  1,  3, 52,246,146,193, 69, 37,130,153,165,144,162,177,148,223, 57, 78,152,
+ 58, 99,190,203,172,247, 39, 29, 45,209,136, 67,128,123,150,154,202,174,215,235,197, 99,198,140, 17, 90,173, 86,203,232, 55,167,
+245,201,201,209, 12,254,106,237, 23, 18, 15, 15, 79,232,141, 44, 98,238, 36,182, 88,176, 96,126,227, 67,199,207,254, 60,239,195,
+137,191, 68, 70, 70, 58,254,248,227,143,124,109,245,249,216, 27,162, 58,111,195,183, 59,246,253,176,122,197, 98,196,165, 22, 98,
+235,230, 47, 65, 56,118, 83, 45, 85, 85,153,147,140, 25, 51, 70,246,243,207, 63,251,102,100,100,148,232,245,122,205, 99,246,  8,
+154, 18,168, 11,244,112, 83,137, 33, 18,208,240,116,150,194,195, 81,  2, 33,  3,208, 20,197, 85,197,185,117,207,145, 69,188,190,
+ 24,  7,119,153, 95,249,118,195,231, 24,247,206,167,136,205, 19, 31,167,229,142,139,166,188, 50,108,150,187,140,139,108,224, 68,
+123,244,108,215,  8, 10,169,  8, 31,191, 59,  6, 29, 99, 82, 60, 50,139,248, 79, 53,  6,166,237,252,227,143,130,117,159,122,220,
+ 56, 82,102,193, 82,201,133, 56,190, 99,121,174,174, 88, 83, 92, 49, 37,103, 54, 25, 83,109,236,198,167,170,120,179,157,213,182,
+117,171,207, 39, 77, 24, 79,119,237,220,145,208,180, 16,121,165,102,138, 16,224,189,169, 19, 49,101,226, 91, 94,233, 89,185,115,
+190,252,114,211,236,168,147,100,161, 78,115,127, 94, 77,156, 52, 85,102,  5, 82, 74,  5, 80,202,202,132,139, 82, 42,128,209,204,
+129,162,192, 56,249,133, 21, 83,101,150,220,172,130,212,106,223,192, 31,227,116,241,107,117,250,228, 67, 85,112,225,158,194, 75,
+201, 89,119, 22,197,220, 82, 95,  5, 80,208,176,187,211, 88, 11, 75,160, 53,178, 72, 86,235,193, 90,  8, 53,174,159, 63,  2, 94,
+162,130, 22,127,123,253,135, 99,183,224, 80,105,208,127,140, 51,243,242, 62,163,107,200,208,145,171,215,109,190,182,226,243, 79,
+153,188, 98, 51,120, 66, 32, 21, 51,144,137,  5,229,  7,  3,131,174, 24, 95,110,252, 58,135,  5, 53, 12,231,206,177,117,233,159,
+224,201,171, 67,251,119,223, 77,  1, 98,138, 22,101, 52,240,111,228,223,107,224,235,210, 94,131,198,128, 99,205,179, 98, 46,144,
+ 51,250,220,184,211,182,112,134,180,108,  1, 10,184,174,203,141,159,  8,  0, 10,143,230,155,130,131,130,219, 61,153,214,180,105,
+ 80, 59, 91,218,253,145,165, 84,170,122,199,217,197,253,211,160, 86,109, 61,212,133, 38, 74,229,234,139,228,132, 27,216,181,113,
+206,118,222,104,158,127,250,200,158,207,215,108, 61,240,114,175,200,161,248,246,171, 47, 62,206,207,126, 36,180, 78, 85,178, 86,
+189,186,237,155, 45, 13,133, 98,  9,172, 44, 15, 43, 71,202, 62, 89, 14,  5,  5,133,176,178, 60,164,114, 21, 88,158,130,149,227,
+ 97,101,121,152,204,172, 98,226,152, 23, 39, 27,129, 43, 85,229,211, 39,248,249, 19, 34,137,196,159,160, 44,118, 45, 33,  4,201,
+ 57,  6,218,219,219,123, 39,  0, 72, 36, 18, 72, 36, 18,240, 60,143,152, 56,205, 59,110, 65,205, 39,161, 92,224,113, 22,115,106,
+ 81,202,111,125,171, 43,187,151,151,215,192, 39, 69,150,209,104,132, 86,171,197,133, 75,215, 28,191,249, 97, 95,100,114,106, 70,
+ 32, 79, 28, 77, 42,143,192,190,165,185, 15,  6, 86, 87,159,165,234,184,201, 14,225,111,209, 31, 76, 25,219,116,221,182,195, 87,
+ 19, 79, 44,170,113,157, 86, 64,175,143,204, 31,188, 61,188,253,210,181, 91, 19, 10,127,219, 52,189,182, 54, 18,  8,  4, 66,141,
+ 70,243,232,254, 94,255,245,174,246,215,227, 50,135,172, 89,189, 70, 26,243,160, 20,183,147,179, 48, 54,194,175,236, 13,199,134,
+118, 87,120,  6,186, 53,110,210,100,231,151,107,151, 10, 18,178,140,216,176,255, 42,162,126,217,116, 33, 39,247, 74, 36,212,217,
+134,250,140, 33,127,130,208,170,150,243,204,173, 60,104,141, 44, 76,102, 22, 86,158,160, 68,111, 69,110,145, 25, 37,122, 11,180,
+  6, 22, 99,123,251, 85,121, 93, 45,122,196,157,162,168,195,132,144,  1,132,144,  8,  0,226,138,239,101,207,108,234,112,185, 32,
+123,236,251,172, 89,179, 62, 89,178,100,201,157,138,115, 43,210, 43,206,173, 41,189,210,245,174, 31,127,252,113,200,210,165, 75,
+ 23,119,238,220,121,247,239,191,255,254, 16, 64,161,173,211,135,130,202,133, 57,124,248,112,109, 21, 29,104,177, 90, 36, 14, 50,
+ 33, 26,  7,248,225,141, 79,190,117,251,126,233,248, 92,169, 88,192, 28, 59,118,204, 37,223,172,  4, 77, 51, 54,191,162, 40,221,
+155,117, 17,137,196, 71, 86,174, 92,137, 87,  6,118,147,165,229, 89,181,183,210, 12,106,157, 25,172,135,123,115,241,162,197, 75,
+149, 75,151, 45,159,114,248, 32, 95,164, 85,223, 93, 94,245, 20, 95,251,104,134,170,180,  6,139,162, 64,120, 46,163, 48,229, 90,
+123,  0,120,150,181, 88, 90,163, 21, 76,249,218, 26,138,  2,244, 70, 22, 12, 67,229, 22,197,237,185, 59,122,225,162,158,219,119,
+159,204, 34,180, 83,169, 78,151, 44, 71, 89,204,193, 58,195,104,230, 96,178,114,184,115, 51,  6,221,195, 91,162, 75,251, 96,232,
+141, 28,244, 38, 22,  1, 77,130,  0,192,173,202,134, 99,232,135,132,179, 26,  9,225, 84,  3, 58,184,195,195, 73, 12,111,103,  9,
+ 36, 98,  1,172, 44, 96, 48,243, 48,154, 57,164,228, 26, 80,106,144,161,245,243, 35, 26,187,122, 71,155,114, 82,100, 63, 23,164,
+ 69, 15,171, 81,156,114, 28,182,237,220,215, 52, 43, 75, 61,248,232,207, 59, 36,154, 18, 43,110,165,232,144, 91,100,  2, 24,119,
+204, 93,188, 65,242,209,244,  9, 67,182,237,250, 41,181, 87,183, 78,169,117, 45,179, 94, 19,183,125,207,222,125,155,  6, 12, 24,
+ 34,187,115,229, 40, 18,110,156,254, 92,151, 91,167,245, 89,116,104,104, 40, 59, 97,194,132,210,197,139, 23, 55, 60,120,240, 96,
+128, 70,163,185,  1,192,234,228,228, 20,220,188,169,255,205, 95,143, 31,243,121,113,200,  8, 97, 70,158,  1,142,114, 17,252, 61,
+228,184,116,225,132, 85, 44, 22, 86,185,222,164,124,122,112, 20,122,205,196,193, 75, 15, 35,239,228, 75,207,190, 53,126,108,234,
+175,231,227,242,215,255,240,235, 23, 62, 74,235, 13, 41,175, 89, 31,221,190,137,215,172,169, 99,176,100,221,118,156,139,137,203,
+213,209,222,159,103,155,216,147,213,155,210,  1,  1, 67, 65, 37, 19, 66, 87,162, 41, 78,186,126,188,249,159,100,166, 30,251,235,
+207,219,233,130, 82, 43,210,243,140, 84, 86, 65, 41, 56,158,192, 73, 46,  2,203, 19, 20, 21,228, 81, 59,182,255,128,107,215, 46,
+209, 96,232, 55,  1,204,171,177, 66,169,178,169, 66,165, 84, 88,102, 17,146,149,125, 90, 57, 30, 65, 77,155, 96,203,250, 85, 14,
+110, 30,158,120,174,187,237,107,163, 85,174,254,161,187,191, 91,143,179,191, 95,127,225,220,154, 13, 29,148, 13,220,215, 81, 20,
+183,  2,  4, 70,147,133, 67,113, 81, 33,196,230,116,116,244,209,192, 69,206, 33,165,196, 27,177, 57,  9,202,218,  6,252,252,216,
+  3, 55, 40, 50,100,246,190, 67, 81, 75,250,246,126,  1,177, 41, 37,144,137,  5,144,138, 25, 72,197, 12,132, 20,135, 85, 27, 55,
+ 89, 11,139, 75,  7,228,223,249, 37,175, 30,253,243, 84,249,219,111,153,184,227,180,238,219,215,205,254,254,173,153,203,250, 70,
+ 14,125,157,138,189,118,230, 19, 61,112,218,182, 23, 61, 98, 83, 26,207,219,254,140,147,170,220,214,190,251,209,162,119,251, 12,
+ 24,  1,134, 17,192,106,181,226,167, 31,183,227,187, 13,115,239,155,181,249,175,  3,224,205,185,204,132, 61,219, 55,142,152, 57,
+103, 21, 21, 18,218,177,211,153,236,167,195,123,254, 31,123,231, 29, 21,213,213,181,241,231, 78, 99, 26,189,131,130, 21,  4, 11,
+ 40,246, 94,163,198, 30, 53,193, 18, 49,177, 39,198, 36,198, 68,141, 38,106,212,104, 76,236, 45,177,197,168,177,247,142, 13, 91,
+140, 10, 40,138, 40, 72,239,157,233,125,230,158,239, 15,192, 88, 40,131,229,123, 83,206,111,173, 89,112,135,225,153, 91,207,125,
+238, 62,251,236,195,114,153, 95,198,140,155, 20,234,225,225, 97,247, 87, 68,139,160, 81, 64, 19,244, 27, 52, 12,103,143, 30,198,
+131,216, 24,176,164,212, 48,177, 44,129,172,164, 40,215,108, 50,108,175,180,199, 67, 36,170,179,237,215, 29,254, 28, 14,243,100,
+  2,249,207, 63,250,192, 48,249,179,175, 59,245,235,221, 53,214,134, 11, 69,106,122,142,227,141,232,184, 32,150,111,235, 51,110,
+198, 10,129, 78,111,129, 92, 99,194,169,173,149,123, 29,145,147,111,251,186, 45,251,141,155,252,205, 38,161,144,203, 49, 54,109,
+228,147,220,181, 93,211, 12, 95,111, 87,229,119, 75,215,181,185,118, 51,186,223,123,163,198,137,194,  2, 91, 50,222, 46, 98,187,
+ 15, 70,189, 19,108, 49, 27,199,104,138, 51, 42,173, 47,200,151, 56,201,124,235,249,105,254,138, 24, 53, 58,196, 16,212,127,198,
+121, 48, 72,214,230,197, 15,  5,  0, 47,111, 95, 29, 95,104,175,172, 65,  4,134,  0,192,154,205,187, 91,221,141,207,158,176,114,
+229, 42, 73, 84,146, 18,119,146,228, 16, 10, 56, 48,154, 88, 48, 86,  6,181, 89,194,157, 52,103,246, 44,251, 18,181,  5, 17, 49,
+  5,136,141,188, 68, 12, 42,221, 40,137,217,126, 40,220,237,198,  0,104,  8, 32,145, 97,200, 47,234, 60,207,163,192,229, 26, 79,
+116,202,178,165,207,203,246,110, 13,234, 91,120,194,126,124, 27,105,123,134, 33, 77, 25,  2, 39,128,100, 21,151,221, 83,173,117,
+106,234,188,120, 44,251,254, 91,172,222,114, 24,217, 69, 58, 56, 88, 50,112,116,235, 34,124,177,228,119,104,245,149,103, 53, 84,
+231, 71, 42, 50, 70,207, 27,174,242,223,203, 63,183,100,201,146,  1,207, 29,155,  1,149, 28,179, 23, 62, 87,254,255, 75,151, 46,
+253,254,169,191,107,172, 53, 89, 79,140, 86,249, 70, 85, 99,182, 26,185,121,213,249,227,232,145, 67, 78, 37, 42, 35, 68,  2, 46,
+124,235,249, 97,254,218,163,110,111,183,114, 69,161,209,  1,187, 55,253, 84,172,211, 40,247, 90,213, 88,184,  7,180, 21,219, 74,
+ 79, 29, 58,120, 24, 13,124,221,  5,187,174, 22,167, 68, 39,107,159,132,122, 21,  5,105, 54,245,236, 53,188,161,239,188, 35,185,
+112,241,210,103, 42,160, 66,163,197,101,184,181, 55,239, 56,232,110, 39,230,131, 97,  0,165,214,140,  9, 99,134,189,250,109,140,
+176,220,113, 99,195,192,148,153, 44, 69, 81, 46,190,158,249,145, 78,106, 74,120,144,158,154,158,213,107,224, 23, 23, 20, 42, 70,
+ 23,250,254, 71,183, 31,196, 47, 41,209,104, 94,110,146, 31,189,193,  2,189,145, 69, 82, 82, 34, 62, 15,123, 11,124, 46,  7, 92,
+ 46, 91,154, 44,109,174,252,100, 84,101,199, 23,195, 83, 48,124,231,242,169,155,189, 61,220, 93,108,165, 98, 98, 43, 17, 50, 77,
+  3,253,  5,237,218,117,176,169, 23, 16, 44,184, 26,167, 69,122,129, 22,201,217,114,  8, 61, 90,240, 70,244,120, 27, 59, 87,205,
+232, 86,156, 30,201,193,139, 73,138,207,112, 46,226,207,129, 91, 54,174, 20,230,201,140,120,152,174, 66,110,137, 14, 57, 37,122,
+228, 22,235, 96, 43,230,163,203,160,137,194,147, 71,127, 25,216,179,115,219, 53, 47,179,221,201,201, 41, 39, 83,179,114,222, 13,
+ 14,105,131,157,191,253,218,217,209,177,158,189, 76,150,162,176,246,232, 44, 90,180,200,102,233,210,165,188,181,107,215, 42,218,
+181,107,231, 57,123,246,236, 62,249,249,249,183,234,214,173, 27,112,246,208,246,139, 45,186, 12,110, 13,214,232,214,185,107,119,
+129,144,229, 33,252,196,  9,227,190,189,187,138,180, 90,229,228, 42, 13,135,196, 97, 81,158,138,129, 91,173, 90,177,182, 54,150,
+183,120, 28, 89,124,201,153,105, 59, 74,128, 67, 13,250,126,114,254, 82,228,163,248, 86, 81,169,238, 23,163, 30,231, 23,107,140,
+141,146,206,124, 81,101,195,203,101, 24,240,185, 28,216,137,121,224,148,181,170,182,222,193,143,193, 48,110,229,145, 83,  6, 76,
+217, 79,128, 97,144, 93,146,126,199,138,156, 13,134,176,  4,120,148,169,134, 74, 87, 26,154,175,237, 42, 65, 65, 94, 38, 54,172,
+217,142,232,200,219,232,253,246, 32,172,223,188, 11, 19,198,188,171,171,238,233,135,195, 41,139,104, 61, 21,205,178, 21,243,  0,
+ 48,144,169, 77, 56,120, 45,  3, 13,235,115,172,190, 49,  0,128,157,173,  4,114,165, 22, 28,129, 29, 18,163, 78, 73, 78, 95,186,
+ 57,123,238,194,149, 95,150,228,196,164, 63,190,119, 21,  1,174,114,212,175,101, 68,108,174, 61, 34,139,234, 33,192,175,  1, 56,
+130,219, 86,105, 23,198,  6, 45, 59,202, 57, 56,160, 85,139, 38,237,235,184, 59, 66,107,176,148, 69,181,184,248,117,219, 14,164,
+166,100,142, 43,122,112, 52,250,117, 56, 90,117,126,114,129,208,221,239,227,123, 55, 47, 36,191, 51,234, 99,120,213,242,109, 46,
+ 75,191, 99,229,205,203, 58, 83,101,177,210,104,  9, 36,142,179, 63,159,243,195,180,222,253,135,227,207,171, 23,112, 39, 54, 17,
+109,219,182,198,219, 67, 70, 64,169, 40, 14,220,191, 99,213, 91,102,141,242, 44, 79,104,158,214,166, 67, 15,134,181, 88,144,240,
+240,126, 98, 69, 90,218,156, 71,119,110,228, 60,178,127,166,123,202, 53,176,185,173,131,243, 29,189,209,130,172,172, 76, 92,255,
+ 35, 34, 68,155,243,168, 70,  5,132,133,  2, 46,194,163,243, 97, 44,155,195,180, 75,215,183, 12,  2,142,190,243,226,149,219,169,
+ 20,239,  5,  0,  0, 32,  0, 73, 68, 65, 84,218,229,100,231,112,164,246,174,172,115,173,198,  2, 47,161, 81,127, 55, 73, 46, 48,
+154, 88, 52,240,150, 86,169,233,230,237,247,253,140, 25,159, 55,230, 10,196, 80,170,245,134,156,236, 44,207, 77,187, 47,169,226,
+ 30,222,171, 85,219,221,193,254,135, 85,191,  8, 20, 58,  6,249,114, 61,138,149, 10,102,212,164,175,188,183,172, 91, 50,186, 42,
+163, 85, 65,186, 72,253,147,225, 87,  3,157,236,  4,140, 74,103,102,139, 20, 70,203,168, 33,175, 54,232,178,204,100, 77, 92,185,
+ 98,149, 36, 58, 73,137,187, 73,114,136,  4, 92,216,  8, 56, 48,152, 88, 88,121, 57,113, 60,221, 61, 39,119,104, 21,132,179,119,
+ 10,193,229,114,160, 85,150,104,120, 40,138,111,213,173,183,164,101,155,118,232,222,173, 43, 30,199, 63,242, 61,113,236, 96,207,
+ 27,215, 47,231,154,141,141,166,170, 11,226, 15,215, 40,176,160,209,112, 77, 54,158, 31,120,213,170,219,113,232,136, 15, 28,234,
+248,214, 98,220, 93, 93, 96, 38, 60, 76, 28, 51,204,234, 43,191,212,152,  3, 75, 23,206,134, 94,111,128,155,163, 13,  8,  1,182,
+173,153, 15,131,193,  0,111, 23, 33,228,234,202,103,147,171,206,143, 84, 22,133,170, 81,238,201, 83,102,172,170,247, 25,134, 57,
+ 49,107,214,172,175,  1,144, 89,179,102,125, 93,190,188,100,201, 18, 45,128,236,106,186, 14, 55, 61, 99,180,202, 55,174,242,171,
+ 91, 16,224,234,226,117, 35,252,236, 25,135, 35,119, 89,252,121, 56, 18,253,219,122, 65,192,227, 64,226,224,141,187, 41,114,156,
+ 60,180, 81,118,116,207, 47, 89,122,189,254,199,234,251,154,253, 90,217, 74,164,103,127,219,185,151,117,117,113,225,108,  8, 47,
+ 72, 42, 82,154,159,116,105,197,223, 60,198, 70,158,221,228, 69,192,156, 17,137, 68,126,  6,131,193,169,186,  3,187, 45, 60,173,
+ 44,137,151,121, 29,109, 43, 24, 46,215,178,115,215, 78,184,218,219, 64,111, 98, 49,235,203, 79,181, 97,189,109,101,163,222, 27,
+209,163,123,191,105, 23,249, 82,255, 11, 29, 66,252, 73,139, 22, 45,100, 92, 46,215,170, 84, 10,119,119,247,249, 28, 14,103,164,
+141,141,141,157,193, 96, 80, 26, 88,157, 68,173, 51, 64,103,  4, 52, 26, 29,248,130, 82,179,200,231, 50,208,234, 12,208,104, 13,
+ 85, 95, 24,185,247,175,  1,104,164,120, 42,166,116, 33,174,129,205,239,251,143,126, 58,252,189,208,185,181,154, 15,177, 77,201,
+145, 67,192, 24,209,186,177, 23, 46,157, 57, 76, 50, 83,227, 63,175,206,100,  1, 64,126, 65,177,143,155,155,  7,162,147, 85,200,
+ 42,210, 34,183,204,100,229,148,232,161,212, 42, 17, 92,199, 27, 50,185,220,231,165,247, 47,112,248,236,217,179,239,246, 27, 28,
+138,105, 95, 46,232,180,117,227, 79, 49, 82, 27,254,135,234,188,132,  8,107,140,214,253,251,247,139,103,206,156,217,112,243,230,
+205,156,209,163, 71,107,131,130,130, 68,239,191,255,126,167, 29, 59,118,136, 36, 18,145,246,238,213, 99,115,199,127, 50,107,240,
+166,213,139,154,151,148,148, 48,102,147,233,180,177,164,100,150,170, 26, 51,151,113,236,235,135,243,146,140, 99,223,234,236,118,
+204, 89,194,105, 42, 36,134, 17,104, 60,127, 47,226,230, 27,147,206,172, 85,138,223, 93,254, 73,182,140,157,163,227,184, 47,174,
+206,100,  1,  0,135,203,192, 96,182,192, 78,204,  7,135,195, 41, 55,241, 94,191,238, 61, 45,113,115,176,  1,159,203,  1,143,203,
+ 64,161, 49,161, 80, 97,196,199, 31, 88, 91, 33,132,176,102, 11,129,214, 96,134,166,236,233, 80,169, 40,196,236, 47,167,227,237,
+129,239, 96,252,228,233, 40,209,  2,145,201, 74, 24, 77,166,106, 47, 10, 14,195,129, 70,111,198,135,189,235,160, 88,101,132, 90,
+107,134,193,204, 66, 98,195,  3,159,199,129, 84,196,131,189,132, 15, 16, 34, 40,111, 76,248,124,190,206,100, 50,237,172,226,137,
+ 30,245,124, 60,160, 53,113,208, 38,244, 39,244,106,223,  8,177,215, 14,242, 46,255,121,175,254,103, 95,206,193,167, 19,  6,226,
+192,195,134,112,118,175,  3, 91,169, 24, 38,194,  1, 64,172, 76,216,155,207,114,140,239,140,252,121,243,182, 71,223,125, 59, 75,
+ 36, 83, 51, 16, 10,184,184,120,225, 60,110,220,140, 92, 93,248,224,232, 78,188, 70,248,132,227, 97,111,111, 15,145, 13, 23,  6,
+163,222, 96,125,234,  2,  1,  1, 66,164,238,141,126, 46,123,226, 15,177,176,168,224,189,234,141, 22, 79,100, 63,107,234,151,223,
+125,223,187,255,112,132,159, 56,128,253,  7,246, 90,218,247, 29,199,221,245,235, 70,116,234, 53,  8,157,122,135,226,244,225, 29,
+211,213, 44,211,100,226,180,185, 11,187,244,232,135,240,147,  7,144,151,155,185,220,218,245,229,242,153,105, 61,222, 26,  8,157,
+193,130,206, 61,  7,224,204,241,195,159,160,108,144,133,245, 55,177,231,218,103,112,204,211, 63,159,198,207,151, 25,248,  5, 10,
+  3, 50, 11, 52, 72,201,211,224,232,158,173,196,250,246,194,208,186, 75,112,109,254,196,101, 23, 51,124,106,123,233,249,122,173,
+ 56, 62, 49, 41,112,252,  7, 97,252,250,126,129,156,124,185, 30,  5,114, 61, 10,229,122,168,116,102,248,213,246,231,152,204, 76,
+251,154, 30,103, 87,  7, 27,254,250,227,201,176,151,242,209, 33,240,229,  7,218,178, 44,251,151,201, 90, 89,106,178, 98,146,229,
+ 16, 10,184, 16, 10, 56, 16, 10,184, 48, 91,136, 85, 15, 46, 98,247, 70,253, 62,158,250,145,183,193, 12, 20,201, 13,224,113, 25,
+184,187, 58, 73, 91, 55, 31,137,109, 63,125,  2,  0,152, 48,115,  3,198,127,248, 62, 26, 55, 13,130,172,164,196,115,228,240,126,
+ 43,  1, 28,182,118, 93, 79,133, 71,248,134, 95,137,158,249,241,140,121,182,239, 13,236,206,189,147, 36, 71, 78,177, 30,137,241,
+202, 26, 69,222,  0,192,108, 97, 65, 64,176,125,239,  9,136,109,120, 40,144, 27, 65,  8,193,162,181,251, 96, 39,230, 35,167,164,
+180,187,191, 42,170,244, 35, 85, 68,164,106, 16,109, 28,128,210, 92, 46, 55,107, 35, 90, 75,150, 44,137, 93,178,100, 73,133, 17,
+178,167, 76,214,203, 77, 42, 45, 16, 72,  3,237, 93, 92,255, 12, 63,115,202,238,240, 93, 11, 46,221, 45,194,240,206,181,161, 42,
+ 78,199,143, 95,190, 87,204,128, 24, 56, 92,174, 76,175,213, 28,210,106,213,139,  1, 24,171, 60,105, 60, 27,133, 72, 69,182,231,
+215,111,250,205,236,234,238,142,157, 87,139, 51, 75,212,102,211, 95,221, 86, 38, 38,242,236,166,250,102,214,212, 87,151,247,248,
+118,117, 79,226, 44,129, 96,201,198,163,  0,  8, 88,150,  5, 97, 89,240, 69,182, 82,215,  6,237,242,202, 26, 58, 17,143,195,232,
+158,110,  1,  8,107,206, 44, 76,174, 58, 12,202,  0,112,144,240,177,247,114, 22,  0,228,113,149, 81,113,163,222, 43,237, 46,212,
+ 25, 68,138,166, 13, 27,146,214,173, 91,203,196, 98,171,202, 95,113, 61, 60, 60,110,205,157, 59, 55,112,252,248,241, 66, 27, 27,
+ 27,152,205,102,231, 95, 54,109, 98, 55, 45,158,128,161,159,172,135,192, 70,  8,173,206,  8, 62,159,135, 18,185, 10, 50,133,  6,
+ 74,141,169,230,103, 80, 82,146,161,  0, 88,118,228,176,205, 59,125,108,131,219,216,112,  4,104, 25,224,133, 75,103,143,144, 63,
+207,108,155,160,205,143,255,205,202, 19, 17, 42,157,  9,217, 69, 58,100, 21,233,144, 91,162, 67,110,177, 30,185, 37, 58, 48, 12,
+  3,157,193,252, 74, 55, 46,117,254,163,253, 59,127,219, 50, 72,111,196,136, 46,189,223,193,244,121,235,235,236,252,121,233,249,
+100,194,233,104,101,162,173, 37, 54, 54, 54,245,131, 15, 62,104,190,123,247,110,110,179,102,205,180,113,113,113,146, 50, 19,105,
+180,181,149,136,183,174, 91,114,182, 77,155, 54,123,179,226, 31, 94, 40,235, 79,175,182, 97,175,211,117,172, 80,108,140,158,232,
+ 43,237,208,167,129,167,  4,190, 82,101,159, 64,219,187, 63, 22,245,248,244,251,130,139,171,243,115,244,230,115,  5, 90,110,139,
+ 44, 21,223,170, 28, 60,147, 94,151, 54,116,248,  8,112, 25, 14,140, 58, 77, 90,249,201,229,238, 96,131,249,187, 30,194, 86,196,
+135,157,152,  7, 91, 49, 31,157,154, 56,163,  6,237, 25, 49, 89, 88,104,244, 22,104,245,102,232, 12,102,184,250, 56, 97,243,206,
+253, 72,207,215,226,232,237, 66, 60, 74, 83,194,191,182, 20,132, 84,223, 76,178, 22,147,122,224,176,209,118, 92, 14,  3, 46,135,
+225, 52,  9,108,132, 98,149, 17,  2, 30,  7,  2,145, 24, 82, 33, 15,246, 98, 62,  4,  2, 62,242,243,243,161,215,235,225,235,235,
+ 43,170,218, 10, 18,216,217,138,225, 95,223, 27, 70,147, 25,167,174, 60,192,226,207,135,226,173, 46,173,192,240,109,241, 80, 31,
+  2, 59,103, 59,176, 28, 14,140,102, 22,  6,163,  5,  0, 71, 87,153,158,143,143, 79, 15,169, 84, 42,213,104, 52,202,244,244,244,
+136,220, 71,135,211, 45,220,193, 19,207,132, 95,220, 57,224,237,183, 16, 29, 19,139,  3,135,143, 93, 45,116,145,207, 40,255,159,
+166, 77,155,182,115,117,117,181, 45, 42, 42, 82,220,191,127,255,214,203, 62, 23, 16, 14,231,179,246,157,186, 65, 37,203, 71, 94,
+ 70,138,213, 79,209,141,235,216,225,155, 37,235, 91,  6, 52, 10,104,105, 33,165,198,171,137,175, 29,190,152,183,166,101, 67,255,
+ 70, 45,203,  7,132, 52,246,173,186, 44, 27, 79, 98,215,123,204,248,233, 75,  6, 13, 31,139,139,225,199,176, 98,241,151, 59,165,
+ 14,110,141,157,157, 28, 90, 52,107,215, 27, 87,207, 31,131,200,206, 19, 78, 46,158,157, 70,127, 56,181,215,240,209,147,112,227,
+234,121,172, 94,250,245, 14,139, 94,249,187, 53,235, 42,117,175,239,214, 60,164,205, 40, 59,103, 15,200,228, 74,216, 57,185,163,
+113,112,235, 81, 15,238,234,103,170,243,147, 11, 94,218,116, 16,  2,189,145,160, 68,101, 68, 70,129, 22,169,185,165, 70,139,101,
+107,144, 19,100, 97, 25, 91, 17,143,231,108,122,236,123,239,252, 69, 82,199,199,131, 89,182,240, 75,174, 17, 34, 20,200, 74, 77,
+ 86,129,194,128,  2,185,  1, 42,157,  9,206, 82, 30, 88, 11, 91,227,167,238, 18,149, 17,118, 18, 62, 28, 36,  2,171,163,140, 21,
+177,241,215,189,  1,119,227,179,135,172, 88,177, 74,114, 39,249, 41,147,197, 47,141,102,  9,  5, 92, 88, 88, 22,176,226,138,231,
+243,248,211,  6,247,235,133,140, 66,109,233,168,101, 14,  3,255,160, 54,112, 21,179,232, 25, 58, 11,  0, 48,176, 95,105,106, 91,
+114,142, 26,199,255, 44,  0,158, 77,236,174,186, 45,214,106,185,155,118,157,252,108,255,190, 61, 14, 58, 11, 15,191,156, 78,133,
+ 70,111,134, 72,192,133, 80,192,133, 88,192,125, 38, 31,187,122,163, 85,154,115,151, 94,104,130, 70,167,131, 66,107,  2,  1,112,
+235,177, 10, 90,131, 25,114,181,  9,237,  2,157, 94, 45, 16,194, 48, 39,  9, 33,253,159, 55, 68,207,155,165,167, 34, 82, 21,105,
+220,126, 90,163,252,243,149, 25,185,167,115,182,  0,212,104,  4, 23,239,121,231,248,244,178, 64,234,212,216,193,206,225,207, 51,
+167, 79,216, 30,190,203, 34, 34,166,212,100,153,180,133, 88, 62,115,100,166, 66, 86,216, 29, 64,146,181, 95, 38,113,109, 28, 44,
+178, 17, 94,252, 97,213, 47, 70,119,143, 90,236,161, 63,101,249,114,141,229, 25, 55, 97,209,235, 57,132, 37,  2, 93,222, 99,171,
+250, 16, 56, 28,198, 56,239,147,119,192, 18,130,249,171,246,227,251, 25,161,176, 21,143,150, 48, 12, 35, 81,235,204,248,124,193,
+ 22, 44,255,102,156,157, 68,200,  3,195,148,230, 68,141, 25,241,142,117, 39,160,206,140,196,155,187, 85,202,228, 19,113, 79,119,
+ 23,182,237,244,118,100,219,182,109,101, 78, 78, 78, 16,139,197,127, 69, 42, 42,193,195,195,227,155,121,243,230,  5, 76,158, 60,
+249, 73,177, 79, 30,143,135,143, 63,250,136, 99,177, 16,156, 62,189, 13,110,117, 67,112,236,220,159,232,219,163, 53, 84, 26, 29,
+138,101, 74,176,224,190,244,137,168,148, 21, 94,204, 77,189,215,166, 99,247,129,136, 56,123,132,252,121,122,235,132,154,212,232,
+113,114,118,202,136,186,151,216,152, 97,156, 75, 35, 90,101, 38,203, 96, 98, 81,199, 67,130,140,212, 68, 56, 58, 56,100, 88,171,
+ 39,118, 11, 24,204,112,200,100,  6,100,155, 58, 47, 97, 63,  0,162,206,137, 27,185,255,247, 77, 49,177,247,239, 44, 30, 48,106,
+ 26,175,247,240,143,184, 63, 47,153,250, 53,  0,107, 11,239, 25, 31, 61,122,244, 96,220,184,113, 29,110,220,184, 97,  1,160, 97,
+ 24,198,196,229,114, 37,  6,131, 65,208,189,123,119,249,195,135, 15, 35, 80,113,210,226, 51,116,250, 96,191, 43, 35, 84,190,109,
+195, 26, 71,214,177, 83,190,213,189,115,123,180,111,234,131,140,206,237,  1, 96, 90,154,202, 54, 64,215,112,203, 94,147, 89,124,
+234,231, 95,143,127, 63, 33,180,215,231, 59,121,243, 87,228,156,152, 95,101, 34,106, 70,220,229, 62, 21,217,120, 30,151,  3, 59,
+ 49, 31,182, 98, 30,236,196,124,216,137,248, 48,153, 73, 77,158, 28,137,201,204,150, 70,180, 12,102,168,180,102, 92,188,147,135,
+ 92,185,  1, 50,165, 17, 90,163,  5,  4,164,244,105,212,138,214,188,224,241,117,199,242, 59,169,163,111,136,124,211,218,159,236,
+ 15, 94,203,124, 50,162,207, 65, 98,  3, 59, 73,233,104,236, 43, 87,174,192,197,165,250,167,125,150,101,113,224,204, 45,172,216,
+126, 17,103,182,125,  5,145,128,139,224,193, 11, 48,118, 72, 91,176,132, 69,226,163,216, 60,255, 38,205, 61, 56, 28, 49, 56, 12,
+  3,189,137,  5, 64, 42,221,159,  6,131,193, 37, 61, 61, 93,225,231,231,231,233,237,237, 61,156,203,229, 18, 40,239,232,143,236,
+ 41,214, 92, 56,241,187, 68,173,213, 91, 36,102,249, 54,191, 28,109,127,248,249,129, 97, 24, 98,111,111, 47,184,120,241,162, 42,
+ 40, 40,200,237, 37, 47, 37,142,216,189,209,234,241, 83, 62, 27,222,176, 65,  3,236,255,125, 27,  8, 97, 14, 90,251,207,187,142,
+223,192,194,217,207,142, 48,252, 98,222,154,150,203, 23, 76,123,230,189, 41,179, 87, 84, 57,234, 80, 44,180,157, 49,116,228, 68,
+ 68,222,250,  3, 63, 46,248, 98,143, 94, 85, 60,214,100, 54,189, 91,156,147,188,167,126,147,182, 32, 70, 37,194,247,253,132,208,
+247, 39,  8,123, 15, 24,142, 27, 87,207,227,251,175,167,236,210,200,242, 63,128,149, 73,206, 44,225, 79,238,222,103,  8, 95,171,
+ 55, 98,205,178,111, 49,105,198, 98,180,235, 49,144,127,255,206,159,147,  1,124,103,117, 58,132,209,130,238, 65,174,165,230,217,
+196,226, 88, 50,151, 87,209, 25,200,227, 50,156, 22, 13, 28,161, 53,152,161,168,230,161,146, 39,224,231,202,228,138,186,235,190,
+255,140,171,214,153, 81, 32, 55, 32, 95,174, 71,161,236, 47,131, 85, 40,215,163, 64,110,  0,159,199, 32, 62, 41, 13, 28, 62,175,
+198,249,121, 37, 42, 19,218, 52,114, 42,189, 70, 95,178,119,196,196,179,111,123,230,242,221,161, 43, 86,172, 20,221, 77, 81, 34,
+ 38, 89, 81, 22,201,226, 66,200,231,192,166,236,119, 11, 91,154, 27, 89, 21,246,110, 13,234,135,141, 25,221,211,222, 86,140,236,
+132,124,240,184,165, 37, 98, 28,220,125,224, 32,212, 97,234,148,137,112,117,113, 68,122,161, 30,171, 15,199, 35,230,193, 99,176,
+218,154,109,246,154, 95,246,244, 29,255,241, 23,142, 28,190, 13,118,156, 77, 41, 93, 79,174,  5, 15,255, 60,174,203, 78,188,167,
+ 86, 41,138,  8,136,197,202, 28,100,134,152, 45,165,167,219,247,243,103, 97,207,246, 13, 56, 27,149,255,228, 12,188,118,112, 57,
+ 62,155,189,  8,133, 10,  3, 42, 58, 47,171,242, 35,  0, 10,158,138, 68,189,176,252,148, 57,170,104,153, 41, 91, 54, 84,162, 97,
+120,206, 92, 25,158,123,223,240,156, 94, 69,181,255, 54, 85,219,117,248,130, 41,114,116,107, 38, 17, 73,255, 56,125,250,184,244,
+ 72, 12,121, 98,178,140,154, 66,178,120,218,192, 76,133,172,160,119,141, 76,150,155,127, 51,161, 68,120,121,238,162,213,122,143,
+ 90,117,205,167,238, 40,138,148, 58,139,249,197, 28,  4,169, 69,234,224,166,227,217,  8, 87,240,181,134,111, 11, 11,227,212,213,
+ 69,158, 88, 66,112,226,102, 46,  8, 41,125, 68,218,119, 37, 11,101, 79,230,176,176,165,221, 42,231,238,228,131, 87,150,135, 98,
+109,248,123,227, 47, 27, 20,253,131,228,234, 81,223,207,127,210, 93,216,174,121,105, 36,203,222,222, 30,142,142,142,176,181,181,
+ 69,117, 93,135, 12,195,140, 25, 63,126,252, 11, 79,255,249,249,249,232,213,179, 59,214,110,216,140,230, 61,195,112,238,250, 89,
+ 24, 77, 44,130,155, 52, 64, 93,111, 39,100,228, 41, 95,234, 66,151,122,  4,124,220,166,251,144,175, 59,245, 24,136,139,103, 14,
+145, 63,207,252, 58,177,166,133, 16,251,247,234,112,124,225,194,249,245,231, 46, 94, 39,180, 19,241, 16,167, 50,128,195, 48,168,
+227, 33,129,139,148,131,136, 35, 59,116,161,  3, 59, 88, 93, 28,207,199,167,214,206,229,107, 55, 73,151, 47, 93,208, 61, 50,138,
+185,168,202,142, 47,  6,  0, 77,222,163,101, 15,129,  7,181,255,  8, 63,213,188,235, 59,240,240,110,240, 86,114,222, 67,171,205,
+  6,  0, 77, 82, 82, 82,242,220,185,115,  3,150, 46, 93, 74,184, 92, 46, 11, 64,184,106,213, 42, 77, 66, 66,194, 29,148, 14,205,
+ 69,117, 55,155,158,111, 53,253,220,214,198,210,206, 89,194,105,218,192, 83,130,246, 77, 75,123, 69, 67,251,119,130,143,175, 47,
+146,114, 53, 45,138, 53, 44, 95,101,224, 54, 88,255, 75,204,237,122,174,220,  9,102,173,225,  1,128,163, 53, 61, 62, 12,254, 74,
+144, 47,143,102,217,137,249, 96, 75,207,149, 26, 25, 45,189,209,  2,173,222,  2,173,193, 12,181,193,  2,141,193,  2,150,148, 94,
+ 19, 12,195,192,104,102, 97,213, 99,243,115,231,190,189,179, 43, 26,212, 99, 96, 47, 41, 93, 55,251,178,114, 15, 12,  0, 23, 23,
+ 23,184,187,187, 91, 21, 21, 53, 24, 75, 47,113,131,137,125,210,173,111, 48,154, 65,  8, 65,124,252,163,175, 82,147,147,  7,251,
+249,251,117,105, 18,220,220, 89, 34,228,  0, 64,165, 70, 75,163,209, 88,236,236,236,220,157,157,157, 57, 89, 89, 89, 79,204,179,
+ 95,139,238,230,195,135, 14, 98,232,208,119, 84,113,183,238, 62, 25,226,174,213,106,153,142, 29, 59,218,251,248,248,112,244,122,
+189,162,166,135, 73,234,214,104,136,147,139,243,226, 49, 31, 76,106,212,189, 87, 95, 92,186, 16,142,163,135,118,255,166, 41,136,
+ 15,183, 86, 36, 32, 32,240,133, 81,135, 13,253, 27,189, 48,234,176,110,125,255, 42,141, 86,147,224,214,109,  9,195,195,217, 19,
+251,136,142, 99,156,  2,128,181,232,148,251,246,110,252,230,187,145,147,103, 55,236, 55,104, 36,198,188, 63, 22, 60, 30, 23, 17,
+231,142, 99,249,130,233, 39, 85,242,252, 48,107,210,  4, 74, 67,111,141,  5,181,196, 62,159,250, 54,108,134,168, 63,175, 34, 49,
+254,126,236,221,219, 55,154,250,  5,181,131,155,119,157, 79,211, 92,185, 75, 17, 23,103,172, 78,198,160,211,165,141, 13,123, 31,
+ 79,143, 58,108, 31, 18,224,194, 60,127,  1,  0,208, 40,243,141, 91,127,250, 60,161,124,212, 33,107, 52,164, 85,166, 43, 47, 41,
+ 56, 16,113,253,230,140,193,253,251,114, 10, 21,134,210,  8,150,220, 80,246,210,163,176,252,119,133, 30,254,222,182,120, 20, 27,
+197,234,228,133,  7,107,120, 93,234,198,190,219,231, 65,249,185,203,178,  4, 12,160,171,113,183, 20,223,126,226,178, 31, 87,136,
+238, 38,171, 16,147,162, 40,237, 42,228,115, 75, 13, 22,159,243,196,116,149,142,102,175, 38, 58,196,112,191,255, 48,108,  4, 10,
+ 21, 70,176, 44,192,227,114,202, 94,  2,164, 43, 25,100, 40, 53, 40, 44, 41, 64,114,106, 26,100,185,137,224,112, 56,112,245,110,
+100,117, 37,105, 11,177,241,210, 24, 72,208,240,254, 93,120,135,254,200,129, 68,200,131, 94,153,135,211,123,127, 42,208,171, 20,
+139,181, 26,213, 33,107,234, 57,254,149,130,192, 20, 40, 84, 58, 15, 33,159,139,253,219,215,225,221,177, 83,158,105,125,191,154,
+179, 16,224, 48, 40, 46, 81,130, 97,152,130,154,181, 75,204,237,170,150, 95, 50, 50,246,202, 26, 21,152,173, 23, 31, 20, 42,127,
+ 26, 37,167,195,207, 28,151, 94, 75, 21,226,214,163,156, 50,147, 85,192, 46,250,164,127,166, 82, 94,220,  7, 64,124,205,158, 11,
+ 57,125, 66, 63,156, 17,219,160, 81, 19,253,165,251,170, 20,153,218, 84,105,158, 67,251,225,115, 99, 35, 79,174,237, 39, 55, 37,
+125, 36,245,106, 98, 97,205,230,101,218,130,248,  5,149,116, 29,218, 44, 88,189,255, 73,183,225,204,165, 59, 74,127,183, 88, 96,
+ 33, 44,  8, 11, 76,253,102, 35,204,172,  5,172,197,  2,214, 66, 96,178, 16, 73,117,171,235,238, 93,247, 80,201,195,125,129,163,
+190,123,177,187,208,209,209, 17, 46, 46, 46,112,113,113,129,189,189,125,181, 70,139,207,231,219,242,120,207,238,234,180,180, 52,
+164,166,166,194,222,222, 30,132, 53,193, 96,  2,154,181,235,141,123,137,247,113,254,218, 29, 16,214,  2,169,109,205,103,121,145,
+122,  4,124,212,186,219,224,117, 61,  6,141,195,185, 67,191,144,219, 87,142, 79,210,230,199,111,177, 58, 66,111,177, 48, 38,147,
+  9,253,123,119, 75,139,142,125,124,102,206,140,201,125, 59, 12,152, 36,108, 31, 80, 11, 58,131,  5,153,169,137,136, 56,242,171,
+174, 81,125,175,179, 61, 59,183, 77, 51,153, 76,176, 88, 44,213,222,200,117,  6, 99, 33,151, 47,150,142, 24, 49,138,127,251,214,
+173,131, 82, 55,255,253, 22,134,115,151, 33,108, 48, 67,200,208,224,224,198, 48,154, 88,104, 52,138,146,154,110,179, 82,169, 76,
+222,182,109, 91,253,176,176, 48, 73,147, 38, 77,248,137,137,137, 88,190,124,121,145, 82,169, 76,182, 86, 35,252,202,163, 85, 60,
+166, 36,161, 60,162,149,222,169, 61, 70, 12,232,132, 61, 39,175, 33,226,234, 13,164,169,108,239,168,204,188, 35, 25,105,217,250,
+166,206,138,131,131,218,215,229,238,223, 94,114, 48,182,219,172,247,  8, 17,134, 23, 94,158,175,182,254,226,  6,148, 90, 19,236,
+ 37,165,245,158,202, 35, 91, 92,134,177,218, 17, 49, 64,242,213, 27, 81,205, 90,249, 55, 65,116,178, 28,249, 50, 61,180,122, 51,
+ 88,150,128,  5,129,139,157, 13, 68,  2, 14,210, 83,147,193, 18, 99, 74, 13,111, 21,  5, 93,187,116,229,  1, 12, 24,134,240,248,
+ 60, 30,  8, 74,235, 43,138,197, 98,149,187,187,187, 85, 17, 45,163,217,140,161,125,219,162, 93,235, 96, 12,158, 84, 90, 51,243,
+194,111,179,224,100,203,199,158,157, 91,144,113,101,213,206,250,237, 39,135,223,191, 23, 59, 44, 54,250,143, 81,111,183, 20,183,
+240,228,101, 11, 42, 11,147,170,213,234,131,  0,108,  4,  2, 65,223, 46, 93,186, 56, 31, 60,120, 80,230,234,234,202,218,  8,  4,
+  5,131,  6, 14, 96,249,  2, 65,113,249,103,175, 95,191,206,159, 52,105,146, 93, 73, 73, 73,122, 94, 94,222, 13,  0,166,170, 31,
+  4,  3,122,129,131,221, 96, 24,145,173, 88,146, 86,175, 94,  3,239,214,237,218, 58, 12, 25,250, 46,132, 54, 66,156, 11, 63,131,
+ 53, 43,151,238, 83,229,196,125, 88,147, 61,249,186, 70, 29,102,166,167, 36,107,180,250,160,102,173,186, 49, 87,195,143, 76, 51,
+194,117, 37, 87,104,252,169,215,208, 41, 13,147,179, 85, 88,179,228, 43, 56, 57, 72,145,146,248, 80,155, 16,119,111,163, 73,167,
+248,202,106,147,  5, 64, 82,100, 25,214,254,253,190, 78,122,163,  5, 87, 46,158,212,177,102,182,239,141,203,167, 18,107, 55,106,
+ 45,106,214,186,167, 83,225,209, 45, 67, 53,192,158,234,116,178, 30,190, 24,193, 37,  6, 89,202,133,139,231, 29, 60,234, 52,229,
+ 50, 96, 96,212,235, 80,144,116,219,172,201,123,168, 80,100,221,183,106, 20,110, 81,  6,190,153, 61,239,135,143, 90,183,106, 37,
+ 37, 16, 61, 19,193, 42, 55, 88,133, 10,  3, 92,237,108,160, 85, 20, 32,225,246, 25,157,166,128, 91,101,189, 51,179, 65, 45, 41,
+204,207,179,249, 43,157, 33,190, 93, 85,159, 47,204,207,179, 49, 27,212,146,234,111,117, 92,216, 75,109,112, 47, 37,235, 73,226,
+187,144, 95,154,155,101,195,231, 62,201,211, 42,111, 11,170,161,155, 64,228,136,172, 34, 29, 24, 16,176, 22, 51,204, 38,  3,148,
+ 10,  5,178,178,115,145,151,155,  7,165, 82,  6,137,173, 19,154,181,104,  3, 59,169,  8,119, 35,246,129, 16, 98, 85, 93, 67, 19,
+195, 15,104,221,174,179,240,126,106,105, 46,150,136, 79,112,124,247,210, 34,149, 34,191,179, 42, 39, 33,161,166,109,177,217, 98,
+ 57, 31,243, 32,161,105,109,175,122,204,157, 68, 57,118,110, 94, 11, 67, 89,100,211,100,178,224,126,186, 26, 57,197, 26,164, 39,
+197, 17,214, 98, 57,143,255,  8,188,202,  3,128,224,  5, 55,107,140,222,163,135, 96,195,134,141, 72, 74, 78,101, 23, 79,235,151,
+174, 82,202,222,174,129,201,234,133,178, 90, 27,154,188, 71,203,180, 78,173, 51,143, 69, 23,115,180,  6, 82,101,130,143,200,173,
+ 14, 58,127,184,252,172, 86, 89,108, 99,209,107,120,199,119,126,184,187, 34,205, 82,  7, 13,195,226, 47, 66, 97, 43,230,129, 97,
+ 24,148,119, 23,174, 95, 56, 17, 18, 97,105,223,178, 86,111,198,232,207, 87, 96,231,138,233, 32,  0, 70,190,123, 77, 83,217,122,
+162,116,238,194,169, 94,184, 85, 59, 45, 53, 63,171,215,192, 47, 46,232,140, 66,253,128,119,194, 34, 91,181,106, 37, 19,139,197,
+ 16,139,197,176,183,183,135,147,147, 19, 28, 29, 29,171,221,118,147,201,164, 50, 24, 12, 46, 54, 54, 54, 96, 89, 22, 41, 41, 41,
+ 72, 73, 73,129, 92, 46, 71, 65, 65,  1,212, 42,133,249,214,133,253,188,102,237,251,193,187, 65, 16,234,248, 55,  7,159,203,128,
+199,227, 32,226,216,230,202,214,179, 98,147,213,117,208,250,158,131,199,227,220,161, 77,228,246,149,227,147,181,249,241,155,173,
+ 61, 70,101,221, 61,119,135, 14, 29, 26, 52,105,210, 36,193,188, 25,147,206,158, 12,143,136,223,127, 98,211,192,146, 18,153, 15,
+ 33,  4,142, 14, 14, 25,161,  3, 59, 28,239,222,177,117,218,133, 11, 23,216,221,187,119,235, 25,134,185, 87,149,102,105, 35,149,
+255,219,133,243, 23,231,119,238,218, 13, 91,182,239,238, 26,251, 32,174,107, 98, 98,  2,124,234, 52, 64,189,250,254,208, 48, 78,
+184,120,249, 42, 84,178,252,223,172, 89,207,231,162, 90, 76, 73, 73,201, 31,161,161,161,189,175, 93,187,198,  9, 13, 13,213, 20,
+ 22, 22, 94,127, 42,138, 69,170,211,188,241,243, 59,  5,  0,126,171,211,117,236,190, 44,163,236, 83,  0, 75,125,235,248, 34,226,
+234, 13,220,184,118,115, 99,161,196,119,193,135,163, 63,152, 88,119, 16,119,252,160,246,117,185,238, 78, 18,252,190,105, 57,247,
+216,141,212, 21,169, 69,150, 45, 75, 47,207, 95,104,205, 49,122,114,227, 80, 26,209,177,177, 51, 76, 22,  2,150,148, 54,184,118,
+ 34,126,101, 13,239, 11,154, 60,131,240,195,201,147, 38, 37, 54, 11,110,241,217,232, 15, 38, 11, 90, 52,240,193,173,199, 50,128,
+ 97,224,236, 41, 69, 78, 78, 14,174, 28,216,100, 46,201,122,184,145,203,101,191,171,193,254, 68, 73,218, 29,191,167, 22, 39, 22,
+ 22, 22, 34, 34, 34,  2,229,  6,203,205,205,173, 50,163,245,140,102, 81, 94,246,245,133, 63,254,210,113,194,152,119, 48,160, 91,
+ 83, 92,190,157,  8, 67, 89,189,166,242,161,228,201, 55,126,182,249, 52,180,129,225,163,161,141, 20, 90,147, 77,234, 55, 41,242,
+ 43, 40,157,131,149,173,100, 61, 13,197,197,197,199, 30, 61,122,212,169,121,243,230,117, 79,157, 58, 85, 28,123,243,236,180,167,
+ 87,226,139, 47,190,176,221,176, 97,131,132, 16,114,221, 96, 48, 36, 89,181,237, 28,252, 30, 21, 25,233, 98, 52,177,184,122,243,
+110,227,158, 29, 91,128, 37,192,237,219,183,177,101,235, 22,221,189,152, 59, 63,169,243, 60,191,171,194,188, 84,184, 63, 45,175,
+ 54,234,240,137,102, 78, 86,234, 79,231, 78, 30,216,217,186,235, 64,140,154,250,221,119, 17, 39,119,207,111,217,121,  0,167,113,
+235,222,136,186,113, 17,231, 79,157,249,193,168, 42,158,143,234,115, 71, 42, 92, 79,161, 88,242, 73,147,150, 93,145,158,150,138,
+148,132,251,191,233,138, 31,103,167, 37,114,127,203,206, 76,155, 92,191,105, 71, 92, 59,187,103, 90, 21, 70,171,202,115,222,199,
+ 77,188,233,212,137, 99, 35, 50, 51,127,246, 84,107,117, 66, 66,136, 78,104,195,203,181,229, 40,247, 42,172, 94,207, 56, 99, 65,
+118,221,161,239,142,158,124,114,205,154,149,124, 15, 71,  9,114, 75,116, 80,104,141, 80,106,140,224, 48, 12,252,188,165,208, 40,
+139,113,249,192,143, 38,131,170, 36, 20, 72, 52, 86,166, 41,117, 15, 88, 84,242,248,226,212, 47,166, 92,130,141,131,143,119,189,
+ 30,179,171,140,214, 41,179,238, 12,252, 98,202,241,  0, 66, 72, 79,169,123,128, 82,157,255,104,110,101,219,206, 48,165,215,247,
+168,238, 62, 48,154, 75,235,143,153, 89,192,194,178,101, 81, 62,128, 60,233,207,103,170,217,118,134,221,123,242, 58,178,243,100,
+208, 26, 76,208, 27,204, 48,154, 44,224,112,185,112,116,114,132,127,189, 16, 56, 56,218, 35, 47, 55, 27, 55, 46, 28, 67,124,204,
+229,235, 12,193,  2,109, 65,194,  5,107,142,145, 64,236, 24,224,229,237,201,201, 81, 24, 32,182,225,226,206,229, 83, 70,147, 65,
+255,147,149, 38,235,  5, 77, 89, 81,241,138,207,102,124, 57,242,215,109,219, 61,131,234,219, 35,179, 80,139,204,  2, 29,148, 58,
+ 83,153, 17, 99,161, 87, 21, 34,230,226,246, 92,139, 78,185,  2,255, 17, 42, 53, 90,102,163, 78,121,240,204, 45,151, 89,243,127,
+228, 62, 78, 76, 50, 45,250,180,127,166, 86,165,232, 87,227, 72,214, 83,252,250,113,253, 61,111, 98, 35, 94,232, 46, 36, 44, 88,
+ 66,112,252,102,238,147,238, 66,182, 44,243, 50, 58,177,234,105,  4,159,158,187,176, 91,191,105,231, 98, 30, 41,119,105,181,121,
+ 14, 15, 31,255, 84,  2,  0, 92, 46,247,201,171, 60, 55, 75,167,211, 25,170,233, 66,217,177,121,243,230,153,147, 39, 79, 22,102,
+100,100, 32, 49, 49, 17, 50,153, 12, 34,145,  8,103,206,156, 49,129, 53,255, 20,115,237,112,202,163,168,240,111,  3, 90,245,174,
+ 29,212,190, 31, 36, 18, 41,120,196,250,100, 76,137,123,163, 17,173,186, 14, 90,215,115,200,  4,156, 63,188,153,220,190,124,108,
+138,182, 32,126, 83, 77,247,165, 76, 38,139,  5,144,240,211, 79, 63,181,216,178,101, 75,253, 25, 51,102, 36,237, 88, 55,127, 13,
+  0, 20, 21, 21,  1,  0,162,163,163,201,148, 41, 83,244, 58,157, 46,185,164,164, 36, 10,213, 12,128,  0,  0,109,129,228,251, 45,
+235,151, 54,203,200,202,121,167, 65,179, 54,112,171,223,  6,158,126,109, 81,162, 52,226,214,227,108, 36,197, 93, 64,220,213,  3,
+167, 52,182,230,249,168, 97,125,227,230,205,155,251,112, 56,156,122, 42,149,202,179, 73,147, 38,205,165, 82,105,116,243,230,205,
+ 67,120, 60, 94,102,100,100,100,106, 77,180,210, 46,111,215,215,233, 58,118,117,154,210,174,123, 82,174, 38, 36, 77,105, 23,173,
+ 17, 58, 76, 47,184,184, 90,255, 43,183,214, 10, 98, 44,140,221,191, 93,113,240,247, 77,203,185,163, 39,126, 97,185, 47,119,250,
+148, 39,182, 57, 87,179,112, 53, 39,231,163,176,193,127,149,119, 40,139,100,149,253,110, 85,152, 94, 46,143,145,  3,152, 25,243,
+128,191,238,254,167,147, 22,  6,183,238,248,126,151,183, 67, 57,102,129, 45,206, 30,254,153, 36,199, 92,220,207, 35,150, 57, 90,
+ 43,102,  3,168,182, 59,200, 96,176,198,100,189,184,142, 25,210,110,251,119,111, 29,123,240,240,161, 37, 67,  6, 13,118, 89,255,
+205,123,248,241,151, 35,144,138,133, 32, 44,139,247,186,251, 12,255,118,124,224, 64, 31, 15, 81,173,131,151, 50,175, 76, 93,121,
+127,166, 70, 99,140,183, 34, 18, 67, 10, 11, 11,175,218,218,218, 22,116,234,212,169,157, 80, 40,100, 10, 11, 11,121,238,238,238,
+102,  7,  7,  7, 67,102,102,166, 70,175,215, 31,  4, 80,163,178,227, 70, 19,139,148, 60, 29,142, 30, 58,136,187, 55, 47, 32, 46,
+238,145, 50,238, 65,220, 90,134, 71, 86,170,243, 18,138,129, 26, 63,224,131,173,112,212, 33,169,241,168, 67,139, 94,249,251,142,
+141,139,122,104,116,250,177,205, 59,244, 71,221,198, 29, 57, 70,147,  5,247,110, 95,194,165,  3, 43,127, 52,170,138,103,189,202,
+ 49,246,174, 93,223,159,112,109,240, 71,196, 73, 16,150,221,  8,  0,132,101, 55, 70, 95, 59, 53,185,109,191,241,112,118,175,219,
+ 92,150, 30,205,224, 37,170,135, 11,120, 28,245,233,131,191, 30, 78, 73, 73,193,195,135, 15,241,248,241, 99, 20, 23, 23,227,247,
+223, 83,106,116,124, 52, 37,169,231,226, 31,112,250, 12,123,111,212,241,225, 35,198,136,234,251,  7,113,  2,106, 59,193,197,150,
+135, 71,143, 83, 17, 31, 25,195, 62,186,117, 74,103, 84,228, 15,209,150,164, 86,106,252, 36,174,141, 61,  0,203,172,242,185, 11,
+219,183,239, 24,240,229,226, 37,237, 92,220,220, 43,108,199,139, 10,242,109,190,154,122, 44,224,198,159,127, 88, 53,215, 33,107,
+177, 20, 77, 28, 27,202,114, 75, 39, 10,197,147, 56,117,217,222, 43,125,152, 42,125,159,176,230,106, 35,248, 31,188,211, 25,102,
+150,133, 90,107,132, 66,173,135, 92,169, 67, 78,126, 17,238,198,196,224,242,241, 99, 72,124,116, 55,217,100, 48,132,115, 56,204,
+  1,109, 94,252,229,154,245, 52,241,234,187, 56, 59, 35,185, 88,  5,145, 13, 15,169,241,145,122,181, 66,190,235,101,207, 35,109,
+ 81, 66, 78, 62,151,233, 29, 26, 58,226, 76,143, 62,131, 28, 90,119,232, 37,113,181,119,132,128, 71,144,144,146,141,168,235,103,
+212, 73,119,175, 40, 76,  6, 85,223,215, 49,235,203,223,156,234, 71, 29, 26,245,234,129, 35,  7,119, 61,196,229,242,108, 88,214,
+172, 55, 26,244,195, 94,197,100,189, 41,  8,177,100,142, 29,249,206, 51,207,  6,102,150,136, 71,190,123, 86,251,244,179,130,201,
+ 66, 36, 35,223,189,174, 41,109, 64, 42, 79,236,243,242,114,238, 95, 62,119, 97, 90, 90,209,237,226, 98,253, 37,  0,153, 58,157,
+238,165,215, 49, 47, 47,111,225,226,197,139,  7,104, 52,154,192,110,221,186,  9,237,237,237, 81, 84, 84,132,240,240,112,211,137,
+ 19, 39, 30,228,231,231,127, 11,228,155,181,  8,249, 45, 70,119, 56,236, 81,100,248,183,129,173,250,212, 14,234,208,207,250,198,
+ 76, 40,158,208, 99,208, 56,230,252,145,205,228, 86,196,145,143,180,  5,  9,191,188,194,110, 53,234,116,186,155, 58,157,238,254,
+156, 57,115, 90,123,120,120,120,124,251,237,183, 34,133, 66,193, 95,191,126,189,174,176,176, 48, 87,161, 80,220, 64, 21,249, 52,
+ 47, 18,109,146,103, 97,232,233,131,155,187,147,131,155,223,114,116,173,213,219,193,173,118, 67, 89, 65, 86,178,188, 32, 59, 28,
+192,249,178, 66,145, 53,162, 69,139, 22, 13, 24,134,  9,  5,208, 76, 42,149,250,217,218,218, 10,  9, 33,129, 12,195,196,178, 44,
+ 27,211,164, 73,147, 19, 15, 30, 60,168, 81, 49,217,180,203,219,245, 62,  1, 29,119, 23,107, 88,129,129, 35,216,157,118,121,187,
+ 30,  0,242,207,125,169,  1,112,244, 65,183,153, 67,143,221, 72, 93, 19, 91,226, 48,173, 32, 98,201,177,154,174,179, 60,243,174,
+223,235, 58,255,117, 57, 15, 50,  1,140,141,137,196,242,123,209, 55,230, 49,  4,124, 11,204,139,180,249,143, 35, 95,135, 62,159,
+207,215,213,170, 85,171,194,209,133, 66,161, 80,167,215, 87, 21, 64,185,108, 86,229, 96, 11,208,117,251,161,125,219,199, 30, 57,
+118,116, 73,151,158, 67, 92, 68,181,107,163,158, 59,131,237,179, 90, 78,187, 16, 93,112,107,208,151, 87, 54, 36,101,235, 98, 80,
+195,124, 24,149, 74, 21, 15,160, 68,165, 82, 13, 38,132,100, 48, 12,227, 83, 82, 82,114,199,100, 50,221,171,177, 33, 96, 49,170,
+125,251, 54,191, 51, 12,195, 35,102,118,217, 13, 62,119,183, 46, 39, 46, 19,175, 56, 45, 73, 80, 61,123,124,254,237,234,150, 13,
+253, 26,181, 44,159,235,176,105, 93, 59, 76,154,185,188,101,221,250,254, 45,255,154,255,176,218, 52,  1, 98,210,148,124,120,104,
+235,178, 43,209,127, 94,250,218,213,171,110,221,220,204,164,184,140,199,119, 22, 90,116,138, 67,175,122,156, 83, 30,199,174,220,
+242,211,204, 25, 57, 89,201, 91, 52,  5,  9,247,  1, 64, 83,144,112, 63, 46, 10,223, 20,230,102,206, 40,202, 79,250,233,101,247,
+133, 90,173,206,222,181,107,151, 99,199,142, 29, 57, 30, 30, 30, 40, 40, 40,192,165, 75,151, 88,150,101,179,106,172, 85,156,124,
+ 73, 93,204, 56,255,246,203,186,101,  2,169, 93, 63,179,217,236, 77,  8,192,227,241,114, 12, 26,197, 25, 37, 71,250, 37, 74, 82,
+117, 85,223, 51, 88,  6,  0,167,124,238, 66,150,101,153,101,107,182,167,242, 69,118, 21, 22, 67, 52,233,148, 18,150,101,173,158,
+235, 80,150, 30,213,240,117, 93,223, 12, 33, 11,154,183,106,247,181,201,100,212,149, 93, 31, 58,  0, 58, 66, 80,196,225, 48,151,
+185,172,233,172,226, 21, 30,166, 24,  6,246,132,225,193, 78,204,  3,  3,  6, 42,121, 49,169, 73, 78, 86,133,134, 56, 63, 62, 86,
+147,223,181,206,105,195,190,176,139,231, 78, 53,148,119, 13,  0,  0, 32,  0, 73, 68, 65, 84,189,107,177, 88,234,149,197, 12, 82,
+244, 90,245,126, 85,142,211,111, 64,164, 25,255,126, 78,150,155, 45,230, 13,127,145, 85,221, 40,127, 39,205,128,250,226,193,181,
+107,121,132,165,164,230,223, 74,202,208,252,134,103,167,213,121,149,245,228,122,120,120,124,195, 48,204,251, 54, 54, 54,182,  6,
+131, 65, 77,  8,217,145,151,151,183, 16, 47, 76,254, 27,194, 23,187,107,195,108, 68,146,185, 70,157,250, 15, 77,126,252,168,234,
+182, 93,226,214,168,183, 72, 42,157,169,211,170,119,104,242,226,183,191,230,253,233, 32, 20, 10, 67,108,109,109,249,133,133,133,
+ 55,  1,200,255, 78,199,189,121,243,230,190, 28, 14,167, 30,203,178, 30,  0, 28, 80, 58, 42,164,144,199,227,101,149, 69,180, 72,
+ 77, 53, 59,125,176,223,181,231, 91, 77, 63, 15,191,242,104, 85, 89,183,226, 19,106, 13, 95, 33,122,191, 95,247, 47,126, 59,116,
+180,162, 81,135,255,184,115,254,255, 79,179, 43,207,214,171,112, 44,199,198, 97, 81,207,  0,157,166, 48, 59,107,202,213,123,  5,
+ 55,  1, 40, 95,101, 61,  5,  2,193,104,163,209, 40, 22,  8,  4, 90,163,209,184,235,239,178,237, 98,247,128,113, 28, 16,171,103,
+166, 96,193, 68, 62, 55,104,229,223,114, 46,113,131,130,130, 58, 11,  4,  2, 95,139,197, 34, 49, 24, 12, 26,173, 86,155,146,154,
+154,250,  7, 42,159,248,252,141,174,167,212,221,127,165, 64, 32,252, 20,  0,140, 70,253,106,117,126,194,231, 85,253, 99, 21,159,
+255, 71, 31, 35,215,122,173, 18,120, 92,190, 27,202, 10,115,179,102,115, 65, 94,242,109,255,255,225,122, 82, 94,242,224, 82, 77,
+170, 73, 53,169,230,243,112,232,254,164,154,255, 75, 77,145, 87, 99, 31,145, 87, 99,171,139, 46, 87,242,121,186, 63, 41,229, 76,
+172,224,  5,192,138,130,165, 20, 10,133,242,  6, 96,233, 46,160,252, 47,209,229,196,101,188,201,207, 83,254,115, 84,154, 19,205,
+ 84,225, 74,107, 18, 18,124, 25,103,123,158,106, 82, 77,170, 73, 53,169, 38,213,164,154,255, 57,205,234,180,255,137, 93,146, 19,
+159, 91, 62,  9,224,255, 37,225,159,134, 85,169, 38,213,164,154, 84,147,106, 82, 77,170,249, 95,227,137,241,226,208,125, 65,161,
+ 80, 40, 20, 10,133,242,102,160, 57, 90, 20, 10,133, 66,161, 80, 40,175, 70, 69, 93,135,212,104, 81, 40, 20, 10,133, 66,161,188,
+  6, 42, 77,134,167, 93,135, 20, 10,133, 66,161, 80, 40,175, 70,121, 68,203, 11,207,149,119,160, 70,139, 66,161, 80, 40, 20, 10,
+229,245,144,131,138,162, 91, 39, 78,156, 32, 21,253, 78,161, 80, 40, 20, 10,133,242,255,193, 63,220,139, 60, 29,201,154, 88,182,
+ 12,224,169,136, 22, 53, 88, 20, 10,133, 66,161, 80,254, 46,102,235, 31, 70,121, 36,171,252,149,243,130,209, 26, 48, 96,  0, 67,
+205, 22,133, 66,161, 80, 40,148,255, 21,255, 70, 47,194,121,126,  3,233, 97,166, 80, 40, 20, 10,133,242,191, 52, 91,255,166,237,
+161,229, 29, 40, 20, 10,133, 66,161, 80, 94, 13, 47,  0,253,159, 90,254,127,155,130,135, 66,161, 80, 40, 20, 10,229,223,206,196,
+202,150,105, 68,139, 66,161, 80, 40, 20, 10,229,245,155, 45, 10,133, 66,161, 80, 40, 20,202, 63, 25, 58,179, 57,213,164,154, 84,
+147,106, 82, 77,170, 73, 53,255,237,148,215,209,  2, 42,171,163, 69,161, 80, 40, 20, 10,133, 66,121, 41,250,163,180,126,214,196,
+178,159,253,169,209,162, 80, 40, 20, 10,133, 66,121,189,188, 48,253, 14, 53, 90, 20, 10,133, 66,161, 80, 40,175,215, 96,109,162,
+ 70,139, 66,161, 80, 40, 20, 10,229, 13, 67,141, 22,133, 66,161, 80, 40, 20,202, 27,130, 65,229, 35,  7,206,215, 64,231,101, 70,
+ 31,156,167,154, 84,147,106, 82, 77,170, 73, 53,169,230,127, 78,179, 58,237,243,248,231, 81, 94, 25,254, 36,254, 74,132,223,244,
+255,241,197,116,232, 43,213,164,154, 84,147,106, 82, 77,170, 73, 53,255,237, 76,124,238,231, 19,104,215, 33,133, 66,161, 80, 40,
+ 20,202,235, 53, 91,116, 10, 30, 10,133, 66,161, 80, 40,148,215, 68,165,221,132, 52,162, 69,161, 80, 40, 20, 10,133,242,106, 84,
+ 58,169, 52, 53, 90, 20, 10,133, 66,161, 80, 40,111,198,112, 81,163, 69,161, 80, 40, 20, 10,133,242, 26, 77,214,196, 10,255,122,
+226,196,  9, 66,247, 17,133, 66,161, 80, 40,148,255, 21,255, 90, 47, 82,190, 97,212,108, 81, 40, 20, 10,133, 66,161, 94,164,198,
+120,225,175,209,134, 19,203,150,  1,208, 81,135, 20, 10,133, 66,161, 80, 40,175, 74,127, 60, 59,242,112, 98,249, 50, 53, 90, 20,
+ 10,133, 66,161, 80, 40,175,206,196, 42,255, 74,187, 13, 41, 20, 10,133, 66,161,252, 47,249, 55,122, 17,134, 30, 86, 10,133, 66,
+161, 80, 40,148, 87,162,162,104,214, 38,186, 91, 40, 20, 10,133, 66,161, 80,222,172,225,162, 80, 40, 20, 10,133, 66,161,188,  9,
+147,245,166, 11,150,210,153,205,169, 38,213,164,154, 84,147,106, 82, 77,170,249, 95, 49, 89, 79,151,120,  0, 64, 71, 29, 82, 40,
+ 20, 10,133, 66,161,188, 42,116, 82,105, 10,133, 66,161, 80, 40,148, 55,  4,157, 84,154, 66,161, 80, 40, 20, 10,229,255,217,112,
+ 81,163, 69,161, 80, 40, 20, 10,133,242, 26, 77,214, 51,102,139,230,104, 81, 40, 20, 10,133, 66,161,188, 26,149,230,104, 49,168,
+124,228,192,249, 26,124,193,203,140, 62, 56, 79, 53,169, 38,213,164,154, 84,147,106, 82,205,255,156,102,117,218,231,241,207,103,
+ 34,254,159, 10,150,210,161,175, 84,147,106, 82, 77,170, 73, 53,169, 38,213,252,175, 65,203, 59, 80, 40, 20, 10,133, 66,161,188,
+110, 99,245, 60,212,104, 81, 40, 20, 10,133, 66,161,188, 26,180,142, 22,133, 66,161, 80, 40, 20,202, 27,194, 11,165, 81,173,242,
+159, 33,212,104, 81, 40, 20, 10,133, 66,161,188, 30,250,163, 52,170, 85,254,147, 26, 45, 10,133, 66,161, 80, 40,148,215, 72,133,
+117,180, 24,  0, 56,113,226,  4, 41, 91,238, 54, 96,192,128,203,116, 95, 81, 40, 20, 10,133, 66,249,255,228,223,234, 69,158, 68,
+180,  6, 12, 24,192,  0,136,160,135,154, 66,161, 80, 40, 20,202,255,130,127,163, 23,225, 60,231, 36,187,209,195, 76,161, 80, 40,
+ 20, 10,229,127,193,191,209,139,240,158,115,145, 20, 10,133, 66,161, 80, 40,255, 19,254,193, 94,196, 11,165,137,240, 39,203,126,
+  2,101, 37, 31,104, 29, 45, 10,133, 66,161, 80, 40,148, 87,163,124,180,225, 11, 83,239,208, 40, 22,133, 66,161, 80, 40, 20,202,
+171, 81, 81,101,248, 77,116,183, 80, 40, 20, 10,133, 66,161,188, 65,104, 68,139, 66,161, 80, 40, 20, 10,229,213,121, 58,170,245,
+255, 22,205,162, 51,155, 83, 77,170, 73, 53,169, 38,213,164,154, 84,243,191,100,178,158, 89,166,149,225, 41, 20, 10,133, 66,161,
+ 80,222, 16,116,212, 33,133, 66,161, 80, 40, 20,202,171, 81, 62,226,240,233,101,106,180, 40, 20, 10,133, 66,161, 80, 94,163,217,
+122,  1,218,117, 72,161, 80, 40, 20, 10,133,242,106, 76,172,236, 15,212,104, 81, 40, 20, 10,133, 66,161,188, 33,195,197,160,242,
+145,  3,231,107, 32,252, 50,163, 15,206, 83, 77,170, 73, 53,169, 38,213,164,154, 84,243, 63,167, 89,157,246,121,252,243,248,159,
+ 21, 44,165, 67, 95,169, 38,213,164,154, 84,147,106, 82, 77,170,249,159,133,118, 29, 82, 40, 20, 10,133, 66,161,252, 13,140,150,
+ 27,143,199,251, 90, 44, 22,111, 16,139,197,191,240,120,188,159,  0, 56,213,244, 11,165, 82,233, 52, 79, 79,207,135,158,158,158,
+153,190,190,190,167,236,236, 36,159, 53, 16,162, 11,  0,254,107,218,158,  0,  0,159,137,197,226, 56,145, 72,148, 10, 96, 39,128,
+207,  0,184,190,138,240, 66,111, 12,187,255,233,224, 35, 11,189, 49,236,185, 63,245,247,240,240,184, 10,160,247,235, 58, 40, 35,
+ 36,232, 53, 92,138,244,225, 82,164,143,144,188,252, 83,131,157,157,221,251, 94, 94, 94, 55, 92, 92, 92,178,188,188,188,174,139,
+ 68,162,225, 53,148,112,247,240,240,248,209,199,199, 39,222,219,219,123, 21, 74,103, 39,255,219,210, 89,136,206,237,132, 40,104,
+111,  3,101, 71, 27,108,104,111,131,183,222,  2, 36, 47, 41,215,  9,192,  1,123,123,251, 59, 60, 30,239,  4,128,161,101,231,215,
+ 80, 30,143,119,194,222,222,254, 14,128,  3,101,159,123,153,243,244, 71,  0, 89,  0,190, 47, 91,254,196,199,199, 71, 25, 28, 28,
+156, 26, 28, 28,252,171,159,159,223, 24,107,197, 36, 18,201, 91, 62, 62, 62,  7,125,125,125, 83,219,183,111, 95, 92,171, 86,173,
+ 71,181,107,215,222, 46, 20, 10,187,209, 38,142, 66,161, 80,254,254, 12,  4,176,  4,192,218,152,152,152, 40, 66, 72, 20, 33, 36,
+ 42, 38, 38, 38, 10,192,  6,  0, 75, 81,121,  8,241,153,247, 93, 92, 92, 22, 44, 90,180, 72,151,147,147, 67, 10, 10, 10, 72,124,
+124, 60, 89, 57,119, 38,219,199,153, 71, 26,184, 57,105,188,188,188, 18,235,212,174,189,167,169, 45,103, 38,128,134,214,104, 62,
+133,147, 88, 44,190, 57,119,238, 92,213,213,171, 87, 85,  6,131, 65,197,178,172, 42, 59, 59, 91,117,254,252,121, 85,199,142, 29,
+ 85,  0, 62,  7,192,173,129,230, 19,190,243,198,101,178,245, 27,242,157, 55, 46, 63,253,126, 96, 96,224,  3,150,101,201,176, 97,
+195,244,  0,106,213, 68,243,121,106,  1,162,166,246,112, 28,110,139, 60,243,246,133,132,172,159, 65,134, 75,145,254, 50,154,238,
+238,238, 71,167, 77,155,166,200,202,202, 34,122,189,158,164,167,167,147, 73,147, 38,201,221,221,221,119, 89,185,237, 46, 65, 65,
+ 65,121, 55,110,220, 96,101, 50, 25,137,136,136, 96,155, 53,107,150,103,165,217,234,245,220,186,108,242,246,246, 62, 85,147,151,
+187,187,251,150,154, 30,163,182, 66,164, 27,163, 46, 17,114, 59,156, 28, 27,214,158,172,108, 85,155, 12,117,182,145,117,178,193,
+ 39, 93, 43, 46,101, 82,153,230,187, 93,187,118, 85,223,187,119,207, 82, 84, 84, 68, 30, 60,120,192, 78,152, 48, 65,  7, 32,118,
+194,132,  9,186,  7, 15, 30,176, 69, 69, 69,228,222,189,123,150,174, 93,187,170,  1,140,175,193,122,114,  0,108,155, 63,127, 62,
+ 33,132,144, 69,139, 22,145,224,224, 96,210,163, 71, 15,162, 82,169,  8, 33, 36,149, 16,242,171,217,108, 30,107,141,166,131,131,
+195,251,211,166, 77, 83,105, 52, 26, 82, 14,203,178, 68, 38,147,145,181,107,215,170, 61, 61, 61, 79, 85,242,144, 65,187, 60,168,
+ 38,213,164,154,127, 55,205,127, 50, 94, 40,205,211, 42,127, 89, 29,152, 24, 57,115,230,204,114, 83,117,186, 83,167, 78,183,198,
+142, 29, 27, 53,118,236,216,168, 78,157, 58, 69,  0, 56, 27, 25, 25, 25,245,213, 87, 95, 69,  1, 24, 89,205,129,112,234,208,161,
+131, 44, 55, 55,151,248,251,251,147,186,117,235,146,220,220, 92, 66,  8, 33,183,223,109, 73, 46, 52,  6,201,184,114,154,132, 31,
+ 62, 64, 38,120,241, 72,103, 47,  7,147,151,167,103,145,171,171,235, 98, 60, 59, 39, 99, 69,  7,247,157,198,141, 27, 43, 99, 99,
+ 99, 85,  9,  9,  9,170,  5, 11, 22,168,122,244,232,161, 10, 10, 10, 82, 13, 29, 58, 84,181,102,205, 26,149,209,104, 84,109,217,
+178, 69,101,111,111, 31, 91,129,217,122,105,163,197,227,241, 86,199,196,196,144,196,196, 68, 82, 22,165,168, 76,211,193,209,209,
+177,175,147,147,211,231,142,142,142,125,  1, 56,  0,128, 63, 96,219,220,  1,190,159, 52,111, 16,120, 98,100,175,134,107,123,181,
+110, 57,220,142, 35, 51,173,155, 65,200, 48,223,151, 50, 90, 14, 14, 14,239,127,246,217,103, 74,189, 94, 79, 52, 26, 13, 81,169,
+ 84, 68,163,209, 16,165, 82, 73, 70,142, 28,169, 16,137, 68,239, 84,167,233,234,234,186,240,202,149, 43,230,220,220, 92,114,229,
+202, 21,114,234,212, 41,178,126,253,122,214,221,221,125, 69, 77, 47, 64, 79, 79,207,115,225,225,225, 81,209,209,209, 81, 55,111,
+222,140, 50,153, 76, 81, 70,163, 49,202,104, 52, 70,157, 56,113, 34,234,208,161, 67, 81,123,247,238,141, 50, 24, 12, 81,  6,131,
+ 33, 74,175,215, 71,213,175, 95,255, 76, 77,143, 81, 27, 33, 50, 12, 87,143, 17,178,226, 99, 34,255, 97, 10,145, 77,239, 71,242,
+ 39,117, 33, 27, 90,215, 38, 93,196, 56,142, 23,231,246,172, 80,147,207,231, 95, 78, 77, 77,101,103,207,158,109,104,210,164,137,
+252,195, 15, 63,212,233,245,122, 66,  8, 33,122,189,158,124,248,225,135,186, 38, 77,154,200,103,207,158,109, 72, 73, 73, 97,121,
+ 60,222,249, 26,172,231,210,114,147,117,249,242,101,242, 52, 42,149,138,244,232,209, 35, 53, 56, 56,248,215,122,245,234,141,170,
+ 78,211,214,214,118,240,172, 89,179, 84,164,  2, 76, 38, 19, 81, 42,149, 36, 37, 37,133,173, 91,183,110, 54,  0, 23,218,152, 83,
+ 77,170, 73, 53,169,209,122, 99, 76,172,102,185,226,157,248,213, 87, 95, 69, 17, 66,162,230,204,153, 19, 85, 22,217, 18,  0,176,
+ 45,123,241,  0,140,152, 53,107, 86, 20, 33, 36,106,230,204,153,229,159,169,236, 64, 12,220,191,127,191,113,213,170, 85,196,195,
+195,131,120,122,122,146,213,171, 87, 19,150,101, 73,238,137, 93,228, 66, 99,144,184,175,195,  8, 33,132,196, 47,158, 74, 46, 52,
+  6, 73,218,248, 29, 25, 61,122,180, 70, 34,145,140,172,226,224, 58,183,108,217, 82,169,213,106, 85,219,183,111, 87, 73, 36,146,
+219,  0,154,160,180, 43,146, 41, 91,215, 49, 77,154, 52, 81,220,191,127, 95,181,123,247,110, 21,128,  5, 86,158, 48, 13,  1,116,
+151, 74,165, 67,103,213,226, 39,144,173,223,144, 89, 30,184,  7,160, 25,  0,183,178,207,120,207,156, 57,147, 16, 66,136,143,143,
+207,149, 74, 52, 29,130,130,130,102, 38, 36, 36,204, 51,153, 76,243,162,163,163,231, 53,106,212,104,246,160,250, 94,237,143,140,
+124, 43, 68,254,221,148, 16,178,124,122,208, 79,111,183,233,181, 39,180,219,200, 15,234,185, 94,253,208, 93,164,121,207,129,171,
+124,174,235,208,170, 19,187, 86,173, 90, 55,211,211,211,159,152, 43,165, 82, 73,178,178,178, 72,114,114, 50,185,122,245, 42,241,
+242,242,186, 80,157,166,167,167,231,131,244,244,116,178,113,229, 74, 50,172, 89, 32,233,226,104, 71,186, 58,217,145, 86,182, 34,
+117, 99,160, 85, 77,141,214,157, 59,119,162,  0, 68,  1,136, 42, 42, 42,138, 42, 42, 42,138, 42, 41, 41,121,242, 30,128, 40,185,
+ 92, 30, 37,151,203,163, 12,  6, 67, 84,131,  6, 13,106,108,180, 58,138,208,177,173,  8,197,237,133,208, 14,172,229,154, 61,165,
+190,171,229,207,145,237, 73,201,199, 61,200,170,144, 90,164,147, 13, 62,177, 82,115,160,141,141, 77,  4,128, 25,101,166, 60,172,
+111,223,190, 26, 66,  8,233,219,183,175,  6, 64, 88,217,251,159,149,153,172,190, 86,174, 39,199,207,207, 79, 93, 30,201,  2,240,
+135,159,159,159, 58, 56, 56,152,  4,  7,  7, 19, 31, 31, 31,101,153,182, 85, 13, 90,195,134, 13,227,181, 90,237, 19,  3, 40,147,
+201, 72,118,118, 54, 73, 74, 74, 34,177,177,177,228,246,237,219, 36, 53, 53,149,236,219,183,207,226,232,232,120,146, 54,230, 84,
+147,106, 82, 77,106,180,222,168,209,122,254,245, 44, 39, 78,156, 32,207,189,245, 67,100,100,100,212,172, 89,179,162,170,113,102,
+ 19,231,204,153, 83, 30,245, 90, 82,197,205,127, 75,124,124, 60,  9, 11, 11, 35,  1,  1,  1, 36, 32, 32,128,140, 29, 59,150,200,
+229,114,162,122,124,159, 92,104, 12,114,251,189, 86,132, 16, 66,148,113,209,228, 66, 99,144,168,209, 29,200,221,187,119, 73,237,
+218,181,195,171,248,254,227,215,175, 95, 47,216,181,107, 87, 46, 74,243,177,248,  0,218,  1, 88, 45, 22,139,183,161,180,187,176,
+ 46,  0, 39,127,127,255, 98,141, 70,163, 26, 54,108,152, 10,128,111, 21,154, 93,  3,  2,  2, 18,183,108,217, 66,242,243,243, 73,
+113,113, 49, 89,214,177, 17, 33, 91,191, 33,139, 90,213,101, 55,110,220,168,159, 49, 99,134,218,217,217,249,  4,  0,239, 97,195,
+134,153,  9, 33,164, 75,151, 46,121, 21,137, 57, 58, 58,246, 77, 72, 72,152,167,211,233,230,201,100,178,121,197,197,197,243,142,
+ 29, 57, 50,175, 79,179, 70, 97,242,239,166,132, 28, 25,249, 86,200,219,181,156,134,174,232,221,122,114,214,236,241,195,230,116,
+104, 18,167, 91,250,233,165,119,235,123,252,248, 50, 71,219,205,205, 45, 71,175,215, 19,  0, 47,188, 18, 19, 19,137,139,139, 75,
+122,117, 26,206,206,206,115, 62, 27, 17,106,121,167,110, 45,146,184,106, 46, 49,157,219, 77, 76,167,182,147,199, 63, 76, 39,131,
+ 60, 93, 21,237,  4,156, 89,214,174,143,167,167,231,185,155, 55,111, 62, 99,180, 74, 74, 74, 42, 52, 90, 10,133, 34,202, 96, 48,
+ 68,249,249,249,157,121,213,179,190,157, 13, 26,116, 21,115,111, 71,135,117, 38,  5, 83,122,144,190, 14,252,212, 87,144, 27,  1,
+ 32,  2,192,232, 26,254, 31,  7,192,210,114, 67,245,195, 15, 63, 16, 66,  8,241,243,243, 83,227,213,  6,163, 56,  4,  6,  6, 38,
+143, 31, 63,222,220,184,113,227,252,142, 29, 59,202,110,221,186, 69, 46, 95,190, 76, 78,157, 58, 69, 14, 28, 56, 64,238,223,191,
+ 79,178,178,178, 72,124,124, 60,233,223,191,191, 12, 64, 87,218, 22, 82, 40,148,191, 51, 21,120,145,127, 60,156,242, 13, 27, 48,
+ 96,  0,243,212,  6, 58,  0, 16,181,106,213,170, 96,233,210,165,203, 81, 90, 11,130,  9,226,226,221, 30, 98,222,221, 30, 98,222,
+221, 32, 46,222, 45,139, 24,109, 90,188,120,241,194,224,224,224, 28,  0, 98,  0,158, 21,125, 17, 33,164,179,139,139, 11,210,211,
+211,225,224,224,  0,  7,  7,  7,164,167,167,131, 16,  2, 51,  1, 76,  4,208, 27,141,208,106,181,208,177,  4, 90, 22, 80,168, 84,
+240,244,244,132,209,104,108, 80,201,250, 55,127,239,189,247, 26,  4,  5,  5, 21,124,245,213, 87,217, 40,205,149,217, 54,110,220,
+184,115,127,252,241, 71,144, 74,165, 42,142,141,141,213, 53,107,214,172, 47,  0,207,132,132,132,247,215,174, 93,139,176,176, 48,
+ 84,113,211,105,214,191,127,255, 83,247,239,223,111, 48,122,244,104, 68, 68, 68, 96,217,178,101, 40, 44, 44, 36,  0,160,215,235,
+137,197, 98, 49,118,232,208,193,184,106,213,170, 54, 93,186,116,185, 89,191,126,125, 46,  0, 36, 39, 39, 63,174, 72,144, 97,152,
+ 70,117,234,212,129, 94,175, 71, 65, 65,  1,238,223,191, 15, 59,  7,  7,196,100, 23,122,116, 91,177,177,232,235, 35,231,248, 35,
+218,  4, 57,127,254, 86, 71,253,247,225, 17,254, 77,188, 61, 60, 12, 70,147,103,124, 78, 94,246,203, 28, 84,129, 64,144, 94, 88,
+ 88,  8,131,193,  0,173, 86, 11,133, 66,129,162,162, 34, 20, 22, 22, 34, 59, 59, 27,  2,129, 32,177, 58, 13,251,226,226, 43,201,
+215, 47, 51,251,126,254,  1, 13,204,197,224, 29, 92, 13,222,209, 13,104,104, 40,192, 47,115, 39,217, 25, 92,220,230,219,219,217,
+149, 56, 58, 58,110,  2,224, 87,157, 94, 72, 72,  8,138,138,138, 80, 84, 84,  4, 23, 23, 23, 56, 57, 57,193,201,201,  9, 50,153,
+ 12,114,185, 28, 10,133,  2,254,254,254,104,222,188, 57,118,236,216,241, 90, 78,238, 63, 13, 72, 50,195, 50,229,220,163,108,  8,
+164, 82,212,119,178,173,211,218, 22,206, 85,252, 75, 15, 62,159,191,223,217,217, 57, 28,192,199,  0,164,  0, 62,118,118,118, 14,
+231,243,249, 67,  0, 44,  2,176,171,134,171,241,253,252,249,243,103, 38, 36, 36, 72,238,222,189,139,175,190,250, 10, 11, 22, 44,
+192,227,199,143,215,  1, 96,203, 62,243,145,139,139,203,  9, 14,135,179, 25, 64, 63,  0,125,189,188,188,122, 86,163, 59,100,198,
+140, 25,186,150, 45, 91,198,199,197,197, 13,185,126,253,122,171,233,211,167,203,211,210,210, 16, 31, 31, 15, 47, 47, 47,248,248,
+248, 64,165, 82,161,164,164,  4, 67,134, 12,113,176,183,183, 31, 73,155,113, 10,133,242,119, 54, 89,207,121,145,127, 90, 68,171,
+194,229, 10,159,168, 37, 18,201,252,168,168,168,246,193,193,193, 60,  0,251,  0, 32,136,139,225, 67, 58,180,216,118,100,211, 15,
+193,135, 86,205, 13,238, 19,236,191, 45,136,139,242, 81,108, 39, 90,181,106,229, 20, 21, 21,213, 65, 40, 20,126, 82,201, 74, 16,
+  0,112,114,114,130,131,131,  3, 28, 29, 29,225,228,228,  4,150,101,161,210,232,160,182,  0, 74,157,  1,114,185, 28,202,178,101,
+149,222,  8,181, 90,253,228,127, 43,160,219,248,241,227, 11,214,174, 93,155,159,147,147,243,  3,128,102, 97, 97, 97,131,215,172,
+ 89,131,139, 23, 47,234,250,  5, 52,116, 89,220,185,197,194, 38, 57,143,231,  5,240, 49,  1,192,149, 43, 87,174,160, 67,135, 14,
+ 96, 24, 38,180, 34, 65,177, 88,188, 97,207,158, 61,226,216,216, 88, 52,108,216, 48, 54, 52, 52,244,221, 31,126,248,161,129, 84,
+ 85,124, 13,  0,204, 69,185,177, 83,167, 78,253,102,241,226,197,  5,  5,  5,  5, 70,141, 70,227, 62,104,208, 32,164,167,167, 35,
+ 43, 43,235,143, 74, 76,102,124,116,116, 52,145,203,229, 72, 74, 74, 66,116,116,180,248,155,111,190,105, 99,225,112,  6,103,194,
+238,131,176,142,173,218,140,110,215,  2,187,110,220, 21, 92,125,148,236,216,170,110, 45,167, 59, 25, 57,245, 76, 12, 18, 95,230,
+104, 43,149,202,213, 11, 23, 46, 84,169, 84, 42,100,102,102,226,222,189,123,136,139,139, 67,106,106, 42,150, 45, 91,166, 42, 46,
+ 46, 94, 83,157,134,183,136,247,197,143,211,199, 49,188,  7,127,  0,119, 47,  3, 26, 37,160, 85, 65,255, 48, 10,191, 62,204,197,
+250,131,135,109,210,210,211, 29,247,238,221, 59,222,215,215, 55, 10,128,127, 85,122,132,148, 30, 66, 14,135,243,188,  9,  5,135,
+195, 81,  2,200,149, 74,165, 25,118,118,118, 25, 28, 14, 39,151, 16,162,126, 45, 79, 18,102, 24,193,229,  2, 54, 98,112,248, 85,
+ 78,237,249,110,104,104,232,158,140,140,140, 62, 73, 73, 73,237,215,172, 89,179, 80, 36, 18,197,172, 89,179,102, 97, 82, 82, 82,
+251,140,140,140, 62,161,161,161,123,  0,140,169,201,247,251,249,249, 77,157, 55,111, 30,150, 45, 91,134,230,205,155,195,223,223,
+ 95, 51,127,254,252,213,  0,230,  2,248,196,207,207,239,218,212,169, 83, 63,204,207,207,247,204,204,204,108,190,110,221,186, 73,
+171, 87,175,110,157,157,157, 45,170, 70,186, 83,239,222,189,113,250,244,105,  0,200,  1,144, 84, 84, 84,100,206,206,206, 70, 96,
+ 96, 32,218,180,105,  3,149, 74,  5,149, 74,  5,153, 76,134, 58,117,234,128,101,217,246,180, 41,167, 80, 40,148,255, 87,195, 85,
+177,209, 18,137, 68, 78, 33, 33, 33,168, 95,191,190, 19,202, 70,107,185,216,240,102,127, 62,126,132,196, 54,234, 12,152,232, 11,
+  8,237,220, 84,226, 98,195,155, 93,246, 47,188, 58,117,234,  8, 67, 66, 66, 32,149, 74,107, 85,242,229, 17,185,185,185,  8,  9,
+  9,129,163,163, 35, 28, 28, 28, 16, 18, 18,  2,163,209,  8,185, 82,  9,181,  5,208,152, 88,200,229,114, 20, 23,228, 65, 99,  1,
+204,118, 46, 72, 77, 77,  5,151,203, 77,174, 68,211,171, 97,195,134,  5, 49, 49, 49,  5,  0,174,  0,152,188, 96,193,  2,204,154,
+ 53, 11,223,126,251,237, 30, 73, 78, 74,239, 61,167,143,186,252, 62,255, 35, 55,127, 27,102,  4,  0, 99, 70, 70,  6, 28, 29, 29,
+ 33,149, 74, 43, 52,  6, 93,186,116,105, 41,149, 74,177,125,251,118,146,153,153,217, 17,165, 67,248,147, 25,166,212,236,137, 57,
+144,  3, 88, 29, 21, 21,213,246,155,111,190,121,212,171, 87, 47,126,187,118,237,176,104,209, 34,  0, 56, 81,145,166, 76, 38,251,
+115,204,152, 49,134, 75,151, 46,225,225,195,135,210, 35, 71,142, 12, 95,180,104, 81,211,180,180, 52,225,241, 83,103,222,222,153,
+161, 24,254, 67,248, 85,209,226,179, 17,127,186,218, 75,155,212,115,117, 70,116, 90,150,192,194,197,173,234,142,104, 91, 62,119,
+124, 55, 17, 47,186,179,144,147,211, 77,196,139,106,205,231,142, 83, 42,149,123,143, 29, 59,118,118,250,244,233,170,252,252,124,
+216,217,217,161,168,168,  8,223,127,255,189, 42, 58, 58,250,160,193, 96, 56, 94,157,174,133, 37, 45,125,234,250,  2,137, 49, 79,
+222, 51,178,  4,183, 12,  2, 12,152,252, 41,  2,  2,  3, 97, 48, 24,208,172, 89, 51,102,193,130,  5, 82,  7,  7,135, 47,171, 53,
+ 61,156, 23, 78, 55, 51,195, 48,185,132,144, 44,149, 74,149, 41, 22,139,211,  4,  2, 65, 90,113,113,113, 38, 33, 36,239,117,248,
+ 44,194,193, 23, 29,154,249,  1, 66, 49,210,138, 84,217,183, 85, 40,174,232,131,118,118,118,227,214,175, 95, 47,218,186,117,171,
+105,234,212,169,250, 73,147, 38,241,181, 90,173,251,164, 73,147,248, 83,167, 78,213,111,221,186,213,180,126,253,122,145,173,173,
+237,208,151, 89, 17,147,201,132,152,152,152, 31, 30, 63,126, 44, 69,105,185,145, 79,231,207,159, 31,150,144,144, 32, 90,187,118,
+ 45, 14, 28, 56,128,  3,  7, 14, 96,240,224,193,152, 54,109, 26,230,205,155, 87,149,156, 36, 56, 56, 56,196,197,197,  5,151, 47,
+ 95,206,  6,144,  6,160,165,173,173,173,221,224,193,131,209,167, 79, 31,232,116, 58, 24,141,198, 39, 70,139,203,229,194,209,209,
+209,133,182,129, 20, 10,133,242,198, 77,214, 51,102,139,  7,  0,229,161,186,  1,  3,  6, 48, 85,221, 24, 45, 37,249,144,169, 53,
+ 72,149,107,144, 94,194, 62,243, 55,150,101,171,252,246,236,236,236,227, 55,110,220, 24, 23, 18, 18,194,203,206, 46,237, 17, 11,
+  9,  9,129, 70,163, 65,246,221,155, 80,179,128,180, 97, 16,212,106, 53, 74,226,238,192, 54,184, 61, 92,250,143,198,138,181,107,
+245, 69, 69, 69, 63, 87,164,105, 99, 99,195,175, 93,187,118, 65,114,114,178, 25, 64,177,131,131, 67,111, 95, 95, 95, 68, 68, 68,
+  0,192, 46,  2,252,136,232, 75,192,229, 67, 32,165, 33, 21,219, 58,117,234, 32, 63, 63, 31, 42,149, 42,162, 34,205, 27, 55,110,
+ 36,152, 76,166,102,131,  6, 13, 98,126,251,237,183,125, 10,133,226, 91,  0,247,244, 44,184,119, 51,242,160,182, 64,  4,224, 45,
+ 39, 39,167,207,230,205,155,215,115,234,212,169, 56,118,236, 24,194,195,195,141, 40,205,  5,187, 81,129,172, 60, 41, 41,233,151,
+ 25, 51,102,180,227,112, 56,147,207,157, 59,103,246,247,247, 87, 24,141, 70, 75,163,128,  0,206,183, 11,190, 19,124, 60,121,162,
+ 99,145,  6, 15,250, 52,242,234,192, 48,192,131,172,252,180,199, 42, 20, 85,181, 79,187,216,112, 79, 12,233, 24,220,101, 92,232,
+ 64, 91,105,195, 38, 80,223,191,233,249,203,254, 83, 43,196,209,  9,  3, 46,231,231, 15, 62,118,236,216,240,136,136,136,143, 13,
+  6, 67,125,161, 80,152, 40,147,201, 86,169, 84,170,106, 77, 22,151,203,237,175,247,170,237, 36, 43, 46,134,168, 44, 18,165, 48,
+177, 40,212,155,241,208,209, 31, 35,107,251, 60,233,  6,205,205,205,133,167,167, 39, 99,177, 88,  6, 86,165, 25, 30, 30,142,  1,
+  3,  6,148, 27, 79, 48, 12,  3,134, 97, 10,  3,  2,  2,242,132, 66, 97,145, 64, 32, 80,252,248,227,143, 58,157, 78,  7, 30,143,
+ 39,178, 88, 44,220, 87, 57,219,219, 72,224, 46, 36,204,134, 73,131,186,247,106,222, 36,144, 92,185,125,151, 41,209,232,126,173,
+ 34, 10,184,206,207,207,143, 87, 92, 92,124, 28,192, 67,147,201,244,251,190,125,251, 68,239,191,255,190,110,255,254,253,163,  0,
+ 52, 88,190,124,249,112,149, 74, 85,163, 41, 21, 30, 63,126,188,110,241,226,197, 51,231,204,153,131, 29, 59,118, 76,125,252,248,
+241,172,178, 72,215,224,121,243,230,225,199, 31,127,196,142, 29, 59,216,135, 15, 31,158, 98, 89,246,241,244,233,211,131, 61, 60,
+ 60, 10,115,114,114, 30, 87, 33,219,170,111,223,190,250,107,215,174,217, 40,149,202,171,  0, 62,155, 50,101,202,248,182,109,219,
+ 42, 66, 67, 67,109,139,139,139,101, 18,137,196,102,203,150, 45, 78, 60, 30, 15,106,181, 26, 12,195, 64,169, 84, 26,104, 59, 72,
+161, 80,254,174, 84,230, 69,254, 33, 84,122,111,224, 85,180,129, 26,141, 38, 47, 61, 61, 61, 48, 43, 43,203, 12,192, 12,  0, 69,
+  6,243,146,197, 91, 14,109, 29,218,206, 79,154, 99, 50,225,200,237, 88, 77,145,193, 92,158,252,110,206,202,202, 82,166,165,165,
+217,105,181, 90, 85, 37,223,245,199,134, 13, 27,180,151, 46, 93,178, 75, 74, 74,130,197, 98, 65,203,150, 45, 17, 31, 31,143,146,
+135, 49,144,  6,182,132,180,235,  0,196, 70,221, 70,116,248,121,164,168, 12,230, 71,115, 23,203, 85,106,245, 60,163,209,120,164,
+ 34, 65, 62,159, 95, 12,128, 16, 66, 44,  0,160, 80, 40,238,169, 84,170,206, 30, 30, 30,120,240,224,129, 84,109,193,180,225,179,
+ 87,172, 33,132, 88,  4,165,163,185, 62, 15, 13, 13, 69,100,100, 36,  0, 68, 86,164,169, 80, 40,166, 78,152, 48,225,210,246,237,
+219,121, 73, 73, 73,125,182,110,221,218,231,209,163, 71,132, 41, 78,183, 92,211,240,209, 32,108, 90,235,141,117,  2,194,  7, 12,
+ 24,  0, 47, 47, 47,108,217,178,  5,171, 86,173, 50,125,244,209, 71,  9,171, 86,173,106,157,159,159,255,123, 37,219, 47,151,201,
+100,103, 92, 92, 92, 62,110,218,180,169, 82,173, 86,163,168,168,  8,217,217,217,112,118,113,225,152,193,233,224,230,232,248,251,
+241, 92,165,148,119,230, 79,220,204,204,169, 50,154,213,142,207, 29, 51,180, 75,139, 46,159,204,153,109,139,107, 71,192, 76,152,
+  7,178,117, 33, 62, 29, 59,220, 78,167,255,189,171,250,110,234,251, 81, 10,197, 78,133, 66,113,160,134, 39, 75,223, 14, 29, 58,
+236, 89,188,120,177,248,235,101,139,177, 60,176, 22,204, 69, 69, 40,208, 91, 80,168, 55, 67, 81,242, 16, 15, 30,196,194,197,197,
+ 21, 41, 41, 41,208,233,116,136,139,139, 35, 92, 46,247,120,117, 17,157,114,158,234, 46,148,  9,133,194, 34, 62,159,159,199,227,
+241,138,147,146,146,212, 58,157, 14, 28, 14, 71,106,177, 88,196, 86,172,107,109, 87, 87,215,233, 40, 45, 38,122, 76, 89, 88,184,
+ 58,132, 15, 71,240,208,173,142,171,203,219,115, 39,189,239,234,235,237, 46, 75, 74, 72, 52,253,124,246,122,161, 78, 95,249, 96,
+ 13,  0, 39,138,139,139,159, 68, 36,247,239,223,255,233,254,253,251,199,  3,216,134,210,121,183,206,203,100,178,141, 47,113,241,
+205, 61,120,240,224,204, 57,115,230, 64, 44, 22, 63, 41,158, 42, 22,139, 69,  0,176,123,247,110, 60,120,240,160, 45,202,242,181,
+ 88,150,221,147,147,147, 83,157,102,131,160,160,160,164, 67,135, 14,217,  0,240,158, 50,101, 74,251, 53,107,214, 96,236,216,177,
+  5,177,177,177,237,  0, 36,  3,104, 48,121,242,228, 91, 59,118,236,112, 98, 89, 22, 37, 37, 37, 48, 24, 12,201,180, 41,167, 80,
+ 40,212,108,189, 17, 66,  0, 68,163,180,126, 86,127,  0, 39, 81,154,214, 81, 41, 62,101,238,236, 44,128, 65,229,247,199, 74,146,
+225,129,210, 17, 89,103,  0,108,  6,224, 81,153,168,139,139,203,151, 97, 97, 97,166,204,204, 76,146,155,155, 75, 14, 28, 56, 64,
+ 62, 31, 23,102,121,171,161, 55,219,208,219, 67,237,230,230, 22,239,229,234,252,107, 11,  9, 62,  7, 80,219,138, 13, 11,123,244,
+232,209,196,176,176,176,113,101,223, 59,110,207,158, 61,170,115,231,206,169,184, 92,238,  9,148,150,118, 40, 55,148, 99,  6, 14,
+ 28,168,210,235,245,170,128,128,128, 98,148, 38,238, 87,198,240,110,221,186,149,156, 62,125,154, 88, 44,150, 23,106, 20, 21, 20,
+ 20,144,240,240,112,210,177, 99, 71, 25,128,247,123,246,236, 25,113,253,250,245,136, 78,157, 58, 29,172,110,133, 93, 93, 93,103,
+223,189,123, 55, 50, 53, 53, 53,234,228,201,147, 81,191,255,254,123,212,228,201,147,239,  5,  7,  7,107, 19, 18, 18, 88,179,217,
+ 76,238,222,185, 67,  2, 26, 53, 82,  3,168, 83,153, 78, 15, 49,239,150, 98,203, 66,162, 91, 52,150,232,134,248, 16,  0, 68,185,
+226, 75,146, 55,181, 23,137,255,248,109,210, 93,196,189,241, 50,103,138,179,179,243,217,200,200, 72,162, 84, 42,201,253,251,247,
+201,152,  1,125,200,141,241,189,200,153, 62,126,100, 71,215,122,100, 69,239, 96,210,167,107,103,178, 97,195,  6,114,232,208, 33,
+ 50,123,246,108,214,213,213, 85,137, 42,114,180, 60, 61, 61,207,237,219,183, 47, 10, 64, 20,151,203,141, 82, 40, 20, 81, 74,165,
+242,120, 70, 70,198,250,128,128,128,153, 77,155, 54, 29, 21, 24, 24,216,163,123,189, 58, 51,123,218,  9,227,123,217,139, 18, 27,
+217, 74, 86,224,197,186, 87, 79,112,  0,234, 52,108,208, 64,121,249,242,101, 86,175,215,147,171, 87,175,178,141, 27,249,235,150,
+191,215,247, 96,202,150,165,  7,117,167,127, 59,171, 57,186,233,250,254, 15,  6,196,116,147,112,126,107, 47,125, 82,142,227,101,
+ 25,  1,224,  8,254, 26,117, 24,  6,224, 40,170, 30,133,200,  1,176,109,209,162, 69, 79,143, 52,  4,  0, 78,112,112,112, 20, 33,
+ 36, 42, 56, 56, 56,170,166, 43, 34,145, 72,166, 31, 59,118,108,190,175,175,239,178,208,208,208, 45, 50,153,236,228,168, 81,163,
+ 98, 80, 58, 24,132, 65,233,236,  8,  3,107,215,174, 93, 16, 29, 29, 77, 34, 34, 34,200,176, 97,195,148,  2,129, 96, 52,109,198,
+ 41, 20, 10,229,141, 48,177,146,159, 85,178, 56, 38, 38,166,188,134,214,148,170,196,103,205,154, 21, 21, 25, 25, 25,133,210, 42,
+241, 85,194,227,241, 14,127,244,209, 71,196,195,195, 67,229,238,238,126,152,207,229,142,247, 17, 35,  4, 47, 55,212,189,243,206,
+157, 59,  7,175, 91,183,174, 63,128,182,  0,248,181,106,213,202,206,205,205, 85, 93,191,126, 93,213,177, 99, 71,149,171,171,107,
+126, 80, 80,144,106,249,242,229, 42,147,201,164,154, 62,125,186, 10, 47,214,251,170,  8, 17,128,143,109,108,108, 14, 55,110,220,
+ 56,102,238,160, 30,166,101,211,198,147, 48, 63, 55, 21,128,117,  0, 62,  2,224,  8,128, 63,124,248,240, 11,113,113,113,103,131,
+130,130,126,177, 66,215,187,105,211,166, 23,247,236,217, 19,121,232,208,161,168, 47,191,252, 50,210,197,197, 37, 51, 33, 33,129,
+213,233,116,164,164,164,132,200,100, 50,114,242,228, 73,139,179,179,243,218, 74, 55, 92,200,205, 33,225,187, 42, 44,225,144, 49,
+103, 52,233,104,195,201,122,153, 51, 69, 42,149, 22, 23, 21, 21,145,220,220, 92,146,148,148, 68, 14, 30, 60, 72,250,118,104, 67,
+246, 78, 30, 74,118,141, 27, 76,126,236,219,134,180,181, 19,169, 61,237,108, 35,237,236,236,242,173, 25,117,232,233,233,121, 78,
+175,215, 63, 41,223, 80,187,118,237,168,128,128,128, 67, 65, 65, 65, 43,142, 29, 59,246,233,202,149, 43,  7,119,175, 87,103,230,
+247,125, 58,104, 53,231,247, 19,229,190,117,100, 86, 75,127, 93,153,153,175,144, 90, 46,206, 59, 47, 71, 68,176,229,230,215,108,
+ 54,147, 35,135, 15,147,247,222,126, 43, 70,126,102,247,230,171,243,166,238,153,222,210,255, 72, 71, 17, 70, 84,101,216,158, 60,
+138,216,194,165,139, 61,103,125, 63, 95,231,156,206, 14,156,117,237,236,158,153, 94,234, 61,127,127,255, 36, 66, 72, 78, 96, 96,
+ 96, 18,128, 93,129,129,129, 79, 47,127, 80,137,236,147,226,164,243,231,207, 39,101,215,  7,  7,192,183,139, 23, 47,142, 34,132,
+ 68,249,249,249, 93,  3,128,230, 82,184,118,117,224,108, 30,212,192,163,168,171,  3,103,115,115,105,197, 83, 70,213, 17,160, 81,
+103, 55,201,213,193,126, 94,202,110,181, 28,174,236,250,117,235,178,126,253,250,109,  1,176, 22,192, 66, 23, 23,151,171, 35, 70,
+140,120,176, 99,199,142,  7,203,151, 47, 55,254, 31,123, 87, 30,214,196,181,190,223,153, 76,246,  4,194, 26,194,174,178,168, 32,
+168,184,111,184,224, 46,238,104,221,171,117,185, 86,175,214,214,218,186, 20,193,170, 85, 91,107,181,181, 85,107, 69, 69, 91, 20,
+113, 41,238,168, 21,173,187, 40,130,130, 32, 59,178,132, 45,  4, 66,246,100,126,127, 40, 92,106, 89,130,109,127,183,246,230,125,
+158, 60,132,228,204,155,115,102,206,153,121,207,119,190,243,125,105,105,105,244,156, 57,115, 20, 28, 14,231, 83,243,125,208, 12,
+ 51,204, 48,227, 47, 67,109,100,120,199,150,  8,173,209, 31,125,244,209,125,154,166,107, 99,105,205,104,160,204,152,213,171, 87,
+223,167,105,186, 54, 58,252,171,  1,204, 26, 10,104, 22,182,115,231, 78,154,195,225,124,255,154,141,169,207, 41, 25, 55,110, 92,
+ 79,185, 92,222,205,193,193,161,219, 75,203,149,171,157,157, 93,198,225,195,135,171,149, 74,101, 53, 77,211,213,122,189,190,250,
+222,189,123,213,  3,  6, 12,168,174, 55,235,111,174,158,191,193, 42,  9,174,223, 93,243, 14,189, 74,130,235,175,124, 53,125,223,
+190,125,103, 51, 51, 51,127,182,180,180, 92, 97, 34,167,171,189,189,125,168,141,141,205,121, 59, 59,187, 85, 54, 54, 54,133, 90,
+173,150,174,168,168,160,159, 62,125, 74,255,242,203, 47,244,205,155, 55,105, 27, 27,155,252,198,234, 25,196,163,110, 85,108, 89,
+ 68, 27,247,109,160, 53, 59, 86,210,  0,104,217,182,143,233,210,111,195,233,187,243,134,209,  3,184,140, 27,175,113, 62, 97,101,
+101,181,231,248,241,227,198,244,244,116, 58, 54, 54,150, 62,125,250, 52,189,100,201, 18,186,173,147,163,186, 39,155, 44,238,199,
+161,206,191, 78,192, 82,181, 90,125, 95, 46,151,223,175,174,174,190,239,227,227,115,191,123,155,137,145, 13,  0,  0, 32,  0, 73,
+ 68, 65, 84,247,238, 49, 61,123,246,252,242,232,209,163, 75, 55,110,220, 56, 54,200,130,243,180, 38,238, 40, 77,127, 56,130,166,
+ 23,245,165,159,205, 29, 64, 15,226, 81, 15, 27,229,116,112,200,175,141,214,174, 80, 40,232,248,248,120,250,242,229,203,180,196,
+206, 78, 30,200, 99,204,239,195, 65,255, 62,150,176, 50,181,158,  3, 69,100,196,173,111, 63, 51, 40,207, 30,164,127,156, 53, 66,
+ 63,192,138,220, 89,175, 92, 20, 77,211,133, 19, 39, 78,204,162,105,186,240,216,177, 99,121, 52, 77, 23, 78,152, 48, 33,139,166,
+233, 66,  0, 63, 53,196,249, 74,112,210,125, 47, 69,214,162,176,176,176,251, 52, 77,223, 15, 11, 11,187, 15,188,  8,162,218, 95,
+ 68,238,191,189,251,115,163,250,244,126,250,232,156, 81,134,254, 34,114,127,131,245,180,162,126, 78,216,183,141,214,156, 63, 68,
+ 31, 95, 50,205,208, 87, 98,121,213,219,219,251,243,165, 75,151,198,220,188,121,243,145,193, 96,120,156,145,145,241,248,235,175,
+191,126,220,171, 87,175,235,182,182,182,137,108, 54,251,221,230,174,209,159,  4, 51,167,153,211,204,105,230, 52,227, 85,  3, 83,
+ 19,223,253,188,121,243,102,  1, 77,211,239,135,132,132, 96,211,166, 77,147, 59,116,232, 48,197,217,217,217, 30,  0, 10, 10, 10,
+106,146,146,146,228, 33, 33, 33,  8, 13, 13,197,150, 45, 91,190,196, 11, 95,150,255, 79, 20,157, 56,113,194,101,241,226,197,210,
+141, 27, 55, 26,231,204,153,211, 30, 64, 82,105,105,105,219,105,211,166, 45,162, 40, 42,196,221,221,221,191,176,176,176, 68,169,
+ 84, 30,  2,176, 27,205,172,153, 54,  6, 14,  9, 67,215, 86,142, 56, 79,194, 80,239,227, 17,161,161,161,111, 77,152, 48, 65,187,
+109,219, 54,189, 92, 46, 63,101, 34, 93, 94, 73, 73,201,186,218,127,108,108,108, 36, 15, 31, 62,124, 87, 44, 22,147, 25, 25, 25,
+ 80,171,213, 72, 79, 79, 55,226,197,210, 84,131,168,214,211,219,191, 59,118,177,221,251,211,131, 45,107, 82, 30,128,197, 96, 64,
+199,100,163,232,214,121,236,139, 79,145, 43,180,216,241, 58,237,148,201,100, 95, 44, 89,178,100,218,138, 21, 43,184,238,238,238,
+196,141, 27, 55,112,228,200, 17,181, 84, 42, 29, 14,224,234,127, 66, 63,181, 12, 70,163, 17,108, 54, 27,  0,240,241,199, 31,131,
+ 36, 73,166, 84, 42,101, 19,  4,193, 33,  8,130, 79, 16,  4, 67,151,249, 24, 70,121,  5,138, 43,100,200, 43,150, 53,201,103, 48,
+ 26,143,220,190,125,123, 89,231,206,157,201,187,119,239,162,164,164,  4,233,233,233,180,129,166,127,138, 87, 26, 94, 56, 37,170,
+ 77,175, 31,223,198,118, 92, 39,107, 14,201,142,  8, 69,160,134,100,236, 50, 98, 34, 94,196,210,  2,128,125,  4, 65,176,  0,148,
+249,248,248, 12,124,242,228,  9,207,199,199, 71,153,146,146,114,150, 32,  8,103,  0,251, 27,226,228,241,120,165,  0, 74,143, 29,
+ 59,  6,  0,243,240,226,228,117, 89,187,118,109, 97,124,124, 60,194,194,194,138,  1,236,  4,  0,161,181,237, 24,127, 17,139, 96,
+ 31,  8, 67, 47, 53,200, 29, 70,186, 65,171,171, 80,236, 48,168,131,128,  4,243,135, 79,208, 77,210,142,100,235,181,126,225,225,
+225,241,213,213,213,234,168,168, 40,205,236,217,179, 25,105,105,105,119,  0, 92,  3,112, 12, 47,125, 44,205, 48,195, 12, 51,204,
+248, 75,241,170,  5,171, 89, 31,173, 87, 85,235, 38,  0,223,165,166,166,214, 37,149, 78, 77, 77,189, 15, 96, 23, 94, 68,131, 31,
+221,  2,197,187,230,165, 69,107,247,107, 54,230, 85, 78,110, 64, 64,  0,239,201,147, 39, 44, 52,156,196,145,120, 13,206,223,161,
+161, 92,135,222,222,222, 95,233,116,186,152, 93,187,118, 29,101, 48, 24,211,254,128,218,119,247,242,242,170, 56,124,248,176, 49,
+ 54, 54,150, 94,179,102,141,193,209,209,177,  2,191,247,209,250, 13,103, 32,155, 17,189,188,189,179,252,222,140,190,244,179,165,
+ 99,232,107,211,  7,208,243,157,133,242, 64, 46,227,200, 31,156,149,120,137, 68,162,125, 60, 30, 79,110,105,105,121, 17, 64,239,
+ 63,114,141,108,109,109, 15, 74, 36,146,139,245, 95, 14, 14, 14, 49,246,246,246,223,216,217,217,173,177,178,178, 90,224,193,101,
+111, 91,218,214, 73,149, 56,206,135,142,235, 99, 79, 79,183, 99,191,186,116,248,106, 61, 29, 61, 60, 60,202, 34, 35, 35,141, 63,
+255,252, 51,189,114,229, 74, 99,171, 86,173,228,104,194,175,173, 73,139,150, 21,227, 72,244,132,158,198,226, 81,206,244,166,246,
+ 22,198,129,214,140,198,118, 40, 78,127, 41,128,103, 53,199,233,233,233,185,139,166,233,136,245,235,215, 71,224, 63,185, 64,135,
+132,135,135,175,165,105,122,109,120,120,248, 90,  0,195,  0, 32, 80, 68, 70, 30, 26,219,213, 80, 48,210,137,254,172,189,208, 16,
+ 40, 34, 35, 27,180,100,218, 80, 39, 78,206, 29,101, 44,156,219,135, 14,245, 18, 24,122,218,112, 46,177,217,236,165,120, 97,113,
+238, 14,128,109,158, 53,155, 57,205,156,102, 78,179, 69,235,111, 39,188, 76,130,196,198,198,102, 95,155, 54,109,142,186,187,187,
+ 31, 21, 10,133, 95,226,133,211,124, 75, 47,132,199,134, 13, 27,228, 34,145,168,211,159,120,113,197,  0,156,241,251,196,185,127,
+ 90,135, 89,231,136,197,105, 43, 38, 63, 92,231,136,197,245, 62,238,222,190,125,251,207,240, 34,154,247, 31,237,132,238, 54, 54,
+ 54, 95,219,216,216,228,191,244,205,114, 55,133,179, 43,131, 49,109, 32,151,113,163, 55,155, 44, 26,200,165,126,237,198, 96, 76,
+125, 67,  7, 96, 83,155, 45, 26,227,116,177,179,179,219,102, 99, 99, 83, 96,103,103,247,117, 11, 69,214,111, 56, 59,241,224, 56,
+200,138,113,162,183,  5,161, 24, 36, 98, 28,235,202,111,124, 83, 71, 11,218, 30, 16, 22, 22,246, 54, 77,211,111, 59, 57, 57,133,
+212, 19,254,254,161,161,161,193, 52, 77,  7,215, 70,128,239,206,135,120,128, 21,227,112, 31, 75, 66, 54,192,138,113,184, 59, 31,
+226,198,234, 57,208,138,113,164,143, 37, 33, 11,180, 36, 15,187,113,208,202,124, 51, 55,115,154, 57,205,156,102,161,245,207, 16,
+ 90,230, 14, 99,230, 52,115,154, 57,205,156,102, 78, 51,167,153,211, 44,180, 26, 22, 86,245, 95,117, 43,108,148,249,220,152, 97,
+134, 25,102,152, 97,134, 25,102,252, 33, 52, 26,176,148,104, 66,149,182,196,177,253,117,148,109,156,153,211,204,105,230, 52,115,
+154, 57,205,156,102,206,255, 57,206,230,184,255,191, 55,214,189,209, 48,155, 85,205,156,102, 78, 51,167,153,211,204,105,230, 52,
+115,254,207,130, 52,159,  2, 51,204, 48,195, 12, 51,204, 48,195,140, 63,132,128,151,127, 95, 13, 92,218,176,143, 22,213,125,125,
+177, 94,175, 23,  3,  0, 69, 81, 82,221,157, 53,142, 77,177, 51,129, 32,253,139,244, 59,160,128,121,122,224, 98,  3,156, 23,245,
+122,189,245, 75,206, 10,221,157, 53,195,154,228,236,190,254,124,253,242,250, 59,107,134,188, 90,134,  6, 24,204,238,235, 11, 94,
+169,171,147,169,103,133,192,111, 98, 98,253,101,245,124, 83, 56,255,151,193,236,177,190, 88,167,123,209,143,152, 76, 74,170,189,
+221,116, 63, 98,245, 88, 95, 80,191,188,238,246, 26,135,166, 56,249, 60, 78,153,167,179,253,151, 77,113,102, 20,148,190,175,168,
+ 81,217, 54,197,217,210,177,233,234,232, 24,100,120, 57, 54, 25,192,188,252,194,194,139,127,179,190,212, 21,192, 26,  0,150,245,
+ 62, 75,  4,240,158,185, 87,154, 97,134, 25,111,152,208, 74,192,139, 60,135,123, 94,138,173, 61,141, 10, 45,189, 94, 47,190,127,
+124, 45, 20,106, 32,104,230,122,177,199,184,221,191, 75,148,172, 87, 85,176,101,201, 81,254, 12,157,220,218,158,210, 90, 22, 20,
+ 20, 16,  0, 64, 16,196,247,  0,220, 26,224,180,190,127,124, 45,106, 52, 64,224,148,112,107, 55,192,178,132,197,250,128, 39, 16,
+ 12, 84, 42,149, 29,  0,128,199,227, 37, 43, 21,138, 43,246, 90,237,214, 87,203, 55,214,178,250,117, 29, 52, 99,189,184,253,184,
+221, 75, 12, 70, 35,251,249,221, 93,129,170,210, 52,138,169, 87,239, 92,  5,156, 93,219,128,168,106,132,239, 63,191, 59,105,165,
+ 45, 19, 24,196,230,114, 59, 89, 89, 91,247, 51,210,180,143,209,104, 36, 12,122,253, 99,121,101,229, 53,163, 94,255, 80,175, 81,
+216,222, 63,245,153,177,169,122,190,218,150, 73,  0,117, 28,  8, 17,  8,133,  3, 25, 76,102,111,  0, 48,232,116, 55, 20,213,213,
+ 87,198,  3,209,166,180,221,212,243,243,186,229,255,215,160,211,233,197,153,231,215, 66,173,  3,  2, 38,126, 38,238, 56,237,192,
+ 97,  0,208, 72, 31, 58, 84,167,157,234,  1,  0,  2,207,224,219, 28, 73, 64, 49,  0, 80, 57,133,226,167,177,171,161,214,  1, 62,
+193,225,226,230, 56,103,135, 30,177, 93, 49,127,  2,  7,  0, 46, 28,251,166,237,229,152,239, 70,  0,192,160,  9, 11,207, 14,157,
+184,248, 41,  0,108,217, 19, 99,251,211,103,147,155,228, 52,109,108, 86,178, 42,211, 98,189, 52,242, 66, 43, 87,  1, 37, 73, 75,
+ 75, 35,  1,192,201,201,201,164,177,233,  2,136, 10,129, 69, 36,131,209,207,211,203, 43,  0,  0,157,241,236, 89,130, 65,175,191,
+238,  8,236,252,147,251,210, 18,154,254,109,112, 86,130, 32,204, 29,210, 12, 51,204,120,211,112,250,165,184, 58,253,187,201,108,
+ 99, 71, 40,212,192,213,116,160,127,207,142,152, 63,109,164,176,254,119,209,187,195,221,210,238,158,108,255,195,129,173,100,199,
+142, 29,145,153,153,105, 82, 45,106, 52,192, 47,105,  0,100, 79, 44, 42,  4,130,103,219, 62,255,220,114,200,144, 33,148,147,147,
+ 19,  8,130, 64, 81, 81, 81,207,184,184,184,174,203,150, 45,251, 23,100, 79, 42,106, 52,168,250, 37,173,121,222,218,186,118,104,
+219, 10,107, 22, 79, 22,  1,192,170,153, 59,187,222, 77, 45,182,121,246,236, 89,208, 71, 31,125, 84,198,184,114,229, 59, 59, 32,
+162, 24,200, 51,165,158,  7,127,190,205, 21, 21,254,232, 49,125,241,226, 99, 94, 94, 94, 66,119,119,119,194,194,194,  2, 12,  6,
+  3, 21, 21, 21,110, 73, 73, 73, 35,238,220,185,163,136,187,250, 61,251,222,157, 49, 25, 82,110, 15,149, 73,109, 87, 22,112, 47,
+ 88, 88, 36,207, 24, 63,222,101,242,228,201, 92, 79, 79, 79,  0,192,179,103,207,188,163,163,163,167, 28, 59,118, 44, 20,202,  2,
+125,141,  6,170,230,218, 94,199,  9,128, 11,244,182, 18,139,167, 51,152,204, 14,122,189,222,249,165,181,225,185, 65,167, 75,150,
+ 73,165,135, 94, 45,111,198,239,161,214,  1, 79, 10,129,193,253,  2, 48, 99,194, 96,  1,  0,124,244,214,134,158, 57, 89,233, 44,
+141, 70,131,182,237,124,250,124,250,217,151,231, 65,146,136,140,137,171, 43,111, 10,103,226,147, 76,172,253,116, 27, 10, 30, 69,
+247, 52, 84,166, 15,172,146, 87, 50,  0,192, 82, 36,154, 16, 29,245,227, 21, 39,255,144, 91,233,165, 90,147, 56,155, 26,155,231,
+162,190,118,204, 79,186,226,251,237,133,125, 76, 55, 55, 55, 60,122,244,168,101, 99,179, 50,213,194,232,232,248,120,235,135, 31,
+ 74,  2,  3,  3, 33, 20, 10, 65, 81, 20,244,122,253,224,235,215,175, 15, 94,187,118,237, 66, 84,166, 42, 76, 29,155, 38, 96, 43,
+ 65, 16,  3,103,207, 95,226, 56,114,108,  8, 38, 12,239,211,100, 97,173, 70,195, 96,177,217,  6,115,111, 53,195, 12, 51,254, 70,
+168,181, 94,213,223,121,184,167, 73,161, 69, 81,148,116,200,172,141,226,126, 61,252,112,247,225,211,202,236,220,194,234,218,239,
+202,147,163,219,142,237,227,236, 27, 31,127, 21,106,181, 26, 55,110,220,192,195,135, 15,145,149,149,133,  5, 11, 22,168, 95, 46,
+ 29, 54,196, 89, 17, 56, 37,220, 26,149,105, 66,111,118,106,235,184,148, 20,134, 74,165, 66,124,124, 60, 42, 42, 42,192,102,179,
+225,226,226,130,161, 67,135, 82, 41, 41, 41, 54, 65, 67,134,139,  2,135, 79,205,132,200,187,154,162,168,138,198,242,136, 80, 20,
+ 37, 13,154,185, 94,236,235,221, 10,207,178, 11, 42,215,124,246, 67,181,209, 72, 83, 25, 89, 57,218,171, 87,175, 34, 32, 32,  0,
+ 23, 47, 94,180, 45, 47, 47,255,100,231,206,157,107,152,155,191,221,174,211,148, 45, 71,227,124, 21,129, 83,194,173,109,165, 71,
+221, 47,159, 59,193, 74, 78, 78,102,237,218,181, 11,101,101,101, 96,179,217,176,178,178,130, 68, 34, 65,219,182,109,137, 85,171,
+ 86,  9,131,131,147,241,239,121, 33,238, 90,143,185,169,141,213,179,174,237,213, 57,124, 59,249,  5,207,152,211,167,201,190,125,
+251,254,102,218,222,166, 77, 27, 12, 27, 54,140, 59,125,250,116,207,201, 83,166, 25,  3, 71,205,126,  6,161,123, 77,179,156,138,
+ 60,158,109,205, 77,167,193, 83,166,156, 10, 15, 15,183,146, 72, 36, 16,  8,  4,  0,128,202,202, 74,151,236,236,236,158,161,161,
+161, 19,111, 39, 70, 81,129,193,121,  5, 16,184, 42,155, 58,159,255,171, 96, 50, 41,105,173, 21,201, 66,192,171,200,203, 47, 86,
+  0,128, 70,163,129, 70,163,129, 90,173,198,187, 11, 23, 48,230, 77,236,238,229,222,111,201,131,172,231,197,229, 62,113,183,108,
+106,143,213, 53,195, 73,213,100,201,100,185,151,230,173,253,240, 67,137,131,195,127, 86,  4, 35, 15, 30,100,148,151,151, 15, 94,
+187,118,173, 47,205, 31, 32,243,  9, 14,183,106,138,179,169,177, 41,123,122,186,245,167,139,135,117,218,253, 89, 44, 12,  6,  3,
+110,222,188,137,248,248,120,124,249,229,151,244,217,179,103, 43, 45,  5,130,121,104,114,108,166, 90,244,117, 44,242,216,188,249,
+ 24,193,225,112,112,242,228, 73,164,164,164,128, 36, 73,116,236,216, 17, 51,102,204,192,224,193,131, 37,243,231, 47,160,  3,135,
+191,149,  1, 81,187,170, 63,216,151, 72,  0, 75, 86,174,221,236, 56,115,238, 34,108,249,116, 85,179, 66,203, 44,178,204, 48,195,
+140,191,177, 53,171,209, 16, 15,136,141,141,165, 95,190,250,  3,  0, 13,144,109,198,237,254,233,232, 61,227,233, 54,227,118,255,
+ 68,  3, 36, 13,144,150, 64,171,206,157, 59,235,100, 50, 25,125,231,206, 29,250,221,119,223, 85,108,223,190,253,202,233,211,167,
+163,245, 90,237, 94, 39, 71,199, 47,232, 70, 28,236,105,128,116,  7, 68,124, 62,191, 36, 55, 55,151, 62,115,230, 12, 29, 22, 22,
+ 70, 31, 58,116,136, 62,123,246, 44, 29, 23, 23, 71,159, 61,123,150,254,233,167,159,232,196,196, 68,250,233,211,167,180, 64, 32,
+ 40,113,  7, 68, 77,112, 50,104,128,209,118,220,174,229,199,238,234,194,219,141,219,189,140,  6, 24,214, 64,251,206,157, 59, 27,
+162,163,163,233,200,200, 72,250,192,129,  3,116, 98, 98, 34, 93, 90, 90, 74, 83, 28, 65, 73,237,113,141,213,147,  6, 72,103,103,
+231, 18,153, 76, 70,187,186,186,210,108, 54,155,118,112,112,160,219,182,109, 75,247,236,217,147, 30, 49, 98,  4, 61,109,218, 52,
+250,147, 79, 62,161,101, 50, 25,205,229,114,139,107,143,107,140, 51,  0,224,  9,  4,130,220,251,247,239,211,141, 65,169, 84,210,
+165,165,165,244,249,243,231,105,129, 64,144, 27,  0,240,154,226,228,  1, 93,252,253,253, 75, 74, 75, 75,105,173, 86, 75,231,230,
+230,210, 73, 73, 73,116, 74, 74, 10,157,155,155, 75, 43,149,202, 58,238,167, 79,159,210, 30, 30, 30, 37, 60,160, 11,109,222,  4,
+209,104, 95,122,245,229,230,224, 48, 66, 34,145, 40,143, 29, 59, 70, 63,127,254,156,222,191,127, 63, 77,  2, 27, 94, 45,215, 20,
+ 39, 27, 24,218,183,111, 95,195,205,155, 55,233,  7, 15, 30,208, 31,127,252, 49, 61,108,216, 48,122,248,240,225,244,218,181,107,
+233,252,252,124, 58, 63, 63,159, 30, 49, 98,132,129, 13, 12,109,174,127, 54, 52, 54, 69,128, 91,112,112,176, 82,171,213,210, 25,
+ 25, 25,116,135, 14, 29,242, 25,192,116,  1,224,219, 31,224, 52,215, 63,157,  1,107, 71, 71,199,194,155, 55,111,210, 49, 49, 49,
+180,187,187,123,  9,  3,152,109,  9,180,177,  4,218, 48,128,217,109,218,180, 41,185,121,243, 38, 93, 86, 86, 70,187,185,185, 21,
+ 58,  3,214,127,160, 47,145,  0,246,173, 92,187,153, 78,205, 87,208, 43,215,110,166,  1,228,210, 52, 77,163,  1, 31, 79, 51,204,
+ 48,227,159,143, 87,181,200, 63,  5,117, 55,201,224,224, 96,  2,192, 47, 77, 21, 86, 50, 24, 27,183,108,217, 66,169, 84, 42,252,
+240,195, 15, 85,147, 38, 78, 60,218,191, 95,191,140,214,238,238, 50,130, 36,155,205, 54, 92,194,225, 44,221,178,101,139,149, 70,
+163,193,189,123,247,208,181,107, 87, 72, 36, 18,  8,133, 66,  8,133, 66,136,197, 98,180,107,215, 14, 82,169, 20, 22, 22, 22, 88,
+177, 98,133,168,132,195, 89,218, 28,175,209, 72, 83,  0, 96, 48, 26,217, 44, 96,190, 71,183,110,247, 66, 67, 67, 73, 91, 91, 91,
+216,216,216, 64, 40, 20, 34, 37, 37,  5, 26,141,  6,124, 30,223,164, 32,173, 36, 73,146, 66,161, 16,151, 47, 95,198,146, 37, 75,
+208,187,119,111, 88, 89, 89,193,194,194,  2, 29, 58,116,192,208,161, 67, 49,111,222, 60,100,100,100,128, 48,193,169,228, 49, 69,
+ 45,154, 55,111,158, 56, 32, 32,160,193,239, 85, 42, 21,100, 50, 25, 74, 74, 74,224,226,226,130,144,144, 16,241, 99,138, 90,212,
+ 24,159, 45, 32,113,241,246, 62,117,231,206, 29, 59,129, 64,128,200,200, 72,156, 56,113,  2,231,206,157,195,153, 51,103, 16, 27,
+ 27,139,147, 39, 79,162,164,164,  4,  0,224,237,237,141, 35, 71,142,216,  9,197,226, 88, 91, 64, 98, 30,210,166, 33,167,184,248,
+ 66,135,162, 34,187,233,211,166, 93,171,174,174,198,244,233,211,177,113,211,166, 85, 76, 96,153, 41,199,183,  3, 68, 54,142,142,
+ 17,155, 55,111, 38,139,138,138, 48,126,252,248,210,173,155, 54,189,147,112,254,188,231,253,115,231, 60, 55,134,135,191,211,191,
+127,255,210,252,252,124, 28, 60,120,144,116,112,115,139,104,  7,136, 90, 90,207, 42, 96,201, 87, 95,125,197, 85,169, 84, 24, 50,
+100, 72,134, 49, 57,185,157, 30,248,177, 26, 72,249,  5,208, 54,119,124, 33,176,104,197,138, 21, 18, 14,135,131, 15, 62,248,160,
+180, 38, 39,199, 79, 15, 28,168,  4,178, 43,129,108, 61,112,160, 42, 51,211,111,230,204,153,165, 28, 14,  7,219,182,109,147, 20,
+254, 39,233,182,169,232, 10,224, 20,128,171,  0, 10,102,207, 95, 50, 59,160,123, 47, 28,220,187, 19,159,133,127, 20,  1, 96, 18,
+ 65, 16,135,  0, 44, 55,247, 60, 51,204,248,223,132, 41, 90,228,111,138, 70, 83,238, 80,245,149, 36,128,  1, 77,177, 88,219,218,
+118,245,243,243, 67,124,124, 60,252,253,253,239, 88, 89, 89,233, 89, 28, 14,152, 76, 38,104, 99,179, 58, 11, 60,129, 32,104,240,
+224,193,212,173, 91,183,224,225,225,  1, 30,143,  7, 38,147,249,155, 23,139,197,130,163,163, 35,228,114, 57,130,130,130,152, 59,
+118,236,  8,130, 90,253,105,179, 15,196,180, 36, 97,201,173,205,211,190,223, 31,209, 38, 48, 48, 16,149,149,114, 24,141, 70,240,
+249,124,104, 52, 26, 80, 20,245, 98,  9, 72, 71,203, 77, 57, 99,  6,131,193,192, 96, 48,224,225,225,129,141, 27, 55, 66,165, 82,
+129,197, 98,  1,  0,228,114, 57,100, 50, 25,146,146,146,144,157,157,141,151,179,240, 38, 97, 33, 18,141,156, 60,121,114,131,  9,
+127,213,106, 53, 42, 43, 43, 81, 89, 89,  9,153, 76,  6,149, 74,133, 94,189,122,177, 79,199,198,142, 68, 89,217,214,  6,143,225,
+114, 39, 30, 60,120, 80,204,102,179,161, 84, 42, 81, 85, 85,133,188,188, 60,228,228,228,168,164, 82,169,222,194,194,130,116,119,
+119, 39, 57, 28, 14,103,220,184,113,132, 92, 46,  7, 65, 16,  8, 14, 14,182, 61, 28, 25, 57, 25, 26,205,151,230, 33,109, 26, 46,
+  0,234, 46, 26,205,232, 30,221,187, 95,190,115,247,110,192,210,165, 75,145,152,152,184,153, 31, 21,117,181,  6,120,216,212,177,
+ 25,192,162, 47,234,  9, 24, 58, 39,199, 95, 11,148,212, 43,146,237,158,153,121,110,230,204,153,143, 18, 19, 19,237,182,109,219,
+ 38,153, 52,126,252, 34,  0, 27, 90, 82, 71, 11,145,168,155,163,163, 35,206,158, 61,139,220,172,172,143,244,128,178, 69, 51, 46,
+  6,163,111, 96, 96, 32, 78,158, 60,137,252,156,156,143,244,191,173,227,139,137, 18, 80, 66,101,100,124, 20, 17, 17,177,111,206,
+156, 57, 96, 80, 84, 95,232, 91,180,112,248, 59,199,247, 57, 11,150, 34, 98,207,142,  8,  0,115,  1, 24,  1,220, 49,247, 56, 51,
+204,248,223,182,106, 53,167, 69,222, 32,177,181,167,197, 22, 45,177, 88,236, 44, 20, 10, 81, 80, 80,  0,159,246,237,165, 28, 14,
+  7,108, 38, 19, 92, 54,219,164, 26,212,212,212,248, 59, 57, 57,161,178,178, 18,118,118,118, 96,177, 88,117, 47, 54,155, 93,247,
+222,194,194,  2, 36, 73,194,205,205, 13, 53, 53, 53,254,205,242, 22, 39,137,163,118, 44,124,247,230,213,179,109,198,143,159,  0,
+107,107, 27,184,186,186, 64, 44, 22,131,199,227,193,213,213, 21,158,158,158,244,214,173, 91,193, 23,119, 52,233, 70, 94, 95, 60,
+ 81, 20,  5,131,193,128,226,226, 98,164,166,166, 34, 49, 49, 17, 55,111,222,196,131,  7, 15, 80, 85, 85,  5, 19,116, 22,106,148,
+202, 78, 20, 69, 53, 40,178,100, 50, 25,100, 50, 89,157,208, 42, 41, 41, 65,118,118, 54,170, 21,138,206, 77,136,222,  9,126,126,
+126, 12,  0,224,241,120,232,220,185, 51,118,239,222,173,255,249,196,137,183,124,111,222,180,113, 61,127,222,234,251, 93,187,222,
+ 10,  9,  9, 49,220,186,117, 11,114,185, 28, 79,158, 60,129,189,189, 61,197,230,114, 39,155,135,115,203,112, 31, 80,216, 85, 85,
+ 13,239,221,187,119,102,101,101, 37, 62,255,252,115,146,105, 97,177, 39,188,145, 37,190, 58, 48, 24,125,  2,  3,  3,113,234,212,
+ 41, 20,228,228,124,156,211,128,128,201,  1, 74,114, 51, 50, 62,142,136,136,192,208,161, 67, 65, 80, 84,159,150,214,175,103,207,
+158,126, 70,163, 17,143, 30, 61,130, 21,112,187,165,199,123,122,121,  5,212, 90,126,  5,192,181,198,202,  9,128,107,  9,  9,  9,
+224,241,120,240,241,245,237,210,194,159,217, 74, 16, 68,225,156,  5, 75, 17,115,238, 87,  0, 64,196,158, 29,197,245, 68,150, 25,
+102,152, 97,182,104,189,169, 22,173, 90, 97, 85,255,133,223,  8, 45, 19,197,  7,  0,128,201,100,130,205,225,128,205,102,191, 16,
+ 72, 28,142,201, 28,  4, 65,128,203,229,214,  9,171,250,  2,171,254,123, 62,159,111,146,128,  1,128,138,244,115,253,230,190, 51,
+135,205,225,112,160,209,168, 65,211, 52, 56, 28, 46,172,172,172,224,225,225,  1,185, 92,142,222,125,250,171,243,100,172, 88, 91,
+159,113,137,175,115,246,244,122, 61, 20, 10,  5, 42, 42, 42, 80, 94, 94, 14,185, 92, 14,165, 82,105,242, 86,116,163,209,200,200,
+203,203,195,143, 63,254,136,178,178, 50,  0, 47, 28,173,107,197, 85,237,223,204,204, 76, 68, 70, 70, 34, 43, 43,171, 69,215,167,
+ 95,191,126,136,141,141,101, 12,  8, 10,218,123,209,221,189,224,162,187,123,193,128,160,160,189,167, 78,157, 98, 56, 59, 59, 35,
+ 59, 59, 27,247,238,221, 67, 69, 69,  5,104,154, 54,239,159,127, 13, 60,  3, 42,106,202,203,231,172, 90,181,138, 22, 10,133,248,
+252,139, 47, 58,109,  0,166,154, 42, 96, 68, 77,  8, 24,209, 31, 19, 48,160,105, 26, 70,163, 17,  6,195,235,249,138, 19,  4, 65,
+ 48,153,204,150,134, 86,104, 73,225, 58,199,247, 21,159,108,196,153,147,209,181,159,167,153, 69,150, 25,102,152,241, 15, 64,163,
+142,240, 84, 61,  5, 89,247,183, 49, 20, 23, 23, 63, 87, 40, 20,109,220,221,221,145,159,159, 47,118,115,115,203, 97, 51,153, 96,
+177,217, 32,200,230, 53,  1,159,207,127, 84, 80, 80,208,199,217,217, 25,122,189,190, 78, 84,189,186,116, 88,107,165,121,240,224,
+  1,248,124,254, 35,168,154,140,156,  0,131,166,162, 85,151, 46, 93,234, 44, 67, 86, 86, 86,176,178, 18,129,195,225, 98,245,234,
+213,198,109, 91,183,238,116, 27, 20, 94,249,246,178, 85,244,170, 13,123,255,212, 51,107,234,131,137,207,231, 63,114,117,117,237,
+ 37, 18,137, 16, 19, 19,131,236,236,108, 84, 84, 84,160,166,166,  6,106,181, 26, 53, 53, 53,208,104, 52,224,114,185,240,245,245,
+133,165,165, 37,226,226,226, 30, 65,173,110, 88, 92,150,149,197, 60,122,244,168, 87,247,238,221,235, 44, 42,  3,  7, 14, 36,  6,
+ 14, 28,104, 87,103, 69,171,169, 65,105,105, 41,238,220,185,131,184,184, 56, 16,  4,129,180,180, 52,131, 90,169,252,201, 60, 38,
+ 94, 15, 42,224,  6, 35, 34, 98,223,191,254,245,175,119,250,244,233,  3,  3, 48,  2, 64,228,127, 81,192,  0,  0,110,222,188,153,
+100, 48, 24,250,180,109,219, 22, 50,160,  7,128,147, 45, 18,145,233,233,  9,122,189, 62,168, 83,167, 78,136, 57,122,180, 31,128,
+236,134,202, 41,128,126,  1,  1,  1, 80, 42,149,120,242,248,241,253, 22,136,172,189, 43,215,110,158, 61,115,238, 34, 28,220,187,
+ 19, 17,123,118,228,237,219,189,221, 21, 38,248,143,153, 97,134, 25,255, 83,214,172,102,181,200,223, 20,243, 27, 19, 95, 84, 75,
+ 88, 42, 43, 42,238, 39, 36, 36,180,233,210,165, 11,246,238,221,219,189,119,175, 94,207, 89,108,182,158,205, 98,129, 52,225, 65,
+162, 84, 40, 46, 93,186,116,169,199,184,113,227,168, 91,183,110, 65, 34,145,212,  9,173,218,191, 20, 69,129,166,105,240,249,124,
+ 28, 63,126, 92,171, 84, 40, 46, 53,107, 45, 50, 24, 13,228, 75,161, 71,211, 52,100, 50, 25, 88, 44, 22,190,252,114, 27,190,222,
+186,117,154,  1,136,246, 22,216,127,  8,128,251, 95,123, 64,215,212, 92, 62,115,230, 76,215,208,208, 80,166,139,139, 11,100, 50,
+ 25, 42, 42, 42, 80, 86, 86,  6,185, 92, 14,185, 92,142,138,138, 10,200,100, 50,112,185, 92, 36, 38, 38,234, 84, 53, 53,151, 27,
+227,227,168, 84,199,102,205,154,181, 34, 33, 33,193,145,162, 40,232,116, 58, 24,141, 70, 24,141, 70,104,181, 90,164,167,167, 35,
+ 57, 57, 25, 41, 41, 41, 40, 47, 47,  7,147,201,  4,131,193,192,131,  7, 15, 42,  4, 58,221, 81,141,121, 76,191, 54,152, 64,204,
+245,235,215,223,153, 49, 99,  6,156, 92, 92,250, 35, 63,223, 36,  1,115,162,  9,  1, 83,249,122,  2,230, 63,  2,168,170,234,110,
+102,102,102,159,  1,  3,  6,192,209,197,101,179,111,126,254,197,199, 45,240,211, 50,232,245,215,174, 95,191, 30, 52,115,230, 76,
+236,221,187,119,179,125,102,230,185,146, 87,150, 57,237,  1,251,214,158,158,155,103,207,158,141, 11, 23, 46,192,160,215, 95,107,
+130,178,126,196,247, 86,179,231, 47,113,125,197,241,125, 55, 65, 16,139,  1,124,110,238, 81,102,152, 97,198, 63,217,162,213,162,
+165, 67,158,193,176,114,249,242,229, 58,146, 36, 49, 97,194,  4,139,147,167, 78,133, 60,120,248,208, 67, 42,149, 90, 25, 12,134,
+102,185,236,213,234,237,203,151, 47,151,105, 52, 26,180,107,215, 14,229,229,229, 48, 24, 12,160, 40, 10, 20, 69,129, 32,  8,144,
+ 36,  9,161, 80,136,132,132,  4,236,219,183, 79,110,175, 86,111,111,246, 33, 97, 48, 60,138,140,140,  4,131,193,160,185, 92, 46,
+  8,130,  0, 69, 81,216,182,109,155,244,107, 32,  6,  0, 24, 36,169,  1,  0,146, 36, 76,245,222,109,118,221,146,205,102,195,248,
+ 98, 19, 64,179,101,173,213,234,175,182,108,217, 82,245,228,201, 19, 40, 20,138, 58,235, 91,117,117,117,157,115,189, 76, 38,  3,
+ 65, 16, 80, 40, 20, 56,117,234, 84,149,181, 90,253, 85, 99,124,101, 64, 81,126, 90,218,152,238,221,187,151,101,102,102,162,178,
+178, 18,143, 30, 61, 66, 92, 92, 28,142, 28, 57,130, 11, 23, 46, 32, 61, 61, 29,122,189, 30,206,206,206,160,105, 26, 39, 78,156,
+168,212, 87, 85,141, 40,  3,138,204, 99,162,113,180,146, 72,130, 28,196,226, 92,123, 59,187,252, 86, 18, 73,208,171,223,139,128,
+167, 79,159, 62,133, 94,175,135,135,135,135, 77, 83,126, 90,180, 94,127,253,250,245,235,152, 57,115, 38, 92,219,180,217,228, 14,
+216,191, 90,198, 29,176,119,247,244,220, 84, 43, 96,104,189,254,122, 75,235,108,  1,236,248,240,195, 15,149, 44, 22, 11, 81, 81,
+ 81, 30, 58, 47,175, 20, 10,152, 42,  4,218, 15,  0, 88,205, 29,239,  8,236,252,228,147, 79,138,  8,130,192,161, 67,135,236, 68,
+158,158, 73, 20, 48, 75,  4,180, 18,  1,173, 40, 96,150,200,211, 51, 41, 42, 42,202, 78,175,215, 99,217,178,101, 69,142,192,206,
+ 38, 40,151,208, 52, 61,154,166,233, 64,154,166, 93,247,237,222,142, 51, 39,163,107, 69,214, 92,188,112,122,159,  1, 32,201,220,
+227,204, 48,195,140,127, 50, 26, 52, 67, 81,221,215, 23,  3,180,184,127,207,142,184,251, 48,181,210,206,218,242,124,237,119,229,
+201,209,109,  7,249, 91,118,252,246,219,111,193,100, 50,145,151,151,135,199,143, 31,195,210,210, 18,211,166, 77, 83, 43,171,170,
+198,212,203,117, 56, 24, 64,220, 75,206, 23,249,212, 42,211,132,158, 84, 98,155,115,103, 98, 25, 34,145,  8,213,213,213, 32, 73,
+ 18, 92, 46, 23,124, 62, 31, 60, 30, 15,247,238,221,195,168,209, 99, 13, 37,252,192,255,  4, 44,253, 79, 62,181, 58,206,218, 88,
+ 67, 61,  0,126,  2,240,129,216,201,105,249,154, 53,107,120,195,134, 13,  3,139,197,130, 75, 43,239, 34,143,225,159,239, 32, 73,
+ 66,159, 95, 38, 95,237,217,202, 73,244, 56, 45, 27,  0, 33,213,221, 89,227, 84, 47,215,225,239,234,233,166,185,234,113,252,192,
+ 86,203,206,157, 95,248,163,203,100, 50, 20, 23, 23, 67, 42,149, 66, 38,147, 65,161, 80,  0,  0, 98, 99, 99,113, 38, 62, 69,174,
+116,  9,201,104,172,158,255,105,123,170,133,147,246,118,235,195,145,  7, 24,246,246,246, 40, 46, 46, 70, 73, 73,  9,100, 50, 25,
+148, 74, 37, 12,  6,  3,202,203,203,241, 67,196,  1, 67,153, 48, 48,171, 46, 32,100, 83,156,138, 60,158, 77,245,175,206,  1,190,
+238,244, 59,239,188, 99, 97,105,105,  9,163,209,136,138,138, 10,228,230,230, 34, 51, 51, 19,241,241,241, 10,169, 76,  3,133,221,
+144,252,186,128,165, 13,112,254,137,120,227, 56,235,199,173,114,114,116, 44,200,201,201, 17, 27, 12,  6, 56, 59, 59,235,101,229,
+229,155,216,192,  5, 11,160, 16,  0, 93, 10,172,249,106,199,142, 57, 99,199,142, 69,183,110,221,242,138,138,139, 91, 55,212,151,
+104,128,209, 14, 16,213,184,184, 36,223,185,115, 71,146,155,155,139,153, 51,103,150,230, 60,123,246,113,173,191, 86, 37,208,207,
+221,211,115, 83, 84, 84,148, 93,155, 54,109,224,239,239, 95,196,205,205,237,144, 10, 84, 54,210, 63, 27, 29,155,178,167,167, 91,
+ 47, 28,239,215,237,221,119,223,133, 94,175, 71,124,124, 60,110,223,190,141,156,156, 28,252,250,235,175, 50, 75,129,224,173,122,
+185, 14, 27,236,159, 35,188, 21, 30,135, 14, 69, 18, 44, 22, 11, 17, 17, 17, 72, 72, 72,  0,  0,  4,  4,  4, 96,246,236,217,208,
+235,245,152, 62,125,  6,125, 58,149,151,209, 84,255,  4,224,  7,224, 11,188, 16,121,221,104,154,230, 18,  4, 81,  0,192, 21, 45,
+243,201, 50,247, 79, 51,167,153,243,127,135,243, 31,137,102,115, 29,174,255, 14,162,223,166,249,152, 87, 16,189, 59,156,234,219,
+ 47,176,125,120,216, 90,178,123,247,238,112,117,117, 69, 64, 64,  0,114,115,115, 57, 86, 86, 86,205,229, 83,171, 14, 28, 62, 53,
+179, 99,199,142, 86, 31,127,252,177,104,232,208,161, 76, 87, 87, 87,208, 52,141,132,132,  4,196,196,196,104,247,238,221, 43,175,
+113, 24, 45,187,127,229,199,106, 83,242,169,221,  6,106,  0,172,115, 41, 40,216,179,104,225,194,181,157,187,116,121, 39, 44, 44,
+140, 20,242,121,204,141,171,231,114,  1, 96,253, 55, 71, 68, 99, 67,166,225, 43, 47,160,255,212,134,243,200,213,175,103,110,254,
+188,156,145,227,131,188, 62, 88, 60,199, 48,121,242,100,129,165,165, 37, 92, 93, 93, 97,109,109,141,140,140, 12,228,231,231,211,
+ 63,255,252,115,245,205,  7, 79,153, 39, 46,220,205,225,138, 28, 77,201, 75, 88, 21, 56,108, 82,214,200,145, 35,173,103,205,154,
+101,209,181,107, 87, 38,135,195,  1,135,195, 65,113,113, 49,210,211,211,181, 63,255,252,115,117,141,120, 68,197,253, 43, 81, 85,
+ 38,230, 58, 84,  6, 78,  9, 79,191,118, 49,108, 89,242,163, 71, 51,140, 64, 39,173, 86,235,108, 48, 24,  8,146, 36, 11,141, 70,
+227, 35,109, 85,213, 62,117, 64,216, 54,115,174, 67,211, 96, 48, 24, 88,  6,131,  1, 50,153, 12, 23, 47, 94,164,158, 61,123,182,
+230,225,195,135,107, 10, 10, 10,160,211,233, 48,113,226, 68,  4,  4,  4,224,202,149, 43, 40, 41, 46,254,185, 41,174, 84,160,146,
+147,159, 63,123,222,188,121,103, 35, 35, 35,201,135, 15, 31,218, 69, 68, 68,252,208,144,128,153, 49, 99,134,177, 56, 55,119,182,
+ 26,168,108,162,127, 54, 53, 54, 75,207, 69,125,253,112,220,132, 16,223,176,208, 53,204,222,189,123,195,206,206, 14,253,250,245,
+131, 86,171,181,242,241,241,105,110,108, 86,  5, 14,127, 43,163, 83,167, 78,130,109,219,182, 73,230,204,153,131,197,139, 23,  3,
+  0,148, 74, 37, 46, 92,184,128,101,203,150, 21,229, 82, 61, 20,205,245,207,151,150,170, 90,  1,118, 21, 64, 32,128, 12,152, 29,
+223,205, 48,195,140,127, 38,106,147, 74, 59,226, 69, 98,233,211,120, 49, 57,111, 62,215,225,181,219, 73,168,159,230,227,  5, 28,
+ 31,235,221,102, 61, 91,176,124,147, 63, 67, 39,183,102, 18, 42,203,180,167, 79,137,230,114, 30,214,229, 83, 19,121, 87,219,102,
+254,212,125,227,250,245, 75,191,250,234,171,160,218, 16, 14,124, 62,255,145, 82,161,184,100,175, 86,111,175, 17,121, 95,106,105,
+110,190,124,160, 24,192, 66,235,251,247,119,  4,143,157,184,133,107,227,193, 92,181, 97,175,138, 65,146,154,244,130, 18,124,229,
+  5,  8, 76,216, 32, 89,163,  1,146,101,142,250, 98,219,144,212, 79, 62,252,240,131,245,235,214,117, 23, 10,133,253,181,122,189,
+183,209,104,  4,140,198,180, 26,133,226, 42,173,213,222, 81,  7,132,110,229,138, 28,105,147,243, 18, 90,249, 84,217,100, 69,119,
+223,191,111,223,146,163, 71,143,254,174,237,182,106,245,142, 26, 43,159, 56, 83,218, 94,191,140, 10,184,  1,169,244, 70, 83,166,
+ 75,115,174, 67, 19,103, 31, 70,227,124,107,107,235,131, 65, 65, 65,220,193,131,  7, 99,212,168, 81,232,221,187, 55,140, 70, 35,
+104,154, 70, 85, 85, 21,142, 28, 57,130, 45, 91,182,164,181,  6,214, 53,199,167,  6, 46,113,206,156, 25,209,169, 83,167,136,166,
+  4,204, 75,145,213,172, 79, 98,211, 99,147,147,166, 23,141,201,158,178,104,163,151, 70, 94,104,101,203,215, 75,146,147, 30,145,
+166,143,205,118, 85,134,132, 35, 61, 38,142, 31,191,136, 65, 81,253, 94,238,128,164,159, 60,126,124,191, 54,169, 52,  2,102, 95,
+108, 97, 95,170,141, 93,103,118,124, 55,195, 12, 51,254,233, 66,107, 20, 94,248,107,213,165,228,105, 52,215, 97,173,213,135,162,
+ 40,105,198,137,  5,211,154, 98,103,  2, 65, 47, 45, 89,104, 54,215,225,203,247,217, 64, 21,212,234, 79,127, 19,140,180,222,238,
+ 66,230, 43,229, 91, 18, 22,177,  2, 72,133, 94, 29, 12,233, 99,224,212,194, 23,124,221,215,127, 84,191, 77,141, 62,100,127,243,
+187,172,114, 21,112, 13,213,213,215, 80, 93,221,160,211, 46,147, 98,149, 55, 87,207, 87,219,158, 11,200,255,104,219, 95,229,108,
+ 86, 60,252,129,243,249,191,134,231,165,165, 39,  0,  8, 93, 98, 99, 29,206,197,198, 78,254,224,253,247, 39, 58, 58, 57,121,218,
+217,217, 89, 91, 88, 88,144,183,110,221,202,212,171, 84, 59, 58,  3,251, 95, 90, 83,155,133, 26,184,212, 46, 55,183,195,164,241,
+227, 23, 17, 20,213,183,190,128,161,245,250, 95, 61,128,157, 77, 89,178, 94,119,108,186,114, 28,131, 94, 90,178,192,  0,230,153,
+210, 55,242, 95,212, 99,  3,244,250, 13, 72, 76,108,160,207,183,184, 47,173, 39,  8,162, 10,102,199,119, 51,204, 48,227,159,139,
+218,124,135,167,255,191,127,120,176,153,211,204,249, 15,226,100,224,197, 46, 58,243,249, 52,115,154, 57,205,156,102, 78, 51, 76,
+  2,101, 62,  5,102,152, 97, 50, 12,248,207, 50,152, 25,102,152, 97,134, 25,102,212,162,214, 55,171, 62,246,  0, 47, 92,119, 26,
+ 83,165, 45,217, 77,240, 58,202, 54,206,204,105,230, 52,115,154, 57,205,156,255, 21, 78, 62,126,191,236,109, 62,159,102,206,255,
+ 47,206,230,184,223,196,221,140,181, 62, 89,117,190, 89,255, 95, 48,155, 85,205,156,102, 78, 51,167,153,211,204,105,230, 52,115,
+254,211,225,248, 82,100,213,127,  1,104, 97,192, 82, 51,204, 48,195,140,127, 42,194,194, 64,210, 52,  8,154, 14, 35,105,250, 40,
+131,166, 67, 24, 52,141, 63,148, 10, 36, 36,164,225, 96,182,255,158,102,109, 97, 62,227,102,152,241,143, 66, 33, 26, 73, 42,109,
+246,209,250,239,194, 77, 34,145,236,  6, 64, 20, 21, 21,205,  7,144,107, 62, 37,127, 63,216,216,216,  4,233,245,122,200,229,242,
+ 75,127, 22, 39,131,193, 32, 12,  6,  3,253,119,104,159,175, 39,198,211, 36,124,234, 62,160,145,251, 36, 29,  7, 27, 42,235,227,
+133,153, 32,254, 19,139,139, 48,226,201,227,103, 56,222,130,159, 35, 71, 12,118,221,  9,  0,103,227,242, 22,225,175,137,171,213,
+214,222,222,254,114,207,188,  0,  0, 32,  0, 73, 68, 65, 84,254, 60, 69, 81,148,193, 96, 88, 40,149, 74, 99, 27, 23, 66, 33, 12,
+  0, 96,210, 87, 86,202,138,196, 31,191,247, 47,130, 89,163,222, 39, 83, 43, 21,149, 12, 38, 35,139,195,148, 92, 95, 48,135, 60,
+ 91, 81,221,235,113, 67,199, 71, 71, 71, 55,154,197,187,131, 23, 70,144,  6,223,209,  1,126,153, 25, 95,108,239,254, 85,127, 15,
+ 59,102,102,222,  3,225,230, 93,149,187,217, 86,238,163,103, 78, 38, 98, 41, 62, 49, 99,223,190,178,234,127,234,216,217,  8,144,
+ 58, 38,179, 29, 97, 52,122,128, 32,248,  4,  0,218,104, 52, 18, 36,153,201,213,235,159, 46,  7,170, 95,131,211, 70, 11,248, 51,
+ 57, 28, 87,131, 94,239, 64,  0, 52,131,162,138,117,106,117, 30, 11, 72, 92,  9,200,254,233,156, 44, 14,199,197,160,215, 59,  0,
+192,223,177,158,102,252, 22,141, 10, 45,161, 80,120,143, 36, 73,151,250,201,112,107,243,  9,214,126, 86,255, 59,130, 32, 96, 48,
+ 24,242, 43, 42, 42,186,182,224,247, 45,  1, 76,  6, 80,187, 69,253, 48,128, 35,120,125,135, 99, 75, 22,139,181, 92, 32, 16, 12,
+ 82, 42,149, 29,  0,128,199,227, 37, 43, 20,138,203, 90,173,246,139,215,228,165,  0, 76, 18, 10,133,  3, 73,146, 28, 72,211, 52,
+ 65,211,244,149,234,234,234,203,  0,142,  2,120,157, 72,  9, 60,177, 88,188,193,198,198,102,234,202,149, 43,203,108,109,109,219,
+ 45, 91,182,236,110,121,121,249,143,165,165,165,171,209,130, 28,117,127, 49, 60, 37, 18,201, 97, 38,147,201,200,203,203, 27,  8,
+  0,174,174,174, 87, 52, 26,141, 65, 42,149, 78,  3,240,172,133,124,  2,  0, 61,133, 66, 97, 87,161, 80, 24,104, 48, 24,124, 94,
+230,103,124, 82, 93, 93, 29,175,213,106,239,  1,184,  5, 64,241, 55, 26, 35, 22, 20, 69, 69,190,236,235,222,  0,170,254, 12,210,
+191,139,200,  2,  0,154,132,207,227,228,148,118,117,194,171, 67,251,198, 11, 19,112,107,160,172,201, 66,107, 80,127,199,209, 99,
+198, 12, 33,  1, 64,163, 59, 59,250,242,213,194,147,127,114,115,218, 78,152, 48,225, 70,100,100,164,181, 90,173,198,252,249,243,
+ 15,199,197,197,237,148,203,229, 43,155,188,113,  8,173,151,125,190,237,  2,159, 32, 72,  0, 16, 27,141,  6,241,243,231,207,188,
+ 31, 39,221, 24,158,156,124,115,163, 50,229,242, 45, 35,193, 92,160, 69,191, 20, 83, 42,225,227,129,224,209, 19,199,143, 90,183,
+ 46, 12, 83,223,154,218, 42, 57, 89,197,115,182,204, 96,151, 43,  5, 94,182,246,226, 49,235,214, 71, 19,215,175,157, 24, 19, 25,
+ 17,126,121,206, 28,219, 65,255, 64,177, 69,172,101,179,221,116,  6,195,112, 18, 40,164, 44, 44, 50,192, 98,213,  0,  0,105, 48,
+ 48, 52,114,185,103, 13, 69, 77,255, 20,184,243,137, 94,255,192, 84,206,245, 20,213, 83,228,229, 21,248,214,137, 19, 16,186,186,
+ 82, 20,135, 67,  2,128, 94,173,118,173,206,203,115,140, 26, 51,166, 71,216,211,167,191,132,  1,183,205,156,255, 21, 78, 51, 90,
+ 34,180, 72,146,116,121,254,252,185, 88, 32, 16,188,184, 25,211, 52, 12,  6,  3, 12,  6, 67, 93,242, 98,154,166,235,254,234,245,
+122,180,111,223,222,164, 25, 45,128, 65,  0,222, 30, 48, 96, 64,200, 23, 95,124,193,244,247,247,175, 77, 25,210,111,213,170, 85,
+223, 36, 36, 36, 28,  3,176, 31, 47,130, 55,154, 58,227, 29, 38, 16,  8, 14,125,254,249,231,150, 67,134, 12,161,156,156,156, 64,
+ 16,  4,138,138,138,122,198,197,197,117, 93,182,108,217, 66,133, 66, 49, 29,192,249, 22,156, 31, 63, 11, 11,139,232,241,227,199,
+187,244,239,223,159,235,235,235, 11,131,193,128,  7, 15, 30,204,185,119,239,222,148, 99,199,142,173,173,170,170, 10,129,233,249,
+218,  8,161, 80, 56,203,210,210,114, 67,104,104,168,205,244,233,211,217, 73, 73, 73, 21, 30, 30, 30,196,245,235,215,237,143, 28,
+ 57,178,112,211,166, 77,147,228,114,249,234,234,234,234,  3, 48, 33,135,162,133,133,197, 61,146, 36, 93, 76, 17,194, 47, 31,240,
+166,138,225,206,173, 91,183, 62,114,237,218,181,214,217,217,217,134,113,227,198, 29,  4,128,203,151, 47,251,235,116, 58, 98,232,
+208,161,103,243,243,243, 39,  3, 48,245, 38,217,209,198,198,230,228,212,169, 83,109, 60, 61, 61,249,173, 91,183, 38,  4,  2,  1,
+ 24, 12,  6, 42, 43, 43,157,146,146,146,  6,223,190,125, 91, 25, 23, 23, 87,174, 86,171,199,  0, 72,108,193,117,234, 45, 22,139,
+103, 48,153, 76, 63,189, 94,239, 12,  0, 20, 69, 61,215,233,116, 73, 82,169, 52, 18,192,141,215, 29, 32, 14, 14, 14, 95,111,216,
+176,193, 78, 42,149,210,155, 54,109,250,186,170,170,106,150, 41,199, 69, 68, 68,144,179,103,207,254, 75,162,160,175, 91, 23,206,
+ 12, 13, 93,171,251,179,121, 15,255,120, 20,247,238,222,  6, 94,164,205, 33, 26,232,127,  4,  0,214,123,239,189,143,174,221,122,
+ 96,218,212, 73,205,114,142, 12,114,249,156,201,102,217,170, 84,170, 27,149, 53,234,163,  2, 62,119,242,212, 41,193,105,  0,112,
+246,220, 47,147,187,119,183,190, 34,226,115, 38,113,185,220,222, 58,141,182,236,204,165,252, 15, 91, 34,170,156,157,157,207, 91,
+ 91, 91,243,203,203,203,139, 74, 74, 74,190, 27, 61,122,244,250,253,251,247, 91,103,102,102, 34, 47, 47, 15, 75,151, 46, 21,230,
+231,231, 47, 74, 76, 76,188,169,209,104, 26,181,108, 85, 85,149,111, 95,245,241,216, 80,145,200,142, 33,224, 91,194, 66,100,  3,
+ 15,207, 78,232,217,123, 52, 70,140,122,  7,233,105,  9, 61,247, 71,172, 75,120,254, 60,238, 51,161, 77,155,245, 50, 89,235, 70,
+175,173,111, 91,244, 31, 51,254,133,200, 10, 13, 13,195,211,148,148,170,236, 44,242,223,167, 79, 80,252, 17, 65,237, 57,122, 77,
+ 81,246,245,107, 39, 90,247,237, 55, 14,  0,186, 70, 70,132, 95,254,247, 52,235,160,175, 15, 87, 84,253, 67,158, 43,196, 58, 38,
+211, 15,122,125, 91, 91, 71,199, 40,149,209, 72,235, 42, 43, 93,141, 53, 53,142,  0,160,103, 50, 53,  2,161,240,145,147,151, 87,
+252,211,251,247,  3, 63,165,168,126,159, 52,157,160,188,150,115,214,176,109,219,196,  1, 11, 23,178,170,179,178,180, 25,187,118,
+213, 20,199,199, 27, 40, 14,135,118, 29, 62,156,176, 31, 56,144,187,240,201, 19,214,175,155, 54,  5, 50,195,195, 61, 86,107,181,
+135,204,156,255,175,156,255,235,168,117,130,175,191,251,112, 79,147, 66,139, 32,  8,  8,  4,  2, 68, 69, 69,129,201,100,130,162,
+ 40, 48,153,204, 70,223,187,185,185,153, 82,145,  9, 18,137,228,155,157, 59,119, 58, 12, 27, 54, 12, 92, 46,183,238, 11,  6,131,
+129, 33, 67,134, 96,240,224,193,204,130,130,130, 41, 81, 81, 81, 83, 54,110,220, 88, 44,147,201, 22,227,101, 98,232, 38, 48,176,
+ 93,187,118, 49, 23, 46, 92,224,169, 84, 42,196,199,199,163,162,162,  2,108, 54, 27, 46, 46, 46, 24, 58,116, 40,149,146,146, 98,
+ 51,100,200,144,152,167, 79,159,  6,  3,184, 98, 66, 93,187,138,197,226,171, 71,143, 30,229,118,234,212,137, 72, 79, 79, 71, 64,
+ 64,  0,  0,160,178,178, 18,227,198,141,227, 78,159, 62,221,115,202,148, 41,183,164, 82,105,127,  0,247,154,225,235, 34,145, 72,
+ 14,140, 31, 63,222,105,227,198,141,150, 22, 22, 22,200,206,206, 46,148, 72, 36,222,181,231,123,202,148, 41,236,209,163, 71, 59,
+110,217,178,101,123,116,116,244,135, 82,169,116, 22,128,251, 77,170,214,151,130,152,207,231,163,184,184, 24,135, 15, 31,198,162,
+ 69,139,192, 96, 48, 32,149, 74,113,228,200, 17,252,251,223,255,174, 21, 52, 38,137, 97, 62,159, 63,216,203,203,235,135,203,151,
+ 47,187, 88, 89, 89,193,201,201,137,252,228,147, 79,252, 60, 60, 60,120,173, 90,181, 98, 20, 22, 22, 34, 38, 38,198, 99,198,140,
+ 25, 39,115,115,115,231,168,213,234,102,151,212, 28, 28, 28,246,157, 62,125,218, 45, 57, 57, 25,187,118,237, 66,121,121, 57,216,
+108, 54,172,172,172, 32,145, 72,224,237,237, 77,124,252,241,199,252,209,163, 71,243, 23, 47, 94,188, 79,163,209,116, 54,225, 26,
+117, 18,139,197,187,  7, 14, 28,232, 17, 30, 30,110, 37,145, 72, 80, 59, 49,168,172,172,116,201,206,206,238, 25, 26, 26, 26,114,
+239,222,189, 76,169, 84,186,  0,192,195, 22, 14,156,206,190,190,190,193,227,198,141, 99, 20, 22, 22, 34, 50, 50, 50,184,170,170,
+170,179, 41,226,146,162,168,191,204, 98,101,164,105, 14,128, 63, 93,104,221,187,123, 27,243,223, 93, 90,237,228,234,202,186,112,
+254,135,  9,209,199,219,222,181,226,189, 72, 72, 45, 83, 66, 27, 50,254,105,183,161,195,222, 97,141, 28, 53,174,122,207,183,219,
+133,166,  8, 45, 38,155,101,123,248,208,151,185,215,174,223,243,187, 24,119,123,248,132, 49, 99,104, 22,203,202,  3,  0, 62, 92,
+246, 30, 51,230,212,169,136, 33,131,123, 20,244,235,219, 53,119,218,244,247,221, 90, 80,221,182,109,219,182,253, 37, 33, 33,193,
+129,195,225,160,188,188,220,118,207,158, 61, 95,246,237,219,151,204,200,200, 64, 74, 74, 10,178,178,178, 80, 89, 89,137, 33, 67,
+134,  8,239,223,191,255, 29,128, 70,133,150,150, 28,180,193,169,149,110,135, 45, 79,208, 90,107,144,139,105, 93,161,239,197,211,
+ 23, 59,254, 20,169, 12,112,112,108,239,253,246,236,181, 88,183,254, 24,243,199,195,155, 67, 47,197,253,  4,144,173, 27,207,  8,
+ 64,163,247,170,213, 43, 33,175, 82, 99,250,212,121,152, 49,117,158, 45, 13,141, 35,109, 80,  9, 52,202, 10, 43, 11,214,147,216,
+157,123,191, 28, 15,192,165,158,216,186,244, 79, 17, 91,235, 88,172,214, 48, 26, 61,188,199,141, 59,145,113,238, 92, 27, 90,171,
+181, 99,176,217,249, 22, 54, 54,197,122,181,154,214,105,181, 44,165, 82,233,156,145,156,236,216,247,227,143, 47, 93,223,180,169,
+255,167, 12, 70,183, 79, 12,134,187,141,114, 82, 84,143,224,111,190,177,247,155, 59,151,243, 48, 60, 92, 81, 26, 31,175,244, 26,
+ 57,178, 34,224, 95,255, 82,  3, 64, 85, 86, 22,235,233,218,181,124,251,192, 64, 94,175,229,203,173, 13, 26,141,100,221,186,117,
+221, 67, 95, 36, 47,111, 17,167,219,228,201,134,208,136,136,110,241,239,191, 63,128,208,233, 24,195,123,245,122,176, 41, 50,242,
+249, 31,225,252, 51,235, 89,112,245,170,186,220,195,  3,  1,227,198,149,185,137,197,234, 63,179,237,127,164,158,102,212,161,214,
+ 87,107,126,253, 25, 42, 98, 99, 99,251,  3,248,  5, 64,120,112,112,112, 24,  0,136, 68,162, 98,153, 76, 38,142,137,137,105, 86,
+100, 49,153, 76, 56, 58, 58,194,219,219, 91, 42,149, 74, 29,154,168, 64,158,209,104,116,161,105,186,206,250,210, 24,212,106, 53,
+210,210,210,208,177, 99,199,124,188, 72, 68,219,168, 81,135,207,231,103,164,164,164,216, 61,126,252, 24,247,238,221,131,135,135,
+  7,172,173,173,193,100, 50,161,211,233, 32,151,203,209,174, 93, 59,112, 56, 28,116,233,210,165, 84,161, 80,120, 52,179,  4,196,
+ 17,  8,  4,105, 87,175, 94,117, 13,  8,  8,192,157, 59,119,224,234,234, 10,137, 68,  2,  0,200,202,202,194,245,235,215, 49,114,
+228, 72, 36, 36, 36, 96,226,196,137,121, 10,133,194, 27,128,186, 49, 66, 27, 27,155,194,203,151, 47,231,251,251,251,171, 20, 10,
+  5, 89, 92, 92,204,140,143,143,215, 87, 85, 85,  9, 43, 43, 43,153, 50,153,140, 41,151,203, 41,133, 66,193, 36, 73,146,165, 84,
+ 42,153,151, 46, 93, 98,104,181,218, 38,  3,100,214, 94,167, 83,167, 78,193,223,223, 31, 49, 49, 49,248,224,131, 15,240,235,175,
+191,194,213,213, 21, 71,143, 30,197,242,229,203,145,154,154, 10, 59, 59, 59,248,250,250, 54,119,141,224,233,233,153,254,232,209,
+ 35, 79, 22,139, 85,155,215,177, 54, 95, 30, 74, 74, 74,240,236,217, 51, 60,127,254, 28, 94, 94, 94,152, 58,117,234,179,231,207,
+159,123, 53,215,243,156,157,157, 75,146,147,147,237, 58,118,236,136,226,226, 98, 88, 89, 89, 65, 36, 18,193,202,202,170,238,189,
+135,135,  7,222,127,255,125, 72, 36, 18,169, 74,165,114,104, 78,  4,249,251,251,159,191,116,233,146,157,165,165, 37,138,138,138,
+ 32,151,203, 65, 81, 20,248,124, 62,236,236,236,234,132,124, 90, 90, 26, 70,141, 26, 85,154,145,145, 49,172,  5, 22, 56,210,193,
+193, 33, 37, 49, 49,209,155,166,105,228,230,230, 34, 53, 53, 21,239,190,251,110,154, 74,165,106,143,255, 98,206,190,  3,251, 15,
+112,102,189, 61, 75,253,103,241,213,243,187, 98,205,154, 61,159, 53,126,108,111,205,147,228, 88,130, 99, 76, 69,103, 63,203, 74,
+  0,120,144, 36, 23,169,201,118,240,233, 16, 76, 31, 63,121,131,125, 96,255, 30, 38,140,112,  0,129,212, 39,105,248,180, 49,238,
+161,  3, 29,231,190,247,222, 28,191,  1,125,251,147, 85, 10,133,248,187,239,182,117,201,200,120, 34,  6,  0, 15, 15, 31,233,194,
+133,203,238, 91,  8,  4,210, 95,174, 95, 53,126,245,213,190,164, 11, 87, 10,247,154, 80,101, 15,111,111,239,155,167, 78,157,178,
+ 19,139,197, 16,137, 68, 80, 40, 20,208,106,181,120,252,248,177, 42, 42, 42, 74,103,105,105,105, 81, 84, 84,  4,153, 76,  6,130,
+ 32,112,234,212,169, 92,  0,238,175, 18,213,250,104,  1,192,187, 35,124,152,190,131,188,173, 89, 28, 61,143,199,124,234,  8,194,
+192, 33,104,161,195,217,243, 15, 58,158,189,120,103,218,248,  9, 31,216,247,235, 63, 30,161,107, 66,116,  5,  5,185,  1, 90,244,
+ 75,105,200, 71,171,189, 23,  6,141,155, 56,126,210,186,117, 97,  8, 11, 13, 71,236,169, 19,149, 66,  1,169,182,180, 98,138,  2,
+123,246, 81,189,191,104,108, 94,117,117,129,235,186, 45, 81, 83, 71,141,125,223,165,111,191,113,184,126,237,  4, 34, 35,194,239,
+ 17, 60,250,141, 94, 70, 92, 11,176, 72,138,122,199,169,117,235, 67,210,130,  2,103,190, 80,200, 92, 26, 23, 39, 54, 24, 12,119,
+ 39, 45, 95, 94,117,252,210,165,186,  9,200, 39, 36,233,196, 96, 48,156,188, 71,141, 74, 76,143,141,125,135,163,215,199,124,  4,
+148,188,202, 25,  6, 88, 91,121,120, 44, 88,146,150,198,122, 24, 22, 86,173, 47, 40,168,232,186,108, 89,105, 67,191,159,127,241,
+162,128,237,228,100,105, 61,102,140,205,118,119,119, 90, 39,149,238,110,200,199,168, 33,206, 56,161,208,234,167,179,103,131,104,
+ 38,179,255,138,143, 62,226,  5,  7,  7, 67, 46,151,227,216,177, 99,216,189,107,151,218,209,209,241,145, 83, 82, 82,130,159, 92,
+190,198, 84,206,174,203,150,149, 26, 12,  6, 98,210,242,229, 67,146,179,178,  6, 21, 73,165,173,  0,192,209,198, 38,175,171,135,
+199,189,125,177,177,169, 95,183,110,109, 52,181,158,223,159, 59,231, 16,157,157, 61,215,198,198,134, 87, 44,149, 82, 28, 54,187,
+172,167,175,239,209,111, 87,175,254, 69,159,152,200,226,186,184, 88,138,130,131, 91,220,246,174,203,150,149,150, 87, 85, 81, 75,
+214,175,239,147, 83, 92,220,170, 90,173,246,146, 85, 85, 73, 12, 58, 29,105,201,231,151,181,105,215, 78,170,140,143, 47,108, 83,
+ 83,179,116, 47, 32,253,171,250, 79, 67, 90,228, 13,194,171,113,180,126,151,235,240,151,224,224,224,223,237,174,161,105,218, 36,
+107, 22,147,201,252,205, 50, 85, 19, 96, 17,  4,129,251,247,239,195,214,214, 22, 18,137,  4, 28,206,111,147, 15,150,148,148,224,
+215, 95,127,197,147, 39, 79,208,169, 83,167,218,101,140,198, 21, 17,135,243,222,150, 45, 91,172, 52, 26, 13,238,221,187,135,174,
+ 93,187,130,195,225,128,197, 98,253, 70,  4, 74,165, 82,116,232,208,  1, 43, 86,172, 16,109,220,184,241, 61,181, 90,189,174,  9,
+107,196,226,121,243,230,137,107, 45, 88,121,121,121,232,210,165, 75,221,247,246,246,246,120,240,224,  1,186,118,237, 10, 23, 23,
+ 23,132,132,132,136, 35, 35, 35, 23,235,245,250, 47, 26,227,100,179,217,164,191,191,127, 55,  0, 16,  8,  4, 32, 73,242,169,165,
+165,165,189,131,131,131,192,210,210,146,213,192,210,147,140, 36,201,102,173, 22, 36, 73,162,168,168,  8,126,126,126,168,172,124,
+145,193, 69,161, 80,192,203,203, 11,114,185,188, 78,180, 58, 57, 57, 65,169,108,218,245,171, 99,199,142, 97,237,219,183, 31, 42,
+ 16,  8, 56, 76, 38, 19, 15, 31, 62, 68, 64, 64,  0,162,162,162,224,230,230,  6, 62,159,143,180,180, 52,248,251,251,227,234,213,
+171,176,183,183, 71,135, 14, 29, 56, 98,177,248, 90,121,121,249,149,156,156,156,176, 38,234, 73, 10,133, 66, 92,189,122, 21,251,
+246,237, 67, 86, 86, 22, 10, 10, 10, 96, 97, 97,129,206,157, 59,195,215,215, 23,189,123,247, 70, 90, 90, 26,136,230, 59,147,196,
+219,219, 59,246,206,157, 59,118, 52, 77, 35, 50, 50, 18,213,213,213,208,104, 52, 32, 73, 18, 92, 46, 23,214,214,214, 24, 52,104,
+ 16,236,237,237,225,237,237,141, 35, 71,142,216,141, 24, 49,226,140, 84, 42,237, 12,160,168,185,243,106,109,109,189,116,237,218,
+181,174, 98,177, 24,217,217,217,168,172,172,132,131,131,  3,  6, 12, 24,224, 28, 23, 23,183, 84,167,211,109,251,111,141,230, 63,
+ 83,100,  1, 64, 61,199,119,226,194,249, 31, 38,120,183,169,240,239,212,142,239, 26, 19,235,224, 26, 21, 43,237,  0,  0,126, 62,
+ 14,201, 19,130,249,121, 15,147, 99,243, 46,156, 63,113,239,201, 83,196,152,178,180, 93, 89,163, 62,122, 49,238,246,240,128, 78,
+ 93,140, 91, 54, 47, 31,181,232,221,185, 28,177,195, 59, 40,206, 61,129,184,203,247,221,150,127, 48,207,254,139,173,223,159,189,
+ 24,119,155,172,172, 81,175, 49,205,148,229,246,245,254,111,123,219, 85,149, 70, 35, 61,133, 13,158,133, 31, 60, 60,218, 66, 46,
+151,131,203,229,114,167, 78,157,106, 88,185,114,101,141,165,165, 37,159, 32,  8, 92,185,114, 69, 10, 96, 88,115,188, 42,177, 53,
+109,208,234,244, 52,155, 97,164,  9, 11, 37, 97, 40,103, 39, 61,206,196,208,193,  3,139,251,246,240,219,184,114,221,214, 85,222,
+109,  3,236,231,204, 13,103,174, 15,155,182, 11,  4,250, 53,196,147,146,142,203,196,209,227, 60,  0,163,214,125, 26,134,140,140,
+ 52,235,249,111,203,194, 41, 14,207,169,189,123, 31,139, 93,251,174, 12,247,242,106,221,234,253,197, 33,167,191,252,230,203, 81,
+245, 45, 91,251, 35,214,158,  4, 16,100,202,185,253, 59,130,164,168,118, 36, 65,228,201,107,106, 24,180, 86,107,183, 52, 46, 78,
+121,225,214,173, 75,137,243,231, 91,116,100,177,218,118,100,177,192,208,106,203, 86,  3,165,159, 26,141,  5,107, 41,202, 50,243,
+228, 73, 39,138,205, 78, 80, 25,141,254, 48, 26, 27,138,159,212,113, 70,108, 44,170,115,115,117,229,215,174,169,130,190,249,166,
+212,117,216,176,109, 26,173,214,174,246, 86, 65, 18,  4,136, 90,215,  9,163,145,160, 86,172, 32,105,138,130,206,218,250,109, 84,
+ 84,180,109,142,243,131,194,194,  9,211,230,206, 29,117,242,220, 57,180,110,221,186,238,121,102,101,101,133,229,203,151, 99,217,
+178,101,156,  7, 15, 30,116,143,142,142,238,254,197,231,159, 59,  0,152, 96, 74, 61, 47,220,186,101,253,175,117,235, 86,119,234,
+218,213,237,224,225,195, 28, 79, 79, 79,  0,192,179,103,207,188, 55,111,218,228,238,231,239, 95,188,241,189,247,246, 39,175, 92,
+217,  1,192,181,166, 56,139,226,227, 53,209,217,217,115, 47, 95,185, 98,229,231,231,  7,  0, 72, 77, 77, 21,111,223,190,125, 94,
+135,144,144,233,235, 22, 46, 92, 19,172, 82,201, 44, 75, 74, 56,193, 95,127, 77,253, 52,105, 82,179,156,181,245,  4,128,  1,115,
+230,188,215,111,224, 64,223,  9,115,231,218,184,185,185, 17, 66,161, 16, 90,173, 22,  5,  5,  5,214,201,201,201,158,177, 85, 85,
+242,227,183,110, 69,194, 96, 24,242, 23,118,161,  6,181,200, 27,102,201,250,253,184,120,249,119, 64,108,108, 44,253, 82, 77,214,
+ 61,192, 13,  6,131, 73, 34,139,162, 40, 16,  4, 97,170,216,  2, 77,211, 40, 45, 45, 69, 82, 82, 18,158, 61,123,  6,133, 66,129,
+204,204, 76,236,217,179,  7,155, 55,111,198,221,187,119,161,211,233,160,213, 54,159,131, 86, 32, 16, 12, 30, 60,120, 48,117,235,
+214, 45,120,120,120,128,199,227,129,205,102,131,197, 98,213,189,184, 92, 46, 28, 29, 29, 33,151,203, 17, 20, 20,196, 20,  8,  4,
+131,155,177, 18,141,156, 60,121, 50,187,246,255,234,234,106, 48, 24,140, 58,209, 82, 93, 93,141,242,242,114,200,100, 50, 20, 22,
+ 22,162, 87,175, 94,108,145, 72, 52,210,212,171, 81, 83, 83, 83, 45,149, 74,173,250,245,235,103,253,228,201,147,223,101,251,253,
+229,151, 95, 84, 42,149,138, 73,146,164, 73,142,246,135, 14, 29, 66, 76, 76, 12, 46, 93,186,132,252,252,124,236,218,181, 11,  7,
+ 15, 30,196,169, 83,167,144,150,150,134, 29, 59,118,224,187,239,190,195,254,253,251,155,188, 70,237,219,183, 31, 17, 25, 25,217,
+163,103,207,158,124,  6,131,129,212,212, 84,188,255,254,251,144,201,100,176,183,183,  7,  0, 20, 23, 23, 99,219,182,109, 80,171,
+213, 16, 10,133,112,118,118,230,174, 91,183,174,175,189,189,253,208,166,234,104, 48, 24, 12, 12,  6,  3,238,238,238,  8, 13, 13,
+197,119,223,125,135,243,231,207,227,232,209,163, 88,184,112, 33,124,125,125,145,144,144,128,187,119,239,130,166,233, 38, 31, 50,
+ 92, 46, 55,228,224,193,131, 98, 54,155, 13,163,209,136,170,170, 42,228,230,230,226,246,237,219,170, 19, 39, 78, 84,159, 62,125,
+186,230,218,181,107,170, 27, 55,110,208,  0,234,  4,103,112,112,176, 45,155,205,126,203,132, 83,106, 47,145, 72, 86,205,155, 55,
+143, 91,191,207, 22, 21, 21, 97,194,132,  9,124, 30,143,183, 18,128,125, 83,  4,145,145,145,127,217,205, 34, 44, 60,204,242, 47,
+162,166,163,143,183,189,203, 49,166, 34, 38,246,185,107, 78,190,161,207,242, 15,183,218, 44,255,112,171, 77, 78,190,161, 79, 76,
+236,115, 87,142, 49, 21,209,199,219,222, 53, 65,  8,144,131,250, 59,142,117,176,181,218, 61, 97,204, 24,250,187,239,182,117, 89,
+244,238, 92,142,123,219,229,224,138,166,194,217,227, 95,  8, 10,116, 35, 58,250,146,220,239,190,219,214,101,194,152, 49,180,131,
+173,213,238, 65,253, 29,199,162,153,176, 51, 98, 91,174, 51,159,163,128,167,183, 47,  6,244,239,  4, 38,145,142, 99, 71,247,161,
+176,176, 16,  5,  5,  5, 40, 46, 46, 22,140, 30, 61, 26, 69, 69, 69,170, 43, 87,174, 72,149, 74,101,127,  0, 79,155,107,124,126,
+254, 99,163,170,218,160, 53, 26,152,250,170, 74, 86,205,194,165,209,131,239, 38,179,102, 23,201,156, 71,179, 57,214,236, 17, 67,
+186, 31,222,183, 55, 20,109,218,248,161, 91,247,161,189,172,133, 55,125, 27, 21,175, 25,136,253,249,216,241,147, 83, 39, 79,213,
+103,101,102,103,182,117,224,106,104,154,214, 45,253,248,251, 33, 76,129,107, 71, 79,159, 64,251, 39,233,  6,199,208, 21,111,253,
+120,250,228,151,249,215,175,157, 64,223,126,227,224,236,228,221,255,237,183,193,126, 83, 45, 90,  4, 77,123, 48,133,194, 12, 93,
+101,165, 59,197,225,228, 26, 12,  6,187, 59, 11, 22, 88,105, 89, 44, 71,131, 86, 91, 96,208,106, 11,180,108,182,229, 78, 31, 31,
+ 23,154,166,109,173, 92, 92,158,211,108,182,155, 94,171, 77, 39, 72,178, 77,131,179,115, 14,199, 69,232,238, 78, 21, 93,184,160,
+241, 24, 61,186,  2,  0, 52, 90,173, 93, 86,118,182,168, 88, 42, 21, 21, 21, 23,139,114,242,242, 68, 25,153,153,162,180,244,116,
+ 81, 74,122,186,229,163,164, 36,225,131, 71,143,132,  4,131,225, 96, 10,103, 86, 65, 65,199, 21, 43, 86,128,199,227, 65,175,215,
+ 55,116,207,134, 66,161,192,219,111,191,141, 26,160,167, 41,156,  6,131,129,248,215,186,117,171, 63, 90,189,218, 51, 38, 38,134,
+211,163, 71, 15,216,216,216,192,198,198,  6, 61,122,244, 64,244,177, 99,236,133,139, 23,187,172,218,187,247,109,146,195,113,109,
+142,179,212,203, 11, 54, 54, 54,188, 90,145,  5,  0,237,218,181,195,174, 93,187, 56,231,206,159, 23,125,250,195, 15, 91,195,111,
+220,240, 87,231,228, 40,108,219,182,165,217, 28,142,139,169,231, 19,  0,170, 84, 42,191,109,219,183,219,218,217,217, 17,197,197,
+197, 72, 79, 79, 71, 78, 78, 14,244,122, 61,186,117,235, 70, 28, 61,118, 76,164, 97, 48,186,255,197, 93,232,119, 90,228, 13,194,
+124, 52, 18, 71,139,122,249,  0,186, 10,128,136,141,141,165,107,151, 19, 95, 62, 28,235,196,148, 41, 66,235,117, 32,147,201, 32,
+147,201,176,119,239,222, 58, 97, 84, 11,141, 70, 99,138,104,241,119,114,114, 66,101,101, 37,218,182,109,251, 27, 75, 22,139,197,
+  2, 69, 81, 96,177, 88,224,112, 56, 80,171,213,112,115,115, 67, 77, 77,141,127, 83,156, 74,165,178,179,141,141, 77,221,  3, 86,
+173, 86,215,137,172,218,250,106, 52, 26, 84, 84, 84,160,186,186, 26, 85, 85, 85, 80, 40, 20,  1,166,180,215,104, 52, 34, 41, 41,
+233, 89,187,118,237, 58, 51, 24, 12,  8,133, 66,129, 66,161,168,243, 45, 42, 47, 47,199,129,  3,  7, 20, 51,103,206,180, 59,117,
+234, 84,179,  9,139,  9,130,192,191,255,253,111,112, 56, 28,212,212,212,224,187,239,190,195,146, 37, 75,192, 98,177, 80, 85, 85,
+133, 93,187,118,225,253,247,223,  7, 69, 81,208,104, 52,216,190,125,123,163, 92,143, 31, 63,206,186,117,235, 86, 64,151, 46, 93,
+172,143, 31, 63, 94, 50,100,200, 16,251, 97,195,134,129,199,227, 65,169, 84, 66,167,211,161,103,207,158,104,223,190, 61,164, 82,
+ 41,206,158, 61, 91,234,237,237,109,119,251,246,109, 99, 81, 81, 81, 78, 51,226,154,174,103, 49,132,193, 96, 64,113,113, 49,100,
+ 50, 25, 74, 74, 74, 80, 80, 80,128,252,252,124, 80, 20,133,102,116, 22,108,109,109, 39,250,249,249, 49,  0,128,199,227,161,115,
+231,206, 88,189,122,181, 94,169, 84, 78,  6,112,246,101,177, 17,223,127,255,253,241,235,215,175, 83, 78, 78, 78, 72, 73, 73,129,
+189,189, 61,197,229,114,223,210,104, 52, 77, 90,163, 36, 18, 73,196,207, 63,255,108, 83, 43,174,107,207,115, 77,205,139,203, 49,
+ 97,194,  4,155,131,  7, 15, 70,232,245,250, 70,197,117, 97, 97,225, 95,103, 53, 32, 24,234,191,138,219,138,  7, 86,103, 63,203,
+202,168, 88,105,135,229, 31,110,165,218,251,189,152,188,206, 95,  0,234,139,207, 63,232, 48,125,172,229,105, 43,158,156,213, 28,
+207,136,193,174, 59,199,140, 25, 66, 78,157, 18,156,198, 98, 89,121,236,222, 19, 46, 22, 59,188, 83,175, 17,150,176,181,179,132,
+135, 59,155,136, 62,253, 68,252,241,202, 79,213,135, 14,126,153,241,227, 79,177,195,217,204,139, 67,207,198,229, 45,108,140,251,
+233, 51,217,169, 26, 53,215, 71, 94,150, 72,216, 56,244, 65,231, 78,237, 32,182,175,192,247, 17, 81,104,221,166, 27,212,106, 53,
+ 44, 45, 45,249,  6,131, 65,203, 96, 48, 14,153, 34,178,  0,224,210, 37,153,177, 67,  7,153,134, 81,101,212, 47, 90,242,197,248,
+ 33, 35,198,248, 14, 26, 52,216,120,225,226,  5,109,159,  0,109,225,136, 97,157,139,207, 93,220,153, 86, 88,144,233,221,193,191,
+ 47, 30, 39, 95, 25, 78,211, 72, 34,136,134, 69,103,114, 58,206,169,140,143,175, 68, 69,205, 55, 42,141,  9,188,245, 27, 30,141,
+ 24, 53,106,150, 95, 96,191, 64,227,197,184,203, 26, 54, 74,159, 88,246,237,253,124,209,220, 17,199,127, 56,180,125,232,185,179,
+ 17, 94,149,242,156,216,253,251,161,198, 27, 10,154, 32,236, 45,  4,130,146,178,170,170, 78, 19,195,195,229,147,150, 47, 63,223,
+145,162,124, 13, 90,109,102, 56,160,164,105,154, 48,234,245, 43, 31, 29, 62,204,  8, 35,136,143,195,  1,227,  6,  6,131,153,111,
+ 52,214, 56,147, 36,127, 45, 64,133,191,178,147,219,160,215, 59, 80, 28, 14, 89,114,229,138,222,255,157,119,212,181,227,145,207,
+231,227,228,201,147, 96,179,217,117, 47, 22,139, 85,247,222,193,193,  1,196,203,109,164,191,155,248, 53,192, 89, 59,110,139,138,
+138, 32, 18,137, 96,111,111,143,162,162, 34,220,184,113,  3, 79,159, 62,  5,147,201,196,240,225,195, 65, 54,226,219,252, 42,231,
+164,229,203,135,248,248,251,187, 45, 88,176,128,124,245,249,168,213,106, 81, 94, 94,142,177, 99,199,146,103,207,158,149,156,203,
+205, 29,  3,224, 80, 83,156,  1,163, 70,149, 21, 71, 71, 55,248,219, 93,186,116, 33,126,253,245, 87,206,240, 97,195,150,125,176,
+ 97,195,206,175, 15, 30,204, 51,232,245,146,150,180,157, 36, 73,146, 32,  8,184,186,186,162,188,188, 28,213,213, 47, 86,176,133,
+ 66, 33,172,173,173,161,211,233, 96,164,105,230, 95,217,127, 26,211, 34,111,  8,246,212, 19, 92,191,177,108, 81, 47,215, 69,107,
+111, 20,  3,234, 63, 88,140, 70,163, 73, 34,139,201,100, 54,235,115,101,138,149,235, 85,152, 34,180,106,235,202,229,114,127, 99,
+201,170, 21, 88,181,245, 36, 73, 18, 12,  6,163,217,135,248, 75, 49,196,168,170,170,194,177, 99,199,208,191,127,255,186,101,169,
+202,202, 74,200,100, 50, 84, 86, 86, 66,165, 82, 33, 43, 43, 11,151, 46, 93,130,151,151, 23, 96, 98,240,215,140,140,140,123,173,
+ 91,183,238, 90,251, 16, 31, 56,112,160,203,254,253,251, 11, 70,142, 28,233, 68,211, 52,214,172, 89, 83,218,179,103, 79,187,250,
+ 15,249,230,192, 96, 48,112,227,198, 13,120,121,121,129,166,105,176, 88, 44,164,166,166, 66, 44, 22,195,104, 52,130,162, 40,148,
+148,148,192,194,162,233, 24,137, 73, 73, 73,179,231,204,153, 83, 32, 18,137, 58,150,149,149, 21,114, 56,156,126,241,241,241,174,
+ 90,173, 22,150,150,150,176,180,180,196,153, 51,103, 96,101,101,133,247,222,123, 47, 87,169, 84,222, 16,  8,  4, 14, 74,165, 50,
+177,168,168,104, 77, 75,174,183, 94,175,135, 66,161, 64, 69, 69,  5,202,203,203, 33,151,203,161, 82,169,154,173, 99, 67,232,215,
+175, 31, 98, 99, 99, 25,159,125,246,217, 15, 25, 25, 25,  0,  0, 15, 15, 15,188,247,222,123, 12,103,103,103,100,101,101,225,222,
+189,123,208,106,181,160,105,186,201,193, 75, 81,212,192,153, 51,103,246,117,115,115, 35,180, 90, 45,140, 70, 35,212,106, 53,106,
+223,231,230,230,194,199,199,135,116,119,119,239,149,145,145, 49, 16,141,108,172,168, 63, 97,248,179, 17, 26,250,137,  6,111, 32,
+138,115, 79,192,153, 41,  6, 72, 75,208,202, 19, 40, 43,125,189, 40, 46, 82,169,116,195,138, 79,126,125,231,235, 45, 90,135,252,
+ 66,160,157,223, 56,120,251,  6, 97,246, 12, 61, 62,251,252, 24,220,220,219, 33, 39, 39,  7,  3,  7, 14,100, 21, 20, 20,204,169,
+174,174, 94,110, 42,247,197,139,183, 12, 23,206,156, 13,153,244,214,172,174,131,  7,143,212,159, 63,127,  6, 73,137,231,147,231,
+188, 53, 81, 74, 27,171,  9, 27, 43, 94, 66,106,202, 93,239,142,157,  7, 64,163, 55,244,  3,194,182,  0, 97,116,227,227, 29,154,
+211,167, 29,201,211, 39, 34,102, 76,157,254,118,167,160,160,161,186,243, 23,127,198,189,155, 23, 31,110,221, 50,239,234,103,219,
+143, 12, 28, 50,124, 98,  7,123,135, 27,103,252,218,170,231,186,218,138,158,125,191,191, 28,111, 48, 40, 22,151,171,  7, 64, 90,
+185,187,187, 28,191,116, 41,187, 51,147,201,176,  4, 12, 52, 77,183,  3, 96, 71, 82,212,170, 83,115,231,  6,248,188,124,144,234,
+  1,163, 15, 64, 86,  2, 26,  1,192, 70, 35, 33,115, 40, 46,215,136,151,247, 69,146, 32, 64,211,244,111, 68,214,171, 66,139, 36,
+201,102, 13,  0,245, 57,235, 63,139,106, 39,212,187,119,239,  6,135,195,  1,155,205,  6,147,201,108,214,253,162, 62,103,114, 86,
+214,160,  3,135, 14,113, 26, 18, 89,101,101,101, 40, 43, 43, 67,117,117, 53,166, 76,153,194, 10,191,123,183, 11, 94,186,126, 52,
+198,233,230,232,168, 22,240,120,197,143, 31, 63,118,242,245,245,253, 77,125,229,114, 57,120, 60, 30, 14, 29, 62,204, 10, 30, 53,
+234,221,160, 51,103,182,162,153,248, 87, 13,181,157, 32,  8,136,197, 98, 88, 91, 91,131, 32,  8,232,245,122, 20, 21, 21, 33, 57,
+ 57, 25,119,239,222,  5,131, 32,244,127,101,231,105, 72,139,188,129, 86,173,223, 45, 31,214, 90,180,136,198,172, 47,166, 10, 45,
+  6,131,241,218, 86,173,198, 96,202,210, 33,159,207,127, 84, 80, 80,208,199,217,217, 25,122,189,190, 78,104,213,183,196,213, 62,
+244,120, 60, 30, 30, 60,120,  0, 62,159,255, 72,165, 82, 53,201, 73,211,116,175,238,221,187, 35, 38, 38,  6, 87,174, 92, 65,102,
+102, 38,106,106,106,160, 86,171,161, 84, 42,145,156,156, 12,163,209,  8, 63, 63, 63,  8,  4,  2,240,249,252, 71,181,150,175,198,
+160, 80, 40, 10,153, 76,102, 59, 30,143, 87,247,153,163,163, 35,202,202,202,140, 58,157, 14,  7, 14, 28,144, 75, 36, 18,  1,143,
+199, 51, 89,184, 18,  4,  1,169, 84, 10, 23, 23,151, 58, 31,173,170,170, 42,136,197,226, 90, 97,  1,181, 90, 13, 11, 11, 11,208,
+ 52,221,220, 53, 82,165,167,167,127, 80,239,255,110,147, 38, 77,250, 49, 42, 42,170, 77, 92, 92, 28,110,223,190, 13,123,123,123,
+108,220,184, 49, 51, 59, 59,123, 42,128,187, 82,233,159,235, 23,105, 74, 31, 42, 43, 43, 59,246,232,209,163, 94,221,187,119,175,
+187, 75, 12, 28, 56,144, 24, 56,112,160, 93,125, 83,127, 73, 73,  9,238,220,185,131,184,184, 56, 16,  4,129,180,180, 52,131, 82,
+169,252,177,  9,106,150,179,179,243,254,213,171, 87, 11,245,122,125, 93,223,230,241,120,224,114,185, 96,177, 88, 96, 48, 24,200,
+206,206,198,216,177, 99, 69,223,124,243, 77,132, 90,173,246,  4,240,187,142,186,108,217,178, 55,210,199, 70,166,132,246, 65,146,
+ 92,228,231,227,144,188,103,247,103,125,230, 47,120,113,143,216,179,251, 51,189,159,143, 56,249, 65, 82,177,168,171, 24,205, 14,
+204,179,113,121,139, 52,186,179,163,207,158,251,101,242,135,203,222, 99,122,120,248, 72,227, 46,223,119, 11,210,127, 74,216,218,
+ 89,162,172, 84,142,236,220, 98,100,228,104,104, 15, 15, 31,233,189, 59,143, 56,159,111,251,202, 91, 81,163, 58,114,249,106,225,
+207,205,208,171,174,221,200, 28,183,117,  7,231,234,172, 57,221,216, 60,158, 19,202, 75, 31,193,205,205, 30, 99,131, 59, 98,223,
+193, 27, 16,137,108,224,224,224,  0,146, 36,  5,166,182,189,180,180,148, 56,246,211,181,119,102,190, 61,175,231,176,161,163,244,
+231,206,159,166,174, 92, 56,117, 35, 98,207,170,227, 52, 67,193, 39,232, 42, 94,171,214,146,196,103,233, 15,166, 14, 26, 60,  5,
+ 60,150,133, 23,208,190,193, 14, 91,183,193,128, 70,110, 76, 84, 24,119,230,219,243,123, 15, 27, 54, 70,127,254,252,  9,156, 63,
+115,240,214,218,181,173,206,100, 62, 63,204,186,121, 55,159, 59, 46,100, 97, 69,236,217, 39,154,137,163, 91, 63,117, 18,116, 86,
+  2,153,111,172,202, 34,  9, 66, 94, 90, 82, 98,201,100, 50,149, 17,211,166,165,  1,128,142,162,202,170, 24, 12,123,130, 32, 82,
+  1,164,110,  0,236,192,102, 87, 78,210,235, 13,203,221,220, 88, 84, 97, 33,163,194, 96, 48, 48,  0,246,135,191,207,191,  8,  6,
+ 69, 21,235,213,106, 87,151, 97,195, 24, 53, 57, 57, 76,161,131,131, 30,  0,116, 58, 93,179, 66, 11,141,108, 90,121,149,211,212,
+246,213,212,212,192,216,136, 16,124,149,179, 72, 42,109,245,114, 18, 94,  7,157, 78, 87, 39,178,202,202,202, 32,147,201, 32, 16,
+  8, 80,162, 86, 59,152,194, 57,180, 71,143,  3,225, 97, 97,203,163,143, 29, 99,213, 23, 89,181, 47, 38,147,137,205, 91,182,176,
+150,124,248,225,194,119, 41,106, 41, 26, 88,  6,109,236,124,214, 78,218, 25, 12,  6, 40,138, 66, 78, 78, 14,114,115,115,145,147,
+147,131,156,156, 28,240,120, 60,208,127,241, 38,160, 55,216, 63, 11,245,150, 10,231,191,106,229,106, 50,188, 67, 75,156,225, 77,
+ 21,  6,  6,131,225, 79, 21, 90, 10,133, 34,238,210,165, 75, 61,198,141, 27, 71,221,186,117, 11, 18,137,164, 78,104,213,254,173,
+ 93,142,226,243,249, 56,126,252,184, 86,161, 80,196, 53, 51,152, 46,157, 57,115,166,107,104,104, 40,115,246,236,217,120,252,248,
+ 49, 22, 44, 88,  0,153, 76,  6,185, 92,142,178,178, 50,212,212,212,160, 71,143, 30,224,114,185, 72, 76, 76,212,213,212,212, 92,
+106,110,233, 76, 42,149, 86,219,219,219, 59,190,250, 93, 72, 72,136,195,183,223,126, 91,147,146,146,162,235,211,167,143,165,169,
+130,163, 22, 63,253,244, 83,157,165,238,233,211,167,248,246,219,111, 65,211, 52,104,154,198,253,251,247,241,197, 23, 95,212,197,
+ 62,107, 33,238,150,150,150,234,117, 58, 29,188,188,188,224,236,236, 12,149, 74,133,175,190,250, 74, 15,224,238,127,171, 55,171,
+ 84,170,232, 89,179,102,125,148,144,144,224, 72, 81,212, 11,147,246,203,246,105,181, 90,164,167,167, 35, 57, 57, 25, 41, 41, 41,
+ 40, 47, 47,175,155,  8, 60,120,240,160, 66,167,211, 29,105,140,215,222,222,126,205,190,125,251, 36,124, 62,255, 55,253,185,214,
+ 26, 90,107, 37, 45, 41, 41,129,149,149, 21,130,130,130,196,151, 46, 93, 90,163, 86,171, 67,241,207,  0, 17, 50,254,105,183, 37,
+139,198, 97, 66, 48, 63, 47, 38,246,249,175, 95,124,254,193,  3,214,187, 21,  0,  0, 32,  0, 73, 68, 65, 84, 75,103,120,113,242,
+132, 96,231,188,135,169, 86,  8, 25,127,162, 27,128,124, 52,237,167,101,188,124,181,240,100,247,238,214, 87, 98, 78,157,138, 88,
+185, 98,217,253,229, 31,204,179,175, 81, 62,227,122,184,179,  9,  0,200,200,209,208,137,143,141,170, 47,182, 46,187,255,217,150,
+111,200,226, 50,217,130, 59,119, 26, 15,111, 80, 95,188,144, 36,184, 30,237,251, 23,120,183,237,219,250,214,141, 67, 16,242,149,
+104,215,190, 27,134, 13,237,133, 43,191, 60, 64, 81,137, 10,133,133,133, 80,171,213, 77,134, 75, 72, 73, 60, 62,131, 38,104, 55,
+130, 38,114,  9,146,230,206,152, 53,183,223,168, 81, 99,232,216,216, 83,250, 19,199, 15, 93, 63, 18,185, 35,154,100, 49, 41,165,
+ 70,164, 33,  8, 85, 37,200,164,199,213,138, 23, 19, 26, 38,135,213,184,249,245,101, 96, 87,223, 14,237, 37, 51,102, 45, 16,141,
+ 28, 49,150, 62,115,230,132,241, 72,212,129, 43, 71,246,250, 31, 50,146,114, 86, 97, 94, 13,167, 82,174,171,164,  9,182, 85,181,
+220, 88, 83,156,225,169,114, 26, 21,162,  5,162,223,216, 14, 68, 27,141, 57,180, 70,211, 26, 76,102, 30,173,215, 75,160,211,149,
+135,171, 84,207, 63,101,179, 91,253, 31,123,215, 29,223, 84,245,190,159,155,221, 38,221,139, 14, 90, 70,129,210,197,178,128,178,
+ 87, 89, 45,162, 40,136,162, 56, 25,138,162, 44, 65, 16, 16, 80,134,130,128,130, 44, 21,144,189,161, 32, 80,164,165,140,130,108,
+232,166,133,206,164, 77,186,146, 54,251,142,243,251,131,182, 22,236, 72, 10,250, 83,191,121, 62,159,124,114,115,115,239,147,115,
+206, 61, 57,247,185,239,121,207,251, 46, 16,  8,158,  1, 69,113,102,138,210,194,100,202,  2,  0,183,220, 92, 31,147,147, 83, 33,
+223, 96,104,  3,150,173, 51,  0,178,217,104,204,175,204,203,243,113,235,219, 87,114,111,225, 66,105,179,238,221, 13, 84,149, 15,
+113, 67, 66,139,207,231,  3, 60, 30,103,  9,167,165,245,211,235,245,224,234,  9,173,210, 24, 39,195, 48,143,136,172,106,161, 85,
+253,127,177,132,115,211,130,  5,151,  3,134, 12, 41,141,143,143,111,214,175, 95, 63,170,162,162,  2, 21, 21, 21,143,136, 45, 95,
+ 95, 95, 42, 52, 60, 92,186, 59, 46, 46,208,210,246,180, 72, 68,243,120,127,185,208,250,151,163,222, 68,210,130, 70,166,208, 44,
+ 22, 90, 22, 90,180,104,154,166,225,229,229,133,226,226,226,122,111,252, 60, 30, 15,246,246,246,213,115,196, 13,174,188, 51, 26,
+141,171,103,204,152, 49,101,216,176, 97, 30,237,219,183,135, 74,165, 66,179,102,205, 96,103,103, 87,227, 59, 86,205,119,253,250,
+117,252,244,211, 79, 26,163,209,184,186, 17,206,111, 87,172, 88,241,193,168, 81,163,220,188,189,189,225,234,234,138,219,183,111,
+195,213,213, 21, 26,141,  6,105,105,105,112,116,116,172,241,219, 57,122,244,104,133,209,104,252,182, 17,241, 70, 18, 18, 18,204,
+142,142,142,183, 85, 42, 21,191,180,180, 84, 80, 86, 86, 38,208,104, 52, 66,181, 90, 45, 60,121,242,164,135,179,179,179,238,236,
+217,179,170,128,128,  0,254,253,251,247,249, 52, 77, 55,170, 94, 41,138,194,212,169, 83, 33, 18,137, 96, 52, 26,177,122,245,106,
+204,152, 49,163,198, 39,107,197,138, 21,152, 59,119,110,141,112,222,188,121,179,117,  3, 39, 33, 48,155,205,160,105,218,226,  5,
+ 10, 79,244, 68,108,153, 96, 47,204,200,200,136,238,214,173,219,233,125,251,246,185, 87,197, 36, 67, 81, 81, 17,138,138,138,160,
+ 82,169, 80, 89, 89,  9,134, 97,224,231,231,135,162,162, 34, 28, 62,124, 88, 93, 81, 81, 49,  4, 13,172, 56,228,243,249,227,123,
+247,238, 45,120,188, 12,213, 79,121,213,226, 93, 34,145, 64, 46,151,163,127,255,254,226,248,248,248,241,  0,254,213, 66,171,118,
+120,135,193, 67,222, 17,133,132,245, 48,221, 74,138,201, 11,110, 85,148, 55,110,164,211,113,  0,184,121,183,200,249, 86,154, 11,
+ 66,194,162,201,224, 33,174, 17, 69,133,155, 58,  0, 48, 55,148,174,  7,  0,156,165,146,209,145,131,186,203, 29,101, 50,222, 55,
+ 43, 55,255,250,195, 15,223, 62,179,255,248, 31,225, 29,190, 89,249, 48,188, 67,228,160,238, 92,106, 74,234,104,  0, 91, 44, 21,
+ 47,209,209, 35,110,252,180,245, 39,164, 38,157,245,253,116,106, 71,113,105, 17, 13,123,  7,127, 68,116,110,134, 77, 91,239,224,
+214,173, 91,133, 38,147,169,127,131,253,155, 34,  1, 73,201,119,131, 58,132,133,122,191, 62,126,130, 83,116,244, 72,196,196, 28,
+193, 47,219,182, 36,188, 52,118,212,143,  5,101, 26,190,151, 80, 42,146, 18, 78,204, 23, 57, 11, 68, 18,123,165,201,244, 48,  2,
+129, 80,104,231,  4,140,110,240,198, 51,105,194, 56,231,  1,131, 70,226,248,137, 35,248,101,219,166,115,159,135,189,188,165, 85,
+151, 16,170,251, 51, 95, 79,110,213,186, 85, 11,109,101,145,134, 71,137,205,  6,  3,231,248,245,182,236, 85, 89,115,199,103,  1,
+ 88,137,127,233,170, 67, 49,203,222, 50,154,205,227,252, 35, 34,174,202,175, 94,237,240, 21, 77,187,125,  6,148,126,110, 50,101,
+239,  3,242,202,  1,222,196,170, 49,125, 37, 96,167, 23,  8,124,156,121,188,155, 21, 44, 59, 12,124,126, 18,234,126, 16,191,253,
+203,240,225,221, 62,202,204, 20,121,246,234,101, 47,143,139,147, 86,101, 34,105, 80,104,  9,  4,  2,144,250,167,186, 30,225,164,
+182,111,231,  1, 15,167,252,235, 27,227, 68, 34, 17,116, 58, 29,104,212,107,209,125,132,211,231,212,169,188,204,204,204,118,110,
+110,110,143,136,172,210,210,210,154,109,131,193,  0,157, 78,  7,123,123,251, 36,125,221, 51, 34,143,112, 22, 37, 36, 24,150, 77,
+157, 58,255,213,177, 99,215,158,249,237, 55, 59,119,119,119,168,213,234, 71,132,150,201,100,194,128,129,  3, 69, 43,110,220,120,
+ 29, 26,205,  2, 75,218,179, 89,255,254,141,250,  3,243,249,124,112,127,241,212,225,127,  0, 19,234, 18, 94,188,198,166,112, 44,
+ 93,117, 88,207, 13,242,241,213,125,115, 35, 34, 34, 12,233,233,233,  8,  8,  8,168, 17, 43,181,127,211,201,201,  9, 46, 46, 46,
+184,126,253, 58,190,252,242, 75, 61,128,185,141,112, 86,232,116,186, 87, 34, 35, 35,245,  2,129,  0,193,193,193, 53,241,179, 56,
+142,131, 88, 44,134, 76, 38,195,141, 27, 55, 48, 98,196,  8,157, 78,167,123,  5,127,142,161,245, 56,167, 90,167,211,189, 54,120,
+240, 96, 93,114,114, 50,122,247,238,141, 91,183,110,161,178,178, 18,149,149,149,120,240,224,  1, 66, 67, 67,161,211,233,176,126,
+253,122,189, 78,167,123, 13,128,186, 33,206,138,138,138, 17, 51,102,204,224,239,218,181,171,149,159,159, 95, 88,215,174, 93,219,
+ 15, 28, 56,176,205,139, 47,190,216, 98,248,240,225, 62,237,218,181, 51, 12, 25, 50,196,115,216,176, 97,158, 58,157, 78,120,241,
+226, 69,  5, 77,211,195, 26, 41,103,141, 56, 73, 79, 79,175,153, 42, 20,  8,  4, 40, 46, 46,174,137,220, 95, 61, 40,213, 35,132,
+  7, 53, 38,182,171,  5, 86,181,224,178,192,207,173, 46,206, 70, 79, 18,139,197,213, 22, 79, 98,  1,231,205,148,148,148,200,190,
+125,251,222,124,231,157,119, 42, 10, 11, 11,225,232,232,136,192,192, 64,  4,  5,  5,193,195,195,  3,102,179, 25,135, 14, 29,210,
+ 30, 62,124,248,142, 90,173,238,143, 63,199,208, 26,244, 88, 59, 62,168,107,144,173,182,102, 85, 11, 45, 59, 59, 59,248,249,249,
+ 85,183,237,  3,107,218,179,137,248,107, 57,171,  4,204,192,  1, 67, 90, 15,143,122,193,249,208,145, 75,226,181,235, 14,223,137,
+ 24,132,205,238, 45, 53, 71,221, 91,106,142, 70, 12,194,230,181,235, 14,223, 57,116,228,146,120,120,212, 11,206,  3,  7, 12,105,
+157,156,148,218,190,118,222,195,186,202,105,103,103,215,163,119,175,136,178,248, 11,231,184,165, 43,190,231, 13,232,255,210,141,
+ 45, 63, 30, 58,180,229,199, 67,135,  6,244,127,233,198,210, 21,223,243,226, 47,156,227,122,247,138, 40,179,179,179,235, 97, 73,
+221, 39, 77, 24,231, 28, 53,124, 36, 98, 98, 14, 49,251,119,175, 95,177,231, 64, 70,223,119,167, 36, 20,165,167,223, 34,202,252,
+ 83, 16,242,114,144,146,146,162,174, 18, 89,233,150,112, 78,124,111, 92,109,145,117,222,221,187,247,230,148, 20,176,177,177,199,
+232,223,126,187,161, 63,127, 83,169,190,150, 92, 92, 42, 87,149,222,215,104, 74, 76, 28,199,130,101, 89,254, 23, 95,212, 56,236,
+214,121,141,122,246,236,135,179,103,118, 98,219,214,141,106,142,131, 97,244,254,253,236,232,209, 11, 73,139,150, 45, 91,236,216,
+189,147,138,126,254,  5,103,  2,112, 35, 70,141,116,217,181,103, 23,213,186,109,235,150,129,129, 53, 33,109,254,117,125,233, 83,
+160,146,  2, 82, 20,191,255,222,213,161,119,239,219,140, 80, 24,180, 72, 36,106,179,  6, 16,143,  6,216,137,  0,189,  0,224, 45,
+  0,252,244,  2, 65, 39,123,134,185, 85,161,211, 53,  7,128,197,132,220,175,139,115, 33, 80,166,201,201, 57,119,253,251,239,141,
+205, 94,121,197, 77,220,172,153, 19, 88,150,170, 30,223,235,123,  9,  4,130,199, 45, 48,245,114,250,121,120, 20, 28, 61,122, 20,
+ 65, 65, 65,240,243,243, 67,109, 31,217,234,128,220,238,238,238, 56,112,224,  0,200,163,193,169,235,229,236,210,170,213,245,229,
+203,150,153, 56,142, 67, 89, 89,217,159,172, 89,101,101,101,224, 56, 14, 39,142, 31, 55,105, 30,102,  2,177,168,238,253,249,252,
+202, 87,251,244, 89, 26, 21, 21,101,206,204,204,172, 89,121, 93,109,217, 82, 42,149,112,112,112,128,193,104,244,  7, 32,181,132,
+ 83,121,242,164, 12,141,140,235,117, 88,180,254,138,190,244,111, 23, 89,181, 19, 74, 79,176,200,162,197, 48, 12,252,253,253, 31,
+ 73,233,194,227,241, 30,121, 89,185,226,112,123,114,114,242,169, 33, 67,134,204,127,246,217,103, 39,205,159, 63,159,223,190,125,
+123,168,213,106,184,186,186,194,203,203, 11,105,105,105, 56,122,244, 40, 91, 92, 92,188,  1,192, 34,212, 17,192,174, 14,196,101,
+100,100, 68,119,236,216,113,207,236,217,179,157,  7, 15, 30, 44,244,247,247,  7, 33,  4, 55,110,220,192,193,131,  7,205, 91,182,
+108,209, 84,137,172, 56, 11,203,122, 90, 46,151,191, 52,108,216,176, 29,227,199,143,119,100, 89, 86,248,224,193,  3, 24,141, 70,
+208, 52,141,220,220, 92,115, 76, 76, 76,165, 78,167, 27,  7,224,180,  5,124,215,203,203,203, 67, 99, 99, 99,199, 95,188,120,241,
+203,119,222,121,199,125,224,192,129, 34,134, 97,112,225,194,  5, 85,151, 46, 93,188,148, 74,165,249,192,129,  3, 37,  6,131, 97,
+ 46,203,178, 22,165,224,161, 40, 10, 26,141,  6, 30, 30, 30, 48, 26,141,224, 56, 14, 38,147,  9, 14, 14, 14, 53,105,147,  8, 33,
+176,198,185,254,177, 62,192, 55,155,205, 24, 59,118, 44, 56,142,195,234,213,171,193, 48,140,213,100,206,206,206,215,110,222,188,
+ 25,221,185,115,231, 26,241, 82,221,135, 36, 18,  9, 60, 60, 60,224,238,238,142,152,152, 24,  8,133,194,107,141,249,187, 85,225,
+ 86,113,113,113,151,216,216,216, 30,119,238,220,121,  3, 64,103,179,217,236,199,178, 44,197,227,241, 20,132,144,219, 26,141,230,
+ 71, 88,152,130, 71,169, 84,126,249,230,155,111,118,217,185,115,167,131, 64,240,199, 95, 67, 32, 16, 64, 34,145,160, 58, 56, 38,
+ 33,  4, 38,147,  9,243,230,205,211,104,181,218, 47,255, 43,163, 68, 68,215,238,216,180,126,141,195,111,103, 79,169, 82, 50,112,
+208,213, 53,229,241,254,151, 95, 84,184,169,131, 60, 47,207, 33,162,107,119,139, 56,105,147,185,228,181,113,211,  2,170, 82,240,
+204,123,240, 32,123,227,142,237,171,178,  0,224,235,111, 87,183, 43, 42, 41,159,152,146,156, 58,122,195,134,221, 61, 24,179,185,
+196, 18,206, 63,196,203, 14, 53,  8, 12,  0,174,220,184, 83,212,106,196, 43, 39,231,182,109,237,244,188,178, 68, 95, 80, 89,169,
+251, 16, 64,150,165,117,239,213,179, 47,206,158,222,133, 95,182,237,208, 16,142,111,240,240,240, 32,  0,144,146,226, 65, 82, 82,
+202,201, 31,126,197, 46, 90, 33,185,181,104,218,135,  3,167,169, 53,165,223,174, 94,223,240, 84, 74,199, 78,207,162, 99,167,103,
+ 49,229,195,207,156, 67,195,130,  3,  0, 96,255,126,176, 97,109,147,143,205,255,124,225,243,139, 22, 45,132,166,194,136,234,116,
+ 61,105,119,147,143,103,101,193,244,111,238, 71,243, 25,230,194, 34, 66, 94,212, 37, 36,116,232, 49,115,230,239,231,191,249,166,
+149,154,207,239,249,  5,192,241, 40,138,  5, 33,246, 60, 30, 79, 33,163,233, 27, 21, 98,177, 15,197,113,207, 56,178,236, 33,186,
+129,252,159,243, 25,230, 10,166, 77,107,167, 43, 45,245,236,245,233,167, 30,130,153, 51,121, 13, 57,195,215,254,255, 90,194,121,
+245,246,237,227, 19,223,125,183, 96,193,252,249, 67, 54,108,220,104,223,161, 67,  7, 20, 22, 22, 34, 56, 56, 24,126,126,126,136,
+141,141,197,129,189,123,181,229, 21, 21,115,  1,252, 96,  9,231,246, 19, 39,210,218,135,133, 21,111,220,184,209, 55, 42, 42,138,
+210,106,181, 80,171,213, 80,171,213, 48, 26,141,168, 10,  8, 77,210, 51, 50, 82,104,154,222, 96,105,221, 89,149,202,110, 81,247,
+238,249, 34,142, 91,254,210,168, 81, 51, 22, 45, 94, 44,105,221,186, 53,101, 52, 26,107,172, 90,102,179, 25, 14, 14, 14,102,147,
+201,228,142, 58,252,222,234,226,148,108,217,194,168, 84, 42,120,122,122,214,132,107,170, 29,151,176,162,162,  2,132,144,255,108,
+  2,244,191, 18,245, 42, 36, 87, 87,215,107,  2,129,160,121,109,235, 86, 93,185,243,106,239,163,105, 58,191,184,184, 56,226, 49,
+197, 91,159, 63, 84, 32,128,175,  6, 12, 24,240,210,244,233,211,169,248,248,120, 28, 62,124,152,100,101,101,237,175,178, 98,101,
+ 53,240,244, 84, 31,167,163, 68, 34,249, 88, 38,147, 13,170, 14,225, 32,149, 74,239,104,181,218, 51, 85,211,133, 21, 77,224,116,
+146, 72, 36, 83,101, 50, 89,100, 85,250, 21, 56, 58, 58,222,212,106,181,177, 70,163,113, 13,234, 79, 84,221, 16,167,189,179,179,
+243,151, 30, 30, 30,175,205,156, 57,211, 61, 33, 33, 65,113,246,236, 89, 81,121,121,249, 78,147,201,212, 80, 82,233, 63,113,186,
+185,185, 93,227,243,249,205,255,162,107,132,142, 29, 59,198,140, 24, 49, 34,106,220,184,113,160,105, 26, 63,252,240,  3, 98, 99,
+ 99,143,223,187,119, 47,186,145, 39,220,199, 57, 61,154, 55,111, 30, 63,105,210,164, 22, 99,199,142,149,186,186,186, 66, 32, 16,
+ 64,171,213,226,222,189,123,184,113,227,  6, 57,114,228, 72,229,245,235,215,243,117, 58, 93, 63,  0,197, 86,180,231,147, 60,137,
+ 63,194, 41, 16,  8,250,250,251,251,239, 94,176, 96,129, 99,100,100,164,189,187,187, 59,248,124, 62,104,154,134, 66,161,192,221,
+187,119,113,234,212, 41,237,254,253,251,181, 37, 37, 37, 99,  1,156,251,255, 40,231,211,228, 12,105,135,207, 31, 75, 20, 93,111,
+180,247, 70,142,109,180,156,  3,250,250,140, 28,253,210,176,161,132, 16,236, 59,112,242,100, 92, 66,163, 73,165,235, 45,103, 99,
+101,181,132, 51,184, 45,111, 65, 82,242,221, 71,  2, 90,134,133,134,167,135,116, 24,181,196, 18,162, 90,145,225, 31,169,123,173,
+233,216,218, 54,221, 71,166, 89, 67,  2, 17, 61,114,244,139, 81,159,205,157,131,175,190, 92,138, 35,251, 14, 29, 79,201,122, 36,
+ 77,208,191,174, 47,213,190,183,124,193,231, 15,224,241,120,254,148, 88,252, 59,173,213,102, 56,  2,194, 10,128,255,  5,160, 93,
+ 36, 18,181,  1,203,134,129, 16, 65,  5, 69,197,124,195,178,174,  0,228,141,113, 46, 17,  8,158,149,250,248,244, 89,205,113,115,
+110,221,189,235, 80,251,129,173,218,242, 92,251,161,210,215,215, 87,169, 80, 40,154, 89,194, 25,253,221,119,102,157, 76, 38,153,
+179,124,121,223, 74,131,161,239,162, 69,139,  4, 87,175, 94,197,250,239,191,103, 12,249,249, 59, 84,192,212,122,102, 67,234,229,
+108, 49,117,170,221,172,245,235,223, 10,108,219,214,235,141, 55,222, 16, 10,133, 66,104,181, 90,228,229,229,225,244,169, 83,166,
+228,148,148,100,141, 70,243,188, 53,117,143,254,238, 59,179, 75, 96, 32,164,158,158,228,183,184, 56,231,137, 31,127, 60,169,101,
+171, 86,206, 67,134, 14, 21, 58, 57, 57,161,172,172, 12, 15, 30, 60,192,161, 67,135,148,149,149,149,190,  0, 88, 75, 56,119, 92,
+188,216,241,196,185,115, 47, 47, 89,178, 68, 28, 30, 30, 14,103,103,103, 84, 84, 84,224,238,221,187, 56,119,238,156,113,195,134,
+ 13,106,181, 90, 61,137,101,217,163,127, 97, 95,250, 79, 78, 29,254,213, 30,254,150, 92,136,  8,  0,159, 87,109, 47, 70,227, 57,
+  3,255,205,131,207,227,  8,112,115,115,219,100, 48, 24,136, 94,175,159,  8, 32,247, 31, 88, 78, 65, 68, 68,196,122,165, 82,217,
+131, 16,  2,103,103,231, 75, 73, 73, 73,239,163,158,149, 55,141,112,242,  1,244,112,112,112,232,238,232,232,216,215,104, 52,134,
+ 84, 77,191,165,104,181,218,115,102,179,249, 74,149,245,137,253,127,174, 59, 31, 64,164,175,175,239,187, 28,199,181,165, 40,202,
+133,101, 89,208, 52, 93,206,113,220, 61,181, 90,189,  5, 64,236, 63,160,156, 79,133, 51,180, 13, 94, 36, 60,132,212, 39,  8, 30,
+ 17, 90,143,  9,  8,138, 67, 74,114, 38, 14, 89, 81, 78,222,208, 65,254,235, 56, 22, 56, 29,151,247,  1, 26,119,174,253, 67,104,
+ 89, 32, 94,172, 22,153,109,248,111, 18,138, 60,194, 73, 17, 42, 55,184,227,139,191, 60,137,208,178, 20,161, 65,232, 11,130, 30,
+ 28,193,149,212,123, 56,251, 95, 27,235, 22,  0,205,120, 60, 94, 55,138,199,107, 67,  0, 45, 69, 81, 12,  8,113,  3, 33,153,224,
+243,147,230,155,205,153,168, 59,129,121,189,156, 95,  1,110,223,187,186, 94,226,  9,  4,222,  0,120, 85,214, 23,142,163, 40,150,
+ 80, 20, 83,123,122,235,177,  7,203,  6, 57,205, 64,  7,161, 68,226,207, 50, 76,179, 66,192,225,  4,203, 62, 99, 32,164,178, 57,
+240,249, 77, 32,205,218,186, 87,115,242, 37,146,128, 19,132,140, 84,201,100, 29,149,122,189, 39,  0,226, 32,147,165,104,180,218,
+109,  6,131, 97,157,181,117, 55,  3, 29, 68, 18, 73,115,150, 97,154,  1,  0, 79, 32, 80,238, 49, 26,253,243,157,156,222, 48, 24,
+141, 45, 28, 28, 28,104,147,201,164, 49, 24, 12,227, 24,134,249,205,154,186,223, 99,152,208,139, 60, 94,111,179, 76,230,110,166,
+ 40,153,137, 97,204, 38,179, 57,207, 96, 48,220,  1,176, 10, 64,230, 95,220,151,108,104,226, 31,208,198,105,227,180,113,218, 56,
+109,156,255,227,156,203,  0,167,175,  0, 55, 91,123,254,165,156, 82,  0,  1, 85, 15,139,255,198,186,255, 39,173, 91,  2, 91, 91,
+216, 96,131, 13, 54,216,240, 87, 99,118,253,110, 22, 54, 60, 61,232, 80,135, 79,150, 13,255,191,160, 26, 80,165,214,152,  4,155,
+162,108,207,216, 56,109,156, 54, 78, 27,167,141,211,198,105,227,252,159,227,108,140,251,223, 56, 37, 57,161,142,125,155,254,142,
+ 31,182,153,127,109,156, 54, 78, 27,103,157, 24, 49, 98,  4,207,214,158, 54, 78, 27,167,141,243,191, 14,158,173,  9,234, 69,179,
+170,215,211, 62,214,134,255,118, 95,248, 59,224, 87,245,178,230,120,159,127, 90,163, 30, 59,118,140,  3,128, 59, 41,119, 37, 21,
+ 21, 21,182,177,200,  6, 27,108,176,  9,173,191,249,166,245, 36, 55,183, 39,189, 49, 46,165, 40,200, 41, 10,114,  0, 75,159,226,
+177,141,193,215,195,195,227,163,208,208,208, 29,205,154, 53,155,  2,192,203,202,243,219, 73,165,210, 53, 50,153, 44, 94, 38,147,
+197, 75,165,210, 53,  0,218, 61,165,235, 70,  1,152, 40,145, 72,226,124,124,124, 10,196, 98,113, 28,128, 73,104,250,202,213,246,
+120, 24, 39,109, 49,128,142,214,156,232, 21, 54,114,175,103,216,200,219,158, 97, 35,239,186,135,143,104,231, 25, 54,242,174,103,
+216,200,219, 94, 97, 35,247,254,  5,253,245,105, 94,223,167, 85,158, 92,138, 66,174,133,229, 89, 69,  1,121, 20,133,252,127, 72,
+249,255,132, 14, 33,225,198,209, 99,198,216,219,134, 99, 27,108,176,225,127, 30,190,190,190, 47,249,248,248,156,241,241,241,137,
+245,245,245,125,201,130, 83,  6,213,113,147, 96, 41, 10,108, 35,131,126, 67,199, 53,102,174,172,125,238, 55, 22, 86,173, 54,103,
+ 51,138,  2, 75,170, 64, 81,224,188,188,188,214,250,248,248, 44,125,252,229,229,229,181,150,162,192,213, 58,150,173, 37,240,172,
+ 53,171, 54,123,253,245,215,247,149,149,149,197,152, 76,166,152,140,140,140,152,126,253,250,237,121,204, 18, 81, 47,167,157,157,
+221,171,221,186,247,184,126,238,194,149,140,244,123,217,242,228,180,251,217,199, 78,254,118, 53,188, 67,199,223,237,236,236, 94,
+181,226, 26, 81,  0, 38, 10,  4,130, 56,  7,  7,135,124,129, 64, 16,  7, 96, 50,159,207, 63,186,108,217,178,236,164,164,164,162,
+139, 23, 47,150,159, 59,119,174,224,157,119,222,185, 71, 81,212,177, 58,  4,251, 32, 11, 44, 48,243,115,114,114, 78, 42, 20,138,
+ 83,246,246,246, 95, 90,112,124, 13,167,103,216,200,219, 74,181,153, 40,213,102,226, 25, 54,146,212,218,190,109,101,155, 55,118,
+141,254,212, 23, 36, 18, 73, 64, 35,130,254,175, 52,209,255,169, 60,  0,188,171,190,139,  0,240, 93,213,171,122, 57,187,183,157,
+ 68,242,180,250,231,211,104, 79, 27,167,141,211,198,105,227,252,175,162, 75,213,187, 15, 30,250,107,213,220,187,173, 93,117,248,
+ 65, 70, 70,134,  3,  0,  4,  5,  5,189, 15,224,128, 53, 66,130,162, 48,139,227,  8, 15,  0,120, 60,234,211,254,253,  7,116,177,
+183,183,127, 36, 10,178, 94,175, 23,199,197,157, 29,200,113,132,170, 58,110, 22, 33, 88,  3,160,200,210,223, 48,153,140, 60,161,
+ 80, 12, 30,143,154, 22, 30,222,161,101,113,113,113,  2,143,199,219, 81, 80, 80, 80,102,181, 25,135,162,176,121,243,230, 32, 31,
+ 31,159, 63, 69,107, 86, 40, 20,226,145, 35,159,183,138,239, 77, 64, 98,148, 72,186,139, 40,202,135,101, 24, 23,  0, 16,  8,  4,
+101, 87,197,226,136,175,150, 44,145, 82, 20,197,149,148,148, 64,175,215,227,147, 79, 62,177, 79, 78, 78,126,161,184,184,120, 93,
+ 35,180, 65, 29, 59,117,249,228,212,169,147, 33,154,210, 50,195,230,111, 55, 94,215, 11, 68,186, 86,161,193,162,245,155,182,185,
+ 78,120,107,220,135,169,169, 73, 55, 81,119, 58,146,218,224,  1, 56,244,241,199, 31,135, 69, 71, 71,139, 43, 42, 42,236,244,122,
+125,203, 29, 59,118,204,139,136,136,112,232,220,185,179,120,247,238,221,148, 90,173,  6, 33, 68, 26, 28, 28, 76,198,140, 25, 99,
+216,179,103,207, 20,  0,107, 27, 16,190,179, 30,182, 37,111,117,251,246,237, 23,  0, 64, 70, 70,134,168, 86, 27, 11, 67, 66, 66,
+100,  0,144,150,150,246,  5, 33,220,199,  0, 64,  8, 86,  0,152, 83,135,105, 45, 35,172,215,104,128, 66,219,164, 11,251,236,194,
+122,143, 54,128,224, 30,  5,100, 84, 61, 16, 44,  2,106,197,133,122, 20, 41,114,185,188, 73,185,  9,163,162,162, 41,138,162,246,
+ 95,191,126,253,128, 82,169,108,197,113,236,123, 13,149,179,190,107,229,233,233,121,138,101, 89, 99,105,105,105, 77,160, 76,207,
+142, 47,246,112,119,148, 13, 84,149, 85, 36,148, 36, 31, 57,103, 97,223,164,220,221,221,223, 44, 46, 46, 94, 10,224,221,148,148,
+148, 46,  0, 16, 18, 18, 34,  2,112,205,201,201,169,167,217,100,162,108,227,159, 13, 54,216, 96,195,223, 34,180,110,  0,136,194,
+ 31, 41,120, 54, 53, 69,104,137,  1, 32, 33, 33,  1,  0, 36, 77, 40,  8, 85, 91,192, 76,157, 58, 21, 62, 62, 62,143,139, 23,196,
+199,199, 61, 73,101, 31,249,141,197,139, 23, 59,148,151,151, 15,250,241,199, 31,251, 16, 66,190,145,203,229,151, 27, 57,191,136,
+ 16,172,224,241,168, 79, 41,138,130, 68, 98,151, 62,105,210,164, 27, 85,223,181, 60,118,236,152,116,196,136, 17, 58,  0,217,  0,
+ 32,145,216,249,241,249,188, 32, 66, 72,245, 13,183, 94, 65,248, 50, 16,200,136,197,  3, 38,126,247, 29,243,204,136, 17,  2,153,
+167, 39,  5,  0,217,169,169,238, 43,190,254,186,103, 89, 86,150, 88,239,238, 94, 82,162,213,234,211,211,211, 33,145, 72, 40, 62,
+159,255, 76, 99, 21,150,201,100, 31, 45,249,106,185, 76, 83, 90,174, 55,104, 42, 76,124,134, 54, 58,218, 75,217,162, 66,101,137,
+131,189, 76,247,233,231, 11,197, 31,188, 55,254, 35,173, 86,251,126, 35, 84, 83,166, 77,155, 22,210,173, 91, 55,191,189,123,247,
+ 82,106,181, 26,  2,129,192,161,115,231,206,136,136,136, 96,207,158, 61, 75,181,106,213, 10,225,225,225,184,112,225,  2, 46, 93,
+186, 68,117,233,210, 69,122,240,224,193,215,105,154, 94,219,152,184,230,243,121,159,  4,  7,  7,119,150,201,100,166,160,160, 32,
+188,247,222,123, 32,132, 96,208,160, 65,225, 14, 14, 14,  7,180, 90,173, 56, 45, 45,181, 79, 99, 34, 91,153,116,100, 76,181,101,
+ 11, 64,  7, 16,220, 83, 37, 29,169, 61,253, 24,146,150,150,246,108, 89, 89, 25, 30, 94, 23, 82,147,192,188, 79,159, 62,214,244,
+165, 34, 66,176, 98,196,136,232, 79,  1,138, 26, 52,104, 80,249,148, 41, 83,120,169,169,169,175,189,248,226, 11,225, 25, 25,247,
+ 96,229,195, 64,208,224,193,131, 47,156, 56,113,194, 61, 40, 40, 72, 85, 90, 90, 90,243,133,183,187,203,144,115,  7, 87,127,244,
+229,154, 29,193,219,  9, 85,174, 74, 57,124,167,145,190, 73,189,249,230, 91, 69, 14, 14, 14,163,246,239,223,159,166, 80, 40,  4,
+ 34, 81,141,118,229,123,121,121,121,  6,  5,  5, 77,118,115,115, 83,242,121, 60, 47,  2, 66, 26,235,159,255,223,200, 72, 79, 21,
+182, 11, 10,166,109,227,181, 13, 54,216,240, 47,196,241, 42,113,117,252,241, 47,  4,  0, 16, 19, 19, 83, 19,153, 54, 58, 58,186,
+222, 39, 96, 66, 72,209,173, 91,183,252,117, 58, 29,  8, 33,150, 12,216,181,151,104, 22, 81, 20,111, 61,143, 71,189, 79, 81, 20,
+194,195, 59,220, 95,189,122,117, 93, 57,189, 76,225,225, 29,238,243,249,188,214,132, 16, 80, 20,239,  7, 66,184,162,122, 56,235,
+188, 17,137,197,146, 89,  0,224,237,237,147,245,235,175,191,154, 94,126,249,101,124,253,245,215,162,217,179,103,207, 16,  8,  4,
+ 83,114,115,115, 11, 27, 40, 39,  0,204,241,244,244,146,110,222,188, 57,104,210,164, 73, 55, 20, 10,197, 28,  0,240,241,241, 89,
+ 10, 32, 20, 64,118,173,125,216,176, 97, 79,193,123,239,189,151,174, 84, 42,231,212,199, 57, 10,104,227, 31, 28, 60, 96, 81, 66,
+  2,225, 25,141, 84,241,249,243, 26, 85, 81, 17,157,169, 82, 73,183, 94,187, 22, 61,111,233, 82,161,127, 64,  0,226,143, 30,245,
+ 40,214,233, 84,106,163,209, 80, 84, 84, 68, 24,134,185,100, 65,221,195,188, 60,189,164, 27, 87,253,112,213, 81,200,231,188,154,
+251, 81, 66, 55, 55,  1, 79,234, 36,230, 11,120,198,214, 45,219,137,  1,132, 53,118,141, 68, 34,209,235,131,  7, 15,150,238,217,
+179,135, 10, 15, 15,135,139,139, 11,206,159, 63,143,155, 55,111,162,172,172,140, 71,211, 52,186,118,237,138,229,203,151, 35, 32,
+ 32,  0,229,229,229,200,205,205,245, 16,139,197,158, 52, 77,215,215,158,143,244,167, 89,179,102,193,199,199,  7, 12,195,160,180,
+180, 20, 12,195,192,193,193,  1,  0,144,159,159,143,163, 71,143, 88,210,151, 26,  5, 33,  4,207, 61,247, 92,  5, 69, 81, 41,143,
+ 91,180,172,225,244,243,243,219,173, 82, 21, 15, 27, 48, 96,  0,202,202,202,232,133, 11, 23,162, 99,199,142,  8, 10, 10,106,180,
+156,190,190,190, 19, 25,134,153, 15,  0,102,179,121,171,157,157,221,219,191,252,242,139,123,237, 20, 33,213,150,172, 34,101, 73,
+217,165,171, 73,105,211, 38,190,220, 47,225,242,221, 60,179,112,100,174,250,246, 17,117, 29,229,156, 35, 18,137,127,108,209,162,
+197,170,169, 83,167,250,184,185,185,193,104, 52,206, 43, 44, 44,196,228,201,147,  1,  0,195,135, 15,239, 40, 20, 10,127,125,231,
+157,119,208,170, 85,171,130,210,210,210,220,235,215,175,191,167,211,233,238, 54,181, 61, 45,196, 19,113,214, 35,178,254,113,229,
+180,113,218, 56,109,156,127, 13,167,165, 90,228, 31, 10,  5, 30, 13,231,176,233, 17,161, 21, 29, 29, 77,197,196,196, 16, 11, 42,
+ 86,210,188,121,115,127,123,123,123,  0, 40,177,182, 20, 28,199, 77,113,119,119, 87,206,153, 51,167, 87, 80, 80,144,105,202,148,
+ 41,119,179,179,179,231,214, 62,166,101,203,150, 95,126,255,253,247, 72, 79, 79,207, 94,186,116,233,133,146,146, 18,107,243,152,
+205, 38,  4,171,171,172, 99,197, 71,143, 30,237,152,144,144,240,254,183,223,126,235,249,193,  7, 31,136, 62,250,232,163,113,  0,
+190,110,140,132,207,231,235,234,154, 46,172, 11, 62, 62, 62, 38, 62,159, 95,111,144,184,104,192,222, 78, 44,238,191, 40, 33,129,
+152,178,179,117, 63,173, 92,233,184,241,247,223, 23,208,132, 52,243,242,242, 66,239,158, 61, 43,237,248,252, 98,101, 97, 33,231,
+213,166, 13,255,193,175,191,122,232,197, 98,249,158, 61,123,212, 37, 37, 37,135, 27, 53,225, 81,148,134, 35,196,228,208, 60,128,
+126,249,133,200,240,171, 87,110,166, 58,122,121,240,186,116, 14,239,152,154,158,125, 29, 28,103,166, 40,170,209, 96,129,206,206,
+206, 65, 37, 37, 37,208,104, 52,240,244,244,196,234,213,171,225,237,237, 13,157, 78,135,164,164, 36,210,188,121,115, 42, 33, 33,
+  1,205,155, 55,135, 74,165,130,201,100, 66, 69, 69,133,210,104, 52,214,151,155,177,136,199,227,255,204,227, 81,111, 81, 20,133,
+214,173,  3,115,214,173, 91,103,226, 56, 14, 33, 33, 33,120,241,197, 23,113,240,224, 65, 36, 37, 37, 85, 91,158, 76, 45, 90,180,
+204,225,241,168, 22, 85, 90,169,201, 22,152,234,212, 62,114,185,124, 84, 19,255, 52, 60, 95, 95,223,113,109,219,182,125,255,213,
+ 87, 95,165,197, 98, 49,180, 90,109,117, 91,208,195,134, 13, 47, 31, 49, 34,218,249,248,241,227,245,150,211,108, 54,207, 47, 40,
+ 40,240,209,235,245, 24, 58,116,232, 71,223,124,243,141, 76, 44, 22,  3,  0, 88,150,125,196,146,181,228,219,237,167, 62,158,191,
+ 46,238,212,238,229,190, 75,102,191,221,111,220,148, 47,227,  0,156,172,171, 96, 38,147, 41, 75,173, 86,191, 59,109,218,180, 29,
+ 27, 54,108,112,157, 59,119, 46, 56,142,  3, 33,  4, 12,195,212, 36, 18,231, 56, 14,135, 14, 29, 66,102,102,230,151,143,137, 44,
+ 27,108,176,193,134,127, 28,172,208, 34,255, 68,248,224,225,180, 33, 30, 23, 91,127,123,100,120, 62,159,191,241,244,233,211,157,
+251,244,233, 35, 24, 56,112, 96,248,201,147, 39,195, 11, 10, 10,238, 86, 89, 15,194,  7, 14, 28, 24,238,229,229,133, 53,107,214,
+232,248,124,254,198, 38,254, 76,205, 77,175,176,176,240,  6,128,111, 14, 30, 60,184, 98,226,196,137,240,246,246, 14, 85, 40, 20,
+127,107,157,157, 36,146, 46,239,172, 94,205,  8,105,154,247,221, 55,223, 56,173,140,139, 91,177,119,223, 62,193,115,207, 61, 71,
+ 17, 66,112,231,246,109,251,229,107,215, 74,199,190,240, 66,118, 90, 86, 22,115,228,212, 41,186,168,160,160,180, 64,165,154, 15,
+160,180, 49,126,154,166, 19, 51, 50, 50,124,123,247,125,206,239,220,239,119,111,190,252,194,240,  1, 66,  1,143,186,151,157,127,
+205,199,219,195, 57, 62,238,140,158,166,233,196,198,120,180, 90,237,  3,134, 97,220,  8, 33,158,241,241,241,240,244,244, 68, 89,
+ 89, 25,104,154,134,201,100, 50,233,116, 58,187,146,146, 18, 24, 12,  6, 24,141, 70, 56, 57, 57,225,206,157, 59, 69, 12,195,156,
+173,143,147,101,217,119, 36, 18,201, 98,161, 80, 40, 22,137, 68,242,107,215,174, 65,163,209,180,116,113,113,249,154, 97, 24,200,
+229,114, 36, 36, 36,204,116,114,114,202,  6,  0, 59, 59, 59,136,197, 18,119,163,209,200,  0, 40,104,106,155, 19, 66,154,124,189,
+188,189,189,  3,236,237,237, 23,125,250,233,172,144, 78,157, 58, 67,165, 82,129,227, 56,200,100, 50,232,116, 58, 56, 57, 57,161,
+ 71,143, 30, 15, 22, 45, 90,164, 32,  4, 19, 26, 16,131,252,170,235,131,137, 19, 39,202,156,156,156,144,151,151,135,224,224,224,
+ 26,161,165, 80,149,220,185,120,245,110,234,180, 73,163,251,238, 60, 26,151,114, 42,254, 90,202, 11, 67,123,118,162, 40,210,178,
+161, 50, 42,149, 74,149, 64, 32,152, 50,113,226,196,197, 65, 65, 65,173,  9, 33,104,215,174, 29,  6, 15, 30,140, 95,127,253, 21,
+233,233,233,208,106,181,236,229,203,151,119, 41, 20,138, 99,182, 33,220,  6, 27,108,176,225, 47,197,159,124,179, 30,177,104,253,
+157, 80, 42,149,170,212,212,212,147,215,175, 95,143, 30, 51,102, 12,226,227,227,223,  4, 48, 13,  0, 36, 18,201,155, 99,198,140,
+193,245,235,215,145,154,154,122, 82,169, 84,170,158,198,111,138,197, 98,131,201,244,208, 56,101,103,103,103,103,229,233, 45,171,
+166, 12,  1,160,101,  3,251,234, 55,141,  8,  4, 62, 29,134, 14, 21,148,221,188,169,217,124,229,202,226, 29, 59,118,  8,122,245,
+234, 69,209,102, 51, 88,142, 67, 96, 96, 32, 53,112,208, 32,217,207, 59,118,184,177, 90,109,194,146, 79, 63, 61,191,233,157,119,
+ 42, 51,170,252,192, 26,131,209,104, 92,251,254,228,119,  7,197,197,159,247, 11, 13,110,227,118,242,116,220, 13,119,119,103,105,
+ 80,219,182,178,146,178, 82,118,238,236,153,  2,163,209,248, 93, 99, 60,122,189,254,208,153, 51,103, 94,240,247,247,247,188,123,
+247, 46, 76, 38, 19, 88,150,197,192,129,  3, 65,  8,145,  0,224,  4,  2,  1, 82, 83, 83, 97, 54,155,149, 25, 25, 25,242,123,247,
+238, 73,  0, 44,107,164,124, 57, 70,163, 17, 41, 41, 15,103,237,154, 55,111, 30, 25, 21, 21,  5,134, 97, 48,116,232, 80, 28, 57,
+114, 36, 50, 37, 37,101,101,109,205,247,164,215,188,202, 66, 22,226,235,235,123,176,106,151, 69, 78,240,126,126,126,225,129,129,
+129, 27,150, 45, 91, 38,106,222,188, 57,  8, 33,112,117,117,129, 78,167, 67,113,113,  9, 66, 67, 67,225,239,239,143,101,203,150,
+  1,192,174,134, 44,110, 28,199, 65,161, 80,224,193,131,  7,200,202,202,130,191,191, 63, 40,138, 66, 69, 69,  5, 24,230, 97, 78,
+110,105,133,230,248,247, 63, 31,235,191,111,195,252,176,238, 29,218,  5, 92,185,145,172,124,125, 84,164,180, 93,171,128, 32,213,
+221,133, 60, 96, 97,189, 73,151,229,114,249, 61,185, 92, 62, 70,169, 84,138,202,203,203, 35, 34, 35, 35,215, 12, 26, 52,  8, 55,
+110,220,192,249,243,231,199, 74, 36, 18,165,217,108,102,188,189,189, 39, 80, 20,229,100, 54,155,119,150,148,148, 40,108,227,161,
+ 13, 54,216, 96,195, 83, 71,181,143, 22,106,189, 91,103,209, 10,  9,  9,145,101,103,103,191,209,178,101, 75, 49,  0,216,219,219,
+135,  6,  6,  6,206,200,202,202,170,176,182, 52, 58,157,110,239,142, 29, 59,  6,175, 90,181, 74, 52,124,248,240, 54,  7, 15, 30,
+236,  6,  0,195,135, 15,111,227,232,232,136, 29, 59,118,152,117, 58,221, 83,139,137, 68,211,116,159,174, 93,187,162,180,180, 20,
+217,217,217, 86, 77,161, 28, 59,118, 76,138,135,126, 89, 13,238,107,  8,140,201,228,234,226,231,199, 43,136,139, 51,151,106, 52,
+ 62,125,250,246,165,104,179, 25, 60, 30, 15, 37, 37, 37,200,205,205,133,179,139, 11,149,154,145,225,176,101,214,172, 99, 45, 59,
+117, 18,179, 38,147,187, 21,197,212, 22, 43,139,222,250,112,202,  7,135,118,238,220,229, 89,174,209,100,218,219, 75,141, 18,137,
+200,123,234,135, 31,178,165,165,165,227,  1, 84, 90,192,179,108,231,206,157, 67,135, 14, 29,122, 59, 32, 32,192, 75,165, 82,121,
+151,151,151,179,165,165,165,124, 60,244,181,162,  0, 32, 46, 46, 14, 26,141,134, 97, 89, 54,  1, 15, 99, 97,153, 44, 45,104,139,
+ 22, 45,156, 35, 34, 34,250,121,122,122, 66,173, 86,195,221,221, 29,157, 59,119,238,199,231,243,127,204,201,201, 81, 63,205, 94,
+ 31, 27, 27,235, 72,  8,121,150, 16,130,161, 67,135, 90,116, 14,203,178,111, 71, 69, 69,137, 40,138,130, 94,175,131,157,157, 61,
+100, 50,  7, 56, 58, 58, 33, 40,168, 61,228,114, 57,134, 12, 25, 98,202,204,204, 92,175, 80, 40,246, 54,194,  5,185, 92, 14,149,
+ 74,133,220,220, 92, 20, 23, 23,  3,  0,138,139,139,107,156,243,159,  6,212,106,245,200, 30, 61,122, 76,159, 60,121, 50, 24,134,
+193,200,145, 35,145,151,151,183,242,193,131,  7,123,124,125,125,199,189,253,246,219,158,238,238,238,152, 62,125,186, 61,128, 47,
+108,227,161, 13, 54,216, 96,195, 83,199,227, 62, 90,127,182,104, 53, 52, 39,234,237,237,221,155,162,168,121,122,189, 94, 92, 61,
+ 37, 67, 81,148,216,211,211,243,136, 94,175, 95,170, 80, 40,172,114,138, 43, 47, 47,215,220,191,127,255, 72, 98, 98,226,232, 81,
+163, 70, 33, 54, 54,118, 60,  0,140, 26, 53, 10,137,137,137,184,127,255,254,145,242,242,242,167,146,128,212,207,207,111, 88,223,
+190,125, 71,117,237,218, 21, 49, 49, 49, 96, 89,246,146, 53,231,215, 94, 97,136, 58, 86, 29, 86,239,179,136,201,113,202, 59,  0,
+  0, 32,  0, 73, 68, 65, 84,140,207,  7, 69, 81, 53,214,140, 98,149, 10,233,105,105, 40, 45, 43,131,209, 96,128, 86,167, 99,131,
+ 90,181,210,171, 77, 38, 33,  5, 88, 59,247,149,115,253,234,229, 92,157, 86,235,229,238,234,166,151, 74, 37, 40,215,168, 69,215,
+174, 94,174,  4,144,105, 33,135,137, 16,210,247,215, 95,127,157,207,231,243,199, 56, 56, 56,224,253,247,223,231,247,235,215, 15,
+ 34,145,  8, 70,163, 17,229,229,229,216,177, 99,135,138,101,217,214, 85,231, 56, 72,165,210,109,124, 62, 63,191,162,162, 98, 94,
+163, 63, 96, 50, 13,143,142,142, 22,152, 76, 38, 44, 89,178,  4, 11, 22, 44,192,208,161, 67,  5, 87,175, 94, 29, 14, 96,231,211,
+234,241, 28,199, 33, 50, 50,178,182, 51,124,138, 37,231,  9,133,194,240,182,109,219, 66,165, 82, 65,165, 82,193,211,211, 19,190,
+190,190,240,246,246,198,202,149, 43,201,154, 53,107, 78,154,205,230,245,197,197,197, 69,150,148, 33, 43, 43,171,198, 50,104, 48,
+ 24,160,213,106,145,151,151, 87, 51,117,168,151, 57, 13,157,242,214,136, 78, 90,189, 94,119,229, 78, 70,238,188,143,198, 61,167,
+213,235,117, 25, 15,114,211,129,181,156,  5,253,123,194,248,241,227, 39,140, 30, 61, 26,149,149,149, 72, 76, 76, 68,207,158, 61,
+177, 98,197, 10,159,132,132,132,105, 93,187,118,133, 80, 40, 68,124,124, 60, 24,134,201,179,141,133, 54,216, 96,195, 63, 25,255,
+ 82,255,172,  6,209,160, 69,203,223,223,223,133,101,217,153, 81, 81, 81,145, 47,188,240,  2,134, 12, 25,242,200,247, 59,119,238,
+116, 60,112,224,192,210,181,107,215, 14, 53,155,205,203,172,153,234,227, 56,238,208,206,157, 59,135, 63,247,220,115,210,254,253,
+251,  7,  2,128, 68, 34, 49,237,220,185, 83,199,113,220,161, 38,212,165, 58, 16, 99, 17,  0,248,250,250,118, 20,  8,  4,163,134,
+ 13, 27,214,241,173,183,222, 66, 82, 82, 18,118,236,216,113, 47, 40, 40,232, 66, 81,145, 85,254,213,217,141,172, 58, 92,218,152,
+117,139, 47, 22,151,148, 23, 22,186, 56,  4,  4,  8, 93, 29, 29, 21, 49, 49, 49,254,131,  6, 13,162,242,242,242, 80, 86, 86,  6,
+131,193,128,171, 87,175,114,  2, 32, 71,224,234, 74,229, 36, 38, 82,124,177,184,  4,180,117, 43,221,253,125, 92,219,125, 62,123,
+ 82, 75,131,209, 16,166, 86,171, 25,129, 80, 40,108,238,237,146,151,150,105,213, 76,156, 81, 42,149, 70,  0, 16,112, 28,167,115,
+115,115,147,158, 62,125, 26, 98,177, 24, 20, 69,161, 67,135, 14,176,179,179, 19, 17, 66,114,  1,192,209,209, 81,188,113,227, 70,
+231,113,227,198,157,111,140,184, 75,151, 46, 66,137, 68,242,124, 80, 80, 16, 18, 19, 19,113,247,238,221,156,196,196,196, 22, 93,
+186,116, 65, 64, 64,192,243, 62, 62, 62,251,110,220,184,241, 84,150,247, 63, 92,177,106,189, 51, 60,203,178, 28, 69, 81,224,241,
+120,224, 56, 14, 42,149, 10,173, 91,183,198,186,117,235,176,122,245,234, 37, 10,133,226,168, 21, 92,172, 70,163,129, 76, 38,195,
+221,187,119,141, 81, 81, 81, 18, 30,143,135,123,247,238,213,  8, 45, 47, 15,183,208,158, 93,195,131,151,124,187,253,148, 76, 34,
+145, 12,233, 23, 17,146,156,145,147, 79,  8,213,232,180,113, 72, 72,136,168,117,235,214,227, 71,143, 30,141,172,172, 44, 44, 93,
+186,180, 88,161, 80,196,157, 58,117,234,165,201,147, 39,243,123,246,236,137,146,146, 18,252,252,243,207,204,181,107,215,126, 42,
+ 44, 44,220,110, 27,198,109,176,193,  6, 27,254, 33, 66,203,223,223,127,180, 72, 36,154,254,202, 43,175,240,219,183,111,143,162,
+162, 34, 56, 57, 57,209, 20, 69,  9,  1,192,197,197,133,182,183,183,199,164, 73,147,208,169, 83,167,222,179,102,205,234, 41, 16,
+  8,214,201,229,242,109,150,252,176, 82,169,212,241,120,188,253,239,191,255,254,178,155, 55,111,180,  6,128,223,127,255,253,190,
+ 92, 46,159,173, 84, 42,117, 86,214,163, 58, 40, 38, 37,145,216, 93,105,215,174,221,131,136,136,  8,167, 23, 94,120,  1,158,158,
+158,184,126,253, 58,150, 47, 95,158, 97, 50,153,230,159, 59,119,142,249,187, 27,153, 49, 26, 11,175, 29, 62,236,216,239,181,215,
+156,166, 70, 69,125,243,193,251,239,175,250,252,243,207,  5,237,219,183,167,116, 58, 29,174, 92,185, 66, 14, 28, 56, 64,255,188,
+120,241,106,200,100,194,196,  3,  7,196, 38,147, 41,199, 74,203, 93,223, 94,125,122,183,255,102,213, 90, 24,244,149,184,114,233,
+ 56,202,202, 84,216,184,233, 96,123, 63, 63,210,183,160,160,224,156,165, 92, 20, 69,  5,197,198,198,122, 17, 66, 32, 22,139,177,
+104,209, 34,248,250,250,194,201,201,  9, 21, 21, 21,152, 54,109,154,243,199, 31,127,236, 12,  0, 73, 73, 73, 53,225, 25, 26,131,
+ 92, 46,239, 49,105,210, 36, 71,134, 97,112,242,228, 73, 19, 69, 81,243,206,156, 57,243, 99,135, 14, 29,196,189,123,247,118,220,
+190,125,123, 79,  0,241, 79, 75,104, 53,241,188,123,167, 79,159,238, 58,102,204, 24, 34, 20, 10,169,242,242,114,184,184,184, 96,
+221,186,117, 90,133, 66,113,220, 74,174, 69,179,103,207,158, 95,181,189,117,222,188,121,239, 46, 91,182,204,179,176,176,176,198,
+170,169, 44, 46, 61,219, 35,234, 67,182,164, 92,109,250,233,219, 89, 47,219,219, 73,196,243,150,253, 20, 79,243,113,185,209,126,
+197, 48, 98,169, 84, 42, 38,132, 96,255,254,253,200,201,201,121,187,164,164,164,144,101,217,131, 51,103,206,156,209,190,125,251,
+ 86,105,105,105, 57, 21, 21, 21, 43,148, 74,229,  3,219,112,103,131, 13, 54,216,240,151,161,218,  9,190,122,245,225,113, 60,156,
+ 78,172, 95,104,177, 44, 59,233,212,169, 83,124,142,227,176,105,211, 38, 92,187,118,141, 72,165,210,121, 82,169,244,123,123,123,
+123, 86,175,215, 79,124,239,189,247,198, 45, 88,176,128,215,187,119,111, 36, 38, 38,242, 90,183,110, 61, 30, 64,109,161, 53,  8,
+ 13,196,218, 80,171,213, 87,139,138, 10, 91,215, 10, 80,217, 90, 34,177,187,218, 72,101, 30,231,124, 60, 40,102,247, 69,139, 22,
+105,125,124,124, 76,119,239,222,197,134, 13, 27,184,107,215,174,197,137,197,226,141, 10,133,194,104, 33,231,211, 64, 13,167,152,
+ 97,174,255, 50, 99, 70,200, 51, 35, 71,114,239, 78,159, 94, 41,178,183,255,232,155,181,107,103,149, 87, 84,248,130,162,136,187,
+179,115,206,166, 69,139,150, 14,125,254,249,202,164,115,231,236,110,198,198, 10, 61,105,250,150, 53,229, 44, 40, 40, 56, 23, 31,
+127, 30, 91, 55,175,130,217,108,132,162,224,161, 78, 43, 46, 81,163, 17,145,245, 39, 78,134, 97,212, 47,189,244,146,  8,128,253,
+235,175,191, 46, 86, 42,149,104,211,166, 13,  0, 64,163,209,224,248,241,227,  8, 14, 14,  6,  0,220,185,115,167,102,187,177,114,
+202,100,178,231,123,246,236,137,156,156, 28, 36, 37, 37,253,166, 80, 40, 74,  0,252,150,151,151, 55,188,107,215,174, 56,116,232,
+208,136,  6,132,150, 85,215,200, 66,161,245, 39, 78,123,123,251,217,  7, 15, 30,124,251,210,165, 75, 99,102,204,152, 33, 28, 56,
+112, 32,  0,160,162,162, 66,  7,128,181,134, 83,175,215,111,  4, 80,179,114, 54, 59, 59,251,151,233,211,167, 39,124,242,201, 39,
+158,213,229, 83, 37, 31, 77, 84,  1,137, 97,253,222,254,188, 71,215,176,246, 95,174,217,113, 42, 55,175,104,135, 58,229,136,218,
+146,186, 19, 66, 64,211, 52, 56,142,131,155,155,155,182,164,164,  4, 74,165,242,129, 82,169,124, 63, 51, 51,211,170,186, 63,205,
+ 62,111,227,180,113,218, 56,109,156,255,163,176, 60, 50, 60, 33,132,225, 56, 14,241,241,241, 56,120,240, 32,107, 54,155, 39, 40,
+ 20,138,218,209,170,215, 94,191,126, 61,246,165,151, 94,218,150,150,150,198, 79, 78, 78,  6, 33,132,181,166, 52,  6,131,129,166,
+168, 63,239,123,210, 90,110,221,186, 21,133,133,133,230,188,188,188, 51, 12,195, 28,122,194,213,139, 79,188,234,112, 43, 96,124,
+213,100, 58,179,160, 87,175,200,249,177,177,146,119, 63,251,204,248,230, 91,111,205,100, 77, 38,154, 47, 18,113, 98,153,140,199,
+ 74, 36,194,164,115,231,236,214, 76,158,236,166, 55, 26, 79,238,176,194,193,188,218,162,213,175, 95,111,188,249,238, 39,208,215,
+178,104, 37, 94, 77,135,209, 12,171, 44, 90, 70,163, 49, 76,161, 80,192,206,206, 46, 23,128,247, 27,111,188,  1,142,227,160,215,
+235, 81, 81, 81,  1,185, 92,174,126,235,173,183,216, 42,241, 36, 24, 53,106,148,147, 37,188,129,129,129,190, 66,161, 16, 39, 79,
+158,132, 80, 40, 60, 14,  0, 66,161,240,120,108,108,236,240,177, 99,199,194,207,207, 47, 48, 43, 43,139, 66, 35,254,105, 94, 97,
+ 35,247, 18,160, 29, 40,180,125,104,130, 67, 91,207,176,145,183, 41, 32,163, 42,106,124, 74,151, 46, 93,  0, 11,253,178,106,163,
+106,113,199,106,154,166,247,205,154, 53,235,253,238,221,187, 15, 94,176, 96,  1,133,170, 80, 13, 79,136,244,130,130,130, 62,115,
+230,204, 57, 69,  8,121, 68,244, 43,139, 75,207, 62, 23, 61,133,148,151,171,111,170, 82,142,222,177,202, 98,202, 48, 79, 20,206,
+194,  6, 27,108,176,193,134,167,102,213,250, 19,234, 21, 90, 20, 69,109,234,219,183,239,  4,  0,124,138,162, 54,200,229,242, 63,
+ 13,254, 10,133, 34,221,215,215,247,235, 86,173, 90, 77,  4, 64, 40,138,218,100,101,161,138,  8,193,114, 30,143,154,245, 80,220,
+ 53, 41, 64,101,117, 90,146, 89,  0, 40, 30,143,191,237,198,141, 27,159,229,230,230,170, 44,180, 64, 52,136,167,177,234, 16,  0,
+118,  1, 15, 94,201,201, 57, 53, 61, 60,124,208,208,201,147,209,113,232, 80, 39,223, 22, 45, 88,189,217,204,221,185,112,129,186,
+180,127,191,232,102,108,172, 80,111, 52,158, 60,  4,228, 90, 91,206,130,130,130,115,103,227,206,157,126,121,212,240,193,129,173,
+124, 31,138,134,  7,114, 20,151,170, 79, 91, 35,178, 30, 19,189, 35,215,173, 91,119, 84, 36, 18,  9,106,167,178, 49,155,205,165,
+ 70,163, 49, 12,  0,202,202,202,124, 55,109,218,180,155,199,227,229, 52,198,151,156,156,124,100,254,252,249,163,178,179,179, 79,
+231,229,229,101,  3, 64,110,110,110, 54, 77,211,219, 20, 10,197,168,156,156,156,  3,176, 96, 17,  0,  1,218, 37, 93,216,215,  1,
+  0,194,122,141, 70,210,133,125,118,  0, 58,132,245, 26, 13,  0,104,106, 46,195,218,168, 10,131, 48, 47, 49, 49,113,231,224,193,
+131,223,195, 19,196,244,122, 92,108,153,205,230, 22,143,239,172,182,108, 89, 67,100, 50,153,104,189, 94,207,176, 44, 43, 48,155,
+205,196,100, 50,217,210,215,216,208, 24,108,185, 47,109,248,215,130, 16,210, 21,128,103,245,176, 89,245,238,249,216,182,  9, 85,
+233,  2,171,135,202,170,207, 42,138,162,174,214,226,168,217,111,193,185,  0, 80, 12,224, 54, 69, 81,245, 25, 65, 54,213,247,185,
+ 94,161, 37,151,203, 15,192,130,164,209,150, 30,215,  0,230, 84,229,137,  3,154,158,135,173,134,131,101,217,162,220,220,220, 39,
+190,160, 60, 30,239,193,136, 17, 35,172, 58,190,177, 99,246,  0, 57, 31, 26,141,219, 99,190,251,174,243,201, 13, 27,252, 88,134,
+113,167,  0,194, 23,139, 75, 76, 38, 83,182, 39, 77,223,178,214,146,245,136, 53,230,126,193,144,172,251,  5,104,219,182, 45,185,
+119,239,222,211, 24, 84,111,105,181, 90,255,198,186,128, 78,167,235,109,161, 24,220, 85, 80, 80,176,171, 14,193,190, 91,161, 80,
+236,182,226, 78,145, 81, 37,170,120, 28,197,189, 28,214,107,244,126,  0, 92,117, 82,233,167,137,194,194,194, 52, 84,197,121,251,
+167, 33, 39, 39,199, 72, 81,212, 47,203,151, 47,127,253,230,205,155,123,228,114,185,209, 54, 20,219, 96,131, 13,255,101,145, 69,
+ 81, 84, 76,213,231,232, 42,163, 80,204,227,219,213,199, 84, 31, 87,251,152,106,142,199,247, 55,116, 46,  0,204,158, 61,251,179,
+165, 75,151, 74,  1, 88,154,140,185,201, 73,165,255, 42, 20,253, 67, 56,106,139,130,205,127, 69, 69,191,  3, 76, 96,152,203, 96,
+106,249,228,211, 79,215, 16,113,239,222,189,255,244, 83,107,117, 82,233, 90,  8,255, 95, 29,124,178,179,179,215,  5,  4,  4,108,
+148,203,229, 12,108,176,193,130,251,149,173,  9,108,248,151,194,179, 46, 97, 84,143, 40,139,110,232,251, 71, 30,220,235, 56,174,
+174,207, 20, 69,197, 44, 93,186, 52,218,138,242,214, 88,180,120,182,107,103,131, 13,255,110,252,127,172,164,181,193,  6, 27,108,
+248, 79, 60,121, 60,102,197,170, 22, 95,143,127,158, 61,123,246,103,104,120,198,201,  7, 15,173, 88, 62, 85,159,107,252,181, 40,
+ 60, 92, 57, 80, 23,172, 89, 77, 48,168,  9,245, 59, 99,227,180,113,218, 56,109,156, 54, 78, 27,167,141,243,127,142,179, 49,238,
+ 51,117,  8,162,168,250,166,250, 26,154, 70,124,124,187,177,115, 27, 59,150,162,168,250,194,252, 84, 79, 21, 62,254,254,151, 99,
+144,141,211,198,105,227,180,113,218, 56,109,156, 54, 78, 27,231,147,128, 16,210,149, 16, 18,133,135,211,223,132, 16, 18, 69,  8,
+ 25, 58,123,246,236, 57,213,251,102,207,158, 61,135, 16, 50,176,250,184,170, 99,106,206,169,222,247,248,251,227,251, 26, 58,182,
+129, 34, 78,120,108,187,230,243, 63,197, 71,203,  6, 27,108,176,193,  6, 27,108,176,161, 78, 84,175, 24,172,101,109, 82,  1,184,
+179,116,233,210,178, 90,190, 83, 42,  0,183,  0,116,170, 58, 78, 85, 37,210,106,251, 86,153,170, 62,155,234, 56,198,100,201,177,
+245, 96, 83, 61,219, 54,161, 85, 31, 58,121,243, 22,  7, 52,247,138,168,186,  0, 32, 85, 73,128,185,170,120, 69,164, 58,112, 17,
+199,129, 16,  2,185,178,252,250, 29, 37, 62,111,234,239,  5,249,194,205,203,206,110, 53, 71, 72,175,170, 93,231,212, 37,198, 79,
+146, 52, 40,183,148, 35,184, 25, 66,236,120,152,201, 17,116,  4,  0, 30,133,219,  6, 14, 95,167, 22, 89, 31, 79,170,174,126, 30,
+230,137,  9, 98,123,233, 43,206, 46,174,109,203,202,138, 51,204,  6,227,190,100, 21, 54,162,  9, 14,182,129,174,120,150, 35,248,
+ 12,  0, 79,200,195,202,140, 82,139, 87,114,216, 96,131, 13, 54, 60,169,117,228,137,226,226, 81, 20,197,214,193, 73, 61, 33,167,
+109,161,130,  5, 98,171,142,221,191,215,177,239,234, 63,169,220, 86,  9,173, 80, 79, 76,  6,133,133,  0,  8,  8,190, 72, 86,225,
+  7,171,206,247,193, 32, 59, 62,127, 11,  0,190,193,204, 78, 39, 28, 18,234,108, 76, 30,250,216,137,248, 43,  1,112,  6,150,125,
+ 39, 89, 97,185,191, 88,152, 31,134, 10, 56,222, 47, 28, 33, 66,150, 35,219, 64, 16,227, 32,194,197,203,  5, 48, 88, 83,214,128,
+230, 94, 17,135,127, 87, 12,142,251, 97, 42,186,119,108,  3,194, 50,  0, 71, 67,218,123, 38,126,251,246, 13,116, 15,  9,  0,225,
+104,128, 99,224, 48,236, 27, 12, 11,119, 38,119,148, 77,203,131, 29,228, 11,183, 22, 30, 94,119, 55,111,222,226,237, 27, 24, 74,
+113,140, 25,105,191,159, 30,247,241,172,249,  3,194,160, 14,183, 68,108,117,244,193,187,  1, 45,219,207,252,100,225, 42,190,143,
+175,191,140,163,141, 76,225,131,148, 46,107, 87,204, 63, 32,226,229,172,188,173,192, 22, 75,251,114,168, 39, 38, 10, 36,226,209,
+246,118,178,182, 58, 93,197, 61,214, 76,239,227,  9,  5, 67,191,254,102,117,231,126,145,195, 29,216,138, 66, 30,205, 33,116,239,
+158,221, 45,190, 91,183,126,248, 93,  5,251, 60,  0,206,154, 58,115,  4,179,210,183, 79, 24, 46, 20,240,169,144,183, 55,243,  1,
+166, 73, 66, 43,196, 11,175, 82,  4,141,134,151, 32, 20,206,167, 40,177,171, 41,191, 17,236,133, 31, 41,130, 32, 80,216, 79, 17,
+236, 78, 86, 65,105, 27,242,108,176,225,191,  5, 30,143, 23,199,113, 92,255,167, 44, 12,158, 37,132, 92,182,181,238,255, 54,172,
+179,104, 81, 88,146,148,153,231, 10,214,140,176,160,192,197,128,117, 66,203,142,207,223,118, 53,163,200, 27,140, 25,155,191,124,
+127,143,137,  6, 24,218, 12,150,161,193, 50, 52, 24,198, 12,150,166, 65,104, 35,230,255, 20,  7,152, 42, 16, 17,222,110, 27,192,
+250, 88,250, 27, 66,194,251,229,250,133,211,110,148, 73,141, 93, 63, 44,253, 48, 79, 85,249,225,153,219,242,226, 80, 47,253,156,
+100, 37,126,182, 70, 16,196,109,152,138, 29,135,142,231,175,249, 81,155,202, 17,  2, 55, 39,251,246,227,162,147,252,183, 31,137,
+203, 91,189,205,144, 10,  0,206, 50,113,251,241,183, 51,  2,158,228, 34,120,217,217,173,222,184,254, 59,111, 31,119,123,138,185,
+180, 12, 12,203,194,191, 69, 20,127,206,148,113, 62, 75,190,221,242, 45, 52,198, 55, 27, 58,191,189, 23, 66, 91,182, 10,153,190,
+237,248,165,  0,173, 70,105, 58,189,243,179, 76, 24, 65,123,251,133,  8, 23, 47, 93,197,159,251,233,212,105, 38, 54,255, 74,154,
+ 18,201,141,141, 53, 33, 94, 56,178,116,217, 55, 29,  7, 12,139,118,224, 42, 85,124,131,182, 50,104,243, 79, 91, 22,  6,119,236,
+ 38,237, 29,222, 92,164,220, 55,137,210, 87,148,194,204,179,147, 12,  8, 27,228,164,127,125, 44,189,121,235,142, 41,201, 74,172,
+181,166,206, 44,249,163,239,113, 92,211,163,174, 83,  4,189,111, 94,142,155,200,202,175,130,176, 52,192,154,107,222,193,210, 32,
+220,195,247,238,147,126,  2,208, 52,161,197, 35, 24,124,230,194, 85,159,162, 66, 69,215,111,191,249,106, 14,185,122,245, 87,176,
+248, 37,165, 20,231,172, 21,152,  0,130, 90,187,243, 79,209, 44,140,121,229,108, 80,245,206,  1, 65,146, 30, 62, 14,212,192, 92,
+ 53,149,112, 62, 83,127,206, 54, 52,217, 96,195,255,139,197,132, 33,132,  8,158, 50,231,112, 66,200,137, 39,164,153,  9,224,221,
+170,237, 45,  0,190,126, 10, 69,107, 14,192,187,106,187, 16, 64,190,173,  7, 60, 17, 30,119,126,111,114, 28, 45, 59, 16, 14,216,
+255,  2,  0,216, 91, 91, 10,  2,216,129,226,  3,180, 22, 35,135, 69,194,195,203, 27,160,117,128, 89,  7,208,122,128,214,  2,180,
+ 30,197,138, 28,192,172,  5,178,126,  5, 67,136,196,234,234, 26,213, 64,250, 62, 12,236, 18,  0, 79,103, 59, 76, 29, 25,234,177,
+233,100,250,150, 45,167,211,  6, 37, 43,241,138, 69,101, 37,  4,221, 59,180,197,154, 45,218,212, 99, 55, 84, 67,  0, 96,120, 39,
+247,147,221, 67, 91,248,175,222,102, 72, 61,113,167,108, 40,  0, 12, 13,115,250,181, 91,123,159,  0,238,  9,194,211,112,132,244,
+246,109,217,150, 98,111,110,  4,167,201,135, 70,163, 71,254,131,237,112,245,123,134,199,114,232,219,216,249,246,124,204,254,104,
+238,114,161, 78, 83,100,226,204, 42,214,147, 95,198, 23,136, 57, 10,  5,231,140,149, 92, 57,251,201,132, 55,152,233,159,127, 57,
+ 27,192,184,134,120, 66,189, 48,101,229,202,213, 29,122, 70,  4,123, 21, 30,152, 74, 85,150, 21,129,225, 75, 37, 35,159,235,  9,
+151,118,161, 92, 81,252, 74, 74, 28, 56,  8, 46,238,129, 40,184,180, 19,217,151, 15, 82,189,186,140,146,252,188, 75,244, 58, 96,
+174, 83,104,181,245, 64,175, 33,125,186,237,  9, 12,240,245, 33,132,  3,199, 17, 16,142, 69,165,129,198,156,189, 89, 96, 89, 22,
+ 47, 13,233, 53, 80, 38,166,  8,199,113, 32,132, 67, 94, 97,137,238,236,149,212,129, 89,101,184, 98,137,165,170,211,179,253,123,
+221,190,126, 57,152, 78, 63,134,136,113, 75, 83, 41,224, 66,173, 62,215,235,198,169,159,131,129,159,154,174,229, 40,176,217, 39,
+151, 33,160,207,  4,254,198, 93, 39, 61,213,170,130,241,  7,182,175,127,249,135,141, 27,119,164, 42, 49,201, 26,145,245,113, 31,
+241,133,111,207,106,220,159, 11,148,169,242,106,217, 41, 91,187,242,134,108, 56,145,252, 81,226,162,238,193,115,143,147,242,132,
+ 76,195, 29,219,184,101,131, 13,127, 47,  8, 33, 79, 93,108,229,228,228,200,159, 68,108,249,249,249,245, 41, 40, 40, 88, 81,237,
+173, 66, 81,212,138,150, 45, 91,206,255,227, 65,245,145,103, 61, 53,203,178,227, 10, 10, 10, 18, 26,226,140,138,138,242, 61,126,
+252,120,171, 90,156,173,  0,180,170,235, 88, 23, 23, 23,182, 71,143, 30,217,199,143, 31,151,219,122, 72,147,  4,151,213, 66, 43,
+ 53,119,223,212, 46, 70, 69, 37,  0,164, 90,112,252, 35, 83,126,  6,154, 93,182,117,225, 27,203,194, 90,186,161, 66,107,194,233,
+107,217, 96, 89, 26, 44,195, 84, 89,182, 24,176, 12,141, 33,157, 60,208,195, 48,  9,107, 99,210,192,176,220,210,134, 56, 31,135,
+153,112,175,118, 30, 52,102, 47,199, 17,177, 68,200, 83,  7,249,187,123, 77,127,169, 19,111,234,200, 48,232,205,204,152,157,241,
+153,103, 83,148,216,108, 17, 39,247,231,240, 68,164,174,125, 44,211,104,221, 27,176, 70,117, 31,212,175,183, 19, 49,170, 65, 23,
+103,161, 66, 71, 35,171,132, 70,161,161, 28, 18, 74, 97, 17, 39, 71,208,177,185,159,143,244,226,158, 79, 31,184,243, 53,  2, 47,
+ 62, 35, 18,243, 24,176, 28,225,147,242,100,163, 91,112,164,176,218,111,171,161,114,218, 75, 29,223,232, 51, 56,202, 57,119,231,
+  4,202, 62,104,  8,188,186,248,227, 65,194, 86, 40,175,197,160, 68,158, 77, 57, 25,202,209,204,189, 13,134,141,123,  5, 95,191,
+210, 21, 21,154, 10,240, 21,153,206, 98,161,196,  5, 48,215,201, 73, 88,140, 91,185,252, 75, 31,  1,159,247,176, 61,171, 95, 44,
+ 13,189,209,  8,176, 12,236,  4, 28, 40, 82,253, 29, 13,150, 54, 75, 59,142,250,244,125,128,189,210, 88,221, 83,148,216, 21,234,
+137,222,224,232, 96, 66,235, 65,  1, 23,146, 85,127,136,159, 16, 47,188,250,204,144,183,122, 19, 10,231,155,114,141,194,221, 17,
+ 29,209,202, 65, 38,211,164, 34,127,255,135,200,132, 29,105,214,243, 93,188,250,246, 20,233,166, 77,155, 70,  0,100, 50, 30,245,
+ 81,171,225, 12,110,198,159, 72,179,152, 15,  0,122,154,108,117, 20, 83,111,175,220,157,232, 14,254, 31, 25, 30,170, 45, 89,153,
+ 37, 92,153, 57,110, 94,218,179,211, 99,250,117,184,217, 47,143,162, 36,185,231,238, 25,213,214,244, 37, 43, 97,227,180,113,254,
+229,156, 78, 78, 78,173, 91,182,108, 57,159,166,233, 62, 34,145,168,153,217,108,  6,199,113,133, 98,177,248,124,118,118,246, 34,
+141, 70,115,255,159, 86,247,219,183,111, 91, 35,182, 26,229, 20, 10,133, 72, 75, 75,187,103,133,216, 58,243,216,249,191, 92,184,
+112,  1,123,247,238,  5,  0,164,167,167,163, 93,187,118,178,186, 78,124,240,224,129,172, 95,191,126,191,  0,240,111,136,243,206,
+157, 59,173,143, 29, 59,134,253,251,247,  3,  0,210,210,210, 16, 20, 20, 84,103, 97, 46, 92,184,192,127,237,181,215, 90,  3,144,
+255, 13,215,232,191, 32,178,106,191,255, 33,180, 98, 98, 98, 72,116,116, 52,245,248,118, 29,200, 10,112, 21,119,129,129,  5,128,
+ 44,107, 75,144, 82,132,229,107,182,159, 26,250,219,254,117,125,236, 68, 60, 44,216, 60, 61, 79, 85, 90,241,172,128,122, 56,253,
+194, 16,240, 92, 29,196,137, 75,199,119, 10, 40,171, 52,224,232,239,  5,  9,201, 74,235, 76,164,201, 10,196,  2,156,203,195, 79,
+ 44, 12,122,101,208,248,175, 99,119,239,158, 61,180,227, 39, 35, 59,226,200,165,236, 79,  0,166,209,168,239,132,227, 64, 56,166,
+198,249,189,234,209,  1,224, 30, 77,224,203,129, 60,220,199, 89,103,209,234, 11,  8,202,188, 48,204, 81, 42,254,126,226,196,247,
+156,104, 85,  6, 74, 77, 34,228,149, 25, 80,168, 23,162, 82,224,133,130,212, 59, 44,143, 66,108,163, 38, 23, 10, 26,194, 24, 92,
+ 92,197, 14,188,240,200,247,253, 52, 39, 63, 43, 19, 83, 12,223,233,197, 37, 46,197,191,173,202,102,180, 42, 45, 69,161,209,240,
+243,206,206, 46,237, 12, 37,217,124,117, 89, 49, 92,188,195, 48,116, 76, 52,190,136, 10, 69,133, 70, 11, 85,105, 34,105,235,227,
+ 68,229,156,223,129,185,195, 66, 80, 82,164,128,145,  6, 40,173,177,212, 96, 50, 84,214,219,142, 60,108,252,120,198,172, 87, 91,
+248,120,202,170, 23, 21, 16,142, 69,167,144, 64, 68,246,233,142,216, 11, 23,113,245, 78, 58,184,170, 69,  5,132,227,144,175, 44,
+ 43, 50,152,217,173, 86, 53, 40,203,128,208,134, 58,133, 24,154, 48,101, 24,238,  5, 41, 11,124,222,181,181,227, 59,179,163, 91,
+ 56,202, 36, 20, 12, 52, 11,131,137, 70,197,197,239,225,222,178,  3,164,118,118, 84, 23,232,  5, 55, 80,119,219, 26,104,204,191,
+175, 40,247, 65,101, 33, 94,139, 12,251,104,219,210, 15,100,148,221,195,174, 73,179,143, 90,178, 46, 46,236,122,234,181,197,135,
+227,246,238, 27,235,251,245,204, 55,250, 13,153,182, 53, 14,192, 73,219,184,101,195,191, 17, 47,191,252,178, 93, 81, 81, 81,188,
+191,191,127,104,100,100,164,180,119,239,222,208,106,181, 56,125,250, 52,180, 90,109, 11,127,127,255, 22,167, 79,159, 30,149,155,
+155,155,220,188,121,243,126,251,247,239,183,216,135,182, 74,  0,241,107,134, 96,128,161, 40, 10, 85,251,168,170,125, 77,206,115,
+ 43, 22,139,145,147,147,243,212, 45, 91,  5,  5,  5,247,154, 98,217,170,172,172, 20,249,249,249,193,211,211, 19, 44,203, 66,171,
+213,226,240,225,195, 80,171,213,224, 56, 14,246,246,246, 88,178,114, 51, 82,111,196,227,202,149, 43, 80,171,213,162,198, 56,243,
+243,243,169, 78,157, 58,193,104, 52,130, 97, 24, 24, 12,  6,156, 57,115,166,230,179, 64, 32,192,172,197,223, 34,253, 90, 60,110,
+222,188,137,252,252,252,191, 37,219,136, 21, 90,228,159,136,122, 99,102,253,237,171, 14, 89,150,153,179,105,219,238,196, 57,147,
+ 94,193,148,177,131,252, 23,173, 59, 56, 40,165, 24,219,  0, 32,196,  3,227, 95,239,223, 54,192, 69, 42,196, 23, 59,175,  1,132,
+204,121,210,223, 75, 42, 69,122,104, 51,238,147, 67, 87,114,226, 63,123,165, 11,  2,125,156,218,149,137, 75,197, 89, 89, 22,228,
+ 20,228, 24,184, 58, 72,218, 15,239,228,126, 18, 28,  7, 23, 71, 73, 48, 88,  6, 46, 14,146,246, 67,195,156,126,  5,  0, 39,169,
+ 48,184, 46,203, 87,125,136,240, 23, 78,144, 74,  4, 19,100,142, 46,  1,111,142,136,180, 31, 62, 98,148,189,131,144, 65,201,149,
+211,208,  8,155,131,118,107,  1, 35, 93,138,252,251,153,236,111,151, 83, 10,138, 43,140,211, 27, 45, 38, 65, 66,193,253, 52,207,
+214, 29, 35, 93,139, 99,230, 42, 91,191,181,179, 21, 15, 28,175, 98,199,139, 69, 50,175,110,246,191,103,221,175,228, 72,157, 22,
+157, 71,160, 81,171,179,105, 22, 62,122, 86,224,152, 25,247, 51,102, 15,235,128,178, 82, 37, 12,102,  6,106, 61, 99,246,118,177,
+147, 24,239,223,133,209,204,192, 68,115, 16,186,248,225,116,226,157, 98,142,166,127,173,143, 51,171,  4, 55,179, 14,223,116,168,
+189, 47,208,  3,157, 62,117,178,191,  9, 90,143,156,124, 57,182, 29, 79,236,146, 85,130,155, 79,114,157,  9,199, 60,156,126,174,
+101,201,162,  8,122, 55,197,  9, 62,216, 11,221, 68,118,162,239, 86,124,242, 90,232,115, 65,110, 18, 46, 63, 17, 20,103,134,140,
+ 21, 64, 47,102,225,236, 31,  8,206, 84, 65,116,  6, 67,121, 18,208,208,197,231,  3,  0, 49,107,241,245, 27, 97, 50,202, 53, 16,
+108,214, 73,  8, 58, 79,  0, 93,101,237,207, 44,225,238,152,227,230,165,246,152,113,172,239,226,216,254, 41,242,227, 11, 82,252,
+ 94,254,190, 19,176,181,165,237,118,109,195,191, 17,237,219,183,247, 46, 40, 40, 72,154, 49, 99,134,219,139, 47,190,136, 67,135,
+ 14, 65,163,209, 96,235,214,173, 88,189,122, 53, 22, 46, 92,  8,154,166,177,105,211, 38,233,129,  3,  7,186,173, 95,191, 62, 63,
+ 32, 32, 32, 44, 55, 55,183,176, 17,129, 69,  1,144,  0, 16, 86,221,187, 40,  0,220,137, 19, 39, 48,124,248,112,156, 56,113,130,
+171,218,199,226,225,195, 79,147,114,127,138,197, 98,136,197, 98,168,213,234,167, 34,182,132, 66, 33, 28, 28, 28, 32, 22,139, 81,
+ 81, 81, 97,181,216, 98, 24,134,159,159,159, 15,181, 90,141,200, 17, 35,240,237,210,165,232,223,191, 63, 34, 35, 35, 65,  8,193,
+153, 51,103, 48,168,103, 56, 94,121,190, 31, 82, 82, 82,192, 48,140, 69,229, 45, 44, 44, 68, 81, 81, 17,134,142, 24,129,205,235,
+215,163,123,247,238,104,223,190, 61, 24,134, 65,124,124, 60, 94, 30,210, 19,118, 47, 12, 66,122,122,186,173, 83, 91,110,205,122,
+ 42, 62, 90, 79,140, 36, 21, 46,115, 71,206,197,140, 29,210, 45,122, 68,175, 80,108,222,243,219,151,240,212,236,  6,  0,119,163,
+100,201, 27,253,  3,145,156, 91,134,223,110,202, 99, 82,138,241, 84, 86,107,112, 44, 60,220,157,164,  0, 95, 12,189,153, 99,156,
+178, 26,119, 96,230,  8,129,180,207,167,120,125, 68,178,127,247, 80,127,255,234, 85,135, 14,195, 87, 97,252,157,123,  1, 93,219,
+123,  7,128,165,  1,150,134,211, 43, 59,129,197,178, 70,203,209,179,149, 56,246,227,169, 83,123, 12,123, 97,140,189, 88,234, 12,
+ 86,147,  7,186,240, 14, 74, 50, 18,160,149,182, 67, 97, 78, 22,246,158,186,162,206,200, 47,209,240,120, 56, 93,164, 54,206,204,
+ 42, 67,101, 99,188,  6, 26, 75,231,207,157, 30,181,119,247, 30, 71, 73, 96, 47, 42,243,251,225,106,177,128,145,120,182,122,134,
+167,179,243, 32, 95,109,221,227,164, 53, 97, 89, 99, 60, 58,173,230,224,153,211, 39, 95,105,219,186,151,227,131,171,199,161, 55,
+ 24, 97,164,129,176,110,253,192,178, 68, 76,241, 40,206,137,207,167,148, 37,101,160,104,182,232,252,173,  7,138, 11,183,178,248,
+ 70, 71, 44,107, 48,186,200,227,234,158,226,127, 52,162, 95,103,128,214,227,249, 62, 29,240,237,142,223, 62,  4,216,183,158,236,
+ 34, 63,180,104, 17,160, 87,168, 39, 54, 16,130, 94,215, 14,175, 14,142,120,225, 99, 88, 99,209, 10,243,192,176,144,214,190, 63,
+127,187,228, 83, 55,247,230,237,248, 20, 71,131,120,119,  4, 52,249,132,202, 79,132,179, 95,119,176,190, 61,177,105,237, 55,149,
+ 28, 71,118,163,129,208, 22, 44,  7,112,185,231,192,166, 30, 66, 86, 86, 22, 60, 90, 92,  3, 40, 30, 72,203,  7, 48, 51, 15, 79,
+ 51,154,201,241, 53, 91,143,245,159, 57, 96,105,216,136, 96, 65, 64,226,173, 76,229,152,183,125,165,207,  6,240,131,146, 21, 50,
+ 94,177, 86,203,217,198, 47, 27,254, 77, 48, 24, 12,  7,151, 47, 95,238, 22, 29, 29, 93,109,145, 65, 98, 98, 34,182,108,217,  2,
+153,236,209,113,114,248,240,225, 32,132,184, 45, 88,176,224, 32,128,231,234,227,236,209,163,199,136,155, 55,111,202, 59,119,238,
+156, 85, 37,182, 68,  0,120,119,239,222,229,229,229,229, 81,174,174,174,196,215,215,151,150,203,229, 28,  0,246,237,183,223,230,
+239,219,183,175,173, 86,171, 61,215, 84,161, 37, 22,139,159,138,207,150, 80, 40,  4, 69, 81, 16,139,197, 16,137, 68, 32,132, 88,
+ 37,182, 88,150, 21,156, 56,113,  2,215,174, 93,195,194,206,157,241,137,159, 31,220,220,220, 16, 31, 31, 15, 66,  8,100, 50, 25,
+ 74, 75, 75,177,123,247,110, 12, 24, 48,  0, 12,195,136, 44,225,221,191,127, 63,174, 95,191,142,197, 17, 17,248,196,217, 25, 14,
+ 14, 14, 56,115,230,225,108,160, 68, 34, 65, 78, 78, 14,206,156, 57,131,126,253,250,217, 58,245, 19,194,226,206,211, 23, 16,148,
+ 82,240, 54,155,244, 32, 12,  1, 40,248,134,132, 64,148,146,242,168,115,142, 37,224,241, 48,119,237,182,152,168, 85, 31,143,160,
+ 38,140,236,226,187,232,231,184,201,  0,240,206, 75, 65,126, 82,137,  0,107,142, 36, 19, 30, 15,115,159, 70,  5, 67, 66, 32,162,
+ 74, 48, 57,178,123,123,200,203, 77,200,148,151,159, 77,  1, 44,202,226,252,219,170,215,177,253,104,124,222,234,237,134, 84, 66,
+  8, 92, 28, 36,237,199,223,206, 12,248,249,196,245,220,149,123, 13,169,132, 35,112,145, 10,131,223, 74,233,217,232,170,195,  8,
+127,225,132,105,211,167,247, 28,249,214, 12, 59, 38,117, 31, 76,153,167,192,153,245,208,152, 69, 40,231,123, 35, 63, 55, 23, 95,
+109,138,201,211,104, 77,175, 36,169,172, 19,152, 25, 37,168, 20, 80,154, 23,191,250,226,179,216,165, 75, 22, 56,232,179,226, 43,
+249, 20,163,231,183,236, 43, 88,178,112, 21, 85, 97, 52,141,201, 42, 67, 69, 99, 60, 70, 71, 44, 91,190,114,109,212,123,227, 70,
+165,  6,181,235,235,206,202,239,187, 27, 52, 26,229,206,147,215,189,171,158, 20, 41,  0,200,204, 47,129, 74,173,101, 88,134, 62,
+231, 40,196,162,100, 75,172,131, 85,104,237,  5,207,232, 94, 97,175,121, 58,138,160,175, 44,135,151,163, 16, 67,186,183,121,141,
+254, 61,253,211,251, 74,107,228,218,227, 66,139,  6,161,245,184,188,108, 64, 48, 97,233, 96,176, 52,204,183,127,177,222, 50, 70,
+225,147, 41,125, 28,156, 92, 77, 15,120,208,202,  0,123, 15, 80, 78, 45,  0,231, 86,148, 48,100, 12,228, 89, 73,204,135,175,141,
+ 43,185,159,157,255,163,135,125,195,211,218, 52, 71,192,101,199,163,178, 40, 19,119,229,102,132, 41, 31,206,182, 59, 21,221,  0,
+107,139,152, 99,195,127, 20, 57, 57, 57,111,204,153, 51,231, 66,247,238,221,155,121,120,120,160, 67,135, 14, 56,122,244, 40,102,
+204,152, 81,115, 76,231,206,157, 65,  8, 65,105,105, 41,150, 47, 95, 94, 40,151,203,223,104,240,  1, 61, 41, 41,117,251,246,237,
+125, 66, 67, 67,205, 34,145,168, 28,128,164,188,188,220,174,180,180,148, 50, 24, 12,224, 56,142,115,118,118,102,229,114, 57,253,
+202, 43,175, 24, 47, 93,186,212, 70,171,213,230, 60,137, 69,203,223,223,255,110, 73, 73,137,154,162,168, 39, 14,253, 80, 45,178,
+ 60, 60, 60, 60, 43, 43, 43, 57,  0,101, 77,  9,253,192, 48, 12, 34, 34, 34,112, 42,225,  6, 78,252,118,  9, 26,121, 26, 38,191,
+247,  6, 58,116,232,128, 83,167, 78, 53,249,154,117,234,212,  9, 39,207, 92,192,133,107,183,144,147,126, 27, 31, 78,126, 15, 97,
+ 97, 97, 56,121,210,230,189, 96,  5,142,227, 81,223,172,227,143, 11,173,126, 49, 49, 49,213, 67,255,159,228,107,176,  7, 58,  9,
+ 93,196,191, 44, 24,214, 38, 68, 24,185,  0,148,208, 30,251,218,157,236, 57,247,171,239, 83,249, 94, 57,227,238, 42, 27, 95, 29,
+246,200,159, 70,137, 36,114, 37,117,215,173,148,224,215,158,239,238,143,205, 71,165,159,  3,192,152,222,173,241,123,134, 10, 87,
+210,149,187,146, 85, 72,122,210, 90,135,123, 65,202, 22, 99,215,242,143, 70,246,107,209,220, 27, 91, 14, 93,  0, 69,225,160, 69,
+ 55, 92, 66, 72,247,208, 22, 88,189,253,241, 21,134,222,  1, 43,247, 26, 82, 79, 39, 85, 12,  3,128,200, 96,233,175, 93,219,184,
+  6,144,218,142, 91,117,192, 94, 44,152, 56,108,212,235,118, 76,250, 81, 32,251, 12, 40,198,  8,189,153,131,162,184,  2, 58,103,
+127,196, 39,222,210,171, 13,166,143,147, 85, 77,179,226,165, 20, 35, 75,116,245, 86,110,165, 86,239, 35,245,108, 99,224,243, 56,
+174,210, 72,240,123,114,182, 38,185, 16,105,150,112,100,101,193,244,172, 31,211,123,195,182,189,243,133, 34,241, 24, 62,  5,202,
+203, 69,230,185, 97,213, 98, 56, 58, 58,128, 51, 85,  2, 90, 21, 94,252,224, 43,213, 93, 57,221, 26,  0,218,185,195,161,119,107,
+225, 54,  1,143,202,143,203, 52,207,107,236, 55, 40, 26,147,198, 13,233, 44,228, 76, 90,124,180,124, 15, 54,126, 58, 18,175, 15,
+ 12, 17, 30,191,152, 62,  9,192,162,166, 94,107,194, 50, 32,180, 30,207,125,150,144, 74,  1, 23,  8,208,235,218,222, 37,193,192,
+ 13,139, 57,186,  0, 66, 86, 64,133,116, 12,144,137,184,252,139,224,242, 47, 18,190,127, 79, 80,  1,125, 40,202, 59,130,124,183,
+ 98,161,118,243,230, 45,167, 57, 30,190,176, 32, 84,  6, 88, 14, 40, 78,191,  0,147,201,  4,154,  5, 12,  6,  3,180, 90, 45,100,
+153, 39,107,124,180, 68, 66,106,232,212, 55, 71,116, 34,149,114,221,177, 84, 38,119,203,123,193,207,145, 74,185,238,114, 46,155,
+ 94,172, 53,218,172, 89, 54,252, 27,145, 37,151,203,135, 14, 31, 62,252,183, 83,167, 78,185,133,135,135,  3,  0,174, 93,187,246,
+240,161, 51, 34,  2, 65, 65, 65, 40, 42, 42,194,216,177, 99,139, 21, 10,197, 80, 52,226,243, 91, 81, 81,113,127,255,254,253,205,
+180, 90,109,231,121,243,230, 41, 91,180,104,161, 49, 24, 12, 84,121,121, 57,199, 48, 12, 92, 93, 93,197,157, 59,119, 70,143, 30,
+ 61, 42, 19, 19, 19, 91,230,229,229, 85,  0,200,110, 74,225, 71,142, 28,137,132,132,135,139,246,158, 70, 92, 45,145, 72,132,240,
+240,112,191,172,172,172,130,170,123,139,213, 99,124,237,219,203,173, 91,183,112,238, 70, 62,  4, 38, 61,196, 42, 57, 46, 31,218,
+143, 17, 19,223,  7,195, 52, 61,183,252,173, 91,183,112,248,204,101,200, 36,  2,164,165, 37, 97,255,254,253,152, 60,121,242, 19,
+113, 54, 17, 13,106,145,127, 56, 20,168,199, 79, 75,  0,  0,209,209,209,231,170,173, 21,181, 17, 24,  8,177,164, 18, 11, 34,187,
+248,205, 26,211,171, 13,159,214,200,193,177, 28,248, 66,192,203,195,  9,191,252,178,171,245,174, 61,123, 18,215,175, 91,191,150,
+ 99,152,185,119,149,208, 89, 81,168,  5,171,246, 92, 24,243,203,244,126,130,201,195,130,221,  0, 64, 36,224, 97,205,209, 36,  6,
+192,130, 39,169,237,179,126,197,208, 97,164,  0,  0, 32,  0, 73, 68, 65, 84,176,171,164, 49,193,203,221,249,243, 57,239, 70,185,
+245,139,  8,194,185, 43,119,177,118,127, 98,130, 88,137,237, 22,119,110,142,198,227,250,169,174, 85,135,224, 26,247,187,100, 89,
+226, 45,146,185,194,156, 29,  7,152, 13, 48, 24,205,200, 43, 97,145, 87,106,128, 64, 42,194,181,244,124,189,123, 33, 98,158,160,
+218,148, 76,106,231, 59,255,203,149,205, 13,250, 74, 70, 83, 86,204,136,196,151,133, 82,123,137,194, 26, 87,133,203,  5, 48,244,
+105, 37,124,  6,224,248, 98, 59,162,251,108,218,155,178,130,228, 83,104,203,147,131, 34,  4,246, 33, 81,112,180,231,139,122,181,
+ 20,230,  2,128, 76, 38, 21, 47,255, 98,134,243,199,159,126,209,168, 15, 88,  8, 32, 10, 10,244,254, 56,188,133, 43, 18,174,167,
+ 34,225, 78, 78, 82,194,181,180,176,254, 29,124, 17,212,220,101,170,184,172,124, 89, 10,172,183,144, 62,188, 48, 12, 64, 27,106,
+ 86, 29,134,120,225,213,174, 99,230,213,183,218,176, 78,180,  2,184,116,150,128,226,243,  1,138,247,112,  5,100,222, 69,  8, 92,
+  2,201,174,189,135,117, 91,182,108, 95,156, 82,108,249,226, 12,154,  5,171,209,104, 32,147,201,112, 50,157, 49,190, 62, 68, 36,
+225,241,120,200, 75,191,241,135, 51,188, 27, 47, 84,212,127, 73,240,197,133, 93, 79, 57,138, 41,137,111,212, 23, 33,204,157,237,
+249, 77,189, 73,216, 96,195, 63,  1,106,181,250,118, 74, 74,202,144,142, 29, 59,110,253,232,163,143, 28,199,141, 27,231,251,222,
+123,239,241,  0,160,168,168,136, 91,189,122,181,252,187,239,190, 83, 23, 23, 23,191, 69,211,180, 37,161, 76,136, 66,161,184,244,
+227,143, 63,170,206,159, 63, 31,214,173, 91, 55,201, 51,207, 60,195,185,186,186, 10, 36, 18,  9,107, 50,153, 12,233,233,233,108,
+ 86, 86,150, 79,121,121,249, 61,  0,153,104, 66,198,138, 42,235,213, 34, 62,159, 63,159, 16, 18,254, 52,124,180,164, 82,169, 47,
+128,123, 20, 69,181,181,118,218,240, 79, 55,108,129,  0,101,101,101,208, 21, 38,193, 46, 63,  3, 29,101, 60,132,186, 58,192,201,
+201,233,137, 68,145, 90,173,  6,180,  5,184,112,225, 22,192, 48,112,118,118,134,179,179,243,223, 46,180,234,211, 34,255, 18, 76,
+168, 99, 95,195, 62, 90,161,158,152,108,111,194,234,137, 81,109, 68,173,  2,154,195,152,127, 13,183,242, 42, 49,247,217,110,201,
+124,137,163, 97,226, 27, 35, 35, 70,189,220, 18,253,122,116,165, 90,249, 56, 79, 93,182,234,135, 15, 66, 81, 60, 35, 89,137, 53,
+150,148, 40, 89,133,251, 28,148, 91,226,110,231, 79,106, 46,213,131,227,  8,226,238, 40,112, 39,187,108, 75,170, 10,247,173,169,
+ 93,168, 15,  6,  9,192,219, 67,  8,177,115,150,201, 42, 66,131,154,123, 12,122,174, 19,111,104,223,  8,136,248,192,133,223,111,
+225,147, 85,  7, 47,115, 28,137,186, 97,225,180,225,195, 21,134,143, 10,168,135, 43, 12,233, 71, 86, 24, 18, 66,200,195, 85,135,
+ 13, 27, 31,248,124,170, 80,151,115,213, 91,232,222, 14,250,204, 56,100,151,113,200, 81, 86, 64, 35,240,134,177,160,  0, 32, 92,
+238,185,134, 29,171, 27,132,135,135,135, 87,235,208,160, 54,223,111,219, 15,179, 78,141,251,241, 91, 81, 89,166,192,146, 13, 71,
+219,248,249,185,247, 45, 40, 40, 56,103,197, 96, 19,244, 91,204, 46, 47, 16,128, 47,148,224,248,250,189, 40,118,183,135,135, 84,
+  4, 78,175,194,196,143,199, 57, 15,139, 28,231, 12,  0, 57,105, 55,209, 66,170,183,136,215,236,142, 81, 99,250,183,119,  1,173,
+199,182,147, 55, 13, 60, 96,232,246,211, 73,153,253,131, 93,236,198,244,106,225,186, 72, 94,254, 18, 74,154, 22, 84,180,218,162,
+ 85, 99,225,107,194,106,195,253,  0, 27,204, 33,115,207, 37,165,236,229,200,103,164, 34,  1, 69,145,202,  2, 16,123, 15,252,176,
+109, 95,165,152,182, 46, 19, 59,  7, 44,234,190,244,254,252,135,253,  4, 91,135, 45,189,246,110,236,231,207,122, 22, 22, 22,194,
+ 92, 53,119,120,191,148, 59,251, 70,100, 40,155,175,230, 76,167,151,189,248, 50,101,239, 41,158,249,245,246,120,  2,216,162, 73,
+219,240,175,134, 94,175,191,174,215,235, 59,204,156, 57,243,213,207, 62,251,172,143, 76, 38,107, 13,  0, 90,173,246, 62, 77,211,
+  9, 85,255, 79,107, 86,  7, 18,  0,247, 50, 51, 51,239,103,102,102, 54,219,177, 99,135, 11,  0,187,170,239, 12,  0,202,  1, 20,
+225,  9, 86, 28, 86,139, 42,138,162,230, 63,173,118,168, 22, 85, 20, 69,181,109,202,249, 60, 30,143,165, 40, 10, 20, 69, 65, 34,
+145,224,252,249,243, 24, 29, 21,137,148,227,229,  8,119,113, 64,183,183, 38, 98, 79,108, 44,248,124, 62, 40,138,  2,159,207,183,
+234, 62, 34, 16,  8,112,225,194,  5,188, 62,246,101, 72,  4,128,179,179, 51,102,206,156,137, 35, 71,142, 64, 32,176,101,233,179,
+  2,155,106,  9, 46, 11,227,104, 81, 88, 20,187,245, 43, 17, 88, 26,199,182,126,131,152,255, 99,239,188,195,162,184,218, 40,126,
+166,108, 99, 89, 58, 75, 47, 34, 17, 16,197,222,149,168,177, 37, 17, 99,139, 45, 49,182,168,196,104,212,152,216,141,198, 24,187,
+ 17, 99, 47,201,103,239,198,130, 73, 84, 18,123, 65,197,  2, 34, 32, 40, 74,239,157, 93,182, 76,249,254,160,  4,148,178,139,166,
+153,249, 61,207, 60,179,101,246,236,204,220,221,185,103,222,123,239,123, 35,138,180,209,153,152,231,147,137,160, 35, 40,228, 50,
+191,219, 29,120,238, 74,196,170,177,195,  2,228,111,117,239,133,183,186,117,167,155,182,237,186,  0,168, 98,180,122,162,150, 92,
+ 27, 44,135,111,182,253, 26, 53,241,224,133, 24,  2,186, 66, 12,235,221,150,103, 57,124, 83,199,193,188,160,105, 97,162, 56,120,
+229,250,117, 43,232,138,240,244,238,239,178,  6, 13,223,  0, 88, 29, 98, 99, 31, 97,253,174,159,184, 11, 55,163,247,104, 25,124,
+246, 56, 23,197,134,106,150,214,148, 12, 44, 76, 37, 62,111, 55, 53,255,133,  3, 15, 75,185,184, 49,207,177,176,148,139, 26,247,
+106, 44,255,133,231,121,222,204, 68,212,152,103,245,117,106,170,181,204,214, 93, 63,238, 88, 51,110,220, 56,211,172,164, 52,164,
+ 20, 68,160, 72,226, 12,189,220, 21,113,119, 47,169, 85, 26,198,144, 74,188,198,243,153,149,149,149, 17, 22,154,131,131, 91,150,
+ 65,175,213, 32, 35,169,212,171,166,100, 21,192,220,214,249,122,114,114,178,193,154, 58,134,203, 31,244,225,  4,177,137, 25, 76,
+ 70, 14, 10,144,196,101,107,208,202,201,172,244,162, 81,148,137,135, 33, 87,208,173,172,143,233,227, 68, 18,238, 45,156, 12,218,
+ 79, 51,153,248,179,119, 90, 59,227, 73, 66, 42, 46, 63, 72,222,245, 36,  7, 41,108, 84,234,174,184,148,188,192,254, 29,220,176,
+246, 68,228, 20, 64,191,223,152, 99,247,181,195,  8,158, 71,151,210,206,240,106,240, 64, 23, 95, 59,140, 48,112,164,225, 11,154,
+180, 24, 31,172,249,229,217,252,195,183,178,250,207,252,192,223,188, 83,167,119, 37, 96,180, 40, 84,107,244, 15,243, 80, 96,140,
+102,129,154,219, 10, 96,107,249, 27, 97, 73,220, 30,255,133,215, 47,237, 31,239,170, 44,247,234,151,226, 52,215,  1, 92, 31,219,
+222,100,129,184,251, 18,159,235,139,219,159,  9, 79,229,246, 94,138,171,200,161, 85,231,255,168,158,  8,154,130,230, 95,161,201,
+  2,216,163,215,235,247,228,229,229,189, 74,205, 20,188,152,215,233,165,142,189,114, 51, 33,207,243,116, 89, 52,171,174,206,240,
+181,106, 86,110, 38,228,121,254,231,178,104, 86, 93, 81,173, 42,154, 28,199,165,180,105,211,198,186, 95,191,126, 96, 89, 22,143,
+ 30, 61,194,179,196, 68,244, 12,156,  2, 75, 75, 75, 92,186,127, 31,209,209,209,248,234,171,175,160,215,235,113,252,248,241,164,
+186, 52,105,154,214,189,241,198, 27,226,  1,  3,  6,128, 97, 24, 60,126,252, 24,201,201,201,152, 62,125, 58, 44, 44, 44, 16, 22,
+ 22, 86,161,153,149,149,  5,154,166,117,213, 68,183,254,140,223,210,191,157, 23, 76, 86,237, 70, 11, 96,193,234,145,127,110, 33,
+214, 93,134, 78,167, 71,227,200, 76,196, 71,254, 17,145,218, 76,133,222, 63,117, 63, 34,234, 73,216,213,183, 36,200,  8,135,177,
+119, 18,143,178,145,106, 38, 43, 44,132,174,208, 28,143,127, 65,124,122, 97,209,163,108,164, 26,125,199,192,177,  4,116, 42, 32,
+245, 54,174, 93,186,136, 11, 55,238,225, 86,120, 20,123, 45, 44,230, 32,201,225,155,135,217,120, 84,143,187, 16, 40,250,174,197,
+232,240, 88,183,182,222,246,110, 96, 25,240,156, 30, 22,195,246, 99, 76,100, 39,183,182,158,150,110,165,145, 44, 61,172, 62,254,
+ 29, 88, 35,171, 85,239,118,162,126,155,228,196,153,193,133,121,217, 29,122,116,237,104,106,225,251, 14,178, 98, 99,240,232,222,
+ 21,117, 88, 68,220,181,219,137,250,109, 47, 83,186,206,206,206,111,246,232,234,131, 97, 19,231, 64,167,202,199,227, 11, 63,162,
+ 40, 39, 13,151,175, 43, 16, 85, 80,208, 17,128,193, 17,173,235,  9, 76, 83, 36,228,162,115,  3, 81,130, 25, 52, 14, 31,  5,244,
+131,148, 40,  1,167, 41,  0,161,202, 66, 92,178, 54,127,240,150, 68, 22,  0,228, 82,130, 54,229,243,205, 13,138, 60,186,219,120,
+201, 41, 61,118,159,123,  0,142, 43,157,190,137,227,176,121,247,239,113,129,223,140,108,133, 38,110, 86, 45,238, 38,103, 16, 48,
+ 34,228, 79,240,240,191,117,240,235,198, 37,191, 45,  0, 56, 29,174, 76,181,110,236,191, 46,199, 31,245,156,110, 39, 34,  5,201,
+  0,  2, 65,171,182, 78, 93,247,235,130, 54,231, 34,187,204,248,184,191, 57,248, 87, 50, 66, 55, 38, 50,141,125,179,253,242,103,
+103, 56,190,106,123,110,105,100,203,151, 79, 41,224,239, 94,138,211,  8, 89,225,  5,  4,  4,  0,  0, 69, 69, 69, 19,199,140, 25,
+179, 85, 36, 18, 41,  1, 16, 28,199,129,227, 56,122,213,170, 85, 34,150,101, 73,146, 36, 89,138,162,152,159,127,254, 89,207,178,
+108,102, 73, 73,201,196,186, 52, 25,134,137,155, 52,105,210, 27,117,141, 80, 60,112,224, 64,185,201,138, 19, 74,194, 32,147, 85,
+121, 93, 17,229,162,107,  9,210,126,221,121,228,194,133,  0,  8,240, 88, 20,153,137,248,231, 55,  9,207, 65, 74, 19, 74, 55,189,
+105,219,174, 11,203, 63, 99,236,158,149,176,236,251,109,155,121, 31,  0,  0, 13,207,142,172,207,209, 21,104,212, 67, 91,182,237,
+120,144,227,121,154,225,249, 29, 36,135,163, 37, 12, 30, 26, 50,210,174, 38, 82, 50,242,194,222,241,179,224,129,210, 38,195,138,
+230,194,178, 52, 14, 60,207,243, 21,205,133,171,101,200,202,215,212,153,  7,234,106,188,182,151,150,185, 53,225,236,213,187, 19,
+ 89,150,119,160, 40, 34, 77,173,101,182,190,172,201,  2,128,228,228,228,139, 33,231,146,207,222,111, 97,223,219, 86, 94, 22,229,
+ 82,  1, 89, 42,156, 77,206, 44,186, 88, 31,205,220, 98,125,255,185, 65, 39, 78, 74, 68, 20, 13,158, 47, 77, 40,202,243, 40,209,
+177, 57,215, 19,152,166,  0,208,204, 26, 78, 95, 30,103, 14, 80, 20,241,172, 46,189,208,232,212,181,195,150,135,124,241,224,105,
+238,142,167,121,136,  0,128,167,121,136, 56,116, 37,126, 65, 92, 90,225, 23, 17,207,114, 87,195,200,126, 21, 60,129,203,109,135,
+ 45,124,225,181,151, 61,159, 81,169,184,  7, 96, 32,144,212,107,216,140,245, 51,  8,  2,175,106,250,137, 24,181,142,119,127,254,
+197,242,200,150,112,173, 18, 16,248,103, 80, 30,213, 34, 73,114,241, 43,212,252,153, 32,136,119,  1,196, 26,241,177,208,162,162,
+162,102,175,248,240,178, 25,134,201, 54,100,195,191,161, 67,252,191,149,109,127,215, 23,247, 20, 52,255,122,205, 70,141, 26,241,
+ 70, 24, 22,225,124, 10,154,130,166,160,249,159,210,228,121,158,122,153,165,  6, 77,226,101, 22,161,140,254,245, 76,168,233,185,
+208,211,237, 53, 36, 54, 54,150, 16,206,130,128,128,128, 64,245, 16,  4,193,254,  9,154, 66,118, 60,129,114,131, 85, 37,186, 69,
+ 10,231, 68, 64, 64, 64, 64, 64, 64, 64,224,149,152,172,202,235, 82, 19,142,154,195,127,198,140, 38,168, 79,  8, 49, 68,208, 20,
+ 52,  5, 77, 65, 83,208, 20, 52,  5,205,255,156,102, 93,218,194,104,198, 63,217,128,  9,154,130,166,160, 41,104, 10,154,130,166,
+160,249,223,211,252, 55, 83, 99, 31, 45,161,233, 80, 64, 64, 64, 64, 64, 64, 64,224, 79, 66,232, 12, 47, 32, 32, 32, 32, 32, 32,
+ 32,240,114,212, 57,169,180,128,128,128,128,128,128,128,128, 64,253,168,125, 82,105,  1,  1,  1,  1,  1,  1,  1,  1,129,122, 99,
+252,164,210,  2,  2,  2,  2,  2,  2,  2,  2,  2,  6,177, 77, 56,  5,  2,  2,  2,  2,  2,  2,  2,  2,127, 13, 85, 71, 29,  6,  7,
+  7,243,149,215,  2,  2,  2,  2,  2,  2,  2,  2,127, 37,175,171, 23, 17,154, 14,  5,  4,  4,  4,  4,  4,  4,  4, 94,142,  9,130,
+209, 18, 16, 16, 16, 16, 16, 16, 16,248,115,168,177,143, 86,121,194,210,110,101,161,186,110,194,185, 18, 16, 16, 16, 16, 16, 16,
+248, 27,120,189,189,136,208, 63, 75, 64, 64, 64, 64, 64, 64, 64,240, 34,  2,  2,  2,  2,  2,  2,  2,  2,  2,255, 36,132,185, 14,
+  5,  4,  4,  4,  4,  4,  4,  4,254, 98,195,245,167, 27, 45, 97,102,115, 65, 83,208, 20, 52,  5, 77, 65, 83,208, 20, 52,255, 75,
+ 38,171,138,217, 18, 70, 29, 10,  8,  8,  8,  8,  8,  8,  8,188, 28,117,142, 58, 20, 16, 16, 16, 16, 16, 16, 16, 16,168, 31, 19,
+  0,  4,148, 61, 14, 64,165,168,150, 16,209, 18, 16, 16, 16, 16, 16, 16, 16,120, 57,182,  1,112, 44, 51, 88,167,  1,164, 10, 70,
+ 75, 64, 64, 64, 64, 64, 64, 64,224,213, 80,185, 95, 86,223, 74,230, 75, 48, 90,  2,  2,  2,  2,  2,  2,  2,  2, 47, 73,141,125,
+180,  8,212, 60,114, 32,196,136, 47,168,207,232,131, 16, 65, 83,208, 20, 52,  5, 77, 65, 83,208, 20, 52,255,115,154,117,105,135,
+224,223,199,  4, 99,204,215,171, 68, 24,250, 42,104, 10,154,130,166,160, 41,104, 10,154,130,230,127,150, 87, 62,234,176, 21, 96,
+ 34,156,214,215, 18,251,178, 69, 64, 64, 64, 64, 64, 64,160,118,254,156, 81,135,190,192,199, 31,250, 41,183,232, 35, 50,205, 35,
+  0, 85,109,219, 42,149,202,173,114,185,252, 67,149, 74, 85, 76, 16,  4, 87,254, 58,207,243,  0, 80,121,174,163,199,153,153,153,
+254,117,125,183, 68, 34,  9,178,183,183,255,184,168,168, 72, 69, 16,  4, 79, 16,  4,  8,130,  0,128, 23,214, 44,203, 38,101,103,
+103,183,249, 87, 23, 33,207, 83,182,246,246, 55, 69, 20,229,108,236, 71, 89,142,139,207, 72, 79,239,104,196, 71,150, 17,  4,102,
+150,126, 45, 86,  2,152,243,186,253, 35,120,128, 50,100, 59, 63,192, 44,  6, 24,198,146,228, 20, 17,176, 81,195,113, 91,  0,128,
+  0,216,250,126,183, 38, 20,111, 16, 60, 90, 16,  4, 44,120, 30,249, 60,129,123,210,246,136,251,155, 78,197, 32,145, 72,212,223,
+220,220, 92,145,157,157,125, 17,192,  1,  0,195,109,108,108,186, 22, 20, 20, 20,233,245,250, 19,  0,142,213, 71,216,191,  5,102,
+ 73,196,162,177, 37, 58,253,138,171,247,240, 99,215, 86,176, 97, 56, 44,151,137,105,127,141,150, 89,121,229, 62,118, 24, 41, 73,
+148, 45,229,215, 12,163,231, 72, 59,108, 96,185,  3,192,113, 43, 43,111,169,210,252, 55,145,132,138,207, 75, 47,250,240,253,140,
+140,196, 33, 47, 81,238,255, 68,108,109,109, 71,147, 36,249, 45,207,243, 96, 89,118, 94, 78, 78,206,206, 87, 36, 61, 15,128,101,
+217,227, 60,  0,223,190,164,222, 51,  0,110,101,143, 19,  0,184, 11,245,122,189,217,252,211, 79, 63,  5,118,239,222, 29,107,215,
+174,197,230,205,155,159,102,102,102, 46,  7,176, 11,128,246,111,208, 17,168,137, 38,192,187,171,250,180,103,245,255,251,134,171,
+244,114,207, 26,254,204, 63,124,244,209, 71, 58,158,231,249,232,232,104, 94,171,213,242,122,189,158,103, 24,134,103, 24,134,215,
+235,245, 21,139,179,179,115,242,115, 31,127, 65,147, 36,201,117,131,  7, 15, 46,228,121,158,191,125,251, 54,175, 86,171,121,141,
+ 70,195,107,181, 90,190,164,164,132, 87,171,213, 85, 22,123,123,251,244,218, 52,205,205,205,111, 91, 89, 89,165, 91, 89, 89,165,
+ 91, 91, 91,167, 91, 91, 91,167,219,216,216, 84, 44,182,182,182, 21,139, 82,169, 76, 87, 42,149,233,214,214,214,183,235,218,207,
+ 50,250,  0,184,104,192,210,167,154,207,246,172,108,180, 28, 29, 29,211,249,122,224,226,226,146,104,192,126,150, 99, 79, 16, 96,
+203, 63, 75, 16,224,164, 82,169, 91,229,247,241, 98,164,171,206,144,178,147,147,211, 96, 71, 71,199, 16, 71, 71,199,115, 78, 78,
+ 78,131, 13,248,137, 85,209, 52, 51, 51,187,109,107,107,155,238,224,224,144, 81,190, 56, 58, 58, 86, 89,156,156,156, 42, 22,123,
+123,251,116, 43, 43,171, 26,203,136,  7,168,154,150, 11,  0, 45,  5,222,162, 41, 42,216,222,222,190, 32, 60, 60,156,229,121,158,
+ 39, 73, 50,185,124, 27, 99,142,253,121,147,165,186,130,121, 89,231,165,161, 69,241,203,243,179,206, 75, 67, 85, 87, 48, 79, 19,
+138, 55,234,171,105, 32,213,105,142, 26, 53,106,212,189,244,244,244,228,188,188,188,212, 45, 91,182,196,200,100,178, 43, 91,182,
+108,137,201,203,203, 75, 77, 79, 79, 79, 30, 53,106,212, 61,  0,147,140,208,  4,  0,116,108,129, 14,227,  6, 57,170,238, 29, 31,
+169,122,171, 45,125,183,179, 31,  2,122,117, 20, 39,111,152,237,171,186,180,189,139,170,123,107, 50,194, 72, 77,130,166,233, 78,
+110,110,110, 99,149, 74,229, 71,101,203,200,242,197,193,193, 97,164,131,131,195, 72, 43, 43,171, 33,181,105, 30,  6, 40, 67, 22,
+ 87,153,172,211,144,134,110,170,103,139, 23,241,225,211,166,240, 99, 61, 93, 11,222,183,179,107,240, 55,148,209,159,170,105,103,
+103,151,162,215,235,121,157, 78,199,219,216,216,164,188,194,253, 92,205,243,252,106,158,231, 87,  3, 88,253, 10, 52, 43,174,103,
+ 70, 24,236,218, 52,101, 52, 73,206,144, 75, 36,231,164, 52,157, 33,165,233, 12,185, 68,114,142, 38,201, 47,  0,200,254, 73,101,
+244, 39,104, 42,148, 74,229,147,160,160, 32, 94,165, 82,241, 42,149,138, 15, 10, 10,226,149, 74,229, 19,  0, 10, 35, 52,235,171,
+243, 58, 69,176,158, 95, 94, 93, 68,203, 23,104,243, 86,139, 70, 71,167,142, 30,  6,238, 72, 16, 81,199, 29,211, 15, 29,219,180,
+ 25,187,107,215, 46,  0,192,135,253,251,163,119,187,118, 48, 83,152, 66, 34, 41,221, 29,130, 39, 32, 22,137, 49, 96,250,231,134,
+124,253,202,  1,  3,  6,124,112,228,200, 17,  5,  0,108,222,188, 25,131,  6, 13,130,181,181, 53,228,114, 57,196, 98, 49, 68, 34,
+ 81,149,117, 93, 80, 20,229,146,156,156,108, 39,147,201, 42,162,108, 28,199, 85, 89,120,158, 47,143,190,129, 97, 24,120,121,121,
+ 25,122,186,102,231,231,231,191, 89, 92, 92, 92,161, 81,221,210,176, 97, 67,  0, 56, 99,136,224,183, 75,190,  1,199, 20,131,166,
+  1,134,  1, 52, 58, 18, 28, 95,173,185,193,164, 73,147, 42,246,187, 62,244,237, 27, 64, 16,  4,113, 36, 44, 44,236,104, 70, 70,
+134,  7,199,177,227,235, 25,233,250,244,209,163, 71, 10,  0,240,246,246,158,  4,224,168, 49,251, 65,211,180,203,253,251,247,237,
+164, 82,105,141,145,203, 74, 17, 76,232,116, 58,180,106,213,138, 49,230, 59,236,  1,183, 28,146, 28,223,178,117,235,  9, 11,  7,
+ 12,144,221,188,121, 83, 70,146, 36, 24,134,193,170, 85,171, 24,158,231, 45,155,  0,230,145, 64, 65, 45, 50,115,  1,140, 46,171,
+ 12,118,  0, 88, 85,197, 45,240,104,161,214, 75,  3, 30, 23, 13,104,215,190,193, 44, 68, 62,  8,111,231,169, 56, 14, 51, 90, 19,
+  7,252,181, 81, 45,115,115,243,254,107,215,174, 85,238,216,177,163, 32, 58, 58, 90,183,101,203, 22,229,196,137, 19,205,116, 58,
+ 29,  2,  3,  3, 51,125,124,124,196,107,215,174, 85, 30, 59,118,236,173,226,226,226, 77, 70,149, 23,129,111,134,247,239,141, 18,
+ 61,  9,189,158, 81, 58, 42,205,246, 76, 29,213, 77,196,243, 90,236, 62, 17,  6, 61,195,253,104,100, 36,171,227,251,239,191,239,
+185,127,255,126, 58, 42, 42,138,110,220,184, 49, 56,142,  3,203,178,208,235,245,  0,  0,142,227,208,168, 81,163,151, 62, 47, 99,
+  1,111, 91,123,235,115, 29,223,125,199,196, 81, 38,133,117,110, 38,198,137,105,179,157,114,205, 94,  0,157, 94,171,200, 46,207,
+131,166,105, 36, 38, 38,194,206,206,206,132,227,184, 84,  0,139,114,115,115,183,225,245,165,157,132,166,143,238,254,113,157, 67,
+251, 78,157, 40,123, 71, 59,196, 60, 74,  0, 77,176, 61,239,223, 10,235, 54,246,147, 25, 83,181, 12, 51, 24,192,205,215,237,192,
+ 29, 58, 77, 26, 72,144,212,102,130,231,240,245,134,147,133,203, 86,  6,201,  3,199,143,162,166, 79,159, 14, 87, 87, 87,143,129,
+  3,  7,174,  4,240, 73,157, 58,237, 39, 13,  4, 69,110,  6,207, 99,225,250,147,133, 75, 87,  6,201, 63,169,135,206,191,156, 26,
+255, 35, 47,109,180,124,  1,207,166,174,118,103,151,205,252, 68,196,255,242, 63, 82,149,157, 81,227,182, 74,165,114,235,219,111,
+191,253,225,206,157,127, 68,163, 59,250,249, 97,224, 91, 93, 96,103, 99,  1,185,169,164,180, 58,226,  8,220,139,142, 55,200, 16,
+184,186,186,  6, 30, 61,122, 84, 81,217, 76,136,197,226,138,165,178,201, 42, 95,202, 43,224,218,144,201,100,  8,  9,  9,  1, 77,
+211,160, 40, 10, 52, 77, 87, 44,149,159, 83, 20,  5,123,123,163,186, 46, 45,183,176,176,104, 94, 88, 88,104,158,151,151,  7, 55,
+ 55,183,  2,  0,247, 43,189,223, 60, 51, 51,211,220, 24, 65,142, 41,198,244,113,190, 16,105,111, 64, 43,106,  7, 53,221, 25,215,
+110, 61, 68,240,153,139, 72, 78, 73, 67,151, 14, 45,241,209,136,247,113,238,220, 57,176,172,209, 45, 29,233, 60,143,149,253,250,
+  5,204,  2,  8,162,103,207,158,121,147, 39, 79, 38,163,162,162, 62, 24, 56,112,128,223,163, 71,177,101, 81, 69, 98, 38,207, 99,
+ 29,128,116,  3,117, 37,  0,112,233,210, 37,  0,144,214,231,183, 39,149, 74,113,253,250,117,148, 55, 19,147, 36,  9,146, 36, 65,
+ 81, 20, 78,197,218,162, 88, 75, 66,149, 30,129, 41,  1,110,104,216,176, 33, 72,178,238, 46,137,221,  0,217, 53, 96, 32, 33, 18,
+ 77,119,116,114,242,232,234,233, 41, 15,  9,  9,161,  0,192,221,221,157, 79, 77, 77,205, 59,113,226, 68, 33, 13,108,118,231,249,
+ 93,181,153, 44, 87, 87,215,206,201,201,201,223,150,159,115,130, 32, 86, 54,104,208,224,171,138,114,227, 56, 44,250,177, 88, 52,
+117,234, 52,113,251,110,243,  1,  0,237,251,237, 71,193,227,101,190, 68,206, 92,139,191,250, 42, 81, 80, 80,112,176, 81,163, 70,
+ 84,118,118,246, 53,  0,207,244,122,253,236, 61,123,246,216,141, 27, 55, 46, 99,239,222,189,203,  1, 56,173, 88,177,162, 91,113,
+113,241, 33, 99,116,187, 52,199,187,173,155,251,117,112,115,117,197,197,107, 55, 33,150,136, 44, 39,141, 14,128, 66, 65, 99,245,
+142,211,220,179,164,156,201, 87,238, 99,151, 17, 38,171,221,251,239,191,239,177,127,255,126,  9,  0,220,191,127, 31,105,105,105,
+ 80, 42,149, 48, 49, 49,129, 72, 36,  2, 69, 81, 16,137, 68,175,196,100, 89,184,218,132, 30, 63,126,194,196,218,218, 18, 27, 62,
+159,138,143, 50,210, 97,105,166,128,190,168,216,227, 53,171, 40,188,253,253,253,101, 44,203,162,184,184, 24, 23, 46, 92,176, 48,
+ 49, 49,177,112,113,113, 89,  8, 35, 70, 79,201,100,178,244,146,146, 18,187,178,199, 25, 37, 37, 37,246,  0, 10,164, 82,105,249,
+117,186,168,108,109,104,115,226, 51,188,216, 76,152, 64, 16, 68,229,215,234, 75,219,118,109,155,135, 28, 59,178, 79,145, 95,152,
+  6, 75,171, 12,144,200,199,182,109, 27, 97, 98, 98,142,133, 11,231,210,241, 61,223,114,238,243,238,224,144,  7, 15, 99,122,190,
+118,102,139, 39,182,245,236,247,161,181,137,220,172,172, 46,209, 99,231,246,169, 32, 73, 18, 95,125,245, 21,154, 54,109, 58,225,
+193,131,  7,243,  1,228,212, 46,131,109,205,222, 28,106, 45,145,149, 22, 49,199,234,177,229,192, 23,165, 58,115, 38, 98,120,191,
+134, 19,190,124,255,201,175, 77, 61, 81, 88,118, 99,174, 22,145, 72, 32,218,163,194, 48,  4,  7,  7,119, 13,  8,  8,184, 88,211,
+243,127,  1,142,248, 35,127, 86, 21,243, 69,  7,  7,  7,243,  1,  1,  1, 68,165,131,171,242,188, 54, 90,  0,182, 86, 22,242,144,
+205,139,166, 42,232, 27,167, 41,117, 66, 44, 82, 74,170, 84,228, 85,134,104,202,229,242, 15,119,238,220, 89, 37,164,228,102,111,
+  7,177, 88,  4,145,152,128,165,127,105,246,250,188,203,193, 32,136, 26, 77, 86, 21,205,226,226,226,146,187,119,239, 42,118,236,
+216,  1, 59, 59, 59,120,120,120, 64, 46,151, 67, 38,147, 85, 49, 87,149, 13, 87, 53, 70,171,138,102,249,251, 52, 77,131, 36, 73,
+156, 59,119, 14, 12,195,224,253,247,223,127,193,100,209, 52, 93,147,113,171,105,120,234, 25,  0,247,121,158,127,179,172,  2,190,
+ 15,160,107,165,247,251, 40,149,202,217,  0,150, 27,170, 73, 81, 60,168,146,107,224, 92,130, 64, 39, 78,133, 86,212,  2,231,175,
+132, 97,231,214,181,  0,  0,143,198,109, 49,100, 96, 64, 69, 52,206,192,253,172,192,217,217,249, 64,102,102,214, 59,111,189,245,
+ 22,114,115,115,245,139, 22, 45, 66,243,230,205,225,237,237,109, 80, 25,213,112,231,156,126,255,254,125, 87,181, 90, 13,158,231,
+ 13, 49,103, 47,104, 18,  4,129, 61,123,246,160,164,164,228,133,141,173,186, 46,197, 23,131,220, 49,102,202, 46,172,140, 62,132,
+ 77,155, 54,213,122,236,114,160,121,137, 69,163,117, 18,138,105,190,124,238,167,210,143, 62,250,136, 26, 51,102, 12, 18, 18, 18,
+ 48,110,220,184,146,115,231,206,105,211, 82, 83, 79, 72, 56,110,131,174,170, 49,174, 81, 83, 42,149,238, 62,115,230, 12, 14, 29,
+ 42,245, 37, 49, 49, 49,240,242,242, 50,173, 98,146,115, 14,163,240,217,  6,132,158,138, 66,251,126,251, 17,122,106,  4,216,188,
+211,162, 54, 94,200, 55,230,124,214,131,234, 52, 15,101,103,103, 87,152,168,189,123,247,154,236,221,187,119,  0,128,147,  0, 14,
+  1, 64, 78, 78,206,119, 70,106,  2,  4,198, 12, 29, 52,  0,180,216, 12, 81,177, 73,232,218,177, 21,236,237,236,112,255, 97, 28,
+158, 37,231,164, 19,  4, 70,247,233, 36, 89,174, 86,107,231, 95,190,135, 31,234,208, 36, 92, 92, 92,188, 15, 31, 62, 44,174, 20,
+129,174,248,143, 83, 20, 85,241,188,220,120,215,231,247, 89,110,178,204, 92, 20,161,223,108,236,108, 26, 26,190, 23, 94,238,239,
+194,234,221,  0,252,112,246, 44, 30, 61,136, 44,209,170,152, 30,127, 67, 25,253, 89,154,222,131,  6, 13,186,182,111,223, 62,203,
+196,196, 68, 92,186,116,  9, 30, 30, 30, 80,169, 84,134,220,240, 86,209, 44, 41, 41,177, 43,255, 12, 65, 16,118,229,129,119,173,
+ 86, 91, 94, 24,229,127, 68,203, 74,219, 89,214,162,233, 86,105,187,114,115,229,254, 10,142, 93, 34, 19,139, 15, 31, 63,118, 64,
+ 17, 25,117,  9, 45, 91,116,128,194,162,  9, 56, 54, 13,217, 57, 69,200,141, 77,193,146, 37, 43,177,112,209, 60,156,252,233,136,
+194,199,183,197, 81, 45,195, 52,  2, 80,242,218,148, 59,193, 79,  8, 57,181,119, 51,193,115, 80,167, 71, 73, 69,197, 79,228, 31,
+142, 24, 76, 13, 27, 54, 12, 39, 79,158,196,131,  7, 15, 54,215, 98,178, 66, 42, 69,230, 39, 68, 92, 58,180, 25, 60, 15,117, 70,
+148, 84,172,126, 34, 31,245,193, 16,234,163,225,189,113,227,247,117,232,221,242, 73,132,147, 29,  6,230,150, 89,108,154, 66,182,
+ 84,134,171,124, 40,110, 84, 50, 91, 23,  0, 16,149, 12,214,  5,252,209,  7,243,223, 64,223, 50, 99, 53,225,249, 27, 19,186, 62,
+  6, 11,  0,188,  0,  5, 33, 17,135,238, 92,248,169,147, 60,225,  1,173,137,184,142, 20, 13,199,111,121,202,112,173,  0,147, 59,
+128,250,249,207,168, 84,170,226,184,184, 56,147,209,  3,  7,162,147,159, 31, 28,109,108,208,200,197,  5, 38, 82,  9, 36, 98, 81,
+149, 91, 86,131,219, 16,  8,130,247,241,241, 65,191,126,253, 32, 18,137, 32,151,203,161, 80, 40, 32,145, 72,170,141,102, 25,122,
+151,203,243, 60, 40,138, 66, 68, 68,  4,158, 61,123,  6, 75, 75, 75, 92,189,122, 21, 61,122,244,120, 33,170, 85,217,156, 25, 19,
+162,175,166,226, 47, 55, 98,103,140,209, 98, 89,  2, 69,124, 11,200,158, 78,134,138,104,  5,141,134,129, 70,163,193, 15, 87,116,
+184, 25, 87, 12,157, 78, 11,141, 70, 83,219,119,214,  4,233,228,228,244, 97,163, 70,141, 38,141, 24, 49, 66, 47,145, 72, 80, 92,
+ 92, 12,149, 74,133,  7, 15, 30,232,223,121,231,221,188,126,253,  2, 44, 78,159, 62,205,151, 53, 29,166, 27,161,157,237,236,236,
+236, 90,214, 60,155, 93,159, 95, 53, 65, 16, 21, 38,230,121, 70,127, 23,  9,154, 42, 45,147,205,155, 55,131,101, 89,240, 60, 95,
+ 99, 33,149, 16,196,111,139,150,174,177, 88, 17,244, 35, 44,172,237,113,241,226, 69,246,215, 95,127, 45, 36,128,152, 71, 15, 30,
+124,247, 30,240,243, 97, 64,103,204,254,229,230,230,154,120,120,120,192,197,197,  5, 28,199, 65,175,215, 87, 68, 95,178,179,179,
+161, 86,171, 97,109,154,135, 55,108, 92,192, 20, 94, 64,106,196,215,112, 84, 68, 97,215, 25,173,190,181, 55,238,253,  3, 46, 28,
+255, 43, 91, 94,242,174, 25,206,118, 14,174, 32,121, 61, 82, 50,178, 49,160,111,111, 80, 98,  5,226, 19,179,208,162,137,167,227,
+  7,239,117,118,164,  8,  6, 51,151,239,159,  4,112, 63,212, 37, 87, 84, 84,196, 70, 69, 69,225,254,253, 82,191,107,110,110, 14,
+ 83, 83,211, 42,255,113,146, 36, 95, 42,162, 85,110,178,150,110,238, 97, 74,138,138, 81,192,134, 96,199,158, 48,180,240,  9,192,
+150,208, 91, 37,108,122, 78,207,213, 37, 37, 49,  7,254,197,193, 12,  7,  7,135,137, 28,199, 45,228,121, 62,175, 75,151, 46,246,
+251,247,239,183, 74, 78, 78, 70, 88, 88, 24,190,250,234,171, 76,150,101, 25,158,231,  9,158,231,191,126,  5, 95,199, 85, 50, 88,
+175, 18,145, 92,134, 41,182,230, 68,127,154, 52,247, 96, 10,138,226,179,180,252,  9, 21,195,173,  7,160,175,245,226, 70,146, 31,
+ 31, 57,184,217,201, 86,201,161,155,242, 45,164,166,235,176,244,243, 81,200,206, 46,196, 15,219,151,  1,144, 64,199, 80,120,179,
+219, 96,216,217, 57, 99,194,248,  9, 14,155,183,110,249,148,225,184,213,120, 77, 72,187,182,233, 39,  0, 33, 74,165,242,193,167,
+ 19, 38, 40, 61, 60, 70, 66, 38,147,225,192,129,  3,216,191, 97,  3, 27,  4, 12,145,  2,231,  3,129,159,106,213,  9,253, 67,103,
+106, 96,160,210,215, 55, 16, 82,169, 20,191,255,250, 63,148,164,237, 41,236,219,  9, 58, 85,  9,250, 54,232,199, 91, 63, 61, 69,
+228,136, 68,136,  5,  0,145, 12,169,  0,158,111,  6,251,183, 25,172,114, 78,227,143,126, 89, 19,170, 68,180,234,125,237, 20, 73,
+194,183, 79, 27,238,110, 15, 13,161,189,114, 10,201, 26,142, 93,241, 72, 71,221,201,231,191,120, 88,141,201, 42,251, 97,115,110,
+110,110,120,171, 77, 27, 12,244,247,  7, 77,211,144, 73,196, 48,147,153,128,103, 75, 35, 89,229, 77,135,181,212,137,168, 46,250,
+100, 99, 99,  3,177, 88, 92, 97,176,140,136,102, 85,171,201,113, 28,104,154,198,253,251,247,209,165, 75, 23,184,186,186,226,208,
+161, 67,232,211,167,207, 11, 77,137,198,154,172,114,163,245, 92, 51, 94, 31,  0,229,145, 44,163,140, 86,137,150, 64,150,182,  5,
+  8,194, 15, 12,  3,176, 60,160, 41, 41,  1,207,  3, 60, 15,232,117, 90,148,148,148, 84,124,167, 33, 77,178, 14, 14, 14,110, 38,
+ 38, 38,139,103,205,154,233,219,162, 69, 75,100,102,102,130,227, 56,152,154,154, 66,165, 82,193,220,220, 28,157, 58,117,138, 95,
+188,120,113, 42,207, 99,130,145, 38,235,165, 41, 63,231,103,207,158,173,210,108, 88,190, 20,167, 38, 97,204,103,123, 33,161, 75,
+155,150,202,251,240,212,118,221,237,254,102,103, 92,187, 19,195,124, 60,115,157, 70,148, 29,182,220,129,227,118, 38,189,196,113,
+241, 60,143,172,172, 44,164,167,167,163,255,128,  1,216,191,111, 31,158, 62,125,138, 38, 77,154,160,123,247,238,176,179,179,195,
+211,167, 79,113,243,178,  6,154,220, 28,228,104,195, 32, 55,107,143,227, 23,227, 52, 95,109,214,197,253,141, 23,140,254,  0, 70,
+153,155,155, 55, 84,169, 84,169, 12,195, 28,  6,112, 24,192, 16,154,166,135,200,229,114,199,130,130,130, 39, 40, 29, 77,116,162,
+ 46, 49, 19,153,204, 70, 42, 51,  7,199,104, 64,211, 52, 92, 93, 61,192,179, 90,228, 22,168, 49,122, 88, 63,220,185,255, 16,191,
+158,191,193,232,245,220,247,134,156, 86,138,162,120,111,111,111,100,100,100, 64, 36, 18,193,196,196,  4, 10,133,  2,115,230,204,
+193,134, 13, 27, 42, 76, 86,125,141,214, 88,192,219,220, 77,113,227,219,141,165, 38, 43, 45, 37, 21,233, 73, 34, 40,109,236,241,
+253,134,160,226,220,167,105,237,127,  4, 98,254,237,149, 44,199,113, 95, 39, 39, 39,219,209, 52,237,192, 48, 12, 18, 19, 19,113,
+251,246,109, 76,158, 60, 57, 61, 59, 59,187, 27,234,121,140, 50,153, 44,163, 60,146, 85,214,116, 88, 83,115, 98, 94,165, 72, 86,
+ 94, 45,146, 53, 53, 19,122,122,184,152,157,219,190,118,186, 91,219,246,157, 72, 57,109,158, 91, 20,155,214,229,202,165,139,157,
+ 38,175,253,225,211,103,185, 69,189,  1, 60,174, 73, 84, 42, 18,189,211,161,115,103, 26,124, 58,104, 73, 23,172, 92, 49, 12,153,
+ 89,  5,200,205, 41,132, 88,108, 10,173,158,  2,203, 17,232,212,197, 31,255,219,117, 16, 77,199,143,163, 36, 34, 81, 47, 70,171,
+125,109,140, 86, 25,203,214,175, 95,239,230,227,227,131,157, 59,119,226,252,238,221,248, 40, 63, 31, 23, 73,146,210,139, 68,182,
+ 63,235,245,219, 80,135,209,170,172,211,180,105, 83,252,248,227,143,216,179,103, 79,194,135, 61, 50,142, 78,255, 16,118, 58, 29,
+222, 14,139,134,117,131,126, 64, 88, 52,172, 91,251,160, 17, 67, 35,150, 32,170,166,131, 10, 14, 14,238, 90,121,253, 47, 35, 21,
+ 53, 52,177,211,  0,186,  5,  7,  7,243,149,215,117, 94, 56,149, 94,129,203,122, 55,116,247,123,195,141,208, 31, 90,135,196, 98,
+ 70, 59, 63, 90, 39,121, 84,196, 79,127,  8,  4,213,114,  7,193, 83, 20,  5, 51, 19, 19, 40, 45, 45, 75,195,252, 36,  9,112,  0,
+167,  7,  8,182,212,  0,240, 28,  1,158, 53,234,130,  1,137, 68, 82,109,199,119, 99,251,102, 85,214, 44, 44, 44, 68,124,124, 60,
+ 38, 76,152,  0,185, 92, 94,234,220,211,210,224,238,238, 14,154,166,145,156,156,140,223,127,255, 29, 13, 27, 54,132, 84, 42, 53,
+202,109, 85,138, 46, 53, 71,233, 40,195,230,169,169,169,230,142,142,142, 48, 58,162,197,241, 80,105,  8,104,181, 44, 30, 61,122,
+132,148,148, 20,196, 63,137, 69,219,226,  2,240,160,192,243,188, 81, 17, 45,103,103,103, 63, 79, 79,207, 45,203,151, 47, 23,187,
+184,184,128,231,121, 88, 89, 89, 66,165, 82, 33, 43, 43, 27, 77,154, 52,129,171,171, 43,150, 47, 95, 14,  0,251,255,106,147,245,
+220,111,170,194,104, 85, 54, 92,159,189,231,134,156, 28,  5, 40,138,172, 48,206,117,244,209, 18,  3, 64,183,222,131,232,115,191,
+254,108,202,  0,139,211, 40,106, 49, 93,119, 57,234, 89,142,147,215,244,126, 98, 98, 34, 68, 34, 17,142, 28, 62,140,156,244,116,
+180,104,209,  2,237,218,181, 67,108,108, 44,238,220,185,  3, 27, 27, 27, 40, 93, 58,226,226, 19, 29, 34, 83,212,176,176,176, 64,
+ 92, 18,249,119,166, 12, 24,223,179,103,207,175,190,251,238, 59, 59,  7,  7,  7, 81,102,102,166,207,198,141, 27, 91,108,220,184,
+113,234,167,159,126,106,255,233,167,159, 90, 41,149, 74, 58, 45, 45,205,251,243,207, 63,111, 29, 18, 18,210, 16,192,154,218,  4,
+ 77, 77,205,172, 41,177, 41,  8,130,134,165,133, 21,104,137, 41, 56,134,  6,203,  1,230, 22, 74, 92,187,115,  4, 87,195, 11, 39,
+102,100,227,176, 65,241,177,178,114,183,177,177,121, 33, 82, 61,121,242,100,108,223,190,189,162, 25,177,190, 38,107,233,198, 30,
+ 10,162,204,100,165, 37,210, 32, 52, 13,113,234,167,235,121,185, 79,211,186,188, 14, 38,171,252, 26,199,243, 60,158, 60,121,  2,
+149, 74,133,203,151, 47,227,235,175,191,206,124,222,100,217,217,217,141, 55, 55, 55, 95, 84, 84, 84,180, 50, 45, 45,109, 93,157,
+ 55,126,165, 38,170,252,113,249,186,218,230, 68,  3,119,213,189,186, 72,150,171,163,236,204,157,203,123,221, 45,248,123,  4,158,
+ 77,  0, 30, 21, 60, 48, 11,181,123,243,221,182,125,201, 86,155,190,105,208,110,226,156, 51,137,  5, 37, 62, 53, 69,182, 56,150,
+109,101,170, 48,  3,144,129,176,219, 23, 42, 76, 86,118, 78, 62, 52, 58, 10, 26, 45,129, 18, 29,137,183,122,190,141, 13, 91,246,
+ 32, 57, 35,  7, 44,203, 54,123,205, 76,150,181,159,159, 95,224,144, 33, 67,176,120,241, 98,132,124,247,157,246, 19,130, 40,160,
+  1,254, 52,203,130,227,121,130, 52,172, 19,123, 21,157,213,171, 87,255,  4,200,224,209, 35,  0,  0, 32,  0, 73, 68, 65, 84, 96,
+248,242,201,232,152, 91,132,209, 78,253,120,235,  6,253, 74, 55,124,127, 22, 15,  0,214,153, 33, 85,171,204,128,128,  0,162,188,
+101,205,216, 22,182,127, 58,116, 64, 64,192,197,224,224, 96, 84, 94,215,246,  1, 51,123,159,119,191,156, 49,105, 69,219, 62,254,
+ 68,234,140, 94,200, 41, 40, 97,230, 70,234, 36, 73,234,218, 77, 86,101,190,220,184, 17,119, 98, 74,255,199, 46,118,118,152,249,
+193,  7,224, 25,224,234,131, 72, 28, 12,  9,193,176,158, 61, 97, 42,147, 25, 28,217,224, 56,174,218, 40, 86,229,104,150,177, 81,
+167,188,188, 60, 28, 62,124, 24,237,218,181,131, 92, 46,  7, 77,211,104,222,188, 57, 30, 62,124,  8, 79, 79, 79, 16,  4,129,227,
+199,143, 99,224,192,129,120,252,248, 49, 58,118,236,168,120,246,236,153,209, 70, 43, 50, 50,210,156,231,249, 55,203,163, 31,245,
+ 69,163,209, 32, 42, 42, 10,253,250,245,131,149,149, 21,156,157,247, 35,228,204, 94,200,253, 62,  2, 65,192, 40,163,197,178,236,
+216,190,125,251,138,  9,130,128, 90,173,130, 76,102,  2, 83, 83,  5,204,204,204,225,237,237,131,148,148, 20,244,233,211, 71, 27,
+ 23, 23,183, 41, 53, 53,245,144,177,251,234,235,235,107,250,244,233,211,143, 26, 52,104, 32,  1,  0, 19, 19,147, 38,158,158,158,
+ 95, 60,126,252,184,208,216,168, 86,185,193, 34,  8,  2, 20, 69, 85, 24, 45,154, 36,225,232, 96, 87,241,188,172,127, 26, 81,139,
+ 86, 65,114,182, 70, 10,  0,110,110,110,216,176,245, 36,217,183,111, 95, 76,157, 58, 21,122,189, 30,155, 54,149, 14,178, 27, 49,
+ 98,  4,116, 58, 29,142, 30, 45, 29, 36, 73,211,116,173, 97,147,219,183,111, 35, 44, 44, 12,122,189, 30,249,249,249,248,229,151,
+ 95,112,241,210, 37, 28, 56,254, 27,158, 62,137, 69,115, 31,119,140, 27, 55, 22, 34,145,  8,187,118,237, 66,151, 46, 93,254,214,
+ 11,130, 72, 36,250,112,251,246,237,142, 59,119,238,204, 59,126,252,120,113,135, 14, 29,164, 65, 65, 65,118, 27, 54,108, 80,106,
+181, 90, 76,155, 54, 45,227,198,141, 27,154,  1,  3,  6,152,110,219,182,205,241,141, 55,222,232,197, 48, 76,117, 70,203, 20,192,
+ 48,  0, 35,115, 11,181,116, 94,161, 26, 28,163,197,147,167,241,200, 47,210,130, 99,117, 72, 72, 74, 65, 81,  9,139,236,156, 66,
+ 52,111,213,123,253,133, 11, 23,230,233,116,186,185,  0,130,235,218,207,  7, 15, 30,224,198,141, 27,120,250,244, 41,158, 60,121,
+ 82,213, 41,142, 31,143, 61,123,246, 24, 29,209,170,222,100, 81, 32, 52,158,  8, 62, 30,154,151, 17,155,250,218,152,172,178,107,
+208, 66, 71, 71,199,133,142,142,142,178,179,103,207, 90, 52,104,208,  0, 12,195,104,159,143,100,117,235,214,109,254,246,237,219,
+ 29, 61, 61, 61, 39,  3, 88,247, 79,216,119,146,196,248,149,155,  3,109,205, 36,  9, 41,120,180,166, 44,151, 32,  5,168, 10,128,
+ 11,251, 64,119, 94, 16, 63,121,192, 44,171,217, 59, 23,143,231,192,213, 56, 66, 54,238,113, 34, 54,111,222,128,233,211, 70,227,
+127, 63,172,  4,199,209,208,232, 41,184,121,116,128, 70,199,129, 32,105,180,104,213,  6,231, 47, 92,134,136,  4, 14,239,220,252,
+154,249, 44,228, 68, 68, 68,108, 58,126,252,248,148,169, 83,167,130,227, 56,201,162,205,155,213,153,153,153,203, 96, 92,254,171,
+231,117,  6,110,222,188, 57,102,246,134,204,159,166,127,  8,234,233, 41, 34, 39, 44, 26,214,239,207,226,113,100,  5,129,214, 62,
+200,145, 87, 95,197, 95,122,110,253,122, 24,173,114, 39, 89,121, 93, 29,173,188, 26,126, 99, 97,109, 53,150, 52,115,182,157, 57,
+245, 19,250,113, 90,  9,142, 54,248,160,232,247,221,223,155,166, 49,210,245,113, 40,  9, 50,230,139, 15,254,254,123,197,227, 85,
+251,247, 87,251, 94,234,251,239, 27,124,103, 86, 83, 20,203,216, 72, 22,  0,200,229,114,203, 94,189,122,161, 71,143, 30, 24, 60,
+120,112, 69,159,172,150, 45, 91,226,192,129,  3, 24, 52,104, 16,238,222,189, 11, 71, 71, 71, 52,110,220, 24,141, 27, 55,198,207,
+ 63,255,108,236, 69, 14, 44,203,194,207,207,175,124,212, 97,243,164,164, 36,243,250, 22,164, 70,163, 65,118,118, 54,172,173,173,
+ 33,145, 72,208,190,125, 59, 76,249,172, 61,108, 29,127,132,159,175, 15,138,139,139, 43,134,191, 27, 80,217,250, 53,106,212,  8,
+153,153,153,200,204,204,132, 82,169,132,147,147, 19, 28, 28, 28,176,102,205, 26,126,221,186,117,191,234,116,186, 77, 89, 89, 89,
+ 70, 71,178, 28, 28, 28,252,  9,130,152,175, 86,171, 37,149,238,112, 37, 74,165,242,132, 90,173, 94,150,154,154,106,112, 71, 80,
+130, 32,160,211,233, 64, 16,  4, 78, 63,113, 66,177,150, 64, 65, 82, 24,166,190,231, 94,197,120,137, 68,162, 58,155, 75,121,158,
+ 47, 30, 62,124,184,157,171,171, 11, 18,227, 30,224,200, 17, 30,223,125,247, 93,249,168, 72,196,148,221, 24,148, 63,239,222,189,
+ 59, 60, 60, 60,192, 27,145, 43,131,227, 56,220,191,127, 31,251, 79, 92,132,163,187, 47, 18, 30, 69,225,206,207,167,208, 64,105,
+141,166,173,218, 64,175,215,191, 84,234,141, 87,129, 94,175,223,225,229,229,197,107,181,218,139,  0, 54,132,135,135,143, 78, 77,
+ 77,157,118,242,228, 73,167, 33, 67,134,164,156, 58,117, 42,  8,192,206,240,240,240,192, 37, 75,150,244, 96, 24,166,218,209,130,
+ 20, 69,253,239,243,207, 63,239, 54,100,200, 16, 66, 76,234,181,103,207,236,162, 25, 70, 79,124, 57,119,  7,123,225,202, 69,146,
+ 97,244,196,224,225,159,115, 63,255, 30, 78, 78,252,108, 21,219,178, 67, 95, 68, 68, 68, 56,  4,  4,  4, 44,209,235,245,181, 26,
+173,242, 72, 85, 77, 17, 74,138,162, 48,122,244,104, 28, 56, 96,120, 15,170,113,128,167,185,187,226,198,210,141, 61, 21,  4, 93,
+ 84,201,100,189,129,224,227,161,121,233,143, 82, 94, 43,147,  5,  0,217,217,217, 91,  1,108,229, 56, 46,221,212,212, 20,133,133,
+133,213,253,254,100,225,225,225, 50,137, 68,130,222,189,123, 91,135,132,132,196,144, 36,185, 46, 37, 37,165, 70,199, 81, 93, 51,
+ 97,117,205,137,120,137, 81,135, 86, 74,  4,180,247,111,101, 22,109,177,216, 76, 70,151,220,109, 16, 35, 51, 39,  0,228,107,236,
+159, 92,123, 54,172,128,200,144,182,108,211,189, 53,204,105,211,128, 60,166,176, 90,163, 69, 82,212,157,252,220,188,119, 10, 10,
+181,184,114, 53,  2,195,135, 53,130, 70, 71,128,227, 72, 20, 21,107,  0, 74,  4, 18,192,136, 15, 70,129, 39,104,228,164,167,128,
+162,168,112, 48, 12, 94, 51,230,  4,  6,  6,190, 51,119,238,220,134, 51,103,206,196,204,153, 51,221,183,111,223,190,117,233,210,
+165, 51, 51, 51, 51,155,161,142,228,227,181,232, 52, 56,117, 96,193,140, 19,151,183,228,247,237,164,126,212,218,167, 52,242,213,
+218,  7, 57, 34, 17, 98,105, 10,217, 60, 95,181,155, 81, 64, 64, 64,215,202,235,127, 25,207,119,130,175,120,110, 80, 31,173, 70,
+ 13,157,223,110,213,210,239,179,121,115,231,153, 61,188,118,  1,179,191,217,192,123,181,233, 85,184,245,242, 29,109,145,169,199,
+ 59, 69, 89,177, 87, 13,245, 23,  0,240,246, 91,131,208,188, 73,187, 23,222,236,210,189, 52, 89,251,149,243,183,145,158,153,108,
+112,101, 91,102, 14,170,237,147,101,200,144,254,231, 81,171,213,121, 17, 17, 17,118, 73, 73, 73, 85, 58,190,123,120,120,128, 32,
+  8,132,134,134,226,198,141, 27, 24, 62,124, 56,104,154,134, 72, 36,194,197,139, 23,141,138,198, 84,138, 46,149,143, 58,236,227,
+226,226, 82,211,104,195, 58,181,212,106, 53,242,243,243,113,230,204, 25, 52,106,212,  8, 75,151, 46,133,147,163, 61,230,205,155,
+  1,142,227, 80, 80, 80,  0,150,101, 13,141,104,113,229,209, 34,142,227,144,153,153,137,134, 13, 27, 98,227,198,141,  8, 10, 10,
+ 90,146,154,154,122,210,216,125,116,117,117,181,100, 89,246,203,190,125,251,246, 26, 48, 96,  0,250,244,169,154,143,117,223,190,
+125,102, 71,143, 30, 93,246,253,247,223,191,173,211,233,150,103,100,100,100, 26,162,251,227,143,165,233,151,228, 29, 22, 98,246,
+144,  6, 24, 57,105, 23,214,172, 57,  6,169, 84, 90,165,226, 93,188,120,113,173, 38,134,227,121, 47,113,214,181,148, 25,179, 86,
+219, 45, 91, 22,130,144,144, 12,144, 36,  9, 71, 71, 71,144, 36,137,248,248,120,144, 36,  9,119,119,119,144, 36,137,228,228,228,
+242, 62,129,185,168,102,212, 99,245,119,225, 36, 74, 74, 74,144,152,240, 20, 73,113, 49, 80, 20,164, 65,105, 46, 71,238,131,251,
+104, 62,110,124, 69,254,167,191,153, 61, 90,173,118, 79,165,231,171, 79,157, 58,165, 37,  8, 98, 48, 74,251,105,148, 71, 52,150,
+ 48, 12,179,164, 38,145, 14, 29, 58,180,156, 59,119,174,168, 60,221,134,147,219,183,140, 78,167,227,  0,192,167,249,155, 85,220,
+126,108,108, 44,214,172, 89,131,226,226, 98,136,197, 98,177, 33,231,129,227,184,138, 17,134,213,153, 48, 99, 76, 22,  0,216,184,
+187,172, 15, 13,187,200,222,139,219,162, 14,143,254,197, 36, 53,129,  4,169,125,125, 77,214,243,145, 45, 23, 23,151,133, 28,199,
+241, 60,207, 47,168,244,150,212,205,205,237,242,217,179,103,109, 24,134,193,247,223,127,111,153,150,150,102,249,230,155,111,206,
+  6, 80,163,209,170,174,153,176,186,230, 68, 84, 26,117, 40,149, 74,173,181,218, 26,131, 39, 47,140, 58,100, 89,120,155,155, 89,
+ 34, 23, 73,208,216,234, 91,230,217, 48, 57,231, 82,199,223,117,122,214,170,137, 41,171,111, 72, 22,104,225, 44,183,  4,199,243,
+ 53, 14,141,214,232,245,191,220, 13,187,211,219,205,181, 17,117, 50,248, 18,250, 15, 28,  2,141,134, 68,137,158,  0, 65,137, 64,
+ 80, 98, 52,107,222, 10,141,155, 54,  7, 15,224,246,205,107,140, 86,175, 63,247, 58,149,189, 99,231, 41,195,  9,  2,235,192,115,
+124, 53,121,180, 26, 14, 28, 56,112, 25,128,207,234,210,177,235, 48,101, 56, 73,150,234, 84,206,163,245,249,148, 64, 60,184, 41,
+178,184, 20,182, 66,220,167,  3, 78,103,134, 16,144,203,254, 24,117, 40, 34, 95, 42, 53,199,191,197,112,213,109,180, 92, 93, 93,
+ 45,205,165,178, 31, 63, 29, 55,214,236,217,189,235, 72,139, 12,197,213, 75, 49,185,  7,143, 30,203, 41,206,206, 24,103,132,201,
+170,104,230,179,113,104,  0, 15,223, 23,141,150, 76,161,  4,  0,120,248,182,  3,101,106, 92, 26,161,234,162, 89,245, 49, 89,149,
+ 47,216,213,229,208,154, 56,113, 34,182,111,223,142,206,157, 59,195,203,203,171,226, 98,111,108,212,172,154,232,146,209,163, 13,
+ 43, 83, 88, 88,  8,119,119,119,108,219,182, 13,225,225,225, 48, 51, 51,195,240,225,195, 81, 88, 88, 88, 97,176, 12,237, 12,207,
+243,124,236,217,179,103,219, 14, 29, 58,148, 23,137, 68, 68, 94, 94, 30, 44, 45, 45,177,113,227,198,226,212,212,212,211,245, 48,
+ 89, 67,196, 98,241,140, 97,195,134, 81, 62, 62, 62, 72, 79, 79,135,185,185,185,158, 32,  8, 17,  0, 88, 90, 90,234, 77, 76, 76,
+ 16, 24, 24,136, 22, 45, 90,248,207,156, 57,179, 51, 77,211, 27, 83, 82, 82,118,213,246, 91, 34,  8,162,162, 66, 29,183, 46, 10,
+ 90,109,105,  5,189,105,211, 38,148,245,117,251,163,137, 32, 46, 14, 48, 96, 36,139, 66,161,128,151,151, 87,181,101,239,239,239,
+143,219,183,111,151, 54, 77,210, 52,236,236,236,112,245,234, 85,131, 70, 82,149, 39,130,140,136,136,128,175,135, 45,194, 67,206,
+194, 86, 46, 66, 11, 39,  7,184,248,119, 69, 76, 76,204,223, 25,205, 34, 80,218, 15,163,103,217,111,112,  7,128,137,149,158,111,
+  4,176,222, 24, 65,134, 97,120,146, 36,137,196,196, 68,157, 92, 46, 39,172,173,173,105,169, 84, 10,141, 70, 83, 97,184, 98, 99,
+ 99, 17, 28, 28,140,164,164, 36, 88, 91, 91,147, 22, 22, 22,208,233,116,185,134,232,123,123,123,195,193,193,161, 74,199,247,113,
+227,198,213,203,100,141,  6,252,182,127,187,188,129,148,164, 44,124,109,223,198,147,168,248, 18, 82, 11,217,127,193,100,  1, 64,
+ 94, 94,222, 86,  0, 91,203,159,219,218,218,142,161, 40,106,158, 70,163,177,184,120,241,162,165, 82,169, 36,118,237,218,165, 95,
+176, 96, 65, 30, 69, 81,185,  4, 65,172,253,251,205, 33, 34,179,242,227,220, 69, 86, 78,220,189, 18,254,218,180,196,217,141,115,
+ 69,141,148, 68, 83, 63, 12,204,120,120,101, 12, 19,215, 41, 61, 53,141,228,193, 69,214,114, 13,222, 49,123,238,226, 47, 99,162,
+238,184,201,204,101,152, 24, 56, 23,167,127, 61, 15,130, 20,225,242,181, 80,104,117, 44,178,114,242, 49,108,196,135,112,113,180,
+ 69,228,141, 51,153, 12,199,109,124,189, 76, 54,183,161,119,255, 49, 86, 82, 19,121,217, 57, 97,177,231,135, 25, 32,201,117,248,
+234,171,175,224,231,231, 55, 41, 34, 34,226,107,212,145, 71,139, 32,184, 13,205,186,142,176, 18, 75, 75,117,120,142,197,182,195,
+179,203,242,104, 77,199,198,173, 71,155, 53,245,120,178,168,182, 60, 90,175,145,201,170,188,174,221,104,185,187,187, 75, 77, 69,
+152, 32,162,232,153,159,126, 48, 64,153, 17,247,  0, 73, 15,239,148, 54, 47,232,212,186,180, 71, 15, 13, 73,133,222, 19, 85,243,
+119,240,181, 53, 93,149,148, 24,116, 71, 95, 69,179,188,194,125, 62,154,101,164,201,122, 65,179,178,217,170,156, 55,203,213,213,
+ 21,203,150, 45, 51, 36,143,214,243,199, 94, 78, 31,148,118,128,175,220, 25,190,143,129, 38,171, 90, 77,165, 82,137,236,236,210,
+ 12,  9,221,186,117, 67,183,110,127,140,103,208,233,116, 21, 81, 44, 51, 51,179,234, 34, 90, 47,104,154,152,152,204, 62,118,236,
+216,216,107,215,174, 13,253,226,139, 47, 68, 61,122,244, 40, 55,115, 42, 24, 54,183, 91, 21, 77,150,101,  3,207,156, 57, 67,113,
+ 28,135,109,219,182,225,246,237,219,188, 92, 46,159, 47,151,203, 55,152,152,152,176,106,181,122,226,248,241,227, 63, 92,180,104,
+ 17,233,239,239,143,235,215,175,147, 13, 27, 54, 28,  5, 84, 73, 98, 89,237,177,135,134,134,130, 36, 73, 48, 57,  9,152, 52,251,
+ 32, 76, 77,104, 68, 69, 69, 33, 39, 39,231,133, 36,166,134,156,207,202,145,146,242,197,223,223,191,162, 25,178,125,251,246,160,
+ 40, 10,119,239,222,173,169, 25,182,178, 38,111, 99, 99, 83,241,251, 16,139,197, 56,127,254, 60,190,249,230, 27,184, 89, 91, 34,
+247, 97, 56, 28,186,189,133, 94, 99,199, 99,248,240,225,160, 40, 10,214,214,214, 21,145, 95,  3,126, 75, 47, 67,101,205,177,190,
+190,190,163, 34, 35, 35, 93,154, 53,107,230, 24, 17, 17,209,221,207,207,207, 61, 60, 60,188,252,185, 20,134,245,205,169,208,188,
+117,235,214,145, 13, 27, 54,  4,142, 30, 61, 90,204,113, 28,251,236,217, 51, 61,  0,194,193,193,129,186,117,235, 22,119,242,228,
+ 73,168,213,106,184,184,184,144,206,206,206,196,185,115,231,184,135, 15, 31,134,242, 60, 63,215,144, 99,103, 89,182, 74, 26,135,
+242,199,251,246,237, 51,250,255,222,160,177,247,210, 30,111,250,184,102,165,220, 69,106,114, 28,216,124,165, 46,248,248, 41,141,
+145, 38,235,207, 46,163,191, 82,115,241,163, 71,143,156, 53, 26, 13, 36, 18,  9, 54,109,218,164, 91,182,108, 89,100, 86, 86, 86,
+ 23, 84, 63,162,188,138,102, 61, 71, 29,230,212,162,249,194,168,195,252,108,156, 62,126,226, 86, 91,197,192, 29,152,148,146, 89,
+209,177,145, 39,  8,235, 99,246, 77,186,200,219, 53, 75, 38,127, 94, 72, 22,178,170,211,181, 28,187, 86,173,213, 14, 25, 56,104,
+196,111,  7, 14,236, 87, 44, 88,184, 16, 87, 67,195,145,157, 87,  4,142,167,192, 17,  4,230,205, 91,  0,  7, 91,107, 20,164, 60,
+ 82,105,116,186,129,168,154, 67,235, 95, 95,238,  4, 65, 78, 62,119,114,215, 58,146,  0, 87,156, 30, 45,165, 10,227,228, 35,135,
+ 15,164,135, 12, 25,130, 99,199,142, 33, 34, 34, 98, 75, 45, 38,171, 66,147,231,201,201,225, 23, 15,174, 35,  0, 78,157, 25, 45,
+165,139,158,200, 71,125, 48,144, 30, 62,124, 56,126, 10,190,134,  3,167,158,108, 62,112, 10,167,240,122, 99,124,102,120, 51, 26,
+ 17, 93,154,120, 58,251,183,106, 42,163, 89, 53,146, 30,198, 33,167,184,  4,231, 30, 60,203, 35,121,178,222,185,117, 74, 47,144,
+ 98, 36, 36, 60,170,230,206, 74, 86, 86,161,151, 24,165, 73,146,100,149,104,214,203, 68,178, 42,239,167,189,189,125,149,233, 92,
+ 42, 87,220,229,125,128,234,145,218, 97,118, 66, 66,130,121, 66, 66,  2,120,158, 71,104,104,168,121,251,246,237,103,191, 76, 52,
+107,198,140, 25, 21, 81,171,231,215,213,189, 86, 23,101,157,210,131,244,122,253,225,153, 51,103, 78,106,223,190,125,239,133, 11,
+ 23, 18, 48, 98,  2,222,231,162, 57, 12,199,113,184,112,225,  2,142, 29, 59,198,234,116,186,  9,169,169,169,225,149, 54,249, 62,
+ 44, 44,236,220,160, 65,131,118, 69, 71, 71, 83,145,145,145,224,249,186,199,157,170,213,106,120,121,121,129, 97, 24,172,152,228,
+138,194,194,102, 96, 24,  6, 44,203,194,212,212,180, 34,138, 87,217, 60,215,245, 59, 98, 89,246,  5,163, 21, 26, 26, 10,138,162,
+208,165, 75, 23,220,185,115,167, 34,162, 85, 87,  4, 74,167,211, 37,216,219,219,219, 47, 94,188,184, 98,191, 50, 51, 51,113,246,
+236, 89,116,232,216,  9, 77, 38, 76, 68, 74, 74, 10,214,174, 93, 11, 39, 39, 39, 44, 93,186, 20, 57, 57, 57, 96, 24,230,175, 14,
+167,191, 19, 25, 25,233,242,193,  7, 31,100,132,135,135,187,  4,  7,  7, 91,  6,  4,  4,152,142, 24, 49, 34, 35, 60, 60,220,133,
+ 32,136, 78, 48,178, 19, 52,199,113,115,230,205,155,247,235,210,165, 75,103,127,246,217,103,237, 71,143, 30, 45, 18,137, 68, 92,
+114,114, 50,179,127,255,126,194,203,203,139, 20,139,197,196,153, 51,103,184,155, 55,111,222, 96, 24,102,  5,128,203,198, 68,156,
+ 43,155, 44,138,162, 12, 53, 89, 85,152,102, 39, 29,101, 70,102,118,217,176,105, 25,233,227,225,162,219,189,255,108,226,229,235,
+143, 30, 83, 26,102,218,143,181,164,  6,120,157,161, 40,234,144,175,175,239,152,201,147, 39,155,244,233,211, 71,186,104,209,162,
+252,194,194,194,154, 76, 86, 53, 55,204,127,201,168,195, 31,230,124, 17, 60,237,243,102, 99, 60, 63,118,104,128,144,226, 12,228,
+210, 20,105,110, 73,162,149, 59,133,194,172, 88,229,169,223,118,198,  3,168, 43, 47,219,173,176,251, 17, 61,155, 54,107,121,116,
+197,210, 21,118,243,103,205, 20, 29, 13,254,  5, 60,163, 67,232,197,139, 80,136, 89,254, 97, 88, 72,186, 70,167, 29,128,215,112,
+ 10,158,212,171,235, 15,  0, 56, 97,109,109,125,111,236,232,209, 94,190,190, 35, 32,151,203,113,228,200, 17,236,249,254,123, 54,
+  8, 24, 42,  5,238,  4,214,145, 79, 47,227, 70,133,206,221,241, 99,199,122,183,106,245, 49,228,114, 57, 14, 31, 62,140, 93, 65,
+ 65,  6,235,252,203, 41,207, 12,127, 26,127,100,136,175,163,143, 22, 73, 20,222,120,244,172, 40,244,209,179, 34,112, 60,207,241,
+188,134, 36,145, 88,172,211, 45,125,244, 36,185, 94,166,160,188,233,112,201,183,147, 95, 93,155, 71, 37,243, 83,223, 33,221,213,
+152,172,164,202,115,164, 85,174,164,107,122,172,215,235,147, 12,148, 95,238,230,230,246,194,107,245, 15,253,242, 70,153, 44, 67,
+243,104,  1, 64,118,118,118, 42,128,249,215,175, 95,223,215,187,119,239,241,  0,146,235, 89, 70,219,186,118,237, 58,  1,  0, 69,
+ 16,196,150,148,148,148,240, 23,254,240,169,169, 49, 78, 78, 78,171, 60, 60, 60, 38,150,222,152, 18,219,234,168,200,159, 52,107,
+214, 76, 87, 93, 89,212,244,156,227,184, 58,203, 40, 47, 47, 15,237,218,181,123, 97, 78, 75,158,231,241,236,217,179,242,136, 83,
+197,185,175,205,192, 21, 21, 21, 77,156, 50,101,202, 86,145, 72,228,  6,128, 40, 55,185, 44,203, 82,235,215,175,151,177, 44, 75,
+  1, 32, 72,146,100, 68, 34, 81,201,177, 99,199, 24,134, 97, 18, 52, 26,205,196,191,248,  2,113,152, 40,157,138,161, 56, 50, 50,
+210,167, 44,146,149, 20, 17, 17,113,247,192,129,  3, 74,  0,  7,235,169,123, 89,165, 82, 93, 94,182,108,153,255,166, 77,155,230,
+ 76,156, 56,177,221,240,225,195,233,110,221,186,225,244,233,211,236,133, 11, 23, 66,213,106,245,114, 99, 12, 86, 89, 89,230,187,
+186,186, 86, 24,174, 58,254,203,181,118,228,181,113,151,110,248,240, 19, 39,217,182,229,103,139,178, 82,180,215,244, 69,218,185,
+ 59,129,  8,252,135, 73, 79, 79,255,  2,192,130,181,107,215,166,180,104,209, 66, 42, 22,139,181,134,154,172,191, 16,134,203, 43,
+122,247,187, 94,239,159,232, 58,111,138, 71,175,238, 93,228,174, 13,236,156, 31,198,165, 35,246,250,233,226,123,167,190,125,202,
+107,114,251,  3, 48,164,231,250, 77,141, 78,215,104,198,204, 25,147, 36, 34, 81,111,150,101,155,247, 56,119,156,167, 40, 42, 92,
+171,215,159, 43,107, 46, 44,121,141,139,124,201,170, 85,171,188,124,125,125,113,228,200, 17,156,219,187, 23,195,178,178,112,158,
+162, 40, 82, 44,182, 57,165,211,173,134, 97,  6,105,201,154, 53,107,188,253,252,252,112,232,208, 33,156,217,181, 11, 67,235,167,
+ 83, 83, 93,215, 22,128,178,236,105, 22,128,104,  0,173,  1,152,  0,208,160,116,106, 39,219,202, 85, 88,217,123,229,239, 95, 34,
+  8,226,207,236,  8, 91,119,102,248,231,137,136,125,218,250, 85,239,133, 90,173,206,241,242,242, 50,106,204,181, 94,175,175,181,
+ 13,151, 97,152, 36, 79, 79, 79,131,163, 22,134,152,162,156,156,156, 54,127, 98, 97,188, 84, 95,172, 42,149,  8,199, 61,117,116,
+116,228,202, 43,253,234, 76, 88,117,175,241, 64,188, 49,223,147,150,150, 22, 13,224,243,250,238,103, 74, 74,202, 81, 24, 48,105,
+180,161,219,  1, 64,110,110,238, 43,159,204,151,224,249,228, 69,139, 22, 25,101,176,193,243,181,153,207,240,162,162,162,246,134,
+124,183, 78,167,195,223,200,161,178,133,140,136,136, 24, 79, 16, 68, 31,148, 54,  9,108,193,171,201,230,125,185,160,160,224,242,
+202,149, 43,253,183,109,219, 54,141,231,121, 20, 20, 20,  4, 25,107,176, 42,238,158, 51, 50, 78,191,170,  3,207, 73,215,254,190,
+127, 75,210, 91,234, 60,221,180,237, 69,218, 93, 16,168,  8, 70,241, 60,255,191,145, 35, 71,118,  0,176,243,101,197,106, 24,117,
+248,178,196,115,185,249, 45,206,207,248,102,236,121, 75,179,190, 96,105, 31,104,201, 83,208,102,159,  6,240, 35, 12,235,230, 80,
+113,188, 12,199,173, 97,180,218, 53,149, 42,151,255, 66, 57, 91,251,249,249, 77, 27, 51,102, 12, 22, 44, 88,128, 51,171, 87,235,
+ 62, 33,136,124, 17,192,255, 90,122,163, 73, 18,192, 44, 67,117, 70,141, 26,133,  5, 11, 22,224,231, 21, 43,234,171, 83, 27, 74,
+130, 32,130,  1, 96,246,236,217,115,151, 45, 91,102, 53,103,206,156,230,203,151, 47, 95, 90,246,252, 65,249,251,101,117, 93,192,
+156, 57,115,154, 86,122,191, 16,192,173, 63,249,124, 86,155, 25,254,207,166,167,160, 41,104, 10,154,130,166,160, 41,104, 10,154,
+130,230,203,192,243,124,223,210, 85,205,235,154, 30, 87, 90,255, 45,208, 16, 16, 16, 16, 16, 16, 16, 16,248, 23, 82, 57,138, 85,
+159,247, 95, 33,229,125,180, 42,179, 13, 40, 29,214, 93,147, 43, 53,102,212, 67,125,156,109,136,160, 41,104, 10,154,130,166,160,
+ 41,104, 10,154,255, 57,205,186,180, 95,248, 60,207,243,125,  9,130,  8,230,121, 62,160,166,117,185,177,122,254,113,165,245, 43,
+235,118, 80, 13,229,125,179, 94,232,163,245,103, 35,132, 85,  5, 77, 65, 83,208, 20, 52,  5, 77, 65, 83,208,124, 41,202,155,  0,
+  1,240,179,103,207,158,243, 15,108, 58,116, 44, 51, 89,149, 23,  0,181, 52, 29,242,252, 97, 42, 57, 25,230, 18,137, 92, 12,  0,
+ 90,173, 74,231,236,140,  2,130, 24,242,119, 78,120, 43,240,239,164,124,184,119,250, 43,222, 86, 64, 64, 64, 64,224,191, 65,102,
+121,164, 10, 64, 38,  0,162,236,185,182,108,157, 89,102,200,158,127, 92,229,253, 63,145, 84,212, 16,201,162,107, 50, 89, 89, 89,
+114, 91,154,206,245,102,217,146,198,  0, 64,211,100, 84, 86,150, 85, 12,207, 31,206,170,143,217,178,181,179, 11, 19, 81,148,179,
+ 33,219,234, 89, 54, 57, 43, 61,189,106,234,120,130,120, 29, 12,158,161, 38,226,101,204,198,159,110, 84,108,109,109,237,237,237,
+237,223, 51, 55, 55,239,152,151,151,119, 51, 51, 51,243,167, 90,230, 61, 92, 70, 16,152, 89,250,187,194, 74,  0,115,106,145, 54,
+102,219,231,241,146,203,229,147,  8,130,240, 43,251,131, 69,168, 84,170, 77,  0, 30,253,  7, 47, 72, 38,  0,  6,208, 52, 61,202,
+214,214,182, 93, 90, 90,218, 34,  0,245,205,230, 77,  3,152, 97,105,105, 57,204,210,210,210, 51, 39, 39,231,113, 65, 65,193, 33,
+  0,107,  0,212, 57, 84,122,209,103,142, 29,187,245,233, 54,255,194,153, 11, 75, 22,125,159,122,253,133,247,103, 56,218,244,238,
+213,121,193,133, 83,215, 22,207,221,152,146, 99,228,190,145,101, 11, 80, 58, 58,146,199,139,201, 94, 95, 22, 17,128,126,  0,186,
+  1,184,  0,224,148, 33,199, 93,  3, 29,  0,204, 45,219,231, 53,  0,206,255,195,127, 71,166,246,246,246, 43,  0,244,163,105, 58,
+ 50, 57, 57,121,  2,128,164,191,121,159,104,  0,109,  1,248,161, 52, 13,199, 45, 24,150,194,161, 78,108,108,108,  2,104,154,158,
+ 84,150,218,101, 83,118,118,118,240, 63,181, 96, 36, 18, 73,144,131,131,195,199,106,181, 90, 69, 16,  4, 95, 57,223, 35,195, 48,
+ 73, 89, 89, 89,109, 94,183,139, 26, 65, 16,183,254,225,187, 56,161,154,215,106,206,163,149,156, 12,115,154,206,245,206, 72, 11,
+ 31,150,146,122,127, 40,  0, 56, 57, 54, 63,100,231,208,236, 96,114,178, 68,231,224, 51, 80, 33,146,211,155, 40, 74,212,178, 68,
+171,177, 21,209,162, 44, 29,163,191, 75,106,249, 73,105,209, 63, 85,155,108, 81, 68, 81,206, 79, 99,206,219, 49,186, 28,136,100,
+ 78, 16,153,184,213,184,183, 78, 78, 78,245, 58, 74, 43, 43, 79, 51,157, 84, 54, 77, 36,162,122,113, 60,227,199,115,  0, 73,136,
+ 34, 24, 86,255,155, 88,163,249, 46, 55,247,113, 97,125,207,160,143, 13, 28,120, 96, 56,  8,244,  2,143,115,  4,112, 32, 58, 27,
+105, 70, 72, 24,106, 34, 94,198,108, 84,254,236, 90,  0, 95,188,234, 95,146,179,179,179, 85, 64, 64, 64,208, 55,223,124, 99,162,
+ 80, 40,136,132,132,132, 62,179,102,205,122,243,246,237,219,159, 39, 39, 39,167, 60,111,250,  8,  2, 51, 57,142, 39,  1,128, 36,
+137, 89, 74,165,157,156,162,168, 23,114, 27,177, 44, 43,207,204,204,152,204,113, 60, 81,182,237, 76,158,199, 58, 67, 12,163, 76,
+ 38, 27,225,215,172,229,231, 43, 86,173, 81,216,219,217,153, 50, 44,167,139,127,246, 84, 62,127,246, 23,237,227, 98, 31,173, 43,
+ 41, 41,217, 95,159,255, 53, 69, 81,195,164, 82,105,  0,  0,223,178,215, 30,106, 52,154, 96,150,101, 15, 26, 90,161,219,219,219,
+ 95,162, 40,170,129, 49, 95,204,178,108, 66,122,122,122,151,122, 22,209, 16, 55, 55,183, 31,187,118,237, 42,111,215,174, 29, 36,
+ 18,  9, 22, 44, 88, 48, 35, 53, 53,181, 46,163, 69,  3,152, 33,151,203,135,153,154,154,122, 22, 21, 21,197,169,213,234,163, 18,
+137,164,231,186,117,235, 92, 59,119,238,108,150,158,158, 78, 80, 20,101,255,243,207, 63,127, 20, 20, 20,212,135, 97,152, 30,117,
+ 85,114,249,113,252,124,105, 63, 95,255,252,184,243,243,  1,188,243,252,251, 76,137,108, 20, 79,185,  6,168,249, 59,137,101,230,
+195, 96,147, 37, 18,137,214, 57, 56, 56,140, 41, 41,205, 21,192, 63, 95,225,  0,128, 86,171,205,205,203,203,243,169,207, 95, 30,
+192, 56, 75, 75,203, 49, 95,126,249,165,213, 59,239,188,131,189,123,247,126,186,125,251,246,220,130,130,130,255,161, 52, 17,102,
+180,145,154, 51,211,210,210,222, 21,137, 68,132,171,171, 43,165, 86,171,141, 49, 90,222, 40,157,132,249, 22,128, 77, 40, 77, 93,
+208, 29, 40,253,191,  3, 88, 89,110,220, 72,146,220,228,227,227,243,222,195,135, 15, 55,  3, 88, 82,223,255,186,131,131,195,214,
+141, 27, 55, 14,237,223,191, 63,149,153,153,233,220,162, 69,139,125,105,105,105,254,175,224, 50, 50, 86, 42,149, 78,111,222,188,
+121,147,232,232,232,152,130,130,130, 53,101,231,179,182,255,148, 11,128,158,150,150,150, 61,230,205,155,167,  8,  8,  8,192,182,
+109,219,222,221,190,125,123, 81, 97, 97,225,111, 40,237,211,243, 82, 38,144,166,233, 73, 73, 73, 73,182, 60,207,195,209,209,113,
+ 18,128,127,164,209, 34, 73,114,221,160, 65,131,198,236,219,183, 79,254,244,233, 83,185,179,179,115, 69,242,108,130, 32,234, 93,
+127, 10,188, 52,219, 42, 25,174,186,243,104, 73, 36,114, 49,203,150, 52, 78, 73,189, 63,244,205,174,235, 45,  0,224,210,197, 41,
+ 67,237, 28,154, 70, 72, 36,242, 24,169,185,236,216,160,126, 61, 91,190, 31,208,149,112,113,180, 67, 82,106,134,253, 15,  7,206,
+188, 29,124,230,252, 49,148, 38, 16,171, 22, 70,151,  3, 19, 93,  8,162,175,124, 15,219,110, 41,216,240,115, 18,174,223,139,135,
+ 42, 63, 11, 13, 28, 76,176,106, 90,111, 56, 88,201,235,119,235,101,231,213,157,161,165,  7, 63, 24, 49,210,226,189,  1,190, 34,
+119,  7,  7,240,188, 20, 49,113, 69,157,126, 57,123,190,237,209,195,251, 39,153,138,188,134, 21,103, 60, 50,248,226,214,202, 17,
+ 38,197, 58, 12,160, 41,226,163,206,109,154,244, 24,241,174, 63,217,196,183, 17, 34, 31, 60,236,125,226,247,208, 85,228,181,  7,
+191, 49, 44,191,219, 84,140,227,119, 82,107, 77,232,247,130,225,232,209,163,167,191, 84, 42,173,146, 60, 73,163,209,136,127,251,
+ 45,164, 67,125,204, 70,249,119,104,181, 26, 82, 36,146,128, 36,137,207,253,252,154,249,102,101,101,157, 39,  8,226,199,148, 20,
+227,162,  5, 83,  0, 73, 46, 77,183, 38,165, 82, 71, 86,171,181,  1,  0, 66, 34,201,141, 39,201,102,243,230,206, 85, 80, 20,197,
+101,103,103, 67,165, 82, 17,227,199,143,151,197,197,197, 13, 74, 78, 78,254,190,142, 59, 18,108,223,190,221,219,209,209,241,133,
+217, 99, 83, 83, 83, 37,253,251,191, 87,159,162,247,110,222,162,213,244, 51,103,126,245, 45,200,201, 45,217,190,118,107,152, 94,
+ 38,215, 52,244,245, 17,109,218,182,203, 98,194,152, 15,167, 68, 69, 61,184, 11,227,230,171,115, 51, 49, 49, 57,182,122,245,106,
+191,238,221,187,139,236,236,236,144,158,158,142,135, 15, 31,250,253,254,251,239,  3,118,237,218, 53, 67,173, 86, 15,  2, 12,154,
+ 16,213,235,183,221, 63,218,153, 90,219,128,213,235,225,212,188, 85, 69,126,179,216,223,207,130,209,233,192,233,245,240, 13, 24,
+ 80, 22, 77,230,225,235,235, 91,223,172,187, 78, 77,155, 54,221,179,116,233, 82,177, 70,163, 65,104,104, 40,206,159, 63,207,165,
+166,166,214,149, 16,151, 38,  8,226,236,194,133, 11, 93,186,116,233, 98,150,149,149,  5,150,101,109,143, 31, 63, 62,169,101,203,
+150,230,174,174,174,146,221,187,119,163,168,168,  8, 12,195, 88,123,122,122, 90,143, 24, 49, 66,187,123,247,238, 25,  0, 86,212,
+ 20,201, 42,136,227,231,167, 18,158,111,251,180, 30,133, 52,226,215,183,167,191,141, 95,204,223, 32, 42, 34, 91,111,123,122,154,
+ 21, 36,203,103, 41,204,155, 89, 23, 36,135,204,122,219,211,115,251,175,143, 13,186, 25, 34,203, 42,155, 15, 14, 28, 56, 32,127,
+248,240,161,220,215,215, 23, 28,199, 85,100,224, 47, 79, 56,235,229,229, 85,159,243,184, 60, 48, 48,112,214,208,161, 67,209,188,
+121,243,138,164,168, 95,125,245, 21,102,205,154,101,117,233,210,165, 25,251,247,239,159,241,211, 79, 63,173,  0, 48,219,200,104,
+ 76, 57,198,150,241,215, 79,158, 60, 25,114,236,216,177, 15,103,206,156,233,  5, 96, 50,128,  5,217,217,217, 93,203,162, 49,146,
+ 50,163, 53,118,198,140, 25,159,204,158, 61, 27,239,190,251,238,130,208,208,208,111,235, 25,229,163, 24,134,121,183,127,255,254,
+148, 94,175,135,169,169, 41,244,122,253, 27, 47, 27,148,  0,176,113,226,196,137,159,  4,  6,  6,194,202,202, 10,122,189,222,251,
+192,129,  3,219, 23, 44, 88,208, 17,192,184, 26,246,117,212, 39,159,124, 50,120,228,200,145,104,211,166, 13,104,186,244, 52,174,
+ 94,189, 26,139, 23, 47, 86,156, 61,123,118,192,238,221,187,  7,156, 56,113,226, 40,170, 78,219,101, 20, 28,199,129,166,105, 36,
+ 38, 38,194,206,206, 78,202,113,220, 25,130, 32,182,229,228,228,252,244, 15,170,204, 87, 14, 25, 50,228,131,125,251,246, 41,  0,
+ 96,213,170, 85,152, 62,125, 58,236,237,237,161, 80, 40,  4,171,243,207,137,104, 77,168, 51,162, 85, 23, 42,149,170,213,156,207,
+ 62,  2, 73,150,222, 53, 54,106,232,134,101,115, 39, 16, 39,130,207,180,170, 53,  6, 47,115, 66,244,149,239, 33,117,157,  6,141,
+158,193,141,123, 79,112,110, 85,159,210,218,242,157,121,208,232,122,148, 87, 54,214, 18, 19,147,149, 90,150,189, 10,  7,135, 80,
+ 60,123,150, 89,151,201, 82, 58,216,  7,111,217,178,194,196,239, 13, 31,232, 24, 61,146, 51,146, 65, 16, 82,184, 56,155, 97,236,
+168,119, 68, 93,187, 58,217,126,253,245,214,211,105, 28,  6,170,178, 30,213,153, 48,212,219, 22, 59, 91,249,121, 13, 29,209,183,
+139,180,153, 95, 83,136,165, 38, 21,239,181,110,211,  6,173,219,180, 33,103, 23, 21,246,186,121, 43,172,215,145,179, 55, 52, 42,
+253,179, 67, 49, 89, 24, 93,199, 69,166,194,112, 76,157, 58, 21,246,246,246, 85, 54, 72, 79, 79,199,239,191,255, 86,237,103,140,
+184,144, 85,124,199,183,223,126,107,150,155,155,251,206,142, 29, 59,222,226, 56,238,219,180,180,180, 43,134,136,140,  4, 26,228,
+ 75,165, 61,198,172, 89,195,181,124,239, 61,202,210,193,129,228, 88,150, 72,121,252,216,102,237,247,223,119,203,137,141, 53, 41,
+182,182,206,201, 85,171, 85, 49, 49, 49,144,201,100,  4, 77,211,109,171,145, 74,231,121,172, 36, 73, 98, 22, 65, 16,144, 74,101,
+ 49,129,129,129,119,202,222,107,112,234,212, 41,121,191,126,253, 84,  0,158,  2,128, 84, 42,115,166, 40,210,187, 52, 19, 59, 86,
+ 26, 98, 48, 77, 77, 77, 63, 91,178,116,133,105, 65, 78,158, 90, 87, 92,172, 87,154, 43,  8, 66, 97, 70, 21,228, 23, 22, 38,167,
+102,106,230, 45, 90, 76, 77, 28, 59,242,179,226,226,226, 73,134,154,172, 22, 45, 90,220, 60,118,236,152,157,141,141, 13,242,242,
+242,144,157,157,141,155, 55,111,130,227, 56, 12, 26, 52, 72,218,169,125,187, 86,115,231,205,191,158,152,156,220,209, 16,179,101,
+106,109,139, 85, 93, 90,150, 86,214, 79,179, 43,202,103,219,144,128,138,109, 22, 39,229,151, 71,231, 94,102, 10,169,142, 61,122,
+244, 16,  3,192,184,113,227, 10, 10, 11, 11,151,  1,216,135,186, 51,250,207,152, 63,127,190,115,195,134, 13,221,247,237,219,135,
+162,162, 34,  0,176,107,216,176, 33,188,189,189,217, 11, 23, 46,192,219,219, 27,102,102,102,184,116,233, 18,174, 95,191,142, 54,
+109,218,152,137,197,226,161, 58,157,174, 90,163,213,173, 79,183,249,210,126,190,254, 62,173, 71, 65, 97,238,136,237,251, 15, 34,
+ 58,108,151,191, 70,247,112,190,152,189, 56, 82,205, 75, 71,103, 38, 40,102, 55,104,211,213,166, 81,211,247,224,222,250,142,109,
+  9,123,249,201,252, 94, 13,151,211,178,146, 93,139,214,164,102,215,100,178,  0,172, 26, 52,104,208,144,  3,  7, 14, 88,  2, 64,
+120,120, 56,210,211,211,161, 84, 42, 33,147,201, 32, 18,137, 42,230, 39,173, 39,163, 55,109,218, 84, 97,218, 24,134,169,152,  5,
+ 64, 46,151,227,205, 55,223, 68,203,150, 45,241,211, 79, 63,141,174,193,104,117,105,223,190,253, 94,119,119,119,215,202, 47, 22,
+ 23, 23, 99,248,240,225,  0,128,174, 93,187,246, 48, 49, 49,225,203, 13, 97,106,106,106,209,173, 91,183,122,  1,  8,173,193, 89,
+170,147,147,147,241,229,151, 95, 34, 62, 62,254,211, 45, 91,182, 60,  3, 32,147, 72, 36, 21,247,199,  0,188,155, 54,109,186,110,
+250,244,233,136,139,139, 67,100,100,228, 77,212,191, 41,149, 53, 53, 53,141,213,235,245,109, 24,134,129, 90,173,198,192,129,  3,
+101, 71,143, 30, 77,167, 40, 42, 42, 43, 43,235, 67,148,246, 73, 49, 20, 25,128, 53,129,129,129,159,204,156, 57, 19,191,253,246,
+ 27, 78,156, 56,129,145, 35, 71, 98,218,180,105, 80, 40, 20, 99,166, 77,155,118, 29,165, 19,154, 63, 79,143, 77,155, 54,129,101,
+217, 23,254, 27, 50,153, 12, 93,186,116, 65,147, 38, 77,112,226,196,137, 30, 47, 97,180,220,187,116,233, 34,225, 56, 14,197,197,
+197,184,112,225,130,194,196,196, 68,225,226,226, 50, 30,192, 63,198,104,185,187,187,  7, 30, 56,112, 64, 81,185,245, 71, 42,149,
+162,210,239, 64,224,239,143,104,213,122,135, 85,129, 86,171,210,209, 52, 25,229,228,216,252,208,165,139, 83, 42,154, 14,  1, 50,
+ 74,171, 85,233,  0,128,229,120, 20,168, 24,152, 72, 73, 60, 77, 43,196,131,199, 89,213, 73, 85, 25,162, 41, 50,113,131,180,170,
+  8,231,172,  0,  0, 32,  0, 73, 68, 65, 84,221, 83,240, 60, 15,173,142,133, 38, 63, 13,203, 78,171,240, 48,169,  4,218,226, 92,
+104,117,165,221,176,108,109,109,233, 51,103,126,153, 30, 18,242,251, 39,255,251,223,255,168, 36, 11,139,200, 66,160, 85,117,154,
+ 86, 86,158,102,156, 68,114,104,243,150,  5, 38, 60,245, 24, 49,  9,197,104,228,210, 14,182,150,174, 72,203, 42,198,213,200,159,
+ 17,245, 40, 24, 13, 29,221, 49,237,179,183,101, 75,150,238, 59, 40,102, 60,220,242,242,226, 11,106,218,207,242,187,168,173,191,
+198,128,201,121, 12, 54, 59, 14,108, 97,202, 11, 27, 40,148,110,104,221,221, 25, 74,215, 55,164,163,167, 45, 30,  5, 84, 49, 90,
+149, 53,211,  9,130,220, 76,146,196, 39,  4, 65,160,121,243, 22, 73,107,214,172,169, 46, 21,184,174,121,243, 22, 73, 20, 69,186,
+148, 94,216,201, 77, 60,207,165,215,177,159, 85, 76,141, 68, 34,157, 89, 26,246,119, 76, 60,125,250,180,110,200,144, 33, 88,189,
+122,181,100,214,172, 89,243, 40,138, 26, 87, 77,243, 94, 21,205,129,128,155,229, 27,111,244,254,246,234, 85, 94,164,215, 19, 57,
+ 55,111, 22,228,165,166, 50,105,133,133,146,195, 81, 81,239,126,252,197, 23, 18, 87, 87, 87, 92,  9, 14,182,201, 44, 46,230,243,
+ 52, 26,117, 94, 94, 30,207, 48,204,205, 26, 52,231, 40,149,118,242,237,219,183,123,  7,  6,  6,222, 73, 77, 77,157,  3,  0,142,
+142,142,203,  0, 52,  1,240,180,210,107,216,178,229, 96,242,248,241,227, 99, 50, 50, 50,230,212,182,159,149,104,106,167,180,147,
+239,223,186,251,190,181,153,  9,169,116,113, 34, 69,150,150, 52, 35, 49, 17,115,128,186,161,235, 27,166,  0,154,214,240,217,231,
+ 53,  9, 19, 19,147, 99, 39, 79,158,180, 19,137, 68, 96, 89, 22, 74,165, 18,241,241,241,200,203,203, 67, 97, 97, 33,158, 68, 61,
+132,135,171, 43,190,158, 61,203,113,242,172,217,199, 84, 42, 85,155,231, 42,179, 23, 39, 64,214,235, 94,136,236, 85, 55,139,193,
+243,205, 94,  6,150,123,101,226, 19, 18, 18,160, 80, 40,224,231,231,167,184,122,245,234,229, 90, 76, 86,229, 73,128,135,118,238,
+220,217,108,223,190,125,104,211,166, 13, 44, 44, 44,112,225,194,  5,132,135,135, 67,167,211,145, 69, 69, 69, 80, 40, 20, 88,190,
+124, 57,220,220,220, 80, 88, 88,136,167, 79,159,218,136, 68, 34,219,231, 50,218, 87,104, 94, 56,115, 97, 73,126,220,249,249,105,
+196,175,111,111,223,127, 16,227, 71, 12,131,  3,255,248,178,197, 27,196,146,222,253, 58,127,197, 83,174,  1,166,102,205,173,188,
+252,250, 65, 44, 81, 96,242,204,197,136,137, 56,101,165, 42,188,255, 41,193, 38,186, 46, 90,115,120,106, 53,199, 78,  0, 32, 93,
+ 93, 93, 63, 62,124,248,176, 89, 69,232,133,162, 42,230, 60,172, 60,  9,124, 45, 19,190,215,121, 62,  9,130, 64,124,124, 60,236,
+236,236,160, 80, 40, 42, 38, 16,127,248,240, 33,110,220,184,129,242,217, 40,106,208,252, 48, 36, 36,196,213,212,212,180,202,  6,
+ 60,207, 35, 43, 43, 11, 12,195, 64, 46,151,131,101, 89,232,116, 58,232,245,122,148,148,148, 40,154, 52,105, 50, 73,175,215,135,
+ 86,167,201,113,220,231, 67,135, 14,237, 28, 26, 26,234,249,253,247,223, 67,171,213,174, 74, 75, 75,195,224,193,131,193,113, 28,
+122,244,232,209,129,231,249,232,121,243,230,  1,  0,166, 79,159,174, 47, 46, 46, 14,172,207,177,151,209,164,117,235,214,158,191,
+253,246, 27,252,253,253,161,209,104,176,122,245,106,243, 45, 91,182,152,239,222,189, 91, 57,115,230,204, 31, 51, 51, 51,251,212,
+161, 73,  0, 88,229,224,224,240, 73,183,110,221, 76,202,230, 48,197,174, 93,187,240,245,215, 95, 31,  0, 48,239,151, 95,126, 89,
+120,226,196,137, 81, 31,127,252, 49,190,254,250,235,105,121,121,121, 59,106,210,124,242,228,  9,148, 74, 37,204,205,205, 75, 47,
+150, 58, 29,238,222,189,139,115,231,206,161,113,227,198,134, 28, 83, 77,251,233, 62,104,208,160, 31,247,239,223,111,150,152,152,
+136, 75,151, 46,193,195,195,  3, 42,149,202,144,185, 97, 67,254,132, 10,187, 70, 77,181, 90, 93,146,144,144,160, 88,177, 98,  5,
+ 28, 29, 29,225,238,238, 14,153, 76,  6,130, 32,160,215,235,107,155, 94,173,206,253,236,218, 21,116, 86,178, 85,127, 11, 75,171,
+ 79,121,158,167,243,243,115,183,234,144,119,228,241, 99,104,255,194, 99,255, 55,211, 10,192, 29, 84,157,243, 48,181,194,104,  5,
+  7,  7,243,  1,  1,  1, 68,249,218,217, 25,  5, 89, 89, 86, 49,118, 14,205, 14,218, 57, 52, 45,155,247,139,140,162, 40,171, 24,
+123,123, 85,  1,  0,232, 24, 30,215,162,242,112, 63, 54, 13,225,177,105, 48,149, 26, 22,124,209,232,152,210, 30,171, 60,143,146,
+162, 63,110, 90,117,170, 92,104,116,165,221, 61,180, 26, 21,242, 51, 35,137, 33,  3,123,201, 62,249,100, 34, 28, 29,157,149, 53,
+233,233,164,178,105,147,167,191,107,105,109, 41, 66,240,213, 95,209,161,241, 64,200,164, 34,100,231,151,  0,  4,240,232,241, 57,
+128, 51, 67, 68, 76,  2,218, 55,149,163, 79,111, 95,197, 79, 71,162,191,  0,176,192,144,253,101,146,110, 66,236,245, 14, 68,172,
+ 30,250,172,104,112,121,207,  0, 83,  7,168,  9,  5,178, 83,159, 33,234,242, 81,131,238, 25, 57,142,251,212,214,214, 54,111,222,
+188,121,221, 26, 53,106,164,155, 52,105,210,189,103,207,158,125,254,220,221,202,119,155, 54,109, 66,108,108,108,242,183,223,126,
+123, 33, 43, 43,107,190,145,  5, 61,155,231, 17, 84,214, 20,151,117,252,248,241,214, 23, 47, 94,156, 22, 20, 20,100, 63,101,202,
+ 20,201,148, 41, 83,198,  2,248,166,182,230,194,  2,169,180,231,183,151, 46,241, 76, 82,146,102,207,250,245,146,141,215,174,205,
+211,113,156,147,173,157, 29,209,169,125,251, 98, 57, 73,102,101,167,167, 51, 74, 79, 79, 42,254,220, 57, 27,222,196, 36,229,151,
+ 95,126, 41, 40, 42, 42,170,113,234, 28,138,162, 84,213, 53, 23, 86,135,163,163,163,182,186, 62, 92,181, 84,136,  5, 28,207,235,
+ 44, 27, 54,228,123,247,232,216, 40, 54,250,241, 99,153,165, 37,229,213,200,195,231, 65, 84,252, 77,158,101, 75,  8,130, 40, 48,
+168,173,132,162,134,  5,  5,  5, 53, 51, 55, 55,  7,199,113,176,176,176, 64,102,102, 38,180, 90, 45, 10, 10, 10,160, 45,204,135,
+ 54, 63, 31,225,207,226,209,185, 91, 55, 12,121,187,183,239,238,227, 39,135,177, 44,123,160,214,246,188,230,173, 42, 34, 89,139,
+ 27,216,252,209, 22,148,152, 87, 97,186, 86,180,242,130, 88,161, 64,175,207,103,191,204, 31,253,206,233,211,167,127, 30, 52,104,
+208,187, 95,124,241,  5,153,154,154,250,107,124,124,124,103,  0,145,181,125, 72,161, 80,188,145,149,149,133,162,162, 34, 88, 88,
+ 88, 32, 40, 40,  8,246,246,246, 80,169, 84,184,117,235, 22,239,226,226, 66, 92,184,112,  1, 46, 46, 46,200,206,206,134, 78,167,
+131, 90,173, 78,211,106,181, 53, 54,151,151, 53, 15,190, 51,253,109,252, 18, 29,182,203,223,153,120,114,107,232,140,174,177,209,
+225, 81,  9,103,207, 93,253,134, 41,145, 37,230, 37,133,204,106,216,246,142,237,167, 95,126,141, 13,171, 22, 34, 58,244, 82,142,
+189, 91,193, 70, 19, 66,179,179,182,253, 45, 46, 46, 46,137,138,138, 50,187,119,239, 30,  8,130,128,133,133,  5,228,114,121,181,
+102,171, 30,144,149, 35, 80,197,197,197, 16,139,197,176,177,177,193,142, 29, 59, 42, 42, 94, 15, 15,143,218, 52,182,246,234,213,
+107,152,155,155,155, 89,229, 23,219,182,109,139,137, 19, 39, 98,243,230,205,184,118,237, 90,149,249, 52,211,210,210, 82,245,122,
+125,109,199,157,151,158,158,254,246,192,129,  3,195, 46, 95,190,108,190, 99,199, 14, 48, 12, 83,237,178,125,251,118,220,184,113,
+ 99,  1,128,168,122,254,142, 26, 15, 30, 60,248,210,222,189,123, 45, 51, 51, 51, 81,254,219, 40, 46, 46,  6,203,178,240,241,241,
+ 33, 24,134,169,171,223, 27, 73, 81,212,241,245,235,215,247, 27, 63,126, 60,104,154,134, 86,171,197,250,245,235, 49,107,214,172,
+244,178,155, 82, 29,128,121, 59,119,238, 28,245,222,123,239,161, 69,139, 22,190,231,207,215,220,179,163,168,168,  8, 69, 69, 69,
+ 16,137, 68,112,112,112,192,146, 37, 75,160,213,150, 94, 86,188,189,189, 43,254,198,  0,182,122,123,123,247,139,137,137, 89,141,
+210,190,107, 47,224,224,224, 48,144,231,249,  9, 44,203, 22,250,251,251,219,236,223,191,223, 44, 57, 57, 25, 97, 97, 97, 88,176,
+ 96, 65, 46,199,113, 44,199,113,132, 90,173,126, 98,103,103, 23, 38,149, 74, 77, 84, 42, 85, 78,118,118,246, 82,  0,191,254, 93,
+ 53, 57, 65, 16,132, 72, 36,194,184,113,227, 64,211, 52, 76, 76, 76, 80, 82, 82,  2,189, 94, 95, 97,230, 97,100,179,116,163, 70,
+ 10, 27, 26,226,241, 86,102, 77,166, 13,153, 26,160,116,116,114,134,165,185, 20, 15, 31, 70,118,254,253,183,115,235, 37,116,244,
+ 22, 78,171,223, 18,253, 52,255, 79,159,236,254,121, 47,242, 47, 53, 90, 47,204,121, 72, 87, 95,152, 67, 88,158, 63,156,149,156,
+ 44,209, 73, 36,242,152,242, 40,151,189,189,170,128, 32,134,176,202,166,253,193,232,244,101, 23, 10,190,108, 49,208,104,233, 89,
+196, 70, 71,224,242,217,147,176, 85, 37, 35,235, 73, 75, 64,220, 12, 90,117, 62, 74,180,186, 50, 83,194,226, 94,216,111, 40,200,
+207,129, 95,155,  0,128, 36,111,212,164,103, 97, 67,  4,116,106,221,156,138, 77,136, 64, 91,239,247,225,233,226,143,103,169,  5,
+200, 43,210, 32,183,160,  4, 45,253,102, 35, 51, 87,141,  2, 85,  9, 34, 99,119,195,217,201,147, 36,232,199, 61, 12, 53, 90,154,
+200, 99,208, 68,157,128,216,189, 51, 36, 62,239,129,114,239,130,132,251,231,113,239,151,181, 72,122,112,  5, 60,199,254,159,189,
+235, 14,139,226,106,191,103,102, 59,187, 75,239, 69,177,130, 98,239, 13, 69,108,104,236, 29, 75,172,209,168,216, 27,106,172, 81,
+209,104, 98,239, 37,  6,123, 55, 98, 23, 21, 11,118, 64, 64,172,244,178, 82,151,182,125,103,103,126,127, 80,130, 72, 89,208,228,
+251,126,249,246, 60,207, 60,187, 51, 59,115,246,157,123,239,220,123,230,189,247,190, 23,246,174,109,245,125, 72,118, 92,191,126,
+189,109,167, 78,157,216, 61,122,244,104,126,245,234,213,230, 18,137, 36,172, 80, 96, 52,239,209,163, 71,115,107,107,107,108,219,
+182, 77, 65, 16,196,142,106,102,118,177,  7, 44, 45, 45,237, 25,128,117,231,207,159,223, 49,117,234, 84,216,216,216, 52, 77, 73,
+ 73, 41,247,194,116, 14,167,249,248,245,235, 25, 14,139,197,156,220,185,147,187,250,250,245, 95,127, 63,114,132,219,205,211,147,
+ 96, 24,  6,161,161,161,194,141, 59,119, 10, 71, 15, 28, 24, 23,159,150, 70,  5,  5,  7,107, 36, 73, 73,121,105, 50,217,106,137,
+ 68,242,233, 63, 81,178,181, 90,237,227,152,216, 24,199,214,237, 90, 88,135, 68,197, 68,122,117,235,216,145, 36, 73,242,109,116,
+124,176,181,181,137,240,214,205, 91, 26,173, 86,251, 88, 31, 46, 62,159,223,175, 91,183,110,108,169, 84, 10,  7,  7,  7,164,167,
+167, 35, 57, 57,185,192,227,144, 35,133, 38, 39,  7,218,220,108,232,100,249,136,121,254, 12, 45,234,214,225,159,225,243,251,201,
+229,242, 10,133, 86,209, 91,102, 89, 11, 93, 23, 29,227, 25, 27,131, 39, 22,131,168,122,183,225, 64, 51, 51,179,197,217,217,217,
+ 87,  1,172,213,104, 52, 62,139, 23, 47,110,179,125,251,118,171,117,235,214,153, 76,153, 50,229, 76,126,126,126, 11, 20, 44,170,
+ 90, 94,  3,246,145,162, 40, 75,  0,182,129,129,129,176,177,177, 65, 78, 78, 78,145,167, 69, 45,151,203,  5,153,153,153, 80,169,
+ 84, 80,171,213, 48, 49, 49,193,139, 23, 47,178, 40,138,186, 92,153,113, 38,245,136,181, 42, 77,212, 79,150,110,162, 20, 13,101,
+238,145,150, 69, 75, 87,253, 42, 89,  3,224,215,222,117,235, 30,208,208,247, 99,222, 71, 92, 54,143,125,126, 47, 43,229,189,172,
+238,193,171, 49, 21,141,209, 98,  0,208,  4, 65, 48,174,174,174, 72, 79, 79,  7,139,197,130, 80, 40,132, 88, 44,198,146, 37, 75,
+176, 99,199,142,234,  8, 45,129, 72, 36, 90, 79,146,228, 72,146, 36,173,117, 58, 29,124,125,125,209,191,127,127,240,120, 60,104,
+ 52,154, 98,143,102,145,151,170, 18, 79, 71,232,147, 39, 79, 76,158, 60,249,172,218,242,180,178,178,186,163, 82,169, 16, 29, 29,
+141,139, 23, 47,118,  5, 16, 84,197,188,142, 14, 13, 13,237,237,238,238,254, 71,171, 86,173,234, 49, 12,131,166, 77,155,194,219,
+219, 27,254,254,254,  8, 11, 11, 67, 78, 78, 14,125,235,214,173,223,  1,108,174,106, 27, 94,152,190, 13,134, 14, 29,250,240,248,
+241,227,230,153,153,153, 80, 40, 20,144,201,100, 56,115,230, 12, 58,117,234,  4, 43, 43, 43, 28, 59,118,140, 98, 24,166,162,188,
+ 39, 73,146, 60,184,119,239,222,254,147, 39, 79,198,174, 93,187,112,242,228, 73, 12, 24, 48,  0, 35, 71,142, 68,122,122,186,237,
+166, 77,155,198, 21,118, 19,174,244,246,246, 70,126,126, 62,158, 63,127, 30,165,231, 51,143,236,236,108,100,103,103,195,200,200,
+168,228, 51, 70,  0,240,223,178,101,203,168, 57,115,230,160,110,221,186, 43, 99, 98, 98,182,160,140, 89,162, 52, 77,255,152,156,
+156,108,206,102,179, 45, 41,138, 66, 98, 98, 34, 94,188,120,129, 25, 51,102,100,101,101,101, 77,  5, 16, 15, 96,217,164, 73,147,
+214,206,155, 55,175,184, 44,205,155, 55, 47,224,234,213,171,189,255,105,111,142,171,171, 89, 99, 30,139, 63, 91,154,199,178,148,
+ 74,165,197,117,135, 90,173,134, 74,165,250,204,147,197,229,114, 44,219,180,168,121, 69, 33,207, 91,250,250,125,118,185, 11,164,
+187,213, 51,109, 38, 20,153,206,233,212,185,219,152, 94,189,  7,177, 40,173, 22, 55,110, 92,198,161, 67,187,225,233,238,138,186,
+245,155, 98,230,172,217,166, 42, 53,229,123,235,214,245,197,102, 79, 30, 92,207,203,205, 94, 82, 17,231,255, 56,174, 20,138,171,
+ 43,101,118, 29,150,165, 32, 11, 67, 56, 72, 11,119,173,204,205,205,119,234,116, 58, 79, 19, 19, 19,208,217,239,240,250,197, 83,
+100, 73, 57, 80, 41,116,160,153,  2,177,165,151,112, 81,169,113,255,198, 37,108,221,242, 43, 50, 51, 51,225,222,165, 43,242,217,
+ 53, 80,179, 70, 77, 40, 21,242,194,135,  6,208,168,181,176,182,117, 70, 72, 72,152, 54, 87, 38, 43,183, 66,226, 10, 52,110, 53,
+109, 93,161,210,116,128,128,199, 67, 78,158, 26,210, 66,145,117,236,236,  8,168,228, 10, 80,106, 13, 40,181, 22,214, 53,135,162,
+161,109, 55,208,186,203,141,171,148,124,180, 14,154,216,251,208,196,222,135, 81,135, 89,248,211,111, 84,169,134, 84,191,117,119,
+211,211,211,211, 34, 35, 35, 47,135,134,134, 14, 30, 49, 98,  4,238,222,189, 59,  5,192,180,194,238,155, 41, 35, 70,140, 64,104,
+104, 40, 34, 35, 35, 47,167,167,167,167,125,139,156,231,241,120, 10,149,170,160,141, 21, 10,133,130, 74,206,117,108, 51,100,  8,
+153, 19, 18,146,187,229,209,163,149,  7, 14, 30,228,246,232,222,157,208, 82, 20,104,157, 14,245, 93, 92,136, 94,189,122,137,252,
+ 79,159,182,100,105,181, 79, 22,250,248,  4,238, 25, 59, 54,239,153, 76,166,239, 64,243, 90,133, 93,134,  0, 80,171,130, 99,122,
+ 67,165, 82,109,255,241,135,  9, 61,130,238, 63,172, 81,179,134,163,201,141, 91, 65, 97,124, 35, 30, 89,183,118, 61,150, 52, 39,
+139,189,102,229, 82, 35,149, 74,165,175,104,117,179,178,178,194,167, 79,159,240,225,195,  7,168, 84, 42,104,181, 90,208,114, 25,
+212,210,108,168,115,178, 64, 40, 21,224,235,116, 80,102,164,162, 86,221, 58,192, 95, 51, 18, 43,237,138, 42, 75,104, 21,125, 10,
+ 76, 76,192, 21,137, 65,114, 56,122, 47,142, 14,160, 85,219,182,109, 79,159, 59,119,142, 59,113,226,196,118,183,111,223,222,  9,
+ 32, 62, 57, 57,185,251,242,229,203,159,237,220,185,147, 63,117,234,212,  6,155, 55,111, 30,  7, 96, 95,121, 36, 74,165,242,244,
+149, 43, 87, 70, 59, 59, 59,219,134,135,135, 67,169, 84,130,166,105,244,233,211,  7, 40, 24, 91,  3,  0,120,251,246,173, 66,169,
+ 84,166, 69, 68, 68,228,198,199,199,107,160,199, 44,193, 85,219, 37,143,115, 63,221, 31, 98,107,231,248, 68, 96, 84,171, 54,147,
+ 31, 50,120,238, 48,199, 77, 91,206, 38, 43,175, 71, 71,231,253,212,179,206,  6, 89,222,171, 25,102, 78,249,187,174,  7,196,232,
+ 51, 16,190,120,118,161,165,165, 37,216,108, 54, 56, 28, 14,184, 92, 46,  8,130,192,172, 89,179,176,127,255,254,202,186, 14, 63,
+ 19, 89,198,198,198,145,171, 87,175,118,154, 58,117, 42, 87, 32, 16, 64, 42,149,226,216,177, 99,152, 52,105, 18, 14, 29, 58, 84,
+230,248, 23, 61,186,148, 74,123, 75,231,140, 29, 59, 22,106,181, 26,222,222,222, 56,112,224,192, 28,157, 78, 23, 84,141, 71,250,
+ 73, 88, 88,152, 75, 88, 88,152,  9,128,  1, 35, 71,142, 60, 50,116,232, 80,  4,  5,  5,225,242,229,203, 93, 81, 48,233, 67,  1,
+192, 15,128, 77,225,103, 69,207,167,200,214,214,118, 55, 77,211,  3,172,173,173,195, 92, 93, 93,155, 28, 63,126,220, 44, 45, 45,
+173,104,242,  3, 98, 99, 99,113,248,240, 97,201,193,131,  7,115,117, 58,157, 37, 73,146, 87,178,179,179,151, 84, 32,216, 14,110,
+217,178,101, 66, 97,119, 32,206,157, 59,199,252,250,235,175,196,242,229,203, 33,149, 74,225,233,233,137,189,123,247,206,206,207,
+207,111,254,235,175,191,254, 48,124,248,112,172, 89,179,  6, 50,153,108, 75,101, 47, 43, 21,136, 47,  2, 64,199, 45, 91,182, 56,
+207,153, 51,  7,231,206,157, 67,171, 86,173,140, 98, 98, 98,246,  0,152, 92, 86,254, 49, 12,131,152,152, 24,200,229,114, 60,124,
+248, 16, 43, 87,174,148,150, 16, 89,179,167, 77,155,182,118,246,236,217, 88,191,126, 61, 19, 30, 30,158, 54,116,232, 80,219,253,
+251,247,179,234,215,175, 63, 91, 46,151,255, 99, 66,171, 65,125,139, 13,109, 90,117, 94,108,239, 88, 31,199,142,159, 64, 86, 86,
+ 86,113,154, 20,165, 11,195, 48,200,203,203,195,167, 79,159, 96,106, 98,140, 77,155,215,126, 55,125,202,132, 26, 40,  8,131,241,
+165,203,178,174,249,230,161, 35, 39,206,247, 30, 61,  1,225, 97, 47,225,127,100, 31, 34,194, 67,139,249, 40,173,  6,239,162, 94,
+224, 93,212, 11,216,218, 57,163, 87,143,174,196,168, 81,163,250,140, 29, 61,210, 26,192,223, 22, 58,226,255,177, 55, 11,248, 50,
+142,214,254,207,132, 86, 37,238, 58, 43,115,115,243,200, 83,167, 78, 89,186,187,187,179, 40,138,194,245, 27, 55, 48, 99,218,247,
+ 24, 55,214, 23, 26,152,131, 82,115, 65,115,  5,122, 89,162, 80,200,193,128,129, 76, 38, 67,112,112, 48, 24,154,130,255,254, 95,
+193, 48,116,177,208,  2, 24,168, 53, 26, 56,214,108,128,221,  7,214, 81,224,112,158, 65, 91,118,232,154,220, 76,150, 78, 75, 49,
+ 72, 78, 75, 64,130, 36,  2,166,198, 53,193,230,212, 68,102,182, 28,108,210, 14, 90,229, 91,232, 10,175,149,203,146,160,208,124,
+ 93,254,233,202,240,158, 50, 85,168,116, 21, 10,197,209,163, 71,143,126,247,219,111,191,241,250,246,237,235,122,246,236,217,142,
+  0,208,183,111, 95, 87, 19, 19, 19, 28, 61,122, 84,173, 80, 40,142,126, 67,143, 79,183,182,109,219, 66, 42,149, 34, 54, 54, 54,
+172,194,123, 83,171, 45,197, 54, 54,172,180,187,119,181,233, 82,105,141,110,221,186, 17, 90,138,  2, 73, 16,200,202,201, 65,124,
+ 92, 28,204,204,204,136,200,183,111,197, 59,102,206,188,224,218,164,  9,187,104, 70,162, 62,184,124,249,178, 16,  5,227,178, 42,
+ 60, 86, 69,200,210, 82, 63, 77,240,241,241,185,112,244,232, 49,211,212,180,212,119,124, 30,143, 18,139,  5, 14, 99,199, 76,103,
+103,103,103,143,  6,144,175, 47,153, 84, 42, 69, 76, 76, 12,140,140,140,192,229,112, 64, 43,228,208,201,242,161,204, 74,  7, 75,
+163,  6, 79,167,131,133,144,143, 26,182,182,168,105,109,165, 23,231,135, 59, 55,139,  7,190,151,236, 46,220,212,214, 13, 60,145,
+ 24, 60, 99, 49,166,  7,220, 43,124, 27,229,  2,203,127,214,135,214,202,209,209,241,207,227,199,143,115,211,211,211, 17, 26, 26,
+ 26,  6, 32,  7,128, 49,  0, 58, 42, 42,234,118, 68, 68, 68,191,194, 89,119,149,205, 22,251,245,252,249,243, 61,221,221,221,169,
+218,181,107,139,210,210,210,106, 72,165, 82, 90, 34,145,124,230, 18,186,121,243, 38, 63, 47, 47, 79, 70,211,244,133, 66,145, 85,
+105,252,162,185,195, 28,  5,193, 33,152,229,225, 85,171,169,137, 85, 51,100, 81, 33, 77,159,132, 73,102,205, 29,230,184,125,203,
+217,100,165, 17,161, 58, 66,232, 18,107,176,  5, 74,125,  7, 49, 51, 64,193, 88,169,224,224, 96,196,199,199, 35, 38, 38,230, 51,
+ 65, 53,101,202, 20,248,251,251,235,229,209, 18,137, 68,235, 87,173, 90,229, 52,103,206, 28,110,  9, 81,  4, 31, 31, 31,228,228,
+228,224,192,129,  3,240,241,241,169,114,195, 95, 10,117,186,117,235,214,215,222,222, 30,153,153,153,176,179,179,131,187,187,123,
+255,160,160,160,218,  0, 98,171, 89,238,167,123,121,121,173, 93,189,122, 53,180, 90, 45, 38, 77,154,132,247,239,223,159,126,255,
+254,253,214,154, 53,107,206, 90,180,104,145,173,173,173, 45, 70,140, 24, 33,162, 40,106, 72,121, 36, 22, 22, 22,126,251,246,237,
+ 27,221,183,111, 95, 82,163,209,116,185,115,231, 14,226,226,226,160, 86,171, 65, 81, 20, 62,126,252,  8, 31, 31, 31, 73,225,236,
+198,143,122,216, 53,113,217,178,101, 19,102,205,154,133,141, 27, 55, 98,213,170, 85,191,155,154,154, 54,105,209,162, 69,203, 85,
+171, 86, 97,225,194,133,112,118,118,134,165,165,101,195,229,203,151,187,205,155, 55, 15,219,183,111,199,202,149, 43,127,  7,112,
+184, 58,  9, 65,211, 52,177, 97,195,134,230, 91,182,108,177, 47, 18, 89, 36, 73,226,212,169, 83,  8,  9,  9,233, 31, 29, 29, 93,
+214, 53,123,237,236,236,166,216,219,219,243,110,221,186, 37,118,118,118,  6, 69, 81,218, 66,145,181,163,102,205,154, 51, 62,126,
+252,136,190,125,251, 34, 58, 58,250, 40,128,113,166,166,166,178,121,243,230,  9,141,140,140, 76,229,114,249, 63,213,120,131, 69,
+ 18,227,215,175, 89,136,231, 33,111,113,254, 60, 23,207,159, 63,135,173,173, 45,248,124, 62, 24,134,129, 74,165, 66,122,122, 58,
+180, 26, 21,154, 54,174,131, 63, 14,110, 64, 90, 90, 58, 64, 18,229, 14,185, 33, 72, 98,204,132,239,  7,227,193,195, 27,216,179,
+103, 31,242,243,101,229,188,124, 11, 80,223,213, 13,142, 14, 54, 72, 76, 74,  4, 65,194,234,239,188,215,255,231, 93,135,197, 85,
+ 16,244,  9,239, 80, 18,102,102,102, 91, 79,158, 60,105,233,233,233,201,146,201,100,160,105, 26,157,221,221, 49,107,206, 28, 92,
+ 62,126, 28, 46,237,188, 65,168,197,160,132,250,205,122, 80, 42,228,104,212,178, 35,134,143, 24,137,132,248,120,120,245, 27, 10,
+165, 82, 94,252,134, 81,228,209, 82,171, 53,176,178,169,129,155, 55,111,178, 48,105,210,107,236, 40,219, 41,161,211,240, 94,189,
+251,168,236,148,173,  8, 65,240,115,127,104, 84, 26, 52,109,186, 28, 26,218, 18, 54, 78, 83,160,213, 94, 68,110,250,157,130,110,
+ 12, 75, 79, 36, 37, 36,128,100,113, 35,171,155,130,180, 44,253,171, 42,221,156,156,156,156,152,152,152,179,193,193,193, 99,134,
+ 12, 25,130,155, 55,111,254,  0,  0, 67,134, 12, 65,112,112, 48, 98, 98, 98,206,230,228,228,228,124,139,220,182,183,183, 31,208,
+181,107, 87,239, 54,109,218, 32, 32, 32,  0, 12,195, 60,208,235,193,230,112, 24,146, 36, 65,211, 52,  8,  0,153,217,217,120,255,
+254, 61, 50, 51, 50,160,213,106, 33,203,207,167,221, 92, 93,243, 25,154, 54,174,138, 61, 37,103, 24,162,140, 89,135, 69,199,170,
+113,171,241,207,158, 60, 74,200,203,207,183, 54, 55, 51,207,227,241,120, 58,105,118,118,206,235,200,112,181,158,141, 67, 17,162,
+ 34, 34, 34,154,164,164,164, 32, 33, 33,  1,148, 44, 15, 44,149, 26,164, 74,142,238, 29, 59,192,  8, 12,  4,160,193,161,181,224,
+176, 56,200, 43,152,157, 87,105,119,135,174,196, 75, 66,145,200, 34,  8,162,160,187, 80, 36,  2, 79,108,252,153,135, 75,159,242,
+196,231,243,143,159, 57,115,198,222,209,209, 17,107,214,172,129,147,147, 83, 67,  7,  7,  7,185,169,169,169,145,173,173, 45, 26,
+ 53,106,132,142, 29, 59,226,218,181,107,208, 35, 13, 40,134, 97,122, 61,120,240, 96,254,163, 71,143,134,139, 68, 34, 98,230,204,
+153,236, 62,125,250,128,207,231, 67, 46,151, 67, 42,149,226,196,137, 19, 25, 52, 77, 23, 77, 74,177, 20, 10,133,135,  9,130,136,
+149,201,100,115, 74, 19,254,241, 91, 83,135,180, 44,122, 18,147, 47, 28,236,225, 85,171,105, 55,175, 30,168,227,210, 13,221,188,
+ 18,  0, 96,131,  5, 59,206,251,151,101,102, 23,204,140,137,195, 55,175,223, 90,233,238,209,109,217,226,252,187,107, 55,238,207,
+174,116, 60, 29, 65, 16,160,105,250,179,216, 65,165,127, 31, 55,110, 28, 78,157, 58, 85,105, 58,146, 36, 57,114,234,212,169,220,
+ 82,158,103, 36, 39, 39,163, 95,191,126, 24, 50,100,200,103, 66,203,202,202, 10,118,118,118,136,139,139,  3,128, 76, 61,203,213,
+172,137, 19, 39, 18, 10,133,  2,147, 39, 79,198,129,  3,  7,224,237,237, 77,  4,  5,  5,205,  2, 48,167,170,133,157, 36,201, 77,
+139, 22, 45,154,239,227,227,131,172,172, 44, 92,189,122, 21,125,250,244,193,169, 83,167,172,175, 94,189,186,222,211,211, 19, 44,
+ 22, 11,  1,  1,  1,160, 40,170,194, 88, 95, 92, 46,119, 64,223,190,125,201,196,196, 68,112,185, 92,180,110,221, 26, 73, 73, 73,
+144,203,229, 72, 78, 78,198,236,217,179, 63,101,102,102,118,213,247, 57,226,114,185,115,102,205,154,133,147, 39, 79,194,215,215,
+247,  8,128,201, 57, 57, 57,195, 31, 61,122,116,114,224,192,129, 72, 78, 78,198,133, 11, 23,176,114,229, 74, 98,220,184,113,216,
+181,107, 23,102,207,158,253,123,161,215,169,188,130,159,151,150,150,102, 90,175, 94, 61,164,166,166, 34, 63, 63, 31, 23, 46, 92,
+176,185,118,237, 90,109, 71, 71, 71,147,152,152, 24,221,207, 63,255,204,155, 51,103, 14,182,110,221,138,208,208, 80,248,251,251,
+163, 91,183,110, 84,116,116,116,153, 94,178,194,144, 13, 23, 24,134,185, 37, 18,137,144,151,151, 87,244,220, 45,240,245,245,245,
+241,243, 43,112,178,167,164,164, 96,252,248,241, 99,  3,  3,  3,105, 79, 79, 79, 33,151,203,133, 82,169,148,253,147,173, 54,173,
+163,  1,208,168, 93, 67,140, 27,151, 15,226,101, 88, 52, 94,134, 69,128,199, 47, 24,  4,175, 80,200,209,178,105,125,180,107,221,
+ 22, 41,146,100, 28,245, 63,  8, 11, 43,199, 10,235, 17,134, 97,192,101,235,224,230,106,135,227,254,251, 16,112, 53, 16,254, 71,
+ 79, 20,143,121, 99,179, 57,104,209,178, 29, 90,183,118, 71,116,204, 71, 28, 60,184,  7,214, 54, 53, 12,157,131,213, 68,113,215,
+ 97,201,207, 82,202,191,155,187,187, 59, 43, 63, 63, 31, 74,165, 18,159, 62,125, 66, 92, 92, 28,204,204,205, 16,157, 18,139,174,
+ 66, 13, 62,209,185,136, 10,139,212, 17, 44, 78,104,101,127,216,215,163,  5,224,209,  2, 51, 38,122, 87,240,202,202, 64,100, 98,
+ 85,208,117, 67, 81, 31,176,125, 59, 85,158,208,162,116,218,219, 55,110,221,105, 59,113,220,  0,206,205, 59,  7,160, 85,211, 80,
+104, 77, 33, 83,170, 33,211,112, 64,154,246,  1, 50,130,192, 98,243,209,190,121,125, 92, 56,127, 77,195, 80,218, 64,189, 19,200,
+182,  9,168,212,136, 18, 66, 43,173, 84,191,131,133,222, 93,135,197, 13,175, 78,119,234,216,177, 99,131, 58,116,232, 32,244,244,
+244,172, 87,216,112,106,142, 29, 59, 38, 47, 12,134, 89, 85,124, 22, 13,222,206,206,174, 37,151,203,245,238,211,167, 79,203,  9,
+ 19, 38,224,245,235,215, 56,122,244,232,187,250,245,235,223,149, 72,202,159,145,205,226,241, 50,243,211,210,204,196,181,107,179,
+205,141,141, 83,174, 93,189,234,220,163,103, 79, 34, 33, 33,  1,153,153,153, 80, 42,149,  8, 13, 11, 99, 56, 44, 86, 18, 97, 98,
+ 66,190, 13,  9, 33, 89, 60, 94,102,121,222,198, 50, 16, 87,201,172, 67,191,234,122,183,106,216,155,215, 91,233,251, 99, 29,165,
+ 74,217, 36, 55, 55,151, 98,115, 56, 28, 39, 59,179,248,183, 31,245,175, 19, 85, 42, 85,192,237,219,183,  7,245,232,209,131,255,
+238, 85, 40,168,156, 28,168,115,164,224,210, 58, 88,180,108, 14,150, 70,  5,168,181,112,116, 99,160,204, 22, 34,232,233, 91,173,
+ 74,165,170, 52,168, 97,145,208, 34, 75,  9,  3,158, 88, 12,190,177,  9,248, 98,113,105,193, 80,217,155,156,176, 87,175, 94,221,
+219,183,111, 15,134, 97,176,127,255,126,104, 52, 26,158, 70,163,129, 90,173,134, 70,163, 65,110,110, 46,252,253,253,177,123,247,
+238, 71,  0,126,215,227,246, 41, 35, 35,163,129,  4, 65,216,176,217,108,185,181,181,181,232,212,169, 83,197,225, 38, 90,180,104,
+  1, 99, 99, 99, 46, 10,131, 66,218,216,216,112, 14, 29, 58,100,214,191,127,255,251,101,118,119, 52,109,184,176, 14,101,238, 33,
+ 48,170, 85,219,196,170, 25,234,184,116,  3,  0,244,236, 55, 17,117,234,215, 68,110,198,171,218, 74, 69,220, 96, 46, 91,106, 30,
+185, 61,249,181, 81,223, 38, 19,100,105,247,222,163,236,233,253,101, 54, 20, 36, 73,150,219, 29,171,143,200, 42,208, 44,164,117,
+209, 56, 31,  0,200,204,204,132, 68, 34, 65, 84, 84, 20, 26, 52,104,128,172,172, 44, 56, 58, 58, 66,173, 86,163, 77,155, 54, 80,
+ 40, 20,216,178,101, 11, 30, 62,124,248,  8,192,108, 61,254,195,200,197,197,101,124,203,150, 45,113,245,234, 85, 60,127,254, 60,
+249,198,141, 27,142,238,238,238,168, 93,187,246,132,216,216,216,165,133, 93,125,250, 66,228,238,238, 62,211,199,199,  7, 17, 17,
+ 17,248,241,199, 31, 51, 19, 19, 19, 47,156, 62,125,122,242,202,149, 43, 73, 47, 47, 47, 72, 36, 18,108,218,180, 73,247,240,225,
+195,205,  0,214, 84,146,142,111, 18, 19, 19,157,148, 74, 37,178,178,178, 64, 81, 20,228,114, 57,174, 93,187,  6,127,127,255,212,
+ 66,145,245, 65, 95,227,154, 55,111,222,136, 36, 73,156, 60,121, 18,  0,126, 66, 65,196,254, 11,131,  7, 15, 78,254,249,231,159,
+ 29,151, 44, 89,130, 31,126,248,  1, 26,141,  6, 27, 55,110,196,146, 37, 75,174, 20,138,172,138, 42,209,223,236,236,236,166,252,
+248,227,143, 13,231,205,155,135,224,224, 96,155, 23, 47, 94,180, 14, 13, 13, 69,141, 26, 53,144,153,153,201,182,180,180,196,214,
+173, 91, 49,119,238,220,115,  0, 50, 30, 63,126, 60, 50, 38, 38,198, 15,192,166, 74, 68,251, 94, 71, 71,199, 41, 12,195, 48,114,
+185, 60,206,215,215,119,211,186,117,235, 48,119,238, 92, 68, 70, 70, 34, 39, 39,  7,198,198,198,196,162, 69,139,198,255,244,211,
+ 79,152, 52,105, 18, 35,147,201,118,255,211, 13, 53,195,232, 32,151, 70, 64,167, 50, 71,139,166, 13,208,162, 73, 45,220,184,243,
+ 18,  0,208,125,168, 59,228,178, 60, 28, 57,178, 31, 31, 62,188,  7,155,195,129,153,133,157, 62,158, 64,168,115,223, 32, 91, 35,
+ 65, 15,207,214,232,227,213, 21,191,255,113, 10,148, 86,131,201, 19, 71, 67,154,157,141, 63,254, 56,136,232,152,143, 96,115, 56,
+176,180,250,251,  3,161, 86,164, 69,254,223, 11, 45, 61,186,159, 64,211, 52,146,147,147,241,226,197, 11,196,198,198, 66, 40, 20,
+ 66, 65,233,232, 61,183, 31,210,  4,193, 77,162, 25,230, 17, 67, 21, 71, 41,254,146, 67,167, 75, 46, 17,177,214,212,220,220,156,
+167, 82, 41, 64, 81,218, 18,173, 10,  1, 16,  0,151, 13,216, 59,212, 65, 98, 66, 34,163, 84, 42,239, 85,248,  6,165, 82,110,189,
+116,225,140, 79,199, 78,238, 86,125,186,175,198,133,139,203, 33,205,205,133, 82,195,129, 76,169,129, 92,  9,152, 89,184,162, 77,
+211,102, 72, 73,201,196,171,231, 65,249,108,149, 92,159,129,162,239,119, 44,155,232, 50,113,198, 66, 24, 57,119,130, 42,234,  2,
+232,252,212, 98,143,150, 64,108, 14,139,154,110,200,150,169,112, 38,240, 37, 80,133,165, 94,210,210,210,228, 44, 22,235,152,143,
+143,207,198,151, 47, 95, 56,  1,192,203,151, 47,147, 36, 18,201,226,180,180,180,170,250,164,139,162,193, 19,  2,129,209,203,250,
+245,235,167,180,110,221,218,116,240,224,193,176,178,178, 66,104,104, 40,252,252,252,222,104, 52,154,133, 65, 65, 65, 21,118,245,
+168,213,234,228,151, 23, 47,154,116,253,254,123,179,133,253,251,111,242,241,241,217,186,102,205, 26,142,139,139, 11,161,213,104,
+ 16, 30, 30,206, 28, 63,118, 76,187,123,201,146, 45, 60,145,136,253,236,210, 37, 14,165, 82, 37,255,167, 11,177,163,163,163,135,
+123,151,206,110,155,127,219, 14,165, 34, 31, 79,131,175, 64, 42, 77,199,190,253,231,221, 28, 29, 25,143,228,228,228, 32,125,  5,
+240,225,195,135,231,183,107,217,178,101,221, 26, 53, 16, 30, 31, 11, 30,173,  3,151,162,192,210,168, 64, 82, 74,212,104,194,128,
+ 32,141, 33,249,148,139,117, 39,207, 70,232, 35,140, 27,126, 55,  0,107,146,114, 64, 16,  4,126,237,208,  4, 60, 99, 49,184, 34,
+ 49,166,255,121,167, 88, 24,  4,172, 89,  2,158, 88,140,122,237,244, 10,  8, 47,191,123,247,238,139,240,240,240, 54, 77,154, 52,
+193,252,249,243, 17, 23, 23,  7,154,166,145,154,154,170,148, 72, 36,201,233,233,233,113, 40,136,255,115,160,146, 70,172,164,234,
+112, 12, 10, 10, 42,238,110,  8, 12, 12,132,131,131,  3, 76, 77, 77,145,155,155,139,169, 83,167,154,173, 88,177,  2,  0,240,226,
+197, 11,148, 20, 40,165, 17,254, 50,106,115,118, 30, 35,101,242, 67,  6,103, 81, 33, 77,187,121, 37,162,103,191,  9,184, 21,240,
+ 59,238,220,184, 13, 11,118, 92, 44, 68,121,215, 50, 98, 51,114,147,100, 46,123,221, 90, 77,102, 73,100, 55,246,206, 28,240,142,
+101,111, 79,159, 89,178, 39, 55,187, 34, 91, 93, 92, 92, 96,107,107, 91, 60, 70,139,205,102, 99,210,164, 73, 96, 24, 70, 95,145,
+ 85,216,214,208,233, 74,165,210, 86, 32, 16,224,211,167, 79,248,248,241, 35,162,163,163,139, 67,  7,208, 52,173, 93,176, 96,  1,
+103,230,204,153,216,179,103, 15,238,221,187,247,  8,192,106,  0,250,190,172,141, 30, 49, 98,132,177, 90,173,198,137, 19, 39, 40,
+  0,253,206,156, 57,243,162, 77,155, 54,236,222,189,123, 27,239,218,181,107,116, 97, 30,233, 45,180, 76, 76, 76,184, 26,141,  6,
+187,118,237, 66, 98, 98,162,  7,128,168,103,207,158,237, 29, 49, 98,196,238, 38, 77,154,212,143,136,136,120,159,159,159, 63, 29,
+192,171,202,200, 82, 83, 83, 39,182,110,221,250, 12, 77,211,206, 61,122,244, 16,253,246,219,111, 38,111,223,190,133,147,147, 19,
+104,154, 14, 71, 21,151,176,122,255,254,125,148, 68, 34,113,235,218,181, 43,174, 93,187,182, 65,167,211,173,  7,176,113,218,180,
+105,142,241,241,241,104,217,178, 37, 44, 44, 44,240,246,237,219, 60,137, 68,178, 27,  5, 75, 18, 85,230,194,141,  1,176,120,239,
+222,189,205,246,238,221,235,109, 97, 97,209, 62, 52, 52, 20, 15, 30, 60,192,230,205,155,177, 98,197, 10,116,238,220, 25,243,231,
+207,207,  0,224, 13,128,138,137,137,209, 43,110, 94,145,103, 11,  0, 90,181,106,149,226,231,231,135,201,147, 39, 51,135, 14, 29,
+218,118,236,216,177, 57,163, 71,143, 46,110,  3,199,143, 31,207, 28, 61,122,116, 60, 10,150, 97,250, 39,161,213,104,212, 48,177,
+168,131,252,236,  4,164, 39,  6, 67,104,108,  7,175,110,205, 33, 87,168,113,249,210, 57,188, 10, 15,  3, 73,146,176,181,171,  1,
+ 51,115, 43,188,123,247, 30,168,120,182,177, 86,163,209,192,216,188, 22,242,115, 18,161, 78,123,  9, 35,177, 13, 38,124, 63, 24,
+114,133,  6,231, 47,156, 67, 68,196, 43,176, 88, 44,216,217,215,128,169, 89,  1, 39,193, 84, 60,131,217,  0,  0,101,196,211,170,
+ 84,104,177, 88,172,187,215,175, 95, 31,214,174, 93, 59,246,135, 15, 31,240,225, 67,193,203,141, 84, 42,165,  8,232,206,166,133,
+ 95, 26, 85,193,229, 61, 80, 56, 59,163,228,218,133, 98, 99,227,228,183,111,162,108,165, 89,169,  8, 11,121,136, 15,239,194, 17,
+ 27, 29,  5,141, 70,  9, 22, 73,130,100,145,168, 85,167, 49, 30, 62, 10, 86, 43, 41, 42,184, 60,206,  2, 59,162,243, 68, 54, 46,
+ 35,215,174, 89, 26, 48,119,225, 42,163,225,195,246,224,213,219,215,200,167,236,192, 48,128,157,165,  8, 45,234, 46, 66,114, 74,
+ 58, 78,254,190, 75, 78,107, 52, 99, 74,197,208,250,130, 19,  0,108, 51,208,104,247,254,223, 39, 29,240, 63,190,106,225,204,169,
+182,  3,135,140,  1, 47,235, 53,180, 41, 47, 81,167, 77, 31, 16,124, 51, 92,189,121,  7, 65, 47, 94,167,210, 58,102,149,109, 38,
+ 14,189,171,132,179, 36,178,179,179, 31,127,250, 36,113, 42, 17,  5,222,137,207, 23, 84, 54, 59,174, 52,231,103, 17,231, 89, 44,
+178,213,218,181,107,181,182,182,182,154,136, 61,213,231,155,  0,  0, 32,  0, 73, 68, 65, 84,136,  8,236,217,179,135,126,249,242,
+229, 77,146, 36,119, 72, 36, 18,101,101,156,214, 90,109,216,113, 95,223, 70,109,135, 12, 97, 70,205,156, 41,  7,159, 63,107,211,
+175,191,250,166, 75,165, 14, 12, 77,195,218,194, 34,105,211,146, 37,126,195, 70,140,144, 70, 62,124,104, 20,124,241,162, 17,143,
+162, 94,234, 97,231,183, 64,185,156,201,201,201, 65,247,238, 61,192,145,  3,191, 65,163, 81, 65,146, 28, 15,  0,200,200,204, 65,
+ 37, 34,171, 52, 39, 35,151,203,135,252,180, 98,197,147,159,230,206,177,235,210,189,  7, 18,194, 66,161,201, 74,  7,161,165,192,
+ 33,216,144,165,  9,145,150,154,143,197, 71, 79,167,229,203,229, 67,202,104, 36,202,180,179,200, 99,197, 55, 49,  6, 87, 36,  6,
+ 79,108,252,153, 23, 75, 96, 98,  2,158, 72, 12, 54,143, 87,214,  0,238, 47, 56,243,243,243,135, 14, 27, 54,236,213,179,103,207,
+204, 39, 79,158,140,142, 29, 59,134, 40, 20, 10, 79,  0,121,213, 77, 79,154,166,147,187,116,233, 66, 18,  4, 33, 30, 51,102, 12,
+ 63, 61, 61,189, 56,178,122,126,126, 62,174, 93,187,134,  6, 13, 10,102,245, 71, 70, 70,162,113,227,198,229,114,254,176, 56, 34,
+ 25,192,154,185,195, 28, 55, 61,  9,147,204,  2,176,161, 78,253, 26,184,115,227, 54, 30,220,  9,246,109,223,132,222,254,221,152,
+ 54, 63, 11, 61, 71, 44,116,107, 53,153, 37, 54,177,199, 31,231,207,177,162, 94, 30, 92, 39,151,135,215,195,158, 11, 11,202,179,
+147, 32,  8, 48, 12,243, 69, 40,  7, 22,139,133, 99,199,142, 85,245,222, 79, 31, 56,112, 96,218,143, 63,254,200,149, 72, 36,120,
+243,230, 13,100, 50, 25,  4,  2,  1,110,220,184, 65,  1,216,117,236,216,177, 27,199,142, 29,235,141,130,217, 68,129, 85, 41,159,
+ 34,145,200,199,203,203, 11,111,222,188,193,243,231,207,207,  1,120, 21, 18, 18,114,238,195,135, 15, 35, 59,119,238,140,223,127,
+255,221, 71,161, 80, 28,168, 10, 39, 77,211, 37, 99, 38, 21,173,248, 16,150,159,159,223, 62, 56, 56,184,170,249, 46,201,204,204,
+236, 84, 40,172, 19,109,109,109, 77,194,194,194, 80,179,102, 77,104, 52,154,118, 85, 45, 75, 57, 57, 57,191,237,216,177,227,208,
+196,137, 19,241,243,207, 63,143, 57,125,250,244,152,239,190,251, 14,125,251,246,197,225,195,135,241,234,213,171, 13,208,111, 89,
+177,178,238,253, 21,128, 87,182,182,182, 51,106,212,168,129,205,155, 55, 35, 60, 60,220,111,205,154, 53, 75, 94,189,122,133,  6,
+ 13, 26,240,163,162,162,168,234,212, 33,  0, 96, 98, 98, 98,162,213,106,113,241,226,197,167,  0,230,142, 25, 51,198,102,235,214,
+173,222, 98,177, 24, 89, 89, 89,138,136,136,136,209,  0, 46,253,211,117, 29, 67, 16,203, 38,255, 48,107,239, 15,147, 71, 11, 90,
+183,106,  1,121,110, 18, 20,249,169,144,231,125,194,142,  3, 55, 65, 16, 36,172,173,237, 97, 99,231,132,248,248,  4, 60,186,114,
+ 85, 45,147, 43,182,242,180,244,134,138, 57,103, 22,112,182, 44,224,148,203,210,160,200, 79, 43,230,180,177,113, 40,228,140,199,
+195,224,171, 74,133, 76,246,155,154, 33,126,249,155,239,253,255, 51,170,182,214, 97, 73, 72,165,210,217, 83,167, 78,245, 92,188,
+120,177, 37, 69, 81, 44, 11, 11, 11,196,199,199, 83,103,207,158,205,202,207,207,159, 93, 29,107,216, 28,206, 43, 23,215,  6,158,
+  3,  7, 14,164,  6, 12,232,207, 29, 59,177, 55,219,218,198,  6, 57,217,153,120,247, 38, 20,111, 95,191,132, 75,131,230, 88,185,
+102, 11, 96,102, 86,233, 66,146,133,203,234,244, 91,253,211,130, 83,157, 60,122,153, 52,104,220,156,219,162,158, 41, 52, 90, 10,
+ 73, 73, 73,184,116, 49, 76, 19,241,226, 65, 46, 77,169, 71,202, 51,244, 91,130, 39,  8,160,144,137,125, 77,108, 52,199,214,111,
+218, 49,127,215,190, 35, 11, 23,207,154, 44,234,236,222, 19,225,183,127,199,185,128, 83, 50,165, 74,189,137,203,194,175, 17,153,
+144,191,171, 98, 26, 40,149, 74, 77,233,246, 84,169, 84,106,190, 54,167, 15, 31, 62,140,212,212, 84,117, 92, 92,220,117,138,162,
+ 78, 87,176,216,243, 23,216,  1,168,  7,171, 84,183,127,114,119,239,253,211,141, 27,130,241,139, 22,169,199,140, 29,187,  0, 42,
+149,  6, 60, 30,195, 22,137, 72,240,249,156,200,135, 15,141,182, 77,155,102, 65,168,213,183,142, 84, 16, 54,160, 12,124,243, 89,
+135, 69, 30,173,174, 93, 59, 99,252,228,185, 80,148,240,104, 61,126,254, 14, 42, 13,244,246,104, 21, 34, 33, 46, 49,177,253,172,
+101, 63,157, 31,233,213,221,173,137,115, 45,190,117,237, 90, 16,219,217, 33, 51, 61, 29, 15,159,191,213,174, 57,117, 62,162, 80,
+100,233, 21, 87,134,166,233,130, 65,238,  0,186,207, 94, 12,130,197,  2, 10,195, 56, 20,205, 28,170,221,166, 35,  8, 54, 27, 58,
+134,134, 74,165,210,103,208, 95,210,199,143, 31,135,142, 25, 51, 38, 48, 32, 32,128,244,242,242,106,113,225,194,  5,250,107,202,
+142, 66,161,104, 15,  0,  2,129, 32,214,204,204,204,113,226,196,137,208,106,181,144,203,229,200,201,201, 65, 82, 82, 82,246,196,
+137, 19, 53,  0, 96,100,100,196, 27, 54,108,152, 73,101,156, 91,206, 38, 43,231, 14,115,220,110,193,142,243,206,205,120, 85,219,
+130, 29, 23,219,190,  9,189,125,203,217,100,165,137,131,108,109, 70, 92,208, 59,137,236,198,222, 63,206,159, 99,141, 27, 60, 84,
+231, 36,126,239, 43,176, 97,206, 86,198, 75, 16,196, 23,193, 73,245, 20, 89,159, 33, 47, 47,111,201,242,229,203,251, 74,165, 82,
+167,222,189,123,115,221,220,220,240,228,201, 19,  4,  4,  4, 80,143, 31, 63, 78,148,201,100, 75,  1, 40,  1,220,172, 78,154,186,
+186,186,214,102,179,217, 69, 93,105, 59, 11, 15,239,188,112,225,194,200,201,147, 39,163, 86,173, 90,141,162,162,162,248,168,194,
+115,196, 48, 76,113, 47,195,183,  4, 65, 16,209,219,182,109,115,180,179,179, 35,174, 93,187, 70,177, 88,172,234,120,110, 14, 31,
+ 60,120,176,157, 86,171,253, 97,202,148, 41,240,240,240,  0, 69, 81, 56,122,244, 40, 14, 30, 60,168,175,200,170, 16,239,222,189,
+123,153,152,152,216,101,193,130,  5,216,188,121,243,146,  5, 11, 22, 32, 49, 49, 17,239,222,189, 11,253, 26,222,220,220, 92, 69,
+ 66, 66,130,176, 67,135, 14,173, 35, 34, 34, 34, 60, 61, 61, 27, 79,158, 60, 25, 27, 54,108, 96,238,221,187, 55, 12,192,181,255,
+ 68,235,253,246, 67,150, 63, 71,199,190,177,102,237,111, 43,234,213,173,253,227,164,  9, 35, 88,174, 46,141, 33,203, 73,130,165,
+149, 45,156,106,212, 65,122, 90,  6,174, 95,191,166,203,200,200, 62,172, 35,137,213, 31, 62,100,165,124, 13,167,163, 83, 29,164,
+165,165,225,234,213,171,186,108,105,238,126,104,201, 53, 81,241,217,169, 48, 64, 31, 79,214, 20, 84, 16, 37,190, 34, 88,153,155,
+155,159, 48, 49, 49, 73, 53, 49, 49, 73, 53, 55, 55, 63,  1,232, 53,251,160, 71,137,218,129,245,217, 54,108,152,  0,  2, 65,123,
+176,217,243,204,204,205,175,153,154,154,102,118,237,218, 85,189,119,239, 94,101, 84, 84, 36,157,156,156,200,152,154,154,230, 20,
+159, 95, 22,103, 41,152,155,215, 53, 22,217, 55, 94, 97,234,212,226,161,216,190, 81,158,216,190, 81,158,169, 83,243, 71, 34,251,
+ 70,171,204,205,235, 26,235,101,103, 57,168, 99,  3,107, 23, 43,236,106, 96, 77, 40, 92,172,176,171,142, 13,172,245,190,247,138,
+187,253,116,  4,  1, 29, 10,166, 97,163, 26,156, 69, 28, 52,139,197, 58,226,228,228,100,143,170,  5,172,251,130,115, 44, 80,107,
+ 44,159,255,195, 25, 95,223,241,177,247,238,141,201,141,137, 25,149, 19, 29, 61, 34,244,212,169,145, 59, 71,142, 28, 59,138,207,
+159, 50, 12,168,171, 47,167,189,189,189,223,203,151, 47,  3,244,221, 74,  8, 47,189,211,179,110, 29,199, 27, 94, 61,218, 49, 62,
+ 83,135, 48, 62, 83,135, 48, 94, 61,218, 49,117,235, 56,222,248,138, 60, 34, 88, 44,150,183, 80, 40, 60, 33, 18, 10,195, 69, 66,
+ 97,184, 80, 40, 60,193, 98,177,188, 81,241, 24,170,207, 56, 45, 45, 45, 95,216,218,218,166, 86,101,179,178,178, 10,169,130,157,
+163,106,215,174,157, 72,146,228,150, 42, 62,211, 21,113,186, 24, 25, 25, 69,139, 68,162,164,146,155,145,145, 81,201,192, 80,150,
+ 66,161,240,178, 72, 36,218,170, 15,231, 47,203, 26,175,120,116,115,198,171, 95,150, 53, 94, 81,250,183,153,131,204, 39, 62,  9,
+ 92,157, 57,115,144,249, 68,125,236,180,177,177,185,103, 99, 99, 35,177,177,177,145,216,218,218, 86,184, 89, 89, 89,189,208,131,
+ 83, 96,108,108,188,213,216,216, 56, 85, 36, 18,233,196, 98,113,170, 72, 36,218,130, 18,161, 45,170,155,158, 36, 73,110,104,212,
+168,145,146,197, 98, 29, 42,245,211,230,122,245,234, 41,217,108,246,166, 42,114,154,116,238,220, 89, 23, 22, 22,198,120,120,120,
+ 48,  0,204,191, 97,190,219,153,155,155, 95, 51, 49, 49, 73, 48, 54, 54,222,  1, 64, 84, 77, 78,  2,128,183,163,163, 99,104,183,
+110,221,228,142,142,142,193,  0,  6,126, 67, 59,251, 14, 26, 52,136, 78, 72, 72, 96, 24,134, 97, 18, 18, 18,152, 65,131,  6,209,
+ 40,  8, 20,249, 53,117,242,178,105,211,166, 49,143, 31, 63,102, 30, 63,126,204,  4,  7,  7, 51,125,251,246,165,  1,124,255,149,
+245, 60,190,213,189,187,213,177,170,219,176,190,249,233,209, 67,221,233,155,151,182, 48, 43,151,254,200,244,244,104,204, 52,168,
+103,126,222,197,197,210,229, 91,112,174, 88, 58,149,233,209,165, 17,237, 86,215,252,148, 91, 29,171,186,255,240,189,255, 27,189,
+ 90,248,187,  7,156,253,229, 90,252, 92, 44,149, 13,  7,  7,  7,100,102,182, 19,176,217,238,124, 62,223,147,100,177,238,102,165,
+167,207, 41,124,221,210,253, 83,174,218, 10, 27,244,186,224, 85,176, 36, 65,117, 56, 63, 27,200, 94, 77,206,170,112,232,197, 89,
+222,162,210,180, 74,149, 98, 73, 81, 47,118,160,194, 52,248,140,211,209,209,241,  7,154,166,107,235,107, 16, 73,146,177,201,201,
+201,  7,170,147,158,245,235,215,103, 10,187,183,137,111,153,239,127, 71, 89,250, 95,226,252,227,183,166, 14, 13,154, 54, 92, 24,
+254, 50,106,115, 97,183, 98, 49, 86,205, 52, 55,118,239,214,117,249,195, 59,247,126, 94,181, 67,154,247, 31,190,119, 18,122,142,
+105,251,  6,156, 69, 65, 66,171,196,201,225,112,246,182,109,219,246,135, 39, 79,158, 28,210,233,116, 83,254, 71,203,103, 95, 22,
+139,181,192,213,213,181,197,187,119,239, 66,117, 58,221,102,148, 17, 40,178, 26,118, 46,173, 93,187,246,116, 46,151,203,207,207,
+207,151,166,164,164, 44,  7,112,250,191, 45, 61,221,234, 91,180,102,152,226,160,219,235,222,124,204,122,246,205, 56, 25, 90, 71,
+ 51,172,181,239, 98, 50, 67,254,  3,249,254,111, 19, 89,251,255,137, 63,238, 97,224, 52,112, 26, 56, 13,156,  6,206,111,206,105,
+100, 72, 79,  3,231,191,144,243, 95,  9,182, 33,  9, 12, 48,192,  0,  3,254,223, 65, 97, 72,  2,  3, 12,248,175, 67, 73,175, 86,
+177, 55,139,168, 64,149, 86,197, 37, 88, 29,101,123,219,192,105,224, 52,112, 26, 56, 13,156,  6, 78,  3,231,255, 28,231,191, 85,
+100,237,175, 96,255,111,131,193,173,106,224, 52,112, 26, 56, 13,156,  6, 78,  3,167,129,243,127, 65,104,149,185,111,232, 58, 52,
+224,111,199,246,193,112,  4,128, 89, 23,144,252,119,156,111,128,  1,  6, 24, 96,128,  1,255, 97,236, 71, 57, 93,135,255, 13, 66,
+203,  1, 64,123, 20, 44,124,251, 22,192,  3,  0,210,175,224,179,  2, 48,130, 32,136,225,  0,192, 48,204, 25, 20,204, 26,201,208,
+231, 98,129, 64,144,170, 84, 42,109, 10,191,167, 41,149,202,146,107, 25, 16,248,114, 54, 27, 83, 98, 43, 19,181,107,215, 78, 85,
+169, 84, 54,122,252,125, 14,195, 48,175, 72,146, 12, 23,139,197,119,222,189,123, 23, 80,149, 27,247,244,244, 28,207, 98,177,214,
+  1,128, 78,167, 91,118,247,238,221, 35,127, 99,190,181,171,225, 96,247,187, 70,171,161, 82,211,179,150,227,203, 64,126,  0,128,
+ 93,253,224, 71, 80, 88, 88,248,125,211,140,128,138,227,232, 84,245,252, 10,208,154,195,225,248,216,218,218,246, 73, 74, 74,122,
+  1, 96, 17, 80,121, 84,227, 26, 53,106,124,207,102,179,199,232,116,186,186, 44, 22, 43,154,162,168, 99,137,137,137,254,134, 58,
+196,  0,  3, 12, 48,192,  0, 61,196,214, 23,168,146,208,106, 96,  9, 59,  6,240,  6,129,158, 96,112,139,  0, 78,190,205,196, 39,
+125,175,255,174,  1,180, 90,170,224, 63,185, 36,116,215, 62,146,251,251,244,233,227, 52,115,230, 76,116,236,216, 17, 79,158, 60,
+233,112,248,240,225,137,167, 79,159,126, 69,211,244, 93,  0, 79,  0,189, 66, 41,136, 80, 16,167,101,116,159, 62,125,122,172, 91,
+183,142,213,184,113, 99, 40, 20, 10,220,187,119,207,125,211,166, 77, 91, 31, 61,122,116, 27,192,241, 66, 65, 80,238,  2,120, 74,
+165,210,166,104, 49, 78,130, 32,108,134, 13, 27,246,172,164,184, 42, 92, 95,141, 96, 24,230, 49, 65, 16,193, 58,157,238,201,217,
+179,103, 19, 27,  0,237,166,214,230,158,157, 19,171,113, 42,205,169, 82,169,108, 46,254,178, 30,108, 62, 31,170,188, 92,116,152,
+240,151,232,189,181, 98, 33,  8,154,  2, 11,140,212,115,237,214, 87,  0,194, 83, 82, 82, 94,121,120,120,196, 86, 53,135, 89, 44,
+214,186,235,215,175,219, 51, 12,  3, 47, 47,175,117,  0,254, 46,161,197,111,223,186,249,221,203,231, 78,  8,242,179, 82,209,123,
+224,200, 99,239, 19,211,198,  3, 56,247,153,104,234,  3, 91,130,192,194,105,235,143,179,  0, 96,247,210,209,139,182,244,194,246,
+185, 55,241,  9,128,103,161,248,  1,128, 95,  0,220,221,213,  7,182,  0, 22, 79, 91,127,156,  0,128, 61, 75, 71, 47,220,213,  7,
+219,102, 92,171,114,216,138,233,227,199,143,223,190,110,221, 58,150,189,189, 61,146,147,147,123, 55,106,212,200, 53, 55, 55,183,
+ 17, 42, 24, 68, 92,171, 86,173, 83,157,187,245,175, 51,100,184,183,208,218,202, 28, 41,146, 12,147, 83, 39, 14, 77,101, 61,190,
+215, 39, 46, 46,110,164,161, 14, 49,192,  0,  3, 12, 48,160, 28, 84, 63, 50,124, 75,123, 24,201, 52, 24,196,102, 17,223,119,106,
+221,168,251,168,239, 58,147,141,220,234,227,117,100, 84,175, 75,119,158,110, 34,131, 35,  3, 41, 29,227, 47,226,226, 98,136,164,
+226,153, 48, 90, 10,236,155, 23,143, 23,180,132, 19, 71,179,158, 61,123, 86,191, 85,171, 86,197, 75,195,116,239,222, 29,221,187,
+119, 39,118,239,222,221,252,230,205,155,205, 15, 30, 60,168,  9, 12, 12,252, 29, 21,199, 71,241,169, 87,175,222,166,237,219,183,
+243, 61, 60, 60,192,231,243,139,127, 16,139,197,232,223,191, 63,250,247,239,207, 74, 73, 73,241,186,124,249,178,215, 47,191,252,
+162,142,143,143, 95,128,191,162, 52, 87,136,229,203,151,183, 46,227,240,117,130, 32, 62, 82, 20, 21,218,188,121,243, 68, 87,160,
+254,212,239, 58,222,154,222,201, 69, 52,103,201,225, 50,121,216, 60, 30,254, 24, 95,208, 86,151, 20, 90,177,119,174, 65,108, 98,
+156, 41, 52, 54,126,  5, 32, 28,192, 43,134, 97,194,163,163,163,163, 26,  2,205,219,155,147,191, 31,146,210,205,170, 32,182,144,
+152,152,  8, 83, 83, 83, 35, 15, 15, 15,  9, 65, 16,171,238,221,187,247,173,  7,228,181, 91,181,112, 58, 87, 26,247, 10,159,222,
+ 60,198,188,225,238,194, 57, 59,254,252, 89,169,214,158,171,232, 34,130, 32,201, 95,130,105, 95, 20, 44,198,187, 60, 51, 51,211,
+  3,  0, 44, 45, 45,121,  0,238,110,121,138,239,230,118, 34,190, 38,182, 27,151,197, 98,237, 58,124,248,240,228,239,191,255,190,
+ 96,233,136,135, 15, 33, 22,139,177,102,205,154, 90,243,231,207,247,163, 40,106,118,121,158,172,206,221,250,215,217,182,249,231,
+ 70,121, 89, 57,170,125,187, 78, 63,119,104,210,128,156,230, 51,223,120,155, 70,101,167,211,233,190, 55,120,182, 12, 48,192,  0,
+  3, 12,168,138, 55,171, 82,161,229,106,133, 35, 45,155,184,140, 24,213,215,157,223,180, 73, 99,112,249,127,133,110,105,213,186,
+ 53, 90,181,110, 77,250,230,231,245,124,246,252,101,207,179, 55,159,168,228,218,248,211,239, 50, 48, 94, 95,171,138, 22,165, 93,
+ 55,208,182,155, 44, 59, 77,  0,  0, 34, 51, 27,229,210,139,159,238,116,234,212,  9, 78, 78, 78,220,192,192,192, 73,149,  8,173,
+165,111,223,190,229,179, 88, 21,199, 67,117,112,112,192,176, 97,195,208,160, 65,  3, 94,215,174, 93,151,150, 39,180,  4,  2, 65,
+ 26, 65, 16, 54,  0, 96, 97, 97,161, 91,181,106, 85, 40, 83,  0,  0, 96, 24,134,121, 76,146,228, 19,154,166,159,254,249,231,159,
+ 73,141,  0,155,222,173, 26, 60,152, 62,118,152,144, 57,187,181, 92,145,160,204,205, 45,243,184, 80, 44, 74, 55, 18,137, 94,241,
+133,130,112, 20,172,229, 21,238,228,228, 20,213,  8,112,106,219,160,246,205,221,115, 71, 27, 31,154,242,115,165,105,217,178,101,
+ 75,215,102,205,154,  9,116, 58, 29,100, 50, 25,246,236,217, 99,106,100,100,100,218,167, 79,159,149, 37, 11,128, 27,208,116,168,
+  3,107,202,234, 20,221,140,106, 20, 36,179,206, 29, 90,199, 13,235,223,199,164,117,251,206,120,127,247, 40,178,178,242,144,147,
+157, 15,154,166,191,136,235, 51,227, 26, 82,119,245,195,166,221, 75, 70, 47, 38, 72,146,104, 62,120, 17,  6,216,229,204,218,187,
+119,111, 36,  0, 14,143,199, 43, 89, 14, 29,140, 28,155,108,170,223,171, 51,246, 44, 27, 11,134,166, 25,  0,155,170,224,205,178,
+ 49, 54, 54,190,116,243,230,205,118,109,218,180,193,147, 39, 79, 16, 19, 19,131,233,211,167,171,103,204,152,193, 29, 55,110, 28,
+ 49,111,222,188,153,191,252,242,203, 89,  0,143,190,120, 16,216,236, 49,  3,135,140,228,229,103,231, 42,213, 42,141,218,194,202,
+140, 86,201,148,242, 12,105,174,114,228,232, 31,212,145, 33, 79,199,  0,248, 66,104,125,101,122, 26, 96,128,  1,  6, 24,160,  7,
+ 24,134,105,  3,192, 26, 64, 58, 65, 16,207, 75,238, 23,158, 82,180, 90, 75,233,253, 12, 20,244, 74, 89,150,160,203, 64,193,112,
+ 31,107,  0, 58,  0,207,  8,130,144,126,165,137, 21,207, 50, 12,  8,  8, 96, 74,126,150, 16, 90, 12,195, 48,140, 54,243, 35,163,
+122,119,141,145, 63, 63,240,197,166,136, 60,199, 72,158,157,102,158, 30, 95,193,184, 90, 85,188, 10,251,119, 13,160, 29,221, 12,
+204,180, 54, 96,102,119, 53, 83, 62,123,246, 44,144,166,233,  0,223,206, 96,152,215,199, 25,230,245,113,102,110,  7, 48,103,207,
+158,189,238,231,231, 23,224,239,239, 31,  0,160,178,113, 74,169,121,207,131,153,167, 54, 96,202,195,219,183,111,153,189,123,247,
+ 50, 75,150, 44, 97, 14, 29, 58,196,160,146,  8,234, 94, 94, 94,247, 34, 34, 34,152,113,227,198,133,162,130,192,128,110,128,104,
+ 76, 45,187, 55,170, 83, 91, 53,234,239,155, 50,210, 46,130, 50,239,223,222,222,254, 51,123, 54,184,216, 49, 59,219,186, 48, 71,
+122,182,250,196, 48,204,117,134, 97, 54, 48, 12, 51,146, 97,152,  6,  0,208, 18, 48, 25,104,111,249, 65,121,122,155, 66, 61,165,
+125,165,235,222,181,108,217,210,117,193,130,  5, 89,106,181,154,137,141,141,101,246,237,219,199,220,186,117,139,185,120,241, 34,
+227,238,238,158, 82,194, 94,219,137, 13,156, 83,213,  7, 87,171,170, 83,138, 56, 44,214,206,231,183,206, 50, 31, 30,156, 97,158,
+157,244, 99,142,253, 52,138,153, 57,176,157,198,196,136,175,  4,208,173,188,235,102,116, 66,253,  6,181,172,223,197,199,199, 51,
+ 26,141,134,153, 48, 97,  2,227,229,229,197,244,234,213,139,233,209,163,  7,211,189,123,119,166, 91,183,110,204,157, 59,119,152,
+148,148, 20,166, 71,231, 86,178,126,110,104, 93,  5,211,154, 56, 59, 59,127,138,141,141,101, 52, 26, 13, 19, 24, 24,200, 28, 61,
+122,148,  9, 12, 12,100,124,125,125, 25,  0, 71,166, 77,155,166,144, 74,165,140,151,151, 87, 18,202,136, 26,239,236,236, 28, 21,
+241, 46, 49,113,203,250,  3,119,254,216,121,226,206,249,179,183,238, 92,186,241,236,202,197, 27,207, 79, 63, 13,139,190,232,236,
+236, 28, 85, 70,254,127, 85,122, 26, 96,128,  1,  6, 24, 80,185, 22, 41, 20, 90,125, 11,157, 29,125, 25,134,233, 81,106,191,111,
+161,112,250, 98,223,215,215,119, 73,201,253,162,115,124,125,125,151,  0, 96, 58,116,232,112,130, 97,152,250,223,192,252, 41,101,
+108,149,123,180,138, 64, 37, 61,  3,215,165, 15, 56, 58, 45,180, 25,111, 65,103,199,  3, 34, 59, 40,  8, 49, 50, 37,241,120,243,
+224, 92,197, 11, 73, 20,226,234, 91,112,  0,  4, 70, 69, 69,225,205,155, 55, 72, 76, 76,132, 80, 40,252,226,188,135, 15, 31,194,
+200,200,  8,246,246,246,250, 41, 93,245,231,237,220,171, 86,206, 16,119,240, 64,198,168, 31, 17, 24, 24,136,180,180, 52,112,185,
+ 92,240,120, 60, 80, 20, 85, 41, 31, 73, 22,172,248, 91,228,197, 42,235, 28, 15,128,205,183, 16, 95,222,189,114,118,109,242,113,
+  0, 71,145,240,  1, 41, 74,157,126,158, 60,177,  8, 66,145, 80, 98,100, 36, 44,238, 46,  4, 16, 78, 16,196,251,150,  0, 71, 36,
+ 22, 92,254,125,237, 60, 59, 86, 72,160, 64,241,225, 85,153, 28, 61,122,244,152, 10, 96, 37,195, 48,217,205,154, 53,179, 93,183,
+110,157,121,114,114, 50, 94,191,126,141,211,167, 79,167, 83,  5, 55, 74, 48, 12,179, 26,  0,218,  3,  2, 51,107,179, 27, 59, 87,
+204, 54,198,221, 83,188,234,148, 34, 83,183,254, 87,134,142,155, 54, 99,251,236,254,144,229, 41,112,252, 86,  8,174,191,252, 56,
+  0,192, 67, 84, 48,238,109,215, 35,124,  0,210,187, 15, 25, 50, 36,244,254,253,251, 86,  7, 15, 30,  4, 69, 81,101,110,  7, 15,
+ 30,196,237,  7, 47,103,  1,120,161,167, 89, 14,181,107,215,190,253,244,233, 83,107,161, 80,136, 91,183,110, 33, 59, 59,187,216,
+147, 53,126,252,120, 34, 59, 59,219,123,207,158, 61, 67,227,226,226, 54, 63,120,240, 32, 19,  5,107, 65,126, 86, 16, 88, 44,214,
+ 71,138,210, 52,180,119,171,207, 30,222,191,115,231,252,204, 87, 16, 91, 54,195,227,176,143,151,179,165,153, 10, 22,139,245,177,
+228,249,223, 34, 61, 13, 48,192,  0,  3, 12,168, 26,  8,130,  8, 96, 24,166, 31, 65, 16,  1,165,143,149,254, 94,116,158,159,159,
+ 95,241,126,209, 53, 27, 54,108, 88, 95, 98, 95,254,141,204,171,112, 48,124,215, 66,  5,217,181,172,147, 84,175,207, 67,245,230,
+ 18,184,206,157,192,107, 48,  0, 44,103,119, 36,188,186,139,176,107, 91,144, 20,249, 16, 12,173,131,189,107, 91,125, 13, 81, 54,
+108,216, 16, 74,101,193,208, 44,149, 74,  5,174,200, 92, 57,111,202,104,  1,  0,208,108,129,170,132,130,213,139,208,184,147, 39,
+218,166, 50,120,102, 91,224,168,104,155, 90,112,221,218,  9, 19,192,229,114,193,229,114, 65, 20, 14,253,209, 71,104, 17,133, 39,
+211,  5,221, 87,101, 25, 65,200,249,156,227, 39, 87,250,180,229,199,133,243, 84, 17,143,145,162,162,153,203,169,186, 43,250,216,
+ 43, 20,  9,147,141,132,194,112, 35,177,168, 88,104, 17,  4,241, 17,  0, 24, 14,199,255,232,106,159,102,162,212,104,145,242,121,
+ 32, 36, 74, 90, 83, 14,205,234,107,215,174,217,176,217,108, 59,157, 78,135,132,132,  4, 68, 70, 70, 98,219,182,109,169,121,121,
+121, 93, 67, 66, 66,222,149,212,142, 58, 35,222,105,255, 53,179,235,176, 95,  5,  9, 84, 31, 35,170, 92,122,172,154, 12,242, 26,
+208,181,249,149,169, 99,151, 97,208,119,189, 48,174,107, 35, 38, 54, 37, 75,  9,224, 86,161,235,181, 50, 36,135,132,132,244,236,
+210,165,203,177, 22, 45, 90,184, 49, 12,131,166, 77,155,194,219,219, 27,254,254,254,  8, 11, 11, 67,110,110,174,230,230,205,155,
+ 91,  1, 28,214,211, 44,161,185,185,249,245, 59,119,238, 88, 11,133, 66,220,188,121, 19, 10,133,  2,246,246,246,152, 49, 99,  6,
+111,195,134, 13,127,228,230,230, 14,247,243,243, 19,196,198,198,238,188,113,227, 70, 45, 20,172, 59,247, 69, 33, 80,171,213,251,
+143,251, 31,217, 62,195,103,166,227,157, 39,175,  3, 85,249,121,166,206,206,137,185,214,230, 98,227,173, 27, 87,215, 84,171,213,
+ 83,203, 78,207,123,213, 74, 79,  3, 12, 48,192,  0,  3,190, 64,133, 90,164,164,120, 42, 45,182,170, 34,210,  0, 40,124,125,125,
+151, 18,  4, 17,224,235,235,187,212,207,207, 79,  1, 32,229,239, 16, 89,197, 66,171, 95,191,126, 65,  1,  1,  1,232,215,175, 95,
+ 80,185, 20,180, 14,154,216,251,208,196,222,135, 81,135, 89,248,211,111, 84,169,155,167,171,109, 93,255, 53,183,238,168, 84, 42,
+246,145, 35, 71,138,199,109,  1,128, 78,167,251,230,185, 88, 21,161, 85, 40,244,190, 48,162, 54, 95, 28,180,127,238,240,246,150,
+ 58, 57, 71,253,240, 50,146, 85, 52,181,249,131, 70,254, 60,155,249,165, 60,206,139,115,166, 34,241,193,109,  8,197,226,196,201,
+247,195,139,189, 88,133, 34, 43,  6,  0,106,241,141,  3,247,206, 30,228,110,199,  5, 87,125,229, 12, 82, 84,180,106,111,156,246,
+112, 57,133, 13, 12,195, 32, 38, 38,  6,114,185, 28,193,193,193, 56,119,238, 92,122, 25, 34, 11,181,249,226,123,135, 22,141,105,
+103,146,247,137,171,126,126, 27, 41, 42, 90,175,174, 46,171,166,131, 58,113, 73,226, 38, 65,178,140,186,183,119,197,156, 31,  6,
+ 99,203,161, 63, 41,181, 77,231,126,219, 47, 93, 29,145,175,210, 44,213, 83,100, 21, 59, 27, 67, 66, 66, 26,133,132,132,240,  1,
+120,122,123,123, 95, 29, 58,116, 40,130,130,130,112,249,242,101, 23,  0,146,194,243,214,160, 96,161,236, 95,  0, 68,151,231,120,
+228,114,185, 39,111,223,190,221,216,193,193,  1,183,111,223,134, 66,161,192,180,105,211,212, 62, 62, 62,220,241,227,199, 19, 57,
+ 57, 57,197,158,172,224,224,224,204,242, 68, 22,  0, 36, 39, 39, 95, 59,119,250,104,199, 46, 93,186, 12,174,227,210,192, 36, 58,
+ 47, 55, 77, 40, 20, 24, 61,  8,186,203,125,254,244,209,206,228,228,228,103,101,167,103,160,222,233,105,128,  1,  6, 24, 96, 64,
+249,208, 75,139,148,242, 76, 85,  5, 37,174,227,248,249,249, 69,250,249,249,125,230,241,250, 74,148,158,117,120,165,168, 77,171,
+ 86, 28, 45, 93, 78,194,151, 55, 64,211, 85,185,217, 47,142,153,155,155, 83, 70, 70, 70,159,  9, 45, 90, 79,206,172, 11, 39, 16,
+ 61,125,116,177, 39,171,200,179,133,222,227,191, 74,104,209, 52, 29, 12,224, 51, 35,132, 54,174,163,182,246,119,235,212,168,142,
+ 35,169, 61,189, 13, 73,114, 74,185,242,173, 70,249, 38,143, 25, 16, 85,198, 32,235, 98, 78, 74, 11,129,200, 40,222, 72, 44, 42,
+ 45,178,226,  0, 64,100,235, 50,116,115,159,  6, 93,155, 55,168, 71, 82,167,126, 67,178, 92,155,239, 27,165,209, 68,203,152,243,
+229,164,225,202, 94,189,122,173,180,180,180, 20,108,223,190,221,212,217,217, 25, 20, 69,169, 75,139, 44,161,141,235,168,109,131,
+154,116,114,181, 51, 39,181,103,119, 32, 81,161,147,111,139,214,254,161,143,200,178, 50, 21,223,216,187,126,186,145,144,207,129,
+ 82,169,196,134,221,103,113,243, 81, 68,191,140,136,139, 55,  0,220,248,138,  2, 57,185, 95,191,126, 91,214,172, 89,  3,173, 86,
+139, 73,147, 38,225,227,199,143, 55,223,190,125,187,173,102,205,154, 11, 22, 45, 90,228, 96,103,103,135, 17, 35, 70,112,181, 90,
+237,248,114, 56, 54, 30, 63,126,188, 95,243,230,205, 17, 20, 20,132,236,236,108,216,219,219,195,199,199,135,231,231,231,247, 71,
+110,110,238,240,245,235,215, 11, 98, 98, 98, 42,244,100,125, 86,174,117,186,181,251,182, 76, 95,208,166,189, 59,249,225,195, 59,
+ 42,161,173,  7,121,247,246,229,251,150,150,150,127, 36, 36, 36,252,149,158,131,155, 86, 57, 61, 13, 48,192,  0,  3, 12,248, 54,
+ 32,  8,226, 74,225,184,171,207,188, 92,165, 69, 88,145,199,170,228,126,233,243, 11,127,255, 22, 47,203,251,203, 16, 94,159,135,
+119,232,215,175,159,222,211,234,105, 89,186, 94,226,169, 52,190,107,  0,173,163, 24,236,165, 30, 36,184, 34,115,101,255, 53,183,
+238,148,119,174, 72, 36,210,219,163, 69,171,148,149,101, 74,149,132, 86,225, 24,173,235, 12,195,124, 38,180, 76,109, 93, 61, 22,
+ 47,154,189,213,125,104,111, 50,245,135, 14,200,206, 87,169, 22,189,166,232, 36,121,197, 34,171,160, 21,215,198, 10, 69,226,112,
+129, 72, 88, 82,100, 37,  0,128,192,166, 94,219,133,115,102,236,238, 54,170, 63,145, 62,205, 29,210,108,133,106, 65, 36, 69, 36,
+ 43,152,225, 81,192,221,178,232,238,220,185,179, 15,192, 62, 15, 15,143, 84,145, 72,132,252,252,252, 47,242,160,200,222, 78, 67,
+123,147,169,147,219, 33, 75,166, 81, 45,138,164,144,162,160, 79, 86, 38,178,172,205,140,111,236, 93, 55, 93,152,146, 20,  7, 46,
+151, 11,177, 88,140, 91, 15,195,145, 17,121,233,107,  4, 22, 72,146, 92,229,235,235,187,114,198,140, 25,200,204,204,196,229,203,
+151,241,221,119,223,225,196,137, 19,206, 87,175, 94,221,226,233,233,  9, 22,139,133,128,128,  0,104,181,218,247,229,208, 12,158,
+ 50,101,202,130,161, 67,135,226,217,179,103,144, 72, 36,159,121,178,178,179,179,189,119,239,222, 61, 52, 54, 54,182, 82, 79, 86,
+ 41,180,173, 93,175, 37,119,201,242, 95,161,146,167,177,211,147,159,  4,  5,222, 34, 31,103,101,101,  9,  1,228, 84, 55, 61, 13,
+ 48,192,  0,  3, 12,208,219,171, 85,158, 22, 73, 47, 20, 81,233,101,237,151, 16, 88,101,237, 19,165,188, 96,234, 82,191,135,253,
+157,247,164,151, 71,139,109,219,  4, 84,106, 68,  9,161,149,246,217,239,  2, 99, 11,189,186, 14,181, 20,216,123, 15, 23,199,209,
+ 18,100,102,102, 10,172,172,172,148, 37,  5,130, 80, 40,132,131,131,  3,164, 82, 41,246,239,223, 15, 84, 62, 40,154, 50, 25, 58,
+ 22,109, 71, 77,194,115, 39, 30, 24,173,166,216,179,181,119,194,132,207,196, 22,151,203, 45, 26, 27, 86, 89,163,251,180,208,211,
+244, 24,  0,211,210,165,206,207,  2,145,104,130,192,170,134,213,156,233,147, 57,177,105, 42,220,113, 95,146,125,118,227, 98,113,
+ 34, 35,158,145,128,156, 71,149,240, 69, 15,220,115,180,180, 39, 43,169,133, 75,157,101,  2,161,224,  7,158, 69, 45, 59,223,121,
+211, 57,177,169, 42,226, 78,219, 69,185,231,126, 89, 36,140,129,241,130, 36,100,223,213, 35,123, 86,126,247,221,119, 43, 25,134,
+ 97,104,154, 94, 14,  0, 37,237,157,231,243,  3, 39,250,147, 18,129,238,203,164,231, 54, 46, 54, 78, 68,197,246, 90, 53, 29,212,
+201,214,220,228,198,222,245, 51,132,146,228,120,240,249,124, 24, 27, 27, 35, 49, 53,  7, 28, 54, 75,241,149,229,141,223,185,115,
+231,197,211,167, 79, 71,120,120, 56,166, 77,155, 38, 73, 72, 72, 56,127,234,212,169,105, 43, 86,172, 96,123,121,121, 65, 34,145,
+ 96,211,166, 77,218,135, 15, 31,174,  7,176,169,204,242,200,102, 79,254,249,231,159,153,148,148, 20, 34, 38, 38,  6,246,246,246,
+152, 57,115, 38,111,253,250,245,197, 99,178,170,226,201, 42, 66,114,114,114,208,205,219,143, 49,224,218, 86, 80, 90, 85, 80,118,
+102,194,253, 55,209,210, 32, 11, 30,111,190, 99,203,166,213, 74, 79,  3, 12, 48,192,  0,  3,190,137, 23,235,121, 69,251,255,  5,
+ 40,171,235, 80, 47,161,245,126,199,178,137, 46, 19,103, 44,132,145,115, 39,168,162, 46,128,206, 79, 45,246,104,  9,196,230,176,
+168,233,134,108,153, 10,103,  2, 95,  2,192,251,170, 88,149,151,151,135, 86,173, 90, 97,215,120,215,110,202,188, 76,129, 17,  0,
+ 21,223, 68,121,145,215,249,206,213,171, 87,229, 52, 77,159,  4,112,181, 18,154, 85,141, 27, 55,222,249,235,175,191,242,220, 70,
+ 77, 68,254,147,  7,165, 61, 40, 48, 50, 50,  2,159,207,199,171, 87,175,112,231,206, 29, 53,128, 85,149,100,232, 83,138,162,194,
+ 78,157, 58,149, 84,191,142, 99,239, 86, 45,154,205, 90,186,196,215,248,245,131,155, 88,190,126, 39, 93,191,181, 87,206,134, 19,
+ 23,243,114,196, 53,187, 43, 36,111, 67,245,184,213,176, 82, 34, 43,165, 97,237, 26,221, 90, 52,105,188,112,249,242,101, 38,145,
+ 15,110, 97,197, 47,123, 25,151,230, 61,114,126, 57,119, 41, 55, 67, 88,171,151, 50,237,205, 51,125,210, 48, 40, 40,104, 31,128,
+125, 69,251,165,237,245, 93,179,141,118,109,211, 91,186,225,196, 57, 89,174,113,205, 30, 21,217,107,237, 54,184,163,147,181,249,
+141, 29,107,127, 20,126, 74, 78,  0,159,207,135, 88, 44, 70,130, 36, 27, 43,183,158,150,105,104,186,247,215, 10, 45, 99, 99, 99,
+190, 70,163,193,174, 93,187,144,144,144,208,  1, 64,194,139, 23, 47,246,142, 28, 57,114,123,211,166, 77, 27, 70, 70, 70,190,207,
+207,207,159,  1,224, 77,121, 36,102,102,102, 29,172,173,173,137,199,143, 31,227,199, 31,127, 84,207,156, 57,147, 59,110,220, 56,
+ 66, 42,149, 86,215,147,  5,  0,112,116,116,244,232,217,189, 61, 58,245,156, 22,164, 86,102,223,143,125,243, 71, 16,201, 60, 18,
+ 84, 55, 61, 13, 48,192,  0,  3, 12,248,159, 65,245,  2,131,123,  0,108, 87, 75, 76,109,236,200,253,228,191,113, 38,147, 23, 29,
+204, 40,158,237, 99,114, 47,252,192, 92,217, 52,142,185,186, 99, 14, 51,173,111, 99,166,161, 13,241,201,213, 18, 83, 61,190, 20,
+110,159,173,238,253, 93,  3,104,123,214,  3,211,179, 30,152,190,174,208,  2, 88,218,178,101,203,139, 62,109,255,138,163,229,211,
+ 22, 12,128, 31,  1,136,203, 49,171,172, 21,195,237,  1,236,111,213,170, 21,117,247,238, 93,230,237,240, 30, 76, 72, 67, 43,102,
+198,140, 25,204,138, 21, 43,152,209,163, 71, 51,214,214,214, 84, 97, 66,216, 87,198, 57, 96,192,  0, 39,  0,168, 81,163,134, 89,
+107,183,250,159, 94,  5, 94,102,238,251,111,103, 14,249, 12, 97,218, 53,117,203,176,107,216, 37,204,200,190, 65,139, 74,146,175,
+152,211,206,206,110,  9,195, 48,189, 25,134,177,  7,  0, 23, 23, 75,113,203,134,245, 83,194,110, 95,102, 30, 28,221,201, 28,242,
+ 25,194,180,111,214, 40,211,201,205,243,141,192,166, 97, 91,125, 56,203, 66,153,246, 54,105,152, 97, 91,191, 99,104,  5,246, 22,
+115,214,105, 59,226, 82, 82, 74, 42,243,244,233, 83,230,234,213,171,204,131,  7, 15, 24,255, 83,151,152,154,109,134,231, 91, 53,
+ 29,212,169, 10, 69,167, 60, 59, 77,251,246,237,203,188,127,255,158,233,211,167, 15,  3,192,180,154,156, 23, 99, 99, 99,153,136,
+136,  8,102,233,210,165, 12,128, 35,211,167, 79, 87,228,228,228, 48, 61,122,244, 72, 40, 20, 88,236,234,216, 89,183,182,227,134,
+193,253, 59,175,242,249,113,168,199,215,166,231, 55,132,129,211,192,105,224, 52,112,254, 47,112,254,127,134,125,161, 87,171,232,
+179,165, 94, 30,173, 32,128, 66, 38,246, 53,177,209, 28, 91,191,105,199,252, 93,251,142, 44, 92, 60,107,178,168,179,123, 79,132,
+223,254, 29,231,  2, 78,201,148, 42,245, 38, 46, 11,191, 70,100, 66,254,174, 18, 43, 10,227,104,125,134,144,144, 16,161, 69,189,
+191, 98, 48,125, 40,136,205,186,183,138, 55, 40,  1, 48,229,229,203,151,191,122,122,122,174,251,161, 83,219, 33, 62, 29,187, 65,
+171,213,194,223,223, 31,241,241,241,231,  1, 44,211,215,227, 22, 30, 30,158,209,168,158,243,108, 14,139,189,112,198,232,193,214,
+233, 31, 95, 35, 41, 42,  4,  0,160, 82, 41,180,159,222,223,111, 94, 21,227,140,140,140,158, 90, 91, 91,191,181,182,182,150,186,
+214,169, 49,133, 15,206,242,105,222,  3,109, 50, 99,223, 32, 49,178,160,103, 84,165,148,107,146,222,223,109, 88,157,220,117,118,
+118,230,139, 56,152, 90,166,189,106,165, 54,245,195,155, 22,250,240,200, 85,234,245,171,183,248,247, 90,187,112,  2,223,196,196,
+  4, 47, 35, 62, 96,249,111, 39,100, 10,181,182,119, 70,248,197,111,210, 61,198, 48, 12,180, 90,173,222, 19, 29,202,193,226,230,
+205,155, 55, 88,183,110,157,203,248,241,227,241,181,158,172,146,136,142, 77,246,117,172, 81,183,209,135,183, 47, 61, 45,140,184,
+199,190, 38, 61, 13, 48,192,  0,  3, 12,248,159, 65,223, 66,103,206,148, 18,159, 33,149, 10,173, 34, 68,164, 65, 14, 96, 77, 29,
+ 86,254,222, 37,235,182,172, 36,137,173, 19,104,134,249,157, 34,177, 58, 38, 19,233, 95,105,156,156,195,  6,213,107,208,104, 54,
+  0,112,216,213,107, 32, 11,241, 30,192,208,  3,143,158,181, 57,240,232,217, 79,133,199,214,  2,168, 82, 95,174, 49, 27, 17,238,
+141,234, 58,118,110,217, 88,192,210, 41,144, 20,245, 17, 89, 50, 37,110, 69,198,103,147, 12,249,123, 85,141,138,137,137,185,  7,
+  0,182,166,194,168,206,141,234,213,236,210,170,177,144, 67,168,145,244,250, 37,114, 20,106,220,140,140,207,  1, 65, 84,123, 64,
+245,183,178, 55, 53,252,210,243, 63, 65,244, 32,  8,226,246, 82,159, 81,252,149,191,157,252,166, 34, 11,128, 60, 57, 57, 57, 83,
+ 46,151, 91,166,164,164,168, 81,253, 32,113, 31,114,115,115,155,206,153, 51,103,205,130,  5,216, 12, 53,220,  0,  0, 32,  0, 73,
+ 68, 65, 84, 11, 22,110,220,184,145, 91,157, 49, 89,229, 65,154, 28,127,161, 75,227,111,151,255,  6, 24, 96,128,  1,  6,252, 79,
+ 96, 74,169, 79,232, 45,180,138,  5, 67, 26,210,  1,204,168, 91,151,153, 23, 29, 13,245,183,178,172, 44, 79,215, 87,226, 57,128,
+254,213,190,154, 36,242,158,188,143,207,127,250, 62, 62, 31, 52,195,208, 12,163, 34, 73, 36,202, 52,154,245,239, 99,146,171, 63,
+235,142, 32,116,207, 63, 36, 40, 94,124, 76, 84, 50, 52,205,208, 12,163, 38,  8,124,210,106,233,245,145, 49,241,151,254, 27,236,
+205,  8,191,248, 40,128, 34, 58, 63,122, 26, 49, 79, 38,211,236,204,136,186, 24,252, 13,243, 69, 27, 30, 30, 62,166, 67,135, 14,
+ 19,117, 58,221, 94,  0,218,175,224, 82, 83, 20,181,120,195,134, 13,231,195,195,195, 79,  7,  7,  7, 75,190,133,200,250, 91,243,
+223,  0,  3, 12, 48,192,128,127, 43,170,183,168,116,121,248,150, 34,235,191, 17, 17, 31,226, 90,253, 29,188,145, 31,226,154,252,
+127,176, 55, 53,234,194,139, 84,192,251,111, 74,222,155, 58,157,238,230,183, 20,213,215,175, 95,175,141, 50,150,213,249,111,203,
+127,  3, 12, 48,192,  0,  3,254,181,152, 82,158,248, 98, 27,210,198,128,127,  1,152,111, 37,178, 12, 48,192,  0,  3, 12, 48,160,
+ 26, 40,215,163, 69,160,252,153,  3,183,171,240,  7,213,153,125,112,219,192,105,224, 52,112, 26, 56, 13,156,  6, 78,  3,231,255,
+ 28,231,191, 17,246, 40, 24, 16,127,165,240,179, 66,241,245, 45, 97,152,250,106,224, 52,112, 26, 56, 13,156,  6, 78,  3,167,129,
+243,223,142, 50,  7,194,  3,  5,131,135, 13, 48,192,  0,  3, 12, 48,224,255, 19,248,133, 91,117,127, 55,192,128,191, 91,108, 21,
+ 11,174,234,140,209,170, 95,248,249,225,111, 52,214,199,222,222,126, 74,179,102,205,220,184, 92, 46,153,151,151,183,250,238,221,
+187,171, 74,159,212,185, 17,251,  5,139,132,211, 95, 71,  8,128, 96,  1, 36,  9, 29,131,164,  7,175, 20,173, 13,249,254, 95, 13,
+103, 35, 19,235, 63,  9,146,197,211, 81, 26,232,180, 26, 20, 12,183, 42,  0, 77, 83,241, 58,141,202,171,188,139,237,154, 15,174,
+ 73,233,232,141,  0,179, 11, 32,167,  3,244,110,  2,236,105, 12,168, 61,  4, 88, 63,130,197,252,  2, 29,177,136,205, 97, 45,145,
+132,156, 77,252, 55, 36,216,153, 51,103, 88, 95,115,253,240,225,195,203, 92, 64,212,193,193, 33, 64, 40, 20,214, 43,239, 58,153,
+ 76, 38,145, 72, 36,158,255,242,242,216,  5,192, 14,  0,141, 75, 29,127,  3, 96, 54,128,192,175,253,  3, 15,128,109, 11, 76,229,
+  2,139,  0, 64,  3,252,146, 10,236, 11,250, 47, 26, 99,104,109,109,125,159,205,102,187,200,100, 50, 89, 94, 94, 94, 93, 99, 99,
+227,104,145, 72, 36,162, 40,234,125,122,122,122,151,138,174,101, 10, 38,165, 84,138, 38,128,241, 59, 96,164,142, 36,103,114,128,
+ 93, 42,154,222, 91, 88,131,235,179,192,237,116,252,181, 60,215, 66,  0,187,171,248,187,  1,  6,252, 29,248,170, 89,135,174,  5,
+245,  3, 60,  0,116,105,211,166,141,173, 76, 38,195,155, 55,111, 82,  1,220,  7, 16, 84,184,189,251, 22,150,146, 36,185,121,203,
+150, 45,243,103,206,156, 89,188, 24,244,171, 87,175,208,188,249,151, 49, 66, 89, 36,156,238, 94,190,109,243, 60,252, 29,218,244,
+ 24, 86, 40,180, 72, 64, 38,129,103,207,182,213, 53,193,216,220,220,124, 53, 65, 16,195, 73,146,172,180,210,160,105, 90,199, 48,
+204, 25,169, 84,186, 18, 64, 94, 85,254, 72, 36,228,107, 41,157,174,204,255, 96,179, 88, 58,153, 92, 85,110,216, 11, 11, 11,139,
+ 96,146, 36,235,148, 92, 48, 27,248,124,  1,237,242,126,163, 40, 42, 41, 35, 35, 67, 31, 17, 42, 32,217,220,217,  4,193,237,  9,
+146,118,  5,  8, 16, 32,223,209, 58,245, 45,154,210,108,  3,160,252, 26,145,101, 95,163,238,131,185,203, 54, 56, 69, 68,189,193,
+ 82,159,209,216,184,227,  8,150,204,158,136,109,251, 79, 96,246,148, 81,104,212,168,113,133,181, 46, 13,238,250,101,179,134,247,
+240,219,117,218,125,201,140,225,124,191, 93,103, 58, 47,245, 25,201, 91,191,243,116,231,165, 62, 35,248,126, 59, 79,187, 47,153,
+ 53,220,104,253,238,179, 52,128,177,213, 49,114,148,139,131,140,160,168, 50,223,140, 25, 54, 91,117,226,125,138,232, 63,241, 68,
+143, 31, 63,190,153, 66,161,120, 57,186,103,203, 13, 45, 92, 29,147,203, 58, 39,243, 83,178, 99,244,219, 16, 95, 14,215,168,213,
+ 64,223, 35,175, 42,116, 15,240,249,117,222,188,121,227, 66,211, 52,116, 58, 29, 40,138, 42,254, 84,171,213,232,210,165,203,183,
+154, 56,211, 31,192,234,130,135, 21,126,  0, 78,127,  5,151,152,205,102,207,229,241,120, 30, 20, 69,185,  1,  0,135,195,137, 82,
+169, 84, 65, 20, 69,109,  1,144, 95, 69,190,173,201,201,201,141,196, 98, 49, 52, 26, 77,241,  2,244, 44, 22,171, 97,205,154, 53,
+119, 41,149, 74,151,175,189,121, 91, 96,106, 71,119,247,109,227,230,207,103, 41,238,223,199,182,195,135,183, 34, 55, 23,  0,118,
+ 85,118, 45,143,199,187, 65,146,164,115, 85,254,143,166,233,120,181, 90,237, 85,149,107,216,108,182, 75, 74, 74,138,141,131,131,
+  3,242,242,242, 32, 18,137, 68, 69,251, 95,131, 32,128,232, 13,116,161, 88,172, 57,150, 86, 86,157, 95,222,188, 41,106,210,164,
+  9,201, 98,177,150, 64,255, 32,213,124,  0,155, 24,134, 49, 42,108, 47,182,181,111,223,190,  3, 65, 16, 20,  0,134,166,105,242,
+233,211,167,163,104,154,102, 23,214,121,155,  0, 28,  6,160, 50,232,  0,  3,254,  1,111,214,254,170, 10,173,171,  0, 60,218,180,
+105, 99,228,237,237, 13, 15, 15, 15,184,184,184, 64, 32, 16, 20, 84,226,153,153,182,161,161,161, 35,238,223,191, 63,226,242,229,
+203,120,253,250,181,  2,192, 67,  0,101, 62,212,221,251,185,207, 20,136,249,219,  1, 32, 61, 41, 83,146, 20,147,182, 93, 34,145,
+108,  2, 80, 50, 68,120,221,177, 99,199,206,155, 53,107, 22,  2,  2,  2,112,226,196,  9,168, 84, 42,228,229, 85,160, 95,228,105,
+144,222,217,  0,136, 98,129,132, 32, 64,104,  3,136,108,171,157, 82,230,230,230,171,103,207,158, 61,167, 81,163, 70,197, 81,204,
+181, 90, 45, 40,138,130, 86,171,133, 84, 42,197,188,121,243, 10, 26, 90,134,  1, 77,211,184,118,237,218,204, 41, 83,166, 64, 42,
+149,206, 45,139,179,125,171, 26, 47, 72,130,116, 42,242,213, 48, 58, 93,210,147,208,164,214,148, 78,199, 82, 42, 53,101,174, 84,
+ 46, 16,112, 43, 20,121, 28, 14,199,233,245,159,127,218,144, 60, 30, 24,157, 14,160,105, 48, 52, 93,152,156,133, 27, 83,112,140,
+209,209, 96,180, 58,208, 20, 13, 74,161, 66,219,233,211,245, 73,138,142, 28,158,209,137, 49, 63,204,183,107,215,190, 61,167, 86,
+ 13,  7, 80, 58, 26, 31, 99,147,236, 94,190,120,210,233,204, 31,187,166,169, 21,121,163,  0, 84, 43,206, 22, 79,104,114,115,231,
+158,  3, 78,207, 67, 35, 16,120,247, 62,110,223,  9,  2,  0,220,184, 27, 92, 36,184, 43,205, 42, 80,249, 77,103, 79, 26,196,223,
+176,243, 36,103,246,164,193,172,141, 59, 79,113,102, 77, 28,200,218,176,253,  4,119,214,196,129,172, 13, 59, 78,112,103, 77, 26,
+196,242,219,118,168, 25,  0,115,  0,210,242,200,202,203, 35,130,162,248,199,162, 83, 89,  0,144,190,119, 47,180,105,105,112, 88,
+185, 18,  0, 48,166,174,173,222, 93, 19, 86, 86, 86, 47, 56, 28,142, 83,101,231,105,181,218, 74, 69,240,248,241,227,155, 43, 20,
+138, 23, 20, 69, 49,108, 54,219,119,244,224, 94, 23,123,119,110,158, 89,242,156, 87,175,194, 44,215,175,255,115,208,233,151,121,
+204,136, 86,198, 47,  3, 54,143,111,221,111,193,145,176, 10, 26,100, 82,165, 82,225,253,251,247, 40,185,200,123,  9,232,170,249,
+ 72,145,  0,182, 89, 90, 90,182,203,204,204, 28,  3, 96,105,110,110,110, 51, 22,139,  5, 11, 11,139,165,106,181,250,163,169,169,
+233,193,156,156,156,224, 66,175,145,190, 75,  6,116, 49, 49, 49,241,191,112,225,130,121,203,150, 45,201,140,140, 12,212,174, 93,
+ 27, 89, 89, 89,109,239,223,191,223,106,210,164, 73,147,242,242,242,190, 47,124, 25,212, 23, 13,132, 66, 33, 51,110,220, 56, 66,
+167,251,235,118, 15, 29, 58,  4,175, 38, 84, 61,107, 51,161, 92,169,102,114,  2,223,155,254,200,229,114, 31,198,199,199,231, 84,
+ 53, 49,184,192,162,113,243,231,179,196,113,113, 16,135,133, 97, 76,110, 46,123, 99,129,119,171, 82,161, 69,146,164,179,255,137,
+223, 93,120, 60, 30, 40,138, 42, 22,131, 69,117,148, 86,171,133, 70,163,129, 86,171,133, 78,167,131, 86,163,133,223,218, 95,170,
+ 93, 23, 10,133, 66,161,189,189,125,170, 80, 40, 20,126,165,184,172,153, 69,146, 63,180,104,213,106,202,202, 65,131,  4,207,158,
+ 61, 19,144, 36,  9,138,162,176,105,211, 38,138, 97, 24,179, 70,128,201,107, 32,183,170,220,124, 62,159,253,199, 31,127,140,226,
+241,120,  0,  0,181, 90,141, 38, 77,154, 16,134, 54,223,128,255,160,216,250,194,203, 85,145,208,234,147,155,155, 11,157, 78,  7,
+ 99, 99, 99,176, 88,159,183,251,150,150,150,232,217,179, 39,186,116,233,  2,111,111,111,188,126,253,218,200,219,219,187,103,121,
+100,163,231,247, 67, 13, 23,219,194,198,132,182,127,116, 37,116,195,161,159,207, 90,127,250,244,105,126,137,211, 38, 77,157, 58,
+149,200,204,204,196,240,225,195,239,171, 84,170,  1,168,224,225,211,209, 72,242,244, 30,  3,154, 33,140,182, 60, 61, 64,168,149,
+ 10,134, 36, 73, 69, 81,215, 97,117, 82,137, 32,136,225, 14, 14, 14, 56,121,242, 36,212,234, 47,195,133,153,152,152, 32, 50, 50,
+242, 47,175, 26,139,133,246,237,219,179,  8,130, 24, 14, 96,110,217,156,164,211,163,231,113, 54, 69,251,253,122, 54,230,182,111,
+ 69,166,166,164,202, 24,  0,196,178,101,203,138,133, 27,  0,172, 94,189, 90, 31, 59, 65,114, 56, 72, 15, 10,250,171, 34,102,147,
+ 32,185,  4,  8, 14, 64,178, 11,122, 81,193,  0,140, 14,160, 41,128,214,  2,  2,251, 26,250, 36, 67, 91,199,154, 46,  1,235,127,
+219,109,166,210, 50, 56,121, 41, 16,177,177, 49, 96,145, 36,234,214,115, 65,175,174,157, 57,173,218,116,168,241,203,170,249,151,
+ 83, 18, 62,244,  1,240,172,202,  9, 77, 51,130,122, 53,173,112,240,208, 75, 88,155,139, 49,124,208,119, 48, 18,240,177,113,199,
+239, 88,187,196,  7, 46,117,157,177,111,235,186,114, 47, 55, 53, 53, 93,227,230, 82,207,121,247, 31, 87,224,214,176, 33,107,183,
+255, 21,184, 53, 42,252,108,236,198,218,237,127,  5,141, 26, 55, 98,237,246,191,130,102,141, 27,212,122, 33,121,186, 38, 43, 43,
+203,167,252,244, 44,149, 71,189, 10,242,136,147, 79, 23, 87,218,113,211,166,  1, 64,177,208,170, 10, 56, 28,142, 83, 74, 74,138,
+ 77,101,231, 85,230, 53, 40,244,100,189,160, 40, 10,105,105,105, 68,118,118, 54, 99,102,102, 54,232,250,190,165, 23,188,220,155,
+103,  1, 64, 88, 88,152,133,159,223,250, 65,167, 94,228, 66,241,100, 39,113,236,207, 32,122,204,  0,143, 23,151, 54,140,111,133,
+194, 37, 33, 74, 67,165, 82,197,182,104,209,130, 41,252,238,200,231,243,185,165,202,155, 67,253,250,245,191,240, 90,235,209,165,
+184,237,241,227,199, 62,141, 26, 53, 66,195,134, 13,131,219,181,107,103, 34, 18,137,112,253,250,117,184,185,185, 53, 54, 49, 49,
+121,122,230,204, 25,206,226,197,139,155, 31, 62,124, 24,  0,102,234,145,156, 61, 60, 61, 61, 79,  6,  4,  4,  8,184, 92, 46, 20,
+ 10,  5, 34, 35, 35, 97,106,106, 10, 30,143,135,129,  3,  7,178, 58,117,234,100,217,181,107,215,115,239,222,189, 27,133, 42,204,
+128, 82, 42,149,204,210,165, 75, 33, 20, 10, 33, 20, 10, 33, 18,137, 32, 18,137, 32, 22,128,216, 59,187,166,209,172,253,217, 70,
+115, 87,238,221,224,191,123,213,221, 26, 53,232, 21,137,137,137,217, 85, 45, 11,138,251,247, 33, 14, 11,  3, 74, 60,187,250,194,
+ 84,100,  1, 95, 95,223,202, 60, 82,224,114,185,232,216,177, 99,165,124, 22, 22, 22,231,217,108,246,103,111,166, 20, 69,  9,124,
+125,125,117,239,222,189, 19,145, 36, 41,162,105, 26,190,190,190, 58,138,162,  4, 54, 54, 54,193, 52, 77,167,102,100,100, 12,169,
+136,183, 43, 32,  8,  6,  6, 19, 28,206, 92,123,  7,135,218, 30,117,235, 10,111,223,190,205,  2,  0,103,103,103, 70, 34,145,100,
+ 95,186,116, 41,143, 13,236,113,102,152, 63,170, 32,178, 84,  0, 22,146, 36,185,141,207,231,179,107,213,170, 21,191,124,249,242,
+199,133, 30, 82, 48, 12, 67,214,170, 85,171,173,145,145,145,179, 74,165,162, 80,208,117,104,240,102,253, 11,192, 48, 76,171,  2,
+221, 94, 12, 53,  0, 94,145,  3,191,160,181,131, 85,169,227,  0,144, 81,248,162,104, 91,206,126, 38,128,215,  0, 26,  0,176, 41,
+252,237, 57, 65, 16, 89,213, 48,179,124,143, 86, 64, 64, 64,241, 43,108,191,126,253,138, 27, 22, 99, 99, 99, 60,127,254, 28,  4,
+ 65,192,216,216, 24, 38, 38, 38, 48, 53, 53, 69,110,110, 46, 94,191,126,141, 55,111,222, 32, 46, 46, 14,  4, 65,160,110,221,186,
+ 40, 42,236, 37, 80, 92,193, 29,255, 53,  0,  2, 49, 31,  4,  1,180,236,214, 12,205,186, 52, 65,155,103,209,179, 95,220, 38,246,
+ 75, 36,146,247,  0,216, 77,154, 52,153,212,190,125,123,252,246,219,111, 80,169, 84,191,149, 35,178,138, 57, 31,188,166, 90,  3,
+128,189,189,253,130,163,215, 63, 10,199,246,174, 39,151, 72, 36,155,171,145, 56,159, 85,196, 25, 25, 25,122,175,197, 71,211, 52,
+164, 82,105,133,156,165, 61,  4, 91,182,237, 52,203,203, 73,197,207, 27,143, 66,171,213, 98,254,252,249,160,105,186,120,203,206,
+206,214,203, 78, 70,167,251,210,119, 64, 22,244,158, 18,108,160,230,200,  2, 93,145,112,114, 39,136,255, 99,239,186,195,162,184,
+214,247, 59,179,125,233,189, 41,160,162, 40,  8,130, 13,197,134,189, 68, 76,172, 49,118,163,137, 55,137, 37,150, 68,108,209,152,
+ 40, 36,214,152,104,212, 24,163, 49, 54,236, 98,139,221,196,174, 32, 82, 20, 20, 17,144,186,244,178,109,118,103,206,239, 15,138,
+128,108, 65,115,127, 55,247,102,223,231,217,103,119,118,102,223, 61,101,230,156,247,124,231, 59,223, 33,  0,197,  2,120, 53, 95,
+245, 59, 33,  9, 79, 40, 61,176,226,155, 77, 54,209,143, 94,224,248,197,104, 48,165,153,200,126,112,180,210,228,216,109, 28, 14,
+170,120,232, 18,208, 18,159, 46,249,214,118,233,167,147, 14,168, 21,101, 62,168, 59,141,120,193,240, 67,195,226,171,149, 43,177,
+125,211,122,124,187,126, 19, 74, 75,138, 33, 16, 56, 84, 53,244, 44, 88,150,213,159,119, 66,  6,135,205,153, 74,125,243,227, 17,
+  4,181,117,197,225,179,119,208,163,189, 39,142,254,126, 15,189, 58, 54,199,241, 11,209,232,219,165, 37, 78, 95,141,195,167, 51,
+198, 81,227,206,237, 28,220,152, 58,218,184,241,  7,155,178,210, 92, 68,173,218,141,188,205,155,145, 54,115, 38,130,170,174,185,
+ 67, 81, 16, 54,109, 10,  8, 13,215, 81,125, 36, 38, 38, 66,165, 82, 53, 52, 50,135,175,175,175,193,122, 87, 40, 20,247,181, 90,
+ 45,201,205,205,165,114,115,115, 97,110,110, 78,197,199,199,177,126,126,254, 35,200,163, 67, 63,  1, 64,120,248,234, 17,  7,239,
+151, 66,126, 99, 19, 20, 55,191,135,176,121, 44,189,253,203, 25,204,135,203,183,221,175,245,140,214, 73,103, 78, 78,206,144,156,
+156, 28,  0, 64,139, 22, 45, 30, 37, 37, 37,181,169,158,106,174,154, 66, 20,106,181, 90,239,234,233, 68,173, 86, 11,149, 74,133,
+254,253,251,243,244,229,221,214,214,182,171,175,175, 47,162,163,163,177,105,211, 38,187, 62,125,250,224,201,147, 39,160, 40, 10,
+171, 87,175,166,218,182,109, 43,200,207,207,199,160, 65,131,112,228,200,145,110,165,165,165,134,202,211,210,220,220,124,231,201,
+147, 39, 37, 52, 77,163,172,172, 12, 28,199,161,123,247,238,160,105, 26,113,113,113, 88,178,100,  9,142, 28, 57,130, 99,199,142,
+ 73, 59,118,236,184, 83, 46,151,251,162,238,180,190,174, 58, 34, 74,165,146,136,197, 98,136,197, 98, 72, 36, 18, 72, 36, 18,136,
+ 68, 34,148, 43,129, 15, 55,164,169,120, 18,  7,206,175,125,143,150, 83,103,175,166,215, 46,123,255, 18,128,227,198,222,243, 64,
+165, 79,214,119,191,252,178,105, 66, 73,  9, 13,  0, 59, 40,138, 99,  8,249,214,152,231, 29,  0,202,149, 37,240,244,106,138,195,
+  7,142, 97,212,216,225, 13,138, 44,129, 64,  8,161, 64,  0, 43, 59,115,131,156, 66,161,208,249,209,163, 71,246,  2,129,  0,132,
+ 16,176, 44, 11,134, 97,114,151, 46, 93,234, 56,116,232, 80,203, 51,103,206,208, 67,135, 14,229,108,109,109, 43,238,220,185,147,
+167,213,106,237,123,246,236,169,147,211, 12,  8, 80, 90,183,250, 78,196,211,  6, 68, 44,254, 68, 60,105,210, 36,222,212,169, 83,
+145,158,158,142,105,211,166, 41,207,159, 63,175,206,201,206, 62, 46,226,184, 31, 24, 32,214,216, 54,185, 30,182,  4,  4,  4,116,
+ 56,122,244,232,251, 97, 97, 97,247, 22, 44, 88,240, 85,237,147,107,214,172, 89,121,250,244,105,207, 17, 35, 70,252,250,224,193,
+131, 45,141,105,151,222,180,239, 48,113,190, 25,116,105,145,106,227, 40, 69, 81, 81,181,218,236,208,234,227,176,176,176,197,225,
+225,225,241, 20, 69, 69,213,254,190,250,186,170,193, 98, 84, 67,199, 85,191,181, 91,180,104,145,127, 68, 68,196,234,224,224,224,
+253, 55,110,220,120,  6,160,177, 66, 75,191,143, 86,117,134,106,103,178, 94,167,134,210,210, 82,148,150,150, 34, 35, 35,  3, 91,
+183,110,173,122,160,  5,224,243,249,224,243,249, 53,254, 12,186,112, 49,234,207,239,  1,124,223,161, 67,  7,193,195,155,145,103,
+ 62,223, 62,187, 95,167,254, 29,120,247, 47, 62, 28,141,202,253,  8,135, 76,158, 60,217,  1,  0,118,239,222,157, 15,224,204,127,
+ 72, 53, 71, 38, 39, 39,127,234,234,234, 90,227,163, 82,123,250, 80,171,213, 66, 34,145,160,218,151, 69,169, 84, 98,235,214,173,
+ 90, 66, 72,164, 30, 78, 36,197, 95, 66,114,252,229,202,223,113, 28, 56,246,229,239, 87,172, 88,  1, 66, 72, 77,103,255, 81,149,
+229,196,160,200,107,168,204, 73,189,247,122,223, 19,150, 53, 48, 61, 33,156, 61,122,210, 76, 87,142,226,227,196,165, 24,  8,  4,
+  2,112,181,172,153,  2, 94,229,104, 57,254, 73, 22,220,156,253,240,246,184, 25, 46, 71,127,253, 97,182,150, 81,126,211,216,178,
+246,  9,  8,198,156, 79, 63,197, 79,219,183, 99,201,242,149, 53, 10, 64,203,178,208, 26, 76, 39, 77,247,239,238, 15,109,121, 22,
+120, 60, 30,250,  6,181,  4,143,199,195,128,224,214,224,241,120, 24,212,221,  7,124, 62, 31,131,123,180, 69,171, 86,173,192,231,
+243,105,  3,245,142,164,248,139, 72,142,191, 82, 75,244, 18, 16,  0, 76,118,246, 43,215,107,178,179, 65, 60,236, 27,123,111, 97,
+218,180,105,197, 25, 25, 25, 76,253,115,238,238,238,194,107,215,174,217,232,152,182,171,129, 84, 42,237,200,231,243,239, 23, 22,
+ 22,114,102,102,102, 52,199,177,156,159,159, 63,239,236,182,197, 71,171,175, 89,180,104,241,209,119, 59, 90,141,216, 19, 25, 69,
+132,205,122, 80,148, 64,172,253, 96,249, 54,161, 64, 40,237,  8, 40,140, 25, 60,208, 42,149, 10,143, 31, 63,134,161,244, 16, 66,
+244, 78,211, 20, 21, 21, 77,246,245,245,189,246,253,247,223,219, 81, 20,133, 63,254,248,  3, 60, 30,175,230,149,146,146,  2,154,
+166,241,249,231,159, 51,165,165,165,211, 13,165,141,207,231,127,122,248,240, 97,107,145, 72,132,178,178,178,154,231,134,199,227,
+225,209,163, 71, 88,187,118, 45, 38, 79,158,140,244,244,116,184,185,185, 97,254,252,249, 22, 17, 17, 17,159, 50, 12,179,210,136,
+ 42,138, 85,171,213,157,204,204,204, 32,145, 72, 80, 45,184,  0,224,247,120, 65,156, 66,161,104,103,111, 47,119,113,188, 26,117,
+162, 91,159,183,  3,237, 29, 93,131,179,179,179, 27,181,117,214, 83, 96,123, 42,203, 46, 29,114,244,168,211,245,163, 71,185, 91,
+ 39, 79,190, 16,151,149,109, 51,250, 30,210,208, 72, 75,121,129,142, 29, 59,226,254,253,251,232,216,177, 99,109,209,  4,145, 72,
+  4,161, 80,  8,161, 80,  8,  7, 91,163, 92, 40,  8, 77,211,184,126,253, 58, 88,150,133, 90,173,134, 90,173, 70,219,182,109, 11,
+ 47, 95,190,108,  1,  0, 41, 41, 41,100,226,196,137,197,183,111,223, 70,251,246,250,247, 83, 87, 82,212,197, 21,171,215, 89,127,
+179,113, 39,172,237,156,113,245,234, 85,246,236,217,179,101, 20,144,148, 28, 31,191,254,109,224,116, 36,192, 52,166,204,156,157,
+157,175,241,120,188,102,181,191, 43, 40, 40,176, 29, 57,114, 36,138,138,138,222, 26, 57,114,100,143,170, 54, 33,243,208,161, 67,
+ 19,  1, 64, 36, 18,129,166,105, 22, 38,252, 87,193,144, 22,169, 45,148,234, 11,174,240,240,240,208,250,223,213, 22, 85, 13,125,
+174,253,219,136,136,136,213,181,184, 21,175,145,124,195, 62, 90, 81, 81, 81,164,  1,  5,105, 52, 12,  9,173,106, 68, 71, 71,107,
+220,220,220,126, 74,142,121,222,175,101,128, 23,164,230,226,129,  0,190, 23,139,197,243, 38, 77,154,132, 91,183,110, 33, 46, 46,
+238,103,188,225, 42, 28,127,127,255,115, 98,177,216, 83,199, 52, 73, 90, 92, 92,220, 32, 29, 29,195,242,147, 39, 79, 66,159, 51,
+252,165, 75,151,106,119, 74,181,157,225, 27,190, 49, 56,  2, 13,163, 65,133, 92,241,178, 19,175, 18, 90, 21, 21, 21, 24, 59,118,
+108, 29,139, 86, 94, 94,158,193,252, 81, 20,133,181,199,143,227,124,100, 36,222, 10, 12,196,145, 59,119, 16, 49,105, 60,124, 60,
+155,128,176, 20,  8,  5,164,239,251,  1,  5,165,229,216,123,241, 58, 10,203,228,152,208,179, 39,188,173, 28,244,243, 10,132,  3,
+130,186,  6, 11, 47,220, 72,128, 64,192,  7, 13, 14, 68, 35,135,155,111,111,240,104, 26,214,206,205, 33, 20,  8, 32, 16,240,145,
+146,145, 15, 95,255,206,162, 40,145,100,192,235,  8, 45,119,207,230, 96, 89, 22,147, 39, 79,198,254,253,251, 97,239,226,  9,107,
+119,127,124,189,126, 59,222,234,223,211, 96,254,171, 71,240,124, 62, 31, 60, 30,239,149,247,234,207,198, 88, 39,  9, 71,192,212,
+175, 35,142,  0,132,160,233,170, 85,104,186,106, 21,238, 84,253,103,219,138, 10, 40, 20, 10,160,139, 95,163, 68,150, 90,173, 70,
+ 70, 70,  6,147,147,147,227,220,192,249, 92,181, 90,109, 80,216,236,218,181, 43,118,202,148, 41,157,236,236,236,238,197, 62,120,
+160,  9,  8, 12, 20,156,217,186,248, 88,245,180, 33,  0,  4,  6,  6, 22, 46, 94,188,248,216,196, 49,161,195,183,132,189,199,126,
+188,242, 87,190, 88, 42,237, 20,186, 96, 87,236,190, 49, 99, 12,207,205,168, 84,169,  1,  1,  1,196,152,124,201,229,242, 28, 61,
+167,135,  1,248,178, 67,135, 14, 86,125,250,244,193,181,107,215, 48,106,212, 40, 21,195, 48,201,  0, 48,116,232,208,214,123,247,
+238, 21, 37, 36, 36,192,209,209, 81,144,150,150,182, 19,  6, 28,228, 69, 34, 81,239,206,157, 59,211, 42,149,234, 21,145, 21, 17,
+ 17,129,113,227,198,161,117,235,214,224, 56, 14,229,229,229,232,211,167,143, 96,211,166, 77,189,141, 20, 90,115,124,124,124,214,
+162,114,213, 97,237,182, 48,177,106, 10, 10,  5,  5,  5, 57, 49,183, 47,198,247,236, 63,178, 83,179, 86,254,174,113,177,247,245,
+ 18, 58, 57, 57, 45,162,105,250, 93,142,227,120,165,165,165, 25, 49,106,117,171,182,158,158,206,221,135, 15, 71,137, 64,192,251,
+238,226, 69, 58,183,172,204,  2,128, 81, 83,144, 74, 77,  5, 60,189, 42, 93,253, 70,141, 29,142,251,247,239, 99,244,123, 35, 32,
+ 20, 10,193,231, 11, 42,159, 77, 97,165, 69,203,198,193,202,168,123, 83,163,209,212,180,225,213,126, 94, 12,195,160,218, 53,203,
+204,204,172,230,156, 74,165,  2, 69, 81,250,238, 13,186, 79,175,238,184, 17,157,164,157,254,249,119, 42, 65,193,253,  8, 23,142,
+219,245,  2,200,125,131,230,220,251,224,202,101, 78, 82, 43,107,176, 26, 13,252,134,143,174,121, 78,110,239,216, 34,  5,199, 73,
+139,211, 82, 49, 43,242,228, 95,189,103,174,  9,255,  1, 24,210, 34,181,133,210,155,130,162,168,168,176,176,176,197,  0, 72, 88,
+ 88,216,226,234,227,240,240,112,  5,128,204,215, 20, 91,175, 88,185,248,127,133,200,170,158, 94,208,135, 62,125,250,204,178,180,
+180,220, 84,125,156,113, 43, 19, 25,183, 50,225,219,198,175,123,135,192, 78, 37,227,198,141,131,189,189, 61, 22, 44, 88, 64,  0,
+252,220,216,255, 79, 73,138,183,  0, 64, 92, 93, 93, 23, 84, 53,200,129,119,238,220,113,188,123,247, 46, 58,119,238,252,210,116,
+207, 48,232,209,163,135, 62,170,178, 42,167,246,185,127,157,149,140,  3,195, 48,144,203, 21, 80,171, 25,104, 53, 28,180, 90, 45,
+ 58,250, 89,226,215,237, 97,149,223,105,171,173,103,149, 86,179,166, 46,150,176,180, 16,104,104,154, 82,220,139,205,105,176,197,
+ 84,171,213,136, 77, 75,195,131,231,207,  1,  0,111,135,235,119,124,253,245,226, 53,180,109,219,214, 80,106, 91, 54,117,115, 65,
+214,249,216,202,198, 91,145,129,187,127, 30,132,165,165,  5,  0,192, 47,100,  2,132,194, 74,161, 85,161, 96,224,208,198, 29, 20,
+ 33, 58,195,  2,152,217,186,156,227, 11, 37,158,132,229, 64,  8,  7,194,177, 32,132,  3, 79, 32, 52,155,245,209,251,224, 56, 22,
+ 65, 65, 65,160,120, 60,176, 26, 21,198, 12, 27,128,162,146, 50,216,219, 24,215, 73,  8,133, 66,132,132,132, 72,117,157,127,242,
+228,137,162,182, 48,211, 95, 71, 26, 84, 84, 40,160, 82,169,192,168,181, 96, 52, 90,176, 45,132,248,106,233,120,104, 25, 45,228,
+239,  5,131,209,104,193,125, 58,  2,140, 90,131,116, 51,154, 14,240,117,208,208,160, 20, 49,137, 50, 43, 67, 66,171, 90, 28,232,
+ 66, 67, 62,129, 58,196,214,131, 41, 83,166,116, 12,  8, 12,188,255,110,255,192,117, 15,227,226,179, 30,198,197,191,114,157,103,
+235,192,212,143, 35,246,207, 23,  8,165, 29, 67, 23,232, 95,117, 88, 27,181,167, 17,223, 16,139,203,202,202,  2, 44, 44, 44,144,
+148,148,  4, 30,143,  7,138,162,158,  0,  8,  0,  0, 87, 87,215,167,124, 62,223,139,199,227, 97,243,230,205, 20,159,207,111, 23,
+ 28, 28,188, 88,169, 84, 30,212, 51,160,243,181,180,180,172, 99,205, 18, 10,133,  8, 11, 11,195,196,137, 19,107, 68,150, 80, 40,
+196,174, 93,187,208,169, 83, 39,168,213,106, 95, 35,211,123, 23, 64, 79, 35, 44,126, 84,149, 56, 55, 40, 70,181, 90,237,148,130,
+119,223,109,133,171, 87,209,221,203,171,109,199,142, 29,193, 48, 47, 13, 58, 94, 94, 94,238,101,101,101, 57, 10,133,226, 55, 84,
+134, 33,136,209, 43,138,148, 28,210, 82, 42,221, 79,239,223,191,143,160,160,160, 26, 11, 86,109,107,150, 80, 40,132, 84,100,209,
+ 40,161,197,113,149,237, 82, 89, 89, 25,125,245,234, 85,  7, 31, 31, 31, 10,  0,124,124,124,168,152,152, 24, 59, 51, 51,179,252,
+150, 45, 91, 26, 26,  0, 11,  1,160,247,192,145,252,243,103, 79,155,107,129,149, 57, 60,222, 74,190,193, 54,146,104, 88,142,211,
+233,116, 47,181,178,198,174, 41, 99,  1,  0, 95,244, 31, 92, 51,216, 58,251,229, 98,  8,  4,  2,244, 91,176,248,149,103,137,227,
+ 56, 30, 76,248,159, 18, 89, 13, 89,180,222,172,111,126,105,209, 10, 15, 15,143, 15, 15, 15,127,197, 58,214, 72, 24,182,104,213,
+ 54,221, 53, 22,213, 15,171, 46,172, 95,191, 30,237,218,181,211,219, 17,109,218,180,  9,123,246,236, 89, 15, 32,165,209, 38,199,
+126, 29,252,176,225,104,188, 87,107, 63, 10,  0, 86,126, 58,140,174,168,168,192,245,235,215, 97,109,109,141, 39, 79,140, 14,251,
+101,105,109,109,253, 37, 77,211, 99,120,245, 87,  0, 52, 44, 48, 89,142,227, 34, 75, 74, 74,116,134,119, 32,  4, 96, 52, 90, 84,
+200,149, 80,171,213,248,244,243, 31, 12, 38, 34, 28,160, 24,117, 25, 63,164, 87,176, 84,151, 69, 39,168, 93,111,124, 50,201,226,
+149,206,155, 71,  3, 52, 13,180, 15,170,180,184,196,220,137,  7,199,  1, 44,  7, 56, 56,217,226,231,125,235,244,138,124, 45,203,
+ 85,141,142, 89,148,171, 88,248,118, 13,197,139,196,171, 53, 22, 36,145,176,114,202, 88, 40, 16,128, 35, 84,101,212,  7, 93,173,
+174, 72,234, 89,148,157,226,189, 61,234, 33, 62, 12,109,135, 67, 23, 98, 49,186,127,  0, 46,223, 78, 64,159, 46,109, 17,159,252,
+ 28,126,222,205,176,121,103, 36,  8, 65,217,143, 27,190,206,121,217,161,105,211,140,177,104,221,186,117, 75, 81,223,138, 85,251,
+157, 24,238, 15, 65,200, 75,139,150, 66,169,194,130, 69, 70,133,222,169,172,163,158, 93,165,198, 92,172,207, 98,101,140, 16,171,
+111,217,130,129,240, 44, 45,  0,116,  2, 22,254, 39, 27, 78,150,101,113,234,212,169,154,250,104,168, 30,107,215,157, 17, 34,  7,
+105,105,105,136,143,143, 71,215,174, 93, 81, 82, 82,  2,  1, 77, 99,254,195,135,104, 59,105, 18,212, 66, 33, 56,142,131, 72, 36,
+194,140, 25, 51,140, 46,207, 70,182,206, 85,142,215,172, 33,242,117,193,193,193,173,146, 42, 42, 16,255,232, 17,250,175, 88,  1,
+  0, 56,125,250,116,157,123, 98,222,188,121,162,132,132,132,105,247,238,221,155,150,149,149,181, 30,192,124,157,237, 44, 81,213,
+248,104,189, 59,126, 20, 90,249,180,192,158, 95,246,213,156,159,247,217, 28,  8,  4, 66,  8,132,  2,216, 88,219, 24,149, 27,141,
+ 70, 83, 35, 90,229,114, 57,125,250,244,233,166,  3,  6, 12, 16,206,153, 51,135,  2,128, 61,123,246,208,223,127,255,189,249,249,
+243,231,133, 77,154, 52,201, 54, 96, 33, 40,205, 44, 80,137,  1,192,195,195,  3, 63,108, 59, 65, 15, 29, 58, 20,115,230,204,129,
+ 70,163,193,150, 45,149,207,213,184,113,227,192, 48, 12, 14, 31, 62, 92,253, 28,235,181, 70,105, 25,230,149,251,134,162, 40,  8,
+  4,  2,  8, 69, 66,128,227, 64, 81,148,249,154, 53,107, 86,198,199,199,119,246,241,241,129, 74,165,154,132,202,197, 31,166, 56,
+ 90,255,101, 98, 75,159, 22,105,200,215,170,202, 42,165, 11,178,218,126, 91,186,132, 90,109,159, 45,188,222,  2, 10,227,124,180,
+ 26,  2,143,199, 51,104,173,170, 94,170,171, 15,243,230,205,131,165,165,165,174, 14,136, 60,124,248, 48, 33, 59, 59,123, 59,128,
+ 31, 94,171,114, 46, 70,199,127, 57,119, 68, 25,170,230, 86,109,108,108,242,251,246,237, 91, 14,128, 57,120,176,238,  0, 89,165,
+ 82,233,236,192,173,173,173,191,220,177, 99,199,236,225,195,135,211,245, 67, 12,212,158,222,171,126,105, 52, 26, 28, 60,120,112,
+246,194,133, 11, 81, 82, 82, 50, 87, 95, 39, 46,175, 80, 64, 81,229,  8,253, 52,238,144,177,141,186,206, 83, 22, 54,174,104,218,
+ 34, 64,103,103, 66, 11, 43,125,136,156, 61, 94,118, 96,150,150, 18,176,122, 56, 41,138, 78,121,158,158,213,196,221,197, 14, 79,
+ 51,100,112,110,214, 14, 69,153, 47,203,129,207,231, 65, 80, 53,117,104, 99,101, 14, 89, 94, 30,104,154,167, 87, 24,127,189, 55,
+ 26,183,227,158,227,240,133, 24, 48,202, 10,108,216,125, 22,140,170, 28,140,178,  2,140,178,242,125,245,194, 15, 64, 81,200,209,
+168, 42, 90, 55,166,222,249,124, 62,186,116,233,162, 83,232,100,102,102, 26,105,209, 34, 53, 22, 45,133,178,145,117,100,220,200,
+ 73,175,197,170,250,252,235, 10,131,234,144, 15, 82,169,180,211,174, 93,186,195, 56, 52,  4, 23, 23,151, 51, 22, 22, 22,205,141,
+189,190, 17,193, 75, 87,219,216,216,124,233,227,227,227,187, 97,195,  6,  1,143,199, 67,191,126,253, 90,187,184,184,164,  1,128,
+159,159,159, 91,117, 27,243,241,199, 31,147, 91,183,110,197, 85,142, 49,116, 67, 36, 18, 61,178,182,182,238,212,167, 79, 31,148,
+148,148, 32, 35, 35,  3,230,230,230,104,187,110, 29, 30,126,252, 49,  2,183,110,  5,221,183, 47, 40,138,130, 72, 36,194,195,135,
+ 15, 33,149, 74, 31, 41,149, 58, 67,190,117,  1,240, 45,128,238,120, 57, 93, 72,  0, 92, 71,101,216,133,219, 13,180,119, 52,  0,
+176, 28,103,168,178,198, 47, 88,176,  0,197,  2,  1, 48,116, 40,132, 41, 41, 96, 24,  6, 93,187,118,173,177,178,119,237,218, 21,
+124, 62, 31,  1,  1,  1,112,115,115,195,230,205,155,199,235, 19, 90,202,114,  6,105, 41, 47, 16, 28, 28, 92, 99,185, 26, 58,116,
+104,141, 69, 75, 32, 16,212, 88,182, 40,214,176,112,165, 40,138,212, 30, 36,179, 44, 75,241,249,124,254,220,185,115,169, 81,163,
+ 70, 17,181, 90,205,137, 68, 34,250,240,225,195,212,229,203,151,249, 21, 21, 21,134,172, 13, 21,239,189,247,158,147,187,123, 83,
+100, 60,141,199,161, 67,  4,235,215,175,199,181,107,149, 81, 54,146,146, 42, 23,174, 86, 31,247,233,211,  7,205,155, 55,  7, 49,
+112,227,251,143, 24,131, 47,  6, 12,169,108, 79,154, 59, 66, 32, 20, 64, 36, 20, 98,193,163, 23, 53,117,109,181,107,191, 40, 34,
+ 34, 98,180,143,143, 79,229,212, 62,192, 55,197,209,250,239,130,  1, 67,143,172,158, 72, 82,215, 58,150,  1,160,170,142,101,181,
+  4,149,140,162,168,187,132,144,206,245,174,173, 62,175,174,247, 94,125,254,193,107, 36,191,122,175,195, 87,196,151,190, 17,113,
+242,205,155, 55,189, 59,118,236,136,244,244,244, 87, 86,194, 85,119, 92,230,230,230,144, 74,165,184,113,227,  6,  0, 36,235, 34,
+187,124,249,242,247,168,140,186,140,170,105,131,224, 62,239,246,190, 17, 52,184, 51,246,134,239, 43,201,206,206, 14,192,203, 24,
+ 58,148,155,155,219, 68,129,136, 63,214,203,223, 35,  4, 28,247,237,197,147,215, 87,232,203,161, 87,107,191,114,  0,138,234, 85,
+135,175,185,250, 16, 52, 77,143, 25, 62,124, 56,157,144,144,128,177, 99,199, 98,207,158, 61, 58,175,157, 56,113, 34,246,239,223,
+143,225,195,135,211,139, 22, 45,210, 25,222,161,174,181, 68,253,151,221,148, 73, 79, 30,224,215,253, 59,116,250, 32, 57, 57, 85,
+250, 99,229,229,229,215,124,215,185,163,254,153, 17, 78,171, 62, 31,125,239, 78,112,183, 94,253,132, 25,185,197,224,180, 42, 40,
+203, 94,254, 94, 94,156, 11,162, 85, 66,104,102,  7, 23,  7,107,220,191,249,187,154, 81, 43,207,235,227,156, 61,220, 15, 31, 15,
+243,  5,  8,135, 17,243,127, 70,212, 15,179,106, 70,208, 61, 70,205,193,197,131,223, 25,237,227, 87, 31,  2,129,  0, 15, 31, 62,
+ 84,232,178,102,241,120, 60, 99, 98,114, 85, 89, 29, 53,144,203, 21,144, 43,148,127,101,219,225,232,236,236,252,163,173,173,173,
+ 68,135,144,114,116,116,116,252,209,222,222, 94, 98,236,212,161, 46,145, 85, 21, 87,235,222,148, 41, 83, 26, 37,182,196, 98,113,
+243,228,228,228,154, 96,165,250,222,213,106, 53,250,244,233, 99,108,240,210,147,  0,158,185,186,186, 94,111,219,182,173,245,211,
+167, 79,177,111,223, 62,161, 64, 32,240,168,110, 63,202,202,202,192,227,241,144,151,151,167,  1,240, 62, 12, 76,157,169, 84,170,
+171, 87,175, 94,109, 63,108,216, 48,222,163, 71,143,192,227,241, 42,211, 21, 28,140,192,173, 91, 17, 55,119, 46, 66,158, 63,135,
+146, 97, 32,145, 72,112,238,220, 57, 70, 46,151, 95,213,197, 39,149, 74,183,167,166,166,250, 73, 36, 18, 48, 12,  3,142,227, 64,
+211, 52,197,231,243,123,216,216,216,108,  2,208,185, 94,101, 57,  5,118,238,211,134,213,106,217,236,244,167, 50, 67,  5, 80, 80,
+ 80,128,147, 39, 79,162,107,215,174,  8,  9,  9, 65,102,102, 38, 82, 82, 82,240,214, 91,111,213, 92,243,224,193,  3, 68, 71, 71,
+163,101,203,150,134, 45,122,180,  6, 45,219, 52,135, 80, 40,172,180,230,  8,132, 85,  3, 31, 65,141, 37, 75, 40, 16, 66,192, 23,
+ 64, 34,149, 24,109,209,162, 40, 10, 52, 77,131,162, 40, 72,165,210,234, 65, 54,215,180,105,211,236,194,194, 66, 87,  0, 60,169,
+ 84, 10,150,101,245, 14, 90, 56, 66,188,133,249, 55,178,230, 47, 92,235, 20, 30,126,  1, 23, 46,228,129,166,105,184,186,186,130,
+166,105,164,166,166,130,166,105,120,122,122,130,166,105,100,102,102, 86,139,196, 34,232, 22,195, 53,207, 13, 69, 81, 53, 34, 75,
+ 40, 18,214, 88,182,  0,160,184,184, 88, 57,124,248,240,223, 84, 42,213, 84,188,222,174, 39, 38,252,141, 65, 81,212,221,255,196,
+111, 27,129,161, 85,194,234, 21,167,120,125, 55,227, 91,221,186,117,219, 58,110,220,184,126, 27, 55,110,132,133,133,  5,178,179,
+179,107, 58, 68,145, 72,  4,119,119,119, 20, 22, 22, 98,219,182,109,120,241,226,197, 37,  0, 51,140, 77, 81,118,118,246,173, 39,
+ 49,201,  5,125, 70,119,179,247,235,214,198, 38, 35,249, 69,215,236,236,236, 27, 85, 34,235,231,113,243,222,154,218,103,100, 16,
+132, 34,  1, 50,158,228,224,226,201,235,255, 47,149,201,227,241,120, 20, 69, 97,236,216,177, 70, 93,255,222,123,239,225,234,213,
+171,208, 55,205,200, 85, 91,180,228, 74, 84, 40,254,186,129,213, 39,179, 38,226,147, 89, 19,107,196,132, 49, 83, 47,  0,224,230,
+118, 64,143, 95,191, 93,233,  0,  0, 32,  0, 73, 68, 65, 84,208, 98, 54, 70, 29,216,246, 97,135,160, 96,207, 78,126,205,113,251,
+ 94, 12,246,110,125,105,100,216,249,253, 74,124,179,243, 18,220,157,109,193,168, 42,112,230,208, 79, 57,140, 74,190,241, 53,141,
+114,149,226,150,162, 64,  8,215,168,188, 87,139, 39,129, 64,  0,127,127,127,157, 22,173,194,194, 66,133, 33,107, 86, 77, 29,169,
+ 53, 40,175, 80, 64, 33,255,203,132, 86, 96,143, 30, 61,206, 71, 70, 70,218, 59, 57, 57, 33, 43, 43,171,190,208, 10,236,222,189,
+251,249,200,200, 72,123,103,103,103,100,100,100, 24, 29, 86,164,  1,145,  5,153, 76, 70, 21, 21, 21,113,182,182,182,141, 18, 91,
+ 52, 77, 67,165, 82, 33, 49, 49,209,216,191, 53,122, 53,151,181,181,245,174,253,251,247, 91,231,231,231,131,199,227, 33, 49, 49,
+177,206,170,195,234,215,207, 63,255, 44, 28, 49, 98,196,142,226,226, 98,189,203,218,180, 90,237,250,137, 19, 39, 78,203,204,204,
+180,117,114,114, 66,118,118, 54, 68, 34, 17,  8, 33,160,250,244, 65,207,103,207,192,176, 44,164, 82, 41,146,146,146,176,125,251,
+246,138,170, 80, 49, 13, 26,200, 40,138,242, 22, 10,133,152, 48, 97, 66,157, 19,187,119,239,198,219,157,120,157, 28,173,249,229,
+ 90, 72, 84,185,210, 33,103,120, 60, 30, 21,216,165,111,235, 46,189,134,250, 63,142,187,253, 84,150,251,194, 80,163,164, 81,171,
+213,240,241,241,193,221,187,119,113,225,194,  5,244,237,219, 23, 33, 33, 33,136,141,141,197,239,191,255,142,232,232,104, 80, 20,
+  5,123,123,251,106,247, 11,189, 62, 24,106,185, 22,121, 89,  5,175, 88,175,234, 31, 11,133, 66,168, 20,198, 45,238,123,244,232,
+ 17,238,222,189, 91, 19, 90,134,199,227,105, 39, 77,154,  4, 66,  8, 73, 77, 77,133,165,165, 37,153, 50,101, 10,203,231,243,181,
+153,153,198,249,  7, 91, 88, 88,192,219,219,187,206,192,167,250,213,179,103, 79,220,187,119, 15, 52, 77,131,207,231,195,201,201,
+  9,215,175, 95, 55,120,227, 87,139,170,106,145,197, 23, 10,234,136, 62,142,227,202, 98, 99, 99, 63,  4, 16, 91,101,201,  2, 76,
+113,180, 76,248,255,195, 41,188,186,177,180, 65,139,214, 51,  0,253,247,237,219, 55,254,216,177, 99,235, 55,109,218,228, 24, 26,
+ 26,138,162,162, 34,120,122,122,194,213,213, 21, 81, 81, 81, 56,125,250,116, 62,203,178,243,  1, 52,100,250,233, 15, 61, 49,107,
+ 50,159,102, 71,170,202,203, 63,238, 24,226,139, 75,  7,255,  8,119,113,113,153,193,227,241, 62,157,178,248,157,169,189,135,119,
+ 70, 82,116, 42,110,253,254, 16,185,233,249,  6, 57,235, 59,195,219,216,216, 76, 51, 51, 51, 19,161,129,165,196, 13,172, 58,172,
+225,100, 89,150, 85,171,213, 56,112,224,128, 81, 98,107,223,190,125, 80, 42,149, 96, 95,157, 95,173,225, 36, 28,161,248,  2, 49,
+220,220,125,192, 48, 21,224,184,215, 94, 80, 89,195, 89, 61,  2,125, 42, 18,193, 41, 63, 31,183,111,223, 54, 78,114, 15, 29,106,
+168,142,148,106,101,217,132,239, 86, 45,136,154, 25,246,173, 77,223,110,237,241,197,186,221, 96,152,157,160,121, 52,164, 98, 33,
+ 58,  6,117,  7, 15, 42,252, 24,241, 89,177,188,180,104,  2, 94,221,138,167, 14, 39,209, 55,195, 66,  0,150,227,112,225,218, 29,
+163,243, 94,107,154,  3,124, 62, 31, 79,158, 60, 81, 52,180,218,144,199,171,156,230,172, 30,169,235,227, 36, 28, 71,  9,132, 18,
+184,123,182,133, 90, 85,254,151,212,145,147,147,211,103, 71,143, 30,181,175, 14,149, 16, 27, 27, 11,138,162, 18, 95, 90, 28, 43,
+207, 43, 20, 10,196,197,197, 33, 54, 54, 22,168, 92,225,102,244,115, 84,109,201,146,201,100, 84,118,118, 54,204,204,204,232,216,
+216, 88, 85, 64, 64,192, 61,  3,207,119, 13,167, 82,169,124,174,203,127, 82,169, 84, 54,145, 72, 36,130,122, 29,158, 91,171, 86,
+173,146, 26,152, 66,124, 37,157, 37, 37, 37,183, 23, 46, 92,216,113,240,224,193,248,236,179,207, 10,109,109,109, 45,127,252,241,
+ 71, 62,143,199,163,102,206,156,201,230,229,229,149,255,244,211, 79,214,199,142, 29, 67,113,113,241, 13, 35,242, 94,166, 84, 42,
+ 63,236,214,173,219,238,179,103,207,154,121,123,123,163,180,180, 20,132, 16,236,218,181, 11, 51,103,206,132, 68, 34, 65, 82, 82,
+ 18,222,126,251,109,185, 92, 46,255, 16,175,250, 78, 86,115, 82, 20, 69, 17,142,227,176,108,217,178,154,224,164,213,193, 74, 45,
+165, 20,182,207,107, 97, 62,231,167, 18,243,241, 95,252, 52,  9,  0, 88,173,150,125, 28,119,251,233,174, 31,190,184, 44, 20, 10,
+175, 25,168,163, 37,115,230,204,249,113,232,208,161, 82, 11, 11, 11, 20, 22, 22,226,250,245,235,184,121,243, 38,110,221,186,  5,
+181, 90, 13,123,123,123,216,218,218, 34, 59, 59, 27,143, 30, 61, 82,  0, 88,162,143, 83,100, 38,128, 87,235,234,149,191,149, 22,
+ 44, 65,173,213,134,181,173, 91, 66,129,192,168,231,168, 87,175, 94,232,210,165, 75,181, 88, 97,211,210,210,178, 85, 42, 21, 85,
+ 75,244,103, 86, 11,114, 15, 15, 15,237,158, 61,123,136, 33, 78,142,227, 94, 17,211, 61,123,246,172, 25, 20,118,233,210,  5, 60,
+ 30, 15, 49, 49, 49,186, 92, 83,234,112,222,218,190, 25,103,191, 90,  2,145, 80,136,249,137, 25, 53,162,107,119,223, 14, 16,136,
+132,240, 29, 54,170,246,111,183,160,114,186, 16,245, 68,150,190,254,232,141,159,119, 19,231, 63, 30,217,120,141, 45,120,170,177,
+ 87,169, 84,158,249,224,131, 15, 34,  2,  3,  3, 63,216,176, 97,  3, 37, 20, 10,177, 98,197, 10,146,149,149,245, 75,213,136,161,
+232,117, 82, 69,  8,249,229,202,145, 27, 31, 77, 14, 27, 78,205,219, 56,165,199,189,139,113,143,218,117,243, 70,187,110,222,184,
+119, 41,  1, 63, 44,222,183,135,213,176,203,114,114,114,210, 13, 80,169,250,119,111, 83,223, 25,222,254,234,229,139,246,141, 93,
+117,200,113, 92,228,190,125,251,102,143, 28, 57,146,190,115,231,206, 43, 62, 89,213,219,238,112, 28,135,243,231,207,131, 97, 24,
+252,242,203, 47, 28,199,113,186,227,104,129, 28,255,110, 99,196,228, 95,126, 61, 46, 18,  9, 41,220,188,118, 24, 37, 69,250, 87,
+117,  9,133,  2,252,188,235,  8, 35, 20, 10, 30, 55,116,158, 97,152,140,139, 23, 47, 58, 15, 98, 89,  1, 77,211, 13,  9,168,  6,
+ 17, 25, 25,169,225, 56, 46,205,192,101, 55,114, 95,164, 15,251,250,179,247,247, 13,125,247,  3,231,110,221,122,  8, 28,156,156,
+ 65, 81, 20,242,114,243,144, 20,119, 71,115,230,240,142,220, 10,185,113, 91,240,188,191,246, 74,141, 79, 22,  0,132,206,220, 84,
+227,159,  5,  0,195,166, 44, 68,159,174,126,160,140, 49, 61,189, 20, 89,156, 86,171,133,185,185, 57,180, 90,109,131, 33, 30,172,
+173,173,165, 74,165, 82, 81, 21,136, 81,239,136,153,  0,127,121, 29,177, 44,235, 91, 84, 84,132,138,138, 10,220,188,121,147,172,
+ 90,181, 74, 38,147,201,106,156, 54, 53, 26,141,111, 97, 97, 33,202,203,203,113,227,198, 13, 18, 17, 17, 33, 43, 40, 40, 88,220,
+152,103, 72, 42,149,118,226,243,249,247,138,138,138, 56, 51, 51, 51, 90,163,209,104,  2,  2,  2,196, 82,169,212,232, 13,213,179,
+179,179,  7,235, 58,231,229,229,149,156,156,156,220,138,101,217,218,123, 32, 10,149, 74,165,119,183,110,221,140,105, 63,230,236,
+220,185, 19, 71,142, 28,  9, 42, 45, 45,157,152,150,150,182, 27, 64, 16,159,207, 71, 76, 76, 76,162, 82,169, 28, 55,114,228,200,
+ 93, 69, 69, 69,183, 81,185,  5,143, 49, 56,155,148,148, 52,193,215,215,119,231,151, 95,126,105, 17, 18, 18,194,119,115,115, 67,
+231,206,157,145,148,148,132, 83,167, 78,105,182,108,217, 82, 33,151,203,223,  7,112, 94,127,181,131,210,106,181, 16,137, 68, 53,
+ 47,177, 88, 12,161, 80,136, 50,  5,193,244,117, 41, 10, 45,164,138,245, 43, 62, 60, 69,  0, 42, 39, 35, 37, 63, 47, 39,227, 54,
+ 69, 81,215,178,179,179, 75,116,148,153, 72,169, 84,182, 39,132,240, 40,138,218,200, 48,204,148, 89,179,102,185,174, 94,189, 26,
+109,218,180, 65,126,126, 62,204,205,205,225,237,237, 13,153, 76,134, 59,119,238,176,114,185,124, 43,128,149,168,242, 31,209,133,
+226,252, 82, 52,117,241,168, 99,249, 36,132,128,176,128, 70,197,130,101,  8,212,148,  6,  2,129,  6, 66,161,208,152, 41, 21,194,
+113, 28,138, 92, 93,193,197,197,225,214,173, 91, 32,132,232,180,170,249,248,248, 24,101, 33,101, 89,246, 21,161,117,251,246,109,
+240,120, 60,244,232,209,  3,209,209,209, 53, 22, 45,163,252, 18,  9,  7,145, 88, 84,103,186,144,162, 40,  8, 69, 34,  8, 68,194,
+134, 86,227,152,172, 88, 38,252,109, 96,236, 60,118, 49,128, 25, 15, 30, 60,216,221,187,119,239, 40, 66,136,  0,149,243,145,127,
+188,201,159,231,228,228,220,191,113,234,254, 34,231,166,182, 17, 67, 38,246, 64,155,246,158, 96,181, 44,174,159,142,193, 47,171,
+143,237,207,204,200,156,  2, 35,246, 62,227, 56,238,114,247, 78,109,104,212,138,213,237,230,230,198,189,206,170,195,146,146,146,
+229,243,231,207,199,103,159,125,246, 58,171, 14, 27,196,195, 71,178, 25, 20, 72,211, 97, 67,122, 14,  2, 69, 19,181, 90,165,167,
+225, 67, 77,228, 82,161, 80,240,248,110,108,118, 64, 67,215,201,100,178, 65, 83,167, 78, 61,207,231,243,155, 55,166,204, 57,142,
+ 75,203,205,205,237,103,248, 74,237,117,149,162,212,251,228,254,109,115,207, 30,217, 57,136,227,216,150, 20,  0, 30, 95,248, 84,
+195, 48,231, 84,138,210, 13, 48,114, 83,233, 53, 51,130, 49,231,187,223,177,249,179, 97,152, 21,113, 16, 59,150, 77,199,162,117,
+251,240,237,103,115,176,106,211,111,248, 98,206,  4,140, 30, 63,149, 35, 20,253,167,177,249,224,241,120,103,183,109,219, 54,121,
+250,244,233, 53,139, 22,  8, 33,117, 26, 97,141, 70,163,224, 56, 14, 91,183,110,229,  0,156,213,199, 87,183,142, 40,162,207, 95,
+202,216, 58, 42, 45, 45,125, 63, 56, 56,120, 23,  0, 49, 33,228, 73, 81, 81,209,191,128,151, 91, 67,149,151,151,191,223,173, 91,
+183, 93,132, 16, 49, 69, 81,175,156, 55,  6, 85,161, 30, 58,217,218,218,222,171,178,100,137, 95,199, 33, 94, 95, 81,235,153, 86,
+ 52,102, 10,145,  3, 48,171, 86,196,247,213, 65, 65, 65,181, 55,149, 78, 44, 42, 42,234,244, 26,233, 58,175, 80, 40,252,150, 45,
+ 91, 54, 87, 34,145,244,145,203,229,173,  1,192,220,220, 60, 73,165, 82, 93, 86, 40, 20, 27, 96, 56, 54,149,154,227,184, 36,173,
+ 86,235,239,232,232, 88,185,162,182, 74,108,  1,192,137,123,236, 61,128,237, 92,105, 20,223,107,116,194, 78,159, 62,221,204,214,
+214,118, 32, 69, 81,163,  9, 33, 62,101,101,101,170,101,203,150,221,136,140,140, 44,105,222,188,249,144,161, 67,135, 82,118,118,
+118,184,123,247, 46, 41, 40, 40, 56, 12, 96, 49,140, 88,105,205,113, 92,218,154, 53,107,208,216,231, 93,223,121,134, 97,114, 78,
+159, 62,237, 48, 56, 47,143,207,113, 28,134, 13, 27, 86, 71,192,213,199,227,199,143,161, 82,169, 12,  6,115, 44, 46, 46, 70, 80,
+ 80, 80,157,  1,106,245, 43, 45, 45, 13,118,118,118,117,254,199,208, 24, 75, 85, 82,132,190,115, 23,  2, 85, 43, 74,171, 81,105,
+201, 34, 32,106,147,174, 50,225,239,139,127,247,230,155, 70,153, 22, 93, 93, 93,199, 74,204,197,159,120,182,118, 13,200, 74,201,
+ 75, 40, 43,145,239,201,206,206,222,166,163, 33, 55,138,179,145,  1, 75, 77,230,223,127, 19,231,203, 56, 90, 44,  8, 97, 65, 56,
+  2, 66, 56,112, 28, 91,185,225, 53,225, 64, 88,150,162, 40,252,169, 86,232,141, 12, 94, 63,157,182, 14, 14, 14, 43,  9, 33,131,
+121, 60, 30, 93,187,161,174,253,185,202,146,117, 86, 38,147,125,209,128,229,245,191,174, 60, 35, 35, 35, 27, 20,255,198,174, 58,
+ 28, 51,102, 12,219,200,103,243,178,185,185,185,107, 67,231, 42, 42, 42,210,179,179,179,  7,254, 77,202,179,246,138,193,198,112,
+ 54,122,213,161, 33, 78, 79, 79, 79, 49,195, 48, 29,  0,120, 83, 20,101,  3,160,144, 97,152,115,249,249,249,185,  0, 58,  1, 88,
+ 86,245,155,175,  0,220,251, 15, 63,239, 82,  7,  7,135,157, 52, 77, 55, 53,230,199, 90,173, 86, 93, 88, 88, 56,185,222,128,224,
+229, 20, 60,192,147,  8,133,119, 64,211, 77, 26,122, 30,117,125,  6, 33,153, 21, 10, 69, 16,245,178,205,175,225,180,183,183,191,
+199,231,243,155, 26,145,182, 23,  5,  5,  5,157, 76,109,242,127, 53,231,127, 51,234, 59,193,235,140, 20,255,239, 16, 90, 38, 78,
+ 19,167,137,211,196,105,226, 52,113,154, 56, 77,156,255,235, 66,171,193, 99,211, 18, 88, 19, 76, 48,193,  4, 19, 76, 48,193,132,
+ 55,195,169,122, 98,235, 84,245,  7, 74,143, 42,109,140, 73,240,117,148,237,  5, 19,167,137,211,196,105,226, 52,113,154, 56, 77,
+156,255, 56, 78, 19,254, 66,152,204,170, 38, 78, 19,167,137,211,196,105,226, 52,113,154, 56,255,215,161,115,234,144, 54,149,141,
+  9, 38,152, 96,130,  9, 38,152, 96,194,191,  7, 70, 11, 45,115,103, 31, 95,  7,207,128, 93,182, 77,219,197,218, 54,109, 23,235,
+224, 25,176,203,220,217,199,247, 31, 90,110, 82,  0,227,249,124,254,121, 23, 23,151, 82,232,216,122,231,127,  0, 86,  0, 70,163,
+ 50,190,207,  8,  0,102,127, 37,121,  8,192, 31, 11,124, 50,  9, 72,159,  4,164,143,  5, 62,  9,249, 31,244, 27, 92, 49,219, 53,
+248,218,153,241,103, 86,204,118, 13,110,240,252,124, 87,251, 91,191,143,249,110,245, 39,110,118,127,209, 95, 90, 58, 57, 57,109,
+119,118,118,126,238,228,228,148,230,228,228,180, 19,128,181,169,185, 51,193,  4, 19, 76,248,183,161,218, 71,171,250, 85,227,163,
+197,  7,128,168,168,168, 16,  0, 87,  0,244, 14, 13, 13,189, 90,255,215,182, 30,254,211, 91,182,104,249,217,215, 43, 22, 83, 46,
+ 78, 14,102, 90,150, 99, 82,159,103,180, 93,254,117,196,161, 44, 17,127,125, 81,122,220,142,215, 72, 20,197,227,241,198,138,197,
+226, 80,  0,213,130, 45, 81,165, 82, 69,177, 44,123,  0,198, 45,211,134,179,179,243, 53, 30,143,215,172, 49,127,204,178,108,122,
+110,110,110,143,215, 44,204, 49, 30, 30, 30, 59, 67, 66, 66,204,130,130,130, 32, 18,137,176,108,217,178,249,217,217,217, 27,140,
+ 37,176,181,245,178,100,196,146, 79,249, 34,209,  0,162, 81,251, 19, 16,128, 22,199,113, 90,213, 69,161, 74,181,190,168, 40,165,
+204, 72,170,197,  0,166, 84,149,213, 14,  0,107,222,228, 46,153,220, 30, 26, 13, 91,121, 79,  8,249, 96,143, 63,179,190,178,100,
+201, 18,126,104,104, 40,118,236,216,209, 99,251,246,237, 31,150,149,149, 93,  4,112,  2,192,211, 55,189, 43,157,129, 25,221,122,
+244,248,110,242,252,249, 60,197,181,107,248,110,231,206,141,168,140,183,180,185,177,247,146, 80,136,209, 14, 14,130, 80, 66,208,
+129,  2, 40, 10,136,145, 21,112,167, 25,134, 61,  0, 35, 98,177,233,193,120,212, 93,142,191,183,177,  4, 37, 79,201, 82,241, 48,
+223,158, 37, 79, 47, 47,  5, 48,164,254,121,173, 82, 50,153,240,220, 67, 21, 36, 58,  3,192,186, 55, 44, 86, 51, 71, 71,199,216,
+227,199,143, 55, 13, 10, 10,226,  3,192,189,123,247, 38,133,134,134,246,149,201,100,254,  0, 74,255, 67,141,144,132, 79,211,159,
+136,  4,130,  1, 44,203,182,  3,  0, 30,143,247, 80,173,209,156,215,114,220,102, 24, 25,147,205,  4, 19, 76,248,223,133, 33, 45,
+242, 55,135,206,200,240,213,153, 35,181,223,107,195,220,169, 77,219,174,253, 70, 61, 46, 41,147, 43,159, 63,207, 44,154,247,201,
+170,243, 31,206, 89,123,108,221, 79, 81,167,175,222, 78,188,229, 27, 52, 48,193,220,169, 77, 91, 29,212,186,230,112, 61,164, 82,
+233,253, 45, 91,182, 48, 73, 73, 73,164,184,184,152, 60,126,252,152, 28, 62,124,152,124,244,209, 71, 74,169, 84,122, 31,128,135,
+ 49,156,206,206,206,185,143, 47,253, 78, 94,196, 70,147,180,123,183,137, 70,163, 33, 12,195, 16,134, 97, 72,194,217, 40, 18,123,
+226,  8,137, 57,124,128,168,213,106,162, 86,171,137, 74,165, 34, 45, 90,180,200, 50, 50,157,245,225,230,231,231,167,142,138,138,
+ 34,135, 14, 29, 34,243,231,207, 39,129,129,129, 44,128,153,198,230,221,220,201,187,143,101,147,  0,217,244,176,205,204,169, 27,
+231, 72,252,179, 24, 18,255, 44,153, 68, 94, 72, 36, 83, 22,108, 98, 44,155,  4,202,204,157,188,251, 24,202,187,173,173,109, 87,
+138,162, 72, 53,  0,144,102,205,154,149,215,126,121,120,120,212,121,185,187,187,151, 55,111,222,252,169,189,189,125,135,134, 56,
+199,181,  3, 33,  9,123,  9, 73,216, 75,150,244,  2,137,143,143,191, 69,  8,185, 82,253, 82, 40, 20, 87,142, 30, 61,122,229,157,
+119,222,185,  2,224,109, 61,229,100, 84,121, 78,  2,210,203,142, 31, 39,100,195,  6, 66, 66, 66, 72, 34, 64, 38,  1,233,141,228,
+108,225,226, 34,136, 89,187,230, 67,245,241,227,191,144, 51,103, 78,145,211,167,163,200,177,163, 59,201,198, 13,159, 48,206,206,
+130, 56,  0,173, 26,193,201,  7,176, 10,192,122, 84, 90, 46,147,100, 50, 25,201,201,201, 33,  0,146,170,190, 91,239,232,232,184,
+ 14, 13, 91,223,250,215,182,100,205, 29,236,114,230,221, 33, 61, 72, 89, 73, 22,121,119, 72, 15, 50,119,176, 75, 29,203,214, 96,
+ 47, 47,203, 89,195,218,201,226,239,237, 97,103, 13,107, 39, 27,236,229,101,249,154,229, 73,161,114,159,208, 45,151, 46, 93,210,
+146, 90,208,104, 52,100,247,238,221,172,173,173,237, 47,141,224,108,237,232,232,152,102,103,103,151, 84,251, 75,199,128, 17,221,
+124,122, 78, 90,110,223,246,157,144, 70,164, 51, 72, 34, 20,190, 56,127,240, 71,182, 32,253, 33, 81, 43,114, 73,201,147,104,242,
+ 34,241, 22,217,189,109,189, 70,196,231,191,  0, 16,244, 38,247, 82, 35, 97,226, 52,113,154, 56,255,134,156,250,180,200,127, 51,
+248,245, 51, 88, 31, 98,177, 40,108,249,146,133, 84,113, 65,177, 66, 89, 90,166,214, 40,149, 74, 90, 72,148, 15, 19,158,229,209,
+124, 94,241,220, 57,179, 45,195, 22, 45,  9,171,  0, 38, 24,249,159, 30,129,129,129,119,142, 28, 57,226,100,103,103,135,146,146,
+ 18, 20, 20, 20,224,206,157, 59, 32,132, 96,228,200,145,226, 46,157, 59,119, 88,186,108,217,205, 23,153,153,193,208,221,241,190,
+ 20, 47,118, 14, 88,211,163,114, 47,218, 47,158, 23, 84,246, 58, 20,133,237, 99, 66,107,174, 89,249,162,114,183, 12,137, 68, 82,
+179, 33,241,107, 32,184, 95,191,126, 66,  0,152, 54,109, 90,105, 89, 89, 89,120,149,133,195,168,157, 86,205,157,188,251, 56,184,
+186, 69,253,184,117,141,180, 93, 75,111, 48, 26, 45,210,114,178,192, 23,216,160,105, 83, 33,166, 78, 24, 32,232,213,205,206, 97,
+213, 87,219, 79,229,112, 24, 33,207, 79, 62,167,139,203,198,198,102,247,129,  3,  7,112,240,224, 65,  0, 64, 82, 82, 18,188,189,
+189,205, 13,165, 33, 46, 46,206,235,237,183,223,222, 95, 80, 80,208,202,208,181,245,  3,227,139,197, 98,244,232,209,  3,109,219,
+182,197,241,227,199,123, 87, 89,182,222,  8,138,107,215, 96,241,224,  1,112,245,181,  6, 47, 45, 58,118,244,188,117,250,212, 30,
+135, 83,167, 19,177,110,221, 78, 60,125, 90,105,104,243,242,242,194,248,113, 99,  4, 15, 31,222,240, 27, 61,122,252,141, 63,254,
+120,218,163, 74, 40, 25,194,151, 63,253,244,211,226,230,205,155, 99,244,232,209, 99,252,252,252, 92,172,172,172,176,109,219, 54,
+184,186,186,122,169,213,234, 39,199,143, 31,119,203,201,201,193,236,217,179,145,155,155, 59, 95, 23, 81,239, 65,189,151,138,135,
+249,246,108,211,113, 50, 44,172, 92,241,211,190,  3,120,124,127,119, 79, 21,147,184, 84,200, 94,157,168, 32,226, 41,178,116,139,
+176,102,157, 66,236, 91,249,189, 13,207,142,209, 14, 74,246,143,103, 75,  7,180,136,224, 75,148,187, 87,172,203, 46,120,133,116,
+116, 36,207,191,244,145, 93,220,121, 20,  0, 43,184,106,129, 85, 99,173, 37,120,187, 87,175, 94, 53, 21,247,252,249,115,168, 84,
+ 42,248,250,250,210,106,181,186,143,145,229,218,122,224,192,129,127,158, 62,125,218,190,117,235,214,178,194,194,194,154, 19, 46,
+246, 54,131,174, 30,217, 56,123,213,119,191,249,252, 74,168, 98, 89,226,177,135,  6,184,130,186,119,237,120,225,204,145, 61, 22,
+ 84,121,  6, 68, 54,249,  0, 87,128,148,253, 63,131, 50,179,195,216,143,230,241,251,244,235,219,100,192,144, 81, 23, 30, 39, 63,
+237,  7,224,174,105, 92,111,130,  9,255,104,171, 22,249, 95,203, 83,141,208, 10, 13, 13,165, 26,202, 32, 71,184,  0,103, 39,123,
+233,198,181,187,238,242, 24,181,218,220,198, 90, 45,176,182,226, 40, 75,107, 30,163,214,148,123,122,121,138, 56,194,  5,232,224,
+175,191,196,147,146, 74,165, 71, 78,156, 56,225, 36, 16,  8,192,113, 28, 28, 29, 29,145,154,154,138,226,226, 98,148,149,149,225,
+105, 98, 34,154,123,184, 99, 69,216, 66,215,217, 11,195,142,200,229,242, 78,168, 59,141,248,202,178, 81, 86, 83,119,223,232,234,
+ 45, 88, 94, 25,242, 87,125,215,192, 57, 99,151,162,166,166,167,167,195,194,194,  2,254,254,254, 22,215,175, 95,255, 67,143,200,
+170,195,105,107,235,101,201,137, 69,  7,183,252,184, 76,202,104,226,144,144, 82,136, 54,205,123,194,217,222,  3, 89,133,106,220,
+186,115,  2,113,177,123,209,178,137,  7,102,126,212, 87, 18,177,230,208,  1,161,182,185, 71,113,113,106,105, 67,156,165,165,165,
+ 22, 45, 90,180,128,135, 71,229,190,103, 44,203, 34, 33, 33,  1, 44,203,214, 28,215,126,223,117,248, 18,180,165,105,152, 60,105,
+ 18, 10, 10, 10, 44, 26,226, 20,240,160,157,247,225,120,190, 84,  0,136,204,237,212,229,229,229, 53,219,112, 48, 12,131,152,152,
+ 24,  4,  7,  7,135, 68, 70, 70, 26, 82, 69, 70,149, 39,  3,124,251,221, 47,191,108,154, 80, 82, 66,  3,192, 14,138,226, 24, 66,
+190, 53,246, 94,114,114, 18, 28, 62,123,230, 87,  7, 30,253,  8,118,214,223,224,206,157, 52, 48, 76,101,122, 11, 10,242, 48,235,
+147, 82,  8,  5,150, 56,126,252, 55,123, 95,223, 30,135,115,114, 24,127,212,157, 70,108, 40,157,146, 51,103,206, 96,214,172, 89,
+ 72, 72, 72,112,171,222,163, 77, 42,149, 98,237,218,181, 60, 95, 95, 95, 55,115,115,115,156, 61,123, 22,185,185,185,148,190,116,
+ 94, 57,119,229,235,146,167,151,151,230, 80,103,  7,255,180,239,  0, 62, 24, 55, 22, 46, 36,229, 15,235,150,212,215,  3,135,117,
+255,130,240,220, 67,205, 45,  3,108,189,253,135, 65, 40,178,192,204,207, 87, 34, 41,238,164,173,188, 44,246, 19,138,205,112, 95,
+177, 46,114,206, 43,233, 60, 52,134,157,182,247,122,199,243, 30,119, 61, 31,196,124,120, 59, 59,122,123,236, 75,161,229,197,167,
+104,214, 26,168,220,214,228,201,147, 39,120,250,244, 41,248,124, 62, 20, 10,  5,180, 90,109,131,233,116,115,115,155,161,213,106,
+191,168,170,231, 93, 18,137,228,253, 61,123,246,216,215, 22,218,142,  1, 35,186,217, 91,154,247,203,205, 43, 40,186,113, 55,254,
+241,188, 25,163,123, 95,187, 21,151,193,  8,222, 73, 47,137, 61, 94,162,163, 60, 37, 82,145,232,240,217,163,191, 89,104,158, 93,
+130,185,111,111,  8, 44,188,193,106, 50, 33, 47,170, 64,217,211,108,168,126,252,  1,237, 63,153,139,147,199, 14, 89,248,181,235,
+ 20,169,210,104,188,  1,168, 95,227,217,108, 12, 76,156, 38, 78, 19,231,223,147, 83,167, 22, 33,132,116,  4,224, 92,117, 88, 80,
+165, 11, 28,  0,228,163,114, 71,  1,231,170,182, 67, 84,235,103,245,143,107, 95, 91,255,184,246,231,130,170,207, 78, 85,239,119,
+ 41,138, 42, 52,144,116, 87, 84,110, 77,120,170,234, 29,168,154, 74, 52,232,120, 76, 81,116, 41,203,114, 98,161,163,147,114,218,
+187,253,218,253,126,225, 94,140,153,131, 21,127, 80,239, 14, 33,119, 30, 62,187, 73,209,148,134,162,104,163,252, 62,120, 60,222,
+216,141, 27, 55,182,179,178,178,  2,199,113,176,182,182,134, 76, 38,131, 90,173, 70, 73, 73,  9, 84,101,165, 96,202, 74,241, 32,
+227, 57,186,135,244,198,168,193,  3,125,127, 59,118, 98, 44,203,178,251,245,241,186,  5,116,168,177,100,173,108,102,255,210, 52,
+145, 81, 92, 35,186,190,233,224, 13,161,133,  5,  6,204, 11,123,147,123, 32,250,212,169, 83,103, 70,142, 28, 57,100,193,130,  5,
+116,118,118,246,217,212,212,212,238,  0, 18, 12,138, 10,177,228,211,143, 63, 13,181,181,181, 32,136, 60,127,  2,189, 58,140,131,
+153,136,135,130, 82,  6, 20,  5, 36,198, 31,  1, 69,217, 33, 54, 41, 27, 61,219, 91, 97,224, 32, 95,139, 99,135, 18, 23,224,165,
+127,208, 43, 85, 83, 84, 84,132,188,188, 60,104, 52, 26,104, 52, 26,140, 30, 51,  6,191,238,222,141,138,138, 10, 40, 20, 10,168,
+213,106,176, 44, 11,154,166,113, 62, 42, 18, 25,207, 18,209, 45, 56, 24,208,177,245,210,238, 24,  8,  0,220,122,252,248, 49, 18,
+ 19, 19,241,226,197, 11, 72, 36, 18,184,184,184, 96,229,202,149, 80,169, 42,247, 19, 27, 51,102, 76,  8,128,135,111,250, 64, 61,
+  5,182,167,178,236,210, 33, 71,143, 58, 93, 63,122,148,187,117,242,228, 11,113, 89,217, 54, 99,126, 43, 20, 98,244,154,111, 63,
+106, 99,110,110,142, 23,233, 27,225,227, 35,196,252,185,246,  8,255, 38, 31,  0, 48,123, 86, 83,116,238,228,128,210,226, 67,112,
+112, 90,140, 77,155,230,180,156, 50,101,253, 36,185,156,221,101,128,122,233,137, 19, 39, 70,121,123,123, 55,137,142,142,166, 68,
+ 34, 17,164, 82, 41,164, 82, 41, 36, 18,  9,242,242,242,144,154,154, 74,214,172, 89,147,  9, 96,169, 62,162, 21,155,178,111,  2,
+ 24, 50,119, 48,206, 60,190,191,187,103, 19,222,179,  7,163,102,246,120, 30,123, 43,186,236,247,243,215,191,210, 42, 37, 25,197,
+ 47, 46, 44,108,209, 57,218,225,147,207,190,196, 15,107,150,227,241,237,107,133,206, 30,165,155,165,148,170,193,116,134,132,172,
+224,187, 58,219,105,103, 76, 25,101,115,210,249,198,140,211,124, 74,150,147,127,127, 45, 82,163, 21,226, 86, 29, 38,182,246,162,
+213,151, 46, 93,146,246,234,213, 11, 74,165,178,198, 50,185,103,207, 30, 78,171,213, 94,110,240,222,100,152, 47, 50, 51, 51, 93,
+ 21, 10,  5,  6, 15, 30, 60,123,237,218,181,230,213,251,201,177, 44, 91,199,146,245,245,134, 95,207,125,250,197,230,203,231,246,
+127,227,246,117,216,251,189, 39,204, 92,117, 25, 58,246,145,228,211,244, 39, 39,143,238,116,145,216,106, 32,181, 27,  8,101,174,
+  2,143,183,127,  0,121,169, 18,157,191,254, 18,128,  8,106, 13,141,109,195, 70, 67, 96,239,134,229,211,223,119, 91,178,237,167,
+143, 56,142,219,104, 26,215,155, 96,130,  9,245,224, 76, 81, 84, 20,  0,132,133,133, 45, 14, 15, 15,143,167, 40, 42,138, 16, 18,
+ 90,101, 64,137, 34,132,132, 86, 95, 83, 37,206, 94, 57,174,190,182,254,113,253,207,139, 22, 45,242,139,136,136, 88, 29, 28, 28,
+188,255,198,141, 27,207,  0, 24, 18, 90, 67,171,132,213, 43, 91,239,208,213, 10,178,246,123, 29,139, 22,199, 93,123,242,236,185,
+124, 96,255, 46, 77,163,174, 62,188, 59,117,234,208,126, 99,135,245, 26,148,154, 94,144,216,210,211,197, 33, 62,254,161, 21,199,
+113,215,140, 41, 37,177, 88, 28,218,183,111, 95,126, 81, 81, 17,204,204,204, 32,147,201,144,153,153,  9,134, 97,160, 44, 41,134,
+170,164, 24,202,226, 34, 48, 37, 69,120,122,239, 14,  2, 90,122,137,171,156,229,245,162,218,234, 82,223, 82, 85,219,178, 37,178,
+180,132,216,210, 18, 84,227,167, 13,223,177,177,177,185, 85,221,169, 50, 12,243,201,194,133, 11,243, 57,142,195,170, 85,171,172,
+ 44, 44, 44, 34,  1,136, 13,145, 88, 58,242, 66,131,219,251,211,143, 82, 99,209, 35,112, 50, 90,183,120, 11,169,185, 10,228,151,
+ 49,200, 43,102,208,185,215,247,104, 22,248, 37,220,219,135, 35, 49,173, 16,110, 77,188,105,240,197,122, 55,127,206,200,200,168,
+115,188,127,223, 62,200,229,114,180,108,217, 18,227,198,141,195,194,133, 11, 49,110,220, 56,184,185,185, 97,194,187,111, 99,249,
+242,229,200,201,201, 49,148, 84, 85,235,214,173, 85,158,158,158, 42, 79, 79, 79, 21,195, 48, 40, 47, 47, 71,113,113,113,253,242,
+158,211,216,130,116,114,114, 90,228,226,226, 18,235,228,228, 20, 47, 22,139, 79,199, 80,212, 35,165,167,167,115,247,225,195,169,
+182,239,190,203, 75,147, 74,169,171,128,133, 49, 92, 14,118,130,161,125,250, 14, 17, 21, 23,237,172, 49, 82,189, 63,213, 17,127,
+ 94,245,195,245, 63, 58, 97,214, 39, 45, 65,209, 18, 80,180,  8,242,138, 75,232, 18, 20, 44,180,177,161, 12,221, 75,227,  1,196,
+116,239,222,221,109,230,204,153,148, 88, 44,198,236,217,179,153,233,211,167, 39,143, 27, 55, 46,249,226,197,139,172,167,167, 39,
+220,221,221, 41,119,119,119, 87,  0, 49, 85,191,209, 11,171,150,212,215, 42, 38,241, 15, 27,111,243,103, 44, 28,186,149,107,196,
+163, 87,172,203, 46,248,122,203,179,117,169,143,229, 94,143,111, 95, 43, 72,142, 59,201,165,222,189,146,159,149, 92,230,245,245,
+150,103,235, 22,111,206,106,240,161,190,122, 21,220,145,168,171,140,188, 66,206, 31, 62,172,143,124,198,180,177,173,237, 44,252,
+246,160,201,192,192,102, 30, 77, 39, 44, 95,189,137,153,254,209,167,204,142,159,119,146,178,178, 50,148,150,150, 98,211,166, 77,
+218,147, 39, 79,102,178, 44,251,169,174, 49, 16,  0,104, 52, 26,204,152, 49,195,220,202,202, 10, 25, 25, 25, 53, 22, 81,  0,200,
+150, 21, 60,188,126, 55,238,209,188,127,141,  9,169, 80,169, 84,231,174,220, 75,108,235,237,217,148,162,136,206,133, 40, 34,129,
+ 96, 64,167, 46, 93,120,132, 20,131,226,123,224,233,238, 53, 40,205, 41, 68,105, 94, 33,120,  2,115,104, 33,134,134, 19,193, 38,
+ 32,  8, 73,119,163,209,196,209,153, 47, 22,  8,  6,153,250, 19, 19, 76,248,103, 66,159, 22,169, 45,150, 34, 34, 34, 86,235, 59,
+ 95,235, 93, 93,239,184, 70, 72,213, 23, 97,181, 63,  3, 64, 68, 68,196,106, 66, 72,232,141, 27, 55,246,  1, 80, 24,153,133, 15,
+107,189, 27, 31, 71,139,167, 84,135, 47, 88,184, 20,182,214, 82,235,160, 14,222, 46,199,207, 94,189,119,237,198,189,196,102,238,
+ 14,142, 68,163,182,253,118,253, 15, 77, 41,185, 34,194,200, 68,248, 58, 56, 56,128, 97, 24, 60,121,242,  4, 47, 94,188,  0,195,
+ 48,208, 86, 84, 64, 85, 92, 12,101, 81, 17,216,138, 50,  8, 89, 22, 10, 89, 30,236,205, 36,192,203, 21,137,  6, 44,111, 84,131,
+ 66,171,250, 93, 98,101,  5,177,165, 21,104,129,192,224, 78,241,181,208, 49, 40, 40,232, 96, 92, 92, 92,151,254,253,251,127,133,
+202, 37,242,105,153,153,153,253,150, 45, 91,166,114,118,118,198,140, 25, 51,218,  0,152,108, 80,100,138,212,190,158, 46,109,208,
+218,107, 50,154,185,247, 69,113,133,  6,178, 82, 13,242,138, 25,108,251, 62, 24,135,119,  4,225,207,195, 61, 17,119,110,  0,138,
+ 53, 46,176,112,123,  7,132, 85,251,233,227, 60,127,254, 60, 86,174, 92,137,175,190,250, 10,171, 86,173,194, 87, 95,125,133,204,
+204, 76,248,251,251, 35, 61, 61, 29,103,206,156, 65,118,118, 54, 28, 28, 28,112,231,206, 29,108,216,176,  1,127,254,249,167,193,
+ 76, 87, 11, 87, 35,174,105,212, 92,186, 86,171,157,146, 61,124,120,187, 92, 59,187,182, 29, 58,116, 24, 50,123,246,108,175,238,
+221,187,215,156,247,242,242,242,144, 74,165, 57,168, 92, 65,217, 94, 31, 23,  7,116,112,116,244,135, 90,245,168,170,142,  5,160,
+ 40,  9,250, 14, 72, 68,247,158,247,192,104,132,160, 41, 49,104, 90,  2,173,182,  0,182,182,110, 32,132,242, 55,144,196,101, 50,
+153,204,251,194,133, 11,116,106,106, 42, 36, 18,  9,  0, 60, 95,177, 98,197, 15,235,214,173, 75,176,183,183,103,163,162,162,112,
+236,216, 49,132,134,134,242,166, 79,159,238,237,238,238,190,213, 80,190, 87,108,202,190,185,119,253,153,247,  4, 26,219,246, 18,
+105,179,230,168,176,120,231,227, 16,  7,115,  0, 56,155,146, 82,230,228, 81, 26, 81, 81, 22,155,110,211,180,252,155,179, 41,134,
+ 86,156,174,224,238, 39, 63,186,181,247,232,217,146,188,220, 34, 65,135,118,126,138,240,149,159,  9,155, 53,111,245,237,242,133,
+255,114,201, 44,149, 20, 15,152,125,230,209,145,179,119,202, 39, 78,253, 64, 59,237,195,153,202, 51,103,207, 31,229, 56,174, 29,
+116,172, 56,228, 56, 14,217,217,217,136,143,143, 71, 74, 74, 10,100, 50, 25,242,243,243, 81, 86, 86, 86, 51,221,104, 86, 86,122,
+234,135, 95, 78, 62, 48,151, 74,205,186,180,243,246,184, 29,157,144,103, 46,149,154,121, 55,247,104, 13,172,104,176, 29, 97, 89,
+182,157,196, 76, 10,128, 66,113,220, 53,148, 23,149,163,188,184, 28,101,133,229, 80, 49, 60, 40, 85, 52, 20,106, 26,158, 33,  3,
+ 81, 94,161, 68,121, 65,  9, 56,150, 13, 52,117, 55, 38,152, 96,130,158,190, 62, 42, 44, 44,108,177,145,215, 26, 61,189, 89, 95,
+120,133,133,133, 45,166, 40, 42,106,209,162, 69,126,208,189,160,170, 54,182, 55,240,  2, 96, 68,120,135,130,130,228,114, 75,202,
+119,228,220,207,191, 56,179,239,231,239,157, 84, 42,121,186,189,173,  5,107, 97, 38,114,152, 54, 99, 21,202,202,139, 70, 84, 24,
+ 31,142,  0, 69, 69, 69,120,246,236, 25,164, 82, 41,132,  2,  1, 88,133,  2,172,162,  2,138,162,  2,208,140, 10, 66,150,133,157,
+153, 20,158,110, 46,104,230,236, 98, 20,231,147, 75,191,215, 56,190,215,158, 46, 92, 19,228, 11,145,185,  5, 68,150, 22,248, 56,
+234, 10,  0, 64, 40, 20,  2,203,190, 50,202,104,210,164, 73,147, 19,123,247,238, 21,202,100, 50,196,196,196, 60,  0, 80,  2,192,
+ 18,  0,151,152,152,120, 33, 46, 46, 46,212,219,219, 27,  0, 90, 26, 34, 43,205,167, 89,141,150, 32, 35,231, 57, 82, 95, 68,195,
+206,186,  5,  4,102,173,145, 87,204, 64, 44,109,  1,141,234,229,236,163,178, 52, 13, 10,134,103, 84,222,213,106, 53,180, 90, 45,
+180, 90, 45,212,106, 53, 62,252,240, 67, 92,191,113,  3,251,143, 93,196,179,167, 73,104,211,220,  5,147, 38, 77, 68, 80, 80, 16,
+110,220,184,161,151,107,114,123,104,154, 88,128,191,126,  8, 13,145,133,189,170,235,194,115,183, 13,137, 45,138,162,  8,116, 76,
+ 69,214,195,186,224,224,224, 86, 73, 21, 21,136,127,244,  8,253, 87,172,  0,  0,156, 62,125,186, 78, 94,230,205,155, 39, 74, 72,
+ 72,152,118,239,222,189,105, 89, 89, 89,235,  1, 52,236,108, 78,128, 83,167,110,226, 95,255, 74,128, 76, 38,  3,  0, 28,216,247,
+ 82,151,166, 62, 99, 48,120,104,229,140,150,141,141, 13,214,175,247, 55,170, 60, 89,150,197,246,237,219,107,166, 11,  1,128,207,
+231,119,159, 55,111,222,200,134,174,111,213,170,149,208, 16,231,220,209, 77, 36,127, 62, 32,159, 88,183,106,230,103,229, 16,128,
+  2, 77,180,127,116,102,246,172,185,163,155,108,220,112, 40, 83, 41,165, 84,187, 40, 54,195,157, 47, 81,238, 54, 38,141, 41,103,
+191, 87, 23,120, 78,217,157, 35, 43, 93, 50,243,131,241,246, 86, 54, 78, 21, 59,126,  8,183,165,121, 52, 57,113,143, 41,246,243,
+178,183,121,167,235,119,229,255,154,187, 44, 90,173,205,152,137,140, 19, 73,208, 19,226,130,101, 89,100,101,101, 65, 38,147, 33,
+ 61, 61, 29,249,249,149,211,175,249,249,249,224, 56,238, 77, 26, 68, 40,210,211,145,118,116,  7,154, 77,156,136,206, 95,173,  4,
+203,241,161,144,179, 88,223,173, 31,138, 74, 20, 80,113, 20,220, 58,118,195,  7,167,255,  0, 77, 88, 96,219,102, 83, 79, 98,130,
+  9,255, 80, 24, 19,222,161, 90, 16,133,135,135,135,254,213,255, 95, 91,108,133,135,135,199,135,135,135, 55,230,191,234, 79, 25,
+214, 28, 87,251,104, 93,169,229,128,246, 74,167, 89,150,159,152,146,144,192,207,170, 80, 84,152, 57, 59, 57,170,204, 36, 98,174,
+164,180,140, 23,253,240,  1, 83,145,243,244,113, 35,242,145, 24, 23, 23,231,159,149,149,133,244,180, 52,104, 21, 21,160, 85,106,
+ 16,165, 28,253,123,116,131,  4,128,132,166, 32,228, 24,240,121, 34,148,149,151,  2, 64,162,193,206, 81,163,121,197,178, 69, 81,
+ 20, 68,150,150, 16,153,155, 67,100, 97, 89,199,194,101,140,197, 70, 44, 22,239,141,140,140,116,109,210,164,  9, 86,174, 92,137,
+166, 77,155,250,184,185,185,201,173,173,173,165,206,206,206,104,219,182, 45,186,117,235,134, 51,103,206,  0, 70,196,148,210,104,
+ 37,177,143,159,163,123,126,225, 13,252,113,229, 71,168, 21, 42,116,  8,249, 17, 12,191, 25, 28,253,190,  4,247,100, 15,228, 57,
+199, 43,173,  7, 46,195,240, 34,253, 57, 40,158, 40,222, 88,203, 83,245,231,  7, 15, 30, 96,223,241,171,112,245,244, 69,122,242,
+ 35, 60,186,124,  1,215, 29,237,225,233,219,182,102, 26, 72,103, 26, 89,240,191,222, 92, 25, 38,106,233, 39,227,197,133,133,133,
+ 98, 59, 59, 59, 85,117,217,185,186,186,190,137,216, 26,191,127, 26, 81,117,  0,  0, 32,  0, 73, 68, 65, 84, 96,193,  2, 20, 11,
+  4,192,208,161, 16,166,164,128, 97, 24,116,237,218, 21,157, 59,119,  6,  0,116,237,218, 21,124, 62, 31,  1,  1,  1,112,115,115,
+195,230,205,155,199,235, 18, 90, 52,133, 24,173,182,192,199,203,203,171, 70,104,237,254, 85,134,232,123,  3, 64, 65,132, 77, 63,
+ 60,169,185,214,195,195,  3, 57,217, 41,160, 40, 18,103, 32,141, 95,185,184,184, 44,115,117,117,245, 90,183,110, 29, 79, 34,145,
+224,163,143, 62,106, 81, 94, 94,222,172,202,148,140, 69,139, 22,  1,  0,150, 47, 95,142, 21, 43, 86, 64,165, 82,201,117,145,237,
+ 94,223,206, 45,175,144,155, 70,202,205, 70,244,113,104,214,174,239,160,254,104,225,221, 23,125,  7,165,  3,192,106, 59,254,243,
+119,191, 93, 98,115,212,198,146,218,249,251,217,243,203,123,132,244, 93,178,176,252,242,215,223,108, 47, 54,232,243, 88,146,182,
+171,236,177,104,236,134,239,183,254,186,225,139, 69,115, 36,233, 50,117, 81,102, 17, 41,183, 16,243, 45, 90, 58, 83, 22,179, 62,
+255,234, 89, 86, 86,202,124,100,156, 53,184,210,146,227, 56,164,164,164,212,248,244, 41,149, 74, 84, 84, 84, 32, 35, 35,163,230,
+158, 81,152, 91, 13,158, 57,117, 88, 96,133, 66, 33,191,253, 48, 57,125,233,236,  9,193, 21, 10,133, 60, 57, 53, 61,  9,216,212,
+160, 26,163,105,250,161,188, 76,222, 95, 94,172,132, 44,230, 49,154,246,243,132, 70, 75, 65,173,101, 33, 43, 40,131, 74, 11,176,
+180,  0,126,239, 78,  2, 75,241,145,159,149,  9,154,199,123,128,186, 78,251, 38,152, 96,194, 63,  7,122,181, 72,181, 69, 43, 56,
+ 56,120,127,109,171, 83,245,103,  0, 42,232,119,229,145,213, 22, 83,213,211,137,186,254,167, 30,175,177,120,197, 71,203, 96,120,
+135,234,255,116,183, 46,117, 91,179,124, 66, 83, 78,171,109,147,151,159,171,229,243,197,  2,119,107, 69,118, 97,186,241,255,174,
+ 82,169,162, 46, 92,184, 48,124,192,128,  1,226,228,135, 15,160, 46, 41,129,186,164, 24,  2, 78, 11, 59,105, 39,208,140, 10,148,
+ 90,141, 38, 62, 28,148,101, 82, 92,189, 30,167, 81,169, 84, 81,198, 10, 45,154,199,171,235,151,101, 97,  1,177,165, 21,196, 22,
+ 22,245,167, 22, 13,137,  2,179,129,  3,  7,246,235,218,181, 43,  8, 33,216,190,125, 59, 24,134, 17, 49, 12,  3,181, 90, 13,134,
+ 97, 80, 90, 90,138, 95,127,253, 21, 91,182,108,185, 14,224, 23,131,157,153, 86,125,225,220,249, 75, 65,239, 79,  8, 21,156,142,
+ 90, 15,173,154,133,130,106,138,138, 10, 13,202,213,102, 96,237, 39,  2,185,167,192,227, 75, 16, 28,208,  2,199, 15, 29, 97,160,
+ 85, 93, 52, 82,133,215,177, 10,101,164, 63,199,139,167, 73,176, 40,205,129,163,149, 25,228, 41, 73,232, 48,105,242,107, 89, 39,
+220,221,221,193,113, 28,250,244,233, 83,227, 92,253,186, 98,171,160,160,  0, 39, 79,158, 68,215,174, 93, 17, 18, 18,130,204,204,
+ 76,164,164,164,224,173,183,222,170,185,230,193,131,  7,136,142,142, 70,203,150,250,141,132,249,133,154,211, 47, 50, 98,198,188,
+243,206, 59,194, 91,183,110,129, 16,  2,111,111, 43, 88, 89,154,131,162,197,240,245,117,  2, 80, 57,  6,232,221,187, 55, 74, 75,
+ 83,180, 69, 69,228,180,129,236,238,  5,112, 76,173, 86, 63,233,213,171,151,219,211,167, 79, 49,119,238, 92,254,129,  3,  7,170,
+ 77,201,  8, 11,171,187,152, 66,161,208, 61,117,223,166,157,207,103, 45,180,182, 33, 18,105,179,230, 86, 14,  1,104,225,221, 23,
+  0, 48, 32,244,125,180,104,229,129,210,252,216,230, 74,197,243, 17, 66,126,145,109,236,166,204,  4,233, 80,255,169,202,188, 43,
+201,168,156, 58, 53, 88,237,138,228,  3,185,233,130,137,  7,143,157, 56, 51,227,173,208,183,  5, 26, 86,171,245,247, 20,216, 68,
+ 30, 61,149,151,153,150,254, 29,210,207,198,189,180,255,233,181,226,177,165,165,165, 48, 55, 55, 71, 92, 92,156,106,232,208,161,
+ 98,154,166,241,228,201,147, 26,161,229,228, 96,215,182,123,103,127,159,175, 55,252,122,206, 92, 44, 22, 15,234,221,201, 55, 33,
+ 57,237,  5, 33,212,115,157,214, 86,141,230,252,195,152,  7,125, 28,221, 90,241, 82,174,220,130,125,207,183,160, 82,209, 80,168,
+ 57,168,180,128,150, 39,132,107,251, 46,176,105,233, 11,  2,224,238,173,235, 26,149, 70,115,206,212,215,152, 96,194, 63,218,170,
+ 69,244,137,164,170,207,133,  0,158,135,135,135,231,215,178, 54,201,  0, 60,  0, 16, 88,117,157,172,222,239,100, 20, 69,221, 37,
+132,116,174,197, 35,171, 37,184,106,127, 86,215,187,230, 65, 35, 68, 86,237,247,186, 66, 75,215,146, 74,  0,112,112,112,112,234,
+208,161, 83,203,159,126, 62,  8, 66,  8, 30, 71,175, 69, 81,222, 35, 44, 91,125,179,101,147, 38, 77, 66, 50, 51, 51,175, 26,147,
+  2,150,101, 15,236,220,185,115,126,151,142, 29, 58, 52,111,218, 20, 15,158,167, 66, 72, 88,  8, 89, 22, 52,163,  2,159, 85,163,
+169, 63, 11,154,178, 64, 86, 86,  9, 34,246, 30,140,171,138, 18,175, 23, 62,111,189,141,149, 47, 74, 64, 81, 20,214,  5,251, 67,
+100,105,  1,161,185,  5, 62, 62,113,169, 70, 92, 69,173, 92,  4,145,133,  5, 90,118, 49, 42, 32,188,252,242,229,203,247, 30, 62,
+124,216,217,223,223, 31,243,231,207,199,243,231,207,193,113, 28,114,115,115,149,217,217,217,153, 50,153,236, 57,128,163,  0,126,
+130, 17,145,199,133, 42,229,198,168,195,187,103,  6,247,  8,113,120,103,196, 22, 28, 59, 52, 15,197, 37,165,144,107,165,168, 80,
+106, 81,161,226,193,206,190, 29,186,  4,  4, 32, 43, 51, 15,241,183,206,149,243, 85,242,181,141,185, 65, 41,138, 66,116,116, 52,
+188,220, 44,145,244,199, 85, 56,152,  9, 16,232,230,  2,183,238, 61,106,226, 75,233,131,128,  7,237,248,241,227,107, 34,195, 15,
+ 28, 56, 48,117,226,196,137,174,243,230,205,195,207, 63,255,140,235,215,175,191,226,160, 29, 18, 18,130,107,215,174,125,  9, 96,
+185, 33,163,158, 90,173,134,143,143, 15,238,222,189,139, 11, 23, 46,160,111,223,190,  8,  9,  9, 65,108,108, 44,126,255,253,119,
+ 68, 71, 71,131,162, 40,216,219,219, 67, 83, 41,158, 53,186,200, 24,  6,145,223,124,187,115,241,134, 13, 91,252, 38, 76,152,128,
+195,135,247,227,253,169,109, 64,209, 98, 80,148, 24,111, 15,107,131,149, 95,221, 69,151, 46,189,225,224, 32,192,134,245,199,159,
+ 41, 20,236,175, 70, 20,227,215,191,255,254,187,155, 82,169, 68,113,113, 49,177,176,176,160, 10, 10, 42, 87,180, 54,100,209,146,
+203,229, 18, 93, 68, 15,239, 39,174, 45, 46, 35, 69,164, 60,122, 68,161, 54,186, 93,223, 65, 25, 24, 16, 58, 21,231,163,126,193,
+165,115, 23, 96,199,127,158, 10,243,178, 51,249,169,249,165,217, 21,222, 91,125, 59, 78,231,189,168, 56,183,117,214,219, 73, 60,
+ 87, 87, 46,114,209,143,165,197,250,132, 22,  0,170, 48, 97,207,137,163,  4,111,119, 11,238,210,202,223,195, 85, 84,148,159, 71,
+ 14, 29, 63, 19,199,164, 30, 62, 89, 75, 96, 17,  3, 66,125,101, 88, 88,216, 23, 85,159,119, 45, 93,186,116,122, 68, 68,132, 99,
+ 78, 78, 78,141,143, 86, 94,126,225,165,110, 67,103,177,  5,197, 37,234,157, 27, 62, 31, 45,149,136, 69, 75, 35,118, 94,209,240,
+112, 75, 23,175,150,227, 54,191, 59,119,217,156,228,199,209, 77,154, 73, 69, 56,254,249,114, 60,248,253, 50, 52,180, 16,255,186,
+112, 27, 42,134, 69,113,126,  1, 46, 78,251,  4, 22,206,182,216,114,229,112, 46,199,113, 63,154,186, 26, 19, 76,248,231, 66,151,
+ 22,161, 40,170,161, 24,123,185, 13,124,119, 87,223,239,116,240,252, 21,208, 25, 21,222,168, 37,120,249,249,249,121,215,174,221,
+198,149,168,175,113, 53,234,107,196, 71, 63, 64, 86,166, 26,153,185, 74, 88, 89, 89,221,212,243,211,250,145, 99,137, 92, 46, 31,
+185,116,217, 23, 57, 18,169, 25,122,245,235,  7, 23, 71, 39,152,  9,  5,224,105, 57,240, 40,  1,202,101, 54, 72,138,149, 99,225,
+206, 61,121,229,114,249,200,  6, 58,137,254,186, 68,  6, 69, 81, 16, 91, 89, 66,100, 97,  9,177,165, 85,157,105, 68,137,149, 21,
+ 36,150, 86,224,139, 68, 13, 57,195,191,194, 89, 94, 94, 62,106,244,232,209, 69, 37, 37, 37,152, 62,125, 58,174, 94,189, 26,125,
+238,220, 57,171,216,216, 88,169, 76, 38,107,  5, 96, 32,128,109,122, 68, 86, 29,206,162,162,148, 50,162, 85,141, 13,255,226, 83,
+133, 82,107,143, 49,147, 15,192,156,206,128,150,229, 64,  0,184,217,137,208,189,255, 87,200, 83,119,195,129,173,171,228, 28,163,
+156, 80, 47,134, 86, 29, 78, 66,  8,113,118,118,126,165, 12, 46, 92,184,128, 49,163, 71, 97,208,136,225,112,108,238,  5,167,254,
+111, 97,208,244,127, 97,235,214,173,160,105, 26, 14, 14, 14,245, 59,222, 26,206,221, 49, 16,236,123,  8,106,223, 67, 80,187,162,
+193,  7, 48,105,207,158, 61,223,  4,  6,  6, 94,190,126,253,250, 90,  0, 99,107,255, 87, 45,172,168,103,205,106,168,142,150,204,
+153, 51, 71,145,156,156, 12,115,115,115,104,181, 90, 92,191,126, 29, 91,182,108,193,186,117,235, 16, 29, 29, 13,123,123,123,180,
+108,217, 18, 42,149, 10,119,239,222, 85,  0, 88,162,135,147,147,201,180,163, 54,109,138, 40,  8, 13,237,137,157, 59,127,128,139,
+ 75, 55,  8,248, 46,224, 11, 28, 97,110,225,131, 29, 63,125,131, 33, 67, 58,224,196,241,131,133,249,  5,218, 81,  0,180, 70,220,
+ 75,202,219,183,111, 99,235,214,173, 24, 61,122,116,230,152, 49, 99,216,146,146,146, 26,139, 22, 33,  4,132, 16,172,168,242, 49,
+ 83,169, 84, 98, 93,156, 31, 44,140,203,252,124, 85,252,202,220,156,204,174, 87, 47,223, 28,127,233,220,  5, 60, 75,190,132, 75,
+231, 46,224,143, 75, 55,194,114,115, 50,187,118,  8,106, 45, 28, 57,125,230,103,187,143, 28,230, 89, 88,185, 98,247,145,195,188,
+113,179, 62, 93,213,105, 80,223, 37,134,238,249,170,122, 36,229,121,185,139, 86,175,253,190, 92,203, 40,233, 53,223,109,206, 82,
+200,178,151,212,186, 47,137,161,251, 83,161, 80,108, 83, 42,149,110, 74,165,210, 77,165, 82, 45,121,254,252,121,175,249,243,231,
+203, 88,150,173,177,150,202, 18, 78,220,124,244,231,174,213, 78, 14,182,210,110,157,253,218,172,223,118,232, 74,122, 70,238,111,
+181, 98,104, 53,148, 78,101,185, 66, 57,106,248,200,137, 21,197, 69, 42,  4,127, 26,  6, 78, 98,  1, 21, 11,104,  8, 15, 90,138,
+143,135, 95,175,135,212,206, 18,123, 83,239,203, 75, 52,204, 40,212,141,161,165, 47,239,111,  2, 19,167,137,211,196,249,247,228,
+252,111,134, 43,234,238,117,232, 90,199,162,101,104, 73,101,147, 38, 77,122,189,243,118,127,244, 14, 93, 10, 66,  8, 30,221,255,
+ 22, 69,178,199,104,226, 34, 70, 74,122,105, 48,128,171,141, 72, 76,250,243,140,140,174,115,150, 44, 61, 50,102, 96, 63, 95,255,
+230,205,197,205,154,121,194,220,201,  9,249,249, 50,252,121, 43, 65,179,106, 95,100, 92,149,200, 50,106, 98,146,227,184, 74, 39,
+119,  0,253,230, 44,  4,197,227,  1, 85, 97, 28,170, 59,198,230,157,187,129,226,243,193, 18, 14, 42,149,202,152,213,114, 47,158,
+ 62,125, 58,106,194,132,  9, 23,163,162,162,232, 65,131,  6,181, 63,122,244,232,155,236,153,135,138,188,228,203,  0, 66, 87, 45,
+154,113,160,107,223,225, 86,222,126,157,132,157,154,241,192,104, 40,100,101,166, 33,234,200, 29, 38,225,246,185, 82,162, 85,142,
+149,231, 39, 95,214,199,197, 48, 76,122,171, 86,173,156,183,110,221, 90,227, 12,207,178, 44,242,243,243,113,243,230, 77,180,235,
+220,  5,190, 83,167, 65, 38,147, 97,211,166, 77,240,240,240,192,176, 97,195, 80, 88, 88,  8,173, 86,107,236,132, 47, 11,224, 92,
+213, 11,245, 68, 22, 85,181,  5,144,222,105, 67, 47, 47, 47,145, 82,169,108, 79,  8,225, 81, 20,181, 81,173, 86, 79, 89,180,104,
+145,235,234,213,171,209,166, 77, 27,228,231,231,195,220,220, 28,222,222,222,144,201,100,184,115,231, 14, 43,151,203,183,162,114,
+ 35,107,153,129,244, 61,185,115, 39,181,235,236,217, 31, 31,249, 38, 98,134,183, 82,213, 91,100,103,215,  3,132,104, 33,147, 61,
+ 71, 89,233,117,230,171,149,191, 60,205,205,211,140,  4,144,108,100,158,151,207,156, 57, 19,  0, 36,  0,150,166,164,164,196,248,
+250,250,122,235,178,104, 25,131, 13,135, 50,149,  0,246,141, 26,228, 54,183, 52, 63,214,219,142,255, 60,181,171, 63,183,105,195,
+161, 76,165,149, 91,197,215,249,207,175, 38,101, 87,156,219,186,251,200, 97,222,228, 17,163,216,166, 22,201, 97, 18, 39,114,200,
+  8,106, 18, 24, 24,232, 78, 81,133, 45,242, 10, 30,223,123,127,250,140,119,173,133,138,211,129, 77, 11, 90,210, 30, 29, 36,209,
+209,209,169,104,228,202,208, 42, 36,101,102,102,246, 90,180,104,209, 57, 66, 72, 29,223,132,188,252,194, 75,193,161, 51, 73,113,
+113, 73,140, 44,241,132, 49,177,212,238,220,185, 31,221,207,191, 93,135,195,223,172,142,112,238, 61,103, 62, 63,233,242, 21,128,
+213, 32,237,234, 21,176, 98, 53,183,254,198,249,220, 18,134, 25,  1, 83, 84,120, 19, 76,248,199, 91,179,244,105,145,191, 57,134,
+ 66,135, 51,188,209,153,241,106,209,228, 92, 27,239,102,  3, 61,154, 58,  2,  0, 82, 82,179,144,146,154,249,123,202,179,204, 65,
+  6, 20,175,174,229,149, 53,155, 74, 83, 85, 33, 28,136,113,155, 74,215,225,180,183,183,191,199,231,243,155, 54,166, 52, 88,150,
+205,202,207,207,239, 96,100, 58,199, 53,111,222, 60, 34, 45, 45,237,  8,199,113,115, 27,169,246, 27,228,172,222, 84,154,230,139,
+250, 19,173,186, 29,  0, 80,124,145, 49,155, 74,215,230,108,103, 97, 97,177, 77, 32, 16,120, 84,215, 99,181, 15, 22,203,178, 60,
+134, 97, 36, 44,203,242,  0, 80, 52, 77,107,  5,  2,129,146,162, 40,173, 86,171, 77, 87,169, 84, 51,240, 50,224,168,190,188, 27,
+236,232,171,132, 22, 26,176,104, 93,  0,128,228,228,228,214,182,182,182, 99, 41,138, 26, 77,  8,241, 41, 43, 43, 83, 45, 91,182,
+ 44, 58, 50, 50,178,180,121,243,230,131,135, 14, 29, 74,197,198,198, 34, 46, 46,142, 20, 20, 20, 28,170,178, 98,165, 52,242, 94,
+162,197, 98,222,123,118,118,244, 80, 66, 16,  8,  2,138,162,241,176,164,132, 59, 45,151,179,191, 85,  9,198,198,222,159,213, 24,
+223,172, 89,179, 95, 82, 83, 83,  5,186, 44,169,186,242, 94, 31,223, 46,241, 91, 26,220,179,231,168,155,127,252,113,244,243, 85,
+241, 43,107,159,155, 53,220,246,253,113,159,204,249,118,223,230,239, 62,255,254, 88,209, 78, 99,210,217,190,125,123, 47,138,162,
+198,  2,240, 39,132,180, 34,132,146, 80, 20, 41,162, 40, 42, 30, 64,172, 90,173,142, 74, 72, 72,120,241,  6,121,127,157, 17,174,
+ 46,206,154, 77,165,193,178,  1, 44, 64,140,220, 84,250,255, 59,157, 38, 78, 19,167,137,243, 63,199,249,223,140, 15, 27,248,206,
+184,200,240,213, 72,121,150, 57, 40,229, 89, 38, 90,181,106, 69,158, 60,121,210, 40,145,166,171,147,102, 89,118,191, 92, 46,223,
+255, 38, 36,  5,  5,  5,157,254,205,133,183, 47, 53, 53,117,223, 95, 73, 88, 37,164, 86, 86,189, 94, 23, 15,203,203,203,187, 24,
+123, 49,195, 48,255,142,178,161,170,172, 89, 95,234,186, 96,224,192,129,105, 12,195, 92,  0,144, 65, 81,148, 13,128, 66,134, 97,
+206,105,181,218,220, 39, 79,158,116, 90,191,126,125,117,228,251,175,  0,220,123,205,116,112, 42, 21,187, 55, 43,139,221,251,111,
+200,227, 94,181, 90, 61,207,222,222,190,165, 82,169, 20, 41,149, 74, 97,237,197,  7, 82,169, 84,166,207, 33,190, 54,108, 44,169,
+ 93, 66,126,145,189,141, 37, 85, 95, 72,193,174,  9, 14, 43, 42,226,218,216, 53,193, 97, 99, 19, 22, 19, 19,147, 18, 24, 24,184,
+135,166,233,230,132, 16,103,128, 88, 19,  2, 25, 33, 36,159,207,231,103, 38, 36, 36,100,254,141, 26, 33,165,150,227,214,106,213,
+234,151,126,135,166,213,133, 38,152, 96,194,255, 14,116,250,104,241, 27,203,244,228,201, 19,202, 84,158, 38,212, 22, 91,250, 78,
+166,165,165,169,  0,220,168,122,213,199, 61,  0,195,254,238, 25,204,206,206,238,160,235,156,177, 34, 11,168,244,217,  2,226, 26,
+140,206,190,226,251,162, 50,124,127,228,179,198,166,237,193,131,  7,233, 48,114,138,221,  4, 19, 76, 48,193,132,127, 27,222,220,
+162,101,130,  9, 38,152, 96,130,  9, 38,152, 96, 66,131,216, 94, 75,112,213,177,110, 81,208,189,114,160, 49,115,175,175,179,250,
+224,130,137,211,196,105,226, 52,113,154, 56, 77,156, 38,206,127, 28,231,255, 42, 94, 17, 89,255, 31, 48, 45,125, 53,113,154, 56,
+ 77,156, 38, 78, 19,167,137,211,196,249, 79, 16, 89,245, 95,  0, 76, 83,135, 38,152, 96,194, 63, 24,145,145,145, 70,109, 42,250,
+222,231, 59, 66, 45, 44,108,151,149,151,150, 68,236, 95,251,254,209,234,239,199,140, 25,195,154, 74,209,  4, 19, 76,192,235, 56,
+195,183,104,209,180, 45,205,114,221,  9,161,121,132, 38, 26,170, 84,113, 32,165,168,168, 78,216,  1,119,119,119, 27,  1,141, 97,
+ 20, 33,230, 20,197,177, 28,143,190,254,236,217,139,132, 70, 36, 76,100,107,107, 59, 83, 40, 20,246, 87,171,213, 77,105,154,126,
+161, 82,169, 46,200,229,242, 31,240,106,224,194,255, 24, 90,183,110, 61,238,202,149, 43, 54, 61,122,244, 80, 73,165, 82,173, 66,
+161,224,159, 61,123, 86, 60,100,200,144,226,167, 79,159,190,214,138, 68, 55, 55,183,190, 59,118,236,104, 49,104,208, 32,180,106,
+213,170, 98,236,216,177,194,224,224, 96,225,244,233,211,159,101,101,101, 93,106, 36, 93, 91,138,162,126,165, 40,138,199,113,220,
+ 36,188, 12,221,240, 87,131,166,105,122,  6, 69, 81, 35,  8, 33, 94, 20, 69,165, 16, 66,142,114, 28,167, 47,112,171, 62,140,  2,
+240, 22, 77,211, 29,  0,128,227,184,104,  0,167,  1,227, 87,222,253,127,114,154,153,153,181,  7,  0,185, 92, 30,243, 87,113, 82,
+ 20,213, 30,  0,  8, 33,175,203, 57, 85, 42,149,126,  0,  0, 10,133,226, 39, 24,177, 29, 84,125,144,173, 62,164,195,151,143,  0,
+  0,209,203,125,  0,  0,141, 57,166,254,245,136,106,204,127, 53,196,215, 24,142,  6,240,214,132,  9, 19, 86,255,246,219,111,203,
+  1, 28,255,119,220,248, 46, 46,238, 63,172,251,110,187,219,167, 51,167, 69,160,114, 71,  8,253, 15, 36, 48, 64,196,227,189,173,
+102,217, 63, 18,128,255, 99,239,186,227,162,184,186,246, 51, 51, 59,219,119, 97,119,169, 75, 17,  5,  5, 17, 80,192,130, 61,162,
+ 38, 26,187, 70, 44, 81,177,196, 22,163, 38, 70,141, 26, 53, 26,107,140,137, 61,182,216,123,141,130,189,247,138,198,138,157,222,
+251,194, 46,219,103,190, 63, 96,121, 81, 41,139,154,188,201,251,113,126,191,113,156, 97,230,217,123,239,220,242,220,115,207, 61,
+103, 47,  0,142, 66,161,232,207,227,241, 90,235,245,122, 37,135,195, 73,209,235,245, 23,243,242,242,118,162,130,  8,  8, 86,151,
+235, 99,200, 13, 26, 56, 19,204,127,226,188,177, 36,116, 92, 17, 82,137,122,200,249,  7,116,163, 36,128,241,197,121,221,128,242,
+221,121, 84,212,249,124,237,226,226,210, 83,165, 82,105, 40,138, 98, 81,180,235,185,232,159,162,191, 19, 12,195,164,103,103,103,
+ 15,170, 12, 75, 92,  3,117,121, 98, 98,171,217,136, 66,147,142, 29,173, 78, 64,180,196, 29,205, 89, 96, 16, 11,212, 34, 41,210,
+129, 97,152, 20,  0,103, 73, 19, 34, 10,146,241,252, 31, 58,184,123, 20,151,107,205,226,107, 26,128, 19,128,123,  0,190,  6, 80,
+ 80,205,127,254, 54,121,211, 24,254,  8,128,148, 18,162, 85,202,221,125,155, 46, 93,186, 92,240,244,116,243,235,221,163,215,252,
+ 81, 35, 71, 19, 20, 69,226,193,195,135,156,207,  7, 13,249, 68, 46,151,187, 74,116,186,122, 32,  8, 70, 35, 16, 60, 80,169,242,
+146,246,238,220, 46,245,173, 91,215,108, 54, 51, 88,179,118,245,167,251,254, 56, 48,205, 74,178,229,227,236,236,188,117,202,148,
+ 41,206,221,186,117,163,156,157,157, 17, 27, 27, 43,219,181,107, 87,221, 21, 43, 86,244,201,201,201, 25,  4,224,233, 59,100,182,
+149,179,130,252, 68, 42, 36,218, 33,223,140,124, 35,206,164, 22,226, 36,128, 75,239, 90,122, 26,141,102,172, 70,163,  9,105,220,
+184, 49,187, 97,195,  6, 98,240,224,193, 44, 65, 16, 68, 97, 97,225,102,  0,239, 68,180,196, 98,241,170, 14, 29, 58,120,123,123,
+123,191,124,241,226, 69,167, 61,123,246, 28, 13, 15, 15,247, 18,139,197,207,  0,248, 84, 17,110, 83, 86, 86, 86, 96, 97, 97, 33,
+220,220,220, 54,  0,104,248, 23, 84, 34,130,162,168,131,174,174,174,236,162, 69,139, 14,  5,  6,  6, 58,101,103,103,155, 38, 77,
+154,212,254,250,245,235,159,154,205,230,110, 85, 32, 91,114,130, 32,214, 58, 57, 57,217, 47, 92,184,240,121,163, 70,141,238,241,
+249,124,222,179,103,207, 68, 19, 38, 76,248,230,233,211,167,125, 88,150, 29,  9, 84,105,128,144, 19,  4,177,214,197,197,197,126,
+254,252,249,177,193,193,193, 15,184, 92, 46,247,217,179,103,226,239,190,251,238,235,232,232,232,119,194, 36, 73,114, 77, 72, 72,
+136,252,135, 31,126,120, 92,183,110,221,171, 20, 69,241, 18, 19, 19,201, 89,179,102,125,117,234,212,169, 48,134, 97, 70,189, 75,
+ 58, 29, 29, 29,229,179,102,205,122,220,172, 89,179,235, 92, 46,151,251,228,201, 19,114,202,148, 41, 95, 61,127,254,220,234,116,
+ 42, 20,138, 80,130, 32,214,165,166,166,114,  0, 64,169, 84, 54,177,177,177, 89, 81, 58,166,165,197, 21,133,209,104,204,215,106,
+181,  3,178,179,179,203,116,132, 59,120,234,242,174,  0,176,194, 96,185, 46, 58, 87,118, 13,172,137,176, 38,211, 65,206, 69,126,
+241,126, 81, 15,237,  1,  0,253,139, 67,133,255,162,  6, 56, 28, 14, 19,228,252, 53,123, 55,181, 74, 46, 99,186,183,109,219,118,
+214,217,179,103, 87,183,105,211,230,187,109,219,182, 57, 38, 36, 36,252,116,233,210, 37,247,126,253,250, 13, 62,115,230,204,130,
+204,204,204,125, 31,170,242,243,184,124, 62, 65, 18, 16, 10, 68, 54,214, 60, 79,147,100,151,171,221,187, 15, 95,255,228, 73,240,
+138,232,104, 79,181, 82, 25, 50,110,220, 56,167, 94,189,122,145,238,238,238,120,254,252,185,221,182,109,219,234,173, 95,191,190,
+103,110,110,238,120,  0,113,239, 67,178,212,185,168,175,211, 35,152,101, 33, 43,105,176,  4,114,249,  6,220, 97, 31,227,254, 63,
+128,108,205,220,180,105,211, 15,207,159, 63,199,130,  5, 11,  0, 96,101, 21,223,159,208,189,123,247,206,  7, 14, 28, 16,238,221,
+187, 87,216,184,113, 99, 56, 59, 59,163,120, 50, 85,226,152,218,211,211,211,186, 50, 99,240,203,210,163, 67, 27, 62,200, 62,134,
+ 85,189, 82, 23,  8,221, 96,106,222,221,187,103,151,193,193,176,117, 16, 65, 32,225, 32, 55, 75, 21,240,228, 78, 66,135,115,123,
+158,255,244, 60, 42, 99,161, 58, 30, 51, 81,190, 79,190,255,138,216,217,217,109,120,245,234, 85,168, 88, 44,126,237,254,203,151,
+ 47,131,188,189,189,243,  0,124, 91, 85,226,230,224,224,176,131, 97, 24, 93, 86, 86,214, 48,  0,144, 74,165,219,197, 98,177, 60,
+ 37, 37,101,218, 95, 53,145,177,200,155, 92,228, 95,174,209, 42,177,215, 42, 43,214, 33, 65,154,153, 22,163, 70,142, 38,250,246,
+239,151,250,252,229, 43,134, 67,243,250, 31, 63,113, 66,228,231,231, 71,234, 86,174,132, 41, 35,  3,198,111,190,105,126,250,244,
+105, 99, 88,255,129,133, 52, 69,108,242,242,172, 37,218,189,115,151,243,129,253,251, 90,  0,168,140,104,241,156,157,157,183,158,
+ 63,127,222,213,211,211, 19,185,185,185,136,141,141,133, 90,173, 70,159, 62,125,232, 22, 45, 90,184,246,238,221,123,107, 94, 94,
+ 94,203, 42,104,182,156,234,184,113, 34, 71, 14,233,229,243,233, 39, 45,196,174,238,181,193,166,106,145,240, 34,186,113,228,249,
+235,227, 54,237, 63,250,244,121, 30,219,  5,101,199, 70,170, 80, 50, 51, 51, 39,247,236,217,115,127,104,104,168,  3,159,207,135,
+139,139, 11,209,173, 91,183,244,228,228,228,217,239,204, 90,138, 67,216,144, 36,105, 46,125, 46, 35, 60,144, 53,226, 38,151,203,
+ 33,151,203,  1,192,245,125,103,158, 50,153,108,165, 84, 42,237,173, 82,169, 10, 73,146,100,  9,130, 96,245,122,189, 80, 46,151,
+255,249, 56,250,169,139, 78,167,171,179,120,233,250,101,109, 91,  5,218,156, 58,117, 10,189,122,245, 98, 79,158, 60, 57,210,218,
+ 56,117,  4, 65,172,237,217,179,167,102,198,140, 25,218,231, 47, 99, 93, 31, 63,125, 73,136,  5, 60,198,222,222,158,190,121,243,
+ 38,103,201,146, 37,130, 89,179,102,173,101, 89,182,119, 21,202,115,109,191,126,253, 12, 19, 39, 78, 76,121,242,252,149,227,253,
+199,207, 89,137,128, 54,217,219,219, 81,215,175, 95,103,222,  5,147, 36,201, 53,147, 39, 79, 86,141, 28, 57, 50, 39, 43, 59,207,
+ 57, 71, 85,192,242,105,202,232,236,236,204, 57,116,232,144,110,199,142, 29,228,240,225,195,215, 48, 12, 19, 86,133,242, 93,211,
+173, 91,183,252, 41, 83,166,228, 62,123, 25,227,124,255,209, 83,136,248,180,209,201,201,145,186,117,235,150, 97,241,226,197,228,
+220,185,115,173, 74,167, 88, 44,222,178,103,207, 30,206,161, 67, 69,125,223,181,107,215, 72, 47, 47, 47, 81,233,103, 10,181, 58,
+144,  4,144,153,153, 41,106,214,172,217, 22,  0,111, 57,247, 13,158, 29,141,193, 83,129,177, 99,199,166, 84,181,178,  4, 43,199,
+ 85,250,140,121,181, 47,187, 68, 51,180,  7,135,195, 97,134, 15, 31,158,250,230,223,181, 90, 45,  1,160, 27,126,178,158,108,117,
+234,212,233,251, 35, 71,142,212,222,182,109,219,175, 59,118,236,208,  3,128, 64, 32,176,223,181,107,215,130, 62,125,250,160, 79,
+159, 62, 51,246,237,219,247,193,136,150,153, 53, 27,  0,128, 47,224,243,163,163,163,  9, 95, 95,223, 10, 61,238, 27, 24,230,246,
+250, 39, 79, 26,125,233,235,219, 56,155, 97,234,112, 63,253,180, 96,194,132,  9,153, 42,149, 10,177,177,177, 48, 24, 12, 24, 60,
+120, 48,213,166, 77, 27,151, 62,125,250, 44,207,207,207,255, 12,128,193,138, 58,185,216,213,213,117, 68, 94, 94, 94,129, 69,171,
+211,114,144,153,211, 58,200,196,111, 80,199,200,227, 82, 38,110,215,111, 24,226,228, 74, 66,237,235,137,203,  0,192,213, 32,163,
+138,147,129, 50,197,198, 13,158,102, 26,115, 29,220,132,109, 51,226, 10,127, 84,199, 87, 72,150, 62, 19,139,197, 61,212,106,245,
+190,226,193,217,167, 75,151, 46,184,126,253, 58,  0,180, 40, 38, 90,109, 73,146,252,156, 97,152,223,  1, 84, 20,202,109, 92,247,
+238,221, 63, 62,112,224,128, 20,  0,246,237,219,  7,163,209,  8, 47, 47, 47,112,185, 92,240,120, 60,208, 52, 93, 18, 29,196, 74,
+ 81, 58, 56,216,195,222,150,134, 92, 33,254,244,187,223,186,115,106,248,217, 32,221,252, 16,217,108, 46, 76,172, 14, 92, 59, 49,
+234,118,144, 33,248,147,182,100,196,154,  7,211, 34, 86, 61,110,164, 33,209, 21,113,208,253, 83, 70,118,146, 36,249,247,238,221,
+131,139,139,203,107,247, 41,138,  2,128,214,239,  0, 57,227,229,203,151,205,162,162,162, 16, 26, 26, 58,163,126,253,250, 29, 47,
+ 92,184,224,156,149,149,133,208,208,208,229,137,137,137,135,254,234, 60,149,230, 34,255, 43,170, 46,242, 13, 38,217,166,104, 22,
+ 76, 82, 20, 69,226,213,203, 88, 99,104,104,187,240,248,248,120, 73, 72, 72,  8, 73,211, 52,212,103,207, 66,123,235, 22, 36, 18,
+  9,122,246,236, 73, 95,188,120,209,198, 70, 98,243, 69,204,171,152,124,138, 34,193,178,100,165, 54, 15,114,185,252,171,105,211,
+166, 57,123,123,123,195,100, 50,149,120, 52, 55,153, 76, 72, 72, 72,128, 68, 34,193,160, 65,131, 28, 69, 34,209, 87, 86,230,163,
+166,143,151,227,157,243, 71,215, 54,156, 48,170,147,216, 71,116, 10,226,132,241,144,236,251, 18,245,146,143, 99, 74,143, 16,241,
+201, 85, 51,130,107,187, 40,238,148, 82,177, 90, 45, 58,157,238,242,131,  7, 15,190,184,112,225,  2,  3,  0,231,206,157, 99, 31,
+ 63,126, 60,242,125,102,161, 12,195, 32, 55, 55, 23, 12,195, 80,197,215,150,243,127,181, 62,216,216,216,172,233,216,177, 99,191,
+184,184, 56,225,177, 99,199,236,226,227,227,237, 99, 98, 98, 28,124,124,124, 56, 11, 22, 44, 56,162,213, 25, 40,163,153,213,155,
+204,198,252,148,135, 15, 95,230,164,165,221,217,184,113, 99, 33, 65, 16, 61,173,252,141,207,148, 74,165,221,212,169, 83, 65,208,
+162, 38,117,235,213,247,166,104,161, 45, 73,243,108, 11, 11,181,230, 87,175, 94, 37, 76,157, 58,181, 86, 96, 96,160, 11,138,150,
+215,172,194,116,113,113,177,159, 56,113, 34, 56,124,105, 80,131,192,224,218, 60,190, 88, 74,209, 66,105, 72, 72, 72,155,151, 47,
+ 95, 38, 79,153, 50, 69,217,184,113,227, 42, 97, 54,110,220, 88, 62,124,248,112,147, 64, 40,109,230,233,233, 85,175,129,127,189,
+206, 62, 62, 62, 61, 56, 28,142, 41, 35, 35, 35,110,208,160, 65,202,174, 93,187, 58, 85,  5,211,209,209, 81, 62,101,202, 20,147,
+187,135, 87,135, 14, 31,127,210,148, 43,148,218,114,120, 98,153, 70,163, 53, 63,121,242, 36,110,250,244,233,202,160,160, 32, 71,
+107, 48, 53, 26, 13,109,111,111,143,128,128,  0,248,121,121, 33, 47, 47, 15,  7, 14, 28,192,166, 77,155,240,251,239,191, 99,231,
+206,157,104,212,242, 19, 72,165, 82, 36, 39, 39, 67,165, 82,209,127,119,133, 50,175,246,101, 87,232, 71,116, 27, 61,122,116,242,
+240,225,195, 83,133, 66, 33,243,230,161, 80, 40,204,  3,  6, 12, 72, 27,244,221,210,110,150,165,197, 74, 52, 89,247,142, 30, 61,
+250, 98,219,182,109,240,243,243, 67,135, 14, 29,120,  0,240,213, 87, 95,241,250,244,233,131, 61,123,246, 96,223,190,125,143,188,
+189,189,175,  0,232,110, 77, 58,  7, 13, 26,212, 50, 44, 44,236, 82, 88, 88,216,221,190,125,251,174, 27, 57,114,228,107, 35, 87,
+ 74,114,226,109,189, 94,143,192,224,198,162, 57, 27,110, 12,168, 12,239, 49,176,109, 93,116,244,166,133, 15, 31,198,205,240,243,
+147,121,196,196, 40, 54, 47, 94,108,111,  9,210,109, 52, 26,145,144,144,  0,185, 92,142,  1,  3,  6,216,243,249,252, 65, 86, 36,
+115, 73,247,238,221,135,196,199,199, 75,214,175, 95,175,188,123,247,174, 75, 74, 74,138,242,204,233, 19, 14,147,190,253, 74,106,
+ 43,225,241,146, 51, 88,  2,  0, 98,146, 33,142,126,133,150, 44, 11, 89,233,229,196,119, 18, 37,132, 66, 55,172,168,221, 82,246,
+116,226,158,160,190, 83, 34,131,237,229, 74,254,212, 10,222,104,176,104,209,162,189, 17, 17, 17,253, 91,182,108,185, 31,128,176,
+140,103,  4,141, 26, 53, 58,176,103,207,158, 33,173, 90,181,186, 12, 32,160,220, 89,164,155, 91,207, 63,254,248,195,206,114,109,
+111,111, 15,129, 64,240, 22,201,226,114,185, 32, 73,178,202,217,155,183,171, 63, 71, 81, 79,135,  7, 57, 71,177,103,209, 61, 44,
+250,244,  9, 51,191,121,140,110,229,160,104,156,220,115, 15,233,184,135, 78, 95,214, 70,255,233,129,237, 69,102,204,253, 39, 13,
+224, 25, 25, 25,159,183,110,221,122,111,167, 78,157,116, 81, 81, 81,200,200,200,128,171,107,201, 92, 59,245, 29, 32, 21, 34,145,
+  8,238,238,238,240,246,246,238,127,241,226, 69,103,163,209,136,152,152, 24,164,167,167,223,249, 59,242, 84,154,139,252,203,228,
+ 77, 67,248, 35,111, 17,173,226,216, 66,231,  1,128, 37,  8,245,189,  7, 15,104,138,199, 27,184,125,199, 14, 62,151,203, 69, 92,
+ 92, 28, 30, 61,122,  4,205,153, 51, 40,188,122, 21,105,105,105, 40, 40, 40,128,147,147, 19,214,110,216, 32,214,155,217,161, 79,
+158, 62,165, 88,146, 45,109,111, 80,230, 22, 79, 62,159,223,190, 87,175, 94,229, 18,178,228,228,100,116,234,212,137,166, 40,170,
+172, 93, 13,111, 98, 18, 46, 14, 68,196,153,253,115,148, 74,222, 35,224,249,  4, 32,255, 14,192,234,  0,147, 30, 72,186, 15, 28,
+153, 13,143,130,104,226,196,156,112,103, 87, 17, 39,162, 12,166, 92,217, 86, 84, 47, 95, 95,223,223,  7, 14, 28, 72,  2, 64,219,
+182,109,  9, 95, 95,223,117,  0,188, 42,120,231,116, 37,131,228,245,156,156, 28,244,233,211,199,174,118,237,218,167,251,244,233,
+ 99,103,185,255,174,152, 22,109,178,159,159, 95,150, 64, 32,216,  9, 88,213,193,150, 96,202,100,178,149,157, 58,117,234,189, 99,
+199, 14, 46,  0,156, 63,127, 30, 17, 17, 17,120,248,240, 33,158, 61,123,198,  4,  7,  7, 59, 44,253,125,239,154,149,171,183, 44,
+233,209, 34,208,165, 77,147,224,122,146,130,156,  2, 39, 39,167, 22, 44,203,122, 89,153,206, 78,179,103,207,126,244,248, 69,156,
+ 45,201,161, 57, 92,154,195,183,177, 17, 59,201,165, 98, 55,133, 72,224,202, 39,  9,137, 70,163, 73,221,185,115, 39,  3,160,147,
+181,152,115,230,204,121,245,248,121,156,140, 32, 57, 28,154, 67,115, 37, 18,145,236,211, 14,161,141,  1,128, 11,150,171, 82,169,
+210, 54,109,218,100,168, 10,230, 15, 63,252,240, 32, 59,183, 64,206,161,105,154,195,161, 74,202, 82, 44, 20, 58,136,248,124,158,
+ 78,167, 75, 90,182,108, 89, 97, 85, 48,103,207,158,253,232,201,139,120,  5, 73, 16, 20, 65,144, 28, 27,169,216,206,206, 86,228,
+224, 32, 17,218,139, 56, 20, 79,165, 82, 37,109,221,186,213, 42, 76,131,193,192, 77, 75, 75,195,227,199,143,225,222,184, 49, 78,
+157, 58,133, 26, 53,106,160, 79,159, 62,232,215,175, 31,132, 66, 33,218, 54,171,143,169, 83,167,226,197,139, 23, 48, 24, 12,252,
+178, 48, 45,118, 82,111,138,139,139, 75, 84,101,149,231,141,119, 95, 75,103,144, 51,216, 21,250, 17,221, 74, 19,172,242,240, 21,
+ 10,133,185, 44,109,215,155,152,157, 58,117,250,254,204,153, 51,181,183,110,221,218,109,208,160, 65,151,183,110,221,138,166, 77,
+155,226,241,227,199,168, 85,171, 22, 54,111,222,140,126,253,250, 93, 94,190,124,121,183,168,168,168, 64, 79, 79,207,105,149, 97,
+246,237,219,119, 76, 80, 80,208,217,212,212,212,102,217,217,217,  1,  7, 14, 28, 24,218,179,103,207, 87,253,251,247,111, 87, 66,
+ 24,141,198, 29, 71, 14,239, 71,231,110,189, 80,215, 63, 96,205,224,105,219,234, 87,210, 54,217,135,192,186, 77, 41, 41, 25, 59,
+180, 90, 77, 31,154, 22,137,110,220, 80,236, 91,189,218,190,116,100,129,164,164, 36,116,237,218,149,230,114,185,173, 42, 73,231,
+162, 30, 61,122,244, 57,112,224,128,220,162,213,185,122,245, 42,238,223,191,143,216,216, 88,228,230,230,162,221,200,  2,140, 94,
+ 80,132, 61,122,  1,139, 79,190, 98,197,239,216,135,148,136,176,  6,156,237,108, 56, 87,134, 46,171,251,213,136, 53,126, 28,137,
+130,198,246,239,158, 33, 51, 70,183,175, 28, 76,162, 89,179,102,219,194,194,194,  8,189, 94, 15,189, 94,175,  7, 80,166, 87, 95,
+ 87, 87, 87, 65,131,  6, 13, 48,114,228, 72,210,198,198,102,121,121,233, 84,171,213,186,163, 71,143, 98,208,160, 65, 24, 63,126,
+ 60,234,212,169,  3,185, 92, 14,154,166,177,101,219,110,251,126, 67, 71,249, 52,108,217, 58,208,175, 97,211,  6,249, 58,170, 49,
+ 45,148, 15, 47, 71, 27, 82,102,222, 11, 28,163,240, 32,230, 26, 86,116, 75,100,110,110,214, 20, 76,250,252,231,232, 39, 23,210,
+ 30, 78, 11, 91,247,128,189,214, 60,115,219,215,241, 72, 51, 62, 70,171, 62, 30,240, 12,146,127, 35,118,135,239,187,150,167,149,
+ 82, 37,204,250,245,235,183,188,121,243, 38,191,117,235,214,136,139,139,  3, 77,151,204,167,204,239,147,206,217,179,103,243,181,
+ 90, 45,254,252,243, 79,132,135,135, 39, 25, 12,134,111,222, 39,157, 85,209,104, 89,184,200,191, 76,214,189,113,164,148,167,209,
+154, 13,  0, 70,  6, 17,  3,195,135,106, 34, 35, 35, 69, 60, 30, 15,113,113,113, 72, 73, 73,193,150, 77,155,204,109, 29, 29,243,
+ 59,184,186,170,182,108,218,196,234,245,122,176, 44, 11, 95, 95, 95,244,238,221, 91,248, 89,159,254,233,132,170,112,183, 21,203,
+ 60, 74,203,250,250,208,161, 67,223,250,251,164, 73,147, 96, 99, 99,  3,130, 32,156,173,200, 92,216,184,217, 61,220,228,158,178,
+ 52, 54,117, 75, 54, 40,  1,192,145,  2, 28, 27, 64, 96, 11,240,165,  0, 79,  4, 93,212,217,108,146,237, 16,219,171,213, 48, 87,
+  0, 85, 89,234,129,139,139,203,140,179,103,207, 58, 68, 69, 69,177, 42,149, 10, 41, 41, 41,236,252,249,243, 29, 92, 92, 92,102,
+188,235, 23, 73, 78, 78,158,211,185,115,231,180,240,240,112,219,227,199,143,187,135,135,135,219,118,238,220, 57, 45, 57, 57,121,
+206,251,124,105, 46,151, 75, 61,124,248, 80, 49,119,238,220,126,  0,110,251,251,251,103,185,186,186,222, 70,145,209,100,133, 34,
+149, 74, 75, 72,150, 69,187,198,225,112, 64,211, 52, 92, 92, 92,244,217,217,217,230, 86, 13,189,132,190,182,164,209,133,207, 21,
+ 42,132,  2, 55,169,141,109, 72, 86, 86,214, 61,130, 32, 94, 90,185,196, 23,212,164, 73, 19,218,204,210,204, 15, 12,241,165,  0,
+  0, 32,  0, 73, 68, 65, 84,232,129,109, 93,190, 26, 18,234,248,219,220,225, 53,150,205, 25,225,186,104,214, 23,190,115, 38, 15,
+  8, 37, 25, 70, 91,171, 86, 45,103,139, 65,187, 21,234,243,224, 70,141, 26,113, 24,208,120,252, 52, 54, 45, 46, 49, 41,255,227,
+ 54,205, 74, 52,151,126, 65,193, 29, 28, 28, 28, 90,251,250,250, 54, 34,  8,194,170, 45,201, 66,161, 48,168,110,221,186, 28,146,
+162,  9, 59,185,212, 93, 42, 17, 58,149, 44,161,200,100,205, 21, 14, 14, 97, 36,203,230, 41,149, 74, 71,161, 80, 24, 84,133,188,
+115, 24,112,225,228,168,176,117,176,151, 73, 58,132,182,168,211,172,121, 51,159,250, 33, 77,155,249, 55,108,244, 25, 97, 50,169,
+188,188,188, 28, 45, 70,242,149,104, 90,  5, 59,118,236,192,220,185,115,209,192,195,  3,174,174,174,112,116,116,196,213,171, 87,
+113,243,230, 77,200,229,114,164,167,167, 99,241,226,197, 56,120,240, 32, 12,  6,131,180,170,245,201, 26,178, 85,145,152, 76, 38,
+242, 77,130, 85, 30,190, 80, 40,100, 44, 70,242,229,201,209,163, 71,183, 89, 52, 89, 95,127,253,117,203,165, 75,151, 94,142,142,
+142,134, 68, 34,193,205,155, 55, 49,116,232,208,203,203,151, 47,111, 57,106,212, 40,108,218,180,  9,175, 94,189,218, 80, 17, 94,
+223,190,125,103,125,241,197, 23,203, 46, 92,184, 64, 58, 57, 57, 65, 46,151,163, 71,143, 30,216,176, 97,  3,199,100, 50,109, 12,
+ 11, 11,187, 27, 22, 22,118,215,156,112,242,251,189,191,207,191,250,224,222, 93,140, 25, 55,145,167, 55, 25,167, 88,145,125,182,
+ 80, 34,201, 55,181,110,157,189,199,104,212,244,229,114, 69,182,119,239, 42, 34, 54,110, 44, 33, 91, 83,167, 78,133,173,173, 45,
+ 80,100,192,140, 10,180, 58, 35, 14, 30, 60, 88,210, 31,218,217,217,129,199,227,129,203,229,130,166,105, 80, 20,133,211,107,196,
+ 88, 61,181,136, 95,172,158, 74,224,228, 74, 66,253, 62,223, 78,228,138,  0,185, 19,239,238,151,155,253,  3,  3,218,217,225,234,
+174, 84,204,239, 28,149,120,115, 79,198,  4,109, 58,126, 41,231,181,134,147, 38, 77,242, 75, 79, 79,199,173, 91,183,112,235,214,
+173,242, 52, 64,218,195,135, 15,255, 84, 80, 80,  0, 79, 79, 79,116,239,222,189, 53,128,198,229,180, 27, 52,106,212,  8, 93,187,
+118, 69,104,104, 40, 26, 52,104,  0,189,193, 68,135, 13, 28, 81,247,225,171, 12,215,249,139,231,139,206,158, 59, 64, 94,190,124,
+129,218,182,255,164,109,179,208, 79,150,113,165,202,235, 16,218, 41,173,201,167,198,156,133, 32,229,167, 88,119,102, 28,185,226,
+124,184,100, 75,196, 10, 47,169, 84, 74,220,185,117,215,184,101,213,158,248,  0,113,247,244,235,187,178,160, 33, 82,209,110,136,
+ 39,201,  0,189,255, 41, 35,187, 64, 32, 88,122,225,194,  5,103,131,193,128,  7, 15, 30, 96,252,248,241,218,247,132, 44, 81,128,
+184,187,187,227,252,249,243, 24, 48, 96,128, 54, 45, 45,237,218,223,149,167,210, 92,228,127, 69, 56,165, 24,100,137, 36, 36, 36,
+228,202,229,114,215,186,117,235,146,122,189,190,104, 73, 98,223, 62,243,239, 27, 55, 30,209,106,181,227,  0,112, 87,254,246,219,
+ 26, 87, 55,183,208,129,131,  6, 17, 70,163, 17,157, 59,119,230, 69, 70, 70,218,189, 76, 79,207,183, 98,192,121,237,247,  6, 15,
+ 30,140,165, 75,151,  2,  0,198,142, 29, 91,162, 90, 39,172, 48, 88,146,216,162, 83,135, 46,141,108, 18,196, 43,108, 12,205,141,
+  5, 53, 95, 72,175,139, 11,132,141, 64,242, 56, 16, 80, 96, 12, 70,211,179,244,158,183, 95, 60,171,231, 39,204,206,170,213,222,
+255, 35,252,126,106,107, 39,141, 89,187,199,234, 14, 71, 36,106, 34,145, 72,112,251,246,237,236, 70,141, 26,229,178, 44,107, 59,
+103,206, 28,123,145, 72,212,228, 61,202, 62,230,233,211,167,173, 91,180,104,241, 21, 73,146,237, 25,134, 57,157,150,150,182, 18,
+ 64,140,149,239,143,  6,240,  3,128,146,153,165, 94,175,  7, 73,146, 96, 89, 22,125,251,246,197,212,169, 83,253,238,223,191,143,
+179,103,207, 42,218,183,111,127, 29, 64, 46,128, 97,  0,202,212,154,169, 84,170,194,155, 55,111, 10,207,158, 61, 11,134, 97,160,
+ 80, 40, 96, 99, 99,  3, 62,159,143, 30, 61,122, 72,166, 76,153,210,238,196,137, 19,233,170,154, 53, 40, 65, 74,146,154, 47,145,
+ 72,225,236,218,106, 84,255,207,163, 89,150, 61, 88,133,206,129, 39,228,152,180,132, 89, 71, 46,154,185,156, 20,113,185,132,128,
+203,  1,159,209,224,251,159,230, 17, 92,214,204, 65, 21,215,231,185, 92, 46, 87,202,135,158,226, 81, 70, 17,  1,246, 67, 52, 14,
+138,162,120,  2,110,249,246, 24, 52, 73,146, 36, 73,114,  1, 88, 29,180,143,207,231,115,165,124,182, 92, 76, 33, 69, 80,  4, 65,
+240, 80,206, 78,180, 32,103,176, 22, 45, 18,111,220, 75, 93,105, 82,220,170, 85, 43, 28, 57,123, 27,251, 34, 78, 35, 51,238, 30,
+166,127,247, 53, 26, 55,110,140,200,200,200, 10,211,100,177,209, 42, 79,187,236,226,226, 18,149,156,156,220,176,188,119, 43, 90,
+ 50, 44, 71, 75,245, 54,254, 76, 91,  4,207,142, 70, 37, 54, 90,221, 91,181,106, 53,102,199,142, 29,250,142, 29, 59,242,250,246,
+237,139,128,128,128,150, 67,134, 12,  1,  0,180,111,223, 30, 75,151, 46,109, 57,100,200, 16,236,222,189, 27,  7, 14, 28,208,181,
+105,211,230,187,243,231,207, 39,161,104, 71,231, 91,194, 48, 76,215,181,107,215,190,169, 41,132,201,100,130,209,104, 84,154, 76,
+ 38,101,113, 95,132,101,203,150,103,158, 60, 17,137,239,166,205,134,163,131,115,144,149,117,136, 24, 60,113, 98,230,230,197,139,
+177,120,247,110, 76,172, 85, 75,180,245,209, 35,156,212,106,177,231,236,217,204,226,223,169,212, 54, 83,173, 86, 23, 30, 61,122,
+212,102,207,158, 61,144,201,100,168, 83,167, 14, 20, 10,  5,104,154,  6, 73,  9, 65,113,229,168,235,223,  4,192, 77,  0, 64, 45,
+ 23,168,125, 61,113,153, 32,144,203,146, 85,183, 41,226,215, 64, 77,123, 55,193,133, 49,155,  2,100, 54,142, 92, 28, 95, 25,143,
+ 19, 43, 18, 14,106, 51,241, 43, 76,120,130,242,109,190, 26,121,122,122, 34, 61, 61, 29, 71,143, 30, 85,  3,229, 18, 50, 48, 12,
+243,211,111,191,253, 54,105,218,180,105,124, 95, 95, 95,  0,  8,  2,112,171,172,103,197, 98, 49, 92, 93, 93, 75,136,101,223,240,
+ 81, 94, 35, 39,140, 18,246,252, 36, 20, 28,142, 61,114,213, 70,100,229, 27, 33,183,151,224,187,  9, 97,130,211,141, 92, 27,175,
+ 93,190,253,112, 97, 33, 26,  3,111,247,  7,  4,129, 91, 55,238, 93,174, 47,240,  5,  8, 18, 72, 32,207,129,  0,129,  2,194,  8,
+130,162, 88,179,217,140,248,248,120,176, 44,139,  1, 61,135, 38,140,152,127,192,177,229,  0, 21,220,235,186,128, 96,241,209, 63,
+133,  8,216,217,217,  5,101,101,101, 33, 38, 38,  6,225,225,225, 73,153,153,153,167,212,106,245,208,228,228,100,  0,200,126,  7,
+200, 18, 50, 31, 20, 20,132, 38, 77,154,160, 79,159, 62,  2,141, 70, 19,230,229,229,229,154,145,145,209,252,175,204,207,155, 92,
+228,127,138,104,149,217,208,140,198,186,186, 53,107,160, 62,125, 26,188,147, 39,177,199,197,165, 64,171,213,126, 11, 32,161,184,
+225,127,189,105,243,230, 43,221,174, 93,179,209, 71, 71,195,235,254,125,208, 50, 89, 80, 85, 19,176,113,227, 70,168, 84, 42,228,
+229,229,  1,  0, 86,172, 88,  1,149, 74,  5,147,149,  1,103, 57, 92,180,116,118,172,133, 84, 60,  3,195, 33, 37,177,117, 53, 77,
+ 37, 90,105,178,107,188,147, 58,143,116, 69,116, 92,136,184, 48, 75,223,148,160,244,208,102,106,224,218,162, 14, 56,224,180,172,
+ 74, 26, 45,235,254, 28, 14, 39,251,233,211,167, 93,125,124,124, 34,  0,216,191,139, 61,192, 27,242, 60, 45, 45,109,220,187,188,
+ 72, 81,212, 15,175, 94,189,114,220,176, 97,195, 87,115,230,204, 97, 75, 19, 45,203,255, 57, 28, 14, 88,150,133,173,173, 45,104,
+154,118,186,122,245,170, 83, 72, 72,200, 42,134, 97,130,202,201, 39, 27, 16, 16,128, 87,175, 94,129,195,225,192,214,214, 22,140,
+201,128,217, 19, 70,193, 76,241, 57,147, 39, 79, 14,234,213,171,215,131, 13, 27, 54, 24,109,154,181,104,158,149,149,245,112,204,
+128,129, 15, 14, 29, 58,164, 47,118,241, 80,249, 20,159,101,239, 62,123,246,140,114,115,113,162, 88,147,134, 17,115,  1,193,189,
+101, 44, 79,226, 12,  1,135, 98,185,  4,  9,190, 64,104, 27,147,152,152,197, 48,204, 99,107, 48, 25,134,185,243,234,213, 43,161,
+147,163, 29, 71, 83,168, 47, 16,210, 44, 47,246,206,237,151, 53,131, 27,121,  1,128,246,206,205,243,252,186,245,132,177,105, 25,
+226, 90,181,106, 89,133, 89, 88, 88,120, 55, 41, 41,137,114,114,114,226,196, 37, 36, 30,150, 73,196, 14, 54, 50, 89, 83,  0, 48,
+228,231,221, 36,117,186, 12,138,230, 56,101,100,101,101, 23, 22, 22,190,178, 54,239, 47, 94,188,224, 40,149,142,212,241,147,103,
+ 34,156, 68,124, 71, 41,143, 99,195, 39,  8, 66, 68, 17, 42,174,137,201, 20,136, 68,142, 49,137,137,217, 44,203,150,171, 33, 92,
+152, 59,176,103,209,247,154,189,187, 20, 54,238,221,187,135, 99,151, 31, 67,204,234, 65,104,243,112,114,211,122, 12,152, 60,237,
+189,237,254, 42, 35, 91,239,164,205, 90, 91, 47,234, 13,124,164, 84, 98,  8, 63, 96,192,128,217,219,182,109, 43, 49, 64,121,252,
+248, 49,218,182,109,107, 89,230, 64,135, 14, 29, 16, 18, 18,130,199,143, 31,195,219,219, 27,103,207,158,229, 83, 20,197, 31, 56,
+112,224,252,237,219,183, 31,173, 84,239,191,110, 29,134, 14, 29, 90,150, 97,245, 11,  0, 90, 66,238, 91, 48,117,225, 22,251,236,
+172, 76,164,103,164,222,181,182, 28,  8,130,192,224,137, 19, 51,215,234,245,216,113,227,  6,  6,137,197,162,205,207,159,163,115,
+ 72,  8,234,183,109,155,105, 77, 95,103,209,234,104,181, 90,208, 52, 13, 27, 27, 27,216,217,217,129,203,229,130,162, 93,192,225,
+  5,130,228,114, 17,220, 42, 16,139,191, 21,107,194, 63,197,114,130, 64, 46,159,135, 59, 92, 81,185,182, 58,132,184,  6,122,176,
+ 44, 84,154,  4,156,179, 16, 18, 91, 15,216,210, 82,250,228, 23,171,124,101, 54,142, 92, 28, 91, 30,135,147,171, 18,247,107, 83,
+ 49,189,184, 44,152, 10, 38, 18,245,101, 50, 25, 18, 18, 18, 16, 31, 31,255,  8, 21, 27,248,107, 30, 63,126,252,146,207,231,251,
+ 57, 56, 56,  0,128,103,121, 19,115,134, 97, 74,236,176,182,238,216,107, 31,212,218, 75,240,113, 75, 63,108,137,152,135, 47,195,
+150,131,166,  8,152,205,  6,252,186,180, 11,204,186,  2,132,117, 27, 65,124,212,222, 59,240,116,132,254, 11, 99, 97,206,250,183,
+ 38,  2, 28,204,253,185,223, 85, 25, 95, 66,214,  7, 67,200,236,237, 29,197, 92, 46, 23,118, 54, 74,253,180,145,223,164,176, 44,
+ 91,210,110,104,138,107, 36,243, 21,133, 89,169,  5, 66, 25, 93,  8,176,100,205,119,243,102,243,225, 37, 49, 49,113, 92,235,214,
+173,231,231,231,231,231,168,213,234,  1,  0,224,233,233,233, 65,146, 36, 31, 64, 69,171, 35, 30, 40,219, 45,  4,247,254,253,251,
+144, 74,165, 72, 74, 74, 42,173,124,  1,195, 48,255,152, 77,  0,255, 80,  9,  6,112,  7,128, 18, 64,103,148,114,239, 64, 22,171,
+234, 62,138,140,140,100, 35, 35, 35, 63, 42, 25,188, 88,150, 49,101,103,131,213, 21,149, 45, 77,211, 44,128,210, 59,154, 68, 50,
+153,140,160,221,220, 64,240,139, 76, 63,216, 15,184,245,213,104,180,206,181, 12, 99,  6,  5,194,  0,182,212,164, 69, 45, 32, 48,
+207,190, 29,198,241,102, 32,149, 39, 43, 61,210,  1, 38, 22,102, 48, 84, 21,147,195,170,213,106,152, 76, 38,121,237,218,181,143,
+152, 76, 38,121,241,224,198,254,183,190,168,217,108,126, 73, 81, 20,190,250,234, 43, 88,180, 63,122,189, 30,169,169,169,208,233,
+116,208,235,245,120,245,234, 21,242,242,242,160,215,235,241,240,225, 67,120,122,122,130,162, 40,101,  5,157, 57,203,178, 44,220,
+221,221, 81,179,102, 77, 80,  4,139,223, 23,205,194,247,227, 71,161,159, 39,131,141, 43,127, 69,155, 54,109,234,213,170, 85,171,
+ 25,135,195, 49, 59, 59, 59,115, 15, 28, 56,112,216,108, 54,247,128,245, 61,207,209,169, 83,167,214,244,247,247,119,148,217, 72,
+141,124, 30,  5,158, 81,205,242,117, 89, 44, 71,147,  9,119,119, 15, 19,132, 34,239, 65,131,  6,153,203,211, 66,148,133,249,237,
+183,223, 42,125,125,125,109,229, 50,169,154, 71, 83,233, 92,176,153,121,247,110, 93,  7,  0,158,131,163, 22,  2,145, 95,120,120,
+184,169, 42,152, 51,102,204,240,116,112,112,144,145, 96,243,205,  6,195,127,214,219,117,250, 44,130,166, 11,193,229, 53, 26, 59,
+118, 44, 81, 21,204, 73,147, 38,213,242,243,243,147,201,108,196,  5, 28,154, 74,225, 50, 76,138,  0, 76, 42,173, 55,228,  8, 28,
+236, 53, 16, 73,130,  7, 13, 26, 84, 46,166, 69,155, 53,101,202,148,132, 55,136, 55,178,179,179,161, 77,125,  0,110, 82, 52,  2,
+ 37, 52, 26, 59,200,193,231,243, 75,182,190,151, 87, 93,203,179,209, 42,139,108, 89,251,110,163, 31, 43, 88,  2, 92, 91, 47,234,
+ 77,191, 89,201,201,201, 80, 42,149, 21,182,167,237,219,183, 79, 11, 13, 13, 77,239,208,161,131,254,200,145, 35, 32,  8,  2,103,
+207,158, 69, 82, 82, 18, 58,116,232,  0,150,101, 45,187,218,112,247,238, 93,180,111,223, 94,223,186,117,235,164, 98,255, 90,149,
+202,208,161, 67, 97, 52, 26, 81, 80, 80,128,236,236,108, 68, 70, 70, 34, 48, 48,144, 21,137, 68,189, 40,247, 79,230,133,125, 49,
+173,121, 64,131, 32,172, 90,190, 88,207,227,208, 11,171,210, 94,  9,130, 64,248,183,223,102,230,  5,  7,103,111, 85,171, 53,131,
+109,108, 68,181, 19, 18, 20,183, 79,156,176, 55, 24, 12, 86, 97, 88,180, 58,110,110,110, 37, 36,139,203,229,130,195,115,  0, 37,
+174, 15,158, 93,  7,136,156,123,225,220, 29,190,206, 86,140,131, 82,  9,142,139,101,229,187,118, 16,185, 99, 94,243,190,202,  3,
+ 45,250, 41,207,136,106, 96, 67,241,120, 64,178, 28,226,192,144, 95,125,106, 59,212, 20,226,218,222, 84,156, 92,149,248,135, 54,
+ 21,179,  0, 60,175,172,157, 27, 12,  6,173,217,108,  6, 73,146,224,112, 56,165,109,  2,175,252,241,199, 31,184,125,251, 54, 80,
+202,109, 79,126,126,190,153,162, 40,  8,  4,  2,  0,144, 84,208,223,129,166,105,208, 52,141,243,215, 47,218,245,251,172, 11,113,
+245,207, 83,104, 17,216, 31, 89,  5,  6,164,229, 25,144,171,  1,252, 27, 79, 71, 64,251,131,184,247, 42, 31, 65, 13,  2, 40,138,
+ 39, 14, 47, 11, 79, 27,131,  4,117, 60,122,103, 61, 98,234,232, 19,133,199,174, 29,122,252,232,226,190,123, 15,119,253, 22,241,
+188,121,227,214,234, 98,101,  2, 10, 10, 10, 88,130, 32,216,111,134, 79,123,185,117,104,142,121,249,128,123, 12, 71, 39,120,241,
+ 55,118,245, 30, 14, 14, 14, 87,237,236,236,206, 22,147, 35, 15,169, 84,122, 69,169, 84, 70,163,104,163,199,161,148,148, 20, 95,
+181, 90,221,  2, 69,155,179,226,178,178,178,218, 22,107,158,226, 42,208,132,109, 80,169, 84, 95,155,205,230,110,197,199,167,102,
+179, 57,232,217,179,103,126, 65, 65, 65,143,188,188,188,238,122,121,121, 29,243,242,242, 58,236,229,229,117, 56, 52, 52,116,169,
+197,221,195, 95,188,108,248, 22, 23,249,151, 17, 45, 20,147,172,117,197,103,148, 16, 45,  0,231,223, 52, 64, 51,241,249, 15, 77,
+ 99,198, 64,118,248, 48,232,103,207, 48, 36, 60,220, 70, 36, 18, 45, 71,145,143,166, 22, 18,137,100,213,172, 89,179,164,246, 11,
+ 22,192,229,226, 69,196, 70, 70,194, 72,211,183,222, 37,117,133,133,133,224,112, 56, 37,154, 24,177, 88, 12,179,217,140,178, 84,
+190,111, 53, 64, 19,174, 37,165, 69,131,135,154, 96,192, 22, 28, 87,181,190,209,255,229,116,199, 72,149,167,247,115, 53,215,251,
+ 71,135,166,142,203, 61, 90,222, 80, 19,156,  2,158, 76,128,248,248,  4,152,193, 84,105,189, 89,171,213,230,169,213,106,  4,  5,
+  5,217,221,190,125,187,118, 96, 96,160,162,248,254,205,247,252, 48,205, 92, 92, 92,246,186,186,186,198,184,184,184,236,  5,208,
+172, 10,239,110,184,116,233, 18, 40,138,194,172, 89,179,144,159,159, 15,131,193,128,172,172, 44,196,199,199, 67,175,215, 35, 49,
+ 49, 17, 79,158, 60,129, 94,175, 71,108,108, 44,116,186,202, 39, 36, 12,195,192,198,198,  6,218,194,  2,172,158,247, 61,102, 76,
+153,128,188, 23, 81, 72, 76, 78,131,204, 86,140,113,227,198, 81,114,185,156, 97, 24,166,166,217,108,110,207, 48,204, 26,107,190,
+ 83,169,250,118,217,221,221, 61, 96,209,162, 69,126,223,207, 91,195,181,225, 20,176,124,169,128,225, 73,249, 44,175, 94, 83, 12,
+157,190,156,187,108,201, 47, 79,175, 93,187,150,  4,235,156,119,146,  0, 46,  7,  7,  7,251, 36, 37, 37,  5,250,250,250,214,181,
+247,168,197,231, 43, 93,115,185,202, 26, 42, 86,167,189, 65,184,214,104,181,102,205,154,  7, 87,174, 92, 73,174, 10,166, 88, 44,
+174,183,101,203,150,  0, 39, 39,167,  0, 90, 40, 20,104,242,242,246,152, 52,234,189,148, 76, 46, 32,109,100,159, 30, 60,120, 48,
+106,255,254,253,169, 85,193,244,246,246,246,157, 55,111,158,127,253,250,245,253,157, 61,107,243,133,174,238, 89,  2, 55,143, 44,
+ 97,253, 64, 62,220,106,118, 92,181,106,213,221,107,215,174, 89,133, 73, 81,148,137, 36, 73,208, 52, 13,145, 72,132,227,199,143,
+ 99,204, 23,253,225,238,106,135,186,190,190,104,247,229,215,216,191,127,127,137, 13, 15, 69, 81,229,142,232,155, 23,140,139,  8,
+ 86, 18, 81, 88, 91, 47, 10,107,235, 69,  5, 43,137,168,114,201, 86,241,223,203,122,198,170,222,168,156,229, 70, 43,200,214,209,
+243,231,207,255, 52,120,240, 96, 94,167, 78,157,112,227,198, 13, 12, 29, 58,244,242,129,  3,  7,  0,  0, 55,110,220,192, 55,223,
+124,115,249,204,153, 51, 24, 53,106, 20,218,182,109,203,187,116,233,210, 42, 88,225,251,199,100, 50, 97,227,198,141, 48,153, 76,
+144, 72, 36, 80, 40, 20,232,210,165, 11, 30, 60,120, 48,106,211,166, 77,209, 20, 77,127,222,185,219,103, 56,114,248,  0,158, 60,
+124, 48,106,243,252,129, 85,118, 10, 76,146, 36, 58,133,135,103,102,250,251,103,111, 86,169, 52,195,228,114,145,111,106,170,226,
+220,222,189,246, 86, 16, 53,194,108, 54,151,144, 43, 11,233,176, 28, 28,158,  3, 56,226,  0,112,164,141,113,239, 57,215,200, 13,
+193, 29, 94, 99, 60,174,200,127, 22,205, 35,135,246,250,222, 19,189,190,247, 68,247,201,181,134,136,106,224,119,113, 13,140,238,
+ 52,190,102,168, 87, 99, 91,168,210, 13,136,252, 53, 54, 78,155,133,  5,  0,158, 88,211,206, 25,134,121,148,148,148,  4, 30,143,
+135, 26, 53,106,248,  0,176,216,  5,110, 24, 62,124,248,216, 31,127,252,113,  2,128, 31,139,239, 73, 66, 67, 67,253, 11, 10, 10,
+240,236,217, 51,  0,184, 93,129, 54,184,100,151, 97,182, 42,150, 95,203,165, 62,  2,235,141,132, 92,222,  0, 73,217,122, 36,103,
+235,241,251,234, 30,136,186, 52, 23,183, 79, 14, 66, 92,106, 42,132,206, 61, 97, 54,233,  2,172,152,212,187,252,249,231,159,196,
+165, 75,151,  8,134, 97, 96, 52, 26,217,124,149,138,189,115,249, 50, 10, 47, 92, 32,108,108,108,136,150, 77, 90, 23,108,158,123,
+228,230,193,149,151,111, 27, 52, 85,158,168,191,143,204,120,249,242,101,179,189,123,247,134,  2,152, 81,191,126,253,107,241,241,
+241,205, 47, 94,188, 88,215,205,205,109,249,187,130, 90,220, 66,196,198,198,190,118, 20,187,133,208, 23,147,134, 78,197,100,174,
+ 59,128,111,240, 30,187,236,171, 32,231,255,197,198,240, 71,240,198,110,195, 55,137, 86,105, 71, 97,240,146,203,165, 70,163, 33,
+241,212,169, 83,  6,146, 36, 33, 18,137, 48,120,232, 80,114,245,111,191,181,234,223,172,217,217, 17, 31,127,124,236,236,153, 51,
+193, 33, 33, 33, 96, 89, 22, 36, 73, 98,247,238,221,133, 90,109, 97,150,187,187,187,204,154, 78,163,116,  3, 82,169, 84, 37, 68,
+ 43, 47, 47, 15, 78, 78, 78, 86, 47, 29,170, 85, 56,125,230,120, 84, 14,107,254, 50,190,211,243, 37,134,133,169, 61, 66,114, 25,
+ 51, 39,207,108, 68, 94, 33,139,124, 45, 56, 55, 72, 69,200, 96,239,158,134, 87,237, 67,158, 92,136,190,154,165, 53,107,171,180,
+ 91, 34, 61, 61,253,251,176,176,176, 44,165, 82, 73,216,216,216,192,213,213,149,236,222,189,123,102, 66, 66,194,143,239,250, 69,
+236,236,236,250,133,134,134, 70, 36, 37, 37,245,190,112,225, 66,205,139, 23, 47,246, 14, 13, 13,141,176,179,179,235,103, 37,196,
+158,105,211,166,169,121, 60, 30,154, 54,109,138,252,252,124, 20,239,242,169,240,176,102,137,148,203,229, 98,237,162, 31, 48, 99,
+202,  4,100, 71,223,192,189,203,167,112, 62,149,192,244,121,191,128,203,229,190,147,175,175, 58, 14,162,250,245, 93,164,143,191,
+ 25,218, 55,121,234,148, 41,210,187,119,239,210, 99,199,127,195,198,166,100,131,215,105, 49,133,143,190, 39,255, 84, 59,160,243,
+167,237, 48,107,198,196,250,197, 78, 59, 43,148,122, 14,162,250,  1, 46,210, 71, 19, 71,244,127, 57,126,252,120,225,194,133, 11,
+181,205,154, 53, 43, 76, 75, 75, 19,138,229, 10, 95,142,173, 44, 32, 54, 37, 85,210,172, 89,179, 87, 95,126,249,101,110, 85, 49,
+167, 79,159, 46, 58,113,226,  4, 39, 44, 44,204,148,147,147, 35,161,133,194, 32,130, 47,104,146,145,147, 99,219, 59, 44,236,121,
+239,222,189, 53,197, 14, 75,173,198,156, 57,115,166,232,201,147, 39,156,102,205,154, 25, 83, 83, 83,165, 98, 59,251, 64, 74,166,
+104, 28,147,146,102,211, 36, 36,228,197,216,177, 99,213, 21,165,179, 52, 73,145, 74,165, 73, 45, 90,180,192,175,191,254,138,101,
+203,150,161, 99,199,142,120,240,240,  1, 58,143,157,  0,191,209,223,224,240,213,235, 72, 74, 74,194,156, 57,115, 16, 24, 24,  8,
+ 46,151,251,164,204,246, 56, 42,154,184,155, 10,226,110, 42,  8, 98, 84, 52, 97,185, 46, 87,179,245, 99, 30, 74, 63, 95,214,115,
+183,103,150,173,233, 10, 86, 18, 81, 21,217, 97, 85, 70,182,122,247,238, 61,198,226,194, 97,216,176, 97,151,151, 47, 95,222,114,
+216,176,162,137,118,211,166, 77, 49,119,238,220,150,211,167, 79,191, 60,111,222, 60,180,107,215, 14, 94, 94, 94,149,110,124, 49,
+155,205, 48,153, 76,232,223,191, 63, 76, 38, 19, 50, 50, 50,240,244,233, 83,172, 91,183, 14, 44,203, 10,  0, 64,233,226,214,136,
+199,227,225,207, 59,183, 52, 51,134,133,108,175,130, 38,139, 40, 61,137, 41, 40, 40, 64,239,209,163, 51, 19,235,212,201, 94,147,
+153,169,249, 66, 46, 23,213,138,139, 83, 72,245,122, 87, 84, 96,151, 72, 16,  4, 24,134, 41, 33, 86, 22,194,245,230, 81, 60, 80,
+ 90, 37,  6, 13,115,244,226,182,100,  0, 64,235,129, 46,232, 62,185,214, 16,165,183,104, 69,171,  1, 69, 74,239,253,115, 95,178,
+249,201,230,133, 48,226, 81, 21, 52,214, 55,110,220,184,  1,153, 76,134,176,176, 48, 62, 73,146, 11, 44,243, 85, 20,249,206, 90,
+ 98,193,226,243,249,139,  7, 13, 26, 68,230,230,230,226,222,189,123,  0,112,166,188,126,137,101,217,146,188, 23,100, 19, 48, 51,
+ 60, 92,185,115, 28, 39, 47,238, 67, 76, 82,  6,226,210,181,  0,199, 22, 90,117, 34, 12,133, 73,208,231,222,129, 74, 39,178, 42,
+193, 92, 46, 55,163,126,253,250,108,227,198,141, 89,150,101,241,226,197, 11, 83,108, 92,156,233,214,210,165,236,253,145, 35,  9,
+233,211,167, 92,161, 80, 72,120,122,122, 66, 32, 16, 48,  2,129, 32,235,111, 28,188,255, 18,119, 11,127,129, 91,136, 15,169,213,
+ 98,241,239,148, 20,188,190,219,176,196,129,105, 89, 14, 75,193,218,  8,251,238, 91,181,218, 54,172,255, 64,117, 96, 96,160,220,
+213,213, 21,  4, 65,160, 71,207,158, 68,232,133, 11, 82,218,197,  5,118, 13, 27,150, 44, 71,156, 62,117, 10,199,143, 31, 87, 31,
+249,227,160,235,208, 47,190,232, 10, 96, 75,  5,137,225,240,249,252,146,223, 77, 73, 73,  1,159,207, 47,177,137, 80,169, 84,112,
+112,112, 64, 74, 74, 10,172, 92,153,219, 58,117,202,245, 41,233, 33,223,123,134, 72,105,226,152, 58, 21,102,150,  5, 77,152,129,
+ 66, 22, 70, 51,160, 51,178,104, 84,139, 82,156, 44, 52,201, 35,111, 28,120,  5, 96,107, 85, 74, 79,167,211,157,187,123,247,238,
+ 72,134, 97,246,  1, 32, 47, 92,184,192, 60,122,244,104, 12,172, 55, 92,127, 91,109, 47, 18, 77, 62,123,246,172, 98,242,228,201,
+ 57,145,145,145,121, 93,186,116,177, 93,183,110,157,162,109,219,182,147,179,178,178,118, 89,163,  8,140,143,143,223,146,144,144,
+ 48,166,113,227,198,200,206,206,134,193, 96, 64, 84, 84, 20,188,189,189,113,251,246,109,248,248,248,224,214,173, 91,168, 91,183,
+ 46,204,102, 51,180, 90, 45, 24,134, 49, 87,214,153,103,103,102,  0, 89,241, 72,190,113, 12, 79,239, 71,225,108, 50,129,149,187,
+ 34, 80,163,166,231, 59,249,169,241,113, 20,249, 43, 29,236, 78, 46,156, 61,211, 49,246,220,110, 28,216,184,146, 57,127,236,152,
+ 31, 79,138,145, 31,245,255,250, 51,189, 17, 30,  0,120,205, 67, 26,163,147,252,137, 89, 84, 19,169,103, 31, 85,236, 96,209,199,
+ 81,228,239,100,111,119,226,231,  5, 63, 74, 95, 28,223,140, 61,107,127,101,247,111,219, 25,168,  5, 66,252,253,253, 59,145, 36,
+ 41,  3,160, 45,182,243,178, 42,180, 77, 89,152,167, 35, 34,130,181, 64,200,161, 67,135, 58,137, 68, 34,103,  0, 70,141, 70,243,
+242,125, 48,207, 68, 70,  6, 91,210, 73, 16,132, 35,  0,  3,203,178, 47, 80,197, 16, 60,125,250,244,153,251,205, 55,223, 76, 49,
+155,205, 14,165,102,231,212,226,197,139, 57, 12,195, 80, 44,203, 26, 72,146, 52,156, 56,113,194,108, 50,153,146,181, 90,237,232,
+247,233, 69, 62,251,236, 51, 92,191,126,125, 54,138, 54, 97, 88,171,173,126,205, 78,171, 56,100,207, 59,227, 95,184,112, 97,206,
+231,159,127, 62,117,215,174, 93, 79,151, 47, 95,222,109,212,168, 81,216,189,123, 55,234,212,169,131, 63,255,252, 19,223,127,255,
+ 61,  0,180,156, 62,125,250,225, 13, 27, 54,120,197,198,198, 46,182, 66,163,  1,147,201,132,157, 59,119,162, 71,143, 30,112,112,
+112,128,139,139, 11,  8,130, 56,247,197, 23, 95,252,  6,  0, 20, 65,113,  1, 64,167,213,233,124,125, 27, 91,173,193,229,114,185,
+ 37,125, 93,106,106,106,201, 78,193, 79, 62,255, 60,243,247,133, 11,177,189,176, 16, 95,200,229,162, 68, 55, 55,229,225, 23, 47,
+ 70, 60, 44,234,156,217,138,180, 58,149,145, 44,107, 77, 26, 10, 83, 48,237,143,249, 49,206,  0, 58,182, 30,232,130,214,  3, 93,
+208,184,187, 35, 65, 82,  4,238,159,204,194,131,211,217,251,141, 42,156, 67,213,194,229, 60, 90,176, 96,193,225,143, 62,250,168,
+ 91,189,122,245, 48,124,248,240, 47, 55,110,220,200, 53, 26,141,227,241, 31, 55, 15,182, 36, 73,254,184,118,237,218, 17, 10,133,
+  2,151, 46, 93,194,197,139, 23,207,  1,136, 47,175, 95,  2, 80,226, 51,171,134,187,143,246, 73,108,129, 40, 61,233, 10, 46, 95,
+250,  3,117,  2,191,134,208,185, 43, 20,190,243, 96,136, 94,  6,125,214, 73, 40,220,187, 32, 49,246,  5, 40, 14,255, 65,101, 70,
+ 40, 44,203, 62, 76, 76, 76,244,242,242,242, 34, 98, 98, 98, 76,  0, 88,179,217,204, 26, 90,181, 50,250, 45, 92, 72, 63,248,242,
+ 75,162,249,147, 39, 20, 75, 16, 76, 84, 84, 20,  0, 60,254,111,140,226, 22,119, 11, 15, 30, 60, 40,207,221, 66,149,164,126,253,
+250, 45, 47, 94,188,200,215,106,181, 56,127,254, 60,154, 52, 41,217,219,245, 95,245,126, 95,154,139,252,203,100, 68, 25,247,214,
+189,166,209,122,173, 98, 51,  4, 93,215,199,199,204, 37,177,169, 71,215,174,154,187,119,239,150,204,250,180, 55,111, 66,125,252,
+ 56,204,102, 51, 88,150,197,197, 11, 23, 48,104,224,192,  2,154, 34,126,175, 85,171, 38, 75,176,175,249,110,105, 95,198,236, 33,
+ 44, 44, 44,172,164,243, 73, 72, 72,128, 88, 44,  6,143,199,  3,195, 48, 48,153, 76,160, 40, 10,182,182,182, 48,153, 76,101,169,
+ 96,222,196, 52,154,179,213,189, 55,116, 30,144,226, 82, 96, 96, 71,202,106,193,131, 43, 44,105,156,206, 54,  4,186,  5,210,176,
+231,164,179,103, 22,127,156,204,232,178,122,227,237, 29, 93,149,109,249,247,105,208,160,193,111,131,  6, 13, 34,  1,160,125,251,
+246,100,131,  6, 13, 86,160,226, 80, 57, 21, 98, 10,  4,  2, 62,  0, 68, 68, 68,100, 63,125,250,180, 99, 68, 68, 68,118,233,251,
+ 86, 98,174, 91,180,104, 17, 68, 34, 17, 76, 38, 19,244,122,125,137,125, 86,233,179,193, 96,128,189,189, 61,142, 28, 57,  2,179,
+217,124,164,178,116,186,123,212,  4,225, 80, 27, 91, 34,206,226, 98, 38,247, 93, 72, 86,  9,102,109,103,113, 93,103,123,187, 83,
+ 63,207,159,227,144,243, 60, 10,137,137,137,236,137,227, 71,174,105,129,164,188,124,204,200, 85,163,110,161, 30,130, 38, 94,136,
+ 63,181,246, 59,118,122,107, 24, 81,246,174,193, 18, 76, 63,103,113, 93, 87,  7,187, 19,191,252, 60, 95,154,251, 60, 10, 41,169,
+169, 56,122, 36,226,174, 22,176, 44, 55, 14, 97, 24, 38,128, 97,152,  0,  0, 67, 42, 32, 47, 85,194,212,104, 52,245, 53, 26, 77,
+253, 15,137,201,178,108,125,150,101,173,198, 44,109, 19,181,100,201,146,232,148,148,148, 65,233,233,233, 29, 44, 71, 78, 78, 78,
+251,130,130,130, 54, 26,141,166, 85,225,146,154,182, 26,141,198,177,160,160, 64,169,213,106, 27,  1,136,170, 66,157, 47,145,210,
+ 94,167, 83, 82, 82,102,165,164,164, 16,149,165,147, 26, 29, 77,236,248,101,226, 31,107,215,174, 85,190, 39,254,107,233,204,204,
+204,220,183,107,215,174, 32, 79, 79, 79,175, 33, 67,134, 96,205,154, 53, 88,190,124,185, 14,  0, 54,108,216,160, 43,165,201,114,
+143,141,141,109, 92,206,178, 97,251, 82,218,146,173,159,124,242,  9,123,241,226, 69,244,232,209,163,196,145,232,250,245,235, 97,
+ 50,153, 84,237,218,181, 99,  0,160, 80,171, 81,177, 12, 11,189,161,220,245,247,183,202,147,199,227,125, 90,218, 95,160,197, 25,
+ 51,143,199,  3,203,178,168,219,178,101,102,110, 96, 96,246,198,188, 60,205,172,250,245,109, 70,248,250, 14,169,  7, 12, 44, 11,
+147, 32,136,215,180, 58,111, 30, 85,208,100,149, 78,103,122, 97, 50,134,255, 49, 63,230,184, 69,179, 37,144,112,160,205, 55,225,
+224,194,152, 12,109,  6,214,151, 71,126, 42,202,123,118,118,246,216,133, 11, 23,234,228,114, 57, 62,251,236, 51,204,155, 55,239,
+139,150, 45, 91,230, 57, 58, 58, 94,175, 83,167,206,253,190,125,251,166, 68, 69, 69,141, 13, 13, 13,197,179,103,207,240,203, 47,
+191,228,230,228,228, 12,168,  8,147, 32,136, 18, 77, 94,247,206,237,179, 87,175,248,149,105,247,209, 24,136,132, 54, 48,210,238,
+200, 46, 48, 34, 71,205, 66,207, 15,  1,143,203, 71,135,102,254,184,126, 98,179,198,172, 87,111,169,172,206, 23, 20, 20,236, 31,
+ 60,120,176,138,203,229, 66,175,215,179, 52, 77,131, 95,100,119,204,208, 29, 59, 26,154, 63,122,100, 50,179, 44, 67, 16,  4,190,
+253,246, 91,117, 78, 78,206,174,119,105, 71, 85,144,210,152, 31,202,221, 66,251, 55,198,159, 15,225, 22,226,175,200,251,191, 89,
+214,149,113,252, 71,163,101,217, 82,105, 57, 19,  4, 99, 54,155, 25,212,242,172, 37,141,141,137, 95,217,167, 79,216,176, 78,157,
+ 58,139, 58,119,238, 44,240,143, 46,154,141, 70, 68, 68,224,192,129,  3,154,147, 39, 79,170,248, 52,181,193,189,134,187,147,217,
+204,128, 32,152, 10,217,176, 84, 42, 29, 63,109,218, 52, 97, 94, 94, 30,150, 47, 95,206,  4,  5,  5,145, 98,177, 24,  6,131,  1,
+ 27, 54,108, 48,250,251,251,211, 36, 73, 34, 47, 47, 15, 36, 73, 62,177, 50,131,247,242,226,147, 58,252, 22,218,235, 64,227,175,
+134,218,249,133, 54,151,183,113,119,133,177, 33,139,228,132, 24, 60, 61,115, 50,231,225,137,165, 89,208,166,245, 66,229,225,129,
+202, 26,  8,126, 56,121,242,164,227,216,177, 99, 89,173, 86, 75,196,199,199,179,243,231,207,119, 28, 62,124,248, 15,201,201,201,
+253,222,241,163, 16,185,185,185, 32,  8,130, 41,238, 72, 44,179,254,170,172,203, 61,216,178,101,203,161,158, 61,123,118,111,215,
+174, 29,162,163,163, 75,150,  8, 75, 19, 45,203,238,195,  5, 11, 22,228,  2,152, 90, 25, 40, 77,211, 88,190,101, 31,114,115, 50,
+225,228,228,  2,129, 80,136,119,221, 97,201, 35,201, 89, 63,205,153,233,152,249,248, 58,241,224,218, 89,102,239,189,180,116,147,
+153, 45,219,227,127,126, 50, 91,204,254, 43,158,205,144,212,172,159,230,255,104,107, 89,214,220,117, 39, 69, 69,152,217,177,239,
+213, 68,254, 45,152,127,179,184,184,184, 32, 37, 37,133,112,113,113, 97,139,109,180,216, 10,136,214,235, 21,188,104,185,140,168,
+104,217,240, 93,241, 95,189,122, 53,191, 97,195,134, 19,159, 61,123,182,215,207,207,111, 20,128, 26, 58,157, 46,119,250,244,233,
+ 63,111,216,176, 97,152, 53,154, 44,  0,216,189,123,247,210,161, 67,135, 30,239,218,181,235,119, 12,195, 52, 40, 53,176,191,114,
+116,116, 44, 89,194,205, 72, 75,157, 50,114, 88,255, 41,  5,  5, 57, 86,251,185,147, 72, 36, 35,166, 79,159, 46, 80,171,213, 88,
+181,106, 21,227,239,239, 79, 90, 38, 69,219,182,109, 51,249,248,248,112,194,198,140,201, 92,146,154,138,185,151, 46,169,167,  4,
+  4,  4,109,124,250,180, 17, 24,102,107,121, 90,157,178, 52, 89, 22,179,139,119,148,228, 98,178,181, 30, 64,199,230,125,156,113,
+104, 81, 12,114, 98,245, 63,195,132, 23,176, 34, 44, 80, 25,146,184,127,255,254, 14,105,105,105,135,102,206,156,105,219,168, 81,
+ 35,  4,  4,  4,208, 18,137, 36,196,226, 46, 38, 47, 47, 15,167, 79,159,198,154, 53,107,244, 15, 31, 62,236, 89,209,114,149,217,
+108, 78,247,241,241,177,148,  3, 75, 16, 68,150, 74, 71,216,238,169, 23, 34, 25, 50,114, 47,113,249,214, 85, 36, 27, 24,232,140,
+ 12,106,121,  6,163, 77,199, 37, 56,124,236,190, 57, 57,246,209, 35, 99, 97,206,239, 86,164,247,197,243,231,207, 15,206,153, 51,
+167,207,119,223,125, 39,204,204,204, 52,235,116, 58,102,223,190,125,212,144, 33, 67,204, 44,135,195,112, 57, 28,140, 31, 63,190,
+ 48, 55, 55,247, 15,224,111, 13, 48,253,151,184, 91,248, 11,220, 66,124, 48,109, 86,233,243,255,138,148,217, 66, 25,138,188,178,
+102,237,234, 79,119,239,220,229, 76, 81,164,243,139,151, 47,111,117,235,213, 59,233,212,169, 83, 10,174,173,109, 19,  0,140,126,
+212,168,107,  6, 93, 97,118,228,161, 67, 30,181,106,213, 12, 44, 14, 42,205, 50, 20,121,165,162, 31, 44, 40, 40, 80, 95,186,116,
+ 73, 51,117,234, 84, 34, 33, 33, 97,135,147,147, 83,223, 99,199,142, 73,122,245,234, 85, 24, 29, 29,189,223,217,217,185,123,104,
+104,168,116,226,196,137,186,130,130,130,170,  4, 30,125,196,102,228,212,187, 57,115,241,231, 55, 23,173,254, 24, 28,170,  5,116,
+ 52,192, 24,175,192,144,127, 10,192, 14, 84,193,223, 81,105, 17,139,197,129, 34,145,  8,119,239,222,205,  9,  9,  9,209,107,181,
+ 90,238,188,121,243,236,196, 98,113,224,187, 22, 60,203,178,108, 78, 78, 14, 24,134,225,  0, 32,138,207, 96,170,190, 23,191, 95,
+183,110,221, 14,237,217,179,231,147,206,157, 59,195,203,203, 11, 70,163, 17, 62, 62, 62,208,235,245,240,246,246,134, 78,167,195,
+236,217,179,145,151,151, 55,  1, 21,196, 60, 35,  8,  2, 38,147,169,196,216,214,213,205,163,200, 79,207,123,184,177, 16,211,164,
+215,147,200,141, 72,207,202,100,246,252,153,150,166, 49,152, 59, 60,207,208, 60,124,243, 57,141, 25,234,208, 33,227,146,  0, 64,
+199, 84, 28,113, 94,204,131,215,211, 35,235,145,150,158,137,221,119, 82,114,213,  6,166,227,211, 50, 48,171,148,206,127,  9,102,
+240,236,104,244, 30,103,253,179,239, 35,214, 18,170,242,228,110, 42,136,219,162,141, 44,214,110, 44,211, 71,214,123,226, 31,122,
+246,236,217, 33,  0,120,244,232, 81, 66,255,254,253,167,196,196,196,204,  1,112, 52, 54, 54,118,109, 85,128, 54,110,220,248, 12,
+192,208,138,158,217,181,120,232, 65,  0,  7,171,130,155,159,159,175,141,138,138,210, 78,156, 56,145, 72, 72, 72, 56,230,236,236,
+252,201,241,227,199, 69,189,122,245,210, 61,120,240,224,140,139,139, 75,235,246,237,219, 75,142,222,184,145,164,121,241, 34, 50,
+ 50, 38,198,205,200, 48,145, 21,181,207, 15, 76,178, 94, 35, 91,  7,231,198,252,116,232,167,152,246,140, 14,251,245, 57,184,  6,
+ 32,241, 61, 48, 47, 94,185,114,197,111,224,192,129,123,186,116,233,210,220,207,207, 15, 53,106,212,192,211,167, 79,145,145,145,
+129,123,247,238, 33, 34, 34, 34, 66,171,213, 86, 26, 80, 59, 59, 59,251,237,240, 68,  2,133,203,230, 85,179, 34,110, 93,110,226,
+211,170,243, 96, 97,128, 11,112,159,172, 26,  0,  0, 32,  0, 73, 68, 65, 84,  3,189,129, 69, 66,220, 11,204,158,241,187, 38, 37,
+238,217, 35,131,201,208, 19, 86,110,212, 41, 44, 44, 92,183,108,217, 50, 58, 50, 50,178,243,202,149, 43,165, 30, 30, 30, 20,151,
+203, 37,  1,176,183,111,223,102,199,141, 27,167,206,204,204, 60,162, 82,169,214,253,205, 99,244,197,151, 47, 95,  6, 83, 20,245,
+ 65,221, 45,188,135, 91,136,106,249,144,226,233,233,230, 87,219,195,101,148, 87, 13,183, 49,158, 30,238,225,101, 25,185,123,201,
+229, 82,207,154,174, 35,188,106,184,141,169,237,225, 50,202,211,211,205,207, 10,213,162,151,141,141,205, 49,165, 82, 25,  4,  0,
+182,182,182,221,101, 50,217, 67, 91, 91,219,238,197,179,192,238, 18,137,228,177,191,191,255,240,191, 81, 93, 89, 33,166,143,143,
+ 79,255,130,130,130, 47,125,124,124,250, 91,174, 95,188,120, 81,114,253, 46,152,238,238,238,237,110,223,190,221,111,241,226,197,
+159,213,169, 83,167,251,252,249,243, 63,251,227,143, 63,250,185,185,185, 53,122,  7, 76, 62,128,237, 52, 77,167,241,120,188,116,
+154,166,211, 44,  7,135,195, 73,163, 40, 42, 13,192,218,114,180,101,237, 75,205,114, 46, 59, 57, 57,197, 58, 57, 57,197, 58, 59,
+ 59,199, 58, 59, 59,199, 42,149,202,183, 14,123,123,251,203,214,150,167,175,179,164,101, 72, 13,233,149,250, 74,201,229,122, 78,
+ 98,223, 15,241,141,124,157, 37, 45,155,212,176,189, 82, 95, 41,189,244,255, 13, 51,200, 25, 44,187,198,151,101,215,248,178, 65,
+206, 96, 43,187,254,144,106,127,165, 82,201, 42,149,202, 89,127,213, 82, 66, 57,248,127,123,123,255,128,152, 94, 82,169,116, 87,
+141, 26, 53, 44,125, 93, 87, 27, 27,155,115, 18,137,164,107,113, 95,215, 85, 44, 22, 95,240,247,247, 31, 92, 25,166, 66,161,184,
+237,232,232,152, 90,124,164, 56, 57, 57,165, 56, 57, 57,165, 56, 58, 58, 38, 59, 58, 58, 38, 59, 56, 56, 36, 89, 14,153, 76,118,
+253, 29,243,238,  8,160, 41,128, 70,  0,108, 62, 96,121,122,  2, 24, 89,220,  7, 45,  4, 48, 28, 64,131, 15,240,141,  8, 90,168,
+ 24,205,151,185, 95,161, 37, 14,249,180,196, 33,159,111,235,118,165,130, 16, 60,214, 96,214, 85, 40, 20,243,108,108,108,254,144,
+ 74,165,151,164, 82,233, 33,123,123,251,249,  0,234,254,151,234,146,  4,192,  6, 20,249,103, 58,138,162,165,240, 67, 40,218, 84,
+224,241, 15,172,243,255,159,101,196,127,235,135,219, 87, 99, 86, 99, 86, 99, 86, 99, 86, 99, 86, 99,254, 11, 49,201,234,242,172,
+ 38, 90, 85, 36, 90,111, 30,  0, 42,240, 12, 95, 45,213, 82, 45,213, 82, 45,213,242,255, 88,152,234, 34,168,150, 42, 74,153, 75,
+203, 68,  5,172,180, 42,190,166,222,133,217,158,174,198,172,198,172,198,172,198,172,198,172,198,172,198,252,127,135, 89, 45, 31,
+ 80,170,213,170,213,152,213,152,213,152,213,152,213,152,213,152,213,152,255,235, 82,189,116, 88, 45,213, 82, 45,213, 82, 45,213,
+ 82, 45,213,242, 23,201,186, 82,132,235,181, 37,196,106,162, 85,117, 33,  1,124,  9,160, 55,128,218, 40,138,102,191, 15,192,111,
+120,183, 53,125, 27,  0, 83,  0,180, 64,209,238,156, 87,  0, 46,161,104,119, 78, 65,117,113,151, 45,246,246,246,211,104,154,150,
+  1, 69,161, 77, 44,231,210,255, 55,155,205,185, 42,149,106,254, 95,148,  4, 10, 86,122, 80,182,164,181,116,218, 74,159,141, 70,
+227, 95,153,206,106,249,103,138,143, 66,161,216,158,157,157, 61,  0,165,130, 44, 87, 75,181,252, 47,136,131,131,195, 40,131,193,
+ 48,157,203,229,206,203,200,200, 88,253,255, 40,235,111,145,172,215,136, 86,100,100,228,  5,  0,232,210,165,203, 71,  0, 32,147,
+201,174,146, 36,233, 89,149, 95, 96, 24,230, 85,110,110,110,185, 14,212,100, 50,217, 85,138,162,222,194, 52, 26,141, 82, 14,135,
+147, 95,214, 59, 38,147, 41, 81,165, 82, 53,250,135, 20, 34,  1, 32, 82, 46,151,107,231,204,153,243, 91,155, 54,109,220,147,147,
+147, 77,147, 39, 79,110,253,231,159,127,118,  6,240,105, 21,201, 86, 51,130, 32, 54,  7,  5,  5, 29, 12, 15, 15,223, 19, 18, 18,
+194,203,202,202,146,238,219,183,207,117,203,150, 45, 81, 12,195, 12, 64,  5,129, 86,255, 63, 11, 77,211,178,196,196, 68, 41, 80,
+ 20,154,164,152, 88,193,104, 52,194,104, 52, 66,173, 86, 35, 48, 48,240,131,255,174,179,179,115, 48, 65, 16, 43, 37, 18, 73,163,
+130,130,130, 91,  0,198,164,164,164,252, 89,149,180,154, 76, 38,176, 44, 91,146, 78, 63, 63,191,234, 15, 90, 53,249,130,199,227,
+117,244,246,246,110,162,211,233,114, 94,189,122,117,211,108, 54,207,196,135,139,209,102, 11, 96, 38,159,207, 15,169, 93,187,182,
+251,179,103,207, 18, 12,  6,195, 13, 20,  5, 67,206,251, 16, 36,235,163,143, 62,186,188,106,213, 42,187,209,163, 71, 95,190,116,
+233, 82,203,106,178, 85, 45,255, 45,113,119,119,151,169,213,234,223,  1,  4,211, 52,237, 44, 16,  8, 32, 20, 10, 83,249,124,254,
+ 93,161, 80, 56,236,202,149, 43,185, 85,197, 52,155,205, 51, 99, 99, 99,157,155, 54,109,186,200,209,209,113,118,102,102,166,214,
+ 96, 48,156,201,201,201,153,  0, 64, 85,209,187,111,114,145,127, 25,201, 42,125,134,133,116,113,138, 51,198,  2,104,243, 26,  3,
+227,112,220,226,226,226, 28,  5,  2,  1, 24,134, 41, 25,204,222, 60, 44,247,245,122, 61,  2,  2,  2, 12,149, 12, 56,238,  9,  9,
+  9,142, 60, 30,175,228,158, 94,175,135,171,171, 43,147,152,152,232, 88, 28,246,160, 68,116, 58, 29,220,220,220,254, 73, 49,143,
+190, 84, 40, 20,121,241,241,  9,129, 90,157,225,199,225, 99,167, 78, 27,208,251, 99,249,213,171, 87,153, 79, 63,253, 84,119,225,
+194,133, 47, 81, 20, 56,213,170,206,156, 32,136, 45,147, 39, 79,158, 45, 16,217,216,157,189,250, 72,183,101,223,145,164, 32,159,
+ 90,196,132,  9, 19,168,113,227,198, 93, 12, 14, 14,222,206, 48, 76, 67, 84, 65,179, 37,151,203,143,243,249,252,154,197,229, 23,
+159,147,147,243,201, 63,176, 66,114,240,182,243,216,178,238, 85, 42, 89, 89, 89, 40, 44, 44,124,235,240,243,243,179, 54, 86,102,
+149,210, 77,211,244,161,  5, 11, 22,184,166,166,164,224,215, 37, 75,154,162, 72,147,217,212,154,151,211,211,211,223, 74,167,175,
+175, 47,170,165, 74, 50,101,246,236,217, 11, 62,255,252,115,152,205,102, 20, 22, 22,186, 60,127,254,220,127,250,244,233, 61, 95,
+188,120,209,  4,192,203,247,157,140,123,123,123, 71,127,253,245,215,138, 38, 77,154,160, 56, 74,133,203,165, 75,151,154,110,216,
+176, 97, 80,124,124,188, 47,128,140,247,249,  1,133, 66,177,125,253,250,245,118, 34,145,  8,135, 15, 31,182,107,215,174,221,165,
+ 59,119,238,180,122, 15,178, 69,218,217,217,141,  3,208,150, 97, 24, 30,128, 27, 57, 57, 57,115, 81,117,175,238, 74,137, 68,178,
+159, 36,201, 90,192,127,188,209,147, 36,105, 79, 16, 68,166,229, 30, 65, 16,142, 12,195, 92,203,206,206,110, 94, 93, 29,255,221,
+ 98,103,103,247, 69, 90, 90,218, 42, 62,159,207,149,203,229, 16,137, 68,224,112, 56,224,112, 56, 53,248,124,126, 13, 62,159,223,
+ 41, 52, 52,116,204,185,115,231, 42,244,176,223, 44,200,105,  8, 72,226, 71,138, 32, 41,  0, 32,105,177,141,173,173, 45,126,252,
+241, 71,113,247,238,221,197,  0,112,249,242,229,240,193,131,  7,183, 75, 76, 76, 12, 40,143,108,149,197, 69,254, 69,178,174,162,
+  1, 15,197,236,241,194,107, 45,151, 36,193,227,241,112,253,250,117, 88,227,172,220, 18, 34,161,194,222,160,216,195,248,159,127,
+254, 71,  1, 96, 25,104,120, 60, 30,174, 92,121,221,169,124,179,102,205, 74, 26,251,223, 37,189,253,138,156, 60,238,253,170, 40,
+ 93, 97, 43,139,188,107,239,253,202, 23,173,127,137, 67,239,113,179,250,106,180,134,198,  0,212,185, 57, 57, 57,183, 14, 28, 72,
+ 14,242,241,225,110,223,190,189,137,171,171,107,239, 42, 16,173, 41, 13, 27, 54,220, 79,  9,109,237,195,  7, 15,  9, 31,198, 33,
+ 13,131, 70, 78,156,151,144,146,169, 30, 49, 98,196,129,195,135, 15,135,255,244,211, 79,143, 39, 77,154, 52,  5,192,247,214,166,
+ 95, 32, 16,212,124,242,228,137,183,217,108,134,159,159,223, 63, 49,140, 65, 16,138,156,239,125, 14, 96,103,241,189,254, 40,242,
+220, 31, 12,224,110, 85,192, 44, 26,172,178,142, 15, 45,174,174,174,190,  3,  7, 14,180,207,206,204,196,175, 75,150, 88,110, 55,
+ 66, 37,203,136,150,246,163,215,235,241,217,103,159, 13, 52,155,205, 28, 11,  9,212,233,116,250,188,188, 60, 45,254, 99, 88,154,
+  1,224, 99, 43,146,227, 41, 22,139,127,  6, 16, 92, 88, 88,232, 10,  0, 98,177, 56,137, 97,152,131,106,181,250,123,252, 39,128,
+111,149, 39,184,  0,252, 81,126, 40, 40,118,193,130,  5,207,166, 78,157,250,242,191,128, 89,211,201,201,105,126, 88, 88, 24,142,
+ 28, 57,130,163, 71,143, 26,133, 66, 33,103,240,224,193,196,152, 49, 99,228, 95,127,253,117, 39,  0,203,222,243, 51,119,154, 61,
+123,182,162, 94,189,122,216,183,111, 31,238,221,187, 87,232,237,237, 45,108,211,166, 13, 56, 28,142, 98,218,180,105,159,  2,216,
+252, 62, 63,144,157,157, 61,119,226,196,137, 91,118,238,220, 41,125,245,234, 21, 86,174, 92,105,223,183,111,223, 11,241,241,241,
+ 31, 85,129,108,241,  1,140,  3, 16, 74, 81, 84,171,193,131,  7,155,198,142, 29, 75,147, 36,105, 92,178,100,137,195,134, 13, 27,
+250,210, 52, 29,156,149,149,101,205, 36,141,  4,240,227,176, 97,195,134,158, 59,119, 78,126,243,230, 77,158,157,157, 29,204,102,
+115,137,166,152, 97, 24, 71, 75,157, 53,153, 76,240,245,245,117, 43,245,190,240,223, 74, 52, 72,146, 52, 48, 12, 67,  3, 16,  0,
+208, 85,118,253,191, 68,178, 20, 10,197,232,236,236,236,223,156,157,157,225,228,228,244,214, 88,171,211,233, 32, 16,  8,184,206,
+206,206,235,187,119,239, 78, 31, 58,116,168,220, 37, 64,130, 34,102, 30,222, 53,199, 85, 33,151,  2,  0,150,174, 57,161,  1,128,
+ 63,254,248,  3,201,201,201,144,203,229,  8,  8,  8,160,230,204,153,163,156, 48, 97,194,175, 57, 57, 57,195,202,195,122,147,139,
+252,203, 52, 90,235,202,186,174,208, 70,139,101,217,146, 56,121, 86, 86,218, 55,111,157,126,  3,143,208,235,245,120, 83,163,101,
+105,188, 52, 77,191,169,126,  4, 65, 16,108, 69,152,101,200, 96,177, 88, 28,168, 86,171, 87, 84, 97,118, 91,130,185,247, 43, 95,
+108,225, 79,238,111,137, 68,218,105, 98,209,121, 11,128,171, 49,195, 86,174,250,232, 35,215,113, 51,150,207, 42,204, 74,206,156,
+ 54,176,107, 77,111,103, 59,161, 56, 55, 61, 79, 81,183,110,135, 55, 52, 50,149,165,179,117,120,120,248,214,147,215, 99,  9,129,
+128,203,229, 80, 20,221,178,190,143,157,187, 45,101, 43,  5,108, 19, 94, 62,187, 58,100,200,144,250,147, 38, 77,106, 85,  5, 76,
+ 20, 15,184,216,182,109, 27,  8,130, 32,171,146,247, 15, 40,167, 43, 34, 89, 44,203,130, 32,136, 29,165,  6,149, 29,197,247,238,
+148, 34, 91,156,138,202,211,162, 77,181,144,170,193,131,  7, 15, 52,153, 76,156, 82,157,196,155,  4,166, 44, 18, 99, 85,222,149,
+ 74,229, 73,  0, 31, 19,  4,  1,189, 86,171,255,249,151, 95, 74,255,249,246, 27, 36,235,116,121,109,201,104, 52,194,108, 54,115,
+238,220,185, 67,151,170,235, 52,  0, 49,  0,123,150,101, 65,146,228,125, 43,202,211, 87, 36, 18, 93,141,136,136,176,105,212,168,
+ 17,193,227,241, 96, 50,153,240,224,193,  3,247,159,126,250,105,228,233,211,167, 63, 85,171,213,126,120, 59,120,186, 53,223,200,
+255,210,165, 75,106, 47, 47,175, 50,137,163, 74,165,226,248,248,248,124, 84, 14, 41,250,171, 49, 19,211,210,210,122,124,252,241,
+199,163, 82, 83, 83,163, 77, 38,211,119,  0,  2,236,237,237,239,244,234,213, 11, 66,161, 48,180,176,176,112,217,251,212,121, 71,
+ 71,199,238,205,155, 55,199,202,149, 43,241,211, 79, 63,181,  7,112,  6, 64, 59,149, 74,117,186, 91,183,110,144,201,100, 61,114,
+115,115, 55,191, 71, 59,242,105,221,186,245,250, 31,127,252, 81,122,228,200, 17,120,123,123, 35, 63, 63, 31,223,126,251,173,227,
+ 15, 63,252,112, 62, 55, 55,183, 77,169,118, 81, 30,166, 31,159,207,223,188,115,231, 78,137,151,151,151, 23,151,203, 37,189,188,
+188,144,157,157, 13,173, 86,203,159, 55,111, 94,125,161, 80,248,231,178,101,203, 54,  3,232, 85, 73, 58, 73,  0,115,215,174, 93,
+ 59,106,196,136, 17,178,129,  3,  7,154,245,122, 61,246,236,217,  3,138,162, 64,211, 52, 68, 34, 81, 73,240,106, 46,151,139,186,
+117,223,114,146,126,184,130,252,230,161,200, 14, 85,134,170, 45,187,158,174,  0,175,100,233,131,166,105,  8,  4,  2,  8,  4,  2,
+240,249,124, 60,121,242,100,134, 64, 32, 88, 66, 16,132,201, 26, 76,226, 63,236, 34, 16,192,205,202,174,241,182,105,200,223,217,
+127, 90,196,141, 32,136,165,  0, 66,139,134, 93,242,130,189,189,253,248,180,180,180, 56,107, 49,149, 74,165, 93, 86, 86,214, 50,
+165, 82,  9, 39, 39,167,146,241,219,213,213, 21, 70,163, 17,105,105,105, 96, 89, 22,185,185,185, 16,137, 68,112,113,113, 89, 54,
+ 98,196,136,125,235,214,173,203, 42, 19,147,193, 79,221,250, 78,159, 73, 81, 20,  9,  0, 20, 71, 34,249,122, 42, 80,179,102, 77,
+180,108,217, 18, 90,173, 22,121,121,121,240,247,247,231, 16,  4, 17, 78, 16,132, 13,203,178,171,  1,156,253, 31, 84, 20,150,107,
+ 12, 63,251,205,117, 81, 75,180,120, 46,151,107, 21,209, 42,126,190, 50, 13, 10,105, 52, 26,193,229,114, 95,211, 72, 16,  4,  1,
+179,217,252,218,125, 11,209,122, 23,162, 62,102,204, 24,102,253,250,245,163,114,114,114,214,224, 29,151, 18,194,195,195,223,178,
+247,152, 48, 97, 66, 98,122,122, 58,251, 89,135, 64,113,244,177,228,148,218,114,137,208, 65, 42,173, 37,144, 43,100, 89, 89, 89,
+215,138, 59, 19,107,165, 78,195,134, 13,133, 91, 14, 92, 74, 28,254,205,130, 57,141,188,236,108, 26,184,217,203,157,109,133, 60,
+  9, 73,168,  5, 38, 99,162, 66,161,240,174,106,186, 45,253,130, 72, 36,  2, 73,146,255, 36,141, 22,199, 66,178,178,179,179,113,
+228,200, 17,116,238,220,249,142,133,132,168, 84, 42,164,164,164, 64,169, 84,222, 41,214,124, 84,186,140,200, 48, 12, 12,  6,  3,
+ 12,  6, 67,  9,129, 41, 85,135, 74,  8,140,229, 89,138,162,238,191, 99,218,231,200,229,242,214,161,161,161,188, 93,123,246,240,
+ 88,150, 85,163, 40,134, 90,  1,203,150, 19, 32,251, 13, 49,153, 76, 37, 90, 54,154,166, 17, 31, 31, 95, 50,112, 89, 98, 75, 10,
+  4,  2,235, 84, 25,124,254,196,221,187,119,219, 52,105,210,132,200,202,202,  2,195, 48, 37,157,228,111,191,253, 38,232,221,187,
+183,107, 84, 84,212, 52,157, 78, 55,251, 29,242, 74,148, 71,136,  0,192,198,198,198,  4,235, 60,102, 87,138,105, 50,153,136, 22,
+ 45, 90, 76,202,204,204,172, 95, 88, 88, 56,207,154, 98,  4,112, 56, 49, 49,177,244,192,254,103,116,116,116, 97,159, 62,125,132,
+181,106,213, 10,121,244,232,209,123, 85, 82, 31, 31,159,102, 52, 77,227,198,141, 27, 58,  0,150,153,245,133,123,247,238,233,122,
+245,234,197,119,119,119,111,150,155,107,181,201,138,143,175,175,239, 41, 71, 71, 71,161,165, 15,117,112,112,160,215,173, 91, 39,
+ 77, 74, 74,130,193, 96,192,148, 41, 83,208,165, 75, 23,216,219,219, 99,194,132,  9, 78,139, 22, 45,218, 94, 80, 80,208,176, 34,
+165, 53,143,199,219,250,252,249,115,111,165, 82, 41,188,126,253, 58, 26, 52,104,128,204,204, 76,164,166,166,162,160,160,  0,169,
+169,169, 24, 54,108,152,227,175,191,254,234, 98,133, 38,171,132,100,173, 91,183, 46,119,255,254,253,212,239,191,255, 46,165,105,
+186,132,104,113, 56,156, 18,162,101,137,173,248, 14, 43, 13,185,197,164, 77,150,151,151,247, 62,118,110,124,  0,188,210, 36,139,
+207,231,131,207,231, 67, 32, 16,188, 87, 92,214,127,137,184, 18,  4,241,136,203,229,242, 69, 34, 17,151, 36, 73,240,249,252, 14,
+ 10,133,226, 97, 64, 64, 64,192,169, 83,167, 98,173,  1,209,106,181, 91,249,124, 62,237,232,232,  8,  0,240,246,246, 70,131,  6,
+ 13,160, 86,171,153,188,188, 60,200,100, 50, 50, 46, 46, 14,133,133,133, 72, 73, 73,129,135,135,  7, 77,146,228, 86, 20,217, 33,
+191, 37, 87,239,164,174,  1,176,198,114,109,111,111,159, 86, 90,211, 41, 16,  8,224,234,234,138,164,164, 36, 72,165, 82,234,135,
+ 31,126,232,181,103,207,158,158, 87,175, 94, 13,  7,176,173, 20,212,236,127,177,141,150,133,100,149, 62,255,135,104,117,233,210,
+101, 86,100,100,228, 71,101,205,194,105,154,254, 96,182, 46, 22, 66,101, 99, 99,243,166,214, 10, 12,195,148,167,209,170,242,239,
+  8,  4,  2,225,232,209,163,243, 87,175, 94, 93,101,178, 21,182, 50,186, 68,139,245,214, 52,210,207,239,234,180,105,211,186,159,
+ 59,119, 46,169,145, 87, 45,142, 56, 57,174, 64, 96, 35,147,193,173, 70,231,193, 61,122,221, 67,209,238, 67,107,229,121,126,126,
+190,176,182,155, 72, 79,146, 90,162,  6,159, 35, 85,138,185,124,103,185,220,149,171,215,165,219,200,229, 60,157, 78,151,139, 10,
+130, 64,  3,128,147,147,211,  9,161, 80,232, 97,185,150,203,229,182, 44,203, 66, 36, 18, 65,169, 84, 74, 40,138,122, 90,170,113,
+197,165,165,165,117,168, 44, 97, 50,153,236,  4,159,207,247, 32, 73, 18,  4, 65,128,162, 40,144, 36,  9,146, 36, 75,254, 79, 81,
+ 20,  8,130,128, 70,163,137,139,141,141,237, 96, 69,126, 77,  0,130,  9,130,184,115,228,200, 17,132,132,132,224,216,177, 99,232,
+216,177, 35,242,242,242,240,224,193,  3,180,110,221, 26, 40, 90, 82,180, 74, 74, 27,191, 91, 38,  5, 79,158, 60, 41, 33, 46,165,
+ 15,169, 84,250, 62, 42,246,203, 97, 97, 97, 88,191,126, 61, 91, 60,153, 16, 19,  4,209,192,214,214,246,201,227,199,143,173,178,
+131, 97, 89, 22,  6,195,127, 30,181, 12, 94,197,246, 16, 85, 10, 14, 76, 81, 84,135,134, 13, 27, 18,121,121,121, 22,  2,  9, 14,
+135,  3,138,162, 64, 81, 20, 86,173, 90, 37,108,210,164,201,116, 62,159, 63,137,203,229,170,140, 70,227, 46,173, 86, 59, 15, 64,
+238, 63,169, 71,106,213,170,213, 55,  9,  9,  9, 93, 60, 60, 60, 34,222,  3,134, 53, 26,141,122,  0, 66,138,162,232, 15,208, 71,
+ 81,197,117, 75, 91,138,236,155,138,175,249, 40, 90, 38,182, 74,236,237,237,183, 31, 61,122,212,205,195,195,  3, 70,163, 17, 38,
+147,  9,  5,  5,  5,184,112,225,  2,116, 58, 29, 76, 38, 19,188,189,189, 49,115,230, 76,237,248,241,227,  5,107,215,174, 77, 47,
+ 40, 40, 24, 80,  9,236,248,125,251,246,137,149, 74,165,176,176,176, 16, 47, 95,190, 68,195,134, 13,145,159,159, 15,181, 90, 13,
+141, 70,  3,131,193,  0,149, 74, 37, 51,155,205,250, 74,176,102,148, 38, 89, 35, 71,142,188,207,227,241, 26,142, 29, 59, 22,137,
+137,137, 37,109,126,248,240,225,112,114,114, 42,105, 75,197,125,114,149, 58,102, 14,135,  3, 62,159, 15, 46,151,155, 91,163, 70,
+ 13, 16,  4, 33,136,139,139,123,151,165, 56, 27,  0, 42,154,166,121,165,  9, 22,159,207,199,141, 27, 55,166,241,120,188,242,180,
+ 89,229,181, 75,182, 42,215,255,109, 33,  8, 98, 41,151,203,229, 43, 20, 10,110,169,  9, 39, 87, 34,145,192,209,209,113, 37,128,
+ 78, 86,230, 59, 72,161, 80,148,244,239,129,129,129, 72, 72, 72, 56,152,151,151, 55, 40, 61, 61, 29, 36, 73,110, 37, 73,178,167,
+101,146,154,147,147,  3,119,119,247,160,242,240,154,  7, 59,143,  2,193,190,166,209,122, 99,130,  6, 27, 27, 27,196,196,196, 64,
+173, 86,179,207,158, 61, 35, 70,143, 30, 77,232,245,250, 77, 81, 81, 81,215, 80,180,219,190, 92, 46,242, 47,145,170,219,104, 89,
+ 52, 90,214, 14,  0,  4, 65, 84, 58,155, 48, 26,141, 18,127,127,255,178, 12,190,136,178,136, 86,241,114,210, 59, 85,116,154,166,
+165,239, 74,182,222,148,136,253, 59,157,126,154, 57,101,166,194,165, 86,237, 73,147,102,112,186,118,237,122,125,203,150, 45,102,
+ 69,189, 78,237,206,158,216,230,180,236,219,201,199,142, 30, 61, 10, 20, 25, 70, 91, 43,151, 35, 35, 35,157, 39,140, 27,131,153,
+ 19,199, 31,183,241,182,231, 73,  8,133, 88,160, 83,103, 72,192, 22,242,235,248,118, 57, 16, 17,145,  2, 32,170, 34, 16,145, 72,
+228,241,232,209, 35,239,210, 27,  9,244,122, 61, 68, 34, 17,206,158, 61,235, 32, 20, 10, 29,  0,160,176,176, 16,  1,  1,  1,214,
+106, 76, 60,158, 62,125,234, 45,149, 74,161,209,104,160,211,233, 96, 52, 26,193, 48, 12,  8,130,  0, 77,211,224,241,120, 16,139,
+197, 85,221,217,119, 23,192,231,157, 59,119,222,113,236,216, 49,248,251,251, 35, 39, 39,  7,209,209,209, 22,146, 85, 37, 27, 45,
+139,150,168,180, 61, 22,135,195,193,118, 47, 47, 12, 79, 78, 46, 33, 48, 75,109,109, 49,147,121,183,104, 26,  1,  1,  1,236,229,
+203,151,113,252,248,113,116,235,214,141, 56,116,232,144,193,108, 54,115,147,147,147,239, 39, 39, 39, 91,133,193, 48, 76, 73, 90,
+ 45,253,118,105,130, 85, 85,162,101, 50,153,164, 60, 30, 15, 90,173, 22, 22,205, 67,233,195,211,211, 19,217,217,217, 28,149, 74,
+197, 73, 78, 78, 22,205,157, 59,119,236,249,243,231,149,249,249,249,253,255,155,189,208,234,213,171, 61,134, 15, 31, 30,207,225,
+112,216,142, 29, 59, 14,140,139,139,235,161, 84, 42,207,156, 59,119,238, 23,  0, 62, 85,197,179,183,183,191,205,225,112,220, 84,
+ 42, 21,119,239,222,189,198,252,252,124,174,131,131, 67,154,165,239,176,148,181,209,104,180,106,231,178,189,189,253,237,204,204,
+ 76,238,138, 21, 43,140, 89, 89, 89, 92, 39, 39,167, 52, 11, 78,110,110, 46,119,239,222,189, 70,149, 74,197,181,181,181,189,157,
+151,151, 87, 41, 94,102,102,230,128,240,240,240, 75,103,206,156,177,167, 40, 10,113,113,113,200,202,202,130, 76, 38,195,214,173,
+ 91,225,225,225,129,125,251,246,101,103,103,103,127,241,243,207, 63, 79, 47, 38, 89,149,217,104,181, 14,  9,  9,241,200,205,205,
+133, 76, 38,131, 90,173,198,237,219,183,225,231,231,135,228,228,100,144, 36,  9,153, 76,134,223,126,251, 77, 67, 16, 68,118, 69,
+ 64, 66,161,176,199,136, 17, 35,100,  0, 48, 98,196,  8,217,136, 17, 35,202, 28,224,154, 53,107,134,149, 43, 87,190, 73,180,170,
+ 50, 49, 40,209, 58,149, 34, 71,218,166, 77,155,226,252,249,243,147,171, 72,142,244, 22,210,246,166, 54,139,207,231, 87,121, 51,
+ 13,195, 48, 92, 20,153, 52, 16,214, 92,255,  3,228, 35,161, 80,200,125,243,166, 70,163,225, 42,149,202, 86, 85, 32,190,118, 66,
+ 97,145,194,201,195,195,  3,121,121,121,102,189, 94,223,247,255,218,187,206,240, 38,174,180,123,102, 70,189, 88,238, 21,  3,  6,
+  2,152, 14,166, 99, 58, 14, 16, 32, 75, 18,218, 38,212,133,152, 16,216, 44, 36, 11, 36, 31,201,134, 56,148, 64, 96, 33,129, 16,
+240, 66, 48, 16, 72, 66, 11, 29, 66, 89,140,  9, 53, 54,  4, 55,108, 76,115, 47,178, 44,217,146,101,149, 25,205,247,195,146, 34,
+ 27, 23,201,150, 41, 89,157,231,153,199, 26,207,232,232,206,157, 91,206,125,239,123,223,187,103,207, 30, 35,  0,132,133,133, 77,
+ 97, 24,166,130,166,105,138,207,231, 67,163,209,192,207,207,207,187, 14,219,232,210,163, 63,172,  8,168,238,163, 21, 24, 24,136,
+176,176, 48,232,116, 58,228,229,229, 33, 54, 54,214,200, 48,204,222,111,191,253,214,228,235,235,251,183,  9, 19, 38, 80,241,241,
+241, 11,  0, 44,170, 77,139,188, 96,214,172,232, 90,133,150, 89, 65, 94,  4, 48,180,250, 67, 86, 23, 63,117,  9,173,250,166, 14,
+249,124,190, 50, 51, 51, 83, 98,219,169,208, 52,141,160,160, 32, 19,203,178, 68, 77, 66,171, 49,166, 96, 46,151,235,246,209, 71,
+ 31, 41,191,253,246,219,169, 15, 31, 62, 92,110,207,119,246, 47,232,128, 93,213, 68,214,214, 53, 81,155, 55,173, 89,225,149,113,
+122, 39,182,127,189,142, 97, 24,196,119,237,218,117,144, 90,173,230,184, 75,140,144, 43,113,202, 44,178,236, 21,133, 36,128,239,
+110,220,184, 17, 63,102,204,152, 95,191,251,241,144, 87,238,253,251, 87,  5,165,242, 60, 89,219,118, 28, 94,179,150,175,151, 85,
+ 84,240,166, 76,153,226, 11, 96, 66,125,141,152, 82,169, 68,126,126,126,117,  1,134,187,119,239, 62,113,175, 93,137, 35, 73, 48,
+ 12,131,131,  7, 15, 66, 44, 22, 67, 34,145, 84, 57, 44, 34,171,129, 11, 21,210,  0, 96,244,232,209, 80, 40, 20,144, 74,165,118,
+167,171,186,120, 97, 89, 22,122,189, 30,122,189, 30,  6,131,129,  1,192,229,112, 56,152,157,157,109,181,242, 56, 34, 96,170,163,
+107,215,174,236,149, 43, 87,240,235,175,191, 66,163,209, 96,211,166, 77,  8, 12, 12, 28, 14,224, 19, 71,185,108,156,244,153,210,
+210, 82,110,105,105,169,213, 58,200,229,114,173,214,  3, 59, 45,121, 60, 14,135, 99, 29,141, 90, 14, 91,171, 22, 69, 81,240,247,
+247, 71, 64, 64,  0,182,110,221,202,107,213,170,213,184,103,217,  2,173, 93,187,182,237,198,141, 27,119,236,218,181,235,212,212,
+169, 83,127, 74, 76, 76,156,229,238,238,126,231,194,133, 11, 43,  4,  2,129,169,129,245, 59, 56, 55, 55,215,207,246, 95, 38,147,
+ 73, 76,211,180, 85,216,150,151,151,219, 61,192,224,114,185,193,201,201,201, 98,  0, 88,177, 98,  5, 23,128,216,226, 12,110,225,
+ 44, 47, 47,231,118,234,212, 41,216,222,178, 30, 23, 23, 55, 40, 34, 34,226,202,217,179,103, 61, 91,182,108,137,156,156, 28,228,
+228,228,160,109,219,182, 88,181,106,149,166,180,180, 52, 28, 64,154, 90,173, 62, 98, 39,103,144,167,167, 39, 55, 51, 51, 19, 52,
+ 77,163, 71,143, 30,216,178,101, 11,166, 76,153,130, 46, 93,186,160,180,180, 20,201,201,201,136,137,137,241,228,241,120,117,182,
+ 29, 90,173,246, 72,116,116,116,243,234, 22,173,105,211,166, 73, 10, 10, 10,172,101, 50, 42, 42,170,202, 20,162, 35,109,178,121,
+106,171,214,163, 33,160,105, 90, 38, 20, 10, 75,  5,  2,  1,223,226,159, 21, 27, 27,235,176, 53,171,218,  0,208,145,243,103,  6,
+139,104,173,161,111, 69, 64, 64,128,221, 60,  2,129,128,176,180,141, 52, 77, 67,165, 82, 49,129,129,129,214,233,253,132,132,  4,
+ 38, 36, 36,132,161, 40,138,226,243,249, 32,  8,  2, 98,177,184,214,  6,159,101,216,168, 87,167,124, 82,101,213,225,194,143,  0,
+131,193,128,132,132,  4, 24, 12,  6,196,198,198, 26,191,252,242,203, 92,165, 82,185, 16,  0,231,204,153, 51, 51,150, 44, 89, 66,
+249,249,249, 69, 20, 22, 22,162, 62, 45,242,  2,137,173, 39,172, 92,150, 94,232,226,184,113,227,  8,243,210, 74,194, 34,156, 28,
+ 17, 90,230,202, 87,111,207, 75, 16,  4,242,242,242,172,231,126,126,126, 14,255,150,189,240,246,246,214,244,239,223,223, 77, 46,
+151, 31, 89,187,118,109,131, 44, 89, 91,215, 68,109, 94,253,249,167, 94,138,148,107,200,206,205,131,162,208, 24,127,249,206,195,
+195,  0, 14,  3,  0,182,117,188, 72,188,147,250,141,189,156, 29,124, 68,221,185, 60,206,225,151,199,140,107, 62, 57,114, 17,249,
+238,187,239, 14,156, 49, 99,134,106,234,212,169,239, 73,165,210,246,  6,131,161,228,208,137, 19,143, 38, 79,158,220,138, 97,152,
+ 25,168, 39,230,136, 86,171,125, 60,116,232, 80,219,252,148,157, 59,119,206,255,209,163, 71,152, 63,127,126, 81, 78, 78,142,210,
+246, 94,123,210,104, 48, 24, 30,119,239,222,189,214,233, 66,203,148, 34,  0,148,149,149, 61,118, 32, 75,223,132,217,241,189,184,
+184, 24,119,239,222,  5,135,195, 65,191,126,253,112,249,242,101, 12, 28, 56, 48,193, 17,171, 86, 69, 69,  5, 90,182,108,137,138,
+138, 10,104, 52,154,114,  0,130,221,173, 90,  1,  0, 22, 20, 23,227,183, 47,191,196,181,213,171, 97, 91,158,237, 69,183,110,221,
+216,107,215,174,225,206,157, 59,208,233,116,152, 51,103, 14,  0, 16,230,178,235, 72,200,140, 54, 20, 69,141, 30, 51,102, 76, 16,
+  0,104, 52, 26,226,198,141, 27, 16, 10,133,214,186,112,236,216, 49,228,228,228,128, 32,  8,120,122,122,  6,151,148,148,180,  2,
+240,176, 14,179, 63,241,240,225, 67,124,241,197, 23, 48,153, 76, 88,178,100,  9,218,181,107,103, 21, 88,143, 31, 63,198,138, 21,
+ 43,192, 48, 12, 62,253,244, 83,180,109,219, 22, 70,163, 81,136,  6,134,208,112,  6,222,127,255,253,140,195,135, 15,159,202,202,
+202,122,101,205,154, 53, 67,  8,130, 48, 45, 94,188,248, 11,153, 76,198, 52,134,183, 68, 85,134,187,247, 30, 91,133, 80,245,195,
+215,199,203, 97,190,244,251, 89,214,239, 51,140, 45, 31,  3,111, 47, 79, 71,147, 88,110, 52, 26, 53,175,191,254,186,199,193,131,
+  7,137,182,109,219,226,193,131,  7, 22,203, 80, 57, 28, 15,233,144,163, 80, 40,218, 81, 20,197,187,119,239, 30, 66, 66, 66,208,
+183,111, 95,172, 92,185, 18,114,185, 28, 52, 77,195,207,207,207,100, 52, 26, 19, 12,  6,195,165,122,184,162,230,206,157,203,  3,
+240,142,217,178,213,117,225,194,133,166,117,235,214, 33, 33, 33,193,106,193,178,117,134,119,116,234,208,214,234,100,123,196,198,
+198, 46,225,243,249, 44,128,235,112, 60,208,179,190,186, 69,171, 33,214,172,166, 66, 83,174,100, 12, 12, 12,140,117,115,115, 27,
+ 87, 82, 82, 82,197,170, 21, 30, 30,110,240,247,247,143,179,151, 71, 42,149,150, 80, 20,229, 13,  0, 57, 57, 57,144, 72, 36,188,
+251,247,239,175, 70,101,240,108,180,106,213,106,181, 66,161,224,181, 50,183,167,  1,  1,  1,208,235,245,181,186,177, 92,189, 85,
+176, 19,192, 78,203,185,151,151, 87,158, 74,165, 18,173, 91,183, 78,189,122,245,106, 45,195, 48, 58,  0, 23,148, 74,165, 53,142,
+ 86,126,126,190,138,203,229,122,121,120,120, 52,179,  8,173,154,180,200, 11,134,218, 45, 90,102, 37,201, 86, 23, 68,  4, 65, 60,
+225,160, 94,143,208,170, 87,100, 49, 12, 83,197,202, 96,113,120,175,233,183,204,157,122,131,166, 14,205, 34, 75,120,232,208,161,
+221,107,215,174,189,110,239,247,108,125,180,182,173,255,124,141, 69,100,253,254,235, 89, 28, 73, 85,201,151,172,222,176,177,161,
+111,160,163,143,184,155,191,191,247,197, 47, 87, 69,201, 50, 78,199,224,167,109,255,102,127,191,121,179,207,205,155, 55,167,207,
+159, 63,191,133,185, 96, 41,  0,220,  6, 48, 25,118,172,210,201,201,201, 25, 85,173, 19, 78,227,241,120,254, 98,177, 24, 57, 57,
+ 57,234,244,244,116,135,167,100,228,114,249,168, 38, 40,128, 28,139,200,146,203,229, 72, 78, 78,198,176, 97,195,  0,  0,151, 47,
+ 95, 70,120,120, 56,226,227,227,209,179,103,207,  4,  0,189, 81, 79,160, 86,163,209,168,236,216,177,163,213,186,165, 82,169, 76,
+  0, 16,153,151,135,232,192, 64,112, 56, 28, 92, 91,189, 26,203,140, 70,172,116, 80,192,119,239,222,157,189,113,227,  6, 30, 61,
+122,  4,154,166, 49,126,252,120, 52,176,210,119,233,208,161,195,185, 11, 23, 46,248, 74,165, 82,104, 52, 26,168,213,106,204,156,
+ 57, 19, 83,166, 76,129, 78,167,195,254,253,251,113,244,232, 81,184,185,185, 65,163,209, 64,163,209,120,142, 29, 59,246, 74, 90,
+ 90,218, 96,  0,247,106, 17, 90,236,168, 81,163, 16, 23, 23,  7,138,162,208,167, 79, 31, 20, 23,255,177, 24,200,223,223,191,166,
+107,212,179, 20, 90, 28, 14,135,141,141,141, 93, 51,100,200, 16,100,101,101,189,210,179,103,207, 77,179,102,205,202,105, 44,175,
+167,187, 27,186,119,106,  3,157, 78,  7,157, 78,135,160,160, 32,148,149,149, 33, 35, 35,  3, 58,157, 14,254,126, 30, 14,243,133,
+117,105,107,229,243,243,243,131, 70,163,193,195,135, 15,161,215,235,225,227,227,144,208,106, 62,106,212,168,255,238,221,187,215,
+ 59, 38, 38, 70, 63,116,232, 80,254,166, 77,155,  8,153, 76,  6,155,142,197, 81,196, 94,190,124,185,101, 68, 68, 68,104, 74, 74,
+ 10, 98, 99, 99,161,215,235, 17, 22, 22,134,244,244,116,244,239,223, 31,106,181,250,250,205,155, 55,143,218, 99, 24,  6,240,241,
+220,185,115, 97, 17, 91,113,113,113,200,203,203,131,155,155,219, 19, 66,203,226,251,104, 94, 53, 30,100, 79, 98, 45,130,200,198,
+242,180,204,195,195,195,  0, 96, 99,  3,173, 79,  0,128,172,172, 44, 65,215,174, 93,117, 66,161,144,111, 22,109, 27, 26,195,231,
+ 76, 56, 97, 37, 99,173,  8,  8,  8, 88,232,227,227, 19,209,186,117,107, 20, 20, 20,240,248,124, 62,194,195,195, 13,189,123,247,
+ 54,  4,  4,  4, 44,176,151, 71, 32, 16,164,240,120,188,193,149,131,  9,  6,153,153,153, 96, 89,118, 73,151, 46, 93,254, 81, 86,
+ 86,134,226,226, 98,190, 76, 38,179, 14,170, 67, 67, 67,161,211,233, 82, 28,176,188, 69,133,132,132,124,204,227,241, 86,202,229,
+242,154,194, 66,240, 61, 60, 60,100, 60, 30, 15,  6,131,161,138,216,172,174, 69, 94,116,145, 85, 69,104,217,168,200, 42, 66,199,
+ 17,139,150, 61, 86,  3,139,131,189,237,185, 69,212, 85,255,173,134,198,208,114,119,119,215, 89, 68,214,202,149, 43,175, 55,132,
+227,192,222, 61,129,238,166,242,230,185,215, 79, 34,237, 78, 60, 14, 39, 43,229, 75, 86,111,120,239,213,  9,111, 22, 84, 23,102,
+246,160,157,175,184,139,191,159,247,197,245,107, 87,203, 20, 41,215,144,151,159,143,147,215,111,198, 27,128,100,  0, 75,156,105,
+ 90,  6, 42,167, 14, 41,138,122,158, 10,172,213, 25, 62, 47, 47,207, 34,178,194,  0, 96,224,192,129,  9,102,145,  5,123, 45, 90,
+ 74,165,178,250,150, 53, 17,  0,124, 44,207,207,225,112, 16,254,241,199, 14,139, 44,  0,108,124,124, 60, 20, 10,133,101,164,216,
+ 80,145,133,128,128,128,127, 94,184,112,193,247,187,239,190, 43,221,181,107, 87,177,201,100,226,118,239,222, 61,184, 87,175, 94,
+196,238,221,187,  1,  0,147, 39, 79,198,146, 37, 75,144,148,148,  4,137, 68,130,129,  3,  7, 50,203,151, 47,247, 91,184,112,225,
+130,130,130,130,247,106,236, 29, 77, 38,158, 80, 40, 60, 15, 96,120, 74, 74, 10,  0, 92, 65,229, 22, 78, 22, 43, 66,173,215,236,
+233,124,203,202,202,184,110,110,110, 53,134,134,224, 85,142,134, 28,181, 64, 88, 57,127,253,245,215, 47,214,175, 95,127,248,131,
+ 15, 62,184,215, 72,206, 26, 45, 90,227,198,141,131, 86,103, 64,118,129, 10, 12, 67, 67,107, 40,116,152,207,214,162, 53,110,220,
+ 56,148, 87,232,145,153,167,  0, 77, 51, 40,211,218,221,151,139, 95,126,249,229, 51, 63,252,240, 67,192,213,171, 87,193, 48,140,
+ 41, 61, 61,253,225,235,175,191, 46, 91,188,120,177,119, 35, 22, 25,125,253,230,155,111, 78,252,245,215, 95, 21,161,161,161, 94,
+215,175, 95, 71, 97, 97, 33,104,154,198,240,225,195,193,231,243, 51, 87,175, 94,205,  3,240,181,189,239,198, 44,182, 12, 55,111,
+222,124,251,218,181,107, 94, 94, 94, 94,124, 83,135, 14,200, 59,123, 22,  7, 15, 30,124,226, 11,219,182,109,  3,236,140,194,111,
+177, 56,221,184,113,195, 41,  2,171, 74, 79,205,231, 55,120,250,241, 69,197,141, 27, 55,114,222,125,247,221, 78, 50,153,108,227,
+160, 65,131,134,121,123,123,147,158,158,158,177,205,154, 53,251, 71,247,238,221,237,158, 93,224,114,185,179, 36, 18, 73,  6, 77,
+211,148, 90,173,134, 70,163,169,108,164,105,154, 79,146, 36, 90,181,106,101,237, 75,250,244,233,131,128,128,  0, 38, 53, 53,117,
+150,189,252, 69, 69, 69, 85, 86, 33,214,128,185,225,225,225, 28,157, 78,135, 71,143, 30, 93,182,189, 80,147, 22,121, 65, 16, 89,
+167,248,178, 60,148,237,195, 53,107,214, 44,203,104, 52,178,201,  0,123,251,246,109, 54, 50, 50,178,206,163,162,162,130,245,243,
+243,203,171,161,243,131, 45,167, 78,167,171,242, 61,157, 78,199,250,251,251, 51, 90,173,246,  9, 78,173, 86,203,  6,  7,  7,231,
+212,197, 89,  3,102,222,186,117,235,219,101,203,150,245,117, 32,131,172,156,236,214, 14,108, 76, 76,204, 95, 89,150, 29, 50,168,
+ 83,203, 59,147,186,251,179,225,237,252,114,143, 30,216, 59,133,101,217, 33,213, 15, 75,128,211,186, 56, 59,248, 75, 58,142,232,
+220,162,228,247,211,251,216, 11,235,254,206,174, 31,223,142,237, 25,236,166,236,224, 35,114,116,143,152,122,119, 75,239,220,185,
+115,154,201,100, 98,245,122, 61,219,185,115,231,116,103,112, 54,  0,117,113,246, 64,165, 47,219,155, 53,252,175, 71, 35,210,249,
+ 59,203,178,172, 66,161, 96,213,106, 53,171,211,233, 88,134, 97, 88, 91,  0,248,221, 14, 78,214, 96, 48,176, 37, 37, 37, 44,236,
+247,185,171,145, 51, 48, 48,240,225,253,251,247,217,151, 94,122, 41,203,108,142, 95,168,209,104,216,234,208,104, 52,236,176, 97,
+195,216,244,244,116, 54, 36, 36,164, 34, 61, 61,157, 13, 12, 12,188, 91, 79, 58, 91, 55,111,222,252,188,143,143, 79, 44,128,118,
+ 14, 92,171, 51, 63,247,239,223,223,134,101,217, 57, 44,203, 70,214,114,204,119,133,129,130,  0,  0, 32,  0, 73, 68, 65, 84, 97,
+ 89,182,195,179,230, 52,231,111,  1,203,178,108,121,121, 57,171, 80, 40,216,220,220, 92,182,188,188,156, 85,171,213,236,173, 91,
+183,216,171, 87,175,178,119,238,220, 97,189,188,188, 10,236,225,180,240,233,245,122,182,180,180,148, 45, 44, 44,100,181, 90, 45,
+171,209,104,216,196,196, 68,246,183,223,126, 99, 83, 82, 82,106,226,123,130,211,219,219,123, 91,126,126,190,250,202,149, 43,229,
+ 91,183,110, 45, 15,  8,  8, 72,  1,208, 18, 64,123, 79, 79,207,252,191,255,253,239,172, 84, 42,125,220,192,122,212,137,203,229,
+222, 90,179,102,205,141,227,199,143, 23, 28, 61,122, 84,191, 99,199,142,236,249,243,231, 95,226,112, 56,183,  0,116,106, 96, 61,
+242,243,240,240,184,114,253,250,117,186,164,164,132, 85, 42,149,108,105,105, 41,171,209,104, 88,173, 86,203,234,245,122,214,104,
+ 52,178,151, 46, 93, 98,253,253,253,109,167, 37,151,214, 49,176, 94,196,178,236, 63, 89,150,229, 56,187,173,179,225, 30,228, 44,
+ 78,103,180,117, 36, 73, 26,204,109, 71,191,202,211,186,207,159, 85, 58, 71,140, 24,241,233,148, 41, 83,216,209,163, 71,179, 97,
+ 97, 97, 79, 28, 61,123,246,100,231,205,155,199, 30, 63,126,156,253,242,203, 47, 63,117, 66, 58, 57,168, 92,244,178,106,196,136,
+ 17,198,184,184, 56,118,242,228,201, 44,128, 81,117,105,145, 63,131,224,178,132,119, 32,108,255,  2,128,193, 96,200, 74, 75, 75,
+ 11, 12,165,105, 10,  0,190,249,230,155, 39, 44, 83,182,136,139,139,163,  9,130,200,168,235,215, 13,  6, 67,214,133, 11, 23,252,
+ 55,111,222,204,181, 49,  1,131,166,105, 83,110,110, 46,185,105,211,166, 42,247, 95,188,120,145,166,105, 58,211,193,135,140,233,
+209,163, 71,140, 51,114,235, 82,210,163,127,156, 57,249,179, 79,191,190,131,148, 50, 47,175, 26, 71, 97,251, 23,116,  0,241, 78,
+221, 86, 45,130, 67,174, 92,179, 42,202,195, 50,  5,249, 99, 66,190,178, 66,199, 12, 75,149,107,127,119,246, 27, 86,171,213,143,
+ 44, 43,  1, 53, 26, 77,230,115, 88,  8,111,161, 50,198, 21, 93,237,127,189,209, 72,167, 83,147,201,  4,119,119,119,171, 53,180,
+  1, 22, 81,214, 98, 97,181,188,186,198,164,135,101,217, 95, 19, 19, 19, 67,102,206,156,233,182,107,215,174,251, 12,195,112,103,
+207,158,109,  8,  8,  8,224, 93,190,124,217,  8,128, 24, 50,100,  8, 39, 63, 63,159,205,201,201, 81,252,229, 47,127, 41,123,251,
+237,183,189,111,223,190,205, 55,153, 76,245,  5, 45,124,144,149,149, 53,162,  1,215,234,196,164, 73,147,238,163,241,219,216, 52,
+ 57,167,  5, 10,101, 41,238, 63,202, 49, 71, 48, 55,129,121, 92, 96,245,171, 50, 26,105, 40, 74,139, 29,182,104,101, 60,204, 49,
+111, 49,198,128, 97,114,205,124,149, 14,241,108, 73,121,253,189,  9,135, 51,112,249,242,229, 99, 72,146, 36,175, 93,187,166, 91,
+187,118,109, 86, 81, 81,209,120,  0,153,  0, 80, 82, 82, 50, 52, 38, 38,230,123, 59, 66, 57,212,134,100,163,209,216,127,233,210,
+165,239,  1, 24,  8,160,133,153,251,178,217,146,213,208,  8,230,133, 74,165,114,228,152, 49, 99,206, 82, 20,213,202,166, 30,249,
+  0,144, 91,234,  5,203,178,126,  5,  5,  5,175,216, 67, 72, 16,196,134,166,106, 72,154,146,187,145,237,208, 11,177,146,241,252,
+249,243,159,141, 31, 63,158,211,178,101,203,255,107,217,178, 37, 89, 82, 82,  2,181, 90, 13,146, 36, 17, 16, 16,128,206,157, 59,
+ 35, 32, 32,192,148,146,146,178,234,195, 15, 63,172, 55, 38, 95,199,142, 29,219, 24,141,198,151, 72,146,108,  3,160, 13,203,178,
+109,  8,130,104,  3,192, 11,  0,100, 50,153, 44, 36, 36,132,211,175, 95, 63,244,237,219, 23, 23, 47, 94,196,129,  3,  7,118,  2,
+ 56, 99,107,205,170,174, 69,158,  7, 36,247,  0,219,233, 22,136,164,158, 24, 66,152,112,145, 37, 49,180,115,188, 53,206, 94,117,
+145, 85,251,166,210, 53,152,254, 70, 13, 31, 62,220, 90,225,236,232, 84, 30,213, 87,249,138,138,138, 70,205,154, 53,171, 10, 39,
+195, 48,186,226,226,226,119,  7, 12, 24,176,133,162, 40, 65,181,  2,251,184,176,176,240,169,238,213, 87, 61,142,214,168, 49,175,
+201, 27,203, 41,229,145, 47,165,157,248, 15, 10, 10,229,248, 49, 33,191,164, 76,207, 12, 77,151,151, 39, 54, 69,250, 31, 63,126,
+ 60,250,  5, 80,252, 53,137,214,198,110,158, 93,100, 71, 64,210,250,246,168, 35,204,225, 68,156, 82,201,243,243,243,215,125,252,
+241,199, 35, 87,173, 90,229,123,234,212, 41,153,101,128,242,198, 27,111, 20, 38, 38, 38, 14,  2, 32,168,168,168, 56,183,106,213,
+ 42,223,168,168, 40,111,  0,222,  0, 48,118,236,216,130,130,130,130,205,112,161, 78, 24,141,198,236,206, 29, 67,173,  3, 63,219,
+144, 14,182,159,105,154,206,118,132,175, 38, 30,219,115,134, 97,234,228,163, 40,234,131,190,125,251, 82, 31,124,240, 65,193,169,
+ 83,167, 44, 27,233,218, 42,180,180,122,130,146,218,  3, 29,128,181,230,195,153,208, 40, 20,138,254, 14,126,135,113,149,198, 26,
+  7,148,142,156, 63, 19, 28, 57,114,228,147,201,147, 39,199,120,121,121,237,105,211,166, 77,168,191,191,191, 76, 36, 18, 65,167,
+211,149,233,245,250,187,105,105,105, 83, 63,249,228,147,  7,118, 89, 56, 98, 98, 40,  0, 60,147,201, 36, 36, 73, 82,  2, 64, 70,
+ 16,132,167, 69,104, 17,  4,  1,131,193,128, 71,143, 30, 97,217,178,101,204,249,243,231,191,  4,240,169,  3,  3,215,222,  0,124,
+109,218,113, 95,  0,122, 84,  6,176, 45, 34,  8,226,102, 83,231, 23, 97,194,197, 78,183, 64, 36,247, 64, 77,253, 68,221,155, 74,
+215, 86,225,138,138,138,250, 59,187, 18,215,198, 89, 84, 84,212,242,121,169, 33, 51,116,107,247, 97,219,218, 42,251, 28, 90, 68,
+ 88, 77,231,245, 65,165,165,231,127,125, 38,105,157,142,102, 77,  6,218,244,183,244,162,242,100, 87, 59,228,116,188,236,172,186,
+228,196, 52, 37,166,166,166, 14,152, 63,127,254, 39, 98,177,184, 15,  0,148,151,151, 95,203,205,205,253, 28,230, 85,133,245, 93,
+119,161,118,200,229,242, 94,207, 35,159, 94,175,255,199,128,  1,  3,190, 98, 24,102, 61, 77,211,151,255,  7, 94, 69,133,171, 52,
+190,184,248,233,167,159, 30,  0,232, 15,  0, 19, 39, 78,164,  0,224,192,129,  3, 14,139,231,153, 51,103, 50, 44,203, 26,204,229,
+ 65,131,202,213,133, 37,150, 54, 85,163,209,148,228,230,230,166, 48, 12,147,  2,224,123, 56,190,226,214,151, 32,136,227, 44,203,
+142, 51, 11,183,227, 44,203,142,179,253, 95, 83, 91,181,234,185,165,126,103,120, 23, 42,113, 32, 25, 68,245,169,192,250,206,235,
+ 67, 90,129, 38, 22, 64, 79, 87,238,254, 79,226,126,110,110,238,140, 70, 92,119,225,197, 67,166, 94,175, 31,255, 63,244,188, 42,
+215, 43,255,147,244,127, 13, 16, 88, 22,164,164,164, 52,153,139,192,179, 70,167, 91, 85,  7,224,213,207,109, 16, 89,147,240,114,
+  9, 45, 23, 92,112,193,  5, 23, 26,  3,165, 43, 11, 92,248, 51,195,226,155,101, 57,175,197, 71,171,186,127,150,245,156, 64,237,
+ 43,  7, 28,217,149,188, 33,171, 36,206,185, 56, 93,156, 46, 78, 23,167,139,243,153,115,122,  0,  8,  1,176,166,158,251,170,175,
+ 46, 44,  0, 32,  7, 96,116,229,167,139,179, 17,250,193, 46,176, 44, 59,182,174,169, 67,130, 32, 78, 52,149,208,178, 58,195,247,
+192,242,206,183,176,220,114,110,175,208,106,106, 68,184, 56, 93,156, 46, 78, 23,167,139,211,197,233,226,116,113, 54, 82,104, 13,
+251,240,195, 15, 63, 66,101,104, 12,246,195, 15, 63,252,136,101,217,177,149,151,216,177, 77,249,219, 73, 61, 49, 36,185,  7, 88,
+203,145,212, 19, 67,106,185, 53,210,230,176,194, 53,117,232,130, 11, 46,184,224,130, 11, 46, 60,239,184,178,122,245,234,242,213,
+171, 87, 91, 28,223,139,  0, 16,102, 11, 87, 81, 83,254,176,121,154,208,158,133, 82,117,111,193,243, 12, 16, 68,114,120,211,184,
+ 60,193, 48,176,166,206,  0,  0,146, 74, 98,244, 21,255,165,105,195, 30,  0,185, 13, 37,238,  0,116,108,235, 33, 58,170, 99, 24,
+ 94, 86,153,126, 98,106,229, 54,  7, 14, 99, 34, 16, 46,224,243,127, 17,120,120,136,106,186,174, 83, 42,181, 58,189,126,228,  1,
+224, 87, 87, 29,112,193,  5, 23, 92,112,225,  5,129,196,211,211,243, 60, 73,146, 45, 45,255,176,141, 59, 88, 61,  6, 33,195, 48,
+121, 10,133, 98, 36, 42,167,138,159, 38,167,237,247,245,104, 96, 95,238,108, 56, 58,117,200,  1,170, 68, 97,125, 42, 59,102, 83,
+ 92,193,219,110,238, 30, 43,255, 58,235, 31,222,237,218,135, 18,205,155, 55,  3, 88, 32, 51, 43,219, 63,227, 94,250,136,159,118,
+125,253,126,169, 74,177,204,168,211,253,199, 81,238,142,128,164,133, 84,112,249, 63, 31,190,229,193,  1,141, 55, 87,236, 61, 77,
+168, 13,205, 83, 42,151,155, 58, 36,178, 60,188,189,207,172, 62,119, 78,228,217,173, 91,149,107, 44,203, 86,238,175,247,251,239,
+162,255, 27, 57,242,204, 68,133, 98,148, 75,108,253, 41, 17, 32,147,201, 22,114,185,220,161,  6,131,161, 37,159,207,207, 98, 24,
+ 38,182,164,164,100, 35,128, 28, 87,246,252,185, 17, 26, 32, 25, 20,218,166,229,222,220,252,130,132,210, 10,253,236,180, 92,181,
+194,149, 43, 14,163,174,253, 53,159,217,222,155,  0, 32,149, 74,127, 35, 73, 50,216, 86,  4, 88,246,236,181,156, 87,255,107, 50,
+153, 30, 40, 20,138,  1,117,208,182,241,242,242,218,  2,160,119,125,  1,147,205,177,217,110, 42, 20,138,119, 81,251,106, 61, 55,
+ 79, 79,207,207,  8,130,152, 68,146, 36, 85,223, 51,153, 76, 38,134,101,217,253, 37, 37, 37,159,  2, 40,171,237, 62, 79, 79,207,
+115,169,169,169,189,253,252,252,234,181,210,208, 52,141,204,204, 76,223, 62,125,250, 92, 82, 40, 20, 29,154,146,243,105,107,145,
+134,162,142, 85,135,181, 22,116,  0, 85,246, 23,106,210,136,172, 60,161,244,104,255,193,163,134,205,123,239,  3,201,173,196,187,
+248,229,226, 85,148,106,116,160, 72, 18, 30,110, 98,180,111,255, 18,177, 33,250,160,207,206,173, 27,214, 95,139, 59, 59,182, 66,
+163,250,139, 67, 50, 93,204, 89,182,228,245, 62, 18,111, 47,  6, 48, 49,248,231,152,238,146,255, 59,158,176, 12,229,244, 71, 14,
+139,172,243,231,197,133,  5,  5,136, 10, 10,  2,135,166, 33, 36, 73,  8,  9,  2, 66,146,132, 68, 40,196,232, 29, 59,240,249,169,
+ 83,226, 79, 94,121,197, 37,182,254,100,144, 74,165,179,130,130,130,214,110,223,190,221,187,117,235,214,144, 72, 36, 80, 40, 20,
+ 62,105,105,105, 61, 22, 45, 90, 52, 35, 47, 47,239,227,210,210,210,109,174,156,250,243,194,100,194,180,239, 86,190,219, 44,239,
+241,189,102,115, 87,237,107, 79,120, 51, 67,239, 22,107,243, 93, 57, 99, 55,122,  0, 72, 64,205,251,151,214,117,173, 86,  8,133,
+194,130,138,138, 10,191,186,238,225,243,249,133,122,189,222,191, 62, 46,146, 36,131,115,114,114,252,196, 98, 49, 24,134, 49,239,
+  6, 96,178, 14,164,109,119, 63, 49,  7,170, 69,135, 14, 29, 12,117,113,186,185,185,125, 83, 88, 88, 24, 97,217, 39,208, 70, 80,
+213,136,156,156,156,136, 78,157, 58,125, 83, 86, 86, 54,178, 22,241,242,217,123,239,189,183,176, 75,151, 46, 22, 43,144,121, 23,
+132,202,191,114,185, 28,243,231,207,183,254,134,201,100,194,217,179,103,223,155, 53,107, 22, 74, 74, 74, 22,213,241,236, 45,253,
+252,252,  8,243,134,226,181, 98,249,242,229, 88,190,124, 57,190,254,250,107,130,203,229,122,212,147,159, 78,225,124, 90, 90,164,
+ 33, 22,172,122, 34,195,159, 64, 85,223,172, 19, 79,  8,173,167,  1,138, 43,248, 91,239,  1, 17, 67,231, 47, 92, 34,217,247,243,
+  5,164,165,252,142,212,203, 63, 84,185,167,215,200, 89,200,151,151, 97,214,188,127, 74,  9,138, 51, 52,238,220,145,191, 25,117,
+218,239,236,180,102,249,183, 20,240,255,222,175, 79,103,110,142, 40, 13,  1,158, 34, 12,236,217,150,219,252,204,157,191,107, 64,
+127,149, 82,185, 74,198, 33,145,181,253,173,183, 48,200,104,132, 31, 69,129, 34,  8, 80,  0, 72,130, 64,133, 78,135,155,211,166,
+161,207,238,221,248,244,216, 49,241,103,175,190,234,144,216,146, 72, 36,183,  8,130,240, 84,171,213, 99, 81,185,177,244,139,128,
+ 78, 82,169,244,  4,203,178, 37, 26,141,166,199,115,148,174, 64, 84,206,209, 87, 31, 29,243, 80,185,162,202,161,157,133,  5,  2,
+193,219, 19, 39, 78,220,176,121,243,102,113, 65, 65,  1,114,115,115,193, 48, 12,132, 66, 33,218,181,107, 71,156, 59,119,206,123,
+201,146, 37,235, 78,156, 56, 33, 40, 43, 43,251,202,145,129, 13,151,203,141,246,242,242,122,197,223,223, 95, 82, 88, 88, 88,174,
+ 84, 42,207,234,116,186,183,209,240,109, 83, 72, 46,151, 59, 53, 36, 36,228,181,160,160, 32,255,156,156, 28,121,118,118,246, 81,
+157, 78,183, 19, 13,220,168,217, 38, 79,187,193, 28,173, 30, 64, 94, 72, 72, 72,210,163, 71,143, 10,157,200,153, 27, 18, 18,146,
+220,  0, 78,  9,128,159,  0,  4,213,115, 95, 46,128,201,112,208,154,109,205, 88,214,116,114,197,198,237,179,163,102, 14, 36,190,
+ 91, 20,209,238,157,175,207, 93, 37,121,236,224,148,188,138, 44,151,134,178, 79,100,153,183,180,170, 46,168,234,186, 86, 39,116,
+ 58,157,175,193, 96,  0,183,150,205,226, 53, 26, 13,220,220,220,124,237, 77,164, 72, 36,194, 15, 63,252,  0, 46,151, 11, 46,151,
+139,146,146, 18,  4,  7,  7, 91,207,121, 60,158,245,115,139, 22, 45,234,229, 99, 24,166, 15, 69, 81, 80,171,213, 96, 24,198,122,
+ 40,149, 74,176, 44, 11,129, 64,  0,134,169,220,206,201,230,122,159,218,248,  8,130,152, 20, 20, 20,132,125,251,246, 65,175,215,
+ 63,113, 93, 38,147, 33, 49,241,143, 77, 70, 40,138, 66,223,190,125, 73,130, 32, 38,  1, 88, 84,  7, 47, 11,  0,145,145,145,160,
+ 40, 10, 20, 69,129, 36, 73,235,103,203,193, 48, 12,150, 47, 95,142,106, 91,147, 61, 53,206,231, 13,245, 68,134,207, 67, 45, 62,
+ 90,100, 19,167,203,118,137,103,144, 88, 34,251,226,221,127,252, 83,122,226,210, 29,100,102,101, 62, 33,178,  0,224,183, 95,118,
+ 34, 47, 55,  7,  9,169,217,152,250,183,  5, 82,153,204,227,139,106, 13,106,173,203, 70,221,221,120, 95,126, 56,121,160, 80,109,
+204, 69,153, 39, 64,181,225,131, 43,214, 96,201,184,110,  2,153, 27,111,173, 61,233, 20,240,249,191,172, 62,119,206, 42,178,194,
+117, 58,  8, 24,  6, 52,195, 88, 69,150,158,166,161,213,235, 17,168, 86, 35, 99,214, 44,176, 70, 35, 62, 62,124, 88, 44,224,243,
+127,177, 39,157,  0,192,227,241,  2,143, 30, 61,218,162,107,215,174, 23, 97,127, 48,211,115, 77,252,142,234, 66,207,238,221,187,
+199,238,222,189,187,  5,143,199, 11,116,  6,167, 80, 40,156, 32,145, 72,138,132, 66,225,132,  6,166,147,  4,176, 98,246,236,217,
+241, 47,189,244,210,  5,179,176,178,138,154,151, 94,122,233,220,236,217,179,111,  1, 88, 94, 75, 89,175,137,179, 89, 80, 80,208,
+202,205,155, 55,139,211,211,211,145,147,147,  3,163,209,136, 55,223,124, 19, 12,195, 64,171,213, 66,175,215, 99,205,154, 53, 18,
+111,111,239,101,168,220, 40,216,158,103,231,185,187,187,167,239,218,181,107,226,195,135, 15,165, 23, 46, 92, 32, 18, 19, 19, 37,
+235,214,173, 27,239,237,237,157,  6, 64,208,128,252, 36,  3,  3,  3,191, 59,114,228,200,187,137,137,137,193,135, 14, 29,226, 94,
+187,118, 45,112,235,214,173,115,  2,  3,  3,119,  3,160, 26,248,142,122,136,197,226, 17,139, 23, 47, 54, 93,185,114, 37,231,202,
+149, 43, 57, 27, 54,108,192,160, 65,131,194,163,162,162,194, 26,200,217,211,205,205,109,248,226,197,139, 77,113,113,113,185,215,
+175, 95,207, 94,183,110, 29, 57,124,248,240,129, 43, 87,174,236,230, 32,231, 79, 87,174, 92, 25,146,149,149,213, 58, 59, 59,187,
+ 85,118,118,118, 72,118,118,118, 72, 78, 78, 78,203,188,188,188, 22,249,249,249,205, 11, 11, 11,155,199,198,198, 14,  4,176,215,
+ 30,206, 80,127,201,187,139,222,140, 40, 95,246,183, 49,236, 71,211, 95,102,151,188, 57,132,125,101,112,215,159, 41, 14,135,184,
+158,156,137, 96,119, 96,231,252,222, 45,155,251, 72, 18, 59,123, 73,219, 63,103,117,243,121,227,228, 88,132,148, 66,161,192,137,
+ 19, 39, 96,182, 94,245,176, 21, 89,165,165,165,200,203,203,179, 92,227,216,147, 78,153, 76,118,126,251,246,237,108, 69, 69,  5,
+ 84, 42, 21, 10, 11, 11,145,149,149,133,140,140, 12, 20, 23, 23,227,238,221,187, 16,139,197,231,237, 73, 39, 65, 16, 96, 24,198,
+ 42,164,206,158, 61,139,217,179,103, 67,161, 80, 88,255,199,225,112,172,159, 45,223,169,143,211, 98,121, 98, 24,  6,215,175, 95,
+199,220,185,115,177, 97,195,  6,236,221,187, 23,199,143, 31,135, 66,161,176,138, 45,154,166,235,229,148,203,229, 48,153,236, 27,
+ 51,177, 44, 11,149, 74,101,247,123,183, 21, 64, 28, 14,231,  9, 81,100, 57, 28, 41, 75,141,228,124,110, 97, 71,100,248,218, 71,
+216,150, 15,102, 83,221,208,166, 74, 36,201,225, 77,157, 52,243, 61,239,236,194, 82,228, 20,168, 64,145,127,244,123, 97, 17, 51,
+193,161, 72,220, 56, 83,105,184, 34, 41, 10, 42,141, 14, 74,181,  1, 19,103, 46,244,250,207,134,127, 77,165, 13, 21,117,198,120,
+233,  2,180,235, 44,149,190,222,169, 83, 11, 50, 69,144,138,176, 87, 46,131, 49,  1,108,220,171,232, 81,226, 71,117,248,133,255,
+186,166,204,176, 50, 17, 72,175,211,154,225,225, 33,242,236,214, 13, 81, 65, 65, 24,108, 52,130,199,178,120,185,160,  0,191, 47,
+ 92,  8,221,193,131, 32,  1,240, 38, 76,192,176,141, 27,113, 41, 40,  8,  1, 90, 45,148,239,191, 15,223,211,167,193,147,201, 68,
+ 40,178,111,241,  3, 65, 16, 24, 58,116, 40,206,157, 59,231, 61,122,244,232, 51,119,238,220,121,131,166,233, 75, 13,201, 91,119,
+119,247,223, 56, 28, 78,112,125,247,209, 52,157,173, 82,169, 28,222,102,132,195,225, 12,238,219,183,239,225, 67,135, 14,121, 26,
+ 12,  6,167,140, 66,248,124,254,232,241,227,199,111,255,246,219,111,101,115,230,204,217,126,252,248,241,114,189, 94,127,218,145,
+ 34,  5, 96,197,182,109,219,222,137,140,140,244,152, 51,103, 14,155,145,145, 97,107,189,242, 29, 52,104,208, 75,219,183,111, 15,
+232,221,187,247,123,115,231,206,229,  1,248,184, 62, 43,143, 84, 42,157,183,125,251,118, 31,185, 92, 14,181, 90,109,109,100,179,
+179,179, 33, 18,137, 64,146, 36, 72,146,  4,151,203,197, 23, 95,124,225, 61,111,222,188,133, 10,133, 98,161, 29, 86,178,232, 45,
+ 91,182,248,142, 28, 57,146,124,248,240, 33, 72,146,132, 80, 40,196, 91,111,189, 69,106,181, 90,207,168,168,168, 24,141, 70, 51,
+197,145, 60,228,114,185, 83,163,163,163,219,135,135,135,115, 82, 83, 83,209,191,127,127,220,184,113,  3, 19, 38, 76,224,150,149,
+149,181, 90,178,100,201,108,157, 78,231,104, 28,151, 64,177, 88,220,229,191,255,253,111, 86,243,230,205,173, 13, 75,171, 86,173,
+152,177, 99,199, 42, 82, 83, 83, 67,175, 92,185, 82, 60, 96,192,  0, 71, 54, 44,111, 38, 22,139, 59,156, 60,121, 50, 47, 42, 42,
+106,196,182,109,219,198,  3, 64,159, 62,125,142,126,254,249,231, 23, 20, 10, 69,231, 75,151, 46, 41,  6, 15, 30,156,109, 39, 95,
+ 80, 96, 96, 32, 51,127,254,124,105, 93, 55,237,216,177, 67,137,202, 13,151, 91,  3,168,115,191,182,208,144,128,101,107, 23, 78,
+ 18,129, 49,128, 53,106,  1, 67, 57, 96, 80,195,164, 47,  7,193, 19,  1, 70, 45,124,  5, 10,252, 52, 47, 84,182,116,223,253, 20,
+230, 46, 49, 54, 85, 94,118, 26, 46,212,216,212,  0,  8, 35,  8, 34,225,196,137, 19,232,219,183, 47, 78,156, 56,129,177, 99,199,
+ 38,216,138,129,196,196, 68, 12, 30, 60, 24,102,139,150, 93,190, 90, 42,149,234,195,229,203,151,199, 77,157, 58, 85, 92,165, 49,
+ 32, 73,120,120,120, 96,204,152, 49, 21, 26,141,230, 67,123, 19,202, 48, 12, 56, 28, 14,178,179,179,177, 99,199, 14,172, 90,181,
+ 10,237,218,181,131,209,104,124, 66,108,153,219, 61,187, 26, 63,154,166,113,243,230, 77,236,217,189, 27, 31, 47, 91,  6, 55, 55,
+ 55,  0,128,193, 96,128,162,164,  4, 66,161,208, 42,198,234, 17, 78,251,239,221,187,183, 48, 56, 56,184,202,148,161,229,175,185,
+205,130,201,100,  2, 77,211,168,168,168,192,134, 13, 27,104,150,101,247,215,215,255, 88, 68,209,194,133, 11,161,211,253, 97, 80,
+239,102,246, 73, 14,  9,  9, 65,247,238,221,173,231, 36, 73,178,246,114,254,103, 64, 23,104,109,238, 14, 93,190, 14,  0, 16, 28,
+ 28,140,208,208, 80,  4,  6,  6,214,202,217,212, 90,164, 33,112, 32, 50,124,237, 66,235,105,236,148,205,229,  9,135,181,105,219,
+158,200,204, 83,128,195,225, 64,226,238,131,  1,175, 45,  2, 69,145,144,122,248,128, 96,180,127, 40, 98,146,  2,135,226, 64, 81,
+166, 69, 72,235,182,164, 64, 40, 26,166,169, 71,104,201,220,185, 91, 22, 79, 25, 32, 44,166,179, 33,106, 33,  4, 99,233, 78,131,
+248, 32,189,203,240,193,232,118,162,200,163,119,182, 64,101, 28,110, 79,122, 41,154,134, 31, 69,193,192,178,248,125,225, 66,132,
+ 69, 71, 35,193, 34, 12,163,163,145, 16, 25,  9, 47, 46, 23,  2,146,  4,107, 52, 62, 49,167,111,143,208,  2,128,172,172, 44, 28,
+ 60,120,208,107,210,164, 73,135, 19, 19, 19,167, 58, 40, 54, 44, 92, 62,215,175, 95,247,107,221,186,117,173,247, 60,120,240,  0,
+189,122,245,114,120,122,138,207,231,143, 30, 62,124,248,190,131,  7, 15,186, 39, 39, 39,195,207,207,175,209, 66, 75, 32, 16, 12,
+142,136,136,216,183,107,215, 46, 89, 81, 81, 17,162,163,163,101,175,190,250,234,222,248,248,248,215,116, 58,157, 61, 98,179,138,
+200,138,142,142, 86,238,216,177,227, 63,168, 58, 69,152,183, 99,199,142,239,122,247,238,253,110,100,100,164,  7,128,119,204,190,
+  3,117,138, 45,129, 64, 48,180, 77,155, 54, 85, 70,181,  2, 65,165,177, 73, 34,145,192,221,221, 29, 60, 30, 15, 58,157, 14, 97,
+ 97, 97,  4,159,207, 31,104,207, 51,187,185,185, 69,188,254,250,235,228,229,203,151,145,159,159, 15, 15, 15, 15, 72,165, 82, 48,
+ 12,131, 57,115,230, 80, 27, 54,108, 24,170,209, 56, 54,195,213,188,121,243,241, 35, 70,140,224, 36, 37, 37,225,225,195,135,208,
+233,116, 72, 75, 75,131, 76, 38,195,244,233,211,121,107,215,174,125, 53, 39, 39,199, 81,161,213, 37, 50, 50,178,192, 86,100, 89,
+ 32,145, 72,136,246,237,219, 43,188,189,189,123,  2,112, 68,104,117, 89,176, 96, 65,225,234,213,171,  7,159, 59,119,206, 26,244,
+242,220,185,115, 75,  0,224,171,175,190,138,243,245,245,237,  9,192, 94,161,  5,150,101, 77,127,253,235, 95, 31,243,249,124,112,
+185, 92,240,249,252, 42,  7,143,199,  3, 73,146,110,150,234, 92, 31, 95,202,195,252, 53,115,150,172, 91, 39, 17, 82,220,127,188,
+214, 21, 45, 60,120,128,200, 11,188,193, 75, 65,120, 84, 26, 45, 89,197,  3,224,151,165, 88,255,186,130,140,252,190,226,103,  3,
+227,233,123,191,164,164,236, 25,247,  1,189,  1,252, 27,149,155,235, 46,  3,112,253, 57,233,155,110,  1,  8, 27, 59,118,172, 85,
+108,157, 58,117, 10,163, 71,143,134, 82,169, 68, 82, 82,146,173,200,114,100,131,229, 91, 70,163,241,246, 15, 63,252, 48, 96,210,
+164, 73,132, 77,253, 66,114,114, 50,238,222,189,155, 96, 47, 31, 73,146, 48,153, 76,224,114,185, 88,183,110, 29, 12,  6,  3,190,
+255,254,123, 28, 56,112,  0, 36, 73,130, 32,  8, 16,  4,  1,153, 76,134,175,191,254,218,161,118,143, 97, 24,196,196,196, 96,233,
+146, 37, 86,145,101,158,201, 64,128,191, 63,188,125,124,112,255,254,253,122,133, 86, 73, 73,201,167,199,142, 29, 67, 93,206,240,
+199,142, 29,179,126,174,230, 12, 95,127, 63, 71, 81,208,233,116,120,249,229, 63,182,138, 93,176, 96,129,245,179, 66,161,  0, 69,
+ 81,150,188, 32,236,229,212,178,192,107,194, 63,254, 55,230,131, 15,170, 88,232,106,227,124, 26, 90,196, 89,214,173, 26,196, 86,
+152,217, 58, 27,  8, 96, 44, 42,125,180,242,128,167,232,163,197,178,166, 14,193,205,130,112, 59, 35, 17, 28,138,  2,223,221,  7,
+238, 94,254, 48,209,122,168, 10, 31,226,226,161,111,  0,  0,219, 98,246,131, 36, 73,112, 56, 20,116,122,  6,237, 90,  4,193,100,
+ 50,117,168,139,187, 35, 48, 96,168,191, 79,223,230, 45, 61,136, 36,207,135,104,239,231, 93,109, 34, 68,128,118,185, 82,162,191,
+ 84,212,167, 68, 85, 58, 32,  5,184, 82,175, 24, 32, 73,144,  4,  1, 49,143,  7,221,193,131,149, 94,155,209,149,125, 86, 66,100,
+ 36,200,159,127,134,155, 64,  0,138, 32,192, 49,155,160, 27,130,210,210, 82, 16,  4,129, 61,123,246,120, 78,159, 62,125,111, 82,
+ 82, 82,100, 69, 69,197, 65, 71, 56,148, 74,229,216,240,240,240, 11, 49, 49, 49,190,  1,  1,  1, 79, 92,207,207,207,199,204,153,
+ 51,139,148, 74,165, 67, 65,221,132, 66,225,132,241,227,199,111,223,185,115,167,236,222,189,123, 80,171,213,240,245,245,109,108,
+ 81,232,217,175, 95,191,195,  7, 15, 30,116,207,207,207,135, 74,165,130, 78,167,195,158, 61,123, 60,198,140, 25,115, 48, 53, 53,
+117, 52,128,248,122, 56, 62,177, 21, 89,115,231,206,189,  3,192, 15,192,150,234, 26,212,124,173,171,141,216, 82,  1, 88, 91,199,
+ 72,180,165, 68, 34, 65, 97, 97, 33,102,206,156,137,244,244, 63, 12,160, 65, 65, 65,214,145,222,253,251,247,225,235,235, 11,130,
+ 32,252,236,121,104, 95, 95, 95,169, 94,175,199,236,217,179,145,149,149, 85,133, 51, 59, 59, 27,  4, 65,136, 29,205, 72,127,127,
+127,127,173, 86,139, 65,131,  6,161,162,162,114, 95,223,201,147, 39,131,203,229,162,176,176, 16, 92, 46,215,167,  1,239,199,103,
+236,216,177,181,134, 86,145,201,100,  6, 79, 79,207,142, 14,114,122,191,250,234,171, 57,209,209,209, 79, 44,108,185,113,227,198,
+ 95,188,188,188,206,121,121,121,181,119,144,211,100, 43,170,120, 60, 94, 21,161,197,229,114, 65,146,164,221, 62,106,233,133,154,
+205, 28, 34,175,251,234,249, 35,103,182,240,115,  7,171, 46,  0,111,248,167,184, 93, 36,194,186, 13, 39,  1,  0,255,124,171, 23,
+186, 69,172,128,126,231, 72, 44,236, 79,241,167,101,235, 22,  3,248,228, 25,183,249, 95,  2,176,172,130,251, 22, 64,247,231,168,
+ 63,178,138,173, 83,167, 78,161,115,231,206, 40, 41, 41, 65,106,106,106, 67, 69,150,165,189, 91,250,217,103,159,253,242,198, 27,
+111, 72, 44,131, 86,145, 72,132,247,223,127, 95,171, 86,171,151, 58, 84,136, 76, 38,112, 56, 28,235, 32, 89, 40, 20, 34, 44, 44,
+204, 42,178,  8,130, 64,121,121, 57, 56, 28,142,101, 69, 34, 97,103, 26, 17, 24, 16,  0, 55, 55, 55,180,109,215, 14,247,204,237,
+136,229,179, 64, 32,  0, 65, 16,160,233,122, 13,121,101,102,167,246, 69,206,238,146, 45,162,168, 78,211,113, 80, 16, 76, 38,147,
+ 69,100,178,206,224,244,241,241,129, 90,173,182,151,243,185, 68, 45, 22, 45,139,208, 26,139, 74, 95,173, 39,194, 59, 12,  1,112,
+ 17, 77,184,164,146,  0, 75,152, 88, 22, 28,138, 52,207,221, 82,160, 40, 18,138,162, 60,108,252,244, 29,179,200, 58,128, 19,113,
+169,  8,110,211,249,143,121, 92,130,  0,216,186, 11,183,175, 59, 47,122,222, 27,253, 68,  5, 68, 30, 60,130,196, 16, 10,171,233,
+ 71, 79, 30,136, 16, 18,243,135,  6,139,111, 30,171,136, 78, 81, 25,234,237, 40,132, 36, 89,233,252, 78, 16, 53, 58,247,144,230,
+107, 20, 65,128,101, 89,176, 38,199,252,142, 45, 66, 94, 36, 18,193, 96, 48,128,162, 40,108,218,180,201, 35, 34, 34, 98,139,163,
+ 66, 11, 64,114, 65, 65,193,152, 57,115,230,156,218,191,127,191,143,143,143, 79,149,209,195,156, 57,115,228,  5,  5,  5, 99,224,
+160,211, 61,151,203,221,242,237,183,223,202, 30, 61,122,132,242,242,114,136, 68, 34,107,227,211,208,242,217,167, 79,159, 51,167,
+ 79,159,246, 84,169, 84, 48, 24, 12, 16,137, 68, 96, 89, 22, 20, 69,225,199, 31,127,244, 30, 55,110,220,201,204,204,204,225,117,
+165, 85, 36, 18,189,102, 22, 78,136,140,140,244,136,140,140, 28,  2,212, 26,169,215,138,200,200, 72,143, 69,139, 22,189,170,213,
+106,215,214,241,204, 89, 10,133, 34, 64, 36, 18,225,208,161, 67,144, 74,165, 16,139,197,  8, 10, 10,130, 66,161,128, 88, 44,  6,
+203,178, 48, 26,141,150,198,162,216,158,  7, 47, 42, 42, 82,211, 52,237,126,234,212, 41, 20, 23,255,241,149, 22, 45, 90, 64,169,
+ 84,194,100, 50,149, 59,154,153,185,185,185,  5,  4, 65, 52,191,125,251, 54, 30, 61,122,132,209,163, 71,227,231,159,127, 70,175,
+ 94,149,179,195,122,189,190, 33, 65,252, 24,138,162,216, 58,202, 45,  1,192,211,153,156,230,206,203, 33, 78,147,201,100,178,136,
+ 44,219,191,182,226,171,158,223,172, 82,157, 59,250, 75,119,172,158, 55, 98,230,200,206, 62,208, 22, 61,132,208,205,  7,132, 71,
+  8,214,109, 56,137,164,  7,149,239,107,221,222,223,176, 47,106, 12, 32,242, 66,168,187, 28,  1,110,156,215,239, 22, 62,115,161,
+229,110, 59, 78,120, 94, 59,166,209,163, 71, 67,161, 80, 64, 42,149, 58,195, 63,231,170, 86,171, 77, 59,114,228, 72,207,177, 99,
+199,130,207,231, 35, 45, 45, 13,241,241,241,169,  0,174, 58, 42,180,184, 92, 46, 62,251,236, 51,188,243,206, 59,240,247,247,199,
+210,165, 75,193,225,112,172,  7, 65, 16, 86, 11,151, 35,240,243,175,123,225,163,197, 33,190, 62, 99,184,187,187,251,103, 36, 73,
+ 78,162,236,200, 56,134, 97, 24,147,201,180, 95,165, 82,213, 25,222,193,226,184,110,207,187,176,205,131,122,250,180, 70,115, 62,
+ 13, 45,210, 16, 84, 95,109, 88,139, 69,203,178,234,240,137,173,128, 44, 79,121,209,108,178,187,216, 84,  9, 37, 72,234,110,118,
+ 78, 46,188, 61,165,102,145,101, 62, 72, 18,221, 58, 87, 14,102, 79,196,165, 34,184,117,103,112, 40, 10, 28,138,130, 84, 36, 64,
+ 65,126, 30, 56, 28,242,110,109,188, 93, 40,188,241, 70,251,230, 33,158,222, 92,200,125,245,  8,244,175,197, 48,208,211, 13,193,
+129,124,140,242, 22,182,236, 66,225,141,186,173,111,172, 85,104, 25,104, 26,188,  9, 19,172,211,133,  9,145,145,  8,139,142,  6,
+ 51,126, 60, 52,  6, 67, 21, 83,113, 67,133,150, 72, 36, 66, 89, 89, 25,166, 78,157,170, 48, 26,141,239, 54, 48,139,227,139,139,
+139, 39, 78,155, 54,173,216, 34, 96, 12,  6,  3,166, 77,155, 86, 92, 92, 92, 60,209, 14, 43,209, 19, 48, 26,141,239,246,234,213,
+ 75, 33,151,203,173,233,108, 72,131, 99,129,151,151,215,137, 29, 59,118,120,233,116, 58,208, 52,109,229, 20,137, 68,160, 40, 10,
+190,190,190,216,183,111,159,175,151,151, 87,157,123, 86,105,181,218, 35,209,209,209, 74,  0,136,142,142, 86, 18,  4, 17, 75, 16,
+196, 86,130, 32,190,173,118,108, 37,  8, 34,214,246, 94,173, 86,123,184, 46,110,189, 94, 31,155,154,154,202,138,197, 98, 80, 20,
+  5,131,193,  0,161, 80,104, 53,137,151,150,150, 66,171,173,156,230,142,143,143,135,209,104,188,108,207,179,151,149,149,157,143,
+137,137, 49,181,104,209,  2,157, 59,119, 70, 88, 88, 24,250,245,235,135,150, 45, 91,226,243,207, 63,103, 52, 26,141,195,117, 47,
+ 55, 55,247,196, 79, 63,253,100,108,222,188, 57,122,246,236,  9,129, 64,128,110,221,186, 33, 40, 40,  8,171, 86,173,210,171, 84,
+170, 83, 13,120, 77,153,137,137,137, 84, 29, 34, 87,  6, 59, 86,239, 86, 67,214,205,155, 55,169,126,253,250, 29,173,126,161, 79,
+159, 62, 71,165, 82,169,187,197,196,238,200,136,220, 86, 92,  9,  4,  2,235, 97,249, 63,135,195,177,103,244, 67,118,244,151,238,
+248,226,157, 97, 51, 71,118,246,196,209,243,215,193, 51, 40,  1,125, 29, 51,130,140, 17,  4, 79,  2,127,119,110,240,115,208,  7,
+ 44,  4,112,  7,149,113,152,150,226,249,130,213,241,189,184,184, 24,169,169,169,136,143,143, 71,191,126,253,112,249,242,101,224,
+ 15,  7,121,135,161, 82,169,150, 70, 69, 69,105, 44, 43,249,150, 45, 91,166, 45, 43, 43, 91,234,104, 27,204,178, 44,184, 92, 46,
+ 66, 67, 67,177,104,209, 34,156, 60,121, 18,105,105,105, 48, 26,141, 86, 33,100,241,201,116,196,162,197,227,241,224,239,239, 15,
+163,209,104,181,102,  1,192,189,244,116,112, 56, 28,152, 76, 38,232,245,250,122, 45, 90,238,238,238,159,109,223,190,253, 61,185,
+ 92, 30, 88, 84, 84,228,103,123, 20, 20, 20,248,229,229,229,249,229,228,228,248,101,101,101,249, 61,126,252,216,239,225,195,135,
+129,107,214,172,121,207,221,221,253, 51,123,210, 73, 81, 20,186,117,235,134,  5, 11, 22, 88,143,205,155, 55, 91,143,139, 23, 47,
+ 58,236,188, 78, 81, 20, 66,151,175,195,152, 34,214,122,156,244, 37,172, 71,210, 63,231,214,197,217,228, 90,164, 65,250,197,188,
+218,208,118, 99,233, 26, 96, 89,117,104,105,203,172,110, 27,213,157,225,155, 12,180,190,226,194,131,140,244, 97,161, 93,122,147,
+249,114,117,149,229,159, 97, 67, 39,130, 32,  8, 52,107,221, 25, 20,135,  3,138, 34,193,161, 40,120,200,132, 72,189,125,219,164,
+211,106, 47,212,196, 57,  4,224,240, 69,252,205,111,141,234, 38,204,229, 23,194, 55, 80,  2, 30,183, 82, 59,178, 15, 38, 86,235,
+ 33, 56, 64, 23, 55,204,202,241, 22, 93, 40,168,216,236,169, 49, 28,141,173,101,  4,104, 50,153, 32, 21,  8, 80,161,211, 65, 75,
+211, 24,186,113,163,117,186,144, 36,  8,220,  2,208,117,227, 70, 92, 57,120, 16, 50, 62, 31, 16,  8,236, 94, 21, 82,147,208,146,
+203,229,152, 49, 99, 70,113, 94, 94,222,244,134,248,104, 89,160,211,233, 46,229,231,231, 79,159, 56,113,226,158, 67,135, 14,121,
+ 77,156, 56, 81,145,159,159, 63,221, 78,191,167, 39, 80, 81, 81,113, 48, 43, 43,171,124,198,140, 25,187,247,238,221,235,237,227,
+227, 99, 29,137, 52,168,176, 18,132,124,196,136, 17,  2,123,238,171,231,150, 40,179,115,251, 59,102,203, 86,215,185,115,231, 94,
+ 65,165,255,149, 45,150,111,219,182,109,178,205, 20,227, 86,  0, 27,235, 34, 46, 45, 45,253,118,209,162, 69,127,187,116,233,146,
+143, 80, 40,  4, 65, 16,224,241,120,104,219,182,173,117, 21, 13,151,203,  5,203,178,248,224,131, 15,228,133,133,133, 95,217,249,
+110,230, 70, 69, 69, 13,174,168,168,240,156, 49, 99,  6, 37, 20, 10, 81, 80, 80,128, 13, 27, 54, 48, 59,119,238, 84,106, 52,154,
+153, 13, 16,194, 49,255,250,215,191,134,170,213,234,214,115,230,204,225,169, 84, 42,104,181, 90, 44, 94,188, 88,255,221,119,223,
+101,107,181, 90,135,  3,254,246,239,223, 63,227,241,227,199,  3,203,203,203, 75,196, 98,113,117,107, 31, 33,145, 72,122,  3,216,
+237,  8,103, 88, 88,216,253,204,204,204,126, 43, 86,172,136, 53, 26,141,220, 27, 55,110, 88,157,225, 55,109,218,116, 81, 40, 20,
+142,128,131,155,175, 18,  4, 97, 18,  8,  4, 85, 44, 88,213, 63,115, 56,156,122,219,180, 14,  1,226, 21, 95,188, 61,120,230,203,
+ 29,221,113,228,252,111,136, 58,252,224,110,187,153,190,161, 47,121, 22,193, 84,148,138,127,190,213, 11,235,246,254,  6,160,114,
+234,208, 84,152,  4,182,228, 62, 88,183,230,120,168,144,231, 62,  7,125,192, 69, 84,134,204,120,222, 80, 69,100, 37, 37, 37, 97,
+216,176, 97,  0,128,203,151, 47, 35, 60, 60, 28,151, 47, 95,198,192,129,  3, 29,142,165,101,198,127, 75, 75, 75, 31, 95,188,120,
+177, 83,243,230,205,113,245,234,213,135,  0,254,235,104, 34, 45, 66,139,195,225,224,205, 55,223, 68, 68, 68,  4, 90,180,104, 81,
+101,181,161,229,179, 35, 98,131,166,105,116,233,210,  5, 58,189, 30, 60, 30,207, 58, 53,201,225,112,224,235,231,135,140,140, 12,
+187, 44, 90, 36, 73, 78,122,237,181,215,200,228,228,100, 76,153, 50,  5,123,246,236,169,245,222,105,211,166,225,135, 31,126,192,
+107,175,189, 70,126,244,209, 71,117,134,119,176, 56,161,219,243, 76,150,126,186,190,118,223, 89,156, 77,173, 69, 26,  3,155,208,
+ 14, 53, 78,154,212,240,191,232, 42, 66,203, 38, 72, 88,211,  8, 45,218,176,231,231,239,191, 89,212,111,203, 64,223, 64, 63,119,
+ 40, 84, 90,171,216, 74,184,120,  0,  0,240,198,220,149,224, 80,149, 83,138, 50,169, 16, 34, 30,133,131,187,190,146, 27, 12, 21,
+ 53,150,174, 50, 46,249,206, 71,  3,218,186,243, 37, 70,148,  6,176,232,236,251,199, 78, 57, 68,235,  3, 79, 10,174, 30,158,240,
+ 73, 42,193, 91, 47, 73,101, 95, 37, 43,223,129,209,180,249,137, 14, 81,169,212, 42,111,223, 22,141,222,190, 29, 55,166, 79, 71,
+ 51,134, 65,108, 80, 16,188,184, 92,184, 11,  4, 32,  9,  2,218,227,199,113,229,208, 33,248, 11,  4,128,155, 27,232,207, 63,135,
+ 46, 53, 21,198,178, 50,109,  3, 70,102,152, 60,121,178, 92, 46,151, 79,212,235,245,151, 26,155,207, 90,173,246,116, 86, 86, 40,
+104, 68,151,  0,  0,  9, 69, 73, 68, 65, 84,214, 59,253,251,247,223, 98, 52, 26,223,213,106,181,141, 90, 25,165,215,235, 79,231,
+231,231, 79,152, 60,121,242,129,195,135, 15,251,120,120,120, 52,152,171,184,184,184,151,147,138,147,  9,192,199,102,231,246,119,
+ 34, 35, 35, 61,110,222,188,249,183, 29, 59,118,108,177, 25, 77,248,205,158, 61,251,237,106, 34,171,222, 85,135,  0, 50, 11, 11,
+ 11, 63,127,255,253,247, 87,174, 95,191, 94,106,113,124,255,253,247,223, 65,211, 52,184, 92, 46, 24,134,193,236,217,179,213,197,
+197,197,235, 80,123, 68,231, 39,138, 86,105,105,105,219, 21, 43, 86,236,216,184,113, 99,  4, 69, 81, 18,134, 97, 52,229,229,229,
+177, 21, 21, 21, 51,209,176, 56, 90,166,162,162,162, 25,159,124,242,201,140, 13, 27, 54,188, 70,146,164, 31, 77,211,242,178,178,
+178, 99, 90,173,246, 59, 52, 96, 42,233,234,213,171, 69,111,189,245,214,131,162,162,162, 14,193,193,193, 42,169, 84,170,215,235,
+245,148, 72, 36,146, 73, 36,146, 48,  0, 87,  9,130, 72,113,132, 51, 33, 33, 33,127,206,156, 57,143,116, 58, 93,232,214,173, 91,
+227,100, 50,217,121,130, 32,  8, 30,143,231, 41, 18,137,134,  1,136, 37,  8,226,158, 35,156, 36, 73,154,108,173, 87,213,253,179,
+248,124,190, 93, 62, 90,173,125,197,179, 34,218,114,112,228,194,111,136, 58,146, 25,195,176,236,161, 67,  9, 37,199,151,134,  3,
+134,253,111,161,219,196,221,149,211,133,  0, 76,133, 73, 48,236,159,  6, 66,236,131,184, 28, 46, 84, 90,195,  9,184, 80, 19,172,
+225, 29,228,114, 57,146,147,147, 45, 34, 43, 12,  0,  6, 14, 28,152, 96, 17, 91,241,241,241,232,217,179,103,  2,  0,174,163,229,
+181,180,180,244,253,169, 83,167,158, 54, 15,142,223,111,192,192,207, 42,180, 44,130,170, 69,139, 22,214,115,219,195,198, 71,203,
+ 46, 48, 12,  3, 30,143,  7, 14,135,131,192,160, 32,235,111,177, 44,139,140,140, 12, 40, 20, 10,187,132, 22, 69, 81, 20, 65, 16,
+152, 50,197,190,  5,201,127,253,235, 95, 17, 27, 27, 11,202, 78, 85, 72, 81, 20, 66, 66, 66,234,189,199,162, 75,237,229, 12, 14,
+ 14,110, 48,103, 83,107,145,134, 10,172,154, 62,215, 36,170,106,171, 16, 79, 11,185,106,181,234,227, 93,219, 55,173,159, 61,239,
+  3,105,210,253,  2,168,212, 58, 80, 20,105,219,120,130,195,161, 32,147,  8,209, 60,192, 29,123,255,243,239,178,178, 82,229, 39,
+168,101,223,195, 22,110,188,185, 35,122,191, 36,224,  5,106, 16,218,117, 50, 40,225, 31, 34,128,205,175,101,118, 48,252, 23,188,
+146,169, 17,254,156,169,153,123,171, 68,255,164,208,210,235, 71, 46, 27, 53,234, 76,212,201,147,226, 62, 49, 49,184, 63,123, 54,
+130,180, 90,  8,204, 83,137, 36, 65, 64,202,227, 65,202,227, 85,138,172, 13, 27,160,165,105,108,156, 62,189, 92,167,215,143,114,
+164,146, 23, 23, 23, 99,252,248,241, 69,185,185,185, 99,208,128,169,189,218,160,209,104, 14,  2, 56,232, 44, 62,157, 78,119, 41,
+ 59, 59,251,149,241,227,199,159, 60,125,250,180,239,115, 18,100,206, 34,182, 12, 55,111,222,124, 59, 46, 46,238, 62,170,110, 44,
+170,140,139,139,187, 63,103,206, 28, 98,199,142, 29,223,  1,248, 23,236, 12,224,169,209,104, 54,157, 61,123, 22,131,  7, 15,254,
+215,234,213,171,189,123,245,234,  5, 63, 63, 63,148,149,149, 33, 62, 62, 30, 11, 23, 46, 84,148,150,150,174, 86, 42,149,235, 29,
+ 76,179, 65,167,211, 77,179, 93, 74,237,140,124,208,233,116, 59,243,242,242,118, 58,139,112,254,252,249,191,103,100,100, 20,251,
+250,250,246,229,241,120, 93, 81,233,  7,148, 15,224, 59, 71,  5,145,  5,243,230,205,187,157,145,145, 33,111,214,172, 89, 63, 51,
+167,  7, 42,183, 49,218,222,  0,206,220,223,126,251, 45,184,119,239,222, 36,151,203,101, 41,138,  2,151,203,101, 57, 28, 14,107,
+246,171, 97,  1,224,216,177, 99,  2,  0,117,110,155,115,191, 80,187, 98,218,191,127,253, 40, 37,191,226, 80,106, 65,249, 34,  0,
+236,254, 36,241, 47,221,124,169,145, 35,219,103, 67, 23, 61, 16,132,172, 50, 80, 37,171,206,  3, 33,241, 71,182,169, 25,150, 31,
+189,155, 79,131, 88,235,210, 84, 53,143,171, 97, 14,239,144,151,151,103, 43,178, 44, 86,171,176,129,  3,  7, 38,152, 69,150,229,
+ 90, 67,252,203,206,153, 76,166, 70,245, 97, 44,203, 34, 42, 42, 10,219,182,109, 67,125, 17,205,205,171,251,136,250,248, 44, 22,
+ 45,134, 97, 96, 48, 24,144,148,148,100,141,217,101,153, 46,180,132,118,160,105,186,206,213,234, 12,195, 48,122,189, 30, 63,254,
+248,163, 93, 98,107,223,190,125,168,168,168,  0, 83,143,130,179, 13,197,208,189,123,119, 40, 20, 10,235, 98,159,176,176, 63, 66,
+229, 25, 12,  6,135,132,171,133, 51, 52, 52, 20,114,185, 28, 22,127,225,230,211,255, 48,246,208, 26,205,159,181,220,215,106,209,
+122,234, 61,166, 64, 44, 59,221,107, 64, 68,248,244,183, 23, 74,212, 58,  6,143, 30, 61, 70, 81, 97, 30, 72,130, 68, 96,179, 96,
+180,108, 25,  2, 17,159,196,158,232,245,154,132, 43,231,127, 85,151,149,140,174,141,107,172, 59,239,202,134,  9,225,253,218,180,
+113, 35, 64, 27,  1,198,  8,208, 70,192,100,254,107,249,159,169,106,153, 75, 78, 86,178, 31,221, 82, 92, 59,161, 50,212,184,103,
+213, 68, 32,220,195,203,235,204,242, 99,199,196, 38,131,  1,197,239,191, 15, 49, 77, 67,104, 30,149, 84, 62,136,  0,244,231,159,
+ 87,138,172,105,211,202, 85, 74,165, 67, 91,240,248,248,248,252, 70, 16,132, 79, 81, 81,209, 11, 21, 25,222,215,215,247,  4,203,
+178,114,185, 92,222,235, 57, 74,151, 31,  0, 37,  0, 67, 13,  3,  9, 95, 56,238,255, 99, 65,136,175,175,239, 71, 36, 73,246,103,
+ 89,214,155, 36,201, 18,147,201,116,181,176,176,112, 13,128, 12, 87,127,250,204, 96,137, 12,223,170,158,251, 10,  1,252,  3,149,
+ 78,193,143,236, 37,239,230,238,238,174,227, 27, 15,255,165,179, 96,232,164, 48,119,180, 14,112,  3,151, 39, 68,110, 41,141,115,
+ 41,165,216,126, 49, 63, 75,107,100,198,165, 23,149, 39,186, 94, 69,157,112,250, 22, 60,206,132,151,151,215,245, 51,103,206,244,
+106,221,186, 53,105,235,240,110,137,149,103,153,222,226,112, 42,181,220,165, 75,151,232, 41, 83,166, 92, 45, 40, 40, 24, 92, 27,
+167,155,155,219, 47,119,238,220,121, 89,165, 82, 61, 33,168,108, 35,197, 91,206, 53, 26, 13,230,205,155,119,182,182, 45,120,220,
+221,221, 55,172, 95,191,254,189, 55,222,120,131,180,132,163,176, 61, 44,219,  5, 89, 14,131,193,128,221,187,119,155,190,250,234,
+171,175, 85, 42, 85,173, 83,135,129,129,129, 89,185,185,185,193,150, 80, 11,246,  4, 21, 13,  9,  9,201,123,252,248,113,208,211,
+228,124,129,  5, 87, 21,235,214, 51, 49, 77,112, 69,162,249,110, 82,207, 79,223,152,186,192, 59,164, 77, 59,194, 63,176, 25,  8,
+144, 40,200,207,193,227,  7,233,236,225,239,191, 41,214,148, 42, 62,211,106, 53,223,212,197,211, 17,104,211, 74,198,219,207,103,
+208, 30, 22,  1, 84,109,127,170, 39, 70, 28,  0, 12, 92,242,238,163, 50,227,228,148, 58,166,125, 44, 98,235,227,195,135,197,252,
+246,237,159,  8, 20,103, 50,153,160, 75, 77,197,198,233,211, 29, 22, 89, 46,184,224,130, 83,208, 26,245,199,200, 50,162, 50, 62,
+151,163, 22, 19, 34,212, 79, 50,153,  5, 38,145, 48,117, 33,  9,130, 79,179, 72,  3,139, 95,196,156,242, 45,  9,121,208,186,178,
+223, 46, 60,183,155, 74,  3,144,120,121,121,157,167, 40,170,165,197, 34, 99,107,173,175, 97, 67,233, 71,  5,  5,  5, 35,  0,212,
+181, 66,184,141,155,155,219, 55, 12,195,244,177,103, 83,105,138,162,110,148,149,149,205, 71, 29,155, 74, 55,197,170, 67,111,111,
+239,140,199,143, 31,183,177,172,162,182,237, 43,107, 90, 89,126,239,222, 61, 12, 25, 50,228,113,126,126,126,200,211,228,124, 94,
+ 81,203,170,195,231,199,162,101,131, 32,158, 64, 58,131, 47, 18, 14, 55, 25,233, 80, 16,  0,135,203,189,171,175,208, 94,208,105,
+213,187, 80,203,116,225,211,196, 68, 32, 92,192,231,255,194,147,201, 68, 53,137, 54, 99, 89,153, 86,167,215,143,116,137, 44, 23,
+ 92,112,193,  5, 23, 94, 32,180,247,242,242, 58,195,229,114,  5,182, 98,178,250,103, 11,104,154,174, 40, 42, 42, 26, 13, 32,237,
+ 41,115,254,111,194, 65, 39,181,  8,123, 57,205,199,144,231,157,179,  9,159,157,117, 34,231, 16, 51,231,242, 23, 36,157, 67,158,
+ 87, 78,203,243, 58,192, 27,225, 72, 57,114, 86,126,218,164,147,117,118, 58,155,138,211, 89,245,168,134,116,178, 77,240,222,151,
+191, 32,233, 28,242,188,113, 86, 47, 63,118,242, 58,196,105,103,153,114, 52,157,172,179,211,217, 84,156,141,173, 71,117,164,147,
+109,108, 89,170,229,221, 47,199, 11,136,228, 30, 96,147,123,128, 77,234, 89, 99,220,198,200,218,190,231,144, 35, 97, 83,173,  4,
+176,132,221, 55,243, 19,207, 43,167,109, 62, 56,115,171,128, 38,216,118,224,162,179, 57,171,229,167,179,176,220,188,194, 36, 22,
+118,  4, 28,117,228,217,157,241,222,171, 61,171, 83,120, 27, 32,178, 28,226,116, 86,185,111,106, 78,103,213,165,234,156,206, 40,
+247, 53,189,247, 38,124, 71,206, 74,167, 83,234, 82, 83,148,249, 26,202, 79,163,121,171,115, 58,163, 46, 85,231,116, 70,185,127,
+ 26,156,206,168, 75, 53,113, 58,163,220,215,246,238, 95, 84, 67,147,101,186,208, 28,226,129,176, 67,108, 69,  3,  0,217,144, 76,
+107, 66, 75,217, 80,103,115, 58, 59,205, 77, 33, 54, 29,176,192, 60,115, 78, 39,191,163,229,102, 78,103,142,110,134, 58,235, 29,
+ 53, 69,121,183,229,116, 22,127,117, 30,103,188,167,154, 56, 27,155,222, 90,210,233,244,103,111,108,185,127, 90,156, 78,126, 71,
+ 78,169, 75,213, 56,135, 58,121, 48, 48,212,230,124,185, 51, 57,157, 85,151,106, 72,103,163,223, 83, 77,156,141, 77,111, 45,233,
+116,250,179, 59,163, 15,105, 42,222,103,105,209, 98,201, 90,203, 68,116,181,227,169,  8,141,103, 54, 37,231, 32,247,159,138,211,
+193,233,153,136, 38,120,247,207, 52,157,206,228,172,158, 70,103, 78,247, 52,101, 58,157,201,233, 64, 90,255,116,156, 47,218,123,
+127, 30,243,179, 54,190,198, 76, 75,213,102, 29,109,138,116, 58,147,211, 78,238, 63,  5,103, 35,222,253,159, 14,156,231, 37, 33,
+150,140,119,242,200,  4, 78,182,192, 52,217,115, 59, 57,157, 67,155,194, 66,216,  4,112,122, 58,205, 35,229, 79,155,224,217, 95,
+148, 60,117,213, 37, 87, 93,122,238,234, 82,181, 50, 57,212,137,150, 34,167, 90,158,171,115, 58,227, 55,108, 57,156, 85, 70,155,
+250,217,157, 89,151,154,226,221,191,104,248,127,145,193,179,185, 29, 76,112,153,  0,  0,  0,  0, 73, 69, 78, 68,174, 66, 96,130,
   0};
 
diff --git a/source/blender/editors/datafiles/claystrips.png.c b/source/blender/editors/datafiles/claystrips.png.c
new file mode 100644
index 0000000..b6ebc54
--- /dev/null
+++ b/source/blender/editors/datafiles/claystrips.png.c
@@ -0,0 +1,290 @@
+/* DataToC output of file <claystrips_png> */
+
+int datatoc_claystrips_png_size= 9087;
+char datatoc_claystrips_png[]= {
+137, 80, 78, 71, 13, 10, 26, 10,  0,  0,  0, 13, 73, 72, 68, 82,  0,  0,  0, 96,  0,  0,  0, 96,  8,  6,  0,  0,  0,226,152,
+119, 56,  0,  0,  0,  1,115, 82, 71, 66,  0,174,206, 28,233,  0,  0,  0,  6, 98, 75, 71, 68,  0,255,  0,255,  0,255,160,189,167,
+147,  0,  0,  0,  9,112, 72, 89,115,  0,  0, 13,215,  0,  0, 13,215,  1, 66, 40,155,120,  0,  0,  0,  7,116, 73, 77, 69,  7,220,
+  3, 18, 11,  2,  3,179,242, 79,233,  0,  0,  0, 25,116, 69, 88,116, 67,111,109,109,101,110,116,  0, 67,114,101, 97,116,101,100,
+ 32,119,105,116,104, 32, 71, 73, 77, 80, 87,129, 14, 23,  0,  0, 32,  0, 73, 68, 65, 84,120,218,237,125, 91,143, 37,199,113,230,
+ 87,153, 89, 85,231,214, 51,211,195, 33, 72, 13,181, 94,131, 67,137, 23,107, 13,138, 52, 47, 35,122, 73,  8, 16,236, 39, 61, 88,
+128, 40, 81,126,144,  4,239,171,254,131,159, 23,254, 27,122,149, 13,120, 33,  8,235, 39,173,  5,173,177, 90,136, 38, 69, 64,182,
+ 41,137,226,144,115, 35,102,166, 79,159, 91, 93, 51,115, 31, 42, 34, 39, 42, 79,158,230,202,242,202, 90,123, 26,104,244,189,186,
+ 42, 51, 50,226,139, 47,190,136,147,  1,240,120,240,246,175,246,166, 30, 44,193,131, 13,120,176,  1, 15,222, 30,108,192,131, 13,
+120,240,246, 96,  3, 30,108,192,131,183,223,252,155,249,109,186,153,233,108,134, 43, 79, 60,  1,103, 45,138,162,192,227,143, 63,
+142,178, 44,225,156,195,102,179,193,123,239,189, 55,250,253, 44,203,240,225,245,235, 56, 61, 57,121,176,  1,191,210,177,211, 26,
+ 90,107,124,226, 19,159,192,107,175,189,134,171, 87,175,226,145, 71, 31,133, 82,195,129,156,148, 37,  0,192, 57,  7,107, 45,148,
+ 82,225,103,222,123,120,239,195,231,  0,112,253,250,117,188,245,214, 91,248,251,183,222,194,141,235,215,113,227,198, 13,116, 93,
+  7,248,223,254, 28, 51,251, 77,101,194, 58,207, 49,159,205,240,228, 83, 79,225,149, 87, 94,193,139, 47,190,136,135, 47, 93,130,
+115, 14, 93,215,193, 90,139,182,235,  0,  0, 69,158, 67, 41, 21, 22, 59,203, 50,104,173,145,101,217,104,241,189, 88, 96,185, 65,
+239,191,255, 62,190,251,221,239,226,199, 63,254, 49,238,220,185,131,174,109,255,253,110, 64, 94, 20,120,242,169,167,240,217,103,
+159,197,213,171, 87,113,229,202, 21,104,173,209,117, 29,156,115, 97, 33,123,107, 97,173, 13,139,169,149, 66,150,101,232,173, 69,
+145,231,208, 90,143,172,158,223,248,107,231,220,240,238, 61, 84,150,193, 58,135,147,123,247,240, 63,254,246,111,241,191,127,244,
+ 35,124,240,193,  7, 88,157,158,254,251,217,128,203,143, 61,134, 39, 62,245, 41,124,246,217,103,241,202, 31,254, 33, 30,190,116,
+105,180,232,236,195,121,  3,156,115,104,233, 36,104,173, 81,228,121,248,122, 62,155,  5, 11,143, 23, 94,158,  6,190,142,247, 30,
+150, 54, 68, 41,133,211,211, 83,252,253,155,111,226, 39,239,188,131,159,189,251, 46,174, 93,187,246, 91,227,158,254,197, 55,224,
+241, 43, 87,240,185,207,125, 14,207, 63,255, 60,254,227,239,254, 46,142,207,159, 71,219,117,240,222,  7, 95,206, 11,159,101, 89,
+176, 92,107, 45,250,190, 71,111, 45, 12,197,136,186,105, 96,173,197,185,163, 35,104,173,247, 22, 61,254,200, 27, 32, 55,193,210,
+201,106,154,  6,187,237, 22,215,174, 93,195,123,239,189,135, 55,223,124, 19,255,248, 15,255,240,111, 99,  3,102,243, 57,254,243,
+171,175,226,229,151, 94,194, 39, 63,249, 73, 92,190,124, 57,160, 23,  0,208, 90, 67,101,217,176, 80,145,213,242,231,206, 57,180,
+109,139,182,235,160,148,130,209, 26, 93,223,  3,  0, 22,243, 57,180,214,112,206, 33,203, 50,100,116, 45,190,190,116, 67,124, 45,
+107, 45, 44,197,151,158,174,211,180, 45,154,170, 66, 93,215, 56, 57, 57,193,187, 63,251, 25,254,219, 95,255,245,191,170,107,250,
+181, 54,224,252,241, 49,190,244, 39,127,130,171, 87,175,226,194,241, 49,142, 22,139, 96,229,222,123, 24, 99,194, 63,144,110, 39,
+203,178,251, 65,150,252, 54, 91,170,115, 14,125,223,  7,235, 85, 74, 97, 62,155,133, 83, 99,140,  9,127, 27,191,141, 92,144,181,
+104,218, 22,109,219,134,191,235,186, 14,117, 93,163,218,237,176,221,237,208,181, 45,150,167,167,184,121,227,  6,254,251,223,252,
+ 13,110,223,188,249,255,199,  6, 92,124,232, 33,124,227, 27,223,192, 75, 47,191,140,217,116, 58, 44, 52, 45, 44,163, 21,137, 88,
+ 84,150, 33, 19,238,199, 57,  7,103,109,248,199,210,109,100, 89,134,190,239,131,251, 49,198, 96, 82,150,240,222,163,235, 58,204,
+231,243,209,181, 83,110, 72,186,183,237,110, 23,126,191,235,186,  1,158,  2,232,105, 51,214,235, 53,178, 44, 67, 93,215,248,201,
+ 59,239,224,175,254,242, 47,127,163,168,233, 87,218,128,115,231,207,227,235, 95,255, 58,190,240,133, 47,160, 40,138, 17,  4,140,
+177,186, 86, 10, 16, 27,194,139, 12,239,225,163,127,204, 22,203, 39,196, 57,135,166,105,208,245, 61,138, 60, 15,238,172,239,123,
+204,102,179,189, 83, 21, 47,126,223,247,225,122, 50, 22,244,125, 31, 54,131, 97,111,181,221,226,206,157, 59,152, 76, 38,200,243,
+ 28,167,167,167,248,193, 15,126,128, 31,254,240,135,216,109,183,191, 29, 27,144, 23,  5,190,248,197, 47,226,171,111,188,129,243,
+231,206,  5, 95,204, 22,205,254, 89,126, 61,242,205,188,184,  2,201,132,197,243, 62,184, 32,185, 56,117,211,160,235, 58, 76,202,
+ 18,179,217, 44,248,245,233,116,186,247,247, 62,113, 10, 56,183,144, 27, 32,175,223,247,253,144,119,120,143,182,105,112,122,122,
+138,249,124, 62, 66, 91,255,248, 79,255,132,239,125,239,123,120,255,151,191, 68,211, 52,225, 57,126, 99, 27,144, 41,133,103, 63,
+251, 89,252,151, 63,251, 51,124,250,211,159, 30,225,116,233,207,179, 44, 11,110, 72,186,128, 44,203,194,131, 75,191,205, 65, 52,
+ 88, 45,197,  1,182,126,107, 45,218,182, 69,211,182,112,206, 97, 58,153,132,107,207,102,179,224,214,148, 64, 70,222,251,209,102,
+112, 80,103,100,197,247,237, 68, 96,230,251,104,219, 22,235,213, 10,219,237, 22,211,233, 20, 69, 81,192, 24,  3,173, 53,242,162,
+192,245, 15, 63,196,219,111,191,141,255,249,119,127,135,187,119,238, 96,179,217,192, 19,  0,248,127,182,  1,153, 82,248,210,151,
+190,132,175,253,233,159, 98, 49,159,  7, 24,201, 11,200,214,158, 17,181,192,139, 41,173,159, 79, 69,140,225, 99,183, 17,252, 63,
+ 16, 78,  3, 47, 82,219,117,152, 77,167, 97,115,138,162, 24,197,154, 17,158,167,  5,229,239,117,125,143,186,174,209,245, 61, 12,
+221, 87, 79,215,102,  3,225,141,170,171, 42, 24, 24,  7,110,109, 12, 84,150,161, 44, 75, 20,101,137,174,109,241,211,159,254, 20,
+ 63,121,231, 29,252,228,237,183,113,227,198,141, 95, 59,159, 72,110,128,210, 26, 95,254,242,151,241,213, 55,222,192,156,142, 63,
+ 47,120, 88,120,122, 88,249, 49, 14,142,177, 59,226, 13, 11, 27,112,192,255,243,  6,176, 43, 50, 90,195, 24, 19, 54, 32,143, 50,
+227,216,250,229,  6, 55, 77, 19,172,221, 82, 28,145,167,129,255, 23,103,209,174,239,177,221,110, 67,188, 97,247,202,107, 96,204,
+ 64,159,221,190,125, 27,255,235, 71, 63,194,219,111,189,133, 95,252,252,231,255,124,138,  6,192,159,199,139,255,250,235,175,227,
+245,175,124,  5,243,217, 44, 88,190, 49, 38,208,  3,169,119,185,232,108,245, 90, 88,190, 76,194,216, 90, 51,250,200,139,198,139,
+202,191,163,148,  2,188, 71, 71,176,148,131,120, 81, 20, 35, 67,144,159,103,156, 97, 39,178,102,118,135,241, 41,149,208,214,211,
+ 66,247,125,143,166,105,194,117, 84,244,236,179,217, 12, 79, 92,185,130, 79, 63,249, 36, 30,122,232, 33,156, 44,151,216,172,215,
+191,230,  6,100, 25,222,248,218,215,240,229,215, 95,199,185,163,163,224,219,195,113,167,223, 73,157,  2,249,181,116, 79,241,239,
+197,249, 64,240,231,226,154, 50,142,240, 27,199,  8,165, 20,138,162,216, 63,  1,194,  0,194,198,136,132,173,167,128, 44,145, 90,
+223,247,163,216,101,  9, 26,231,121, 14, 67,207,108,140, 65, 73,236, 44,111,162,124,198,249,124,142,199, 30,123, 12, 79, 63,253,
+ 52,202,201,  4, 63,255, 21, 79, 67,112, 65,231,206,159,199,183,190,245, 45,188,244,210, 75, 56, 90, 44, 70, 15,205,150, 42, 33,
+165, 92, 28, 25,116,247, 78,132,240,205,242,251,169,192,201,239,140, 82, 36, 69,225,  9, 45, 25,173, 49,159,207,  3, 12,150, 49,
+ 68, 34, 35,240,102, 18,199,180,217,110,135,  5,213, 58,184, 34,222, 80,201,200, 42,165,208, 81, 54,174,148,194,234,244, 20, 39,
+ 39, 39,184,120,241, 34,242, 60, 15,255,131, 93, 25,255,127,  0,168,235, 26,239,190,251, 46,190,253,237,111, 99,189, 90,253,223,
+159,128,231,158,123, 14,255,245, 47,254,  2, 87, 30,127, 28,139,249, 60,  4, 43,165, 84,  8,178,236,251,226,133,148, 46, 71, 90,
+112,216, 12,233,118,132,191,150,113, 32, 70, 70,242, 20,240,  3,202,235, 74, 43,142, 99, 83, 42, 47,136,239,155, 23,159,249, 37,
+134,171,236,218,188,247,232,218, 22,206,123,148,101,137,237,118, 59, 58,185,155,205, 38, 24,  4,159, 70,254,249,133, 11, 23,240,
+194, 11, 47,224,131,235,215,113,239,238,221,143,223,128,167,159,121,230,207,191,249,205,111,  6,254, 70,107, 13,107, 45,202,178,
+ 28, 61, 92,252, 32, 33,249, 74, 88,124, 88,244,136, 32,147,167, 73, 90,105,124, 50,100,102,172,148, 26, 78,129,181,200,201, 93,
+228, 84, 47,136, 93, 86,202, 29,202,205,224,235,  4, 74,131,  2, 51, 95, 83, 22,129, 44,185, 39,165, 20,202,162,192,122,189, 70,
+215,117, 48,198,224,252,133, 11, 35, 96, 16,146,204, 44,131,166,204,253,185,231,158,  3,128,143,117, 73,234,115, 87,175,  2, 64,
+ 88,112,107, 45,180, 82, 33,250, 75,146,139, 23, 94,243,194, 75, 11, 22,254, 44,184,  4,250,158, 34,107, 83,148, 29,139,149,  9,
+ 31,179,136, 39,210,145, 69,243,169,236,201, 37, 65,  4, 76,105,253, 35, 88, 43,232, 17, 25, 51,120,241,229,102, 72, 18, 47,203,
+ 50, 20,130,254,232,251, 30,199,199,199, 33, 22,236,  8, 37, 49,194,226,211, 83, 22,  5, 52,185, 52,231, 61, 62,255,249,207,227,
+ 43, 95,253, 42, 20,253,239,116, 73, 82, 36, 81,140,  8,140, 49,163, 84, 94, 30,113, 21, 33, 12,  9, 39,101, 80,221, 91,104,233,
+ 14,232,231, 50,176,203, 13,201,196,207, 37, 94,215, 90, 67,211,105,236,105,161,242, 40,248,142,114, 11, 50,160,140, 16,150, 12,
+206, 61, 17,127,177, 27,226,205,224,  4,174,169,107,204,230,115,180, 77,  3, 99, 12,150,203, 37, 38,147,  9,180,214, 40,203,114,
+244,127,229,198, 27,173, 97,180,198, 31,188,240,  2,178, 44,195,119,190,243, 29,180, 77,147, 40,207,146,181,  3,128, 86, 10,  5,
+  5,154,192,102, 70,254, 62, 69, 39,179,149,239,185, 24,105,229,  7, 18,177,248,243,140, 16,  6,195, 94,165, 84,192,253,158, 32,
+105,211,182, 33, 96, 34,113, 63,  1,165,208,137,115,244, 51,166,185, 25,210,242,115,179,123,100,151, 35,223,172,181,232,187, 14,
+ 57,229, 31, 23, 47, 94,132,214, 26,211,233, 52,184, 66, 94,120,173, 53,114,226,174,216,131,216,190,199, 51,207, 60,131, 63,250,
+227, 63,134,206,243,253, 13,200,232,  2,  0,160,141,  9, 46, 68,137,239, 75, 50, 77, 50,156, 42,225,191,165,127, 15, 31,227,223,
+161, 19, 49,242,223, 34, 56,243, 38,168,136, 89,101, 43,141,171,106,242,132,166,226,129, 18,240,152, 51,237, 56,144, 75, 56,202,
+207,109,180,198,108, 62, 71,223,247,  3, 45,190, 88,160,156, 78,161,180,198,114,185, 28,242,  4,250,123, 25,136,229, 73,208,  4,
+ 99,255,224,249,231,241,218,107,175,141,248,176,160,138, 96,107,103,235,144,148,  3, 91,129, 60,194,217, 30,152, 77,159,146,189,
+ 19, 16,185,165, 24, 17,141,174, 67, 22, 37,173, 90,146,128,241,145,151,150, 31,111,146,220, 12, 43,  8,181, 80,165,163, 83, 34,
+ 51, 94,  6, 35,222,123, 56,186, 15, 38,239,182,155, 77, 72,214,202,178, 68,223,247,168,234, 26, 69,158,  7, 55,206,245,236,172,
+235,208, 57,135,178, 44,241,242, 75, 47,193, 89,139,239,127,255,251,193, 61, 42,208,131, 26, 99,194, 81,149, 55,109,173, 13,214,
+ 58, 90,124, 97,217, 18,117,248,120, 65,229,251,190, 15,186,191, 89,  7, 16,145,116, 29, 18, 81,197,185,200, 94, 18, 38,  3,179,
+176, 74, 25,180,115, 50, 58, 54, 50,118, 35, 50, 96, 51,147, 90,237,118,128,247,176,125, 31,114,130,158,104,139, 60,207, 81,144,
+123,153, 16,117,195, 44, 48,127,174,148,194,185,115,231,240,234,171,175,226,197, 23, 95, 20,  6, 67,255,144,143,184, 33,180, 50,
+ 98, 44, 19, 22, 31, 47,122,204,116,198, 27, 19,163,158, 56,136,199,144,213,138, 69,214, 74,  5,190, 62,150,160,200, 35, 31,223,
+ 71, 12, 85,131,175,167,  0, 25,200, 57, 66, 50,210,141,133,  4,144,138, 66,124, 42,202,201,100, 88,232,201,  4,198, 24,228,121,
+142,166,105, 80,148, 37,234,186,198,106,185, 68,158,231,  1,218, 22,101, 57, 32, 76, 65,217,191,242,202, 43,120,228,145, 71,216,
+149, 15,190,154,143, 78,236, 78,172,181,193,234, 51,177,248, 50,147, 77, 45,124, 42, 48, 38, 93, 81,180,  9,  1,182,146,213, 27,
+ 99,130,144,171, 20, 73,143, 68, 71,108,189, 41, 42, 67,210, 40,206,185, 16,216,  3,172,165,140,182,160, 69, 27,197,  0, 99, 48,
+153, 78, 81,148, 37, 76, 81, 12,240,211, 90,204,230,115, 76,166, 83,104,173,177, 94,175, 81,215, 53,118,219, 45,142,142,142,194,
+243, 44,142,142,134,196, 78, 84,  0, 45, 81, 34, 69, 81,224,229,171, 87,161,180,134,226,165,208, 34,121,226, 55, 46,223,177,107,
+ 10,  8, 72, 66, 60, 97,141,113, 54,187,151, 20, 69,112, 51,222,  8,127,192,189,177,159,150, 22,202, 11, 47,177,191, 20,  1,240,
+230, 72,  3,144,238,197,210,207,140, 49,131,239,142, 98,128, 68, 68,206, 57, 56,162,182, 79, 79, 78,144,231,121, 64, 64, 77,219,
+222,223,104,165,240,208,165, 75,104,219, 22,155,245,122,160,179,  5,146,155, 76, 38,152, 77,167,152, 78,167,184,112,254, 60, 62,
+243,153,207, 64,  5,151, 34,162,115,202,189,248,216,125, 36,104,135, 20, 85,145, 60,  5,188,192,156,128, 37,114, 10, 31,113, 68,
+188,128, 57,225,244,142,202,142,114,225,101,205, 89,  6,228,120,241, 89,  4,198, 11,220,245,125, 72,168,164,  2,143, 93,145,117,
+ 14, 74,107,204, 72,159,180, 89,175,  3,220, 60, 90, 44,134,210,105, 81,192,246, 61,218,166,193,100, 54, 27,174,217,117,152,204,
+102, 33,111,240,228, 90, 89,253,177,152,207, 15,171,163, 25, 10,202, 27, 98,182, 16,145,165,159, 85, 28, 63, 35,  9,216,183,252,
+ 67,247, 34,138,250,146,147,231,100, 43,  6,  8,169, 56, 36, 17,157, 44, 28,201,224, 44,197,  5, 18,  0,148, 69, 17,170,100,198,
+ 24,172, 86, 43,212,117,141,201,116,138,249,124, 14,219,247,216,108, 54,208, 68, 77,192,123, 44, 22, 11, 84, 85,133,122,183,187,
+ 15,169, 41,195,103, 99, 48,198,220,223,128, 81,150, 42,248,115,149, 58,  9,  7, 22, 54, 46,200,164, 24,208, 56, 14,248, 68,133,
+ 12,226, 84, 72, 84,195,  6, 97,164,139,161,251,180, 66,101,145,188,158,184,183,156, 54,144, 13,136,209,144, 44,234, 51, 97,199,
+155, 98,  5,162,241,  4, 69,  1,192, 20,  5,166,211,233, 80,212,161, 83, 85, 87, 21,156,181,152, 83, 37,209, 57,135,178, 40, 48,
+153, 76, 80,150, 37,114,170,234,121,112,127, 64,194, 69,  4,122,129,240,174,181,118,175, 40,157, 90,240, 36,250, 73, 36, 97,136,
+ 22,122, 47,120, 71,155,144, 58,101,172,148,144,  5,248,179, 72, 57, 41, 32, 96,229,134,230,228,140, 92, 25,187, 34,182,246,212,
+ 41, 41,203,114,168, 89, 55, 13,142, 22, 11, 28, 29, 29, 97,179,217, 12, 18, 23,165, 48,161, 18,170, 33, 55,197,155, 39, 11, 84,
+ 76,183, 27,196,148,177,120, 72,182, 58, 38,168,156,115, 67, 96, 57, 64, 46, 73, 42, 57,165,126, 56,116, 18,178, 68, 57,241,227,
+ 54,149, 23,107, 84, 44,250,152,205,226,123,147,226, 49,  9,101,165, 20,222, 11,177, 88,128,168,121, 14, 77, 39,162,109, 91, 44,
+ 79, 78,194, 38, 77,167, 83,116,125, 15,103, 45, 12,233, 90,251,190, 71, 78,238,139,107, 12,147,201,  4,206,251, 16,196, 21,179,
+138,225, 61,162,  3, 82,  5, 15, 31, 45,120,106, 19,246,172, 93, 34,161, 67,137, 89,164,112,115,194,237,201,148,223, 69, 52,134,
+ 22,185,139, 36,227,246, 42,111,130, 87,146,137, 22,187, 28, 94,252,160,206,163, 13,225,211, 16,199,141,245,122,141,147,123,247,
+ 80, 78, 38, 56, 62, 62,134,179, 22,155,205,  6,125,215,193,  8,101, 69, 57,153, 12, 65,154,174, 23,128, 68,215, 65, 33,  1,253,
+100,246, 40, 57, 32, 62, 54,103,249,217,189,120,146,250, 24, 37,101,238,128,202, 77,110,188,132,115,133,168,  7,200, 83,151,186,
+191, 44,170, 57,135,223, 37,106,187, 19,138,108,201,121, 41,165, 80,150,229,136, 41,182,214,162, 35,216, 57,153, 76,144, 41,133,
+187,119,239, 14,148,196,100, 18,146, 51,195, 37, 77,173,209,145, 52,134,121,173,166,105,  6, 24,107, 12,224,253,125, 24, 42,249,
+ 25,169, 84, 72, 21, 53,152,158,216,251,249, 33,173,140,116, 67, 18, 98,210,123,170,182,124,200,173,132,218,  2,163, 26, 82,209,
+ 85, 85,181, 39,222,149,174, 71,107, 29, 98,138,124,150, 44,203, 70,149, 48, 73, 71, 56,113, 58, 56, 54,228,100,217, 76,242,157,
+156,156, 96,181, 90, 97, 62,159,227,194,241,241,160, 73,173,235,251, 53, 11,239,135,216,153,101,152,206,102, 40,138, 98,168,180,
+145, 43, 50,114, 97,108, 92,120,161,155,222, 17, 49,181,231, 43,197,105,201, 82,137, 86,204,144,198,191,155,162, 57, 14, 72,207,
+195, 38,  9, 52,196,190, 56,203, 50,148,137, 26,177, 92,108,201,238,202,197,231, 24,199,207, 36,105, 25, 25,  3,216,215, 75,195,
+204,178, 12, 93,215,225,238,157, 59,120,248,225,135,199, 98,  1,231,144,211,198, 58,239,225,233,239,140, 49,104,182, 91, 56,231,
+ 80,215,181,128,161,226, 65,227,138, 23,223,164,132,161,214,218,225,194,241,226,127, 12,230,207, 82, 68,220, 25,180,197, 30,199,
+ 79,208,144, 51, 85,246,213, 92, 96,137,221, 97,138, 19,226, 86, 40, 22,  2,179,  8, 56,112,248, 66, 20, 16,171, 48,228,189, 24,
+ 99, 80, 78, 38, 88,173, 86,104,219, 22,147,201,  4, 71,231,206, 13, 39, 68,107, 52,117, 61, 64, 88,214, 29,  9,215,214,117, 29,
+202,162,184,223,164, 39,249,148, 56, 14,112,224, 83,  7,152,199, 36,245, 28, 23,102, 34,154,195,127, 76,226, 37, 73,183, 56, 31,
+144, 20, 68,219,182,129,117,116, 36,165,145,127, 31,171,239,228,  9,231,103, 27, 81, 14, 98,161,120,227,100,198, 45,101,244, 92,
+138,188,125,251, 54,238,221,189,139,163,163, 35,228,121,142,106,183,131, 39,133,181,230,120,165, 84,112,209, 92,176,209,198, 12,
+ 27,224, 36,121, 37,234,182, 25, 45, 24, 87,167, 98,110,197, 37,178, 80, 28, 42,208,124, 12,130, 58,132,166,226,160, 26, 47, 68,
+ 31, 89, 23,243, 70, 41, 88, 43, 23, 78,178,159,242,122,114,179,249,251, 49, 10,228,255, 83,150, 37,142,142,142,176, 94,173,176,
+ 92, 46,241, 24, 81, 18, 69, 89, 14, 25, 58,  9,203, 10,206,  5,178, 12, 93,211, 64, 41,133,182,235, 80, 87, 21,148, 39,127,197,
+ 21,160,192,  9, 37, 84,199,142, 45, 46,166,126, 15, 20, 92, 66, 16,162,119, 31,159, 32, 81,204,207, 14,104, 70, 37, 10,139,121,
+ 39, 99, 12, 12,249,126,185, 81, 62,186, 70,124, 93, 67,156, 18, 47,178,204,124,229,166,132,250, 46,209,206,129,132,227, 32, 76,
+144,114,177, 88,224,131, 15, 62,192,102,187, 69,145,231,152,207,231,208,198,160,239, 58,116, 84, 62,117,180, 30,225,228,101, 25,
+202,201,  4,134,143, 47, 43, 22,120, 51, 92,148, 84, 73,218, 90, 30, 99, 21, 87,185, 18,150,183, 39,212, 74, 48,160, 62,194,252,
+242,123, 82,101,237,163,250,174,166, 56,208,146, 66,129, 19,156,164,  4, 68,168, 61,152,144,235,163, 90, 64,236, 94,227, 46,204,
+174,239,209, 19,180,228,205, 45, 39, 19, 44,151, 75,220,187,115,  7,231,207,157, 27,130, 56,197, 22,254, 60, 47,138,128,176, 90,
+170, 31,228,198,192,120, 74,146, 88,135,153,114,  3, 28,136,186,174, 11, 13,119,225,253,  0,247, 63,242,223, 31,179,224, 72,180,
+ 48, 73, 12, 31,208, 11,113, 63,177,251,146,106,234, 84,117, 46,174,160,245, 36,127,103,186, 61,150,219,199, 20,119,208, 19,137,
+ 56, 25, 19,119,143, 60,250, 40,110,221,186,133,255,240, 59,191,131, 60,207, 49,157,205,194, 41,208, 81, 91,149, 22,140,174,145,
+ 62,109,100,185,194,255,115,214,  6,  0, 59,194,219,113,131, 92,172,  9,197, 33,138, 57,177,224, 42,209,184, 17,159,136,184,  3,
+ 82,234,254, 51,165, 70,253,  4,135,228,239,161, 51,134,122,199, 24,239,199, 89,116,252,191, 66,193,134,172,152, 99, 15,255, 77,
+211, 52, 88, 44, 22,120,255,151,191,196,127,250,253,223,199,241,133, 11, 35, 69,133,228,161, 24,113,221,231,130,168, 24, 35, 89,
+ 78, 25,148,229,162,177, 27, 96, 81, 43,136,172, 11, 15,113,198,130,199,139,157,  9,152,155, 90,236, 67, 27, 32, 85,212, 44, 87,
+ 47,242, 28, 59,234,255,146,192, 64, 26, 85,104, 87,165, 77,154,205,102, 48,132,238,228,  6,201, 66, 79, 74, 73,205,139,202,240,
+213,210, 61, 77, 72, 35,244,222, 47,126,129,201, 51,207,220, 87, 61,144, 75,148, 48,190,107,219, 80, 25, 51,153, 40,142,196, 90,
+ 77,169,112, 46,104,247,249, 98,206, 57, 40,194,206,129, 51, 74,248,254,176,224,  9,247,227, 18,139,140,132,208, 74,  6,217, 88,
+  1, 97,140, 65, 81,150, 67, 79,153,176, 54,249, 55,142, 92, 84,219,182,208, 74,225,104,177,  8,113, 32,134,150,210, 35,196,174,
+136,117, 62,242,247,180,168, 45, 88,231,240,238,187,239,226,137, 79,125, 10, 57, 41, 36,156,247,128,240, 22,124, 10,114, 18,191,
+153, 61,205, 62, 91,126,148,177, 74, 78, 62, 21,148, 83, 46,200, 71,110,104,143,212, 59,227,116,140,126, 47,225, 86,164,236,144,
+147, 40,153,165,202, 92,161, 23, 69, 24, 54, 32,174,168,241,194,103, 66, 62, 25,187,174, 17,157,109, 12, 50,239,161, 68,166,204,
+235,178,152,207,177, 90,173,198,144, 85, 92, 87, 54,186, 56,242, 38,102, 68, 31,167,168,  1,162, 40,194,142, 43, 21, 84,  4,163,
+230,139,196, 73, 58, 52, 88, 35,213, 97, 19,147,112, 92, 89,114,145, 79,142,185,253, 92,244, 14, 75,221,191,188,127,166, 45,152,
+120,235,  5,197, 32, 75,149,177,223,143, 51,234, 80, 21,164,191,239,186, 14, 77,211,160,105,154, 16,212, 79,150,203,144,224,177,
+120, 87,214, 21,248, 36,122, 42, 12,153, 84,  6,155, 69,  5,114, 45, 52, 57, 82, 27, 31,138,206,146,204, 59, 64, 45, 28, 90,112,
+217,221, 46,239,197, 31,112,101,210,138, 36, 69, 13,  0,109,211, 12,165,194,201,228,254,105, 98, 45, 41,185, 14, 41,187,148,126,
+ 61,238, 49,142, 79,162,244,255,177,122,155, 81,207,209,209, 17,250, 15, 62, 64, 83,215,161,227, 50,206,101,164,235,180, 28,132,
+ 71, 42,  4,153, 92, 69,228, 26, 31, 85, 57,116, 67,138,159, 14,185, 22, 28,192,250,201, 77,226,251,144, 10,140,  3, 39, 71, 42,
+159,165,133,199, 56, 62, 14,172,103,125, 95,102,220,123,201,160,115, 48,121,126, 63, 87, 34,235,230,161, 34, 69, 81,192, 59,135,
+ 15, 63,252, 16,231, 47, 92, 24,209,229,220, 80, 50,146, 87,134, 13, 72, 80,  5, 35,249,160, 56,158,220, 65,210,117,221, 72,174,
+120, 22, 71,116, 40, 43,141, 33,104,170, 40,147,186, 70,140,215, 89,  4, 85,215,117,128,206,177,245,202, 19,196,165, 65, 43, 71,
+ 38, 68,150, 30,171, 45, 70,136, 42,203,224,100,  7, 15,117,221,111,169,177,251,218,181,107,120,242,169,167, 70, 48,151, 79, 67,
+181,219,161, 33,165,117, 81,150,247,201, 56,159,232, 78,137, 31, 66, 50,145, 93,223, 67, 19, 22,102,153,246, 89, 45,168,169, 90,
+109, 60,128, 73,138,189, 92,130,142,136,143,190,164,152, 21, 41,147,229,181, 36, 39, 31,199, 14,105,137, 49, 18,226,153, 67,113,
+126, 98,157, 11,254,159,107,209,252,222, 52, 13, 50,165, 48,155,207,113,235,214,173, 80, 46,141, 93,119,215,117, 65, 35,148,101,
+ 25,140, 79, 80,  6, 18,130, 58,241, 51, 14,118,121,158,163,109,219, 32, 99,148,141,124,177,111,151,232,232,172,138,215, 33, 42,
+ 34, 94, 56,230,105,226,241,  8, 69, 81,160,239,186, 97, 34, 10, 17, 94,210,144,120, 88, 71, 32,217, 36,161, 39,146, 58,173, 20,
+242,168,  1,208, 18, 32, 96,  8,202,198,200, 45,179,252,183,214, 90,108,214,107,220,254,232,163,209,224, 17, 94, 35,126, 30,110,
+ 32,183,214,194,100, 17, 93, 32,231, 56,248, 51,132,183, 93,215,193, 79, 38,201, 62,223, 67, 62, 53, 85,108, 65,164,162, 59, 43,
+ 35,150,238, 39,190, 78,128,151,130, 42,  1,117, 60, 74,216, 39,209,140, 76,236,228,233, 25,157, 56,225,158,117,158, 67,115, 25,
+149, 54,206, 90,139,150,144, 80, 85, 85,216,237,118,216,110, 54,232,218, 54,120,  6, 54, 28,107, 45,170,170, 66,219,182, 65,216,
+101, 82,130,172, 24, 13,113,207, 20, 39, 27,198, 24, 84,117, 61,238,255,194,253, 97,124,123,149,169,152,  9,149,138,  8,225, 91,
+ 15,117, 77,198,244, 64,223,247,131,178, 32,106,168,208, 90,135, 69, 97,171, 15,240, 79,148, 22, 57, 27,150,113, 33, 84,192,200,
+218, 37,157, 30,126,207,251, 80, 92, 97,119,210,118, 29,218,166, 25,180, 63,147,  9, 46, 28, 31,227,198,205,155,161,206, 44,103,
+ 87,180, 77,  3,109, 12,102,116, 95, 74,169,241,  6,248,216,250,152, 67, 23, 41,183,247,126,208, 82, 82,243,116,198, 52, 46,245,
+ 79, 37,229,138,169,158,  2, 81, 71,254, 56, 58,226, 80,153, 82,  6,114,206, 60,251,168,143,215,139,209,  7, 65,102, 40, 40,231,
+152, 82, 80, 66,166, 51,218,120, 25, 35,200,133,177,112,184,200,243,208,216,200,242,245, 15, 63,252, 16,199, 23, 47,142, 59,112,
+138,  2,166,239,131,166,200, 89, 59,176,161,158,118, 55,  5, 23, 67, 11,191, 96, 19,181,214, 80,100,109,140, 58,152,214,149,250,
+202, 84, 11,145, 44,222,251, 68,118,123,168, 56, 51, 98, 69,163,123,149,174,164, 35, 74,194,  8,245,155,204, 29,  0,160, 21,215,
+  9,106,139,  4,112,224,160, 27, 43, 51, 36,213,209,247, 61, 90, 49,157,171,105, 26,120,231,112,235,214, 45, 60,243,123,191, 55,
+122,182,190,109, 81, 85, 85, 72,220,192, 65, 56,149,132,200,250,111, 28,  0, 57,203, 99, 40,154, 42,130, 39,191, 78,212,129, 67,
+162, 37, 78,139, 63, 35, 72, 75, 50,142,239,131,181, 62, 60, 23, 78,206,130,144,127, 35,185,127, 41,191, 31, 37, 90,214,194, 69,
+153,126,220,155, 44, 93, 22,103,182, 93,215,161,170, 42, 84, 85,  5,  0, 88, 46,151,  1,  9,113,204,100,174, 42,232, 76,181, 30,
+130,112,150,104,184,  8, 86,168,212, 64, 38,209,226, 51,146, 48,198,132,169, 34,241, 28, 55,159,144, 29,142, 18, 44,105,233,226,
+  4,166,170, 95,103, 13,  4,137,169,137, 64, 15,183,109,208,101,114,192,147,194, 94, 69, 49, 65,142, 55,235, 73,205,236, 19,160,
+ 96,143,144,163,133,103,  5,116,136,  5,228, 90,  0, 96,183,219,  5, 99,181,148,116,113,214, 94,215, 53,106, 10,220,  6,114,192,
+197, 33, 26, 88,164,242,124, 81, 46, 62,199,110, 32, 38,157, 70, 13, 29,  9,154, 34, 86, 50, 28,170, 13,140,240,184, 64, 48, 28,
+236,248,235, 78, 44,196,174,170, 70, 67, 96, 99,215,193, 69, 28,110,178, 54,220,172,205,255, 87,248,252,216, 75,132, 46, 24, 99,
+  6,139,110, 26,104,165, 80, 85, 21,238,221,187,135,205,118, 59,140,101, 35,218,158, 71, 25, 44,151, 75,236,170,106,168, 19,100,
+217, 16,  3, 36, 39, 62,202, 62,197, 64,189,216,205,140,228,125, 20,248,242, 60, 15, 69,253, 20, 17,151,154,148, 24, 99,252,179,
+ 20,114, 50, 75,149,115, 65,165,206,  7,  0,214,171,213,168,173, 40,238,176,148,195,252,130,242,193,185, 17,207,115, 72,161, 33,
+239, 37, 19, 94,161,109,219,  1,130,110,183, 33, 64,243,243, 54,117,141,213,106,133,211,211,211, 97, 38, 42, 53,117, 59,231, 96,
+ 88, 19,106, 83,202,231,104,113,184,154,196,197,232,140, 38,224, 26, 99,144,115,122, 79,169,126, 38, 10, 59,135, 84,  5,114,254,
+ 68,204, 66,166, 80, 79,120,120,177, 25, 13, 85,182,164, 74,186,109, 91,204,154,  6,115,154,123, 17, 10,239,236, 58,200,141,142,
+148,207, 89,  6, 37, 79,  0, 97,253, 61,  8, 76,168,176,237,186,161, 48, 67, 16,157,209,215,116, 58,133,202,178,209,224,191,134,
+ 96,234,185,115,231,208,118, 29,182,155, 13, 60,157, 86,195,205,  3, 18, 53, 72,109,103, 70, 15, 44,131, 72,128,127,162,237, 83,
+182,129,198,104, 37, 37, 57,116,  9, 25, 99,138,157, 60, 36,212, 98,203,231,222, 49,214,247, 79,167, 83, 84,116,196,251,190, 71,
+ 79,238,169,161,  5,145, 67, 58,226, 96, 45,179, 94, 47, 44, 93,198,  9, 43, 50,102, 93,150, 40,200, 61,183,212, 31,160,133,218,
+ 66,150, 79,101,207,242,108, 54,195,116, 58, 29, 88, 89,151,168,127,166, 70,199,112,242,163,  4, 21,192,124,183,244,197,204,121,
+200, 38,185,184, 74, 21,187,186, 56,144,230,162, 91, 63, 62, 33,222,123,100,162,200, 18, 55,228,149,147,  9,106,202, 74,243,162,
+  8,147,216, 75,146,  9, 90, 49,111, 66,142,196, 57,132,245, 33,122,232,242, 60, 15,149,193,160,172,238,186,161,217,142,202,180,
+ 70,107, 76, 72, 45,119,243,230, 77, 92,190,124, 57,244, 19,179, 27, 83, 74, 97,181, 90, 81, 16,142,230, 56, 28,122,240,216, 63,
+243,  6,236,104,214,154, 34,157,166, 84,154,197, 11, 61,154, 57, 17,181,154, 30,146, 35,198,138,181,152,195,145,115,126,120,224,
+171,119, 14, 29,249,232,197, 98, 17,166,162,240,201,130,208,185,118,125, 31,178,219,152,140,211,137, 33, 32, 18,140, 72,151,215,
+182, 45,170,186,198,233,106, 53,140,177,161, 38, 14, 83, 20, 56, 71, 82, 21,134,171,203,229, 18,119,239,222,189, 79, 71,103,130,
+110,149, 92,121, 44,247,102,  9,139, 76, 76, 60,249, 85,173, 53,244, 25, 52,115,236,223, 15,113,239,113,160,142,121,168,184,101,
+ 41,110,228, 54,132,208,118,187,221,125,242, 75,184, 79,166, 36,100, 37,207, 71, 19,192, 98,191, 31,244, 61,226, 99,252, 51,174,
+ 22,206,166, 83,180, 77,131, 13,117,203, 24,173,209, 91, 27,166, 50,158,158,158, 98,181, 90, 13,227,119,138,130,116, 65,137,102,
+231, 94,  8,139,226,214,211,184, 27,134, 79,  0, 79, 52, 60,212, 47, 48,154,173, 35,160,175, 60,154,103,149, 49,189,247,208,228,
+ 71,157,184,159, 82,184,  5,  9, 26,154,186, 30, 70, 21, 19,111,197, 99,243, 57, 65,146, 42,235, 56, 33, 11, 68, 28,183,226,138,
+210,226,168,154, 70,110,136,131,112,215,117,129,202,168,118, 59,244,214, 98,117,122,138,187,119,239,162,170,170,209,240, 39,  0,
+ 48,177,168, 41,142,  7,169,252, 32,158, 86, 37,253,187,236,170,145,200, 74,102,159,169,215,  2, 72,  9,114,247,180, 64, 66,197,
+ 16,183, 20,197,243,133,186,174,195,122,189,198,226,232,  8,206,185, 16, 87,164, 27,100, 96, 97, 69,112,149, 60,146,146,185,144,
+ 82,  1, 21, 73, 57, 35, 67, 80,102, 66,119,187, 29, 90,106,194,240,222,163,169,170,  1,251,239,118,  3,253,192, 11, 79,109,171,
+134,103,107, 86, 85, 53,170, 36,237,233,242, 19, 83,173,138, 60, 15, 29,127,220,255, 42, 45,112,111,100,101,170, 67, 62, 66, 62,
+ 54,130,163,146,204,138, 55, 48, 12,141, 37,183, 35, 55,191,216,110,  3, 53,205, 57,129,108,194,147, 61, 16, 78, 36,115, 49,239,
+100,  5, 76,239, 89, 19, 36,160,167,167, 56, 18, 42,113,194,149, 43,165,176,221,110,177, 60, 61, 69, 79,241,130, 65,202,108, 54,
+195, 29,  0,134,199,206,112,144,136, 27,216,226,114, 99, 56,150,212,104,198, 68,156, 21,115,255, 83,243,219, 82,197,239,100, 91,
+ 83,162,150,156,211, 32, 17,185,153,114,100,129,142, 38,232, 50, 49,198,247, 50,165, 70,105,134,162,220, 25,207,227,102, 92, 20,
+216,153, 29,117, 18, 98, 83,188, 40,138,  2, 37, 25, 28,215,  4,154,166, 65, 77,133, 22,166,237, 37, 34,156, 77,167, 88,139, 17,
+104,114,  8,136, 97, 30,166,166,155,145, 74,  3, 45,146,171,152,254,149, 11,196,101, 74,105, 57, 49,172,149,110,202,201,169,234,
+137, 18,165, 84, 39,247,180, 24,135,200,185,  0, 93, 69,230,217, 19,223,239,196,160,214,158,104, 96, 54, 34,118, 33,150, 78, 68,
+ 75, 42,230, 64,222, 81,  0,149, 30,129, 45,158,239,131, 93, 55,187,177,134, 42, 93, 28, 23, 23,139,  5,154,166, 25, 32,103,219,
+142,158,183, 38,137,167,201, 34,157,191,148,242,201,241, 91, 49, 38,150,141,211,220,115,107,157,131,141,212,105,241, 34,203,210,
+165, 75,100,224,136,168,241,148, 80, 86, 14,214, 11, 83, 94, 40, 39,225,124,132, 19, 29,231, 28,118, 84,133,226,134, 10,182,218,
+174,239,  7,164, 98, 76, 24, 16, 46, 27,181, 37,241, 22, 98, 16,137,186,156,152,184,107, 73, 49,199,243,172,229,218,221,188,121,
+115,232,134,164,252,198,121,143,135, 46, 94, 28, 10,248,222,195, 88,145,112,100,162,  1, 46,158, 40, 37,221,  4, 19, 81, 33, 23,
+216,237,  6, 58, 66,140, 56,139,149,205,161,199, 76, 10,186,162, 65, 73, 41,169, 74,170,211, 61,116,184, 16, 58,145,253,107,252,
+ 55, 21,229, 39,211,233, 20,117, 85, 13,155, 50,155,161,164, 97,124, 44, 19,  9, 98, 45,242,233,188,169, 41,151,169,178, 12,208,
+ 26, 69,150,  1,162,  9,187,110, 26,212, 44,117,167,198, 12,118,207, 60,131,154,217, 80,103, 45,214,155, 13, 86, 12, 83,229,172,
+184, 84,159,173,117, 14,153, 88, 32, 89,233, 79, 77,175,141, 19, 23, 89, 73,219, 75,232, 68, 16,  5,171,211, 18,101, 72,159, 16,
+208,  6, 20, 70,228, 22, 43, 29, 24,217,176, 75, 89,173,215,152, 76, 38,184,120,241, 98,200, 98, 59,145,120, 49,101, 33, 11,229,
+ 41,  5, 30,183, 24,197,131,101,123, 58, 13, 25, 53, 92,120,239,  3,236,237,186, 14, 91,  2,  3,114,192,121, 77, 53,135, 48,178,
+140,253,219,161,196, 72, 90,117, 30, 77, 84, 12, 13,208,162,254,170,196, 64,138, 34, 33,251,142,133,185,253,129,222,227, 84,151,
+140, 44,148,123,231,144, 69,136, 43, 52, 67, 83,137,210,146, 85,242,230,196,226,168, 64, 97,208, 96, 37, 38,207,100, 64,102,244,
+ 35,  3,243,136, 92,164,231,204,148, 66,181,219, 13,100,156,181, 88,158,158, 66,122, 24,118,199,125,223,135,154,136,225,116,156,
+253, 92,140,201,229,  6,104, 65,218,133, 14,114, 94,104,178, 66,153,170,167,134, 55, 73,168, 25,187,158,148,184, 75,139,137, 94,
+113, 60,104,187, 14,158, 94, 33,169,174,235,208, 14, 84, 85, 21, 86,171, 21, 54,155, 13,242, 60,199,165, 75,151, 48,159,207, 71,
+250,165,208,124, 40,220,140,156,148, 30,247,  7,199, 39, 53, 32, 25,154,170,213, 52, 13,118,187, 93, 64, 90,121, 81,  4, 84,196,
+ 11,239, 40,145,148,242,124,195, 71, 72,214,114, 83,178, 18,217, 42,100,157, 67, 30,213,129, 25,246,229,121, 30,220,128, 19,181,
+130, 67,139, 28,143, 68,142,171, 93,169, 19, 32,  5, 82,172, 81,229,216,210, 52, 13,150,203, 37, 78, 78, 78,208,117, 29, 46, 94,
+188, 56, 12, 93, 37, 40,106,133,134,167, 35, 14,135,221,149, 49,  6, 77,219,134,110,120,110,196, 75,161, 58, 70, 87, 46, 86,  0,
+138,211,188, 38, 94, 40, 12,152,141, 84,223,148,144,233, 32, 39,137,219,126, 98, 55,196, 62,212,  8,139,151,189,183,123,170,103,
+ 65, 87, 28, 74,232,112, 70,149, 44,165,170, 11,121,138,214,208, 98,180,152,115, 14,125,219, 34,163,225,120,109,219, 98,179,217,
+224,248,248, 24,115,122,117,167,160,140,176, 22, 53,189,156,149,148,184, 48,244,118,226, 36,  4,119, 41,220, 88, 72,196,200, 69,
+ 49, 28,237,173, 13, 52,132, 38, 68,228,  4, 64,224,156, 41, 52,197,132,177,149,  2, 47, 75,210, 73,106,230,181,214,152, 16,165,
+ 26,  6, 94,136,  5,110,154, 38, 28, 83, 62,  9,121,180,152,146, 74, 72,225,250, 67,172,169, 68, 97, 35, 53, 91,215,193,208,189,
+ 48, 85, 60,235,123,108,214,107, 44,151, 75, 84,117,141,123,247,238, 97, 58,157,134, 23, 99,144,167, 74,206,  2,226,225,123,117,
+ 93,135, 83,145,  2, 14,  1,189,113,114, 38, 80, 98,156, 72, 90,154, 17,225,  5, 69,195, 49,131, 73, 77, 99,173, 69,211,117,168,
+118, 59,100,212,190, 41,135, 99,243,  8,128,120,138,148, 28,214, 23, 72, 42, 57, 12, 67,104,244,229, 72,176, 67,228, 94,234, 53,
+  6,124,244,114, 38, 78, 36, 74, 74, 41, 24,106, 27,229, 69,109,154,  6,203,147, 19,172,214,107,220,190,125, 27, 77, 93,163, 41,
+ 75,172,215,235,144, 27,152,162,  0,  8,  5, 49,133,109,  8,159, 91,138, 11,204,221,239,197, 29, 81,168, 41,138,  2,104, 91, 52,
+ 20, 63,131, 52, 38,234,182, 12, 74,136,178, 12,192, 67,139,193,230,198,211,241,155, 76,167,123, 67,241,120, 40, 29,143,237,226,
+197,142,199,126,133,151,158,162,122,192, 89,242,148,184,  6, 28, 47,184,172, 64,133, 90, 52,161, 29, 67, 80,153,135,162,246,212,
+ 37,223, 25,131,150, 94, 29,239,206,157, 59,216, 85, 21,234,166, 65, 57,153,224,233,167,159,198,165,135, 31, 30, 93,191,205, 50,
+228,100, 88,204,224, 86, 85, 53,212, 13,120,146,138,128,164,204,  7,201,207, 57, 25, 11,191, 39, 74,152,153, 82,152,208,164, 21,
+103,109, 56,  5,108,253,204,157,193,123, 42, 73, 10,171,149, 40, 33,206,140,115,177,  0,241, 20, 90,153,213,198, 69,153,152,138,
+ 24,189, 40, 67,162, 22,124,232,149, 50, 70, 42,102, 81,171,104,182, 91,108, 54, 27,236,126,171,177,119,  0,  0,  2,206, 73, 68,
+ 65, 84,118, 59,228,121,142, 25,128,106,183,195,148, 70,200, 72,132,199,125,190,146,130,150,180,  2, 15,212,107,232,197,127,216,
+247, 59, 41, 40,227, 53,145,129, 89,142,244,177, 22,179,217, 12, 43, 10,194,185,156, 44, 73,180,  8,195, 83,211,117, 29, 26, 78,
+ 92, 68,237,210,123, 31, 38, 99,121,162,115,195, 28,207,104,248,133,161,105, 80,188, 73,129,150, 16,173, 64, 41, 69, 68,220,123,
+155,137,121,112,161,205,147, 11,222,252,114, 87, 81,128,102, 56,185, 88, 44, 70,254, 27,192,240,170,123, 98,182,  4,128,176,113,
+210,184, 24,  5,  5,185,137, 40,164, 56, 81, 27,224,207,101,125, 92,146,117,153,112,171, 53, 21,226, 83,221, 65,124,221,193,  5,
+ 17,127, 35, 19, 12, 69, 11, 33,155,203,100,191,112,140,203, 25, 31, 55,162, 90,212, 11,148, 32, 37,126,178,217,205,104,141, 76,
+136,  1,248,232, 59, 33,131, 73,141, 39,230,205,110,  9,245,116,109,139, 83,122,169, 17, 69, 10, 57, 69, 90,125,153,179, 56, 42,
+158,112,220,200,148, 10, 35,229,249,101,170, 88, 11,203,229, 67,153,187,184,232,217,246, 52,174,194, 32,184,198,192,181,228, 76,
+180,114, 57, 58, 81, 25, 48, 52,233,105, 10,104,  0,  6, 13, 60,177,126,124, 51, 74,142,174,164, 28, 64,186, 25,249, 66,155,124,
+131,187,170, 66, 71, 86,176,247,138, 71, 52, 67, 39, 12,  1, 20, 15, 16,203, 87,226,124, 36,188,200, 27, 33,150,144,132,209, 98,
+201,226, 74, 93, 85, 88,158,156,132,105,133,172, 96,227,190,134,150,192,  7, 23,108,182,219,237,208,110,196,197, 22, 97, 12, 46,
+114, 53,146,154, 72, 17,137, 18,150, 50,114, 98,113,150,117, 46,240, 96, 33, 19,102, 77,165,124,117, 33, 14, 80,101, 89, 98, 50,
+153,132,  1,213,169, 49,241,178,148,201,242,188,188, 44, 71,163,123,101, 33, 91, 74,202,195, 56, 74, 17, 99,152, 70,144,245, 87,
+230,107,120,209, 55,155,205,200, 18,173,152,232,251,232,163,143,226,242,229,203,152,209, 75,225, 90,231,  0,122,105,196,160,164,
+163,211,204, 19,208,121,174,167, 87,106,152,243,198, 69,123,218,144,150,105,110, 97, 48,225,100, 18, 49,168, 34, 96,161,201,224,
+216, 21,247, 17, 41,105,186,174,195, 71, 31,125,116, 95,116,171,245,253, 57, 65,121, 14, 80,225,165, 44,138, 33,251,229,128,196,
+ 92, 12,249, 75,134,109, 85, 85, 13, 20, 65,228,171,227,217,211, 18, 59,143,116, 68,209, 76, 33,239,253,160,191,140, 40,226, 94,
+  8,104,229,171, 44, 49, 50, 89,204,231,120,255,253,247, 67,158,192,244,181, 38,151,215, 81,198,203,226,179,166,174, 67,241,158,
+101, 36, 77,211,160, 37, 94,200, 37, 12,110,143, 32,228, 87,103,162,181,104,154, 38, 12,238,246,228,254, 60,185,160,170,174,  7,
+ 20, 84,148, 37, 86,171,213,240,178, 75, 50,173,150,252, 63, 89,167,162, 76, 81,186, 19,185,192, 76, 90,181,109, 59,200,252,132,
+164, 59,140, 50, 16,175,178, 33,199,  9,164, 50,229, 84,214,204,110,145,255,215,150,168,240,176,168,125,143,140, 90, 86, 89,168,
+165,  8, 20,100, 81, 39, 13,191,122,119, 71,214, 45,135,175, 42,238,135, 38, 35,203,164, 98, 46,158,125, 23,189, 46, 50,207, 34,
+109,154, 38,232,146,156, 76,112,133,225,253, 31, 32,  1, 67,246, 69,185,191,176,  0,  0,  0,  0, 73, 69, 78, 68,174, 66, 96,130,
+  0};
+
diff --git a/source/blender/editors/datafiles/preview.blend.c b/source/blender/editors/datafiles/preview.blend.c
index 77749fd..a9dc29c 100644
--- a/source/blender/editors/datafiles/preview.blend.c
+++ b/source/blender/editors/datafiles/preview.blend.c
@@ -1,767 +1,859 @@
-/* DataToC output of file <preview1_blend> */
+/* DataToC output of file <preview_blend> */
 
-int datatoc_preview_blend_size= 495540;
-char datatoc_preview_blend[]= {
- 66, 76, 69, 78, 68, 69, 82, 45,118, 50, 53, 56, 82, 69, 78, 68, 32,  0,  0,  0,
-  0,117,192,137,255,127,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0, 20,  0,  0,  0,112,114,101,118,105,101,119,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 71, 76, 79, 66, 32,  1,  0,  0, 16,116,192,137,255,127,  0,  0,
-199,  0,  0,  0,  1,  0,  0,  0, 32, 32, 32, 49,  1,  0,  0,  0,250,  0,  0,  0,  1,  0,  0,  1,248,239, 48,  3,  0,  0,  0,  0,
- 40,147, 49,  3,  0,  0,  0,  0,  0,  0,  0,  2, 64, 32,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 47,100,115,107, 47,100, 97,116,
- 97, 47,115,114, 99, 47, 98,108,101,110,100,101,114, 47, 98,108,101,110,100,101,114, 47,115,111,117,114, 99,101, 47, 98,108,101,
-110,100,101,114, 47,101,100,105,116,111,114,115, 47,100, 97,116, 97,102,105,108,101,115, 47,112,114,101,118,105,101,119, 49, 46,
- 98,108,101,110,100,  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,  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,  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,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 87, 77,  0,  0, 24,  1,  0,  0, 40,217, 31,  3,  0,  0,  0,  0,106,  1,  0,  0,  1,  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,
- 87, 77, 87,105,110, 77, 97,110,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,200,239, 16,  3,  0,  0,  0,  0,200,239, 16,  3,  0,  0,  0,  0,200,239, 16,  3,  0,  0,  0,  0,
-200,239, 16,  3,  0,  0,  0,  0,  3,  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,  0,  0,  0,  0,  0,
- 16,  0,  0,  0,  2,  0,  0,  0,  2,  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,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,136, 85,  3,  2,  0,  0,  0,  0,136, 85,  3,  2,  0,  0,  0,  0,136, 85,  3,  2,  0,  0,  0,  0,
- 72, 26,251,  2,  0,  0,  0,  0, 72, 26,251,  2,  0,  0,  0,  0, 72, 26,251,  2,  0,  0,  0,  0, 68, 65, 84, 65,224,  0,  0,  0,
-200,239, 16,  3,  0,  0,  0,  0,107,  1,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-176,162,211,  1,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,248,239, 48,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-115, 99,114,101,101,110,  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,
-  1,  0,  6,  0,126,  7, 28,  4,  0,  0,  0,  0,  1,  0,  5,  0,238,  3,  5,  0,  1,  0,  0,  0,168,128,  3,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,104,169,  3,  3,  0,  0,  0,  0,
- 40, 31, 17,  3,  0,  0,  0,  0, 40, 31, 17,  3,  0,  0,  0,  0,104, 29,251,  2,  0,  0,  0,  0,200, 27,251,  2,  0,  0,  0,  0,
-152, 28,251,  2,  0,  0,  0,  0,152, 28,251,  2,  0,  0,  0,  0,184, 50,251,  2,  0,  0,  0,  0,248,253, 57,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 83, 78,  0,  0,216,  0,  0,  0,248,239, 48,  3,  0,  0,  0,  0,
-193,  0,  0,  0,  1,  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, 83, 82,115, 99,114,101,101,110,  0, 45, 83, 99,114,105,112,116,105,110,103,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,146,192,  1,  0,  0,  0,  0,248,241, 48,  3,  0,  0,  0,  0,
-104,242, 48,  3,  0,  0,  0,  0, 72,250, 48,  3,  0,  0,  0,  0,184,250, 48,  3,  0,  0,  0,  0, 88,135, 49,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40,147, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 15,  0, 14,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 76, 85,140,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 32,  0,  0,  0,  8,146,192,  1,  0,  0,  0,  0,194,  0,  0,  0,  1,  0,  0,  0, 88, 11,223,  1,  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, 68, 65, 84, 65, 32,  0,  0,  0,
- 88, 11,223,  1,  0,  0,  0,  0,194,  0,  0,  0,  1,  0,  0,  0, 24,145,192,  1,  0,  0,  0,  0,  8,146,192,  1,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 28,  4,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 24,145,192,  1,  0,  0,  0,  0,
-194,  0,  0,  0,  1,  0,  0,  0,248,196, 20,  3,  0,  0,  0,  0, 88, 11,223,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-126,  7, 28,  4,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,248,196, 20,  3,  0,  0,  0,  0,194,  0,  0,  0,  1,  0,  0,  0,
-120,181, 20,  3,  0,  0,  0,  0, 24,145,192,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 32,  0,  0,  0,120,181, 20,  3,  0,  0,  0,  0,194,  0,  0,  0,  1,  0,  0,  0,248,152,192,  1,  0,  0,  0,  0,
-248,196, 20,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  4,  1,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,
-248,152,192,  1,  0,  0,  0,  0,194,  0,  0,  0,  1,  0,  0,  0,184,154,  3,  2,  0,  0,  0,  0,120,181, 20,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,126,  7,  1,  4,  1,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,184,154,  3,  2,  0,  0,  0,  0,
-194,  0,  0,  0,  1,  0,  0,  0,248,137, 17,  3,  0,  0,  0,  0,248,152,192,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 16,  6,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,248,137, 17,  3,  0,  0,  0,  0,194,  0,  0,  0,  1,  0,  0,  0,
- 40,148, 17,  3,  0,  0,  0,  0,184,154,  3,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16,  6,  1,  4,  1,  0,  0,  0,
- 68, 65, 84, 65, 32,  0,  0,  0, 40,148, 17,  3,  0,  0,  0,  0,194,  0,  0,  0,  1,  0,  0,  0,168,185,  3,  2,  0,  0,  0,  0,
-248,137, 17,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,196,  3,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,
-168,185,  3,  2,  0,  0,  0,  0,194,  0,  0,  0,  1,  0,  0,  0,248, 34,  4,  3,  0,  0,  0,  0, 40,148, 17,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,196,  3,  1,  4,  1,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,248, 34,  4,  3,  0,  0,  0,  0,
-194,  0,  0,  0,  1,  0,  0,  0, 24,241, 48,  3,  0,  0,  0,  0,168,185,  3,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-196,  3,216,  2,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 24,241, 48,  3,  0,  0,  0,  0,194,  0,  0,  0,  1,  0,  0,  0,
-136,241, 48,  3,  0,  0,  0,  0,248, 34,  4,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16,  6,216,  2,  0,  0,  0,  0,
- 68, 65, 84, 65, 32,  0,  0,  0,136,241, 48,  3,  0,  0,  0,  0,194,  0,  0,  0,  1,  0,  0,  0,248,241, 48,  3,  0,  0,  0,  0,
- 24,241, 48,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,196,  3, 12,  3,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,
-248,241, 48,  3,  0,  0,  0,  0,194,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,136,241, 48,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 16,  6, 12,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,104,242, 48,  3,  0,  0,  0,  0,
-195,  0,  0,  0,  1,  0,  0,  0,216,242, 48,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24,145,192,  1,  0,  0,  0,  0,
- 88, 11,223,  1,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,216,242, 48,  3,  0,  0,  0,  0,
-195,  0,  0,  0,  1,  0,  0,  0, 72,243, 48,  3,  0,  0,  0,  0,104,242, 48,  3,  0,  0,  0,  0, 88, 11,223,  1,  0,  0,  0,  0,
-120,181, 20,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 72,243, 48,  3,  0,  0,  0,  0,
-195,  0,  0,  0,  1,  0,  0,  0,184,243, 48,  3,  0,  0,  0,  0,216,242, 48,  3,  0,  0,  0,  0, 24,145,192,  1,  0,  0,  0,  0,
-248,152,192,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,184,243, 48,  3,  0,  0,  0,  0,
-195,  0,  0,  0,  1,  0,  0,  0, 40,244, 48,  3,  0,  0,  0,  0, 72,243, 48,  3,  0,  0,  0,  0,248,152,192,  1,  0,  0,  0,  0,
-120,181, 20,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 40,244, 48,  3,  0,  0,  0,  0,
-195,  0,  0,  0,  1,  0,  0,  0,152,244, 48,  3,  0,  0,  0,  0,184,243, 48,  3,  0,  0,  0,  0,184,154,  3,  2,  0,  0,  0,  0,
-248,196, 20,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,152,244, 48,  3,  0,  0,  0,  0,
-195,  0,  0,  0,  1,  0,  0,  0,  8,245, 48,  3,  0,  0,  0,  0, 40,244, 48,  3,  0,  0,  0,  0,248,152,192,  1,  0,  0,  0,  0,
-248,137, 17,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,  8,245, 48,  3,  0,  0,  0,  0,
-195,  0,  0,  0,  1,  0,  0,  0,120,245, 48,  3,  0,  0,  0,  0,152,244, 48,  3,  0,  0,  0,  0,184,154,  3,  2,  0,  0,  0,  0,
-248,137, 17,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,120,245, 48,  3,  0,  0,  0,  0,
-195,  0,  0,  0,  1,  0,  0,  0,232,245, 48,  3,  0,  0,  0,  0,  8,245, 48,  3,  0,  0,  0,  0,248,152,192,  1,  0,  0,  0,  0,
-248,196, 20,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,232,245, 48,  3,  0,  0,  0,  0,
-195,  0,  0,  0,  1,  0,  0,  0, 88,246, 48,  3,  0,  0,  0,  0,120,245, 48,  3,  0,  0,  0,  0,  8,146,192,  1,  0,  0,  0,  0,
-120,181, 20,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 88,246, 48,  3,  0,  0,  0,  0,
-195,  0,  0,  0,  1,  0,  0,  0,200,246, 48,  3,  0,  0,  0,  0,232,245, 48,  3,  0,  0,  0,  0,  8,146,192,  1,  0,  0,  0,  0,
- 40,148, 17,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,200,246, 48,  3,  0,  0,  0,  0,
-195,  0,  0,  0,  1,  0,  0,  0, 56,247, 48,  3,  0,  0,  0,  0, 88,246, 48,  3,  0,  0,  0,  0,184,154,  3,  2,  0,  0,  0,  0,
- 40,148, 17,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 56,247, 48,  3,  0,  0,  0,  0,
-195,  0,  0,  0,  1,  0,  0,  0,168,247, 48,  3,  0,  0,  0,  0,200,246, 48,  3,  0,  0,  0,  0,168,185,  3,  2,  0,  0,  0,  0,
-120,181, 20,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,168,247, 48,  3,  0,  0,  0,  0,
-195,  0,  0,  0,  1,  0,  0,  0, 24,248, 48,  3,  0,  0,  0,  0, 56,247, 48,  3,  0,  0,  0,  0,168,185,  3,  2,  0,  0,  0,  0,
-248,137, 17,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 24,248, 48,  3,  0,  0,  0,  0,
-195,  0,  0,  0,  1,  0,  0,  0,136,248, 48,  3,  0,  0,  0,  0,168,247, 48,  3,  0,  0,  0,  0,168,185,  3,  2,  0,  0,  0,  0,
- 40,148, 17,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,136,248, 48,  3,  0,  0,  0,  0,
-195,  0,  0,  0,  1,  0,  0,  0,248,248, 48,  3,  0,  0,  0,  0, 24,248, 48,  3,  0,  0,  0,  0,248, 34,  4,  3,  0,  0,  0,  0,
- 40,148, 17,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,248,248, 48,  3,  0,  0,  0,  0,
-195,  0,  0,  0,  1,  0,  0,  0,104,249, 48,  3,  0,  0,  0,  0,136,248, 48,  3,  0,  0,  0,  0,184,154,  3,  2,  0,  0,  0,  0,
- 24,241, 48,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,104,249, 48,  3,  0,  0,  0,  0,
-195,  0,  0,  0,  1,  0,  0,  0,216,249, 48,  3,  0,  0,  0,  0,248,248, 48,  3,  0,  0,  0,  0,248, 34,  4,  3,  0,  0,  0,  0,
- 24,241, 48,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,216,249, 48,  3,  0,  0,  0,  0,
-195,  0,  0,  0,  1,  0,  0,  0, 72,250, 48,  3,  0,  0,  0,  0,104,249, 48,  3,  0,  0,  0,  0,168,185,  3,  2,  0,  0,  0,  0,
-248, 34,  4,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 72,250, 48,  3,  0,  0,  0,  0,
-195,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,216,249, 48,  3,  0,  0,  0,  0,248,137, 17,  3,  0,  0,  0,  0,
- 24,241, 48,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0,184,250, 48,  3,  0,  0,  0,  0,
-197,  0,  0,  0,  1,  0,  0,  0,104,  3, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,120,181, 20,  3,  0,  0,  0,  0,
- 88, 11,223,  1,  0,  0,  0,  0, 24,145,192,  1,  0,  0,  0,  0,248,152,192,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,126,  7,  0,  0,  2,  4,  0,  0, 28,  4,  0,  0,  7,  7,127,  7, 27,  0,  1,  0,  0,  0,  0,  0,  7,  0,  8,  0,
-184, 96,194,  1,  0,  0,  0,  0, 40,214,222,  1,  0,  0,  0,  0, 40,214,222,  1,  0,  0,  0,  0,168,251, 48,  3,  0,  0,  0,  0,
- 24,253, 48,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 75,  8,  2,  0,  0,  0,  0,
-104,103,  7,  2,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0,168,251, 48,  3,  0,  0,  0,  0,198,  0,  0,  0,  1,  0,  0,  0,
- 24,253, 48,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,192,156, 68,  0,  0,  0,  0,  0,  0,208, 65,
-  0,  0,  0,  0,  0,224,239, 68,  0,  0,  0,  0,  0,  0,208, 65,  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,126,  7,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,
-  0,192,239, 68,  0,  0,200, 65,  0,192,239, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,
-  4,  0, 12,  0, 10,  0,127,  7, 26,  0,127,  7, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,126,  7,  0,  0,  2,  4,  0,  0, 27,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-127,  7, 26,  0, 16,  0,  1,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-200, 98,194,  1,  0,  0,  0,  0, 56,178, 56,  3,  0,  0,  0,  0, 56,178, 56,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 88,146, 49,  3,  0,  0,  0,  0,216,165, 24,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0, 24,253, 48,  3,  0,  0,  0,  0,198,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,168,251, 48,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,107, 69,  0,128,206,195,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,192,237, 68,  0,  0,  0,  0,  0,192,121, 68,110,  7,  0,  0,127,  7,  0,  0,  0,  0,  0,  0,230,  3,  0,  0,
-  0,  0,  0,  0,103,  7,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,109,  7,  0,  0,  0,  0,  0,  0,230,  3,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  2,  0,  0,  0,  1,  0,  3,  3,
-  2,  0,  0,  4, 10,  0,127,  7,231,  3,110,  7,231,  3,  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, 28,  4,  0,  0, 28,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-216, 97,194,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,136,254, 48,  3,  0,  0,  0,  0,
-200,  1, 49,  3,  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, 68, 65, 84, 65, 88,  1,  0,  0,136,254, 48,  3,  0,  0,  0,  0,196,  0,  0,  0,  1,  0,  0,  0,
- 40,  0, 49,  3,  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,
- 73, 78, 70, 79, 95, 80, 84, 95,116, 97, 98,115,  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,  0,  0,
- 73, 78, 70, 79, 95, 80, 84, 95,116, 97, 98,115,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,220,255,208, 14, 36,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,
- 40,  0, 49,  3,  0,  0,  0,  0,196,  0,  0,  0,  1,  0,  0,  0,200,  1, 49,  3,  0,  0,  0,  0,136,254, 48,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 73, 78, 70, 79, 95, 80, 84, 95,118,105,101,119,  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,  0,  0, 73, 78, 70, 79, 95, 80, 84, 95,118,105,101,119,  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,  0,  0, 86,105,101,119,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,122,254,208, 14, 98,  1,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  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,
+int datatoc_preview_blend_size = 575216;
+char datatoc_preview_blend[] = {
+ 66, 76, 69, 78, 68, 69, 82, 45,118, 50, 54, 50, 82, 69, 78, 68,
+ 32,  0,  0,  0,128,173,121, 86,255,127,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0, 20,  0,  0,  0,112,114,101,118,
+105,101,119,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 71, 76, 79, 66, 48,  4,  0,  0,128,169,121, 86,
+255,127,  0,  0,216,  0,  0,  0,  1,  0,  0,  0, 32, 32, 32, 51,  3,  0,  0,  0,250,  0,  0,  0,  1,  0,  0,  1,152,133, 23,  4,
+  0,  0,  0,  0, 72, 41, 24,  4,  0,  0,  0,  0,  0,  0,  0,  2, 64, 32,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 47,100,115,107,
+ 47,100, 97,116, 97, 47,115,114, 99, 47, 98,108,101,110,100,101,114, 47, 98,108,101,110,100,101,114, 47, 46, 47,115,111,117,114,
+ 99,101, 47, 98,108,101,110,100,101,114, 47,101,100,105,116,111,114,115, 47,100, 97,116, 97,102,105,108,101,115, 47,112,114,101,
+118,105,101,119, 46, 98,108,101,110,100,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,200,  1, 49,  3,  0,  0,  0,  0,196,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 40,  0, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 73, 78, 70, 79, 95, 80, 84, 95, 98,111,116,116,111,109, 98, 97,114,  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,
- 73, 78, 70, 79, 95, 80, 84, 95, 98,111,116,116,111,109, 98, 97,114,  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,
- 32,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0, 86,254,208, 14, 36,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  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,  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, 68, 65, 84, 65,160,  0,  0,  0,
-104,  3, 49,  3,  0,  0,  0,  0,197,  0,  0,  0,  1,  0,  0,  0,248, 79, 49,  3,  0,  0,  0,  0,184,250, 48,  3,  0,  0,  0,  0,
-184,154,  3,  2,  0,  0,  0,  0,248,137, 17,  3,  0,  0,  0,  0,248,152,192,  1,  0,  0,  0,  0,248,196, 20,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 17,  6,  0,  0,126,  7,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  4,  4,110,  1,  1,  4,  2,  0,
-  0,  0,  0,  0,  7,  0,  0,  0, 88, 92,194,  1,  0,  0,  0,  0,184, 78, 49,  3,  0,  0,  0,  0,184, 78, 49,  3,  0,  0,  0,  0,
- 88,  4, 49,  3,  0,  0,  0,  0,200,  5, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 72,142, 25,  3,  0,  0,  0,  0,184, 10, 25,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0, 88,  4, 49,  3,  0,  0,  0,  0,
-198,  0,  0,  0,  1,  0,  0,  0,200,  5, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,148, 67,
-  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,  0,183, 67,  0,  0,  0,  0,  0,  0,208, 65,  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,109,  1,  0,  0,
-  0,  0,  0,  0, 25,  0,  0,  0,  0,128,182, 67,  0,  0,200, 65,  0,128,182, 67,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,110,  1, 26,  0,110,  1, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 17,  6,  0,  0,126,  7,  0,  0,231,  3,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,110,  1, 26,  0, 17,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,200, 95,194,  1,  0,  0,  0,  0,248,170, 28,  3,  0,  0,  0,  0,248,170, 28,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24,148,243,  3,  0,  0,  0,  0,184,236,  3,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0,200,  5, 49,  3,  0,  0,  0,  0,
-198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 88,  4, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,193, 67,
-  0, 96,132,196,  0,  0,  0,  0,  0,  0,  0,  0,180,252,184, 67, 55, 97,132,196,  0,  0,  0,  0, 93,  1,  0,  0,110,  1,  0,  0,
-  0,  0,  0,  0,230,  3,  0,  0,  0,  0,  0,  0, 94,  1,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0, 92,  1,  0,  0,
-  0,  0,  0,  0,230,  3,  0,  0,  0,  0,128, 67,  0,  0, 40, 66,  0,  0,  0, 69,  0,  0,225, 67,  0,  0,  0, 63,  0,  0,  0, 64,
- 10,  3,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,110,  1,231,  3, 93,  1,231,  3,  0,  0, 88,234,  3,  3,  0,  0,  0,  0,
-  5,  0,  0,  0,  4,  0,  0,  0, 17,  6,  0,  0,126,  7,  0,  0,  0,  0,  0,  0,230,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,110,  1,231,  3, 18,  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,120, 93,194,  1,  0,  0,  0,  0, 88,111, 27,  3,  0,  0,  0,  0,136,197, 56,  3,  0,  0,  0,  0,
- 56,  7, 49,  3,  0,  0,  0,  0, 88,237,  6,  2,  0,  0,  0,  0, 72, 82,  3,  2,  0,  0,  0,  0,200, 43, 26,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0, 56,  7, 49,  3,  0,  0,  0,  0,
-196,  0,  0,  0,  1,  0,  0,  0,216,  8, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,104, 94,194,  1,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 66, 85, 84, 84, 79, 78, 83, 95, 80, 84, 95, 99,111,110,116,101,120,116,  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, 66, 85, 84, 84, 79, 78, 83, 95, 80, 84, 95, 99,111,110,116,101,120,116,  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, 67,111,110,116,101,120,116,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,220,255,113,  1, 36,  0,  0,  0,  0,  0,  0,  0, 38,  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,  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,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 88,  1,  0,  0,216,  8, 49,  3,  0,  0,  0,  0,196,  0,  0,  0,  1,  0,  0,  0,120, 10, 49,  3,  0,  0,  0,  0,
- 56,  7, 49,  3,  0,  0,  0,  0,120,  3,131,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95,
- 99,111,110,116,101,120,116, 95,108, 97,109,112,  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, 68, 65, 84, 65, 95, 80, 84, 95,
- 99,111,110,116,101,120,116, 95,108, 97,109,112,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,184,255,113,  1, 36,  0,
-  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0, 39,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,120, 10, 49,  3,  0,  0,  0,  0,
-196,  0,  0,  0,  1,  0,  0,  0, 24, 12, 49,  3,  0,  0,  0,  0,216,  8, 49,  3,  0,  0,  0,  0,232,  6,131,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95,112,114,101,118,105,101,119,  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, 68, 65, 84, 65, 95, 80, 84, 95,112,114,101,118,105,101,119,  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, 80,114,101,118,105,101,119,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24,255,113,  1,136,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0, 40,  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,  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,
- 68, 65, 84, 65, 88,  1,  0,  0, 24, 12, 49,  3,  0,  0,  0,  0,196,  0,  0,  0,  1,  0,  0,  0,184, 13, 49,  3,  0,  0,  0,  0,
-120, 10, 49,  3,  0,  0,  0,  0, 24, 10,131,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95,
-108, 97,109,112,  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,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95,
-108, 97,109,112,  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,  0,  0, 76, 97,109,112,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 85,254,113,  1,171,  0,
-  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0, 41,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,184, 13, 49,  3,  0,  0,  0,  0,
-196,  0,  0,  0,  1,  0,  0,  0, 88, 15, 49,  3,  0,  0,  0,  0, 24, 12, 49,  3,  0,  0,  0,  0, 72, 16,131,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95,115,104, 97,100,111,119,  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, 68, 65, 84, 65, 95, 80, 84, 95,115,104, 97,100,111,119,  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, 83,104, 97,100,111,119,  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, 87, 77,  0,  0,
+ 88,  1,  0,  0,168,130, 23,  4,  0,  0,  0,  0,146,  1,  0,  0,  1,  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, 87, 77, 87,105,110, 77, 97,110,  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, 25,254,113,  1, 36,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0, 42,  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,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72,132, 23,  4,  0,  0,  0,  0, 72,132, 23,  4,  0,  0,  0,  0, 72,132, 23,  4,
+  0,  0,  0,  0, 72,132, 23,  4,  0,  0,  0,  0,  3,  0,  0,  0,  1,  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,  8,199,197,  4,  0,  0,  0,  0,  8,199,197,  4,
+  0,  0,  0,  0, 16,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0, 88,239,223,  2,  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,  0,  0,232,117,167,  2,  0,  0,  0,  0,200,119,167,  2,  0,  0,  0,  0,232,117,167,  2,
+  0,  0,  0,  0,216,118,167,  2,  0,  0,  0,  0,200,119,167,  2,  0,  0,  0,  0, 88,111,224,  2,  0,  0,  0,  0, 88,239,223,  2,
+  0,  0,  0,  0, 88,111,224,  2,  0,  0,  0,  0, 68, 65, 84, 65,  0,  1,  0,  0, 72,132, 23,  4,  0,  0,  0,  0,147,  1,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 48,121,167,  2,  0,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,152,133, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,115, 99,114,101,101,110,  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,  0,  0,  0,  0,  0,  0,  0,  0,  5,  0, 28,  0,118,  7,  4,  4,  0,  0,  0,  0,
+  1,  0,  5,  0,238,  3,  5,  0,  1,  0,  0,  0,  8,221,211,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,152,109,225,  2,  0,  0,  0,  0,200, 99,254,  3,  0,  0,  0,  0,200, 99,254,  3,
+  0,  0,  0,  0, 72,230,185,  2,  0,  0,  0,  0,152, 79,254,  3,  0,  0,  0,  0,120,229,185,  2,  0,  0,  0,  0,120,229,185,  2,
+  0,  0,  0,  0, 24,  2,  9,  4,  0,  0,  0,  0, 40, 29,212,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 83, 78,  0,  0,  8,  1,  0,  0,152,133, 23,  4,  0,  0,  0,  0,210,  0,  0,  0,  1,  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, 83, 82,115, 99,
+114,101,101,110,  0, 45, 83, 99,114,105,112,116,105,110,103,  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,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,248,212,144,  2,  0,  0,  0,  0,248,195,224,  2,
+  0,  0,  0,  0, 40,174,218,  2,  0,  0,  0,  0,152,140, 23,  4,  0,  0,  0,  0, 40,215,248,  3,  0,  0,  0,  0,120, 29, 24,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72, 41, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,
+  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,188, 22,173,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,248,212,144,  2,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,120, 23,190,  2,
+  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, 68, 65, 84, 65,
+ 32,  0,  0,  0,120, 23,190,  2,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0, 72,228,  8,  4,  0,  0,  0,  0,248,212,144,  2,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  4,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 72,228,  8,  4,
+  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0, 56,224,211,  2,  0,  0,  0,  0,120, 23,190,  2,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,118,  7,  4,  4,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 56,224,211,  2,  0,  0,  0,  0,211,  0,  0,  0,
+  1,  0,  0,  0,216,225,211,  2,  0,  0,  0,  0, 72,228,  8,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,118,  7,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,216,225,211,  2,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,120,227,211,  2,
+  0,  0,  0,  0, 56,224,211,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,236,  3,  1,  0,  0,  0, 68, 65, 84, 65,
+ 32,  0,  0,  0,120,227,211,  2,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,168,  1,  9,  4,  0,  0,  0,  0,216,225,211,  2,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,118,  7,236,  3,  1,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,168,  1,  9,  4,
+  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,232,  4,  9,  4,  0,  0,  0,  0,120,227,211,  2,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 12,  6,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,232,  4,  9,  4,  0,  0,  0,  0,211,  0,  0,  0,
+  1,  0,  0,  0, 40,244,211,  2,  0,  0,  0,  0,168,  1,  9,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 12,  6,236,  3,
+  1,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 40,244,211,  2,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0, 72,112,225,  2,
+  0,  0,  0,  0,232,  4,  9,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,192,  3,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 32,  0,  0,  0, 72,112,225,  2,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0, 40, 18,224,  2,  0,  0,  0,  0, 40,244,211,  2,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,192,  3,236,  3,  1,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 40, 18,224,  2,
+  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,152, 18,186,  2,  0,  0,  0,  0, 72,112,225,  2,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,192,  3,200,  2,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,152, 18,186,  2,  0,  0,  0,  0,211,  0,  0,  0,
+  1,  0,  0,  0,184,201,188,  2,  0,  0,  0,  0, 40, 18,224,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 12,  6,200,  2,
+  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,184,201,188,  2,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,248,195,224,  2,
+  0,  0,  0,  0,152, 18,186,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,192,  3,252,  2,  0,  0,  0,  0, 68, 65, 84, 65,
+ 32,  0,  0,  0,248,195,224,  2,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,184,201,188,  2,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 12,  6,252,  2,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 40,174,218,  2,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,184,255,223,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,120, 23,190,  2,
+  0,  0,  0,  0, 72,228,  8,  4,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,184,255,223,  2,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,120,211,185,  2,  0,  0,  0,  0, 40,174,218,  2,  0,  0,  0,  0,120, 23,190,  2,
+  0,  0,  0,  0,216,225,211,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,120,211,185,  2,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,136, 61,249,  3,  0,  0,  0,  0,184,255,223,  2,  0,  0,  0,  0,120,227,211,  2,
+  0,  0,  0,  0, 72,228,  8,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,136, 61,249,  3,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,184, 94,254,  3,  0,  0,  0,  0,120,211,185,  2,  0,  0,  0,  0,216,225,211,  2,
+  0,  0,  0,  0,120,227,211,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,184, 94,254,  3,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,232,134, 23,  4,  0,  0,  0,  0,136, 61,249,  3,  0,  0,  0,  0, 56,224,211,  2,
+  0,  0,  0,  0,168,  1,  9,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,232,134, 23,  4,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 88,135, 23,  4,  0,  0,  0,  0,184, 94,254,  3,  0,  0,  0,  0,120,227,211,  2,
+  0,  0,  0,  0,232,  4,  9,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 88,135, 23,  4,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,200,135, 23,  4,  0,  0,  0,  0,232,134, 23,  4,  0,  0,  0,  0,168,  1,  9,  4,
+  0,  0,  0,  0,232,  4,  9,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,200,135, 23,  4,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 56,136, 23,  4,  0,  0,  0,  0, 88,135, 23,  4,  0,  0,  0,  0, 56,224,211,  2,
+  0,  0,  0,  0,120,227,211,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 56,136, 23,  4,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,168,136, 23,  4,  0,  0,  0,  0,200,135, 23,  4,  0,  0,  0,  0,248,212,144,  2,
+  0,  0,  0,  0,216,225,211,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,168,136, 23,  4,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 24,137, 23,  4,  0,  0,  0,  0, 56,136, 23,  4,  0,  0,  0,  0,248,212,144,  2,
+  0,  0,  0,  0, 40,244,211,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 24,137, 23,  4,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,136,137, 23,  4,  0,  0,  0,  0,168,136, 23,  4,  0,  0,  0,  0, 40,244,211,  2,
+  0,  0,  0,  0,168,  1,  9,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,136,137, 23,  4,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,248,137, 23,  4,  0,  0,  0,  0, 24,137, 23,  4,  0,  0,  0,  0,216,225,211,  2,
+  0,  0,  0,  0, 72,112,225,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,248,137, 23,  4,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,104,138, 23,  4,  0,  0,  0,  0,136,137, 23,  4,  0,  0,  0,  0, 72,112,225,  2,
+  0,  0,  0,  0,232,  4,  9,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,104,138, 23,  4,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,216,138, 23,  4,  0,  0,  0,  0,248,137, 23,  4,  0,  0,  0,  0, 40,244,211,  2,
+  0,  0,  0,  0, 72,112,225,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,216,138, 23,  4,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 72,139, 23,  4,  0,  0,  0,  0,104,138, 23,  4,  0,  0,  0,  0, 40,244,211,  2,
+  0,  0,  0,  0, 40, 18,224,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 72,139, 23,  4,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,184,139, 23,  4,  0,  0,  0,  0,216,138, 23,  4,  0,  0,  0,  0,152, 18,186,  2,
+  0,  0,  0,  0,168,  1,  9,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,184,139, 23,  4,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 40,140, 23,  4,  0,  0,  0,  0, 72,139, 23,  4,  0,  0,  0,  0,152, 18,186,  2,
+  0,  0,  0,  0, 40, 18,224,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 40,140, 23,  4,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,152,140, 23,  4,  0,  0,  0,  0,184,139, 23,  4,  0,  0,  0,  0, 40, 18,224,  2,
+  0,  0,  0,  0, 72,112,225,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,152,140, 23,  4,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40,140, 23,  4,  0,  0,  0,  0,152, 18,186,  2,
+  0,  0,  0,  0,232,  4,  9,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0, 40,215,248,  3,
+  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0, 88,147, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,216,225,211,  2,
+  0,  0,  0,  0,120, 23,190,  2,  0,  0,  0,  0, 72,228,  8,  4,  0,  0,  0,  0,120,227,211,  2,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,118,  7,  0,  0,237,  3,  0,  0,  4,  4,  0,  0,  7,  7,119,  7, 24,  0,  1,  0,  0,  0,  0,  0,
+  7,  0,  8,  0, 56, 90,147,  2,  0,  0,  0,  0,136,146,217,  2,  0,  0,  0,  0,136,146,217,  2,  0,  0,  0,  0, 24, 83, 23,  4,
+  0,  0,  0,  0,  8,141, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,216,156, 10,  4,
+  0,  0,  0,  0,  8, 59,187,  2,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0, 24, 83, 23,  4,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,  8,141, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,174, 68,  0,  0,  0,  0,
+  0,  0,184, 65,  0,  0,  0,  0,  0,224,238, 68,  0,  0,  0,  0,  0,  0,184, 65,  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,118,  7,  0,  0,  0,  0,  0,  0,
+ 22,  0,  0,  0,  0,192,238, 68,  0,  0,176, 65,  0,192,238, 68,  0,  0,176, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,119,  7, 23,  0,119,  7, 23,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,118,  7,  0,  0,237,  3,  0,  0,  3,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,119,  7, 23,  0,  2,  0,  1,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 72, 92,147,  2,  0,  0,  0,  0,200,  7, 16,  4,  0,  0,  0,  0,200,  7, 16,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72,103,187,  2,  0,  0,  0,  0, 72,213,185,  2,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0,  8,141, 23,  4,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24, 83, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,107, 69,  0,128,206,195,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,192,237, 68,  0,  0,  0,  0,  0,192,121, 68,110,  7,  0,  0,127,  7,  0,  0,  0,  0,  0,  0,
+230,  3,  0,  0,  0,  0,  0,  0,103,  7,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,109,  7,  0,  0,  0,  0,  0,  0,
+230,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  2,  0,  0,  0,
+  1,  0,  3,  3,  2,  0,  0,  4, 10,  0,127,  7,231,  3,110,  7,231,  3,  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,  4,  4,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 88, 91,147,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,120,142, 23,  4,
+  0,  0,  0,  0,184,145, 23,  4,  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, 68, 65, 84, 65, 88,  1,  0,  0,120,142, 23,  4,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0, 24,144, 23,  4,  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, 73, 78, 70, 79, 95, 80, 84, 95,116, 97, 98,115,  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,  0,  0, 73, 78, 70, 79, 95, 80, 84, 95,116, 97, 98,115,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,220,255,208, 14, 36,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 88,  1,  0,  0, 24,144, 23,  4,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,184,145, 23,  4,  0,  0,  0,  0,120,142, 23,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 73, 78, 70, 79, 95, 80, 84, 95,118,105,101,119,
   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,
- 68, 65, 84, 65, 88,  1,  0,  0, 88, 15, 49,  3,  0,  0,  0,  0,196,  0,  0,  0,  1,  0,  0,  0,248, 16, 49,  3,  0,  0,  0,  0,
-184, 13, 49,  3,  0,  0,  0,  0,184, 22,131,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95,
-115,112,111,116,  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,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95,
-115,112,111,116,  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,  0,  0, 83,112,111,116, 32, 83,104, 97,
-112,101,  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,  0,  0,  0,  0,  0,  0,155,253,113,  1,102,  0,
-  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0, 43,  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, 73, 78, 70, 79, 95, 80, 84, 95,118,105,101,119,
   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,  0,  0, 86,105,101,119,  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,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,248, 16, 49,  3,  0,  0,  0,  0,
-196,  0,  0,  0,  1,  0,  0,  0,152, 18, 49,  3,  0,  0,  0,  0, 88, 15, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,114,101,110,100,101,114,  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,122,254,208, 14, 98,  1,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,114,101,110,100,101,114,  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, 82,101,110,100,101,114,  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, 68, 65, 84, 65, 88,  1,  0,  0,184,145, 23,  4,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24,144, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 73, 78, 70, 79, 95, 80, 84, 95, 98,111,116,116,111,109, 98, 97,114,  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,  0,  0,  0,135,255,113,  1, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 28,  0,  0,  0,
+  0,  0,  0,  0, 73, 78, 70, 79, 95, 80, 84, 95, 98,111,116,116,111,109, 98, 97,114,  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, 32,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0, 86,254,208, 14, 36,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  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,
- 68, 65, 84, 65, 88,  1,  0,  0,152, 18, 49,  3,  0,  0,  0,  0,196,  0,  0,  0,  1,  0,  0,  0, 56, 20, 49,  3,  0,  0,  0,  0,
-248, 16, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80,
- 84, 95,100,105,109,101,110,115,105,111,110,115,  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, 82, 69, 78, 68, 69, 82, 95, 80,
- 84, 95,100,105,109,101,110,115,105,111,110,115,  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, 68,105,109,101,110,115,105,111,
-110,115,  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,  0,  0,  0,  0,  0,  0,164,254,113,  1,203,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 29,  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,  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, 68, 65, 84, 65,
+160,  0,  0,  0, 88,147, 23,  4,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,136,225, 23,  4,  0,  0,  0,  0, 40,215,248,  3,
+  0,  0,  0,  0,168,  1,  9,  4,  0,  0,  0,  0,232,  4,  9,  4,  0,  0,  0,  0,120,227,211,  2,  0,  0,  0,  0, 56,224,211,  2,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 13,  6,  0,  0,118,  7,  0,  0,  0,  0,  0,  0,235,  3,  0,  0,  4,  4,106,  1,
+236,  3,  2,  0,  0,  0,  0,  0,  7,  0,  0,  0,216, 85,147,  2,  0,  0,  0,  0, 72,224, 23,  4,  0,  0,  0,  0, 72,224, 23,  4,
+  0,  0,  0,  0, 72,148, 23,  4,  0,  0,  0,  0,184,149, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  8,138,187,  2,  0,  0,  0,  0, 88,149,217,  2,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0, 72,148, 23,  4,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,184,149, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,111, 67,  0,  0,  0,  0,  0,  0,184, 65,  0,  0,  0,  0,  0,  0,181, 67,  0,  0,  0,  0,  0,  0,184, 65,  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,
+105,  1,  0,  0,  0,  0,  0,  0, 22,  0,  0,  0,  0,128,180, 67,  0,  0,176, 65,  0,128,180, 67,  0,  0,176, 65,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,106,  1, 23,  0,106,  1, 23,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 13,  6,  0,  0,118,  7,  0,  0,213,  3,  0,  0,235,  3,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,106,  1, 23,  0,  3,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72, 89,147,  2,  0,  0,  0,  0,104, 90,198,  4,  0,  0,  0,  0,104, 90,198,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72,224,248,  3,  0,  0,  0,  0,136,216,185,  2,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0,184,149, 23,  4,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72,148, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,191, 67,  0,224,129,196,  0,  0,  0,  0,  0,  0,  0,  0,239,221,182, 67,154,254,129,196,  0,  0,  0,  0, 89,  1,  0,  0,
+106,  1,  0,  0,  0,  0,  0,  0,212,  3,  0,  0,  0,  0,  0,  0, 94,  1,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,
+ 88,  1,  0,  0,  0,  0,  0,  0,212,  3,  0,  0,  0,  0,128, 67,  0,  0, 40, 66,  0,  0,  0, 69,  0,  0,225, 67,  0,  0,  0, 63,
+  0,  0,  0, 64, 10,  3,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,106,  1,213,  3, 89,  1,213,  3,  0,  0, 24, 14,198,  4,
+  0,  0,  0,  0,  9,  0,  0,  0,  4,  0,  0,  0, 13,  6,  0,  0,118,  7,  0,  0,  0,  0,  0,  0,212,  3,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,106,  1,213,  3,  4,  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,248, 86,147,  2,  0,  0,  0,  0,120,147,197,  4,  0,  0,  0,  0,168, 95,221,  2,
+  0,  0,  0,  0, 40,151, 23,  4,  0,  0,  0,  0, 72,157,254,  3,  0,  0,  0,  0, 88,  9,220,  2,  0,  0,  0,  0, 72,252,187,  2,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0, 40,151, 23,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,200,152, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232, 87,147,  2,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 85, 84, 84, 79, 78, 83, 95, 80, 84, 95, 99,111,110,116,101,120,116,  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, 66, 85, 84, 84, 79, 78, 83, 95, 80, 84, 95, 99,111,110,116,101,120,116,  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, 67,111,110,116,101,120,116,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,223,255,109,  1, 33,  0,  0,  0,  0,  0,  0,  0, 38,  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,  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,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,200,152, 23,  4,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,104,154, 23,  4,
+  0,  0,  0,  0, 40,151, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 95, 80, 84, 95, 99,111,110,116,101,120,116, 95,108, 97,109,112,  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, 68, 65, 84, 65,
+ 95, 80, 84, 95, 99,111,110,116,101,120,116, 95,108, 97,109,112,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0, 56, 20, 49,  3,  0,  0,  0,  0,
-196,  0,  0,  0,  1,  0,  0,  0,216, 21, 49,  3,  0,  0,  0,  0,152, 18, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 97,110,116,105, 97,108,105, 97,115,105,110,103,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 97,110,116,105, 97,108,105, 97,115,105,110,103,  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,184,255,
+113,  1, 36,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 46,  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,  0,  0,  0,  0,  0, 65,110,116,105, 45, 65,108,105, 97,115,105,110,103,  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,  0,  0,  0, 82,254,113,  1, 58,  0, 20,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 30,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,104,154, 23,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,  8,156, 23,  4,  0,  0,  0,  0,200,152, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95,112,114,101,118,105,101,119,  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, 68, 65, 84, 65, 95, 80, 84, 95,112,114,101,118,105,101,119,  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, 80,114,101,118,105,101,119,  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,
- 68, 65, 84, 65, 88,  1,  0,  0,216, 21, 49,  3,  0,  0,  0,  0,196,  0,  0,  0,  1,  0,  0,  0,120, 23, 49,  3,  0,  0,  0,  0,
- 56, 20, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80,
- 84, 95,108, 97,121,101,114,115,  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, 82, 69, 78, 68, 69, 82, 95, 80,
- 84, 95,108, 97,121,101,114,115,  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, 76, 97,121,101,114,115,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24,255,113,  1,136,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 47,  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,  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,246,251,113,  1, 44,  2,
-  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  2,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,120, 23, 49,  3,  0,  0,  0,  0,
-196,  0,  0,  0,  1,  0,  0,  0, 24, 25, 49,  3,  0,  0,  0,  0,216, 21, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,104, 97,100,105,110,103,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,  8,156, 23,  4,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,168,157, 23,  4,
+  0,  0,  0,  0,104,154, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 95, 80, 84, 95,108, 97,109,112,  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,  0,  0, 68, 65, 84, 65,
+ 95, 80, 84, 95,108, 97,109,112,  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,  0,  0, 76, 97,109,112,
   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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,104, 97,100,105,110,103,  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, 85,254,
+113,  1,171,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 48,  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,  0,  0,  0,  0,  0, 83,104, 97,100,105,110,103,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,164,253,113,  1,102,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 33,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,168,157, 23,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0, 72,159, 23,  4,  0,  0,  0,  0,  8,156, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95,115,104, 97,100,111,119,  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, 68, 65, 84, 65, 95, 80, 84, 95,115,104, 97,100,111,119,  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, 83,104, 97,100,111,119,  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,
- 68, 65, 84, 65, 88,  1,  0,  0, 24, 25, 49,  3,  0,  0,  0,  0,196,  0,  0,  0,  1,  0,  0,  0,184, 26, 49,  3,  0,  0,  0,  0,
-120, 23, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80,
- 84, 95,112,111,115,116, 95,112,114,111, 99,101,115,115,105,110,103,  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, 82, 69, 78, 68, 69, 82, 95, 80,
- 84, 95,112,111,115,116, 95,112,114,111, 99,101,115,115,105,110,103,  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, 80,111,115,116, 32, 80,114,111,
- 99,101,115,115,105,110,103,  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,  0,140,253,113,  1,  0,  0,
-  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 34,  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, 25,254,113,  1, 36,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 49,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,184, 26, 49,  3,  0,  0,  0,  0,
-196,  0,  0,  0,  1,  0,  0,  0, 88, 28, 49,  3,  0,  0,  0,  0, 24, 25, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,101,114,102,111,114,109, 97,110, 99,101,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0, 72,159, 23,  4,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,232,160, 23,  4,
+  0,  0,  0,  0,168,157, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 95, 80, 84, 95,115,112,111,116,  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,  0,  0, 68, 65, 84, 65,
+ 95, 80, 84, 95,115,112,111,116,  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,  0,  0, 83,112,111,116,
+ 32, 83,104, 97,112,101,  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,  0,  0,  0,  0,  0,  0,155,253,
+113,  1,102,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 50,  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,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,101,114,102,111,114,109, 97,110, 99,101,  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, 80,101,114,102,111,114,109, 97,110, 99,101,  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, 68, 65, 84, 65, 88,  1,  0,  0,232,160, 23,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,136,162, 23,  4,  0,  0,  0,  0, 72,159, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,114,101,110,100,101,114,  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,116,253,113,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 35,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,114,101,110,100,101,114,  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, 82,101,110,100,101,114,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,135,255,113,  1, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 35,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 88,  1,  0,  0, 88, 28, 49,  3,  0,  0,  0,  0,196,  0,  0,  0,  1,  0,  0,  0,248, 29, 49,  3,  0,  0,  0,  0,
-184, 26, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80,
- 84, 95,111,117,116,112,117,116,  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, 82, 69, 78, 68, 69, 82, 95, 80,
- 84, 95,111,117,116,112,117,116,  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, 79,117,116,112,117,116,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,218,252,113,  1,130,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 36,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,136,162, 23,  4,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0, 40,164, 23,  4,
+  0,  0,  0,  0,232,160, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,100,105,109,101,110,115,105,111,110,115,  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, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,100,105,109,101,110,115,105,111,110,115,  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, 68,105,109,101,
+110,115,105,111,110,115,  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,  0,  0,  0,  0,  0,  0,164,254,
+113,  1,203,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 36,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,248, 29, 49,  3,  0,  0,  0,  0,
-196,  0,  0,  0,  1,  0,  0,  0,152, 31, 49,  3,  0,  0,  0,  0, 88, 28, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,116, 97,109,112,  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, 68, 65, 84, 65, 88,  1,  0,  0, 40,164, 23,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,200,165, 23,  4,  0,  0,  0,  0,136,162, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 97,110,116,105, 97,108,105, 97,115,105,
+110,103,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 97,110,116,105, 97,108,105, 97,115,105,
+110,103,  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, 65,110,116,105, 45, 65,108,105, 97,115,105,110,103,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,116, 97,109,112,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82,254,113,  1, 58,  0, 20,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 37,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 83,116, 97,109,112,  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,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,170,252,113,  1,  0,  0, 20,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 38,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,200,165, 23,  4,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,104,167, 23,  4,
+  0,  0,  0,  0, 40,164, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,108, 97,121,101,114,115,  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, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,108, 97,121,101,114,115,  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, 76, 97,121,101,
+114,115,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,246,251,
+113,  1, 44,  2,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 39,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  1,  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,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,104,167, 23,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,  8,169, 23,  4,  0,  0,  0,  0,200,165, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,104, 97,100,105,110,103,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,104, 97,100,105,110,103,  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,
- 68, 65, 84, 65, 88,  1,  0,  0,152, 31, 49,  3,  0,  0,  0,  0,196,  0,  0,  0,  1,  0,  0,  0, 56, 33, 49,  3,  0,  0,  0,  0,
-248, 29, 49,  3,  0,  0,  0,  0,184, 45,131,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95,
- 99,111,110,116,101,120,116, 95,109,101,115,104,  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, 68, 65, 84, 65, 95, 80, 84, 95,
- 99,111,110,116,101,120,116, 95,109,101,115,104,  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, 83,104, 97,100,105,110,103,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,164,253,113,  1,102,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 40,  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,  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,184,255,113,  1, 36,  0,
-  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0, 18,  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,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,  8,169, 23,  4,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,168,170, 23,  4,
+  0,  0,  0,  0,104,167, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,112,111,115,116, 95,112,114,111, 99,101,115,115,105,110,103,  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, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,112,111,115,116, 95,112,114,111, 99,101,115,115,105,110,103,  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, 80,111,115,116,
+ 32, 80,114,111, 99,101,115,115,105,110,103,  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,  0,140,253,
+113,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 41,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0, 56, 33, 49,  3,  0,  0,  0,  0,
-196,  0,  0,  0,  1,  0,  0,  0,216, 34, 49,  3,  0,  0,  0,  0,152, 31, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95,109,101,115,104,  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,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95,109,101,115,104,  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, 68, 65, 84, 65, 88,  1,  0,  0,168,170, 23,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0, 72,172, 23,  4,  0,  0,  0,  0,  8,169, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,101,114,102,111,114,109, 97,110, 99,
+101,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,101,114,102,111,114,109, 97,110, 99,
+101,  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, 80,101,114,102,111,114,109, 97,110, 99,101,  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, 77,101,115,104,  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,116,253,113,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+ 42,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66,255,240,  0, 94,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 21,  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, 68, 65, 84, 65, 88,  1,  0,  0, 72,172, 23,  4,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,232,173, 23,  4,
+  0,  0,  0,  0,168,170, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,111,117,116,112,117,116,  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, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,111,117,116,112,117,116,  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, 79,117,116,112,
+117,116,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,218,252,
+113,  1,130,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 43,  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,  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,
- 68, 65, 84, 65, 88,  1,  0,  0,216, 34, 49,  3,  0,  0,  0,  0,196,  0,  0,  0,  1,  0,  0,  0,120, 36, 49,  3,  0,  0,  0,  0,
- 56, 33, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95,
-109, 97,116,101,114,105, 97,108,115,  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, 68, 65, 84, 65, 95, 80, 84, 95,
-109, 97,116,101,114,105, 97,108,115,  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, 77, 97,116,101,114,105, 97,108,
-115,  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,  0,  0,  0,  0,  0,  0,  0,172,254,240,  0,126,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 22,  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, 68, 65, 84, 65, 88,  1,  0,  0,232,173, 23,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,136,175, 23,  4,  0,  0,  0,  0, 72,172, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,116, 97,109,112,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,116, 97,109,112,  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,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,120, 36, 49,  3,  0,  0,  0,  0,
-196,  0,  0,  0,  1,  0,  0,  0, 24, 38, 49,  3,  0,  0,  0,  0,216, 34, 49,  3,  0,  0,  0,  0, 40, 55,131,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95,118,101,114,116,101,120, 95,103,114,111,117,112,115,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 83,116, 97,109,112,  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,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95,118,101,114,116,101,120, 95,103,114,111,117,112,115,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,170,252,113,  1,  0,  0, 20,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+ 45,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 86,101,114,116,101,120, 32, 71,114,111,117,112,115,  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,  0,  0,  0,234,254,113,  1, 76,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0, 23,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,136,175, 23,  4,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0, 40,177, 23,  4,
+  0,  0,  0,  0,232,173, 23,  4,  0,  0,  0,  0,  8, 76, 93,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 95, 80, 84, 95, 99,111,110,116,101,120,116, 95,109,101,115,104,  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, 68, 65, 84, 65,
+ 95, 80, 84, 95, 99,111,110,116,101,120,116, 95,109,101,115,104,  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,  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,
- 68, 65, 84, 65, 88,  1,  0,  0, 24, 38, 49,  3,  0,  0,  0,  0,196,  0,  0,  0,  1,  0,  0,  0,184, 39, 49,  3,  0,  0,  0,  0,
-120, 36, 49,  3,  0,  0,  0,  0,104, 58,131,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95,
-115,104, 97,112,101, 95,107,101,121,115,  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, 68, 65, 84, 65, 95, 80, 84, 95,
-115,104, 97,112,101, 95,107,101,121,115,  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, 83,104, 97,112,101, 32, 75,101,
-121,115,  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,  0,  0,  0,  0,  0,  0,134,254,113,  1, 76,  0,
-  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0, 24,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  2,  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,  0,  0,  0,  0,  0,  0,  0,190,255,
+109,  1, 33,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0, 25,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,184, 39, 49,  3,  0,  0,  0,  0,
-196,  0,  0,  0,  1,  0,  0,  0, 88, 41, 49,  3,  0,  0,  0,  0, 24, 38, 49,  3,  0,  0,  0,  0,168, 61,131,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95,117,118, 95,116,101,120,116,117,114,101,  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, 68, 65, 84, 65, 95, 80, 84, 95,117,118, 95,116,101,120,116,117,114,101,  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, 68, 65, 84, 65, 88,  1,  0,  0, 40,177, 23,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,200,178, 23,  4,  0,  0,  0,  0,136,175, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95,109,101,115,104,  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, 85, 86, 32, 84,101,120,116,117,114,101,  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, 68, 65, 84, 65, 95, 80, 84, 95,109,101,115,104,  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, 16,254,113,  1, 94,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0, 25,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77,101,115,104,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66,255,240,  0, 94,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 28,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 88,  1,  0,  0, 88, 41, 49,  3,  0,  0,  0,  0,196,  0,  0,  0,  1,  0,  0,  0,248, 42, 49,  3,  0,  0,  0,  0,
-184, 39, 49,  3,  0,  0,  0,  0, 40, 68,131,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95,
-118,101,114,116,101,120, 95, 99,111,108,111,114,115,  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, 68, 65, 84, 65, 95, 80, 84, 95,
-118,101,114,116,101,120, 95, 99,111,108,111,114,115,  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, 86,101,114,116,101,120, 32, 67,
-111,108,111,114,115,  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,  0,  0,  0,154,253,113,  1, 94,  0,
-  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  2,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,248, 42, 49,  3,  0,  0,  0,  0,
-196,  0,  0,  0,  1,  0,  0,  0,152, 44, 49,  3,  0,  0,  0,  0, 88, 41, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95, 99,111,110,116,101,120,116, 95,109, 97,116,101,
-114,105, 97,108,  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, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95, 99,111,110,116,101,120,116, 95,109, 97,116,101,
-114,105, 97,108,  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, 68, 65, 84, 65, 88,  1,  0,  0,200,178, 23,  4,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,104,180, 23,  4,
+  0,  0,  0,  0, 40,177, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 95, 80, 84, 95,109, 97,116,101,114,105, 97,108,115,  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, 68, 65, 84, 65,
+ 95, 80, 84, 95,109, 97,116,101,114,105, 97,108,115,  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, 77, 97,116,101,
+114,105, 97,108,115,  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,  0,  0,  0,  0,  0,  0,  0,172,254,
+240,  0,126,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 29,  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,  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, 94,255,113,  1,126,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  2,  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, 68, 65, 84, 65, 88,  1,  0,  0,104,180, 23,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,  8,182, 23,  4,  0,  0,  0,  0,200,178, 23,  4,  0,  0,  0,  0,168, 84, 93,  3,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95,118,101,114,116,101,120, 95,103,114,111,117,112,
+115,  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, 68, 65, 84, 65, 95, 80, 84, 95,118,101,114,116,101,120, 95,103,114,111,117,112,
+115,  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, 86,101,114,116,101,120, 32, 71,114,111,117,112,115,  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,  0,  0,  0,  8,255,109,  1, 67,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,
+ 30,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  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,
- 68, 65, 84, 65, 88,  1,  0,  0,152, 44, 49,  3,  0,  0,  0,  0,196,  0,  0,  0,  1,  0,  0,  0, 56, 46, 49,  3,  0,  0,  0,  0,
-248, 42, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76,
- 95, 80, 84, 95,112,114,101,118,105,101,119,  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, 77, 65, 84, 69, 82, 73, 65, 76,
- 95, 80, 84, 95,112,114,101,118,105,101,119,  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, 80,114,101,118,105,101,119,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,190,254,113,  1,136,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,  8,182, 23,  4,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,168,183, 23,  4,
+  0,  0,  0,  0,104,180, 23,  4,  0,  0,  0,  0,136, 87, 93,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 95, 80, 84, 95,115,104, 97,112,101, 95,107,101,121,115,  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, 68, 65, 84, 65,
+ 95, 80, 84, 95,115,104, 97,112,101, 95,107,101,121,115,  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, 83,104, 97,112,
+101, 32, 75,101,121,115,  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,  0,  0,  0,  0,  0,  0,176,254,
+109,  1, 67,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0, 31,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  2,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,168,183, 23,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0, 72,185, 23,  4,  0,  0,  0,  0,  8,182, 23,  4,  0,  0,  0,  0,104, 90, 93,  3,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95,117,118, 95,116,101,120,116,117,114,101,  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, 68, 65, 84, 65, 88,  1,  0,  0, 56, 46, 49,  3,  0,  0,  0,  0,
-196,  0,  0,  0,  1,  0,  0,  0,216, 47, 49,  3,  0,  0,  0,  0,152, 44, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95,109, 97,116,101,114,105, 97,108,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95,117,118, 95,116,101,120,116,117,114,101,  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, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95,109, 97,116,101,114,105, 97,108,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 85, 86, 32, 77, 97,112,115,  0,114,101,  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, 77, 97,116,101,114,105, 97,108,  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, 70,254,109,  1, 85,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,
+ 32,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  1,  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, 55,254,116,  1, 86,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  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, 68, 65, 84, 65, 88,  1,  0,  0, 72,185, 23,  4,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,232,186, 23,  4,
+  0,  0,  0,  0,168,183, 23,  4,  0,  0,  0,  0, 72, 93, 93,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 95, 80, 84, 95,118,101,114,116,101,120, 95, 99,111,108,111,114,115,  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, 68, 65, 84, 65,
+ 95, 80, 84, 95,118,101,114,116,101,120, 95, 99,111,108,111,114,115,  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, 86,101,114,116,
+101,120, 32, 67,111,108,111,114,115,  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,  0,  0,  0,220,253,
+109,  1, 85,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  1,  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,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,232,186, 23,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,136,188, 23,  4,  0,  0,  0,  0, 72,185, 23,  4,  0,  0,  0,  0, 72,205, 93,  3,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95, 99,111,110,116,101,120,116, 95,
+109, 97,116,101,114,105, 97,108,  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, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95, 99,111,110,116,101,120,116, 95,
+109, 97,116,101,114,105, 97,108,  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,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 88,  1,  0,  0,216, 47, 49,  3,  0,  0,  0,  0,196,  0,  0,  0,  1,  0,  0,  0,120, 49, 49,  3,  0,  0,  0,  0,
- 56, 46, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76,
- 95, 80, 84, 95,100,105,102,102,117,115,101,  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, 77, 65, 84, 69, 82, 73, 65, 76,
- 95, 80, 84, 95,100,105,102,102,117,115,101,  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, 68,105,102,102,117,115,101,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,103,254,113,  1, 63,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  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,112,255,109,  1,111,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  2,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,120, 49, 49,  3,  0,  0,  0,  0,
-196,  0,  0,  0,  1,  0,  0,  0, 24, 51, 49,  3,  0,  0,  0,  0,216, 47, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95,115,112,101, 99,117,108, 97,114,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,136,188, 23,  4,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0, 40,190, 23,  4,
+  0,  0,  0,  0,232,186, 23,  4,  0,  0,  0,  0,200,213, 93,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69,
+ 82, 73, 65, 76, 95, 80, 84, 95,112,114,101,118,105,101,119,  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, 77, 65, 84, 69,
+ 82, 73, 65, 76, 95, 80, 84, 95,112,114,101,118,105,101,119,  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, 80,114,101,118,
+105,101,119,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,229,254,
+109,  1,118,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 11,  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,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95,115,112,101, 99,117,108, 97,114,  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, 83,112,101, 99,117,108, 97,114,  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, 68, 65, 84, 65, 88,  1,  0,  0, 40,190, 23,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,200,191, 23,  4,  0,  0,  0,  0,136,188, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95,109, 97,116,101,114,105, 97,108,
   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,252,253,113,  1, 83,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  7,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95,109, 97,116,101,114,105, 97,108,
   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, 77, 97,116,101,114,105, 97,108,  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,  0,  0,  0,  0,  0,  0,  0,  0, 55,254,116,  1, 86,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 12,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 88,  1,  0,  0, 24, 51, 49,  3,  0,  0,  0,  0,196,  0,  0,  0,  1,  0,  0,  0,184, 52, 49,  3,  0,  0,  0,  0,
-120, 49, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76,
- 95, 80, 84, 95,114, 97,121,109,105,114,  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, 77, 65, 84, 69, 82, 73, 65, 76,
- 95, 80, 84, 95,114, 97,121,109,105,114,  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, 82, 97,121, 32, 77,105,114,114,
-111,114,  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,  0,  0,  0,  0,  0,  0,205,252,116,  1,  0,  0,
- 24,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 11,  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,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,200,191, 23,  4,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,104,193, 23,  4,
+  0,  0,  0,  0, 40,190, 23,  4,  0,  0,  0,  0,200,167, 42,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69,
+ 82, 73, 65, 76, 95, 80, 84, 95,100,105,102,102,117,115,101,  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, 77, 65, 84, 69,
+ 82, 73, 65, 76, 95, 80, 84, 95,100,105,102,102,117,115,101,  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, 68,105,102,102,
+117,115,101,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,151,254,
+109,  1, 57,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 13,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,184, 52, 49,  3,  0,  0,  0,  0,
-196,  0,  0,  0,  1,  0,  0,  0, 88, 54, 49,  3,  0,  0,  0,  0, 24, 51, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95,114, 97,121,116,114, 97,110,115,112,  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, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95,114, 97,121,116,114, 97,110,115,112,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,104,193, 23,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,  8,195, 23,  4,  0,  0,  0,  0,200,191, 23,  4,  0,  0,  0,  0,152,225, 93,  3,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95,115,112,101, 99,117,108, 97,114,
   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, 82, 97,121, 32, 84,114, 97,110,115,112, 97,114,101,110, 99,121,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95,115,112,101, 99,117,108, 97,114,
   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,181,252,116,  1,  0,  0, 24,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 12,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 83,112,101, 99,117,108, 97,114,  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,  0,  0,  0,  0,  0,  0,  0,  0, 56,254,109,  1, 74,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 14,  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,  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,
- 68, 65, 84, 65, 88,  1,  0,  0, 88, 54, 49,  3,  0,  0,  0,  0,196,  0,  0,  0,  1,  0,  0,  0,248, 55, 49,  3,  0,  0,  0,  0,
-184, 52, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76,
- 95, 80, 84, 95,115,115,115,  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, 77, 65, 84, 69, 82, 73, 65, 76,
- 95, 80, 84, 95,115,115,115,  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, 83,117, 98,115,117,114,102, 97,
- 99,101, 32, 83, 99, 97,116,116,101,114,105,110,103,  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,249,252,113,  1,  0,  0,
- 20,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 13,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,  8,195, 23,  4,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,168,196, 23,  4,
+  0,  0,  0,  0,104,193, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69,
+ 82, 73, 65, 76, 95, 80, 84, 95,114, 97,121,109,105,114,  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, 77, 65, 84, 69,
+ 82, 73, 65, 76, 95, 80, 84, 95,114, 97,121,109,105,114,  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, 82, 97,121, 32,
+ 77,105,114,114,111,114,  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,  0,  0,  0,  0,  0,  0,205,252,
+116,  1,  0,  0, 24,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 18,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,248, 55, 49,  3,  0,  0,  0,  0,
-196,  0,  0,  0,  1,  0,  0,  0,152, 57, 49,  3,  0,  0,  0,  0, 88, 54, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95,115,116,114, 97,110,100,  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, 68, 65, 84, 65, 88,  1,  0,  0,168,196, 23,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0, 72,198, 23,  4,  0,  0,  0,  0,  8,195, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95,114, 97,121,116,114, 97,110,115,
+112,  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, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95,114, 97,121,116,114, 97,110,115,
+112,  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, 82, 97,121, 32, 84,114, 97,110,115,112, 97,114,101,110, 99,121,  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, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95,115,116,114, 97,110,100,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,181,252,116,  1,  0,  0, 24,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+ 19,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 83,116,114, 97,110,100,  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,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,225,252,113,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 14,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0, 72,198, 23,  4,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,232,199, 23,  4,
+  0,  0,  0,  0,168,196, 23,  4,  0,  0,  0,  0,200,241, 93,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69,
+ 82, 73, 65, 76, 95, 80, 84, 95,115,115,115,  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, 77, 65, 84, 69,
+ 82, 73, 65, 76, 95, 80, 84, 95,115,115,115,  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, 83,117, 98,115,
+117,114,102, 97, 99,101, 32, 83, 99, 97,116,116,101,114,105,110,103,  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, 83,253,
+109,  1,  0,  0, 17,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 20,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,232,199, 23,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,136,201, 23,  4,  0,  0,  0,  0, 72,198, 23,  4,  0,  0,  0,  0,152,162, 44,  3,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95,115,116,114, 97,110,100,  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,
- 68, 65, 84, 65, 88,  1,  0,  0,152, 57, 49,  3,  0,  0,  0,  0,196,  0,  0,  0,  1,  0,  0,  0, 56, 59, 49,  3,  0,  0,  0,  0,
-248, 55, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76,
- 95, 80, 84, 95,111,112,116,105,111,110,115,  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, 77, 65, 84, 69, 82, 73, 65, 76,
- 95, 80, 84, 95,111,112,116,105,111,110,115,  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, 79,112,116,105,111,110,115,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95,115,116,114, 97,110,100,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,249,251,113,  1,208,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 15,  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, 83,116,114, 97,110,100,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 62,253,109,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+ 21,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0, 56, 59, 49,  3,  0,  0,  0,  0,
-196,  0,  0,  0,  1,  0,  0,  0,216, 60, 49,  3,  0,  0,  0,  0,152, 57, 49,  3,  0,  0,  0,  0, 40, 49,131,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95,110,111,114,109, 97,108,115,  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, 68, 65, 84, 65, 95, 80, 84, 95,110,111,114,109, 97,108,115,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,136,201, 23,  4,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0, 40,203, 23,  4,
+  0,  0,  0,  0,232,199, 23,  4,  0,  0,  0,  0,232,176, 44,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69,
+ 82, 73, 65, 76, 95, 80, 84, 95,111,112,116,105,111,110,115,  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, 77, 65, 84, 69,
+ 82, 73, 65, 76, 95, 80, 84, 95,111,112,116,105,111,110,115,  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, 79,112,116,105,
+111,110,115,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,116,252,
+109,  1,181,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 22,  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,  0,  0,  0,  0,  0, 78,111,114,109, 97,108,115,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,102,255,113,  1, 58,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0, 19,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0, 40,203, 23,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,200,204, 23,  4,  0,  0,  0,  0,136,201, 23,  4,  0,  0,  0,  0,232, 78, 93,  3,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95,110,111,114,109, 97,108,115,  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, 68, 65, 84, 65, 95, 80, 84, 95,110,111,114,109, 97,108,115,  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, 78,111,114,109, 97,108,115,  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,
- 68, 65, 84, 65, 88,  1,  0,  0,216, 60, 49,  3,  0,  0,  0,  0,196,  0,  0,  0,  1,  0,  0,  0,120, 62, 49,  3,  0,  0,  0,  0,
- 56, 59, 49,  3,  0,  0,  0,  0,232, 51,131,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95,
-116,101,120,116,117,114,101, 95,115,112, 97, 99,101,  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, 68, 65, 84, 65, 95, 80, 84, 95,
-116,101,120,116,117,114,101, 95,115,112, 97, 99,101,  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, 84,101,120,116,117,114,101, 32,
- 83,112, 97, 99,101,  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,  0,  0,  0, 78,255,113,  1,  0,  0,
-  0,  0,  0,  0,  4,  0,  2,  0,  0,  0,  0,  0, 20,  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,117,255,109,  1, 52,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,
+ 26,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,120, 62, 49,  3,  0,  0,  0,  0,
-196,  0,  0,  0,  1,  0,  0,  0, 24, 64, 49,  3,  0,  0,  0,  0,216, 60, 49,  3,  0,  0,  0,  0, 24, 71,131,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95, 99,117,115,116,111,109, 95,112,114,111,112,115, 95,109,101,115,
-104,  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, 68, 65, 84, 65, 95, 80, 84, 95, 99,117,115,116,111,109, 95,112,114,111,112,115, 95,109,101,115,
-104,  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, 67,117,115,116,111,109, 32, 80,114,111,112,101,114,116,105,101,115,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,200,204, 23,  4,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,104,206, 23,  4,
+  0,  0,  0,  0, 40,203, 23,  4,  0,  0,  0,  0,200, 81, 93,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 95, 80, 84, 95,116,101,120,116,117,114,101, 95,115,112, 97, 99,101,  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, 68, 65, 84, 65,
+ 95, 80, 84, 95,116,101,120,116,117,114,101, 95,115,112, 97, 99,101,  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, 84,101,120,116,
+117,114,101, 32, 83,112, 97, 99,101,  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,  0,  0,  0, 96,255,
+109,  1,  0,  0,  0,  0,  0,  0,  4,  0,  6,  0,  0,  0,  0,  0, 27,  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,  0,  0,  0,  0,  0,  0,  0,130,253,113,  1,  0,  0,  0,  0,  0,  0,  4,  0,  3,  0,  0,  0,  0,  0, 27,  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,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,104,206, 23,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,  8,208, 23,  4,  0,  0,  0,  0,200,204, 23,  4,  0,  0,  0,  0, 40, 96, 93,  3,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95, 99,117,115,116,111,109, 95,112,114,111,112,115,
+ 95,109,101,115,104,  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, 68, 65, 84, 65, 95, 80, 84, 95, 99,117,115,116,111,109, 95,112,114,111,112,115,
+ 95,109,101,115,104,  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, 67,117,115,116,111,109, 32, 80,114,111,112,101,114,116,105,101,115,  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,199,253,109,  1,  0,  0,  0,  0,  0,  0,  4,  0,  7,  0,  0,  0,  0,  0,
+ 34,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 88,  1,  0,  0, 24, 64, 49,  3,  0,  0,  0,  0,196,  0,  0,  0,  1,  0,  0,  0,184, 65, 49,  3,  0,  0,  0,  0,
-120, 62, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80,
- 84, 95,109,111,116,105,111,110, 95, 98,108,117,114,  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, 82, 69, 78, 68, 69, 82, 95, 80,
- 84, 95,109,111,116,105,111,110, 95, 98,108,117,114,  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, 83, 97,109,112,108,101,100, 32,
- 77,111,116,105,111,110, 32, 66,108,117,114,  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, 58,254,113,  1,  0,  0,
- 20,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 31,  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,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,  8,208, 23,  4,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,168,209, 23,  4,
+  0,  0,  0,  0,104,206, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,109,111,116,105,111,110, 95, 98,108,117,114,  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, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,109,111,116,105,111,110, 95, 98,108,117,114,  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, 83, 97,109,112,
+108,101,100, 32, 77,111,116,105,111,110, 32, 66,108,117,114,  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, 58,254,
+113,  1,  0,  0, 20,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 38,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,184, 65, 49,  3,  0,  0,  0,  0,
-196,  0,  0,  0,  1,  0,  0,  0, 88, 67, 49,  3,  0,  0,  0,  0, 24, 64, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 98, 97,107,101,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 98, 97,107,101,  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, 68, 65, 84, 65, 88,  1,  0,  0,168,209, 23,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0, 72,211, 23,  4,  0,  0,  0,  0,  8,208, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 98, 97,107,101,  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, 66, 97,107,101,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 98, 97,107,101,  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,194,252,113,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 37,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 97,107,101,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,194,252,113,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+ 44,  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,  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,
- 68, 65, 84, 65, 88,  1,  0,  0, 88, 67, 49,  3,  0,  0,  0,  0,196,  0,  0,  0,  1,  0,  0,  0,248, 68, 49,  3,  0,  0,  0,  0,
-184, 65, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 80, 72, 89, 83, 73, 67, 83, 95,
- 80, 84, 95, 97,100,100,  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, 80, 72, 89, 83, 73, 67, 83, 95,
- 80, 84, 95, 97,100,100,  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, 68, 65, 84, 65, 88,  1,  0,  0, 72,211, 23,  4,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,232,212, 23,  4,
+  0,  0,  0,  0,168,209, 23,  4,  0,  0,  0,  0, 24,102, 94,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 80, 72, 89, 83,
+ 73, 67, 83, 95, 80, 84, 95, 97,100,100,  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, 80, 72, 89, 83,
+ 73, 67, 83, 95, 80, 84, 95, 97,100,100,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,115,255,113,  1,105,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  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,111,255,
+109,  1,112,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,248, 68, 49,  3,  0,  0,  0,  0,
-196,  0,  0,  0,  1,  0,  0,  0,152, 70, 49,  3,  0,  0,  0,  0, 88, 67, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 80, 65, 82, 84, 73, 67, 76, 69, 95, 80, 84, 95, 99,111,110,116,101,120,116, 95,112, 97,114,116,
-105, 99,108,101,115,  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, 80, 65, 82, 84, 73, 67, 76, 69, 95, 80, 84, 95, 99,111,110,116,101,120,116, 95,112, 97,114,116,
-105, 99,108,101,115,  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, 68, 65, 84, 65, 88,  1,  0,  0,232,212, 23,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,136,214, 23,  4,  0,  0,  0,  0, 72,211, 23,  4,  0,  0,  0,  0,104,105, 94,  3,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 80, 65, 82, 84, 73, 67, 76, 69, 95, 80, 84, 95, 99,111,110,116,101,120,116, 95,
+112, 97,114,116,105, 99,108,101,115,  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, 80, 65, 82, 84, 73, 67, 76, 69, 95, 80, 84, 95, 99,111,110,116,101,120,116, 95,
+112, 97,114,116,105, 99,108,101,115,  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,  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,151,255,113,  1, 69,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  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,160,255,109,  1, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 88,  1,  0,  0,152, 70, 49,  3,  0,  0,  0,  0,196,  0,  0,  0,  1,  0,  0,  0, 56, 72, 49,  3,  0,  0,  0,  0,
-248, 68, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76,
- 95, 80, 84, 95,115,104, 97,100,105,110,103,  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, 77, 65, 84, 69, 82, 73, 65, 76,
- 95, 80, 84, 95,115,104, 97,100,105,110,103,  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, 83,104, 97,100,105,110,103,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,136,214, 23,  4,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0, 40,216, 23,  4,
+  0,  0,  0,  0,232,212, 23,  4,  0,  0,  0,  0,120,228, 93,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69,
+ 82, 73, 65, 76, 95, 80, 84, 95,115,104, 97,100,105,110,103,  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, 77, 65, 84, 69,
+ 82, 73, 65, 76, 95, 80, 84, 95,115,104, 97,100,105,110,103,  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, 83,104, 97,100,
+105,110,103,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,220,253,
+109,  1, 71,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 15,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,148,253,113,  1, 80,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,  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,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0, 40,216, 23,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,200,217, 23,  4,  0,  0,  0,  0,136,214, 23,  4,  0,  0,  0,  0, 88,231, 93,  3,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95,116,114, 97,110,115,112,  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, 68, 65, 84, 65, 88,  1,  0,  0, 56, 72, 49,  3,  0,  0,  0,  0,
-196,  0,  0,  0,  1,  0,  0,  0,216, 73, 49,  3,  0,  0,  0,  0,152, 70, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95,116,114, 97,110,115,112,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95,116,114, 97,110,115,112,  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, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95,116,114, 97,110,115,112,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 84,114, 97,110,115,112, 97,114,101,110, 99,121,  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, 84,114, 97,110,115,112, 97,114,101,110, 99,121,  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,125,253,109,  1, 74,  0, 17,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 16,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 41,253,113,  1, 83,  0, 20,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  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, 68, 65, 84, 65, 88,  1,  0,  0,200,217, 23,  4,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,104,219, 23,  4,
+  0,  0,  0,  0, 40,216, 23,  4,  0,  0,  0,  0, 24, 96, 42,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69,
+ 82, 73, 65, 76, 95, 80, 84, 95,109,105,114,114,111,114,  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, 77, 65, 84, 69,
+ 82, 73, 65, 76, 95, 80, 84, 95,109,105,114,114,111,114,  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, 77,105,114,114,
+111,114,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,104,253,
+109,  1,  0,  0, 17,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 17,  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,  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,
- 68, 65, 84, 65, 88,  1,  0,  0,216, 73, 49,  3,  0,  0,  0,  0,196,  0,  0,  0,  1,  0,  0,  0,120, 75, 49,  3,  0,  0,  0,  0,
- 56, 72, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76,
- 95, 80, 84, 95,109,105,114,114,111,114,  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, 77, 65, 84, 69, 82, 73, 65, 76,
- 95, 80, 84, 95,109,105,114,114,111,114,  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, 77,105,114,114,111,114,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,104,219, 23,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,  8,221, 23,  4,  0,  0,  0,  0,200,217, 23,  4,  0,  0,  0,  0,216, 19, 94,  3,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95,115,104, 97,100,111,119,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 17,253,113,  1,  0,  0,
- 20,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 10,  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, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95,115,104, 97,100,111,119,  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, 83,104, 97,100,111,119,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,120, 75, 49,  3,  0,  0,  0,  0,
-196,  0,  0,  0,  1,  0,  0,  0, 24, 77, 49,  3,  0,  0,  0,  0,216, 73, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95,115,104, 97,100,111,119,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 95,252,109,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+ 23,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76, 95, 80, 84, 95,115,104, 97,100,111,119,  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, 83,104, 97,100,111,119,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,  8,221, 23,  4,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,168,222, 23,  4,
+  0,  0,  0,  0,104,219, 23,  4,  0,  0,  0,  0,152, 53, 94,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69,
+ 82, 73, 65, 76, 95, 80, 84, 95, 99,117,115,116,111,109, 95,112,114,111,112,115,  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, 77, 65, 84, 69,
+ 82, 73, 65, 76, 95, 80, 84, 95, 99,117,115,116,111,109, 95,112,114,111,112,115,  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, 67,117,115,116,
+111,109, 32, 80,114,111,112,101,114,116,105,101,115,  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, 74,252,
+109,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 24,  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,  0,  0,  0,  0,  0,  0,  0,225,251,113,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 16,  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,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,168,222, 23,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0, 24,254,223,  2,  0,  0,  0,  0,  8,221, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95, 99,117,115,116,111,109, 95,112,114,111,112,115,
+ 95,108, 97,109,112,  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, 68, 65, 84, 65, 95, 80, 84, 95, 99,117,115,116,111,109, 95,112,114,111,112,115,
+ 95,108, 97,109,112,  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, 67,117,115,116,111,109, 32, 80,114,111,112,101,114,116,105,101,115,  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,131,253,113,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+ 51,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 88,  1,  0,  0, 24, 77, 49,  3,  0,  0,  0,  0,196,  0,  0,  0,  1,  0,  0,  0, 88,237,  6,  2,  0,  0,  0,  0,
-120, 75, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 84, 69, 82, 73, 65, 76,
- 95, 80, 84, 95, 99,117,115,116,111,109, 95,112,114,111,112,115,  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, 77, 65, 84, 69, 82, 73, 65, 76,
- 95, 80, 84, 95, 99,117,115,116,111,109, 95,112,114,111,112,115,  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, 67,117,115,116,111,109, 32, 80,
-114,111,112,101,114,116,105,101,115,  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,201,251,113,  1,  0,  0,
-  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 17,  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,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0, 24,254,223,  2,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,216, 28, 16,  4,
+  0,  0,  0,  0,168,222, 23,  4,  0,  0,  0,  0, 72,121, 95,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 84, 69, 88, 84,
+ 85, 82, 69, 95, 80, 84, 95, 99,111,110,116,101,120,116, 95,116,101,120,116,117,114,101,  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, 84, 69, 88, 84,
+ 85, 82, 69, 95, 80, 84, 95, 99,111,110,116,101,120,116, 95,116,101,120,116,117,114,101,  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,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0, 88,237,  6,  2,  0,  0,  0,  0,
-196,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24, 77, 49,  3,  0,  0,  0,  0,184, 28,131,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 95, 80, 84, 95, 99,117,115,116,111,109, 95,112,114,111,112,115, 95,108, 97,109,
-112,  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, 68, 65, 84, 65, 95, 80, 84, 95, 99,117,115,116,111,109, 95,112,114,111,112,115, 95,108, 97,109,
-112,  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, 67,117,115,116,111,109, 32, 80,114,111,112,101,114,116,105,101,115,  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,131,253,113,  1,  0,  0,  0,  0,  0,  0,  4,  0,  4,  0,  0,  0,  0,  0, 44,  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, 43,255,
+109,  1,180,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,  0, 18,  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,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,216, 28, 16,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,  8, 61,197,  4,  0,  0,  0,  0, 24,254,223,  2,  0,  0,  0,  0, 56,130, 95,  3,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 84, 69, 88, 84, 85, 82, 69, 95, 80, 84, 95,112,114,101,118,105,101,119,  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, 84, 69, 88, 84, 85, 82, 69, 95, 80, 84, 95,112,114,101,118,105,101,119,  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,
- 68, 65, 84, 65,248,  0,  0,  0,184, 78, 49,  3,  0,  0,  0,  0,162,  0,  0,  0,  1,  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,  4,  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,193,  0,  0,163, 67,
-  0, 64,180,196,  0,  0,104, 67,  0,  0,  0,193,  0,  0,163, 67,  0, 64,180,196, 30,209,118, 67,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 80,114,101,118,105,101,119,  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,  0,  0,  0,  0,  0,128, 67,  0,  0, 40, 66,  0,  0,  0, 69,  0,  0,225, 67,  0,  0,  0, 63, 72,225,154, 63,
-  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,213,  0, 53,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  4,  0,  4,  0,  0,  0,  2,  0,  1,  0,  0,  0,  0,  0,  8,212,  3,  3,  0,  0,  0,  0,
-255, 21,  0,  0,160,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0,248, 79, 49,  3,  0,  0,  0,  0,
-197,  0,  0,  0,  1,  0,  0,  0, 56,117, 49,  3,  0,  0,  0,  0,104,  3, 49,  3,  0,  0,  0,  0, 40,148, 17,  3,  0,  0,  0,  0,
-248, 34,  4,  3,  0,  0,  0,  0, 24,241, 48,  3,  0,  0,  0,  0,184,154,  3,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-197,  3,  0,  0, 15,  6,  0,  0,  0,  0,  0,  0,215,  2,  0,  0,  6,  6, 75,  2,216,  2,  1,  0,  0,  0,  0,  0,  7,  0,  0,  0,
-152, 75,194,  1,  0,  0,  0,  0,200, 83, 49,  3,  0,  0,  0,  0,200, 83, 49,  3,  0,  0,  0,  0,232, 80, 49,  3,  0,  0,  0,  0,
- 88, 82, 49,  3,  0,  0,  0,  0,216, 55, 24,  3,  0,  0,  0,  0,216, 55, 24,  3,  0,  0,  0,  0,200,133,192,  1,  0,  0,  0,  0,
-  8, 20, 26,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0,232, 80, 49,  3,  0,  0,  0,  0,198,  0,  0,  0,  1,  0,  0,  0,
- 88, 82, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64, 19, 68,  0,  0,  0,  0,  0,  0,208, 65,
-  0,  0,  0,  0,  0,192, 18, 68,  0,  0,  0,  0,  0,  0,208, 65,  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, 74,  2,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,
-  0,128, 18, 68,  0,  0,200, 65,  0,128, 18, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,
-  4,  0, 12,  0, 10,  0, 75,  2, 26,  0, 75,  2, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-197,  3,  0,  0, 15,  6,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 75,  2, 26,  0, 19,  0,  1,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-168, 83,194,  1,  0,  0,  0,  0,104, 71,  8,  2,  0,  0,  0,  0,104, 71,  8,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,168, 56, 24,  3,  0,  0,  0,  0, 40, 28, 25,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0, 88, 82, 49,  3,  0,  0,  0,  0,198,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,232, 80, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 22, 67,  0,  0,  0,  0,  0,  0, 22, 67,
- 12,116,186,191,  6, 58, 29, 64, 29,133,235,191,143,194, 53, 64,  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, 75,  2,  0,  0,  0,  0,  0,  0,190,  2,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,116,254,109,  1,162,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  2,  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,  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,
-197,  3,  0,  0, 15,  6,  0,  0, 26,  0,  0,  0,215,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 75,  2,190,  2, 20,  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,
-184, 76,194,  1,  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,248, 28, 25,  3,  0,  0,  0,  0,104,241,  6,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40, 33,  0,  0,200, 83, 49,  3,  0,  0,  0,  0,167,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,  8, 61,197,  4,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,  8, 77,197,  4,
+  0,  0,  0,  0,216, 28, 16,  4,  0,  0,  0,  0,152,131, 95,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 84, 69, 88, 84,
+ 85, 82, 69, 95, 80, 84, 95, 99,111,108,111,114,115,  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, 84, 69, 88, 84,
+ 85, 82, 69, 95, 80, 84, 95, 99,111,108,111,114,115,  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, 67,111,108,111,
+114,115,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 95,254,
+109,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  3,  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,
-  6,  0,  0,  0,  0,  1,  0,  0,136,187, 49,  3,  0,  0,  0,  0, 40,147, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  1,  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,240, 65,  0,  0,  0,  0,154,153,153, 62,  0,  0,  0,  0,100,  0,  0,  0,
-154,153,153, 62,100,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,  8, 77,197,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,216,185,197,  4,  0,  0,  0,  0,  8, 61,197,  4,  0,  0,  0,  0,248,145, 95,  3,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 84, 69, 88, 84, 85, 82, 69, 95, 80, 84, 95, 98,108,101,110,100,  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, 84, 69, 88, 84, 85, 82, 69, 95, 80, 84, 95, 98,108,101,110,100,  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, 66,108,101,110,100,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 19,254,109,  1, 55,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  4,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,216,185,197,  4,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,168, 14,198,  4,
+  0,  0,  0,  0,  8, 77,197,  4,  0,  0,  0,  0,120,204, 95,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 84, 69, 88, 84,
+ 85, 82, 69, 95, 80, 84, 95,109, 97,112,112,105,110,103,  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, 84, 69, 88, 84,
+ 85, 82, 69, 95, 80, 84, 95,109, 97,112,112,105,110,103,  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, 77, 97,112,112,
+105,110,103,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82,253,
+109,  1,172,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,168, 14,198,  4,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0, 72,157,254,  3,  0,  0,  0,  0,216,185,197,  4,  0,  0,  0,  0, 88,207, 95,  3,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 84, 69, 88, 84, 85, 82, 69, 95, 80, 84, 95,105,110,102,108,117,101,110, 99,101,
   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, 84, 69, 88, 84, 85, 82, 69, 95, 80, 84, 95,105,110,102,108,117,101,110, 99,101,
   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, 73,110,102,108,117,101,110, 99,101,  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,  0,  0,  0,  0,  0,  0,  0, 17,252,109,  1, 44,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  6,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0, 72,157,254,  3,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,168, 14,198,  4,  0,  0,  0,  0, 56,210, 95,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 84, 69, 88, 84,
+ 85, 82, 69, 95, 80, 84, 95, 99,117,115,116,111,109, 95,112,114,111,112,115,  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, 84, 69, 88, 84,
+ 85, 82, 69, 95, 80, 84, 95, 99,117,115,116,111,109, 95,112,114,111,112,115,  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, 67,117,115,116,
+111,109, 32, 80,114,111,112,101,114,116,105,101,115,  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,252,251,
+109,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  7,  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,  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, 68, 65, 84, 65,248,  0,  0,  0, 72,224, 23,  4,
+  0,  0,  0,  0,179,  0,  0,  0,  1,  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,  4,  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,193,  0,  0,163, 67,  0, 64,180,196,  0,  0,104, 67,  0,  0,  0,193,  0,  0,163, 67,  0, 64,180,196,
+ 30,209,118, 67,  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,128, 67,  0,  0, 40, 66,  0,  0,  0, 69,
+  0,  0,225, 67,  0,  0,  0, 63, 72,225,154, 63,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,213,  0,
+ 53,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  4,  0,  4,  0,  0,  0,  2,  0,  1,  0,
+  3,  0,  0,  0, 72,116,187,  2,  0,  0,  0,  0,191, 21,  0,  0,160,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0,136,225, 23,  4,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0, 88, 26,  8,  4,
+  0,  0,  0,  0, 88,147, 23,  4,  0,  0,  0,  0, 40,244,211,  2,  0,  0,  0,  0, 40, 18,224,  2,  0,  0,  0,  0,152, 18,186,  2,
+  0,  0,  0,  0,168,  1,  9,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,193,  3,  0,  0, 11,  6,  0,  0,  0,  0,  0,  0,
+199,  2,  0,  0,  6,  6, 75,  2,200,  2,  1,  0,  0,  0,  0,  0,  7,  0,  0,  0,184, 67,147,  2,  0,  0,  0,  0, 88,229, 23,  4,
+  0,  0,  0,  0, 88,229, 23,  4,  0,  0,  0,  0,120,226, 23,  4,  0,  0,  0,  0,232,227, 23,  4,  0,  0,  0,  0, 24,253,187,  2,
+  0,  0,  0,  0, 24,253,187,  2,  0,  0,  0,  0,184,185,185,  2,  0,  0,  0,  0,  8,198, 85,  3,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  1,  0,  0,120,226, 23,  4,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,232,227, 23,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,192,  3, 68,  0,  0,  0,  0,  0,  0,184, 65,  0,  0,  0,  0,  0,192, 18, 68,  0,  0,  0,  0,
+  0,  0,184, 65,  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, 74,  2,  0,  0,  0,  0,  0,  0, 22,  0,  0,  0,  0,128, 18, 68,  0,  0,176, 65,  0,128, 18, 68,
+  0,  0,176, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 75,  2, 23,  0, 75,  2,
+ 23,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,193,  3,  0,  0, 11,  6,  0,  0,  0,  0,  0,  0,
+ 22,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 75,  2, 23,  0,  5,  0,  1,  0,  2,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 75,147,  2,  0,  0,  0,  0,232,156,  9,  4,
+  0,  0,  0,  0,232,156,  9,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200,222,248,  3,
+  0,  0,  0,  0, 56,227,185,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  1,  0,  0,232,227, 23,  4,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,120,226, 23,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 22, 67,  0,  0,  0,  0,  0,  0, 22, 67, 12,116,186,191,  6, 58, 29, 64, 43,249,229,191,
+149,252, 50, 64,  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, 75,  2,  0,  0,  0,  0,  0,  0,177,  2,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,193,  3,  0,  0, 11,  6,  0,  0, 23,  0,  0,  0,
+199,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 75,  2,177,  2,  6,  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,216, 68,147,  2,  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,  8,228,185,  2,
+  0,  0,  0,  0, 56,132,218,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40, 33,  0,  0, 88,229, 23,  4,  0,  0,  0,  0,184,  0,  0,  0,  1,  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,  6,  0,  0,  0,  0,  1,  0,  0,136, 92, 24,  4,
+  0,  0,  0,  0, 72, 41, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  1,  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,240, 65,  0,  0,  0,  0,154,153,153, 62,  0,  0,  0,  0,100,  0,  0,  0,154,153,153, 62,100,  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,  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,  0,  0,  0,
@@ -873,7 +965,6 @@ char datatoc_preview_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  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,  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,  0,  0,  0,  0,  0,  0,  0,
@@ -892,6 +983,7 @@ char datatoc_preview_blend[]= {
   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,  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,  1,  0,  0,  0,100,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -1003,53 +1095,10 @@ char datatoc_preview_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,100,  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,  1,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0, 56,117, 49,  3,  0,  0,  0,  0,197,  0,  0,  0,  1,  0,  0,  0,
- 88,135, 49,  3,  0,  0,  0,  0,248, 79, 49,  3,  0,  0,  0,  0,  8,146,192,  1,  0,  0,  0,  0,120,181, 20,  3,  0,  0,  0,  0,
-168,185,  3,  2,  0,  0,  0,  0, 40,148, 17,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,195,  3,  0,  0,
-  0,  0,  0,  0,  0,  4,  0,  0,  1,  1,196,  3,  1,  4,  1,  0,  0,  0,  0,  0,  7,  0,  9,  0,136, 52,194,  1,  0,  0,  0,  0,
-184,124, 49,  3,  0,  0,  0,  0,248,131, 49,  3,  0,  0,  0,  0, 40,118, 49,  3,  0,  0,  0,  0,152,119, 49,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200,239, 19,  3,  0,  0,  0,  0,232, 69,  8,  2,  0,  0,  0,  0,
- 68, 65, 84, 65, 40,  1,  0,  0, 40,118, 49,  3,  0,  0,  0,  0,198,  0,  0,  0,  1,  0,  0,  0,152,119, 49,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,192, 79, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,  0,113, 68,
-  0,  0,  0,  0,  0,  0,208, 65,  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,195,  3,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,192,112, 68,  0,  0,200, 65,
-  0,192,112, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,196,  3,
- 26,  0,196,  3, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,195,  3,  0,  0,
-  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,196,  3, 26,  0, 13,  0,  1,  0,
-  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232, 62,194,  1,  0,  0,  0,  0,
-  8, 70, 20,  3,  0,  0,  0,  0,  8, 70, 20,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-104,188, 24,  3,  0,  0,  0,  0,120,181,  3,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 40,  1,  0,  0,152,119, 49,  3,  0,  0,  0,  0,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 40,118, 49,  3,  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,  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,  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,  0,  0,195,  3,  0,  0,
- 26,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,196,  3,231,  3, 14,  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,168, 53,194,  1,  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,
-200,132,252,  2,  0,  0,  0,  0, 40,200,251,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,121, 49,  3,  0,  0,  0,  0,
- 68, 65, 84, 65, 96,  3,  0,  0,  8,121, 49,  3,  0,  0,  0,  0,156,  0,  0,  0,  1,  0,  0,  0, 63, 21,145, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,140, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 80,  1,128,191,  0,  0,128,191,  0,  0,  0,  0,  0,  0,  0,  0,225,215,163,188,  0,  0,  0,  0,197, 56, 16, 63,181,165,214,190,
-216, 65, 54, 63,  0,  0,  0,  0,103,115, 83, 63,179,248,135, 62,228,147,254,190,  0,  0,  0,  0,155,199,158, 60, 68, 64, 94, 63,
-111,229,253, 62,  0,  0,  0,  0,239,219,254,191,166, 80,144,192,255, 66, 63,194,  0,  0,128, 63,215, 56, 16, 63,100,115, 83, 63,
- 74,200,158, 60,  0,  0,  0,  0,200,165,214,190,182,248,135, 62, 79, 64, 94, 63,  0,  0,  0,  0,215, 65, 54, 63,242,147,254,190,
-103,229,253, 62,  0,  0,  0,  0,102, 23,  5, 66,  7,118,167,193, 47, 82,221, 65,  0,  0,128, 63, 63,120, 35, 63, 62,197,234,190,
-182, 67, 54,191,216, 65, 54,191,212,171,111, 63,  4,184,148, 62,128,150,254, 62,228,147,254, 62,120,248,179, 60, 74, 22,115, 63,
-  9,232,253,190,111,229,253,190,185,111, 16,192, 54,216,157,192,122, 48, 63, 66,255, 66, 63, 66,209, 21,254, 62,120,173, 58, 63,
- 87,211,134, 60, 96,147,194,183,  0, 34,196,190,184,124,120, 62,223, 63, 75, 63,  0,  0,229, 54,196,159,207,196,222,158,130, 68,
-181,161,172,196,110,174, 71,194, 37,139,207, 68, 80,144,130,196,162,147,172, 68,129,176, 71, 66,197, 56, 16, 63,181,165,214,190,
-216, 65, 54, 63,  0,  0,  0,  0,103,115, 83, 63,179,248,135, 62,228,147,254,190,  0,  0,  0,  0,155,199,158, 60, 68, 64, 94, 63,
-111,229,253, 62,  0,  0,  0,  0, 62,101,214,192,127, 55, 88,192, 97, 89, 45,194,  0,  0,128, 63, 63,120, 35, 63, 62,197,234,190,
-182, 67, 54,191,216, 65, 54,191,212,171,111, 63,  4,184,148, 62,128,150,254, 62,228,147,254, 62,120,248,179, 60, 74, 22,115, 63,
-  9,232,253,190,111,229,253,190, 70,  2,243,192,180,124,108,192,174, 70, 45, 66, 97, 89, 45, 66, 20, 97,190, 64,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 20, 97,190, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 20, 97,190, 64,  0,  0,  0,  0,113, 36,122, 61,157, 24,186,192, 28, 38, 71, 64,  0,  0,128, 63,153, 42, 67, 63,246, 62,229,190,
-251,142,104,190,131, 17,209,190,141,  8, 56, 66,223,139, 15, 66,  0,  0,  0,  0,  0,  0,  0,  0, 31,234,239, 58, 80,127,  4,191,
-250,204,248,191, 74, 51,155,192,  0,  0,255,255,  1,  0,  0,  0,  0,  0,  0,  0,  1,  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,  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,  0,  0,  0,  0,  0,  0,  0,
@@ -1058,322 +1107,191 @@ char datatoc_preview_blend[]= {
   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,  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,  0,  0,128, 63, 46,219, 35, 66, 48,203,139, 66,250, 65, 96, 66,  0,  0,  0,  0, 68, 65, 84, 65, 56,  1,  0,  0,
-184,124, 49,  3,  0,  0,  0,  0,157,  0,  0,  0,  1,  0,  0,  0,248,131, 49,  3,  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,  1,  0,  0,  0, 51, 51, 51, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 17,139, 48, 63,240,151, 31,191,155, 98,151,190, 77, 45, 97,190,141,  8, 56, 66,  0,  0,  0,  0,
-255, 13,  0,  0,  1,  0,  0,  0,248,251, 49,  3,  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,  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,  2,  0,  0,  0,  2,  0,  0,  0,
-  2,  0,  0,  0,  1,  0,  0,  0,  8, 24,  0,  0,  0,  0, 12, 66,  0,  0,128, 63, 10,215, 35, 60,  0,  0,250, 67, 80,127,  4,191,
-250,204,248,191, 74, 51,155,192, 96,199, 41,188,225,230, 30,193,216,129,230, 63,  0,  0, 20,  0, 10,  0,  7,  1,  1,  3,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0, 56,126, 49,  3,  0,  0,  0,  0,198,  0,  0,  0,  1,  0,  0,  0,
-168,127, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64, 80, 68,  0,  0,  0,  0,  0,  0,208, 65,
-  0,  0,  0,  0,  0,224,239, 68,  0,  0,  0,  0,  0,  0,208, 65,  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,126,  7,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,
-  0,192,239, 68,  0,  0,200, 65,  0,192,239, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,
-  4,  0,  0,  0, 10,  0,127,  7, 26,  0,127,  7, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,126,  7,  0,  0,231,  3,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-127,  7, 26,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-216,102,194,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0,168,127, 49,  3,  0,  0,  0,  0,198,  0,  0,  0,  1,  0,  0,  0,
- 24,129, 49,  3,  0,  0,  0,  0, 56,126, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,112, 67,  0,192,121,196,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0, 95, 67,  0,192,121,196,  0,  0,  0,  0,223,  0,  0,  0,240,  0,  0,  0,  0,  0,  0,  0,230,  3,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,222,  0,  0,  0,  0,  0,  0,  0,230,  3,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  3,  0,  0,  1,  0,  7,  0,
- 18,  0,  0,  4,  6,  0,240,  0,231,  3,223,  0,231,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,239,  0,  0,  0,  0,  0,  0,  0,230,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-240,  0,231,  3,  0,  0,  2,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-184,104,194,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232, 34, 26,  3,  0,  0,  0,  0,
-120,165, 56,  3,  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, 68, 65, 84, 65, 40,  1,  0,  0, 24,129, 49,  3,  0,  0,  0,  0,198,  0,  0,  0,  1,  0,  0,  0,
-136,130, 49,  3,  0,  0,  0,  0,168,127, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,224,209, 68,  0,  0,  0,  0,  0,  0,112, 66,
-  0,  0,128, 56,  0,224,209, 68,  0,  0,  0,  0,  0,  0,112, 66,  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,142,  6,  0,  0,  0,  0,  0,  0, 59,  0,  0,  0,
-  0,192,209, 68,  0,  0,108, 66,  0,192,209, 68,  0,  0,108, 66,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,
-  4,  0,  0,  4, 10,  0,143,  6, 60,  0,143,  6, 60,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-240,  0,  0,  0,126,  7,  0,  0,171,  3,  0,  0,230,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-143,  6, 60,  0,  0,  0,  4,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-200,103,194,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0,136,130, 49,  3,  0,  0,  0,  0,198,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 24,129, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 45, 67,  0,128,105,196,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,224,209, 68,  0, 64,102,196,  0,  0,  0,  0,126,  6,  0,  0,143,  6,  0,  0, 18,  0,  0,  0,170,  3,  0,  0,
-  0,  0,  0,  0,142,  6,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,142,  6,  0,  0, 18,  0,  0,  0,170,  3,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  8,  4,  0,  0,  2,  0,  3,  3,
-  4,  0,  0,  4,  6,  0,143,  6,171,  3,143,  6,153,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-240,  0,  0,  0,126,  7,  0,  0,  0,  0,  0,  0,170,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-143,  6,171,  3,  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,
-232,101,194,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,104,  0,  0,  0,248,131, 49,  3,  0,  0,  0,  0,165,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,184,124, 49,  3,  0,  0,  0,  0, 56,126, 49,  3,  0,  0,  0,  0,136,130, 49,  3,  0,  0,  0,  0,
-  5,  0,  0,  0,  0,  0,  0,  0,168,132, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,152,170, 17,  3,  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, 24,251,  6,  2,  0,  0,  0,  0,
-  7,  0,255,255,255,255,  0,  0, 68, 65, 84, 65, 96,  2,  0,  0,168,132, 49,  3,  0,  0,  0,  0,164,  0,  0,  0,  1,  0,  0,  0,
- 79,112,101,110, 32, 66,108,101,110,100,101,114, 32, 70,105,108,101,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 47,100,115,107, 47,100, 97,116, 97, 47,115,114, 99, 47, 98,108,101,110,100,101,114, 47, 98,108,101,110,100,101,114, 47,115,111,
-117,114, 99,101, 47, 98,108,101,110,100,101,114, 47,101,100,105,116,111,114,115, 47,100, 97,116, 97,102,105,108,101,115, 47,  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,  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,  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,  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,112,114,101,118,105,101,119, 49, 46, 98,108,101,110,100,  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,  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,  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,  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,  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,  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,
-255,255,255,255,  0,  0,  0,  0,  0,  0,  0,  0,  8,  0,  8,  1,  0,  0,  1,  0,  4,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65,160,  0,  0,  0, 88,135, 49,  3,  0,  0,  0,  0,197,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 56,117, 49,  3,  0,  0,  0,  0,248, 34,  4,  3,  0,  0,  0,  0,168,185,  3,  2,  0,  0,  0,  0,248,137, 17,  3,  0,  0,  0,  0,
- 24,241, 48,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,197,  3,  0,  0, 15,  6,  0,  0,217,  2,  0,  0,  0,  4,  0,  0,
-  3,  3, 75,  2, 40,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,136, 46,194,  1,  0,  0,  0,  0, 40,139, 49,  3,  0,  0,  0,  0,
- 40,139, 49,  3,  0,  0,  0,  0, 72,136, 49,  3,  0,  0,  0,  0,184,137, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 56, 58,  7,  2,  0,  0,  0,  0,216,155, 24,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0,
- 72,136, 49,  3,  0,  0,  0,  0,198,  0,  0,  0,  1,  0,  0,  0,184,137, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,128,244, 67,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,192, 18, 68,  0,  0,  0,  0,  0,  0,208, 65,
-  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, 74,  2,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,128, 18, 68,  0,  0,200, 65,  0,128, 18, 68,  0,  0,200, 65,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 75,  2, 26,  0, 75,  2, 26,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,197,  3,  0,  0, 15,  6,  0,  0,217,  2,  0,  0,242,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 75,  2, 26,  0, 21,  0,  1,  0,  2,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,152, 48,194,  1,  0,  0,  0,  0, 72,150, 26,  3,  0,  0,  0,  0,
- 72,150, 26,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,104, 83,251,  2,  0,  0,  0,  0,
- 24, 42,251,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0,
-184,137, 49,  3,  0,  0,  0,  0,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72,136, 49,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,128,241, 67,  0,  0, 94,195,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 14, 68,  0,  0,124,195,  0,  0,  0,  0,
- 58,  2,  0,  0, 75,  2,  0,  0, 18,  0,  0,  0, 13,  1,  0,  0,  0,  0,  0,  0, 57,  2,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,
-  0,  0,  0,  0, 57,  2,  0,  0, 18,  0,  0,  0, 13,  1,  0,  0,  0,  0,190,195,  0,  0,190,195,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63, 18,  6,  0,  0,  2,  0,  3,  3,  0,  0, 12,  4,  6,  0, 75,  2, 14,  1, 58,  2,252,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,197,  3,  0,  0, 15,  6,  0,  0,243,  2,  0,  0,  0,  4,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 75,  2, 14,  1, 22,  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,168, 47,194,  1,  0,  0,  0,  0, 56,218, 24,  3,  0,  0,  0,  0,
- 56,218, 24,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232, 42,251,  2,  0,  0,  0,  0,
- 40, 48,251,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  1,  0,  0,
- 40,139, 49,  3,  0,  0,  0,  0,166,  0,  0,  0,  1,  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,  3,  0,  0,  0, 51, 51, 51, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,182, 67,  0,  0,209,195,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,182, 67,
-  0,  0,190,195,  0,  0,  0,181,  0,  0,  0,  0, 16,  0,  0,  0,  0,  0,  0,  0,124,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 16,  0,  0,  0,124,  1,  0,  0,  0,  0,  0,  0,124,  1,  0,  0,  0,  0,190,195,  0,  0,190,195,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  1,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,108,  1,124,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,120, 34,251,  2,  0,  0,  0,  0,
-120, 34,251,  2,  0,  0,  0,  0, 88,171, 20,  3,  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,  0,  0,
-  1,  0, 12,  0,  1,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0, 88,171, 20,  3,  0,  0,  0,  0,220,  0,  0,  0,  1,  0,  0,  0,
-218,  0,  0,  0,101,  0,  0,  0,136,243, 55,  3,  0,  0,  0,  0, 68, 65, 84, 65, 80,  6,  0,  0,136,243, 55,  3,  0,  0,  0,  0,
-219,  0,  0,  0,101,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40,147, 49,  3,  0,  0,  0,  0, 19,  0,  0,  0,  1,  0,  0,  0,
- 40,147, 49,  3,  0,  0,  0,  0, 20,  0,  0,  0,  1,  0,  0,  0, 40,147, 49,  3,  0,  0,  0,  0, 23,  0,  0,  0,  1,  0,  0,  0,
- 56,248, 49,  3,  0,  0,  0,  0, 21,  0,  1,  0,  1,  0,  0,  0, 40,147, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-216,239, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 24,217, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-120, 25, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,136,195, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
- 72, 59, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,120, 25, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-120, 53, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,120,117, 53,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
- 24,217, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,120, 25, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-136,195, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,120, 25, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-168, 47, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,216, 41, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
- 24,217, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,120, 25, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-136,195, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,120, 25, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-  8, 36, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 24,217, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-120, 25, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 56, 30, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-136,195, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,104, 24, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-120, 25, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 24,217, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-120, 25, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,152, 18, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-136,195, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,248,251, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-136,206, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  8,184, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
- 40,208, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 40, 13, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-120, 25, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,216,  6, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-248, 43, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  8,146, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
- 56,108, 53,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,168,238, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
- 72, 23, 52,  3,  0,  0,  0,  0,  9,  0,  0,  0,  1,  0,  0,  0,  8,146, 50,  3,  0,  0,  0,  0, 10,  0,  0,  0,  1,  0,  0,  0,
-  8,146, 50,  3,  0,  0,  0,  0, 29,  0,  0,  0,  1,  0,  0,  0,  8,146, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
- 24, 98, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 40,236, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-136,195, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,120, 25, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-168, 92, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 88,228, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
- 56, 87, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,168,224, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-248,139, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,232,227, 55,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
- 24,217, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,120,128, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
- 72,212, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,232,133, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
- 72,218, 55,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 24, 16, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-120,189, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  8,202, 55,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-136,  7, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 72, 23, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-104,122, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,104,135, 53,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-168,238, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,136,103, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
- 88,192, 55,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 72, 23, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-232, 70, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,104,216, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
- 88,116, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,168,238, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-200, 81, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  8,232, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-152,109, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,200,104, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
- 72, 23, 52,  3,  0,  0,  0,  0,  9,  0,  0,  0,  1,  0,  0,  0,152,109, 50,  3,  0,  0,  0,  0, 10,  0,  0,  0,  1,  0,  0,  0,
-152,109, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 88, 76, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-136,220, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,104,  1, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
- 88,207, 49,  3,  0,  0,  0,  0, 30,  0,255,255,  0,  0,  1,  0,160,214,107,  1,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  1,  0,
-160,214,107,  1,  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  1,  0,160,214,107,  1,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  1,  0,
-160,214,107,  1,  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  1,  0,160,214,107,  1,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  1,  0,
-160,214,107,  1,  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  1,  0,160,214,107,  1,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  1,  0,
-160,214,107,  1,  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  1,  0,160,214,107,  1,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  1,  0,
-160,214,107,  1,  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  1,  0,160,214,107,  1,  0,  0,  0,  0, 83, 67,  0,  0,184,  5,  0,  0,
- 40,147, 49,  3,  0,  0,  0,  0,154,  0,  0,  0,  1,  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, 83, 67,112,114,101,118,105,101,119,  0,  0, 99,101,110,101, 46,
- 48, 48, 49,  0,  0,  0,  0,  0,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-248,251, 49,  3,  0,  0,  0,  0,216,239, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40,153, 49,  3,  0,  0,  0,  0,
-104,165, 49,  3,  0,  0,  0,  0,104,158, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,236, 81,122, 61,230,224,239,192,
-116, 34, 53,192,113, 36,122, 61,157, 24,186,192, 28, 38, 71, 64,113, 36,122, 61,157, 24,186,192, 28, 38, 71, 64,113, 36,122, 61,
-157, 24,186,192, 28, 38, 71, 64,  2,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0, 25,  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,216,165, 49,  3,  0,  0,  0,  0, 56,199, 58,  3,  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,  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,
-  0,  0,  0,  0, 68,172,  0,  0,  0,  0,128, 63,  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,  2,  0,  0,  0,  1,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,100,  0,  0,  0,100,  0,  0,  0,  0,  0,  1,  0,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,  2,224,  1, 60,  0, 32,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0, 25,  0,
-141,  0, 88,  2, 88,  2,  4,  0,  4,  0, 24,  0,  4,  0,  0,  0, 90,  0,  1,  0, 16,  0,  0,  0,  0,  0, 32,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 64,  0,  0,  0,  0,  0,  5,  0, 25,  0, 10,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-232,167, 49,  3,  0,  0,  0,  0,232,167, 49,  3,  0,  0,  0,  0,  0,  0,  5,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,128, 63,
-  0,  0,128, 63,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  2,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 47,116,109,112, 47,  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,  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,  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,  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,  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,  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,  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,  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,  0,  0,  0,205,204, 76, 63,205,204, 76, 63,205,204, 76, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  0, 16,  0,  0,  0,128, 63,  0,  0,128, 63,
-173,  2, 95,  0,154,153,217, 63,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  1,  0,180,  0,  0,  0,  0,  0,128, 63,  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, 68,172,  0,  0,  0,  0,128, 63,102,166,171, 67,  0,  0,128, 63,  2,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-232,110,224,  1,  0,  0,  0,  0,  1,  0,  0,  0,  1,  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,205,204, 28, 65,  0,  0,  0,  0,
- 32,  0, 32,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,  0,  5,  0, 60,  0,  5,  0,  1,  0,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,  2,224,  1, 60,  0, 32,  0,  0,  0,  0,  0,  0,  0,  4,  0,  1,  0,180,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  5,  0, 88,  2, 88,  2,205,204,204, 61,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,195,245, 28,193,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 40,153, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
-152,153, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 14,  4,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,101,  1,187,  1,
- 56, 30, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,152,153, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
-  8,154, 49,  3,  0,  0,  0,  0, 40,153, 49,  3,  0,  0,  0,  0, 14,  4,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,113,  1,204,  1,
-104, 24, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,  8,154, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
-120,154, 49,  3,  0,  0,  0,  0,152,153, 49,  3,  0,  0,  0,  0, 14,  4,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,131,  1,183,  1,
-152, 18, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,120,154, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
-232,154, 49,  3,  0,  0,  0,  0,  8,154, 49,  3,  0,  0,  0,  0, 33,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,224, 46,162,  0,
- 72, 59, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,232,154, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
- 88,155, 49,  3,  0,  0,  0,  0,120,154, 49,  3,  0,  0,  0,  0, 33,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0, 25,  1, 84,  2,
- 24, 65, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 88,155, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
-200,155, 49,  3,  0,  0,  0,  0,232,154, 49,  3,  0,  0,  0,  0, 33,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,105,  1, 77,  2,
-120, 53, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,200,155, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
- 56,156, 49,  3,  0,  0,  0,  0, 88,155, 49,  3,  0,  0,  0,  0, 33,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,142,  3,183,  0,
-168, 47, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 56,156, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
-168,156, 49,  3,  0,  0,  0,  0,200,155, 49,  3,  0,  0,  0,  0, 33,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,135,  2,121,  1,
-216, 41, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,168,156, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
- 24,157, 49,  3,  0,  0,  0,  0, 56,156, 49,  3,  0,  0,  0,  0, 33,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,164,  1, 33,  2,
-  8, 36, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 24,157, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
-136,157, 49,  3,  0,  0,  0,  0,168,156, 49,  3,  0,  0,  0,  0,  0,  8,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 42,  2, 90,  2,
-248,251, 49,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,136,157, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
-248,157, 49,  3,  0,  0,  0,  0, 24,157, 49,  3,  0,  0,  0,  0,  0,  8,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,152,  3, 67,  3,
-  8,184, 51,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,248,157, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
-104,158, 49,  3,  0,  0,  0,  0,136,157, 49,  3,  0,  0,  0,  0, 33,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,251,  1,225,  1,
- 40, 13, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,104,158, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
-216,158, 49,  3,  0,  0,  0,  0,248,157, 49,  3,  0,  0,  0,  0, 14,  4,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,141,  1,200,  1,
-216,  6, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,216,158, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
- 72,159, 49,  3,  0,  0,  0,  0,104,158, 49,  3,  0,  0,  0,  0,  0,  4,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  6,  3,138,  2,
-  8,146, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 72,159, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
-184,159, 49,  3,  0,  0,  0,  0,216,158, 49,  3,  0,  0,  0,  0, 32,  0,  0,  0, 14,  0,  0,  0,  0, 16,  0,  0,224,  1, 10,  2,
- 24, 98, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,184,159, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
- 40,160, 49,  3,  0,  0,  0,  0, 72,159, 49,  3,  0,  0,  0,  0,  1,  0,  0,  0,  8,  0,  0,  0,  0, 20,  0,  0, 70,  1,168,  1,
-168, 92, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 40,160, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
-152,160, 49,  3,  0,  0,  0,  0,184,159, 49,  3,  0,  0,  0,  0,  1,  0,  0,  0,  9,  0,  0,  0,  0, 20,  0,  0,115,  1,186,  1,
- 56, 87, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,152,160, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
-  8,161, 49,  3,  0,  0,  0,  0, 40,160, 49,  3,  0,  0,  0,  0,  4,  0,  0,  0,  8,  0,  0,  0,  0,  0,  0,  0,  0,  1, 78,  1,
-248,139, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,  8,161, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
-120,161, 49,  3,  0,  0,  0,  0,152,160, 49,  3,  0,  0,  0,  0, 64,  0,  0,  0,  1,  0,  0,  0,  0, 16,  0,  0, 44,  3,140,  3,
-120,128, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,120,161, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
-232,161, 49,  3,  0,  0,  0,  0,  8,161, 49,  3,  0,  0,  0,  0, 64,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,224, 46,119,  1,
-232,133, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,232,161, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
- 88,162, 49,  3,  0,  0,  0,  0,120,161, 49,  3,  0,  0,  0,  0, 32,  0,  0,  0, 16,  0,  0,  0,  0,  0,  0,  0, 55,  2, 51,  2,
-120,189, 51,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 88,162, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
-200,162, 49,  3,  0,  0,  0,  0,232,161, 49,  3,  0,  0,  0,  0, 16,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,216,  1,187,  1,
-104,122, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,200,162, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
- 56,163, 49,  3,  0,  0,  0,  0, 88,162, 49,  3,  0,  0,  0,  0,  1,  0,  0,  0, 10,  0,  0,  0,  0,  0,  0,  0,194,  1,205,  1,
-136,103, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 56,163, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
-168,163, 49,  3,  0,  0,  0,  0,200,162, 49,  3,  0,  0,  0,  0, 30,  4,  0,  0,  5,  0,  0,  0,  0, 20,  0,  0, 96,  2, 23,  1,
-232, 70, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,168,163, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
- 24,164, 49,  3,  0,  0,  0,  0, 56,163, 49,  3,  0,  0,  0,  0,  2,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,209,  1,211,  1,
- 88,116, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 24,164, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
-136,164, 49,  3,  0,  0,  0,  0,168,163, 49,  3,  0,  0,  0,  0, 30,  4,  0,  0,  7,  0,  0,  0,  0, 20,  0,  0,  2,  1, 33,  2,
-200, 81, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,136,164, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
-248,164, 49,  3,  0,  0,  0,  0, 24,164, 49,  3,  0,  0,  0,  0,  8,  0,  0,  0, 21,  0,  0,  0,  0,  0,  0,  0,180,  1,213,  1,
-152,109, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,248,164, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
-104,165, 49,  3,  0,  0,  0,  0,136,164, 49,  3,  0,  0,  0,  0, 30,  4,  0,  0,  8,  0,  0,  0,  0, 20,  0,  0, 22,  1,126,  1,
- 88, 76, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,104,165, 49,  3,  0,  0,  0,  0,130,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,248,164, 49,  3,  0,  0,  0,  0,223, 13,  0,  0,  9,  0,  0,  0,  0,  4,  0,  0, 93,  1,170,  1,
-104,  1, 50,  3,  0,  0,  0,  0, 68, 65, 84, 65,192,  1,  0,  0,216,165, 49,  3,  0,  0,  0,  0,150,  0,  0,  0,  1,  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,128, 63,  1,  0,  1,  0,
-205,204, 76, 63,  0,  0,180, 66,  9,  0,  1,  0,  0,  0,128, 63,111, 18,131, 58,205,204,204, 61,  0,  0,  1,  0, 32,  0, 32,  0,
- 32,  0,  1,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  1,  0,  1,  0,  0,  0,  1,  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,  2,  0, 80,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  7,  0,  5,  0,  5,  0,255,255, 50,  0, 10,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0, 63, 50,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63, 50,  0, 10,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0, 63, 50,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63, 50,  0, 10,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0, 63, 50,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63, 50,  0, 10,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0, 72, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 62,  0,  0,  0,  0,  1,  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,128, 63, 23,183,209, 56,
-205,204,204, 61,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,250,  0,205,204,204, 61,205,204,204, 61,102,102,166, 63,  0,  0,192, 63,
-  0,  0,240, 65, 72,225,122, 63,205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 67,  2,  0,  3,  2,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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, 35,  0,  0,  0,  0,  0,  0, 62,  0,  0,  0, 63,
- 68, 65, 84, 65, 88,  0,  0,  0,232,167, 49,  3,  0,  0,  0,  0,136,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 49, 32, 82,101,110,100,101,114, 76, 97,121,101,114,  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, 56,248, 49,  3,  0,  0,  0,  0,255,255, 15,  0,  0,  0,  0,  0,
-255,127,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 73, 77,  0,  0,240,  1,  0,  0,136,168, 49,  3,  0,  0,  0,  0,
- 23,  0,  0,  0,  1,  0,  0,  0,136,187, 49,  3,  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, 73, 77, 73,109, 97,103,101, 46, 48, 48, 49,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 85,110,116,105,116,108,101,100,  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,  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,100,  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,  1,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+160,  0,  0,  0, 88, 26,  8,  4,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,120, 29, 24,  4,  0,  0,  0,  0,136,225, 23,  4,
+  0,  0,  0,  0,248,212,144,  2,  0,  0,  0,  0,216,225,211,  2,  0,  0,  0,  0, 72,112,225,  2,  0,  0,  0,  0, 40,244,211,  2,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,191,  3,  0,  0,  0,  0,  0,  0,235,  3,  0,  0,  1,  1,192,  3,
+236,  3,  1,  0,  0,  0,  0,  0,  7,  0,  9,  0,168, 44,147,  2,  0,  0,  0,  0,104, 13, 24,  4,  0,  0,  0,  0,104, 13, 24,  4,
+  0,  0,  0,  0,200,  6, 24,  4,  0,  0,  0,  0, 56,  8, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,216, 64,242,  3,  0,  0,  0,  0,  8,206,243,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0,200,  6, 24,  4,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0, 56,  8, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,128, 53, 68,  0,  0,  0,  0,  0,  0,184, 65,  0,  0,  0,  0,  0,  0,112, 68,  0,  0,  0,  0,  0,  0,184, 65,  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,
+191,  3,  0,  0,  0,  0,  0,  0, 22,  0,  0,  0,  0,192,111, 68,  0,  0,176, 65,  0,192,111, 68,  0,  0,176, 65,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,192,  3, 23,  0,192,  3, 23,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,191,  3,  0,  0,  0,  0,  0,  0, 22,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,192,  3, 23,  0,  7,  0,  1,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8, 55,147,  2,  0,  0,  0,  0, 56, 19,198,  4,  0,  0,  0,  0, 56, 19,198,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24,231,185,  2,  0,  0,  0,  0,184,137,218,  2,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0, 56,  8, 24,  4,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200,  6, 24,  4,  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,  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,  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,  0,  0,191,  3,  0,  0, 23,  0,  0,  0,235,  3,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,192,  3,213,  3,  8,  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,200, 45,147,  2,  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, 72,105,218,  2,  0,  0,  0,  0,120,104,218,  2,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,168,  9, 24,  4,  0,  0,  0,  0, 68, 65, 84, 65,112,  3,  0,  0,168,  9, 24,  4,
+  0,  0,  0,  0,173,  0,  0,  0,  1,  0,  0,  0,  0, 16,143, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,140, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 80,  1,128,191,  0,  0,128,191,  0,  0,  0,  0,
+  0,  0,  0,  0,225,215,163,188,  0,  0,  0,  0,197, 56, 16, 63,181,165,214,190,216, 65, 54, 63,  0,  0,  0,  0,103,115, 83, 63,
+179,248,135, 62,228,147,254,190,  0,  0,  0,  0,155,199,158, 60, 68, 64, 94, 63,111,229,253, 62,  0,  0,  0,  0,239,219,254,191,
+166, 80,144,192,255, 66, 63,194,  0,  0,128, 63,215, 56, 16, 63,100,115, 83, 63, 74,200,158, 60,  0,  0,  0,  0,200,165,214,190,
+182,248,135, 62, 79, 64, 94, 63,  0,  0,  0,  0,215, 65, 54, 63,242,147,254,190,103,229,253, 62,  0,  0,  0,  0,102, 23,  5, 66,
+  7,118,167,193, 47, 82,221, 65,  0,  0,128, 63,115, 49, 33, 63, 62,197,234,190,182, 67, 54,191,216, 65, 54,191, 91, 85,108, 63,
+  4,184,148, 62,128,150,254, 62,228,147,254, 62,216,118,177, 60, 74, 22,115, 63,  9,232,253,190,111,229,253,190,200,108, 14,192,
+ 54,216,157,192,122, 48, 63, 66,255, 66, 63, 66, 17,195,  0, 63,120, 92, 61, 63,162,188,134, 60, 16,166,  7,184,158, 12,196,190,
+212, 97,120, 62,195, 72, 75, 63,  0,200, 68, 55,202,124,207,196,221,136,130, 68,161,132,172,196,200,140, 71,194, 47,104,207, 68,
+ 82,122,130,196,146,118,172, 68,224,142, 71, 66,197, 56, 16, 63,181,165,214,190,216, 65, 54, 63,  0,  0,  0,  0,103,115, 83, 63,
+179,248,135, 62,228,147,254,190,  0,  0,  0,  0,155,199,158, 60, 68, 64, 94, 63,111,229,253, 62,  0,  0,  0,  0, 62,101,214,192,
+127, 55, 88,192, 97, 89, 45,194,  0,  0,128, 63,115, 49, 33, 63, 62,197,234,190,182, 67, 54,191,216, 65, 54,191, 91, 85,108, 63,
+  4,184,148, 62,128,150,254, 62,228,147,254, 62,216,118,177, 60, 74, 22,115, 63,  9,232,253,190,111,229,253,190,232,159,239,192,
+180,124,108,192,174, 70, 45, 66, 97, 89, 45, 66,  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,  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,  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,  1,  0,  0,  0,  1,  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,200,170, 49,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,184,117, 30, 78,  0,  0,  0,  1,  0,  1,  1,  0,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 40,  0,  0,  0,
-200,170, 49,  3,  0,  0,  0,  0, 11,  0,  0,  0,  1,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  1,  0,  0,  0,  0,  0, 56,171, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  0, 16,  0,  0,
- 56,171, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 88,223,193, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 88,223,193, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 88,223,193, 64,  0,  0,  0,  0,113, 36,122, 61,
+157, 24,186,192, 28, 38, 71, 64,  0,  0,128, 63,153, 42, 67, 63,246, 62,229,190,251,142,104,190,131, 17,209,190,141,  8, 56, 66,
+223,139, 15, 66,  0,  0,  0,  0,  0,  0,  0,  0, 15, 81,244, 58, 80,127,  4,191,250,204,248,191, 74, 51,155,192,  0,  0,  0,  0,
+  1,  1,  0,  0,255,255,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+ 46,219, 35, 66, 48,203,139, 66,250, 65, 96, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 96,  1,  0,  0,104, 13, 24,  4,  0,  0,  0,  0,174,  0,  0,  0,  1,  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,  1,  0,  0,  0, 51, 51, 51, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 17,139, 48, 63,240,151, 31,191,155, 98,151,190, 77, 45, 97,190,141,  8, 56, 66,
+205,204, 76, 62,  2,  0,  0,  0,  0,  0,  0,  0,255, 13,  0,  0,  1,  0,  0,  0, 72,166, 24,  4,  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,  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,  0,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0,  8, 24,128,  0,  0,  0, 12, 66,  0,  0,128, 63,
+ 10,215, 35, 60,  0,  0,250, 67, 80,127,  4,191,250,204,248,191, 74, 51,155,192, 96,199, 41,188,225,230, 30,193,216,129,230, 63,
+  0,  0, 20,  0, 10,  0,  7,  1,  1,  3,  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,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0,120, 29, 24,  4,
+  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 88, 26,  8,  4,  0,  0,  0,  0, 40, 18,224,  2,
+  0,  0,  0,  0, 72,112,225,  2,  0,  0,  0,  0,232,  4,  9,  4,  0,  0,  0,  0,152, 18,186,  2,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,193,  3,  0,  0, 11,  6,  0,  0,201,  2,  0,  0,235,  3,  0,  0,  3,  3, 75,  2, 35,  1,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,168, 38,147,  2,  0,  0,  0,  0, 72, 33, 24,  4,  0,  0,  0,  0, 72, 33, 24,  4,  0,  0,  0,  0,104, 30, 24,  4,
+  0,  0,  0,  0,216, 31, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 88, 47,243,  3,
+  0,  0,  0,  0, 24,106,218,  2,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0,104, 30, 24,  4,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,216, 31, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,229, 67,  0,  0,  0,  0,
+  0,  0,184, 65,  0,  0,  0,  0,  0,192, 18, 68,  0,  0,  0,  0,  0,  0,184, 65,  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, 74,  2,  0,  0,  0,  0,  0,  0,
+ 22,  0,  0,  0,  0,128, 18, 68,  0,  0,176, 65,  0,128, 18, 68,  0,  0,176, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 75,  2, 23,  0, 75,  2, 23,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,193,  3,  0,  0, 11,  6,  0,  0,201,  2,  0,  0,223,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 75,  2, 23,  0,  9,  0,  1,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,184, 40,147,  2,  0,  0,  0,  0,  8,109,145,  2,  0,  0,  0,  0,  8,109,145,  2,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24,214,185,  2,  0,  0,  0,  0, 40,135,217,  2,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0,216, 31, 24,  4,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,104, 30, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,207, 67,  0,  0, 61,195,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 14, 68,  0,  0,122,195,  0,  0,  0,  0, 58,  2,  0,  0, 75,  2,  0,  0, 18,  0,  0,  0,
+ 11,  1,  0,  0,  0,  0,  0,  0, 57,  2,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0, 57,  2,  0,  0, 18,  0,  0,  0,
+ 11,  1,  0,  0,  0,  0,190,195,  0,  0,190,195,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63, 18,  6,  0,  0,
+  2,  0,  3,  3,  0,  0, 12,  4,  6,  0, 75,  2, 12,  1, 58,  2,250,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,193,  3,  0,  0, 11,  6,  0,  0,224,  2,  0,  0,235,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 75,  2, 12,  1, 10,  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,200, 39,147,  2,  0,  0,  0,  0,248,144,197,  4,  0,  0,  0,  0,248,144,197,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,184,249,187,  2,  0,  0,  0,  0,  8,199,185,  2,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  1,  0,  0, 72, 33, 24,  4,  0,  0,  0,  0,183,  0,  0,  0,
+  1,  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,  3,  0,  0,  0, 51, 51, 51, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,182, 67,  0,  0,209,195,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,182, 67,  0,  0,190,195,  0,  0,  0,181,  0,  0,  0,  0,
+ 16,  0,  0,  0,  0,  0,  0,  0,124,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16,  0,  0,  0,
+124,  1,  0,  0,  0,  0,  0,  0,124,  1,  0,  0,  0,  0,190,195,  0,  0,190,195,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  1,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,108,  1,124,  1,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,136,156,217,  2,  0,  0,  0,  0,136,156,217,  2,  0,  0,  0,  0,184, 71,218,  2,
+  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,  0,  0,  1,  0, 12,  0,  1,  0,  0,  0, 68, 65, 84, 65,
+ 16,  0,  0,  0,184, 71,218,  2,  0,  0,  0,  0,237,  0,  0,  0,  1,  0,  0,  0,218,  0,  0,  0,101,  0,  0,  0,168, 82,  2,  4,
+  0,  0,  0,  0, 68, 65, 84, 65, 80,  6,  0,  0,168, 82,  2,  4,  0,  0,  0,  0,236,  0,  0,  0,101,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 72, 41, 24,  4,  0,  0,  0,  0, 19,  0,  0,  0,  1,  0,  0,  0, 72, 41, 24,  4,  0,  0,  0,  0, 20,  0,  0,  0,
+  1,  0,  0,  0, 72, 41, 24,  4,  0,  0,  0,  0, 23,  0,  0,  0,  1,  0,  0,  0, 88,162, 24,  4,  0,  0,  0,  0, 21,  0,  1,  0,
+  1,  0,  0,  0, 72, 41, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,152,153, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,104,142, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,216,208, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0, 88,120, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,200,233, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,216,208, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,168,227, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,168, 20,196,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,104,142, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,216,208, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 88,120, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,216,208, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,136,221, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,104,215, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,104,142, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,216,208, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 88,120, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,216,208, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 72,209, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,104,142, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,216,208, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0, 40,203, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 88,120, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,  8,197, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,216,208, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,104,142, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,216,208, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,232,190, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 88,120, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0, 72,166, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,200,114, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0, 56,108, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,232,116, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,200,184, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,216,208, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,200,177, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,136,227, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0, 56, 66, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  8,  8,196,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,120,164, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,120,206, 26,  4,  0,  0,  0,  0,  9,  0,  0,  0,
+  1,  0,  0,  0, 56, 66, 25,  4,  0,  0,  0,  0, 10,  0,  0,  0,  1,  0,  0,  0, 56, 66, 25,  4,  0,  0,  0,  0, 29,  0,  0,  0,
+  1,  0,  0,  0, 56, 66, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,200, 18, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0, 72,149, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 88,120, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,216,208, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  8, 13, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0, 56,140, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 72,  7, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,232,135, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,216, 59, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,  8,157,198,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,104,142, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0, 88, 48, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,168,121, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0, 24, 54, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 56,142,198,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,232,198, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,248,113, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,200,120,198,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,216,189, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,120,206, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,152, 42, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,200, 43,196,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,120,164, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,136, 24, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,232,105,198,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,120,206, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  8,246, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,104,126, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,216, 36, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,120,164, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,136,  1, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,136,144, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 72, 30, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,136, 37, 27,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,120,206, 26,  4,  0,  0,  0,  0,  9,  0,  0,  0,
+  1,  0,  0,  0, 72, 30, 25,  4,  0,  0,  0,  0, 10,  0,  0,  0,  1,  0,  0,  0, 72, 30, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,200,251, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 40,131, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,  8,172, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,216,115, 24,  4,  0,  0,  0,  0, 30,  0,255,255,
+  0,  0,  1,  0,224,111,238,  1,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  1,  0,224,111,238,  1,  0,  0,  0,  0, 31,  0,  1,  0,
+  1,  0,  1,  0,224,111,238,  1,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  1,  0,224,111,238,  1,  0,  0,  0,  0, 31,  0,  3,  0,
+  1,  0,  1,  0,224,111,238,  1,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  1,  0,224,111,238,  1,  0,  0,  0,  0, 31,  0,  5,  0,
+  1,  0,  1,  0,224,111,238,  1,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  1,  0,224,111,238,  1,  0,  0,  0,  0, 31,  0,  7,  0,
+  1,  0,  1,  0,224,111,238,  1,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  1,  0,224,111,238,  1,  0,  0,  0,  0, 31,  0,  9,  0,
+  1,  0,  1,  0,224,111,238,  1,  0,  0,  0,  0, 83, 67,  0,  0,216, 11,  0,  0, 72, 41, 24,  4,  0,  0,  0,  0,171,  0,  0,  0,
+  1,  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, 83, 67,112,114,101,118,105,101,119,  0,  0, 99,101,110,101, 46, 48, 48, 49,  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,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 72,166, 24,  4,  0,  0,  0,  0,152,153, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,104, 53, 24,  4,
+  0,  0,  0,  0,168, 65, 24,  4,  0,  0,  0,  0,168, 58, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,236, 81,122, 61,
+230,224,239,192,116, 34, 53,192,113, 36,122, 61,157, 24,186,192, 28, 38, 71, 64,113, 36,122, 61,157, 24,186,192, 28, 38, 71, 64,
+113, 36,122, 61,157, 24,186,192, 28, 38, 71, 64,  2,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24, 66, 24,  4,  0,  0,  0,  0,  8,208,196,  4,  0,  0,  0,  0,  4,  2, 24,  0,
+ 90, 90,  2,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68,172,  0,  0,  2,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  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,  2,  0,  0,  0,  1,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,100,  0,  0,  0,100,  0,  0,  0,  0,  0,  1,  0,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128,  2,224,  1, 60,  0, 32,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0, 25,  0,141,  0, 88,  2,
+ 88,  2,  4,  0,  4,  0, 24,  0,  4,  0,  0,  0, 90,  0,  1,  0, 16,  0,  0,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 64,  0,  0,  0,  0,  0,  5,  0, 25,  0, 10,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72, 68, 24,  4,
+  0,  0,  0,  0, 72, 68, 24,  4,  0,  0,  0,  0,  0,  0,  5,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,128, 63,  0,  0,128, 63,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  2,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 47,116,109,112, 47,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -1429,10 +1347,107 @@ char datatoc_preview_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,205,204, 76, 63,205,204, 76, 63,205,204, 76, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  6,  0, 16,  0,  0,  0,128, 63,  0,  0,128, 63,173,  2, 95,  0,154,153,217, 63,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  1,  0,
+180,  0,  0,  0,  0,  0,128, 63,  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, 68,172,  0,  0,  0,  0,128, 63,102,166,171, 67,
+  0,  0,128, 63,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  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, 67, 53,  3,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,176,147,224,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,104,140,  2,  4,
+  0,  0,  0,  0,  1,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128,  2,224,  1, 60,  0, 32,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  1,  0,
+180,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  5,  0,205,204,204, 61,154,153,153, 62,
+205,204, 76, 62,219, 15, 73, 63,102,102,102, 63,  0,  0,  0, 64,154,153, 25, 63,  0,  0, 64, 65,102,102,166, 63,  0,  0,  0, 65,
+  0,  0,160, 65,  6,  0,  0,  0,  0,  0,192, 64,  0,  0,128, 63,  0,  0,  0,  0,205,204, 28, 65,  0,  0,  0,  0, 32,  0,  0,  0,
+ 32,  0,  0,  0,128,  0,  5,  0,218,  0,  0,  0, 60,  0,  5,  0,  1,  0,  5,  0,  0,  0,  0,  0,  0,  0,  0, 64,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,195,245, 28,193,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 25,  0,  0, 38,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,104, 53, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0,216, 53, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 14,  4,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,101,  1,179,  1, 40,203, 24,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,216, 53, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0, 72, 54, 24,  4,  0,  0,  0,  0,104, 53, 24,  4,
+  0,  0,  0,  0, 14,  4,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,113,  1,195,  1,  8,197, 24,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 72, 54, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0,184, 54, 24,  4,  0,  0,  0,  0,216, 53, 24,  4,
+  0,  0,  0,  0, 14,  4,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,131,  1,175,  1,232,190, 24,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,184, 54, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0, 40, 55, 24,  4,  0,  0,  0,  0, 72, 54, 24,  4,
+  0,  0,  0,  0, 33,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,224, 46,162,  0,200,233, 24,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 40, 55, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0,152, 55, 24,  4,  0,  0,  0,  0,184, 54, 24,  4,
+  0,  0,  0,  0, 33,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0, 25,  1, 84,  2,232,239, 24,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,152, 55, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0,  8, 56, 24,  4,  0,  0,  0,  0, 40, 55, 24,  4,
+  0,  0,  0,  0, 33,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,105,  1, 77,  2,168,227, 24,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,  8, 56, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0,120, 56, 24,  4,  0,  0,  0,  0,152, 55, 24,  4,
+  0,  0,  0,  0, 33,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,142,  3,183,  0,136,221, 24,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,120, 56, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0,232, 56, 24,  4,  0,  0,  0,  0,  8, 56, 24,  4,
+  0,  0,  0,  0, 33,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,135,  2,121,  1,104,215, 24,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,232, 56, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0, 88, 57, 24,  4,  0,  0,  0,  0,120, 56, 24,  4,
+  0,  0,  0,  0, 33,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,164,  1, 33,  2, 72,209, 24,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 88, 57, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0,200, 57, 24,  4,  0,  0,  0,  0,232, 56, 24,  4,
+  0,  0,  0,  0,  0,  8,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 42,  2, 90,  2, 72,166, 24,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,200, 57, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0, 56, 58, 24,  4,  0,  0,  0,  0, 88, 57, 24,  4,
+  0,  0,  0,  0,  0,  8,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,152,  3, 67,  3, 56,108, 26,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 56, 58, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0,168, 58, 24,  4,  0,  0,  0,  0,200, 57, 24,  4,
+  0,  0,  0,  0, 33,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,251,  1,225,  1,200,184, 24,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,168, 58, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0, 24, 59, 24,  4,  0,  0,  0,  0, 56, 58, 24,  4,
+  0,  0,  0,  0, 14,  4,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,141,  1,192,  1,200,177, 24,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 24, 59, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0,136, 59, 24,  4,  0,  0,  0,  0,168, 58, 24,  4,
+  0,  0,  0,  0,  0,  4,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  6,  3,138,  2, 56, 66, 25,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,136, 59, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0,248, 59, 24,  4,  0,  0,  0,  0, 24, 59, 24,  4,
+  0,  0,  0,  0, 32,  0,  0,  0, 14,  0,  0,  0,  0, 16,  0,  0,224,  1, 10,  2,200, 18, 25,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,248, 59, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0,104, 60, 24,  4,  0,  0,  0,  0,136, 59, 24,  4,
+  0,  0,  0,  0,  1,  0,  0,  0,  8,  0,  0,  0,  0, 20,  0,  0, 70,  1,168,  1,  8, 13, 25,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,104, 60, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0,216, 60, 24,  4,  0,  0,  0,  0,248, 59, 24,  4,
+  0,  0,  0,  0,  1,  0,  0,  0,  9,  0,  0,  0,  0, 20,  0,  0,115,  1,186,  1, 72,  7, 25,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,216, 60, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0, 72, 61, 24,  4,  0,  0,  0,  0,104, 60, 24,  4,
+  0,  0,  0,  0,  4,  0,  0,  0,  8,  0,  0,  0,  0,  0,  0,  0,  0,  1, 78,  1,216, 59, 25,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 72, 61, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0,184, 61, 24,  4,  0,  0,  0,  0,216, 60, 24,  4,
+  0,  0,  0,  0, 64,  0,  0,  0,  1,  0,  0,  0,  0, 16,  0,  0, 44,  3,140,  3, 88, 48, 25,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,184, 61, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0, 40, 62, 24,  4,  0,  0,  0,  0, 72, 61, 24,  4,
+  0,  0,  0,  0, 64,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,224, 46,119,  1, 24, 54, 25,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 40, 62, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0,152, 62, 24,  4,  0,  0,  0,  0,184, 61, 24,  4,
+  0,  0,  0,  0, 32,  0,  0,  0, 16,  0,  0,  0,  0,  0,  0,  0, 55,  2, 51,  2,248,113, 26,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,152, 62, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0,  8, 63, 24,  4,  0,  0,  0,  0, 40, 62, 24,  4,
+  0,  0,  0,  0, 16,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,216,  1,187,  1,152, 42, 25,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,  8, 63, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0,120, 63, 24,  4,  0,  0,  0,  0,152, 62, 24,  4,
+  0,  0,  0,  0,  1,  0,  0,  0, 10,  0,  0,  0,  0,  0,  0,  0,194,  1,205,  1,136, 24, 25,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,120, 63, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0,232, 63, 24,  4,  0,  0,  0,  0,  8, 63, 24,  4,
+  0,  0,  0,  0, 30,  4,  0,  0,  5,  0,  0,  0,  0, 20,  0,  0, 92,  2, 18,  1,  8,246, 24,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,232, 63, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0, 88, 64, 24,  4,  0,  0,  0,  0,120, 63, 24,  4,
+  0,  0,  0,  0,  2,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,208,  1,202,  1,216, 36, 25,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 88, 64, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0,200, 64, 24,  4,  0,  0,  0,  0,232, 63, 24,  4,
+  0,  0,  0,  0, 30,  4,  0,  0,  7,  0,  0,  0,  0, 20,  0,  0,  4,  1, 24,  2,136,  1, 25,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,200, 64, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0, 56, 65, 24,  4,  0,  0,  0,  0, 88, 64, 24,  4,
+  0,  0,  0,  0,  8,  0,  0,  0, 21,  0,  0,  0,  0,  0,  0,  0,180,  1,213,  1, 72, 30, 25,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 56, 65, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0,168, 65, 24,  4,  0,  0,  0,  0,200, 64, 24,  4,
+  0,  0,  0,  0, 30,  4,  0,  0,  8,  0,  0,  0,  0, 20,  0,  0, 23,  1,119,  1,200,251, 24,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,168, 65, 24,  4,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 56, 65, 24,  4,
+  0,  0,  0,  0,223, 13,  0,  0,  9,  0,  0,  0,  0,  4,  0,  0, 94,  1,162,  1,  8,172, 24,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+232,  1,  0,  0, 24, 66, 24,  4,  0,  0,  0,  0,167,  0,  0,  0,  1,  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,128, 63,  1,  0,  1,  0,205,204, 76, 63,
+  0,  0,180, 66,  9,  0,  1,  0,  0,  0,128, 63,111, 18,131, 58,205,204,204, 61,  0,  0,  1,  0, 32,  0, 32,  0, 32,  0,  1,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  1,  0,  1,  0,  0,  0,  1,  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,  2,  0, 80,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  7,  0,  5,  0,  5,  0,255,255, 50,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0, 63, 50,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63, 50,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0, 63, 50,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63, 50,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0, 63, 50,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63, 50,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0, 72, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 62,  0,  0,  0,  0,  1,  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,128, 63, 23,183,209, 56,205,204,204, 61,
+  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,250,  0,205,204,204, 61,205,204,204, 61,102,102,166, 63,  0,  0,192, 63,  0,  0,240, 65,
+ 72,225,122, 63,205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 67,  2,  0,  3,  2,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0,
+ 35,  0,  0,  0,  0,  0,  0, 62,  0,  0,  0, 63, 35,  0,  0,  0,  0,  0,  0, 62,  0,  0,  0, 63,  0,  0,  0,  0, 68, 65, 84, 65,
+120,  0,  0,  0, 72, 68, 24,  4,  0,  0,  0,  0,149,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 49, 32, 82,101,110,100,101,114, 76, 97,121,101,114,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 88,162, 24,  4,  0,  0,  0,  0,255,255, 15,  0,  0,  0,  0,  0,255,127,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 73, 77,  0,  0, 48,  5,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0, 24,  0,  0,  0,
+  1,  0,  0,  0,136, 92, 24,  4,  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, 73, 77, 73,109, 97,103,101, 46, 48, 48, 49,  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,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 85,110,116,105,
+116,108,101,100,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -1467,6 +1482,12 @@ char datatoc_preview_blend[]= {
   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,  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,  0,  0,  0,  0,  1,  0,  0,  0,  1,  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,200, 75, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+184,117, 30, 78,  0,  0,  0,  1,  0,  1,  1,  0,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 40,  0,  0,  0,200, 75, 24,  4,
+  0,  0,  0,  0, 12,  0,  0,  0,  1,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,
+  0,  0,  0,  0, 56, 76, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  0, 16,  0,  0, 56, 76, 24,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -1490,10 +1511,6 @@ char datatoc_preview_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 73, 77,  0,  0,240,  1,  0,  0,136,187, 49,  3,  0,  0,  0,  0,
- 23,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,136,168, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 73, 77, 82,101,110,100,101,114, 32, 82,101,115,117,108,116,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  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,  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,  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,
@@ -1504,12 +1521,6 @@ char datatoc_preview_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  5,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  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,200,189, 49,  3,  0,  0,  0,  0,
-  0,  0,  0,  0, 94,122, 30, 78,  0,  0,  0,  1,  0,  1,  1,  0,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 40,  0,  0,  0,
-200,189, 49,  3,  0,  0,  0,  0, 11,  0,  0,  0,  1,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  1,  0,  0,  0,  0,  0, 56,190, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  0, 16,  0,  0,
- 56,190, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -1604,7 +1615,11 @@ char datatoc_preview_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0, 73, 77,  0,  0, 48,  5,  0,  0,136, 92, 24,  4,  0,  0,  0,  0, 24,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 73, 77, 82,101,110,100,101,114, 32, 82,101,115,117,108,116,  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,  0,  0,  0,  1,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -1637,4194 +1652,4475 @@ char datatoc_preview_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 67, 65,  0,  0,136,  0,  0,  0,136,206, 49,  3,  0,  0,  0,  0,
- 21,  0,  0,  0,  1,  0,  0,  0, 88,207, 49,  3,  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, 67, 65, 67, 97,109,101,114, 97,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  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,  9,  0,205,204, 76, 62,
-  0,  0,128, 63,  0,  0,112, 66,  0,  0,240, 65,  0,  0,192, 64,  0,  0,  0, 63,  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, 67, 65,  0,  0,136,  0,  0,  0, 88,207, 49,  3,  0,  0,  0,  0,
- 21,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,136,206, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 67, 65, 67, 97,109,101,114, 97, 65,116,109,111,  0,  0, 48, 49,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  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, 13,  0,205,204, 76, 62,
-  0,  0,128, 63,210, 69,112, 66,  0,  0, 12, 66,161, 14,234, 64,  0,  0,  0, 63,  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, 76, 65,  0,  0,216,  1,  0,  0, 40,208, 49,  3,  0,  0,  0,  0,
- 33,  0,  0,  0,  1,  0,  0,  0, 72,212, 49,  3,  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, 76, 65, 76, 97,109,112, 46, 48, 48, 49,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,160, 65,  0,  0, 52, 66,154,153, 25, 62,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
- 72,210, 49,  3,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0, 63,  0,  0, 32, 66,  0,  0, 52, 66,  0,  0,128, 63,  0,  0, 64, 64,
-205,204, 76, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  3,  0,  1,  0,  0,  0,  0,  2,  1,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,111, 18,131, 58,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0, 32, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 64,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  5,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  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,  8, 98, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+ 77,248,131, 79,  0,  0,  0,  1,  0,  1,  1,  0,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 40,  0,  0,  0,  8, 98, 24,  4,
+  0,  0,  0,  0, 12,  0,  0,  0,  1,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,
+  0,  0,  0,  0,120, 98, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  0, 16,  0,  0,120, 98, 24,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  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,216,211, 49,  3,  0,  0,  0,  0,
- 68, 65, 84, 65, 64,  1,  0,  0, 72,210, 49,  3,  0,  0,  0,  0, 79,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  2,  0,  1,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,243,  4, 53,191,242,  4, 53, 63,
-242,  4, 53,191,243,  4, 53, 63,248, 80, 20,  3,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,
-248, 80, 20,  3,  0,  0,  0,  0, 77,  1,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,216,211, 49,  3,  0,  0,  0,  0, 11,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 76, 65,  0,  0,216,  1,  0,  0, 72,212, 49,  3,  0,  0,  0,  0, 33,  0,  0,  0,  1,  0,  0,  0,
-104,216, 49,  3,  0,  0,  0,  0, 40,208, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 76, 65, 76, 97,109,112, 46, 48, 48, 50,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,160, 65,182,152,143, 66,154,153, 25, 62,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,104,214, 49,  3,  0,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0, 63,  0,  0, 32, 66,  0,  0, 52, 66,  0,  0,128, 63,  0,  0, 64, 64,205,204, 76, 61,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  3,  0,  1,  0,  0,  0,  0,  0,  1,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,111, 18,131, 58,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,248,215, 49,  3,  0,  0,  0,  0, 68, 65, 84, 65, 64,  1,  0,  0,
-104,214, 49,  3,  0,  0,  0,  0, 79,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  2,  0,  1,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,243,  4, 53,191,242,  4, 53, 63,242,  4, 53,191,243,  4, 53, 63,
-120,136,192,  1,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,120,136,192,  1,  0,  0,  0,  0,
- 77,  1,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 40,  0,  0,  0,248,215, 49,  3,  0,  0,  0,  0, 11,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 76, 65,  0,  0,216,  1,  0,  0,104,216, 49,  3,  0,  0,  0,  0, 33,  0,  0,  0,  1,  0,  0,  0,136,220, 49,  3,  0,  0,  0,  0,
- 72,212, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 76, 65, 83,112,111,116,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  8, 16,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,247,255,239, 65,  0,  0,150, 66,
-154,153, 25, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,136,218, 49,  3,  0,  0,  0,  0,  2,  0,  0,  0, 46, 26,128, 63,
- 25,  4,240, 65,  0,  0, 52, 66,  0,  0,128, 63,  0,  0, 64, 64,205,204, 76, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 64, 11,  3,  0,  1,  0,  0,  0,  0,  0,  1,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-111, 18,131, 58,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
   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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 24,220, 49,  3,  0,  0,  0,  0, 68, 65, 84, 65, 64,  1,  0,  0,136,218, 49,  3,  0,  0,  0,  0,
- 79,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  2,  0,  1,  0,  0,  0,128, 67,
-  0,  0,  0,  0,  0,  0,128, 63,243,  4, 53,191,242,  4, 53, 63,242,  4, 53,191,243,  4, 53, 63,168,135,192,  1,  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,  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,
   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,  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,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,168,135,192,  1,  0,  0,  0,  0, 77,  1,  0,  0,  2,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,
- 24,220, 49,  3,  0,  0,  0,  0, 11,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 76, 65,  0,  0,216,  1,  0,  0,
-136,220, 49,  3,  0,  0,  0,  0, 33,  0,  0,  0,  1,  0,  0,  0,168,224, 49,  3,  0,  0,  0,  0,104,216, 49,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 76, 65, 83,112,111,116, 46, 48, 48, 49,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  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, 16,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,247,255,239, 65,  0,  0,150, 66,154,153, 25, 62,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,168,222, 49,  3,  0,  0,  0,  0,  2,  0,  0,  0, 46, 26,128, 63, 25,  4,240, 65,  0,  0, 52, 66,
-  0,  0,128, 63,  0,  0, 64, 64,205,204, 76, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64, 11,  3,  0,  1,  0,  0,  0,
-  0,  0,  1,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,111, 18,131, 58,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 56,224, 49,  3,  0,  0,  0,  0, 68, 65, 84, 65, 64,  1,  0,  0,168,222, 49,  3,  0,  0,  0,  0, 79,  1,  0,  0,  1,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  2,  0,  1,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,
-243,  4, 53,191,242,  4, 53, 63,242,  4, 53,191,243,  4, 53, 63, 72,151, 17,  3,  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,  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,  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,  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,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 24,  0,  0,  0, 72,151, 17,  3,  0,  0,  0,  0, 77,  1,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 56,224, 49,  3,  0,  0,  0,  0,
- 11,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 76, 65,  0,  0,216,  1,  0,  0,168,224, 49,  3,  0,  0,  0,  0,
- 33,  0,  0,  0,  1,  0,  0,  0, 88,228, 49,  3,  0,  0,  0,  0,136,220, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 76, 65, 83,112,111,116, 46, 48, 48, 51,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,247,255,239, 65,  0,  0,150, 66,154,153, 25, 62,  0,  0,128, 63,200,182, 27, 63,  0,  0,128, 63,
-200,226, 49,  3,  0,  0,  0,  0,  1,  0,  0,  0, 46, 26,128, 63, 25,  4,240, 65,  0,  0, 52, 66,  0,  0,128, 63,  0,  0, 64, 64,
-205,204, 76, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64, 11,  3,  0,  1,  0,  0,  0,  0,  0,  1,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,111, 18,131, 58,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 64,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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,  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,
- 68, 65, 84, 65, 64,  1,  0,  0,200,226, 49,  3,  0,  0,  0,  0, 79,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  2,  0,  1,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,243,  4, 53,191,242,  4, 53, 63,
-242,  4, 53,191,243,  4, 53, 63,248,172, 16,  3,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,
-248,172, 16,  3,  0,  0,  0,  0, 77,  1,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0, 76, 65,  0,  0,216,  1,  0,  0, 88,228, 49,  3,  0,  0,  0,  0, 33,  0,  0,  0,  1,  0,  0,  0,
-  8,232, 49,  3,  0,  0,  0,  0,168,224, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 76, 65, 83,112,111,116, 46, 48, 48, 52,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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, 16,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,205,204,204, 62,
-247,255,239, 65,  0,  0,150, 66,154,153, 25, 62,  0,  0,128, 63,200,182, 27, 63,  0,  0,128, 63,120,230, 49,  3,  0,  0,  0,  0,
-  1,  0,  0,  0, 46, 26,128, 63, 25,  4,240, 65,  0,  0, 52, 66,  0,  0,128, 63,  0,  0, 64, 64,205,204, 76, 61,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 64, 11,  3,  0,  1,  0,  0,  0,  0,  0,  1,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,111, 18,131, 58,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,
-120,230, 49,  3,  0,  0,  0,  0, 79,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  2,  0,  1,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,243,  4, 53,191,242,  4, 53, 63,242,  4, 53,191,243,  4, 53, 63,
-120,165, 16,  3,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,120,165, 16,  3,  0,  0,  0,  0,
- 77,  1,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
- 76, 65,  0,  0,216,  1,  0,  0,  8,232, 49,  3,  0,  0,  0,  0, 33,  0,  0,  0,  1,  0,  0,  0, 40,236, 49,  3,  0,  0,  0,  0,
- 88,228, 49,  3,  0,  0,  0,  0, 56, 33, 24,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 76, 65, 83,112,111,116, 46, 48,
- 48, 54,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,160, 64,  0,  0, 52, 66,  0,  0, 72, 66,
-171,156,  8, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 40,234, 49,  3,  0,  0,  0,  0,  2,  0,  0,  0, 78,207, 68, 65,
- 25,  4,240, 65,  0,  0, 52, 66,  0,  0,128, 63,  0,  0, 64, 64,205,204, 76, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  2,  3,  0,  1,  0,  0,  0,  0,  0,  1,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-111, 18,131, 58,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
   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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,184,235, 49,  3,  0,  0,  0,  0, 68, 65, 84, 65, 64,  1,  0,  0, 40,234, 49,  3,  0,  0,  0,  0,
- 79,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  2,  0,  1,  0,  0,  0,128, 67,
-  0,  0,  0,  0,  0,  0,128, 63,243,  4, 53,191,242,  4, 53, 63,242,  4, 53,191,243,  4, 53, 63,136,149, 16,  3,  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,  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,
   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,  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,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,136,149, 16,  3,  0,  0,  0,  0, 77,  1,  0,  0,  2,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,
-184,235, 49,  3,  0,  0,  0,  0, 11,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 76, 65,  0,  0,216,  1,  0,  0,
- 40,236, 49,  3,  0,  0,  0,  0, 33,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,232, 49,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 76, 65, 76, 97,109,112,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,192, 63,  0,  0,160, 65,  0,  0, 52, 66,154,153, 25, 62,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63, 72,238, 49,  3,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0, 63,  0,  0, 32, 66,  0,  0, 52, 66,
-  0,  0,128, 63,  0,  0, 64, 64,205,204, 76, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  3,  0,  1,  0,  0,  0,
-  0,  0,  1,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,111, 18,131, 58,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0, 72,238, 49,  3,  0,  0,  0,  0, 79,  1,  0,  0,  1,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  2,  0,  1,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,
-243,  4, 53,191,242,  4, 53, 63,242,  4, 53,191,243,  4, 53, 63,184,141, 16,  3,  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,  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,  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,  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,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 24,  0,  0,  0,184,141, 16,  3,  0,  0,  0,  0, 77,  1,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 87, 79,  0,  0,224,  1,  0,  0,216,239, 49,  3,  0,  0,  0,  0,
-129,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40,170,159,  4,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 87, 79, 87,111,114,108,100,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  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,
-233,150, 10, 61,119, 32, 14, 62, 31,130,137, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-205,204, 28, 65,  0,  0,  0,  0,  1,  0, 32,  0,128,  0,  5,  0, 60,  0,  5,  0,  1,  0,  5,  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, 64,  0,  0,  0,  0,
-  0,  0,112, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 65,  0,  0,  0,  0,  0,  0,128, 63,205,204, 76, 61,
-  0,  0,  5,  0,  3,  0,  0,  0, 10,215,163, 59,  0,  0,  0,  0,  0,  0,128, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,
-  0,  0,  0,  0,  1,  0,  0,  0,  2,  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,  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,  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,  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,
-  8,242, 49,  3,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,  8,242, 49,  3,  0,  0,  0,  0, 11,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 84, 88,  0,  0,176,  0,  0,  0,120,242, 49,  3,  0,  0,  0,  0, 19,  0,  0,  0,  1,  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,
- 84, 88, 84,101,120,116,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  7,  0,  0,  0,  1,  0,  0,  0,120,243, 49,  3,  0,  0,  0,  0,
-120,243, 49,  3,  0,  0,  0,  0,120,243, 49,  3,  0,  0,  0,  0,120,243, 49,  3,  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,232,243, 49,  3,  0,  0,  0,  0,255,255,255,255,  0,  4,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,120,243, 49,  3,  0,  0,  0,  0,
- 17,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40,180, 16,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 69, 69, 82, 70, 68, 65, 84, 65,  4,  0,  0,  0, 40,180, 16,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  1,  0, 71, 82,  0,  0,104,  0,  0,  0, 56,248, 49,  3,  0,  0,  0,  0,  7,  1,  0,  0,
-  1,  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, 71, 82, 79,118,101,114,114,105,100,101,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232,248, 49,  3,  0,  0,  0,  0,136,251, 49,  3,  0,  0,  0,  0,255,255, 15,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,232,248, 49,  3,  0,  0,  0,  0,  6,  1,  0,  0,
-  1,  0,  0,  0, 88,249, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24, 98, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 88,249, 49,  3,  0,  0,  0,  0,  6,  1,  0,  0,
-  1,  0,  0,  0,200,249, 49,  3,  0,  0,  0,  0,232,248, 49,  3,  0,  0,  0,  0,168, 92, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,200,249, 49,  3,  0,  0,  0,  0,  6,  1,  0,  0,
-  1,  0,  0,  0, 56,250, 49,  3,  0,  0,  0,  0, 88,249, 49,  3,  0,  0,  0,  0, 56, 87, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 56,250, 49,  3,  0,  0,  0,  0,  6,  1,  0,  0,
-  1,  0,  0,  0,168,250, 49,  3,  0,  0,  0,  0,200,249, 49,  3,  0,  0,  0,  0,120,128, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,168,250, 49,  3,  0,  0,  0,  0,  6,  1,  0,  0,
-  1,  0,  0,  0, 24,251, 49,  3,  0,  0,  0,  0, 56,250, 49,  3,  0,  0,  0,  0,232, 70, 50,  3,  0,  0,  0,  0, 40,181,151,  4,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 24,251, 49,  3,  0,  0,  0,  0,  6,  1,  0,  0,
-  1,  0,  0,  0,136,251, 49,  3,  0,  0,  0,  0,168,250, 49,  3,  0,  0,  0,  0,200, 81, 50,  3,  0,  0,  0,  0,168,218,225,  4,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,136,251, 49,  3,  0,  0,  0,  0,  6,  1,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24,251, 49,  3,  0,  0,  0,  0, 88, 76, 50,  3,  0,  0,  0,  0, 40,  6,154,  4,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,  0,  0, 32,  5,  0,  0,248,251, 49,  3,  0,  0,  0,  0,116,  0,  0,  0,
-  1,  0,  0,  0,104,  1, 50,  3,  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, 79, 66, 67, 97,109,101,114, 97,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,
-  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, 11,  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,  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,  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,136,206, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0,
- 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0,
- 10,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 78,199, 41,188,
-225,230, 30,193,216,129,230, 63,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,218, 15,201, 63,  0,  0,  0,128,
-  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,105, 33,162, 51,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,191,105, 33,162, 51,  0,  0,  0,  0,
- 78,199, 41,188,225,230, 30,193,216,129,230, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63, 64, 90,136, 48,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,168,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0, 64, 90,136,176,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0, 64, 90,136,176,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  1,  0,
-  0,  0, 68,  0, 79, 66,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0,
- 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  1,  0,  5,  0,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  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,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0, 64,  1,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,
   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,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 79, 66,  0,  0, 32,  5,  0,  0,104,  1, 50,  3,  0,  0,  0,  0,116,  0,  0,  0,  1,  0,  0,  0,216,  6, 50,  3,
-  0,  0,  0,  0,248,251, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 67, 97,
-109,101,114, 97, 65,116,109,111,  0, 97,109,101,114, 97, 46, 48, 48, 49,  0,  0,  1,  0,  0,  4,  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, 11,  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,  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,  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, 88,207, 49,  3,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 78,199, 41,188,225,230, 30,193,216,129,230, 63,
-  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,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,173, 47,244, 63,162,155,113, 37, 40, 80,170, 37,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63, 40, 80,170, 37,162,155,113,165,  0,  0,  0,  0, 39, 80,170, 37,157, 64,169,190,
-163,155,113, 63,  0,  0,  0,  0,165,155,113, 37,163,155,113,191,157, 64,169,190,  0,  0,  0,  0, 78,199, 41,188,225,230, 30,193,
-216,129,230, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,187, 35, 58,154,139,  2,174, 25,  0,  0,  0,  0,151, 29,171, 37,  1,  0,128, 63,
- 33,110, 77, 51,  0,  0,  0,  0,135,255,255, 45,158, 64,169, 50,  0,  0,128, 63,  0,  0,  0,  0, 30,  0,128, 48,  5, 80, 56, 53,
-157,216,128, 52,  0,  0,128, 63,  0,  0,128, 63, 38, 80,170, 37,163,155,113, 37,  0,  0,  0,  0,  0,  0,  0,  0,158, 64,169,190,
-162,155,113,191,  0,  0,  0,  0,  0,  0,  0,174,164,155,113, 63,157, 64,169,190,  0,  0,  0,  0, 77,199, 41, 60,158,113,159,192,
-150,113, 12,193,  0,  0,128, 63,  0,  0,128, 63, 40, 80,170, 37,166,155,113, 37,  0,  0,  0,  0,162,155,113,165,164,155,113, 63,
-158, 64,169,190,  0,  0,  0,  0, 40, 80,170,165,159, 64,169, 62,162,155,113, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,223, 13,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  5,  0,  1,  0,  0,  0,  0,  0, 79, 66,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,
-187,225, 16, 63,  0,  0,128, 63,205,204,204, 62,210, 32, 80, 63,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  1,  0,  2,  0,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,  0,  0,
- 32,  5,  0,  0,216,  6, 50,  3,  0,  0,  0,  0,116,  0,  0,  0,  1,  0,  0,  0, 40, 13, 50,  3,  0,  0,  0,  0,104,  1, 50,  3,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 99,104,101, 99,107,101,114,115, 46, 48,
- 48, 50,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  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,  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,  0,  0,  0,136,152,  3,  3,  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,248, 43, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,
-  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,120,233, 19,  3,  0,  0,  0,  0, 56, 90, 17,  3,
-  0,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0,113, 36,122, 61,157, 24,186,192, 28, 38, 71, 64,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,113, 36,122, 61,157, 24,186,192, 28, 38, 71, 64,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,113, 36,122,189,157, 24,186, 64, 28, 38, 71,192,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,255,255,127,191,  0,  0,192, 51,  0,  0,  0,  0, 34, 75,146,189, 36,181,131,192, 95,202,167,191,  0,  0,128, 63,
- 14,  4,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0, 79, 66,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,
-205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  1,  0,  5,  0,
-  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  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,  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,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72, 12, 50,  3,  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,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,137,  3,  3,
-  0,  0,  0,  0,200,144,  3,  3,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0,120,233, 19,  3,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,136,195, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
-  4,  0,  0,  0, 56, 90, 17,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0, 68, 65, 84, 65,152,  0,  0,  0,
- 72, 12, 50,  3,  0,  0,  0,  0,119,  0,  0,  0,  1,  0,  0,  0,  0,192,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  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,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,205,204,204, 61,205,204, 76, 62, 10,215,163, 60,  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,104,  0,  0,  0, 79, 66,  0,  0, 32,  5,  0,  0, 40, 13, 50,  3,  0,  0,  0,  0,116,  0,  0,  0,  1,  0,  0,  0,
-152, 18, 50,  3,  0,  0,  0,  0,216,  6, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 79, 66, 99,104,101, 99,107,101,114,115, 46, 48, 48, 51,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  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,  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,  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,
-120,117, 53,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,
-  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,
- 56,225, 20,  3,  0,  0,  0,  0,200,105, 17,  3,  0,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0,  0,131,102, 60, 14,112,164, 64,
- 24,211,229, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,178,159, 34, 65,
-178,159, 34, 65,177,159, 34, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,166,250, 89,178,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,178,159, 34, 65,151,120, 10,180,  0,  0,  0,  0,  0,  0,  0,  0,151,120, 10, 52,
-178,159, 34, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,177,159, 34, 65,  0,  0,  0,  0,  0,131,102, 60,
- 14,112,164, 64, 24,211,229, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,252,118,143,165,  0,  0,  0,  0,  0,  0,  0,  0,176,193,168,165,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,176,193, 40,155,
-  0,  0,  0, 53,  0,  0,  0,  0,  0,  0,128, 63,231,126,201, 61,218,145,171, 48,  0,  0,  0,  0,  0,  0,  0,  0,218,145,171,176,
-231,126,201, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232,126,201, 61,  0,  0,  0,  0,232,110,181,186,
-127,109,  1,191,172,228, 52,190,  0,  0,128, 63,231,126,201, 61,219,145,171, 48,  0,  0,  0, 31,  0,  0,  0,  0,  0,  0,218,164,
- 51, 57,255, 49,232,126,201, 61,  0,  0,  0,  0,  0,  0,172, 48,231,126,201,189,  0,192,251, 49,  0,  0,  0,  0, 18,136, 29,187,
-203,200,189,191,180,139,  9, 58,  0,  0,128, 63, 33,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0,
- 79, 66,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,
-  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  1,  0,  5,  0,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  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,  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,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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, 25,  0,  0,  0,  0,  0,  0,  0,
-  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 16,  0,  0,  0, 56,225, 20,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 24,217, 51,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0,200,105, 17,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-  1,  0,  0,  0, 79, 66,  0,  0, 32,  5,  0,  0,152, 18, 50,  3,  0,  0,  0,  0,116,  0,  0,  0,  1,  0,  0,  0,104, 24, 50,  3,
-  0,  0,  0,  0, 40, 13, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 99,104,
-101, 99,107,101,114,115, 46, 48, 48, 52,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 67, 65,  0,  0,200,  0,  0,  0,200,114, 24,  4,  0,  0,  0,  0, 22,  0,  0,  0,
+  1,  0,  0,  0,216,115, 24,  4,  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, 67, 65, 67, 97,109,101,114, 97,  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,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  9,  0,205,204, 76, 62,  0,  0,128, 63,  0,  0,112, 66,  0,  0,240, 65,  0,  0,192, 64,  0,  0,  0, 63,
+  0,  0,  0, 66,  0,  0,144, 65,  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, 67, 65,  0,  0,200,  0,  0,  0,216,115, 24,  4,  0,  0,  0,  0, 22,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200,114, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 67, 65, 67, 97,109,101,114, 97, 65,116,109,111,  0,  0, 48, 49,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 88,136,  3,  3,
-  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,248, 43, 52,  3,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  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, 13,  0,205,204, 76, 62,  0,  0,128, 63,210, 69,112, 66,  0,  0, 12, 66,161, 14,234, 64,  0,  0,  0, 63,
+  0,  0,  0, 66,  0,  0,144, 65,  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, 76, 65,  0,  0, 16,  2,  0,  0,232,116, 24,  4,  0,  0,  0,  0, 36,  0,  0,  0,
+  1,  0,  0,  0,168,121, 24,  4,  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, 76, 65, 76, 97,109,112, 46, 48, 48, 49,  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,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,160, 65,  0,  0, 52, 66,154,153, 25, 62,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63, 72,119, 24,  4,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0, 63,  0,  0, 32, 66,
+  0,  0, 52, 66,  0,  0,128, 63,  0,  0, 64, 64,205,204, 76, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  3,  0,
+  1,  0,  0,  0,  0,  2,  1,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,111, 18,131, 58,
+  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0, 32, 65,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8, 24, 50,  3,
-  0,  0,  0,  0,232,138, 16,  3,  0,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0,179,243,222, 63,139,224,239,192, 28, 38, 71, 64,
-  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,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,218, 15,201,191,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,105, 33,162, 51,  0,  0,128,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,105, 33,162, 51,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,179,243,222, 63,139,224,239,192,
- 28, 38, 71, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,191,  0,  0,160, 51,
-  0,  0,  0,179,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,139,224,239,192,174,243,222,191,
- 28, 38, 71,192,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,128, 63,  0,  0,128, 51,  0,  0,  0,  0,104, 33,162,179,  0,  0,128, 39,
-  0,  0,128, 63,  0,  0,  0,  0,255,255,127, 63,  0,  0,  0,  0,  0,  0,  0, 52,  0,  0,  0,  0,109,218, 27, 64, 67, 71,224,191,
- 96,202,167,191,  0,  0,128, 63, 14,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0, 79, 66,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,
-169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  1,  0,  5,  0,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  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,  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,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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, 56,121, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 64,  1,  0,  0, 72,119, 24,  4,
+  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  2,  0,  1,  0,
+  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,243,  4, 53,191,242,  4, 53, 63,242,  4, 53,191,243,  4, 53, 63,216,120, 24,  4,
   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,216,120,  3,  3,  0,  0,  0,  0,152,128,  3,  3,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 16,  0,  0,  0,  8, 24, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0,232,138, 16,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
- 79, 66,  0,  0, 32,  5,  0,  0,104, 24, 50,  3,  0,  0,  0,  0,116,  0,  0,  0,  1,  0,  0,  0, 56, 30, 50,  3,  0,  0,  0,  0,
-152, 18, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 99,104,101, 99,107,101,
-114,115, 46, 48, 48, 55,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  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,  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,  0,  0,  0, 40,120,  3,  3,  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,248, 43, 52,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,
-  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,216, 29, 50,  3,  0,  0,  0,  0,
- 56,209,  3,  2,  0,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0,149, 78,207,191, 65,225,239,192, 28, 38, 71, 64,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,228,203,150,192,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 46,222, 76, 50,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,191, 46,222, 76, 50,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,149, 78,207,191, 65,225,239,192, 28, 38, 71, 64,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,128,  0,  0,128,191,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,128, 63,  0,  0,  0,  0,  0,  0,128,179,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0, 66,225,239, 64,149, 78,207,191, 29, 38, 71,192,
-  0,  0,128, 63,  0,  0,  0,  0,255,255,127,191,  0,  0,  0,  0,  0,  0,  0,  0,104, 33,162, 51,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,255,255,127,191,  0,  0,  0,  0,  0,  0,128, 51,  0,  0,  0,  0,  2,217, 27,192,  5,251,205,191, 97,202,167,191,
-  0,  0,128, 63, 14,  4,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0, 79, 66,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,
-  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  1,  0,  5,  0,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,216,120, 24,  4,  0,  0,  0,  0,117,  1,  0,  0,
+  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 56,121, 24,  4,  0,  0,  0,  0, 12,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 76, 65,  0,  0,
+ 16,  2,  0,  0,168,121, 24,  4,  0,  0,  0,  0, 36,  0,  0,  0,  1,  0,  0,  0,104,126, 24,  4,  0,  0,  0,  0,232,116, 24,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 76, 65, 76, 97,109,112, 46, 48, 48, 50,  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,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  2,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,160, 65,182,152,143, 66,154,153, 25, 62,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  8,124, 24,  4,
+  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0, 63,  0,  0, 32, 66,  0,  0, 52, 66,  0,  0,128, 63,  0,  0, 64, 64,205,204, 76, 61,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  3,  0,  1,  0,  0,  0,  0,  0,  1,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,111, 18,131, 58,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 64,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-168, 65,253,  2,  0,  0,  0,  0,104,112,  3,  3,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  1,  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,248,125, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 64,  1,  0,  0,  8,124, 24,  4,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  2,  0,  1,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,243,  4, 53,191,
+242,  4, 53, 63,242,  4, 53,191,243,  4, 53, 63,152,125, 24,  4,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0,
-216, 29, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,136,195, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65,  4,  0,  0,  0, 56,209,  3,  2,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0, 79, 66,  0,  0,
- 32,  5,  0,  0, 56, 30, 50,  3,  0,  0,  0,  0,116,  0,  0,  0,  1,  0,  0,  0,  8, 36, 50,  3,  0,  0,  0,  0,104, 24, 50,  3,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 99,104,101, 99,107,101,114,115, 46, 48,
- 48, 56,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  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,  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,  0,  0,  0,104, 23, 20,  3,  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,248, 43, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,
-  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,168, 35, 50,  3,  0,  0,  0,  0,200,210,  3,  2,
-  0,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0,142,127,122, 61,152,212, 18,193, 28, 38, 71, 64,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,218, 15, 73,192,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128,191,105, 33, 34,180,  0,  0,  0,  0,  0,  0,  0,  0,105, 33, 34, 52,  0,  0,128,191,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,142,127,122, 61,152,212, 18,193, 28, 38, 71, 64,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128,191,105, 33, 34, 52,  0,  0,128, 39,  0,  0,  0,  0,  0,  0, 34,180,  0,  0,128,191,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0, 27,126,122, 61,152,212, 18,193, 28, 38, 71,192,  0,  0,128, 63,
-  0,  0,128,191,106, 33, 34, 52, 95,202,167, 28,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,179,  0,  0,128, 63,  0,  0,  0,  0,
-106, 33, 34, 52,  1,  0,128, 63,  0,  0,160, 51,  0,  0,  0,  0,192,120,146, 61,145, 36, 65, 63, 95,202,167,191,  0,  0,128, 63,
- 14,  4,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0, 79, 66,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,
-205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  1,  0,  5,  0,
-  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  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,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 24,  0,  0,  0,152,125, 24,  4,  0,  0,  0,  0,117,  1,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,248,125, 24,  4,  0,  0,  0,  0, 12,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 76, 65,  0,  0, 16,  2,  0,  0,104,126, 24,  4,  0,  0,  0,  0, 36,  0,  0,  0,
+  1,  0,  0,  0, 40,131, 24,  4,  0,  0,  0,  0,168,121, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 76, 65, 83,112,111,116,  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,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  8, 16,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,247,255,239, 65,  0,  0,150, 66,154,153, 25, 62,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,200,128, 24,  4,  0,  0,  0,  0,  2,  0,  0,  0, 46, 26,128, 63, 25,  4,240, 65,
+  0,  0, 52, 66,  0,  0,128, 63,  0,  0, 64, 64,205,204, 76, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64, 11,  3,  0,
+  1,  0,  0,  0,  0,  0,  1,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,111, 18,131, 58,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40, 50,253,  2,
-  0,  0,  0,  0,232, 57,253,  2,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0,168, 35, 50,  3,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,136,195, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
-  4,  0,  0,  0,200,210,  3,  2,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0, 79, 66,  0,  0, 32,  5,  0,  0,
-  8, 36, 50,  3,  0,  0,  0,  0,116,  0,  0,  0,  1,  0,  0,  0,216, 41, 50,  3,  0,  0,  0,  0, 56, 30, 50,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 99,104,101, 99,107,101,114,115, 46, 48, 49, 48,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  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,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,184,130, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 64,  1,  0,  0,200,128, 24,  4,
+  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  2,  0,  1,  0,
+  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,243,  4, 53,191,242,  4, 53, 63,242,  4, 53,191,243,  4, 53, 63, 88,130, 24,  4,
   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,  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,120,117, 53,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,
-  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,120, 41, 50,  3,  0,  0,  0,  0,184,226, 19,  3,  0,  0,  0,  0,
-  2,  0,  0,  0,  1,  0,  0,  0,227,252,129,193, 14,112,164, 64,  9,197,229, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,178,159, 34, 65,178,159, 34, 65,177,159, 34, 65,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,166,250, 89,178,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,178,159, 34, 65,
-151,120, 10,180,  0,  0,  0,  0,  0,  0,  0,  0,151,120, 10, 52,178,159, 34, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,177,159, 34, 65,  0,  0,  0,  0,227,252,129,193, 14,112,164, 64,  9,197,229, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
- 17, 66,216,178,  0,  0,  0,  0,  0,  0,  0,  0,176,193,168,165,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,176,193, 40, 27,  0,  0,  0,181,  0,  0,  0, 52,  0,  0,128, 63,231,126,201, 61,
-  0,  0,128, 49,  0,  0,  0,  0,  0,  0,  0,  0,218,145,171,176,231,126,201, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,232,126,201, 61,  0,  0,  0,  0,252,159,204, 63,126,109,  1,191,156,217, 52,190,  0,  0,128, 63,231,126,201, 61,
-  0,  0,  0,178,  0,  0,128, 44,  0,  0,  0,  0, 95, 81,217,164, 51, 57,255, 49,232,126,201, 61,  0,  0,  0,  0,219,145,171, 48,
-231,126,201,189,161,222,251, 49,  0,  0,  0,  0,148,126,204, 63,204,200,189,191,117,156, 20, 58,  0,  0,128, 63, 33,  0,  0,  0,
-  0,  0,  1,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0, 79, 66,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,
-236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  1,  0,  5,  0,  1,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  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,  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,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 88,130, 24,  4,  0,  0,  0,  0,117,  1,  0,  0,
+  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,184,130, 24,  4,  0,  0,  0,  0, 12,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 76, 65,  0,  0,
+ 16,  2,  0,  0, 40,131, 24,  4,  0,  0,  0,  0, 36,  0,  0,  0,  1,  0,  0,  0,232,135, 24,  4,  0,  0,  0,  0,104,126, 24,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 76, 65, 83,112,111,116, 46, 48, 48, 49,  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,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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, 16,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,247,255,239, 65,  0,  0,150, 66,154,153, 25, 62,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,136,133, 24,  4,
+  0,  0,  0,  0,  2,  0,  0,  0, 46, 26,128, 63, 25,  4,240, 65,  0,  0, 52, 66,  0,  0,128, 63,  0,  0, 64, 64,205,204, 76, 61,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64, 11,  3,  0,  1,  0,  0,  0,  0,  0,  1,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,111, 18,131, 58,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 64,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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, 25,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0,120, 41, 50,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0, 24,217, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0,
-184,226, 19,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0, 79, 66,  0,  0, 32,  5,  0,  0,216, 41, 50,  3,
-  0,  0,  0,  0,116,  0,  0,  0,  1,  0,  0,  0,168, 47, 50,  3,  0,  0,  0,  0,  8, 36, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 99,104,101, 99,107,101,114,115, 46, 48, 49, 51,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  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,  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,120,135, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 64,  1,  0,  0,136,133, 24,  4,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  2,  0,  1,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,243,  4, 53,191,
+242,  4, 53, 63,242,  4, 53,191,243,  4, 53, 63, 24,135, 24,  4,  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,  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,120,117, 53,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,
-250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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, 72, 47, 50,  3,  0,  0,  0,  0,232,160, 17,  3,  0,  0,  0,  0,  2,  0,  0,  0,
-  1,  0,  0,  0,  8, 56,130, 65, 14,112,164, 64, 35,197,229, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,178,159, 34, 65,178,159, 34, 65,177,159, 34, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,128,166,250, 89,178,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,178,159, 34, 65,151,120, 10,180,
-  0,  0,  0,  0,  0,  0,  0,  0,151,120, 10, 52,178,159, 34, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-177,159, 34, 65,  0,  0,  0,  0,  8, 56,130, 65, 14,112,164, 64, 35,197,229, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,254,255,127, 63, 15, 66,216,178,
-  0,  0,  0,  0,  0,  0,  0,  0,138,222,112, 38,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,138,222,112, 28,  0,  0,128, 53,  0,  0,  0,  0,  0,  0,128, 63,232,126,201, 61,  0,  0,128, 49,
-  0,  0,  0,  0,  0,  0,  0,  0,219,145,171,176,231,126,201, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-232,126,201, 61,  0,  0,  0,  0, 23,253,204,191,128,109,  1,191,176,217, 52,190,  0,  0,128, 63,230,126,201, 61,  0,  0,  0,178,
-  0,  0,128,172,  0,  0,  0,  0, 94, 81,217,164, 51, 57,255, 49,232,126,201, 61,  0,  0,  0,  0,217,145,171, 48,231,126,201,189,
-161,222,251, 49,  0,  0,  0,  0,127, 30,205,191,203,200,189,191,254,135, 20, 58,  0,  0,128, 63, 33,  0,  0,  0,  0,  0,  1,  0,
-  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0, 79, 66,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,
-  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  1,  0,  5,  0,  1,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  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,  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,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 24,  0,  0,  0, 24,135, 24,  4,  0,  0,  0,  0,117,  1,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,120,135, 24,  4,  0,  0,  0,  0, 12,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 76, 65,  0,  0, 16,  2,  0,  0,232,135, 24,  4,  0,  0,  0,  0, 36,  0,  0,  0,
+  1,  0,  0,  0, 56,140, 24,  4,  0,  0,  0,  0, 40,131, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 76, 65, 83,112,111,116, 46, 48, 48, 51,  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,
-  0,  0,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  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,  1,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,247,255,239, 65,  0,  0,150, 66,154,153, 25, 62,
+  0,  0,128, 63,200,182, 27, 63,  0,  0,128, 63, 72,138, 24,  4,  0,  0,  0,  0,  1,  0,  0,  0, 46, 26,128, 63, 25,  4,240, 65,
+  0,  0, 52, 66,  0,  0,128, 63,  0,  0, 64, 64,205,204, 76, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64, 11,  3,  0,
+  1,  0,  0,  0,  0,  0,  1,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,111, 18,131, 58,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,
-  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0, 72, 47, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0, 24,217, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0,232,160, 17,  3,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0, 79, 66,  0,  0, 32,  5,  0,  0,168, 47, 50,  3,  0,  0,  0,  0,
-116,  0,  0,  0,  1,  0,  0,  0,120, 53, 50,  3,  0,  0,  0,  0,216, 41, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 99,104,101, 99,107,101,114,115, 46, 48, 49, 52,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  4,  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,
-  1,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0, 72,138, 24,  4,
+  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  2,  0,  1,  0,
+  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,243,  4, 53,191,242,  4, 53, 63,242,  4, 53,191,243,  4, 53, 63,216,139, 24,  4,
   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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,120,117, 53,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0,
- 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0,
- 10,  0,  0,  0, 10,  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,  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, 24, 53, 50,  3,  0,  0,  0,  0,248, 37, 19,  3,  0,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0,
-176, 38,  2, 66, 14,112,164, 64, 46,149,229, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,178,159, 34, 65,178,159, 34, 65,177,159, 34, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,128,166,250, 89,178,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,178,159, 34, 65,151,120, 10,180,  0,  0,  0,  0,
-  0,  0,  0,  0,151,120, 10, 52,178,159, 34, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,177,159, 34, 65,
-  0,  0,  0,  0,176, 38,  2, 66, 14,112,164, 64, 46,149,229, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,254,255,127, 63,120,137,214,177,176,159,162,177,
-  0,  0,  0,  0,138,222,112, 38,  0,  0,128, 63,177,159, 34, 37,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,254,255,127, 54,255,255,255, 52,255,255,127, 52,  0,  0,128, 63,232,126,201, 61,  0,  0,  0, 49,  0,  0,  0, 48,
-  0,  0,  0,  0,219,145,171,176,231,126,201, 61,  0,  0,128,163,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232,126,201, 61,
-  0,  0,  0,  0,202,225, 76,192,128,109,  1,191,242,179, 52,190,  0,  0,128, 63,231,126,201, 61,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 95, 81,217,164, 51, 57,255, 49,232,126,201, 61,  0,  0,  0,  0,218,145,171, 48,231,126,201,189,160,222,251, 49,
-  0,  0,  0,  0,125,242, 76,192,203,200,189,191, 33, 71, 58, 58,  0,  0,128, 63, 33,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,
-  1,  0,  2,  0,  0,  0, 68,  0, 79, 66,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,
-  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,
-143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  1,  0,  5,  0,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
   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,  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,128, 63,
-  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,216,139, 24,  4,  0,  0,  0,  0,117,  1,  0,  0,
+  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 76, 65,  0,  0,
+ 16,  2,  0,  0, 56,140, 24,  4,  0,  0,  0,  0, 36,  0,  0,  0,  1,  0,  0,  0,136,144, 24,  4,  0,  0,  0,  0,232,135, 24,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 76, 65, 83,112,111,116, 46, 48, 48, 52,  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,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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, 16,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+205,204,204, 62,247,255,239, 65,  0,  0,150, 66,154,153, 25, 62,  0,  0,128, 63,200,182, 27, 63,  0,  0,128, 63,152,142, 24,  4,
+  0,  0,  0,  0,  1,  0,  0,  0, 46, 26,128, 63, 25,  4,240, 65,  0,  0, 52, 66,  0,  0,128, 63,  0,  0, 64, 64,205,204, 76, 61,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64, 11,  3,  0,  1,  0,  0,  0,  0,  0,  1,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,111, 18,131, 58,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 64,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 25,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0, 24, 53, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
- 24,217, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0,248, 37, 19,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0, 79, 66,  0,  0, 32,  5,  0,  0,120, 53, 50,  3,  0,  0,  0,  0,116,  0,  0,  0,
-  1,  0,  0,  0, 72, 59, 50,  3,  0,  0,  0,  0,168, 47, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 79, 66, 99,104,101, 99,107,101,114,115, 46, 48, 49, 55,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,
-  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,  1,  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, 68, 65, 84, 65, 64,  1,  0,  0,152,142, 24,  4,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  2,  0,  1,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,243,  4, 53,191,
+242,  4, 53, 63,242,  4, 53,191,243,  4, 53, 63, 40,144, 24,  4,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,120,117, 53,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0,
- 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0,
- 10,  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,  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,232, 58, 50,  3,  0,  0,  0,  0,216,171,  4,  3,  0,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0,237, 10,  2,194,
- 14,112,164, 64,184,147,229, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-178,159, 34, 65,178,159, 34, 65,177,159, 34, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,
-166,250, 89,178,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,178,159, 34, 65,151,120, 10,180,  0,  0,  0,  0,  0,  0,  0,  0,
-151,120, 10, 52,178,159, 34, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,177,159, 34, 65,  0,  0,  0,  0,
-237, 10,  2,194, 14,112,164, 64,184,147,229, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,254,255,127, 63,130,206,  7, 51,  0,  0,  0,  0,  0,  0,  0,  0,
-138,222,112, 38,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-138,222,112, 28,  0,  0,128, 53,  0,  0,  0,  0,  0,  0,128, 63,232,126,201, 61,  0,  0,  0,177,  0,  0,  0,  0,  0,  0,  0,  0,
-219,145,171,176,231,126,201, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232,126,201, 61,  0,  0,  0,  0,
- 22,182, 76, 64,127,109,  1,191,202,178, 52,190,  0,  0,128, 63,231,126,201, 61,  0,  0,  0,  0,  0,  0,  0, 44,  0,  0,  0,  0,
- 94, 81,217,164, 51, 57,255, 49,232,126,201, 61,  0,  0,  0,  0,218,145,171, 48,231,126,201,189,161,222,251, 49,  0,  0,  0,  0,
- 98,165, 76, 64,203,200,189,191,129,109, 59, 58,  0,  0,128, 63, 33,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  2,  0,
-  0,  0, 68,  0, 79, 66,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0,
- 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  1,  0,  5,  0,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  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,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 24,  0,  0,  0, 40,144, 24,  4,  0,  0,  0,  0,117,  1,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 76, 65,  0,  0, 16,  2,  0,  0,136,144, 24,  4,  0,  0,  0,  0, 36,  0,  0,  0,
+  1,  0,  0,  0, 72,149, 24,  4,  0,  0,  0,  0, 56,140, 24,  4,  0,  0,  0,  0, 56, 33, 24,  3,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 76, 65, 83,112,111,116, 46, 48, 48, 54,  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,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  2,  0,  0,  0,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,160, 64,  0,  0, 52, 66,  0,  0, 72, 66,171,156,  8, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,232,146, 24,  4,  0,  0,  0,  0,  2,  0,  0,  0, 78,207, 68, 65, 25,  4,240, 65,
+  0,  0, 52, 66,  0,  0,128, 63,  0,  0, 64, 64,205,204, 76, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  3,  0,
+  1,  0,  0,  0,  0,  0,  1,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,111, 18,131, 58,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0, 64,  1,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,
-  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, 25,  0,  0,  0,
-  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0,232, 58, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0,216,171,  4,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0, 79, 66,  0,  0, 32,  5,  0,  0, 72, 59, 50,  3,  0,  0,  0,  0,116,  0,  0,  0,  1,  0,  0,  0,
- 24, 65, 50,  3,  0,  0,  0,  0,120, 53, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 79, 66, 99,104,101, 99,107,101,114,115, 46, 48, 49, 57,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,216,148, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 64,  1,  0,  0,232,146, 24,  4,
+  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  2,  0,  1,  0,
+  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,243,  4, 53,191,242,  4, 53, 63,242,  4, 53,191,243,  4, 53, 63,120,148, 24,  4,
   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,  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,  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,
-120,117, 53,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,
-  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,120,148, 24,  4,  0,  0,  0,  0,117,  1,  0,  0,
+  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,216,148, 24,  4,  0,  0,  0,  0, 12,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 76, 65,  0,  0,
+ 16,  2,  0,  0, 72,149, 24,  4,  0,  0,  0,  0, 36,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,136,144, 24,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 76, 65, 76, 97,109,112,  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,
-184, 64, 50,  3,  0,  0,  0,  0,104, 80,  4,  3,  0,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0, 16,173, 34, 66,220,133, 63,192,
-216,147,229, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,178,159, 34, 65,
-178,159, 34, 65,177,159, 34, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,210, 83,251,192,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 98, 99,102,182,178,159, 34,193,  0,  0,  0,  0,  0,  0,  0,  0,178,159, 34, 65,
- 98, 99,102,182,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,177,159, 34, 65,  0,  0,  0,  0, 16,173, 34, 66,
-220,133, 63,192,216,147,229, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,254,255,127, 63,130,206,  7, 51,  0,  0,  0,  0,  0,  0,  0,  0,138,222,112, 38,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,138,222,112, 28,
-  0,  0,128, 53,  0,  0,  0,  0,  0,  0,128, 63,  0,  0, 14,179,230,126,201, 61,  0,  0,  0,176,  0,  0,  0,  0,231,126,201,189,
-153,186, 14,179,  0,  0,  0, 37,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232,126,201, 61,  0,  0,  0,  0,221,190,150,190,
-133, 10,128,192,227,178, 52,190,  0,  0,128, 63,  0,  0, 24,179,232,126,201, 61,  0,  0,  0,  0,  0,  0,  0,  0, 51, 57,255,177,
-106,201, 52,167,232,126,201, 61,  0,  0,  0,  0,231,126,201, 61,154,186, 14, 51,163,222,251, 49,  0,  0,  0,  0,169,196, 46, 63,
-223, 18,128,192, 64, 84, 59, 58,  0,  0,128, 63, 33,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0,
- 79, 66,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,
-  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  1,  0,  5,  0,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  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,  1,  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,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,192, 63,  0,  0,160, 65,  0,  0, 52, 66,154,153, 25, 62,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,168,151, 24,  4,
+  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0, 63,  0,  0, 32, 66,  0,  0, 52, 66,  0,  0,128, 63,  0,  0, 64, 64,205,204, 76, 61,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  3,  0,  1,  0,  0,  0,  0,  0,  1,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,111, 18,131, 58,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 64,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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, 25,  0,  0,  0,  0,  0,  0,  0,
-  1,  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, 68, 65, 84, 65, 64,  1,  0,  0,168,151, 24,  4,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  2,  0,  1,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,243,  4, 53,191,
+242,  4, 53, 63,242,  4, 53,191,243,  4, 53, 63, 56,153, 24,  4,  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,
- 68, 65, 84, 65, 16,  0,  0,  0,184, 64, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 24,217, 51,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0,104, 80,  4,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-  1,  0,  0,  0, 79, 66,  0,  0, 32,  5,  0,  0, 24, 65, 50,  3,  0,  0,  0,  0,116,  0,  0,  0,  1,  0,  0,  0,232, 70, 50,  3,
-  0,  0,  0,  0, 72, 59, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 99,104,
-101, 99,107,101,114,115, 46, 48, 50, 50,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  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,  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,  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,120,117, 53,  3,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 24,  0,  0,  0, 56,153, 24,  4,  0,  0,  0,  0,117,  1,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 87, 79,  0,  0, 24,  2,  0,  0,152,153, 24,  4,  0,  0,  0,  0,142,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40,170,159,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 87, 79, 87,111,114,108,100,  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,  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,136, 70, 50,  3,
-  0,  0,  0,  0, 56,220,  4,  3,  0,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0, 77,145, 34,194,220,133, 63,192,216,147,229, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,178,159, 34, 65,178,159, 34, 65,
-177,159, 34, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,228,203,150,192,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,102, 36,  2, 52,178,159, 34, 65,  0,  0,  0,  0,  0,  0,  0,  0,178,159, 34,193,102, 36,  2, 52,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,177,159, 34, 65,  0,  0,  0,  0, 77,145, 34,194,220,133, 63,192,
-216,147,229, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,254,255,127, 63,130,206,  7, 51,  0,  0,  0,  0,  0,  0,  0,  0,138,222,112, 38,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,138,222,112, 28,  0,  0,128, 53,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,192, 48,231,126,201,189,  0,  0,  0,176,  0,  0,  0,  0,231,126,201, 61,  0, 64,161, 48,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232,126,201, 61,  0,  0,  0,  0, 12,191,150, 62, 88,233,127,192,
-228,178, 52,190,  0,  0,128, 63,  0,  0,  0, 49,231,126,201,189,  0,  0,  0,  0,  0,  0,  0,  0, 51, 57,255, 49, 23, 63,204, 36,
-232,126,201, 61,  0,  0,  0,  0,231,126,201,189,  1, 64,161,176,162,222,251, 49,  0,  0,  0,  0,145,196, 46,191,164,216,127,192,
- 63, 84, 59, 58,  0,  0,128, 63, 33,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0, 79, 66,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,
-169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  1,  0,  5,  0,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,233,150, 10, 61,119, 32, 14, 62, 31,130,137, 62,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,205,204, 28, 65,  0,  0,  0,  0,  1,  0, 32,  0,128,  0,  5,  0, 60,  0,  5,  0,
+  1,  0,  5,  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, 64,  0,  0,  0,  0,  0,  0,112, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 65,
+  0,  0,  0,  0,  0,  0,128, 63,205,204, 76, 61,  0,  0,  5,  0,  3,  0,  0,  0, 10,215,163, 59,  0,  0,  0,  0,  0,  0,128, 62,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,  1,  0,  0,  0,  2,  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,  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,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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, 25,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,248,155, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,248,155, 24,  4,  0,  0,  0,  0, 12,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 84, 88,  0,  0,
+224,  0,  0,  0,104,156, 24,  4,  0,  0,  0,  0, 20,  0,  0,  0,  1,  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, 84, 88, 84,101,120,116,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 16,  0,  0,  0,136, 70, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 24,217, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0, 56,220,  4,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
- 79, 66,  0,  0, 32,  5,  0,  0,232, 70, 50,  3,  0,  0,  0,  0,116,  0,  0,  0,  1,  0,  0,  0, 88, 76, 50,  3,  0,  0,  0,  0,
- 24, 65, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 76, 97,109,112,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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, 10,  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,  1,  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,  7,  0,  0,  0,  1,  0,  0,  0,152,157, 24,  4,
+  0,  0,  0,  0,152,157, 24,  4,  0,  0,  0,  0,152,157, 24,  4,  0,  0,  0,  0,152,157, 24,  4,  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,  8,158, 24,  4,  0,  0,  0,  0,255,255,255,255,
+  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,152,157, 24,  4,
+  0,  0,  0,  0, 18,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,216,  4,212,  2,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 69, 69, 82, 70, 68, 65, 84, 65,  4,  0,  0,  0,216,  4,212,  2,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  1,  0, 71, 82,  0,  0,152,  0,  0,  0, 88,162, 24,  4,  0,  0,  0,  0,
+ 25,  1,  0,  0,  1,  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, 71, 82, 79,118,101,114,114,105,100,101,  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,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 56,163, 24,  4,  0,  0,  0,  0,216,165, 24,  4,  0,  0,  0,  0,255,255, 15,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0, 56,163, 24,  4,  0,  0,  0,  0, 24,  1,  0,  0,  1,  0,  0,  0,168,163, 24,  4,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,200, 18, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0,168,163, 24,  4,  0,  0,  0,  0, 24,  1,  0,  0,  1,  0,  0,  0, 24,164, 24,  4,  0,  0,  0,  0,
+ 56,163, 24,  4,  0,  0,  0,  0,  8, 13, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0, 24,164, 24,  4,  0,  0,  0,  0, 24,  1,  0,  0,  1,  0,  0,  0,136,164, 24,  4,  0,  0,  0,  0,
+168,163, 24,  4,  0,  0,  0,  0, 72,  7, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0,136,164, 24,  4,  0,  0,  0,  0, 24,  1,  0,  0,  1,  0,  0,  0,248,164, 24,  4,  0,  0,  0,  0,
+ 24,164, 24,  4,  0,  0,  0,  0, 88, 48, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0,248,164, 24,  4,  0,  0,  0,  0, 24,  1,  0,  0,  1,  0,  0,  0,104,165, 24,  4,  0,  0,  0,  0,
+136,164, 24,  4,  0,  0,  0,  0,  8,246, 24,  4,  0,  0,  0,  0, 40,181,151,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0,104,165, 24,  4,  0,  0,  0,  0, 24,  1,  0,  0,  1,  0,  0,  0,216,165, 24,  4,  0,  0,  0,  0,
+248,164, 24,  4,  0,  0,  0,  0,136,  1, 25,  4,  0,  0,  0,  0,168,218,225,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0,216,165, 24,  4,  0,  0,  0,  0, 24,  1,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+104,165, 24,  4,  0,  0,  0,  0,200,251, 24,  4,  0,  0,  0,  0, 40,  6,154,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 79, 66,  0,  0,112,  5,  0,  0, 72,166, 24,  4,  0,  0,  0,  0,129,  0,  0,  0,  1,  0,  0,  0,  8,172, 24,  4,  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, 79, 66, 67, 97,109,101,114, 97,
   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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,
   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,  0,  0,  0,  0,  0,  0,104,216, 49,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,
-  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 11,  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,  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,  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,170, 77,152, 65,248,108, 90,191, 90,202,168,191,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 85, 90,103, 63,254, 45,186,190,115,209,128, 63,  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,
+200,114, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,
+  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 78,199, 41,188,225,230, 30,193,
+216,129,230, 63,  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,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+218, 15,201, 63,  0,  0,  0,128,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,105, 33,162, 51,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,191,
+105, 33,162, 51,  0,  0,  0,  0, 78,199, 41,188,225,230, 30,193,216,129,230, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63, 64, 90,136, 48,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,168,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0, 64, 90,136,176,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0, 64, 90,136,176,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  8,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  1,  0,  0,  0, 68,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0,  0,  0,  5,  0,  1,
+  0,  0,128, 63,  0,  0,128, 63,  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,  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,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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,  1,  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,  0,  0,  0,  0,  0, 79, 66,  0,  0,112,  5,  0,  0,  8,172, 24,  4,  0,  0,  0,  0,129,  0,  0,  0,  1,  0,  0,  0,
+200,177, 24,  4,  0,  0,  0,  0, 72,166, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 79, 66, 67, 97,109,101,114, 97, 65,116,109,111,  0, 97,109,101,114, 97, 46, 48, 48, 49,  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,  1,  0,  0,  4,  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, 11,  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,  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,  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,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,216,115, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0,
+ 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0,
+ 10,  0,  0,  0, 10,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 78,199, 41,188,225,230, 30,193,216,129,230, 63,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,173, 47,244, 63,162,155,113, 37, 40, 80,170, 37,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63, 40, 80,170, 37,162,155,113,165,  0,  0,  0,  0, 39, 80,170, 37,157, 64,169,190,163,155,113, 63,  0,  0,  0,  0,
+165,155,113, 37,163,155,113,191,157, 64,169,190,  0,  0,  0,  0, 78,199, 41,188,225,230, 30,193,216,129,230, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,187, 35, 58,154,139,  2,174, 25,  0,  0,  0,  0,151, 29,171, 37,  1,  0,128, 63, 33,110, 77, 51,  0,  0,  0,  0,
+135,255,255, 45,158, 64,169, 50,  0,  0,128, 63,  0,  0,  0,  0, 30,  0,128, 48,  5, 80, 56, 53,157,216,128, 52,  0,  0,128, 63,
+  0,  0,128, 63, 38, 80,170, 37,163,155,113, 37,  0,  0,  0,  0,  0,  0,  0,  0,158, 64,169,190,162,155,113,191,  0,  0,  0,  0,
+  0,  0,  0,174,164,155,113, 63,157, 64,169,190,  0,  0,  0,  0, 77,199, 41, 60,158,113,159,192,150,113, 12,193,  0,  0,128, 63,
+  0,  0,128, 63, 40, 80,170, 37,166,155,113, 37,  0,  0,  0,  0,162,155,113,165,164,155,113, 63,158, 64,169,190,  0,  0,  0,  0,
+ 40, 80,170,165,159, 64,169, 62,162,155,113, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+223, 13,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  5,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,187,225, 16, 63,  0,  0,128, 63,
+205,204,204, 62,210, 32, 80, 63,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  1,  0,  0,  0,  0,  2,  0,  1,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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,  1,  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,  0,  0,  0,  0,  0, 79, 66,  0,  0,112,  5,  0,  0,200,177, 24,  4,  0,  0,  0,  0,
+129,  0,  0,  0,  1,  0,  0,  0,200,184, 24,  4,  0,  0,  0,  0,  8,172, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 99,104,101, 99,107,101,114,115, 46, 48, 48, 50,  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,  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  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,  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,  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, 56,145,212,  2,  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,136,227, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,
+  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,136,183, 24,  4,  0,  0,  0,  0,120,233,186,  2,  0,  0,  0,  0,
+  2,  0,  0,  0,  1,  0,  0,  0,113, 36,122, 61,157, 24,186,192, 28, 38, 71, 64,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,113, 36,122, 61,157, 24,186,192,
+ 28, 38, 71, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,113, 36,122,189,157, 24,186, 64,
+ 28, 38, 71,192,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,255,255,127,191,  0,  0,192, 51,  0,  0,  0,  0, 34, 75,146,189, 36,181,131,192,
+ 95,202,167,191,  0,  0,128, 63, 14,  4,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,
+169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0,  0,  0,  5,  0,  1,  0,  0,128, 63,  0,  0,128, 63,  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,  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,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232,183, 24,  4,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 56,136,224,  2,  0,  0,  0,  0, 40,125,218,  2,  0,  0,  0,  0, 25,  0,  0, 38,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  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,  0,  0,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0,
+136,183, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 88,120, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,  4,  0,  0,  0,120,233,186,  2,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0, 68, 65, 84, 65,
+152,  0,  0,  0,232,183, 24,  4,  0,  0,  0,  0,132,  0,  0,  0,  1,  0,  0,  0,  0,192,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,205,204,204, 61,205,204, 76, 62, 10,215,163, 60,  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,104,  0,  0,  0, 79, 66,  0,  0,112,  5,  0,  0,200,184, 24,  4,  0,  0,  0,  0,129,  0,  0,  0,
+  1,  0,  0,  0,232,190, 24,  4,  0,  0,  0,  0,200,177, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 79, 66, 99,104,101, 99,107,101,114,115, 46, 48, 48, 51,  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,  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,168, 20,196,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,
+250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,136,190, 24,  4,  0,  0,  0,  0, 24, 36,187,  2,  0,  0,  0,  0,  2,  0,  0,  0,
+  1,  0,  0,  0,  0,131,102, 60, 14,112,164, 64, 24,211,229, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,178,159, 34, 65,178,159, 34, 65,177,159, 34, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,128,166,250, 89,178,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,178,159, 34, 65,151,120, 10,180,  0,  0,  0,  0,  0,  0,  0,  0,151,120, 10, 52,178,159, 34, 65,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,177,159, 34, 65,  0,  0,  0,  0,  0,131,102, 60, 14,112,164, 64, 24,211,229, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,252,118,143,165,  0,  0,  0,  0,  0,  0,  0,  0,176,193,168,165,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,176,193, 40,155,  0,  0,  0, 53,  0,  0,  0,  0,
+  0,  0,128, 63,231,126,201, 61,218,145,171, 48,  0,  0,  0,  0,  0,  0,  0,  0,218,145,171,176,231,126,201, 61,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232,126,201, 61,  0,  0,  0,  0,232,110,181,186,127,109,  1,191,172,228, 52,190,
+  0,  0,128, 63,231,126,201, 61,219,145,171, 48,  0,  0,  0, 31,  0,  0,  0,  0,  0,  0,218,164, 51, 57,255, 49,232,126,201, 61,
+  0,  0,  0,  0,  0,  0,172, 48,231,126,201,189,  0,192,251, 49,  0,  0,  0,  0, 18,136, 29,187,203,200,189,191,180,139,  9, 58,
+  0,  0,128, 63, 33,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,
+  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  1,  0,  0,  0,  0,  5,  0,  1,  0,  0,128, 63,  0,  0,128, 63,  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,  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,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0,136,190, 24,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,104,142, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+  4,  0,  0,  0, 24, 36,187,  2,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0, 79, 66,  0,  0,112,  5,  0,  0,
+232,190, 24,  4,  0,  0,  0,  0,129,  0,  0,  0,  1,  0,  0,  0,  8,197, 24,  4,  0,  0,  0,  0,200,184, 24,  4,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 99,104,101, 99,107,101,114,115, 46, 48, 48, 52,  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,  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  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,  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,  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, 72,106,187,  2,  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,136,227, 26,  4,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,168,196, 24,  4,  0,  0,  0,  0,
+ 24,193,224,  2,  0,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0,179,243,222, 63,139,224,239,192, 28, 38, 71, 64,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,128,
+218, 15,201,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,105, 33,162, 51,  0,  0,128,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,105, 33,162, 51,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+179,243,222, 63,139,224,239,192, 28, 38, 71, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128,191,  0,  0,160, 51,  0,  0,  0,179,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+139,224,239,192,174,243,222,191, 28, 38, 71,192,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,128, 63,  0,  0,128, 51,  0,  0,  0,  0,
+104, 33,162,179,  0,  0,128, 39,  0,  0,128, 63,  0,  0,  0,  0,255,255,127, 63,  0,  0,  0,  0,  0,  0,  0, 52,  0,  0,  0,  0,
+109,218, 27, 64, 67, 71,224,191, 96,202,167,191,  0,  0,128, 63, 14,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  2,  0,  0,  0, 68,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0,
+ 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0,  0,  0,  5,  0,  1,  0,  0,128, 63,  0,  0,128, 63,
+  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,  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,128, 63,
+  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  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,  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,  0,  0,  0,  0,216, 36,249,  3,  0,  0,  0,  0,168,247,223,  2,  0,  0,  0,  0, 25,  0,  0, 38,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 16,  0,  0,  0,168,196, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0, 24,193,224,  2,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0, 79, 66,  0,  0,112,  5,  0,  0,  8,197, 24,  4,  0,  0,  0,  0,129,  0,  0,  0,  1,  0,  0,  0, 40,203, 24,  4,
+  0,  0,  0,  0,232,190, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 99,104,
+101, 99,107,101,114,115, 46, 48, 48, 55,  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,  0,  0,  0,  0,
+  1,  0,  0,  4,  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,  1,  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,  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,  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,120, 30,  8,  4,  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,136,227, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0,
+ 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0,
+ 10,  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,  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,200,202, 24,  4,  0,  0,  0,  0,136,149,225,  2,  0,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0,149, 78,207,191,
+ 65,225,239,192, 28, 38, 71, 64,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,128,228,203,150,192,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 46,222, 76, 50,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,191, 46,222, 76, 50,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,149, 78,207,191, 65,225,239,192, 28, 38, 71, 64,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,128,
+  0,  0,128,191,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,128, 63,  0,  0,  0,  0,  0,  0,128,179,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0, 66,225,239, 64,149, 78,207,191, 29, 38, 71,192,  0,  0,128, 63,  0,  0,  0,  0,
+255,255,127,191,  0,  0,  0,  0,  0,  0,  0,  0,104, 33,162, 51,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,255,255,127,191,
+  0,  0,  0,  0,  0,  0,128, 51,  0,  0,  0,  0,  2,217, 27,192,  5,251,205,191, 97,202,167,191,  0,  0,128, 63, 14,  4,  0,  0,
+  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,
+236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0,  0,
+  0,  5,  0,  1,  0,  0,128, 63,  0,  0,128, 63,  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,  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,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0, 40,103,225,  2,  0,  0,  0,  0,152, 52,187,  2,
+  0,  0,  0,  0, 25,  0,  0, 38,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0,200,202, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0, 88,120, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0,136,149,225,  2,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0, 79, 66,  0,  0,112,  5,  0,  0, 40,203, 24,  4,  0,  0,  0,  0,
+129,  0,  0,  0,  1,  0,  0,  0, 72,209, 24,  4,  0,  0,  0,  0,  8,197, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 99,104,101, 99,107,101,114,115, 46, 48, 48, 56,  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,  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  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,  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,  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, 56, 31,187,  2,  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,136,227, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,
+  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,232,208, 24,  4,  0,  0,  0,  0,120,  5,186,  2,  0,  0,  0,  0,
+  2,  0,  0,  0,  1,  0,  0,  0,142,127,122, 61,152,212, 18,193, 28, 38, 71, 64,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,128,218, 15, 73,192,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,191,105, 33, 34,180,  0,  0,  0,  0,  0,  0,  0,  0,105, 33, 34, 52,  0,  0,128,191,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,142,127,122, 61,152,212, 18,193,
+ 28, 38, 71, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128,191,105, 33, 34, 52,  0,  0,128, 39,  0,  0,  0,  0,  0,  0, 34,180,  0,  0,128,191,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0, 27,126,122, 61,152,212, 18,193,
+ 28, 38, 71,192,  0,  0,128, 63,  0,  0,128,191,106, 33, 34, 52, 95,202,167, 28,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,179,
+  0,  0,128, 63,  0,  0,  0,  0,106, 33, 34, 52,  1,  0,128, 63,  0,  0,160, 51,  0,  0,  0,  0,192,120,146, 61,145, 36, 65, 63,
+ 95,202,167,191,  0,  0,128, 63, 14,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,
+169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0,  0,  0,  5,  0,  1,  0,  0,128, 63,  0,  0,128, 63,  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,  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,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,
+104, 83,145,  2,  0,  0,  0,  0,  8,245,211,  2,  0,  0,  0,  0, 25,  0,  0, 38,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  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,  0,  0,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0,
+232,208, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 88,120, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,  4,  0,  0,  0,120,  5,186,  2,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0, 79, 66,  0,  0,
+112,  5,  0,  0, 72,209, 24,  4,  0,  0,  0,  0,129,  0,  0,  0,  1,  0,  0,  0,104,215, 24,  4,  0,  0,  0,  0, 40,203, 24,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 99,104,101, 99,107,101,114,115, 46, 48,
+ 49, 48,  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,  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,168, 20,196,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,
+  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,  8,215, 24,  4,
+  0,  0,  0,  0, 24,156,212,  2,  0,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0,227,252,129,193, 14,112,164, 64,  9,197,229, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,178,159, 34, 65,178,159, 34, 65,
+177,159, 34, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,128,166,250, 89,178,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,178,159, 34, 65,151,120, 10,180,  0,  0,  0,  0,
+  0,  0,  0,  0,151,120, 10, 52,178,159, 34, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,177,159, 34, 65,
+  0,  0,  0,  0,227,252,129,193, 14,112,164, 64,  9,197,229, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63, 17, 66,216,178,  0,  0,  0,  0,
+  0,  0,  0,  0,176,193,168,165,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,176,193, 40, 27,  0,  0,  0,181,  0,  0,  0, 52,  0,  0,128, 63,231,126,201, 61,  0,  0,128, 49,  0,  0,  0,  0,
+  0,  0,  0,  0,218,145,171,176,231,126,201, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232,126,201, 61,
+  0,  0,  0,  0,252,159,204, 63,126,109,  1,191,156,217, 52,190,  0,  0,128, 63,231,126,201, 61,  0,  0,  0,178,  0,  0,128, 44,
+  0,  0,  0,  0, 95, 81,217,164, 51, 57,255, 49,232,126,201, 61,  0,  0,  0,  0,219,145,171, 48,231,126,201,189,161,222,251, 49,
+  0,  0,  0,  0,148,126,204, 63,204,200,189,191,117,156, 20, 58,  0,  0,128, 63, 33,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,
+  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,
+  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,
+143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0,  0,  0,  5,  0,  1,  0,  0,128, 63,
+  0,  0,128, 63,  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,  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,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0,  8,215, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,104,142, 26,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0, 24,156,212,  2,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,  1,  0,  0,  0, 79, 66,  0,  0,112,  5,  0,  0,104,215, 24,  4,  0,  0,  0,  0,129,  0,  0,  0,  1,  0,  0,  0,
+136,221, 24,  4,  0,  0,  0,  0, 72,209, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 79, 66, 99,104,101, 99,107,101,114,115, 46, 48, 49, 51,  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,
+  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  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,  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,  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,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,168, 20,196,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0,
+ 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0,
+ 10,  0,  0,  0, 10,  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,  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, 40,221, 24,  4,  0,  0,  0,  0, 56,136,180,  2,  0,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0,
+  8, 56,130, 65, 14,112,164, 64, 35,197,229, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,178,159, 34, 65,178,159, 34, 65,177,159, 34, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,128,166,250, 89,178,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+178,159, 34, 65,151,120, 10,180,  0,  0,  0,  0,  0,  0,  0,  0,151,120, 10, 52,178,159, 34, 65,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,177,159, 34, 65,  0,  0,  0,  0,  8, 56,130, 65, 14,112,164, 64, 35,197,229, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+254,255,127, 63, 15, 66,216,178,  0,  0,  0,  0,  0,  0,  0,  0,138,222,112, 38,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,138,222,112, 28,  0,  0,128, 53,  0,  0,  0,  0,  0,  0,128, 63,
+232,126,201, 61,  0,  0,128, 49,  0,  0,  0,  0,  0,  0,  0,  0,219,145,171,176,231,126,201, 61,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,232,126,201, 61,  0,  0,  0,  0, 23,253,204,191,128,109,  1,191,176,217, 52,190,  0,  0,128, 63,
+230,126,201, 61,  0,  0,  0,178,  0,  0,128,172,  0,  0,  0,  0, 94, 81,217,164, 51, 57,255, 49,232,126,201, 61,  0,  0,  0,  0,
+217,145,171, 48,231,126,201,189,161,222,251, 49,  0,  0,  0,  0,127, 30,205,191,203,200,189,191,254,135, 20, 58,  0,  0,128, 63,
+ 33,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,
+205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  1,  0,  0,  0,  0,  5,  0,  1,  0,  0,128, 63,  0,  0,128, 63,  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,  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,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0, 40,221, 24,  4,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,104,142, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0,
+ 56,136,180,  2,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0, 79, 66,  0,  0,112,  5,  0,  0,136,221, 24,  4,
+  0,  0,  0,  0,129,  0,  0,  0,  1,  0,  0,  0,168,227, 24,  4,  0,  0,  0,  0,104,215, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 99,104,101, 99,107,101,114,115, 46, 48, 49, 52,  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,  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,168, 20,196,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,
+  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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, 72,227, 24,  4,  0,  0,  0,  0, 40, 30,  8,  4,
+  0,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0,176, 38,  2, 66, 14,112,164, 64, 46,149,229, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,178,159, 34, 65,178,159, 34, 65,177,159, 34, 65,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,128,166,250, 89,178,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,178,159, 34, 65,151,120, 10,180,  0,  0,  0,  0,  0,  0,  0,  0,151,120, 10, 52,
+178,159, 34, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,177,159, 34, 65,  0,  0,  0,  0,176, 38,  2, 66,
+ 14,112,164, 64, 46,149,229, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,254,255,127, 63,120,137,214,177,176,159,162,177,  0,  0,  0,  0,138,222,112, 38,
+  0,  0,128, 63,177,159, 34, 37,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,254,255,127, 54,
+255,255,255, 52,255,255,127, 52,  0,  0,128, 63,232,126,201, 61,  0,  0,  0, 49,  0,  0,  0, 48,  0,  0,  0,  0,219,145,171,176,
+231,126,201, 61,  0,  0,128,163,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232,126,201, 61,  0,  0,  0,  0,202,225, 76,192,
+128,109,  1,191,242,179, 52,190,  0,  0,128, 63,231,126,201, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 95, 81,217,164,
+ 51, 57,255, 49,232,126,201, 61,  0,  0,  0,  0,218,145,171, 48,231,126,201,189,160,222,251, 49,  0,  0,  0,  0,125,242, 76,192,
+203,200,189,191, 33, 71, 58, 58,  0,  0,128, 63, 33,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  1,  0,  2,  0,
+  0,  0, 68,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,
+  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0,  0,  0,  5,  0,  1,  0,  0,128, 63,  0,  0,128, 63,  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,  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,128, 63,  0, 64,  1,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 16,  0,  0,  0, 72,227, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,104,142, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0, 40, 30,  8,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+ 79, 66,  0,  0,112,  5,  0,  0,168,227, 24,  4,  0,  0,  0,  0,129,  0,  0,  0,  1,  0,  0,  0,200,233, 24,  4,  0,  0,  0,  0,
+136,221, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 99,104,101, 99,107,101,
+114,115, 46, 48, 49, 55,  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,  0,  0,  0,  0,  1,  0,  0,  4,
+  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,
+  1,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+168, 20,196,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,
+  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,
+104,233, 24,  4,  0,  0,  0,  0,152,244,185,  2,  0,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0,237, 10,  2,194, 14,112,164, 64,
+184,147,229, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,178,159, 34, 65,
+178,159, 34, 65,177,159, 34, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,128,166,250, 89,178,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,178,159, 34, 65,151,120, 10,180,
+  0,  0,  0,  0,  0,  0,  0,  0,151,120, 10, 52,178,159, 34, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+177,159, 34, 65,  0,  0,  0,  0,237, 10,  2,194, 14,112,164, 64,184,147,229, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,254,255,127, 63,130,206,  7, 51,
+  0,  0,  0,  0,  0,  0,  0,  0,138,222,112, 38,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,138,222,112, 28,  0,  0,128, 53,  0,  0,  0,  0,  0,  0,128, 63,232,126,201, 61,  0,  0,  0,177,
+  0,  0,  0,  0,  0,  0,  0,  0,219,145,171,176,231,126,201, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+232,126,201, 61,  0,  0,  0,  0, 22,182, 76, 64,127,109,  1,191,202,178, 52,190,  0,  0,128, 63,231,126,201, 61,  0,  0,  0,  0,
+  0,  0,  0, 44,  0,  0,  0,  0, 94, 81,217,164, 51, 57,255, 49,232,126,201, 61,  0,  0,  0,  0,218,145,171, 48,231,126,201,189,
+161,222,251, 49,  0,  0,  0,  0, 98,165, 76, 64,203,200,189,191,129,109, 59, 58,  0,  0,128, 63, 33,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,
+  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0,  0,  0,  5,  0,  1,
+  0,  0,128, 63,  0,  0,128, 63,  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,  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,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0,104,233, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0,152,244,185,  2,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 79, 66,  0,  0,112,  5,  0,  0,200,233, 24,  4,  0,  0,  0,  0,129,  0,  0,  0,
+  1,  0,  0,  0,232,239, 24,  4,  0,  0,  0,  0,168,227, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 79, 66, 99,104,101, 99,107,101,114,115, 46, 48, 49, 57,  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,  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,168, 20,196,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,
+250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,136,239, 24,  4,  0,  0,  0,  0,200,  5,  9,  4,  0,  0,  0,  0,  2,  0,  0,  0,
+  1,  0,  0,  0, 16,173, 34, 66,220,133, 63,192,216,147,229, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,178,159, 34, 65,178,159, 34, 65,177,159, 34, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,128,210, 83,251,192,  0,  0,  0,  0,  0,  0,  0,  0,
   0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,136,247,255, 62, 37, 39, 74, 63,138, 26,182, 62,  0,  0,  0,  0,164, 21, 44,191, 28, 67,194, 61,176,248, 59, 63,
-  0,  0,  0,  0,251,203, 11, 63,217, 45, 27,191, 47,  7, 20, 63,  0,  0,  0,  0,170, 77,152, 65,248,108, 90,191, 90,202,168,191,
+  0,  0,  0,  0, 98, 99,102,182,178,159, 34,193,  0,  0,  0,  0,  0,  0,  0,  0,178,159, 34, 65, 98, 99,102,182,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,177,159, 34, 65,  0,  0,  0,  0, 16,173, 34, 66,220,133, 63,192,216,147,229, 63,
   0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,220, 19,149,176,206,185,149,179,  0,  0,  0,  0,101, 61, 84, 51,  1,  0,128, 63, 45,173,146, 51,
-  0,  0,  0,  0,180,106, 15, 51, 67, 91, 19,178,  0,  0,128, 63,  0,  0,  0,  0,229,162, 50, 53,251, 88,214, 52,187,255,179, 53,
-  0,  0,128, 63,138,247,255, 62,164, 21, 44,191,252,203, 11, 63,  0,  0,  0,  0, 35, 39, 74, 63, 24, 67,194, 61,217, 45, 27,191,
-  0,  0,  0,  0,137, 26,182, 62,176,248, 59, 63, 46,  7, 20, 63,  0,  0,  0,  0,214,255,  5,193,149,139, 93, 65, 72,106, 34,193,
-  0,  0,128, 63,136,247,255, 62,164, 21, 44,191,250,203, 11, 63,  0,  0,  0,  0,139, 26,182, 62,175,248, 59, 63, 46,  7, 20, 63,
-  0,  0,  0,  0, 36, 39, 74,191, 24, 67,194,189,218, 45, 27, 63,  0,  0,  0,  0,  4, 80,121,193,162,189, 99, 65, 13, 24, 70,192,
-  0,  0,128, 63, 30,  4,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,  5,  0,  1,  0,  0,  0, 68,  0, 79, 66,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,254,255,127, 63,130,206,  7, 51,  0,  0,  0,  0,  0,  0,  0,  0,138,222,112, 38,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,138,222,112, 28,  0,  0,128, 53,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0, 14,179,230,126,201, 61,  0,  0,  0,176,  0,  0,  0,  0,231,126,201,189,153,186, 14,179,  0,  0,  0, 37,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232,126,201, 61,  0,  0,  0,  0,221,190,150,190,133, 10,128,192,227,178, 52,190,
+  0,  0,128, 63,  0,  0, 24,179,232,126,201, 61,  0,  0,  0,  0,  0,  0,  0,  0, 51, 57,255,177,106,201, 52,167,232,126,201, 61,
+  0,  0,  0,  0,231,126,201, 61,154,186, 14, 51,163,222,251, 49,  0,  0,  0,  0,169,196, 46, 63,223, 18,128,192, 64, 84, 59, 58,
+  0,  0,128, 63, 33,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0,  0,  0,  0,  0,
   1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,
   0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  1,  0,  5,  0,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,  0,  5,  0,  1,  0,  0,128, 63,  0,  0,128, 63,  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,  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, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,  0,  0, 32,  5,  0,  0,
- 88, 76, 50,  3,  0,  0,  0,  0,116,  0,  0,  0,  1,  0,  0,  0,200, 81, 50,  3,  0,  0,  0,  0,232, 70, 50,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 76, 97,109,112, 46, 48, 48, 49,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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, 10,  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, 68, 65, 84, 65, 16,  0,  0,  0,136,239, 24,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,104,142, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+  4,  0,  0,  0,200,  5,  9,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0, 79, 66,  0,  0,112,  5,  0,  0,
+232,239, 24,  4,  0,  0,  0,  0,129,  0,  0,  0,  1,  0,  0,  0,  8,246, 24,  4,  0,  0,  0,  0,200,233, 24,  4,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 99,104,101, 99,107,101,114,115, 46, 48, 50, 50,  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,  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  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,  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,136,220, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,
-  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,  0,  0,  0,  0,  0,  0,  0,168, 20,196,  4,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  0, 98,160, 52,193, 56,135, 93,193,153,227, 19,193,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,168,245, 24,  4,  0,  0,  0,  0,
+ 24,104,217,  2,  0,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0, 77,145, 34,194,220,133, 63,192,216,147,229, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,178,159, 34, 65,178,159, 34, 65,177,159, 34, 65,
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 85, 90,103, 63,254, 45,186,190,115,209,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+228,203,150,192,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,102, 36,  2, 52,178,159, 34, 65,  0,  0,  0,  0,  0,  0,  0,  0,
+178,159, 34,193,102, 36,  2, 52,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,177,159, 34, 65,  0,  0,  0,  0,
+ 77,145, 34,194,220,133, 63,192,216,147,229, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,254,255,127, 63,130,206,  7, 51,  0,  0,  0,  0,  0,  0,  0,  0,
+138,222,112, 38,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+138,222,112, 28,  0,  0,128, 53,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,192, 48,231,126,201,189,  0,  0,  0,176,  0,  0,  0,  0,
+231,126,201, 61,  0, 64,161, 48,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232,126,201, 61,  0,  0,  0,  0,
+ 12,191,150, 62, 88,233,127,192,228,178, 52,190,  0,  0,128, 63,  0,  0,  0, 49,231,126,201,189,  0,  0,  0,  0,  0,  0,  0,  0,
+ 51, 57,255, 49, 23, 63,204, 36,232,126,201, 61,  0,  0,  0,  0,231,126,201,189,  1, 64,161,176,162,222,251, 49,  0,  0,  0,  0,
+145,196, 46,191,164,216,127,192, 63, 84, 59, 58,  0,  0,128, 63, 33,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,
+  1,  0,  2,  0,  0,  0, 68,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0,
+ 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0,  0,  0,  5,  0,  1,  0,  0,128, 63,  0,  0,128, 63,
+  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,  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,128, 63,
+  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 16,  0,  0,  0,168,245, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,104,142, 26,  4,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0, 24,104,217,  2,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+  1,  0,  0,  0, 79, 66,  0,  0,112,  5,  0,  0,  8,246, 24,  4,  0,  0,  0,  0,129,  0,  0,  0,  1,  0,  0,  0,200,251, 24,  4,
+  0,  0,  0,  0,232,239, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 76, 97,
+109,112,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  4,  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, 10,  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,  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,  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,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,104,126, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0,
+ 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0,
+ 10,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,170, 77,152, 65,
+248,108, 90,191, 90,202,168,191,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 85, 90,103, 63,254, 45,186,190,115,209,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
   0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,136,247,255, 62,
  37, 39, 74, 63,138, 26,182, 62,  0,  0,  0,  0,164, 21, 44,191, 28, 67,194, 61,176,248, 59, 63,  0,  0,  0,  0,251,203, 11, 63,
-217, 45, 27,191, 47,  7, 20, 63,  0,  0,  0,  0, 98,160, 52,193, 56,135, 93,193,153,227, 19,193,  0,  0,128, 63,  0,  0,128, 63,
+217, 45, 27,191, 47,  7, 20, 63,  0,  0,  0,  0,170, 77,152, 65,248,108, 90,191, 90,202,168,191,  0,  0,128, 63,  0,  0,128, 63,
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
   0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
- 12, 73,149, 51,183,223, 34,179,  0,  0,  0,  0,180, 66, 41, 50,  0,  0,128, 63,176, 27,138, 49,  0,  0,  0,  0,201, 75, 13, 50,
- 76, 10,177, 50,  1,  0,128, 63,  0,  0,  0,  0, 41,189, 56,179,113,162,231,180, 67,151,100,180,  0,  0,128, 63,135,247,255, 62,
-164, 21, 44,191,252,203, 11, 63,  0,  0,  0,  0, 37, 39, 74, 63, 28, 67,194, 61,217, 45, 27,191,  0,  0,  0,  0,136, 26,182, 62,
-175,248, 59, 63, 46,  7, 20, 63,  0,  0,  0,  0,172,234,158, 65, 79,243,  2, 63,195,120, 71, 64,  0,  0,128, 63,138,247,255, 62,
-165, 21, 44,191,251,203, 11, 63,  0,  0,  0,  0,140, 26,182, 62,176,248, 59, 63, 46,  7, 20, 63,  0,  0,  0,  0, 35, 39, 74,191,
- 17, 67,194,189,217, 45, 27, 63,  0,  0,  0,  0, 41,133, 74, 65, 29, 20,102, 63,115,194, 34, 65,  0,  0,128, 63, 30,  4,  0,  0,
-  0, 20,  0,  0,  0,  0,  0,  0,  5,  0,  1,  0,  0,  0, 68,  0, 79, 66,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+220, 19,149,176,206,185,149,179,  0,  0,  0,  0,101, 61, 84, 51,  1,  0,128, 63, 45,173,146, 51,  0,  0,  0,  0,180,106, 15, 51,
+ 67, 91, 19,178,  0,  0,128, 63,  0,  0,  0,  0,229,162, 50, 53,251, 88,214, 52,187,255,179, 53,  0,  0,128, 63,138,247,255, 62,
+164, 21, 44,191,252,203, 11, 63,  0,  0,  0,  0, 35, 39, 74, 63, 24, 67,194, 61,217, 45, 27,191,  0,  0,  0,  0,137, 26,182, 62,
+176,248, 59, 63, 46,  7, 20, 63,  0,  0,  0,  0,214,255,  5,193,149,139, 93, 65, 72,106, 34,193,  0,  0,128, 63,136,247,255, 62,
+164, 21, 44,191,250,203, 11, 63,  0,  0,  0,  0,139, 26,182, 62,175,248, 59, 63, 46,  7, 20, 63,  0,  0,  0,  0, 36, 39, 74,191,
+ 24, 67,194,189,218, 45, 27, 63,  0,  0,  0,  0,  4, 80,121,193,162,189, 99, 65, 13, 24, 70,192,  0,  0,128, 63, 30,  4,  0,  0,
+  0,  0,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,  5,  0,  1,  0,  0,  0, 68,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
   1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,
-236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  1,  0,  5,  0,  1,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0,  0,
+  0,  5,  0,  1,  0,  0,128, 63,  0,  0,128, 63,  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,  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, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  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, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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,  1,  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,  1,  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,  0,  0,  0,  0,  0, 79, 66,  0,  0,112,  5,  0,  0,200,251, 24,  4,  0,  0,  0,  0,129,  0,  0,  0,
+  1,  0,  0,  0,136,  1, 25,  4,  0,  0,  0,  0,  8,246, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 79, 66, 76, 97,109,112, 46, 48, 48, 49,  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,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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, 10,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40,131, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,
+250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 98,160, 52,193, 56,135, 93,193,153,227, 19,193,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 85, 90,103, 63,254, 45,186,190,115,209,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,136,247,255, 62, 37, 39, 74, 63,138, 26,182, 62,  0,  0,  0,  0,164, 21, 44,191, 28, 67,194, 61,176,248, 59, 63,
+  0,  0,  0,  0,251,203, 11, 63,217, 45, 27,191, 47,  7, 20, 63,  0,  0,  0,  0, 98,160, 52,193, 56,135, 93,193,153,227, 19,193,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63, 12, 73,149, 51,183,223, 34,179,  0,  0,  0,  0,180, 66, 41, 50,  0,  0,128, 63,176, 27,138, 49,
+  0,  0,  0,  0,201, 75, 13, 50, 76, 10,177, 50,  1,  0,128, 63,  0,  0,  0,  0, 41,189, 56,179,113,162,231,180, 67,151,100,180,
+  0,  0,128, 63,135,247,255, 62,164, 21, 44,191,252,203, 11, 63,  0,  0,  0,  0, 37, 39, 74, 63, 28, 67,194, 61,217, 45, 27,191,
+  0,  0,  0,  0,136, 26,182, 62,175,248, 59, 63, 46,  7, 20, 63,  0,  0,  0,  0,172,234,158, 65, 79,243,  2, 63,195,120, 71, 64,
+  0,  0,128, 63,138,247,255, 62,165, 21, 44,191,251,203, 11, 63,  0,  0,  0,  0,140, 26,182, 62,176,248, 59, 63, 46,  7, 20, 63,
+  0,  0,  0,  0, 35, 39, 74,191, 17, 67,194,189,217, 45, 27, 63,  0,  0,  0,  0, 41,133, 74, 65, 29, 20,102, 63,115,194, 34, 65,
+  0,  0,128, 63, 30,  4,  0,  0,  0,  0,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,  5,  0,  1,  0,  0,  0, 68,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,
+  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  1,  0,  0,  0,  0,  5,  0,  1,  0,  0,128, 63,  0,  0,128, 63,  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,  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, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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,  1,  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,  0,  0,  0,  0,  0, 79, 66,  0,  0,112,  5,  0,  0,136,  1, 25,  4,
+  0,  0,  0,  0,129,  0,  0,  0,  1,  0,  0,  0, 72,  7, 25,  4,  0,  0,  0,  0,200,251, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 76, 97,109,112, 46, 48, 48, 50,  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,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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, 10,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,136,144, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,
+  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,111, 56,183,192, 61, 86, 90,193,242,190, 40, 65,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,214,143,104,191, 93, 33, 11,191,232, 45, 17, 64,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,134,194, 12,191,  1,236, 39, 63,180, 97,  4, 63,  0,  0,  0,  0, 37,182, 59,191,
+170, 20,169,189, 65,200, 44,191,  0,  0,  0,  0, 11,208,204,190, 93, 18, 64,191,215,191,  6, 63,  0,  0,  0,  0,111, 56,183,192,
+ 61, 86, 90,193,242,190, 40, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,238,165, 47,180,227,129, 13, 50,  0,  0,  0,  0,163, 29,131,178,
+  1,  0,128, 63, 76,221,150,177,  0,  0,  0,  0, 14, 36, 14,179,106,112,163, 48,  0,  0,128, 63,  0,  0,  0,  0,255,187,156,179,
+ 91, 51,158,181,179,247,156,180,  0,  0,128, 63,132,194, 12,191, 36,182, 59,191, 15,208,204,190,  0,  0,  0,  0,  0,236, 39, 63,
+171, 20,169,189, 92, 18, 64,191,  0,  0,  0,  0,180, 97,  4, 63, 65,200, 44,191,215,191,  6, 63,  0,  0,  0,  0,124,180,178, 62,
+111,139,229, 63, 27,164,144,193,  0,  0,128, 63,133,194, 12,191, 38,182, 59,191,  7,208,204,190,  0,  0,  0,  0,181, 97,  4, 63,
+ 66,200, 44,191,214,191,  6, 63,  0,  0,  0,  0,255,235, 39,191,164, 20,169, 61, 92, 18, 64, 63,  0,  0,  0,  0,133, 79,167,192,
+ 33,228,179, 63, 21,212, 26,193,  0,  0,128, 63, 30,  4,  0,  0,  0,  0,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,  5,  0,  1,  0,
+  0,  0, 68,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,
+  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0,  0,  0,  5,  0,  1,  0,  0,128, 63,  0,  0,128, 63,  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,  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, 64,  1,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,
+  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,  1,  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,  0,  0,  0,  0,  0, 79, 66,  0,  0,
+112,  5,  0,  0, 72,  7, 25,  4,  0,  0,  0,  0,129,  0,  0,  0,  1,  0,  0,  0,  8, 13, 25,  4,  0,  0,  0,  0,136,  1, 25,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 76, 97,109,112, 46, 48, 48, 51,  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,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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, 10,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,232,135, 24,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,
+  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,176,147,104, 64, 42, 84, 23,193,116, 77,171, 64,
+  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,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 85, 90,103, 63,
+254, 45,186,190,115,209,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,136,247,255, 62, 37, 39, 74, 63,138, 26,182, 62,
+  0,  0,  0,  0,164, 21, 44,191, 28, 67,194, 61,176,248, 59, 63,  0,  0,  0,  0,251,203, 11, 63,217, 45, 27,191, 47,  7, 20, 63,
+  0,  0,  0,  0,176,147,104, 64, 42, 84, 23,193,116, 77,171, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,197,201, 17,180, 99,220,102, 50,
+  0,  0,  0,  0,123,165,191, 50,254,255,127, 63, 10,194,140, 50,  0,  0,  0,  0, 41,160,180,178, 91,103, 73, 50,254,255,127, 63,
+  0,  0,  0,  0,254,255,127, 52,254,255,127,181,253,255,255, 52,  0,  0,128, 63,141,247,255, 62,165, 21, 44,191,250,203, 11, 63,
+  0,  0,  0,  0, 38, 39, 74, 63, 28, 67,194, 61,218, 45, 27,191,  0,  0,  0,  0,138, 26,182, 62,176,248, 59, 63, 47,  7, 20, 63,
+  0,  0,  0,  0, 97,221,111, 64,113, 57, 23,191, 59,  2, 45,193,  0,  0,128, 63,137,247,255, 62,165, 21, 44,191,251,203, 11, 63,
+  0,  0,  0,  0,142, 26,182, 62,176,248, 59, 63, 46,  7, 20, 63,  0,  0,  0,  0, 37, 39, 74,191, 20, 67,194,189,217, 45, 27, 63,
+  0,  0,  0,  0, 91, 99, 93,192,135, 98, 80,190,223,119,112,192,  0,  0,128, 63,  1,  0,  0,  0,  0,  0,  0,  0,  0, 20,  0,  0,
+  0,  0,  0,  0,  5,  0,  1,  0,  0,  0, 68,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,
+  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,
+143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0,  0,  0,  5,  0,  1,  0,  0,128, 63,
+  0,  0,128, 63,  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,  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, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  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,  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,  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,  1,  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,  0,
+  0,  0,  0,  0, 79, 66,  0,  0,112,  5,  0,  0,  8, 13, 25,  4,  0,  0,  0,  0,129,  0,  0,  0,  1,  0,  0,  0,200, 18, 25,  4,
+  0,  0,  0,  0, 72,  7, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 76, 97,
+109,112, 46, 48, 48, 52,  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,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,  0,  0, 32,  5,  0,  0,200, 81, 50,  3,  0,  0,  0,  0,
-116,  0,  0,  0,  1,  0,  0,  0, 56, 87, 50,  3,  0,  0,  0,  0, 88, 76, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 76, 97,109,112, 46, 48, 48, 50,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
   1,  0,  0,  4,  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, 10,  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,  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,  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,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 56,140, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0,
+ 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0,
  10,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,249,147,251,192,
+206,  0, 24,193, 67,131,104,192,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 85, 90,103, 63,254, 45,186,190,115,209,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,136,247,255, 62,
+ 37, 39, 74, 63,138, 26,182, 62,  0,  0,  0,  0,164, 21, 44,191, 28, 67,194, 61,176,248, 59, 63,  0,  0,  0,  0,251,203, 11, 63,
+217, 45, 27,191, 47,  7, 20, 63,  0,  0,  0,  0,249,147,251,192,206,  0, 24,193, 67,131,104,192,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,254,255,127, 63,
+ 55,105,222, 50,186,168, 17, 51,  0,  0,  0,  0,243,228, 47,178,  0,  0,128, 63, 81, 76,155,178,  0,  0,  0,  0,170,191, 22, 50,
+214, 89, 50, 51,254,255,127, 63,  0,  0,  0,  0,254,255,127,181,  0,  0,128,181, 35,  5,136,168,  0,  0,128, 63,137,247,255, 62,
+166, 21, 44,191,252,203, 11, 63,  0,  0,  0,  0, 38, 39, 74, 63, 28, 67,194, 61,217, 45, 27,191,  0,  0,  0,  0,137, 26,182, 62,
+176,248, 59, 63, 47,  7, 20, 63,  0,  0,  0,  0,121,151, 75, 65,207,166,219,191,181,156, 34, 63,  0,  0,128, 63,140,247,255, 62,
+165, 21, 44,191,252,203, 11, 63,  0,  0,  0,  0,140, 26,182, 62,176,248, 59, 63, 45,  7, 20, 63,  0,  0,  0,  0, 36, 39, 74,191,
+ 22, 67,194,189,218, 45, 27, 63,  0,  0,  0,  0,148,142,176, 64, 97, 22,170,191, 27, 28,246, 64,  0,  0,128, 63,  1,  0,  0,  0,
+  0,  0,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,  5,  0,  1,  0,  0,  0, 68,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,
+236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0,  0,
+  0,  5,  0,  1,  0,  0,128, 63,  0,  0,128, 63,  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,  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, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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,  1,  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,  0,  0,  0,  0,  0, 79, 66,  0,  0,112,  5,  0,  0,200, 18, 25,  4,  0,  0,  0,  0,129,  0,  0,  0,
+  1,  0,  0,  0,136, 24, 25,  4,  0,  0,  0,  0,  8, 13, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 79, 66, 76, 97,109,112, 46, 48, 48, 56,  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,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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, 10,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72,149, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,
+250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,145, 75,188, 63, 44,197,107,193,  5,147, 81, 64,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,218, 15,201, 63,  0,  0,128, 37,255,255,127, 37,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,255,255,127, 37,  0,  0,128,165,  0,  0,  0,  0,255,255,127, 37,105, 33,162, 51,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 37,  0,  0,128,191,105, 33,162, 51,  0,  0,  0,  0,145, 75,188, 63, 44,197,107,193,  5,147, 81, 64,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,254,255,127, 63, 44,197,107, 53,  4,147, 81,180,  0,  0,  0,  0,253,255,127, 37,  0,  0,128, 63, 64, 90,136, 48,
+  0,  0,  0,  0,254,255,127,165, 44,197,107,155,  0,  0,128, 63,  0,  0,  0,  0,254,255,255, 51,255,255,255,181,254,255,127, 52,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,  0,128,165,  0,  0,128, 63,255,255,255, 39,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0, 32,159,189,191, 47,164,188,191,150,188,153,192,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,  0,128,165,  0,  0,128, 63,255,255,255, 39,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0, 32,159,189,191, 47,164,188,191,150,188,153,192,
+  0,  0,128, 63, 32,  0,  0,  0,  0,  0,  0,  0,  0, 16,  0,  0,  0,  0,  0,  0,  5,  0,  1,  0,  0,  0, 68,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,
+  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  1,  0,  0,  0,  0,  5,  0,  1,  0,  0,128, 63,  0,  0,128, 63,  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,  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,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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,  1,  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,  0,  0,  0,  0,  0, 79, 66,  0,  0,112,  5,  0,  0,136, 24, 25,  4,
+  0,  0,  0,  0,129,  0,  0,  0,  1,  0,  0,  0, 72, 30, 25,  4,  0,  0,  0,  0,200, 18, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,112,114,101,118,105,101,119,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,232,105,198,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,
+  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  0,  0,  0,  0,  0,  8,232, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0,
- 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0,
- 10,  0,  0,  0, 10,  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,  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, 56,238,223,  2,  0,  0,  0,  0,104,195,185,  2,
+  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,100, 82,  7,189, 21,204,103,191,241,165,230, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,153, 39,155, 64,153, 39,155, 64,153, 39,155, 64,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,218, 15,201, 63,  0,  0,192, 37,255,255,255, 36,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,153, 39,155, 64,152, 39, 27, 38,102,187,232,166,  0,  0,  0,  0,102,187,232, 38,
+157,134,196, 52,153, 39,155, 64,  0,  0,  0,  0,154, 39, 27, 38,153, 39,155,192,157,134,196, 52,  0,  0,  0,  0,100, 82,  7,189,
+ 21,204,103,191,241,165,230, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,236, 48,206,152,  9, 66, 41, 24,  0,  0,  0,  0,216, 55, 60,152,
+  0,  0,128, 63, 88,133,105,166,  0,  0,  0,  0,226,159, 91,151, 64,218, 93, 38,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63, 25, 50, 83, 62,147,101,158, 36, 26, 50,211, 35,  0,  0,  0,  0, 24, 50,211, 35,
+ 68,193,133, 50, 25, 50, 83,190,  0,  0,  0,  0,147,101,158,164, 25, 50, 83, 62, 68,193,133, 50,  0,  0,  0,  0,199, 70,223, 59,
+232, 71,190,190,148, 58, 63,190,  0,  0,128, 63, 25, 50, 83, 62,147,101,158, 36, 27, 50,211, 35,  0,  0,  0,  0,147,101,158,164,
+ 25, 50, 83, 62,158, 59,174, 38,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 96,175, 25, 50, 83, 62,  0,  0,  0,  0,135, 62,153, 59,
+217, 94,110,185,118, 71,238, 63,  0,  0,128, 63,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  2,  0,
+  0,  0, 68,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,
+  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0,  0,  0,  5,  4,  1,  0,  0,128, 63,  0,  0,128, 63,  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,  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,128, 63,  0, 64,  1,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+  8,  0,  0,  0, 56,238,223,  2,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+  4,  0,  0,  0,104,195,185,  2,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 79, 66,  0,  0,112,  5,  0,  0,
+ 72, 30, 25,  4,  0,  0,  0,  0,129,  0,  0,  0,  1,  0,  0,  0,216, 36, 25,  4,  0,  0,  0,  0,136, 24, 25,  4,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,112,114,101,118,105,101,119, 46, 48, 48, 50,  0, 46, 48,
+ 48, 49,  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,  1,  0,  0,  4,  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,  1,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,136, 37, 27,  4,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,
+  8, 36, 25,  4,  0,  0,  0,  0,  8, 36, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,152, 42,  8,  4,  0,  0,  0,  0,
+ 72, 51,187,  2,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,242,187,213,191,194,145,134, 63,254,100, 35, 64,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,243,  0, 28, 65,246,  0, 28, 65,243,  0, 28, 65,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 48,110,135, 63,180,169, 59, 62,
+138,115,  1,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,198, 49,  6, 65,115,154,148,192,  3,113,227,191,  0,  0,  0,  0,
+159,250,106, 64,189,207, 91, 64, 80,170,  5, 65,  0,  0,  0,  0, 46,151, 86,192,125, 94,251,192,188,127,150, 64,  0,  0,  0,  0,
+242,187,213,191,194,145,134, 63,254,100, 35, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,220,198, 33,177, 33, 91, 79,179,  0,  0,  0,  0,
+132, 62,152, 49,  0,  0,128, 63, 52,168,172, 50,  0,  0,  0,  0, 31,  6, 96,177,234,190, 21, 51,  0,  0,128, 63,  0,  0,  0,  0,
+212, 90,228, 50,171,224,143,179,223, 27,189,175,  0,  0,128, 63,144,174,180, 61,160, 48, 30, 61,223,118, 16,189,  0,  0,  0,  0,
+164, 29,153,188, 38,248,179, 61,113,162, 74, 61,  0,  0,  0,  0, 15, 21, 72, 61,160,250, 19,189, 88, 57,169, 61,  0,  0,  0,  0,
+  4,107, 50, 63, 88, 46,204,190,177,206, 79, 63,  0,  0,128, 63,144,174,180, 61,160, 48, 30, 61,223,118, 16,189,  0,  0,  0,  0,
+164, 29,153,188, 38,248,179, 61,113,162, 74, 61,  0,  0,  0,  0, 15, 21, 72, 61,160,250, 19,189, 88, 57,169, 61,  0,  0,  0,  0,
+  4,107, 50, 63, 88, 46,204,190,177,206, 79, 63,  0,  0,128, 63,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  2,  0,  0,  0, 68,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0,
+ 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0,  0,  0,  5,  0,  1,  0,  0,128, 63,  0,  0,128, 63,
+  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,  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,128, 63,
+  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,  8,  0,  0,  0,152, 42,  8,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,  4,  0,  0,  0, 72, 51,187,  2,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+136,  0,  0,  0,  8, 36, 25,  4,  0,  0,  0,  0, 81,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0, 31,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 83,117, 98,115,117,114,102,  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,  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,  1,  0,  1,  0,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,  0,  0,
+112,  5,  0,  0,216, 36, 25,  4,  0,  0,  0,  0,129,  0,  0,  0,  1,  0,  0,  0,152, 42, 25,  4,  0,  0,  0,  0, 72, 30, 25,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,112,114,101,118,105,101,119, 46, 48, 48,
+ 51,  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,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  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,  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,  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,216, 67,239,  3,
+  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,200, 43,196,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,
+  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-111, 56,183,192, 61, 86, 90,193,242,190, 40, 65,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,214,143,104,191,
- 93, 33, 11,191,232, 45, 17, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  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,232,216,188,  2,
+  0,  0,  0,  0,248,144,224,  2,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0, 16,194,203,187,155, 89, 45, 63,244,153,230, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 56,135, 72, 63, 56,135, 72, 63,
+ 56,135, 72, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
   0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,134,194, 12,191,  1,236, 39, 63,180, 97,  4, 63,
-  0,  0,  0,  0, 37,182, 59,191,170, 20,169,189, 65,200, 44,191,  0,  0,  0,  0, 11,208,204,190, 93, 18, 64,191,215,191,  6, 63,
-  0,  0,  0,  0,111, 56,183,192, 61, 86, 90,193,242,190, 40, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 56,135, 72, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 56,135, 72, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 56,135, 72, 63,
+  0,  0,  0,  0, 16,194,203,187,155, 89, 45, 63,244,153,230, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,238,165, 47,180,227,129, 13, 50,
-  0,  0,  0,  0,163, 29,131,178,  1,  0,128, 63, 76,221,150,177,  0,  0,  0,  0, 14, 36, 14,179,106,112,163, 48,  0,  0,128, 63,
-  0,  0,  0,  0,255,187,156,179, 91, 51,158,181,179,247,156,180,  0,  0,128, 63,132,194, 12,191, 36,182, 59,191, 15,208,204,190,
-  0,  0,  0,  0,  0,236, 39, 63,171, 20,169,189, 92, 18, 64,191,  0,  0,  0,  0,180, 97,  4, 63, 65,200, 44,191,215,191,  6, 63,
-  0,  0,  0,  0,124,180,178, 62,111,139,229, 63, 27,164,144,193,  0,  0,128, 63,133,194, 12,191, 38,182, 59,191,  7,208,204,190,
-  0,  0,  0,  0,181, 97,  4, 63, 66,200, 44,191,214,191,  6, 63,  0,  0,  0,  0,255,235, 39,191,164, 20,169, 61, 92, 18, 64, 63,
-  0,  0,  0,  0,133, 79,167,192, 33,228,179, 63, 21,212, 26,193,  0,  0,128, 63, 30,  4,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,
-  5,  0,  1,  0,  0,  0, 68,  0, 79, 66,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 57,135,200, 47, 57,135,200,178,  1,  0,128, 63,
+  0,  0,  0,  0,180,192,175,176, 32,132,146, 51,193, 40, 10,179,  0,  0,128, 63,144,104,163, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,144,104,163, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,176,  0,  0,  0, 51,143,104,163, 63,
+  0,  0,  0,  0,203, 15,  2, 60,184, 77, 93,191, 54, 50, 19,192,  0,  0,128, 63,144,104,163, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 34,252,250,206, 51,144,104,163, 63,  0,  0,  0,  0,  0,  0,  0,  0,144,104,163,191,  0, 64,204, 51,
+  0,  0,  0,  0,105, 93,173,187,172,176, 88,193, 95, 52,118,186,  0,  0,128, 63,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,
   0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,
-143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  1,  0,  5,  0,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0,  0,  0,  5,  0,  1,  0,  0,128, 63,
+  0,  0,128, 63,  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,  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,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  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,  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, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232, 38,212,  2,  0,  0,  0,  0,216, 38,187,  2,  0,  0,  0,  0, 25,  0,  0, 38,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,
+  0,  0,  0,  0, 68, 65, 84, 65,  8,  0,  0,  0,232,216,188,  2,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0,248,144,224,  2,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+ 79, 66,  0,  0,112,  5,  0,  0,152, 42, 25,  4,  0,  0,  0,  0,129,  0,  0,  0,  1,  0,  0,  0, 88, 48, 25,  4,  0,  0,  0,  0,
+216, 36, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,112,114,101,118,105,101,
+119, 46, 48, 48, 52,  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,  0,  0,  0,  0,  0,  1,  0,  0,  4,
   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,
+  1,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+200, 43,196,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,
+  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,
+168,  9, 13,  4,  0,  0,  0,  0,104,150,187,  2,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0, 31, 10, 58, 59, 94,236, 63,
+236, 84,231, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 91,188,110, 63,
+ 91,188,110, 63, 91,188,110, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+218, 15,201, 63,  0,  0,  0,128,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 91,188,110, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 90, 50,151, 51, 91,188,110, 63,  0,  0,  0,  0,  0,  0,  0,  0, 91,188,110,191,
+ 90, 50,151, 51,  0,  0,  0,  0,  0, 31, 10, 58, 59, 94,236, 63,236, 84,231, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  1,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,254,255,127, 63,226, 53, 25,179,  0,  0,  0,  0,  0,  0,  0,  0,167,120,247,166,
+  1,  0,128, 63,  0,  0,  0,  0,183,132, 39,174,239,106,181,179,116,226,155,179,  0,  0,128, 63,160, 65,137, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,160, 65,137, 63,157, 46, 19, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,152,176,
+161, 65,137, 63,  0,  0,  0,  0, 29, 80, 63,188, 62, 95,226,187, 87, 19, 74, 65,  0,  0,128, 63,160, 65,137, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,160, 65,137, 63,157, 46, 19, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,152,176,
+161, 65,137, 63,  0,  0,  0,  0, 29, 80, 63,188, 62, 95,226,187, 87, 19, 74, 65,  0,  0,128, 63, 16,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,
+  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0,  0,  0,  5,  0,  1,
+  0,  0,128, 63,  0,  0,128, 63,  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,  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,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0, 79, 66,  0,  0, 32,  5,  0,  0, 56, 87, 50,  3,  0,  0,  0,  0,116,  0,  0,  0,  1,  0,  0,  0,
-168, 92, 50,  3,  0,  0,  0,  0,200, 81, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 79, 66, 76, 97,109,112, 46, 48, 48, 51,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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, 10,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  8,  0,  0,  0,168,  9, 13,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0,104,150,187,  2,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0, 79, 66,  0,  0,112,  5,  0,  0, 88, 48, 25,  4,  0,  0,  0,  0,129,  0,  0,  0,  1,  0,  0,  0, 24, 54, 25,  4,
+  0,  0,  0,  0,152, 42, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,112,114,
+101,118,105,101,119, 46, 48, 48, 53,  0, 48, 48, 51,  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,  0,
+  1,  0,  0,  4,  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, 10,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-168,224, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,
-  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,168,121, 24,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0,
+ 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0,
+ 10,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,176,147,104, 64, 42, 84, 23,193,
-116, 77,171, 64,  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,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 85, 90,103, 63,254, 45,186,190,115,209,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,136,247,255, 62, 37, 39, 74, 63,138, 26,182, 62,  0,  0,  0,  0,164, 21, 44,191,
- 28, 67,194, 61,176,248, 59, 63,  0,  0,  0,  0,251,203, 11, 63,217, 45, 27,191, 47,  7, 20, 63,  0,  0,  0,  0,176,147,104, 64,
- 42, 84, 23,193,116, 77,171, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,197,201, 17,180, 99,220,102, 50,  0,  0,  0,  0,123,165,191, 50,
-254,255,127, 63, 10,194,140, 50,  0,  0,  0,  0, 41,160,180,178, 91,103, 73, 50,254,255,127, 63,  0,  0,  0,  0,254,255,127, 52,
-254,255,127,181,253,255,255, 52,  0,  0,128, 63,141,247,255, 62,165, 21, 44,191,250,203, 11, 63,  0,  0,  0,  0, 38, 39, 74, 63,
- 28, 67,194, 61,218, 45, 27,191,  0,  0,  0,  0,138, 26,182, 62,176,248, 59, 63, 47,  7, 20, 63,  0,  0,  0,  0, 97,221,111, 64,
-113, 57, 23,191, 59,  2, 45,193,  0,  0,128, 63,137,247,255, 62,165, 21, 44,191,251,203, 11, 63,  0,  0,  0,  0,142, 26,182, 62,
-176,248, 59, 63, 46,  7, 20, 63,  0,  0,  0,  0, 37, 39, 74,191, 20, 67,194,189,217, 45, 27, 63,  0,  0,  0,  0, 91, 99, 93,192,
-135, 98, 80,190,223,119,112,192,  0,  0,128, 63,  1,  0,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,  5,  0,  1,  0,  0,  0, 68,  0,
- 79, 66,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,
-  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  1,  0,  5,  0,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  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,128,155,195,189,
+ 20,145,188, 64, 94,220, 88, 65,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,221,180,134, 63, 48,190,141, 37,253, 55, 57, 35,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+253, 55, 57, 35, 48,190,141,165,  0,  0,  0,  0,219,128,112, 37, 52,177,253, 62, 94, 93, 94, 63,  0,  0,  0,  0, 52,133, 22, 37,
+ 94, 93, 94,191, 52,177,253, 62,  0,  0,  0,  0,128,155,195,189, 20,145,188, 64, 94,220, 88, 65,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+118, 42, 31, 25,242,108,131,153,  0,  0,  0,  0,  0,  0,  0,176,  0,  0,128, 63,210, 21, 66,178,  0,  0,  0,  0,  5,  0,  0,176,
+ 25,245,158, 50,  1,  0,128, 63,  0,  0,  0,  0,  0,  0,  0, 50,118, 42,159, 11,242,108,  3,140,  0,  0,128, 63,  0,  0,128, 63,
+219,128,112, 37, 52,133, 22, 37,  0,  0,  0,  0,  0,  0,  0, 48, 94, 93, 94, 63, 52,177,253, 62,  0,  0,  0,  0,  0,  0,128,175,
+ 50,177,253,190, 96, 93, 94, 63,  0,  0,  0,  0,149, 98,174, 61, 85,101,144,193,196,124,253, 64,  0,  0,128, 63,  0,  0,128, 63,
+219,128,112, 37, 52,133, 22, 37,  0,  0,  0,  0,  0,  0,  0, 48, 94, 93, 94, 63, 52,177,253, 62,  0,  0,  0,  0,  0,  0,128,175,
+ 50,177,253,190, 96, 93, 94, 63,  0,  0,  0,  0,149, 98,174, 61, 85,101,144,193,196,124,253, 64,  0,  0,128, 63, 64,  0,  0,  0,
+  0,  0,  0,  0,  0, 16,  0,  0,  0,  0,  0,  0,  5,  0,  1,  0,  0,  0, 68,  0,  0,  0,  7,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,
+236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0,  0,
+  0,  5,  0,  1,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64,  1,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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,  1,  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,
-  1,  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, 79, 66,  0,  0,112,  5,  0,  0, 24, 54, 25,  4,  0,  0,  0,  0,129,  0,  0,  0,
+  1,  0,  0,  0,216, 59, 25,  4,  0,  0,  0,  0, 88, 48, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 79, 66,112,114,101,118,105,101,119, 46, 48, 48, 54,  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,
- 79, 66,  0,  0, 32,  5,  0,  0,168, 92, 50,  3,  0,  0,  0,  0,116,  0,  0,  0,  1,  0,  0,  0, 24, 98, 50,  3,  0,  0,  0,  0,
- 56, 87, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 76, 97,109,112, 46, 48,
- 48, 52,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  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,  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,  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, 88,228, 49,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,
-  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  0,  0,  0,  0,  0, 56,142,198,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,
+250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,  0,  0,  0,249,147,251,192,206,  0, 24,193, 67,131,104,192,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 85, 90,103, 63,254, 45,186,190,115,209,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,168, 61,212,  2,  0,  0,  0,  0,168,202,185,  2,  0,  0,  0,  0,  1,  0,  0,  0,
+  1,  0,  0,  0, 94, 52,252,190,174,101,228, 65,141,116, 17, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,235,239, 30, 66,236,239, 30, 66,235,239, 30, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,138,174, 95, 63, 98,132,123, 37, 61, 56, 87,165,  0,  0,  0,  0,  0,  0,  0,  0,
   0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,136,247,255, 62, 37, 39, 74, 63,138, 26,182, 62,  0,  0,  0,  0,164, 21, 44,191, 28, 67,194, 61,176,248, 59, 63,
-  0,  0,  0,  0,251,203, 11, 63,217, 45, 27,191, 47,  7, 20, 63,  0,  0,  0,  0,249,147,251,192,206,  0, 24,193, 67,131,104,192,
+  0,  0,  0,  0,235,239, 30, 66,105,158,  5,168,108, 39, 28,168,  0,  0,  0,  0,212,129, 77, 40, 66, 15,204, 65,158,186,243, 65,
+  0,  0,  0,  0, 55, 89, 13,165,156,186,243,193, 65, 15,204, 65,  0,  0,  0,  0, 94, 52,252,190,174,101,228, 65,141,116, 17, 65,
   0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,254,255,127, 63, 55,105,222, 50,186,168, 17, 51,  0,  0,  0,  0,243,228, 47,178,  0,  0,128, 63, 81, 76,155,178,
-  0,  0,  0,  0,170,191, 22, 50,214, 89, 50, 51,254,255,127, 63,  0,  0,  0,  0,254,255,127,181,  0,  0,128,181, 35,  5,136,168,
-  0,  0,128, 63,137,247,255, 62,166, 21, 44,191,252,203, 11, 63,  0,  0,  0,  0, 38, 39, 74, 63, 28, 67,194, 61,217, 45, 27,191,
-  0,  0,  0,  0,137, 26,182, 62,176,248, 59, 63, 47,  7, 20, 63,  0,  0,  0,  0,121,151, 75, 65,207,166,219,191,181,156, 34, 63,
-  0,  0,128, 63,140,247,255, 62,165, 21, 44,191,252,203, 11, 63,  0,  0,  0,  0,140, 26,182, 62,176,248, 59, 63, 45,  7, 20, 63,
-  0,  0,  0,  0, 36, 39, 74,191, 22, 67,194,189,218, 45, 27, 63,  0,  0,  0,  0,148,142,176, 64, 97, 22,170,191, 27, 28,246, 64,
-  0,  0,128, 63,  1,  0,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,  5,  0,  1,  0,  0,  0, 68,  0, 79, 66,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,151,169,232, 24,151,190,157, 25,  0,  0,  0,  0, 21, 24,149, 24,  0,  0,128, 63,109,157, 59,178,
+  0,  0,  0,  0,191,231, 64,153,  1,158,199,178,  1,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,101, 43,206, 60, 25, 74,  5, 35,141, 90,183,159,  0,  0,  0,  0, 42,143,202,162,100, 20,158, 60,192, 89,132, 60,
+  0,  0,  0,  0,187, 83,173, 34,192, 89,132,188,102, 20,158, 60,  0,  0,  0,  0, 11,215, 70, 60, 61, 43, 67,191,184,241, 31, 63,
+  0,  0,128, 63,101, 43,206, 60, 25, 74,  5, 35,141, 90,183,159,  0,  0,  0,  0, 42,143,202,162,100, 20,158, 60,192, 89,132, 60,
+  0,  0,  0,  0,187, 83,173, 34,192, 89,132,188,102, 20,158, 60,  0,  0,  0,  0, 11,215, 70, 60, 61, 43, 67,191,184,241, 31, 63,
+  0,  0,128, 63, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0,  0,  0,  0,  0,
   1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,
   0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  1,  0,  5,  0,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,  0,  5,  0,  1,  0,  0,128, 63,  0,  0,128, 63,  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,  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, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0, 68, 65, 84, 65,  8,  0,  0,  0,168, 61,212,  2,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0,168,202,185,  2,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 79, 66,  0,  0,112,  5,  0,  0,216, 59, 25,  4,  0,  0,  0,  0,
+129,  0,  0,  0,  1,  0,  0,  0, 56, 66, 25,  4,  0,  0,  0,  0, 24, 54, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,112,114,101,118,105,101,119, 99,117, 98,101,  0,117, 98,101,  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,  0,  1,  0,  0,  4,  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,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,  0,  0, 32,  5,  0,  0,
- 24, 98, 50,  3,  0,  0,  0,  0,116,  0,  0,  0,  1,  0,  0,  0,136,103, 50,  3,  0,  0,  0,  0,168, 92, 50,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 76, 97,109,112, 46, 48, 48, 56,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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, 10,  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,  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,  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, 40,236, 49,  3,  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,  8,157,198,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
   1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,
   1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,145, 75,188, 63, 44,197,107,193,  5,147, 81, 64,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,218, 15,201, 63,  0,  0,128, 37,255,255,127, 37,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-255,255,127, 37,  0,  0,128,165,  0,  0,  0,  0,255,255,127, 37,105, 33,162, 51,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 37,
-  0,  0,128,191,105, 33,162, 51,  0,  0,  0,  0,145, 75,188, 63, 44,197,107,193,  5,147, 81, 64,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,152, 65, 25,  4,  0,  0,  0,  0,232, 65, 25,  4,  0,  0,  0,  0,
+  1,  0,  0,  0,  1,  0,  0,  0,128,253, 88, 59,220,118,160, 63,  0, 15, 37, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 84, 88, 68, 64, 84, 88, 68, 64, 83, 88, 68, 64,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  1,190,237, 62,108,230,217,190, 20,151, 52, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 67, 38,  8, 64,191,228,231, 63,186, 31,162, 63,  0,  0,  0,  0, 35,118, 13,192,  2, 61,220, 63,
+ 31, 44,160, 63,  0,  0,  0,  0,166, 52,234, 60,102,223,227,191, 55,229, 31, 64,  0,  0,  0,  0,128,253, 88, 59,220,118,160, 63,
+  0, 15, 37, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,254,255,127, 63,
- 44,197,107, 53,  4,147, 81,180,  0,  0,  0,  0,253,255,127, 37,  0,  0,128, 63, 64, 90,136, 48,  0,  0,  0,  0,254,255,127,165,
- 44,197,107,155,  0,  0,128, 63,  0,  0,  0,  0,254,255,255, 51,255,255,255,181,254,255,127, 52,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,  0,128,165,  0,  0,128, 63,255,255,255, 39,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0, 32,159,189,191, 47,164,188,191,150,188,153,192,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,  0,128,165,  0,  0,128, 63,255,255,255, 39,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0, 32,159,189,191, 47,164,188,191,150,188,153,192,  0,  0,128, 63, 32,  0,  0,  0,
-  0, 16,  0,  0,  0,  0,  0,  0,  5,  0,  1,  0,  0,  0, 68,  0, 79, 66,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,
-236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  1,  0,  5,  0,  1,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  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,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,187,122,172,178,103,144,  8, 50,  0,  0,  0,  0,  7,239, 27,179,  0,  0,128, 63,
+247,131,152,178,  0,  0,  0,  0,149,110,134, 50,189,195,169, 50,  1,  0,128, 63,  0,  0,  0,  0,255,223,172, 50, 56, 88,136,179,
+159,134, 16,180,  0,  0,128, 63, 11,115,103, 62,200,122,112,190,232, 17, 71, 59,  0,  0,  0,  0,  4, 27, 69, 62,226, 50, 59, 62,
+ 24,176, 65,190,  0,  0,  0,  0,114,205,  9, 62,203, 36,  8, 62,136,232,135, 62,  0,  0,  0,  0,188,208, 22,191, 23, 64, 18,191,
+174, 28,229,190,  0,  0,128, 63, 10,115,103, 62,201,122,112,190,  0, 18, 71, 59,  0,  0,  0,  0,116,205,  9, 62,204, 36,  8, 62,
+136,232,135, 62,  0,  0,  0,  0,  1, 27, 69,190,224, 50, 59,190, 25,176, 65, 62,  0,  0,  0,  0,110,176, 16,192,158, 71,  9,192,
+115, 90,244, 63,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,
+169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0,  0,  0,  5,  0,  1,  0,  0,128, 63,  0,  0,128, 63,  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,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  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,  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,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,  0,  0, 32,  5,  0,  0,136,103, 50,  3,  0,  0,  0,  0,
-116,  0,  0,  0,  1,  0,  0,  0,152,109, 50,  3,  0,  0,  0,  0, 24, 98, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,112,114,101,118,105,101,119,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  4,  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, 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
   1,  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,  0,  0,  0,  0,  0, 68, 65, 84, 65,  8,  0,  0,  0,
+152, 65, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0,
+232, 65, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 79, 66,  0,  0,112,  5,  0,  0, 56, 66, 25,  4,
+  0,  0,  0,  0,129,  0,  0,  0,  1,  0,  0,  0, 56,108, 26,  4,  0,  0,  0,  0,216, 59, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,112,114,101,118,105,101,119,104, 97,105,114,  0,108, 97,110,101,  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,  1,  0,  0,  4,  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,  1,  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,  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, 88,192, 55,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0,
- 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0,
- 10,  0,  0,  0, 10,  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,  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,248,108, 50,  3,  0,  0,  0,  0, 72,109, 50,  3,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
-100, 82,  7,189, 21,204,103,191,241,165,230, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,153, 39,155, 64,153, 39,155, 64,153, 39,155, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,218, 15,201, 63,
-  0,  0,192, 37,255,255,255, 36,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,153, 39,155, 64,152, 39, 27, 38,102,187,232,166,
-  0,  0,  0,  0,102,187,232, 38,157,134,196, 52,153, 39,155, 64,  0,  0,  0,  0,154, 39, 27, 38,153, 39,155,192,157,134,196, 52,
-  0,  0,  0,  0,100, 82,  7,189, 21,204,103,191,241,165,230, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,236, 48,206,152,  9, 66, 41, 24,
-  0,  0,  0,  0,216, 55, 60,152,  0,  0,128, 63, 88,133,105,166,  0,  0,  0,  0,226,159, 91,151, 64,218, 93, 38,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63, 25, 50, 83, 62,147,101,158, 36, 26, 50,211, 35,
-  0,  0,  0,  0, 24, 50,211, 35, 68,193,133, 50, 25, 50, 83,190,  0,  0,  0,  0,147,101,158,164, 25, 50, 83, 62, 68,193,133, 50,
-  0,  0,  0,  0,199, 70,223, 59,232, 71,190,190,148, 58, 63,190,  0,  0,128, 63, 25, 50, 83, 62,147,101,158, 36, 27, 50,211, 35,
-  0,  0,  0,  0,147,101,158,164, 25, 50, 83, 62,158, 59,174, 38,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 96,175, 25, 50, 83, 62,
-  0,  0,  0,  0,135, 62,153, 59,217, 94,110,185,118, 71,238, 63,  0,  0,128, 63,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  2,  0,  0,  0, 68,  0, 79, 66,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,
-  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,
-143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  1,  0,  5,  4,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  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,  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,128, 63,
-  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
   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,  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,  8,  8,196,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,
+  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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, 88,107, 26,  4,
+  0,  0,  0,  0, 88,107, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,248, 71, 25,  4,  0,  0,  0,  0, 72, 72, 25,  4,
+  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0, 86, 92,200, 63,  7,205,227, 63,149,199,  9,189,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,234,126, 47, 64,234,126, 47, 64,236,126, 47, 64,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,225, 80,  2, 63,  5,211, 15,191, 92,219, 18, 62,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,224,254, 18, 64, 23,209,169, 62, 27,251,186, 63,  0,  0,  0,  0, 71,254,133,191,
+207, 40, 17, 64,229,194,144, 63,  0,  0,  0,  0, 78, 38,137,191, 48,162,192,191,125,176,  1, 64,  0,  0,  0,  0, 86, 92,200, 63,
+  7,205,227, 63,149,199,  9,189,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,225,128, 25,179,157,103, 88,179,  0,  0,  0,  0,249,162,132, 50,
+  1,  0,128, 63, 89,156,139, 51,  0,  0,  0,  0,225,204,139,179,160, 96,185,178,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0, 52,
+  1,  0,  0,180,  1,  0, 84,180,  0,  0,128, 63,244,100,156, 62,133,143, 14,190, 54,235, 17,190,  0,  0,  0,  0,174,239, 70, 62,
+100,  4, 26, 62, 74,251,137, 62,  0,  0,  0,  0,176,172, 52,189,213,112,154,190, 70,243, 76, 62,  0,  0,  0,  0,151, 56, 36,191,
+142, 98, 66,192,171,  5, 68, 64,  0,  0,128, 63,244,100,156, 62,133,143, 14,190, 54,235, 17,190,  0,  0,  0,  0,174,239, 70, 62,
+100,  4, 26, 62, 74,251,137, 62,  0,  0,  0,  0,176,172, 52,189,213,112,154,190, 70,243, 76, 62,  0,  0,  0,  0,151, 56, 36,191,
+142, 98, 66,192,171,  5, 68, 64,  0,  0,128, 63,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  2,  0,
+  0,  0, 68,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,
+  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0,  0,  0,  5,  0,  1,  0,  0,128, 63,  0,  0,128, 63,  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,
- 25,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  8,  0,  0,  0,248,108, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0, 72,109, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0, 79, 66,  0,  0, 32,  5,  0,  0,152,109, 50,  3,  0,  0,  0,  0,116,  0,  0,  0,  1,  0,  0,  0, 88,116, 50,  3,
-  0,  0,  0,  0,136,103, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,112,114,
-101,118,105,101,119, 46, 48, 48, 50,  0, 46, 48, 48, 49,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  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,128, 63,  0, 64,  1,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,120, 73, 25,  4,  0,  0,  0,  0,120, 73, 25,  4,  0,  0,  0,  0,152, 72, 25,  4,
   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,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+  8,  0,  0,  0,248, 71, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+  4,  0,  0,  0, 72, 72, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,152,  0,  0,  0,
+152, 72, 25,  4,  0,  0,  0,  0,132,  0,  0,  0,  1,  0,  0,  0,  0, 64,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200,104, 52,  3,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,205,204,204, 61,205,204, 76, 62, 10,215,163, 60,  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,168,115, 50,  3,  0,  0,  0,  0,168,115, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,115, 50,  3,
-  0,  0,  0,  0, 88,115, 50,  3,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,242,187,213,191,194,145,134, 63,254,100, 35, 64,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,243,  0, 28, 65,246,  0, 28, 65,
-243,  0, 28, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 48,110,135, 63,180,169, 59, 62,138,115,  1,191,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,198, 49,  6, 65,115,154,148,192,  3,113,227,191,  0,  0,  0,  0,159,250,106, 64,189,207, 91, 64,
- 80,170,  5, 65,  0,  0,  0,  0, 46,151, 86,192,125, 94,251,192,188,127,150, 64,  0,  0,  0,  0,242,187,213,191,194,145,134, 63,
-254,100, 35, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,220,198, 33,177, 33, 91, 79,179,  0,  0,  0,  0,132, 62,152, 49,  0,  0,128, 63,
- 52,168,172, 50,  0,  0,  0,  0, 31,  6, 96,177,234,190, 21, 51,  0,  0,128, 63,  0,  0,  0,  0,212, 90,228, 50,171,224,143,179,
-223, 27,189,175,  0,  0,128, 63,144,174,180, 61,160, 48, 30, 61,223,118, 16,189,  0,  0,  0,  0,164, 29,153,188, 38,248,179, 61,
-113,162, 74, 61,  0,  0,  0,  0, 15, 21, 72, 61,160,250, 19,189, 88, 57,169, 61,  0,  0,  0,  0,  4,107, 50, 63, 88, 46,204,190,
-177,206, 79, 63,  0,  0,128, 63,144,174,180, 61,160, 48, 30, 61,223,118, 16,189,  0,  0,  0,  0,164, 29,153,188, 38,248,179, 61,
-113,162, 74, 61,  0,  0,  0,  0, 15, 21, 72, 61,160,250, 19,189, 88, 57,169, 61,  0,  0,  0,  0,  4,107, 50, 63, 88, 46,204,190,
-177,206, 79, 63,  0,  0,128, 63,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0, 79, 66,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,
-169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  1,  0,  5,  0,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,152,  2,  0,  0,120, 73, 25,  4,  0,  0,  0,  0,137,  1,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40,174,198,  4,  0,  0,  0,  0, 88, 76, 25,  4,  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,  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,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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, 25,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
-  8,  0,  0,  0,  8,115, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
-  4,  0,  0,  0, 88,115, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,104,  0,  0,  0,
-168,115, 50,  3,  0,  0,  0,  0, 74,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0, 31,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 83,117, 98,115,117,114,102,  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,  1,  0,  1,  0,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,  0,  0, 32,  5,  0,  0,
- 88,116, 50,  3,  0,  0,  0,  0,116,  0,  0,  0,  1,  0,  0,  0,104,122, 50,  3,  0,  0,  0,  0,152,109, 50,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,112,114,101,118,105,101,119, 46, 48, 48, 51,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  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,244,100,156, 62,134,143, 14,190, 52,235, 17,190,  0,  0,  0,  0,172,172, 52, 61,211,112,154, 62,
+ 69,243, 76,190,  0,  0,  0,  0,176,239, 70, 62,102,  4, 26, 62, 73,251,137, 62,  0,  0,  0,  0,188,211, 12,191,198,176,160,190,
+ 56,156, 22, 63,  0,  0,128, 63,  0,  0,  0, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 49,  2,  0,  0,
+150,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,150,  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,  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,184,168,  3,  3,  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,104,135, 53,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,
-  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,200,121, 50,  3,  0,  0,  0,  0, 24,122, 50,  3,  0,  0,  0,  0,
-  1,  0,  0,  0,  1,  0,  0,  0, 16,194,203,187,155, 89, 45, 63,244,153,230, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 56,135, 72, 63, 56,135, 72, 63, 56,135, 72, 63,  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,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 56,135, 72, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 56,135, 72, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 56,135, 72, 63,  0,  0,  0,  0, 16,194,203,187,155, 89, 45, 63,244,153,230, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 57,135,200, 47,
- 57,135,200,178,  1,  0,128, 63,  0,  0,  0,  0,180,192,175,176, 32,132,146, 51,193, 40, 10,179,  0,  0,128, 63,144,104,163, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,144,104,163, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,176,
-  0,  0,  0, 51,143,104,163, 63,  0,  0,  0,  0,203, 15,  2, 60,184, 77, 93,191, 54, 50, 19,192,  0,  0,128, 63,144,104,163, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 34,252,250,206, 51,144,104,163, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-144,104,163,191,  0, 64,204, 51,  0,  0,  0,  0,105, 93,173,187,172,176, 88,193, 95, 52,118,186,  0,  0,128, 63,  2,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0, 79, 66,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,
-236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  1,  0,  5,  0,  1,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  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,  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,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  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,  0,  0,  0,  0,  0,  0,
+232,101, 26,  4,  0,  0,  0,  0,232,101, 26,  4,  0,  0,  0,  0,232,101, 26,  4,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 56,153,  3,  3,  0,  0,  0,  0,
-248,160,  3,  3,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  8, 95,224,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,128,112,  0,  0,
+ 88, 76, 25,  4,  0,  0,  0,  0,134,  1,  0,  0,150,  0,  0,  0, 20,135, 17,192, 36,121, 97,192,112, 32,141, 63,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  8,  0,  0,  0,200,121, 50,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0, 24,122, 50,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 79, 66,  0,  0, 32,  5,  0,  0,104,122, 50,  3,  0,  0,  0,  0,116,  0,  0,  0,
-  1,  0,  0,  0,120,128, 50,  3,  0,  0,  0,  0, 88,116, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 79, 66,112,114,101,118,105,101,119, 46, 48, 48, 52,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,
-  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,  1,  0,  0,  0,
+ 40,189, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,180, 96, 10, 60,200,196,163, 61, 78,182, 99, 63,165,242,180, 60,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,111, 46,  7,192,143, 26, 60,192, 28,147,207, 63,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 72,190, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,147,247, 17, 61, 51,172, 44, 62, 17,125, 54, 63, 69,195,169, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,224,103,174,189, 60, 88, 17,192,230, 35, 76, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,201,206,183,190,200,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+104,191, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,102, 96, 39, 62,101,119,242, 61,189,168,146, 62, 55,  9,221, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 75,102,131,192,196,241, 26, 63,140,198, 76, 64,190, 81, 55,191,
+107,243, 71,191, 98,237, 42, 63,235,163,214, 62,198,206,183,190,206,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+136,192, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,227,146, 53, 61, 63,180,115, 63,216,113, 42, 59,125, 63,144, 58,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 64, 43,226,189,253, 85,220,191,225,104,101, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,201,206,183,190,200,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+168,193, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,250,120,128, 62, 19,194, 20, 62, 61, 15, 90, 62, 92, 30,200, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,108,159,129,191,  8,210,  6, 63, 35,221,152, 64,190, 81, 55,191,
+107,243, 71,191,102,237, 42, 63,235,163,214, 62,200,206,183,190,205,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+200,194, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,148,235, 25, 63,206,172,146, 62,137,195, 52, 61, 99,142,139, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,114,167,189,191,217, 59,104,192,184,179,184, 63,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+232,195, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,120,167,104, 60,166,104,235, 60,218,251, 73, 63, 13, 25, 44, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 86,112, 30, 63,111, 69, 82,192, 59,191, 51, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+  8,197, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 27,112,241, 60,  0,187,177, 60,  4,134,171, 62,164, 35, 29, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,118,148,176,191, 88,200,  1, 63, 89, 48,146, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 40,198, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,160,178,  8, 63,185,164,184, 62, 68, 72, 63, 61, 16,104,112, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,200, 80,168,191,  8,154,165,191,229,248, 80, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 72,199, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,177, 46,104, 62, 36,106,150, 62,  2, 61,138, 62,  4,131, 86, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,  0,190,246,189,233,129, 90,192,224,155, 20, 64,190, 81, 55,191,
+107,243, 71,191, 98,237, 42, 63,235,163,214, 62,198,206,183,190,206,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+104,200, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 79, 25,187, 60,207,244,194, 60, 53,234,253, 62,233, 52,234, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,176,231, 67,190,144,105, 11,189,210,111,153, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,201,206,183,190,200,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+136,201, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,206,217, 24, 63, 59,222, 25, 62,  0, 50,134, 61,139,161, 63, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 58,217,158, 63,122,225, 17,192,213,158,120, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+168,202, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 34,213, 73, 62,217,230, 49, 61,217,117,187, 61,143,253, 42, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 29,205,127,191,231,116,142,191,116, 64,100, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+200,203, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,109,124,145, 62, 47, 84,135, 62, 95, 56, 95, 62,104, 38,111, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,143,106, 67,192,239,  1,236, 62,230,139,105, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+232,204, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 37,227,100, 62,230, 38, 54, 63, 87,  4, 43, 61,166,  1,190, 60,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,114, 63, 58,191,242, 44,102,191,239,155,119, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+  8,206, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,232,134,178, 62, 23,134,113, 62,235,242, 46, 62, 45,121,122, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,244,173,175, 62,136,194,141, 61,  0,239,164, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,201,206,183,190,200,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 40,207, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,211, 97, 48, 63, 38,134,130, 61,167, 53,  8, 61, 56, 40, 91, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,127,188, 36,192, 83,192, 42,192, 20, 24,202, 63,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 72,208, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,191,242,154, 60, 14,165,130, 62,127,236, 49, 63,163, 44,253, 60,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,191,117, 51, 63, 40,247, 44,192, 84, 59, 82, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+104,209, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,218, 50,227, 61, 48,152,110, 61,166, 58,104, 62,121,161, 26, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 23,218, 44,192,131,112,159,190, 68,196, 80, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+136,210, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 23,126, 53, 62, 93,113, 22, 63, 29,104, 42, 62,166,168,140, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,222,253, 61,191,212,216, 43,190,219,239,140, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+168,211, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 24, 36,252, 62,191,130,121, 62, 96,245,198, 61, 98,186, 42, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,192,168,212,191, 47,175, 30,192, 94,228, 12, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+200,212, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,118,198,167, 61, 92,200, 80, 62,157,210, 10, 63,240,  9, 48, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,114,184,238,190,237,206,230,191,208,122, 85, 64,190, 81, 55,191,
+107,243, 71,191, 98,237, 42, 63,235,163,214, 62,198,206,183,190,206,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+232,213, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,138,132, 94, 62,167,190, 48, 62,203, 41,136, 62,157, 52,176, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 67, 19,104, 63,179,122,254,191,115, 37,123, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+  8,215, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,197,245,124, 62, 30,108,130, 61,201,152,229, 61,242,193, 19, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,172,106,191, 63,110,225, 42,192,  2,170,110, 64,190, 81, 55,191,
+109,243, 71,191, 98,237, 42, 63,236,163,214, 62,197,206,183,190,201,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 40,216, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,240, 99,249, 61,190, 88,249, 60,174, 20,183, 61, 39, 38, 66, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,121,  3, 12,192, 63, 11,252,190,146,136, 89, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 72,217, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,173, 28,108, 62,191,152,246, 62,199, 50, 61, 62, 31,254,210, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,250,104,187,191, 56, 86,139,189,145, 23,131, 64,190, 81, 55,191,
+107,243, 71,191,100,237, 42, 63,235,163,214, 62,198,206,183,190,203,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+104,218, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 15, 67,208, 62,184, 57,190, 62,119,154,219, 61,111,114,234, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 52, 56,161, 62,255,221,207,191,202,110,120, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,201,206,183,190,200,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+136,219, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,123, 33,150, 62, 68, 30,226, 61,224,121, 27, 62,  4,154,227, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 63, 89, 41,192,117,107, 25,192,174,245,222, 63,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+168,220, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 82,179,202, 60,197,106,157, 62,211,197, 33, 63,  9,243, 18, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 94,238,220,191, 91, 70,150,191,203,192, 72, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+200,221, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 13,183, 77, 62,158,153,182, 62, 65, 59,143, 62, 52,159, 38, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 61,234,116,192,224,101,238,188,165, 20, 56, 64,190, 81, 55,191,
+107,243, 71,191,100,237, 42, 63,235,163,214, 62,198,206,183,190,203,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+232,222, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 31,255,242, 60,231,194, 83, 63,189, 56,  5, 62, 68,188, 85, 60,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,128,209,240,189,178,183, 95, 63,  5, 67,176, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,201,206,183,190,200,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+  8,224, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,153,189, 85, 63,151,104,200, 61,246, 55,142, 60, 74, 57, 76, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,206, 54, 25,192,171,197,162, 62,  6, 16,121, 64,190, 81, 55,191,
+109,243, 71,191, 98,237, 42, 63,236,163,214, 62,197,206,183,190,201,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 40,225, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,104,246,163, 62, 91,201, 16, 63, 24,104,136, 61,227,230, 66, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 29, 57, 61,192,236, 53, 39,191,173,221, 55, 64,190, 81, 55,191,
+107,243, 71,191,100,237, 42, 63,235,163,214, 62,198,206,183,190,203,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 72,226, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 39,218,212, 61,242, 20, 25, 63,122, 70,118, 62,159,226,107, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,249, 62, 40,191, 16,113, 26, 63, 50,179,160, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+104,227, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 64,186, 45, 63,109,122, 91, 62, 32,134, 21, 61, 21,118,144, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 90, 51,138,191,199, 14,110,192, 18, 66,203, 63,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+136,228, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,235,223,153, 59, 21,174,243, 59,231,160, 60, 63,251,135,128, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 44, 75,186,191,170,205,204,191,132,169, 61, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+168,229, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 79, 19, 52, 62,229, 52,146, 62,191,228,171, 62,106,185, 79, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,  4,119,219, 63,231, 73, 28,192, 83,117,128, 64,188, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,233,163,214, 62,202,206,183,190,201,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+200,230, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,186, 75, 51, 62,206,251,144, 60,198, 49, 19, 61, 22,114, 69, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,172, 59,194,191, 35, 29, 13,192, 13,208, 30, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+232,231, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 97, 31,227, 61,168,207,104, 62, 38, 89,237, 62, 93,238, 74, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,197,190, 82,192,251,148,174, 62, 29,189, 91, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+  8,233, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,210, 10, 37, 62,124,152, 65, 63, 28,110,106, 61,179,189,207, 60,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,120,157,163,190, 44,219, 33, 63,250, 25,167, 64,190, 81, 55,191,
+107,243, 71,191,102,237, 42, 63,237,163,214, 62,199,206,183,190,206,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 40,234, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 52,192, 61, 63, 16, 50, 23, 62, 40, 56,  1, 61, 43,254,162, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,131, 63, 79, 63, 22,225,203,191,183, 83,133, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 72,235, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,  9,188,167, 62,141,167,138, 61,186,163,185, 61,147,152,  3, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 20,218, 89, 62,169, 21, 81,192, 50,226, 38, 64,190, 81, 55,191,
+107,243, 71,191, 98,237, 42, 63,235,163,214, 62,198,206,183,190,206,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+104,236, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,175,237, 18, 61, 50,  0,  0, 61,180, 45,208, 62, 72,186,  6, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,192, 91,166,190,203,138,151, 62,232,  4,159, 64,190, 81, 55,191,
+109,243, 71,191, 98,237, 42, 63,236,163,214, 62,197,206,183,190,201,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+136,237, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,114,117, 40, 63,164, 92, 37, 62, 72,198, 78, 61,  6, 28,  5, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,104,137,191,191,143,156,208,190,234,245,116, 64,190, 81, 55,191,
+109,243, 71,191, 98,237, 42, 63,236,163,214, 62,197,206,183,190,202,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+168,238, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,121,217,174, 62, 45, 55,188, 62, 41, 76, 25, 62,138,146, 16, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,218,  6, 78,191,240,247,  2,191,  2,181,131, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+200,239, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,237,209,211, 62,  1,168,129, 62,108,237,  7, 62,188, 30, 77, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,100,181,251,191,160, 67, 79, 63, 83,115,143, 64,190, 81, 55,191,
+109,243, 71,191, 98,237, 42, 63,236,163,214, 62,197,206,183,190,201,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+232,240, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 31, 56,250, 62,174,208,248, 62, 50, 43, 79, 60,252,186, 79, 60,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,166,143, 16,192,219, 40, 31,192,188,165,240, 63,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+  8,242, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 93,255, 69, 61,131,237,129, 62,199,113, 29, 63, 16,188,169, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 47, 16, 46,192,234,135, 17, 62,196,174,101, 64,190, 81, 55,191,
+107,243, 71,191,100,237, 42, 63,235,163,214, 62,198,206,183,190,203,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 40,243, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,132,185,112, 62, 76,198, 31, 63, 82,148,186, 61,149,140, 75, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,221, 76, 34,192,195, 63,220,191,101, 92, 19, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 72,244, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,191,  5,144, 61, 27,251,203, 62,  8,217,232, 62,185,169,156, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,  0,209,208,191,175, 98, 57,192,214, 39,244, 63,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+104,245, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 40,142,100, 61,206, 81, 18, 62, 52,238, 34, 63,214,209, 40, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,156,146, 19,192,132,169, 38, 63,119,240,133, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+136,246, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,177, 98,202, 62,157,134, 14, 63,246,140,213, 60, 97,116,179, 60,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,100,209,211, 63, 80, 57, 64,192,239, 52,100, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+168,247, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,131,222,112, 61,150,149,161, 60,127,188,202, 61,219,141, 82, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,204, 40,195, 62,169, 66, 22,192, 56, 69, 88, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+200,248, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,237,198, 39, 62,232,166,180, 61, 33, 45,106, 62, 32,238,  4, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,179, 41,124, 63,215, 52, 92,192,  1,194, 56, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+232,249, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,225,119,158, 59, 62,185, 89, 59, 58, 41,150, 62,186,212, 50, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 78,215, 66,192, 16,102, 17,189,251, 64, 82, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+  8,251, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 94, 65, 31, 62,152, 57, 45, 63,117,240,248, 61, 59,128, 61, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,243,234,243, 63, 12,199, 50,192,246,173,118, 64,192, 81, 55,191,
+107,243, 71,191, 98,237, 42, 63,235,163,214, 62,197,206,183,190,205,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 40,252, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,202, 64,207, 61, 46,106, 89, 60, 30, 53, 13, 61,236,222, 89, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,174,176, 54,191, 99,173,187,191,209, 31, 93, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 72,253, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,101,144,129, 62,185,  1, 91, 62, 60, 67,121, 62, 32, 77,148, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,238,131,100,192,222,185, 81,191, 40, 50, 27, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+104,254, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,197,146, 70, 60, 83,125, 44, 63, 64,124,156, 62,125,144, 10, 60,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,226, 77,248,190, 12,109,103,190,230,231,143, 64,190, 81, 55,191,
+107,243, 71,191,100,237, 42, 63,235,163,214, 62,199,206,183,190,204,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+136,255, 25,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 53,173,  3, 63,187,233, 78, 62, 77,225,187, 61,203,112, 68, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,129, 80, 10, 64,253,130, 74,192,124,179,109, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+168,  0, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,215,  2,202, 60, 38,116,181, 59,240,167,204, 60,193,223,113, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 73, 37, 55,192, 92, 44,210,191,134, 20, 12, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+200,  1, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,144,158, 50, 61, 53,247,230, 62,253, 25,236, 62,226,215, 52, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,  4,163,152,191,233,189, 16,192,148, 29, 39, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+232,  2, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,113,136,250, 61,109, 45, 71, 62,248,240,222, 62,108,172,125, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 83,219,213, 63,119,221, 77,192, 98,157, 90, 64,192, 81, 55,191,
+107,243, 71,191, 98,237, 42, 63,235,163,214, 62,197,206,183,190,205,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+  8,  4, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,154,154,192, 60,206,233, 43, 60, 68, 13,  0, 62, 51, 72, 87, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,118, 39,106,191,130, 29,114, 63,156,123,164, 64,190, 81, 55,191,
+107,243, 71,191,102,237, 42, 63,235,163,214, 62,200,206,183,190,205,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 40,  5, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,149, 27, 54, 63,243, 38,133, 62,232, 55, 53, 60, 91,130,143, 60,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,  4, 71,102,192,241,109,194,190,108, 39, 47, 64,192, 81, 55,191,
+107,243, 71,191,100,237, 42, 63,233,163,214, 62,198,206,183,190,204,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 72,  6, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,152,203, 22, 61,132,161, 61, 63, 67,196, 79, 62, 79, 22,160, 60,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 12,224,214, 63,225,182,  5,192,246, 59,136, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+104,  7, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,211, 28,131, 62, 24,255, 46, 60, 11,165,139, 60,113, 88, 55, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 95,158, 92, 63,117,243, 67,192, 16,154, 70, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+136,  8, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,112, 55,104, 61, 14, 23,  9, 61,208, 82,129, 62,176, 65, 40, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 87,234, 31,192,204,234, 65,192,110,200,172, 63,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+168,  9, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,197,252, 48, 60,163,176, 62, 62,216, 93, 72, 63, 94, 65,166, 60,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 76,122,189,191,238,243,102,191,158,253, 93, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+200, 10, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,101,159,135, 62,253,216,174, 62,217, 99, 96, 62,104,171, 50, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,227, 75, 67, 63, 48,124, 78, 61,200,150,171, 64,190, 81, 55,191,
+107,243, 71,191,100,237, 42, 63,235,163,214, 62,198,206,183,190,203,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+232, 11, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,191,115, 58, 63,121,198,  2, 60,254,102,167, 59,178,100,132, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 24, 37,139, 62,  4,231, 62, 63,174,205,179, 64,188, 81, 55,191,
+107,243, 71,191,102,237, 42, 63,235,163,214, 62,200,206,183,190,206,137, 61,190,156, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+  8, 13, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 50, 23, 92, 63,169, 27, 15, 61,  8, 43, 83, 60, 59, 83,189, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 32,247,225,191, 37,175, 81,192,248,254,198, 63,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 40, 14, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 66,132,  2, 61,191, 37,189, 61,173,  5, 64, 63, 91,181,  0, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,200,110,165, 61,183, 43,239, 62,129,243,169, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 72, 15, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 62,109, 66, 63,244,159,170, 61, 79,150,243, 60, 69,136,  2, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 12,158,243,191,244,237,104,192,138, 34,155, 63,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+104, 16, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,228,106, 92, 60, 23, 25, 35, 61,136,111, 93, 63,211,105,167, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,118, 74,  8, 63,  0,240,  1,192, 28,123,108, 64,190, 81, 55,191,
+107,243, 71,191,102,237, 42, 63,235,163,214, 62,200,206,183,190,205,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+136, 17, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,233,242,101, 62,181,120,181, 61,231,136, 43, 62,245,241,  4, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 26, 24,231,191, 44,105, 21,191,186, 32, 98, 64,190, 81, 55,191,
+107,243, 71,191,100,237, 42, 63,235,163,214, 62,198,206,183,190,203,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+168, 18, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 66,189,138, 62,114,103,210, 62,117,128, 62, 62, 35, 54,  7, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,141, 52,  5,191, 10,103, 49,192,230,154, 37, 64,190, 81, 55,191,
+107,243, 71,191, 98,237, 42, 63,235,163,214, 62,198,206,183,190,206,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+200, 19, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,132, 47,184, 61,244,157,207, 61,168,  0,225, 62,249, 11,189, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,136, 45,177,191, 22,253, 99, 63,  8, 58,155, 64,190, 81, 55,191,
+109,243, 71,191, 98,237, 42, 63,236,163,214, 62,197,206,183,190,202,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+232, 20, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,147,253, 28, 63,231,184,184, 62, 48, 48, 58, 60, 59, 78,111, 60,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 42,255, 57,191,235,  4, 65,192, 77,  7, 19, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+  8, 22, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,228,255,128, 61, 76, 32,172, 61,147,152,  5, 63,205,134,169, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,184, 68,137,191,204,177,226, 61,196,247,141, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 40, 23, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,107,166,  0, 63, 23, 29,154, 62, 34,214,165, 61, 42,130,236, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 22,103, 82,192, 73, 75,201,191,  1,247,  0, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 72, 24, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 73,109,118, 59,168,155,  4, 63, 73,  2,243, 62,186,198,108, 59,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,194,241,246,191, 87,130,236, 62, 50,209,135, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+104, 25, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 49, 99,219, 62, 85, 73,242, 62,127, 14, 79, 61, 68,141, 67, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,224,228,149,189,233, 13,221,190,210,251,145, 64,190, 81, 55,191,
+107,243, 71,191,100,237, 42, 63,235,163,214, 62,199,206,183,190,204,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+136, 26, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,198,141,  4, 63,  3, 71, 19, 62, 60,186,174, 61, 99,146,129, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,  0,120, 89, 62,164,169,120,190, 26, 78,155, 64,192, 81, 55,191,
+109,243, 71,191, 98,237, 42, 63,234,163,214, 62,197,206,183,190,202,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+168, 27, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,224, 89, 24, 63,189,174,198, 61,  2,152,101, 61,143,237,128, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 92, 80, 26,192,232,  3,239,189,182,210, 99, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+200, 28, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,115,248,126, 62, 84, 41, 12, 63,153, 55,  4, 62, 62, 85,152, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 80,245, 70,190,136,148, 37,192, 41,107, 57, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+232, 29, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,208,237,239, 61, 10, 34,210, 61, 62,101,181, 62,205, 22,218, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,253,172, 25,191, 68,234,249,191, 59,217, 73, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+  8, 31, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 12,172, 64, 62,160, 24, 51, 62,145, 49,156, 62, 26,236,169, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 77, 63, 60,192,192, 70,245,191,246,177,248, 63,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 40, 32, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,172,109,175, 60,  7,135,214, 62, 59, 12,  9, 63,150,154,198, 60,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,  6,125,162, 63, 63,233, 64,192,147,167, 86, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 72, 33, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,  4, 49,119, 61,119,251,224, 60, 94,  5, 47, 62,188,195, 61, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,184, 96, 27,192,251, 23,179,191,193, 77, 38, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+104, 34, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,166,161,213, 61,217,242,218, 62, 39, 18,191, 62, 89, 74,194, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,185,  0, 21,191,137,241, 14,192,206, 27, 61, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+136, 35, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 58, 36, 27, 62,245,151, 28, 62, 82, 23,179, 62,148, 10,177, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 64, 80, 57,189,193, 80,166,191,242,172,123, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,201,206,183,190,200,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+168, 36, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,199,225,170, 62,114, 67, 23, 62,202, 56, 33, 62, 26,224,184, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,202,106,219,190, 17,216,127, 63,140,251,173, 64,190, 81, 55,191,
+110,243, 71,191, 98,237, 42, 63,235,163,214, 62,198,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+200, 37, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 10,203, 79, 63,104, 14, 32, 62,252,238, 44, 60, 55,180,175, 60,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,111, 39, 91,192, 64, 81,150,191, 89, 68, 15, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+232, 38, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 25, 88, 25, 60, 85, 74, 25, 63,199,185,196, 62,210,179,249, 59,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,231, 17, 40, 63,141, 44,153,190, 68,123,161, 64,190, 81, 55,191,
+107,243, 71,191,102,237, 42, 63,235,163,214, 62,200,206,183,190,205,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+  8, 40, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,202,133, 32, 63, 25,163, 36, 61, 45,136,225, 60,133, 71,156, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 50, 95,160, 63, 34,101,249,191,176, 96,132, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 40, 41, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 62, 45,138, 62, 35,142, 30, 61,173, 78,128, 61,170,246, 32, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,111,133,  6,192,167,152,225,191, 84, 16, 32, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 72, 42, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,245,107,217, 61,253,147,174, 62,227,232,218, 62, 70, 80,  0, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 80, 99,228,190, 44, 59, 51,191,221, 75,133, 64,192, 81, 55,191,
+109,243, 71,191, 98,237, 42, 63,234,163,214, 62,197,206,183,190,202,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+104, 43, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,117,208,213, 62,118,118, 76, 62, 32,254,  5, 62, 65,245,128, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 85,101, 74,192,166,185,105,191, 18,141, 36, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+136, 44, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,221,214,102, 61, 50, 22, 25, 63,139, 42,157, 62,164,113, 30, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,122,234,218,191, 50,177,232,191,108,174, 42, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+168, 45, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,229, 50,  8, 62,227,251,148, 62,133, 65,206, 62, 75, 82, 49, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,254,106,206,191,205, 36,150, 62, 96, 42,137, 64,190, 81, 55,191,
+107,243, 71,191,100,237, 42, 63,235,163,214, 62,198,206,183,190,203,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+200, 46, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 87, 15,231, 62, 49,237,207, 62,254, 43,141, 61,226,225,150, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,200, 61,167, 63,119,  5,171,191, 86,214,147, 64,190, 81, 55,191,
+109,243, 71,191, 98,237, 42, 63,236,163,214, 62,197,206,183,190,201,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+232, 47, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,216, 36,214, 62,172, 85,122, 60, 44,247,142, 60,132,140, 12, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,194, 14,251,191, 44,213,105,190,165,188,109, 64,190, 81, 55,191,
+107,243, 71,191,100,237, 42, 63,235,163,214, 62,198,206,183,190,203,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+  8, 49, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,239, 13,155, 62, 40, 17,234, 62, 92,128, 13, 62,226,130,208, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,102, 47, 46,192, 64,212, 45, 63, 61, 35,127, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 40, 50, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 74, 31,165, 62,207,208, 37, 63, 74,227,141, 60,  8, 28, 76, 60,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 10,203, 83,191,133, 15, 29,192,237, 82, 42, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 72, 51, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 21,150,239, 61,130,193, 24, 62, 46, 71,217, 62,141,114,158, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 47, 71,102, 63, 16, 13, 44,191, 24,187,156, 64,190, 81, 55,191,
+109,243, 71,191, 98,237, 42, 63,236,163,214, 62,197,206,183,190,201,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+104, 52, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,178,206, 13, 63,144,101,237, 60, 16,227,198, 60, 16, 30,201, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,140,210,252, 62,216, 58, 44,191, 98,217,149, 64,192, 81, 55,191,
+109,243, 71,191, 98,237, 42, 63,234,163,214, 62,197,206,183,190,202,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+136, 53, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,235,174,  4, 63,125,216,156, 61,114,228,115, 61,124,239,176, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,181,210, 46,192, 59,  4,135,191,164, 99, 44, 64,190, 81, 55,191,
+109,243, 71,191, 98,237, 42, 63,236,163,214, 62,197,206,183,190,202,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+168, 54, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,154, 69,201, 61, 74,143,  3, 63,155, 10,162, 62,186, 21,146, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 64,235, 64, 60,203,210,147, 63,205, 32,185, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,201,206,183,190,200,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+200, 55, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,135,168,109, 63, 87, 44,112, 61,106, 72,115, 59,214, 90, 24, 60,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,160,185,  0,192,197,235, 38,192,182,221,245, 63,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+232, 56, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 85,123,103, 61,230, 65, 90, 62, 33,215, 29, 63,124,  5,233, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,132,118,247,191, 87, 66,  8,192, 93, 88, 20, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+  8, 58, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 15,245,186, 61,252,211,140, 62,237,184,252, 62,164,107, 15, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 96,252,  2,190,189, 32, 63,192,249,176, 40, 64,190, 81, 55,191,
+107,243, 71,191, 98,237, 42, 63,235,163,214, 62,198,206,183,190,206,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 40, 59, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,109,251,141, 61,209, 15,135, 61,152,122,212, 62,150, 66,230, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,186, 37, 60,192,209, 36, 19,192,200,102,212, 63,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 72, 60, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,144,146,141, 59, 24,189,182, 62, 12, 24, 34, 63,242, 33,183, 59,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 62,165,155, 63, 35,188,200,191,156,201,140, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+104, 61, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 54,112,182, 62,156,202,  2, 61, 65,146, 40, 61, 24, 18, 18, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,150, 48,  1, 63,133, 14,211, 62,120,209,175, 64,190, 81, 55,191,
+107,243, 71,191,102,237, 42, 63,235,163,214, 62,200,206,183,190,205,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+136, 62, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 26, 61, 76, 63,214,234,171, 60,230,187, 47, 60,126,146, 46, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,196,144, 98, 62, 62,190,112,191,153,224,138, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+168, 63, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 51,212,220, 62, 49, 96,238, 61,  1,246,205, 61, 64, 22,180, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 80,243,  2,192, 18, 84, 91,191,110,  0, 77, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+200, 64, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,112,143, 79, 62, 13, 36,220, 62,207,171,119, 62,168,124,  0, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,228, 81, 34, 62,178, 55, 39,192, 87, 36, 68, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+232, 65, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,144, 72,244, 61,152, 98,173, 61, 16,243,154, 62, 38,162,252, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,226,206,132,191,153,157,254,191, 61, 78, 57, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+  8, 67, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 49,138, 35, 62,237,209, 85, 62,126, 75,186, 62,113,  6,137, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,228,163,237, 62, 55, 20, 58,192,  9,122, 64, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 40, 68, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,187,215,163, 61, 90,207, 92, 61,188,248,152, 62,182, 59, 17, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,202, 59,148,191,188,242, 56,191,189,111,113, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 72, 69, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 42,204,169, 62,204,195,154, 62,146,225, 51, 62,125,254, 66, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 34,179,252,191, 86,102,184,191,169,174, 51, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+104, 70, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 46,210, 21, 62,250, 32,186, 62,195,126,178, 62, 85,238, 16, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,  1,244, 77,192, 51, 52,163,190, 30,234, 62, 64,190, 81, 55,191,
+109,243, 71,191, 98,237, 42, 63,236,163,214, 62,197,206,183,190,202,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+136, 71, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 89,246,198, 61, 30,130, 46, 63,223,241, 54, 62,221, 41, 46, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,255, 27,122, 63,179,229,133,191, 66, 39,149, 64,190, 81, 55,191,
+107,243, 71,191,102,237, 42, 63,235,163,214, 62,200,206,183,190,205,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+168, 72, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,216,  4,239, 62,235,100, 21, 61,174, 73, 20, 61, 83,197,235, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 20, 66,151,191,208,139, 62,192, 98,118,  5, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+200, 73, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,212,101,120, 61, 72, 26,221, 61,158, 82, 22, 63,241, 14,122, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,224, 63, 46,190,222,105,107,191,198,191,132, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,201,206,183,190,200,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+232, 74, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 89,238,204, 62, 10, 90, 39, 62,123,156,  6, 62, 98, 22,156, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,250,148,234,190, 11,179, 97,192, 16,215,  3, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+  8, 76, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,251, 26,119, 60, 34,207,150, 60,170,176, 20, 63,225,120,197, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,202,177,135,191,150,220, 86,192,144,  9,239, 63,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 40, 77, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 87,169,  5, 61,120,116, 92, 61,179,253, 38, 63,225,192,133, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,213,105,108,192,125,145,223, 62,192,182, 82, 64,190, 81, 55,191,
+107,243, 71,191, 98,237, 42, 63,235,163,214, 62,198,206,183,190,206,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 72, 78, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,206, 82,204, 61, 44,113, 89, 63, 63, 63, 23, 61,220, 33,100, 60,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 76, 23,243, 62, 46,133,166,191, 78,153,134, 64,192, 81, 55,191,
+109,243, 71,191, 98,237, 42, 63,234,163,214, 62,197,206,183,190,202,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+104, 79, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,159,  2,190, 62, 29,141,193, 61,214, 93,214, 61,164,  2,220, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,130,192,214,190,182, 57, 73,192,175, 83, 23, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+136, 80, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,211,103, 84, 61, 92,194,115, 61,148,216,253, 62, 41, 34,201, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,122,  4,133,192,109,136,128, 62,136, 58, 58, 64,190, 81, 55,191,
+107,243, 71,191, 98,237, 42, 63,235,163,214, 62,198,206,183,190,206,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+168, 81, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 70, 80,156, 58,142,100,108, 63, 15, 72,153, 61,116, 35, 17, 58,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,132, 40, 12, 62,102, 32,  1,192,222,178, 95, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+200, 82, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,223,196, 88, 62,134, 94,237, 61,141,  5, 97, 62, 43,195,231, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,211,109, 80, 63, 96,210, 20,192,246,253,103, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+232, 83, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 69,196, 53, 62,136,184,135, 61,240,250, 35, 62, 34,153, 24, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,240,142,147,191, 43,  7,166,190, 61, 69,130, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+  8, 85, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 56,243,206, 62,109,170,159, 62,224,145,  2, 62,211, 50, 32, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,  2,254, 89,191,195,197, 85,192,176,197,254, 63,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 40, 86, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,111,  3, 11, 61,241,  2, 76, 61,231,181, 28, 63,103,179,155, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 24, 46,253,191,200,126,214, 61,248,  1,125, 64,190, 81, 55,191,
+109,243, 71,191, 98,237, 42, 63,236,163,214, 62,197,206,183,190,202,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 72, 87, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 18,251,181, 62,225,163,242, 62, 90, 98,191, 61,220, 33,158, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,115, 18, 94,192,112, 61, 49, 61, 90,153, 71, 64,190, 81, 55,191,
+109,243, 71,191, 98,237, 42, 63,236,163,214, 62,197,206,183,190,202,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+104, 88, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,141,188,190, 61,118,157, 68, 63,105,119,224, 61,112,129,239, 60,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 38, 34,141,191,222,140, 39,192,182, 55, 25, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+136, 89, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,122,  6,189, 61, 58,195, 23, 62,  6,114,254, 62,189,106,134, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,149, 14, 63,192, 64,204,165,191, 12, 96, 24, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+168, 90, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 14, 67, 83, 61,192,186,  4, 63, 39,206,197, 62,178,159, 50, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,183,180, 22,192,126,173,  4,192,240,189,  8, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+200, 91, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,133, 49,131, 61,130, 33,167, 62,160,225,  5, 63,124, 59,177, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 35,160, 97, 63,129,220,163,191,194,248,141, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+232, 92, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 78,174,206, 62, 68,159, 93, 61,160, 84,118, 61, 54,211,246, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,  4,223, 18,192,155,169,140,191,151, 18, 57, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+  8, 94, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,245, 96, 21, 62, 35,104,227, 62, 83, 62,154, 62, 64,164,222, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,100,193,179,191,251,111, 78,192,166, 64,228, 63,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 40, 95, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 37,242, 35, 61,204,214,171, 61,175, 25, 46, 63, 82,177, 72, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 93, 90,124,191,113, 48,212,191, 56,208, 74, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+ 72, 96, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,187,178, 81, 62,176, 57,108, 62, 93,177,153, 62,108, 88,135, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,251,231, 33,192,132,  2, 59,191, 78,162, 66, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+104, 97, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,217, 15, 30, 62,227,209,  4, 63,178,148,117, 62,218, 39,178, 61,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,  2,185,138, 63,191,128, 41,192,139,193, 97, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+136, 98, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,  0,196,250, 61, 79,120, 62, 61,195, 12, 31, 62,202,252, 44, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,242, 63,243,190, 86,176,159,191,245,150,111, 64,190, 81, 55,191,
+109,243, 71,191,100,237, 42, 63,234,163,214, 62,200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+168, 99, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255,217, 77,158, 62, 43,131, 72, 62,119,208, 68, 62, 86,  8,155, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,198,178, 48,191,138, 39, 52, 62, 39,252,149, 64,190, 81, 55,191,
+107,243, 71,191,100,237, 42, 63,235,163,214, 62,198,206,183,190,203,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,
+200,100, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,255,255,255,255, 62, 71, 19, 63,111,215,107, 62, 63, 71,138, 61,243,231,  1, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  1,  0, 68, 65, 84, 65,216,  0,  0,  0, 40,189, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 84,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,255,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,136,127, 35,188, 15, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188, 31,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+203, 20,227,188, 15,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 15, 62, 14, 62,
+165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 59,138, 94,189,151,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 31,224,124, 62,143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0, 72,190, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+136,127, 35,188,255, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 15,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,203, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,152,127, 35,189, 15, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 59,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 27,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104,191, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 85,145,186, 63,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,191,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,168,127, 35,188,239, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188,251,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+235, 20,227,188,  3,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  7, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 59,138, 94,189,142,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 23,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,136,192, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 82,145,186,255,223,124, 59, 56,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 84,145,187,255,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+  8,127, 35,188,255, 61, 14, 61,218,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,199, 84,145,188, 15,224,124, 61,
+123,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,171, 20,227,188, 15,143,197, 61, 80,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,136,127, 35,189, 15, 62, 14, 62,163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 43,138, 94,189,151,155, 65, 62,182,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,255, 84,145,189, 31,224,124, 62,
+139, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168,193, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 85,145,186,127,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,191,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,168,127, 35,188,243, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 15, 85,145,188,251,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+235, 20,227,188,  5,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,180,127, 35,189,  8, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 59,138, 94,189,142,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 11, 85,145,189, 23,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,200,194, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 82,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 84,145,187,223,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+200,126, 35,188,247, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,135, 84,145,188,  7,224,124, 61,
+125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,107, 20,227,188, 11,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,104,127, 35,189, 11, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+251,137, 94,189,145,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,231, 84,145,189, 27,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232,195, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 84,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,
+188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,136,127, 35,188,255, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188, 15,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+235, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189, 11, 62, 14, 62,
+165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 75,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 27,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,  8,197, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,127,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,223,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+136,127, 35,188,247, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,251,223,124, 61,
+125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188,  5,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  8, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 75,138, 94,189,142,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189, 23,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40,198, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 86,145,186,255,223,124, 59, 59,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187, 15,224,124, 60,
+188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,128, 35,188,  7, 62, 14, 61,221,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188, 23,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+ 43, 21,227,188, 18,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189, 15, 62, 14, 62,
+165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 91,138, 94,189,152,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189, 34,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0, 72,199, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,135, 84,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,223, 84,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+132,127, 35,188,  3, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,252, 84,145,188, 19,224,124, 61,
+127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,207, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,169,127, 35,189, 13, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 50,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,  7, 85,145,189, 31,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104,200, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 84,145,186,143,223,124, 59, 56,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,223,223,124, 60,
+186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188,250, 61, 14, 61,218,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,  4,224,124, 61,124,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+235, 20,227,188, 11,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 11, 62, 14, 62,
+163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 43,138, 94,189,146,155, 65, 62,183,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0,255, 84,145,189, 26,224,124, 62,140, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,136,201, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 87,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,199, 85,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+  8,128, 35,188,255, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188,255,223,124, 61,
+125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 11, 21,227,188, 11,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,192,127, 35,189, 11, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 75,138, 94,189,145,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 25,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168,202, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 86,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,191,223,124, 60,
+188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188,239, 61, 14, 61,221,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188,239,223,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+235, 20,227,188,255,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  3, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 75,138, 94,189,135,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 17,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,200,203, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0, 71, 84,145,186,239,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,199, 84,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+120,127, 35,188,  2, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,247, 84,145,188, 17,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,203, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,165,127, 35,189, 13, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 48,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,  7, 85,145,189, 28,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232,204, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 86,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,255,223,124, 60,
+188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,128, 35,188,255, 61, 14, 61,221,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188, 15,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+ 43, 21,227,188,  7,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189,  7, 62, 14, 62,
+165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 91,138, 94,189,143,155, 65, 62,186,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189, 23,224,124, 62,143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,  8,206, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,135, 84,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,231, 84,145,187,255,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+136,127, 35,188,  3, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,255, 84,145,188, 17,224,124, 61,
+125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,211, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 13, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 53,138, 94,189,148,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 10, 85,145,189, 29,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40,207, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 86,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,255,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,128, 35,188,255, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188,255,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+ 43, 21,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189,  7, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 83,138, 94,189,143,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 27, 85,145,189, 23,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0, 72,208, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+168,127, 35,188, 15, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 15,224,124, 61,
+127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,219, 20,227,188, 23,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 11, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 67,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 19, 85,145,189, 27,224,124, 62,
+143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104,209, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 84,145,186,127,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,191,223,124, 60,
+188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188,239, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,247,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+235, 20,227,188,255,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  5, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 59,138, 94,189,138,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 19,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,136,210, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 59,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+  8,128, 35,188,255, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188, 15,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 11, 21,227,188,  7,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189, 11, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 83,138, 94,189,143,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 27, 85,145,189, 23,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168,211, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 85,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0, 71, 85,145,187,223,223,124, 60,
+189, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188,247, 61, 14, 61,221,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188,  7,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+235, 20,227,188, 11,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189, 11, 62, 14, 62,
+165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 59,138, 94,189,145,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 27,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,200,212, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,127,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,223,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+168,127, 35,188,247, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,  7,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,203, 20,227,188, 11,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 13, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 43,138, 94,189,145,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 11, 85,145,189, 25,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232,213, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+135, 84,145,186, 63,224,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,231, 84,145,187, 55,224,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,152,127, 35,188, 17, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,255, 84,145,188, 30,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+203, 20,227,188, 24,143,197, 61, 80,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,164,127, 35,189, 18, 62, 14, 62,
+163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 55,138, 94,189,155,155, 65, 62,183,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0,  9, 85,145,189, 36,224,124, 62,140, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,  8,215, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+168,127, 35,188,239, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188,255,223,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188,255,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  7, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 67,138, 94,189,139,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 19,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40,216, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 84,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,
+186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188,255, 61, 14, 61,218,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188, 15,224,124, 61,124,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+ 11, 21,227,188, 15,143,197, 61, 80,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189, 15, 62, 14, 62,
+163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 91,138, 94,189,151,155, 65, 62,182,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189, 31,224,124, 62,139, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0, 72,217, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0, 71, 85,145,187,255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+200,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188, 23,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188, 19,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189, 15, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 59,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 27,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104,218, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 84,145,186,191,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,247,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0, 72,127, 35,188,  0, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188, 14,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+171, 20,227,188, 13,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,152,127, 35,189, 13, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 27,138, 94,189,147,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0,251, 84,145,189, 27,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,136,219, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,127,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0, 39, 85,145,187,223,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+184,127, 35,188,247, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 31, 85,145,188,255,223,124, 61,
+125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,243, 20,227,188,  3,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,188,127, 35,189,  7, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 67,138, 94,189,141,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 17, 85,145,189, 22,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168,220, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 85,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,168,127, 35,188,255, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+219, 20,227,188,  7,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189, 11, 62, 14, 62,
+165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 67,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 27,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,200,221, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0, 71, 84,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,199, 84,145,187,255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+136,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,255, 84,145,188, 23,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,211, 20,227,188, 19,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,170,127, 35,189, 15, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 56,138, 94,189,147,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 13, 85,145,189, 25,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232,222, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 84,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 84,145,187, 63,224,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0, 72,127, 35,188, 15, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,199, 84,145,188, 15,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+171, 20,227,188,  7,143,197, 61, 80,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,152,127, 35,189, 11, 62, 14, 62,
+163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 27,138, 94,189,147,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0,255, 84,145,189, 19,224,124, 62,140, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,  8,224, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 59,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+  8,128, 35,188,255, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,103, 85,145,188,255,223,124, 61,
+127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 75, 21,227,188,  7,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,216,127, 35,189,  7, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 91,138, 94,189,143,155, 65, 62,186,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189, 23,224,124, 62,
+143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40,225, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 86,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187, 31,224,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,128, 35,188, 15, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188, 23,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+ 43, 21,227,188, 27,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189, 19, 62, 14, 62,
+165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 91,138, 94,189,155,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189, 35,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0, 72,226, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+104,127, 35,188,255, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188, 15,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,187, 20,227,188,  7,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,152,127, 35,189, 11, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 35,138, 94,189,143,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,255, 84,145,189, 23,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104,227, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 84,145,186,255,223,124, 59, 59,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,
+188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188,255, 61, 14, 61,221,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188, 15,224,124, 61,128,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+ 11, 21,227,188, 15,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189, 13, 62, 14, 62,
+165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 75,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 29,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,136,228, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187, 31,224,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+136,127, 35,188,  7, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188, 23,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,203, 20,227,188, 19,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 13, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 75,138, 94,189,149,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 33,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168,229, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+135, 84,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,215, 84,145,187,255,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,144,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,251, 84,145,188, 15,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+207, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,166,127, 35,189, 13, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 45,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0,  8, 85,145,189, 27,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,200,230, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+200,127, 35,188,239, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188,255,223,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 11, 21,227,188,255,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189,  7, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 91,138, 94,189,139,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189, 15,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232,231, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 85,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,
+188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,168,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188, 15,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+219, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189, 13, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 51,138, 94,189,145,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 29,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,  8,233, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+200,127, 35,188,255, 61, 14, 61,221,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188, 15,224,124, 61,
+127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 11, 21,227,188,  7,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189, 11, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 75,138, 94,189,143,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 23,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40,234, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 82,145,186,255,223,124, 59, 59,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 83,145,187,191,223,124, 60,
+188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,126, 35,188,239, 61, 14, 61,221,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,135, 84,145,188,255,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+ 75, 20,227,188,255,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0, 88,127, 35,189,255, 61, 14, 62,
+165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,219,137, 94,189,135,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0,223, 84,145,189, 15,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0, 72,235, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+168,127, 35,188,239, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188,255,223,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188,255,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  3, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 67,138, 94,189,137,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 11, 85,145,189, 15,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104,236, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 86,145,186,127,223,124, 59, 56,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,223,223,124, 60,
+186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188,251, 61, 14, 61,218,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,  3,224,124, 61,124,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+235, 20,227,188,  8,143,197, 61, 80,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 10, 62, 14, 62,
+163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 27,138, 94,189,143,155, 65, 62,183,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0,247, 84,145,189, 24,224,124, 62,140, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,136,237, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,224,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187, 63,224,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+  8,128, 35,188, 15, 62, 14, 61,221,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188, 31,224,124, 61,
+127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 11, 21,227,188, 27,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,216,127, 35,189, 23, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 91,138, 94,189,157,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189, 37,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168,238, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 87,145,186, 15,224,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187, 19,224,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,232,127, 35,188, 12, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188, 28,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+ 11, 21,227,188, 25,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189, 19, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 91,138, 94,189,155,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189, 35,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,200,239, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186, 63,224,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+168,127, 35,188,  3, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 19,224,124, 61,
+127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,219, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 13, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 51,138, 94,189,148,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 11, 85,145,189, 29,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232,240, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 86,145,186, 33,224,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187, 29,224,124, 60,
+188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,128, 35,188, 11, 62, 14, 61,221,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188, 24,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+ 43, 21,227,188, 24,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189, 18, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 91,138, 94,189,157,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189, 37,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,  8,242, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0, 71, 85,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+200,127, 35,188,255, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188, 15,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188, 15,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189, 11, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 75,138, 94,189,143,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 27, 85,145,189, 23,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40,243, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 82,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 84,145,187,255,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,127, 35,188,  7, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,167, 84,145,188, 15,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+139, 20,227,188, 15,143,197, 61, 80,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,136,127, 35,189, 11, 62, 14, 62,
+163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 11,138, 94,189,143,155, 65, 62,183,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0,247, 84,145,189, 23,224,124, 62,140, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0, 72,244, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,135, 84,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,215, 84,145,187,191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+152,127, 35,188,255, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,255, 84,145,188, 15,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,223, 20,227,188, 15,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,174,127, 35,189, 11, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 57,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 12, 85,145,189, 27,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104,245, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 86,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,
+188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188,255, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 15,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+235, 20,227,188, 15,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189, 15, 62, 14, 62,
+165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 75,138, 94,189,147,155, 65, 62,186,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 31,224,124, 62,143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,136,246, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,191,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187, 15,224,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+  8,128, 35,188,  7, 62, 14, 61,221,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188, 23,224,124, 61,
+127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 11, 21,227,188, 17,143,197, 61, 83,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189, 14, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 91,138, 94,189,146,155, 65, 62,186,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 26,224,124, 62,
+143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168,247, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 86,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,255,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188,239, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188,255,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+ 11, 21,227,188,  7,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  7, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 75,138, 94,189,139,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189, 19,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,200,248, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,127,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0, 71, 85,145,187,191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+168,127, 35,188,239, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188,255,223,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,251, 20,227,188,  3,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,192,127, 35,189,  6, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 67,138, 94,189,140,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 19, 85,145,189, 21,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232,249, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 84,145,186,127,223,124, 59, 56,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,223,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,136,127, 35,188,247, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188,255,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+235, 20,227,188,  7,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  7, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 91,138, 94,189,141,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189, 23,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,  8,251, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+200,127, 35,188, 15, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188, 15,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189, 11, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 75,138, 94,189,143,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 23,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40,252, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 84,145,186,255,224,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187, 63,224,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0, 72,127, 35,188, 47, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188, 63,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+203, 20,227,188, 47,143,197, 61, 80,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 27, 62, 14, 62,
+163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 43,138, 94,189,167,155, 65, 62,183,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0,255, 84,145,189, 51,224,124, 62,139, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0, 72,253, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,135, 84,145,186, 31,224,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,199, 84,145,187, 31,224,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+152,127, 35,188, 16, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 31,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,215, 20,227,188, 22,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,172,127, 35,189, 17, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 53,138, 94,189,151,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,  9, 85,145,189, 32,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104,254, 25,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 85,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,199, 84,145,187,255,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,136,127, 35,188,255, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,247, 84,145,188,255,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+219, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189,  7, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 59,138, 94,189,143,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 23,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,136,255, 25,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,191,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+104,127, 35,188,239, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188,247,223,124, 61,
+125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,171, 20,227,188,  3,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,152,127, 35,189,  7, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 35,138, 94,189,145,155, 65, 62,183,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,255, 84,145,189, 26,224,124, 62,
+140, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168,  0, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 84,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188,255, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+235, 20,227,188,  7,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  7, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 75,138, 94,189,143,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 23,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,200,  1, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,191, 84,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,229, 84,145,187,191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+154,127, 35,188,255, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,255,223,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,232, 20,227,188,  7,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,182,127, 35,189,  7, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 65,138, 94,189,139,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 16, 85,145,189, 19,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232,  2, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 84,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,199, 84,145,187, 31,224,124, 60,
+188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,168,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,247, 84,145,188, 15,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+219, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 13, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 51,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0,  7, 85,145,189, 31,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,  8,  4, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,224,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187, 63,224,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+ 72,127, 35,188, 47, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188, 47,224,124, 61,
+125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,171, 20,227,188, 47,143,197, 61, 80,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,152,127, 35,189, 27, 62, 14, 62,163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 27,138, 94,189,167,155, 65, 62,183,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,247, 84,145,189, 49,224,124, 62,
+139, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40,  5, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 84,145,186,255,223,124, 59, 56,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 84,145,187,191,223,124, 60,
+186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,127, 35,188,239, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,167, 84,145,188,255,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+107, 20,227,188, 11,143,197, 61, 80,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,104,127, 35,189,  9, 62, 14, 62,
+163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,251,137, 94,189,143,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0,239, 84,145,189, 23,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0, 72,  6, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 56,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+ 72,127, 35,188, 15, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188, 15,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,171, 20,227,188, 31,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,152,127, 35,189, 15, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 11,138, 94,189,159,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,247, 84,145,189, 39,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104,  7, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 85,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,
+186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188,255, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188,255,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+235, 20,227,188,  7,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,192,127, 35,189,  7, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 67,138, 94,189,139,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 19, 85,145,189, 19,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,136,  8, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,127,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+136,127, 35,188,239, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,247,223,124, 61,
+125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188,255,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189,  5, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 59,138, 94,189,138,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 19,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168,  9, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 84,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,255,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,136,127, 35,188,255, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188, 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+203, 20,227,188,  7,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 11, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 59,138, 94,189,147,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 27,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,200, 10, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,135, 84,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,231, 84,145,187, 15,224,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+136,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,247, 84,145,188, 19,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,203, 20,227,188, 17,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,164,127, 35,189, 14, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 51,138, 94,189,148,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,  7, 85,145,189, 30,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232, 11, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 83,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0, 71, 84,145,187,191,223,124, 60,
+186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0, 40,127, 35,188,223, 61, 14, 61,218,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,199, 84,145,188,239,223,124, 61,124,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+155, 20,227,188,255,142,197, 61, 80,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,128,127, 35,189,255, 61, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 11,138, 94,189,131,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0,243, 84,145,189, 15,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,  8, 13, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,191,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+ 72,127, 35,188,239, 61, 14, 61,218,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,199, 84,145,188,255,223,124, 61,
+124,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,139, 20,227,188,247,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,120,127, 35,189,255, 61, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+251,137, 94,189,131,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,239, 84,145,189, 11,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40, 14, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 86,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,255,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188, 15, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188, 31,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+ 11, 21,227,188, 23,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189, 15, 62, 14, 62,
+165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 91,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 39, 85,145,189, 27,224,124, 62,143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0, 72, 15, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,222,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,191,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+  8,128, 35,188,239, 61, 14, 61,221,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,103, 85,145,188,255,223,124, 61,
+127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 43, 21,227,188,255,142,197, 61, 82,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189,  3, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 75,138, 94,189,135,155, 65, 62,186,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 19,224,124, 62,
+143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104, 16, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 86,145,186,255,223,124, 59, 59,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188, 15, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188, 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+ 11, 21,227,188, 15,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189, 15, 62, 14, 62,
+165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 91,138, 94,189,151,155, 65, 62,186,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189, 27,224,124, 62,143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,136, 17, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,127,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,199, 84,145,187,191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+136,127, 35,188,231, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,215, 84,145,188,231,223,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,171, 20,227,188,247,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,152,127, 35,189,  1, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 27,138, 94,189,135,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,251, 84,145,189, 15,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168, 18, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 83,145,186,191,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,239,223,124, 60,
+186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,104,127, 35,188,  3, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188, 15,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+187, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,152,127, 35,189, 11, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 35,138, 94,189,145,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0,255, 84,145,189, 25,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,200, 19, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186, 63,224,124, 59, 56,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187, 47,224,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+136,127, 35,188, 15, 62, 14, 61,218,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 29,224,124, 61,
+125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188, 24,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 17, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 59,138, 94,189,155,155, 65, 62,183,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,  7, 85,145,189, 35,224,124, 62,
+140, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232, 20, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 86,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,255,223,124, 60,
+188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,128, 35,188,  7, 62, 14, 61,221,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188, 23,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+ 43, 21,227,188, 23,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,216,127, 35,189, 15, 62, 14, 62,
+166,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 91,138, 94,189,150,155, 65, 62,186,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189, 30,224,124, 62,143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,  8, 22, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187, 15,224,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+200,127, 35,188, 11, 62, 14, 61,221,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 23,224,124, 61,
+127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188, 19,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189, 17, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 75,138, 94,189,151,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 33,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40, 23, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 86,145,186,191,223,124, 59, 59,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187, 15,224,124, 60,
+188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,128, 35,188,  7, 62, 14, 61,221,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188, 19,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+235, 20,227,188, 17,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189, 14, 62, 14, 62,
+165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 75,138, 94,189,151,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 34,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0, 72, 24, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,103, 84,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,191, 84,145,187, 63,224,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+144,127, 35,188, 15, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  3, 85,145,188, 15,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,223, 20,227,188,  7,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,174,127, 35,189, 11, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 63,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 27,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104, 25, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 86,145,186,191,223,124, 59, 59,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,  3,224,124, 60,
+188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,128, 35,188,  4, 62, 14, 61,221,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188, 18,224,124, 61,128,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+ 43, 21,227,188, 15,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189, 14, 62, 14, 62,
+165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 91,138, 94,189,149,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 26,224,124, 62,143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,136, 26, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,199, 84,145,187,191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+136,127, 35,188,239, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,247, 84,145,188,247,223,124, 61,
+125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,203, 20,227,188,  3,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,160,127, 35,189,  7, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 51,138, 94,189,145,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,  7, 85,145,189, 25,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168, 27, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 87,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,199, 85,145,187,255,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0, 40,128, 35,188, 15, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188, 31,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+ 27, 21,227,188, 31,143,197, 61, 80,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,208,127, 35,189, 27, 62, 14, 62,
+163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 91,138, 94,189,163,155, 65, 62,183,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 27, 85,145,189, 43,224,124, 62,140, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,200, 28, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 59,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+  8,128, 35,188,  7, 62, 14, 61,221,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188, 15,224,124, 61,
+127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188, 19,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189, 13, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 75,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 27,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232, 29, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 86,145,186,127,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,207,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,128, 35,188,244, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188,254,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+ 11, 21,227,188,  5,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  9, 62, 14, 62,
+165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 75,138, 94,189,143,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 25,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,  8, 31, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,241,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+168,127, 35,188,253, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188, 11,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,219, 20,227,188, 13,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189, 12, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 59,138, 94,189,146,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 11, 85,145,189, 27,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40, 32, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+199, 84,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,247, 84,145,187,255,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,160,127, 35,188,255, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 11, 85,145,188,255,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+231, 20,227,188, 15,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,178,127, 35,189,  7, 62, 14, 62,
+165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 61,138, 94,189,143,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 14, 85,145,189, 23,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0, 72, 33, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+136,127, 35,188,239, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,239,223,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,203, 20,227,188,255,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  3, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 75,138, 94,189,137,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 17,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104, 34, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+135, 84,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,215, 84,145,187,255,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,140,127, 35,188, 15, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,251, 84,145,188, 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+219, 20,227,188, 15,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,178,127, 35,189, 15, 62, 14, 62,
+165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 61,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 27,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,136, 35, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186, 13,224,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187, 31,224,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+168,127, 35,188,  9, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188, 22,224,124, 61,
+127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188, 16,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189, 14, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 59,138, 94,189,148,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 30,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168, 36, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+199, 84,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,231, 84,145,187,159,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,144,127, 35,188,231, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,239,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+217, 20,227,188,255,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,175,127, 35,189,  5, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 56,138, 94,189,140,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 11, 85,145,189, 21,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,200, 37, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,224,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187, 63,224,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+ 72,128, 35,188, 31, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,103, 85,145,188, 47,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 75, 21,227,188, 39,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,248,127, 35,189, 27, 62, 14, 62,163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+139,138, 94,189,163,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 55, 85,145,189, 43,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232, 38, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 85,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,199, 84,145,187,255,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,152,127, 35,188,239, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+219, 20,227,188,  7,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189, 11, 62, 14, 62,
+165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 59,138, 94,189,139,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 19,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,  8, 40, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 56,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0, 71, 84,145,187,191,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+ 72,127, 35,188,239, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188,255,223,124, 61,
+125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,187, 20,227,188,255,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,152,127, 35,189,  3, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 35,138, 94,189,139,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,255, 84,145,189, 19,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40, 41, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 85,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0, 71, 85,145,187,255,223,124, 60,
+186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188,239, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188,255,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+251, 20,227,188,  7,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  7, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 67,138, 94,189,139,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 19, 85,145,189, 19,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0, 72, 42, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,199, 84,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,231, 84,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+152,127, 35,188, 15, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  3, 85,145,188, 15,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,180,127, 35,189, 11, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 63,138, 94,189,147,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 27,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104, 43, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 86,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0, 39, 85,145,187, 31,224,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,168,127, 35,188, 15, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,255, 84,145,188, 39,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+227, 20,227,188, 33,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189, 24, 62, 14, 62,
+165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 67,138, 94,189,162,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 17, 85,145,189, 45,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,136, 44, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,199, 84,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+136,127, 35,188,255, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 15,224,124, 61,
+125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,219, 20,227,188,  7,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189, 11, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 59,138, 94,189,143,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 19,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168, 45, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+135, 84,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,231, 84,145,187,255,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,152,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,255, 84,145,188, 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+219, 20,227,188, 15,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 15, 62, 14, 62,
+165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 51,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0,  9, 85,145,189, 27,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,200, 46, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 82,145,186,223,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 84,145,187,235,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+200,126, 35,188,251, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,167, 84,145,188,  9,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,107, 20,227,188, 11,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,120,127, 35,189, 11, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+251,137, 94,189,145,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,239, 84,145,189, 28,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232, 47, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 85,145,186,255,222,124, 59, 56,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0, 39, 85,145,187,191,223,124, 60,
+186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,168,127, 35,188,239, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188,255,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+  3, 21,227,188,  7,143,197, 61, 80,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,196,127, 35,189,  7, 62, 14, 62,
+163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 87,138, 94,189,143,155, 65, 62,183,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 29, 85,145,189, 23,224,124, 62,140, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,  8, 49, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,191,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 84,145,187,223,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+ 72,127, 35,188,251, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,199, 84,145,188, 11,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,155, 20,227,188, 13,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,136,127, 35,189, 12, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 19,138, 94,189,144,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,247, 84,145,189, 24,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40, 50, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 86,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187, 31,224,124, 60,
+188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,128, 35,188,  7, 62, 14, 61,221,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188, 15,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+ 11, 21,227,188, 11,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189, 11, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 91,138, 94,189,143,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189, 23,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0, 72, 51, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,239,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+168,127, 35,188,  3, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 15,224,124, 61,
+127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,219, 20,227,188, 17,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 13, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 59,138, 94,189,149,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 29,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104, 52, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+135, 86,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,103, 85,145,187,255,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,248,127, 35,188,255, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 55, 85,145,188, 15,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+ 35, 21,227,188, 15,143,197, 61, 80,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,220,127, 35,189, 15, 62, 14, 62,
+162,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,107,138, 94,189,151,155, 65, 62,182,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 37, 85,145,189, 31,224,124, 62,139, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,136, 53, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,135, 86,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,103, 85,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+184,127, 35,188, 15, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 31,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188, 31,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,180,127, 35,189, 23, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 71,138, 94,189,159,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 18, 85,145,189, 43,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168, 54, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 85,145,186,255,222,124, 59, 56,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0, 39, 85,145,187,255,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,168,127, 35,188, 15, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 15, 85,145,188, 15,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+243, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189, 11, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 83,138, 94,189,151,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 25, 85,145,189, 27,224,124, 62,140, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,200, 55, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,222,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,191,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+  8,128, 35,188,239, 61, 14, 61,221,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188,255,223,124, 61,
+127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 75, 21,227,188,  7,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,216,127, 35,189,  7, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+107,138, 94,189,143,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189, 23,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232, 56, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 85,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187, 63,224,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,168,127, 35,188, 15, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 31,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+219, 20,227,188, 23,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189, 15, 62, 14, 62,
+165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 67,138, 94,189,151,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 19, 85,145,189, 31,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,  8, 58, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0, 71, 85,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+200,127, 35,188,255, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188, 15,224,124, 61,
+127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188, 15,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189, 15, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 59,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 19, 85,145,189, 31,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40, 59, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 86,145,186,143,223,124, 59, 56,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,223,223,124, 60,
+186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188,251, 61, 14, 61,218,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188,  2,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+235, 20,227,188, 11,143,197, 61, 80,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 11, 62, 14, 62,
+163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 43,138, 94,189,145,155, 65, 62,183,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0,  7, 85,145,189, 27,224,124, 62,139, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0, 72, 60, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+168,127, 35,188, 15, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188, 15,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188,  7,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189, 11, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 67,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 19, 85,145,189, 27,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104, 61, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 85,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,231, 84,145,187,191,223,124, 60,
+188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,152,127, 35,188,239, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 15, 85,145,188,255,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+235, 20,227,188,255,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  7, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 75,138, 94,189,143,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 19, 85,145,189, 23,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,136, 62, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,191,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+  8,127, 35,188,239, 61, 14, 61,218,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,199, 84,145,188,239,223,124, 61,
+124,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,139, 20,227,188,247,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,120,127, 35,189,251, 61, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 11,138, 94,189,131,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,239, 84,145,189, 11,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168, 63, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 85,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0, 39, 85,145,187,191,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,176,127, 35,188,239, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 19, 85,145,188,239,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+231, 20,227,188,255,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,179,127, 35,189,  5, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 65,138, 94,189,139,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 16, 85,145,189, 21,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,200, 64, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,199, 84,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+104,127, 35,188,255, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,239, 84,145,188, 15,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,203, 20,227,188, 11,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,164,127, 35,189, 11, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 51,138, 94,189,145,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 11, 85,145,189, 25,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232, 65, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 86,145,186,127,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,207,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188,243, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188,251,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+235, 20,227,188,  3,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  7, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 75,138, 94,189,141,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 23,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,  8, 67, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+168,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 15,224,124, 61,
+127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,219, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 13, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 51,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 11, 85,145,189, 27,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40, 68, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 84,145,186,127,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,223,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188,247, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,255,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+235, 20,227,188,  3,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  6, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 75,138, 94,189,141,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 22,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0, 72, 69, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 59,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0, 71, 85,145,187, 13,224,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+168,127, 35,188,  5, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 19,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,227, 20,227,188, 17,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189, 14, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 59,138, 94,189,149,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 13, 85,145,189, 31,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104, 70, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+151, 84,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,219, 84,145,187,255,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,140,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,249, 84,145,188, 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+205, 20,227,188, 15,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 15, 62, 14, 62,
+165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 51,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 10, 85,145,189, 27,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,136, 71, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+  8,128, 35,188,255, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188, 15,224,124, 61,
+125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 11, 21,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189,  7, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 91,138, 94,189,143,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 27, 85,145,189, 23,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168, 72, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+175, 84,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,224, 84,145,187,191,223,124, 60,
+188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,142,127, 35,188,239, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,  1, 85,145,188,239,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+207, 20,227,188,255,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,164,127, 35,189,  3, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 42,138, 94,189,135,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0,  4, 85,145,189, 15,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,200, 73, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187, 31,224,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+200,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188, 23,224,124, 61,
+127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188, 19,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 15, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 59,138, 94,189,147,155, 65, 62,186,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 31,224,124, 62,
+143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232, 74, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 85,145,186,127,223,124, 59, 56,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0, 39, 85,145,187,223,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,176,127, 35,188,239, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 19, 85,145,188,255,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+231, 20,227,188,  3,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,178,127, 35,189,  9, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 63,138, 94,189,143,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 24,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,  8, 76, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187, 31,224,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+136,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 15,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188, 19,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189, 15, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 75,138, 94,189,151,155, 65, 62,186,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 31,224,124, 62,
+143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40, 77, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 86,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,136,127, 35,188,  7, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+203, 20,227,188, 15,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189, 15, 62, 14, 62,
+165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 75,138, 94,189,151,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 31,224,124, 62,143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0, 72, 78, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 56,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,255,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+ 72,127, 35,188,255, 61, 14, 61,217,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188, 15,224,124, 61,
+123,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,203, 20,227,188, 15,143,197, 61, 80,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 11, 62, 14, 62,163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 59,138, 94,189,147,155, 65, 62,182,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,  7, 85,145,189, 27,224,124, 62,
+139, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104, 79, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+ 71, 85,145,186,255,223,124, 59, 56,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0, 39, 85,145,187,255,223,124, 60,
+186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,144,127, 35,188, 15, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,255, 84,145,188, 31,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+223, 20,227,188, 31,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189, 23, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 63,138, 94,189,161,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 14, 85,145,189, 43,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,136, 80, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187, 15,224,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+136,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188, 15,224,124, 61,
+127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,203, 20,227,188, 17,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 15, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 59,138, 94,189,150,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 30,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168, 81, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 84,145,186,255,223,124, 59, 56,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,255,223,124, 60,
+185, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0, 72,127, 35,188,255, 61, 14, 61,217,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188,255,223,124, 61,123,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+203, 20,227,188, 15,143,197, 61, 80,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,152,127, 35,189,  7, 62, 14, 62,
+163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 43,138, 94,189,143,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0,255, 84,145,189, 23,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,200, 82, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,127,223,124, 59, 56,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,223,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+168,127, 35,188,247, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188,255,223,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188,  3,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189,  7, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 59,138, 94,189,141,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 23,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232, 83, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 86,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,191,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188,239, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188,255,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+235, 20,227,188,  3,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  5, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 75,138, 94,189,139,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 21,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,  8, 85, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 59,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,255,223,124, 60,189, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+200,127, 35,188,  1, 62, 14, 61,221,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188, 16,224,124, 61,
+127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188, 15,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189, 13, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 67,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 30,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40, 86, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 86,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,223,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,136,127, 35,188,255, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,  7,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+203, 20,227,188, 11,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 11, 62, 14, 62,
+165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 59,138, 94,189,145,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 29,224,124, 62,143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0, 72, 87, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,191,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+  8,128, 35,188, 11, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188, 19,224,124, 61,
+127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 11, 21,227,188, 21,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189, 17, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 91,138, 94,189,153,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189, 33,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104, 88, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 86,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 86,145,187,255,223,124, 60,
+188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,128, 35,188,255, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188, 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+ 43, 21,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,216,127, 35,189, 11, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,107,138, 94,189,147,155, 65, 62,183,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 39, 85,145,189, 27,224,124, 62,140, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,136, 89, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+200,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 15,224,124, 61,
+127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,203, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 13, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 43,138, 94,189,147,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 31,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168, 90, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+135, 84,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,199, 84,145,187,255,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,136,127, 35,188,255, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,255, 84,145,188, 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+215, 20,227,188,  7,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,174,127, 35,189, 11, 62, 14, 62,
+165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 57,138, 94,189,143,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 13, 85,145,189, 23,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,200, 91, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,135, 84,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,231, 84,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+168,127, 35,188, 15, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 15, 85,145,188, 31,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,211, 20,227,188, 23,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 15, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 51,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 11, 85,145,189, 27,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232, 92, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 85,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,247, 84,145,187,191,223,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,152,127, 35,188,239, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 11, 85,145,188,255,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+227, 20,227,188,255,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,180,127, 35,189,  7, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 73,138, 94,189,143,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 20, 85,145,189, 23,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,  8, 94, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,135, 84,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,231, 84,145,187,255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+136,127, 35,188,255, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,255, 84,145,188, 15,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,211, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 15, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 55,138, 94,189,147,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 12, 85,145,189, 27,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40, 95, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 86,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187, 63,224,124, 60,
+187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188, 15, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 31,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+235, 20,227,188, 23,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189, 15, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 75,138, 94,189,151,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 35,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0, 72, 96, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,135, 84,145,186, 15,224,124, 59, 58,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,199, 84,145,187,251,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+152,127, 35,188,  8, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 22,224,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,219, 20,227,188, 17,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,172,127, 35,189, 15, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 51,138, 94,189,148,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,  9, 85,145,189, 30,224,124, 62,
+141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104, 97, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  7, 85,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,191,223,124, 60,
+188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,168,127, 35,188,255, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188, 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+219, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189, 11, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 67,138, 94,189,147,155, 65, 62,184,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0, 19, 85,145,189, 27,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,136, 98, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+136,127, 35,188,239, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,239,223,124, 61,
+126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,203, 20,227,188,255,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189,  3, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 59,138, 94,189,137,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 17,224,124, 62,
+142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168, 99, 26,  4,  0,  0,  0,  0,
+127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+111, 84,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,173, 84,145,187,255,223,124, 60,
+188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,116,127, 35,188,255, 61, 14, 61,221,123, 65, 63,  0,  0, 22, 66,
+  0,  0, 32, 63,  0,  0,  0,  0,245, 84,145,188, 15,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,
+199, 20,227,188, 13,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,163,127, 35,189, 13, 62, 14, 62,
+164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 47,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,
+  0,  0,  0, 62,  0,  0,  0,  0,  6, 85,145,189, 28,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,216,  0,  0,  0,200,100, 26,  4,  0,  0,  0,  0,127,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 82,145,186,127,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,
+  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,223,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,
+  8,127, 35,188,247, 61, 14, 61,218,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,199, 84,145,188,  7,224,124, 61,
+125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,139, 20,227,188,  7,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,
+  0,  0,192, 62,  0,  0,  0,  0,136,127, 35,189, 11, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,
+ 27,138, 94,189,147,155, 65, 62,183,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,247, 84,145,189, 28,224,124, 62,
+140, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  5,  0,  0,232,101, 26,  4,  0,  0,  0,  0,
+136,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,250,  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,  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,104,135, 53,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0,
- 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0,
- 10,  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,  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,216,127, 50,  3,  0,  0,  0,  0, 40,128, 50,  3,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0, 31, 10, 58,
- 59, 94,236, 63,236, 84,231, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 91,188,110, 63, 91,188,110, 63, 91,188,110, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,218, 15,201, 63,  0,  0,  0,128,
-  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 91,188,110, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 90, 50,151, 51, 91,188,110, 63,  0,  0,  0,  0,  0,  0,  0,  0, 91,188,110,191, 90, 50,151, 51,  0,  0,  0,  0,
-  0, 31, 10, 58, 59, 94,236, 63,236, 84,231, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  1,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,254,255,127, 63,226, 53, 25,179,  0,  0,  0,  0,  0,  0,  0,  0,167,120,247,166,  1,  0,128, 63,  0,  0,  0,  0,
-183,132, 39,174,239,106,181,179,116,226,155,179,  0,  0,128, 63,160, 65,137, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,160, 65,137, 63,157, 46, 19, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,152,176,161, 65,137, 63,  0,  0,  0,  0,
- 29, 80, 63,188, 62, 95,226,187, 87, 19, 74, 65,  0,  0,128, 63,160, 65,137, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,160, 65,137, 63,157, 46, 19, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,152,176,161, 65,137, 63,  0,  0,  0,  0,
- 29, 80, 63,188, 62, 95,226,187, 87, 19, 74, 65,  0,  0,128, 63, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  2,  0,
-  0,  0, 68,  0, 79, 66,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0,
- 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  1,  0,  5,  0,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  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,  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,128, 63,  0, 64,  1,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,
-  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, 25,  0,  0,  0,
-  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,  8,  0,  0,  0,216,127, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0, 40,128, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
- 79, 66,  0,  0, 32,  5,  0,  0,120,128, 50,  3,  0,  0,  0,  0,116,  0,  0,  0,  1,  0,  0,  0,232,133, 50,  3,  0,  0,  0,  0,
-104,122, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,112,114,101,118,105,101,
-119, 46, 48, 48, 53,  0, 48, 48, 51,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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, 10,  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,  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,  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, 72,212, 49,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,
-  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,155,195,189, 20,145,188, 64, 94,220, 88, 65,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,221,180,134, 63, 48,190,141, 37,253, 55, 57, 35,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,253, 55, 57, 35, 48,190,141,165,  0,  0,  0,  0,219,128,112, 37, 52,177,253, 62, 94, 93, 94, 63,
-  0,  0,  0,  0, 52,133, 22, 37, 94, 93, 94,191, 52,177,253, 62,  0,  0,  0,  0,128,155,195,189, 20,145,188, 64, 94,220, 88, 65,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,118, 42, 31, 25,242,108,131,153,  0,  0,  0,  0,  0,  0,  0,176,  0,  0,128, 63,210, 21, 66,178,
-  0,  0,  0,  0,  5,  0,  0,176, 25,245,158, 50,  1,  0,128, 63,  0,  0,  0,  0,  0,  0,  0, 50,118, 42,159, 11,242,108,  3,140,
-  0,  0,128, 63,  0,  0,128, 63,219,128,112, 37, 52,133, 22, 37,  0,  0,  0,  0,  0,  0,  0, 48, 94, 93, 94, 63, 52,177,253, 62,
-  0,  0,  0,  0,  0,  0,128,175, 50,177,253,190, 96, 93, 94, 63,  0,  0,  0,  0,149, 98,174, 61, 85,101,144,193,196,124,253, 64,
-  0,  0,128, 63,  0,  0,128, 63,219,128,112, 37, 52,133, 22, 37,  0,  0,  0,  0,  0,  0,  0, 48, 94, 93, 94, 63, 52,177,253, 62,
-  0,  0,  0,  0,  0,  0,128,175, 50,177,253,190, 96, 93, 94, 63,  0,  0,  0,  0,149, 98,174, 61, 85,101,144,193,196,124,253, 64,
-  0,  0,128, 63, 64,  0,  0,  0,  0, 16,  0,  0,  0,  0,  0,  0,  5,  0,  1,  0,  0,  0, 68,  0, 79, 66,  0,  0,  7,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,
-  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  1,  0,  5,  0,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  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,  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,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,  0,  0, 32,  5,  0,  0,
-232,133, 50,  3,  0,  0,  0,  0,116,  0,  0,  0,  1,  0,  0,  0,248,139, 50,  3,  0,  0,  0,  0,120,128, 50,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,112,114,101,118,105,101,119, 46, 48, 48, 54,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  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,  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,  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, 72,218, 55,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,
-  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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, 88,139, 50,  3,  0,  0,  0,  0,168,139, 50,  3,  0,  0,  0,  0,
-  1,  0,  0,  0,  1,  0,  0,  0, 94, 52,252,190,174,101,228, 65,141,116, 17, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,235,239, 30, 66,236,239, 30, 66,235,239, 30, 66,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,138,174, 95, 63, 98,132,123, 37, 61, 56, 87,165,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,235,239, 30, 66,
-105,158,  5,168,108, 39, 28,168,  0,  0,  0,  0,212,129, 77, 40, 66, 15,204, 65,158,186,243, 65,  0,  0,  0,  0, 55, 89, 13,165,
-156,186,243,193, 65, 15,204, 65,  0,  0,  0,  0, 94, 52,252,190,174,101,228, 65,141,116, 17, 65,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-151,169,232, 24,151,190,157, 25,  0,  0,  0,  0, 21, 24,149, 24,  0,  0,128, 63,109,157, 59,178,  0,  0,  0,  0,191,231, 64,153,
-  1,158,199,178,  1,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,101, 43,206, 60,
- 25, 74,  5, 35,141, 90,183,159,  0,  0,  0,  0, 42,143,202,162,100, 20,158, 60,192, 89,132, 60,  0,  0,  0,  0,187, 83,173, 34,
-192, 89,132,188,102, 20,158, 60,  0,  0,  0,  0, 11,215, 70, 60, 61, 43, 67,191,184,241, 31, 63,  0,  0,128, 63,101, 43,206, 60,
- 25, 74,  5, 35,141, 90,183,159,  0,  0,  0,  0, 42,143,202,162,100, 20,158, 60,192, 89,132, 60,  0,  0,  0,  0,187, 83,173, 34,
-192, 89,132,188,102, 20,158, 60,  0,  0,  0,  0, 11,215, 70, 60, 61, 43, 67,191,184,241, 31, 63,  0,  0,128, 63, 64,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0, 79, 66,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,
-236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  1,  0,  5,  0,  1,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  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,  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,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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, 25,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  8,  0,  0,  0, 88,139, 50,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0,168,139, 50,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 79, 66,  0,  0, 32,  5,  0,  0,248,139, 50,  3,  0,  0,  0,  0,116,  0,  0,  0,
-  1,  0,  0,  0,  8,146, 50,  3,  0,  0,  0,  0,232,133, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 79, 66,112,114,101,118,105,101,119, 99,117, 98,101,  0,117, 98,101,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,
-  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,  1,  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,  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,  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,232,227, 55,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0,
- 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0,
- 10,  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,  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,104,145, 50,  3,  0,  0,  0,  0,184,145, 50,  3,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,128,253, 88, 59,
-220,118,160, 63,  0, 15, 37, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 84, 88, 68, 64, 84, 88, 68, 64, 83, 88, 68, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,190,237, 62,108,230,217,190,
- 20,151, 52, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 67, 38,  8, 64,191,228,231, 63,186, 31,162, 63,  0,  0,  0,  0,
- 35,118, 13,192,  2, 61,220, 63, 31, 44,160, 63,  0,  0,  0,  0,166, 52,234, 60,102,223,227,191, 55,229, 31, 64,  0,  0,  0,  0,
-128,253, 88, 59,220,118,160, 63,  0, 15, 37, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,187,122,172,178,103,144,  8, 50,  0,  0,  0,  0,
-  7,239, 27,179,  0,  0,128, 63,247,131,152,178,  0,  0,  0,  0,149,110,134, 50,189,195,169, 50,  1,  0,128, 63,  0,  0,  0,  0,
-255,223,172, 50, 56, 88,136,179,159,134, 16,180,  0,  0,128, 63, 11,115,103, 62,200,122,112,190,232, 17, 71, 59,  0,  0,  0,  0,
-  4, 27, 69, 62,226, 50, 59, 62, 24,176, 65,190,  0,  0,  0,  0,114,205,  9, 62,203, 36,  8, 62,136,232,135, 62,  0,  0,  0,  0,
-188,208, 22,191, 23, 64, 18,191,174, 28,229,190,  0,  0,128, 63, 10,115,103, 62,201,122,112,190,  0, 18, 71, 59,  0,  0,  0,  0,
-116,205,  9, 62,204, 36,  8, 62,136,232,135, 62,  0,  0,  0,  0,  1, 27, 69,190,224, 50, 59,190, 25,176, 65, 62,  0,  0,  0,  0,
-110,176, 16,192,158, 71,  9,192,115, 90,244, 63,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  2,  0,
-  0,  0, 68,  0, 79, 66,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0,
- 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  1,  0,  5,  0,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,144,  0,  0,  0, 88,107, 26,  4,  0,  0,  0,  0,
+108,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 19,  0,  0,  0, 23,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 80, 97,114,116,105, 99,108,101, 83,121,115,116,101,109, 32, 49,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,120, 73, 25,  4,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,  4,  0,  0,  0, 79, 66,  0,  0,112,  5,  0,  0,
+ 56,108, 26,  4,  0,  0,  0,  0,129,  0,  0,  0,  1,  0,  0,  0,248,113, 26,  4,  0,  0,  0,  0, 56, 66, 25,  4,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,112,114,101,118,105,101,119,108, 97,109,112,  0,  0,  0,
+  0,  0,  0,  0,  0, 97,109,112,  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,  1,  0,  0,  4,  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, 10,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0, 64,  1,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,
-  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, 25,  0,  0,  0,
-  0,  0,  0,  0,  1,  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,  0,232,116, 24,  4,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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, 68, 65, 84, 65,  8,  0,  0,  0,104,145, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0,184,145, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
- 79, 66,  0,  0, 32,  5,  0,  0,  8,146, 50,  3,  0,  0,  0,  0,116,  0,  0,  0,  1,  0,  0,  0,  8,184, 51,  3,  0,  0,  0,  0,
-248,139, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,112,114,101,118,105,101,
-119,104, 97,105,114,  0,108, 97,110,101,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  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,  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,192,197,211,188, 76,229, 59, 65,208,106,184, 64,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,247,215, 98,191, 71, 11, 72, 63,
+230,248,  6, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,212, 14, 29, 63,149,225,182, 62, 84, 76, 52,191,  0,  0,  0,  0,
+ 22, 40, 74,191,201, 74,139, 62,228,198, 12,191,  0,  0,  0,  0, 84,213,157,187,151,190,100, 63,145,223,229, 62,  0,  0,  0,  0,
+192,197,211,188, 76,229, 59, 65,208,106,184, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,147, 39, 25, 51, 43, 47, 63,179,  0,  0,  0,  0,
+  9,108,247, 50,  0,  0,128, 63, 26, 92,142,178,  0,  0,  0,  0, 43,  4,114,179, 32, 59,141,178,  1,  0,128, 63,  0,  0,  0,  0,
+135,255,127,177,130,214, 10, 40,  1,  0,  0,181,  0,  0,128, 63,214, 14, 29, 63, 22, 40, 74,191,113,210,157,187,  0,  0,  0,  0,
+ 85, 76, 52,191,228,198, 12,191,137,223,229, 62,  0,  0,  0,  0,154,225,182,190,205, 74,139,190,157,190,100,191,  0,  0,  0,  0,
+213, 36,158,192,107,186,110,192,102, 43,169,193,  0,  0,128, 63,214, 14, 29, 63, 22, 40, 74,191,113,210,157,187,  0,  0,  0,  0,
+ 85, 76, 52,191,228,198, 12,191,137,223,229, 62,  0,  0,  0,  0,154,225,182,190,205, 74,139,190,157,190,100,191,  0,  0,  0,  0,
+213, 36,158,192,107,186,110,192,102, 43,169,193,  0,  0,128, 63,  0,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  5,  0,  1,  0,  0,  0, 68,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0,
+ 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0,  0,  0,  5,  0,  1,  0,  0,128, 63,  0,  0,128, 63,
   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,  0,  0,  0,  0,  0,  0, 56,108, 53,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,
-  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
   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,
- 72,183, 51,  3,  0,  0,  0,  0, 72,183, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,120,151, 50,  3,  0,  0,  0,  0,
-200,151, 50,  3,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0, 86, 92,200, 63,  7,205,227, 63,149,199,  9,189,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,234,126, 47, 64,234,126, 47, 64,236,126, 47, 64,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,225, 80,  2, 63,  5,211, 15,191, 92,219, 18, 62,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,224,254, 18, 64, 23,209,169, 62, 27,251,186, 63,  0,  0,  0,  0, 71,254,133,191,207, 40, 17, 64,229,194,144, 63,
-  0,  0,  0,  0, 78, 38,137,191, 48,162,192,191,125,176,  1, 64,  0,  0,  0,  0, 86, 92,200, 63,  7,205,227, 63,149,199,  9,189,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,225,128, 25,179,157,103, 88,179,  0,  0,  0,  0,249,162,132, 50,  1,  0,128, 63, 89,156,139, 51,
-  0,  0,  0,  0,225,204,139,179,160, 96,185,178,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0, 52,  1,  0,  0,180,  1,  0, 84,180,
-  0,  0,128, 63,244,100,156, 62,133,143, 14,190, 54,235, 17,190,  0,  0,  0,  0,174,239, 70, 62,100,  4, 26, 62, 74,251,137, 62,
-  0,  0,  0,  0,176,172, 52,189,213,112,154,190, 70,243, 76, 62,  0,  0,  0,  0,151, 56, 36,191,142, 98, 66,192,171,  5, 68, 64,
-  0,  0,128, 63,244,100,156, 62,133,143, 14,190, 54,235, 17,190,  0,  0,  0,  0,174,239, 70, 62,100,  4, 26, 62, 74,251,137, 62,
-  0,  0,  0,  0,176,172, 52,189,213,112,154,190, 70,243, 76, 62,  0,  0,  0,  0,151, 56, 36,191,142, 98, 66,192,171,  5, 68, 64,
-  0,  0,128, 63,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0, 79, 66,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,
-  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  1,  0,  5,  0,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  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,  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,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,
-248,152, 50,  3,  0,  0,  0,  0,248,152, 50,  3,  0,  0,  0,  0, 24,152, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+ 79, 66,  0,  0,112,  5,  0,  0,248,113, 26,  4,  0,  0,  0,  0,129,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 56,108, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,116,101,120,116,117,114,
+101,  0,114,101,118,105,101,119, 46, 48, 48, 53,  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,  1,  0,  0,  4,
   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,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  8,  0,  0,  0,
-120,151, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0,
-200,151, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,152,  0,  0,  0, 24,152, 50,  3,
-  0,  0,  0,  0,119,  0,  0,  0,  1,  0,  0,  0,  0, 64,  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,
-  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,205,204,204, 61,205,204, 76, 62, 10,215,163, 60,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 16,  2,  0,  0,248,152, 50,  3,  0,  0,  0,  0, 97,  1,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,216,239, 55,  3,  0,  0,  0,  0, 88,155, 50,  3,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,244,100,156, 62,134,143, 14,190, 52,235, 17,190,  0,  0,  0,  0,172,172, 52, 61,211,112,154, 62, 69,243, 76,190,
-  0,  0,  0,  0,176,239, 70, 62,102,  4, 26, 62, 73,251,137, 62,  0,  0,  0,  0,188,211, 12,191,198,176,160,190, 56,156, 22, 63,
-  0,  0,128, 63,  0,  0,  0, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 49,  2,  0,  0,150,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,150,  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,  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,  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,232,180, 51,  3,
-  0,  0,  0,  0,232,180, 51,  3,  0,  0,  0,  0,232,180, 51,  3,  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,  0,  0, 72,103, 16,  3,  0,  0,  0,  0, 68, 65, 84, 65,128,112,  0,  0, 88,155, 50,  3,  0,  0,  0,  0, 94,  1,  0,  0,
-150,  0,  0,  0, 20,135, 17,192, 36,121, 97,192,112, 32,141, 63,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 40, 12, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,180, 96, 10, 60,200,196,163, 61, 78,182, 99, 63,165,242,180, 60,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,111, 46,  7,192,143, 26, 60,192, 28,147,207, 63,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 72, 13, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,147,247, 17, 61, 51,172, 44, 62, 17,125, 54, 63, 69,195,169, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,224,103,174,189, 60, 88, 17,192,230, 35, 76, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-201,206,183,190,200,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,104, 14, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,102, 96, 39, 62,101,119,242, 61,189,168,146, 62, 55,  9,221, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 75,102,131,192,196,241, 26, 63,140,198, 76, 64,190, 81, 55,191,107,243, 71,191, 98,237, 42, 63,235,163,214, 62,
-198,206,183,190,206,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,136, 15, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,227,146, 53, 61, 63,180,115, 63,216,113, 42, 59,125, 63,144, 58,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 64, 43,226,189,253, 85,220,191,225,104,101, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-201,206,183,190,200,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,168, 16, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,250,120,128, 62, 19,194, 20, 62, 61, 15, 90, 62, 92, 30,200, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,108,159,129,191,  8,210,  6, 63, 35,221,152, 64,190, 81, 55,191,107,243, 71,191,102,237, 42, 63,235,163,214, 62,
-200,206,183,190,205,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,200, 17, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,148,235, 25, 63,206,172,146, 62,137,195, 52, 61, 99,142,139, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,114,167,189,191,217, 59,104,192,184,179,184, 63,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,232, 18, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,120,167,104, 60,166,104,235, 60,218,251, 73, 63, 13, 25, 44, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 86,112, 30, 63,111, 69, 82,192, 59,191, 51, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,  8, 20, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 27,112,241, 60,  0,187,177, 60,  4,134,171, 62,164, 35, 29, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,118,148,176,191, 88,200,  1, 63, 89, 48,146, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 40, 21, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,160,178,  8, 63,185,164,184, 62, 68, 72, 63, 61, 16,104,112, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,200, 80,168,191,  8,154,165,191,229,248, 80, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 72, 22, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,177, 46,104, 62, 36,106,150, 62,  2, 61,138, 62,  4,131, 86, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,  0,190,246,189,233,129, 90,192,224,155, 20, 64,190, 81, 55,191,107,243, 71,191, 98,237, 42, 63,235,163,214, 62,
-198,206,183,190,206,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,104, 23, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 79, 25,187, 60,207,244,194, 60, 53,234,253, 62,233, 52,234, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,176,231, 67,190,144,105, 11,189,210,111,153, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-201,206,183,190,200,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,136, 24, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,206,217, 24, 63, 59,222, 25, 62,  0, 50,134, 61,139,161, 63, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 58,217,158, 63,122,225, 17,192,213,158,120, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,168, 25, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 34,213, 73, 62,217,230, 49, 61,217,117,187, 61,143,253, 42, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 29,205,127,191,231,116,142,191,116, 64,100, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,200, 26, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,109,124,145, 62, 47, 84,135, 62, 95, 56, 95, 62,104, 38,111, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,143,106, 67,192,239,  1,236, 62,230,139,105, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,232, 27, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 37,227,100, 62,230, 38, 54, 63, 87,  4, 43, 61,166,  1,190, 60,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,114, 63, 58,191,242, 44,102,191,239,155,119, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,  8, 29, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,232,134,178, 62, 23,134,113, 62,235,242, 46, 62, 45,121,122, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,244,173,175, 62,136,194,141, 61,  0,239,164, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-201,206,183,190,200,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 40, 30, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,211, 97, 48, 63, 38,134,130, 61,167, 53,  8, 61, 56, 40, 91, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,127,188, 36,192, 83,192, 42,192, 20, 24,202, 63,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 72, 31, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,191,242,154, 60, 14,165,130, 62,127,236, 49, 63,163, 44,253, 60,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,191,117, 51, 63, 40,247, 44,192, 84, 59, 82, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,104, 32, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,218, 50,227, 61, 48,152,110, 61,166, 58,104, 62,121,161, 26, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 23,218, 44,192,131,112,159,190, 68,196, 80, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,136, 33, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 23,126, 53, 62, 93,113, 22, 63, 29,104, 42, 62,166,168,140, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,222,253, 61,191,212,216, 43,190,219,239,140, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,168, 34, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 24, 36,252, 62,191,130,121, 62, 96,245,198, 61, 98,186, 42, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,192,168,212,191, 47,175, 30,192, 94,228, 12, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,200, 35, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,118,198,167, 61, 92,200, 80, 62,157,210, 10, 63,240,  9, 48, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,114,184,238,190,237,206,230,191,208,122, 85, 64,190, 81, 55,191,107,243, 71,191, 98,237, 42, 63,235,163,214, 62,
-198,206,183,190,206,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,232, 36, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,138,132, 94, 62,167,190, 48, 62,203, 41,136, 62,157, 52,176, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 67, 19,104, 63,179,122,254,191,115, 37,123, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,  8, 38, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,197,245,124, 62, 30,108,130, 61,201,152,229, 61,242,193, 19, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,172,106,191, 63,110,225, 42,192,  2,170,110, 64,190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,236,163,214, 62,
-197,206,183,190,201,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 40, 39, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,240, 99,249, 61,190, 88,249, 60,174, 20,183, 61, 39, 38, 66, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,121,  3, 12,192, 63, 11,252,190,146,136, 89, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 72, 40, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,173, 28,108, 62,191,152,246, 62,199, 50, 61, 62, 31,254,210, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,250,104,187,191, 56, 86,139,189,145, 23,131, 64,190, 81, 55,191,107,243, 71,191,100,237, 42, 63,235,163,214, 62,
-198,206,183,190,203,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,104, 41, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 15, 67,208, 62,184, 57,190, 62,119,154,219, 61,111,114,234, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 52, 56,161, 62,255,221,207,191,202,110,120, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-201,206,183,190,200,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,136, 42, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,123, 33,150, 62, 68, 30,226, 61,224,121, 27, 62,  4,154,227, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 63, 89, 41,192,117,107, 25,192,174,245,222, 63,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,168, 43, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 82,179,202, 60,197,106,157, 62,211,197, 33, 63,  9,243, 18, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 94,238,220,191, 91, 70,150,191,203,192, 72, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,200, 44, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 13,183, 77, 62,158,153,182, 62, 65, 59,143, 62, 52,159, 38, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 61,234,116,192,224,101,238,188,165, 20, 56, 64,190, 81, 55,191,107,243, 71,191,100,237, 42, 63,235,163,214, 62,
-198,206,183,190,203,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,232, 45, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 31,255,242, 60,231,194, 83, 63,189, 56,  5, 62, 68,188, 85, 60,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,128,209,240,189,178,183, 95, 63,  5, 67,176, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-201,206,183,190,200,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,  8, 47, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,153,189, 85, 63,151,104,200, 61,246, 55,142, 60, 74, 57, 76, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,206, 54, 25,192,171,197,162, 62,  6, 16,121, 64,190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,236,163,214, 62,
-197,206,183,190,201,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 40, 48, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,104,246,163, 62, 91,201, 16, 63, 24,104,136, 61,227,230, 66, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 29, 57, 61,192,236, 53, 39,191,173,221, 55, 64,190, 81, 55,191,107,243, 71,191,100,237, 42, 63,235,163,214, 62,
-198,206,183,190,203,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 72, 49, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 39,218,212, 61,242, 20, 25, 63,122, 70,118, 62,159,226,107, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,249, 62, 40,191, 16,113, 26, 63, 50,179,160, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,104, 50, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 64,186, 45, 63,109,122, 91, 62, 32,134, 21, 61, 21,118,144, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 90, 51,138,191,199, 14,110,192, 18, 66,203, 63,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,136, 51, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,235,223,153, 59, 21,174,243, 59,231,160, 60, 63,251,135,128, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 44, 75,186,191,170,205,204,191,132,169, 61, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,168, 52, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 79, 19, 52, 62,229, 52,146, 62,191,228,171, 62,106,185, 79, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,  4,119,219, 63,231, 73, 28,192, 83,117,128, 64,188, 81, 55,191,109,243, 71,191,100,237, 42, 63,233,163,214, 62,
-202,206,183,190,201,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,200, 53, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,186, 75, 51, 62,206,251,144, 60,198, 49, 19, 61, 22,114, 69, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,172, 59,194,191, 35, 29, 13,192, 13,208, 30, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,232, 54, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 97, 31,227, 61,168,207,104, 62, 38, 89,237, 62, 93,238, 74, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,197,190, 82,192,251,148,174, 62, 29,189, 91, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,  8, 56, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,210, 10, 37, 62,124,152, 65, 63, 28,110,106, 61,179,189,207, 60,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,120,157,163,190, 44,219, 33, 63,250, 25,167, 64,190, 81, 55,191,107,243, 71,191,102,237, 42, 63,237,163,214, 62,
-199,206,183,190,206,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 40, 57, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 52,192, 61, 63, 16, 50, 23, 62, 40, 56,  1, 61, 43,254,162, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,131, 63, 79, 63, 22,225,203,191,183, 83,133, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 72, 58, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,  9,188,167, 62,141,167,138, 61,186,163,185, 61,147,152,  3, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 20,218, 89, 62,169, 21, 81,192, 50,226, 38, 64,190, 81, 55,191,107,243, 71,191, 98,237, 42, 63,235,163,214, 62,
-198,206,183,190,206,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,104, 59, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,175,237, 18, 61, 50,  0,  0, 61,180, 45,208, 62, 72,186,  6, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,192, 91,166,190,203,138,151, 62,232,  4,159, 64,190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,236,163,214, 62,
-197,206,183,190,201,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,136, 60, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,114,117, 40, 63,164, 92, 37, 62, 72,198, 78, 61,  6, 28,  5, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,104,137,191,191,143,156,208,190,234,245,116, 64,190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,236,163,214, 62,
-197,206,183,190,202,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,168, 61, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,121,217,174, 62, 45, 55,188, 62, 41, 76, 25, 62,138,146, 16, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,218,  6, 78,191,240,247,  2,191,  2,181,131, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,200, 62, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,237,209,211, 62,  1,168,129, 62,108,237,  7, 62,188, 30, 77, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,100,181,251,191,160, 67, 79, 63, 83,115,143, 64,190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,236,163,214, 62,
-197,206,183,190,201,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,232, 63, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 31, 56,250, 62,174,208,248, 62, 50, 43, 79, 60,252,186, 79, 60,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,166,143, 16,192,219, 40, 31,192,188,165,240, 63,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,  8, 65, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 93,255, 69, 61,131,237,129, 62,199,113, 29, 63, 16,188,169, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 47, 16, 46,192,234,135, 17, 62,196,174,101, 64,190, 81, 55,191,107,243, 71,191,100,237, 42, 63,235,163,214, 62,
-198,206,183,190,203,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 40, 66, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,132,185,112, 62, 76,198, 31, 63, 82,148,186, 61,149,140, 75, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,221, 76, 34,192,195, 63,220,191,101, 92, 19, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 72, 67, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,191,  5,144, 61, 27,251,203, 62,  8,217,232, 62,185,169,156, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,  0,209,208,191,175, 98, 57,192,214, 39,244, 63,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,104, 68, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 40,142,100, 61,206, 81, 18, 62, 52,238, 34, 63,214,209, 40, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,156,146, 19,192,132,169, 38, 63,119,240,133, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,136, 69, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,177, 98,202, 62,157,134, 14, 63,246,140,213, 60, 97,116,179, 60,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,100,209,211, 63, 80, 57, 64,192,239, 52,100, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,168, 70, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,131,222,112, 61,150,149,161, 60,127,188,202, 61,219,141, 82, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,204, 40,195, 62,169, 66, 22,192, 56, 69, 88, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,200, 71, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,237,198, 39, 62,232,166,180, 61, 33, 45,106, 62, 32,238,  4, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,179, 41,124, 63,215, 52, 92,192,  1,194, 56, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,232, 72, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,225,119,158, 59, 62,185, 89, 59, 58, 41,150, 62,186,212, 50, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 78,215, 66,192, 16,102, 17,189,251, 64, 82, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,  8, 74, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 94, 65, 31, 62,152, 57, 45, 63,117,240,248, 61, 59,128, 61, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,243,234,243, 63, 12,199, 50,192,246,173,118, 64,192, 81, 55,191,107,243, 71,191, 98,237, 42, 63,235,163,214, 62,
-197,206,183,190,205,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 40, 75, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,202, 64,207, 61, 46,106, 89, 60, 30, 53, 13, 61,236,222, 89, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,174,176, 54,191, 99,173,187,191,209, 31, 93, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 72, 76, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,101,144,129, 62,185,  1, 91, 62, 60, 67,121, 62, 32, 77,148, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,238,131,100,192,222,185, 81,191, 40, 50, 27, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,104, 77, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,197,146, 70, 60, 83,125, 44, 63, 64,124,156, 62,125,144, 10, 60,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,226, 77,248,190, 12,109,103,190,230,231,143, 64,190, 81, 55,191,107,243, 71,191,100,237, 42, 63,235,163,214, 62,
-199,206,183,190,204,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,136, 78, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 53,173,  3, 63,187,233, 78, 62, 77,225,187, 61,203,112, 68, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,129, 80, 10, 64,253,130, 74,192,124,179,109, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,168, 79, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,215,  2,202, 60, 38,116,181, 59,240,167,204, 60,193,223,113, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 73, 37, 55,192, 92, 44,210,191,134, 20, 12, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,200, 80, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,144,158, 50, 61, 53,247,230, 62,253, 25,236, 62,226,215, 52, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,  4,163,152,191,233,189, 16,192,148, 29, 39, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,232, 81, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,113,136,250, 61,109, 45, 71, 62,248,240,222, 62,108,172,125, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 83,219,213, 63,119,221, 77,192, 98,157, 90, 64,192, 81, 55,191,107,243, 71,191, 98,237, 42, 63,235,163,214, 62,
-197,206,183,190,205,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,  8, 83, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,154,154,192, 60,206,233, 43, 60, 68, 13,  0, 62, 51, 72, 87, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,118, 39,106,191,130, 29,114, 63,156,123,164, 64,190, 81, 55,191,107,243, 71,191,102,237, 42, 63,235,163,214, 62,
-200,206,183,190,205,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 40, 84, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,149, 27, 54, 63,243, 38,133, 62,232, 55, 53, 60, 91,130,143, 60,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,  4, 71,102,192,241,109,194,190,108, 39, 47, 64,192, 81, 55,191,107,243, 71,191,100,237, 42, 63,233,163,214, 62,
-198,206,183,190,204,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 72, 85, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,152,203, 22, 61,132,161, 61, 63, 67,196, 79, 62, 79, 22,160, 60,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 12,224,214, 63,225,182,  5,192,246, 59,136, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,104, 86, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,211, 28,131, 62, 24,255, 46, 60, 11,165,139, 60,113, 88, 55, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 95,158, 92, 63,117,243, 67,192, 16,154, 70, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,136, 87, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,112, 55,104, 61, 14, 23,  9, 61,208, 82,129, 62,176, 65, 40, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 87,234, 31,192,204,234, 65,192,110,200,172, 63,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,168, 88, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,197,252, 48, 60,163,176, 62, 62,216, 93, 72, 63, 94, 65,166, 60,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 76,122,189,191,238,243,102,191,158,253, 93, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,200, 89, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,101,159,135, 62,253,216,174, 62,217, 99, 96, 62,104,171, 50, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,227, 75, 67, 63, 48,124, 78, 61,200,150,171, 64,190, 81, 55,191,107,243, 71,191,100,237, 42, 63,235,163,214, 62,
-198,206,183,190,203,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,232, 90, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,191,115, 58, 63,121,198,  2, 60,254,102,167, 59,178,100,132, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 24, 37,139, 62,  4,231, 62, 63,174,205,179, 64,188, 81, 55,191,107,243, 71,191,102,237, 42, 63,235,163,214, 62,
-200,206,183,190,206,137, 61,190,156, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,  8, 92, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 50, 23, 92, 63,169, 27, 15, 61,  8, 43, 83, 60, 59, 83,189, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 32,247,225,191, 37,175, 81,192,248,254,198, 63,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 40, 93, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 66,132,  2, 61,191, 37,189, 61,173,  5, 64, 63, 91,181,  0, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,200,110,165, 61,183, 43,239, 62,129,243,169, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 72, 94, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 62,109, 66, 63,244,159,170, 61, 79,150,243, 60, 69,136,  2, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 12,158,243,191,244,237,104,192,138, 34,155, 63,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,104, 95, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,228,106, 92, 60, 23, 25, 35, 61,136,111, 93, 63,211,105,167, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,118, 74,  8, 63,  0,240,  1,192, 28,123,108, 64,190, 81, 55,191,107,243, 71,191,102,237, 42, 63,235,163,214, 62,
-200,206,183,190,205,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,136, 96, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,233,242,101, 62,181,120,181, 61,231,136, 43, 62,245,241,  4, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 26, 24,231,191, 44,105, 21,191,186, 32, 98, 64,190, 81, 55,191,107,243, 71,191,100,237, 42, 63,235,163,214, 62,
-198,206,183,190,203,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,168, 97, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 66,189,138, 62,114,103,210, 62,117,128, 62, 62, 35, 54,  7, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,141, 52,  5,191, 10,103, 49,192,230,154, 37, 64,190, 81, 55,191,107,243, 71,191, 98,237, 42, 63,235,163,214, 62,
-198,206,183,190,206,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,200, 98, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,132, 47,184, 61,244,157,207, 61,168,  0,225, 62,249, 11,189, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,136, 45,177,191, 22,253, 99, 63,  8, 58,155, 64,190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,236,163,214, 62,
-197,206,183,190,202,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,232, 99, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,147,253, 28, 63,231,184,184, 62, 48, 48, 58, 60, 59, 78,111, 60,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 42,255, 57,191,235,  4, 65,192, 77,  7, 19, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,  8,101, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,228,255,128, 61, 76, 32,172, 61,147,152,  5, 63,205,134,169, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,184, 68,137,191,204,177,226, 61,196,247,141, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 40,102, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,107,166,  0, 63, 23, 29,154, 62, 34,214,165, 61, 42,130,236, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 22,103, 82,192, 73, 75,201,191,  1,247,  0, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 72,103, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 73,109,118, 59,168,155,  4, 63, 73,  2,243, 62,186,198,108, 59,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,194,241,246,191, 87,130,236, 62, 50,209,135, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,104,104, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 49, 99,219, 62, 85, 73,242, 62,127, 14, 79, 61, 68,141, 67, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,224,228,149,189,233, 13,221,190,210,251,145, 64,190, 81, 55,191,107,243, 71,191,100,237, 42, 63,235,163,214, 62,
-199,206,183,190,204,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,136,105, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,198,141,  4, 63,  3, 71, 19, 62, 60,186,174, 61, 99,146,129, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,  0,120, 89, 62,164,169,120,190, 26, 78,155, 64,192, 81, 55,191,109,243, 71,191, 98,237, 42, 63,234,163,214, 62,
-197,206,183,190,202,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,168,106, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,224, 89, 24, 63,189,174,198, 61,  2,152,101, 61,143,237,128, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 92, 80, 26,192,232,  3,239,189,182,210, 99, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,200,107, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,115,248,126, 62, 84, 41, 12, 63,153, 55,  4, 62, 62, 85,152, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 80,245, 70,190,136,148, 37,192, 41,107, 57, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,232,108, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,208,237,239, 61, 10, 34,210, 61, 62,101,181, 62,205, 22,218, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,253,172, 25,191, 68,234,249,191, 59,217, 73, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,  8,110, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 12,172, 64, 62,160, 24, 51, 62,145, 49,156, 62, 26,236,169, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 77, 63, 60,192,192, 70,245,191,246,177,248, 63,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 40,111, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,172,109,175, 60,  7,135,214, 62, 59, 12,  9, 63,150,154,198, 60,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,  6,125,162, 63, 63,233, 64,192,147,167, 86, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 72,112, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,  4, 49,119, 61,119,251,224, 60, 94,  5, 47, 62,188,195, 61, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,184, 96, 27,192,251, 23,179,191,193, 77, 38, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,104,113, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,166,161,213, 61,217,242,218, 62, 39, 18,191, 62, 89, 74,194, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,185,  0, 21,191,137,241, 14,192,206, 27, 61, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,136,114, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 58, 36, 27, 62,245,151, 28, 62, 82, 23,179, 62,148, 10,177, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 64, 80, 57,189,193, 80,166,191,242,172,123, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-201,206,183,190,200,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,168,115, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,199,225,170, 62,114, 67, 23, 62,202, 56, 33, 62, 26,224,184, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,202,106,219,190, 17,216,127, 63,140,251,173, 64,190, 81, 55,191,110,243, 71,191, 98,237, 42, 63,235,163,214, 62,
-198,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,200,116, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 10,203, 79, 63,104, 14, 32, 62,252,238, 44, 60, 55,180,175, 60,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,111, 39, 91,192, 64, 81,150,191, 89, 68, 15, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,232,117, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 25, 88, 25, 60, 85, 74, 25, 63,199,185,196, 62,210,179,249, 59,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,231, 17, 40, 63,141, 44,153,190, 68,123,161, 64,190, 81, 55,191,107,243, 71,191,102,237, 42, 63,235,163,214, 62,
-200,206,183,190,205,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,  8,119, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,202,133, 32, 63, 25,163, 36, 61, 45,136,225, 60,133, 71,156, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 50, 95,160, 63, 34,101,249,191,176, 96,132, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 40,120, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 62, 45,138, 62, 35,142, 30, 61,173, 78,128, 61,170,246, 32, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,111,133,  6,192,167,152,225,191, 84, 16, 32, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 72,121, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,245,107,217, 61,253,147,174, 62,227,232,218, 62, 70, 80,  0, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 80, 99,228,190, 44, 59, 51,191,221, 75,133, 64,192, 81, 55,191,109,243, 71,191, 98,237, 42, 63,234,163,214, 62,
-197,206,183,190,202,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,104,122, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,117,208,213, 62,118,118, 76, 62, 32,254,  5, 62, 65,245,128, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 85,101, 74,192,166,185,105,191, 18,141, 36, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,136,123, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,221,214,102, 61, 50, 22, 25, 63,139, 42,157, 62,164,113, 30, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,122,234,218,191, 50,177,232,191,108,174, 42, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,168,124, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,229, 50,  8, 62,227,251,148, 62,133, 65,206, 62, 75, 82, 49, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,254,106,206,191,205, 36,150, 62, 96, 42,137, 64,190, 81, 55,191,107,243, 71,191,100,237, 42, 63,235,163,214, 62,
-198,206,183,190,203,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,200,125, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 87, 15,231, 62, 49,237,207, 62,254, 43,141, 61,226,225,150, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,200, 61,167, 63,119,  5,171,191, 86,214,147, 64,190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,236,163,214, 62,
-197,206,183,190,201,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,232,126, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,216, 36,214, 62,172, 85,122, 60, 44,247,142, 60,132,140, 12, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,194, 14,251,191, 44,213,105,190,165,188,109, 64,190, 81, 55,191,107,243, 71,191,100,237, 42, 63,235,163,214, 62,
-198,206,183,190,203,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,  8,128, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,239, 13,155, 62, 40, 17,234, 62, 92,128, 13, 62,226,130,208, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,102, 47, 46,192, 64,212, 45, 63, 61, 35,127, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 40,129, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 74, 31,165, 62,207,208, 37, 63, 74,227,141, 60,  8, 28, 76, 60,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 10,203, 83,191,133, 15, 29,192,237, 82, 42, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 72,130, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 21,150,239, 61,130,193, 24, 62, 46, 71,217, 62,141,114,158, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 47, 71,102, 63, 16, 13, 44,191, 24,187,156, 64,190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,236,163,214, 62,
-197,206,183,190,201,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,104,131, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,178,206, 13, 63,144,101,237, 60, 16,227,198, 60, 16, 30,201, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,140,210,252, 62,216, 58, 44,191, 98,217,149, 64,192, 81, 55,191,109,243, 71,191, 98,237, 42, 63,234,163,214, 62,
-197,206,183,190,202,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,136,132, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,235,174,  4, 63,125,216,156, 61,114,228,115, 61,124,239,176, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,181,210, 46,192, 59,  4,135,191,164, 99, 44, 64,190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,236,163,214, 62,
-197,206,183,190,202,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,168,133, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,154, 69,201, 61, 74,143,  3, 63,155, 10,162, 62,186, 21,146, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 64,235, 64, 60,203,210,147, 63,205, 32,185, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-201,206,183,190,200,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,200,134, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,135,168,109, 63, 87, 44,112, 61,106, 72,115, 59,214, 90, 24, 60,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,160,185,  0,192,197,235, 38,192,182,221,245, 63,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,232,135, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 85,123,103, 61,230, 65, 90, 62, 33,215, 29, 63,124,  5,233, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,132,118,247,191, 87, 66,  8,192, 93, 88, 20, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,  8,137, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 15,245,186, 61,252,211,140, 62,237,184,252, 62,164,107, 15, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 96,252,  2,190,189, 32, 63,192,249,176, 40, 64,190, 81, 55,191,107,243, 71,191, 98,237, 42, 63,235,163,214, 62,
-198,206,183,190,206,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 40,138, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,109,251,141, 61,209, 15,135, 61,152,122,212, 62,150, 66,230, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,186, 37, 60,192,209, 36, 19,192,200,102,212, 63,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 72,139, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,144,146,141, 59, 24,189,182, 62, 12, 24, 34, 63,242, 33,183, 59,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 62,165,155, 63, 35,188,200,191,156,201,140, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,104,140, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 54,112,182, 62,156,202,  2, 61, 65,146, 40, 61, 24, 18, 18, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,150, 48,  1, 63,133, 14,211, 62,120,209,175, 64,190, 81, 55,191,107,243, 71,191,102,237, 42, 63,235,163,214, 62,
-200,206,183,190,205,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,136,141, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 26, 61, 76, 63,214,234,171, 60,230,187, 47, 60,126,146, 46, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,196,144, 98, 62, 62,190,112,191,153,224,138, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,168,142, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 51,212,220, 62, 49, 96,238, 61,  1,246,205, 61, 64, 22,180, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 80,243,  2,192, 18, 84, 91,191,110,  0, 77, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,200,143, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,112,143, 79, 62, 13, 36,220, 62,207,171,119, 62,168,124,  0, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,228, 81, 34, 62,178, 55, 39,192, 87, 36, 68, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,232,144, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,144, 72,244, 61,152, 98,173, 61, 16,243,154, 62, 38,162,252, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,226,206,132,191,153,157,254,191, 61, 78, 57, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,  8,146, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 49,138, 35, 62,237,209, 85, 62,126, 75,186, 62,113,  6,137, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,228,163,237, 62, 55, 20, 58,192,  9,122, 64, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 40,147, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,187,215,163, 61, 90,207, 92, 61,188,248,152, 62,182, 59, 17, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,202, 59,148,191,188,242, 56,191,189,111,113, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 72,148, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 42,204,169, 62,204,195,154, 62,146,225, 51, 62,125,254, 66, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 34,179,252,191, 86,102,184,191,169,174, 51, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,104,149, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 46,210, 21, 62,250, 32,186, 62,195,126,178, 62, 85,238, 16, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,  1,244, 77,192, 51, 52,163,190, 30,234, 62, 64,190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,236,163,214, 62,
-197,206,183,190,202,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,136,150, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 89,246,198, 61, 30,130, 46, 63,223,241, 54, 62,221, 41, 46, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,255, 27,122, 63,179,229,133,191, 66, 39,149, 64,190, 81, 55,191,107,243, 71,191,102,237, 42, 63,235,163,214, 62,
-200,206,183,190,205,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,168,151, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,216,  4,239, 62,235,100, 21, 61,174, 73, 20, 61, 83,197,235, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 20, 66,151,191,208,139, 62,192, 98,118,  5, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,200,152, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,212,101,120, 61, 72, 26,221, 61,158, 82, 22, 63,241, 14,122, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,224, 63, 46,190,222,105,107,191,198,191,132, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-201,206,183,190,200,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,232,153, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 89,238,204, 62, 10, 90, 39, 62,123,156,  6, 62, 98, 22,156, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,250,148,234,190, 11,179, 97,192, 16,215,  3, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,  8,155, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,251, 26,119, 60, 34,207,150, 60,170,176, 20, 63,225,120,197, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,202,177,135,191,150,220, 86,192,144,  9,239, 63,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 40,156, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 87,169,  5, 61,120,116, 92, 61,179,253, 38, 63,225,192,133, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,213,105,108,192,125,145,223, 62,192,182, 82, 64,190, 81, 55,191,107,243, 71,191, 98,237, 42, 63,235,163,214, 62,
-198,206,183,190,206,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 72,157, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,206, 82,204, 61, 44,113, 89, 63, 63, 63, 23, 61,220, 33,100, 60,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 76, 23,243, 62, 46,133,166,191, 78,153,134, 64,192, 81, 55,191,109,243, 71,191, 98,237, 42, 63,234,163,214, 62,
-197,206,183,190,202,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,104,158, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,159,  2,190, 62, 29,141,193, 61,214, 93,214, 61,164,  2,220, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,130,192,214,190,182, 57, 73,192,175, 83, 23, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,136,159, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,211,103, 84, 61, 92,194,115, 61,148,216,253, 62, 41, 34,201, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,122,  4,133,192,109,136,128, 62,136, 58, 58, 64,190, 81, 55,191,107,243, 71,191, 98,237, 42, 63,235,163,214, 62,
-198,206,183,190,206,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,168,160, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 70, 80,156, 58,142,100,108, 63, 15, 72,153, 61,116, 35, 17, 58,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,132, 40, 12, 62,102, 32,  1,192,222,178, 95, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,200,161, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,223,196, 88, 62,134, 94,237, 61,141,  5, 97, 62, 43,195,231, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,211,109, 80, 63, 96,210, 20,192,246,253,103, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,232,162, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 69,196, 53, 62,136,184,135, 61,240,250, 35, 62, 34,153, 24, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,240,142,147,191, 43,  7,166,190, 61, 69,130, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,  8,164, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 56,243,206, 62,109,170,159, 62,224,145,  2, 62,211, 50, 32, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,  2,254, 89,191,195,197, 85,192,176,197,254, 63,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 40,165, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,111,  3, 11, 61,241,  2, 76, 61,231,181, 28, 63,103,179,155, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 24, 46,253,191,200,126,214, 61,248,  1,125, 64,190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,236,163,214, 62,
-197,206,183,190,202,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 72,166, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 18,251,181, 62,225,163,242, 62, 90, 98,191, 61,220, 33,158, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,115, 18, 94,192,112, 61, 49, 61, 90,153, 71, 64,190, 81, 55,191,109,243, 71,191, 98,237, 42, 63,236,163,214, 62,
-197,206,183,190,202,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,104,167, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,141,188,190, 61,118,157, 68, 63,105,119,224, 61,112,129,239, 60,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 38, 34,141,191,222,140, 39,192,182, 55, 25, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,136,168, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,122,  6,189, 61, 58,195, 23, 62,  6,114,254, 62,189,106,134, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,149, 14, 63,192, 64,204,165,191, 12, 96, 24, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,168,169, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 14, 67, 83, 61,192,186,  4, 63, 39,206,197, 62,178,159, 50, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,183,180, 22,192,126,173,  4,192,240,189,  8, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,200,170, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,133, 49,131, 61,130, 33,167, 62,160,225,  5, 63,124, 59,177, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 35,160, 97, 63,129,220,163,191,194,248,141, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,232,171, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 78,174,206, 62, 68,159, 93, 61,160, 84,118, 61, 54,211,246, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,  4,223, 18,192,155,169,140,191,151, 18, 57, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,  8,173, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,245, 96, 21, 62, 35,104,227, 62, 83, 62,154, 62, 64,164,222, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,100,193,179,191,251,111, 78,192,166, 64,228, 63,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 40,174, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 37,242, 35, 61,204,214,171, 61,175, 25, 46, 63, 82,177, 72, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 93, 90,124,191,113, 48,212,191, 56,208, 74, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0, 72,175, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,187,178, 81, 62,176, 57,108, 62, 93,177,153, 62,108, 88,135, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,251,231, 33,192,132,  2, 59,191, 78,162, 66, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,104,176, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,217, 15, 30, 62,227,209,  4, 63,178,148,117, 62,218, 39,178, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,  2,185,138, 63,191,128, 41,192,139,193, 97, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,136,177, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,  0,196,250, 61, 79,120, 62, 61,195, 12, 31, 62,202,252, 44, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,242, 63,243,190, 86,176,159,191,245,150,111, 64,190, 81, 55,191,109,243, 71,191,100,237, 42, 63,234,163,214, 62,
-200,206,183,190,199,137, 61,190,158, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,168,178, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255,217, 77,158, 62, 43,131, 72, 62,119,208, 68, 62, 86,  8,155, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0,198,178, 48,191,138, 39, 52, 62, 39,252,149, 64,190, 81, 55,191,107,243, 71,191,100,237, 42, 63,235,163,214, 62,
-198,206,183,190,203,137, 61,190,157, 38, 80,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  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,  0,  0,  0,  0,  0,  0,200,179, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,  0,  0,200, 66,  0,  0,  0,  0,
-255,255,255,255, 62, 71, 19, 63,111,215,107, 62, 63, 71,138, 61,243,231,  1, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  1,  0, 68, 65, 84, 65,216,  0,  0,  0, 40, 12, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 58,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,136,127, 35,188, 15, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188,
- 31,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,203, 20,227,188, 15,143,197, 61, 82,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 15, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 59,138, 94,189,151,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189,
- 31,224,124, 62,143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 72, 13, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,
-255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,136,127, 35,188,255, 61, 14, 61,219,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,203, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,152,127, 35,189,
- 15, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 59,138, 94,189,147,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 27,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104, 14, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186, 63,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,168,127, 35,188,239, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188,
-251,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188,  3,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  7, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 59,138, 94,189,142,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189,
- 23,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,136, 15, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 82,145,186,255,223,124, 59, 56,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 84,145,187,
-255,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,127, 35,188,255, 61, 14, 61,218,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,199, 84,145,188, 15,224,124, 61,123,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,171, 20,227,188, 15,143,197, 61, 80,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,136,127, 35,189,
- 15, 62, 14, 62,163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 43,138, 94,189,151,155, 65, 62,182,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,255, 84,145,189, 31,224,124, 62,139, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168, 16, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,127,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,168,127, 35,188,243, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 15, 85,145,188,
-251,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188,  5,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,180,127, 35,189,  8, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 59,138, 94,189,142,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 11, 85,145,189,
- 23,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,200, 17, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 82,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 84,145,187,
-223,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,126, 35,188,247, 61, 14, 61,219,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,135, 84,145,188,  7,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,107, 20,227,188, 11,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,104,127, 35,189,
- 11, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,251,137, 94,189,145,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,231, 84,145,189, 27,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232, 18, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 58,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,136,127, 35,188,255, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188,
- 15,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188, 15,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189, 11, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 75,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189,
- 27,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,  8, 20, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 84,145,186,127,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,
-223,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,136,127, 35,188,247, 61, 14, 61,219,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,251,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,235, 20,227,188,  5,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,
-  8, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 75,138, 94,189,142,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189, 23,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40, 21, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 59,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187, 15,224,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,  8,128, 35,188,  7, 62, 14, 61,221,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188,
- 23,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 43, 21,227,188, 18,143,197, 61, 82,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189, 15, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 91,138, 94,189,152,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189,
- 34,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 72, 22, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,135, 84,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,223, 84,145,187,
-255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,132,127, 35,188,  3, 62, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,252, 84,145,188, 19,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,207, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,169,127, 35,189,
- 13, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 50,138, 94,189,147,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,  7, 85,145,189, 31,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104, 23, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,143,223,124, 59, 56,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,223,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,200,127, 35,188,250, 61, 14, 61,218,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,
-  4,224,124, 61,124,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188, 11,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 11, 62, 14, 62,163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 43,138, 94,189,146,155, 65, 62,183,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,255, 84,145,189,
- 26,224,124, 62,140, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,136, 24, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 87,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,199, 85,145,187,
-255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,128, 35,188,255, 61, 14, 61,219,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188,255,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0, 11, 21,227,188, 11,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,192,127, 35,189,
- 11, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 75,138, 94,189,145,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 25,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168, 25, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,222,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,191,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,200,127, 35,188,239, 61, 14, 61,221,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188,
-239,223,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188,255,142,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  3, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 75,138, 94,189,135,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189,
- 17,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,200, 26, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0, 71, 84,145,186,239,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,199, 84,145,187,
-255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,120,127, 35,188,  2, 62, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,247, 84,145,188, 17,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,203, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,165,127, 35,189,
- 13, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 48,138, 94,189,147,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,  7, 85,145,189, 28,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232, 27, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 58,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,  8,128, 35,188,255, 61, 14, 61,221,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188,
- 15,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 43, 21,227,188,  7,143,197, 61, 82,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189,  7, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 91,138, 94,189,143,155, 65, 62,186,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189,
- 23,224,124, 62,143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,  8, 29, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,135, 84,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,231, 84,145,187,
-255,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,136,127, 35,188,  3, 62, 14, 61,219,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,255, 84,145,188, 17,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,211, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189,
- 13, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 53,138, 94,189,148,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 10, 85,145,189, 29,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40, 30, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,  8,128, 35,188,255, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188,
-255,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 43, 21,227,188, 15,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189,  7, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 83,138, 94,189,143,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 27, 85,145,189,
- 23,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 72, 31, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 85,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,
-255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,168,127, 35,188, 15, 62, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 15,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,219, 20,227,188, 23,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189,
- 11, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 67,138, 94,189,147,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 19, 85,145,189, 27,224,124, 62,143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104, 32, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,127,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,191,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,200,127, 35,188,239, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,
-247,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188,255,142,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  5, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 59,138, 94,189,138,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189,
- 19,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,136, 33, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 59,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,
-255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,128, 35,188,255, 61, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188, 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0, 11, 21,227,188,  7,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189,
- 11, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 83,138, 94,189,143,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 27, 85,145,189, 23,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168, 34, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,255,223,124, 59, 58,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0, 71, 85,145,187,223,223,124, 60,189, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,200,127, 35,188,247, 61, 14, 61,221,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188,
-  7,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188, 11,143,197, 61, 82,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189, 11, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 59,138, 94,189,145,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189,
- 27,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,200, 35, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 85,145,186,127,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,
-223,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,168,127, 35,188,247, 61, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,  7,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,203, 20,227,188, 11,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189,
- 13, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 43,138, 94,189,145,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 11, 85,145,189, 25,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232, 36, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,135, 84,145,186, 63,224,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,231, 84,145,187, 55,224,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,152,127, 35,188, 17, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,255, 84,145,188,
- 30,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,203, 20,227,188, 24,143,197, 61, 80,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,164,127, 35,189, 18, 62, 14, 62,163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 55,138, 94,189,155,155, 65, 62,183,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,  9, 85,145,189,
- 36,224,124, 62,140, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,  8, 38, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 85,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,
-191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,168,127, 35,188,239, 61, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188,255,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,235, 20,227,188,255,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,
-  7, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 67,138, 94,189,139,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 19,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40, 39, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,200,127, 35,188,255, 61, 14, 61,218,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188,
- 15,224,124, 61,124,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 11, 21,227,188, 15,143,197, 61, 80,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189, 15, 62, 14, 62,163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 91,138, 94,189,151,155, 65, 62,182,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189,
- 31,224,124, 62,139, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 72, 40, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0, 71, 85,145,187,
-255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188, 23,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,235, 20,227,188, 19,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189,
- 15, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 59,138, 94,189,147,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 27,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104, 41, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,191,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,247,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0, 72,127, 35,188,  0, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188,
- 14,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,171, 20,227,188, 13,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,152,127, 35,189, 13, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 27,138, 94,189,147,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,251, 84,145,189,
- 27,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,136, 42, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 85,145,186,127,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0, 39, 85,145,187,
-223,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,184,127, 35,188,247, 61, 14, 61,219,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 31, 85,145,188,255,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,243, 20,227,188,  3,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,188,127, 35,189,
-  7, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 67,138, 94,189,141,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 17, 85,145,189, 22,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168, 43, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,255,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,168,127, 35,188,255, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,
- 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,219, 20,227,188,  7,143,197, 61, 82,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189, 11, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 67,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189,
- 27,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,200, 44, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0, 71, 84,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,199, 84,145,187,
-255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,136,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,255, 84,145,188, 23,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,211, 20,227,188, 19,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,170,127, 35,189,
- 15, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 56,138, 94,189,147,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 13, 85,145,189, 25,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232, 45, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 84,145,187, 63,224,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0, 72,127, 35,188, 15, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,199, 84,145,188,
- 15,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,171, 20,227,188,  7,143,197, 61, 80,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,152,127, 35,189, 11, 62, 14, 62,163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 27,138, 94,189,147,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,255, 84,145,189,
- 19,224,124, 62,140, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,  8, 47, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 59,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,
-255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,128, 35,188,255, 61, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,103, 85,145,188,255,223,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0, 75, 21,227,188,  7,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,216,127, 35,189,
-  7, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 91,138, 94,189,143,155, 65, 62,186,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189, 23,224,124, 62,143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40, 48, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 58,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187, 31,224,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,  8,128, 35,188, 15, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188,
- 23,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 43, 21,227,188, 27,143,197, 61, 82,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189, 19, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 91,138, 94,189,155,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189,
- 35,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 72, 49, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 84,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,
-191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,104,127, 35,188,255, 61, 14, 61,219,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188, 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,187, 20,227,188,  7,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,152,127, 35,189,
- 11, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 35,138, 94,189,143,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,255, 84,145,189, 23,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104, 50, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 59,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,200,127, 35,188,255, 61, 14, 61,221,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188,
- 15,224,124, 61,128,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 11, 21,227,188, 15,143,197, 61, 82,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189, 13, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 75,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189,
- 29,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,136, 51, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,
- 31,224,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,136,127, 35,188,  7, 62, 14, 61,219,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188, 23,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,203, 20,227,188, 19,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189,
- 13, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 75,138, 94,189,149,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 33,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168, 52, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,135, 84,145,186,255,223,124, 59, 58,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,215, 84,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,144,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,251, 84,145,188,
- 15,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,207, 20,227,188, 15,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,166,127, 35,189, 13, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 45,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,  8, 85,145,189,
- 27,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,200, 53, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 86,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,
-191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188,239, 61, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188,255,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0, 11, 21,227,188,255,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189,
-  7, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 91,138, 94,189,139,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189, 15,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232, 54, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,255,223,124, 59, 58,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,168,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188,
- 15,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,219, 20,227,188, 15,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189, 13, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 51,138, 94,189,145,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189,
- 29,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,  8, 56, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,
-255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188,255, 61, 14, 61,221,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188, 15,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0, 11, 21,227,188,  7,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,
- 11, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 75,138, 94,189,143,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 23,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40, 57, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 82,145,186,255,223,124, 59, 59,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 83,145,187,191,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,200,126, 35,188,239, 61, 14, 61,221,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,135, 84,145,188,
-255,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 75, 20,227,188,255,142,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0, 88,127, 35,189,255, 61, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0,219,137, 94,189,135,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,223, 84,145,189,
- 15,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 72, 58, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 85,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,
-191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,168,127, 35,188,239, 61, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188,255,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,235, 20,227,188,255,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,
-  3, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 67,138, 94,189,137,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 11, 85,145,189, 15,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104, 59, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,127,223,124, 59, 56,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,223,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,200,127, 35,188,251, 61, 14, 61,218,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,
-  3,224,124, 61,124,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188,  8,143,197, 61, 80,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 10, 62, 14, 62,163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 27,138, 94,189,143,155, 65, 62,183,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,247, 84,145,189,
- 24,224,124, 62,140, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,136, 60, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 86,145,186,255,224,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,
- 63,224,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,128, 35,188, 15, 62, 14, 61,221,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188, 31,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0, 11, 21,227,188, 27,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,216,127, 35,189,
- 23, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 91,138, 94,189,157,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189, 37,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168, 61, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 87,145,186, 15,224,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187, 19,224,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,232,127, 35,188, 12, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188,
- 28,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 11, 21,227,188, 25,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189, 19, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 91,138, 94,189,155,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189,
- 35,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,200, 62, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 85,145,186, 63,224,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,
-255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,168,127, 35,188,  3, 62, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 19,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,219, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189,
- 13, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 51,138, 94,189,148,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 11, 85,145,189, 29,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232, 63, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186, 33,224,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187, 29,224,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,  8,128, 35,188, 11, 62, 14, 61,221,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188,
- 24,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 43, 21,227,188, 24,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189, 18, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 91,138, 94,189,157,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189,
- 37,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,  8, 65, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0, 71, 85,145,187,
-255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188,255, 61, 14, 61,219,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188, 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,235, 20,227,188, 15,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,
- 11, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 75,138, 94,189,143,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 27, 85,145,189, 23,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40, 66, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 82,145,186,255,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 84,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,  8,127, 35,188,  7, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,167, 84,145,188,
- 15,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,139, 20,227,188, 15,143,197, 61, 80,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,136,127, 35,189, 11, 62, 14, 62,163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 11,138, 94,189,143,155, 65, 62,183,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,247, 84,145,189,
- 23,224,124, 62,140, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 72, 67, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,135, 84,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,215, 84,145,187,
-191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,152,127, 35,188,255, 61, 14, 61,219,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,255, 84,145,188, 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,223, 20,227,188, 15,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,174,127, 35,189,
- 11, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 57,138, 94,189,147,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 12, 85,145,189, 27,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104, 68, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 58,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,200,127, 35,188,255, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,
- 15,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188, 15,143,197, 61, 82,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189, 15, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 75,138, 94,189,147,155, 65, 62,186,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189,
- 31,224,124, 62,143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,136, 69, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 86,145,186,191,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,
- 15,224,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,128, 35,188,  7, 62, 14, 61,221,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188, 23,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0, 11, 21,227,188, 17,143,197, 61, 83,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189,
- 14, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 91,138, 94,189,146,155, 65, 62,186,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 26,224,124, 62,143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168, 70, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 58,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,200,127, 35,188,239, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188,
-255,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 11, 21,227,188,  7,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  7, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 75,138, 94,189,139,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189,
- 19,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,200, 71, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 85,145,186,127,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0, 71, 85,145,187,
-191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,168,127, 35,188,239, 61, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188,255,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,251, 20,227,188,  3,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,192,127, 35,189,
-  6, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 67,138, 94,189,140,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 19, 85,145,189, 21,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232, 72, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,127,223,124, 59, 56,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,223,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,136,127, 35,188,247, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188,
-255,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188,  7,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  7, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 91,138, 94,189,141,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189,
- 23,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,  8, 74, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,
-255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188, 15, 62, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188, 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,235, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,
- 11, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 75,138, 94,189,143,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 23,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40, 75, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,224,124, 59, 58,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187, 63,224,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0, 72,127, 35,188, 47, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188,
- 63,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,203, 20,227,188, 47,143,197, 61, 80,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 27, 62, 14, 62,163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 43,138, 94,189,167,155, 65, 62,183,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,255, 84,145,189,
- 51,224,124, 62,139, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 72, 76, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,135, 84,145,186, 31,224,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,199, 84,145,187,
- 31,224,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,152,127, 35,188, 16, 62, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 31,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,215, 20,227,188, 22,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,172,127, 35,189,
- 17, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 53,138, 94,189,151,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,  9, 85,145,189, 32,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104, 77, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,255,223,124, 59, 58,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,199, 84,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,136,127, 35,188,255, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,247, 84,145,188,
-255,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,219, 20,227,188, 15,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189,  7, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 59,138, 94,189,143,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189,
- 23,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,136, 78, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 84,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,
-191,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,104,127, 35,188,239, 61, 14, 61,219,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188,247,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,171, 20,227,188,  3,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,152,127, 35,189,
-  7, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 35,138, 94,189,145,155, 65, 62,183,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,255, 84,145,189, 26,224,124, 62,140, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168, 79, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 58,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,200,127, 35,188,255, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,
- 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188,  7,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  7, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 75,138, 94,189,143,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189,
- 23,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,200, 80, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,191, 84,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,229, 84,145,187,
-191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,154,127, 35,188,255, 61, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,255,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,232, 20,227,188,  7,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,182,127, 35,189,
-  7, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 65,138, 94,189,139,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 16, 85,145,189, 19,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232, 81, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 58,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,199, 84,145,187, 31,224,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,168,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,247, 84,145,188,
- 15,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,219, 20,227,188, 15,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 13, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 51,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,  7, 85,145,189,
- 31,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,  8, 83, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 84,145,186,255,224,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,
- 63,224,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0, 72,127, 35,188, 47, 62, 14, 61,219,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188, 47,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,171, 20,227,188, 47,143,197, 61, 80,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,152,127, 35,189,
- 27, 62, 14, 62,163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 27,138, 94,189,167,155, 65, 62,183,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,247, 84,145,189, 49,224,124, 62,139, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40, 84, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 56,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 84,145,187,191,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,  8,127, 35,188,239, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,167, 84,145,188,
-255,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,107, 20,227,188, 11,143,197, 61, 80,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,104,127, 35,189,  9, 62, 14, 62,163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0,251,137, 94,189,143,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,239, 84,145,189,
- 23,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 72, 85, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 56,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,
-255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0, 72,127, 35,188, 15, 62, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188, 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,171, 20,227,188, 31,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,152,127, 35,189,
- 15, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 11,138, 94,189,159,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,247, 84,145,189, 39,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104, 86, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,255,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,200,127, 35,188,255, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188,
-255,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188,  7,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,192,127, 35,189,  7, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 67,138, 94,189,139,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 19, 85,145,189,
- 19,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,136, 87, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 84,145,186,127,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,
-191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,136,127, 35,188,239, 61, 14, 61,219,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,247,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,235, 20,227,188,255,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189,
-  5, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 59,138, 94,189,138,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 19,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168, 88, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 58,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,136,127, 35,188,255, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188,
- 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,203, 20,227,188,  7,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 11, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 59,138, 94,189,147,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189,
- 27,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,200, 89, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,135, 84,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,231, 84,145,187,
- 15,224,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,136,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,247, 84,145,188, 19,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,203, 20,227,188, 17,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,164,127, 35,189,
- 14, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 51,138, 94,189,148,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,  7, 85,145,189, 30,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232, 90, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 83,145,186,255,222,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0, 71, 84,145,187,191,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0, 40,127, 35,188,223, 61, 14, 61,218,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,199, 84,145,188,
-239,223,124, 61,124,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,155, 20,227,188,255,142,197, 61, 80,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,128,127, 35,189,255, 61, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 11,138, 94,189,131,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,243, 84,145,189,
- 15,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,  8, 92, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 84,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,
-191,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0, 72,127, 35,188,239, 61, 14, 61,218,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,199, 84,145,188,255,223,124, 61,124,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,139, 20,227,188,247,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,120,127, 35,189,
-255, 61, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,251,137, 94,189,131,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,239, 84,145,189, 11,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40, 93, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,200,127, 35,188, 15, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188,
- 31,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 11, 21,227,188, 23,143,197, 61, 82,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189, 15, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 91,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 39, 85,145,189,
- 27,224,124, 62,143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 72, 94, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 86,145,186,255,222,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,
-191,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,128, 35,188,239, 61, 14, 61,221,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,103, 85,145,188,255,223,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0, 43, 21,227,188,255,142,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189,
-  3, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 75,138, 94,189,135,155, 65, 62,186,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 19,224,124, 62,143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104, 95, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 59,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,200,127, 35,188, 15, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188,
- 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 11, 21,227,188, 15,143,197, 61, 82,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189, 15, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 91,138, 94,189,151,155, 65, 62,186,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189,
- 27,224,124, 62,143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,136, 96, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 85,145,186,127,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,199, 84,145,187,
-191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,136,127, 35,188,231, 61, 14, 61,219,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,215, 84,145,188,231,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,171, 20,227,188,247,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,152,127, 35,189,
-  1, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 27,138, 94,189,135,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,251, 84,145,189, 15,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168, 97, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 83,145,186,191,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,239,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,104,127, 35,188,  3, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188,
- 15,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,187, 20,227,188, 15,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,152,127, 35,189, 11, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 35,138, 94,189,145,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,255, 84,145,189,
- 25,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,200, 98, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 86,145,186, 63,224,124, 59, 56,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,
- 47,224,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,136,127, 35,188, 15, 62, 14, 61,218,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 29,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,235, 20,227,188, 24,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189,
- 17, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 59,138, 94,189,155,155, 65, 62,183,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,  7, 85,145,189, 35,224,124, 62,140, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232, 99, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,  8,128, 35,188,  7, 62, 14, 61,221,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188,
- 23,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 43, 21,227,188, 23,143,197, 61, 82,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,216,127, 35,189, 15, 62, 14, 62,166,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 91,138, 94,189,150,155, 65, 62,186,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189,
- 30,224,124, 62,143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,  8,101, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,
- 15,224,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188, 11, 62, 14, 61,221,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 23,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,235, 20,227,188, 19,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,
- 17, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 75,138, 94,189,151,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 33,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40,102, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,191,223,124, 59, 59,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187, 15,224,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,  8,128, 35,188,  7, 62, 14, 61,221,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188,
- 19,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188, 17,143,197, 61, 82,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189, 14, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 75,138, 94,189,151,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189,
- 34,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 72,103, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,103, 84,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,191, 84,145,187,
- 63,224,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,144,127, 35,188, 15, 62, 14, 61,219,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  3, 85,145,188, 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,223, 20,227,188,  7,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,174,127, 35,189,
- 11, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 63,138, 94,189,147,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 27,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104,104, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,191,223,124, 59, 59,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,  3,224,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,  8,128, 35,188,  4, 62, 14, 61,221,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188,
- 18,224,124, 61,128,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 43, 21,227,188, 15,143,197, 61, 82,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189, 14, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 91,138, 94,189,149,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189,
- 26,224,124, 62,143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,136,105, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 84,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,199, 84,145,187,
-191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,136,127, 35,188,239, 61, 14, 61,219,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,247, 84,145,188,247,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,203, 20,227,188,  3,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,160,127, 35,189,
-  7, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 51,138, 94,189,145,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,  7, 85,145,189, 25,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168,106, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 87,145,186,255,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,199, 85,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0, 40,128, 35,188, 15, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188,
- 31,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 27, 21,227,188, 31,143,197, 61, 80,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,208,127, 35,189, 27, 62, 14, 62,163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 91,138, 94,189,163,155, 65, 62,183,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 27, 85,145,189,
- 43,224,124, 62,140, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,200,107, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 59,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,
-255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,128, 35,188,  7, 62, 14, 61,221,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188, 15,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,235, 20,227,188, 19,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,
- 13, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 75,138, 94,189,147,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 27,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232,108, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,127,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,207,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,  8,128, 35,188,244, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188,
-254,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 11, 21,227,188,  5,143,197, 61, 82,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  9, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 75,138, 94,189,143,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189,
- 25,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,  8,110, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,
-241,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,168,127, 35,188,253, 61, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188, 11,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,219, 20,227,188, 13,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189,
- 12, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 59,138, 94,189,146,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 11, 85,145,189, 27,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40,111, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,199, 84,145,186,255,222,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,247, 84,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,160,127, 35,188,255, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 11, 85,145,188,
-255,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,231, 20,227,188, 15,143,197, 61, 82,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,178,127, 35,189,  7, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 61,138, 94,189,143,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 14, 85,145,189,
- 23,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 72,112, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 84,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,
-191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,136,127, 35,188,239, 61, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,239,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,203, 20,227,188,255,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,
-  3, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 75,138, 94,189,137,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 17,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104,113, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,135, 84,145,186,255,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,215, 84,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,140,127, 35,188, 15, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,251, 84,145,188,
- 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,219, 20,227,188, 15,143,197, 61, 82,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,178,127, 35,189, 15, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 61,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189,
- 27,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,136,114, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 85,145,186, 13,224,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,
- 31,224,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,168,127, 35,188,  9, 62, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188, 22,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,235, 20,227,188, 16,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189,
- 14, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 59,138, 94,189,148,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 30,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168,115, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,199, 84,145,186,255,222,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,231, 84,145,187,159,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,144,127, 35,188,231, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,
-239,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,217, 20,227,188,255,142,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,175,127, 35,189,  5, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 56,138, 94,189,140,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 11, 85,145,189,
- 21,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,200,116, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 86,145,186,255,224,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,
- 63,224,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0, 72,128, 35,188, 31, 62, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,103, 85,145,188, 47,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0, 75, 21,227,188, 39,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,248,127, 35,189,
- 27, 62, 14, 62,163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,139,138, 94,189,163,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 55, 85,145,189, 43,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232,117, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,255,222,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,199, 84,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,152,127, 35,188,239, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,
- 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,219, 20,227,188,  7,143,197, 61, 82,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189, 11, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 59,138, 94,189,139,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189,
- 19,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,  8,119, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 56,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0, 71, 84,145,187,
-191,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0, 72,127, 35,188,239, 61, 14, 61,219,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188,255,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,187, 20,227,188,255,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,152,127, 35,189,
-  3, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 35,138, 94,189,139,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,255, 84,145,189, 19,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40,120, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,255,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0, 71, 85,145,187,255,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,200,127, 35,188,239, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188,
-255,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,251, 20,227,188,  7,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  7, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 67,138, 94,189,139,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 19, 85,145,189,
- 19,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 72,121, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,199, 84,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,231, 84,145,187,
-255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,152,127, 35,188, 15, 62, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  3, 85,145,188, 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,235, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,180,127, 35,189,
- 11, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 63,138, 94,189,147,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 27,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104,122, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 58,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0, 39, 85,145,187, 31,224,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,168,127, 35,188, 15, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,255, 84,145,188,
- 39,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,227, 20,227,188, 33,143,197, 61, 82,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189, 24, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 67,138, 94,189,162,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 17, 85,145,189,
- 45,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,136,123, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 85,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,199, 84,145,187,
-255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,136,127, 35,188,255, 61, 14, 61,219,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 15,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,219, 20,227,188,  7,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189,
- 11, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 59,138, 94,189,143,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 19,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168,124, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,135, 84,145,186,255,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,231, 84,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,152,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,255, 84,145,188,
- 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,219, 20,227,188, 15,143,197, 61, 82,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 15, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 51,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,  9, 85,145,189,
- 27,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,200,125, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 82,145,186,223,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 84,145,187,
-235,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,126, 35,188,251, 61, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,167, 84,145,188,  9,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,107, 20,227,188, 11,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,120,127, 35,189,
- 11, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,251,137, 94,189,145,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,239, 84,145,189, 28,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232,126, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,255,222,124, 59, 56,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0, 39, 85,145,187,191,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,168,127, 35,188,239, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188,
-255,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,  3, 21,227,188,  7,143,197, 61, 80,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,196,127, 35,189,  7, 62, 14, 62,163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 87,138, 94,189,143,155, 65, 62,183,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 29, 85,145,189,
- 23,224,124, 62,140, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,  8,128, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 84,145,186,191,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 84,145,187,
-223,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0, 72,127, 35,188,251, 61, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,199, 84,145,188, 11,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,155, 20,227,188, 13,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,136,127, 35,189,
- 12, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 19,138, 94,189,144,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,247, 84,145,189, 24,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40,129, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 58,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187, 31,224,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,  8,128, 35,188,  7, 62, 14, 61,221,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188,
- 15,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 11, 21,227,188, 11,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189, 11, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 91,138, 94,189,143,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189,
- 23,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 72,130, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,
-239,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,168,127, 35,188,  3, 62, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 15,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,219, 20,227,188, 17,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189,
- 13, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 59,138, 94,189,149,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 29,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104,131, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,135, 86,145,186,255,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,103, 85,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,248,127, 35,188,255, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 55, 85,145,188,
- 15,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 35, 21,227,188, 15,143,197, 61, 80,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,220,127, 35,189, 15, 62, 14, 62,162,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0,107,138, 94,189,151,155, 65, 62,182,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 37, 85,145,189,
- 31,224,124, 62,139, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,136,132, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,135, 86,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,103, 85,145,187,
-255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,184,127, 35,188, 15, 62, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 31,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,235, 20,227,188, 31,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,180,127, 35,189,
- 23, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 71,138, 94,189,159,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 18, 85,145,189, 43,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168,133, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,255,222,124, 59, 56,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0, 39, 85,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,168,127, 35,188, 15, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 15, 85,145,188,
- 15,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,243, 20,227,188, 15,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189, 11, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 83,138, 94,189,151,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 25, 85,145,189,
- 27,224,124, 62,140, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,200,134, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 86,145,186,255,222,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,
-191,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,128, 35,188,239, 61, 14, 61,221,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188,255,223,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0, 75, 21,227,188,  7,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,216,127, 35,189,
-  7, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0,107,138, 94,189,143,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189, 23,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232,135, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,255,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187, 63,224,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,168,127, 35,188, 15, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,
- 31,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,219, 20,227,188, 23,143,197, 61, 82,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189, 15, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 67,138, 94,189,151,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 19, 85,145,189,
- 31,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,  8,137, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 85,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0, 71, 85,145,187,
-255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188,255, 61, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188, 15,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,235, 20,227,188, 15,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189,
- 15, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 59,138, 94,189,147,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 19, 85,145,189, 31,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40,138, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,143,223,124, 59, 56,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,223,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,200,127, 35,188,251, 61, 14, 61,218,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188,
-  2,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188, 11,143,197, 61, 80,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 11, 62, 14, 62,163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 43,138, 94,189,145,155, 65, 62,183,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,  7, 85,145,189,
- 27,224,124, 62,139, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 72,139, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 85,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,
-255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,168,127, 35,188, 15, 62, 14, 61,219,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188, 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,235, 20,227,188,  7,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189,
- 11, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 67,138, 94,189,147,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 19, 85,145,189, 27,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104,140, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,255,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,231, 84,145,187,191,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,152,127, 35,188,239, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 15, 85,145,188,
-255,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188,255,142,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  7, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 75,138, 94,189,143,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 19, 85,145,189,
- 23,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,136,141, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 84,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,
-191,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,127, 35,188,239, 61, 14, 61,218,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,199, 84,145,188,239,223,124, 61,124,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,139, 20,227,188,247,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,120,127, 35,189,
-251, 61, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 11,138, 94,189,131,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,239, 84,145,189, 11,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168,142, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,255,222,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0, 39, 85,145,187,191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,176,127, 35,188,239, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 19, 85,145,188,
-239,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,231, 20,227,188,255,142,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,179,127, 35,189,  5, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 65,138, 94,189,139,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 16, 85,145,189,
- 21,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,200,143, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,199, 84,145,187,
-255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,104,127, 35,188,255, 61, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,239, 84,145,188, 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,203, 20,227,188, 11,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,164,127, 35,189,
- 11, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 51,138, 94,189,145,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 11, 85,145,189, 25,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232,144, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,127,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,207,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,200,127, 35,188,243, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188,
-251,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188,  3,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  7, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 75,138, 94,189,141,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189,
- 23,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,  8,146, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 85,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,
-255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,168,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 15,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,219, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189,
- 13, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 51,138, 94,189,147,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 11, 85,145,189, 27,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40,147, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,127,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,223,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,200,127, 35,188,247, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,
-255,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188,  3,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  6, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 75,138, 94,189,141,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189,
- 22,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 72,148, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 59,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0, 71, 85,145,187,
- 13,224,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,168,127, 35,188,  5, 62, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 19,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,227, 20,227,188, 17,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189,
- 14, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 59,138, 94,189,149,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 13, 85,145,189, 31,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104,149, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,151, 84,145,186,255,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,219, 84,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,140,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,249, 84,145,188,
- 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,205, 20,227,188, 15,143,197, 61, 82,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 15, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 51,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 10, 85,145,189,
- 27,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,136,150, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,
-255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,128, 35,188,255, 61, 14, 61,219,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188, 15,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0, 11, 21,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189,
-  7, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 91,138, 94,189,143,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 27, 85,145,189, 23,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168,151, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,175, 84,145,186,255,222,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,224, 84,145,187,191,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,142,127, 35,188,239, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  1, 85,145,188,
-239,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,207, 20,227,188,255,142,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,164,127, 35,189,  3, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 42,138, 94,189,135,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,  4, 85,145,189,
- 15,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,200,152, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,
- 31,224,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188, 23,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,235, 20,227,188, 19,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189,
- 15, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 59,138, 94,189,147,155, 65, 62,186,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 31,224,124, 62,143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232,153, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,127,223,124, 59, 56,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0, 39, 85,145,187,223,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,176,127, 35,188,239, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 19, 85,145,188,
-255,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,231, 20,227,188,  3,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,178,127, 35,189,  9, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 63,138, 94,189,143,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189,
- 24,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,  8,155, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,
- 31,224,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,136,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,235, 20,227,188, 19,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,
- 15, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 75,138, 94,189,151,155, 65, 62,186,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 31,224,124, 62,143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40,156, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,136,127, 35,188,  7, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,
- 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,203, 20,227,188, 15,143,197, 61, 82,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189, 15, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 75,138, 94,189,151,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189,
- 31,224,124, 62,143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 72,157, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 56,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,
-255,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0, 72,127, 35,188,255, 61, 14, 61,217,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188, 15,224,124, 61,123,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,203, 20,227,188, 15,143,197, 61, 80,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189,
- 11, 62, 14, 62,163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 59,138, 94,189,147,155, 65, 62,182,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,  7, 85,145,189, 27,224,124, 62,139, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104,158, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0, 71, 85,145,186,255,223,124, 59, 56,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0, 39, 85,145,187,255,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,144,127, 35,188, 15, 62, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,255, 84,145,188,
- 31,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,223, 20,227,188, 31,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189, 23, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 63,138, 94,189,161,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 14, 85,145,189,
- 43,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,136,159, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,
- 15,224,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,136,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188, 15,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,203, 20,227,188, 17,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189,
- 15, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 59,138, 94,189,150,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 30,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168,160, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 84,145,186,255,223,124, 59, 56,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,255,223,124, 60,185, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0, 72,127, 35,188,255, 61, 14, 61,217,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,231, 84,145,188,
-255,223,124, 61,123,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,203, 20,227,188, 15,143,197, 61, 80,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,152,127, 35,189,  7, 62, 14, 62,163,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 43,138, 94,189,143,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,255, 84,145,189,
- 23,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,200,161, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 85,145,186,127,223,124, 59, 56,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,
-223,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,168,127, 35,188,247, 61, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188,255,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,235, 20,227,188,  3,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189,
-  7, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 59,138, 94,189,141,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 23,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232,162, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,200,127, 35,188,239, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188,
-255,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188,  3,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,  5, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 75,138, 94,189,139,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189,
- 21,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,  8,164, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 59,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,
-255,223,124, 60,189, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188,  1, 62, 14, 61,221,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188, 16,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,235, 20,227,188, 15,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189,
- 13, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 67,138, 94,189,147,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 30,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40,165, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 58,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,223,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,136,127, 35,188,255, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,
-  7,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,203, 20,227,188, 11,143,197, 61, 82,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189, 11, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 59,138, 94,189,145,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189,
- 29,224,124, 62,143, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 72,166, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 86,145,186,191,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 85,145,187,
-255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,128, 35,188, 11, 62, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 39, 85,145,188, 19,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0, 11, 21,227,188, 21,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,200,127, 35,189,
- 17, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 91,138, 94,189,153,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 31, 85,145,189, 33,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104,167, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 86,145,187,255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,  8,128, 35,188,255, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 71, 85,145,188,
- 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0, 43, 21,227,188, 15,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,216,127, 35,189, 11, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0,107,138, 94,189,147,155, 65, 62,183,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 39, 85,145,189,
- 27,224,124, 62,140, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,136,168, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,
-255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,200,127, 35,188,  7, 62, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 15,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,203, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189,
- 13, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 43,138, 94,189,147,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 15, 85,145,189, 31,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168,169, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,135, 84,145,186,255,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,199, 84,145,187,255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,136,127, 35,188,255, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,255, 84,145,188,
- 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,215, 20,227,188,  7,143,197, 61, 82,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,174,127, 35,189, 11, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 57,138, 94,189,143,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 13, 85,145,189,
- 23,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,200,170, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,135, 84,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,231, 84,145,187,
-255,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,168,127, 35,188, 15, 62, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 15, 85,145,188, 31,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,211, 20,227,188, 23,143,197, 61, 82,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189,
- 15, 62, 14, 62,165,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 51,138, 94,189,147,155, 65, 62,185,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 11, 85,145,189, 27,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,232,171, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,255,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,247, 84,145,187,191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,152,127, 35,188,239, 61, 14, 61,219,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 11, 85,145,188,
-255,223,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,227, 20,227,188,255,142,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,180,127, 35,189,  7, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 73,138, 94,189,143,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 20, 85,145,189,
- 23,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,  8,173, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,135, 84,145,186,255,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,231, 84,145,187,
-255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,136,127, 35,188,255, 61, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,255, 84,145,188, 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,211, 20,227,188, 15,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189,
- 15, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 55,138, 94,189,147,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 12, 85,145,189, 27,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 40,174, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 86,145,186,255,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187, 63,224,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,200,127, 35,188, 15, 62, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,
- 31,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,235, 20,227,188, 23,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,184,127, 35,189, 15, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 75,138, 94,189,151,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189,
- 35,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0, 72,175, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,135, 84,145,186, 15,224,124, 59, 58,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,199, 84,145,187,
-251,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,152,127, 35,188,  8, 62, 14, 61,220,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188, 22,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,219, 20,227,188, 17,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,172,127, 35,189,
- 15, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 51,138, 94,189,148,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,  9, 85,145,189, 30,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,104,176, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  7, 85,145,186,255,223,124, 59, 58,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,191,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,168,127, 35,188,255, 61, 14, 61,220,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0, 23, 85,145,188,
- 15,224,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,219, 20,227,188, 15,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,176,127, 35,189, 11, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 67,138, 94,189,147,155, 65, 62,184,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 19, 85,145,189,
- 27,224,124, 62,141, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,136,177, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 84,145,186,255,222,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,  7, 85,145,187,
-191,223,124, 60,187, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,136,127, 35,188,239, 61, 14, 61,219,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,  7, 85,145,188,239,223,124, 61,126,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,203, 20,227,188,255,142,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,168,127, 35,189,
-  3, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 59,138, 94,189,137,155, 65, 62,184,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0, 23, 85,145,189, 17,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,168,178, 51,  3,  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,111, 84,145,186,255,223,124, 59, 57,146,131, 62,
-  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,173, 84,145,187,255,223,124, 60,188, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,
-  0,  0,  0,  0,116,127, 35,188,255, 61, 14, 61,221,123, 65, 63,  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,245, 84,145,188,
- 15,224,124, 61,127,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,  0,  0,  0,  0,199, 20,227,188, 13,143,197, 61, 81,  2,158, 63,
-  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,163,127, 35,189, 13, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,
-  0,  0,  0,  0, 47,138, 94,189,147,155, 65, 62,185,177,216, 63,  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,  6, 85,145,189,
- 28,224,124, 62,142, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,216,  0,  0,  0,200,179, 51,  3,
-  0,  0,  0,  0, 87,  1,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  7, 82,145,186,127,223,124, 59, 57,146,131, 62,  0,  0, 72, 65,  0,  0, 96, 63,  0,  0,  0,  0,135, 84,145,187,
-223,223,124, 60,186, 71,  2, 63,  0,  0,200, 65,  0,  0, 64, 63,  0,  0,  0,  0,  8,127, 35,188,247, 61, 14, 61,218,123, 65, 63,
-  0,  0, 22, 66,  0,  0, 32, 63,  0,  0,  0,  0,199, 84,145,188,  7,224,124, 61,125,101,127, 63,  0,  0, 72, 66,  0,  0,  0, 63,
-  0,  0,  0,  0,139, 20,227,188,  7,143,197, 61, 81,  2,158, 63,  0,  0,122, 66,  0,  0,192, 62,  0,  0,  0,  0,136,127, 35,189,
- 11, 62, 14, 62,164,172,187, 63,  0,  0,150, 66,  0,  0,128, 62,  0,  0,  0,  0, 27,138, 94,189,147,155, 65, 62,183,177,216, 63,
-  0,  0,175, 66,  0,  0,  0, 62,  0,  0,  0,  0,247, 84,145,189, 28,224,124, 62,140, 17,245, 63,  0,  0,200, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 16,  2,  0,  0,232,180, 51,  3,  0,  0,  0,  0,123,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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, 68, 65, 84, 65,112,  0,  0,  0, 72,183, 51,  3,  0,  0,  0,  0,101,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 19,  0,  0,  0, 23,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 80, 97,114,116,105, 99,108,101, 83,121,115,116,101,109, 32, 49,  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,248,152, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  4,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,  4,  0,  0,  0, 79, 66,  0,  0, 32,  5,  0,  0,  8,184, 51,  3,
-  0,  0,  0,  0,116,  0,  0,  0,  1,  0,  0,  0,120,189, 51,  3,  0,  0,  0,  0,  8,146, 50,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,112,114,101,118,105,101,119,108, 97,109,112,  0,  0,  0,  0,  0,  0,  0,
-  0, 97,109,112,  1,  0,  0,  4,  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, 10,  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,  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,  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, 40,208, 49,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,
-250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+200,120,198,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,
+  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,  0,  0,  0,192,197,211,188, 76,229, 59, 65,208,106,184, 64,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-247,215, 98,191, 71, 11, 72, 63,230,248,  6, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+184,119, 26,  4,  0,  0,  0,  0,  8,120, 26,  4,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0, 61, 16,183,188, 21,204,103,191,
+ 48,234,228, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,153, 39,155, 64,
+153, 39,155, 64,153, 39,155, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+218, 15,201, 63,  0,  0,192, 37,255,255,255, 36,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,212, 14, 29, 63,149,225,182, 62,
- 84, 76, 52,191,  0,  0,  0,  0, 22, 40, 74,191,201, 74,139, 62,228,198, 12,191,  0,  0,  0,  0, 84,213,157,187,151,190,100, 63,
-145,223,229, 62,  0,  0,  0,  0,192,197,211,188, 76,229, 59, 65,208,106,184, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,153, 39,155, 64,152, 39, 27, 38,
+102,187,232,166,  0,  0,  0,  0,102,187,232, 38,157,134,196, 52,153, 39,155, 64,  0,  0,  0,  0,154, 39, 27, 38,153, 39,155,192,
+157,134,196, 52,  0,  0,  0,  0, 61, 16,183,188, 21,204,103,191, 48,234,228, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,147, 39, 25, 51,
- 43, 47, 63,179,  0,  0,  0,  0,  9,108,247, 50,  0,  0,128, 63, 26, 92,142,178,  0,  0,  0,  0, 43,  4,114,179, 32, 59,141,178,
-  1,  0,128, 63,  0,  0,  0,  0,135,255,127,177,130,214, 10, 40,  1,  0,  0,181,  0,  0,128, 63,214, 14, 29, 63, 22, 40, 74,191,
-113,210,157,187,  0,  0,  0,  0, 85, 76, 52,191,228,198, 12,191,137,223,229, 62,  0,  0,  0,  0,154,225,182,190,205, 74,139,190,
-157,190,100,191,  0,  0,  0,  0,213, 36,158,192,107,186,110,192,102, 43,169,193,  0,  0,128, 63,214, 14, 29, 63, 22, 40, 74,191,
-113,210,157,187,  0,  0,  0,  0, 85, 76, 52,191,228,198, 12,191,137,223,229, 62,  0,  0,  0,  0,154,225,182,190,205, 74,139,190,
-157,190,100,191,  0,  0,  0,  0,213, 36,158,192,107,186,110,192,102, 43,169,193,  0,  0,128, 63,  0,  8,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  5,  0,  1,  0,  0,  0, 68,  0, 79, 66,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,236, 48,206,152,
+  9, 66, 41, 24,  0,  0,  0,  0,216, 55, 60,152,  0,  0,128, 63, 88,133,105,166,  0,  0,  0,  0,226,159, 91,151, 64,218, 93, 38,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63, 25, 50, 83, 62,147,101,158, 36,
+ 27, 50,211, 35,  0,  0,  0,  0,147,101,158,164, 25, 50, 83, 62,158, 59,174, 38,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 96,175,
+ 25, 50, 83, 62,  0,  0,  0,  0,236,251, 33, 59,135, 37, 40, 59,118, 71,238, 63,  0,  0,128, 63, 25, 50, 83, 62,147,101,158, 36,
+ 27, 50,211, 35,  0,  0,  0,  0,147,101,158,164, 25, 50, 83, 62,158, 59,174, 38,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 96,175,
+ 25, 50, 83, 62,  0,  0,  0,  0,236,251, 33, 59,135, 37, 40, 59,118, 71,238, 63,  0,  0,128, 63, 32,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
 100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  1,  0,  5,  0,  1,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  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,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  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,  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,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0,  0,  0,  5,  4,  1,
+  0,  0,128, 63,  0,  0,128, 63,  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,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,  0,  0, 32,  5,  0,  0,120,189, 51,  3,  0,  0,  0,  0,116,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,184, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 79, 66,116,101,120,116,117,114,101,  0,114,101,118,105,101,119, 46, 48, 48, 53,  0,  0,  0,  0,  1,  0,  0,  4,
-  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,  1,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  8,202, 55,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0,
- 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0,
- 10,  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, 68, 65, 84, 65,  8,  0,  0,  0,184,119, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0,  8,120, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0, 77, 65,  0,  0,128,  3,  0,  0, 88,120, 26,  4,  0,  0,  0,  0, 39,  0,  0,  0,  1,  0,  0,  0,104,142, 26,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,248,  8,  0,168, 69,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 99,104,
+101, 99,107,101,114,100, 97,114,107,  0,  0,  0, 97,116,101,114,105, 97,  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,
+  5,  0,  0,  0, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,
+128,192,224, 60,224,181,224, 60,224,181,224, 60,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,154,153, 89, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,205,204, 76, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 10,215, 35, 60,  0,  0,  0,  0,  0,  0,  8,  0,
+  1,  0, 50,  0,205,204, 76, 62,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,160, 63,  0,  0,  0,  0,  0,  0,160, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  2,  0,  2,  0,  1,  0,  0,  6,  0,  0,128, 63,  0,  0,128, 63, 18,  0, 18,  0, 10,215,163, 59, 10,215,163, 59,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  4,  0, 67,  0, 64,  1, 67,  0, 64,  1,  1,  0,  4,  0, 12,  0,  4,  0,  0,  0,  0, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  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,232,194, 51,  3,  0,  0,  0,  0, 56,195, 51,  3,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0, 61, 16,183,188,
- 21,204,103,191, 48,234,228, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-153, 39,155, 64,153, 39,155, 64,153, 39,155, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,218, 15,201, 63,  0,  0,192, 37,
-255,255,255, 36,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,153, 39,155, 64,152, 39, 27, 38,102,187,232,166,  0,  0,  0,  0,
-102,187,232, 38,157,134,196, 52,153, 39,155, 64,  0,  0,  0,  0,154, 39, 27, 38,153, 39,155,192,157,134,196, 52,  0,  0,  0,  0,
- 61, 16,183,188, 21,204,103,191, 48,234,228, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,236, 48,206,152,  9, 66, 41, 24,  0,  0,  0,  0,
-216, 55, 60,152,  0,  0,128, 63, 88,133,105,166,  0,  0,  0,  0,226,159, 91,151, 64,218, 93, 38,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63, 25, 50, 83, 62,147,101,158, 36, 27, 50,211, 35,  0,  0,  0,  0,
-147,101,158,164, 25, 50, 83, 62,158, 59,174, 38,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 96,175, 25, 50, 83, 62,  0,  0,  0,  0,
-236,251, 33, 59,135, 37, 40, 59,118, 71,238, 63,  0,  0,128, 63, 25, 50, 83, 62,147,101,158, 36, 27, 50,211, 35,  0,  0,  0,  0,
-147,101,158,164, 25, 50, 83, 62,158, 59,174, 38,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 96,175, 25, 50, 83, 62,  0,  0,  0,  0,
-236,251, 33, 59,135, 37, 40, 59,118, 71,238, 63,  0,  0,128, 63, 32,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  2,  0,
-  0,  0, 68,  0, 79, 66,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0,
- 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,236, 81, 56, 62,  0,  0,  0,  0,143,194,117, 61,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  1,  0,  5,  4,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  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,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0, 63,  0,  0,128, 64,  0,  0,  0, 63,205,204,204, 61,  0,  0,  0, 63,205,204,204, 61,205,204,204, 61,  0,  0,128, 63,
+ 16,  8,  1,  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,128, 63,
+  0,  0,128, 63, 40,124, 26,  4,  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,  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,128, 63,  0, 64,  1,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,
-  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, 25,  0,  0,  0,
-  0,  0,  0,  0,  1,  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,168,125, 26,  4,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,111,148, 26, 63,111,148, 26, 63,
+111,148, 26, 63,205,204, 76, 61,205,204,204, 61,102,102,166, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 56,  1,  0,  0, 40,124, 26,  4,  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0, 16,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,216,208, 26,  4,  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,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,  8,  0,  0,  0,232,194, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0, 56,195, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
- 77, 65,  0,  0, 32,  3,  0,  0,136,195, 51,  3,  0,  0,  0,  0, 35,  0,  0,  0,  1,  0,  0,  0, 24,217, 51,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,104,187,219,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 99,104,101, 99,107,101,
-114,100, 97,114,107,  0,  0,  0, 97,116,101,114,105, 97,  0,  0,  5,  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,  1,  0,128,192,224, 60,224,181,224, 60,224,181,224, 60,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-154,153, 89, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,205,204, 76, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,192, 63,
+  1,  0,192, 63,  1,  0,192, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 23,183,209, 56,184,177,209, 56,184,177,209, 56,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
   0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
- 10,215, 35, 60,  0,  0,  0,  0,  0,  0,  8,  0,  1,  0, 50,  0,205,204, 76, 62,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
-  0,  0,  0,  0,  0,  0,160, 63,  0,  0,  0,  0,  0,  0,160, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  2,  0,  2,  0,
-  1,  0,  0,  6,  0,  0,128, 63,  0,  0,128, 63, 18,  0, 18,  0, 10,215,163, 59, 10,215,163, 59,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  4,  0, 67,  0, 64,  1, 67,  0, 64,  1,  1,  0,  4,  0, 12,  0,  4,  0,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  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,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,
-  0,  0,128, 64,  0,  0,  0, 63,205,204,204, 61,  0,  0,  0, 63,205,204,204, 61,205,204,204, 61,  0,  0,128, 63, 16,  8,  1,  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,128, 63,  0,  0,128, 63,
-248,198, 51,  3,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 40,  0,  0,  0,168,125, 26,  4,  0,  0,  0,  0, 12,  0,  0,  0,
+  1,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0, 24,126, 26,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  0, 16,  0,  0, 24,126, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  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,  0,  1,  1,  1, 51,  1,  1,  1, 51,  2,  2,  2,153,
+  2,  2,  2,153,  3,  3,  3,153,  2,  2,  2,102,  2,  2,  2,102,  1,  1,  1, 51,  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,  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,  1,  1,  1, 51,  2,  2,  2,153,  3,  3,  3,204,  5,  5,  5,255,  5,  5,  5,255,  5,  5,  5,255,
+  5,  5,  5,255,  5,  5,  5,255,  5,  5,  5,255,  5,  5,  5,255,  5,  5,  5,255,  5,  5,  5,255,  2,  2,  2,102,  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,  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, 88,200, 51,  3,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,111,148, 26, 63,111,148, 26, 63,111,148, 26, 63,
-205,204, 76, 61,205,204,204, 61,102,102,166, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  1,  0,  0,
-248,198, 51,  3,  0,  0,  0,  0, 24,  0,  0,  0,  1,  0,  0,  0, 16,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-120, 25, 52,  3,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,192, 63,  1,  0,192, 63,
-  1,  0,192, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 23,183,209, 56,
-184,177,209, 56,184,177,209, 56,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,
-205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 40,  0,  0,  0, 88,200, 51,  3,  0,  0,  0,  0, 11,  0,  0,  0,  1,  0,  0,  0,
- 32,  0,  0,  0,  0,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,200,200, 51,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  0, 16,  0,  0,200,200, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  1,  1,  1, 51,  1,  1,  1, 51,  2,  2,  2,153,  2,  2,  2,153,
-  3,  3,  3,153,  2,  2,  2,102,  2,  2,  2,102,  1,  1,  1, 51,  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,  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,  1,  1,  1, 51,  2,  2,  2,153,  3,  3,  3,204,  5,  5,  5,255,  5,  5,  5,255,  5,  5,  5,255,  5,  5,  5,255,
-  5,  5,  5,255,  5,  5,  5,255,  5,  5,  5,255,  5,  5,  5,255,  5,  5,  5,255,  2,  2,  2,102,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  1,  1, 51,
-  2,  2,  2,153,  4,  4,  4,255,  5,  5,  5,255,  5,  5,  5,255,  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,
-  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,  5,  5,  5,255,  4,  4,  4,204,
-  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,  0,  0,  0,  0,  0,  0,  2,  2,  2,102,  4,  4,  4,204,
-  5,  5,  5,255,  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,
-  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,
-  5,  5,  5,255,  2,  2,  2,102,  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,  2,  2,  2,153,  5,  5,  5,255,  6,  6,  6,255,
-  6,  6,  6,255,  6,  6,  6,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,
-  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  6,  6,  6,255,  6,  6,  6,255,
-  6,  6,  6,255,  6,  6,  6,255,  3,  3,  3,153,  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,  2,  2,  2,102,  5,  5,  5,255,  6,  6,  6,255,  6,  6,  6,255,
-  7,  7,  7,255,  7,  7,  7,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,
+  1,  1,  1, 51,  2,  2,  2,153,  4,  4,  4,255,  5,  5,  5,255,  5,  5,  5,255,  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,
+  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,  5,  5,  5,255,
+  4,  4,  4,204,  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,  0,  0,  0,  0,  0,  0,  2,  2,  2,102,
+  4,  4,  4,204,  5,  5,  5,255,  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,  7,  7,  7,255,  7,  7,  7,255,
+  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,
+  6,  6,  6,255,  5,  5,  5,255,  2,  2,  2,102,  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,  2,  2,  2,153,  5,  5,  5,255,
+  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,
   7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  6,  6,  6,255,
   6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,  3,  3,  3,153,  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,  2,  2,  2,102,  5,  5,  5,255,  6,  6,  6,255,  7,  7,  7,255,  7,  7,  7,255,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  2,  2,102,  5,  5,  5,255,  6,  6,  6,255,
+  6,  6,  6,255,  7,  7,  7,255,  7,  7,  7,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,
+  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,
+  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,  3,  3,  3,153,  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,  2,  2,  2,102,  5,  5,  5,255,  6,  6,  6,255,  7,  7,  7,255,
+  7,  7,  7,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,
+  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,
+  7,  7,  7,255,  7,  7,  7,255,  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,  2,  2,  2,102,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  4,  4,204,  6,  6,  6,255,  7,  7,  7,255,  7,  7,  7,255,
   8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,
-  8,  8,  8,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,
-  7,  7,  7,255,  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,  2,  2,  2,102,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  4,  4,204,  6,  6,  6,255,  7,  7,  7,255,  7,  7,  7,255,  8,  8,  8,255,
+  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,
+  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,  1,  1,  1, 51,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  2,  2,102,  6,  6,  6,255,  7,  7,  7,255,  8,  8,  8,255,  8,  8,  8,255,
   8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,
-  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,
-  7,  7,  7,255,  7,  7,  7,255,  6,  6,  6,255,  6,  6,  6,255,  6,  6,  6,255,  1,  1,  1, 51,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  2,  2,  2,102,  6,  6,  6,255,  7,  7,  7,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,
-  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,
-  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,
-  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  6,  6,  6,255,  6,  6,  6,255,  5,  5,  5,204,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  6,  6,  6,255,  7,  7,  7,255,  8,  8,  8,255,  8,  8,  8,255,  9,  9,  9,255,  9,  9,  9,255,
-  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  8,  8,  8,255,  8,  8,  8,255,
   8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  7,  7,  7,255,
-  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  6,  6,  6,255,  6,  6,  6,255,  2,  2,  2,102,  0,  0,  0,  0,
-  0,  0,  0,  0,  2,  2,  2,102,  7,  7,  7,255,  8,  8,  8,255,  8,  8,  8,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,
-  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,
-  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,
   7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  6,  6,  6,255,  6,  6,  6,255,  5,  5,  5,204,  0,  0,  0,  0,
-  0,  0,  0,  0,  5,  5,  5,204,  7,  7,  7,255,  8,  8,  8,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  6,  6,255,  7,  7,  7,255,  8,  8,  8,255,  8,  8,  8,255,  9,  9,  9,255,
+  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  8,  8,  8,255,
+  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,
+  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  6,  6,  6,255,  6,  6,  6,255,  2,  2,  2,102,
+  0,  0,  0,  0,  0,  0,  0,  0,  2,  2,  2,102,  7,  7,  7,255,  8,  8,  8,255,  8,  8,  8,255,  9,  9,  9,255,  9,  9,  9,255,
   9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,
-  9,  9,  9,255,  9,  9,  9,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,
-  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  6,  6,  6,255,  6,  6,  6,255,  0,  0,  0,  0,
-  2,  2,  2,102,  7,  7,  7,255,  8,  8,  8,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,
+  9,  9,  9,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,
+  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  6,  6,  6,255,  6,  6,  6,255,  5,  5,  5,204,
+  0,  0,  0,  0,  0,  0,  0,  0,  5,  5,  5,204,  7,  7,  7,255,  8,  8,  8,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,
   9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,
   9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,
-  8,  8,  8,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  6,  6,  6,255,  3,  3,  3,102,
-  2,  2,  2,102,  7,  7,  7,255,  8,  8,  8,255,  9,  9,  9,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,
- 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,
+  8,  8,  8,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  6,  6,  6,255,  6,  6,  6,255,
+  0,  0,  0,  0,  2,  2,  2,102,  7,  7,  7,255,  8,  8,  8,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,
+  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,
   9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,
-  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  6,  6,  6,255,  4,  4,  4,153,
-  3,  3,  3,102,  8,  8,  8,255,  9,  9,  9,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,
- 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,  9,  9,  9,255,
+  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  6,  6,  6,255,
+  3,  3,  3,102,  2,  2,  2,102,  7,  7,  7,255,  8,  8,  8,255,  9,  9,  9,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,
+ 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,
   9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,
-  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  5,  5,  5,204,
-  4,  4,  4,153,  8,  8,  8,255,  9,  9,  9,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,
- 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,
+  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  6,  6,  6,255,
+  4,  4,  4,153,  3,  3,  3,102,  8,  8,  8,255,  9,  9,  9,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,
+ 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,
   9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  8,  8,  8,255,  8,  8,  8,255,
-  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  5,  5,  5,204,
-  4,  4,  4,153,  9,  9,  9,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,
+  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,
+  5,  5,  5,204,  4,  4,  4,153,  8,  8,  8,255,  9,  9,  9,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,
  10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,
  10, 10, 10,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  8,  8,  8,255,
-  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  5,  5,  5,204,
-  4,  4,  4,153,  9,  9,  9,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
- 11, 11, 11,255, 11, 11, 11,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,
+  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,
+  5,  5,  5,204,  4,  4,  4,153,  9,  9,  9,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,
+ 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,
  10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,
-  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  4,  4,  4,153,
-  3,  3,  3,102,  9,  9,  9,255, 10, 10, 10,255, 10, 10, 10,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
- 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,
+  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,
+  5,  5,  5,204,  4,  4,  4,153,  9,  9,  9,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 11, 11, 11,255, 11, 11, 11,255,
+ 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,
  10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,
-  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,  4,  4,  4,153,
-  2,  2,  2, 51,  9,  9,  9,255, 10, 10, 10,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
- 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 10, 10, 10,255, 10, 10, 10,255,
+  9,  9,  9,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,
+  4,  4,  4,153,  3,  3,  3,102,  9,  9,  9,255, 10, 10, 10,255, 10, 10, 10,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
+ 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,
  10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,
-  9,  9,  9,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  7,  7,  7,255,  3,  3,  3,102,
-  0,  0,  0,  0,  9,  9,  9,255, 10, 10, 10,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
+  9,  9,  9,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  7,  7,  7,255,  7,  7,  7,255,
+  4,  4,  4,153,  2,  2,  2, 51,  9,  9,  9,255, 10, 10, 10,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
  11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 10, 10, 10,255,
- 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,
-  9,  9,  9,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  7,  7,  7,255,  1,  1,  1, 51,
-  0,  0,  0,  0,  5,  5,  5,153, 10, 10, 10,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
+ 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,
+  9,  9,  9,255,  9,  9,  9,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  7,  7,  7,255,
+  3,  3,  3,102,  0,  0,  0,  0,  9,  9,  9,255, 10, 10, 10,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
  11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
  10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,
-  9,  9,  9,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  4,  4,  4,153,  0,  0,  0,  0,
-  0,  0,  0,  0,  2,  2,  2, 51, 10, 10, 10,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
+  9,  9,  9,255,  9,  9,  9,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  7,  7,  7,255,
+  1,  1,  1, 51,  0,  0,  0,  0,  5,  5,  5,153, 10, 10, 10,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
  11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
- 11, 11, 11,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,
-  9,  9,  9,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  4,  4,  4,153,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  8,  8,  8,204, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 12, 12, 12,255, 12, 12, 12,255,
- 12, 12, 12,255, 12, 12, 12,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
  11, 11, 11,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,  9,  9,  9,255,
-  9,  9,  9,255,  9,  9,  9,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  6,  6,  6,204,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  2,  2,  2, 51, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 12, 12, 12,255, 12, 12, 12,255,
- 12, 12, 12,255, 12, 12, 12,255, 12, 12, 12,255, 12, 12, 12,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
- 11, 11, 11,255, 11, 11, 11,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,  9,  9,  9,255,
-  9,  9,  9,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  1,  1,  1, 51,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  4,  4,102, 11, 11, 11,255, 11, 11, 11,255, 12, 12, 12,255, 12, 12, 12,255,
- 12, 12, 12,255, 12, 12, 12,255, 12, 12, 12,255, 12, 12, 12,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
+  9,  9,  9,255,  9,  9,  9,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  4,  4,  4,153,
+  0,  0,  0,  0,  0,  0,  0,  0,  2,  2,  2, 51, 10, 10, 10,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
+ 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
  11, 11, 11,255, 11, 11, 11,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,  9,  9,  9,255,
-  9,  9,  9,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  4,  4,  4,153,  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,  6,  6,  6,153, 11, 11, 11,255, 11, 11, 11,255, 12, 12, 12,255,
+  9,  9,  9,255,  9,  9,  9,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  4,  4,  4,153,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,  8,  8,204, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 12, 12, 12,255,
+ 12, 12, 12,255, 12, 12, 12,255, 12, 12, 12,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
+ 11, 11, 11,255, 11, 11, 11,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,
+  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  6,  6,  6,204,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  2,  2, 51, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 12, 12, 12,255,
  12, 12, 12,255, 12, 12, 12,255, 12, 12, 12,255, 12, 12, 12,255, 12, 12, 12,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
- 11, 11, 11,255, 11, 11, 11,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,  9,  9,  9,255,
-  9,  9,  9,255,  8,  8,  8,255,  8,  8,  8,255,  5,  5,  5,153,  1,  1,  1, 51,  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,  6,  6,  6,153, 11, 11, 11,255, 11, 11, 11,255,
+ 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,
+  9,  9,  9,255,  9,  9,  9,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  7,  7,  7,255,  1,  1,  1, 51,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  4,  4,102, 11, 11, 11,255, 11, 11, 11,255, 12, 12, 12,255,
  12, 12, 12,255, 12, 12, 12,255, 12, 12, 12,255, 12, 12, 12,255, 12, 12, 12,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
- 11, 11, 11,255, 11, 11, 11,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,  9,  9,  9,255,
-  9,  9,  9,255,  8,  8,  8,255,  6,  6,  6,204,  1,  1,  1, 51,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,
+  9,  9,  9,255,  9,  9,  9,255,  8,  8,  8,255,  8,  8,  8,255,  8,  8,  8,255,  4,  4,  4,153,  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,  6,  6,  6,153, 11, 11, 11,255, 11, 11, 11,255,
+ 12, 12, 12,255, 12, 12, 12,255, 12, 12, 12,255, 12, 12, 12,255, 12, 12, 12,255, 12, 12, 12,255, 11, 11, 11,255, 11, 11, 11,255,
+ 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,
+  9,  9,  9,255,  9,  9,  9,255,  8,  8,  8,255,  8,  8,  8,255,  5,  5,  5,153,  1,  1,  1, 51,  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,  6,  6,  6,153, 11, 11, 11,255,
- 11, 11, 11,255, 11, 11, 11,255, 12, 12, 12,255, 12, 12, 12,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
- 11, 11, 11,255, 11, 11, 11,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,
-  8,  8,  8,255,  5,  5,  5,153,  1,  1,  1, 51,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 11, 11, 11,255, 12, 12, 12,255, 12, 12, 12,255, 12, 12, 12,255, 12, 12, 12,255, 12, 12, 12,255, 11, 11, 11,255, 11, 11, 11,255,
+ 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,
+  9,  9,  9,255,  9,  9,  9,255,  8,  8,  8,255,  6,  6,  6,204,  1,  1,  1, 51,  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,  6,  6,  6,153,
+ 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 12, 12, 12,255, 12, 12, 12,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
+ 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,  9,  9,  9,255,
+  9,  9,  9,255,  8,  8,  8,255,  5,  5,  5,153,  1,  1,  1, 51,  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,  0,  0, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
+ 11, 11, 11,255, 11, 11, 11,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,  9,  9,  9,255,
+  7,  7,  7,204,  3,  3,  3,102,  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,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  6,  6,  6,153,  8,  8,  8,204, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
+ 11, 11, 11,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,  9,  9,  9,255,  7,  7,  7,204,  3,  3,  3,102,
+  1,  1,  1, 51,  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,  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,  4,  4,  4,102,  6,  6,  6,153,  6,  6,  6,153,
+  8,  8,  8,204,  8,  8,  8,204,  8,  8,  8,204,  5,  5,  5,153,  4,  4,  4,102,  2,  2,  2, 51,  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, 77, 65,  0,  0,128,  3,  0,  0,104,142, 26,  4,  0,  0,  0,  0, 39,  0,  0,  0,  1,  0,  0,  0,120,164, 26,  4,
+  0,  0,  0,  0, 88,120, 26,  4,  0,  0,  0,  0,168,  1,222,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 99,104,
+101, 99,107,101,114,108,105,103,104,116,  0,  0,  0, 97,116,101,114,105,  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,
+  8,  0,  0,  0, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,
+ 15,153,157, 62, 40,144,157, 62, 40,144,157, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,154,153, 89, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,205,204, 76, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 10,215, 35, 60,  0,  0,  0,  0,  0,  0,  8,  0,
+  1,  0, 50,  0,205,204, 76, 62,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,160, 63,  0,  0,  0,  0,  0,  0,160, 63,  0,  0,  0,  0,  0,  0,  0,  0,205,204,204, 61,
+  2,  0,  2,  0,  1,  0,  0,  6,  0,  0,128, 63,  0,  0,128, 63, 18,  0, 18,  0, 10,215,163, 59, 10,215,163, 59,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  4,  0, 67,  0, 64,  1, 67,  0, 64,  1,  1,  0,  4,  0, 12,  0,  4,  0,  0,  0,  0, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  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,
- 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
- 11, 11, 11,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,  9,  9,  9,255,  7,  7,  7,204,
-  3,  3,  3,102,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  6,  6,  6,153,  8,  8,  8,204, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255, 11, 11, 11,255,
- 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,  9,  9,  9,255,  7,  7,  7,204,  3,  3,  3,102,  1,  1,  1, 51,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0, 63,  0,  0,128, 64,  0,  0,  0, 63,205,204,204, 61,  0,  0,  0, 63,205,204,204, 61,205,204,204, 61,  0,  0,128, 63,
+ 16,  8,  1,  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,128, 63,
+  0,  0,128, 63, 56,146, 26,  4,  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,  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,  0,  0,  0,  0,  4,  4,  4,102,  6,  6,  6,153,  6,  6,  6,153,  8,  8,  8,204,
-  8,  8,  8,204,  8,  8,  8,204,  5,  5,  5,153,  4,  4,  4,102,  2,  2,  2, 51,  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,
- 77, 65,  0,  0, 32,  3,  0,  0, 24,217, 51,  3,  0,  0,  0,  0, 35,  0,  0,  0,  1,  0,  0,  0,168,238, 51,  3,  0,  0,  0,  0,
-136,195, 51,  3,  0,  0,  0,  0,168,  1,222,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 99,104,101, 99,107,101,
-114,108,105,103,104,116,  0,  0,  0, 97,116,101,114,105,  0,  0,  8,  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,  1,  0, 15,153,157, 62, 40,144,157, 62, 40,144,157, 62,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-154,153, 89, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,205,204, 76, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  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,184,147, 26,  4,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,111,148, 26, 63,111,148, 26, 63,
+111,148, 26, 63,205,204, 76, 61,205,204,204, 61,102,102,166, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 56,  1,  0,  0, 56,146, 26,  4,  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0, 16,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,216,208, 26,  4,  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,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 23,183,209, 56,184,177,209, 56,184,177,209, 56,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
   0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
- 10,215, 35, 60,  0,  0,  0,  0,  0,  0,  8,  0,  1,  0, 50,  0,205,204, 76, 62,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
-  0,  0,  0,  0,  0,  0,160, 63,  0,  0,  0,  0,  0,  0,160, 63,  0,  0,  0,  0,  0,  0,  0,  0,205,204,204, 61,  2,  0,  2,  0,
-  1,  0,  0,  6,  0,  0,128, 63,  0,  0,128, 63, 18,  0, 18,  0, 10,215,163, 59, 10,215,163, 59,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  4,  0, 67,  0, 64,  1, 67,  0, 64,  1,  1,  0,  4,  0, 12,  0,  4,  0,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  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,128, 63,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,
-  0,  0,128, 64,  0,  0,  0, 63,205,204,204, 61,  0,  0,  0, 63,205,204,204, 61,205,204,204, 61,  0,  0,128, 63, 16,  8,  1,  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,128, 63,  0,  0,128, 63,
-136,220, 51,  3,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 40,  0,  0,  0,184,147, 26,  4,  0,  0,  0,  0, 12,  0,  0,  0,
+  1,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0, 40,148, 26,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  0, 16,  0,  0, 40,148, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  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,  0,  6,  6,  6, 51,  6,  6,  6, 51, 18, 18, 18,153,
+ 19, 19, 19,153, 19, 19, 19,153, 13, 13, 13,102, 13, 13, 13,102,  6,  6,  6, 51,  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,  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,  6,  6,  6, 51, 18, 18, 18,153, 26, 26, 26,204, 34, 34, 34,255, 35, 35, 35,255, 37, 37, 37,255,
+ 38, 38, 38,255, 38, 38, 38,255, 38, 38, 38,255, 38, 38, 38,255, 37, 37, 37,255, 36, 36, 36,255, 15, 15, 15,102,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  5,  5,  5, 51, 18, 18, 18,153, 33, 33, 33,255, 37, 37, 37,255, 40, 40, 40,255, 42, 42, 42,255, 43, 43, 43,255, 44, 44, 44,255,
+ 44, 44, 44,255, 45, 45, 45,255, 44, 44, 44,255, 43, 43, 43,255, 43, 43, 43,255, 42, 42, 42,255, 41, 41, 41,255, 40, 40, 40,255,
+ 29, 29, 29,204,  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,  0,  0,  0,  0,  0,  0, 12, 12, 12,102,
+ 28, 28, 28,204, 38, 38, 38,255, 42, 42, 42,255, 45, 45, 45,255, 47, 47, 47,255, 48, 48, 48,255, 49, 49, 49,255, 50, 50, 50,255,
+ 50, 50, 50,255, 50, 50, 50,255, 50, 50, 50,255, 49, 49, 49,255, 48, 48, 48,255, 47, 47, 47,255, 46, 46, 46,255, 45, 45, 45,255,
+ 44, 44, 44,255, 41, 41, 41,255, 16, 16, 16,102,  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, 18, 18, 18,153, 36, 36, 36,255,
+ 42, 42, 42,255, 45, 45, 45,255, 48, 48, 48,255, 51, 51, 51,255, 53, 53, 53,255, 54, 54, 54,255, 55, 55, 55,255, 55, 55, 55,255,
+ 56, 56, 56,255, 56, 56, 56,255, 55, 55, 55,255, 55, 55, 55,255, 54, 54, 54,255, 53, 53, 53,255, 52, 52, 52,255, 50, 50, 50,255,
+ 48, 48, 48,255, 46, 46, 46,255, 44, 44, 44,255, 24, 24, 24,153,  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, 14, 14, 14,102, 38, 38, 38,255, 44, 44, 44,255,
+ 48, 48, 48,255, 52, 52, 52,255, 54, 54, 54,255, 56, 56, 56,255, 58, 58, 58,255, 59, 59, 59,255, 60, 60, 60,255, 60, 60, 60,255,
+ 61, 61, 61,255, 61, 61, 61,255, 60, 60, 60,255, 60, 60, 60,255, 59, 59, 59,255, 58, 58, 58,255, 57, 57, 57,255, 55, 55, 55,255,
+ 53, 53, 53,255, 51, 51, 51,255, 48, 48, 48,255, 46, 46, 46,255, 25, 25, 25,153,  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, 13, 13, 13,102, 39, 39, 39,255, 46, 46, 46,255, 50, 50, 50,255,
+ 54, 54, 54,255, 57, 57, 57,255, 59, 59, 59,255, 61, 61, 61,255, 63, 63, 63,255, 64, 64, 64,255, 65, 65, 65,255, 65, 65, 65,255,
+ 66, 66, 66,255, 66, 66, 66,255, 65, 65, 65,255, 65, 65, 65,255, 64, 64, 64,255, 63, 63, 63,255, 62, 62, 62,255, 60, 60, 60,255,
+ 58, 58, 58,255, 56, 56, 56,255, 53, 53, 53,255, 50, 50, 50,255, 47, 47, 47,255, 17, 17, 17,102,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 32, 32,204, 46, 46, 46,255, 52, 52, 52,255, 56, 56, 56,255,
+ 59, 59, 59,255, 62, 62, 62,255, 64, 64, 64,255, 66, 66, 66,255, 67, 67, 67,255, 69, 69, 69,255, 70, 70, 70,255, 70, 70, 70,255,
+ 70, 70, 70,255, 70, 70, 70,255, 70, 70, 70,255, 69, 69, 69,255, 68, 68, 68,255, 68, 68, 68,255, 66, 66, 66,255, 65, 65, 65,255,
+ 63, 63, 63,255, 60, 60, 60,255, 58, 58, 58,255, 54, 54, 54,255, 51, 51, 51,255, 47, 47, 47,255,  7,  7,  7, 51,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16, 16, 16,102, 46, 46, 46,255, 52, 52, 52,255, 57, 57, 57,255, 61, 61, 61,255,
+ 64, 63, 63,255, 66, 66, 66,255, 69, 69, 69,255, 71, 70, 70,255, 72, 72, 72,255, 73, 73, 73,255, 74, 74, 74,255, 75, 75, 75,255,
+ 75, 75, 75,255, 75, 75, 75,255, 75, 74, 74,255, 73, 73, 73,255, 73, 73, 73,255, 72, 72, 72,255, 71, 71, 71,255, 69, 69, 69,255,
+ 67, 67, 67,255, 65, 65, 65,255, 62, 62, 62,255, 59, 59, 59,255, 55, 55, 55,255, 52, 52, 52,255, 38, 38, 38,204,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 43, 43, 43,255, 52, 52, 52,255, 57, 57, 57,255, 61, 61, 61,255, 65, 65, 65,255,
+ 68, 68, 68,255, 71, 71, 71,255, 73, 73, 73,255, 75, 75, 75,255, 77, 77, 77,255, 78, 78, 78,255, 79, 78, 78,255, 79, 79, 79,255,
+ 79, 79, 79,255, 79, 79, 79,255, 79, 79, 79,255, 78, 78, 78,255, 77, 77, 77,255, 76, 76, 76,255, 75, 75, 75,255, 73, 73, 73,255,
+ 71, 71, 71,255, 70, 70, 70,255, 67, 67, 67,255, 64, 64, 64,255, 59, 59, 59,255, 55, 55, 55,255, 51, 51, 51,255, 18, 18, 18,102,
+  0,  0,  0,  0,  0,  0,  0,  0, 17, 17, 17,102, 50, 50, 50,255, 56, 56, 56,255, 62, 61, 61,255, 66, 66, 66,255, 69, 69, 69,255,
+ 73, 73, 73,255, 75, 75, 75,255, 77, 77, 77,255, 79, 79, 79,255, 81, 81, 81,255, 82, 82, 82,255, 83, 83, 83,255, 84, 84, 84,255,
+ 84, 84, 84,255, 84, 84, 84,255, 83, 83, 83,255, 83, 83, 83,255, 82, 82, 82,255, 80, 80, 80,255, 79, 79, 79,255, 78, 78, 78,255,
+ 77, 77, 77,255, 74, 74, 74,255, 71, 71, 71,255, 68, 68, 68,255, 64, 64, 64,255, 59, 59, 59,255, 54, 54, 54,255, 40, 40, 40,204,
+  0,  0,  0,  0,  0,  0,  0,  0, 37, 37, 37,204, 55, 55, 55,255, 61, 61, 61,255, 66, 66, 66,255, 70, 70, 70,255, 73, 73, 73,255,
+ 77, 77, 77,255, 79, 79, 79,255, 81, 81, 81,255, 84, 84, 84,255, 85, 85, 85,255, 87, 87, 87,255, 87, 87, 87,255, 88, 88, 88,255,
+ 89, 89, 89,255, 88, 88, 88,255, 88, 88, 88,255, 87, 87, 87,255, 88, 88, 88,255, 84, 84, 84,255, 83, 83, 83,255, 83, 83, 83,255,
+ 81, 81, 81,255, 79, 79, 79,255, 76, 76, 76,255, 72, 72, 72,255, 68, 68, 68,255, 63, 63, 63,255, 57, 57, 57,255, 52, 52, 52,255,
+  0,  0,  0,  0, 14, 14, 14,102, 50, 50, 50,255, 59, 59, 59,255, 65, 65, 65,255, 70, 70, 70,255, 74, 74, 74,255, 78, 78, 78,255,
+ 81, 81, 81,255, 84, 84, 84,255, 86, 86, 86,255, 88, 88, 88,255, 90, 90, 90,255, 91, 91, 91,255, 92, 92, 92,255, 92, 92, 92,255,
+ 93, 93, 93,255, 94, 94, 94,255, 93, 93, 93,255, 93, 93, 93,255, 95, 95, 95,255, 90, 90, 90,255, 90, 90, 90,255, 89, 89, 89,255,
+ 86, 86, 86,255, 83, 83, 83,255, 80, 80, 80,255, 77, 77, 77,255, 72, 72, 72,255, 67, 67, 67,255, 61, 61, 61,255, 55, 55, 55,255,
+ 20, 20, 20,102, 18, 18, 18,102, 54, 54, 54,255, 63, 63, 63,255, 69, 69, 69,255, 74, 74, 74,255, 78, 78, 78,255, 82, 82, 82,255,
+ 85, 85, 85,255, 87, 87, 87,255, 90, 90, 90,255, 92, 92, 92,255, 93, 93, 93,255, 95, 95, 95,255, 96, 96, 96,255, 97, 97, 97,255,
+ 98, 98, 98,255,100,100,100,255, 99, 99, 99,255, 98, 98, 98,255, 96, 96, 96,255, 95, 95, 95,255, 93, 93, 93,255, 91, 91, 91,255,
+ 89, 89, 89,255, 87, 87, 87,255, 85, 85, 85,255, 81, 81, 81,255, 76, 76, 76,255, 70, 70, 70,255, 64, 64, 64,255, 58, 58, 58,255,
+ 31, 31, 31,153, 20, 20, 20,102, 59, 59, 59,255, 66, 66, 66,255, 73, 73, 73,255, 77, 77, 77,255, 82, 81, 81,255, 85, 85, 85,255,
+ 88, 88, 88,255, 91, 91, 91,255, 94, 94, 94,255, 96, 96, 96,255, 98, 98, 98,255,100,100,100,255,101,101,101,255,102,102,102,255,
+103,103,103,255,103,103,103,255,102,102,102,255,100,100,100,255, 99, 99, 99,255, 97, 97, 97,255, 95, 95, 95,255, 93, 93, 93,255,
+ 91, 91, 91,255, 89, 89, 89,255, 87, 87, 87,255, 84, 84, 84,255, 79, 79, 79,255, 74, 74, 74,255, 67, 67, 67,255, 61, 61, 61,255,
+ 43, 43, 43,204, 32, 32, 32,153, 62, 62, 62,255, 70, 70, 70,255, 76, 76, 76,255, 81, 81, 81,255, 85, 85, 85,255, 89, 89, 89,255,
+ 92, 92, 92,255, 95, 95, 95,255, 98, 97, 97,255,100,100,100,255,102,102,102,255,104,104,104,255,105,105,105,255,107,107,107,255,
+107,107,107,255,106,106,106,255,104,104,104,255,102,102,102,255,100,100,100,255, 99, 99, 99,255, 97, 97, 97,255, 95, 95, 95,255,
+ 93, 93, 93,255, 91, 91, 91,255, 88, 88, 88,255, 86, 86, 86,255, 83, 83, 83,255, 77, 77, 77,255, 70, 70, 70,255, 63, 63, 63,255,
+ 44, 44, 44,204, 32, 32, 32,153, 64, 64, 64,255, 72, 72, 72,255, 79, 79, 79,255, 84, 84, 84,255, 88, 88, 88,255, 92, 92, 92,255,
+ 96, 95, 95,255, 98, 98, 98,255,101,101,101,255,103,103,103,255,106,106,106,255,107,107,107,255,109,109,109,255,111,111,111,255,
+109,109,109,255,108,108,108,255,106,106,106,255,104,104,104,255,102,102,102,255,100,100,100,255, 98, 98, 98,255, 96, 96, 96,255,
+ 94, 94, 94,255, 92, 92, 92,255, 90, 90, 90,255, 87, 87, 87,255, 85, 85, 85,255, 79, 79, 79,255, 73, 73, 73,255, 65, 65, 65,255,
+ 45, 45, 45,204, 33, 33, 33,153, 67, 67, 67,255, 75, 75, 75,255, 81, 81, 81,255, 87, 87, 87,255, 91, 91, 91,255, 95, 95, 95,255,
+ 98, 98, 98,255,102,102,102,255,104,104,104,255,107,107,107,255,109,109,109,255,111,111,111,255,113,113,113,255,113,113,113,255,
+111,111,111,255,109,109,109,255,108,108,108,255,106,106,106,255,104,104,104,255,102,102,102,255,100,100,100,255, 98, 98, 98,255,
+ 96, 96, 96,255, 93, 93, 93,255, 91, 91, 91,255, 88, 88, 88,255, 86, 86, 86,255, 81, 81, 81,255, 74, 74, 74,255, 67, 67, 67,255,
+ 35, 35, 35,153, 22, 22, 22,102, 68, 68, 68,255, 77, 77, 77,255, 84, 84, 84,255, 89, 89, 89,255, 94, 94, 94,255, 98, 98, 98,255,
+101,101,101,255,105,105,105,255,108,108,108,255,110,110,110,255,112,112,112,255,115,114,114,255,116,116,116,255,115,115,115,255,
+113,113,113,255,111,111,111,255,110,110,110,255,108,108,108,255,106,106,106,255,104,104,104,255,101,101,101,255, 99, 99, 99,255,
+ 97, 97, 97,255, 95, 95, 95,255, 92, 92, 92,255, 90, 89, 89,255, 87, 87, 87,255, 83, 83, 83,255, 76, 76, 76,255, 68, 68, 68,255,
+ 36, 36, 36,153, 11, 11, 11, 51, 68, 68, 68,255, 78, 78, 78,255, 86, 86, 86,255, 91, 91, 91,255, 96, 96, 96,255,101,101,101,255,
+104,104,104,255,107,107,107,255,110,110,110,255,113,113,113,255,115,115,115,255,117,117,117,255,118,118,118,255,117,117,117,255,
+115,115,115,255,113,113,113,255,111,111,111,255,109,109,109,255,107,107,107,255,105,105,105,255,103,103,103,255,101,101,101,255,
+ 98, 98, 98,255, 96, 96, 96,255, 93, 93, 93,255, 90, 90, 90,255, 88, 87, 87,255, 84, 84, 84,255, 77, 77, 77,255, 68, 68, 68,255,
+ 23, 23, 23,102,  0,  0,  0,  0, 68, 68, 68,255, 79, 79, 79,255, 87, 87, 87,255, 93, 93, 93,255, 98, 98, 98,255,103,103,103,255,
+106,106,106,255,110,110,110,255,113,113,113,255,115,115,115,255,118,118,118,255,120,120,120,255,120,120,120,255,119,119,119,255,
+117,117,117,255,115,115,115,255,113,113,113,255,111,111,111,255,109,109,109,255,106,106,106,255,104,104,104,255,102,102,102,255,
+ 99, 99, 99,255, 97, 97, 97,255, 94, 94, 94,255, 91, 91, 91,255, 88, 88, 88,255, 84, 84, 84,255, 77, 77, 77,255, 67, 67, 67,255,
+ 11, 11, 11, 51,  0,  0,  0,  0, 41, 41, 41,153, 79, 79, 79,255, 88, 88, 88,255, 94, 94, 94,255,100,100,100,255,104,104,104,255,
+108,108,108,255,112,112,112,255,115,115,115,255,118,118,118,255,120,120,120,255,122,122,122,255,122,122,122,255,120,120,120,255,
+119,119,119,255,117,117,117,255,115,115,115,255,112,112,112,255,110,110,110,255,108,108,108,255,105,105,105,255,103,103,103,255,
+100,100,100,255, 98, 98, 98,255, 95, 95, 95,255, 92, 92, 92,255, 89, 89, 89,255, 85, 84, 84,255, 76, 76, 76,255, 41, 41, 41,153,
+  0,  0,  0,  0,  0,  0,  0,  0, 14, 14, 14, 51, 78, 78, 78,255, 88, 88, 88,255, 95, 95, 95,255,101,101,101,255,106,106,106,255,
+110,110,110,255,114,114,114,255,117,117,117,255,120,119,119,255,122,122,122,255,124,124,124,255,124,124,124,255,122,122,122,255,
+120,120,120,255,118,118,118,255,116,116,116,255,114,114,114,255,111,111,111,255,109,109,109,255,106,106,106,255,104,104,104,255,
+101,101,101,255, 98, 98, 98,255, 95, 95, 95,255, 92, 92, 92,255, 89, 89, 89,255, 84, 84, 84,255, 75, 75, 75,255, 37, 37, 37,153,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 59, 59, 59,204, 87, 87, 87,255, 95, 95, 95,255,101,101,101,255,106,106,106,255,
+111,111,111,255,114,114,114,255,118,118,118,255,121,121,121,255,123,123,123,255,125,125,125,255,125,125,125,255,124,124,124,255,
+122,122,122,255,120,120,120,255,117,117,117,255,115,115,115,255,112,112,112,255,110,110,110,255,107,107,107,255,104,104,104,255,
+102,102,102,255, 99, 98, 98,255, 95, 95, 95,255, 92, 92, 92,255, 89, 89, 89,255, 82, 82, 82,255, 57, 57, 57,204,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 14, 14, 14, 51, 84, 84, 84,255, 93, 93, 93,255,101,101,101,255,106,106,106,255,
+111,111,111,255,115,115,115,255,118,118,118,255,121,121,121,255,124,124,124,255,126,126,126,255,126,126,126,255,125,125,125,255,
+123,123,123,255,121,121,121,255,118,118,118,255,116,116,116,255,113,113,113,255,111,111,111,255,108,108,108,255,105,105,105,255,
+102,102,102,255, 99, 99, 99,255, 95, 95, 95,255, 92, 92, 92,255, 88, 88, 88,255, 78, 78, 78,255, 15, 15, 15, 51,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 32, 32,102, 91, 91, 91,255, 99, 99, 99,255,106,106,106,255,
+111,111,111,255,115,115,115,255,119,119,119,255,122,122,122,255,124,124,124,255,126,126,126,255,127,127,127,255,126,126,126,255,
+124,124,124,255,121,121,121,255,119,119,119,255,117,116,116,255,114,114,114,255,111,111,111,255,108,108,108,255,105,105,105,255,
+102,102,102,255, 98, 98, 98,255, 95, 95, 95,255, 91, 91, 91,255, 84, 84, 84,255, 45, 45, 45,153,  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, 51, 51, 51,153, 95, 95, 95,255,103,103,103,255,
+109,109,109,255,114,114,114,255,118,118,118,255,121,121,121,255,124,124,124,255,126,126,126,255,128,128,128,255,126,126,126,255,
+124,124,124,255,122,122,122,255,119,119,119,255,117,117,117,255,114,114,114,255,111,111,111,255,108,108,108,255,104,104,104,255,
+101,101,101,255, 98, 98, 98,255, 94, 94, 94,255, 88, 88, 88,255, 49, 49, 49,153, 12, 12, 12, 51,  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, 53, 53, 53,153, 98, 98, 98,255,
+106,106,106,255,112,112,112,255,116,116,116,255,119,119,119,255,122,122,122,255,125,125,125,255,127,127,127,255,126,126,126,255,
+124,124,124,255,122,122,122,255,119,119,119,255,116,116,116,255,113,113,113,255,110,110,110,255,107,107,107,255,104,104,104,255,
+100,100,100,255, 96, 96, 96,255, 91, 91, 91,255, 66, 66, 66,204, 15, 15, 15, 51,  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, 54, 54, 54,153,
+100,100,100,255,107,107,107,255,113,113,113,255,117,117,117,255,120,120,120,255,122,122,122,255,124,124,124,255,125,125,125,255,
+123,123,123,255,121,121,121,255,118,118,118,255,116,115,115,255,112,112,112,255,109,109,109,255,105,105,105,255,102,102,102,255,
+ 97, 97, 97,255, 92, 92, 92,255, 51, 51, 51,153, 15, 15, 15, 51,  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,  0,  0, 97, 97, 97,255,106,106,106,255,112,112,112,255,115,115,115,255,118,118,118,255,121,121,121,255,122,122,122,255,
+121,121,121,255,119,119,119,255,117,117,117,255,114,114,114,255,111,111,111,255,107,107,107,255,103,103,103,255, 98, 98, 98,255,
+ 74, 74, 74,204, 35, 35, 35,102,  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,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 56, 56, 56,153, 80, 80, 80,204,106,106,106,255,111,111,111,255,114,114,114,255,116,116,116,255,
+117,117,117,255,116,116,116,255,113,113,113,255,110,110,110,255,106,106,106,255,102,102,102,255, 78, 78, 78,204, 38, 38, 38,102,
+ 15, 15, 15, 51,  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,  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, 39, 39, 39,102, 62, 62, 62,153, 64, 64, 64,153,
+ 86, 86, 86,204, 86, 86, 86,204, 84, 84, 84,204, 61, 61, 61,153, 40, 40, 40,102, 19, 19, 19, 51,  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, 77, 65,  0,  0,128,  3,  0,  0,120,164, 26,  4,  0,  0,  0,  0, 39,  0,  0,  0,  1,  0,  0,  0,216,189, 26,  4,
+  0,  0,  0,  0,104,142, 26,  4,  0,  0,  0,  0,168,  1,222,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65,112,114,
+101,118,105,101,119,  0,  0, 97,116,101,114,105, 97,108,  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,
+  5,  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,  1,  0,
+  0,  0,128, 63, 30, 18,240, 62,246,137,158, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+188,248, 68, 62,  0,  0,128, 63,205,204, 76, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 10,215, 35, 60,  0,  0,  0,  0,  0,  0,  8,  0,
+  1,  0, 50,  0,205,204, 76, 62,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,198,121,130, 63,  0,  0,160, 63,  0,  0,  0,  0,  0,  0,160, 63,  0,  0,  0,  0,  0,  0,  0,  0,205,204,204, 61,
+  2,  0,  2,  0, 50,  0,  0,  6,  0,  0,128, 63,  0,  0,128, 63, 18,  0, 18,  0, 10,215,163, 59, 10,215,163, 59,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  4,  0, 67,  0, 16,  3, 67,  0, 16,  3,  1,  0,  4,  0, 12,  0,  4,  0,  0,  0,  0, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  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,  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,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  2,  0,  0,  0,  0,  0,
+  0,  0,  0, 63,  0,  0,128, 64,  0,  0,  0, 63,205,204,204, 61,  0,  0,  0, 63,205,204,204, 61,205,204,204, 61,  0,  0,128, 63,
+ 16,  8,  1,  0,200,169, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63, 72,168, 26,  4,  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,  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,  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,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24,173, 26,  4,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,111,148, 26, 63,111,148, 26, 63,
+111,148, 26, 63,205,204, 76, 61,205,204,204, 61,102,102,166, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 56,  1,  0,  0, 72,168, 26,  4,  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0, 16,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,120,206, 26,  4,  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,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65,  8,  3,  0,  0,200,169, 26,  4,  0,  0,  0,  0, 28,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  2,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,245, 40,220, 62,
+  0,  0,  0,  0,  3, 55,122, 63,  0,  0,128, 63, 96, 82,161, 62,  0,  0,128, 63,  0,  0,128, 63,  1,  0,  0,  0,  0,  0,  0, 63,
+  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,
+  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,
+  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,
+  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,
+  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,
+  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,
+  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,
+  0,  0,128, 63,  0,  0,  0, 63,  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,  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,  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,  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,  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,  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,  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,  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, 68, 65, 84, 65, 40,  0,  0,  0, 24,173, 26,  4,  0,  0,  0,  0, 12,  0,  0,  0,
+  1,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,136,173, 26,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  0, 16,  0,  0,136,173, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  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,  0,  2,  2,  1, 51,  2,  1,  1, 51,  6,  3,  4,153,
+  6,  2,  4,153,  5,  1,  4,153,  3,  1,  3,102,  3,  0,  3,102,  2,  0,  2, 51,  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,  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,  3,  3,  1, 51,  8,  7,  3,153, 11,  9,  5,204, 13,  9,  6,255, 12,  8,  7,255, 11,  6,  7,255,
+ 11,  5,  7,255, 10,  4,  7,255,  9,  3,  6,255,  9,  2,  7,255, 10,  2,  7,255, 10,  2,  8,255,  4,  1,  3,102,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  3,  3,  1, 51, 11, 10,  4,153, 20, 16,  8,255, 23, 15, 12,255, 25, 13, 15,255, 25, 11, 18,255, 24,  9, 18,255, 22,  7, 17,255,
+ 20,  7, 15,255, 17,  6, 12,255, 14,  5,  9,255, 11,  4,  6,255, 10,  4,  5,255, 10,  4,  5,255, 11,  4,  5,255, 12,  4,  5,255,
+  9,  3,  5,204,  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,  0,  0,  0,  0,  0,  0,  8,  7,  3,102,
+ 23, 17,  8,204, 33, 22, 14,255, 37, 20, 21,255, 38, 16, 26,255, 39, 13, 30,255, 38, 11, 31,255, 36,  9, 30,255, 34,  9, 27,255,
+ 31,  9, 22,255, 28,  9, 17,255, 24,  9, 13,255, 21,  9, 10,255, 17,  8,  7,255, 14,  6,  5,255, 11,  5,  3,255, 11,  5,  4,255,
+ 12,  6,  4,255, 13,  6,  4,255,  5,  2,  2,102,  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, 16, 13,  5,153, 36, 26, 12,255,
+ 45, 28, 19,255, 48, 25, 26,255, 51, 20, 33,255, 51, 16, 39,255, 51, 12, 42,255, 48, 10, 42,255, 46, 10, 39,255, 44, 10, 34,255,
+ 41, 12, 28,255, 38, 13, 22,255, 34, 14, 16,255, 31, 14, 12,255, 27, 13,  9,255, 23, 11,  7,255, 19,  9,  6,255, 14,  7,  5,255,
+ 12,  5,  4,255, 13,  6,  4,255, 13,  6,  4,255,  7,  3,  3,153,  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, 16, 11,  5,102, 45, 31, 15,255, 54, 34, 20,255,
+ 59, 31, 28,255, 61, 26, 36,255, 61, 20, 44,255, 61, 15, 50,255, 60, 11, 52,255, 58, 10, 52,255, 56, 10, 48,255, 53, 12, 41,255,
+ 51, 15, 33,255, 48, 17, 25,255, 44, 19, 18,255, 40, 19, 14,255, 37, 18, 11,255, 32, 15, 10,255, 28, 12, 10,255, 24,  9, 10,255,
+ 19,  7,  9,255, 14,  5,  7,255, 13,  5,  6,255, 13,  5,  5,255,  7,  4,  2,153,  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, 15,  9,  7,102, 50, 33, 17,255, 61, 39, 20,255, 67, 37, 26,255,
+ 70, 32, 36,255, 71, 26, 46,255, 72, 19, 54,255, 71, 14, 60,255, 69, 10, 62,255, 68,  9, 61,255, 66, 10, 56,255, 63, 13, 48,255,
+ 60, 17, 39,255, 56, 21, 28,255, 53, 23, 21,255, 49, 23, 16,255, 46, 22, 15,255, 42, 18, 16,255, 37, 14, 17,255, 33, 10, 18,255,
+ 28,  7, 17,255, 22,  5, 14,255, 15,  3, 10,255, 13,  3,  8,255, 12,  5,  6,255,  5,  3,  2,102,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 44, 26, 18,204, 66, 41, 21,255, 73, 43, 25,255, 78, 40, 33,255,
+ 80, 34, 43,255, 80, 26, 53,255, 80, 19, 62,255, 80, 13, 69,255, 78, 10, 71,255, 76,  8, 71,255, 74, 10, 65,255, 71, 13, 57,255,
+ 68, 18, 45,255, 65, 24, 32,255, 61, 27, 23,255, 57, 27, 18,255, 53, 25, 18,255, 49, 19, 22,255, 45, 14, 25,255, 41,  9, 27,255,
+ 36,  5, 28,255, 30,  4, 25,255, 23,  2, 20,255, 16,  2, 13,255, 12,  2,  9,255, 12,  5,  6,255,  3,  3,  1, 51,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 23, 11, 12,102, 68, 38, 26,255, 78, 46, 25,255, 83, 46, 28,255, 84, 42, 36,255,
+ 84, 35, 45,255, 84, 27, 55,255, 84, 20, 64,255, 83, 14, 71,255, 82,  9, 75,255, 81,  7, 75,255, 79,  8, 72,255, 78, 12, 63,255,
+ 76, 19, 51,255, 73, 25, 39,255, 69, 30, 26,255, 65, 31, 20,255, 61, 27, 22,255, 57, 19, 29,255, 53, 11, 36,255, 48,  6, 39,255,
+ 43,  3, 39,255, 37,  1, 36,255, 31,  1, 30,255, 24,  1, 23,255, 15,  1, 14,255, 12,  2,  9,255, 10,  5,  5,204,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 29, 35,255, 81, 44, 29,255, 85, 49, 27,255, 86, 48, 29,255, 87, 43, 36,255,
+ 87, 37, 45,255, 87, 29, 55,255, 86, 22, 64,255, 86, 15, 72,255, 85, 11, 77,255, 83,  8, 78,255, 82,  7, 76,255, 81, 10, 70,255,
+ 79, 15, 59,255, 77, 22, 47,255, 76, 31, 31,255, 72, 34, 23,255, 68, 30, 24,255, 64, 21, 33,255, 60,  8, 48,255, 55,  2, 52,255,
+ 50,  1, 49,255, 44,  0, 44,255, 38,  0, 38,255, 31,  0, 30,255, 22,  0, 22,255, 12,  1, 12,255, 12,  4,  9,255,  6,  5,  2,102,
+  0,  0,  0,  0,  0,  0,  0,  0, 27,  8, 19,102, 79, 34, 41,255, 86, 46, 31,255, 88, 50, 28,255, 89, 50, 30,255, 90, 46, 36,255,
+ 90, 41, 44,255, 90, 34, 53,255, 89, 27, 62,255, 89, 20, 69,255, 87, 14, 76,255, 86, 10, 79,255, 85,  8, 80,255, 83,  8, 75,255,
+ 82, 12, 67,255, 80, 20, 54,255, 78, 31, 35,255, 77, 36, 24,255, 75, 33, 27,255, 71, 20, 42,255, 66,  5, 60,255, 61,  0, 61,255,
+ 56,  1, 55,255, 51,  3, 47,255, 44,  2, 41,255, 37,  1, 35,255, 29,  1, 28,255, 18,  0, 18,255, 12,  2, 10,255, 11,  6,  6,204,
+  0,  0,  0,  0,  0,  0,  0,  0, 58, 15, 43,204, 85, 36, 43,255, 89, 47, 33,255, 91, 52, 29,255, 93, 53, 30,255, 93, 51, 34,255,
+ 94, 47, 41,255, 93, 41, 49,255, 93, 34, 58,255, 92, 26, 66,255, 91, 20, 73,255, 89, 14, 79,255, 88, 10, 81,255, 86,  9, 79,255,
+ 85, 10, 74,255, 83, 16, 62,255, 81, 26, 45,255, 79, 34, 31,255, 78, 24, 43,255, 76, 11, 61,255, 73,  2, 71,255, 68,  3, 63,255,
+ 63,  8, 51,255, 56,  9, 43,255, 50,  9, 37,255, 43,  6, 33,255, 35,  4, 30,255, 25,  1, 23,255, 13,  1, 13,255, 13,  6,  9,255,
+  0,  0,  0,  0, 17,  2, 15,102, 79, 18, 60,255, 88, 37, 46,255, 92, 49, 35,255, 95, 56, 31,255, 96, 58, 30,255, 97, 57, 33,255,
+ 98, 54, 39,255, 98, 49, 46,255, 97, 42, 54,255, 96, 35, 61,255, 95, 28, 68,255, 93, 22, 74,255, 91, 16, 79,255, 89, 12, 82,255,
+ 88, 10, 81,255, 86,  9, 78,255, 84, 14, 67,255, 82, 18, 58,255, 80,  2, 78,255, 78,  1, 77,255, 77,  9, 64,255, 74, 19, 46,255,
+ 68, 21, 37,255, 62, 19, 34,255, 55, 18, 29,255, 48, 14, 27,255, 40,  9, 28,255, 30,  4, 25,255, 19,  2, 17,255, 12,  4, 10,255,
+  7,  5,  3,102, 28,  3, 26,102, 84, 19, 65,255, 92, 39, 50,255, 96, 52, 39,255, 99, 60, 33,255,101, 64, 32,255,102, 65, 33,255,
+103, 63, 37,255,102, 58, 42,255,102, 53, 47,255,100, 47, 54,255, 99, 40, 61,255, 97, 33, 66,255, 95, 26, 72,255, 93, 19, 78,255,
+ 91, 14, 81,255, 89, 11, 82,255, 87,  8, 81,255, 84,  8, 76,255, 82, 20, 55,255, 81, 35, 31,255, 79, 31, 35,255, 77, 34, 27,255,
+ 74, 34, 24,255, 67, 31, 22,255, 61, 27, 21,255, 53, 21, 22,255, 46, 15, 24,255, 35,  8, 23,255, 24,  3, 19,255, 13,  3, 11,255,
+ 10,  6,  5,153, 31,  3, 29,102, 88, 22, 68,255, 96, 42, 54,255,101, 56, 44,255,104, 65, 37,255,107, 70, 34,255,108, 73, 34,255,
+108, 72, 36,255,108, 70, 39,255,107, 66, 43,255,106, 60, 48,255,105, 54, 54,255,102, 47, 59,255,100, 39, 64,255, 98, 32, 69,255,
+ 95, 25, 73,255, 92, 20, 76,255, 90, 17, 74,255, 87, 28, 53,255, 85, 41, 30,255, 83, 34, 35,255, 81, 31, 37,255, 79, 35, 28,255,
+ 77, 31, 31,255, 73, 30, 28,255, 66, 30, 21,255, 58, 26, 19,255, 50, 21, 20,255, 40, 13, 21,255, 29,  6, 20,255, 17,  3, 14,255,
+ 12,  7,  7,204, 48,  5, 44,153, 92, 24, 72,255,100, 44, 60,255,106, 60, 50,255,111, 72, 42,255,113, 78, 38,255,115, 82, 37,255,
+115, 82, 37,255,115, 81, 38,255,115, 78, 41,255,114, 74, 45,255,112, 69, 49,255,110, 63, 53,255,107, 55, 56,255,103, 50, 57,255,
+100, 42, 59,255, 96, 36, 61,255, 93, 33, 59,255, 90, 40, 42,255, 87, 46, 27,255, 85, 33, 42,255, 83, 18, 59,255, 81,  8, 71,255,
+ 78, 12, 61,255, 76, 21, 45,255, 70, 29, 27,255, 63, 29, 20,255, 55, 25, 17,255, 45, 18, 19,255, 33,  9, 20,255, 21,  4, 16,255,
+ 11,  6,  7,204, 47,  6, 42,153, 95, 26, 76,255,105, 48, 65,255,112, 66, 56,255,118, 79, 48,255,121, 87, 43,255,122, 91, 41,255,
+123, 93, 40,255,124, 94, 40,255,124, 93, 42,255,124, 91, 45,255,124, 88, 48,255,122, 83, 51,255,118, 76, 52,255,112, 69, 49,255,
+106, 62, 46,255,102, 54, 46,255, 98, 51, 41,255, 94, 52, 31,255, 90, 48, 30,255, 87, 31, 49,255, 85, 17, 65,255, 82,  6, 75,255,
+ 80,  4, 75,255, 77, 14, 57,255, 74, 24, 39,255, 67, 28, 25,255, 59, 27, 18,255, 49, 21, 17,255, 37, 13, 18,255, 25,  5, 18,255,
+ 11,  5,  8,204, 47,  8, 40,153, 99, 31, 78,255,111, 53, 70,255,119, 72, 62,255,125, 86, 55,255,129, 96, 50,255,131,102, 46,255,
+133,105, 45,255,134,107, 45,255,137,110, 49,255,142,113, 55,255,143,113, 59,255,142,110, 60,255,136,101, 58,255,126, 91, 51,255,
+117, 80, 44,255,108, 70, 38,255,102, 64, 33,255, 98, 56, 34,255, 93, 44, 43,255, 90, 29, 57,255, 87, 16, 70,255, 84,  6, 79,255,
+ 81,  4, 77,255, 79, 11, 64,255, 76, 19, 49,255, 71, 26, 32,255, 62, 28, 20,255, 52, 24, 17,255, 40, 15, 18,255, 27,  7, 19,255,
+  9,  3,  7,153, 31,  8, 24,102,102, 34, 79,255,116, 58, 75,255,126, 80, 67,255,133, 95, 61,255,138,106, 57,255,141,113, 53,255,
+144,117, 52,255,148,123, 55,255,155,130, 62,255,166,140, 73,255,174,147, 83,255,173,144, 85,255,163,133, 79,255,147,115, 66,255,
+131, 97, 53,255,118, 83, 43,255,108, 70, 39,255,102, 56, 44,255, 96, 42, 54,255, 92, 28, 65,255, 89, 16, 75,255, 86,  8, 80,255,
+ 83,  5, 78,255, 80,  8, 69,255, 77, 17, 53,255, 74, 25, 37,255, 65, 28, 23,255, 55, 26, 17,255, 43, 17, 18,255, 29,  8, 19,255,
+ 10,  3,  7,153, 16,  5, 11, 51,103, 39, 76,255,121, 65, 77,255,133, 88, 72,255,142,105, 67,255,148,117, 63,255,152,125, 60,255,
+156,131, 61,255,164,140, 67,255,178,155, 80,255,198,174,101,255,213,188,119,255,215,189,124,255,201,173,113,255,175,144, 91,255,
+149,116, 70,255,129, 93, 55,255,115, 74, 49,255,106, 58, 52,255,100, 42, 62,255, 95, 27, 72,255, 91, 17, 79,255, 87, 11, 79,255,
+ 84,  7, 79,255, 81,  8, 72,255, 78, 15, 57,255, 75, 23, 41,255, 68, 28, 26,255, 57, 27, 18,255, 45, 18, 18,255, 30,  7, 20,255,
+  6,  2,  5,102,  0,  0,  0,  0,101, 43, 67,255,126, 72, 77,255,140, 97, 75,255,151,116, 71,255,158,129, 68,255,162,138, 66,255,
+168,145, 68,255,179,157, 78,255,199,178, 98,255,227,205,127,255,251,228,154,255,255,232,163,255,238,210,149,255,203,172,119,255,
+167,132, 89,255,140,101, 69,255,122, 77, 62,255,111, 58, 63,255,103, 43, 69,255, 97, 29, 76,255, 93, 20, 79,255, 89, 15, 77,255,
+ 85,  9, 78,255, 82,  9, 72,255, 79, 14, 59,255, 75, 22, 43,255, 69, 29, 26,255, 59, 27, 18,255, 46, 18, 19,255, 29,  7, 20,255,
+  3,  1,  2, 51,  0,  0,  0,  0, 61, 30, 36,153,126, 76, 75,255,146,105, 76,255,158,127, 74,255,167,142, 71,255,173,151, 71,255,
+179,159, 74,255,191,172, 85,255,214,195,107,255,245,225,141,255,255,251,172,255,255,255,183,255,255,233,171,255,222,190,138,255,
+180,143,104,255,148,106, 81,255,127, 79, 73,255,115, 60, 72,255,107, 45, 75,255,100, 33, 78,255, 95, 24, 78,255, 90, 18, 77,255,
+ 86, 12, 77,255, 82, 12, 69,255, 79, 16, 57,255, 76, 24, 41,255, 71, 30, 27,255, 60, 28, 19,255, 46, 17, 20,255, 18,  4, 13,153,
+  0,  0,  0,  0,  0,  0,  0,  0, 20, 11,  9, 51,124, 78, 67,255,148,110, 74,255,164,136, 74,255,175,154, 73,255,182,164, 73,255,
+187,172, 75,255,199,183, 86,255,219,202,107,255,245,228,137,255,255,249,164,255,255,254,176,255,255,233,167,255,222,191,138,255,
+183,146,107,255,152,109, 86,255,131, 82, 77,255,119, 64, 76,255,110, 49, 77,255,103, 38, 78,255, 97, 30, 75,255, 92, 25, 71,255,
+ 87, 15, 75,255, 83, 15, 66,255, 79, 19, 53,255, 76, 26, 37,255, 71, 31, 25,255, 60, 28, 19,255, 43, 14, 22,255, 11,  2,  8,153,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 89, 58, 40,204,147,112, 70,255,168,143, 73,255,181,164, 73,255,189,176, 73,255,
+194,183, 74,255,202,190, 81,255,215,203, 96,255,233,219,118,255,249,233,139,255,252,232,147,255,237,213,141,255,209,179,121,255,
+178,143,101,255,152,111, 86,255,134, 87, 79,255,122, 69, 77,255,113, 55, 77,255,105, 44, 74,255, 98, 37, 69,255, 93, 33, 62,255,
+ 87, 30, 54,255, 83, 21, 59,255, 79, 23, 49,255, 76, 30, 33,255, 71, 33, 23,255, 58, 25, 21,255, 30,  8, 18,204,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 18, 12,  6, 51,136,104, 58,255,165,142, 69,255,184,169, 72,255,194,184, 72,255,
+199,192, 73,255,204,197, 76,255,210,202, 83,255,218,208, 96,255,225,213,109,255,224,207,114,255,212,190,111,255,192,166,101,255,
+170,138, 89,255,151,112, 81,255,136, 92, 77,255,125, 75, 76,255,116, 61, 74,255,107, 51, 70,255,100, 44, 63,255, 93, 39, 55,255,
+ 87, 36, 46,255, 83, 31, 44,255, 79, 27, 42,255, 75, 32, 29,255, 68, 32, 22,255, 51, 18, 25,255,  8,  2,  5, 51,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 48, 36, 17,102,155,132, 61,255,180,167, 68,255,194,187, 70,255,
+202,198, 70,255,206,203, 72,255,207,205, 75,255,209,204, 80,255,209,201, 86,255,204,192, 89,255,194,177, 88,255,180,157, 84,255,
+165,136, 79,255,150,115, 76,255,138, 97, 74,255,127, 81, 72,255,117, 68, 68,255,108, 58, 63,255,100, 50, 55,255, 93, 46, 46,255,
+ 87, 43, 36,255, 82, 31, 43,255, 78, 32, 34,255, 74, 34, 24,255, 63, 26, 24,255, 28,  8, 17,153,  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, 78, 64, 27,153,164,148, 60,255,187,179, 66,255,
+199,197, 68,255,205,205, 69,255,206,207, 70,255,205,204, 71,255,202,197, 73,255,195,186, 75,255,186,172, 75,255,175,155, 74,255,
+162,137, 72,255,150,119, 70,255,139,102, 69,255,128, 87, 66,255,118, 75, 60,255,108, 64, 54,255, 99, 56, 45,255, 92, 51, 37,255,
+ 86, 41, 37,255, 81, 33, 38,255, 76, 35, 27,255, 70, 31, 24,255, 34, 12, 17,153,  3,  0,  3, 51,  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, 82, 70, 27,153,167,155, 58,255,
+188,183, 64,255,200,199, 67,255,203,204, 68,255,202,202, 68,255,199,196, 69,255,192,186, 69,255,183,172, 69,255,173,156, 68,255,
+162,140, 67,255,150,123, 65,255,138,107, 62,255,127, 92, 58,255,116, 79, 52,255,106, 68, 45,255, 97, 60, 37,255, 90, 53, 30,255,
+ 84, 40, 35,255, 79, 37, 28,255, 73, 33, 25,255, 47, 16, 23,204,  9,  1,  7, 51,  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, 79, 68, 25,153,
+161,150, 54,255,182,177, 62,255,191,189, 64,255,194,193, 65,255,192,189, 65,255,186,181, 65,255,179,169, 64,255,169,155, 63,255,
+158,139, 61,255,147,123, 59,255,136,108, 55,255,124, 93, 49,255,113, 81, 43,255,103, 70, 37,255, 94, 59, 30,255, 86, 48, 29,255,
+ 80, 40, 28,255, 73, 33, 26,255, 39, 14, 19,153,  9,  1,  7, 51,  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,  0,  0,139,121, 46,255,163,154, 54,255,174,168, 58,255,176,170, 59,255,174,166, 59,255,168,158, 59,255,160,146, 56,255,
+150,132, 53,255,139,118, 50,255,128,104, 45,255,117, 90, 40,255,107, 77, 35,255, 97, 64, 31,255, 88, 51, 29,255, 80, 42, 26,255,
+ 59, 27, 22,204, 26,  9, 13,102,  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,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 70, 55, 25,153,106, 89, 37,204,142,127, 46,255,148,134, 48,255,147,132, 48,255,141,124, 46,255,
+134,115, 44,255,125,103, 41,255,115, 89, 37,255,106, 76, 34,255, 96, 60, 35,255, 86, 42, 39,255, 64, 25, 33,204, 30, 14, 11,102,
+  7,  0,  7, 51,  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,  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, 44, 30, 18,102, 69, 52, 25,153, 70, 54, 24,153,
+ 88, 63, 33,204, 82, 54, 33,204, 76, 42, 35,204, 52, 23, 29,153, 34, 14, 19,102, 16,  4, 11, 51,  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, 77, 65,  0,  0,128,  3,  0,  0,216,189, 26,  4,  0,  0,  0,  0, 39,  0,  0,  0,  1,  0,  0,  0,232,198, 26,  4,
+  0,  0,  0,  0,120,164, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65,116,101,
+120,116,117,114,101,  0,114,101,118,105,101,119, 46, 48, 48, 49,  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,
+  1,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,205,204, 76, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 10,215, 35, 60,  0,  0,  0,  0,  0,  0,  8,  0,
+  1,  0, 50,  0,205,204, 76, 62,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,160, 63,  0,  0,  0,  0,  0,  0,160, 63,  0,  0,  0,  0,  0,  0,  0,  0,205,204,204, 61,
+  2,  0,  2,  0, 50,  0,  0,  6,  0,  0,128, 63,  0,  0,128, 63, 18,  0, 18,  0, 10,215,163, 59, 10,215,163, 59,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  4,  0, 71,  0,  1,  3, 67,  0,  1,  3,  1,  0,  4,  0, 12,  0,  4,  0,  0,  0,  0, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  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,  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,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  2,  0,  0,  0,  0,  0,
+  0,  0,  0, 63,  0,  0,128, 64,  0,  0,  0, 63,205,204,204, 61,  0,  0,  0, 63,205,204,204, 61,205,204,204, 61,  0,  0,128, 63,
+  1,  8,129,  0, 40,195, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,168,193, 26,  4,  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,  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,  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,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,120,198, 26,  4,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,111,148, 26, 63,111,148, 26, 63,
+111,148, 26, 63,205,204, 76, 61,205,204,204, 61,102,102,166, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  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, 68, 65, 84, 65,
+ 56,  1,  0,  0,168,193, 26,  4,  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,129,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,120,206, 26,  4,  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,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65,  8,  3,  0,  0, 40,195, 26,  4,  0,  0,  0,  0, 28,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  2,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,245, 40,220, 62,
+  0,  0,  0,  0,  3, 55,122, 63,  0,  0,128, 63, 96, 82,161, 62,  0,  0,128, 63,  0,  0,128, 63,  1,  0,  0,  0,  0,  0,  0, 63,
+  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,
+  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,
+  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,
+  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,
+  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,
+  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,
+  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,
+  0,  0,128, 63,  0,  0,  0, 63,  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,  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,  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,232,221, 51,  3,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,111,148, 26, 63,111,148, 26, 63,111,148, 26, 63,
-205,204, 76, 61,205,204,204, 61,102,102,166, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  1,  0,  0,
-136,220, 51,  3,  0,  0,  0,  0, 24,  0,  0,  0,  1,  0,  0,  0, 16,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-120, 25, 52,  3,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 23,183,209, 56,
-184,177,209, 56,184,177,209, 56,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,
-205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 40,  0,  0,  0,232,221, 51,  3,  0,  0,  0,  0, 11,  0,  0,  0,  1,  0,  0,  0,
- 32,  0,  0,  0,  0,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0, 88,222, 51,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  0, 16,  0,  0, 88,222, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  6,  6,  6, 51,  6,  6,  6, 51, 18, 18, 18,153, 19, 19, 19,153,
- 19, 19, 19,153, 13, 13, 13,102, 13, 13, 13,102,  6,  6,  6, 51,  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,  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,  6,  6,  6, 51, 18, 18, 18,153, 26, 26, 26,204, 34, 34, 34,255, 35, 35, 35,255, 37, 37, 37,255, 38, 38, 38,255,
- 38, 38, 38,255, 38, 38, 38,255, 38, 38, 38,255, 37, 37, 37,255, 36, 36, 36,255, 15, 15, 15,102,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  5,  5, 51,
- 18, 18, 18,153, 33, 33, 33,255, 37, 37, 37,255, 40, 40, 40,255, 42, 42, 42,255, 43, 43, 43,255, 44, 44, 44,255, 44, 44, 44,255,
- 45, 45, 45,255, 44, 44, 44,255, 43, 43, 43,255, 43, 43, 43,255, 42, 42, 42,255, 41, 41, 41,255, 40, 40, 40,255, 29, 29, 29,204,
-  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,  0,  0,  0,  0,  0,  0, 12, 12, 12,102, 28, 28, 28,204,
- 38, 38, 38,255, 42, 42, 42,255, 45, 45, 45,255, 47, 47, 47,255, 48, 48, 48,255, 49, 49, 49,255, 50, 50, 50,255, 50, 50, 50,255,
- 50, 50, 50,255, 50, 50, 50,255, 49, 49, 49,255, 48, 48, 48,255, 47, 47, 47,255, 46, 46, 46,255, 45, 45, 45,255, 44, 44, 44,255,
- 41, 41, 41,255, 16, 16, 16,102,  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, 18, 18, 18,153, 36, 36, 36,255, 42, 42, 42,255,
- 45, 45, 45,255, 48, 48, 48,255, 51, 51, 51,255, 53, 53, 53,255, 54, 54, 54,255, 55, 55, 55,255, 55, 55, 55,255, 56, 56, 56,255,
- 56, 56, 56,255, 55, 55, 55,255, 55, 55, 55,255, 54, 54, 54,255, 53, 53, 53,255, 52, 52, 52,255, 50, 50, 50,255, 48, 48, 48,255,
- 46, 46, 46,255, 44, 44, 44,255, 24, 24, 24,153,  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, 14, 14, 14,102, 38, 38, 38,255, 44, 44, 44,255, 48, 48, 48,255,
- 52, 52, 52,255, 54, 54, 54,255, 56, 56, 56,255, 58, 58, 58,255, 59, 59, 59,255, 60, 60, 60,255, 60, 60, 60,255, 61, 61, 61,255,
- 61, 61, 61,255, 60, 60, 60,255, 60, 60, 60,255, 59, 59, 59,255, 58, 58, 58,255, 57, 57, 57,255, 55, 55, 55,255, 53, 53, 53,255,
- 51, 51, 51,255, 48, 48, 48,255, 46, 46, 46,255, 25, 25, 25,153,  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, 13, 13, 13,102, 39, 39, 39,255, 46, 46, 46,255, 50, 50, 50,255, 54, 54, 54,255,
- 57, 57, 57,255, 59, 59, 59,255, 61, 61, 61,255, 63, 63, 63,255, 64, 64, 64,255, 65, 65, 65,255, 65, 65, 65,255, 66, 66, 66,255,
- 66, 66, 66,255, 65, 65, 65,255, 65, 65, 65,255, 64, 64, 64,255, 63, 63, 63,255, 62, 62, 62,255, 60, 60, 60,255, 58, 58, 58,255,
- 56, 56, 56,255, 53, 53, 53,255, 50, 50, 50,255, 47, 47, 47,255, 17, 17, 17,102,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 32, 32,204, 46, 46, 46,255, 52, 52, 52,255, 56, 56, 56,255, 59, 59, 59,255,
- 62, 62, 62,255, 64, 64, 64,255, 66, 66, 66,255, 67, 67, 67,255, 69, 69, 69,255, 70, 70, 70,255, 70, 70, 70,255, 70, 70, 70,255,
- 70, 70, 70,255, 70, 70, 70,255, 69, 69, 69,255, 68, 68, 68,255, 68, 68, 68,255, 66, 66, 66,255, 65, 65, 65,255, 63, 63, 63,255,
- 60, 60, 60,255, 58, 58, 58,255, 54, 54, 54,255, 51, 51, 51,255, 47, 47, 47,255,  7,  7,  7, 51,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 16, 16, 16,102, 46, 46, 46,255, 52, 52, 52,255, 57, 57, 57,255, 61, 61, 61,255, 64, 63, 63,255,
- 66, 66, 66,255, 69, 69, 69,255, 71, 70, 70,255, 72, 72, 72,255, 73, 73, 73,255, 74, 74, 74,255, 75, 75, 75,255, 75, 75, 75,255,
- 75, 75, 75,255, 75, 74, 74,255, 73, 73, 73,255, 73, 73, 73,255, 72, 72, 72,255, 71, 71, 71,255, 69, 69, 69,255, 67, 67, 67,255,
- 65, 65, 65,255, 62, 62, 62,255, 59, 59, 59,255, 55, 55, 55,255, 52, 52, 52,255, 38, 38, 38,204,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 43, 43, 43,255, 52, 52, 52,255, 57, 57, 57,255, 61, 61, 61,255, 65, 65, 65,255, 68, 68, 68,255,
- 71, 71, 71,255, 73, 73, 73,255, 75, 75, 75,255, 77, 77, 77,255, 78, 78, 78,255, 79, 78, 78,255, 79, 79, 79,255, 79, 79, 79,255,
- 79, 79, 79,255, 79, 79, 79,255, 78, 78, 78,255, 77, 77, 77,255, 76, 76, 76,255, 75, 75, 75,255, 73, 73, 73,255, 71, 71, 71,255,
- 70, 70, 70,255, 67, 67, 67,255, 64, 64, 64,255, 59, 59, 59,255, 55, 55, 55,255, 51, 51, 51,255, 18, 18, 18,102,  0,  0,  0,  0,
-  0,  0,  0,  0, 17, 17, 17,102, 50, 50, 50,255, 56, 56, 56,255, 62, 61, 61,255, 66, 66, 66,255, 69, 69, 69,255, 73, 73, 73,255,
- 75, 75, 75,255, 77, 77, 77,255, 79, 79, 79,255, 81, 81, 81,255, 82, 82, 82,255, 83, 83, 83,255, 84, 84, 84,255, 84, 84, 84,255,
- 84, 84, 84,255, 83, 83, 83,255, 83, 83, 83,255, 82, 82, 82,255, 80, 80, 80,255, 79, 79, 79,255, 78, 78, 78,255, 77, 77, 77,255,
- 74, 74, 74,255, 71, 71, 71,255, 68, 68, 68,255, 64, 64, 64,255, 59, 59, 59,255, 54, 54, 54,255, 40, 40, 40,204,  0,  0,  0,  0,
-  0,  0,  0,  0, 37, 37, 37,204, 55, 55, 55,255, 61, 61, 61,255, 66, 66, 66,255, 70, 70, 70,255, 73, 73, 73,255, 77, 77, 77,255,
- 79, 79, 79,255, 81, 81, 81,255, 84, 84, 84,255, 85, 85, 85,255, 87, 87, 87,255, 87, 87, 87,255, 88, 88, 88,255, 89, 89, 89,255,
- 88, 88, 88,255, 88, 88, 88,255, 87, 87, 87,255, 88, 88, 88,255, 84, 84, 84,255, 83, 83, 83,255, 83, 83, 83,255, 81, 81, 81,255,
- 79, 79, 79,255, 76, 76, 76,255, 72, 72, 72,255, 68, 68, 68,255, 63, 63, 63,255, 57, 57, 57,255, 52, 52, 52,255,  0,  0,  0,  0,
- 14, 14, 14,102, 50, 50, 50,255, 59, 59, 59,255, 65, 65, 65,255, 70, 70, 70,255, 74, 74, 74,255, 78, 78, 78,255, 81, 81, 81,255,
- 84, 84, 84,255, 86, 86, 86,255, 88, 88, 88,255, 90, 90, 90,255, 91, 91, 91,255, 92, 92, 92,255, 92, 92, 92,255, 93, 93, 93,255,
- 94, 94, 94,255, 93, 93, 93,255, 93, 93, 93,255, 95, 95, 95,255, 90, 90, 90,255, 90, 90, 90,255, 89, 89, 89,255, 86, 86, 86,255,
- 83, 83, 83,255, 80, 80, 80,255, 77, 77, 77,255, 72, 72, 72,255, 67, 67, 67,255, 61, 61, 61,255, 55, 55, 55,255, 20, 20, 20,102,
- 18, 18, 18,102, 54, 54, 54,255, 63, 63, 63,255, 69, 69, 69,255, 74, 74, 74,255, 78, 78, 78,255, 82, 82, 82,255, 85, 85, 85,255,
- 87, 87, 87,255, 90, 90, 90,255, 92, 92, 92,255, 93, 93, 93,255, 95, 95, 95,255, 96, 96, 96,255, 97, 97, 97,255, 98, 98, 98,255,
-100,100,100,255, 99, 99, 99,255, 98, 98, 98,255, 96, 96, 96,255, 95, 95, 95,255, 93, 93, 93,255, 91, 91, 91,255, 89, 89, 89,255,
- 87, 87, 87,255, 85, 85, 85,255, 81, 81, 81,255, 76, 76, 76,255, 70, 70, 70,255, 64, 64, 64,255, 58, 58, 58,255, 31, 31, 31,153,
- 20, 20, 20,102, 59, 59, 59,255, 66, 66, 66,255, 73, 73, 73,255, 77, 77, 77,255, 82, 81, 81,255, 85, 85, 85,255, 88, 88, 88,255,
- 91, 91, 91,255, 94, 94, 94,255, 96, 96, 96,255, 98, 98, 98,255,100,100,100,255,101,101,101,255,102,102,102,255,103,103,103,255,
-103,103,103,255,102,102,102,255,100,100,100,255, 99, 99, 99,255, 97, 97, 97,255, 95, 95, 95,255, 93, 93, 93,255, 91, 91, 91,255,
- 89, 89, 89,255, 87, 87, 87,255, 84, 84, 84,255, 79, 79, 79,255, 74, 74, 74,255, 67, 67, 67,255, 61, 61, 61,255, 43, 43, 43,204,
- 32, 32, 32,153, 62, 62, 62,255, 70, 70, 70,255, 76, 76, 76,255, 81, 81, 81,255, 85, 85, 85,255, 89, 89, 89,255, 92, 92, 92,255,
- 95, 95, 95,255, 98, 97, 97,255,100,100,100,255,102,102,102,255,104,104,104,255,105,105,105,255,107,107,107,255,107,107,107,255,
-106,106,106,255,104,104,104,255,102,102,102,255,100,100,100,255, 99, 99, 99,255, 97, 97, 97,255, 95, 95, 95,255, 93, 93, 93,255,
- 91, 91, 91,255, 88, 88, 88,255, 86, 86, 86,255, 83, 83, 83,255, 77, 77, 77,255, 70, 70, 70,255, 63, 63, 63,255, 44, 44, 44,204,
- 32, 32, 32,153, 64, 64, 64,255, 72, 72, 72,255, 79, 79, 79,255, 84, 84, 84,255, 88, 88, 88,255, 92, 92, 92,255, 96, 95, 95,255,
- 98, 98, 98,255,101,101,101,255,103,103,103,255,106,106,106,255,107,107,107,255,109,109,109,255,111,111,111,255,109,109,109,255,
-108,108,108,255,106,106,106,255,104,104,104,255,102,102,102,255,100,100,100,255, 98, 98, 98,255, 96, 96, 96,255, 94, 94, 94,255,
- 92, 92, 92,255, 90, 90, 90,255, 87, 87, 87,255, 85, 85, 85,255, 79, 79, 79,255, 73, 73, 73,255, 65, 65, 65,255, 45, 45, 45,204,
- 33, 33, 33,153, 67, 67, 67,255, 75, 75, 75,255, 81, 81, 81,255, 87, 87, 87,255, 91, 91, 91,255, 95, 95, 95,255, 98, 98, 98,255,
-102,102,102,255,104,104,104,255,107,107,107,255,109,109,109,255,111,111,111,255,113,113,113,255,113,113,113,255,111,111,111,255,
-109,109,109,255,108,108,108,255,106,106,106,255,104,104,104,255,102,102,102,255,100,100,100,255, 98, 98, 98,255, 96, 96, 96,255,
- 93, 93, 93,255, 91, 91, 91,255, 88, 88, 88,255, 86, 86, 86,255, 81, 81, 81,255, 74, 74, 74,255, 67, 67, 67,255, 35, 35, 35,153,
- 22, 22, 22,102, 68, 68, 68,255, 77, 77, 77,255, 84, 84, 84,255, 89, 89, 89,255, 94, 94, 94,255, 98, 98, 98,255,101,101,101,255,
-105,105,105,255,108,108,108,255,110,110,110,255,112,112,112,255,115,114,114,255,116,116,116,255,115,115,115,255,113,113,113,255,
-111,111,111,255,110,110,110,255,108,108,108,255,106,106,106,255,104,104,104,255,101,101,101,255, 99, 99, 99,255, 97, 97, 97,255,
- 95, 95, 95,255, 92, 92, 92,255, 90, 89, 89,255, 87, 87, 87,255, 83, 83, 83,255, 76, 76, 76,255, 68, 68, 68,255, 36, 36, 36,153,
- 11, 11, 11, 51, 68, 68, 68,255, 78, 78, 78,255, 86, 86, 86,255, 91, 91, 91,255, 96, 96, 96,255,101,101,101,255,104,104,104,255,
-107,107,107,255,110,110,110,255,113,113,113,255,115,115,115,255,117,117,117,255,118,118,118,255,117,117,117,255,115,115,115,255,
-113,113,113,255,111,111,111,255,109,109,109,255,107,107,107,255,105,105,105,255,103,103,103,255,101,101,101,255, 98, 98, 98,255,
- 96, 96, 96,255, 93, 93, 93,255, 90, 90, 90,255, 88, 87, 87,255, 84, 84, 84,255, 77, 77, 77,255, 68, 68, 68,255, 23, 23, 23,102,
-  0,  0,  0,  0, 68, 68, 68,255, 79, 79, 79,255, 87, 87, 87,255, 93, 93, 93,255, 98, 98, 98,255,103,103,103,255,106,106,106,255,
-110,110,110,255,113,113,113,255,115,115,115,255,118,118,118,255,120,120,120,255,120,120,120,255,119,119,119,255,117,117,117,255,
-115,115,115,255,113,113,113,255,111,111,111,255,109,109,109,255,106,106,106,255,104,104,104,255,102,102,102,255, 99, 99, 99,255,
- 97, 97, 97,255, 94, 94, 94,255, 91, 91, 91,255, 88, 88, 88,255, 84, 84, 84,255, 77, 77, 77,255, 67, 67, 67,255, 11, 11, 11, 51,
-  0,  0,  0,  0, 41, 41, 41,153, 79, 79, 79,255, 88, 88, 88,255, 94, 94, 94,255,100,100,100,255,104,104,104,255,108,108,108,255,
-112,112,112,255,115,115,115,255,118,118,118,255,120,120,120,255,122,122,122,255,122,122,122,255,120,120,120,255,119,119,119,255,
-117,117,117,255,115,115,115,255,112,112,112,255,110,110,110,255,108,108,108,255,105,105,105,255,103,103,103,255,100,100,100,255,
- 98, 98, 98,255, 95, 95, 95,255, 92, 92, 92,255, 89, 89, 89,255, 85, 84, 84,255, 76, 76, 76,255, 41, 41, 41,153,  0,  0,  0,  0,
-  0,  0,  0,  0, 14, 14, 14, 51, 78, 78, 78,255, 88, 88, 88,255, 95, 95, 95,255,101,101,101,255,106,106,106,255,110,110,110,255,
-114,114,114,255,117,117,117,255,120,119,119,255,122,122,122,255,124,124,124,255,124,124,124,255,122,122,122,255,120,120,120,255,
-118,118,118,255,116,116,116,255,114,114,114,255,111,111,111,255,109,109,109,255,106,106,106,255,104,104,104,255,101,101,101,255,
- 98, 98, 98,255, 95, 95, 95,255, 92, 92, 92,255, 89, 89, 89,255, 84, 84, 84,255, 75, 75, 75,255, 37, 37, 37,153,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 59, 59, 59,204, 87, 87, 87,255, 95, 95, 95,255,101,101,101,255,106,106,106,255,111,111,111,255,
-114,114,114,255,118,118,118,255,121,121,121,255,123,123,123,255,125,125,125,255,125,125,125,255,124,124,124,255,122,122,122,255,
-120,120,120,255,117,117,117,255,115,115,115,255,112,112,112,255,110,110,110,255,107,107,107,255,104,104,104,255,102,102,102,255,
- 99, 98, 98,255, 95, 95, 95,255, 92, 92, 92,255, 89, 89, 89,255, 82, 82, 82,255, 57, 57, 57,204,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 14, 14, 14, 51, 84, 84, 84,255, 93, 93, 93,255,101,101,101,255,106,106,106,255,111,111,111,255,
-115,115,115,255,118,118,118,255,121,121,121,255,124,124,124,255,126,126,126,255,126,126,126,255,125,125,125,255,123,123,123,255,
-121,121,121,255,118,118,118,255,116,116,116,255,113,113,113,255,111,111,111,255,108,108,108,255,105,105,105,255,102,102,102,255,
- 99, 99, 99,255, 95, 95, 95,255, 92, 92, 92,255, 88, 88, 88,255, 78, 78, 78,255, 15, 15, 15, 51,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 32, 32,102, 91, 91, 91,255, 99, 99, 99,255,106,106,106,255,111,111,111,255,
-115,115,115,255,119,119,119,255,122,122,122,255,124,124,124,255,126,126,126,255,127,127,127,255,126,126,126,255,124,124,124,255,
-121,121,121,255,119,119,119,255,117,116,116,255,114,114,114,255,111,111,111,255,108,108,108,255,105,105,105,255,102,102,102,255,
- 98, 98, 98,255, 95, 95, 95,255, 91, 91, 91,255, 84, 84, 84,255, 45, 45, 45,153,  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, 51, 51, 51,153, 95, 95, 95,255,103,103,103,255,109,109,109,255,
-114,114,114,255,118,118,118,255,121,121,121,255,124,124,124,255,126,126,126,255,128,128,128,255,126,126,126,255,124,124,124,255,
-122,122,122,255,119,119,119,255,117,117,117,255,114,114,114,255,111,111,111,255,108,108,108,255,104,104,104,255,101,101,101,255,
- 98, 98, 98,255, 94, 94, 94,255, 88, 88, 88,255, 49, 49, 49,153, 12, 12, 12, 51,  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, 53, 53, 53,153, 98, 98, 98,255,106,106,106,255,
-112,112,112,255,116,116,116,255,119,119,119,255,122,122,122,255,125,125,125,255,127,127,127,255,126,126,126,255,124,124,124,255,
-122,122,122,255,119,119,119,255,116,116,116,255,113,113,113,255,110,110,110,255,107,107,107,255,104,104,104,255,100,100,100,255,
- 96, 96, 96,255, 91, 91, 91,255, 66, 66, 66,204, 15, 15, 15, 51,  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, 54, 54, 54,153,100,100,100,255,
-107,107,107,255,113,113,113,255,117,117,117,255,120,120,120,255,122,122,122,255,124,124,124,255,125,125,125,255,123,123,123,255,
-121,121,121,255,118,118,118,255,116,115,115,255,112,112,112,255,109,109,109,255,105,105,105,255,102,102,102,255, 97, 97, 97,255,
- 92, 92, 92,255, 51, 51, 51,153, 15, 15, 15, 51,  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,  0,  0,
- 97, 97, 97,255,106,106,106,255,112,112,112,255,115,115,115,255,118,118,118,255,121,121,121,255,122,122,122,255,121,121,121,255,
-119,119,119,255,117,117,117,255,114,114,114,255,111,111,111,255,107,107,107,255,103,103,103,255, 98, 98, 98,255, 74, 74, 74,204,
- 35, 35, 35,102,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 56, 56, 56,153, 80, 80, 80,204,106,106,106,255,111,111,111,255,114,114,114,255,116,116,116,255,117,117,117,255,
-116,116,116,255,113,113,113,255,110,110,110,255,106,106,106,255,102,102,102,255, 78, 78, 78,204, 38, 38, 38,102, 15, 15, 15, 51,
-  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,  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, 39, 39, 39,102, 62, 62, 62,153, 64, 64, 64,153, 86, 86, 86,204,
- 86, 86, 86,204, 84, 84, 84,204, 61, 61, 61,153, 40, 40, 40,102, 19, 19, 19, 51,  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,
- 77, 65,  0,  0, 32,  3,  0,  0,168,238, 51,  3,  0,  0,  0,  0, 35,  0,  0,  0,  1,  0,  0,  0,136,  7, 52,  3,  0,  0,  0,  0,
- 24,217, 51,  3,  0,  0,  0,  0,168,  1,222,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65,112,114,101,118,105,101,
-119,  0,  0, 97,116,101,114,105, 97,108,  0,  0,  0,  0,  0,  0,  5,  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,  1,  0,  0,  0,128, 63, 30, 18,240, 62,246,137,158, 62,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,188,248, 68, 62,  0,  0,128, 63,205,204, 76, 63,  0,  0,  0, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
- 10,215, 35, 60,  0,  0,  0,  0,  0,  0,  8,  0,  1,  0, 50,  0,205,204, 76, 62,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
-198,121,130, 63,  0,  0,160, 63,  0,  0,  0,  0,  0,  0,160, 63,  0,  0,  0,  0,  0,  0,  0,  0,205,204,204, 61,  2,  0,  2,  0,
- 50,  0,  0,  6,  0,  0,128, 63,  0,  0,128, 63, 18,  0, 18,  0, 10,215,163, 59, 10,215,163, 59,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  4,  0, 67,  0, 16,  3, 67,  0, 16,  3,  1,  0,  4,  0, 12,  0,  4,  0,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  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,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0, 63,
-  0,  0,128, 64,  0,  0,  0, 63,205,204,204, 61,  0,  0,  0, 63,205,204,204, 61,205,204,204, 61,  0,  0,128, 63, 16,  8,  1,  0,
-120,243, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
- 24,242, 51,  3,  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,  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,  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,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,200,246, 51,  3,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,111,148, 26, 63,111,148, 26, 63,111,148, 26, 63,
-205,204, 76, 61,205,204,204, 61,102,102,166, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  1,  0,  0,
- 24,242, 51,  3,  0,  0,  0,  0, 24,  0,  0,  0,  1,  0,  0,  0, 16,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 72, 23, 52,  3,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,
-205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65,  8,  3,  0,  0,120,243, 51,  3,  0,  0,  0,  0, 27,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  2,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,245, 40,220, 62,  0,  0,  0,  0,
-  3, 55,122, 63,  0,  0,128, 63, 96, 82,161, 62,  0,  0,128, 63,  0,  0,128, 63,  1,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,
-  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,
-  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,
-  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,
-  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,
-  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,
-  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,
-  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,
-  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,
-  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,
-  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,
-  0,  0,  0, 63,  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,  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,  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,  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,  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,  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,  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,  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, 68, 65, 84, 65, 40,  0,  0,  0,200,246, 51,  3,  0,  0,  0,  0, 11,  0,  0,  0,  1,  0,  0,  0,
- 32,  0,  0,  0,  0,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0, 56,247, 51,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  0, 16,  0,  0, 56,247, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  2,  2,  1, 51,  2,  1,  1, 51,  6,  3,  4,153,  6,  2,  4,153,
-  5,  1,  4,153,  3,  1,  3,102,  3,  0,  3,102,  2,  0,  2, 51,  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,  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,  3,  3,  1, 51,  8,  7,  3,153, 11,  9,  5,204, 13,  9,  6,255, 12,  8,  7,255, 11,  6,  7,255, 11,  5,  7,255,
- 10,  4,  7,255,  9,  3,  6,255,  9,  2,  7,255, 10,  2,  7,255, 10,  2,  8,255,  4,  1,  3,102,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  3,  1, 51,
- 11, 10,  4,153, 20, 16,  8,255, 23, 15, 12,255, 25, 13, 15,255, 25, 11, 18,255, 24,  9, 18,255, 22,  7, 17,255, 20,  7, 15,255,
- 17,  6, 12,255, 14,  5,  9,255, 11,  4,  6,255, 10,  4,  5,255, 10,  4,  5,255, 11,  4,  5,255, 12,  4,  5,255,  9,  3,  5,204,
-  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,  0,  0,  0,  0,  0,  0,  8,  7,  3,102, 23, 17,  8,204,
- 33, 22, 14,255, 37, 20, 21,255, 38, 16, 26,255, 39, 13, 30,255, 38, 11, 31,255, 36,  9, 30,255, 34,  9, 27,255, 31,  9, 22,255,
- 28,  9, 17,255, 24,  9, 13,255, 21,  9, 10,255, 17,  8,  7,255, 14,  6,  5,255, 11,  5,  3,255, 11,  5,  4,255, 12,  6,  4,255,
- 13,  6,  4,255,  5,  2,  2,102,  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, 16, 13,  5,153, 36, 26, 12,255, 45, 28, 19,255,
- 48, 25, 26,255, 51, 20, 33,255, 51, 16, 39,255, 51, 12, 42,255, 48, 10, 42,255, 46, 10, 39,255, 44, 10, 34,255, 41, 12, 28,255,
- 38, 13, 22,255, 34, 14, 16,255, 31, 14, 12,255, 27, 13,  9,255, 23, 11,  7,255, 19,  9,  6,255, 14,  7,  5,255, 12,  5,  4,255,
- 13,  6,  4,255, 13,  6,  4,255,  7,  3,  3,153,  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, 16, 11,  5,102, 45, 31, 15,255, 54, 34, 20,255, 59, 31, 28,255,
- 61, 26, 36,255, 61, 20, 44,255, 61, 15, 50,255, 60, 11, 52,255, 58, 10, 52,255, 56, 10, 48,255, 53, 12, 41,255, 51, 15, 33,255,
- 48, 17, 25,255, 44, 19, 18,255, 40, 19, 14,255, 37, 18, 11,255, 32, 15, 10,255, 28, 12, 10,255, 24,  9, 10,255, 19,  7,  9,255,
- 14,  5,  7,255, 13,  5,  6,255, 13,  5,  5,255,  7,  4,  2,153,  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, 15,  9,  7,102, 50, 33, 17,255, 61, 39, 20,255, 67, 37, 26,255, 70, 32, 36,255,
- 71, 26, 46,255, 72, 19, 54,255, 71, 14, 60,255, 69, 10, 62,255, 68,  9, 61,255, 66, 10, 56,255, 63, 13, 48,255, 60, 17, 39,255,
- 56, 21, 28,255, 53, 23, 21,255, 49, 23, 16,255, 46, 22, 15,255, 42, 18, 16,255, 37, 14, 17,255, 33, 10, 18,255, 28,  7, 17,255,
- 22,  5, 14,255, 15,  3, 10,255, 13,  3,  8,255, 12,  5,  6,255,  5,  3,  2,102,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 44, 26, 18,204, 66, 41, 21,255, 73, 43, 25,255, 78, 40, 33,255, 80, 34, 43,255,
- 80, 26, 53,255, 80, 19, 62,255, 80, 13, 69,255, 78, 10, 71,255, 76,  8, 71,255, 74, 10, 65,255, 71, 13, 57,255, 68, 18, 45,255,
- 65, 24, 32,255, 61, 27, 23,255, 57, 27, 18,255, 53, 25, 18,255, 49, 19, 22,255, 45, 14, 25,255, 41,  9, 27,255, 36,  5, 28,255,
- 30,  4, 25,255, 23,  2, 20,255, 16,  2, 13,255, 12,  2,  9,255, 12,  5,  6,255,  3,  3,  1, 51,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 23, 11, 12,102, 68, 38, 26,255, 78, 46, 25,255, 83, 46, 28,255, 84, 42, 36,255, 84, 35, 45,255,
- 84, 27, 55,255, 84, 20, 64,255, 83, 14, 71,255, 82,  9, 75,255, 81,  7, 75,255, 79,  8, 72,255, 78, 12, 63,255, 76, 19, 51,255,
- 73, 25, 39,255, 69, 30, 26,255, 65, 31, 20,255, 61, 27, 22,255, 57, 19, 29,255, 53, 11, 36,255, 48,  6, 39,255, 43,  3, 39,255,
- 37,  1, 36,255, 31,  1, 30,255, 24,  1, 23,255, 15,  1, 14,255, 12,  2,  9,255, 10,  5,  5,204,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 66, 29, 35,255, 81, 44, 29,255, 85, 49, 27,255, 86, 48, 29,255, 87, 43, 36,255, 87, 37, 45,255,
- 87, 29, 55,255, 86, 22, 64,255, 86, 15, 72,255, 85, 11, 77,255, 83,  8, 78,255, 82,  7, 76,255, 81, 10, 70,255, 79, 15, 59,255,
- 77, 22, 47,255, 76, 31, 31,255, 72, 34, 23,255, 68, 30, 24,255, 64, 21, 33,255, 60,  8, 48,255, 55,  2, 52,255, 50,  1, 49,255,
- 44,  0, 44,255, 38,  0, 38,255, 31,  0, 30,255, 22,  0, 22,255, 12,  1, 12,255, 12,  4,  9,255,  6,  5,  2,102,  0,  0,  0,  0,
-  0,  0,  0,  0, 27,  8, 19,102, 79, 34, 41,255, 86, 46, 31,255, 88, 50, 28,255, 89, 50, 30,255, 90, 46, 36,255, 90, 41, 44,255,
- 90, 34, 53,255, 89, 27, 62,255, 89, 20, 69,255, 87, 14, 76,255, 86, 10, 79,255, 85,  8, 80,255, 83,  8, 75,255, 82, 12, 67,255,
- 80, 20, 54,255, 78, 31, 35,255, 77, 36, 24,255, 75, 33, 27,255, 71, 20, 42,255, 66,  5, 60,255, 61,  0, 61,255, 56,  1, 55,255,
- 51,  3, 47,255, 44,  2, 41,255, 37,  1, 35,255, 29,  1, 28,255, 18,  0, 18,255, 12,  2, 10,255, 11,  6,  6,204,  0,  0,  0,  0,
-  0,  0,  0,  0, 58, 15, 43,204, 85, 36, 43,255, 89, 47, 33,255, 91, 52, 29,255, 93, 53, 30,255, 93, 51, 34,255, 94, 47, 41,255,
- 93, 41, 49,255, 93, 34, 58,255, 92, 26, 66,255, 91, 20, 73,255, 89, 14, 79,255, 88, 10, 81,255, 86,  9, 79,255, 85, 10, 74,255,
- 83, 16, 62,255, 81, 26, 45,255, 79, 34, 31,255, 78, 24, 43,255, 76, 11, 61,255, 73,  2, 71,255, 68,  3, 63,255, 63,  8, 51,255,
- 56,  9, 43,255, 50,  9, 37,255, 43,  6, 33,255, 35,  4, 30,255, 25,  1, 23,255, 13,  1, 13,255, 13,  6,  9,255,  0,  0,  0,  0,
- 17,  2, 15,102, 79, 18, 60,255, 88, 37, 46,255, 92, 49, 35,255, 95, 56, 31,255, 96, 58, 30,255, 97, 57, 33,255, 98, 54, 39,255,
- 98, 49, 46,255, 97, 42, 54,255, 96, 35, 61,255, 95, 28, 68,255, 93, 22, 74,255, 91, 16, 79,255, 89, 12, 82,255, 88, 10, 81,255,
- 86,  9, 78,255, 84, 14, 67,255, 82, 18, 58,255, 80,  2, 78,255, 78,  1, 77,255, 77,  9, 64,255, 74, 19, 46,255, 68, 21, 37,255,
- 62, 19, 34,255, 55, 18, 29,255, 48, 14, 27,255, 40,  9, 28,255, 30,  4, 25,255, 19,  2, 17,255, 12,  4, 10,255,  7,  5,  3,102,
- 28,  3, 26,102, 84, 19, 65,255, 92, 39, 50,255, 96, 52, 39,255, 99, 60, 33,255,101, 64, 32,255,102, 65, 33,255,103, 63, 37,255,
-102, 58, 42,255,102, 53, 47,255,100, 47, 54,255, 99, 40, 61,255, 97, 33, 66,255, 95, 26, 72,255, 93, 19, 78,255, 91, 14, 81,255,
- 89, 11, 82,255, 87,  8, 81,255, 84,  8, 76,255, 82, 20, 55,255, 81, 35, 31,255, 79, 31, 35,255, 77, 34, 27,255, 74, 34, 24,255,
- 67, 31, 22,255, 61, 27, 21,255, 53, 21, 22,255, 46, 15, 24,255, 35,  8, 23,255, 24,  3, 19,255, 13,  3, 11,255, 10,  6,  5,153,
- 31,  3, 29,102, 88, 22, 68,255, 96, 42, 54,255,101, 56, 44,255,104, 65, 37,255,107, 70, 34,255,108, 73, 34,255,108, 72, 36,255,
-108, 70, 39,255,107, 66, 43,255,106, 60, 48,255,105, 54, 54,255,102, 47, 59,255,100, 39, 64,255, 98, 32, 69,255, 95, 25, 73,255,
- 92, 20, 76,255, 90, 17, 74,255, 87, 28, 53,255, 85, 41, 30,255, 83, 34, 35,255, 81, 31, 37,255, 79, 35, 28,255, 77, 31, 31,255,
- 73, 30, 28,255, 66, 30, 21,255, 58, 26, 19,255, 50, 21, 20,255, 40, 13, 21,255, 29,  6, 20,255, 17,  3, 14,255, 12,  7,  7,204,
- 48,  5, 44,153, 92, 24, 72,255,100, 44, 60,255,106, 60, 50,255,111, 72, 42,255,113, 78, 38,255,115, 82, 37,255,115, 82, 37,255,
-115, 81, 38,255,115, 78, 41,255,114, 74, 45,255,112, 69, 49,255,110, 63, 53,255,107, 55, 56,255,103, 50, 57,255,100, 42, 59,255,
- 96, 36, 61,255, 93, 33, 59,255, 90, 40, 42,255, 87, 46, 27,255, 85, 33, 42,255, 83, 18, 59,255, 81,  8, 71,255, 78, 12, 61,255,
- 76, 21, 45,255, 70, 29, 27,255, 63, 29, 20,255, 55, 25, 17,255, 45, 18, 19,255, 33,  9, 20,255, 21,  4, 16,255, 11,  6,  7,204,
- 47,  6, 42,153, 95, 26, 76,255,105, 48, 65,255,112, 66, 56,255,118, 79, 48,255,121, 87, 43,255,122, 91, 41,255,123, 93, 40,255,
-124, 94, 40,255,124, 93, 42,255,124, 91, 45,255,124, 88, 48,255,122, 83, 51,255,118, 76, 52,255,112, 69, 49,255,106, 62, 46,255,
-102, 54, 46,255, 98, 51, 41,255, 94, 52, 31,255, 90, 48, 30,255, 87, 31, 49,255, 85, 17, 65,255, 82,  6, 75,255, 80,  4, 75,255,
- 77, 14, 57,255, 74, 24, 39,255, 67, 28, 25,255, 59, 27, 18,255, 49, 21, 17,255, 37, 13, 18,255, 25,  5, 18,255, 11,  5,  8,204,
- 47,  8, 40,153, 99, 31, 78,255,111, 53, 70,255,119, 72, 62,255,125, 86, 55,255,129, 96, 50,255,131,102, 46,255,133,105, 45,255,
-134,107, 45,255,137,110, 49,255,142,113, 55,255,143,113, 59,255,142,110, 60,255,136,101, 58,255,126, 91, 51,255,117, 80, 44,255,
-108, 70, 38,255,102, 64, 33,255, 98, 56, 34,255, 93, 44, 43,255, 90, 29, 57,255, 87, 16, 70,255, 84,  6, 79,255, 81,  4, 77,255,
- 79, 11, 64,255, 76, 19, 49,255, 71, 26, 32,255, 62, 28, 20,255, 52, 24, 17,255, 40, 15, 18,255, 27,  7, 19,255,  9,  3,  7,153,
- 31,  8, 24,102,102, 34, 79,255,116, 58, 75,255,126, 80, 67,255,133, 95, 61,255,138,106, 57,255,141,113, 53,255,144,117, 52,255,
-148,123, 55,255,155,130, 62,255,166,140, 73,255,174,147, 83,255,173,144, 85,255,163,133, 79,255,147,115, 66,255,131, 97, 53,255,
-118, 83, 43,255,108, 70, 39,255,102, 56, 44,255, 96, 42, 54,255, 92, 28, 65,255, 89, 16, 75,255, 86,  8, 80,255, 83,  5, 78,255,
- 80,  8, 69,255, 77, 17, 53,255, 74, 25, 37,255, 65, 28, 23,255, 55, 26, 17,255, 43, 17, 18,255, 29,  8, 19,255, 10,  3,  7,153,
- 16,  5, 11, 51,103, 39, 76,255,121, 65, 77,255,133, 88, 72,255,142,105, 67,255,148,117, 63,255,152,125, 60,255,156,131, 61,255,
-164,140, 67,255,178,155, 80,255,198,174,101,255,213,188,119,255,215,189,124,255,201,173,113,255,175,144, 91,255,149,116, 70,255,
-129, 93, 55,255,115, 74, 49,255,106, 58, 52,255,100, 42, 62,255, 95, 27, 72,255, 91, 17, 79,255, 87, 11, 79,255, 84,  7, 79,255,
- 81,  8, 72,255, 78, 15, 57,255, 75, 23, 41,255, 68, 28, 26,255, 57, 27, 18,255, 45, 18, 18,255, 30,  7, 20,255,  6,  2,  5,102,
-  0,  0,  0,  0,101, 43, 67,255,126, 72, 77,255,140, 97, 75,255,151,116, 71,255,158,129, 68,255,162,138, 66,255,168,145, 68,255,
-179,157, 78,255,199,178, 98,255,227,205,127,255,251,228,154,255,255,232,163,255,238,210,149,255,203,172,119,255,167,132, 89,255,
-140,101, 69,255,122, 77, 62,255,111, 58, 63,255,103, 43, 69,255, 97, 29, 76,255, 93, 20, 79,255, 89, 15, 77,255, 85,  9, 78,255,
- 82,  9, 72,255, 79, 14, 59,255, 75, 22, 43,255, 69, 29, 26,255, 59, 27, 18,255, 46, 18, 19,255, 29,  7, 20,255,  3,  1,  2, 51,
-  0,  0,  0,  0, 61, 30, 36,153,126, 76, 75,255,146,105, 76,255,158,127, 74,255,167,142, 71,255,173,151, 71,255,179,159, 74,255,
-191,172, 85,255,214,195,107,255,245,225,141,255,255,251,172,255,255,255,183,255,255,233,171,255,222,190,138,255,180,143,104,255,
-148,106, 81,255,127, 79, 73,255,115, 60, 72,255,107, 45, 75,255,100, 33, 78,255, 95, 24, 78,255, 90, 18, 77,255, 86, 12, 77,255,
- 82, 12, 69,255, 79, 16, 57,255, 76, 24, 41,255, 71, 30, 27,255, 60, 28, 19,255, 46, 17, 20,255, 18,  4, 13,153,  0,  0,  0,  0,
-  0,  0,  0,  0, 20, 11,  9, 51,124, 78, 67,255,148,110, 74,255,164,136, 74,255,175,154, 73,255,182,164, 73,255,187,172, 75,255,
-199,183, 86,255,219,202,107,255,245,228,137,255,255,249,164,255,255,254,176,255,255,233,167,255,222,191,138,255,183,146,107,255,
-152,109, 86,255,131, 82, 77,255,119, 64, 76,255,110, 49, 77,255,103, 38, 78,255, 97, 30, 75,255, 92, 25, 71,255, 87, 15, 75,255,
- 83, 15, 66,255, 79, 19, 53,255, 76, 26, 37,255, 71, 31, 25,255, 60, 28, 19,255, 43, 14, 22,255, 11,  2,  8,153,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 89, 58, 40,204,147,112, 70,255,168,143, 73,255,181,164, 73,255,189,176, 73,255,194,183, 74,255,
-202,190, 81,255,215,203, 96,255,233,219,118,255,249,233,139,255,252,232,147,255,237,213,141,255,209,179,121,255,178,143,101,255,
-152,111, 86,255,134, 87, 79,255,122, 69, 77,255,113, 55, 77,255,105, 44, 74,255, 98, 37, 69,255, 93, 33, 62,255, 87, 30, 54,255,
- 83, 21, 59,255, 79, 23, 49,255, 76, 30, 33,255, 71, 33, 23,255, 58, 25, 21,255, 30,  8, 18,204,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 18, 12,  6, 51,136,104, 58,255,165,142, 69,255,184,169, 72,255,194,184, 72,255,199,192, 73,255,
-204,197, 76,255,210,202, 83,255,218,208, 96,255,225,213,109,255,224,207,114,255,212,190,111,255,192,166,101,255,170,138, 89,255,
-151,112, 81,255,136, 92, 77,255,125, 75, 76,255,116, 61, 74,255,107, 51, 70,255,100, 44, 63,255, 93, 39, 55,255, 87, 36, 46,255,
- 83, 31, 44,255, 79, 27, 42,255, 75, 32, 29,255, 68, 32, 22,255, 51, 18, 25,255,  8,  2,  5, 51,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 48, 36, 17,102,155,132, 61,255,180,167, 68,255,194,187, 70,255,202,198, 70,255,
-206,203, 72,255,207,205, 75,255,209,204, 80,255,209,201, 86,255,204,192, 89,255,194,177, 88,255,180,157, 84,255,165,136, 79,255,
-150,115, 76,255,138, 97, 74,255,127, 81, 72,255,117, 68, 68,255,108, 58, 63,255,100, 50, 55,255, 93, 46, 46,255, 87, 43, 36,255,
- 82, 31, 43,255, 78, 32, 34,255, 74, 34, 24,255, 63, 26, 24,255, 28,  8, 17,153,  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, 78, 64, 27,153,164,148, 60,255,187,179, 66,255,199,197, 68,255,
-205,205, 69,255,206,207, 70,255,205,204, 71,255,202,197, 73,255,195,186, 75,255,186,172, 75,255,175,155, 74,255,162,137, 72,255,
-150,119, 70,255,139,102, 69,255,128, 87, 66,255,118, 75, 60,255,108, 64, 54,255, 99, 56, 45,255, 92, 51, 37,255, 86, 41, 37,255,
- 81, 33, 38,255, 76, 35, 27,255, 70, 31, 24,255, 34, 12, 17,153,  3,  0,  3, 51,  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, 82, 70, 27,153,167,155, 58,255,188,183, 64,255,
-200,199, 67,255,203,204, 68,255,202,202, 68,255,199,196, 69,255,192,186, 69,255,183,172, 69,255,173,156, 68,255,162,140, 67,255,
-150,123, 65,255,138,107, 62,255,127, 92, 58,255,116, 79, 52,255,106, 68, 45,255, 97, 60, 37,255, 90, 53, 30,255, 84, 40, 35,255,
- 79, 37, 28,255, 73, 33, 25,255, 47, 16, 23,204,  9,  1,  7, 51,  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, 79, 68, 25,153,161,150, 54,255,
-182,177, 62,255,191,189, 64,255,194,193, 65,255,192,189, 65,255,186,181, 65,255,179,169, 64,255,169,155, 63,255,158,139, 61,255,
-147,123, 59,255,136,108, 55,255,124, 93, 49,255,113, 81, 43,255,103, 70, 37,255, 94, 59, 30,255, 86, 48, 29,255, 80, 40, 28,255,
- 73, 33, 26,255, 39, 14, 19,153,  9,  1,  7, 51,  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,  0,  0,
-139,121, 46,255,163,154, 54,255,174,168, 58,255,176,170, 59,255,174,166, 59,255,168,158, 59,255,160,146, 56,255,150,132, 53,255,
-139,118, 50,255,128,104, 45,255,117, 90, 40,255,107, 77, 35,255, 97, 64, 31,255, 88, 51, 29,255, 80, 42, 26,255, 59, 27, 22,204,
- 26,  9, 13,102,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 70, 55, 25,153,106, 89, 37,204,142,127, 46,255,148,134, 48,255,147,132, 48,255,141,124, 46,255,134,115, 44,255,
-125,103, 41,255,115, 89, 37,255,106, 76, 34,255, 96, 60, 35,255, 86, 42, 39,255, 64, 25, 33,204, 30, 14, 11,102,  7,  0,  7, 51,
-  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,  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, 44, 30, 18,102, 69, 52, 25,153, 70, 54, 24,153, 88, 63, 33,204,
- 82, 54, 33,204, 76, 42, 35,204, 52, 23, 29,153, 34, 14, 19,102, 16,  4, 11, 51,  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,
- 77, 65,  0,  0, 32,  3,  0,  0,136,  7, 52,  3,  0,  0,  0,  0, 35,  0,  0,  0,  1,  0,  0,  0, 24, 16, 52,  3,  0,  0,  0,  0,
-168,238, 51,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65,116,101,120,116,117,114,
-101,  0,114,101,118,105,101,119, 46, 48, 48, 49,  0,  0,  0,  0,  1,  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,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,205,204, 76, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
- 10,215, 35, 60,  0,  0,  0,  0,  0,  0,  8,  0,  1,  0, 50,  0,205,204, 76, 62,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
-  0,  0,  0,  0,  0,  0,160, 63,  0,  0,  0,  0,  0,  0,160, 63,  0,  0,  0,  0,  0,  0,  0,  0,205,204,204, 61,  2,  0,  2,  0,
- 50,  0,  0,  6,  0,  0,128, 63,  0,  0,128, 63, 18,  0, 18,  0, 10,215,163, 59, 10,215,163, 59,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  4,  0, 71,  0,  1,  3, 67,  0,  1,  3,  1,  0,  4,  0, 12,  0,  4,  0,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  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,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0, 63,
-  0,  0,128, 64,  0,  0,  0, 63,205,204,204, 61,  0,  0,  0, 63,205,204,204, 61,205,204,204, 61,  0,  0,128, 63,  1,  8,129,  0,
- 88, 12, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-248, 10, 52,  3,  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,  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,  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,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,168, 15, 52,  3,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,111,148, 26, 63,111,148, 26, 63,111,148, 26, 63,
-205,204, 76, 61,205,204,204, 61,102,102,166, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  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, 68, 65, 84, 65, 24,  1,  0,  0,
-248, 10, 52,  3,  0,  0,  0,  0, 24,  0,  0,  0,  1,  0,  0,  0,  1,  0,129,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 72, 23, 52,  3,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,
-205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65,  8,  3,  0,  0, 88, 12, 52,  3,  0,  0,  0,  0, 27,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  2,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,245, 40,220, 62,  0,  0,  0,  0,
-  3, 55,122, 63,  0,  0,128, 63, 96, 82,161, 62,  0,  0,128, 63,  0,  0,128, 63,  1,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,
-  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,
-  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,
-  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,
-  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,
-  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,
-  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,
-  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,
-  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,
-  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,
-  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,
-  0,  0,  0, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -5833,709 +6129,270 @@ char datatoc_preview_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,120,198, 26,  4,  0,  0,  0,  0, 12,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65,  0,  0,128,  3,  0,  0,232,198, 26,  4,  0,  0,  0,  0, 39,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,216,189, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 77, 65,116,101,120,116,117,114,101, 46, 48, 48, 49,  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,  0,  0,  0,  0,  0,  1,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,205,204, 76, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 10,215, 35, 60,
+  0,  0,  0,  0,  0,  0,  8,  0,  1,  0, 50,  0,205,204, 76, 62,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62, 16,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,160, 63,  0,  0,  0,  0,  0,  0,160, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  2,  0,  2,  0, 50,  0,  0,  6,  0,  0,128, 63,  0,  0,128, 63, 18,  0, 18,  0, 10,215,163, 59,
+ 10,215,163, 59,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  4,  0, 67,  0,  0,  3, 67,  0,  0,  3,  1,  0,  4,  0, 12,  0,  4,  0,
+  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  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,  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,128, 63,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0,  3,  0,
+  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,128, 64,  0,  0,  0, 63,205,204,204, 61,  0,  0,  0, 63,205,204,204, 61,
+205,204,204, 61,  0,  0,128, 63,  0,  0,  0,  0,184,202, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  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,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,168, 15, 52,  3,  0,  0,  0,  0, 11,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 77, 65,  0,  0, 32,  3,  0,  0, 24, 16, 52,  3,  0,  0,  0,  0, 35,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,136,  7, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 77, 65,116,101,120,116,117,114,101, 46, 48, 48, 49,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,205,204, 76, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63, 10,215, 35, 60,  0,  0,  0,  0,  0,  0,  8,  0,  1,  0, 50,  0,205,204, 76, 62,  0,  0,128, 63,
-  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,160, 63,  0,  0,  0,  0,  0,  0,160, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  2,  0,  2,  0, 50,  0,  0,  6,  0,  0,128, 63,  0,  0,128, 63, 18,  0, 18,  0, 10,215,163, 59, 10,215,163, 59,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  4,  0, 67,  0,  0,  3, 67,  0,  0,  3,  1,  0,  4,  0, 12,  0,  4,  0,  0,  0,  0, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  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,128, 63,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0,  3,  0,  0,  0,  2,  0,
-  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,128, 64,  0,  0,  0, 63,205,204,204, 61,  0,  0,  0, 63,205,204,204, 61,205,204,204, 61,
-  0,  0,128, 63,  0,  0,  0,  0,136, 19, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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,  8,206, 26,  4,  0,  0,  0,  0,  0,  0,  0, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+111,148, 26, 63,111,148, 26, 63,111,148, 26, 63,205,204, 76, 61,205,204,204, 61,102,102,166, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  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, 68, 65, 84, 65,  8,  3,  0,  0,184,202, 26,  4,  0,  0,  0,  0, 28,  0,  0,  0,  1,  0,  0,  0,  0,  0,  2,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,245, 40,220, 62,  0,  0,  0,  0,  3, 55,122, 63,
+  0,  0,128, 63, 96, 82,161, 62,  0,  0,128, 63,  0,  0,128, 63,  1,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,
+  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,
+  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,
+  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,
+  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,
+  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,
+  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,
+  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,
+  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,  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,  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,  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,  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,  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,  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,  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, 68, 65, 84, 65, 40,  0,  0,  0,  8,206, 26,  4,  0,  0,  0,  0, 12,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 84, 69,  0,  0,168,  1,  0,  0,120,206, 26,  4,  0,  0,  0,  0, 33,  0,  0,  0,  1,  0,  0,  0,216,208, 26,  4,
+  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, 84, 69,112,114,
+101,118,105,101,119,  0,101,120,  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,  0,  0,  0,  0,  0,  0,
+  2,  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,128, 62,
+  0,  0,160, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0, 64,  0,  0,  0, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 64,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,
+  5,  0,  8,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  8,  0,  0,  0,
+  1,  0,  1,  0,  3,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,205,204,204, 60,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  2,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,104,208, 26,  4,
+  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, 68, 65, 84, 65, 40,  0,  0,  0,104,208, 26,  4,  0,  0,  0,  0, 12,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 84, 69,  0,  0,168,  1,  0,  0,216,208, 26,  4,  0,  0,  0,  0, 33,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,120,206, 26,  4,  0,  0,  0,  0,  8,124,  8,168, 69,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 84, 69,102, 97,
+107,101,115,104, 97,100,111,119,  0,  0, 76,101,110,100,  0,101,120,  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,
+  2,  0,  0,  0, 53,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 62,
+  0,  0,160, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0, 64,  0,  0,  0, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 64,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,
+  5,  0, 40,  0,  5,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  8,  0,  0,  0,
+  1,  0,  1,  0,  3,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,205,204,204, 60,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  2,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200,210, 26,  4,
+  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, 68, 65, 84, 65, 40,  0,  0,  0,200,210, 26,  4,  0,  0,  0,  0, 12,  0,  0,  0,  1,  0,  0,  0, 32,  0,  0,  0,
+  0,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0, 56,211, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65,  0, 16,  0,  0, 56,211, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,161,161,161,255,
+161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255, 14, 14, 14,255,
+ 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,155,155,155,255,
+155,154,154,255,155,155,155,255,157,157,157,255,158,158,158,255,158,158,158,255,159,159,159,255,159,159,159,255, 43, 43, 43,255,
+ 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,161,161,161,255,
+161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255, 14, 14, 14,255,
+ 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 15, 15, 15,255, 15, 15, 15,255, 15, 15, 15,255, 15, 15, 15,255,147,147,147,255,
+147,147,147,255,147,147,147,255,148,148,148,255,150,150,150,255,153,153,153,255,157,157,157,255,159,159,159,255, 43, 43, 43,255,
+ 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,161,161,161,255,
+161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,159,159,159,255, 14, 14, 14,255,
+ 15, 15, 15,255, 15, 15, 15,255, 16, 16, 16,255, 17, 17, 17,255, 18, 18, 18,255, 18, 18, 18,255, 19, 19, 19,255,141,141,141,255,
+141,141,141,255,141,141,141,255,142,142,142,255,143,143,143,255,146,146,146,255,149,149,149,255,153,153,153,255, 43, 43, 43,255,
+ 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,161,161,161,255,
+161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,157,157,157,255,152,152,152,255, 15, 15, 15,255,
+ 17, 17, 17,255, 18, 18, 18,255, 20, 20, 20,255, 21, 21, 21,255, 22, 22, 22,255, 23, 23, 23,255, 24, 24, 24,255,137,137,137,255,
+137,137,137,255,137,137,137,255,137,137,137,255,138,138,138,255,140,140,140,255,143,143,143,255,147,147,147,255, 42, 42, 42,255,
+ 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,161,161,161,255,
+161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,156,156,156,255,150,150,150,255,146,146,146,255, 18, 18, 18,255,
+ 20, 20, 20,255, 22, 22, 22,255, 25, 25, 25,255, 27, 27, 27,255, 29, 29, 29,255, 30, 30, 30,255, 31, 31, 31,255,135,135,135,255,
+135,135,135,255,135,134,134,255,135,135,135,255,135,135,135,255,137,137,137,255,139,139,139,255,141,141,141,255, 42, 42, 42,255,
+ 15, 15, 15,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,161,161,161,255,
+161,161,161,255,161,161,161,255,161,161,161,255,156,156,156,255,150,150,150,255,145,145,145,255,142,142,142,255, 22, 22, 22,255,
+ 25, 25, 25,255, 28, 28, 28,255, 32, 32, 32,255, 35, 35, 35,255, 37, 37, 37,255, 39, 39, 39,255, 40, 40, 40,255,135,135,135,255,
+135,135,135,255,134,134,134,255,134,134,134,255,134,134,134,255,134,134,134,255,136,136,136,255,138,138,138,255, 43, 43, 43,255,
+ 16, 16, 16,255, 15, 15, 15,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,161,161,161,255,
+161,161,161,255,161,161,161,255,157,157,157,255,150,150,150,255,145,145,145,255,141,141,141,255,138,138,138,255, 27, 27, 27,255,
+ 31, 31, 31,255, 36, 36, 36,255, 40, 40, 40,255, 44, 44, 44,255, 47, 47, 47,255, 50, 50, 50,255, 51, 51, 51,255,137,137,137,255,
+136,136,136,255,136,135,135,255,135,135,135,255,134,134,134,255,134,134,134,255,134,134,134,255,135,135,135,255, 45, 45, 45,255,
+ 19, 19, 19,255, 16, 16, 16,255, 15, 15, 15,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,161,161,161,255,
+161,161,161,255,159,159,159,255,152,152,152,255,146,146,146,255,142,142,142,255,138,138,138,255,137,136,136,255, 32, 32, 32,255,
+ 38, 38, 38,255, 44, 44, 44,255, 50, 50, 50,255, 55, 55, 55,255, 59, 59, 59,255, 62, 62, 62,255, 64, 64, 64,255,141,141,141,255,
+140,140,140,255,139,139,139,255,137,137,137,255,136,136,136,255,135,135,135,255,134,134,134,255,134,134,134,255, 49, 49, 49,255,
+ 22, 22, 22,255, 19, 19, 19,255, 16, 16, 16,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,
+ 14, 14, 14,255, 14, 14, 14,255, 15, 15, 15,255, 18, 18, 18,255, 22, 22, 22,255, 27, 27, 27,255, 33, 33, 33,255,136,136,136,255,
+137,137,137,255,138,138,138,255,141,141,141,255,143,143,143,255,145,145,145,255,147,147,147,255,147,147,147,255, 79, 79, 79,255,
+ 77, 77, 77,255, 73, 73, 73,255, 67, 67, 67,255, 61, 61, 61,255, 53, 53, 53,255, 46, 46, 46,255, 39, 39, 39,255,114,114,114,255,
+137,137,137,255,139,139,139,255,143,143,143,255,148,148,148,255,155,155,155,255,161,161,161,255,161,161,161,255, 14, 14, 14,255,
+ 14, 14, 14,255, 15, 15, 15,255, 17, 17, 17,255, 20, 20, 20,255, 25, 25, 25,255, 31, 31, 31,255, 38, 38, 38,255,137,137,137,255,
+139,139,139,255,142,142,142,255,145,145,145,255,148,148,148,255,152,152,152,255,154,154,154,255,155,155,155,255, 96, 96, 96,255,
+ 93, 93, 93,255, 88, 88, 88,255, 81, 81, 81,255, 73, 73, 73,255, 64, 64, 64,255, 55, 55, 55,255, 46, 46, 46,255,116,116,116,255,
+136,136,136,255,137,137,137,255,140,140,140,255,145,145,145,255,151,151,151,255,159,159,159,255,161,161,161,255, 14, 14, 14,255,
+ 14, 14, 14,255, 15, 15, 15,255, 18, 18, 18,255, 23, 23, 23,255, 28, 28, 28,255, 36, 36, 36,255, 44, 44, 44,255,138,138,138,255,
+142,142,142,255,146,146,146,255,151,151,151,255,155,155,155,255,160,160,160,255,163,163,163,255,165,165,165,255,114,114,114,255,
+111,111,111,255,104,104,104,255, 95, 95, 95,255, 85, 85, 85,255, 75, 75, 75,255, 64, 64, 64,255, 53, 53, 53,255,117,117,117,255,
+136,135,135,255,136,136,136,255,139,139,139,255,142,142,142,255,148,148,148,255,156,156,156,255,161,161,161,255, 14, 14, 14,255,
+ 14, 14, 14,255, 16, 16, 16,255, 20, 20, 20,255, 25, 25, 25,255, 32, 32, 32,255, 40, 40, 40,255, 50, 50, 50,255,141,141,141,255,
+145,145,145,255,151,151,151,255,157,157,157,255,163,163,163,255,169,169,169,255,174,174,174,255,177,177,177,255,135,135,135,255,
+130,130,130,255,122,122,122,255,111,111,111,255, 98, 98, 98,255, 85, 85, 85,255, 73, 73, 73,255, 61, 61, 61,255,119,119,119,255,
+136,136,136,255,136,136,136,255,137,137,137,255,141,141,141,255,146,146,146,255,153,153,153,255,161,161,161,255, 14, 14, 14,255,
+ 15, 15, 15,255, 17, 17, 17,255, 21, 21, 21,255, 27, 27, 27,255, 35, 35, 35,255, 44, 44, 44,255, 55, 55, 55,255,143,143,143,255,
+149,149,149,255,156,156,156,255,163,163,163,255,172,172,172,255,180,180,180,255,186,186,186,255,190,190,190,255,158,158,158,255,
+151,151,151,255,140,140,140,255,126,126,126,255,111,111,111,255, 95, 95, 95,255, 81, 81, 81,255, 67, 67, 67,255,122,121,121,255,
+136,136,136,255,136,136,136,255,137,137,137,255,139,139,139,255,144,144,144,255,151,151,151,255,159,159,159,255, 14, 14, 14,255,
+ 15, 15, 15,255, 18, 18, 18,255, 23, 23, 23,255, 29, 29, 29,255, 38, 38, 38,255, 48, 48, 48,255, 60, 60, 60,255,145,145,145,255,
+152,152,152,255,160,160,160,255,170,170,170,255,180,180,180,255,191,191,191,255,200,200,200,255,206,206,206,255,182,182,182,255,
+173,173,173,255,158,158,158,255,140,140,140,255,122,122,122,255,104,104,104,255, 88, 88, 88,255, 73, 73, 73,255,123,123,123,255,
+137,137,137,255,136,136,136,255,136,136,136,255,139,139,139,255,143,143,143,255,149,149,149,255,157,157,157,255, 14, 14, 14,255,
+ 15, 15, 15,255, 18, 18, 18,255, 24, 24, 24,255, 31, 31, 31,255, 39, 39, 39,255, 50, 50, 50,255, 63, 63, 63,255,147,147,147,255,
+154,154,154,255,164,164,164,255,175,175,175,255,187,187,187,255,200,200,200,255,213,213,213,255,223,223,223,255,208,208,208,255,
+193,193,193,255,173,173,173,255,151,151,151,255,130,130,130,255,111,111,111,255, 93, 93, 93,255, 77, 77, 77,255,125,125,125,255,
+137,137,137,255,136,136,136,255,136,136,136,255,138,138,138,255,142,142,142,255,148,148,148,255,156,156,156,255, 14, 14, 14,255,
+ 16, 16, 16,255, 19, 19, 19,255, 24, 24, 24,255, 31, 31, 31,255, 40, 40, 40,255, 52, 52, 52,255, 65, 65, 65,255,148,148,148,255,
+156,156,156,255,166,166,166,255,177,177,177,255,191,191,191,255,206,206,206,255,223,223,223,255,240,240,240,255,232,232,232,255,
+208,208,208,255,182,182,182,255,158,158,158,255,135,135,135,255,114,114,114,255, 96, 96, 96,255, 79, 79, 79,255,126,126,126,255,
+138,138,138,255,136,136,136,255,136,136,136,255,138,138,138,255,142,142,142,255,148,148,148,255,155,155,155,255,155,155,155,255,
+147,147,147,255,141,141,141,255,138,138,138,255,136,136,136,255,136,136,136,255,138,138,138,255,142,142,142,255, 80, 80, 80,255,
+ 97, 97, 97,255,116,116,116,255,137,137,137,255,159,159,159,255,184,184,184,255,210,210,210,255,235,235,235,255,240,240,240,255,
+223,223,223,255,205,205,205,255,190,190,190,255,176,176,176,255,164,164,164,255,154,154,154,255,147,147,147,255, 79, 79, 79,255,
+ 51, 51, 51,255, 40, 40, 40,255, 31, 31, 31,255, 24, 24, 24,255, 19, 19, 19,255, 15, 15, 15,255, 14, 14, 14,255,156,155,155,255,
+148,148,148,255,142,142,142,255,138,138,138,255,136,136,136,255,136,136,136,255,138,138,138,255,141,141,141,255, 78, 78, 78,255,
+ 94, 94, 94,255,112,112,112,255,132,132,132,255,153,153,153,255,175,175,175,255,195,195,195,255,210,210,210,255,224,224,224,255,
+213,213,213,255,200,200,200,255,186,186,186,255,173,173,173,255,162,162,162,255,153,153,153,255,146,146,146,255, 78, 78, 78,255,
+ 50, 50, 50,255, 39, 39, 39,255, 30, 30, 30,255, 23, 23, 23,255, 18, 18, 18,255, 15, 15, 15,255, 14, 14, 14,255,157,157,157,255,
+149,149,149,255,142,142,142,255,138,138,138,255,136,136,136,255,136,136,136,255,137,137,137,255,140,140,140,255, 74, 74, 74,255,
+ 89, 89, 89,255,106,106,106,255,124,124,124,255,142,142,142,255,160,160,160,255,175,175,175,255,184,184,184,255,206,206,206,255,
+200,200,200,255,190,190,190,255,179,179,179,255,169,169,169,255,159,159,159,255,151,151,151,255,144,144,144,255, 75, 75, 75,255,
+ 47, 47, 47,255, 37, 37, 37,255, 29, 29, 29,255, 22, 22, 22,255, 18, 18, 18,255, 15, 15, 15,255, 14, 14, 14,255,158,158,158,255,
+150,150,150,255,144,144,144,255,139,139,139,255,136,136,136,255,136,135,135,255,136,136,136,255,139,139,139,255, 68, 68, 68,255,
+ 82, 82, 82,255, 97, 97, 97,255,112,112,112,255,128,128,128,255,142,142,142,255,153,153,153,255,159,159,159,255,191,191,191,255,
+187,187,187,255,180,180,180,255,171,171,171,255,162,162,162,255,154,154,154,255,148,147,147,255,142,142,142,255, 72, 72, 72,255,
+ 44, 44, 44,255, 35, 35, 35,255, 27, 27, 27,255, 21, 21, 21,255, 17, 17, 17,255, 15, 15, 15,255, 14, 14, 14,255,161,161,161,255,
+152,152,152,255,145,145,145,255,140,140,140,255,137,137,137,255,136,136,136,255,136,136,136,255,138,138,138,255, 62, 62, 62,255,
+ 74, 74, 74,255, 87, 87, 87,255,100,100,100,255,112,112,112,255,124,124,124,255,132,132,132,255,137,137,137,255,177,177,177,255,
+174,174,174,255,169,169,169,255,163,163,163,255,156,156,156,255,150,150,150,255,144,144,144,255,140,140,140,255, 67, 67, 67,255,
+ 40, 40, 40,255, 32, 32, 32,255, 25, 25, 25,255, 20, 20, 20,255, 16, 16, 16,255, 14, 14, 14,255, 14, 14, 14,255,161,161,161,255,
+155,155,155,255,148,148,148,255,142,142,142,255,138,138,138,255,136,136,136,255,136,136,136,255,136,136,136,255, 54, 54, 54,255,
+ 65, 65, 65,255, 76, 76, 76,255, 87, 87, 87,255, 97, 97, 97,255,106,106,106,255,112,112,112,255,116,116,116,255,165,165,165,255,
+163,163,163,255,159,159,159,255,155,155,155,255,150,150,150,255,145,145,145,255,141,141,141,255,137,137,137,255, 62, 62, 62,255,
+ 36, 36, 36,255, 28, 28, 28,255, 22, 22, 22,255, 18, 18, 18,255, 15, 15, 15,255, 14, 14, 14,255, 14, 14, 14,255,161,161,161,255,
+158,158,158,255,151,151,151,255,144,144,144,255,140,140,140,255,137,137,137,255,136,136,136,255,136,136,136,255, 47, 47, 47,255,
+ 56, 56, 56,255, 65, 65, 65,255, 74, 74, 74,255, 82, 82, 82,255, 89, 89, 89,255, 94, 94, 94,255, 97, 97, 97,255,155,155,155,255,
+154,154,154,255,151,151,151,255,148,148,148,255,144,144,144,255,140,140,140,255,138,138,138,255,136,136,136,255, 58, 58, 58,255,
+ 31, 31, 31,255, 25, 25, 25,255, 20, 20, 20,255, 17, 17, 17,255, 15, 15, 15,255, 14, 14, 14,255, 14, 14, 14,255,161,161,161,255,
+161,161,161,255,154,154,154,255,148,148,148,255,142,142,142,255,139,139,139,255,137,137,137,255,136,136,136,255, 40, 40, 40,255,
+ 47, 47, 47,255, 54, 54, 54,255, 62, 62, 62,255, 68, 68, 68,255, 74, 74, 74,255, 78, 78, 78,255, 80, 80, 80,255,147,147,147,255,
+146,146,146,255,144,144,144,255,142,142,142,255,139,139,139,255,137,137,137,255,135,135,135,255,135,135,135,255, 53, 53, 53,255,
+ 27, 27, 27,255, 22, 22, 22,255, 18, 18, 18,255, 15, 15, 15,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 44, 44, 44,255,
+ 44, 44, 44,255, 43, 43, 43,255, 42, 42, 42,255, 42, 42, 42,255, 43, 43, 43,255, 46, 46, 46,255, 49, 49, 49,255,115,115,115,255,
+116,116,116,255,118,118,118,255,120,120,120,255,122,122,122,255,124,124,124,255,126,126,126,255,126,126,126,255, 80, 80, 80,255,
+ 79, 79, 79,255, 76, 76, 76,255, 72, 72, 72,255, 67, 67, 67,255, 62, 62, 62,255, 58, 58, 58,255, 53, 53, 53,255,136,136,136,255,
+115,115,115,255,117,117,117,255,120,120,120,255,124,124,124,255,130,130,130,255,132,132,132,255,132,132,132,255, 14, 14, 14,255,
+ 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 15, 15, 15,255, 16, 16, 16,255, 19, 19, 19,255, 23, 23, 23,255,137,137,137,255,
+136,136,136,255,136,136,136,255,136,136,136,255,136,136,136,255,137,137,137,255,138,138,138,255,138,138,138,255, 52, 52, 52,255,
+ 50, 50, 50,255, 48, 48, 48,255, 44, 44, 44,255, 40, 40, 40,255, 36, 36, 36,255, 31, 31, 31,255, 27, 27, 27,255,115,115,115,255,
+141,141,141,255,145,145,145,255,150,150,150,255,157,157,157,255,161,161,161,255,161,161,161,255,161,161,161,255, 14, 14, 14,255,
+ 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 15, 15, 15,255, 16, 16, 16,255, 19, 19, 19,255,139,139,139,255,
+137,137,137,255,136,136,136,255,136,136,136,255,136,135,135,255,136,136,136,255,136,136,136,255,136,136,136,255, 41, 41, 41,255,
+ 40, 40, 40,255, 38, 38, 38,255, 35, 35, 35,255, 32, 32, 32,255, 29, 29, 29,255, 25, 25, 25,255, 22, 22, 22,255,116,116,116,255,
+145,145,145,255,150,150,150,255,156,156,156,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255, 14, 14, 14,255,
+ 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 15, 15, 15,255, 16, 16, 16,255,142,142,142,255,
+140,140,140,255,138,138,138,255,137,137,137,255,136,136,136,255,136,136,136,255,136,136,136,255,136,136,136,255, 31, 31, 31,255,
+ 31, 31, 31,255, 29, 29, 29,255, 27, 27, 27,255, 25, 25, 25,255, 23, 23, 23,255, 20, 20, 20,255, 18, 18, 18,255,119,119,119,255,
+150,150,150,255,156,156,156,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255, 14, 14, 14,255,
+ 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,148,148,148,255,
+144,144,144,255,142,142,142,255,140,140,140,255,139,139,139,255,138,138,138,255,138,138,138,255,138,138,138,255, 24, 24, 24,255,
+ 24, 24, 24,255, 23, 23, 23,255, 21, 21, 21,255, 20, 20, 20,255, 18, 18, 18,255, 17, 17, 17,255, 15, 15, 15,255,124,124,124,255,
+157,157,157,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255, 14, 14, 14,255,
+ 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,154,154,154,255,
+151,151,151,255,148,148,148,255,145,145,145,255,144,144,144,255,142,142,142,255,142,142,142,255,141,141,141,255, 19, 19, 19,255,
+ 19, 19, 19,255, 18, 18, 18,255, 17, 17, 17,255, 16, 16, 16,255, 15, 15, 15,255, 15, 15, 15,255, 14, 14, 14,255,129,129,129,255,
+161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255, 14, 14, 14,255,
+ 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,161,161,161,255,
+158,158,158,255,155,155,155,255,152,152,152,255,150,150,150,255,149,149,149,255,148,148,148,255,147,147,147,255, 16, 16, 16,255,
+ 15, 15, 15,255, 15, 15, 15,255, 15, 15, 15,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,131,131,131,255,
+161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255, 14, 14, 14,255,
+ 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,161,161,161,255,
+161,161,161,255,161,161,161,255,161,161,161,255,158,158,158,255,157,157,157,255,155,155,155,255,155,155,155,255, 14, 14, 14,255,
+ 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,131,131,131,255,
+161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255, 77, 69,  0,  0,
+232,  4,  0,  0,136,227, 26,  4,  0,  0,  0,  0, 50,  0,  0,  0,  1,  0,  0,  0,136, 37, 27,  4,  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, 77, 69, 99,111,114,110,101,114, 95, 99,104,101,
+ 99,107,101,114,115,  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,  0,  4,  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,  0,  0,  0,  0,  0,216, 22, 52,  3,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,111,148, 26, 63,
-111,148, 26, 63,111,148, 26, 63,205,204, 76, 61,205,204,204, 61,102,102,166, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  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,
- 68, 65, 84, 65,  8,  3,  0,  0,136, 19, 52,  3,  0,  0,  0,  0, 27,  0,  0,  0,  1,  0,  0,  0,  0,  0,  2,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,245, 40,220, 62,  0,  0,  0,  0,  3, 55,122, 63,  0,  0,128, 63,
- 96, 82,161, 62,  0,  0,128, 63,  0,  0,128, 63,  1,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,
-  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,
-  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,
-  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,
-  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,
-  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,
-  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,
-  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,
-  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,
-  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,
-  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  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,  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,
-  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,  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,  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,  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,  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,  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,
- 68, 65, 84, 65, 40,  0,  0,  0,216, 22, 52,  3,  0,  0,  0,  0, 11,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 84, 69,  0,  0,112,  1,  0,  0, 72, 23, 52,  3,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,120, 25, 52,  3,  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, 84, 69,112,114,101,118,105,101,
-119,  0,101,120,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  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,128, 62,  0,  0,160, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0, 64,  0,  0,  0, 64,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 64,
-  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  5,  0,  8,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  8,  0,  0,  0,  1,  0,  1,  0,  3,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,205,204,204, 60,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,  2,  0,  1,  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,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  8, 25, 52,  3,  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, 68, 65, 84, 65, 40,  0,  0,  0,  8, 25, 52,  3,  0,  0,  0,  0, 11,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 84, 69,  0,  0,112,  1,  0,  0,120, 25, 52,  3,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 72, 23, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 84, 69,102, 97,107,101,115,104, 97,100,111,119,  0,  0, 76,101,110,100,  0,101,120,  0,  0,  0,  2,  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,128, 62,  0,  0,160, 64,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0, 64,
-  0,  0,  0, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0, 32, 64,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  5,  0, 40,  0,  5,  0,  4,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  8,  0,  0,  0,  1,  0,  1,  0,  3,  0,  2,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,205,204,204, 60,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  2,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 56, 27, 52,  3,  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, 68, 65, 84, 65, 40,  0,  0,  0, 56, 27, 52,  3,  0,  0,  0,  0,
- 11,  0,  0,  0,  1,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,
-168, 27, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  0, 16,  0,  0,168, 27, 52,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,
-161,161,161,255,161,161,161,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,
- 14, 14, 14,255, 14, 14, 14,255,155,155,155,255,155,154,154,255,155,155,155,255,157,157,157,255,158,158,158,255,158,158,158,255,
-159,159,159,255,159,159,159,255, 43, 43, 43,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,
- 14, 14, 14,255, 14, 14, 14,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,
-161,161,161,255,161,161,161,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 15, 15, 15,255, 15, 15, 15,255,
- 15, 15, 15,255, 15, 15, 15,255,147,147,147,255,147,147,147,255,147,147,147,255,148,148,148,255,150,150,150,255,153,153,153,255,
-157,157,157,255,159,159,159,255, 43, 43, 43,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,
- 14, 14, 14,255, 14, 14, 14,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,
-161,161,161,255,159,159,159,255, 14, 14, 14,255, 15, 15, 15,255, 15, 15, 15,255, 16, 16, 16,255, 17, 17, 17,255, 18, 18, 18,255,
- 18, 18, 18,255, 19, 19, 19,255,141,141,141,255,141,141,141,255,141,141,141,255,142,142,142,255,143,143,143,255,146,146,146,255,
-149,149,149,255,153,153,153,255, 43, 43, 43,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,
- 14, 14, 14,255, 14, 14, 14,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,
-157,157,157,255,152,152,152,255, 15, 15, 15,255, 17, 17, 17,255, 18, 18, 18,255, 20, 20, 20,255, 21, 21, 21,255, 22, 22, 22,255,
- 23, 23, 23,255, 24, 24, 24,255,137,137,137,255,137,137,137,255,137,137,137,255,137,137,137,255,138,138,138,255,140,140,140,255,
-143,143,143,255,147,147,147,255, 42, 42, 42,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,
- 14, 14, 14,255, 14, 14, 14,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,156,156,156,255,
-150,150,150,255,146,146,146,255, 18, 18, 18,255, 20, 20, 20,255, 22, 22, 22,255, 25, 25, 25,255, 27, 27, 27,255, 29, 29, 29,255,
- 30, 30, 30,255, 31, 31, 31,255,135,135,135,255,135,135,135,255,135,134,134,255,135,135,135,255,135,135,135,255,137,137,137,255,
-139,139,139,255,141,141,141,255, 42, 42, 42,255, 15, 15, 15,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,
- 14, 14, 14,255, 14, 14, 14,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,156,156,156,255,150,150,150,255,
-145,145,145,255,142,142,142,255, 22, 22, 22,255, 25, 25, 25,255, 28, 28, 28,255, 32, 32, 32,255, 35, 35, 35,255, 37, 37, 37,255,
- 39, 39, 39,255, 40, 40, 40,255,135,135,135,255,135,135,135,255,134,134,134,255,134,134,134,255,134,134,134,255,134,134,134,255,
-136,136,136,255,138,138,138,255, 43, 43, 43,255, 16, 16, 16,255, 15, 15, 15,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,
- 14, 14, 14,255, 14, 14, 14,255,161,161,161,255,161,161,161,255,161,161,161,255,157,157,157,255,150,150,150,255,145,145,145,255,
-141,141,141,255,138,138,138,255, 27, 27, 27,255, 31, 31, 31,255, 36, 36, 36,255, 40, 40, 40,255, 44, 44, 44,255, 47, 47, 47,255,
- 50, 50, 50,255, 51, 51, 51,255,137,137,137,255,136,136,136,255,136,135,135,255,135,135,135,255,134,134,134,255,134,134,134,255,
-134,134,134,255,135,135,135,255, 45, 45, 45,255, 19, 19, 19,255, 16, 16, 16,255, 15, 15, 15,255, 14, 14, 14,255, 14, 14, 14,255,
- 14, 14, 14,255, 14, 14, 14,255,161,161,161,255,161,161,161,255,159,159,159,255,152,152,152,255,146,146,146,255,142,142,142,255,
-138,138,138,255,137,136,136,255, 32, 32, 32,255, 38, 38, 38,255, 44, 44, 44,255, 50, 50, 50,255, 55, 55, 55,255, 59, 59, 59,255,
- 62, 62, 62,255, 64, 64, 64,255,141,141,141,255,140,140,140,255,139,139,139,255,137,137,137,255,136,136,136,255,135,135,135,255,
-134,134,134,255,134,134,134,255, 49, 49, 49,255, 22, 22, 22,255, 19, 19, 19,255, 16, 16, 16,255, 14, 14, 14,255, 14, 14, 14,255,
- 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 15, 15, 15,255, 18, 18, 18,255, 22, 22, 22,255,
- 27, 27, 27,255, 33, 33, 33,255,136,136,136,255,137,137,137,255,138,138,138,255,141,141,141,255,143,143,143,255,145,145,145,255,
-147,147,147,255,147,147,147,255, 79, 79, 79,255, 77, 77, 77,255, 73, 73, 73,255, 67, 67, 67,255, 61, 61, 61,255, 53, 53, 53,255,
- 46, 46, 46,255, 39, 39, 39,255,114,114,114,255,137,137,137,255,139,139,139,255,143,143,143,255,148,148,148,255,155,155,155,255,
-161,161,161,255,161,161,161,255, 14, 14, 14,255, 14, 14, 14,255, 15, 15, 15,255, 17, 17, 17,255, 20, 20, 20,255, 25, 25, 25,255,
- 31, 31, 31,255, 38, 38, 38,255,137,137,137,255,139,139,139,255,142,142,142,255,145,145,145,255,148,148,148,255,152,152,152,255,
-154,154,154,255,155,155,155,255, 96, 96, 96,255, 93, 93, 93,255, 88, 88, 88,255, 81, 81, 81,255, 73, 73, 73,255, 64, 64, 64,255,
- 55, 55, 55,255, 46, 46, 46,255,116,116,116,255,136,136,136,255,137,137,137,255,140,140,140,255,145,145,145,255,151,151,151,255,
-159,159,159,255,161,161,161,255, 14, 14, 14,255, 14, 14, 14,255, 15, 15, 15,255, 18, 18, 18,255, 23, 23, 23,255, 28, 28, 28,255,
- 36, 36, 36,255, 44, 44, 44,255,138,138,138,255,142,142,142,255,146,146,146,255,151,151,151,255,155,155,155,255,160,160,160,255,
-163,163,163,255,165,165,165,255,114,114,114,255,111,111,111,255,104,104,104,255, 95, 95, 95,255, 85, 85, 85,255, 75, 75, 75,255,
- 64, 64, 64,255, 53, 53, 53,255,117,117,117,255,136,135,135,255,136,136,136,255,139,139,139,255,142,142,142,255,148,148,148,255,
-156,156,156,255,161,161,161,255, 14, 14, 14,255, 14, 14, 14,255, 16, 16, 16,255, 20, 20, 20,255, 25, 25, 25,255, 32, 32, 32,255,
- 40, 40, 40,255, 50, 50, 50,255,141,141,141,255,145,145,145,255,151,151,151,255,157,157,157,255,163,163,163,255,169,169,169,255,
-174,174,174,255,177,177,177,255,135,135,135,255,130,130,130,255,122,122,122,255,111,111,111,255, 98, 98, 98,255, 85, 85, 85,255,
- 73, 73, 73,255, 61, 61, 61,255,119,119,119,255,136,136,136,255,136,136,136,255,137,137,137,255,141,141,141,255,146,146,146,255,
-153,153,153,255,161,161,161,255, 14, 14, 14,255, 15, 15, 15,255, 17, 17, 17,255, 21, 21, 21,255, 27, 27, 27,255, 35, 35, 35,255,
- 44, 44, 44,255, 55, 55, 55,255,143,143,143,255,149,149,149,255,156,156,156,255,163,163,163,255,172,172,172,255,180,180,180,255,
-186,186,186,255,190,190,190,255,158,158,158,255,151,151,151,255,140,140,140,255,126,126,126,255,111,111,111,255, 95, 95, 95,255,
- 81, 81, 81,255, 67, 67, 67,255,122,121,121,255,136,136,136,255,136,136,136,255,137,137,137,255,139,139,139,255,144,144,144,255,
-151,151,151,255,159,159,159,255, 14, 14, 14,255, 15, 15, 15,255, 18, 18, 18,255, 23, 23, 23,255, 29, 29, 29,255, 38, 38, 38,255,
- 48, 48, 48,255, 60, 60, 60,255,145,145,145,255,152,152,152,255,160,160,160,255,170,170,170,255,180,180,180,255,191,191,191,255,
-200,200,200,255,206,206,206,255,182,182,182,255,173,173,173,255,158,158,158,255,140,140,140,255,122,122,122,255,104,104,104,255,
- 88, 88, 88,255, 73, 73, 73,255,123,123,123,255,137,137,137,255,136,136,136,255,136,136,136,255,139,139,139,255,143,143,143,255,
-149,149,149,255,157,157,157,255, 14, 14, 14,255, 15, 15, 15,255, 18, 18, 18,255, 24, 24, 24,255, 31, 31, 31,255, 39, 39, 39,255,
- 50, 50, 50,255, 63, 63, 63,255,147,147,147,255,154,154,154,255,164,164,164,255,175,175,175,255,187,187,187,255,200,200,200,255,
-213,213,213,255,223,223,223,255,208,208,208,255,193,193,193,255,173,173,173,255,151,151,151,255,130,130,130,255,111,111,111,255,
- 93, 93, 93,255, 77, 77, 77,255,125,125,125,255,137,137,137,255,136,136,136,255,136,136,136,255,138,138,138,255,142,142,142,255,
-148,148,148,255,156,156,156,255, 14, 14, 14,255, 16, 16, 16,255, 19, 19, 19,255, 24, 24, 24,255, 31, 31, 31,255, 40, 40, 40,255,
- 52, 52, 52,255, 65, 65, 65,255,148,148,148,255,156,156,156,255,166,166,166,255,177,177,177,255,191,191,191,255,206,206,206,255,
-223,223,223,255,240,240,240,255,232,232,232,255,208,208,208,255,182,182,182,255,158,158,158,255,135,135,135,255,114,114,114,255,
- 96, 96, 96,255, 79, 79, 79,255,126,126,126,255,138,138,138,255,136,136,136,255,136,136,136,255,138,138,138,255,142,142,142,255,
-148,148,148,255,155,155,155,255,155,155,155,255,147,147,147,255,141,141,141,255,138,138,138,255,136,136,136,255,136,136,136,255,
-138,138,138,255,142,142,142,255, 80, 80, 80,255, 97, 97, 97,255,116,116,116,255,137,137,137,255,159,159,159,255,184,184,184,255,
-210,210,210,255,235,235,235,255,240,240,240,255,223,223,223,255,205,205,205,255,190,190,190,255,176,176,176,255,164,164,164,255,
-154,154,154,255,147,147,147,255, 79, 79, 79,255, 51, 51, 51,255, 40, 40, 40,255, 31, 31, 31,255, 24, 24, 24,255, 19, 19, 19,255,
- 15, 15, 15,255, 14, 14, 14,255,156,155,155,255,148,148,148,255,142,142,142,255,138,138,138,255,136,136,136,255,136,136,136,255,
-138,138,138,255,141,141,141,255, 78, 78, 78,255, 94, 94, 94,255,112,112,112,255,132,132,132,255,153,153,153,255,175,175,175,255,
-195,195,195,255,210,210,210,255,224,224,224,255,213,213,213,255,200,200,200,255,186,186,186,255,173,173,173,255,162,162,162,255,
-153,153,153,255,146,146,146,255, 78, 78, 78,255, 50, 50, 50,255, 39, 39, 39,255, 30, 30, 30,255, 23, 23, 23,255, 18, 18, 18,255,
- 15, 15, 15,255, 14, 14, 14,255,157,157,157,255,149,149,149,255,142,142,142,255,138,138,138,255,136,136,136,255,136,136,136,255,
-137,137,137,255,140,140,140,255, 74, 74, 74,255, 89, 89, 89,255,106,106,106,255,124,124,124,255,142,142,142,255,160,160,160,255,
-175,175,175,255,184,184,184,255,206,206,206,255,200,200,200,255,190,190,190,255,179,179,179,255,169,169,169,255,159,159,159,255,
-151,151,151,255,144,144,144,255, 75, 75, 75,255, 47, 47, 47,255, 37, 37, 37,255, 29, 29, 29,255, 22, 22, 22,255, 18, 18, 18,255,
- 15, 15, 15,255, 14, 14, 14,255,158,158,158,255,150,150,150,255,144,144,144,255,139,139,139,255,136,136,136,255,136,135,135,255,
-136,136,136,255,139,139,139,255, 68, 68, 68,255, 82, 82, 82,255, 97, 97, 97,255,112,112,112,255,128,128,128,255,142,142,142,255,
-153,153,153,255,159,159,159,255,191,191,191,255,187,187,187,255,180,180,180,255,171,171,171,255,162,162,162,255,154,154,154,255,
-148,147,147,255,142,142,142,255, 72, 72, 72,255, 44, 44, 44,255, 35, 35, 35,255, 27, 27, 27,255, 21, 21, 21,255, 17, 17, 17,255,
- 15, 15, 15,255, 14, 14, 14,255,161,161,161,255,152,152,152,255,145,145,145,255,140,140,140,255,137,137,137,255,136,136,136,255,
-136,136,136,255,138,138,138,255, 62, 62, 62,255, 74, 74, 74,255, 87, 87, 87,255,100,100,100,255,112,112,112,255,124,124,124,255,
-132,132,132,255,137,137,137,255,177,177,177,255,174,174,174,255,169,169,169,255,163,163,163,255,156,156,156,255,150,150,150,255,
-144,144,144,255,140,140,140,255, 67, 67, 67,255, 40, 40, 40,255, 32, 32, 32,255, 25, 25, 25,255, 20, 20, 20,255, 16, 16, 16,255,
- 14, 14, 14,255, 14, 14, 14,255,161,161,161,255,155,155,155,255,148,148,148,255,142,142,142,255,138,138,138,255,136,136,136,255,
-136,136,136,255,136,136,136,255, 54, 54, 54,255, 65, 65, 65,255, 76, 76, 76,255, 87, 87, 87,255, 97, 97, 97,255,106,106,106,255,
-112,112,112,255,116,116,116,255,165,165,165,255,163,163,163,255,159,159,159,255,155,155,155,255,150,150,150,255,145,145,145,255,
-141,141,141,255,137,137,137,255, 62, 62, 62,255, 36, 36, 36,255, 28, 28, 28,255, 22, 22, 22,255, 18, 18, 18,255, 15, 15, 15,255,
- 14, 14, 14,255, 14, 14, 14,255,161,161,161,255,158,158,158,255,151,151,151,255,144,144,144,255,140,140,140,255,137,137,137,255,
-136,136,136,255,136,136,136,255, 47, 47, 47,255, 56, 56, 56,255, 65, 65, 65,255, 74, 74, 74,255, 82, 82, 82,255, 89, 89, 89,255,
- 94, 94, 94,255, 97, 97, 97,255,155,155,155,255,154,154,154,255,151,151,151,255,148,148,148,255,144,144,144,255,140,140,140,255,
-138,138,138,255,136,136,136,255, 58, 58, 58,255, 31, 31, 31,255, 25, 25, 25,255, 20, 20, 20,255, 17, 17, 17,255, 15, 15, 15,255,
- 14, 14, 14,255, 14, 14, 14,255,161,161,161,255,161,161,161,255,154,154,154,255,148,148,148,255,142,142,142,255,139,139,139,255,
-137,137,137,255,136,136,136,255, 40, 40, 40,255, 47, 47, 47,255, 54, 54, 54,255, 62, 62, 62,255, 68, 68, 68,255, 74, 74, 74,255,
- 78, 78, 78,255, 80, 80, 80,255,147,147,147,255,146,146,146,255,144,144,144,255,142,142,142,255,139,139,139,255,137,137,137,255,
-135,135,135,255,135,135,135,255, 53, 53, 53,255, 27, 27, 27,255, 22, 22, 22,255, 18, 18, 18,255, 15, 15, 15,255, 14, 14, 14,255,
- 14, 14, 14,255, 14, 14, 14,255, 44, 44, 44,255, 44, 44, 44,255, 43, 43, 43,255, 42, 42, 42,255, 42, 42, 42,255, 43, 43, 43,255,
- 46, 46, 46,255, 49, 49, 49,255,115,115,115,255,116,116,116,255,118,118,118,255,120,120,120,255,122,122,122,255,124,124,124,255,
-126,126,126,255,126,126,126,255, 80, 80, 80,255, 79, 79, 79,255, 76, 76, 76,255, 72, 72, 72,255, 67, 67, 67,255, 62, 62, 62,255,
- 58, 58, 58,255, 53, 53, 53,255,136,136,136,255,115,115,115,255,117,117,117,255,120,120,120,255,124,124,124,255,130,130,130,255,
-132,132,132,255,132,132,132,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 15, 15, 15,255, 16, 16, 16,255,
- 19, 19, 19,255, 23, 23, 23,255,137,137,137,255,136,136,136,255,136,136,136,255,136,136,136,255,136,136,136,255,137,137,137,255,
-138,138,138,255,138,138,138,255, 52, 52, 52,255, 50, 50, 50,255, 48, 48, 48,255, 44, 44, 44,255, 40, 40, 40,255, 36, 36, 36,255,
- 31, 31, 31,255, 27, 27, 27,255,115,115,115,255,141,141,141,255,145,145,145,255,150,150,150,255,157,157,157,255,161,161,161,255,
-161,161,161,255,161,161,161,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 15, 15, 15,255,
- 16, 16, 16,255, 19, 19, 19,255,139,139,139,255,137,137,137,255,136,136,136,255,136,136,136,255,136,135,135,255,136,136,136,255,
-136,136,136,255,136,136,136,255, 41, 41, 41,255, 40, 40, 40,255, 38, 38, 38,255, 35, 35, 35,255, 32, 32, 32,255, 29, 29, 29,255,
- 25, 25, 25,255, 22, 22, 22,255,116,116,116,255,145,145,145,255,150,150,150,255,156,156,156,255,161,161,161,255,161,161,161,255,
-161,161,161,255,161,161,161,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,
- 15, 15, 15,255, 16, 16, 16,255,142,142,142,255,140,140,140,255,138,138,138,255,137,137,137,255,136,136,136,255,136,136,136,255,
-136,136,136,255,136,136,136,255, 31, 31, 31,255, 31, 31, 31,255, 29, 29, 29,255, 27, 27, 27,255, 25, 25, 25,255, 23, 23, 23,255,
- 20, 20, 20,255, 18, 18, 18,255,119,119,119,255,150,150,150,255,156,156,156,255,161,161,161,255,161,161,161,255,161,161,161,255,
-161,161,161,255,161,161,161,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,
- 14, 14, 14,255, 14, 14, 14,255,148,148,148,255,144,144,144,255,142,142,142,255,140,140,140,255,139,139,139,255,138,138,138,255,
-138,138,138,255,138,138,138,255, 24, 24, 24,255, 24, 24, 24,255, 23, 23, 23,255, 21, 21, 21,255, 20, 20, 20,255, 18, 18, 18,255,
- 17, 17, 17,255, 15, 15, 15,255,124,124,124,255,157,157,157,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,
-161,161,161,255,161,161,161,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,
- 14, 14, 14,255, 14, 14, 14,255,154,154,154,255,151,151,151,255,148,148,148,255,145,145,145,255,144,144,144,255,142,142,142,255,
-142,142,142,255,141,141,141,255, 19, 19, 19,255, 19, 19, 19,255, 18, 18, 18,255, 17, 17, 17,255, 16, 16, 16,255, 15, 15, 15,255,
- 15, 15, 15,255, 14, 14, 14,255,129,129,129,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,
-161,161,161,255,161,161,161,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,
- 14, 14, 14,255, 14, 14, 14,255,161,161,161,255,158,158,158,255,155,155,155,255,152,152,152,255,150,150,150,255,149,149,149,255,
-148,148,148,255,147,147,147,255, 16, 16, 16,255, 15, 15, 15,255, 15, 15, 15,255, 15, 15, 15,255, 14, 14, 14,255, 14, 14, 14,255,
- 14, 14, 14,255, 14, 14, 14,255,131,131,131,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,
-161,161,161,255,161,161,161,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,
- 14, 14, 14,255, 14, 14, 14,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,158,158,158,255,157,157,157,255,
-155,155,155,255,155,155,155,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255, 14, 14, 14,255,
- 14, 14, 14,255, 14, 14, 14,255,131,131,131,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,161,161,161,255,
-161,161,161,255,161,161,161,255, 77, 69,  0,  0,152,  1,  0,  0,248, 43, 52,  3,  0,  0,  0,  0, 46,  0,  0,  0,  1,  0,  0,  0,
-200,104, 52,  3,  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,
- 77, 69, 99,111,114,110,101,114, 95, 99,104,101, 99,107,101,114,115,  0,  0,  0,  0,  0,  0,  0,  4,  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,216, 45, 52,  3,  0,  0,  0,  0,  8, 71, 52,  3,  0,  0,  0,  0, 40, 79, 52,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,232, 47, 52,  3,  0,  0,  0,  0,248, 58, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 56, 98, 52,  3,  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, 56, 46, 52,  3,  0,  0,  0,  0,  1,  0,  0,  0,  5,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72, 57, 52,  3,  0,  0,  0,  0,  1,  0,  0,  0,  5,  0,  0,  0,
- 12,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 88, 69, 52,  3,  0,  0,  0,  0,
-  3,  0,  0,  0,  5,  0,  0,  0, 84,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-116,  0,  0,  0,215,  0,  0,  0,100,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,213,204, 76, 63,255,204, 76, 63,  0,  0,104,182,
- 30,  0,128, 63,140,  0,128, 63,214,255,127, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0, 83,  0, 30,  0,  4,  0,
-  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0,
-216, 45, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,136,195, 51,  3,  0,  0,  0,  0, 24,217, 51,  3,  0,  0,  0,  0,
- 68, 65, 84, 65,104,  1,  0,  0, 56, 46, 52,  3,  0,  0,  0,  0, 84,  1,  0,  0,  5,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232, 47, 52,  3,  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,  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,
-  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,  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,  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,  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,
- 68, 65, 84, 65, 16,  9,  0,  0,232, 47, 52,  3,  0,  0,  0,  0, 52,  0,  0,  0,116,  0,  0,  0,214, 28,215, 63, 77, 31, 87, 65,
- 74, 36,190,192,  1,192,  1,192,129, 90,  0,  0,173, 86,161, 64,144, 87, 33, 65, 74, 36,190,192,  1,192,  1,192,129, 90,  0,  0,
-204,194,135,184,112, 59, 60, 65, 72, 36,190,192,  0,  0,  0,  0,255,127,  0,  0, 24, 33,215,191,147, 87, 33, 65, 68, 36,190,192,
-  0,  0,  0,  0,255,127,  0,  0,  9, 32, 87,192,182,115,  6, 65, 68, 36,190,192,  0,  0,  0,  0,255,127,  0,  0,195, 87,161,192,
-179, 31,215, 64, 66, 36,190,192,  0,  0,  0,  0,255,127,  0,  0,202, 28,215, 63,146, 87, 33, 65, 72, 36,190,192,  0,  0,  0,  0,
-255,127,  0,  0, 71,248,139,184,181,115,  6, 65, 70, 36,190,192,  0,  0,  0,  0,255,127,  0,  0, 41, 33,215,191,175, 31,215, 64,
- 68, 36,190,192,  0,  0,  0,  0,255,127,  0,  0, 15, 32, 87,192,244, 87,161, 64, 66, 36,190,192,  0,  0,  0,  0,255,127,  0,  0,
-223, 29, 87, 64,179,115,  6, 65, 72, 36,190,192,  0,  0,  0,  0,255,127,  0,  0,220,160,141,184,242, 87,161, 64, 68, 36,190,192,
-  0,  0,  0,  0,255,127,  0,  0,172, 86,161, 64,170, 31,215, 64, 72, 36,190,192,  0,  0,  0,  0,255,127,  0,  0,218, 29, 87, 64,
-240, 87,161, 64, 70, 36,190,192,  0,  0,  0,  0,255,127,  0,  0,123, 31,215,192,180,115,  6, 65,136, 43,100,192,129, 90,127,165,
-  0,  0,  0,  0,194, 87,161,192,147, 87, 33, 65,142, 43,100,192,129, 90,127,165,  0,  0,  0,  0, 11, 32, 87,192,113, 59, 60, 65,
-147, 43,100,192,129, 90,127,165,  0,  0,  0,  0, 45, 33,215,191, 81, 31, 87, 65,153, 43,100,192,129, 90,127,165,  0,  0,  0,  0,
-123, 31,215,192,180,115,  6, 65,253, 28,152,191,129, 90,127,165,  0,  0,  0,  0,194, 87,161,192,147, 87, 33, 65,  8, 29,152,191,
-129, 90,127,165,  0,  0,  0,  0, 11, 32, 87,192,113, 59, 60, 65, 19, 29,152,191,129, 90,127,165,  0,  0,  0,  0, 45, 33,215,191,
- 81, 31, 87, 65, 30, 29,152,191,129, 90,127,165,  0,  0,  0,  0,123, 31,215,192,180,115,  6, 65, 12, 29,152, 63,129, 90,127,165,
-  0,  0,  0,  0,194, 87,161,192,147, 87, 33, 65,  1, 29,152, 63,129, 90,127,165,  0,  0,  0,  0, 11, 32, 87,192,113, 59, 60, 65,
-245, 28,152, 63,129, 90,127,165,  0,  0,  0,  0, 45, 33,215,191, 81, 31, 87, 65,234, 28,152, 63,129, 90,127,165,  0,  0,  0,  0,
-122, 31,215,192,181,115,  6, 65,139, 43,100, 64,129, 90,127,165,  0,  0,  0,  0,193, 87,161,192,148, 87, 33, 65,133, 43,100, 64,
-129, 90,127,165,  0,  0,  0,  0,  9, 32, 87,192,114, 59, 60, 65,128, 43,100, 64,129, 90,127,165,  0,  0,  0,  0, 41, 33,215,191,
- 81, 31, 87, 65,128, 43,100, 64,129, 90,127,165,  0,  0,  0,  0,123, 31,215,192,180,115,  6, 65, 72, 36,190,192,255, 63,  1,192,
-129, 90,  0,  0,194, 87,161,192,147, 87, 33, 65, 74, 36,190,192,255, 63,  1,192,129, 90,  0,  0, 11, 32, 87,192,113, 59, 60, 65,
- 76, 36,190,192,255, 63,  1,192,129, 90,  0,  0, 45, 33,215,191, 81, 31, 87, 65, 78, 36,190,192,255, 63,  1,192,129, 90,  0,  0,
-183,115,  6,193,128, 31,215, 64,127, 43,100, 64,129, 90,127,165,  0,  0,  0,  0,184,115,  6,193,127, 31,215, 64,232, 28,152, 63,
-129, 90,127,165,  0,  0,  0,  0,184,115,  6,193,127, 31,215, 64, 32, 29,152,191,129, 90,127,165,  0,  0,  0,  0,184,115,  6,193,
-127, 31,215, 64,154, 43,100,192,129, 90,127,165,  0,  0,  0,  0,222, 33,215,191,210,189,135, 56, 72, 36,190,192,  0,  0,  0,  0,
-255,127,  0,  0,103, 32, 87,192, 14, 33,215, 63, 72, 36,190,192,  0,  0,  0,  0,255,127,  0,  0,241, 87,161,192,  2, 32, 87, 64,
- 72, 36,190,192,  0,  0,  0,  0,255,127,  0,  0,171, 31,215,192,190, 87,161, 64, 72, 36,190,192,  0,  0,  0,  0,255,127,  0,  0,
-235,192,138,184, 43,  3,114, 65,134, 43,100,192,  0,  0,  1,128,  0,  0,  0,  0,190, 28,215, 63, 78, 31, 87, 65,140, 43,100,192,
-127,165,127,165,  0,  0,  0,  0,213, 29, 87, 64,112, 59, 60, 65,146, 43,100,192,127,165,127,165,  0,  0,  0,  0,175, 86,161, 64,
-146, 87, 33, 65,151, 43,100,192,127,165,127,165,  0,  0,  0,  0,235,192,138,184, 43,  3,114, 65,248, 28,152,191,  0,  0,  1,128,
-  0,  0,  0,  0,190, 28,215, 63, 78, 31, 87, 65,  4, 29,152,191,127,165,127,165,  0,  0,  0,  0,213, 29, 87, 64,112, 59, 60, 65,
- 15, 29,152,191,127,165,127,165,  0,  0,  0,  0,235,192,138,184, 43,  3,114, 65, 16, 29,152, 63,  0,  0,  1,128,  0,  0,  0,  0,
-190, 28,215, 63, 78, 31, 87, 65,  4, 29,152, 63,127,165,127,165,  0,  0,  0,  0,213, 29, 87, 64,112, 59, 60, 65,249, 28,152, 63,
-127,165,127,165,  0,  0,  0,  0,175, 86,161, 64,146, 87, 33, 65,237, 28,152, 63,127,165,127,165,  0,  0,  0,  0,235,192,138,184,
- 43,  3,114, 65,142, 43,100, 64,  0,  0,  1,128,  0,  0,  0,  0,190, 28,215, 63, 78, 31, 87, 65,136, 43,100, 64,127,165,127,165,
-  0,  0,  0,  0,221, 29, 87, 64,110, 59, 60, 65,130, 43,100, 64,127,165,127,165,  0,  0,  0,  0,175, 86,161, 64,146, 87, 33, 65,
-131, 43,100, 64,127,165,127,165,  0,  0,  0,  0,235,192,138,184, 43,  3,114, 65, 72, 36,190,192,  0,  0,126,151,230, 73,  0,  0,
-213, 29, 87, 64,112, 59, 60, 65, 76, 36,190,192,  1,192,  1,192,129, 90,  0,  0,149, 30,215, 64,151,115,  6, 65, 72, 36,190,192,
-  1,192,  1,192,129, 90,  0,  0, 42,115,  6, 65,117, 31,215, 64,137, 43,100, 64,127,165,127,165,  0,  0,  0,  0,149, 30,215, 64,
-151,115,  6, 65,143, 43,100, 64,127,165,127,165,  0,  0,  0,  0, 42,115,  6, 65,117, 31,215, 64,  6, 29,152, 63,127,165,127,165,
-  0,  0,  0,  0,149, 30,215, 64,151,115,  6, 65, 18, 29,152, 63,127,165,127,165,  0,  0,  0,  0, 42,115,  6, 65,117, 31,215, 64,
-  2, 29,152,191,127,165,127,165,  0,  0,  0,  0,149, 30,215, 64,151,115,  6, 65,246, 28,152,191,127,165,127,165,  0,  0,  0,  0,
- 42,115,  6, 65,117, 31,215, 64,139, 43,100,192,127,165,127,165,  0,  0,  0,  0,  3, 32, 87, 64,150, 29,215, 63, 68, 36,190,192,
-  0,  0,  0,  0,254,127,  0,  0,126, 31,215, 64,217, 86,161, 64, 72, 36,190,192,  0,  0,  0,  0,254,127,  0,  0,158,115,  6, 65,
-146, 30,215, 64, 72, 36,190,192,  1,192,  1,192,130, 90,  0,  0,158,115,  6, 65,146, 30,215, 64,244, 35,190, 64,  1,192,  1,192,
-130, 90,  0,  0,126, 31,215, 64,217, 86,161, 64,244, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,192, 87,161, 64, 62, 30, 87, 64,
-248, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,  3, 32, 87, 64,150, 29,215, 63,248, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,
- 15, 33,215, 63, 24,  2, 41,184,250, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,149, 30,215, 64,151,115,  6, 65,244, 35,190, 64,
-  1,192,  1,192,129, 90,  0,  0,213, 29, 87, 64,112, 59, 60, 65,240, 35,190, 64,  1,192,  1,192,129, 90,  0,  0,235,192,138,184,
- 43,  3,114, 65,244, 35,190, 64,  0,  0,126,151,230, 73,  0,  0,171, 31,215,192,190, 87,161, 64,244, 35,190, 64,  0,  0,  0,  0,
-255,127,  0,  0,241, 87,161,192,  2, 32, 87, 64,244, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,103, 32, 87,192, 14, 33,215, 63,
-244, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,222, 33,215,191,210,189,135, 56,244, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,
- 45, 33,215,191, 81, 31, 87, 65,238, 35,190, 64,255, 63,  1,192,129, 90,  0,  0, 11, 32, 87,192,113, 59, 60, 65,240, 35,190, 64,
-255, 63,  1,192,129, 90,  0,  0,194, 87,161,192,147, 87, 33, 65,242, 35,190, 64,255, 63,  1,192,129, 90,  0,  0,123, 31,215,192,
-180,115,  6, 65,244, 35,190, 64,255, 63,  1,192,129, 90,  0,  0,254,226,142,184,239, 33,215, 63,248, 35,190, 64,  0,  0,  0,  0,
-255,127,  1,  0,189, 28,215, 63,107, 32, 87, 64,248, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,218, 29, 87, 64,240, 87,161, 64,
-246, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,172, 86,161, 64,170, 31,215, 64,244, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,
- 46, 33,215,191,113, 32, 87, 64,250, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,220,160,141,184,242, 87,161, 64,248, 35,190, 64,
-  0,  0,  0,  0,255,127,  0,  0,197, 28,215, 63,172, 31,215, 64,246, 35,190, 64,  0,  0,  0,  0,254,127,  0,  0,223, 29, 87, 64,
-179,115,  6, 65,244, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0, 15, 32, 87,192,244, 87,161, 64,250, 35,190, 64,  0,  0,  0,  0,
-255,127,  0,  0, 41, 33,215,191,175, 31,215, 64,248, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0, 71,248,139,184,181,115,  6, 65,
-246, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,202, 28,215, 63,146, 87, 33, 65,244, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,
-195, 87,161,192,179, 31,215, 64,250, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,  9, 32, 87,192,182,115,  6, 65,248, 35,190, 64,
-  0,  0,  0,  0,255,127,  0,  0, 24, 33,215,191,147, 87, 33, 65,248, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,204,194,135,184,
-112, 59, 60, 65,244, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,173, 86,161, 64,144, 87, 33, 65,242, 35,190, 64,  1,192,  1,192,
-129, 90,  0,  0,214, 28,215, 63, 77, 31, 87, 65,242, 35,190, 64,  1,192,  1,192,129, 90,  0,  0,183,115,  6,193,127, 31,215, 64,
-238, 35,190, 64,255, 63,  1,192,129, 90,  0,  0, 98,234, 53, 56, 38, 33,215,191,244, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,
-193, 87,161, 64, 62, 30, 87, 64, 69, 36,190,192,  0,  0,  0,  0,255,127,  0,  0, 15, 33,215, 63,226,  3, 41,184, 67, 36,190,192,
-  0,  0,  0,  0,255,127,  0,  0, 98,234, 53, 56, 38, 33,215,191, 72, 36,190,192,  0,  0,  0,  0,255,127,  0,  0,150, 30,215, 64,
-151,115,  6, 65,135, 43,100,192,127,165,127,165,  0,  0,  0,  0,177, 86,161, 64,146, 87, 33, 65, 30, 29,152,191,127,165,127,165,
-  0,  0,  0,  0,183,115,  6,193,127, 31,215, 64, 78, 36,190,192,255, 63,  1,192,129, 90,  0,  0,222,158,142,184,239, 33,215, 63,
- 67, 36,190,192,  0,  0,  0,  0,255,127,  0,  0,191, 28,215, 63,107, 32, 87, 64, 69, 36,190,192,  0,  0,  0,  0,255,127,  0,  0,
- 44, 33,215,191,113, 32, 87, 64, 67, 36,190,192,  0,  0,  0,  0,255,127,  0,  0,201, 28,215, 63,172, 31,215, 64, 71, 36,190,192,
-  0,  0,  0,  0,255,127,  0,  0, 68, 65, 84, 65,104,  1,  0,  0, 72, 57, 52,  3,  0,  0,  0,  0, 84,  1,  0,  0,  5,  0,  0,  0,
-  3,  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,184,232, 26,  4,  0,  0,  0,  0,136,178,198,  4,  0,  0,  0,  0,248,200,198,  4,
+  0,  0,  0,  0,216,185,198,  4,  0,  0,  0,  0,136,207,198,  4,  0,  0,  0,  0,152,226,198,  4,  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,104,235, 26,  4,  0,  0,  0,  0, 24,247, 26,  4,
   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,
-248, 58, 52,  3,  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,  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,  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,  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,  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,  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, 68, 65, 84, 65, 20, 10,  0,  0,248, 58, 52,  3,  0,  0,  0,  0, 49,  0,  0,  0,215,  0,  0,  0,
-  4,  0,  0,  0,  5,  0,  0,  0,  0,  0, 34,  0,  3,  0,  0,  0,  4,  0,  0,  0,  0,  0, 34,  0,  2,  0,  0,  0,  3,  0,  0,  0,
-  0,  0, 34,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0, 34,  0,  5,  0,  0,  0,  9,  0,  0,  0,  0,  0, 34,  0,  8,  0,  0,  0,
-  9,  0,  0,  0,  0,  0, 34,  0,  4,  0,  0,  0,  8,  0,  0,  0,  0,  0, 34,  0,  7,  0,  0,  0,  8,  0,  0,  0,  0,  0, 34,  0,
-  3,  0,  0,  0,  7,  0,  0,  0,  0,  0, 34,  0,  6,  0,  0,  0,  7,  0,  0,  0,  0,  0, 34,  0,  2,  0,  0,  0,  6,  0,  0,  0,
-  0,  0, 34,  0,  8,  0,  0,  0, 11,  0,  0,  0,  0,  0, 34,  0,  6,  0,  0,  0, 10,  0,  0,  0,  0,  0, 34,  0,  1,  0,  0,  0,
- 10,  0,  0,  0,  0,  0, 34,  0, 12,  0,  0,  0, 13,  0,  0,  0,  0,  0, 34,  0, 10,  0,  0,  0, 12,  0,  0,  0,  0,  0, 34,  0,
- 17,  0,  0,  0, 33,  0,  0,  0,  0,  0, 34,  0, 16,  0,  0,  0, 32,  0,  0,  0,  0,  0, 34,  0, 15,  0,  0,  0, 31,  0,  0,  0,
-  0,  0, 34,  0, 14,  0,  0,  0, 30,  0,  0,  0,  0,  0, 34,  0, 17,  0,  0,  0, 21,  0,  0,  0,  0,  0, 34,  0, 16,  0,  0,  0,
- 17,  0,  0,  0,  0,  0, 34,  0, 16,  0,  0,  0, 20,  0,  0,  0,  0,  0, 34,  0, 15,  0,  0,  0, 16,  0,  0,  0,  0,  0, 34,  0,
- 15,  0,  0,  0, 19,  0,  0,  0,  0,  0, 34,  0, 14,  0,  0,  0, 15,  0,  0,  0,  0,  0, 34,  0, 14,  0,  0,  0, 18,  0,  0,  0,
-  0,  0, 34,  0, 21,  0,  0,  0, 25,  0,  0,  0,  0,  0, 34,  0, 20,  0,  0,  0, 21,  0,  0,  0,  0,  0, 34,  0, 20,  0,  0,  0,
- 24,  0,  0,  0,  0,  0, 34,  0, 19,  0,  0,  0, 20,  0,  0,  0,  0,  0, 34,  0, 19,  0,  0,  0, 23,  0,  0,  0,  0,  0, 34,  0,
- 18,  0,  0,  0, 19,  0,  0,  0,  0,  0, 34,  0, 18,  0,  0,  0, 22,  0,  0,  0,  0,  0, 34,  0, 25,  0,  0,  0, 29,  0,  0,  0,
-  0,  0, 34,  0, 24,  0,  0,  0, 25,  0,  0,  0,  0,  0, 34,  0, 24,  0,  0,  0, 28,  0,  0,  0,  0,  0, 34,  0, 23,  0,  0,  0,
- 24,  0,  0,  0,  0,  0, 34,  0, 23,  0,  0,  0, 27,  0,  0,  0,  0,  0, 34,  0, 22,  0,  0,  0, 23,  0,  0,  0,  0,  0, 34,  0,
- 22,  0,  0,  0, 26,  0,  0,  0,  0,  0, 34,  0, 28,  0,  0,  0, 29,  0,  0,  0,  0,  0, 34,  0, 27,  0,  0,  0, 28,  0,  0,  0,
-  0,  0, 34,  0, 26,  0,  0,  0, 27,  0,  0,  0,  0,  0, 34,  0, 30,  0,  0,  0, 31,  0,  0,  0,  0,  0, 34,  0, 32,  0,  0,  0,
- 33,  0,  0,  0,  0,  0, 34,  0,  2,  0,  0,  0, 33,  0,  0,  0,  0,  0, 34,  0,  3,  0,  0,  0, 32,  0,  0,  0,  0,  0, 34,  0,
-  4,  0,  0,  0, 31,  0,  0,  0,  0,  0, 34,  0,  5,  0,  0,  0, 30,  0,  0,  0,  0,  0, 34,  0, 34,  0,  0,  0, 35,  0,  0,  0,
-  0,  0, 34,  0, 36,  0,  0,  0, 37,  0,  0,  0,  0,  0, 34,  0, 38,  0,  0,  0, 39,  0,  0,  0,  0,  0, 34,  0, 40,  0,  0,  0,
- 41,  0,  0,  0,  0,  0, 34,  0, 26,  0,  0,  0, 34,  0,  0,  0,  0,  0, 34,  0, 22,  0,  0,  0, 35,  0,  0,  0,  0,  0, 34,  0,
- 18,  0,  0,  0, 36,  0,  0,  0,  0,  0, 34,  0, 14,  0,  0,  0, 37,  0,  0,  0,  0,  0, 34,  0,  9,  0,  0,  0, 40,  0,  0,  0,
-  0,  0, 34,  0,  5,  0,  0,  0, 41,  0,  0,  0,  0,  0, 34,  0, 52,  0,  0,  0, 63,  0,  0,  0,  0,  0, 34,  0, 56,  0,  0,  0,
- 61,  0,  0,  0,  0,  0, 34,  0, 44,  0,  0,  0, 58,  0,  0,  0,  0,  0, 34,  0, 42,  0,  0,  0, 57,  0,  0,  0,  0,  0, 34,  0,
- 44,  0,  0,  0, 45,  0,  0,  0,  0,  0, 34,  0, 44,  0,  0,  0, 48,  0,  0,  0,  0,  0, 34,  0, 43,  0,  0,  0, 44,  0,  0,  0,
-  0,  0, 34,  0, 43,  0,  0,  0, 47,  0,  0,  0,  0,  0, 34,  0, 42,  0,  0,  0, 43,  0,  0,  0,  0,  0, 34,  0, 42,  0,  0,  0,
- 46,  0,  0,  0,  0,  0, 34,  0, 48,  0,  0,  0, 51,  0,  0,  0,  0,  0, 34,  0, 47,  0,  0,  0, 48,  0,  0,  0,  0,  0, 34,  0,
- 47,  0,  0,  0, 50,  0,  0,  0,  0,  0, 34,  0, 46,  0,  0,  0, 47,  0,  0,  0,  0,  0, 34,  0, 46,  0,  0,  0, 49,  0,  0,  0,
-  0,  0, 34,  0, 52,  0,  0,  0, 56,  0,  0,  0,  0,  0, 34,  0, 51,  0,  0,  0, 52,  0,  0,  0,  0,  0, 34,  0, 51,  0,  0,  0,
- 55,  0,  0,  0,  0,  0, 34,  0, 50,  0,  0,  0, 51,  0,  0,  0,  0,  0, 34,  0, 50,  0,  0,  0, 54,  0,  0,  0,  0,  0, 34,  0,
- 49,  0,  0,  0, 50,  0,  0,  0,  0,  0, 34,  0, 49,  0,  0,  0, 53,  0,  0,  0,  0,  0, 34,  0, 55,  0,  0,  0, 56,  0,  0,  0,
-  0,  0, 34,  0, 54,  0,  0,  0, 55,  0,  0,  0,  0,  0, 34,  0, 53,  0,  0,  0, 54,  0,  0,  0,  0,  0, 34,  0, 60,  0,  0,  0,
- 61,  0,  0,  0,  0,  0, 34,  0, 61,  0,  0,  0, 63,  0,  0,  0,  0,  0, 34,  0, 62,  0,  0,  0, 63,  0,  0,  0,  0,  0, 34,  0,
- 63,  0,  0,  0, 65,  0,  0,  0,  0,  0, 34,  0, 64,  0,  0,  0, 65,  0,  0,  0,  0,  0, 34,  0, 62,  0,  0,  0, 64,  0,  0,  0,
-  0,  0, 34,  0,  1,  0,  0,  0, 58,  0,  0,  0,  0,  0, 34,  0,  0,  0,  0,  0, 58,  0,  0,  0,  0,  0, 34,  0,  0,  0,  0,  0,
- 57,  0,  0,  0,  0,  0, 34,  0,  0,  0,  0,  0, 43,  0,  0,  0,  0,  0, 34,  0,  1,  0,  0,  0, 45,  0,  0,  0,  0,  0, 34,  0,
-  1,  0,  0,  0, 59,  0,  0,  0,  0,  0, 34,  0, 29,  0,  0,  0, 53,  0,  0,  0,  0,  0, 34,  0, 25,  0,  0,  0, 49,  0,  0,  0,
-  0,  0, 34,  0, 21,  0,  0,  0, 46,  0,  0,  0,  0,  0, 34,  0, 17,  0,  0,  0, 42,  0,  0,  0,  0,  0, 34,  0, 12,  0,  0,  0,
- 59,  0,  0,  0,  0,  0, 34,  0,  6,  0,  0,  0, 58,  0,  0,  0,  0,  0, 34,  0, 66,  0,  0,  0, 69,  0,  0,  0,  0,  0, 34,  0,
- 59,  0,  0,  0, 69,  0,  0,  0,  0,  0, 34,  0, 12,  0,  0,  0, 68,  0,  0,  0,  0,  0, 34,  0, 74,  0,  0,  0, 86,  0,  0,  0,
-  0,  0, 34,  0, 73,  0,  0,  0, 87,  0,  0,  0,  0,  0, 34,  0, 72,  0,  0,  0, 88,  0,  0,  0,  0,  0, 34,  0, 71,  0,  0,  0,
- 89,  0,  0,  0,  0,  0, 34,  0, 70,  0,  0,  0, 75,  0,  0,  0,  0,  0, 34,  0, 73,  0,  0,  0, 74,  0,  0,  0,  0,  0, 34,  0,
- 71,  0,  0,  0, 72,  0,  0,  0,  0,  0, 34,  0, 76,  0,  0,  0, 97,  0,  0,  0,  0,  0, 34,  0, 75,  0,  0,  0, 89,  0,  0,  0,
-  0,  0, 34,  0, 75,  0,  0,  0,102,  0,  0,  0,  0,  0, 34,  0, 77,  0,  0,  0,103,  0,  0,  0,  0,  0, 34,  0, 76,  0,  0,  0,
-103,  0,  0,  0,  0,  0, 34,  0, 76,  0,  0,  0,102,  0,  0,  0,  0,  0, 34,  0, 78,  0,  0,  0, 98,  0,  0,  0,  0,  0, 34,  0,
- 79,  0,  0,  0, 94,  0,  0,  0,  0,  0, 34,  0, 80,  0,  0,  0, 90,  0,  0,  0,  0,  0, 34,  0, 81,  0,  0,  0, 86,  0,  0,  0,
-  0,  0, 34,  0, 78,  0,  0,  0, 79,  0,  0,  0,  0,  0, 34,  0, 80,  0,  0,  0, 81,  0,  0,  0,  0,  0, 34,  0, 85,  0,  0,  0,
- 98,  0,  0,  0,  0,  0, 34,  0, 84,  0,  0,  0, 99,  0,  0,  0,  0,  0, 34,  0, 83,  0,  0,  0,100,  0,  0,  0,  0,  0, 34,  0,
- 82,  0,  0,  0,101,  0,  0,  0,  0,  0, 34,  0, 82,  0,  0,  0, 83,  0,  0,  0,  0,  0, 34,  0, 84,  0,  0,  0, 85,  0,  0,  0,
-  0,  0, 34,  0, 89,  0,  0,  0, 93,  0,  0,  0,  0,  0, 34,  0, 88,  0,  0,  0, 89,  0,  0,  0,  0,  0, 34,  0, 88,  0,  0,  0,
- 92,  0,  0,  0,  0,  0, 34,  0, 87,  0,  0,  0, 88,  0,  0,  0,  0,  0, 34,  0, 87,  0,  0,  0, 91,  0,  0,  0,  0,  0, 34,  0,
- 86,  0,  0,  0, 87,  0,  0,  0,  0,  0, 34,  0, 86,  0,  0,  0, 90,  0,  0,  0,  0,  0, 34,  0, 93,  0,  0,  0,102,  0,  0,  0,
-  0,  0, 34,  0, 93,  0,  0,  0, 97,  0,  0,  0,  0,  0, 34,  0, 92,  0,  0,  0, 93,  0,  0,  0,  0,  0, 34,  0, 92,  0,  0,  0,
- 96,  0,  0,  0,  0,  0, 34,  0, 91,  0,  0,  0, 92,  0,  0,  0,  0,  0, 34,  0, 91,  0,  0,  0, 95,  0,  0,  0,  0,  0, 34,  0,
- 90,  0,  0,  0, 91,  0,  0,  0,  0,  0, 34,  0, 90,  0,  0,  0, 94,  0,  0,  0,  0,  0, 34,  0, 97,  0,  0,  0,101,  0,  0,  0,
-  0,  0, 34,  0, 96,  0,  0,  0, 97,  0,  0,  0,  0,  0, 34,  0, 96,  0,  0,  0,100,  0,  0,  0,  0,  0, 34,  0, 95,  0,  0,  0,
- 96,  0,  0,  0,  0,  0, 34,  0, 95,  0,  0,  0, 99,  0,  0,  0,  0,  0, 34,  0, 94,  0,  0,  0, 95,  0,  0,  0,  0,  0, 34,  0,
- 94,  0,  0,  0, 98,  0,  0,  0,  0,  0, 34,  0,101,  0,  0,  0,103,  0,  0,  0,  0,  0, 34,  0,100,  0,  0,  0,101,  0,  0,  0,
-  0,  0, 34,  0, 99,  0,  0,  0,100,  0,  0,  0,  0,  0, 34,  0, 98,  0,  0,  0, 99,  0,  0,  0,  0,  0, 34,  0, 60,  0,  0,  0,
- 70,  0,  0,  0,  0,  0, 34,  0, 61,  0,  0,  0, 75,  0,  0,  0,  0,  0, 34,  0, 53,  0,  0,  0, 77,  0,  0,  0,  0,  0, 34,  0,
- 54,  0,  0,  0,103,  0,  0,  0,  0,  0, 34,  0, 55,  0,  0,  0, 76,  0,  0,  0,  0,  0, 34,  0, 56,  0,  0,  0,102,  0,  0,  0,
-  0,  0, 34,  0, 26,  0,  0,  0, 85,  0,  0,  0,  0,  0, 34,  0, 27,  0,  0,  0, 84,  0,  0,  0,  0,  0, 34,  0, 28,  0,  0,  0,
- 83,  0,  0,  0,  0,  0, 34,  0, 29,  0,  0,  0, 82,  0,  0,  0,  0,  0, 34,  0,107,  0,  0,  0,112,  0,  0,  0,  0,  0, 34,  0,
-107,  0,  0,  0,108,  0,  0,  0,  0,  0, 34,  0,112,  0,  0,  0,113,  0,  0,  0,  0,  0, 34,  0,112,  0,  0,  0,114,  0,  0,  0,
-  0,  0, 34,  0,  9,  0,  0,  0,114,  0,  0,  0,  0,  0, 34,  0, 11,  0,  0,  0,114,  0,  0,  0,  0,  0, 34,  0, 11,  0,  0,  0,
-115,  0,  0,  0,  0,  0, 34,  0,  7,  0,  0,  0,115,  0,  0,  0,  0,  0, 34,  0, 10,  0,  0,  0,115,  0,  0,  0,  0,  0, 34,  0,
- 11,  0,  0,  0,113,  0,  0,  0,  0,  0, 34,  0, 13,  0,  0,  0,113,  0,  0,  0,  0,  0, 34,  0, 13,  0,  0,  0,115,  0,  0,  0,
-  0,  0, 34,  0, 31,  0,  0,  0, 32,  0,  0,  0,  0,  0, 34,  0, 41,  0,  0,  0,111,  0,  0,  0,  0,  0, 34,  0, 35,  0,  0,  0,
- 36,  0,  0,  0,  0,  0, 34,  0, 37,  0,  0,  0,111,  0,  0,  0,  0,  0, 34,  0, 39,  0,  0,  0, 40,  0,  0,  0,  0,  0, 34,  0,
- 30,  0,  0,  0,111,  0,  0,  0,  0,  0, 34,  0, 38,  0,  0,  0,112,  0,  0,  0,  0,  0, 34,  0, 39,  0,  0,  0,114,  0,  0,  0,
-  0,  0, 34,  0, 45,  0,  0,  0,109,  0,  0,  0,  0,  0, 34,  0, 65,  0,  0,  0,110,  0,  0,  0,  0,  0, 34,  0, 45,  0,  0,  0,
-110,  0,  0,  0,  0,  0, 34,  0, 52,  0,  0,  0,110,  0,  0,  0,  0,  0, 34,  0, 48,  0,  0,  0,110,  0,  0,  0,  0,  0, 34,  0,
- 60,  0,  0,  0, 62,  0,  0,  0,  0,  0, 34,  0, 65,  0,  0,  0,109,  0,  0,  0,  0,  0, 34,  0, 66,  0,  0,  0,109,  0,  0,  0,
-  0,  0, 34,  0, 64,  0,  0,  0, 66,  0,  0,  0,  0,  0, 34,  0, 59,  0,  0,  0,109,  0,  0,  0,  0,  0, 34,  0, 33,  0,  0,  0,
- 57,  0,  0,  0,  0,  0, 34,  0, 68,  0,  0,  0, 69,  0,  0,  0,  0,  0, 34,  0, 67,  0,  0,  0,106,  0,  0,  0,  0,  0, 34,  0,
- 38,  0,  0,  0,108,  0,  0,  0,  0,  0, 34,  0, 13,  0,  0,  0,106,  0,  0,  0,  0,  0, 34,  0, 67,  0,  0,  0,113,  0,  0,  0,
-  0,  0, 34,  0, 81,  0,  0,  0,105,  0,  0,  0,  0,  0, 34,  0, 72,  0,  0,  0, 73,  0,  0,  0,  0,  0, 34,  0, 70,  0,  0,  0,
- 71,  0,  0,  0,  0,  0, 34,  0, 74,  0,  0,  0,105,  0,  0,  0,  0,  0, 34,  0, 77,  0,  0,  0, 82,  0,  0,  0,  0,  0, 34,  0,
- 85,  0,  0,  0,104,  0,  0,  0,  0,  0, 34,  0, 79,  0,  0,  0, 80,  0,  0,  0,  0,  0, 34,  0, 78,  0,  0,  0,104,  0,  0,  0,
-  0,  0, 34,  0, 83,  0,  0,  0, 84,  0,  0,  0,  0,  0, 34,  0, 34,  0,  0,  0,104,  0,  0,  0,  0,  0, 34,  0, 67,  0,  0,  0,
-107,  0,  0,  0,  0,  0, 34,  0, 68,  0,  0,  0,106,  0,  0,  0,  0,  0, 34,  0, 68, 65, 84, 65,104,  1,  0,  0, 88, 69, 52,  3,
-  0,  0,  0,  0, 84,  1,  0,  0,  5,  0,  0,  0,  4,  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, 86, 84,101,120,  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,  8, 71, 52,  3,  0,  0,  0,  0,  5,  0,  0,  0, 20,  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, 85, 86, 84,101,120,  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, 40, 79, 52,  3,  0,  0,  0,  0,  6,  0,  0,  0,
- 68,  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, 67,111,108,  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, 56, 98, 52,  3,
-  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,  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,  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, 68, 65, 84, 65,208,  7,  0,  0,  8, 71, 52,  3,
-  0,  0,  0,  0, 48,  0,  0,  0,100,  0,  0,  0, 31,  0,  0,  0, 30,  0,  0,  0,  5,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,
- 33,  0,  0,  0, 32,  0,  0,  0,  3,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0,  5,  0,  0,  0, 41,  0,  0,  0, 40,  0,  0,  0,
-  9,  0,  0,  0,  1,  0,  0,  0,  3,  0,  0,  0,  4,  0,  0,  0,  8,  0,  0,  0,  7,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  2,  0,  0,  0,  6,  0,  0,  0, 58,  0,  0,  0,  1,  0,  0,  0,  8,  0,  0,  0,  9,  0,  0,  0,114,  0,  0,  0, 11,  0,  0,  0,
-  1,  0,  0,  0,  6,  0,  0,  0,  7,  0,  0,  0,115,  0,  0,  0, 10,  0,  0,  0,  1,  0,  0,  0,114,  0,  0,  0, 39,  0,  0,  0,
- 38,  0,  0,  0,112,  0,  0,  0,  1,  0,  0,  0,115,  0,  0,  0, 11,  0,  0,  0,113,  0,  0,  0, 13,  0,  0,  0,  1,  0,  0,  0,
-  1,  0,  0,  0, 10,  0,  0,  0, 12,  0,  0,  0, 59,  0,  0,  0,  1,  0,  0,  0,113,  0,  0,  0,112,  0,  0,  0,107,  0,  0,  0,
- 67,  0,  0,  0,  1,  0,  0,  0,106,  0,  0,  0, 68,  0,  0,  0, 12,  0,  0,  0, 13,  0,  0,  0,  1,  0,  0,  0, 17,  0,  0,  0,
- 16,  0,  0,  0, 32,  0,  0,  0, 33,  0,  0,  0,  1,  0,  0,  0, 15,  0,  0,  0, 14,  0,  0,  0, 30,  0,  0,  0, 31,  0,  0,  0,
-  1,  0,  0,  0, 46,  0,  0,  0, 21,  0,  0,  0, 17,  0,  0,  0, 42,  0,  0,  0,  1,  0,  0,  0, 20,  0,  0,  0, 19,  0,  0,  0,
- 15,  0,  0,  0, 16,  0,  0,  0,  1,  0,  0,  0, 18,  0,  0,  0, 36,  0,  0,  0, 37,  0,  0,  0, 14,  0,  0,  0,  1,  0,  0,  0,
- 25,  0,  0,  0, 24,  0,  0,  0, 20,  0,  0,  0, 21,  0,  0,  0,  1,  0,  0,  0, 23,  0,  0,  0, 22,  0,  0,  0, 18,  0,  0,  0,
- 19,  0,  0,  0,  1,  0,  0,  0, 53,  0,  0,  0, 29,  0,  0,  0, 25,  0,  0,  0, 49,  0,  0,  0,  1,  0,  0,  0, 28,  0,  0,  0,
- 27,  0,  0,  0, 23,  0,  0,  0, 24,  0,  0,  0,  1,  0,  0,  0, 26,  0,  0,  0, 34,  0,  0,  0, 35,  0,  0,  0, 22,  0,  0,  0,
-  1,  0,  0,  0, 82,  0,  0,  0, 83,  0,  0,  0, 28,  0,  0,  0, 29,  0,  0,  0,  1,  0,  0,  0, 84,  0,  0,  0, 85,  0,  0,  0,
- 26,  0,  0,  0, 27,  0,  0,  0,  1,  0,  0,  0, 45,  0,  0,  0, 44,  0,  0,  0, 58,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
- 57,  0,  0,  0,  0,  0,  0,  0, 43,  0,  0,  0, 42,  0,  0,  0,  1,  0,  0,  0, 48,  0,  0,  0, 47,  0,  0,  0, 43,  0,  0,  0,
- 44,  0,  0,  0,  1,  0,  0,  0, 52,  0,  0,  0, 51,  0,  0,  0, 48,  0,  0,  0,110,  0,  0,  0,  1,  0,  0,  0, 50,  0,  0,  0,
- 49,  0,  0,  0, 46,  0,  0,  0, 47,  0,  0,  0,  1,  0,  0,  0, 55,  0,  0,  0, 54,  0,  0,  0, 50,  0,  0,  0, 51,  0,  0,  0,
-  1,  0,  0,  0,102,  0,  0,  0, 76,  0,  0,  0, 55,  0,  0,  0, 56,  0,  0,  0,  1,  0,  0,  0,103,  0,  0,  0, 77,  0,  0,  0,
- 53,  0,  0,  0, 54,  0,  0,  0,  1,  0,  0,  0, 70,  0,  0,  0, 75,  0,  0,  0, 61,  0,  0,  0, 60,  0,  0,  0,  1,  0,  0,  0,
- 61,  0,  0,  0, 56,  0,  0,  0, 52,  0,  0,  0, 63,  0,  0,  0,  1,  0,  0,  0, 62,  0,  0,  0, 63,  0,  0,  0, 65,  0,  0,  0,
- 64,  0,  0,  0,  1,  0,  0,  0, 65,  0,  0,  0,110,  0,  0,  0, 45,  0,  0,  0,109,  0,  0,  0,  1,  0,  0,  0, 66,  0,  0,  0,
-109,  0,  0,  0, 59,  0,  0,  0, 69,  0,  0,  0,  1,  0,  0,  0, 72,  0,  0,  0, 71,  0,  0,  0, 89,  0,  0,  0, 88,  0,  0,  0,
-  1,  0,  0,  0, 87,  0,  0,  0, 86,  0,  0,  0, 74,  0,  0,  0, 73,  0,  0,  0,  1,  0,  0,  0,102,  0,  0,  0, 93,  0,  0,  0,
- 89,  0,  0,  0, 75,  0,  0,  0,  1,  0,  0,  0, 92,  0,  0,  0, 91,  0,  0,  0, 87,  0,  0,  0, 88,  0,  0,  0,  1,  0,  0,  0,
- 90,  0,  0,  0, 80,  0,  0,  0, 81,  0,  0,  0, 86,  0,  0,  0,  1,  0,  0,  0, 97,  0,  0,  0, 96,  0,  0,  0, 92,  0,  0,  0,
- 93,  0,  0,  0,  1,  0,  0,  0, 95,  0,  0,  0, 94,  0,  0,  0, 90,  0,  0,  0, 91,  0,  0,  0,  1,  0,  0,  0,103,  0,  0,  0,
-101,  0,  0,  0, 97,  0,  0,  0, 76,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0, 99,  0,  0,  0, 95,  0,  0,  0, 96,  0,  0,  0,
-  1,  0,  0,  0, 98,  0,  0,  0, 78,  0,  0,  0, 79,  0,  0,  0, 94,  0,  0,  0,  1,  0,  0,  0, 82,  0,  0,  0, 83,  0,  0,  0,
-100,  0,  0,  0,101,  0,  0,  0,  1,  0,  0,  0, 84,  0,  0,  0, 85,  0,  0,  0, 98,  0,  0,  0, 99,  0,  0,  0,  1,  0,  0,  0,
- 85,  0,  0,  0,104,  0,  0,  0, 78,  0,  0,  0, 98,  0,  0,  0,  0,  0,  0,  0, 83,  0,  0,  0, 84,  0,  0,  0, 99,  0,  0,  0,
-100,  0,  0,  0,  0,  0,  0,  0,101,  0,  0,  0,103,  0,  0,  0, 77,  0,  0,  0, 82,  0,  0,  0,  0,  0,  0,  0, 99,  0,  0,  0,
- 98,  0,  0,  0, 94,  0,  0,  0, 95,  0,  0,  0,  0,  0,  0,  0,101,  0,  0,  0,100,  0,  0,  0, 96,  0,  0,  0, 97,  0,  0,  0,
-  0,  0,  0,  0, 94,  0,  0,  0, 79,  0,  0,  0, 80,  0,  0,  0, 90,  0,  0,  0,  0,  0,  0,  0, 96,  0,  0,  0, 95,  0,  0,  0,
- 91,  0,  0,  0, 92,  0,  0,  0,  0,  0,  0,  0, 76,  0,  0,  0, 97,  0,  0,  0, 93,  0,  0,  0,102,  0,  0,  0,  0,  0,  0,  0,
- 91,  0,  0,  0, 90,  0,  0,  0, 86,  0,  0,  0, 87,  0,  0,  0,  0,  0,  0,  0, 93,  0,  0,  0, 92,  0,  0,  0, 88,  0,  0,  0,
- 89,  0,  0,  0,  0,  0,  0,  0, 86,  0,  0,  0, 81,  0,  0,  0,105,  0,  0,  0, 74,  0,  0,  0,  0,  0,  0,  0, 88,  0,  0,  0,
- 87,  0,  0,  0, 73,  0,  0,  0, 72,  0,  0,  0,  0,  0,  0,  0, 71,  0,  0,  0, 70,  0,  0,  0, 75,  0,  0,  0, 89,  0,  0,  0,
-  0,  0,  0,  0,109,  0,  0,  0, 45,  0,  0,  0,  1,  0,  0,  0, 59,  0,  0,  0,  0,  0,  0,  0, 64,  0,  0,  0, 65,  0,  0,  0,
-109,  0,  0,  0, 66,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 52,  0,  0,  0,110,  0,  0,  0, 65,  0,  0,  0,  0,  0,  0,  0,
- 60,  0,  0,  0, 61,  0,  0,  0, 63,  0,  0,  0, 62,  0,  0,  0,  0,  0,  0,  0, 75,  0,  0,  0,102,  0,  0,  0, 56,  0,  0,  0,
- 61,  0,  0,  0,  0,  0,  0,  0, 76,  0,  0,  0,103,  0,  0,  0, 54,  0,  0,  0, 55,  0,  0,  0,  0,  0,  0,  0, 54,  0,  0,  0,
- 53,  0,  0,  0, 49,  0,  0,  0, 50,  0,  0,  0,  0,  0,  0,  0, 56,  0,  0,  0, 55,  0,  0,  0, 51,  0,  0,  0, 52,  0,  0,  0,
-  0,  0,  0,  0, 51,  0,  0,  0, 50,  0,  0,  0, 47,  0,  0,  0, 48,  0,  0,  0,  0,  0,  0,  0, 47,  0,  0,  0, 46,  0,  0,  0,
- 42,  0,  0,  0, 43,  0,  0,  0,  0,  0,  0,  0,110,  0,  0,  0, 48,  0,  0,  0, 44,  0,  0,  0, 45,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 58,  0,  0,  0, 44,  0,  0,  0, 43,  0,  0,  0,  0,  0,  0,  0, 85,  0,  0,  0,104,  0,  0,  0, 34,  0,  0,  0,
- 26,  0,  0,  0,  0,  0,  0,  0, 83,  0,  0,  0, 84,  0,  0,  0, 27,  0,  0,  0, 28,  0,  0,  0,  0,  0,  0,  0, 77,  0,  0,  0,
- 82,  0,  0,  0, 29,  0,  0,  0, 53,  0,  0,  0,  0,  0,  0,  0, 27,  0,  0,  0, 26,  0,  0,  0, 22,  0,  0,  0, 23,  0,  0,  0,
-  0,  0,  0,  0, 29,  0,  0,  0, 28,  0,  0,  0, 24,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0, 22,  0,  0,  0, 35,  0,  0,  0,
- 36,  0,  0,  0, 18,  0,  0,  0,  0,  0,  0,  0, 24,  0,  0,  0, 23,  0,  0,  0, 19,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,  0,
- 49,  0,  0,  0, 25,  0,  0,  0, 21,  0,  0,  0, 46,  0,  0,  0,  0,  0,  0,  0, 19,  0,  0,  0, 18,  0,  0,  0, 14,  0,  0,  0,
- 15,  0,  0,  0,  0,  0,  0,  0, 21,  0,  0,  0, 20,  0,  0,  0, 16,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0, 14,  0,  0,  0,
- 37,  0,  0,  0,111,  0,  0,  0, 30,  0,  0,  0,  0,  0,  0,  0, 16,  0,  0,  0, 15,  0,  0,  0, 31,  0,  0,  0, 32,  0,  0,  0,
-  0,  0,  0,  0, 33,  0,  0,  0, 57,  0,  0,  0, 42,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0, 68,  0,  0,  0, 69,  0,  0,  0,
- 59,  0,  0,  0, 12,  0,  0,  0,  0,  0,  0,  0, 13,  0,  0,  0,113,  0,  0,  0, 67,  0,  0,  0,106,  0,  0,  0,  0,  0,  0,  0,
-112,  0,  0,  0, 38,  0,  0,  0,108,  0,  0,  0,107,  0,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0,115,  0,  0,  0, 13,  0,  0,  0,
- 12,  0,  0,  0,  0,  0,  0,  0, 11,  0,  0,  0,114,  0,  0,  0,112,  0,  0,  0,113,  0,  0,  0,  0,  0,  0,  0, 58,  0,  0,  0,
-  6,  0,  0,  0, 10,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  7,  0,  0,  0,  8,  0,  0,  0, 11,  0,  0,  0,115,  0,  0,  0,
-  0,  0,  0,  0,  9,  0,  0,  0, 40,  0,  0,  0, 39,  0,  0,  0,114,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  3,  0,  0,  0,
-  7,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  5,  0,  0,  0,  9,  0,  0,  0,  8,  0,  0,  0,  0,  0,  0,  0,
-  2,  0,  0,  0,  0,  0,  0,  0, 57,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0,  0, 32,  0,  0,  0, 31,  0,  0,  0,  4,  0,  0,  0,
-  3,  0,  0,  0,  0,  0,  0,  0, 30,  0,  0,  0,111,  0,  0,  0, 41,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
-192, 18,  0,  0, 40, 79, 52,  3,  0,  0,  0,  0, 59,  0,  0,  0,100,  0,  0,  0,160, 84,104, 61,242, 65, 79, 63,128,105,188,189,
-120, 47, 41, 63,160, 84,104, 61,  0, 29,  3, 63, 26, 95, 82, 62,120, 47, 41, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0,122, 84,181, 62,113,179,141, 63, 26, 95, 82, 62,102, 84,117, 63,127, 84,181, 62,242, 65, 79, 63,190,188,  0, 63,
-102, 84,117, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,160, 84,104, 61,  0, 29,  3, 63,128,106,188,189,
-176, 20,186, 62,144, 82,104, 61,128,223, 91, 62, 14, 95, 82, 62,  0, 21,186, 62,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0,127, 84,181, 62,242, 65, 79, 63, 26, 95, 82, 62,120, 47, 41, 63,122, 84,181, 62,248, 28,  3, 63,188,188,  0, 63,
-120, 47, 41, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0, 56,207, 38, 63,111,179,141, 63,190,188,  0, 63,
-102, 84,117, 63, 52,207, 38, 63,236, 65, 79, 63,172,225, 76, 63,102, 84,117, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0,122, 84,181, 62,248, 28,  3, 63, 14, 95, 82, 62,  0, 21,186, 62,122, 84,181, 62, 32,224, 91, 62,185,188,  0, 63,
-  0, 21,186, 62,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0, 52,207, 38, 63,236, 65, 79, 63,188,188,  0, 63,
-120, 47, 41, 63, 52,207, 38, 63,248, 28,  3, 63,174,225, 76, 63,116, 47, 41, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0,122, 84,181, 62, 32,224, 91, 62,138, 94, 82, 62, 48, 43,135, 61, 61, 84,181, 62,176,104,169,189,185,188,  0, 63,
- 96, 44,135, 61,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0, 52,207, 38, 63,248, 28,  3, 63,185,188,  0, 63,
-  0, 21,186, 62, 51,207, 38, 63, 24,224, 91, 62,174,225, 76, 63,  0, 21,186, 62,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0, 44,244,114, 63,236, 65, 79, 63,174,225, 76, 63,116, 47, 41, 63, 42,244,114, 63,244, 28,  3, 63, 99,131,140, 63,
- 76, 47, 41, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0, 51,207, 38, 63, 24,224, 91, 62,185,188,  0, 63,
- 96, 44,135, 61,248,207, 38, 63,144,109,169,189,112,226, 76, 63, 64, 38,135, 61,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0,240,244,114, 63,  4,221, 91, 62,180,131,140, 63,116, 19,186, 62, 42,244,114, 63,244, 28,  3, 63,174,225, 76, 63,
-  0, 21,186, 62,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,122, 84,181, 62,113,179,141, 63, 26, 95, 82, 62,
-102, 84,117, 63, 26, 95, 82, 62,102, 84,117, 63,122, 84,181, 62,113,179,141, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0,160, 84,104, 61,242, 65, 79, 63,128,105,188,189,120, 47, 41, 63,128,105,188,189,120, 47, 41, 63,160, 84,104, 61,
-242, 65, 79, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,188,188,  0, 63,173,188,160, 63,122, 84,181, 62,
-113,179,141, 63,122, 84,181, 62,113,179,141, 63,188,188,  0, 63,173,188,160, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0, 26, 95, 82, 62,102, 84,117, 63,160, 84,104, 61,242, 65, 79, 63,160, 84,104, 61,242, 65, 79, 63, 26, 95, 82, 62,
-102, 84,117, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,128,105,188,189,120, 47, 41, 63, 64,127,118,190,
-216, 28,  3, 63, 64,127,118,190,216, 28,  3, 63,128,105,188,189,120, 47, 41, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0,122, 84,181, 62,113,179,141, 63, 26, 95, 82, 62,102, 84,117, 63, 26, 95, 82, 62,102, 84,117, 63,122, 84,181, 62,
-113,179,141, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,160, 84,104, 61,242, 65, 79, 63,128,105,188,189,
-120, 47, 41, 63,128,105,188,189,120, 47, 41, 63,160, 84,104, 61,242, 65, 79, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0,188,188,  0, 63,173,188,160, 63,122, 84,181, 62,113,179,141, 63,122, 84,181, 62,113,179,141, 63,188,188,  0, 63,
-173,188,160, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0, 26, 95, 82, 62,102, 84,117, 63,200, 84,104, 61,
-242, 65, 79, 63,160, 84,104, 61,242, 65, 79, 63, 26, 95, 82, 62,102, 84,117, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0, 96,105,188,189,120, 47, 41, 63, 56,127,118,190,220, 28,  3, 63, 64,127,118,190,216, 28,  3, 63,128,105,188,189,
-120, 47, 41, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,122, 84,181, 62,113,179,141, 63, 26, 95, 82, 62,
-102, 84,117, 63, 26, 95, 82, 62,102, 84,117, 63,122, 84,181, 62,113,179,141, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0,200, 84,104, 61,244, 65, 79, 63, 96,105,188,189,120, 47, 41, 63, 96,105,188,189,120, 47, 41, 63,200, 84,104, 61,
-242, 65, 79, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0, 44,244,114, 63,236, 65, 79, 63,172,225, 76, 63,
-102, 84,117, 63,172,225, 76, 63,102, 84,117, 63, 44,244,114, 63,236, 65, 79, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0,188,188,  0, 63,173,188,160, 63, 56,207, 38, 63,111,179,141, 63, 52,207, 38, 63,111,179,141, 63,188,188,  0, 63,
-173,188,160, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,172,225, 76, 63,102, 84,117, 63, 52,207, 38, 63,
-111,179,141, 63, 52,207, 38, 63,111,179,141, 63,172,225, 76, 63,102, 84,117, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0, 44,244,114, 63,236, 65, 79, 63,172,225, 76, 63,102, 84,117, 63,172,225, 76, 63,102, 84,117, 63, 44,244,114, 63,
-236, 65, 79, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0, 52,207, 38, 63,111,179,141, 63,188,188,  0, 63,
-173,188,160, 63,188,188,  0, 63,173,188,160, 63, 52,207, 38, 63,111,179,141, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0,174,225, 76, 63,102, 84,117, 63, 52,207, 38, 63,111,179,141, 63, 52,207, 38, 63,111,179,141, 63,172,225, 76, 63,
-102, 84,117, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0, 44,244,114, 63,236, 65, 79, 63,174,225, 76, 63,
-102, 84,117, 63,174,225, 76, 63,102, 84,117, 63, 44,244,114, 63,236, 65, 79, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0, 52,207, 38, 63,111,179,141, 63,190,188,  0, 63,171,188,160, 63,188,188,  0, 63,173,188,160, 63, 52,207, 38, 63,
-111,179,141, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,162,140,159, 63,210, 28,  3, 63, 99,131,140, 63,
- 72, 47, 41, 63, 99,131,140, 63, 76, 47, 41, 63,161,140,159, 63,210, 28,  3, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0, 99,131,140, 63, 76, 47, 41, 63, 44,244,114, 63,236, 65, 79, 63, 44,244,114, 63,236, 65, 79, 63, 99,131,140, 63,
- 76, 47, 41, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,161,140,159, 63,210, 28,  3, 63, 99,131,140, 63,
- 76, 47, 41, 63, 99,131,140, 63, 76, 47, 41, 63,161,140,159, 63,210, 28,  3, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0, 99,131,140, 63, 76, 47, 41, 63, 44,244,114, 63,236, 65, 79, 63, 44,244,114, 63,236, 65, 79, 63, 99,131,140, 63,
- 76, 47, 41, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,161,140,159, 63,210, 28,  3, 63, 99,131,140, 63,
- 76, 47, 41, 63, 99,131,140, 63, 76, 47, 41, 63,244,140,159, 63, 50, 28,  3, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0, 22,172,131, 63, 96,211, 93, 59,226,151,158, 63, 96,211, 93, 59,224,151,158, 63, 96,211, 93, 59, 22,172,131, 63,
- 96,211, 93, 59,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,144,128, 81, 63, 96,211, 93, 59,247,168, 27, 63,
- 96,211, 93, 59,248,168, 27, 63, 96,211, 93, 59,144,128, 81, 63, 96,211, 93, 59,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,
-  0,  0,  0,  0,176,131,185, 63, 96,211, 93, 59,226,151,158, 63, 96,211, 93, 59,224,151,158, 63, 96,211, 93, 59,174,131,185, 63,
- 96,211, 93, 59,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0, 21,172,131, 63, 96,211, 93, 59,144,128, 81, 63,
- 96,211, 93, 59,144,128, 81, 63, 96,211, 93, 59, 22,172,131, 63, 96,211, 93, 59,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,
-  0,  0,  0,  0,247,168, 27, 63, 96,211, 93, 59, 85,162,203, 62, 96,211, 93, 59, 85,162,203, 62, 96,211, 93, 59,247,168, 27, 63,
- 96,211, 93, 59,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,226,151,158, 63, 96,211, 93, 59, 24,172,131, 63,
- 96,211, 93, 59, 21,172,131, 63, 96,211, 93, 59,226,151,158, 63, 96,211, 93, 59,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,
-  0,  0,  0,  0,142,128, 81, 63, 96,211, 93, 59,246,168, 27, 63, 96,211, 93, 59,247,168, 27, 63, 96,211, 93, 59,144,128, 81, 63,
- 96,211, 93, 59,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,174,131,185, 63, 96,211, 93, 59,227,151,158, 63,
- 96,211, 93, 59,226,151,158, 63, 96,211, 93, 59,174,131,185, 63, 96,211, 93, 59,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,
-  0,  0,  0,  0, 22,172,131, 63, 96,211, 93, 59,149,128, 81, 63, 96,211, 93, 59,142,128, 81, 63, 96,211, 93, 59, 24,172,131, 63,
- 96,211, 93, 59,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,251,168, 27, 63, 96,211, 93, 59, 84,162,203, 62,
- 96,211, 93, 59, 86,162,203, 62, 96,211, 93, 59,246,168, 27, 63, 96,211, 93, 59,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,
-  0,  0,  0,  0,225,151,158, 63, 96,211, 93, 59, 21,172,131, 63, 96,211, 93, 59, 22,172,131, 63, 96,211, 93, 59,227,151,158, 63,
- 96,211, 93, 59,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,146,128, 81, 63, 96,211, 93, 59,250,168, 27, 63,
- 96,211, 93, 59,251,168, 27, 63, 96,211, 93, 59,149,128, 81, 63, 96,211, 93, 59,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,
-  0,  0,  0,  0,250,168, 27, 63, 96,211, 93, 59, 84,162,203, 62, 96,211, 93, 59, 84,162,203, 62, 96,211, 93, 59,251,168, 27, 63,
- 96,211, 93, 59,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0, 21,172,131, 63, 96,211, 93, 59,146,128, 81, 63,
- 96,211, 93, 59,149,128, 81, 63, 96,211, 93, 59, 22,172,131, 63, 96,211, 93, 59,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,
-  0,  0,  0,  0,227,151,158, 63, 96,211, 93, 59,174,131,185, 63, 96,211, 93, 59,174,131,185, 63, 96,211, 93, 59,225,151,158, 63,
- 96,211, 93, 59,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,149,128, 81, 63, 96,211, 93, 59,251,168, 27, 63,
- 96,211, 93, 59,246,168, 27, 63, 96,211, 93, 59,142,128, 81, 63, 96,211, 93, 59,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,
-  0,  0,  0,  0,227,151,158, 63, 96,211, 93, 59, 22,172,131, 63, 96,211, 93, 59, 24,172,131, 63, 96,211, 93, 59,226,151,158, 63,
- 96,211, 93, 59,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,246,168, 27, 63, 96,211, 93, 59, 86,162,203, 62,
- 96,211, 93, 59, 85,162,203, 62, 96,211, 93, 59,247,168, 27, 63, 96,211, 93, 59,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,
-  0,  0,  0,  0, 24,172,131, 63, 96,211, 93, 59,142,128, 81, 63, 96,211, 93, 59,144,128, 81, 63, 96,211, 93, 59, 21,172,131, 63,
- 96,211, 93, 59,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,174,131,185, 63, 96,211, 93, 59,226,151,158, 63,
- 96,211, 93, 59,226,151,158, 63, 96,211, 93, 59,176,131,185, 63, 96,211, 93, 59,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,
-  0,  0,  0,  0,144,128, 81, 63, 96,211, 93, 59,247,168, 27, 63, 96,211, 93, 59,247,168, 27, 63, 96,211, 93, 59,144,128, 81, 63,
- 96,211, 93, 59,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,226,151,158, 63, 96,211, 93, 59, 21,172,131, 63,
- 96,211, 93, 59, 22,172,131, 63, 96,211, 93, 59,224,151,158, 63, 96,211, 93, 59,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,
-  0,  0,  0,  0,247,168, 27, 63, 96,211, 93, 59, 85,162,203, 62, 96,211, 93, 59, 86,162,203, 62, 96,211, 93, 59,248,168, 27, 63,
- 96,211, 93, 59,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0, 22,172,131, 63, 96,211, 93, 59,144,128, 81, 63,
- 96,211, 93, 59,144,128, 81, 63, 96,211, 93, 59, 22,172,131, 63, 96,211, 93, 59,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,
-  0,  0,  0,  0,226,151,158, 63, 96,211, 93, 59,176,131,185, 63, 96,211, 93, 59,174,131,185, 63, 96,211, 93, 59,224,151,158, 63,
- 96,211, 93, 59,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0, 99,131,140, 63, 76, 47, 41, 63, 44,244,114, 63,
-236, 65, 79, 63, 44,244,114, 63,236, 65, 79, 63, 99,131,140, 63, 76, 47, 41, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0,161,140,159, 63,210, 28,  3, 63, 99,131,140, 63, 76, 47, 41, 63, 99,131,140, 63, 76, 47, 41, 63,161,140,159, 63,
-210, 28,  3, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0, 99,131,140, 63, 76, 47, 41, 63, 44,244,114, 63,
-236, 65, 79, 63, 44,244,114, 63,236, 65, 79, 63, 99,131,140, 63, 76, 47, 41, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0,161,140,159, 63,210, 28,  3, 63, 99,131,140, 63, 76, 47, 41, 63, 99,131,140, 63, 76, 47, 41, 63,161,140,159, 63,
-210, 28,  3, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0, 99,131,140, 63, 72, 47, 41, 63, 44,244,114, 63,
-236, 65, 79, 63, 44,244,114, 63,236, 65, 79, 63, 99,131,140, 63, 76, 47, 41, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0,174,225, 76, 63,102, 84,117, 63, 52,207, 38, 63,111,179,141, 63, 52,207, 38, 63,111,179,141, 63,174,225, 76, 63,
-102, 84,117, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0, 52,207, 38, 63,111,179,141, 63,188,188,  0, 63,
-173,188,160, 63,188,188,  0, 63,173,188,160, 63, 52,207, 38, 63,111,179,141, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0, 44,244,114, 63,236, 65, 79, 63,174,225, 76, 63,102, 84,117, 63,172,225, 76, 63,102, 84,117, 63, 44,244,114, 63,
-236, 65, 79, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,172,225, 76, 63,102, 84,117, 63, 52,207, 38, 63,
-111,179,141, 63, 52,207, 38, 63,111,179,141, 63,172,225, 76, 63,102, 84,117, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0, 52,207, 38, 63,111,179,141, 63,188,188,  0, 63,173,188,160, 63,188,188,  0, 63,173,188,160, 63, 52,207, 38, 63,
-111,179,141, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0, 44,244,114, 63,236, 65, 79, 63,172,225, 76, 63,
-102, 84,117, 63,172,225, 76, 63,102, 84,117, 63, 44,244,114, 63,236, 65, 79, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0, 56,207, 38, 63,111,179,141, 63,172,225, 76, 63,102, 84,117, 63,172,225, 76, 63,102, 84,117, 63, 52,207, 38, 63,
-111,179,141, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0, 96,105,188,189,120, 47, 41, 63, 56,127,118,190,
-220, 28,  3, 63, 56,127,118,190,220, 28,  3, 63, 96,105,188,189,120, 47, 41, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0, 26, 95, 82, 62,102, 84,117, 63,200, 84,104, 61,244, 65, 79, 63,200, 84,104, 61,242, 65, 79, 63, 26, 95, 82, 62,
-102, 84,117, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,190,188,  0, 63,171,188,160, 63,122, 84,181, 62,
-113,179,141, 63,122, 84,181, 62,113,179,141, 63,188,188,  0, 63,173,188,160, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0,200, 84,104, 61,242, 65, 79, 63, 96,105,188,189,120, 47, 41, 63,128,105,188,189,120, 47, 41, 63,160, 84,104, 61,
-242, 65, 79, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,122, 84,181, 62,113,179,141, 63, 26, 95, 82, 62,
-102, 84,117, 63, 26, 95, 82, 62,102, 84,117, 63,122, 84,181, 62,113,179,141, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0,128,105,188,189,120, 47, 41, 63, 64,127,118,190,216, 28,  3, 63, 64,127,118,190,216, 28,  3, 63,128,105,188,189,
-120, 47, 41, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0, 26, 95, 82, 62,102, 84,117, 63,160, 84,104, 61,
-242, 65, 79, 63,160, 84,104, 61,242, 65, 79, 63, 26, 95, 82, 62,102, 84,117, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0,188,188,  0, 63,173,188,160, 63,122, 84,181, 62,113,179,141, 63,122, 84,181, 62,113,179,141, 63,188,188,  0, 63,
-173,188,160, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,160, 84,104, 61,242, 65, 79, 63,128,105,188,189,
-120, 47, 41, 63,128,105,188,189,120, 47, 41, 63,160, 84,104, 61,242, 65, 79, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0,122, 84,181, 62,113,179,141, 63, 26, 95, 82, 62,102, 84,117, 63, 26, 95, 82, 62,102, 84,117, 63,122, 84,181, 62,
-113,179,141, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,128,105,188,189,120, 47, 41, 63, 64,127,118,190,
-216, 28,  3, 63, 64,127,118,190,216, 28,  3, 63,128,105,188,189,120, 47, 41, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0, 26, 95, 82, 62,102, 84,117, 63,160, 84,104, 61,242, 65, 79, 63,160, 84,104, 61,242, 65, 79, 63, 26, 95, 82, 62,
-102, 84,117, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,122, 84,181, 62,113,179,141, 63,188,188,  0, 63,
-173,188,160, 63,188,188,  0, 63,173,188,160, 63,122, 84,181, 62,113,179,141, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0,180,131,140, 63,116, 19,186, 62,244,140,159, 63, 50, 28,  3, 63, 99,131,140, 63, 76, 47, 41, 63, 42,244,114, 63,
-244, 28,  3, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,174,225, 76, 63,  0, 21,186, 62, 51,207, 38, 63,
- 24,224, 91, 62,112,226, 76, 63, 64, 38,135, 61,240,244,114, 63,  4,221, 91, 62,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0,185,188,  0, 63, 96, 44,135, 61, 61, 84,181, 62,176,104,169,189, 93,189,  0, 63, 80,  1,109,190,248,207, 38, 63,
-144,109,169,189,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,174,225, 76, 63,116, 47, 41, 63, 52,207, 38, 63,
-248, 28,  3, 63,174,225, 76, 63,  0, 21,186, 62, 42,244,114, 63,244, 28,  3, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0,185,188,  0, 63,  0, 21,186, 62,122, 84,181, 62, 32,224, 91, 62,185,188,  0, 63, 96, 44,135, 61, 51,207, 38, 63,
- 24,224, 91, 62,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,172,225, 76, 63,102, 84,117, 63, 52,207, 38, 63,
-236, 65, 79, 63,174,225, 76, 63,116, 47, 41, 63, 44,244,114, 63,236, 65, 79, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0,188,188,  0, 63,120, 47, 41, 63,122, 84,181, 62,248, 28,  3, 63,185,188,  0, 63,  0, 21,186, 62, 52,207, 38, 63,
-248, 28,  3, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0, 14, 95, 82, 62,  0, 21,186, 62,144, 82,104, 61,
-128,223, 91, 62,138, 94, 82, 62, 48, 43,135, 61,122, 84,181, 62, 32,224, 91, 62,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0,190,188,  0, 63,102, 84,117, 63,127, 84,181, 62,242, 65, 79, 63,188,188,  0, 63,120, 47, 41, 63, 52,207, 38, 63,
-236, 65, 79, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0, 26, 95, 82, 62,120, 47, 41, 63,160, 84,104, 61,
-  0, 29,  3, 63, 14, 95, 82, 62,  0, 21,186, 62,122, 84,181, 62,248, 28,  3, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0,190,188,  0, 63,102, 84,117, 63, 56,207, 38, 63,111,179,141, 63,188,188,  0, 63,173,188,160, 63,122, 84,181, 62,
-113,179,141, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0, 26, 95, 82, 62,102, 84,117, 63,160, 84,104, 61,
-242, 65, 79, 63, 26, 95, 82, 62,120, 47, 41, 63,127, 84,181, 62,242, 65, 79, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,
-  0,  0,  0,  0,128,105,188,189,120, 47, 41, 63, 64,127,118,190,216, 28,  3, 63,128,106,188,189,176, 20,186, 62,160, 84,104, 61,
-  0, 29,  3, 63,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0, 68, 65, 84, 65, 64,  6,  0,  0, 56, 98, 52,  3,
-  0,  0,  0,  0, 53,  0,  0,  0,144,  1,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24,233, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,  1,  0,  0,  0,  5,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,200,244, 26,  4,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,  0,  0,  0,  0,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  1,  0,  0,  0,  5,  0,  0,  0, 12,  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,  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,  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,  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,136,183,198,  4,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  1,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  2,  0,  0,  0,  5,  0,  0,  0, 28,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,168,198,198,  4,  0,  0,  0,  0,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255, 77, 69,  0,  0,152,  1,  0,  0,200,104, 52,  3,  0,  0,  0,  0, 46,  0,  0,  0,
-  1,  0,  0,  0, 56,108, 53,  3,  0,  0,  0,  0,248, 43, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 77, 69, 67,117, 98,101, 46, 48, 48, 49,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  0,  0,  0,  0,
+  1,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,  2,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,  3,  0,  0,  0,  5,  0,  0,  0, 24,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,116,  0,  0,  0,215,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,144,  1,  0,  0,  0,  0,  0,  0,
+213,204, 76, 63,255,204, 76, 63,  0,  0,104,182, 30,  0,128, 63,140,  0,128, 63,214,255,127, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0, 83,  0, 30,  0,  4,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 16,  0,  0,  0,184,232, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 88,120, 26,  4,  0,  0,  0,  0,104,142, 26,  4,
+  0,  0,  0,  0, 68, 65, 84, 65,  8,  2,  0,  0, 24,233, 26,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  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,  0,168,106, 52,  3,  0,  0,  0,  0, 56,199, 52,  3,  0,  0,  0,  0,152,238, 52,  3,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,168,108, 52,  3,  0,  0,  0,  0, 24,150, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,168, 76, 53,  3,  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,248,106, 52,  3,  0,  0,  0,  0,  1,  0,  0,  0,  5,  0,  0,  0, 20,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,104,148, 52,  3,  0,  0,  0,  0,  1,  0,  0,  0,
-  5,  0,  0,  0, 12,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,136,197, 52,  3,
-  0,  0,  0,  0,  3,  0,  0,  0,  5,  0,  0,  0, 80,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,249,  1,  0,  0,237,  3,  0,  0,244,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,192,133, 88, 61,184, 45, 85,189,
-196,181, 24,190,185, 71, 35, 63,153, 31,235, 62,130,102,203, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0, 67,  0,
- 30,  0,  4,  0,  1,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
-  8,  0,  0,  0,168,106, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,168,238, 51,  3,  0,  0,  0,  0, 68, 65, 84, 65,
-104,  1,  0,  0,248,106, 52,  3,  0,  0,  0,  0, 84,  1,  0,  0,  5,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,168,108, 52,  3,  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,104,235, 26,  4,
   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,  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,
@@ -6544,1796 +6401,2134 @@ char datatoc_preview_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
-116, 39,  0,  0,168,108, 52,  3,  0,  0,  0,  0, 52,  0,  0,  0,249,  1,  0,  0,140,144,131, 62,119,163,200, 60,156,  9, 85, 62,
- 36, 93, 58,172, 64, 26,  0,  0, 50,222, 26,190,119,163,200, 60,156,  9, 85, 62,220,162, 58,172, 64, 26,  0,  0, 61,126,146, 62,
-223, 37,  8,188, 99,183, 47, 62, 80, 77,177,190, 91, 78,  2,  0,147,185, 56,190,223, 37,  8,188, 99,183, 47, 62,176,178,177,190,
- 91, 78,  2,  0,129,176,157, 62,211, 91,217,188,244,238,246, 61,106, 87,237,185,228, 61,  2,  0, 28, 30, 79,190,211, 91,217,188,
-244,238,246, 61,150,168,237,185,228, 61,  2,  0,115, 19, 94, 62,103,251,128,189,150, 32, 14, 62,213, 14,  8,145,  9, 62,  2,  0,
- 26,161,227,189,103,251,128,189,150, 32, 14, 62, 43,241,  8,145,  9, 62,  2,  0,115, 19, 94, 62,251,118, 25,189, 20,165, 62, 62,
-146, 12,225,159,148, 83,  2,  0, 26,161,227,189,251,118, 25,189, 20,165, 62, 62,110,243,225,159,148, 83,  2,  0,115, 19, 94, 62,
-232,107, 34, 60,116,128, 92, 62,205,  4,122,132, 46, 33,  0,  0, 26,161,227,189,232,107, 34, 60,116,128, 92, 62, 51,251,122,132,
- 46, 33,  0,  0, 58,193, 56, 62,119,163,200, 60, 77,247, 99, 62, 30,172, 83,167,129, 38,  0,  0,168,252,152,189,119,163,200, 60,
- 77,247, 99, 62,226, 83, 83,167,129, 38,  0,  0,109, 42, 23, 62,223, 37,  8,188, 88,215, 73, 62, 41,217, 14,206, 67,111,  0,  0,
-229,197,  0, 62,211, 91,217,188, 71, 14, 29, 62,114,185,159,174, 37, 69,  2,  0,249, 23,164,188,211, 91,217,188, 71, 14, 29, 62,
-142, 70,159,174, 37, 69,  2,  0, 88,231,182, 61,159,154,121, 61,179,201, 32, 62,182,151,132,255, 51, 74,  2,  0,207,121,134, 60,
-159,154,121, 61,179,201, 32, 62, 74,104,132,255, 51, 74,  2,  0, 25,158,242, 61,159,154,121, 61, 88,215, 73, 62, 44,167,141,255,
- 38, 92,  2,  0,110,194, 80,188,159,154,121, 61, 88,215, 73, 62,212, 88,141,255, 38, 92,  2,  0,138,211, 41, 62,159,154,121, 61,
- 77,247, 99, 62,233,134, 91,254,110, 41,  0,  0,143, 66,118,189,159,154,121, 61, 77,247, 99, 62, 23,121, 91,254,110, 41,  0,  0,
- 58,193, 56, 62,154,232,206, 61, 77,247, 99, 62, 63,171,127, 88,251, 36,  0,  0,168,252,152,189,154,232,206, 61, 77,247, 99, 62,
-193, 84,127, 88,251, 36,  0,  0,109, 42, 23, 62,173, 79,  5, 62, 88,215, 73, 62,191,197, 53, 67, 11, 92,  2,  0, 31,158, 43,189,
-173, 79,  5, 62, 88,215, 73, 62, 65, 58, 53, 67, 11, 92,  2,  0,229,197,  0, 62, 54,180, 27, 62, 71, 14, 29, 62, 49,188, 51, 80,
- 41, 73,  2,  0,249, 23,164,188, 54,180, 27, 62, 71, 14, 29, 62,207, 67, 51, 80, 41, 73,  2,  0,115, 19, 94, 62,111,  6, 65, 62,
-150, 32, 14, 62,171, 15, 44,107, 51, 68,  2,  0, 26,161,227,189,111,  6, 65, 62,150, 32, 14, 62, 85,240, 44,107, 51, 68,  2,  0,
-115, 19, 94, 62, 14, 43, 35, 62, 20,165, 62, 62, 10, 13,188, 94, 19, 85,  2,  0, 26,161,227,189, 14, 43, 35, 62, 20,165, 62, 62,
-246,242,188, 94, 19, 85,  2,  0,115, 19, 94, 62,250,195,236, 61,116,128, 92, 62, 27,  4, 73,124, 81, 30,  0,  0, 26,161,227,189,
-250,195,236, 61,116,128, 92, 62,229,251, 73,124, 81, 30,  0,  0,140,144,131, 62,154,232,206, 61,156,  9, 85, 62,179, 93,140, 83,
-243, 24,  0,  0, 50,222, 26,190,154,232,206, 61,156,  9, 85, 62, 77,162,140, 83,243, 24,  0,  0, 61,126,146, 62,173, 79,  5, 62,
- 99,183, 47, 62,225, 77, 89, 63,101, 79,  2,  0,147,185, 56,190,173, 79,  5, 62, 99,183, 47, 62, 31,178, 89, 63,101, 79,  2,  0,
-129,176,157, 62, 54,180, 27, 62,244,238,246, 61, 10, 86,225, 68, 20, 65,  2,  0, 28, 30, 79,190, 54,180, 27, 62,244,238,246, 61,
-246,169,225, 68, 20, 65,  2,  0,157, 89,176, 62,159,154,121, 61, 67,  1,232, 61, 39,111,149,255,117, 63,  2,  0, 84,112,116,190,
-159,154,121, 61, 67,  1,232, 61,217,144,149,255,117, 63,  2,  0,237,107,161, 62,159,154,121, 61,139, 64, 40, 62,169,102,145,255,
-112, 76,  2,  0,244,148, 86,190,159,154,121, 61,139, 64, 40, 62, 87,153,145,255,112, 76,  2,  0,100,  7,139, 62,159,154,121, 61,
- 48, 78, 81, 62, 36,125,151,254,216, 26,  0,  0,227,203, 41,190,159,154,121, 61, 48, 78, 81, 62,220,130,151,254,216, 26,  0,  0,
- 26,229,140, 62,159,154,121, 61,  8,197, 88, 62,162,124,112,254, 23, 29,  2,  0, 79,135, 45,190,159,154,121, 61,  8,197, 88, 62,
- 94,131,112,254, 23, 29,  2,  0, 66,110,133, 62,114, 95,214, 61,116,128, 92, 62,105, 92, 46, 83,100, 30,  2,  0,158,153, 30,190,
-114, 95,214, 61,116,128, 92, 62,151,163, 46, 83,100, 30,  2,  0,115, 19, 94, 62,170,177,251, 61,185,178,103, 62,203,  4,126,119,
-158, 45,  2,  0, 26,161,227,189,170,177,251, 61,185,178,103, 62, 53,251,126,119,158, 45,  2,  0,206,  5, 53, 62,114, 95,214, 61,
-145, 41,111, 62,213,175,209, 82,166, 55,  2,  0,208,133,145,189,114, 95,214, 61,145, 41,111, 62, 43, 80,209, 82,166, 55,  2,  0,
-178, 92, 34, 62,159,154,121, 61,145, 41,111, 62, 93,139,110,254,175, 52,  2,  0, 48,103, 88,189,159,154,121, 61,145, 41,111, 62,
-163,116,110,254,175, 52,  2,  0,206,  5, 53, 62, 22,200,170, 60,145, 41,111, 62,226,176, 82,172,220, 55,  2,  0,208,133,145,189,
- 22,200,170, 60,145, 41,111, 62, 30, 79, 82,172,220, 55,  2,  0,115, 19, 94, 62,159,154,121, 61,253,228,114, 62,128, 23, 82,255,
-209,125,  2,  0, 26,161,227,189,159,154,121, 61,253,228,114, 62,128,232, 82,255,209,125,  2,  0,115, 19, 94, 62,149,249, 43, 59,
-185,178,103, 62,186,  4, 80,136, 27, 45,  2,  0, 26,161,227,189,149,249, 43, 59,185,178,103, 62, 70,251, 80,136, 27, 45,  2,  0,
- 66,110,133, 62, 22,200,170, 60,116,128, 92, 62,134, 91,236,171,153, 30,  2,  0,158,153, 30,190, 22,200,170, 60,116,128, 92, 62,
-122,164,236,171,153, 30,  2,  0,203,133, 88, 61,202,248, 23, 62, 88,215, 73, 62,  0,  0,209,122, 10, 36,  0,  0,203,133, 88, 61,
- 34, 77,229, 61,145, 41,111, 62,  0,  0,235,252,245,127,  0,  0,203,133, 88, 61,150,254,188,190,236, 27, 70, 62,  0,  0,159,251,
-235,127,  0,  0,203,133, 88, 61,191, 79, 78,190,116,128, 92, 62,  0,  0, 65,146,221, 65,  2,  0,203,133, 88, 61,146,221, 14,190,
- 77,247, 99, 62,  0,  0,125,100, 70, 79,  0,  0,203,133, 88, 61, 30, 99,211,190, 20,165, 62, 62,  0,  0,104,140,246, 54,  2,  0,
-203,133, 88, 61,133,198, 12, 62,190,169,  6, 62,  0,  0,143,112,238, 60,  0,  0,203,133, 88, 61, 99, 38, 91, 62, 28,120,239, 61,
-  0,  0,104, 79, 98,100,  0,  0,203,133, 88, 61, 16,243,187, 62,170,250,206,190,  0,  0,144,106, 25,185,  2,  0,203,133, 88, 61,
-247,106, 87, 62,178,224, 11,191,  0,  0, 51, 40,124,134,  3,  0,203,133, 88, 61, 18,165,157,188, 33, 20,  9,191,  0,  0,140,217,
-235,133,  2,  0,203,133, 88, 61, 32, 43,108,190,227, 83,160,190,  0,  0,143,135,174,212,  2,  0,109, 42, 23, 62,146,221, 14,190,
- 67,  1,232, 61,224,115, 50,206,203, 21,  0,  0, 31,158, 43,189,146,221, 14,190, 67,  1,232, 61, 32,140, 50,206,203, 21,  0,  0,
- 87,106, 75, 62,138, 37,131,190, 28,120,239, 61,136,123,  6, 28, 94, 18,  2,  0,225, 78,190,189,138, 37,131,190, 28,120,239, 61,
-120,132,  6, 28, 94, 18,  2,  0,115, 19, 94, 62,  2,186,192,190, 28,120,239, 61,229,124, 36, 12, 56, 25,  0,  0, 26,161,227,189,
-  2,186,192,190, 28,120,239, 61, 27,131, 36, 12, 56, 25,  0,  0, 75,138,101, 62,200, 96,239,190,227, 37,202, 61, 26,124, 38,237,
-  2, 25,  2,  0,203,142,242,189,200, 96,239,190,227, 37,202, 61,230,131, 38,237,  2, 25,  2,  0, 47,225, 82, 62,195,112,252,190,
- 10,175,194, 61,185, 83, 15,161,241, 18,  2,  0,146, 60,205,189,195,112,252,190, 10,175,194, 61, 71,172, 15,161,241, 18,  2,  0,
- 41,248, 11, 62,242,  4,  1,191,107,138,224, 61, 45, 20, 69,131,109, 20,  2,  0, 27,170,253,188,242,  4,  1,191,107,138,224, 61,
-211,235, 69,131,109, 20,  2,  0,203,133, 88, 61,168,226,  2,191,244,238,246, 61,  0,  0,219,130,219, 26,  2,  0,140,144,131, 62,
- 18,242,240,189,227, 37,202, 61, 38, 46,194,136,209,  5,  2,  0, 50,222, 26,190, 18,242,240,189,227, 37,202, 61,218,209,194,136,
-209,  5,  2,  0, 83, 55,178, 62, 23,233,143,189,187,156,209, 61, 96, 75,200,154, 89, 21,  2,  0,193, 43,120,190, 23,233,143,189,
-187,156,209, 61,160,180,200,154, 89, 21,  2,  0, 26,222,224, 62,182,236,140, 60, 49, 21,112, 61,208,116,116,204, 17,247,  2,  0,
-167,188,170,190,182,236,140, 60, 49, 21,112, 61, 48,139,116,204, 17,247,  2,  0,243, 84,232, 62,202,248, 23, 62, 82,238,  2, 62,
-167,112, 64, 54, 93, 27,  2,  0,128, 51,178,190,202,248, 23, 62, 82,238,  2, 62, 89,143, 64, 54, 93, 27,  2,  0,112,224,196, 62,
-190, 24, 50, 62,  2,220, 17, 62, 70, 65,159,106,113, 27,  0,  0,253,190,142,190,190, 24, 50, 62,  2,220, 17, 62,186,190,159,106,
-113, 27,  0,  0,134,160,144, 62, 20, 20,106, 62, 99,183, 47, 62,131, 76, 82,100,139, 21,  0,  0, 39,254, 52,190, 20, 20,106, 62,
- 99,183, 47, 62,125,179, 82,100,139, 21,  0,  0,195, 37, 79, 62, 67, 92,154, 62,236, 27, 70, 62, 56, 29,185,122,159, 21,  2,  0,
-186,197,197,189, 67, 92,154, 62,236, 27, 70, 62,200,226,185,122,159, 21,  2,  0,229,197,  0, 62,181,  7,145, 62, 48, 78, 81, 62,
- 95,179,127, 99,180, 24,  2,  0,249, 23,164,188,181,  7,145, 62, 48, 78, 81, 62,161, 76,127, 99,180, 24,  2,  0,168,249,167, 61,
- 42,212, 53, 62,196,146, 77, 62,169,154,155, 74, 94, 23,  0,  0,144, 48,194, 60, 42,212, 53, 62,196,146, 77, 62, 87,101,155, 74,
- 94, 23,  0,  0, 81,129,  4, 62,241,129, 16, 62,  8,197, 88, 62,248, 33,229,229,156,120,  0,  0, 89,243,193,188,241,129, 16, 62,
-  8,197, 88, 62,  8,222,229,229,156,120,  0,  0,105,176,227, 61, 17,132,184, 61,156,  9, 85, 62,162,  3,150,230,100,125,  0,  0,
-214,169,178,187, 17,132,184, 61,156,  9, 85, 62, 94,252,150,230,100,125,  0,  0, 31,158, 43,189,223, 37,  8,188, 88,215, 73, 62,
-215, 38, 14,206, 67,111,  0,  0,184, 69,105, 62, 92, 82, 55,189, 59, 46, 55, 62,194, 39,112,212,152,113,  0,  0,163,  5,250,189,
- 92, 82, 55,189, 59, 46, 55, 62, 62,216,112,212,152,113,  0,  0,134,160,144, 62,115,128,187,188,139, 64, 40, 62,176, 53,101,207,
-137,105,  0,  0, 39,254, 52,190,115,128,187,188,139, 64, 40, 62, 80,202,101,207,137,105,  0,  0,157, 89,176, 62,205, 26, 17, 61,
- 71, 14, 29, 62,129, 56,167,229,200,111,  0,  0, 84,112,116,190,205, 26, 17, 61, 71, 14, 29, 62,127,199,167,229,200,111,  0,  0,
-  9, 21,180, 62, 57, 13,177, 61, 71, 14, 29, 62,117, 46,213,228, 33,116,  0,  0, 45,231,123,190, 57, 13,177, 61, 71, 14, 29, 62,
-139,209,213,228, 33,116,  0,  0,123,192,170, 62,170,177,251, 61, 31,133, 36, 62,228, 30,190,216,216,117,  0,  0, 16, 62,105,190,
-170,177,251, 61, 31,133, 36, 62, 28,225,190,216,216,117,  0,  0,214,178,129, 62, 54,180, 27, 62, 20,165, 62, 62, 82, 25,170,254,
-117,125,  0,  0,198, 34, 23,190, 54,180, 27, 62, 20,165, 62, 62,174,230,170,254,117,125,  0,  0,246,142, 45, 62,230,161, 42, 62,
- 48, 78, 81, 62, 13, 34,233,239, 84,122,  0,  0, 32,152,130,189,230,161, 42, 62, 48, 78, 81, 62,243,221,233,239, 84,122,  0,  0,
-203,133, 88, 61,104,133,209,190,236, 27, 70, 62,  0,  0,130,201,209,115,  0,  0,185,194,212, 61, 36, 83,198,190,236, 27, 70, 62,
-244, 19, 41,234,135,124,  0,  0,191,196,240, 58, 36, 83,198,190,236, 27, 70, 62, 12,236, 41,234,135,124,  0,  0,145, 57,220, 61,
-207, 80,226,190,167,233, 58, 62,102, 11,172,214,154,120,  0,  0, 77,241,236,186,207, 80,226,190,167,233, 58, 62,154,244,172,214,
-154,120,  0,  0,168,249,167, 61, 19,131,237,190,207,114, 51, 62,198,252, 75,203,152,116,  0,  0,144, 48,194, 60, 19,131,237,190,
-207,114, 51, 62, 58,  3, 75,203,152,116,  0,  0,203,133, 88, 61,200, 96,239,190, 99,183, 47, 62,  0,  0,154,213,196,120,  0,  0,
-203,133, 88, 61,254,152, 18,190,196,146, 77, 62,  0,  0, 46, 97, 76, 83,  0,  0,203,133, 88, 61, 18,242,240,189, 88,215, 73, 62,
-  0,  0,220, 72, 59,105,  0,  0,225, 75,205, 61,235,104,248,189, 88,215, 73, 62, 91, 32,137, 44,141,115,  0,  0,179,158,179, 59,
-235,104,248,189, 88,215, 73, 62,165,223,137, 44,141,115,  0,  0,105,176,227, 61,174,134, 33,190,196,146, 77, 62, 91, 92, 85,209,
- 85, 75,  0,  0,214,169,178,187,174,134, 33,190,196,146, 77, 62,165,163, 85,209, 85, 75,  0,  0, 48, 94,190, 61, 15, 98, 63,190,
- 88,215, 73, 62,153, 63, 63,200, 17, 96,  0,  0,220, 60, 81, 60, 15, 98, 63,190, 88,215, 73, 62,103,192, 63,200, 17, 96,  0,  0,
-252,119,116, 62,239, 95,151,189,139, 64, 40, 62,192, 48,194,189, 17, 98,  0,  0, 22, 53,  8,190,239, 95,151,189,139, 64, 40, 62,
- 64,207,194,189, 17, 98,  0,  0,231,123,174, 62,211, 91,217,188,  2,220, 17, 62,214, 63,168,204, 87, 98,  2,  0,232,180,112,190,
-211, 91,217,188,  2,220, 17, 62, 42,192,168,204, 87, 98,  2,  0,220,155,200, 62, 45,246, 46, 61,190,169,  6, 62, 66, 70, 51,214,
-123, 98,  0,  0,105,122,146,190, 45,246, 46, 61,190,169,  6, 62,190,185, 51,214,123, 98,  0,  0, 72, 87,204, 62,170,177,251, 61,
-179,201, 32, 62,103, 62, 46,237, 39,110,  0,  0,213, 53,150,190,170,177,251, 61,179,201, 32, 62,153,193, 46,237, 39,110,  0,  0,
- 78, 71,191, 62,241,129, 16, 62,128, 96, 66, 62,188, 43,214,251, 56,120,  2,  0,219, 37,137,190,241,129, 16, 62,128, 96, 66, 62,
- 68,212,214,251, 56,120,  2,  0,140,144,131, 62, 31,244, 79, 62, 77,247, 99, 62, 53, 40, 29,252,116,121,  0,  0, 50,222, 26,190,
- 31,244, 79, 62, 77,247, 99, 62,203,215, 29,252,116,121,  0,  0, 87,106, 75, 62, 48,189,124, 62,105,160,118, 62,180, 34, 68, 27,
- 37,120,  0,  0,225, 78,190,189, 48,189,124, 62,105,160,118, 62, 76,221, 68, 27, 37,120,  0,  0,109, 42, 23, 62,236,138,113, 62,
- 65, 23,126, 62,250,234, 91, 20,154,124,  0,  0, 31,158, 43,189,236,138,113, 62, 65, 23,126, 62,  6, 21, 91, 20,154,124,  0,  0,
-225, 75,205, 61,202,248, 23, 62,213, 91,122, 62,170,246, 84,252,154,127,  0,  0,179,158,179, 59,202,248, 23, 62,213, 91,122, 62,
- 86,  9, 84,252,154,127,  0,  0,105,176,227, 61,217,159,203,189, 37,110,107, 62,125,  8, 79,231, 77,125,  0,  0,214,169,178,187,
-217,159,203,189, 37,110,107, 62,131,247, 79,231, 77,125,  0,  0,218,229, 26, 62, 64,  3,133,190,167,233, 58, 62, 41, 75, 84, 14,
-155,102,  2,  0,207,139, 58,189, 64,  3,133,190,167,233, 58, 62,215,180, 84, 14,155,102,  2,  0,246,142, 45, 62,184,151,194,190,
- 99,183, 47, 62,174, 72,200,251, 69,105,  2,  0, 32,152,130,189,184,151,194,190, 99,183, 47, 62, 82,183,200,251, 69,105,  2,  0,
-206,  5, 53, 62, 99,149,222,190, 31,133, 36, 62, 39, 71, 91,228,189,102,  2,  0,208,133,145,189, 99,149,222,190, 31,133, 36, 62,
-217,184, 91,228,189,102,  2,  0, 30, 24, 38, 62,234,249,244,190,111,151, 21, 62,118, 46,217,176, 53, 89,  2,  0,224, 84,103,189,
-234,249,244,190,111,151, 21, 62,138,209,217,176, 53, 89,  2,  0, 81,129,  4, 62, 86,181,248,190,111,151, 21, 62,124, 21,143,159,
- 92, 81,  2,  0, 89,243,193,188, 86,181,248,190,111,151, 21, 62,132,234,143,159, 92, 81,  2,  0,203,133, 88, 61,195,112,252,190,
-219, 82, 25, 62,  0,  0,155,154, 28, 78,  2,  0,203,133, 88, 61, 52, 55,247,188,128, 96, 66, 62,  0,  0,185,  1,252,127,  0,  0,
-203,133, 88, 61,222,227, 61, 61,156,  9, 85, 62,  0,  0,102,227,194,124,  0,  0, 47,225, 82, 62, 82, 93, 46, 62, 88,215, 73, 62,
- 20, 17,134,243, 60,126,  0,  0,146, 60,205,189, 82, 93, 46, 62, 88,215, 73, 62,236,238,134,243, 60,126,  0,  0, 81,129,  4, 62,
-170, 34, 94, 60,196,146, 77, 62, 69,216, 70,234,183,119,  0,  0, 89,243,193,188,170, 34, 94, 60,196,146, 77, 62,187, 39, 70,234,
-183,119,  0,  0, 65, 39,235, 61,222,227, 61, 61, 48, 78, 81, 62, 55,235,111,230,174,123,  0,  0,173, 11, 21,188,222,227, 61, 61,
- 48, 78, 81, 62,201, 20,111,230,174,123,  0,  0,145, 57,220, 61, 76,220,190,190,236, 27, 70, 62, 18, 23,153,248,174,125,  0,  0,
- 77,241,236,186, 76,220,190,190,236, 27, 70, 62,238,232,153,248,174,125,  0,  0, 88,231,182, 61, 64,  3,133,190,196,146, 77, 62,
-190, 17, 95,  0,194,126,  2,  0,207,121,134, 60, 64,  3,133,190,196,146, 77, 62, 66,238, 95,  0,194,126,  2,  0,203,133, 88, 61,
- 64,  3,133,190,196,146, 77, 62,  0,  0,122,255,254,127,  0,  0,203,133, 88, 61, 43, 11, 82,190, 88,215, 73, 62,  0,  0,111,197,
-207,113,  0,  0,  8,213,197, 61, 55,235, 55,190,116,128, 92, 62, 71, 74,123,162,  9, 46,  2,  0, 27,134, 21, 60, 55,235, 55,190,
-116,128, 92, 62,185,181,123,162,  9, 46,  2,  0, 65, 39,235, 61,174,134, 33,190, 77,247, 99, 62, 88,118,191,228,110, 40,  2,  0,
-173, 11, 21,188,174,134, 33,190, 77,247, 99, 62,168,137,191,228,110, 40,  2,  0,185,194,212, 61, 57,123,233,189,116,128, 92, 62,
-150, 79, 31, 99,242, 14,  2,  0,191,196,240, 58, 57,123,233,189,116,128, 92, 62,106,176, 31, 99,242, 14,  2,  0, 31,149,145, 61,
- 97,  4,226,189,116,128, 92, 62, 95,217,134,120, 24, 19,  2,  0, 89,225, 13, 61, 97,  4,226,189,116,128, 92, 62,161, 38,134,120,
- 24, 19,  2,  0,203,133, 88, 61,106, 84, 22,190,253,228,114, 62,  0,  0,137, 14, 42,127,  0,  0,247, 11,153, 61,235,104,248,189,
- 37,110,107, 62,130,230,  5, 77,255, 98,  2,  0, 82,231,253, 60,235,104,248,189, 37,110,107, 62,126, 25,  5, 77,255, 98,  2,  0,
-  8,213,197, 61,195,223,255,189, 37,110,107, 62,229, 46,209, 60,101,102,  2,  0, 27,134, 21, 60,195,223,255,189, 37,110,107, 62,
- 27,209,209, 60,101,102,  2,  0,185,194,212, 61,174,134, 33,190,253,228,114, 62,254, 54, 84,232, 32,113,  2,  0,191,196,240, 58,
-174,134, 33,190,253,228,114, 62,  2,201, 84,232, 32,113,  2,  0, 88,231,182, 61,243,184, 44,190,185,178,103, 62, 59, 28,209,183,
-219,101,  2,  0,207,121,134, 60,243,184, 44,190,185,178,103, 62,197,227,209,183,219,101,  2,  0,203,133, 88, 61, 15, 98, 63,190,
-185,178,103, 62,  0,  0, 89,188,167,108,  2,  0, 98, 74, 49, 62, 83,148, 74,190,107,138,224, 61, 32,120,156, 41,218, 14,  0,  0,
-248, 14,138,189, 83,148, 74,190,107,138,224, 61,224,135,156, 41,218, 14,  0,  0, 81,129,  4, 62,134,253, 40,190,167,233, 58, 62,
- 27, 95,200,  3,147, 85,  0,  0, 89,243,193,188,134,253, 40,190,167,233, 58, 62,229,160,200,  3,147, 85,  0,  0, 41,248, 11, 62,
- 83,148, 74,190,167,233, 58, 62,188, 82, 59, 18,241, 95,  0,  0, 27,170,253,188, 83,148, 74,190,167,233, 58, 62, 68,173, 59, 18,
-241, 95,  0,  0, 30, 24, 38, 62,243,184, 44,190,107,138,224, 61,  9,122, 11, 36,207, 13,  0,  0,224, 84,103,189,243,184, 44,190,
-107,138,224, 61,247,133, 11, 36,207, 13,  0,  0,203,133, 88, 61, 93,165,235,190, 99,183, 47, 62,  0,  0,198, 82,160, 97,  0,  0,
-247, 11,153, 61,167,199,233,190, 99,183, 47, 62,149,208,194, 69, 69, 96,  0,  0, 82,231,253, 60,167,199,233,190, 99,183, 47, 62,
-107, 47,194, 69, 69, 96,  0,  0,  8,213,197, 61, 99,149,222,190,167,233, 58, 62,197,172,223,  7,235, 96,  0,  0, 27,134, 21, 60,
- 99,149,222,190,167,233, 58, 62, 59, 83,223,  7,235, 96,  0,  0,  8,213,197, 61, 70,236,203,190,128, 96, 66, 62,104,241, 70,177,
-219, 99,  0,  0, 27,134, 21, 60, 70,236,203,190,128, 96, 66, 62,152, 14, 70,177,219, 99,  0,  0,203,133, 88, 61,212, 64,213,190,
-179,201, 32, 62,  0,  0,141,166,141, 91,  0,  0,  8,213,197, 61,252,201,205,190, 31,133, 36, 62,233,189,224,165, 99, 62,  0,  0,
- 27,134, 21, 60,252,201,205,190, 31,133, 36, 62, 23, 66,224,165, 99, 62,  0,  0,  8,213,197, 61,173,183,220,190,219, 82, 25, 62,
-160,169,174, 14, 78, 93,  0,  0, 27,134, 21, 60,173,183,220,190,219, 82, 25, 62, 96, 86,174, 14, 78, 93,  0,  0,247, 11,153, 61,
- 59, 12,230,190,111,151, 21, 62, 30,214,188, 60,151,104,  0,  0, 82,231,253, 60, 59, 12,230,190,111,151, 21, 62,226, 41,188, 60,
-151,104,  0,  0,203,133, 88, 61,241,233,231,190,111,151, 21, 62,  0,  0,177, 67,161,108,  0,  0,189, 60,  8, 62,142,209, 76, 61,
-116,128, 92, 62, 27, 21,134,244,184,125,  0,  0,186,206,223,188,142,209, 76, 61,116,128, 92, 62,229,234,134,244,184,125,  0,  0,
-149,179, 15, 62, 22,200,170, 60,  8,197, 88, 62,210,253, 49,248,189,127,  0,  0,190,194, 13,189, 22,200,170, 60,  8,197, 88, 62,
- 46,  2, 49,248,189,127,  0,  0,155,156, 86, 62,202,248, 23, 62, 48, 78, 81, 62, 53, 21,115, 14,101,125,  0,  0,106,179,212,189,
-202,248, 23, 62, 48, 78, 81, 62,203,234,115, 14,101,125,  0,  0, 58,193, 56, 62, 94, 61, 20, 62,  8,197, 88, 62,103, 23,178,  4,
-192,125,  2,  0,168,252,152,189, 94, 61, 20, 62,  8,197, 88, 62,153,232,178,  4,192,125,  2,  0, 64,170,127, 62, 25, 11,  9, 62,
-  8,197, 88, 62, 38, 22,205,241, 67,125,  2,  0, 90,103, 19,190, 25, 11,  9, 62,  8,197, 88, 62,218,233,205,241, 67,125,  2,  0,
-237,107,161, 62, 34, 77,229, 61,207,114, 51, 62, 51, 39, 96,  4,196,121,  0,  0,244,148, 86,190, 34, 77,229, 61,207,114, 51, 62,
-205,216, 96,  4,196,121,  0,  0, 15,  5,167, 62, 97,150,169, 61, 99,183, 47, 62,238, 23,158,247,117,125,  0,  0, 56,199, 97,190,
- 97,150,169, 61, 99,183, 47, 62, 18,232,158,247,117,125,  0,  0, 89, 39,165, 62,125,  8, 32, 61,247,251, 43, 62, 69, 38, 13,244,
-142,121,  0,  0,204, 11, 94,190,125,  8, 32, 61,247,251, 43, 62,187,217, 13,244,142,121,  0,  0, 26,229,140, 62, 60,222,152,187,
- 20,165, 62, 62,148, 36,144,250,137,122,  0,  0, 79,135, 45,190, 60,222,152,187, 20,165, 62, 62,108,219,144,250,137,122,  0,  0,
-184, 69,105, 62,115,128,187,188, 88,215, 73, 62,146, 25,123,229,148,122,  0,  0,163,  5,250,189,115,128,187,188, 88,215, 73, 62,
-110,230,123,229,148,122,  0,  0,178, 92, 34, 62,226,194,133,186,116,128, 92, 62,166,  1,  8,236,106,126,  0,  0, 48,103, 88,189,
-226,194,133,186,116,128, 92, 62, 90,254,  8,236,106,126,  0,  0, 41,248, 11, 62, 57, 13,177, 61,116,128, 92, 62, 48, 30, 16,242,
-153,123,  0,  0, 27,170,253,188, 57, 13,177, 61,116,128, 92, 62,208,225, 16,242,153,123,  0,  0,218,229, 26, 62,170,177,251, 61,
-116,128, 92, 62,232, 20, 76,245,210,125,  0,  0,207,139, 58,189,170,177,251, 61,116,128, 92, 62, 24,235, 76,245,210,125,  0,  0,
- 30, 24, 38, 62,250,195,236, 61, 48, 78, 81, 62, 31, 64,221,206, 71, 99,  0,  0,224, 84,103,189,250,195,236, 61, 48, 78, 81, 62,
-225,191,221,206, 71, 99,  0,  0,  1,111, 19, 62, 57, 13,177, 61, 48, 78, 81, 62,138, 95,174,228,172, 80,  0,  0,110,176, 28,189,
- 57, 13,177, 61, 48, 78, 81, 62,118,160,174,228,172, 80,  0,  0,138,211, 41, 62, 77,106,205, 59, 48, 78, 81, 62, 84, 54,203, 71,
-250, 90,  0,  0,143, 66,118,189, 77,106,205, 59, 48, 78, 81, 62,172,201,203, 71,250, 90,  0,  0,184, 69,105, 62,161,220, 67,188,
-128, 96, 66, 62, 14, 19,134, 78, 67, 99,  0,  0,163,  5,250,189,161,220, 67,188,128, 96, 66, 62,242,236,134, 78, 67, 99,  0,  0,
-174, 41,137, 62,149,249, 43, 59, 59, 46, 55, 62, 93,245, 83, 69, 17,107,  0,  0,118, 16, 38,190,149,249, 43, 59, 59, 46, 55, 62,
-163, 10, 83, 69, 17,107,  0,  0,129,176,157, 62,222,227, 61, 61,139, 64, 40, 62, 97,223,176, 28,101,120,  0,  0, 28, 30, 79,190,
-222,227, 61, 61,139, 64, 40, 62,159, 32,176, 28,101,120,  0,  0, 55,142,159, 62,137, 31,162, 61,139, 64, 40, 62,148,210,138,239,
-134,118,  0,  0,136,217, 82,190,137, 31,162, 61,139, 64, 40, 62,108, 45,138,239,134,118,  0,  0, 21,245,153, 62,114, 95,214, 61,
-247,251, 43, 62, 33,231, 38,177,180, 97,  0,  0, 67,167, 71,190,114, 95,214, 61,247,251, 43, 62,223, 24, 38,177,180, 97,  0,  0,
-212,238,123, 62,173, 79,  5, 62,196,146, 77, 62, 18,238,118,158,234, 80,  2,  0,238,171, 15,190,173, 79,  5, 62,196,146, 77, 62,
-238, 17,118,158,234, 80,  2,  0,166,124, 60, 62, 25, 11,  9, 62,156,  9, 85, 62, 52, 39, 21,212,166,113,  2,  0,129,115,160,189,
- 25, 11,  9, 62,156,  9, 85, 62,204,216, 21,212,166,113,  2,  0,155,156, 86, 62,133,198, 12, 62,196,146, 77, 62, 69,  0,155,192,
- 49,111,  0,  0,106,179,212,189,133,198, 12, 62,196,146, 77, 62,187,255,155,192, 49,111,  0,  0,109, 42, 23, 62,216,126,230, 60,
-196,146, 77, 62,255, 87, 17, 38,203, 84,  0,  0, 31,158, 43,189,216,126,230, 60,196,146, 77, 62,  1,168, 17, 38,203, 84,  0,  0,
-  1,111, 19, 62, 63,191, 91, 61,196,146, 77, 62, 16,103,234,  1,224, 75,  0,  0,110,176, 28,189, 63,191, 91, 61,196,146, 77, 62,
-240,152,234,  1,224, 75,  0,  0,185,194,212, 61,122,230, 38, 62, 42,101, 10, 62,106,191, 91,110,188,  5,  0,  0,191,196,240, 58,
-122,230, 38, 62, 42,101, 10, 62,150, 64, 91,110,188,  5,  0,  0,  1,111, 19, 62,186,247,131, 62,150, 32, 14, 62,242,194, 70, 65,
- 98,164,  2,  0,110,176, 28,189,186,247,131, 62,150, 32, 14, 62, 14, 61, 70, 65, 98,164,  2,  0,155,156, 86, 62,220,144,137, 62,
- 82,238,  2, 62,171, 14,231, 83,118,160,  2,  0,106,179,212,189,220,144,137, 62, 82,238,  2, 62, 85,241,231, 83,118,160,  2,  0,
-208,194,142, 62,139,175, 83, 62,107,138,224, 61,121, 39,247,116, 47,222,  0,  0,187, 66, 49,190,139,175, 83, 62,107,138,224, 61,
-135,216,247,116, 47,222,  0,  0,152,105,189, 62, 14, 43, 35, 62,170,211,164, 61,252, 44, 81,116, 54,227,  0,  0, 37, 72,135,190,
- 14, 43, 35, 62,170,211,164, 61,  4,211, 81,116, 54,227,  0,  0, 66,103,217, 62,133,198, 12, 62, 73,248,134, 61,158, 94,220, 76,
-251,216,  0,  0,207, 69,163,190,133,198, 12, 62, 73,248,134, 61, 98,161,220, 76,251,216,  0,  0, 32,206,211, 62,119,163,200, 60,
-252,115,211, 60, 59,120,187,216, 97,236,  0,  0,173,172,157,190,119,163,200, 60,252,115,211, 60,197,135,187,216, 97,236,  0,  0,
-123,192,170, 62,188, 45, 85,189,112, 94, 52, 61,213, 73, 49,152,144,243,  0,  0, 16, 62,105,190,188, 45, 85,189,112, 94, 52, 61,
- 43,182, 49,152,144,243,  0,  0,140,144,131, 62,  0, 41,196,189, 33,111,142, 61, 61, 56,195,141,255,242,  0,  0, 50,222, 26,190,
-  0, 41,196,189, 33,111,142, 61,195,199,195,141,255,242,  0,  0,203,133, 88, 61, 16,243,187, 62, 89,242,105,188,  0,  0,207,105,
-  5, 72,  2,  0,203,133, 88, 61,226,121,208, 62,254,  7, 62,190,  0,  0,246,127,248,  2,  2,  0,203,133, 88, 61,254,152, 18,190,
- 11,214,236,190,  0,  0,213,166, 46,164,  3,  0,203,133, 88, 61,173,190,136,190,139,142,124,189,  0,  0,195,129,226,234,  0,  0,
-203,133, 88, 61,205,243,  1,191, 73,248,134, 61,  0,  0, 26,147,190,188,  2,  0,203,133, 88, 61,247,217,218,190,241, 12, 56, 60,
-  0,  0,226,217,208,133,  2,  0,203,133, 88, 61,161,222,162,190,147, 21,157, 57,  0,  0, 83,215,164,134,  0,  0,203,133, 88, 61,
-207, 87,142,190,141,212,146,188,  0,  0,243,152, 22,180,  0,  0, 61,119,230, 62,239,172,106, 61,161, 43,253,189,243,124, 39,230,
- 19, 10,  0,  0,202, 85,176,190,239,172,106, 61,161, 43,253,189, 13,131, 39,230, 19, 10,  0,  0,243, 84,232, 62,194,113,199, 61,
- 78, 26, 47,190,220,127, 45,250,202,  0,  0,  0,128, 51,178,190,194,113,199, 61, 78, 26, 47,190, 36,128, 45,250,202,  0,  0,  0,
- 32,206,211, 62,216, 49,147, 61,181,218,180,190, 32, 80,174,252, 62,156,  1,  0,173,172,157,190,216, 49,147, 61,181,218,180,190,
-224,175,174,252, 62,156,  1,  0,174, 41,137, 62, 54,180, 27, 62,226, 76,244,190,  9, 58, 51, 25,189,144,  3,  0,118, 16, 38,190,
- 54,180, 27, 62,226, 76,244,190,247,197, 51, 25,189,144,  3,  0,146,121,202, 62,239, 95,151,189,240, 61,238,189,139, 91, 11,167,
-108,  9,  2,  0, 31, 88,148,190,239, 95,151,189,240, 61,238,189,117,164, 11,167,108,  9,  2,  0,197,226,168, 62, 97,  4,226,189,
-163, 21,103,190, 32, 35, 32,133,239,248,  0,  0,164,130,101,190, 97,  4,226,189,163, 21,103,190,224,220, 32,133,239,248,  0,  0,
-  9, 21,180, 62,109, 27,100,189,255,252,178,190,117, 51, 16,177, 97,169,  1,  0, 45,231,123,190,109, 27,100,189,255,252,178,190,
-139,204, 16,177, 97,169,  1,  0,155,156, 86, 62,211, 91,217,188, 85,248,234,190, 58, 54,135,214,188,147,  2,  0,106,179,212,189,
-211, 91,217,188, 85,248,234,190,198,201,135,214,188,147,  2,  0, 30, 24, 38, 62,112, 61, 93,190,191,112, 37, 61,229,122,202,255,
- 60,220,  0,  0,224, 84,103,189,112, 61, 93,190,191,112, 37, 61, 27,133,202,255, 60,220,  0,  0, 41,248, 11, 62,209, 24,123,190,
-176,102,236,188,236, 92,238,180, 10,210,  0,  0, 27,170,253,188,209, 24,123,190,176,102,236,188, 20,163,238,180, 10,210,  0,  0,
- 19, 56, 64, 62,110,117,196,190, 92, 79,241, 60,138, 77,170,  2, 52,154,  2,  0, 89,234,167,189,110,117,196,190, 92, 79,241, 60,
-118,178,170,  2, 52,154,  2,  0,246,142, 45, 62, 59, 19,146,190, 95,149,  7, 61,103, 99,206,254, 97,175,  0,  0, 32,152,130,189,
- 59, 19,146,190, 95,149,  7, 61,153,156,206,254, 97,175,  0,  0, 47,225, 82, 62,234,249,244,190, 15,131, 22, 61,129, 71, 28,196,
- 90,168,  2,  0,146, 60,205,189,234,249,244,190, 15,131, 22, 61,127,184, 28,196, 90,168,  2,  0, 25,158,242, 61,178,167,207,190,
-155,152,181, 60,141, 16, 26,233, 42,131,  0,  0,110,194, 80,188,178,167,207,190,155,152,181, 60,115,239, 26,233, 42,131,  0,  0,
-105,176,227, 61,201,103,155,190, 58,189,151, 60, 50, 43,143,223,247,139,  0,  0,214,169,178,187,201,103,155,190, 58,189,151, 60,
-206,212,143,223,247,139,  0,  0, 81,129,  4, 62,195,112,252,190,129, 39, 97, 61,181, 12,181,157,  3,175,  0,  0, 89,243,193,188,
-195,112,252,190,129, 39, 97, 61, 75,243,181,157,  3,175,  0,  0, 70,161, 30, 62,163,166, 59,190,208, 57, 82, 61,142,124,137,226,
-  5,  0,  0,  0,127,121, 73,189,163,166, 59,190,208, 57, 82, 61,114,131,137,226,  5,  0,  0,  0,218,229, 26, 62,174,134, 33,190,
- 33,111,142, 61, 18,122,107,230,193, 28,  0,  0,207,139, 58,189,174,134, 33,190, 33,111,142, 61,238,133,107,230,193, 28,  0,  0,
-109, 42, 23, 62,186,102,  7,190,130, 74,172, 61, 49,104, 11,185, 42, 22,  0,  0, 31,158, 43,189,186,102,  7,190,130, 74,172, 61,
-207,151, 11,185, 42, 22,  0,  0,218,229, 26, 62,140,230,111,190,206,171,148,189, 91, 75,146,152,161,253,  0,  0,207,139, 58,189,
-140,230,111,190,206,171,148,189,165,180,146,152,161,253,  0,  0,127,243, 67, 62, 83,148, 74,190, 16,205,139,190,187, 66, 88,150,
- 83,228,  2,  0, 49, 97,175,189, 83,148, 74,190, 16,205,139,190, 69,189, 88,150, 83,228,  2,  0,  7, 88, 90, 62,235,104,248,189,
-244, 28,205,190,113, 66, 21,172,210,185,  3,  0, 66, 42,220,189,235,104,248,189,244, 28,205,190,143,189, 21,172,210,185,  3,  0,
-248, 75,135, 62, 55,124,180, 62,187,202,167,190,129, 54,206,102,175,202,  2,  0, 10, 85, 34,190, 55,124,180, 62,187,202,167,190,
-127,201,206,102,175,202,  2,  0,248, 75,135, 62,232,105,195, 62,146, 76, 58,190,186, 53, 22,116,118,  4,  2,  0, 10, 85, 34,190,
-232,105,195, 62,146, 76, 58,190, 70,202, 22,116,118,  4,  2,  0,248, 75,135, 62,203,192,176, 62,105,252, 34,189,  3, 59,236, 93,
-221, 63,  2,  0, 10, 85, 34,190,203,192,176, 62,105,252, 34,189,253,196,236, 93,221, 63,  2,  0,174, 41,137, 62,219,193, 68, 62,
-208, 57, 82, 61, 32, 50,252,105, 90, 51,  0,  0,118, 16, 38,190,219,193, 68, 62,208, 57, 82, 61,224,205,252,105, 90, 51,  0,  0,
-220,155,200, 62,133,198, 12, 62, 95,172,248, 59,242, 97,236, 79,  9, 20,  0,  0,105,122,146,190,133,198, 12, 62, 95,172,248, 59,
- 14,158,236, 79,  9, 20,  0,  0, 83, 55,178, 62, 14, 43, 35, 62,141,212,146,188,108, 60,141, 99, 28, 53,  0,  0,193, 43,120,190,
- 14, 43, 35, 62,141,212,146,188,148,195,141, 99, 28, 53,  0,  0,  9, 21,180, 62, 72, 76,141, 62,161, 43,253,189, 96, 83, 57, 87,
-177, 42,  0,  0, 45,231,123,190, 72, 76,141, 62,161, 43,253,189,160,172, 57, 87,177, 42,  0,  0, 66,103,217, 62,247,106, 87, 62,
-  7,254,185,189,174, 95, 44, 68,204, 50,  2,  0,207, 69,163,190,247,106, 87, 62,  7,254,185,189, 82,160, 44, 68,204, 50,  2,  0,
- 66,103,217, 62,236,138,113, 62, 26,177, 80,190,105,109, 79, 66, 37,252,  2,  0,207, 69,163,190,236,138,113, 62, 26,177, 80,190,
-151,146, 79, 66, 37,252,  2,  0,  9, 21,180, 62,141,126,152, 62, 83,  3,118,190,226, 86,170, 93, 43,248,  0,  0, 45,231,123,190,
-141,126,152, 62, 83,  3,118,190, 30,169,170, 93, 43,248,  0,  0,  9, 21,180, 62, 38,179,135, 62,107,184,182,190,111, 82,219, 68,
-100,186,  2,  0, 45,231,123,190, 38,179,135, 62,107,184,182,190,145,173,219, 68,100,186,  2,  0, 66,103,217, 62,179, 56, 76, 62,
-153, 49,162,190,218,111, 76, 39,195,207,  2,  0,207, 69,163,190,179, 56, 76, 62,153, 49,162,190, 38,144, 76, 39,195,207,  2,  0,
-231,123,174, 62,154,232,206, 61, 56, 79,216,190,  2, 75,  5,254, 79,152,  3,  0,232,180,112,190,154,232,206, 61, 56, 79,216,190,
-254,180,  5,254, 79,152,  3,  0,208,194,142, 62,171,100, 40,189,170,250,206,190,171, 69,136,192,101,169,  1,  0,187, 66, 49,190,
-171,100, 40,189,170,250,206,190, 85,186,136,192,101,169,  0,  0,100,  0,223, 62,154,232,206, 61,191,190,121,190,190,114,245, 38,
- 55, 41,  0,  0,241,222,168,190,154,232,206, 61,191,190,121,190, 66,141,245, 38, 55, 41,  0,  0,104, 51,120, 62,186,102,  7,190,
-127,153,163,189, 89, 73, 32,153,123, 20,  0,  0,130,240, 11,190,186,102,  7,190,127,153,163,189,167,182, 32,153,123, 20,  0,  0,
-214,178,129, 62,254,152, 18,190, 44,122,125,190, 90, 74,132,153, 69,237,  0,  0,198, 34, 23,190,254,152, 18,190, 44,122,125,190,
-166,181,132,153, 69,237,  0,  0,202,203,239, 62,133,198, 12, 62, 56, 86,132,190, 43,219,144, 94,  0, 78,  2,  0, 88,170,185,190,
-133,198, 12, 62, 56, 86,132,190,213, 36,144, 94,  0, 78,  2,  0, 32,206,211, 62, 18,242,240,189,135,108, 84,190, 98,250, 11,173,
- 79, 97,  2,  0,173,172,157,190, 18,242,240,189,135,108, 84,190,158,  5, 11,173, 79, 97,  2,  0, 38,160,  9, 63,217,159,203,189,
-192,186,154,190,102, 60, 54,156,176, 52,  0,  0,219, 30,221,190,217,159,203,189,192,186,154,190,154,195, 54,156,177, 52,  0,  0,
-172,140, 38, 63,211, 91,217,188,255,252,178,190, 40, 86,  6,192,194, 69,  0,  0,244,123, 11,191,211, 91,217,188,255,252,178,190,
-216,169,  6,192,194, 69,  0,  0, 95,242, 46, 63,194,113,199, 61, 73, 31,177,190, 16,101,233, 22, 32, 75,  2,  0,167,225, 19,191,
-194,113,199, 61, 73, 31,177,190,240,154,233, 22, 32, 75,  2,  0,138,243, 32, 63,  3, 75, 61, 62, 73, 31,177,190, 32, 46, 37,110,
- 20, 46,  0,  0,209,226,  5,191,  3, 75, 61, 62, 73, 31,177,190,224,209, 37,110, 20, 46,  0,  0,112,194,  7, 63, 82, 93, 46, 62,
- 84,255,150,190, 21,  2,210,111, 62, 62,  0,  0,111, 99,217,190, 82, 93, 46, 62, 84,255,150,190,235,253,210,111, 62, 62,  0,  0,
-149,211,  6, 63,241,129, 16, 62, 50,102,145,190, 97, 69, 95,247, 54,107,  0,  0,185,133,215,190,241,129, 16, 62, 50,102,145,190,
-159,186, 95,247, 54,107,  0,  0,104, 90, 27, 63, 54,180, 27, 62,113,168,169,190,159, 40, 26,244,203,120,  0,  0,175, 73,  0,191,
- 54,180, 27, 62,113,168,169,190, 97,215, 26,244,203,120,  0,  0,246,174, 36, 63, 97,150,169, 61,221, 99,173,190,162,240,132,244,
-140,126,  0,  0, 62,158,  9,191, 97,150,169, 61,221, 99,173,190, 94, 15,132,244,140,126,  0,  0,249, 38, 30, 63, 98,147,127,188,
-221, 99,173,190,238,252, 16, 35, 15,123,  0,  0, 64, 22,  3,191, 98,147,127,188,221, 99,173,190, 18,  3, 16, 35, 15,123,  0,  0,
- 75,177,  8, 63, 23,233,143,189,158, 33,149,190,255, 62, 10, 35,196,105,  0,  0, 37, 65,219,190, 23,233,143,189,158, 33,149,190,
-  1,193, 10, 35,196,105,  0,  0, 26,222,224, 62,120,196,173,189,243, 39, 88,190,176, 43, 36, 45,132,111,  2,  0,167,188,170,190,
-120,196,173,189,243, 39, 88,190, 80,212, 36, 45,132,111,  2,  0,162, 66,247, 62,250,195,236, 61,204,154,128,190,191, 58,236,247,
-109,113,  2,  0, 48, 33,193,190,250,195,236, 61,204,154,128,190, 65,197,236,247,109,113,  2,  0,196,219,252, 62, 17,132,184, 61,
- 50,102,145,190,  9, 88, 45,185, 34, 60,  0,  0, 82,186,198,190, 17,132,184, 61, 50,102,145,190,247,167, 45,185, 34, 60,  0,  0,
- 21,238,237, 62,103,251,128,189, 44,122,125,190,210, 29,124,112, 75, 53,  0,  0,162,204,183,190,103,251,128,189, 44,122,125,190,
- 46,226,124,112, 75, 53,  0,  0, 38,160,  9, 63,188, 45, 85,189, 79, 15,164,190,175,234, 24,122,245, 31,  0,  0,219, 30,221,190,
-188, 45, 85,189, 79, 15,164,190, 81, 21, 24,122,245, 31,  0,  0,104, 90, 27, 63,223, 37,  8,188,107,184,182,190,141,158,211, 82,
- 28,  5,  0,  0,175, 73,  0,191,223, 37,  8,188,107,184,182,190,115, 97,211, 82, 28,  5,  0,  0,138,243, 32, 63, 40, 68,132, 61,
-107,184,182,190,111,130, 12,244,188, 21,  0,  0,209,226,  5,191, 40, 68,132, 61,107,184,182,190,145,125, 12,244,188, 21,  0,  0,
-178,124, 25, 63,250,195,236, 61,181,218,180,190,245,237, 22,157, 52, 79,  0,  0,242,215,252,190,250,195,236, 61,181,218,180,190,
- 11, 18, 22,157, 52, 79,  0,  0,112,194,  7, 63, 74,214,221, 61,153, 49,162,190,132, 71,190,171,144, 64,  0,  0,111, 99,217,190,
- 74,214,221, 61,153, 49,162,190,124,184,190,171,144, 64,  0,  0,135,153,228, 62, 97,150,169, 61, 44,122,125,190, 16, 95,148,222,
-236, 78,  0,  0, 20,120,174,190, 97,150,169, 61, 44,122,125,190,240,160,148,222,236, 78,  0,  0,209,187,226, 62,216,126,230, 60,
-198,170,141,190,194, 95,198,181, 68, 41,  0,  0, 93,154,172,190,216,126,230, 60,198,170,141,190, 62,160,198,181, 68, 41,  0,  0,
-180, 18,208, 62,223, 37,  8,188,198,170,141,190,238,109,193,  4, 98, 65,  0,  0, 65,241,153,190,223, 37,  8,188,198,170,141,190,
- 18,146,193,  4, 98, 65,  0,  0,100,  0,223, 62,161,220, 67,188,198,170,141,190, 91, 73,245, 92,148, 48,  2,  0,241,222,168,190,
-161,220, 67,188,198,170,141,190,165,182,245, 92,148, 48,  2,  0,135,153,228, 62, 92, 82, 55,189,198,170,141,190, 27,113,  2,248,
- 97, 59,  2,  0, 20,120,174,190, 92, 82, 55,189,198,170,141,190,229,142,  2,248, 97, 59,  2,  0,174, 34,221, 62, 29,  9,115,189,
-198,170,141,190,241, 75,125, 72, 55, 73,  0,  0, 59,  1,167,190, 29,  9,115,189,198,170,141,190, 15,180,125, 72, 55, 73,  0,  0,
-220,155,200, 62,188, 45, 85,189,146, 76, 58,190, 69,110,138,193, 22,238,  0,  0,105,122,146,190,188, 45, 85,189,146, 76, 58,190,
-187,145,138,193, 22,238,  0,  0, 38,190,198, 62,103,251,128,189, 15,209,106,190, 93, 95,240, 10,170, 84,  0,  0,179,156,144,190,
-103,251,128,189, 15,209,106,190,163,160,240, 10,170, 84,  0,  0, 38,190,198, 62, 74,137, 10,189,231, 71,114,190,226,117,157,233,
-140, 44,  0,  0,179,156,144,190, 74,137, 10,189,231, 71,114,190, 30,138,157,233,140, 44,  0,  0, 66,103,217, 62, 45,246, 46, 61,
- 44,122,125,190,156,111,186,201, 79, 31,  0,  0,207, 69,163,190, 45,246, 46, 61, 44,122,125,190,100,144,186,201, 79, 31,  0,  0,
-202,203,239, 62,159,154,121, 61, 16,205,139,190, 32, 89,187,186, 87, 60,  0,  0, 88,170,185,190,159,154,121, 61, 16,205,139,190,
-224,166,187,186, 87, 60,  0,  0,202,203,239, 62,239,172,106, 61, 10,221,152,190, 91, 85, 90,200,118, 77,  0,  0, 88,170,185,190,
-239,172,106, 61, 10,221,152,190,165,170, 90,200,118, 77,  0,  0,174, 34,221, 62, 29,  9,115,189, 10,221,152,190,123, 84,188, 44,
- 29, 85,  0,  0, 59,  1,167,190, 29,  9,115,189, 10,221,152,190,133,171,188, 44, 29, 85,  0,  0, 61,119,230, 62, 92, 82, 55,189,
- 10,221,152,190,219, 47, 50, 47,237,108,  0,  0,202, 85,176,190, 92, 82, 55,189, 10,221,152,190, 37,208, 50, 47,237,108,  0,  0,
- 26,222,224, 62, 98,147,127,188, 10,221,152,190,236, 56,223, 47, 42,104,  0,  0,167,188,170,190, 98,147,127,188, 10,221,152,190,
- 20,199,223, 47, 42,104,  0,  0,106,240,209, 62,223, 37,  8,188, 10,221,152,190, 79,100, 44, 32,179, 72,  0,  0,247,206,155,190,
-223, 37,  8,188, 10,221,152,190,177,155, 44, 32,179, 72,  0,  0,135,153,228, 62,216,126,230, 60, 10,221,152,190, 35, 73,126,201,
-202, 89,  0,  0, 20,120,174,190,216,126,230, 60, 10,221,152,190,221,182,126,201,202, 89,  0,  0, 38,160,  9, 63,154,232,206, 61,
-147, 65,175,190,  1, 62,211,212, 80,103,  0,  0,219, 30,221,190,154,232,206, 61,147, 65,175,190,255,193,211,212, 80,103,  0,  0,
-104, 90, 27, 63, 74,214,221, 61,249, 12,192,190, 51,224,110,181, 12, 99,  0,  0,175, 73,  0,191, 74,214,221, 61,249, 12,192,190,
-205, 31,110,181, 12, 99,  0,  0, 27,192, 35, 63,159,154,121, 61,175,234,193,190,220,160,139,243,182, 84,  0,  0, 98,175,  8,191,
-159,154,121, 61,175,234,193,190, 36, 95,139,243,182, 84,  0,  0,249, 38, 30, 63,161,220, 67,188,249, 12,192,190,253,186,174, 57,
- 16, 91,  0,  0, 64, 22,  3,191,161,220, 67,188,249, 12,192,190,  3, 69,174, 57, 16, 91,  0,  0,  1,143, 10, 63,188, 45, 85,189,
- 73, 31,177,190, 44, 11,185, 94, 90, 85,  0,  0,145,252,222,190,188, 45, 85,189, 73, 31,177,190,212,244,185, 94, 90, 85,  0,  0,
- 21,238,237, 62, 29,  9,115,189, 16,205,139,190,131,249,213,121,178, 38,  0,  0,162,204,183,190, 29,  9,115,189, 16,205,139,190,
-125,  6,213,121,178, 38,  0,  0,122,185,254, 62, 97,150,169, 61, 45,118,158,190, 97, 81,161,203,196, 83,  0,  0,  8,152,200,190,
- 97,150,169, 61, 45,118,158,190,159,174,161,203,196, 83,  0,  0,202,203,239, 62,226,194,133,186,192,186,154,190, 99, 25,168,  0,
-115,125,  0,  0, 88,170,185,190,226,194,133,186,192,186,154,190,157,230,168,  0,115,125,  0,  0, 14,254,250, 62,115,128,187,188,
-119,152,156,190, 86, 49,224, 14, 41,117,  0,  0,156,220,196,190,115,128,187,188,119,152,156,190,170,206,224, 14, 41,117,  0,  0,
-223,245,  4, 63, 77,106,205, 59, 79, 15,164,190, 60, 55,195,251, 98,115,  0,  0, 76,202,211,190, 77,106,205, 59, 79, 15,164,190,
-196,200,195,251, 98,115,  0,  0,152, 75,  0, 63,216,126,230, 60,227, 83,160,190,255, 41,  6,  0,232,120,  0,  0,190,117,202,190,
-216,126,230, 60,227, 83,160,190,  1,214,  6,  0,232,120,  0,  0,149,211,  6, 63,239,172,106, 61,  5,237,165,190,174, 40,253, 11,
-196,120,  0,  0,185,133,215,190,239,172,106, 61,  5,237,165,190, 82,215,253, 11,196,120,  0,  0,220,125, 11, 63,205, 26, 17, 61,
-187,202,167,190, 32, 44, 47,246,191,119,  0,  0, 71,218,224,190,205, 26, 17, 61,187,202,167,190,224,211, 47,246,191,119,  0,  0,
-218,  5, 18, 63,222,227, 61, 61,113,168,169,190,222, 55, 67,254, 37,115,  2,  0, 65,234,237,190,222,227, 61, 61,113,168,169,190,
- 34,200, 67,254, 37,115,  2,  0, 73, 57, 15, 63,176,168,154, 61,113,168,169,190,188, 45, 37, 38, 75,113,  2,  0, 31, 81,232,190,
-176,168,154, 61,113,168,169,190, 68,210, 37, 38, 75,113,  2,  0,112,194,  7, 63, 54,180, 27, 62,249, 12,192,190,139,202,127, 71,
- 71,164,  3,  0,111, 99,217,190, 54,180, 27, 62,249, 12,192,190,117, 53,127, 71, 71,164,  3,  0, 64,209, 34, 63,230,161, 42, 62,
-170,250,206,190,  2, 39,153, 79,172,163,  3,  0,135,192,  7,191,230,161, 42, 62,170,250,206,190,254,216,153, 79,172,163,  3,  0,
- 21,208, 48, 63, 57, 13,177, 61,102,200,195,190, 49,118,245, 10, 30,208,  3,  0, 93,191, 21,191, 57, 13,177, 61,102,200,195,190,
-207,137,245, 10, 30,208,  3,  0, 24, 72, 42, 63,211, 91,217,188, 62, 63,203,190,182, 78, 54,193,251,176,  3,  0, 96, 55, 15,191,
-211, 91,217,188, 62, 63,203,190, 74,177, 54,193,251,176,  3,  0, 38,160,  9, 63, 40,178,188,189,175,234,193,190,165,250,140,166,
-156,164,  3,  0,219, 30,221,190, 40,178,188,189,175,234,193,190, 91,  5,140,166,156,164,  3,  0,140,137,215, 62, 97,  4,226,189,
-192,186,154,190,203,245,207,147, 96,188,  1,  0, 25,104,161,190, 97,  4,226,189,192,186,154,190, 53, 10,207,147, 96,188,  1,  0,
-243, 84,232, 62, 65,148,  1, 62,187,202,167,190,  3,172, 39, 73,240,192,  1,  0,128, 51,178,190, 65,148,  1, 62,187,202,167,190,
-253, 83, 39, 73,240,192,  1,  0, 68, 65, 84, 65,104,  1,  0,  0,104,148, 52,  3,  0,  0,  0,  0, 84,  1,  0,  0,  5,  0,  0,  0,
-  3,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 24,150, 52,  3,  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,  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,  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,  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,  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,  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, 68, 65, 84, 65, 28, 47,  0,  0, 24,150, 52,  3,  0,  0,  0,  0, 49,  0,  0,  0,237,  3,  0,  0,
-  0,  0,  0,  0, 45,  0,  0,  0,  0,  0, 34,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0, 34,  0,  2,  0,  0,  0, 43,  0,  0,  0,
-  0,  0, 34,  0, 43,  0,  0,  0, 45,  0,  0,  0,  0,  0, 34,  0,  1,  0,  0,  0,  3,  0,  0,  0,  0,  0, 34,  0,  1,  0,  0,  0,
- 46,  0,  0,  0,  0,  0, 34,  0, 44,  0,  0,  0, 46,  0,  0,  0,  0,  0, 34,  0,  3,  0,  0,  0, 44,  0,  0,  0,  0,  0, 34,  0,
-  2,  0,  0,  0,  4,  0,  0,  0,  0,  0, 34,  0,  4,  0,  0,  0, 41,  0,  0,  0,  0,  0, 34,  0, 41,  0,  0,  0, 43,  0,  0,  0,
-  0,  0, 34,  0,  3,  0,  0,  0,  5,  0,  0,  0,  0,  0, 34,  0, 42,  0,  0,  0, 44,  0,  0,  0,  0,  0, 34,  0,  5,  0,  0,  0,
- 42,  0,  0,  0,  0,  0, 34,  0,  2,  0,  0,  0,  8,  0,  0,  0,  0,  0, 34,  0,  6,  0,  0,  0,  8,  0,  0,  0,  0,  0, 34,  0,
-  4,  0,  0,  0,  6,  0,  0,  0,  0,  0, 34,  0,  7,  0,  0,  0,  9,  0,  0,  0,  0,  0, 34,  0,  3,  0,  0,  0,  9,  0,  0,  0,
-  0,  0, 34,  0,  5,  0,  0,  0,  7,  0,  0,  0,  0,  0, 34,  0,  0,  0,  0,  0, 10,  0,  0,  0,  0,  0, 34,  0,  8,  0,  0,  0,
- 10,  0,  0,  0,  0,  0, 34,  0,  9,  0,  0,  0, 11,  0,  0,  0,  0,  0, 34,  0,  1,  0,  0,  0, 11,  0,  0,  0,  0,  0, 34,  0,
- 10,  0,  0,  0, 12,  0,  0,  0,  0,  0, 34,  0, 12,  0,  0,  0, 14,  0,  0,  0,  0,  0, 34,  0,  8,  0,  0,  0, 14,  0,  0,  0,
-  0,  0, 34,  0, 11,  0,  0,  0, 13,  0,  0,  0,  0,  0, 34,  0, 14,  0,  0,  0, 15,  0,  0,  0,  0,  0, 34,  0,  6,  0,  0,  0,
- 15,  0,  0,  0,  0,  0, 34,  0,  7,  0,  0,  0, 16,  0,  0,  0,  0,  0, 34,  0, 14,  0,  0,  0, 19,  0,  0,  0,  0,  0, 34,  0,
- 17,  0,  0,  0, 19,  0,  0,  0,  0,  0, 34,  0, 15,  0,  0,  0, 17,  0,  0,  0,  0,  0, 34,  0, 18,  0,  0,  0, 20,  0,  0,  0,
-  0,  0, 34,  0, 16,  0,  0,  0, 18,  0,  0,  0,  0,  0, 34,  0, 12,  0,  0,  0, 21,  0,  0,  0,  0,  0, 34,  0, 19,  0,  0,  0,
- 21,  0,  0,  0,  0,  0, 34,  0, 20,  0,  0,  0, 22,  0,  0,  0,  0,  0, 34,  0, 13,  0,  0,  0, 22,  0,  0,  0,  0,  0, 34,  0,
- 21,  0,  0,  0, 23,  0,  0,  0,  0,  0, 34,  0, 23,  0,  0,  0, 25,  0,  0,  0,  0,  0, 34,  0, 19,  0,  0,  0, 25,  0,  0,  0,
-  0,  0, 34,  0, 24,  0,  0,  0, 26,  0,  0,  0,  0,  0, 34,  0, 22,  0,  0,  0, 24,  0,  0,  0,  0,  0, 34,  0, 20,  0,  0,  0,
- 26,  0,  0,  0,  0,  0, 34,  0, 25,  0,  0,  0, 27,  0,  0,  0,  0,  0, 34,  0, 17,  0,  0,  0, 27,  0,  0,  0,  0,  0, 34,  0,
- 26,  0,  0,  0, 28,  0,  0,  0,  0,  0, 34,  0, 18,  0,  0,  0, 28,  0,  0,  0,  0,  0, 34,  0, 25,  0,  0,  0, 31,  0,  0,  0,
-  0,  0, 34,  0, 29,  0,  0,  0, 31,  0,  0,  0,  0,  0, 34,  0, 27,  0,  0,  0, 29,  0,  0,  0,  0,  0, 34,  0, 30,  0,  0,  0,
- 32,  0,  0,  0,  0,  0, 34,  0, 26,  0,  0,  0, 32,  0,  0,  0,  0,  0, 34,  0, 28,  0,  0,  0, 30,  0,  0,  0,  0,  0, 34,  0,
- 23,  0,  0,  0, 33,  0,  0,  0,  0,  0, 34,  0, 31,  0,  0,  0, 33,  0,  0,  0,  0,  0, 34,  0, 32,  0,  0,  0, 34,  0,  0,  0,
-  0,  0, 34,  0, 24,  0,  0,  0, 34,  0,  0,  0,  0,  0, 34,  0, 33,  0,  0,  0, 35,  0,  0,  0,  0,  0, 34,  0, 35,  0,  0,  0,
- 37,  0,  0,  0,  0,  0, 34,  0, 31,  0,  0,  0, 37,  0,  0,  0,  0,  0, 34,  0, 36,  0,  0,  0, 38,  0,  0,  0,  0,  0, 34,  0,
- 34,  0,  0,  0, 36,  0,  0,  0,  0,  0, 34,  0, 32,  0,  0,  0, 38,  0,  0,  0,  0,  0, 34,  0, 37,  0,  0,  0, 39,  0,  0,  0,
-  0,  0, 34,  0, 29,  0,  0,  0, 39,  0,  0,  0,  0,  0, 34,  0, 38,  0,  0,  0, 40,  0,  0,  0,  0,  0, 34,  0, 30,  0,  0,  0,
- 40,  0,  0,  0,  0,  0, 34,  0, 37,  0,  0,  0, 43,  0,  0,  0,  0,  0, 34,  0, 39,  0,  0,  0, 41,  0,  0,  0,  0,  0, 34,  0,
- 38,  0,  0,  0, 44,  0,  0,  0,  0,  0, 34,  0, 40,  0,  0,  0, 42,  0,  0,  0,  0,  0, 34,  0, 35,  0,  0,  0, 45,  0,  0,  0,
-  0,  0, 34,  0, 36,  0,  0,  0, 46,  0,  0,  0,  0,  0, 34,  0, 35,  0,  0,  0, 49,  0,  0,  0,  0,  0, 34,  0, 47,  0,  0,  0,
- 49,  0,  0,  0,  0,  0, 34,  0, 45,  0,  0,  0, 47,  0,  0,  0,  0,  0, 34,  0, 36,  0,  0,  0, 50,  0,  0,  0,  0,  0, 34,  0,
- 46,  0,  0,  0, 48,  0,  0,  0,  0,  0, 34,  0, 48,  0,  0,  0, 50,  0,  0,  0,  0,  0, 34,  0, 33,  0,  0,  0, 51,  0,  0,  0,
-  0,  0, 34,  0, 49,  0,  0,  0, 51,  0,  0,  0,  0,  0, 34,  0, 34,  0,  0,  0, 52,  0,  0,  0,  0,  0, 34,  0, 50,  0,  0,  0,
- 52,  0,  0,  0,  0,  0, 34,  0, 23,  0,  0,  0, 53,  0,  0,  0,  0,  0, 34,  0, 51,  0,  0,  0, 53,  0,  0,  0,  0,  0, 34,  0,
- 24,  0,  0,  0, 54,  0,  0,  0,  0,  0, 34,  0, 52,  0,  0,  0, 54,  0,  0,  0,  0,  0, 34,  0, 21,  0,  0,  0, 55,  0,  0,  0,
-  0,  0, 34,  0, 53,  0,  0,  0, 55,  0,  0,  0,  0,  0, 34,  0, 22,  0,  0,  0, 56,  0,  0,  0,  0,  0, 34,  0, 54,  0,  0,  0,
- 56,  0,  0,  0,  0,  0, 34,  0, 12,  0,  0,  0, 57,  0,  0,  0,  0,  0, 34,  0, 55,  0,  0,  0, 57,  0,  0,  0,  0,  0, 34,  0,
- 13,  0,  0,  0, 58,  0,  0,  0,  0,  0, 34,  0, 56,  0,  0,  0, 58,  0,  0,  0,  0,  0, 34,  0, 10,  0,  0,  0, 61,  0,  0,  0,
-  0,  0, 34,  0, 57,  0,  0,  0, 61,  0,  0,  0,  0,  0, 34,  0, 11,  0,  0,  0, 62,  0,  0,  0,  0,  0, 34,  0, 58,  0,  0,  0,
- 62,  0,  0,  0,  0,  0, 34,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,  0, 34,  0, 61,  0,  0,  0, 63,  0,  0,  0,  0,  0, 34,  0,
-  1,  0,  0,  0, 64,  0,  0,  0,  0,  0, 34,  0, 62,  0,  0,  0, 64,  0,  0,  0,  0,  0, 34,  0, 47,  0,  0,  0, 63,  0,  0,  0,
-  0,  0, 34,  0, 48,  0,  0,  0, 64,  0,  0,  0,  0,  0, 34,  0, 59,  0,  0,  0, 63,  0,  0,  0,  0,  0, 34,  0, 47,  0,  0,  0,
- 59,  0,  0,  0,  0,  0, 34,  0, 60,  0,  0,  0, 64,  0,  0,  0,  0,  0, 34,  0, 48,  0,  0,  0, 60,  0,  0,  0,  0,  0, 34,  0,
- 59,  0,  0,  0, 61,  0,  0,  0,  0,  0, 34,  0, 60,  0,  0,  0, 62,  0,  0,  0,  0,  0, 34,  0, 57,  0,  0,  0, 59,  0,  0,  0,
-  0,  0, 34,  0, 58,  0,  0,  0, 60,  0,  0,  0,  0,  0, 34,  0, 55,  0,  0,  0, 59,  0,  0,  0,  0,  0, 34,  0, 56,  0,  0,  0,
- 60,  0,  0,  0,  0,  0, 34,  0, 53,  0,  0,  0, 59,  0,  0,  0,  0,  0, 34,  0, 54,  0,  0,  0, 60,  0,  0,  0,  0,  0, 34,  0,
- 51,  0,  0,  0, 59,  0,  0,  0,  0,  0, 34,  0, 52,  0,  0,  0, 60,  0,  0,  0,  0,  0, 34,  0, 49,  0,  0,  0, 59,  0,  0,  0,
-  0,  0, 34,  0, 50,  0,  0,  0, 60,  0,  0,  0,  0,  0, 34,  0, 87,  0,  0,  0,171,  0,  0,  0,  0,  0, 34,  0,171,  0,  0,  0,
-173,  0,  0,  0,  0,  0, 34,  0, 89,  0,  0,  0,173,  0,  0,  0,  0,  0, 34,  0, 87,  0,  0,  0, 89,  0,  0,  0,  0,  0, 34,  0,
-172,  0,  0,  0,173,  0,  0,  0,  0,  0, 34,  0, 88,  0,  0,  0,172,  0,  0,  0,  0,  0, 34,  0, 88,  0,  0,  0, 89,  0,  0,  0,
-  0,  0, 34,  0, 85,  0,  0,  0,169,  0,  0,  0,  0,  0, 34,  0,169,  0,  0,  0,171,  0,  0,  0,  0,  0, 34,  0, 85,  0,  0,  0,
- 87,  0,  0,  0,  0,  0, 34,  0,170,  0,  0,  0,172,  0,  0,  0,  0,  0, 34,  0, 86,  0,  0,  0,170,  0,  0,  0,  0,  0, 34,  0,
- 86,  0,  0,  0, 88,  0,  0,  0,  0,  0, 34,  0, 83,  0,  0,  0,167,  0,  0,  0,  0,  0, 34,  0,167,  0,  0,  0,169,  0,  0,  0,
-  0,  0, 34,  0, 83,  0,  0,  0, 85,  0,  0,  0,  0,  0, 34,  0,168,  0,  0,  0,170,  0,  0,  0,  0,  0, 34,  0, 84,  0,  0,  0,
-168,  0,  0,  0,  0,  0, 34,  0, 84,  0,  0,  0, 86,  0,  0,  0,  0,  0, 34,  0, 81,  0,  0,  0,165,  0,  0,  0,  0,  0, 34,  0,
-165,  0,  0,  0,167,  0,  0,  0,  0,  0, 34,  0, 81,  0,  0,  0, 83,  0,  0,  0,  0,  0, 34,  0,166,  0,  0,  0,168,  0,  0,  0,
-  0,  0, 34,  0, 82,  0,  0,  0,166,  0,  0,  0,  0,  0, 34,  0, 82,  0,  0,  0, 84,  0,  0,  0,  0,  0, 34,  0, 79,  0,  0,  0,
-163,  0,  0,  0,  0,  0, 34,  0,163,  0,  0,  0,165,  0,  0,  0,  0,  0, 34,  0, 79,  0,  0,  0, 81,  0,  0,  0,  0,  0, 34,  0,
-164,  0,  0,  0,166,  0,  0,  0,  0,  0, 34,  0, 80,  0,  0,  0,164,  0,  0,  0,  0,  0, 34,  0, 80,  0,  0,  0, 82,  0,  0,  0,
-  0,  0, 34,  0, 77,  0,  0,  0, 90,  0,  0,  0,  0,  0, 34,  0, 90,  0,  0,  0,143,  0,  0,  0,  0,  0, 34,  0,143,  0,  0,  0,
-161,  0,  0,  0,  0,  0, 34,  0, 77,  0,  0,  0,161,  0,  0,  0,  0,  0, 34,  0, 91,  0,  0,  0,144,  0,  0,  0,  0,  0, 34,  0,
- 78,  0,  0,  0, 91,  0,  0,  0,  0,  0, 34,  0, 78,  0,  0,  0,162,  0,  0,  0,  0,  0, 34,  0,144,  0,  0,  0,162,  0,  0,  0,
-  0,  0, 34,  0, 90,  0,  0,  0, 92,  0,  0,  0,  0,  0, 34,  0, 92,  0,  0,  0,145,  0,  0,  0,  0,  0, 34,  0,143,  0,  0,  0,
-145,  0,  0,  0,  0,  0, 34,  0, 93,  0,  0,  0,146,  0,  0,  0,  0,  0, 34,  0, 91,  0,  0,  0, 93,  0,  0,  0,  0,  0, 34,  0,
-144,  0,  0,  0,146,  0,  0,  0,  0,  0, 34,  0, 92,  0,  0,  0, 94,  0,  0,  0,  0,  0, 34,  0, 94,  0,  0,  0,147,  0,  0,  0,
-  0,  0, 34,  0,145,  0,  0,  0,147,  0,  0,  0,  0,  0, 34,  0, 95,  0,  0,  0,148,  0,  0,  0,  0,  0, 34,  0, 93,  0,  0,  0,
- 95,  0,  0,  0,  0,  0, 34,  0,146,  0,  0,  0,148,  0,  0,  0,  0,  0, 34,  0, 94,  0,  0,  0, 96,  0,  0,  0,  0,  0, 34,  0,
- 96,  0,  0,  0,149,  0,  0,  0,  0,  0, 34,  0,147,  0,  0,  0,149,  0,  0,  0,  0,  0, 34,  0, 97,  0,  0,  0,150,  0,  0,  0,
-  0,  0, 34,  0, 95,  0,  0,  0, 97,  0,  0,  0,  0,  0, 34,  0,148,  0,  0,  0,150,  0,  0,  0,  0,  0, 34,  0, 96,  0,  0,  0,
- 98,  0,  0,  0,  0,  0, 34,  0, 98,  0,  0,  0,151,  0,  0,  0,  0,  0, 34,  0,149,  0,  0,  0,151,  0,  0,  0,  0,  0, 34,  0,
- 99,  0,  0,  0,152,  0,  0,  0,  0,  0, 34,  0, 97,  0,  0,  0, 99,  0,  0,  0,  0,  0, 34,  0,150,  0,  0,  0,152,  0,  0,  0,
-  0,  0, 34,  0, 98,  0,  0,  0,100,  0,  0,  0,  0,  0, 34,  0,100,  0,  0,  0,153,  0,  0,  0,  0,  0, 34,  0,151,  0,  0,  0,
-153,  0,  0,  0,  0,  0, 34,  0,101,  0,  0,  0,154,  0,  0,  0,  0,  0, 34,  0, 99,  0,  0,  0,101,  0,  0,  0,  0,  0, 34,  0,
-152,  0,  0,  0,154,  0,  0,  0,  0,  0, 34,  0,100,  0,  0,  0,102,  0,  0,  0,  0,  0, 34,  0,102,  0,  0,  0,155,  0,  0,  0,
-  0,  0, 34,  0,153,  0,  0,  0,155,  0,  0,  0,  0,  0, 34,  0,103,  0,  0,  0,156,  0,  0,  0,  0,  0, 34,  0,101,  0,  0,  0,
-103,  0,  0,  0,  0,  0, 34,  0,154,  0,  0,  0,156,  0,  0,  0,  0,  0, 34,  0,102,  0,  0,  0,104,  0,  0,  0,  0,  0, 34,  0,
-104,  0,  0,  0,157,  0,  0,  0,  0,  0, 34,  0,155,  0,  0,  0,157,  0,  0,  0,  0,  0, 34,  0,105,  0,  0,  0,158,  0,  0,  0,
-  0,  0, 34,  0,103,  0,  0,  0,105,  0,  0,  0,  0,  0, 34,  0,156,  0,  0,  0,158,  0,  0,  0,  0,  0, 34,  0,104,  0,  0,  0,
-106,  0,  0,  0,  0,  0, 34,  0,106,  0,  0,  0,159,  0,  0,  0,  0,  0, 34,  0,157,  0,  0,  0,159,  0,  0,  0,  0,  0, 34,  0,
-107,  0,  0,  0,160,  0,  0,  0,  0,  0, 34,  0,105,  0,  0,  0,107,  0,  0,  0,  0,  0, 34,  0,158,  0,  0,  0,160,  0,  0,  0,
-  0,  0, 34,  0, 65,  0,  0,  0,106,  0,  0,  0,  0,  0, 34,  0, 65,  0,  0,  0, 66,  0,  0,  0,  0,  0, 34,  0, 66,  0,  0,  0,
-159,  0,  0,  0,  0,  0, 34,  0, 65,  0,  0,  0,107,  0,  0,  0,  0,  0, 34,  0, 66,  0,  0,  0,160,  0,  0,  0,  0,  0, 34,  0,
-108,  0,  0,  0,125,  0,  0,  0,  0,  0, 34,  0,125,  0,  0,  0,157,  0,  0,  0,  0,  0, 34,  0,108,  0,  0,  0,159,  0,  0,  0,
-  0,  0, 34,  0,126,  0,  0,  0,158,  0,  0,  0,  0,  0, 34,  0,109,  0,  0,  0,126,  0,  0,  0,  0,  0, 34,  0,109,  0,  0,  0,
-160,  0,  0,  0,  0,  0, 34,  0,125,  0,  0,  0,176,  0,  0,  0,  0,  0, 34,  0,155,  0,  0,  0,176,  0,  0,  0,  0,  0, 34,  0,
-156,  0,  0,  0,177,  0,  0,  0,  0,  0, 34,  0,126,  0,  0,  0,177,  0,  0,  0,  0,  0, 34,  0,123,  0,  0,  0,153,  0,  0,  0,
-  0,  0, 34,  0,123,  0,  0,  0,176,  0,  0,  0,  0,  0, 34,  0,124,  0,  0,  0,154,  0,  0,  0,  0,  0, 34,  0,124,  0,  0,  0,
-177,  0,  0,  0,  0,  0, 34,  0,121,  0,  0,  0,151,  0,  0,  0,  0,  0, 34,  0,121,  0,  0,  0,123,  0,  0,  0,  0,  0, 34,  0,
-122,  0,  0,  0,152,  0,  0,  0,  0,  0, 34,  0,122,  0,  0,  0,124,  0,  0,  0,  0,  0, 34,  0,119,  0,  0,  0,149,  0,  0,  0,
-  0,  0, 34,  0,119,  0,  0,  0,121,  0,  0,  0,  0,  0, 34,  0,120,  0,  0,  0,150,  0,  0,  0,  0,  0, 34,  0,120,  0,  0,  0,
-122,  0,  0,  0,  0,  0, 34,  0,117,  0,  0,  0,147,  0,  0,  0,  0,  0, 34,  0,117,  0,  0,  0,119,  0,  0,  0,  0,  0, 34,  0,
-118,  0,  0,  0,148,  0,  0,  0,  0,  0, 34,  0,118,  0,  0,  0,120,  0,  0,  0,  0,  0, 34,  0,115,  0,  0,  0,145,  0,  0,  0,
-  0,  0, 34,  0,115,  0,  0,  0,117,  0,  0,  0,  0,  0, 34,  0,116,  0,  0,  0,146,  0,  0,  0,  0,  0, 34,  0,116,  0,  0,  0,
-118,  0,  0,  0,  0,  0, 34,  0,113,  0,  0,  0,143,  0,  0,  0,  0,  0, 34,  0,113,  0,  0,  0,115,  0,  0,  0,  0,  0, 34,  0,
-114,  0,  0,  0,144,  0,  0,  0,  0,  0, 34,  0,114,  0,  0,  0,116,  0,  0,  0,  0,  0, 34,  0,112,  0,  0,  0,162,  0,  0,  0,
-  0,  0, 34,  0,112,  0,  0,  0,114,  0,  0,  0,  0,  0, 34,  0,174,  0,  0,  0,178,  0,  0,  0,  0,  0, 34,  0,161,  0,  0,  0,
-174,  0,  0,  0,  0,  0, 34,  0,174,  0,  0,  0,179,  0,  0,  0,  0,  0, 34,  0,112,  0,  0,  0,179,  0,  0,  0,  0,  0, 34,  0,
-162,  0,  0,  0,174,  0,  0,  0,  0,  0, 34,  0, 66,  0,  0,  0,110,  0,  0,  0,  0,  0, 34,  0,108,  0,  0,  0,110,  0,  0,  0,
-  0,  0, 34,  0,109,  0,  0,  0,111,  0,  0,  0,  0,  0, 34,  0, 66,  0,  0,  0,111,  0,  0,  0,  0,  0, 34,  0, 66,  0,  0,  0,
-175,  0,  0,  0,  0,  0, 34,  0,175,  0,  0,  0,180,  0,  0,  0,  0,  0, 34,  0,110,  0,  0,  0,180,  0,  0,  0,  0,  0, 34,  0,
-111,  0,  0,  0,181,  0,  0,  0,  0,  0, 34,  0,175,  0,  0,  0,181,  0,  0,  0,  0,  0, 34,  0,178,  0,  0,  0,180,  0,  0,  0,
-  0,  0, 34,  0,174,  0,  0,  0,175,  0,  0,  0,  0,  0, 32,  0,179,  0,  0,  0,181,  0,  0,  0,  0,  0, 34,  0,132,  0,  0,  0,
-134,  0,  0,  0,  0,  0, 34,  0,134,  0,  0,  0,173,  0,  0,  0,  0,  0, 34,  0,132,  0,  0,  0,171,  0,  0,  0,  0,  0, 34,  0,
-133,  0,  0,  0,134,  0,  0,  0,  0,  0, 34,  0,133,  0,  0,  0,172,  0,  0,  0,  0,  0, 34,  0,130,  0,  0,  0,132,  0,  0,  0,
-  0,  0, 34,  0,130,  0,  0,  0,169,  0,  0,  0,  0,  0, 34,  0,131,  0,  0,  0,133,  0,  0,  0,  0,  0, 34,  0,131,  0,  0,  0,
-170,  0,  0,  0,  0,  0, 34,  0,128,  0,  0,  0,130,  0,  0,  0,  0,  0, 34,  0,128,  0,  0,  0,167,  0,  0,  0,  0,  0, 34,  0,
-129,  0,  0,  0,131,  0,  0,  0,  0,  0, 34,  0,129,  0,  0,  0,168,  0,  0,  0,  0,  0, 34,  0,163,  0,  0,  0,184,  0,  0,  0,
-  0,  0, 34,  0,182,  0,  0,  0,184,  0,  0,  0,  0,  0, 34,  0,165,  0,  0,  0,182,  0,  0,  0,  0,  0, 34,  0,183,  0,  0,  0,
-185,  0,  0,  0,  0,  0, 34,  0,164,  0,  0,  0,185,  0,  0,  0,  0,  0, 34,  0,166,  0,  0,  0,183,  0,  0,  0,  0,  0, 34,  0,
-128,  0,  0,  0,182,  0,  0,  0,  0,  0, 34,  0,129,  0,  0,  0,183,  0,  0,  0,  0,  0, 34,  0,141,  0,  0,  0,187,  0,  0,  0,
-  0,  0, 34,  0,186,  0,  0,  0,187,  0,  0,  0,  0,  0, 32,  0,184,  0,  0,  0,186,  0,  0,  0,  0,  0, 34,  0,141,  0,  0,  0,
-184,  0,  0,  0,  0,  0, 34,  0,142,  0,  0,  0,187,  0,  0,  0,  0,  0, 34,  0,142,  0,  0,  0,185,  0,  0,  0,  0,  0, 34,  0,
-185,  0,  0,  0,186,  0,  0,  0,  0,  0, 34,  0, 67,  0,  0,  0,186,  0,  0,  0,  0,  0, 32,  0, 67,  0,  0,  0,182,  0,  0,  0,
-  0,  0, 34,  0, 67,  0,  0,  0,183,  0,  0,  0,  0,  0, 34,  0,127,  0,  0,  0,128,  0,  0,  0,  0,  0, 34,  0, 67,  0,  0,  0,
-127,  0,  0,  0,  0,  0, 32,  0,127,  0,  0,  0,129,  0,  0,  0,  0,  0, 34,  0,139,  0,  0,  0,190,  0,  0,  0,  0,  0, 34,  0,
-188,  0,  0,  0,190,  0,  0,  0,  0,  0, 34,  0,141,  0,  0,  0,188,  0,  0,  0,  0,  0, 34,  0,139,  0,  0,  0,141,  0,  0,  0,
-  0,  0, 34,  0,189,  0,  0,  0,191,  0,  0,  0,  0,  0, 34,  0,140,  0,  0,  0,191,  0,  0,  0,  0,  0, 34,  0,140,  0,  0,  0,
-142,  0,  0,  0,  0,  0, 34,  0,142,  0,  0,  0,189,  0,  0,  0,  0,  0, 34,  0,137,  0,  0,  0,192,  0,  0,  0,  0,  0, 34,  0,
-190,  0,  0,  0,192,  0,  0,  0,  0,  0, 34,  0,137,  0,  0,  0,139,  0,  0,  0,  0,  0, 34,  0,191,  0,  0,  0,193,  0,  0,  0,
-  0,  0, 34,  0,138,  0,  0,  0,193,  0,  0,  0,  0,  0, 34,  0,138,  0,  0,  0,140,  0,  0,  0,  0,  0, 34,  0,136,  0,  0,  0,
-194,  0,  0,  0,  0,  0, 34,  0,192,  0,  0,  0,194,  0,  0,  0,  0,  0, 34,  0,136,  0,  0,  0,137,  0,  0,  0,  0,  0, 34,  0,
-193,  0,  0,  0,195,  0,  0,  0,  0,  0, 34,  0,136,  0,  0,  0,195,  0,  0,  0,  0,  0, 34,  0,136,  0,  0,  0,138,  0,  0,  0,
-  0,  0, 34,  0, 69,  0,  0,  0,135,  0,  0,  0,  0,  0, 34,  0, 69,  0,  0,  0,194,  0,  0,  0,  0,  0, 34,  0,135,  0,  0,  0,
-136,  0,  0,  0,  0,  0, 34,  0, 69,  0,  0,  0,195,  0,  0,  0,  0,  0, 34,  0, 68,  0,  0,  0,188,  0,  0,  0,  0,  0, 34,  0,
- 68,  0,  0,  0,187,  0,  0,  0,  0,  0, 34,  0, 68,  0,  0,  0,189,  0,  0,  0,  0,  0, 34,  0,188,  0,  0,  0,203,  0,  0,  0,
-  0,  0, 34,  0,203,  0,  0,  0,205,  0,  0,  0,  0,  0, 34,  0, 68,  0,  0,  0,205,  0,  0,  0,  0,  0, 34,  0,189,  0,  0,  0,
-204,  0,  0,  0,  0,  0, 34,  0,204,  0,  0,  0,205,  0,  0,  0,  0,  0, 34,  0, 69,  0,  0,  0,196,  0,  0,  0,  0,  0, 34,  0,
-196,  0,  0,  0,197,  0,  0,  0,  0,  0, 34,  0,194,  0,  0,  0,197,  0,  0,  0,  0,  0, 34,  0,196,  0,  0,  0,198,  0,  0,  0,
-  0,  0, 34,  0,195,  0,  0,  0,198,  0,  0,  0,  0,  0, 34,  0,197,  0,  0,  0,199,  0,  0,  0,  0,  0, 34,  0,192,  0,  0,  0,
-199,  0,  0,  0,  0,  0, 34,  0,198,  0,  0,  0,200,  0,  0,  0,  0,  0, 34,  0,193,  0,  0,  0,200,  0,  0,  0,  0,  0, 34,  0,
-199,  0,  0,  0,201,  0,  0,  0,  0,  0, 34,  0,190,  0,  0,  0,201,  0,  0,  0,  0,  0, 34,  0,200,  0,  0,  0,202,  0,  0,  0,
-  0,  0, 34,  0,191,  0,  0,  0,202,  0,  0,  0,  0,  0, 34,  0,201,  0,  0,  0,203,  0,  0,  0,  0,  0, 34,  0,202,  0,  0,  0,
-204,  0,  0,  0,  0,  0, 34,  0,196,  0,  0,  0,201,  0,  0,  0,  0,  0, 34,  0,196,  0,  0,  0,202,  0,  0,  0,  0,  0, 34,  0,
-196,  0,  0,  0,205,  0,  0,  0,  0,  0, 34,  0,137,  0,  0,  0,161,  0,  0,  0,  0,  0, 34,  0,136,  0,  0,  0,174,  0,  0,  0,
-  0,  0, 34,  0,138,  0,  0,  0,162,  0,  0,  0,  0,  0, 34,  0,139,  0,  0,  0,208,  0,  0,  0,  0,  0, 34,  0,161,  0,  0,  0,
-208,  0,  0,  0,  0,  0, 34,  0,140,  0,  0,  0,209,  0,  0,  0,  0,  0, 34,  0,162,  0,  0,  0,209,  0,  0,  0,  0,  0, 34,  0,
-141,  0,  0,  0,210,  0,  0,  0,  0,  0, 34,  0,208,  0,  0,  0,210,  0,  0,  0,  0,  0, 34,  0,142,  0,  0,  0,211,  0,  0,  0,
-  0,  0, 34,  0,209,  0,  0,  0,211,  0,  0,  0,  0,  0, 34,  0,163,  0,  0,  0,210,  0,  0,  0,  0,  0, 34,  0,164,  0,  0,  0,
-211,  0,  0,  0,  0,  0, 34,  0, 79,  0,  0,  0,206,  0,  0,  0,  0,  0, 34,  0,206,  0,  0,  0,210,  0,  0,  0,  0,  0, 34,  0,
-207,  0,  0,  0,211,  0,  0,  0,  0,  0, 34,  0, 80,  0,  0,  0,207,  0,  0,  0,  0,  0, 34,  0,206,  0,  0,  0,212,  0,  0,  0,
-  0,  0, 34,  0,208,  0,  0,  0,212,  0,  0,  0,  0,  0, 34,  0,209,  0,  0,  0,213,  0,  0,  0,  0,  0, 34,  0,207,  0,  0,  0,
-213,  0,  0,  0,  0,  0, 34,  0, 77,  0,  0,  0,212,  0,  0,  0,  0,  0, 34,  0, 78,  0,  0,  0,213,  0,  0,  0,  0,  0, 34,  0,
- 70,  0,  0,  0,127,  0,  0,  0,  0,  0, 34,  0, 70,  0,  0,  0,219,  0,  0,  0,  0,  0, 34,  0,128,  0,  0,  0,219,  0,  0,  0,
-  0,  0, 34,  0,129,  0,  0,  0,220,  0,  0,  0,  0,  0, 34,  0, 70,  0,  0,  0,220,  0,  0,  0,  0,  0, 34,  0,217,  0,  0,  0,
-219,  0,  0,  0,  0,  0, 34,  0,130,  0,  0,  0,217,  0,  0,  0,  0,  0, 34,  0,131,  0,  0,  0,218,  0,  0,  0,  0,  0, 34,  0,
-218,  0,  0,  0,220,  0,  0,  0,  0,  0, 34,  0,215,  0,  0,  0,217,  0,  0,  0,  0,  0, 34,  0,132,  0,  0,  0,215,  0,  0,  0,
-  0,  0, 34,  0,133,  0,  0,  0,216,  0,  0,  0,  0,  0, 34,  0,216,  0,  0,  0,218,  0,  0,  0,  0,  0, 34,  0,214,  0,  0,  0,
-215,  0,  0,  0,  0,  0, 34,  0,134,  0,  0,  0,214,  0,  0,  0,  0,  0, 34,  0,214,  0,  0,  0,216,  0,  0,  0,  0,  0, 34,  0,
-215,  0,  0,  0,226,  0,  0,  0,  0,  0, 34,  0,226,  0,  0,  0,228,  0,  0,  0,  0,  0, 34,  0,214,  0,  0,  0,228,  0,  0,  0,
-  0,  0, 34,  0,216,  0,  0,  0,227,  0,  0,  0,  0,  0, 34,  0,227,  0,  0,  0,228,  0,  0,  0,  0,  0, 34,  0,217,  0,  0,  0,
-224,  0,  0,  0,  0,  0, 34,  0,224,  0,  0,  0,226,  0,  0,  0,  0,  0, 34,  0,218,  0,  0,  0,225,  0,  0,  0,  0,  0, 34,  0,
-225,  0,  0,  0,227,  0,  0,  0,  0,  0, 34,  0,219,  0,  0,  0,222,  0,  0,  0,  0,  0, 34,  0,222,  0,  0,  0,224,  0,  0,  0,
-  0,  0, 34,  0,220,  0,  0,  0,223,  0,  0,  0,  0,  0, 34,  0,223,  0,  0,  0,225,  0,  0,  0,  0,  0, 34,  0, 70,  0,  0,  0,
-221,  0,  0,  0,  0,  0, 34,  0,221,  0,  0,  0,222,  0,  0,  0,  0,  0, 34,  0,221,  0,  0,  0,223,  0,  0,  0,  0,  0, 34,  0,
-221,  0,  0,  0,228,  0,  0,  0,  0,  0, 34,  0,222,  0,  0,  0,226,  0,  0,  0,  0,  0, 34,  0,223,  0,  0,  0,227,  0,  0,  0,
-  0,  0, 34,  0,178,  0,  0,  0,231,  0,  0,  0,  0,  0, 34,  0,229,  0,  0,  0,231,  0,  0,  0,  0,  0, 34,  0,180,  0,  0,  0,
-229,  0,  0,  0,  0,  0, 34,  0,179,  0,  0,  0,232,  0,  0,  0,  0,  0, 34,  0,181,  0,  0,  0,230,  0,  0,  0,  0,  0, 34,  0,
-230,  0,  0,  0,232,  0,  0,  0,  0,  0, 34,  0,229,  0,  0,  0,251,  0,  0,  0,  0,  0, 34,  0,110,  0,  0,  0,251,  0,  0,  0,
-  0,  0, 34,  0,111,  0,  0,  0,252,  0,  0,  0,  0,  0, 34,  0,230,  0,  0,  0,252,  0,  0,  0,  0,  0, 34,  0,251,  0,  0,  0,
-253,  0,  0,  0,  0,  0, 34,  0,108,  0,  0,  0,253,  0,  0,  0,  0,  0, 34,  0,109,  0,  0,  0,254,  0,  0,  0,  0,  0, 34,  0,
-252,  0,  0,  0,254,  0,  0,  0,  0,  0, 34,  0,231,  0,  0,  0,249,  0,  0,  0,  0,  0, 34,  0,112,  0,  0,  0,250,  0,  0,  0,
-  0,  0, 34,  0,232,  0,  0,  0,250,  0,  0,  0,  0,  0, 34,  0,113,  0,  0,  0,247,  0,  0,  0,  0,  0, 34,  0,247,  0,  0,  0,
-249,  0,  0,  0,  0,  0, 34,  0,114,  0,  0,  0,248,  0,  0,  0,  0,  0, 34,  0,248,  0,  0,  0,250,  0,  0,  0,  0,  0, 34,  0,
-115,  0,  0,  0,245,  0,  0,  0,  0,  0, 34,  0,245,  0,  0,  0,247,  0,  0,  0,  0,  0, 34,  0,116,  0,  0,  0,246,  0,  0,  0,
-  0,  0, 34,  0,246,  0,  0,  0,248,  0,  0,  0,  0,  0, 34,  0,117,  0,  0,  0,243,  0,  0,  0,  0,  0, 34,  0,243,  0,  0,  0,
-245,  0,  0,  0,  0,  0, 34,  0,118,  0,  0,  0,244,  0,  0,  0,  0,  0, 34,  0,244,  0,  0,  0,246,  0,  0,  0,  0,  0, 34,  0,
-119,  0,  0,  0,241,  0,  0,  0,  0,  0, 34,  0,241,  0,  0,  0,243,  0,  0,  0,  0,  0, 34,  0,120,  0,  0,  0,242,  0,  0,  0,
-  0,  0, 34,  0,242,  0,  0,  0,244,  0,  0,  0,  0,  0, 34,  0,121,  0,  0,  0,239,  0,  0,  0,  0,  0, 34,  0,239,  0,  0,  0,
-241,  0,  0,  0,  0,  0, 34,  0,122,  0,  0,  0,240,  0,  0,  0,  0,  0, 34,  0,240,  0,  0,  0,242,  0,  0,  0,  0,  0, 34,  0,
-123,  0,  0,  0,237,  0,  0,  0,  0,  0, 34,  0,237,  0,  0,  0,239,  0,  0,  0,  0,  0, 34,  0,124,  0,  0,  0,238,  0,  0,  0,
-  0,  0, 34,  0,238,  0,  0,  0,240,  0,  0,  0,  0,  0, 34,  0,176,  0,  0,  0,233,  0,  0,  0,  0,  0, 34,  0,233,  0,  0,  0,
-237,  0,  0,  0,  0,  0, 34,  0,177,  0,  0,  0,234,  0,  0,  0,  0,  0, 34,  0,234,  0,  0,  0,238,  0,  0,  0,  0,  0, 34,  0,
-125,  0,  0,  0,235,  0,  0,  0,  0,  0, 34,  0,233,  0,  0,  0,235,  0,  0,  0,  0,  0, 34,  0,126,  0,  0,  0,236,  0,  0,  0,
-  0,  0, 34,  0,234,  0,  0,  0,236,  0,  0,  0,  0,  0, 34,  0,235,  0,  0,  0,253,  0,  0,  0,  0,  0, 34,  0,236,  0,  0,  0,
-254,  0,  0,  0,  0,  0, 34,  0,253,  0,  0,  0,255,  0,  0,  0,  0,  0, 34,  0,255,  0,  0,  0, 17,  1,  0,  0,  0,  0, 34,  0,
-235,  0,  0,  0, 17,  1,  0,  0,  0,  0, 34,  0,254,  0,  0,  0,  0,  1,  0,  0,  0,  0, 34,  0,236,  0,  0,  0, 18,  1,  0,  0,
-  0,  0, 34,  0,  0,  1,  0,  0, 18,  1,  0,  0,  0,  0, 34,  0, 17,  1,  0,  0, 19,  1,  0,  0,  0,  0, 34,  0,233,  0,  0,  0,
- 19,  1,  0,  0,  0,  0, 34,  0,234,  0,  0,  0, 20,  1,  0,  0,  0,  0, 34,  0, 18,  1,  0,  0, 20,  1,  0,  0,  0,  0, 34,  0,
- 15,  1,  0,  0, 19,  1,  0,  0,  0,  0, 34,  0,237,  0,  0,  0, 15,  1,  0,  0,  0,  0, 34,  0,238,  0,  0,  0, 16,  1,  0,  0,
-  0,  0, 34,  0, 16,  1,  0,  0, 20,  1,  0,  0,  0,  0, 34,  0, 13,  1,  0,  0, 15,  1,  0,  0,  0,  0, 34,  0,239,  0,  0,  0,
- 13,  1,  0,  0,  0,  0, 34,  0,240,  0,  0,  0, 14,  1,  0,  0,  0,  0, 34,  0, 14,  1,  0,  0, 16,  1,  0,  0,  0,  0, 34,  0,
- 11,  1,  0,  0, 13,  1,  0,  0,  0,  0, 34,  0,241,  0,  0,  0, 11,  1,  0,  0,  0,  0, 34,  0,242,  0,  0,  0, 12,  1,  0,  0,
-  0,  0, 34,  0, 12,  1,  0,  0, 14,  1,  0,  0,  0,  0, 34,  0,  9,  1,  0,  0, 11,  1,  0,  0,  0,  0, 34,  0,243,  0,  0,  0,
-  9,  1,  0,  0,  0,  0, 34,  0,244,  0,  0,  0, 10,  1,  0,  0,  0,  0, 34,  0, 10,  1,  0,  0, 12,  1,  0,  0,  0,  0, 34,  0,
-  7,  1,  0,  0,  9,  1,  0,  0,  0,  0, 34,  0,245,  0,  0,  0,  7,  1,  0,  0,  0,  0, 34,  0,246,  0,  0,  0,  8,  1,  0,  0,
-  0,  0, 34,  0,  8,  1,  0,  0, 10,  1,  0,  0,  0,  0, 34,  0,  5,  1,  0,  0,  7,  1,  0,  0,  0,  0, 34,  0,247,  0,  0,  0,
-  5,  1,  0,  0,  0,  0, 34,  0,248,  0,  0,  0,  6,  1,  0,  0,  0,  0, 34,  0,  6,  1,  0,  0,  8,  1,  0,  0,  0,  0, 34,  0,
-  3,  1,  0,  0,  5,  1,  0,  0,  0,  0, 34,  0,249,  0,  0,  0,  3,  1,  0,  0,  0,  0, 34,  0,250,  0,  0,  0,  4,  1,  0,  0,
-  0,  0, 34,  0,  4,  1,  0,  0,  6,  1,  0,  0,  0,  0, 34,  0,  3,  1,  0,  0, 21,  1,  0,  0,  0,  0, 34,  0,231,  0,  0,  0,
- 21,  1,  0,  0,  0,  0, 34,  0,232,  0,  0,  0, 22,  1,  0,  0,  0,  0, 34,  0,  4,  1,  0,  0, 22,  1,  0,  0,  0,  0, 34,  0,
-251,  0,  0,  0,  1,  1,  0,  0,  0,  0, 34,  0,255,  0,  0,  0,  1,  1,  0,  0,  0,  0, 34,  0,252,  0,  0,  0,  2,  1,  0,  0,
-  0,  0, 34,  0,  0,  1,  0,  0,  2,  1,  0,  0,  0,  0, 34,  0,229,  0,  0,  0, 23,  1,  0,  0,  0,  0, 34,  0,  1,  1,  0,  0,
- 23,  1,  0,  0,  0,  0, 34,  0,230,  0,  0,  0, 24,  1,  0,  0,  0,  0, 34,  0,  2,  1,  0,  0, 24,  1,  0,  0,  0,  0, 34,  0,
- 21,  1,  0,  0, 23,  1,  0,  0,  0,  0, 34,  0, 22,  1,  0,  0, 24,  1,  0,  0,  0,  0, 34,  0,106,  0,  0,  0, 25,  1,  0,  0,
-  0,  0, 34,  0, 71,  0,  0,  0, 25,  1,  0,  0,  0,  0, 38,  0, 65,  0,  0,  0, 71,  0,  0,  0,  0,  0, 34,  0,107,  0,  0,  0,
- 26,  1,  0,  0,  0,  0, 34,  0, 71,  0,  0,  0, 26,  1,  0,  0,  0,  0, 38,  0,104,  0,  0,  0, 27,  1,  0,  0,  0,  0, 34,  0,
- 25,  1,  0,  0, 27,  1,  0,  0,  0,  0, 34,  0,105,  0,  0,  0, 28,  1,  0,  0,  0,  0, 34,  0, 26,  1,  0,  0, 28,  1,  0,  0,
-  0,  0, 34,  0,102,  0,  0,  0, 29,  1,  0,  0,  0,  0, 34,  0, 27,  1,  0,  0, 29,  1,  0,  0,  0,  0, 34,  0,103,  0,  0,  0,
- 30,  1,  0,  0,  0,  0, 34,  0, 28,  1,  0,  0, 30,  1,  0,  0,  0,  0, 34,  0,100,  0,  0,  0, 31,  1,  0,  0,  0,  0, 34,  0,
- 29,  1,  0,  0, 31,  1,  0,  0,  0,  0, 34,  0,101,  0,  0,  0, 32,  1,  0,  0,  0,  0, 34,  0, 30,  1,  0,  0, 32,  1,  0,  0,
-  0,  0, 34,  0, 98,  0,  0,  0, 33,  1,  0,  0,  0,  0, 34,  0, 31,  1,  0,  0, 33,  1,  0,  0,  0,  0, 38,  0, 99,  0,  0,  0,
- 34,  1,  0,  0,  0,  0, 34,  0, 32,  1,  0,  0, 34,  1,  0,  0,  0,  0, 38,  0, 96,  0,  0,  0, 35,  1,  0,  0,  0,  0, 34,  0,
- 33,  1,  0,  0, 35,  1,  0,  0,  0,  0, 34,  0, 97,  0,  0,  0, 36,  1,  0,  0,  0,  0, 34,  0, 34,  1,  0,  0, 36,  1,  0,  0,
-  0,  0, 34,  0, 94,  0,  0,  0, 37,  1,  0,  0,  0,  0, 34,  0, 35,  1,  0,  0, 37,  1,  0,  0,  0,  0, 34,  0, 95,  0,  0,  0,
- 38,  1,  0,  0,  0,  0, 34,  0, 36,  1,  0,  0, 38,  1,  0,  0,  0,  0, 34,  0, 92,  0,  0,  0, 39,  1,  0,  0,  0,  0, 34,  0,
- 37,  1,  0,  0, 39,  1,  0,  0,  0,  0, 34,  0, 93,  0,  0,  0, 40,  1,  0,  0,  0,  0, 34,  0, 38,  1,  0,  0, 40,  1,  0,  0,
-  0,  0, 34,  0, 90,  0,  0,  0, 41,  1,  0,  0,  0,  0, 34,  0, 39,  1,  0,  0, 41,  1,  0,  0,  0,  0, 34,  0, 91,  0,  0,  0,
- 42,  1,  0,  0,  0,  0, 34,  0, 40,  1,  0,  0, 42,  1,  0,  0,  0,  0, 34,  0, 49,  1,  0,  0, 50,  1,  0,  0,  0,  0, 38,  0,
- 50,  1,  0,  0, 69,  1,  0,  0,  0,  0, 34,  0, 69,  1,  0,  0, 79,  1,  0,  0,  0,  0, 34,  0, 49,  1,  0,  0, 79,  1,  0,  0,
-  0,  0, 34,  0, 50,  1,  0,  0, 70,  1,  0,  0,  0,  0, 34,  0, 49,  1,  0,  0, 80,  1,  0,  0,  0,  0, 34,  0, 70,  1,  0,  0,
- 80,  1,  0,  0,  0,  0, 34,  0, 48,  1,  0,  0, 49,  1,  0,  0,  0,  0, 38,  0, 77,  1,  0,  0, 79,  1,  0,  0,  0,  0, 34,  0,
- 48,  1,  0,  0, 77,  1,  0,  0,  0,  0, 34,  0, 48,  1,  0,  0, 78,  1,  0,  0,  0,  0, 34,  0, 78,  1,  0,  0, 80,  1,  0,  0,
-  0,  0, 34,  0, 47,  1,  0,  0, 48,  1,  0,  0,  0,  0, 38,  0, 77,  1,  0,  0, 81,  1,  0,  0,  0,  0, 34,  0, 47,  1,  0,  0,
- 81,  1,  0,  0,  0,  0, 34,  0, 47,  1,  0,  0, 82,  1,  0,  0,  0,  0, 34,  0, 78,  1,  0,  0, 82,  1,  0,  0,  0,  0, 34,  0,
- 89,  0,  0,  0, 47,  1,  0,  0,  0,  0, 38,  0, 87,  0,  0,  0, 81,  1,  0,  0,  0,  0, 34,  0, 88,  0,  0,  0, 82,  1,  0,  0,
-  0,  0, 34,  0, 75,  1,  0,  0, 81,  1,  0,  0,  0,  0, 34,  0, 85,  0,  0,  0, 75,  1,  0,  0,  0,  0, 34,  0, 86,  0,  0,  0,
- 76,  1,  0,  0,  0,  0, 34,  0, 76,  1,  0,  0, 82,  1,  0,  0,  0,  0, 34,  0, 71,  1,  0,  0, 75,  1,  0,  0,  0,  0, 34,  0,
- 83,  0,  0,  0, 71,  1,  0,  0,  0,  0, 34,  0, 84,  0,  0,  0, 72,  1,  0,  0,  0,  0, 34,  0, 72,  1,  0,  0, 76,  1,  0,  0,
-  0,  0, 34,  0, 71,  1,  0,  0, 73,  1,  0,  0,  0,  0, 34,  0, 81,  0,  0,  0, 73,  1,  0,  0,  0,  0, 34,  0, 82,  0,  0,  0,
- 74,  1,  0,  0,  0,  0, 34,  0, 72,  1,  0,  0, 74,  1,  0,  0,  0,  0, 34,  0, 71,  1,  0,  0, 77,  1,  0,  0,  0,  0, 34,  0,
- 73,  1,  0,  0, 79,  1,  0,  0,  0,  0, 34,  0, 72,  1,  0,  0, 78,  1,  0,  0,  0,  0, 34,  0, 74,  1,  0,  0, 80,  1,  0,  0,
-  0,  0, 34,  0, 67,  1,  0,  0, 73,  1,  0,  0,  0,  0, 34,  0, 67,  1,  0,  0, 69,  1,  0,  0,  0,  0, 34,  0, 68,  1,  0,  0,
- 74,  1,  0,  0,  0,  0, 34,  0, 68,  1,  0,  0, 70,  1,  0,  0,  0,  0, 34,  0, 79,  0,  0,  0, 67,  1,  0,  0,  0,  0, 34,  0,
- 80,  0,  0,  0, 68,  1,  0,  0,  0,  0, 34,  0,206,  0,  0,  0, 83,  1,  0,  0,  0,  0, 34,  0, 83,  1,  0,  0, 85,  1,  0,  0,
-  0,  0, 34,  0,212,  0,  0,  0, 85,  1,  0,  0,  0,  0, 34,  0, 84,  1,  0,  0, 86,  1,  0,  0,  0,  0, 34,  0,207,  0,  0,  0,
- 84,  1,  0,  0,  0,  0, 34,  0,213,  0,  0,  0, 86,  1,  0,  0,  0,  0, 34,  0, 67,  1,  0,  0, 83,  1,  0,  0,  0,  0, 34,  0,
- 68,  1,  0,  0, 84,  1,  0,  0,  0,  0, 34,  0, 85,  1,  0,  0, 87,  1,  0,  0,  0,  0, 34,  0, 77,  0,  0,  0, 87,  1,  0,  0,
-  0,  0, 34,  0, 78,  0,  0,  0, 88,  1,  0,  0,  0,  0, 34,  0, 86,  1,  0,  0, 88,  1,  0,  0,  0,  0, 34,  0, 41,  1,  0,  0,
- 87,  1,  0,  0,  0,  0, 34,  0, 42,  1,  0,  0, 88,  1,  0,  0,  0,  0, 34,  0, 75,  0,  0,  0, 65,  1,  0,  0,  0,  0, 34,  0,
- 65,  1,  0,  0, 93,  1,  0,  0,  0,  0, 34,  0, 45,  1,  0,  0, 93,  1,  0,  0,  0,  0, 39,  0, 75,  0,  0,  0, 45,  1,  0,  0,
-  0,  0, 38,  0, 66,  1,  0,  0, 94,  1,  0,  0,  0,  0, 34,  0, 75,  0,  0,  0, 66,  1,  0,  0,  0,  0, 34,  0, 45,  1,  0,  0,
- 94,  1,  0,  0,  0,  0, 39,  0, 91,  1,  0,  0, 93,  1,  0,  0,  0,  0, 34,  0, 76,  0,  0,  0, 91,  1,  0,  0,  0,  0, 34,  0,
- 76,  0,  0,  0, 45,  1,  0,  0,  0,  0, 38,  0, 92,  1,  0,  0, 94,  1,  0,  0,  0,  0, 34,  0, 76,  0,  0,  0, 92,  1,  0,  0,
-  0,  0, 34,  0, 89,  1,  0,  0, 91,  1,  0,  0,  0,  0, 34,  0, 46,  1,  0,  0, 89,  1,  0,  0,  0,  0, 34,  0, 76,  0,  0,  0,
- 46,  1,  0,  0,  0,  0, 38,  0, 90,  1,  0,  0, 92,  1,  0,  0,  0,  0, 34,  0, 46,  1,  0,  0, 90,  1,  0,  0,  0,  0, 34,  0,
- 69,  1,  0,  0, 89,  1,  0,  0,  0,  0, 34,  0, 46,  1,  0,  0, 50,  1,  0,  0,  0,  0, 38,  0, 70,  1,  0,  0, 90,  1,  0,  0,
-  0,  0, 34,  0, 83,  1,  0,  0, 89,  1,  0,  0,  0,  0, 34,  0, 84,  1,  0,  0, 90,  1,  0,  0,  0,  0, 34,  0, 39,  1,  0,  0,
- 59,  1,  0,  0,  0,  0, 34,  0, 51,  1,  0,  0, 59,  1,  0,  0,  0,  0, 34,  0, 37,  1,  0,  0, 51,  1,  0,  0,  0,  0, 34,  0,
- 40,  1,  0,  0, 60,  1,  0,  0,  0,  0, 34,  0, 38,  1,  0,  0, 52,  1,  0,  0,  0,  0, 34,  0, 52,  1,  0,  0, 60,  1,  0,  0,
-  0,  0, 34,  0, 74,  0,  0,  0, 57,  1,  0,  0,  0,  0, 39,  0, 57,  1,  0,  0, 65,  1,  0,  0,  0,  0, 34,  0, 74,  0,  0,  0,
- 75,  0,  0,  0,  0,  0, 38,  0, 58,  1,  0,  0, 66,  1,  0,  0,  0,  0, 34,  0, 74,  0,  0,  0, 58,  1,  0,  0,  0,  0, 39,  0,
- 43,  1,  0,  0, 99,  1,  0,  0,  0,  0, 34,  0, 97,  1,  0,  0, 99,  1,  0,  0,  0,  0, 34,  0, 44,  1,  0,  0, 97,  1,  0,  0,
-  0,  0, 34,  0, 43,  1,  0,  0, 44,  1,  0,  0,  0,  0, 38,  0, 98,  1,  0,  0,100,  1,  0,  0,  0,  0, 34,  0, 43,  1,  0,  0,
-100,  1,  0,  0,  0,  0, 34,  0, 44,  1,  0,  0, 98,  1,  0,  0,  0,  0, 34,  0, 95,  1,  0,  0, 97,  1,  0,  0,  0,  0, 34,  0,
- 73,  0,  0,  0, 95,  1,  0,  0,  0,  0, 34,  0, 73,  0,  0,  0, 44,  1,  0,  0,  0,  0, 38,  0, 96,  1,  0,  0, 98,  1,  0,  0,
-  0,  0, 34,  0, 73,  0,  0,  0, 96,  1,  0,  0,  0,  0, 34,  0, 57,  1,  0,  0, 95,  1,  0,  0,  0,  0, 34,  0, 73,  0,  0,  0,
- 74,  0,  0,  0,  0,  0, 38,  0, 58,  1,  0,  0, 96,  1,  0,  0,  0,  0, 34,  0, 35,  1,  0,  0,103,  1,  0,  0,  0,  0, 34,  0,
-103,  1,  0,  0,105,  1,  0,  0,  0,  0, 34,  0, 33,  1,  0,  0,105,  1,  0,  0,  0,  0, 34,  0, 36,  1,  0,  0,104,  1,  0,  0,
-  0,  0, 34,  0, 34,  1,  0,  0,106,  1,  0,  0,  0,  0, 34,  0,104,  1,  0,  0,106,  1,  0,  0,  0,  0, 34,  0,103,  1,  0,  0,
-109,  1,  0,  0,  0,  0, 34,  0,107,  1,  0,  0,109,  1,  0,  0,  0,  0, 34,  0,105,  1,  0,  0,107,  1,  0,  0,  0,  0, 34,  0,
-104,  1,  0,  0,110,  1,  0,  0,  0,  0, 34,  0,106,  1,  0,  0,108,  1,  0,  0,  0,  0, 34,  0,108,  1,  0,  0,110,  1,  0,  0,
-  0,  0, 34,  0,109,  1,  0,  0,111,  1,  0,  0,  0,  0, 34,  0,111,  1,  0,  0,113,  1,  0,  0,  0,  0, 34,  0,107,  1,  0,  0,
-113,  1,  0,  0,  0,  0, 34,  0,110,  1,  0,  0,112,  1,  0,  0,  0,  0, 34,  0,108,  1,  0,  0,114,  1,  0,  0,  0,  0, 34,  0,
-112,  1,  0,  0,114,  1,  0,  0,  0,  0, 34,  0,111,  1,  0,  0,117,  1,  0,  0,  0,  0, 34,  0,115,  1,  0,  0,117,  1,  0,  0,
-  0,  0, 34,  0,113,  1,  0,  0,115,  1,  0,  0,  0,  0, 34,  0,112,  1,  0,  0,118,  1,  0,  0,  0,  0, 34,  0,114,  1,  0,  0,
-116,  1,  0,  0,  0,  0, 34,  0,116,  1,  0,  0,118,  1,  0,  0,  0,  0, 34,  0, 55,  1,  0,  0,119,  1,  0,  0,  0,  0, 39,  0,
-115,  1,  0,  0,119,  1,  0,  0,  0,  0, 34,  0, 55,  1,  0,  0,117,  1,  0,  0,  0,  0, 34,  0,116,  1,  0,  0,120,  1,  0,  0,
-  0,  0, 34,  0, 56,  1,  0,  0,120,  1,  0,  0,  0,  0, 39,  0, 56,  1,  0,  0,118,  1,  0,  0,  0,  0, 34,  0, 95,  1,  0,  0,
-115,  1,  0,  0,  0,  0, 34,  0, 57,  1,  0,  0,119,  1,  0,  0,  0,  0, 39,  0, 96,  1,  0,  0,116,  1,  0,  0,  0,  0, 34,  0,
- 58,  1,  0,  0,120,  1,  0,  0,  0,  0, 39,  0, 97,  1,  0,  0,113,  1,  0,  0,  0,  0, 34,  0, 98,  1,  0,  0,114,  1,  0,  0,
-  0,  0, 34,  0, 99,  1,  0,  0,107,  1,  0,  0,  0,  0, 34,  0,100,  1,  0,  0,108,  1,  0,  0,  0,  0, 34,  0, 99,  1,  0,  0,
-101,  1,  0,  0,  0,  0, 34,  0,101,  1,  0,  0,105,  1,  0,  0,  0,  0, 34,  0,102,  1,  0,  0,106,  1,  0,  0,  0,  0, 34,  0,
-100,  1,  0,  0,102,  1,  0,  0,  0,  0, 34,  0, 31,  1,  0,  0,101,  1,  0,  0,  0,  0, 34,  0, 32,  1,  0,  0,102,  1,  0,  0,
-  0,  0, 34,  0, 72,  0,  0,  0,101,  1,  0,  0,  0,  0, 34,  0, 72,  0,  0,  0, 43,  1,  0,  0,  0,  0, 38,  0, 72,  0,  0,  0,
-102,  1,  0,  0,  0,  0, 34,  0, 25,  1,  0,  0, 31,  1,  0,  0,  0,  0, 38,  0, 26,  1,  0,  0, 32,  1,  0,  0,  0,  0, 38,  0,
- 72,  0,  0,  0, 25,  1,  0,  0,  0,  0, 34,  0, 72,  0,  0,  0, 26,  1,  0,  0,  0,  0, 34,  0, 71,  0,  0,  0, 72,  0,  0,  0,
-  0,  0, 38,  0, 51,  1,  0,  0,103,  1,  0,  0,  0,  0, 34,  0, 52,  1,  0,  0,104,  1,  0,  0,  0,  0, 34,  0, 51,  1,  0,  0,
- 53,  1,  0,  0,  0,  0, 34,  0, 53,  1,  0,  0,109,  1,  0,  0,  0,  0, 34,  0, 54,  1,  0,  0,110,  1,  0,  0,  0,  0, 34,  0,
- 52,  1,  0,  0, 54,  1,  0,  0,  0,  0, 34,  0, 53,  1,  0,  0,123,  1,  0,  0,  0,  0, 34,  0,111,  1,  0,  0,123,  1,  0,  0,
-  0,  0, 34,  0,112,  1,  0,  0,124,  1,  0,  0,  0,  0, 34,  0, 54,  1,  0,  0,124,  1,  0,  0,  0,  0, 34,  0, 55,  1,  0,  0,
-123,  1,  0,  0,  0,  0, 34,  0, 56,  1,  0,  0,124,  1,  0,  0,  0,  0, 34,  0, 91,  1,  0,  0,127,  1,  0,  0,  0,  0, 34,  0,
-125,  1,  0,  0,127,  1,  0,  0,  0,  0, 34,  0, 89,  1,  0,  0,125,  1,  0,  0,  0,  0, 34,  0, 92,  1,  0,  0,128,  1,  0,  0,
-  0,  0, 34,  0, 90,  1,  0,  0,126,  1,  0,  0,  0,  0, 34,  0,126,  1,  0,  0,128,  1,  0,  0,  0,  0, 34,  0, 59,  1,  0,  0,
-125,  1,  0,  0,  0,  0, 34,  0, 61,  1,  0,  0,127,  1,  0,  0,  0,  0, 34,  0, 59,  1,  0,  0, 61,  1,  0,  0,  0,  0, 34,  0,
- 60,  1,  0,  0,126,  1,  0,  0,  0,  0, 34,  0, 60,  1,  0,  0, 62,  1,  0,  0,  0,  0, 34,  0, 62,  1,  0,  0,128,  1,  0,  0,
-  0,  0, 34,  0, 41,  1,  0,  0,125,  1,  0,  0,  0,  0, 34,  0, 42,  1,  0,  0,126,  1,  0,  0,  0,  0, 34,  0, 41,  1,  0,  0,
- 85,  1,  0,  0,  0,  0, 34,  0, 83,  1,  0,  0,125,  1,  0,  0,  0,  0, 34,  0, 42,  1,  0,  0, 86,  1,  0,  0,  0,  0, 34,  0,
- 84,  1,  0,  0,126,  1,  0,  0,  0,  0, 34,  0, 55,  1,  0,  0, 63,  1,  0,  0,  0,  0, 34,  0, 63,  1,  0,  0,121,  1,  0,  0,
-  0,  0, 39,  0,119,  1,  0,  0,121,  1,  0,  0,  0,  0, 34,  0, 64,  1,  0,  0,122,  1,  0,  0,  0,  0, 39,  0, 56,  1,  0,  0,
- 64,  1,  0,  0,  0,  0, 34,  0,120,  1,  0,  0,122,  1,  0,  0,  0,  0, 34,  0, 65,  1,  0,  0,121,  1,  0,  0,  0,  0, 34,  0,
- 66,  1,  0,  0,122,  1,  0,  0,  0,  0, 34,  0,121,  1,  0,  0,127,  1,  0,  0,  0,  0, 34,  0, 61,  1,  0,  0, 63,  1,  0,  0,
-  0,  0, 34,  0,122,  1,  0,  0,128,  1,  0,  0,  0,  0, 34,  0, 62,  1,  0,  0, 64,  1,  0,  0,  0,  0, 34,  0, 93,  1,  0,  0,
-121,  1,  0,  0,  0,  0, 39,  0, 94,  1,  0,  0,122,  1,  0,  0,  0,  0, 39,  0,129,  1,  0,  0,141,  1,  0,  0,  0,  0, 34,  0,
-129,  1,  0,  0,155,  1,  0,  0,  0,  0, 34,  0,143,  1,  0,  0,155,  1,  0,  0,  0,  0, 34,  0,141,  1,  0,  0,143,  1,  0,  0,
-  0,  0, 34,  0,130,  1,  0,  0,156,  1,  0,  0,  0,  0, 34,  0,130,  1,  0,  0,142,  1,  0,  0,  0,  0, 34,  0,142,  1,  0,  0,
-144,  1,  0,  0,  0,  0, 34,  0,144,  1,  0,  0,156,  1,  0,  0,  0,  0, 34,  0,143,  1,  0,  0,145,  1,  0,  0,  0,  0, 34,  0,
-139,  1,  0,  0,145,  1,  0,  0,  0,  0, 34,  0,139,  1,  0,  0,141,  1,  0,  0,  0,  0, 34,  0,144,  1,  0,  0,146,  1,  0,  0,
-  0,  0, 34,  0,140,  1,  0,  0,142,  1,  0,  0,  0,  0, 34,  0,140,  1,  0,  0,146,  1,  0,  0,  0,  0, 34,  0,145,  1,  0,  0,
-147,  1,  0,  0,  0,  0, 34,  0,137,  1,  0,  0,147,  1,  0,  0,  0,  0, 34,  0,137,  1,  0,  0,139,  1,  0,  0,  0,  0, 34,  0,
-146,  1,  0,  0,148,  1,  0,  0,  0,  0, 34,  0,138,  1,  0,  0,140,  1,  0,  0,  0,  0, 34,  0,138,  1,  0,  0,148,  1,  0,  0,
-  0,  0, 34,  0,147,  1,  0,  0,149,  1,  0,  0,  0,  0, 34,  0,135,  1,  0,  0,149,  1,  0,  0,  0,  0, 34,  0,135,  1,  0,  0,
-137,  1,  0,  0,  0,  0, 34,  0,148,  1,  0,  0,150,  1,  0,  0,  0,  0, 34,  0,136,  1,  0,  0,138,  1,  0,  0,  0,  0, 34,  0,
-136,  1,  0,  0,150,  1,  0,  0,  0,  0, 34,  0,149,  1,  0,  0,151,  1,  0,  0,  0,  0, 34,  0,133,  1,  0,  0,151,  1,  0,  0,
-  0,  0, 34,  0,133,  1,  0,  0,135,  1,  0,  0,  0,  0, 34,  0,150,  1,  0,  0,152,  1,  0,  0,  0,  0, 34,  0,134,  1,  0,  0,
-136,  1,  0,  0,  0,  0, 34,  0,134,  1,  0,  0,152,  1,  0,  0,  0,  0, 34,  0,151,  1,  0,  0,153,  1,  0,  0,  0,  0, 34,  0,
-131,  1,  0,  0,153,  1,  0,  0,  0,  0, 34,  0,131,  1,  0,  0,133,  1,  0,  0,  0,  0, 34,  0,152,  1,  0,  0,154,  1,  0,  0,
-  0,  0, 34,  0,132,  1,  0,  0,134,  1,  0,  0,  0,  0, 34,  0,132,  1,  0,  0,154,  1,  0,  0,  0,  0, 34,  0,151,  1,  0,  0,
-161,  1,  0,  0,  0,  0, 34,  0,159,  1,  0,  0,161,  1,  0,  0,  0,  0, 34,  0,153,  1,  0,  0,159,  1,  0,  0,  0,  0, 34,  0,
-160,  1,  0,  0,162,  1,  0,  0,  0,  0, 34,  0,152,  1,  0,  0,162,  1,  0,  0,  0,  0, 34,  0,154,  1,  0,  0,160,  1,  0,  0,
-  0,  0, 34,  0,149,  1,  0,  0,163,  1,  0,  0,  0,  0, 34,  0,161,  1,  0,  0,163,  1,  0,  0,  0,  0, 34,  0,162,  1,  0,  0,
-164,  1,  0,  0,  0,  0, 34,  0,150,  1,  0,  0,164,  1,  0,  0,  0,  0, 34,  0,147,  1,  0,  0,165,  1,  0,  0,  0,  0, 34,  0,
-163,  1,  0,  0,165,  1,  0,  0,  0,  0, 34,  0,164,  1,  0,  0,166,  1,  0,  0,  0,  0, 34,  0,148,  1,  0,  0,166,  1,  0,  0,
-  0,  0, 34,  0,145,  1,  0,  0,167,  1,  0,  0,  0,  0, 34,  0,165,  1,  0,  0,167,  1,  0,  0,  0,  0, 34,  0,166,  1,  0,  0,
-168,  1,  0,  0,  0,  0, 34,  0,146,  1,  0,  0,168,  1,  0,  0,  0,  0, 34,  0,143,  1,  0,  0,169,  1,  0,  0,  0,  0, 34,  0,
-167,  1,  0,  0,169,  1,  0,  0,  0,  0, 34,  0,168,  1,  0,  0,170,  1,  0,  0,  0,  0, 34,  0,144,  1,  0,  0,170,  1,  0,  0,
-  0,  0, 34,  0,155,  1,  0,  0,157,  1,  0,  0,  0,  0, 34,  0,157,  1,  0,  0,169,  1,  0,  0,  0,  0, 34,  0,156,  1,  0,  0,
-158,  1,  0,  0,  0,  0, 34,  0,158,  1,  0,  0,170,  1,  0,  0,  0,  0, 34,  0, 61,  1,  0,  0,185,  1,  0,  0,  0,  0, 34,  0,
-183,  1,  0,  0,185,  1,  0,  0,  0,  0, 34,  0, 59,  1,  0,  0,183,  1,  0,  0,  0,  0, 34,  0, 62,  1,  0,  0,186,  1,  0,  0,
-  0,  0, 34,  0, 60,  1,  0,  0,184,  1,  0,  0,  0,  0, 34,  0,184,  1,  0,  0,186,  1,  0,  0,  0,  0, 34,  0, 61,  1,  0,  0,
-131,  1,  0,  0,  0,  0, 34,  0,153,  1,  0,  0,185,  1,  0,  0,  0,  0, 34,  0, 62,  1,  0,  0,132,  1,  0,  0,  0,  0, 34,  0,
-154,  1,  0,  0,186,  1,  0,  0,  0,  0, 34,  0, 53,  1,  0,  0,183,  1,  0,  0,  0,  0, 34,  0, 54,  1,  0,  0,184,  1,  0,  0,
-  0,  0, 34,  0,123,  1,  0,  0,171,  1,  0,  0,  0,  0, 34,  0,155,  1,  0,  0,171,  1,  0,  0,  0,  0, 34,  0,123,  1,  0,  0,
-129,  1,  0,  0,  0,  0, 34,  0,156,  1,  0,  0,172,  1,  0,  0,  0,  0, 34,  0,124,  1,  0,  0,172,  1,  0,  0,  0,  0, 34,  0,
-124,  1,  0,  0,130,  1,  0,  0,  0,  0, 34,  0,159,  1,  0,  0,181,  1,  0,  0,  0,  0, 34,  0,181,  1,  0,  0,185,  1,  0,  0,
-  0,  0, 34,  0,160,  1,  0,  0,182,  1,  0,  0,  0,  0, 34,  0,182,  1,  0,  0,186,  1,  0,  0,  0,  0, 34,  0,179,  1,  0,  0,
-187,  1,  0,  0,  0,  0, 34,  0,185,  1,  0,  0,187,  1,  0,  0,  0,  0, 34,  0,179,  1,  0,  0,181,  1,  0,  0,  0,  0, 34,  0,
-186,  1,  0,  0,188,  1,  0,  0,  0,  0, 34,  0,180,  1,  0,  0,188,  1,  0,  0,  0,  0, 34,  0,180,  1,  0,  0,182,  1,  0,  0,
-  0,  0, 34,  0,175,  1,  0,  0,187,  1,  0,  0,  0,  0, 34,  0,177,  1,  0,  0,179,  1,  0,  0,  0,  0, 34,  0,175,  1,  0,  0,
-177,  1,  0,  0,  0,  0, 34,  0,176,  1,  0,  0,188,  1,  0,  0,  0,  0, 34,  0,176,  1,  0,  0,178,  1,  0,  0,  0,  0, 34,  0,
-178,  1,  0,  0,180,  1,  0,  0,  0,  0, 34,  0,173,  1,  0,  0,189,  1,  0,  0,  0,  0, 34,  0,187,  1,  0,  0,189,  1,  0,  0,
-  0,  0, 34,  0,173,  1,  0,  0,175,  1,  0,  0,  0,  0, 34,  0,188,  1,  0,  0,190,  1,  0,  0,  0,  0, 34,  0,174,  1,  0,  0,
-190,  1,  0,  0,  0,  0, 34,  0,174,  1,  0,  0,176,  1,  0,  0,  0,  0, 34,  0,171,  1,  0,  0,189,  1,  0,  0,  0,  0, 34,  0,
-173,  1,  0,  0,191,  1,  0,  0,  0,  0, 34,  0,171,  1,  0,  0,191,  1,  0,  0,  0,  0, 32,  0,172,  1,  0,  0,190,  1,  0,  0,
-  0,  0, 34,  0,172,  1,  0,  0,192,  1,  0,  0,  0,  0, 32,  0,174,  1,  0,  0,192,  1,  0,  0,  0,  0, 34,  0,157,  1,  0,  0,
-191,  1,  0,  0,  0,  0, 34,  0,158,  1,  0,  0,192,  1,  0,  0,  0,  0, 34,  0, 53,  1,  0,  0,189,  1,  0,  0,  0,  0, 34,  0,
- 54,  1,  0,  0,190,  1,  0,  0,  0,  0, 34,  0,183,  1,  0,  0,187,  1,  0,  0,  0,  0, 34,  0,184,  1,  0,  0,188,  1,  0,  0,
-  0,  0, 34,  0,191,  1,  0,  0,193,  1,  0,  0,  0,  0, 34,  0,193,  1,  0,  0,217,  1,  0,  0,  0,  0, 34,  0,157,  1,  0,  0,
-217,  1,  0,  0,  0,  0, 34,  0,192,  1,  0,  0,194,  1,  0,  0,  0,  0, 34,  0,158,  1,  0,  0,218,  1,  0,  0,  0,  0, 34,  0,
-194,  1,  0,  0,218,  1,  0,  0,  0,  0, 34,  0,173,  1,  0,  0,203,  1,  0,  0,  0,  0, 34,  0,193,  1,  0,  0,203,  1,  0,  0,
-  0,  0, 34,  0,174,  1,  0,  0,204,  1,  0,  0,  0,  0, 34,  0,194,  1,  0,  0,204,  1,  0,  0,  0,  0, 34,  0,175,  1,  0,  0,
-201,  1,  0,  0,  0,  0, 34,  0,201,  1,  0,  0,203,  1,  0,  0,  0,  0, 34,  0,176,  1,  0,  0,202,  1,  0,  0,  0,  0, 34,  0,
-202,  1,  0,  0,204,  1,  0,  0,  0,  0, 34,  0,177,  1,  0,  0,199,  1,  0,  0,  0,  0, 34,  0,199,  1,  0,  0,201,  1,  0,  0,
-  0,  0, 34,  0,178,  1,  0,  0,200,  1,  0,  0,  0,  0, 34,  0,200,  1,  0,  0,202,  1,  0,  0,  0,  0, 34,  0,179,  1,  0,  0,
-197,  1,  0,  0,  0,  0, 34,  0,197,  1,  0,  0,199,  1,  0,  0,  0,  0, 34,  0,180,  1,  0,  0,198,  1,  0,  0,  0,  0, 34,  0,
-198,  1,  0,  0,200,  1,  0,  0,  0,  0, 34,  0,181,  1,  0,  0,195,  1,  0,  0,  0,  0, 34,  0,195,  1,  0,  0,197,  1,  0,  0,
-  0,  0, 34,  0,182,  1,  0,  0,196,  1,  0,  0,  0,  0, 34,  0,196,  1,  0,  0,198,  1,  0,  0,  0,  0, 34,  0,159,  1,  0,  0,
-215,  1,  0,  0,  0,  0, 34,  0,195,  1,  0,  0,215,  1,  0,  0,  0,  0, 34,  0,160,  1,  0,  0,216,  1,  0,  0,  0,  0, 34,  0,
-196,  1,  0,  0,216,  1,  0,  0,  0,  0, 34,  0,205,  1,  0,  0,217,  1,  0,  0,  0,  0, 34,  0,169,  1,  0,  0,205,  1,  0,  0,
-  0,  0, 34,  0,170,  1,  0,  0,206,  1,  0,  0,  0,  0, 34,  0,206,  1,  0,  0,218,  1,  0,  0,  0,  0, 34,  0,205,  1,  0,  0,
-207,  1,  0,  0,  0,  0, 34,  0,167,  1,  0,  0,207,  1,  0,  0,  0,  0, 34,  0,168,  1,  0,  0,208,  1,  0,  0,  0,  0, 34,  0,
-206,  1,  0,  0,208,  1,  0,  0,  0,  0, 34,  0,207,  1,  0,  0,209,  1,  0,  0,  0,  0, 34,  0,165,  1,  0,  0,209,  1,  0,  0,
-  0,  0, 34,  0,166,  1,  0,  0,210,  1,  0,  0,  0,  0, 34,  0,208,  1,  0,  0,210,  1,  0,  0,  0,  0, 34,  0,209,  1,  0,  0,
-211,  1,  0,  0,  0,  0, 34,  0,163,  1,  0,  0,211,  1,  0,  0,  0,  0, 34,  0,164,  1,  0,  0,212,  1,  0,  0,  0,  0, 34,  0,
-210,  1,  0,  0,212,  1,  0,  0,  0,  0, 34,  0,211,  1,  0,  0,213,  1,  0,  0,  0,  0, 34,  0,161,  1,  0,  0,213,  1,  0,  0,
-  0,  0, 34,  0,162,  1,  0,  0,214,  1,  0,  0,  0,  0, 34,  0,212,  1,  0,  0,214,  1,  0,  0,  0,  0, 34,  0,213,  1,  0,  0,
-215,  1,  0,  0,  0,  0, 34,  0,214,  1,  0,  0,216,  1,  0,  0,  0,  0, 34,  0,197,  1,  0,  0,221,  1,  0,  0,  0,  0, 34,  0,
-219,  1,  0,  0,221,  1,  0,  0,  0,  0, 34,  0,199,  1,  0,  0,219,  1,  0,  0,  0,  0, 34,  0,198,  1,  0,  0,222,  1,  0,  0,
-  0,  0, 34,  0,200,  1,  0,  0,220,  1,  0,  0,  0,  0, 34,  0,220,  1,  0,  0,222,  1,  0,  0,  0,  0, 34,  0,221,  1,  0,  0,
-223,  1,  0,  0,  0,  0, 34,  0,223,  1,  0,  0,225,  1,  0,  0,  0,  0, 32,  0,219,  1,  0,  0,225,  1,  0,  0,  0,  0, 34,  0,
-222,  1,  0,  0,224,  1,  0,  0,  0,  0, 34,  0,220,  1,  0,  0,226,  1,  0,  0,  0,  0, 34,  0,224,  1,  0,  0,226,  1,  0,  0,
-  0,  0, 32,  0,223,  1,  0,  0,229,  1,  0,  0,  0,  0, 34,  0,227,  1,  0,  0,229,  1,  0,  0,  0,  0, 34,  0,225,  1,  0,  0,
-227,  1,  0,  0,  0,  0, 34,  0,224,  1,  0,  0,230,  1,  0,  0,  0,  0, 34,  0,226,  1,  0,  0,228,  1,  0,  0,  0,  0, 34,  0,
-228,  1,  0,  0,230,  1,  0,  0,  0,  0, 34,  0,229,  1,  0,  0,231,  1,  0,  0,  0,  0, 34,  0,231,  1,  0,  0,233,  1,  0,  0,
-  0,  0, 34,  0,227,  1,  0,  0,233,  1,  0,  0,  0,  0, 34,  0,230,  1,  0,  0,232,  1,  0,  0,  0,  0, 34,  0,228,  1,  0,  0,
-234,  1,  0,  0,  0,  0, 34,  0,232,  1,  0,  0,234,  1,  0,  0,  0,  0, 34,  0,217,  1,  0,  0,227,  1,  0,  0,  0,  0, 34,  0,
-205,  1,  0,  0,233,  1,  0,  0,  0,  0, 34,  0,218,  1,  0,  0,228,  1,  0,  0,  0,  0, 34,  0,206,  1,  0,  0,234,  1,  0,  0,
-  0,  0, 34,  0,193,  1,  0,  0,225,  1,  0,  0,  0,  0, 34,  0,194,  1,  0,  0,226,  1,  0,  0,  0,  0, 34,  0,203,  1,  0,  0,
-219,  1,  0,  0,  0,  0, 34,  0,204,  1,  0,  0,220,  1,  0,  0,  0,  0, 34,  0,215,  1,  0,  0,221,  1,  0,  0,  0,  0, 34,  0,
-216,  1,  0,  0,222,  1,  0,  0,  0,  0, 34,  0,213,  1,  0,  0,223,  1,  0,  0,  0,  0, 34,  0,214,  1,  0,  0,224,  1,  0,  0,
-  0,  0, 34,  0,211,  1,  0,  0,229,  1,  0,  0,  0,  0, 34,  0,212,  1,  0,  0,230,  1,  0,  0,  0,  0, 34,  0,209,  1,  0,  0,
-231,  1,  0,  0,  0,  0, 34,  0,210,  1,  0,  0,232,  1,  0,  0,  0,  0, 34,  0,207,  1,  0,  0,233,  1,  0,  0,  0,  0, 34,  0,
-208,  1,  0,  0,234,  1,  0,  0,  0,  0, 34,  0,131,  1,  0,  0,245,  1,  0,  0,  0,  0, 34,  0,243,  1,  0,  0,245,  1,  0,  0,
-  0,  0, 39,  0,133,  1,  0,  0,243,  1,  0,  0,  0,  0, 34,  0,132,  1,  0,  0,246,  1,  0,  0,  0,  0, 34,  0,134,  1,  0,  0,
-244,  1,  0,  0,  0,  0, 34,  0,244,  1,  0,  0,246,  1,  0,  0,  0,  0, 39,  0,241,  1,  0,  0,243,  1,  0,  0,  0,  0, 39,  0,
-135,  1,  0,  0,241,  1,  0,  0,  0,  0, 34,  0,136,  1,  0,  0,242,  1,  0,  0,  0,  0, 34,  0,242,  1,  0,  0,244,  1,  0,  0,
-  0,  0, 39,  0,239,  1,  0,  0,241,  1,  0,  0,  0,  0, 39,  0,137,  1,  0,  0,239,  1,  0,  0,  0,  0, 34,  0,138,  1,  0,  0,
-240,  1,  0,  0,  0,  0, 34,  0,240,  1,  0,  0,242,  1,  0,  0,  0,  0, 39,  0,237,  1,  0,  0,239,  1,  0,  0,  0,  0, 39,  0,
-139,  1,  0,  0,237,  1,  0,  0,  0,  0, 34,  0,140,  1,  0,  0,238,  1,  0,  0,  0,  0, 34,  0,238,  1,  0,  0,240,  1,  0,  0,
-  0,  0, 39,  0,235,  1,  0,  0,237,  1,  0,  0,  0,  0, 39,  0,141,  1,  0,  0,235,  1,  0,  0,  0,  0, 34,  0,142,  1,  0,  0,
-236,  1,  0,  0,  0,  0, 34,  0,236,  1,  0,  0,238,  1,  0,  0,  0,  0, 39,  0,235,  1,  0,  0,247,  1,  0,  0,  0,  0, 39,  0,
-129,  1,  0,  0,247,  1,  0,  0,  0,  0, 34,  0,130,  1,  0,  0,248,  1,  0,  0,  0,  0, 34,  0,236,  1,  0,  0,248,  1,  0,  0,
-  0,  0, 39,  0,235,  1,  0,  0,243,  1,  0,  0,  0,  0, 34,  0,245,  1,  0,  0,247,  1,  0,  0,  0,  0, 34,  0,236,  1,  0,  0,
-244,  1,  0,  0,  0,  0, 34,  0,246,  1,  0,  0,248,  1,  0,  0,  0,  0, 34,  0,237,  1,  0,  0,241,  1,  0,  0,  0,  0, 34,  0,
-238,  1,  0,  0,242,  1,  0,  0,  0,  0, 34,  0, 55,  1,  0,  0,247,  1,  0,  0,  0,  0, 39,  0, 56,  1,  0,  0,248,  1,  0,  0,
-  0,  0, 39,  0, 63,  1,  0,  0,245,  1,  0,  0,  0,  0, 39,  0, 64,  1,  0,  0,246,  1,  0,  0,  0,  0, 39,  0, 14,  0,  0,  0,
-249,  0,  0,  0,  0,  0, 34,  0, 14,  0,  0,  0,178,  0,  0,  0,  0,  0, 34,  0, 14,  0,  0,  0,113,  0,  0,  0,  0,  0, 34,  0,
- 14,  0,  0,  0,161,  0,  0,  0,  0,  0, 34,  0, 20,  0,  0,  0,112,  0,  0,  0,  0,  0, 34,  0, 16,  0,  0,  0,112,  0,  0,  0,
-  0,  0, 34,  0,  9,  0,  0,  0,112,  0,  0,  0,  0,  0, 34,  0, 13,  0,  0,  0,112,  0,  0,  0,  0,  0, 34,  0, 68, 65, 84, 65,
-104,  1,  0,  0,136,197, 52,  3,  0,  0,  0,  0, 84,  1,  0,  0,  5,  0,  0,  0,  4,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 56,199, 52,  3,  0,  0,  0,  0,  5,  0,  0,  0,
- 20,  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, 85, 86, 84,101,
-120,  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,152,238, 52,  3,
-  0,  0,  0,  0,  6,  0,  0,  0, 64,  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, 67,111,108,  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,168, 76, 53,  3,  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,  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,  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, 68, 65, 84, 65,
- 16, 39,  0,  0, 56,199, 52,  3,  0,  0,  0,  0, 48,  0,  0,  0,244,  1,  0,  0, 45,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,
- 43,  0,  0,  0,  0,  0,  0,  1,  3,  0,  0,  0,  1,  0,  0,  0, 46,  0,  0,  0, 44,  0,  0,  0,  0,  0,  0,  1, 43,  0,  0,  0,
-  2,  0,  0,  0,  4,  0,  0,  0, 41,  0,  0,  0,  0,  0,  0,  1,  5,  0,  0,  0,  3,  0,  0,  0, 44,  0,  0,  0, 42,  0,  0,  0,
-  0,  0,  0,  1,  2,  0,  0,  0,  8,  0,  0,  0,  6,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  1,  7,  0,  0,  0,  9,  0,  0,  0,
-  3,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0, 10,  0,  0,  0,  8,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  1,
-  9,  0,  0,  0, 11,  0,  0,  0,  1,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  1, 10,  0,  0,  0, 12,  0,  0,  0, 14,  0,  0,  0,
-  8,  0,  0,  0,  0,  0,  0,  1,112,  0,  0,  0, 13,  0,  0,  0, 11,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  1,  8,  0,  0,  0,
- 14,  0,  0,  0, 15,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  1, 16,  0,  0,  0,112,  0,  0,  0,  9,  0,  0,  0,  7,  0,  0,  0,
-  0,  0,  0,  1, 14,  0,  0,  0, 19,  0,  0,  0, 17,  0,  0,  0, 15,  0,  0,  0,  0,  0,  0,  1, 18,  0,  0,  0, 20,  0,  0,  0,
-112,  0,  0,  0, 16,  0,  0,  0,  0,  0,  0,  1, 12,  0,  0,  0, 21,  0,  0,  0, 19,  0,  0,  0, 14,  0,  0,  0,  0,  0,  0,  1,
- 20,  0,  0,  0, 22,  0,  0,  0, 13,  0,  0,  0,112,  0,  0,  0,  0,  0,  0,  1, 21,  0,  0,  0, 23,  0,  0,  0, 25,  0,  0,  0,
- 19,  0,  0,  0,  0,  0,  0,  1, 26,  0,  0,  0, 24,  0,  0,  0, 22,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,  1, 19,  0,  0,  0,
- 25,  0,  0,  0, 27,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  1, 28,  0,  0,  0, 26,  0,  0,  0, 20,  0,  0,  0, 18,  0,  0,  0,
-  0,  0,  0,  1, 25,  0,  0,  0, 31,  0,  0,  0, 29,  0,  0,  0, 27,  0,  0,  0,  0,  0,  0,  1, 30,  0,  0,  0, 32,  0,  0,  0,
- 26,  0,  0,  0, 28,  0,  0,  0,  0,  0,  0,  1, 23,  0,  0,  0, 33,  0,  0,  0, 31,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  1,
- 32,  0,  0,  0, 34,  0,  0,  0, 24,  0,  0,  0, 26,  0,  0,  0,  0,  0,  0,  1, 33,  0,  0,  0, 35,  0,  0,  0, 37,  0,  0,  0,
- 31,  0,  0,  0,  0,  0,  0,  1, 38,  0,  0,  0, 36,  0,  0,  0, 34,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  1, 31,  0,  0,  0,
- 37,  0,  0,  0, 39,  0,  0,  0, 29,  0,  0,  0,  0,  0,  0,  1, 40,  0,  0,  0, 38,  0,  0,  0, 32,  0,  0,  0, 30,  0,  0,  0,
-  0,  0,  0,  1, 37,  0,  0,  0, 43,  0,  0,  0, 41,  0,  0,  0, 39,  0,  0,  0,  0,  0,  0,  1, 42,  0,  0,  0, 44,  0,  0,  0,
- 38,  0,  0,  0, 40,  0,  0,  0,  0,  0,  0,  1, 35,  0,  0,  0, 45,  0,  0,  0, 43,  0,  0,  0, 37,  0,  0,  0,  0,  0,  0,  1,
- 44,  0,  0,  0, 46,  0,  0,  0, 36,  0,  0,  0, 38,  0,  0,  0,  0,  0,  0,  1, 45,  0,  0,  0, 35,  0,  0,  0, 49,  0,  0,  0,
- 47,  0,  0,  0,  0,  0,  0,  1, 50,  0,  0,  0, 36,  0,  0,  0, 46,  0,  0,  0, 48,  0,  0,  0,  0,  0,  0,  1, 35,  0,  0,  0,
- 33,  0,  0,  0, 51,  0,  0,  0, 49,  0,  0,  0,  0,  0,  0,  1, 52,  0,  0,  0, 34,  0,  0,  0, 36,  0,  0,  0, 50,  0,  0,  0,
-  0,  0,  0,  1, 33,  0,  0,  0, 23,  0,  0,  0, 53,  0,  0,  0, 51,  0,  0,  0,  0,  0,  0,  1, 54,  0,  0,  0, 24,  0,  0,  0,
- 34,  0,  0,  0, 52,  0,  0,  0,  0,  0,  0,  1, 23,  0,  0,  0, 21,  0,  0,  0, 55,  0,  0,  0, 53,  0,  0,  0,  0,  0,  0,  1,
- 56,  0,  0,  0, 22,  0,  0,  0, 24,  0,  0,  0, 54,  0,  0,  0,  0,  0,  0,  1, 21,  0,  0,  0, 12,  0,  0,  0, 57,  0,  0,  0,
- 55,  0,  0,  0,  0,  0,  0,  1, 58,  0,  0,  0, 13,  0,  0,  0, 22,  0,  0,  0, 56,  0,  0,  0,  0,  0,  0,  1, 12,  0,  0,  0,
- 10,  0,  0,  0, 61,  0,  0,  0, 57,  0,  0,  0,  0,  0,  0,  1, 62,  0,  0,  0, 11,  0,  0,  0, 13,  0,  0,  0, 58,  0,  0,  0,
-  0,  0,  0,  1, 10,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 61,  0,  0,  0,  0,  0,  0,  1, 64,  0,  0,  0,  1,  0,  0,  0,
- 11,  0,  0,  0, 62,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0, 45,  0,  0,  0, 47,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  1,
- 48,  0,  0,  0, 46,  0,  0,  0,  1,  0,  0,  0, 64,  0,  0,  0,  0,  0,  0,  1, 59,  0,  0,  0, 63,  0,  0,  0, 47,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  1, 48,  0,  0,  0, 64,  0,  0,  0, 60,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1, 61,  0,  0,  0,
- 63,  0,  0,  0, 59,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1, 60,  0,  0,  0, 64,  0,  0,  0, 62,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  1, 59,  0,  0,  0, 57,  0,  0,  0, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1, 62,  0,  0,  0, 58,  0,  0,  0,
- 60,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1, 59,  0,  0,  0, 55,  0,  0,  0, 57,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,
- 58,  0,  0,  0, 56,  0,  0,  0, 60,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1, 59,  0,  0,  0, 53,  0,  0,  0, 55,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  1, 56,  0,  0,  0, 54,  0,  0,  0, 60,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1, 59,  0,  0,  0,
- 51,  0,  0,  0, 53,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1, 54,  0,  0,  0, 52,  0,  0,  0, 60,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  1, 59,  0,  0,  0, 49,  0,  0,  0, 51,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1, 52,  0,  0,  0, 50,  0,  0,  0,
- 60,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1, 59,  0,  0,  0, 47,  0,  0,  0, 49,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,
- 50,  0,  0,  0, 48,  0,  0,  0, 60,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1, 87,  0,  0,  0,171,  0,  0,  0,173,  0,  0,  0,
- 89,  0,  0,  0,  0,  0,  0,  1,173,  0,  0,  0,172,  0,  0,  0, 88,  0,  0,  0, 89,  0,  0,  0,  0,  0,  0,  1, 85,  0,  0,  0,
-169,  0,  0,  0,171,  0,  0,  0, 87,  0,  0,  0,  0,  0,  0,  1,172,  0,  0,  0,170,  0,  0,  0, 86,  0,  0,  0, 88,  0,  0,  0,
-  0,  0,  0,  1, 83,  0,  0,  0,167,  0,  0,  0,169,  0,  0,  0, 85,  0,  0,  0,  0,  0,  0,  1,170,  0,  0,  0,168,  0,  0,  0,
- 84,  0,  0,  0, 86,  0,  0,  0,  0,  0,  0,  1, 81,  0,  0,  0,165,  0,  0,  0,167,  0,  0,  0, 83,  0,  0,  0,  0,  0,  0,  1,
-168,  0,  0,  0,166,  0,  0,  0, 82,  0,  0,  0, 84,  0,  0,  0,  0,  0,  0,  1, 79,  0,  0,  0,163,  0,  0,  0,165,  0,  0,  0,
- 81,  0,  0,  0,  0,  0,  0,  1,166,  0,  0,  0,164,  0,  0,  0, 80,  0,  0,  0, 82,  0,  0,  0,  0,  0,  0,  1, 77,  0,  0,  0,
- 90,  0,  0,  0,143,  0,  0,  0,161,  0,  0,  0,  0,  0,  0,  1,144,  0,  0,  0, 91,  0,  0,  0, 78,  0,  0,  0,162,  0,  0,  0,
-  0,  0,  0,  1, 90,  0,  0,  0, 92,  0,  0,  0,145,  0,  0,  0,143,  0,  0,  0,  0,  0,  0,  1,146,  0,  0,  0, 93,  0,  0,  0,
- 91,  0,  0,  0,144,  0,  0,  0,  0,  0,  0,  1, 92,  0,  0,  0, 94,  0,  0,  0,147,  0,  0,  0,145,  0,  0,  0,  0,  0,  0,  1,
-148,  0,  0,  0, 95,  0,  0,  0, 93,  0,  0,  0,146,  0,  0,  0,  0,  0,  0,  1, 94,  0,  0,  0, 96,  0,  0,  0,149,  0,  0,  0,
-147,  0,  0,  0,  0,  0,  0,  1,150,  0,  0,  0, 97,  0,  0,  0, 95,  0,  0,  0,148,  0,  0,  0,  0,  0,  0,  1, 96,  0,  0,  0,
- 98,  0,  0,  0,151,  0,  0,  0,149,  0,  0,  0,  0,  0,  0,  1,152,  0,  0,  0, 99,  0,  0,  0, 97,  0,  0,  0,150,  0,  0,  0,
-  0,  0,  0,  1, 98,  0,  0,  0,100,  0,  0,  0,153,  0,  0,  0,151,  0,  0,  0,  0,  0,  0,  1,154,  0,  0,  0,101,  0,  0,  0,
- 99,  0,  0,  0,152,  0,  0,  0,  0,  0,  0,  1,100,  0,  0,  0,102,  0,  0,  0,155,  0,  0,  0,153,  0,  0,  0,  0,  0,  0,  1,
-156,  0,  0,  0,103,  0,  0,  0,101,  0,  0,  0,154,  0,  0,  0,  0,  0,  0,  1,102,  0,  0,  0,104,  0,  0,  0,157,  0,  0,  0,
-155,  0,  0,  0,  0,  0,  0,  1,158,  0,  0,  0,105,  0,  0,  0,103,  0,  0,  0,156,  0,  0,  0,  0,  0,  0,  1,104,  0,  0,  0,
-106,  0,  0,  0,159,  0,  0,  0,157,  0,  0,  0,  0,  0,  0,  1,160,  0,  0,  0,107,  0,  0,  0,105,  0,  0,  0,158,  0,  0,  0,
-  0,  0,  0,  1,106,  0,  0,  0, 65,  0,  0,  0, 66,  0,  0,  0,159,  0,  0,  0,  0,  0,  0,  1, 66,  0,  0,  0, 65,  0,  0,  0,
-107,  0,  0,  0,160,  0,  0,  0,  0,  0,  0,  1,108,  0,  0,  0,125,  0,  0,  0,157,  0,  0,  0,159,  0,  0,  0,  0,  0,  0,  1,
-158,  0,  0,  0,126,  0,  0,  0,109,  0,  0,  0,160,  0,  0,  0,  0,  0,  0,  1,125,  0,  0,  0,176,  0,  0,  0,155,  0,  0,  0,
-157,  0,  0,  0,  0,  0,  0,  1,156,  0,  0,  0,177,  0,  0,  0,126,  0,  0,  0,158,  0,  0,  0,  0,  0,  0,  1,123,  0,  0,  0,
-153,  0,  0,  0,155,  0,  0,  0,176,  0,  0,  0,  0,  0,  0,  1,156,  0,  0,  0,154,  0,  0,  0,124,  0,  0,  0,177,  0,  0,  0,
-  0,  0,  0,  1,121,  0,  0,  0,151,  0,  0,  0,153,  0,  0,  0,123,  0,  0,  0,  0,  0,  0,  1,154,  0,  0,  0,152,  0,  0,  0,
-122,  0,  0,  0,124,  0,  0,  0,  0,  0,  0,  1,119,  0,  0,  0,149,  0,  0,  0,151,  0,  0,  0,121,  0,  0,  0,  0,  0,  0,  1,
-152,  0,  0,  0,150,  0,  0,  0,120,  0,  0,  0,122,  0,  0,  0,  0,  0,  0,  1,117,  0,  0,  0,147,  0,  0,  0,149,  0,  0,  0,
-119,  0,  0,  0,  0,  0,  0,  1,150,  0,  0,  0,148,  0,  0,  0,118,  0,  0,  0,120,  0,  0,  0,  0,  0,  0,  1,115,  0,  0,  0,
-145,  0,  0,  0,147,  0,  0,  0,117,  0,  0,  0,  0,  0,  0,  1,148,  0,  0,  0,146,  0,  0,  0,116,  0,  0,  0,118,  0,  0,  0,
-  0,  0,  0,  1,113,  0,  0,  0,143,  0,  0,  0,145,  0,  0,  0,115,  0,  0,  0,  0,  0,  0,  1,146,  0,  0,  0,144,  0,  0,  0,
-114,  0,  0,  0,116,  0,  0,  0,  0,  0,  0,  1, 14,  0,  0,  0,161,  0,  0,  0,143,  0,  0,  0,113,  0,  0,  0,  0,  0,  0,  1,
-144,  0,  0,  0,162,  0,  0,  0,112,  0,  0,  0,114,  0,  0,  0,  0,  0,  0,  1, 14,  0,  0,  0,178,  0,  0,  0,174,  0,  0,  0,
-161,  0,  0,  0,  0,  0,  0,  1,174,  0,  0,  0,179,  0,  0,  0,112,  0,  0,  0,162,  0,  0,  0,  0,  0,  0,  1,108,  0,  0,  0,
-159,  0,  0,  0, 66,  0,  0,  0,110,  0,  0,  0,  0,  0,  0,  1, 66,  0,  0,  0,160,  0,  0,  0,109,  0,  0,  0,111,  0,  0,  0,
-  0,  0,  0,  1,110,  0,  0,  0, 66,  0,  0,  0,175,  0,  0,  0,180,  0,  0,  0,  0,  0,  0,  1,175,  0,  0,  0, 66,  0,  0,  0,
-111,  0,  0,  0,181,  0,  0,  0,  0,  0,  0,  1,174,  0,  0,  0,178,  0,  0,  0,180,  0,  0,  0,175,  0,  0,  0,  0,  0,  0,  1,
-181,  0,  0,  0,179,  0,  0,  0,174,  0,  0,  0,175,  0,  0,  0,  0,  0,  0,  1,132,  0,  0,  0,134,  0,  0,  0,173,  0,  0,  0,
-171,  0,  0,  0,  0,  0,  0,  1,173,  0,  0,  0,134,  0,  0,  0,133,  0,  0,  0,172,  0,  0,  0,  0,  0,  0,  1,130,  0,  0,  0,
-132,  0,  0,  0,171,  0,  0,  0,169,  0,  0,  0,  0,  0,  0,  1,172,  0,  0,  0,133,  0,  0,  0,131,  0,  0,  0,170,  0,  0,  0,
-  0,  0,  0,  1,128,  0,  0,  0,130,  0,  0,  0,169,  0,  0,  0,167,  0,  0,  0,  0,  0,  0,  1,170,  0,  0,  0,131,  0,  0,  0,
-129,  0,  0,  0,168,  0,  0,  0,  0,  0,  0,  1,163,  0,  0,  0,184,  0,  0,  0,182,  0,  0,  0,165,  0,  0,  0,  0,  0,  0,  1,
-183,  0,  0,  0,185,  0,  0,  0,164,  0,  0,  0,166,  0,  0,  0,  0,  0,  0,  1,128,  0,  0,  0,167,  0,  0,  0,165,  0,  0,  0,
-182,  0,  0,  0,  0,  0,  0,  1,166,  0,  0,  0,168,  0,  0,  0,129,  0,  0,  0,183,  0,  0,  0,  0,  0,  0,  1,141,  0,  0,  0,
-187,  0,  0,  0,186,  0,  0,  0,184,  0,  0,  0,  0,  0,  0,  1,186,  0,  0,  0,187,  0,  0,  0,142,  0,  0,  0,185,  0,  0,  0,
-  0,  0,  0,  1,182,  0,  0,  0,184,  0,  0,  0,186,  0,  0,  0, 67,  0,  0,  0,  0,  0,  0,  1,186,  0,  0,  0,185,  0,  0,  0,
-183,  0,  0,  0, 67,  0,  0,  0,  0,  0,  0,  1,127,  0,  0,  0,128,  0,  0,  0,182,  0,  0,  0, 67,  0,  0,  0,  0,  0,  0,  1,
-183,  0,  0,  0,129,  0,  0,  0,127,  0,  0,  0, 67,  0,  0,  0,  0,  0,  0,  1,139,  0,  0,  0,190,  0,  0,  0,188,  0,  0,  0,
-141,  0,  0,  0,  0,  0,  0,  1,189,  0,  0,  0,191,  0,  0,  0,140,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  1,137,  0,  0,  0,
-192,  0,  0,  0,190,  0,  0,  0,139,  0,  0,  0,  0,  0,  0,  1,191,  0,  0,  0,193,  0,  0,  0,138,  0,  0,  0,140,  0,  0,  0,
-  0,  0,  0,  1,136,  0,  0,  0,194,  0,  0,  0,192,  0,  0,  0,137,  0,  0,  0,  0,  0,  0,  1,193,  0,  0,  0,195,  0,  0,  0,
-136,  0,  0,  0,138,  0,  0,  0,  0,  0,  0,  1,135,  0,  0,  0, 69,  0,  0,  0,194,  0,  0,  0,136,  0,  0,  0,  0,  0,  0,  1,
-195,  0,  0,  0, 69,  0,  0,  0,135,  0,  0,  0,136,  0,  0,  0,  0,  0,  0,  1,187,  0,  0,  0,141,  0,  0,  0,188,  0,  0,  0,
- 68,  0,  0,  0,  0,  0,  0,  1,189,  0,  0,  0,142,  0,  0,  0,187,  0,  0,  0, 68,  0,  0,  0,  0,  0,  0,  1, 68,  0,  0,  0,
-188,  0,  0,  0,203,  0,  0,  0,205,  0,  0,  0,  0,  0,  0,  1,204,  0,  0,  0,189,  0,  0,  0, 68,  0,  0,  0,205,  0,  0,  0,
-  0,  0,  0,  1, 69,  0,  0,  0,196,  0,  0,  0,197,  0,  0,  0,194,  0,  0,  0,  0,  0,  0,  1,198,  0,  0,  0,196,  0,  0,  0,
- 69,  0,  0,  0,195,  0,  0,  0,  0,  0,  0,  1,194,  0,  0,  0,197,  0,  0,  0,199,  0,  0,  0,192,  0,  0,  0,  0,  0,  0,  1,
-200,  0,  0,  0,198,  0,  0,  0,195,  0,  0,  0,193,  0,  0,  0,  0,  0,  0,  1,192,  0,  0,  0,199,  0,  0,  0,201,  0,  0,  0,
-190,  0,  0,  0,  0,  0,  0,  1,202,  0,  0,  0,200,  0,  0,  0,193,  0,  0,  0,191,  0,  0,  0,  0,  0,  0,  1,190,  0,  0,  0,
-201,  0,  0,  0,203,  0,  0,  0,188,  0,  0,  0,  0,  0,  0,  1,204,  0,  0,  0,202,  0,  0,  0,191,  0,  0,  0,189,  0,  0,  0,
-  0,  0,  0,  1,196,  0,  0,  0,201,  0,  0,  0,199,  0,  0,  0,197,  0,  0,  0,  0,  0,  0,  1,200,  0,  0,  0,202,  0,  0,  0,
-196,  0,  0,  0,198,  0,  0,  0,  0,  0,  0,  1,196,  0,  0,  0,205,  0,  0,  0,203,  0,  0,  0,201,  0,  0,  0,  0,  0,  0,  1,
-204,  0,  0,  0,205,  0,  0,  0,196,  0,  0,  0,202,  0,  0,  0,  0,  0,  0,  1,136,  0,  0,  0,137,  0,  0,  0,161,  0,  0,  0,
-174,  0,  0,  0,  0,  0,  0,  1,162,  0,  0,  0,138,  0,  0,  0,136,  0,  0,  0,174,  0,  0,  0,  0,  0,  0,  1,137,  0,  0,  0,
-139,  0,  0,  0,208,  0,  0,  0,161,  0,  0,  0,  0,  0,  0,  1,209,  0,  0,  0,140,  0,  0,  0,138,  0,  0,  0,162,  0,  0,  0,
-  0,  0,  0,  1,139,  0,  0,  0,141,  0,  0,  0,210,  0,  0,  0,208,  0,  0,  0,  0,  0,  0,  1,211,  0,  0,  0,142,  0,  0,  0,
-140,  0,  0,  0,209,  0,  0,  0,  0,  0,  0,  1,141,  0,  0,  0,184,  0,  0,  0,163,  0,  0,  0,210,  0,  0,  0,  0,  0,  0,  1,
-164,  0,  0,  0,185,  0,  0,  0,142,  0,  0,  0,211,  0,  0,  0,  0,  0,  0,  1, 79,  0,  0,  0,206,  0,  0,  0,210,  0,  0,  0,
-163,  0,  0,  0,  0,  0,  0,  1,211,  0,  0,  0,207,  0,  0,  0, 80,  0,  0,  0,164,  0,  0,  0,  0,  0,  0,  1,206,  0,  0,  0,
-212,  0,  0,  0,208,  0,  0,  0,210,  0,  0,  0,  0,  0,  0,  1,209,  0,  0,  0,213,  0,  0,  0,207,  0,  0,  0,211,  0,  0,  0,
-  0,  0,  0,  1, 77,  0,  0,  0,161,  0,  0,  0,208,  0,  0,  0,212,  0,  0,  0,  0,  0,  0,  1,209,  0,  0,  0,162,  0,  0,  0,
- 78,  0,  0,  0,213,  0,  0,  0,  0,  0,  0,  1,128,  0,  0,  0,127,  0,  0,  0, 70,  0,  0,  0,219,  0,  0,  0,  0,  0,  0,  1,
- 70,  0,  0,  0,127,  0,  0,  0,129,  0,  0,  0,220,  0,  0,  0,  0,  0,  0,  1,130,  0,  0,  0,128,  0,  0,  0,219,  0,  0,  0,
-217,  0,  0,  0,  0,  0,  0,  1,220,  0,  0,  0,129,  0,  0,  0,131,  0,  0,  0,218,  0,  0,  0,  0,  0,  0,  1,132,  0,  0,  0,
-130,  0,  0,  0,217,  0,  0,  0,215,  0,  0,  0,  0,  0,  0,  1,218,  0,  0,  0,131,  0,  0,  0,133,  0,  0,  0,216,  0,  0,  0,
-  0,  0,  0,  1,134,  0,  0,  0,132,  0,  0,  0,215,  0,  0,  0,214,  0,  0,  0,  0,  0,  0,  1,216,  0,  0,  0,133,  0,  0,  0,
-134,  0,  0,  0,214,  0,  0,  0,  0,  0,  0,  1,214,  0,  0,  0,215,  0,  0,  0,226,  0,  0,  0,228,  0,  0,  0,  0,  0,  0,  1,
-227,  0,  0,  0,216,  0,  0,  0,214,  0,  0,  0,228,  0,  0,  0,  0,  0,  0,  1,215,  0,  0,  0,217,  0,  0,  0,224,  0,  0,  0,
-226,  0,  0,  0,  0,  0,  0,  1,225,  0,  0,  0,218,  0,  0,  0,216,  0,  0,  0,227,  0,  0,  0,  0,  0,  0,  1,217,  0,  0,  0,
-219,  0,  0,  0,222,  0,  0,  0,224,  0,  0,  0,  0,  0,  0,  1,223,  0,  0,  0,220,  0,  0,  0,218,  0,  0,  0,225,  0,  0,  0,
-  0,  0,  0,  1,219,  0,  0,  0, 70,  0,  0,  0,221,  0,  0,  0,222,  0,  0,  0,  0,  0,  0,  1,221,  0,  0,  0, 70,  0,  0,  0,
-220,  0,  0,  0,223,  0,  0,  0,  0,  0,  0,  1,221,  0,  0,  0,228,  0,  0,  0,226,  0,  0,  0,222,  0,  0,  0,  0,  0,  0,  1,
-227,  0,  0,  0,228,  0,  0,  0,221,  0,  0,  0,223,  0,  0,  0,  0,  0,  0,  1,222,  0,  0,  0,226,  0,  0,  0,224,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  1,225,  0,  0,  0,227,  0,  0,  0,223,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,180,  0,  0,  0,
-178,  0,  0,  0,231,  0,  0,  0,229,  0,  0,  0,  0,  0,  0,  1,232,  0,  0,  0,179,  0,  0,  0,181,  0,  0,  0,230,  0,  0,  0,
-  0,  0,  0,  1,110,  0,  0,  0,180,  0,  0,  0,229,  0,  0,  0,251,  0,  0,  0,  0,  0,  0,  1,230,  0,  0,  0,181,  0,  0,  0,
-111,  0,  0,  0,252,  0,  0,  0,  0,  0,  0,  1,108,  0,  0,  0,110,  0,  0,  0,251,  0,  0,  0,253,  0,  0,  0,  0,  0,  0,  1,
-252,  0,  0,  0,111,  0,  0,  0,109,  0,  0,  0,254,  0,  0,  0,  0,  0,  0,  1,178,  0,  0,  0, 14,  0,  0,  0,249,  0,  0,  0,
-231,  0,  0,  0,  0,  0,  0,  1,250,  0,  0,  0,112,  0,  0,  0,179,  0,  0,  0,232,  0,  0,  0,  0,  0,  0,  1, 14,  0,  0,  0,
-113,  0,  0,  0,247,  0,  0,  0,249,  0,  0,  0,  0,  0,  0,  1,248,  0,  0,  0,114,  0,  0,  0,112,  0,  0,  0,250,  0,  0,  0,
-  0,  0,  0,  1,113,  0,  0,  0,115,  0,  0,  0,245,  0,  0,  0,247,  0,  0,  0,  0,  0,  0,  1,246,  0,  0,  0,116,  0,  0,  0,
-114,  0,  0,  0,248,  0,  0,  0,  0,  0,  0,  1,115,  0,  0,  0,117,  0,  0,  0,243,  0,  0,  0,245,  0,  0,  0,  0,  0,  0,  1,
-244,  0,  0,  0,118,  0,  0,  0,116,  0,  0,  0,246,  0,  0,  0,  0,  0,  0,  1,117,  0,  0,  0,119,  0,  0,  0,241,  0,  0,  0,
-243,  0,  0,  0,  0,  0,  0,  1,242,  0,  0,  0,120,  0,  0,  0,118,  0,  0,  0,244,  0,  0,  0,  0,  0,  0,  1,119,  0,  0,  0,
-121,  0,  0,  0,239,  0,  0,  0,241,  0,  0,  0,  0,  0,  0,  1,240,  0,  0,  0,122,  0,  0,  0,120,  0,  0,  0,242,  0,  0,  0,
-  0,  0,  0,  1,121,  0,  0,  0,123,  0,  0,  0,237,  0,  0,  0,239,  0,  0,  0,  0,  0,  0,  1,238,  0,  0,  0,124,  0,  0,  0,
-122,  0,  0,  0,240,  0,  0,  0,  0,  0,  0,  1,123,  0,  0,  0,176,  0,  0,  0,233,  0,  0,  0,237,  0,  0,  0,  0,  0,  0,  1,
-234,  0,  0,  0,177,  0,  0,  0,124,  0,  0,  0,238,  0,  0,  0,  0,  0,  0,  1,176,  0,  0,  0,125,  0,  0,  0,235,  0,  0,  0,
-233,  0,  0,  0,  0,  0,  0,  1,236,  0,  0,  0,126,  0,  0,  0,177,  0,  0,  0,234,  0,  0,  0,  0,  0,  0,  1,125,  0,  0,  0,
-108,  0,  0,  0,253,  0,  0,  0,235,  0,  0,  0,  0,  0,  0,  1,254,  0,  0,  0,109,  0,  0,  0,126,  0,  0,  0,236,  0,  0,  0,
-  0,  0,  0,  1,235,  0,  0,  0,253,  0,  0,  0,255,  0,  0,  0, 17,  1,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,254,  0,  0,  0,
-236,  0,  0,  0, 18,  1,  0,  0,  0,  0,  0,  1,233,  0,  0,  0,235,  0,  0,  0, 17,  1,  0,  0, 19,  1,  0,  0,  0,  0,  0,  1,
- 18,  1,  0,  0,236,  0,  0,  0,234,  0,  0,  0, 20,  1,  0,  0,  0,  0,  0,  1,237,  0,  0,  0,233,  0,  0,  0, 19,  1,  0,  0,
- 15,  1,  0,  0,  0,  0,  0,  1, 20,  1,  0,  0,234,  0,  0,  0,238,  0,  0,  0, 16,  1,  0,  0,  0,  0,  0,  1,239,  0,  0,  0,
-237,  0,  0,  0, 15,  1,  0,  0, 13,  1,  0,  0,  0,  0,  0,  1, 16,  1,  0,  0,238,  0,  0,  0,240,  0,  0,  0, 14,  1,  0,  0,
-  0,  0,  0,  1,241,  0,  0,  0,239,  0,  0,  0, 13,  1,  0,  0, 11,  1,  0,  0,  0,  0,  0,  1, 14,  1,  0,  0,240,  0,  0,  0,
-242,  0,  0,  0, 12,  1,  0,  0,  0,  0,  0,  1,243,  0,  0,  0,241,  0,  0,  0, 11,  1,  0,  0,  9,  1,  0,  0,  0,  0,  0,  1,
- 12,  1,  0,  0,242,  0,  0,  0,244,  0,  0,  0, 10,  1,  0,  0,  0,  0,  0,  1,245,  0,  0,  0,243,  0,  0,  0,  9,  1,  0,  0,
-  7,  1,  0,  0,  0,  0,  0,  1, 10,  1,  0,  0,244,  0,  0,  0,246,  0,  0,  0,  8,  1,  0,  0,  0,  0,  0,  1,247,  0,  0,  0,
-245,  0,  0,  0,  7,  1,  0,  0,  5,  1,  0,  0,  0,  0,  0,  1,  8,  1,  0,  0,246,  0,  0,  0,248,  0,  0,  0,  6,  1,  0,  0,
-  0,  0,  0,  1,249,  0,  0,  0,247,  0,  0,  0,  5,  1,  0,  0,  3,  1,  0,  0,  0,  0,  0,  1,  6,  1,  0,  0,248,  0,  0,  0,
-250,  0,  0,  0,  4,  1,  0,  0,  0,  0,  0,  1,231,  0,  0,  0,249,  0,  0,  0,  3,  1,  0,  0, 21,  1,  0,  0,  0,  0,  0,  1,
-  4,  1,  0,  0,250,  0,  0,  0,232,  0,  0,  0, 22,  1,  0,  0,  0,  0,  0,  1,253,  0,  0,  0,251,  0,  0,  0,  1,  1,  0,  0,
-255,  0,  0,  0,  0,  0,  0,  1,  2,  1,  0,  0,252,  0,  0,  0,254,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  1,251,  0,  0,  0,
-229,  0,  0,  0, 23,  1,  0,  0,  1,  1,  0,  0,  0,  0,  0,  1, 24,  1,  0,  0,230,  0,  0,  0,252,  0,  0,  0,  2,  1,  0,  0,
-  0,  0,  0,  1,229,  0,  0,  0,231,  0,  0,  0, 21,  1,  0,  0, 23,  1,  0,  0,  0,  0,  0,  1, 22,  1,  0,  0,232,  0,  0,  0,
-230,  0,  0,  0, 24,  1,  0,  0,  0,  0,  0,  1, 65,  0,  0,  0,106,  0,  0,  0, 25,  1,  0,  0, 71,  0,  0,  0,  0,  0,  0,  1,
- 26,  1,  0,  0,107,  0,  0,  0, 65,  0,  0,  0, 71,  0,  0,  0,  0,  0,  0,  1,106,  0,  0,  0,104,  0,  0,  0, 27,  1,  0,  0,
- 25,  1,  0,  0,  0,  0,  0,  1, 28,  1,  0,  0,105,  0,  0,  0,107,  0,  0,  0, 26,  1,  0,  0,  0,  0,  0,  1,104,  0,  0,  0,
-102,  0,  0,  0, 29,  1,  0,  0, 27,  1,  0,  0,  0,  0,  0,  1, 30,  1,  0,  0,103,  0,  0,  0,105,  0,  0,  0, 28,  1,  0,  0,
-  0,  0,  0,  1,102,  0,  0,  0,100,  0,  0,  0, 31,  1,  0,  0, 29,  1,  0,  0,  0,  0,  0,  1, 32,  1,  0,  0,101,  0,  0,  0,
-103,  0,  0,  0, 30,  1,  0,  0,  0,  0,  0,  1,100,  0,  0,  0, 98,  0,  0,  0, 33,  1,  0,  0, 31,  1,  0,  0,  0,  0,  0,  1,
- 34,  1,  0,  0, 99,  0,  0,  0,101,  0,  0,  0, 32,  1,  0,  0,  0,  0,  0,  1, 98,  0,  0,  0, 96,  0,  0,  0, 35,  1,  0,  0,
- 33,  1,  0,  0,  0,  0,  0,  1, 36,  1,  0,  0, 97,  0,  0,  0, 99,  0,  0,  0, 34,  1,  0,  0,  0,  0,  0,  1, 96,  0,  0,  0,
- 94,  0,  0,  0, 37,  1,  0,  0, 35,  1,  0,  0,  0,  0,  0,  1, 38,  1,  0,  0, 95,  0,  0,  0, 97,  0,  0,  0, 36,  1,  0,  0,
-  0,  0,  0,  1, 94,  0,  0,  0, 92,  0,  0,  0, 39,  1,  0,  0, 37,  1,  0,  0,  0,  0,  0,  1, 40,  1,  0,  0, 93,  0,  0,  0,
- 95,  0,  0,  0, 38,  1,  0,  0,  0,  0,  0,  1, 92,  0,  0,  0, 90,  0,  0,  0, 41,  1,  0,  0, 39,  1,  0,  0,  0,  0,  0,  1,
- 42,  1,  0,  0, 91,  0,  0,  0, 93,  0,  0,  0, 40,  1,  0,  0,  0,  0,  0,  1, 49,  1,  0,  0, 50,  1,  0,  0, 69,  1,  0,  0,
- 79,  1,  0,  0,  0,  0,  0,  1, 70,  1,  0,  0, 50,  1,  0,  0, 49,  1,  0,  0, 80,  1,  0,  0,  0,  0,  0,  1, 48,  1,  0,  0,
- 49,  1,  0,  0, 79,  1,  0,  0, 77,  1,  0,  0,  0,  0,  0,  1, 80,  1,  0,  0, 49,  1,  0,  0, 48,  1,  0,  0, 78,  1,  0,  0,
-  0,  0,  0,  1, 47,  1,  0,  0, 48,  1,  0,  0, 77,  1,  0,  0, 81,  1,  0,  0,  0,  0,  0,  1, 78,  1,  0,  0, 48,  1,  0,  0,
- 47,  1,  0,  0, 82,  1,  0,  0,  0,  0,  0,  1, 87,  0,  0,  0, 89,  0,  0,  0, 47,  1,  0,  0, 81,  1,  0,  0,  0,  0,  0,  1,
- 47,  1,  0,  0, 89,  0,  0,  0, 88,  0,  0,  0, 82,  1,  0,  0,  0,  0,  0,  1, 85,  0,  0,  0, 87,  0,  0,  0, 81,  1,  0,  0,
- 75,  1,  0,  0,  0,  0,  0,  1, 82,  1,  0,  0, 88,  0,  0,  0, 86,  0,  0,  0, 76,  1,  0,  0,  0,  0,  0,  1, 83,  0,  0,  0,
- 85,  0,  0,  0, 75,  1,  0,  0, 71,  1,  0,  0,  0,  0,  0,  1, 76,  1,  0,  0, 86,  0,  0,  0, 84,  0,  0,  0, 72,  1,  0,  0,
-  0,  0,  0,  1, 81,  0,  0,  0, 83,  0,  0,  0, 71,  1,  0,  0, 73,  1,  0,  0,  0,  0,  0,  1, 72,  1,  0,  0, 84,  0,  0,  0,
- 82,  0,  0,  0, 74,  1,  0,  0,  0,  0,  0,  1, 71,  1,  0,  0, 77,  1,  0,  0, 79,  1,  0,  0, 73,  1,  0,  0,  0,  0,  0,  1,
- 80,  1,  0,  0, 78,  1,  0,  0, 72,  1,  0,  0, 74,  1,  0,  0,  0,  0,  0,  1, 71,  1,  0,  0, 75,  1,  0,  0, 81,  1,  0,  0,
- 77,  1,  0,  0,  0,  0,  0,  1, 82,  1,  0,  0, 76,  1,  0,  0, 72,  1,  0,  0, 78,  1,  0,  0,  0,  0,  0,  1, 67,  1,  0,  0,
- 73,  1,  0,  0, 79,  1,  0,  0, 69,  1,  0,  0,  0,  0,  0,  1, 80,  1,  0,  0, 74,  1,  0,  0, 68,  1,  0,  0, 70,  1,  0,  0,
-  0,  0,  0,  1, 79,  0,  0,  0, 81,  0,  0,  0, 73,  1,  0,  0, 67,  1,  0,  0,  0,  0,  0,  1, 74,  1,  0,  0, 82,  0,  0,  0,
- 80,  0,  0,  0, 68,  1,  0,  0,  0,  0,  0,  1,206,  0,  0,  0, 83,  1,  0,  0, 85,  1,  0,  0,212,  0,  0,  0,  0,  0,  0,  1,
- 86,  1,  0,  0, 84,  1,  0,  0,207,  0,  0,  0,213,  0,  0,  0,  0,  0,  0,  1, 79,  0,  0,  0, 67,  1,  0,  0, 83,  1,  0,  0,
-206,  0,  0,  0,  0,  0,  0,  1, 84,  1,  0,  0, 68,  1,  0,  0, 80,  0,  0,  0,207,  0,  0,  0,  0,  0,  0,  1, 77,  0,  0,  0,
-212,  0,  0,  0, 85,  1,  0,  0, 87,  1,  0,  0,  0,  0,  0,  1, 86,  1,  0,  0,213,  0,  0,  0, 78,  0,  0,  0, 88,  1,  0,  0,
-  0,  0,  0,  1, 77,  0,  0,  0, 87,  1,  0,  0, 41,  1,  0,  0, 90,  0,  0,  0,  0,  0,  0,  1, 42,  1,  0,  0, 88,  1,  0,  0,
- 78,  0,  0,  0, 91,  0,  0,  0,  0,  0,  0,  1, 75,  0,  0,  0, 65,  1,  0,  0, 93,  1,  0,  0, 45,  1,  0,  0,  0,  0,  0,  1,
- 94,  1,  0,  0, 66,  1,  0,  0, 75,  0,  0,  0, 45,  1,  0,  0,  0,  0,  0,  1, 45,  1,  0,  0, 93,  1,  0,  0, 91,  1,  0,  0,
- 76,  0,  0,  0,  0,  0,  0,  1, 92,  1,  0,  0, 94,  1,  0,  0, 45,  1,  0,  0, 76,  0,  0,  0,  0,  0,  0,  1, 76,  0,  0,  0,
- 91,  1,  0,  0, 89,  1,  0,  0, 46,  1,  0,  0,  0,  0,  0,  1, 90,  1,  0,  0, 92,  1,  0,  0, 76,  0,  0,  0, 46,  1,  0,  0,
-  0,  0,  0,  1, 46,  1,  0,  0, 89,  1,  0,  0, 69,  1,  0,  0, 50,  1,  0,  0,  0,  0,  0,  1, 70,  1,  0,  0, 90,  1,  0,  0,
- 46,  1,  0,  0, 50,  1,  0,  0,  0,  0,  0,  1, 67,  1,  0,  0, 69,  1,  0,  0, 89,  1,  0,  0, 83,  1,  0,  0,  0,  0,  0,  1,
- 90,  1,  0,  0, 70,  1,  0,  0, 68,  1,  0,  0, 84,  1,  0,  0,  0,  0,  0,  1, 37,  1,  0,  0, 39,  1,  0,  0, 59,  1,  0,  0,
- 51,  1,  0,  0,  0,  0,  0,  1, 60,  1,  0,  0, 40,  1,  0,  0, 38,  1,  0,  0, 52,  1,  0,  0,  0,  0,  0,  1, 74,  0,  0,  0,
- 57,  1,  0,  0, 65,  1,  0,  0, 75,  0,  0,  0,  0,  0,  0,  1, 66,  1,  0,  0, 58,  1,  0,  0, 74,  0,  0,  0, 75,  0,  0,  0,
-  0,  0,  0,  1, 43,  1,  0,  0, 99,  1,  0,  0, 97,  1,  0,  0, 44,  1,  0,  0,  0,  0,  0,  1, 98,  1,  0,  0,100,  1,  0,  0,
- 43,  1,  0,  0, 44,  1,  0,  0,  0,  0,  0,  1, 44,  1,  0,  0, 97,  1,  0,  0, 95,  1,  0,  0, 73,  0,  0,  0,  0,  0,  0,  1,
- 96,  1,  0,  0, 98,  1,  0,  0, 44,  1,  0,  0, 73,  0,  0,  0,  0,  0,  0,  1, 73,  0,  0,  0, 95,  1,  0,  0, 57,  1,  0,  0,
- 74,  0,  0,  0,  0,  0,  0,  1, 58,  1,  0,  0, 96,  1,  0,  0, 73,  0,  0,  0, 74,  0,  0,  0,  0,  0,  0,  1, 33,  1,  0,  0,
- 35,  1,  0,  0,103,  1,  0,  0,105,  1,  0,  0,  0,  0,  0,  1,104,  1,  0,  0, 36,  1,  0,  0, 34,  1,  0,  0,106,  1,  0,  0,
-  0,  0,  0,  1,105,  1,  0,  0,103,  1,  0,  0,109,  1,  0,  0,107,  1,  0,  0,  0,  0,  0,  1,110,  1,  0,  0,104,  1,  0,  0,
-106,  1,  0,  0,108,  1,  0,  0,  0,  0,  0,  1,107,  1,  0,  0,109,  1,  0,  0,111,  1,  0,  0,113,  1,  0,  0,  0,  0,  0,  1,
-112,  1,  0,  0,110,  1,  0,  0,108,  1,  0,  0,114,  1,  0,  0,  0,  0,  0,  1,113,  1,  0,  0,111,  1,  0,  0,117,  1,  0,  0,
-115,  1,  0,  0,  0,  0,  0,  1,118,  1,  0,  0,112,  1,  0,  0,114,  1,  0,  0,116,  1,  0,  0,  0,  0,  0,  1, 55,  1,  0,  0,
-119,  1,  0,  0,115,  1,  0,  0,117,  1,  0,  0,  0,  0,  0,  1,116,  1,  0,  0,120,  1,  0,  0, 56,  1,  0,  0,118,  1,  0,  0,
-  0,  0,  0,  1, 57,  1,  0,  0, 95,  1,  0,  0,115,  1,  0,  0,119,  1,  0,  0,  0,  0,  0,  1,116,  1,  0,  0, 96,  1,  0,  0,
- 58,  1,  0,  0,120,  1,  0,  0,  0,  0,  0,  1, 95,  1,  0,  0, 97,  1,  0,  0,113,  1,  0,  0,115,  1,  0,  0,  0,  0,  0,  1,
-114,  1,  0,  0, 98,  1,  0,  0, 96,  1,  0,  0,116,  1,  0,  0,  0,  0,  0,  1, 97,  1,  0,  0, 99,  1,  0,  0,107,  1,  0,  0,
-113,  1,  0,  0,  0,  0,  0,  1,108,  1,  0,  0,100,  1,  0,  0, 98,  1,  0,  0,114,  1,  0,  0,  0,  0,  0,  1, 99,  1,  0,  0,
-101,  1,  0,  0,105,  1,  0,  0,107,  1,  0,  0,  0,  0,  0,  1,106,  1,  0,  0,102,  1,  0,  0,100,  1,  0,  0,108,  1,  0,  0,
-  0,  0,  0,  1, 31,  1,  0,  0, 33,  1,  0,  0,105,  1,  0,  0,101,  1,  0,  0,  0,  0,  0,  1,106,  1,  0,  0, 34,  1,  0,  0,
- 32,  1,  0,  0,102,  1,  0,  0,  0,  0,  0,  1, 72,  0,  0,  0,101,  1,  0,  0, 99,  1,  0,  0, 43,  1,  0,  0,  0,  0,  0,  1,
-100,  1,  0,  0,102,  1,  0,  0, 72,  0,  0,  0, 43,  1,  0,  0,  0,  0,  0,  1, 25,  1,  0,  0, 27,  1,  0,  0, 29,  1,  0,  0,
- 31,  1,  0,  0,  0,  0,  0,  1, 30,  1,  0,  0, 28,  1,  0,  0, 26,  1,  0,  0, 32,  1,  0,  0,  0,  0,  0,  1, 25,  1,  0,  0,
- 31,  1,  0,  0,101,  1,  0,  0, 72,  0,  0,  0,  0,  0,  0,  1,102,  1,  0,  0, 32,  1,  0,  0, 26,  1,  0,  0, 72,  0,  0,  0,
-  0,  0,  0,  1, 71,  0,  0,  0, 25,  1,  0,  0, 72,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1, 72,  0,  0,  0, 26,  1,  0,  0,
- 71,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1, 35,  1,  0,  0, 37,  1,  0,  0, 51,  1,  0,  0,103,  1,  0,  0,  0,  0,  0,  1,
- 52,  1,  0,  0, 38,  1,  0,  0, 36,  1,  0,  0,104,  1,  0,  0,  0,  0,  0,  1, 51,  1,  0,  0, 53,  1,  0,  0,109,  1,  0,  0,
-103,  1,  0,  0,  0,  0,  0,  1,110,  1,  0,  0, 54,  1,  0,  0, 52,  1,  0,  0,104,  1,  0,  0,  0,  0,  0,  1, 53,  1,  0,  0,
-123,  1,  0,  0,111,  1,  0,  0,109,  1,  0,  0,  0,  0,  0,  1,112,  1,  0,  0,124,  1,  0,  0, 54,  1,  0,  0,110,  1,  0,  0,
-  0,  0,  0,  1, 55,  1,  0,  0,117,  1,  0,  0,111,  1,  0,  0,123,  1,  0,  0,  0,  0,  0,  1,112,  1,  0,  0,118,  1,  0,  0,
- 56,  1,  0,  0,124,  1,  0,  0,  0,  0,  0,  1, 89,  1,  0,  0, 91,  1,  0,  0,127,  1,  0,  0,125,  1,  0,  0,  0,  0,  0,  1,
-128,  1,  0,  0, 92,  1,  0,  0, 90,  1,  0,  0,126,  1,  0,  0,  0,  0,  0,  1, 59,  1,  0,  0,125,  1,  0,  0,127,  1,  0,  0,
- 61,  1,  0,  0,  0,  0,  0,  1,128,  1,  0,  0,126,  1,  0,  0, 60,  1,  0,  0, 62,  1,  0,  0,  0,  0,  0,  1, 39,  1,  0,  0,
- 41,  1,  0,  0,125,  1,  0,  0, 59,  1,  0,  0,  0,  0,  0,  1,126,  1,  0,  0, 42,  1,  0,  0, 40,  1,  0,  0, 60,  1,  0,  0,
-  0,  0,  0,  1, 41,  1,  0,  0, 85,  1,  0,  0, 83,  1,  0,  0,125,  1,  0,  0,  0,  0,  0,  1, 84,  1,  0,  0, 86,  1,  0,  0,
- 42,  1,  0,  0,126,  1,  0,  0,  0,  0,  0,  1, 83,  1,  0,  0, 89,  1,  0,  0,125,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,
-126,  1,  0,  0, 90,  1,  0,  0, 84,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1, 41,  1,  0,  0, 87,  1,  0,  0, 85,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  1, 86,  1,  0,  0, 88,  1,  0,  0, 42,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1, 55,  1,  0,  0,
- 63,  1,  0,  0,121,  1,  0,  0,119,  1,  0,  0,  0,  0,  0,  1,122,  1,  0,  0, 64,  1,  0,  0, 56,  1,  0,  0,120,  1,  0,  0,
-  0,  0,  0,  1, 57,  1,  0,  0,119,  1,  0,  0,121,  1,  0,  0, 65,  1,  0,  0,  0,  0,  0,  1,122,  1,  0,  0,120,  1,  0,  0,
- 58,  1,  0,  0, 66,  1,  0,  0,  0,  0,  0,  1, 61,  1,  0,  0,127,  1,  0,  0,121,  1,  0,  0, 63,  1,  0,  0,  0,  0,  0,  1,
-122,  1,  0,  0,128,  1,  0,  0, 62,  1,  0,  0, 64,  1,  0,  0,  0,  0,  0,  1, 91,  1,  0,  0, 93,  1,  0,  0,121,  1,  0,  0,
-127,  1,  0,  0,  0,  0,  0,  1,122,  1,  0,  0, 94,  1,  0,  0, 92,  1,  0,  0,128,  1,  0,  0,  0,  0,  0,  1, 65,  1,  0,  0,
-121,  1,  0,  0, 93,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1, 94,  1,  0,  0,122,  1,  0,  0, 66,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  1,141,  1,  0,  0,129,  1,  0,  0,155,  1,  0,  0,143,  1,  0,  0,  0,  0,  0,  1,156,  1,  0,  0,130,  1,  0,  0,
-142,  1,  0,  0,144,  1,  0,  0,  0,  0,  0,  1,141,  1,  0,  0,143,  1,  0,  0,145,  1,  0,  0,139,  1,  0,  0,  0,  0,  0,  1,
-146,  1,  0,  0,144,  1,  0,  0,142,  1,  0,  0,140,  1,  0,  0,  0,  0,  0,  1,139,  1,  0,  0,145,  1,  0,  0,147,  1,  0,  0,
-137,  1,  0,  0,  0,  0,  0,  1,148,  1,  0,  0,146,  1,  0,  0,140,  1,  0,  0,138,  1,  0,  0,  0,  0,  0,  1,137,  1,  0,  0,
-147,  1,  0,  0,149,  1,  0,  0,135,  1,  0,  0,  0,  0,  0,  1,150,  1,  0,  0,148,  1,  0,  0,138,  1,  0,  0,136,  1,  0,  0,
-  0,  0,  0,  1,135,  1,  0,  0,149,  1,  0,  0,151,  1,  0,  0,133,  1,  0,  0,  0,  0,  0,  1,152,  1,  0,  0,150,  1,  0,  0,
-136,  1,  0,  0,134,  1,  0,  0,  0,  0,  0,  1,133,  1,  0,  0,151,  1,  0,  0,153,  1,  0,  0,131,  1,  0,  0,  0,  0,  0,  1,
-154,  1,  0,  0,152,  1,  0,  0,134,  1,  0,  0,132,  1,  0,  0,  0,  0,  0,  1,151,  1,  0,  0,161,  1,  0,  0,159,  1,  0,  0,
-153,  1,  0,  0,  0,  0,  0,  1,160,  1,  0,  0,162,  1,  0,  0,152,  1,  0,  0,154,  1,  0,  0,  0,  0,  0,  1,149,  1,  0,  0,
-163,  1,  0,  0,161,  1,  0,  0,151,  1,  0,  0,  0,  0,  0,  1,162,  1,  0,  0,164,  1,  0,  0,150,  1,  0,  0,152,  1,  0,  0,
-  0,  0,  0,  1,147,  1,  0,  0,165,  1,  0,  0,163,  1,  0,  0,149,  1,  0,  0,  0,  0,  0,  1,164,  1,  0,  0,166,  1,  0,  0,
-148,  1,  0,  0,150,  1,  0,  0,  0,  0,  0,  1,145,  1,  0,  0,167,  1,  0,  0,165,  1,  0,  0,147,  1,  0,  0,  0,  0,  0,  1,
-166,  1,  0,  0,168,  1,  0,  0,146,  1,  0,  0,148,  1,  0,  0,  0,  0,  0,  1,143,  1,  0,  0,169,  1,  0,  0,167,  1,  0,  0,
-145,  1,  0,  0,  0,  0,  0,  1,168,  1,  0,  0,170,  1,  0,  0,144,  1,  0,  0,146,  1,  0,  0,  0,  0,  0,  1,143,  1,  0,  0,
-155,  1,  0,  0,157,  1,  0,  0,169,  1,  0,  0,  0,  0,  0,  1,158,  1,  0,  0,156,  1,  0,  0,144,  1,  0,  0,170,  1,  0,  0,
-  0,  0,  0,  1, 59,  1,  0,  0, 61,  1,  0,  0,185,  1,  0,  0,183,  1,  0,  0,  0,  0,  0,  1,186,  1,  0,  0, 62,  1,  0,  0,
- 60,  1,  0,  0,184,  1,  0,  0,  0,  0,  0,  1, 61,  1,  0,  0,131,  1,  0,  0,153,  1,  0,  0,185,  1,  0,  0,  0,  0,  0,  1,
-154,  1,  0,  0,132,  1,  0,  0, 62,  1,  0,  0,186,  1,  0,  0,  0,  0,  0,  1, 51,  1,  0,  0, 59,  1,  0,  0,183,  1,  0,  0,
- 53,  1,  0,  0,  0,  0,  0,  1,184,  1,  0,  0, 60,  1,  0,  0, 52,  1,  0,  0, 54,  1,  0,  0,  0,  0,  0,  1,123,  1,  0,  0,
-171,  1,  0,  0,155,  1,  0,  0,129,  1,  0,  0,  0,  0,  0,  1,156,  1,  0,  0,172,  1,  0,  0,124,  1,  0,  0,130,  1,  0,  0,
-  0,  0,  0,  1,153,  1,  0,  0,159,  1,  0,  0,181,  1,  0,  0,185,  1,  0,  0,  0,  0,  0,  1,182,  1,  0,  0,160,  1,  0,  0,
-154,  1,  0,  0,186,  1,  0,  0,  0,  0,  0,  1,179,  1,  0,  0,187,  1,  0,  0,185,  1,  0,  0,181,  1,  0,  0,  0,  0,  0,  1,
-186,  1,  0,  0,188,  1,  0,  0,180,  1,  0,  0,182,  1,  0,  0,  0,  0,  0,  1,175,  1,  0,  0,187,  1,  0,  0,179,  1,  0,  0,
-177,  1,  0,  0,  0,  0,  0,  1,180,  1,  0,  0,188,  1,  0,  0,176,  1,  0,  0,178,  1,  0,  0,  0,  0,  0,  1,173,  1,  0,  0,
-189,  1,  0,  0,187,  1,  0,  0,175,  1,  0,  0,  0,  0,  0,  1,188,  1,  0,  0,190,  1,  0,  0,174,  1,  0,  0,176,  1,  0,  0,
-  0,  0,  0,  1,171,  1,  0,  0,189,  1,  0,  0,173,  1,  0,  0,191,  1,  0,  0,  0,  0,  0,  1,174,  1,  0,  0,190,  1,  0,  0,
-172,  1,  0,  0,192,  1,  0,  0,  0,  0,  0,  1,155,  1,  0,  0,171,  1,  0,  0,191,  1,  0,  0,157,  1,  0,  0,  0,  0,  0,  1,
-192,  1,  0,  0,172,  1,  0,  0,156,  1,  0,  0,158,  1,  0,  0,  0,  0,  0,  1, 53,  1,  0,  0,189,  1,  0,  0,171,  1,  0,  0,
-123,  1,  0,  0,  0,  0,  0,  1,172,  1,  0,  0,190,  1,  0,  0, 54,  1,  0,  0,124,  1,  0,  0,  0,  0,  0,  1, 53,  1,  0,  0,
-183,  1,  0,  0,187,  1,  0,  0,189,  1,  0,  0,  0,  0,  0,  1,188,  1,  0,  0,184,  1,  0,  0, 54,  1,  0,  0,190,  1,  0,  0,
-  0,  0,  0,  1,183,  1,  0,  0,185,  1,  0,  0,187,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,188,  1,  0,  0,186,  1,  0,  0,
-184,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,157,  1,  0,  0,191,  1,  0,  0,193,  1,  0,  0,217,  1,  0,  0,  0,  0,  0,  1,
-194,  1,  0,  0,192,  1,  0,  0,158,  1,  0,  0,218,  1,  0,  0,  0,  0,  0,  1,191,  1,  0,  0,173,  1,  0,  0,203,  1,  0,  0,
-193,  1,  0,  0,  0,  0,  0,  1,204,  1,  0,  0,174,  1,  0,  0,192,  1,  0,  0,194,  1,  0,  0,  0,  0,  0,  1,173,  1,  0,  0,
-175,  1,  0,  0,201,  1,  0,  0,203,  1,  0,  0,  0,  0,  0,  1,202,  1,  0,  0,176,  1,  0,  0,174,  1,  0,  0,204,  1,  0,  0,
-  0,  0,  0,  1,175,  1,  0,  0,177,  1,  0,  0,199,  1,  0,  0,201,  1,  0,  0,  0,  0,  0,  1,200,  1,  0,  0,178,  1,  0,  0,
-176,  1,  0,  0,202,  1,  0,  0,  0,  0,  0,  1,177,  1,  0,  0,179,  1,  0,  0,197,  1,  0,  0,199,  1,  0,  0,  0,  0,  0,  1,
-198,  1,  0,  0,180,  1,  0,  0,178,  1,  0,  0,200,  1,  0,  0,  0,  0,  0,  1,179,  1,  0,  0,181,  1,  0,  0,195,  1,  0,  0,
-197,  1,  0,  0,  0,  0,  0,  1,196,  1,  0,  0,182,  1,  0,  0,180,  1,  0,  0,198,  1,  0,  0,  0,  0,  0,  1,181,  1,  0,  0,
-159,  1,  0,  0,215,  1,  0,  0,195,  1,  0,  0,  0,  0,  0,  1,216,  1,  0,  0,160,  1,  0,  0,182,  1,  0,  0,196,  1,  0,  0,
-  0,  0,  0,  1,169,  1,  0,  0,157,  1,  0,  0,217,  1,  0,  0,205,  1,  0,  0,  0,  0,  0,  1,218,  1,  0,  0,158,  1,  0,  0,
-170,  1,  0,  0,206,  1,  0,  0,  0,  0,  0,  1,167,  1,  0,  0,169,  1,  0,  0,205,  1,  0,  0,207,  1,  0,  0,  0,  0,  0,  1,
-206,  1,  0,  0,170,  1,  0,  0,168,  1,  0,  0,208,  1,  0,  0,  0,  0,  0,  1,165,  1,  0,  0,167,  1,  0,  0,207,  1,  0,  0,
-209,  1,  0,  0,  0,  0,  0,  1,208,  1,  0,  0,168,  1,  0,  0,166,  1,  0,  0,210,  1,  0,  0,  0,  0,  0,  1,163,  1,  0,  0,
-165,  1,  0,  0,209,  1,  0,  0,211,  1,  0,  0,  0,  0,  0,  1,210,  1,  0,  0,166,  1,  0,  0,164,  1,  0,  0,212,  1,  0,  0,
-  0,  0,  0,  1,161,  1,  0,  0,163,  1,  0,  0,211,  1,  0,  0,213,  1,  0,  0,  0,  0,  0,  1,212,  1,  0,  0,164,  1,  0,  0,
-162,  1,  0,  0,214,  1,  0,  0,  0,  0,  0,  1,159,  1,  0,  0,161,  1,  0,  0,213,  1,  0,  0,215,  1,  0,  0,  0,  0,  0,  1,
-214,  1,  0,  0,162,  1,  0,  0,160,  1,  0,  0,216,  1,  0,  0,  0,  0,  0,  1,199,  1,  0,  0,197,  1,  0,  0,221,  1,  0,  0,
-219,  1,  0,  0,  0,  0,  0,  1,222,  1,  0,  0,198,  1,  0,  0,200,  1,  0,  0,220,  1,  0,  0,  0,  0,  0,  1,219,  1,  0,  0,
-221,  1,  0,  0,223,  1,  0,  0,225,  1,  0,  0,  0,  0,  0,  1,224,  1,  0,  0,222,  1,  0,  0,220,  1,  0,  0,226,  1,  0,  0,
-  0,  0,  0,  1,225,  1,  0,  0,223,  1,  0,  0,229,  1,  0,  0,227,  1,  0,  0,  0,  0,  0,  1,230,  1,  0,  0,224,  1,  0,  0,
-226,  1,  0,  0,228,  1,  0,  0,  0,  0,  0,  1,227,  1,  0,  0,229,  1,  0,  0,231,  1,  0,  0,233,  1,  0,  0,  0,  0,  0,  1,
-232,  1,  0,  0,230,  1,  0,  0,228,  1,  0,  0,234,  1,  0,  0,  0,  0,  0,  1,205,  1,  0,  0,217,  1,  0,  0,227,  1,  0,  0,
-233,  1,  0,  0,  0,  0,  0,  1,228,  1,  0,  0,218,  1,  0,  0,206,  1,  0,  0,234,  1,  0,  0,  0,  0,  0,  1,193,  1,  0,  0,
-225,  1,  0,  0,227,  1,  0,  0,217,  1,  0,  0,  0,  0,  0,  1,228,  1,  0,  0,226,  1,  0,  0,194,  1,  0,  0,218,  1,  0,  0,
-  0,  0,  0,  1,193,  1,  0,  0,203,  1,  0,  0,219,  1,  0,  0,225,  1,  0,  0,  0,  0,  0,  1,220,  1,  0,  0,204,  1,  0,  0,
-194,  1,  0,  0,226,  1,  0,  0,  0,  0,  0,  1,199,  1,  0,  0,219,  1,  0,  0,203,  1,  0,  0,201,  1,  0,  0,  0,  0,  0,  1,
-204,  1,  0,  0,220,  1,  0,  0,200,  1,  0,  0,202,  1,  0,  0,  0,  0,  0,  1,195,  1,  0,  0,215,  1,  0,  0,221,  1,  0,  0,
-197,  1,  0,  0,  0,  0,  0,  1,222,  1,  0,  0,216,  1,  0,  0,196,  1,  0,  0,198,  1,  0,  0,  0,  0,  0,  1,213,  1,  0,  0,
-223,  1,  0,  0,221,  1,  0,  0,215,  1,  0,  0,  0,  0,  0,  1,222,  1,  0,  0,224,  1,  0,  0,214,  1,  0,  0,216,  1,  0,  0,
-  0,  0,  0,  1,211,  1,  0,  0,229,  1,  0,  0,223,  1,  0,  0,213,  1,  0,  0,  0,  0,  0,  1,224,  1,  0,  0,230,  1,  0,  0,
-212,  1,  0,  0,214,  1,  0,  0,  0,  0,  0,  1,209,  1,  0,  0,231,  1,  0,  0,229,  1,  0,  0,211,  1,  0,  0,  0,  0,  0,  1,
-230,  1,  0,  0,232,  1,  0,  0,210,  1,  0,  0,212,  1,  0,  0,  0,  0,  0,  1,207,  1,  0,  0,233,  1,  0,  0,231,  1,  0,  0,
-209,  1,  0,  0,  0,  0,  0,  1,232,  1,  0,  0,234,  1,  0,  0,208,  1,  0,  0,210,  1,  0,  0,  0,  0,  0,  1,205,  1,  0,  0,
-233,  1,  0,  0,207,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,208,  1,  0,  0,234,  1,  0,  0,206,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  1,133,  1,  0,  0,131,  1,  0,  0,245,  1,  0,  0,243,  1,  0,  0,  0,  0,  0,  1,246,  1,  0,  0,132,  1,  0,  0,
-134,  1,  0,  0,244,  1,  0,  0,  0,  0,  0,  1,135,  1,  0,  0,133,  1,  0,  0,243,  1,  0,  0,241,  1,  0,  0,  0,  0,  0,  1,
-244,  1,  0,  0,134,  1,  0,  0,136,  1,  0,  0,242,  1,  0,  0,  0,  0,  0,  1,137,  1,  0,  0,135,  1,  0,  0,241,  1,  0,  0,
-239,  1,  0,  0,  0,  0,  0,  1,242,  1,  0,  0,136,  1,  0,  0,138,  1,  0,  0,240,  1,  0,  0,  0,  0,  0,  1,139,  1,  0,  0,
-137,  1,  0,  0,239,  1,  0,  0,237,  1,  0,  0,  0,  0,  0,  1,240,  1,  0,  0,138,  1,  0,  0,140,  1,  0,  0,238,  1,  0,  0,
-  0,  0,  0,  1,141,  1,  0,  0,139,  1,  0,  0,237,  1,  0,  0,235,  1,  0,  0,  0,  0,  0,  1,238,  1,  0,  0,140,  1,  0,  0,
-142,  1,  0,  0,236,  1,  0,  0,  0,  0,  0,  1,129,  1,  0,  0,141,  1,  0,  0,235,  1,  0,  0,247,  1,  0,  0,  0,  0,  0,  1,
-236,  1,  0,  0,142,  1,  0,  0,130,  1,  0,  0,248,  1,  0,  0,  0,  0,  0,  1,235,  1,  0,  0,243,  1,  0,  0,245,  1,  0,  0,
-247,  1,  0,  0,  0,  0,  0,  1,246,  1,  0,  0,244,  1,  0,  0,236,  1,  0,  0,248,  1,  0,  0,  0,  0,  0,  1,235,  1,  0,  0,
-237,  1,  0,  0,241,  1,  0,  0,243,  1,  0,  0,  0,  0,  0,  1,242,  1,  0,  0,238,  1,  0,  0,236,  1,  0,  0,244,  1,  0,  0,
-  0,  0,  0,  1,237,  1,  0,  0,239,  1,  0,  0,241,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,242,  1,  0,  0,240,  1,  0,  0,
-238,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1, 55,  1,  0,  0,123,  1,  0,  0,129,  1,  0,  0,247,  1,  0,  0,  0,  0,  0,  1,
-130,  1,  0,  0,124,  1,  0,  0, 56,  1,  0,  0,248,  1,  0,  0,  0,  0,  0,  1, 55,  1,  0,  0,247,  1,  0,  0,245,  1,  0,  0,
- 63,  1,  0,  0,  0,  0,  0,  1,246,  1,  0,  0,248,  1,  0,  0, 56,  1,  0,  0, 64,  1,  0,  0,  0,  0,  0,  1, 61,  1,  0,  0,
- 63,  1,  0,  0,245,  1,  0,  0,131,  1,  0,  0,  0,  0,  0,  1,246,  1,  0,  0, 64,  1,  0,  0, 62,  1,  0,  0,132,  1,  0,  0,
-  0,  0,  0,  1, 68, 65, 84, 65,192, 93,  0,  0,152,238, 52,  3,  0,  0,  0,  0, 59,  0,  0,  0,244,  1,  0,  0,  3,112, 28, 63,
-185,178,236, 62,224,124, 27, 63,235, 65,232, 62,144, 63, 30, 63,233,195,226, 62,118,152, 32, 63, 37,167,236, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,  2,232,209, 62,222, 21,226, 62,102,109,215, 62,222,147,231, 62, 28,135,213, 62,
-172,  4,236, 62, 56, 54,205, 62, 22,249,235, 62,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,118,152, 32, 63,
- 37,167,236, 62,144, 63, 30, 63,233,195,226, 62,108,235, 33, 63,197,235,220, 62,209,151, 37, 63, 89,161,236, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 76,144,202, 62,186, 61,220, 62,  2,232,209, 62,222, 21,226, 62, 56, 54,205, 62,
- 22,249,235, 62,128, 55,195, 62, 70,243,235, 62,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,144, 63, 30, 63,
-233,195,226, 62, 20, 55, 25, 63,  1, 35,223, 62,200,178, 25, 63, 77,233,214, 62,108,235, 33, 63,197,235,220, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,146,  1,219, 62, 66, 59,214, 62,248,248,219, 62,246,116,222, 62,  2,232,209, 62,
-222, 21,226, 62, 76,144,202, 62,186, 61,220, 62,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,224,124, 27, 63,
-235, 65,232, 62, 87,252, 24, 63, 93,111,230, 62, 20, 55, 25, 63,  1, 35,223, 62,144, 63, 30, 63,233,195,226, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,248,248,219, 62,246,116,222, 62,118,110,220, 62, 78,193,229, 62,102,109,215, 62,
-222,147,231, 62,  2,232,209, 62,222, 21,226, 62,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0, 87,252, 24, 63,
- 93,111,230, 62, 22,195, 22, 63,195, 90,232, 62,191, 91, 20, 63,193, 18,227, 62, 20, 55, 25, 63,  1, 35,223, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,162,175,229, 62,178,100,226, 62,248,224,224, 62,182,172,231, 62,118,110,220, 62,
- 78,193,229, 62,248,248,219, 62,246,116,222, 62,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0, 20, 55, 25, 63,
-  1, 35,223, 62,191, 91, 20, 63,193, 18,227, 62,187,165, 17, 63,225,  6,221, 62,200,178, 25, 63, 77,233,214, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,170, 27,235, 62,214, 88,220, 62,162,175,229, 62,178,100,226, 62,248,248,219, 62,
-246,116,222, 62,146,  1,219, 62, 66, 59,214, 62,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,191, 91, 20, 63,
-193, 18,227, 62,164, 18, 18, 63,173,201,236, 62,157,231, 13, 63, 89,161,236, 62,187,165, 17, 63,225,  6,221, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,232,151,242, 62, 70,243,235, 62,216, 65,234, 62,158, 27,236, 62,162,175,229, 62,
-178,100,226, 62,170, 27,235, 62,214, 88,220, 62,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0, 22,195, 22, 63,
-195, 90,232, 62, 11,202, 21, 63,  1,189,236, 62,164, 18, 18, 63,173,201,236, 62,191, 91, 20, 63,193, 18,227, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,216, 65,234, 62,158, 27,236, 62, 12,211,226, 62,246, 14,236, 62,248,224,224, 62,
-182,172,231, 62,162,175,229, 62,178,100,226, 62,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0, 11,202, 21, 63,
-  1,189,236, 62,215,202, 22, 63,237,124,241, 62,125,105, 20, 63,  1, 71,246, 62,164, 18, 18, 63,173,201,236, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 42,148,229, 62,246,152,245, 62,112,209,224, 62,226,206,240, 62, 12,211,226, 62,
-246, 14,236, 62,216, 65,234, 62,158, 27,236, 62,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,164, 18, 18, 63,
-173,201,236, 62,125,105, 20, 63,  1, 71,246, 62, 44,173, 17, 63,231,149,252, 62,157,231, 13, 63, 89,161,236, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,206, 12,235, 62,218,231,251, 62, 42,148,229, 62,246,152,245, 62,216, 65,234, 62,
-158, 27,236, 62,232,151,242, 62, 70,243,235, 62,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,125,105, 20, 63,
-  1, 71,246, 62, 37, 59, 25, 63, 49, 73,250, 62,108,178, 25, 63,218,108,  1, 63, 44,173, 17, 63,231,149,252, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 76,  2,219, 62,213, 21,  1, 63,216,240,219, 62, 38,155,249, 62, 42,148,229, 62,
-246,152,245, 62,206, 12,235, 62,218,231,251, 62,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,215,202, 22, 63,
-237,124,241, 62,195,  1, 25, 63,169,102,243, 62, 37, 59, 25, 63, 49, 73,250, 62,125,105, 20, 63,  1, 71,246, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,216,240,219, 62, 38,155,249, 62,156, 99,220, 62,154,184,242, 62,112,209,224, 62,
-226,206,240, 62, 42,148,229, 62,246,152,245, 62,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,195,  1, 25, 63,
-169,102,243, 62,176,125, 27, 63,149,145,241, 62,167, 74, 30, 63,  3,153,246, 62, 37, 59, 25, 63, 49, 73,250, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,212,209,209, 62,246,234,245, 62,192,107,215, 62,138,227,240, 62,156, 99,220, 62,
-154,184,242, 62,216,240,219, 62, 38,155,249, 62,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0, 37, 59, 25, 63,
- 49, 73,250, 62,167, 74, 30, 63,  3,153,246, 62,204,230, 33, 63,107,232,252, 62,108,178, 25, 63,218,108,  1, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,132,153,202, 62, 94, 58,252, 62,212,209,209, 62,246,234,245, 62,216,240,219, 62,
- 38,155,249, 62, 76,  2,219, 62,213, 21,  1, 63,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,167, 74, 30, 63,
-  3,153,246, 62,118,152, 32, 63, 37,167,236, 62,209,151, 37, 63, 89,161,236, 62,204,230, 33, 63,107,232,252, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,128, 55,195, 62, 70,243,235, 62, 56, 54,205, 62, 22,249,235, 62,212,209,209, 62,
-246,234,245, 62,132,153,202, 62, 94, 58,252, 62,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,176,125, 27, 63,
-149,145,241, 62,  3,112, 28, 63,185,178,236, 62,118,152, 32, 63, 37,167,236, 62,167, 74, 30, 63,  3,153,246, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 56, 54,205, 62, 22,249,235, 62, 28,135,213, 62,172,  4,236, 62,192,107,215, 62,
-138,227,240, 62,212,209,209, 62,246,234,245, 62,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,  3,112, 28, 63,
-185,178,236, 62,176,125, 27, 63,149,145,241, 62, 42, 39, 27, 63, 57,  1,241, 62,140,249, 27, 63,115,186,236, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,206, 24,216, 62, 46, 83,240, 62,192,107,215, 62,138,227,240, 62, 28,135,213, 62,
-172,  4,236, 62,  8,116,214, 62,102, 12,236, 62,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,176,125, 27, 63,
-149,145,241, 62,195,  1, 25, 63,169,102,243, 62,  6,248, 24, 63,185, 91,242, 62, 42, 39, 27, 63, 57,  1,241, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 22,119,220, 62,174,173,241, 62,156, 99,220, 62,154,184,242, 62,192,107,215, 62,
-138,227,240, 62,206, 24,216, 62, 46, 83,240, 62,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,195,  1, 25, 63,
-169,102,243, 62,215,202, 22, 63,237,124,241, 62,157, 38, 23, 63,225,173,240, 62,  6,248, 24, 63,185, 91,242, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,234, 25,224, 62,214,255,239, 62,112,209,224, 62,226,206,240, 62,156, 99,220, 62,
-154,184,242, 62, 22,119,220, 62,174,173,241, 62,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,215,202, 22, 63,
-237,124,241, 62, 11,202, 21, 63,  1,189,236, 62, 13, 89, 22, 63,247,196,236, 62,157, 38, 23, 63,225,173,240, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,  8,181,225, 62,234, 22,236, 62, 12,211,226, 62,246, 14,236, 62,112,209,224, 62,
-226,206,240, 62,234, 25,224, 62,214,255,239, 62,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0, 11,202, 21, 63,
-  1,189,236, 62, 22,195, 22, 63,195, 90,232, 62, 88, 33, 23, 63, 69, 47,233, 62, 13, 89, 22, 63,247,196,236, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,112, 36,224, 62, 58,129,232, 62,248,224,224, 62,182,172,231, 62, 12,211,226, 62,
-246, 14,236, 62,  8,181,225, 62,234, 22,236, 62,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0, 22,195, 22, 63,
-195, 90,232, 62, 87,252, 24, 63, 93,111,230, 62,100,243, 24, 63,  5,123,231, 62, 88, 33, 23, 63, 69, 47,233, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 90,128,220, 62,248,204,230, 62,118,110,220, 62, 78,193,229, 62,248,224,224, 62,
-182,172,231, 62,112, 36,224, 62, 58,129,232, 62,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0, 87,252, 24, 63,
- 93,111,230, 62,224,124, 27, 63,235, 65,232, 62,169, 37, 27, 63, 35,211,232, 62,100,243, 24, 63,  5,123,231, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,206, 27,216, 62, 22, 37,232, 62,102,109,215, 62,222,147,231, 62,118,110,220, 62,
- 78,193,229, 62, 90,128,220, 62,248,204,230, 62,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,224,124, 27, 63,
-235, 65,232, 62,  3,112, 28, 63,185,178,236, 62,140,249, 27, 63,115,186,236, 62,169, 37, 27, 63, 35,211,232, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,  8,116,214, 62,102, 12,236, 62, 28,135,213, 62,172,  4,236, 62,102,109,215, 62,
-222,147,231, 62,206, 27,216, 62, 22, 37,232, 62,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,138,242, 24, 63,
- 21,194,236, 62,169, 37, 27, 63, 35,211,232, 62,140,249, 27, 63,115,186,236, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,112,  0,  8,116,214, 62,102, 12,236, 62,206, 27,216, 62, 22, 37,232, 62, 16,130,220, 62,
-  6, 20,236, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,112,  0,100,243, 24, 63,
-  5,123,231, 62,169, 37, 27, 63, 35,211,232, 62,138,242, 24, 63, 21,194,236, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,112,  0, 16,130,220, 62,  6, 20,236, 62,206, 27,216, 62, 22, 37,232, 62, 90,128,220, 62,
-248,204,230, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,112,  0,138,242, 24, 63,
- 21,194,236, 62, 88, 33, 23, 63, 69, 47,233, 62,100,243, 24, 63,  5,123,231, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,112,  0, 90,128,220, 62,248,204,230, 62,112, 36,224, 62, 58,129,232, 62, 16,130,220, 62,
-  6, 20,236, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,112,  0,138,242, 24, 63,
- 21,194,236, 62, 13, 89, 22, 63,247,196,236, 62, 88, 33, 23, 63, 69, 47,233, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,112,  0,112, 36,224, 62, 58,129,232, 62,  8,181,225, 62,234, 22,236, 62, 16,130,220, 62,
-  6, 20,236, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,112,  0,138,242, 24, 63,
- 21,194,236, 62,157, 38, 23, 63,225,173,240, 62, 13, 89, 22, 63,247,196,236, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,112,  0,  8,181,225, 62,234, 22,236, 62,234, 25,224, 62,214,255,239, 62, 16,130,220, 62,
-  6, 20,236, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,112,  0,138,242, 24, 63,
- 21,194,236, 62,  6,248, 24, 63,185, 91,242, 62,157, 38, 23, 63,225,173,240, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,112,  0,234, 25,224, 62,214,255,239, 62, 22,119,220, 62,174,173,241, 62, 16,130,220, 62,
-  6, 20,236, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,112,  0,138,242, 24, 63,
- 21,194,236, 62, 42, 39, 27, 63, 57,  1,241, 62,  6,248, 24, 63,185, 91,242, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,112,  0, 22,119,220, 62,174,173,241, 62,206, 24,216, 62, 46, 83,240, 62, 16,130,220, 62,
-  6, 20,236, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,112,  0,138,242, 24, 63,
- 21,194,236, 62,140,249, 27, 63,115,186,236, 62, 42, 39, 27, 63, 57,  1,241, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,112,  0,206, 24,216, 62, 46, 83,240, 62,  8,116,214, 62,102, 12,236, 62, 16,130,220, 62,
-  6, 20,236, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,112,  0,174,254, 16, 63,
- 94, 45, 34, 62, 79,190, 13, 63,160,193, 46, 62,220,199,  3, 63, 89,219, 24, 62,219,199,  3, 63, 18, 28,229, 61,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0,220,199,  3, 63, 89,219, 24, 62, 14,150,243, 62,204, 79, 47, 62,140,248,236, 62,
-182,202, 34, 62,219,199,  3, 63, 18, 28,229, 61,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0,184,152, 21, 63,
-182, 47, 53, 62,250,104, 16, 63, 16,113, 55, 62, 79,190, 13, 63,160,193, 46, 62,174,254, 16, 63, 94, 45, 34, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0, 14,150,243, 62,204, 79, 47, 62,200, 68,238, 62, 76, 62, 56, 62,183,207,227, 62,
-250, 75, 54, 62,140,248,236, 62,182,202, 34, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0,137, 57, 22, 63,
- 81, 93, 61, 62,206,186, 16, 63, 85,129, 72, 62,250,104, 16, 63, 16,113, 55, 62,184,152, 21, 63,182, 47, 53, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,200, 68,238, 62, 76, 62, 56, 62,192,187,237, 62,194,118, 73, 62,122,152,226, 62,
-190,166, 62, 62,183,207,227, 62,250, 75, 54, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,250,249, 22, 63,
-160,251, 88, 62,222, 32, 16, 63, 34,106, 93, 62,206,186, 16, 63, 85,129, 72, 62,137, 57, 22, 63, 81, 93, 61, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,192,187,237, 62,194,118, 73, 62, 21, 19,239, 62,121,110, 94, 62, 90, 83,225, 62,
- 21,153, 90, 62,122,152,226, 62,190,166, 62, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 20, 81, 25, 63,
- 17, 56,132, 62,206,243, 15, 63,182,207,136, 62,222, 32, 16, 63, 34,106, 93, 62,250,249, 22, 63,160,251, 88, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 21, 19,239, 62,121,110, 94, 62, 92,193,239, 62,113, 61,137, 62, 54, 42,221, 62,
-209, 25,133, 62, 90, 83,225, 62, 21,153, 90, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,111,239, 27, 63,
-159, 77,166, 62, 91, 94, 37, 63,107,120,187, 62, 66, 21, 30, 63,178,139,200, 62,158,237, 12, 63, 38,241,187, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,139,125,211, 62,170,171,200, 62,156, 28,197, 62,166,130,187, 62,115, 21,216, 62,
- 14,177,166, 62, 15,175,245, 62,188, 14,188, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 91, 94, 37, 63,
-107,120,187, 62, 87, 57, 43, 63,222, 58,206, 62, 24,163, 39, 63,174, 95,216, 62, 66, 21, 30, 63,178,139,200, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 98,194,191, 62, 42, 94,216, 62,130,207,184, 62, 42, 27,206, 62,156, 28,197, 62,
-166,130,187, 62,139,125,211, 62,170,171,200, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 87, 57, 43, 63,
-222, 58,206, 62, 38,229, 50, 63,169, 32,226, 62,177, 79, 43, 63,202,194,231, 62, 24,163, 39, 63,174, 95,216, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 60,201,183, 62, 82,218,231, 62,196, 39,168, 62,206, 11,226, 62,130,207,184, 62,
- 42, 27,206, 62, 98,194,191, 62, 42, 94,216, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 38,229, 50, 63,
-169, 32,226, 62, 62,134, 48, 63, 37,107,249, 62,154,190, 43, 63,192,  0,249, 62,177, 79, 43, 63,202,194,231, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,138,190,182, 62, 35, 49,249, 62,172,229,172, 62,116,127,249, 62,196, 39,168, 62,
-206, 11,226, 62, 60,201,183, 62, 82,218,231, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 62,134, 48, 63,
- 37,107,249, 62,238, 88, 46, 63,146,223,  2, 63,123,207, 40, 63,218,175,254, 62,154,190, 43, 63,192,  0,249, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,  2,184,188, 62,140,  0,255, 62,173, 87,177, 62,102,  9,  3, 63,172,229,172, 62,
-116,127,249, 62,138,190,182, 62, 35, 49,249, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,238, 88, 46, 63,
-146,223,  2, 63,220,158, 34, 63,175, 23, 10, 63,126, 77, 30, 63,156, 88,  5, 63,123,207, 40, 63,218,175,254, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 89, 65,210, 62, 56,158,  5, 63,124,109,201, 62, 72,121, 10, 63,173, 87,177, 62,
-102,  9,  3, 63,  2,184,188, 62,140,  0,255, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,220,158, 34, 63,
-175, 23, 10, 63, 28,105, 26, 63,242,194, 11, 63,244,120, 25, 63, 78,242,  7, 63,126, 77, 30, 63,156, 88,  5, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,  0, 39,220, 62,252, 58,  8, 63,220, 73,218, 62,169, 31, 12, 63,124,109,201, 62,
- 72,121, 10, 63, 89, 65,210, 62, 56,158,  5, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 28,105, 26, 63,
-242,194, 11, 63,173,244, 22, 63,236,215, 11, 63,202, 47, 22, 63,156, 60,  8, 63,244,120, 25, 63, 78,242,  7, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 11,221,226, 62, 90,125,  8, 63,220, 89,225, 62, 77, 42, 12, 63,220, 73,218, 62,
-169, 31, 12, 63,  0, 39,220, 62,252, 58,  8, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,173,244, 22, 63,
-236,215, 11, 63, 67,169, 11, 63, 18,197, 11, 63,106,252, 12, 63,180,173,  3, 63,202, 47, 22, 63,156, 60,  8, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 35,114,245, 62,233,196,  3, 63, 55, 72,248, 62, 91,232, 11, 63,220, 89,225, 62,
- 77, 42, 12, 63, 11,221,226, 62, 90,125,  8, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 67,169, 11, 63,
- 18,197, 11, 63,148,232,  3, 63,164, 17, 11, 63,162,220,  3, 63, 45, 88,  0, 63,106,252, 12, 63,180,173,  3, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,162,220,  3, 63, 45, 88,  0, 63,148,232,  3, 63,164, 17, 11, 63, 55, 72,248, 62,
- 91,232, 11, 63, 35,114,245, 62,233,196,  3, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,103, 59, 17, 63,
-120,195,255, 62,240, 81, 22, 63,114, 70,  1, 63,202, 47, 22, 63,156, 60,  8, 63,106,252, 12, 63,180,173,  3, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 11,221,226, 62, 90,125,  8, 63,106,128,226, 62,198,111,  1, 63,209,213,236, 62,
-  4,250,255, 62, 35,114,245, 62,233,196,  3, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,240, 81, 22, 63,
-114, 70,  1, 63,151,182, 25, 63,130,  9,  1, 63,244,120, 25, 63, 78,242,  7, 63,202, 47, 22, 63,156, 60,  8, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,  0, 39,220, 62,252, 58,  8, 63,213,150,219, 62, 50, 55,  1, 63,106,128,226, 62,
-198,111,  1, 63, 11,221,226, 62, 90,125,  8, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 96, 49, 30, 63,
-121,229,254, 62,126, 77, 30, 63,156, 88,  5, 63,244,120, 25, 63, 78,242,  7, 63,151,182, 25, 63,130,  9,  1, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,  0, 39,220, 62,252, 58,  8, 63, 89, 65,210, 62, 56,158,  5, 63,176,116,210, 62,
-227, 62,255, 62,213,150,219, 62, 50, 55,  1, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 25,113, 37, 63,
- 35,157,247, 62,123,207, 40, 63,218,175,254, 62,126, 77, 30, 63,156, 88,  5, 63, 96, 49, 30, 63,121,229,254, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 89, 65,210, 62, 56,158,  5, 63,  2,184,188, 62,140,  0,255, 62,189,165,195, 62,
-139,232,247, 62,176,116,210, 62,227, 62,255, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 92, 62, 39, 63,
-121, 75,240, 62,154,190, 43, 63,192,  0,249, 62,123,207, 40, 63,218,175,254, 62, 25,113, 37, 63, 35,157,247, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,  2,184,188, 62,140,  0,255, 62,138,190,182, 62, 35, 49,249, 62,222, 10,192, 62,
-163,128,240, 62,189,165,195, 62,139,232,247, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,140,149, 38, 63,
- 38, 95,229, 62,177, 79, 43, 63,202,194,231, 62,154,190, 43, 63,192,  0,249, 62, 92, 62, 39, 63,121, 75,240, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,138,190,182, 62, 35, 49,249, 62, 60,201,183, 62, 82,218,231, 62,168,140,193, 62,
- 94,129,229, 62,222, 10,192, 62,163,128,240, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 14,120, 33, 63,
-166,238,214, 62, 24,163, 39, 63,174, 95,216, 62,177, 79, 43, 63,202,194,231, 62,140,149, 38, 63, 38, 95,229, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 60,201,183, 62, 82,218,231, 62, 98,194,191, 62, 42, 94,216, 62,168, 75,204, 62,
- 62,  7,215, 62,168,140,193, 62, 94,129,229, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,165,178, 27, 63,
-128, 17,208, 62, 66, 21, 30, 63,178,139,200, 62, 24,163, 39, 63,174, 95,216, 62, 14,120, 33, 63,166,238,214, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 98,194,191, 62, 42, 94,216, 62,139,125,211, 62,170,171,200, 62,  6, 24,216, 62,
-128, 57,208, 62,168, 75,204, 62, 62,  7,215, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 15, 97, 17, 63,
-220, 34,214, 62,158,237, 12, 63, 38,241,187, 62, 66, 21, 30, 63,178,139,200, 62,165,178, 27, 63,128, 17,208, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,139,125,211, 62,170,171,200, 62, 15,175,245, 62,188, 14,188, 62,217,200,236, 62,
-134, 49,214, 62,  6, 24,216, 62,128, 57,208, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 15, 97, 17, 63,
-220, 34,214, 62,149,244, 14, 63,  4, 42,221, 62,147,230,  3, 63, 78, 47,208, 62,158,237, 12, 63, 38,241,187, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,147,230,  3, 63, 78, 47,208, 62,141,144,241, 62,244, 52,221, 62,217,200,236, 62,
-134, 49,214, 62, 15,175,245, 62,188, 14,188, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,103, 59, 17, 63,
-120,195,255, 62,106,252, 12, 63,180,173,  3, 63,162,220,  3, 63, 45, 88,  0, 63, 71, 25, 13, 63,116,163,243, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,162,220,  3, 63, 45, 88,  0, 63, 35,114,245, 62,233,196,  3, 63,209,213,236, 62,
-  4,250,255, 62,  0, 45,245, 62,206,185,243, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 71, 25, 13, 63,
-116,163,243, 62,162,220,  3, 63, 45, 88,  0, 63,215,220,  3, 63,148,189,231, 62, 64,  2, 13, 63, 52,215,230, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,215,220,  3, 63,148,189,231, 62,162,220,  3, 63, 45, 88,  0, 63,  0, 45,245, 62,
-206,185,243, 62,219,100,245, 62,184,230,230, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,147,230,  3, 63,
- 78, 47,208, 62,149,244, 14, 63,  4, 42,221, 62, 64,  2, 13, 63, 52,215,230, 62,215,220,  3, 63,148,189,231, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,219,100,245, 62,184,230,230, 62,141,144,241, 62,244, 52,221, 62,147,230,  3, 63,
- 78, 47,208, 62,215,220,  3, 63,148,189,231, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,250, 61,  7, 63,
-148, 31, 54, 62,193,202,  3, 63,214,174, 49, 62,220,199,  3, 63, 89,219, 24, 62, 79,190, 13, 63,160,193, 46, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,220,199,  3, 63, 89,219, 24, 62,193,202,  3, 63,214,174, 49, 62,175, 87,  0, 63,
-251, 90, 54, 62, 14,150,243, 62,204, 79, 47, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 68,214,  9, 63,
-246,237, 66, 62,250, 61,  7, 63,148, 31, 54, 62, 79,190, 13, 63,160,193, 46, 62,250,104, 16, 63, 16,113, 55, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 14,150,243, 62,204, 79, 47, 62,175, 87,  0, 63,251, 90, 54, 62,104,137,251, 62,
-179, 92, 67, 62,200, 68,238, 62, 76, 62, 56, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,237,221,  8, 63,
-218, 90, 91, 62, 68,214,  9, 63,246,237, 66, 62,250,104, 16, 63, 16,113, 55, 62,206,186, 16, 63, 85,129, 72, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,200, 68,238, 62, 76, 62, 56, 62,104,137,251, 62,179, 92, 67, 62, 39,153,253, 62,
- 27,195, 91, 62,192,187,237, 62,194,118, 73, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,206,243, 15, 63,
-182,207,136, 62, 77, 32,  8, 63, 10, 39,139, 62, 22,117,  9, 63,146,203, 97, 62,222, 32, 16, 63, 34,106, 93, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,192,110,252, 62, 79, 68, 98, 62,219, 89,255, 62,116, 79,139, 62, 92,193,239, 62,
-113, 61,137, 62, 21, 19,239, 62,121,110, 94, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,237,221,  8, 63,
-218, 90, 91, 62,206,186, 16, 63, 85,129, 72, 62,222, 32, 16, 63, 34,106, 93, 62, 22,117,  9, 63,146,203, 97, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 21, 19,239, 62,121,110, 94, 62,192,187,237, 62,194,118, 73, 62, 39,153,253, 62,
- 27,195, 91, 62,192,110,252, 62, 79, 68, 98, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,119,125,  9, 63,
-  7,112,158, 62, 70,233,  3, 63, 88, 27,154, 62,235,229,  3, 63, 97,108,139, 62, 77, 32,  8, 63, 10, 39,139, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,235,229,  3, 63, 97,108,139, 62, 70,233,  3, 63, 88, 27,154, 62,165,179,252, 62,
-163,140,158, 62,219, 89,255, 62,116, 79,139, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 22,117,  9, 63,
-146,203, 97, 62, 77, 32,  8, 63, 10, 39,139, 62,235,229,  3, 63, 97,108,139, 62,246,215,  3, 63,143, 56,101, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,235,229,  3, 63, 97,108,139, 62,219, 89,255, 62,116, 79,139, 62,192,110,252, 62,
- 79, 68, 98, 62,246,215,  3, 63,143, 56,101, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,147,210,  3, 63,
-221, 95, 86, 62,237,221,  8, 63,218, 90, 91, 62, 22,117,  9, 63,146,203, 97, 62,246,215,  3, 63,143, 56,101, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,192,110,252, 62, 79, 68, 98, 62, 39,153,253, 62, 27,195, 91, 62,147,210,  3, 63,
-221, 95, 86, 62,246,215,  3, 63,143, 56,101, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,  5, 54, 12, 63,
-188,183,167, 62,250, 61,  9, 63,252,214,168, 62,152,143,  8, 63, 45,107,163, 62,119,125,  9, 63,  7,112,158, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,100,136,254, 62, 38,123,163, 62,110, 39,253, 62,103,224,168, 62, 98, 68,247, 62,
-146,206,167, 62,165,179,252, 62,163,140,158, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,135,196, 10, 63,
- 52,208,178, 62, 25,233,  8, 63,116,110,175, 62,250, 61,  9, 63,252,214,168, 62,  5, 54, 12, 63,188,183,167, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,110, 39,253, 62,103,224,168, 62,102,195,253, 62,184,102,175, 62, 98, 14,250, 62,
-149,202,178, 62, 98, 68,247, 62,146,206,167, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 69, 17,  4, 63,
-105,176,182, 62, 69,138,  6, 63, 80,180,177, 62, 25,233,  8, 63,116,110,175, 62,135,196, 10, 63, 52,208,178, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,102,195,253, 62,184,102,175, 62, 14, 49,  1, 63, 62,150,177, 62, 69, 17,  4, 63,
-105,176,182, 62, 98, 14,250, 62,149,202,178, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,209,124,  3, 63,
- 70,  0,177, 62, 11,232,  3, 63,140,  4,174, 62, 69,138,  6, 63, 80,180,177, 62, 69, 17,  4, 63,105,176,182, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 14, 49,  1, 63, 62,150,177, 62, 11,232,  3, 63,140,  4,174, 62,209,124,  3, 63,
- 70,  0,177, 62, 69, 17,  4, 63,105,176,182, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 70,233,  3, 63,
- 88, 27,154, 62,119,125,  9, 63,  7,112,158, 62,152,143,  8, 63, 45,107,163, 62,212,232,  3, 63, 58,152,158, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,100,136,254, 62, 38,123,163, 62,165,179,252, 62,163,140,158, 62, 70,233,  3, 63,
- 88, 27,154, 62,212,232,  3, 63, 58,152,158, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,212,232,  3, 63,
- 58,152,158, 62,152,143,  8, 63, 45,107,163, 62,121, 91,  7, 63,134, 51,166, 62,205,231,  3, 63, 58,149,162, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 44,116,  0, 63,255, 56,166, 62,100,136,254, 62, 38,123,163, 62,212,232,  3, 63,
- 58,152,158, 62,205,231,  3, 63, 58,149,162, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 11,232,  3, 63,
-140,  4,174, 62,214,233,  3, 63,198,154,170, 62,233,110,  6, 63, 94,152,174, 62, 69,138,  6, 63, 80,180,177, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,228, 82,  1, 63, 95,140,174, 62,214,233,  3, 63,198,154,170, 62, 11,232,  3, 63,
-140,  4,174, 62, 14, 49,  1, 63, 62,150,177, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 69,138,  6, 63,
- 80,180,177, 62,233,110,  6, 63, 94,152,174, 62, 59,236,  7, 63, 19,123,173, 62, 25,233,  8, 63,116,110,175, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,217,185,255, 62, 92,116,173, 62,228, 82,  1, 63, 95,140,174, 62, 14, 49,  1, 63,
- 62,150,177, 62,102,195,253, 62,184,102,175, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 25,233,  8, 63,
-116,110,175, 62, 59,236,  7, 63, 19,123,173, 62, 85,249,  7, 63, 92, 52,169, 62,250, 61,  9, 63,252,214,168, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,160,169,255, 62,  6, 57,169, 62,217,185,255, 62, 92,116,173, 62,102,195,253, 62,
-184,102,175, 62,110, 39,253, 62,103,224,168, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,250, 61,  9, 63,
-252,214,168, 62, 85,249,  7, 63, 92, 52,169, 62,121, 91,  7, 63,134, 51,166, 62,152,143,  8, 63, 45,107,163, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 44,116,  0, 63,255, 56,166, 62,160,169,255, 62,  6, 57,169, 62,110, 39,253, 62,
-103,224,168, 62,100,136,254, 62, 38,123,163, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,214,233,  3, 63,
-198,154,170, 62, 85,249,  7, 63, 92, 52,169, 62, 59,236,  7, 63, 19,123,173, 62,233,110,  6, 63, 94,152,174, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,217,185,255, 62, 92,116,173, 62,160,169,255, 62,  6, 57,169, 62,214,233,  3, 63,
-198,154,170, 62,228, 82,  1, 63, 95,140,174, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,214,233,  3, 63,
-198,154,170, 62,205,231,  3, 63, 58,149,162, 62,121, 91,  7, 63,134, 51,166, 62, 85,249,  7, 63, 92, 52,169, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 44,116,  0, 63,255, 56,166, 62,205,231,  3, 63, 58,149,162, 62,214,233,  3, 63,
-198,154,170, 62,160,169,255, 62,  6, 57,169, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 69, 17,  4, 63,
-105,176,182, 62,135,196, 10, 63, 52,208,178, 62,158,237, 12, 63, 38,241,187, 62,147,230,  3, 63, 78, 47,208, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 15,175,245, 62,188, 14,188, 62, 98, 14,250, 62,149,202,178, 62, 69, 17,  4, 63,
-105,176,182, 62,147,230,  3, 63, 78, 47,208, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,135,196, 10, 63,
- 52,208,178, 62,  5, 54, 12, 63,188,183,167, 62,112,  0, 16, 63,254,246,164, 62,158,237, 12, 63, 38,241,187, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,207,187,239, 62, 19, 42,165, 62, 98, 68,247, 62,146,206,167, 62, 98, 14,250, 62,
-149,202,178, 62, 15,175,245, 62,188, 14,188, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,  5, 54, 12, 63,
-188,183,167, 62,119,125,  9, 63,  7,112,158, 62, 44,250, 15, 63,109,  0,154, 62,112,  0, 16, 63,254,246,164, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 56,205,239, 62,  8, 71,154, 62,165,179,252, 62,163,140,158, 62, 98, 68,247, 62,
-146,206,167, 62,207,187,239, 62, 19, 42,165, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,119,125,  9, 63,
-  7,112,158, 62, 77, 32,  8, 63, 10, 39,139, 62,206,243, 15, 63,182,207,136, 62, 44,250, 15, 63,109,  0,154, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 92,193,239, 62,113, 61,137, 62,219, 89,255, 62,116, 79,139, 62,165,179,252, 62,
-163,140,158, 62, 56,205,239, 62,  8, 71,154, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 20, 81, 25, 63,
- 17, 56,132, 62,208, 46, 27, 63,149, 35,148, 62, 44,250, 15, 63,109,  0,154, 62,206,243, 15, 63,182,207,136, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 56,205,239, 62,  8, 71,154, 62,238,166,217, 62,229,221,148, 62, 54, 42,221, 62,
-209, 25,133, 62, 92,193,239, 62,113, 61,137, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,208, 46, 27, 63,
-149, 35,148, 62, 36,177, 27, 63,158,151,156, 62,112,  0, 16, 63,254,246,164, 62, 44,250, 15, 63,109,  0,154, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,207,187,239, 62, 19, 42,165, 62,  0,160,216, 62,127, 44,157, 62,238,166,217, 62,
-229,221,148, 62, 56,205,239, 62,  8, 71,154, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,111,239, 27, 63,
-159, 77,166, 62,158,237, 12, 63, 38,241,187, 62,112,  0, 16, 63,254,246,164, 62, 36,177, 27, 63,158,151,156, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,207,187,239, 62, 19, 42,165, 62, 15,175,245, 62,188, 14,188, 62,115, 21,216, 62,
- 14,177,166, 62,  0,160,216, 62,127, 44,157, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,237,221,  8, 63,
-218, 90, 91, 62,147,210,  3, 63,221, 95, 86, 62,129,211,  3, 63,248,168, 83, 62,170, 33,  8, 63,254,149, 86, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,129,211,  3, 63,248,168, 83, 62,147,210,  3, 63,221, 95, 86, 62, 39,153,253, 62,
- 27,195, 91, 62,  8, 14,255, 62, 58,232, 86, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 68,214,  9, 63,
-246,237, 66, 62,237,221,  8, 63,218, 90, 91, 62,170, 33,  8, 63,254,149, 86, 62, 20,180,  8, 63, 94, 29, 69, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,  8, 14,255, 62, 58,232, 86, 62, 39,153,253, 62, 27,195, 91, 62,104,137,251, 62,
-179, 92, 67, 62, 19,210,253, 62, 55,114, 69, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,250, 61,  7, 63,
-148, 31, 54, 62, 68,214,  9, 63,246,237, 66, 62, 20,180,  8, 63, 94, 29, 69, 62,168, 82,  6, 63, 80, 43, 57, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 19,210,253, 62, 55,114, 69, 62,104,137,251, 62,179, 92, 67, 62,175, 87,  0, 63,
-251, 90, 54, 62, 48, 68,  1, 63,166, 84, 57, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,193,202,  3, 63,
-214,174, 49, 62,250, 61,  7, 63,148, 31, 54, 62,168, 82,  6, 63, 80, 43, 57, 62,205,202,  3, 63,  8, 22, 54, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 48, 68,  1, 63,166, 84, 57, 62,175, 87,  0, 63,251, 90, 54, 62,193,202,  3, 63,
-214,174, 49, 62,205,202,  3, 63,  8, 22, 54, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,205,202,  3, 63,
-  8, 22, 54, 62,168, 82,  6, 63, 80, 43, 57, 62,246, 24,  5, 63, 26,150, 66, 62,213,205,  3, 63,220,232, 64, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 29,131,  2, 63, 22,172, 66, 62, 48, 68,  1, 63,166, 84, 57, 62,205,202,  3, 63,
-  8, 22, 54, 62,213,205,  3, 63,220,232, 64, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,168, 82,  6, 63,
- 80, 43, 57, 62, 20,180,  8, 63, 94, 29, 69, 62, 39, 83,  6, 63,191,114, 70, 62,246, 24,  5, 63, 26,150, 66, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,185, 75,  1, 63,222,160, 70, 62, 19,210,253, 62, 55,114, 69, 62, 48, 68,  1, 63,
-166, 84, 57, 62, 29,131,  2, 63, 22,172, 66, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 20,180,  8, 63,
- 94, 29, 69, 62,170, 33,  8, 63,254,149, 86, 62,  4,111,  6, 63, 40,172, 76, 62, 39, 83,  6, 63,191,114, 70, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,157, 51,  1, 63,158,218, 76, 62,  8, 14,255, 62, 58,232, 86, 62, 19,210,253, 62,
- 55,114, 69, 62,185, 75,  1, 63,222,160, 70, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,170, 33,  8, 63,
-254,149, 86, 62,129,211,  3, 63,248,168, 83, 62,234,208,  3, 63,146, 43, 75, 62,  4,111,  6, 63, 40,172, 76, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,234,208,  3, 63,146, 43, 75, 62,129,211,  3, 63,248,168, 83, 62,  8, 14,255, 62,
- 58,232, 86, 62,157, 51,  1, 63,158,218, 76, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,234,208,  3, 63,
-146, 43, 75, 62,213,205,  3, 63,220,232, 64, 62,246, 24,  5, 63, 26,150, 66, 62,  4,111,  6, 63, 40,172, 76, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 29,131,  2, 63, 22,172, 66, 62,213,205,  3, 63,220,232, 64, 62,234,208,  3, 63,
-146, 43, 75, 62,157, 51,  1, 63,158,218, 76, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,  4,111,  6, 63,
- 40,172, 76, 62,246, 24,  5, 63, 26,150, 66, 62, 39, 83,  6, 63,191,114, 70, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,185, 75,  1, 63,222,160, 70, 62, 29,131,  2, 63, 22,172, 66, 62,157, 51,  1, 63,
-158,218, 76, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 64,  2, 13, 63,
- 52,215,230, 62,149,244, 14, 63,  4, 42,221, 62,  4,216, 16, 63,160, 24,224, 62,120,200, 15, 63, 84,255,231, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,119,193,237, 62,190, 38,224, 62,141,144,241, 62,244, 52,221, 62,219,100,245, 62,
-184,230,230, 62, 21,211,239, 62,185, 18,232, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 71, 25, 13, 63,
-116,163,243, 62, 64,  2, 13, 63, 52,215,230, 62,120,200, 15, 63, 84,255,231, 62,184,171, 16, 63, 40,133,241, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 21,211,239, 62,185, 18,232, 62,219,100,245, 62,184,230,230, 62,  0, 45,245, 62,
-206,185,243, 62,218,252,237, 62, 62,160,241, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,103, 59, 17, 63,
-120,195,255, 62, 71, 25, 13, 63,116,163,243, 62,184,171, 16, 63, 40,133,241, 62, 55, 44, 19, 63, 86, 21,250, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,218,252,237, 62, 62,160,241, 62,  0, 45,245, 62,206,185,243, 62,209,213,236, 62,
-  4,250,255, 62,153,228,232, 62,154, 67,250, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,149,244, 14, 63,
-  4, 42,221, 62, 15, 97, 17, 63,220, 34,214, 62,217, 53, 19, 63, 16,211,218, 62,  4,216, 16, 63,160, 24,224, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,  8, 14,233, 62, 66,226,218, 62,217,200,236, 62,134, 49,214, 62,141,144,241, 62,
-244, 52,221, 62,119,193,237, 62,190, 38,224, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 15, 97, 17, 63,
-220, 34,214, 62,165,178, 27, 63,128, 17,208, 62,205,198, 26, 63,124,184,214, 62,217, 53, 19, 63, 16,211,218, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,216,214,217, 62,218,224,214, 62,  6, 24,216, 62,128, 57,208, 62,217,200,236, 62,
-134, 49,214, 62,  8, 14,233, 62, 66,226,218, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,165,178, 27, 63,
-128, 17,208, 62, 14,120, 33, 63,166,238,214, 62,156,136, 31, 63,194,138,219, 62,205,198, 26, 63,124,184,214, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,254, 30,208, 62,204,177,219, 62,168, 75,204, 62, 62,  7,215, 62,  6, 24,216, 62,
-128, 57,208, 62,216,214,217, 62,218,224,214, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 14,120, 33, 63,
-166,238,214, 62,140,149, 38, 63, 38, 95,229, 62, 79,  9, 36, 63, 94,224,229, 62,156,136, 31, 63,194,138,219, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,148,192,198, 62,182, 11,230, 62,168,140,193, 62, 94,129,229, 62,168, 75,204, 62,
- 62,  7,215, 62,254, 30,208, 62,204,177,219, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,140,149, 38, 63,
- 38, 95,229, 62, 92, 62, 39, 63,121, 75,240, 62, 14, 49, 36, 63,253, 88,239, 62, 79,  9, 36, 63, 94,224,229, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 97, 71,198, 62,192,149,239, 62,222, 10,192, 62,163,128,240, 62,168,140,193, 62,
- 94,129,229, 62,148,192,198, 62,182, 11,230, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 92, 62, 39, 63,
-121, 75,240, 62, 25,113, 37, 63, 35,157,247, 62,243, 33, 35, 63, 80,143,245, 62, 14, 49, 36, 63,253, 88,239, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 87, 99,200, 62,172,217,245, 62,189,165,195, 62,139,232,247, 62,222, 10,192, 62,
-163,128,240, 62, 97, 71,198, 62,192,149,239, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 25,113, 37, 63,
- 35,157,247, 62, 96, 49, 30, 63,121,229,254, 62,223, 49, 29, 63,199,140,250, 62,243, 33, 35, 63, 80,143,245, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,147,124,212, 62,146,215,250, 62,176,116,210, 62,227, 62,255, 62,189,165,195, 62,
-139,232,247, 62, 87, 99,200, 62,172,217,245, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 96, 49, 30, 63,
-121,229,254, 62,151,182, 25, 63,130,  9,  1, 63, 50,181, 25, 63,118,111,253, 62,223, 49, 29, 63,199,140,250, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 52,151,219, 62, 68,186,253, 62,213,150,219, 62, 50, 55,  1, 63,176,116,210, 62,
-227, 62,255, 62,147,124,212, 62,146,215,250, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,151,182, 25, 63,
-130,  9,  1, 63,240, 81, 22, 63,114, 70,  1, 63,241,188, 22, 63, 28,149,253, 62, 50,181, 25, 63,118,111,253, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,212,163,225, 62, 91,215,253, 62,106,128,226, 62,198,111,  1, 63,213,150,219, 62,
- 50, 55,  1, 63, 52,151,219, 62, 68,186,253, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,240, 81, 22, 63,
-114, 70,  1, 63,103, 59, 17, 63,120,195,255, 62, 55, 44, 19, 63, 86, 21,250, 62,241,188, 22, 63, 28,149,253, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,153,228,232, 62,154, 67,250, 62,209,213,236, 62,  4,250,255, 62,106,128,226, 62,
-198,111,  1, 63,212,163,225, 62, 91,215,253, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,241,188, 22, 63,
- 28,149,253, 62, 55, 44, 19, 63, 86, 21,250, 62,  9,165, 20, 63,248, 99,247, 62, 20,  0, 23, 63,  6, 57,251, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,232,232,229, 62, 74,142,247, 62,153,228,232, 62,154, 67,250, 62,212,163,225, 62,
- 91,215,253, 62,145, 26,225, 62,114,116,251, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 50,181, 25, 63,
-118,111,253, 62,241,188, 22, 63, 28,149,253, 62, 20,  0, 23, 63,  6, 57,251, 62,130,144, 25, 63,128,  7,251, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,145, 26,225, 62,114,116,251, 62,212,163,225, 62, 91,215,253, 62, 52,151,219, 62,
- 68,186,253, 62,177,225,219, 62, 67, 75,251, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,223, 49, 29, 63,
-199,140,250, 62, 50,181, 25, 63,118,111,253, 62,130,144, 25, 63,128,  7,251, 62, 80,195, 28, 63, 55,166,248, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,177,225,219, 62, 67, 75,251, 62, 52,151,219, 62, 68,186,253, 62,147,124,212, 62,
-146,215,250, 62,233, 95,213, 62, 20,237,248, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,243, 33, 35, 63,
- 80,143,245, 62,223, 49, 29, 63,199,140,250, 62, 80,195, 28, 63, 55,166,248, 62, 22,164, 33, 63,102, 75,243, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,233, 95,213, 62, 20,237,248, 62,147,124,212, 62,146,215,250, 62, 87, 99,200, 62,
-172,217,245, 62, 65,114,203, 62,159,143,243, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 14, 49, 36, 63,
-253, 88,239, 62,243, 33, 35, 63, 80,143,245, 62, 22,164, 33, 63,102, 75,243, 62, 30,160, 34, 63,169, 47,238, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 65,114,203, 62,159,143,243, 62, 87, 99,200, 62,172,217,245, 62, 97, 71,198, 62,
-192,149,239, 62,188,128,201, 62,126,110,238, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 79,  9, 36, 63,
- 94,224,229, 62, 14, 49, 36, 63,253, 88,239, 62, 30,160, 34, 63,169, 47,238, 62,131,144, 34, 63,253, 87,231, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,188,128,201, 62,126,110,238, 62, 97, 71,198, 62,192,149,239, 62,148,192,198, 62,
-182, 11,230, 62,141,190,201, 62,124,140,231, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,156,136, 31, 63,
-194,138,219, 62, 79,  9, 36, 63, 94,224,229, 62,131,144, 34, 63,253, 87,231, 62, 21,208, 30, 63,174,182,221, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,141,190,201, 62,124,140,231, 62,148,192,198, 62,182, 11,230, 62,254, 30,208, 62,
-204,177,219, 62,168,133,209, 62, 51,221,221, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,205,198, 26, 63,
-124,184,214, 62,156,136, 31, 63,194,138,219, 62, 21,208, 30, 63,174,182,221, 62,128,218, 26, 63, 68,206,217, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,168,133,209, 62, 51,221,221, 62,254, 30,208, 62,204,177,219, 62,216,214,217, 62,
-218,224,214, 62, 11,157,217, 62, 64,243,217, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,217, 53, 19, 63,
- 16,211,218, 62,205,198, 26, 63,124,184,214, 62,128,218, 26, 63, 68,206,217, 62,103, 53, 20, 63,236, 84,221, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 11,157,217, 62, 64,243,217, 62,216,214,217, 62,218,224,214, 62,  8, 14,233, 62,
- 66,226,218, 62, 68,  5,231, 62,234,101,221, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,  4,216, 16, 63,
-160, 24,224, 62,217, 53, 19, 63, 16,211,218, 62,103, 53, 20, 63,236, 84,221, 62, 81, 87, 18, 63, 33,175,226, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 68,  5,231, 62,234,101,221, 62,  8, 14,233, 62, 66,226,218, 62,119,193,237, 62,
-190, 38,224, 62,180,187,234, 62,249,190,226, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 55, 44, 19, 63,
- 86, 21,250, 62,184,171, 16, 63, 40,133,241, 62, 98, 68, 18, 63,150,197,240, 62,  9,165, 20, 63,248, 99,247, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 35,197,234, 62,215,226,240, 62,218,252,237, 62, 62,160,241, 62,153,228,232, 62,
-154, 67,250, 62,232,232,229, 62, 74,142,247, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,184,171, 16, 63,
- 40,133,241, 62,120,200, 15, 63, 84,255,231, 62,161,  4, 18, 63,138,184,232, 62, 98, 68, 18, 63,150,197,240, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,154, 85,235, 62, 92,206,232, 62, 21,211,239, 62,185, 18,232, 62,218,252,237, 62,
- 62,160,241, 62, 35,197,234, 62,215,226,240, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,120,200, 15, 63,
- 84,255,231, 62,  4,216, 16, 63,160, 24,224, 62, 81, 87, 18, 63, 33,175,226, 62,161,  4, 18, 63,138,184,232, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,180,187,234, 62,249,190,226, 62,119,193,237, 62,190, 38,224, 62, 21,211,239, 62,
-185, 18,232, 62,154, 85,235, 62, 92,206,232, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,148,232,  3, 63,
-164, 17, 11, 63, 67,169, 11, 63, 18,197, 11, 63,216,120, 13, 63,160, 81, 23, 63,147, 15,  4, 63,227,248, 23, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 64, 27,245, 62,100,166, 23, 63, 55, 72,248, 62, 91,232, 11, 63,148,232,  3, 63,
-164, 17, 11, 63,147, 15,  4, 63,227,248, 23, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 67,169, 11, 63,
- 18,197, 11, 63,173,244, 22, 63,236,215, 11, 63, 94,233, 23, 63,186, 60, 16, 63,216,120, 13, 63,160, 81, 23, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,109,130,223, 62,118,165, 16, 63,220, 89,225, 62, 77, 42, 12, 63, 55, 72,248, 62,
- 91,232, 11, 63, 64, 27,245, 62,100,166, 23, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,173,244, 22, 63,
-236,215, 11, 63, 28,105, 26, 63,242,194, 11, 63,220, 56, 28, 63, 66,250, 14, 63, 94,233, 23, 63,186, 60, 16, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,157,161,214, 62,219,110, 15, 63,220, 73,218, 62,169, 31, 12, 63,220, 89,225, 62,
- 77, 42, 12, 63,109,130,223, 62,118,165, 16, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 28,105, 26, 63,
-242,194, 11, 63,220,158, 34, 63,175, 23, 10, 63,109, 44, 39, 63,107,221, 19, 63,220, 56, 28, 63, 66,250, 14, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,156, 26,192, 62, 31,139, 20, 63,124,109,201, 62, 72,121, 10, 63,220, 73,218, 62,
-169, 31, 12, 63,157,161,214, 62,219,110, 15, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,220,158, 34, 63,
-175, 23, 10, 63,238, 88, 46, 63,146,223,  2, 63,242, 80, 56, 63, 44,244,  6, 63,109, 44, 39, 63,107,221, 19, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0, 61,208,156, 62,204, 16,  7, 63,173, 87,177, 62,102,  9,  3, 63,124,109,201, 62,
- 72,121, 10, 63,156, 26,192, 62, 31,139, 20, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0,238, 88, 46, 63,
-146,223,  2, 63, 62,134, 48, 63, 37,107,249, 62,195,173, 54, 63,239,106,252, 62,242, 80, 56, 63, 44,244,  6, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0,202, 36,160, 62, 94, 51,252, 62,172,229,172, 62,116,127,249, 62,173, 87,177, 62,
-102,  9,  3, 63, 61,208,156, 62,204, 16,  7, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0, 62,134, 48, 63,
- 37,107,249, 62, 38,229, 50, 63,169, 32,226, 62,154, 88, 53, 63,240,146,221, 62,195,173, 54, 63,239,106,252, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0,128,172,162, 62, 17,169,221, 62,196, 39,168, 62,206, 11,226, 62,172,229,172, 62,
-116,127,249, 62,202, 36,160, 62, 94, 51,252, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0, 38,229, 50, 63,
-169, 32,226, 62, 87, 57, 43, 63,222, 58,206, 62,240,117, 49, 63,164,138,198, 62,154, 88, 53, 63,240,146,221, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0,147,137,172, 62,148, 19,198, 62,130,207,184, 62, 42, 27,206, 62,196, 39,168, 62,
-206, 11,226, 62,128,172,162, 62, 17,169,221, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0, 87, 57, 43, 63,
-222, 58,206, 62, 91, 94, 37, 63,107,120,187, 62,156,160, 41, 63, 56,175,182, 62,240,117, 49, 63,164,138,198, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,202,212,188, 62,245,163,182, 62,156, 28,197, 62,166,130,187, 62,130,207,184, 62,
- 42, 27,206, 62,147,137,172, 62,148, 19,198, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,165,252, 48, 63,
-133, 33, 85, 62,112, 54, 48, 63, 20, 19, 96, 62,172, 36, 46, 63,208,  7,129, 62,240, 17, 42, 63,129, 84, 97, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 76, 71,181, 62,204,200,131, 62,117,121,175, 62,183,185,106, 62,217, 24,172, 62,
- 21,237, 92, 62,138, 81,187, 62, 59, 40,103, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,204, 89, 48, 63,
-134,194,  4, 62,165,252, 48, 63,133, 33, 85, 62,240, 17, 42, 63,129, 84, 97, 62,160,125, 37, 63, 50,211, 46, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0,138, 81,187, 62, 59, 40,103, 62,217, 24,172, 62, 21,237, 92, 62, 94,197,172, 62,
-109,200,  4, 62, 25,121,195, 62, 46,253, 48, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0, 11, 44, 20, 63,
- 20, 26,163, 61,204, 89, 48, 63,134,194,  4, 62,160,125, 37, 63, 50,211, 46, 62, 40, 92, 24, 63,214,184, 21, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 32,  0, 25,121,195, 62, 46,253, 48, 62, 94,197,172, 62,109,200,  4, 62,140,122,230, 62,
-202,248,161, 61,216, 13,222, 62,222,116, 22, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 32,  0,174,254, 16, 63,
- 94, 45, 34, 62,219,199,  3, 63, 18, 28,229, 61, 11, 44, 20, 63, 20, 26,163, 61, 40, 92, 24, 63,214,184, 21, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0,140,122,230, 62,202,248,161, 61,219,199,  3, 63, 18, 28,229, 61,140,248,236, 62,
-182,202, 34, 62,216, 13,222, 62,222,116, 22, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0,184,152, 21, 63,
-182, 47, 53, 62,174,254, 16, 63, 94, 45, 34, 62, 40, 92, 24, 63,214,184, 21, 62,209, 52, 25, 63, 76,140, 51, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 32,  0,216, 13,222, 62,222,116, 22, 62,140,248,236, 62,182,202, 34, 62,183,207,227, 62,
-250, 75, 54, 62,229,137,220, 62,185,228, 52, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 32,  0,137, 57, 22, 63,
- 81, 93, 61, 62,184,152, 21, 63,182, 47, 53, 62,209, 52, 25, 63, 76,140, 51, 62,193,166, 30, 63,114,168, 73, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,229,137,220, 62,185,228, 52, 62,183,207,227, 62,250, 75, 54, 62,122,152,226, 62,
-190,166, 62, 62, 54,198,209, 62, 18,240, 75, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,250,249, 22, 63,
-160,251, 88, 62,137, 57, 22, 63, 81, 93, 61, 62,193,166, 30, 63,114,168, 73, 62, 75,  0, 36, 63,229, 47,116, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 54,198,209, 62, 18,240, 75, 62,122,152,226, 62,190,166, 62, 62, 90, 83,225, 62,
- 21,153, 90, 62,211,231,199, 62,216,237,119, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,193,166, 30, 63,
-114,168, 73, 62,160,125, 37, 63, 50,211, 46, 62,240, 17, 42, 63,129, 84, 97, 62, 75,  0, 36, 63,229, 47,116, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,138, 81,187, 62, 59, 40,103, 62, 25,121,195, 62, 46,253, 48, 62, 54,198,209, 62,
- 18,240, 75, 62,211,231,199, 62,216,237,119, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,193,166, 30, 63,
-114,168, 73, 62,209, 52, 25, 63, 76,140, 51, 62, 40, 92, 24, 63,214,184, 21, 62,160,125, 37, 63, 50,211, 46, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,216, 13,222, 62,222,116, 22, 62,229,137,220, 62,185,228, 52, 62, 54,198,209, 62,
- 18,240, 75, 62, 25,121,195, 62, 46,253, 48, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 37,163, 36, 63,
-191,168,140, 62, 75,  0, 36, 63,229, 47,116, 62,240, 17, 42, 63,129, 84, 97, 62,172, 36, 46, 63,208,  7,129, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,138, 81,187, 62, 59, 40,103, 62,211,231,199, 62,216,237,119, 62,  6, 64,199, 62,
-105,  6,142, 62, 76, 71,181, 62,204,200,131, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 20, 81, 25, 63,
- 17, 56,132, 62,250,249, 22, 63,160,251, 88, 62, 75,  0, 36, 63,229, 47,116, 62, 37,163, 36, 63,191,168,140, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,211,231,199, 62,216,237,119, 62, 90, 83,225, 62, 21,153, 90, 62, 54, 42,221, 62,
-209, 25,133, 62,  6, 64,199, 62,105,  6,142, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,208, 46, 27, 63,
-149, 35,148, 62, 91, 60, 36, 63,221,222,150, 62,222,170, 33, 63, 74,126,158, 62, 36,177, 27, 63,158,151,156, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72,234,204, 62, 56, 63,159, 62,150,245,199, 62, 85, 15,152, 62,238,166,217, 62,
-229,221,148, 62,  0,160,216, 62,127, 44,157, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 20, 81, 25, 63,
- 17, 56,132, 62, 37,163, 36, 63,191,168,140, 62, 91, 60, 36, 63,221,222,150, 62,208, 46, 27, 63,149, 35,148, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,150,245,199, 62, 85, 15,152, 62,  6, 64,199, 62,105,  6,142, 62, 54, 42,221, 62,
-209, 25,133, 62,238,166,217, 62,229,221,148, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,111,239, 27, 63,
-159, 77,166, 62, 36,177, 27, 63,158,151,156, 62,222,170, 33, 63, 74,126,158, 62,102,212, 31, 63,144,192,164, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72,234,204, 62, 56, 63,159, 62,  0,160,216, 62,127, 44,157, 62,115, 21,216, 62,
- 14,177,166, 62, 17,119,208, 62,201, 65,165, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,111,239, 27, 63,
-159, 77,166, 62,102,212, 31, 63,144,192,164, 62,156,160, 41, 63, 56,175,182, 62, 91, 94, 37, 63,107,120,187, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,202,212,188, 62,245,163,182, 62, 17,119,208, 62,201, 65,165, 62,115, 21,216, 62,
- 14,177,166, 62,156, 28,197, 62,166,130,187, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,104,119,194, 62,
-164,189, 82, 63, 23, 73,212, 62,152,239, 90, 63,100,192,205, 62, 46,238, 97, 63, 38, 56,185, 62, 72,154, 91, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,228, 94,141, 62, 86,234,100, 63, 84, 66,150, 62,114,154, 94, 63,230, 86,173, 62,
- 79, 66, 98, 63, 20,143,162, 62, 44,173,106, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72,122, 87, 63,
-216,  8, 62, 62,202,106, 84, 63,137,185,113, 62,226, 77, 72, 63,204, 21,121, 62,158,225, 71, 63,113, 34, 68, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0,132, 32,137, 62,181, 65,121, 62,168,179,107, 62,139,127,103, 62,210,147,114, 62,
-212,116, 61, 62,248,125,142, 62, 30,  4, 80, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0,158,225, 71, 63,
-113, 34, 68, 62,226, 77, 72, 63,204, 21,121, 62,  8,  7, 51, 63,  5,186,130, 62,  3,166, 49, 63,232, 57, 96, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 18,197,172, 62, 41,112,133, 62,132, 32,137, 62,181, 65,121, 62,248,125,142, 62,
- 30,  4, 80, 62,121,228,174, 62, 52, 79,109, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,  3,166, 49, 63,
-232, 57, 96, 62,  8,  7, 51, 63,  5,186,130, 62,172, 36, 46, 63,208,  7,129, 62,112, 54, 48, 63, 20, 19, 96, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 76, 71,181, 62,204,200,131, 62, 18,197,172, 62, 41,112,133, 62,121,228,174, 62,
- 52, 79,109, 62,117,121,175, 62,183,185,106, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 37,163, 36, 63,
-191,168,140, 62,172, 36, 46, 63,208,  7,129, 62,  8,  7, 51, 63,  5,186,130, 62, 91, 60, 36, 63,221,222,150, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 18,197,172, 62, 41,112,133, 62, 76, 71,181, 62,204,200,131, 62,  6, 64,199, 62,
-105,  6,142, 62,150,245,199, 62, 85, 15,152, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,154, 88, 53, 63,
-240,146,221, 62,240,117, 49, 63,164,138,198, 62,224, 19, 69, 63, 24, 68,190, 62, 53, 64, 74, 63,171, 31,224, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0,250, 78,134, 62,148,213,186, 62,147,137,172, 62,148, 19,198, 62,128,172,162, 62,
- 17,169,221, 62,184,112,114, 62,248,169,220, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0, 54, 74,214, 62,
- 20, 55, 70, 63, 48,130,233, 62,188, 69, 83, 63, 23, 73,212, 62,152,239, 90, 63,104,119,194, 62,164,189, 82, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 84, 66,150, 62,114,154, 94, 63, 66,  1,153, 62,245,149, 81, 63, 38, 56,185, 62,
-102,110, 83, 63,230, 86,173, 62, 79, 66, 98, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,106,242, 66, 63,
-202, 94, 25, 63,190,100, 70, 63,222,234, 15, 63, 90,189, 77, 63,233, 88, 17, 63,  8,206, 74, 63, 88,118, 27, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 22, 32, 96, 62, 66, 60, 16, 63, 86, 87,125, 62,174,  5, 15, 63, 78,187,132, 62,
-180, 44, 24, 63, 26, 79,108, 62,124,  1, 26, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,  8,206, 74, 63,
- 88,118, 27, 63, 90,189, 77, 63,233, 88, 17, 63, 72,139, 85, 63,103, 51, 19, 63,220,119, 85, 63, 77, 71, 31, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 64,199, 64, 62, 26, 40, 18, 63, 22, 32, 96, 62, 66, 60, 16, 63, 26, 79,108, 62,
-124,  1, 26, 63, 44,191, 67, 62, 90, 89, 30, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,220,119, 85, 63,
- 77, 71, 31, 63, 72,139, 85, 63,103, 51, 19, 63,228,213,100, 63, 72,156, 20, 63, 18, 82, 96, 63,128,133, 34, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0,226, 50,  1, 62,184, 68, 20, 63, 64,199, 64, 62, 26, 40, 18, 63, 44,191, 67, 62,
- 90, 89, 30, 63,194,204, 24, 62, 32,186, 34, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0,242, 80, 56, 63,
- 44,244,  6, 63,195,173, 54, 63,239,106,252, 62,115,205, 60, 63,213,150,253, 62,166, 14, 64, 63, 81, 80,  4, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0,190, 85,147, 62, 91,176,252, 62,202, 36,160, 62, 94, 51,252, 62, 61,208,156, 62,
-204, 16,  7, 63,160,121,140, 62, 74,197,  3, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0,166, 14, 64, 63,
- 81, 80,  4, 63,115,205, 60, 63,213,150,253, 62, 68,103, 73, 63,233,248,  0, 63,248, 12, 75, 63, 64,206,  8, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,144, 59,115, 62,102,143,255, 62,190, 85,147, 62, 91,176,252, 62,160,121,140, 62,
- 74,197,  3, 63, 78,135,107, 62, 88,182,  7, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,248, 12, 75, 63,
- 64,206,  8, 63, 68,103, 73, 63,233,248,  0, 63,239,151, 82, 63, 86,223,  3, 63,181,227, 82, 63,189,102, 11, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 82, 17, 77, 62,162, 98,  2, 63,144, 59,115, 62,102,143,255, 62, 78,135,107, 62,
- 88,182,  7, 63,202, 98, 75, 62,108, 43, 10, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,181,227, 82, 63,
-189,102, 11, 63,239,151, 82, 63, 86,223,  3, 63, 92,224, 91, 63,239,144,  5, 63,161,148, 90, 63,146, 95, 13, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,178, 40, 38, 62, 14,230,  3, 63, 82, 17, 77, 62,162, 98,  2, 63,202, 98, 75, 62,
-108, 43, 10, 63, 10,162, 43, 62,  8, 50, 12, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,120, 89,103, 63,
-105, 76,  2, 63,170,179,103, 63,142,105, 12, 63,161,148, 90, 63,146, 95, 13, 63, 92,224, 91, 63,239,144,  5, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 10,162, 43, 62,  8, 50, 12, 63,168, 41,231, 61,158, 83, 11, 63,116,128,234, 61,
-200, 39,  0, 63,178, 40, 38, 62, 14,230,  3, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,228,213,100, 63,
- 72,156, 20, 63, 72,139, 85, 63,103, 51, 19, 63,161,148, 90, 63,146, 95, 13, 63,170,179,103, 63,142,105, 12, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 10,162, 43, 62,  8, 50, 12, 63, 64,199, 64, 62, 26, 40, 18, 63,226, 50,  1, 62,
-184, 68, 20, 63,168, 41,231, 61,158, 83, 11, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72,139, 85, 63,
-103, 51, 19, 63, 90,189, 77, 63,233, 88, 17, 63,181,227, 82, 63,189,102, 11, 63,161,148, 90, 63,146, 95, 13, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,202, 98, 75, 62,108, 43, 10, 63, 22, 32, 96, 62, 66, 60, 16, 63, 64,199, 64, 62,
- 26, 40, 18, 63, 10,162, 43, 62,  8, 50, 12, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 90,189, 77, 63,
-233, 88, 17, 63,190,100, 70, 63,222,234, 15, 63,248, 12, 75, 63, 64,206,  8, 63,181,227, 82, 63,189,102, 11, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 78,135,107, 62, 88,182,  7, 63, 86, 87,125, 62,174,  5, 15, 63, 22, 32, 96, 62,
- 66, 60, 16, 63,202, 98, 75, 62,108, 43, 10, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,190,100, 70, 63,
-222,234, 15, 63, 82,235, 60, 63, 27, 12, 12, 63,166, 14, 64, 63, 81, 80,  4, 63,248, 12, 75, 63, 64,206,  8, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,160,121,140, 62, 74,197,  3, 63, 78,230,145, 62,148,225, 11, 63, 86, 87,125, 62,
-174,  5, 15, 63, 78,135,107, 62, 88,182,  7, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 31,118, 57, 63,
-230, 79, 12, 63,242, 80, 56, 63, 44,244,  6, 63,166, 14, 64, 63, 81, 80,  4, 63, 82,235, 60, 63, 27, 12, 12, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 32,  0,160,121,140, 62, 74,197,  3, 63, 61,208,156, 62,204, 16,  7, 63,  0,199,152, 62,
- 13,133, 12, 63, 78,230,145, 62,148,225, 11, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 32,  0,195,240, 57, 63,
- 10,138, 23, 63, 82,235, 60, 63, 27, 12, 12, 63,190,100, 70, 63,222,234, 15, 63,106,242, 66, 63,202, 94, 25, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 86, 87,125, 62,174,  5, 15, 63, 78,230,145, 62,148,225, 11, 63,247,  7,150, 62,
- 96, 12, 23, 63, 78,187,132, 62,180, 44, 24, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,216,120, 13, 63,
-160, 81, 23, 63, 94,233, 23, 63,186, 60, 16, 63,220, 56, 28, 63, 66,250, 14, 63,109, 44, 39, 63,107,221, 19, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,157,161,214, 62,219,110, 15, 63,109,130,223, 62,118,165, 16, 63, 64, 27,245, 62,
-100,166, 23, 63,156, 26,192, 62, 31,139, 20, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,176, 29, 56, 63,
- 88,206, 20, 63, 31,118, 57, 63,230, 79, 12, 63, 82,235, 60, 63, 27, 12, 12, 63,195,240, 57, 63, 10,138, 23, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 78,230,145, 62,148,225, 11, 63,  0,199,152, 62, 13,133, 12, 63,239,211,153, 62,
-220,159, 20, 63,247,  7,150, 62, 96, 12, 23, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 48,148, 54, 63,
-220,206, 22, 63,176, 29, 56, 63, 88,206, 20, 63,195,240, 57, 63, 10,138, 23, 63,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,247,  7,150, 62, 96, 12, 23, 63,239,211,153, 62,220,159, 20, 63,108,106,156, 62,
-146,154, 22, 63,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,195,173, 54, 63,
-239,106,252, 62,154, 88, 53, 63,240,146,221, 62, 53, 64, 74, 63,171, 31,224, 62,115,205, 60, 63,213,150,253, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 32,  0,184,112,114, 62,248,169,220, 62,128,172,162, 62, 17,169,221, 62,202, 36,160, 62,
- 94, 51,252, 62,190, 85,147, 62, 91,176,252, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 32,  0, 53, 64, 74, 63,
-171, 31,224, 62,217,106, 81, 63, 14,214,232, 62, 68,103, 73, 63,233,248,  0, 63,115,205, 60, 63,213,150,253, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,144, 59,115, 62,102,143,255, 62, 88, 93, 84, 62, 50,105,228, 62,184,112,114, 62,
-248,169,220, 62,190, 85,147, 62, 91,176,252, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,217,106, 81, 63,
- 14,214,232, 62,106,154, 93, 63,226, 26,233, 62,239,151, 82, 63, 86,223,  3, 63, 68,103, 73, 63,233,248,  0, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 82, 17, 77, 62,162, 98,  2, 63,128,  1, 33, 62, 70,210,226, 62, 88, 93, 84, 62,
- 50,105,228, 62,144, 59,115, 62,102,143,255, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,120, 89,103, 63,
-105, 76,  2, 63, 92,224, 91, 63,239,144,  5, 63,239,151, 82, 63, 86,223,  3, 63,106,154, 93, 63,226, 26,233, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 82, 17, 77, 62,162, 98,  2, 63,178, 40, 38, 62, 14,230,  3, 63,116,128,234, 61,
-200, 39,  0, 63,128,  1, 33, 62, 70,210,226, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,  8,  7, 51, 63,
-  5,186,130, 62,226, 77, 72, 63,204, 21,121, 62,154,254, 73, 63,178, 82,140, 62, 90,188, 56, 63,103,207,159, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,249,249,130, 62,246,175,137, 62,132, 32,137, 62,181, 65,121, 62, 18,197,172, 62,
- 41,112,133, 62,192,  5,161, 62,228, 40,159, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,224, 19, 69, 63,
- 24, 68,190, 62, 90,188, 56, 63,103,207,159, 62,154,254, 73, 63,178, 82,140, 62,216,217, 77, 63,  7,228,157, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0,249,249,130, 62,246,175,137, 62,192,  5,161, 62,228, 40,159, 62,250, 78,134, 62,
-148,213,186, 62,154,118,111, 62,120,108,152, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0,240,117, 49, 63,
-164,138,198, 62,156,160, 41, 63, 56,175,182, 62, 90,188, 56, 63,103,207,159, 62,224, 19, 69, 63, 24, 68,190, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,192,  5,161, 62,228, 40,159, 62,202,212,188, 62,245,163,182, 62,147,137,172, 62,
-148, 19,198, 62,250, 78,134, 62,148,213,186, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,156,160, 41, 63,
- 56,175,182, 62,222,170, 33, 63, 74,126,158, 62, 91, 60, 36, 63,221,222,150, 62, 90,188, 56, 63,103,207,159, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,150,245,199, 62, 85, 15,152, 62, 72,234,204, 62, 56, 63,159, 62,202,212,188, 62,
-245,163,182, 62,192,  5,161, 62,228, 40,159, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 91, 60, 36, 63,
-221,222,150, 62,  8,  7, 51, 63,  5,186,130, 62, 90,188, 56, 63,103,207,159, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,192,  5,161, 62,228, 40,159, 62, 18,197,172, 62, 41,112,133, 62,150,245,199, 62,
- 85, 15,152, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,156,160, 41, 63,
- 56,175,182, 62,102,212, 31, 63,144,192,164, 62,222,170, 33, 63, 74,126,158, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72,234,204, 62, 56, 63,159, 62, 17,119,208, 62,201, 65,165, 62,202,212,188, 62,
-245,163,182, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,226, 44,245, 62,
-129,140, 96, 63, 42,135,227, 62, 58,  2,101, 63,136,168,219, 62, 30,236, 95, 63,135, 30,238, 62,200, 41, 90, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,216,240,137, 62, 90,226, 93, 63,110,103,122, 62,236,255, 92, 63, 74, 84,120, 62,
-104, 32, 83, 63, 32,193,138, 62, 16,  3, 83, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 48,130,233, 62,
-188, 69, 83, 63,135, 30,238, 62,200, 41, 90, 63,136,168,219, 62, 30,236, 95, 63, 23, 73,212, 62,152,239, 90, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,216,240,137, 62, 90,226, 93, 63, 32,193,138, 62, 16,  3, 83, 63, 66,  1,153, 62,
-245,149, 81, 63, 84, 66,150, 62,114,154, 94, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,216,217, 77, 63,
-  7,228,157, 62,154,254, 73, 63,178, 82,140, 62, 33, 61, 90, 63,195,207,124, 62,160,225, 90, 63,110,121,137, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0, 98,207, 81, 62,109,  1,110, 62,249,249,130, 62,246,175,137, 62,154,118,111, 62,
-120,108,152, 62,166,125, 74, 62,252, 30,130, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0,226, 77, 72, 63,
-204, 21,121, 62,202,106, 84, 63,137,185,113, 62, 33, 61, 90, 63,195,207,124, 62,154,254, 73, 63,178, 82,140, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 98,207, 81, 62,109,  1,110, 62,168,179,107, 62,139,127,103, 62,132, 32,137, 62,
-181, 65,121, 62,249,249,130, 62,246,175,137, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 23, 73,212, 62,
-152,239, 90, 63,136,168,219, 62, 30,236, 95, 63,100,192,205, 62, 46,238, 97, 63,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,112,  0,228, 94,141, 62, 86,234,100, 63,216,240,137, 62, 90,226, 93, 63, 84, 66,150, 62,
-114,154, 94, 63,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,112,  0, 31,178,109, 63,
-224, 68,228, 62, 46,178,102, 63,100,184,232, 62,100,251,101, 63,238,198,227, 62, 94,173,107, 63,168,130,225, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 68,209,249, 61, 70,134,219, 62,120,216,242, 61,124, 40,225, 62, 28, 27,177, 61,
- 42,240,219, 62, 76,131,196, 61,196, 97,216, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 31,178,109, 63,
-224, 68,228, 62, 94,173,107, 63,168,130,225, 62,144,102,114, 63,198, 23,220, 62, 41, 76,116, 63,139,153,222, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 56,163,120, 61, 58,252,208, 62, 76,131,196, 61,196, 97,216, 62, 28, 27,177, 61,
- 42,240,219, 62,128,183, 73, 61, 84,108,213, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 41, 76,116, 63,
-139,153,222, 62,144,102,114, 63,198, 23,220, 62, 84, 87,117, 63,221,255,211, 62,183,115,119, 63,140, 49,215, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,144, 29, 55, 61,207,183,194, 62, 56,163,120, 61, 58,252,208, 62,128,183, 73, 61,
- 84,108,213, 62,224,111,231, 60,100,142,198, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,183,115,119, 63,
-140, 49,215, 62, 84, 87,117, 63,221,255,211, 62,150, 20,118, 63, 60,110,196, 62, 49, 12,122, 63,246,  8,197, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 96,197,103, 61, 15,206,170, 62,144, 29, 55, 61,207,183,194, 62,224,111,231, 60,
-100,142,198, 62,240, 54, 16, 61,120,  4,167, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 49, 12,122, 63,
-246,  8,197, 62,150, 20,118, 63, 60,110,196, 62, 17,155,108, 63,130,201,178, 62, 84,190,110, 63,223, 77,172, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,148,252,246, 61,164,116,160, 62, 96,197,103, 61, 15,206,170, 62,240, 54, 16, 61,
-120,  4,167, 62,  8, 66,246, 61, 28,161,152, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 84,190,110, 63,
-223, 77,172, 62, 17,155,108, 63,130,201,178, 62, 21,180, 92, 63,202, 95,173, 62,151,  5, 90, 63,138, 61,167, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,144,216, 54, 62, 35, 76,163, 62,148,252,246, 61,164,116,160, 62,  8, 66,246, 61,
- 28,161,152, 62,194,251, 66, 62,163,102,158, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 17,155,108, 63,
-130,201,178, 62,198,132,109, 63,182,157,186, 62, 68, 32, 97, 63,192, 12,178, 62, 21,180, 92, 63,202, 95,173, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 48,185, 36, 62, 16,  7,166, 62, 40, 91,221, 61,  4,194,167, 62,148,252,246, 61,
-164,116,160, 62,144,216, 54, 62, 35, 76,163, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,150, 20,118, 63,
- 60,110,196, 62, 84,225,115, 63,208, 85,198, 62,198,132,109, 63,182,157,186, 62, 17,155,108, 63,130,201,178, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 40, 91,221, 61,  4,194,167, 62,244,221,134, 61,121,164,175, 62, 96,197,103, 61,
- 15,206,170, 62,148,252,246, 61,164,116,160, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 84, 87,117, 63,
-221,255,211, 62,222, 48,116, 63,169,  8,209, 62, 84,225,115, 63,208, 85,198, 62,150, 20,118, 63, 60,110,196, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,244,221,134, 61,121,164,175, 62,160,108, 93, 61, 17,207,190, 62,144, 29, 55, 61,
-207,183,194, 62, 96,197,103, 61, 15,206,170, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,144,102,114, 63,
-198, 23,220, 62,174,151,113, 63, 26,229,214, 62,222, 48,116, 63,169,  8,209, 62, 84, 87,117, 63,221,255,211, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,160,108, 93, 61, 17,207,190, 62, 12,155,135, 61,166, 39,201, 62, 56,163,120, 61,
- 58,252,208, 62,144, 29, 55, 61,207,183,194, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 94,173,107, 63,
-168,130,225, 62,228,239,107, 63, 62, 59,218, 62,174,151,113, 63, 26,229,214, 62,144,102,114, 63,198, 23,220, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 12,155,135, 61,166, 39,201, 62,128, 47,195, 61,  6, 11,207, 62, 76,131,196, 61,
-196, 97,216, 62, 56,163,120, 61, 58,252,208, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 94,173,107, 63,
-168,130,225, 62,100,251,101, 63,238,198,227, 62, 71,205,102, 63,132, 94,219, 62,228,239,107, 63, 62, 59,218, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,192,157,244, 61,157,137,209, 62, 68,209,249, 61, 70,134,219, 62, 76,131,196, 61,
-196, 97,216, 62,128, 47,195, 61,  6, 11,207, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,224, 19, 69, 63,
- 24, 68,190, 62,216,217, 77, 63,  7,228,157, 62,236, 35, 85, 63,164,201,181, 62, 56, 92, 78, 63,177,114,188, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 32,  0,122, 91, 80, 62, 72, 18,174, 62,154,118,111, 62,120,108,152, 62,250, 78,134, 62,
-148,213,186, 62,162,163,104, 62,150,180,182, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 32,  0,216,217, 77, 63,
-  7,228,157, 62,151,  5, 90, 63,138, 61,167, 62, 21,180, 92, 63,202, 95,173, 62,236, 35, 85, 63,164,201,181, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0,144,216, 54, 62, 35, 76,163, 62,194,251, 66, 62,163,102,158, 62,154,118,111, 62,
-120,108,152, 62,122, 91, 80, 62, 72, 18,174, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0, 53, 64, 74, 63,
-171, 31,224, 62,224, 19, 69, 63, 24, 68,190, 62, 56, 92, 78, 63,177,114,188, 62,217,106, 81, 63, 14,214,232, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,162,163,104, 62,150,180,182, 62,250, 78,134, 62,148,213,186, 62,184,112,114, 62,
-248,169,220, 62, 88, 93, 84, 62, 50,105,228, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,106,154, 93, 63,
-226, 26,233, 62,196,229, 94, 63,128,195,224, 62,100,251,101, 63,238,198,227, 62, 46,178,102, 63,100,184,232, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 68,209,249, 61, 70,134,219, 62,108,187, 28, 62, 48, 86,217, 62,128,  1, 33, 62,
- 70,210,226, 62,120,216,242, 61,124, 40,225, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 21,180, 92, 63,
-202, 95,173, 62, 68, 32, 97, 63,192, 12,178, 62,  9,215, 94, 63,  4, 54,186, 62,236, 35, 85, 63,164,201,181, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 60,122, 41, 62, 16, 58,175, 62, 48,185, 36, 62, 16,  7,166, 62,144,216, 54, 62,
- 35, 76,163, 62,122, 91, 80, 62, 72, 18,174, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,230, 78, 95, 63,
-  4,233,189, 62, 32,188, 86, 63, 44, 62,190, 62,236, 35, 85, 63,164,201,181, 62,  9,215, 94, 63,  4, 54,186, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,122, 91, 80, 62, 72, 18,174, 62, 78,118, 71, 62, 27, 49,182, 62, 52,225, 37, 62,
- 40, 12,179, 62, 60,122, 41, 62, 16, 58,175, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 70,166, 92, 63,
-  0,166,197, 62, 32,188, 86, 63, 44, 62,190, 62,230, 78, 95, 63,  4,233,189, 62,226, 13, 95, 63, 37,152,194, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 52,225, 37, 62, 40, 12,179, 62, 78,118, 71, 62, 27, 49,182, 62,142,143, 45, 62,
-237, 37,188, 62,106,230, 36, 62,222, 27,184, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,248, 90, 95, 63,
-100,122,207, 62,108,249, 90, 63, 58,199,212, 62, 32,188, 86, 63, 44, 62,190, 62, 70,166, 92, 63,  0,166,197, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 78,118, 71, 62, 27, 49,182, 62,110, 56, 48, 62,230, 43,205, 62,174,250, 30, 62,
- 26, 12,198, 62,142,143, 45, 62,237, 37,188, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,196,229, 94, 63,
-128,195,224, 62,108,249, 90, 63, 58,199,212, 62,248, 90, 95, 63,100,122,207, 62, 92,104, 98, 63,197,136,215, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,174,250, 30, 62, 26, 12,198, 62,110, 56, 48, 62,230, 43,205, 62,108,187, 28, 62,
- 48, 86,217, 62,212, 59, 15, 62,224, 50,206, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,100,251,101, 63,
-238,198,227, 62,196,229, 94, 63,128,195,224, 62, 92,104, 98, 63,197,136,215, 62, 71,205,102, 63,132, 94,219, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,212, 59, 15, 62,224, 50,206, 62,108,187, 28, 62, 48, 86,217, 62, 68,209,249, 61,
- 70,134,219, 62,192,157,244, 61,157,137,209, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,217,106, 81, 63,
- 14,214,232, 62,108,249, 90, 63, 58,199,212, 62,196,229, 94, 63,128,195,224, 62,106,154, 93, 63,226, 26,233, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,108,187, 28, 62, 48, 86,217, 62,110, 56, 48, 62,230, 43,205, 62, 88, 93, 84, 62,
- 50,105,228, 62,128,  1, 33, 62, 70,210,226, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,217,106, 81, 63,
- 14,214,232, 62, 56, 92, 78, 63,177,114,188, 62, 32,188, 86, 63, 44, 62,190, 62,108,249, 90, 63, 58,199,212, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 78,118, 71, 62, 27, 49,182, 62,162,163,104, 62,150,180,182, 62, 88, 93, 84, 62,
- 50,105,228, 62,110, 56, 48, 62,230, 43,205, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 56, 92, 78, 63,
-177,114,188, 62,236, 35, 85, 63,164,201,181, 62, 32,188, 86, 63, 44, 62,190, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 78,118, 71, 62, 27, 49,182, 62,122, 91, 80, 62, 72, 18,174, 62,162,163,104, 62,
-150,180,182, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 71,205,102, 63,
-132, 94,219, 62, 92,104, 98, 63,197,136,215, 62,182,109,100, 63,149,255,210, 62, 54, 86,104, 63,209,241,214, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,160,107,  7, 62, 34,103,200, 62,212, 59, 15, 62,224, 50,206, 62,192,157,244, 61,
-157,137,209, 62,  8,  2,232, 61, 20,214,203, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 92,104, 98, 63,
-197,136,215, 62,248, 90, 95, 63,100,122,207, 62,112,206, 97, 63, 10,202,204, 62,182,109,100, 63,149,255,210, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 64, 68, 21, 62,107, 55,194, 62,174,250, 30, 62, 26, 12,198, 62,212, 59, 15, 62,
-224, 50,206, 62,160,107,  7, 62, 34,103,200, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,248, 90, 95, 63,
-100,122,207, 62, 70,166, 92, 63,  0,166,197, 62, 82,241, 94, 63, 40,103,198, 62,112,206, 97, 63, 10,202,204, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 20,225, 35, 62, 39, 50,188, 62,142,143, 45, 62,237, 37,188, 62,174,250, 30, 62,
- 26, 12,198, 62, 64, 68, 21, 62,107, 55,194, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 70,166, 92, 63,
-  0,166,197, 62,226, 13, 95, 63, 37,152,194, 62,118,  1, 97, 63, 47,226,195, 62, 82,241, 94, 63, 40,103,198, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 12, 43, 28, 62,186,177,184, 62,106,230, 36, 62,222, 27,184, 62,142,143, 45, 62,
-237, 37,188, 62, 20,225, 35, 62, 39, 50,188, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,226, 13, 95, 63,
- 37,152,194, 62,230, 78, 95, 63,  4,233,189, 62, 51,113, 97, 63, 92,151,189, 62,118,  1, 97, 63, 47,226,195, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,104, 67, 29, 62, 58,199,177, 62, 52,225, 37, 62, 40, 12,179, 62,106,230, 36, 62,
-222, 27,184, 62, 12, 43, 28, 62,186,177,184, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,230, 78, 95, 63,
-  4,233,189, 62,  9,215, 94, 63,  4, 54,186, 62, 96, 69, 96, 63,152,133,187, 62, 51,113, 97, 63, 92,151,189, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,140, 14, 35, 62, 33, 19,176, 62, 60,122, 41, 62, 16, 58,175, 62, 52,225, 37, 62,
- 40, 12,179, 62,104, 67, 29, 62, 58,199,177, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,  9,215, 94, 63,
-  4, 54,186, 62, 68, 32, 97, 63,192, 12,178, 62,112, 91, 98, 63,149,128,182, 62, 96, 69, 96, 63,152,133,187, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,228,107, 29, 62, 95,230,169, 62, 48,185, 36, 62, 16,  7,166, 62, 60,122, 41, 62,
- 16, 58,175, 62,140, 14, 35, 62, 33, 19,176, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,228,239,107, 63,
- 62, 59,218, 62, 71,205,102, 63,132, 94,219, 62, 54, 86,104, 63,209,241,214, 62, 34, 27,109, 63,155,254,214, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,  8,  2,232, 61, 20,214,203, 62,192,157,244, 61,157,137,209, 62,128, 47,195, 61,
-  6, 11,207, 62, 36,174,184, 61,216,130,202, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,174,151,113, 63,
- 26,229,214, 62,228,239,107, 63, 62, 59,218, 62, 34, 27,109, 63,155,254,214, 62, 69,134,113, 63,156, 82,212, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 36,174,184, 61,216,130,202, 62,128, 47,195, 61,  6, 11,207, 62, 12,155,135, 61,
-166, 39,201, 62, 60,114,138, 61, 28, 61,197, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,222, 48,116, 63,
-169,  8,209, 62,174,151,113, 63, 26,229,214, 62, 69,134,113, 63,156, 82,212, 62, 42,143,114, 63, 24,168,207, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 60,114,138, 61, 28, 61,197, 62, 12,155,135, 61,166, 39,201, 62,160,108, 93, 61,
- 17,207,190, 62,184, 85,132, 61, 22,211,189, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 84,225,115, 63,
-208, 85,198, 62,222, 48,116, 63,169,  8,209, 62, 42,143,114, 63, 24,168,207, 62,203,125,114, 63, 96,114,200, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,184, 85,132, 61, 22,211,189, 62,160,108, 93, 61, 17,207,190, 62,244,221,134, 61,
-121,164,175, 62, 16,152,145, 61, 84,214,179, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,198,132,109, 63,
-182,157,186, 62, 84,225,115, 63,208, 85,198, 62,203,125,114, 63, 96,114,200, 62,177,192,109, 63,152,240,190, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 16,152,145, 61, 84,214,179, 62,244,221,134, 61,121,164,175, 62, 40, 91,221, 61,
-  4,194,167, 62, 64,226,208, 61,232, 58,172, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 68, 32, 97, 63,
-192, 12,178, 62,198,132,109, 63,182,157,186, 62,177,192,109, 63,152,240,190, 62,112, 91, 98, 63,149,128,182, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 64,226,208, 61,232, 58,172, 62, 40, 91,221, 61,  4,194,167, 62, 48,185, 36, 62,
- 16,  7,166, 62,228,107, 29, 62, 95,230,169, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,118,  1, 97, 63,
- 47,226,195, 62, 51,113, 97, 63, 92,151,189, 62,215,139,102, 63, 15,109,193, 62, 54, 47,100, 63,186,115,198, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 92,169,  5, 62,168,115,179, 62,104, 67, 29, 62, 58,199,177, 62, 12, 43, 28, 62,
-186,177,184, 62, 50, 97, 13, 62, 50, 42,186, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 54, 47,100, 63,
-186,115,198, 62,215,139,102, 63, 15,109,193, 62,174,241,105, 63,204,  8,200, 62, 71,233,103, 63,178, 42,204, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,228,171,229, 61, 41, 42,185, 62, 92,169,  5, 62,168,115,179, 62, 50, 97, 13, 62,
- 50, 42,186, 62, 92,248,243, 61, 96, 22,191, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 71,233,103, 63,
-178, 42,204, 62,174,241,105, 63,204,  8,200, 62, 51, 37,108, 63,249,  3,205, 62, 56,212,106, 63, 96,238,208, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,120, 99,202, 61,192, 49,190, 62,228,171,229, 61, 41, 42,185, 62, 92,248,243, 61,
- 96, 22,191, 62,160,209,211, 61,108,159,195, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 56,212,106, 63,
- 96,238,208, 62, 51, 37,108, 63,249,  3,205, 62, 56, 73,110, 63,186,119,206, 62, 46,191,109, 63, 92, 64,210, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,244,234,179, 61,240,219,190, 62,120, 99,202, 61,192, 49,190, 62,160,209,211, 61,
-108,159,195, 62,196,129,181, 61,204, 14,196, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 34, 27,109, 63,
-155,254,214, 62, 54, 86,104, 63,209,241,214, 62, 56,212,106, 63, 96,238,208, 62, 46,191,109, 63, 92, 64,210, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,160,209,211, 61,108,159,195, 62,  8,  2,232, 61, 20,214,203, 62, 36,174,184, 61,
-216,130,202, 62,196,129,181, 61,204, 14,196, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,182,109,100, 63,
-149,255,210, 62, 71,233,103, 63,178, 42,204, 62, 56,212,106, 63, 96,238,208, 62, 54, 86,104, 63,209,241,214, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,160,209,211, 61,108,159,195, 62, 92,248,243, 61, 96, 22,191, 62,160,107,  7, 62,
- 34,103,200, 62,  8,  2,232, 61, 20,214,203, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,182,109,100, 63,
-149,255,210, 62,112,206, 97, 63, 10,202,204, 62, 54, 47,100, 63,186,115,198, 62, 71,233,103, 63,178, 42,204, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 50, 97, 13, 62, 50, 42,186, 62, 64, 68, 21, 62,107, 55,194, 62,160,107,  7, 62,
- 34,103,200, 62, 92,248,243, 61, 96, 22,191, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,118,  1, 97, 63,
- 47,226,195, 62, 54, 47,100, 63,186,115,198, 62,112,206, 97, 63, 10,202,204, 62, 82,241, 94, 63, 40,103,198, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 64, 68, 21, 62,107, 55,194, 62, 50, 97, 13, 62, 50, 42,186, 62, 12, 43, 28, 62,
-186,177,184, 62, 20,225, 35, 62, 39, 50,188, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 96, 69, 96, 63,
-152,133,187, 62,112, 91, 98, 63,149,128,182, 62,215,139,102, 63, 15,109,193, 62, 51,113, 97, 63, 92,151,189, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 92,169,  5, 62,168,115,179, 62,228,107, 29, 62, 95,230,169, 62,140, 14, 35, 62,
- 33, 19,176, 62,104, 67, 29, 62, 58,199,177, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,177,192,109, 63,
-152,240,190, 62,174,241,105, 63,204,  8,200, 62,215,139,102, 63, 15,109,193, 62,112, 91, 98, 63,149,128,182, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 92,169,  5, 62,168,115,179, 62,228,171,229, 61, 41, 42,185, 62, 64,226,208, 61,
-232, 58,172, 62,228,107, 29, 62, 95,230,169, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,203,125,114, 63,
- 96,114,200, 62, 51, 37,108, 63,249,  3,205, 62,174,241,105, 63,204,  8,200, 62,177,192,109, 63,152,240,190, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,228,171,229, 61, 41, 42,185, 62,120, 99,202, 61,192, 49,190, 62, 16,152,145, 61,
- 84,214,179, 62, 64,226,208, 61,232, 58,172, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 42,143,114, 63,
- 24,168,207, 62, 56, 73,110, 63,186,119,206, 62, 51, 37,108, 63,249,  3,205, 62,203,125,114, 63, 96,114,200, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,120, 99,202, 61,192, 49,190, 62,244,234,179, 61,240,219,190, 62,184, 85,132, 61,
- 22,211,189, 62, 16,152,145, 61, 84,214,179, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 69,134,113, 63,
-156, 82,212, 62, 46,191,109, 63, 92, 64,210, 62, 56, 73,110, 63,186,119,206, 62, 42,143,114, 63, 24,168,207, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,244,234,179, 61,240,219,190, 62,196,129,181, 61,204, 14,196, 62, 60,114,138, 61,
- 28, 61,197, 62,184, 85,132, 61, 22,211,189, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 34, 27,109, 63,
-155,254,214, 62, 46,191,109, 63, 92, 64,210, 62, 69,134,113, 63,156, 82,212, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 60,114,138, 61, 28, 61,197, 62,196,129,181, 61,204, 14,196, 62, 36,174,184, 61,
-216,130,202, 62,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 84,190,110, 63,
-223, 77,172, 62,151,  5, 90, 63,138, 61,167, 62, 22, 25, 96, 63,246,248,149, 62,162,176,122, 63,145,215,161, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0, 64,234, 54, 62,146,219,140, 62,194,251, 66, 62,163,102,158, 62,  8, 66,246, 61,
- 28,161,152, 62,172,241,189, 61, 13,107,132, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 49, 12,122, 63,
-246,  8,197, 62, 84,190,110, 63,223, 77,172, 62,162,176,122, 63,145,215,161, 62,188,255,126, 63,115,248,198, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0,172,241,189, 61, 13,107,132, 62,  8, 66,246, 61, 28,161,152, 62,240, 54, 16, 61,
-120,  4,167, 62,  0,  8,163, 58, 39, 69,162, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0,183,115,119, 63,
-140, 49,215, 62, 49, 12,122, 63,246,  8,197, 62,188,255,126, 63,115,248,198, 62, 47,  6,122, 63,248,157,216, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,  0,  8,163, 58, 39, 69,162, 62,240, 54, 16, 61,120,  4,167, 62,224,111,231, 60,
-100,142,198, 62,224,248, 14, 60, 70,141,198, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0, 41, 76,116, 63,
-139,153,222, 62,183,115,119, 63,140, 49,215, 62, 47,  6,122, 63,248,157,216, 62,134, 98,119, 63,204, 37,225, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,224,248, 14, 60, 70,141,198, 62,224,111,231, 60,100,142,198, 62,128,183, 73, 61,
- 84,108,213, 62, 80,210,229, 60, 32,239,218, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 31,178,109, 63,
-224, 68,228, 62, 41, 76,116, 63,139,153,222, 62,134, 98,119, 63,204, 37,225, 62, 46,185,115, 63, 90,157,234, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0, 80,210,229, 60, 32,239,218, 62,128,183, 73, 61, 84,108,213, 62, 28, 27,177, 61,
- 42,240,219, 62, 56,103,122, 61, 30, 10,230, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0, 46,178,102, 63,
-100,184,232, 62, 31,178,109, 63,224, 68,228, 62, 46,185,115, 63, 90,157,234, 62,244,134,106, 63,234, 64,246, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0, 56,103,122, 61, 30, 10,230, 62, 28, 27,177, 61, 42,240,219, 62,120,216,242, 61,
-124, 40,225, 62,212,222,209, 61,238,123,240, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0,235,188,  5, 63,
-252, 74, 98, 63,200,111,248, 62,197,105,112, 63,  0, 49,231, 62,118,190,107, 63,150, 57,255, 62, 53, 14, 96, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 80, 99, 95, 62,149,194, 94, 63, 58,  8, 62, 62, 10,154, 89, 63, 40, 24, 92, 62,
- 14, 82, 74, 63,112, 11,112, 62,157,133, 78, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,235,188,  5, 63,
-252, 74, 98, 63,136,139, 12, 63,138,233,101, 63,116, 45,  6, 63,112,245,113, 63,200,111,248, 62,197,105,112, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 68,219, 36, 62,249,186, 81, 63, 28,254, 65, 62, 20, 55, 70, 63, 40, 24, 92, 62,
- 14, 82, 74, 63, 58,  8, 62, 62, 10,154, 89, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,136,139, 12, 63,
-138,233,101, 63,  5,130, 12, 63,149,216,108, 63,116, 45,  6, 63,112,245,113, 63,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,112,  0, 68,219, 36, 62,249,186, 81, 63, 76,  1, 42, 62, 39,178, 73, 63, 28,254, 65, 62,
- 20, 55, 70, 63,  0,  0,128, 63,  0,  0,128, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,112,  0,120, 89,103, 63,
-105, 76,  2, 63,106,154, 93, 63,226, 26,233, 62, 46,178,102, 63,100,184,232, 62,244,134,106, 63,234, 64,246, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,120,216,242, 61,124, 40,225, 62,128,  1, 33, 62, 70,210,226, 62,116,128,234, 61,
-200, 39,  0, 63,212,222,209, 61,238,123,240, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,226, 44,245, 62,
-129,140, 96, 63,150, 57,255, 62, 53, 14, 96, 63,  0, 49,231, 62,118,190,107, 63, 42,135,227, 62, 58,  2,101, 63,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 80, 99, 95, 62,149,194, 94, 63,112, 11,112, 62,157,133, 78, 63, 74, 84,120, 62,
-104, 32, 83, 63,110,103,122, 62,236,255, 92, 63,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,216,217, 77, 63,
-  7,228,157, 62,160,225, 90, 63,110,121,137, 62, 22, 25, 96, 63,246,248,149, 62,151,  5, 90, 63,138, 61,167, 62,136,168, 49,  3,
-  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0, 64,234, 54, 62,146,219,140, 62,166,125, 74, 62,252, 30,130, 62,154,118,111, 62,
-120,108,152, 62,194,251, 66, 62,163,102,158, 62,136,168, 49,  3,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0, 68, 65, 84, 65,
- 64, 31,  0,  0,168, 76, 53,  3,  0,  0,  0,  0, 53,  0,  0,  0,208,  7,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,
+  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, 68, 65, 84, 65, 16,  9,  0,  0,104,235, 26,  4,  0,  0,  0,  0, 56,  0,  0,  0,116,  0,  0,  0,214, 28,215, 63,
+ 77, 31, 87, 65, 74, 36,190,192,  1,192,  1,192,129, 90,  0,  0,173, 86,161, 64,144, 87, 33, 65, 74, 36,190,192,  1,192,  1,192,
+129, 90,  0,  0,204,194,135,184,112, 59, 60, 65, 72, 36,190,192,  0,  0,  0,  0,255,127,  0,  0, 24, 33,215,191,147, 87, 33, 65,
+ 68, 36,190,192,  0,  0,  0,  0,255,127,  0,  0,  9, 32, 87,192,182,115,  6, 65, 68, 36,190,192,  0,  0,  0,  0,255,127,  0,  0,
+195, 87,161,192,179, 31,215, 64, 66, 36,190,192,  0,  0,  0,  0,255,127,  0,  0,202, 28,215, 63,146, 87, 33, 65, 72, 36,190,192,
+  0,  0,  0,  0,255,127,  0,  0, 71,248,139,184,181,115,  6, 65, 70, 36,190,192,  0,  0,  0,  0,255,127,  0,  0, 41, 33,215,191,
+175, 31,215, 64, 68, 36,190,192,  0,  0,  0,  0,255,127,  0,  0, 15, 32, 87,192,244, 87,161, 64, 66, 36,190,192,  0,  0,  0,  0,
+255,127,  0,  0,223, 29, 87, 64,179,115,  6, 65, 72, 36,190,192,  0,  0,  0,  0,255,127,  0,  0,220,160,141,184,242, 87,161, 64,
+ 68, 36,190,192,  0,  0,  0,  0,255,127,  0,  0,172, 86,161, 64,170, 31,215, 64, 72, 36,190,192,  0,  0,  0,  0,255,127,  0,  0,
+218, 29, 87, 64,240, 87,161, 64, 70, 36,190,192,  0,  0,  0,  0,255,127,  0,  0,123, 31,215,192,180,115,  6, 65,136, 43,100,192,
+129, 90,127,165,  0,  0,  0,  0,194, 87,161,192,147, 87, 33, 65,142, 43,100,192,129, 90,127,165,  0,  0,  0,  0, 11, 32, 87,192,
+113, 59, 60, 65,147, 43,100,192,129, 90,127,165,  0,  0,  0,  0, 45, 33,215,191, 81, 31, 87, 65,153, 43,100,192,129, 90,127,165,
+  0,  0,  0,  0,123, 31,215,192,180,115,  6, 65,253, 28,152,191,129, 90,127,165,  0,  0,  0,  0,194, 87,161,192,147, 87, 33, 65,
+  8, 29,152,191,129, 90,127,165,  0,  0,  0,  0, 11, 32, 87,192,113, 59, 60, 65, 19, 29,152,191,129, 90,127,165,  0,  0,  0,  0,
+ 45, 33,215,191, 81, 31, 87, 65, 30, 29,152,191,129, 90,127,165,  0,  0,  0,  0,123, 31,215,192,180,115,  6, 65, 12, 29,152, 63,
+129, 90,127,165,  0,  0,  0,  0,194, 87,161,192,147, 87, 33, 65,  1, 29,152, 63,129, 90,127,165,  0,  0,  0,  0, 11, 32, 87,192,
+113, 59, 60, 65,245, 28,152, 63,129, 90,127,165,  0,  0,  0,  0, 45, 33,215,191, 81, 31, 87, 65,234, 28,152, 63,129, 90,127,165,
+  0,  0,  0,  0,122, 31,215,192,181,115,  6, 65,139, 43,100, 64,129, 90,127,165,  0,  0,  0,  0,193, 87,161,192,148, 87, 33, 65,
+133, 43,100, 64,129, 90,127,165,  0,  0,  0,  0,  9, 32, 87,192,114, 59, 60, 65,128, 43,100, 64,129, 90,127,165,  0,  0,  0,  0,
+ 41, 33,215,191, 81, 31, 87, 65,128, 43,100, 64,129, 90,127,165,  0,  0,  0,  0,123, 31,215,192,180,115,  6, 65, 72, 36,190,192,
+255, 63,  1,192,129, 90,  0,  0,194, 87,161,192,147, 87, 33, 65, 74, 36,190,192,255, 63,  1,192,129, 90,  0,  0, 11, 32, 87,192,
+113, 59, 60, 65, 76, 36,190,192,255, 63,  1,192,129, 90,  0,  0, 45, 33,215,191, 81, 31, 87, 65, 78, 36,190,192,255, 63,  1,192,
+129, 90,  0,  0,183,115,  6,193,128, 31,215, 64,127, 43,100, 64,129, 90,127,165,  0,  0,  0,  0,184,115,  6,193,127, 31,215, 64,
+232, 28,152, 63,129, 90,127,165,  0,  0,  0,  0,184,115,  6,193,127, 31,215, 64, 32, 29,152,191,129, 90,127,165,  0,  0,  0,  0,
+184,115,  6,193,127, 31,215, 64,154, 43,100,192,129, 90,127,165,  0,  0,  0,  0,222, 33,215,191,210,189,135, 56, 72, 36,190,192,
+  0,  0,  0,  0,255,127,  0,  0,103, 32, 87,192, 14, 33,215, 63, 72, 36,190,192,  0,  0,  0,  0,255,127,  0,  0,241, 87,161,192,
+  2, 32, 87, 64, 72, 36,190,192,  0,  0,  0,  0,255,127,  0,  0,171, 31,215,192,190, 87,161, 64, 72, 36,190,192,  0,  0,  0,  0,
+255,127,  0,  0,235,192,138,184, 43,  3,114, 65,134, 43,100,192,  0,  0,  1,128,  0,  0,  0,  0,190, 28,215, 63, 78, 31, 87, 65,
+140, 43,100,192,127,165,127,165,  0,  0,  0,  0,213, 29, 87, 64,112, 59, 60, 65,146, 43,100,192,127,165,127,165,  0,  0,  0,  0,
+175, 86,161, 64,146, 87, 33, 65,151, 43,100,192,127,165,127,165,  0,  0,  0,  0,235,192,138,184, 43,  3,114, 65,248, 28,152,191,
+  0,  0,  1,128,  0,  0,  0,  0,190, 28,215, 63, 78, 31, 87, 65,  4, 29,152,191,127,165,127,165,  0,  0,  0,  0,213, 29, 87, 64,
+112, 59, 60, 65, 15, 29,152,191,127,165,127,165,  0,  0,  0,  0,235,192,138,184, 43,  3,114, 65, 16, 29,152, 63,  0,  0,  1,128,
+  0,  0,  0,  0,190, 28,215, 63, 78, 31, 87, 65,  4, 29,152, 63,127,165,127,165,  0,  0,  0,  0,213, 29, 87, 64,112, 59, 60, 65,
+249, 28,152, 63,127,165,127,165,  0,  0,  0,  0,175, 86,161, 64,146, 87, 33, 65,237, 28,152, 63,127,165,127,165,  0,  0,  0,  0,
+235,192,138,184, 43,  3,114, 65,142, 43,100, 64,  0,  0,  1,128,  0,  0,  0,  0,190, 28,215, 63, 78, 31, 87, 65,136, 43,100, 64,
+127,165,127,165,  0,  0,  0,  0,221, 29, 87, 64,110, 59, 60, 65,130, 43,100, 64,127,165,127,165,  0,  0,  0,  0,175, 86,161, 64,
+146, 87, 33, 65,131, 43,100, 64,127,165,127,165,  0,  0,  0,  0,235,192,138,184, 43,  3,114, 65, 72, 36,190,192,  0,  0,126,151,
+230, 73,  0,  0,213, 29, 87, 64,112, 59, 60, 65, 76, 36,190,192,  1,192,  1,192,129, 90,  0,  0,149, 30,215, 64,151,115,  6, 65,
+ 72, 36,190,192,  1,192,  1,192,129, 90,  0,  0, 42,115,  6, 65,117, 31,215, 64,137, 43,100, 64,127,165,127,165,  0,  0,  0,  0,
+149, 30,215, 64,151,115,  6, 65,143, 43,100, 64,127,165,127,165,  0,  0,  0,  0, 42,115,  6, 65,117, 31,215, 64,  6, 29,152, 63,
+127,165,127,165,  0,  0,  0,  0,149, 30,215, 64,151,115,  6, 65, 18, 29,152, 63,127,165,127,165,  0,  0,  0,  0, 42,115,  6, 65,
+117, 31,215, 64,  2, 29,152,191,127,165,127,165,  0,  0,  0,  0,149, 30,215, 64,151,115,  6, 65,246, 28,152,191,127,165,127,165,
+  0,  0,  0,  0, 42,115,  6, 65,117, 31,215, 64,139, 43,100,192,127,165,127,165,  0,  0,  0,  0,  3, 32, 87, 64,150, 29,215, 63,
+ 68, 36,190,192,  0,  0,  0,  0,254,127,  0,  0,126, 31,215, 64,217, 86,161, 64, 72, 36,190,192,  0,  0,  0,  0,254,127,  0,  0,
+158,115,  6, 65,146, 30,215, 64, 72, 36,190,192,  1,192,  1,192,130, 90,  0,  0,158,115,  6, 65,146, 30,215, 64,244, 35,190, 64,
+  1,192,  1,192,130, 90,  0,  0,126, 31,215, 64,217, 86,161, 64,244, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,192, 87,161, 64,
+ 62, 30, 87, 64,248, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,  3, 32, 87, 64,150, 29,215, 63,248, 35,190, 64,  0,  0,  0,  0,
+255,127,  0,  0, 15, 33,215, 63, 24,  2, 41,184,250, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,149, 30,215, 64,151,115,  6, 65,
+244, 35,190, 64,  1,192,  1,192,129, 90,  0,  0,213, 29, 87, 64,112, 59, 60, 65,240, 35,190, 64,  1,192,  1,192,129, 90,  0,  0,
+235,192,138,184, 43,  3,114, 65,244, 35,190, 64,  0,  0,126,151,230, 73,  0,  0,171, 31,215,192,190, 87,161, 64,244, 35,190, 64,
+  0,  0,  0,  0,255,127,  0,  0,241, 87,161,192,  2, 32, 87, 64,244, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,103, 32, 87,192,
+ 14, 33,215, 63,244, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,222, 33,215,191,210,189,135, 56,244, 35,190, 64,  0,  0,  0,  0,
+255,127,  0,  0, 45, 33,215,191, 81, 31, 87, 65,238, 35,190, 64,255, 63,  1,192,129, 90,  0,  0, 11, 32, 87,192,113, 59, 60, 65,
+240, 35,190, 64,255, 63,  1,192,129, 90,  0,  0,194, 87,161,192,147, 87, 33, 65,242, 35,190, 64,255, 63,  1,192,129, 90,  0,  0,
+123, 31,215,192,180,115,  6, 65,244, 35,190, 64,255, 63,  1,192,129, 90,  0,  0,254,226,142,184,239, 33,215, 63,248, 35,190, 64,
+  0,  0,  0,  0,255,127,  1,  0,189, 28,215, 63,107, 32, 87, 64,248, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,218, 29, 87, 64,
+240, 87,161, 64,246, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,172, 86,161, 64,170, 31,215, 64,244, 35,190, 64,  0,  0,  0,  0,
+255,127,  0,  0, 46, 33,215,191,113, 32, 87, 64,250, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,220,160,141,184,242, 87,161, 64,
+248, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,197, 28,215, 63,172, 31,215, 64,246, 35,190, 64,  0,  0,  0,  0,254,127,  0,  0,
+223, 29, 87, 64,179,115,  6, 65,244, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0, 15, 32, 87,192,244, 87,161, 64,250, 35,190, 64,
+  0,  0,  0,  0,255,127,  0,  0, 41, 33,215,191,175, 31,215, 64,248, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0, 71,248,139,184,
+181,115,  6, 65,246, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,202, 28,215, 63,146, 87, 33, 65,244, 35,190, 64,  0,  0,  0,  0,
+255,127,  0,  0,195, 87,161,192,179, 31,215, 64,250, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,  9, 32, 87,192,182,115,  6, 65,
+248, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0, 24, 33,215,191,147, 87, 33, 65,248, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,
+204,194,135,184,112, 59, 60, 65,244, 35,190, 64,  0,  0,  0,  0,255,127,  0,  0,173, 86,161, 64,144, 87, 33, 65,242, 35,190, 64,
+  1,192,  1,192,129, 90,  0,  0,214, 28,215, 63, 77, 31, 87, 65,242, 35,190, 64,  1,192,  1,192,129, 90,  0,  0,183,115,  6,193,
+127, 31,215, 64,238, 35,190, 64,255, 63,  1,192,129, 90,  0,  0, 98,234, 53, 56, 38, 33,215,191,244, 35,190, 64,  0,  0,  0,  0,
+255,127,  0,  0,193, 87,161, 64, 62, 30, 87, 64, 69, 36,190,192,  0,  0,  0,  0,255,127,  0,  0, 15, 33,215, 63,226,  3, 41,184,
+ 67, 36,190,192,  0,  0,  0,  0,255,127,  0,  0, 98,234, 53, 56, 38, 33,215,191, 72, 36,190,192,  0,  0,  0,  0,255,127,  0,  0,
+150, 30,215, 64,151,115,  6, 65,135, 43,100,192,127,165,127,165,  0,  0,  0,  0,177, 86,161, 64,146, 87, 33, 65, 30, 29,152,191,
+127,165,127,165,  0,  0,  0,  0,183,115,  6,193,127, 31,215, 64, 78, 36,190,192,255, 63,  1,192,129, 90,  0,  0,222,158,142,184,
+239, 33,215, 63, 67, 36,190,192,  0,  0,  0,  0,255,127,  0,  0,191, 28,215, 63,107, 32, 87, 64, 69, 36,190,192,  0,  0,  0,  0,
+255,127,  0,  0, 44, 33,215,191,113, 32, 87, 64, 67, 36,190,192,  0,  0,  0,  0,255,127,  0,  0,201, 28,215, 63,172, 31,215, 64,
+ 71, 36,190,192,  0,  0,  0,  0,255,127,  0,  0, 68, 65, 84, 65,  8,  2,  0,  0,200,244, 26,  4,  0,  0,  0,  0,124,  1,  0,  0,
+  5,  0,  0,  0,  3,  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,  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, 24,247, 26,  4,  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,  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,  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,  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,  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,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 20, 10,  0,  0, 24,247, 26,  4,  0,  0,  0,  0, 53,  0,  0,  0,
+215,  0,  0,  0,  4,  0,  0,  0,  5,  0,  0,  0,  0,  0, 34,  0,  3,  0,  0,  0,  4,  0,  0,  0,  0,  0, 34,  0,  2,  0,  0,  0,
+  3,  0,  0,  0,  0,  0, 34,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0, 34,  0,  5,  0,  0,  0,  9,  0,  0,  0,  0,  0, 34,  0,
+  8,  0,  0,  0,  9,  0,  0,  0,  0,  0, 34,  0,  4,  0,  0,  0,  8,  0,  0,  0,  0,  0, 34,  0,  7,  0,  0,  0,  8,  0,  0,  0,
+  0,  0, 34,  0,  3,  0,  0,  0,  7,  0,  0,  0,  0,  0, 34,  0,  6,  0,  0,  0,  7,  0,  0,  0,  0,  0, 34,  0,  2,  0,  0,  0,
+  6,  0,  0,  0,  0,  0, 34,  0,  8,  0,  0,  0, 11,  0,  0,  0,  0,  0, 34,  0,  6,  0,  0,  0, 10,  0,  0,  0,  0,  0, 34,  0,
+  1,  0,  0,  0, 10,  0,  0,  0,  0,  0, 34,  0, 12,  0,  0,  0, 13,  0,  0,  0,  0,  0, 34,  0, 10,  0,  0,  0, 12,  0,  0,  0,
+  0,  0, 34,  0, 17,  0,  0,  0, 33,  0,  0,  0,  0,  0, 34,  0, 16,  0,  0,  0, 32,  0,  0,  0,  0,  0, 34,  0, 15,  0,  0,  0,
+ 31,  0,  0,  0,  0,  0, 34,  0, 14,  0,  0,  0, 30,  0,  0,  0,  0,  0, 34,  0, 17,  0,  0,  0, 21,  0,  0,  0,  0,  0, 34,  0,
+ 16,  0,  0,  0, 17,  0,  0,  0,  0,  0, 34,  0, 16,  0,  0,  0, 20,  0,  0,  0,  0,  0, 34,  0, 15,  0,  0,  0, 16,  0,  0,  0,
+  0,  0, 34,  0, 15,  0,  0,  0, 19,  0,  0,  0,  0,  0, 34,  0, 14,  0,  0,  0, 15,  0,  0,  0,  0,  0, 34,  0, 14,  0,  0,  0,
+ 18,  0,  0,  0,  0,  0, 34,  0, 21,  0,  0,  0, 25,  0,  0,  0,  0,  0, 34,  0, 20,  0,  0,  0, 21,  0,  0,  0,  0,  0, 34,  0,
+ 20,  0,  0,  0, 24,  0,  0,  0,  0,  0, 34,  0, 19,  0,  0,  0, 20,  0,  0,  0,  0,  0, 34,  0, 19,  0,  0,  0, 23,  0,  0,  0,
+  0,  0, 34,  0, 18,  0,  0,  0, 19,  0,  0,  0,  0,  0, 34,  0, 18,  0,  0,  0, 22,  0,  0,  0,  0,  0, 34,  0, 25,  0,  0,  0,
+ 29,  0,  0,  0,  0,  0, 34,  0, 24,  0,  0,  0, 25,  0,  0,  0,  0,  0, 34,  0, 24,  0,  0,  0, 28,  0,  0,  0,  0,  0, 34,  0,
+ 23,  0,  0,  0, 24,  0,  0,  0,  0,  0, 34,  0, 23,  0,  0,  0, 27,  0,  0,  0,  0,  0, 34,  0, 22,  0,  0,  0, 23,  0,  0,  0,
+  0,  0, 34,  0, 22,  0,  0,  0, 26,  0,  0,  0,  0,  0, 34,  0, 28,  0,  0,  0, 29,  0,  0,  0,  0,  0, 34,  0, 27,  0,  0,  0,
+ 28,  0,  0,  0,  0,  0, 34,  0, 26,  0,  0,  0, 27,  0,  0,  0,  0,  0, 34,  0, 30,  0,  0,  0, 31,  0,  0,  0,  0,  0, 34,  0,
+ 32,  0,  0,  0, 33,  0,  0,  0,  0,  0, 34,  0,  2,  0,  0,  0, 33,  0,  0,  0,  0,  0, 34,  0,  3,  0,  0,  0, 32,  0,  0,  0,
+  0,  0, 34,  0,  4,  0,  0,  0, 31,  0,  0,  0,  0,  0, 34,  0,  5,  0,  0,  0, 30,  0,  0,  0,  0,  0, 34,  0, 34,  0,  0,  0,
+ 35,  0,  0,  0,  0,  0, 34,  0, 36,  0,  0,  0, 37,  0,  0,  0,  0,  0, 34,  0, 38,  0,  0,  0, 39,  0,  0,  0,  0,  0, 34,  0,
+ 40,  0,  0,  0, 41,  0,  0,  0,  0,  0, 34,  0, 26,  0,  0,  0, 34,  0,  0,  0,  0,  0, 34,  0, 22,  0,  0,  0, 35,  0,  0,  0,
+  0,  0, 34,  0, 18,  0,  0,  0, 36,  0,  0,  0,  0,  0, 34,  0, 14,  0,  0,  0, 37,  0,  0,  0,  0,  0, 34,  0,  9,  0,  0,  0,
+ 40,  0,  0,  0,  0,  0, 34,  0,  5,  0,  0,  0, 41,  0,  0,  0,  0,  0, 34,  0, 52,  0,  0,  0, 63,  0,  0,  0,  0,  0, 34,  0,
+ 56,  0,  0,  0, 61,  0,  0,  0,  0,  0, 34,  0, 44,  0,  0,  0, 58,  0,  0,  0,  0,  0, 34,  0, 42,  0,  0,  0, 57,  0,  0,  0,
+  0,  0, 34,  0, 44,  0,  0,  0, 45,  0,  0,  0,  0,  0, 34,  0, 44,  0,  0,  0, 48,  0,  0,  0,  0,  0, 34,  0, 43,  0,  0,  0,
+ 44,  0,  0,  0,  0,  0, 34,  0, 43,  0,  0,  0, 47,  0,  0,  0,  0,  0, 34,  0, 42,  0,  0,  0, 43,  0,  0,  0,  0,  0, 34,  0,
+ 42,  0,  0,  0, 46,  0,  0,  0,  0,  0, 34,  0, 48,  0,  0,  0, 51,  0,  0,  0,  0,  0, 34,  0, 47,  0,  0,  0, 48,  0,  0,  0,
+  0,  0, 34,  0, 47,  0,  0,  0, 50,  0,  0,  0,  0,  0, 34,  0, 46,  0,  0,  0, 47,  0,  0,  0,  0,  0, 34,  0, 46,  0,  0,  0,
+ 49,  0,  0,  0,  0,  0, 34,  0, 52,  0,  0,  0, 56,  0,  0,  0,  0,  0, 34,  0, 51,  0,  0,  0, 52,  0,  0,  0,  0,  0, 34,  0,
+ 51,  0,  0,  0, 55,  0,  0,  0,  0,  0, 34,  0, 50,  0,  0,  0, 51,  0,  0,  0,  0,  0, 34,  0, 50,  0,  0,  0, 54,  0,  0,  0,
+  0,  0, 34,  0, 49,  0,  0,  0, 50,  0,  0,  0,  0,  0, 34,  0, 49,  0,  0,  0, 53,  0,  0,  0,  0,  0, 34,  0, 55,  0,  0,  0,
+ 56,  0,  0,  0,  0,  0, 34,  0, 54,  0,  0,  0, 55,  0,  0,  0,  0,  0, 34,  0, 53,  0,  0,  0, 54,  0,  0,  0,  0,  0, 34,  0,
+ 60,  0,  0,  0, 61,  0,  0,  0,  0,  0, 34,  0, 61,  0,  0,  0, 63,  0,  0,  0,  0,  0, 34,  0, 62,  0,  0,  0, 63,  0,  0,  0,
+  0,  0, 34,  0, 63,  0,  0,  0, 65,  0,  0,  0,  0,  0, 34,  0, 64,  0,  0,  0, 65,  0,  0,  0,  0,  0, 34,  0, 62,  0,  0,  0,
+ 64,  0,  0,  0,  0,  0, 34,  0,  1,  0,  0,  0, 58,  0,  0,  0,  0,  0, 34,  0,  0,  0,  0,  0, 58,  0,  0,  0,  0,  0, 34,  0,
+  0,  0,  0,  0, 57,  0,  0,  0,  0,  0, 34,  0,  0,  0,  0,  0, 43,  0,  0,  0,  0,  0, 34,  0,  1,  0,  0,  0, 45,  0,  0,  0,
+  0,  0, 34,  0,  1,  0,  0,  0, 59,  0,  0,  0,  0,  0, 34,  0, 29,  0,  0,  0, 53,  0,  0,  0,  0,  0, 34,  0, 25,  0,  0,  0,
+ 49,  0,  0,  0,  0,  0, 34,  0, 21,  0,  0,  0, 46,  0,  0,  0,  0,  0, 34,  0, 17,  0,  0,  0, 42,  0,  0,  0,  0,  0, 34,  0,
+ 12,  0,  0,  0, 59,  0,  0,  0,  0,  0, 34,  0,  6,  0,  0,  0, 58,  0,  0,  0,  0,  0, 34,  0, 66,  0,  0,  0, 69,  0,  0,  0,
+  0,  0, 34,  0, 59,  0,  0,  0, 69,  0,  0,  0,  0,  0, 34,  0, 12,  0,  0,  0, 68,  0,  0,  0,  0,  0, 34,  0, 74,  0,  0,  0,
+ 86,  0,  0,  0,  0,  0, 34,  0, 73,  0,  0,  0, 87,  0,  0,  0,  0,  0, 34,  0, 72,  0,  0,  0, 88,  0,  0,  0,  0,  0, 34,  0,
+ 71,  0,  0,  0, 89,  0,  0,  0,  0,  0, 34,  0, 70,  0,  0,  0, 75,  0,  0,  0,  0,  0, 34,  0, 73,  0,  0,  0, 74,  0,  0,  0,
+  0,  0, 34,  0, 71,  0,  0,  0, 72,  0,  0,  0,  0,  0, 34,  0, 76,  0,  0,  0, 97,  0,  0,  0,  0,  0, 34,  0, 75,  0,  0,  0,
+ 89,  0,  0,  0,  0,  0, 34,  0, 75,  0,  0,  0,102,  0,  0,  0,  0,  0, 34,  0, 77,  0,  0,  0,103,  0,  0,  0,  0,  0, 34,  0,
+ 76,  0,  0,  0,103,  0,  0,  0,  0,  0, 34,  0, 76,  0,  0,  0,102,  0,  0,  0,  0,  0, 34,  0, 78,  0,  0,  0, 98,  0,  0,  0,
+  0,  0, 34,  0, 79,  0,  0,  0, 94,  0,  0,  0,  0,  0, 34,  0, 80,  0,  0,  0, 90,  0,  0,  0,  0,  0, 34,  0, 81,  0,  0,  0,
+ 86,  0,  0,  0,  0,  0, 34,  0, 78,  0,  0,  0, 79,  0,  0,  0,  0,  0, 34,  0, 80,  0,  0,  0, 81,  0,  0,  0,  0,  0, 34,  0,
+ 85,  0,  0,  0, 98,  0,  0,  0,  0,  0, 34,  0, 84,  0,  0,  0, 99,  0,  0,  0,  0,  0, 34,  0, 83,  0,  0,  0,100,  0,  0,  0,
+  0,  0, 34,  0, 82,  0,  0,  0,101,  0,  0,  0,  0,  0, 34,  0, 82,  0,  0,  0, 83,  0,  0,  0,  0,  0, 34,  0, 84,  0,  0,  0,
+ 85,  0,  0,  0,  0,  0, 34,  0, 89,  0,  0,  0, 93,  0,  0,  0,  0,  0, 34,  0, 88,  0,  0,  0, 89,  0,  0,  0,  0,  0, 34,  0,
+ 88,  0,  0,  0, 92,  0,  0,  0,  0,  0, 34,  0, 87,  0,  0,  0, 88,  0,  0,  0,  0,  0, 34,  0, 87,  0,  0,  0, 91,  0,  0,  0,
+  0,  0, 34,  0, 86,  0,  0,  0, 87,  0,  0,  0,  0,  0, 34,  0, 86,  0,  0,  0, 90,  0,  0,  0,  0,  0, 34,  0, 93,  0,  0,  0,
+102,  0,  0,  0,  0,  0, 34,  0, 93,  0,  0,  0, 97,  0,  0,  0,  0,  0, 34,  0, 92,  0,  0,  0, 93,  0,  0,  0,  0,  0, 34,  0,
+ 92,  0,  0,  0, 96,  0,  0,  0,  0,  0, 34,  0, 91,  0,  0,  0, 92,  0,  0,  0,  0,  0, 34,  0, 91,  0,  0,  0, 95,  0,  0,  0,
+  0,  0, 34,  0, 90,  0,  0,  0, 91,  0,  0,  0,  0,  0, 34,  0, 90,  0,  0,  0, 94,  0,  0,  0,  0,  0, 34,  0, 97,  0,  0,  0,
+101,  0,  0,  0,  0,  0, 34,  0, 96,  0,  0,  0, 97,  0,  0,  0,  0,  0, 34,  0, 96,  0,  0,  0,100,  0,  0,  0,  0,  0, 34,  0,
+ 95,  0,  0,  0, 96,  0,  0,  0,  0,  0, 34,  0, 95,  0,  0,  0, 99,  0,  0,  0,  0,  0, 34,  0, 94,  0,  0,  0, 95,  0,  0,  0,
+  0,  0, 34,  0, 94,  0,  0,  0, 98,  0,  0,  0,  0,  0, 34,  0,101,  0,  0,  0,103,  0,  0,  0,  0,  0, 34,  0,100,  0,  0,  0,
+101,  0,  0,  0,  0,  0, 34,  0, 99,  0,  0,  0,100,  0,  0,  0,  0,  0, 34,  0, 98,  0,  0,  0, 99,  0,  0,  0,  0,  0, 34,  0,
+ 60,  0,  0,  0, 70,  0,  0,  0,  0,  0, 34,  0, 61,  0,  0,  0, 75,  0,  0,  0,  0,  0, 34,  0, 53,  0,  0,  0, 77,  0,  0,  0,
+  0,  0, 34,  0, 54,  0,  0,  0,103,  0,  0,  0,  0,  0, 34,  0, 55,  0,  0,  0, 76,  0,  0,  0,  0,  0, 34,  0, 56,  0,  0,  0,
+102,  0,  0,  0,  0,  0, 34,  0, 26,  0,  0,  0, 85,  0,  0,  0,  0,  0, 34,  0, 27,  0,  0,  0, 84,  0,  0,  0,  0,  0, 34,  0,
+ 28,  0,  0,  0, 83,  0,  0,  0,  0,  0, 34,  0, 29,  0,  0,  0, 82,  0,  0,  0,  0,  0, 34,  0,107,  0,  0,  0,112,  0,  0,  0,
+  0,  0, 34,  0,107,  0,  0,  0,108,  0,  0,  0,  0,  0, 34,  0,112,  0,  0,  0,113,  0,  0,  0,  0,  0, 34,  0,112,  0,  0,  0,
+114,  0,  0,  0,  0,  0, 34,  0,  9,  0,  0,  0,114,  0,  0,  0,  0,  0, 34,  0, 11,  0,  0,  0,114,  0,  0,  0,  0,  0, 34,  0,
+ 11,  0,  0,  0,115,  0,  0,  0,  0,  0, 34,  0,  7,  0,  0,  0,115,  0,  0,  0,  0,  0, 34,  0, 10,  0,  0,  0,115,  0,  0,  0,
+  0,  0, 34,  0, 11,  0,  0,  0,113,  0,  0,  0,  0,  0, 34,  0, 13,  0,  0,  0,113,  0,  0,  0,  0,  0, 34,  0, 13,  0,  0,  0,
+115,  0,  0,  0,  0,  0, 34,  0, 31,  0,  0,  0, 32,  0,  0,  0,  0,  0, 34,  0, 41,  0,  0,  0,111,  0,  0,  0,  0,  0, 34,  0,
+ 35,  0,  0,  0, 36,  0,  0,  0,  0,  0, 34,  0, 37,  0,  0,  0,111,  0,  0,  0,  0,  0, 34,  0, 39,  0,  0,  0, 40,  0,  0,  0,
+  0,  0, 34,  0, 30,  0,  0,  0,111,  0,  0,  0,  0,  0, 34,  0, 38,  0,  0,  0,112,  0,  0,  0,  0,  0, 34,  0, 39,  0,  0,  0,
+114,  0,  0,  0,  0,  0, 34,  0, 45,  0,  0,  0,109,  0,  0,  0,  0,  0, 34,  0, 65,  0,  0,  0,110,  0,  0,  0,  0,  0, 34,  0,
+ 45,  0,  0,  0,110,  0,  0,  0,  0,  0, 34,  0, 52,  0,  0,  0,110,  0,  0,  0,  0,  0, 34,  0, 48,  0,  0,  0,110,  0,  0,  0,
+  0,  0, 34,  0, 60,  0,  0,  0, 62,  0,  0,  0,  0,  0, 34,  0, 65,  0,  0,  0,109,  0,  0,  0,  0,  0, 34,  0, 66,  0,  0,  0,
+109,  0,  0,  0,  0,  0, 34,  0, 64,  0,  0,  0, 66,  0,  0,  0,  0,  0, 34,  0, 59,  0,  0,  0,109,  0,  0,  0,  0,  0, 34,  0,
+ 33,  0,  0,  0, 57,  0,  0,  0,  0,  0, 34,  0, 68,  0,  0,  0, 69,  0,  0,  0,  0,  0, 34,  0, 67,  0,  0,  0,106,  0,  0,  0,
+  0,  0, 34,  0, 38,  0,  0,  0,108,  0,  0,  0,  0,  0, 34,  0, 13,  0,  0,  0,106,  0,  0,  0,  0,  0, 34,  0, 67,  0,  0,  0,
+113,  0,  0,  0,  0,  0, 34,  0, 81,  0,  0,  0,105,  0,  0,  0,  0,  0, 34,  0, 72,  0,  0,  0, 73,  0,  0,  0,  0,  0, 34,  0,
+ 70,  0,  0,  0, 71,  0,  0,  0,  0,  0, 34,  0, 74,  0,  0,  0,105,  0,  0,  0,  0,  0, 34,  0, 77,  0,  0,  0, 82,  0,  0,  0,
+  0,  0, 34,  0, 85,  0,  0,  0,104,  0,  0,  0,  0,  0, 34,  0, 79,  0,  0,  0, 80,  0,  0,  0,  0,  0, 34,  0, 78,  0,  0,  0,
+104,  0,  0,  0,  0,  0, 34,  0, 83,  0,  0,  0, 84,  0,  0,  0,  0,  0, 34,  0, 34,  0,  0,  0,104,  0,  0,  0,  0,  0, 34,  0,
+ 67,  0,  0,  0,107,  0,  0,  0,  0,  0, 34,  0, 68,  0,  0,  0,106,  0,  0,  0,  0,  0, 34,  0, 68, 65, 84, 65,  8,  2,  0,  0,
+168,198,198,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  0,  0,  0, 16,  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, 85, 86, 84,101,120,  0, 97, 99,101, 45, 86,101,114,116,101,120,
+  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,136,207,198,  4,  0,  0,  0,  0, 17,  0,  0,  0, 12,  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, 67,111,108,  0, 32, 70, 97, 99,
+101, 45, 86,101,114,116,101,120,  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,152,226,198,  4,  0,  0,  0,  0,
+ 26,  0,  0,  0, 16,  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,
+ 78, 71,111,110, 32, 70, 97, 99,101, 45, 86,101,114,116,101,120,  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,
+216,185,198,  4,  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,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,192, 18,  0,  0,
+136,207,198,  4,  0,  0,  0,  0, 61,  0,  0,  0,144,  1,  0,  0,160, 84,104, 61,242, 65, 79, 63,  0,  0,  0,  0,128,105,188,189,
+120, 47, 41, 63,  0,  0,  0,  0,160, 84,104, 61,  0, 29,  3, 63,  0,  0,  0,  0, 26, 95, 82, 62,120, 47, 41, 63,  0,  0,  0,  0,
+122, 84,181, 62,113,179,141, 63,  0,  0,  0,  0, 26, 95, 82, 62,102, 84,117, 63,  0,  0,  0,  0,127, 84,181, 62,242, 65, 79, 63,
+  0,  0,  0,  0,190,188,  0, 63,102, 84,117, 63,  0,  0,  0,  0,160, 84,104, 61,  0, 29,  3, 63,  0,  0,  0,  0,128,106,188,189,
+176, 20,186, 62,  0,  0,  0,  0,144, 82,104, 61,128,223, 91, 62,  0,  0,  0,  0, 14, 95, 82, 62,  0, 21,186, 62,  0,  0,  0,  0,
+127, 84,181, 62,242, 65, 79, 63,  0,  0,  0,  0, 26, 95, 82, 62,120, 47, 41, 63,  0,  0,  0,  0,122, 84,181, 62,248, 28,  3, 63,
+  0,  0,  0,  0,188,188,  0, 63,120, 47, 41, 63,  0,  0,  0,  0, 56,207, 38, 63,111,179,141, 63,  0,  0,  0,  0,190,188,  0, 63,
+102, 84,117, 63,  0,  0,  0,  0, 52,207, 38, 63,236, 65, 79, 63,  0,  0,  0,  0,172,225, 76, 63,102, 84,117, 63,  0,  0,  0,  0,
+122, 84,181, 62,248, 28,  3, 63,  0,  0,  0,  0, 14, 95, 82, 62,  0, 21,186, 62,  0,  0,  0,  0,122, 84,181, 62, 32,224, 91, 62,
+  0,  0,  0,  0,185,188,  0, 63,  0, 21,186, 62,  0,  0,  0,  0, 52,207, 38, 63,236, 65, 79, 63,  0,  0,  0,  0,188,188,  0, 63,
+120, 47, 41, 63,  0,  0,  0,  0, 52,207, 38, 63,248, 28,  3, 63,  0,  0,  0,  0,174,225, 76, 63,116, 47, 41, 63,  0,  0,  0,  0,
+122, 84,181, 62, 32,224, 91, 62,  0,  0,  0,  0,138, 94, 82, 62, 48, 43,135, 61,  0,  0,  0,  0, 61, 84,181, 62,176,104,169,189,
+  0,  0,  0,  0,185,188,  0, 63, 96, 44,135, 61,  0,  0,  0,  0, 52,207, 38, 63,248, 28,  3, 63,  0,  0,  0,  0,185,188,  0, 63,
+  0, 21,186, 62,  0,  0,  0,  0, 51,207, 38, 63, 24,224, 91, 62,  0,  0,  0,  0,174,225, 76, 63,  0, 21,186, 62,  0,  0,  0,  0,
+ 44,244,114, 63,236, 65, 79, 63,  0,  0,  0,  0,174,225, 76, 63,116, 47, 41, 63,  0,  0,  0,  0, 42,244,114, 63,244, 28,  3, 63,
+  0,  0,  0,  0, 99,131,140, 63, 76, 47, 41, 63,  0,  0,  0,  0, 51,207, 38, 63, 24,224, 91, 62,  0,  0,  0,  0,185,188,  0, 63,
+ 96, 44,135, 61,  0,  0,  0,  0,248,207, 38, 63,144,109,169,189,  0,  0,  0,  0,112,226, 76, 63, 64, 38,135, 61,  0,  0,  0,  0,
+240,244,114, 63,  4,221, 91, 62,  0,  0,  0,  0,180,131,140, 63,116, 19,186, 62,  0,  0,  0,  0, 42,244,114, 63,244, 28,  3, 63,
+  0,  0,  0,  0,174,225, 76, 63,  0, 21,186, 62,  0,  0,  0,  0,122, 84,181, 62,113,179,141, 63,  0,  0,  0,  0, 26, 95, 82, 62,
+102, 84,117, 63,  0,  0,  0,  0, 26, 95, 82, 62,102, 84,117, 63,  0,  0,  0,  0,122, 84,181, 62,113,179,141, 63,  0,  0,  0,  0,
+160, 84,104, 61,242, 65, 79, 63,  0,  0,  0,  0,128,105,188,189,120, 47, 41, 63,  0,  0,  0,  0,128,105,188,189,120, 47, 41, 63,
+  0,  0,  0,  0,160, 84,104, 61,242, 65, 79, 63,  0,  0,  0,  0,188,188,  0, 63,173,188,160, 63,  0,  0,  0,  0,122, 84,181, 62,
+113,179,141, 63,  0,  0,  0,  0,122, 84,181, 62,113,179,141, 63,  0,  0,  0,  0,188,188,  0, 63,173,188,160, 63,  0,  0,  0,  0,
+ 26, 95, 82, 62,102, 84,117, 63,  0,  0,  0,  0,160, 84,104, 61,242, 65, 79, 63,  0,  0,  0,  0,160, 84,104, 61,242, 65, 79, 63,
+  0,  0,  0,  0, 26, 95, 82, 62,102, 84,117, 63,  0,  0,  0,  0,128,105,188,189,120, 47, 41, 63,  0,  0,  0,  0, 64,127,118,190,
+216, 28,  3, 63,  0,  0,  0,  0, 64,127,118,190,216, 28,  3, 63,  0,  0,  0,  0,128,105,188,189,120, 47, 41, 63,  0,  0,  0,  0,
+122, 84,181, 62,113,179,141, 63,  0,  0,  0,  0, 26, 95, 82, 62,102, 84,117, 63,  0,  0,  0,  0, 26, 95, 82, 62,102, 84,117, 63,
+  0,  0,  0,  0,122, 84,181, 62,113,179,141, 63,  0,  0,  0,  0,160, 84,104, 61,242, 65, 79, 63,  0,  0,  0,  0,128,105,188,189,
+120, 47, 41, 63,  0,  0,  0,  0,128,105,188,189,120, 47, 41, 63,  0,  0,  0,  0,160, 84,104, 61,242, 65, 79, 63,  0,  0,  0,  0,
+188,188,  0, 63,173,188,160, 63,  0,  0,  0,  0,122, 84,181, 62,113,179,141, 63,  0,  0,  0,  0,122, 84,181, 62,113,179,141, 63,
+  0,  0,  0,  0,188,188,  0, 63,173,188,160, 63,  0,  0,  0,  0, 26, 95, 82, 62,102, 84,117, 63,  0,  0,  0,  0,200, 84,104, 61,
+242, 65, 79, 63,  0,  0,  0,  0,160, 84,104, 61,242, 65, 79, 63,  0,  0,  0,  0, 26, 95, 82, 62,102, 84,117, 63,  0,  0,  0,  0,
+ 96,105,188,189,120, 47, 41, 63,  0,  0,  0,  0, 56,127,118,190,220, 28,  3, 63,  0,  0,  0,  0, 64,127,118,190,216, 28,  3, 63,
+  0,  0,  0,  0,128,105,188,189,120, 47, 41, 63,  0,  0,  0,  0,122, 84,181, 62,113,179,141, 63,  0,  0,  0,  0, 26, 95, 82, 62,
+102, 84,117, 63,  0,  0,  0,  0, 26, 95, 82, 62,102, 84,117, 63,  0,  0,  0,  0,122, 84,181, 62,113,179,141, 63,  0,  0,  0,  0,
+200, 84,104, 61,244, 65, 79, 63,  0,  0,  0,  0, 96,105,188,189,120, 47, 41, 63,  0,  0,  0,  0, 96,105,188,189,120, 47, 41, 63,
+  0,  0,  0,  0,200, 84,104, 61,242, 65, 79, 63,  0,  0,  0,  0, 44,244,114, 63,236, 65, 79, 63,  0,  0,  0,  0,172,225, 76, 63,
+102, 84,117, 63,  0,  0,  0,  0,172,225, 76, 63,102, 84,117, 63,  0,  0,  0,  0, 44,244,114, 63,236, 65, 79, 63,  0,  0,  0,  0,
+188,188,  0, 63,173,188,160, 63,  0,  0,  0,  0, 56,207, 38, 63,111,179,141, 63,  0,  0,  0,  0, 52,207, 38, 63,111,179,141, 63,
+  0,  0,  0,  0,188,188,  0, 63,173,188,160, 63,  0,  0,  0,  0,172,225, 76, 63,102, 84,117, 63,  0,  0,  0,  0, 52,207, 38, 63,
+111,179,141, 63,  0,  0,  0,  0, 52,207, 38, 63,111,179,141, 63,  0,  0,  0,  0,172,225, 76, 63,102, 84,117, 63,  0,  0,  0,  0,
+ 44,244,114, 63,236, 65, 79, 63,  0,  0,  0,  0,172,225, 76, 63,102, 84,117, 63,  0,  0,  0,  0,172,225, 76, 63,102, 84,117, 63,
+  0,  0,  0,  0, 44,244,114, 63,236, 65, 79, 63,  0,  0,  0,  0, 52,207, 38, 63,111,179,141, 63,  0,  0,  0,  0,188,188,  0, 63,
+173,188,160, 63,  0,  0,  0,  0,188,188,  0, 63,173,188,160, 63,  0,  0,  0,  0, 52,207, 38, 63,111,179,141, 63,  0,  0,  0,  0,
+174,225, 76, 63,102, 84,117, 63,  0,  0,  0,  0, 52,207, 38, 63,111,179,141, 63,  0,  0,  0,  0, 52,207, 38, 63,111,179,141, 63,
+  0,  0,  0,  0,172,225, 76, 63,102, 84,117, 63,  0,  0,  0,  0, 44,244,114, 63,236, 65, 79, 63,  0,  0,  0,  0,174,225, 76, 63,
+102, 84,117, 63,  0,  0,  0,  0,174,225, 76, 63,102, 84,117, 63,  0,  0,  0,  0, 44,244,114, 63,236, 65, 79, 63,  0,  0,  0,  0,
+ 52,207, 38, 63,111,179,141, 63,  0,  0,  0,  0,190,188,  0, 63,171,188,160, 63,  0,  0,  0,  0,188,188,  0, 63,173,188,160, 63,
+  0,  0,  0,  0, 52,207, 38, 63,111,179,141, 63,  0,  0,  0,  0,162,140,159, 63,210, 28,  3, 63,  0,  0,  0,  0, 99,131,140, 63,
+ 72, 47, 41, 63,  0,  0,  0,  0, 99,131,140, 63, 76, 47, 41, 63,  0,  0,  0,  0,161,140,159, 63,210, 28,  3, 63,  0,  0,  0,  0,
+ 99,131,140, 63, 76, 47, 41, 63,  0,  0,  0,  0, 44,244,114, 63,236, 65, 79, 63,  0,  0,  0,  0, 44,244,114, 63,236, 65, 79, 63,
+  0,  0,  0,  0, 99,131,140, 63, 76, 47, 41, 63,  0,  0,  0,  0,161,140,159, 63,210, 28,  3, 63,  0,  0,  0,  0, 99,131,140, 63,
+ 76, 47, 41, 63,  0,  0,  0,  0, 99,131,140, 63, 76, 47, 41, 63,  0,  0,  0,  0,161,140,159, 63,210, 28,  3, 63,  0,  0,  0,  0,
+ 99,131,140, 63, 76, 47, 41, 63,  0,  0,  0,  0, 44,244,114, 63,236, 65, 79, 63,  0,  0,  0,  0, 44,244,114, 63,236, 65, 79, 63,
+  0,  0,  0,  0, 99,131,140, 63, 76, 47, 41, 63,  0,  0,  0,  0,161,140,159, 63,210, 28,  3, 63,  0,  0,  0,  0, 99,131,140, 63,
+ 76, 47, 41, 63,  0,  0,  0,  0, 99,131,140, 63, 76, 47, 41, 63,  0,  0,  0,  0,244,140,159, 63, 50, 28,  3, 63,  0,  0,  0,  0,
+ 22,172,131, 63, 96,211, 93, 59,  0,  0,  0,  0,226,151,158, 63, 96,211, 93, 59,  0,  0,  0,  0,224,151,158, 63, 96,211, 93, 59,
+  0,  0,  0,  0, 22,172,131, 63, 96,211, 93, 59,  0,  0,  0,  0,144,128, 81, 63, 96,211, 93, 59,  0,  0,  0,  0,247,168, 27, 63,
+ 96,211, 93, 59,  0,  0,  0,  0,248,168, 27, 63, 96,211, 93, 59,  0,  0,  0,  0,144,128, 81, 63, 96,211, 93, 59,  0,  0,  0,  0,
+176,131,185, 63, 96,211, 93, 59,  0,  0,  0,  0,226,151,158, 63, 96,211, 93, 59,  0,  0,  0,  0,224,151,158, 63, 96,211, 93, 59,
+  0,  0,  0,  0,174,131,185, 63, 96,211, 93, 59,  0,  0,  0,  0, 21,172,131, 63, 96,211, 93, 59,  0,  0,  0,  0,144,128, 81, 63,
+ 96,211, 93, 59,  0,  0,  0,  0,144,128, 81, 63, 96,211, 93, 59,  0,  0,  0,  0, 22,172,131, 63, 96,211, 93, 59,  0,  0,  0,  0,
+247,168, 27, 63, 96,211, 93, 59,  0,  0,  0,  0, 85,162,203, 62, 96,211, 93, 59,  0,  0,  0,  0, 85,162,203, 62, 96,211, 93, 59,
+  0,  0,  0,  0,247,168, 27, 63, 96,211, 93, 59,  0,  0,  0,  0,226,151,158, 63, 96,211, 93, 59,  0,  0,  0,  0, 24,172,131, 63,
+ 96,211, 93, 59,  0,  0,  0,  0, 21,172,131, 63, 96,211, 93, 59,  0,  0,  0,  0,226,151,158, 63, 96,211, 93, 59,  0,  0,  0,  0,
+142,128, 81, 63, 96,211, 93, 59,  0,  0,  0,  0,246,168, 27, 63, 96,211, 93, 59,  0,  0,  0,  0,247,168, 27, 63, 96,211, 93, 59,
+  0,  0,  0,  0,144,128, 81, 63, 96,211, 93, 59,  0,  0,  0,  0,174,131,185, 63, 96,211, 93, 59,  0,  0,  0,  0,227,151,158, 63,
+ 96,211, 93, 59,  0,  0,  0,  0,226,151,158, 63, 96,211, 93, 59,  0,  0,  0,  0,174,131,185, 63, 96,211, 93, 59,  0,  0,  0,  0,
+ 22,172,131, 63, 96,211, 93, 59,  0,  0,  0,  0,149,128, 81, 63, 96,211, 93, 59,  0,  0,  0,  0,142,128, 81, 63, 96,211, 93, 59,
+  0,  0,  0,  0, 24,172,131, 63, 96,211, 93, 59,  0,  0,  0,  0,251,168, 27, 63, 96,211, 93, 59,  0,  0,  0,  0, 84,162,203, 62,
+ 96,211, 93, 59,  0,  0,  0,  0, 86,162,203, 62, 96,211, 93, 59,  0,  0,  0,  0,246,168, 27, 63, 96,211, 93, 59,  0,  0,  0,  0,
+225,151,158, 63, 96,211, 93, 59,  0,  0,  0,  0, 21,172,131, 63, 96,211, 93, 59,  0,  0,  0,  0, 22,172,131, 63, 96,211, 93, 59,
+  0,  0,  0,  0,227,151,158, 63, 96,211, 93, 59,  0,  0,  0,  0,146,128, 81, 63, 96,211, 93, 59,  0,  0,  0,  0,250,168, 27, 63,
+ 96,211, 93, 59,  0,  0,  0,  0,251,168, 27, 63, 96,211, 93, 59,  0,  0,  0,  0,149,128, 81, 63, 96,211, 93, 59,  0,  0,  0,  0,
+250,168, 27, 63, 96,211, 93, 59,  0,  0,  0,  0, 84,162,203, 62, 96,211, 93, 59,  0,  0,  0,  0, 84,162,203, 62, 96,211, 93, 59,
+  0,  0,  0,  0,251,168, 27, 63, 96,211, 93, 59,  0,  0,  0,  0, 21,172,131, 63, 96,211, 93, 59,  0,  0,  0,  0,146,128, 81, 63,
+ 96,211, 93, 59,  0,  0,  0,  0,149,128, 81, 63, 96,211, 93, 59,  0,  0,  0,  0, 22,172,131, 63, 96,211, 93, 59,  0,  0,  0,  0,
+227,151,158, 63, 96,211, 93, 59,  0,  0,  0,  0,174,131,185, 63, 96,211, 93, 59,  0,  0,  0,  0,174,131,185, 63, 96,211, 93, 59,
+  0,  0,  0,  0,225,151,158, 63, 96,211, 93, 59,  0,  0,  0,  0,149,128, 81, 63, 96,211, 93, 59,  0,  0,  0,  0,251,168, 27, 63,
+ 96,211, 93, 59,  0,  0,  0,  0,246,168, 27, 63, 96,211, 93, 59,  0,  0,  0,  0,142,128, 81, 63, 96,211, 93, 59,  0,  0,  0,  0,
+227,151,158, 63, 96,211, 93, 59,  0,  0,  0,  0, 22,172,131, 63, 96,211, 93, 59,  0,  0,  0,  0, 24,172,131, 63, 96,211, 93, 59,
+  0,  0,  0,  0,226,151,158, 63, 96,211, 93, 59,  0,  0,  0,  0,246,168, 27, 63, 96,211, 93, 59,  0,  0,  0,  0, 86,162,203, 62,
+ 96,211, 93, 59,  0,  0,  0,  0, 85,162,203, 62, 96,211, 93, 59,  0,  0,  0,  0,247,168, 27, 63, 96,211, 93, 59,  0,  0,  0,  0,
+ 24,172,131, 63, 96,211, 93, 59,  0,  0,  0,  0,142,128, 81, 63, 96,211, 93, 59,  0,  0,  0,  0,144,128, 81, 63, 96,211, 93, 59,
+  0,  0,  0,  0, 21,172,131, 63, 96,211, 93, 59,  0,  0,  0,  0,174,131,185, 63, 96,211, 93, 59,  0,  0,  0,  0,226,151,158, 63,
+ 96,211, 93, 59,  0,  0,  0,  0,226,151,158, 63, 96,211, 93, 59,  0,  0,  0,  0,176,131,185, 63, 96,211, 93, 59,  0,  0,  0,  0,
+144,128, 81, 63, 96,211, 93, 59,  0,  0,  0,  0,247,168, 27, 63, 96,211, 93, 59,  0,  0,  0,  0,247,168, 27, 63, 96,211, 93, 59,
+  0,  0,  0,  0,144,128, 81, 63, 96,211, 93, 59,  0,  0,  0,  0,226,151,158, 63, 96,211, 93, 59,  0,  0,  0,  0, 21,172,131, 63,
+ 96,211, 93, 59,  0,  0,  0,  0, 22,172,131, 63, 96,211, 93, 59,  0,  0,  0,  0,224,151,158, 63, 96,211, 93, 59,  0,  0,  0,  0,
+247,168, 27, 63, 96,211, 93, 59,  0,  0,  0,  0, 85,162,203, 62, 96,211, 93, 59,  0,  0,  0,  0, 86,162,203, 62, 96,211, 93, 59,
+  0,  0,  0,  0,248,168, 27, 63, 96,211, 93, 59,  0,  0,  0,  0, 22,172,131, 63, 96,211, 93, 59,  0,  0,  0,  0,144,128, 81, 63,
+ 96,211, 93, 59,  0,  0,  0,  0,144,128, 81, 63, 96,211, 93, 59,  0,  0,  0,  0, 22,172,131, 63, 96,211, 93, 59,  0,  0,  0,  0,
+226,151,158, 63, 96,211, 93, 59,  0,  0,  0,  0,176,131,185, 63, 96,211, 93, 59,  0,  0,  0,  0,174,131,185, 63, 96,211, 93, 59,
+  0,  0,  0,  0,224,151,158, 63, 96,211, 93, 59,  0,  0,  0,  0, 99,131,140, 63, 76, 47, 41, 63,  0,  0,  0,  0, 44,244,114, 63,
+236, 65, 79, 63,  0,  0,  0,  0, 44,244,114, 63,236, 65, 79, 63,  0,  0,  0,  0, 99,131,140, 63, 76, 47, 41, 63,  0,  0,  0,  0,
+161,140,159, 63,210, 28,  3, 63,  0,  0,  0,  0, 99,131,140, 63, 76, 47, 41, 63,  0,  0,  0,  0, 99,131,140, 63, 76, 47, 41, 63,
+  0,  0,  0,  0,161,140,159, 63,210, 28,  3, 63,  0,  0,  0,  0, 99,131,140, 63, 76, 47, 41, 63,  0,  0,  0,  0, 44,244,114, 63,
+236, 65, 79, 63,  0,  0,  0,  0, 44,244,114, 63,236, 65, 79, 63,  0,  0,  0,  0, 99,131,140, 63, 76, 47, 41, 63,  0,  0,  0,  0,
+161,140,159, 63,210, 28,  3, 63,  0,  0,  0,  0, 99,131,140, 63, 76, 47, 41, 63,  0,  0,  0,  0, 99,131,140, 63, 76, 47, 41, 63,
+  0,  0,  0,  0,161,140,159, 63,210, 28,  3, 63,  0,  0,  0,  0, 99,131,140, 63, 72, 47, 41, 63,  0,  0,  0,  0, 44,244,114, 63,
+236, 65, 79, 63,  0,  0,  0,  0, 44,244,114, 63,236, 65, 79, 63,  0,  0,  0,  0, 99,131,140, 63, 76, 47, 41, 63,  0,  0,  0,  0,
+174,225, 76, 63,102, 84,117, 63,  0,  0,  0,  0, 52,207, 38, 63,111,179,141, 63,  0,  0,  0,  0, 52,207, 38, 63,111,179,141, 63,
+  0,  0,  0,  0,174,225, 76, 63,102, 84,117, 63,  0,  0,  0,  0, 52,207, 38, 63,111,179,141, 63,  0,  0,  0,  0,188,188,  0, 63,
+173,188,160, 63,  0,  0,  0,  0,188,188,  0, 63,173,188,160, 63,  0,  0,  0,  0, 52,207, 38, 63,111,179,141, 63,  0,  0,  0,  0,
+ 44,244,114, 63,236, 65, 79, 63,  0,  0,  0,  0,174,225, 76, 63,102, 84,117, 63,  0,  0,  0,  0,172,225, 76, 63,102, 84,117, 63,
+  0,  0,  0,  0, 44,244,114, 63,236, 65, 79, 63,  0,  0,  0,  0,172,225, 76, 63,102, 84,117, 63,  0,  0,  0,  0, 52,207, 38, 63,
+111,179,141, 63,  0,  0,  0,  0, 52,207, 38, 63,111,179,141, 63,  0,  0,  0,  0,172,225, 76, 63,102, 84,117, 63,  0,  0,  0,  0,
+ 52,207, 38, 63,111,179,141, 63,  0,  0,  0,  0,188,188,  0, 63,173,188,160, 63,  0,  0,  0,  0,188,188,  0, 63,173,188,160, 63,
+  0,  0,  0,  0, 52,207, 38, 63,111,179,141, 63,  0,  0,  0,  0, 44,244,114, 63,236, 65, 79, 63,  0,  0,  0,  0,172,225, 76, 63,
+102, 84,117, 63,  0,  0,  0,  0,172,225, 76, 63,102, 84,117, 63,  0,  0,  0,  0, 44,244,114, 63,236, 65, 79, 63,  0,  0,  0,  0,
+ 56,207, 38, 63,111,179,141, 63,  0,  0,  0,  0,172,225, 76, 63,102, 84,117, 63,  0,  0,  0,  0,172,225, 76, 63,102, 84,117, 63,
+  0,  0,  0,  0, 52,207, 38, 63,111,179,141, 63,  0,  0,  0,  0, 96,105,188,189,120, 47, 41, 63,  0,  0,  0,  0, 56,127,118,190,
+220, 28,  3, 63,  0,  0,  0,  0, 56,127,118,190,220, 28,  3, 63,  0,  0,  0,  0, 96,105,188,189,120, 47, 41, 63,  0,  0,  0,  0,
+ 26, 95, 82, 62,102, 84,117, 63,  0,  0,  0,  0,200, 84,104, 61,244, 65, 79, 63,  0,  0,  0,  0,200, 84,104, 61,242, 65, 79, 63,
+  0,  0,  0,  0, 26, 95, 82, 62,102, 84,117, 63,  0,  0,  0,  0,190,188,  0, 63,171,188,160, 63,  0,  0,  0,  0,122, 84,181, 62,
+113,179,141, 63,  0,  0,  0,  0,122, 84,181, 62,113,179,141, 63,  0,  0,  0,  0,188,188,  0, 63,173,188,160, 63,  0,  0,  0,  0,
+200, 84,104, 61,242, 65, 79, 63,  0,  0,  0,  0, 96,105,188,189,120, 47, 41, 63,  0,  0,  0,  0,128,105,188,189,120, 47, 41, 63,
+  0,  0,  0,  0,160, 84,104, 61,242, 65, 79, 63,  0,  0,  0,  0,122, 84,181, 62,113,179,141, 63,  0,  0,  0,  0, 26, 95, 82, 62,
+102, 84,117, 63,  0,  0,  0,  0, 26, 95, 82, 62,102, 84,117, 63,  0,  0,  0,  0,122, 84,181, 62,113,179,141, 63,  0,  0,  0,  0,
+128,105,188,189,120, 47, 41, 63,  0,  0,  0,  0, 64,127,118,190,216, 28,  3, 63,  0,  0,  0,  0, 64,127,118,190,216, 28,  3, 63,
+  0,  0,  0,  0,128,105,188,189,120, 47, 41, 63,  0,  0,  0,  0, 26, 95, 82, 62,102, 84,117, 63,  0,  0,  0,  0,160, 84,104, 61,
+242, 65, 79, 63,  0,  0,  0,  0,160, 84,104, 61,242, 65, 79, 63,  0,  0,  0,  0, 26, 95, 82, 62,102, 84,117, 63,  0,  0,  0,  0,
+188,188,  0, 63,173,188,160, 63,  0,  0,  0,  0,122, 84,181, 62,113,179,141, 63,  0,  0,  0,  0,122, 84,181, 62,113,179,141, 63,
+  0,  0,  0,  0,188,188,  0, 63,173,188,160, 63,  0,  0,  0,  0,160, 84,104, 61,242, 65, 79, 63,  0,  0,  0,  0,128,105,188,189,
+120, 47, 41, 63,  0,  0,  0,  0,128,105,188,189,120, 47, 41, 63,  0,  0,  0,  0,160, 84,104, 61,242, 65, 79, 63,  0,  0,  0,  0,
+122, 84,181, 62,113,179,141, 63,  0,  0,  0,  0, 26, 95, 82, 62,102, 84,117, 63,  0,  0,  0,  0, 26, 95, 82, 62,102, 84,117, 63,
+  0,  0,  0,  0,122, 84,181, 62,113,179,141, 63,  0,  0,  0,  0,128,105,188,189,120, 47, 41, 63,  0,  0,  0,  0, 64,127,118,190,
+216, 28,  3, 63,  0,  0,  0,  0, 64,127,118,190,216, 28,  3, 63,  0,  0,  0,  0,128,105,188,189,120, 47, 41, 63,  0,  0,  0,  0,
+ 26, 95, 82, 62,102, 84,117, 63,  0,  0,  0,  0,160, 84,104, 61,242, 65, 79, 63,  0,  0,  0,  0,160, 84,104, 61,242, 65, 79, 63,
+  0,  0,  0,  0, 26, 95, 82, 62,102, 84,117, 63,  0,  0,  0,  0,122, 84,181, 62,113,179,141, 63,  0,  0,  0,  0,188,188,  0, 63,
+173,188,160, 63,  0,  0,  0,  0,188,188,  0, 63,173,188,160, 63,  0,  0,  0,  0,122, 84,181, 62,113,179,141, 63,  0,  0,  0,  0,
+180,131,140, 63,116, 19,186, 62,  0,  0,  0,  0,244,140,159, 63, 50, 28,  3, 63,  0,  0,  0,  0, 99,131,140, 63, 76, 47, 41, 63,
+  0,  0,  0,  0, 42,244,114, 63,244, 28,  3, 63,  0,  0,  0,  0,174,225, 76, 63,  0, 21,186, 62,  0,  0,  0,  0, 51,207, 38, 63,
+ 24,224, 91, 62,  0,  0,  0,  0,112,226, 76, 63, 64, 38,135, 61,  0,  0,  0,  0,240,244,114, 63,  4,221, 91, 62,  0,  0,  0,  0,
+185,188,  0, 63, 96, 44,135, 61,  0,  0,  0,  0, 61, 84,181, 62,176,104,169,189,  0,  0,  0,  0, 93,189,  0, 63, 80,  1,109,190,
+  0,  0,  0,  0,248,207, 38, 63,144,109,169,189,  0,  0,  0,  0,174,225, 76, 63,116, 47, 41, 63,  0,  0,  0,  0, 52,207, 38, 63,
+248, 28,  3, 63,  0,  0,  0,  0,174,225, 76, 63,  0, 21,186, 62,  0,  0,  0,  0, 42,244,114, 63,244, 28,  3, 63,  0,  0,  0,  0,
+185,188,  0, 63,  0, 21,186, 62,  0,  0,  0,  0,122, 84,181, 62, 32,224, 91, 62,  0,  0,  0,  0,185,188,  0, 63, 96, 44,135, 61,
+  0,  0,  0,  0, 51,207, 38, 63, 24,224, 91, 62,  0,  0,  0,  0,172,225, 76, 63,102, 84,117, 63,  0,  0,  0,  0, 52,207, 38, 63,
+236, 65, 79, 63,  0,  0,  0,  0,174,225, 76, 63,116, 47, 41, 63,  0,  0,  0,  0, 44,244,114, 63,236, 65, 79, 63,  0,  0,  0,  0,
+188,188,  0, 63,120, 47, 41, 63,  0,  0,  0,  0,122, 84,181, 62,248, 28,  3, 63,  0,  0,  0,  0,185,188,  0, 63,  0, 21,186, 62,
+  0,  0,  0,  0, 52,207, 38, 63,248, 28,  3, 63,  0,  0,  0,  0, 14, 95, 82, 62,  0, 21,186, 62,  0,  0,  0,  0,144, 82,104, 61,
+128,223, 91, 62,  0,  0,  0,  0,138, 94, 82, 62, 48, 43,135, 61,  0,  0,  0,  0,122, 84,181, 62, 32,224, 91, 62,  0,  0,  0,  0,
+190,188,  0, 63,102, 84,117, 63,  0,  0,  0,  0,127, 84,181, 62,242, 65, 79, 63,  0,  0,  0,  0,188,188,  0, 63,120, 47, 41, 63,
+  0,  0,  0,  0, 52,207, 38, 63,236, 65, 79, 63,  0,  0,  0,  0, 26, 95, 82, 62,120, 47, 41, 63,  0,  0,  0,  0,160, 84,104, 61,
+  0, 29,  3, 63,  0,  0,  0,  0, 14, 95, 82, 62,  0, 21,186, 62,  0,  0,  0,  0,122, 84,181, 62,248, 28,  3, 63,  0,  0,  0,  0,
+190,188,  0, 63,102, 84,117, 63,  0,  0,  0,  0, 56,207, 38, 63,111,179,141, 63,  0,  0,  0,  0,188,188,  0, 63,173,188,160, 63,
+  0,  0,  0,  0,122, 84,181, 62,113,179,141, 63,  0,  0,  0,  0, 26, 95, 82, 62,102, 84,117, 63,  0,  0,  0,  0,160, 84,104, 61,
+242, 65, 79, 63,  0,  0,  0,  0, 26, 95, 82, 62,120, 47, 41, 63,  0,  0,  0,  0,127, 84,181, 62,242, 65, 79, 63,  0,  0,  0,  0,
+128,105,188,189,120, 47, 41, 63,  0,  0,  0,  0, 64,127,118,190,216, 28,  3, 63,  0,  0,  0,  0,128,106,188,189,176, 20,186, 62,
+  0,  0,  0,  0,160, 84,104, 61,  0, 29,  3, 63,  0,  0,  0,  0, 68, 65, 84, 65, 64,  6,  0,  0,152,226,198,  4,  0,  0,  0,  0,
+ 62,  0,  0,  0,144,  1,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255, 68, 65, 84, 65,128, 12,  0,  0,216,185,198,  4,  0,  0,  0,  0, 59,  0,  0,  0,144,  1,  0,  0,
+ 31,  0,  0,  0, 44,  0,  0,  0, 30,  0,  0,  0, 49,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0, 48,  0,  0,  0,
+ 33,  0,  0,  0, 45,  0,  0,  0, 32,  0,  0,  0, 47,  0,  0,  0,  3,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0, 46,  0,  0,  0,
+  5,  0,  0,  0, 59,  0,  0,  0, 41,  0,  0,  0, 53,  0,  0,  0, 40,  0,  0,  0, 58,  0,  0,  0,  9,  0,  0,  0,  4,  0,  0,  0,
+  3,  0,  0,  0,  1,  0,  0,  0,  4,  0,  0,  0,  6,  0,  0,  0,  8,  0,  0,  0,  7,  0,  0,  0,  7,  0,  0,  0,  8,  0,  0,  0,
+  0,  0,  0,  0,  3,  0,  0,  0,  2,  0,  0,  0, 10,  0,  0,  0,  6,  0,  0,  0,102,  0,  0,  0, 58,  0,  0,  0, 92,  0,  0,  0,
+  8,  0,  0,  0,  5,  0,  0,  0,  9,  0,  0,  0,171,  0,  0,  0,114,  0,  0,  0,172,  0,  0,  0, 11,  0,  0,  0, 11,  0,  0,  0,
+  6,  0,  0,  0,  9,  0,  0,  0,  7,  0,  0,  0,174,  0,  0,  0,115,  0,  0,  0,175,  0,  0,  0, 10,  0,  0,  0, 12,  0,  0,  0,
+114,  0,  0,  0,186,  0,  0,  0, 39,  0,  0,  0, 52,  0,  0,  0, 38,  0,  0,  0,185,  0,  0,  0,112,  0,  0,  0,170,  0,  0,  0,
+115,  0,  0,  0,173,  0,  0,  0, 11,  0,  0,  0,176,  0,  0,  0,113,  0,  0,  0,177,  0,  0,  0, 13,  0,  0,  0,178,  0,  0,  0,
+  1,  0,  0,  0, 13,  0,  0,  0, 10,  0,  0,  0, 15,  0,  0,  0, 12,  0,  0,  0,101,  0,  0,  0, 59,  0,  0,  0, 96,  0,  0,  0,
+113,  0,  0,  0,169,  0,  0,  0,112,  0,  0,  0,167,  0,  0,  0,107,  0,  0,  0,213,  0,  0,  0, 67,  0,  0,  0,202,  0,  0,  0,
+106,  0,  0,  0,214,  0,  0,  0, 68,  0,  0,  0,105,  0,  0,  0, 12,  0,  0,  0, 14,  0,  0,  0, 13,  0,  0,  0,201,  0,  0,  0,
+ 17,  0,  0,  0, 21,  0,  0,  0, 16,  0,  0,  0, 17,  0,  0,  0, 32,  0,  0,  0, 45,  0,  0,  0, 33,  0,  0,  0, 16,  0,  0,  0,
+ 15,  0,  0,  0, 25,  0,  0,  0, 14,  0,  0,  0, 19,  0,  0,  0, 30,  0,  0,  0, 44,  0,  0,  0, 31,  0,  0,  0, 18,  0,  0,  0,
+ 46,  0,  0,  0, 99,  0,  0,  0, 21,  0,  0,  0, 20,  0,  0,  0, 17,  0,  0,  0,100,  0,  0,  0, 42,  0,  0,  0, 69,  0,  0,  0,
+ 20,  0,  0,  0, 30,  0,  0,  0, 19,  0,  0,  0, 24,  0,  0,  0, 15,  0,  0,  0, 23,  0,  0,  0, 16,  0,  0,  0, 22,  0,  0,  0,
+ 18,  0,  0,  0, 56,  0,  0,  0, 36,  0,  0,  0, 51,  0,  0,  0, 37,  0,  0,  0, 57,  0,  0,  0, 14,  0,  0,  0, 26,  0,  0,  0,
+ 25,  0,  0,  0, 35,  0,  0,  0, 24,  0,  0,  0, 29,  0,  0,  0, 20,  0,  0,  0, 28,  0,  0,  0, 21,  0,  0,  0, 27,  0,  0,  0,
+ 23,  0,  0,  0, 39,  0,  0,  0, 22,  0,  0,  0, 33,  0,  0,  0, 18,  0,  0,  0, 32,  0,  0,  0, 19,  0,  0,  0, 31,  0,  0,  0,
+ 53,  0,  0,  0, 97,  0,  0,  0, 29,  0,  0,  0, 34,  0,  0,  0, 25,  0,  0,  0, 98,  0,  0,  0, 49,  0,  0,  0, 81,  0,  0,  0,
+ 28,  0,  0,  0, 42,  0,  0,  0, 27,  0,  0,  0, 38,  0,  0,  0, 23,  0,  0,  0, 37,  0,  0,  0, 24,  0,  0,  0, 36,  0,  0,  0,
+ 26,  0,  0,  0, 54,  0,  0,  0, 34,  0,  0,  0, 50,  0,  0,  0, 35,  0,  0,  0, 55,  0,  0,  0, 22,  0,  0,  0, 40,  0,  0,  0,
+ 82,  0,  0,  0,129,  0,  0,  0, 83,  0,  0,  0,165,  0,  0,  0, 28,  0,  0,  0, 41,  0,  0,  0, 29,  0,  0,  0,166,  0,  0,  0,
+ 84,  0,  0,  0,130,  0,  0,  0, 85,  0,  0,  0,163,  0,  0,  0, 26,  0,  0,  0, 43,  0,  0,  0, 27,  0,  0,  0,164,  0,  0,  0,
+ 45,  0,  0,  0, 64,  0,  0,  0, 44,  0,  0,  0, 62,  0,  0,  0, 58,  0,  0,  0, 91,  0,  0,  0,  1,  0,  0,  0, 95,  0,  0,  0,
+ 57,  0,  0,  0, 93,  0,  0,  0,  0,  0,  0,  0, 94,  0,  0,  0, 43,  0,  0,  0, 68,  0,  0,  0, 42,  0,  0,  0, 63,  0,  0,  0,
+ 48,  0,  0,  0, 71,  0,  0,  0, 47,  0,  0,  0, 67,  0,  0,  0, 43,  0,  0,  0, 66,  0,  0,  0, 44,  0,  0,  0, 65,  0,  0,  0,
+ 52,  0,  0,  0, 76,  0,  0,  0, 51,  0,  0,  0, 70,  0,  0,  0, 48,  0,  0,  0,191,  0,  0,  0,110,  0,  0,  0,190,  0,  0,  0,
+ 50,  0,  0,  0, 80,  0,  0,  0, 49,  0,  0,  0, 74,  0,  0,  0, 46,  0,  0,  0, 73,  0,  0,  0, 47,  0,  0,  0, 72,  0,  0,  0,
+ 55,  0,  0,  0, 83,  0,  0,  0, 54,  0,  0,  0, 79,  0,  0,  0, 50,  0,  0,  0, 78,  0,  0,  0, 51,  0,  0,  0, 77,  0,  0,  0,
+102,  0,  0,  0,118,  0,  0,  0, 76,  0,  0,  0,161,  0,  0,  0, 55,  0,  0,  0, 82,  0,  0,  0, 56,  0,  0,  0,162,  0,  0,  0,
+103,  0,  0,  0,116,  0,  0,  0, 77,  0,  0,  0,159,  0,  0,  0, 53,  0,  0,  0, 84,  0,  0,  0, 54,  0,  0,  0,160,  0,  0,  0,
+ 70,  0,  0,  0,110,  0,  0,  0, 75,  0,  0,  0,158,  0,  0,  0, 61,  0,  0,  0, 85,  0,  0,  0, 60,  0,  0,  0,157,  0,  0,  0,
+ 61,  0,  0,  0, 61,  0,  0,  0, 56,  0,  0,  0, 75,  0,  0,  0, 52,  0,  0,  0, 60,  0,  0,  0, 63,  0,  0,  0, 86,  0,  0,  0,
+ 62,  0,  0,  0, 87,  0,  0,  0, 63,  0,  0,  0, 88,  0,  0,  0, 65,  0,  0,  0, 89,  0,  0,  0, 64,  0,  0,  0, 90,  0,  0,  0,
+ 65,  0,  0,  0,188,  0,  0,  0,110,  0,  0,  0,189,  0,  0,  0, 45,  0,  0,  0,187,  0,  0,  0,109,  0,  0,  0,193,  0,  0,  0,
+ 66,  0,  0,  0,194,  0,  0,  0,109,  0,  0,  0,196,  0,  0,  0, 59,  0,  0,  0,104,  0,  0,  0, 69,  0,  0,  0,103,  0,  0,  0,
+ 72,  0,  0,  0,112,  0,  0,  0, 71,  0,  0,  0,109,  0,  0,  0, 89,  0,  0,  0,132,  0,  0,  0, 88,  0,  0,  0,108,  0,  0,  0,
+ 87,  0,  0,  0,136,  0,  0,  0, 86,  0,  0,  0,106,  0,  0,  0, 74,  0,  0,  0,111,  0,  0,  0, 73,  0,  0,  0,107,  0,  0,  0,
+102,  0,  0,  0,138,  0,  0,  0, 93,  0,  0,  0,131,  0,  0,  0, 89,  0,  0,  0,114,  0,  0,  0, 75,  0,  0,  0,115,  0,  0,  0,
+ 92,  0,  0,  0,142,  0,  0,  0, 91,  0,  0,  0,135,  0,  0,  0, 87,  0,  0,  0,134,  0,  0,  0, 88,  0,  0,  0,133,  0,  0,  0,
+ 90,  0,  0,  0,121,  0,  0,  0, 80,  0,  0,  0,124,  0,  0,  0, 81,  0,  0,  0,122,  0,  0,  0, 86,  0,  0,  0,137,  0,  0,  0,
+ 97,  0,  0,  0,147,  0,  0,  0, 96,  0,  0,  0,141,  0,  0,  0, 92,  0,  0,  0,140,  0,  0,  0, 93,  0,  0,  0,139,  0,  0,  0,
+ 95,  0,  0,  0,151,  0,  0,  0, 94,  0,  0,  0,145,  0,  0,  0, 90,  0,  0,  0,144,  0,  0,  0, 91,  0,  0,  0,143,  0,  0,  0,
+103,  0,  0,  0,153,  0,  0,  0,101,  0,  0,  0,146,  0,  0,  0, 97,  0,  0,  0,113,  0,  0,  0, 76,  0,  0,  0,117,  0,  0,  0,
+100,  0,  0,  0,155,  0,  0,  0, 99,  0,  0,  0,150,  0,  0,  0, 95,  0,  0,  0,149,  0,  0,  0, 96,  0,  0,  0,148,  0,  0,  0,
+ 98,  0,  0,  0,119,  0,  0,  0, 78,  0,  0,  0,123,  0,  0,  0, 79,  0,  0,  0,120,  0,  0,  0, 94,  0,  0,  0,152,  0,  0,  0,
+ 82,  0,  0,  0,129,  0,  0,  0, 83,  0,  0,  0,127,  0,  0,  0,100,  0,  0,  0,154,  0,  0,  0,101,  0,  0,  0,128,  0,  0,  0,
+ 84,  0,  0,  0,130,  0,  0,  0, 85,  0,  0,  0,125,  0,  0,  0, 98,  0,  0,  0,156,  0,  0,  0, 99,  0,  0,  0,126,  0,  0,  0,
+ 85,  0,  0,  0,208,  0,  0,  0,104,  0,  0,  0,210,  0,  0,  0, 78,  0,  0,  0,119,  0,  0,  0, 98,  0,  0,  0,125,  0,  0,  0,
+ 83,  0,  0,  0,211,  0,  0,  0, 84,  0,  0,  0,126,  0,  0,  0, 99,  0,  0,  0,155,  0,  0,  0,100,  0,  0,  0,127,  0,  0,  0,
+101,  0,  0,  0,153,  0,  0,  0,103,  0,  0,  0,116,  0,  0,  0, 77,  0,  0,  0,207,  0,  0,  0, 82,  0,  0,  0,128,  0,  0,  0,
+ 99,  0,  0,  0,156,  0,  0,  0, 98,  0,  0,  0,152,  0,  0,  0, 94,  0,  0,  0,151,  0,  0,  0, 95,  0,  0,  0,150,  0,  0,  0,
+101,  0,  0,  0,154,  0,  0,  0,100,  0,  0,  0,148,  0,  0,  0, 96,  0,  0,  0,147,  0,  0,  0, 97,  0,  0,  0,146,  0,  0,  0,
+ 94,  0,  0,  0,120,  0,  0,  0, 79,  0,  0,  0,209,  0,  0,  0, 80,  0,  0,  0,121,  0,  0,  0, 90,  0,  0,  0,145,  0,  0,  0,
+ 96,  0,  0,  0,149,  0,  0,  0, 95,  0,  0,  0,143,  0,  0,  0, 91,  0,  0,  0,142,  0,  0,  0, 92,  0,  0,  0,141,  0,  0,  0,
+ 76,  0,  0,  0,113,  0,  0,  0, 97,  0,  0,  0,139,  0,  0,  0, 93,  0,  0,  0,138,  0,  0,  0,102,  0,  0,  0,118,  0,  0,  0,
+ 91,  0,  0,  0,144,  0,  0,  0, 90,  0,  0,  0,137,  0,  0,  0, 86,  0,  0,  0,136,  0,  0,  0, 87,  0,  0,  0,135,  0,  0,  0,
+ 93,  0,  0,  0,140,  0,  0,  0, 92,  0,  0,  0,133,  0,  0,  0, 88,  0,  0,  0,132,  0,  0,  0, 89,  0,  0,  0,131,  0,  0,  0,
+ 86,  0,  0,  0,122,  0,  0,  0, 81,  0,  0,  0,203,  0,  0,  0,105,  0,  0,  0,206,  0,  0,  0, 74,  0,  0,  0,106,  0,  0,  0,
+ 88,  0,  0,  0,134,  0,  0,  0, 87,  0,  0,  0,107,  0,  0,  0, 73,  0,  0,  0,204,  0,  0,  0, 72,  0,  0,  0,108,  0,  0,  0,
+ 71,  0,  0,  0,205,  0,  0,  0, 70,  0,  0,  0,110,  0,  0,  0, 75,  0,  0,  0,114,  0,  0,  0, 89,  0,  0,  0,109,  0,  0,  0,
+109,  0,  0,  0,187,  0,  0,  0, 45,  0,  0,  0, 95,  0,  0,  0,  1,  0,  0,  0, 96,  0,  0,  0, 59,  0,  0,  0,196,  0,  0,  0,
+ 64,  0,  0,  0, 89,  0,  0,  0, 65,  0,  0,  0,193,  0,  0,  0,109,  0,  0,  0,194,  0,  0,  0, 66,  0,  0,  0,195,  0,  0,  0,
+ 63,  0,  0,  0, 60,  0,  0,  0, 52,  0,  0,  0,190,  0,  0,  0,110,  0,  0,  0,188,  0,  0,  0, 65,  0,  0,  0, 88,  0,  0,  0,
+ 60,  0,  0,  0, 85,  0,  0,  0, 61,  0,  0,  0, 86,  0,  0,  0, 63,  0,  0,  0, 87,  0,  0,  0, 62,  0,  0,  0,192,  0,  0,  0,
+ 75,  0,  0,  0,115,  0,  0,  0,102,  0,  0,  0,162,  0,  0,  0, 56,  0,  0,  0, 61,  0,  0,  0, 61,  0,  0,  0,158,  0,  0,  0,
+ 76,  0,  0,  0,117,  0,  0,  0,103,  0,  0,  0,160,  0,  0,  0, 54,  0,  0,  0, 83,  0,  0,  0, 55,  0,  0,  0,161,  0,  0,  0,
+ 54,  0,  0,  0, 84,  0,  0,  0, 53,  0,  0,  0, 81,  0,  0,  0, 49,  0,  0,  0, 80,  0,  0,  0, 50,  0,  0,  0, 79,  0,  0,  0,
+ 56,  0,  0,  0, 82,  0,  0,  0, 55,  0,  0,  0, 77,  0,  0,  0, 51,  0,  0,  0, 76,  0,  0,  0, 52,  0,  0,  0, 75,  0,  0,  0,
+ 51,  0,  0,  0, 78,  0,  0,  0, 50,  0,  0,  0, 72,  0,  0,  0, 47,  0,  0,  0, 71,  0,  0,  0, 48,  0,  0,  0, 70,  0,  0,  0,
+ 47,  0,  0,  0, 73,  0,  0,  0, 46,  0,  0,  0, 69,  0,  0,  0, 42,  0,  0,  0, 68,  0,  0,  0, 43,  0,  0,  0, 67,  0,  0,  0,
+110,  0,  0,  0,191,  0,  0,  0, 48,  0,  0,  0, 65,  0,  0,  0, 44,  0,  0,  0, 64,  0,  0,  0, 45,  0,  0,  0,189,  0,  0,  0,
+  0,  0,  0,  0, 92,  0,  0,  0, 58,  0,  0,  0, 62,  0,  0,  0, 44,  0,  0,  0, 66,  0,  0,  0, 43,  0,  0,  0, 94,  0,  0,  0,
+ 85,  0,  0,  0,208,  0,  0,  0,104,  0,  0,  0,212,  0,  0,  0, 34,  0,  0,  0, 54,  0,  0,  0, 26,  0,  0,  0,163,  0,  0,  0,
+ 83,  0,  0,  0,211,  0,  0,  0, 84,  0,  0,  0,164,  0,  0,  0, 27,  0,  0,  0, 42,  0,  0,  0, 28,  0,  0,  0,165,  0,  0,  0,
+ 77,  0,  0,  0,207,  0,  0,  0, 82,  0,  0,  0,166,  0,  0,  0, 29,  0,  0,  0, 97,  0,  0,  0, 53,  0,  0,  0,159,  0,  0,  0,
+ 27,  0,  0,  0, 43,  0,  0,  0, 26,  0,  0,  0, 40,  0,  0,  0, 22,  0,  0,  0, 39,  0,  0,  0, 23,  0,  0,  0, 38,  0,  0,  0,
+ 29,  0,  0,  0, 41,  0,  0,  0, 28,  0,  0,  0, 36,  0,  0,  0, 24,  0,  0,  0, 35,  0,  0,  0, 25,  0,  0,  0, 34,  0,  0,  0,
+ 22,  0,  0,  0, 55,  0,  0,  0, 35,  0,  0,  0,181,  0,  0,  0, 36,  0,  0,  0, 56,  0,  0,  0, 18,  0,  0,  0, 33,  0,  0,  0,
+ 24,  0,  0,  0, 37,  0,  0,  0, 23,  0,  0,  0, 31,  0,  0,  0, 19,  0,  0,  0, 30,  0,  0,  0, 20,  0,  0,  0, 29,  0,  0,  0,
+ 49,  0,  0,  0, 98,  0,  0,  0, 25,  0,  0,  0, 27,  0,  0,  0, 21,  0,  0,  0, 99,  0,  0,  0, 46,  0,  0,  0, 74,  0,  0,  0,
+ 19,  0,  0,  0, 32,  0,  0,  0, 18,  0,  0,  0, 26,  0,  0,  0, 14,  0,  0,  0, 25,  0,  0,  0, 15,  0,  0,  0, 24,  0,  0,  0,
+ 21,  0,  0,  0, 28,  0,  0,  0, 20,  0,  0,  0, 22,  0,  0,  0, 16,  0,  0,  0, 21,  0,  0,  0, 17,  0,  0,  0, 20,  0,  0,  0,
+ 14,  0,  0,  0, 57,  0,  0,  0, 37,  0,  0,  0,182,  0,  0,  0,111,  0,  0,  0,184,  0,  0,  0, 30,  0,  0,  0, 19,  0,  0,  0,
+ 16,  0,  0,  0, 23,  0,  0,  0, 15,  0,  0,  0, 18,  0,  0,  0, 31,  0,  0,  0,179,  0,  0,  0, 32,  0,  0,  0, 17,  0,  0,  0,
+ 33,  0,  0,  0,197,  0,  0,  0, 57,  0,  0,  0, 63,  0,  0,  0, 42,  0,  0,  0,100,  0,  0,  0, 17,  0,  0,  0, 16,  0,  0,  0,
+ 68,  0,  0,  0,198,  0,  0,  0, 69,  0,  0,  0,104,  0,  0,  0, 59,  0,  0,  0,101,  0,  0,  0, 12,  0,  0,  0,105,  0,  0,  0,
+ 13,  0,  0,  0,177,  0,  0,  0,113,  0,  0,  0,202,  0,  0,  0, 67,  0,  0,  0,199,  0,  0,  0,106,  0,  0,  0,201,  0,  0,  0,
+112,  0,  0,  0,185,  0,  0,  0, 38,  0,  0,  0,200,  0,  0,  0,108,  0,  0,  0,168,  0,  0,  0,107,  0,  0,  0,167,  0,  0,  0,
+ 10,  0,  0,  0,175,  0,  0,  0,115,  0,  0,  0,178,  0,  0,  0, 13,  0,  0,  0, 14,  0,  0,  0, 12,  0,  0,  0, 15,  0,  0,  0,
+ 11,  0,  0,  0,172,  0,  0,  0,114,  0,  0,  0,170,  0,  0,  0,112,  0,  0,  0,169,  0,  0,  0,113,  0,  0,  0,176,  0,  0,  0,
+ 58,  0,  0,  0,102,  0,  0,  0,  6,  0,  0,  0, 12,  0,  0,  0, 10,  0,  0,  0, 13,  0,  0,  0,  1,  0,  0,  0, 91,  0,  0,  0,
+  7,  0,  0,  0,  7,  0,  0,  0,  8,  0,  0,  0, 11,  0,  0,  0, 11,  0,  0,  0,173,  0,  0,  0,115,  0,  0,  0,174,  0,  0,  0,
+  9,  0,  0,  0, 58,  0,  0,  0, 40,  0,  0,  0,183,  0,  0,  0, 39,  0,  0,  0,186,  0,  0,  0,114,  0,  0,  0,171,  0,  0,  0,
+  2,  0,  0,  0,  2,  0,  0,  0,  3,  0,  0,  0,  8,  0,  0,  0,  7,  0,  0,  0,  9,  0,  0,  0,  6,  0,  0,  0, 10,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,  0,  4,  0,  0,  0,  9,  0,  0,  0,  5,  0,  0,  0,  8,  0,  0,  0,  6,  0,  0,  0,
+  2,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0, 93,  0,  0,  0, 57,  0,  0,  0,197,  0,  0,  0, 33,  0,  0,  0, 46,  0,  0,  0,
+ 32,  0,  0,  0,179,  0,  0,  0, 31,  0,  0,  0, 48,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,  3,  0,  0,  0, 47,  0,  0,  0,
+ 30,  0,  0,  0,184,  0,  0,  0,111,  0,  0,  0,180,  0,  0,  0, 41,  0,  0,  0, 59,  0,  0,  0,  5,  0,  0,  0, 49,  0,  0,  0,
+ 68, 65, 84, 65,  8,  2,  0,  0,136,183,198,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  0,  0,  0, 15,  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, 85, 86, 84,101,120,  0, 97, 99,
+101,  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,  0,  0,  0,  0,  0,248,200,198,  4,  0,  0,  0,  0,
+ 25,  0,  0,  0, 16,  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,
+ 78, 71,111,110, 32, 70, 97, 99,101,  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,  0,  0,  0,  0,  0,
+136,178,198,  4,  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,  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,  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,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 64,  6,  0,  0,248,200,198,  4,  0,  0,  0,  0, 60,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 60,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0, 68, 65, 84, 65,176,  4,  0,  0,
+136,178,198,  4,  0,  0,  0,  0, 58,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,  4,  0,  0,  0,
+  4,  0,  0,  0,  1,  0,  0,  0,  8,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0, 12,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,
+ 16,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0, 20,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0, 24,  0,  0,  0,  4,  0,  0,  0,
+  1,  0,  0,  0, 28,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0, 32,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0, 36,  0,  0,  0,
+  4,  0,  0,  0,  1,  0,  0,  0, 40,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0, 44,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,
+ 48,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0, 52,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0, 56,  0,  0,  0,  4,  0,  0,  0,
+  1,  0,  0,  0, 60,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0, 64,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0, 68,  0,  0,  0,
+  4,  0,  0,  0,  1,  0,  0,  0, 72,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0, 76,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,
+ 80,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0, 84,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0, 88,  0,  0,  0,  4,  0,  0,  0,
+  1,  0,  0,  0, 92,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0, 96,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,
+  4,  0,  0,  0,  1,  0,  0,  0,104,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,108,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,
+112,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,116,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,120,  0,  0,  0,  4,  0,  0,  0,
+  1,  0,  0,  0,124,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,128,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,132,  0,  0,  0,
+  4,  0,  0,  0,  1,  0,  0,  0,136,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,140,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,
+144,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,148,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,152,  0,  0,  0,  4,  0,  0,  0,
+  1,  0,  0,  0,156,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,160,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,164,  0,  0,  0,
+  4,  0,  0,  0,  1,  0,  0,  0,168,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,172,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,
+176,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,180,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,184,  0,  0,  0,  4,  0,  0,  0,
+  1,  0,  0,  0,188,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,192,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,196,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  0,  0,200,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,204,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+208,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,212,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,216,  0,  0,  0,  4,  0,  0,  0,
+  0,  0,  0,  0,220,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,224,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,228,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  0,  0,232,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,236,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+240,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,244,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,248,  0,  0,  0,  4,  0,  0,  0,
+  0,  0,  0,  0,252,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  4,  1,  0,  0,
+  4,  0,  0,  0,  0,  0,  0,  0,  8,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 12,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+ 16,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 20,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 24,  1,  0,  0,  4,  0,  0,  0,
+  0,  0,  0,  0, 28,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 32,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 36,  1,  0,  0,
+  4,  0,  0,  0,  0,  0,  0,  0, 40,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 44,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+ 48,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 52,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 56,  1,  0,  0,  4,  0,  0,  0,
+  0,  0,  0,  0, 60,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 64,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 68,  1,  0,  0,
+  4,  0,  0,  0,  0,  0,  0,  0, 72,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 76,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+ 80,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 84,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 88,  1,  0,  0,  4,  0,  0,  0,
+  0,  0,  0,  0, 92,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 96,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,100,  1,  0,  0,
+  4,  0,  0,  0,  0,  0,  0,  0,104,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,108,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+112,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,116,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,120,  1,  0,  0,  4,  0,  0,  0,
+  0,  0,  0,  0,124,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,128,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,132,  1,  0,  0,
+  4,  0,  0,  0,  0,  0,  0,  0,136,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,140,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+ 77, 69,  0,  0,232,  4,  0,  0,136, 37, 27,  4,  0,  0,  0,  0, 50,  0,  0,  0,  1,  0,  0,  0,  8,  8,196,  4,  0,  0,  0,  0,
+136,227, 26,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 69, 67,117, 98,101, 46, 48,
+ 48, 49,  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,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,184, 42, 27,  4,  0,  0,  0,  0,120,  1, 27,  4,  0,  0,  0,  0,
+248, 38,199,  4,  0,  0,  0,  0, 40,233,198,  4,  0,  0,  0,  0,136, 70,199,  4,  0,  0,  0,  0, 24,163,199,  4,  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, 88, 45, 27,  4,  0,  0,  0,  0,
+248, 90,195,  4,  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,  0,  0,  8, 43, 27,  4,  0,  0,  0,  0,
+  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,  1,  0,  0,  0,  5,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 24, 85, 27,  4,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,  0,  0,  0,  0,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  1,  0,  0,  0,  5,  0,  0,  0,
+ 12,  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,  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,  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,  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, 56, 25, 27,  4,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  1,  0,  0,  0,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  2,  0,  0,  0,  5,  0,  0,  0,
+ 28,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,136, 27, 27,  4,  0,  0,  0,  0,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  0,  0,  0,  0,  1,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,  2,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,  3,  0,  0,  0,  5,  0,  0,  0, 24,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,249,  1,  0,  0,237,  3,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,244,  1,  0,  0,176,  7,  0,  0,
+  0,  0,  0,  0,192,133, 88, 61,184, 45, 85,189,196,181, 24,190,185, 71, 35, 63,153, 31,235, 62,130,102,203, 62,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0, 67,  0, 30,  0,  4,  0,  1,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,  8,  0,  0,  0,184, 42, 27,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,120,164, 26,  4,  0,  0,  0,  0,
+ 68, 65, 84, 65,  8,  2,  0,  0,  8, 43, 27,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  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,  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, 88, 45, 27,  4,  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,  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,
+  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,  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,  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,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,116, 39,  0,  0, 88, 45, 27,  4,  0,  0,  0,  0, 56,  0,  0,  0,249,  1,  0,  0,140,144,131, 62,119,163,200, 60,
+156,  9, 85, 62, 36, 93, 58,172, 64, 26,  0,  0, 50,222, 26,190,119,163,200, 60,156,  9, 85, 62,220,162, 58,172, 64, 26,  0,  0,
+ 61,126,146, 62,223, 37,  8,188, 99,183, 47, 62, 80, 77,177,190, 91, 78,  2,  0,147,185, 56,190,223, 37,  8,188, 99,183, 47, 62,
+176,178,177,190, 91, 78,  2,  0,129,176,157, 62,211, 91,217,188,244,238,246, 61,106, 87,237,185,228, 61,  2,  0, 28, 30, 79,190,
+211, 91,217,188,244,238,246, 61,150,168,237,185,228, 61,  2,  0,115, 19, 94, 62,103,251,128,189,150, 32, 14, 62,213, 14,  8,145,
+  9, 62,  2,  0, 26,161,227,189,103,251,128,189,150, 32, 14, 62, 43,241,  8,145,  9, 62,  2,  0,115, 19, 94, 62,251,118, 25,189,
+ 20,165, 62, 62,146, 12,225,159,148, 83,  2,  0, 26,161,227,189,251,118, 25,189, 20,165, 62, 62,110,243,225,159,148, 83,  2,  0,
+115, 19, 94, 62,232,107, 34, 60,116,128, 92, 62,205,  4,122,132, 46, 33,  0,  0, 26,161,227,189,232,107, 34, 60,116,128, 92, 62,
+ 51,251,122,132, 46, 33,  0,  0, 58,193, 56, 62,119,163,200, 60, 77,247, 99, 62, 30,172, 83,167,129, 38,  0,  0,168,252,152,189,
+119,163,200, 60, 77,247, 99, 62,226, 83, 83,167,129, 38,  0,  0,109, 42, 23, 62,223, 37,  8,188, 88,215, 73, 62, 41,217, 14,206,
+ 67,111,  0,  0,229,197,  0, 62,211, 91,217,188, 71, 14, 29, 62,114,185,159,174, 37, 69,  2,  0,249, 23,164,188,211, 91,217,188,
+ 71, 14, 29, 62,142, 70,159,174, 37, 69,  2,  0, 88,231,182, 61,159,154,121, 61,179,201, 32, 62,182,151,132,255, 51, 74,  2,  0,
+207,121,134, 60,159,154,121, 61,179,201, 32, 62, 74,104,132,255, 51, 74,  2,  0, 25,158,242, 61,159,154,121, 61, 88,215, 73, 62,
+ 44,167,141,255, 38, 92,  2,  0,110,194, 80,188,159,154,121, 61, 88,215, 73, 62,212, 88,141,255, 38, 92,  2,  0,138,211, 41, 62,
+159,154,121, 61, 77,247, 99, 62,233,134, 91,254,110, 41,  0,  0,143, 66,118,189,159,154,121, 61, 77,247, 99, 62, 23,121, 91,254,
+110, 41,  0,  0, 58,193, 56, 62,154,232,206, 61, 77,247, 99, 62, 63,171,127, 88,251, 36,  0,  0,168,252,152,189,154,232,206, 61,
+ 77,247, 99, 62,193, 84,127, 88,251, 36,  0,  0,109, 42, 23, 62,173, 79,  5, 62, 88,215, 73, 62,191,197, 53, 67, 11, 92,  2,  0,
+ 31,158, 43,189,173, 79,  5, 62, 88,215, 73, 62, 65, 58, 53, 67, 11, 92,  2,  0,229,197,  0, 62, 54,180, 27, 62, 71, 14, 29, 62,
+ 49,188, 51, 80, 41, 73,  2,  0,249, 23,164,188, 54,180, 27, 62, 71, 14, 29, 62,207, 67, 51, 80, 41, 73,  2,  0,115, 19, 94, 62,
+111,  6, 65, 62,150, 32, 14, 62,171, 15, 44,107, 51, 68,  2,  0, 26,161,227,189,111,  6, 65, 62,150, 32, 14, 62, 85,240, 44,107,
+ 51, 68,  2,  0,115, 19, 94, 62, 14, 43, 35, 62, 20,165, 62, 62, 10, 13,188, 94, 19, 85,  2,  0, 26,161,227,189, 14, 43, 35, 62,
+ 20,165, 62, 62,246,242,188, 94, 19, 85,  2,  0,115, 19, 94, 62,250,195,236, 61,116,128, 92, 62, 27,  4, 73,124, 81, 30,  0,  0,
+ 26,161,227,189,250,195,236, 61,116,128, 92, 62,229,251, 73,124, 81, 30,  0,  0,140,144,131, 62,154,232,206, 61,156,  9, 85, 62,
+179, 93,140, 83,243, 24,  0,  0, 50,222, 26,190,154,232,206, 61,156,  9, 85, 62, 77,162,140, 83,243, 24,  0,  0, 61,126,146, 62,
+173, 79,  5, 62, 99,183, 47, 62,225, 77, 89, 63,101, 79,  2,  0,147,185, 56,190,173, 79,  5, 62, 99,183, 47, 62, 31,178, 89, 63,
+101, 79,  2,  0,129,176,157, 62, 54,180, 27, 62,244,238,246, 61, 10, 86,225, 68, 20, 65,  2,  0, 28, 30, 79,190, 54,180, 27, 62,
+244,238,246, 61,246,169,225, 68, 20, 65,  2,  0,157, 89,176, 62,159,154,121, 61, 67,  1,232, 61, 39,111,149,255,117, 63,  2,  0,
+ 84,112,116,190,159,154,121, 61, 67,  1,232, 61,217,144,149,255,117, 63,  2,  0,237,107,161, 62,159,154,121, 61,139, 64, 40, 62,
+169,102,145,255,112, 76,  2,  0,244,148, 86,190,159,154,121, 61,139, 64, 40, 62, 87,153,145,255,112, 76,  2,  0,100,  7,139, 62,
+159,154,121, 61, 48, 78, 81, 62, 36,125,151,254,216, 26,  0,  0,227,203, 41,190,159,154,121, 61, 48, 78, 81, 62,220,130,151,254,
+216, 26,  0,  0, 26,229,140, 62,159,154,121, 61,  8,197, 88, 62,162,124,112,254, 23, 29,  2,  0, 79,135, 45,190,159,154,121, 61,
+  8,197, 88, 62, 94,131,112,254, 23, 29,  2,  0, 66,110,133, 62,114, 95,214, 61,116,128, 92, 62,105, 92, 46, 83,100, 30,  2,  0,
+158,153, 30,190,114, 95,214, 61,116,128, 92, 62,151,163, 46, 83,100, 30,  2,  0,115, 19, 94, 62,170,177,251, 61,185,178,103, 62,
+203,  4,126,119,158, 45,  2,  0, 26,161,227,189,170,177,251, 61,185,178,103, 62, 53,251,126,119,158, 45,  2,  0,206,  5, 53, 62,
+114, 95,214, 61,145, 41,111, 62,213,175,209, 82,166, 55,  2,  0,208,133,145,189,114, 95,214, 61,145, 41,111, 62, 43, 80,209, 82,
+166, 55,  2,  0,178, 92, 34, 62,159,154,121, 61,145, 41,111, 62, 93,139,110,254,175, 52,  2,  0, 48,103, 88,189,159,154,121, 61,
+145, 41,111, 62,163,116,110,254,175, 52,  2,  0,206,  5, 53, 62, 22,200,170, 60,145, 41,111, 62,226,176, 82,172,220, 55,  2,  0,
+208,133,145,189, 22,200,170, 60,145, 41,111, 62, 30, 79, 82,172,220, 55,  2,  0,115, 19, 94, 62,159,154,121, 61,253,228,114, 62,
+128, 23, 82,255,209,125,  2,  0, 26,161,227,189,159,154,121, 61,253,228,114, 62,128,232, 82,255,209,125,  2,  0,115, 19, 94, 62,
+149,249, 43, 59,185,178,103, 62,186,  4, 80,136, 27, 45,  2,  0, 26,161,227,189,149,249, 43, 59,185,178,103, 62, 70,251, 80,136,
+ 27, 45,  2,  0, 66,110,133, 62, 22,200,170, 60,116,128, 92, 62,134, 91,236,171,153, 30,  2,  0,158,153, 30,190, 22,200,170, 60,
+116,128, 92, 62,122,164,236,171,153, 30,  2,  0,203,133, 88, 61,202,248, 23, 62, 88,215, 73, 62,  0,  0,209,122, 10, 36,  0,  0,
+203,133, 88, 61, 34, 77,229, 61,145, 41,111, 62,  0,  0,235,252,245,127,  0,  0,203,133, 88, 61,150,254,188,190,236, 27, 70, 62,
+  0,  0,159,251,235,127,  0,  0,203,133, 88, 61,191, 79, 78,190,116,128, 92, 62,  0,  0, 65,146,221, 65,  2,  0,203,133, 88, 61,
+146,221, 14,190, 77,247, 99, 62,  0,  0,125,100, 70, 79,  0,  0,203,133, 88, 61, 30, 99,211,190, 20,165, 62, 62,  0,  0,104,140,
+246, 54,  2,  0,203,133, 88, 61,133,198, 12, 62,190,169,  6, 62,  0,  0,143,112,238, 60,  0,  0,203,133, 88, 61, 99, 38, 91, 62,
+ 28,120,239, 61,  0,  0,104, 79, 98,100,  0,  0,203,133, 88, 61, 16,243,187, 62,170,250,206,190,  0,  0,144,106, 25,185,  2,  0,
+203,133, 88, 61,247,106, 87, 62,178,224, 11,191,  0,  0, 51, 40,124,134,  3,  0,203,133, 88, 61, 18,165,157,188, 33, 20,  9,191,
+  0,  0,140,217,235,133,  2,  0,203,133, 88, 61, 32, 43,108,190,227, 83,160,190,  0,  0,143,135,174,212,  2,  0,109, 42, 23, 62,
+146,221, 14,190, 67,  1,232, 61,224,115, 50,206,203, 21,  0,  0, 31,158, 43,189,146,221, 14,190, 67,  1,232, 61, 32,140, 50,206,
+203, 21,  0,  0, 87,106, 75, 62,138, 37,131,190, 28,120,239, 61,136,123,  6, 28, 94, 18,  2,  0,225, 78,190,189,138, 37,131,190,
+ 28,120,239, 61,120,132,  6, 28, 94, 18,  2,  0,115, 19, 94, 62,  2,186,192,190, 28,120,239, 61,229,124, 36, 12, 56, 25,  0,  0,
+ 26,161,227,189,  2,186,192,190, 28,120,239, 61, 27,131, 36, 12, 56, 25,  0,  0, 75,138,101, 62,200, 96,239,190,227, 37,202, 61,
+ 26,124, 38,237,  2, 25,  2,  0,203,142,242,189,200, 96,239,190,227, 37,202, 61,230,131, 38,237,  2, 25,  2,  0, 47,225, 82, 62,
+195,112,252,190, 10,175,194, 61,185, 83, 15,161,241, 18,  2,  0,146, 60,205,189,195,112,252,190, 10,175,194, 61, 71,172, 15,161,
+241, 18,  2,  0, 41,248, 11, 62,242,  4,  1,191,107,138,224, 61, 45, 20, 69,131,109, 20,  2,  0, 27,170,253,188,242,  4,  1,191,
+107,138,224, 61,211,235, 69,131,109, 20,  2,  0,203,133, 88, 61,168,226,  2,191,244,238,246, 61,  0,  0,219,130,219, 26,  2,  0,
+140,144,131, 62, 18,242,240,189,227, 37,202, 61, 38, 46,194,136,209,  5,  2,  0, 50,222, 26,190, 18,242,240,189,227, 37,202, 61,
+218,209,194,136,209,  5,  2,  0, 83, 55,178, 62, 23,233,143,189,187,156,209, 61, 96, 75,200,154, 89, 21,  2,  0,193, 43,120,190,
+ 23,233,143,189,187,156,209, 61,160,180,200,154, 89, 21,  2,  0, 26,222,224, 62,182,236,140, 60, 49, 21,112, 61,208,116,116,204,
+ 17,247,  2,  0,167,188,170,190,182,236,140, 60, 49, 21,112, 61, 48,139,116,204, 17,247,  2,  0,243, 84,232, 62,202,248, 23, 62,
+ 82,238,  2, 62,167,112, 64, 54, 93, 27,  2,  0,128, 51,178,190,202,248, 23, 62, 82,238,  2, 62, 89,143, 64, 54, 93, 27,  2,  0,
+112,224,196, 62,190, 24, 50, 62,  2,220, 17, 62, 70, 65,159,106,113, 27,  0,  0,253,190,142,190,190, 24, 50, 62,  2,220, 17, 62,
+186,190,159,106,113, 27,  0,  0,134,160,144, 62, 20, 20,106, 62, 99,183, 47, 62,131, 76, 82,100,139, 21,  0,  0, 39,254, 52,190,
+ 20, 20,106, 62, 99,183, 47, 62,125,179, 82,100,139, 21,  0,  0,195, 37, 79, 62, 67, 92,154, 62,236, 27, 70, 62, 56, 29,185,122,
+159, 21,  2,  0,186,197,197,189, 67, 92,154, 62,236, 27, 70, 62,200,226,185,122,159, 21,  2,  0,229,197,  0, 62,181,  7,145, 62,
+ 48, 78, 81, 62, 95,179,127, 99,180, 24,  2,  0,249, 23,164,188,181,  7,145, 62, 48, 78, 81, 62,161, 76,127, 99,180, 24,  2,  0,
+168,249,167, 61, 42,212, 53, 62,196,146, 77, 62,169,154,155, 74, 94, 23,  0,  0,144, 48,194, 60, 42,212, 53, 62,196,146, 77, 62,
+ 87,101,155, 74, 94, 23,  0,  0, 81,129,  4, 62,241,129, 16, 62,  8,197, 88, 62,248, 33,229,229,156,120,  0,  0, 89,243,193,188,
+241,129, 16, 62,  8,197, 88, 62,  8,222,229,229,156,120,  0,  0,105,176,227, 61, 17,132,184, 61,156,  9, 85, 62,162,  3,150,230,
+100,125,  0,  0,214,169,178,187, 17,132,184, 61,156,  9, 85, 62, 94,252,150,230,100,125,  0,  0, 31,158, 43,189,223, 37,  8,188,
+ 88,215, 73, 62,215, 38, 14,206, 67,111,  0,  0,184, 69,105, 62, 92, 82, 55,189, 59, 46, 55, 62,194, 39,112,212,152,113,  0,  0,
+163,  5,250,189, 92, 82, 55,189, 59, 46, 55, 62, 62,216,112,212,152,113,  0,  0,134,160,144, 62,115,128,187,188,139, 64, 40, 62,
+176, 53,101,207,137,105,  0,  0, 39,254, 52,190,115,128,187,188,139, 64, 40, 62, 80,202,101,207,137,105,  0,  0,157, 89,176, 62,
+205, 26, 17, 61, 71, 14, 29, 62,129, 56,167,229,200,111,  0,  0, 84,112,116,190,205, 26, 17, 61, 71, 14, 29, 62,127,199,167,229,
+200,111,  0,  0,  9, 21,180, 62, 57, 13,177, 61, 71, 14, 29, 62,117, 46,213,228, 33,116,  0,  0, 45,231,123,190, 57, 13,177, 61,
+ 71, 14, 29, 62,139,209,213,228, 33,116,  0,  0,123,192,170, 62,170,177,251, 61, 31,133, 36, 62,228, 30,190,216,216,117,  0,  0,
+ 16, 62,105,190,170,177,251, 61, 31,133, 36, 62, 28,225,190,216,216,117,  0,  0,214,178,129, 62, 54,180, 27, 62, 20,165, 62, 62,
+ 82, 25,170,254,117,125,  0,  0,198, 34, 23,190, 54,180, 27, 62, 20,165, 62, 62,174,230,170,254,117,125,  0,  0,246,142, 45, 62,
+230,161, 42, 62, 48, 78, 81, 62, 13, 34,233,239, 84,122,  0,  0, 32,152,130,189,230,161, 42, 62, 48, 78, 81, 62,243,221,233,239,
+ 84,122,  0,  0,203,133, 88, 61,104,133,209,190,236, 27, 70, 62,  0,  0,130,201,209,115,  0,  0,185,194,212, 61, 36, 83,198,190,
+236, 27, 70, 62,244, 19, 41,234,135,124,  0,  0,191,196,240, 58, 36, 83,198,190,236, 27, 70, 62, 12,236, 41,234,135,124,  0,  0,
+145, 57,220, 61,207, 80,226,190,167,233, 58, 62,102, 11,172,214,154,120,  0,  0, 77,241,236,186,207, 80,226,190,167,233, 58, 62,
+154,244,172,214,154,120,  0,  0,168,249,167, 61, 19,131,237,190,207,114, 51, 62,198,252, 75,203,152,116,  0,  0,144, 48,194, 60,
+ 19,131,237,190,207,114, 51, 62, 58,  3, 75,203,152,116,  0,  0,203,133, 88, 61,200, 96,239,190, 99,183, 47, 62,  0,  0,154,213,
+196,120,  0,  0,203,133, 88, 61,254,152, 18,190,196,146, 77, 62,  0,  0, 46, 97, 76, 83,  0,  0,203,133, 88, 61, 18,242,240,189,
+ 88,215, 73, 62,  0,  0,220, 72, 59,105,  0,  0,225, 75,205, 61,235,104,248,189, 88,215, 73, 62, 91, 32,137, 44,141,115,  0,  0,
+179,158,179, 59,235,104,248,189, 88,215, 73, 62,165,223,137, 44,141,115,  0,  0,105,176,227, 61,174,134, 33,190,196,146, 77, 62,
+ 91, 92, 85,209, 85, 75,  0,  0,214,169,178,187,174,134, 33,190,196,146, 77, 62,165,163, 85,209, 85, 75,  0,  0, 48, 94,190, 61,
+ 15, 98, 63,190, 88,215, 73, 62,153, 63, 63,200, 17, 96,  0,  0,220, 60, 81, 60, 15, 98, 63,190, 88,215, 73, 62,103,192, 63,200,
+ 17, 96,  0,  0,252,119,116, 62,239, 95,151,189,139, 64, 40, 62,192, 48,194,189, 17, 98,  0,  0, 22, 53,  8,190,239, 95,151,189,
+139, 64, 40, 62, 64,207,194,189, 17, 98,  0,  0,231,123,174, 62,211, 91,217,188,  2,220, 17, 62,214, 63,168,204, 87, 98,  2,  0,
+232,180,112,190,211, 91,217,188,  2,220, 17, 62, 42,192,168,204, 87, 98,  2,  0,220,155,200, 62, 45,246, 46, 61,190,169,  6, 62,
+ 66, 70, 51,214,123, 98,  0,  0,105,122,146,190, 45,246, 46, 61,190,169,  6, 62,190,185, 51,214,123, 98,  0,  0, 72, 87,204, 62,
+170,177,251, 61,179,201, 32, 62,103, 62, 46,237, 39,110,  0,  0,213, 53,150,190,170,177,251, 61,179,201, 32, 62,153,193, 46,237,
+ 39,110,  0,  0, 78, 71,191, 62,241,129, 16, 62,128, 96, 66, 62,188, 43,214,251, 56,120,  2,  0,219, 37,137,190,241,129, 16, 62,
+128, 96, 66, 62, 68,212,214,251, 56,120,  2,  0,140,144,131, 62, 31,244, 79, 62, 77,247, 99, 62, 53, 40, 29,252,116,121,  0,  0,
+ 50,222, 26,190, 31,244, 79, 62, 77,247, 99, 62,203,215, 29,252,116,121,  0,  0, 87,106, 75, 62, 48,189,124, 62,105,160,118, 62,
+180, 34, 68, 27, 37,120,  0,  0,225, 78,190,189, 48,189,124, 62,105,160,118, 62, 76,221, 68, 27, 37,120,  0,  0,109, 42, 23, 62,
+236,138,113, 62, 65, 23,126, 62,250,234, 91, 20,154,124,  0,  0, 31,158, 43,189,236,138,113, 62, 65, 23,126, 62,  6, 21, 91, 20,
+154,124,  0,  0,225, 75,205, 61,202,248, 23, 62,213, 91,122, 62,170,246, 84,252,154,127,  0,  0,179,158,179, 59,202,248, 23, 62,
+213, 91,122, 62, 86,  9, 84,252,154,127,  0,  0,105,176,227, 61,217,159,203,189, 37,110,107, 62,125,  8, 79,231, 77,125,  0,  0,
+214,169,178,187,217,159,203,189, 37,110,107, 62,131,247, 79,231, 77,125,  0,  0,218,229, 26, 62, 64,  3,133,190,167,233, 58, 62,
+ 41, 75, 84, 14,155,102,  2,  0,207,139, 58,189, 64,  3,133,190,167,233, 58, 62,215,180, 84, 14,155,102,  2,  0,246,142, 45, 62,
+184,151,194,190, 99,183, 47, 62,174, 72,200,251, 69,105,  2,  0, 32,152,130,189,184,151,194,190, 99,183, 47, 62, 82,183,200,251,
+ 69,105,  2,  0,206,  5, 53, 62, 99,149,222,190, 31,133, 36, 62, 39, 71, 91,228,189,102,  2,  0,208,133,145,189, 99,149,222,190,
+ 31,133, 36, 62,217,184, 91,228,189,102,  2,  0, 30, 24, 38, 62,234,249,244,190,111,151, 21, 62,118, 46,217,176, 53, 89,  2,  0,
+224, 84,103,189,234,249,244,190,111,151, 21, 62,138,209,217,176, 53, 89,  2,  0, 81,129,  4, 62, 86,181,248,190,111,151, 21, 62,
+124, 21,143,159, 92, 81,  2,  0, 89,243,193,188, 86,181,248,190,111,151, 21, 62,132,234,143,159, 92, 81,  2,  0,203,133, 88, 61,
+195,112,252,190,219, 82, 25, 62,  0,  0,155,154, 28, 78,  2,  0,203,133, 88, 61, 52, 55,247,188,128, 96, 66, 62,  0,  0,185,  1,
+252,127,  0,  0,203,133, 88, 61,222,227, 61, 61,156,  9, 85, 62,  0,  0,102,227,194,124,  0,  0, 47,225, 82, 62, 82, 93, 46, 62,
+ 88,215, 73, 62, 20, 17,134,243, 60,126,  0,  0,146, 60,205,189, 82, 93, 46, 62, 88,215, 73, 62,236,238,134,243, 60,126,  0,  0,
+ 81,129,  4, 62,170, 34, 94, 60,196,146, 77, 62, 69,216, 70,234,183,119,  0,  0, 89,243,193,188,170, 34, 94, 60,196,146, 77, 62,
+187, 39, 70,234,183,119,  0,  0, 65, 39,235, 61,222,227, 61, 61, 48, 78, 81, 62, 55,235,111,230,174,123,  0,  0,173, 11, 21,188,
+222,227, 61, 61, 48, 78, 81, 62,201, 20,111,230,174,123,  0,  0,145, 57,220, 61, 76,220,190,190,236, 27, 70, 62, 18, 23,153,248,
+174,125,  0,  0, 77,241,236,186, 76,220,190,190,236, 27, 70, 62,238,232,153,248,174,125,  0,  0, 88,231,182, 61, 64,  3,133,190,
+196,146, 77, 62,190, 17, 95,  0,194,126,  2,  0,207,121,134, 60, 64,  3,133,190,196,146, 77, 62, 66,238, 95,  0,194,126,  2,  0,
+203,133, 88, 61, 64,  3,133,190,196,146, 77, 62,  0,  0,122,255,254,127,  0,  0,203,133, 88, 61, 43, 11, 82,190, 88,215, 73, 62,
+  0,  0,111,197,207,113,  0,  0,  8,213,197, 61, 55,235, 55,190,116,128, 92, 62, 71, 74,123,162,  9, 46,  2,  0, 27,134, 21, 60,
+ 55,235, 55,190,116,128, 92, 62,185,181,123,162,  9, 46,  2,  0, 65, 39,235, 61,174,134, 33,190, 77,247, 99, 62, 88,118,191,228,
+110, 40,  2,  0,173, 11, 21,188,174,134, 33,190, 77,247, 99, 62,168,137,191,228,110, 40,  2,  0,185,194,212, 61, 57,123,233,189,
+116,128, 92, 62,150, 79, 31, 99,242, 14,  2,  0,191,196,240, 58, 57,123,233,189,116,128, 92, 62,106,176, 31, 99,242, 14,  2,  0,
+ 31,149,145, 61, 97,  4,226,189,116,128, 92, 62, 95,217,134,120, 24, 19,  2,  0, 89,225, 13, 61, 97,  4,226,189,116,128, 92, 62,
+161, 38,134,120, 24, 19,  2,  0,203,133, 88, 61,106, 84, 22,190,253,228,114, 62,  0,  0,137, 14, 42,127,  0,  0,247, 11,153, 61,
+235,104,248,189, 37,110,107, 62,130,230,  5, 77,255, 98,  2,  0, 82,231,253, 60,235,104,248,189, 37,110,107, 62,126, 25,  5, 77,
+255, 98,  2,  0,  8,213,197, 61,195,223,255,189, 37,110,107, 62,229, 46,209, 60,101,102,  2,  0, 27,134, 21, 60,195,223,255,189,
+ 37,110,107, 62, 27,209,209, 60,101,102,  2,  0,185,194,212, 61,174,134, 33,190,253,228,114, 62,254, 54, 84,232, 32,113,  2,  0,
+191,196,240, 58,174,134, 33,190,253,228,114, 62,  2,201, 84,232, 32,113,  2,  0, 88,231,182, 61,243,184, 44,190,185,178,103, 62,
+ 59, 28,209,183,219,101,  2,  0,207,121,134, 60,243,184, 44,190,185,178,103, 62,197,227,209,183,219,101,  2,  0,203,133, 88, 61,
+ 15, 98, 63,190,185,178,103, 62,  0,  0, 89,188,167,108,  2,  0, 98, 74, 49, 62, 83,148, 74,190,107,138,224, 61, 32,120,156, 41,
+218, 14,  0,  0,248, 14,138,189, 83,148, 74,190,107,138,224, 61,224,135,156, 41,218, 14,  0,  0, 81,129,  4, 62,134,253, 40,190,
+167,233, 58, 62, 27, 95,200,  3,147, 85,  0,  0, 89,243,193,188,134,253, 40,190,167,233, 58, 62,229,160,200,  3,147, 85,  0,  0,
+ 41,248, 11, 62, 83,148, 74,190,167,233, 58, 62,188, 82, 59, 18,241, 95,  0,  0, 27,170,253,188, 83,148, 74,190,167,233, 58, 62,
+ 68,173, 59, 18,241, 95,  0,  0, 30, 24, 38, 62,243,184, 44,190,107,138,224, 61,  9,122, 11, 36,207, 13,  0,  0,224, 84,103,189,
+243,184, 44,190,107,138,224, 61,247,133, 11, 36,207, 13,  0,  0,203,133, 88, 61, 93,165,235,190, 99,183, 47, 62,  0,  0,198, 82,
+160, 97,  0,  0,247, 11,153, 61,167,199,233,190, 99,183, 47, 62,149,208,194, 69, 69, 96,  0,  0, 82,231,253, 60,167,199,233,190,
+ 99,183, 47, 62,107, 47,194, 69, 69, 96,  0,  0,  8,213,197, 61, 99,149,222,190,167,233, 58, 62,197,172,223,  7,235, 96,  0,  0,
+ 27,134, 21, 60, 99,149,222,190,167,233, 58, 62, 59, 83,223,  7,235, 96,  0,  0,  8,213,197, 61, 70,236,203,190,128, 96, 66, 62,
+104,241, 70,177,219, 99,  0,  0, 27,134, 21, 60, 70,236,203,190,128, 96, 66, 62,152, 14, 70,177,219, 99,  0,  0,203,133, 88, 61,
+212, 64,213,190,179,201, 32, 62,  0,  0,141,166,141, 91,  0,  0,  8,213,197, 61,252,201,205,190, 31,133, 36, 62,233,189,224,165,
+ 99, 62,  0,  0, 27,134, 21, 60,252,201,205,190, 31,133, 36, 62, 23, 66,224,165, 99, 62,  0,  0,  8,213,197, 61,173,183,220,190,
+219, 82, 25, 62,160,169,174, 14, 78, 93,  0,  0, 27,134, 21, 60,173,183,220,190,219, 82, 25, 62, 96, 86,174, 14, 78, 93,  0,  0,
+247, 11,153, 61, 59, 12,230,190,111,151, 21, 62, 30,214,188, 60,151,104,  0,  0, 82,231,253, 60, 59, 12,230,190,111,151, 21, 62,
+226, 41,188, 60,151,104,  0,  0,203,133, 88, 61,241,233,231,190,111,151, 21, 62,  0,  0,177, 67,161,108,  0,  0,189, 60,  8, 62,
+142,209, 76, 61,116,128, 92, 62, 27, 21,134,244,184,125,  0,  0,186,206,223,188,142,209, 76, 61,116,128, 92, 62,229,234,134,244,
+184,125,  0,  0,149,179, 15, 62, 22,200,170, 60,  8,197, 88, 62,210,253, 49,248,189,127,  0,  0,190,194, 13,189, 22,200,170, 60,
+  8,197, 88, 62, 46,  2, 49,248,189,127,  0,  0,155,156, 86, 62,202,248, 23, 62, 48, 78, 81, 62, 53, 21,115, 14,101,125,  0,  0,
+106,179,212,189,202,248, 23, 62, 48, 78, 81, 62,203,234,115, 14,101,125,  0,  0, 58,193, 56, 62, 94, 61, 20, 62,  8,197, 88, 62,
+103, 23,178,  4,192,125,  2,  0,168,252,152,189, 94, 61, 20, 62,  8,197, 88, 62,153,232,178,  4,192,125,  2,  0, 64,170,127, 62,
+ 25, 11,  9, 62,  8,197, 88, 62, 38, 22,205,241, 67,125,  2,  0, 90,103, 19,190, 25, 11,  9, 62,  8,197, 88, 62,218,233,205,241,
+ 67,125,  2,  0,237,107,161, 62, 34, 77,229, 61,207,114, 51, 62, 51, 39, 96,  4,196,121,  0,  0,244,148, 86,190, 34, 77,229, 61,
+207,114, 51, 62,205,216, 96,  4,196,121,  0,  0, 15,  5,167, 62, 97,150,169, 61, 99,183, 47, 62,238, 23,158,247,117,125,  0,  0,
+ 56,199, 97,190, 97,150,169, 61, 99,183, 47, 62, 18,232,158,247,117,125,  0,  0, 89, 39,165, 62,125,  8, 32, 61,247,251, 43, 62,
+ 69, 38, 13,244,142,121,  0,  0,204, 11, 94,190,125,  8, 32, 61,247,251, 43, 62,187,217, 13,244,142,121,  0,  0, 26,229,140, 62,
+ 60,222,152,187, 20,165, 62, 62,148, 36,144,250,137,122,  0,  0, 79,135, 45,190, 60,222,152,187, 20,165, 62, 62,108,219,144,250,
+137,122,  0,  0,184, 69,105, 62,115,128,187,188, 88,215, 73, 62,146, 25,123,229,148,122,  0,  0,163,  5,250,189,115,128,187,188,
+ 88,215, 73, 62,110,230,123,229,148,122,  0,  0,178, 92, 34, 62,226,194,133,186,116,128, 92, 62,166,  1,  8,236,106,126,  0,  0,
+ 48,103, 88,189,226,194,133,186,116,128, 92, 62, 90,254,  8,236,106,126,  0,  0, 41,248, 11, 62, 57, 13,177, 61,116,128, 92, 62,
+ 48, 30, 16,242,153,123,  0,  0, 27,170,253,188, 57, 13,177, 61,116,128, 92, 62,208,225, 16,242,153,123,  0,  0,218,229, 26, 62,
+170,177,251, 61,116,128, 92, 62,232, 20, 76,245,210,125,  0,  0,207,139, 58,189,170,177,251, 61,116,128, 92, 62, 24,235, 76,245,
+210,125,  0,  0, 30, 24, 38, 62,250,195,236, 61, 48, 78, 81, 62, 31, 64,221,206, 71, 99,  0,  0,224, 84,103,189,250,195,236, 61,
+ 48, 78, 81, 62,225,191,221,206, 71, 99,  0,  0,  1,111, 19, 62, 57, 13,177, 61, 48, 78, 81, 62,138, 95,174,228,172, 80,  0,  0,
+110,176, 28,189, 57, 13,177, 61, 48, 78, 81, 62,118,160,174,228,172, 80,  0,  0,138,211, 41, 62, 77,106,205, 59, 48, 78, 81, 62,
+ 84, 54,203, 71,250, 90,  0,  0,143, 66,118,189, 77,106,205, 59, 48, 78, 81, 62,172,201,203, 71,250, 90,  0,  0,184, 69,105, 62,
+161,220, 67,188,128, 96, 66, 62, 14, 19,134, 78, 67, 99,  0,  0,163,  5,250,189,161,220, 67,188,128, 96, 66, 62,242,236,134, 78,
+ 67, 99,  0,  0,174, 41,137, 62,149,249, 43, 59, 59, 46, 55, 62, 93,245, 83, 69, 17,107,  0,  0,118, 16, 38,190,149,249, 43, 59,
+ 59, 46, 55, 62,163, 10, 83, 69, 17,107,  0,  0,129,176,157, 62,222,227, 61, 61,139, 64, 40, 62, 97,223,176, 28,101,120,  0,  0,
+ 28, 30, 79,190,222,227, 61, 61,139, 64, 40, 62,159, 32,176, 28,101,120,  0,  0, 55,142,159, 62,137, 31,162, 61,139, 64, 40, 62,
+148,210,138,239,134,118,  0,  0,136,217, 82,190,137, 31,162, 61,139, 64, 40, 62,108, 45,138,239,134,118,  0,  0, 21,245,153, 62,
+114, 95,214, 61,247,251, 43, 62, 33,231, 38,177,180, 97,  0,  0, 67,167, 71,190,114, 95,214, 61,247,251, 43, 62,223, 24, 38,177,
+180, 97,  0,  0,212,238,123, 62,173, 79,  5, 62,196,146, 77, 62, 18,238,118,158,234, 80,  2,  0,238,171, 15,190,173, 79,  5, 62,
+196,146, 77, 62,238, 17,118,158,234, 80,  2,  0,166,124, 60, 62, 25, 11,  9, 62,156,  9, 85, 62, 52, 39, 21,212,166,113,  2,  0,
+129,115,160,189, 25, 11,  9, 62,156,  9, 85, 62,204,216, 21,212,166,113,  2,  0,155,156, 86, 62,133,198, 12, 62,196,146, 77, 62,
+ 69,  0,155,192, 49,111,  0,  0,106,179,212,189,133,198, 12, 62,196,146, 77, 62,187,255,155,192, 49,111,  0,  0,109, 42, 23, 62,
+216,126,230, 60,196,146, 77, 62,255, 87, 17, 38,203, 84,  0,  0, 31,158, 43,189,216,126,230, 60,196,146, 77, 62,  1,168, 17, 38,
+203, 84,  0,  0,  1,111, 19, 62, 63,191, 91, 61,196,146, 77, 62, 16,103,234,  1,224, 75,  0,  0,110,176, 28,189, 63,191, 91, 61,
+196,146, 77, 62,240,152,234,  1,224, 75,  0,  0,185,194,212, 61,122,230, 38, 62, 42,101, 10, 62,106,191, 91,110,188,  5,  0,  0,
+191,196,240, 58,122,230, 38, 62, 42,101, 10, 62,150, 64, 91,110,188,  5,  0,  0,  1,111, 19, 62,186,247,131, 62,150, 32, 14, 62,
+242,194, 70, 65, 98,164,  2,  0,110,176, 28,189,186,247,131, 62,150, 32, 14, 62, 14, 61, 70, 65, 98,164,  2,  0,155,156, 86, 62,
+220,144,137, 62, 82,238,  2, 62,171, 14,231, 83,118,160,  2,  0,106,179,212,189,220,144,137, 62, 82,238,  2, 62, 85,241,231, 83,
+118,160,  2,  0,208,194,142, 62,139,175, 83, 62,107,138,224, 61,121, 39,247,116, 47,222,  0,  0,187, 66, 49,190,139,175, 83, 62,
+107,138,224, 61,135,216,247,116, 47,222,  0,  0,152,105,189, 62, 14, 43, 35, 62,170,211,164, 61,252, 44, 81,116, 54,227,  0,  0,
+ 37, 72,135,190, 14, 43, 35, 62,170,211,164, 61,  4,211, 81,116, 54,227,  0,  0, 66,103,217, 62,133,198, 12, 62, 73,248,134, 61,
+158, 94,220, 76,251,216,  0,  0,207, 69,163,190,133,198, 12, 62, 73,248,134, 61, 98,161,220, 76,251,216,  0,  0, 32,206,211, 62,
+119,163,200, 60,252,115,211, 60, 59,120,187,216, 97,236,  0,  0,173,172,157,190,119,163,200, 60,252,115,211, 60,197,135,187,216,
+ 97,236,  0,  0,123,192,170, 62,188, 45, 85,189,112, 94, 52, 61,213, 73, 49,152,144,243,  0,  0, 16, 62,105,190,188, 45, 85,189,
+112, 94, 52, 61, 43,182, 49,152,144,243,  0,  0,140,144,131, 62,  0, 41,196,189, 33,111,142, 61, 61, 56,195,141,255,242,  0,  0,
+ 50,222, 26,190,  0, 41,196,189, 33,111,142, 61,195,199,195,141,255,242,  0,  0,203,133, 88, 61, 16,243,187, 62, 89,242,105,188,
+  0,  0,207,105,  5, 72,  2,  0,203,133, 88, 61,226,121,208, 62,254,  7, 62,190,  0,  0,246,127,248,  2,  2,  0,203,133, 88, 61,
+254,152, 18,190, 11,214,236,190,  0,  0,213,166, 46,164,  3,  0,203,133, 88, 61,173,190,136,190,139,142,124,189,  0,  0,195,129,
+226,234,  0,  0,203,133, 88, 61,205,243,  1,191, 73,248,134, 61,  0,  0, 26,147,190,188,  2,  0,203,133, 88, 61,247,217,218,190,
+241, 12, 56, 60,  0,  0,226,217,208,133,  2,  0,203,133, 88, 61,161,222,162,190,147, 21,157, 57,  0,  0, 83,215,164,134,  0,  0,
+203,133, 88, 61,207, 87,142,190,141,212,146,188,  0,  0,243,152, 22,180,  0,  0, 61,119,230, 62,239,172,106, 61,161, 43,253,189,
+243,124, 39,230, 19, 10,  0,  0,202, 85,176,190,239,172,106, 61,161, 43,253,189, 13,131, 39,230, 19, 10,  0,  0,243, 84,232, 62,
+194,113,199, 61, 78, 26, 47,190,220,127, 45,250,202,  0,  0,  0,128, 51,178,190,194,113,199, 61, 78, 26, 47,190, 36,128, 45,250,
+202,  0,  0,  0, 32,206,211, 62,216, 49,147, 61,181,218,180,190, 32, 80,174,252, 62,156,  1,  0,173,172,157,190,216, 49,147, 61,
+181,218,180,190,224,175,174,252, 62,156,  1,  0,174, 41,137, 62, 54,180, 27, 62,226, 76,244,190,  9, 58, 51, 25,189,144,  3,  0,
+118, 16, 38,190, 54,180, 27, 62,226, 76,244,190,247,197, 51, 25,189,144,  3,  0,146,121,202, 62,239, 95,151,189,240, 61,238,189,
+139, 91, 11,167,108,  9,  2,  0, 31, 88,148,190,239, 95,151,189,240, 61,238,189,117,164, 11,167,108,  9,  2,  0,197,226,168, 62,
+ 97,  4,226,189,163, 21,103,190, 32, 35, 32,133,239,248,  0,  0,164,130,101,190, 97,  4,226,189,163, 21,103,190,224,220, 32,133,
+239,248,  0,  0,  9, 21,180, 62,109, 27,100,189,255,252,178,190,117, 51, 16,177, 97,169,  1,  0, 45,231,123,190,109, 27,100,189,
+255,252,178,190,139,204, 16,177, 97,169,  1,  0,155,156, 86, 62,211, 91,217,188, 85,248,234,190, 58, 54,135,214,188,147,  2,  0,
+106,179,212,189,211, 91,217,188, 85,248,234,190,198,201,135,214,188,147,  2,  0, 30, 24, 38, 62,112, 61, 93,190,191,112, 37, 61,
+229,122,202,255, 60,220,  0,  0,224, 84,103,189,112, 61, 93,190,191,112, 37, 61, 27,133,202,255, 60,220,  0,  0, 41,248, 11, 62,
+209, 24,123,190,176,102,236,188,236, 92,238,180, 10,210,  0,  0, 27,170,253,188,209, 24,123,190,176,102,236,188, 20,163,238,180,
+ 10,210,  0,  0, 19, 56, 64, 62,110,117,196,190, 92, 79,241, 60,138, 77,170,  2, 52,154,  2,  0, 89,234,167,189,110,117,196,190,
+ 92, 79,241, 60,118,178,170,  2, 52,154,  2,  0,246,142, 45, 62, 59, 19,146,190, 95,149,  7, 61,103, 99,206,254, 97,175,  0,  0,
+ 32,152,130,189, 59, 19,146,190, 95,149,  7, 61,153,156,206,254, 97,175,  0,  0, 47,225, 82, 62,234,249,244,190, 15,131, 22, 61,
+129, 71, 28,196, 90,168,  2,  0,146, 60,205,189,234,249,244,190, 15,131, 22, 61,127,184, 28,196, 90,168,  2,  0, 25,158,242, 61,
+178,167,207,190,155,152,181, 60,141, 16, 26,233, 42,131,  0,  0,110,194, 80,188,178,167,207,190,155,152,181, 60,115,239, 26,233,
+ 42,131,  0,  0,105,176,227, 61,201,103,155,190, 58,189,151, 60, 50, 43,143,223,247,139,  0,  0,214,169,178,187,201,103,155,190,
+ 58,189,151, 60,206,212,143,223,247,139,  0,  0, 81,129,  4, 62,195,112,252,190,129, 39, 97, 61,181, 12,181,157,  3,175,  0,  0,
+ 89,243,193,188,195,112,252,190,129, 39, 97, 61, 75,243,181,157,  3,175,  0,  0, 70,161, 30, 62,163,166, 59,190,208, 57, 82, 61,
+142,124,137,226,  5,  0,  0,  0,127,121, 73,189,163,166, 59,190,208, 57, 82, 61,114,131,137,226,  5,  0,  0,  0,218,229, 26, 62,
+174,134, 33,190, 33,111,142, 61, 18,122,107,230,193, 28,  0,  0,207,139, 58,189,174,134, 33,190, 33,111,142, 61,238,133,107,230,
+193, 28,  0,  0,109, 42, 23, 62,186,102,  7,190,130, 74,172, 61, 49,104, 11,185, 42, 22,  0,  0, 31,158, 43,189,186,102,  7,190,
+130, 74,172, 61,207,151, 11,185, 42, 22,  0,  0,218,229, 26, 62,140,230,111,190,206,171,148,189, 91, 75,146,152,161,253,  0,  0,
+207,139, 58,189,140,230,111,190,206,171,148,189,165,180,146,152,161,253,  0,  0,127,243, 67, 62, 83,148, 74,190, 16,205,139,190,
+187, 66, 88,150, 83,228,  2,  0, 49, 97,175,189, 83,148, 74,190, 16,205,139,190, 69,189, 88,150, 83,228,  2,  0,  7, 88, 90, 62,
+235,104,248,189,244, 28,205,190,113, 66, 21,172,210,185,  3,  0, 66, 42,220,189,235,104,248,189,244, 28,205,190,143,189, 21,172,
+210,185,  3,  0,248, 75,135, 62, 55,124,180, 62,187,202,167,190,129, 54,206,102,175,202,  2,  0, 10, 85, 34,190, 55,124,180, 62,
+187,202,167,190,127,201,206,102,175,202,  2,  0,248, 75,135, 62,232,105,195, 62,146, 76, 58,190,186, 53, 22,116,118,  4,  2,  0,
+ 10, 85, 34,190,232,105,195, 62,146, 76, 58,190, 70,202, 22,116,118,  4,  2,  0,248, 75,135, 62,203,192,176, 62,105,252, 34,189,
+  3, 59,236, 93,221, 63,  2,  0, 10, 85, 34,190,203,192,176, 62,105,252, 34,189,253,196,236, 93,221, 63,  2,  0,174, 41,137, 62,
+219,193, 68, 62,208, 57, 82, 61, 32, 50,252,105, 90, 51,  0,  0,118, 16, 38,190,219,193, 68, 62,208, 57, 82, 61,224,205,252,105,
+ 90, 51,  0,  0,220,155,200, 62,133,198, 12, 62, 95,172,248, 59,242, 97,236, 79,  9, 20,  0,  0,105,122,146,190,133,198, 12, 62,
+ 95,172,248, 59, 14,158,236, 79,  9, 20,  0,  0, 83, 55,178, 62, 14, 43, 35, 62,141,212,146,188,108, 60,141, 99, 28, 53,  0,  0,
+193, 43,120,190, 14, 43, 35, 62,141,212,146,188,148,195,141, 99, 28, 53,  0,  0,  9, 21,180, 62, 72, 76,141, 62,161, 43,253,189,
+ 96, 83, 57, 87,177, 42,  0,  0, 45,231,123,190, 72, 76,141, 62,161, 43,253,189,160,172, 57, 87,177, 42,  0,  0, 66,103,217, 62,
+247,106, 87, 62,  7,254,185,189,174, 95, 44, 68,204, 50,  2,  0,207, 69,163,190,247,106, 87, 62,  7,254,185,189, 82,160, 44, 68,
+204, 50,  2,  0, 66,103,217, 62,236,138,113, 62, 26,177, 80,190,105,109, 79, 66, 37,252,  2,  0,207, 69,163,190,236,138,113, 62,
+ 26,177, 80,190,151,146, 79, 66, 37,252,  2,  0,  9, 21,180, 62,141,126,152, 62, 83,  3,118,190,226, 86,170, 93, 43,248,  0,  0,
+ 45,231,123,190,141,126,152, 62, 83,  3,118,190, 30,169,170, 93, 43,248,  0,  0,  9, 21,180, 62, 38,179,135, 62,107,184,182,190,
+111, 82,219, 68,100,186,  2,  0, 45,231,123,190, 38,179,135, 62,107,184,182,190,145,173,219, 68,100,186,  2,  0, 66,103,217, 62,
+179, 56, 76, 62,153, 49,162,190,218,111, 76, 39,195,207,  2,  0,207, 69,163,190,179, 56, 76, 62,153, 49,162,190, 38,144, 76, 39,
+195,207,  2,  0,231,123,174, 62,154,232,206, 61, 56, 79,216,190,  2, 75,  5,254, 79,152,  3,  0,232,180,112,190,154,232,206, 61,
+ 56, 79,216,190,254,180,  5,254, 79,152,  3,  0,208,194,142, 62,171,100, 40,189,170,250,206,190,171, 69,136,192,101,169,  1,  0,
+187, 66, 49,190,171,100, 40,189,170,250,206,190, 85,186,136,192,101,169,  0,  0,100,  0,223, 62,154,232,206, 61,191,190,121,190,
+190,114,245, 38, 55, 41,  0,  0,241,222,168,190,154,232,206, 61,191,190,121,190, 66,141,245, 38, 55, 41,  0,  0,104, 51,120, 62,
+186,102,  7,190,127,153,163,189, 89, 73, 32,153,123, 20,  0,  0,130,240, 11,190,186,102,  7,190,127,153,163,189,167,182, 32,153,
+123, 20,  0,  0,214,178,129, 62,254,152, 18,190, 44,122,125,190, 90, 74,132,153, 69,237,  0,  0,198, 34, 23,190,254,152, 18,190,
+ 44,122,125,190,166,181,132,153, 69,237,  0,  0,202,203,239, 62,133,198, 12, 62, 56, 86,132,190, 43,219,144, 94,  0, 78,  2,  0,
+ 88,170,185,190,133,198, 12, 62, 56, 86,132,190,213, 36,144, 94,  0, 78,  2,  0, 32,206,211, 62, 18,242,240,189,135,108, 84,190,
+ 98,250, 11,173, 79, 97,  2,  0,173,172,157,190, 18,242,240,189,135,108, 84,190,158,  5, 11,173, 79, 97,  2,  0, 38,160,  9, 63,
+217,159,203,189,192,186,154,190,102, 60, 54,156,176, 52,  0,  0,219, 30,221,190,217,159,203,189,192,186,154,190,154,195, 54,156,
+177, 52,  0,  0,172,140, 38, 63,211, 91,217,188,255,252,178,190, 40, 86,  6,192,194, 69,  0,  0,244,123, 11,191,211, 91,217,188,
+255,252,178,190,216,169,  6,192,194, 69,  0,  0, 95,242, 46, 63,194,113,199, 61, 73, 31,177,190, 16,101,233, 22, 32, 75,  2,  0,
+167,225, 19,191,194,113,199, 61, 73, 31,177,190,240,154,233, 22, 32, 75,  2,  0,138,243, 32, 63,  3, 75, 61, 62, 73, 31,177,190,
+ 32, 46, 37,110, 20, 46,  0,  0,209,226,  5,191,  3, 75, 61, 62, 73, 31,177,190,224,209, 37,110, 20, 46,  0,  0,112,194,  7, 63,
+ 82, 93, 46, 62, 84,255,150,190, 21,  2,210,111, 62, 62,  0,  0,111, 99,217,190, 82, 93, 46, 62, 84,255,150,190,235,253,210,111,
+ 62, 62,  0,  0,149,211,  6, 63,241,129, 16, 62, 50,102,145,190, 97, 69, 95,247, 54,107,  0,  0,185,133,215,190,241,129, 16, 62,
+ 50,102,145,190,159,186, 95,247, 54,107,  0,  0,104, 90, 27, 63, 54,180, 27, 62,113,168,169,190,159, 40, 26,244,203,120,  0,  0,
+175, 73,  0,191, 54,180, 27, 62,113,168,169,190, 97,215, 26,244,203,120,  0,  0,246,174, 36, 63, 97,150,169, 61,221, 99,173,190,
+162,240,132,244,140,126,  0,  0, 62,158,  9,191, 97,150,169, 61,221, 99,173,190, 94, 15,132,244,140,126,  0,  0,249, 38, 30, 63,
+ 98,147,127,188,221, 99,173,190,238,252, 16, 35, 15,123,  0,  0, 64, 22,  3,191, 98,147,127,188,221, 99,173,190, 18,  3, 16, 35,
+ 15,123,  0,  0, 75,177,  8, 63, 23,233,143,189,158, 33,149,190,255, 62, 10, 35,196,105,  0,  0, 37, 65,219,190, 23,233,143,189,
+158, 33,149,190,  1,193, 10, 35,196,105,  0,  0, 26,222,224, 62,120,196,173,189,243, 39, 88,190,176, 43, 36, 45,132,111,  2,  0,
+167,188,170,190,120,196,173,189,243, 39, 88,190, 80,212, 36, 45,132,111,  2,  0,162, 66,247, 62,250,195,236, 61,204,154,128,190,
+191, 58,236,247,109,113,  2,  0, 48, 33,193,190,250,195,236, 61,204,154,128,190, 65,197,236,247,109,113,  2,  0,196,219,252, 62,
+ 17,132,184, 61, 50,102,145,190,  9, 88, 45,185, 34, 60,  0,  0, 82,186,198,190, 17,132,184, 61, 50,102,145,190,247,167, 45,185,
+ 34, 60,  0,  0, 21,238,237, 62,103,251,128,189, 44,122,125,190,210, 29,124,112, 75, 53,  0,  0,162,204,183,190,103,251,128,189,
+ 44,122,125,190, 46,226,124,112, 75, 53,  0,  0, 38,160,  9, 63,188, 45, 85,189, 79, 15,164,190,175,234, 24,122,245, 31,  0,  0,
+219, 30,221,190,188, 45, 85,189, 79, 15,164,190, 81, 21, 24,122,245, 31,  0,  0,104, 90, 27, 63,223, 37,  8,188,107,184,182,190,
+141,158,211, 82, 28,  5,  0,  0,175, 73,  0,191,223, 37,  8,188,107,184,182,190,115, 97,211, 82, 28,  5,  0,  0,138,243, 32, 63,
+ 40, 68,132, 61,107,184,182,190,111,130, 12,244,188, 21,  0,  0,209,226,  5,191, 40, 68,132, 61,107,184,182,190,145,125, 12,244,
+188, 21,  0,  0,178,124, 25, 63,250,195,236, 61,181,218,180,190,245,237, 22,157, 52, 79,  0,  0,242,215,252,190,250,195,236, 61,
+181,218,180,190, 11, 18, 22,157, 52, 79,  0,  0,112,194,  7, 63, 74,214,221, 61,153, 49,162,190,132, 71,190,171,144, 64,  0,  0,
+111, 99,217,190, 74,214,221, 61,153, 49,162,190,124,184,190,171,144, 64,  0,  0,135,153,228, 62, 97,150,169, 61, 44,122,125,190,
+ 16, 95,148,222,236, 78,  0,  0, 20,120,174,190, 97,150,169, 61, 44,122,125,190,240,160,148,222,236, 78,  0,  0,209,187,226, 62,
+216,126,230, 60,198,170,141,190,194, 95,198,181, 68, 41,  0,  0, 93,154,172,190,216,126,230, 60,198,170,141,190, 62,160,198,181,
+ 68, 41,  0,  0,180, 18,208, 62,223, 37,  8,188,198,170,141,190,238,109,193,  4, 98, 65,  0,  0, 65,241,153,190,223, 37,  8,188,
+198,170,141,190, 18,146,193,  4, 98, 65,  0,  0,100,  0,223, 62,161,220, 67,188,198,170,141,190, 91, 73,245, 92,148, 48,  2,  0,
+241,222,168,190,161,220, 67,188,198,170,141,190,165,182,245, 92,148, 48,  2,  0,135,153,228, 62, 92, 82, 55,189,198,170,141,190,
+ 27,113,  2,248, 97, 59,  2,  0, 20,120,174,190, 92, 82, 55,189,198,170,141,190,229,142,  2,248, 97, 59,  2,  0,174, 34,221, 62,
+ 29,  9,115,189,198,170,141,190,241, 75,125, 72, 55, 73,  0,  0, 59,  1,167,190, 29,  9,115,189,198,170,141,190, 15,180,125, 72,
+ 55, 73,  0,  0,220,155,200, 62,188, 45, 85,189,146, 76, 58,190, 69,110,138,193, 22,238,  0,  0,105,122,146,190,188, 45, 85,189,
+146, 76, 58,190,187,145,138,193, 22,238,  0,  0, 38,190,198, 62,103,251,128,189, 15,209,106,190, 93, 95,240, 10,170, 84,  0,  0,
+179,156,144,190,103,251,128,189, 15,209,106,190,163,160,240, 10,170, 84,  0,  0, 38,190,198, 62, 74,137, 10,189,231, 71,114,190,
+226,117,157,233,140, 44,  0,  0,179,156,144,190, 74,137, 10,189,231, 71,114,190, 30,138,157,233,140, 44,  0,  0, 66,103,217, 62,
+ 45,246, 46, 61, 44,122,125,190,156,111,186,201, 79, 31,  0,  0,207, 69,163,190, 45,246, 46, 61, 44,122,125,190,100,144,186,201,
+ 79, 31,  0,  0,202,203,239, 62,159,154,121, 61, 16,205,139,190, 32, 89,187,186, 87, 60,  0,  0, 88,170,185,190,159,154,121, 61,
+ 16,205,139,190,224,166,187,186, 87, 60,  0,  0,202,203,239, 62,239,172,106, 61, 10,221,152,190, 91, 85, 90,200,118, 77,  0,  0,
+ 88,170,185,190,239,172,106, 61, 10,221,152,190,165,170, 90,200,118, 77,  0,  0,174, 34,221, 62, 29,  9,115,189, 10,221,152,190,
+123, 84,188, 44, 29, 85,  0,  0, 59,  1,167,190, 29,  9,115,189, 10,221,152,190,133,171,188, 44, 29, 85,  0,  0, 61,119,230, 62,
+ 92, 82, 55,189, 10,221,152,190,219, 47, 50, 47,237,108,  0,  0,202, 85,176,190, 92, 82, 55,189, 10,221,152,190, 37,208, 50, 47,
+237,108,  0,  0, 26,222,224, 62, 98,147,127,188, 10,221,152,190,236, 56,223, 47, 42,104,  0,  0,167,188,170,190, 98,147,127,188,
+ 10,221,152,190, 20,199,223, 47, 42,104,  0,  0,106,240,209, 62,223, 37,  8,188, 10,221,152,190, 79,100, 44, 32,179, 72,  0,  0,
+247,206,155,190,223, 37,  8,188, 10,221,152,190,177,155, 44, 32,179, 72,  0,  0,135,153,228, 62,216,126,230, 60, 10,221,152,190,
+ 35, 73,126,201,202, 89,  0,  0, 20,120,174,190,216,126,230, 60, 10,221,152,190,221,182,126,201,202, 89,  0,  0, 38,160,  9, 63,
+154,232,206, 61,147, 65,175,190,  1, 62,211,212, 80,103,  0,  0,219, 30,221,190,154,232,206, 61,147, 65,175,190,255,193,211,212,
+ 80,103,  0,  0,104, 90, 27, 63, 74,214,221, 61,249, 12,192,190, 51,224,110,181, 12, 99,  0,  0,175, 73,  0,191, 74,214,221, 61,
+249, 12,192,190,205, 31,110,181, 12, 99,  0,  0, 27,192, 35, 63,159,154,121, 61,175,234,193,190,220,160,139,243,182, 84,  0,  0,
+ 98,175,  8,191,159,154,121, 61,175,234,193,190, 36, 95,139,243,182, 84,  0,  0,249, 38, 30, 63,161,220, 67,188,249, 12,192,190,
+253,186,174, 57, 16, 91,  0,  0, 64, 22,  3,191,161,220, 67,188,249, 12,192,190,  3, 69,174, 57, 16, 91,  0,  0,  1,143, 10, 63,
+188, 45, 85,189, 73, 31,177,190, 44, 11,185, 94, 90, 85,  0,  0,145,252,222,190,188, 45, 85,189, 73, 31,177,190,212,244,185, 94,
+ 90, 85,  0,  0, 21,238,237, 62, 29,  9,115,189, 16,205,139,190,131,249,213,121,178, 38,  0,  0,162,204,183,190, 29,  9,115,189,
+ 16,205,139,190,125,  6,213,121,178, 38,  0,  0,122,185,254, 62, 97,150,169, 61, 45,118,158,190, 97, 81,161,203,196, 83,  0,  0,
+  8,152,200,190, 97,150,169, 61, 45,118,158,190,159,174,161,203,196, 83,  0,  0,202,203,239, 62,226,194,133,186,192,186,154,190,
+ 99, 25,168,  0,115,125,  0,  0, 88,170,185,190,226,194,133,186,192,186,154,190,157,230,168,  0,115,125,  0,  0, 14,254,250, 62,
+115,128,187,188,119,152,156,190, 86, 49,224, 14, 41,117,  0,  0,156,220,196,190,115,128,187,188,119,152,156,190,170,206,224, 14,
+ 41,117,  0,  0,223,245,  4, 63, 77,106,205, 59, 79, 15,164,190, 60, 55,195,251, 98,115,  0,  0, 76,202,211,190, 77,106,205, 59,
+ 79, 15,164,190,196,200,195,251, 98,115,  0,  0,152, 75,  0, 63,216,126,230, 60,227, 83,160,190,255, 41,  6,  0,232,120,  0,  0,
+190,117,202,190,216,126,230, 60,227, 83,160,190,  1,214,  6,  0,232,120,  0,  0,149,211,  6, 63,239,172,106, 61,  5,237,165,190,
+174, 40,253, 11,196,120,  0,  0,185,133,215,190,239,172,106, 61,  5,237,165,190, 82,215,253, 11,196,120,  0,  0,220,125, 11, 63,
+205, 26, 17, 61,187,202,167,190, 32, 44, 47,246,191,119,  0,  0, 71,218,224,190,205, 26, 17, 61,187,202,167,190,224,211, 47,246,
+191,119,  0,  0,218,  5, 18, 63,222,227, 61, 61,113,168,169,190,222, 55, 67,254, 37,115,  2,  0, 65,234,237,190,222,227, 61, 61,
+113,168,169,190, 34,200, 67,254, 37,115,  2,  0, 73, 57, 15, 63,176,168,154, 61,113,168,169,190,188, 45, 37, 38, 75,113,  2,  0,
+ 31, 81,232,190,176,168,154, 61,113,168,169,190, 68,210, 37, 38, 75,113,  2,  0,112,194,  7, 63, 54,180, 27, 62,249, 12,192,190,
+139,202,127, 71, 71,164,  3,  0,111, 99,217,190, 54,180, 27, 62,249, 12,192,190,117, 53,127, 71, 71,164,  3,  0, 64,209, 34, 63,
+230,161, 42, 62,170,250,206,190,  2, 39,153, 79,172,163,  3,  0,135,192,  7,191,230,161, 42, 62,170,250,206,190,254,216,153, 79,
+172,163,  3,  0, 21,208, 48, 63, 57, 13,177, 61,102,200,195,190, 49,118,245, 10, 30,208,  3,  0, 93,191, 21,191, 57, 13,177, 61,
+102,200,195,190,207,137,245, 10, 30,208,  3,  0, 24, 72, 42, 63,211, 91,217,188, 62, 63,203,190,182, 78, 54,193,251,176,  3,  0,
+ 96, 55, 15,191,211, 91,217,188, 62, 63,203,190, 74,177, 54,193,251,176,  3,  0, 38,160,  9, 63, 40,178,188,189,175,234,193,190,
+165,250,140,166,156,164,  3,  0,219, 30,221,190, 40,178,188,189,175,234,193,190, 91,  5,140,166,156,164,  3,  0,140,137,215, 62,
+ 97,  4,226,189,192,186,154,190,203,245,207,147, 96,188,  1,  0, 25,104,161,190, 97,  4,226,189,192,186,154,190, 53, 10,207,147,
+ 96,188,  1,  0,243, 84,232, 62, 65,148,  1, 62,187,202,167,190,  3,172, 39, 73,240,192,  1,  0,128, 51,178,190, 65,148,  1, 62,
+187,202,167,190,253, 83, 39, 73,240,192,  1,  0, 68, 65, 84, 65,  8,  2,  0,  0, 24, 85, 27,  4,  0,  0,  0,  0,124,  1,  0,  0,
+  5,  0,  0,  0,  3,  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,  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,248, 90,195,  4,  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,  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,  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,  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,  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,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 28, 47,  0,  0,248, 90,195,  4,  0,  0,  0,  0, 53,  0,  0,  0,
+237,  3,  0,  0,  0,  0,  0,  0, 45,  0,  0,  0,  0,  0, 34,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0, 34,  0,  2,  0,  0,  0,
+ 43,  0,  0,  0,  0,  0, 34,  0, 43,  0,  0,  0, 45,  0,  0,  0,  0,  0, 34,  0,  1,  0,  0,  0,  3,  0,  0,  0,  0,  0, 34,  0,
+  1,  0,  0,  0, 46,  0,  0,  0,  0,  0, 34,  0, 44,  0,  0,  0, 46,  0,  0,  0,  0,  0, 34,  0,  3,  0,  0,  0, 44,  0,  0,  0,
+  0,  0, 34,  0,  2,  0,  0,  0,  4,  0,  0,  0,  0,  0, 34,  0,  4,  0,  0,  0, 41,  0,  0,  0,  0,  0, 34,  0, 41,  0,  0,  0,
+ 43,  0,  0,  0,  0,  0, 34,  0,  3,  0,  0,  0,  5,  0,  0,  0,  0,  0, 34,  0, 42,  0,  0,  0, 44,  0,  0,  0,  0,  0, 34,  0,
+  5,  0,  0,  0, 42,  0,  0,  0,  0,  0, 34,  0,  2,  0,  0,  0,  8,  0,  0,  0,  0,  0, 34,  0,  6,  0,  0,  0,  8,  0,  0,  0,
+  0,  0, 34,  0,  4,  0,  0,  0,  6,  0,  0,  0,  0,  0, 34,  0,  7,  0,  0,  0,  9,  0,  0,  0,  0,  0, 34,  0,  3,  0,  0,  0,
+  9,  0,  0,  0,  0,  0, 34,  0,  5,  0,  0,  0,  7,  0,  0,  0,  0,  0, 34,  0,  0,  0,  0,  0, 10,  0,  0,  0,  0,  0, 34,  0,
+  8,  0,  0,  0, 10,  0,  0,  0,  0,  0, 34,  0,  9,  0,  0,  0, 11,  0,  0,  0,  0,  0, 34,  0,  1,  0,  0,  0, 11,  0,  0,  0,
+  0,  0, 34,  0, 10,  0,  0,  0, 12,  0,  0,  0,  0,  0, 34,  0, 12,  0,  0,  0, 14,  0,  0,  0,  0,  0, 34,  0,  8,  0,  0,  0,
+ 14,  0,  0,  0,  0,  0, 34,  0, 11,  0,  0,  0, 13,  0,  0,  0,  0,  0, 34,  0, 14,  0,  0,  0, 15,  0,  0,  0,  0,  0, 34,  0,
+  6,  0,  0,  0, 15,  0,  0,  0,  0,  0, 34,  0,  7,  0,  0,  0, 16,  0,  0,  0,  0,  0, 34,  0, 14,  0,  0,  0, 19,  0,  0,  0,
+  0,  0, 34,  0, 17,  0,  0,  0, 19,  0,  0,  0,  0,  0, 34,  0, 15,  0,  0,  0, 17,  0,  0,  0,  0,  0, 34,  0, 18,  0,  0,  0,
+ 20,  0,  0,  0,  0,  0, 34,  0, 16,  0,  0,  0, 18,  0,  0,  0,  0,  0, 34,  0, 12,  0,  0,  0, 21,  0,  0,  0,  0,  0, 34,  0,
+ 19,  0,  0,  0, 21,  0,  0,  0,  0,  0, 34,  0, 20,  0,  0,  0, 22,  0,  0,  0,  0,  0, 34,  0, 13,  0,  0,  0, 22,  0,  0,  0,
+  0,  0, 34,  0, 21,  0,  0,  0, 23,  0,  0,  0,  0,  0, 34,  0, 23,  0,  0,  0, 25,  0,  0,  0,  0,  0, 34,  0, 19,  0,  0,  0,
+ 25,  0,  0,  0,  0,  0, 34,  0, 24,  0,  0,  0, 26,  0,  0,  0,  0,  0, 34,  0, 22,  0,  0,  0, 24,  0,  0,  0,  0,  0, 34,  0,
+ 20,  0,  0,  0, 26,  0,  0,  0,  0,  0, 34,  0, 25,  0,  0,  0, 27,  0,  0,  0,  0,  0, 34,  0, 17,  0,  0,  0, 27,  0,  0,  0,
+  0,  0, 34,  0, 26,  0,  0,  0, 28,  0,  0,  0,  0,  0, 34,  0, 18,  0,  0,  0, 28,  0,  0,  0,  0,  0, 34,  0, 25,  0,  0,  0,
+ 31,  0,  0,  0,  0,  0, 34,  0, 29,  0,  0,  0, 31,  0,  0,  0,  0,  0, 34,  0, 27,  0,  0,  0, 29,  0,  0,  0,  0,  0, 34,  0,
+ 30,  0,  0,  0, 32,  0,  0,  0,  0,  0, 34,  0, 26,  0,  0,  0, 32,  0,  0,  0,  0,  0, 34,  0, 28,  0,  0,  0, 30,  0,  0,  0,
+  0,  0, 34,  0, 23,  0,  0,  0, 33,  0,  0,  0,  0,  0, 34,  0, 31,  0,  0,  0, 33,  0,  0,  0,  0,  0, 34,  0, 32,  0,  0,  0,
+ 34,  0,  0,  0,  0,  0, 34,  0, 24,  0,  0,  0, 34,  0,  0,  0,  0,  0, 34,  0, 33,  0,  0,  0, 35,  0,  0,  0,  0,  0, 34,  0,
+ 35,  0,  0,  0, 37,  0,  0,  0,  0,  0, 34,  0, 31,  0,  0,  0, 37,  0,  0,  0,  0,  0, 34,  0, 36,  0,  0,  0, 38,  0,  0,  0,
+  0,  0, 34,  0, 34,  0,  0,  0, 36,  0,  0,  0,  0,  0, 34,  0, 32,  0,  0,  0, 38,  0,  0,  0,  0,  0, 34,  0, 37,  0,  0,  0,
+ 39,  0,  0,  0,  0,  0, 34,  0, 29,  0,  0,  0, 39,  0,  0,  0,  0,  0, 34,  0, 38,  0,  0,  0, 40,  0,  0,  0,  0,  0, 34,  0,
+ 30,  0,  0,  0, 40,  0,  0,  0,  0,  0, 34,  0, 37,  0,  0,  0, 43,  0,  0,  0,  0,  0, 34,  0, 39,  0,  0,  0, 41,  0,  0,  0,
+  0,  0, 34,  0, 38,  0,  0,  0, 44,  0,  0,  0,  0,  0, 34,  0, 40,  0,  0,  0, 42,  0,  0,  0,  0,  0, 34,  0, 35,  0,  0,  0,
+ 45,  0,  0,  0,  0,  0, 34,  0, 36,  0,  0,  0, 46,  0,  0,  0,  0,  0, 34,  0, 35,  0,  0,  0, 49,  0,  0,  0,  0,  0, 34,  0,
+ 47,  0,  0,  0, 49,  0,  0,  0,  0,  0, 34,  0, 45,  0,  0,  0, 47,  0,  0,  0,  0,  0, 34,  0, 36,  0,  0,  0, 50,  0,  0,  0,
+  0,  0, 34,  0, 46,  0,  0,  0, 48,  0,  0,  0,  0,  0, 34,  0, 48,  0,  0,  0, 50,  0,  0,  0,  0,  0, 34,  0, 33,  0,  0,  0,
+ 51,  0,  0,  0,  0,  0, 34,  0, 49,  0,  0,  0, 51,  0,  0,  0,  0,  0, 34,  0, 34,  0,  0,  0, 52,  0,  0,  0,  0,  0, 34,  0,
+ 50,  0,  0,  0, 52,  0,  0,  0,  0,  0, 34,  0, 23,  0,  0,  0, 53,  0,  0,  0,  0,  0, 34,  0, 51,  0,  0,  0, 53,  0,  0,  0,
+  0,  0, 34,  0, 24,  0,  0,  0, 54,  0,  0,  0,  0,  0, 34,  0, 52,  0,  0,  0, 54,  0,  0,  0,  0,  0, 34,  0, 21,  0,  0,  0,
+ 55,  0,  0,  0,  0,  0, 34,  0, 53,  0,  0,  0, 55,  0,  0,  0,  0,  0, 34,  0, 22,  0,  0,  0, 56,  0,  0,  0,  0,  0, 34,  0,
+ 54,  0,  0,  0, 56,  0,  0,  0,  0,  0, 34,  0, 12,  0,  0,  0, 57,  0,  0,  0,  0,  0, 34,  0, 55,  0,  0,  0, 57,  0,  0,  0,
+  0,  0, 34,  0, 13,  0,  0,  0, 58,  0,  0,  0,  0,  0, 34,  0, 56,  0,  0,  0, 58,  0,  0,  0,  0,  0, 34,  0, 10,  0,  0,  0,
+ 61,  0,  0,  0,  0,  0, 34,  0, 57,  0,  0,  0, 61,  0,  0,  0,  0,  0, 34,  0, 11,  0,  0,  0, 62,  0,  0,  0,  0,  0, 34,  0,
+ 58,  0,  0,  0, 62,  0,  0,  0,  0,  0, 34,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,  0, 34,  0, 61,  0,  0,  0, 63,  0,  0,  0,
+  0,  0, 34,  0,  1,  0,  0,  0, 64,  0,  0,  0,  0,  0, 34,  0, 62,  0,  0,  0, 64,  0,  0,  0,  0,  0, 34,  0, 47,  0,  0,  0,
+ 63,  0,  0,  0,  0,  0, 34,  0, 48,  0,  0,  0, 64,  0,  0,  0,  0,  0, 34,  0, 59,  0,  0,  0, 63,  0,  0,  0,  0,  0, 34,  0,
+ 47,  0,  0,  0, 59,  0,  0,  0,  0,  0, 34,  0, 60,  0,  0,  0, 64,  0,  0,  0,  0,  0, 34,  0, 48,  0,  0,  0, 60,  0,  0,  0,
+  0,  0, 34,  0, 59,  0,  0,  0, 61,  0,  0,  0,  0,  0, 34,  0, 60,  0,  0,  0, 62,  0,  0,  0,  0,  0, 34,  0, 57,  0,  0,  0,
+ 59,  0,  0,  0,  0,  0, 34,  0, 58,  0,  0,  0, 60,  0,  0,  0,  0,  0, 34,  0, 55,  0,  0,  0, 59,  0,  0,  0,  0,  0, 34,  0,
+ 56,  0,  0,  0, 60,  0,  0,  0,  0,  0, 34,  0, 53,  0,  0,  0, 59,  0,  0,  0,  0,  0, 34,  0, 54,  0,  0,  0, 60,  0,  0,  0,
+  0,  0, 34,  0, 51,  0,  0,  0, 59,  0,  0,  0,  0,  0, 34,  0, 52,  0,  0,  0, 60,  0,  0,  0,  0,  0, 34,  0, 49,  0,  0,  0,
+ 59,  0,  0,  0,  0,  0, 34,  0, 50,  0,  0,  0, 60,  0,  0,  0,  0,  0, 34,  0, 87,  0,  0,  0,171,  0,  0,  0,  0,  0, 34,  0,
+171,  0,  0,  0,173,  0,  0,  0,  0,  0, 34,  0, 89,  0,  0,  0,173,  0,  0,  0,  0,  0, 34,  0, 87,  0,  0,  0, 89,  0,  0,  0,
+  0,  0, 34,  0,172,  0,  0,  0,173,  0,  0,  0,  0,  0, 34,  0, 88,  0,  0,  0,172,  0,  0,  0,  0,  0, 34,  0, 88,  0,  0,  0,
+ 89,  0,  0,  0,  0,  0, 34,  0, 85,  0,  0,  0,169,  0,  0,  0,  0,  0, 34,  0,169,  0,  0,  0,171,  0,  0,  0,  0,  0, 34,  0,
+ 85,  0,  0,  0, 87,  0,  0,  0,  0,  0, 34,  0,170,  0,  0,  0,172,  0,  0,  0,  0,  0, 34,  0, 86,  0,  0,  0,170,  0,  0,  0,
+  0,  0, 34,  0, 86,  0,  0,  0, 88,  0,  0,  0,  0,  0, 34,  0, 83,  0,  0,  0,167,  0,  0,  0,  0,  0, 34,  0,167,  0,  0,  0,
+169,  0,  0,  0,  0,  0, 34,  0, 83,  0,  0,  0, 85,  0,  0,  0,  0,  0, 34,  0,168,  0,  0,  0,170,  0,  0,  0,  0,  0, 34,  0,
+ 84,  0,  0,  0,168,  0,  0,  0,  0,  0, 34,  0, 84,  0,  0,  0, 86,  0,  0,  0,  0,  0, 34,  0, 81,  0,  0,  0,165,  0,  0,  0,
+  0,  0, 34,  0,165,  0,  0,  0,167,  0,  0,  0,  0,  0, 34,  0, 81,  0,  0,  0, 83,  0,  0,  0,  0,  0, 34,  0,166,  0,  0,  0,
+168,  0,  0,  0,  0,  0, 34,  0, 82,  0,  0,  0,166,  0,  0,  0,  0,  0, 34,  0, 82,  0,  0,  0, 84,  0,  0,  0,  0,  0, 34,  0,
+ 79,  0,  0,  0,163,  0,  0,  0,  0,  0, 34,  0,163,  0,  0,  0,165,  0,  0,  0,  0,  0, 34,  0, 79,  0,  0,  0, 81,  0,  0,  0,
+  0,  0, 34,  0,164,  0,  0,  0,166,  0,  0,  0,  0,  0, 34,  0, 80,  0,  0,  0,164,  0,  0,  0,  0,  0, 34,  0, 80,  0,  0,  0,
+ 82,  0,  0,  0,  0,  0, 34,  0, 77,  0,  0,  0, 90,  0,  0,  0,  0,  0, 34,  0, 90,  0,  0,  0,143,  0,  0,  0,  0,  0, 34,  0,
+143,  0,  0,  0,161,  0,  0,  0,  0,  0, 34,  0, 77,  0,  0,  0,161,  0,  0,  0,  0,  0, 34,  0, 91,  0,  0,  0,144,  0,  0,  0,
+  0,  0, 34,  0, 78,  0,  0,  0, 91,  0,  0,  0,  0,  0, 34,  0, 78,  0,  0,  0,162,  0,  0,  0,  0,  0, 34,  0,144,  0,  0,  0,
+162,  0,  0,  0,  0,  0, 34,  0, 90,  0,  0,  0, 92,  0,  0,  0,  0,  0, 34,  0, 92,  0,  0,  0,145,  0,  0,  0,  0,  0, 34,  0,
+143,  0,  0,  0,145,  0,  0,  0,  0,  0, 34,  0, 93,  0,  0,  0,146,  0,  0,  0,  0,  0, 34,  0, 91,  0,  0,  0, 93,  0,  0,  0,
+  0,  0, 34,  0,144,  0,  0,  0,146,  0,  0,  0,  0,  0, 34,  0, 92,  0,  0,  0, 94,  0,  0,  0,  0,  0, 34,  0, 94,  0,  0,  0,
+147,  0,  0,  0,  0,  0, 34,  0,145,  0,  0,  0,147,  0,  0,  0,  0,  0, 34,  0, 95,  0,  0,  0,148,  0,  0,  0,  0,  0, 34,  0,
+ 93,  0,  0,  0, 95,  0,  0,  0,  0,  0, 34,  0,146,  0,  0,  0,148,  0,  0,  0,  0,  0, 34,  0, 94,  0,  0,  0, 96,  0,  0,  0,
+  0,  0, 34,  0, 96,  0,  0,  0,149,  0,  0,  0,  0,  0, 34,  0,147,  0,  0,  0,149,  0,  0,  0,  0,  0, 34,  0, 97,  0,  0,  0,
+150,  0,  0,  0,  0,  0, 34,  0, 95,  0,  0,  0, 97,  0,  0,  0,  0,  0, 34,  0,148,  0,  0,  0,150,  0,  0,  0,  0,  0, 34,  0,
+ 96,  0,  0,  0, 98,  0,  0,  0,  0,  0, 34,  0, 98,  0,  0,  0,151,  0,  0,  0,  0,  0, 34,  0,149,  0,  0,  0,151,  0,  0,  0,
+  0,  0, 34,  0, 99,  0,  0,  0,152,  0,  0,  0,  0,  0, 34,  0, 97,  0,  0,  0, 99,  0,  0,  0,  0,  0, 34,  0,150,  0,  0,  0,
+152,  0,  0,  0,  0,  0, 34,  0, 98,  0,  0,  0,100,  0,  0,  0,  0,  0, 34,  0,100,  0,  0,  0,153,  0,  0,  0,  0,  0, 34,  0,
+151,  0,  0,  0,153,  0,  0,  0,  0,  0, 34,  0,101,  0,  0,  0,154,  0,  0,  0,  0,  0, 34,  0, 99,  0,  0,  0,101,  0,  0,  0,
+  0,  0, 34,  0,152,  0,  0,  0,154,  0,  0,  0,  0,  0, 34,  0,100,  0,  0,  0,102,  0,  0,  0,  0,  0, 34,  0,102,  0,  0,  0,
+155,  0,  0,  0,  0,  0, 34,  0,153,  0,  0,  0,155,  0,  0,  0,  0,  0, 34,  0,103,  0,  0,  0,156,  0,  0,  0,  0,  0, 34,  0,
+101,  0,  0,  0,103,  0,  0,  0,  0,  0, 34,  0,154,  0,  0,  0,156,  0,  0,  0,  0,  0, 34,  0,102,  0,  0,  0,104,  0,  0,  0,
+  0,  0, 34,  0,104,  0,  0,  0,157,  0,  0,  0,  0,  0, 34,  0,155,  0,  0,  0,157,  0,  0,  0,  0,  0, 34,  0,105,  0,  0,  0,
+158,  0,  0,  0,  0,  0, 34,  0,103,  0,  0,  0,105,  0,  0,  0,  0,  0, 34,  0,156,  0,  0,  0,158,  0,  0,  0,  0,  0, 34,  0,
+104,  0,  0,  0,106,  0,  0,  0,  0,  0, 34,  0,106,  0,  0,  0,159,  0,  0,  0,  0,  0, 34,  0,157,  0,  0,  0,159,  0,  0,  0,
+  0,  0, 34,  0,107,  0,  0,  0,160,  0,  0,  0,  0,  0, 34,  0,105,  0,  0,  0,107,  0,  0,  0,  0,  0, 34,  0,158,  0,  0,  0,
+160,  0,  0,  0,  0,  0, 34,  0, 65,  0,  0,  0,106,  0,  0,  0,  0,  0, 34,  0, 65,  0,  0,  0, 66,  0,  0,  0,  0,  0, 34,  0,
+ 66,  0,  0,  0,159,  0,  0,  0,  0,  0, 34,  0, 65,  0,  0,  0,107,  0,  0,  0,  0,  0, 34,  0, 66,  0,  0,  0,160,  0,  0,  0,
+  0,  0, 34,  0,108,  0,  0,  0,125,  0,  0,  0,  0,  0, 34,  0,125,  0,  0,  0,157,  0,  0,  0,  0,  0, 34,  0,108,  0,  0,  0,
+159,  0,  0,  0,  0,  0, 34,  0,126,  0,  0,  0,158,  0,  0,  0,  0,  0, 34,  0,109,  0,  0,  0,126,  0,  0,  0,  0,  0, 34,  0,
+109,  0,  0,  0,160,  0,  0,  0,  0,  0, 34,  0,125,  0,  0,  0,176,  0,  0,  0,  0,  0, 34,  0,155,  0,  0,  0,176,  0,  0,  0,
+  0,  0, 34,  0,156,  0,  0,  0,177,  0,  0,  0,  0,  0, 34,  0,126,  0,  0,  0,177,  0,  0,  0,  0,  0, 34,  0,123,  0,  0,  0,
+153,  0,  0,  0,  0,  0, 34,  0,123,  0,  0,  0,176,  0,  0,  0,  0,  0, 34,  0,124,  0,  0,  0,154,  0,  0,  0,  0,  0, 34,  0,
+124,  0,  0,  0,177,  0,  0,  0,  0,  0, 34,  0,121,  0,  0,  0,151,  0,  0,  0,  0,  0, 34,  0,121,  0,  0,  0,123,  0,  0,  0,
+  0,  0, 34,  0,122,  0,  0,  0,152,  0,  0,  0,  0,  0, 34,  0,122,  0,  0,  0,124,  0,  0,  0,  0,  0, 34,  0,119,  0,  0,  0,
+149,  0,  0,  0,  0,  0, 34,  0,119,  0,  0,  0,121,  0,  0,  0,  0,  0, 34,  0,120,  0,  0,  0,150,  0,  0,  0,  0,  0, 34,  0,
+120,  0,  0,  0,122,  0,  0,  0,  0,  0, 34,  0,117,  0,  0,  0,147,  0,  0,  0,  0,  0, 34,  0,117,  0,  0,  0,119,  0,  0,  0,
+  0,  0, 34,  0,118,  0,  0,  0,148,  0,  0,  0,  0,  0, 34,  0,118,  0,  0,  0,120,  0,  0,  0,  0,  0, 34,  0,115,  0,  0,  0,
+145,  0,  0,  0,  0,  0, 34,  0,115,  0,  0,  0,117,  0,  0,  0,  0,  0, 34,  0,116,  0,  0,  0,146,  0,  0,  0,  0,  0, 34,  0,
+116,  0,  0,  0,118,  0,  0,  0,  0,  0, 34,  0,113,  0,  0,  0,143,  0,  0,  0,  0,  0, 34,  0,113,  0,  0,  0,115,  0,  0,  0,
+  0,  0, 34,  0,114,  0,  0,  0,144,  0,  0,  0,  0,  0, 34,  0,114,  0,  0,  0,116,  0,  0,  0,  0,  0, 34,  0,112,  0,  0,  0,
+162,  0,  0,  0,  0,  0, 34,  0,112,  0,  0,  0,114,  0,  0,  0,  0,  0, 34,  0,174,  0,  0,  0,178,  0,  0,  0,  0,  0, 34,  0,
+161,  0,  0,  0,174,  0,  0,  0,  0,  0, 34,  0,174,  0,  0,  0,179,  0,  0,  0,  0,  0, 34,  0,112,  0,  0,  0,179,  0,  0,  0,
+  0,  0, 34,  0,162,  0,  0,  0,174,  0,  0,  0,  0,  0, 34,  0, 66,  0,  0,  0,110,  0,  0,  0,  0,  0, 34,  0,108,  0,  0,  0,
+110,  0,  0,  0,  0,  0, 34,  0,109,  0,  0,  0,111,  0,  0,  0,  0,  0, 34,  0, 66,  0,  0,  0,111,  0,  0,  0,  0,  0, 34,  0,
+ 66,  0,  0,  0,175,  0,  0,  0,  0,  0, 34,  0,175,  0,  0,  0,180,  0,  0,  0,  0,  0, 34,  0,110,  0,  0,  0,180,  0,  0,  0,
+  0,  0, 34,  0,111,  0,  0,  0,181,  0,  0,  0,  0,  0, 34,  0,175,  0,  0,  0,181,  0,  0,  0,  0,  0, 34,  0,178,  0,  0,  0,
+180,  0,  0,  0,  0,  0, 34,  0,174,  0,  0,  0,175,  0,  0,  0,  0,  0, 32,  0,179,  0,  0,  0,181,  0,  0,  0,  0,  0, 34,  0,
+132,  0,  0,  0,134,  0,  0,  0,  0,  0, 34,  0,134,  0,  0,  0,173,  0,  0,  0,  0,  0, 34,  0,132,  0,  0,  0,171,  0,  0,  0,
+  0,  0, 34,  0,133,  0,  0,  0,134,  0,  0,  0,  0,  0, 34,  0,133,  0,  0,  0,172,  0,  0,  0,  0,  0, 34,  0,130,  0,  0,  0,
+132,  0,  0,  0,  0,  0, 34,  0,130,  0,  0,  0,169,  0,  0,  0,  0,  0, 34,  0,131,  0,  0,  0,133,  0,  0,  0,  0,  0, 34,  0,
+131,  0,  0,  0,170,  0,  0,  0,  0,  0, 34,  0,128,  0,  0,  0,130,  0,  0,  0,  0,  0, 34,  0,128,  0,  0,  0,167,  0,  0,  0,
+  0,  0, 34,  0,129,  0,  0,  0,131,  0,  0,  0,  0,  0, 34,  0,129,  0,  0,  0,168,  0,  0,  0,  0,  0, 34,  0,163,  0,  0,  0,
+184,  0,  0,  0,  0,  0, 34,  0,182,  0,  0,  0,184,  0,  0,  0,  0,  0, 34,  0,165,  0,  0,  0,182,  0,  0,  0,  0,  0, 34,  0,
+183,  0,  0,  0,185,  0,  0,  0,  0,  0, 34,  0,164,  0,  0,  0,185,  0,  0,  0,  0,  0, 34,  0,166,  0,  0,  0,183,  0,  0,  0,
+  0,  0, 34,  0,128,  0,  0,  0,182,  0,  0,  0,  0,  0, 34,  0,129,  0,  0,  0,183,  0,  0,  0,  0,  0, 34,  0,141,  0,  0,  0,
+187,  0,  0,  0,  0,  0, 34,  0,186,  0,  0,  0,187,  0,  0,  0,  0,  0, 32,  0,184,  0,  0,  0,186,  0,  0,  0,  0,  0, 34,  0,
+141,  0,  0,  0,184,  0,  0,  0,  0,  0, 34,  0,142,  0,  0,  0,187,  0,  0,  0,  0,  0, 34,  0,142,  0,  0,  0,185,  0,  0,  0,
+  0,  0, 34,  0,185,  0,  0,  0,186,  0,  0,  0,  0,  0, 34,  0, 67,  0,  0,  0,186,  0,  0,  0,  0,  0, 32,  0, 67,  0,  0,  0,
+182,  0,  0,  0,  0,  0, 34,  0, 67,  0,  0,  0,183,  0,  0,  0,  0,  0, 34,  0,127,  0,  0,  0,128,  0,  0,  0,  0,  0, 34,  0,
+ 67,  0,  0,  0,127,  0,  0,  0,  0,  0, 32,  0,127,  0,  0,  0,129,  0,  0,  0,  0,  0, 34,  0,139,  0,  0,  0,190,  0,  0,  0,
+  0,  0, 34,  0,188,  0,  0,  0,190,  0,  0,  0,  0,  0, 34,  0,141,  0,  0,  0,188,  0,  0,  0,  0,  0, 34,  0,139,  0,  0,  0,
+141,  0,  0,  0,  0,  0, 34,  0,189,  0,  0,  0,191,  0,  0,  0,  0,  0, 34,  0,140,  0,  0,  0,191,  0,  0,  0,  0,  0, 34,  0,
+140,  0,  0,  0,142,  0,  0,  0,  0,  0, 34,  0,142,  0,  0,  0,189,  0,  0,  0,  0,  0, 34,  0,137,  0,  0,  0,192,  0,  0,  0,
+  0,  0, 34,  0,190,  0,  0,  0,192,  0,  0,  0,  0,  0, 34,  0,137,  0,  0,  0,139,  0,  0,  0,  0,  0, 34,  0,191,  0,  0,  0,
+193,  0,  0,  0,  0,  0, 34,  0,138,  0,  0,  0,193,  0,  0,  0,  0,  0, 34,  0,138,  0,  0,  0,140,  0,  0,  0,  0,  0, 34,  0,
+136,  0,  0,  0,194,  0,  0,  0,  0,  0, 34,  0,192,  0,  0,  0,194,  0,  0,  0,  0,  0, 34,  0,136,  0,  0,  0,137,  0,  0,  0,
+  0,  0, 34,  0,193,  0,  0,  0,195,  0,  0,  0,  0,  0, 34,  0,136,  0,  0,  0,195,  0,  0,  0,  0,  0, 34,  0,136,  0,  0,  0,
+138,  0,  0,  0,  0,  0, 34,  0, 69,  0,  0,  0,135,  0,  0,  0,  0,  0, 34,  0, 69,  0,  0,  0,194,  0,  0,  0,  0,  0, 34,  0,
+135,  0,  0,  0,136,  0,  0,  0,  0,  0, 34,  0, 69,  0,  0,  0,195,  0,  0,  0,  0,  0, 34,  0, 68,  0,  0,  0,188,  0,  0,  0,
+  0,  0, 34,  0, 68,  0,  0,  0,187,  0,  0,  0,  0,  0, 34,  0, 68,  0,  0,  0,189,  0,  0,  0,  0,  0, 34,  0,188,  0,  0,  0,
+203,  0,  0,  0,  0,  0, 34,  0,203,  0,  0,  0,205,  0,  0,  0,  0,  0, 34,  0, 68,  0,  0,  0,205,  0,  0,  0,  0,  0, 34,  0,
+189,  0,  0,  0,204,  0,  0,  0,  0,  0, 34,  0,204,  0,  0,  0,205,  0,  0,  0,  0,  0, 34,  0, 69,  0,  0,  0,196,  0,  0,  0,
+  0,  0, 34,  0,196,  0,  0,  0,197,  0,  0,  0,  0,  0, 34,  0,194,  0,  0,  0,197,  0,  0,  0,  0,  0, 34,  0,196,  0,  0,  0,
+198,  0,  0,  0,  0,  0, 34,  0,195,  0,  0,  0,198,  0,  0,  0,  0,  0, 34,  0,197,  0,  0,  0,199,  0,  0,  0,  0,  0, 34,  0,
+192,  0,  0,  0,199,  0,  0,  0,  0,  0, 34,  0,198,  0,  0,  0,200,  0,  0,  0,  0,  0, 34,  0,193,  0,  0,  0,200,  0,  0,  0,
+  0,  0, 34,  0,199,  0,  0,  0,201,  0,  0,  0,  0,  0, 34,  0,190,  0,  0,  0,201,  0,  0,  0,  0,  0, 34,  0,200,  0,  0,  0,
+202,  0,  0,  0,  0,  0, 34,  0,191,  0,  0,  0,202,  0,  0,  0,  0,  0, 34,  0,201,  0,  0,  0,203,  0,  0,  0,  0,  0, 34,  0,
+202,  0,  0,  0,204,  0,  0,  0,  0,  0, 34,  0,196,  0,  0,  0,201,  0,  0,  0,  0,  0, 34,  0,196,  0,  0,  0,202,  0,  0,  0,
+  0,  0, 34,  0,196,  0,  0,  0,205,  0,  0,  0,  0,  0, 34,  0,137,  0,  0,  0,161,  0,  0,  0,  0,  0, 34,  0,136,  0,  0,  0,
+174,  0,  0,  0,  0,  0, 34,  0,138,  0,  0,  0,162,  0,  0,  0,  0,  0, 34,  0,139,  0,  0,  0,208,  0,  0,  0,  0,  0, 34,  0,
+161,  0,  0,  0,208,  0,  0,  0,  0,  0, 34,  0,140,  0,  0,  0,209,  0,  0,  0,  0,  0, 34,  0,162,  0,  0,  0,209,  0,  0,  0,
+  0,  0, 34,  0,141,  0,  0,  0,210,  0,  0,  0,  0,  0, 34,  0,208,  0,  0,  0,210,  0,  0,  0,  0,  0, 34,  0,142,  0,  0,  0,
+211,  0,  0,  0,  0,  0, 34,  0,209,  0,  0,  0,211,  0,  0,  0,  0,  0, 34,  0,163,  0,  0,  0,210,  0,  0,  0,  0,  0, 34,  0,
+164,  0,  0,  0,211,  0,  0,  0,  0,  0, 34,  0, 79,  0,  0,  0,206,  0,  0,  0,  0,  0, 34,  0,206,  0,  0,  0,210,  0,  0,  0,
+  0,  0, 34,  0,207,  0,  0,  0,211,  0,  0,  0,  0,  0, 34,  0, 80,  0,  0,  0,207,  0,  0,  0,  0,  0, 34,  0,206,  0,  0,  0,
+212,  0,  0,  0,  0,  0, 34,  0,208,  0,  0,  0,212,  0,  0,  0,  0,  0, 34,  0,209,  0,  0,  0,213,  0,  0,  0,  0,  0, 34,  0,
+207,  0,  0,  0,213,  0,  0,  0,  0,  0, 34,  0, 77,  0,  0,  0,212,  0,  0,  0,  0,  0, 34,  0, 78,  0,  0,  0,213,  0,  0,  0,
+  0,  0, 34,  0, 70,  0,  0,  0,127,  0,  0,  0,  0,  0, 34,  0, 70,  0,  0,  0,219,  0,  0,  0,  0,  0, 34,  0,128,  0,  0,  0,
+219,  0,  0,  0,  0,  0, 34,  0,129,  0,  0,  0,220,  0,  0,  0,  0,  0, 34,  0, 70,  0,  0,  0,220,  0,  0,  0,  0,  0, 34,  0,
+217,  0,  0,  0,219,  0,  0,  0,  0,  0, 34,  0,130,  0,  0,  0,217,  0,  0,  0,  0,  0, 34,  0,131,  0,  0,  0,218,  0,  0,  0,
+  0,  0, 34,  0,218,  0,  0,  0,220,  0,  0,  0,  0,  0, 34,  0,215,  0,  0,  0,217,  0,  0,  0,  0,  0, 34,  0,132,  0,  0,  0,
+215,  0,  0,  0,  0,  0, 34,  0,133,  0,  0,  0,216,  0,  0,  0,  0,  0, 34,  0,216,  0,  0,  0,218,  0,  0,  0,  0,  0, 34,  0,
+214,  0,  0,  0,215,  0,  0,  0,  0,  0, 34,  0,134,  0,  0,  0,214,  0,  0,  0,  0,  0, 34,  0,214,  0,  0,  0,216,  0,  0,  0,
+  0,  0, 34,  0,215,  0,  0,  0,226,  0,  0,  0,  0,  0, 34,  0,226,  0,  0,  0,228,  0,  0,  0,  0,  0, 34,  0,214,  0,  0,  0,
+228,  0,  0,  0,  0,  0, 34,  0,216,  0,  0,  0,227,  0,  0,  0,  0,  0, 34,  0,227,  0,  0,  0,228,  0,  0,  0,  0,  0, 34,  0,
+217,  0,  0,  0,224,  0,  0,  0,  0,  0, 34,  0,224,  0,  0,  0,226,  0,  0,  0,  0,  0, 34,  0,218,  0,  0,  0,225,  0,  0,  0,
+  0,  0, 34,  0,225,  0,  0,  0,227,  0,  0,  0,  0,  0, 34,  0,219,  0,  0,  0,222,  0,  0,  0,  0,  0, 34,  0,222,  0,  0,  0,
+224,  0,  0,  0,  0,  0, 34,  0,220,  0,  0,  0,223,  0,  0,  0,  0,  0, 34,  0,223,  0,  0,  0,225,  0,  0,  0,  0,  0, 34,  0,
+ 70,  0,  0,  0,221,  0,  0,  0,  0,  0, 34,  0,221,  0,  0,  0,222,  0,  0,  0,  0,  0, 34,  0,221,  0,  0,  0,223,  0,  0,  0,
+  0,  0, 34,  0,221,  0,  0,  0,228,  0,  0,  0,  0,  0, 34,  0,222,  0,  0,  0,226,  0,  0,  0,  0,  0, 34,  0,223,  0,  0,  0,
+227,  0,  0,  0,  0,  0, 34,  0,178,  0,  0,  0,231,  0,  0,  0,  0,  0, 34,  0,229,  0,  0,  0,231,  0,  0,  0,  0,  0, 34,  0,
+180,  0,  0,  0,229,  0,  0,  0,  0,  0, 34,  0,179,  0,  0,  0,232,  0,  0,  0,  0,  0, 34,  0,181,  0,  0,  0,230,  0,  0,  0,
+  0,  0, 34,  0,230,  0,  0,  0,232,  0,  0,  0,  0,  0, 34,  0,229,  0,  0,  0,251,  0,  0,  0,  0,  0, 34,  0,110,  0,  0,  0,
+251,  0,  0,  0,  0,  0, 34,  0,111,  0,  0,  0,252,  0,  0,  0,  0,  0, 34,  0,230,  0,  0,  0,252,  0,  0,  0,  0,  0, 34,  0,
+251,  0,  0,  0,253,  0,  0,  0,  0,  0, 34,  0,108,  0,  0,  0,253,  0,  0,  0,  0,  0, 34,  0,109,  0,  0,  0,254,  0,  0,  0,
+  0,  0, 34,  0,252,  0,  0,  0,254,  0,  0,  0,  0,  0, 34,  0,231,  0,  0,  0,249,  0,  0,  0,  0,  0, 34,  0,112,  0,  0,  0,
+250,  0,  0,  0,  0,  0, 34,  0,232,  0,  0,  0,250,  0,  0,  0,  0,  0, 34,  0,113,  0,  0,  0,247,  0,  0,  0,  0,  0, 34,  0,
+247,  0,  0,  0,249,  0,  0,  0,  0,  0, 34,  0,114,  0,  0,  0,248,  0,  0,  0,  0,  0, 34,  0,248,  0,  0,  0,250,  0,  0,  0,
+  0,  0, 34,  0,115,  0,  0,  0,245,  0,  0,  0,  0,  0, 34,  0,245,  0,  0,  0,247,  0,  0,  0,  0,  0, 34,  0,116,  0,  0,  0,
+246,  0,  0,  0,  0,  0, 34,  0,246,  0,  0,  0,248,  0,  0,  0,  0,  0, 34,  0,117,  0,  0,  0,243,  0,  0,  0,  0,  0, 34,  0,
+243,  0,  0,  0,245,  0,  0,  0,  0,  0, 34,  0,118,  0,  0,  0,244,  0,  0,  0,  0,  0, 34,  0,244,  0,  0,  0,246,  0,  0,  0,
+  0,  0, 34,  0,119,  0,  0,  0,241,  0,  0,  0,  0,  0, 34,  0,241,  0,  0,  0,243,  0,  0,  0,  0,  0, 34,  0,120,  0,  0,  0,
+242,  0,  0,  0,  0,  0, 34,  0,242,  0,  0,  0,244,  0,  0,  0,  0,  0, 34,  0,121,  0,  0,  0,239,  0,  0,  0,  0,  0, 34,  0,
+239,  0,  0,  0,241,  0,  0,  0,  0,  0, 34,  0,122,  0,  0,  0,240,  0,  0,  0,  0,  0, 34,  0,240,  0,  0,  0,242,  0,  0,  0,
+  0,  0, 34,  0,123,  0,  0,  0,237,  0,  0,  0,  0,  0, 34,  0,237,  0,  0,  0,239,  0,  0,  0,  0,  0, 34,  0,124,  0,  0,  0,
+238,  0,  0,  0,  0,  0, 34,  0,238,  0,  0,  0,240,  0,  0,  0,  0,  0, 34,  0,176,  0,  0,  0,233,  0,  0,  0,  0,  0, 34,  0,
+233,  0,  0,  0,237,  0,  0,  0,  0,  0, 34,  0,177,  0,  0,  0,234,  0,  0,  0,  0,  0, 34,  0,234,  0,  0,  0,238,  0,  0,  0,
+  0,  0, 34,  0,125,  0,  0,  0,235,  0,  0,  0,  0,  0, 34,  0,233,  0,  0,  0,235,  0,  0,  0,  0,  0, 34,  0,126,  0,  0,  0,
+236,  0,  0,  0,  0,  0, 34,  0,234,  0,  0,  0,236,  0,  0,  0,  0,  0, 34,  0,235,  0,  0,  0,253,  0,  0,  0,  0,  0, 34,  0,
+236,  0,  0,  0,254,  0,  0,  0,  0,  0, 34,  0,253,  0,  0,  0,255,  0,  0,  0,  0,  0, 34,  0,255,  0,  0,  0, 17,  1,  0,  0,
+  0,  0, 34,  0,235,  0,  0,  0, 17,  1,  0,  0,  0,  0, 34,  0,254,  0,  0,  0,  0,  1,  0,  0,  0,  0, 34,  0,236,  0,  0,  0,
+ 18,  1,  0,  0,  0,  0, 34,  0,  0,  1,  0,  0, 18,  1,  0,  0,  0,  0, 34,  0, 17,  1,  0,  0, 19,  1,  0,  0,  0,  0, 34,  0,
+233,  0,  0,  0, 19,  1,  0,  0,  0,  0, 34,  0,234,  0,  0,  0, 20,  1,  0,  0,  0,  0, 34,  0, 18,  1,  0,  0, 20,  1,  0,  0,
+  0,  0, 34,  0, 15,  1,  0,  0, 19,  1,  0,  0,  0,  0, 34,  0,237,  0,  0,  0, 15,  1,  0,  0,  0,  0, 34,  0,238,  0,  0,  0,
+ 16,  1,  0,  0,  0,  0, 34,  0, 16,  1,  0,  0, 20,  1,  0,  0,  0,  0, 34,  0, 13,  1,  0,  0, 15,  1,  0,  0,  0,  0, 34,  0,
+239,  0,  0,  0, 13,  1,  0,  0,  0,  0, 34,  0,240,  0,  0,  0, 14,  1,  0,  0,  0,  0, 34,  0, 14,  1,  0,  0, 16,  1,  0,  0,
+  0,  0, 34,  0, 11,  1,  0,  0, 13,  1,  0,  0,  0,  0, 34,  0,241,  0,  0,  0, 11,  1,  0,  0,  0,  0, 34,  0,242,  0,  0,  0,
+ 12,  1,  0,  0,  0,  0, 34,  0, 12,  1,  0,  0, 14,  1,  0,  0,  0,  0, 34,  0,  9,  1,  0,  0, 11,  1,  0,  0,  0,  0, 34,  0,
+243,  0,  0,  0,  9,  1,  0,  0,  0,  0, 34,  0,244,  0,  0,  0, 10,  1,  0,  0,  0,  0, 34,  0, 10,  1,  0,  0, 12,  1,  0,  0,
+  0,  0, 34,  0,  7,  1,  0,  0,  9,  1,  0,  0,  0,  0, 34,  0,245,  0,  0,  0,  7,  1,  0,  0,  0,  0, 34,  0,246,  0,  0,  0,
+  8,  1,  0,  0,  0,  0, 34,  0,  8,  1,  0,  0, 10,  1,  0,  0,  0,  0, 34,  0,  5,  1,  0,  0,  7,  1,  0,  0,  0,  0, 34,  0,
+247,  0,  0,  0,  5,  1,  0,  0,  0,  0, 34,  0,248,  0,  0,  0,  6,  1,  0,  0,  0,  0, 34,  0,  6,  1,  0,  0,  8,  1,  0,  0,
+  0,  0, 34,  0,  3,  1,  0,  0,  5,  1,  0,  0,  0,  0, 34,  0,249,  0,  0,  0,  3,  1,  0,  0,  0,  0, 34,  0,250,  0,  0,  0,
+  4,  1,  0,  0,  0,  0, 34,  0,  4,  1,  0,  0,  6,  1,  0,  0,  0,  0, 34,  0,  3,  1,  0,  0, 21,  1,  0,  0,  0,  0, 34,  0,
+231,  0,  0,  0, 21,  1,  0,  0,  0,  0, 34,  0,232,  0,  0,  0, 22,  1,  0,  0,  0,  0, 34,  0,  4,  1,  0,  0, 22,  1,  0,  0,
+  0,  0, 34,  0,251,  0,  0,  0,  1,  1,  0,  0,  0,  0, 34,  0,255,  0,  0,  0,  1,  1,  0,  0,  0,  0, 34,  0,252,  0,  0,  0,
+  2,  1,  0,  0,  0,  0, 34,  0,  0,  1,  0,  0,  2,  1,  0,  0,  0,  0, 34,  0,229,  0,  0,  0, 23,  1,  0,  0,  0,  0, 34,  0,
+  1,  1,  0,  0, 23,  1,  0,  0,  0,  0, 34,  0,230,  0,  0,  0, 24,  1,  0,  0,  0,  0, 34,  0,  2,  1,  0,  0, 24,  1,  0,  0,
+  0,  0, 34,  0, 21,  1,  0,  0, 23,  1,  0,  0,  0,  0, 34,  0, 22,  1,  0,  0, 24,  1,  0,  0,  0,  0, 34,  0,106,  0,  0,  0,
+ 25,  1,  0,  0,  0,  0, 34,  0, 71,  0,  0,  0, 25,  1,  0,  0,  0,  0, 38,  0, 65,  0,  0,  0, 71,  0,  0,  0,  0,  0, 34,  0,
+107,  0,  0,  0, 26,  1,  0,  0,  0,  0, 34,  0, 71,  0,  0,  0, 26,  1,  0,  0,  0,  0, 38,  0,104,  0,  0,  0, 27,  1,  0,  0,
+  0,  0, 34,  0, 25,  1,  0,  0, 27,  1,  0,  0,  0,  0, 34,  0,105,  0,  0,  0, 28,  1,  0,  0,  0,  0, 34,  0, 26,  1,  0,  0,
+ 28,  1,  0,  0,  0,  0, 34,  0,102,  0,  0,  0, 29,  1,  0,  0,  0,  0, 34,  0, 27,  1,  0,  0, 29,  1,  0,  0,  0,  0, 34,  0,
+103,  0,  0,  0, 30,  1,  0,  0,  0,  0, 34,  0, 28,  1,  0,  0, 30,  1,  0,  0,  0,  0, 34,  0,100,  0,  0,  0, 31,  1,  0,  0,
+  0,  0, 34,  0, 29,  1,  0,  0, 31,  1,  0,  0,  0,  0, 34,  0,101,  0,  0,  0, 32,  1,  0,  0,  0,  0, 34,  0, 30,  1,  0,  0,
+ 32,  1,  0,  0,  0,  0, 34,  0, 98,  0,  0,  0, 33,  1,  0,  0,  0,  0, 34,  0, 31,  1,  0,  0, 33,  1,  0,  0,  0,  0, 38,  0,
+ 99,  0,  0,  0, 34,  1,  0,  0,  0,  0, 34,  0, 32,  1,  0,  0, 34,  1,  0,  0,  0,  0, 38,  0, 96,  0,  0,  0, 35,  1,  0,  0,
+  0,  0, 34,  0, 33,  1,  0,  0, 35,  1,  0,  0,  0,  0, 34,  0, 97,  0,  0,  0, 36,  1,  0,  0,  0,  0, 34,  0, 34,  1,  0,  0,
+ 36,  1,  0,  0,  0,  0, 34,  0, 94,  0,  0,  0, 37,  1,  0,  0,  0,  0, 34,  0, 35,  1,  0,  0, 37,  1,  0,  0,  0,  0, 34,  0,
+ 95,  0,  0,  0, 38,  1,  0,  0,  0,  0, 34,  0, 36,  1,  0,  0, 38,  1,  0,  0,  0,  0, 34,  0, 92,  0,  0,  0, 39,  1,  0,  0,
+  0,  0, 34,  0, 37,  1,  0,  0, 39,  1,  0,  0,  0,  0, 34,  0, 93,  0,  0,  0, 40,  1,  0,  0,  0,  0, 34,  0, 38,  1,  0,  0,
+ 40,  1,  0,  0,  0,  0, 34,  0, 90,  0,  0,  0, 41,  1,  0,  0,  0,  0, 34,  0, 39,  1,  0,  0, 41,  1,  0,  0,  0,  0, 34,  0,
+ 91,  0,  0,  0, 42,  1,  0,  0,  0,  0, 34,  0, 40,  1,  0,  0, 42,  1,  0,  0,  0,  0, 34,  0, 49,  1,  0,  0, 50,  1,  0,  0,
+  0,  0, 38,  0, 50,  1,  0,  0, 69,  1,  0,  0,  0,  0, 34,  0, 69,  1,  0,  0, 79,  1,  0,  0,  0,  0, 34,  0, 49,  1,  0,  0,
+ 79,  1,  0,  0,  0,  0, 34,  0, 50,  1,  0,  0, 70,  1,  0,  0,  0,  0, 34,  0, 49,  1,  0,  0, 80,  1,  0,  0,  0,  0, 34,  0,
+ 70,  1,  0,  0, 80,  1,  0,  0,  0,  0, 34,  0, 48,  1,  0,  0, 49,  1,  0,  0,  0,  0, 38,  0, 77,  1,  0,  0, 79,  1,  0,  0,
+  0,  0, 34,  0, 48,  1,  0,  0, 77,  1,  0,  0,  0,  0, 34,  0, 48,  1,  0,  0, 78,  1,  0,  0,  0,  0, 34,  0, 78,  1,  0,  0,
+ 80,  1,  0,  0,  0,  0, 34,  0, 47,  1,  0,  0, 48,  1,  0,  0,  0,  0, 38,  0, 77,  1,  0,  0, 81,  1,  0,  0,  0,  0, 34,  0,
+ 47,  1,  0,  0, 81,  1,  0,  0,  0,  0, 34,  0, 47,  1,  0,  0, 82,  1,  0,  0,  0,  0, 34,  0, 78,  1,  0,  0, 82,  1,  0,  0,
+  0,  0, 34,  0, 89,  0,  0,  0, 47,  1,  0,  0,  0,  0, 38,  0, 87,  0,  0,  0, 81,  1,  0,  0,  0,  0, 34,  0, 88,  0,  0,  0,
+ 82,  1,  0,  0,  0,  0, 34,  0, 75,  1,  0,  0, 81,  1,  0,  0,  0,  0, 34,  0, 85,  0,  0,  0, 75,  1,  0,  0,  0,  0, 34,  0,
+ 86,  0,  0,  0, 76,  1,  0,  0,  0,  0, 34,  0, 76,  1,  0,  0, 82,  1,  0,  0,  0,  0, 34,  0, 71,  1,  0,  0, 75,  1,  0,  0,
+  0,  0, 34,  0, 83,  0,  0,  0, 71,  1,  0,  0,  0,  0, 34,  0, 84,  0,  0,  0, 72,  1,  0,  0,  0,  0, 34,  0, 72,  1,  0,  0,
+ 76,  1,  0,  0,  0,  0, 34,  0, 71,  1,  0,  0, 73,  1,  0,  0,  0,  0, 34,  0, 81,  0,  0,  0, 73,  1,  0,  0,  0,  0, 34,  0,
+ 82,  0,  0,  0, 74,  1,  0,  0,  0,  0, 34,  0, 72,  1,  0,  0, 74,  1,  0,  0,  0,  0, 34,  0, 71,  1,  0,  0, 77,  1,  0,  0,
+  0,  0, 34,  0, 73,  1,  0,  0, 79,  1,  0,  0,  0,  0, 34,  0, 72,  1,  0,  0, 78,  1,  0,  0,  0,  0, 34,  0, 74,  1,  0,  0,
+ 80,  1,  0,  0,  0,  0, 34,  0, 67,  1,  0,  0, 73,  1,  0,  0,  0,  0, 34,  0, 67,  1,  0,  0, 69,  1,  0,  0,  0,  0, 34,  0,
+ 68,  1,  0,  0, 74,  1,  0,  0,  0,  0, 34,  0, 68,  1,  0,  0, 70,  1,  0,  0,  0,  0, 34,  0, 79,  0,  0,  0, 67,  1,  0,  0,
+  0,  0, 34,  0, 80,  0,  0,  0, 68,  1,  0,  0,  0,  0, 34,  0,206,  0,  0,  0, 83,  1,  0,  0,  0,  0, 34,  0, 83,  1,  0,  0,
+ 85,  1,  0,  0,  0,  0, 34,  0,212,  0,  0,  0, 85,  1,  0,  0,  0,  0, 34,  0, 84,  1,  0,  0, 86,  1,  0,  0,  0,  0, 34,  0,
+207,  0,  0,  0, 84,  1,  0,  0,  0,  0, 34,  0,213,  0,  0,  0, 86,  1,  0,  0,  0,  0, 34,  0, 67,  1,  0,  0, 83,  1,  0,  0,
+  0,  0, 34,  0, 68,  1,  0,  0, 84,  1,  0,  0,  0,  0, 34,  0, 85,  1,  0,  0, 87,  1,  0,  0,  0,  0, 34,  0, 77,  0,  0,  0,
+ 87,  1,  0,  0,  0,  0, 34,  0, 78,  0,  0,  0, 88,  1,  0,  0,  0,  0, 34,  0, 86,  1,  0,  0, 88,  1,  0,  0,  0,  0, 34,  0,
+ 41,  1,  0,  0, 87,  1,  0,  0,  0,  0, 34,  0, 42,  1,  0,  0, 88,  1,  0,  0,  0,  0, 34,  0, 75,  0,  0,  0, 65,  1,  0,  0,
+  0,  0, 34,  0, 65,  1,  0,  0, 93,  1,  0,  0,  0,  0, 34,  0, 45,  1,  0,  0, 93,  1,  0,  0,  0,  0, 39,  0, 75,  0,  0,  0,
+ 45,  1,  0,  0,  0,  0, 38,  0, 66,  1,  0,  0, 94,  1,  0,  0,  0,  0, 34,  0, 75,  0,  0,  0, 66,  1,  0,  0,  0,  0, 34,  0,
+ 45,  1,  0,  0, 94,  1,  0,  0,  0,  0, 39,  0, 91,  1,  0,  0, 93,  1,  0,  0,  0,  0, 34,  0, 76,  0,  0,  0, 91,  1,  0,  0,
+  0,  0, 34,  0, 76,  0,  0,  0, 45,  1,  0,  0,  0,  0, 38,  0, 92,  1,  0,  0, 94,  1,  0,  0,  0,  0, 34,  0, 76,  0,  0,  0,
+ 92,  1,  0,  0,  0,  0, 34,  0, 89,  1,  0,  0, 91,  1,  0,  0,  0,  0, 34,  0, 46,  1,  0,  0, 89,  1,  0,  0,  0,  0, 34,  0,
+ 76,  0,  0,  0, 46,  1,  0,  0,  0,  0, 38,  0, 90,  1,  0,  0, 92,  1,  0,  0,  0,  0, 34,  0, 46,  1,  0,  0, 90,  1,  0,  0,
+  0,  0, 34,  0, 69,  1,  0,  0, 89,  1,  0,  0,  0,  0, 34,  0, 46,  1,  0,  0, 50,  1,  0,  0,  0,  0, 38,  0, 70,  1,  0,  0,
+ 90,  1,  0,  0,  0,  0, 34,  0, 83,  1,  0,  0, 89,  1,  0,  0,  0,  0, 34,  0, 84,  1,  0,  0, 90,  1,  0,  0,  0,  0, 34,  0,
+ 39,  1,  0,  0, 59,  1,  0,  0,  0,  0, 34,  0, 51,  1,  0,  0, 59,  1,  0,  0,  0,  0, 34,  0, 37,  1,  0,  0, 51,  1,  0,  0,
+  0,  0, 34,  0, 40,  1,  0,  0, 60,  1,  0,  0,  0,  0, 34,  0, 38,  1,  0,  0, 52,  1,  0,  0,  0,  0, 34,  0, 52,  1,  0,  0,
+ 60,  1,  0,  0,  0,  0, 34,  0, 74,  0,  0,  0, 57,  1,  0,  0,  0,  0, 39,  0, 57,  1,  0,  0, 65,  1,  0,  0,  0,  0, 34,  0,
+ 74,  0,  0,  0, 75,  0,  0,  0,  0,  0, 38,  0, 58,  1,  0,  0, 66,  1,  0,  0,  0,  0, 34,  0, 74,  0,  0,  0, 58,  1,  0,  0,
+  0,  0, 39,  0, 43,  1,  0,  0, 99,  1,  0,  0,  0,  0, 34,  0, 97,  1,  0,  0, 99,  1,  0,  0,  0,  0, 34,  0, 44,  1,  0,  0,
+ 97,  1,  0,  0,  0,  0, 34,  0, 43,  1,  0,  0, 44,  1,  0,  0,  0,  0, 38,  0, 98,  1,  0,  0,100,  1,  0,  0,  0,  0, 34,  0,
+ 43,  1,  0,  0,100,  1,  0,  0,  0,  0, 34,  0, 44,  1,  0,  0, 98,  1,  0,  0,  0,  0, 34,  0, 95,  1,  0,  0, 97,  1,  0,  0,
+  0,  0, 34,  0, 73,  0,  0,  0, 95,  1,  0,  0,  0,  0, 34,  0, 73,  0,  0,  0, 44,  1,  0,  0,  0,  0, 38,  0, 96,  1,  0,  0,
+ 98,  1,  0,  0,  0,  0, 34,  0, 73,  0,  0,  0, 96,  1,  0,  0,  0,  0, 34,  0, 57,  1,  0,  0, 95,  1,  0,  0,  0,  0, 34,  0,
+ 73,  0,  0,  0, 74,  0,  0,  0,  0,  0, 38,  0, 58,  1,  0,  0, 96,  1,  0,  0,  0,  0, 34,  0, 35,  1,  0,  0,103,  1,  0,  0,
+  0,  0, 34,  0,103,  1,  0,  0,105,  1,  0,  0,  0,  0, 34,  0, 33,  1,  0,  0,105,  1,  0,  0,  0,  0, 34,  0, 36,  1,  0,  0,
+104,  1,  0,  0,  0,  0, 34,  0, 34,  1,  0,  0,106,  1,  0,  0,  0,  0, 34,  0,104,  1,  0,  0,106,  1,  0,  0,  0,  0, 34,  0,
+103,  1,  0,  0,109,  1,  0,  0,  0,  0, 34,  0,107,  1,  0,  0,109,  1,  0,  0,  0,  0, 34,  0,105,  1,  0,  0,107,  1,  0,  0,
+  0,  0, 34,  0,104,  1,  0,  0,110,  1,  0,  0,  0,  0, 34,  0,106,  1,  0,  0,108,  1,  0,  0,  0,  0, 34,  0,108,  1,  0,  0,
+110,  1,  0,  0,  0,  0, 34,  0,109,  1,  0,  0,111,  1,  0,  0,  0,  0, 34,  0,111,  1,  0,  0,113,  1,  0,  0,  0,  0, 34,  0,
+107,  1,  0,  0,113,  1,  0,  0,  0,  0, 34,  0,110,  1,  0,  0,112,  1,  0,  0,  0,  0, 34,  0,108,  1,  0,  0,114,  1,  0,  0,
+  0,  0, 34,  0,112,  1,  0,  0,114,  1,  0,  0,  0,  0, 34,  0,111,  1,  0,  0,117,  1,  0,  0,  0,  0, 34,  0,115,  1,  0,  0,
+117,  1,  0,  0,  0,  0, 34,  0,113,  1,  0,  0,115,  1,  0,  0,  0,  0, 34,  0,112,  1,  0,  0,118,  1,  0,  0,  0,  0, 34,  0,
+114,  1,  0,  0,116,  1,  0,  0,  0,  0, 34,  0,116,  1,  0,  0,118,  1,  0,  0,  0,  0, 34,  0, 55,  1,  0,  0,119,  1,  0,  0,
+  0,  0, 39,  0,115,  1,  0,  0,119,  1,  0,  0,  0,  0, 34,  0, 55,  1,  0,  0,117,  1,  0,  0,  0,  0, 34,  0,116,  1,  0,  0,
+120,  1,  0,  0,  0,  0, 34,  0, 56,  1,  0,  0,120,  1,  0,  0,  0,  0, 39,  0, 56,  1,  0,  0,118,  1,  0,  0,  0,  0, 34,  0,
+ 95,  1,  0,  0,115,  1,  0,  0,  0,  0, 34,  0, 57,  1,  0,  0,119,  1,  0,  0,  0,  0, 39,  0, 96,  1,  0,  0,116,  1,  0,  0,
+  0,  0, 34,  0, 58,  1,  0,  0,120,  1,  0,  0,  0,  0, 39,  0, 97,  1,  0,  0,113,  1,  0,  0,  0,  0, 34,  0, 98,  1,  0,  0,
+114,  1,  0,  0,  0,  0, 34,  0, 99,  1,  0,  0,107,  1,  0,  0,  0,  0, 34,  0,100,  1,  0,  0,108,  1,  0,  0,  0,  0, 34,  0,
+ 99,  1,  0,  0,101,  1,  0,  0,  0,  0, 34,  0,101,  1,  0,  0,105,  1,  0,  0,  0,  0, 34,  0,102,  1,  0,  0,106,  1,  0,  0,
+  0,  0, 34,  0,100,  1,  0,  0,102,  1,  0,  0,  0,  0, 34,  0, 31,  1,  0,  0,101,  1,  0,  0,  0,  0, 34,  0, 32,  1,  0,  0,
+102,  1,  0,  0,  0,  0, 34,  0, 72,  0,  0,  0,101,  1,  0,  0,  0,  0, 34,  0, 72,  0,  0,  0, 43,  1,  0,  0,  0,  0, 38,  0,
+ 72,  0,  0,  0,102,  1,  0,  0,  0,  0, 34,  0, 25,  1,  0,  0, 31,  1,  0,  0,  0,  0, 38,  0, 26,  1,  0,  0, 32,  1,  0,  0,
+  0,  0, 38,  0, 72,  0,  0,  0, 25,  1,  0,  0,  0,  0, 34,  0, 72,  0,  0,  0, 26,  1,  0,  0,  0,  0, 34,  0, 71,  0,  0,  0,
+ 72,  0,  0,  0,  0,  0, 38,  0, 51,  1,  0,  0,103,  1,  0,  0,  0,  0, 34,  0, 52,  1,  0,  0,104,  1,  0,  0,  0,  0, 34,  0,
+ 51,  1,  0,  0, 53,  1,  0,  0,  0,  0, 34,  0, 53,  1,  0,  0,109,  1,  0,  0,  0,  0, 34,  0, 54,  1,  0,  0,110,  1,  0,  0,
+  0,  0, 34,  0, 52,  1,  0,  0, 54,  1,  0,  0,  0,  0, 34,  0, 53,  1,  0,  0,123,  1,  0,  0,  0,  0, 34,  0,111,  1,  0,  0,
+123,  1,  0,  0,  0,  0, 34,  0,112,  1,  0,  0,124,  1,  0,  0,  0,  0, 34,  0, 54,  1,  0,  0,124,  1,  0,  0,  0,  0, 34,  0,
+ 55,  1,  0,  0,123,  1,  0,  0,  0,  0, 34,  0, 56,  1,  0,  0,124,  1,  0,  0,  0,  0, 34,  0, 91,  1,  0,  0,127,  1,  0,  0,
+  0,  0, 34,  0,125,  1,  0,  0,127,  1,  0,  0,  0,  0, 34,  0, 89,  1,  0,  0,125,  1,  0,  0,  0,  0, 34,  0, 92,  1,  0,  0,
+128,  1,  0,  0,  0,  0, 34,  0, 90,  1,  0,  0,126,  1,  0,  0,  0,  0, 34,  0,126,  1,  0,  0,128,  1,  0,  0,  0,  0, 34,  0,
+ 59,  1,  0,  0,125,  1,  0,  0,  0,  0, 34,  0, 61,  1,  0,  0,127,  1,  0,  0,  0,  0, 34,  0, 59,  1,  0,  0, 61,  1,  0,  0,
+  0,  0, 34,  0, 60,  1,  0,  0,126,  1,  0,  0,  0,  0, 34,  0, 60,  1,  0,  0, 62,  1,  0,  0,  0,  0, 34,  0, 62,  1,  0,  0,
+128,  1,  0,  0,  0,  0, 34,  0, 41,  1,  0,  0,125,  1,  0,  0,  0,  0, 34,  0, 42,  1,  0,  0,126,  1,  0,  0,  0,  0, 34,  0,
+ 41,  1,  0,  0, 85,  1,  0,  0,  0,  0, 34,  0, 83,  1,  0,  0,125,  1,  0,  0,  0,  0, 34,  0, 42,  1,  0,  0, 86,  1,  0,  0,
+  0,  0, 34,  0, 84,  1,  0,  0,126,  1,  0,  0,  0,  0, 34,  0, 55,  1,  0,  0, 63,  1,  0,  0,  0,  0, 34,  0, 63,  1,  0,  0,
+121,  1,  0,  0,  0,  0, 39,  0,119,  1,  0,  0,121,  1,  0,  0,  0,  0, 34,  0, 64,  1,  0,  0,122,  1,  0,  0,  0,  0, 39,  0,
+ 56,  1,  0,  0, 64,  1,  0,  0,  0,  0, 34,  0,120,  1,  0,  0,122,  1,  0,  0,  0,  0, 34,  0, 65,  1,  0,  0,121,  1,  0,  0,
+  0,  0, 34,  0, 66,  1,  0,  0,122,  1,  0,  0,  0,  0, 34,  0,121,  1,  0,  0,127,  1,  0,  0,  0,  0, 34,  0, 61,  1,  0,  0,
+ 63,  1,  0,  0,  0,  0, 34,  0,122,  1,  0,  0,128,  1,  0,  0,  0,  0, 34,  0, 62,  1,  0,  0, 64,  1,  0,  0,  0,  0, 34,  0,
+ 93,  1,  0,  0,121,  1,  0,  0,  0,  0, 39,  0, 94,  1,  0,  0,122,  1,  0,  0,  0,  0, 39,  0,129,  1,  0,  0,141,  1,  0,  0,
+  0,  0, 34,  0,129,  1,  0,  0,155,  1,  0,  0,  0,  0, 34,  0,143,  1,  0,  0,155,  1,  0,  0,  0,  0, 34,  0,141,  1,  0,  0,
+143,  1,  0,  0,  0,  0, 34,  0,130,  1,  0,  0,156,  1,  0,  0,  0,  0, 34,  0,130,  1,  0,  0,142,  1,  0,  0,  0,  0, 34,  0,
+142,  1,  0,  0,144,  1,  0,  0,  0,  0, 34,  0,144,  1,  0,  0,156,  1,  0,  0,  0,  0, 34,  0,143,  1,  0,  0,145,  1,  0,  0,
+  0,  0, 34,  0,139,  1,  0,  0,145,  1,  0,  0,  0,  0, 34,  0,139,  1,  0,  0,141,  1,  0,  0,  0,  0, 34,  0,144,  1,  0,  0,
+146,  1,  0,  0,  0,  0, 34,  0,140,  1,  0,  0,142,  1,  0,  0,  0,  0, 34,  0,140,  1,  0,  0,146,  1,  0,  0,  0,  0, 34,  0,
+145,  1,  0,  0,147,  1,  0,  0,  0,  0, 34,  0,137,  1,  0,  0,147,  1,  0,  0,  0,  0, 34,  0,137,  1,  0,  0,139,  1,  0,  0,
+  0,  0, 34,  0,146,  1,  0,  0,148,  1,  0,  0,  0,  0, 34,  0,138,  1,  0,  0,140,  1,  0,  0,  0,  0, 34,  0,138,  1,  0,  0,
+148,  1,  0,  0,  0,  0, 34,  0,147,  1,  0,  0,149,  1,  0,  0,  0,  0, 34,  0,135,  1,  0,  0,149,  1,  0,  0,  0,  0, 34,  0,
+135,  1,  0,  0,137,  1,  0,  0,  0,  0, 34,  0,148,  1,  0,  0,150,  1,  0,  0,  0,  0, 34,  0,136,  1,  0,  0,138,  1,  0,  0,
+  0,  0, 34,  0,136,  1,  0,  0,150,  1,  0,  0,  0,  0, 34,  0,149,  1,  0,  0,151,  1,  0,  0,  0,  0, 34,  0,133,  1,  0,  0,
+151,  1,  0,  0,  0,  0, 34,  0,133,  1,  0,  0,135,  1,  0,  0,  0,  0, 34,  0,150,  1,  0,  0,152,  1,  0,  0,  0,  0, 34,  0,
+134,  1,  0,  0,136,  1,  0,  0,  0,  0, 34,  0,134,  1,  0,  0,152,  1,  0,  0,  0,  0, 34,  0,151,  1,  0,  0,153,  1,  0,  0,
+  0,  0, 34,  0,131,  1,  0,  0,153,  1,  0,  0,  0,  0, 34,  0,131,  1,  0,  0,133,  1,  0,  0,  0,  0, 34,  0,152,  1,  0,  0,
+154,  1,  0,  0,  0,  0, 34,  0,132,  1,  0,  0,134,  1,  0,  0,  0,  0, 34,  0,132,  1,  0,  0,154,  1,  0,  0,  0,  0, 34,  0,
+151,  1,  0,  0,161,  1,  0,  0,  0,  0, 34,  0,159,  1,  0,  0,161,  1,  0,  0,  0,  0, 34,  0,153,  1,  0,  0,159,  1,  0,  0,
+  0,  0, 34,  0,160,  1,  0,  0,162,  1,  0,  0,  0,  0, 34,  0,152,  1,  0,  0,162,  1,  0,  0,  0,  0, 34,  0,154,  1,  0,  0,
+160,  1,  0,  0,  0,  0, 34,  0,149,  1,  0,  0,163,  1,  0,  0,  0,  0, 34,  0,161,  1,  0,  0,163,  1,  0,  0,  0,  0, 34,  0,
+162,  1,  0,  0,164,  1,  0,  0,  0,  0, 34,  0,150,  1,  0,  0,164,  1,  0,  0,  0,  0, 34,  0,147,  1,  0,  0,165,  1,  0,  0,
+  0,  0, 34,  0,163,  1,  0,  0,165,  1,  0,  0,  0,  0, 34,  0,164,  1,  0,  0,166,  1,  0,  0,  0,  0, 34,  0,148,  1,  0,  0,
+166,  1,  0,  0,  0,  0, 34,  0,145,  1,  0,  0,167,  1,  0,  0,  0,  0, 34,  0,165,  1,  0,  0,167,  1,  0,  0,  0,  0, 34,  0,
+166,  1,  0,  0,168,  1,  0,  0,  0,  0, 34,  0,146,  1,  0,  0,168,  1,  0,  0,  0,  0, 34,  0,143,  1,  0,  0,169,  1,  0,  0,
+  0,  0, 34,  0,167,  1,  0,  0,169,  1,  0,  0,  0,  0, 34,  0,168,  1,  0,  0,170,  1,  0,  0,  0,  0, 34,  0,144,  1,  0,  0,
+170,  1,  0,  0,  0,  0, 34,  0,155,  1,  0,  0,157,  1,  0,  0,  0,  0, 34,  0,157,  1,  0,  0,169,  1,  0,  0,  0,  0, 34,  0,
+156,  1,  0,  0,158,  1,  0,  0,  0,  0, 34,  0,158,  1,  0,  0,170,  1,  0,  0,  0,  0, 34,  0, 61,  1,  0,  0,185,  1,  0,  0,
+  0,  0, 34,  0,183,  1,  0,  0,185,  1,  0,  0,  0,  0, 34,  0, 59,  1,  0,  0,183,  1,  0,  0,  0,  0, 34,  0, 62,  1,  0,  0,
+186,  1,  0,  0,  0,  0, 34,  0, 60,  1,  0,  0,184,  1,  0,  0,  0,  0, 34,  0,184,  1,  0,  0,186,  1,  0,  0,  0,  0, 34,  0,
+ 61,  1,  0,  0,131,  1,  0,  0,  0,  0, 34,  0,153,  1,  0,  0,185,  1,  0,  0,  0,  0, 34,  0, 62,  1,  0,  0,132,  1,  0,  0,
+  0,  0, 34,  0,154,  1,  0,  0,186,  1,  0,  0,  0,  0, 34,  0, 53,  1,  0,  0,183,  1,  0,  0,  0,  0, 34,  0, 54,  1,  0,  0,
+184,  1,  0,  0,  0,  0, 34,  0,123,  1,  0,  0,171,  1,  0,  0,  0,  0, 34,  0,155,  1,  0,  0,171,  1,  0,  0,  0,  0, 34,  0,
+123,  1,  0,  0,129,  1,  0,  0,  0,  0, 34,  0,156,  1,  0,  0,172,  1,  0,  0,  0,  0, 34,  0,124,  1,  0,  0,172,  1,  0,  0,
+  0,  0, 34,  0,124,  1,  0,  0,130,  1,  0,  0,  0,  0, 34,  0,159,  1,  0,  0,181,  1,  0,  0,  0,  0, 34,  0,181,  1,  0,  0,
+185,  1,  0,  0,  0,  0, 34,  0,160,  1,  0,  0,182,  1,  0,  0,  0,  0, 34,  0,182,  1,  0,  0,186,  1,  0,  0,  0,  0, 34,  0,
+179,  1,  0,  0,187,  1,  0,  0,  0,  0, 34,  0,185,  1,  0,  0,187,  1,  0,  0,  0,  0, 34,  0,179,  1,  0,  0,181,  1,  0,  0,
+  0,  0, 34,  0,186,  1,  0,  0,188,  1,  0,  0,  0,  0, 34,  0,180,  1,  0,  0,188,  1,  0,  0,  0,  0, 34,  0,180,  1,  0,  0,
+182,  1,  0,  0,  0,  0, 34,  0,175,  1,  0,  0,187,  1,  0,  0,  0,  0, 34,  0,177,  1,  0,  0,179,  1,  0,  0,  0,  0, 34,  0,
+175,  1,  0,  0,177,  1,  0,  0,  0,  0, 34,  0,176,  1,  0,  0,188,  1,  0,  0,  0,  0, 34,  0,176,  1,  0,  0,178,  1,  0,  0,
+  0,  0, 34,  0,178,  1,  0,  0,180,  1,  0,  0,  0,  0, 34,  0,173,  1,  0,  0,189,  1,  0,  0,  0,  0, 34,  0,187,  1,  0,  0,
+189,  1,  0,  0,  0,  0, 34,  0,173,  1,  0,  0,175,  1,  0,  0,  0,  0, 34,  0,188,  1,  0,  0,190,  1,  0,  0,  0,  0, 34,  0,
+174,  1,  0,  0,190,  1,  0,  0,  0,  0, 34,  0,174,  1,  0,  0,176,  1,  0,  0,  0,  0, 34,  0,171,  1,  0,  0,189,  1,  0,  0,
+  0,  0, 34,  0,173,  1,  0,  0,191,  1,  0,  0,  0,  0, 34,  0,171,  1,  0,  0,191,  1,  0,  0,  0,  0, 32,  0,172,  1,  0,  0,
+190,  1,  0,  0,  0,  0, 34,  0,172,  1,  0,  0,192,  1,  0,  0,  0,  0, 32,  0,174,  1,  0,  0,192,  1,  0,  0,  0,  0, 34,  0,
+157,  1,  0,  0,191,  1,  0,  0,  0,  0, 34,  0,158,  1,  0,  0,192,  1,  0,  0,  0,  0, 34,  0, 53,  1,  0,  0,189,  1,  0,  0,
+  0,  0, 34,  0, 54,  1,  0,  0,190,  1,  0,  0,  0,  0, 34,  0,183,  1,  0,  0,187,  1,  0,  0,  0,  0, 34,  0,184,  1,  0,  0,
+188,  1,  0,  0,  0,  0, 34,  0,191,  1,  0,  0,193,  1,  0,  0,  0,  0, 34,  0,193,  1,  0,  0,217,  1,  0,  0,  0,  0, 34,  0,
+157,  1,  0,  0,217,  1,  0,  0,  0,  0, 34,  0,192,  1,  0,  0,194,  1,  0,  0,  0,  0, 34,  0,158,  1,  0,  0,218,  1,  0,  0,
+  0,  0, 34,  0,194,  1,  0,  0,218,  1,  0,  0,  0,  0, 34,  0,173,  1,  0,  0,203,  1,  0,  0,  0,  0, 34,  0,193,  1,  0,  0,
+203,  1,  0,  0,  0,  0, 34,  0,174,  1,  0,  0,204,  1,  0,  0,  0,  0, 34,  0,194,  1,  0,  0,204,  1,  0,  0,  0,  0, 34,  0,
+175,  1,  0,  0,201,  1,  0,  0,  0,  0, 34,  0,201,  1,  0,  0,203,  1,  0,  0,  0,  0, 34,  0,176,  1,  0,  0,202,  1,  0,  0,
+  0,  0, 34,  0,202,  1,  0,  0,204,  1,  0,  0,  0,  0, 34,  0,177,  1,  0,  0,199,  1,  0,  0,  0,  0, 34,  0,199,  1,  0,  0,
+201,  1,  0,  0,  0,  0, 34,  0,178,  1,  0,  0,200,  1,  0,  0,  0,  0, 34,  0,200,  1,  0,  0,202,  1,  0,  0,  0,  0, 34,  0,
+179,  1,  0,  0,197,  1,  0,  0,  0,  0, 34,  0,197,  1,  0,  0,199,  1,  0,  0,  0,  0, 34,  0,180,  1,  0,  0,198,  1,  0,  0,
+  0,  0, 34,  0,198,  1,  0,  0,200,  1,  0,  0,  0,  0, 34,  0,181,  1,  0,  0,195,  1,  0,  0,  0,  0, 34,  0,195,  1,  0,  0,
+197,  1,  0,  0,  0,  0, 34,  0,182,  1,  0,  0,196,  1,  0,  0,  0,  0, 34,  0,196,  1,  0,  0,198,  1,  0,  0,  0,  0, 34,  0,
+159,  1,  0,  0,215,  1,  0,  0,  0,  0, 34,  0,195,  1,  0,  0,215,  1,  0,  0,  0,  0, 34,  0,160,  1,  0,  0,216,  1,  0,  0,
+  0,  0, 34,  0,196,  1,  0,  0,216,  1,  0,  0,  0,  0, 34,  0,205,  1,  0,  0,217,  1,  0,  0,  0,  0, 34,  0,169,  1,  0,  0,
+205,  1,  0,  0,  0,  0, 34,  0,170,  1,  0,  0,206,  1,  0,  0,  0,  0, 34,  0,206,  1,  0,  0,218,  1,  0,  0,  0,  0, 34,  0,
+205,  1,  0,  0,207,  1,  0,  0,  0,  0, 34,  0,167,  1,  0,  0,207,  1,  0,  0,  0,  0, 34,  0,168,  1,  0,  0,208,  1,  0,  0,
+  0,  0, 34,  0,206,  1,  0,  0,208,  1,  0,  0,  0,  0, 34,  0,207,  1,  0,  0,209,  1,  0,  0,  0,  0, 34,  0,165,  1,  0,  0,
+209,  1,  0,  0,  0,  0, 34,  0,166,  1,  0,  0,210,  1,  0,  0,  0,  0, 34,  0,208,  1,  0,  0,210,  1,  0,  0,  0,  0, 34,  0,
+209,  1,  0,  0,211,  1,  0,  0,  0,  0, 34,  0,163,  1,  0,  0,211,  1,  0,  0,  0,  0, 34,  0,164,  1,  0,  0,212,  1,  0,  0,
+  0,  0, 34,  0,210,  1,  0,  0,212,  1,  0,  0,  0,  0, 34,  0,211,  1,  0,  0,213,  1,  0,  0,  0,  0, 34,  0,161,  1,  0,  0,
+213,  1,  0,  0,  0,  0, 34,  0,162,  1,  0,  0,214,  1,  0,  0,  0,  0, 34,  0,212,  1,  0,  0,214,  1,  0,  0,  0,  0, 34,  0,
+213,  1,  0,  0,215,  1,  0,  0,  0,  0, 34,  0,214,  1,  0,  0,216,  1,  0,  0,  0,  0, 34,  0,197,  1,  0,  0,221,  1,  0,  0,
+  0,  0, 34,  0,219,  1,  0,  0,221,  1,  0,  0,  0,  0, 34,  0,199,  1,  0,  0,219,  1,  0,  0,  0,  0, 34,  0,198,  1,  0,  0,
+222,  1,  0,  0,  0,  0, 34,  0,200,  1,  0,  0,220,  1,  0,  0,  0,  0, 34,  0,220,  1,  0,  0,222,  1,  0,  0,  0,  0, 34,  0,
+221,  1,  0,  0,223,  1,  0,  0,  0,  0, 34,  0,223,  1,  0,  0,225,  1,  0,  0,  0,  0, 32,  0,219,  1,  0,  0,225,  1,  0,  0,
+  0,  0, 34,  0,222,  1,  0,  0,224,  1,  0,  0,  0,  0, 34,  0,220,  1,  0,  0,226,  1,  0,  0,  0,  0, 34,  0,224,  1,  0,  0,
+226,  1,  0,  0,  0,  0, 32,  0,223,  1,  0,  0,229,  1,  0,  0,  0,  0, 34,  0,227,  1,  0,  0,229,  1,  0,  0,  0,  0, 34,  0,
+225,  1,  0,  0,227,  1,  0,  0,  0,  0, 34,  0,224,  1,  0,  0,230,  1,  0,  0,  0,  0, 34,  0,226,  1,  0,  0,228,  1,  0,  0,
+  0,  0, 34,  0,228,  1,  0,  0,230,  1,  0,  0,  0,  0, 34,  0,229,  1,  0,  0,231,  1,  0,  0,  0,  0, 34,  0,231,  1,  0,  0,
+233,  1,  0,  0,  0,  0, 34,  0,227,  1,  0,  0,233,  1,  0,  0,  0,  0, 34,  0,230,  1,  0,  0,232,  1,  0,  0,  0,  0, 34,  0,
+228,  1,  0,  0,234,  1,  0,  0,  0,  0, 34,  0,232,  1,  0,  0,234,  1,  0,  0,  0,  0, 34,  0,217,  1,  0,  0,227,  1,  0,  0,
+  0,  0, 34,  0,205,  1,  0,  0,233,  1,  0,  0,  0,  0, 34,  0,218,  1,  0,  0,228,  1,  0,  0,  0,  0, 34,  0,206,  1,  0,  0,
+234,  1,  0,  0,  0,  0, 34,  0,193,  1,  0,  0,225,  1,  0,  0,  0,  0, 34,  0,194,  1,  0,  0,226,  1,  0,  0,  0,  0, 34,  0,
+203,  1,  0,  0,219,  1,  0,  0,  0,  0, 34,  0,204,  1,  0,  0,220,  1,  0,  0,  0,  0, 34,  0,215,  1,  0,  0,221,  1,  0,  0,
+  0,  0, 34,  0,216,  1,  0,  0,222,  1,  0,  0,  0,  0, 34,  0,213,  1,  0,  0,223,  1,  0,  0,  0,  0, 34,  0,214,  1,  0,  0,
+224,  1,  0,  0,  0,  0, 34,  0,211,  1,  0,  0,229,  1,  0,  0,  0,  0, 34,  0,212,  1,  0,  0,230,  1,  0,  0,  0,  0, 34,  0,
+209,  1,  0,  0,231,  1,  0,  0,  0,  0, 34,  0,210,  1,  0,  0,232,  1,  0,  0,  0,  0, 34,  0,207,  1,  0,  0,233,  1,  0,  0,
+  0,  0, 34,  0,208,  1,  0,  0,234,  1,  0,  0,  0,  0, 34,  0,131,  1,  0,  0,245,  1,  0,  0,  0,  0, 34,  0,243,  1,  0,  0,
+245,  1,  0,  0,  0,  0, 39,  0,133,  1,  0,  0,243,  1,  0,  0,  0,  0, 34,  0,132,  1,  0,  0,246,  1,  0,  0,  0,  0, 34,  0,
+134,  1,  0,  0,244,  1,  0,  0,  0,  0, 34,  0,244,  1,  0,  0,246,  1,  0,  0,  0,  0, 39,  0,241,  1,  0,  0,243,  1,  0,  0,
+  0,  0, 39,  0,135,  1,  0,  0,241,  1,  0,  0,  0,  0, 34,  0,136,  1,  0,  0,242,  1,  0,  0,  0,  0, 34,  0,242,  1,  0,  0,
+244,  1,  0,  0,  0,  0, 39,  0,239,  1,  0,  0,241,  1,  0,  0,  0,  0, 39,  0,137,  1,  0,  0,239,  1,  0,  0,  0,  0, 34,  0,
+138,  1,  0,  0,240,  1,  0,  0,  0,  0, 34,  0,240,  1,  0,  0,242,  1,  0,  0,  0,  0, 39,  0,237,  1,  0,  0,239,  1,  0,  0,
+  0,  0, 39,  0,139,  1,  0,  0,237,  1,  0,  0,  0,  0, 34,  0,140,  1,  0,  0,238,  1,  0,  0,  0,  0, 34,  0,238,  1,  0,  0,
+240,  1,  0,  0,  0,  0, 39,  0,235,  1,  0,  0,237,  1,  0,  0,  0,  0, 39,  0,141,  1,  0,  0,235,  1,  0,  0,  0,  0, 34,  0,
+142,  1,  0,  0,236,  1,  0,  0,  0,  0, 34,  0,236,  1,  0,  0,238,  1,  0,  0,  0,  0, 39,  0,235,  1,  0,  0,247,  1,  0,  0,
+  0,  0, 39,  0,129,  1,  0,  0,247,  1,  0,  0,  0,  0, 34,  0,130,  1,  0,  0,248,  1,  0,  0,  0,  0, 34,  0,236,  1,  0,  0,
+248,  1,  0,  0,  0,  0, 39,  0,235,  1,  0,  0,243,  1,  0,  0,  0,  0, 34,  0,245,  1,  0,  0,247,  1,  0,  0,  0,  0, 34,  0,
+236,  1,  0,  0,244,  1,  0,  0,  0,  0, 34,  0,246,  1,  0,  0,248,  1,  0,  0,  0,  0, 34,  0,237,  1,  0,  0,241,  1,  0,  0,
+  0,  0, 34,  0,238,  1,  0,  0,242,  1,  0,  0,  0,  0, 34,  0, 55,  1,  0,  0,247,  1,  0,  0,  0,  0, 39,  0, 56,  1,  0,  0,
+248,  1,  0,  0,  0,  0, 39,  0, 63,  1,  0,  0,245,  1,  0,  0,  0,  0, 39,  0, 64,  1,  0,  0,246,  1,  0,  0,  0,  0, 39,  0,
+ 14,  0,  0,  0,249,  0,  0,  0,  0,  0, 34,  0, 14,  0,  0,  0,178,  0,  0,  0,  0,  0, 34,  0, 14,  0,  0,  0,113,  0,  0,  0,
+  0,  0, 34,  0, 14,  0,  0,  0,161,  0,  0,  0,  0,  0, 34,  0, 20,  0,  0,  0,112,  0,  0,  0,  0,  0, 34,  0, 16,  0,  0,  0,
+112,  0,  0,  0,  0,  0, 34,  0,  9,  0,  0,  0,112,  0,  0,  0,  0,  0, 34,  0, 13,  0,  0,  0,112,  0,  0,  0,  0,  0, 34,  0,
+ 68, 65, 84, 65,  8,  2,  0,  0,136, 27, 27,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  0,  0,  0, 16,  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, 85, 86, 84,101,120,  0, 97, 99,
+101, 45, 86,101,114,116,101,120,  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,136, 70,199,  4,  0,  0,  0,  0,
+ 17,  0,  0,  0, 12,  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,
+ 67,111,108,  0, 32, 70, 97, 99,101, 45, 86,101,114,116,101,120,  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,
+ 24,163,199,  4,  0,  0,  0,  0, 26,  0,  0,  0, 16,  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, 78, 71,111,110, 32, 70, 97, 99,101, 45, 86,101,114,116,101,120,  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, 40,233,198,  4,  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,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 64, 92,  0,  0,136, 70,199,  4,  0,  0,  0,  0, 61,  0,  0,  0,176,  7,  0,  0,  3,112, 28, 63,185,178,236, 62,
+  0,  0,  0,  0,224,124, 27, 63,235, 65,232, 62,  0,  0,  0,  0,144, 63, 30, 63,233,195,226, 62,  0,  0,  0,  0,118,152, 32, 63,
+ 37,167,236, 62,  0,  0,  0,  0,  2,232,209, 62,222, 21,226, 62,  0,  0,  0,  0,102,109,215, 62,222,147,231, 62,  0,  0,  0,  0,
+ 28,135,213, 62,172,  4,236, 62,  0,  0,  0,  0, 56, 54,205, 62, 22,249,235, 62,  0,  0,  0,  0,118,152, 32, 63, 37,167,236, 62,
+  0,  0,  0,  0,144, 63, 30, 63,233,195,226, 62,  0,  0,  0,  0,108,235, 33, 63,197,235,220, 62,  0,  0,  0,  0,209,151, 37, 63,
+ 89,161,236, 62,  0,  0,  0,  0, 76,144,202, 62,186, 61,220, 62,  0,  0,  0,  0,  2,232,209, 62,222, 21,226, 62,  0,  0,  0,  0,
+ 56, 54,205, 62, 22,249,235, 62,  0,  0,  0,  0,128, 55,195, 62, 70,243,235, 62,  0,  0,  0,  0,144, 63, 30, 63,233,195,226, 62,
+  0,  0,  0,  0, 20, 55, 25, 63,  1, 35,223, 62,  0,  0,  0,  0,200,178, 25, 63, 77,233,214, 62,  0,  0,  0,  0,108,235, 33, 63,
+197,235,220, 62,  0,  0,  0,  0,146,  1,219, 62, 66, 59,214, 62,  0,  0,  0,  0,248,248,219, 62,246,116,222, 62,  0,  0,  0,  0,
+  2,232,209, 62,222, 21,226, 62,  0,  0,  0,  0, 76,144,202, 62,186, 61,220, 62,  0,  0,  0,  0,224,124, 27, 63,235, 65,232, 62,
+  0,  0,  0,  0, 87,252, 24, 63, 93,111,230, 62,  0,  0,  0,  0, 20, 55, 25, 63,  1, 35,223, 62,  0,  0,  0,  0,144, 63, 30, 63,
+233,195,226, 62,  0,  0,  0,  0,248,248,219, 62,246,116,222, 62,  0,  0,  0,  0,118,110,220, 62, 78,193,229, 62,  0,  0,  0,  0,
+102,109,215, 62,222,147,231, 62,  0,  0,  0,  0,  2,232,209, 62,222, 21,226, 62,  0,  0,  0,  0, 87,252, 24, 63, 93,111,230, 62,
+  0,  0,  0,  0, 22,195, 22, 63,195, 90,232, 62,  0,  0,  0,  0,191, 91, 20, 63,193, 18,227, 62,  0,  0,  0,  0, 20, 55, 25, 63,
+  1, 35,223, 62,  0,  0,  0,  0,162,175,229, 62,178,100,226, 62,  0,  0,  0,  0,248,224,224, 62,182,172,231, 62,  0,  0,  0,  0,
+118,110,220, 62, 78,193,229, 62,  0,  0,  0,  0,248,248,219, 62,246,116,222, 62,  0,  0,  0,  0, 20, 55, 25, 63,  1, 35,223, 62,
+  0,  0,  0,  0,191, 91, 20, 63,193, 18,227, 62,  0,  0,  0,  0,187,165, 17, 63,225,  6,221, 62,  0,  0,  0,  0,200,178, 25, 63,
+ 77,233,214, 62,  0,  0,  0,  0,170, 27,235, 62,214, 88,220, 62,  0,  0,  0,  0,162,175,229, 62,178,100,226, 62,  0,  0,  0,  0,
+248,248,219, 62,246,116,222, 62,  0,  0,  0,  0,146,  1,219, 62, 66, 59,214, 62,  0,  0,  0,  0,191, 91, 20, 63,193, 18,227, 62,
+  0,  0,  0,  0,164, 18, 18, 63,173,201,236, 62,  0,  0,  0,  0,157,231, 13, 63, 89,161,236, 62,  0,  0,  0,  0,187,165, 17, 63,
+225,  6,221, 62,  0,  0,  0,  0,232,151,242, 62, 70,243,235, 62,  0,  0,  0,  0,216, 65,234, 62,158, 27,236, 62,  0,  0,  0,  0,
+162,175,229, 62,178,100,226, 62,  0,  0,  0,  0,170, 27,235, 62,214, 88,220, 62,  0,  0,  0,  0, 22,195, 22, 63,195, 90,232, 62,
+  0,  0,  0,  0, 11,202, 21, 63,  1,189,236, 62,  0,  0,  0,  0,164, 18, 18, 63,173,201,236, 62,  0,  0,  0,  0,191, 91, 20, 63,
+193, 18,227, 62,  0,  0,  0,  0,216, 65,234, 62,158, 27,236, 62,  0,  0,  0,  0, 12,211,226, 62,246, 14,236, 62,  0,  0,  0,  0,
+248,224,224, 62,182,172,231, 62,  0,  0,  0,  0,162,175,229, 62,178,100,226, 62,  0,  0,  0,  0, 11,202, 21, 63,  1,189,236, 62,
+  0,  0,  0,  0,215,202, 22, 63,237,124,241, 62,  0,  0,  0,  0,125,105, 20, 63,  1, 71,246, 62,  0,  0,  0,  0,164, 18, 18, 63,
+173,201,236, 62,  0,  0,  0,  0, 42,148,229, 62,246,152,245, 62,  0,  0,  0,  0,112,209,224, 62,226,206,240, 62,  0,  0,  0,  0,
+ 12,211,226, 62,246, 14,236, 62,  0,  0,  0,  0,216, 65,234, 62,158, 27,236, 62,  0,  0,  0,  0,164, 18, 18, 63,173,201,236, 62,
+  0,  0,  0,  0,125,105, 20, 63,  1, 71,246, 62,  0,  0,  0,  0, 44,173, 17, 63,231,149,252, 62,  0,  0,  0,  0,157,231, 13, 63,
+ 89,161,236, 62,  0,  0,  0,  0,206, 12,235, 62,218,231,251, 62,  0,  0,  0,  0, 42,148,229, 62,246,152,245, 62,  0,  0,  0,  0,
+216, 65,234, 62,158, 27,236, 62,  0,  0,  0,  0,232,151,242, 62, 70,243,235, 62,  0,  0,  0,  0,125,105, 20, 63,  1, 71,246, 62,
+  0,  0,  0,  0, 37, 59, 25, 63, 49, 73,250, 62,  0,  0,  0,  0,108,178, 25, 63,218,108,  1, 63,  0,  0,  0,  0, 44,173, 17, 63,
+231,149,252, 62,  0,  0,  0,  0, 76,  2,219, 62,213, 21,  1, 63,  0,  0,  0,  0,216,240,219, 62, 38,155,249, 62,  0,  0,  0,  0,
+ 42,148,229, 62,246,152,245, 62,  0,  0,  0,  0,206, 12,235, 62,218,231,251, 62,  0,  0,  0,  0,215,202, 22, 63,237,124,241, 62,
+  0,  0,  0,  0,195,  1, 25, 63,169,102,243, 62,  0,  0,  0,  0, 37, 59, 25, 63, 49, 73,250, 62,  0,  0,  0,  0,125,105, 20, 63,
+  1, 71,246, 62,  0,  0,  0,  0,216,240,219, 62, 38,155,249, 62,  0,  0,  0,  0,156, 99,220, 62,154,184,242, 62,  0,  0,  0,  0,
+112,209,224, 62,226,206,240, 62,  0,  0,  0,  0, 42,148,229, 62,246,152,245, 62,  0,  0,  0,  0,195,  1, 25, 63,169,102,243, 62,
+  0,  0,  0,  0,176,125, 27, 63,149,145,241, 62,  0,  0,  0,  0,167, 74, 30, 63,  3,153,246, 62,  0,  0,  0,  0, 37, 59, 25, 63,
+ 49, 73,250, 62,  0,  0,  0,  0,212,209,209, 62,246,234,245, 62,  0,  0,  0,  0,192,107,215, 62,138,227,240, 62,  0,  0,  0,  0,
+156, 99,220, 62,154,184,242, 62,  0,  0,  0,  0,216,240,219, 62, 38,155,249, 62,  0,  0,  0,  0, 37, 59, 25, 63, 49, 73,250, 62,
+  0,  0,  0,  0,167, 74, 30, 63,  3,153,246, 62,  0,  0,  0,  0,204,230, 33, 63,107,232,252, 62,  0,  0,  0,  0,108,178, 25, 63,
+218,108,  1, 63,  0,  0,  0,  0,132,153,202, 62, 94, 58,252, 62,  0,  0,  0,  0,212,209,209, 62,246,234,245, 62,  0,  0,  0,  0,
+216,240,219, 62, 38,155,249, 62,  0,  0,  0,  0, 76,  2,219, 62,213, 21,  1, 63,  0,  0,  0,  0,167, 74, 30, 63,  3,153,246, 62,
+  0,  0,  0,  0,118,152, 32, 63, 37,167,236, 62,  0,  0,  0,  0,209,151, 37, 63, 89,161,236, 62,  0,  0,  0,  0,204,230, 33, 63,
+107,232,252, 62,  0,  0,  0,  0,128, 55,195, 62, 70,243,235, 62,  0,  0,  0,  0, 56, 54,205, 62, 22,249,235, 62,  0,  0,  0,  0,
+212,209,209, 62,246,234,245, 62,  0,  0,  0,  0,132,153,202, 62, 94, 58,252, 62,  0,  0,  0,  0,176,125, 27, 63,149,145,241, 62,
+  0,  0,  0,  0,  3,112, 28, 63,185,178,236, 62,  0,  0,  0,  0,118,152, 32, 63, 37,167,236, 62,  0,  0,  0,  0,167, 74, 30, 63,
+  3,153,246, 62,  0,  0,  0,  0, 56, 54,205, 62, 22,249,235, 62,  0,  0,  0,  0, 28,135,213, 62,172,  4,236, 62,  0,  0,  0,  0,
+192,107,215, 62,138,227,240, 62,  0,  0,  0,  0,212,209,209, 62,246,234,245, 62,  0,  0,  0,  0,  3,112, 28, 63,185,178,236, 62,
+  0,  0,  0,  0,176,125, 27, 63,149,145,241, 62,  0,  0,  0,  0, 42, 39, 27, 63, 57,  1,241, 62,  0,  0,  0,  0,140,249, 27, 63,
+115,186,236, 62,  0,  0,  0,  0,206, 24,216, 62, 46, 83,240, 62,  0,  0,  0,  0,192,107,215, 62,138,227,240, 62,  0,  0,  0,  0,
+ 28,135,213, 62,172,  4,236, 62,  0,  0,  0,  0,  8,116,214, 62,102, 12,236, 62,  0,  0,  0,  0,176,125, 27, 63,149,145,241, 62,
+  0,  0,  0,  0,195,  1, 25, 63,169,102,243, 62,  0,  0,  0,  0,  6,248, 24, 63,185, 91,242, 62,  0,  0,  0,  0, 42, 39, 27, 63,
+ 57,  1,241, 62,  0,  0,  0,  0, 22,119,220, 62,174,173,241, 62,  0,  0,  0,  0,156, 99,220, 62,154,184,242, 62,  0,  0,  0,  0,
+192,107,215, 62,138,227,240, 62,  0,  0,  0,  0,206, 24,216, 62, 46, 83,240, 62,  0,  0,  0,  0,195,  1, 25, 63,169,102,243, 62,
+  0,  0,  0,  0,215,202, 22, 63,237,124,241, 62,  0,  0,  0,  0,157, 38, 23, 63,225,173,240, 62,  0,  0,  0,  0,  6,248, 24, 63,
+185, 91,242, 62,  0,  0,  0,  0,234, 25,224, 62,214,255,239, 62,  0,  0,  0,  0,112,209,224, 62,226,206,240, 62,  0,  0,  0,  0,
+156, 99,220, 62,154,184,242, 62,  0,  0,  0,  0, 22,119,220, 62,174,173,241, 62,  0,  0,  0,  0,215,202, 22, 63,237,124,241, 62,
+  0,  0,  0,  0, 11,202, 21, 63,  1,189,236, 62,  0,  0,  0,  0, 13, 89, 22, 63,247,196,236, 62,  0,  0,  0,  0,157, 38, 23, 63,
+225,173,240, 62,  0,  0,  0,  0,  8,181,225, 62,234, 22,236, 62,  0,  0,  0,  0, 12,211,226, 62,246, 14,236, 62,  0,  0,  0,  0,
+112,209,224, 62,226,206,240, 62,  0,  0,  0,  0,234, 25,224, 62,214,255,239, 62,  0,  0,  0,  0, 11,202, 21, 63,  1,189,236, 62,
+  0,  0,  0,  0, 22,195, 22, 63,195, 90,232, 62,  0,  0,  0,  0, 88, 33, 23, 63, 69, 47,233, 62,  0,  0,  0,  0, 13, 89, 22, 63,
+247,196,236, 62,  0,  0,  0,  0,112, 36,224, 62, 58,129,232, 62,  0,  0,  0,  0,248,224,224, 62,182,172,231, 62,  0,  0,  0,  0,
+ 12,211,226, 62,246, 14,236, 62,  0,  0,  0,  0,  8,181,225, 62,234, 22,236, 62,  0,  0,  0,  0, 22,195, 22, 63,195, 90,232, 62,
+  0,  0,  0,  0, 87,252, 24, 63, 93,111,230, 62,  0,  0,  0,  0,100,243, 24, 63,  5,123,231, 62,  0,  0,  0,  0, 88, 33, 23, 63,
+ 69, 47,233, 62,  0,  0,  0,  0, 90,128,220, 62,248,204,230, 62,  0,  0,  0,  0,118,110,220, 62, 78,193,229, 62,  0,  0,  0,  0,
+248,224,224, 62,182,172,231, 62,  0,  0,  0,  0,112, 36,224, 62, 58,129,232, 62,  0,  0,  0,  0, 87,252, 24, 63, 93,111,230, 62,
+  0,  0,  0,  0,224,124, 27, 63,235, 65,232, 62,  0,  0,  0,  0,169, 37, 27, 63, 35,211,232, 62,  0,  0,  0,  0,100,243, 24, 63,
+  5,123,231, 62,  0,  0,  0,  0,206, 27,216, 62, 22, 37,232, 62,  0,  0,  0,  0,102,109,215, 62,222,147,231, 62,  0,  0,  0,  0,
+118,110,220, 62, 78,193,229, 62,  0,  0,  0,  0, 90,128,220, 62,248,204,230, 62,  0,  0,  0,  0,224,124, 27, 63,235, 65,232, 62,
+  0,  0,  0,  0,  3,112, 28, 63,185,178,236, 62,  0,  0,  0,  0,140,249, 27, 63,115,186,236, 62,  0,  0,  0,  0,169, 37, 27, 63,
+ 35,211,232, 62,  0,  0,  0,  0,  8,116,214, 62,102, 12,236, 62,  0,  0,  0,  0, 28,135,213, 62,172,  4,236, 62,  0,  0,  0,  0,
+102,109,215, 62,222,147,231, 62,  0,  0,  0,  0,206, 27,216, 62, 22, 37,232, 62,  0,  0,  0,  0,138,242, 24, 63, 21,194,236, 62,
+  0,  0,  0,  0,169, 37, 27, 63, 35,211,232, 62,  0,  0,  0,  0,140,249, 27, 63,115,186,236, 62,  0,  0,  0,  0,  8,116,214, 62,
+102, 12,236, 62,  0,  0,  0,  0,206, 27,216, 62, 22, 37,232, 62,  0,  0,  0,  0, 16,130,220, 62,  6, 20,236, 62,  0,  0,  0,  0,
+100,243, 24, 63,  5,123,231, 62,  0,  0,  0,  0,169, 37, 27, 63, 35,211,232, 62,  0,  0,  0,  0,138,242, 24, 63, 21,194,236, 62,
+  0,  0,  0,  0, 16,130,220, 62,  6, 20,236, 62,  0,  0,  0,  0,206, 27,216, 62, 22, 37,232, 62,  0,  0,  0,  0, 90,128,220, 62,
+248,204,230, 62,  0,  0,  0,  0,138,242, 24, 63, 21,194,236, 62,  0,  0,  0,  0, 88, 33, 23, 63, 69, 47,233, 62,  0,  0,  0,  0,
+100,243, 24, 63,  5,123,231, 62,  0,  0,  0,  0, 90,128,220, 62,248,204,230, 62,  0,  0,  0,  0,112, 36,224, 62, 58,129,232, 62,
+  0,  0,  0,  0, 16,130,220, 62,  6, 20,236, 62,  0,  0,  0,  0,138,242, 24, 63, 21,194,236, 62,  0,  0,  0,  0, 13, 89, 22, 63,
+247,196,236, 62,  0,  0,  0,  0, 88, 33, 23, 63, 69, 47,233, 62,  0,  0,  0,  0,112, 36,224, 62, 58,129,232, 62,  0,  0,  0,  0,
+  8,181,225, 62,234, 22,236, 62,  0,  0,  0,  0, 16,130,220, 62,  6, 20,236, 62,  0,  0,  0,  0,138,242, 24, 63, 21,194,236, 62,
+  0,  0,  0,  0,157, 38, 23, 63,225,173,240, 62,  0,  0,  0,  0, 13, 89, 22, 63,247,196,236, 62,  0,  0,  0,  0,  8,181,225, 62,
+234, 22,236, 62,  0,  0,  0,  0,234, 25,224, 62,214,255,239, 62,  0,  0,  0,  0, 16,130,220, 62,  6, 20,236, 62,  0,  0,  0,  0,
+138,242, 24, 63, 21,194,236, 62,  0,  0,  0,  0,  6,248, 24, 63,185, 91,242, 62,  0,  0,  0,  0,157, 38, 23, 63,225,173,240, 62,
+  0,  0,  0,  0,234, 25,224, 62,214,255,239, 62,  0,  0,  0,  0, 22,119,220, 62,174,173,241, 62,  0,  0,  0,  0, 16,130,220, 62,
+  6, 20,236, 62,  0,  0,  0,  0,138,242, 24, 63, 21,194,236, 62,  0,  0,  0,  0, 42, 39, 27, 63, 57,  1,241, 62,  0,  0,  0,  0,
+  6,248, 24, 63,185, 91,242, 62,  0,  0,  0,  0, 22,119,220, 62,174,173,241, 62,  0,  0,  0,  0,206, 24,216, 62, 46, 83,240, 62,
+  0,  0,  0,  0, 16,130,220, 62,  6, 20,236, 62,  0,  0,  0,  0,138,242, 24, 63, 21,194,236, 62,  0,  0,  0,  0,140,249, 27, 63,
+115,186,236, 62,  0,  0,  0,  0, 42, 39, 27, 63, 57,  1,241, 62,  0,  0,  0,  0,206, 24,216, 62, 46, 83,240, 62,  0,  0,  0,  0,
+  8,116,214, 62,102, 12,236, 62,  0,  0,  0,  0, 16,130,220, 62,  6, 20,236, 62,  0,  0,  0,  0,174,254, 16, 63, 94, 45, 34, 62,
+  0,  0,  0,  0, 79,190, 13, 63,160,193, 46, 62,  0,  0,  0,  0,220,199,  3, 63, 89,219, 24, 62,  0,  0,  0,  0,219,199,  3, 63,
+ 18, 28,229, 61,  0,  0,  0,  0,220,199,  3, 63, 89,219, 24, 62,  0,  0,  0,  0, 14,150,243, 62,204, 79, 47, 62,  0,  0,  0,  0,
+140,248,236, 62,182,202, 34, 62,  0,  0,  0,  0,219,199,  3, 63, 18, 28,229, 61,  0,  0,  0,  0,184,152, 21, 63,182, 47, 53, 62,
+  0,  0,  0,  0,250,104, 16, 63, 16,113, 55, 62,  0,  0,  0,  0, 79,190, 13, 63,160,193, 46, 62,  0,  0,  0,  0,174,254, 16, 63,
+ 94, 45, 34, 62,  0,  0,  0,  0, 14,150,243, 62,204, 79, 47, 62,  0,  0,  0,  0,200, 68,238, 62, 76, 62, 56, 62,  0,  0,  0,  0,
+183,207,227, 62,250, 75, 54, 62,  0,  0,  0,  0,140,248,236, 62,182,202, 34, 62,  0,  0,  0,  0,137, 57, 22, 63, 81, 93, 61, 62,
+  0,  0,  0,  0,206,186, 16, 63, 85,129, 72, 62,  0,  0,  0,  0,250,104, 16, 63, 16,113, 55, 62,  0,  0,  0,  0,184,152, 21, 63,
+182, 47, 53, 62,  0,  0,  0,  0,200, 68,238, 62, 76, 62, 56, 62,  0,  0,  0,  0,192,187,237, 62,194,118, 73, 62,  0,  0,  0,  0,
+122,152,226, 62,190,166, 62, 62,  0,  0,  0,  0,183,207,227, 62,250, 75, 54, 62,  0,  0,  0,  0,250,249, 22, 63,160,251, 88, 62,
+  0,  0,  0,  0,222, 32, 16, 63, 34,106, 93, 62,  0,  0,  0,  0,206,186, 16, 63, 85,129, 72, 62,  0,  0,  0,  0,137, 57, 22, 63,
+ 81, 93, 61, 62,  0,  0,  0,  0,192,187,237, 62,194,118, 73, 62,  0,  0,  0,  0, 21, 19,239, 62,121,110, 94, 62,  0,  0,  0,  0,
+ 90, 83,225, 62, 21,153, 90, 62,  0,  0,  0,  0,122,152,226, 62,190,166, 62, 62,  0,  0,  0,  0, 20, 81, 25, 63, 17, 56,132, 62,
+  0,  0,  0,  0,206,243, 15, 63,182,207,136, 62,  0,  0,  0,  0,222, 32, 16, 63, 34,106, 93, 62,  0,  0,  0,  0,250,249, 22, 63,
+160,251, 88, 62,  0,  0,  0,  0, 21, 19,239, 62,121,110, 94, 62,  0,  0,  0,  0, 92,193,239, 62,113, 61,137, 62,  0,  0,  0,  0,
+ 54, 42,221, 62,209, 25,133, 62,  0,  0,  0,  0, 90, 83,225, 62, 21,153, 90, 62,  0,  0,  0,  0,111,239, 27, 63,159, 77,166, 62,
+  0,  0,  0,  0, 91, 94, 37, 63,107,120,187, 62,  0,  0,  0,  0, 66, 21, 30, 63,178,139,200, 62,  0,  0,  0,  0,158,237, 12, 63,
+ 38,241,187, 62,  0,  0,  0,  0,139,125,211, 62,170,171,200, 62,  0,  0,  0,  0,156, 28,197, 62,166,130,187, 62,  0,  0,  0,  0,
+115, 21,216, 62, 14,177,166, 62,  0,  0,  0,  0, 15,175,245, 62,188, 14,188, 62,  0,  0,  0,  0, 91, 94, 37, 63,107,120,187, 62,
+  0,  0,  0,  0, 87, 57, 43, 63,222, 58,206, 62,  0,  0,  0,  0, 24,163, 39, 63,174, 95,216, 62,  0,  0,  0,  0, 66, 21, 30, 63,
+178,139,200, 62,  0,  0,  0,  0, 98,194,191, 62, 42, 94,216, 62,  0,  0,  0,  0,130,207,184, 62, 42, 27,206, 62,  0,  0,  0,  0,
+156, 28,197, 62,166,130,187, 62,  0,  0,  0,  0,139,125,211, 62,170,171,200, 62,  0,  0,  0,  0, 87, 57, 43, 63,222, 58,206, 62,
+  0,  0,  0,  0, 38,229, 50, 63,169, 32,226, 62,  0,  0,  0,  0,177, 79, 43, 63,202,194,231, 62,  0,  0,  0,  0, 24,163, 39, 63,
+174, 95,216, 62,  0,  0,  0,  0, 60,201,183, 62, 82,218,231, 62,  0,  0,  0,  0,196, 39,168, 62,206, 11,226, 62,  0,  0,  0,  0,
+130,207,184, 62, 42, 27,206, 62,  0,  0,  0,  0, 98,194,191, 62, 42, 94,216, 62,  0,  0,  0,  0, 38,229, 50, 63,169, 32,226, 62,
+  0,  0,  0,  0, 62,134, 48, 63, 37,107,249, 62,  0,  0,  0,  0,154,190, 43, 63,192,  0,249, 62,  0,  0,  0,  0,177, 79, 43, 63,
+202,194,231, 62,  0,  0,  0,  0,138,190,182, 62, 35, 49,249, 62,  0,  0,  0,  0,172,229,172, 62,116,127,249, 62,  0,  0,  0,  0,
+196, 39,168, 62,206, 11,226, 62,  0,  0,  0,  0, 60,201,183, 62, 82,218,231, 62,  0,  0,  0,  0, 62,134, 48, 63, 37,107,249, 62,
+  0,  0,  0,  0,238, 88, 46, 63,146,223,  2, 63,  0,  0,  0,  0,123,207, 40, 63,218,175,254, 62,  0,  0,  0,  0,154,190, 43, 63,
+192,  0,249, 62,  0,  0,  0,  0,  2,184,188, 62,140,  0,255, 62,  0,  0,  0,  0,173, 87,177, 62,102,  9,  3, 63,  0,  0,  0,  0,
+172,229,172, 62,116,127,249, 62,  0,  0,  0,  0,138,190,182, 62, 35, 49,249, 62,  0,  0,  0,  0,238, 88, 46, 63,146,223,  2, 63,
+  0,  0,  0,  0,220,158, 34, 63,175, 23, 10, 63,  0,  0,  0,  0,126, 77, 30, 63,156, 88,  5, 63,  0,  0,  0,  0,123,207, 40, 63,
+218,175,254, 62,  0,  0,  0,  0, 89, 65,210, 62, 56,158,  5, 63,  0,  0,  0,  0,124,109,201, 62, 72,121, 10, 63,  0,  0,  0,  0,
+173, 87,177, 62,102,  9,  3, 63,  0,  0,  0,  0,  2,184,188, 62,140,  0,255, 62,  0,  0,  0,  0,220,158, 34, 63,175, 23, 10, 63,
+  0,  0,  0,  0, 28,105, 26, 63,242,194, 11, 63,  0,  0,  0,  0,244,120, 25, 63, 78,242,  7, 63,  0,  0,  0,  0,126, 77, 30, 63,
+156, 88,  5, 63,  0,  0,  0,  0,  0, 39,220, 62,252, 58,  8, 63,  0,  0,  0,  0,220, 73,218, 62,169, 31, 12, 63,  0,  0,  0,  0,
+124,109,201, 62, 72,121, 10, 63,  0,  0,  0,  0, 89, 65,210, 62, 56,158,  5, 63,  0,  0,  0,  0, 28,105, 26, 63,242,194, 11, 63,
+  0,  0,  0,  0,173,244, 22, 63,236,215, 11, 63,  0,  0,  0,  0,202, 47, 22, 63,156, 60,  8, 63,  0,  0,  0,  0,244,120, 25, 63,
+ 78,242,  7, 63,  0,  0,  0,  0, 11,221,226, 62, 90,125,  8, 63,  0,  0,  0,  0,220, 89,225, 62, 77, 42, 12, 63,  0,  0,  0,  0,
+220, 73,218, 62,169, 31, 12, 63,  0,  0,  0,  0,  0, 39,220, 62,252, 58,  8, 63,  0,  0,  0,  0,173,244, 22, 63,236,215, 11, 63,
+  0,  0,  0,  0, 67,169, 11, 63, 18,197, 11, 63,  0,  0,  0,  0,106,252, 12, 63,180,173,  3, 63,  0,  0,  0,  0,202, 47, 22, 63,
+156, 60,  8, 63,  0,  0,  0,  0, 35,114,245, 62,233,196,  3, 63,  0,  0,  0,  0, 55, 72,248, 62, 91,232, 11, 63,  0,  0,  0,  0,
+220, 89,225, 62, 77, 42, 12, 63,  0,  0,  0,  0, 11,221,226, 62, 90,125,  8, 63,  0,  0,  0,  0, 67,169, 11, 63, 18,197, 11, 63,
+  0,  0,  0,  0,148,232,  3, 63,164, 17, 11, 63,  0,  0,  0,  0,162,220,  3, 63, 45, 88,  0, 63,  0,  0,  0,  0,106,252, 12, 63,
+180,173,  3, 63,  0,  0,  0,  0,162,220,  3, 63, 45, 88,  0, 63,  0,  0,  0,  0,148,232,  3, 63,164, 17, 11, 63,  0,  0,  0,  0,
+ 55, 72,248, 62, 91,232, 11, 63,  0,  0,  0,  0, 35,114,245, 62,233,196,  3, 63,  0,  0,  0,  0,103, 59, 17, 63,120,195,255, 62,
+  0,  0,  0,  0,240, 81, 22, 63,114, 70,  1, 63,  0,  0,  0,  0,202, 47, 22, 63,156, 60,  8, 63,  0,  0,  0,  0,106,252, 12, 63,
+180,173,  3, 63,  0,  0,  0,  0, 11,221,226, 62, 90,125,  8, 63,  0,  0,  0,  0,106,128,226, 62,198,111,  1, 63,  0,  0,  0,  0,
+209,213,236, 62,  4,250,255, 62,  0,  0,  0,  0, 35,114,245, 62,233,196,  3, 63,  0,  0,  0,  0,240, 81, 22, 63,114, 70,  1, 63,
+  0,  0,  0,  0,151,182, 25, 63,130,  9,  1, 63,  0,  0,  0,  0,244,120, 25, 63, 78,242,  7, 63,  0,  0,  0,  0,202, 47, 22, 63,
+156, 60,  8, 63,  0,  0,  0,  0,  0, 39,220, 62,252, 58,  8, 63,  0,  0,  0,  0,213,150,219, 62, 50, 55,  1, 63,  0,  0,  0,  0,
+106,128,226, 62,198,111,  1, 63,  0,  0,  0,  0, 11,221,226, 62, 90,125,  8, 63,  0,  0,  0,  0, 96, 49, 30, 63,121,229,254, 62,
+  0,  0,  0,  0,126, 77, 30, 63,156, 88,  5, 63,  0,  0,  0,  0,244,120, 25, 63, 78,242,  7, 63,  0,  0,  0,  0,151,182, 25, 63,
+130,  9,  1, 63,  0,  0,  0,  0,  0, 39,220, 62,252, 58,  8, 63,  0,  0,  0,  0, 89, 65,210, 62, 56,158,  5, 63,  0,  0,  0,  0,
+176,116,210, 62,227, 62,255, 62,  0,  0,  0,  0,213,150,219, 62, 50, 55,  1, 63,  0,  0,  0,  0, 25,113, 37, 63, 35,157,247, 62,
+  0,  0,  0,  0,123,207, 40, 63,218,175,254, 62,  0,  0,  0,  0,126, 77, 30, 63,156, 88,  5, 63,  0,  0,  0,  0, 96, 49, 30, 63,
+121,229,254, 62,  0,  0,  0,  0, 89, 65,210, 62, 56,158,  5, 63,  0,  0,  0,  0,  2,184,188, 62,140,  0,255, 62,  0,  0,  0,  0,
+189,165,195, 62,139,232,247, 62,  0,  0,  0,  0,176,116,210, 62,227, 62,255, 62,  0,  0,  0,  0, 92, 62, 39, 63,121, 75,240, 62,
+  0,  0,  0,  0,154,190, 43, 63,192,  0,249, 62,  0,  0,  0,  0,123,207, 40, 63,218,175,254, 62,  0,  0,  0,  0, 25,113, 37, 63,
+ 35,157,247, 62,  0,  0,  0,  0,  2,184,188, 62,140,  0,255, 62,  0,  0,  0,  0,138,190,182, 62, 35, 49,249, 62,  0,  0,  0,  0,
+222, 10,192, 62,163,128,240, 62,  0,  0,  0,  0,189,165,195, 62,139,232,247, 62,  0,  0,  0,  0,140,149, 38, 63, 38, 95,229, 62,
+  0,  0,  0,  0,177, 79, 43, 63,202,194,231, 62,  0,  0,  0,  0,154,190, 43, 63,192,  0,249, 62,  0,  0,  0,  0, 92, 62, 39, 63,
+121, 75,240, 62,  0,  0,  0,  0,138,190,182, 62, 35, 49,249, 62,  0,  0,  0,  0, 60,201,183, 62, 82,218,231, 62,  0,  0,  0,  0,
+168,140,193, 62, 94,129,229, 62,  0,  0,  0,  0,222, 10,192, 62,163,128,240, 62,  0,  0,  0,  0, 14,120, 33, 63,166,238,214, 62,
+  0,  0,  0,  0, 24,163, 39, 63,174, 95,216, 62,  0,  0,  0,  0,177, 79, 43, 63,202,194,231, 62,  0,  0,  0,  0,140,149, 38, 63,
+ 38, 95,229, 62,  0,  0,  0,  0, 60,201,183, 62, 82,218,231, 62,  0,  0,  0,  0, 98,194,191, 62, 42, 94,216, 62,  0,  0,  0,  0,
+168, 75,204, 62, 62,  7,215, 62,  0,  0,  0,  0,168,140,193, 62, 94,129,229, 62,  0,  0,  0,  0,165,178, 27, 63,128, 17,208, 62,
+  0,  0,  0,  0, 66, 21, 30, 63,178,139,200, 62,  0,  0,  0,  0, 24,163, 39, 63,174, 95,216, 62,  0,  0,  0,  0, 14,120, 33, 63,
+166,238,214, 62,  0,  0,  0,  0, 98,194,191, 62, 42, 94,216, 62,  0,  0,  0,  0,139,125,211, 62,170,171,200, 62,  0,  0,  0,  0,
+  6, 24,216, 62,128, 57,208, 62,  0,  0,  0,  0,168, 75,204, 62, 62,  7,215, 62,  0,  0,  0,  0, 15, 97, 17, 63,220, 34,214, 62,
+  0,  0,  0,  0,158,237, 12, 63, 38,241,187, 62,  0,  0,  0,  0, 66, 21, 30, 63,178,139,200, 62,  0,  0,  0,  0,165,178, 27, 63,
+128, 17,208, 62,  0,  0,  0,  0,139,125,211, 62,170,171,200, 62,  0,  0,  0,  0, 15,175,245, 62,188, 14,188, 62,  0,  0,  0,  0,
+217,200,236, 62,134, 49,214, 62,  0,  0,  0,  0,  6, 24,216, 62,128, 57,208, 62,  0,  0,  0,  0, 15, 97, 17, 63,220, 34,214, 62,
+  0,  0,  0,  0,149,244, 14, 63,  4, 42,221, 62,  0,  0,  0,  0,147,230,  3, 63, 78, 47,208, 62,  0,  0,  0,  0,158,237, 12, 63,
+ 38,241,187, 62,  0,  0,  0,  0,147,230,  3, 63, 78, 47,208, 62,  0,  0,  0,  0,141,144,241, 62,244, 52,221, 62,  0,  0,  0,  0,
+217,200,236, 62,134, 49,214, 62,  0,  0,  0,  0, 15,175,245, 62,188, 14,188, 62,  0,  0,  0,  0,103, 59, 17, 63,120,195,255, 62,
+  0,  0,  0,  0,106,252, 12, 63,180,173,  3, 63,  0,  0,  0,  0,162,220,  3, 63, 45, 88,  0, 63,  0,  0,  0,  0, 71, 25, 13, 63,
+116,163,243, 62,  0,  0,  0,  0,162,220,  3, 63, 45, 88,  0, 63,  0,  0,  0,  0, 35,114,245, 62,233,196,  3, 63,  0,  0,  0,  0,
+209,213,236, 62,  4,250,255, 62,  0,  0,  0,  0,  0, 45,245, 62,206,185,243, 62,  0,  0,  0,  0, 71, 25, 13, 63,116,163,243, 62,
+  0,  0,  0,  0,162,220,  3, 63, 45, 88,  0, 63,  0,  0,  0,  0,215,220,  3, 63,148,189,231, 62,  0,  0,  0,  0, 64,  2, 13, 63,
+ 52,215,230, 62,  0,  0,  0,  0,215,220,  3, 63,148,189,231, 62,  0,  0,  0,  0,162,220,  3, 63, 45, 88,  0, 63,  0,  0,  0,  0,
+  0, 45,245, 62,206,185,243, 62,  0,  0,  0,  0,219,100,245, 62,184,230,230, 62,  0,  0,  0,  0,147,230,  3, 63, 78, 47,208, 62,
+  0,  0,  0,  0,149,244, 14, 63,  4, 42,221, 62,  0,  0,  0,  0, 64,  2, 13, 63, 52,215,230, 62,  0,  0,  0,  0,215,220,  3, 63,
+148,189,231, 62,  0,  0,  0,  0,219,100,245, 62,184,230,230, 62,  0,  0,  0,  0,141,144,241, 62,244, 52,221, 62,  0,  0,  0,  0,
+147,230,  3, 63, 78, 47,208, 62,  0,  0,  0,  0,215,220,  3, 63,148,189,231, 62,  0,  0,  0,  0,250, 61,  7, 63,148, 31, 54, 62,
+  0,  0,  0,  0,193,202,  3, 63,214,174, 49, 62,  0,  0,  0,  0,220,199,  3, 63, 89,219, 24, 62,  0,  0,  0,  0, 79,190, 13, 63,
+160,193, 46, 62,  0,  0,  0,  0,220,199,  3, 63, 89,219, 24, 62,  0,  0,  0,  0,193,202,  3, 63,214,174, 49, 62,  0,  0,  0,  0,
+175, 87,  0, 63,251, 90, 54, 62,  0,  0,  0,  0, 14,150,243, 62,204, 79, 47, 62,  0,  0,  0,  0, 68,214,  9, 63,246,237, 66, 62,
+  0,  0,  0,  0,250, 61,  7, 63,148, 31, 54, 62,  0,  0,  0,  0, 79,190, 13, 63,160,193, 46, 62,  0,  0,  0,  0,250,104, 16, 63,
+ 16,113, 55, 62,  0,  0,  0,  0, 14,150,243, 62,204, 79, 47, 62,  0,  0,  0,  0,175, 87,  0, 63,251, 90, 54, 62,  0,  0,  0,  0,
+104,137,251, 62,179, 92, 67, 62,  0,  0,  0,  0,200, 68,238, 62, 76, 62, 56, 62,  0,  0,  0,  0,237,221,  8, 63,218, 90, 91, 62,
+  0,  0,  0,  0, 68,214,  9, 63,246,237, 66, 62,  0,  0,  0,  0,250,104, 16, 63, 16,113, 55, 62,  0,  0,  0,  0,206,186, 16, 63,
+ 85,129, 72, 62,  0,  0,  0,  0,200, 68,238, 62, 76, 62, 56, 62,  0,  0,  0,  0,104,137,251, 62,179, 92, 67, 62,  0,  0,  0,  0,
+ 39,153,253, 62, 27,195, 91, 62,  0,  0,  0,  0,192,187,237, 62,194,118, 73, 62,  0,  0,  0,  0,206,243, 15, 63,182,207,136, 62,
+  0,  0,  0,  0, 77, 32,  8, 63, 10, 39,139, 62,  0,  0,  0,  0, 22,117,  9, 63,146,203, 97, 62,  0,  0,  0,  0,222, 32, 16, 63,
+ 34,106, 93, 62,  0,  0,  0,  0,192,110,252, 62, 79, 68, 98, 62,  0,  0,  0,  0,219, 89,255, 62,116, 79,139, 62,  0,  0,  0,  0,
+ 92,193,239, 62,113, 61,137, 62,  0,  0,  0,  0, 21, 19,239, 62,121,110, 94, 62,  0,  0,  0,  0,237,221,  8, 63,218, 90, 91, 62,
+  0,  0,  0,  0,206,186, 16, 63, 85,129, 72, 62,  0,  0,  0,  0,222, 32, 16, 63, 34,106, 93, 62,  0,  0,  0,  0, 22,117,  9, 63,
+146,203, 97, 62,  0,  0,  0,  0, 21, 19,239, 62,121,110, 94, 62,  0,  0,  0,  0,192,187,237, 62,194,118, 73, 62,  0,  0,  0,  0,
+ 39,153,253, 62, 27,195, 91, 62,  0,  0,  0,  0,192,110,252, 62, 79, 68, 98, 62,  0,  0,  0,  0,119,125,  9, 63,  7,112,158, 62,
+  0,  0,  0,  0, 70,233,  3, 63, 88, 27,154, 62,  0,  0,  0,  0,235,229,  3, 63, 97,108,139, 62,  0,  0,  0,  0, 77, 32,  8, 63,
+ 10, 39,139, 62,  0,  0,  0,  0,235,229,  3, 63, 97,108,139, 62,  0,  0,  0,  0, 70,233,  3, 63, 88, 27,154, 62,  0,  0,  0,  0,
+165,179,252, 62,163,140,158, 62,  0,  0,  0,  0,219, 89,255, 62,116, 79,139, 62,  0,  0,  0,  0, 22,117,  9, 63,146,203, 97, 62,
+  0,  0,  0,  0, 77, 32,  8, 63, 10, 39,139, 62,  0,  0,  0,  0,235,229,  3, 63, 97,108,139, 62,  0,  0,  0,  0,246,215,  3, 63,
+143, 56,101, 62,  0,  0,  0,  0,235,229,  3, 63, 97,108,139, 62,  0,  0,  0,  0,219, 89,255, 62,116, 79,139, 62,  0,  0,  0,  0,
+192,110,252, 62, 79, 68, 98, 62,  0,  0,  0,  0,246,215,  3, 63,143, 56,101, 62,  0,  0,  0,  0,147,210,  3, 63,221, 95, 86, 62,
+  0,  0,  0,  0,237,221,  8, 63,218, 90, 91, 62,  0,  0,  0,  0, 22,117,  9, 63,146,203, 97, 62,  0,  0,  0,  0,246,215,  3, 63,
+143, 56,101, 62,  0,  0,  0,  0,192,110,252, 62, 79, 68, 98, 62,  0,  0,  0,  0, 39,153,253, 62, 27,195, 91, 62,  0,  0,  0,  0,
+147,210,  3, 63,221, 95, 86, 62,  0,  0,  0,  0,246,215,  3, 63,143, 56,101, 62,  0,  0,  0,  0,  5, 54, 12, 63,188,183,167, 62,
+  0,  0,  0,  0,250, 61,  9, 63,252,214,168, 62,  0,  0,  0,  0,152,143,  8, 63, 45,107,163, 62,  0,  0,  0,  0,119,125,  9, 63,
+  7,112,158, 62,  0,  0,  0,  0,100,136,254, 62, 38,123,163, 62,  0,  0,  0,  0,110, 39,253, 62,103,224,168, 62,  0,  0,  0,  0,
+ 98, 68,247, 62,146,206,167, 62,  0,  0,  0,  0,165,179,252, 62,163,140,158, 62,  0,  0,  0,  0,135,196, 10, 63, 52,208,178, 62,
+  0,  0,  0,  0, 25,233,  8, 63,116,110,175, 62,  0,  0,  0,  0,250, 61,  9, 63,252,214,168, 62,  0,  0,  0,  0,  5, 54, 12, 63,
+188,183,167, 62,  0,  0,  0,  0,110, 39,253, 62,103,224,168, 62,  0,  0,  0,  0,102,195,253, 62,184,102,175, 62,  0,  0,  0,  0,
+ 98, 14,250, 62,149,202,178, 62,  0,  0,  0,  0, 98, 68,247, 62,146,206,167, 62,  0,  0,  0,  0, 69, 17,  4, 63,105,176,182, 62,
+  0,  0,  0,  0, 69,138,  6, 63, 80,180,177, 62,  0,  0,  0,  0, 25,233,  8, 63,116,110,175, 62,  0,  0,  0,  0,135,196, 10, 63,
+ 52,208,178, 62,  0,  0,  0,  0,102,195,253, 62,184,102,175, 62,  0,  0,  0,  0, 14, 49,  1, 63, 62,150,177, 62,  0,  0,  0,  0,
+ 69, 17,  4, 63,105,176,182, 62,  0,  0,  0,  0, 98, 14,250, 62,149,202,178, 62,  0,  0,  0,  0,209,124,  3, 63, 70,  0,177, 62,
+  0,  0,  0,  0, 11,232,  3, 63,140,  4,174, 62,  0,  0,  0,  0, 69,138,  6, 63, 80,180,177, 62,  0,  0,  0,  0, 69, 17,  4, 63,
+105,176,182, 62,  0,  0,  0,  0, 14, 49,  1, 63, 62,150,177, 62,  0,  0,  0,  0, 11,232,  3, 63,140,  4,174, 62,  0,  0,  0,  0,
+209,124,  3, 63, 70,  0,177, 62,  0,  0,  0,  0, 69, 17,  4, 63,105,176,182, 62,  0,  0,  0,  0, 70,233,  3, 63, 88, 27,154, 62,
+  0,  0,  0,  0,119,125,  9, 63,  7,112,158, 62,  0,  0,  0,  0,152,143,  8, 63, 45,107,163, 62,  0,  0,  0,  0,212,232,  3, 63,
+ 58,152,158, 62,  0,  0,  0,  0,100,136,254, 62, 38,123,163, 62,  0,  0,  0,  0,165,179,252, 62,163,140,158, 62,  0,  0,  0,  0,
+ 70,233,  3, 63, 88, 27,154, 62,  0,  0,  0,  0,212,232,  3, 63, 58,152,158, 62,  0,  0,  0,  0,212,232,  3, 63, 58,152,158, 62,
+  0,  0,  0,  0,152,143,  8, 63, 45,107,163, 62,  0,  0,  0,  0,121, 91,  7, 63,134, 51,166, 62,  0,  0,  0,  0,205,231,  3, 63,
+ 58,149,162, 62,  0,  0,  0,  0, 44,116,  0, 63,255, 56,166, 62,  0,  0,  0,  0,100,136,254, 62, 38,123,163, 62,  0,  0,  0,  0,
+212,232,  3, 63, 58,152,158, 62,  0,  0,  0,  0,205,231,  3, 63, 58,149,162, 62,  0,  0,  0,  0, 11,232,  3, 63,140,  4,174, 62,
+  0,  0,  0,  0,214,233,  3, 63,198,154,170, 62,  0,  0,  0,  0,233,110,  6, 63, 94,152,174, 62,  0,  0,  0,  0, 69,138,  6, 63,
+ 80,180,177, 62,  0,  0,  0,  0,228, 82,  1, 63, 95,140,174, 62,  0,  0,  0,  0,214,233,  3, 63,198,154,170, 62,  0,  0,  0,  0,
+ 11,232,  3, 63,140,  4,174, 62,  0,  0,  0,  0, 14, 49,  1, 63, 62,150,177, 62,  0,  0,  0,  0, 69,138,  6, 63, 80,180,177, 62,
+  0,  0,  0,  0,233,110,  6, 63, 94,152,174, 62,  0,  0,  0,  0, 59,236,  7, 63, 19,123,173, 62,  0,  0,  0,  0, 25,233,  8, 63,
+116,110,175, 62,  0,  0,  0,  0,217,185,255, 62, 92,116,173, 62,  0,  0,  0,  0,228, 82,  1, 63, 95,140,174, 62,  0,  0,  0,  0,
+ 14, 49,  1, 63, 62,150,177, 62,  0,  0,  0,  0,102,195,253, 62,184,102,175, 62,  0,  0,  0,  0, 25,233,  8, 63,116,110,175, 62,
+  0,  0,  0,  0, 59,236,  7, 63, 19,123,173, 62,  0,  0,  0,  0, 85,249,  7, 63, 92, 52,169, 62,  0,  0,  0,  0,250, 61,  9, 63,
+252,214,168, 62,  0,  0,  0,  0,160,169,255, 62,  6, 57,169, 62,  0,  0,  0,  0,217,185,255, 62, 92,116,173, 62,  0,  0,  0,  0,
+102,195,253, 62,184,102,175, 62,  0,  0,  0,  0,110, 39,253, 62,103,224,168, 62,  0,  0,  0,  0,250, 61,  9, 63,252,214,168, 62,
+  0,  0,  0,  0, 85,249,  7, 63, 92, 52,169, 62,  0,  0,  0,  0,121, 91,  7, 63,134, 51,166, 62,  0,  0,  0,  0,152,143,  8, 63,
+ 45,107,163, 62,  0,  0,  0,  0, 44,116,  0, 63,255, 56,166, 62,  0,  0,  0,  0,160,169,255, 62,  6, 57,169, 62,  0,  0,  0,  0,
+110, 39,253, 62,103,224,168, 62,  0,  0,  0,  0,100,136,254, 62, 38,123,163, 62,  0,  0,  0,  0,214,233,  3, 63,198,154,170, 62,
+  0,  0,  0,  0, 85,249,  7, 63, 92, 52,169, 62,  0,  0,  0,  0, 59,236,  7, 63, 19,123,173, 62,  0,  0,  0,  0,233,110,  6, 63,
+ 94,152,174, 62,  0,  0,  0,  0,217,185,255, 62, 92,116,173, 62,  0,  0,  0,  0,160,169,255, 62,  6, 57,169, 62,  0,  0,  0,  0,
+214,233,  3, 63,198,154,170, 62,  0,  0,  0,  0,228, 82,  1, 63, 95,140,174, 62,  0,  0,  0,  0,214,233,  3, 63,198,154,170, 62,
+  0,  0,  0,  0,205,231,  3, 63, 58,149,162, 62,  0,  0,  0,  0,121, 91,  7, 63,134, 51,166, 62,  0,  0,  0,  0, 85,249,  7, 63,
+ 92, 52,169, 62,  0,  0,  0,  0, 44,116,  0, 63,255, 56,166, 62,  0,  0,  0,  0,205,231,  3, 63, 58,149,162, 62,  0,  0,  0,  0,
+214,233,  3, 63,198,154,170, 62,  0,  0,  0,  0,160,169,255, 62,  6, 57,169, 62,  0,  0,  0,  0, 69, 17,  4, 63,105,176,182, 62,
+  0,  0,  0,  0,135,196, 10, 63, 52,208,178, 62,  0,  0,  0,  0,158,237, 12, 63, 38,241,187, 62,  0,  0,  0,  0,147,230,  3, 63,
+ 78, 47,208, 62,  0,  0,  0,  0, 15,175,245, 62,188, 14,188, 62,  0,  0,  0,  0, 98, 14,250, 62,149,202,178, 62,  0,  0,  0,  0,
+ 69, 17,  4, 63,105,176,182, 62,  0,  0,  0,  0,147,230,  3, 63, 78, 47,208, 62,  0,  0,  0,  0,135,196, 10, 63, 52,208,178, 62,
+  0,  0,  0,  0,  5, 54, 12, 63,188,183,167, 62,  0,  0,  0,  0,112,  0, 16, 63,254,246,164, 62,  0,  0,  0,  0,158,237, 12, 63,
+ 38,241,187, 62,  0,  0,  0,  0,207,187,239, 62, 19, 42,165, 62,  0,  0,  0,  0, 98, 68,247, 62,146,206,167, 62,  0,  0,  0,  0,
+ 98, 14,250, 62,149,202,178, 62,  0,  0,  0,  0, 15,175,245, 62,188, 14,188, 62,  0,  0,  0,  0,  5, 54, 12, 63,188,183,167, 62,
+  0,  0,  0,  0,119,125,  9, 63,  7,112,158, 62,  0,  0,  0,  0, 44,250, 15, 63,109,  0,154, 62,  0,  0,  0,  0,112,  0, 16, 63,
+254,246,164, 62,  0,  0,  0,  0, 56,205,239, 62,  8, 71,154, 62,  0,  0,  0,  0,165,179,252, 62,163,140,158, 62,  0,  0,  0,  0,
+ 98, 68,247, 62,146,206,167, 62,  0,  0,  0,  0,207,187,239, 62, 19, 42,165, 62,  0,  0,  0,  0,119,125,  9, 63,  7,112,158, 62,
+  0,  0,  0,  0, 77, 32,  8, 63, 10, 39,139, 62,  0,  0,  0,  0,206,243, 15, 63,182,207,136, 62,  0,  0,  0,  0, 44,250, 15, 63,
+109,  0,154, 62,  0,  0,  0,  0, 92,193,239, 62,113, 61,137, 62,  0,  0,  0,  0,219, 89,255, 62,116, 79,139, 62,  0,  0,  0,  0,
+165,179,252, 62,163,140,158, 62,  0,  0,  0,  0, 56,205,239, 62,  8, 71,154, 62,  0,  0,  0,  0, 20, 81, 25, 63, 17, 56,132, 62,
+  0,  0,  0,  0,208, 46, 27, 63,149, 35,148, 62,  0,  0,  0,  0, 44,250, 15, 63,109,  0,154, 62,  0,  0,  0,  0,206,243, 15, 63,
+182,207,136, 62,  0,  0,  0,  0, 56,205,239, 62,  8, 71,154, 62,  0,  0,  0,  0,238,166,217, 62,229,221,148, 62,  0,  0,  0,  0,
+ 54, 42,221, 62,209, 25,133, 62,  0,  0,  0,  0, 92,193,239, 62,113, 61,137, 62,  0,  0,  0,  0,208, 46, 27, 63,149, 35,148, 62,
+  0,  0,  0,  0, 36,177, 27, 63,158,151,156, 62,  0,  0,  0,  0,112,  0, 16, 63,254,246,164, 62,  0,  0,  0,  0, 44,250, 15, 63,
+109,  0,154, 62,  0,  0,  0,  0,207,187,239, 62, 19, 42,165, 62,  0,  0,  0,  0,  0,160,216, 62,127, 44,157, 62,  0,  0,  0,  0,
+238,166,217, 62,229,221,148, 62,  0,  0,  0,  0, 56,205,239, 62,  8, 71,154, 62,  0,  0,  0,  0,111,239, 27, 63,159, 77,166, 62,
+  0,  0,  0,  0,158,237, 12, 63, 38,241,187, 62,  0,  0,  0,  0,112,  0, 16, 63,254,246,164, 62,  0,  0,  0,  0, 36,177, 27, 63,
+158,151,156, 62,  0,  0,  0,  0,207,187,239, 62, 19, 42,165, 62,  0,  0,  0,  0, 15,175,245, 62,188, 14,188, 62,  0,  0,  0,  0,
+115, 21,216, 62, 14,177,166, 62,  0,  0,  0,  0,  0,160,216, 62,127, 44,157, 62,  0,  0,  0,  0,237,221,  8, 63,218, 90, 91, 62,
+  0,  0,  0,  0,147,210,  3, 63,221, 95, 86, 62,  0,  0,  0,  0,129,211,  3, 63,248,168, 83, 62,  0,  0,  0,  0,170, 33,  8, 63,
+254,149, 86, 62,  0,  0,  0,  0,129,211,  3, 63,248,168, 83, 62,  0,  0,  0,  0,147,210,  3, 63,221, 95, 86, 62,  0,  0,  0,  0,
+ 39,153,253, 62, 27,195, 91, 62,  0,  0,  0,  0,  8, 14,255, 62, 58,232, 86, 62,  0,  0,  0,  0, 68,214,  9, 63,246,237, 66, 62,
+  0,  0,  0,  0,237,221,  8, 63,218, 90, 91, 62,  0,  0,  0,  0,170, 33,  8, 63,254,149, 86, 62,  0,  0,  0,  0, 20,180,  8, 63,
+ 94, 29, 69, 62,  0,  0,  0,  0,  8, 14,255, 62, 58,232, 86, 62,  0,  0,  0,  0, 39,153,253, 62, 27,195, 91, 62,  0,  0,  0,  0,
+104,137,251, 62,179, 92, 67, 62,  0,  0,  0,  0, 19,210,253, 62, 55,114, 69, 62,  0,  0,  0,  0,250, 61,  7, 63,148, 31, 54, 62,
+  0,  0,  0,  0, 68,214,  9, 63,246,237, 66, 62,  0,  0,  0,  0, 20,180,  8, 63, 94, 29, 69, 62,  0,  0,  0,  0,168, 82,  6, 63,
+ 80, 43, 57, 62,  0,  0,  0,  0, 19,210,253, 62, 55,114, 69, 62,  0,  0,  0,  0,104,137,251, 62,179, 92, 67, 62,  0,  0,  0,  0,
+175, 87,  0, 63,251, 90, 54, 62,  0,  0,  0,  0, 48, 68,  1, 63,166, 84, 57, 62,  0,  0,  0,  0,193,202,  3, 63,214,174, 49, 62,
+  0,  0,  0,  0,250, 61,  7, 63,148, 31, 54, 62,  0,  0,  0,  0,168, 82,  6, 63, 80, 43, 57, 62,  0,  0,  0,  0,205,202,  3, 63,
+  8, 22, 54, 62,  0,  0,  0,  0, 48, 68,  1, 63,166, 84, 57, 62,  0,  0,  0,  0,175, 87,  0, 63,251, 90, 54, 62,  0,  0,  0,  0,
+193,202,  3, 63,214,174, 49, 62,  0,  0,  0,  0,205,202,  3, 63,  8, 22, 54, 62,  0,  0,  0,  0,205,202,  3, 63,  8, 22, 54, 62,
+  0,  0,  0,  0,168, 82,  6, 63, 80, 43, 57, 62,  0,  0,  0,  0,246, 24,  5, 63, 26,150, 66, 62,  0,  0,  0,  0,213,205,  3, 63,
+220,232, 64, 62,  0,  0,  0,  0, 29,131,  2, 63, 22,172, 66, 62,  0,  0,  0,  0, 48, 68,  1, 63,166, 84, 57, 62,  0,  0,  0,  0,
+205,202,  3, 63,  8, 22, 54, 62,  0,  0,  0,  0,213,205,  3, 63,220,232, 64, 62,  0,  0,  0,  0,168, 82,  6, 63, 80, 43, 57, 62,
+  0,  0,  0,  0, 20,180,  8, 63, 94, 29, 69, 62,  0,  0,  0,  0, 39, 83,  6, 63,191,114, 70, 62,  0,  0,  0,  0,246, 24,  5, 63,
+ 26,150, 66, 62,  0,  0,  0,  0,185, 75,  1, 63,222,160, 70, 62,  0,  0,  0,  0, 19,210,253, 62, 55,114, 69, 62,  0,  0,  0,  0,
+ 48, 68,  1, 63,166, 84, 57, 62,  0,  0,  0,  0, 29,131,  2, 63, 22,172, 66, 62,  0,  0,  0,  0, 20,180,  8, 63, 94, 29, 69, 62,
+  0,  0,  0,  0,170, 33,  8, 63,254,149, 86, 62,  0,  0,  0,  0,  4,111,  6, 63, 40,172, 76, 62,  0,  0,  0,  0, 39, 83,  6, 63,
+191,114, 70, 62,  0,  0,  0,  0,157, 51,  1, 63,158,218, 76, 62,  0,  0,  0,  0,  8, 14,255, 62, 58,232, 86, 62,  0,  0,  0,  0,
+ 19,210,253, 62, 55,114, 69, 62,  0,  0,  0,  0,185, 75,  1, 63,222,160, 70, 62,  0,  0,  0,  0,170, 33,  8, 63,254,149, 86, 62,
+  0,  0,  0,  0,129,211,  3, 63,248,168, 83, 62,  0,  0,  0,  0,234,208,  3, 63,146, 43, 75, 62,  0,  0,  0,  0,  4,111,  6, 63,
+ 40,172, 76, 62,  0,  0,  0,  0,234,208,  3, 63,146, 43, 75, 62,  0,  0,  0,  0,129,211,  3, 63,248,168, 83, 62,  0,  0,  0,  0,
+  8, 14,255, 62, 58,232, 86, 62,  0,  0,  0,  0,157, 51,  1, 63,158,218, 76, 62,  0,  0,  0,  0,234,208,  3, 63,146, 43, 75, 62,
+  0,  0,  0,  0,213,205,  3, 63,220,232, 64, 62,  0,  0,  0,  0,246, 24,  5, 63, 26,150, 66, 62,  0,  0,  0,  0,  4,111,  6, 63,
+ 40,172, 76, 62,  0,  0,  0,  0, 29,131,  2, 63, 22,172, 66, 62,  0,  0,  0,  0,213,205,  3, 63,220,232, 64, 62,  0,  0,  0,  0,
+234,208,  3, 63,146, 43, 75, 62,  0,  0,  0,  0,157, 51,  1, 63,158,218, 76, 62,  0,  0,  0,  0,  4,111,  6, 63, 40,172, 76, 62,
+  0,  0,  0,  0,246, 24,  5, 63, 26,150, 66, 62,  0,  0,  0,  0, 39, 83,  6, 63,191,114, 70, 62,  0,  0,  0,  0,185, 75,  1, 63,
+222,160, 70, 62,  0,  0,  0,  0, 29,131,  2, 63, 22,172, 66, 62,  0,  0,  0,  0,157, 51,  1, 63,158,218, 76, 62,  0,  0,  0,  0,
+ 64,  2, 13, 63, 52,215,230, 62,  0,  0,  0,  0,149,244, 14, 63,  4, 42,221, 62,  0,  0,  0,  0,  4,216, 16, 63,160, 24,224, 62,
+  0,  0,  0,  0,120,200, 15, 63, 84,255,231, 62,  0,  0,  0,  0,119,193,237, 62,190, 38,224, 62,  0,  0,  0,  0,141,144,241, 62,
+244, 52,221, 62,  0,  0,  0,  0,219,100,245, 62,184,230,230, 62,  0,  0,  0,  0, 21,211,239, 62,185, 18,232, 62,  0,  0,  0,  0,
+ 71, 25, 13, 63,116,163,243, 62,  0,  0,  0,  0, 64,  2, 13, 63, 52,215,230, 62,  0,  0,  0,  0,120,200, 15, 63, 84,255,231, 62,
+  0,  0,  0,  0,184,171, 16, 63, 40,133,241, 62,  0,  0,  0,  0, 21,211,239, 62,185, 18,232, 62,  0,  0,  0,  0,219,100,245, 62,
+184,230,230, 62,  0,  0,  0,  0,  0, 45,245, 62,206,185,243, 62,  0,  0,  0,  0,218,252,237, 62, 62,160,241, 62,  0,  0,  0,  0,
+103, 59, 17, 63,120,195,255, 62,  0,  0,  0,  0, 71, 25, 13, 63,116,163,243, 62,  0,  0,  0,  0,184,171, 16, 63, 40,133,241, 62,
+  0,  0,  0,  0, 55, 44, 19, 63, 86, 21,250, 62,  0,  0,  0,  0,218,252,237, 62, 62,160,241, 62,  0,  0,  0,  0,  0, 45,245, 62,
+206,185,243, 62,  0,  0,  0,  0,209,213,236, 62,  4,250,255, 62,  0,  0,  0,  0,153,228,232, 62,154, 67,250, 62,  0,  0,  0,  0,
+149,244, 14, 63,  4, 42,221, 62,  0,  0,  0,  0, 15, 97, 17, 63,220, 34,214, 62,  0,  0,  0,  0,217, 53, 19, 63, 16,211,218, 62,
+  0,  0,  0,  0,  4,216, 16, 63,160, 24,224, 62,  0,  0,  0,  0,  8, 14,233, 62, 66,226,218, 62,  0,  0,  0,  0,217,200,236, 62,
+134, 49,214, 62,  0,  0,  0,  0,141,144,241, 62,244, 52,221, 62,  0,  0,  0,  0,119,193,237, 62,190, 38,224, 62,  0,  0,  0,  0,
+ 15, 97, 17, 63,220, 34,214, 62,  0,  0,  0,  0,165,178, 27, 63,128, 17,208, 62,  0,  0,  0,  0,205,198, 26, 63,124,184,214, 62,
+  0,  0,  0,  0,217, 53, 19, 63, 16,211,218, 62,  0,  0,  0,  0,216,214,217, 62,218,224,214, 62,  0,  0,  0,  0,  6, 24,216, 62,
+128, 57,208, 62,  0,  0,  0,  0,217,200,236, 62,134, 49,214, 62,  0,  0,  0,  0,  8, 14,233, 62, 66,226,218, 62,  0,  0,  0,  0,
+165,178, 27, 63,128, 17,208, 62,  0,  0,  0,  0, 14,120, 33, 63,166,238,214, 62,  0,  0,  0,  0,156,136, 31, 63,194,138,219, 62,
+  0,  0,  0,  0,205,198, 26, 63,124,184,214, 62,  0,  0,  0,  0,254, 30,208, 62,204,177,219, 62,  0,  0,  0,  0,168, 75,204, 62,
+ 62,  7,215, 62,  0,  0,  0,  0,  6, 24,216, 62,128, 57,208, 62,  0,  0,  0,  0,216,214,217, 62,218,224,214, 62,  0,  0,  0,  0,
+ 14,120, 33, 63,166,238,214, 62,  0,  0,  0,  0,140,149, 38, 63, 38, 95,229, 62,  0,  0,  0,  0, 79,  9, 36, 63, 94,224,229, 62,
+  0,  0,  0,  0,156,136, 31, 63,194,138,219, 62,  0,  0,  0,  0,148,192,198, 62,182, 11,230, 62,  0,  0,  0,  0,168,140,193, 62,
+ 94,129,229, 62,  0,  0,  0,  0,168, 75,204, 62, 62,  7,215, 62,  0,  0,  0,  0,254, 30,208, 62,204,177,219, 62,  0,  0,  0,  0,
+140,149, 38, 63, 38, 95,229, 62,  0,  0,  0,  0, 92, 62, 39, 63,121, 75,240, 62,  0,  0,  0,  0, 14, 49, 36, 63,253, 88,239, 62,
+  0,  0,  0,  0, 79,  9, 36, 63, 94,224,229, 62,  0,  0,  0,  0, 97, 71,198, 62,192,149,239, 62,  0,  0,  0,  0,222, 10,192, 62,
+163,128,240, 62,  0,  0,  0,  0,168,140,193, 62, 94,129,229, 62,  0,  0,  0,  0,148,192,198, 62,182, 11,230, 62,  0,  0,  0,  0,
+ 92, 62, 39, 63,121, 75,240, 62,  0,  0,  0,  0, 25,113, 37, 63, 35,157,247, 62,  0,  0,  0,  0,243, 33, 35, 63, 80,143,245, 62,
+  0,  0,  0,  0, 14, 49, 36, 63,253, 88,239, 62,  0,  0,  0,  0, 87, 99,200, 62,172,217,245, 62,  0,  0,  0,  0,189,165,195, 62,
+139,232,247, 62,  0,  0,  0,  0,222, 10,192, 62,163,128,240, 62,  0,  0,  0,  0, 97, 71,198, 62,192,149,239, 62,  0,  0,  0,  0,
+ 25,113, 37, 63, 35,157,247, 62,  0,  0,  0,  0, 96, 49, 30, 63,121,229,254, 62,  0,  0,  0,  0,223, 49, 29, 63,199,140,250, 62,
+  0,  0,  0,  0,243, 33, 35, 63, 80,143,245, 62,  0,  0,  0,  0,147,124,212, 62,146,215,250, 62,  0,  0,  0,  0,176,116,210, 62,
+227, 62,255, 62,  0,  0,  0,  0,189,165,195, 62,139,232,247, 62,  0,  0,  0,  0, 87, 99,200, 62,172,217,245, 62,  0,  0,  0,  0,
+ 96, 49, 30, 63,121,229,254, 62,  0,  0,  0,  0,151,182, 25, 63,130,  9,  1, 63,  0,  0,  0,  0, 50,181, 25, 63,118,111,253, 62,
+  0,  0,  0,  0,223, 49, 29, 63,199,140,250, 62,  0,  0,  0,  0, 52,151,219, 62, 68,186,253, 62,  0,  0,  0,  0,213,150,219, 62,
+ 50, 55,  1, 63,  0,  0,  0,  0,176,116,210, 62,227, 62,255, 62,  0,  0,  0,  0,147,124,212, 62,146,215,250, 62,  0,  0,  0,  0,
+151,182, 25, 63,130,  9,  1, 63,  0,  0,  0,  0,240, 81, 22, 63,114, 70,  1, 63,  0,  0,  0,  0,241,188, 22, 63, 28,149,253, 62,
+  0,  0,  0,  0, 50,181, 25, 63,118,111,253, 62,  0,  0,  0,  0,212,163,225, 62, 91,215,253, 62,  0,  0,  0,  0,106,128,226, 62,
+198,111,  1, 63,  0,  0,  0,  0,213,150,219, 62, 50, 55,  1, 63,  0,  0,  0,  0, 52,151,219, 62, 68,186,253, 62,  0,  0,  0,  0,
+240, 81, 22, 63,114, 70,  1, 63,  0,  0,  0,  0,103, 59, 17, 63,120,195,255, 62,  0,  0,  0,  0, 55, 44, 19, 63, 86, 21,250, 62,
+  0,  0,  0,  0,241,188, 22, 63, 28,149,253, 62,  0,  0,  0,  0,153,228,232, 62,154, 67,250, 62,  0,  0,  0,  0,209,213,236, 62,
+  4,250,255, 62,  0,  0,  0,  0,106,128,226, 62,198,111,  1, 63,  0,  0,  0,  0,212,163,225, 62, 91,215,253, 62,  0,  0,  0,  0,
+241,188, 22, 63, 28,149,253, 62,  0,  0,  0,  0, 55, 44, 19, 63, 86, 21,250, 62,  0,  0,  0,  0,  9,165, 20, 63,248, 99,247, 62,
+  0,  0,  0,  0, 20,  0, 23, 63,  6, 57,251, 62,  0,  0,  0,  0,232,232,229, 62, 74,142,247, 62,  0,  0,  0,  0,153,228,232, 62,
+154, 67,250, 62,  0,  0,  0,  0,212,163,225, 62, 91,215,253, 62,  0,  0,  0,  0,145, 26,225, 62,114,116,251, 62,  0,  0,  0,  0,
+ 50,181, 25, 63,118,111,253, 62,  0,  0,  0,  0,241,188, 22, 63, 28,149,253, 62,  0,  0,  0,  0, 20,  0, 23, 63,  6, 57,251, 62,
+  0,  0,  0,  0,130,144, 25, 63,128,  7,251, 62,  0,  0,  0,  0,145, 26,225, 62,114,116,251, 62,  0,  0,  0,  0,212,163,225, 62,
+ 91,215,253, 62,  0,  0,  0,  0, 52,151,219, 62, 68,186,253, 62,  0,  0,  0,  0,177,225,219, 62, 67, 75,251, 62,  0,  0,  0,  0,
+223, 49, 29, 63,199,140,250, 62,  0,  0,  0,  0, 50,181, 25, 63,118,111,253, 62,  0,  0,  0,  0,130,144, 25, 63,128,  7,251, 62,
+  0,  0,  0,  0, 80,195, 28, 63, 55,166,248, 62,  0,  0,  0,  0,177,225,219, 62, 67, 75,251, 62,  0,  0,  0,  0, 52,151,219, 62,
+ 68,186,253, 62,  0,  0,  0,  0,147,124,212, 62,146,215,250, 62,  0,  0,  0,  0,233, 95,213, 62, 20,237,248, 62,  0,  0,  0,  0,
+243, 33, 35, 63, 80,143,245, 62,  0,  0,  0,  0,223, 49, 29, 63,199,140,250, 62,  0,  0,  0,  0, 80,195, 28, 63, 55,166,248, 62,
+  0,  0,  0,  0, 22,164, 33, 63,102, 75,243, 62,  0,  0,  0,  0,233, 95,213, 62, 20,237,248, 62,  0,  0,  0,  0,147,124,212, 62,
+146,215,250, 62,  0,  0,  0,  0, 87, 99,200, 62,172,217,245, 62,  0,  0,  0,  0, 65,114,203, 62,159,143,243, 62,  0,  0,  0,  0,
+ 14, 49, 36, 63,253, 88,239, 62,  0,  0,  0,  0,243, 33, 35, 63, 80,143,245, 62,  0,  0,  0,  0, 22,164, 33, 63,102, 75,243, 62,
+  0,  0,  0,  0, 30,160, 34, 63,169, 47,238, 62,  0,  0,  0,  0, 65,114,203, 62,159,143,243, 62,  0,  0,  0,  0, 87, 99,200, 62,
+172,217,245, 62,  0,  0,  0,  0, 97, 71,198, 62,192,149,239, 62,  0,  0,  0,  0,188,128,201, 62,126,110,238, 62,  0,  0,  0,  0,
+ 79,  9, 36, 63, 94,224,229, 62,  0,  0,  0,  0, 14, 49, 36, 63,253, 88,239, 62,  0,  0,  0,  0, 30,160, 34, 63,169, 47,238, 62,
+  0,  0,  0,  0,131,144, 34, 63,253, 87,231, 62,  0,  0,  0,  0,188,128,201, 62,126,110,238, 62,  0,  0,  0,  0, 97, 71,198, 62,
+192,149,239, 62,  0,  0,  0,  0,148,192,198, 62,182, 11,230, 62,  0,  0,  0,  0,141,190,201, 62,124,140,231, 62,  0,  0,  0,  0,
+156,136, 31, 63,194,138,219, 62,  0,  0,  0,  0, 79,  9, 36, 63, 94,224,229, 62,  0,  0,  0,  0,131,144, 34, 63,253, 87,231, 62,
+  0,  0,  0,  0, 21,208, 30, 63,174,182,221, 62,  0,  0,  0,  0,141,190,201, 62,124,140,231, 62,  0,  0,  0,  0,148,192,198, 62,
+182, 11,230, 62,  0,  0,  0,  0,254, 30,208, 62,204,177,219, 62,  0,  0,  0,  0,168,133,209, 62, 51,221,221, 62,  0,  0,  0,  0,
+205,198, 26, 63,124,184,214, 62,  0,  0,  0,  0,156,136, 31, 63,194,138,219, 62,  0,  0,  0,  0, 21,208, 30, 63,174,182,221, 62,
+  0,  0,  0,  0,128,218, 26, 63, 68,206,217, 62,  0,  0,  0,  0,168,133,209, 62, 51,221,221, 62,  0,  0,  0,  0,254, 30,208, 62,
+204,177,219, 62,  0,  0,  0,  0,216,214,217, 62,218,224,214, 62,  0,  0,  0,  0, 11,157,217, 62, 64,243,217, 62,  0,  0,  0,  0,
+217, 53, 19, 63, 16,211,218, 62,  0,  0,  0,  0,205,198, 26, 63,124,184,214, 62,  0,  0,  0,  0,128,218, 26, 63, 68,206,217, 62,
+  0,  0,  0,  0,103, 53, 20, 63,236, 84,221, 62,  0,  0,  0,  0, 11,157,217, 62, 64,243,217, 62,  0,  0,  0,  0,216,214,217, 62,
+218,224,214, 62,  0,  0,  0,  0,  8, 14,233, 62, 66,226,218, 62,  0,  0,  0,  0, 68,  5,231, 62,234,101,221, 62,  0,  0,  0,  0,
+  4,216, 16, 63,160, 24,224, 62,  0,  0,  0,  0,217, 53, 19, 63, 16,211,218, 62,  0,  0,  0,  0,103, 53, 20, 63,236, 84,221, 62,
+  0,  0,  0,  0, 81, 87, 18, 63, 33,175,226, 62,  0,  0,  0,  0, 68,  5,231, 62,234,101,221, 62,  0,  0,  0,  0,  8, 14,233, 62,
+ 66,226,218, 62,  0,  0,  0,  0,119,193,237, 62,190, 38,224, 62,  0,  0,  0,  0,180,187,234, 62,249,190,226, 62,  0,  0,  0,  0,
+ 55, 44, 19, 63, 86, 21,250, 62,  0,  0,  0,  0,184,171, 16, 63, 40,133,241, 62,  0,  0,  0,  0, 98, 68, 18, 63,150,197,240, 62,
+  0,  0,  0,  0,  9,165, 20, 63,248, 99,247, 62,  0,  0,  0,  0, 35,197,234, 62,215,226,240, 62,  0,  0,  0,  0,218,252,237, 62,
+ 62,160,241, 62,  0,  0,  0,  0,153,228,232, 62,154, 67,250, 62,  0,  0,  0,  0,232,232,229, 62, 74,142,247, 62,  0,  0,  0,  0,
+184,171, 16, 63, 40,133,241, 62,  0,  0,  0,  0,120,200, 15, 63, 84,255,231, 62,  0,  0,  0,  0,161,  4, 18, 63,138,184,232, 62,
+  0,  0,  0,  0, 98, 68, 18, 63,150,197,240, 62,  0,  0,  0,  0,154, 85,235, 62, 92,206,232, 62,  0,  0,  0,  0, 21,211,239, 62,
+185, 18,232, 62,  0,  0,  0,  0,218,252,237, 62, 62,160,241, 62,  0,  0,  0,  0, 35,197,234, 62,215,226,240, 62,  0,  0,  0,  0,
+120,200, 15, 63, 84,255,231, 62,  0,  0,  0,  0,  4,216, 16, 63,160, 24,224, 62,  0,  0,  0,  0, 81, 87, 18, 63, 33,175,226, 62,
+  0,  0,  0,  0,161,  4, 18, 63,138,184,232, 62,  0,  0,  0,  0,180,187,234, 62,249,190,226, 62,  0,  0,  0,  0,119,193,237, 62,
+190, 38,224, 62,  0,  0,  0,  0, 21,211,239, 62,185, 18,232, 62,  0,  0,  0,  0,154, 85,235, 62, 92,206,232, 62,  0,  0,  0,  0,
+148,232,  3, 63,164, 17, 11, 63,  0,  0,  0,  0, 67,169, 11, 63, 18,197, 11, 63,  0,  0,  0,  0,216,120, 13, 63,160, 81, 23, 63,
+  0,  0,  0,  0,147, 15,  4, 63,227,248, 23, 63,  0,  0,  0,  0, 64, 27,245, 62,100,166, 23, 63,  0,  0,  0,  0, 55, 72,248, 62,
+ 91,232, 11, 63,  0,  0,  0,  0,148,232,  3, 63,164, 17, 11, 63,  0,  0,  0,  0,147, 15,  4, 63,227,248, 23, 63,  0,  0,  0,  0,
+ 67,169, 11, 63, 18,197, 11, 63,  0,  0,  0,  0,173,244, 22, 63,236,215, 11, 63,  0,  0,  0,  0, 94,233, 23, 63,186, 60, 16, 63,
+  0,  0,  0,  0,216,120, 13, 63,160, 81, 23, 63,  0,  0,  0,  0,109,130,223, 62,118,165, 16, 63,  0,  0,  0,  0,220, 89,225, 62,
+ 77, 42, 12, 63,  0,  0,  0,  0, 55, 72,248, 62, 91,232, 11, 63,  0,  0,  0,  0, 64, 27,245, 62,100,166, 23, 63,  0,  0,  0,  0,
+173,244, 22, 63,236,215, 11, 63,  0,  0,  0,  0, 28,105, 26, 63,242,194, 11, 63,  0,  0,  0,  0,220, 56, 28, 63, 66,250, 14, 63,
+  0,  0,  0,  0, 94,233, 23, 63,186, 60, 16, 63,  0,  0,  0,  0,157,161,214, 62,219,110, 15, 63,  0,  0,  0,  0,220, 73,218, 62,
+169, 31, 12, 63,  0,  0,  0,  0,220, 89,225, 62, 77, 42, 12, 63,  0,  0,  0,  0,109,130,223, 62,118,165, 16, 63,  0,  0,  0,  0,
+ 28,105, 26, 63,242,194, 11, 63,  0,  0,  0,  0,220,158, 34, 63,175, 23, 10, 63,  0,  0,  0,  0,109, 44, 39, 63,107,221, 19, 63,
+  0,  0,  0,  0,220, 56, 28, 63, 66,250, 14, 63,  0,  0,  0,  0,156, 26,192, 62, 31,139, 20, 63,  0,  0,  0,  0,124,109,201, 62,
+ 72,121, 10, 63,  0,  0,  0,  0,220, 73,218, 62,169, 31, 12, 63,  0,  0,  0,  0,157,161,214, 62,219,110, 15, 63,  0,  0,  0,  0,
+220,158, 34, 63,175, 23, 10, 63,  0,  0,  0,  0,238, 88, 46, 63,146,223,  2, 63,  0,  0,  0,  0,242, 80, 56, 63, 44,244,  6, 63,
+  0,  0,  0,  0,109, 44, 39, 63,107,221, 19, 63,  0,  0,  0,  0, 61,208,156, 62,204, 16,  7, 63,  0,  0,  0,  0,173, 87,177, 62,
+102,  9,  3, 63,  0,  0,  0,  0,124,109,201, 62, 72,121, 10, 63,  0,  0,  0,  0,156, 26,192, 62, 31,139, 20, 63,  0,  0,  0,  0,
+238, 88, 46, 63,146,223,  2, 63,  0,  0,  0,  0, 62,134, 48, 63, 37,107,249, 62,  0,  0,  0,  0,195,173, 54, 63,239,106,252, 62,
+  0,  0,  0,  0,242, 80, 56, 63, 44,244,  6, 63,  0,  0,  0,  0,202, 36,160, 62, 94, 51,252, 62,  0,  0,  0,  0,172,229,172, 62,
+116,127,249, 62,  0,  0,  0,  0,173, 87,177, 62,102,  9,  3, 63,  0,  0,  0,  0, 61,208,156, 62,204, 16,  7, 63,  0,  0,  0,  0,
+ 62,134, 48, 63, 37,107,249, 62,  0,  0,  0,  0, 38,229, 50, 63,169, 32,226, 62,  0,  0,  0,  0,154, 88, 53, 63,240,146,221, 62,
+  0,  0,  0,  0,195,173, 54, 63,239,106,252, 62,  0,  0,  0,  0,128,172,162, 62, 17,169,221, 62,  0,  0,  0,  0,196, 39,168, 62,
+206, 11,226, 62,  0,  0,  0,  0,172,229,172, 62,116,127,249, 62,  0,  0,  0,  0,202, 36,160, 62, 94, 51,252, 62,  0,  0,  0,  0,
+ 38,229, 50, 63,169, 32,226, 62,  0,  0,  0,  0, 87, 57, 43, 63,222, 58,206, 62,  0,  0,  0,  0,240,117, 49, 63,164,138,198, 62,
+  0,  0,  0,  0,154, 88, 53, 63,240,146,221, 62,  0,  0,  0,  0,147,137,172, 62,148, 19,198, 62,  0,  0,  0,  0,130,207,184, 62,
+ 42, 27,206, 62,  0,  0,  0,  0,196, 39,168, 62,206, 11,226, 62,  0,  0,  0,  0,128,172,162, 62, 17,169,221, 62,  0,  0,  0,  0,
+ 87, 57, 43, 63,222, 58,206, 62,  0,  0,  0,  0, 91, 94, 37, 63,107,120,187, 62,  0,  0,  0,  0,156,160, 41, 63, 56,175,182, 62,
+  0,  0,  0,  0,240,117, 49, 63,164,138,198, 62,  0,  0,  0,  0,202,212,188, 62,245,163,182, 62,  0,  0,  0,  0,156, 28,197, 62,
+166,130,187, 62,  0,  0,  0,  0,130,207,184, 62, 42, 27,206, 62,  0,  0,  0,  0,147,137,172, 62,148, 19,198, 62,  0,  0,  0,  0,
+165,252, 48, 63,133, 33, 85, 62,  0,  0,  0,  0,112, 54, 48, 63, 20, 19, 96, 62,  0,  0,  0,  0,172, 36, 46, 63,208,  7,129, 62,
+  0,  0,  0,  0,240, 17, 42, 63,129, 84, 97, 62,  0,  0,  0,  0, 76, 71,181, 62,204,200,131, 62,  0,  0,  0,  0,117,121,175, 62,
+183,185,106, 62,  0,  0,  0,  0,217, 24,172, 62, 21,237, 92, 62,  0,  0,  0,  0,138, 81,187, 62, 59, 40,103, 62,  0,  0,  0,  0,
+204, 89, 48, 63,134,194,  4, 62,  0,  0,  0,  0,165,252, 48, 63,133, 33, 85, 62,  0,  0,  0,  0,240, 17, 42, 63,129, 84, 97, 62,
+  0,  0,  0,  0,160,125, 37, 63, 50,211, 46, 62,  0,  0,  0,  0,138, 81,187, 62, 59, 40,103, 62,  0,  0,  0,  0,217, 24,172, 62,
+ 21,237, 92, 62,  0,  0,  0,  0, 94,197,172, 62,109,200,  4, 62,  0,  0,  0,  0, 25,121,195, 62, 46,253, 48, 62,  0,  0,  0,  0,
+ 11, 44, 20, 63, 20, 26,163, 61,  0,  0,  0,  0,204, 89, 48, 63,134,194,  4, 62,  0,  0,  0,  0,160,125, 37, 63, 50,211, 46, 62,
+  0,  0,  0,  0, 40, 92, 24, 63,214,184, 21, 62,  0,  0,  0,  0, 25,121,195, 62, 46,253, 48, 62,  0,  0,  0,  0, 94,197,172, 62,
+109,200,  4, 62,  0,  0,  0,  0,140,122,230, 62,202,248,161, 61,  0,  0,  0,  0,216, 13,222, 62,222,116, 22, 62,  0,  0,  0,  0,
+174,254, 16, 63, 94, 45, 34, 62,  0,  0,  0,  0,219,199,  3, 63, 18, 28,229, 61,  0,  0,  0,  0, 11, 44, 20, 63, 20, 26,163, 61,
+  0,  0,  0,  0, 40, 92, 24, 63,214,184, 21, 62,  0,  0,  0,  0,140,122,230, 62,202,248,161, 61,  0,  0,  0,  0,219,199,  3, 63,
+ 18, 28,229, 61,  0,  0,  0,  0,140,248,236, 62,182,202, 34, 62,  0,  0,  0,  0,216, 13,222, 62,222,116, 22, 62,  0,  0,  0,  0,
+184,152, 21, 63,182, 47, 53, 62,  0,  0,  0,  0,174,254, 16, 63, 94, 45, 34, 62,  0,  0,  0,  0, 40, 92, 24, 63,214,184, 21, 62,
+  0,  0,  0,  0,209, 52, 25, 63, 76,140, 51, 62,  0,  0,  0,  0,216, 13,222, 62,222,116, 22, 62,  0,  0,  0,  0,140,248,236, 62,
+182,202, 34, 62,  0,  0,  0,  0,183,207,227, 62,250, 75, 54, 62,  0,  0,  0,  0,229,137,220, 62,185,228, 52, 62,  0,  0,  0,  0,
+137, 57, 22, 63, 81, 93, 61, 62,  0,  0,  0,  0,184,152, 21, 63,182, 47, 53, 62,  0,  0,  0,  0,209, 52, 25, 63, 76,140, 51, 62,
+  0,  0,  0,  0,193,166, 30, 63,114,168, 73, 62,  0,  0,  0,  0,229,137,220, 62,185,228, 52, 62,  0,  0,  0,  0,183,207,227, 62,
+250, 75, 54, 62,  0,  0,  0,  0,122,152,226, 62,190,166, 62, 62,  0,  0,  0,  0, 54,198,209, 62, 18,240, 75, 62,  0,  0,  0,  0,
+250,249, 22, 63,160,251, 88, 62,  0,  0,  0,  0,137, 57, 22, 63, 81, 93, 61, 62,  0,  0,  0,  0,193,166, 30, 63,114,168, 73, 62,
+  0,  0,  0,  0, 75,  0, 36, 63,229, 47,116, 62,  0,  0,  0,  0, 54,198,209, 62, 18,240, 75, 62,  0,  0,  0,  0,122,152,226, 62,
+190,166, 62, 62,  0,  0,  0,  0, 90, 83,225, 62, 21,153, 90, 62,  0,  0,  0,  0,211,231,199, 62,216,237,119, 62,  0,  0,  0,  0,
+193,166, 30, 63,114,168, 73, 62,  0,  0,  0,  0,160,125, 37, 63, 50,211, 46, 62,  0,  0,  0,  0,240, 17, 42, 63,129, 84, 97, 62,
+  0,  0,  0,  0, 75,  0, 36, 63,229, 47,116, 62,  0,  0,  0,  0,138, 81,187, 62, 59, 40,103, 62,  0,  0,  0,  0, 25,121,195, 62,
+ 46,253, 48, 62,  0,  0,  0,  0, 54,198,209, 62, 18,240, 75, 62,  0,  0,  0,  0,211,231,199, 62,216,237,119, 62,  0,  0,  0,  0,
+193,166, 30, 63,114,168, 73, 62,  0,  0,  0,  0,209, 52, 25, 63, 76,140, 51, 62,  0,  0,  0,  0, 40, 92, 24, 63,214,184, 21, 62,
+  0,  0,  0,  0,160,125, 37, 63, 50,211, 46, 62,  0,  0,  0,  0,216, 13,222, 62,222,116, 22, 62,  0,  0,  0,  0,229,137,220, 62,
+185,228, 52, 62,  0,  0,  0,  0, 54,198,209, 62, 18,240, 75, 62,  0,  0,  0,  0, 25,121,195, 62, 46,253, 48, 62,  0,  0,  0,  0,
+ 37,163, 36, 63,191,168,140, 62,  0,  0,  0,  0, 75,  0, 36, 63,229, 47,116, 62,  0,  0,  0,  0,240, 17, 42, 63,129, 84, 97, 62,
+  0,  0,  0,  0,172, 36, 46, 63,208,  7,129, 62,  0,  0,  0,  0,138, 81,187, 62, 59, 40,103, 62,  0,  0,  0,  0,211,231,199, 62,
+216,237,119, 62,  0,  0,  0,  0,  6, 64,199, 62,105,  6,142, 62,  0,  0,  0,  0, 76, 71,181, 62,204,200,131, 62,  0,  0,  0,  0,
+ 20, 81, 25, 63, 17, 56,132, 62,  0,  0,  0,  0,250,249, 22, 63,160,251, 88, 62,  0,  0,  0,  0, 75,  0, 36, 63,229, 47,116, 62,
+  0,  0,  0,  0, 37,163, 36, 63,191,168,140, 62,  0,  0,  0,  0,211,231,199, 62,216,237,119, 62,  0,  0,  0,  0, 90, 83,225, 62,
+ 21,153, 90, 62,  0,  0,  0,  0, 54, 42,221, 62,209, 25,133, 62,  0,  0,  0,  0,  6, 64,199, 62,105,  6,142, 62,  0,  0,  0,  0,
+208, 46, 27, 63,149, 35,148, 62,  0,  0,  0,  0, 91, 60, 36, 63,221,222,150, 62,  0,  0,  0,  0,222,170, 33, 63, 74,126,158, 62,
+  0,  0,  0,  0, 36,177, 27, 63,158,151,156, 62,  0,  0,  0,  0, 72,234,204, 62, 56, 63,159, 62,  0,  0,  0,  0,150,245,199, 62,
+ 85, 15,152, 62,  0,  0,  0,  0,238,166,217, 62,229,221,148, 62,  0,  0,  0,  0,  0,160,216, 62,127, 44,157, 62,  0,  0,  0,  0,
+ 20, 81, 25, 63, 17, 56,132, 62,  0,  0,  0,  0, 37,163, 36, 63,191,168,140, 62,  0,  0,  0,  0, 91, 60, 36, 63,221,222,150, 62,
+  0,  0,  0,  0,208, 46, 27, 63,149, 35,148, 62,  0,  0,  0,  0,150,245,199, 62, 85, 15,152, 62,  0,  0,  0,  0,  6, 64,199, 62,
+105,  6,142, 62,  0,  0,  0,  0, 54, 42,221, 62,209, 25,133, 62,  0,  0,  0,  0,238,166,217, 62,229,221,148, 62,  0,  0,  0,  0,
+111,239, 27, 63,159, 77,166, 62,  0,  0,  0,  0, 36,177, 27, 63,158,151,156, 62,  0,  0,  0,  0,222,170, 33, 63, 74,126,158, 62,
+  0,  0,  0,  0,102,212, 31, 63,144,192,164, 62,  0,  0,  0,  0, 72,234,204, 62, 56, 63,159, 62,  0,  0,  0,  0,  0,160,216, 62,
+127, 44,157, 62,  0,  0,  0,  0,115, 21,216, 62, 14,177,166, 62,  0,  0,  0,  0, 17,119,208, 62,201, 65,165, 62,  0,  0,  0,  0,
+111,239, 27, 63,159, 77,166, 62,  0,  0,  0,  0,102,212, 31, 63,144,192,164, 62,  0,  0,  0,  0,156,160, 41, 63, 56,175,182, 62,
+  0,  0,  0,  0, 91, 94, 37, 63,107,120,187, 62,  0,  0,  0,  0,202,212,188, 62,245,163,182, 62,  0,  0,  0,  0, 17,119,208, 62,
+201, 65,165, 62,  0,  0,  0,  0,115, 21,216, 62, 14,177,166, 62,  0,  0,  0,  0,156, 28,197, 62,166,130,187, 62,  0,  0,  0,  0,
+104,119,194, 62,164,189, 82, 63,  0,  0,  0,  0, 23, 73,212, 62,152,239, 90, 63,  0,  0,  0,  0,100,192,205, 62, 46,238, 97, 63,
+  0,  0,  0,  0, 38, 56,185, 62, 72,154, 91, 63,  0,  0,  0,  0,228, 94,141, 62, 86,234,100, 63,  0,  0,  0,  0, 84, 66,150, 62,
+114,154, 94, 63,  0,  0,  0,  0,230, 86,173, 62, 79, 66, 98, 63,  0,  0,  0,  0, 20,143,162, 62, 44,173,106, 63,  0,  0,  0,  0,
+ 72,122, 87, 63,216,  8, 62, 62,  0,  0,  0,  0,202,106, 84, 63,137,185,113, 62,  0,  0,  0,  0,226, 77, 72, 63,204, 21,121, 62,
+  0,  0,  0,  0,158,225, 71, 63,113, 34, 68, 62,  0,  0,  0,  0,132, 32,137, 62,181, 65,121, 62,  0,  0,  0,  0,168,179,107, 62,
+139,127,103, 62,  0,  0,  0,  0,210,147,114, 62,212,116, 61, 62,  0,  0,  0,  0,248,125,142, 62, 30,  4, 80, 62,  0,  0,  0,  0,
+158,225, 71, 63,113, 34, 68, 62,  0,  0,  0,  0,226, 77, 72, 63,204, 21,121, 62,  0,  0,  0,  0,  8,  7, 51, 63,  5,186,130, 62,
+  0,  0,  0,  0,  3,166, 49, 63,232, 57, 96, 62,  0,  0,  0,  0, 18,197,172, 62, 41,112,133, 62,  0,  0,  0,  0,132, 32,137, 62,
+181, 65,121, 62,  0,  0,  0,  0,248,125,142, 62, 30,  4, 80, 62,  0,  0,  0,  0,121,228,174, 62, 52, 79,109, 62,  0,  0,  0,  0,
+  3,166, 49, 63,232, 57, 96, 62,  0,  0,  0,  0,  8,  7, 51, 63,  5,186,130, 62,  0,  0,  0,  0,172, 36, 46, 63,208,  7,129, 62,
+  0,  0,  0,  0,112, 54, 48, 63, 20, 19, 96, 62,  0,  0,  0,  0, 76, 71,181, 62,204,200,131, 62,  0,  0,  0,  0, 18,197,172, 62,
+ 41,112,133, 62,  0,  0,  0,  0,121,228,174, 62, 52, 79,109, 62,  0,  0,  0,  0,117,121,175, 62,183,185,106, 62,  0,  0,  0,  0,
+ 37,163, 36, 63,191,168,140, 62,  0,  0,  0,  0,172, 36, 46, 63,208,  7,129, 62,  0,  0,  0,  0,  8,  7, 51, 63,  5,186,130, 62,
+  0,  0,  0,  0, 91, 60, 36, 63,221,222,150, 62,  0,  0,  0,  0, 18,197,172, 62, 41,112,133, 62,  0,  0,  0,  0, 76, 71,181, 62,
+204,200,131, 62,  0,  0,  0,  0,  6, 64,199, 62,105,  6,142, 62,  0,  0,  0,  0,150,245,199, 62, 85, 15,152, 62,  0,  0,  0,  0,
+154, 88, 53, 63,240,146,221, 62,  0,  0,  0,  0,240,117, 49, 63,164,138,198, 62,  0,  0,  0,  0,224, 19, 69, 63, 24, 68,190, 62,
+  0,  0,  0,  0, 53, 64, 74, 63,171, 31,224, 62,  0,  0,  0,  0,250, 78,134, 62,148,213,186, 62,  0,  0,  0,  0,147,137,172, 62,
+148, 19,198, 62,  0,  0,  0,  0,128,172,162, 62, 17,169,221, 62,  0,  0,  0,  0,184,112,114, 62,248,169,220, 62,  0,  0,  0,  0,
+ 54, 74,214, 62, 20, 55, 70, 63,  0,  0,  0,  0, 48,130,233, 62,188, 69, 83, 63,  0,  0,  0,  0, 23, 73,212, 62,152,239, 90, 63,
+  0,  0,  0,  0,104,119,194, 62,164,189, 82, 63,  0,  0,  0,  0, 84, 66,150, 62,114,154, 94, 63,  0,  0,  0,  0, 66,  1,153, 62,
+245,149, 81, 63,  0,  0,  0,  0, 38, 56,185, 62,102,110, 83, 63,  0,  0,  0,  0,230, 86,173, 62, 79, 66, 98, 63,  0,  0,  0,  0,
+106,242, 66, 63,202, 94, 25, 63,  0,  0,  0,  0,190,100, 70, 63,222,234, 15, 63,  0,  0,  0,  0, 90,189, 77, 63,233, 88, 17, 63,
+  0,  0,  0,  0,  8,206, 74, 63, 88,118, 27, 63,  0,  0,  0,  0, 22, 32, 96, 62, 66, 60, 16, 63,  0,  0,  0,  0, 86, 87,125, 62,
+174,  5, 15, 63,  0,  0,  0,  0, 78,187,132, 62,180, 44, 24, 63,  0,  0,  0,  0, 26, 79,108, 62,124,  1, 26, 63,  0,  0,  0,  0,
+  8,206, 74, 63, 88,118, 27, 63,  0,  0,  0,  0, 90,189, 77, 63,233, 88, 17, 63,  0,  0,  0,  0, 72,139, 85, 63,103, 51, 19, 63,
+  0,  0,  0,  0,220,119, 85, 63, 77, 71, 31, 63,  0,  0,  0,  0, 64,199, 64, 62, 26, 40, 18, 63,  0,  0,  0,  0, 22, 32, 96, 62,
+ 66, 60, 16, 63,  0,  0,  0,  0, 26, 79,108, 62,124,  1, 26, 63,  0,  0,  0,  0, 44,191, 67, 62, 90, 89, 30, 63,  0,  0,  0,  0,
+220,119, 85, 63, 77, 71, 31, 63,  0,  0,  0,  0, 72,139, 85, 63,103, 51, 19, 63,  0,  0,  0,  0,228,213,100, 63, 72,156, 20, 63,
+  0,  0,  0,  0, 18, 82, 96, 63,128,133, 34, 63,  0,  0,  0,  0,226, 50,  1, 62,184, 68, 20, 63,  0,  0,  0,  0, 64,199, 64, 62,
+ 26, 40, 18, 63,  0,  0,  0,  0, 44,191, 67, 62, 90, 89, 30, 63,  0,  0,  0,  0,194,204, 24, 62, 32,186, 34, 63,  0,  0,  0,  0,
+242, 80, 56, 63, 44,244,  6, 63,  0,  0,  0,  0,195,173, 54, 63,239,106,252, 62,  0,  0,  0,  0,115,205, 60, 63,213,150,253, 62,
+  0,  0,  0,  0,166, 14, 64, 63, 81, 80,  4, 63,  0,  0,  0,  0,190, 85,147, 62, 91,176,252, 62,  0,  0,  0,  0,202, 36,160, 62,
+ 94, 51,252, 62,  0,  0,  0,  0, 61,208,156, 62,204, 16,  7, 63,  0,  0,  0,  0,160,121,140, 62, 74,197,  3, 63,  0,  0,  0,  0,
+166, 14, 64, 63, 81, 80,  4, 63,  0,  0,  0,  0,115,205, 60, 63,213,150,253, 62,  0,  0,  0,  0, 68,103, 73, 63,233,248,  0, 63,
+  0,  0,  0,  0,248, 12, 75, 63, 64,206,  8, 63,  0,  0,  0,  0,144, 59,115, 62,102,143,255, 62,  0,  0,  0,  0,190, 85,147, 62,
+ 91,176,252, 62,  0,  0,  0,  0,160,121,140, 62, 74,197,  3, 63,  0,  0,  0,  0, 78,135,107, 62, 88,182,  7, 63,  0,  0,  0,  0,
+248, 12, 75, 63, 64,206,  8, 63,  0,  0,  0,  0, 68,103, 73, 63,233,248,  0, 63,  0,  0,  0,  0,239,151, 82, 63, 86,223,  3, 63,
+  0,  0,  0,  0,181,227, 82, 63,189,102, 11, 63,  0,  0,  0,  0, 82, 17, 77, 62,162, 98,  2, 63,  0,  0,  0,  0,144, 59,115, 62,
+102,143,255, 62,  0,  0,  0,  0, 78,135,107, 62, 88,182,  7, 63,  0,  0,  0,  0,202, 98, 75, 62,108, 43, 10, 63,  0,  0,  0,  0,
+181,227, 82, 63,189,102, 11, 63,  0,  0,  0,  0,239,151, 82, 63, 86,223,  3, 63,  0,  0,  0,  0, 92,224, 91, 63,239,144,  5, 63,
+  0,  0,  0,  0,161,148, 90, 63,146, 95, 13, 63,  0,  0,  0,  0,178, 40, 38, 62, 14,230,  3, 63,  0,  0,  0,  0, 82, 17, 77, 62,
+162, 98,  2, 63,  0,  0,  0,  0,202, 98, 75, 62,108, 43, 10, 63,  0,  0,  0,  0, 10,162, 43, 62,  8, 50, 12, 63,  0,  0,  0,  0,
+120, 89,103, 63,105, 76,  2, 63,  0,  0,  0,  0,170,179,103, 63,142,105, 12, 63,  0,  0,  0,  0,161,148, 90, 63,146, 95, 13, 63,
+  0,  0,  0,  0, 92,224, 91, 63,239,144,  5, 63,  0,  0,  0,  0, 10,162, 43, 62,  8, 50, 12, 63,  0,  0,  0,  0,168, 41,231, 61,
+158, 83, 11, 63,  0,  0,  0,  0,116,128,234, 61,200, 39,  0, 63,  0,  0,  0,  0,178, 40, 38, 62, 14,230,  3, 63,  0,  0,  0,  0,
+228,213,100, 63, 72,156, 20, 63,  0,  0,  0,  0, 72,139, 85, 63,103, 51, 19, 63,  0,  0,  0,  0,161,148, 90, 63,146, 95, 13, 63,
+  0,  0,  0,  0,170,179,103, 63,142,105, 12, 63,  0,  0,  0,  0, 10,162, 43, 62,  8, 50, 12, 63,  0,  0,  0,  0, 64,199, 64, 62,
+ 26, 40, 18, 63,  0,  0,  0,  0,226, 50,  1, 62,184, 68, 20, 63,  0,  0,  0,  0,168, 41,231, 61,158, 83, 11, 63,  0,  0,  0,  0,
+ 72,139, 85, 63,103, 51, 19, 63,  0,  0,  0,  0, 90,189, 77, 63,233, 88, 17, 63,  0,  0,  0,  0,181,227, 82, 63,189,102, 11, 63,
+  0,  0,  0,  0,161,148, 90, 63,146, 95, 13, 63,  0,  0,  0,  0,202, 98, 75, 62,108, 43, 10, 63,  0,  0,  0,  0, 22, 32, 96, 62,
+ 66, 60, 16, 63,  0,  0,  0,  0, 64,199, 64, 62, 26, 40, 18, 63,  0,  0,  0,  0, 10,162, 43, 62,  8, 50, 12, 63,  0,  0,  0,  0,
+ 90,189, 77, 63,233, 88, 17, 63,  0,  0,  0,  0,190,100, 70, 63,222,234, 15, 63,  0,  0,  0,  0,248, 12, 75, 63, 64,206,  8, 63,
+  0,  0,  0,  0,181,227, 82, 63,189,102, 11, 63,  0,  0,  0,  0, 78,135,107, 62, 88,182,  7, 63,  0,  0,  0,  0, 86, 87,125, 62,
+174,  5, 15, 63,  0,  0,  0,  0, 22, 32, 96, 62, 66, 60, 16, 63,  0,  0,  0,  0,202, 98, 75, 62,108, 43, 10, 63,  0,  0,  0,  0,
+190,100, 70, 63,222,234, 15, 63,  0,  0,  0,  0, 82,235, 60, 63, 27, 12, 12, 63,  0,  0,  0,  0,166, 14, 64, 63, 81, 80,  4, 63,
+  0,  0,  0,  0,248, 12, 75, 63, 64,206,  8, 63,  0,  0,  0,  0,160,121,140, 62, 74,197,  3, 63,  0,  0,  0,  0, 78,230,145, 62,
+148,225, 11, 63,  0,  0,  0,  0, 86, 87,125, 62,174,  5, 15, 63,  0,  0,  0,  0, 78,135,107, 62, 88,182,  7, 63,  0,  0,  0,  0,
+ 31,118, 57, 63,230, 79, 12, 63,  0,  0,  0,  0,242, 80, 56, 63, 44,244,  6, 63,  0,  0,  0,  0,166, 14, 64, 63, 81, 80,  4, 63,
+  0,  0,  0,  0, 82,235, 60, 63, 27, 12, 12, 63,  0,  0,  0,  0,160,121,140, 62, 74,197,  3, 63,  0,  0,  0,  0, 61,208,156, 62,
+204, 16,  7, 63,  0,  0,  0,  0,  0,199,152, 62, 13,133, 12, 63,  0,  0,  0,  0, 78,230,145, 62,148,225, 11, 63,  0,  0,  0,  0,
+195,240, 57, 63, 10,138, 23, 63,  0,  0,  0,  0, 82,235, 60, 63, 27, 12, 12, 63,  0,  0,  0,  0,190,100, 70, 63,222,234, 15, 63,
+  0,  0,  0,  0,106,242, 66, 63,202, 94, 25, 63,  0,  0,  0,  0, 86, 87,125, 62,174,  5, 15, 63,  0,  0,  0,  0, 78,230,145, 62,
+148,225, 11, 63,  0,  0,  0,  0,247,  7,150, 62, 96, 12, 23, 63,  0,  0,  0,  0, 78,187,132, 62,180, 44, 24, 63,  0,  0,  0,  0,
+216,120, 13, 63,160, 81, 23, 63,  0,  0,  0,  0, 94,233, 23, 63,186, 60, 16, 63,  0,  0,  0,  0,220, 56, 28, 63, 66,250, 14, 63,
+  0,  0,  0,  0,109, 44, 39, 63,107,221, 19, 63,  0,  0,  0,  0,157,161,214, 62,219,110, 15, 63,  0,  0,  0,  0,109,130,223, 62,
+118,165, 16, 63,  0,  0,  0,  0, 64, 27,245, 62,100,166, 23, 63,  0,  0,  0,  0,156, 26,192, 62, 31,139, 20, 63,  0,  0,  0,  0,
+176, 29, 56, 63, 88,206, 20, 63,  0,  0,  0,  0, 31,118, 57, 63,230, 79, 12, 63,  0,  0,  0,  0, 82,235, 60, 63, 27, 12, 12, 63,
+  0,  0,  0,  0,195,240, 57, 63, 10,138, 23, 63,  0,  0,  0,  0, 78,230,145, 62,148,225, 11, 63,  0,  0,  0,  0,  0,199,152, 62,
+ 13,133, 12, 63,  0,  0,  0,  0,239,211,153, 62,220,159, 20, 63,  0,  0,  0,  0,247,  7,150, 62, 96, 12, 23, 63,  0,  0,  0,  0,
+ 48,148, 54, 63,220,206, 22, 63,  0,  0,  0,  0,176, 29, 56, 63, 88,206, 20, 63,  0,  0,  0,  0,195,240, 57, 63, 10,138, 23, 63,
+  0,  0,  0,  0,247,  7,150, 62, 96, 12, 23, 63,  0,  0,  0,  0,239,211,153, 62,220,159, 20, 63,  0,  0,  0,  0,108,106,156, 62,
+146,154, 22, 63,  0,  0,  0,  0,195,173, 54, 63,239,106,252, 62,  0,  0,  0,  0,154, 88, 53, 63,240,146,221, 62,  0,  0,  0,  0,
+ 53, 64, 74, 63,171, 31,224, 62,  0,  0,  0,  0,115,205, 60, 63,213,150,253, 62,  0,  0,  0,  0,184,112,114, 62,248,169,220, 62,
+  0,  0,  0,  0,128,172,162, 62, 17,169,221, 62,  0,  0,  0,  0,202, 36,160, 62, 94, 51,252, 62,  0,  0,  0,  0,190, 85,147, 62,
+ 91,176,252, 62,  0,  0,  0,  0, 53, 64, 74, 63,171, 31,224, 62,  0,  0,  0,  0,217,106, 81, 63, 14,214,232, 62,  0,  0,  0,  0,
+ 68,103, 73, 63,233,248,  0, 63,  0,  0,  0,  0,115,205, 60, 63,213,150,253, 62,  0,  0,  0,  0,144, 59,115, 62,102,143,255, 62,
+  0,  0,  0,  0, 88, 93, 84, 62, 50,105,228, 62,  0,  0,  0,  0,184,112,114, 62,248,169,220, 62,  0,  0,  0,  0,190, 85,147, 62,
+ 91,176,252, 62,  0,  0,  0,  0,217,106, 81, 63, 14,214,232, 62,  0,  0,  0,  0,106,154, 93, 63,226, 26,233, 62,  0,  0,  0,  0,
+239,151, 82, 63, 86,223,  3, 63,  0,  0,  0,  0, 68,103, 73, 63,233,248,  0, 63,  0,  0,  0,  0, 82, 17, 77, 62,162, 98,  2, 63,
+  0,  0,  0,  0,128,  1, 33, 62, 70,210,226, 62,  0,  0,  0,  0, 88, 93, 84, 62, 50,105,228, 62,  0,  0,  0,  0,144, 59,115, 62,
+102,143,255, 62,  0,  0,  0,  0,120, 89,103, 63,105, 76,  2, 63,  0,  0,  0,  0, 92,224, 91, 63,239,144,  5, 63,  0,  0,  0,  0,
+239,151, 82, 63, 86,223,  3, 63,  0,  0,  0,  0,106,154, 93, 63,226, 26,233, 62,  0,  0,  0,  0, 82, 17, 77, 62,162, 98,  2, 63,
+  0,  0,  0,  0,178, 40, 38, 62, 14,230,  3, 63,  0,  0,  0,  0,116,128,234, 61,200, 39,  0, 63,  0,  0,  0,  0,128,  1, 33, 62,
+ 70,210,226, 62,  0,  0,  0,  0,  8,  7, 51, 63,  5,186,130, 62,  0,  0,  0,  0,226, 77, 72, 63,204, 21,121, 62,  0,  0,  0,  0,
+154,254, 73, 63,178, 82,140, 62,  0,  0,  0,  0, 90,188, 56, 63,103,207,159, 62,  0,  0,  0,  0,249,249,130, 62,246,175,137, 62,
+  0,  0,  0,  0,132, 32,137, 62,181, 65,121, 62,  0,  0,  0,  0, 18,197,172, 62, 41,112,133, 62,  0,  0,  0,  0,192,  5,161, 62,
+228, 40,159, 62,  0,  0,  0,  0,224, 19, 69, 63, 24, 68,190, 62,  0,  0,  0,  0, 90,188, 56, 63,103,207,159, 62,  0,  0,  0,  0,
+154,254, 73, 63,178, 82,140, 62,  0,  0,  0,  0,216,217, 77, 63,  7,228,157, 62,  0,  0,  0,  0,249,249,130, 62,246,175,137, 62,
+  0,  0,  0,  0,192,  5,161, 62,228, 40,159, 62,  0,  0,  0,  0,250, 78,134, 62,148,213,186, 62,  0,  0,  0,  0,154,118,111, 62,
+120,108,152, 62,  0,  0,  0,  0,240,117, 49, 63,164,138,198, 62,  0,  0,  0,  0,156,160, 41, 63, 56,175,182, 62,  0,  0,  0,  0,
+ 90,188, 56, 63,103,207,159, 62,  0,  0,  0,  0,224, 19, 69, 63, 24, 68,190, 62,  0,  0,  0,  0,192,  5,161, 62,228, 40,159, 62,
+  0,  0,  0,  0,202,212,188, 62,245,163,182, 62,  0,  0,  0,  0,147,137,172, 62,148, 19,198, 62,  0,  0,  0,  0,250, 78,134, 62,
+148,213,186, 62,  0,  0,  0,  0,156,160, 41, 63, 56,175,182, 62,  0,  0,  0,  0,222,170, 33, 63, 74,126,158, 62,  0,  0,  0,  0,
+ 91, 60, 36, 63,221,222,150, 62,  0,  0,  0,  0, 90,188, 56, 63,103,207,159, 62,  0,  0,  0,  0,150,245,199, 62, 85, 15,152, 62,
+  0,  0,  0,  0, 72,234,204, 62, 56, 63,159, 62,  0,  0,  0,  0,202,212,188, 62,245,163,182, 62,  0,  0,  0,  0,192,  5,161, 62,
+228, 40,159, 62,  0,  0,  0,  0, 91, 60, 36, 63,221,222,150, 62,  0,  0,  0,  0,  8,  7, 51, 63,  5,186,130, 62,  0,  0,  0,  0,
+ 90,188, 56, 63,103,207,159, 62,  0,  0,  0,  0,192,  5,161, 62,228, 40,159, 62,  0,  0,  0,  0, 18,197,172, 62, 41,112,133, 62,
+  0,  0,  0,  0,150,245,199, 62, 85, 15,152, 62,  0,  0,  0,  0,156,160, 41, 63, 56,175,182, 62,  0,  0,  0,  0,102,212, 31, 63,
+144,192,164, 62,  0,  0,  0,  0,222,170, 33, 63, 74,126,158, 62,  0,  0,  0,  0, 72,234,204, 62, 56, 63,159, 62,  0,  0,  0,  0,
+ 17,119,208, 62,201, 65,165, 62,  0,  0,  0,  0,202,212,188, 62,245,163,182, 62,  0,  0,  0,  0,226, 44,245, 62,129,140, 96, 63,
+  0,  0,  0,  0, 42,135,227, 62, 58,  2,101, 63,  0,  0,  0,  0,136,168,219, 62, 30,236, 95, 63,  0,  0,  0,  0,135, 30,238, 62,
+200, 41, 90, 63,  0,  0,  0,  0,216,240,137, 62, 90,226, 93, 63,  0,  0,  0,  0,110,103,122, 62,236,255, 92, 63,  0,  0,  0,  0,
+ 74, 84,120, 62,104, 32, 83, 63,  0,  0,  0,  0, 32,193,138, 62, 16,  3, 83, 63,  0,  0,  0,  0, 48,130,233, 62,188, 69, 83, 63,
+  0,  0,  0,  0,135, 30,238, 62,200, 41, 90, 63,  0,  0,  0,  0,136,168,219, 62, 30,236, 95, 63,  0,  0,  0,  0, 23, 73,212, 62,
+152,239, 90, 63,  0,  0,  0,  0,216,240,137, 62, 90,226, 93, 63,  0,  0,  0,  0, 32,193,138, 62, 16,  3, 83, 63,  0,  0,  0,  0,
+ 66,  1,153, 62,245,149, 81, 63,  0,  0,  0,  0, 84, 66,150, 62,114,154, 94, 63,  0,  0,  0,  0,216,217, 77, 63,  7,228,157, 62,
+  0,  0,  0,  0,154,254, 73, 63,178, 82,140, 62,  0,  0,  0,  0, 33, 61, 90, 63,195,207,124, 62,  0,  0,  0,  0,160,225, 90, 63,
+110,121,137, 62,  0,  0,  0,  0, 98,207, 81, 62,109,  1,110, 62,  0,  0,  0,  0,249,249,130, 62,246,175,137, 62,  0,  0,  0,  0,
+154,118,111, 62,120,108,152, 62,  0,  0,  0,  0,166,125, 74, 62,252, 30,130, 62,  0,  0,  0,  0,226, 77, 72, 63,204, 21,121, 62,
+  0,  0,  0,  0,202,106, 84, 63,137,185,113, 62,  0,  0,  0,  0, 33, 61, 90, 63,195,207,124, 62,  0,  0,  0,  0,154,254, 73, 63,
+178, 82,140, 62,  0,  0,  0,  0, 98,207, 81, 62,109,  1,110, 62,  0,  0,  0,  0,168,179,107, 62,139,127,103, 62,  0,  0,  0,  0,
+132, 32,137, 62,181, 65,121, 62,  0,  0,  0,  0,249,249,130, 62,246,175,137, 62,  0,  0,  0,  0, 23, 73,212, 62,152,239, 90, 63,
+  0,  0,  0,  0,136,168,219, 62, 30,236, 95, 63,  0,  0,  0,  0,100,192,205, 62, 46,238, 97, 63,  0,  0,  0,  0,228, 94,141, 62,
+ 86,234,100, 63,  0,  0,  0,  0,216,240,137, 62, 90,226, 93, 63,  0,  0,  0,  0, 84, 66,150, 62,114,154, 94, 63,  0,  0,  0,  0,
+ 31,178,109, 63,224, 68,228, 62,  0,  0,  0,  0, 46,178,102, 63,100,184,232, 62,  0,  0,  0,  0,100,251,101, 63,238,198,227, 62,
+  0,  0,  0,  0, 94,173,107, 63,168,130,225, 62,  0,  0,  0,  0, 68,209,249, 61, 70,134,219, 62,  0,  0,  0,  0,120,216,242, 61,
+124, 40,225, 62,  0,  0,  0,  0, 28, 27,177, 61, 42,240,219, 62,  0,  0,  0,  0, 76,131,196, 61,196, 97,216, 62,  0,  0,  0,  0,
+ 31,178,109, 63,224, 68,228, 62,  0,  0,  0,  0, 94,173,107, 63,168,130,225, 62,  0,  0,  0,  0,144,102,114, 63,198, 23,220, 62,
+  0,  0,  0,  0, 41, 76,116, 63,139,153,222, 62,  0,  0,  0,  0, 56,163,120, 61, 58,252,208, 62,  0,  0,  0,  0, 76,131,196, 61,
+196, 97,216, 62,  0,  0,  0,  0, 28, 27,177, 61, 42,240,219, 62,  0,  0,  0,  0,128,183, 73, 61, 84,108,213, 62,  0,  0,  0,  0,
+ 41, 76,116, 63,139,153,222, 62,  0,  0,  0,  0,144,102,114, 63,198, 23,220, 62,  0,  0,  0,  0, 84, 87,117, 63,221,255,211, 62,
+  0,  0,  0,  0,183,115,119, 63,140, 49,215, 62,  0,  0,  0,  0,144, 29, 55, 61,207,183,194, 62,  0,  0,  0,  0, 56,163,120, 61,
+ 58,252,208, 62,  0,  0,  0,  0,128,183, 73, 61, 84,108,213, 62,  0,  0,  0,  0,224,111,231, 60,100,142,198, 62,  0,  0,  0,  0,
+183,115,119, 63,140, 49,215, 62,  0,  0,  0,  0, 84, 87,117, 63,221,255,211, 62,  0,  0,  0,  0,150, 20,118, 63, 60,110,196, 62,
+  0,  0,  0,  0, 49, 12,122, 63,246,  8,197, 62,  0,  0,  0,  0, 96,197,103, 61, 15,206,170, 62,  0,  0,  0,  0,144, 29, 55, 61,
+207,183,194, 62,  0,  0,  0,  0,224,111,231, 60,100,142,198, 62,  0,  0,  0,  0,240, 54, 16, 61,120,  4,167, 62,  0,  0,  0,  0,
+ 49, 12,122, 63,246,  8,197, 62,  0,  0,  0,  0,150, 20,118, 63, 60,110,196, 62,  0,  0,  0,  0, 17,155,108, 63,130,201,178, 62,
+  0,  0,  0,  0, 84,190,110, 63,223, 77,172, 62,  0,  0,  0,  0,148,252,246, 61,164,116,160, 62,  0,  0,  0,  0, 96,197,103, 61,
+ 15,206,170, 62,  0,  0,  0,  0,240, 54, 16, 61,120,  4,167, 62,  0,  0,  0,  0,  8, 66,246, 61, 28,161,152, 62,  0,  0,  0,  0,
+ 84,190,110, 63,223, 77,172, 62,  0,  0,  0,  0, 17,155,108, 63,130,201,178, 62,  0,  0,  0,  0, 21,180, 92, 63,202, 95,173, 62,
+  0,  0,  0,  0,151,  5, 90, 63,138, 61,167, 62,  0,  0,  0,  0,144,216, 54, 62, 35, 76,163, 62,  0,  0,  0,  0,148,252,246, 61,
+164,116,160, 62,  0,  0,  0,  0,  8, 66,246, 61, 28,161,152, 62,  0,  0,  0,  0,194,251, 66, 62,163,102,158, 62,  0,  0,  0,  0,
+ 17,155,108, 63,130,201,178, 62,  0,  0,  0,  0,198,132,109, 63,182,157,186, 62,  0,  0,  0,  0, 68, 32, 97, 63,192, 12,178, 62,
+  0,  0,  0,  0, 21,180, 92, 63,202, 95,173, 62,  0,  0,  0,  0, 48,185, 36, 62, 16,  7,166, 62,  0,  0,  0,  0, 40, 91,221, 61,
+  4,194,167, 62,  0,  0,  0,  0,148,252,246, 61,164,116,160, 62,  0,  0,  0,  0,144,216, 54, 62, 35, 76,163, 62,  0,  0,  0,  0,
+150, 20,118, 63, 60,110,196, 62,  0,  0,  0,  0, 84,225,115, 63,208, 85,198, 62,  0,  0,  0,  0,198,132,109, 63,182,157,186, 62,
+  0,  0,  0,  0, 17,155,108, 63,130,201,178, 62,  0,  0,  0,  0, 40, 91,221, 61,  4,194,167, 62,  0,  0,  0,  0,244,221,134, 61,
+121,164,175, 62,  0,  0,  0,  0, 96,197,103, 61, 15,206,170, 62,  0,  0,  0,  0,148,252,246, 61,164,116,160, 62,  0,  0,  0,  0,
+ 84, 87,117, 63,221,255,211, 62,  0,  0,  0,  0,222, 48,116, 63,169,  8,209, 62,  0,  0,  0,  0, 84,225,115, 63,208, 85,198, 62,
+  0,  0,  0,  0,150, 20,118, 63, 60,110,196, 62,  0,  0,  0,  0,244,221,134, 61,121,164,175, 62,  0,  0,  0,  0,160,108, 93, 61,
+ 17,207,190, 62,  0,  0,  0,  0,144, 29, 55, 61,207,183,194, 62,  0,  0,  0,  0, 96,197,103, 61, 15,206,170, 62,  0,  0,  0,  0,
+144,102,114, 63,198, 23,220, 62,  0,  0,  0,  0,174,151,113, 63, 26,229,214, 62,  0,  0,  0,  0,222, 48,116, 63,169,  8,209, 62,
+  0,  0,  0,  0, 84, 87,117, 63,221,255,211, 62,  0,  0,  0,  0,160,108, 93, 61, 17,207,190, 62,  0,  0,  0,  0, 12,155,135, 61,
+166, 39,201, 62,  0,  0,  0,  0, 56,163,120, 61, 58,252,208, 62,  0,  0,  0,  0,144, 29, 55, 61,207,183,194, 62,  0,  0,  0,  0,
+ 94,173,107, 63,168,130,225, 62,  0,  0,  0,  0,228,239,107, 63, 62, 59,218, 62,  0,  0,  0,  0,174,151,113, 63, 26,229,214, 62,
+  0,  0,  0,  0,144,102,114, 63,198, 23,220, 62,  0,  0,  0,  0, 12,155,135, 61,166, 39,201, 62,  0,  0,  0,  0,128, 47,195, 61,
+  6, 11,207, 62,  0,  0,  0,  0, 76,131,196, 61,196, 97,216, 62,  0,  0,  0,  0, 56,163,120, 61, 58,252,208, 62,  0,  0,  0,  0,
+ 94,173,107, 63,168,130,225, 62,  0,  0,  0,  0,100,251,101, 63,238,198,227, 62,  0,  0,  0,  0, 71,205,102, 63,132, 94,219, 62,
+  0,  0,  0,  0,228,239,107, 63, 62, 59,218, 62,  0,  0,  0,  0,192,157,244, 61,157,137,209, 62,  0,  0,  0,  0, 68,209,249, 61,
+ 70,134,219, 62,  0,  0,  0,  0, 76,131,196, 61,196, 97,216, 62,  0,  0,  0,  0,128, 47,195, 61,  6, 11,207, 62,  0,  0,  0,  0,
+224, 19, 69, 63, 24, 68,190, 62,  0,  0,  0,  0,216,217, 77, 63,  7,228,157, 62,  0,  0,  0,  0,236, 35, 85, 63,164,201,181, 62,
+  0,  0,  0,  0, 56, 92, 78, 63,177,114,188, 62,  0,  0,  0,  0,122, 91, 80, 62, 72, 18,174, 62,  0,  0,  0,  0,154,118,111, 62,
+120,108,152, 62,  0,  0,  0,  0,250, 78,134, 62,148,213,186, 62,  0,  0,  0,  0,162,163,104, 62,150,180,182, 62,  0,  0,  0,  0,
+216,217, 77, 63,  7,228,157, 62,  0,  0,  0,  0,151,  5, 90, 63,138, 61,167, 62,  0,  0,  0,  0, 21,180, 92, 63,202, 95,173, 62,
+  0,  0,  0,  0,236, 35, 85, 63,164,201,181, 62,  0,  0,  0,  0,144,216, 54, 62, 35, 76,163, 62,  0,  0,  0,  0,194,251, 66, 62,
+163,102,158, 62,  0,  0,  0,  0,154,118,111, 62,120,108,152, 62,  0,  0,  0,  0,122, 91, 80, 62, 72, 18,174, 62,  0,  0,  0,  0,
+ 53, 64, 74, 63,171, 31,224, 62,  0,  0,  0,  0,224, 19, 69, 63, 24, 68,190, 62,  0,  0,  0,  0, 56, 92, 78, 63,177,114,188, 62,
+  0,  0,  0,  0,217,106, 81, 63, 14,214,232, 62,  0,  0,  0,  0,162,163,104, 62,150,180,182, 62,  0,  0,  0,  0,250, 78,134, 62,
+148,213,186, 62,  0,  0,  0,  0,184,112,114, 62,248,169,220, 62,  0,  0,  0,  0, 88, 93, 84, 62, 50,105,228, 62,  0,  0,  0,  0,
+106,154, 93, 63,226, 26,233, 62,  0,  0,  0,  0,196,229, 94, 63,128,195,224, 62,  0,  0,  0,  0,100,251,101, 63,238,198,227, 62,
+  0,  0,  0,  0, 46,178,102, 63,100,184,232, 62,  0,  0,  0,  0, 68,209,249, 61, 70,134,219, 62,  0,  0,  0,  0,108,187, 28, 62,
+ 48, 86,217, 62,  0,  0,  0,  0,128,  1, 33, 62, 70,210,226, 62,  0,  0,  0,  0,120,216,242, 61,124, 40,225, 62,  0,  0,  0,  0,
+ 21,180, 92, 63,202, 95,173, 62,  0,  0,  0,  0, 68, 32, 97, 63,192, 12,178, 62,  0,  0,  0,  0,  9,215, 94, 63,  4, 54,186, 62,
+  0,  0,  0,  0,236, 35, 85, 63,164,201,181, 62,  0,  0,  0,  0, 60,122, 41, 62, 16, 58,175, 62,  0,  0,  0,  0, 48,185, 36, 62,
+ 16,  7,166, 62,  0,  0,  0,  0,144,216, 54, 62, 35, 76,163, 62,  0,  0,  0,  0,122, 91, 80, 62, 72, 18,174, 62,  0,  0,  0,  0,
+230, 78, 95, 63,  4,233,189, 62,  0,  0,  0,  0, 32,188, 86, 63, 44, 62,190, 62,  0,  0,  0,  0,236, 35, 85, 63,164,201,181, 62,
+  0,  0,  0,  0,  9,215, 94, 63,  4, 54,186, 62,  0,  0,  0,  0,122, 91, 80, 62, 72, 18,174, 62,  0,  0,  0,  0, 78,118, 71, 62,
+ 27, 49,182, 62,  0,  0,  0,  0, 52,225, 37, 62, 40, 12,179, 62,  0,  0,  0,  0, 60,122, 41, 62, 16, 58,175, 62,  0,  0,  0,  0,
+ 70,166, 92, 63,  0,166,197, 62,  0,  0,  0,  0, 32,188, 86, 63, 44, 62,190, 62,  0,  0,  0,  0,230, 78, 95, 63,  4,233,189, 62,
+  0,  0,  0,  0,226, 13, 95, 63, 37,152,194, 62,  0,  0,  0,  0, 52,225, 37, 62, 40, 12,179, 62,  0,  0,  0,  0, 78,118, 71, 62,
+ 27, 49,182, 62,  0,  0,  0,  0,142,143, 45, 62,237, 37,188, 62,  0,  0,  0,  0,106,230, 36, 62,222, 27,184, 62,  0,  0,  0,  0,
+248, 90, 95, 63,100,122,207, 62,  0,  0,  0,  0,108,249, 90, 63, 58,199,212, 62,  0,  0,  0,  0, 32,188, 86, 63, 44, 62,190, 62,
+  0,  0,  0,  0, 70,166, 92, 63,  0,166,197, 62,  0,  0,  0,  0, 78,118, 71, 62, 27, 49,182, 62,  0,  0,  0,  0,110, 56, 48, 62,
+230, 43,205, 62,  0,  0,  0,  0,174,250, 30, 62, 26, 12,198, 62,  0,  0,  0,  0,142,143, 45, 62,237, 37,188, 62,  0,  0,  0,  0,
+196,229, 94, 63,128,195,224, 62,  0,  0,  0,  0,108,249, 90, 63, 58,199,212, 62,  0,  0,  0,  0,248, 90, 95, 63,100,122,207, 62,
+  0,  0,  0,  0, 92,104, 98, 63,197,136,215, 62,  0,  0,  0,  0,174,250, 30, 62, 26, 12,198, 62,  0,  0,  0,  0,110, 56, 48, 62,
+230, 43,205, 62,  0,  0,  0,  0,108,187, 28, 62, 48, 86,217, 62,  0,  0,  0,  0,212, 59, 15, 62,224, 50,206, 62,  0,  0,  0,  0,
+100,251,101, 63,238,198,227, 62,  0,  0,  0,  0,196,229, 94, 63,128,195,224, 62,  0,  0,  0,  0, 92,104, 98, 63,197,136,215, 62,
+  0,  0,  0,  0, 71,205,102, 63,132, 94,219, 62,  0,  0,  0,  0,212, 59, 15, 62,224, 50,206, 62,  0,  0,  0,  0,108,187, 28, 62,
+ 48, 86,217, 62,  0,  0,  0,  0, 68,209,249, 61, 70,134,219, 62,  0,  0,  0,  0,192,157,244, 61,157,137,209, 62,  0,  0,  0,  0,
+217,106, 81, 63, 14,214,232, 62,  0,  0,  0,  0,108,249, 90, 63, 58,199,212, 62,  0,  0,  0,  0,196,229, 94, 63,128,195,224, 62,
+  0,  0,  0,  0,106,154, 93, 63,226, 26,233, 62,  0,  0,  0,  0,108,187, 28, 62, 48, 86,217, 62,  0,  0,  0,  0,110, 56, 48, 62,
+230, 43,205, 62,  0,  0,  0,  0, 88, 93, 84, 62, 50,105,228, 62,  0,  0,  0,  0,128,  1, 33, 62, 70,210,226, 62,  0,  0,  0,  0,
+217,106, 81, 63, 14,214,232, 62,  0,  0,  0,  0, 56, 92, 78, 63,177,114,188, 62,  0,  0,  0,  0, 32,188, 86, 63, 44, 62,190, 62,
+  0,  0,  0,  0,108,249, 90, 63, 58,199,212, 62,  0,  0,  0,  0, 78,118, 71, 62, 27, 49,182, 62,  0,  0,  0,  0,162,163,104, 62,
+150,180,182, 62,  0,  0,  0,  0, 88, 93, 84, 62, 50,105,228, 62,  0,  0,  0,  0,110, 56, 48, 62,230, 43,205, 62,  0,  0,  0,  0,
+ 56, 92, 78, 63,177,114,188, 62,  0,  0,  0,  0,236, 35, 85, 63,164,201,181, 62,  0,  0,  0,  0, 32,188, 86, 63, 44, 62,190, 62,
+  0,  0,  0,  0, 78,118, 71, 62, 27, 49,182, 62,  0,  0,  0,  0,122, 91, 80, 62, 72, 18,174, 62,  0,  0,  0,  0,162,163,104, 62,
+150,180,182, 62,  0,  0,  0,  0, 71,205,102, 63,132, 94,219, 62,  0,  0,  0,  0, 92,104, 98, 63,197,136,215, 62,  0,  0,  0,  0,
+182,109,100, 63,149,255,210, 62,  0,  0,  0,  0, 54, 86,104, 63,209,241,214, 62,  0,  0,  0,  0,160,107,  7, 62, 34,103,200, 62,
+  0,  0,  0,  0,212, 59, 15, 62,224, 50,206, 62,  0,  0,  0,  0,192,157,244, 61,157,137,209, 62,  0,  0,  0,  0,  8,  2,232, 61,
+ 20,214,203, 62,  0,  0,  0,  0, 92,104, 98, 63,197,136,215, 62,  0,  0,  0,  0,248, 90, 95, 63,100,122,207, 62,  0,  0,  0,  0,
+112,206, 97, 63, 10,202,204, 62,  0,  0,  0,  0,182,109,100, 63,149,255,210, 62,  0,  0,  0,  0, 64, 68, 21, 62,107, 55,194, 62,
+  0,  0,  0,  0,174,250, 30, 62, 26, 12,198, 62,  0,  0,  0,  0,212, 59, 15, 62,224, 50,206, 62,  0,  0,  0,  0,160,107,  7, 62,
+ 34,103,200, 62,  0,  0,  0,  0,248, 90, 95, 63,100,122,207, 62,  0,  0,  0,  0, 70,166, 92, 63,  0,166,197, 62,  0,  0,  0,  0,
+ 82,241, 94, 63, 40,103,198, 62,  0,  0,  0,  0,112,206, 97, 63, 10,202,204, 62,  0,  0,  0,  0, 20,225, 35, 62, 39, 50,188, 62,
+  0,  0,  0,  0,142,143, 45, 62,237, 37,188, 62,  0,  0,  0,  0,174,250, 30, 62, 26, 12,198, 62,  0,  0,  0,  0, 64, 68, 21, 62,
+107, 55,194, 62,  0,  0,  0,  0, 70,166, 92, 63,  0,166,197, 62,  0,  0,  0,  0,226, 13, 95, 63, 37,152,194, 62,  0,  0,  0,  0,
+118,  1, 97, 63, 47,226,195, 62,  0,  0,  0,  0, 82,241, 94, 63, 40,103,198, 62,  0,  0,  0,  0, 12, 43, 28, 62,186,177,184, 62,
+  0,  0,  0,  0,106,230, 36, 62,222, 27,184, 62,  0,  0,  0,  0,142,143, 45, 62,237, 37,188, 62,  0,  0,  0,  0, 20,225, 35, 62,
+ 39, 50,188, 62,  0,  0,  0,  0,226, 13, 95, 63, 37,152,194, 62,  0,  0,  0,  0,230, 78, 95, 63,  4,233,189, 62,  0,  0,  0,  0,
+ 51,113, 97, 63, 92,151,189, 62,  0,  0,  0,  0,118,  1, 97, 63, 47,226,195, 62,  0,  0,  0,  0,104, 67, 29, 62, 58,199,177, 62,
+  0,  0,  0,  0, 52,225, 37, 62, 40, 12,179, 62,  0,  0,  0,  0,106,230, 36, 62,222, 27,184, 62,  0,  0,  0,  0, 12, 43, 28, 62,
+186,177,184, 62,  0,  0,  0,  0,230, 78, 95, 63,  4,233,189, 62,  0,  0,  0,  0,  9,215, 94, 63,  4, 54,186, 62,  0,  0,  0,  0,
+ 96, 69, 96, 63,152,133,187, 62,  0,  0,  0,  0, 51,113, 97, 63, 92,151,189, 62,  0,  0,  0,  0,140, 14, 35, 62, 33, 19,176, 62,
+  0,  0,  0,  0, 60,122, 41, 62, 16, 58,175, 62,  0,  0,  0,  0, 52,225, 37, 62, 40, 12,179, 62,  0,  0,  0,  0,104, 67, 29, 62,
+ 58,199,177, 62,  0,  0,  0,  0,  9,215, 94, 63,  4, 54,186, 62,  0,  0,  0,  0, 68, 32, 97, 63,192, 12,178, 62,  0,  0,  0,  0,
+112, 91, 98, 63,149,128,182, 62,  0,  0,  0,  0, 96, 69, 96, 63,152,133,187, 62,  0,  0,  0,  0,228,107, 29, 62, 95,230,169, 62,
+  0,  0,  0,  0, 48,185, 36, 62, 16,  7,166, 62,  0,  0,  0,  0, 60,122, 41, 62, 16, 58,175, 62,  0,  0,  0,  0,140, 14, 35, 62,
+ 33, 19,176, 62,  0,  0,  0,  0,228,239,107, 63, 62, 59,218, 62,  0,  0,  0,  0, 71,205,102, 63,132, 94,219, 62,  0,  0,  0,  0,
+ 54, 86,104, 63,209,241,214, 62,  0,  0,  0,  0, 34, 27,109, 63,155,254,214, 62,  0,  0,  0,  0,  8,  2,232, 61, 20,214,203, 62,
+  0,  0,  0,  0,192,157,244, 61,157,137,209, 62,  0,  0,  0,  0,128, 47,195, 61,  6, 11,207, 62,  0,  0,  0,  0, 36,174,184, 61,
+216,130,202, 62,  0,  0,  0,  0,174,151,113, 63, 26,229,214, 62,  0,  0,  0,  0,228,239,107, 63, 62, 59,218, 62,  0,  0,  0,  0,
+ 34, 27,109, 63,155,254,214, 62,  0,  0,  0,  0, 69,134,113, 63,156, 82,212, 62,  0,  0,  0,  0, 36,174,184, 61,216,130,202, 62,
+  0,  0,  0,  0,128, 47,195, 61,  6, 11,207, 62,  0,  0,  0,  0, 12,155,135, 61,166, 39,201, 62,  0,  0,  0,  0, 60,114,138, 61,
+ 28, 61,197, 62,  0,  0,  0,  0,222, 48,116, 63,169,  8,209, 62,  0,  0,  0,  0,174,151,113, 63, 26,229,214, 62,  0,  0,  0,  0,
+ 69,134,113, 63,156, 82,212, 62,  0,  0,  0,  0, 42,143,114, 63, 24,168,207, 62,  0,  0,  0,  0, 60,114,138, 61, 28, 61,197, 62,
+  0,  0,  0,  0, 12,155,135, 61,166, 39,201, 62,  0,  0,  0,  0,160,108, 93, 61, 17,207,190, 62,  0,  0,  0,  0,184, 85,132, 61,
+ 22,211,189, 62,  0,  0,  0,  0, 84,225,115, 63,208, 85,198, 62,  0,  0,  0,  0,222, 48,116, 63,169,  8,209, 62,  0,  0,  0,  0,
+ 42,143,114, 63, 24,168,207, 62,  0,  0,  0,  0,203,125,114, 63, 96,114,200, 62,  0,  0,  0,  0,184, 85,132, 61, 22,211,189, 62,
+  0,  0,  0,  0,160,108, 93, 61, 17,207,190, 62,  0,  0,  0,  0,244,221,134, 61,121,164,175, 62,  0,  0,  0,  0, 16,152,145, 61,
+ 84,214,179, 62,  0,  0,  0,  0,198,132,109, 63,182,157,186, 62,  0,  0,  0,  0, 84,225,115, 63,208, 85,198, 62,  0,  0,  0,  0,
+203,125,114, 63, 96,114,200, 62,  0,  0,  0,  0,177,192,109, 63,152,240,190, 62,  0,  0,  0,  0, 16,152,145, 61, 84,214,179, 62,
+  0,  0,  0,  0,244,221,134, 61,121,164,175, 62,  0,  0,  0,  0, 40, 91,221, 61,  4,194,167, 62,  0,  0,  0,  0, 64,226,208, 61,
+232, 58,172, 62,  0,  0,  0,  0, 68, 32, 97, 63,192, 12,178, 62,  0,  0,  0,  0,198,132,109, 63,182,157,186, 62,  0,  0,  0,  0,
+177,192,109, 63,152,240,190, 62,  0,  0,  0,  0,112, 91, 98, 63,149,128,182, 62,  0,  0,  0,  0, 64,226,208, 61,232, 58,172, 62,
+  0,  0,  0,  0, 40, 91,221, 61,  4,194,167, 62,  0,  0,  0,  0, 48,185, 36, 62, 16,  7,166, 62,  0,  0,  0,  0,228,107, 29, 62,
+ 95,230,169, 62,  0,  0,  0,  0,118,  1, 97, 63, 47,226,195, 62,  0,  0,  0,  0, 51,113, 97, 63, 92,151,189, 62,  0,  0,  0,  0,
+215,139,102, 63, 15,109,193, 62,  0,  0,  0,  0, 54, 47,100, 63,186,115,198, 62,  0,  0,  0,  0, 92,169,  5, 62,168,115,179, 62,
+  0,  0,  0,  0,104, 67, 29, 62, 58,199,177, 62,  0,  0,  0,  0, 12, 43, 28, 62,186,177,184, 62,  0,  0,  0,  0, 50, 97, 13, 62,
+ 50, 42,186, 62,  0,  0,  0,  0, 54, 47,100, 63,186,115,198, 62,  0,  0,  0,  0,215,139,102, 63, 15,109,193, 62,  0,  0,  0,  0,
+174,241,105, 63,204,  8,200, 62,  0,  0,  0,  0, 71,233,103, 63,178, 42,204, 62,  0,  0,  0,  0,228,171,229, 61, 41, 42,185, 62,
+  0,  0,  0,  0, 92,169,  5, 62,168,115,179, 62,  0,  0,  0,  0, 50, 97, 13, 62, 50, 42,186, 62,  0,  0,  0,  0, 92,248,243, 61,
+ 96, 22,191, 62,  0,  0,  0,  0, 71,233,103, 63,178, 42,204, 62,  0,  0,  0,  0,174,241,105, 63,204,  8,200, 62,  0,  0,  0,  0,
+ 51, 37,108, 63,249,  3,205, 62,  0,  0,  0,  0, 56,212,106, 63, 96,238,208, 62,  0,  0,  0,  0,120, 99,202, 61,192, 49,190, 62,
+  0,  0,  0,  0,228,171,229, 61, 41, 42,185, 62,  0,  0,  0,  0, 92,248,243, 61, 96, 22,191, 62,  0,  0,  0,  0,160,209,211, 61,
+108,159,195, 62,  0,  0,  0,  0, 56,212,106, 63, 96,238,208, 62,  0,  0,  0,  0, 51, 37,108, 63,249,  3,205, 62,  0,  0,  0,  0,
+ 56, 73,110, 63,186,119,206, 62,  0,  0,  0,  0, 46,191,109, 63, 92, 64,210, 62,  0,  0,  0,  0,244,234,179, 61,240,219,190, 62,
+  0,  0,  0,  0,120, 99,202, 61,192, 49,190, 62,  0,  0,  0,  0,160,209,211, 61,108,159,195, 62,  0,  0,  0,  0,196,129,181, 61,
+204, 14,196, 62,  0,  0,  0,  0, 34, 27,109, 63,155,254,214, 62,  0,  0,  0,  0, 54, 86,104, 63,209,241,214, 62,  0,  0,  0,  0,
+ 56,212,106, 63, 96,238,208, 62,  0,  0,  0,  0, 46,191,109, 63, 92, 64,210, 62,  0,  0,  0,  0,160,209,211, 61,108,159,195, 62,
+  0,  0,  0,  0,  8,  2,232, 61, 20,214,203, 62,  0,  0,  0,  0, 36,174,184, 61,216,130,202, 62,  0,  0,  0,  0,196,129,181, 61,
+204, 14,196, 62,  0,  0,  0,  0,182,109,100, 63,149,255,210, 62,  0,  0,  0,  0, 71,233,103, 63,178, 42,204, 62,  0,  0,  0,  0,
+ 56,212,106, 63, 96,238,208, 62,  0,  0,  0,  0, 54, 86,104, 63,209,241,214, 62,  0,  0,  0,  0,160,209,211, 61,108,159,195, 62,
+  0,  0,  0,  0, 92,248,243, 61, 96, 22,191, 62,  0,  0,  0,  0,160,107,  7, 62, 34,103,200, 62,  0,  0,  0,  0,  8,  2,232, 61,
+ 20,214,203, 62,  0,  0,  0,  0,182,109,100, 63,149,255,210, 62,  0,  0,  0,  0,112,206, 97, 63, 10,202,204, 62,  0,  0,  0,  0,
+ 54, 47,100, 63,186,115,198, 62,  0,  0,  0,  0, 71,233,103, 63,178, 42,204, 62,  0,  0,  0,  0, 50, 97, 13, 62, 50, 42,186, 62,
+  0,  0,  0,  0, 64, 68, 21, 62,107, 55,194, 62,  0,  0,  0,  0,160,107,  7, 62, 34,103,200, 62,  0,  0,  0,  0, 92,248,243, 61,
+ 96, 22,191, 62,  0,  0,  0,  0,118,  1, 97, 63, 47,226,195, 62,  0,  0,  0,  0, 54, 47,100, 63,186,115,198, 62,  0,  0,  0,  0,
+112,206, 97, 63, 10,202,204, 62,  0,  0,  0,  0, 82,241, 94, 63, 40,103,198, 62,  0,  0,  0,  0, 64, 68, 21, 62,107, 55,194, 62,
+  0,  0,  0,  0, 50, 97, 13, 62, 50, 42,186, 62,  0,  0,  0,  0, 12, 43, 28, 62,186,177,184, 62,  0,  0,  0,  0, 20,225, 35, 62,
+ 39, 50,188, 62,  0,  0,  0,  0, 96, 69, 96, 63,152,133,187, 62,  0,  0,  0,  0,112, 91, 98, 63,149,128,182, 62,  0,  0,  0,  0,
+215,139,102, 63, 15,109,193, 62,  0,  0,  0,  0, 51,113, 97, 63, 92,151,189, 62,  0,  0,  0,  0, 92,169,  5, 62,168,115,179, 62,
+  0,  0,  0,  0,228,107, 29, 62, 95,230,169, 62,  0,  0,  0,  0,140, 14, 35, 62, 33, 19,176, 62,  0,  0,  0,  0,104, 67, 29, 62,
+ 58,199,177, 62,  0,  0,  0,  0,177,192,109, 63,152,240,190, 62,  0,  0,  0,  0,174,241,105, 63,204,  8,200, 62,  0,  0,  0,  0,
+215,139,102, 63, 15,109,193, 62,  0,  0,  0,  0,112, 91, 98, 63,149,128,182, 62,  0,  0,  0,  0, 92,169,  5, 62,168,115,179, 62,
+  0,  0,  0,  0,228,171,229, 61, 41, 42,185, 62,  0,  0,  0,  0, 64,226,208, 61,232, 58,172, 62,  0,  0,  0,  0,228,107, 29, 62,
+ 95,230,169, 62,  0,  0,  0,  0,203,125,114, 63, 96,114,200, 62,  0,  0,  0,  0, 51, 37,108, 63,249,  3,205, 62,  0,  0,  0,  0,
+174,241,105, 63,204,  8,200, 62,  0,  0,  0,  0,177,192,109, 63,152,240,190, 62,  0,  0,  0,  0,228,171,229, 61, 41, 42,185, 62,
+  0,  0,  0,  0,120, 99,202, 61,192, 49,190, 62,  0,  0,  0,  0, 16,152,145, 61, 84,214,179, 62,  0,  0,  0,  0, 64,226,208, 61,
+232, 58,172, 62,  0,  0,  0,  0, 42,143,114, 63, 24,168,207, 62,  0,  0,  0,  0, 56, 73,110, 63,186,119,206, 62,  0,  0,  0,  0,
+ 51, 37,108, 63,249,  3,205, 62,  0,  0,  0,  0,203,125,114, 63, 96,114,200, 62,  0,  0,  0,  0,120, 99,202, 61,192, 49,190, 62,
+  0,  0,  0,  0,244,234,179, 61,240,219,190, 62,  0,  0,  0,  0,184, 85,132, 61, 22,211,189, 62,  0,  0,  0,  0, 16,152,145, 61,
+ 84,214,179, 62,  0,  0,  0,  0, 69,134,113, 63,156, 82,212, 62,  0,  0,  0,  0, 46,191,109, 63, 92, 64,210, 62,  0,  0,  0,  0,
+ 56, 73,110, 63,186,119,206, 62,  0,  0,  0,  0, 42,143,114, 63, 24,168,207, 62,  0,  0,  0,  0,244,234,179, 61,240,219,190, 62,
+  0,  0,  0,  0,196,129,181, 61,204, 14,196, 62,  0,  0,  0,  0, 60,114,138, 61, 28, 61,197, 62,  0,  0,  0,  0,184, 85,132, 61,
+ 22,211,189, 62,  0,  0,  0,  0, 34, 27,109, 63,155,254,214, 62,  0,  0,  0,  0, 46,191,109, 63, 92, 64,210, 62,  0,  0,  0,  0,
+ 69,134,113, 63,156, 82,212, 62,  0,  0,  0,  0, 60,114,138, 61, 28, 61,197, 62,  0,  0,  0,  0,196,129,181, 61,204, 14,196, 62,
+  0,  0,  0,  0, 36,174,184, 61,216,130,202, 62,  0,  0,  0,  0, 84,190,110, 63,223, 77,172, 62,  0,  0,  0,  0,151,  5, 90, 63,
+138, 61,167, 62,  0,  0,  0,  0, 22, 25, 96, 63,246,248,149, 62,  0,  0,  0,  0,162,176,122, 63,145,215,161, 62,  0,  0,  0,  0,
+ 64,234, 54, 62,146,219,140, 62,  0,  0,  0,  0,194,251, 66, 62,163,102,158, 62,  0,  0,  0,  0,  8, 66,246, 61, 28,161,152, 62,
+  0,  0,  0,  0,172,241,189, 61, 13,107,132, 62,  0,  0,  0,  0, 49, 12,122, 63,246,  8,197, 62,  0,  0,  0,  0, 84,190,110, 63,
+223, 77,172, 62,  0,  0,  0,  0,162,176,122, 63,145,215,161, 62,  0,  0,  0,  0,188,255,126, 63,115,248,198, 62,  0,  0,  0,  0,
+172,241,189, 61, 13,107,132, 62,  0,  0,  0,  0,  8, 66,246, 61, 28,161,152, 62,  0,  0,  0,  0,240, 54, 16, 61,120,  4,167, 62,
+  0,  0,  0,  0,  0,  8,163, 58, 39, 69,162, 62,  0,  0,  0,  0,183,115,119, 63,140, 49,215, 62,  0,  0,  0,  0, 49, 12,122, 63,
+246,  8,197, 62,  0,  0,  0,  0,188,255,126, 63,115,248,198, 62,  0,  0,  0,  0, 47,  6,122, 63,248,157,216, 62,  0,  0,  0,  0,
+  0,  8,163, 58, 39, 69,162, 62,  0,  0,  0,  0,240, 54, 16, 61,120,  4,167, 62,  0,  0,  0,  0,224,111,231, 60,100,142,198, 62,
+  0,  0,  0,  0,224,248, 14, 60, 70,141,198, 62,  0,  0,  0,  0, 41, 76,116, 63,139,153,222, 62,  0,  0,  0,  0,183,115,119, 63,
+140, 49,215, 62,  0,  0,  0,  0, 47,  6,122, 63,248,157,216, 62,  0,  0,  0,  0,134, 98,119, 63,204, 37,225, 62,  0,  0,  0,  0,
+224,248, 14, 60, 70,141,198, 62,  0,  0,  0,  0,224,111,231, 60,100,142,198, 62,  0,  0,  0,  0,128,183, 73, 61, 84,108,213, 62,
+  0,  0,  0,  0, 80,210,229, 60, 32,239,218, 62,  0,  0,  0,  0, 31,178,109, 63,224, 68,228, 62,  0,  0,  0,  0, 41, 76,116, 63,
+139,153,222, 62,  0,  0,  0,  0,134, 98,119, 63,204, 37,225, 62,  0,  0,  0,  0, 46,185,115, 63, 90,157,234, 62,  0,  0,  0,  0,
+ 80,210,229, 60, 32,239,218, 62,  0,  0,  0,  0,128,183, 73, 61, 84,108,213, 62,  0,  0,  0,  0, 28, 27,177, 61, 42,240,219, 62,
+  0,  0,  0,  0, 56,103,122, 61, 30, 10,230, 62,  0,  0,  0,  0, 46,178,102, 63,100,184,232, 62,  0,  0,  0,  0, 31,178,109, 63,
+224, 68,228, 62,  0,  0,  0,  0, 46,185,115, 63, 90,157,234, 62,  0,  0,  0,  0,244,134,106, 63,234, 64,246, 62,  0,  0,  0,  0,
+ 56,103,122, 61, 30, 10,230, 62,  0,  0,  0,  0, 28, 27,177, 61, 42,240,219, 62,  0,  0,  0,  0,120,216,242, 61,124, 40,225, 62,
+  0,  0,  0,  0,212,222,209, 61,238,123,240, 62,  0,  0,  0,  0,235,188,  5, 63,252, 74, 98, 63,  0,  0,  0,  0,200,111,248, 62,
+197,105,112, 63,  0,  0,  0,  0,  0, 49,231, 62,118,190,107, 63,  0,  0,  0,  0,150, 57,255, 62, 53, 14, 96, 63,  0,  0,  0,  0,
+ 80, 99, 95, 62,149,194, 94, 63,  0,  0,  0,  0, 58,  8, 62, 62, 10,154, 89, 63,  0,  0,  0,  0, 40, 24, 92, 62, 14, 82, 74, 63,
+  0,  0,  0,  0,112, 11,112, 62,157,133, 78, 63,  0,  0,  0,  0,235,188,  5, 63,252, 74, 98, 63,  0,  0,  0,  0,136,139, 12, 63,
+138,233,101, 63,  0,  0,  0,  0,116, 45,  6, 63,112,245,113, 63,  0,  0,  0,  0,200,111,248, 62,197,105,112, 63,  0,  0,  0,  0,
+ 68,219, 36, 62,249,186, 81, 63,  0,  0,  0,  0, 28,254, 65, 62, 20, 55, 70, 63,  0,  0,  0,  0, 40, 24, 92, 62, 14, 82, 74, 63,
+  0,  0,  0,  0, 58,  8, 62, 62, 10,154, 89, 63,  0,  0,  0,  0,136,139, 12, 63,138,233,101, 63,  0,  0,  0,  0,  5,130, 12, 63,
+149,216,108, 63,  0,  0,  0,  0,116, 45,  6, 63,112,245,113, 63,  0,  0,  0,  0, 68,219, 36, 62,249,186, 81, 63,  0,  0,  0,  0,
+ 76,  1, 42, 62, 39,178, 73, 63,  0,  0,  0,  0, 28,254, 65, 62, 20, 55, 70, 63,  0,  0,  0,  0,120, 89,103, 63,105, 76,  2, 63,
+  0,  0,  0,  0,106,154, 93, 63,226, 26,233, 62,  0,  0,  0,  0, 46,178,102, 63,100,184,232, 62,  0,  0,  0,  0,244,134,106, 63,
+234, 64,246, 62,  0,  0,  0,  0,120,216,242, 61,124, 40,225, 62,  0,  0,  0,  0,128,  1, 33, 62, 70,210,226, 62,  0,  0,  0,  0,
+116,128,234, 61,200, 39,  0, 63,  0,  0,  0,  0,212,222,209, 61,238,123,240, 62,  0,  0,  0,  0,226, 44,245, 62,129,140, 96, 63,
+  0,  0,  0,  0,150, 57,255, 62, 53, 14, 96, 63,  0,  0,  0,  0,  0, 49,231, 62,118,190,107, 63,  0,  0,  0,  0, 42,135,227, 62,
+ 58,  2,101, 63,  0,  0,  0,  0, 80, 99, 95, 62,149,194, 94, 63,  0,  0,  0,  0,112, 11,112, 62,157,133, 78, 63,  0,  0,  0,  0,
+ 74, 84,120, 62,104, 32, 83, 63,  0,  0,  0,  0,110,103,122, 62,236,255, 92, 63,  0,  0,  0,  0,216,217, 77, 63,  7,228,157, 62,
+  0,  0,  0,  0,160,225, 90, 63,110,121,137, 62,  0,  0,  0,  0, 22, 25, 96, 63,246,248,149, 62,  0,  0,  0,  0,151,  5, 90, 63,
+138, 61,167, 62,  0,  0,  0,  0, 64,234, 54, 62,146,219,140, 62,  0,  0,  0,  0,166,125, 74, 62,252, 30,130, 62,  0,  0,  0,  0,
+154,118,111, 62,120,108,152, 62,  0,  0,  0,  0,194,251, 66, 62,163,102,158, 62,  0,  0,  0,  0, 68, 65, 84, 65,192, 30,  0,  0,
+ 24,163,199,  4,  0,  0,  0,  0, 62,  0,  0,  0,176,  7,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
@@ -8577,212 +8772,1003 @@ char datatoc_preview_blend[]= {
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 77, 69,  0,  0,152,  1,  0,  0, 56,108, 53,  3,
-  0,  0,  0,  0, 46,  0,  0,  0,  1,  0,  0,  0,120,117, 53,  3,  0,  0,  0,  0,200,104, 52,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 69, 80,108, 97,110,101, 46, 48, 48, 52,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  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, 24,110, 53,  3,  0,  0,  0,  0,152,116, 53,  3,
-  0,  0,  0,  0,248,116, 53,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24,112, 53,  3,  0,  0,  0,  0,104,114, 53,  3,
-  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,  0,  0,104,110, 53,  3,  0,  0,  0,  0,  1,  0,  0,  0,
-  5,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,184,112, 53,  3,
-  0,  0,  0,  0,  1,  0,  0,  0,  5,  0,  0,  0, 12,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,232,114, 53,  3,  0,  0,  0,  0,  2,  0,  0,  0,  5,  0,  0,  0, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128,179,  0,  0, 64, 52,  0,  0,  0,  0,  0,  0,128, 63,  2,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0, 67,  0, 30,  0,  4,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,  8,  0,  0,  0, 24,110, 53,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,168,238, 51,  3,
-  0,  0,  0,  0, 68, 65, 84, 65,104,  1,  0,  0,104,110, 53,  3,  0,  0,  0,  0, 84,  1,  0,  0,  5,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24,112, 53,  3,
-  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,  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,  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,  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,  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,  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, 68, 65, 84, 65, 80,  0,  0,  0, 24,112, 53,  3,  0,  0,  0,  0, 52,  0,  0,  0,  4,  0,  0,  0,  0,  0,128, 63,
-255,255,127, 63,  0,  0,  0,  0,  0,  0,  0,  0,254,127,  3,  0,  0,  0,128, 63,  0,  0,128,191,  0,  0,  0,  0,  0,  0,  0,  0,
-255,127,  3,  0,  1,  0,128,191,253,255,127,191,  0,  0,  0,  0,  0,  0,  0,  0,255,127,  3,  0,250,255,127,191,  3,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,255,127,  3,  0, 68, 65, 84, 65,104,  1,  0,  0,184,112, 53,  3,  0,  0,  0,  0, 84,  1,  0,  0,
-  5,  0,  0,  0,  3,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,104,114, 53,  3,  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,  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,  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,  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,  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,  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, 68, 65, 84, 65, 48,  0,  0,  0,104,114, 53,  3,  0,  0,  0,  0, 49,  0,  0,  0,
-  4,  0,  0,  0,  1,  0,  0,  0,  2,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0,  0,
-  3,  0,  0,  0,  0,  0, 35,  0,  2,  0,  0,  0,  3,  0,  0,  0,  0,  0, 35,  0, 68, 65, 84, 65,104,  1,  0,  0,232,114, 53,  3,
-  0,  0,  0,  0, 84,  1,  0,  0,  5,  0,  0,  0,  4,  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, 86, 84,101,120,  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,152,116, 53,  3,  0,  0,  0,  0,  5,  0,  0,  0, 20,  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, 85, 86, 84,101,120,  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,248,116, 53,  3,  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,  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,  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,  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,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,152,116, 53,  3,
-  0,  0,  0,  0, 48,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  2,
- 68, 65, 84, 65, 48,  0,  0,  0,248,116, 53,  3,  0,  0,  0,  0, 59,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
- 60,  0,  1,  0,  0,  0,  0,  0, 77, 69,  0,  0,152,  1,  0,  0,120,117, 53,  3,  0,  0,  0,  0, 46,  0,  0,  0,  1,  0,  0,  0,
-104,135, 53,  3,  0,  0,  0,  0, 56,108, 53,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 77, 69,112,108, 97,110,101, 95, 99,104,101, 99,107,101,114,115,  0,  0,  0,  0,  0,  0,  0,  0,  7,  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, 88,119, 53,  3,  0,  0,  0,  0, 56,129, 53,  3,  0,  0,  0,  0,200,130, 53,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,104,121, 53,  3,  0,  0,  0,  0, 88,125, 53,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 24,134, 53,  3,  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,184,119, 53,  3,  0,  0,  0,  0,  1,  0,  0,  0,  5,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,168,123, 53,  3,  0,  0,  0,  0,  1,  0,  0,  0,  5,  0,  0,  0,
- 12,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,136,127, 53,  3,  0,  0,  0,  0,
-  3,  0,  0,  0,  5,  0,  0,  0, 84,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 25,  0,  0,  0, 40,  0,  0,  0, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  4,205, 76, 63,172,197, 39, 55,214,204, 76, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0, 83,  0, 30,  0,  5,  0,
-  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0,
- 88,119, 53,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 24,217, 51,  3,  0,  0,  0,  0,136,195, 51,  3,  0,  0,  0,  0,
- 68, 65, 84, 65,104,  1,  0,  0,184,119, 53,  3,  0,  0,  0,  0, 84,  1,  0,  0,  5,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,104,121, 53,  3,  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,  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,
-  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,  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,  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,  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,
- 68, 65, 84, 65,244,  1,  0,  0,104,121, 53,  3,  0,  0,  0,  0, 52,  0,  0,  0, 25,  0,  0,  0,  4,205, 76,191,  0,  0,  0,  0,
-208,204, 76,191,  0,  0,  2,128,  0,  0,  1,  0,  4,205, 76, 63,  0,  0,  0,  0,210,204, 76, 63,  0,  0,  1,128,  0,  0,  1,  0,
-  0,205, 76, 63,  0,  0,  0,  0,213,204,204, 62,  0,  0,  2,128,  0,  0,  1,  0, 41,205,204, 62,174,148, 77,180,200,204,204,190,
-  0,  0,  1,128,  0,  0,  1,  0,254,204, 76, 63,176, 90, 19, 51,208,204,204,190,  0,  0,  1,128,  0,  0,  1,  0, 41,205,204, 62,
-174,148, 77,180,  0,  0,240, 52,  0,  0,  1,128,  0,  0,  1,  0,254,204, 76, 63,176, 90, 19, 51,  0,  0, 96, 52,  0,  0,  2,128,
-  0,  0,  1,  0, 41,205,204, 62,174,148, 77,180,221,204,204, 62,  0,  0,  1,128,  0,  0,  1,  0, 47,205,204, 62,174,148, 77,180,
-214,204, 76, 63,  0,  0,  1,128,  0,  0,  1,  0, 41,205,204, 62,174,148, 77,180,206,204, 76,191,  0,  0,  1,128,  0,  0,  1,  0,
-254,204, 76, 63,176, 90, 19, 51,208,204, 76,191,  0,  0,  1,128,  0,  0,  1,  0,  2,  0, 86,182,  3,  0,160, 52,214,204, 76,191,
-  0,  0,  1,128,  0,  0,  1,  0, 65,205,204,190, 91, 41,155, 51,212,204, 76,191,  0,  0,  1,128,  0,  0,  1,  0,  1,  0, 78,182,
-  3,  0,160, 52,206,204, 76, 63,  0,  0,  1,128,  0,  0,  1,  0, 57,205,204,190, 90, 41,155, 51,206,204, 76, 63,  0,  0,  1,128,
-  0,  0,  1,  0, 10,205, 76,191,169, 82,182, 51,210,204, 76, 63,  0,  0,  1,128,  0,  0,  1,  0,  2,  0, 86,182,  3,  0,160, 52,
-197,204,204, 62,  0,  0,  1,128,  0,  0,  1,  0, 65,205,204,190, 91, 41,155, 51,205,204,204, 62,  0,  0,  2,128,  0,  0,  1,  0,
- 10,205, 76,191,169, 82,182, 51,213,204,204, 62,  0,  0,  1,128,  0,  0,  1,  0,  2,  0, 86,182,  3,  0,160, 52,  0,  0,144,180,
-  0,  0,  2,128,  0,  0,  1,  0, 65,205,204,190, 91, 41,155, 51,  0,  0,  0,179,  0,  0,  1,128,  0,  0,  1,  0, 10,205, 76,191,
-169, 82,182, 51,  0,  0, 96, 52,  0,  0,  1,128,  0,  0,  1,  0,  2,  0, 86,182,  3,  0,160, 52,224,204,204,190,  0,  0,  1,128,
-  0,  0,  1,  0, 65,205,204,190, 91, 41,155, 51,216,204,204,190,  0,  0,  2,128,  0,  0,  1,  0, 10,205, 76,191,169, 82,182, 51,
-208,204,204,190,  0,  0,  2,128,  0,  0,  1,  0, 68, 65, 84, 65,104,  1,  0,  0,168,123, 53,  3,  0,  0,  0,  0, 84,  1,  0,  0,
-  5,  0,  0,  0,  3,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 88,125, 53,  3,  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,  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,  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,  0,  0,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 68, 65, 84, 65,128, 61,  0,  0, 40,233,198,  4,  0,  0,  0,  0,
+ 59,  0,  0,  0,176,  7,  0,  0, 45,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,
+ 43,  0,  0,  0,  3,  0,  0,  0,  3,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,  5,  0,  0,  0, 46,  0,  0,  0,  6,  0,  0,  0,
+ 44,  0,  0,  0,  7,  0,  0,  0, 43,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  8,  0,  0,  0,  4,  0,  0,  0,  9,  0,  0,  0,
+ 41,  0,  0,  0, 10,  0,  0,  0,  5,  0,  0,  0, 11,  0,  0,  0,  3,  0,  0,  0,  7,  0,  0,  0, 44,  0,  0,  0, 12,  0,  0,  0,
+ 42,  0,  0,  0, 13,  0,  0,  0,  2,  0,  0,  0, 14,  0,  0,  0,  8,  0,  0,  0, 15,  0,  0,  0,  6,  0,  0,  0, 16,  0,  0,  0,
+  4,  0,  0,  0,  8,  0,  0,  0,  7,  0,  0,  0, 17,  0,  0,  0,  9,  0,  0,  0, 18,  0,  0,  0,  3,  0,  0,  0, 11,  0,  0,  0,
+  5,  0,  0,  0, 19,  0,  0,  0,  0,  0,  0,  0, 20,  0,  0,  0, 10,  0,  0,  0, 21,  0,  0,  0,  8,  0,  0,  0, 14,  0,  0,  0,
+  2,  0,  0,  0,  1,  0,  0,  0,  9,  0,  0,  0, 22,  0,  0,  0, 11,  0,  0,  0, 23,  0,  0,  0,  1,  0,  0,  0,  4,  0,  0,  0,
+  3,  0,  0,  0, 18,  0,  0,  0, 10,  0,  0,  0, 24,  0,  0,  0, 12,  0,  0,  0, 25,  0,  0,  0, 14,  0,  0,  0, 26,  0,  0,  0,
+  8,  0,  0,  0, 21,  0,  0,  0,112,  0,  0,  0,236,  3,  0,  0, 13,  0,  0,  0, 27,  0,  0,  0, 11,  0,  0,  0, 22,  0,  0,  0,
+  9,  0,  0,  0,235,  3,  0,  0,  8,  0,  0,  0, 26,  0,  0,  0, 14,  0,  0,  0, 28,  0,  0,  0, 15,  0,  0,  0, 29,  0,  0,  0,
+  6,  0,  0,  0, 15,  0,  0,  0, 16,  0,  0,  0,234,  3,  0,  0,112,  0,  0,  0,235,  3,  0,  0,  9,  0,  0,  0, 17,  0,  0,  0,
+  7,  0,  0,  0, 30,  0,  0,  0, 14,  0,  0,  0, 31,  0,  0,  0, 19,  0,  0,  0, 32,  0,  0,  0, 17,  0,  0,  0, 33,  0,  0,  0,
+ 15,  0,  0,  0, 28,  0,  0,  0, 18,  0,  0,  0, 34,  0,  0,  0, 20,  0,  0,  0,233,  3,  0,  0,112,  0,  0,  0,234,  3,  0,  0,
+ 16,  0,  0,  0, 35,  0,  0,  0, 12,  0,  0,  0, 36,  0,  0,  0, 21,  0,  0,  0, 37,  0,  0,  0, 19,  0,  0,  0, 31,  0,  0,  0,
+ 14,  0,  0,  0, 25,  0,  0,  0, 20,  0,  0,  0, 38,  0,  0,  0, 22,  0,  0,  0, 39,  0,  0,  0, 13,  0,  0,  0,236,  3,  0,  0,
+112,  0,  0,  0,233,  3,  0,  0, 21,  0,  0,  0, 40,  0,  0,  0, 23,  0,  0,  0, 41,  0,  0,  0, 25,  0,  0,  0, 42,  0,  0,  0,
+ 19,  0,  0,  0, 37,  0,  0,  0, 26,  0,  0,  0, 43,  0,  0,  0, 24,  0,  0,  0, 44,  0,  0,  0, 22,  0,  0,  0, 38,  0,  0,  0,
+ 20,  0,  0,  0, 45,  0,  0,  0, 19,  0,  0,  0, 42,  0,  0,  0, 25,  0,  0,  0, 46,  0,  0,  0, 27,  0,  0,  0, 47,  0,  0,  0,
+ 17,  0,  0,  0, 32,  0,  0,  0, 28,  0,  0,  0, 48,  0,  0,  0, 26,  0,  0,  0, 45,  0,  0,  0, 20,  0,  0,  0, 34,  0,  0,  0,
+ 18,  0,  0,  0, 49,  0,  0,  0, 25,  0,  0,  0, 50,  0,  0,  0, 31,  0,  0,  0, 51,  0,  0,  0, 29,  0,  0,  0, 52,  0,  0,  0,
+ 27,  0,  0,  0, 46,  0,  0,  0, 30,  0,  0,  0, 53,  0,  0,  0, 32,  0,  0,  0, 54,  0,  0,  0, 26,  0,  0,  0, 48,  0,  0,  0,
+ 28,  0,  0,  0, 55,  0,  0,  0, 23,  0,  0,  0, 56,  0,  0,  0, 33,  0,  0,  0, 57,  0,  0,  0, 31,  0,  0,  0, 50,  0,  0,  0,
+ 25,  0,  0,  0, 41,  0,  0,  0, 32,  0,  0,  0, 58,  0,  0,  0, 34,  0,  0,  0, 59,  0,  0,  0, 24,  0,  0,  0, 43,  0,  0,  0,
+ 26,  0,  0,  0, 54,  0,  0,  0, 33,  0,  0,  0, 60,  0,  0,  0, 35,  0,  0,  0, 61,  0,  0,  0, 37,  0,  0,  0, 62,  0,  0,  0,
+ 31,  0,  0,  0, 57,  0,  0,  0, 38,  0,  0,  0, 63,  0,  0,  0, 36,  0,  0,  0, 64,  0,  0,  0, 34,  0,  0,  0, 58,  0,  0,  0,
+ 32,  0,  0,  0, 65,  0,  0,  0, 31,  0,  0,  0, 62,  0,  0,  0, 37,  0,  0,  0, 66,  0,  0,  0, 39,  0,  0,  0, 67,  0,  0,  0,
+ 29,  0,  0,  0, 51,  0,  0,  0, 40,  0,  0,  0, 68,  0,  0,  0, 38,  0,  0,  0, 65,  0,  0,  0, 32,  0,  0,  0, 53,  0,  0,  0,
+ 30,  0,  0,  0, 69,  0,  0,  0, 37,  0,  0,  0, 70,  0,  0,  0, 43,  0,  0,  0, 10,  0,  0,  0, 41,  0,  0,  0, 71,  0,  0,  0,
+ 39,  0,  0,  0, 66,  0,  0,  0, 42,  0,  0,  0, 12,  0,  0,  0, 44,  0,  0,  0, 72,  0,  0,  0, 38,  0,  0,  0, 68,  0,  0,  0,
+ 40,  0,  0,  0, 73,  0,  0,  0, 35,  0,  0,  0, 74,  0,  0,  0, 45,  0,  0,  0,  3,  0,  0,  0, 43,  0,  0,  0, 70,  0,  0,  0,
+ 37,  0,  0,  0, 61,  0,  0,  0, 44,  0,  0,  0,  6,  0,  0,  0, 46,  0,  0,  0, 75,  0,  0,  0, 36,  0,  0,  0, 63,  0,  0,  0,
+ 38,  0,  0,  0, 72,  0,  0,  0, 45,  0,  0,  0, 74,  0,  0,  0, 35,  0,  0,  0, 76,  0,  0,  0, 49,  0,  0,  0, 77,  0,  0,  0,
+ 47,  0,  0,  0, 78,  0,  0,  0, 50,  0,  0,  0, 79,  0,  0,  0, 36,  0,  0,  0, 75,  0,  0,  0, 46,  0,  0,  0, 80,  0,  0,  0,
+ 48,  0,  0,  0, 81,  0,  0,  0, 35,  0,  0,  0, 60,  0,  0,  0, 33,  0,  0,  0, 82,  0,  0,  0, 51,  0,  0,  0, 83,  0,  0,  0,
+ 49,  0,  0,  0, 76,  0,  0,  0, 52,  0,  0,  0, 84,  0,  0,  0, 34,  0,  0,  0, 64,  0,  0,  0, 36,  0,  0,  0, 79,  0,  0,  0,
+ 50,  0,  0,  0, 85,  0,  0,  0, 33,  0,  0,  0, 56,  0,  0,  0, 23,  0,  0,  0, 86,  0,  0,  0, 53,  0,  0,  0, 87,  0,  0,  0,
+ 51,  0,  0,  0, 82,  0,  0,  0, 54,  0,  0,  0, 88,  0,  0,  0, 24,  0,  0,  0, 59,  0,  0,  0, 34,  0,  0,  0, 84,  0,  0,  0,
+ 52,  0,  0,  0, 89,  0,  0,  0, 23,  0,  0,  0, 40,  0,  0,  0, 21,  0,  0,  0, 90,  0,  0,  0, 55,  0,  0,  0, 91,  0,  0,  0,
+ 53,  0,  0,  0, 86,  0,  0,  0, 56,  0,  0,  0, 92,  0,  0,  0, 22,  0,  0,  0, 44,  0,  0,  0, 24,  0,  0,  0, 88,  0,  0,  0,
+ 54,  0,  0,  0, 93,  0,  0,  0, 21,  0,  0,  0, 36,  0,  0,  0, 12,  0,  0,  0, 94,  0,  0,  0, 57,  0,  0,  0, 95,  0,  0,  0,
+ 55,  0,  0,  0, 90,  0,  0,  0, 58,  0,  0,  0, 96,  0,  0,  0, 13,  0,  0,  0, 39,  0,  0,  0, 22,  0,  0,  0, 92,  0,  0,  0,
+ 56,  0,  0,  0, 97,  0,  0,  0, 12,  0,  0,  0, 24,  0,  0,  0, 10,  0,  0,  0, 98,  0,  0,  0, 61,  0,  0,  0, 99,  0,  0,  0,
+ 57,  0,  0,  0, 94,  0,  0,  0, 62,  0,  0,  0,100,  0,  0,  0, 11,  0,  0,  0, 27,  0,  0,  0, 13,  0,  0,  0, 96,  0,  0,  0,
+ 58,  0,  0,  0,101,  0,  0,  0, 10,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,  0,102,  0,  0,  0, 63,  0,  0,  0,103,  0,  0,  0,
+ 61,  0,  0,  0, 98,  0,  0,  0, 64,  0,  0,  0,104,  0,  0,  0,  1,  0,  0,  0, 23,  0,  0,  0, 11,  0,  0,  0,100,  0,  0,  0,
+ 62,  0,  0,  0,105,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 45,  0,  0,  0, 78,  0,  0,  0, 47,  0,  0,  0,106,  0,  0,  0,
+ 63,  0,  0,  0,102,  0,  0,  0, 48,  0,  0,  0, 80,  0,  0,  0, 46,  0,  0,  0,  5,  0,  0,  0,  1,  0,  0,  0,104,  0,  0,  0,
+ 64,  0,  0,  0,107,  0,  0,  0, 59,  0,  0,  0,108,  0,  0,  0, 63,  0,  0,  0,106,  0,  0,  0, 47,  0,  0,  0,109,  0,  0,  0,
+ 48,  0,  0,  0,107,  0,  0,  0, 64,  0,  0,  0,110,  0,  0,  0, 60,  0,  0,  0,111,  0,  0,  0, 61,  0,  0,  0,103,  0,  0,  0,
+ 63,  0,  0,  0,108,  0,  0,  0, 59,  0,  0,  0,112,  0,  0,  0, 60,  0,  0,  0,110,  0,  0,  0, 64,  0,  0,  0,105,  0,  0,  0,
+ 62,  0,  0,  0,113,  0,  0,  0, 59,  0,  0,  0,114,  0,  0,  0, 57,  0,  0,  0, 99,  0,  0,  0, 61,  0,  0,  0,112,  0,  0,  0,
+ 62,  0,  0,  0,101,  0,  0,  0, 58,  0,  0,  0,115,  0,  0,  0, 60,  0,  0,  0,113,  0,  0,  0, 59,  0,  0,  0,116,  0,  0,  0,
+ 55,  0,  0,  0, 95,  0,  0,  0, 57,  0,  0,  0,114,  0,  0,  0, 58,  0,  0,  0, 97,  0,  0,  0, 56,  0,  0,  0,117,  0,  0,  0,
+ 60,  0,  0,  0,115,  0,  0,  0, 59,  0,  0,  0,118,  0,  0,  0, 53,  0,  0,  0, 91,  0,  0,  0, 55,  0,  0,  0,116,  0,  0,  0,
+ 56,  0,  0,  0, 93,  0,  0,  0, 54,  0,  0,  0,119,  0,  0,  0, 60,  0,  0,  0,117,  0,  0,  0, 59,  0,  0,  0,120,  0,  0,  0,
+ 51,  0,  0,  0, 87,  0,  0,  0, 53,  0,  0,  0,118,  0,  0,  0, 54,  0,  0,  0, 89,  0,  0,  0, 52,  0,  0,  0,121,  0,  0,  0,
+ 60,  0,  0,  0,119,  0,  0,  0, 59,  0,  0,  0,122,  0,  0,  0, 49,  0,  0,  0, 83,  0,  0,  0, 51,  0,  0,  0,120,  0,  0,  0,
+ 52,  0,  0,  0, 85,  0,  0,  0, 50,  0,  0,  0,123,  0,  0,  0, 60,  0,  0,  0,121,  0,  0,  0, 59,  0,  0,  0,109,  0,  0,  0,
+ 47,  0,  0,  0, 77,  0,  0,  0, 49,  0,  0,  0,122,  0,  0,  0, 50,  0,  0,  0, 81,  0,  0,  0, 48,  0,  0,  0,111,  0,  0,  0,
+ 60,  0,  0,  0,123,  0,  0,  0, 87,  0,  0,  0,124,  0,  0,  0,171,  0,  0,  0,125,  0,  0,  0,173,  0,  0,  0,126,  0,  0,  0,
+ 89,  0,  0,  0,127,  0,  0,  0,173,  0,  0,  0,128,  0,  0,  0,172,  0,  0,  0,129,  0,  0,  0, 88,  0,  0,  0,130,  0,  0,  0,
+ 89,  0,  0,  0,126,  0,  0,  0, 85,  0,  0,  0,131,  0,  0,  0,169,  0,  0,  0,132,  0,  0,  0,171,  0,  0,  0,124,  0,  0,  0,
+ 87,  0,  0,  0,133,  0,  0,  0,172,  0,  0,  0,134,  0,  0,  0,170,  0,  0,  0,135,  0,  0,  0, 86,  0,  0,  0,136,  0,  0,  0,
+ 88,  0,  0,  0,129,  0,  0,  0, 83,  0,  0,  0,137,  0,  0,  0,167,  0,  0,  0,138,  0,  0,  0,169,  0,  0,  0,131,  0,  0,  0,
+ 85,  0,  0,  0,139,  0,  0,  0,170,  0,  0,  0,140,  0,  0,  0,168,  0,  0,  0,141,  0,  0,  0, 84,  0,  0,  0,142,  0,  0,  0,
+ 86,  0,  0,  0,135,  0,  0,  0, 81,  0,  0,  0,143,  0,  0,  0,165,  0,  0,  0,144,  0,  0,  0,167,  0,  0,  0,137,  0,  0,  0,
+ 83,  0,  0,  0,145,  0,  0,  0,168,  0,  0,  0,146,  0,  0,  0,166,  0,  0,  0,147,  0,  0,  0, 82,  0,  0,  0,148,  0,  0,  0,
+ 84,  0,  0,  0,141,  0,  0,  0, 79,  0,  0,  0,149,  0,  0,  0,163,  0,  0,  0,150,  0,  0,  0,165,  0,  0,  0,143,  0,  0,  0,
+ 81,  0,  0,  0,151,  0,  0,  0,166,  0,  0,  0,152,  0,  0,  0,164,  0,  0,  0,153,  0,  0,  0, 80,  0,  0,  0,154,  0,  0,  0,
+ 82,  0,  0,  0,147,  0,  0,  0, 77,  0,  0,  0,155,  0,  0,  0, 90,  0,  0,  0,156,  0,  0,  0,143,  0,  0,  0,157,  0,  0,  0,
+161,  0,  0,  0,158,  0,  0,  0,144,  0,  0,  0,159,  0,  0,  0, 91,  0,  0,  0,160,  0,  0,  0, 78,  0,  0,  0,161,  0,  0,  0,
+162,  0,  0,  0,162,  0,  0,  0, 90,  0,  0,  0,163,  0,  0,  0, 92,  0,  0,  0,164,  0,  0,  0,145,  0,  0,  0,165,  0,  0,  0,
+143,  0,  0,  0,156,  0,  0,  0,146,  0,  0,  0,166,  0,  0,  0, 93,  0,  0,  0,167,  0,  0,  0, 91,  0,  0,  0,159,  0,  0,  0,
+144,  0,  0,  0,168,  0,  0,  0, 92,  0,  0,  0,169,  0,  0,  0, 94,  0,  0,  0,170,  0,  0,  0,147,  0,  0,  0,171,  0,  0,  0,
+145,  0,  0,  0,164,  0,  0,  0,148,  0,  0,  0,172,  0,  0,  0, 95,  0,  0,  0,173,  0,  0,  0, 93,  0,  0,  0,166,  0,  0,  0,
+146,  0,  0,  0,174,  0,  0,  0, 94,  0,  0,  0,175,  0,  0,  0, 96,  0,  0,  0,176,  0,  0,  0,149,  0,  0,  0,177,  0,  0,  0,
+147,  0,  0,  0,170,  0,  0,  0,150,  0,  0,  0,178,  0,  0,  0, 97,  0,  0,  0,179,  0,  0,  0, 95,  0,  0,  0,172,  0,  0,  0,
+148,  0,  0,  0,180,  0,  0,  0, 96,  0,  0,  0,181,  0,  0,  0, 98,  0,  0,  0,182,  0,  0,  0,151,  0,  0,  0,183,  0,  0,  0,
+149,  0,  0,  0,176,  0,  0,  0,152,  0,  0,  0,184,  0,  0,  0, 99,  0,  0,  0,185,  0,  0,  0, 97,  0,  0,  0,178,  0,  0,  0,
+150,  0,  0,  0,186,  0,  0,  0, 98,  0,  0,  0,187,  0,  0,  0,100,  0,  0,  0,188,  0,  0,  0,153,  0,  0,  0,189,  0,  0,  0,
+151,  0,  0,  0,182,  0,  0,  0,154,  0,  0,  0,190,  0,  0,  0,101,  0,  0,  0,191,  0,  0,  0, 99,  0,  0,  0,184,  0,  0,  0,
+152,  0,  0,  0,192,  0,  0,  0,100,  0,  0,  0,193,  0,  0,  0,102,  0,  0,  0,194,  0,  0,  0,155,  0,  0,  0,195,  0,  0,  0,
+153,  0,  0,  0,188,  0,  0,  0,156,  0,  0,  0,196,  0,  0,  0,103,  0,  0,  0,197,  0,  0,  0,101,  0,  0,  0,190,  0,  0,  0,
+154,  0,  0,  0,198,  0,  0,  0,102,  0,  0,  0,199,  0,  0,  0,104,  0,  0,  0,200,  0,  0,  0,157,  0,  0,  0,201,  0,  0,  0,
+155,  0,  0,  0,194,  0,  0,  0,158,  0,  0,  0,202,  0,  0,  0,105,  0,  0,  0,203,  0,  0,  0,103,  0,  0,  0,196,  0,  0,  0,
+156,  0,  0,  0,204,  0,  0,  0,104,  0,  0,  0,205,  0,  0,  0,106,  0,  0,  0,206,  0,  0,  0,159,  0,  0,  0,207,  0,  0,  0,
+157,  0,  0,  0,200,  0,  0,  0,160,  0,  0,  0,208,  0,  0,  0,107,  0,  0,  0,209,  0,  0,  0,105,  0,  0,  0,202,  0,  0,  0,
+158,  0,  0,  0,210,  0,  0,  0,106,  0,  0,  0,211,  0,  0,  0, 65,  0,  0,  0,212,  0,  0,  0, 66,  0,  0,  0,213,  0,  0,  0,
+159,  0,  0,  0,206,  0,  0,  0, 66,  0,  0,  0,212,  0,  0,  0, 65,  0,  0,  0,214,  0,  0,  0,107,  0,  0,  0,208,  0,  0,  0,
+160,  0,  0,  0,215,  0,  0,  0,108,  0,  0,  0,216,  0,  0,  0,125,  0,  0,  0,217,  0,  0,  0,157,  0,  0,  0,207,  0,  0,  0,
+159,  0,  0,  0,218,  0,  0,  0,158,  0,  0,  0,219,  0,  0,  0,126,  0,  0,  0,220,  0,  0,  0,109,  0,  0,  0,221,  0,  0,  0,
+160,  0,  0,  0,210,  0,  0,  0,125,  0,  0,  0,222,  0,  0,  0,176,  0,  0,  0,223,  0,  0,  0,155,  0,  0,  0,201,  0,  0,  0,
+157,  0,  0,  0,217,  0,  0,  0,156,  0,  0,  0,224,  0,  0,  0,177,  0,  0,  0,225,  0,  0,  0,126,  0,  0,  0,219,  0,  0,  0,
+158,  0,  0,  0,204,  0,  0,  0,123,  0,  0,  0,226,  0,  0,  0,153,  0,  0,  0,195,  0,  0,  0,155,  0,  0,  0,223,  0,  0,  0,
+176,  0,  0,  0,227,  0,  0,  0,156,  0,  0,  0,198,  0,  0,  0,154,  0,  0,  0,228,  0,  0,  0,124,  0,  0,  0,229,  0,  0,  0,
+177,  0,  0,  0,224,  0,  0,  0,121,  0,  0,  0,230,  0,  0,  0,151,  0,  0,  0,189,  0,  0,  0,153,  0,  0,  0,226,  0,  0,  0,
+123,  0,  0,  0,231,  0,  0,  0,154,  0,  0,  0,192,  0,  0,  0,152,  0,  0,  0,232,  0,  0,  0,122,  0,  0,  0,233,  0,  0,  0,
+124,  0,  0,  0,228,  0,  0,  0,119,  0,  0,  0,234,  0,  0,  0,149,  0,  0,  0,183,  0,  0,  0,151,  0,  0,  0,230,  0,  0,  0,
+121,  0,  0,  0,235,  0,  0,  0,152,  0,  0,  0,186,  0,  0,  0,150,  0,  0,  0,236,  0,  0,  0,120,  0,  0,  0,237,  0,  0,  0,
+122,  0,  0,  0,232,  0,  0,  0,117,  0,  0,  0,238,  0,  0,  0,147,  0,  0,  0,177,  0,  0,  0,149,  0,  0,  0,234,  0,  0,  0,
+119,  0,  0,  0,239,  0,  0,  0,150,  0,  0,  0,180,  0,  0,  0,148,  0,  0,  0,240,  0,  0,  0,118,  0,  0,  0,241,  0,  0,  0,
+120,  0,  0,  0,236,  0,  0,  0,115,  0,  0,  0,242,  0,  0,  0,145,  0,  0,  0,171,  0,  0,  0,147,  0,  0,  0,238,  0,  0,  0,
+117,  0,  0,  0,243,  0,  0,  0,148,  0,  0,  0,174,  0,  0,  0,146,  0,  0,  0,244,  0,  0,  0,116,  0,  0,  0,245,  0,  0,  0,
+118,  0,  0,  0,240,  0,  0,  0,113,  0,  0,  0,246,  0,  0,  0,143,  0,  0,  0,165,  0,  0,  0,145,  0,  0,  0,242,  0,  0,  0,
+115,  0,  0,  0,247,  0,  0,  0,146,  0,  0,  0,168,  0,  0,  0,144,  0,  0,  0,248,  0,  0,  0,114,  0,  0,  0,249,  0,  0,  0,
+116,  0,  0,  0,244,  0,  0,  0, 14,  0,  0,  0,232,  3,  0,  0,161,  0,  0,  0,157,  0,  0,  0,143,  0,  0,  0,246,  0,  0,  0,
+113,  0,  0,  0,231,  3,  0,  0,144,  0,  0,  0,162,  0,  0,  0,162,  0,  0,  0,250,  0,  0,  0,112,  0,  0,  0,251,  0,  0,  0,
+114,  0,  0,  0,248,  0,  0,  0, 14,  0,  0,  0,230,  3,  0,  0,178,  0,  0,  0,252,  0,  0,  0,174,  0,  0,  0,253,  0,  0,  0,
+161,  0,  0,  0,232,  3,  0,  0,174,  0,  0,  0,254,  0,  0,  0,179,  0,  0,  0,255,  0,  0,  0,112,  0,  0,  0,250,  0,  0,  0,
+162,  0,  0,  0,  0,  1,  0,  0,108,  0,  0,  0,218,  0,  0,  0,159,  0,  0,  0,213,  0,  0,  0, 66,  0,  0,  0,  1,  1,  0,  0,
+110,  0,  0,  0,  2,  1,  0,  0, 66,  0,  0,  0,215,  0,  0,  0,160,  0,  0,  0,221,  0,  0,  0,109,  0,  0,  0,  3,  1,  0,  0,
+111,  0,  0,  0,  4,  1,  0,  0,110,  0,  0,  0,  1,  1,  0,  0, 66,  0,  0,  0,  5,  1,  0,  0,175,  0,  0,  0,  6,  1,  0,  0,
+180,  0,  0,  0,  7,  1,  0,  0,175,  0,  0,  0,  5,  1,  0,  0, 66,  0,  0,  0,  4,  1,  0,  0,111,  0,  0,  0,  8,  1,  0,  0,
+181,  0,  0,  0,  9,  1,  0,  0,174,  0,  0,  0,252,  0,  0,  0,178,  0,  0,  0, 10,  1,  0,  0,180,  0,  0,  0,  6,  1,  0,  0,
+175,  0,  0,  0, 11,  1,  0,  0,181,  0,  0,  0, 12,  1,  0,  0,179,  0,  0,  0,254,  0,  0,  0,174,  0,  0,  0, 11,  1,  0,  0,
+175,  0,  0,  0,  9,  1,  0,  0,132,  0,  0,  0, 13,  1,  0,  0,134,  0,  0,  0, 14,  1,  0,  0,173,  0,  0,  0,125,  0,  0,  0,
+171,  0,  0,  0, 15,  1,  0,  0,173,  0,  0,  0, 14,  1,  0,  0,134,  0,  0,  0, 16,  1,  0,  0,133,  0,  0,  0, 17,  1,  0,  0,
+172,  0,  0,  0,128,  0,  0,  0,130,  0,  0,  0, 18,  1,  0,  0,132,  0,  0,  0, 15,  1,  0,  0,171,  0,  0,  0,132,  0,  0,  0,
+169,  0,  0,  0, 19,  1,  0,  0,172,  0,  0,  0, 17,  1,  0,  0,133,  0,  0,  0, 20,  1,  0,  0,131,  0,  0,  0, 21,  1,  0,  0,
+170,  0,  0,  0,134,  0,  0,  0,128,  0,  0,  0, 22,  1,  0,  0,130,  0,  0,  0, 19,  1,  0,  0,169,  0,  0,  0,138,  0,  0,  0,
+167,  0,  0,  0, 23,  1,  0,  0,170,  0,  0,  0, 21,  1,  0,  0,131,  0,  0,  0, 24,  1,  0,  0,129,  0,  0,  0, 25,  1,  0,  0,
+168,  0,  0,  0,140,  0,  0,  0,163,  0,  0,  0, 26,  1,  0,  0,184,  0,  0,  0, 27,  1,  0,  0,182,  0,  0,  0, 28,  1,  0,  0,
+165,  0,  0,  0,150,  0,  0,  0,183,  0,  0,  0, 29,  1,  0,  0,185,  0,  0,  0, 30,  1,  0,  0,164,  0,  0,  0,152,  0,  0,  0,
+166,  0,  0,  0, 31,  1,  0,  0,128,  0,  0,  0, 23,  1,  0,  0,167,  0,  0,  0,144,  0,  0,  0,165,  0,  0,  0, 28,  1,  0,  0,
+182,  0,  0,  0, 32,  1,  0,  0,166,  0,  0,  0,146,  0,  0,  0,168,  0,  0,  0, 25,  1,  0,  0,129,  0,  0,  0, 33,  1,  0,  0,
+183,  0,  0,  0, 31,  1,  0,  0,141,  0,  0,  0, 34,  1,  0,  0,187,  0,  0,  0, 35,  1,  0,  0,186,  0,  0,  0, 36,  1,  0,  0,
+184,  0,  0,  0, 37,  1,  0,  0,186,  0,  0,  0, 35,  1,  0,  0,187,  0,  0,  0, 38,  1,  0,  0,142,  0,  0,  0, 39,  1,  0,  0,
+185,  0,  0,  0, 40,  1,  0,  0,182,  0,  0,  0, 27,  1,  0,  0,184,  0,  0,  0, 36,  1,  0,  0,186,  0,  0,  0, 41,  1,  0,  0,
+ 67,  0,  0,  0, 42,  1,  0,  0,186,  0,  0,  0, 40,  1,  0,  0,185,  0,  0,  0, 29,  1,  0,  0,183,  0,  0,  0, 43,  1,  0,  0,
+ 67,  0,  0,  0, 41,  1,  0,  0,127,  0,  0,  0, 44,  1,  0,  0,128,  0,  0,  0, 32,  1,  0,  0,182,  0,  0,  0, 42,  1,  0,  0,
+ 67,  0,  0,  0, 45,  1,  0,  0,183,  0,  0,  0, 33,  1,  0,  0,129,  0,  0,  0, 46,  1,  0,  0,127,  0,  0,  0, 45,  1,  0,  0,
+ 67,  0,  0,  0, 43,  1,  0,  0,139,  0,  0,  0, 47,  1,  0,  0,190,  0,  0,  0, 48,  1,  0,  0,188,  0,  0,  0, 49,  1,  0,  0,
+141,  0,  0,  0, 50,  1,  0,  0,189,  0,  0,  0, 51,  1,  0,  0,191,  0,  0,  0, 52,  1,  0,  0,140,  0,  0,  0, 53,  1,  0,  0,
+142,  0,  0,  0, 54,  1,  0,  0,137,  0,  0,  0, 55,  1,  0,  0,192,  0,  0,  0, 56,  1,  0,  0,190,  0,  0,  0, 47,  1,  0,  0,
+139,  0,  0,  0, 57,  1,  0,  0,191,  0,  0,  0, 58,  1,  0,  0,193,  0,  0,  0, 59,  1,  0,  0,138,  0,  0,  0, 60,  1,  0,  0,
+140,  0,  0,  0, 52,  1,  0,  0,136,  0,  0,  0, 61,  1,  0,  0,194,  0,  0,  0, 62,  1,  0,  0,192,  0,  0,  0, 55,  1,  0,  0,
+137,  0,  0,  0, 63,  1,  0,  0,193,  0,  0,  0, 64,  1,  0,  0,195,  0,  0,  0, 65,  1,  0,  0,136,  0,  0,  0, 66,  1,  0,  0,
+138,  0,  0,  0, 59,  1,  0,  0,135,  0,  0,  0, 67,  1,  0,  0, 69,  0,  0,  0, 68,  1,  0,  0,194,  0,  0,  0, 61,  1,  0,  0,
+136,  0,  0,  0, 69,  1,  0,  0,195,  0,  0,  0, 70,  1,  0,  0, 69,  0,  0,  0, 67,  1,  0,  0,135,  0,  0,  0, 69,  1,  0,  0,
+136,  0,  0,  0, 65,  1,  0,  0,187,  0,  0,  0, 34,  1,  0,  0,141,  0,  0,  0, 49,  1,  0,  0,188,  0,  0,  0, 71,  1,  0,  0,
+ 68,  0,  0,  0, 72,  1,  0,  0,189,  0,  0,  0, 54,  1,  0,  0,142,  0,  0,  0, 38,  1,  0,  0,187,  0,  0,  0, 72,  1,  0,  0,
+ 68,  0,  0,  0, 73,  1,  0,  0, 68,  0,  0,  0, 71,  1,  0,  0,188,  0,  0,  0, 74,  1,  0,  0,203,  0,  0,  0, 75,  1,  0,  0,
+205,  0,  0,  0, 76,  1,  0,  0,204,  0,  0,  0, 77,  1,  0,  0,189,  0,  0,  0, 73,  1,  0,  0, 68,  0,  0,  0, 76,  1,  0,  0,
+205,  0,  0,  0, 78,  1,  0,  0, 69,  0,  0,  0, 79,  1,  0,  0,196,  0,  0,  0, 80,  1,  0,  0,197,  0,  0,  0, 81,  1,  0,  0,
+194,  0,  0,  0, 68,  1,  0,  0,198,  0,  0,  0, 82,  1,  0,  0,196,  0,  0,  0, 79,  1,  0,  0, 69,  0,  0,  0, 70,  1,  0,  0,
+195,  0,  0,  0, 83,  1,  0,  0,194,  0,  0,  0, 81,  1,  0,  0,197,  0,  0,  0, 84,  1,  0,  0,199,  0,  0,  0, 85,  1,  0,  0,
+192,  0,  0,  0, 62,  1,  0,  0,200,  0,  0,  0, 86,  1,  0,  0,198,  0,  0,  0, 83,  1,  0,  0,195,  0,  0,  0, 64,  1,  0,  0,
+193,  0,  0,  0, 87,  1,  0,  0,192,  0,  0,  0, 85,  1,  0,  0,199,  0,  0,  0, 88,  1,  0,  0,201,  0,  0,  0, 89,  1,  0,  0,
+190,  0,  0,  0, 56,  1,  0,  0,202,  0,  0,  0, 90,  1,  0,  0,200,  0,  0,  0, 87,  1,  0,  0,193,  0,  0,  0, 58,  1,  0,  0,
+191,  0,  0,  0, 91,  1,  0,  0,190,  0,  0,  0, 89,  1,  0,  0,201,  0,  0,  0, 92,  1,  0,  0,203,  0,  0,  0, 74,  1,  0,  0,
+188,  0,  0,  0, 48,  1,  0,  0,204,  0,  0,  0, 93,  1,  0,  0,202,  0,  0,  0, 91,  1,  0,  0,191,  0,  0,  0, 51,  1,  0,  0,
+189,  0,  0,  0, 77,  1,  0,  0,196,  0,  0,  0, 94,  1,  0,  0,201,  0,  0,  0, 88,  1,  0,  0,199,  0,  0,  0, 84,  1,  0,  0,
+197,  0,  0,  0, 80,  1,  0,  0,200,  0,  0,  0, 90,  1,  0,  0,202,  0,  0,  0, 95,  1,  0,  0,196,  0,  0,  0, 82,  1,  0,  0,
+198,  0,  0,  0, 86,  1,  0,  0,196,  0,  0,  0, 96,  1,  0,  0,205,  0,  0,  0, 75,  1,  0,  0,203,  0,  0,  0, 92,  1,  0,  0,
+201,  0,  0,  0, 94,  1,  0,  0,204,  0,  0,  0, 78,  1,  0,  0,205,  0,  0,  0, 96,  1,  0,  0,196,  0,  0,  0, 95,  1,  0,  0,
+202,  0,  0,  0, 93,  1,  0,  0,136,  0,  0,  0, 63,  1,  0,  0,137,  0,  0,  0, 97,  1,  0,  0,161,  0,  0,  0,253,  0,  0,  0,
+174,  0,  0,  0, 98,  1,  0,  0,162,  0,  0,  0, 99,  1,  0,  0,138,  0,  0,  0, 66,  1,  0,  0,136,  0,  0,  0, 98,  1,  0,  0,
+174,  0,  0,  0,  0,  1,  0,  0,137,  0,  0,  0, 57,  1,  0,  0,139,  0,  0,  0,100,  1,  0,  0,208,  0,  0,  0,101,  1,  0,  0,
+161,  0,  0,  0, 97,  1,  0,  0,209,  0,  0,  0,102,  1,  0,  0,140,  0,  0,  0, 60,  1,  0,  0,138,  0,  0,  0, 99,  1,  0,  0,
+162,  0,  0,  0,103,  1,  0,  0,139,  0,  0,  0, 50,  1,  0,  0,141,  0,  0,  0,104,  1,  0,  0,210,  0,  0,  0,105,  1,  0,  0,
+208,  0,  0,  0,100,  1,  0,  0,211,  0,  0,  0,106,  1,  0,  0,142,  0,  0,  0, 53,  1,  0,  0,140,  0,  0,  0,102,  1,  0,  0,
+209,  0,  0,  0,107,  1,  0,  0,141,  0,  0,  0, 37,  1,  0,  0,184,  0,  0,  0, 26,  1,  0,  0,163,  0,  0,  0,108,  1,  0,  0,
+210,  0,  0,  0,104,  1,  0,  0,164,  0,  0,  0, 30,  1,  0,  0,185,  0,  0,  0, 39,  1,  0,  0,142,  0,  0,  0,106,  1,  0,  0,
+211,  0,  0,  0,109,  1,  0,  0, 79,  0,  0,  0,110,  1,  0,  0,206,  0,  0,  0,111,  1,  0,  0,210,  0,  0,  0,108,  1,  0,  0,
+163,  0,  0,  0,149,  0,  0,  0,211,  0,  0,  0,112,  1,  0,  0,207,  0,  0,  0,113,  1,  0,  0, 80,  0,  0,  0,153,  0,  0,  0,
+164,  0,  0,  0,109,  1,  0,  0,206,  0,  0,  0,114,  1,  0,  0,212,  0,  0,  0,115,  1,  0,  0,208,  0,  0,  0,105,  1,  0,  0,
+210,  0,  0,  0,111,  1,  0,  0,209,  0,  0,  0,116,  1,  0,  0,213,  0,  0,  0,117,  1,  0,  0,207,  0,  0,  0,112,  1,  0,  0,
+211,  0,  0,  0,107,  1,  0,  0, 77,  0,  0,  0,158,  0,  0,  0,161,  0,  0,  0,101,  1,  0,  0,208,  0,  0,  0,115,  1,  0,  0,
+212,  0,  0,  0,118,  1,  0,  0,209,  0,  0,  0,103,  1,  0,  0,162,  0,  0,  0,161,  0,  0,  0, 78,  0,  0,  0,119,  1,  0,  0,
+213,  0,  0,  0,116,  1,  0,  0,128,  0,  0,  0, 44,  1,  0,  0,127,  0,  0,  0,120,  1,  0,  0, 70,  0,  0,  0,121,  1,  0,  0,
+219,  0,  0,  0,122,  1,  0,  0, 70,  0,  0,  0,120,  1,  0,  0,127,  0,  0,  0, 46,  1,  0,  0,129,  0,  0,  0,123,  1,  0,  0,
+220,  0,  0,  0,124,  1,  0,  0,130,  0,  0,  0, 22,  1,  0,  0,128,  0,  0,  0,122,  1,  0,  0,219,  0,  0,  0,125,  1,  0,  0,
+217,  0,  0,  0,126,  1,  0,  0,220,  0,  0,  0,123,  1,  0,  0,129,  0,  0,  0, 24,  1,  0,  0,131,  0,  0,  0,127,  1,  0,  0,
+218,  0,  0,  0,128,  1,  0,  0,132,  0,  0,  0, 18,  1,  0,  0,130,  0,  0,  0,126,  1,  0,  0,217,  0,  0,  0,129,  1,  0,  0,
+215,  0,  0,  0,130,  1,  0,  0,218,  0,  0,  0,127,  1,  0,  0,131,  0,  0,  0, 20,  1,  0,  0,133,  0,  0,  0,131,  1,  0,  0,
+216,  0,  0,  0,132,  1,  0,  0,134,  0,  0,  0, 13,  1,  0,  0,132,  0,  0,  0,130,  1,  0,  0,215,  0,  0,  0,133,  1,  0,  0,
+214,  0,  0,  0,134,  1,  0,  0,216,  0,  0,  0,131,  1,  0,  0,133,  0,  0,  0, 16,  1,  0,  0,134,  0,  0,  0,134,  1,  0,  0,
+214,  0,  0,  0,135,  1,  0,  0,214,  0,  0,  0,133,  1,  0,  0,215,  0,  0,  0,136,  1,  0,  0,226,  0,  0,  0,137,  1,  0,  0,
+228,  0,  0,  0,138,  1,  0,  0,227,  0,  0,  0,139,  1,  0,  0,216,  0,  0,  0,135,  1,  0,  0,214,  0,  0,  0,138,  1,  0,  0,
+228,  0,  0,  0,140,  1,  0,  0,215,  0,  0,  0,129,  1,  0,  0,217,  0,  0,  0,141,  1,  0,  0,224,  0,  0,  0,142,  1,  0,  0,
+226,  0,  0,  0,136,  1,  0,  0,225,  0,  0,  0,143,  1,  0,  0,218,  0,  0,  0,132,  1,  0,  0,216,  0,  0,  0,139,  1,  0,  0,
+227,  0,  0,  0,144,  1,  0,  0,217,  0,  0,  0,125,  1,  0,  0,219,  0,  0,  0,145,  1,  0,  0,222,  0,  0,  0,146,  1,  0,  0,
+224,  0,  0,  0,141,  1,  0,  0,223,  0,  0,  0,147,  1,  0,  0,220,  0,  0,  0,128,  1,  0,  0,218,  0,  0,  0,143,  1,  0,  0,
+225,  0,  0,  0,148,  1,  0,  0,219,  0,  0,  0,121,  1,  0,  0, 70,  0,  0,  0,149,  1,  0,  0,221,  0,  0,  0,150,  1,  0,  0,
+222,  0,  0,  0,145,  1,  0,  0,221,  0,  0,  0,149,  1,  0,  0, 70,  0,  0,  0,124,  1,  0,  0,220,  0,  0,  0,147,  1,  0,  0,
+223,  0,  0,  0,151,  1,  0,  0,221,  0,  0,  0,152,  1,  0,  0,228,  0,  0,  0,137,  1,  0,  0,226,  0,  0,  0,153,  1,  0,  0,
+222,  0,  0,  0,150,  1,  0,  0,227,  0,  0,  0,140,  1,  0,  0,228,  0,  0,  0,152,  1,  0,  0,221,  0,  0,  0,151,  1,  0,  0,
+223,  0,  0,  0,154,  1,  0,  0,222,  0,  0,  0,153,  1,  0,  0,226,  0,  0,  0,142,  1,  0,  0,224,  0,  0,  0,146,  1,  0,  0,
+225,  0,  0,  0,144,  1,  0,  0,227,  0,  0,  0,154,  1,  0,  0,223,  0,  0,  0,148,  1,  0,  0,180,  0,  0,  0, 10,  1,  0,  0,
+178,  0,  0,  0,155,  1,  0,  0,231,  0,  0,  0,156,  1,  0,  0,229,  0,  0,  0,157,  1,  0,  0,232,  0,  0,  0,158,  1,  0,  0,
+179,  0,  0,  0, 12,  1,  0,  0,181,  0,  0,  0,159,  1,  0,  0,230,  0,  0,  0,160,  1,  0,  0,110,  0,  0,  0,  7,  1,  0,  0,
+180,  0,  0,  0,157,  1,  0,  0,229,  0,  0,  0,161,  1,  0,  0,251,  0,  0,  0,162,  1,  0,  0,230,  0,  0,  0,159,  1,  0,  0,
+181,  0,  0,  0,  8,  1,  0,  0,111,  0,  0,  0,163,  1,  0,  0,252,  0,  0,  0,164,  1,  0,  0,108,  0,  0,  0,  2,  1,  0,  0,
+110,  0,  0,  0,162,  1,  0,  0,251,  0,  0,  0,165,  1,  0,  0,253,  0,  0,  0,166,  1,  0,  0,252,  0,  0,  0,163,  1,  0,  0,
+111,  0,  0,  0,  3,  1,  0,  0,109,  0,  0,  0,167,  1,  0,  0,254,  0,  0,  0,168,  1,  0,  0,178,  0,  0,  0,230,  3,  0,  0,
+ 14,  0,  0,  0,229,  3,  0,  0,249,  0,  0,  0,169,  1,  0,  0,231,  0,  0,  0,155,  1,  0,  0,250,  0,  0,  0,170,  1,  0,  0,
+112,  0,  0,  0,255,  0,  0,  0,179,  0,  0,  0,158,  1,  0,  0,232,  0,  0,  0,171,  1,  0,  0, 14,  0,  0,  0,231,  3,  0,  0,
+113,  0,  0,  0,172,  1,  0,  0,247,  0,  0,  0,173,  1,  0,  0,249,  0,  0,  0,229,  3,  0,  0,248,  0,  0,  0,174,  1,  0,  0,
+114,  0,  0,  0,251,  0,  0,  0,112,  0,  0,  0,170,  1,  0,  0,250,  0,  0,  0,175,  1,  0,  0,113,  0,  0,  0,247,  0,  0,  0,
+115,  0,  0,  0,176,  1,  0,  0,245,  0,  0,  0,177,  1,  0,  0,247,  0,  0,  0,172,  1,  0,  0,246,  0,  0,  0,178,  1,  0,  0,
+116,  0,  0,  0,249,  0,  0,  0,114,  0,  0,  0,174,  1,  0,  0,248,  0,  0,  0,179,  1,  0,  0,115,  0,  0,  0,243,  0,  0,  0,
+117,  0,  0,  0,180,  1,  0,  0,243,  0,  0,  0,181,  1,  0,  0,245,  0,  0,  0,176,  1,  0,  0,244,  0,  0,  0,182,  1,  0,  0,
+118,  0,  0,  0,245,  0,  0,  0,116,  0,  0,  0,178,  1,  0,  0,246,  0,  0,  0,183,  1,  0,  0,117,  0,  0,  0,239,  0,  0,  0,
+119,  0,  0,  0,184,  1,  0,  0,241,  0,  0,  0,185,  1,  0,  0,243,  0,  0,  0,180,  1,  0,  0,242,  0,  0,  0,186,  1,  0,  0,
+120,  0,  0,  0,241,  0,  0,  0,118,  0,  0,  0,182,  1,  0,  0,244,  0,  0,  0,187,  1,  0,  0,119,  0,  0,  0,235,  0,  0,  0,
+121,  0,  0,  0,188,  1,  0,  0,239,  0,  0,  0,189,  1,  0,  0,241,  0,  0,  0,184,  1,  0,  0,240,  0,  0,  0,190,  1,  0,  0,
+122,  0,  0,  0,237,  0,  0,  0,120,  0,  0,  0,186,  1,  0,  0,242,  0,  0,  0,191,  1,  0,  0,121,  0,  0,  0,231,  0,  0,  0,
+123,  0,  0,  0,192,  1,  0,  0,237,  0,  0,  0,193,  1,  0,  0,239,  0,  0,  0,188,  1,  0,  0,238,  0,  0,  0,194,  1,  0,  0,
+124,  0,  0,  0,233,  0,  0,  0,122,  0,  0,  0,190,  1,  0,  0,240,  0,  0,  0,195,  1,  0,  0,123,  0,  0,  0,227,  0,  0,  0,
+176,  0,  0,  0,196,  1,  0,  0,233,  0,  0,  0,197,  1,  0,  0,237,  0,  0,  0,192,  1,  0,  0,234,  0,  0,  0,198,  1,  0,  0,
+177,  0,  0,  0,229,  0,  0,  0,124,  0,  0,  0,194,  1,  0,  0,238,  0,  0,  0,199,  1,  0,  0,176,  0,  0,  0,222,  0,  0,  0,
+125,  0,  0,  0,200,  1,  0,  0,235,  0,  0,  0,201,  1,  0,  0,233,  0,  0,  0,196,  1,  0,  0,236,  0,  0,  0,202,  1,  0,  0,
+126,  0,  0,  0,225,  0,  0,  0,177,  0,  0,  0,198,  1,  0,  0,234,  0,  0,  0,203,  1,  0,  0,125,  0,  0,  0,216,  0,  0,  0,
+108,  0,  0,  0,166,  1,  0,  0,253,  0,  0,  0,204,  1,  0,  0,235,  0,  0,  0,200,  1,  0,  0,254,  0,  0,  0,167,  1,  0,  0,
+109,  0,  0,  0,220,  0,  0,  0,126,  0,  0,  0,202,  1,  0,  0,236,  0,  0,  0,205,  1,  0,  0,235,  0,  0,  0,204,  1,  0,  0,
+253,  0,  0,  0,206,  1,  0,  0,255,  0,  0,  0,207,  1,  0,  0, 17,  1,  0,  0,208,  1,  0,  0,  0,  1,  0,  0,209,  1,  0,  0,
+254,  0,  0,  0,205,  1,  0,  0,236,  0,  0,  0,210,  1,  0,  0, 18,  1,  0,  0,211,  1,  0,  0,233,  0,  0,  0,201,  1,  0,  0,
+235,  0,  0,  0,208,  1,  0,  0, 17,  1,  0,  0,212,  1,  0,  0, 19,  1,  0,  0,213,  1,  0,  0, 18,  1,  0,  0,210,  1,  0,  0,
+236,  0,  0,  0,203,  1,  0,  0,234,  0,  0,  0,214,  1,  0,  0, 20,  1,  0,  0,215,  1,  0,  0,237,  0,  0,  0,197,  1,  0,  0,
+233,  0,  0,  0,213,  1,  0,  0, 19,  1,  0,  0,216,  1,  0,  0, 15,  1,  0,  0,217,  1,  0,  0, 20,  1,  0,  0,214,  1,  0,  0,
+234,  0,  0,  0,199,  1,  0,  0,238,  0,  0,  0,218,  1,  0,  0, 16,  1,  0,  0,219,  1,  0,  0,239,  0,  0,  0,193,  1,  0,  0,
+237,  0,  0,  0,217,  1,  0,  0, 15,  1,  0,  0,220,  1,  0,  0, 13,  1,  0,  0,221,  1,  0,  0, 16,  1,  0,  0,218,  1,  0,  0,
+238,  0,  0,  0,195,  1,  0,  0,240,  0,  0,  0,222,  1,  0,  0, 14,  1,  0,  0,223,  1,  0,  0,241,  0,  0,  0,189,  1,  0,  0,
+239,  0,  0,  0,221,  1,  0,  0, 13,  1,  0,  0,224,  1,  0,  0, 11,  1,  0,  0,225,  1,  0,  0, 14,  1,  0,  0,222,  1,  0,  0,
+240,  0,  0,  0,191,  1,  0,  0,242,  0,  0,  0,226,  1,  0,  0, 12,  1,  0,  0,227,  1,  0,  0,243,  0,  0,  0,185,  1,  0,  0,
+241,  0,  0,  0,225,  1,  0,  0, 11,  1,  0,  0,228,  1,  0,  0,  9,  1,  0,  0,229,  1,  0,  0, 12,  1,  0,  0,226,  1,  0,  0,
+242,  0,  0,  0,187,  1,  0,  0,244,  0,  0,  0,230,  1,  0,  0, 10,  1,  0,  0,231,  1,  0,  0,245,  0,  0,  0,181,  1,  0,  0,
+243,  0,  0,  0,229,  1,  0,  0,  9,  1,  0,  0,232,  1,  0,  0,  7,  1,  0,  0,233,  1,  0,  0, 10,  1,  0,  0,230,  1,  0,  0,
+244,  0,  0,  0,183,  1,  0,  0,246,  0,  0,  0,234,  1,  0,  0,  8,  1,  0,  0,235,  1,  0,  0,247,  0,  0,  0,177,  1,  0,  0,
+245,  0,  0,  0,233,  1,  0,  0,  7,  1,  0,  0,236,  1,  0,  0,  5,  1,  0,  0,237,  1,  0,  0,  8,  1,  0,  0,234,  1,  0,  0,
+246,  0,  0,  0,179,  1,  0,  0,248,  0,  0,  0,238,  1,  0,  0,  6,  1,  0,  0,239,  1,  0,  0,249,  0,  0,  0,173,  1,  0,  0,
+247,  0,  0,  0,237,  1,  0,  0,  5,  1,  0,  0,240,  1,  0,  0,  3,  1,  0,  0,241,  1,  0,  0,  6,  1,  0,  0,238,  1,  0,  0,
+248,  0,  0,  0,175,  1,  0,  0,250,  0,  0,  0,242,  1,  0,  0,  4,  1,  0,  0,243,  1,  0,  0,231,  0,  0,  0,169,  1,  0,  0,
+249,  0,  0,  0,241,  1,  0,  0,  3,  1,  0,  0,244,  1,  0,  0, 21,  1,  0,  0,245,  1,  0,  0,  4,  1,  0,  0,242,  1,  0,  0,
+250,  0,  0,  0,171,  1,  0,  0,232,  0,  0,  0,246,  1,  0,  0, 22,  1,  0,  0,247,  1,  0,  0,253,  0,  0,  0,165,  1,  0,  0,
+251,  0,  0,  0,248,  1,  0,  0,  1,  1,  0,  0,249,  1,  0,  0,255,  0,  0,  0,206,  1,  0,  0,  2,  1,  0,  0,250,  1,  0,  0,
+252,  0,  0,  0,168,  1,  0,  0,254,  0,  0,  0,209,  1,  0,  0,  0,  1,  0,  0,251,  1,  0,  0,251,  0,  0,  0,161,  1,  0,  0,
+229,  0,  0,  0,252,  1,  0,  0, 23,  1,  0,  0,253,  1,  0,  0,  1,  1,  0,  0,248,  1,  0,  0, 24,  1,  0,  0,254,  1,  0,  0,
+230,  0,  0,  0,164,  1,  0,  0,252,  0,  0,  0,250,  1,  0,  0,  2,  1,  0,  0,255,  1,  0,  0,229,  0,  0,  0,156,  1,  0,  0,
+231,  0,  0,  0,245,  1,  0,  0, 21,  1,  0,  0,  0,  2,  0,  0, 23,  1,  0,  0,252,  1,  0,  0, 22,  1,  0,  0,246,  1,  0,  0,
+232,  0,  0,  0,160,  1,  0,  0,230,  0,  0,  0,254,  1,  0,  0, 24,  1,  0,  0,  1,  2,  0,  0, 65,  0,  0,  0,211,  0,  0,  0,
+106,  0,  0,  0,  2,  2,  0,  0, 25,  1,  0,  0,  3,  2,  0,  0, 71,  0,  0,  0,  4,  2,  0,  0, 26,  1,  0,  0,  5,  2,  0,  0,
+107,  0,  0,  0,214,  0,  0,  0, 65,  0,  0,  0,  4,  2,  0,  0, 71,  0,  0,  0,  6,  2,  0,  0,106,  0,  0,  0,205,  0,  0,  0,
+104,  0,  0,  0,  7,  2,  0,  0, 27,  1,  0,  0,  8,  2,  0,  0, 25,  1,  0,  0,  2,  2,  0,  0, 28,  1,  0,  0,  9,  2,  0,  0,
+105,  0,  0,  0,209,  0,  0,  0,107,  0,  0,  0,  5,  2,  0,  0, 26,  1,  0,  0, 10,  2,  0,  0,104,  0,  0,  0,199,  0,  0,  0,
+102,  0,  0,  0, 11,  2,  0,  0, 29,  1,  0,  0, 12,  2,  0,  0, 27,  1,  0,  0,  7,  2,  0,  0, 30,  1,  0,  0, 13,  2,  0,  0,
+103,  0,  0,  0,203,  0,  0,  0,105,  0,  0,  0,  9,  2,  0,  0, 28,  1,  0,  0, 14,  2,  0,  0,102,  0,  0,  0,193,  0,  0,  0,
+100,  0,  0,  0, 15,  2,  0,  0, 31,  1,  0,  0, 16,  2,  0,  0, 29,  1,  0,  0, 11,  2,  0,  0, 32,  1,  0,  0, 17,  2,  0,  0,
+101,  0,  0,  0,197,  0,  0,  0,103,  0,  0,  0, 13,  2,  0,  0, 30,  1,  0,  0, 18,  2,  0,  0,100,  0,  0,  0,187,  0,  0,  0,
+ 98,  0,  0,  0, 19,  2,  0,  0, 33,  1,  0,  0, 20,  2,  0,  0, 31,  1,  0,  0, 15,  2,  0,  0, 34,  1,  0,  0, 21,  2,  0,  0,
+ 99,  0,  0,  0,191,  0,  0,  0,101,  0,  0,  0, 17,  2,  0,  0, 32,  1,  0,  0, 22,  2,  0,  0, 98,  0,  0,  0,181,  0,  0,  0,
+ 96,  0,  0,  0, 23,  2,  0,  0, 35,  1,  0,  0, 24,  2,  0,  0, 33,  1,  0,  0, 19,  2,  0,  0, 36,  1,  0,  0, 25,  2,  0,  0,
+ 97,  0,  0,  0,185,  0,  0,  0, 99,  0,  0,  0, 21,  2,  0,  0, 34,  1,  0,  0, 26,  2,  0,  0, 96,  0,  0,  0,175,  0,  0,  0,
+ 94,  0,  0,  0, 27,  2,  0,  0, 37,  1,  0,  0, 28,  2,  0,  0, 35,  1,  0,  0, 23,  2,  0,  0, 38,  1,  0,  0, 29,  2,  0,  0,
+ 95,  0,  0,  0,179,  0,  0,  0, 97,  0,  0,  0, 25,  2,  0,  0, 36,  1,  0,  0, 30,  2,  0,  0, 94,  0,  0,  0,169,  0,  0,  0,
+ 92,  0,  0,  0, 31,  2,  0,  0, 39,  1,  0,  0, 32,  2,  0,  0, 37,  1,  0,  0, 27,  2,  0,  0, 40,  1,  0,  0, 33,  2,  0,  0,
+ 93,  0,  0,  0,173,  0,  0,  0, 95,  0,  0,  0, 29,  2,  0,  0, 38,  1,  0,  0, 34,  2,  0,  0, 92,  0,  0,  0,163,  0,  0,  0,
+ 90,  0,  0,  0, 35,  2,  0,  0, 41,  1,  0,  0, 36,  2,  0,  0, 39,  1,  0,  0, 31,  2,  0,  0, 42,  1,  0,  0, 37,  2,  0,  0,
+ 91,  0,  0,  0,167,  0,  0,  0, 93,  0,  0,  0, 33,  2,  0,  0, 40,  1,  0,  0, 38,  2,  0,  0, 49,  1,  0,  0, 39,  2,  0,  0,
+ 50,  1,  0,  0, 40,  2,  0,  0, 69,  1,  0,  0, 41,  2,  0,  0, 79,  1,  0,  0, 42,  2,  0,  0, 70,  1,  0,  0, 43,  2,  0,  0,
+ 50,  1,  0,  0, 39,  2,  0,  0, 49,  1,  0,  0, 44,  2,  0,  0, 80,  1,  0,  0, 45,  2,  0,  0, 48,  1,  0,  0, 46,  2,  0,  0,
+ 49,  1,  0,  0, 42,  2,  0,  0, 79,  1,  0,  0, 47,  2,  0,  0, 77,  1,  0,  0, 48,  2,  0,  0, 80,  1,  0,  0, 44,  2,  0,  0,
+ 49,  1,  0,  0, 46,  2,  0,  0, 48,  1,  0,  0, 49,  2,  0,  0, 78,  1,  0,  0, 50,  2,  0,  0, 47,  1,  0,  0, 51,  2,  0,  0,
+ 48,  1,  0,  0, 48,  2,  0,  0, 77,  1,  0,  0, 52,  2,  0,  0, 81,  1,  0,  0, 53,  2,  0,  0, 78,  1,  0,  0, 49,  2,  0,  0,
+ 48,  1,  0,  0, 51,  2,  0,  0, 47,  1,  0,  0, 54,  2,  0,  0, 82,  1,  0,  0, 55,  2,  0,  0, 87,  0,  0,  0,127,  0,  0,  0,
+ 89,  0,  0,  0, 56,  2,  0,  0, 47,  1,  0,  0, 53,  2,  0,  0, 81,  1,  0,  0, 57,  2,  0,  0, 47,  1,  0,  0, 56,  2,  0,  0,
+ 89,  0,  0,  0,130,  0,  0,  0, 88,  0,  0,  0, 58,  2,  0,  0, 82,  1,  0,  0, 54,  2,  0,  0, 85,  0,  0,  0,133,  0,  0,  0,
+ 87,  0,  0,  0, 57,  2,  0,  0, 81,  1,  0,  0, 59,  2,  0,  0, 75,  1,  0,  0, 60,  2,  0,  0, 82,  1,  0,  0, 58,  2,  0,  0,
+ 88,  0,  0,  0,136,  0,  0,  0, 86,  0,  0,  0, 61,  2,  0,  0, 76,  1,  0,  0, 62,  2,  0,  0, 83,  0,  0,  0,139,  0,  0,  0,
+ 85,  0,  0,  0, 60,  2,  0,  0, 75,  1,  0,  0, 63,  2,  0,  0, 71,  1,  0,  0, 64,  2,  0,  0, 76,  1,  0,  0, 61,  2,  0,  0,
+ 86,  0,  0,  0,142,  0,  0,  0, 84,  0,  0,  0, 65,  2,  0,  0, 72,  1,  0,  0, 66,  2,  0,  0, 81,  0,  0,  0,145,  0,  0,  0,
+ 83,  0,  0,  0, 64,  2,  0,  0, 71,  1,  0,  0, 67,  2,  0,  0, 73,  1,  0,  0, 68,  2,  0,  0, 72,  1,  0,  0, 65,  2,  0,  0,
+ 84,  0,  0,  0,148,  0,  0,  0, 82,  0,  0,  0, 69,  2,  0,  0, 74,  1,  0,  0, 70,  2,  0,  0, 71,  1,  0,  0, 71,  2,  0,  0,
+ 77,  1,  0,  0, 47,  2,  0,  0, 79,  1,  0,  0, 72,  2,  0,  0, 73,  1,  0,  0, 67,  2,  0,  0, 80,  1,  0,  0, 50,  2,  0,  0,
+ 78,  1,  0,  0, 73,  2,  0,  0, 72,  1,  0,  0, 70,  2,  0,  0, 74,  1,  0,  0, 74,  2,  0,  0, 71,  1,  0,  0, 63,  2,  0,  0,
+ 75,  1,  0,  0, 59,  2,  0,  0, 81,  1,  0,  0, 52,  2,  0,  0, 77,  1,  0,  0, 71,  2,  0,  0, 82,  1,  0,  0, 62,  2,  0,  0,
+ 76,  1,  0,  0, 66,  2,  0,  0, 72,  1,  0,  0, 73,  2,  0,  0, 78,  1,  0,  0, 55,  2,  0,  0, 67,  1,  0,  0, 75,  2,  0,  0,
+ 73,  1,  0,  0, 72,  2,  0,  0, 79,  1,  0,  0, 41,  2,  0,  0, 69,  1,  0,  0, 76,  2,  0,  0, 80,  1,  0,  0, 74,  2,  0,  0,
+ 74,  1,  0,  0, 77,  2,  0,  0, 68,  1,  0,  0, 78,  2,  0,  0, 70,  1,  0,  0, 45,  2,  0,  0, 79,  0,  0,  0,151,  0,  0,  0,
+ 81,  0,  0,  0, 68,  2,  0,  0, 73,  1,  0,  0, 75,  2,  0,  0, 67,  1,  0,  0, 79,  2,  0,  0, 74,  1,  0,  0, 69,  2,  0,  0,
+ 82,  0,  0,  0,154,  0,  0,  0, 80,  0,  0,  0, 80,  2,  0,  0, 68,  1,  0,  0, 77,  2,  0,  0,206,  0,  0,  0, 81,  2,  0,  0,
+ 83,  1,  0,  0, 82,  2,  0,  0, 85,  1,  0,  0, 83,  2,  0,  0,212,  0,  0,  0,114,  1,  0,  0, 86,  1,  0,  0, 84,  2,  0,  0,
+ 84,  1,  0,  0, 85,  2,  0,  0,207,  0,  0,  0,117,  1,  0,  0,213,  0,  0,  0, 86,  2,  0,  0, 79,  0,  0,  0, 79,  2,  0,  0,
+ 67,  1,  0,  0, 87,  2,  0,  0, 83,  1,  0,  0, 81,  2,  0,  0,206,  0,  0,  0,110,  1,  0,  0, 84,  1,  0,  0, 88,  2,  0,  0,
+ 68,  1,  0,  0, 80,  2,  0,  0, 80,  0,  0,  0,113,  1,  0,  0,207,  0,  0,  0, 85,  2,  0,  0, 77,  0,  0,  0,118,  1,  0,  0,
+212,  0,  0,  0, 83,  2,  0,  0, 85,  1,  0,  0, 89,  2,  0,  0, 87,  1,  0,  0, 90,  2,  0,  0, 86,  1,  0,  0, 86,  2,  0,  0,
+213,  0,  0,  0,119,  1,  0,  0, 78,  0,  0,  0, 91,  2,  0,  0, 88,  1,  0,  0, 92,  2,  0,  0, 77,  0,  0,  0, 90,  2,  0,  0,
+ 87,  1,  0,  0, 93,  2,  0,  0, 41,  1,  0,  0, 35,  2,  0,  0, 90,  0,  0,  0,155,  0,  0,  0, 42,  1,  0,  0, 94,  2,  0,  0,
+ 88,  1,  0,  0, 91,  2,  0,  0, 78,  0,  0,  0,160,  0,  0,  0, 91,  0,  0,  0, 37,  2,  0,  0, 75,  0,  0,  0, 95,  2,  0,  0,
+ 65,  1,  0,  0, 96,  2,  0,  0, 93,  1,  0,  0, 97,  2,  0,  0, 45,  1,  0,  0, 98,  2,  0,  0, 94,  1,  0,  0, 99,  2,  0,  0,
+ 66,  1,  0,  0,100,  2,  0,  0, 75,  0,  0,  0, 98,  2,  0,  0, 45,  1,  0,  0,101,  2,  0,  0, 45,  1,  0,  0, 97,  2,  0,  0,
+ 93,  1,  0,  0,102,  2,  0,  0, 91,  1,  0,  0,103,  2,  0,  0, 76,  0,  0,  0,104,  2,  0,  0, 92,  1,  0,  0,105,  2,  0,  0,
+ 94,  1,  0,  0,101,  2,  0,  0, 45,  1,  0,  0,104,  2,  0,  0, 76,  0,  0,  0,106,  2,  0,  0, 76,  0,  0,  0,103,  2,  0,  0,
+ 91,  1,  0,  0,107,  2,  0,  0, 89,  1,  0,  0,108,  2,  0,  0, 46,  1,  0,  0,109,  2,  0,  0, 90,  1,  0,  0,110,  2,  0,  0,
+ 92,  1,  0,  0,106,  2,  0,  0, 76,  0,  0,  0,109,  2,  0,  0, 46,  1,  0,  0,111,  2,  0,  0, 46,  1,  0,  0,108,  2,  0,  0,
+ 89,  1,  0,  0,112,  2,  0,  0, 69,  1,  0,  0, 40,  2,  0,  0, 50,  1,  0,  0,113,  2,  0,  0, 70,  1,  0,  0,114,  2,  0,  0,
+ 90,  1,  0,  0,111,  2,  0,  0, 46,  1,  0,  0,113,  2,  0,  0, 50,  1,  0,  0, 43,  2,  0,  0, 67,  1,  0,  0, 76,  2,  0,  0,
+ 69,  1,  0,  0,112,  2,  0,  0, 89,  1,  0,  0,115,  2,  0,  0, 83,  1,  0,  0, 87,  2,  0,  0, 90,  1,  0,  0,114,  2,  0,  0,
+ 70,  1,  0,  0, 78,  2,  0,  0, 68,  1,  0,  0, 88,  2,  0,  0, 84,  1,  0,  0,116,  2,  0,  0, 37,  1,  0,  0, 32,  2,  0,  0,
+ 39,  1,  0,  0,117,  2,  0,  0, 59,  1,  0,  0,118,  2,  0,  0, 51,  1,  0,  0,119,  2,  0,  0, 60,  1,  0,  0,120,  2,  0,  0,
+ 40,  1,  0,  0, 34,  2,  0,  0, 38,  1,  0,  0,121,  2,  0,  0, 52,  1,  0,  0,122,  2,  0,  0, 74,  0,  0,  0,123,  2,  0,  0,
+ 57,  1,  0,  0,124,  2,  0,  0, 65,  1,  0,  0, 95,  2,  0,  0, 75,  0,  0,  0,125,  2,  0,  0, 66,  1,  0,  0,126,  2,  0,  0,
+ 58,  1,  0,  0,127,  2,  0,  0, 74,  0,  0,  0,125,  2,  0,  0, 75,  0,  0,  0,100,  2,  0,  0, 43,  1,  0,  0,128,  2,  0,  0,
+ 99,  1,  0,  0,129,  2,  0,  0, 97,  1,  0,  0,130,  2,  0,  0, 44,  1,  0,  0,131,  2,  0,  0, 98,  1,  0,  0,132,  2,  0,  0,
+100,  1,  0,  0,133,  2,  0,  0, 43,  1,  0,  0,131,  2,  0,  0, 44,  1,  0,  0,134,  2,  0,  0, 44,  1,  0,  0,130,  2,  0,  0,
+ 97,  1,  0,  0,135,  2,  0,  0, 95,  1,  0,  0,136,  2,  0,  0, 73,  0,  0,  0,137,  2,  0,  0, 96,  1,  0,  0,138,  2,  0,  0,
+ 98,  1,  0,  0,134,  2,  0,  0, 44,  1,  0,  0,137,  2,  0,  0, 73,  0,  0,  0,139,  2,  0,  0, 73,  0,  0,  0,136,  2,  0,  0,
+ 95,  1,  0,  0,140,  2,  0,  0, 57,  1,  0,  0,123,  2,  0,  0, 74,  0,  0,  0,141,  2,  0,  0, 58,  1,  0,  0,142,  2,  0,  0,
+ 96,  1,  0,  0,139,  2,  0,  0, 73,  0,  0,  0,141,  2,  0,  0, 74,  0,  0,  0,127,  2,  0,  0, 33,  1,  0,  0, 24,  2,  0,  0,
+ 35,  1,  0,  0,143,  2,  0,  0,103,  1,  0,  0,144,  2,  0,  0,105,  1,  0,  0,145,  2,  0,  0,104,  1,  0,  0,146,  2,  0,  0,
+ 36,  1,  0,  0, 26,  2,  0,  0, 34,  1,  0,  0,147,  2,  0,  0,106,  1,  0,  0,148,  2,  0,  0,105,  1,  0,  0,144,  2,  0,  0,
+103,  1,  0,  0,149,  2,  0,  0,109,  1,  0,  0,150,  2,  0,  0,107,  1,  0,  0,151,  2,  0,  0,110,  1,  0,  0,152,  2,  0,  0,
+104,  1,  0,  0,148,  2,  0,  0,106,  1,  0,  0,153,  2,  0,  0,108,  1,  0,  0,154,  2,  0,  0,107,  1,  0,  0,150,  2,  0,  0,
+109,  1,  0,  0,155,  2,  0,  0,111,  1,  0,  0,156,  2,  0,  0,113,  1,  0,  0,157,  2,  0,  0,112,  1,  0,  0,158,  2,  0,  0,
+110,  1,  0,  0,154,  2,  0,  0,108,  1,  0,  0,159,  2,  0,  0,114,  1,  0,  0,160,  2,  0,  0,113,  1,  0,  0,156,  2,  0,  0,
+111,  1,  0,  0,161,  2,  0,  0,117,  1,  0,  0,162,  2,  0,  0,115,  1,  0,  0,163,  2,  0,  0,118,  1,  0,  0,164,  2,  0,  0,
+112,  1,  0,  0,160,  2,  0,  0,114,  1,  0,  0,165,  2,  0,  0,116,  1,  0,  0,166,  2,  0,  0, 55,  1,  0,  0,167,  2,  0,  0,
+119,  1,  0,  0,168,  2,  0,  0,115,  1,  0,  0,162,  2,  0,  0,117,  1,  0,  0,169,  2,  0,  0,116,  1,  0,  0,170,  2,  0,  0,
+120,  1,  0,  0,171,  2,  0,  0, 56,  1,  0,  0,172,  2,  0,  0,118,  1,  0,  0,166,  2,  0,  0, 57,  1,  0,  0,140,  2,  0,  0,
+ 95,  1,  0,  0,173,  2,  0,  0,115,  1,  0,  0,168,  2,  0,  0,119,  1,  0,  0,174,  2,  0,  0,116,  1,  0,  0,175,  2,  0,  0,
+ 96,  1,  0,  0,142,  2,  0,  0, 58,  1,  0,  0,176,  2,  0,  0,120,  1,  0,  0,170,  2,  0,  0, 95,  1,  0,  0,135,  2,  0,  0,
+ 97,  1,  0,  0,177,  2,  0,  0,113,  1,  0,  0,163,  2,  0,  0,115,  1,  0,  0,173,  2,  0,  0,114,  1,  0,  0,178,  2,  0,  0,
+ 98,  1,  0,  0,138,  2,  0,  0, 96,  1,  0,  0,175,  2,  0,  0,116,  1,  0,  0,165,  2,  0,  0, 97,  1,  0,  0,129,  2,  0,  0,
+ 99,  1,  0,  0,179,  2,  0,  0,107,  1,  0,  0,157,  2,  0,  0,113,  1,  0,  0,177,  2,  0,  0,108,  1,  0,  0,180,  2,  0,  0,
+100,  1,  0,  0,132,  2,  0,  0, 98,  1,  0,  0,178,  2,  0,  0,114,  1,  0,  0,159,  2,  0,  0, 99,  1,  0,  0,181,  2,  0,  0,
+101,  1,  0,  0,182,  2,  0,  0,105,  1,  0,  0,151,  2,  0,  0,107,  1,  0,  0,179,  2,  0,  0,106,  1,  0,  0,183,  2,  0,  0,
+102,  1,  0,  0,184,  2,  0,  0,100,  1,  0,  0,180,  2,  0,  0,108,  1,  0,  0,153,  2,  0,  0, 31,  1,  0,  0, 20,  2,  0,  0,
+ 33,  1,  0,  0,145,  2,  0,  0,105,  1,  0,  0,182,  2,  0,  0,101,  1,  0,  0,185,  2,  0,  0,106,  1,  0,  0,147,  2,  0,  0,
+ 34,  1,  0,  0, 22,  2,  0,  0, 32,  1,  0,  0,186,  2,  0,  0,102,  1,  0,  0,183,  2,  0,  0, 72,  0,  0,  0,187,  2,  0,  0,
+101,  1,  0,  0,181,  2,  0,  0, 99,  1,  0,  0,128,  2,  0,  0, 43,  1,  0,  0,188,  2,  0,  0,100,  1,  0,  0,184,  2,  0,  0,
+102,  1,  0,  0,189,  2,  0,  0, 72,  0,  0,  0,188,  2,  0,  0, 43,  1,  0,  0,133,  2,  0,  0, 25,  1,  0,  0,  8,  2,  0,  0,
+ 27,  1,  0,  0, 12,  2,  0,  0, 29,  1,  0,  0, 16,  2,  0,  0, 31,  1,  0,  0,190,  2,  0,  0, 30,  1,  0,  0, 14,  2,  0,  0,
+ 28,  1,  0,  0, 10,  2,  0,  0, 26,  1,  0,  0,191,  2,  0,  0, 32,  1,  0,  0, 18,  2,  0,  0, 25,  1,  0,  0,190,  2,  0,  0,
+ 31,  1,  0,  0,185,  2,  0,  0,101,  1,  0,  0,187,  2,  0,  0, 72,  0,  0,  0,192,  2,  0,  0,102,  1,  0,  0,186,  2,  0,  0,
+ 32,  1,  0,  0,191,  2,  0,  0, 26,  1,  0,  0,193,  2,  0,  0, 72,  0,  0,  0,189,  2,  0,  0, 71,  0,  0,  0,  3,  2,  0,  0,
+ 25,  1,  0,  0,192,  2,  0,  0, 72,  0,  0,  0,194,  2,  0,  0, 72,  0,  0,  0,193,  2,  0,  0, 26,  1,  0,  0,  6,  2,  0,  0,
+ 71,  0,  0,  0,194,  2,  0,  0, 35,  1,  0,  0, 28,  2,  0,  0, 37,  1,  0,  0,119,  2,  0,  0, 51,  1,  0,  0,195,  2,  0,  0,
+103,  1,  0,  0,143,  2,  0,  0, 52,  1,  0,  0,121,  2,  0,  0, 38,  1,  0,  0, 30,  2,  0,  0, 36,  1,  0,  0,146,  2,  0,  0,
+104,  1,  0,  0,196,  2,  0,  0, 51,  1,  0,  0,197,  2,  0,  0, 53,  1,  0,  0,198,  2,  0,  0,109,  1,  0,  0,149,  2,  0,  0,
+103,  1,  0,  0,195,  2,  0,  0,110,  1,  0,  0,199,  2,  0,  0, 54,  1,  0,  0,200,  2,  0,  0, 52,  1,  0,  0,196,  2,  0,  0,
+104,  1,  0,  0,152,  2,  0,  0, 53,  1,  0,  0,201,  2,  0,  0,123,  1,  0,  0,202,  2,  0,  0,111,  1,  0,  0,155,  2,  0,  0,
+109,  1,  0,  0,198,  2,  0,  0,112,  1,  0,  0,203,  2,  0,  0,124,  1,  0,  0,204,  2,  0,  0, 54,  1,  0,  0,199,  2,  0,  0,
+110,  1,  0,  0,158,  2,  0,  0, 55,  1,  0,  0,169,  2,  0,  0,117,  1,  0,  0,161,  2,  0,  0,111,  1,  0,  0,202,  2,  0,  0,
+123,  1,  0,  0,205,  2,  0,  0,112,  1,  0,  0,164,  2,  0,  0,118,  1,  0,  0,172,  2,  0,  0, 56,  1,  0,  0,206,  2,  0,  0,
+124,  1,  0,  0,203,  2,  0,  0, 89,  1,  0,  0,107,  2,  0,  0, 91,  1,  0,  0,207,  2,  0,  0,127,  1,  0,  0,208,  2,  0,  0,
+125,  1,  0,  0,209,  2,  0,  0,128,  1,  0,  0,210,  2,  0,  0, 92,  1,  0,  0,110,  2,  0,  0, 90,  1,  0,  0,211,  2,  0,  0,
+126,  1,  0,  0,212,  2,  0,  0, 59,  1,  0,  0,213,  2,  0,  0,125,  1,  0,  0,208,  2,  0,  0,127,  1,  0,  0,214,  2,  0,  0,
+ 61,  1,  0,  0,215,  2,  0,  0,128,  1,  0,  0,212,  2,  0,  0,126,  1,  0,  0,216,  2,  0,  0, 60,  1,  0,  0,217,  2,  0,  0,
+ 62,  1,  0,  0,218,  2,  0,  0, 39,  1,  0,  0, 36,  2,  0,  0, 41,  1,  0,  0,219,  2,  0,  0,125,  1,  0,  0,213,  2,  0,  0,
+ 59,  1,  0,  0,117,  2,  0,  0,126,  1,  0,  0,220,  2,  0,  0, 42,  1,  0,  0, 38,  2,  0,  0, 40,  1,  0,  0,120,  2,  0,  0,
+ 60,  1,  0,  0,216,  2,  0,  0, 41,  1,  0,  0,221,  2,  0,  0, 85,  1,  0,  0, 82,  2,  0,  0, 83,  1,  0,  0,222,  2,  0,  0,
+125,  1,  0,  0,219,  2,  0,  0, 84,  1,  0,  0, 84,  2,  0,  0, 86,  1,  0,  0,223,  2,  0,  0, 42,  1,  0,  0,220,  2,  0,  0,
+126,  1,  0,  0,224,  2,  0,  0, 83,  1,  0,  0,115,  2,  0,  0, 89,  1,  0,  0,209,  2,  0,  0,125,  1,  0,  0,222,  2,  0,  0,
+126,  1,  0,  0,211,  2,  0,  0, 90,  1,  0,  0,116,  2,  0,  0, 84,  1,  0,  0,224,  2,  0,  0, 41,  1,  0,  0, 93,  2,  0,  0,
+ 87,  1,  0,  0, 89,  2,  0,  0, 85,  1,  0,  0,221,  2,  0,  0, 86,  1,  0,  0, 92,  2,  0,  0, 88,  1,  0,  0, 94,  2,  0,  0,
+ 42,  1,  0,  0,223,  2,  0,  0, 55,  1,  0,  0,225,  2,  0,  0, 63,  1,  0,  0,226,  2,  0,  0,121,  1,  0,  0,227,  2,  0,  0,
+119,  1,  0,  0,167,  2,  0,  0,122,  1,  0,  0,228,  2,  0,  0, 64,  1,  0,  0,229,  2,  0,  0, 56,  1,  0,  0,171,  2,  0,  0,
+120,  1,  0,  0,230,  2,  0,  0, 57,  1,  0,  0,174,  2,  0,  0,119,  1,  0,  0,227,  2,  0,  0,121,  1,  0,  0,231,  2,  0,  0,
+ 65,  1,  0,  0,124,  2,  0,  0,122,  1,  0,  0,230,  2,  0,  0,120,  1,  0,  0,176,  2,  0,  0, 58,  1,  0,  0,126,  2,  0,  0,
+ 66,  1,  0,  0,232,  2,  0,  0, 61,  1,  0,  0,214,  2,  0,  0,127,  1,  0,  0,233,  2,  0,  0,121,  1,  0,  0,226,  2,  0,  0,
+ 63,  1,  0,  0,234,  2,  0,  0,122,  1,  0,  0,235,  2,  0,  0,128,  1,  0,  0,218,  2,  0,  0, 62,  1,  0,  0,236,  2,  0,  0,
+ 64,  1,  0,  0,228,  2,  0,  0, 91,  1,  0,  0,102,  2,  0,  0, 93,  1,  0,  0,237,  2,  0,  0,121,  1,  0,  0,233,  2,  0,  0,
+127,  1,  0,  0,207,  2,  0,  0,122,  1,  0,  0,238,  2,  0,  0, 94,  1,  0,  0,105,  2,  0,  0, 92,  1,  0,  0,210,  2,  0,  0,
+128,  1,  0,  0,235,  2,  0,  0, 65,  1,  0,  0,231,  2,  0,  0,121,  1,  0,  0,237,  2,  0,  0, 93,  1,  0,  0, 96,  2,  0,  0,
+ 94,  1,  0,  0,238,  2,  0,  0,122,  1,  0,  0,232,  2,  0,  0, 66,  1,  0,  0, 99,  2,  0,  0,141,  1,  0,  0,239,  2,  0,  0,
+129,  1,  0,  0,240,  2,  0,  0,155,  1,  0,  0,241,  2,  0,  0,143,  1,  0,  0,242,  2,  0,  0,156,  1,  0,  0,243,  2,  0,  0,
+130,  1,  0,  0,244,  2,  0,  0,142,  1,  0,  0,245,  2,  0,  0,144,  1,  0,  0,246,  2,  0,  0,141,  1,  0,  0,242,  2,  0,  0,
+143,  1,  0,  0,247,  2,  0,  0,145,  1,  0,  0,248,  2,  0,  0,139,  1,  0,  0,249,  2,  0,  0,146,  1,  0,  0,250,  2,  0,  0,
+144,  1,  0,  0,245,  2,  0,  0,142,  1,  0,  0,251,  2,  0,  0,140,  1,  0,  0,252,  2,  0,  0,139,  1,  0,  0,248,  2,  0,  0,
+145,  1,  0,  0,253,  2,  0,  0,147,  1,  0,  0,254,  2,  0,  0,137,  1,  0,  0,255,  2,  0,  0,148,  1,  0,  0,  0,  3,  0,  0,
+146,  1,  0,  0,252,  2,  0,  0,140,  1,  0,  0,  1,  3,  0,  0,138,  1,  0,  0,  2,  3,  0,  0,137,  1,  0,  0,254,  2,  0,  0,
+147,  1,  0,  0,  3,  3,  0,  0,149,  1,  0,  0,  4,  3,  0,  0,135,  1,  0,  0,  5,  3,  0,  0,150,  1,  0,  0,  6,  3,  0,  0,
+148,  1,  0,  0,  2,  3,  0,  0,138,  1,  0,  0,  7,  3,  0,  0,136,  1,  0,  0,  8,  3,  0,  0,135,  1,  0,  0,  4,  3,  0,  0,
+149,  1,  0,  0,  9,  3,  0,  0,151,  1,  0,  0, 10,  3,  0,  0,133,  1,  0,  0, 11,  3,  0,  0,152,  1,  0,  0, 12,  3,  0,  0,
+150,  1,  0,  0,  8,  3,  0,  0,136,  1,  0,  0, 13,  3,  0,  0,134,  1,  0,  0, 14,  3,  0,  0,133,  1,  0,  0, 10,  3,  0,  0,
+151,  1,  0,  0, 15,  3,  0,  0,153,  1,  0,  0, 16,  3,  0,  0,131,  1,  0,  0, 17,  3,  0,  0,154,  1,  0,  0, 18,  3,  0,  0,
+152,  1,  0,  0, 14,  3,  0,  0,134,  1,  0,  0, 19,  3,  0,  0,132,  1,  0,  0, 20,  3,  0,  0,151,  1,  0,  0, 21,  3,  0,  0,
+161,  1,  0,  0, 22,  3,  0,  0,159,  1,  0,  0, 23,  3,  0,  0,153,  1,  0,  0, 15,  3,  0,  0,160,  1,  0,  0, 24,  3,  0,  0,
+162,  1,  0,  0, 25,  3,  0,  0,152,  1,  0,  0, 18,  3,  0,  0,154,  1,  0,  0, 26,  3,  0,  0,149,  1,  0,  0, 27,  3,  0,  0,
+163,  1,  0,  0, 28,  3,  0,  0,161,  1,  0,  0, 21,  3,  0,  0,151,  1,  0,  0,  9,  3,  0,  0,162,  1,  0,  0, 29,  3,  0,  0,
+164,  1,  0,  0, 30,  3,  0,  0,150,  1,  0,  0, 12,  3,  0,  0,152,  1,  0,  0, 25,  3,  0,  0,147,  1,  0,  0, 31,  3,  0,  0,
+165,  1,  0,  0, 32,  3,  0,  0,163,  1,  0,  0, 27,  3,  0,  0,149,  1,  0,  0,  3,  3,  0,  0,164,  1,  0,  0, 33,  3,  0,  0,
+166,  1,  0,  0, 34,  3,  0,  0,148,  1,  0,  0,  6,  3,  0,  0,150,  1,  0,  0, 30,  3,  0,  0,145,  1,  0,  0, 35,  3,  0,  0,
+167,  1,  0,  0, 36,  3,  0,  0,165,  1,  0,  0, 31,  3,  0,  0,147,  1,  0,  0,253,  2,  0,  0,166,  1,  0,  0, 37,  3,  0,  0,
+168,  1,  0,  0, 38,  3,  0,  0,146,  1,  0,  0,  0,  3,  0,  0,148,  1,  0,  0, 34,  3,  0,  0,143,  1,  0,  0, 39,  3,  0,  0,
+169,  1,  0,  0, 40,  3,  0,  0,167,  1,  0,  0, 35,  3,  0,  0,145,  1,  0,  0,247,  2,  0,  0,168,  1,  0,  0, 41,  3,  0,  0,
+170,  1,  0,  0, 42,  3,  0,  0,144,  1,  0,  0,250,  2,  0,  0,146,  1,  0,  0, 38,  3,  0,  0,143,  1,  0,  0,241,  2,  0,  0,
+155,  1,  0,  0, 43,  3,  0,  0,157,  1,  0,  0, 44,  3,  0,  0,169,  1,  0,  0, 39,  3,  0,  0,158,  1,  0,  0, 45,  3,  0,  0,
+156,  1,  0,  0,246,  2,  0,  0,144,  1,  0,  0, 42,  3,  0,  0,170,  1,  0,  0, 46,  3,  0,  0, 59,  1,  0,  0,215,  2,  0,  0,
+ 61,  1,  0,  0, 47,  3,  0,  0,185,  1,  0,  0, 48,  3,  0,  0,183,  1,  0,  0, 49,  3,  0,  0,186,  1,  0,  0, 50,  3,  0,  0,
+ 62,  1,  0,  0,217,  2,  0,  0, 60,  1,  0,  0, 51,  3,  0,  0,184,  1,  0,  0, 52,  3,  0,  0, 61,  1,  0,  0, 53,  3,  0,  0,
+131,  1,  0,  0, 16,  3,  0,  0,153,  1,  0,  0, 54,  3,  0,  0,185,  1,  0,  0, 47,  3,  0,  0,154,  1,  0,  0, 20,  3,  0,  0,
+132,  1,  0,  0, 55,  3,  0,  0, 62,  1,  0,  0, 50,  3,  0,  0,186,  1,  0,  0, 56,  3,  0,  0, 51,  1,  0,  0,118,  2,  0,  0,
+ 59,  1,  0,  0, 49,  3,  0,  0,183,  1,  0,  0, 57,  3,  0,  0, 53,  1,  0,  0,197,  2,  0,  0,184,  1,  0,  0, 51,  3,  0,  0,
+ 60,  1,  0,  0,122,  2,  0,  0, 52,  1,  0,  0,200,  2,  0,  0, 54,  1,  0,  0, 58,  3,  0,  0,123,  1,  0,  0, 59,  3,  0,  0,
+171,  1,  0,  0, 60,  3,  0,  0,155,  1,  0,  0,240,  2,  0,  0,129,  1,  0,  0, 61,  3,  0,  0,156,  1,  0,  0, 62,  3,  0,  0,
+172,  1,  0,  0, 63,  3,  0,  0,124,  1,  0,  0, 64,  3,  0,  0,130,  1,  0,  0,243,  2,  0,  0,153,  1,  0,  0, 23,  3,  0,  0,
+159,  1,  0,  0, 65,  3,  0,  0,181,  1,  0,  0, 66,  3,  0,  0,185,  1,  0,  0, 54,  3,  0,  0,182,  1,  0,  0, 67,  3,  0,  0,
+160,  1,  0,  0, 26,  3,  0,  0,154,  1,  0,  0, 56,  3,  0,  0,186,  1,  0,  0, 68,  3,  0,  0,179,  1,  0,  0, 69,  3,  0,  0,
+187,  1,  0,  0, 70,  3,  0,  0,185,  1,  0,  0, 66,  3,  0,  0,181,  1,  0,  0, 71,  3,  0,  0,186,  1,  0,  0, 72,  3,  0,  0,
+188,  1,  0,  0, 73,  3,  0,  0,180,  1,  0,  0, 74,  3,  0,  0,182,  1,  0,  0, 68,  3,  0,  0,175,  1,  0,  0, 75,  3,  0,  0,
+187,  1,  0,  0, 69,  3,  0,  0,179,  1,  0,  0, 76,  3,  0,  0,177,  1,  0,  0, 77,  3,  0,  0,180,  1,  0,  0, 73,  3,  0,  0,
+188,  1,  0,  0, 78,  3,  0,  0,176,  1,  0,  0, 79,  3,  0,  0,178,  1,  0,  0, 80,  3,  0,  0,173,  1,  0,  0, 81,  3,  0,  0,
+189,  1,  0,  0, 82,  3,  0,  0,187,  1,  0,  0, 75,  3,  0,  0,175,  1,  0,  0, 83,  3,  0,  0,188,  1,  0,  0, 84,  3,  0,  0,
+190,  1,  0,  0, 85,  3,  0,  0,174,  1,  0,  0, 86,  3,  0,  0,176,  1,  0,  0, 78,  3,  0,  0,171,  1,  0,  0, 87,  3,  0,  0,
+189,  1,  0,  0, 81,  3,  0,  0,173,  1,  0,  0, 88,  3,  0,  0,191,  1,  0,  0, 89,  3,  0,  0,174,  1,  0,  0, 85,  3,  0,  0,
+190,  1,  0,  0, 90,  3,  0,  0,172,  1,  0,  0, 91,  3,  0,  0,192,  1,  0,  0, 92,  3,  0,  0,155,  1,  0,  0, 60,  3,  0,  0,
+171,  1,  0,  0, 89,  3,  0,  0,191,  1,  0,  0, 93,  3,  0,  0,157,  1,  0,  0, 43,  3,  0,  0,192,  1,  0,  0, 91,  3,  0,  0,
+172,  1,  0,  0, 62,  3,  0,  0,156,  1,  0,  0, 45,  3,  0,  0,158,  1,  0,  0, 94,  3,  0,  0, 53,  1,  0,  0, 95,  3,  0,  0,
+189,  1,  0,  0, 87,  3,  0,  0,171,  1,  0,  0, 59,  3,  0,  0,123,  1,  0,  0,201,  2,  0,  0,172,  1,  0,  0, 90,  3,  0,  0,
+190,  1,  0,  0, 96,  3,  0,  0, 54,  1,  0,  0,204,  2,  0,  0,124,  1,  0,  0, 63,  3,  0,  0, 53,  1,  0,  0, 57,  3,  0,  0,
+183,  1,  0,  0, 97,  3,  0,  0,187,  1,  0,  0, 82,  3,  0,  0,189,  1,  0,  0, 95,  3,  0,  0,188,  1,  0,  0, 98,  3,  0,  0,
+184,  1,  0,  0, 58,  3,  0,  0, 54,  1,  0,  0, 96,  3,  0,  0,190,  1,  0,  0, 84,  3,  0,  0,183,  1,  0,  0, 48,  3,  0,  0,
+185,  1,  0,  0, 70,  3,  0,  0,187,  1,  0,  0, 97,  3,  0,  0,188,  1,  0,  0, 72,  3,  0,  0,186,  1,  0,  0, 52,  3,  0,  0,
+184,  1,  0,  0, 98,  3,  0,  0,157,  1,  0,  0, 93,  3,  0,  0,191,  1,  0,  0, 99,  3,  0,  0,193,  1,  0,  0,100,  3,  0,  0,
+217,  1,  0,  0,101,  3,  0,  0,194,  1,  0,  0,102,  3,  0,  0,192,  1,  0,  0, 94,  3,  0,  0,158,  1,  0,  0,103,  3,  0,  0,
+218,  1,  0,  0,104,  3,  0,  0,191,  1,  0,  0, 88,  3,  0,  0,173,  1,  0,  0,105,  3,  0,  0,203,  1,  0,  0,106,  3,  0,  0,
+193,  1,  0,  0, 99,  3,  0,  0,204,  1,  0,  0,107,  3,  0,  0,174,  1,  0,  0, 92,  3,  0,  0,192,  1,  0,  0,102,  3,  0,  0,
+194,  1,  0,  0,108,  3,  0,  0,173,  1,  0,  0, 83,  3,  0,  0,175,  1,  0,  0,109,  3,  0,  0,201,  1,  0,  0,110,  3,  0,  0,
+203,  1,  0,  0,105,  3,  0,  0,202,  1,  0,  0,111,  3,  0,  0,176,  1,  0,  0, 86,  3,  0,  0,174,  1,  0,  0,107,  3,  0,  0,
+204,  1,  0,  0,112,  3,  0,  0,175,  1,  0,  0, 77,  3,  0,  0,177,  1,  0,  0,113,  3,  0,  0,199,  1,  0,  0,114,  3,  0,  0,
+201,  1,  0,  0,109,  3,  0,  0,200,  1,  0,  0,115,  3,  0,  0,178,  1,  0,  0, 79,  3,  0,  0,176,  1,  0,  0,111,  3,  0,  0,
+202,  1,  0,  0,116,  3,  0,  0,177,  1,  0,  0, 76,  3,  0,  0,179,  1,  0,  0,117,  3,  0,  0,197,  1,  0,  0,118,  3,  0,  0,
+199,  1,  0,  0,113,  3,  0,  0,198,  1,  0,  0,119,  3,  0,  0,180,  1,  0,  0, 80,  3,  0,  0,178,  1,  0,  0,115,  3,  0,  0,
+200,  1,  0,  0,120,  3,  0,  0,179,  1,  0,  0, 71,  3,  0,  0,181,  1,  0,  0,121,  3,  0,  0,195,  1,  0,  0,122,  3,  0,  0,
+197,  1,  0,  0,117,  3,  0,  0,196,  1,  0,  0,123,  3,  0,  0,182,  1,  0,  0, 74,  3,  0,  0,180,  1,  0,  0,119,  3,  0,  0,
+198,  1,  0,  0,124,  3,  0,  0,181,  1,  0,  0, 65,  3,  0,  0,159,  1,  0,  0,125,  3,  0,  0,215,  1,  0,  0,126,  3,  0,  0,
+195,  1,  0,  0,121,  3,  0,  0,216,  1,  0,  0,127,  3,  0,  0,160,  1,  0,  0, 67,  3,  0,  0,182,  1,  0,  0,123,  3,  0,  0,
+196,  1,  0,  0,128,  3,  0,  0,169,  1,  0,  0, 44,  3,  0,  0,157,  1,  0,  0,101,  3,  0,  0,217,  1,  0,  0,129,  3,  0,  0,
+205,  1,  0,  0,130,  3,  0,  0,218,  1,  0,  0,103,  3,  0,  0,158,  1,  0,  0, 46,  3,  0,  0,170,  1,  0,  0,131,  3,  0,  0,
+206,  1,  0,  0,132,  3,  0,  0,167,  1,  0,  0, 40,  3,  0,  0,169,  1,  0,  0,130,  3,  0,  0,205,  1,  0,  0,133,  3,  0,  0,
+207,  1,  0,  0,134,  3,  0,  0,206,  1,  0,  0,131,  3,  0,  0,170,  1,  0,  0, 41,  3,  0,  0,168,  1,  0,  0,135,  3,  0,  0,
+208,  1,  0,  0,136,  3,  0,  0,165,  1,  0,  0, 36,  3,  0,  0,167,  1,  0,  0,134,  3,  0,  0,207,  1,  0,  0,137,  3,  0,  0,
+209,  1,  0,  0,138,  3,  0,  0,208,  1,  0,  0,135,  3,  0,  0,168,  1,  0,  0, 37,  3,  0,  0,166,  1,  0,  0,139,  3,  0,  0,
+210,  1,  0,  0,140,  3,  0,  0,163,  1,  0,  0, 32,  3,  0,  0,165,  1,  0,  0,138,  3,  0,  0,209,  1,  0,  0,141,  3,  0,  0,
+211,  1,  0,  0,142,  3,  0,  0,210,  1,  0,  0,139,  3,  0,  0,166,  1,  0,  0, 33,  3,  0,  0,164,  1,  0,  0,143,  3,  0,  0,
+212,  1,  0,  0,144,  3,  0,  0,161,  1,  0,  0, 28,  3,  0,  0,163,  1,  0,  0,142,  3,  0,  0,211,  1,  0,  0,145,  3,  0,  0,
+213,  1,  0,  0,146,  3,  0,  0,212,  1,  0,  0,143,  3,  0,  0,164,  1,  0,  0, 29,  3,  0,  0,162,  1,  0,  0,147,  3,  0,  0,
+214,  1,  0,  0,148,  3,  0,  0,159,  1,  0,  0, 22,  3,  0,  0,161,  1,  0,  0,146,  3,  0,  0,213,  1,  0,  0,149,  3,  0,  0,
+215,  1,  0,  0,125,  3,  0,  0,214,  1,  0,  0,147,  3,  0,  0,162,  1,  0,  0, 24,  3,  0,  0,160,  1,  0,  0,127,  3,  0,  0,
+216,  1,  0,  0,150,  3,  0,  0,199,  1,  0,  0,118,  3,  0,  0,197,  1,  0,  0,151,  3,  0,  0,221,  1,  0,  0,152,  3,  0,  0,
+219,  1,  0,  0,153,  3,  0,  0,222,  1,  0,  0,154,  3,  0,  0,198,  1,  0,  0,120,  3,  0,  0,200,  1,  0,  0,155,  3,  0,  0,
+220,  1,  0,  0,156,  3,  0,  0,219,  1,  0,  0,152,  3,  0,  0,221,  1,  0,  0,157,  3,  0,  0,223,  1,  0,  0,158,  3,  0,  0,
+225,  1,  0,  0,159,  3,  0,  0,224,  1,  0,  0,160,  3,  0,  0,222,  1,  0,  0,156,  3,  0,  0,220,  1,  0,  0,161,  3,  0,  0,
+226,  1,  0,  0,162,  3,  0,  0,225,  1,  0,  0,158,  3,  0,  0,223,  1,  0,  0,163,  3,  0,  0,229,  1,  0,  0,164,  3,  0,  0,
+227,  1,  0,  0,165,  3,  0,  0,230,  1,  0,  0,166,  3,  0,  0,224,  1,  0,  0,162,  3,  0,  0,226,  1,  0,  0,167,  3,  0,  0,
+228,  1,  0,  0,168,  3,  0,  0,227,  1,  0,  0,164,  3,  0,  0,229,  1,  0,  0,169,  3,  0,  0,231,  1,  0,  0,170,  3,  0,  0,
+233,  1,  0,  0,171,  3,  0,  0,232,  1,  0,  0,172,  3,  0,  0,230,  1,  0,  0,168,  3,  0,  0,228,  1,  0,  0,173,  3,  0,  0,
+234,  1,  0,  0,174,  3,  0,  0,205,  1,  0,  0,129,  3,  0,  0,217,  1,  0,  0,175,  3,  0,  0,227,  1,  0,  0,171,  3,  0,  0,
+233,  1,  0,  0,176,  3,  0,  0,228,  1,  0,  0,177,  3,  0,  0,218,  1,  0,  0,132,  3,  0,  0,206,  1,  0,  0,178,  3,  0,  0,
+234,  1,  0,  0,173,  3,  0,  0,193,  1,  0,  0,179,  3,  0,  0,225,  1,  0,  0,165,  3,  0,  0,227,  1,  0,  0,175,  3,  0,  0,
+217,  1,  0,  0,100,  3,  0,  0,228,  1,  0,  0,167,  3,  0,  0,226,  1,  0,  0,180,  3,  0,  0,194,  1,  0,  0,104,  3,  0,  0,
+218,  1,  0,  0,177,  3,  0,  0,193,  1,  0,  0,106,  3,  0,  0,203,  1,  0,  0,181,  3,  0,  0,219,  1,  0,  0,159,  3,  0,  0,
+225,  1,  0,  0,179,  3,  0,  0,220,  1,  0,  0,182,  3,  0,  0,204,  1,  0,  0,108,  3,  0,  0,194,  1,  0,  0,180,  3,  0,  0,
+226,  1,  0,  0,161,  3,  0,  0,199,  1,  0,  0,153,  3,  0,  0,219,  1,  0,  0,181,  3,  0,  0,203,  1,  0,  0,110,  3,  0,  0,
+201,  1,  0,  0,114,  3,  0,  0,204,  1,  0,  0,182,  3,  0,  0,220,  1,  0,  0,155,  3,  0,  0,200,  1,  0,  0,116,  3,  0,  0,
+202,  1,  0,  0,112,  3,  0,  0,195,  1,  0,  0,126,  3,  0,  0,215,  1,  0,  0,183,  3,  0,  0,221,  1,  0,  0,151,  3,  0,  0,
+197,  1,  0,  0,122,  3,  0,  0,222,  1,  0,  0,184,  3,  0,  0,216,  1,  0,  0,128,  3,  0,  0,196,  1,  0,  0,124,  3,  0,  0,
+198,  1,  0,  0,154,  3,  0,  0,213,  1,  0,  0,185,  3,  0,  0,223,  1,  0,  0,157,  3,  0,  0,221,  1,  0,  0,183,  3,  0,  0,
+215,  1,  0,  0,149,  3,  0,  0,222,  1,  0,  0,160,  3,  0,  0,224,  1,  0,  0,186,  3,  0,  0,214,  1,  0,  0,150,  3,  0,  0,
+216,  1,  0,  0,184,  3,  0,  0,211,  1,  0,  0,187,  3,  0,  0,229,  1,  0,  0,163,  3,  0,  0,223,  1,  0,  0,185,  3,  0,  0,
+213,  1,  0,  0,145,  3,  0,  0,224,  1,  0,  0,166,  3,  0,  0,230,  1,  0,  0,188,  3,  0,  0,212,  1,  0,  0,148,  3,  0,  0,
+214,  1,  0,  0,186,  3,  0,  0,209,  1,  0,  0,189,  3,  0,  0,231,  1,  0,  0,169,  3,  0,  0,229,  1,  0,  0,187,  3,  0,  0,
+211,  1,  0,  0,141,  3,  0,  0,230,  1,  0,  0,172,  3,  0,  0,232,  1,  0,  0,190,  3,  0,  0,210,  1,  0,  0,144,  3,  0,  0,
+212,  1,  0,  0,188,  3,  0,  0,207,  1,  0,  0,191,  3,  0,  0,233,  1,  0,  0,170,  3,  0,  0,231,  1,  0,  0,189,  3,  0,  0,
+209,  1,  0,  0,137,  3,  0,  0,232,  1,  0,  0,174,  3,  0,  0,234,  1,  0,  0,192,  3,  0,  0,208,  1,  0,  0,140,  3,  0,  0,
+210,  1,  0,  0,190,  3,  0,  0,205,  1,  0,  0,176,  3,  0,  0,233,  1,  0,  0,191,  3,  0,  0,207,  1,  0,  0,133,  3,  0,  0,
+208,  1,  0,  0,192,  3,  0,  0,234,  1,  0,  0,178,  3,  0,  0,206,  1,  0,  0,136,  3,  0,  0,133,  1,  0,  0, 17,  3,  0,  0,
+131,  1,  0,  0,193,  3,  0,  0,245,  1,  0,  0,194,  3,  0,  0,243,  1,  0,  0,195,  3,  0,  0,246,  1,  0,  0,196,  3,  0,  0,
+132,  1,  0,  0, 19,  3,  0,  0,134,  1,  0,  0,197,  3,  0,  0,244,  1,  0,  0,198,  3,  0,  0,135,  1,  0,  0, 11,  3,  0,  0,
+133,  1,  0,  0,195,  3,  0,  0,243,  1,  0,  0,199,  3,  0,  0,241,  1,  0,  0,200,  3,  0,  0,244,  1,  0,  0,197,  3,  0,  0,
+134,  1,  0,  0, 13,  3,  0,  0,136,  1,  0,  0,201,  3,  0,  0,242,  1,  0,  0,202,  3,  0,  0,137,  1,  0,  0,  5,  3,  0,  0,
+135,  1,  0,  0,200,  3,  0,  0,241,  1,  0,  0,203,  3,  0,  0,239,  1,  0,  0,204,  3,  0,  0,242,  1,  0,  0,201,  3,  0,  0,
+136,  1,  0,  0,  7,  3,  0,  0,138,  1,  0,  0,205,  3,  0,  0,240,  1,  0,  0,206,  3,  0,  0,139,  1,  0,  0,255,  2,  0,  0,
+137,  1,  0,  0,204,  3,  0,  0,239,  1,  0,  0,207,  3,  0,  0,237,  1,  0,  0,208,  3,  0,  0,240,  1,  0,  0,205,  3,  0,  0,
+138,  1,  0,  0,  1,  3,  0,  0,140,  1,  0,  0,209,  3,  0,  0,238,  1,  0,  0,210,  3,  0,  0,141,  1,  0,  0,249,  2,  0,  0,
+139,  1,  0,  0,208,  3,  0,  0,237,  1,  0,  0,211,  3,  0,  0,235,  1,  0,  0,212,  3,  0,  0,238,  1,  0,  0,209,  3,  0,  0,
+140,  1,  0,  0,251,  2,  0,  0,142,  1,  0,  0,213,  3,  0,  0,236,  1,  0,  0,214,  3,  0,  0,129,  1,  0,  0,239,  2,  0,  0,
+141,  1,  0,  0,212,  3,  0,  0,235,  1,  0,  0,215,  3,  0,  0,247,  1,  0,  0,216,  3,  0,  0,236,  1,  0,  0,213,  3,  0,  0,
+142,  1,  0,  0,244,  2,  0,  0,130,  1,  0,  0,217,  3,  0,  0,248,  1,  0,  0,218,  3,  0,  0,235,  1,  0,  0,219,  3,  0,  0,
+243,  1,  0,  0,194,  3,  0,  0,245,  1,  0,  0,220,  3,  0,  0,247,  1,  0,  0,215,  3,  0,  0,246,  1,  0,  0,198,  3,  0,  0,
+244,  1,  0,  0,221,  3,  0,  0,236,  1,  0,  0,218,  3,  0,  0,248,  1,  0,  0,222,  3,  0,  0,235,  1,  0,  0,211,  3,  0,  0,
+237,  1,  0,  0,223,  3,  0,  0,241,  1,  0,  0,199,  3,  0,  0,243,  1,  0,  0,219,  3,  0,  0,242,  1,  0,  0,224,  3,  0,  0,
+238,  1,  0,  0,214,  3,  0,  0,236,  1,  0,  0,221,  3,  0,  0,244,  1,  0,  0,202,  3,  0,  0,237,  1,  0,  0,207,  3,  0,  0,
+239,  1,  0,  0,203,  3,  0,  0,241,  1,  0,  0,223,  3,  0,  0,242,  1,  0,  0,206,  3,  0,  0,240,  1,  0,  0,210,  3,  0,  0,
+238,  1,  0,  0,224,  3,  0,  0, 55,  1,  0,  0,205,  2,  0,  0,123,  1,  0,  0, 61,  3,  0,  0,129,  1,  0,  0,216,  3,  0,  0,
+247,  1,  0,  0,225,  3,  0,  0,130,  1,  0,  0, 64,  3,  0,  0,124,  1,  0,  0,206,  2,  0,  0, 56,  1,  0,  0,226,  3,  0,  0,
+248,  1,  0,  0,217,  3,  0,  0, 55,  1,  0,  0,225,  3,  0,  0,247,  1,  0,  0,220,  3,  0,  0,245,  1,  0,  0,227,  3,  0,  0,
+ 63,  1,  0,  0,225,  2,  0,  0,246,  1,  0,  0,222,  3,  0,  0,248,  1,  0,  0,226,  3,  0,  0, 56,  1,  0,  0,229,  2,  0,  0,
+ 64,  1,  0,  0,228,  3,  0,  0, 61,  1,  0,  0,234,  2,  0,  0, 63,  1,  0,  0,227,  3,  0,  0,245,  1,  0,  0,193,  3,  0,  0,
+131,  1,  0,  0, 53,  3,  0,  0,246,  1,  0,  0,228,  3,  0,  0, 64,  1,  0,  0,236,  2,  0,  0, 62,  1,  0,  0, 55,  3,  0,  0,
+132,  1,  0,  0,196,  3,  0,  0, 68, 65, 84, 65,  8,  2,  0,  0, 56, 25, 27,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  0,  0,  0,
+ 15,  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,
+ 85, 86, 84,101,120,  0, 97, 99,101,  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,  0,  0,  0,  0,  0,
+248, 38,199,  4,  0,  0,  0,  0, 25,  0,  0,  0, 16,  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, 78, 71,111,110, 32, 70, 97, 99,101,  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,  0,  0,  0,  0,  0,120,  1, 27,  4,  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,  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,  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,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 64, 31,  0,  0,248, 38,199,  4,  0,  0,  0,  0, 60,  0,  0,  0,244,  1,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,112,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,112,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,112,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,112,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,112,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,112,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,112,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,112,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,112,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,112,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,112,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,112,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,112,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,112,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,112,  0, 72, 70, 24,  4,  0,  0,  0,  0, 61,  0,  5,  0,  0,  0,112,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 32,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 32,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 32,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 32,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 32,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 32,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 32,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 32,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,112,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,112,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 32,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 32,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,128,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,112,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,112,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,240,  0,
+ 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 16,  0, 72, 70, 24,  4,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0, 64,  0,
+ 68, 65, 84, 65,112, 23,  0,  0,120,  1, 27,  4,  0,  0,  0,  0, 58,  0,  0,  0,244,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,  4,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,  8,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 12,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0, 16,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 20,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+ 24,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 28,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 32,  0,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0, 36,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 40,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 44,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0, 48,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 52,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+ 56,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 60,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 64,  0,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0, 68,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 72,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 76,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0, 80,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 84,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+ 88,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 92,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 96,  0,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,100,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,104,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,108,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,112,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,116,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+120,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,124,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,128,  0,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,132,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,136,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,140,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,144,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,148,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+152,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,156,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,160,  0,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,164,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,168,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,172,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,176,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,180,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+184,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,188,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,192,  0,  0,  0,  3,  0,  0,  0,
+  0,  0,  1,  0,195,  0,  0,  0,  3,  0,  0,  0,  0,  0,  1,  0,198,  0,  0,  0,  3,  0,  0,  0,  0,  0,  1,  0,201,  0,  0,  0,
+  3,  0,  0,  0,  0,  0,  1,  0,204,  0,  0,  0,  3,  0,  0,  0,  0,  0,  1,  0,207,  0,  0,  0,  3,  0,  0,  0,  0,  0,  1,  0,
+210,  0,  0,  0,  3,  0,  0,  0,  0,  0,  1,  0,213,  0,  0,  0,  3,  0,  0,  0,  0,  0,  1,  0,216,  0,  0,  0,  3,  0,  0,  0,
+  0,  0,  1,  0,219,  0,  0,  0,  3,  0,  0,  0,  0,  0,  1,  0,222,  0,  0,  0,  3,  0,  0,  0,  0,  0,  1,  0,225,  0,  0,  0,
+  3,  0,  0,  0,  0,  0,  1,  0,228,  0,  0,  0,  3,  0,  0,  0,  0,  0,  1,  0,231,  0,  0,  0,  3,  0,  0,  0,  0,  0,  1,  0,
+234,  0,  0,  0,  3,  0,  0,  0,  0,  0,  1,  0,237,  0,  0,  0,  3,  0,  0,  0,  0,  0,  1,  0,240,  0,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,244,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,248,  0,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,252,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,  0,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,  4,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+  8,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 12,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 16,  1,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0, 20,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 24,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 28,  1,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0, 32,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 36,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+ 40,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 44,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 48,  1,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0, 52,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 56,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 60,  1,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0, 64,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 68,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+ 72,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 76,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 80,  1,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0, 84,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 88,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 92,  1,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0, 96,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,100,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+104,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,108,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,112,  1,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,116,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,120,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,124,  1,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,128,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,132,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+136,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,140,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,144,  1,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,148,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,152,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,156,  1,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,160,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,164,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+168,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,172,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,176,  1,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,180,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,184,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,188,  1,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,192,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,196,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+200,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,204,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,208,  1,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,212,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,216,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,220,  1,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,224,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,228,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+232,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,236,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,240,  1,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,244,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,248,  1,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,252,  1,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,  0,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,  4,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+  8,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 12,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 16,  2,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0, 20,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 24,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 28,  2,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0, 32,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 36,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+ 40,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 44,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 48,  2,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0, 52,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 56,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 60,  2,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0, 64,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 68,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+ 72,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 76,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 80,  2,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0, 84,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 88,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 92,  2,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0, 96,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,100,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+104,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,108,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,112,  2,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,116,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,120,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,124,  2,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,128,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,132,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+136,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,140,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,144,  2,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,148,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,152,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,156,  2,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,160,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,164,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+168,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,172,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,176,  2,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,180,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,184,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,188,  2,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,192,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,196,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+200,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,204,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,208,  2,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,212,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,216,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,220,  2,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,224,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,228,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+232,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,236,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,240,  2,  0,  0,  3,  0,  0,  0,
+  0,  0,  1,  0,243,  2,  0,  0,  3,  0,  0,  0,  0,  0,  1,  0,246,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,250,  2,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,254,  2,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,  2,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+  6,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 10,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 14,  3,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0, 18,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 22,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 26,  3,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0, 30,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 34,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+ 38,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 42,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 46,  3,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0, 50,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 54,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 58,  3,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0, 62,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 66,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+ 70,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 74,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 78,  3,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0, 82,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 86,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 90,  3,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0, 94,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 98,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+102,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,106,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,110,  3,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,114,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,118,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,122,  3,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,126,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,130,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+134,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,138,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,142,  3,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,146,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,150,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,154,  3,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,158,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,162,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+166,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,170,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,174,  3,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,178,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,182,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,186,  3,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,190,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,194,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+198,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,202,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,206,  3,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,210,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,214,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,218,  3,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,222,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,226,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+230,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,234,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,238,  3,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,242,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,246,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,250,  3,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,254,  3,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,  2,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+  6,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 10,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 14,  4,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0, 18,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 22,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 26,  4,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0, 30,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 34,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+ 38,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 42,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 46,  4,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0, 50,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 54,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 58,  4,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0, 62,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 66,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+ 70,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 74,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 78,  4,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0, 82,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 86,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 90,  4,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0, 94,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 98,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+102,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,106,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,110,  4,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,114,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,118,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,122,  4,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,126,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,130,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+134,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,138,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,142,  4,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,146,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,150,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,154,  4,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,158,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,162,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+166,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,170,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,174,  4,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,178,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,182,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,186,  4,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,190,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,194,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+198,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,202,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,206,  4,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,210,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,214,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,218,  4,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,222,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,226,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+230,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,234,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,238,  4,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,242,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,246,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,250,  4,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,254,  4,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,  2,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+  6,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 10,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 14,  5,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0, 18,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 22,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 26,  5,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0, 30,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 34,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+ 38,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 42,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 46,  5,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0, 50,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 54,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 58,  5,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0, 62,  5,  0,  0,  3,  0,  0,  0,  0,  0,  1,  0, 65,  5,  0,  0,  3,  0,  0,  0,  0,  0,  1,  0,
+ 68,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 72,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 76,  5,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0, 80,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 84,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 88,  5,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0, 92,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 96,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+100,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,104,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,108,  5,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,112,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,116,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,120,  5,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,124,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,128,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+132,  5,  0,  0,  3,  0,  0,  0,  0,  0,  1,  0,135,  5,  0,  0,  3,  0,  0,  0,  0,  0,  1,  0,138,  5,  0,  0,  3,  0,  0,  0,
+  0,  0,  1,  0,141,  5,  0,  0,  3,  0,  0,  0,  0,  0,  1,  0,144,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,148,  5,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,152,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,156,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+160,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,164,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,168,  5,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,172,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,176,  5,  0,  0,  3,  0,  0,  0,  0,  0,  1,  0,179,  5,  0,  0,
+  3,  0,  0,  0,  0,  0,  1,  0,182,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,186,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+190,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,194,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,198,  5,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,202,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,206,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,210,  5,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,214,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,218,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+222,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,226,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,230,  5,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,234,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,238,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,242,  5,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,246,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,250,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+254,  5,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,  2,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,  6,  6,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0, 10,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 14,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 18,  6,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0, 22,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 26,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+ 30,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 34,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 38,  6,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0, 42,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 46,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 50,  6,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0, 54,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 58,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+ 62,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 66,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 70,  6,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0, 74,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 78,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 82,  6,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0, 86,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 90,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+ 94,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 98,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,102,  6,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,106,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,110,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,114,  6,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,118,  6,  0,  0,  3,  0,  0,  0,  0,  0,  1,  0,121,  6,  0,  0,  3,  0,  0,  0,  0,  0,  1,  0,
+124,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,128,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,132,  6,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,136,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,140,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,144,  6,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,148,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,152,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+156,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,160,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,164,  6,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,168,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,172,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,176,  6,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,180,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,184,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+188,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,192,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,196,  6,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,200,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,204,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,208,  6,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,212,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,216,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+220,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,224,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,228,  6,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,232,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,236,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,240,  6,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,244,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,248,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+252,  6,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,  0,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,  4,  7,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,  8,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 12,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 16,  7,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0, 20,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 24,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+ 28,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 32,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 36,  7,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0, 40,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 44,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 48,  7,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0, 52,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 56,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+ 60,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 64,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 68,  7,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0, 72,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 76,  7,  0,  0,  3,  0,  0,  0,  0,  0,  1,  0, 79,  7,  0,  0,
+  3,  0,  0,  0,  0,  0,  1,  0, 82,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 86,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+ 90,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 94,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0, 98,  7,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,102,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,106,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,110,  7,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,114,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,118,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,
+122,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,126,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,130,  7,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,134,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,138,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,142,  7,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0,146,  7,  0,  0,  3,  0,  0,  0,  0,  0,  1,  0,149,  7,  0,  0,  3,  0,  0,  0,  0,  0,  1,  0,
+152,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,156,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,160,  7,  0,  0,  4,  0,  0,  0,
+  0,  0,  1,  0,164,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,168,  7,  0,  0,  4,  0,  0,  0,  0,  0,  1,  0,172,  7,  0,  0,
+  4,  0,  0,  0,  0,  0,  1,  0, 77, 69,  0,  0,232,  4,  0,  0,  8,  8,196,  4,  0,  0,  0,  0, 50,  0,  0,  0,  1,  0,  0,  0,
+168, 20,196,  4,  0,  0,  0,  0,136, 37, 27,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 77, 69, 80,108, 97,110,101, 46, 48, 48, 52,  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,  0,  0,  0,
+  0,  0,  0,  0,  1,  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,  0, 24,129, 27,  4,  0,  0,  0,  0,
+ 72, 30, 27,  4,  0,  0,  0,  0, 72, 35, 27,  4,  0,  0,  0,  0,216, 29, 27,  4,  0,  0,  0,  0,168, 35, 27,  4,  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,
+104,129, 27,  4,  0,  0,  0,  0,  8,130, 27,  4,  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,  0,  0,
+ 56, 13,196,  4,  0,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  1,  0,  0,  0,  5,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,136, 15,196,  4,  0,  0,  0,  0,255,255,255,255,255,255,255,255,
+255,255,255,255,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  1,  0,  0,  0,  5,  0,  0,  0, 12,  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,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,224,  1,  0,  0, 88,125, 53,  3,  0,  0,  0,  0, 49,  0,  0,  0,
- 40,  0,  0,  0,  1,  0,  0,  0,  2,  0,  0,  0,  0,  0, 35,  0,  4,  0,  0,  0, 10,  0,  0,  0,  0,  0, 35,  0,  3,  0,  0,  0,
-  9,  0,  0,  0,  0,  0, 35,  0,  3,  0,  0,  0,  4,  0,  0,  0,  0,  0, 35,  0,  3,  0,  0,  0,  5,  0,  0,  0,  0,  0, 35,  0,
-  5,  0,  0,  0,  6,  0,  0,  0,  0,  0, 35,  0,  5,  0,  0,  0,  7,  0,  0,  0,  0,  0, 35,  0,  7,  0,  0,  0,  8,  0,  0,  0,
-  0,  0, 35,  0,  9,  0,  0,  0, 10,  0,  0,  0,  0,  0, 35,  0, 11,  0,  0,  0, 12,  0,  0,  0,  0,  0, 35,  0, 14,  0,  0,  0,
- 15,  0,  0,  0,  0,  0, 35,  0, 15,  0,  0,  0, 18,  0,  0,  0,  0,  0, 35,  0, 17,  0,  0,  0, 18,  0,  0,  0,  0,  0, 35,  0,
- 14,  0,  0,  0, 17,  0,  0,  0,  0,  0, 35,  0, 16,  0,  0,  0, 17,  0,  0,  0,  0,  0, 35,  0, 13,  0,  0,  0, 16,  0,  0,  0,
-  0,  0, 35,  0, 20,  0,  0,  0, 21,  0,  0,  0,  0,  0, 35,  0, 17,  0,  0,  0, 20,  0,  0,  0,  0,  0, 35,  0, 19,  0,  0,  0,
- 20,  0,  0,  0,  0,  0, 35,  0, 16,  0,  0,  0, 19,  0,  0,  0,  0,  0, 35,  0, 21,  0,  0,  0, 24,  0,  0,  0,  0,  0, 35,  0,
- 23,  0,  0,  0, 24,  0,  0,  0,  0,  0, 35,  0, 20,  0,  0,  0, 23,  0,  0,  0,  0,  0, 35,  0, 22,  0,  0,  0, 23,  0,  0,  0,
-  0,  0, 35,  0, 19,  0,  0,  0, 22,  0,  0,  0,  0,  0, 35,  0, 12,  0,  0,  0, 23,  0,  0,  0,  0,  0, 35,  0, 11,  0,  0,  0,
- 22,  0,  0,  0,  0,  0, 35,  0,  8,  0,  0,  0, 13,  0,  0,  0,  0,  0, 35,  0,  7,  0,  0,  0, 16,  0,  0,  0,  0,  0, 35,  0,
-  5,  0,  0,  0, 19,  0,  0,  0,  0,  0, 35,  0,  3,  0,  0,  0, 22,  0,  0,  0,  0,  0, 35,  0,  2,  0,  0,  0,  7,  0,  0,  0,
-  0,  0, 35,  0,  2,  0,  0,  0,  6,  0,  0,  0,  0,  0, 35,  0,  4,  0,  0,  0,  6,  0,  0,  0,  0,  0, 35,  0,  1,  0,  0,  0,
-  8,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0,  0, 12,  0,  0,  0,  0,  0, 35,  0, 13,  0,  0,  0, 14,  0,  0,  0,  0,  0, 35,  0,
- 18,  0,  0,  0, 21,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0,  0, 24,  0,  0,  0,  0,  0, 35,  0,  9,  0,  0,  0, 11,  0,  0,  0,
-  0,  0, 35,  0, 68, 65, 84, 65,104,  1,  0,  0,136,127, 53,  3,  0,  0,  0,  0, 84,  1,  0,  0,  5,  0,  0,  0,  4,  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, 86, 84,101,
-120,  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, 56,129, 53,  3,
-  0,  0,  0,  0,  5,  0,  0,  0, 20,  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, 85, 86, 84,101,120,  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,200,130, 53,  3,  0,  0,  0,  0,  6,  0,  0,  0, 68,  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, 67,111,108,  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, 24,134, 53,  3,  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,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0, 56,129, 53,  3,  0,  0,  0,  0, 48,  0,  0,  0, 16,  0,  0,  0,  0,  0,  0,  0,
- 12,  0,  0,  0, 23,  0,  0,  0, 24,  0,  0,  0,  0,  0,  0,  2, 19,  0,  0,  0, 20,  0,  0,  0, 23,  0,  0,  0, 22,  0,  0,  0,
-  0,  0,  0,  2, 17,  0,  0,  0, 18,  0,  0,  0, 21,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,  2, 13,  0,  0,  0, 14,  0,  0,  0,
- 17,  0,  0,  0, 16,  0,  0,  0,  0,  0,  0,  2,  1,  0,  0,  0,  8,  0,  0,  0,  7,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  2,
-  7,  0,  0,  0, 16,  0,  0,  0, 19,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  2,  3,  0,  0,  0,  4,  0,  0,  0,  6,  0,  0,  0,
-  5,  0,  0,  0,  0,  0,  0,  2,  3,  0,  0,  0, 22,  0,  0,  0, 11,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  2,  4,  0,  0,  0,
-  3,  0,  0,  0,  9,  0,  0,  0, 10,  0,  0,  0,  1,  0,  0,  2, 22,  0,  0,  0,  3,  0,  0,  0,  5,  0,  0,  0, 19,  0,  0,  0,
-  1,  0,  0,  2,  2,  0,  0,  0,  7,  0,  0,  0,  5,  0,  0,  0,  6,  0,  0,  0,  1,  0,  0,  2,  8,  0,  0,  0, 13,  0,  0,  0,
- 16,  0,  0,  0,  7,  0,  0,  0,  1,  0,  0,  2, 14,  0,  0,  0, 15,  0,  0,  0, 18,  0,  0,  0, 17,  0,  0,  0,  1,  0,  0,  2,
- 16,  0,  0,  0, 17,  0,  0,  0, 20,  0,  0,  0, 19,  0,  0,  0,  1,  0,  0,  2, 20,  0,  0,  0, 21,  0,  0,  0, 24,  0,  0,  0,
- 23,  0,  0,  0,  1,  0,  0,  2, 22,  0,  0,  0, 23,  0,  0,  0, 12,  0,  0,  0, 11,  0,  0,  0,  1,  0,  0,  2, 68, 65, 84, 65,
-  0,  3,  0,  0,200,130, 53,  3,  0,  0,  0,  0, 59,  0,  0,  0, 16,  0,  0,  0,144,108,246, 61,162,226,125, 63, 12,192,137, 62,
-162,226,125, 63, 12,192,137, 62,162,226,125, 63,144,108,246, 61,162,226,125, 63,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,
-  0,  0,  0,  0,252,228,213, 62,162,226,125, 63, 12,192,137, 62,162,226,125, 63, 12,192,137, 62,162,226,125, 63,252,228,213, 62,
-162,226,125, 63,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0, 12,192,137, 62,162,226,125, 63,144,108,246, 61,
-162,226,125, 63,144,108,246, 61,162,226,125, 63, 12,192,137, 62,162,226,125, 63,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,
-  0,  0,  0,  0,  0,229,213, 62,162,226,125, 63, 18,192,137, 62,162,226,125, 63, 12,192,137, 62,162,226,125, 63,252,228,213, 62,
-162,226,125, 63,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,154, 23, 55, 63,162,226,125, 63, 34,  5, 17, 63,
-162,226,125, 63, 30,  5, 17, 63,162,226,125, 63,152, 23, 55, 63,162,226,125, 63,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,
-  0,  0,  0,  0, 30,  5, 17, 63,162,226,125, 63,252,228,213, 62,162,226,125, 63,252,228,213, 62,162,226,125, 63, 30,  5, 17, 63,
-162,226,125, 63,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0, 30,  5, 17, 63,162,226,125, 63,152, 23, 55, 63,
-162,226,125, 63,152, 23, 55, 63,162,226,125, 63, 30,  5, 17, 63,162,226,125, 63,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,
-  0,  0,  0,  0, 30,  5, 17, 63,162,226,125, 63,252,228,213, 62,162,226,125, 63,252,228,213, 62,162,226,125, 63, 30,  5, 17, 63,
-162,226,125, 63,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,152, 23, 55, 63,162,226,125, 63, 30,  5, 17, 63,
-162,226,125, 63, 30,  5, 17, 63,162,226,125, 63,152, 23, 55, 63,162,226,125, 63,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,
-  0,  0,  0,  0,252,228,213, 62,162,226,125, 63, 30,  5, 17, 63,162,226,125, 63, 30,  5, 17, 63,162,226,125, 63,252,228,213, 62,
-162,226,125, 63,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,152, 23, 55, 63,162,226,125, 63, 30,  5, 17, 63,
-162,226,125, 63, 30,  5, 17, 63,162,226,125, 63,152, 23, 55, 63,162,226,125, 63,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,
-  0,  0,  0,  0, 34,  5, 17, 63,162,226,125, 63,  0,229,213, 62,162,226,125, 63,252,228,213, 62,162,226,125, 63, 30,  5, 17, 63,
-162,226,125, 63,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0, 18,192,137, 62,162,226,125, 63,144,108,246, 61,
-162,226,125, 63,144,108,246, 61,162,226,125, 63, 12,192,137, 62,162,226,125, 63,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,
-  0,  0,  0,  0,252,228,213, 62,162,226,125, 63, 12,192,137, 62,162,226,125, 63, 12,192,137, 62,162,226,125, 63,252,228,213, 62,
-162,226,125, 63,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0, 12,192,137, 62,162,226,125, 63,144,108,246, 61,
-162,226,125, 63,144,108,246, 61,162,226,125, 63, 12,192,137, 62,162,226,125, 63,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,
-  0,  0,  0,  0,252,228,213, 62,162,226,125, 63, 12,192,137, 62,162,226,125, 63, 12,192,137, 62,162,226,125, 63,252,228,213, 62,
-162,226,125, 63,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0, 68, 65, 84, 65,  0,  1,  0,  0, 24,134, 53,  3,
-  0,  0,  0,  0, 53,  0,  0,  0, 64,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,168, 30, 27,  4,  0,  0,  0,  0,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  0,  0,  0,  0,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  1,  0,  0,  0,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  2,  0,  0,  0,  5,  0,  0,  0, 28,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+248, 32, 27,  4,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255, 77, 69,  0,  0,152,  1,  0,  0,104,135, 53,  3,  0,  0,  0,  0, 46,  0,  0,  0,
-  1,  0,  0,  0, 88,192, 55,  3,  0,  0,  0,  0,120,117, 53,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 77, 69,112,114,101,118,105,101,119,  0,  0,  0,  0,112,104,101,114,101,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,
+255,255,255,255,255,255,255,255,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  1,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  2,  0,  0,  0,  5,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,179,  0,  0, 64, 52,  0,  0,  0,  0,  0,  0,128, 63,  2,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0, 67,  0, 30,  0,  4,  0,  0,  0,  0,  0,  0,  0,  1,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  8,  0,  0,  0, 24,129, 27,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+120,164, 26,  4,  0,  0,  0,  0, 68, 65, 84, 65,  8,  2,  0,  0, 56, 13,196,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  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, 72,137, 53,  3,  0,  0,  0,  0,104, 27, 54,  3,  0,  0,  0,  0,184,127, 54,  3,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72,139, 53,  3,  0,  0,  0,  0,104,191, 53,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  8,112, 55,  3,  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,152,137, 53,  3,  0,  0,  0,  0,  1,  0,  0,  0,  5,  0,  0,  0, 20,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,184,189, 53,  3,  0,  0,  0,  0,  1,  0,  0,  0,
-  5,  0,  0,  0, 12,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,184, 25, 54,  3,
-  0,  0,  0,  0,  3,  0,  0,  0,  5,  0,  0,  0, 84,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,130,  2,  0,  0,128,  7,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,117,224,186, 64, 91, 13,187, 64,160,240,186, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0, 67,  0,
- 30,  0,  4,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
-  8,  0,  0,  0, 72,137, 53,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,168,238, 51,  3,  0,  0,  0,  0, 68, 65, 84, 65,
-104,  1,  0,  0,152,137, 53,  3,  0,  0,  0,  0, 84,  1,  0,  0,  5,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72,139, 53,  3,  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,
+104,129, 27,  4,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -8790,3990 +9776,224 @@ char datatoc_preview_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 40, 50,  0,  0, 72,139, 53,  3,  0,  0,  0,  0, 52,  0,  0,  0,130,  2,  0,  0, 28,136,141,191, 12,243,244, 62,198, 86,183,192,
-212,231,117, 10,191,130,  1,  0,240,102,131,192, 30,183,119, 64,109,169,199,191, 58,166,158, 84,230,221,  1,  0,119,108,239, 63,
-213, 85,156, 64,188, 58, 40,192,228, 40,207,106,137,198,  1,  0, 95,135,146, 64, 63, 54, 14,191,241,194,102,192, 27,100,219,243,
- 45,177,  1,  0,239, 84,141, 62, 16,220,157,192, 14,  2, 73,192,  8,  6, 39,148, 86,187,  1,  0,132,239,162,192,206,165, 12,192,
-150, 45,240,191,175,144,245,207,251,214,  1,  0,239, 84,141,190, 16,220,157, 64, 14,  2, 73, 64,248,249,217,107,170, 68,  1,  0,
-132,239,162, 64,206,165, 12, 64,150, 45,240, 63, 81,111, 11, 48,  5, 41,  1,  0,240,102,131, 64, 30,183,119,192,109,169,199, 63,
-198, 89, 98,171, 26, 34,  1,  0,119,108,239,191,213, 85,156,192,188, 58, 40, 64, 28,215, 49,149,119, 57,  1,  0, 95,135,146,192,
- 63, 54, 14, 63,241,194,102, 64,229,155, 37, 12,211, 78,  1,  0, 28,136,141, 63, 12,243,244,190,198, 86,183, 64, 44, 24,139,245,
- 65,125,  1,  0,114, 17, 68,192,226,153, 35, 64,154, 26,137,192,  6,189,226, 55, 85,162,  1,  0,155, 40,230, 62,239,199, 73, 64,
-176, 52,157,192,211,  9,237, 68,153,148,  1,  0,124, 55,168,191,224,177,164, 64, 58,144, 29,192, 69,227,132,112, 46,202,  1,  0,
- 94, 35,105,192,230, 88,129,191,195, 14,143,192, 93,176,233,233, 68,158,  1,  0, 37,  2,173,192,137,187,123, 63, 56, 68,  1,192,
-206,137,127, 21,216,211,  1,  0,234,168,  2, 64,231,158, 57,189, 65,149,175,192,162, 44,  3,255, 11,136,  1,  0, 19,159,114, 64,
-254,226, 34, 64,196,133,106,192,225, 82,164, 55,228,175,  1,  0,105,176,249,190, 21,148, 39,192,217,214,166,192, 87,245,194,198,
-  5,142,  1,  0,227,163, 54, 64, 86,121, 78,192, 22,202,125,192, 99, 62,120,185, 79,169,  1,  0,241, 40, 53,192,200, 31,134,192,
-229,188, 60,192, 30,194, 94,164,136,191,  1,  0, 96,230,181,192, 33, 24,119,191,174, 26,130, 63,186,131,231,234, 56, 22,  1,  0,
-103, 93,163,192,136,128, 38, 64, 83,235,153, 63,100,144,224, 56, 74, 26,  1,  0,238,219, 36,192,132,151,165, 64,165,226,109, 63,
-176,199, 33,113, 80, 20,  1,  0, 24,237,111, 63,118,174,184, 64,212, 34,154, 62,125, 20, 44,126,148,  6,  1,  0,163,244,130, 64,
-157, 58,133, 64,125, 95,226,190,119, 89,  5, 91, 86,246,  1,  0, 96,230,181, 64, 33, 24,119, 63,174, 26,130,191, 70,124, 25, 21,
-200,233,  1,  0,103, 93,163, 64,136,128, 38,192, 83,235,153,191,156,111, 32,199,182,229,  1,  0,238,219, 36, 64,132,151,165,192,
-165,226,109,191, 80, 56,223,142,176,235,  1,  0, 24,237,111,191,118,174,184,192,212, 34,154,190,131,235,212,129,108,249,  1,  0,
-163,244,130,192,157, 58,133,192,125, 95,226, 62,137,166,251,164,170,  9,  1,  0,227,163, 54,192, 86,121, 78, 64, 22,202,125, 64,
-157,193,136, 70,177, 86,  1,  0,241, 40, 53, 64,200, 31,134, 64,229,188, 60, 64,226, 61,162, 91,120, 64,  1,  0, 37,  2,173, 64,
-137,187,123,191, 56, 68,  1, 64, 50,118,129,234, 40, 44,  1,  0,124, 55,168, 63,224,177,164,192, 58,144, 29, 64,187, 28,124,143,
-210, 53,  1,  0, 19,159,114,192,254,226, 34,192,196,133,106, 64, 31,173, 92,200, 28, 80,  1,  0,234,168,  2,192,231,158, 57, 61,
- 65,149,175, 64, 94,211,253,  0,245,119,  1,  0,105,176,249, 62, 21,148, 39, 64,217,214,166, 64,169, 10, 62, 57,251,113,  1,  0,
- 94, 35,105, 64,230, 88,129, 63,195, 14,143, 64,163, 79, 23, 22,188, 97,  1,  0,114, 17, 68, 64,226,153, 35,192,154, 26,137, 64,
-250, 66, 30,200,171, 93,  1,  0,155, 40,230,190,239,199, 73,192,176, 52,157, 64, 45,246, 19,187,103,107,  1,  0, 37,178, 10,192,
-138,231,201, 63,149,143,166,192, 31,209,244, 33,216,141,  1,  0,  3,132,110,192,243,203, 85, 64,151,107, 66,192, 67,174, 93, 73,
- 73,190,  1,  0,116,161,174,190, 81,152,241, 63,110,  2,177,192, 38,248,149, 40,221,134,  1,  0,138, 91,154, 63,218,179,133, 64,
-209,222,122,192,185, 26,201, 91,228,170,  1,  0,  7, 82, 52,192, 82,252,149, 64, 64,202,  5,192,177,193, 36,102,136,210,  1,  0,
-179, 12,148, 62,251,221,166, 64,188, 87, 41,192, 34,  7,239,113, 29,198,  1,  0,216,246, 29,192, 17,156,141,190,209,167,169,192,
-176,202, 86,250,199,139,  1,  0, 99, 72,145,192, 79,114,213,191,183, 35, 83,192, 97,156, 62,219,138,184,  1,  0,115, 58,158,192,
-129,120, 33, 64,198, 41,238,191, 60,148,228, 55,113,215,  1,  0,118,158,174,192,103,148, 33,191,140,156,  1,192,201,136,100,241,
-196,211,  1,  0, 55, 14,249, 62, 95,133,102, 62,210,143,186,192,213,  9, 14,  5,124,128,  1,  0,220, 61, 92, 64, 56,230,159,190,
-  6, 61,151,192,224, 75, 11,249, 40,153,  1,  0,  7, 86, 60, 64, 60, 48,119, 64, 93, 88, 81,192,216, 63,  8, 85,193,184,  1,  0,
-252, 55,139, 64, 62, 95,132, 63,225,216,113,192, 80, 95,209, 21,103,173,  1,  0, 18,  6, 84,191,251, 96,142,191, 76,  4,182,192,
-189,237,121,232,133,131,  1,  0,109, 74,225,189, 51, 54,123,192, 34,246,138,192,203,253,153,169,152,161,  1,  0,153, 66,119, 64,
-127,154,251,191,161,220,123,192,230, 84,182,213, 15,170,  1,  0,201, 59,208, 63,241,182,135,192,212,101,108,192,232, 34,217,162,
-118,175,  1,  0,161,246,169,191,235,196,151,192,170,149, 74,192,196,227, 32,152,192,186,  1,  0, 33,198,131,192,218,137, 84,192,
- 37,134, 32,192,102,165,233,183,113,201,  1,  0,176, 61,179,192,138,110,210,191, 24,220,228,190,179,133,191,219,126,245,  1,  0,
- 73,182,170,192,136, 16, 90,190, 90,194, 25, 64,168,139,188,251, 46, 53,  1,  0, 75, 55,153,192,  4, 78, 87, 64, 12, 54, 62,190,
-149,151,222, 73, 60,251,  1,  0,235, 19,161,192,207, 12,210, 63,210,242, 31, 64, 23,146, 90, 35, 63, 55,  1,  0, 60, 75, 94,192,
-189,115,150, 64,186,211,167,190,173,179,116,102, 51,248,  1,  0,186,191,189,191, 63, 32,168, 64,213,100,  7, 64, 46,224,204,114,
-208, 46,  1,  0,242,205,186, 63,141, 65,177, 64,127,219,154,191, 36, 32,223,120,206,228,  1,  0, 99,245,175, 62, 97, 12,178, 64,
-255,253,228, 63, 52,  7,109,121,213, 39,  1,  0,226, 92, 70, 64,  8,131,150, 64,182, 77,204,191, 49, 67,  2,103,141,220,  1,  0,
-200,194,152, 64,180,155, 83, 64,154,217, 62, 63,158,104,199, 71,227, 16,  1,  0, 73,182,170, 64,136, 16, 90, 62, 90,194, 25,192,
- 88,116, 68,  4,210,202,  1,  0,176, 61,179, 64,138,110,210, 63, 24,220,228, 62, 77,122, 65, 36,130, 10,  1,  0,235, 19,161, 64,
-207, 12,210,191,210,242, 31,192,233,109,166,220,193,200,  1,  0, 75, 55,153, 64,  4, 78, 87,192, 12, 54, 62, 62,107,104, 34,182,
-196,  4,  1,  0,186,191,189, 63, 63, 32,168,192,213,100,  7,192,210, 31, 52,141, 48,209,  1,  0, 60, 75, 94, 64,189,115,150,192,
-186,211,167, 62, 83, 76,140,153,205,  7,  1,  0, 99,245,175,190, 97, 12,178,192,255,253,228,191,204,248,147,134, 43,216,  1,  0,
-242,205,186,191,141, 65,177,192,127,219,154, 63,220,223, 33,135, 50, 27,  1,  0,200,194,152,192,180,155, 83,192,154,217, 62,191,
- 98,151, 57,184, 29,239,  1,  0,226, 92, 70,192,  8,131,150,192,182, 77,204, 63,207,188,254,152,115, 35,  1,  0,201, 59,208,191,
-241,182,135, 64,212,101,108, 64, 24,221, 39, 93,138, 80,  1,  0,153, 66,119,192,127,154,251, 63,161,220,123, 64, 26,171, 74, 42,
-241, 85,  1,  0,161,246,169, 63,235,196,151, 64,170,149, 74, 64, 60, 28,224,103, 64, 69,  1,  0, 33,198,131, 64,218,137, 84, 64,
- 37,134, 32, 64,154, 90, 23, 72,143, 54,  1,  0,118,158,174, 64,103,148, 33, 63,140,156,  1, 64, 55,119,156, 14, 60, 44,  1,  0,
-115, 58,158, 64,129,120, 33,192,198, 41,238, 63,196,107, 28,200,143, 40,  1,  0,  7, 82, 52, 64, 82,252,149,192, 64,202,  5, 64,
- 79, 62,220,153,120, 45,  1,  0,179, 12,148,190,251,221,166,192,188, 87, 41, 64,222,248, 17,142,227, 57,  1,  0,  7, 86, 60,192,
- 60, 48,119,192, 93, 88, 81, 64, 40,192,248,170, 63, 71,  1,  0,252, 55,139,192, 62, 95,132,191,225,216,113, 64,176,160, 47,234,
-153, 82,  1,  0,220, 61, 92,192, 56,230,159, 62,  6, 61,151, 64, 32,180,245,  6,216,102,  1,  0, 55, 14,249,190, 95,133,102,190,
-210,143,186, 64, 43,246,242,250,132,127,  1,  0,109, 74,225, 61, 51, 54,123, 64, 34,246,138, 64, 53,  2,103, 86,104, 94,  1,  0,
- 18,  6, 84, 63,251, 96,142, 63, 76,  4,182, 64, 67, 18,135, 23,123,124,  1,  0, 99, 72,145, 64, 79,114,213, 63,183, 35, 83, 64,
-159, 99,194, 36,118, 71,  1,  0,216,246, 29, 64, 17,156,141, 62,209,167,169, 64, 80, 53,170,  5, 57,116,  1,  0,  3,132,110, 64,
-243,203, 85,192,151,107, 66, 64,189, 81,163,182,183, 65,  1,  0, 37,178, 10, 64,138,231,201,191,149,143,166, 64,225, 46, 12,222,
- 40,114,  1,  0,138, 91,154,191,218,179,133,192,209,222,122, 64, 71,229, 55,164, 28, 85,  1,  0,116,161,174, 62, 81,152,241,191,
-110,  2,177, 64,218,  7,107,215, 35,121,  1,  0, 36, 76, 19,192, 25,151,129, 64,212,254, 98,192,201,206,101, 88,154,177,  1,  0,
- 93,232,175,191,177, 23, 64, 64, 69,186,154,192,229,225,204, 66, 13,151,  1,  0,208,190,232,190, 93,160,139, 64,191, 33,120,192,
-216,244,220, 94,204,170,  1,  0,210,126,142,192, 43, 49,238, 63,112, 30, 84,192,185,158,127, 39,203,182,  1,  0,138,165, 97,192,
- 92,  9, 80, 63, 20, 74,147,192,212,177,229, 17, 63,156,  1,  0, 98, 61,152,192, 87, 63,106,188,  6, 97, 90,192,114,152,219,  0,
-199,180,  1,  0,200,173, 14, 64,155,183, 63, 64,192, 75,144,192,205, 48, 77, 64,172,156,  1,  0, 95,162,167, 63,144, 29,209, 63,
- 25,245,174,192,217, 29, 61, 36,238,136,  1,  0,211, 62, 68, 64, 51, 56,168, 63, 13,245,153,192, 12, 66,168, 29,115,150,  1,  0,
- 33,182, 36, 64, 34, 38,220,191,150,  5,159,192, 10, 55,224,217,234,146,  1,  0, 16, 34, 81, 63,129, 64,179,191,162,  5,180,192,
-215, 18,118,224,100,133,  1,  0,212, 56,159, 63,172,166, 68,192,212,108,154,192,164, 27,  0,190,224,149,  1,  0,204, 76,223,191,
-170, 32,101,192, 65, 83,137,192,225,216,170,178,208,161,  1,  0,249,249, 10,192, 62, 52,244,191, 25,236,162,192, 21,208, 32,213,
- 85,145,  1,  0, 42,207, 89,192,251,  6, 47,192, 27,165,121,192,179,182, 21,196,221,169,  1,  0,137,215,176,192, 25, 62,241, 63,
-179,254,219,190,190,134,  7, 40, 61,247,  1,  0, 28,150,186,192,150, 16, 28, 60,191,  9,  7,191,120,128,100,  1, 57,245,  1,  0,
- 34,132,181,192, 99, 60, 92, 63,217, 81,149, 63,188,131,235, 18, 33, 24,  1,  0,175,242, 74,190,164,173,183, 64,227,105,145,191,
-146,250,157,125,  8,232,  1,  0,219,227,  2,192, 96,164,173, 64,200, 71, 78,191,131,212, 38,119,214,238,  1,  0,181,140, 92,191,
- 75, 38,184, 64,176,148, 37, 63,231,236,234,125,196, 12,  1,  0, 75,104,159, 64,212, 56,236, 63,240,126, 29,192,213,108,134, 41,
-245,202,  1,  0,215,159,132, 64, 84,184, 97, 64, 30, 44, 10,192,150, 91, 44, 76, 46,209,  1,  0, 95,122,164, 64,199,143, 44, 64,
- 53, 78, 68,191, 25,112, 14, 59,222,237,  1,  0,255,176, 54, 64,243, 84,141,192,237,176, 36,192,159, 63,250,159, 50,200,  1,  0,
- 93,229,133, 64,217, 21, 68,192,157,226, 45,192,  6, 91,218,187, 61,197,  1,  0,203, 56,129, 64, 21,211,130,192,187,115,143,191,
-  3, 88,190,166, 33,230,  1,  0,189,239,104,192, 82,142,140,192,178,178,168,191,108,177, 13,159,144,227,  1,  0, 50,141,253,191,
- 52,155,167,192,170,181,218,191,154,211,162,141,131,219,  1,  0,164, 58, 41,192,172, 34,167,192,206,232,151, 61,239,197,240,141,
- 63,  0,  1,  0, 93,229,133,192,217, 21, 68, 64,157,226, 45, 64,250,164, 38, 68,195, 58,  1,  0,203, 56,129,192, 21,211,130, 64,
-187,115,143, 63,253,167, 66, 89,223, 25,  1,  0,255,176, 54,192,243, 84,141, 64,237,176, 36, 64, 97,192,  6, 96,206, 55,  1,  0,
- 50,141,253, 63, 52,155,167, 64,170,181,218, 63,102, 44, 94,114,125, 36,  1,  0,164, 58, 41, 64,172, 34,167, 64,206,232,151,189,
- 17, 58, 16,114,193,255,  1,  0,189,239,104, 64, 82,142,140, 64,178,178,168, 63,148, 78,243, 96,112, 28,  1,  0, 28,150,186, 64,
-150, 16, 28,188,191,  9,  7, 63,136,127,156,254,199, 10,  1,  0, 34,132,181, 64, 99, 60, 92,191,217, 81,149,191, 68,124, 21,237,
-223,231,  1,  0,137,215,176, 64, 25, 62,241,191,179,254,219, 62, 66,121,249,215,195,  8,  1,  0,219,227,  2, 64, 96,164,173,192,
-200, 71, 78, 63,125, 43,218,136, 42, 17,  1,  0,181,140, 92, 63, 75, 38,184,192,176,148, 37,191, 25, 19, 22,130, 60,243,  1,  0,
-175,242, 74, 62,164,173,183,192,227,105,145, 63,110,  5, 99,130,248, 23,  1,  0,215,159,132,192, 84,184, 97,192, 30, 44, 10, 64,
-106,164,212,179,210, 46,  1,  0, 95,122,164,192,199,143, 44,192, 53, 78, 68, 63,231,143,242,196, 34, 18,  1,  0, 75,104,159,192,
-212, 56,236,191,240,126, 29, 64, 43,147,122,214, 11, 53,  1,  0,212, 56,159,191,172,166, 68, 64,212,108,154, 64, 92,228,  0, 66,
- 32,106,  1,  0, 33,182, 36,192, 34, 38,220, 63,150,  5,159, 64,246,200, 32, 38, 22,109,  1,  0, 16, 34, 81,191,129, 64,179, 63,
-162,  5,180, 64, 41,237,138, 31,156,122,  1,  0, 42,207, 89, 64,251,  6, 47, 64, 27,165,121, 64, 77, 73,235, 59, 35, 86,  1,  0,
-208, 76,223, 63,170, 32,101, 64, 65, 83,137, 64, 31, 39, 86, 77, 48, 94,  1,  0,249,249, 10, 64, 62, 52,244, 63, 25,236,162, 64,
-235, 47,224, 42,171,110,  1,  0,210,126,142, 64, 43, 49,238,191,112, 30, 84, 64, 71, 97,129,216, 53, 73,  1,  0, 98, 61,152, 64,
- 87, 63,106, 60,  6, 97, 90, 64,142,103, 37,255, 57, 75,  1,  0,138,165, 97, 64, 92,  9, 80,191, 20, 74,147, 64, 44, 78, 27,238,
-193, 99,  1,  0,208,190,232, 62, 93,160,139,192,191, 33,120, 64, 40, 11, 36,161, 52, 85,  1,  0, 36, 76, 19, 64, 25,151,129,192,
-212,254, 98, 64, 55, 49,155,167,102, 78,  1,  0, 93,232,175, 63,177, 23, 64,192, 69,186,154, 64, 27, 30, 52,189,243,104,  1,  0,
-211, 62, 68,192, 51, 56,168,191, 13,245,153, 64,244,189, 88,226,141,105,  1,  0,200,173, 14,192,155,183, 63,192,192, 75,144, 64,
- 51,207,179,191, 84, 99,  1,  0, 95,162,167,191,144, 29,209,191, 25,245,174, 64, 39,226,195,219, 18,119,  1,  0,158,156,211,191,
-185,228,132, 63,190,207,176,192,249,219,152, 22, 71,135,  1,  0,  0, 76, 41,192,190,199,  5, 64, 83,157,153,192, 56,198,174, 45,
- 83,151,  1,  0,204, 83,125,192,169, 55,105, 64,244,162, 20,192,132,169,162, 79,100,205,  1,  0,178,215, 91,192,222,235, 62, 64,
-190,254,108,192, 26,181,  8, 65, 28,175,  1,  0,242, 63, 59,191,210,237,152, 63,251, 21,182,192,248,239,253, 25,180,131,  1,  0,
- 86,230, 94, 61,198, 30, 35, 64,233, 15,169,192, 62,  1,180, 55,197,140,  1,  0,220,  4,199, 63,  7,145,146, 64,104,186, 83,192,
-  3, 34, 24,100,216,183,  1,  0,  9,120, 86, 63,149, 91,109, 64, 79,242,142,192, 57, 18,216, 80,117,158,  1,  0,103,243, 95,192,
-221, 91,138, 64,186, 15,236,191,121,179, 96, 94,195,215,  1,  0, 46,206,  5,192,121, 41,159, 64,154, 91, 19,192,127,210,143,108,
-188,205,  1,  0,169,200,139, 63,198, 78,163, 64,201,146, 42,192,249, 23,113,111,202,197,  1,  0,187,128,  4,191,206,181,167, 64,
- 74, 92, 37,192,151,244, 89,114,164,199,  1,  0,151, 16,231,191,160,166,209, 61,167, 95,178,192,173,216, 74,  2, 56,134,  1,  0,
-163,200, 69,192,178,143, 38,191,148, 48,158,192,124,188,192,241, 51,148,  1,  0, 43,192,155,192,151,  6,250,191,170, 82, 39,192,
-166,149, 76,213,  2,199,  1,  0,233,118,132,192,217,111,173,191, 67,122,123,192,191,165,124,226, 46,170,  1,  0,238, 85,146,192,
-178,205, 78, 64, 70, 54,221,191, 47,156,175, 70, 71,218,  1,  0, 76,137,167,192,111, 31,227, 63,158, 57,251,191,187,141,154, 38,
- 42,213,  1,  0, 39,143,170,192,167, 15,183,191,251, 85,252,191,157,139,164,224,245,212,  1,  0,  8,214,175,192,177,124, 53, 62,
-206,241,  2,192, 28,136,252,  3, 92,211,  1,  0, 77,160,160,190,  9, 20,182, 62,108,232,186,192,  8,249,201,  7,111,128,  1,  0,
- 33,144,163, 63,151,144,186, 61, 50, 47,183,192,255, 27,247,  1, 31,131,  1,  0,222,179,129, 64,234,147,224,190, 38,180,134,192,
-157, 88,103,246, 37,164,  1,  0,114,138, 49, 64,246, 97, 57,190, 57, 76,165,192,109, 60, 18,252, 60,143,  1,  0,249,158, 27, 64,
-197,118,141, 64, 58,196, 62,192,  6, 53,163, 96,242,190,  1,  0, 98,244, 89, 64,  8,120, 79, 64, 65,128, 96,192, 94, 74,162, 70,
-111,179,  1,  0, 13,100,144, 64,200,214,118, 62, 64,205,110,192,146, 98, 37,  5,132,174,  1,  0, 42,202,131, 64, 60,161,231, 63,
-142,245,112,192,210, 89,152, 39,220,173,  1,  0,149, 51,122,191, 52,151,163,190, 15,157,184,192,162,234, 36,249,253,129,  1,  0,
-  5,113, 42,191, 31,112,241,191, 15,119,176,192,128,241,188,214,182,135,  1,  0, 60, 55,172, 61, 22, 64,143,192,164,246,113,192,
-221,  1, 37,158,133,173,  1,  0,167,173,154,190,111,224, 83,192,198,169,154,192, 98,249,221,183,123,150,  1,  0,151,133,136, 64,
-  9,249,162,191,106,219,115,192, 61, 93, 76,228,206,172,  1,  0,110,124, 89, 64,135,  6, 40,192,223,195,127,192, 18, 74,160,198,
-205,168,  1,  0,244,248,117, 63,109, 90,148,192,123,  0, 93,192,225, 20,176,154,159,180,  1,  0,162,  0, 17, 64, 63,196,113,192,
- 52,239,119,192,134, 49,167,173,116,171,  1,  0,162,217,  7,191, 21,117,156,192,222,238, 75,192,137,244, 50,149,104,186,  1,  0,
-171,144,  6,192,112,158,144,192,198,241, 69,192,  4,210,111,157,136,188,  1,  0,110,238,148,192,115,109, 50,192,187,197, 13,192,
- 69,154, 50,195,171,207,  1,  0, 79,252, 96,192,140, 40,115,192,116,165, 48,192,100,179, 10,173,191,195,  1,  0,100,228,172,192,
-217,128,248,191,  8, 93,150,191,  8,138,142,213, 59,230,  1,  0, 82,171,182,192,216,250,168,191, 15, 15,147, 62,113,131, 63,227,
- 95,  6,  1,  0,215, 73,160,192,124,165, 49, 62,232, 85, 66, 64,167,146,217,  3,105, 66,  1,  0,171, 89,178,192,192,115, 24,191,
- 78,116,221, 63, 94,134,244,242,165, 37,  1,  0, 51,206,143,192,133,250,105, 64,119,251, 97,191,230,157,228, 79,157,236,  1,  0,
- 62, 32,160,192,163, 38, 65, 64,164,117,  3, 63,203,146,203, 65, 78, 11,  1,  0,216,108,155,192, 59,255,141, 63,189,117, 69, 64,
-243,149, 37, 24,120, 67,  1,  0, 85, 27,164,192,244, 78,  9, 64, 87,193,239, 63, 25,144,226, 46,198, 40,  1,  0,134, 35,117,192,
- 39,152,138, 64, 73, 86,116,191, 74,172,136, 94, 15,235,  1,  0, 35,220, 67,192,  6,218,159, 64,242,103,155, 62, 75,189,  8,109,
-183,  6,  1,  0,130, 79, 99,191,215,182,164, 64, 10,  4, 42, 64,180,236,103,112, 26, 58,  1,  0,161, 86,  3,192, 14,205,168, 64,
- 60, 55,197, 63, 37,211, 23,115,135, 33,  1,  0,229,101,215, 63, 84,141,168, 64, 16, 90,248,191,201, 36,255,114,131,213,  1,  0,
- 99, 52,155, 63,198, 17,183, 64,232,199,235,190,107, 26,216,124, 17,246,  1,  0,105,179, 10, 61, 25,185,169, 64,120,119, 31, 64,
-177,  0,204,115,135, 54,  1,  0,143,198, 37, 63,123,120,183, 64,160,108,135, 63, 44, 14, 29,125,249, 22,  1,  0,180,174, 32, 64,
- 65, 13,155, 64,238,167,  8,192,189, 54,216,105, 72,209,  1,  0, 69,199,104, 64,177,135,143, 64, 41, 12,132,191,111, 79,211, 97,
-148,233,  1,  0,121,134,159, 64, 49,245, 49, 64,210,166,169, 63,233,108,165, 60,  9, 29,  1,  0, 52,133,143, 64,119,200,113, 64,
-186,206, 29, 62,207, 97,126, 82, 70,  3,  1,  0,215, 73,160, 64,124,165, 49,190,232, 85, 66,192, 89,109, 39,252,151,189,  1,  0,
-171, 89,178, 64,192,115, 24, 63, 78,116,221,191,162,121, 12, 13, 91,218,  1,  0,100,228,172, 64,217,128,248, 63,  8, 93,150, 63,
-248,117,114, 42,197, 25,  1,  0, 82,171,182, 64,216,250,168, 63, 15, 15,147,190,143,124,193, 28,161,249,  1,  0,216,108,155, 64,
- 59,255,141,191,189,117, 69,192, 13,106,219,231,136,188,  1,  0, 85, 27,164, 64,244, 78,  9,192, 87,193,239,191,231,111, 30,209,
- 58,215,  1,  0, 51,206,143, 64,133,250,105,192,119,251, 97, 63, 26, 98, 28,176, 99, 19,  1,  0, 62, 32,160, 64,163, 38, 65,192,
-164,117,  3,191, 53,109, 53,190,178,244,  1,  0,130, 79, 99, 63,215,182,164,192, 10,  4, 42,192, 76, 19,153,143,230,197,  1,  0,
-161, 86,  3, 64, 14,205,168,192, 60, 55,197,191,219, 44,233,140,121,222,  1,  0,134, 35,117, 64, 39,152,138,192, 73, 86,116, 63,
-182, 83,120,161,241, 20,  1,  0, 35,220, 67, 64,  6,218,159,192,242,103,155,190,181, 66,248,146, 73,249,  1,  0,105,179, 10,189,
- 25,185,169,192,120,119, 31,192, 79,255, 52,140,121,201,  1,  0,143,198, 37,191,123,120,183,192,160,108,135,191,212,241,227,130,
-  7,233,  1,  0,229,101,215,191, 84,141,168,192, 16, 90,248, 63, 55,219,  1,141,125, 42,  1,  0, 99, 52,155,191,198, 17,183,192,
-232,199,235, 62,149,229, 40,131,239,  9,  1,  0,121,134,159,192, 49,245, 49,192,210,166,169,191, 23,147, 91,195,247,226,  1,  0,
- 52,133,143,192,119,200,113,192,186,206, 29,190, 49,158,130,173,186,252,  1,  0,180,174, 32,192, 65, 13,155,192,238,167,  8, 64,
- 67,201, 40,150,184, 46,  1,  0, 69,199,104,192,177,135,143,192, 41, 12,132, 63,145,176, 45,158,108, 22,  1,  0,244,248,117,191,
-109, 90,148, 64,123,  0, 93, 64, 31,235, 80,101, 97, 75,  1,  0,162,  0, 17,192, 63,196,113, 64, 52,239,119, 64,122,206, 89, 82,
-140, 84,  1,  0,151,133,136,192,  9,249,162, 63,106,219,115, 64,195,162,180, 27, 50, 83,  1,  0,110,124, 89,192,135,  6, 40, 64,
-223,195,127, 64,238,181, 96, 57, 51, 87,  1,  0,162,217,  7, 63, 21,117,156, 64,222,238, 75, 64,119, 11,206,106,152, 69,  1,  0,
-171,144,  6, 64,112,158,144, 64,198,241, 69, 64,252, 45,145, 98,120, 67,  1,  0,110,238,148, 64,115,109, 50, 64,187,197, 13, 64,
-187,101,206, 60, 85, 48,  1,  0, 79,252, 96, 64,140, 40,115, 64,116,165, 48, 64,156, 76,246, 82, 65, 60,  1,  0, 39,143,170, 64,
-167, 15,183, 63,251, 85,252, 63, 99,116, 92, 31, 11, 43,  1,  0,  8,214,175, 64,177,124, 53,190,206,241,  2, 64,228,119,  4,252,
-164, 44,  1,  0,238, 85,146, 64,178,205, 78,192, 70, 54,221, 63,209, 99, 81,185,185, 37,  1,  0, 76,137,167, 64,111, 31,227,191,
-158, 57,251, 63, 69,114,102,217,214, 42,  1,  0,103,243, 95, 64,221, 91,138,192,186, 15,236, 63,135, 76,160,161, 61, 40,  1,  0,
- 46,206,  5, 64,121, 41,159,192,154, 91, 19, 64,129, 45,113,147, 68, 50,  1,  0,169,200,139,191,198, 78,163,192,201,146, 42, 64,
-  7,232,143,144, 54, 58,  1,  0,187,128,  4, 63,206,181,167,192, 74, 92, 37, 64,105, 11,167,141, 92, 56,  1,  0,249,158, 27,192,
-197,118,141,192, 58,196, 62, 64,250,202, 93,159, 14, 65,  1,  0, 98,244, 89,192,  8,120, 79,192, 65,128, 96, 64,162,181, 94,185,
-145, 76,  1,  0, 13,100,144,192,200,214,118,190, 64,205,110, 64,110,157,219,250,124, 81,  1,  0, 42,202,131,192, 60,161,231,191,
-142,245,112, 64, 46,166,104,216, 36, 82,  1,  0,222,179,129,192,234,147,224, 62, 38,180,134, 64, 99,167,153,  9,219, 91,  1,  0,
-114,138, 49,192,246, 97, 57, 62, 57, 76,165, 64,147,195,238,  3,196,112,  1,  0, 77,160,160, 62,  9, 20,182,190,108,232,186, 64,
-248,  6, 55,248,145,127,  1,  0, 33,144,163,191,151,144,186,189, 50, 47,183, 64,  1,228,  9,254,225,124,  1,  0, 60, 55,172,189,
- 22, 64,143, 64,164,246,113, 64, 35,254,219, 97,123, 82,  1,  0,167,173,154, 62,111,224, 83, 64,198,169,154, 64,158,  6, 35, 72,
-133,105,  1,  0,149, 51,122, 63, 52,151,163, 62, 15,157,184, 64, 94, 21,220,  6,  3,126,  1,  0,  5,113, 42, 63, 31,112,241, 63,
- 15,119,176, 64,128, 14, 68, 41, 74,120,  1,  0, 43,192,155, 64,151,  6,250, 63,170, 82, 39, 64, 90,106,180, 42,254, 56,  1,  0,
-233,118,132, 64,217,111,173, 63, 67,122,123, 64, 65, 90,132, 29,210, 85,  1,  0,151, 16,231, 63,160,166,209,189,167, 95,178, 64,
- 83, 39,182,253,200,121,  1,  0,163,200, 69, 64,178,143, 38, 63,148, 48,158, 64,132, 67, 64, 14,205,107,  1,  0,204, 83,125, 64,
-169, 55,105,192,244,162, 20, 64,124, 86, 94,176,156, 50,  1,  0,178,215, 91, 64,222,235, 62,192,190,254,108, 64,230, 74,248,190,
-228, 80,  1,  0,158,156,211, 63,185,228,132,191,190,207,176, 64,  7, 36,104,233,185,120,  1,  0,  0, 76, 41, 64,190,199,  5,192,
- 83,157,153, 64,200, 57, 82,210,173,104,  1,  0,220,  4,199,191,  7,145,146,192,104,186, 83, 64,253,221,232,155, 40, 72,  1,  0,
-  9,120, 86,191,149, 91,109,192, 79,242,142, 64,199,237, 40,175,139, 97,  1,  0,242, 63, 59, 63,210,237,152,191,251, 21,182, 64,
-  8, 16,  3,230, 76,124,  1,  0, 86,230, 94,189,198, 30, 35,192,233, 15,169, 64,194,254, 76,200, 59,115,  1,  0,208, 27, 46,192,
-124,104, 86, 64, 85, 52,126,192,122,197, 16, 73,183,168,  1,  0, 82,168,234,191, 87, 62,149, 64,118, 12, 67,192,197,216,162,101,
-209,188,  1,  0,186, 10, 16,192,249,106, 52, 64,210,253,147,192,231,206,104, 62,158,155,  1,  0, 93, 33,240,190,191,199, 71, 64,
-142, 47,158,192,166,245,253, 68,176,148,  1,  0, 19, 46, 71,187,194,240,115, 64,175,166,142,192,  0,255,213, 82,110,158,  1,  0,
-188,194,101,191, 17, 84,154, 64,240,193, 77,192,140,235,211,104,117,185,  1,  0,246,246,115,192,183, 86, 15, 64, 51,168,118,192,
-208,172,249, 47, 97,171,  1,  0,101,  1,160,192, 47,146,184, 63,153, 38, 45,192,249,146,160, 30, 91,196,  1,  0,215,229, 85,192,
-166,178,218, 63,183, 55,144,192, 61,182, 81, 37, 72,158,  1,  0,151,178,104,192,245,107,205,189,175, 60,147,192,218,175,251,253,
- 58,156,  1,  0,192, 81,136,192, 55,239,  4,191, 24,222,127,192, 84,163,147,245, 85,168,  1,  0, 70,241,164,192,102,218,251, 62,
-143, 82, 48,192,224,143,144, 11, 93,195,  1,  0,209,230,173, 63,231,135, 71, 64, 27,234,152,192,195, 29, 39, 67, 46,151,  1,  0,
-158,103, 67, 64, 82,206, 51, 64, 39,168,132,192,158, 66,115, 60,243,164,  1,  0,136,131,100, 63, 16, 95, 27, 64,  4,115,168,192,
-106, 20, 79, 53,113,141,  1,  0, 77,154,217, 63,185, 69, 78, 63,221,196,177,192,249, 37,  9, 18, 27,135,  1,  0,107,195, 37, 64,
-  4,213, 36, 63, 20, 33,167,192,212, 55,201, 14,199,141,  1,  0,103,139, 94, 64,153,146,250, 63, 72,141,137,192, 32, 75, 91, 43,
-225,161,  1,  0,231,195, 21, 64,236, 58,101,191,218,178,169,192, 46, 50,  2,236,247,139,  1,  0,142, 32, 48, 64,155,140, 32,192,
-195,  1,145,192, 36, 59,237,200,191,156,  1,  0, 70,155,185, 63, 12,202, 59,191,163, 86,180,192, 83, 32, 66,239, 75,133,  1,  0,
- 29, 97, 43, 62,144,118,  2,192,125,231,175,192,109,  4,225,210, 78,136,  1,  0, 97,116,196, 62, 10,176, 56,192,120,239,162,192,
-197,  8,225,193,112,144,  1,  0,185,  2,  5, 64,217,105, 76,192,135,173,142,192,159, 45, 45,187, 53,158,  1,  0,163,243,144,191,
-252, 41, 73,192,148, 66,154,192,132,230, 16,188,144,150,  1,  0,147,133, 20,192,234, 55,124,192,176,  3,107,192,172,204,182,170,
-139,175,  1,  0, 42,186, 60,192,219,128,189,191, 23, 43,155,192, 96,191,203,222,161,150,  1,  0, 52,164,172,191,106,240, 18,192,
-141, 58,167,192, 44,226, 15,205,110,142,  1,  0, 12,171,100,192,249, 33,243,191,106,221,135,192,218,178, 99,214,187,162,  1,  0,
-195, 78, 74,192,241,206, 96,192, 98, 88, 94,192,207,187, 78,179,131,179,  1,  0, 41,110,177,192, 81, 30,186, 63,105,249,158,191,
-171,134,229, 30,109,229,  1,  0, 45,138,172,192,114,149, 17, 64,127,203,200, 62,254,137,191, 48,246,  8,  1,  0, 10, 94,182,192,
- 48,  5,  1, 63, 86, 81,165,191,147,131,214, 11,110,228,  1,  0,117,224,186,192, 37,234,247,190,147, 56,126, 62,130,128, 89,246,
-234,  5,  1,  0,204, 78,184,192, 19,193, 89,189,187,163,141, 63, 30,130,255,254, 35, 23,  1,  0,105,232,174,192,151,187,224, 63,
-156,183,153, 63,130,136, 85, 38, 48, 25,  1,  0, 42,118, 68,191,101,173,176, 64,114,132,233,191,124,238,154,120,225,216,  1,  0,
- 81,172,191, 62, 67,208,186, 64,195,163,216,190, 80,  7,126,127, 90,247,  1,  0,113,  2,218,191,172,151,171, 64,114, 25,212,191,
-182,219,106,117, 61,220,  1,  0,251,244, 21,192, 28, 12,172, 64, 13,151,128, 61,203,205,185,117,163,  1,  1,  0, 51, 39,223,191,
-248, 94,177, 64,104,122, 76, 63,211,217, 16,121,103, 16,  1,  0, 72,208, 28, 61, 91, 13,187, 64, 64,215,245, 62,146,  0,164,127,
-121,  9,  1,  0, 45, 93,142, 64, 70,137, 14, 64,147,202, 70,192, 20, 97,115, 49,210,188,  1,  0,106, 23,173, 64,157,131,182, 63,
-175,176,225,191,246,117,  6, 32,  7,218,  1,  0, 78,203,128, 64,124, 14, 69, 64, 55,  0, 61,192,146, 88,138, 66,228,191,  1,  0,
-133,175,133, 64, 28,149,121, 64, 51,212,168,191,229, 91,100, 84,110,227,  1,  0,  8,211,149, 64, 84,166, 94, 64, 68, 24, 29,191,
-  3,102,242, 75,149,241,  1,  0, 31,169,175, 64,138,176,237, 63, 15,168,103,191,147,119,172, 40, 64,235,  1,  0,122, 78, 57, 64,
-224, 12,120,192,  7, 56, 84,192, 22, 64,197,171,  7,184,  1,  0,  0, 74, 48, 64,245,165,155,192,208, 87,227,191,  5, 61, 71,150,
-132,217,  1,  0, 85,108,100, 64,115, 47, 76,192,149,224, 88,192,154, 77,133,185,145,182,  1,  0,173,191,150, 64,227,233, 55,192,
-198,101,254,191,111,102,105,192, 10,213,  1,  0,119, 97,148, 64,200, 33, 89,192, 24,225,150,191,243,100,255,181, 68,229,  1,  0,
- 75,171, 86, 64, 36, 83,150,192, 22, 36,133,191, 14, 73,157,153, 72,232,  1,  0,116,251, 81,192,115, 80,139,192, 57,124, 10,192,
- 26,185, 78,160, 31,209,  1,  0, 70,239,122,192, 53,220,138,192,113, 86,227,190, 47,171,157,160,134,246,  1,  0, 14, 50, 28,192,
-245,  4,153,192,141, 39, 23,192,247,201,182,151, 38,205,  1,  0, 34,123,189,191,203,168,178,192,149,106,130,191,217,222, 73,134,
- 91,234,  1,  0,176,127,232,191,177,107,178,192, 47,189,236,189, 27,216,111,134,122,252,  1,  0, 53,168, 90,192,169, 83,152,192,
-227,201,133, 62, 78,181, 43,152,172,  4,  1,  0,173,191,150,192,227,233, 55, 64,198,101,254, 63,145,153,151, 63,246, 42,  1,  0,
- 85,108,100,192,115, 47, 76, 64,149,224, 88, 64,102,178,123, 70,111, 73,  1,  0,119, 97,148,192,200, 33, 89, 64, 24,225,150, 63,
- 13,155,  1, 74,188, 26,  1,  0, 75,171, 86,192, 36, 83,150, 64, 22, 36,133, 63,242,182, 99,102,184, 23,  1,  0,  0, 74, 48,192,
-245,165,155, 64,208, 87,227, 63,251,194,185,105,124, 38,  1,  0,122, 78, 57,192,224, 12,120, 64,  7, 56, 84, 64,234,191, 59, 84,
-249, 71,  1,  0, 34,123,189, 63,203,168,178, 64,149,106,130, 63, 39, 33,183,121,165, 21,  1,  0, 14, 50, 28, 64,245,  4,153, 64,
-141, 39, 23, 64,  9, 54, 74,104,218, 50,  1,  0,176,127,232, 63,177,107,178, 64, 47,189,236, 61,229, 39,145,121,134,  3,  1,  0,
- 53,168, 90, 64,169, 83,152, 64,227,201,133,190,178, 74,213,103, 84,251,  1,  0, 70,239,122, 64, 53,220,138, 64,113, 86,227, 62,
-209, 84, 99, 95,122,  9,  1,  0,116,251, 81, 64,115, 80,139, 64, 57,124, 10, 64,230, 70,178, 95,225, 46,  1,  0,117,224,186, 64,
- 37,234,247, 62,147, 56,126,190,126,127,167,  9, 22,250,  1,  0, 10, 94,182, 64, 48,  5,  1,191, 86, 81,165, 63,109,124, 42,244,
-146, 27,  1,  0,204, 78,184, 64, 19,193, 89, 61,187,163,141,191,226,125,  1,  1,221,232,  1,  0,105,232,174, 64,151,187,224,191,
-156,183,153,191,126,119,171,217,208,230,  1,  0, 45,138,172, 64,114,149, 17,192,127,203,200,190,  2,118, 65,207, 10,247,  1,  0,
- 41,110,177, 64, 81, 30,186,191,105,249,158, 63, 85,121, 27,225,147, 26,  1,  0,251,244, 21, 64, 28, 12,172,192, 13,151,128,189,
- 53, 50, 71,138, 93,254,  1,  0,113,  2,218, 63,172,151,171,192,114, 25,212, 63, 74, 36,150,138,195, 35,  1,  0, 51, 39,223, 63,
-248, 94,177,192,104,122, 76,191, 45, 38,240,134,153,239,  1,  0, 72,208, 28,189, 91, 13,187,192, 64,215,245,190,110,255, 92,128,
-135,246,  1,  0, 81,172,191,190, 67,208,186,192,195,163,216, 62,176,248,130,128,166,  8,  1,  0, 42,118, 68, 63,101,173,176,192,
-114,132,233, 63,132, 17,102,135, 31, 39,  1,  0,133,175,133,192, 28,149,121,192, 51,212,168, 63, 27,164,156,171,146, 28,  1,  0,
- 78,203,128,192,124, 14, 69,192, 55,  0, 61, 64,110,167,118,189, 28, 64,  1,  0, 31,169,175,192,138,176,237,191, 15,168,103, 63,
-109,136, 84,215,192, 20,  1,  0,  8,211,149,192, 84,166, 94,192, 68, 24, 29, 63,253,153, 14,180,107, 14,  1,  0,106, 23,173,192,
-157,131,182,191,175,176,225, 63, 10,138,250,223,249, 37,  1,  0, 45, 93,142,192, 70,137, 14,192,147,202, 70, 64,236,158,141,206,
- 46, 67,  1,  0,185,  2,  5,192,217,105, 76, 64,135,173,142, 64, 97,210,211, 68,203, 97,  1,  0, 97,116,196,190, 10,176, 56, 64,
-120,239,162, 64, 59,247, 31, 62,144,111,  1,  0,142, 32, 48,192,155,140, 32, 64,195,  1,145, 64,220,196, 19, 55, 65, 99,  1,  0,
-231,195, 21,192,236, 58,101, 63,218,178,169, 64,210,205,254, 19,  9,116,  1,  0, 70,155,185,191, 12,202, 59, 63,163, 86,180, 64,
-173,223,190, 16,181,122,  1,  0, 29, 97, 43,190,144,118,  2, 64,125,231,175, 64,147,251, 31, 45,178,119,  1,  0,195, 78, 74, 64,
-241,206, 96, 64, 98, 88, 94, 64, 49, 68,178, 76,125, 76,  1,  0, 12,171,100, 64,249, 33,243, 63,106,221,135, 64, 38, 77,157, 41,
- 69, 93,  1,  0,147,133, 20, 64,234, 55,124, 64,176,  3,107, 64, 84, 51, 74, 85,117, 80,  1,  0,164,243,144, 63,252, 41, 73, 64,
-148, 66,154, 64,124, 25,240, 67,112,105,  1,  0, 52,164,172, 63,106,240, 18, 64,141, 58,167, 64,212, 29,241, 50,146,113,  1,  0,
- 42,186, 60, 64,219,128,189, 63, 23, 43,155, 64,160, 64, 53, 33, 95,105,  1,  0,101,  1,160, 64, 47,146,184,191,153, 38, 45, 64,
-  7,109, 96,225,165, 59,  1,  0,246,246,115, 64,183, 86, 15,192, 51,168,118, 64, 48, 83,  7,208,159, 84,  1,  0, 70,241,164, 64,
-102,218,251,190,143, 82, 48, 64, 32,112,112,244,163, 60,  1,  0,192, 81,136, 64, 55,239,  4, 63, 24,222,127, 64,172, 92,109, 10,
-171, 87,  1,  0,151,178,104, 64,245,107,205, 61,175, 60,147, 64, 38, 80,  5,  2,198, 99,  1,  0,215,229, 85, 64,166,178,218,191,
-183, 55,144, 64,195, 73,175,218,184, 97,  1,  0,188,194,101, 63, 17, 84,154,192,240,193, 77, 64,116, 20, 45,151,139, 70,  1,  0,
- 19, 46, 71, 59,194,240,115,192,175,166,142, 64,  0,  1, 43,173,146, 97,  1,  0, 82,168,234, 63, 87, 62,149,192,118, 12, 67, 64,
- 59, 39, 94,154, 47, 67,  1,  0,208, 27, 46, 64,124,104, 86,192, 85, 52,126, 64,134, 58,240,182, 73, 87,  1,  0,186, 10, 16, 64,
-249,106, 52,192,210,253,147, 64, 25, 49,152,193, 98,100,  1,  0, 93, 33,240, 62,191,199, 71,192,142, 47,158, 64, 90, 10,  3,187,
- 80,107,  1,  0,103,139, 94,192,153,146,250,191, 72,141,137, 64,224,180,165,212, 31, 94,  1,  0,107,195, 37,192,  4,213, 36,191,
- 20, 33,167, 64, 44,200, 55,241, 57,114,  1,  0,158,103, 67,192, 82,206, 51,192, 39,168,132, 64, 98,189,141,195, 13, 91,  1,  0,
-209,230,173,191,231,135, 71,192, 27,234,152, 64, 61,226,217,188,210,104,  1,  0, 77,154,217,191,185, 69, 78,191,221,196,177, 64,
-  7,218,247,237,229,120,  1,  0,136,131,100,191, 16, 95, 27,192,  4,115,168, 64,150,235,177,202,143,114,  1,  0,139,220, 37,192,
-245,135,141, 64,114,173, 54,192, 49,199, 96, 96,209,193,  1,  0,204,119, 84,192, 93, 73,130, 64,212,107, 38,192, 46,183,222, 88,
-151,199,  1,  0,208, 76, 67,192, 62,120,111, 64, 14, 89, 85,192, 82,189,194, 81,136,183,  1,  0, 68,147,238,191,166,230,100, 64,
-234,  9,136,192,206,215,123, 78, 57,163,  1,  0, 30,149,109,191, 40, 18,111, 64,171,100,141,192, 48,235,197, 81,194,159,  1,  0,
-144,237,178,191, 25,136,136, 64,121,  1,113,192,117,225,197, 92, 71,173,  1,  0,214, 82, 66, 63,128,115,152, 64,164, 25, 85,192,
-  1, 17, 31,104,135,183,  1,  0,119,155,171,189,138, 40,155, 64,113, 96, 83,192,123,254,195,105,238,183,  1,  0, 67,138,194, 62,
-177, 97,138, 64, 75,158,124,192,109,  8,131, 94, 26,170,  1,  0,158,106, 94,191,167,106, 30, 64,254,240,167,192,230,236,191, 53,
-107,141,  1,  0, 22,114,229,191,193, 96, 20, 64,253,167,162,192, 20,217, 97, 50,247,144,  1,  0, 45,210,162,191,233,211,224, 63,
-184, 67,174,192, 71,228,227, 37,237,136,  1,  0, 37, 61,152,192,230,  9, 14, 64,137,179, 39,192, 84,152,178, 48,225,198,  1,  0,
-232,187,140,192,  6, 96, 62, 64,107,247, 30,192,  9,160, 82, 65, 23,202,  1,  0,116,134,132,192, 40,130, 40, 64,237,207, 77,192,
-140,165,146, 57, 26,186,  1,  0, 12,129,129,192,231,129,173, 63,159,125,128,192, 68,167, 25, 29,120,168,  1,  0,254,112,134,192,
-126,146,207, 62,159, 19,130,192, 18,164,108,  9,113,167,  1,  0,189,121,149,192,142,192,111, 63, 76, 95, 90,192, 88,154,108, 20,
-246,180,  1,  0, 12, 65,162,192, 11, 84,149,191,172,202, 44,192, 58,145, 32,230, 85,197,  1,  0, 74,120,165,192, 95, 78,167,190,
-139, 51, 48,192, 54,143,145,248,243,195,  1,  0, 61,161,150,192,107,221, 89,191,118,113, 89,192, 42,153, 81,237, 31,182,  1,  0,
- 52, 56, 66,192,206, 40,139, 62, 21,116,160,192,  9,190, 18,  6,123,146,  1,  0,245,120, 56,192,118,213,154, 63, 81,227,158,192,
- 78,193, 49, 26,136,147,  1,  0,220,104, 22,192,204,221, 40, 63,115,137,170,192, 33,205, 87, 14,110,139,  1,  0,145,143, 39, 64,
-190, 49, 94, 64,165, 27,124,192,240, 56,248, 75, 41,170,  1,  0,130,168,  6, 64,190,132,130, 64, 12, 96,105,192,224, 45,104, 89,
-186,176,  1,  0, 76,169,222, 63,205,107,104, 64,150,142,136,192, 22, 38,102, 79, 30,163,  1,  0,137,207,229, 63, 30, 63, 22, 64,
-207,235,161,192,188, 39,234, 50,127,145,  1,  0,239, 11, 14, 64,175,114,191, 63,254,208,166,192,132, 48, 69, 33, 84,142,  1,  0,
-239,222, 43, 64,212,226, 11, 64,227, 71,151,192, 42, 58,144, 47, 97,152,  1,  0,  0,245,124, 64, 27, 32,187, 62, 57,  6,138,192,
-148, 86,163,  7, 11,162,  1,  0, 42, 75,112, 64,228, 42,152, 63, 25, 44,139,192,254, 81,163, 25, 31,161,  1,  0,178,218, 82, 64,
-178,247,  1, 63,211,129,154,192, 31, 72,  6, 11,214,150,  1,  0,208,203,104, 63,146,  6,113, 63,108,  5,183,192,137, 19,150, 20,
- 49,131,  1,  0, 26, 68,251, 62,111, 38,228, 63,114, 48,178,192,142, 10,162, 38,111,134,  1,  0,163, 78,149, 61, 65, 25,137, 63,
-234,102,184,192, 37,  1, 44, 23, 32,130,  1,  0, 98,140, 80, 64,169,205,238,191, 83, 69,144,192, 67, 71,141,215,172,157,  1,  0,
-177, 39,109, 64,155,213,147,191,238,143,140,192, 71, 81,255,230, 87,160,  1,  0,100,225, 66, 64,146,191,131,191,152, 18,157,192,
-173, 66,128,233, 23,149,  1,  0,190, 24,220, 63,163,163,202,191,160,244,171,192,102, 37,211,220,194,138,  1,  0,227,219,133, 63,
-172, 47, 17,192, 93,160,169,192,115, 23,161,206, 68,140,  1,  0, 46,202,247, 63, 23,140, 27,192,116,252,158,192,225, 41, 71,203,
- 38,147,  1,  0, 36,220, 68, 63, 24,143,132,192, 20,105,130,192,156, 16, 53,165, 84,167,  1,  0, 60,255,185, 63,215,244,108,192,
-129,  7,138,192,117, 31, 15,175,249,161,  1,  0,220, 18, 19, 63,168,186, 98,192, 66,136,148,192,154, 12,125,178,238,154,  1,  0,
-131,119,172,187,182,209,162,191,170, 73,183,192,211,255,140,228,252,130,  1,  0,165,230, 40, 63,246,111, 24,191, 50,150,185,192,
- 24, 14, 16,243,114,129,  1,  0,123, 45, 50,190,213, 16,230,190,160,240,186,192,217,251,137,246,109,128,  1,  0,221, 22,199,191,
- 71,211,134,192, 37,161,113,192, 93,222,  1,164,157,173,  1,  0,171,131, 58,191, 57,178,140,192,214,174,115,192,120,240,191,159,
- 19,173,  1,  0,228,119,112,191, 49, 46,115,192,186,222,139,192,149,235,225,172,214,160,  1,  0,122, 75,254,191, 18, 36, 50,192,
- 84, 70,152,192,  8,212, 46,195, 82,152,  1,  0,190,239, 52,192,193,186, 22,192,166,240,145,192,160,194, 13,204,107,156,  1,  0,
- 51, 23, 39,192, 14,245, 76,192,105,248,132,192, 27,199,129,186,208,164,  1,  0,202,137,140,192,  4,234, 33,192,152,117, 60,192,
-203,159,220,200, 20,192,  1,  0, 68,176,115,192, 85, 49, 68,192, 65,173, 79,192,182,172, 79,189, 79,185,  1,  0,131,173,128,192,
- 50,170, 14,192,247, 71,105,192, 33,168, 65,207,185,176,  1,  0,230, 80, 22,192, 50,155,141,191,108, 95,168,192,  0,205,  3,232,
- 21,141,  1,  0, 96,113,194,191,166,184,195,191, 31,160,174,192,205,222,240,222,228,136,  1,  0,249,244,213,191, 10, 33, 52,191,
-248, 94,178,192,179,219, 20,241, 44,134,  1,  0, 30, 26,167,192, 62, 11, 42, 64,199,163,159,190, 43,142, 23, 58,240,248,  1,  0,
- 15,242,157,192,177, 35, 63, 64,242,230,132,191,125,148,148, 65, 31,233,  1,  0, 58,163,169,192,184,207, 14, 64, 43, 92,148,191,
-120,140,246, 48,193,230,  1,  0,241, 83,184,192, 33,241,117, 63,204, 69,248,190, 33,130,245, 20, 10,246,  1,  0, 88,178,186,192,
-180, 33,226, 62, 69,211,165, 62,152,128, 54, 10,201,  6,  1,  0,100,194,181,192,227, 37,178, 63, 65, 51,191, 62,202,131,227, 29,
-208,  7,  1,  0,140, 68,168,192,162,100, 57, 63, 90, 41, 31, 64, 98,141,193, 15,192, 54,  1,  0,185,114,173,192,147, 11,162, 63,
-136,131,237, 63,203,137,109, 27,183, 40,  1,  0, 90, 82,178,192,181,  0,168, 62,125, 64,231, 63,135,134, 77,  7,170, 39,  1,  0,
-235, 52,185,192,191,185, 83,191, 39,176,252,190,201,129,214,237,245,244,  1,  0, 95,222,182,192,178, 32,161,190, 48, 92,165,191,
- 90,131,213,248,212,227,  1,  0, 52,119,179,192,223,204,147,191,116,141,160,191,174,133, 97,230, 93,228,  1,  0,109, 88, 35, 63,
-129,186,182, 64,207,  8,152,191,  3, 14,128,124,207,229,  1,  0,226, 54, 99, 63,172,134,174, 64, 96, 98,250,191,195, 19,238,118,
-  3,213,  1,  0,150,195, 60, 61, 46,121,177, 64,174,  6,245,191, 79,  1,250,120, 56,214,  1,  0,228,160,145,191,121, 59,181, 64,
-246,252,123,191, 62,231,212,123, 30,235,  1,  0, 29,166,188,191,167,120,181, 64,  4,224,165,189, 72,224,251,123,211,253,  1,  0,
- 26,186,  9,191,104,142,186, 64,128, 74,126,190,169,243, 70,127, 92,250,  1,  0,179,205, 19,191, 33,145,175, 64,102,151,253, 63,
-129,243,165,119,184, 43,  1,  0,163,114,134,190, 81, 94,183, 64, 73,210,157, 63, 41,250,241,124, 44, 27,  1,  0,253,217,151,191,
- 90, 89,178, 64,210,246,178, 63, 86,230,147,121,183, 30,  1,  0,107,200, 50,192,  4, 21,164, 64,143,252, 18,191,232,194,191,111,
- 61,243,  1,  0,219,140, 29,192,164,216,163, 64,163,160,187,191,  6,202,150,111, 27,224,  1,  0,  8, 63, 76,192,149, 92,152, 64,
-201,  6,157,191,240,185,173,103, 19,229,  1,  0,102, 31,167, 64, 18,113,133, 63,122,150, 29,192,215,113,152, 22,  9,202,  1,  0,
-115, 48,157, 64, 74,183, 33, 63, 21,172, 72,192, 47,107, 89, 13, 84,187,  1,  0,250, 48,151, 64,117,157,186, 63,236, 37, 74,192,
- 40,103,131, 31, 24,187,  1,  0,118, 31,148, 64,144, 99, 46, 64, 95,237, 21,192, 96,101,140, 59,104,205,  1,  0, 40,177,150, 64,
-101,250, 73, 64,104,252,189,191,  9,103,121, 68, 46,223,  1,  0, 59, 67,164, 64,106,116, 19, 64, 96,145,209,191,209,111,213, 50,
-  3,220,  1,  0,  9, 99,168, 64,184,173, 32, 64,129, 16, 27, 63,227,114,186, 54,183, 13,  1,  0,225,  1,174, 64, 65,167, 12, 64,
-199,  1, 38,190,149,118, 16, 48,190,252,  1,  0,172,156,160, 64, 23,121, 66, 64,220,253, 53,188,154,109, 28, 66,252,255,  1,  0,
-230,184,106, 64,117, 83,133, 64, 76, 95,243,191,205, 79,249, 90, 80,214,  1,  0,116,166,101, 64, 67,107,111, 64, 69,233, 47,192,
- 26, 78,215, 81, 33,196,  1,  0,109, 20, 68, 64,202,  9,139, 64,124,255, 29,192,122, 66, 31, 95,  3,202,  1,  0, 46,138, 12, 64,
-195,168,156,192, 99,240, 23,192,176, 47, 54,149,255,203,  1,  0,110,189,201, 63, 48, 28,154,192,180,148, 60,192,240, 33,192,150,
-143,191,  1,  0, 21, 55, 17, 64,125, 67,140,192,118,  8, 75,192, 65, 49, 53,160,221,186,  1,  0, 85,126,100, 64,103,211,114,192,
-187,176, 43,192, 56, 78,244,172,248,197,  1,  0, 29,112,133, 64,168, 45,104,192, 95, 44,249,191,163, 90,102,176, 54,213,  1,  0,
-192,193, 95, 64,221,  5,138,192, 42,219,239,191,175, 76, 53,162,183,214,  1,  0, 28, 21,134, 64,185,231,130,192,175,210,133, 62,
-129, 91,184,166, 51,  6,  1,  0,128,101,115, 64,106,100,142,192,214,174,205,190, 30, 83, 11,159,122,247,  1,  0,187,250,142, 64,
-178,123,113,192, 90,120,242,190, 99, 97,143,173,240,245,  1,  0,115, 83,149, 64, 25,118, 24,192, 96,  5, 41,192,195,101, 58,204,
- 39,198,  1,  0,236, 97,130, 64,181,248, 34,192, 49,132, 87,192, 15, 89,179,200,144,182,  1,  0,186,103,144, 64, 91,  9,234,191,
-150,226, 80,192,155, 98,138,216,146,184,  1,  0,208, 74,136,192,231,117,121,192, 32,193,133,191,251,162, 38,171,252,232,  1,  0,
- 31, 84,144,192, 24, 19, 87,192, 53, 65,211,191, 64,157,  8,183,220,219,  1,  0,  7, 90,123,192,107,238,121,192,115,227,247,191,
- 25,170,254,170,217,213,  1,  0,161,112, 54,192, 94, 77,156,192,207,107,196,191,198,193, 27,149, 21,223,  1,  0, 24, 41, 22,192,
-  1,197,169,192,191, 68, 84,191, 56,204,100,140,176,237,  1,  0, 73,243, 75,192, 86, 16,156,192,180,150, 33,191,208,186, 67,149,
-202,241,  1,  0,140,246, 19,192,148, 60,166,192, 11, 70,182, 63,170,205,162,142,144, 31,  1,  0, 17, 21, 58,192,224,209,160,192,
-103,100, 88, 63,199,192, 73,146,167, 18,  1,  0,151,252,  4,192, 71, 89,174,192,215, 93, 38, 63,148,210, 55,137,117, 14,  1,  0,
- 53,176,150,191,238,252,174,192, 37,172,226,191,112,230,198,136, 24,217,  1,  0,225,105,214,191,211,177,161,192,160,229, 29,192,
-193,219,176,145, 39,202,  1,  0, 62,213, 88,191,193, 70,167,192,212,217, 32,192,237,237,235,141,220,200,  1,  0,236, 97,130,192,
-181,248, 34, 64, 49,132, 87, 64,241,166, 77, 55,112, 73,  1,  0,186,103,144,192, 91,  9,234, 63,150,226, 80, 64,101,157,118, 39,
-110, 71,  1,  0,115, 83,149,192, 25,118, 24, 64, 96,  5, 41, 64, 61,154,198, 51,217, 57,  1,  0, 29,112,133,192,168, 45,104, 64,
- 95, 44,249, 63, 93,165,154, 79,202, 42,  1,  0,192,193, 95,192,221,  5,138, 64, 42,219,239, 63, 81,179,203, 93, 73, 41,  1,  0,
- 85,126,100,192,103,211,114, 64,187,176, 43, 64,200,177, 12, 83,  8, 58,  1,  0,110,189,201,191, 48, 28,154, 64,180,148, 60, 64,
- 16,222, 64,105,113, 64,  1,  0, 21, 55, 17,192,125, 67,140, 64,118,  8, 75, 64,191,206,203, 95, 35, 69,  1,  0, 46,138, 12,192,
-195,168,156, 64, 99,240, 23, 64, 80,208,202,106,  1, 52,  1,  0,128,101,115,192,106,100,142, 64,214,174,205, 62,226,172,245, 96,
-134,  8,  1,  0,187,250,142,192,178,123,113, 64, 90,120,242, 62,157,158,113, 82, 16, 10,  1,  0, 28, 21,134,192,185,231,130, 64,
-175,210,133,190,127,164, 72, 89,205,249,  1,  0,225,105,214, 63,211,177,161, 64,160,229, 29, 64, 63, 36, 80,110,217, 53,  1,  0,
- 62,213, 88, 63,193, 70,167, 64,212,217, 32, 64, 19, 18, 21,114, 36, 55,  1,  0, 53,176,150, 63,238,252,174, 64, 37,172,226, 63,
-144, 25, 58,119,232, 38,  1,  0, 24, 41, 22, 64,  1,197,169, 64,191, 68, 84, 63,200, 51,156,115, 80, 18,  1,  0, 73,243, 75, 64,
- 86, 16,156, 64,180,150, 33, 63, 48, 69,189,106, 54, 14,  1,  0,161,112, 54, 64, 94, 77,156, 64,208,107,196, 63, 58, 62,229,106,
-235, 32,  1,  0, 31, 84,144, 64, 24, 19, 87, 64, 53, 65,211, 63,192, 98,248, 72, 36, 36,  1,  0,  7, 90,123, 64,107,238,121, 64,
-115,227,247, 63,231, 85,  2, 85, 39, 42,  1,  0,208, 74,136, 64,231,117,121, 64, 32,193,133, 63,  5, 93,218, 84,  4, 23,  1,  0,
- 17, 21, 58, 64,224,209,160, 64,103,100, 88,191, 57, 63,183,109, 89,237,  1,  0,151,252,  4, 64, 71, 89,174, 64,215, 93, 38,191,
-108, 45,201,118,139,241,  1,  0,140,246, 19, 64,148, 60,166, 64, 11, 70,182,191, 86, 50, 94,113,112,224,  1,  0, 95,222,182, 64,
-178, 32,161, 62, 48, 92,165, 63,166,124, 43,  7, 44, 28,  1,  0, 52,119,179, 64,223,204,147, 63,116,141,160, 63, 82,122,159, 25,
-163, 27,  1,  0,235, 52,185, 64,191,185, 83, 63, 39,176,252, 62, 55,126, 42, 18, 11, 11,  1,  0, 88,178,186, 64,180, 33,226,190,
- 69,211,165,190,104,127,202,245, 55,249,  1,  0,100,194,181, 64,227, 37,178,191, 65, 51,191,190, 54,124, 29,226, 48,248,  1,  0,
-241, 83,184, 64, 33,241,117,191,204, 69,248, 62,223,125, 11,235,246,  9,  1,  0, 15,242,157, 64,177, 35, 63,192,242,230,132, 63,
-131,107,108,190,225, 22,  1,  0, 58,163,169, 64,184,207, 14,192, 43, 92,148, 63,136,115, 10,207, 63, 25,  1,  0, 30, 26,167, 64,
- 62, 11, 42,192,199,163,159, 62,213,113,233,197, 16,  7,  1,  0,185,114,173, 64,147, 11,162,191,136,131,237,191, 53,118,147,228,
- 73,215,  1,  0, 90, 82,178, 64,181,  0,168,190,125, 64,231,191,121,121,179,248, 86,216,  1,  0,140, 68,168, 64,162,100, 57,191,
- 90, 41, 31,192,158,114, 63,240, 64,201,  1,  0,219,140, 29, 64,164,216,163,192,163,160,187, 63,250, 53,106,144,229, 31,  1,  0,
-  8, 63, 76, 64,149, 92,152,192,201,  6,157, 63, 16, 70, 83,152,237, 26,  1,  0,107,200, 50, 64,  4, 21,164,192,143,252, 18, 63,
- 24, 61, 65,144,195, 12,  1,  0, 29,166,188, 63,167,120,181,192,  4,224,165, 61,184, 31,  5,132, 45,  2,  1,  0, 26,186,  9, 63,
-104,142,186,192,128, 74,126, 62, 87, 12,186,128,164,  5,  1,  0,228,160,145, 63,121, 59,181,192,246,252,123, 63,194, 24, 44,132,
-226, 20,  1,  0,226, 54, 99,191,172,134,174,192, 96, 98,250, 63, 61,236, 18,137,253, 42,  1,  0,150,195, 60,189, 46,121,177,192,
-174,  6,245, 63,177,254,  6,135,200, 41,  1,  0,109, 88, 35,191,129,186,182,192,207,  8,152, 63,253,241,128,131, 49, 26,  1,  0,
-163,114,134, 62, 81, 94,183,192, 73,210,157,191,215,  5, 15,131,212,228,  1,  0,253,217,151, 63, 90, 89,178,192,210,246,178,191,
-170, 25,109,134, 73,225,  1,  0,179,205, 19, 63, 33,145,175,192,102,151,253,191,127, 12, 91,136, 72,212,  1,  0,116,166,101,192,
- 67,107,111,192, 69,233, 47, 64,230,177, 41,174,223, 59,  1,  0,109, 20, 68,192,202,  9,139,192,124,255, 29, 64,134,189,225,160,
-253, 53,  1,  0,230,184,106,192,117, 83,133,192, 76, 95,243, 63, 51,176,  7,165,176, 41,  1,  0, 40,177,150,192,101,250, 73,192,
-104,252,189, 63,247,152,135,187,210, 32,  1,  0, 59, 67,164,192,106,116, 19,192, 96,145,209, 63, 47,144, 43,205,253, 35,  1,  0,
-118, 31,148,192,144, 99, 46,192, 95,237, 21, 64,160,154,116,196,152, 50,  1,  0,115, 48,157,192, 74,183, 33,191, 21,172, 72, 64,
-209,148,167,242,172, 68,  1,  0,250, 48,151,192,117,157,186,191,236, 37, 74, 64,216,152,125,224,232, 68,  1,  0,102, 31,167,192,
- 18,113,133,191,122,150, 29, 64, 41,142,104,233,247, 53,  1,  0,225,  1,174,192, 65,167, 12,192,199,  1, 38, 62,107,137,240,207,
- 66,  3,  1,  0,172,156,160,192, 23,121, 66,192,220,253, 53, 60,102,146,228,189,  4,  0,  1,  0,  9, 99,168,192,184,173, 32,192,
-129, 16, 27,191, 29,141, 70,201, 73,242,  1,  0,220, 18, 19,191,168,186, 98, 64, 66,136,148, 64,102,243,131, 77, 18,101,  1,  0,
- 36,220, 68,191, 24,143,132, 64, 20,105,130, 64,100,239,203, 90,172, 88,  1,  0, 60,255,185,191,215,244,108, 64,129,  7,138, 64,
-139,224,241, 80,  7, 94,  1,  0, 46,202,247,191, 23,140, 27, 64,116,252,158, 64, 31,214,185, 52,218,108,  1,  0,190, 24,220,191,
-163,163,202, 63,160,244,171, 64,154,218, 45, 35, 62,117,  1,  0,227,219,133,191,172, 47, 17, 64, 93,160,169, 64,141,232, 95, 49,
-188,115,  1,  0,123, 45, 50, 62,213, 16,230, 62,160,240,186, 64, 39,  4,119,  9,147,127,  1,  0,131,119,172, 59,182,209,162, 63,
-170, 73,183, 64, 45,  0,116, 27,  4,125,  1,  0,165,230, 40,191,246,111, 24, 63, 50,150,185, 64,232,241,240, 12,142,126,  1,  0,
-100,225, 66,192,146,191,131, 63,152, 18,157, 64, 83,189,128, 22,233,106,  1,  0, 98,140, 80,192,169,205,238, 63, 83, 69,144, 64,
-189,184,115, 40, 84, 98,  1,  0,177, 39,109,192,154,213,147, 63,239,143,140, 64,185,174,  1, 25,169, 95,  1,  0,131,173,128, 64,
- 50,170, 14, 64,247, 71,105, 64,223, 87,191, 48, 71, 79,  1,  0,202,137,140, 64,  4,234, 33, 64,152,117, 60, 64, 53, 96, 36, 55,
-236, 63,  1,  0, 68,176,115, 64, 85, 49, 68, 64, 65,173, 79, 64, 74, 83,177, 66,177, 70,  1,  0, 51, 23, 39, 64, 14,245, 76, 64,
-105,248,132, 64,229, 56,127, 69, 48, 91,  1,  0,122, 75,254, 63, 17, 36, 50, 64, 83, 70,152, 64,248, 43,210, 60,174,103,  1,  0,
-190,239, 52, 64,193,186, 22, 64,166,240,145, 64, 96, 61,243, 51,149, 99,  1,  0,249,244,213, 63, 10, 33, 52, 63,248, 94,178, 64,
- 77, 36,236, 14,212,121,  1,  0,230, 80, 22, 64, 50,155,141, 63,108, 95,168, 64,  0, 51,253, 23,235,114,  1,  0, 96,113,194, 63,
-166,184,195, 63, 31,160,174, 64, 51, 33, 16, 33, 28,119,  1,  0,228,119,112, 63, 49, 46,115, 64,186,222,139, 64,107, 20, 31, 83,
- 42, 95,  1,  0,221, 22,199, 63, 71,211,134, 64, 37,161,113, 64,163, 33,255, 91, 99, 82,  1,  0,170,131, 58, 63, 58,178,140, 64,
-213,174,115, 64,136, 15, 65, 96,237, 82,  1,  0,116,134,132, 64, 40,130, 40,192,237,207, 77, 64,116, 90,110,198,230, 69,  1,  0,
-232,187,140, 64,  6, 96, 62,192,107,247, 30, 64,247, 95,174,190,233, 53,  1,  0, 37, 61,152, 64,230,  9, 14,192,137,179, 39, 64,
-172,103, 78,207, 31, 57,  1,  0,189,121,149, 64,142,192,111,191, 76, 95, 90, 64,168,101,148,235, 10, 75,  1,  0,254,112,134, 64,
-126,146,207,190,159, 19,130, 64,238, 91,148,246,143, 88,  1,  0, 12,129,129, 64,231,129,173,191,159,125,128, 64,188, 88,231,226,
-136, 87,  1,  0,220,104, 22, 64,204,221, 40,191,115,137,170, 64,223, 50,169,241,146,116,  1,  0,245,120, 56, 64,118,213,154,191,
- 81,227,158, 64,178, 62,207,229,120,108,  1,  0, 52, 56, 66, 64,206, 40,139,190, 21,116,160, 64,247, 65,238,249,133,109,  1,  0,
- 61,161,150, 64,107,221, 89, 63,118,113, 89, 64,214,102,175, 18,225, 73,  1,  0, 74,120,165, 64, 95, 78,167, 62,139, 51, 48, 64,
-202,112,111,  7, 13, 60,  1,  0, 12, 65,162, 64, 11, 84,149, 63,172,202, 44, 64,198,110,224, 25,171, 58,  1,  0, 67,138,194,190,
-177, 97,138,192, 75,158,124, 64,147,247,125,161,230, 85,  1,  0,214, 82, 66,191,128,115,152,192,164, 25, 85, 64,255,238,225,151,
-121, 72,  1,  0,119,155,171, 61,138, 40,155,192,113, 96, 83, 64,133,  1, 61,150, 18, 72,  1,  0,144,237,178, 63, 25,136,136,192,
-121,  1,113, 64,139, 30, 59,163,185, 82,  1,  0, 68,147,238, 63,166,230,100,192,234,  9,136, 64, 50, 40,133,177,199, 92,  1,  0,
- 30,149,109, 63, 40, 18,111,192,171,100,141, 64,208, 20, 59,174, 62, 96,  1,  0, 45,210,162, 63,233,211,224,191,184, 67,174, 64,
-185, 27, 29,218, 19,119,  1,  0,158,106, 94, 63,167,106, 30,192,254,240,167, 64, 26, 19, 65,202,149,114,  1,  0, 22,114,229, 63,
-193, 96, 20,192,253,167,162, 64,236, 38,159,205,  9,111,  1,  0,208, 76, 67, 64, 62,120,111,192, 14, 89, 85, 64,174, 66, 62,174,
-120, 72,  1,  0,139,220, 37, 64,245,135,141,192,114,173, 54, 64,207, 56,160,159, 47, 62,  1,  0,204,119, 84, 64, 93, 73,130,192,
-212,107, 38, 64,210, 72, 34,167,105, 56,  1,  0,178,218, 82,192,178,247,  1,191,211,129,154, 64,225,183,250,244, 42,105,  1,  0,
-  0,245,124,192, 27, 32,187,190, 57,  6,138, 64,108,169, 93,248,245, 93,  1,  0, 42, 75,112,192,228, 42,152,191, 25, 44,139, 64,
-  2,174, 93,230,225, 94,  1,  0,239,222, 43,192,212,226, 11,192,227, 71,151, 64,214,197,113,208,159,103,  1,  0,137,207,229,191,
- 30, 63, 22,192,207,235,161, 64, 68,216, 22,205,129,110,  1,  0,239, 11, 14,192,175,114,191,191,254,208,166, 64,124,207,187,222,
-172,113,  1,  0,163, 78,149,189, 65, 25,137,191,234,102,184, 64,219,254,212,232,224,125,  1,  0,208,203,104,191,146,  6,113,191,
-108,  5,183, 64,119,236,106,235,207,124,  1,  0, 26, 68,251,190,111, 38,228,191,114, 48,178, 64,114,245, 94,217,145,121,  1,  0,
- 76,169,222,191,205,107,104,192,150,142,136, 64,234,217,154,176,226, 92,  1,  0,145,143, 39,192,190, 49, 94,192,165, 27,124, 64,
- 16,199,  8,180,215, 85,  1,  0,130,168,  6,192,190,132,130,192, 12, 96,105, 64, 32,210,152,166, 70, 79,  1,  0, 68, 65, 84, 65,
-104,  1,  0,  0,184,189, 53,  3,  0,  0,  0,  0, 84,  1,  0,  0,  5,  0,  0,  0,  3,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,104,191, 53,  3,  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,  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,  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,  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, 68, 65, 84, 65, 80,  0,  0,  0,104,129, 27,  4,  0,  0,  0,  0, 56,  0,  0,  0,  4,  0,  0,  0,
+  0,  0,128, 63,255,255,127, 63,  0,  0,  0,  0,  0,  0,  0,  0,254,127,  3,  0,  0,  0,128, 63,  0,  0,128,191,  0,  0,  0,  0,
+  0,  0,  0,  0,255,127,  3,  0,  1,  0,128,191,253,255,127,191,  0,  0,  0,  0,  0,  0,  0,  0,255,127,  3,  0,250,255,127,191,
+  3,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,255,127,  3,  0, 68, 65, 84, 65,  8,  2,  0,  0,136, 15,196,  4,  0,  0,  0,  0,
+124,  1,  0,  0,  5,  0,  0,  0,  3,  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,  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,  8,130, 27,  4,  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,  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, 68, 65, 84, 65,
-  0, 90,  0,  0,104,191, 53,  3,  0,  0,  0,  0, 49,  0,  0,  0,128,  7,  0,  0,  0,  0,  0,  0,162,  0,  0,  0,  0,  0, 35,  0,
- 42,  0,  0,  0,162,  0,  0,  0,  0,  0, 35,  0, 12,  0,  0,  0,163,  0,  0,  0,  0,  0, 35,  0, 42,  0,  0,  0,163,  0,  0,  0,
-  0,  0, 35,  0,  1,  0,  0,  0,164,  0,  0,  0,  0,  0, 35,  0, 43,  0,  0,  0,164,  0,  0,  0,  0,  0, 35,  0, 12,  0,  0,  0,
-165,  0,  0,  0,  0,  0, 35,  0, 43,  0,  0,  0,165,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0,  0,166,  0,  0,  0,  0,  0, 35,  0,
- 44,  0,  0,  0,166,  0,  0,  0,  0,  0, 35,  0, 13,  0,  0,  0,167,  0,  0,  0,  0,  0, 35,  0, 44,  0,  0,  0,167,  0,  0,  0,
-  0,  0, 35,  0,  2,  0,  0,  0,168,  0,  0,  0,  0,  0, 35,  0, 45,  0,  0,  0,168,  0,  0,  0,  0,  0, 35,  0, 13,  0,  0,  0,
-169,  0,  0,  0,  0,  0, 35,  0, 45,  0,  0,  0,169,  0,  0,  0,  0,  0, 35,  0,  1,  0,  0,  0,170,  0,  0,  0,  0,  0, 35,  0,
- 46,  0,  0,  0,170,  0,  0,  0,  0,  0, 35,  0, 14,  0,  0,  0,171,  0,  0,  0,  0,  0, 35,  0, 46,  0,  0,  0,171,  0,  0,  0,
-  0,  0, 35,  0,  2,  0,  0,  0,172,  0,  0,  0,  0,  0, 35,  0, 47,  0,  0,  0,172,  0,  0,  0,  0,  0, 35,  0, 14,  0,  0,  0,
-173,  0,  0,  0,  0,  0, 35,  0, 47,  0,  0,  0,173,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0,  0,174,  0,  0,  0,  0,  0, 35,  0,
- 48,  0,  0,  0,174,  0,  0,  0,  0,  0, 35,  0, 15,  0,  0,  0,175,  0,  0,  0,  0,  0, 35,  0, 48,  0,  0,  0,175,  0,  0,  0,
-  0,  0, 35,  0,  5,  0,  0,  0,176,  0,  0,  0,  0,  0, 35,  0, 49,  0,  0,  0,176,  0,  0,  0,  0,  0, 35,  0, 15,  0,  0,  0,
-177,  0,  0,  0,  0,  0, 35,  0, 49,  0,  0,  0,177,  0,  0,  0,  0,  0, 35,  0,  1,  0,  0,  0,178,  0,  0,  0,  0,  0, 35,  0,
- 50,  0,  0,  0,178,  0,  0,  0,  0,  0, 35,  0, 16,  0,  0,  0,179,  0,  0,  0,  0,  0, 35,  0, 50,  0,  0,  0,179,  0,  0,  0,
-  0,  0, 35,  0,  5,  0,  0,  0,180,  0,  0,  0,  0,  0, 35,  0, 51,  0,  0,  0,180,  0,  0,  0,  0,  0, 35,  0, 16,  0,  0,  0,
-181,  0,  0,  0,  0,  0, 35,  0, 51,  0,  0,  0,181,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0,  0,182,  0,  0,  0,  0,  0, 35,  0,
- 52,  0,  0,  0,182,  0,  0,  0,  0,  0, 35,  0, 17,  0,  0,  0,183,  0,  0,  0,  0,  0, 35,  0, 52,  0,  0,  0,183,  0,  0,  0,
-  0,  0, 35,  0,  3,  0,  0,  0,184,  0,  0,  0,  0,  0, 35,  0, 53,  0,  0,  0,184,  0,  0,  0,  0,  0, 35,  0, 17,  0,  0,  0,
-185,  0,  0,  0,  0,  0, 35,  0, 53,  0,  0,  0,185,  0,  0,  0,  0,  0, 35,  0,  2,  0,  0,  0,186,  0,  0,  0,  0,  0, 35,  0,
- 54,  0,  0,  0,186,  0,  0,  0,  0,  0, 35,  0, 18,  0,  0,  0,187,  0,  0,  0,  0,  0, 35,  0, 54,  0,  0,  0,187,  0,  0,  0,
-  0,  0, 35,  0,  3,  0,  0,  0,188,  0,  0,  0,  0,  0, 35,  0, 55,  0,  0,  0,188,  0,  0,  0,  0,  0, 35,  0, 18,  0,  0,  0,
-189,  0,  0,  0,  0,  0, 35,  0, 55,  0,  0,  0,189,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0,  0,190,  0,  0,  0,  0,  0, 35,  0,
- 56,  0,  0,  0,190,  0,  0,  0,  0,  0, 35,  0, 19,  0,  0,  0,191,  0,  0,  0,  0,  0, 35,  0, 56,  0,  0,  0,191,  0,  0,  0,
-  0,  0, 35,  0,  4,  0,  0,  0,192,  0,  0,  0,  0,  0, 35,  0, 57,  0,  0,  0,192,  0,  0,  0,  0,  0, 35,  0, 19,  0,  0,  0,
-193,  0,  0,  0,  0,  0, 35,  0, 57,  0,  0,  0,193,  0,  0,  0,  0,  0, 35,  0,  3,  0,  0,  0,194,  0,  0,  0,  0,  0, 35,  0,
- 58,  0,  0,  0,194,  0,  0,  0,  0,  0, 35,  0, 20,  0,  0,  0,195,  0,  0,  0,  0,  0, 35,  0, 58,  0,  0,  0,195,  0,  0,  0,
-  0,  0, 35,  0,  4,  0,  0,  0,196,  0,  0,  0,  0,  0, 35,  0, 59,  0,  0,  0,196,  0,  0,  0,  0,  0, 35,  0, 20,  0,  0,  0,
-197,  0,  0,  0,  0,  0, 35,  0, 59,  0,  0,  0,197,  0,  0,  0,  0,  0, 35,  0,  4,  0,  0,  0,198,  0,  0,  0,  0,  0, 35,  0,
- 60,  0,  0,  0,198,  0,  0,  0,  0,  0, 35,  0, 21,  0,  0,  0,199,  0,  0,  0,  0,  0, 35,  0, 60,  0,  0,  0,199,  0,  0,  0,
-  0,  0, 35,  0,  5,  0,  0,  0,200,  0,  0,  0,  0,  0, 35,  0, 61,  0,  0,  0,200,  0,  0,  0,  0,  0, 35,  0, 21,  0,  0,  0,
-201,  0,  0,  0,  0,  0, 35,  0, 61,  0,  0,  0,201,  0,  0,  0,  0,  0, 35,  0,  5,  0,  0,  0,202,  0,  0,  0,  0,  0, 35,  0,
- 62,  0,  0,  0,202,  0,  0,  0,  0,  0, 35,  0, 22,  0,  0,  0,203,  0,  0,  0,  0,  0, 35,  0, 62,  0,  0,  0,203,  0,  0,  0,
-  0,  0, 35,  0, 10,  0,  0,  0,204,  0,  0,  0,  0,  0, 35,  0, 63,  0,  0,  0,204,  0,  0,  0,  0,  0, 35,  0, 22,  0,  0,  0,
-205,  0,  0,  0,  0,  0, 35,  0, 63,  0,  0,  0,205,  0,  0,  0,  0,  0, 35,  0,  1,  0,  0,  0,206,  0,  0,  0,  0,  0, 35,  0,
- 64,  0,  0,  0,206,  0,  0,  0,  0,  0, 35,  0, 23,  0,  0,  0,207,  0,  0,  0,  0,  0, 35,  0, 64,  0,  0,  0,207,  0,  0,  0,
-  0,  0, 35,  0, 10,  0,  0,  0,208,  0,  0,  0,  0,  0, 35,  0, 65,  0,  0,  0,208,  0,  0,  0,  0,  0, 35,  0, 23,  0,  0,  0,
-209,  0,  0,  0,  0,  0, 35,  0, 65,  0,  0,  0,209,  0,  0,  0,  0,  0, 35,  0,  1,  0,  0,  0,210,  0,  0,  0,  0,  0, 35,  0,
- 66,  0,  0,  0,210,  0,  0,  0,  0,  0, 35,  0, 24,  0,  0,  0,211,  0,  0,  0,  0,  0, 35,  0, 66,  0,  0,  0,211,  0,  0,  0,
-  0,  0, 35,  0,  6,  0,  0,  0,212,  0,  0,  0,  0,  0, 35,  0, 67,  0,  0,  0,212,  0,  0,  0,  0,  0, 35,  0, 24,  0,  0,  0,
-213,  0,  0,  0,  0,  0, 35,  0, 67,  0,  0,  0,213,  0,  0,  0,  0,  0, 35,  0,  2,  0,  0,  0,214,  0,  0,  0,  0,  0, 35,  0,
- 68,  0,  0,  0,214,  0,  0,  0,  0,  0, 35,  0, 25,  0,  0,  0,215,  0,  0,  0,  0,  0, 35,  0, 68,  0,  0,  0,215,  0,  0,  0,
-  0,  0, 35,  0,  6,  0,  0,  0,216,  0,  0,  0,  0,  0, 35,  0, 69,  0,  0,  0,216,  0,  0,  0,  0,  0, 35,  0, 25,  0,  0,  0,
-217,  0,  0,  0,  0,  0, 35,  0, 69,  0,  0,  0,217,  0,  0,  0,  0,  0, 35,  0,  2,  0,  0,  0,218,  0,  0,  0,  0,  0, 35,  0,
- 70,  0,  0,  0,218,  0,  0,  0,  0,  0, 35,  0, 26,  0,  0,  0,219,  0,  0,  0,  0,  0, 35,  0, 70,  0,  0,  0,219,  0,  0,  0,
-  0,  0, 35,  0,  7,  0,  0,  0,220,  0,  0,  0,  0,  0, 35,  0, 71,  0,  0,  0,220,  0,  0,  0,  0,  0, 35,  0, 26,  0,  0,  0,
-221,  0,  0,  0,  0,  0, 35,  0, 71,  0,  0,  0,221,  0,  0,  0,  0,  0, 35,  0,  3,  0,  0,  0,222,  0,  0,  0,  0,  0, 35,  0,
- 72,  0,  0,  0,222,  0,  0,  0,  0,  0, 35,  0, 27,  0,  0,  0,223,  0,  0,  0,  0,  0, 35,  0, 72,  0,  0,  0,223,  0,  0,  0,
-  0,  0, 35,  0,  7,  0,  0,  0,224,  0,  0,  0,  0,  0, 35,  0, 73,  0,  0,  0,224,  0,  0,  0,  0,  0, 35,  0, 27,  0,  0,  0,
-225,  0,  0,  0,  0,  0, 35,  0, 73,  0,  0,  0,225,  0,  0,  0,  0,  0, 35,  0,  3,  0,  0,  0,226,  0,  0,  0,  0,  0, 35,  0,
- 74,  0,  0,  0,226,  0,  0,  0,  0,  0, 35,  0, 28,  0,  0,  0,227,  0,  0,  0,  0,  0, 35,  0, 74,  0,  0,  0,227,  0,  0,  0,
-  0,  0, 35,  0,  8,  0,  0,  0,228,  0,  0,  0,  0,  0, 35,  0, 75,  0,  0,  0,228,  0,  0,  0,  0,  0, 35,  0, 28,  0,  0,  0,
-229,  0,  0,  0,  0,  0, 35,  0, 75,  0,  0,  0,229,  0,  0,  0,  0,  0, 35,  0,  4,  0,  0,  0,230,  0,  0,  0,  0,  0, 35,  0,
- 76,  0,  0,  0,230,  0,  0,  0,  0,  0, 35,  0, 29,  0,  0,  0,231,  0,  0,  0,  0,  0, 35,  0, 76,  0,  0,  0,231,  0,  0,  0,
-  0,  0, 35,  0,  8,  0,  0,  0,232,  0,  0,  0,  0,  0, 35,  0, 77,  0,  0,  0,232,  0,  0,  0,  0,  0, 35,  0, 29,  0,  0,  0,
-233,  0,  0,  0,  0,  0, 35,  0, 77,  0,  0,  0,233,  0,  0,  0,  0,  0, 35,  0,  4,  0,  0,  0,234,  0,  0,  0,  0,  0, 35,  0,
- 78,  0,  0,  0,234,  0,  0,  0,  0,  0, 35,  0, 30,  0,  0,  0,235,  0,  0,  0,  0,  0, 35,  0, 78,  0,  0,  0,235,  0,  0,  0,
-  0,  0, 35,  0,  9,  0,  0,  0,236,  0,  0,  0,  0,  0, 35,  0, 79,  0,  0,  0,236,  0,  0,  0,  0,  0, 35,  0, 30,  0,  0,  0,
-237,  0,  0,  0,  0,  0, 35,  0, 79,  0,  0,  0,237,  0,  0,  0,  0,  0, 35,  0,  5,  0,  0,  0,238,  0,  0,  0,  0,  0, 35,  0,
- 80,  0,  0,  0,238,  0,  0,  0,  0,  0, 35,  0, 31,  0,  0,  0,239,  0,  0,  0,  0,  0, 35,  0, 80,  0,  0,  0,239,  0,  0,  0,
-  0,  0, 35,  0,  9,  0,  0,  0,240,  0,  0,  0,  0,  0, 35,  0, 81,  0,  0,  0,240,  0,  0,  0,  0,  0, 35,  0, 31,  0,  0,  0,
-241,  0,  0,  0,  0,  0, 35,  0, 81,  0,  0,  0,241,  0,  0,  0,  0,  0, 35,  0,  6,  0,  0,  0,242,  0,  0,  0,  0,  0, 35,  0,
- 82,  0,  0,  0,242,  0,  0,  0,  0,  0, 35,  0, 32,  0,  0,  0,243,  0,  0,  0,  0,  0, 35,  0, 82,  0,  0,  0,243,  0,  0,  0,
-  0,  0, 35,  0, 10,  0,  0,  0,244,  0,  0,  0,  0,  0, 35,  0, 83,  0,  0,  0,244,  0,  0,  0,  0,  0, 35,  0, 32,  0,  0,  0,
-245,  0,  0,  0,  0,  0, 35,  0, 83,  0,  0,  0,245,  0,  0,  0,  0,  0, 35,  0,  6,  0,  0,  0,246,  0,  0,  0,  0,  0, 35,  0,
- 84,  0,  0,  0,246,  0,  0,  0,  0,  0, 35,  0, 33,  0,  0,  0,247,  0,  0,  0,  0,  0, 35,  0, 84,  0,  0,  0,247,  0,  0,  0,
-  0,  0, 35,  0,  7,  0,  0,  0,248,  0,  0,  0,  0,  0, 35,  0, 85,  0,  0,  0,248,  0,  0,  0,  0,  0, 35,  0, 33,  0,  0,  0,
-249,  0,  0,  0,  0,  0, 35,  0, 85,  0,  0,  0,249,  0,  0,  0,  0,  0, 35,  0,  7,  0,  0,  0,250,  0,  0,  0,  0,  0, 35,  0,
- 86,  0,  0,  0,250,  0,  0,  0,  0,  0, 35,  0, 34,  0,  0,  0,251,  0,  0,  0,  0,  0, 35,  0, 86,  0,  0,  0,251,  0,  0,  0,
-  0,  0, 35,  0,  8,  0,  0,  0,252,  0,  0,  0,  0,  0, 35,  0, 87,  0,  0,  0,252,  0,  0,  0,  0,  0, 35,  0, 34,  0,  0,  0,
-253,  0,  0,  0,  0,  0, 35,  0, 87,  0,  0,  0,253,  0,  0,  0,  0,  0, 35,  0,  8,  0,  0,  0,254,  0,  0,  0,  0,  0, 35,  0,
- 88,  0,  0,  0,254,  0,  0,  0,  0,  0, 35,  0, 35,  0,  0,  0,255,  0,  0,  0,  0,  0, 35,  0, 88,  0,  0,  0,255,  0,  0,  0,
-  0,  0, 35,  0,  9,  0,  0,  0,  0,  1,  0,  0,  0,  0, 35,  0, 89,  0,  0,  0,  0,  1,  0,  0,  0,  0, 35,  0, 35,  0,  0,  0,
-  1,  1,  0,  0,  0,  0, 35,  0, 89,  0,  0,  0,  1,  1,  0,  0,  0,  0, 35,  0,  9,  0,  0,  0,  2,  1,  0,  0,  0,  0, 35,  0,
- 90,  0,  0,  0,  2,  1,  0,  0,  0,  0, 35,  0, 36,  0,  0,  0,  3,  1,  0,  0,  0,  0, 35,  0, 90,  0,  0,  0,  3,  1,  0,  0,
-  0,  0, 35,  0, 10,  0,  0,  0,  4,  1,  0,  0,  0,  0, 35,  0, 91,  0,  0,  0,  4,  1,  0,  0,  0,  0, 35,  0, 36,  0,  0,  0,
-  5,  1,  0,  0,  0,  0, 35,  0, 91,  0,  0,  0,  5,  1,  0,  0,  0,  0, 35,  0, 10,  0,  0,  0,  6,  1,  0,  0,  0,  0, 35,  0,
- 92,  0,  0,  0,  6,  1,  0,  0,  0,  0, 35,  0, 37,  0,  0,  0,  7,  1,  0,  0,  0,  0, 35,  0, 92,  0,  0,  0,  7,  1,  0,  0,
-  0,  0, 35,  0, 11,  0,  0,  0,  8,  1,  0,  0,  0,  0, 35,  0, 93,  0,  0,  0,  8,  1,  0,  0,  0,  0, 35,  0, 37,  0,  0,  0,
-  9,  1,  0,  0,  0,  0, 35,  0, 93,  0,  0,  0,  9,  1,  0,  0,  0,  0, 35,  0,  6,  0,  0,  0, 10,  1,  0,  0,  0,  0, 35,  0,
- 94,  0,  0,  0, 10,  1,  0,  0,  0,  0, 35,  0, 38,  0,  0,  0, 11,  1,  0,  0,  0,  0, 35,  0, 94,  0,  0,  0, 11,  1,  0,  0,
-  0,  0, 35,  0, 11,  0,  0,  0, 12,  1,  0,  0,  0,  0, 35,  0, 95,  0,  0,  0, 12,  1,  0,  0,  0,  0, 35,  0, 38,  0,  0,  0,
- 13,  1,  0,  0,  0,  0, 35,  0, 95,  0,  0,  0, 13,  1,  0,  0,  0,  0, 35,  0,  7,  0,  0,  0, 14,  1,  0,  0,  0,  0, 35,  0,
- 96,  0,  0,  0, 14,  1,  0,  0,  0,  0, 35,  0, 39,  0,  0,  0, 15,  1,  0,  0,  0,  0, 35,  0, 96,  0,  0,  0, 15,  1,  0,  0,
-  0,  0, 35,  0, 11,  0,  0,  0, 16,  1,  0,  0,  0,  0, 35,  0, 97,  0,  0,  0, 16,  1,  0,  0,  0,  0, 35,  0, 39,  0,  0,  0,
- 17,  1,  0,  0,  0,  0, 35,  0, 97,  0,  0,  0, 17,  1,  0,  0,  0,  0, 35,  0,  8,  0,  0,  0, 18,  1,  0,  0,  0,  0, 35,  0,
- 98,  0,  0,  0, 18,  1,  0,  0,  0,  0, 35,  0, 40,  0,  0,  0, 19,  1,  0,  0,  0,  0, 35,  0, 98,  0,  0,  0, 19,  1,  0,  0,
-  0,  0, 35,  0, 11,  0,  0,  0, 20,  1,  0,  0,  0,  0, 35,  0, 99,  0,  0,  0, 20,  1,  0,  0,  0,  0, 35,  0, 40,  0,  0,  0,
- 21,  1,  0,  0,  0,  0, 35,  0, 99,  0,  0,  0, 21,  1,  0,  0,  0,  0, 35,  0,  9,  0,  0,  0, 22,  1,  0,  0,  0,  0, 35,  0,
-100,  0,  0,  0, 22,  1,  0,  0,  0,  0, 35,  0, 41,  0,  0,  0, 23,  1,  0,  0,  0,  0, 35,  0,100,  0,  0,  0, 23,  1,  0,  0,
-  0,  0, 35,  0, 11,  0,  0,  0, 24,  1,  0,  0,  0,  0, 35,  0,101,  0,  0,  0, 24,  1,  0,  0,  0,  0, 35,  0, 41,  0,  0,  0,
- 25,  1,  0,  0,  0,  0, 35,  0,101,  0,  0,  0, 25,  1,  0,  0,  0,  0, 35,  0, 12,  0,  0,  0, 26,  1,  0,  0,  0,  0, 35,  0,
-102,  0,  0,  0, 26,  1,  0,  0,  0,  0, 35,  0, 14,  0,  0,  0, 27,  1,  0,  0,  0,  0, 35,  0,102,  0,  0,  0, 27,  1,  0,  0,
-  0,  0, 35,  0, 12,  0,  0,  0, 28,  1,  0,  0,  0,  0, 35,  0,103,  0,  0,  0, 28,  1,  0,  0,  0,  0, 35,  0, 13,  0,  0,  0,
- 29,  1,  0,  0,  0,  0, 35,  0,103,  0,  0,  0, 29,  1,  0,  0,  0,  0, 35,  0, 13,  0,  0,  0, 30,  1,  0,  0,  0,  0, 35,  0,
-104,  0,  0,  0, 30,  1,  0,  0,  0,  0, 35,  0, 14,  0,  0,  0, 31,  1,  0,  0,  0,  0, 35,  0,104,  0,  0,  0, 31,  1,  0,  0,
-  0,  0, 35,  0, 12,  0,  0,  0, 32,  1,  0,  0,  0,  0, 35,  0,105,  0,  0,  0, 32,  1,  0,  0,  0,  0, 35,  0, 16,  0,  0,  0,
- 33,  1,  0,  0,  0,  0, 35,  0,105,  0,  0,  0, 33,  1,  0,  0,  0,  0, 35,  0, 12,  0,  0,  0, 34,  1,  0,  0,  0,  0, 35,  0,
-106,  0,  0,  0, 34,  1,  0,  0,  0,  0, 35,  0, 15,  0,  0,  0, 35,  1,  0,  0,  0,  0, 35,  0,106,  0,  0,  0, 35,  1,  0,  0,
-  0,  0, 35,  0, 15,  0,  0,  0, 36,  1,  0,  0,  0,  0, 35,  0,107,  0,  0,  0, 36,  1,  0,  0,  0,  0, 35,  0, 16,  0,  0,  0,
- 37,  1,  0,  0,  0,  0, 35,  0,107,  0,  0,  0, 37,  1,  0,  0,  0,  0, 35,  0, 13,  0,  0,  0, 38,  1,  0,  0,  0,  0, 35,  0,
-108,  0,  0,  0, 38,  1,  0,  0,  0,  0, 35,  0, 18,  0,  0,  0, 39,  1,  0,  0,  0,  0, 35,  0,108,  0,  0,  0, 39,  1,  0,  0,
-  0,  0, 35,  0, 13,  0,  0,  0, 40,  1,  0,  0,  0,  0, 35,  0,109,  0,  0,  0, 40,  1,  0,  0,  0,  0, 35,  0, 17,  0,  0,  0,
- 41,  1,  0,  0,  0,  0, 35,  0,109,  0,  0,  0, 41,  1,  0,  0,  0,  0, 35,  0, 17,  0,  0,  0, 42,  1,  0,  0,  0,  0, 35,  0,
-110,  0,  0,  0, 42,  1,  0,  0,  0,  0, 35,  0, 18,  0,  0,  0, 43,  1,  0,  0,  0,  0, 35,  0,110,  0,  0,  0, 43,  1,  0,  0,
-  0,  0, 35,  0, 17,  0,  0,  0, 44,  1,  0,  0,  0,  0, 35,  0,111,  0,  0,  0, 44,  1,  0,  0,  0,  0, 35,  0, 20,  0,  0,  0,
- 45,  1,  0,  0,  0,  0, 35,  0,111,  0,  0,  0, 45,  1,  0,  0,  0,  0, 35,  0, 17,  0,  0,  0, 46,  1,  0,  0,  0,  0, 35,  0,
-112,  0,  0,  0, 46,  1,  0,  0,  0,  0, 35,  0, 19,  0,  0,  0, 47,  1,  0,  0,  0,  0, 35,  0,112,  0,  0,  0, 47,  1,  0,  0,
-  0,  0, 35,  0, 19,  0,  0,  0, 48,  1,  0,  0,  0,  0, 35,  0,113,  0,  0,  0, 48,  1,  0,  0,  0,  0, 35,  0, 20,  0,  0,  0,
- 49,  1,  0,  0,  0,  0, 35,  0,113,  0,  0,  0, 49,  1,  0,  0,  0,  0, 35,  0, 19,  0,  0,  0, 50,  1,  0,  0,  0,  0, 35,  0,
-114,  0,  0,  0, 50,  1,  0,  0,  0,  0, 35,  0, 21,  0,  0,  0, 51,  1,  0,  0,  0,  0, 35,  0,114,  0,  0,  0, 51,  1,  0,  0,
-  0,  0, 35,  0, 15,  0,  0,  0, 52,  1,  0,  0,  0,  0, 35,  0,115,  0,  0,  0, 52,  1,  0,  0,  0,  0, 35,  0, 19,  0,  0,  0,
- 53,  1,  0,  0,  0,  0, 35,  0,115,  0,  0,  0, 53,  1,  0,  0,  0,  0, 35,  0, 15,  0,  0,  0, 54,  1,  0,  0,  0,  0, 35,  0,
-116,  0,  0,  0, 54,  1,  0,  0,  0,  0, 35,  0, 21,  0,  0,  0, 55,  1,  0,  0,  0,  0, 35,  0,116,  0,  0,  0, 55,  1,  0,  0,
-  0,  0, 35,  0, 16,  0,  0,  0, 56,  1,  0,  0,  0,  0, 35,  0,117,  0,  0,  0, 56,  1,  0,  0,  0,  0, 35,  0, 23,  0,  0,  0,
- 57,  1,  0,  0,  0,  0, 35,  0,117,  0,  0,  0, 57,  1,  0,  0,  0,  0, 35,  0, 16,  0,  0,  0, 58,  1,  0,  0,  0,  0, 35,  0,
-118,  0,  0,  0, 58,  1,  0,  0,  0,  0, 35,  0, 22,  0,  0,  0, 59,  1,  0,  0,  0,  0, 35,  0,118,  0,  0,  0, 59,  1,  0,  0,
-  0,  0, 35,  0, 22,  0,  0,  0, 60,  1,  0,  0,  0,  0, 35,  0,119,  0,  0,  0, 60,  1,  0,  0,  0,  0, 35,  0, 23,  0,  0,  0,
- 61,  1,  0,  0,  0,  0, 35,  0,119,  0,  0,  0, 61,  1,  0,  0,  0,  0, 35,  0, 14,  0,  0,  0, 62,  1,  0,  0,  0,  0, 35,  0,
-120,  0,  0,  0, 62,  1,  0,  0,  0,  0, 35,  0, 25,  0,  0,  0, 63,  1,  0,  0,  0,  0, 35,  0,120,  0,  0,  0, 63,  1,  0,  0,
-  0,  0, 35,  0, 14,  0,  0,  0, 64,  1,  0,  0,  0,  0, 35,  0,121,  0,  0,  0, 64,  1,  0,  0,  0,  0, 35,  0, 24,  0,  0,  0,
- 65,  1,  0,  0,  0,  0, 35,  0,121,  0,  0,  0, 65,  1,  0,  0,  0,  0, 35,  0, 24,  0,  0,  0, 66,  1,  0,  0,  0,  0, 35,  0,
-122,  0,  0,  0, 66,  1,  0,  0,  0,  0, 35,  0, 25,  0,  0,  0, 67,  1,  0,  0,  0,  0, 35,  0,122,  0,  0,  0, 67,  1,  0,  0,
-  0,  0, 35,  0, 18,  0,  0,  0, 68,  1,  0,  0,  0,  0, 35,  0,123,  0,  0,  0, 68,  1,  0,  0,  0,  0, 35,  0, 27,  0,  0,  0,
- 69,  1,  0,  0,  0,  0, 35,  0,123,  0,  0,  0, 69,  1,  0,  0,  0,  0, 35,  0, 18,  0,  0,  0, 70,  1,  0,  0,  0,  0, 35,  0,
-124,  0,  0,  0, 70,  1,  0,  0,  0,  0, 35,  0, 26,  0,  0,  0, 71,  1,  0,  0,  0,  0, 35,  0,124,  0,  0,  0, 71,  1,  0,  0,
-  0,  0, 35,  0, 26,  0,  0,  0, 72,  1,  0,  0,  0,  0, 35,  0,125,  0,  0,  0, 72,  1,  0,  0,  0,  0, 35,  0, 27,  0,  0,  0,
- 73,  1,  0,  0,  0,  0, 35,  0,125,  0,  0,  0, 73,  1,  0,  0,  0,  0, 35,  0, 20,  0,  0,  0, 74,  1,  0,  0,  0,  0, 35,  0,
-126,  0,  0,  0, 74,  1,  0,  0,  0,  0, 35,  0, 29,  0,  0,  0, 75,  1,  0,  0,  0,  0, 35,  0,126,  0,  0,  0, 75,  1,  0,  0,
-  0,  0, 35,  0, 20,  0,  0,  0, 76,  1,  0,  0,  0,  0, 35,  0,127,  0,  0,  0, 76,  1,  0,  0,  0,  0, 35,  0, 28,  0,  0,  0,
- 77,  1,  0,  0,  0,  0, 35,  0,127,  0,  0,  0, 77,  1,  0,  0,  0,  0, 35,  0, 28,  0,  0,  0, 78,  1,  0,  0,  0,  0, 35,  0,
-128,  0,  0,  0, 78,  1,  0,  0,  0,  0, 35,  0, 29,  0,  0,  0, 79,  1,  0,  0,  0,  0, 35,  0,128,  0,  0,  0, 79,  1,  0,  0,
-  0,  0, 35,  0, 21,  0,  0,  0, 80,  1,  0,  0,  0,  0, 35,  0,129,  0,  0,  0, 80,  1,  0,  0,  0,  0, 35,  0, 31,  0,  0,  0,
- 81,  1,  0,  0,  0,  0, 35,  0,129,  0,  0,  0, 81,  1,  0,  0,  0,  0, 35,  0, 21,  0,  0,  0, 82,  1,  0,  0,  0,  0, 35,  0,
-130,  0,  0,  0, 82,  1,  0,  0,  0,  0, 35,  0, 30,  0,  0,  0, 83,  1,  0,  0,  0,  0, 35,  0,130,  0,  0,  0, 83,  1,  0,  0,
-  0,  0, 35,  0, 30,  0,  0,  0, 84,  1,  0,  0,  0,  0, 35,  0,131,  0,  0,  0, 84,  1,  0,  0,  0,  0, 35,  0, 31,  0,  0,  0,
- 85,  1,  0,  0,  0,  0, 35,  0,131,  0,  0,  0, 85,  1,  0,  0,  0,  0, 35,  0, 23,  0,  0,  0, 86,  1,  0,  0,  0,  0, 35,  0,
-132,  0,  0,  0, 86,  1,  0,  0,  0,  0, 35,  0, 32,  0,  0,  0, 87,  1,  0,  0,  0,  0, 35,  0,132,  0,  0,  0, 87,  1,  0,  0,
-  0,  0, 35,  0, 23,  0,  0,  0, 88,  1,  0,  0,  0,  0, 35,  0,133,  0,  0,  0, 88,  1,  0,  0,  0,  0, 35,  0, 24,  0,  0,  0,
- 89,  1,  0,  0,  0,  0, 35,  0,133,  0,  0,  0, 89,  1,  0,  0,  0,  0, 35,  0, 24,  0,  0,  0, 90,  1,  0,  0,  0,  0, 35,  0,
-134,  0,  0,  0, 90,  1,  0,  0,  0,  0, 35,  0, 32,  0,  0,  0, 91,  1,  0,  0,  0,  0, 35,  0,134,  0,  0,  0, 91,  1,  0,  0,
-  0,  0, 35,  0, 25,  0,  0,  0, 92,  1,  0,  0,  0,  0, 35,  0,135,  0,  0,  0, 92,  1,  0,  0,  0,  0, 35,  0, 33,  0,  0,  0,
- 93,  1,  0,  0,  0,  0, 35,  0,135,  0,  0,  0, 93,  1,  0,  0,  0,  0, 35,  0, 25,  0,  0,  0, 94,  1,  0,  0,  0,  0, 35,  0,
-136,  0,  0,  0, 94,  1,  0,  0,  0,  0, 35,  0, 26,  0,  0,  0, 95,  1,  0,  0,  0,  0, 35,  0,136,  0,  0,  0, 95,  1,  0,  0,
-  0,  0, 35,  0, 26,  0,  0,  0, 96,  1,  0,  0,  0,  0, 35,  0,137,  0,  0,  0, 96,  1,  0,  0,  0,  0, 35,  0, 33,  0,  0,  0,
- 97,  1,  0,  0,  0,  0, 35,  0,137,  0,  0,  0, 97,  1,  0,  0,  0,  0, 35,  0, 27,  0,  0,  0, 98,  1,  0,  0,  0,  0, 35,  0,
-138,  0,  0,  0, 98,  1,  0,  0,  0,  0, 35,  0, 34,  0,  0,  0, 99,  1,  0,  0,  0,  0, 35,  0,138,  0,  0,  0, 99,  1,  0,  0,
-  0,  0, 35,  0, 27,  0,  0,  0,100,  1,  0,  0,  0,  0, 35,  0,139,  0,  0,  0,100,  1,  0,  0,  0,  0, 35,  0, 28,  0,  0,  0,
-101,  1,  0,  0,  0,  0, 35,  0,139,  0,  0,  0,101,  1,  0,  0,  0,  0, 35,  0, 28,  0,  0,  0,102,  1,  0,  0,  0,  0, 35,  0,
-140,  0,  0,  0,102,  1,  0,  0,  0,  0, 35,  0, 34,  0,  0,  0,103,  1,  0,  0,  0,  0, 35,  0,140,  0,  0,  0,103,  1,  0,  0,
-  0,  0, 35,  0, 29,  0,  0,  0,104,  1,  0,  0,  0,  0, 35,  0,141,  0,  0,  0,104,  1,  0,  0,  0,  0, 35,  0, 35,  0,  0,  0,
-105,  1,  0,  0,  0,  0, 35,  0,141,  0,  0,  0,105,  1,  0,  0,  0,  0, 35,  0, 29,  0,  0,  0,106,  1,  0,  0,  0,  0, 35,  0,
-142,  0,  0,  0,106,  1,  0,  0,  0,  0, 35,  0, 30,  0,  0,  0,107,  1,  0,  0,  0,  0, 35,  0,142,  0,  0,  0,107,  1,  0,  0,
-  0,  0, 35,  0, 30,  0,  0,  0,108,  1,  0,  0,  0,  0, 35,  0,143,  0,  0,  0,108,  1,  0,  0,  0,  0, 35,  0, 35,  0,  0,  0,
-109,  1,  0,  0,  0,  0, 35,  0,143,  0,  0,  0,109,  1,  0,  0,  0,  0, 35,  0, 31,  0,  0,  0,110,  1,  0,  0,  0,  0, 35,  0,
-144,  0,  0,  0,110,  1,  0,  0,  0,  0, 35,  0, 36,  0,  0,  0,111,  1,  0,  0,  0,  0, 35,  0,144,  0,  0,  0,111,  1,  0,  0,
-  0,  0, 35,  0, 22,  0,  0,  0,112,  1,  0,  0,  0,  0, 35,  0,145,  0,  0,  0,112,  1,  0,  0,  0,  0, 35,  0, 31,  0,  0,  0,
-113,  1,  0,  0,  0,  0, 35,  0,145,  0,  0,  0,113,  1,  0,  0,  0,  0, 35,  0, 22,  0,  0,  0,114,  1,  0,  0,  0,  0, 35,  0,
-146,  0,  0,  0,114,  1,  0,  0,  0,  0, 35,  0, 36,  0,  0,  0,115,  1,  0,  0,  0,  0, 35,  0,146,  0,  0,  0,115,  1,  0,  0,
-  0,  0, 35,  0, 32,  0,  0,  0,116,  1,  0,  0,  0,  0, 35,  0,147,  0,  0,  0,116,  1,  0,  0,  0,  0, 35,  0, 38,  0,  0,  0,
-117,  1,  0,  0,  0,  0, 35,  0,147,  0,  0,  0,117,  1,  0,  0,  0,  0, 35,  0, 32,  0,  0,  0,118,  1,  0,  0,  0,  0, 35,  0,
-148,  0,  0,  0,118,  1,  0,  0,  0,  0, 35,  0, 37,  0,  0,  0,119,  1,  0,  0,  0,  0, 35,  0,148,  0,  0,  0,119,  1,  0,  0,
-  0,  0, 35,  0, 37,  0,  0,  0,120,  1,  0,  0,  0,  0, 35,  0,149,  0,  0,  0,120,  1,  0,  0,  0,  0, 35,  0, 38,  0,  0,  0,
-121,  1,  0,  0,  0,  0, 35,  0,149,  0,  0,  0,121,  1,  0,  0,  0,  0, 35,  0, 33,  0,  0,  0,122,  1,  0,  0,  0,  0, 35,  0,
-150,  0,  0,  0,122,  1,  0,  0,  0,  0, 35,  0, 39,  0,  0,  0,123,  1,  0,  0,  0,  0, 35,  0,150,  0,  0,  0,123,  1,  0,  0,
-  0,  0, 35,  0, 33,  0,  0,  0,124,  1,  0,  0,  0,  0, 35,  0,151,  0,  0,  0,124,  1,  0,  0,  0,  0, 35,  0, 38,  0,  0,  0,
-125,  1,  0,  0,  0,  0, 35,  0,151,  0,  0,  0,125,  1,  0,  0,  0,  0, 35,  0, 38,  0,  0,  0,126,  1,  0,  0,  0,  0, 35,  0,
-152,  0,  0,  0,126,  1,  0,  0,  0,  0, 35,  0, 39,  0,  0,  0,127,  1,  0,  0,  0,  0, 35,  0,152,  0,  0,  0,127,  1,  0,  0,
-  0,  0, 35,  0, 34,  0,  0,  0,128,  1,  0,  0,  0,  0, 35,  0,153,  0,  0,  0,128,  1,  0,  0,  0,  0, 35,  0, 40,  0,  0,  0,
-129,  1,  0,  0,  0,  0, 35,  0,153,  0,  0,  0,129,  1,  0,  0,  0,  0, 35,  0, 34,  0,  0,  0,130,  1,  0,  0,  0,  0, 35,  0,
-154,  0,  0,  0,130,  1,  0,  0,  0,  0, 35,  0, 39,  0,  0,  0,131,  1,  0,  0,  0,  0, 35,  0,154,  0,  0,  0,131,  1,  0,  0,
-  0,  0, 35,  0, 39,  0,  0,  0,132,  1,  0,  0,  0,  0, 35,  0,155,  0,  0,  0,132,  1,  0,  0,  0,  0, 35,  0, 40,  0,  0,  0,
-133,  1,  0,  0,  0,  0, 35,  0,155,  0,  0,  0,133,  1,  0,  0,  0,  0, 35,  0, 35,  0,  0,  0,134,  1,  0,  0,  0,  0, 35,  0,
-156,  0,  0,  0,134,  1,  0,  0,  0,  0, 35,  0, 41,  0,  0,  0,135,  1,  0,  0,  0,  0, 35,  0,156,  0,  0,  0,135,  1,  0,  0,
-  0,  0, 35,  0, 35,  0,  0,  0,136,  1,  0,  0,  0,  0, 35,  0,157,  0,  0,  0,136,  1,  0,  0,  0,  0, 35,  0, 40,  0,  0,  0,
-137,  1,  0,  0,  0,  0, 35,  0,157,  0,  0,  0,137,  1,  0,  0,  0,  0, 35,  0, 40,  0,  0,  0,138,  1,  0,  0,  0,  0, 35,  0,
-158,  0,  0,  0,138,  1,  0,  0,  0,  0, 35,  0, 41,  0,  0,  0,139,  1,  0,  0,  0,  0, 35,  0,158,  0,  0,  0,139,  1,  0,  0,
-  0,  0, 35,  0, 36,  0,  0,  0,140,  1,  0,  0,  0,  0, 35,  0,159,  0,  0,  0,140,  1,  0,  0,  0,  0, 35,  0, 37,  0,  0,  0,
-141,  1,  0,  0,  0,  0, 35,  0,159,  0,  0,  0,141,  1,  0,  0,  0,  0, 35,  0, 36,  0,  0,  0,142,  1,  0,  0,  0,  0, 35,  0,
-160,  0,  0,  0,142,  1,  0,  0,  0,  0, 35,  0, 41,  0,  0,  0,143,  1,  0,  0,  0,  0, 35,  0,160,  0,  0,  0,143,  1,  0,  0,
-  0,  0, 35,  0, 37,  0,  0,  0,144,  1,  0,  0,  0,  0, 35,  0,161,  0,  0,  0,144,  1,  0,  0,  0,  0, 35,  0, 41,  0,  0,  0,
-145,  1,  0,  0,  0,  0, 35,  0,161,  0,  0,  0,145,  1,  0,  0,  0,  0, 35,  0, 46,  0,  0,  0,146,  1,  0,  0,  0,  0, 35,  0,
-102,  0,  0,  0,146,  1,  0,  0,  0,  0, 35,  0, 43,  0,  0,  0,147,  1,  0,  0,  0,  0, 33,  0, 46,  0,  0,  0,147,  1,  0,  0,
-  0,  0, 33,  0, 43,  0,  0,  0,148,  1,  0,  0,  0,  0, 35,  0,102,  0,  0,  0,148,  1,  0,  0,  0,  0, 35,  0,102,  0,  0,  0,
-149,  1,  0,  0,  0,  0, 35,  0,103,  0,  0,  0,149,  1,  0,  0,  0,  0, 35,  0,103,  0,  0,  0,150,  1,  0,  0,  0,  0, 35,  0,
-104,  0,  0,  0,150,  1,  0,  0,  0,  0, 35,  0,102,  0,  0,  0,151,  1,  0,  0,  0,  0, 35,  0,104,  0,  0,  0,151,  1,  0,  0,
-  0,  0, 35,  0, 45,  0,  0,  0,152,  1,  0,  0,  0,  0, 33,  0, 47,  0,  0,  0,152,  1,  0,  0,  0,  0, 33,  0, 47,  0,  0,  0,
-153,  1,  0,  0,  0,  0, 35,  0,104,  0,  0,  0,153,  1,  0,  0,  0,  0, 35,  0, 45,  0,  0,  0,154,  1,  0,  0,  0,  0, 35,  0,
-104,  0,  0,  0,154,  1,  0,  0,  0,  0, 35,  0, 44,  0,  0,  0,155,  1,  0,  0,  0,  0, 35,  0,103,  0,  0,  0,155,  1,  0,  0,
-  0,  0, 35,  0, 42,  0,  0,  0,156,  1,  0,  0,  0,  0, 35,  0,103,  0,  0,  0,156,  1,  0,  0,  0,  0, 35,  0, 42,  0,  0,  0,
-157,  1,  0,  0,  0,  0, 33,  0, 44,  0,  0,  0,157,  1,  0,  0,  0,  0, 33,  0, 50,  0,  0,  0,158,  1,  0,  0,  0,  0, 35,  0,
-105,  0,  0,  0,158,  1,  0,  0,  0,  0, 35,  0, 43,  0,  0,  0,159,  1,  0,  0,  0,  0, 33,  0, 50,  0,  0,  0,159,  1,  0,  0,
-  0,  0, 33,  0, 43,  0,  0,  0,160,  1,  0,  0,  0,  0, 35,  0,105,  0,  0,  0,160,  1,  0,  0,  0,  0, 35,  0,105,  0,  0,  0,
-161,  1,  0,  0,  0,  0, 35,  0,106,  0,  0,  0,161,  1,  0,  0,  0,  0, 35,  0,106,  0,  0,  0,162,  1,  0,  0,  0,  0, 35,  0,
-107,  0,  0,  0,162,  1,  0,  0,  0,  0, 35,  0,105,  0,  0,  0,163,  1,  0,  0,  0,  0, 35,  0,107,  0,  0,  0,163,  1,  0,  0,
-  0,  0, 35,  0, 49,  0,  0,  0,164,  1,  0,  0,  0,  0, 33,  0, 51,  0,  0,  0,164,  1,  0,  0,  0,  0, 33,  0, 51,  0,  0,  0,
-165,  1,  0,  0,  0,  0, 35,  0,107,  0,  0,  0,165,  1,  0,  0,  0,  0, 35,  0, 49,  0,  0,  0,166,  1,  0,  0,  0,  0, 35,  0,
-107,  0,  0,  0,166,  1,  0,  0,  0,  0, 35,  0, 48,  0,  0,  0,167,  1,  0,  0,  0,  0, 35,  0,106,  0,  0,  0,167,  1,  0,  0,
-  0,  0, 35,  0, 42,  0,  0,  0,168,  1,  0,  0,  0,  0, 35,  0,106,  0,  0,  0,168,  1,  0,  0,  0,  0, 35,  0, 42,  0,  0,  0,
-169,  1,  0,  0,  0,  0, 33,  0, 48,  0,  0,  0,169,  1,  0,  0,  0,  0, 33,  0, 54,  0,  0,  0,170,  1,  0,  0,  0,  0, 35,  0,
-108,  0,  0,  0,170,  1,  0,  0,  0,  0, 35,  0, 45,  0,  0,  0,171,  1,  0,  0,  0,  0, 33,  0, 54,  0,  0,  0,171,  1,  0,  0,
-  0,  0, 33,  0, 45,  0,  0,  0,172,  1,  0,  0,  0,  0, 35,  0,108,  0,  0,  0,172,  1,  0,  0,  0,  0, 35,  0,108,  0,  0,  0,
-173,  1,  0,  0,  0,  0, 35,  0,109,  0,  0,  0,173,  1,  0,  0,  0,  0, 35,  0,109,  0,  0,  0,174,  1,  0,  0,  0,  0, 35,  0,
-110,  0,  0,  0,174,  1,  0,  0,  0,  0, 35,  0,108,  0,  0,  0,175,  1,  0,  0,  0,  0, 35,  0,110,  0,  0,  0,175,  1,  0,  0,
-  0,  0, 35,  0, 53,  0,  0,  0,176,  1,  0,  0,  0,  0, 33,  0, 55,  0,  0,  0,176,  1,  0,  0,  0,  0, 33,  0, 55,  0,  0,  0,
-177,  1,  0,  0,  0,  0, 35,  0,110,  0,  0,  0,177,  1,  0,  0,  0,  0, 35,  0, 53,  0,  0,  0,178,  1,  0,  0,  0,  0, 35,  0,
-110,  0,  0,  0,178,  1,  0,  0,  0,  0, 35,  0, 52,  0,  0,  0,179,  1,  0,  0,  0,  0, 35,  0,109,  0,  0,  0,179,  1,  0,  0,
-  0,  0, 35,  0, 44,  0,  0,  0,180,  1,  0,  0,  0,  0, 35,  0,109,  0,  0,  0,180,  1,  0,  0,  0,  0, 35,  0, 44,  0,  0,  0,
-181,  1,  0,  0,  0,  0, 33,  0, 52,  0,  0,  0,181,  1,  0,  0,  0,  0, 33,  0, 58,  0,  0,  0,182,  1,  0,  0,  0,  0, 35,  0,
-111,  0,  0,  0,182,  1,  0,  0,  0,  0, 35,  0, 53,  0,  0,  0,183,  1,  0,  0,  0,  0, 33,  0, 58,  0,  0,  0,183,  1,  0,  0,
-  0,  0, 33,  0, 53,  0,  0,  0,184,  1,  0,  0,  0,  0, 35,  0,111,  0,  0,  0,184,  1,  0,  0,  0,  0, 35,  0,111,  0,  0,  0,
-185,  1,  0,  0,  0,  0, 35,  0,112,  0,  0,  0,185,  1,  0,  0,  0,  0, 35,  0,112,  0,  0,  0,186,  1,  0,  0,  0,  0, 35,  0,
-113,  0,  0,  0,186,  1,  0,  0,  0,  0, 35,  0,111,  0,  0,  0,187,  1,  0,  0,  0,  0, 35,  0,113,  0,  0,  0,187,  1,  0,  0,
-  0,  0, 35,  0, 57,  0,  0,  0,188,  1,  0,  0,  0,  0, 33,  0, 59,  0,  0,  0,188,  1,  0,  0,  0,  0, 33,  0, 59,  0,  0,  0,
-189,  1,  0,  0,  0,  0, 35,  0,113,  0,  0,  0,189,  1,  0,  0,  0,  0, 35,  0, 57,  0,  0,  0,190,  1,  0,  0,  0,  0, 35,  0,
-113,  0,  0,  0,190,  1,  0,  0,  0,  0, 35,  0, 56,  0,  0,  0,191,  1,  0,  0,  0,  0, 35,  0,112,  0,  0,  0,191,  1,  0,  0,
-  0,  0, 35,  0, 52,  0,  0,  0,192,  1,  0,  0,  0,  0, 35,  0,112,  0,  0,  0,192,  1,  0,  0,  0,  0, 35,  0, 52,  0,  0,  0,
-193,  1,  0,  0,  0,  0, 33,  0, 56,  0,  0,  0,193,  1,  0,  0,  0,  0, 33,  0, 60,  0,  0,  0,194,  1,  0,  0,  0,  0, 35,  0,
-114,  0,  0,  0,194,  1,  0,  0,  0,  0, 35,  0, 57,  0,  0,  0,195,  1,  0,  0,  0,  0, 33,  0, 60,  0,  0,  0,195,  1,  0,  0,
-  0,  0, 33,  0, 57,  0,  0,  0,196,  1,  0,  0,  0,  0, 35,  0,114,  0,  0,  0,196,  1,  0,  0,  0,  0, 35,  0,114,  0,  0,  0,
-197,  1,  0,  0,  0,  0, 35,  0,115,  0,  0,  0,197,  1,  0,  0,  0,  0, 35,  0,115,  0,  0,  0,198,  1,  0,  0,  0,  0, 35,  0,
-116,  0,  0,  0,198,  1,  0,  0,  0,  0, 35,  0,114,  0,  0,  0,199,  1,  0,  0,  0,  0, 35,  0,116,  0,  0,  0,199,  1,  0,  0,
-  0,  0, 35,  0, 49,  0,  0,  0,200,  1,  0,  0,  0,  0, 33,  0, 61,  0,  0,  0,200,  1,  0,  0,  0,  0, 33,  0, 61,  0,  0,  0,
-201,  1,  0,  0,  0,  0, 35,  0,116,  0,  0,  0,201,  1,  0,  0,  0,  0, 35,  0, 49,  0,  0,  0,202,  1,  0,  0,  0,  0, 35,  0,
-116,  0,  0,  0,202,  1,  0,  0,  0,  0, 35,  0, 48,  0,  0,  0,203,  1,  0,  0,  0,  0, 35,  0,115,  0,  0,  0,203,  1,  0,  0,
-  0,  0, 35,  0, 56,  0,  0,  0,204,  1,  0,  0,  0,  0, 35,  0,115,  0,  0,  0,204,  1,  0,  0,  0,  0, 35,  0, 48,  0,  0,  0,
-205,  1,  0,  0,  0,  0, 33,  0, 56,  0,  0,  0,205,  1,  0,  0,  0,  0, 33,  0, 64,  0,  0,  0,206,  1,  0,  0,  0,  0, 35,  0,
-117,  0,  0,  0,206,  1,  0,  0,  0,  0, 35,  0, 50,  0,  0,  0,207,  1,  0,  0,  0,  0, 33,  0, 64,  0,  0,  0,207,  1,  0,  0,
-  0,  0, 33,  0, 50,  0,  0,  0,208,  1,  0,  0,  0,  0, 35,  0,117,  0,  0,  0,208,  1,  0,  0,  0,  0, 35,  0,117,  0,  0,  0,
-209,  1,  0,  0,  0,  0, 35,  0,118,  0,  0,  0,209,  1,  0,  0,  0,  0, 35,  0,118,  0,  0,  0,210,  1,  0,  0,  0,  0, 35,  0,
-119,  0,  0,  0,210,  1,  0,  0,  0,  0, 35,  0,117,  0,  0,  0,211,  1,  0,  0,  0,  0, 35,  0,119,  0,  0,  0,211,  1,  0,  0,
-  0,  0, 35,  0, 63,  0,  0,  0,212,  1,  0,  0,  0,  0, 33,  0, 65,  0,  0,  0,212,  1,  0,  0,  0,  0, 33,  0, 65,  0,  0,  0,
-213,  1,  0,  0,  0,  0, 35,  0,119,  0,  0,  0,213,  1,  0,  0,  0,  0, 35,  0, 63,  0,  0,  0,214,  1,  0,  0,  0,  0, 35,  0,
-119,  0,  0,  0,214,  1,  0,  0,  0,  0, 35,  0, 62,  0,  0,  0,215,  1,  0,  0,  0,  0, 35,  0,118,  0,  0,  0,215,  1,  0,  0,
-  0,  0, 35,  0, 51,  0,  0,  0,216,  1,  0,  0,  0,  0, 35,  0,118,  0,  0,  0,216,  1,  0,  0,  0,  0, 35,  0, 51,  0,  0,  0,
-217,  1,  0,  0,  0,  0, 33,  0, 62,  0,  0,  0,217,  1,  0,  0,  0,  0, 33,  0, 68,  0,  0,  0,218,  1,  0,  0,  0,  0, 35,  0,
-120,  0,  0,  0,218,  1,  0,  0,  0,  0, 35,  0, 47,  0,  0,  0,219,  1,  0,  0,  0,  0, 33,  0, 68,  0,  0,  0,219,  1,  0,  0,
-  0,  0, 33,  0, 47,  0,  0,  0,220,  1,  0,  0,  0,  0, 35,  0,120,  0,  0,  0,220,  1,  0,  0,  0,  0, 35,  0,120,  0,  0,  0,
-221,  1,  0,  0,  0,  0, 35,  0,121,  0,  0,  0,221,  1,  0,  0,  0,  0, 35,  0,121,  0,  0,  0,222,  1,  0,  0,  0,  0, 35,  0,
-122,  0,  0,  0,222,  1,  0,  0,  0,  0, 35,  0,120,  0,  0,  0,223,  1,  0,  0,  0,  0, 35,  0,122,  0,  0,  0,223,  1,  0,  0,
-  0,  0, 35,  0, 67,  0,  0,  0,224,  1,  0,  0,  0,  0, 33,  0, 69,  0,  0,  0,224,  1,  0,  0,  0,  0, 33,  0, 69,  0,  0,  0,
-225,  1,  0,  0,  0,  0, 35,  0,122,  0,  0,  0,225,  1,  0,  0,  0,  0, 35,  0, 67,  0,  0,  0,226,  1,  0,  0,  0,  0, 35,  0,
-122,  0,  0,  0,226,  1,  0,  0,  0,  0, 35,  0, 66,  0,  0,  0,227,  1,  0,  0,  0,  0, 35,  0,121,  0,  0,  0,227,  1,  0,  0,
-  0,  0, 35,  0, 46,  0,  0,  0,228,  1,  0,  0,  0,  0, 35,  0,121,  0,  0,  0,228,  1,  0,  0,  0,  0, 35,  0, 46,  0,  0,  0,
-229,  1,  0,  0,  0,  0, 33,  0, 66,  0,  0,  0,229,  1,  0,  0,  0,  0, 33,  0, 72,  0,  0,  0,230,  1,  0,  0,  0,  0, 35,  0,
-123,  0,  0,  0,230,  1,  0,  0,  0,  0, 35,  0, 55,  0,  0,  0,231,  1,  0,  0,  0,  0, 33,  0, 72,  0,  0,  0,231,  1,  0,  0,
-  0,  0, 33,  0, 55,  0,  0,  0,232,  1,  0,  0,  0,  0, 35,  0,123,  0,  0,  0,232,  1,  0,  0,  0,  0, 35,  0,123,  0,  0,  0,
-233,  1,  0,  0,  0,  0, 35,  0,124,  0,  0,  0,233,  1,  0,  0,  0,  0, 35,  0,124,  0,  0,  0,234,  1,  0,  0,  0,  0, 35,  0,
-125,  0,  0,  0,234,  1,  0,  0,  0,  0, 35,  0,123,  0,  0,  0,235,  1,  0,  0,  0,  0, 35,  0,125,  0,  0,  0,235,  1,  0,  0,
-  0,  0, 35,  0, 71,  0,  0,  0,236,  1,  0,  0,  0,  0, 33,  0, 73,  0,  0,  0,236,  1,  0,  0,  0,  0, 33,  0, 73,  0,  0,  0,
-237,  1,  0,  0,  0,  0, 35,  0,125,  0,  0,  0,237,  1,  0,  0,  0,  0, 35,  0, 71,  0,  0,  0,238,  1,  0,  0,  0,  0, 35,  0,
-125,  0,  0,  0,238,  1,  0,  0,  0,  0, 35,  0, 70,  0,  0,  0,239,  1,  0,  0,  0,  0, 35,  0,124,  0,  0,  0,239,  1,  0,  0,
-  0,  0, 35,  0, 54,  0,  0,  0,240,  1,  0,  0,  0,  0, 35,  0,124,  0,  0,  0,240,  1,  0,  0,  0,  0, 35,  0, 54,  0,  0,  0,
-241,  1,  0,  0,  0,  0, 33,  0, 70,  0,  0,  0,241,  1,  0,  0,  0,  0, 33,  0, 76,  0,  0,  0,242,  1,  0,  0,  0,  0, 35,  0,
-126,  0,  0,  0,242,  1,  0,  0,  0,  0, 35,  0, 59,  0,  0,  0,243,  1,  0,  0,  0,  0, 33,  0, 76,  0,  0,  0,243,  1,  0,  0,
-  0,  0, 33,  0, 59,  0,  0,  0,244,  1,  0,  0,  0,  0, 35,  0,126,  0,  0,  0,244,  1,  0,  0,  0,  0, 35,  0,126,  0,  0,  0,
-245,  1,  0,  0,  0,  0, 35,  0,127,  0,  0,  0,245,  1,  0,  0,  0,  0, 35,  0,127,  0,  0,  0,246,  1,  0,  0,  0,  0, 35,  0,
-128,  0,  0,  0,246,  1,  0,  0,  0,  0, 35,  0,126,  0,  0,  0,247,  1,  0,  0,  0,  0, 35,  0,128,  0,  0,  0,247,  1,  0,  0,
-  0,  0, 35,  0, 75,  0,  0,  0,248,  1,  0,  0,  0,  0, 33,  0, 77,  0,  0,  0,248,  1,  0,  0,  0,  0, 33,  0, 77,  0,  0,  0,
-249,  1,  0,  0,  0,  0, 35,  0,128,  0,  0,  0,249,  1,  0,  0,  0,  0, 35,  0, 75,  0,  0,  0,250,  1,  0,  0,  0,  0, 35,  0,
-128,  0,  0,  0,250,  1,  0,  0,  0,  0, 35,  0, 74,  0,  0,  0,251,  1,  0,  0,  0,  0, 35,  0,127,  0,  0,  0,251,  1,  0,  0,
-  0,  0, 35,  0, 58,  0,  0,  0,252,  1,  0,  0,  0,  0, 35,  0,127,  0,  0,  0,252,  1,  0,  0,  0,  0, 35,  0, 58,  0,  0,  0,
-253,  1,  0,  0,  0,  0, 33,  0, 74,  0,  0,  0,253,  1,  0,  0,  0,  0, 33,  0, 80,  0,  0,  0,254,  1,  0,  0,  0,  0, 35,  0,
-129,  0,  0,  0,254,  1,  0,  0,  0,  0, 35,  0, 61,  0,  0,  0,255,  1,  0,  0,  0,  0, 33,  0, 80,  0,  0,  0,255,  1,  0,  0,
-  0,  0, 33,  0, 61,  0,  0,  0,  0,  2,  0,  0,  0,  0, 35,  0,129,  0,  0,  0,  0,  2,  0,  0,  0,  0, 35,  0,129,  0,  0,  0,
-  1,  2,  0,  0,  0,  0, 35,  0,130,  0,  0,  0,  1,  2,  0,  0,  0,  0, 35,  0,130,  0,  0,  0,  2,  2,  0,  0,  0,  0, 35,  0,
-131,  0,  0,  0,  2,  2,  0,  0,  0,  0, 35,  0,129,  0,  0,  0,  3,  2,  0,  0,  0,  0, 35,  0,131,  0,  0,  0,  3,  2,  0,  0,
-  0,  0, 35,  0, 79,  0,  0,  0,  4,  2,  0,  0,  0,  0, 33,  0, 81,  0,  0,  0,  4,  2,  0,  0,  0,  0, 33,  0, 81,  0,  0,  0,
-  5,  2,  0,  0,  0,  0, 35,  0,131,  0,  0,  0,  5,  2,  0,  0,  0,  0, 35,  0, 79,  0,  0,  0,  6,  2,  0,  0,  0,  0, 35,  0,
-131,  0,  0,  0,  6,  2,  0,  0,  0,  0, 35,  0, 78,  0,  0,  0,  7,  2,  0,  0,  0,  0, 35,  0,130,  0,  0,  0,  7,  2,  0,  0,
-  0,  0, 35,  0, 60,  0,  0,  0,  8,  2,  0,  0,  0,  0, 35,  0,130,  0,  0,  0,  8,  2,  0,  0,  0,  0, 35,  0, 60,  0,  0,  0,
-  9,  2,  0,  0,  0,  0, 33,  0, 78,  0,  0,  0,  9,  2,  0,  0,  0,  0, 33,  0, 83,  0,  0,  0, 10,  2,  0,  0,  0,  0, 35,  0,
-132,  0,  0,  0, 10,  2,  0,  0,  0,  0, 35,  0, 65,  0,  0,  0, 11,  2,  0,  0,  0,  0, 33,  0, 83,  0,  0,  0, 11,  2,  0,  0,
-  0,  0, 33,  0, 65,  0,  0,  0, 12,  2,  0,  0,  0,  0, 35,  0,132,  0,  0,  0, 12,  2,  0,  0,  0,  0, 35,  0,132,  0,  0,  0,
- 13,  2,  0,  0,  0,  0, 35,  0,133,  0,  0,  0, 13,  2,  0,  0,  0,  0, 35,  0,133,  0,  0,  0, 14,  2,  0,  0,  0,  0, 35,  0,
-134,  0,  0,  0, 14,  2,  0,  0,  0,  0, 35,  0,132,  0,  0,  0, 15,  2,  0,  0,  0,  0, 35,  0,134,  0,  0,  0, 15,  2,  0,  0,
-  0,  0, 35,  0, 67,  0,  0,  0, 16,  2,  0,  0,  0,  0, 33,  0, 82,  0,  0,  0, 16,  2,  0,  0,  0,  0, 33,  0, 82,  0,  0,  0,
- 17,  2,  0,  0,  0,  0, 35,  0,134,  0,  0,  0, 17,  2,  0,  0,  0,  0, 35,  0, 67,  0,  0,  0, 18,  2,  0,  0,  0,  0, 35,  0,
-134,  0,  0,  0, 18,  2,  0,  0,  0,  0, 35,  0, 66,  0,  0,  0, 19,  2,  0,  0,  0,  0, 35,  0,133,  0,  0,  0, 19,  2,  0,  0,
-  0,  0, 35,  0, 64,  0,  0,  0, 20,  2,  0,  0,  0,  0, 35,  0,133,  0,  0,  0, 20,  2,  0,  0,  0,  0, 35,  0, 64,  0,  0,  0,
- 21,  2,  0,  0,  0,  0, 33,  0, 66,  0,  0,  0, 21,  2,  0,  0,  0,  0, 33,  0, 84,  0,  0,  0, 22,  2,  0,  0,  0,  0, 35,  0,
-135,  0,  0,  0, 22,  2,  0,  0,  0,  0, 35,  0, 69,  0,  0,  0, 23,  2,  0,  0,  0,  0, 33,  0, 84,  0,  0,  0, 23,  2,  0,  0,
-  0,  0, 33,  0, 69,  0,  0,  0, 24,  2,  0,  0,  0,  0, 35,  0,135,  0,  0,  0, 24,  2,  0,  0,  0,  0, 35,  0,135,  0,  0,  0,
- 25,  2,  0,  0,  0,  0, 35,  0,136,  0,  0,  0, 25,  2,  0,  0,  0,  0, 35,  0,136,  0,  0,  0, 26,  2,  0,  0,  0,  0, 35,  0,
-137,  0,  0,  0, 26,  2,  0,  0,  0,  0, 35,  0,135,  0,  0,  0, 27,  2,  0,  0,  0,  0, 35,  0,137,  0,  0,  0, 27,  2,  0,  0,
-  0,  0, 35,  0, 71,  0,  0,  0, 28,  2,  0,  0,  0,  0, 33,  0, 85,  0,  0,  0, 28,  2,  0,  0,  0,  0, 33,  0, 85,  0,  0,  0,
- 29,  2,  0,  0,  0,  0, 35,  0,137,  0,  0,  0, 29,  2,  0,  0,  0,  0, 35,  0, 71,  0,  0,  0, 30,  2,  0,  0,  0,  0, 35,  0,
-137,  0,  0,  0, 30,  2,  0,  0,  0,  0, 35,  0, 70,  0,  0,  0, 31,  2,  0,  0,  0,  0, 35,  0,136,  0,  0,  0, 31,  2,  0,  0,
-  0,  0, 35,  0, 68,  0,  0,  0, 32,  2,  0,  0,  0,  0, 35,  0,136,  0,  0,  0, 32,  2,  0,  0,  0,  0, 35,  0, 68,  0,  0,  0,
- 33,  2,  0,  0,  0,  0, 33,  0, 70,  0,  0,  0, 33,  2,  0,  0,  0,  0, 33,  0, 86,  0,  0,  0, 34,  2,  0,  0,  0,  0, 35,  0,
-138,  0,  0,  0, 34,  2,  0,  0,  0,  0, 35,  0, 73,  0,  0,  0, 35,  2,  0,  0,  0,  0, 33,  0, 86,  0,  0,  0, 35,  2,  0,  0,
-  0,  0, 33,  0, 73,  0,  0,  0, 36,  2,  0,  0,  0,  0, 35,  0,138,  0,  0,  0, 36,  2,  0,  0,  0,  0, 35,  0,138,  0,  0,  0,
- 37,  2,  0,  0,  0,  0, 35,  0,139,  0,  0,  0, 37,  2,  0,  0,  0,  0, 35,  0,139,  0,  0,  0, 38,  2,  0,  0,  0,  0, 35,  0,
-140,  0,  0,  0, 38,  2,  0,  0,  0,  0, 35,  0,138,  0,  0,  0, 39,  2,  0,  0,  0,  0, 35,  0,140,  0,  0,  0, 39,  2,  0,  0,
-  0,  0, 35,  0, 75,  0,  0,  0, 40,  2,  0,  0,  0,  0, 33,  0, 87,  0,  0,  0, 40,  2,  0,  0,  0,  0, 33,  0, 87,  0,  0,  0,
- 41,  2,  0,  0,  0,  0, 35,  0,140,  0,  0,  0, 41,  2,  0,  0,  0,  0, 35,  0, 75,  0,  0,  0, 42,  2,  0,  0,  0,  0, 35,  0,
-140,  0,  0,  0, 42,  2,  0,  0,  0,  0, 35,  0, 74,  0,  0,  0, 43,  2,  0,  0,  0,  0, 35,  0,139,  0,  0,  0, 43,  2,  0,  0,
-  0,  0, 35,  0, 72,  0,  0,  0, 44,  2,  0,  0,  0,  0, 35,  0,139,  0,  0,  0, 44,  2,  0,  0,  0,  0, 35,  0, 72,  0,  0,  0,
- 45,  2,  0,  0,  0,  0, 33,  0, 74,  0,  0,  0, 45,  2,  0,  0,  0,  0, 33,  0, 88,  0,  0,  0, 46,  2,  0,  0,  0,  0, 35,  0,
-141,  0,  0,  0, 46,  2,  0,  0,  0,  0, 35,  0, 77,  0,  0,  0, 47,  2,  0,  0,  0,  0, 33,  0, 88,  0,  0,  0, 47,  2,  0,  0,
-  0,  0, 33,  0, 77,  0,  0,  0, 48,  2,  0,  0,  0,  0, 35,  0,141,  0,  0,  0, 48,  2,  0,  0,  0,  0, 35,  0,141,  0,  0,  0,
- 49,  2,  0,  0,  0,  0, 35,  0,142,  0,  0,  0, 49,  2,  0,  0,  0,  0, 35,  0,142,  0,  0,  0, 50,  2,  0,  0,  0,  0, 35,  0,
-143,  0,  0,  0, 50,  2,  0,  0,  0,  0, 35,  0,141,  0,  0,  0, 51,  2,  0,  0,  0,  0, 35,  0,143,  0,  0,  0, 51,  2,  0,  0,
-  0,  0, 35,  0, 79,  0,  0,  0, 52,  2,  0,  0,  0,  0, 33,  0, 89,  0,  0,  0, 52,  2,  0,  0,  0,  0, 33,  0, 89,  0,  0,  0,
- 53,  2,  0,  0,  0,  0, 35,  0,143,  0,  0,  0, 53,  2,  0,  0,  0,  0, 35,  0, 79,  0,  0,  0, 54,  2,  0,  0,  0,  0, 35,  0,
-143,  0,  0,  0, 54,  2,  0,  0,  0,  0, 35,  0, 78,  0,  0,  0, 55,  2,  0,  0,  0,  0, 35,  0,142,  0,  0,  0, 55,  2,  0,  0,
-  0,  0, 35,  0, 76,  0,  0,  0, 56,  2,  0,  0,  0,  0, 35,  0,142,  0,  0,  0, 56,  2,  0,  0,  0,  0, 35,  0, 76,  0,  0,  0,
- 57,  2,  0,  0,  0,  0, 33,  0, 78,  0,  0,  0, 57,  2,  0,  0,  0,  0, 33,  0, 90,  0,  0,  0, 58,  2,  0,  0,  0,  0, 35,  0,
-144,  0,  0,  0, 58,  2,  0,  0,  0,  0, 35,  0, 81,  0,  0,  0, 59,  2,  0,  0,  0,  0, 33,  0, 90,  0,  0,  0, 59,  2,  0,  0,
-  0,  0, 33,  0, 81,  0,  0,  0, 60,  2,  0,  0,  0,  0, 35,  0,144,  0,  0,  0, 60,  2,  0,  0,  0,  0, 35,  0,144,  0,  0,  0,
- 61,  2,  0,  0,  0,  0, 35,  0,145,  0,  0,  0, 61,  2,  0,  0,  0,  0, 35,  0,145,  0,  0,  0, 62,  2,  0,  0,  0,  0, 35,  0,
-146,  0,  0,  0, 62,  2,  0,  0,  0,  0, 35,  0,144,  0,  0,  0, 63,  2,  0,  0,  0,  0, 35,  0,146,  0,  0,  0, 63,  2,  0,  0,
-  0,  0, 35,  0, 63,  0,  0,  0, 64,  2,  0,  0,  0,  0, 33,  0, 91,  0,  0,  0, 64,  2,  0,  0,  0,  0, 33,  0, 91,  0,  0,  0,
- 65,  2,  0,  0,  0,  0, 35,  0,146,  0,  0,  0, 65,  2,  0,  0,  0,  0, 35,  0, 63,  0,  0,  0, 66,  2,  0,  0,  0,  0, 35,  0,
-146,  0,  0,  0, 66,  2,  0,  0,  0,  0, 35,  0, 62,  0,  0,  0, 67,  2,  0,  0,  0,  0, 35,  0,145,  0,  0,  0, 67,  2,  0,  0,
-  0,  0, 35,  0, 80,  0,  0,  0, 68,  2,  0,  0,  0,  0, 35,  0,145,  0,  0,  0, 68,  2,  0,  0,  0,  0, 35,  0, 62,  0,  0,  0,
- 69,  2,  0,  0,  0,  0, 33,  0, 80,  0,  0,  0, 69,  2,  0,  0,  0,  0, 33,  0, 94,  0,  0,  0, 70,  2,  0,  0,  0,  0, 35,  0,
-147,  0,  0,  0, 70,  2,  0,  0,  0,  0, 35,  0, 82,  0,  0,  0, 71,  2,  0,  0,  0,  0, 33,  0, 94,  0,  0,  0, 71,  2,  0,  0,
-  0,  0, 33,  0, 82,  0,  0,  0, 72,  2,  0,  0,  0,  0, 35,  0,147,  0,  0,  0, 72,  2,  0,  0,  0,  0, 35,  0,147,  0,  0,  0,
- 73,  2,  0,  0,  0,  0, 35,  0,148,  0,  0,  0, 73,  2,  0,  0,  0,  0, 35,  0,148,  0,  0,  0, 74,  2,  0,  0,  0,  0, 35,  0,
-149,  0,  0,  0, 74,  2,  0,  0,  0,  0, 35,  0,147,  0,  0,  0, 75,  2,  0,  0,  0,  0, 35,  0,149,  0,  0,  0, 75,  2,  0,  0,
-  0,  0, 35,  0, 93,  0,  0,  0, 76,  2,  0,  0,  0,  0, 33,  0, 95,  0,  0,  0, 76,  2,  0,  0,  0,  0, 33,  0, 95,  0,  0,  0,
- 77,  2,  0,  0,  0,  0, 35,  0,149,  0,  0,  0, 77,  2,  0,  0,  0,  0, 35,  0, 93,  0,  0,  0, 78,  2,  0,  0,  0,  0, 35,  0,
-149,  0,  0,  0, 78,  2,  0,  0,  0,  0, 35,  0, 92,  0,  0,  0, 79,  2,  0,  0,  0,  0, 35,  0,148,  0,  0,  0, 79,  2,  0,  0,
-  0,  0, 35,  0, 83,  0,  0,  0, 80,  2,  0,  0,  0,  0, 35,  0,148,  0,  0,  0, 80,  2,  0,  0,  0,  0, 35,  0, 83,  0,  0,  0,
- 81,  2,  0,  0,  0,  0, 33,  0, 92,  0,  0,  0, 81,  2,  0,  0,  0,  0, 33,  0, 96,  0,  0,  0, 82,  2,  0,  0,  0,  0, 35,  0,
-150,  0,  0,  0, 82,  2,  0,  0,  0,  0, 35,  0, 85,  0,  0,  0, 83,  2,  0,  0,  0,  0, 33,  0, 96,  0,  0,  0, 83,  2,  0,  0,
-  0,  0, 33,  0, 85,  0,  0,  0, 84,  2,  0,  0,  0,  0, 35,  0,150,  0,  0,  0, 84,  2,  0,  0,  0,  0, 35,  0,150,  0,  0,  0,
- 85,  2,  0,  0,  0,  0, 35,  0,151,  0,  0,  0, 85,  2,  0,  0,  0,  0, 35,  0,151,  0,  0,  0, 86,  2,  0,  0,  0,  0, 35,  0,
-152,  0,  0,  0, 86,  2,  0,  0,  0,  0, 35,  0,150,  0,  0,  0, 87,  2,  0,  0,  0,  0, 35,  0,152,  0,  0,  0, 87,  2,  0,  0,
-  0,  0, 35,  0, 95,  0,  0,  0, 88,  2,  0,  0,  0,  0, 33,  0, 97,  0,  0,  0, 88,  2,  0,  0,  0,  0, 33,  0, 97,  0,  0,  0,
- 89,  2,  0,  0,  0,  0, 35,  0,152,  0,  0,  0, 89,  2,  0,  0,  0,  0, 35,  0, 95,  0,  0,  0, 90,  2,  0,  0,  0,  0, 35,  0,
-152,  0,  0,  0, 90,  2,  0,  0,  0,  0, 35,  0, 94,  0,  0,  0, 91,  2,  0,  0,  0,  0, 35,  0,151,  0,  0,  0, 91,  2,  0,  0,
-  0,  0, 35,  0, 84,  0,  0,  0, 92,  2,  0,  0,  0,  0, 35,  0,151,  0,  0,  0, 92,  2,  0,  0,  0,  0, 35,  0, 84,  0,  0,  0,
- 93,  2,  0,  0,  0,  0, 33,  0, 94,  0,  0,  0, 93,  2,  0,  0,  0,  0, 33,  0, 98,  0,  0,  0, 94,  2,  0,  0,  0,  0, 35,  0,
-153,  0,  0,  0, 94,  2,  0,  0,  0,  0, 35,  0, 87,  0,  0,  0, 95,  2,  0,  0,  0,  0, 33,  0, 98,  0,  0,  0, 95,  2,  0,  0,
-  0,  0, 33,  0, 87,  0,  0,  0, 96,  2,  0,  0,  0,  0, 35,  0,153,  0,  0,  0, 96,  2,  0,  0,  0,  0, 35,  0,153,  0,  0,  0,
- 97,  2,  0,  0,  0,  0, 35,  0,154,  0,  0,  0, 97,  2,  0,  0,  0,  0, 35,  0,154,  0,  0,  0, 98,  2,  0,  0,  0,  0, 35,  0,
-155,  0,  0,  0, 98,  2,  0,  0,  0,  0, 35,  0,153,  0,  0,  0, 99,  2,  0,  0,  0,  0, 35,  0,155,  0,  0,  0, 99,  2,  0,  0,
-  0,  0, 35,  0, 97,  0,  0,  0,100,  2,  0,  0,  0,  0, 33,  0, 99,  0,  0,  0,100,  2,  0,  0,  0,  0, 33,  0, 99,  0,  0,  0,
-101,  2,  0,  0,  0,  0, 35,  0,155,  0,  0,  0,101,  2,  0,  0,  0,  0, 35,  0, 97,  0,  0,  0,102,  2,  0,  0,  0,  0, 35,  0,
-155,  0,  0,  0,102,  2,  0,  0,  0,  0, 35,  0, 96,  0,  0,  0,103,  2,  0,  0,  0,  0, 35,  0,154,  0,  0,  0,103,  2,  0,  0,
-  0,  0, 35,  0, 86,  0,  0,  0,104,  2,  0,  0,  0,  0, 35,  0,154,  0,  0,  0,104,  2,  0,  0,  0,  0, 35,  0, 86,  0,  0,  0,
-105,  2,  0,  0,  0,  0, 33,  0, 96,  0,  0,  0,105,  2,  0,  0,  0,  0, 33,  0,100,  0,  0,  0,106,  2,  0,  0,  0,  0, 35,  0,
-156,  0,  0,  0,106,  2,  0,  0,  0,  0, 35,  0, 89,  0,  0,  0,107,  2,  0,  0,  0,  0, 33,  0,100,  0,  0,  0,107,  2,  0,  0,
-  0,  0, 33,  0, 89,  0,  0,  0,108,  2,  0,  0,  0,  0, 35,  0,156,  0,  0,  0,108,  2,  0,  0,  0,  0, 35,  0,156,  0,  0,  0,
-109,  2,  0,  0,  0,  0, 35,  0,157,  0,  0,  0,109,  2,  0,  0,  0,  0, 35,  0,157,  0,  0,  0,110,  2,  0,  0,  0,  0, 35,  0,
-158,  0,  0,  0,110,  2,  0,  0,  0,  0, 35,  0,156,  0,  0,  0,111,  2,  0,  0,  0,  0, 35,  0,158,  0,  0,  0,111,  2,  0,  0,
-  0,  0, 35,  0, 99,  0,  0,  0,112,  2,  0,  0,  0,  0, 33,  0,101,  0,  0,  0,112,  2,  0,  0,  0,  0, 33,  0,101,  0,  0,  0,
-113,  2,  0,  0,  0,  0, 35,  0,158,  0,  0,  0,113,  2,  0,  0,  0,  0, 35,  0, 99,  0,  0,  0,114,  2,  0,  0,  0,  0, 35,  0,
-158,  0,  0,  0,114,  2,  0,  0,  0,  0, 35,  0, 98,  0,  0,  0,115,  2,  0,  0,  0,  0, 35,  0,157,  0,  0,  0,115,  2,  0,  0,
-  0,  0, 35,  0, 88,  0,  0,  0,116,  2,  0,  0,  0,  0, 35,  0,157,  0,  0,  0,116,  2,  0,  0,  0,  0, 35,  0, 88,  0,  0,  0,
-117,  2,  0,  0,  0,  0, 33,  0, 98,  0,  0,  0,117,  2,  0,  0,  0,  0, 33,  0, 92,  0,  0,  0,118,  2,  0,  0,  0,  0, 35,  0,
-159,  0,  0,  0,118,  2,  0,  0,  0,  0, 35,  0, 91,  0,  0,  0,119,  2,  0,  0,  0,  0, 33,  0, 92,  0,  0,  0,119,  2,  0,  0,
-  0,  0, 33,  0, 91,  0,  0,  0,120,  2,  0,  0,  0,  0, 35,  0,159,  0,  0,  0,120,  2,  0,  0,  0,  0, 35,  0,159,  0,  0,  0,
-121,  2,  0,  0,  0,  0, 35,  0,160,  0,  0,  0,121,  2,  0,  0,  0,  0, 35,  0,160,  0,  0,  0,122,  2,  0,  0,  0,  0, 35,  0,
-161,  0,  0,  0,122,  2,  0,  0,  0,  0, 35,  0,159,  0,  0,  0,123,  2,  0,  0,  0,  0, 35,  0,161,  0,  0,  0,123,  2,  0,  0,
-  0,  0, 35,  0, 93,  0,  0,  0,124,  2,  0,  0,  0,  0, 33,  0,101,  0,  0,  0,124,  2,  0,  0,  0,  0, 33,  0, 93,  0,  0,  0,
-125,  2,  0,  0,  0,  0, 35,  0,161,  0,  0,  0,125,  2,  0,  0,  0,  0, 35,  0,101,  0,  0,  0,126,  2,  0,  0,  0,  0, 35,  0,
-161,  0,  0,  0,126,  2,  0,  0,  0,  0, 35,  0,100,  0,  0,  0,127,  2,  0,  0,  0,  0, 35,  0,160,  0,  0,  0,127,  2,  0,  0,
-  0,  0, 35,  0, 90,  0,  0,  0,128,  2,  0,  0,  0,  0, 35,  0,160,  0,  0,  0,128,  2,  0,  0,  0,  0, 35,  0, 90,  0,  0,  0,
-129,  2,  0,  0,  0,  0, 33,  0,100,  0,  0,  0,129,  2,  0,  0,  0,  0, 33,  0, 27,  1,  0,  0,146,  1,  0,  0,  0,  0, 35,  0,
-171,  0,  0,  0,146,  1,  0,  0,  0,  0, 35,  0,171,  0,  0,  0, 27,  1,  0,  0,  0,  0, 35,  0,146,  1,  0,  0,147,  1,  0,  0,
-  0,  0, 35,  0,146,  1,  0,  0,148,  1,  0,  0,  0,  0, 35,  0,147,  1,  0,  0,148,  1,  0,  0,  0,  0, 35,  0,165,  0,  0,  0,
- 26,  1,  0,  0,  0,  0, 35,  0,165,  0,  0,  0,148,  1,  0,  0,  0,  0, 35,  0, 26,  1,  0,  0,148,  1,  0,  0,  0,  0, 35,  0,
-164,  0,  0,  0,147,  1,  0,  0,  0,  0, 35,  0,164,  0,  0,  0,170,  0,  0,  0,  0,  0, 35,  0,170,  0,  0,  0,147,  1,  0,  0,
-  0,  0, 35,  0, 26,  1,  0,  0,149,  1,  0,  0,  0,  0, 35,  0, 28,  1,  0,  0,149,  1,  0,  0,  0,  0, 35,  0, 26,  1,  0,  0,
- 28,  1,  0,  0,  0,  0, 35,  0,149,  1,  0,  0,150,  1,  0,  0,  0,  0, 35,  0,149,  1,  0,  0,151,  1,  0,  0,  0,  0, 35,  0,
-150,  1,  0,  0,151,  1,  0,  0,  0,  0, 35,  0, 27,  1,  0,  0, 31,  1,  0,  0,  0,  0, 35,  0, 31,  1,  0,  0,151,  1,  0,  0,
-  0,  0, 35,  0, 27,  1,  0,  0,151,  1,  0,  0,  0,  0, 35,  0, 30,  1,  0,  0,150,  1,  0,  0,  0,  0, 35,  0, 29,  1,  0,  0,
- 30,  1,  0,  0,  0,  0, 35,  0, 29,  1,  0,  0,150,  1,  0,  0,  0,  0, 35,  0,168,  0,  0,  0,152,  1,  0,  0,  0,  0, 35,  0,
-172,  0,  0,  0,152,  1,  0,  0,  0,  0, 35,  0,168,  0,  0,  0,172,  0,  0,  0,  0,  0, 35,  0,152,  1,  0,  0,153,  1,  0,  0,
-  0,  0, 35,  0,152,  1,  0,  0,154,  1,  0,  0,  0,  0, 35,  0,153,  1,  0,  0,154,  1,  0,  0,  0,  0, 35,  0,169,  0,  0,  0,
- 30,  1,  0,  0,  0,  0, 35,  0, 30,  1,  0,  0,154,  1,  0,  0,  0,  0, 35,  0,169,  0,  0,  0,154,  1,  0,  0,  0,  0, 35,  0,
- 31,  1,  0,  0,153,  1,  0,  0,  0,  0, 35,  0,173,  0,  0,  0, 31,  1,  0,  0,  0,  0, 35,  0,173,  0,  0,  0,153,  1,  0,  0,
-  0,  0, 35,  0,167,  0,  0,  0,155,  1,  0,  0,  0,  0, 35,  0, 29,  1,  0,  0,155,  1,  0,  0,  0,  0, 35,  0,167,  0,  0,  0,
- 29,  1,  0,  0,  0,  0, 35,  0,155,  1,  0,  0,156,  1,  0,  0,  0,  0, 35,  0,155,  1,  0,  0,157,  1,  0,  0,  0,  0, 35,  0,
-156,  1,  0,  0,157,  1,  0,  0,  0,  0, 35,  0,162,  0,  0,  0,166,  0,  0,  0,  0,  0, 35,  0,162,  0,  0,  0,157,  1,  0,  0,
-  0,  0, 35,  0,166,  0,  0,  0,157,  1,  0,  0,  0,  0, 35,  0,163,  0,  0,  0,156,  1,  0,  0,  0,  0, 35,  0,163,  0,  0,  0,
- 28,  1,  0,  0,  0,  0, 35,  0, 28,  1,  0,  0,156,  1,  0,  0,  0,  0, 35,  0, 33,  1,  0,  0,158,  1,  0,  0,  0,  0, 35,  0,
-179,  0,  0,  0, 33,  1,  0,  0,  0,  0, 35,  0,179,  0,  0,  0,158,  1,  0,  0,  0,  0, 35,  0,158,  1,  0,  0,159,  1,  0,  0,
-  0,  0, 35,  0,159,  1,  0,  0,160,  1,  0,  0,  0,  0, 35,  0,158,  1,  0,  0,160,  1,  0,  0,  0,  0, 35,  0,165,  0,  0,  0,
- 32,  1,  0,  0,  0,  0, 35,  0, 32,  1,  0,  0,160,  1,  0,  0,  0,  0, 35,  0,165,  0,  0,  0,160,  1,  0,  0,  0,  0, 35,  0,
-164,  0,  0,  0,159,  1,  0,  0,  0,  0, 35,  0,178,  0,  0,  0,159,  1,  0,  0,  0,  0, 35,  0,164,  0,  0,  0,178,  0,  0,  0,
-  0,  0, 35,  0, 32,  1,  0,  0,161,  1,  0,  0,  0,  0, 35,  0, 32,  1,  0,  0, 34,  1,  0,  0,  0,  0, 35,  0, 34,  1,  0,  0,
-161,  1,  0,  0,  0,  0, 35,  0,161,  1,  0,  0,162,  1,  0,  0,  0,  0, 35,  0,162,  1,  0,  0,163,  1,  0,  0,  0,  0, 35,  0,
-161,  1,  0,  0,163,  1,  0,  0,  0,  0, 35,  0, 33,  1,  0,  0, 37,  1,  0,  0,  0,  0, 35,  0, 33,  1,  0,  0,163,  1,  0,  0,
-  0,  0, 35,  0, 37,  1,  0,  0,163,  1,  0,  0,  0,  0, 35,  0, 36,  1,  0,  0,162,  1,  0,  0,  0,  0, 35,  0, 35,  1,  0,  0,
-162,  1,  0,  0,  0,  0, 35,  0, 35,  1,  0,  0, 36,  1,  0,  0,  0,  0, 35,  0,176,  0,  0,  0,164,  1,  0,  0,  0,  0, 35,  0,
-176,  0,  0,  0,180,  0,  0,  0,  0,  0, 35,  0,180,  0,  0,  0,164,  1,  0,  0,  0,  0, 35,  0,164,  1,  0,  0,165,  1,  0,  0,
-  0,  0, 35,  0,165,  1,  0,  0,166,  1,  0,  0,  0,  0, 35,  0,164,  1,  0,  0,166,  1,  0,  0,  0,  0, 35,  0,177,  0,  0,  0,
- 36,  1,  0,  0,  0,  0, 35,  0,177,  0,  0,  0,166,  1,  0,  0,  0,  0, 35,  0, 36,  1,  0,  0,166,  1,  0,  0,  0,  0, 35,  0,
- 37,  1,  0,  0,165,  1,  0,  0,  0,  0, 35,  0,181,  0,  0,  0,165,  1,  0,  0,  0,  0, 35,  0,181,  0,  0,  0, 37,  1,  0,  0,
-  0,  0, 35,  0,175,  0,  0,  0,167,  1,  0,  0,  0,  0, 35,  0,175,  0,  0,  0, 35,  1,  0,  0,  0,  0, 35,  0, 35,  1,  0,  0,
-167,  1,  0,  0,  0,  0, 35,  0,167,  1,  0,  0,168,  1,  0,  0,  0,  0, 35,  0,168,  1,  0,  0,169,  1,  0,  0,  0,  0, 35,  0,
-167,  1,  0,  0,169,  1,  0,  0,  0,  0, 35,  0,162,  0,  0,  0,174,  0,  0,  0,  0,  0, 35,  0,174,  0,  0,  0,169,  1,  0,  0,
-  0,  0, 35,  0,162,  0,  0,  0,169,  1,  0,  0,  0,  0, 35,  0,163,  0,  0,  0,168,  1,  0,  0,  0,  0, 35,  0, 34,  1,  0,  0,
-168,  1,  0,  0,  0,  0, 35,  0,163,  0,  0,  0, 34,  1,  0,  0,  0,  0, 35,  0, 39,  1,  0,  0,170,  1,  0,  0,  0,  0, 35,  0,
-187,  0,  0,  0,170,  1,  0,  0,  0,  0, 35,  0,187,  0,  0,  0, 39,  1,  0,  0,  0,  0, 35,  0,170,  1,  0,  0,171,  1,  0,  0,
-  0,  0, 35,  0,170,  1,  0,  0,172,  1,  0,  0,  0,  0, 35,  0,171,  1,  0,  0,172,  1,  0,  0,  0,  0, 35,  0,169,  0,  0,  0,
- 38,  1,  0,  0,  0,  0, 35,  0,169,  0,  0,  0,172,  1,  0,  0,  0,  0, 35,  0, 38,  1,  0,  0,172,  1,  0,  0,  0,  0, 35,  0,
-168,  0,  0,  0,171,  1,  0,  0,  0,  0, 35,  0,168,  0,  0,  0,186,  0,  0,  0,  0,  0, 35,  0,186,  0,  0,  0,171,  1,  0,  0,
-  0,  0, 35,  0, 38,  1,  0,  0,173,  1,  0,  0,  0,  0, 35,  0, 40,  1,  0,  0,173,  1,  0,  0,  0,  0, 35,  0, 38,  1,  0,  0,
- 40,  1,  0,  0,  0,  0, 35,  0,173,  1,  0,  0,174,  1,  0,  0,  0,  0, 35,  0,173,  1,  0,  0,175,  1,  0,  0,  0,  0, 35,  0,
-174,  1,  0,  0,175,  1,  0,  0,  0,  0, 35,  0, 39,  1,  0,  0, 43,  1,  0,  0,  0,  0, 35,  0, 43,  1,  0,  0,175,  1,  0,  0,
-  0,  0, 35,  0, 39,  1,  0,  0,175,  1,  0,  0,  0,  0, 35,  0, 42,  1,  0,  0,174,  1,  0,  0,  0,  0, 35,  0, 41,  1,  0,  0,
- 42,  1,  0,  0,  0,  0, 35,  0, 41,  1,  0,  0,174,  1,  0,  0,  0,  0, 35,  0,184,  0,  0,  0,176,  1,  0,  0,  0,  0, 35,  0,
-188,  0,  0,  0,176,  1,  0,  0,  0,  0, 35,  0,184,  0,  0,  0,188,  0,  0,  0,  0,  0, 35,  0,176,  1,  0,  0,177,  1,  0,  0,
-  0,  0, 35,  0,176,  1,  0,  0,178,  1,  0,  0,  0,  0, 35,  0,177,  1,  0,  0,178,  1,  0,  0,  0,  0, 35,  0,185,  0,  0,  0,
- 42,  1,  0,  0,  0,  0, 35,  0, 42,  1,  0,  0,178,  1,  0,  0,  0,  0, 35,  0,185,  0,  0,  0,178,  1,  0,  0,  0,  0, 35,  0,
- 43,  1,  0,  0,177,  1,  0,  0,  0,  0, 35,  0,189,  0,  0,  0, 43,  1,  0,  0,  0,  0, 35,  0,189,  0,  0,  0,177,  1,  0,  0,
-  0,  0, 35,  0,183,  0,  0,  0,179,  1,  0,  0,  0,  0, 35,  0, 41,  1,  0,  0,179,  1,  0,  0,  0,  0, 35,  0,183,  0,  0,  0,
- 41,  1,  0,  0,  0,  0, 35,  0,179,  1,  0,  0,180,  1,  0,  0,  0,  0, 35,  0,179,  1,  0,  0,181,  1,  0,  0,  0,  0, 35,  0,
-180,  1,  0,  0,181,  1,  0,  0,  0,  0, 35,  0,166,  0,  0,  0,182,  0,  0,  0,  0,  0, 35,  0,166,  0,  0,  0,181,  1,  0,  0,
-  0,  0, 35,  0,182,  0,  0,  0,181,  1,  0,  0,  0,  0, 35,  0,167,  0,  0,  0,180,  1,  0,  0,  0,  0, 35,  0,167,  0,  0,  0,
- 40,  1,  0,  0,  0,  0, 35,  0, 40,  1,  0,  0,180,  1,  0,  0,  0,  0, 35,  0, 45,  1,  0,  0,182,  1,  0,  0,  0,  0, 35,  0,
-195,  0,  0,  0,182,  1,  0,  0,  0,  0, 35,  0,195,  0,  0,  0, 45,  1,  0,  0,  0,  0, 35,  0,182,  1,  0,  0,183,  1,  0,  0,
-  0,  0, 35,  0,182,  1,  0,  0,184,  1,  0,  0,  0,  0, 35,  0,183,  1,  0,  0,184,  1,  0,  0,  0,  0, 35,  0,185,  0,  0,  0,
- 44,  1,  0,  0,  0,  0, 35,  0,185,  0,  0,  0,184,  1,  0,  0,  0,  0, 35,  0, 44,  1,  0,  0,184,  1,  0,  0,  0,  0, 35,  0,
-184,  0,  0,  0,183,  1,  0,  0,  0,  0, 35,  0,184,  0,  0,  0,194,  0,  0,  0,  0,  0, 35,  0,194,  0,  0,  0,183,  1,  0,  0,
-  0,  0, 35,  0, 44,  1,  0,  0,185,  1,  0,  0,  0,  0, 35,  0, 46,  1,  0,  0,185,  1,  0,  0,  0,  0, 35,  0, 44,  1,  0,  0,
- 46,  1,  0,  0,  0,  0, 35,  0,185,  1,  0,  0,186,  1,  0,  0,  0,  0, 35,  0,185,  1,  0,  0,187,  1,  0,  0,  0,  0, 35,  0,
-186,  1,  0,  0,187,  1,  0,  0,  0,  0, 35,  0, 45,  1,  0,  0, 49,  1,  0,  0,  0,  0, 35,  0, 49,  1,  0,  0,187,  1,  0,  0,
-  0,  0, 35,  0, 45,  1,  0,  0,187,  1,  0,  0,  0,  0, 35,  0, 48,  1,  0,  0,186,  1,  0,  0,  0,  0, 35,  0, 47,  1,  0,  0,
- 48,  1,  0,  0,  0,  0, 35,  0, 47,  1,  0,  0,186,  1,  0,  0,  0,  0, 35,  0,192,  0,  0,  0,188,  1,  0,  0,  0,  0, 35,  0,
-196,  0,  0,  0,188,  1,  0,  0,  0,  0, 35,  0,192,  0,  0,  0,196,  0,  0,  0,  0,  0, 35,  0,188,  1,  0,  0,189,  1,  0,  0,
-  0,  0, 35,  0,188,  1,  0,  0,190,  1,  0,  0,  0,  0, 35,  0,189,  1,  0,  0,190,  1,  0,  0,  0,  0, 35,  0,193,  0,  0,  0,
- 48,  1,  0,  0,  0,  0, 35,  0, 48,  1,  0,  0,190,  1,  0,  0,  0,  0, 35,  0,193,  0,  0,  0,190,  1,  0,  0,  0,  0, 35,  0,
- 49,  1,  0,  0,189,  1,  0,  0,  0,  0, 35,  0,197,  0,  0,  0, 49,  1,  0,  0,  0,  0, 35,  0,197,  0,  0,  0,189,  1,  0,  0,
-  0,  0, 35,  0,191,  0,  0,  0,191,  1,  0,  0,  0,  0, 35,  0, 47,  1,  0,  0,191,  1,  0,  0,  0,  0, 35,  0,191,  0,  0,  0,
- 47,  1,  0,  0,  0,  0, 35,  0,191,  1,  0,  0,192,  1,  0,  0,  0,  0, 35,  0,191,  1,  0,  0,193,  1,  0,  0,  0,  0, 35,  0,
-192,  1,  0,  0,193,  1,  0,  0,  0,  0, 35,  0,182,  0,  0,  0,190,  0,  0,  0,  0,  0, 35,  0,182,  0,  0,  0,193,  1,  0,  0,
-  0,  0, 35,  0,190,  0,  0,  0,193,  1,  0,  0,  0,  0, 35,  0,183,  0,  0,  0,192,  1,  0,  0,  0,  0, 35,  0,183,  0,  0,  0,
- 46,  1,  0,  0,  0,  0, 35,  0, 46,  1,  0,  0,192,  1,  0,  0,  0,  0, 35,  0, 51,  1,  0,  0,194,  1,  0,  0,  0,  0, 35,  0,
-199,  0,  0,  0,194,  1,  0,  0,  0,  0, 35,  0,199,  0,  0,  0, 51,  1,  0,  0,  0,  0, 35,  0,194,  1,  0,  0,195,  1,  0,  0,
-  0,  0, 35,  0,194,  1,  0,  0,196,  1,  0,  0,  0,  0, 35,  0,195,  1,  0,  0,196,  1,  0,  0,  0,  0, 35,  0,193,  0,  0,  0,
- 50,  1,  0,  0,  0,  0, 35,  0,193,  0,  0,  0,196,  1,  0,  0,  0,  0, 35,  0, 50,  1,  0,  0,196,  1,  0,  0,  0,  0, 35,  0,
-192,  0,  0,  0,195,  1,  0,  0,  0,  0, 35,  0,192,  0,  0,  0,198,  0,  0,  0,  0,  0, 35,  0,198,  0,  0,  0,195,  1,  0,  0,
-  0,  0, 35,  0, 50,  1,  0,  0,197,  1,  0,  0,  0,  0, 35,  0, 53,  1,  0,  0,197,  1,  0,  0,  0,  0, 35,  0, 50,  1,  0,  0,
- 53,  1,  0,  0,  0,  0, 35,  0,197,  1,  0,  0,198,  1,  0,  0,  0,  0, 35,  0,197,  1,  0,  0,199,  1,  0,  0,  0,  0, 35,  0,
-198,  1,  0,  0,199,  1,  0,  0,  0,  0, 35,  0, 51,  1,  0,  0, 55,  1,  0,  0,  0,  0, 35,  0, 55,  1,  0,  0,199,  1,  0,  0,
-  0,  0, 35,  0, 51,  1,  0,  0,199,  1,  0,  0,  0,  0, 35,  0, 54,  1,  0,  0,198,  1,  0,  0,  0,  0, 35,  0, 52,  1,  0,  0,
- 54,  1,  0,  0,  0,  0, 35,  0, 52,  1,  0,  0,198,  1,  0,  0,  0,  0, 35,  0,176,  0,  0,  0,200,  1,  0,  0,  0,  0, 35,  0,
-200,  0,  0,  0,200,  1,  0,  0,  0,  0, 35,  0,176,  0,  0,  0,200,  0,  0,  0,  0,  0, 35,  0,200,  1,  0,  0,201,  1,  0,  0,
-  0,  0, 35,  0,200,  1,  0,  0,202,  1,  0,  0,  0,  0, 35,  0,201,  1,  0,  0,202,  1,  0,  0,  0,  0, 35,  0,177,  0,  0,  0,
- 54,  1,  0,  0,  0,  0, 35,  0, 54,  1,  0,  0,202,  1,  0,  0,  0,  0, 35,  0,177,  0,  0,  0,202,  1,  0,  0,  0,  0, 35,  0,
- 55,  1,  0,  0,201,  1,  0,  0,  0,  0, 35,  0,201,  0,  0,  0, 55,  1,  0,  0,  0,  0, 35,  0,201,  0,  0,  0,201,  1,  0,  0,
-  0,  0, 35,  0,175,  0,  0,  0,203,  1,  0,  0,  0,  0, 35,  0, 52,  1,  0,  0,203,  1,  0,  0,  0,  0, 35,  0,175,  0,  0,  0,
- 52,  1,  0,  0,  0,  0, 35,  0,203,  1,  0,  0,204,  1,  0,  0,  0,  0, 35,  0,203,  1,  0,  0,205,  1,  0,  0,  0,  0, 35,  0,
-204,  1,  0,  0,205,  1,  0,  0,  0,  0, 35,  0,174,  0,  0,  0,190,  0,  0,  0,  0,  0, 35,  0,190,  0,  0,  0,205,  1,  0,  0,
-  0,  0, 35,  0,174,  0,  0,  0,205,  1,  0,  0,  0,  0, 35,  0,191,  0,  0,  0,204,  1,  0,  0,  0,  0, 35,  0,191,  0,  0,  0,
- 53,  1,  0,  0,  0,  0, 35,  0, 53,  1,  0,  0,204,  1,  0,  0,  0,  0, 35,  0, 57,  1,  0,  0,206,  1,  0,  0,  0,  0, 35,  0,
-207,  0,  0,  0, 57,  1,  0,  0,  0,  0, 35,  0,207,  0,  0,  0,206,  1,  0,  0,  0,  0, 35,  0,206,  1,  0,  0,207,  1,  0,  0,
-  0,  0, 35,  0,207,  1,  0,  0,208,  1,  0,  0,  0,  0, 35,  0,206,  1,  0,  0,208,  1,  0,  0,  0,  0, 35,  0,179,  0,  0,  0,
- 56,  1,  0,  0,  0,  0, 35,  0, 56,  1,  0,  0,208,  1,  0,  0,  0,  0, 35,  0,179,  0,  0,  0,208,  1,  0,  0,  0,  0, 35,  0,
-178,  0,  0,  0,207,  1,  0,  0,  0,  0, 35,  0,206,  0,  0,  0,207,  1,  0,  0,  0,  0, 35,  0,178,  0,  0,  0,206,  0,  0,  0,
-  0,  0, 35,  0, 56,  1,  0,  0,209,  1,  0,  0,  0,  0, 35,  0, 56,  1,  0,  0, 58,  1,  0,  0,  0,  0, 35,  0, 58,  1,  0,  0,
-209,  1,  0,  0,  0,  0, 35,  0,209,  1,  0,  0,210,  1,  0,  0,  0,  0, 35,  0,210,  1,  0,  0,211,  1,  0,  0,  0,  0, 35,  0,
-209,  1,  0,  0,211,  1,  0,  0,  0,  0, 35,  0, 57,  1,  0,  0, 61,  1,  0,  0,  0,  0, 35,  0, 57,  1,  0,  0,211,  1,  0,  0,
-  0,  0, 35,  0, 61,  1,  0,  0,211,  1,  0,  0,  0,  0, 35,  0, 60,  1,  0,  0,210,  1,  0,  0,  0,  0, 35,  0, 59,  1,  0,  0,
-210,  1,  0,  0,  0,  0, 35,  0, 59,  1,  0,  0, 60,  1,  0,  0,  0,  0, 35,  0,204,  0,  0,  0,212,  1,  0,  0,  0,  0, 35,  0,
-204,  0,  0,  0,208,  0,  0,  0,  0,  0, 35,  0,208,  0,  0,  0,212,  1,  0,  0,  0,  0, 35,  0,212,  1,  0,  0,213,  1,  0,  0,
-  0,  0, 35,  0,213,  1,  0,  0,214,  1,  0,  0,  0,  0, 35,  0,212,  1,  0,  0,214,  1,  0,  0,  0,  0, 35,  0,205,  0,  0,  0,
- 60,  1,  0,  0,  0,  0, 35,  0,205,  0,  0,  0,214,  1,  0,  0,  0,  0, 35,  0, 60,  1,  0,  0,214,  1,  0,  0,  0,  0, 35,  0,
- 61,  1,  0,  0,213,  1,  0,  0,  0,  0, 35,  0,209,  0,  0,  0,213,  1,  0,  0,  0,  0, 35,  0,209,  0,  0,  0, 61,  1,  0,  0,
-  0,  0, 35,  0,203,  0,  0,  0,215,  1,  0,  0,  0,  0, 35,  0,203,  0,  0,  0, 59,  1,  0,  0,  0,  0, 35,  0, 59,  1,  0,  0,
-215,  1,  0,  0,  0,  0, 35,  0,215,  1,  0,  0,216,  1,  0,  0,  0,  0, 35,  0,216,  1,  0,  0,217,  1,  0,  0,  0,  0, 35,  0,
-215,  1,  0,  0,217,  1,  0,  0,  0,  0, 35,  0,180,  0,  0,  0,202,  0,  0,  0,  0,  0, 35,  0,202,  0,  0,  0,217,  1,  0,  0,
-  0,  0, 35,  0,180,  0,  0,  0,217,  1,  0,  0,  0,  0, 35,  0,181,  0,  0,  0,216,  1,  0,  0,  0,  0, 35,  0, 58,  1,  0,  0,
-216,  1,  0,  0,  0,  0, 35,  0,181,  0,  0,  0, 58,  1,  0,  0,  0,  0, 35,  0, 63,  1,  0,  0,218,  1,  0,  0,  0,  0, 35,  0,
-215,  0,  0,  0, 63,  1,  0,  0,  0,  0, 35,  0,215,  0,  0,  0,218,  1,  0,  0,  0,  0, 35,  0,218,  1,  0,  0,219,  1,  0,  0,
-  0,  0, 35,  0,219,  1,  0,  0,220,  1,  0,  0,  0,  0, 35,  0,218,  1,  0,  0,220,  1,  0,  0,  0,  0, 35,  0,173,  0,  0,  0,
- 62,  1,  0,  0,  0,  0, 35,  0, 62,  1,  0,  0,220,  1,  0,  0,  0,  0, 35,  0,173,  0,  0,  0,220,  1,  0,  0,  0,  0, 35,  0,
-172,  0,  0,  0,219,  1,  0,  0,  0,  0, 35,  0,214,  0,  0,  0,219,  1,  0,  0,  0,  0, 35,  0,172,  0,  0,  0,214,  0,  0,  0,
-  0,  0, 35,  0, 62,  1,  0,  0,221,  1,  0,  0,  0,  0, 35,  0, 62,  1,  0,  0, 64,  1,  0,  0,  0,  0, 35,  0, 64,  1,  0,  0,
-221,  1,  0,  0,  0,  0, 35,  0,221,  1,  0,  0,222,  1,  0,  0,  0,  0, 35,  0,222,  1,  0,  0,223,  1,  0,  0,  0,  0, 35,  0,
-221,  1,  0,  0,223,  1,  0,  0,  0,  0, 35,  0, 63,  1,  0,  0, 67,  1,  0,  0,  0,  0, 35,  0, 63,  1,  0,  0,223,  1,  0,  0,
-  0,  0, 35,  0, 67,  1,  0,  0,223,  1,  0,  0,  0,  0, 35,  0, 66,  1,  0,  0,222,  1,  0,  0,  0,  0, 35,  0, 65,  1,  0,  0,
-222,  1,  0,  0,  0,  0, 35,  0, 65,  1,  0,  0, 66,  1,  0,  0,  0,  0, 35,  0,212,  0,  0,  0,224,  1,  0,  0,  0,  0, 35,  0,
-212,  0,  0,  0,216,  0,  0,  0,  0,  0, 35,  0,216,  0,  0,  0,224,  1,  0,  0,  0,  0, 35,  0,224,  1,  0,  0,225,  1,  0,  0,
-  0,  0, 35,  0,225,  1,  0,  0,226,  1,  0,  0,  0,  0, 35,  0,224,  1,  0,  0,226,  1,  0,  0,  0,  0, 35,  0,213,  0,  0,  0,
- 66,  1,  0,  0,  0,  0, 35,  0,213,  0,  0,  0,226,  1,  0,  0,  0,  0, 35,  0, 66,  1,  0,  0,226,  1,  0,  0,  0,  0, 35,  0,
- 67,  1,  0,  0,225,  1,  0,  0,  0,  0, 35,  0,217,  0,  0,  0,225,  1,  0,  0,  0,  0, 35,  0,217,  0,  0,  0, 67,  1,  0,  0,
-  0,  0, 35,  0,211,  0,  0,  0,227,  1,  0,  0,  0,  0, 35,  0,211,  0,  0,  0, 65,  1,  0,  0,  0,  0, 35,  0, 65,  1,  0,  0,
-227,  1,  0,  0,  0,  0, 35,  0,227,  1,  0,  0,228,  1,  0,  0,  0,  0, 35,  0,228,  1,  0,  0,229,  1,  0,  0,  0,  0, 35,  0,
-227,  1,  0,  0,229,  1,  0,  0,  0,  0, 35,  0,170,  0,  0,  0,210,  0,  0,  0,  0,  0, 35,  0,210,  0,  0,  0,229,  1,  0,  0,
-  0,  0, 35,  0,170,  0,  0,  0,229,  1,  0,  0,  0,  0, 35,  0,171,  0,  0,  0,228,  1,  0,  0,  0,  0, 35,  0, 64,  1,  0,  0,
-228,  1,  0,  0,  0,  0, 35,  0,171,  0,  0,  0, 64,  1,  0,  0,  0,  0, 35,  0, 69,  1,  0,  0,230,  1,  0,  0,  0,  0, 35,  0,
-223,  0,  0,  0, 69,  1,  0,  0,  0,  0, 35,  0,223,  0,  0,  0,230,  1,  0,  0,  0,  0, 35,  0,230,  1,  0,  0,231,  1,  0,  0,
-  0,  0, 35,  0,231,  1,  0,  0,232,  1,  0,  0,  0,  0, 35,  0,230,  1,  0,  0,232,  1,  0,  0,  0,  0, 35,  0,189,  0,  0,  0,
- 68,  1,  0,  0,  0,  0, 35,  0, 68,  1,  0,  0,232,  1,  0,  0,  0,  0, 35,  0,189,  0,  0,  0,232,  1,  0,  0,  0,  0, 35,  0,
-188,  0,  0,  0,231,  1,  0,  0,  0,  0, 35,  0,222,  0,  0,  0,231,  1,  0,  0,  0,  0, 35,  0,188,  0,  0,  0,222,  0,  0,  0,
-  0,  0, 35,  0, 68,  1,  0,  0,233,  1,  0,  0,  0,  0, 35,  0, 68,  1,  0,  0, 70,  1,  0,  0,  0,  0, 35,  0, 70,  1,  0,  0,
-233,  1,  0,  0,  0,  0, 35,  0,233,  1,  0,  0,234,  1,  0,  0,  0,  0, 35,  0,234,  1,  0,  0,235,  1,  0,  0,  0,  0, 35,  0,
-233,  1,  0,  0,235,  1,  0,  0,  0,  0, 35,  0, 69,  1,  0,  0, 73,  1,  0,  0,  0,  0, 35,  0, 69,  1,  0,  0,235,  1,  0,  0,
-  0,  0, 35,  0, 73,  1,  0,  0,235,  1,  0,  0,  0,  0, 35,  0, 72,  1,  0,  0,234,  1,  0,  0,  0,  0, 35,  0, 71,  1,  0,  0,
-234,  1,  0,  0,  0,  0, 35,  0, 71,  1,  0,  0, 72,  1,  0,  0,  0,  0, 35,  0,220,  0,  0,  0,236,  1,  0,  0,  0,  0, 35,  0,
-220,  0,  0,  0,224,  0,  0,  0,  0,  0, 35,  0,224,  0,  0,  0,236,  1,  0,  0,  0,  0, 35,  0,236,  1,  0,  0,237,  1,  0,  0,
-  0,  0, 35,  0,237,  1,  0,  0,238,  1,  0,  0,  0,  0, 35,  0,236,  1,  0,  0,238,  1,  0,  0,  0,  0, 35,  0,221,  0,  0,  0,
- 72,  1,  0,  0,  0,  0, 35,  0,221,  0,  0,  0,238,  1,  0,  0,  0,  0, 35,  0, 72,  1,  0,  0,238,  1,  0,  0,  0,  0, 35,  0,
- 73,  1,  0,  0,237,  1,  0,  0,  0,  0, 35,  0,225,  0,  0,  0,237,  1,  0,  0,  0,  0, 35,  0,225,  0,  0,  0, 73,  1,  0,  0,
-  0,  0, 35,  0,219,  0,  0,  0,239,  1,  0,  0,  0,  0, 35,  0,219,  0,  0,  0, 71,  1,  0,  0,  0,  0, 35,  0, 71,  1,  0,  0,
-239,  1,  0,  0,  0,  0, 35,  0,239,  1,  0,  0,240,  1,  0,  0,  0,  0, 35,  0,240,  1,  0,  0,241,  1,  0,  0,  0,  0, 35,  0,
-239,  1,  0,  0,241,  1,  0,  0,  0,  0, 35,  0,186,  0,  0,  0,218,  0,  0,  0,  0,  0, 35,  0,218,  0,  0,  0,241,  1,  0,  0,
-  0,  0, 35,  0,186,  0,  0,  0,241,  1,  0,  0,  0,  0, 35,  0,187,  0,  0,  0,240,  1,  0,  0,  0,  0, 35,  0, 70,  1,  0,  0,
-240,  1,  0,  0,  0,  0, 35,  0,187,  0,  0,  0, 70,  1,  0,  0,  0,  0, 35,  0, 75,  1,  0,  0,242,  1,  0,  0,  0,  0, 35,  0,
-231,  0,  0,  0, 75,  1,  0,  0,  0,  0, 35,  0,231,  0,  0,  0,242,  1,  0,  0,  0,  0, 35,  0,242,  1,  0,  0,243,  1,  0,  0,
-  0,  0, 35,  0,243,  1,  0,  0,244,  1,  0,  0,  0,  0, 35,  0,242,  1,  0,  0,244,  1,  0,  0,  0,  0, 35,  0,197,  0,  0,  0,
- 74,  1,  0,  0,  0,  0, 35,  0, 74,  1,  0,  0,244,  1,  0,  0,  0,  0, 35,  0,197,  0,  0,  0,244,  1,  0,  0,  0,  0, 35,  0,
-196,  0,  0,  0,243,  1,  0,  0,  0,  0, 35,  0,230,  0,  0,  0,243,  1,  0,  0,  0,  0, 35,  0,196,  0,  0,  0,230,  0,  0,  0,
-  0,  0, 35,  0, 74,  1,  0,  0,245,  1,  0,  0,  0,  0, 35,  0, 74,  1,  0,  0, 76,  1,  0,  0,  0,  0, 35,  0, 76,  1,  0,  0,
-245,  1,  0,  0,  0,  0, 35,  0,245,  1,  0,  0,246,  1,  0,  0,  0,  0, 35,  0,246,  1,  0,  0,247,  1,  0,  0,  0,  0, 35,  0,
-245,  1,  0,  0,247,  1,  0,  0,  0,  0, 35,  0, 75,  1,  0,  0, 79,  1,  0,  0,  0,  0, 35,  0, 75,  1,  0,  0,247,  1,  0,  0,
-  0,  0, 35,  0, 79,  1,  0,  0,247,  1,  0,  0,  0,  0, 35,  0, 78,  1,  0,  0,246,  1,  0,  0,  0,  0, 35,  0, 77,  1,  0,  0,
-246,  1,  0,  0,  0,  0, 35,  0, 77,  1,  0,  0, 78,  1,  0,  0,  0,  0, 35,  0,228,  0,  0,  0,248,  1,  0,  0,  0,  0, 35,  0,
-228,  0,  0,  0,232,  0,  0,  0,  0,  0, 35,  0,232,  0,  0,  0,248,  1,  0,  0,  0,  0, 35,  0,248,  1,  0,  0,249,  1,  0,  0,
-  0,  0, 35,  0,249,  1,  0,  0,250,  1,  0,  0,  0,  0, 35,  0,248,  1,  0,  0,250,  1,  0,  0,  0,  0, 35,  0,229,  0,  0,  0,
- 78,  1,  0,  0,  0,  0, 35,  0,229,  0,  0,  0,250,  1,  0,  0,  0,  0, 35,  0, 78,  1,  0,  0,250,  1,  0,  0,  0,  0, 35,  0,
- 79,  1,  0,  0,249,  1,  0,  0,  0,  0, 35,  0,233,  0,  0,  0,249,  1,  0,  0,  0,  0, 35,  0,233,  0,  0,  0, 79,  1,  0,  0,
-  0,  0, 35,  0,227,  0,  0,  0,251,  1,  0,  0,  0,  0, 35,  0,227,  0,  0,  0, 77,  1,  0,  0,  0,  0, 35,  0, 77,  1,  0,  0,
-251,  1,  0,  0,  0,  0, 35,  0,251,  1,  0,  0,252,  1,  0,  0,  0,  0, 35,  0,252,  1,  0,  0,253,  1,  0,  0,  0,  0, 35,  0,
-251,  1,  0,  0,253,  1,  0,  0,  0,  0, 35,  0,194,  0,  0,  0,226,  0,  0,  0,  0,  0, 35,  0,226,  0,  0,  0,253,  1,  0,  0,
-  0,  0, 35,  0,194,  0,  0,  0,253,  1,  0,  0,  0,  0, 35,  0,195,  0,  0,  0,252,  1,  0,  0,  0,  0, 35,  0, 76,  1,  0,  0,
-252,  1,  0,  0,  0,  0, 35,  0,195,  0,  0,  0, 76,  1,  0,  0,  0,  0, 35,  0, 81,  1,  0,  0,254,  1,  0,  0,  0,  0, 35,  0,
-239,  0,  0,  0, 81,  1,  0,  0,  0,  0, 35,  0,239,  0,  0,  0,254,  1,  0,  0,  0,  0, 35,  0,254,  1,  0,  0,255,  1,  0,  0,
-  0,  0, 35,  0,255,  1,  0,  0,  0,  2,  0,  0,  0,  0, 35,  0,254,  1,  0,  0,  0,  2,  0,  0,  0,  0, 35,  0,201,  0,  0,  0,
- 80,  1,  0,  0,  0,  0, 35,  0, 80,  1,  0,  0,  0,  2,  0,  0,  0,  0, 35,  0,201,  0,  0,  0,  0,  2,  0,  0,  0,  0, 35,  0,
-200,  0,  0,  0,255,  1,  0,  0,  0,  0, 35,  0,238,  0,  0,  0,255,  1,  0,  0,  0,  0, 35,  0,200,  0,  0,  0,238,  0,  0,  0,
-  0,  0, 35,  0, 80,  1,  0,  0,  1,  2,  0,  0,  0,  0, 35,  0, 80,  1,  0,  0, 82,  1,  0,  0,  0,  0, 35,  0, 82,  1,  0,  0,
-  1,  2,  0,  0,  0,  0, 35,  0,  1,  2,  0,  0,  2,  2,  0,  0,  0,  0, 35,  0,  2,  2,  0,  0,  3,  2,  0,  0,  0,  0, 35,  0,
-  1,  2,  0,  0,  3,  2,  0,  0,  0,  0, 35,  0, 81,  1,  0,  0, 85,  1,  0,  0,  0,  0, 35,  0, 81,  1,  0,  0,  3,  2,  0,  0,
-  0,  0, 35,  0, 85,  1,  0,  0,  3,  2,  0,  0,  0,  0, 35,  0, 84,  1,  0,  0,  2,  2,  0,  0,  0,  0, 35,  0, 83,  1,  0,  0,
-  2,  2,  0,  0,  0,  0, 35,  0, 83,  1,  0,  0, 84,  1,  0,  0,  0,  0, 35,  0,236,  0,  0,  0,  4,  2,  0,  0,  0,  0, 35,  0,
-236,  0,  0,  0,240,  0,  0,  0,  0,  0, 35,  0,240,  0,  0,  0,  4,  2,  0,  0,  0,  0, 35,  0,  4,  2,  0,  0,  5,  2,  0,  0,
-  0,  0, 35,  0,  5,  2,  0,  0,  6,  2,  0,  0,  0,  0, 35,  0,  4,  2,  0,  0,  6,  2,  0,  0,  0,  0, 35,  0,237,  0,  0,  0,
- 84,  1,  0,  0,  0,  0, 35,  0,237,  0,  0,  0,  6,  2,  0,  0,  0,  0, 35,  0, 84,  1,  0,  0,  6,  2,  0,  0,  0,  0, 35,  0,
- 85,  1,  0,  0,  5,  2,  0,  0,  0,  0, 35,  0,241,  0,  0,  0,  5,  2,  0,  0,  0,  0, 35,  0,241,  0,  0,  0, 85,  1,  0,  0,
-  0,  0, 35,  0,235,  0,  0,  0,  7,  2,  0,  0,  0,  0, 35,  0,235,  0,  0,  0, 83,  1,  0,  0,  0,  0, 35,  0, 83,  1,  0,  0,
-  7,  2,  0,  0,  0,  0, 35,  0,  7,  2,  0,  0,  8,  2,  0,  0,  0,  0, 35,  0,  8,  2,  0,  0,  9,  2,  0,  0,  0,  0, 35,  0,
-  7,  2,  0,  0,  9,  2,  0,  0,  0,  0, 35,  0,198,  0,  0,  0,234,  0,  0,  0,  0,  0, 35,  0,234,  0,  0,  0,  9,  2,  0,  0,
-  0,  0, 35,  0,198,  0,  0,  0,  9,  2,  0,  0,  0,  0, 35,  0,199,  0,  0,  0,  8,  2,  0,  0,  0,  0, 35,  0, 82,  1,  0,  0,
-  8,  2,  0,  0,  0,  0, 35,  0,199,  0,  0,  0, 82,  1,  0,  0,  0,  0, 35,  0, 87,  1,  0,  0, 10,  2,  0,  0,  0,  0, 35,  0,
-245,  0,  0,  0, 10,  2,  0,  0,  0,  0, 35,  0,245,  0,  0,  0, 87,  1,  0,  0,  0,  0, 35,  0, 10,  2,  0,  0, 11,  2,  0,  0,
-  0,  0, 35,  0, 10,  2,  0,  0, 12,  2,  0,  0,  0,  0, 35,  0, 11,  2,  0,  0, 12,  2,  0,  0,  0,  0, 35,  0,209,  0,  0,  0,
- 86,  1,  0,  0,  0,  0, 35,  0,209,  0,  0,  0, 12,  2,  0,  0,  0,  0, 35,  0, 86,  1,  0,  0, 12,  2,  0,  0,  0,  0, 35,  0,
-208,  0,  0,  0, 11,  2,  0,  0,  0,  0, 35,  0,208,  0,  0,  0,244,  0,  0,  0,  0,  0, 35,  0,244,  0,  0,  0, 11,  2,  0,  0,
-  0,  0, 35,  0, 86,  1,  0,  0, 13,  2,  0,  0,  0,  0, 35,  0, 88,  1,  0,  0, 13,  2,  0,  0,  0,  0, 35,  0, 86,  1,  0,  0,
- 88,  1,  0,  0,  0,  0, 35,  0, 13,  2,  0,  0, 14,  2,  0,  0,  0,  0, 35,  0, 13,  2,  0,  0, 15,  2,  0,  0,  0,  0, 35,  0,
- 14,  2,  0,  0, 15,  2,  0,  0,  0,  0, 35,  0, 87,  1,  0,  0, 91,  1,  0,  0,  0,  0, 35,  0, 91,  1,  0,  0, 15,  2,  0,  0,
-  0,  0, 35,  0, 87,  1,  0,  0, 15,  2,  0,  0,  0,  0, 35,  0, 90,  1,  0,  0, 14,  2,  0,  0,  0,  0, 35,  0, 89,  1,  0,  0,
- 90,  1,  0,  0,  0,  0, 35,  0, 89,  1,  0,  0, 14,  2,  0,  0,  0,  0, 35,  0,212,  0,  0,  0, 16,  2,  0,  0,  0,  0, 35,  0,
-242,  0,  0,  0, 16,  2,  0,  0,  0,  0, 35,  0,212,  0,  0,  0,242,  0,  0,  0,  0,  0, 35,  0, 16,  2,  0,  0, 17,  2,  0,  0,
-  0,  0, 35,  0, 16,  2,  0,  0, 18,  2,  0,  0,  0,  0, 35,  0, 17,  2,  0,  0, 18,  2,  0,  0,  0,  0, 35,  0,213,  0,  0,  0,
- 90,  1,  0,  0,  0,  0, 35,  0, 90,  1,  0,  0, 18,  2,  0,  0,  0,  0, 35,  0,213,  0,  0,  0, 18,  2,  0,  0,  0,  0, 35,  0,
- 91,  1,  0,  0, 17,  2,  0,  0,  0,  0, 35,  0,243,  0,  0,  0, 91,  1,  0,  0,  0,  0, 35,  0,243,  0,  0,  0, 17,  2,  0,  0,
-  0,  0, 35,  0,211,  0,  0,  0, 19,  2,  0,  0,  0,  0, 35,  0, 89,  1,  0,  0, 19,  2,  0,  0,  0,  0, 35,  0,211,  0,  0,  0,
- 89,  1,  0,  0,  0,  0, 35,  0, 19,  2,  0,  0, 20,  2,  0,  0,  0,  0, 35,  0, 19,  2,  0,  0, 21,  2,  0,  0,  0,  0, 35,  0,
- 20,  2,  0,  0, 21,  2,  0,  0,  0,  0, 35,  0,206,  0,  0,  0,210,  0,  0,  0,  0,  0, 35,  0,206,  0,  0,  0, 21,  2,  0,  0,
-  0,  0, 35,  0,210,  0,  0,  0, 21,  2,  0,  0,  0,  0, 35,  0,207,  0,  0,  0, 20,  2,  0,  0,  0,  0, 35,  0,207,  0,  0,  0,
- 88,  1,  0,  0,  0,  0, 35,  0, 88,  1,  0,  0, 20,  2,  0,  0,  0,  0, 35,  0, 93,  1,  0,  0, 22,  2,  0,  0,  0,  0, 35,  0,
-247,  0,  0,  0, 22,  2,  0,  0,  0,  0, 35,  0,247,  0,  0,  0, 93,  1,  0,  0,  0,  0, 35,  0, 22,  2,  0,  0, 23,  2,  0,  0,
-  0,  0, 35,  0, 22,  2,  0,  0, 24,  2,  0,  0,  0,  0, 35,  0, 23,  2,  0,  0, 24,  2,  0,  0,  0,  0, 35,  0,217,  0,  0,  0,
- 92,  1,  0,  0,  0,  0, 35,  0,217,  0,  0,  0, 24,  2,  0,  0,  0,  0, 35,  0, 92,  1,  0,  0, 24,  2,  0,  0,  0,  0, 35,  0,
-216,  0,  0,  0, 23,  2,  0,  0,  0,  0, 35,  0,216,  0,  0,  0,246,  0,  0,  0,  0,  0, 35,  0,246,  0,  0,  0, 23,  2,  0,  0,
-  0,  0, 35,  0, 92,  1,  0,  0, 25,  2,  0,  0,  0,  0, 35,  0, 94,  1,  0,  0, 25,  2,  0,  0,  0,  0, 35,  0, 92,  1,  0,  0,
- 94,  1,  0,  0,  0,  0, 35,  0, 25,  2,  0,  0, 26,  2,  0,  0,  0,  0, 35,  0, 25,  2,  0,  0, 27,  2,  0,  0,  0,  0, 35,  0,
- 26,  2,  0,  0, 27,  2,  0,  0,  0,  0, 35,  0, 93,  1,  0,  0, 97,  1,  0,  0,  0,  0, 35,  0, 97,  1,  0,  0, 27,  2,  0,  0,
-  0,  0, 35,  0, 93,  1,  0,  0, 27,  2,  0,  0,  0,  0, 35,  0, 96,  1,  0,  0, 26,  2,  0,  0,  0,  0, 35,  0, 95,  1,  0,  0,
- 96,  1,  0,  0,  0,  0, 35,  0, 95,  1,  0,  0, 26,  2,  0,  0,  0,  0, 35,  0,220,  0,  0,  0, 28,  2,  0,  0,  0,  0, 35,  0,
-248,  0,  0,  0, 28,  2,  0,  0,  0,  0, 35,  0,220,  0,  0,  0,248,  0,  0,  0,  0,  0, 35,  0, 28,  2,  0,  0, 29,  2,  0,  0,
-  0,  0, 35,  0, 28,  2,  0,  0, 30,  2,  0,  0,  0,  0, 35,  0, 29,  2,  0,  0, 30,  2,  0,  0,  0,  0, 35,  0,221,  0,  0,  0,
- 96,  1,  0,  0,  0,  0, 35,  0, 96,  1,  0,  0, 30,  2,  0,  0,  0,  0, 35,  0,221,  0,  0,  0, 30,  2,  0,  0,  0,  0, 35,  0,
- 97,  1,  0,  0, 29,  2,  0,  0,  0,  0, 35,  0,249,  0,  0,  0, 97,  1,  0,  0,  0,  0, 35,  0,249,  0,  0,  0, 29,  2,  0,  0,
-  0,  0, 35,  0,219,  0,  0,  0, 31,  2,  0,  0,  0,  0, 35,  0, 95,  1,  0,  0, 31,  2,  0,  0,  0,  0, 35,  0,219,  0,  0,  0,
- 95,  1,  0,  0,  0,  0, 35,  0, 31,  2,  0,  0, 32,  2,  0,  0,  0,  0, 35,  0, 31,  2,  0,  0, 33,  2,  0,  0,  0,  0, 35,  0,
- 32,  2,  0,  0, 33,  2,  0,  0,  0,  0, 35,  0,214,  0,  0,  0,218,  0,  0,  0,  0,  0, 35,  0,214,  0,  0,  0, 33,  2,  0,  0,
-  0,  0, 35,  0,218,  0,  0,  0, 33,  2,  0,  0,  0,  0, 35,  0,215,  0,  0,  0, 32,  2,  0,  0,  0,  0, 35,  0,215,  0,  0,  0,
- 94,  1,  0,  0,  0,  0, 35,  0, 94,  1,  0,  0, 32,  2,  0,  0,  0,  0, 35,  0, 99,  1,  0,  0, 34,  2,  0,  0,  0,  0, 35,  0,
-251,  0,  0,  0, 34,  2,  0,  0,  0,  0, 35,  0,251,  0,  0,  0, 99,  1,  0,  0,  0,  0, 35,  0, 34,  2,  0,  0, 35,  2,  0,  0,
-  0,  0, 35,  0, 34,  2,  0,  0, 36,  2,  0,  0,  0,  0, 35,  0, 35,  2,  0,  0, 36,  2,  0,  0,  0,  0, 35,  0,225,  0,  0,  0,
- 98,  1,  0,  0,  0,  0, 35,  0,225,  0,  0,  0, 36,  2,  0,  0,  0,  0, 35,  0, 98,  1,  0,  0, 36,  2,  0,  0,  0,  0, 35,  0,
-224,  0,  0,  0, 35,  2,  0,  0,  0,  0, 35,  0,224,  0,  0,  0,250,  0,  0,  0,  0,  0, 35,  0,250,  0,  0,  0, 35,  2,  0,  0,
-  0,  0, 35,  0, 98,  1,  0,  0, 37,  2,  0,  0,  0,  0, 35,  0,100,  1,  0,  0, 37,  2,  0,  0,  0,  0, 35,  0, 98,  1,  0,  0,
-100,  1,  0,  0,  0,  0, 35,  0, 37,  2,  0,  0, 38,  2,  0,  0,  0,  0, 35,  0, 37,  2,  0,  0, 39,  2,  0,  0,  0,  0, 35,  0,
- 38,  2,  0,  0, 39,  2,  0,  0,  0,  0, 35,  0, 99,  1,  0,  0,103,  1,  0,  0,  0,  0, 35,  0,103,  1,  0,  0, 39,  2,  0,  0,
-  0,  0, 35,  0, 99,  1,  0,  0, 39,  2,  0,  0,  0,  0, 35,  0,102,  1,  0,  0, 38,  2,  0,  0,  0,  0, 35,  0,101,  1,  0,  0,
-102,  1,  0,  0,  0,  0, 35,  0,101,  1,  0,  0, 38,  2,  0,  0,  0,  0, 35,  0,228,  0,  0,  0, 40,  2,  0,  0,  0,  0, 35,  0,
-252,  0,  0,  0, 40,  2,  0,  0,  0,  0, 35,  0,228,  0,  0,  0,252,  0,  0,  0,  0,  0, 35,  0, 40,  2,  0,  0, 41,  2,  0,  0,
-  0,  0, 35,  0, 40,  2,  0,  0, 42,  2,  0,  0,  0,  0, 35,  0, 41,  2,  0,  0, 42,  2,  0,  0,  0,  0, 35,  0,229,  0,  0,  0,
-102,  1,  0,  0,  0,  0, 35,  0,102,  1,  0,  0, 42,  2,  0,  0,  0,  0, 35,  0,229,  0,  0,  0, 42,  2,  0,  0,  0,  0, 35,  0,
-103,  1,  0,  0, 41,  2,  0,  0,  0,  0, 35,  0,253,  0,  0,  0,103,  1,  0,  0,  0,  0, 35,  0,253,  0,  0,  0, 41,  2,  0,  0,
-  0,  0, 35,  0,227,  0,  0,  0, 43,  2,  0,  0,  0,  0, 35,  0,101,  1,  0,  0, 43,  2,  0,  0,  0,  0, 35,  0,227,  0,  0,  0,
-101,  1,  0,  0,  0,  0, 35,  0, 43,  2,  0,  0, 44,  2,  0,  0,  0,  0, 35,  0, 43,  2,  0,  0, 45,  2,  0,  0,  0,  0, 35,  0,
- 44,  2,  0,  0, 45,  2,  0,  0,  0,  0, 35,  0,222,  0,  0,  0,226,  0,  0,  0,  0,  0, 35,  0,222,  0,  0,  0, 45,  2,  0,  0,
-  0,  0, 35,  0,226,  0,  0,  0, 45,  2,  0,  0,  0,  0, 35,  0,223,  0,  0,  0, 44,  2,  0,  0,  0,  0, 35,  0,223,  0,  0,  0,
-100,  1,  0,  0,  0,  0, 35,  0,100,  1,  0,  0, 44,  2,  0,  0,  0,  0, 35,  0,105,  1,  0,  0, 46,  2,  0,  0,  0,  0, 35,  0,
-255,  0,  0,  0, 46,  2,  0,  0,  0,  0, 35,  0,255,  0,  0,  0,105,  1,  0,  0,  0,  0, 35,  0, 46,  2,  0,  0, 47,  2,  0,  0,
-  0,  0, 35,  0, 46,  2,  0,  0, 48,  2,  0,  0,  0,  0, 35,  0, 47,  2,  0,  0, 48,  2,  0,  0,  0,  0, 35,  0,233,  0,  0,  0,
-104,  1,  0,  0,  0,  0, 35,  0,233,  0,  0,  0, 48,  2,  0,  0,  0,  0, 35,  0,104,  1,  0,  0, 48,  2,  0,  0,  0,  0, 35,  0,
-232,  0,  0,  0, 47,  2,  0,  0,  0,  0, 35,  0,232,  0,  0,  0,254,  0,  0,  0,  0,  0, 35,  0,254,  0,  0,  0, 47,  2,  0,  0,
-  0,  0, 35,  0,104,  1,  0,  0, 49,  2,  0,  0,  0,  0, 35,  0,106,  1,  0,  0, 49,  2,  0,  0,  0,  0, 35,  0,104,  1,  0,  0,
-106,  1,  0,  0,  0,  0, 35,  0, 49,  2,  0,  0, 50,  2,  0,  0,  0,  0, 35,  0, 49,  2,  0,  0, 51,  2,  0,  0,  0,  0, 35,  0,
- 50,  2,  0,  0, 51,  2,  0,  0,  0,  0, 35,  0,105,  1,  0,  0,109,  1,  0,  0,  0,  0, 35,  0,109,  1,  0,  0, 51,  2,  0,  0,
-  0,  0, 35,  0,105,  1,  0,  0, 51,  2,  0,  0,  0,  0, 35,  0,108,  1,  0,  0, 50,  2,  0,  0,  0,  0, 35,  0,107,  1,  0,  0,
-108,  1,  0,  0,  0,  0, 35,  0,107,  1,  0,  0, 50,  2,  0,  0,  0,  0, 35,  0,236,  0,  0,  0, 52,  2,  0,  0,  0,  0, 35,  0,
-  0,  1,  0,  0, 52,  2,  0,  0,  0,  0, 35,  0,236,  0,  0,  0,  0,  1,  0,  0,  0,  0, 35,  0, 52,  2,  0,  0, 53,  2,  0,  0,
-  0,  0, 35,  0, 52,  2,  0,  0, 54,  2,  0,  0,  0,  0, 35,  0, 53,  2,  0,  0, 54,  2,  0,  0,  0,  0, 35,  0,237,  0,  0,  0,
-108,  1,  0,  0,  0,  0, 35,  0,108,  1,  0,  0, 54,  2,  0,  0,  0,  0, 35,  0,237,  0,  0,  0, 54,  2,  0,  0,  0,  0, 35,  0,
-109,  1,  0,  0, 53,  2,  0,  0,  0,  0, 35,  0,  1,  1,  0,  0,109,  1,  0,  0,  0,  0, 35,  0,  1,  1,  0,  0, 53,  2,  0,  0,
-  0,  0, 35,  0,235,  0,  0,  0, 55,  2,  0,  0,  0,  0, 35,  0,107,  1,  0,  0, 55,  2,  0,  0,  0,  0, 35,  0,235,  0,  0,  0,
-107,  1,  0,  0,  0,  0, 35,  0, 55,  2,  0,  0, 56,  2,  0,  0,  0,  0, 35,  0, 55,  2,  0,  0, 57,  2,  0,  0,  0,  0, 35,  0,
- 56,  2,  0,  0, 57,  2,  0,  0,  0,  0, 35,  0,230,  0,  0,  0,234,  0,  0,  0,  0,  0, 35,  0,230,  0,  0,  0, 57,  2,  0,  0,
-  0,  0, 35,  0,234,  0,  0,  0, 57,  2,  0,  0,  0,  0, 35,  0,231,  0,  0,  0, 56,  2,  0,  0,  0,  0, 35,  0,231,  0,  0,  0,
-106,  1,  0,  0,  0,  0, 35,  0,106,  1,  0,  0, 56,  2,  0,  0,  0,  0, 35,  0,111,  1,  0,  0, 58,  2,  0,  0,  0,  0, 35,  0,
-  3,  1,  0,  0, 58,  2,  0,  0,  0,  0, 35,  0,  3,  1,  0,  0,111,  1,  0,  0,  0,  0, 35,  0, 58,  2,  0,  0, 59,  2,  0,  0,
-  0,  0, 35,  0, 58,  2,  0,  0, 60,  2,  0,  0,  0,  0, 35,  0, 59,  2,  0,  0, 60,  2,  0,  0,  0,  0, 35,  0,241,  0,  0,  0,
-110,  1,  0,  0,  0,  0, 35,  0,241,  0,  0,  0, 60,  2,  0,  0,  0,  0, 35,  0,110,  1,  0,  0, 60,  2,  0,  0,  0,  0, 35,  0,
-240,  0,  0,  0, 59,  2,  0,  0,  0,  0, 35,  0,240,  0,  0,  0,  2,  1,  0,  0,  0,  0, 35,  0,  2,  1,  0,  0, 59,  2,  0,  0,
-  0,  0, 35,  0,110,  1,  0,  0, 61,  2,  0,  0,  0,  0, 35,  0,113,  1,  0,  0, 61,  2,  0,  0,  0,  0, 35,  0,110,  1,  0,  0,
-113,  1,  0,  0,  0,  0, 35,  0, 61,  2,  0,  0, 62,  2,  0,  0,  0,  0, 35,  0, 61,  2,  0,  0, 63,  2,  0,  0,  0,  0, 35,  0,
- 62,  2,  0,  0, 63,  2,  0,  0,  0,  0, 35,  0,111,  1,  0,  0,115,  1,  0,  0,  0,  0, 35,  0,115,  1,  0,  0, 63,  2,  0,  0,
-  0,  0, 35,  0,111,  1,  0,  0, 63,  2,  0,  0,  0,  0, 35,  0,114,  1,  0,  0, 62,  2,  0,  0,  0,  0, 35,  0,112,  1,  0,  0,
-114,  1,  0,  0,  0,  0, 35,  0,112,  1,  0,  0, 62,  2,  0,  0,  0,  0, 35,  0,204,  0,  0,  0, 64,  2,  0,  0,  0,  0, 35,  0,
-  4,  1,  0,  0, 64,  2,  0,  0,  0,  0, 35,  0,204,  0,  0,  0,  4,  1,  0,  0,  0,  0, 35,  0, 64,  2,  0,  0, 65,  2,  0,  0,
-  0,  0, 35,  0, 64,  2,  0,  0, 66,  2,  0,  0,  0,  0, 35,  0, 65,  2,  0,  0, 66,  2,  0,  0,  0,  0, 35,  0,205,  0,  0,  0,
-114,  1,  0,  0,  0,  0, 35,  0,114,  1,  0,  0, 66,  2,  0,  0,  0,  0, 35,  0,205,  0,  0,  0, 66,  2,  0,  0,  0,  0, 35,  0,
-115,  1,  0,  0, 65,  2,  0,  0,  0,  0, 35,  0,  5,  1,  0,  0,115,  1,  0,  0,  0,  0, 35,  0,  5,  1,  0,  0, 65,  2,  0,  0,
-  0,  0, 35,  0,203,  0,  0,  0, 67,  2,  0,  0,  0,  0, 35,  0,112,  1,  0,  0, 67,  2,  0,  0,  0,  0, 35,  0,203,  0,  0,  0,
-112,  1,  0,  0,  0,  0, 35,  0, 67,  2,  0,  0, 68,  2,  0,  0,  0,  0, 35,  0, 67,  2,  0,  0, 69,  2,  0,  0,  0,  0, 35,  0,
- 68,  2,  0,  0, 69,  2,  0,  0,  0,  0, 35,  0,202,  0,  0,  0,238,  0,  0,  0,  0,  0, 35,  0,238,  0,  0,  0, 69,  2,  0,  0,
-  0,  0, 35,  0,202,  0,  0,  0, 69,  2,  0,  0,  0,  0, 35,  0,239,  0,  0,  0, 68,  2,  0,  0,  0,  0, 35,  0,239,  0,  0,  0,
-113,  1,  0,  0,  0,  0, 35,  0,113,  1,  0,  0, 68,  2,  0,  0,  0,  0, 35,  0,117,  1,  0,  0, 70,  2,  0,  0,  0,  0, 35,  0,
- 11,  1,  0,  0,117,  1,  0,  0,  0,  0, 35,  0, 11,  1,  0,  0, 70,  2,  0,  0,  0,  0, 35,  0, 70,  2,  0,  0, 71,  2,  0,  0,
-  0,  0, 35,  0, 71,  2,  0,  0, 72,  2,  0,  0,  0,  0, 35,  0, 70,  2,  0,  0, 72,  2,  0,  0,  0,  0, 35,  0,243,  0,  0,  0,
-116,  1,  0,  0,  0,  0, 35,  0,116,  1,  0,  0, 72,  2,  0,  0,  0,  0, 35,  0,243,  0,  0,  0, 72,  2,  0,  0,  0,  0, 35,  0,
-242,  0,  0,  0, 71,  2,  0,  0,  0,  0, 35,  0, 10,  1,  0,  0, 71,  2,  0,  0,  0,  0, 35,  0,242,  0,  0,  0, 10,  1,  0,  0,
-  0,  0, 35,  0,116,  1,  0,  0, 73,  2,  0,  0,  0,  0, 35,  0,116,  1,  0,  0,118,  1,  0,  0,  0,  0, 35,  0,118,  1,  0,  0,
- 73,  2,  0,  0,  0,  0, 35,  0, 73,  2,  0,  0, 74,  2,  0,  0,  0,  0, 35,  0, 74,  2,  0,  0, 75,  2,  0,  0,  0,  0, 35,  0,
- 73,  2,  0,  0, 75,  2,  0,  0,  0,  0, 35,  0,117,  1,  0,  0,121,  1,  0,  0,  0,  0, 35,  0,117,  1,  0,  0, 75,  2,  0,  0,
-  0,  0, 35,  0,121,  1,  0,  0, 75,  2,  0,  0,  0,  0, 35,  0,120,  1,  0,  0, 74,  2,  0,  0,  0,  0, 35,  0,119,  1,  0,  0,
- 74,  2,  0,  0,  0,  0, 35,  0,119,  1,  0,  0,120,  1,  0,  0,  0,  0, 35,  0,  8,  1,  0,  0, 76,  2,  0,  0,  0,  0, 35,  0,
-  8,  1,  0,  0, 12,  1,  0,  0,  0,  0, 35,  0, 12,  1,  0,  0, 76,  2,  0,  0,  0,  0, 35,  0, 76,  2,  0,  0, 77,  2,  0,  0,
-  0,  0, 35,  0, 77,  2,  0,  0, 78,  2,  0,  0,  0,  0, 35,  0, 76,  2,  0,  0, 78,  2,  0,  0,  0,  0, 35,  0,  9,  1,  0,  0,
-120,  1,  0,  0,  0,  0, 35,  0,  9,  1,  0,  0, 78,  2,  0,  0,  0,  0, 35,  0,120,  1,  0,  0, 78,  2,  0,  0,  0,  0, 35,  0,
-121,  1,  0,  0, 77,  2,  0,  0,  0,  0, 35,  0, 13,  1,  0,  0, 77,  2,  0,  0,  0,  0, 35,  0, 13,  1,  0,  0,121,  1,  0,  0,
-  0,  0, 35,  0,  7,  1,  0,  0, 79,  2,  0,  0,  0,  0, 35,  0,  7,  1,  0,  0,119,  1,  0,  0,  0,  0, 35,  0,119,  1,  0,  0,
- 79,  2,  0,  0,  0,  0, 35,  0, 79,  2,  0,  0, 80,  2,  0,  0,  0,  0, 35,  0, 80,  2,  0,  0, 81,  2,  0,  0,  0,  0, 35,  0,
- 79,  2,  0,  0, 81,  2,  0,  0,  0,  0, 35,  0,244,  0,  0,  0,  6,  1,  0,  0,  0,  0, 35,  0,  6,  1,  0,  0, 81,  2,  0,  0,
-  0,  0, 35,  0,244,  0,  0,  0, 81,  2,  0,  0,  0,  0, 35,  0,245,  0,  0,  0, 80,  2,  0,  0,  0,  0, 35,  0,118,  1,  0,  0,
- 80,  2,  0,  0,  0,  0, 35,  0,245,  0,  0,  0,118,  1,  0,  0,  0,  0, 35,  0,123,  1,  0,  0, 82,  2,  0,  0,  0,  0, 35,  0,
- 15,  1,  0,  0,123,  1,  0,  0,  0,  0, 35,  0, 15,  1,  0,  0, 82,  2,  0,  0,  0,  0, 35,  0, 82,  2,  0,  0, 83,  2,  0,  0,
-  0,  0, 35,  0, 83,  2,  0,  0, 84,  2,  0,  0,  0,  0, 35,  0, 82,  2,  0,  0, 84,  2,  0,  0,  0,  0, 35,  0,249,  0,  0,  0,
-122,  1,  0,  0,  0,  0, 35,  0,122,  1,  0,  0, 84,  2,  0,  0,  0,  0, 35,  0,249,  0,  0,  0, 84,  2,  0,  0,  0,  0, 35,  0,
-248,  0,  0,  0, 83,  2,  0,  0,  0,  0, 35,  0, 14,  1,  0,  0, 83,  2,  0,  0,  0,  0, 35,  0,248,  0,  0,  0, 14,  1,  0,  0,
-  0,  0, 35,  0,122,  1,  0,  0, 85,  2,  0,  0,  0,  0, 35,  0,122,  1,  0,  0,124,  1,  0,  0,  0,  0, 35,  0,124,  1,  0,  0,
- 85,  2,  0,  0,  0,  0, 35,  0, 85,  2,  0,  0, 86,  2,  0,  0,  0,  0, 35,  0, 86,  2,  0,  0, 87,  2,  0,  0,  0,  0, 35,  0,
- 85,  2,  0,  0, 87,  2,  0,  0,  0,  0, 35,  0,123,  1,  0,  0,127,  1,  0,  0,  0,  0, 35,  0,123,  1,  0,  0, 87,  2,  0,  0,
-  0,  0, 35,  0,127,  1,  0,  0, 87,  2,  0,  0,  0,  0, 35,  0,126,  1,  0,  0, 86,  2,  0,  0,  0,  0, 35,  0,125,  1,  0,  0,
- 86,  2,  0,  0,  0,  0, 35,  0,125,  1,  0,  0,126,  1,  0,  0,  0,  0, 35,  0, 12,  1,  0,  0, 88,  2,  0,  0,  0,  0, 35,  0,
- 12,  1,  0,  0, 16,  1,  0,  0,  0,  0, 35,  0, 16,  1,  0,  0, 88,  2,  0,  0,  0,  0, 35,  0, 88,  2,  0,  0, 89,  2,  0,  0,
-  0,  0, 35,  0, 89,  2,  0,  0, 90,  2,  0,  0,  0,  0, 35,  0, 88,  2,  0,  0, 90,  2,  0,  0,  0,  0, 35,  0, 13,  1,  0,  0,
-126,  1,  0,  0,  0,  0, 35,  0, 13,  1,  0,  0, 90,  2,  0,  0,  0,  0, 35,  0,126,  1,  0,  0, 90,  2,  0,  0,  0,  0, 35,  0,
-127,  1,  0,  0, 89,  2,  0,  0,  0,  0, 35,  0, 17,  1,  0,  0, 89,  2,  0,  0,  0,  0, 35,  0, 17,  1,  0,  0,127,  1,  0,  0,
-  0,  0, 35,  0, 11,  1,  0,  0, 91,  2,  0,  0,  0,  0, 35,  0, 11,  1,  0,  0,125,  1,  0,  0,  0,  0, 35,  0,125,  1,  0,  0,
- 91,  2,  0,  0,  0,  0, 35,  0, 91,  2,  0,  0, 92,  2,  0,  0,  0,  0, 35,  0, 92,  2,  0,  0, 93,  2,  0,  0,  0,  0, 35,  0,
- 91,  2,  0,  0, 93,  2,  0,  0,  0,  0, 35,  0,246,  0,  0,  0, 10,  1,  0,  0,  0,  0, 35,  0, 10,  1,  0,  0, 93,  2,  0,  0,
-  0,  0, 35,  0,246,  0,  0,  0, 93,  2,  0,  0,  0,  0, 35,  0,247,  0,  0,  0, 92,  2,  0,  0,  0,  0, 35,  0,124,  1,  0,  0,
- 92,  2,  0,  0,  0,  0, 35,  0,247,  0,  0,  0,124,  1,  0,  0,  0,  0, 35,  0,129,  1,  0,  0, 94,  2,  0,  0,  0,  0, 35,  0,
- 19,  1,  0,  0,129,  1,  0,  0,  0,  0, 35,  0, 19,  1,  0,  0, 94,  2,  0,  0,  0,  0, 35,  0, 94,  2,  0,  0, 95,  2,  0,  0,
-  0,  0, 35,  0, 95,  2,  0,  0, 96,  2,  0,  0,  0,  0, 35,  0, 94,  2,  0,  0, 96,  2,  0,  0,  0,  0, 35,  0,253,  0,  0,  0,
-128,  1,  0,  0,  0,  0, 35,  0,128,  1,  0,  0, 96,  2,  0,  0,  0,  0, 35,  0,253,  0,  0,  0, 96,  2,  0,  0,  0,  0, 35,  0,
-252,  0,  0,  0, 95,  2,  0,  0,  0,  0, 35,  0, 18,  1,  0,  0, 95,  2,  0,  0,  0,  0, 35,  0,252,  0,  0,  0, 18,  1,  0,  0,
-  0,  0, 35,  0,128,  1,  0,  0, 97,  2,  0,  0,  0,  0, 35,  0,128,  1,  0,  0,130,  1,  0,  0,  0,  0, 35,  0,130,  1,  0,  0,
- 97,  2,  0,  0,  0,  0, 35,  0, 97,  2,  0,  0, 98,  2,  0,  0,  0,  0, 35,  0, 98,  2,  0,  0, 99,  2,  0,  0,  0,  0, 35,  0,
- 97,  2,  0,  0, 99,  2,  0,  0,  0,  0, 35,  0,129,  1,  0,  0,133,  1,  0,  0,  0,  0, 35,  0,129,  1,  0,  0, 99,  2,  0,  0,
-  0,  0, 35,  0,133,  1,  0,  0, 99,  2,  0,  0,  0,  0, 35,  0,132,  1,  0,  0, 98,  2,  0,  0,  0,  0, 35,  0,131,  1,  0,  0,
- 98,  2,  0,  0,  0,  0, 35,  0,131,  1,  0,  0,132,  1,  0,  0,  0,  0, 35,  0, 16,  1,  0,  0,100,  2,  0,  0,  0,  0, 35,  0,
- 16,  1,  0,  0, 20,  1,  0,  0,  0,  0, 35,  0, 20,  1,  0,  0,100,  2,  0,  0,  0,  0, 35,  0,100,  2,  0,  0,101,  2,  0,  0,
-  0,  0, 35,  0,101,  2,  0,  0,102,  2,  0,  0,  0,  0, 35,  0,100,  2,  0,  0,102,  2,  0,  0,  0,  0, 35,  0, 17,  1,  0,  0,
-132,  1,  0,  0,  0,  0, 35,  0, 17,  1,  0,  0,102,  2,  0,  0,  0,  0, 35,  0,132,  1,  0,  0,102,  2,  0,  0,  0,  0, 35,  0,
-133,  1,  0,  0,101,  2,  0,  0,  0,  0, 35,  0, 21,  1,  0,  0,101,  2,  0,  0,  0,  0, 35,  0, 21,  1,  0,  0,133,  1,  0,  0,
-  0,  0, 35,  0, 15,  1,  0,  0,103,  2,  0,  0,  0,  0, 35,  0, 15,  1,  0,  0,131,  1,  0,  0,  0,  0, 35,  0,131,  1,  0,  0,
-103,  2,  0,  0,  0,  0, 35,  0,103,  2,  0,  0,104,  2,  0,  0,  0,  0, 35,  0,104,  2,  0,  0,105,  2,  0,  0,  0,  0, 35,  0,
-103,  2,  0,  0,105,  2,  0,  0,  0,  0, 35,  0,250,  0,  0,  0, 14,  1,  0,  0,  0,  0, 35,  0, 14,  1,  0,  0,105,  2,  0,  0,
-  0,  0, 35,  0,250,  0,  0,  0,105,  2,  0,  0,  0,  0, 35,  0,251,  0,  0,  0,104,  2,  0,  0,  0,  0, 35,  0,130,  1,  0,  0,
-104,  2,  0,  0,  0,  0, 35,  0,251,  0,  0,  0,130,  1,  0,  0,  0,  0, 35,  0,135,  1,  0,  0,106,  2,  0,  0,  0,  0, 35,  0,
- 23,  1,  0,  0,135,  1,  0,  0,  0,  0, 35,  0, 23,  1,  0,  0,106,  2,  0,  0,  0,  0, 35,  0,106,  2,  0,  0,107,  2,  0,  0,
-  0,  0, 35,  0,107,  2,  0,  0,108,  2,  0,  0,  0,  0, 35,  0,106,  2,  0,  0,108,  2,  0,  0,  0,  0, 35,  0,  1,  1,  0,  0,
-134,  1,  0,  0,  0,  0, 35,  0,134,  1,  0,  0,108,  2,  0,  0,  0,  0, 35,  0,  1,  1,  0,  0,108,  2,  0,  0,  0,  0, 35,  0,
-  0,  1,  0,  0,107,  2,  0,  0,  0,  0, 35,  0, 22,  1,  0,  0,107,  2,  0,  0,  0,  0, 35,  0,  0,  1,  0,  0, 22,  1,  0,  0,
-  0,  0, 35,  0,134,  1,  0,  0,109,  2,  0,  0,  0,  0, 35,  0,134,  1,  0,  0,136,  1,  0,  0,  0,  0, 35,  0,136,  1,  0,  0,
-109,  2,  0,  0,  0,  0, 35,  0,109,  2,  0,  0,110,  2,  0,  0,  0,  0, 35,  0,110,  2,  0,  0,111,  2,  0,  0,  0,  0, 35,  0,
-109,  2,  0,  0,111,  2,  0,  0,  0,  0, 35,  0,135,  1,  0,  0,139,  1,  0,  0,  0,  0, 35,  0,135,  1,  0,  0,111,  2,  0,  0,
-  0,  0, 35,  0,139,  1,  0,  0,111,  2,  0,  0,  0,  0, 35,  0,138,  1,  0,  0,110,  2,  0,  0,  0,  0, 35,  0,137,  1,  0,  0,
-110,  2,  0,  0,  0,  0, 35,  0,137,  1,  0,  0,138,  1,  0,  0,  0,  0, 35,  0, 20,  1,  0,  0,112,  2,  0,  0,  0,  0, 35,  0,
- 20,  1,  0,  0, 24,  1,  0,  0,  0,  0, 35,  0, 24,  1,  0,  0,112,  2,  0,  0,  0,  0, 35,  0,112,  2,  0,  0,113,  2,  0,  0,
-  0,  0, 35,  0,113,  2,  0,  0,114,  2,  0,  0,  0,  0, 35,  0,112,  2,  0,  0,114,  2,  0,  0,  0,  0, 35,  0, 21,  1,  0,  0,
-138,  1,  0,  0,  0,  0, 35,  0, 21,  1,  0,  0,114,  2,  0,  0,  0,  0, 35,  0,138,  1,  0,  0,114,  2,  0,  0,  0,  0, 35,  0,
-139,  1,  0,  0,113,  2,  0,  0,  0,  0, 35,  0, 25,  1,  0,  0,113,  2,  0,  0,  0,  0, 35,  0, 25,  1,  0,  0,139,  1,  0,  0,
-  0,  0, 35,  0, 19,  1,  0,  0,115,  2,  0,  0,  0,  0, 35,  0, 19,  1,  0,  0,137,  1,  0,  0,  0,  0, 35,  0,137,  1,  0,  0,
-115,  2,  0,  0,  0,  0, 35,  0,115,  2,  0,  0,116,  2,  0,  0,  0,  0, 35,  0,116,  2,  0,  0,117,  2,  0,  0,  0,  0, 35,  0,
-115,  2,  0,  0,117,  2,  0,  0,  0,  0, 35,  0,254,  0,  0,  0, 18,  1,  0,  0,  0,  0, 35,  0, 18,  1,  0,  0,117,  2,  0,  0,
-  0,  0, 35,  0,254,  0,  0,  0,117,  2,  0,  0,  0,  0, 35,  0,255,  0,  0,  0,116,  2,  0,  0,  0,  0, 35,  0,136,  1,  0,  0,
-116,  2,  0,  0,  0,  0, 35,  0,255,  0,  0,  0,136,  1,  0,  0,  0,  0, 35,  0,141,  1,  0,  0,118,  2,  0,  0,  0,  0, 35,  0,
-  7,  1,  0,  0,141,  1,  0,  0,  0,  0, 35,  0,  7,  1,  0,  0,118,  2,  0,  0,  0,  0, 35,  0,118,  2,  0,  0,119,  2,  0,  0,
-  0,  0, 35,  0,119,  2,  0,  0,120,  2,  0,  0,  0,  0, 35,  0,118,  2,  0,  0,120,  2,  0,  0,  0,  0, 35,  0,  5,  1,  0,  0,
-140,  1,  0,  0,  0,  0, 35,  0,140,  1,  0,  0,120,  2,  0,  0,  0,  0, 35,  0,  5,  1,  0,  0,120,  2,  0,  0,  0,  0, 35,  0,
-  4,  1,  0,  0,119,  2,  0,  0,  0,  0, 35,  0,  6,  1,  0,  0,119,  2,  0,  0,  0,  0, 35,  0,  4,  1,  0,  0,  6,  1,  0,  0,
-  0,  0, 35,  0,140,  1,  0,  0,121,  2,  0,  0,  0,  0, 35,  0,140,  1,  0,  0,142,  1,  0,  0,  0,  0, 35,  0,142,  1,  0,  0,
-121,  2,  0,  0,  0,  0, 35,  0,121,  2,  0,  0,122,  2,  0,  0,  0,  0, 35,  0,122,  2,  0,  0,123,  2,  0,  0,  0,  0, 35,  0,
-121,  2,  0,  0,123,  2,  0,  0,  0,  0, 35,  0,141,  1,  0,  0,144,  1,  0,  0,  0,  0, 35,  0,141,  1,  0,  0,123,  2,  0,  0,
-  0,  0, 35,  0,144,  1,  0,  0,123,  2,  0,  0,  0,  0, 35,  0,145,  1,  0,  0,122,  2,  0,  0,  0,  0, 35,  0,143,  1,  0,  0,
-122,  2,  0,  0,  0,  0, 35,  0,143,  1,  0,  0,145,  1,  0,  0,  0,  0, 35,  0, 24,  1,  0,  0,124,  2,  0,  0,  0,  0, 35,  0,
-  8,  1,  0,  0, 24,  1,  0,  0,  0,  0, 35,  0,  8,  1,  0,  0,124,  2,  0,  0,  0,  0, 35,  0,124,  2,  0,  0,125,  2,  0,  0,
-  0,  0, 35,  0,125,  2,  0,  0,126,  2,  0,  0,  0,  0, 35,  0,124,  2,  0,  0,126,  2,  0,  0,  0,  0, 35,  0, 25,  1,  0,  0,
-145,  1,  0,  0,  0,  0, 35,  0, 25,  1,  0,  0,126,  2,  0,  0,  0,  0, 35,  0,145,  1,  0,  0,126,  2,  0,  0,  0,  0, 35,  0,
-144,  1,  0,  0,125,  2,  0,  0,  0,  0, 35,  0,  9,  1,  0,  0,125,  2,  0,  0,  0,  0, 35,  0,  9,  1,  0,  0,144,  1,  0,  0,
-  0,  0, 35,  0, 23,  1,  0,  0,127,  2,  0,  0,  0,  0, 35,  0, 23,  1,  0,  0,143,  1,  0,  0,  0,  0, 35,  0,143,  1,  0,  0,
-127,  2,  0,  0,  0,  0, 35,  0,127,  2,  0,  0,128,  2,  0,  0,  0,  0, 35,  0,128,  2,  0,  0,129,  2,  0,  0,  0,  0, 35,  0,
-127,  2,  0,  0,129,  2,  0,  0,  0,  0, 35,  0,  2,  1,  0,  0, 22,  1,  0,  0,  0,  0, 35,  0, 22,  1,  0,  0,129,  2,  0,  0,
-  0,  0, 35,  0,  2,  1,  0,  0,129,  2,  0,  0,  0,  0, 35,  0,  3,  1,  0,  0,128,  2,  0,  0,  0,  0, 35,  0,142,  1,  0,  0,
-128,  2,  0,  0,  0,  0, 35,  0,  3,  1,  0,  0,142,  1,  0,  0,  0,  0, 35,  0, 68, 65, 84, 65,104,  1,  0,  0,184, 25, 54,  3,
-  0,  0,  0,  0, 84,  1,  0,  0,  5,  0,  0,  0,  4,  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, 86, 84,101,120,  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,104, 27, 54,  3,  0,  0,  0,  0,  5,  0,  0,  0, 20,  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, 85, 86, 84,101,120,  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,184,127, 54,  3,  0,  0,  0,  0,  6,  0,  0,  0,
- 68,  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, 67,111,108,  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,  8,112, 55,  3,
-  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,  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,  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, 68, 65, 84, 65,  0,100,  0,  0,104, 27, 54,  3,
-  0,  0,  0,  0, 48,  0,  0,  0,  0,  5,  0,  0, 27,  1,  0,  0,102,  0,  0,  0,146,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-146,  1,  0,  0,171,  0,  0,  0, 27,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 14,  0,  0,  0, 27,  1,  0,  0,171,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,171,  0,  0,  0,146,  1,  0,  0, 46,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,147,  1,  0,  0,
- 46,  0,  0,  0,146,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,146,  1,  0,  0,148,  1,  0,  0,147,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 43,  0,  0,  0,147,  1,  0,  0,148,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,148,  1,  0,  0,146,  1,  0,  0,
-102,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 26,  1,  0,  0, 12,  0,  0,  0,165,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-165,  0,  0,  0,148,  1,  0,  0, 26,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,102,  0,  0,  0, 26,  1,  0,  0,148,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,148,  1,  0,  0,165,  0,  0,  0, 43,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,147,  1,  0,  0,
- 43,  0,  0,  0,164,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,164,  0,  0,  0,170,  0,  0,  0,147,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 46,  0,  0,  0,147,  1,  0,  0,170,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,170,  0,  0,  0,164,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 26,  1,  0,  0,102,  0,  0,  0,149,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-149,  1,  0,  0, 28,  1,  0,  0, 26,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 12,  0,  0,  0, 26,  1,  0,  0, 28,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 28,  1,  0,  0,149,  1,  0,  0,103,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,150,  1,  0,  0,
-103,  0,  0,  0,149,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,149,  1,  0,  0,151,  1,  0,  0,150,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,104,  0,  0,  0,150,  1,  0,  0,151,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,151,  1,  0,  0,149,  1,  0,  0,
-102,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 27,  1,  0,  0, 14,  0,  0,  0, 31,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 31,  1,  0,  0,151,  1,  0,  0, 27,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,102,  0,  0,  0, 27,  1,  0,  0,151,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,151,  1,  0,  0, 31,  1,  0,  0,104,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,150,  1,  0,  0,
-104,  0,  0,  0, 30,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 30,  1,  0,  0, 29,  1,  0,  0,150,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,103,  0,  0,  0,150,  1,  0,  0, 29,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 29,  1,  0,  0, 30,  1,  0,  0,
- 13,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,168,  0,  0,  0, 45,  0,  0,  0,152,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-152,  1,  0,  0,172,  0,  0,  0,168,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  2,  0,  0,  0,168,  0,  0,  0,172,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,172,  0,  0,  0,152,  1,  0,  0, 47,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,153,  1,  0,  0,
- 47,  0,  0,  0,152,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,152,  1,  0,  0,154,  1,  0,  0,153,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,104,  0,  0,  0,153,  1,  0,  0,154,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,154,  1,  0,  0,152,  1,  0,  0,
- 45,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,169,  0,  0,  0, 13,  0,  0,  0, 30,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 30,  1,  0,  0,154,  1,  0,  0,169,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 45,  0,  0,  0,169,  0,  0,  0,154,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,154,  1,  0,  0, 30,  1,  0,  0,104,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,153,  1,  0,  0,
-104,  0,  0,  0, 31,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 31,  1,  0,  0,173,  0,  0,  0,153,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 47,  0,  0,  0,153,  1,  0,  0,173,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,173,  0,  0,  0, 31,  1,  0,  0,
- 14,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,167,  0,  0,  0, 44,  0,  0,  0,155,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-155,  1,  0,  0, 29,  1,  0,  0,167,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 13,  0,  0,  0,167,  0,  0,  0, 29,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 29,  1,  0,  0,155,  1,  0,  0,103,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,156,  1,  0,  0,
-103,  0,  0,  0,155,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,155,  1,  0,  0,157,  1,  0,  0,156,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 42,  0,  0,  0,156,  1,  0,  0,157,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,157,  1,  0,  0,155,  1,  0,  0,
- 44,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,166,  0,  0,  0,  0,  0,  0,  0,162,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-162,  0,  0,  0,157,  1,  0,  0,166,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 44,  0,  0,  0,166,  0,  0,  0,157,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,157,  1,  0,  0,162,  0,  0,  0, 42,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,156,  1,  0,  0,
- 42,  0,  0,  0,163,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,163,  0,  0,  0, 28,  1,  0,  0,156,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,103,  0,  0,  0,156,  1,  0,  0, 28,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 28,  1,  0,  0,163,  0,  0,  0,
- 12,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,158,  1,  0,  0,105,  0,  0,  0, 33,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 33,  1,  0,  0,179,  0,  0,  0,158,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 50,  0,  0,  0,158,  1,  0,  0,179,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,179,  0,  0,  0, 33,  1,  0,  0, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,158,  1,  0,  0,
- 50,  0,  0,  0,159,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,159,  1,  0,  0,160,  1,  0,  0,158,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,105,  0,  0,  0,158,  1,  0,  0,160,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,160,  1,  0,  0,159,  1,  0,  0,
- 43,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,165,  0,  0,  0, 12,  0,  0,  0, 32,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 32,  1,  0,  0,160,  1,  0,  0,165,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 43,  0,  0,  0,165,  0,  0,  0,160,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,160,  1,  0,  0, 32,  1,  0,  0,105,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,164,  0,  0,  0,
- 43,  0,  0,  0,159,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,159,  1,  0,  0,178,  0,  0,  0,164,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,  1,  0,  0,  0,164,  0,  0,  0,178,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,178,  0,  0,  0,159,  1,  0,  0,
- 50,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,161,  1,  0,  0,105,  0,  0,  0, 32,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 32,  1,  0,  0, 34,  1,  0,  0,161,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,106,  0,  0,  0,161,  1,  0,  0, 34,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 34,  1,  0,  0, 32,  1,  0,  0, 12,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,161,  1,  0,  0,
-106,  0,  0,  0,162,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,162,  1,  0,  0,163,  1,  0,  0,161,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,105,  0,  0,  0,161,  1,  0,  0,163,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,163,  1,  0,  0,162,  1,  0,  0,
-107,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 37,  1,  0,  0, 16,  0,  0,  0, 33,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 33,  1,  0,  0,163,  1,  0,  0, 37,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,107,  0,  0,  0, 37,  1,  0,  0,163,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,163,  1,  0,  0, 33,  1,  0,  0,105,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 36,  1,  0,  0,
-107,  0,  0,  0,162,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,162,  1,  0,  0, 35,  1,  0,  0, 36,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 15,  0,  0,  0, 36,  1,  0,  0, 35,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 35,  1,  0,  0,162,  1,  0,  0,
-106,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,164,  1,  0,  0, 49,  0,  0,  0,176,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-176,  0,  0,  0,180,  0,  0,  0,164,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 51,  0,  0,  0,164,  1,  0,  0,180,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,180,  0,  0,  0,176,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,164,  1,  0,  0,
- 51,  0,  0,  0,165,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,165,  1,  0,  0,166,  1,  0,  0,164,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 49,  0,  0,  0,164,  1,  0,  0,166,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,166,  1,  0,  0,165,  1,  0,  0,
-107,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 36,  1,  0,  0, 15,  0,  0,  0,177,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-177,  0,  0,  0,166,  1,  0,  0, 36,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,107,  0,  0,  0, 36,  1,  0,  0,166,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,166,  1,  0,  0,177,  0,  0,  0, 49,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 37,  1,  0,  0,
-107,  0,  0,  0,165,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,165,  1,  0,  0,181,  0,  0,  0, 37,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 16,  0,  0,  0, 37,  1,  0,  0,181,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,181,  0,  0,  0,165,  1,  0,  0,
- 51,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,167,  1,  0,  0, 48,  0,  0,  0,175,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-175,  0,  0,  0, 35,  1,  0,  0,167,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,106,  0,  0,  0,167,  1,  0,  0, 35,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 35,  1,  0,  0,175,  0,  0,  0, 15,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,167,  1,  0,  0,
-106,  0,  0,  0,168,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,168,  1,  0,  0,169,  1,  0,  0,167,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 48,  0,  0,  0,167,  1,  0,  0,169,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,169,  1,  0,  0,168,  1,  0,  0,
- 42,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,162,  0,  0,  0,  0,  0,  0,  0,174,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-174,  0,  0,  0,169,  1,  0,  0,162,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 42,  0,  0,  0,162,  0,  0,  0,169,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,169,  1,  0,  0,174,  0,  0,  0, 48,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,163,  0,  0,  0,
- 42,  0,  0,  0,168,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,168,  1,  0,  0, 34,  1,  0,  0,163,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 12,  0,  0,  0,163,  0,  0,  0, 34,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 34,  1,  0,  0,168,  1,  0,  0,
-106,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 39,  1,  0,  0,108,  0,  0,  0,170,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-170,  1,  0,  0,187,  0,  0,  0, 39,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 18,  0,  0,  0, 39,  1,  0,  0,187,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,187,  0,  0,  0,170,  1,  0,  0, 54,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,171,  1,  0,  0,
- 54,  0,  0,  0,170,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,170,  1,  0,  0,172,  1,  0,  0,171,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 45,  0,  0,  0,171,  1,  0,  0,172,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,172,  1,  0,  0,170,  1,  0,  0,
-108,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 38,  1,  0,  0, 13,  0,  0,  0,169,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-169,  0,  0,  0,172,  1,  0,  0, 38,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,108,  0,  0,  0, 38,  1,  0,  0,172,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,172,  1,  0,  0,169,  0,  0,  0, 45,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,171,  1,  0,  0,
- 45,  0,  0,  0,168,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,168,  0,  0,  0,186,  0,  0,  0,171,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 54,  0,  0,  0,171,  1,  0,  0,186,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,186,  0,  0,  0,168,  0,  0,  0,
-  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 38,  1,  0,  0,108,  0,  0,  0,173,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-173,  1,  0,  0, 40,  1,  0,  0, 38,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 13,  0,  0,  0, 38,  1,  0,  0, 40,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 40,  1,  0,  0,173,  1,  0,  0,109,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,174,  1,  0,  0,
-109,  0,  0,  0,173,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,173,  1,  0,  0,175,  1,  0,  0,174,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,110,  0,  0,  0,174,  1,  0,  0,175,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,175,  1,  0,  0,173,  1,  0,  0,
-108,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 39,  1,  0,  0, 18,  0,  0,  0, 43,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 43,  1,  0,  0,175,  1,  0,  0, 39,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,108,  0,  0,  0, 39,  1,  0,  0,175,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,175,  1,  0,  0, 43,  1,  0,  0,110,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,174,  1,  0,  0,
-110,  0,  0,  0, 42,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 42,  1,  0,  0, 41,  1,  0,  0,174,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,109,  0,  0,  0,174,  1,  0,  0, 41,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 41,  1,  0,  0, 42,  1,  0,  0,
- 17,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,184,  0,  0,  0, 53,  0,  0,  0,176,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-176,  1,  0,  0,188,  0,  0,  0,184,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  3,  0,  0,  0,184,  0,  0,  0,188,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,188,  0,  0,  0,176,  1,  0,  0, 55,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,177,  1,  0,  0,
- 55,  0,  0,  0,176,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,176,  1,  0,  0,178,  1,  0,  0,177,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,110,  0,  0,  0,177,  1,  0,  0,178,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,178,  1,  0,  0,176,  1,  0,  0,
- 53,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,185,  0,  0,  0, 17,  0,  0,  0, 42,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 42,  1,  0,  0,178,  1,  0,  0,185,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 53,  0,  0,  0,185,  0,  0,  0,178,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,178,  1,  0,  0, 42,  1,  0,  0,110,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,177,  1,  0,  0,
-110,  0,  0,  0, 43,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 43,  1,  0,  0,189,  0,  0,  0,177,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 55,  0,  0,  0,177,  1,  0,  0,189,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,189,  0,  0,  0, 43,  1,  0,  0,
- 18,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,183,  0,  0,  0, 52,  0,  0,  0,179,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-179,  1,  0,  0, 41,  1,  0,  0,183,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 17,  0,  0,  0,183,  0,  0,  0, 41,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 41,  1,  0,  0,179,  1,  0,  0,109,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,180,  1,  0,  0,
-109,  0,  0,  0,179,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,179,  1,  0,  0,181,  1,  0,  0,180,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 44,  0,  0,  0,180,  1,  0,  0,181,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,181,  1,  0,  0,179,  1,  0,  0,
- 52,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,182,  0,  0,  0,  0,  0,  0,  0,166,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-166,  0,  0,  0,181,  1,  0,  0,182,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 52,  0,  0,  0,182,  0,  0,  0,181,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,181,  1,  0,  0,166,  0,  0,  0, 44,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,180,  1,  0,  0,
- 44,  0,  0,  0,167,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,167,  0,  0,  0, 40,  1,  0,  0,180,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,109,  0,  0,  0,180,  1,  0,  0, 40,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 40,  1,  0,  0,167,  0,  0,  0,
- 13,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 45,  1,  0,  0,111,  0,  0,  0,182,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-182,  1,  0,  0,195,  0,  0,  0, 45,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 20,  0,  0,  0, 45,  1,  0,  0,195,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,195,  0,  0,  0,182,  1,  0,  0, 58,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,183,  1,  0,  0,
- 58,  0,  0,  0,182,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,182,  1,  0,  0,184,  1,  0,  0,183,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 53,  0,  0,  0,183,  1,  0,  0,184,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,184,  1,  0,  0,182,  1,  0,  0,
-111,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 44,  1,  0,  0, 17,  0,  0,  0,185,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-185,  0,  0,  0,184,  1,  0,  0, 44,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,111,  0,  0,  0, 44,  1,  0,  0,184,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,184,  1,  0,  0,185,  0,  0,  0, 53,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,183,  1,  0,  0,
- 53,  0,  0,  0,184,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,184,  0,  0,  0,194,  0,  0,  0,183,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 58,  0,  0,  0,183,  1,  0,  0,194,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,194,  0,  0,  0,184,  0,  0,  0,
-  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 44,  1,  0,  0,111,  0,  0,  0,185,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-185,  1,  0,  0, 46,  1,  0,  0, 44,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 17,  0,  0,  0, 44,  1,  0,  0, 46,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 46,  1,  0,  0,185,  1,  0,  0,112,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,186,  1,  0,  0,
-112,  0,  0,  0,185,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,185,  1,  0,  0,187,  1,  0,  0,186,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,113,  0,  0,  0,186,  1,  0,  0,187,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,187,  1,  0,  0,185,  1,  0,  0,
-111,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 45,  1,  0,  0, 20,  0,  0,  0, 49,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 49,  1,  0,  0,187,  1,  0,  0, 45,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,111,  0,  0,  0, 45,  1,  0,  0,187,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,187,  1,  0,  0, 49,  1,  0,  0,113,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,186,  1,  0,  0,
-113,  0,  0,  0, 48,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 48,  1,  0,  0, 47,  1,  0,  0,186,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,112,  0,  0,  0,186,  1,  0,  0, 47,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 47,  1,  0,  0, 48,  1,  0,  0,
- 19,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,192,  0,  0,  0, 57,  0,  0,  0,188,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-188,  1,  0,  0,196,  0,  0,  0,192,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  4,  0,  0,  0,192,  0,  0,  0,196,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,196,  0,  0,  0,188,  1,  0,  0, 59,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,189,  1,  0,  0,
- 59,  0,  0,  0,188,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,188,  1,  0,  0,190,  1,  0,  0,189,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,113,  0,  0,  0,189,  1,  0,  0,190,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,190,  1,  0,  0,188,  1,  0,  0,
- 57,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,193,  0,  0,  0, 19,  0,  0,  0, 48,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 48,  1,  0,  0,190,  1,  0,  0,193,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 57,  0,  0,  0,193,  0,  0,  0,190,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,190,  1,  0,  0, 48,  1,  0,  0,113,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,189,  1,  0,  0,
-113,  0,  0,  0, 49,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 49,  1,  0,  0,197,  0,  0,  0,189,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 59,  0,  0,  0,189,  1,  0,  0,197,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,197,  0,  0,  0, 49,  1,  0,  0,
- 20,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,191,  0,  0,  0, 56,  0,  0,  0,191,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-191,  1,  0,  0, 47,  1,  0,  0,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 19,  0,  0,  0,191,  0,  0,  0, 47,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 47,  1,  0,  0,191,  1,  0,  0,112,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,192,  1,  0,  0,
-112,  0,  0,  0,191,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,191,  1,  0,  0,193,  1,  0,  0,192,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 52,  0,  0,  0,192,  1,  0,  0,193,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,193,  1,  0,  0,191,  1,  0,  0,
- 56,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,190,  0,  0,  0,  0,  0,  0,  0,182,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-182,  0,  0,  0,193,  1,  0,  0,190,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 56,  0,  0,  0,190,  0,  0,  0,193,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,193,  1,  0,  0,182,  0,  0,  0, 52,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,192,  1,  0,  0,
- 52,  0,  0,  0,183,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,183,  0,  0,  0, 46,  1,  0,  0,192,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,112,  0,  0,  0,192,  1,  0,  0, 46,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 46,  1,  0,  0,183,  0,  0,  0,
- 17,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 51,  1,  0,  0,114,  0,  0,  0,194,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-194,  1,  0,  0,199,  0,  0,  0, 51,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 21,  0,  0,  0, 51,  1,  0,  0,199,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,199,  0,  0,  0,194,  1,  0,  0, 60,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,195,  1,  0,  0,
- 60,  0,  0,  0,194,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,194,  1,  0,  0,196,  1,  0,  0,195,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 57,  0,  0,  0,195,  1,  0,  0,196,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,196,  1,  0,  0,194,  1,  0,  0,
-114,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 50,  1,  0,  0, 19,  0,  0,  0,193,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-193,  0,  0,  0,196,  1,  0,  0, 50,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,114,  0,  0,  0, 50,  1,  0,  0,196,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,196,  1,  0,  0,193,  0,  0,  0, 57,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,195,  1,  0,  0,
- 57,  0,  0,  0,192,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,192,  0,  0,  0,198,  0,  0,  0,195,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 60,  0,  0,  0,195,  1,  0,  0,198,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,198,  0,  0,  0,192,  0,  0,  0,
-  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 50,  1,  0,  0,114,  0,  0,  0,197,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-197,  1,  0,  0, 53,  1,  0,  0, 50,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 19,  0,  0,  0, 50,  1,  0,  0, 53,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 53,  1,  0,  0,197,  1,  0,  0,115,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,198,  1,  0,  0,
-115,  0,  0,  0,197,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,197,  1,  0,  0,199,  1,  0,  0,198,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,116,  0,  0,  0,198,  1,  0,  0,199,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,199,  1,  0,  0,197,  1,  0,  0,
-114,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 51,  1,  0,  0, 21,  0,  0,  0, 55,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 55,  1,  0,  0,199,  1,  0,  0, 51,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,114,  0,  0,  0, 51,  1,  0,  0,199,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,199,  1,  0,  0, 55,  1,  0,  0,116,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,198,  1,  0,  0,
-116,  0,  0,  0, 54,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 54,  1,  0,  0, 52,  1,  0,  0,198,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,115,  0,  0,  0,198,  1,  0,  0, 52,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 52,  1,  0,  0, 54,  1,  0,  0,
- 15,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,176,  0,  0,  0, 49,  0,  0,  0,200,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-200,  1,  0,  0,200,  0,  0,  0,176,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  5,  0,  0,  0,176,  0,  0,  0,200,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,200,  0,  0,  0,200,  1,  0,  0, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,201,  1,  0,  0,
- 61,  0,  0,  0,200,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,200,  1,  0,  0,202,  1,  0,  0,201,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,116,  0,  0,  0,201,  1,  0,  0,202,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,202,  1,  0,  0,200,  1,  0,  0,
- 49,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,177,  0,  0,  0, 15,  0,  0,  0, 54,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 54,  1,  0,  0,202,  1,  0,  0,177,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 49,  0,  0,  0,177,  0,  0,  0,202,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,202,  1,  0,  0, 54,  1,  0,  0,116,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,201,  1,  0,  0,
-116,  0,  0,  0, 55,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 55,  1,  0,  0,201,  0,  0,  0,201,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 61,  0,  0,  0,201,  1,  0,  0,201,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,201,  0,  0,  0, 55,  1,  0,  0,
- 21,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,175,  0,  0,  0, 48,  0,  0,  0,203,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-203,  1,  0,  0, 52,  1,  0,  0,175,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 15,  0,  0,  0,175,  0,  0,  0, 52,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 52,  1,  0,  0,203,  1,  0,  0,115,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,204,  1,  0,  0,
-115,  0,  0,  0,203,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,203,  1,  0,  0,205,  1,  0,  0,204,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 56,  0,  0,  0,204,  1,  0,  0,205,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,205,  1,  0,  0,203,  1,  0,  0,
- 48,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,174,  0,  0,  0,  0,  0,  0,  0,190,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-190,  0,  0,  0,205,  1,  0,  0,174,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 48,  0,  0,  0,174,  0,  0,  0,205,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,205,  1,  0,  0,190,  0,  0,  0, 56,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,204,  1,  0,  0,
- 56,  0,  0,  0,191,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,191,  0,  0,  0, 53,  1,  0,  0,204,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,115,  0,  0,  0,204,  1,  0,  0, 53,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 53,  1,  0,  0,191,  0,  0,  0,
- 19,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,206,  1,  0,  0,117,  0,  0,  0, 57,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 57,  1,  0,  0,207,  0,  0,  0,206,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 64,  0,  0,  0,206,  1,  0,  0,207,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,207,  0,  0,  0, 57,  1,  0,  0, 23,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,206,  1,  0,  0,
- 64,  0,  0,  0,207,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,207,  1,  0,  0,208,  1,  0,  0,206,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,117,  0,  0,  0,206,  1,  0,  0,208,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,208,  1,  0,  0,207,  1,  0,  0,
- 50,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,179,  0,  0,  0, 16,  0,  0,  0, 56,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 56,  1,  0,  0,208,  1,  0,  0,179,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 50,  0,  0,  0,179,  0,  0,  0,208,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,208,  1,  0,  0, 56,  1,  0,  0,117,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,178,  0,  0,  0,
- 50,  0,  0,  0,207,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,207,  1,  0,  0,206,  0,  0,  0,178,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,  1,  0,  0,  0,178,  0,  0,  0,206,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,206,  0,  0,  0,207,  1,  0,  0,
- 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,209,  1,  0,  0,117,  0,  0,  0, 56,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 56,  1,  0,  0, 58,  1,  0,  0,209,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,118,  0,  0,  0,209,  1,  0,  0, 58,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 58,  1,  0,  0, 56,  1,  0,  0, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,209,  1,  0,  0,
-118,  0,  0,  0,210,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,210,  1,  0,  0,211,  1,  0,  0,209,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,117,  0,  0,  0,209,  1,  0,  0,211,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,211,  1,  0,  0,210,  1,  0,  0,
-119,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 61,  1,  0,  0, 23,  0,  0,  0, 57,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 57,  1,  0,  0,211,  1,  0,  0, 61,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,119,  0,  0,  0, 61,  1,  0,  0,211,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,211,  1,  0,  0, 57,  1,  0,  0,117,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 60,  1,  0,  0,
-119,  0,  0,  0,210,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,210,  1,  0,  0, 59,  1,  0,  0, 60,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 22,  0,  0,  0, 60,  1,  0,  0, 59,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 59,  1,  0,  0,210,  1,  0,  0,
-118,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,212,  1,  0,  0, 63,  0,  0,  0,204,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-204,  0,  0,  0,208,  0,  0,  0,212,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 65,  0,  0,  0,212,  1,  0,  0,208,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,208,  0,  0,  0,204,  0,  0,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,212,  1,  0,  0,
- 65,  0,  0,  0,213,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,213,  1,  0,  0,214,  1,  0,  0,212,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 63,  0,  0,  0,212,  1,  0,  0,214,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,214,  1,  0,  0,213,  1,  0,  0,
-119,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 60,  1,  0,  0, 22,  0,  0,  0,205,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-205,  0,  0,  0,214,  1,  0,  0, 60,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,119,  0,  0,  0, 60,  1,  0,  0,214,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,214,  1,  0,  0,205,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 61,  1,  0,  0,
-119,  0,  0,  0,213,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,213,  1,  0,  0,209,  0,  0,  0, 61,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 23,  0,  0,  0, 61,  1,  0,  0,209,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,209,  0,  0,  0,213,  1,  0,  0,
- 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,215,  1,  0,  0, 62,  0,  0,  0,203,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-203,  0,  0,  0, 59,  1,  0,  0,215,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,118,  0,  0,  0,215,  1,  0,  0, 59,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 59,  1,  0,  0,203,  0,  0,  0, 22,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,215,  1,  0,  0,
-118,  0,  0,  0,216,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,216,  1,  0,  0,217,  1,  0,  0,215,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 62,  0,  0,  0,215,  1,  0,  0,217,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,217,  1,  0,  0,216,  1,  0,  0,
- 51,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,180,  0,  0,  0,  5,  0,  0,  0,202,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-202,  0,  0,  0,217,  1,  0,  0,180,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 51,  0,  0,  0,180,  0,  0,  0,217,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,217,  1,  0,  0,202,  0,  0,  0, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,181,  0,  0,  0,
- 51,  0,  0,  0,216,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,216,  1,  0,  0, 58,  1,  0,  0,181,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 16,  0,  0,  0,181,  0,  0,  0, 58,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 58,  1,  0,  0,216,  1,  0,  0,
-118,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,218,  1,  0,  0,120,  0,  0,  0, 63,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 63,  1,  0,  0,215,  0,  0,  0,218,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 68,  0,  0,  0,218,  1,  0,  0,215,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,215,  0,  0,  0, 63,  1,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,218,  1,  0,  0,
- 68,  0,  0,  0,219,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,219,  1,  0,  0,220,  1,  0,  0,218,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,120,  0,  0,  0,218,  1,  0,  0,220,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,220,  1,  0,  0,219,  1,  0,  0,
- 47,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,173,  0,  0,  0, 14,  0,  0,  0, 62,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 62,  1,  0,  0,220,  1,  0,  0,173,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 47,  0,  0,  0,173,  0,  0,  0,220,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,220,  1,  0,  0, 62,  1,  0,  0,120,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,172,  0,  0,  0,
- 47,  0,  0,  0,219,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,219,  1,  0,  0,214,  0,  0,  0,172,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,  2,  0,  0,  0,172,  0,  0,  0,214,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,214,  0,  0,  0,219,  1,  0,  0,
- 68,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,221,  1,  0,  0,120,  0,  0,  0, 62,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 62,  1,  0,  0, 64,  1,  0,  0,221,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,121,  0,  0,  0,221,  1,  0,  0, 64,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 64,  1,  0,  0, 62,  1,  0,  0, 14,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,221,  1,  0,  0,
-121,  0,  0,  0,222,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,222,  1,  0,  0,223,  1,  0,  0,221,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,120,  0,  0,  0,221,  1,  0,  0,223,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,223,  1,  0,  0,222,  1,  0,  0,
-122,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 67,  1,  0,  0, 25,  0,  0,  0, 63,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 63,  1,  0,  0,223,  1,  0,  0, 67,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,122,  0,  0,  0, 67,  1,  0,  0,223,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,223,  1,  0,  0, 63,  1,  0,  0,120,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 66,  1,  0,  0,
-122,  0,  0,  0,222,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,222,  1,  0,  0, 65,  1,  0,  0, 66,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 24,  0,  0,  0, 66,  1,  0,  0, 65,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 65,  1,  0,  0,222,  1,  0,  0,
-121,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,224,  1,  0,  0, 67,  0,  0,  0,212,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-212,  0,  0,  0,216,  0,  0,  0,224,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 69,  0,  0,  0,224,  1,  0,  0,216,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,216,  0,  0,  0,212,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,224,  1,  0,  0,
- 69,  0,  0,  0,225,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,225,  1,  0,  0,226,  1,  0,  0,224,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 67,  0,  0,  0,224,  1,  0,  0,226,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,226,  1,  0,  0,225,  1,  0,  0,
-122,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 66,  1,  0,  0, 24,  0,  0,  0,213,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-213,  0,  0,  0,226,  1,  0,  0, 66,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,122,  0,  0,  0, 66,  1,  0,  0,226,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,226,  1,  0,  0,213,  0,  0,  0, 67,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 67,  1,  0,  0,
-122,  0,  0,  0,225,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,225,  1,  0,  0,217,  0,  0,  0, 67,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 25,  0,  0,  0, 67,  1,  0,  0,217,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,217,  0,  0,  0,225,  1,  0,  0,
- 69,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,227,  1,  0,  0, 66,  0,  0,  0,211,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-211,  0,  0,  0, 65,  1,  0,  0,227,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,121,  0,  0,  0,227,  1,  0,  0, 65,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 65,  1,  0,  0,211,  0,  0,  0, 24,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,227,  1,  0,  0,
-121,  0,  0,  0,228,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,228,  1,  0,  0,229,  1,  0,  0,227,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 66,  0,  0,  0,227,  1,  0,  0,229,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,229,  1,  0,  0,228,  1,  0,  0,
- 46,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,170,  0,  0,  0,  1,  0,  0,  0,210,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-210,  0,  0,  0,229,  1,  0,  0,170,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 46,  0,  0,  0,170,  0,  0,  0,229,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,229,  1,  0,  0,210,  0,  0,  0, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,171,  0,  0,  0,
- 46,  0,  0,  0,228,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,228,  1,  0,  0, 64,  1,  0,  0,171,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 14,  0,  0,  0,171,  0,  0,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 64,  1,  0,  0,228,  1,  0,  0,
-121,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,230,  1,  0,  0,123,  0,  0,  0, 69,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 69,  1,  0,  0,223,  0,  0,  0,230,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 72,  0,  0,  0,230,  1,  0,  0,223,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,223,  0,  0,  0, 69,  1,  0,  0, 27,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,230,  1,  0,  0,
- 72,  0,  0,  0,231,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,231,  1,  0,  0,232,  1,  0,  0,230,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,123,  0,  0,  0,230,  1,  0,  0,232,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,232,  1,  0,  0,231,  1,  0,  0,
- 55,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,189,  0,  0,  0, 18,  0,  0,  0, 68,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 68,  1,  0,  0,232,  1,  0,  0,189,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 55,  0,  0,  0,189,  0,  0,  0,232,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,232,  1,  0,  0, 68,  1,  0,  0,123,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,188,  0,  0,  0,
- 55,  0,  0,  0,231,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,231,  1,  0,  0,222,  0,  0,  0,188,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,  3,  0,  0,  0,188,  0,  0,  0,222,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,222,  0,  0,  0,231,  1,  0,  0,
- 72,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,233,  1,  0,  0,123,  0,  0,  0, 68,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 68,  1,  0,  0, 70,  1,  0,  0,233,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,124,  0,  0,  0,233,  1,  0,  0, 70,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 70,  1,  0,  0, 68,  1,  0,  0, 18,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,233,  1,  0,  0,
-124,  0,  0,  0,234,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,234,  1,  0,  0,235,  1,  0,  0,233,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,123,  0,  0,  0,233,  1,  0,  0,235,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,235,  1,  0,  0,234,  1,  0,  0,
-125,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 73,  1,  0,  0, 27,  0,  0,  0, 69,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 69,  1,  0,  0,235,  1,  0,  0, 73,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,125,  0,  0,  0, 73,  1,  0,  0,235,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,235,  1,  0,  0, 69,  1,  0,  0,123,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 72,  1,  0,  0,
-125,  0,  0,  0,234,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,234,  1,  0,  0, 71,  1,  0,  0, 72,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 26,  0,  0,  0, 72,  1,  0,  0, 71,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 71,  1,  0,  0,234,  1,  0,  0,
-124,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,236,  1,  0,  0, 71,  0,  0,  0,220,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-220,  0,  0,  0,224,  0,  0,  0,236,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 73,  0,  0,  0,236,  1,  0,  0,224,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,224,  0,  0,  0,220,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,236,  1,  0,  0,
- 73,  0,  0,  0,237,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,237,  1,  0,  0,238,  1,  0,  0,236,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 71,  0,  0,  0,236,  1,  0,  0,238,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,238,  1,  0,  0,237,  1,  0,  0,
-125,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 72,  1,  0,  0, 26,  0,  0,  0,221,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-221,  0,  0,  0,238,  1,  0,  0, 72,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,125,  0,  0,  0, 72,  1,  0,  0,238,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,238,  1,  0,  0,221,  0,  0,  0, 71,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 73,  1,  0,  0,
-125,  0,  0,  0,237,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,237,  1,  0,  0,225,  0,  0,  0, 73,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 27,  0,  0,  0, 73,  1,  0,  0,225,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,225,  0,  0,  0,237,  1,  0,  0,
- 73,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,239,  1,  0,  0, 70,  0,  0,  0,219,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-219,  0,  0,  0, 71,  1,  0,  0,239,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,124,  0,  0,  0,239,  1,  0,  0, 71,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 71,  1,  0,  0,219,  0,  0,  0, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,239,  1,  0,  0,
-124,  0,  0,  0,240,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,240,  1,  0,  0,241,  1,  0,  0,239,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 70,  0,  0,  0,239,  1,  0,  0,241,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,241,  1,  0,  0,240,  1,  0,  0,
- 54,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,186,  0,  0,  0,  2,  0,  0,  0,218,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-218,  0,  0,  0,241,  1,  0,  0,186,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 54,  0,  0,  0,186,  0,  0,  0,241,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,241,  1,  0,  0,218,  0,  0,  0, 70,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,187,  0,  0,  0,
- 54,  0,  0,  0,240,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,240,  1,  0,  0, 70,  1,  0,  0,187,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 18,  0,  0,  0,187,  0,  0,  0, 70,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 70,  1,  0,  0,240,  1,  0,  0,
-124,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,242,  1,  0,  0,126,  0,  0,  0, 75,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 75,  1,  0,  0,231,  0,  0,  0,242,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 76,  0,  0,  0,242,  1,  0,  0,231,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,231,  0,  0,  0, 75,  1,  0,  0, 29,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,242,  1,  0,  0,
- 76,  0,  0,  0,243,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,243,  1,  0,  0,244,  1,  0,  0,242,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,126,  0,  0,  0,242,  1,  0,  0,244,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,244,  1,  0,  0,243,  1,  0,  0,
- 59,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,197,  0,  0,  0, 20,  0,  0,  0, 74,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 74,  1,  0,  0,244,  1,  0,  0,197,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 59,  0,  0,  0,197,  0,  0,  0,244,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,244,  1,  0,  0, 74,  1,  0,  0,126,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,196,  0,  0,  0,
- 59,  0,  0,  0,243,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,243,  1,  0,  0,230,  0,  0,  0,196,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,  4,  0,  0,  0,196,  0,  0,  0,230,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,230,  0,  0,  0,243,  1,  0,  0,
- 76,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,245,  1,  0,  0,126,  0,  0,  0, 74,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 74,  1,  0,  0, 76,  1,  0,  0,245,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,127,  0,  0,  0,245,  1,  0,  0, 76,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 76,  1,  0,  0, 74,  1,  0,  0, 20,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,245,  1,  0,  0,
-127,  0,  0,  0,246,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,246,  1,  0,  0,247,  1,  0,  0,245,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,126,  0,  0,  0,245,  1,  0,  0,247,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,247,  1,  0,  0,246,  1,  0,  0,
-128,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 79,  1,  0,  0, 29,  0,  0,  0, 75,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 75,  1,  0,  0,247,  1,  0,  0, 79,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,128,  0,  0,  0, 79,  1,  0,  0,247,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,247,  1,  0,  0, 75,  1,  0,  0,126,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 78,  1,  0,  0,
-128,  0,  0,  0,246,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,246,  1,  0,  0, 77,  1,  0,  0, 78,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 28,  0,  0,  0, 78,  1,  0,  0, 77,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 77,  1,  0,  0,246,  1,  0,  0,
-127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,248,  1,  0,  0, 75,  0,  0,  0,228,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-228,  0,  0,  0,232,  0,  0,  0,248,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 77,  0,  0,  0,248,  1,  0,  0,232,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,232,  0,  0,  0,228,  0,  0,  0,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,248,  1,  0,  0,
- 77,  0,  0,  0,249,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,249,  1,  0,  0,250,  1,  0,  0,248,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 75,  0,  0,  0,248,  1,  0,  0,250,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,250,  1,  0,  0,249,  1,  0,  0,
-128,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 78,  1,  0,  0, 28,  0,  0,  0,229,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-229,  0,  0,  0,250,  1,  0,  0, 78,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,128,  0,  0,  0, 78,  1,  0,  0,250,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,250,  1,  0,  0,229,  0,  0,  0, 75,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 79,  1,  0,  0,
-128,  0,  0,  0,249,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,249,  1,  0,  0,233,  0,  0,  0, 79,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 29,  0,  0,  0, 79,  1,  0,  0,233,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,233,  0,  0,  0,249,  1,  0,  0,
- 77,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,251,  1,  0,  0, 74,  0,  0,  0,227,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-227,  0,  0,  0, 77,  1,  0,  0,251,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,127,  0,  0,  0,251,  1,  0,  0, 77,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 77,  1,  0,  0,227,  0,  0,  0, 28,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,251,  1,  0,  0,
-127,  0,  0,  0,252,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,252,  1,  0,  0,253,  1,  0,  0,251,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 74,  0,  0,  0,251,  1,  0,  0,253,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,253,  1,  0,  0,252,  1,  0,  0,
- 58,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,194,  0,  0,  0,  3,  0,  0,  0,226,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-226,  0,  0,  0,253,  1,  0,  0,194,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 58,  0,  0,  0,194,  0,  0,  0,253,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,253,  1,  0,  0,226,  0,  0,  0, 74,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,195,  0,  0,  0,
- 58,  0,  0,  0,252,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,252,  1,  0,  0, 76,  1,  0,  0,195,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 20,  0,  0,  0,195,  0,  0,  0, 76,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 76,  1,  0,  0,252,  1,  0,  0,
-127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,254,  1,  0,  0,129,  0,  0,  0, 81,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 81,  1,  0,  0,239,  0,  0,  0,254,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 80,  0,  0,  0,254,  1,  0,  0,239,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,239,  0,  0,  0, 81,  1,  0,  0, 31,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,254,  1,  0,  0,
- 80,  0,  0,  0,255,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,255,  1,  0,  0,  0,  2,  0,  0,254,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,129,  0,  0,  0,254,  1,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  2,  0,  0,255,  1,  0,  0,
- 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,201,  0,  0,  0, 21,  0,  0,  0, 80,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 80,  1,  0,  0,  0,  2,  0,  0,201,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 61,  0,  0,  0,201,  0,  0,  0,  0,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,  0,  2,  0,  0, 80,  1,  0,  0,129,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,200,  0,  0,  0,
- 61,  0,  0,  0,255,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,255,  1,  0,  0,238,  0,  0,  0,200,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,  5,  0,  0,  0,200,  0,  0,  0,238,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,238,  0,  0,  0,255,  1,  0,  0,
- 80,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  1,  2,  0,  0,129,  0,  0,  0, 80,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 80,  1,  0,  0, 82,  1,  0,  0,  1,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,130,  0,  0,  0,  1,  2,  0,  0, 82,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 82,  1,  0,  0, 80,  1,  0,  0, 21,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  1,  2,  0,  0,
-130,  0,  0,  0,  2,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  2,  2,  0,  0,  3,  2,  0,  0,  1,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,129,  0,  0,  0,  1,  2,  0,  0,  3,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  3,  2,  0,  0,  2,  2,  0,  0,
-131,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 85,  1,  0,  0, 31,  0,  0,  0, 81,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 81,  1,  0,  0,  3,  2,  0,  0, 85,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,131,  0,  0,  0, 85,  1,  0,  0,  3,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,  3,  2,  0,  0, 81,  1,  0,  0,129,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 84,  1,  0,  0,
-131,  0,  0,  0,  2,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  2,  2,  0,  0, 83,  1,  0,  0, 84,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 30,  0,  0,  0, 84,  1,  0,  0, 83,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 83,  1,  0,  0,  2,  2,  0,  0,
-130,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  4,  2,  0,  0, 79,  0,  0,  0,236,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-236,  0,  0,  0,240,  0,  0,  0,  4,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 81,  0,  0,  0,  4,  2,  0,  0,240,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,240,  0,  0,  0,236,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  4,  2,  0,  0,
- 81,  0,  0,  0,  5,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  5,  2,  0,  0,  6,  2,  0,  0,  4,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 79,  0,  0,  0,  4,  2,  0,  0,  6,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  6,  2,  0,  0,  5,  2,  0,  0,
-131,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 84,  1,  0,  0, 30,  0,  0,  0,237,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-237,  0,  0,  0,  6,  2,  0,  0, 84,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,131,  0,  0,  0, 84,  1,  0,  0,  6,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,  6,  2,  0,  0,237,  0,  0,  0, 79,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 85,  1,  0,  0,
-131,  0,  0,  0,  5,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  5,  2,  0,  0,241,  0,  0,  0, 85,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 31,  0,  0,  0, 85,  1,  0,  0,241,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,241,  0,  0,  0,  5,  2,  0,  0,
- 81,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  7,  2,  0,  0, 78,  0,  0,  0,235,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-235,  0,  0,  0, 83,  1,  0,  0,  7,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,130,  0,  0,  0,  7,  2,  0,  0, 83,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 83,  1,  0,  0,235,  0,  0,  0, 30,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  7,  2,  0,  0,
-130,  0,  0,  0,  8,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  8,  2,  0,  0,  9,  2,  0,  0,  7,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 78,  0,  0,  0,  7,  2,  0,  0,  9,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  9,  2,  0,  0,  8,  2,  0,  0,
- 60,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,198,  0,  0,  0,  4,  0,  0,  0,234,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-234,  0,  0,  0,  9,  2,  0,  0,198,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 60,  0,  0,  0,198,  0,  0,  0,  9,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,  9,  2,  0,  0,234,  0,  0,  0, 78,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,199,  0,  0,  0,
- 60,  0,  0,  0,  8,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  8,  2,  0,  0, 82,  1,  0,  0,199,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 21,  0,  0,  0,199,  0,  0,  0, 82,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 82,  1,  0,  0,  8,  2,  0,  0,
-130,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 87,  1,  0,  0,132,  0,  0,  0, 10,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 10,  2,  0,  0,245,  0,  0,  0, 87,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 32,  0,  0,  0, 87,  1,  0,  0,245,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,245,  0,  0,  0, 10,  2,  0,  0, 83,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 11,  2,  0,  0,
- 83,  0,  0,  0, 10,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 10,  2,  0,  0, 12,  2,  0,  0, 11,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 65,  0,  0,  0, 11,  2,  0,  0, 12,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 12,  2,  0,  0, 10,  2,  0,  0,
-132,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 86,  1,  0,  0, 23,  0,  0,  0,209,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-209,  0,  0,  0, 12,  2,  0,  0, 86,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,132,  0,  0,  0, 86,  1,  0,  0, 12,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 12,  2,  0,  0,209,  0,  0,  0, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 11,  2,  0,  0,
- 65,  0,  0,  0,208,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,208,  0,  0,  0,244,  0,  0,  0, 11,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 83,  0,  0,  0, 11,  2,  0,  0,244,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,244,  0,  0,  0,208,  0,  0,  0,
- 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 86,  1,  0,  0,132,  0,  0,  0, 13,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 13,  2,  0,  0, 88,  1,  0,  0, 86,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 23,  0,  0,  0, 86,  1,  0,  0, 88,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 88,  1,  0,  0, 13,  2,  0,  0,133,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 14,  2,  0,  0,
-133,  0,  0,  0, 13,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 13,  2,  0,  0, 15,  2,  0,  0, 14,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,134,  0,  0,  0, 14,  2,  0,  0, 15,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 15,  2,  0,  0, 13,  2,  0,  0,
-132,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 87,  1,  0,  0, 32,  0,  0,  0, 91,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 91,  1,  0,  0, 15,  2,  0,  0, 87,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,132,  0,  0,  0, 87,  1,  0,  0, 15,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 15,  2,  0,  0, 91,  1,  0,  0,134,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 14,  2,  0,  0,
-134,  0,  0,  0, 90,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 90,  1,  0,  0, 89,  1,  0,  0, 14,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,133,  0,  0,  0, 14,  2,  0,  0, 89,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 89,  1,  0,  0, 90,  1,  0,  0,
- 24,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,212,  0,  0,  0, 67,  0,  0,  0, 16,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 16,  2,  0,  0,242,  0,  0,  0,212,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  6,  0,  0,  0,212,  0,  0,  0,242,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,242,  0,  0,  0, 16,  2,  0,  0, 82,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 17,  2,  0,  0,
- 82,  0,  0,  0, 16,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 16,  2,  0,  0, 18,  2,  0,  0, 17,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,134,  0,  0,  0, 17,  2,  0,  0, 18,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 18,  2,  0,  0, 16,  2,  0,  0,
- 67,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,213,  0,  0,  0, 24,  0,  0,  0, 90,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 90,  1,  0,  0, 18,  2,  0,  0,213,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 67,  0,  0,  0,213,  0,  0,  0, 18,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 18,  2,  0,  0, 90,  1,  0,  0,134,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 17,  2,  0,  0,
-134,  0,  0,  0, 91,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 91,  1,  0,  0,243,  0,  0,  0, 17,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 82,  0,  0,  0, 17,  2,  0,  0,243,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,243,  0,  0,  0, 91,  1,  0,  0,
- 32,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,211,  0,  0,  0, 66,  0,  0,  0, 19,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 19,  2,  0,  0, 89,  1,  0,  0,211,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 24,  0,  0,  0,211,  0,  0,  0, 89,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 89,  1,  0,  0, 19,  2,  0,  0,133,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 20,  2,  0,  0,
-133,  0,  0,  0, 19,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 19,  2,  0,  0, 21,  2,  0,  0, 20,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 64,  0,  0,  0, 20,  2,  0,  0, 21,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 21,  2,  0,  0, 19,  2,  0,  0,
- 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,210,  0,  0,  0,  1,  0,  0,  0,206,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-206,  0,  0,  0, 21,  2,  0,  0,210,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 66,  0,  0,  0,210,  0,  0,  0, 21,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 21,  2,  0,  0,206,  0,  0,  0, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 20,  2,  0,  0,
- 64,  0,  0,  0,207,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,207,  0,  0,  0, 88,  1,  0,  0, 20,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,133,  0,  0,  0, 20,  2,  0,  0, 88,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 88,  1,  0,  0,207,  0,  0,  0,
- 23,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 93,  1,  0,  0,135,  0,  0,  0, 22,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 22,  2,  0,  0,247,  0,  0,  0, 93,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 33,  0,  0,  0, 93,  1,  0,  0,247,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,247,  0,  0,  0, 22,  2,  0,  0, 84,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 23,  2,  0,  0,
- 84,  0,  0,  0, 22,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 22,  2,  0,  0, 24,  2,  0,  0, 23,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 69,  0,  0,  0, 23,  2,  0,  0, 24,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 24,  2,  0,  0, 22,  2,  0,  0,
-135,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 92,  1,  0,  0, 25,  0,  0,  0,217,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-217,  0,  0,  0, 24,  2,  0,  0, 92,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,135,  0,  0,  0, 92,  1,  0,  0, 24,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 24,  2,  0,  0,217,  0,  0,  0, 69,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 23,  2,  0,  0,
- 69,  0,  0,  0,216,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,216,  0,  0,  0,246,  0,  0,  0, 23,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 84,  0,  0,  0, 23,  2,  0,  0,246,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,246,  0,  0,  0,216,  0,  0,  0,
-  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 92,  1,  0,  0,135,  0,  0,  0, 25,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 25,  2,  0,  0, 94,  1,  0,  0, 92,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 25,  0,  0,  0, 92,  1,  0,  0, 94,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 94,  1,  0,  0, 25,  2,  0,  0,136,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 26,  2,  0,  0,
-136,  0,  0,  0, 25,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 25,  2,  0,  0, 27,  2,  0,  0, 26,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,137,  0,  0,  0, 26,  2,  0,  0, 27,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 27,  2,  0,  0, 25,  2,  0,  0,
-135,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 93,  1,  0,  0, 33,  0,  0,  0, 97,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 97,  1,  0,  0, 27,  2,  0,  0, 93,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,135,  0,  0,  0, 93,  1,  0,  0, 27,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 27,  2,  0,  0, 97,  1,  0,  0,137,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 26,  2,  0,  0,
-137,  0,  0,  0, 96,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 96,  1,  0,  0, 95,  1,  0,  0, 26,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,136,  0,  0,  0, 26,  2,  0,  0, 95,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 95,  1,  0,  0, 96,  1,  0,  0,
- 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,220,  0,  0,  0, 71,  0,  0,  0, 28,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 28,  2,  0,  0,248,  0,  0,  0,220,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  7,  0,  0,  0,220,  0,  0,  0,248,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,248,  0,  0,  0, 28,  2,  0,  0, 85,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 29,  2,  0,  0,
- 85,  0,  0,  0, 28,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 28,  2,  0,  0, 30,  2,  0,  0, 29,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,137,  0,  0,  0, 29,  2,  0,  0, 30,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 30,  2,  0,  0, 28,  2,  0,  0,
- 71,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,221,  0,  0,  0, 26,  0,  0,  0, 96,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 96,  1,  0,  0, 30,  2,  0,  0,221,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 71,  0,  0,  0,221,  0,  0,  0, 30,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 30,  2,  0,  0, 96,  1,  0,  0,137,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 29,  2,  0,  0,
-137,  0,  0,  0, 97,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 97,  1,  0,  0,249,  0,  0,  0, 29,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 85,  0,  0,  0, 29,  2,  0,  0,249,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,249,  0,  0,  0, 97,  1,  0,  0,
- 33,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,219,  0,  0,  0, 70,  0,  0,  0, 31,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 31,  2,  0,  0, 95,  1,  0,  0,219,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 26,  0,  0,  0,219,  0,  0,  0, 95,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 95,  1,  0,  0, 31,  2,  0,  0,136,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 32,  2,  0,  0,
-136,  0,  0,  0, 31,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 31,  2,  0,  0, 33,  2,  0,  0, 32,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 68,  0,  0,  0, 32,  2,  0,  0, 33,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 33,  2,  0,  0, 31,  2,  0,  0,
- 70,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,218,  0,  0,  0,  2,  0,  0,  0,214,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-214,  0,  0,  0, 33,  2,  0,  0,218,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 70,  0,  0,  0,218,  0,  0,  0, 33,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 33,  2,  0,  0,214,  0,  0,  0, 68,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 32,  2,  0,  0,
- 68,  0,  0,  0,215,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,215,  0,  0,  0, 94,  1,  0,  0, 32,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,136,  0,  0,  0, 32,  2,  0,  0, 94,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 94,  1,  0,  0,215,  0,  0,  0,
- 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 99,  1,  0,  0,138,  0,  0,  0, 34,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 34,  2,  0,  0,251,  0,  0,  0, 99,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 34,  0,  0,  0, 99,  1,  0,  0,251,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,251,  0,  0,  0, 34,  2,  0,  0, 86,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 35,  2,  0,  0,
- 86,  0,  0,  0, 34,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 34,  2,  0,  0, 36,  2,  0,  0, 35,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 73,  0,  0,  0, 35,  2,  0,  0, 36,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 36,  2,  0,  0, 34,  2,  0,  0,
-138,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 98,  1,  0,  0, 27,  0,  0,  0,225,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-225,  0,  0,  0, 36,  2,  0,  0, 98,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,138,  0,  0,  0, 98,  1,  0,  0, 36,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 36,  2,  0,  0,225,  0,  0,  0, 73,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 35,  2,  0,  0,
- 73,  0,  0,  0,224,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,224,  0,  0,  0,250,  0,  0,  0, 35,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 86,  0,  0,  0, 35,  2,  0,  0,250,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,250,  0,  0,  0,224,  0,  0,  0,
-  7,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 98,  1,  0,  0,138,  0,  0,  0, 37,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 37,  2,  0,  0,100,  1,  0,  0, 98,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 27,  0,  0,  0, 98,  1,  0,  0,100,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,100,  1,  0,  0, 37,  2,  0,  0,139,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 38,  2,  0,  0,
-139,  0,  0,  0, 37,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 37,  2,  0,  0, 39,  2,  0,  0, 38,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,140,  0,  0,  0, 38,  2,  0,  0, 39,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 39,  2,  0,  0, 37,  2,  0,  0,
-138,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 99,  1,  0,  0, 34,  0,  0,  0,103,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-103,  1,  0,  0, 39,  2,  0,  0, 99,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,138,  0,  0,  0, 99,  1,  0,  0, 39,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 39,  2,  0,  0,103,  1,  0,  0,140,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 38,  2,  0,  0,
-140,  0,  0,  0,102,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,102,  1,  0,  0,101,  1,  0,  0, 38,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,139,  0,  0,  0, 38,  2,  0,  0,101,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,101,  1,  0,  0,102,  1,  0,  0,
- 28,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,228,  0,  0,  0, 75,  0,  0,  0, 40,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 40,  2,  0,  0,252,  0,  0,  0,228,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  8,  0,  0,  0,228,  0,  0,  0,252,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,252,  0,  0,  0, 40,  2,  0,  0, 87,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 41,  2,  0,  0,
- 87,  0,  0,  0, 40,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 40,  2,  0,  0, 42,  2,  0,  0, 41,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,140,  0,  0,  0, 41,  2,  0,  0, 42,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 42,  2,  0,  0, 40,  2,  0,  0,
- 75,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,229,  0,  0,  0, 28,  0,  0,  0,102,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-102,  1,  0,  0, 42,  2,  0,  0,229,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 75,  0,  0,  0,229,  0,  0,  0, 42,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 42,  2,  0,  0,102,  1,  0,  0,140,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 41,  2,  0,  0,
-140,  0,  0,  0,103,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,103,  1,  0,  0,253,  0,  0,  0, 41,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 87,  0,  0,  0, 41,  2,  0,  0,253,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,253,  0,  0,  0,103,  1,  0,  0,
- 34,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,227,  0,  0,  0, 74,  0,  0,  0, 43,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 43,  2,  0,  0,101,  1,  0,  0,227,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 28,  0,  0,  0,227,  0,  0,  0,101,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,101,  1,  0,  0, 43,  2,  0,  0,139,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 44,  2,  0,  0,
-139,  0,  0,  0, 43,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 43,  2,  0,  0, 45,  2,  0,  0, 44,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 72,  0,  0,  0, 44,  2,  0,  0, 45,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 45,  2,  0,  0, 43,  2,  0,  0,
- 74,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,226,  0,  0,  0,  3,  0,  0,  0,222,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-222,  0,  0,  0, 45,  2,  0,  0,226,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 74,  0,  0,  0,226,  0,  0,  0, 45,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 45,  2,  0,  0,222,  0,  0,  0, 72,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 44,  2,  0,  0,
- 72,  0,  0,  0,223,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,223,  0,  0,  0,100,  1,  0,  0, 44,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,139,  0,  0,  0, 44,  2,  0,  0,100,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,100,  1,  0,  0,223,  0,  0,  0,
- 27,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,105,  1,  0,  0,141,  0,  0,  0, 46,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 46,  2,  0,  0,255,  0,  0,  0,105,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 35,  0,  0,  0,105,  1,  0,  0,255,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,255,  0,  0,  0, 46,  2,  0,  0, 88,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 47,  2,  0,  0,
- 88,  0,  0,  0, 46,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 46,  2,  0,  0, 48,  2,  0,  0, 47,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 77,  0,  0,  0, 47,  2,  0,  0, 48,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 48,  2,  0,  0, 46,  2,  0,  0,
-141,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,104,  1,  0,  0, 29,  0,  0,  0,233,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-233,  0,  0,  0, 48,  2,  0,  0,104,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,141,  0,  0,  0,104,  1,  0,  0, 48,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 48,  2,  0,  0,233,  0,  0,  0, 77,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 47,  2,  0,  0,
- 77,  0,  0,  0,232,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,232,  0,  0,  0,254,  0,  0,  0, 47,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 88,  0,  0,  0, 47,  2,  0,  0,254,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,254,  0,  0,  0,232,  0,  0,  0,
-  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,104,  1,  0,  0,141,  0,  0,  0, 49,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 49,  2,  0,  0,106,  1,  0,  0,104,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 29,  0,  0,  0,104,  1,  0,  0,106,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,106,  1,  0,  0, 49,  2,  0,  0,142,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 50,  2,  0,  0,
-142,  0,  0,  0, 49,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 49,  2,  0,  0, 51,  2,  0,  0, 50,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,143,  0,  0,  0, 50,  2,  0,  0, 51,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 51,  2,  0,  0, 49,  2,  0,  0,
-141,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,105,  1,  0,  0, 35,  0,  0,  0,109,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-109,  1,  0,  0, 51,  2,  0,  0,105,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,141,  0,  0,  0,105,  1,  0,  0, 51,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 51,  2,  0,  0,109,  1,  0,  0,143,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 50,  2,  0,  0,
-143,  0,  0,  0,108,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,108,  1,  0,  0,107,  1,  0,  0, 50,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,142,  0,  0,  0, 50,  2,  0,  0,107,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,107,  1,  0,  0,108,  1,  0,  0,
- 30,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,236,  0,  0,  0, 79,  0,  0,  0, 52,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 52,  2,  0,  0,  0,  1,  0,  0,236,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  9,  0,  0,  0,236,  0,  0,  0,  0,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,  0,  1,  0,  0, 52,  2,  0,  0, 89,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 53,  2,  0,  0,
- 89,  0,  0,  0, 52,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 52,  2,  0,  0, 54,  2,  0,  0, 53,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,143,  0,  0,  0, 53,  2,  0,  0, 54,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 54,  2,  0,  0, 52,  2,  0,  0,
- 79,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,237,  0,  0,  0, 30,  0,  0,  0,108,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-108,  1,  0,  0, 54,  2,  0,  0,237,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 79,  0,  0,  0,237,  0,  0,  0, 54,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 54,  2,  0,  0,108,  1,  0,  0,143,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 53,  2,  0,  0,
-143,  0,  0,  0,109,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,109,  1,  0,  0,  1,  1,  0,  0, 53,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 89,  0,  0,  0, 53,  2,  0,  0,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  1,  1,  0,  0,109,  1,  0,  0,
- 35,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,235,  0,  0,  0, 78,  0,  0,  0, 55,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 55,  2,  0,  0,107,  1,  0,  0,235,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 30,  0,  0,  0,235,  0,  0,  0,107,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,107,  1,  0,  0, 55,  2,  0,  0,142,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 56,  2,  0,  0,
-142,  0,  0,  0, 55,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 55,  2,  0,  0, 57,  2,  0,  0, 56,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 76,  0,  0,  0, 56,  2,  0,  0, 57,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 57,  2,  0,  0, 55,  2,  0,  0,
- 78,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,234,  0,  0,  0,  4,  0,  0,  0,230,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-230,  0,  0,  0, 57,  2,  0,  0,234,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 78,  0,  0,  0,234,  0,  0,  0, 57,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 57,  2,  0,  0,230,  0,  0,  0, 76,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 56,  2,  0,  0,
- 76,  0,  0,  0,231,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,231,  0,  0,  0,106,  1,  0,  0, 56,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,142,  0,  0,  0, 56,  2,  0,  0,106,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,106,  1,  0,  0,231,  0,  0,  0,
- 29,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,111,  1,  0,  0,144,  0,  0,  0, 58,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 58,  2,  0,  0,  3,  1,  0,  0,111,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 36,  0,  0,  0,111,  1,  0,  0,  3,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,  3,  1,  0,  0, 58,  2,  0,  0, 90,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 59,  2,  0,  0,
- 90,  0,  0,  0, 58,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 58,  2,  0,  0, 60,  2,  0,  0, 59,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 81,  0,  0,  0, 59,  2,  0,  0, 60,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 60,  2,  0,  0, 58,  2,  0,  0,
-144,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,110,  1,  0,  0, 31,  0,  0,  0,241,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-241,  0,  0,  0, 60,  2,  0,  0,110,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,144,  0,  0,  0,110,  1,  0,  0, 60,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 60,  2,  0,  0,241,  0,  0,  0, 81,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 59,  2,  0,  0,
- 81,  0,  0,  0,240,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,240,  0,  0,  0,  2,  1,  0,  0, 59,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 90,  0,  0,  0, 59,  2,  0,  0,  2,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  2,  1,  0,  0,240,  0,  0,  0,
-  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,110,  1,  0,  0,144,  0,  0,  0, 61,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 61,  2,  0,  0,113,  1,  0,  0,110,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 31,  0,  0,  0,110,  1,  0,  0,113,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,113,  1,  0,  0, 61,  2,  0,  0,145,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 62,  2,  0,  0,
-145,  0,  0,  0, 61,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 61,  2,  0,  0, 63,  2,  0,  0, 62,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,146,  0,  0,  0, 62,  2,  0,  0, 63,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 63,  2,  0,  0, 61,  2,  0,  0,
-144,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,111,  1,  0,  0, 36,  0,  0,  0,115,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-115,  1,  0,  0, 63,  2,  0,  0,111,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,144,  0,  0,  0,111,  1,  0,  0, 63,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 63,  2,  0,  0,115,  1,  0,  0,146,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 62,  2,  0,  0,
-146,  0,  0,  0,114,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,114,  1,  0,  0,112,  1,  0,  0, 62,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,145,  0,  0,  0, 62,  2,  0,  0,112,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,112,  1,  0,  0,114,  1,  0,  0,
- 22,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,204,  0,  0,  0, 63,  0,  0,  0, 64,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 64,  2,  0,  0,  4,  1,  0,  0,204,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 10,  0,  0,  0,204,  0,  0,  0,  4,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,  4,  1,  0,  0, 64,  2,  0,  0, 91,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 65,  2,  0,  0,
- 91,  0,  0,  0, 64,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 64,  2,  0,  0, 66,  2,  0,  0, 65,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,146,  0,  0,  0, 65,  2,  0,  0, 66,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 66,  2,  0,  0, 64,  2,  0,  0,
- 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,205,  0,  0,  0, 22,  0,  0,  0,114,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-114,  1,  0,  0, 66,  2,  0,  0,205,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 63,  0,  0,  0,205,  0,  0,  0, 66,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 66,  2,  0,  0,114,  1,  0,  0,146,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 65,  2,  0,  0,
-146,  0,  0,  0,115,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,115,  1,  0,  0,  5,  1,  0,  0, 65,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 91,  0,  0,  0, 65,  2,  0,  0,  5,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  5,  1,  0,  0,115,  1,  0,  0,
- 36,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,203,  0,  0,  0, 62,  0,  0,  0, 67,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 67,  2,  0,  0,112,  1,  0,  0,203,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 22,  0,  0,  0,203,  0,  0,  0,112,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,112,  1,  0,  0, 67,  2,  0,  0,145,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 68,  2,  0,  0,
-145,  0,  0,  0, 67,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 67,  2,  0,  0, 69,  2,  0,  0, 68,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 80,  0,  0,  0, 68,  2,  0,  0, 69,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 69,  2,  0,  0, 67,  2,  0,  0,
- 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,202,  0,  0,  0,  5,  0,  0,  0,238,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-238,  0,  0,  0, 69,  2,  0,  0,202,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 62,  0,  0,  0,202,  0,  0,  0, 69,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 69,  2,  0,  0,238,  0,  0,  0, 80,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 68,  2,  0,  0,
- 80,  0,  0,  0,239,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,239,  0,  0,  0,113,  1,  0,  0, 68,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,145,  0,  0,  0, 68,  2,  0,  0,113,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,113,  1,  0,  0,239,  0,  0,  0,
- 31,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 70,  2,  0,  0,147,  0,  0,  0,117,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-117,  1,  0,  0, 11,  1,  0,  0, 70,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 94,  0,  0,  0, 70,  2,  0,  0, 11,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 11,  1,  0,  0,117,  1,  0,  0, 38,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 70,  2,  0,  0,
- 94,  0,  0,  0, 71,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 71,  2,  0,  0, 72,  2,  0,  0, 70,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,147,  0,  0,  0, 70,  2,  0,  0, 72,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 72,  2,  0,  0, 71,  2,  0,  0,
- 82,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,243,  0,  0,  0, 32,  0,  0,  0,116,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-116,  1,  0,  0, 72,  2,  0,  0,243,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 82,  0,  0,  0,243,  0,  0,  0, 72,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 72,  2,  0,  0,116,  1,  0,  0,147,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,242,  0,  0,  0,
- 82,  0,  0,  0, 71,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 71,  2,  0,  0, 10,  1,  0,  0,242,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,  6,  0,  0,  0,242,  0,  0,  0, 10,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 10,  1,  0,  0, 71,  2,  0,  0,
- 94,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 73,  2,  0,  0,147,  0,  0,  0,116,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-116,  1,  0,  0,118,  1,  0,  0, 73,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,148,  0,  0,  0, 73,  2,  0,  0,118,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,118,  1,  0,  0,116,  1,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 73,  2,  0,  0,
-148,  0,  0,  0, 74,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 74,  2,  0,  0, 75,  2,  0,  0, 73,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,147,  0,  0,  0, 73,  2,  0,  0, 75,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 75,  2,  0,  0, 74,  2,  0,  0,
-149,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,121,  1,  0,  0, 38,  0,  0,  0,117,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-117,  1,  0,  0, 75,  2,  0,  0,121,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,149,  0,  0,  0,121,  1,  0,  0, 75,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 75,  2,  0,  0,117,  1,  0,  0,147,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,120,  1,  0,  0,
-149,  0,  0,  0, 74,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 74,  2,  0,  0,119,  1,  0,  0,120,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 37,  0,  0,  0,120,  1,  0,  0,119,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,119,  1,  0,  0, 74,  2,  0,  0,
-148,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 76,  2,  0,  0, 93,  0,  0,  0,  8,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-  8,  1,  0,  0, 12,  1,  0,  0, 76,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 95,  0,  0,  0, 76,  2,  0,  0, 12,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 12,  1,  0,  0,  8,  1,  0,  0, 11,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 76,  2,  0,  0,
- 95,  0,  0,  0, 77,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 77,  2,  0,  0, 78,  2,  0,  0, 76,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 93,  0,  0,  0, 76,  2,  0,  0, 78,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 78,  2,  0,  0, 77,  2,  0,  0,
-149,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,120,  1,  0,  0, 37,  0,  0,  0,  9,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-  9,  1,  0,  0, 78,  2,  0,  0,120,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,149,  0,  0,  0,120,  1,  0,  0, 78,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 78,  2,  0,  0,  9,  1,  0,  0, 93,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,121,  1,  0,  0,
-149,  0,  0,  0, 77,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 77,  2,  0,  0, 13,  1,  0,  0,121,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 38,  0,  0,  0,121,  1,  0,  0, 13,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 13,  1,  0,  0, 77,  2,  0,  0,
- 95,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 79,  2,  0,  0, 92,  0,  0,  0,  7,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-  7,  1,  0,  0,119,  1,  0,  0, 79,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,148,  0,  0,  0, 79,  2,  0,  0,119,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,119,  1,  0,  0,  7,  1,  0,  0, 37,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 79,  2,  0,  0,
-148,  0,  0,  0, 80,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 80,  2,  0,  0, 81,  2,  0,  0, 79,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 92,  0,  0,  0, 79,  2,  0,  0, 81,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 81,  2,  0,  0, 80,  2,  0,  0,
- 83,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,244,  0,  0,  0, 10,  0,  0,  0,  6,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-  6,  1,  0,  0, 81,  2,  0,  0,244,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 83,  0,  0,  0,244,  0,  0,  0, 81,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 81,  2,  0,  0,  6,  1,  0,  0, 92,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,245,  0,  0,  0,
- 83,  0,  0,  0, 80,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 80,  2,  0,  0,118,  1,  0,  0,245,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 32,  0,  0,  0,245,  0,  0,  0,118,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,118,  1,  0,  0, 80,  2,  0,  0,
-148,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 82,  2,  0,  0,150,  0,  0,  0,123,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-123,  1,  0,  0, 15,  1,  0,  0, 82,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 96,  0,  0,  0, 82,  2,  0,  0, 15,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 15,  1,  0,  0,123,  1,  0,  0, 39,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 82,  2,  0,  0,
- 96,  0,  0,  0, 83,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 83,  2,  0,  0, 84,  2,  0,  0, 82,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,150,  0,  0,  0, 82,  2,  0,  0, 84,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 84,  2,  0,  0, 83,  2,  0,  0,
- 85,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,249,  0,  0,  0, 33,  0,  0,  0,122,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-122,  1,  0,  0, 84,  2,  0,  0,249,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 85,  0,  0,  0,249,  0,  0,  0, 84,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 84,  2,  0,  0,122,  1,  0,  0,150,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,248,  0,  0,  0,
- 85,  0,  0,  0, 83,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 83,  2,  0,  0, 14,  1,  0,  0,248,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,  7,  0,  0,  0,248,  0,  0,  0, 14,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 14,  1,  0,  0, 83,  2,  0,  0,
- 96,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 85,  2,  0,  0,150,  0,  0,  0,122,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-122,  1,  0,  0,124,  1,  0,  0, 85,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,151,  0,  0,  0, 85,  2,  0,  0,124,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,124,  1,  0,  0,122,  1,  0,  0, 33,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 85,  2,  0,  0,
-151,  0,  0,  0, 86,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 86,  2,  0,  0, 87,  2,  0,  0, 85,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,150,  0,  0,  0, 85,  2,  0,  0, 87,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 87,  2,  0,  0, 86,  2,  0,  0,
-152,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,127,  1,  0,  0, 39,  0,  0,  0,123,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-123,  1,  0,  0, 87,  2,  0,  0,127,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,152,  0,  0,  0,127,  1,  0,  0, 87,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 87,  2,  0,  0,123,  1,  0,  0,150,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,126,  1,  0,  0,
-152,  0,  0,  0, 86,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 86,  2,  0,  0,125,  1,  0,  0,126,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 38,  0,  0,  0,126,  1,  0,  0,125,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,125,  1,  0,  0, 86,  2,  0,  0,
-151,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 88,  2,  0,  0, 95,  0,  0,  0, 12,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 12,  1,  0,  0, 16,  1,  0,  0, 88,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 97,  0,  0,  0, 88,  2,  0,  0, 16,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 16,  1,  0,  0, 12,  1,  0,  0, 11,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 88,  2,  0,  0,
- 97,  0,  0,  0, 89,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 89,  2,  0,  0, 90,  2,  0,  0, 88,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 95,  0,  0,  0, 88,  2,  0,  0, 90,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 90,  2,  0,  0, 89,  2,  0,  0,
-152,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,126,  1,  0,  0, 38,  0,  0,  0, 13,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 13,  1,  0,  0, 90,  2,  0,  0,126,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,152,  0,  0,  0,126,  1,  0,  0, 90,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 90,  2,  0,  0, 13,  1,  0,  0, 95,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,127,  1,  0,  0,
-152,  0,  0,  0, 89,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 89,  2,  0,  0, 17,  1,  0,  0,127,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 39,  0,  0,  0,127,  1,  0,  0, 17,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 17,  1,  0,  0, 89,  2,  0,  0,
- 97,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 91,  2,  0,  0, 94,  0,  0,  0, 11,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 11,  1,  0,  0,125,  1,  0,  0, 91,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,151,  0,  0,  0, 91,  2,  0,  0,125,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,125,  1,  0,  0, 11,  1,  0,  0, 38,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 91,  2,  0,  0,
-151,  0,  0,  0, 92,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 92,  2,  0,  0, 93,  2,  0,  0, 91,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 94,  0,  0,  0, 91,  2,  0,  0, 93,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 93,  2,  0,  0, 92,  2,  0,  0,
- 84,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,246,  0,  0,  0,  6,  0,  0,  0, 10,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 10,  1,  0,  0, 93,  2,  0,  0,246,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 84,  0,  0,  0,246,  0,  0,  0, 93,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 93,  2,  0,  0, 10,  1,  0,  0, 94,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,247,  0,  0,  0,
- 84,  0,  0,  0, 92,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 92,  2,  0,  0,124,  1,  0,  0,247,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 33,  0,  0,  0,247,  0,  0,  0,124,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,124,  1,  0,  0, 92,  2,  0,  0,
-151,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 94,  2,  0,  0,153,  0,  0,  0,129,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-129,  1,  0,  0, 19,  1,  0,  0, 94,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 98,  0,  0,  0, 94,  2,  0,  0, 19,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 19,  1,  0,  0,129,  1,  0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 94,  2,  0,  0,
- 98,  0,  0,  0, 95,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 95,  2,  0,  0, 96,  2,  0,  0, 94,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,153,  0,  0,  0, 94,  2,  0,  0, 96,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 96,  2,  0,  0, 95,  2,  0,  0,
- 87,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,253,  0,  0,  0, 34,  0,  0,  0,128,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-128,  1,  0,  0, 96,  2,  0,  0,253,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 87,  0,  0,  0,253,  0,  0,  0, 96,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 96,  2,  0,  0,128,  1,  0,  0,153,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,252,  0,  0,  0,
- 87,  0,  0,  0, 95,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 95,  2,  0,  0, 18,  1,  0,  0,252,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,  8,  0,  0,  0,252,  0,  0,  0, 18,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 18,  1,  0,  0, 95,  2,  0,  0,
- 98,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 97,  2,  0,  0,153,  0,  0,  0,128,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-128,  1,  0,  0,130,  1,  0,  0, 97,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,154,  0,  0,  0, 97,  2,  0,  0,130,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,130,  1,  0,  0,128,  1,  0,  0, 34,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 97,  2,  0,  0,
-154,  0,  0,  0, 98,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 98,  2,  0,  0, 99,  2,  0,  0, 97,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,153,  0,  0,  0, 97,  2,  0,  0, 99,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 99,  2,  0,  0, 98,  2,  0,  0,
-155,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,133,  1,  0,  0, 40,  0,  0,  0,129,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-129,  1,  0,  0, 99,  2,  0,  0,133,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,155,  0,  0,  0,133,  1,  0,  0, 99,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 99,  2,  0,  0,129,  1,  0,  0,153,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,132,  1,  0,  0,
-155,  0,  0,  0, 98,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 98,  2,  0,  0,131,  1,  0,  0,132,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 39,  0,  0,  0,132,  1,  0,  0,131,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,131,  1,  0,  0, 98,  2,  0,  0,
-154,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,100,  2,  0,  0, 97,  0,  0,  0, 16,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 16,  1,  0,  0, 20,  1,  0,  0,100,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 99,  0,  0,  0,100,  2,  0,  0, 20,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 20,  1,  0,  0, 16,  1,  0,  0, 11,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,100,  2,  0,  0,
- 99,  0,  0,  0,101,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,101,  2,  0,  0,102,  2,  0,  0,100,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 97,  0,  0,  0,100,  2,  0,  0,102,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,102,  2,  0,  0,101,  2,  0,  0,
-155,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,132,  1,  0,  0, 39,  0,  0,  0, 17,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 17,  1,  0,  0,102,  2,  0,  0,132,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,155,  0,  0,  0,132,  1,  0,  0,102,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,102,  2,  0,  0, 17,  1,  0,  0, 97,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,133,  1,  0,  0,
-155,  0,  0,  0,101,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,101,  2,  0,  0, 21,  1,  0,  0,133,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 40,  0,  0,  0,133,  1,  0,  0, 21,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 21,  1,  0,  0,101,  2,  0,  0,
- 99,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,103,  2,  0,  0, 96,  0,  0,  0, 15,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 15,  1,  0,  0,131,  1,  0,  0,103,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,154,  0,  0,  0,103,  2,  0,  0,131,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,131,  1,  0,  0, 15,  1,  0,  0, 39,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,103,  2,  0,  0,
-154,  0,  0,  0,104,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,104,  2,  0,  0,105,  2,  0,  0,103,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 96,  0,  0,  0,103,  2,  0,  0,105,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,105,  2,  0,  0,104,  2,  0,  0,
- 86,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,250,  0,  0,  0,  7,  0,  0,  0, 14,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 14,  1,  0,  0,105,  2,  0,  0,250,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 86,  0,  0,  0,250,  0,  0,  0,105,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,105,  2,  0,  0, 14,  1,  0,  0, 96,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,251,  0,  0,  0,
- 86,  0,  0,  0,104,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,104,  2,  0,  0,130,  1,  0,  0,251,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 34,  0,  0,  0,251,  0,  0,  0,130,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,130,  1,  0,  0,104,  2,  0,  0,
-154,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,106,  2,  0,  0,156,  0,  0,  0,135,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-135,  1,  0,  0, 23,  1,  0,  0,106,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,100,  0,  0,  0,106,  2,  0,  0, 23,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 23,  1,  0,  0,135,  1,  0,  0, 41,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,106,  2,  0,  0,
-100,  0,  0,  0,107,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,107,  2,  0,  0,108,  2,  0,  0,106,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,156,  0,  0,  0,106,  2,  0,  0,108,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,108,  2,  0,  0,107,  2,  0,  0,
- 89,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  1,  1,  0,  0, 35,  0,  0,  0,134,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-134,  1,  0,  0,108,  2,  0,  0,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 89,  0,  0,  0,  1,  1,  0,  0,108,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,108,  2,  0,  0,134,  1,  0,  0,156,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  1,  0,  0,
- 89,  0,  0,  0,107,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,107,  2,  0,  0, 22,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,  9,  0,  0,  0,  0,  1,  0,  0, 22,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 22,  1,  0,  0,107,  2,  0,  0,
-100,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,109,  2,  0,  0,156,  0,  0,  0,134,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-134,  1,  0,  0,136,  1,  0,  0,109,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,157,  0,  0,  0,109,  2,  0,  0,136,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,136,  1,  0,  0,134,  1,  0,  0, 35,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,109,  2,  0,  0,
-157,  0,  0,  0,110,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,110,  2,  0,  0,111,  2,  0,  0,109,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,156,  0,  0,  0,109,  2,  0,  0,111,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,111,  2,  0,  0,110,  2,  0,  0,
-158,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,139,  1,  0,  0, 41,  0,  0,  0,135,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-135,  1,  0,  0,111,  2,  0,  0,139,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,158,  0,  0,  0,139,  1,  0,  0,111,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,111,  2,  0,  0,135,  1,  0,  0,156,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,138,  1,  0,  0,
-158,  0,  0,  0,110,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,110,  2,  0,  0,137,  1,  0,  0,138,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 40,  0,  0,  0,138,  1,  0,  0,137,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,137,  1,  0,  0,110,  2,  0,  0,
-157,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,112,  2,  0,  0, 99,  0,  0,  0, 20,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 20,  1,  0,  0, 24,  1,  0,  0,112,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,101,  0,  0,  0,112,  2,  0,  0, 24,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3, 24,  1,  0,  0, 20,  1,  0,  0, 11,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,112,  2,  0,  0,
-101,  0,  0,  0,113,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,113,  2,  0,  0,114,  2,  0,  0,112,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 99,  0,  0,  0,112,  2,  0,  0,114,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,114,  2,  0,  0,113,  2,  0,  0,
-158,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,138,  1,  0,  0, 40,  0,  0,  0, 21,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 21,  1,  0,  0,114,  2,  0,  0,138,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,158,  0,  0,  0,138,  1,  0,  0,114,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,114,  2,  0,  0, 21,  1,  0,  0, 99,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,139,  1,  0,  0,
-158,  0,  0,  0,113,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,113,  2,  0,  0, 25,  1,  0,  0,139,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 41,  0,  0,  0,139,  1,  0,  0, 25,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 25,  1,  0,  0,113,  2,  0,  0,
-101,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,115,  2,  0,  0, 98,  0,  0,  0, 19,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 19,  1,  0,  0,137,  1,  0,  0,115,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,157,  0,  0,  0,115,  2,  0,  0,137,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,137,  1,  0,  0, 19,  1,  0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,115,  2,  0,  0,
-157,  0,  0,  0,116,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,116,  2,  0,  0,117,  2,  0,  0,115,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 98,  0,  0,  0,115,  2,  0,  0,117,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,117,  2,  0,  0,116,  2,  0,  0,
- 88,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,254,  0,  0,  0,  8,  0,  0,  0, 18,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 18,  1,  0,  0,117,  2,  0,  0,254,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 88,  0,  0,  0,254,  0,  0,  0,117,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,117,  2,  0,  0, 18,  1,  0,  0, 98,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,255,  0,  0,  0,
- 88,  0,  0,  0,116,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,116,  2,  0,  0,136,  1,  0,  0,255,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 35,  0,  0,  0,255,  0,  0,  0,136,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,136,  1,  0,  0,116,  2,  0,  0,
-157,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,118,  2,  0,  0,159,  0,  0,  0,141,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-141,  1,  0,  0,  7,  1,  0,  0,118,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 92,  0,  0,  0,118,  2,  0,  0,  7,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,  7,  1,  0,  0,141,  1,  0,  0, 37,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,118,  2,  0,  0,
- 92,  0,  0,  0,119,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,119,  2,  0,  0,120,  2,  0,  0,118,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,159,  0,  0,  0,118,  2,  0,  0,120,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,120,  2,  0,  0,119,  2,  0,  0,
- 91,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  5,  1,  0,  0, 36,  0,  0,  0,140,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-140,  1,  0,  0,120,  2,  0,  0,  5,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 91,  0,  0,  0,  5,  1,  0,  0,120,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,120,  2,  0,  0,140,  1,  0,  0,159,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  4,  1,  0,  0,
- 91,  0,  0,  0,119,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,119,  2,  0,  0,  6,  1,  0,  0,  4,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 10,  0,  0,  0,  4,  1,  0,  0,  6,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  6,  1,  0,  0,119,  2,  0,  0,
- 92,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,121,  2,  0,  0,159,  0,  0,  0,140,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-140,  1,  0,  0,142,  1,  0,  0,121,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,160,  0,  0,  0,121,  2,  0,  0,142,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,142,  1,  0,  0,140,  1,  0,  0, 36,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,121,  2,  0,  0,
-160,  0,  0,  0,122,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,122,  2,  0,  0,123,  2,  0,  0,121,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,159,  0,  0,  0,121,  2,  0,  0,123,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,123,  2,  0,  0,122,  2,  0,  0,
-161,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,144,  1,  0,  0, 37,  0,  0,  0,141,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
-141,  1,  0,  0,123,  2,  0,  0,144,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,161,  0,  0,  0,144,  1,  0,  0,123,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,123,  2,  0,  0,141,  1,  0,  0,159,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,145,  1,  0,  0,
-161,  0,  0,  0,122,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,122,  2,  0,  0,143,  1,  0,  0,145,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 41,  0,  0,  0,145,  1,  0,  0,143,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,143,  1,  0,  0,122,  2,  0,  0,
-160,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,124,  2,  0,  0,101,  0,  0,  0, 24,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 24,  1,  0,  0,  8,  1,  0,  0,124,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 93,  0,  0,  0,124,  2,  0,  0,  8,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,  8,  1,  0,  0, 24,  1,  0,  0, 11,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,124,  2,  0,  0,
- 93,  0,  0,  0,125,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,125,  2,  0,  0,126,  2,  0,  0,124,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,101,  0,  0,  0,124,  2,  0,  0,126,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,126,  2,  0,  0,125,  2,  0,  0,
-161,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,145,  1,  0,  0, 41,  0,  0,  0, 25,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 25,  1,  0,  0,126,  2,  0,  0,145,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,161,  0,  0,  0,145,  1,  0,  0,126,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,126,  2,  0,  0, 25,  1,  0,  0,101,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,144,  1,  0,  0,
-161,  0,  0,  0,125,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,125,  2,  0,  0,  9,  1,  0,  0,144,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 37,  0,  0,  0,144,  1,  0,  0,  9,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  9,  1,  0,  0,125,  2,  0,  0,
- 93,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,127,  2,  0,  0,100,  0,  0,  0, 23,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 23,  1,  0,  0,143,  1,  0,  0,127,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,160,  0,  0,  0,127,  2,  0,  0,143,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,143,  1,  0,  0, 23,  1,  0,  0, 41,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,127,  2,  0,  0,
-160,  0,  0,  0,128,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,128,  2,  0,  0,129,  2,  0,  0,127,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3,100,  0,  0,  0,127,  2,  0,  0,129,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,129,  2,  0,  0,128,  2,  0,  0,
- 90,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  2,  1,  0,  0,  9,  0,  0,  0, 22,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
- 22,  1,  0,  0,129,  2,  0,  0,  2,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 90,  0,  0,  0,  2,  1,  0,  0,129,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  3,129,  2,  0,  0, 22,  1,  0,  0,100,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  3,  1,  0,  0,
- 90,  0,  0,  0,128,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,128,  2,  0,  0,142,  1,  0,  0,  3,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  3, 36,  0,  0,  0,  3,  1,  0,  0,142,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,142,  1,  0,  0,128,  2,  0,  0,
-160,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 68, 65, 84, 65,  0,240,  0,  0,184,127, 54,  3,  0,  0,  0,  0, 59,  0,  0,  0,
-  0,  5,  0,  0,166,222,110, 63,  9,205, 55, 63,212,132,105, 63,201,236, 65, 63,218,153,103, 63,119,155, 54, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,218,153,103, 63,119,155, 54, 63,118,148,108, 63,
-211,160, 44, 63,166,222,110, 63,  9,205, 55, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 36, 51,115, 63, 36, 28, 45, 63,166,222,110, 63,  9,205, 55, 63,118,148,108, 63,211,160, 44, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,118,148,108, 63,211,160, 44, 63,218,153,103, 63,
-119,155, 54, 63, 87, 17,102, 63,229, 52, 43, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 56, 81, 96, 63,170, 55, 52, 63, 87, 17,102, 63,229, 52, 43, 63,218,153,103, 63,119,155, 54, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,218,153,103, 63,119,155, 54, 63,  9, 75, 97, 63,
- 92,233, 63, 63, 56, 81, 96, 63,170, 55, 52, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,138,153, 89, 63, 49, 86, 60, 63, 56, 81, 96, 63,170, 55, 52, 63,  9, 75, 97, 63, 92,233, 63, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  9, 75, 97, 63, 92,233, 63, 63,218,153,103, 63,
-119,155, 54, 63,212,132,105, 63,201,236, 65, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,103,167, 98, 63,168, 39, 75, 63,138,153, 89, 63, 39,228, 82, 63,139,153, 89, 63,255,153, 71, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,139,153, 89, 63,255,153, 71, 63,  9, 75, 97, 63,
- 92,233, 63, 63,103,167, 98, 63,168, 39, 75, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,212,132,105, 63,201,236, 65, 63,103,167, 98, 63,168, 39, 75, 63,  9, 75, 97, 63, 92,233, 63, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  9, 75, 97, 63, 92,233, 63, 63,139,153, 89, 63,
-255,153, 71, 63,138,153, 89, 63, 49, 86, 60, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 56, 81, 96, 63,170, 55, 52, 63,138,153, 89, 63, 49, 86, 60, 63,139,153, 89, 63, 79, 12, 49, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,139,153, 89, 63, 79, 12, 49, 63,205,182, 95, 63,
-222,228, 40, 63, 56, 81, 96, 63,170, 55, 52, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 87, 17,102, 63,229, 52, 43, 63, 56, 81, 96, 63,170, 55, 52, 63,205,182, 95, 63,222,228, 40, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,205,182, 95, 63,222,228, 40, 63,139,153, 89, 63,
- 79, 12, 49, 63,139,153, 89, 63, 45,200, 37, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,103,167, 98, 63,168, 39, 75, 63,212,132,105, 63,201,236, 65, 63,168, 83,109, 63,207, 83, 78, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,168, 83,109, 63,207, 83, 78, 63,135, 85,101, 63,
-148, 64, 88, 63,103,167, 98, 63,168, 39, 75, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,138,153, 89, 63, 39,228, 82, 63,103,167, 98, 63,168, 39, 75, 63,135, 85,101, 63,148, 64, 88, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,135, 85,101, 63,148, 64, 88, 63,168, 83,109, 63,
-207, 83, 78, 63, 36, 51,115, 63, 22, 56, 90, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,162, 18,121, 63,207, 83, 78, 63, 36, 51,115, 63, 22, 56, 90, 63,168, 83,109, 63,207, 83, 78, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,168, 83,109, 63,207, 83, 78, 63, 36, 51,115, 63,
-115, 23, 67, 63,162, 18,121, 63,207, 83, 78, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,116,225,124, 63,202,236, 65, 63,162, 18,121, 63,207, 83, 78, 63, 36, 51,115, 63,115, 23, 67, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 36, 51,115, 63,115, 23, 67, 63,168, 83,109, 63,
-207, 83, 78, 63,212,132,105, 63,201,236, 65, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,166,222,110, 63,  9,205, 55, 63, 36, 51,115, 63, 36, 28, 45, 63,163,135,119, 63, 11,205, 55, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,163,135,119, 63, 11,205, 55, 63, 36, 51,115, 63,
-115, 23, 67, 63,166,222,110, 63,  9,205, 55, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,212,132,105, 63,201,236, 65, 63,166,222,110, 63,  9,205, 55, 63, 36, 51,115, 63,115, 23, 67, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 36, 51,115, 63,115, 23, 67, 63,163,135,119, 63,
- 11,205, 55, 63,116,225,124, 63,202,236, 65, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,162, 18,121, 63,207, 83, 78, 63,116,225,124, 63,202,236, 65, 63,113,223,129, 63,170, 39, 75, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,113,223,129, 63,170, 39, 75, 63, 98,136,128, 63,
-148, 64, 88, 63,162, 18,121, 63,207, 83, 78, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 36, 51,115, 63, 22, 56, 90, 63,162, 18,121, 63,207, 83, 78, 63, 98,136,128, 63,148, 64, 88, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 95, 98,136, 59,148, 64, 88, 63,160,184,111, 60,
-170, 39, 75, 63,243,203, 76, 61, 41,228, 82, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,243,203, 76, 61, 82, 12, 49, 63,246,203, 76, 61, 53, 86, 60, 63, 31,162,194, 60,172, 55, 52, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 31,162,194, 60,172, 55, 52, 63,111,239,213, 60,
-223,228, 40, 63,243,203, 76, 61, 82, 12, 49, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,246,203, 76, 61, 48,200, 37, 63,243,203, 76, 61, 82, 12, 49, 63,111,239,213, 60,223,228, 40, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,111,239,213, 60,223,228, 40, 63, 31,162,194, 60,
-172, 55, 52, 63,120,226,169, 58,230, 52, 43, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,111,204,126, 63,121,155, 54, 63,121, 42,128, 63,230, 52, 43, 63,136, 10,131, 63,172, 55, 52, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,136, 10,131, 63,172, 55, 52, 63,160,141,130, 63,
- 95,233, 63, 63,111,204,126, 63,121,155, 54, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,116,225,124, 63,202,236, 65, 63,111,204,126, 63,121,155, 54, 63,160,141,130, 63, 95,233, 63, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 11,104,163, 60, 95,233, 63, 63, 31,162,194, 60,
-172, 55, 52, 63,246,203, 76, 61, 53, 86, 60, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,244,203, 76, 61,  2,154, 71, 63,243,203, 76, 61, 41,228, 82, 63,160,184,111, 60,170, 39, 75, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,160,184,111, 60,170, 39, 75, 63, 11,104,163, 60,
- 95,233, 63, 63,244,203, 76, 61,  2,154, 71, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,246,203, 76, 61, 53, 86, 60, 63,244,203, 76, 61,  2,154, 71, 63, 11,104,163, 60, 95,233, 63, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,160,141,130, 63, 95,233, 63, 63,113,223,129, 63,
-170, 39, 75, 63,116,225,124, 63,202,236, 65, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,111,204,126, 63,121,155, 54, 63,116,225,124, 63,202,236, 65, 63,163,135,119, 63, 11,205, 55, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,163,135,119, 63, 11,205, 55, 63,210,209,121, 63,
-212,160, 44, 63,111,204,126, 63,121,155, 54, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,121, 42,128, 63,230, 52, 43, 63,111,204,126, 63,121,155, 54, 63,210,209,121, 63,212,160, 44, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,210,209,121, 63,212,160, 44, 63,163,135,119, 63,
- 11,205, 55, 63, 36, 51,115, 63, 36, 28, 45, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 95,102,134, 63, 79, 46, 94, 63, 95,102,134, 63, 22,114,105, 63, 52,205,124, 63, 58, 26, 99, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 52,205,124, 63, 58, 26, 99, 63, 98,136,128, 63,
-148, 64, 88, 63, 95,102,134, 63, 79, 46, 94, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,243,203, 76, 61, 41,228, 82, 63,234,203, 76, 61, 79, 46, 94, 63, 95, 98,136, 59,148, 64, 88, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 98,136,128, 63,148, 64, 88, 63, 52,205,124, 63,
- 58, 26, 99, 63, 36, 51,115, 63, 22, 56, 90, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 21,153,105, 63, 58, 26, 99, 63, 36, 51,115, 63, 22, 56, 90, 63, 52,205,124, 63, 58, 26, 99, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 52,205,124, 63, 58, 26, 99, 63, 32, 51,115, 63,
-212,154,109, 63, 21,153,105, 63, 58, 26, 99, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,138,153, 89, 63, 19,114,105, 63, 21,153,105, 63, 58, 26, 99, 63, 32, 51,115, 63,212,154,109, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 32, 51,115, 63,212,154,109, 63, 52,205,124, 63,
- 58, 26, 99, 63, 95,102,134, 63, 22,114,105, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 95,102,134, 63,242,187,116, 63,  3,153, 59, 63,  0,  0,128, 63,136,153, 89, 63,242,187,116, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,136,153, 89, 63,242,187,116, 63, 32, 51,115, 63,
-212,154,109, 63, 95,102,134, 63,242,187,116, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 95,102,134, 63, 22,114,105, 63, 95,102,134, 63,242,187,116, 63, 32, 51,115, 63,212,154,109, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 32, 51,115, 63,212,154,109, 63,136,153, 89, 63,
-242,187,116, 63,138,153, 89, 63, 19,114,105, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 21,153,105, 63, 58, 26, 99, 63,138,153, 89, 63, 19,114,105, 63,138,153, 89, 63, 77, 46, 94, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,138,153, 89, 63, 77, 46, 94, 63,135, 85,101, 63,
-148, 64, 88, 63, 21,153,105, 63, 58, 26, 99, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 36, 51,115, 63, 22, 56, 90, 63, 21,153,105, 63, 58, 26, 99, 63,135, 85,101, 63,148, 64, 88, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,135, 85,101, 63,148, 64, 88, 63,138,153, 89, 63,
- 77, 46, 94, 63,138,153, 89, 63, 39,228, 82, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 67,153, 75, 63,113,155, 54, 63, 74,174, 73, 63,193,236, 65, 63,124, 84, 68, 63,255,204, 55, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,124, 84, 68, 63,255,204, 55, 63,169,158, 70, 63,
-200,160, 44, 63, 67,153, 75, 63,113,155, 54, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,196, 33, 77, 63,221, 52, 43, 63, 67,153, 75, 63,113,155, 54, 63,169,158, 70, 63,200,160, 44, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,169,158, 70, 63,200,160, 44, 63,124, 84, 68, 63,
-255,204, 55, 63,  0,  0, 64, 63, 24, 28, 45, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 67,153, 75, 63,113,155, 54, 63,196, 33, 77, 63,221, 52, 43, 63,225,225, 82, 63,165, 55, 52, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,225,225, 82, 63,165, 55, 52, 63, 16,232, 81, 63,
- 89,233, 63, 63, 67,153, 75, 63,113,155, 54, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 74,174, 73, 63,193,236, 65, 63, 67,153, 75, 63,113,155, 54, 63, 16,232, 81, 63, 89,233, 63, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 16,232, 81, 63, 89,233, 63, 63,225,225, 82, 63,
-165, 55, 52, 63,138,153, 89, 63, 49, 86, 60, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,139,153, 89, 63,255,153, 71, 63,138,153, 89, 63, 39,228, 82, 63,179,139, 80, 63,164, 39, 75, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,179,139, 80, 63,164, 39, 75, 63, 16,232, 81, 63,
- 89,233, 63, 63,139,153, 89, 63,255,153, 71, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,138,153, 89, 63, 49, 86, 60, 63,139,153, 89, 63,255,153, 71, 63, 16,232, 81, 63, 89,233, 63, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 16,232, 81, 63, 89,233, 63, 63,179,139, 80, 63,
-164, 39, 75, 63, 74,174, 73, 63,193,236, 65, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,139,153, 89, 63, 79, 12, 49, 63,138,153, 89, 63, 49, 86, 60, 63,225,225, 82, 63,165, 55, 52, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,225,225, 82, 63,165, 55, 52, 63, 75,124, 83, 63,
-217,228, 40, 63,139,153, 89, 63, 79, 12, 49, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,139,153, 89, 63, 45,200, 37, 63,139,153, 89, 63, 79, 12, 49, 63, 75,124, 83, 63,217,228, 40, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 75,124, 83, 63,217,228, 40, 63,225,225, 82, 63,
-165, 55, 52, 63,196, 33, 77, 63,221, 52, 43, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,120,223, 69, 63,198, 83, 78, 63, 74,174, 73, 63,193,236, 65, 63,179,139, 80, 63,164, 39, 75, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,179,139, 80, 63,164, 39, 75, 63,148,221, 77, 63,
-140, 64, 88, 63,120,223, 69, 63,198, 83, 78, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0, 64, 63, 12, 56, 90, 63,120,223, 69, 63,198, 83, 78, 63,148,221, 77, 63,140, 64, 88, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,148,221, 77, 63,140, 64, 88, 63,179,139, 80, 63,
-164, 39, 75, 63,138,153, 89, 63, 39,228, 82, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,120,223, 69, 63,198, 83, 78, 63,  0,  0, 64, 63, 12, 56, 90, 63,136, 32, 58, 63,198, 83, 78, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,136, 32, 58, 63,198, 83, 78, 63,  0,  0, 64, 63,
-106, 23, 67, 63,120,223, 69, 63,198, 83, 78, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 74,174, 73, 63,193,236, 65, 63,120,223, 69, 63,198, 83, 78, 63,  0,  0, 64, 63,106, 23, 67, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0, 64, 63,106, 23, 67, 63,136, 32, 58, 63,
-198, 83, 78, 63,182, 81, 54, 63,193,236, 65, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,132,171, 59, 63,255,204, 55, 63,  0,  0, 64, 63, 24, 28, 45, 63,124, 84, 68, 63,255,204, 55, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,124, 84, 68, 63,255,204, 55, 63,  0,  0, 64, 63,
-106, 23, 67, 63,132,171, 59, 63,255,204, 55, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,182, 81, 54, 63,193,236, 65, 63,132,171, 59, 63,255,204, 55, 63,  0,  0, 64, 63,106, 23, 67, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0, 64, 63,106, 23, 67, 63,124, 84, 68, 63,
-255,204, 55, 63, 74,174, 73, 63,193,236, 65, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 77,116, 47, 63,164, 39, 75, 63,182, 81, 54, 63,193,236, 65, 63,136, 32, 58, 63,198, 83, 78, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,136, 32, 58, 63,198, 83, 78, 63,108, 34, 50, 63,
-140, 64, 88, 63, 77,116, 47, 63,164, 39, 75, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,118,102, 38, 63, 38,228, 82, 63, 77,116, 47, 63,164, 39, 75, 63,108, 34, 50, 63,140, 64, 88, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,108, 34, 50, 63,140, 64, 88, 63,136, 32, 58, 63,
-198, 83, 78, 63,  0,  0, 64, 63, 12, 56, 90, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 31, 30, 45, 63,165, 55, 52, 63,117,102, 38, 63, 50, 86, 60, 63,117,102, 38, 63, 78, 12, 49, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,117,102, 38, 63, 78, 12, 49, 63,181,131, 44, 63,
-216,228, 40, 63, 31, 30, 45, 63,165, 55, 52, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 60,222, 50, 63,221, 52, 43, 63, 31, 30, 45, 63,165, 55, 52, 63,181,131, 44, 63,216,228, 40, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,181,131, 44, 63,216,228, 40, 63,117,102, 38, 63,
- 78, 12, 49, 63,117,102, 38, 63, 45,200, 37, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 31, 30, 45, 63,165, 55, 52, 63, 60,222, 50, 63,221, 52, 43, 63,189,102, 52, 63,113,155, 54, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,189,102, 52, 63,113,155, 54, 63,240, 23, 46, 63,
- 89,233, 63, 63, 31, 30, 45, 63,165, 55, 52, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,117,102, 38, 63, 50, 86, 60, 63, 31, 30, 45, 63,165, 55, 52, 63,240, 23, 46, 63, 89,233, 63, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,240, 23, 46, 63, 89,233, 63, 63,189,102, 52, 63,
-113,155, 54, 63,182, 81, 54, 63,193,236, 65, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 77,116, 47, 63,164, 39, 75, 63,118,102, 38, 63, 38,228, 82, 63,117,102, 38, 63,255,153, 71, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,117,102, 38, 63,255,153, 71, 63,240, 23, 46, 63,
- 89,233, 63, 63, 77,116, 47, 63,164, 39, 75, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,182, 81, 54, 63,193,236, 65, 63, 77,116, 47, 63,164, 39, 75, 63,240, 23, 46, 63, 89,233, 63, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,240, 23, 46, 63, 89,233, 63, 63,117,102, 38, 63,
-255,153, 71, 63,117,102, 38, 63, 50, 86, 60, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,132,171, 59, 63,255,204, 55, 63,182, 81, 54, 63,193,236, 65, 63,189,102, 52, 63,113,155, 54, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,189,102, 52, 63,113,155, 54, 63, 87, 97, 57, 63,
-200,160, 44, 63,132,171, 59, 63,255,204, 55, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0, 64, 63, 24, 28, 45, 63,132,171, 59, 63,255,204, 55, 63, 87, 97, 57, 63,200,160, 44, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 87, 97, 57, 63,200,160, 44, 63,189,102, 52, 63,
-113,155, 54, 63, 60,222, 50, 63,221, 52, 43, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,250,101, 54, 63, 51, 26, 99, 63,118,102, 38, 63, 19,114,105, 63,118,102, 38, 63, 77, 46, 94, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,118,102, 38, 63, 77, 46, 94, 63,108, 34, 50, 63,
-140, 64, 88, 63,250,101, 54, 63, 51, 26, 99, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0, 64, 63, 12, 56, 90, 63,250,101, 54, 63, 51, 26, 99, 63,108, 34, 50, 63,140, 64, 88, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,108, 34, 50, 63,140, 64, 88, 63,118,102, 38, 63,
- 77, 46, 94, 63,118,102, 38, 63, 38,228, 82, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,250,101, 54, 63, 51, 26, 99, 63,  0,  0, 64, 63, 12, 56, 90, 63,  6,154, 73, 63, 51, 26, 99, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  6,154, 73, 63, 51, 26, 99, 63,  0,  0, 64, 63,
-206,154,109, 63,250,101, 54, 63, 51, 26, 99, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,118,102, 38, 63, 19,114,105, 63,250,101, 54, 63, 51, 26, 99, 63,  0,  0, 64, 63,206,154,109, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0, 64, 63,206,154,109, 63,  6,154, 73, 63,
- 51, 26, 99, 63,138,153, 89, 63, 19,114,105, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,136,153, 89, 63,242,187,116, 63,  3,153, 59, 63,  0,  0,128, 63,120,102, 38, 63,242,187,116, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,120,102, 38, 63,242,187,116, 63,  0,  0, 64, 63,
-206,154,109, 63,136,153, 89, 63,242,187,116, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,138,153, 89, 63, 19,114,105, 63,136,153, 89, 63,242,187,116, 63,  0,  0, 64, 63,206,154,109, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0, 64, 63,206,154,109, 63,120,102, 38, 63,
-242,187,116, 63,118,102, 38, 63, 19,114,105, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,138,153, 89, 63, 77, 46, 94, 63,138,153, 89, 63, 19,114,105, 63,  6,154, 73, 63, 51, 26, 99, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  6,154, 73, 63, 51, 26, 99, 63,148,221, 77, 63,
-140, 64, 88, 63,138,153, 89, 63, 77, 46, 94, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,138,153, 89, 63, 39,228, 82, 63,138,153, 89, 63, 77, 46, 94, 63,148,221, 77, 63,140, 64, 88, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,148,221, 77, 63,140, 64, 88, 63,  6,154, 73, 63,
- 51, 26, 99, 63,  0,  0, 64, 63, 12, 56, 90, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,167, 71,  8, 62,  7,205, 55, 63,170,192,229, 61,200,236, 65, 63,203,104,214, 61,120,155, 54, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,203,104,214, 61,120,155, 54, 63,201, 61,254, 61,
-207,160, 44, 63,167, 71,  8, 62,  7,205, 55, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,173,153, 25, 62, 27, 28, 45, 63,167, 71,  8, 62,  7,205, 55, 63,201, 61,254, 61,207,160, 44, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,201, 61,254, 61,207,160, 44, 63,203,104,214, 61,
-120,155, 54, 63,175, 36,202, 61,228, 52, 43, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,145, 35,156, 61,172, 55, 52, 63,175, 36,202, 61,228, 52, 43, 63,203,104,214, 61,120,155, 54, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,203,104,214, 61,120,155, 54, 63, 32,242,163, 61,
- 96,233, 63, 63,145, 35,156, 61,172, 55, 52, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,246,203, 76, 61, 53, 86, 60, 63,145, 35,156, 61,172, 55, 52, 63, 32,242,163, 61, 96,233, 63, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 32,242,163, 61, 96,233, 63, 63,203,104,214, 61,
-120,155, 54, 63,170,192,229, 61,200,236, 65, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 17,213,174, 61,171, 39, 75, 63,243,203, 76, 61, 41,228, 82, 63,244,203, 76, 61,  2,154, 71, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,244,203, 76, 61,  2,154, 71, 63, 32,242,163, 61,
- 96,233, 63, 63, 17,213,174, 61,171, 39, 75, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,170,192,229, 61,200,236, 65, 63, 17,213,174, 61,171, 39, 75, 63, 32,242,163, 61, 96,233, 63, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 32,242,163, 61, 96,233, 63, 63,244,203, 76, 61,
-  2,154, 71, 63,246,203, 76, 61, 53, 86, 60, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,145, 35,156, 61,172, 55, 52, 63,246,203, 76, 61, 53, 86, 60, 63,243,203, 76, 61, 82, 12, 49, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,243,203, 76, 61, 82, 12, 49, 63, 53, 80,151, 61,
-223,228, 40, 63,145, 35,156, 61,172, 55, 52, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,175, 36,202, 61,228, 52, 43, 63,145, 35,156, 61,172, 55, 52, 63, 53, 80,151, 61,223,228, 40, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 53, 80,151, 61,223,228, 40, 63,243,203, 76, 61,
- 82, 12, 49, 63,246,203, 76, 61, 48,200, 37, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 17,213,174, 61,171, 39, 75, 63,170,192,229, 61,200,236, 65, 63,169, 27,  2, 62,204, 83, 78, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,169, 27,  2, 62,204, 83, 78, 63, 23, 70,196, 61,
-147, 64, 88, 63, 17,213,174, 61,171, 39, 75, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,243,203, 76, 61, 41,228, 82, 63, 17,213,174, 61,171, 39, 75, 63, 23, 70,196, 61,147, 64, 88, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 23, 70,196, 61,147, 64, 88, 63,169, 27,  2, 62,
-204, 83, 78, 63,160,153, 25, 62, 14, 56, 90, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,162, 23, 49, 62,195, 83, 78, 63,160,153, 25, 62, 14, 56, 90, 63,169, 27,  2, 62,204, 83, 78, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,169, 27,  2, 62,204, 83, 78, 63,172,153, 25, 62,
-108, 23, 67, 63,162, 23, 49, 62,195, 83, 78, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,240, 82, 64, 62,183,236, 65, 63,162, 23, 49, 62,195, 83, 78, 63,172,153, 25, 62,108, 23, 67, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,172,153, 25, 62,108, 23, 67, 63,169, 27,  2, 62,
-204, 83, 78, 63,170,192,229, 61,200,236, 65, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,167, 71,  8, 62,  7,205, 55, 63,173,153, 25, 62, 27, 28, 45, 63,173,235, 42, 62,254,204, 55, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,173,235, 42, 62,254,204, 55, 63,172,153, 25, 62,
-108, 23, 67, 63,167, 71,  8, 62,  7,205, 55, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,170,192,229, 61,200,236, 65, 63,167, 71,  8, 62,  7,205, 55, 63,172,153, 25, 62,108, 23, 67, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,172,153, 25, 62,108, 23, 67, 63,173,235, 42, 62,
-254,204, 55, 63,240, 82, 64, 62,183,236, 65, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,162, 23, 49, 62,195, 83, 78, 63,240, 82, 64, 62,183,236, 65, 63,166,200, 91, 62,147, 39, 75, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,166,200, 91, 62,147, 39, 75, 63, 34, 16, 81, 62,
-131, 64, 88, 63,162, 23, 49, 62,195, 83, 78, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,160,153, 25, 62, 14, 56, 90, 63,162, 23, 49, 62,195, 83, 78, 63, 34, 16, 81, 62,131, 64, 88, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 34, 16, 81, 62,131, 64, 88, 63,166,200, 91, 62,
-147, 39, 75, 63,  0,  0,128, 62, 13,228, 82, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,128, 62, 47, 12, 49, 63,  0,  0,128, 62, 19, 86, 60, 63, 92, 33,101, 62,146, 55, 52, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 92, 33,101, 62,146, 55, 52, 63, 14,139,103, 62,
-199,228, 40, 63,  0,  0,128, 62, 47, 12, 49, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,128, 62, 23,200, 37, 63,  0,  0,128, 62, 47, 12, 49, 63, 14,139,103, 62,199,228, 40, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 14,139,103, 62,199,228, 40, 63, 92, 33,101, 62,
-146, 55, 52, 63,230, 32, 78, 62,211, 52, 43, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,223,254, 71, 62,102,155, 54, 63,230, 32, 78, 62,211, 52, 43, 63, 92, 33,101, 62,146, 55, 52, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 92, 33,101, 62,146, 55, 52, 63, 23, 58, 97, 62,
- 69,233, 63, 63,223,254, 71, 62,102,155, 54, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,240, 82, 64, 62,183,236, 65, 63,223,254, 71, 62,102,155, 54, 63, 23, 58, 97, 62, 69,233, 63, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 23, 58, 97, 62, 69,233, 63, 63, 92, 33,101, 62,
-146, 55, 52, 63,  0,  0,128, 62, 19, 86, 60, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,128, 62,228,153, 71, 63,  0,  0,128, 62, 13,228, 82, 63,166,200, 91, 62,147, 39, 75, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,166,200, 91, 62,147, 39, 75, 63, 23, 58, 97, 62,
- 69,233, 63, 63,  0,  0,128, 62,228,153, 71, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,128, 62, 19, 86, 60, 63,  0,  0,128, 62,228,153, 71, 63, 23, 58, 97, 62, 69,233, 63, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 23, 58, 97, 62, 69,233, 63, 63,166,200, 91, 62,
-147, 39, 75, 63,240, 82, 64, 62,183,236, 65, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,223,254, 71, 62,102,155, 54, 63,240, 82, 64, 62,183,236, 65, 63,173,235, 42, 62,254,204, 55, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,173,235, 42, 62,254,204, 55, 63,105, 20, 52, 62,
-198,160, 44, 63,223,254, 71, 62,102,155, 54, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,230, 32, 78, 62,211, 52, 43, 63,223,254, 71, 62,102,155, 54, 63,105, 20, 52, 62,198,160, 44, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,105, 20, 52, 62,198,160, 44, 63,173,235, 42, 62,
-254,204, 55, 63,173,153, 25, 62, 27, 28, 45, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,128, 62, 58, 46, 94, 63,  0,  0,128, 62,  8,114,105, 63,230,  1, 64, 62, 49, 26, 99, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,230,  1, 64, 62, 49, 26, 99, 63, 34, 16, 81, 62,
-131, 64, 88, 63,  0,  0,128, 62, 58, 46, 94, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,128, 62, 13,228, 82, 63,  0,  0,128, 62, 58, 46, 94, 63, 34, 16, 81, 62,131, 64, 88, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 34, 16, 81, 62,131, 64, 88, 63,230,  1, 64, 62,
- 49, 26, 99, 63,160,153, 25, 62, 14, 56, 90, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,164, 98,230, 61, 58, 26, 99, 63,160,153, 25, 62, 14, 56, 90, 63,230,  1, 64, 62, 49, 26, 99, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,230,  1, 64, 62, 49, 26, 99, 63,159,153, 25, 62,
-210,154,109, 63,164, 98,230, 61, 58, 26, 99, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,237,203, 76, 61, 22,114,105, 63,164, 98,230, 61, 58, 26, 99, 63,159,153, 25, 62,210,154,109, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,159,153, 25, 62,210,154,109, 63,230,  1, 64, 62,
- 49, 26, 99, 63,  0,  0,128, 62,  8,114,105, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,128, 62,232,187,116, 63,  3,153, 59, 63,  0,  0,128, 63, 95,102,134, 63,242,187,116, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,210,203, 76, 61,242,187,116, 63,159,153, 25, 62,
-210,154,109, 63,  0,  0,128, 62,232,187,116, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,128, 62,  8,114,105, 63,  0,  0,128, 62,232,187,116, 63,159,153, 25, 62,210,154,109, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,159,153, 25, 62,210,154,109, 63,210,203, 76, 61,
-242,187,116, 63,237,203, 76, 61, 22,114,105, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,164, 98,230, 61, 58, 26, 99, 63,237,203, 76, 61, 22,114,105, 63,234,203, 76, 61, 79, 46, 94, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,234,203, 76, 61, 79, 46, 94, 63, 23, 70,196, 61,
-147, 64, 88, 63,164, 98,230, 61, 58, 26, 99, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,160,153, 25, 62, 14, 56, 90, 63,164, 98,230, 61, 58, 26, 99, 63, 23, 70,196, 61,147, 64, 88, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 23, 70,196, 61,147, 64, 88, 63,234,203, 76, 61,
- 79, 46, 94, 63,243,203, 76, 61, 41,228, 82, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 42,138,170, 62,254,204, 55, 63,136,214,159, 62,183,236, 65, 63,145,  0,156, 62,102,155, 54, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,145,  0,156, 62,102,155, 54, 63,204,245,165, 62,
-198,160, 44, 63, 42,138,170, 62,254,204, 55, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 42, 51,179, 62, 28, 28, 45, 63, 42,138,170, 62,254,204, 55, 63,204,245,165, 62,198,160, 44, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,204,245,165, 62,198,160, 44, 63,145,  0,156, 62,
-102,155, 54, 63,141,239,152, 62,211, 52, 43, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 82,111,141, 62,146, 55, 52, 63,141,239,152, 62,211, 52, 43, 63,145,  0,156, 62,102,155, 54, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,145,  0,156, 62,102,155, 54, 63,245, 98,143, 62,
- 68,233, 63, 63, 82,111,141, 62,146, 55, 52, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,128, 62, 19, 86, 60, 63, 82,111,141, 62,146, 55, 52, 63,245, 98,143, 62, 68,233, 63, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,245, 98,143, 62, 68,233, 63, 63,145,  0,156, 62,
-102,155, 54, 63,136,214,159, 62,183,236, 65, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,173, 27,146, 62,147, 39, 75, 63,  0,  0,128, 62, 13,228, 82, 63,  0,  0,128, 62,228,153, 71, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,128, 62,228,153, 71, 63,245, 98,143, 62,
- 68,233, 63, 63,173, 27,146, 62,147, 39, 75, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,136,214,159, 62,183,236, 65, 63,173, 27,146, 62,147, 39, 75, 63,245, 98,143, 62, 68,233, 63, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,245, 98,143, 62, 68,233, 63, 63,  0,  0,128, 62,
-228,153, 71, 63,  0,  0,128, 62, 19, 86, 60, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 82,111,141, 62,146, 55, 52, 63,  0,  0,128, 62, 19, 86, 60, 63,  0,  0,128, 62, 47, 12, 49, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,128, 62, 47, 12, 49, 63,121, 58,140, 62,
-199,228, 40, 63, 82,111,141, 62,146, 55, 52, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,141,239,152, 62,211, 52, 43, 63, 82,111,141, 62,146, 55, 52, 63,121, 58,140, 62,199,228, 40, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,121, 58,140, 62,199,228, 40, 63,  0,  0,128, 62,
- 47, 12, 49, 63,  0,  0,128, 62, 23,200, 37, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,173, 27,146, 62,147, 39, 75, 63,136,214,159, 62,183,236, 65, 63, 47,116,167, 62,195, 83, 78, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 47,116,167, 62,195, 83, 78, 63,239,119,151, 62,
-131, 64, 88, 63,173, 27,146, 62,147, 39, 75, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,128, 62, 13,228, 82, 63,173, 27,146, 62,147, 39, 75, 63,239,119,151, 62,131, 64, 88, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,239,119,151, 62,131, 64, 88, 63, 47,116,167, 62,
-195, 83, 78, 63, 49, 51,179, 62, 14, 56, 90, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 44,242,190, 62,205, 83, 78, 63, 49, 51,179, 62, 14, 56, 90, 63, 47,116,167, 62,195, 83, 78, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 47,116,167, 62,195, 83, 78, 63, 42, 51,179, 62,
-108, 23, 67, 63, 44,242,190, 62,205, 83, 78, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,214,143,198, 62,200,236, 65, 63, 44,242,190, 62,205, 83, 78, 63, 42, 51,179, 62,108, 23, 67, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 42, 51,179, 62,108, 23, 67, 63, 47,116,167, 62,
-195, 83, 78, 63,136,214,159, 62,183,236, 65, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 42,138,170, 62,254,204, 55, 63, 42, 51,179, 62, 28, 28, 45, 63, 45,220,187, 62,  7,205, 55, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 45,220,187, 62,  7,205, 55, 63, 42, 51,179, 62,
-108, 23, 67, 63, 42,138,170, 62,254,204, 55, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,136,214,159, 62,183,236, 65, 63, 42,138,170, 62,254,204, 55, 63, 42, 51,179, 62,108, 23, 67, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 42, 51,179, 62,108, 23, 67, 63, 45,220,187, 62,
-  7,205, 55, 63,214,143,198, 62,200,236, 65, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 44,242,190, 62,205, 83, 78, 63,214,143,198, 62,200,236, 65, 63,188, 74,212, 62,171, 39, 75, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,188, 74,212, 62,171, 39, 75, 63,122,238,206, 62,
-147, 64, 88, 63, 44,242,190, 62,205, 83, 78, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 49, 51,179, 62, 14, 56, 90, 63, 44,242,190, 62,205, 83, 78, 63,122,238,206, 62,147, 64, 88, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,122,238,206, 62,147, 64, 88, 63,188, 74,212, 62,
-171, 39, 75, 63,130,102,230, 62, 41,228, 82, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,130,102,230, 62, 82, 12, 49, 63,129,102,230, 62, 53, 86, 60, 63, 28,247,216, 62,172, 55, 52, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 28,247,216, 62,172, 55, 52, 63,243, 43,218, 62,
-223,228, 40, 63,130,102,230, 62, 82, 12, 49, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,129,102,230, 62, 48,200, 37, 63,130,102,230, 62, 82, 12, 49, 63,243, 43,218, 62,223,228, 40, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,243, 43,218, 62,223,228, 40, 63, 28,247,216, 62,
-172, 55, 52, 63,212,118,205, 62,228, 52, 43, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,206,101,202, 62,120,155, 54, 63,212,118,205, 62,228, 52, 43, 63, 28,247,216, 62,172, 55, 52, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 28,247,216, 62,172, 55, 52, 63,120,  3,215, 62,
- 95,233, 63, 63,206,101,202, 62,120,155, 54, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,214,143,198, 62,200,236, 65, 63,206,101,202, 62,120,155, 54, 63,120,  3,215, 62, 95,233, 63, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,120,  3,215, 62, 95,233, 63, 63, 28,247,216, 62,
-172, 55, 52, 63,129,102,230, 62, 53, 86, 60, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,130,102,230, 62,  1,154, 71, 63,130,102,230, 62, 41,228, 82, 63,188, 74,212, 62,171, 39, 75, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,188, 74,212, 62,171, 39, 75, 63,120,  3,215, 62,
- 95,233, 63, 63,130,102,230, 62,  1,154, 71, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,129,102,230, 62, 53, 86, 60, 63,130,102,230, 62,  1,154, 71, 63,120,  3,215, 62, 95,233, 63, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,120,  3,215, 62, 95,233, 63, 63,188, 74,212, 62,
-171, 39, 75, 63,214,143,198, 62,200,236, 65, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,206,101,202, 62,120,155, 54, 63,214,143,198, 62,200,236, 65, 63, 45,220,187, 62,  7,205, 55, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 45,220,187, 62,  7,205, 55, 63,142,112,192, 62,
-207,160, 44, 63,206,101,202, 62,120,155, 54, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,212,118,205, 62,228, 52, 43, 63,206,101,202, 62,120,155, 54, 63,142,112,192, 62,207,160, 44, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,142,112,192, 62,207,160, 44, 63, 45,220,187, 62,
-  7,205, 55, 63, 42, 51,179, 62, 28, 28, 45, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,131,102,230, 62, 79, 46, 94, 63,131,102,230, 62, 22,114,105, 63, 87,103,198, 62, 58, 26, 99, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 87,103,198, 62, 58, 26, 99, 63,122,238,206, 62,
-147, 64, 88, 63,131,102,230, 62, 79, 46, 94, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,130,102,230, 62, 41,228, 82, 63,131,102,230, 62, 79, 46, 94, 63,122,238,206, 62,147, 64, 88, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,122,238,206, 62,147, 64, 88, 63, 87,103,198, 62,
- 58, 26, 99, 63, 49, 51,179, 62, 14, 56, 90, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 14,255,159, 62, 49, 26, 99, 63, 49, 51,179, 62, 14, 56, 90, 63, 87,103,198, 62, 58, 26, 99, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 87,103,198, 62, 58, 26, 99, 63, 49, 51,179, 62,
-210,154,109, 63, 14,255,159, 62, 49, 26, 99, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,128, 62,  8,114,105, 63, 14,255,159, 62, 49, 26, 99, 63, 49, 51,179, 62,210,154,109, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 49, 51,179, 62,210,154,109, 63, 87,103,198, 62,
- 58, 26, 99, 63,131,102,230, 62, 22,114,105, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,134,102,230, 62,242,187,116, 63,  3,153, 59, 63,  0,  0,128, 63,  0,  0,128, 62,232,187,116, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,128, 62,232,187,116, 63, 49, 51,179, 62,
-210,154,109, 63,134,102,230, 62,242,187,116, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,131,102,230, 62, 22,114,105, 63,134,102,230, 62,242,187,116, 63, 49, 51,179, 62,210,154,109, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 49, 51,179, 62,210,154,109, 63,  0,  0,128, 62,
-232,187,116, 63,  0,  0,128, 62,  8,114,105, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 14,255,159, 62, 49, 26, 99, 63,  0,  0,128, 62,  8,114,105, 63,  0,  0,128, 62, 58, 46, 94, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,128, 62, 58, 46, 94, 63,239,119,151, 62,
-131, 64, 88, 63, 14,255,159, 62, 49, 26, 99, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 49, 51,179, 62, 14, 56, 90, 63, 14,255,159, 62, 49, 26, 99, 63,239,119,151, 62,131, 64, 88, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,239,119,151, 62,131, 64, 88, 63,  0,  0,128, 62,
- 58, 46, 94, 63,  0,  0,128, 62, 13,228, 82, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 93,120,  8, 63, 11,205, 55, 63,140, 30,  3, 63,201,236, 65, 63,145, 51,  1, 63,121,155, 54, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,145, 51,  1, 63,121,155, 54, 63, 46, 46,  6, 63,
-211,160, 44, 63, 93,120,  8, 63, 11,205, 55, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,220,204, 12, 63, 35, 28, 45, 63, 93,120,  8, 63, 11,205, 55, 63, 46, 46,  6, 63,211,160, 44, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 46, 46,  6, 63,211,160, 44, 63,145, 51,  1, 63,
-121,155, 54, 63, 30, 86,255, 62,230, 52, 43, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,222,213,243, 62,172, 55, 52, 63, 30, 86,255, 62,230, 52, 43, 63,145, 51,  1, 63,121,155, 54, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,145, 51,  1, 63,121,155, 54, 63,128,201,245, 62,
- 94,233, 63, 63,222,213,243, 62,172, 55, 52, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,129,102,230, 62, 53, 86, 60, 63,222,213,243, 62,172, 55, 52, 63,128,201,245, 62, 94,233, 63, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,128,201,245, 62, 94,233, 63, 63,145, 51,  1, 63,
-121,155, 54, 63,140, 30,  3, 63,201,236, 65, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 59,130,248, 62,169, 39, 75, 63,130,102,230, 62, 41,228, 82, 63,130,102,230, 62,  1,154, 71, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,130,102,230, 62,  1,154, 71, 63,128,201,245, 62,
- 94,233, 63, 63, 59,130,248, 62,169, 39, 75, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,140, 30,  3, 63,201,236, 65, 63, 59,130,248, 62,169, 39, 75, 63,128,201,245, 62, 94,233, 63, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,128,201,245, 62, 94,233, 63, 63,130,102,230, 62,
-  1,154, 71, 63,129,102,230, 62, 53, 86, 60, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,222,213,243, 62,172, 55, 52, 63,129,102,230, 62, 53, 86, 60, 63,130,102,230, 62, 82, 12, 49, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,130,102,230, 62, 82, 12, 49, 63,  9,161,242, 62,
-223,228, 40, 63,222,213,243, 62,172, 55, 52, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 30, 86,255, 62,230, 52, 43, 63,222,213,243, 62,172, 55, 52, 63,  9,161,242, 62,223,228, 40, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  9,161,242, 62,223,228, 40, 63,130,102,230, 62,
- 82, 12, 49, 63,129,102,230, 62, 48,200, 37, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 59,130,248, 62,169, 39, 75, 63,140, 30,  3, 63,201,236, 65, 63, 94,237,  6, 63,207, 83, 78, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 94,237,  6, 63,207, 83, 78, 63,118,222,253, 62,
-148, 64, 88, 63, 59,130,248, 62,169, 39, 75, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,130,102,230, 62, 41,228, 82, 63, 59,130,248, 62,169, 39, 75, 63,118,222,253, 62,148, 64, 88, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,118,222,253, 62,148, 64, 88, 63, 94,237,  6, 63,
-207, 83, 78, 63,220,204, 12, 63, 22, 56, 90, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 88,172, 18, 63,207, 83, 78, 63,220,204, 12, 63, 22, 56, 90, 63, 94,237,  6, 63,207, 83, 78, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 94,237,  6, 63,207, 83, 78, 63,220,204, 12, 63,
-115, 23, 67, 63, 88,172, 18, 63,207, 83, 78, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 44,123, 22, 63,201,236, 65, 63, 88,172, 18, 63,207, 83, 78, 63,220,204, 12, 63,115, 23, 67, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,220,204, 12, 63,115, 23, 67, 63, 94,237,  6, 63,
-207, 83, 78, 63,140, 30,  3, 63,201,236, 65, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 93,120,  8, 63, 11,205, 55, 63,220,204, 12, 63, 35, 28, 45, 63, 91, 33, 17, 63,  9,205, 55, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 91, 33, 17, 63,  9,205, 55, 63,220,204, 12, 63,
-115, 23, 67, 63, 93,120,  8, 63, 11,205, 55, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,140, 30,  3, 63,201,236, 65, 63, 93,120,  8, 63, 11,205, 55, 63,220,204, 12, 63,115, 23, 67, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,220,204, 12, 63,115, 23, 67, 63, 91, 33, 17, 63,
-  9,205, 55, 63, 44,123, 22, 63,201,236, 65, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 88,172, 18, 63,207, 83, 78, 63, 44,123, 22, 63,201,236, 65, 63,153, 88, 29, 63,167, 39, 75, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,153, 88, 29, 63,167, 39, 75, 63,121,170, 26, 63,
-147, 64, 88, 63, 88,172, 18, 63,207, 83, 78, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,220,204, 12, 63, 22, 56, 90, 63, 88,172, 18, 63,207, 83, 78, 63,121,170, 26, 63,147, 64, 88, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,121,170, 26, 63,147, 64, 88, 63,153, 88, 29, 63,
-167, 39, 75, 63,118,102, 38, 63, 38,228, 82, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,117,102, 38, 63, 78, 12, 49, 63,117,102, 38, 63, 50, 86, 60, 63,200,174, 31, 63,169, 55, 52, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,200,174, 31, 63,169, 55, 52, 63, 51, 73, 32, 63,
-221,228, 40, 63,117,102, 38, 63, 78, 12, 49, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,117,102, 38, 63, 45,200, 37, 63,117,102, 38, 63, 78, 12, 49, 63, 51, 73, 32, 63,221,228, 40, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 51, 73, 32, 63,221,228, 40, 63,200,174, 31, 63,
-169, 55, 52, 63,169,238, 25, 63,229, 52, 43, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 39,102, 24, 63,119,155, 54, 63,169,238, 25, 63,229, 52, 43, 63,200,174, 31, 63,169, 55, 52, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,200,174, 31, 63,169, 55, 52, 63,246,180, 30, 63,
- 92,233, 63, 63, 39,102, 24, 63,119,155, 54, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 44,123, 22, 63,201,236, 65, 63, 39,102, 24, 63,119,155, 54, 63,246,180, 30, 63, 92,233, 63, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,246,180, 30, 63, 92,233, 63, 63,200,174, 31, 63,
-169, 55, 52, 63,117,102, 38, 63, 50, 86, 60, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,117,102, 38, 63,255,153, 71, 63,118,102, 38, 63, 38,228, 82, 63,153, 88, 29, 63,167, 39, 75, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,153, 88, 29, 63,167, 39, 75, 63,246,180, 30, 63,
- 92,233, 63, 63,117,102, 38, 63,255,153, 71, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,117,102, 38, 63, 50, 86, 60, 63,117,102, 38, 63,255,153, 71, 63,246,180, 30, 63, 92,233, 63, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,246,180, 30, 63, 92,233, 63, 63,153, 88, 29, 63,
-167, 39, 75, 63, 44,123, 22, 63,201,236, 65, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 39,102, 24, 63,119,155, 54, 63, 44,123, 22, 63,201,236, 65, 63, 91, 33, 17, 63,  9,205, 55, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 91, 33, 17, 63,  9,205, 55, 63,138,107, 19, 63,
-211,160, 44, 63, 39,102, 24, 63,119,155, 54, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,169,238, 25, 63,229, 52, 43, 63, 39,102, 24, 63,119,155, 54, 63,138,107, 19, 63,211,160, 44, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,138,107, 19, 63,211,160, 44, 63, 91, 33, 17, 63,
-  9,205, 55, 63,220,204, 12, 63, 35, 28, 45, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,118,102, 38, 63, 77, 46, 94, 63,118,102, 38, 63, 19,114,105, 63,235,102, 22, 63, 59, 26, 99, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,235,102, 22, 63, 59, 26, 99, 63,121,170, 26, 63,
-147, 64, 88, 63,118,102, 38, 63, 77, 46, 94, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,118,102, 38, 63, 38,228, 82, 63,118,102, 38, 63, 77, 46, 94, 63,121,170, 26, 63,147, 64, 88, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,121,170, 26, 63,147, 64, 88, 63,235,102, 22, 63,
- 59, 26, 99, 63,220,204, 12, 63, 22, 56, 90, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,204, 50,  3, 63, 58, 26, 99, 63,220,204, 12, 63, 22, 56, 90, 63,235,102, 22, 63, 59, 26, 99, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,235,102, 22, 63, 59, 26, 99, 63,224,204, 12, 63,
-212,154,109, 63,204, 50,  3, 63, 58, 26, 99, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,131,102,230, 62, 22,114,105, 63,204, 50,  3, 63, 58, 26, 99, 63,224,204, 12, 63,212,154,109, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,224,204, 12, 63,212,154,109, 63,235,102, 22, 63,
- 59, 26, 99, 63,118,102, 38, 63, 19,114,105, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,120,102, 38, 63,242,187,116, 63,  3,153, 59, 63,  0,  0,128, 63,134,102,230, 62,242,187,116, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,134,102,230, 62,242,187,116, 63,224,204, 12, 63,
-212,154,109, 63,120,102, 38, 63,242,187,116, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,118,102, 38, 63, 19,114,105, 63,120,102, 38, 63,242,187,116, 63,224,204, 12, 63,212,154,109, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,224,204, 12, 63,212,154,109, 63,134,102,230, 62,
-242,187,116, 63,131,102,230, 62, 22,114,105, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,204, 50,  3, 63, 58, 26, 99, 63,131,102,230, 62, 22,114,105, 63,131,102,230, 62, 79, 46, 94, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,131,102,230, 62, 79, 46, 94, 63,118,222,253, 62,
-148, 64, 88, 63,204, 50,  3, 63, 58, 26, 99, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,220,204, 12, 63, 22, 56, 90, 63,204, 50,  3, 63, 58, 26, 99, 63,118,222,253, 62,148, 64, 88, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,118,222,253, 62,148, 64, 88, 63,131,102,230, 62,
- 79, 46, 94, 63,130,102,230, 62, 41,228, 82, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,213,233, 76, 63, 35, 48, 21, 63,176,235, 70, 63,226,209, 22, 63, 80,234, 73, 63,146,111, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 80,234, 73, 63,146,111, 11, 63,  1,200, 79, 63,
- 94,152,  9, 63,213,233, 76, 63, 35, 48, 21, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 19,215, 82, 63,252, 29, 19, 63,213,233, 76, 63, 35, 48, 21, 63,  1,200, 79, 63, 94,152,  9, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  1,200, 79, 63, 94,152,  9, 63, 80,234, 73, 63,
-146,111, 11, 63,193,204, 76, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,213,233, 76, 63, 35, 48, 21, 63, 19,215, 82, 63,252, 29, 19, 63,220, 41, 80, 63,105, 60, 31, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,220, 41, 80, 63,105, 60, 31, 63,164,219, 73, 63,
-173, 23, 33, 63,213,233, 76, 63, 35, 48, 21, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,176,235, 70, 63,226,209, 22, 63,213,233, 76, 63, 35, 48, 21, 63,164,219, 73, 63,173, 23, 33, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,164,219, 73, 63,173, 23, 33, 63,220, 41, 80, 63,
-105, 60, 31, 63,196, 33, 77, 63,221, 52, 43, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,169,158, 70, 63,200,160, 44, 63,  0,  0, 64, 63, 24, 28, 45, 63,  5,171, 67, 63,216, 17, 34, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  5,171, 67, 63,216, 17, 34, 63,164,219, 73, 63,
-173, 23, 33, 63,169,158, 70, 63,200,160, 44, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,196, 33, 77, 63,221, 52, 43, 63,169,158, 70, 63,200,160, 44, 63,164,219, 73, 63,173, 23, 33, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,164,219, 73, 63,173, 23, 33, 63,  5,171, 67, 63,
-216, 17, 34, 63,176,235, 70, 63,226,209, 22, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 75,124, 83, 63,217,228, 40, 63,196, 33, 77, 63,221, 52, 43, 63,220, 41, 80, 63,105, 60, 31, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,220, 41, 80, 63,105, 60, 31, 63,218, 20, 86, 63,
-143,140, 28, 63, 75,124, 83, 63,217,228, 40, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,139,153, 89, 63, 45,200, 37, 63, 75,124, 83, 63,217,228, 40, 63,218, 20, 86, 63,143,140, 28, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,218, 20, 86, 63,143,140, 28, 63,220, 41, 80, 63,
-105, 60, 31, 63, 19,215, 82, 63,252, 29, 19, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0, 64, 63,182, 32, 23, 63,176,235, 70, 63,226,209, 22, 63,  5,171, 67, 63,216, 17, 34, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  5,171, 67, 63,216, 17, 34, 63,251, 84, 60, 63,
-216, 17, 34, 63,  0,  0, 64, 63,182, 32, 23, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 80, 20, 57, 63,226,209, 22, 63,  0,  0, 64, 63,182, 32, 23, 63,251, 84, 60, 63,216, 17, 34, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,251, 84, 60, 63,216, 17, 34, 63,  5,171, 67, 63,
-216, 17, 34, 63,  0,  0, 64, 63, 24, 28, 45, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0, 64, 63,182, 32, 23, 63, 80, 20, 57, 63,226,209, 22, 63,169,156, 60, 63, 96,116, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,169,156, 60, 63, 96,116, 11, 63, 87, 99, 67, 63,
- 96,116, 11, 63,  0,  0, 64, 63,182, 32, 23, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,176,235, 70, 63,226,209, 22, 63,  0,  0, 64, 63,182, 32, 23, 63, 87, 99, 67, 63, 96,116, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 87, 99, 67, 63, 96,116, 11, 63,169,156, 60, 63,
- 96,116, 11, 63,  0,  0, 64, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 96,102, 70, 63,244,  1,  0, 63,193,204, 76, 63,  0,  0,  0, 63, 80,234, 73, 63,146,111, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 80,234, 73, 63,146,111, 11, 63, 87, 99, 67, 63,
- 96,116, 11, 63, 96,102, 70, 63,244,  1,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0, 64, 63,  0,  0,  0, 63, 96,102, 70, 63,244,  1,  0, 63, 87, 99, 67, 63, 96,116, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 87, 99, 67, 63, 96,116, 11, 63, 80,234, 73, 63,
-146,111, 11, 63,176,235, 70, 63,226,209, 22, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,160,153, 57, 63,244,  1,  0, 63,  0,  0, 64, 63,  0,  0,  0, 63,169,156, 60, 63, 96,116, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,169,156, 60, 63, 96,116, 11, 63,176, 21, 54, 63,
-146,111, 11, 63,160,153, 57, 63,244,  1,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 63, 51, 51, 63,  0,  0,  0, 63,160,153, 57, 63,244,  1,  0, 63,176, 21, 54, 63,146,111, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,176, 21, 54, 63,146,111, 11, 63,169,156, 60, 63,
- 96,116, 11, 63, 80, 20, 57, 63,226,209, 22, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0, 64, 63, 93, 58,217, 62,144, 61, 57, 63, 19,196,217, 62, 85,123, 60, 63,253,230,198, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 85,123, 60, 63,253,230,198, 62,171,132, 67, 63,
-253,230,198, 62,  0,  0, 64, 63, 93, 58,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,112,194, 70, 63, 19,196,217, 62,  0,  0, 64, 63, 93, 58,217, 62,171,132, 67, 63,253,230,198, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,171,132, 67, 63,253,230,198, 62, 85,123, 60, 63,
-253,230,198, 62,  0,  0, 64, 63,211,111,180, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0, 64, 63, 93, 58,217, 62,112,194, 70, 63, 19,196,217, 62,125, 84, 67, 63, 42,211,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,125, 84, 67, 63, 42,211,236, 62,131,171, 60, 63,
- 42,211,236, 62,  0,  0, 64, 63, 93, 58,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,144, 61, 57, 63, 19,196,217, 62,  0,  0, 64, 63, 93, 58,217, 62,131,171, 60, 63, 42,211,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,131,171, 60, 63, 42,211,236, 62,125, 84, 67, 63,
- 42,211,236, 62,  0,  0, 64, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,160,153, 57, 63,244,  1,  0, 63, 63, 51, 51, 63,  0,  0,  0, 63,128, 46, 54, 63, 75,207,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,128, 46, 54, 63, 75,207,236, 62,131,171, 60, 63,
- 42,211,236, 62,160,153, 57, 63,244,  1,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0, 64, 63,  0,  0,  0, 63,160,153, 57, 63,244,  1,  0, 63,131,171, 60, 63, 42,211,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,131,171, 60, 63, 42,211,236, 62,128, 46, 54, 63,
- 75,207,236, 62,144, 61, 57, 63, 19,196,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 96,102, 70, 63,244,  1,  0, 63,  0,  0, 64, 63,  0,  0,  0, 63,125, 84, 67, 63, 42,211,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,125, 84, 67, 63, 42,211,236, 62,128,209, 73, 63,
- 75,207,236, 62, 96,102, 70, 63,244,  1,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,193,204, 76, 63,  0,  0,  0, 63, 96,102, 70, 63,244,  1,  0, 63,128,209, 73, 63, 75,207,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,128,209, 73, 63, 75,207,236, 62,125, 84, 67, 63,
- 42,211,236, 62,112,194, 70, 63, 19,196,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 43, 22, 51, 63, 35, 48, 21, 63,237, 40, 45, 63,252, 29, 19, 63,255, 55, 48, 63, 94,152,  9, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,255, 55, 48, 63, 94,152,  9, 63,176, 21, 54, 63,
-146,111, 11, 63, 43, 22, 51, 63, 35, 48, 21, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 80, 20, 57, 63,226,209, 22, 63, 43, 22, 51, 63, 35, 48, 21, 63,176, 21, 54, 63,146,111, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,176, 21, 54, 63,146,111, 11, 63,255, 55, 48, 63,
- 94,152,  9, 63, 63, 51, 51, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 43, 22, 51, 63, 35, 48, 21, 63, 80, 20, 57, 63,226,209, 22, 63, 91, 36, 54, 63,173, 23, 33, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 91, 36, 54, 63,173, 23, 33, 63, 36,214, 47, 63,
-105, 60, 31, 63, 43, 22, 51, 63, 35, 48, 21, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,237, 40, 45, 63,252, 29, 19, 63, 43, 22, 51, 63, 35, 48, 21, 63, 36,214, 47, 63,105, 60, 31, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 36,214, 47, 63,105, 60, 31, 63, 91, 36, 54, 63,
-173, 23, 33, 63, 60,222, 50, 63,221, 52, 43, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,181,131, 44, 63,216,228, 40, 63,117,102, 38, 63, 45,200, 37, 63, 38,235, 41, 63,141,140, 28, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 38,235, 41, 63,141,140, 28, 63, 36,214, 47, 63,
-105, 60, 31, 63,181,131, 44, 63,216,228, 40, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 60,222, 50, 63,221, 52, 43, 63,181,131, 44, 63,216,228, 40, 63, 36,214, 47, 63,105, 60, 31, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 36,214, 47, 63,105, 60, 31, 63, 38,235, 41, 63,
-141,140, 28, 63,237, 40, 45, 63,252, 29, 19, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 87, 97, 57, 63,200,160, 44, 63, 60,222, 50, 63,221, 52, 43, 63, 91, 36, 54, 63,173, 23, 33, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 91, 36, 54, 63,173, 23, 33, 63,251, 84, 60, 63,
-216, 17, 34, 63, 87, 97, 57, 63,200,160, 44, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0, 64, 63, 24, 28, 45, 63, 87, 97, 57, 63,200,160, 44, 63,251, 84, 60, 63,216, 17, 34, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,251, 84, 60, 63,216, 17, 34, 63, 91, 36, 54, 63,
-173, 23, 33, 63, 80, 20, 57, 63,226,209, 22, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,134, 14,128, 63, 39, 48, 21, 63,227, 30,122, 63,233,209, 22, 63,138, 29,125, 63,150,111, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,138, 29,125, 63,150,111, 11, 63,159,125,129, 63,
- 94,152,  9, 63,134, 14,128, 63, 39, 48, 21, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,174, 73,193, 60,253, 29, 19, 63,209, 92,232, 57, 39, 48, 21, 63,114,207, 62, 60, 94,152,  9, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,159,125,129, 63, 94,152,  9, 63,138, 29,125, 63,
-150,111, 11, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,209, 92,232, 57, 39, 48, 21, 63,174, 73,193, 60,253, 29, 19, 63,214, 67, 87, 60,110, 60, 31, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,136,174,129, 63,110, 60, 31, 63,213, 14,125, 63,
-180, 23, 33, 63,134, 14,128, 63, 39, 48, 21, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,227, 30,122, 63,233,209, 22, 63,134, 14,128, 63, 39, 48, 21, 63,213, 14,125, 63,180, 23, 33, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,213, 14,125, 63,180, 23, 33, 63,136,174,129, 63,
-110, 60, 31, 63,121, 42,128, 63,230, 52, 43, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,210,209,121, 63,212,160, 44, 63, 36, 51,115, 63, 36, 28, 45, 63, 49,222,118, 63,226, 17, 34, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 49,222,118, 63,226, 17, 34, 63,213, 14,125, 63,
-180, 23, 33, 63,210,209,121, 63,212,160, 44, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,121, 42,128, 63,230, 52, 43, 63,210,209,121, 63,212,160, 44, 63,213, 14,125, 63,180, 23, 33, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,213, 14,125, 63,180, 23, 33, 63, 49,222,118, 63,
-226, 17, 34, 63,227, 30,122, 63,233,209, 22, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,111,239,213, 60,223,228, 40, 63,120,226,169, 58,230, 52, 43, 63,214, 67, 87, 60,110, 60, 31, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,214, 67, 87, 60,110, 60, 31, 63, 13,129, 20, 61,
-143,140, 28, 63,111,239,213, 60,223,228, 40, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,246,203, 76, 61, 48,200, 37, 63,111,239,213, 60,223,228, 40, 63, 13,129, 20, 61,143,140, 28, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 13,129, 20, 61,143,140, 28, 63,214, 67, 87, 60,
-110, 60, 31, 63,174, 73,193, 60,253, 29, 19, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 44, 51,115, 63,188, 32, 23, 63,227, 30,122, 63,233,209, 22, 63, 49,222,118, 63,226, 17, 34, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 49,222,118, 63,226, 17, 34, 63, 31,136,111, 63,
-225, 17, 34, 63, 44, 51,115, 63,188, 32, 23, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,116, 71,108, 63,232,209, 22, 63, 44, 51,115, 63,188, 32, 23, 63, 31,136,111, 63,225, 17, 34, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 31,136,111, 63,225, 17, 34, 63, 49,222,118, 63,
-226, 17, 34, 63, 36, 51,115, 63, 36, 28, 45, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 44, 51,115, 63,188, 32, 23, 63,116, 71,108, 63,232,209, 22, 63,213,207,111, 63,100,116, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,213,207,111, 63,100,116, 11, 63,138,150,118, 63,
-101,116, 11, 63, 44, 51,115, 63,188, 32, 23, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,227, 30,122, 63,233,209, 22, 63, 44, 51,115, 63,188, 32, 23, 63,138,150,118, 63,101,116, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,138,150,118, 63,101,116, 11, 63,213,207,111, 63,
-100,116, 11, 63, 51, 51,115, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,154,153,121, 63,244,  1,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,138, 29,125, 63,150,111, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,138, 29,125, 63,150,111, 11, 63,138,150,118, 63,
-101,116, 11, 63,154,153,121, 63,244,  1,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 51, 51,115, 63,  0,  0,  0, 63,154,153,121, 63,244,  1,  0, 63,138,150,118, 63,101,116, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,138,150,118, 63,101,116, 11, 63,138, 29,125, 63,
-150,111, 11, 63,227, 30,122, 63,233,209, 22, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,205,204,108, 63,244,  1,  0, 63, 51, 51,115, 63,  0,  0,  0, 63,213,207,111, 63,100,116, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,213,207,111, 63,100,116, 11, 63,213, 72,105, 63,
-149,111, 11, 63,205,204,108, 63,244,  1,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,101,102,102, 63,  0,  0,  0, 63,205,204,108, 63,244,  1,  0, 63,213, 72,105, 63,149,111, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,213, 72,105, 63,149,111, 11, 63,213,207,111, 63,
-100,116, 11, 63,116, 71,108, 63,232,209, 22, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 58, 51,115, 63, 73, 58,217, 62,192,112,108, 63,  4,196,217, 62,139,174,111, 63,223,230,198, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,139,174,111, 63,223,230,198, 62,239,183,118, 63,
-227,230,198, 62, 58, 51,115, 63, 73, 58,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,179,245,121, 63,  6,196,217, 62, 58, 51,115, 63, 73, 58,217, 62,239,183,118, 63,227,230,198, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,239,183,118, 63,227,230,198, 62,139,174,111, 63,
-223,230,198, 62, 65, 51,115, 63,160,111,180, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 58, 51,115, 63, 73, 58,217, 62,179,245,121, 63,  6,196,217, 62,185,135,118, 63, 30,211,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,185,135,118, 63, 30,211,236, 62,180,222,111, 63,
- 30,211,236, 62, 58, 51,115, 63, 73, 58,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,192,112,108, 63,  4,196,217, 62, 58, 51,115, 63, 73, 58,217, 62,180,222,111, 63, 30,211,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,180,222,111, 63, 30,211,236, 62,185,135,118, 63,
- 30,211,236, 62, 51, 51,115, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,205,204,108, 63,244,  1,  0, 63,101,102,102, 63,  0,  0,  0, 63,170, 97,105, 63, 65,207,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,170, 97,105, 63, 65,207,236, 62,180,222,111, 63,
- 30,211,236, 62,205,204,108, 63,244,  1,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 51, 51,115, 63,  0,  0,  0, 63,205,204,108, 63,244,  1,  0, 63,180,222,111, 63, 30,211,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,180,222,111, 63, 30,211,236, 62,170, 97,105, 63,
- 65,207,236, 62,192,112,108, 63,  4,196,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,154,153,121, 63,244,  1,  0, 63, 51, 51,115, 63,  0,  0,  0, 63,185,135,118, 63, 30,211,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,185,135,118, 63, 30,211,236, 62,194,  4,125, 63,
- 67,207,236, 62,154,153,121, 63,244,  1,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0, 63,154,153,121, 63,244,  1,  0, 63,194,  4,125, 63, 67,207,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,194,  4,125, 63, 67,207,236, 62,185,135,118, 63,
- 30,211,236, 62,179,245,121, 63,  6,196,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 76, 73,102, 63, 38, 48, 21, 63, 11, 92, 96, 63,253, 29, 19, 63, 33,107, 99, 63, 94,152,  9, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 33,107, 99, 63, 94,152,  9, 63,213, 72,105, 63,
-149,111, 11, 63, 76, 73,102, 63, 38, 48, 21, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,116, 71,108, 63,232,209, 22, 63, 76, 73,102, 63, 38, 48, 21, 63,213, 72,105, 63,149,111, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,213, 72,105, 63,149,111, 11, 63, 33,107, 99, 63,
- 94,152,  9, 63,101,102,102, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 76, 73,102, 63, 38, 48, 21, 63,116, 71,108, 63,232,209, 22, 63,124, 87,105, 63,180, 23, 33, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,124, 87,105, 63,180, 23, 33, 63, 65,  9, 99, 63,
-109, 60, 31, 63, 76, 73,102, 63, 38, 48, 21, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 11, 92, 96, 63,253, 29, 19, 63, 76, 73,102, 63, 38, 48, 21, 63, 65,  9, 99, 63,109, 60, 31, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 65,  9, 99, 63,109, 60, 31, 63,124, 87,105, 63,
-180, 23, 33, 63, 87, 17,102, 63,229, 52, 43, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,205,182, 95, 63,222,228, 40, 63,139,153, 89, 63, 45,200, 37, 63, 63, 30, 93, 63,143,140, 28, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 63, 30, 93, 63,143,140, 28, 63, 65,  9, 99, 63,
-109, 60, 31, 63,205,182, 95, 63,222,228, 40, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 87, 17,102, 63,229, 52, 43, 63,205,182, 95, 63,222,228, 40, 63, 65,  9, 99, 63,109, 60, 31, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 65,  9, 99, 63,109, 60, 31, 63, 63, 30, 93, 63,
-143,140, 28, 63, 11, 92, 96, 63,253, 29, 19, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,118,148,108, 63,211,160, 44, 63, 87, 17,102, 63,229, 52, 43, 63,124, 87,105, 63,180, 23, 33, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,124, 87,105, 63,180, 23, 33, 63, 31,136,111, 63,
-225, 17, 34, 63,118,148,108, 63,211,160, 44, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 36, 51,115, 63, 36, 28, 45, 63,118,148,108, 63,211,160, 44, 63, 31,136,111, 63,225, 17, 34, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 31,136,111, 63,225, 17, 34, 63,124, 87,105, 63,
-180, 23, 33, 63,116, 71,108, 63,232,209, 22, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 65, 65, 77, 62, 32, 48, 21, 63,152, 72, 53, 62,229,209, 22, 63, 47, 67, 65, 62,147,111, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 47, 67, 65, 62,147,111, 11, 63,255,185, 88, 62,
- 90,152,  9, 63, 65, 65, 77, 62, 32, 48, 21, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 64,246,100, 62,246, 29, 19, 63, 65, 65, 77, 62, 32, 48, 21, 63,255,185, 88, 62, 90,152,  9, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,255,185, 88, 62, 90,152,  9, 63, 47, 67, 65, 62,
-147,111, 11, 63,254,204, 76, 62,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 65, 65, 77, 62, 32, 48, 21, 63, 64,246,100, 62,246, 29, 19, 63, 89, 65, 90, 62, 94, 60, 31, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 89, 65, 90, 62, 94, 60, 31, 63,107,  8, 65, 62,
-170, 23, 33, 63, 65, 65, 77, 62, 32, 48, 21, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,152, 72, 53, 62,229,209, 22, 63, 65, 65, 77, 62, 32, 48, 21, 63,107,  8, 65, 62,170, 23, 33, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,107,  8, 65, 62,170, 23, 33, 63, 89, 65, 90, 62,
- 94, 60, 31, 63,230, 32, 78, 62,211, 52, 43, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,105, 20, 52, 62,198,160, 44, 63,173,153, 25, 62, 27, 28, 45, 63,216, 69, 40, 62,220, 17, 34, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,216, 69, 40, 62,220, 17, 34, 63,107,  8, 65, 62,
-170, 23, 33, 63,105, 20, 52, 62,198,160, 44, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,230, 32, 78, 62,211, 52, 43, 63,105, 20, 52, 62,198,160, 44, 63,107,  8, 65, 62,170, 23, 33, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,107,  8, 65, 62,170, 23, 33, 63,216, 69, 40, 62,
-220, 17, 34, 63,152, 72, 53, 62,229,209, 22, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 14,139,103, 62,199,228, 40, 63,230, 32, 78, 62,211, 52, 43, 63, 89, 65, 90, 62, 94, 60, 31, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 89, 65, 90, 62, 94, 60, 31, 63, 83,237,113, 62,
-130,140, 28, 63, 14,139,103, 62,199,228, 40, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,128, 62, 23,200, 37, 63, 14,139,103, 62,199,228, 40, 63, 83,237,113, 62,130,140, 28, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 83,237,113, 62,130,140, 28, 63, 89, 65, 90, 62,
- 94, 60, 31, 63, 64,246,100, 62,246, 29, 19, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,180,153, 25, 62,185, 32, 23, 63,152, 72, 53, 62,229,209, 22, 63,216, 69, 40, 62,220, 17, 34, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,216, 69, 40, 62,220, 17, 34, 63,133,237, 10, 62,
-219, 17, 34, 63,180,153, 25, 62,185, 32, 23, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,147,213,251, 61,228,209, 22, 63,180,153, 25, 62,185, 32, 23, 63,133,237, 10, 62,219, 17, 34, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,133,237, 10, 62,219, 17, 34, 63,216, 69, 40, 62,
-220, 17, 34, 63,173,153, 25, 62, 27, 28, 45, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,180,153, 25, 62,185, 32, 23, 63,147,213,251, 61,228,209, 22, 63, 67, 12, 12, 62, 98,116, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 67, 12, 12, 62, 98,116, 11, 63, 34, 39, 39, 62,
- 98,116, 11, 63,180,153, 25, 62,185, 32, 23, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,152, 72, 53, 62,229,209, 22, 63,180,153, 25, 62,185, 32, 23, 63, 34, 39, 39, 62, 98,116, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 34, 39, 39, 62, 98,116, 11, 63, 67, 12, 12, 62,
- 98,116, 11, 63,181,153, 25, 62,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 92, 51, 51, 62,244,  1,  0, 63,254,204, 76, 62,  0,  0,  0, 63, 47, 67, 65, 62,147,111, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 47, 67, 65, 62,147,111, 11, 63, 34, 39, 39, 62,
- 98,116, 11, 63, 92, 51, 51, 62,244,  1,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,181,153, 25, 62,  0,  0,  0, 63, 92, 51, 51, 62,244,  1,  0, 63, 34, 39, 39, 62, 98,116, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 34, 39, 39, 62, 98,116, 11, 63, 47, 67, 65, 62,
-147,111, 11, 63,152, 72, 53, 62,229,209, 22, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  8,  0,  0, 62,244,  1,  0, 63,181,153, 25, 62,  0,  0,  0, 63, 67, 12, 12, 62, 98,116, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 67, 12, 12, 62, 98,116, 11, 63,109,224,227, 61,
-147,111, 11, 63,  8,  0,  0, 62,244,  1,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,215,204,204, 61,  0,  0,  0, 63,  8,  0,  0, 62,244,  1,  0, 63,109,224,227, 61,147,111, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,109,224,227, 61,147,111, 11, 63, 67, 12, 12, 62,
- 98,116, 11, 63,147,213,251, 61,228,209, 22, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,196,153, 25, 62, 73, 58,217, 62,171, 31,253, 61,  6,196,217, 62,  1,135, 11, 62,228,230,198, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  1,135, 11, 62,228,230,198, 62,153,172, 39, 62,
-230,230,198, 62,196,153, 25, 62, 73, 58,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,179,163, 52, 62,  7,196,217, 62,196,153, 25, 62, 73, 58,217, 62,153,172, 39, 62,230,230,198, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,153,172, 39, 62,230,230,198, 62,  1,135, 11, 62,
-228,230,198, 62,214,153, 25, 62,165,111,180, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,196,153, 25, 62, 73, 58,217, 62,179,163, 52, 62,  7,196,217, 62,202,235, 38, 62, 33,211,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,202,235, 38, 62, 33,211,236, 62,173, 71, 12, 62,
- 31,211,236, 62,196,153, 25, 62, 73, 58,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,171, 31,253, 61,  6,196,217, 62,196,153, 25, 62, 73, 58,217, 62,173, 71, 12, 62, 31,211,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,173, 71, 12, 62, 31,211,236, 62,202,235, 38, 62,
- 33,211,236, 62,181,153, 25, 62,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  8,  0,  0, 62,244,  1,  0, 63,215,204,204, 61,  0,  0,  0, 63,251,166,228, 61, 67,207,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,251,166,228, 61, 67,207,236, 62,173, 71, 12, 62,
- 31,211,236, 62,  8,  0,  0, 62,244,  1,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,181,153, 25, 62,  0,  0,  0, 63,  8,  0,  0, 62,244,  1,  0, 63,173, 71, 12, 62, 31,211,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,173, 71, 12, 62, 31,211,236, 62,251,166,228, 61,
- 67,207,236, 62,171, 31,253, 61,  6,196,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 92, 51, 51, 62,244,  1,  0, 63,181,153, 25, 62,  0,  0,  0, 63,202,235, 38, 62, 33,211,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,202,235, 38, 62, 33,211,236, 62,251,223, 64, 62,
- 67,207,236, 62, 92, 51, 51, 62,244,  1,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,254,204, 76, 62,  0,  0,  0, 63, 92, 51, 51, 62,244,  1,  0, 63,251,223, 64, 62, 67,207,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,251,223, 64, 62, 67,207,236, 62,202,235, 38, 62,
- 33,211,236, 62,179,163, 52, 62,  7,196,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 42,228,203, 61, 37, 48, 21, 63,  1,122,156, 61,254, 29, 19, 63,172,242,180, 61, 96,152,  9, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,172,242,180, 61, 96,152,  9, 63,109,224,227, 61,
-147,111, 11, 63, 42,228,203, 61, 37, 48, 21, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,147,213,251, 61,228,209, 22, 63, 42,228,203, 61, 37, 48, 21, 63,109,224,227, 61,147,111, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,109,224,227, 61,147,111, 11, 63,172,242,180, 61,
- 96,152,  9, 63,215,204,204, 61,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 42,228,203, 61, 37, 48, 21, 63,147,213,251, 61,228,209, 22, 63,208, 85,228, 61,179, 23, 33, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,208, 85,228, 61,179, 23, 33, 63,212,227,177, 61,
-110, 60, 31, 63, 42,228,203, 61, 37, 48, 21, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  1,122,156, 61,254, 29, 19, 63, 42,228,203, 61, 37, 48, 21, 63,212,227,177, 61,110, 60, 31, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,212,227,177, 61,110, 60, 31, 63,208, 85,228, 61,
-179, 23, 33, 63,175, 36,202, 61,228, 52, 43, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 53, 80,151, 61,223,228, 40, 63,246,203, 76, 61, 48,200, 37, 63,166,139,130, 61,145,140, 28, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,166,139,130, 61,145,140, 28, 63,212,227,177, 61,
-110, 60, 31, 63, 53, 80,151, 61,223,228, 40, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,175, 36,202, 61,228, 52, 43, 63, 53, 80,151, 61,223,228, 40, 63,212,227,177, 61,110, 60, 31, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,212,227,177, 61,110, 60, 31, 63,166,139,130, 61,
-145,140, 28, 63,  1,122,156, 61,254, 29, 19, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,201, 61,254, 61,207,160, 44, 63,175, 36,202, 61,228, 52, 43, 63,208, 85,228, 61,179, 23, 33, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,208, 85,228, 61,179, 23, 33, 63,133,237, 10, 62,
-219, 17, 34, 63,201, 61,254, 61,207,160, 44, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,173,153, 25, 62, 27, 28, 45, 63,201, 61,254, 61,207,160, 44, 63,133,237, 10, 62,219, 17, 34, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,133,237, 10, 62,219, 17, 34, 63,208, 85,228, 61,
-179, 23, 33, 63,147,213,251, 61,228,209, 22, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,245,  6,205, 62, 37, 48, 21, 63,155, 10,193, 62,229,209, 22, 63,229,  7,199, 62,147,111, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,229,  7,199, 62,147,111, 11, 63, 85,195,210, 62,
- 96,152,  9, 63,245,  6,205, 62, 37, 48, 21, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,128,225,216, 62,254, 29, 19, 63,245,  6,205, 62, 37, 48, 21, 63, 85,195,210, 62, 96,152,  9, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 85,195,210, 62, 96,152,  9, 63,229,  7,199, 62,
-147,111, 11, 63,202,204,204, 62,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,245,  6,205, 62, 37, 48, 21, 63,128,225,216, 62,254, 29, 19, 63, 11,135,211, 62,110, 60, 31, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 11,135,211, 62,110, 60, 31, 63,140,234,198, 62,
-179, 23, 33, 63,245,  6,205, 62, 37, 48, 21, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,155, 10,193, 62,229,209, 22, 63,245,  6,205, 62, 37, 48, 21, 63,140,234,198, 62,179, 23, 33, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,140,234,198, 62,179, 23, 33, 63, 11,135,211, 62,
-110, 60, 31, 63,212,118,205, 62,228, 52, 43, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,142,112,192, 62,207,160, 44, 63, 42, 51,179, 62, 28, 28, 45, 63, 61,137,186, 62,219, 17, 34, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 61,137,186, 62,219, 17, 34, 63,140,234,198, 62,
-179, 23, 33, 63,142,112,192, 62,207,160, 44, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,212,118,205, 62,228, 52, 43, 63,142,112,192, 62,207,160, 44, 63,140,234,198, 62,179, 23, 33, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,140,234,198, 62,179, 23, 33, 63, 61,137,186, 62,
-219, 17, 34, 63,155, 10,193, 62,229,209, 22, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,243, 43,218, 62,223,228, 40, 63,212,118,205, 62,228, 52, 43, 63, 11,135,211, 62,110, 60, 31, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 11,135,211, 62,110, 60, 31, 63, 22, 93,223, 62,
-145,140, 28, 63,243, 43,218, 62,223,228, 40, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,129,102,230, 62, 48,200, 37, 63,243, 43,218, 62,223,228, 40, 63, 22, 93,223, 62,145,140, 28, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 22, 93,223, 62,145,140, 28, 63, 11,135,211, 62,
-110, 60, 31, 63,128,225,216, 62,254, 29, 19, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 38, 51,179, 62,185, 32, 23, 63,155, 10,193, 62,229,209, 22, 63, 61,137,186, 62,219, 17, 34, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 61,137,186, 62,219, 17, 34, 63, 20,221,171, 62,
-219, 17, 34, 63, 38, 51,179, 62,185, 32, 23, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,180, 91,165, 62,229,209, 22, 63, 38, 51,179, 62,185, 32, 23, 63, 20,221,171, 62,219, 17, 34, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 20,221,171, 62,219, 17, 34, 63, 61,137,186, 62,
-219, 17, 34, 63, 42, 51,179, 62, 28, 28, 45, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 38, 51,179, 62,185, 32, 23, 63,180, 91,165, 62,229,209, 22, 63,111,108,172, 62, 98,116, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,111,108,172, 62, 98,116, 11, 63,222,249,185, 62,
- 98,116, 11, 63, 38, 51,179, 62,185, 32, 23, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,155, 10,193, 62,229,209, 22, 63, 38, 51,179, 62,185, 32, 23, 63,222,249,185, 62, 98,116, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,222,249,185, 62, 98,116, 11, 63,111,108,172, 62,
- 98,116, 11, 63, 38, 51,179, 62,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,252,255,191, 62,244,  1,  0, 63,202,204,204, 62,  0,  0,  0, 63,229,  7,199, 62,147,111, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,229,  7,199, 62,147,111, 11, 63,222,249,185, 62,
- 98,116, 11, 63,252,255,191, 62,244,  1,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 38, 51,179, 62,  0,  0,  0, 63,252,255,191, 62,244,  1,  0, 63,222,249,185, 62, 98,116, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,222,249,185, 62, 98,116, 11, 63,229,  7,199, 62,
-147,111, 11, 63,155, 10,193, 62,229,209, 22, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 82,102,166, 62,244,  1,  0, 63, 38, 51,179, 62,  0,  0,  0, 63,111,108,172, 62, 98,116, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,111,108,172, 62, 98,116, 11, 63,104, 94,159, 62,
-147,111, 11, 63, 82,102,166, 62,244,  1,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,129,153,153, 62,  0,  0,  0, 63, 82,102,166, 62,244,  1,  0, 63,104, 94,159, 62,147,111, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,104, 94,159, 62,147,111, 11, 63,111,108,172, 62,
- 98,116, 11, 63,180, 91,165, 62,229,209, 22, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 30, 51,179, 62, 73, 58,217, 62, 39,174,165, 62,  7,196,217, 62,180, 41,172, 62,227,230,198, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,180, 41,172, 62,227,230,198, 62,127, 60,186, 62,
-225,230,198, 62, 30, 51,179, 62, 73, 58,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 21,184,192, 62,  6,196,217, 62, 30, 51,179, 62, 73, 58,217, 62,127, 60,186, 62,225,230,198, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,127, 60,186, 62,225,230,198, 62,180, 41,172, 62,
-227,230,198, 62, 21, 51,179, 62,165,111,180, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 30, 51,179, 62, 73, 58,217, 62, 21,184,192, 62,  6,196,217, 62, 42,220,185, 62, 31,211,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 42,220,185, 62, 31,211,236, 62, 27,138,172, 62,
- 33,211,236, 62, 30, 51,179, 62, 73, 58,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 39,174,165, 62,  7,196,217, 62, 30, 51,179, 62, 73, 58,217, 62, 27,138,172, 62, 33,211,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 27,138,172, 62, 33,211,236, 62, 42,220,185, 62,
- 31,211,236, 62, 38, 51,179, 62,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 82,102,166, 62,244,  1,  0, 63,129,153,153, 62,  0,  0,  0, 63,  3,144,159, 62, 67,207,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  3,144,159, 62, 67,207,236, 62, 27,138,172, 62,
- 33,211,236, 62, 82,102,166, 62,244,  1,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 38, 51,179, 62,  0,  0,  0, 63, 82,102,166, 62,244,  1,  0, 63, 27,138,172, 62, 33,211,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 27,138,172, 62, 33,211,236, 62,  3,144,159, 62,
- 67,207,236, 62, 39,174,165, 62,  7,196,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,252,255,191, 62,244,  1,  0, 63, 38, 51,179, 62,  0,  0,  0, 63, 42,220,185, 62, 31,211,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 42,220,185, 62, 31,211,236, 62, 65,214,198, 62,
- 67,207,236, 62,252,255,191, 62,244,  1,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,202,204,204, 62,  0,  0,  0, 63,252,255,191, 62,244,  1,  0, 63, 65,214,198, 62, 67,207,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 65,214,198, 62, 67,207,236, 62, 42,220,185, 62,
- 31,211,236, 62, 21,184,192, 62,  6,196,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 95, 95,153, 62, 32, 48, 21, 63,224,132,141, 62,246, 29, 19, 63,  1,163,147, 62, 91,152,  9, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  1,163,147, 62, 91,152,  9, 63,104, 94,159, 62,
-147,111, 11, 63, 95, 95,153, 62, 32, 48, 21, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,180, 91,165, 62,229,209, 22, 63, 95, 95,153, 62, 32, 48, 21, 63,104, 94,159, 62,147,111, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,104, 94,159, 62,147,111, 11, 63,  1,163,147, 62,
- 91,152,  9, 63,129,153,153, 62,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 95, 95,153, 62, 32, 48, 21, 63,180, 91,165, 62,229,209, 22, 63,203,123,159, 62,170, 23, 33, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,203,123,159, 62,170, 23, 33, 63, 84,223,146, 62,
- 94, 60, 31, 63, 95, 95,153, 62, 32, 48, 21, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,224,132,141, 62,246, 29, 19, 63, 95, 95,153, 62, 32, 48, 21, 63, 84,223,146, 62, 94, 60, 31, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 84,223,146, 62, 94, 60, 31, 63,203,123,159, 62,
-170, 23, 33, 63,141,239,152, 62,211, 52, 43, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,121, 58,140, 62,199,228, 40, 63,  0,  0,128, 62, 23,200, 37, 63, 86,  9,135, 62,130,140, 28, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 86,  9,135, 62,130,140, 28, 63, 84,223,146, 62,
- 94, 60, 31, 63,121, 58,140, 62,199,228, 40, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,141,239,152, 62,211, 52, 43, 63,121, 58,140, 62,199,228, 40, 63, 84,223,146, 62, 94, 60, 31, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 84,223,146, 62, 94, 60, 31, 63, 86,  9,135, 62,
-130,140, 28, 63,224,132,141, 62,246, 29, 19, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,204,245,165, 62,198,160, 44, 63,141,239,152, 62,211, 52, 43, 63,203,123,159, 62,170, 23, 33, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,203,123,159, 62,170, 23, 33, 63, 20,221,171, 62,
-219, 17, 34, 63,204,245,165, 62,198,160, 44, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 42, 51,179, 62, 28, 28, 45, 63,204,245,165, 62,198,160, 44, 63, 20,221,171, 62,219, 17, 34, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 20,221,171, 62,219, 17, 34, 63,203,123,159, 62,
-170, 23, 33, 63,180, 91,165, 62,229,209, 22, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,180,182, 25, 63, 38, 48, 21, 63,140,184, 19, 63,232,209, 22, 63, 43,183, 22, 63,149,111, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 43,183, 22, 63,149,111, 11, 63,223,148, 28, 63,
- 94,152,  9, 63,180,182, 25, 63, 38, 48, 21, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,245,163, 31, 63,253, 29, 19, 63,180,182, 25, 63, 38, 48, 21, 63,223,148, 28, 63, 94,152,  9, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,223,148, 28, 63, 94,152,  9, 63, 43,183, 22, 63,
-149,111, 11, 63,155,153, 25, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,180,182, 25, 63, 38, 48, 21, 63,245,163, 31, 63,253, 29, 19, 63,191,246, 28, 63,109, 60, 31, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,191,246, 28, 63,109, 60, 31, 63,132,168, 22, 63,
-180, 23, 33, 63,180,182, 25, 63, 38, 48, 21, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,140,184, 19, 63,232,209, 22, 63,180,182, 25, 63, 38, 48, 21, 63,132,168, 22, 63,180, 23, 33, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,132,168, 22, 63,180, 23, 33, 63,191,246, 28, 63,
-109, 60, 31, 63,169,238, 25, 63,229, 52, 43, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,138,107, 19, 63,211,160, 44, 63,220,204, 12, 63, 35, 28, 45, 63,225,119, 16, 63,225, 17, 34, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,225,119, 16, 63,225, 17, 34, 63,132,168, 22, 63,
-180, 23, 33, 63,138,107, 19, 63,211,160, 44, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,169,238, 25, 63,229, 52, 43, 63,138,107, 19, 63,211,160, 44, 63,132,168, 22, 63,180, 23, 33, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,132,168, 22, 63,180, 23, 33, 63,225,119, 16, 63,
-225, 17, 34, 63,140,184, 19, 63,232,209, 22, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 51, 73, 32, 63,221,228, 40, 63,169,238, 25, 63,229, 52, 43, 63,191,246, 28, 63,109, 60, 31, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,191,246, 28, 63,109, 60, 31, 63,192,225, 34, 63,
-142,140, 28, 63, 51, 73, 32, 63,221,228, 40, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,117,102, 38, 63, 45,200, 37, 63, 51, 73, 32, 63,221,228, 40, 63,192,225, 34, 63,142,140, 28, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,192,225, 34, 63,142,140, 28, 63,191,246, 28, 63,
-109, 60, 31, 63,245,163, 31, 63,253, 29, 19, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,212,204, 12, 63,188, 32, 23, 63,140,184, 19, 63,232,209, 22, 63,225,119, 16, 63,225, 17, 34, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,225,119, 16, 63,225, 17, 34, 63,207, 33,  9, 63,
-226, 17, 34, 63,212,204, 12, 63,188, 32, 23, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 29,225,  5, 63,233,209, 22, 63,212,204, 12, 63,188, 32, 23, 63,207, 33,  9, 63,226, 17, 34, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,207, 33,  9, 63,226, 17, 34, 63,225,119, 16, 63,
-225, 17, 34, 63,220,204, 12, 63, 35, 28, 45, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,212,204, 12, 63,188, 32, 23, 63, 29,225,  5, 63,233,209, 22, 63,118,105,  9, 63,101,116, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,118,105,  9, 63,101,116, 11, 63, 43, 48, 16, 63,
-100,116, 11, 63,212,204, 12, 63,188, 32, 23, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,140,184, 19, 63,232,209, 22, 63,212,204, 12, 63,188, 32, 23, 63, 43, 48, 16, 63,100,116, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 43, 48, 16, 63,100,116, 11, 63,118,105,  9, 63,
-101,116, 11, 63,205,204, 12, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 51, 51, 19, 63,244,  1,  0, 63,155,153, 25, 63,  0,  0,  0, 63, 43,183, 22, 63,149,111, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 43,183, 22, 63,149,111, 11, 63, 43, 48, 16, 63,
-100,116, 11, 63, 51, 51, 19, 63,244,  1,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,205,204, 12, 63,  0,  0,  0, 63, 51, 51, 19, 63,244,  1,  0, 63, 43, 48, 16, 63,100,116, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 43, 48, 16, 63,100,116, 11, 63, 43,183, 22, 63,
-149,111, 11, 63,140,184, 19, 63,232,209, 22, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,102,102,  6, 63,244,  1,  0, 63,205,204, 12, 63,  0,  0,  0, 63,118,105,  9, 63,101,116, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,118,105,  9, 63,101,116, 11, 63,118,226,  2, 63,
-149,111, 11, 63,102,102,  6, 63,244,  1,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,102,102,  6, 63,244,  1,  0, 63,118,226,  2, 63,149,111, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,118,226,  2, 63,149,111, 11, 63,118,105,  9, 63,
-101,116, 11, 63, 29,225,  5, 63,233,209, 22, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,198,204, 12, 63, 72, 58,217, 62, 77, 10,  6, 63,  6,196,217, 62, 17, 72,  9, 63,227,230,198, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 17, 72,  9, 63,227,230,198, 62,117, 81, 16, 63,
-223,230,198, 62,198,204, 12, 63, 72, 58,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 64,143, 19, 63,  4,196,217, 62,198,204, 12, 63, 72, 58,217, 62,117, 81, 16, 63,223,230,198, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,117, 81, 16, 63,223,230,198, 62, 17, 72,  9, 63,
-227,230,198, 62,191,204, 12, 63,160,111,180, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,198,204, 12, 63, 72, 58,217, 62, 64,143, 19, 63,  4,196,217, 62, 76, 33, 16, 63, 30,211,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 76, 33, 16, 63, 30,211,236, 62, 71,120,  9, 63,
- 30,211,236, 62,198,204, 12, 63, 72, 58,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 77, 10,  6, 63,  6,196,217, 62,198,204, 12, 63, 72, 58,217, 62, 71,120,  9, 63, 30,211,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 71,120,  9, 63, 30,211,236, 62, 76, 33, 16, 63,
- 30,211,236, 62,205,204, 12, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,102,102,  6, 63,244,  1,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63, 62,251,  2, 63, 67,207,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 62,251,  2, 63, 67,207,236, 62, 71,120,  9, 63,
- 30,211,236, 62,102,102,  6, 63,244,  1,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,205,204, 12, 63,  0,  0,  0, 63,102,102,  6, 63,244,  1,  0, 63, 71,120,  9, 63, 30,211,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 71,120,  9, 63, 30,211,236, 62, 62,251,  2, 63,
- 67,207,236, 62, 77, 10,  6, 63,  6,196,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 51, 51, 19, 63,244,  1,  0, 63,205,204, 12, 63,  0,  0,  0, 63, 76, 33, 16, 63, 30,211,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 76, 33, 16, 63, 30,211,236, 62, 86,158, 22, 63,
- 65,207,236, 62, 51, 51, 19, 63,244,  1,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,155,153, 25, 63,  0,  0,  0, 63, 51, 51, 19, 63,244,  1,  0, 63, 86,158, 22, 63, 65,207,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 86,158, 22, 63, 65,207,236, 62, 76, 33, 16, 63,
- 30,211,236, 62, 64,143, 19, 63,  4,196,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,233,197,255, 62, 39, 48, 21, 63,101,235,243, 62,252, 29, 19, 63,132,  9,250, 62, 94,152,  9, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,132,  9,250, 62, 94,152,  9, 63,118,226,  2, 63,
-149,111, 11, 63,233,197,255, 62, 39, 48, 21, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 29,225,  5, 63,233,209, 22, 63,233,197,255, 62, 39, 48, 21, 63,118,226,  2, 63,149,111, 11, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,118,226,  2, 63,149,111, 11, 63,132,  9,250, 62,
- 94,152,  9, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,233,197,255, 62, 39, 48, 21, 63, 29,225,  5, 63,233,209, 22, 63, 43,241,  2, 63,181, 23, 33, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 43,241,  2, 63,181, 23, 33, 63,225, 69,249, 62,
-110, 60, 31, 63,233,197,255, 62, 39, 48, 21, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,101,235,243, 62,252, 29, 19, 63,233,197,255, 62, 39, 48, 21, 63,225, 69,249, 62,110, 60, 31, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,225, 69,249, 62,110, 60, 31, 63, 43,241,  2, 63,
-181, 23, 33, 63, 30, 86,255, 62,230, 52, 43, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  9,161,242, 62,223,228, 40, 63,129,102,230, 62, 48,200, 37, 63,222,111,237, 62,143,140, 28, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,222,111,237, 62,143,140, 28, 63,225, 69,249, 62,
-110, 60, 31, 63,  9,161,242, 62,223,228, 40, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 30, 86,255, 62,230, 52, 43, 63,  9,161,242, 62,223,228, 40, 63,225, 69,249, 62,110, 60, 31, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,225, 69,249, 62,110, 60, 31, 63,222,111,237, 62,
-143,140, 28, 63,101,235,243, 62,252, 29, 19, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 46, 46,  6, 63,211,160, 44, 63, 30, 86,255, 62,230, 52, 43, 63, 43,241,  2, 63,181, 23, 33, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 43,241,  2, 63,181, 23, 33, 63,207, 33,  9, 63,
-226, 17, 34, 63, 46, 46,  6, 63,211,160, 44, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,220,204, 12, 63, 35, 28, 45, 63, 46, 46,  6, 63,211,160, 44, 63,207, 33,  9, 63,226, 17, 34, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,207, 33,  9, 63,226, 17, 34, 63, 43,241,  2, 63,
-181, 23, 33, 63, 29,225,  5, 63,233,209, 22, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,138,238, 85, 63, 72,220,187, 62,218,173, 82, 63, 55, 92,210, 62,229,189, 79, 63,173,208,189, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,229,189, 79, 63,173,208,189, 62,230,250, 82, 63,
-117,190,166, 62,138,238, 85, 63, 72,220,187, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,149,153, 89, 63,201,199,165, 62,138,238, 85, 63, 72,220,187, 62,230,250, 82, 63,117,190,166, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,230,250, 82, 63,117,190,166, 62,229,189, 79, 63,
-173,208,189, 62,198,119, 76, 63, 90,150,169, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,170,111, 73, 63, 68,135,193, 62,198,119, 76, 63, 90,150,169, 62,229,189, 79, 63,173,208,189, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,229,189, 79, 63,173,208,189, 62,176,175, 76, 63,
-192,159,213, 62,170,111, 73, 63, 68,135,193, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,112,194, 70, 63, 19,196,217, 62,170,111, 73, 63, 68,135,193, 62,176,175, 76, 63,192,159,213, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,176,175, 76, 63,192,159,213, 62,229,189, 79, 63,
-173,208,189, 62,218,173, 82, 63, 55, 92,210, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 52,175, 79, 63,218, 32,233, 62,193,204, 76, 63,  0,  0,  0, 63,128,209, 73, 63, 75,207,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,128,209, 73, 63, 75,207,236, 62,176,175, 76, 63,
-192,159,213, 62, 52,175, 79, 63,218, 32,233, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,218,173, 82, 63, 55, 92,210, 62, 52,175, 79, 63,218, 32,233, 62,176,175, 76, 63,192,159,213, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,176,175, 76, 63,192,159,213, 62,128,209, 73, 63,
- 75,207,236, 62,112,194, 70, 63, 19,196,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,170,111, 73, 63, 68,135,193, 62,112,194, 70, 63, 19,196,217, 62,171,132, 67, 63,253,230,198, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,171,132, 67, 63,253,230,198, 62, 61, 29, 70, 63,
-114, 54,174, 62,170,111, 73, 63, 68,135,193, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,198,119, 76, 63, 90,150,169, 62,170,111, 73, 63, 68,135,193, 62, 61, 29, 70, 63,114, 54,174, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 61, 29, 70, 63,114, 54,174, 62,171,132, 67, 63,
-253,230,198, 62,  0,  0, 64, 63,211,111,180, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 52,175, 79, 63,218, 32,233, 62,218,173, 82, 63, 55, 92,210, 62, 56, 54, 86, 63, 58, 23,233, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 56, 54, 86, 63, 58, 23,233, 62, 41, 51, 83, 63,
- 24,252,255, 62, 52,175, 79, 63,218, 32,233, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,193,204, 76, 63,  0,  0,  0, 63, 52,175, 79, 63,218, 32,233, 62, 41, 51, 83, 63, 24,252,255, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 41, 51, 83, 63, 24,252,255, 62, 56, 54, 86, 63,
- 58, 23,233, 62,147,153, 89, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,239,252, 92, 63, 58, 23,233, 62,147,153, 89, 63,  0,  0,  0, 63, 56, 54, 86, 63, 58, 23,233, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 56, 54, 86, 63, 58, 23,233, 62,147,153, 89, 63,
-143,190,209, 62,239,252, 92, 63, 58, 23,233, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 78,133, 96, 63, 55, 92,210, 62,239,252, 92, 63, 58, 23,233, 62,147,153, 89, 63,143,190,209, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,147,153, 89, 63,143,190,209, 62, 56, 54, 86, 63,
- 58, 23,233, 62,218,173, 82, 63, 55, 92,210, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,138,238, 85, 63, 72,220,187, 62,149,153, 89, 63,201,199,165, 62,159, 68, 93, 63, 72,220,187, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,159, 68, 93, 63, 72,220,187, 62,147,153, 89, 63,
-143,190,209, 62,138,238, 85, 63, 72,220,187, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,218,173, 82, 63, 55, 92,210, 62,138,238, 85, 63, 72,220,187, 62,147,153, 89, 63,143,190,209, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,147,153, 89, 63,143,190,209, 62,159, 68, 93, 63,
- 72,220,187, 62, 78,133, 96, 63, 55, 92,210, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,239,252, 92, 63, 58, 23,233, 62, 78,133, 96, 63, 55, 92,210, 62,242,131, 99, 63,218, 32,233, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,242,131, 99, 63,218, 32,233, 62,254,255, 95, 63,
- 24,252,255, 62,239,252, 92, 63, 58, 23,233, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,147,153, 89, 63,  0,  0,  0, 63,239,252, 92, 63, 58, 23,233, 62,254,255, 95, 63, 24,252,255, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,254,255, 95, 63, 24,252,255, 62,242,131, 99, 63,
-218, 32,233, 62,101,102,102, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,139,174,111, 63,223,230,198, 62,192,112,108, 63,  4,196,217, 62,133,195,105, 63, 37,135,193, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,133,195,105, 63, 37,135,193, 62,249, 21,109, 63,
- 65, 54,174, 62,139,174,111, 63,223,230,198, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 65, 51,115, 63,160,111,180, 62,139,174,111, 63,223,230,198, 62,249, 21,109, 63, 65, 54,174, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,249, 21,109, 63, 65, 54,174, 62,133,195,105, 63,
- 37,135,193, 62,106,187,102, 63, 54,150,169, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 70,117, 99, 63,155,208,189, 62,106,187,102, 63, 54,150,169, 62,133,195,105, 63, 37,135,193, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,133,195,105, 63, 37,135,193, 62,123,131,102, 63,
-181,159,213, 62, 70,117, 99, 63,155,208,189, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 78,133, 96, 63, 55, 92,210, 62, 70,117, 99, 63,155,208,189, 62,123,131,102, 63,181,159,213, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,123,131,102, 63,181,159,213, 62,133,195,105, 63,
- 37,135,193, 62,192,112,108, 63,  4,196,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,170, 97,105, 63, 65,207,236, 62,101,102,102, 63,  0,  0,  0, 63,242,131, 99, 63,218, 32,233, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,242,131, 99, 63,218, 32,233, 62,123,131,102, 63,
-181,159,213, 62,170, 97,105, 63, 65,207,236, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,192,112,108, 63,  4,196,217, 62,170, 97,105, 63, 65,207,236, 62,123,131,102, 63,181,159,213, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,123,131,102, 63,181,159,213, 62,242,131, 99, 63,
-218, 32,233, 62, 78,133, 96, 63, 55, 92,210, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 70,117, 99, 63,155,208,189, 62, 78,133, 96, 63, 55, 92,210, 62,159, 68, 93, 63, 72,220,187, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,159, 68, 93, 63, 72,220,187, 62, 71, 56, 96, 63,
- 99,190,166, 62, 70,117, 99, 63,155,208,189, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,106,187,102, 63, 54,150,169, 62, 70,117, 99, 63,155,208,189, 62, 71, 56, 96, 63, 99,190,166, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 71, 56, 96, 63, 99,190,166, 62,159, 68, 93, 63,
- 72,220,187, 62,149,153, 89, 63,201,199,165, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 33,107, 99, 63, 94,152,  9, 63, 11, 92, 96, 63,253, 29, 19, 63, 21,238, 92, 63,112,150,  9, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 21,238, 92, 63,112,150,  9, 63,254,255, 95, 63,
- 24,252,255, 62, 33,107, 99, 63, 94,152,  9, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,101,102,102, 63,  0,  0,  0, 63, 33,107, 99, 63, 94,152,  9, 63,254,255, 95, 63, 24,252,255, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,254,255, 95, 63, 24,252,255, 62, 21,238, 92, 63,
-112,150,  9, 63,147,153, 89, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 14, 69, 86, 63,112,150,  9, 63,147,153, 89, 63,  0,  0,  0, 63, 21,238, 92, 63,112,150,  9, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 21,238, 92, 63,112,150,  9, 63,143,153, 89, 63,
-219, 98, 19, 63, 14, 69, 86, 63,112,150,  9, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 19,215, 82, 63,252, 29, 19, 63, 14, 69, 86, 63,112,150,  9, 63,143,153, 89, 63,219, 98, 19, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,143,153, 89, 63,219, 98, 19, 63, 21,238, 92, 63,
-112,150,  9, 63, 11, 92, 96, 63,253, 29, 19, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 63, 30, 93, 63,143,140, 28, 63,139,153, 89, 63, 45,200, 37, 63,218, 20, 86, 63,143,140, 28, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,218, 20, 86, 63,143,140, 28, 63,143,153, 89, 63,
-219, 98, 19, 63, 63, 30, 93, 63,143,140, 28, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 11, 92, 96, 63,253, 29, 19, 63, 63, 30, 93, 63,143,140, 28, 63,143,153, 89, 63,219, 98, 19, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,143,153, 89, 63,219, 98, 19, 63,218, 20, 86, 63,
-143,140, 28, 63, 19,215, 82, 63,252, 29, 19, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 14, 69, 86, 63,112,150,  9, 63, 19,215, 82, 63,252, 29, 19, 63,  1,200, 79, 63, 94,152,  9, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  1,200, 79, 63, 94,152,  9, 63, 41, 51, 83, 63,
- 24,252,255, 62, 14, 69, 86, 63,112,150,  9, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,147,153, 89, 63,  0,  0,  0, 63, 14, 69, 86, 63,112,150,  9, 63, 41, 51, 83, 63, 24,252,255, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 41, 51, 83, 63, 24,252,255, 62,  1,200, 79, 63,
- 94,152,  9, 63,193,204, 76, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,237, 28, 18, 61, 60,220,187, 62,151, 35,188, 60, 46, 92,210, 62,218, 74, 60, 60,150,208,189, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,218, 74, 60, 60,150,208,189, 62,195,197,197, 60,
- 89,190,166, 62,237, 28, 18, 61, 60,220,187, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,194,205, 76, 61,186,199,165, 62,237, 28, 18, 61, 60,220,187, 62,195,197,197, 60, 89,190,166, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 23, 23,131, 63, 89,190,166, 62,150,120,129, 63,
-150,208,189, 62, 15,171,127, 63, 52,150,169, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,241,162,124, 63, 36,135,193, 62, 15,171,127, 63, 52,150,169, 62,150,120,129, 63,150,208,189, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,150,120,129, 63,150,208,189, 62,244,226,127, 63,
-179,159,213, 62,241,162,124, 63, 36,135,193, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,179,245,121, 63,  6,196,217, 62,241,162,124, 63, 36,135,193, 62,244,226,127, 63,179,159,213, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,244,226,127, 63,179,159,213, 62,150,120,129, 63,
-150,208,189, 62,142,240,130, 63, 46, 92,210, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 59,113,129, 63,214, 32,233, 62,  0,  0,128, 63,  0,  0,  0, 63,194,  4,125, 63, 67,207,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,194,  4,125, 63, 67,207,236, 62,244,226,127, 63,
-179,159,213, 62, 59,113,129, 63,214, 32,233, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,142,240,130, 63, 46, 92,210, 62, 59,113,129, 63,214, 32,233, 62,244,226,127, 63,179,159,213, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,244,226,127, 63,179,159,213, 62,194,  4,125, 63,
- 67,207,236, 62,179,245,121, 63,  6,196,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,241,162,124, 63, 36,135,193, 62,179,245,121, 63,  6,196,217, 62,239,183,118, 63,227,230,198, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,239,183,118, 63,227,230,198, 62,133, 80,121, 63,
- 65, 54,174, 62,241,162,124, 63, 36,135,193, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 15,171,127, 63, 52,150,169, 62,241,162,124, 63, 36,135,193, 62,133, 80,121, 63, 65, 54,174, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,133, 80,121, 63, 65, 54,174, 62,239,183,118, 63,
-227,230,198, 62, 65, 51,115, 63,160,111,180, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,110,157, 56, 60,214, 32,233, 62,151, 35,188, 60, 46, 92,210, 62, 95,151, 22, 61, 55, 23,233, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 95,151, 22, 61, 55, 23,233, 62,176,204,204, 60,
- 24,252,255, 62,110,157, 56, 60,214, 32,233, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,167, 79, 11, 38,  0,  0,  0, 63,110,157, 56, 60,214, 32,233, 62,176,204,204, 60, 24,252,255, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,176,204,204, 60, 24,252,255, 62, 95,151, 22, 61,
- 55, 23,233, 62,215,204, 76, 61,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 87,129,129, 61, 57, 23,233, 62,215,204, 76, 61,  0,  0,  0, 63, 95,151, 22, 61, 55, 23,233, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 95,151, 22, 61, 55, 23,233, 62, 68,205, 76, 61,
-135,190,209, 62, 87,129,129, 61, 57, 23,233, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 92,196,157, 61, 49, 92,210, 62, 87,129,129, 61, 57, 23,233, 62, 68,205, 76, 61,135,190,209, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 68,205, 76, 61,135,190,209, 62, 95,151, 22, 61,
- 55, 23,233, 62,151, 35,188, 60, 46, 92,210, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,237, 28, 18, 61, 60,220,187, 62,194,205, 76, 61,186,199,165, 62,  7,191,131, 61, 62,220,187, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  7,191,131, 61, 62,220,187, 62, 68,205, 76, 61,
-135,190,209, 62,237, 28, 18, 61, 60,220,187, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,151, 35,188, 60, 46, 92,210, 62,237, 28, 18, 61, 60,220,187, 62, 68,205, 76, 61,135,190,209, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 68,205, 76, 61,135,190,209, 62,  7,191,131, 61,
- 62,220,187, 62, 92,196,157, 61, 49, 92,210, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 87,129,129, 61, 57, 23,233, 62, 92,196,157, 61, 49, 92,210, 62, 89,185,181, 61,214, 32,233, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 89,185,181, 61,214, 32,233, 62,154,153,153, 61,
- 25,252,255, 62, 87,129,129, 61, 57, 23,233, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,215,204, 76, 61,  0,  0,  0, 63, 87,129,129, 61, 57, 23,233, 62,154,153,153, 61, 25,252,255, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,154,153,153, 61, 25,252,255, 62, 89,185,181, 61,
-214, 32,233, 62,215,204,204, 61,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  1,135, 11, 62,228,230,198, 62,171, 31,253, 61,  6,196,217, 62,251,181,231, 61, 38,135,193, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,251,181,231, 61, 38,135,193, 62,204, 36,  1, 62,
- 70, 54,174, 62,  1,135, 11, 62,228,230,198, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,214,153, 25, 62,165,111,180, 62,  1,135, 11, 62,228,230,198, 62,204, 36,  1, 62, 70, 54,174, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,204, 36,  1, 62, 70, 54,174, 62,251,181,231, 61,
- 38,135,193, 62, 70,117,207, 61, 54,150,169, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 35, 68,181, 61,153,208,189, 62, 70,117,207, 61, 54,150,169, 62,251,181,231, 61, 38,135,193, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,251,181,231, 61, 38,135,193, 62,164,181,205, 61,
-180,159,213, 62, 35, 68,181, 61,153,208,189, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 92,196,157, 61, 49, 92,210, 62, 35, 68,181, 61,153,208,189, 62,164,181,205, 61,180,159,213, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,164,181,205, 61,180,159,213, 62,251,181,231, 61,
- 38,135,193, 62,171, 31,253, 61,  6,196,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,251,166,228, 61, 67,207,236, 62,215,204,204, 61,  0,  0,  0, 63, 89,185,181, 61,214, 32,233, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 89,185,181, 61,214, 32,233, 62,164,181,205, 61,
-180,159,213, 62,251,166,228, 61, 67,207,236, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,171, 31,253, 61,  6,196,217, 62,251,166,228, 61, 67,207,236, 62,164,181,205, 61,180,159,213, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,164,181,205, 61,180,159,213, 62, 89,185,181, 61,
-214, 32,233, 62, 92,196,157, 61, 49, 92,210, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 35, 68,181, 61,153,208,189, 62, 92,196,157, 61, 49, 92,210, 62,  7,191,131, 61, 62,220,187, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  7,191,131, 61, 62,220,187, 62, 79, 92,155, 61,
- 91,190,166, 62, 35, 68,181, 61,153,208,189, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 70,117,207, 61, 54,150,169, 62, 35, 68,181, 61,153,208,189, 62, 79, 92,155, 61, 91,190,166, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 79, 92,155, 61, 91,190,166, 62,  7,191,131, 61,
- 62,220,187, 62,194,205, 76, 61,186,199,165, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,172,242,180, 61, 96,152,  9, 63,  1,122,156, 61,254, 29, 19, 63,100, 10,129, 61,113,150,  9, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,100, 10,129, 61,113,150,  9, 63,154,153,153, 61,
- 25,252,255, 62,172,242,180, 61, 96,152,  9, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,215,204,204, 61,  0,  0,  0, 63,172,242,180, 61, 96,152,  9, 63,154,153,153, 61, 25,252,255, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,154,153,153, 61, 25,252,255, 62,100, 10,129, 61,
-113,150,  9, 63,215,204, 76, 61,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,109,132, 23, 61,113,150,  9, 63,215,204, 76, 61,  0,  0,  0, 63,100, 10,129, 61,113,150,  9, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,100, 10,129, 61,113,150,  9, 63, 91,204, 76, 61,
-220, 98, 19, 63,109,132, 23, 61,113,150,  9, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,174, 73,193, 60,253, 29, 19, 63,109,132, 23, 61,113,150,  9, 63, 91,204, 76, 61,220, 98, 19, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 91,204, 76, 61,220, 98, 19, 63,100, 10,129, 61,
-113,150,  9, 63,  1,122,156, 61,254, 29, 19, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,166,139,130, 61,145,140, 28, 63,246,203, 76, 61, 48,200, 37, 63, 13,129, 20, 61,143,140, 28, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 13,129, 20, 61,143,140, 28, 63, 91,204, 76, 61,
-220, 98, 19, 63,166,139,130, 61,145,140, 28, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  1,122,156, 61,254, 29, 19, 63,166,139,130, 61,145,140, 28, 63, 91,204, 76, 61,220, 98, 19, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 91,204, 76, 61,220, 98, 19, 63, 13,129, 20, 61,
-143,140, 28, 63,174, 73,193, 60,253, 29, 19, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,109,132, 23, 61,113,150,  9, 63,174, 73,193, 60,253, 29, 19, 63,114,207, 62, 60, 94,152,  9, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,114,207, 62, 60, 94,152,  9, 63,176,204,204, 60,
- 24,252,255, 62,109,132, 23, 61,113,150,  9, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,215,204, 76, 61,  0,  0,  0, 63,109,132, 23, 61,113,150,  9, 63,176,204,204, 60, 24,252,255, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,176,204,204, 60, 24,252,255, 62,114,207, 62, 60,
- 94,152,  9, 63,167, 79, 11, 38,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,237, 83,113, 62, 79,220,187, 62, 63, 81,100, 62, 60, 92,210, 62,110,145, 88, 62,167,208,189, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,110,145, 88, 62,167,208,189, 62, 91,133,101, 62,
-112,190,166, 62,237, 83,113, 62, 79,220,187, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,128, 62,206,199,165, 62,237, 83,113, 62, 79,220,187, 62, 91,133,101, 62,112,190,166, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 91,133,101, 62,112,190,166, 62,110,145, 88, 62,
-167,208,189, 62,239,120, 75, 62, 70,150,169, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,144, 88, 63, 62, 46,135,193, 62,239,120, 75, 62, 70,150,169, 62,110,145, 88, 62,167,208,189, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,110,145, 88, 62,167,208,189, 62,170, 88, 76, 62,
-187,159,213, 62,144, 88, 63, 62, 46,135,193, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,179,163, 52, 62,  7,196,217, 62,144, 88, 63, 62, 46,135,193, 62,170, 88, 76, 62,187,159,213, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,170, 88, 76, 62,187,159,213, 62,110,145, 88, 62,
-167,208,189, 62, 63, 81,100, 62, 60, 92,210, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,190, 86, 88, 62,221, 32,233, 62,254,204, 76, 62,  0,  0,  0, 63,251,223, 64, 62, 67,207,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,251,223, 64, 62, 67,207,236, 62,170, 88, 76, 62,
-187,159,213, 62,190, 86, 88, 62,221, 32,233, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 63, 81,100, 62, 60, 92,210, 62,190, 86, 88, 62,221, 32,233, 62,170, 88, 76, 62,187,159,213, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,170, 88, 76, 62,187,159,213, 62,251,223, 64, 62,
- 67,207,236, 62,179,163, 52, 62,  7,196,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,144, 88, 63, 62, 46,135,193, 62,179,163, 52, 62,  7,196,217, 62,153,172, 39, 62,230,230,198, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,153,172, 39, 62,230,230,198, 62,213, 14, 50, 62,
- 78, 54,174, 62,144, 88, 63, 62, 46,135,193, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,239,120, 75, 62, 70,150,169, 62,144, 88, 63, 62, 46,135,193, 62,213, 14, 50, 62, 78, 54,174, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,213, 14, 50, 62, 78, 54,174, 62,153,172, 39, 62,
-230,230,198, 62,214,153, 25, 62,165,111,180, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,190, 86, 88, 62,221, 32,233, 62, 63, 81,100, 62, 60, 92,210, 62,166,114,114, 62, 63, 23,233, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,166,114,114, 62, 63, 23,233, 62,126,102,102, 62,
- 25,252,255, 62,190, 86, 88, 62,221, 32,233, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,254,204, 76, 62,  0,  0,  0, 63,190, 86, 88, 62,221, 32,233, 62,126,102,102, 62, 25,252,255, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,126,102,102, 62, 25,252,255, 62,166,114,114, 62,
- 63, 23,233, 62,  0,  0,128, 62,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,173,198,134, 62, 63, 23,233, 62,  0,  0,128, 62,  0,  0,  0, 63,166,114,114, 62, 63, 23,233, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,166,114,114, 62, 63, 23,233, 62,  0,  0,128, 62,
-149,190,209, 62,173,198,134, 62, 63, 23,233, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 97,215,141, 62, 60, 92,210, 62,173,198,134, 62, 63, 23,233, 62,  0,  0,128, 62,149,190,209, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,128, 62,149,190,209, 62,166,114,114, 62,
- 63, 23,233, 62, 63, 81,100, 62, 60, 92,210, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,237, 83,113, 62, 79,220,187, 62,  0,  0,128, 62,206,199,165, 62,  9, 86,135, 62, 79,220,187, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  9, 86,135, 62, 79,220,187, 62,  0,  0,128, 62,
-149,190,209, 62,237, 83,113, 62, 79,220,187, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 63, 81,100, 62, 60, 92,210, 62,237, 83,113, 62, 79,220,187, 62,  0,  0,128, 62,149,190,209, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,128, 62,149,190,209, 62,  9, 86,135, 62,
- 79,220,187, 62, 97,215,141, 62, 60, 92,210, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,173,198,134, 62, 63, 23,233, 62, 97,215,141, 62, 60, 92,210, 62,161,212,147, 62,221, 32,233, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,161,212,147, 62,221, 32,233, 62,193,204,140, 62,
- 25,252,255, 62,173,198,134, 62, 63, 23,233, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,128, 62,  0,  0,  0, 63,173,198,134, 62, 63, 23,233, 62,193,204,140, 62, 25,252,255, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,193,204,140, 62, 25,252,255, 62,161,212,147, 62,
-221, 32,233, 62,129,153,153, 62,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,180, 41,172, 62,227,230,198, 62, 39,174,165, 62,  7,196,217, 62,184, 83,160, 62, 46,135,193, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,184, 83,160, 62, 46,135,193, 62,150,248,166, 62,
- 78, 54,174, 62,180, 41,172, 62,227,230,198, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 21, 51,179, 62,165,111,180, 62,180, 41,172, 62,227,230,198, 62,150,248,166, 62, 78, 54,174, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,150,248,166, 62, 78, 54,174, 62,184, 83,160, 62,
- 46,135,193, 62,137, 67,154, 62, 70,150,169, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 73,183,147, 62,167,208,189, 62,137, 67,154, 62, 70,150,169, 62,184, 83,160, 62, 46,135,193, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,184, 83,160, 62, 46,135,193, 62,171,211,153, 62,
-187,159,213, 62, 73,183,147, 62,167,208,189, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 97,215,141, 62, 60, 92,210, 62, 73,183,147, 62,167,208,189, 62,171,211,153, 62,187,159,213, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,171,211,153, 62,187,159,213, 62,184, 83,160, 62,
- 46,135,193, 62, 39,174,165, 62,  7,196,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  3,144,159, 62, 67,207,236, 62,129,153,153, 62,  0,  0,  0, 63,161,212,147, 62,221, 32,233, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,161,212,147, 62,221, 32,233, 62,171,211,153, 62,
-187,159,213, 62,  3,144,159, 62, 67,207,236, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 39,174,165, 62,  7,196,217, 62,  3,144,159, 62, 67,207,236, 62,171,211,153, 62,187,159,213, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,171,211,153, 62,187,159,213, 62,161,212,147, 62,
-221, 32,233, 62, 97,215,141, 62, 60, 92,210, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 73,183,147, 62,167,208,189, 62, 97,215,141, 62, 60, 92,210, 62,  9, 86,135, 62, 79,220,187, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  9, 86,135, 62, 79,220,187, 62, 82, 61,141, 62,
-112,190,166, 62, 73,183,147, 62,167,208,189, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,137, 67,154, 62, 70,150,169, 62, 73,183,147, 62,167,208,189, 62, 82, 61,141, 62,112,190,166, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 82, 61,141, 62,112,190,166, 62,  9, 86,135, 62,
- 79,220,187, 62,  0,  0,128, 62,206,199,165, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  1,163,147, 62, 91,152,  9, 63,224,132,141, 62,246, 29, 19, 63,251,168,134, 62,107,150,  9, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,251,168,134, 62,107,150,  9, 63,193,204,140, 62,
- 25,252,255, 62,  1,163,147, 62, 91,152,  9, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,129,153,153, 62,  0,  0,  0, 63,  1,163,147, 62, 91,152,  9, 63,193,204,140, 62, 25,252,255, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,193,204,140, 62, 25,252,255, 62,251,168,134, 62,
-107,150,  9, 63,  0,  0,128, 62,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 11,174,114, 62,107,150,  9, 63,  0,  0,128, 62,  0,  0,  0, 63,251,168,134, 62,107,150,  9, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,251,168,134, 62,107,150,  9, 63,  0,  0,128, 62,
-209, 98, 19, 63, 11,174,114, 62,107,150,  9, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 64,246,100, 62,246, 29, 19, 63, 11,174,114, 62,107,150,  9, 63,  0,  0,128, 62,209, 98, 19, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,128, 62,209, 98, 19, 63,251,168,134, 62,
-107,150,  9, 63,224,132,141, 62,246, 29, 19, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 86,  9,135, 62,130,140, 28, 63,  0,  0,128, 62, 23,200, 37, 63, 83,237,113, 62,130,140, 28, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 83,237,113, 62,130,140, 28, 63,  0,  0,128, 62,
-209, 98, 19, 63, 86,  9,135, 62,130,140, 28, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,224,132,141, 62,246, 29, 19, 63, 86,  9,135, 62,130,140, 28, 63,  0,  0,128, 62,209, 98, 19, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,128, 62,209, 98, 19, 63, 83,237,113, 62,
-130,140, 28, 63, 64,246,100, 62,246, 29, 19, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 11,174,114, 62,107,150,  9, 63, 64,246,100, 62,246, 29, 19, 63,255,185, 88, 62, 90,152,  9, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,255,185, 88, 62, 90,152,  9, 63,126,102,102, 62,
- 25,252,255, 62, 11,174,114, 62,107,150,  9, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,128, 62,  0,  0,  0, 63, 11,174,114, 62,107,150,  9, 63,126,102,102, 62, 25,252,255, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,126,102,102, 62, 25,252,255, 62,255,185, 88, 62,
- 90,152,  9, 63,254,204, 76, 62,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 63, 16,223, 62, 62,220,187, 62,233,142,216, 62, 49, 92,210, 62,248,174,210, 62,153,208,189, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,248,174,210, 62,153,208,189, 62,237, 40,217, 62,
- 91,190,166, 62, 63, 16,223, 62, 62,220,187, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 72,102,230, 62,183,199,165, 62, 63, 16,223, 62, 62,220,187, 62,237, 40,217, 62, 91,190,166, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,237, 40,217, 62, 91,190,166, 62,248,174,210, 62,
-153,208,189, 62,175, 34,204, 62, 54,150,169, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,129, 18,198, 62, 37,135,193, 62,175, 34,204, 62, 54,150,169, 62,248,174,210, 62,153,208,189, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,248,174,210, 62,153,208,189, 62,151,146,204, 62,
-180,159,213, 62,129, 18,198, 62, 37,135,193, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 21,184,192, 62,  6,196,217, 62,129, 18,198, 62, 37,135,193, 62,151,146,204, 62,180,159,213, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,151,146,204, 62,180,159,213, 62,248,174,210, 62,
-153,208,189, 62,233,142,216, 62, 49, 92,210, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,170,145,210, 62,214, 32,233, 62,202,204,204, 62,  0,  0,  0, 63, 65,214,198, 62, 67,207,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 65,214,198, 62, 67,207,236, 62,151,146,204, 62,
-180,159,213, 62,170,145,210, 62,214, 32,233, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,233,142,216, 62, 49, 92,210, 62,170,145,210, 62,214, 32,233, 62,151,146,204, 62,180,159,213, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,151,146,204, 62,180,159,213, 62, 65,214,198, 62,
- 67,207,236, 62, 21,184,192, 62,  6,196,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,129, 18,198, 62, 37,135,193, 62, 21,184,192, 62,  6,196,217, 62,127, 60,186, 62,225,230,198, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,127, 60,186, 62,225,230,198, 62,154,109,191, 62,
- 68, 54,174, 62,129, 18,198, 62, 37,135,193, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,175, 34,204, 62, 54,150,169, 62,129, 18,198, 62, 37,135,193, 62,154,109,191, 62, 68, 54,174, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,154,109,191, 62, 68, 54,174, 62,127, 60,186, 62,
-225,230,198, 62, 21, 51,179, 62,165,111,180, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,170,145,210, 62,214, 32,233, 62,233,142,216, 62, 49, 92,210, 62,171,159,223, 62, 57, 23,233, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,171,159,223, 62, 57, 23,233, 62,154,153,217, 62,
- 24,252,255, 62,170,145,210, 62,214, 32,233, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,202,204,204, 62,  0,  0,  0, 63,170,145,210, 62,214, 32,233, 62,154,153,217, 62, 24,252,255, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,154,153,217, 62, 24,252,255, 62,171,159,223, 62,
- 57, 23,233, 62,101,102,230, 62,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 20, 45,237, 62, 55, 23,233, 62,101,102,230, 62,  0,  0,  0, 63,171,159,223, 62, 57, 23,233, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,171,159,223, 62, 57, 23,233, 62, 88,102,230, 62,
-135,190,209, 62, 20, 45,237, 62, 55, 23,233, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,199, 61,244, 62, 46, 92,210, 62, 20, 45,237, 62, 55, 23,233, 62, 88,102,230, 62,135,190,209, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 88,102,230, 62,135,190,209, 62,171,159,223, 62,
- 57, 23,233, 62,233,142,216, 62, 49, 92,210, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 63, 16,223, 62, 62,220,187, 62, 72,102,230, 62,183,199,165, 62, 99,188,237, 62, 60,220,187, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 99,188,237, 62, 60,220,187, 62, 88,102,230, 62,
-135,190,209, 62, 63, 16,223, 62, 62,220,187, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,233,142,216, 62, 49, 92,210, 62, 63, 16,223, 62, 62,220,187, 62, 88,102,230, 62,135,190,209, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 88,102,230, 62,135,190,209, 62, 99,188,237, 62,
- 60,220,187, 62,199, 61,244, 62, 46, 92,210, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 20, 45,237, 62, 55, 23,233, 62,199, 61,244, 62, 46, 92,210, 62, 21, 59,250, 62,213, 32,233, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 21, 59,250, 62,213, 32,233, 62, 53, 51,243, 62,
- 24,252,255, 62, 20, 45,237, 62, 55, 23,233, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,101,102,230, 62,  0,  0,  0, 63, 20, 45,237, 62, 55, 23,233, 62, 53, 51,243, 62, 24,252,255, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 53, 51,243, 62, 24,252,255, 62, 21, 59,250, 62,
-213, 32,233, 62,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 17, 72,  9, 63,227,230,198, 62, 77, 10,  6, 63,  6,196,217, 62, 15, 93,  3, 63, 36,135,193, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 15, 93,  3, 63, 36,135,193, 62,123,175,  6, 63,
- 65, 54,174, 62, 17, 72,  9, 63,227,230,198, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,191,204, 12, 63,160,111,180, 62, 17, 72,  9, 63,227,230,198, 62,123,175,  6, 63, 65, 54,174, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,123,175,  6, 63, 65, 54,174, 62, 15, 93,  3, 63,
- 36,135,193, 62,241, 84,  0, 63, 52,150,169, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,169, 29,250, 62,150,208,189, 62,241, 84,  0, 63, 52,150,169, 62, 15, 93,  3, 63, 36,135,193, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 15, 93,  3, 63, 36,135,193, 62, 12, 29,  0, 63,
-179,159,213, 62,169, 29,250, 62,150,208,189, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,199, 61,244, 62, 46, 92,210, 62,169, 29,250, 62,150,208,189, 62, 12, 29,  0, 63,179,159,213, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 12, 29,  0, 63,179,159,213, 62, 15, 93,  3, 63,
- 36,135,193, 62, 77, 10,  6, 63,  6,196,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 62,251,  2, 63, 67,207,236, 62,  0,  0,  0, 63,  0,  0,  0, 63, 21, 59,250, 62,213, 32,233, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 21, 59,250, 62,213, 32,233, 62, 12, 29,  0, 63,
-179,159,213, 62, 62,251,  2, 63, 67,207,236, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 77, 10,  6, 63,  6,196,217, 62, 62,251,  2, 63, 67,207,236, 62, 12, 29,  0, 63,179,159,213, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 12, 29,  0, 63,179,159,213, 62, 21, 59,250, 62,
-213, 32,233, 62,199, 61,244, 62, 46, 92,210, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,169, 29,250, 62,150,208,189, 62,199, 61,244, 62, 46, 92,210, 62, 99,188,237, 62, 60,220,187, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 99,188,237, 62, 60,220,187, 62,164,163,243, 62,
- 89,190,166, 62,169, 29,250, 62,150,208,189, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,241, 84,  0, 63, 52,150,169, 62,169, 29,250, 62,150,208,189, 62,164,163,243, 62, 89,190,166, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,164,163,243, 62, 89,190,166, 62, 99,188,237, 62,
- 60,220,187, 62, 72,102,230, 62,183,199,165, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,132,  9,250, 62, 94,152,  9, 63,101,235,243, 62,252, 29, 19, 63,114, 15,237, 62,113,150,  9, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,114, 15,237, 62,113,150,  9, 63, 53, 51,243, 62,
- 24,252,255, 62,132,  9,250, 62, 94,152,  9, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,132,  9,250, 62, 94,152,  9, 63, 53, 51,243, 62, 24,252,255, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 53, 51,243, 62, 24,252,255, 62,114, 15,237, 62,
-113,150,  9, 63,101,102,230, 62,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,103,189,223, 62,112,150,  9, 63,101,102,230, 62,  0,  0,  0, 63,114, 15,237, 62,113,150,  9, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,114, 15,237, 62,113,150,  9, 63,117,102,230, 62,
-220, 98, 19, 63,103,189,223, 62,112,150,  9, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,128,225,216, 62,254, 29, 19, 63,103,189,223, 62,112,150,  9, 63,117,102,230, 62,220, 98, 19, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,117,102,230, 62,220, 98, 19, 63,114, 15,237, 62,
-113,150,  9, 63,101,235,243, 62,252, 29, 19, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,222,111,237, 62,143,140, 28, 63,129,102,230, 62, 48,200, 37, 63, 22, 93,223, 62,145,140, 28, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 22, 93,223, 62,145,140, 28, 63,117,102,230, 62,
-220, 98, 19, 63,222,111,237, 62,143,140, 28, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,101,235,243, 62,252, 29, 19, 63,222,111,237, 62,143,140, 28, 63,117,102,230, 62,220, 98, 19, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,117,102,230, 62,220, 98, 19, 63, 22, 93,223, 62,
-145,140, 28, 63,128,225,216, 62,254, 29, 19, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,103,189,223, 62,112,150,  9, 63,128,225,216, 62,254, 29, 19, 63, 85,195,210, 62, 96,152,  9, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 85,195,210, 62, 96,152,  9, 63,154,153,217, 62,
- 24,252,255, 62,103,189,223, 62,112,150,  9, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,101,102,230, 62,  0,  0,  0, 63,103,189,223, 62,112,150,  9, 63,154,153,217, 62, 24,252,255, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,154,153,217, 62, 24,252,255, 62, 85,195,210, 62,
- 96,152,  9, 63,202,204,204, 62,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 97,187, 34, 63, 72,220,187, 62,178,122, 31, 63, 55, 92,210, 62,186,138, 28, 63,155,208,189, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,186,138, 28, 63,155,208,189, 62,185,199, 31, 63,
- 96,190,166, 62, 97,187, 34, 63, 72,220,187, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,107,102, 38, 63,201,199,165, 62, 97,187, 34, 63, 72,220,187, 62,185,199, 31, 63, 96,190,166, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,185,199, 31, 63, 96,190,166, 62,186,138, 28, 63,
-155,208,189, 62,150, 68, 25, 63, 54,150,169, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,123, 60, 22, 63, 36,135,193, 62,150, 68, 25, 63, 54,150,169, 62,186,138, 28, 63,155,208,189, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,186,138, 28, 63,155,208,189, 62,133,124, 25, 63,
-181,159,213, 62,123, 60, 22, 63, 36,135,193, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 64,143, 19, 63,  4,196,217, 62,123, 60, 22, 63, 36,135,193, 62,133,124, 25, 63,181,159,213, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,133,124, 25, 63,181,159,213, 62,186,138, 28, 63,
-155,208,189, 62,178,122, 31, 63, 55, 92,210, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 14,124, 28, 63,218, 32,233, 62,155,153, 25, 63,  0,  0,  0, 63, 86,158, 22, 63, 65,207,236, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 86,158, 22, 63, 65,207,236, 62,133,124, 25, 63,
-181,159,213, 62, 14,124, 28, 63,218, 32,233, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,178,122, 31, 63, 55, 92,210, 62, 14,124, 28, 63,218, 32,233, 62,133,124, 25, 63,181,159,213, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,133,124, 25, 63,181,159,213, 62, 86,158, 22, 63,
- 65,207,236, 62, 64,143, 19, 63,  4,196,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,123, 60, 22, 63, 36,135,193, 62, 64,143, 19, 63,  4,196,217, 62,117, 81, 16, 63,223,230,198, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,117, 81, 16, 63,223,230,198, 62,  7,234, 18, 63,
- 65, 54,174, 62,123, 60, 22, 63, 36,135,193, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,150, 68, 25, 63, 54,150,169, 62,123, 60, 22, 63, 36,135,193, 62,  7,234, 18, 63, 65, 54,174, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  7,234, 18, 63, 65, 54,174, 62,117, 81, 16, 63,
-223,230,198, 62,191,204, 12, 63,160,111,180, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 14,124, 28, 63,218, 32,233, 62,178,122, 31, 63, 55, 92,210, 62, 17,  3, 35, 63, 58, 23,233, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 17,  3, 35, 63, 58, 23,233, 62,  2,  0, 32, 63,
- 24,252,255, 62, 14,124, 28, 63,218, 32,233, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,155,153, 25, 63,  0,  0,  0, 63, 14,124, 28, 63,218, 32,233, 62,  2,  0, 32, 63, 24,252,255, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  2,  0, 32, 63, 24,252,255, 62, 17,  3, 35, 63,
- 58, 23,233, 62,109,102, 38, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,200,201, 41, 63, 58, 23,233, 62,109,102, 38, 63,  0,  0,  0, 63, 17,  3, 35, 63, 58, 23,233, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 17,  3, 35, 63, 58, 23,233, 62,109,102, 38, 63,
-143,190,209, 62,200,201, 41, 63, 58, 23,233, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 38, 82, 45, 63, 55, 92,210, 62,200,201, 41, 63, 58, 23,233, 62,109,102, 38, 63,143,190,209, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,109,102, 38, 63,143,190,209, 62, 17,  3, 35, 63,
- 58, 23,233, 62,178,122, 31, 63, 55, 92,210, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 97,187, 34, 63, 72,220,187, 62,107,102, 38, 63,201,199,165, 62,118, 17, 42, 63, 72,220,187, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,118, 17, 42, 63, 72,220,187, 62,109,102, 38, 63,
-143,190,209, 62, 97,187, 34, 63, 72,220,187, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,178,122, 31, 63, 55, 92,210, 62, 97,187, 34, 63, 72,220,187, 62,109,102, 38, 63,143,190,209, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,109,102, 38, 63,143,190,209, 62,118, 17, 42, 63,
- 72,220,187, 62, 38, 82, 45, 63, 55, 92,210, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,200,201, 41, 63, 58, 23,233, 62, 38, 82, 45, 63, 55, 92,210, 62,204, 80, 48, 63,218, 32,233, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,204, 80, 48, 63,218, 32,233, 62,215,204, 44, 63,
- 23,252,255, 62,200,201, 41, 63, 58, 23,233, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,109,102, 38, 63,  0,  0,  0, 63,200,201, 41, 63, 58, 23,233, 62,215,204, 44, 63, 23,252,255, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,215,204, 44, 63, 23,252,255, 62,204, 80, 48, 63,
-218, 32,233, 62, 63, 51, 51, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 85,123, 60, 63,253,230,198, 62,144, 61, 57, 63, 19,196,217, 62, 86,144, 54, 63, 68,135,193, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 86,144, 54, 63, 68,135,193, 62,196,226, 57, 63,
-114, 54,174, 62, 85,123, 60, 63,253,230,198, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0, 64, 63,211,111,180, 62, 85,123, 60, 63,253,230,198, 62,196,226, 57, 63,114, 54,174, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,196,226, 57, 63,114, 54,174, 62, 86,144, 54, 63,
- 68,135,193, 62, 58,136, 51, 63, 90,150,169, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 27, 66, 48, 63,173,208,189, 62, 58,136, 51, 63, 90,150,169, 62, 86,144, 54, 63, 68,135,193, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 86,144, 54, 63, 68,135,193, 62, 80, 80, 51, 63,
-192,159,213, 62, 27, 66, 48, 63,173,208,189, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 38, 82, 45, 63, 55, 92,210, 62, 27, 66, 48, 63,173,208,189, 62, 80, 80, 51, 63,192,159,213, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 80, 80, 51, 63,192,159,213, 62, 86,144, 54, 63,
- 68,135,193, 62,144, 61, 57, 63, 19,196,217, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,128, 46, 54, 63, 75,207,236, 62, 63, 51, 51, 63,  0,  0,  0, 63,204, 80, 48, 63,218, 32,233, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,204, 80, 48, 63,218, 32,233, 62, 80, 80, 51, 63,
-192,159,213, 62,128, 46, 54, 63, 75,207,236, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,144, 61, 57, 63, 19,196,217, 62,128, 46, 54, 63, 75,207,236, 62, 80, 80, 51, 63,192,159,213, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 80, 80, 51, 63,192,159,213, 62,204, 80, 48, 63,
-218, 32,233, 62, 38, 82, 45, 63, 55, 92,210, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 27, 66, 48, 63,173,208,189, 62, 38, 82, 45, 63, 55, 92,210, 62,118, 17, 42, 63, 72,220,187, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,118, 17, 42, 63, 72,220,187, 62, 26,  5, 45, 63,
-117,190,166, 62, 27, 66, 48, 63,173,208,189, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 58,136, 51, 63, 90,150,169, 62, 27, 66, 48, 63,173,208,189, 62, 26,  5, 45, 63,117,190,166, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 26,  5, 45, 63,117,190,166, 62,118, 17, 42, 63,
- 72,220,187, 62,107,102, 38, 63,201,199,165, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,255, 55, 48, 63, 94,152,  9, 63,237, 40, 45, 63,252, 29, 19, 63,242,186, 41, 63,112,150,  9, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,242,186, 41, 63,112,150,  9, 63,215,204, 44, 63,
- 23,252,255, 62,255, 55, 48, 63, 94,152,  9, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 63, 51, 51, 63,  0,  0,  0, 63,255, 55, 48, 63, 94,152,  9, 63,215,204, 44, 63, 23,252,255, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,215,204, 44, 63, 23,252,255, 62,242,186, 41, 63,
-112,150,  9, 63,109,102, 38, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,235, 17, 35, 63,112,150,  9, 63,109,102, 38, 63,  0,  0,  0, 63,242,186, 41, 63,112,150,  9, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,242,186, 41, 63,112,150,  9, 63,113,102, 38, 63,
-219, 98, 19, 63,235, 17, 35, 63,112,150,  9, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,245,163, 31, 63,253, 29, 19, 63,235, 17, 35, 63,112,150,  9, 63,113,102, 38, 63,219, 98, 19, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,113,102, 38, 63,219, 98, 19, 63,242,186, 41, 63,
-112,150,  9, 63,237, 40, 45, 63,252, 29, 19, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 38,235, 41, 63,141,140, 28, 63,117,102, 38, 63, 45,200, 37, 63,192,225, 34, 63,142,140, 28, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,192,225, 34, 63,142,140, 28, 63,113,102, 38, 63,
-219, 98, 19, 63, 38,235, 41, 63,141,140, 28, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,237, 40, 45, 63,252, 29, 19, 63, 38,235, 41, 63,141,140, 28, 63,113,102, 38, 63,219, 98, 19, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,113,102, 38, 63,219, 98, 19, 63,192,225, 34, 63,
-142,140, 28, 63,245,163, 31, 63,253, 29, 19, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,235, 17, 35, 63,112,150,  9, 63,245,163, 31, 63,253, 29, 19, 63,223,148, 28, 63, 94,152,  9, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,223,148, 28, 63, 94,152,  9, 63,  2,  0, 32, 63,
- 24,252,255, 62,235, 17, 35, 63,112,150,  9, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,109,102, 38, 63,  0,  0,  0, 63,235, 17, 35, 63,112,150,  9, 63,  2,  0, 32, 63, 24,252,255, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  2,  0, 32, 63, 24,252,255, 62,223,148, 28, 63,
- 94,152,  9, 63,155,153, 25, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,188,129,107, 63, 66, 45,128, 62,235, 71, 99, 63,222, 76,120, 62, 94, 37,106, 63, 84, 97, 83, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 94, 37,106, 63, 84, 97, 83, 62, 65, 51,115, 63,
-248,151, 97, 62,188,129,107, 63, 66, 45,128, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 65, 51,115, 63,151, 83,135, 62,188,129,107, 63, 66, 45,128, 62, 65, 51,115, 63,248,151, 97, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 65, 51,115, 63,248,151, 97, 62, 94, 37,106, 63,
- 84, 97, 83, 62, 65, 51,115, 63, 90,111, 52, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,188,129,107, 63, 66, 45,128, 62, 65, 51,115, 63,151, 83,135, 62,142,123,108, 63,169,144,151, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,142,123,108, 63,169,144,151, 62,231, 50,101, 63,
- 17,201,146, 62,188,129,107, 63, 66, 45,128, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,235, 71, 99, 63,222, 76,120, 62,188,129,107, 63, 66, 45,128, 62,231, 50,101, 63, 17,201,146, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,231, 50,101, 63, 17,201,146, 62,142,123,108, 63,
-169,144,151, 62,106,187,102, 63, 54,150,169, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 71, 56, 96, 63, 99,190,166, 62,149,153, 89, 63,201,199,165, 62, 22,238, 93, 63,243,101,144, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 22,238, 93, 63,243,101,144, 62,231, 50,101, 63,
- 17,201,146, 62, 71, 56, 96, 63, 99,190,166, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,106,187,102, 63, 54,150,169, 62, 71, 56, 96, 63, 99,190,166, 62,231, 50,101, 63, 17,201,146, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,231, 50,101, 63, 17,201,146, 62, 22,238, 93, 63,
-243,101,144, 62,235, 71, 99, 63,222, 76,120, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,249, 21,109, 63, 65, 54,174, 62,106,187,102, 63, 54,150,169, 62,142,123,108, 63,169,144,151, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,142,123,108, 63,169,144,151, 62, 65, 51,115, 63,
- 93,231,157, 62,249, 21,109, 63, 65, 54,174, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 65, 51,115, 63,160,111,180, 62,249, 21,109, 63, 65, 54,174, 62, 65, 51,115, 63, 93,231,157, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 65, 51,115, 63, 93,231,157, 62,142,123,108, 63,
-169,144,151, 62, 65, 51,115, 63,151, 83,135, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,149,153, 89, 63, 79,162,115, 62,235, 71, 99, 63,222, 76,120, 62, 22,238, 93, 63,243,101,144, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 22,238, 93, 63,243,101,144, 62, 21, 69, 85, 63,
-  3,102,144, 62,149,153, 89, 63, 79,162,115, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 68,235, 79, 63, 37, 77,120, 62,149,153, 89, 63, 79,162,115, 62, 21, 69, 85, 63,  3,102,144, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 21, 69, 85, 63,  3,102,144, 62, 22,238, 93, 63,
-243,101,144, 62,149,153, 89, 63,201,199,165, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,149,153, 89, 63, 79,162,115, 62, 68,235, 79, 63, 37, 77,120, 62, 24,186, 83, 63,245,176, 70, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 24,186, 83, 63,245,176, 70, 62, 22,121, 95, 63,
-204,176, 70, 62,149,153, 89, 63, 79,162,115, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,235, 71, 99, 63,222, 76,120, 62,149,153, 89, 63, 79,162,115, 62, 22,121, 95, 63,204,176, 70, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 22,121, 95, 63,204,176, 70, 62, 24,186, 83, 63,
-245,176, 70, 62,152,153, 89, 63,198, 31, 23, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 61,119,103, 63,179,253, 30, 62, 65, 51,115, 63, 90,111, 52, 62, 94, 37,106, 63, 84, 97, 83, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 94, 37,106, 63, 84, 97, 83, 62, 22,121, 95, 63,
-204,176, 70, 62, 61,119,103, 63,179,253, 30, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,152,153, 89, 63,198, 31, 23, 62, 61,119,103, 63,179,253, 30, 62, 22,121, 95, 63,204,176, 70, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 22,121, 95, 63,204,176, 70, 62, 94, 37,106, 63,
- 84, 97, 83, 62,235, 71, 99, 63,222, 76,120, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,248,187, 75, 63,241,253, 30, 62,152,153, 89, 63,198, 31, 23, 62, 24,186, 83, 63,245,176, 70, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 24,186, 83, 63,245,176, 70, 62,214, 13, 73, 63,
-181, 97, 83, 62,248,187, 75, 63,241,253, 30, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0, 64, 63,202,111, 52, 62,248,187, 75, 63,241,253, 30, 62,214, 13, 73, 63,181, 97, 83, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,214, 13, 73, 63,181, 97, 83, 62, 24,186, 83, 63,
-245,176, 70, 62, 68,235, 79, 63, 37, 77,120, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,152,153, 89, 63,111, 41,147, 61,  0,  0, 64, 63,195,111,180, 61,  0,  0, 64, 63,111, 65, 52, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0, 64, 63,111, 65, 52, 61, 38, 49,117, 63,
-225, 64, 52, 61,152,153, 89, 63,111, 41,147, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 65, 51,115, 63, 83,111,180, 61,152,153, 89, 63,111, 41,147, 61, 38, 49,117, 63,225, 64, 52, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 38, 49,117, 63,225, 64, 52, 61,  0,  0, 64, 63,
-111, 65, 52, 61,208,222,121, 63,102,  9,239,178,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,152,153, 89, 63,111, 41,147, 61, 65, 51,115, 63, 83,111,180, 61,172, 51, 99, 63, 48, 46,231, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,172, 51, 99, 63, 48, 46,231, 61,135,255, 79, 63,
-120, 46,231, 61,152,153, 89, 63,111, 41,147, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0, 64, 63,195,111,180, 61,152,153, 89, 63,111, 41,147, 61,135,255, 79, 63,120, 46,231, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,135,255, 79, 63,120, 46,231, 61,172, 51, 99, 63,
- 48, 46,231, 61,152,153, 89, 63,198, 31, 23, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,248,187, 75, 63,241,253, 30, 62,  0,  0, 64, 63,202,111, 52, 62,  0,  0, 64, 63, 24, 71,  7, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0, 64, 63, 24, 71,  7, 62,135,255, 79, 63,
-120, 46,231, 61,248,187, 75, 63,241,253, 30, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,152,153, 89, 63,198, 31, 23, 62,248,187, 75, 63,241,253, 30, 62,135,255, 79, 63,120, 46,231, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,135,255, 79, 63,120, 46,231, 61,  0,  0, 64, 63,
- 24, 71,  7, 62,  0,  0, 64, 63,195,111,180, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 61,119,103, 63,179,253, 30, 62,152,153, 89, 63,198, 31, 23, 62,172, 51, 99, 63, 48, 46,231, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,172, 51, 99, 63, 48, 46,231, 61, 66, 51,115, 63,
-199, 70,  7, 62, 61,119,103, 63,179,253, 30, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 65, 51,115, 63, 90,111, 52, 62, 61,119,103, 63,179,253, 30, 62, 66, 51,115, 63,199, 70,  7, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 66, 51,115, 63,199, 70,  7, 62,172, 51, 99, 63,
- 48, 46,231, 61, 65, 51,115, 63, 83,111,180, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,122,177, 71, 63,120, 45,128, 62,  0,  0, 64, 63,218, 83,135, 62,  0,  0, 64, 63,115,152, 97, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0, 64, 63,115,152, 97, 62,214, 13, 73, 63,
-181, 97, 83, 62,122,177, 71, 63,120, 45,128, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 68,235, 79, 63, 37, 77,120, 62,122,177, 71, 63,120, 45,128, 62,214, 13, 73, 63,181, 97, 83, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,214, 13, 73, 63,181, 97, 83, 62,  0,  0, 64, 63,
-115,152, 97, 62,  0,  0, 64, 63,202,111, 52, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,122,177, 71, 63,120, 45,128, 62, 68,235, 79, 63, 37, 77,120, 62, 72,  0, 78, 63, 52,201,146, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 72,  0, 78, 63, 52,201,146, 62,169,183, 70, 63,
-219,144,151, 62,122,177, 71, 63,120, 45,128, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0, 64, 63,218, 83,135, 62,122,177, 71, 63,120, 45,128, 62,169,183, 70, 63,219,144,151, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,169,183, 70, 63,219,144,151, 62, 72,  0, 78, 63,
- 52,201,146, 62,198,119, 76, 63, 90,150,169, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 61, 29, 70, 63,114, 54,174, 62,  0,  0, 64, 63,211,111,180, 62,  0,  0, 64, 63,162,231,157, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0, 64, 63,162,231,157, 62,169,183, 70, 63,
-219,144,151, 62, 61, 29, 70, 63,114, 54,174, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,198,119, 76, 63, 90,150,169, 62, 61, 29, 70, 63,114, 54,174, 62,169,183, 70, 63,219,144,151, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,169,183, 70, 63,219,144,151, 62,  0,  0, 64, 63,
-162,231,157, 62,  0,  0, 64, 63,218, 83,135, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,230,250, 82, 63,117,190,166, 62,198,119, 76, 63, 90,150,169, 62, 72,  0, 78, 63, 52,201,146, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 72,  0, 78, 63, 52,201,146, 62, 21, 69, 85, 63,
-  3,102,144, 62,230,250, 82, 63,117,190,166, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,149,153, 89, 63,201,199,165, 62,230,250, 82, 63,117,190,166, 62, 21, 69, 85, 63,  3,102,144, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 21, 69, 85, 63,  3,102,144, 62, 72,  0, 78, 63,
- 52,201,146, 62, 68,235, 79, 63, 37, 77,120, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,179,167,245, 61, 72, 45,128, 62, 94,217,179, 61,222, 76,120, 62,202,196,234, 61,100, 97, 83, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,202,196,234, 61,100, 97, 83, 62,212,153, 25, 62,
-  2,152, 97, 62,179,167,245, 61, 72, 45,128, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,214,153, 25, 62,156, 83,135, 62,179,167,245, 61, 72, 45,128, 62,212,153, 25, 62,  2,152, 97, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,212,153, 25, 62,  2,152, 97, 62,202,196,234, 61,
-100, 97, 83, 62,214,153, 25, 62,106,111, 52, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,179,167,245, 61, 72, 45,128, 62,214,153, 25, 62,156, 83,135, 62, 62,118,253, 61,174,144,151, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 62,118,253, 61,174,144,151, 62, 53, 49,195, 61,
- 17,201,146, 62,179,167,245, 61, 72, 45,128, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 94,217,179, 61,222, 76,120, 62,179,167,245, 61, 72, 45,128, 62, 53, 49,195, 61, 17,201,146, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 53, 49,195, 61, 17,201,146, 62, 62,118,253, 61,
-174,144,151, 62, 70,117,207, 61, 54,150,169, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 79, 92,155, 61, 91,190,166, 62,194,205, 76, 61,186,199,165, 62,212, 10,137, 61,238,101,144, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,212, 10,137, 61,238,101,144, 62, 53, 49,195, 61,
- 17,201,146, 62, 79, 92,155, 61, 91,190,166, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 70,117,207, 61, 54,150,169, 62, 79, 92,155, 61, 91,190,166, 62, 53, 49,195, 61, 17,201,146, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 53, 49,195, 61, 17,201,146, 62,212, 10,137, 61,
-238,101,144, 62, 94,217,179, 61,222, 76,120, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,204, 36,  1, 62, 70, 54,174, 62, 70,117,207, 61, 54,150,169, 62, 62,118,253, 61,174,144,151, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 62,118,253, 61,174,144,151, 62,213,153, 25, 62,
-100,231,157, 62,204, 36,  1, 62, 70, 54,174, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,214,153, 25, 62,165,111,180, 62,204, 36,  1, 62, 70, 54,174, 62,213,153, 25, 62,100,231,157, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,213,153, 25, 62,100,231,157, 62, 62,118,253, 61,
-174,144,151, 62,214,153, 25, 62,156, 83,135, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,188,205, 76, 61, 53,162,115, 62, 94,217,179, 61,222, 76,120, 62,212, 10,137, 61,238,101,144, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,212, 10,137, 61,238,101,144, 62,207,133,  7, 61,
-236,101,144, 62,188,205, 76, 61, 53,162,115, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,255,162, 71, 60,216, 76,120, 62,188,205, 76, 61, 53,162,115, 62,207,133,  7, 61,236,101,144, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,207,133,  7, 61,236,101,144, 62,212, 10,137, 61,
-238,101,144, 62,194,205, 76, 61,186,199,165, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,188,205, 76, 61, 53,162,115, 62,255,162, 71, 60,216, 76,120, 62,190,171,221, 60,194,176, 70, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,190,171,221, 60,194,176, 70, 62,194, 98,149, 61,
-194,176, 70, 62,188,205, 76, 61, 53,162,115, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 94,217,179, 61,222, 76,120, 62,188,205, 76, 61, 53,162,115, 62,194, 98,149, 61,194,176, 70, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,194, 98,149, 61,194,176, 70, 62,190,171,221, 60,
-194,176, 70, 62,193,205, 76, 61,168, 31, 23, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,198, 83,213, 61,179,253, 30, 62,214,153, 25, 62,106,111, 52, 62,202,196,234, 61,100, 97, 83, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,202,196,234, 61,100, 97, 83, 62,194, 98,149, 61,
-194,176, 70, 62,198, 83,213, 61,179,253, 30, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,193,205, 76, 61,168, 31, 23, 62,198, 83,213, 61,179,253, 30, 62,194, 98,149, 61,194,176, 70, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,194, 98,149, 61,194,176, 70, 62,202,196,234, 61,
-100, 97, 83, 62, 94,217,179, 61,222, 76,120, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 59,239,126, 63,174,253, 30, 62,154,105,131, 63,168, 31, 23, 62,175,118,131, 63,194,176, 70, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,175,118,131, 63,194,176, 70, 62, 30, 65,124, 63,
- 90, 97, 83, 62, 59,239,126, 63,174,253, 30, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 65, 51,115, 63, 90,111, 52, 62, 59,239,126, 63,174,253, 30, 62, 30, 65,124, 63, 90, 97, 83, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 30, 65,124, 63, 90, 97, 83, 62,175,118,131, 63,
-194,176, 70, 62, 70,143,129, 63,216, 76,120, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,156,105,131, 63,101, 41,147, 61, 65, 51,115, 63, 83,111,180, 61, 38, 49,117, 63,225, 64, 52, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 38, 49,117, 63,225, 64, 52, 61,232,148,135, 63,
-144,158,125, 60,156,105,131, 63,101, 41,147, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,215,153, 25, 62,104,111,180, 61,122,245,128, 61,101, 41,147, 61,224,153, 25, 62,225, 64, 52, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,232,148,135, 63,144,158,125, 60, 38, 49,117, 63,
-225, 64, 52, 61,208,222,121, 63,102,  9,239,178,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,122,245,128, 61,101, 41,147, 61,215,153, 25, 62,104,111,180, 61, 89, 55,179, 61, 38, 46,231, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 89, 55,179, 61, 38, 46,231, 61, 96,147,208, 60,
- 48, 46,231, 61,122,245,128, 61,101, 41,147, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 65, 51,115, 63, 83,111,180, 61,156,105,131, 63,101, 41,147, 61,102,153,129, 63, 48, 46,231, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 96,147,208, 60, 48, 46,231, 61, 89, 55,179, 61,
- 38, 46,231, 61,193,205, 76, 61,168, 31, 23, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 59,239,126, 63,174,253, 30, 62, 65, 51,115, 63, 90,111, 52, 62, 66, 51,115, 63,199, 70,  7, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 66, 51,115, 63,199, 70,  7, 62,102,153,129, 63,
- 48, 46,231, 61, 59,239,126, 63,174,253, 30, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,154,105,131, 63,168, 31, 23, 62, 59,239,126, 63,174,253, 30, 62,102,153,129, 63, 48, 46,231, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,102,153,129, 63, 48, 46,231, 61, 66, 51,115, 63,
-199, 70,  7, 62, 65, 51,115, 63, 83,111,180, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,198, 83,213, 61,179,253, 30, 62,193,205, 76, 61,168, 31, 23, 62, 89, 55,179, 61, 38, 46,231, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 89, 55,179, 61, 38, 46,231, 61,217,153, 25, 62,
-204, 70,  7, 62,198, 83,213, 61,179,253, 30, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,214,153, 25, 62,106,111, 52, 62,198, 83,213, 61,179,253, 30, 62,217,153, 25, 62,204, 70,  7, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,217,153, 25, 62,204, 70,  7, 62, 89, 55,179, 61,
- 38, 46,231, 61,215,153, 25, 62,104,111,180, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,192,228,122, 63, 66, 45,128, 62, 65, 51,115, 63,151, 83,135, 62, 65, 51,115, 63,248,151, 97, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 65, 51,115, 63,248,151, 97, 62, 30, 65,124, 63,
- 90, 97, 83, 62,192,228,122, 63, 66, 45,128, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 70,143,129, 63,216, 76,120, 62,192,228,122, 63, 66, 45,128, 62, 30, 65,124, 63, 90, 97, 83, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 30, 65,124, 63, 90, 97, 83, 62, 65, 51,115, 63,
-248,151, 97, 62, 65, 51,115, 63, 90,111, 52, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,192,228,122, 63, 66, 45,128, 62, 70,143,129, 63,216, 76,120, 62,201,153,128, 63, 14,201,146, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,201,153,128, 63, 14,201,146, 62,239,234,121, 63,
-169,144,151, 62,192,228,122, 63, 66, 45,128, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 65, 51,115, 63,151, 83,135, 62,192,228,122, 63, 66, 45,128, 62,239,234,121, 63,169,144,151, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,239,234,121, 63,169,144,151, 62,201,153,128, 63,
- 14,201,146, 62, 15,171,127, 63, 52,150,169, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,133, 80,121, 63, 65, 54,174, 62, 65, 51,115, 63,160,111,180, 62, 65, 51,115, 63, 93,231,157, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 65, 51,115, 63, 93,231,157, 62,239,234,121, 63,
-169,144,151, 62,133, 80,121, 63, 65, 54,174, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 15,171,127, 63, 52,150,169, 62,133, 80,121, 63, 65, 54,174, 62,239,234,121, 63,169,144,151, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,239,234,121, 63,169,144,151, 62, 65, 51,115, 63,
- 93,231,157, 62, 65, 51,115, 63,151, 83,135, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 23, 23,131, 63, 89,190,166, 62, 15,171,127, 63, 52,150,169, 62,201,153,128, 63, 14,201,146, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,136,200,153, 59, 14,201,146, 62,207,133,  7, 61,
-236,101,144, 62,195,197,197, 60, 89,190,166, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,194,205, 76, 61,186,199,165, 62,195,197,197, 60, 89,190,166, 62,207,133,  7, 61,236,101,144, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,207,133,  7, 61,236,101,144, 62,136,200,153, 59,
- 14,201,146, 62,255,162, 71, 60,216, 76,120, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 32,208,163, 62, 79, 45,128, 62,147, 92,147, 62,252, 76,120, 62,102, 23,161, 62,115, 97, 83, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,102, 23,161, 62,115, 97, 83, 62, 22, 51,179, 62,
-  2,152, 97, 62, 32,208,163, 62, 79, 45,128, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 21, 51,179, 62,156, 83,135, 62, 32,208,163, 62, 79, 45,128, 62, 22, 51,179, 62,  2,152, 97, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 22, 51,179, 62,  2,152, 97, 62,102, 23,161, 62,
-115, 97, 83, 62, 21, 51,179, 62,101,111, 52, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 32,208,163, 62, 79, 45,128, 62, 21, 51,179, 62,156, 83,135, 62,194,195,165, 62,181,144,151, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,194,195,165, 62,181,144,151, 62,134, 50,151, 62,
- 29,201,146, 62, 32,208,163, 62, 79, 45,128, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,147, 92,147, 62,252, 76,120, 62, 32,208,163, 62, 79, 45,128, 62,134, 50,151, 62, 29,201,146, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,134, 50,151, 62, 29,201,146, 62,194,195,165, 62,
-181,144,151, 62,137, 67,154, 62, 70,150,169, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 82, 61,141, 62,112,190,166, 62,  0,  0,128, 62,206,199,165, 62,247,168,136, 62,  3,102,144, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,247,168,136, 62,  3,102,144, 62,134, 50,151, 62,
- 29,201,146, 62, 82, 61,141, 62,112,190,166, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,137, 67,154, 62, 70,150,169, 62, 82, 61,141, 62,112,190,166, 62,134, 50,151, 62, 29,201,146, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,134, 50,151, 62, 29,201,146, 62,247,168,136, 62,
-  3,102,144, 62,147, 92,147, 62,252, 76,120, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,150,248,166, 62, 78, 54,174, 62,137, 67,154, 62, 70,150,169, 62,194,195,165, 62,181,144,151, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,194,195,165, 62,181,144,151, 62, 21, 51,179, 62,
- 98,231,157, 62,150,248,166, 62, 78, 54,174, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 21, 51,179, 62,165,111,180, 62,150,248,166, 62, 78, 54,174, 62, 21, 51,179, 62, 98,231,157, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 21, 51,179, 62, 98,231,157, 62,194,195,165, 62,
-181,144,151, 62, 21, 51,179, 62,156, 83,135, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,128, 62, 89,162,115, 62,147, 92,147, 62,252, 76,120, 62,247,168,136, 62,  3,102,144, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,247,168,136, 62,  3,102,144, 62, 18,174,110, 62,
-  3,102,144, 62,  0,  0,128, 62, 89,162,115, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,217, 70, 89, 62,252, 76,120, 62,  0,  0,128, 62, 89,162,115, 62, 18,174,110, 62,  3,102,144, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 18,174,110, 62,  3,102,144, 62,247,168,136, 62,
-  3,102,144, 62,  0,  0,128, 62,206,199,165, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,128, 62, 89,162,115, 62,217, 70, 89, 62,252, 76,120, 62, 30,130,104, 62,230,176, 70, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 30,130,104, 62,230,176, 70, 62,241,190,139, 62,
-230,176, 70, 62,  0,  0,128, 62, 89,162,115, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,147, 92,147, 62,252, 76,120, 62,  0,  0,128, 62, 89,162,115, 62,241,190,139, 62,230,176, 70, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,241,190,139, 62,230,176, 70, 62, 30,130,104, 62,
-230,176, 70, 62,  0,  0,128, 62,208, 31, 23, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 41,187,155, 62,205,253, 30, 62, 21, 51,179, 62,101,111, 52, 62,102, 23,161, 62,115, 97, 83, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,102, 23,161, 62,115, 97, 83, 62,241,190,139, 62,
-230,176, 70, 62, 41,187,155, 62,205,253, 30, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,128, 62,208, 31, 23, 62, 41,187,155, 62,205,253, 30, 62,241,190,139, 62,230,176, 70, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,241,190,139, 62,230,176, 70, 62,102, 23,161, 62,
-115, 97, 83, 62,147, 92,147, 62,252, 76,120, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,174,137, 72, 62,205,253, 30, 62,  0,  0,128, 62,208, 31, 23, 62, 30,130,104, 62,230,176, 70, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 30,130,104, 62,230,176, 70, 62, 51,209, 61, 62,
-115, 97, 83, 62,174,137, 72, 62,205,253, 30, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,214,153, 25, 62,106,111, 52, 62,174,137, 72, 62,205,253, 30, 62, 51,209, 61, 62,115, 97, 83, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 51,209, 61, 62,115, 97, 83, 62, 30,130,104, 62,
-230,176, 70, 62,217, 70, 89, 62,252, 76,120, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,255,255,127, 62,141, 41,147, 61,215,153, 25, 62,104,111,180, 61,224,153, 25, 62,225, 64, 52, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,224,153, 25, 62,225, 64, 52, 61, 15, 51,179, 62,
-225, 64, 52, 61,255,255,127, 62,141, 41,147, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 20, 51,179, 62,104,111,180, 61,255,255,127, 62,141, 41,147, 61, 15, 51,179, 62,225, 64, 52, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 15, 51,179, 62,225, 64, 52, 61,224,153, 25, 62,
-225, 64, 52, 61,144,175,161, 62,102,  9,239,178,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,255,255,127, 62,141, 41,147, 61, 20, 51,179, 62,104,111,180, 61, 12, 52,147, 62,109, 46,231, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 12, 52,147, 62,109, 46,231, 61,231,151, 89, 62,
-109, 46,231, 61,255,255,127, 62,141, 41,147, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,215,153, 25, 62,104,111,180, 61,255,255,127, 62,141, 41,147, 61,231,151, 89, 62,109, 46,231, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,231,151, 89, 62,109, 46,231, 61, 12, 52,147, 62,
-109, 46,231, 61,  0,  0,128, 62,208, 31, 23, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,174,137, 72, 62,205,253, 30, 62,214,153, 25, 62,106,111, 52, 62,217,153, 25, 62,204, 70,  7, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,217,153, 25, 62,204, 70,  7, 62,231,151, 89, 62,
-109, 46,231, 61,174,137, 72, 62,205,253, 30, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,128, 62,208, 31, 23, 62,174,137, 72, 62,205,253, 30, 62,231,151, 89, 62,109, 46,231, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,231,151, 89, 62,109, 46,231, 61,217,153, 25, 62,
-204, 70,  7, 62,215,153, 25, 62,104,111,180, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 41,187,155, 62,205,253, 30, 62,  0,  0,128, 62,208, 31, 23, 62, 12, 52,147, 62,109, 46,231, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 12, 52,147, 62,109, 46,231, 61, 19, 51,179, 62,
-204, 70,  7, 62, 41,187,155, 62,205,253, 30, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 21, 51,179, 62,101,111, 52, 62, 41,187,155, 62,205,253, 30, 62, 19, 51,179, 62,204, 70,  7, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 19, 51,179, 62,204, 70,  7, 62, 12, 52,147, 62,
-109, 46,231, 61, 20, 51,179, 62,104,111,180, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,192, 95, 56, 62, 79, 45,128, 62,214,153, 25, 62,156, 83,135, 62,212,153, 25, 62,  2,152, 97, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,212,153, 25, 62,  2,152, 97, 62, 51,209, 61, 62,
-115, 97, 83, 62,192, 95, 56, 62, 79, 45,128, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,217, 70, 89, 62,252, 76,120, 62,192, 95, 56, 62, 79, 45,128, 62, 51,209, 61, 62,115, 97, 83, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 51,209, 61, 62,115, 97, 83, 62,212,153, 25, 62,
-  2,152, 97, 62,214,153, 25, 62,106,111, 52, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,192, 95, 56, 62, 79, 45,128, 62,217, 70, 89, 62,252, 76,120, 62,245,154, 81, 62, 29,201,146, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,245,154, 81, 62, 29,201,146, 62,125,120, 52, 62,
-181,144,151, 62,192, 95, 56, 62, 79, 45,128, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,214,153, 25, 62,156, 83,135, 62,192, 95, 56, 62, 79, 45,128, 62,125,120, 52, 62,181,144,151, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,125,120, 52, 62,181,144,151, 62,245,154, 81, 62,
- 29,201,146, 62,239,120, 75, 62, 70,150,169, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,213, 14, 50, 62, 78, 54,174, 62,214,153, 25, 62,165,111,180, 62,213,153, 25, 62,100,231,157, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,213,153, 25, 62,100,231,157, 62,125,120, 52, 62,
-181,144,151, 62,213, 14, 50, 62, 78, 54,174, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,239,120, 75, 62, 70,150,169, 62,213, 14, 50, 62, 78, 54,174, 62,125,120, 52, 62,181,144,151, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,125,120, 52, 62,181,144,151, 62,213,153, 25, 62,
-100,231,157, 62,214,153, 25, 62,156, 83,135, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 91,133,101, 62,112,190,166, 62,239,120, 75, 62, 70,150,169, 62,245,154, 81, 62, 29,201,146, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,245,154, 81, 62, 29,201,146, 62, 18,174,110, 62,
-  3,102,144, 62, 91,133,101, 62,112,190,166, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,128, 62,206,199,165, 62, 91,133,101, 62,112,190,166, 62, 18,174,110, 62,  3,102,144, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 18,174,110, 62,  3,102,144, 62,245,154, 81, 62,
- 29,201,146, 62,217, 70, 89, 62,252, 76,120, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 64, 27,  5, 63, 66, 45,128, 62,232,194,249, 62,216, 76,120, 62,226,190,  3, 63, 90, 97, 83, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,226,190,  3, 63, 90, 97, 83, 62,191,204, 12, 63,
-248,151, 97, 62, 64, 27,  5, 63, 66, 45,128, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,191,204, 12, 63,149, 83,135, 62, 64, 27,  5, 63, 66, 45,128, 62,191,204, 12, 63,248,151, 97, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,191,204, 12, 63,248,151, 97, 62,226,190,  3, 63,
- 90, 97, 83, 62,191,204, 12, 63, 90,111, 52, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 64, 27,  5, 63, 66, 45,128, 62,191,204, 12, 63,149, 83,135, 62, 17, 21,  6, 63,169,144,151, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 17, 21,  6, 63,169,144,151, 62,222,152,253, 62,
- 14,201,146, 62, 64, 27,  5, 63, 66, 45,128, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,232,194,249, 62,216, 76,120, 62, 64, 27,  5, 63, 66, 45,128, 62,222,152,253, 62, 14,201,146, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,222,152,253, 62, 14,201,146, 62, 17, 21,  6, 63,
-169,144,151, 62,241, 84,  0, 63, 52,150,169, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,164,163,243, 62, 89,190,166, 62, 72,102,230, 62,183,199,165, 62, 70, 15,239, 62,233,101,144, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 70, 15,239, 62,233,101,144, 62,222,152,253, 62,
- 14,201,146, 62,164,163,243, 62, 89,190,166, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,241, 84,  0, 63, 52,150,169, 62,164,163,243, 62, 89,190,166, 62,222,152,253, 62, 14,201,146, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,222,152,253, 62, 14,201,146, 62, 70, 15,239, 62,
-233,101,144, 62,232,194,249, 62,216, 76,120, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,123,175,  6, 63, 65, 54,174, 62,241, 84,  0, 63, 52,150,169, 62, 17, 21,  6, 63,169,144,151, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 17, 21,  6, 63,169,144,151, 62,191,204, 12, 63,
- 90,231,157, 62,123,175,  6, 63, 65, 54,174, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,191,204, 12, 63,160,111,180, 62,123,175,  6, 63, 65, 54,174, 62,191,204, 12, 63, 90,231,157, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,191,204, 12, 63, 90,231,157, 62, 17, 21,  6, 63,
-169,144,151, 62,191,204, 12, 63,149, 83,135, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 72,102,230, 62, 53,162,115, 62,232,194,249, 62,216, 76,120, 62, 70, 15,239, 62,233,101,144, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 70, 15,239, 62,233,101,144, 62, 75,189,221, 62,
-238,101,144, 62, 72,102,230, 62, 53,162,115, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,168,  9,211, 62,222, 76,120, 62, 72,102,230, 62, 53,162,115, 62, 75,189,221, 62,238,101,144, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 75,189,221, 62,238,101,144, 62, 70, 15,239, 62,
-233,101,144, 62, 72,102,230, 62,183,199,165, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 72,102,230, 62, 53,162,115, 62,168,  9,211, 62,222, 76,120, 62, 80,167,218, 62,194,176, 70, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 80,167,218, 62,194,176, 70, 62, 68, 37,242, 62,
-194,176, 70, 62, 72,102,230, 62, 53,162,115, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,232,194,249, 62,216, 76,120, 62, 72,102,230, 62, 53,162,115, 62, 68, 37,242, 62,194,176, 70, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 68, 37,242, 62,194,176, 70, 62, 80,167,218, 62,
-194,176, 70, 62, 72,102,230, 62,168, 31, 23, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,197, 16,  1, 63,174,253, 30, 62,191,204, 12, 63, 90,111, 52, 62,226,190,  3, 63, 90, 97, 83, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,226,190,  3, 63, 90, 97, 83, 62, 68, 37,242, 62,
-194,176, 70, 62,197, 16,  1, 63,174,253, 30, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 72,102,230, 62,168, 31, 23, 62,197, 16,  1, 63,174,253, 30, 62, 68, 37,242, 62,194,176, 70, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 68, 37,242, 62,194,176, 70, 62,226,190,  3, 63,
- 90, 97, 83, 62,232,194,249, 62,216, 76,120, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 14,171,202, 62,179,253, 30, 62, 72,102,230, 62,168, 31, 23, 62, 80,167,218, 62,194,176, 70, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 80,167,218, 62,194,176, 70, 62,205, 78,197, 62,
- 95, 97, 83, 62, 14,171,202, 62,179,253, 30, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 21, 51,179, 62,101,111, 52, 62, 14,171,202, 62,179,253, 30, 62,205, 78,197, 62, 95, 97, 83, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,205, 78,197, 62, 95, 97, 83, 62, 80,167,218, 62,
-194,176, 70, 62,168,  9,211, 62,222, 76,120, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 63,102,230, 62,101, 41,147, 61, 20, 51,179, 62,104,111,180, 61, 15, 51,179, 62,225, 64, 52, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 15, 51,179, 62,225, 64, 52, 61,189,204, 12, 63,
-225, 64, 52, 61, 63,102,230, 62,101, 41,147, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,191,204, 12, 63, 83,111,180, 61, 63,102,230, 62,101, 41,147, 61,189,204, 12, 63,225, 64, 52, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,189,204, 12, 63,225, 64, 52, 61, 15, 51,179, 62,
-225, 64, 52, 61,144,175,161, 62,102,  9,239,178,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 63,102,230, 62,101, 41,147, 61,191,204, 12, 63, 83,111,180, 61,104,154,249, 62, 48, 46,231, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,104,154,249, 62, 48, 46,231, 61, 42, 50,211, 62,
- 48, 46,231, 61, 63,102,230, 62,101, 41,147, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 20, 51,179, 62,104,111,180, 61, 63,102,230, 62,101, 41,147, 61, 42, 50,211, 62, 48, 46,231, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 42, 50,211, 62, 48, 46,231, 61,104,154,249, 62,
- 48, 46,231, 61, 72,102,230, 62,168, 31, 23, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 14,171,202, 62,179,253, 30, 62, 21, 51,179, 62,101,111, 52, 62, 19, 51,179, 62,204, 70,  7, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 19, 51,179, 62,204, 70,  7, 62, 42, 50,211, 62,
- 48, 46,231, 61, 14,171,202, 62,179,253, 30, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 72,102,230, 62,168, 31, 23, 62, 14,171,202, 62,179,253, 30, 62, 42, 50,211, 62, 48, 46,231, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 42, 50,211, 62, 48, 46,231, 61, 19, 51,179, 62,
-204, 70,  7, 62, 20, 51,179, 62,104,111,180, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,197, 16,  1, 63,174,253, 30, 62, 72,102,230, 62,168, 31, 23, 62,104,154,249, 62, 48, 46,231, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,104,154,249, 62, 48, 46,231, 61,191,204, 12, 63,
-199, 70,  7, 62,197, 16,  1, 63,174,253, 30, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,191,204, 12, 63, 90,111, 52, 62,197, 16,  1, 63,174,253, 30, 62,191,204, 12, 63,199, 70,  7, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,191,204, 12, 63,199, 70,  7, 62,104,154,249, 62,
- 48, 46,231, 61,191,204, 12, 63, 83,111,180, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 19,150,194, 62, 72, 45,128, 62, 21, 51,179, 62,156, 83,135, 62, 22, 51,179, 62,  2,152, 97, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 22, 51,179, 62,  2,152, 97, 62,205, 78,197, 62,
- 95, 97, 83, 62, 19,150,194, 62, 72, 45,128, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,168,  9,211, 62,222, 76,120, 62, 19,150,194, 62, 72, 45,128, 62,205, 78,197, 62, 95, 97, 83, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,205, 78,197, 62, 95, 97, 83, 62, 22, 51,179, 62,
-  2,152, 97, 62, 21, 51,179, 62,101,111, 52, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 19,150,194, 62, 72, 45,128, 62,168,  9,211, 62,222, 76,120, 62,179, 51,207, 62, 17,201,146, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,179, 51,207, 62, 17,201,146, 62,113,162,192, 62,
-174,144,151, 62, 19,150,194, 62, 72, 45,128, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 21, 51,179, 62,156, 83,135, 62, 19,150,194, 62, 72, 45,128, 62,113,162,192, 62,174,144,151, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,113,162,192, 62,174,144,151, 62,179, 51,207, 62,
- 17,201,146, 62,175, 34,204, 62, 54,150,169, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,154,109,191, 62, 68, 54,174, 62, 21, 51,179, 62,165,111,180, 62, 21, 51,179, 62, 98,231,157, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 21, 51,179, 62, 98,231,157, 62,113,162,192, 62,
-174,144,151, 62,154,109,191, 62, 68, 54,174, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,175, 34,204, 62, 54,150,169, 62,154,109,191, 62, 68, 54,174, 62,113,162,192, 62,174,144,151, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,113,162,192, 62,174,144,151, 62, 21, 51,179, 62,
- 98,231,157, 62, 21, 51,179, 62,156, 83,135, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,237, 40,217, 62, 91,190,166, 62,175, 34,204, 62, 54,150,169, 62,179, 51,207, 62, 17,201,146, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,179, 51,207, 62, 17,201,146, 62, 75,189,221, 62,
-238,101,144, 62,237, 40,217, 62, 91,190,166, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 72,102,230, 62,183,199,165, 62,237, 40,217, 62, 91,190,166, 62, 75,189,221, 62,238,101,144, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 75,189,221, 62,238,101,144, 62,179, 51,207, 62,
- 17,201,146, 62,168,  9,211, 62,222, 76,120, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,134, 78, 56, 63,117, 45,128, 62,188, 20, 48, 63, 37, 77,120, 62, 42,242, 54, 63,181, 97, 83, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 42,242, 54, 63,181, 97, 83, 62,  0,  0, 64, 63,
-115,152, 97, 62,134, 78, 56, 63,117, 45,128, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0, 64, 63,218, 83,135, 62,134, 78, 56, 63,117, 45,128, 62,  0,  0, 64, 63,115,152, 97, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0, 64, 63,115,152, 97, 62, 42,242, 54, 63,
-181, 97, 83, 62,  0,  0, 64, 63,202,111, 52, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,134, 78, 56, 63,117, 45,128, 62,  0,  0, 64, 63,218, 83,135, 62, 87, 72, 57, 63,219,144,151, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 87, 72, 57, 63,219,144,151, 62,184,255, 49, 63,
- 52,201,146, 62,134, 78, 56, 63,117, 45,128, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,188, 20, 48, 63, 37, 77,120, 62,134, 78, 56, 63,117, 45,128, 62,184,255, 49, 63, 52,201,146, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,184,255, 49, 63, 52,201,146, 62, 87, 72, 57, 63,
-219,144,151, 62, 58,136, 51, 63, 90,150,169, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 26,  5, 45, 63,117,190,166, 62,107,102, 38, 63,201,199,165, 62,235,186, 42, 63,  5,102,144, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,235,186, 42, 63,  5,102,144, 62,184,255, 49, 63,
- 52,201,146, 62, 26,  5, 45, 63,117,190,166, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 58,136, 51, 63, 90,150,169, 62, 26,  5, 45, 63,117,190,166, 62,184,255, 49, 63, 52,201,146, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,184,255, 49, 63, 52,201,146, 62,235,186, 42, 63,
-  5,102,144, 62,188, 20, 48, 63, 37, 77,120, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,196,226, 57, 63,114, 54,174, 62, 58,136, 51, 63, 90,150,169, 62, 87, 72, 57, 63,219,144,151, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 87, 72, 57, 63,219,144,151, 62,  0,  0, 64, 63,
-162,231,157, 62,196,226, 57, 63,114, 54,174, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0, 64, 63,211,111,180, 62,196,226, 57, 63,114, 54,174, 62,  0,  0, 64, 63,162,231,157, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0, 64, 63,162,231,157, 62, 87, 72, 57, 63,
-219,144,151, 62,  0,  0, 64, 63,218, 83,135, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,107,102, 38, 63, 79,162,115, 62,188, 20, 48, 63, 37, 77,120, 62,235,186, 42, 63,  5,102,144, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,235,186, 42, 63,  5,102,144, 62,234, 17, 34, 63,
-243,101,144, 62,107,102, 38, 63, 79,162,115, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 21,184, 28, 63,222, 76,120, 62,107,102, 38, 63, 79,162,115, 62,234, 17, 34, 63,243,101,144, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,234, 17, 34, 63,243,101,144, 62,235,186, 42, 63,
-  5,102,144, 62,107,102, 38, 63,201,199,165, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,107,102, 38, 63, 79,162,115, 62, 21,184, 28, 63,222, 76,120, 62,234,134, 32, 63,204,176, 70, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,234,134, 32, 63,204,176, 70, 62,233, 69, 44, 63,
-245,176, 70, 62,107,102, 38, 63, 79,162,115, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,188, 20, 48, 63, 37, 77,120, 62,107,102, 38, 63, 79,162,115, 62,233, 69, 44, 63,245,176, 70, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,233, 69, 44, 63,245,176, 70, 62,234,134, 32, 63,
-204,176, 70, 62,104,102, 38, 63,198, 31, 23, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  9, 68, 52, 63,241,253, 30, 62,  0,  0, 64, 63,202,111, 52, 62, 42,242, 54, 63,181, 97, 83, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 42,242, 54, 63,181, 97, 83, 62,233, 69, 44, 63,
-245,176, 70, 62,  9, 68, 52, 63,241,253, 30, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,104,102, 38, 63,198, 31, 23, 62,  9, 68, 52, 63,241,253, 30, 62,233, 69, 44, 63,245,176, 70, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,233, 69, 44, 63,245,176, 70, 62, 42,242, 54, 63,
-181, 97, 83, 62,188, 20, 48, 63, 37, 77,120, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,195,136, 24, 63,179,253, 30, 62,104,102, 38, 63,198, 31, 23, 62,234,134, 32, 63,204,176, 70, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,234,134, 32, 63,204,176, 70, 62,162,218, 21, 63,
- 84, 97, 83, 62,195,136, 24, 63,179,253, 30, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,191,204, 12, 63, 90,111, 52, 62,195,136, 24, 63,179,253, 30, 62,162,218, 21, 63, 84, 97, 83, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,162,218, 21, 63, 84, 97, 83, 62,234,134, 32, 63,
-204,176, 70, 62, 21,184, 28, 63,222, 76,120, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,104,102, 38, 63,111, 41,147, 61,191,204, 12, 63, 83,111,180, 61,189,204, 12, 63,225, 64, 52, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,189,204, 12, 63,225, 64, 52, 61,  0,  0, 64, 63,
-111, 65, 52, 61,104,102, 38, 63,111, 41,147, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0, 64, 63,195,111,180, 61,104,102, 38, 63,111, 41,147, 61,  0,  0, 64, 63,111, 65, 52, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0, 64, 63,111, 65, 52, 61,189,204, 12, 63,
-225, 64, 52, 61,208,222,121, 63,102,  9,239,178,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,104,102, 38, 63,111, 41,147, 61,  0,  0, 64, 63,195,111,180, 61,122,  0, 48, 63,120, 46,231, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,122,  0, 48, 63,120, 46,231, 61, 85,204, 28, 63,
- 48, 46,231, 61,104,102, 38, 63,111, 41,147, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,191,204, 12, 63, 83,111,180, 61,104,102, 38, 63,111, 41,147, 61, 85,204, 28, 63, 48, 46,231, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 85,204, 28, 63, 48, 46,231, 61,122,  0, 48, 63,
-120, 46,231, 61,104,102, 38, 63,198, 31, 23, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,195,136, 24, 63,179,253, 30, 62,191,204, 12, 63, 90,111, 52, 62,191,204, 12, 63,199, 70,  7, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,191,204, 12, 63,199, 70,  7, 62, 85,204, 28, 63,
- 48, 46,231, 61,195,136, 24, 63,179,253, 30, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,104,102, 38, 63,198, 31, 23, 62,195,136, 24, 63,179,253, 30, 62, 85,204, 28, 63, 48, 46,231, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 85,204, 28, 63, 48, 46,231, 61,191,204, 12, 63,
-199, 70,  7, 62,191,204, 12, 63, 83,111,180, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  9, 68, 52, 63,241,253, 30, 62,104,102, 38, 63,198, 31, 23, 62,122,  0, 48, 63,120, 46,231, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,122,  0, 48, 63,120, 46,231, 61,  0,  0, 64, 63,
- 24, 71,  7, 62,  9, 68, 52, 63,241,253, 30, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0, 64, 63,202,111, 52, 62,  9, 68, 52, 63,241,253, 30, 62,  0,  0, 64, 63, 24, 71,  7, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0, 64, 63, 24, 71,  7, 62,122,  0, 48, 63,
-120, 46,231, 61,  0,  0, 64, 63,195,111,180, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 68,126, 20, 63, 64, 45,128, 62,191,204, 12, 63,149, 83,135, 62,191,204, 12, 63,248,151, 97, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,191,204, 12, 63,248,151, 97, 62,162,218, 21, 63,
- 84, 97, 83, 62, 68,126, 20, 63, 64, 45,128, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 21,184, 28, 63,222, 76,120, 62, 68,126, 20, 63, 64, 45,128, 62,162,218, 21, 63, 84, 97, 83, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,162,218, 21, 63, 84, 97, 83, 62,191,204, 12, 63,
-248,151, 97, 62,191,204, 12, 63, 90,111, 52, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 68,126, 20, 63, 64, 45,128, 62, 21,184, 28, 63,222, 76,120, 62, 25,205, 26, 63, 14,201,146, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 25,205, 26, 63, 14,201,146, 62,114,132, 19, 63,
-169,144,151, 62, 68,126, 20, 63, 64, 45,128, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,191,204, 12, 63,149, 83,135, 62, 68,126, 20, 63, 64, 45,128, 62,114,132, 19, 63,169,144,151, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,114,132, 19, 63,169,144,151, 62, 25,205, 26, 63,
- 14,201,146, 62,150, 68, 25, 63, 54,150,169, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  7,234, 18, 63, 65, 54,174, 62,191,204, 12, 63,160,111,180, 62,191,204, 12, 63, 90,231,157, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,191,204, 12, 63, 90,231,157, 62,114,132, 19, 63,
-169,144,151, 62,  7,234, 18, 63, 65, 54,174, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,150, 68, 25, 63, 54,150,169, 62,  7,234, 18, 63, 65, 54,174, 62,114,132, 19, 63,169,144,151, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,114,132, 19, 63,169,144,151, 62,191,204, 12, 63,
- 90,231,157, 62,191,204, 12, 63,149, 83,135, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,185,199, 31, 63, 96,190,166, 62,150, 68, 25, 63, 54,150,169, 62, 25,205, 26, 63, 14,201,146, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 25,205, 26, 63, 14,201,146, 62,234, 17, 34, 63,
-243,101,144, 62,185,199, 31, 63, 96,190,166, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,107,102, 38, 63,201,199,165, 62,185,199, 31, 63, 96,190,166, 62,234, 17, 34, 63,243,101,144, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,234, 17, 34, 63,243,101,144, 62, 25,205, 26, 63,
- 14,201,146, 62, 21,184, 28, 63,222, 76,120, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,  0, 80,  0,  0,  8,112, 55,  3,  0,  0,  0,  0, 53,  0,  0,  0,  0, 20,  0,  0,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  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,  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,  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,  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,  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,  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,  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,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0,  8,130, 27,  4,  0,  0,  0,  0,
+ 53,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,  2,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0, 35,  0,
+  0,  0,  0,  0,  3,  0,  0,  0,  0,  0, 35,  0,  2,  0,  0,  0,  3,  0,  0,  0,  0,  0, 35,  0, 68, 65, 84, 65,  8,  2,  0,  0,
+248, 32, 27,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  0,  0,  0, 16,  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, 85, 86, 84,101,120,  0, 97, 99,101, 45, 86,101,114,116,101,120,
+  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,168, 35, 27,  4,  0,  0,  0,  0, 26,  0,  0,  0, 12,  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, 78, 71,111,110, 32, 70, 97, 99,
+101, 45, 86,101,114,116,101,120,  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,216, 29, 27,  4,  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,  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,
+  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,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0,
+168, 35, 27,  4,  0,  0,  0,  0, 61,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+ 68, 65, 84, 65, 32,  0,  0,  0,216, 29, 27,  4,  0,  0,  0,  0, 59,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,
+  3,  0,  0,  0,  3,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0, 68, 65, 84, 65,  8,  2,  0,  0,
+168, 30, 27,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  0,  0,  0, 15,  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, 85, 86, 84,101,120,  0, 97, 99,101,  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,  0,  0,  0,  0,  0, 72, 35, 27,  4,  0,  0,  0,  0, 25,  0,  0,  0, 16,  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, 78, 71,111,110, 32, 70, 97, 99,
+101,  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,  0,  0,  0,  0,  0, 72, 30, 27,  4,  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,  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,
+  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,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0,
+ 72, 35, 27,  4,  0,  0,  0,  0, 60,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 60,  0,  1,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 12,  0,  0,  0, 72, 30, 27,  4,  0,  0,  0,  0, 58,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,
+  0,  0,  2,  0, 77, 69,  0,  0,232,  4,  0,  0,168, 20,196,  4,  0,  0,  0,  0, 50,  0,  0,  0,  1,  0,  0,  0,200, 43,196,  4,
+  0,  0,  0,  0,  8,  8,196,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 69,112,108,
+ 97,110,101, 95, 99,104,101, 99,107,101,114,115,  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,  0,  0,
+  7,  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,  0,216, 25,196,  4,  0,  0,  0,  0,216, 17,196,  4,
+  0,  0,  0,  0, 88, 94, 27,  4,  0,  0,  0,  0,184, 89, 27,  4,  0,  0,  0,  0,168, 95, 27,  4,  0,  0,  0,  0,248, 98, 27,  4,
+  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,136, 28,196,  4,
+  0,  0,  0,  0, 24, 33,196,  4,  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,  0,  0, 56, 26,196,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,  1,  0,  0,  0,  5,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 30,196,  4,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,
+  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  1,  0,  0,  0,
+  5,  0,  0,  0, 12,  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,  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,  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,  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,104, 87, 27,  4,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  1,  0,  0,  0,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  2,  0,  0,  0,
+  5,  0,  0,  0, 28,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8, 92, 27,  4,
+  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,  0,  0,  0,  0,  1,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,  2,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,  3,  0,  0,  0,  5,  0,  0,  0, 24,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16,  0,  0,  0,
+ 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,205, 76, 63,172,197, 39, 55,214,204, 76, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0, 83,  0, 30,  0,  5,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0,216, 25,196,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,104,142, 26,  4,
+  0,  0,  0,  0, 88,120, 26,  4,  0,  0,  0,  0, 68, 65, 84, 65,  8,  2,  0,  0, 56, 26,196,  4,  0,  0,  0,  0,124,  1,  0,  0,
+  5,  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,  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,136, 28,196,  4,  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,  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,  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,  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,  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,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,244,  1,  0,  0,136, 28,196,  4,  0,  0,  0,  0, 56,  0,  0,  0,
+ 25,  0,  0,  0,  4,205, 76,191,  0,  0,  0,  0,208,204, 76,191,  0,  0,  2,128,  0,  0,  1,  0,  4,205, 76, 63,  0,  0,  0,  0,
+210,204, 76, 63,  0,  0,  1,128,  0,  0,  1,  0,  0,205, 76, 63,  0,  0,  0,  0,213,204,204, 62,  0,  0,  2,128,  0,  0,  1,  0,
+ 41,205,204, 62,174,148, 77,180,200,204,204,190,  0,  0,  1,128,  0,  0,  1,  0,254,204, 76, 63,176, 90, 19, 51,208,204,204,190,
+  0,  0,  1,128,  0,  0,  1,  0, 41,205,204, 62,174,148, 77,180,  0,  0,240, 52,  0,  0,  1,128,  0,  0,  1,  0,254,204, 76, 63,
+176, 90, 19, 51,  0,  0, 96, 52,  0,  0,  2,128,  0,  0,  1,  0, 41,205,204, 62,174,148, 77,180,221,204,204, 62,  0,  0,  1,128,
+  0,  0,  1,  0, 47,205,204, 62,174,148, 77,180,214,204, 76, 63,  0,  0,  1,128,  0,  0,  1,  0, 41,205,204, 62,174,148, 77,180,
+206,204, 76,191,  0,  0,  1,128,  0,  0,  1,  0,254,204, 76, 63,176, 90, 19, 51,208,204, 76,191,  0,  0,  1,128,  0,  0,  1,  0,
+  2,  0, 86,182,  3,  0,160, 52,214,204, 76,191,  0,  0,  1,128,  0,  0,  1,  0, 65,205,204,190, 91, 41,155, 51,212,204, 76,191,
+  0,  0,  1,128,  0,  0,  1,  0,  1,  0, 78,182,  3,  0,160, 52,206,204, 76, 63,  0,  0,  1,128,  0,  0,  1,  0, 57,205,204,190,
+ 90, 41,155, 51,206,204, 76, 63,  0,  0,  1,128,  0,  0,  1,  0, 10,205, 76,191,169, 82,182, 51,210,204, 76, 63,  0,  0,  1,128,
+  0,  0,  1,  0,  2,  0, 86,182,  3,  0,160, 52,197,204,204, 62,  0,  0,  1,128,  0,  0,  1,  0, 65,205,204,190, 91, 41,155, 51,
+205,204,204, 62,  0,  0,  2,128,  0,  0,  1,  0, 10,205, 76,191,169, 82,182, 51,213,204,204, 62,  0,  0,  1,128,  0,  0,  1,  0,
+  2,  0, 86,182,  3,  0,160, 52,  0,  0,144,180,  0,  0,  2,128,  0,  0,  1,  0, 65,205,204,190, 91, 41,155, 51,  0,  0,  0,179,
+  0,  0,  1,128,  0,  0,  1,  0, 10,205, 76,191,169, 82,182, 51,  0,  0, 96, 52,  0,  0,  1,128,  0,  0,  1,  0,  2,  0, 86,182,
+  3,  0,160, 52,224,204,204,190,  0,  0,  1,128,  0,  0,  1,  0, 65,205,204,190, 91, 41,155, 51,216,204,204,190,  0,  0,  2,128,
+  0,  0,  1,  0, 10,205, 76,191,169, 82,182, 51,208,204,204,190,  0,  0,  2,128,  0,  0,  1,  0, 68, 65, 84, 65,  8,  2,  0,  0,
+200, 30,196,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  0,  0,  0,  3,  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,  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, 24, 33,196,  4,  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,  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,  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,  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,  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,  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,
+  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,224,  1,  0,  0,
+ 24, 33,196,  4,  0,  0,  0,  0, 53,  0,  0,  0, 40,  0,  0,  0,  1,  0,  0,  0,  2,  0,  0,  0,  0,  0, 35,  0,  4,  0,  0,  0,
+ 10,  0,  0,  0,  0,  0, 35,  0,  3,  0,  0,  0,  9,  0,  0,  0,  0,  0, 35,  0,  3,  0,  0,  0,  4,  0,  0,  0,  0,  0, 35,  0,
+  3,  0,  0,  0,  5,  0,  0,  0,  0,  0, 35,  0,  5,  0,  0,  0,  6,  0,  0,  0,  0,  0, 35,  0,  5,  0,  0,  0,  7,  0,  0,  0,
+  0,  0, 35,  0,  7,  0,  0,  0,  8,  0,  0,  0,  0,  0, 35,  0,  9,  0,  0,  0, 10,  0,  0,  0,  0,  0, 35,  0, 11,  0,  0,  0,
+ 12,  0,  0,  0,  0,  0, 35,  0, 14,  0,  0,  0, 15,  0,  0,  0,  0,  0, 35,  0, 15,  0,  0,  0, 18,  0,  0,  0,  0,  0, 35,  0,
+ 17,  0,  0,  0, 18,  0,  0,  0,  0,  0, 35,  0, 14,  0,  0,  0, 17,  0,  0,  0,  0,  0, 35,  0, 16,  0,  0,  0, 17,  0,  0,  0,
+  0,  0, 35,  0, 13,  0,  0,  0, 16,  0,  0,  0,  0,  0, 35,  0, 20,  0,  0,  0, 21,  0,  0,  0,  0,  0, 35,  0, 17,  0,  0,  0,
+ 20,  0,  0,  0,  0,  0, 35,  0, 19,  0,  0,  0, 20,  0,  0,  0,  0,  0, 35,  0, 16,  0,  0,  0, 19,  0,  0,  0,  0,  0, 35,  0,
+ 21,  0,  0,  0, 24,  0,  0,  0,  0,  0, 35,  0, 23,  0,  0,  0, 24,  0,  0,  0,  0,  0, 35,  0, 20,  0,  0,  0, 23,  0,  0,  0,
+  0,  0, 35,  0, 22,  0,  0,  0, 23,  0,  0,  0,  0,  0, 35,  0, 19,  0,  0,  0, 22,  0,  0,  0,  0,  0, 35,  0, 12,  0,  0,  0,
+ 23,  0,  0,  0,  0,  0, 35,  0, 11,  0,  0,  0, 22,  0,  0,  0,  0,  0, 35,  0,  8,  0,  0,  0, 13,  0,  0,  0,  0,  0, 35,  0,
+  7,  0,  0,  0, 16,  0,  0,  0,  0,  0, 35,  0,  5,  0,  0,  0, 19,  0,  0,  0,  0,  0, 35,  0,  3,  0,  0,  0, 22,  0,  0,  0,
+  0,  0, 35,  0,  2,  0,  0,  0,  7,  0,  0,  0,  0,  0, 35,  0,  2,  0,  0,  0,  6,  0,  0,  0,  0,  0, 35,  0,  4,  0,  0,  0,
+  6,  0,  0,  0,  0,  0, 35,  0,  1,  0,  0,  0,  8,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0,  0, 12,  0,  0,  0,  0,  0, 35,  0,
+ 13,  0,  0,  0, 14,  0,  0,  0,  0,  0, 35,  0, 18,  0,  0,  0, 21,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0,  0, 24,  0,  0,  0,
+  0,  0, 35,  0,  9,  0,  0,  0, 11,  0,  0,  0,  0,  0, 35,  0, 68, 65, 84, 65,  8,  2,  0,  0,  8, 92, 27,  4,  0,  0,  0,  0,
+124,  1,  0,  0,  5,  0,  0,  0, 16,  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, 85, 86, 84,101,120,  0, 97, 99,101, 45, 86,101,114,116,101,120,  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,168, 95, 27,  4,  0,  0,  0,  0, 17,  0,  0,  0, 12,  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, 67,111,108,  0, 32, 70, 97, 99,101, 45, 86,101,114,116,101,120,
+  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,248, 98, 27,  4,  0,  0,  0,  0, 26,  0,  0,  0, 16,  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, 78, 71,111,110, 32, 70, 97, 99,
+101, 45, 86,101,114,116,101,120,  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,184, 89, 27,  4,  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,  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,
+  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  0,  3,  0,  0,168, 95, 27,  4,  0,  0,  0,  0,
+ 61,  0,  0,  0, 64,  0,  0,  0,144,108,246, 61,162,226,125, 63,  0,  0,  0,  0, 12,192,137, 62,162,226,125, 63,  0,  0,  0,  0,
+ 12,192,137, 62,162,226,125, 63,  0,  0,  0,  0,144,108,246, 61,162,226,125, 63,  0,  0,  0,  0,252,228,213, 62,162,226,125, 63,
+  0,  0,  0,  0, 12,192,137, 62,162,226,125, 63,  0,  0,  0,  0, 12,192,137, 62,162,226,125, 63,  0,  0,  0,  0,252,228,213, 62,
+162,226,125, 63,  0,  0,  0,  0, 12,192,137, 62,162,226,125, 63,  0,  0,  0,  0,144,108,246, 61,162,226,125, 63,  0,  0,  0,  0,
+144,108,246, 61,162,226,125, 63,  0,  0,  0,  0, 12,192,137, 62,162,226,125, 63,  0,  0,  0,  0,  0,229,213, 62,162,226,125, 63,
+  0,  0,  0,  0, 18,192,137, 62,162,226,125, 63,  0,  0,  0,  0, 12,192,137, 62,162,226,125, 63,  0,  0,  0,  0,252,228,213, 62,
+162,226,125, 63,  0,  0,  0,  0,154, 23, 55, 63,162,226,125, 63,  0,  0,  0,  0, 34,  5, 17, 63,162,226,125, 63,  0,  0,  0,  0,
+ 30,  5, 17, 63,162,226,125, 63,  0,  0,  0,  0,152, 23, 55, 63,162,226,125, 63,  0,  0,  0,  0, 30,  5, 17, 63,162,226,125, 63,
+  0,  0,  0,  0,252,228,213, 62,162,226,125, 63,  0,  0,  0,  0,252,228,213, 62,162,226,125, 63,  0,  0,  0,  0, 30,  5, 17, 63,
+162,226,125, 63,  0,  0,  0,  0, 30,  5, 17, 63,162,226,125, 63,  0,  0,  0,  0,152, 23, 55, 63,162,226,125, 63,  0,  0,  0,  0,
+152, 23, 55, 63,162,226,125, 63,  0,  0,  0,  0, 30,  5, 17, 63,162,226,125, 63,  0,  0,  0,  0, 30,  5, 17, 63,162,226,125, 63,
+  0,  0,  0,  0,252,228,213, 62,162,226,125, 63,  0,  0,  0,  0,252,228,213, 62,162,226,125, 63,  0,  0,  0,  0, 30,  5, 17, 63,
+162,226,125, 63,  0,  0,  0,  0,152, 23, 55, 63,162,226,125, 63,  0,  0,  0,  0, 30,  5, 17, 63,162,226,125, 63,  0,  0,  0,  0,
+ 30,  5, 17, 63,162,226,125, 63,  0,  0,  0,  0,152, 23, 55, 63,162,226,125, 63,  0,  0,  0,  0,252,228,213, 62,162,226,125, 63,
+  0,  0,  0,  0, 30,  5, 17, 63,162,226,125, 63,  0,  0,  0,  0, 30,  5, 17, 63,162,226,125, 63,  0,  0,  0,  0,252,228,213, 62,
+162,226,125, 63,  0,  0,  0,  0,152, 23, 55, 63,162,226,125, 63,  0,  0,  0,  0, 30,  5, 17, 63,162,226,125, 63,  0,  0,  0,  0,
+ 30,  5, 17, 63,162,226,125, 63,  0,  0,  0,  0,152, 23, 55, 63,162,226,125, 63,  0,  0,  0,  0, 34,  5, 17, 63,162,226,125, 63,
+  0,  0,  0,  0,  0,229,213, 62,162,226,125, 63,  0,  0,  0,  0,252,228,213, 62,162,226,125, 63,  0,  0,  0,  0, 30,  5, 17, 63,
+162,226,125, 63,  0,  0,  0,  0, 18,192,137, 62,162,226,125, 63,  0,  0,  0,  0,144,108,246, 61,162,226,125, 63,  0,  0,  0,  0,
+144,108,246, 61,162,226,125, 63,  0,  0,  0,  0, 12,192,137, 62,162,226,125, 63,  0,  0,  0,  0,252,228,213, 62,162,226,125, 63,
+  0,  0,  0,  0, 12,192,137, 62,162,226,125, 63,  0,  0,  0,  0, 12,192,137, 62,162,226,125, 63,  0,  0,  0,  0,252,228,213, 62,
+162,226,125, 63,  0,  0,  0,  0, 12,192,137, 62,162,226,125, 63,  0,  0,  0,  0,144,108,246, 61,162,226,125, 63,  0,  0,  0,  0,
+144,108,246, 61,162,226,125, 63,  0,  0,  0,  0, 12,192,137, 62,162,226,125, 63,  0,  0,  0,  0,252,228,213, 62,162,226,125, 63,
+  0,  0,  0,  0, 12,192,137, 62,162,226,125, 63,  0,  0,  0,  0, 12,192,137, 62,162,226,125, 63,  0,  0,  0,  0,252,228,213, 62,
+162,226,125, 63,  0,  0,  0,  0, 68, 65, 84, 65,  0,  1,  0,  0,248, 98, 27,  4,  0,  0,  0,  0, 62,  0,  0,  0, 64,  0,  0,  0,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
@@ -12782,13 +10002,2712 @@ char datatoc_preview_blend[]= {
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+ 68, 65, 84, 65,  0,  2,  0,  0,184, 89, 27,  4,  0,  0,  0,  0, 59,  0,  0,  0, 64,  0,  0,  0,  0,  0,  0,  0, 35,  0,  0,  0,
+ 12,  0,  0,  0, 25,  0,  0,  0, 23,  0,  0,  0, 21,  0,  0,  0, 24,  0,  0,  0, 38,  0,  0,  0, 19,  0,  0,  0, 18,  0,  0,  0,
+ 20,  0,  0,  0, 22,  0,  0,  0, 23,  0,  0,  0, 23,  0,  0,  0, 22,  0,  0,  0, 24,  0,  0,  0, 17,  0,  0,  0, 12,  0,  0,  0,
+ 18,  0,  0,  0, 37,  0,  0,  0, 21,  0,  0,  0, 16,  0,  0,  0, 20,  0,  0,  0, 17,  0,  0,  0, 13,  0,  0,  0, 36,  0,  0,  0,
+ 14,  0,  0,  0, 13,  0,  0,  0, 17,  0,  0,  0, 14,  0,  0,  0, 16,  0,  0,  0, 15,  0,  0,  0,  1,  0,  0,  0, 34,  0,  0,  0,
+  8,  0,  0,  0,  7,  0,  0,  0,  7,  0,  0,  0, 31,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  7,  0,  0,  0, 28,  0,  0,  0,
+ 16,  0,  0,  0, 19,  0,  0,  0, 19,  0,  0,  0, 29,  0,  0,  0,  5,  0,  0,  0,  6,  0,  0,  0,  3,  0,  0,  0,  3,  0,  0,  0,
+  4,  0,  0,  0, 33,  0,  0,  0,  6,  0,  0,  0,  5,  0,  0,  0,  5,  0,  0,  0,  4,  0,  0,  0,  3,  0,  0,  0, 30,  0,  0,  0,
+ 22,  0,  0,  0, 26,  0,  0,  0, 11,  0,  0,  0, 39,  0,  0,  0,  9,  0,  0,  0,  2,  0,  0,  0,  4,  0,  0,  0,  3,  0,  0,  0,
+  3,  0,  0,  0,  2,  0,  0,  0,  9,  0,  0,  0,  8,  0,  0,  0, 10,  0,  0,  0,  1,  0,  0,  0, 22,  0,  0,  0, 30,  0,  0,  0,
+  3,  0,  0,  0,  4,  0,  0,  0,  5,  0,  0,  0, 29,  0,  0,  0, 19,  0,  0,  0, 24,  0,  0,  0,  2,  0,  0,  0, 31,  0,  0,  0,
+  7,  0,  0,  0,  6,  0,  0,  0,  5,  0,  0,  0,  5,  0,  0,  0,  6,  0,  0,  0, 32,  0,  0,  0,  8,  0,  0,  0, 27,  0,  0,  0,
+ 13,  0,  0,  0, 15,  0,  0,  0, 16,  0,  0,  0, 28,  0,  0,  0,  7,  0,  0,  0,  7,  0,  0,  0, 14,  0,  0,  0, 10,  0,  0,  0,
+ 15,  0,  0,  0, 11,  0,  0,  0, 18,  0,  0,  0, 12,  0,  0,  0, 17,  0,  0,  0, 13,  0,  0,  0, 16,  0,  0,  0, 14,  0,  0,  0,
+ 17,  0,  0,  0, 17,  0,  0,  0, 20,  0,  0,  0, 18,  0,  0,  0, 19,  0,  0,  0, 19,  0,  0,  0, 20,  0,  0,  0, 16,  0,  0,  0,
+ 21,  0,  0,  0, 20,  0,  0,  0, 24,  0,  0,  0, 21,  0,  0,  0, 23,  0,  0,  0, 22,  0,  0,  0, 22,  0,  0,  0, 23,  0,  0,  0,
+ 23,  0,  0,  0, 25,  0,  0,  0, 12,  0,  0,  0,  9,  0,  0,  0, 11,  0,  0,  0, 26,  0,  0,  0, 68, 65, 84, 65,  8,  2,  0,  0,
+104, 87, 27,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  0,  0,  0, 15,  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, 85, 86, 84,101,120,  0, 97, 99,101,  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,  0,  0,  0,  0,  0, 88, 94, 27,  4,  0,  0,  0,  0, 25,  0,  0,  0, 16,  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, 78, 71,111,110, 32, 70, 97, 99,
+101,  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,  0,  0,  0,  0,  0,216, 17,196,  4,  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,  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,
+  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,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  0,  1,  0,  0,
+ 88, 94, 27,  4,  0,  0,  0,  0, 60,  0,  0,  0, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 61,  0,  1,  0,  0,  0,  0,  0, 68, 65, 84, 65,192,  0,  0,  0,216, 17,196,  4,  0,  0,  0,  0,
+ 58,  0,  0,  0, 16,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  2,  0,  4,  0,  0,  0,  4,  0,  0,  0,  0,  0,  2,  0,
+  8,  0,  0,  0,  4,  0,  0,  0,  0,  0,  2,  0, 12,  0,  0,  0,  4,  0,  0,  0,  0,  0,  2,  0, 16,  0,  0,  0,  4,  0,  0,  0,
+  0,  0,  2,  0, 20,  0,  0,  0,  4,  0,  0,  0,  0,  0,  2,  0, 24,  0,  0,  0,  4,  0,  0,  0,  0,  0,  2,  0, 28,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  2,  0, 32,  0,  0,  0,  4,  0,  0,  0,  1,  0,  2,  0, 36,  0,  0,  0,  4,  0,  0,  0,  1,  0,  2,  0,
+ 40,  0,  0,  0,  4,  0,  0,  0,  1,  0,  2,  0, 44,  0,  0,  0,  4,  0,  0,  0,  1,  0,  2,  0, 48,  0,  0,  0,  4,  0,  0,  0,
+  1,  0,  2,  0, 52,  0,  0,  0,  4,  0,  0,  0,  1,  0,  2,  0, 56,  0,  0,  0,  4,  0,  0,  0,  1,  0,  2,  0, 60,  0,  0,  0,
+  4,  0,  0,  0,  1,  0,  2,  0, 77, 69,  0,  0,232,  4,  0,  0,200, 43,196,  4,  0,  0,  0,  0, 50,  0,  0,  0,  1,  0,  0,  0,
+232,105,198,  4,  0,  0,  0,  0,168, 20,196,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 77, 69,112,114,101,118,105,101,119,  0,  0,  0,  0,112,104,101,114,101,  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,  2,  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,  0,248, 48,196,  4,  0,  0,  0,  0,
+104,138,195,  4,  0,  0,  0,  0,120, 58,200,  4,  0,  0,  0,  0, 40,194,199,  4,  0,  0,  0,  0,200,138,200,  4,  0,  0,  0,  0,
+184,198,195,  4,  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,
+152, 51,196,  4,  0,  0,  0,  0, 88,104,196,  4,  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,  0,  0,
+ 72, 49,196,  4,  0,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  1,  0,  0,  0,  5,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,102,196,  4,  0,  0,  0,  0,255,255,255,255,255,255,255,255,
+255,255,255,255,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  1,  0,  0,  0,  5,  0,  0,  0, 12,  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,  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,  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,  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, 72, 35,196,  4,  0,  0,  0,  0,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  0,  0,  0,  0,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  1,  0,  0,  0,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  2,  0,  0,  0,  5,  0,  0,  0, 28,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+152, 37,196,  4,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,  0,  0,  0,  0,  1,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  2,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  3,  0,  0,  0,  5,  0,  0,  0, 24,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,130,  2,  0,  0,128,  7,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  5,  0,  0,  0, 15,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,117,224,186, 64, 91, 13,187, 64,
+160,240,186, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0, 67,  0, 30,  0,  4,  0,  0,  0,  0,  0,  0,  0,  1,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  8,  0,  0,  0,248, 48,196,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+120,164, 26,  4,  0,  0,  0,  0, 68, 65, 84, 65,  8,  2,  0,  0, 72, 49,196,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  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,  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,
+152, 51,196,  4,  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,  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,  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,  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,  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,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40, 50,  0,  0,152, 51,196,  4,  0,  0,  0,  0, 56,  0,  0,  0,130,  2,  0,  0,
+ 28,136,141,191, 12,243,244, 62,198, 86,183,192,212,231,117, 10,191,130,  1,  0,240,102,131,192, 30,183,119, 64,109,169,199,191,
+ 58,166,158, 84,230,221,  1,  0,119,108,239, 63,213, 85,156, 64,188, 58, 40,192,228, 40,207,106,137,198,  1,  0, 95,135,146, 64,
+ 63, 54, 14,191,241,194,102,192, 27,100,219,243, 45,177,  1,  0,239, 84,141, 62, 16,220,157,192, 14,  2, 73,192,  8,  6, 39,148,
+ 86,187,  1,  0,132,239,162,192,206,165, 12,192,150, 45,240,191,175,144,245,207,251,214,  1,  0,239, 84,141,190, 16,220,157, 64,
+ 14,  2, 73, 64,248,249,217,107,170, 68,  1,  0,132,239,162, 64,206,165, 12, 64,150, 45,240, 63, 81,111, 11, 48,  5, 41,  1,  0,
+240,102,131, 64, 30,183,119,192,109,169,199, 63,198, 89, 98,171, 26, 34,  1,  0,119,108,239,191,213, 85,156,192,188, 58, 40, 64,
+ 28,215, 49,149,119, 57,  1,  0, 95,135,146,192, 63, 54, 14, 63,241,194,102, 64,229,155, 37, 12,211, 78,  1,  0, 28,136,141, 63,
+ 12,243,244,190,198, 86,183, 64, 44, 24,139,245, 65,125,  1,  0,114, 17, 68,192,226,153, 35, 64,154, 26,137,192,  6,189,226, 55,
+ 85,162,  1,  0,155, 40,230, 62,239,199, 73, 64,176, 52,157,192,211,  9,237, 68,153,148,  1,  0,124, 55,168,191,224,177,164, 64,
+ 58,144, 29,192, 69,227,132,112, 46,202,  1,  0, 94, 35,105,192,230, 88,129,191,195, 14,143,192, 93,176,233,233, 68,158,  1,  0,
+ 37,  2,173,192,137,187,123, 63, 56, 68,  1,192,206,137,127, 21,216,211,  1,  0,234,168,  2, 64,231,158, 57,189, 65,149,175,192,
+162, 44,  3,255, 11,136,  1,  0, 19,159,114, 64,254,226, 34, 64,196,133,106,192,225, 82,164, 55,228,175,  1,  0,105,176,249,190,
+ 21,148, 39,192,217,214,166,192, 87,245,194,198,  5,142,  1,  0,227,163, 54, 64, 86,121, 78,192, 22,202,125,192, 99, 62,120,185,
+ 79,169,  1,  0,241, 40, 53,192,200, 31,134,192,229,188, 60,192, 30,194, 94,164,136,191,  1,  0, 96,230,181,192, 33, 24,119,191,
+174, 26,130, 63,186,131,231,234, 56, 22,  1,  0,103, 93,163,192,136,128, 38, 64, 83,235,153, 63,100,144,224, 56, 74, 26,  1,  0,
+238,219, 36,192,132,151,165, 64,165,226,109, 63,176,199, 33,113, 80, 20,  1,  0, 24,237,111, 63,118,174,184, 64,212, 34,154, 62,
+125, 20, 44,126,148,  6,  1,  0,163,244,130, 64,157, 58,133, 64,125, 95,226,190,119, 89,  5, 91, 86,246,  1,  0, 96,230,181, 64,
+ 33, 24,119, 63,174, 26,130,191, 70,124, 25, 21,200,233,  1,  0,103, 93,163, 64,136,128, 38,192, 83,235,153,191,156,111, 32,199,
+182,229,  1,  0,238,219, 36, 64,132,151,165,192,165,226,109,191, 80, 56,223,142,176,235,  1,  0, 24,237,111,191,118,174,184,192,
+212, 34,154,190,131,235,212,129,108,249,  1,  0,163,244,130,192,157, 58,133,192,125, 95,226, 62,137,166,251,164,170,  9,  1,  0,
+227,163, 54,192, 86,121, 78, 64, 22,202,125, 64,157,193,136, 70,177, 86,  1,  0,241, 40, 53, 64,200, 31,134, 64,229,188, 60, 64,
+226, 61,162, 91,120, 64,  1,  0, 37,  2,173, 64,137,187,123,191, 56, 68,  1, 64, 50,118,129,234, 40, 44,  1,  0,124, 55,168, 63,
+224,177,164,192, 58,144, 29, 64,187, 28,124,143,210, 53,  1,  0, 19,159,114,192,254,226, 34,192,196,133,106, 64, 31,173, 92,200,
+ 28, 80,  1,  0,234,168,  2,192,231,158, 57, 61, 65,149,175, 64, 94,211,253,  0,245,119,  1,  0,105,176,249, 62, 21,148, 39, 64,
+217,214,166, 64,169, 10, 62, 57,251,113,  1,  0, 94, 35,105, 64,230, 88,129, 63,195, 14,143, 64,163, 79, 23, 22,188, 97,  1,  0,
+114, 17, 68, 64,226,153, 35,192,154, 26,137, 64,250, 66, 30,200,171, 93,  1,  0,155, 40,230,190,239,199, 73,192,176, 52,157, 64,
+ 45,246, 19,187,103,107,  1,  0, 37,178, 10,192,138,231,201, 63,149,143,166,192, 31,209,244, 33,216,141,  1,  0,  3,132,110,192,
+243,203, 85, 64,151,107, 66,192, 67,174, 93, 73, 73,190,  1,  0,116,161,174,190, 81,152,241, 63,110,  2,177,192, 38,248,149, 40,
+221,134,  1,  0,138, 91,154, 63,218,179,133, 64,209,222,122,192,185, 26,201, 91,228,170,  1,  0,  7, 82, 52,192, 82,252,149, 64,
+ 64,202,  5,192,177,193, 36,102,136,210,  1,  0,179, 12,148, 62,251,221,166, 64,188, 87, 41,192, 34,  7,239,113, 29,198,  1,  0,
+216,246, 29,192, 17,156,141,190,209,167,169,192,176,202, 86,250,199,139,  1,  0, 99, 72,145,192, 79,114,213,191,183, 35, 83,192,
+ 97,156, 62,219,138,184,  1,  0,115, 58,158,192,129,120, 33, 64,198, 41,238,191, 60,148,228, 55,113,215,  1,  0,118,158,174,192,
+103,148, 33,191,140,156,  1,192,201,136,100,241,196,211,  1,  0, 55, 14,249, 62, 95,133,102, 62,210,143,186,192,213,  9, 14,  5,
+124,128,  1,  0,220, 61, 92, 64, 56,230,159,190,  6, 61,151,192,224, 75, 11,249, 40,153,  1,  0,  7, 86, 60, 64, 60, 48,119, 64,
+ 93, 88, 81,192,216, 63,  8, 85,193,184,  1,  0,252, 55,139, 64, 62, 95,132, 63,225,216,113,192, 80, 95,209, 21,103,173,  1,  0,
+ 18,  6, 84,191,251, 96,142,191, 76,  4,182,192,189,237,121,232,133,131,  1,  0,109, 74,225,189, 51, 54,123,192, 34,246,138,192,
+203,253,153,169,152,161,  1,  0,153, 66,119, 64,127,154,251,191,161,220,123,192,230, 84,182,213, 15,170,  1,  0,201, 59,208, 63,
+241,182,135,192,212,101,108,192,232, 34,217,162,118,175,  1,  0,161,246,169,191,235,196,151,192,170,149, 74,192,196,227, 32,152,
+192,186,  1,  0, 33,198,131,192,218,137, 84,192, 37,134, 32,192,102,165,233,183,113,201,  1,  0,176, 61,179,192,138,110,210,191,
+ 24,220,228,190,179,133,191,219,126,245,  1,  0, 73,182,170,192,136, 16, 90,190, 90,194, 25, 64,168,139,188,251, 46, 53,  1,  0,
+ 75, 55,153,192,  4, 78, 87, 64, 12, 54, 62,190,149,151,222, 73, 60,251,  1,  0,235, 19,161,192,207, 12,210, 63,210,242, 31, 64,
+ 23,146, 90, 35, 63, 55,  1,  0, 60, 75, 94,192,189,115,150, 64,186,211,167,190,173,179,116,102, 51,248,  1,  0,186,191,189,191,
+ 63, 32,168, 64,213,100,  7, 64, 46,224,204,114,208, 46,  1,  0,242,205,186, 63,141, 65,177, 64,127,219,154,191, 36, 32,223,120,
+206,228,  1,  0, 99,245,175, 62, 97, 12,178, 64,255,253,228, 63, 52,  7,109,121,213, 39,  1,  0,226, 92, 70, 64,  8,131,150, 64,
+182, 77,204,191, 49, 67,  2,103,141,220,  1,  0,200,194,152, 64,180,155, 83, 64,154,217, 62, 63,158,104,199, 71,227, 16,  1,  0,
+ 73,182,170, 64,136, 16, 90, 62, 90,194, 25,192, 88,116, 68,  4,210,202,  1,  0,176, 61,179, 64,138,110,210, 63, 24,220,228, 62,
+ 77,122, 65, 36,130, 10,  1,  0,235, 19,161, 64,207, 12,210,191,210,242, 31,192,233,109,166,220,193,200,  1,  0, 75, 55,153, 64,
+  4, 78, 87,192, 12, 54, 62, 62,107,104, 34,182,196,  4,  1,  0,186,191,189, 63, 63, 32,168,192,213,100,  7,192,210, 31, 52,141,
+ 48,209,  1,  0, 60, 75, 94, 64,189,115,150,192,186,211,167, 62, 83, 76,140,153,205,  7,  1,  0, 99,245,175,190, 97, 12,178,192,
+255,253,228,191,204,248,147,134, 43,216,  1,  0,242,205,186,191,141, 65,177,192,127,219,154, 63,220,223, 33,135, 50, 27,  1,  0,
+200,194,152,192,180,155, 83,192,154,217, 62,191, 98,151, 57,184, 29,239,  1,  0,226, 92, 70,192,  8,131,150,192,182, 77,204, 63,
+207,188,254,152,115, 35,  1,  0,201, 59,208,191,241,182,135, 64,212,101,108, 64, 24,221, 39, 93,138, 80,  1,  0,153, 66,119,192,
+127,154,251, 63,161,220,123, 64, 26,171, 74, 42,241, 85,  1,  0,161,246,169, 63,235,196,151, 64,170,149, 74, 64, 60, 28,224,103,
+ 64, 69,  1,  0, 33,198,131, 64,218,137, 84, 64, 37,134, 32, 64,154, 90, 23, 72,143, 54,  1,  0,118,158,174, 64,103,148, 33, 63,
+140,156,  1, 64, 55,119,156, 14, 60, 44,  1,  0,115, 58,158, 64,129,120, 33,192,198, 41,238, 63,196,107, 28,200,143, 40,  1,  0,
+  7, 82, 52, 64, 82,252,149,192, 64,202,  5, 64, 79, 62,220,153,120, 45,  1,  0,179, 12,148,190,251,221,166,192,188, 87, 41, 64,
+222,248, 17,142,227, 57,  1,  0,  7, 86, 60,192, 60, 48,119,192, 93, 88, 81, 64, 40,192,248,170, 63, 71,  1,  0,252, 55,139,192,
+ 62, 95,132,191,225,216,113, 64,176,160, 47,234,153, 82,  1,  0,220, 61, 92,192, 56,230,159, 62,  6, 61,151, 64, 32,180,245,  6,
+216,102,  1,  0, 55, 14,249,190, 95,133,102,190,210,143,186, 64, 43,246,242,250,132,127,  1,  0,109, 74,225, 61, 51, 54,123, 64,
+ 34,246,138, 64, 53,  2,103, 86,104, 94,  1,  0, 18,  6, 84, 63,251, 96,142, 63, 76,  4,182, 64, 67, 18,135, 23,123,124,  1,  0,
+ 99, 72,145, 64, 79,114,213, 63,183, 35, 83, 64,159, 99,194, 36,118, 71,  1,  0,216,246, 29, 64, 17,156,141, 62,209,167,169, 64,
+ 80, 53,170,  5, 57,116,  1,  0,  3,132,110, 64,243,203, 85,192,151,107, 66, 64,189, 81,163,182,183, 65,  1,  0, 37,178, 10, 64,
+138,231,201,191,149,143,166, 64,225, 46, 12,222, 40,114,  1,  0,138, 91,154,191,218,179,133,192,209,222,122, 64, 71,229, 55,164,
+ 28, 85,  1,  0,116,161,174, 62, 81,152,241,191,110,  2,177, 64,218,  7,107,215, 35,121,  1,  0, 36, 76, 19,192, 25,151,129, 64,
+212,254, 98,192,201,206,101, 88,154,177,  1,  0, 93,232,175,191,177, 23, 64, 64, 69,186,154,192,229,225,204, 66, 13,151,  1,  0,
+208,190,232,190, 93,160,139, 64,191, 33,120,192,216,244,220, 94,204,170,  1,  0,210,126,142,192, 43, 49,238, 63,112, 30, 84,192,
+185,158,127, 39,203,182,  1,  0,138,165, 97,192, 92,  9, 80, 63, 20, 74,147,192,212,177,229, 17, 63,156,  1,  0, 98, 61,152,192,
+ 87, 63,106,188,  6, 97, 90,192,114,152,219,  0,199,180,  1,  0,200,173, 14, 64,155,183, 63, 64,192, 75,144,192,205, 48, 77, 64,
+172,156,  1,  0, 95,162,167, 63,144, 29,209, 63, 25,245,174,192,217, 29, 61, 36,238,136,  1,  0,211, 62, 68, 64, 51, 56,168, 63,
+ 13,245,153,192, 12, 66,168, 29,115,150,  1,  0, 33,182, 36, 64, 34, 38,220,191,150,  5,159,192, 10, 55,224,217,234,146,  1,  0,
+ 16, 34, 81, 63,129, 64,179,191,162,  5,180,192,215, 18,118,224,100,133,  1,  0,212, 56,159, 63,172,166, 68,192,212,108,154,192,
+164, 27,  0,190,224,149,  1,  0,204, 76,223,191,170, 32,101,192, 65, 83,137,192,225,216,170,178,208,161,  1,  0,249,249, 10,192,
+ 62, 52,244,191, 25,236,162,192, 21,208, 32,213, 85,145,  1,  0, 42,207, 89,192,251,  6, 47,192, 27,165,121,192,179,182, 21,196,
+221,169,  1,  0,137,215,176,192, 25, 62,241, 63,179,254,219,190,190,134,  7, 40, 61,247,  1,  0, 28,150,186,192,150, 16, 28, 60,
+191,  9,  7,191,120,128,100,  1, 57,245,  1,  0, 34,132,181,192, 99, 60, 92, 63,217, 81,149, 63,188,131,235, 18, 33, 24,  1,  0,
+175,242, 74,190,164,173,183, 64,227,105,145,191,146,250,157,125,  8,232,  1,  0,219,227,  2,192, 96,164,173, 64,200, 71, 78,191,
+131,212, 38,119,214,238,  1,  0,181,140, 92,191, 75, 38,184, 64,176,148, 37, 63,231,236,234,125,196, 12,  1,  0, 75,104,159, 64,
+212, 56,236, 63,240,126, 29,192,213,108,134, 41,245,202,  1,  0,215,159,132, 64, 84,184, 97, 64, 30, 44, 10,192,150, 91, 44, 76,
+ 46,209,  1,  0, 95,122,164, 64,199,143, 44, 64, 53, 78, 68,191, 25,112, 14, 59,222,237,  1,  0,255,176, 54, 64,243, 84,141,192,
+237,176, 36,192,159, 63,250,159, 50,200,  1,  0, 93,229,133, 64,217, 21, 68,192,157,226, 45,192,  6, 91,218,187, 61,197,  1,  0,
+203, 56,129, 64, 21,211,130,192,187,115,143,191,  3, 88,190,166, 33,230,  1,  0,189,239,104,192, 82,142,140,192,178,178,168,191,
+108,177, 13,159,144,227,  1,  0, 50,141,253,191, 52,155,167,192,170,181,218,191,154,211,162,141,131,219,  1,  0,164, 58, 41,192,
+172, 34,167,192,206,232,151, 61,239,197,240,141, 63,  0,  1,  0, 93,229,133,192,217, 21, 68, 64,157,226, 45, 64,250,164, 38, 68,
+195, 58,  1,  0,203, 56,129,192, 21,211,130, 64,187,115,143, 63,253,167, 66, 89,223, 25,  1,  0,255,176, 54,192,243, 84,141, 64,
+237,176, 36, 64, 97,192,  6, 96,206, 55,  1,  0, 50,141,253, 63, 52,155,167, 64,170,181,218, 63,102, 44, 94,114,125, 36,  1,  0,
+164, 58, 41, 64,172, 34,167, 64,206,232,151,189, 17, 58, 16,114,193,255,  1,  0,189,239,104, 64, 82,142,140, 64,178,178,168, 63,
+148, 78,243, 96,112, 28,  1,  0, 28,150,186, 64,150, 16, 28,188,191,  9,  7, 63,136,127,156,254,199, 10,  1,  0, 34,132,181, 64,
+ 99, 60, 92,191,217, 81,149,191, 68,124, 21,237,223,231,  1,  0,137,215,176, 64, 25, 62,241,191,179,254,219, 62, 66,121,249,215,
+195,  8,  1,  0,219,227,  2, 64, 96,164,173,192,200, 71, 78, 63,125, 43,218,136, 42, 17,  1,  0,181,140, 92, 63, 75, 38,184,192,
+176,148, 37,191, 25, 19, 22,130, 60,243,  1,  0,175,242, 74, 62,164,173,183,192,227,105,145, 63,110,  5, 99,130,248, 23,  1,  0,
+215,159,132,192, 84,184, 97,192, 30, 44, 10, 64,106,164,212,179,210, 46,  1,  0, 95,122,164,192,199,143, 44,192, 53, 78, 68, 63,
+231,143,242,196, 34, 18,  1,  0, 75,104,159,192,212, 56,236,191,240,126, 29, 64, 43,147,122,214, 11, 53,  1,  0,212, 56,159,191,
+172,166, 68, 64,212,108,154, 64, 92,228,  0, 66, 32,106,  1,  0, 33,182, 36,192, 34, 38,220, 63,150,  5,159, 64,246,200, 32, 38,
+ 22,109,  1,  0, 16, 34, 81,191,129, 64,179, 63,162,  5,180, 64, 41,237,138, 31,156,122,  1,  0, 42,207, 89, 64,251,  6, 47, 64,
+ 27,165,121, 64, 77, 73,235, 59, 35, 86,  1,  0,208, 76,223, 63,170, 32,101, 64, 65, 83,137, 64, 31, 39, 86, 77, 48, 94,  1,  0,
+249,249, 10, 64, 62, 52,244, 63, 25,236,162, 64,235, 47,224, 42,171,110,  1,  0,210,126,142, 64, 43, 49,238,191,112, 30, 84, 64,
+ 71, 97,129,216, 53, 73,  1,  0, 98, 61,152, 64, 87, 63,106, 60,  6, 97, 90, 64,142,103, 37,255, 57, 75,  1,  0,138,165, 97, 64,
+ 92,  9, 80,191, 20, 74,147, 64, 44, 78, 27,238,193, 99,  1,  0,208,190,232, 62, 93,160,139,192,191, 33,120, 64, 40, 11, 36,161,
+ 52, 85,  1,  0, 36, 76, 19, 64, 25,151,129,192,212,254, 98, 64, 55, 49,155,167,102, 78,  1,  0, 93,232,175, 63,177, 23, 64,192,
+ 69,186,154, 64, 27, 30, 52,189,243,104,  1,  0,211, 62, 68,192, 51, 56,168,191, 13,245,153, 64,244,189, 88,226,141,105,  1,  0,
+200,173, 14,192,155,183, 63,192,192, 75,144, 64, 51,207,179,191, 84, 99,  1,  0, 95,162,167,191,144, 29,209,191, 25,245,174, 64,
+ 39,226,195,219, 18,119,  1,  0,158,156,211,191,185,228,132, 63,190,207,176,192,249,219,152, 22, 71,135,  1,  0,  0, 76, 41,192,
+190,199,  5, 64, 83,157,153,192, 56,198,174, 45, 83,151,  1,  0,204, 83,125,192,169, 55,105, 64,244,162, 20,192,132,169,162, 79,
+100,205,  1,  0,178,215, 91,192,222,235, 62, 64,190,254,108,192, 26,181,  8, 65, 28,175,  1,  0,242, 63, 59,191,210,237,152, 63,
+251, 21,182,192,248,239,253, 25,180,131,  1,  0, 86,230, 94, 61,198, 30, 35, 64,233, 15,169,192, 62,  1,180, 55,197,140,  1,  0,
+220,  4,199, 63,  7,145,146, 64,104,186, 83,192,  3, 34, 24,100,216,183,  1,  0,  9,120, 86, 63,149, 91,109, 64, 79,242,142,192,
+ 57, 18,216, 80,117,158,  1,  0,103,243, 95,192,221, 91,138, 64,186, 15,236,191,121,179, 96, 94,195,215,  1,  0, 46,206,  5,192,
+121, 41,159, 64,154, 91, 19,192,127,210,143,108,188,205,  1,  0,169,200,139, 63,198, 78,163, 64,201,146, 42,192,249, 23,113,111,
+202,197,  1,  0,187,128,  4,191,206,181,167, 64, 74, 92, 37,192,151,244, 89,114,164,199,  1,  0,151, 16,231,191,160,166,209, 61,
+167, 95,178,192,173,216, 74,  2, 56,134,  1,  0,163,200, 69,192,178,143, 38,191,148, 48,158,192,124,188,192,241, 51,148,  1,  0,
+ 43,192,155,192,151,  6,250,191,170, 82, 39,192,166,149, 76,213,  2,199,  1,  0,233,118,132,192,217,111,173,191, 67,122,123,192,
+191,165,124,226, 46,170,  1,  0,238, 85,146,192,178,205, 78, 64, 70, 54,221,191, 47,156,175, 70, 71,218,  1,  0, 76,137,167,192,
+111, 31,227, 63,158, 57,251,191,187,141,154, 38, 42,213,  1,  0, 39,143,170,192,167, 15,183,191,251, 85,252,191,157,139,164,224,
+245,212,  1,  0,  8,214,175,192,177,124, 53, 62,206,241,  2,192, 28,136,252,  3, 92,211,  1,  0, 77,160,160,190,  9, 20,182, 62,
+108,232,186,192,  8,249,201,  7,111,128,  1,  0, 33,144,163, 63,151,144,186, 61, 50, 47,183,192,255, 27,247,  1, 31,131,  1,  0,
+222,179,129, 64,234,147,224,190, 38,180,134,192,157, 88,103,246, 37,164,  1,  0,114,138, 49, 64,246, 97, 57,190, 57, 76,165,192,
+109, 60, 18,252, 60,143,  1,  0,249,158, 27, 64,197,118,141, 64, 58,196, 62,192,  6, 53,163, 96,242,190,  1,  0, 98,244, 89, 64,
+  8,120, 79, 64, 65,128, 96,192, 94, 74,162, 70,111,179,  1,  0, 13,100,144, 64,200,214,118, 62, 64,205,110,192,146, 98, 37,  5,
+132,174,  1,  0, 42,202,131, 64, 60,161,231, 63,142,245,112,192,210, 89,152, 39,220,173,  1,  0,149, 51,122,191, 52,151,163,190,
+ 15,157,184,192,162,234, 36,249,253,129,  1,  0,  5,113, 42,191, 31,112,241,191, 15,119,176,192,128,241,188,214,182,135,  1,  0,
+ 60, 55,172, 61, 22, 64,143,192,164,246,113,192,221,  1, 37,158,133,173,  1,  0,167,173,154,190,111,224, 83,192,198,169,154,192,
+ 98,249,221,183,123,150,  1,  0,151,133,136, 64,  9,249,162,191,106,219,115,192, 61, 93, 76,228,206,172,  1,  0,110,124, 89, 64,
+135,  6, 40,192,223,195,127,192, 18, 74,160,198,205,168,  1,  0,244,248,117, 63,109, 90,148,192,123,  0, 93,192,225, 20,176,154,
+159,180,  1,  0,162,  0, 17, 64, 63,196,113,192, 52,239,119,192,134, 49,167,173,116,171,  1,  0,162,217,  7,191, 21,117,156,192,
+222,238, 75,192,137,244, 50,149,104,186,  1,  0,171,144,  6,192,112,158,144,192,198,241, 69,192,  4,210,111,157,136,188,  1,  0,
+110,238,148,192,115,109, 50,192,187,197, 13,192, 69,154, 50,195,171,207,  1,  0, 79,252, 96,192,140, 40,115,192,116,165, 48,192,
+100,179, 10,173,191,195,  1,  0,100,228,172,192,217,128,248,191,  8, 93,150,191,  8,138,142,213, 59,230,  1,  0, 82,171,182,192,
+216,250,168,191, 15, 15,147, 62,113,131, 63,227, 95,  6,  1,  0,215, 73,160,192,124,165, 49, 62,232, 85, 66, 64,167,146,217,  3,
+105, 66,  1,  0,171, 89,178,192,192,115, 24,191, 78,116,221, 63, 94,134,244,242,165, 37,  1,  0, 51,206,143,192,133,250,105, 64,
+119,251, 97,191,230,157,228, 79,157,236,  1,  0, 62, 32,160,192,163, 38, 65, 64,164,117,  3, 63,203,146,203, 65, 78, 11,  1,  0,
+216,108,155,192, 59,255,141, 63,189,117, 69, 64,243,149, 37, 24,120, 67,  1,  0, 85, 27,164,192,244, 78,  9, 64, 87,193,239, 63,
+ 25,144,226, 46,198, 40,  1,  0,134, 35,117,192, 39,152,138, 64, 73, 86,116,191, 74,172,136, 94, 15,235,  1,  0, 35,220, 67,192,
+  6,218,159, 64,242,103,155, 62, 75,189,  8,109,183,  6,  1,  0,130, 79, 99,191,215,182,164, 64, 10,  4, 42, 64,180,236,103,112,
+ 26, 58,  1,  0,161, 86,  3,192, 14,205,168, 64, 60, 55,197, 63, 37,211, 23,115,135, 33,  1,  0,229,101,215, 63, 84,141,168, 64,
+ 16, 90,248,191,201, 36,255,114,131,213,  1,  0, 99, 52,155, 63,198, 17,183, 64,232,199,235,190,107, 26,216,124, 17,246,  1,  0,
+105,179, 10, 61, 25,185,169, 64,120,119, 31, 64,177,  0,204,115,135, 54,  1,  0,143,198, 37, 63,123,120,183, 64,160,108,135, 63,
+ 44, 14, 29,125,249, 22,  1,  0,180,174, 32, 64, 65, 13,155, 64,238,167,  8,192,189, 54,216,105, 72,209,  1,  0, 69,199,104, 64,
+177,135,143, 64, 41, 12,132,191,111, 79,211, 97,148,233,  1,  0,121,134,159, 64, 49,245, 49, 64,210,166,169, 63,233,108,165, 60,
+  9, 29,  1,  0, 52,133,143, 64,119,200,113, 64,186,206, 29, 62,207, 97,126, 82, 70,  3,  1,  0,215, 73,160, 64,124,165, 49,190,
+232, 85, 66,192, 89,109, 39,252,151,189,  1,  0,171, 89,178, 64,192,115, 24, 63, 78,116,221,191,162,121, 12, 13, 91,218,  1,  0,
+100,228,172, 64,217,128,248, 63,  8, 93,150, 63,248,117,114, 42,197, 25,  1,  0, 82,171,182, 64,216,250,168, 63, 15, 15,147,190,
+143,124,193, 28,161,249,  1,  0,216,108,155, 64, 59,255,141,191,189,117, 69,192, 13,106,219,231,136,188,  1,  0, 85, 27,164, 64,
+244, 78,  9,192, 87,193,239,191,231,111, 30,209, 58,215,  1,  0, 51,206,143, 64,133,250,105,192,119,251, 97, 63, 26, 98, 28,176,
+ 99, 19,  1,  0, 62, 32,160, 64,163, 38, 65,192,164,117,  3,191, 53,109, 53,190,178,244,  1,  0,130, 79, 99, 63,215,182,164,192,
+ 10,  4, 42,192, 76, 19,153,143,230,197,  1,  0,161, 86,  3, 64, 14,205,168,192, 60, 55,197,191,219, 44,233,140,121,222,  1,  0,
+134, 35,117, 64, 39,152,138,192, 73, 86,116, 63,182, 83,120,161,241, 20,  1,  0, 35,220, 67, 64,  6,218,159,192,242,103,155,190,
+181, 66,248,146, 73,249,  1,  0,105,179, 10,189, 25,185,169,192,120,119, 31,192, 79,255, 52,140,121,201,  1,  0,143,198, 37,191,
+123,120,183,192,160,108,135,191,212,241,227,130,  7,233,  1,  0,229,101,215,191, 84,141,168,192, 16, 90,248, 63, 55,219,  1,141,
+125, 42,  1,  0, 99, 52,155,191,198, 17,183,192,232,199,235, 62,149,229, 40,131,239,  9,  1,  0,121,134,159,192, 49,245, 49,192,
+210,166,169,191, 23,147, 91,195,247,226,  1,  0, 52,133,143,192,119,200,113,192,186,206, 29,190, 49,158,130,173,186,252,  1,  0,
+180,174, 32,192, 65, 13,155,192,238,167,  8, 64, 67,201, 40,150,184, 46,  1,  0, 69,199,104,192,177,135,143,192, 41, 12,132, 63,
+145,176, 45,158,108, 22,  1,  0,244,248,117,191,109, 90,148, 64,123,  0, 93, 64, 31,235, 80,101, 97, 75,  1,  0,162,  0, 17,192,
+ 63,196,113, 64, 52,239,119, 64,122,206, 89, 82,140, 84,  1,  0,151,133,136,192,  9,249,162, 63,106,219,115, 64,195,162,180, 27,
+ 50, 83,  1,  0,110,124, 89,192,135,  6, 40, 64,223,195,127, 64,238,181, 96, 57, 51, 87,  1,  0,162,217,  7, 63, 21,117,156, 64,
+222,238, 75, 64,119, 11,206,106,152, 69,  1,  0,171,144,  6, 64,112,158,144, 64,198,241, 69, 64,252, 45,145, 98,120, 67,  1,  0,
+110,238,148, 64,115,109, 50, 64,187,197, 13, 64,187,101,206, 60, 85, 48,  1,  0, 79,252, 96, 64,140, 40,115, 64,116,165, 48, 64,
+156, 76,246, 82, 65, 60,  1,  0, 39,143,170, 64,167, 15,183, 63,251, 85,252, 63, 99,116, 92, 31, 11, 43,  1,  0,  8,214,175, 64,
+177,124, 53,190,206,241,  2, 64,228,119,  4,252,164, 44,  1,  0,238, 85,146, 64,178,205, 78,192, 70, 54,221, 63,209, 99, 81,185,
+185, 37,  1,  0, 76,137,167, 64,111, 31,227,191,158, 57,251, 63, 69,114,102,217,214, 42,  1,  0,103,243, 95, 64,221, 91,138,192,
+186, 15,236, 63,135, 76,160,161, 61, 40,  1,  0, 46,206,  5, 64,121, 41,159,192,154, 91, 19, 64,129, 45,113,147, 68, 50,  1,  0,
+169,200,139,191,198, 78,163,192,201,146, 42, 64,  7,232,143,144, 54, 58,  1,  0,187,128,  4, 63,206,181,167,192, 74, 92, 37, 64,
+105, 11,167,141, 92, 56,  1,  0,249,158, 27,192,197,118,141,192, 58,196, 62, 64,250,202, 93,159, 14, 65,  1,  0, 98,244, 89,192,
+  8,120, 79,192, 65,128, 96, 64,162,181, 94,185,145, 76,  1,  0, 13,100,144,192,200,214,118,190, 64,205,110, 64,110,157,219,250,
+124, 81,  1,  0, 42,202,131,192, 60,161,231,191,142,245,112, 64, 46,166,104,216, 36, 82,  1,  0,222,179,129,192,234,147,224, 62,
+ 38,180,134, 64, 99,167,153,  9,219, 91,  1,  0,114,138, 49,192,246, 97, 57, 62, 57, 76,165, 64,147,195,238,  3,196,112,  1,  0,
+ 77,160,160, 62,  9, 20,182,190,108,232,186, 64,248,  6, 55,248,145,127,  1,  0, 33,144,163,191,151,144,186,189, 50, 47,183, 64,
+  1,228,  9,254,225,124,  1,  0, 60, 55,172,189, 22, 64,143, 64,164,246,113, 64, 35,254,219, 97,123, 82,  1,  0,167,173,154, 62,
+111,224, 83, 64,198,169,154, 64,158,  6, 35, 72,133,105,  1,  0,149, 51,122, 63, 52,151,163, 62, 15,157,184, 64, 94, 21,220,  6,
+  3,126,  1,  0,  5,113, 42, 63, 31,112,241, 63, 15,119,176, 64,128, 14, 68, 41, 74,120,  1,  0, 43,192,155, 64,151,  6,250, 63,
+170, 82, 39, 64, 90,106,180, 42,254, 56,  1,  0,233,118,132, 64,217,111,173, 63, 67,122,123, 64, 65, 90,132, 29,210, 85,  1,  0,
+151, 16,231, 63,160,166,209,189,167, 95,178, 64, 83, 39,182,253,200,121,  1,  0,163,200, 69, 64,178,143, 38, 63,148, 48,158, 64,
+132, 67, 64, 14,205,107,  1,  0,204, 83,125, 64,169, 55,105,192,244,162, 20, 64,124, 86, 94,176,156, 50,  1,  0,178,215, 91, 64,
+222,235, 62,192,190,254,108, 64,230, 74,248,190,228, 80,  1,  0,158,156,211, 63,185,228,132,191,190,207,176, 64,  7, 36,104,233,
+185,120,  1,  0,  0, 76, 41, 64,190,199,  5,192, 83,157,153, 64,200, 57, 82,210,173,104,  1,  0,220,  4,199,191,  7,145,146,192,
+104,186, 83, 64,253,221,232,155, 40, 72,  1,  0,  9,120, 86,191,149, 91,109,192, 79,242,142, 64,199,237, 40,175,139, 97,  1,  0,
+242, 63, 59, 63,210,237,152,191,251, 21,182, 64,  8, 16,  3,230, 76,124,  1,  0, 86,230, 94,189,198, 30, 35,192,233, 15,169, 64,
+194,254, 76,200, 59,115,  1,  0,208, 27, 46,192,124,104, 86, 64, 85, 52,126,192,122,197, 16, 73,183,168,  1,  0, 82,168,234,191,
+ 87, 62,149, 64,118, 12, 67,192,197,216,162,101,209,188,  1,  0,186, 10, 16,192,249,106, 52, 64,210,253,147,192,231,206,104, 62,
+158,155,  1,  0, 93, 33,240,190,191,199, 71, 64,142, 47,158,192,166,245,253, 68,176,148,  1,  0, 19, 46, 71,187,194,240,115, 64,
+175,166,142,192,  0,255,213, 82,110,158,  1,  0,188,194,101,191, 17, 84,154, 64,240,193, 77,192,140,235,211,104,117,185,  1,  0,
+246,246,115,192,183, 86, 15, 64, 51,168,118,192,208,172,249, 47, 97,171,  1,  0,101,  1,160,192, 47,146,184, 63,153, 38, 45,192,
+249,146,160, 30, 91,196,  1,  0,215,229, 85,192,166,178,218, 63,183, 55,144,192, 61,182, 81, 37, 72,158,  1,  0,151,178,104,192,
+245,107,205,189,175, 60,147,192,218,175,251,253, 58,156,  1,  0,192, 81,136,192, 55,239,  4,191, 24,222,127,192, 84,163,147,245,
+ 85,168,  1,  0, 70,241,164,192,102,218,251, 62,143, 82, 48,192,224,143,144, 11, 93,195,  1,  0,209,230,173, 63,231,135, 71, 64,
+ 27,234,152,192,195, 29, 39, 67, 46,151,  1,  0,158,103, 67, 64, 82,206, 51, 64, 39,168,132,192,158, 66,115, 60,243,164,  1,  0,
+136,131,100, 63, 16, 95, 27, 64,  4,115,168,192,106, 20, 79, 53,113,141,  1,  0, 77,154,217, 63,185, 69, 78, 63,221,196,177,192,
+249, 37,  9, 18, 27,135,  1,  0,107,195, 37, 64,  4,213, 36, 63, 20, 33,167,192,212, 55,201, 14,199,141,  1,  0,103,139, 94, 64,
+153,146,250, 63, 72,141,137,192, 32, 75, 91, 43,225,161,  1,  0,231,195, 21, 64,236, 58,101,191,218,178,169,192, 46, 50,  2,236,
+247,139,  1,  0,142, 32, 48, 64,155,140, 32,192,195,  1,145,192, 36, 59,237,200,191,156,  1,  0, 70,155,185, 63, 12,202, 59,191,
+163, 86,180,192, 83, 32, 66,239, 75,133,  1,  0, 29, 97, 43, 62,144,118,  2,192,125,231,175,192,109,  4,225,210, 78,136,  1,  0,
+ 97,116,196, 62, 10,176, 56,192,120,239,162,192,197,  8,225,193,112,144,  1,  0,185,  2,  5, 64,217,105, 76,192,135,173,142,192,
+159, 45, 45,187, 53,158,  1,  0,163,243,144,191,252, 41, 73,192,148, 66,154,192,132,230, 16,188,144,150,  1,  0,147,133, 20,192,
+234, 55,124,192,176,  3,107,192,172,204,182,170,139,175,  1,  0, 42,186, 60,192,219,128,189,191, 23, 43,155,192, 96,191,203,222,
+161,150,  1,  0, 52,164,172,191,106,240, 18,192,141, 58,167,192, 44,226, 15,205,110,142,  1,  0, 12,171,100,192,249, 33,243,191,
+106,221,135,192,218,178, 99,214,187,162,  1,  0,195, 78, 74,192,241,206, 96,192, 98, 88, 94,192,207,187, 78,179,131,179,  1,  0,
+ 41,110,177,192, 81, 30,186, 63,105,249,158,191,171,134,229, 30,109,229,  1,  0, 45,138,172,192,114,149, 17, 64,127,203,200, 62,
+254,137,191, 48,246,  8,  1,  0, 10, 94,182,192, 48,  5,  1, 63, 86, 81,165,191,147,131,214, 11,110,228,  1,  0,117,224,186,192,
+ 37,234,247,190,147, 56,126, 62,130,128, 89,246,234,  5,  1,  0,204, 78,184,192, 19,193, 89,189,187,163,141, 63, 30,130,255,254,
+ 35, 23,  1,  0,105,232,174,192,151,187,224, 63,156,183,153, 63,130,136, 85, 38, 48, 25,  1,  0, 42,118, 68,191,101,173,176, 64,
+114,132,233,191,124,238,154,120,225,216,  1,  0, 81,172,191, 62, 67,208,186, 64,195,163,216,190, 80,  7,126,127, 90,247,  1,  0,
+113,  2,218,191,172,151,171, 64,114, 25,212,191,182,219,106,117, 61,220,  1,  0,251,244, 21,192, 28, 12,172, 64, 13,151,128, 61,
+203,205,185,117,163,  1,  1,  0, 51, 39,223,191,248, 94,177, 64,104,122, 76, 63,211,217, 16,121,103, 16,  1,  0, 72,208, 28, 61,
+ 91, 13,187, 64, 64,215,245, 62,146,  0,164,127,121,  9,  1,  0, 45, 93,142, 64, 70,137, 14, 64,147,202, 70,192, 20, 97,115, 49,
+210,188,  1,  0,106, 23,173, 64,157,131,182, 63,175,176,225,191,246,117,  6, 32,  7,218,  1,  0, 78,203,128, 64,124, 14, 69, 64,
+ 55,  0, 61,192,146, 88,138, 66,228,191,  1,  0,133,175,133, 64, 28,149,121, 64, 51,212,168,191,229, 91,100, 84,110,227,  1,  0,
+  8,211,149, 64, 84,166, 94, 64, 68, 24, 29,191,  3,102,242, 75,149,241,  1,  0, 31,169,175, 64,138,176,237, 63, 15,168,103,191,
+147,119,172, 40, 64,235,  1,  0,122, 78, 57, 64,224, 12,120,192,  7, 56, 84,192, 22, 64,197,171,  7,184,  1,  0,  0, 74, 48, 64,
+245,165,155,192,208, 87,227,191,  5, 61, 71,150,132,217,  1,  0, 85,108,100, 64,115, 47, 76,192,149,224, 88,192,154, 77,133,185,
+145,182,  1,  0,173,191,150, 64,227,233, 55,192,198,101,254,191,111,102,105,192, 10,213,  1,  0,119, 97,148, 64,200, 33, 89,192,
+ 24,225,150,191,243,100,255,181, 68,229,  1,  0, 75,171, 86, 64, 36, 83,150,192, 22, 36,133,191, 14, 73,157,153, 72,232,  1,  0,
+116,251, 81,192,115, 80,139,192, 57,124, 10,192, 26,185, 78,160, 31,209,  1,  0, 70,239,122,192, 53,220,138,192,113, 86,227,190,
+ 47,171,157,160,134,246,  1,  0, 14, 50, 28,192,245,  4,153,192,141, 39, 23,192,247,201,182,151, 38,205,  1,  0, 34,123,189,191,
+203,168,178,192,149,106,130,191,217,222, 73,134, 91,234,  1,  0,176,127,232,191,177,107,178,192, 47,189,236,189, 27,216,111,134,
+122,252,  1,  0, 53,168, 90,192,169, 83,152,192,227,201,133, 62, 78,181, 43,152,172,  4,  1,  0,173,191,150,192,227,233, 55, 64,
+198,101,254, 63,145,153,151, 63,246, 42,  1,  0, 85,108,100,192,115, 47, 76, 64,149,224, 88, 64,102,178,123, 70,111, 73,  1,  0,
+119, 97,148,192,200, 33, 89, 64, 24,225,150, 63, 13,155,  1, 74,188, 26,  1,  0, 75,171, 86,192, 36, 83,150, 64, 22, 36,133, 63,
+242,182, 99,102,184, 23,  1,  0,  0, 74, 48,192,245,165,155, 64,208, 87,227, 63,251,194,185,105,124, 38,  1,  0,122, 78, 57,192,
+224, 12,120, 64,  7, 56, 84, 64,234,191, 59, 84,249, 71,  1,  0, 34,123,189, 63,203,168,178, 64,149,106,130, 63, 39, 33,183,121,
+165, 21,  1,  0, 14, 50, 28, 64,245,  4,153, 64,141, 39, 23, 64,  9, 54, 74,104,218, 50,  1,  0,176,127,232, 63,177,107,178, 64,
+ 47,189,236, 61,229, 39,145,121,134,  3,  1,  0, 53,168, 90, 64,169, 83,152, 64,227,201,133,190,178, 74,213,103, 84,251,  1,  0,
+ 70,239,122, 64, 53,220,138, 64,113, 86,227, 62,209, 84, 99, 95,122,  9,  1,  0,116,251, 81, 64,115, 80,139, 64, 57,124, 10, 64,
+230, 70,178, 95,225, 46,  1,  0,117,224,186, 64, 37,234,247, 62,147, 56,126,190,126,127,167,  9, 22,250,  1,  0, 10, 94,182, 64,
+ 48,  5,  1,191, 86, 81,165, 63,109,124, 42,244,146, 27,  1,  0,204, 78,184, 64, 19,193, 89, 61,187,163,141,191,226,125,  1,  1,
+221,232,  1,  0,105,232,174, 64,151,187,224,191,156,183,153,191,126,119,171,217,208,230,  1,  0, 45,138,172, 64,114,149, 17,192,
+127,203,200,190,  2,118, 65,207, 10,247,  1,  0, 41,110,177, 64, 81, 30,186,191,105,249,158, 63, 85,121, 27,225,147, 26,  1,  0,
+251,244, 21, 64, 28, 12,172,192, 13,151,128,189, 53, 50, 71,138, 93,254,  1,  0,113,  2,218, 63,172,151,171,192,114, 25,212, 63,
+ 74, 36,150,138,195, 35,  1,  0, 51, 39,223, 63,248, 94,177,192,104,122, 76,191, 45, 38,240,134,153,239,  1,  0, 72,208, 28,189,
+ 91, 13,187,192, 64,215,245,190,110,255, 92,128,135,246,  1,  0, 81,172,191,190, 67,208,186,192,195,163,216, 62,176,248,130,128,
+166,  8,  1,  0, 42,118, 68, 63,101,173,176,192,114,132,233, 63,132, 17,102,135, 31, 39,  1,  0,133,175,133,192, 28,149,121,192,
+ 51,212,168, 63, 27,164,156,171,146, 28,  1,  0, 78,203,128,192,124, 14, 69,192, 55,  0, 61, 64,110,167,118,189, 28, 64,  1,  0,
+ 31,169,175,192,138,176,237,191, 15,168,103, 63,109,136, 84,215,192, 20,  1,  0,  8,211,149,192, 84,166, 94,192, 68, 24, 29, 63,
+253,153, 14,180,107, 14,  1,  0,106, 23,173,192,157,131,182,191,175,176,225, 63, 10,138,250,223,249, 37,  1,  0, 45, 93,142,192,
+ 70,137, 14,192,147,202, 70, 64,236,158,141,206, 46, 67,  1,  0,185,  2,  5,192,217,105, 76, 64,135,173,142, 64, 97,210,211, 68,
+203, 97,  1,  0, 97,116,196,190, 10,176, 56, 64,120,239,162, 64, 59,247, 31, 62,144,111,  1,  0,142, 32, 48,192,155,140, 32, 64,
+195,  1,145, 64,220,196, 19, 55, 65, 99,  1,  0,231,195, 21,192,236, 58,101, 63,218,178,169, 64,210,205,254, 19,  9,116,  1,  0,
+ 70,155,185,191, 12,202, 59, 63,163, 86,180, 64,173,223,190, 16,181,122,  1,  0, 29, 97, 43,190,144,118,  2, 64,125,231,175, 64,
+147,251, 31, 45,178,119,  1,  0,195, 78, 74, 64,241,206, 96, 64, 98, 88, 94, 64, 49, 68,178, 76,125, 76,  1,  0, 12,171,100, 64,
+249, 33,243, 63,106,221,135, 64, 38, 77,157, 41, 69, 93,  1,  0,147,133, 20, 64,234, 55,124, 64,176,  3,107, 64, 84, 51, 74, 85,
+117, 80,  1,  0,164,243,144, 63,252, 41, 73, 64,148, 66,154, 64,124, 25,240, 67,112,105,  1,  0, 52,164,172, 63,106,240, 18, 64,
+141, 58,167, 64,212, 29,241, 50,146,113,  1,  0, 42,186, 60, 64,219,128,189, 63, 23, 43,155, 64,160, 64, 53, 33, 95,105,  1,  0,
+101,  1,160, 64, 47,146,184,191,153, 38, 45, 64,  7,109, 96,225,165, 59,  1,  0,246,246,115, 64,183, 86, 15,192, 51,168,118, 64,
+ 48, 83,  7,208,159, 84,  1,  0, 70,241,164, 64,102,218,251,190,143, 82, 48, 64, 32,112,112,244,163, 60,  1,  0,192, 81,136, 64,
+ 55,239,  4, 63, 24,222,127, 64,172, 92,109, 10,171, 87,  1,  0,151,178,104, 64,245,107,205, 61,175, 60,147, 64, 38, 80,  5,  2,
+198, 99,  1,  0,215,229, 85, 64,166,178,218,191,183, 55,144, 64,195, 73,175,218,184, 97,  1,  0,188,194,101, 63, 17, 84,154,192,
+240,193, 77, 64,116, 20, 45,151,139, 70,  1,  0, 19, 46, 71, 59,194,240,115,192,175,166,142, 64,  0,  1, 43,173,146, 97,  1,  0,
+ 82,168,234, 63, 87, 62,149,192,118, 12, 67, 64, 59, 39, 94,154, 47, 67,  1,  0,208, 27, 46, 64,124,104, 86,192, 85, 52,126, 64,
+134, 58,240,182, 73, 87,  1,  0,186, 10, 16, 64,249,106, 52,192,210,253,147, 64, 25, 49,152,193, 98,100,  1,  0, 93, 33,240, 62,
+191,199, 71,192,142, 47,158, 64, 90, 10,  3,187, 80,107,  1,  0,103,139, 94,192,153,146,250,191, 72,141,137, 64,224,180,165,212,
+ 31, 94,  1,  0,107,195, 37,192,  4,213, 36,191, 20, 33,167, 64, 44,200, 55,241, 57,114,  1,  0,158,103, 67,192, 82,206, 51,192,
+ 39,168,132, 64, 98,189,141,195, 13, 91,  1,  0,209,230,173,191,231,135, 71,192, 27,234,152, 64, 61,226,217,188,210,104,  1,  0,
+ 77,154,217,191,185, 69, 78,191,221,196,177, 64,  7,218,247,237,229,120,  1,  0,136,131,100,191, 16, 95, 27,192,  4,115,168, 64,
+150,235,177,202,143,114,  1,  0,139,220, 37,192,245,135,141, 64,114,173, 54,192, 49,199, 96, 96,209,193,  1,  0,204,119, 84,192,
+ 93, 73,130, 64,212,107, 38,192, 46,183,222, 88,151,199,  1,  0,208, 76, 67,192, 62,120,111, 64, 14, 89, 85,192, 82,189,194, 81,
+136,183,  1,  0, 68,147,238,191,166,230,100, 64,234,  9,136,192,206,215,123, 78, 57,163,  1,  0, 30,149,109,191, 40, 18,111, 64,
+171,100,141,192, 48,235,197, 81,194,159,  1,  0,144,237,178,191, 25,136,136, 64,121,  1,113,192,117,225,197, 92, 71,173,  1,  0,
+214, 82, 66, 63,128,115,152, 64,164, 25, 85,192,  1, 17, 31,104,135,183,  1,  0,119,155,171,189,138, 40,155, 64,113, 96, 83,192,
+123,254,195,105,238,183,  1,  0, 67,138,194, 62,177, 97,138, 64, 75,158,124,192,109,  8,131, 94, 26,170,  1,  0,158,106, 94,191,
+167,106, 30, 64,254,240,167,192,230,236,191, 53,107,141,  1,  0, 22,114,229,191,193, 96, 20, 64,253,167,162,192, 20,217, 97, 50,
+247,144,  1,  0, 45,210,162,191,233,211,224, 63,184, 67,174,192, 71,228,227, 37,237,136,  1,  0, 37, 61,152,192,230,  9, 14, 64,
+137,179, 39,192, 84,152,178, 48,225,198,  1,  0,232,187,140,192,  6, 96, 62, 64,107,247, 30,192,  9,160, 82, 65, 23,202,  1,  0,
+116,134,132,192, 40,130, 40, 64,237,207, 77,192,140,165,146, 57, 26,186,  1,  0, 12,129,129,192,231,129,173, 63,159,125,128,192,
+ 68,167, 25, 29,120,168,  1,  0,254,112,134,192,126,146,207, 62,159, 19,130,192, 18,164,108,  9,113,167,  1,  0,189,121,149,192,
+142,192,111, 63, 76, 95, 90,192, 88,154,108, 20,246,180,  1,  0, 12, 65,162,192, 11, 84,149,191,172,202, 44,192, 58,145, 32,230,
+ 85,197,  1,  0, 74,120,165,192, 95, 78,167,190,139, 51, 48,192, 54,143,145,248,243,195,  1,  0, 61,161,150,192,107,221, 89,191,
+118,113, 89,192, 42,153, 81,237, 31,182,  1,  0, 52, 56, 66,192,206, 40,139, 62, 21,116,160,192,  9,190, 18,  6,123,146,  1,  0,
+245,120, 56,192,118,213,154, 63, 81,227,158,192, 78,193, 49, 26,136,147,  1,  0,220,104, 22,192,204,221, 40, 63,115,137,170,192,
+ 33,205, 87, 14,110,139,  1,  0,145,143, 39, 64,190, 49, 94, 64,165, 27,124,192,240, 56,248, 75, 41,170,  1,  0,130,168,  6, 64,
+190,132,130, 64, 12, 96,105,192,224, 45,104, 89,186,176,  1,  0, 76,169,222, 63,205,107,104, 64,150,142,136,192, 22, 38,102, 79,
+ 30,163,  1,  0,137,207,229, 63, 30, 63, 22, 64,207,235,161,192,188, 39,234, 50,127,145,  1,  0,239, 11, 14, 64,175,114,191, 63,
+254,208,166,192,132, 48, 69, 33, 84,142,  1,  0,239,222, 43, 64,212,226, 11, 64,227, 71,151,192, 42, 58,144, 47, 97,152,  1,  0,
+  0,245,124, 64, 27, 32,187, 62, 57,  6,138,192,148, 86,163,  7, 11,162,  1,  0, 42, 75,112, 64,228, 42,152, 63, 25, 44,139,192,
+254, 81,163, 25, 31,161,  1,  0,178,218, 82, 64,178,247,  1, 63,211,129,154,192, 31, 72,  6, 11,214,150,  1,  0,208,203,104, 63,
+146,  6,113, 63,108,  5,183,192,137, 19,150, 20, 49,131,  1,  0, 26, 68,251, 62,111, 38,228, 63,114, 48,178,192,142, 10,162, 38,
+111,134,  1,  0,163, 78,149, 61, 65, 25,137, 63,234,102,184,192, 37,  1, 44, 23, 32,130,  1,  0, 98,140, 80, 64,169,205,238,191,
+ 83, 69,144,192, 67, 71,141,215,172,157,  1,  0,177, 39,109, 64,155,213,147,191,238,143,140,192, 71, 81,255,230, 87,160,  1,  0,
+100,225, 66, 64,146,191,131,191,152, 18,157,192,173, 66,128,233, 23,149,  1,  0,190, 24,220, 63,163,163,202,191,160,244,171,192,
+102, 37,211,220,194,138,  1,  0,227,219,133, 63,172, 47, 17,192, 93,160,169,192,115, 23,161,206, 68,140,  1,  0, 46,202,247, 63,
+ 23,140, 27,192,116,252,158,192,225, 41, 71,203, 38,147,  1,  0, 36,220, 68, 63, 24,143,132,192, 20,105,130,192,156, 16, 53,165,
+ 84,167,  1,  0, 60,255,185, 63,215,244,108,192,129,  7,138,192,117, 31, 15,175,249,161,  1,  0,220, 18, 19, 63,168,186, 98,192,
+ 66,136,148,192,154, 12,125,178,238,154,  1,  0,131,119,172,187,182,209,162,191,170, 73,183,192,211,255,140,228,252,130,  1,  0,
+165,230, 40, 63,246,111, 24,191, 50,150,185,192, 24, 14, 16,243,114,129,  1,  0,123, 45, 50,190,213, 16,230,190,160,240,186,192,
+217,251,137,246,109,128,  1,  0,221, 22,199,191, 71,211,134,192, 37,161,113,192, 93,222,  1,164,157,173,  1,  0,171,131, 58,191,
+ 57,178,140,192,214,174,115,192,120,240,191,159, 19,173,  1,  0,228,119,112,191, 49, 46,115,192,186,222,139,192,149,235,225,172,
+214,160,  1,  0,122, 75,254,191, 18, 36, 50,192, 84, 70,152,192,  8,212, 46,195, 82,152,  1,  0,190,239, 52,192,193,186, 22,192,
+166,240,145,192,160,194, 13,204,107,156,  1,  0, 51, 23, 39,192, 14,245, 76,192,105,248,132,192, 27,199,129,186,208,164,  1,  0,
+202,137,140,192,  4,234, 33,192,152,117, 60,192,203,159,220,200, 20,192,  1,  0, 68,176,115,192, 85, 49, 68,192, 65,173, 79,192,
+182,172, 79,189, 79,185,  1,  0,131,173,128,192, 50,170, 14,192,247, 71,105,192, 33,168, 65,207,185,176,  1,  0,230, 80, 22,192,
+ 50,155,141,191,108, 95,168,192,  0,205,  3,232, 21,141,  1,  0, 96,113,194,191,166,184,195,191, 31,160,174,192,205,222,240,222,
+228,136,  1,  0,249,244,213,191, 10, 33, 52,191,248, 94,178,192,179,219, 20,241, 44,134,  1,  0, 30, 26,167,192, 62, 11, 42, 64,
+199,163,159,190, 43,142, 23, 58,240,248,  1,  0, 15,242,157,192,177, 35, 63, 64,242,230,132,191,125,148,148, 65, 31,233,  1,  0,
+ 58,163,169,192,184,207, 14, 64, 43, 92,148,191,120,140,246, 48,193,230,  1,  0,241, 83,184,192, 33,241,117, 63,204, 69,248,190,
+ 33,130,245, 20, 10,246,  1,  0, 88,178,186,192,180, 33,226, 62, 69,211,165, 62,152,128, 54, 10,201,  6,  1,  0,100,194,181,192,
+227, 37,178, 63, 65, 51,191, 62,202,131,227, 29,208,  7,  1,  0,140, 68,168,192,162,100, 57, 63, 90, 41, 31, 64, 98,141,193, 15,
+192, 54,  1,  0,185,114,173,192,147, 11,162, 63,136,131,237, 63,203,137,109, 27,183, 40,  1,  0, 90, 82,178,192,181,  0,168, 62,
+125, 64,231, 63,135,134, 77,  7,170, 39,  1,  0,235, 52,185,192,191,185, 83,191, 39,176,252,190,201,129,214,237,245,244,  1,  0,
+ 95,222,182,192,178, 32,161,190, 48, 92,165,191, 90,131,213,248,212,227,  1,  0, 52,119,179,192,223,204,147,191,116,141,160,191,
+174,133, 97,230, 93,228,  1,  0,109, 88, 35, 63,129,186,182, 64,207,  8,152,191,  3, 14,128,124,207,229,  1,  0,226, 54, 99, 63,
+172,134,174, 64, 96, 98,250,191,195, 19,238,118,  3,213,  1,  0,150,195, 60, 61, 46,121,177, 64,174,  6,245,191, 79,  1,250,120,
+ 56,214,  1,  0,228,160,145,191,121, 59,181, 64,246,252,123,191, 62,231,212,123, 30,235,  1,  0, 29,166,188,191,167,120,181, 64,
+  4,224,165,189, 72,224,251,123,211,253,  1,  0, 26,186,  9,191,104,142,186, 64,128, 74,126,190,169,243, 70,127, 92,250,  1,  0,
+179,205, 19,191, 33,145,175, 64,102,151,253, 63,129,243,165,119,184, 43,  1,  0,163,114,134,190, 81, 94,183, 64, 73,210,157, 63,
+ 41,250,241,124, 44, 27,  1,  0,253,217,151,191, 90, 89,178, 64,210,246,178, 63, 86,230,147,121,183, 30,  1,  0,107,200, 50,192,
+  4, 21,164, 64,143,252, 18,191,232,194,191,111, 61,243,  1,  0,219,140, 29,192,164,216,163, 64,163,160,187,191,  6,202,150,111,
+ 27,224,  1,  0,  8, 63, 76,192,149, 92,152, 64,201,  6,157,191,240,185,173,103, 19,229,  1,  0,102, 31,167, 64, 18,113,133, 63,
+122,150, 29,192,215,113,152, 22,  9,202,  1,  0,115, 48,157, 64, 74,183, 33, 63, 21,172, 72,192, 47,107, 89, 13, 84,187,  1,  0,
+250, 48,151, 64,117,157,186, 63,236, 37, 74,192, 40,103,131, 31, 24,187,  1,  0,118, 31,148, 64,144, 99, 46, 64, 95,237, 21,192,
+ 96,101,140, 59,104,205,  1,  0, 40,177,150, 64,101,250, 73, 64,104,252,189,191,  9,103,121, 68, 46,223,  1,  0, 59, 67,164, 64,
+106,116, 19, 64, 96,145,209,191,209,111,213, 50,  3,220,  1,  0,  9, 99,168, 64,184,173, 32, 64,129, 16, 27, 63,227,114,186, 54,
+183, 13,  1,  0,225,  1,174, 64, 65,167, 12, 64,199,  1, 38,190,149,118, 16, 48,190,252,  1,  0,172,156,160, 64, 23,121, 66, 64,
+220,253, 53,188,154,109, 28, 66,252,255,  1,  0,230,184,106, 64,117, 83,133, 64, 76, 95,243,191,205, 79,249, 90, 80,214,  1,  0,
+116,166,101, 64, 67,107,111, 64, 69,233, 47,192, 26, 78,215, 81, 33,196,  1,  0,109, 20, 68, 64,202,  9,139, 64,124,255, 29,192,
+122, 66, 31, 95,  3,202,  1,  0, 46,138, 12, 64,195,168,156,192, 99,240, 23,192,176, 47, 54,149,255,203,  1,  0,110,189,201, 63,
+ 48, 28,154,192,180,148, 60,192,240, 33,192,150,143,191,  1,  0, 21, 55, 17, 64,125, 67,140,192,118,  8, 75,192, 65, 49, 53,160,
+221,186,  1,  0, 85,126,100, 64,103,211,114,192,187,176, 43,192, 56, 78,244,172,248,197,  1,  0, 29,112,133, 64,168, 45,104,192,
+ 95, 44,249,191,163, 90,102,176, 54,213,  1,  0,192,193, 95, 64,221,  5,138,192, 42,219,239,191,175, 76, 53,162,183,214,  1,  0,
+ 28, 21,134, 64,185,231,130,192,175,210,133, 62,129, 91,184,166, 51,  6,  1,  0,128,101,115, 64,106,100,142,192,214,174,205,190,
+ 30, 83, 11,159,122,247,  1,  0,187,250,142, 64,178,123,113,192, 90,120,242,190, 99, 97,143,173,240,245,  1,  0,115, 83,149, 64,
+ 25,118, 24,192, 96,  5, 41,192,195,101, 58,204, 39,198,  1,  0,236, 97,130, 64,181,248, 34,192, 49,132, 87,192, 15, 89,179,200,
+144,182,  1,  0,186,103,144, 64, 91,  9,234,191,150,226, 80,192,155, 98,138,216,146,184,  1,  0,208, 74,136,192,231,117,121,192,
+ 32,193,133,191,251,162, 38,171,252,232,  1,  0, 31, 84,144,192, 24, 19, 87,192, 53, 65,211,191, 64,157,  8,183,220,219,  1,  0,
+  7, 90,123,192,107,238,121,192,115,227,247,191, 25,170,254,170,217,213,  1,  0,161,112, 54,192, 94, 77,156,192,207,107,196,191,
+198,193, 27,149, 21,223,  1,  0, 24, 41, 22,192,  1,197,169,192,191, 68, 84,191, 56,204,100,140,176,237,  1,  0, 73,243, 75,192,
+ 86, 16,156,192,180,150, 33,191,208,186, 67,149,202,241,  1,  0,140,246, 19,192,148, 60,166,192, 11, 70,182, 63,170,205,162,142,
+144, 31,  1,  0, 17, 21, 58,192,224,209,160,192,103,100, 88, 63,199,192, 73,146,167, 18,  1,  0,151,252,  4,192, 71, 89,174,192,
+215, 93, 38, 63,148,210, 55,137,117, 14,  1,  0, 53,176,150,191,238,252,174,192, 37,172,226,191,112,230,198,136, 24,217,  1,  0,
+225,105,214,191,211,177,161,192,160,229, 29,192,193,219,176,145, 39,202,  1,  0, 62,213, 88,191,193, 70,167,192,212,217, 32,192,
+237,237,235,141,220,200,  1,  0,236, 97,130,192,181,248, 34, 64, 49,132, 87, 64,241,166, 77, 55,112, 73,  1,  0,186,103,144,192,
+ 91,  9,234, 63,150,226, 80, 64,101,157,118, 39,110, 71,  1,  0,115, 83,149,192, 25,118, 24, 64, 96,  5, 41, 64, 61,154,198, 51,
+217, 57,  1,  0, 29,112,133,192,168, 45,104, 64, 95, 44,249, 63, 93,165,154, 79,202, 42,  1,  0,192,193, 95,192,221,  5,138, 64,
+ 42,219,239, 63, 81,179,203, 93, 73, 41,  1,  0, 85,126,100,192,103,211,114, 64,187,176, 43, 64,200,177, 12, 83,  8, 58,  1,  0,
+110,189,201,191, 48, 28,154, 64,180,148, 60, 64, 16,222, 64,105,113, 64,  1,  0, 21, 55, 17,192,125, 67,140, 64,118,  8, 75, 64,
+191,206,203, 95, 35, 69,  1,  0, 46,138, 12,192,195,168,156, 64, 99,240, 23, 64, 80,208,202,106,  1, 52,  1,  0,128,101,115,192,
+106,100,142, 64,214,174,205, 62,226,172,245, 96,134,  8,  1,  0,187,250,142,192,178,123,113, 64, 90,120,242, 62,157,158,113, 82,
+ 16, 10,  1,  0, 28, 21,134,192,185,231,130, 64,175,210,133,190,127,164, 72, 89,205,249,  1,  0,225,105,214, 63,211,177,161, 64,
+160,229, 29, 64, 63, 36, 80,110,217, 53,  1,  0, 62,213, 88, 63,193, 70,167, 64,212,217, 32, 64, 19, 18, 21,114, 36, 55,  1,  0,
+ 53,176,150, 63,238,252,174, 64, 37,172,226, 63,144, 25, 58,119,232, 38,  1,  0, 24, 41, 22, 64,  1,197,169, 64,191, 68, 84, 63,
+200, 51,156,115, 80, 18,  1,  0, 73,243, 75, 64, 86, 16,156, 64,180,150, 33, 63, 48, 69,189,106, 54, 14,  1,  0,161,112, 54, 64,
+ 94, 77,156, 64,208,107,196, 63, 58, 62,229,106,235, 32,  1,  0, 31, 84,144, 64, 24, 19, 87, 64, 53, 65,211, 63,192, 98,248, 72,
+ 36, 36,  1,  0,  7, 90,123, 64,107,238,121, 64,115,227,247, 63,231, 85,  2, 85, 39, 42,  1,  0,208, 74,136, 64,231,117,121, 64,
+ 32,193,133, 63,  5, 93,218, 84,  4, 23,  1,  0, 17, 21, 58, 64,224,209,160, 64,103,100, 88,191, 57, 63,183,109, 89,237,  1,  0,
+151,252,  4, 64, 71, 89,174, 64,215, 93, 38,191,108, 45,201,118,139,241,  1,  0,140,246, 19, 64,148, 60,166, 64, 11, 70,182,191,
+ 86, 50, 94,113,112,224,  1,  0, 95,222,182, 64,178, 32,161, 62, 48, 92,165, 63,166,124, 43,  7, 44, 28,  1,  0, 52,119,179, 64,
+223,204,147, 63,116,141,160, 63, 82,122,159, 25,163, 27,  1,  0,235, 52,185, 64,191,185, 83, 63, 39,176,252, 62, 55,126, 42, 18,
+ 11, 11,  1,  0, 88,178,186, 64,180, 33,226,190, 69,211,165,190,104,127,202,245, 55,249,  1,  0,100,194,181, 64,227, 37,178,191,
+ 65, 51,191,190, 54,124, 29,226, 48,248,  1,  0,241, 83,184, 64, 33,241,117,191,204, 69,248, 62,223,125, 11,235,246,  9,  1,  0,
+ 15,242,157, 64,177, 35, 63,192,242,230,132, 63,131,107,108,190,225, 22,  1,  0, 58,163,169, 64,184,207, 14,192, 43, 92,148, 63,
+136,115, 10,207, 63, 25,  1,  0, 30, 26,167, 64, 62, 11, 42,192,199,163,159, 62,213,113,233,197, 16,  7,  1,  0,185,114,173, 64,
+147, 11,162,191,136,131,237,191, 53,118,147,228, 73,215,  1,  0, 90, 82,178, 64,181,  0,168,190,125, 64,231,191,121,121,179,248,
+ 86,216,  1,  0,140, 68,168, 64,162,100, 57,191, 90, 41, 31,192,158,114, 63,240, 64,201,  1,  0,219,140, 29, 64,164,216,163,192,
+163,160,187, 63,250, 53,106,144,229, 31,  1,  0,  8, 63, 76, 64,149, 92,152,192,201,  6,157, 63, 16, 70, 83,152,237, 26,  1,  0,
+107,200, 50, 64,  4, 21,164,192,143,252, 18, 63, 24, 61, 65,144,195, 12,  1,  0, 29,166,188, 63,167,120,181,192,  4,224,165, 61,
+184, 31,  5,132, 45,  2,  1,  0, 26,186,  9, 63,104,142,186,192,128, 74,126, 62, 87, 12,186,128,164,  5,  1,  0,228,160,145, 63,
+121, 59,181,192,246,252,123, 63,194, 24, 44,132,226, 20,  1,  0,226, 54, 99,191,172,134,174,192, 96, 98,250, 63, 61,236, 18,137,
+253, 42,  1,  0,150,195, 60,189, 46,121,177,192,174,  6,245, 63,177,254,  6,135,200, 41,  1,  0,109, 88, 35,191,129,186,182,192,
+207,  8,152, 63,253,241,128,131, 49, 26,  1,  0,163,114,134, 62, 81, 94,183,192, 73,210,157,191,215,  5, 15,131,212,228,  1,  0,
+253,217,151, 63, 90, 89,178,192,210,246,178,191,170, 25,109,134, 73,225,  1,  0,179,205, 19, 63, 33,145,175,192,102,151,253,191,
+127, 12, 91,136, 72,212,  1,  0,116,166,101,192, 67,107,111,192, 69,233, 47, 64,230,177, 41,174,223, 59,  1,  0,109, 20, 68,192,
+202,  9,139,192,124,255, 29, 64,134,189,225,160,253, 53,  1,  0,230,184,106,192,117, 83,133,192, 76, 95,243, 63, 51,176,  7,165,
+176, 41,  1,  0, 40,177,150,192,101,250, 73,192,104,252,189, 63,247,152,135,187,210, 32,  1,  0, 59, 67,164,192,106,116, 19,192,
+ 96,145,209, 63, 47,144, 43,205,253, 35,  1,  0,118, 31,148,192,144, 99, 46,192, 95,237, 21, 64,160,154,116,196,152, 50,  1,  0,
+115, 48,157,192, 74,183, 33,191, 21,172, 72, 64,209,148,167,242,172, 68,  1,  0,250, 48,151,192,117,157,186,191,236, 37, 74, 64,
+216,152,125,224,232, 68,  1,  0,102, 31,167,192, 18,113,133,191,122,150, 29, 64, 41,142,104,233,247, 53,  1,  0,225,  1,174,192,
+ 65,167, 12,192,199,  1, 38, 62,107,137,240,207, 66,  3,  1,  0,172,156,160,192, 23,121, 66,192,220,253, 53, 60,102,146,228,189,
+  4,  0,  1,  0,  9, 99,168,192,184,173, 32,192,129, 16, 27,191, 29,141, 70,201, 73,242,  1,  0,220, 18, 19,191,168,186, 98, 64,
+ 66,136,148, 64,102,243,131, 77, 18,101,  1,  0, 36,220, 68,191, 24,143,132, 64, 20,105,130, 64,100,239,203, 90,172, 88,  1,  0,
+ 60,255,185,191,215,244,108, 64,129,  7,138, 64,139,224,241, 80,  7, 94,  1,  0, 46,202,247,191, 23,140, 27, 64,116,252,158, 64,
+ 31,214,185, 52,218,108,  1,  0,190, 24,220,191,163,163,202, 63,160,244,171, 64,154,218, 45, 35, 62,117,  1,  0,227,219,133,191,
+172, 47, 17, 64, 93,160,169, 64,141,232, 95, 49,188,115,  1,  0,123, 45, 50, 62,213, 16,230, 62,160,240,186, 64, 39,  4,119,  9,
+147,127,  1,  0,131,119,172, 59,182,209,162, 63,170, 73,183, 64, 45,  0,116, 27,  4,125,  1,  0,165,230, 40,191,246,111, 24, 63,
+ 50,150,185, 64,232,241,240, 12,142,126,  1,  0,100,225, 66,192,146,191,131, 63,152, 18,157, 64, 83,189,128, 22,233,106,  1,  0,
+ 98,140, 80,192,169,205,238, 63, 83, 69,144, 64,189,184,115, 40, 84, 98,  1,  0,177, 39,109,192,154,213,147, 63,239,143,140, 64,
+185,174,  1, 25,169, 95,  1,  0,131,173,128, 64, 50,170, 14, 64,247, 71,105, 64,223, 87,191, 48, 71, 79,  1,  0,202,137,140, 64,
+  4,234, 33, 64,152,117, 60, 64, 53, 96, 36, 55,236, 63,  1,  0, 68,176,115, 64, 85, 49, 68, 64, 65,173, 79, 64, 74, 83,177, 66,
+177, 70,  1,  0, 51, 23, 39, 64, 14,245, 76, 64,105,248,132, 64,229, 56,127, 69, 48, 91,  1,  0,122, 75,254, 63, 17, 36, 50, 64,
+ 83, 70,152, 64,248, 43,210, 60,174,103,  1,  0,190,239, 52, 64,193,186, 22, 64,166,240,145, 64, 96, 61,243, 51,149, 99,  1,  0,
+249,244,213, 63, 10, 33, 52, 63,248, 94,178, 64, 77, 36,236, 14,212,121,  1,  0,230, 80, 22, 64, 50,155,141, 63,108, 95,168, 64,
+  0, 51,253, 23,235,114,  1,  0, 96,113,194, 63,166,184,195, 63, 31,160,174, 64, 51, 33, 16, 33, 28,119,  1,  0,228,119,112, 63,
+ 49, 46,115, 64,186,222,139, 64,107, 20, 31, 83, 42, 95,  1,  0,221, 22,199, 63, 71,211,134, 64, 37,161,113, 64,163, 33,255, 91,
+ 99, 82,  1,  0,170,131, 58, 63, 58,178,140, 64,213,174,115, 64,136, 15, 65, 96,237, 82,  1,  0,116,134,132, 64, 40,130, 40,192,
+237,207, 77, 64,116, 90,110,198,230, 69,  1,  0,232,187,140, 64,  6, 96, 62,192,107,247, 30, 64,247, 95,174,190,233, 53,  1,  0,
+ 37, 61,152, 64,230,  9, 14,192,137,179, 39, 64,172,103, 78,207, 31, 57,  1,  0,189,121,149, 64,142,192,111,191, 76, 95, 90, 64,
+168,101,148,235, 10, 75,  1,  0,254,112,134, 64,126,146,207,190,159, 19,130, 64,238, 91,148,246,143, 88,  1,  0, 12,129,129, 64,
+231,129,173,191,159,125,128, 64,188, 88,231,226,136, 87,  1,  0,220,104, 22, 64,204,221, 40,191,115,137,170, 64,223, 50,169,241,
+146,116,  1,  0,245,120, 56, 64,118,213,154,191, 81,227,158, 64,178, 62,207,229,120,108,  1,  0, 52, 56, 66, 64,206, 40,139,190,
+ 21,116,160, 64,247, 65,238,249,133,109,  1,  0, 61,161,150, 64,107,221, 89, 63,118,113, 89, 64,214,102,175, 18,225, 73,  1,  0,
+ 74,120,165, 64, 95, 78,167, 62,139, 51, 48, 64,202,112,111,  7, 13, 60,  1,  0, 12, 65,162, 64, 11, 84,149, 63,172,202, 44, 64,
+198,110,224, 25,171, 58,  1,  0, 67,138,194,190,177, 97,138,192, 75,158,124, 64,147,247,125,161,230, 85,  1,  0,214, 82, 66,191,
+128,115,152,192,164, 25, 85, 64,255,238,225,151,121, 72,  1,  0,119,155,171, 61,138, 40,155,192,113, 96, 83, 64,133,  1, 61,150,
+ 18, 72,  1,  0,144,237,178, 63, 25,136,136,192,121,  1,113, 64,139, 30, 59,163,185, 82,  1,  0, 68,147,238, 63,166,230,100,192,
+234,  9,136, 64, 50, 40,133,177,199, 92,  1,  0, 30,149,109, 63, 40, 18,111,192,171,100,141, 64,208, 20, 59,174, 62, 96,  1,  0,
+ 45,210,162, 63,233,211,224,191,184, 67,174, 64,185, 27, 29,218, 19,119,  1,  0,158,106, 94, 63,167,106, 30,192,254,240,167, 64,
+ 26, 19, 65,202,149,114,  1,  0, 22,114,229, 63,193, 96, 20,192,253,167,162, 64,236, 38,159,205,  9,111,  1,  0,208, 76, 67, 64,
+ 62,120,111,192, 14, 89, 85, 64,174, 66, 62,174,120, 72,  1,  0,139,220, 37, 64,245,135,141,192,114,173, 54, 64,207, 56,160,159,
+ 47, 62,  1,  0,204,119, 84, 64, 93, 73,130,192,212,107, 38, 64,210, 72, 34,167,105, 56,  1,  0,178,218, 82,192,178,247,  1,191,
+211,129,154, 64,225,183,250,244, 42,105,  1,  0,  0,245,124,192, 27, 32,187,190, 57,  6,138, 64,108,169, 93,248,245, 93,  1,  0,
+ 42, 75,112,192,228, 42,152,191, 25, 44,139, 64,  2,174, 93,230,225, 94,  1,  0,239,222, 43,192,212,226, 11,192,227, 71,151, 64,
+214,197,113,208,159,103,  1,  0,137,207,229,191, 30, 63, 22,192,207,235,161, 64, 68,216, 22,205,129,110,  1,  0,239, 11, 14,192,
+175,114,191,191,254,208,166, 64,124,207,187,222,172,113,  1,  0,163, 78,149,189, 65, 25,137,191,234,102,184, 64,219,254,212,232,
+224,125,  1,  0,208,203,104,191,146,  6,113,191,108,  5,183, 64,119,236,106,235,207,124,  1,  0, 26, 68,251,190,111, 38,228,191,
+114, 48,178, 64,114,245, 94,217,145,121,  1,  0, 76,169,222,191,205,107,104,192,150,142,136, 64,234,217,154,176,226, 92,  1,  0,
+145,143, 39,192,190, 49, 94,192,165, 27,124, 64, 16,199,  8,180,215, 85,  1,  0,130,168,  6,192,190,132,130,192, 12, 96,105, 64,
+ 32,210,152,166, 70, 79,  1,  0, 68, 65, 84, 65,  8,  2,  0,  0,  8,102,196,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  0,  0,  0,
+  3,  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,  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,
+ 88,104,196,  4,  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,  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,  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,  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,  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,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  0, 90,  0,  0, 88,104,196,  4,  0,  0,  0,  0, 53,  0,  0,  0,128,  7,  0,  0,
+  0,  0,  0,  0,162,  0,  0,  0,  0,  0, 35,  0, 42,  0,  0,  0,162,  0,  0,  0,  0,  0, 35,  0, 12,  0,  0,  0,163,  0,  0,  0,
+  0,  0, 35,  0, 42,  0,  0,  0,163,  0,  0,  0,  0,  0, 35,  0,  1,  0,  0,  0,164,  0,  0,  0,  0,  0, 35,  0, 43,  0,  0,  0,
+164,  0,  0,  0,  0,  0, 35,  0, 12,  0,  0,  0,165,  0,  0,  0,  0,  0, 35,  0, 43,  0,  0,  0,165,  0,  0,  0,  0,  0, 35,  0,
+  0,  0,  0,  0,166,  0,  0,  0,  0,  0, 35,  0, 44,  0,  0,  0,166,  0,  0,  0,  0,  0, 35,  0, 13,  0,  0,  0,167,  0,  0,  0,
+  0,  0, 35,  0, 44,  0,  0,  0,167,  0,  0,  0,  0,  0, 35,  0,  2,  0,  0,  0,168,  0,  0,  0,  0,  0, 35,  0, 45,  0,  0,  0,
+168,  0,  0,  0,  0,  0, 35,  0, 13,  0,  0,  0,169,  0,  0,  0,  0,  0, 35,  0, 45,  0,  0,  0,169,  0,  0,  0,  0,  0, 35,  0,
+  1,  0,  0,  0,170,  0,  0,  0,  0,  0, 35,  0, 46,  0,  0,  0,170,  0,  0,  0,  0,  0, 35,  0, 14,  0,  0,  0,171,  0,  0,  0,
+  0,  0, 35,  0, 46,  0,  0,  0,171,  0,  0,  0,  0,  0, 35,  0,  2,  0,  0,  0,172,  0,  0,  0,  0,  0, 35,  0, 47,  0,  0,  0,
+172,  0,  0,  0,  0,  0, 35,  0, 14,  0,  0,  0,173,  0,  0,  0,  0,  0, 35,  0, 47,  0,  0,  0,173,  0,  0,  0,  0,  0, 35,  0,
+  0,  0,  0,  0,174,  0,  0,  0,  0,  0, 35,  0, 48,  0,  0,  0,174,  0,  0,  0,  0,  0, 35,  0, 15,  0,  0,  0,175,  0,  0,  0,
+  0,  0, 35,  0, 48,  0,  0,  0,175,  0,  0,  0,  0,  0, 35,  0,  5,  0,  0,  0,176,  0,  0,  0,  0,  0, 35,  0, 49,  0,  0,  0,
+176,  0,  0,  0,  0,  0, 35,  0, 15,  0,  0,  0,177,  0,  0,  0,  0,  0, 35,  0, 49,  0,  0,  0,177,  0,  0,  0,  0,  0, 35,  0,
+  1,  0,  0,  0,178,  0,  0,  0,  0,  0, 35,  0, 50,  0,  0,  0,178,  0,  0,  0,  0,  0, 35,  0, 16,  0,  0,  0,179,  0,  0,  0,
+  0,  0, 35,  0, 50,  0,  0,  0,179,  0,  0,  0,  0,  0, 35,  0,  5,  0,  0,  0,180,  0,  0,  0,  0,  0, 35,  0, 51,  0,  0,  0,
+180,  0,  0,  0,  0,  0, 35,  0, 16,  0,  0,  0,181,  0,  0,  0,  0,  0, 35,  0, 51,  0,  0,  0,181,  0,  0,  0,  0,  0, 35,  0,
+  0,  0,  0,  0,182,  0,  0,  0,  0,  0, 35,  0, 52,  0,  0,  0,182,  0,  0,  0,  0,  0, 35,  0, 17,  0,  0,  0,183,  0,  0,  0,
+  0,  0, 35,  0, 52,  0,  0,  0,183,  0,  0,  0,  0,  0, 35,  0,  3,  0,  0,  0,184,  0,  0,  0,  0,  0, 35,  0, 53,  0,  0,  0,
+184,  0,  0,  0,  0,  0, 35,  0, 17,  0,  0,  0,185,  0,  0,  0,  0,  0, 35,  0, 53,  0,  0,  0,185,  0,  0,  0,  0,  0, 35,  0,
+  2,  0,  0,  0,186,  0,  0,  0,  0,  0, 35,  0, 54,  0,  0,  0,186,  0,  0,  0,  0,  0, 35,  0, 18,  0,  0,  0,187,  0,  0,  0,
+  0,  0, 35,  0, 54,  0,  0,  0,187,  0,  0,  0,  0,  0, 35,  0,  3,  0,  0,  0,188,  0,  0,  0,  0,  0, 35,  0, 55,  0,  0,  0,
+188,  0,  0,  0,  0,  0, 35,  0, 18,  0,  0,  0,189,  0,  0,  0,  0,  0, 35,  0, 55,  0,  0,  0,189,  0,  0,  0,  0,  0, 35,  0,
+  0,  0,  0,  0,190,  0,  0,  0,  0,  0, 35,  0, 56,  0,  0,  0,190,  0,  0,  0,  0,  0, 35,  0, 19,  0,  0,  0,191,  0,  0,  0,
+  0,  0, 35,  0, 56,  0,  0,  0,191,  0,  0,  0,  0,  0, 35,  0,  4,  0,  0,  0,192,  0,  0,  0,  0,  0, 35,  0, 57,  0,  0,  0,
+192,  0,  0,  0,  0,  0, 35,  0, 19,  0,  0,  0,193,  0,  0,  0,  0,  0, 35,  0, 57,  0,  0,  0,193,  0,  0,  0,  0,  0, 35,  0,
+  3,  0,  0,  0,194,  0,  0,  0,  0,  0, 35,  0, 58,  0,  0,  0,194,  0,  0,  0,  0,  0, 35,  0, 20,  0,  0,  0,195,  0,  0,  0,
+  0,  0, 35,  0, 58,  0,  0,  0,195,  0,  0,  0,  0,  0, 35,  0,  4,  0,  0,  0,196,  0,  0,  0,  0,  0, 35,  0, 59,  0,  0,  0,
+196,  0,  0,  0,  0,  0, 35,  0, 20,  0,  0,  0,197,  0,  0,  0,  0,  0, 35,  0, 59,  0,  0,  0,197,  0,  0,  0,  0,  0, 35,  0,
+  4,  0,  0,  0,198,  0,  0,  0,  0,  0, 35,  0, 60,  0,  0,  0,198,  0,  0,  0,  0,  0, 35,  0, 21,  0,  0,  0,199,  0,  0,  0,
+  0,  0, 35,  0, 60,  0,  0,  0,199,  0,  0,  0,  0,  0, 35,  0,  5,  0,  0,  0,200,  0,  0,  0,  0,  0, 35,  0, 61,  0,  0,  0,
+200,  0,  0,  0,  0,  0, 35,  0, 21,  0,  0,  0,201,  0,  0,  0,  0,  0, 35,  0, 61,  0,  0,  0,201,  0,  0,  0,  0,  0, 35,  0,
+  5,  0,  0,  0,202,  0,  0,  0,  0,  0, 35,  0, 62,  0,  0,  0,202,  0,  0,  0,  0,  0, 35,  0, 22,  0,  0,  0,203,  0,  0,  0,
+  0,  0, 35,  0, 62,  0,  0,  0,203,  0,  0,  0,  0,  0, 35,  0, 10,  0,  0,  0,204,  0,  0,  0,  0,  0, 35,  0, 63,  0,  0,  0,
+204,  0,  0,  0,  0,  0, 35,  0, 22,  0,  0,  0,205,  0,  0,  0,  0,  0, 35,  0, 63,  0,  0,  0,205,  0,  0,  0,  0,  0, 35,  0,
+  1,  0,  0,  0,206,  0,  0,  0,  0,  0, 35,  0, 64,  0,  0,  0,206,  0,  0,  0,  0,  0, 35,  0, 23,  0,  0,  0,207,  0,  0,  0,
+  0,  0, 35,  0, 64,  0,  0,  0,207,  0,  0,  0,  0,  0, 35,  0, 10,  0,  0,  0,208,  0,  0,  0,  0,  0, 35,  0, 65,  0,  0,  0,
+208,  0,  0,  0,  0,  0, 35,  0, 23,  0,  0,  0,209,  0,  0,  0,  0,  0, 35,  0, 65,  0,  0,  0,209,  0,  0,  0,  0,  0, 35,  0,
+  1,  0,  0,  0,210,  0,  0,  0,  0,  0, 35,  0, 66,  0,  0,  0,210,  0,  0,  0,  0,  0, 35,  0, 24,  0,  0,  0,211,  0,  0,  0,
+  0,  0, 35,  0, 66,  0,  0,  0,211,  0,  0,  0,  0,  0, 35,  0,  6,  0,  0,  0,212,  0,  0,  0,  0,  0, 35,  0, 67,  0,  0,  0,
+212,  0,  0,  0,  0,  0, 35,  0, 24,  0,  0,  0,213,  0,  0,  0,  0,  0, 35,  0, 67,  0,  0,  0,213,  0,  0,  0,  0,  0, 35,  0,
+  2,  0,  0,  0,214,  0,  0,  0,  0,  0, 35,  0, 68,  0,  0,  0,214,  0,  0,  0,  0,  0, 35,  0, 25,  0,  0,  0,215,  0,  0,  0,
+  0,  0, 35,  0, 68,  0,  0,  0,215,  0,  0,  0,  0,  0, 35,  0,  6,  0,  0,  0,216,  0,  0,  0,  0,  0, 35,  0, 69,  0,  0,  0,
+216,  0,  0,  0,  0,  0, 35,  0, 25,  0,  0,  0,217,  0,  0,  0,  0,  0, 35,  0, 69,  0,  0,  0,217,  0,  0,  0,  0,  0, 35,  0,
+  2,  0,  0,  0,218,  0,  0,  0,  0,  0, 35,  0, 70,  0,  0,  0,218,  0,  0,  0,  0,  0, 35,  0, 26,  0,  0,  0,219,  0,  0,  0,
+  0,  0, 35,  0, 70,  0,  0,  0,219,  0,  0,  0,  0,  0, 35,  0,  7,  0,  0,  0,220,  0,  0,  0,  0,  0, 35,  0, 71,  0,  0,  0,
+220,  0,  0,  0,  0,  0, 35,  0, 26,  0,  0,  0,221,  0,  0,  0,  0,  0, 35,  0, 71,  0,  0,  0,221,  0,  0,  0,  0,  0, 35,  0,
+  3,  0,  0,  0,222,  0,  0,  0,  0,  0, 35,  0, 72,  0,  0,  0,222,  0,  0,  0,  0,  0, 35,  0, 27,  0,  0,  0,223,  0,  0,  0,
+  0,  0, 35,  0, 72,  0,  0,  0,223,  0,  0,  0,  0,  0, 35,  0,  7,  0,  0,  0,224,  0,  0,  0,  0,  0, 35,  0, 73,  0,  0,  0,
+224,  0,  0,  0,  0,  0, 35,  0, 27,  0,  0,  0,225,  0,  0,  0,  0,  0, 35,  0, 73,  0,  0,  0,225,  0,  0,  0,  0,  0, 35,  0,
+  3,  0,  0,  0,226,  0,  0,  0,  0,  0, 35,  0, 74,  0,  0,  0,226,  0,  0,  0,  0,  0, 35,  0, 28,  0,  0,  0,227,  0,  0,  0,
+  0,  0, 35,  0, 74,  0,  0,  0,227,  0,  0,  0,  0,  0, 35,  0,  8,  0,  0,  0,228,  0,  0,  0,  0,  0, 35,  0, 75,  0,  0,  0,
+228,  0,  0,  0,  0,  0, 35,  0, 28,  0,  0,  0,229,  0,  0,  0,  0,  0, 35,  0, 75,  0,  0,  0,229,  0,  0,  0,  0,  0, 35,  0,
+  4,  0,  0,  0,230,  0,  0,  0,  0,  0, 35,  0, 76,  0,  0,  0,230,  0,  0,  0,  0,  0, 35,  0, 29,  0,  0,  0,231,  0,  0,  0,
+  0,  0, 35,  0, 76,  0,  0,  0,231,  0,  0,  0,  0,  0, 35,  0,  8,  0,  0,  0,232,  0,  0,  0,  0,  0, 35,  0, 77,  0,  0,  0,
+232,  0,  0,  0,  0,  0, 35,  0, 29,  0,  0,  0,233,  0,  0,  0,  0,  0, 35,  0, 77,  0,  0,  0,233,  0,  0,  0,  0,  0, 35,  0,
+  4,  0,  0,  0,234,  0,  0,  0,  0,  0, 35,  0, 78,  0,  0,  0,234,  0,  0,  0,  0,  0, 35,  0, 30,  0,  0,  0,235,  0,  0,  0,
+  0,  0, 35,  0, 78,  0,  0,  0,235,  0,  0,  0,  0,  0, 35,  0,  9,  0,  0,  0,236,  0,  0,  0,  0,  0, 35,  0, 79,  0,  0,  0,
+236,  0,  0,  0,  0,  0, 35,  0, 30,  0,  0,  0,237,  0,  0,  0,  0,  0, 35,  0, 79,  0,  0,  0,237,  0,  0,  0,  0,  0, 35,  0,
+  5,  0,  0,  0,238,  0,  0,  0,  0,  0, 35,  0, 80,  0,  0,  0,238,  0,  0,  0,  0,  0, 35,  0, 31,  0,  0,  0,239,  0,  0,  0,
+  0,  0, 35,  0, 80,  0,  0,  0,239,  0,  0,  0,  0,  0, 35,  0,  9,  0,  0,  0,240,  0,  0,  0,  0,  0, 35,  0, 81,  0,  0,  0,
+240,  0,  0,  0,  0,  0, 35,  0, 31,  0,  0,  0,241,  0,  0,  0,  0,  0, 35,  0, 81,  0,  0,  0,241,  0,  0,  0,  0,  0, 35,  0,
+  6,  0,  0,  0,242,  0,  0,  0,  0,  0, 35,  0, 82,  0,  0,  0,242,  0,  0,  0,  0,  0, 35,  0, 32,  0,  0,  0,243,  0,  0,  0,
+  0,  0, 35,  0, 82,  0,  0,  0,243,  0,  0,  0,  0,  0, 35,  0, 10,  0,  0,  0,244,  0,  0,  0,  0,  0, 35,  0, 83,  0,  0,  0,
+244,  0,  0,  0,  0,  0, 35,  0, 32,  0,  0,  0,245,  0,  0,  0,  0,  0, 35,  0, 83,  0,  0,  0,245,  0,  0,  0,  0,  0, 35,  0,
+  6,  0,  0,  0,246,  0,  0,  0,  0,  0, 35,  0, 84,  0,  0,  0,246,  0,  0,  0,  0,  0, 35,  0, 33,  0,  0,  0,247,  0,  0,  0,
+  0,  0, 35,  0, 84,  0,  0,  0,247,  0,  0,  0,  0,  0, 35,  0,  7,  0,  0,  0,248,  0,  0,  0,  0,  0, 35,  0, 85,  0,  0,  0,
+248,  0,  0,  0,  0,  0, 35,  0, 33,  0,  0,  0,249,  0,  0,  0,  0,  0, 35,  0, 85,  0,  0,  0,249,  0,  0,  0,  0,  0, 35,  0,
+  7,  0,  0,  0,250,  0,  0,  0,  0,  0, 35,  0, 86,  0,  0,  0,250,  0,  0,  0,  0,  0, 35,  0, 34,  0,  0,  0,251,  0,  0,  0,
+  0,  0, 35,  0, 86,  0,  0,  0,251,  0,  0,  0,  0,  0, 35,  0,  8,  0,  0,  0,252,  0,  0,  0,  0,  0, 35,  0, 87,  0,  0,  0,
+252,  0,  0,  0,  0,  0, 35,  0, 34,  0,  0,  0,253,  0,  0,  0,  0,  0, 35,  0, 87,  0,  0,  0,253,  0,  0,  0,  0,  0, 35,  0,
+  8,  0,  0,  0,254,  0,  0,  0,  0,  0, 35,  0, 88,  0,  0,  0,254,  0,  0,  0,  0,  0, 35,  0, 35,  0,  0,  0,255,  0,  0,  0,
+  0,  0, 35,  0, 88,  0,  0,  0,255,  0,  0,  0,  0,  0, 35,  0,  9,  0,  0,  0,  0,  1,  0,  0,  0,  0, 35,  0, 89,  0,  0,  0,
+  0,  1,  0,  0,  0,  0, 35,  0, 35,  0,  0,  0,  1,  1,  0,  0,  0,  0, 35,  0, 89,  0,  0,  0,  1,  1,  0,  0,  0,  0, 35,  0,
+  9,  0,  0,  0,  2,  1,  0,  0,  0,  0, 35,  0, 90,  0,  0,  0,  2,  1,  0,  0,  0,  0, 35,  0, 36,  0,  0,  0,  3,  1,  0,  0,
+  0,  0, 35,  0, 90,  0,  0,  0,  3,  1,  0,  0,  0,  0, 35,  0, 10,  0,  0,  0,  4,  1,  0,  0,  0,  0, 35,  0, 91,  0,  0,  0,
+  4,  1,  0,  0,  0,  0, 35,  0, 36,  0,  0,  0,  5,  1,  0,  0,  0,  0, 35,  0, 91,  0,  0,  0,  5,  1,  0,  0,  0,  0, 35,  0,
+ 10,  0,  0,  0,  6,  1,  0,  0,  0,  0, 35,  0, 92,  0,  0,  0,  6,  1,  0,  0,  0,  0, 35,  0, 37,  0,  0,  0,  7,  1,  0,  0,
+  0,  0, 35,  0, 92,  0,  0,  0,  7,  1,  0,  0,  0,  0, 35,  0, 11,  0,  0,  0,  8,  1,  0,  0,  0,  0, 35,  0, 93,  0,  0,  0,
+  8,  1,  0,  0,  0,  0, 35,  0, 37,  0,  0,  0,  9,  1,  0,  0,  0,  0, 35,  0, 93,  0,  0,  0,  9,  1,  0,  0,  0,  0, 35,  0,
+  6,  0,  0,  0, 10,  1,  0,  0,  0,  0, 35,  0, 94,  0,  0,  0, 10,  1,  0,  0,  0,  0, 35,  0, 38,  0,  0,  0, 11,  1,  0,  0,
+  0,  0, 35,  0, 94,  0,  0,  0, 11,  1,  0,  0,  0,  0, 35,  0, 11,  0,  0,  0, 12,  1,  0,  0,  0,  0, 35,  0, 95,  0,  0,  0,
+ 12,  1,  0,  0,  0,  0, 35,  0, 38,  0,  0,  0, 13,  1,  0,  0,  0,  0, 35,  0, 95,  0,  0,  0, 13,  1,  0,  0,  0,  0, 35,  0,
+  7,  0,  0,  0, 14,  1,  0,  0,  0,  0, 35,  0, 96,  0,  0,  0, 14,  1,  0,  0,  0,  0, 35,  0, 39,  0,  0,  0, 15,  1,  0,  0,
+  0,  0, 35,  0, 96,  0,  0,  0, 15,  1,  0,  0,  0,  0, 35,  0, 11,  0,  0,  0, 16,  1,  0,  0,  0,  0, 35,  0, 97,  0,  0,  0,
+ 16,  1,  0,  0,  0,  0, 35,  0, 39,  0,  0,  0, 17,  1,  0,  0,  0,  0, 35,  0, 97,  0,  0,  0, 17,  1,  0,  0,  0,  0, 35,  0,
+  8,  0,  0,  0, 18,  1,  0,  0,  0,  0, 35,  0, 98,  0,  0,  0, 18,  1,  0,  0,  0,  0, 35,  0, 40,  0,  0,  0, 19,  1,  0,  0,
+  0,  0, 35,  0, 98,  0,  0,  0, 19,  1,  0,  0,  0,  0, 35,  0, 11,  0,  0,  0, 20,  1,  0,  0,  0,  0, 35,  0, 99,  0,  0,  0,
+ 20,  1,  0,  0,  0,  0, 35,  0, 40,  0,  0,  0, 21,  1,  0,  0,  0,  0, 35,  0, 99,  0,  0,  0, 21,  1,  0,  0,  0,  0, 35,  0,
+  9,  0,  0,  0, 22,  1,  0,  0,  0,  0, 35,  0,100,  0,  0,  0, 22,  1,  0,  0,  0,  0, 35,  0, 41,  0,  0,  0, 23,  1,  0,  0,
+  0,  0, 35,  0,100,  0,  0,  0, 23,  1,  0,  0,  0,  0, 35,  0, 11,  0,  0,  0, 24,  1,  0,  0,  0,  0, 35,  0,101,  0,  0,  0,
+ 24,  1,  0,  0,  0,  0, 35,  0, 41,  0,  0,  0, 25,  1,  0,  0,  0,  0, 35,  0,101,  0,  0,  0, 25,  1,  0,  0,  0,  0, 35,  0,
+ 12,  0,  0,  0, 26,  1,  0,  0,  0,  0, 35,  0,102,  0,  0,  0, 26,  1,  0,  0,  0,  0, 35,  0, 14,  0,  0,  0, 27,  1,  0,  0,
+  0,  0, 35,  0,102,  0,  0,  0, 27,  1,  0,  0,  0,  0, 35,  0, 12,  0,  0,  0, 28,  1,  0,  0,  0,  0, 35,  0,103,  0,  0,  0,
+ 28,  1,  0,  0,  0,  0, 35,  0, 13,  0,  0,  0, 29,  1,  0,  0,  0,  0, 35,  0,103,  0,  0,  0, 29,  1,  0,  0,  0,  0, 35,  0,
+ 13,  0,  0,  0, 30,  1,  0,  0,  0,  0, 35,  0,104,  0,  0,  0, 30,  1,  0,  0,  0,  0, 35,  0, 14,  0,  0,  0, 31,  1,  0,  0,
+  0,  0, 35,  0,104,  0,  0,  0, 31,  1,  0,  0,  0,  0, 35,  0, 12,  0,  0,  0, 32,  1,  0,  0,  0,  0, 35,  0,105,  0,  0,  0,
+ 32,  1,  0,  0,  0,  0, 35,  0, 16,  0,  0,  0, 33,  1,  0,  0,  0,  0, 35,  0,105,  0,  0,  0, 33,  1,  0,  0,  0,  0, 35,  0,
+ 12,  0,  0,  0, 34,  1,  0,  0,  0,  0, 35,  0,106,  0,  0,  0, 34,  1,  0,  0,  0,  0, 35,  0, 15,  0,  0,  0, 35,  1,  0,  0,
+  0,  0, 35,  0,106,  0,  0,  0, 35,  1,  0,  0,  0,  0, 35,  0, 15,  0,  0,  0, 36,  1,  0,  0,  0,  0, 35,  0,107,  0,  0,  0,
+ 36,  1,  0,  0,  0,  0, 35,  0, 16,  0,  0,  0, 37,  1,  0,  0,  0,  0, 35,  0,107,  0,  0,  0, 37,  1,  0,  0,  0,  0, 35,  0,
+ 13,  0,  0,  0, 38,  1,  0,  0,  0,  0, 35,  0,108,  0,  0,  0, 38,  1,  0,  0,  0,  0, 35,  0, 18,  0,  0,  0, 39,  1,  0,  0,
+  0,  0, 35,  0,108,  0,  0,  0, 39,  1,  0,  0,  0,  0, 35,  0, 13,  0,  0,  0, 40,  1,  0,  0,  0,  0, 35,  0,109,  0,  0,  0,
+ 40,  1,  0,  0,  0,  0, 35,  0, 17,  0,  0,  0, 41,  1,  0,  0,  0,  0, 35,  0,109,  0,  0,  0, 41,  1,  0,  0,  0,  0, 35,  0,
+ 17,  0,  0,  0, 42,  1,  0,  0,  0,  0, 35,  0,110,  0,  0,  0, 42,  1,  0,  0,  0,  0, 35,  0, 18,  0,  0,  0, 43,  1,  0,  0,
+  0,  0, 35,  0,110,  0,  0,  0, 43,  1,  0,  0,  0,  0, 35,  0, 17,  0,  0,  0, 44,  1,  0,  0,  0,  0, 35,  0,111,  0,  0,  0,
+ 44,  1,  0,  0,  0,  0, 35,  0, 20,  0,  0,  0, 45,  1,  0,  0,  0,  0, 35,  0,111,  0,  0,  0, 45,  1,  0,  0,  0,  0, 35,  0,
+ 17,  0,  0,  0, 46,  1,  0,  0,  0,  0, 35,  0,112,  0,  0,  0, 46,  1,  0,  0,  0,  0, 35,  0, 19,  0,  0,  0, 47,  1,  0,  0,
+  0,  0, 35,  0,112,  0,  0,  0, 47,  1,  0,  0,  0,  0, 35,  0, 19,  0,  0,  0, 48,  1,  0,  0,  0,  0, 35,  0,113,  0,  0,  0,
+ 48,  1,  0,  0,  0,  0, 35,  0, 20,  0,  0,  0, 49,  1,  0,  0,  0,  0, 35,  0,113,  0,  0,  0, 49,  1,  0,  0,  0,  0, 35,  0,
+ 19,  0,  0,  0, 50,  1,  0,  0,  0,  0, 35,  0,114,  0,  0,  0, 50,  1,  0,  0,  0,  0, 35,  0, 21,  0,  0,  0, 51,  1,  0,  0,
+  0,  0, 35,  0,114,  0,  0,  0, 51,  1,  0,  0,  0,  0, 35,  0, 15,  0,  0,  0, 52,  1,  0,  0,  0,  0, 35,  0,115,  0,  0,  0,
+ 52,  1,  0,  0,  0,  0, 35,  0, 19,  0,  0,  0, 53,  1,  0,  0,  0,  0, 35,  0,115,  0,  0,  0, 53,  1,  0,  0,  0,  0, 35,  0,
+ 15,  0,  0,  0, 54,  1,  0,  0,  0,  0, 35,  0,116,  0,  0,  0, 54,  1,  0,  0,  0,  0, 35,  0, 21,  0,  0,  0, 55,  1,  0,  0,
+  0,  0, 35,  0,116,  0,  0,  0, 55,  1,  0,  0,  0,  0, 35,  0, 16,  0,  0,  0, 56,  1,  0,  0,  0,  0, 35,  0,117,  0,  0,  0,
+ 56,  1,  0,  0,  0,  0, 35,  0, 23,  0,  0,  0, 57,  1,  0,  0,  0,  0, 35,  0,117,  0,  0,  0, 57,  1,  0,  0,  0,  0, 35,  0,
+ 16,  0,  0,  0, 58,  1,  0,  0,  0,  0, 35,  0,118,  0,  0,  0, 58,  1,  0,  0,  0,  0, 35,  0, 22,  0,  0,  0, 59,  1,  0,  0,
+  0,  0, 35,  0,118,  0,  0,  0, 59,  1,  0,  0,  0,  0, 35,  0, 22,  0,  0,  0, 60,  1,  0,  0,  0,  0, 35,  0,119,  0,  0,  0,
+ 60,  1,  0,  0,  0,  0, 35,  0, 23,  0,  0,  0, 61,  1,  0,  0,  0,  0, 35,  0,119,  0,  0,  0, 61,  1,  0,  0,  0,  0, 35,  0,
+ 14,  0,  0,  0, 62,  1,  0,  0,  0,  0, 35,  0,120,  0,  0,  0, 62,  1,  0,  0,  0,  0, 35,  0, 25,  0,  0,  0, 63,  1,  0,  0,
+  0,  0, 35,  0,120,  0,  0,  0, 63,  1,  0,  0,  0,  0, 35,  0, 14,  0,  0,  0, 64,  1,  0,  0,  0,  0, 35,  0,121,  0,  0,  0,
+ 64,  1,  0,  0,  0,  0, 35,  0, 24,  0,  0,  0, 65,  1,  0,  0,  0,  0, 35,  0,121,  0,  0,  0, 65,  1,  0,  0,  0,  0, 35,  0,
+ 24,  0,  0,  0, 66,  1,  0,  0,  0,  0, 35,  0,122,  0,  0,  0, 66,  1,  0,  0,  0,  0, 35,  0, 25,  0,  0,  0, 67,  1,  0,  0,
+  0,  0, 35,  0,122,  0,  0,  0, 67,  1,  0,  0,  0,  0, 35,  0, 18,  0,  0,  0, 68,  1,  0,  0,  0,  0, 35,  0,123,  0,  0,  0,
+ 68,  1,  0,  0,  0,  0, 35,  0, 27,  0,  0,  0, 69,  1,  0,  0,  0,  0, 35,  0,123,  0,  0,  0, 69,  1,  0,  0,  0,  0, 35,  0,
+ 18,  0,  0,  0, 70,  1,  0,  0,  0,  0, 35,  0,124,  0,  0,  0, 70,  1,  0,  0,  0,  0, 35,  0, 26,  0,  0,  0, 71,  1,  0,  0,
+  0,  0, 35,  0,124,  0,  0,  0, 71,  1,  0,  0,  0,  0, 35,  0, 26,  0,  0,  0, 72,  1,  0,  0,  0,  0, 35,  0,125,  0,  0,  0,
+ 72,  1,  0,  0,  0,  0, 35,  0, 27,  0,  0,  0, 73,  1,  0,  0,  0,  0, 35,  0,125,  0,  0,  0, 73,  1,  0,  0,  0,  0, 35,  0,
+ 20,  0,  0,  0, 74,  1,  0,  0,  0,  0, 35,  0,126,  0,  0,  0, 74,  1,  0,  0,  0,  0, 35,  0, 29,  0,  0,  0, 75,  1,  0,  0,
+  0,  0, 35,  0,126,  0,  0,  0, 75,  1,  0,  0,  0,  0, 35,  0, 20,  0,  0,  0, 76,  1,  0,  0,  0,  0, 35,  0,127,  0,  0,  0,
+ 76,  1,  0,  0,  0,  0, 35,  0, 28,  0,  0,  0, 77,  1,  0,  0,  0,  0, 35,  0,127,  0,  0,  0, 77,  1,  0,  0,  0,  0, 35,  0,
+ 28,  0,  0,  0, 78,  1,  0,  0,  0,  0, 35,  0,128,  0,  0,  0, 78,  1,  0,  0,  0,  0, 35,  0, 29,  0,  0,  0, 79,  1,  0,  0,
+  0,  0, 35,  0,128,  0,  0,  0, 79,  1,  0,  0,  0,  0, 35,  0, 21,  0,  0,  0, 80,  1,  0,  0,  0,  0, 35,  0,129,  0,  0,  0,
+ 80,  1,  0,  0,  0,  0, 35,  0, 31,  0,  0,  0, 81,  1,  0,  0,  0,  0, 35,  0,129,  0,  0,  0, 81,  1,  0,  0,  0,  0, 35,  0,
+ 21,  0,  0,  0, 82,  1,  0,  0,  0,  0, 35,  0,130,  0,  0,  0, 82,  1,  0,  0,  0,  0, 35,  0, 30,  0,  0,  0, 83,  1,  0,  0,
+  0,  0, 35,  0,130,  0,  0,  0, 83,  1,  0,  0,  0,  0, 35,  0, 30,  0,  0,  0, 84,  1,  0,  0,  0,  0, 35,  0,131,  0,  0,  0,
+ 84,  1,  0,  0,  0,  0, 35,  0, 31,  0,  0,  0, 85,  1,  0,  0,  0,  0, 35,  0,131,  0,  0,  0, 85,  1,  0,  0,  0,  0, 35,  0,
+ 23,  0,  0,  0, 86,  1,  0,  0,  0,  0, 35,  0,132,  0,  0,  0, 86,  1,  0,  0,  0,  0, 35,  0, 32,  0,  0,  0, 87,  1,  0,  0,
+  0,  0, 35,  0,132,  0,  0,  0, 87,  1,  0,  0,  0,  0, 35,  0, 23,  0,  0,  0, 88,  1,  0,  0,  0,  0, 35,  0,133,  0,  0,  0,
+ 88,  1,  0,  0,  0,  0, 35,  0, 24,  0,  0,  0, 89,  1,  0,  0,  0,  0, 35,  0,133,  0,  0,  0, 89,  1,  0,  0,  0,  0, 35,  0,
+ 24,  0,  0,  0, 90,  1,  0,  0,  0,  0, 35,  0,134,  0,  0,  0, 90,  1,  0,  0,  0,  0, 35,  0, 32,  0,  0,  0, 91,  1,  0,  0,
+  0,  0, 35,  0,134,  0,  0,  0, 91,  1,  0,  0,  0,  0, 35,  0, 25,  0,  0,  0, 92,  1,  0,  0,  0,  0, 35,  0,135,  0,  0,  0,
+ 92,  1,  0,  0,  0,  0, 35,  0, 33,  0,  0,  0, 93,  1,  0,  0,  0,  0, 35,  0,135,  0,  0,  0, 93,  1,  0,  0,  0,  0, 35,  0,
+ 25,  0,  0,  0, 94,  1,  0,  0,  0,  0, 35,  0,136,  0,  0,  0, 94,  1,  0,  0,  0,  0, 35,  0, 26,  0,  0,  0, 95,  1,  0,  0,
+  0,  0, 35,  0,136,  0,  0,  0, 95,  1,  0,  0,  0,  0, 35,  0, 26,  0,  0,  0, 96,  1,  0,  0,  0,  0, 35,  0,137,  0,  0,  0,
+ 96,  1,  0,  0,  0,  0, 35,  0, 33,  0,  0,  0, 97,  1,  0,  0,  0,  0, 35,  0,137,  0,  0,  0, 97,  1,  0,  0,  0,  0, 35,  0,
+ 27,  0,  0,  0, 98,  1,  0,  0,  0,  0, 35,  0,138,  0,  0,  0, 98,  1,  0,  0,  0,  0, 35,  0, 34,  0,  0,  0, 99,  1,  0,  0,
+  0,  0, 35,  0,138,  0,  0,  0, 99,  1,  0,  0,  0,  0, 35,  0, 27,  0,  0,  0,100,  1,  0,  0,  0,  0, 35,  0,139,  0,  0,  0,
+100,  1,  0,  0,  0,  0, 35,  0, 28,  0,  0,  0,101,  1,  0,  0,  0,  0, 35,  0,139,  0,  0,  0,101,  1,  0,  0,  0,  0, 35,  0,
+ 28,  0,  0,  0,102,  1,  0,  0,  0,  0, 35,  0,140,  0,  0,  0,102,  1,  0,  0,  0,  0, 35,  0, 34,  0,  0,  0,103,  1,  0,  0,
+  0,  0, 35,  0,140,  0,  0,  0,103,  1,  0,  0,  0,  0, 35,  0, 29,  0,  0,  0,104,  1,  0,  0,  0,  0, 35,  0,141,  0,  0,  0,
+104,  1,  0,  0,  0,  0, 35,  0, 35,  0,  0,  0,105,  1,  0,  0,  0,  0, 35,  0,141,  0,  0,  0,105,  1,  0,  0,  0,  0, 35,  0,
+ 29,  0,  0,  0,106,  1,  0,  0,  0,  0, 35,  0,142,  0,  0,  0,106,  1,  0,  0,  0,  0, 35,  0, 30,  0,  0,  0,107,  1,  0,  0,
+  0,  0, 35,  0,142,  0,  0,  0,107,  1,  0,  0,  0,  0, 35,  0, 30,  0,  0,  0,108,  1,  0,  0,  0,  0, 35,  0,143,  0,  0,  0,
+108,  1,  0,  0,  0,  0, 35,  0, 35,  0,  0,  0,109,  1,  0,  0,  0,  0, 35,  0,143,  0,  0,  0,109,  1,  0,  0,  0,  0, 35,  0,
+ 31,  0,  0,  0,110,  1,  0,  0,  0,  0, 35,  0,144,  0,  0,  0,110,  1,  0,  0,  0,  0, 35,  0, 36,  0,  0,  0,111,  1,  0,  0,
+  0,  0, 35,  0,144,  0,  0,  0,111,  1,  0,  0,  0,  0, 35,  0, 22,  0,  0,  0,112,  1,  0,  0,  0,  0, 35,  0,145,  0,  0,  0,
+112,  1,  0,  0,  0,  0, 35,  0, 31,  0,  0,  0,113,  1,  0,  0,  0,  0, 35,  0,145,  0,  0,  0,113,  1,  0,  0,  0,  0, 35,  0,
+ 22,  0,  0,  0,114,  1,  0,  0,  0,  0, 35,  0,146,  0,  0,  0,114,  1,  0,  0,  0,  0, 35,  0, 36,  0,  0,  0,115,  1,  0,  0,
+  0,  0, 35,  0,146,  0,  0,  0,115,  1,  0,  0,  0,  0, 35,  0, 32,  0,  0,  0,116,  1,  0,  0,  0,  0, 35,  0,147,  0,  0,  0,
+116,  1,  0,  0,  0,  0, 35,  0, 38,  0,  0,  0,117,  1,  0,  0,  0,  0, 35,  0,147,  0,  0,  0,117,  1,  0,  0,  0,  0, 35,  0,
+ 32,  0,  0,  0,118,  1,  0,  0,  0,  0, 35,  0,148,  0,  0,  0,118,  1,  0,  0,  0,  0, 35,  0, 37,  0,  0,  0,119,  1,  0,  0,
+  0,  0, 35,  0,148,  0,  0,  0,119,  1,  0,  0,  0,  0, 35,  0, 37,  0,  0,  0,120,  1,  0,  0,  0,  0, 35,  0,149,  0,  0,  0,
+120,  1,  0,  0,  0,  0, 35,  0, 38,  0,  0,  0,121,  1,  0,  0,  0,  0, 35,  0,149,  0,  0,  0,121,  1,  0,  0,  0,  0, 35,  0,
+ 33,  0,  0,  0,122,  1,  0,  0,  0,  0, 35,  0,150,  0,  0,  0,122,  1,  0,  0,  0,  0, 35,  0, 39,  0,  0,  0,123,  1,  0,  0,
+  0,  0, 35,  0,150,  0,  0,  0,123,  1,  0,  0,  0,  0, 35,  0, 33,  0,  0,  0,124,  1,  0,  0,  0,  0, 35,  0,151,  0,  0,  0,
+124,  1,  0,  0,  0,  0, 35,  0, 38,  0,  0,  0,125,  1,  0,  0,  0,  0, 35,  0,151,  0,  0,  0,125,  1,  0,  0,  0,  0, 35,  0,
+ 38,  0,  0,  0,126,  1,  0,  0,  0,  0, 35,  0,152,  0,  0,  0,126,  1,  0,  0,  0,  0, 35,  0, 39,  0,  0,  0,127,  1,  0,  0,
+  0,  0, 35,  0,152,  0,  0,  0,127,  1,  0,  0,  0,  0, 35,  0, 34,  0,  0,  0,128,  1,  0,  0,  0,  0, 35,  0,153,  0,  0,  0,
+128,  1,  0,  0,  0,  0, 35,  0, 40,  0,  0,  0,129,  1,  0,  0,  0,  0, 35,  0,153,  0,  0,  0,129,  1,  0,  0,  0,  0, 35,  0,
+ 34,  0,  0,  0,130,  1,  0,  0,  0,  0, 35,  0,154,  0,  0,  0,130,  1,  0,  0,  0,  0, 35,  0, 39,  0,  0,  0,131,  1,  0,  0,
+  0,  0, 35,  0,154,  0,  0,  0,131,  1,  0,  0,  0,  0, 35,  0, 39,  0,  0,  0,132,  1,  0,  0,  0,  0, 35,  0,155,  0,  0,  0,
+132,  1,  0,  0,  0,  0, 35,  0, 40,  0,  0,  0,133,  1,  0,  0,  0,  0, 35,  0,155,  0,  0,  0,133,  1,  0,  0,  0,  0, 35,  0,
+ 35,  0,  0,  0,134,  1,  0,  0,  0,  0, 35,  0,156,  0,  0,  0,134,  1,  0,  0,  0,  0, 35,  0, 41,  0,  0,  0,135,  1,  0,  0,
+  0,  0, 35,  0,156,  0,  0,  0,135,  1,  0,  0,  0,  0, 35,  0, 35,  0,  0,  0,136,  1,  0,  0,  0,  0, 35,  0,157,  0,  0,  0,
+136,  1,  0,  0,  0,  0, 35,  0, 40,  0,  0,  0,137,  1,  0,  0,  0,  0, 35,  0,157,  0,  0,  0,137,  1,  0,  0,  0,  0, 35,  0,
+ 40,  0,  0,  0,138,  1,  0,  0,  0,  0, 35,  0,158,  0,  0,  0,138,  1,  0,  0,  0,  0, 35,  0, 41,  0,  0,  0,139,  1,  0,  0,
+  0,  0, 35,  0,158,  0,  0,  0,139,  1,  0,  0,  0,  0, 35,  0, 36,  0,  0,  0,140,  1,  0,  0,  0,  0, 35,  0,159,  0,  0,  0,
+140,  1,  0,  0,  0,  0, 35,  0, 37,  0,  0,  0,141,  1,  0,  0,  0,  0, 35,  0,159,  0,  0,  0,141,  1,  0,  0,  0,  0, 35,  0,
+ 36,  0,  0,  0,142,  1,  0,  0,  0,  0, 35,  0,160,  0,  0,  0,142,  1,  0,  0,  0,  0, 35,  0, 41,  0,  0,  0,143,  1,  0,  0,
+  0,  0, 35,  0,160,  0,  0,  0,143,  1,  0,  0,  0,  0, 35,  0, 37,  0,  0,  0,144,  1,  0,  0,  0,  0, 35,  0,161,  0,  0,  0,
+144,  1,  0,  0,  0,  0, 35,  0, 41,  0,  0,  0,145,  1,  0,  0,  0,  0, 35,  0,161,  0,  0,  0,145,  1,  0,  0,  0,  0, 35,  0,
+ 46,  0,  0,  0,146,  1,  0,  0,  0,  0, 35,  0,102,  0,  0,  0,146,  1,  0,  0,  0,  0, 35,  0, 43,  0,  0,  0,147,  1,  0,  0,
+  0,  0, 33,  0, 46,  0,  0,  0,147,  1,  0,  0,  0,  0, 33,  0, 43,  0,  0,  0,148,  1,  0,  0,  0,  0, 35,  0,102,  0,  0,  0,
+148,  1,  0,  0,  0,  0, 35,  0,102,  0,  0,  0,149,  1,  0,  0,  0,  0, 35,  0,103,  0,  0,  0,149,  1,  0,  0,  0,  0, 35,  0,
+103,  0,  0,  0,150,  1,  0,  0,  0,  0, 35,  0,104,  0,  0,  0,150,  1,  0,  0,  0,  0, 35,  0,102,  0,  0,  0,151,  1,  0,  0,
+  0,  0, 35,  0,104,  0,  0,  0,151,  1,  0,  0,  0,  0, 35,  0, 45,  0,  0,  0,152,  1,  0,  0,  0,  0, 33,  0, 47,  0,  0,  0,
+152,  1,  0,  0,  0,  0, 33,  0, 47,  0,  0,  0,153,  1,  0,  0,  0,  0, 35,  0,104,  0,  0,  0,153,  1,  0,  0,  0,  0, 35,  0,
+ 45,  0,  0,  0,154,  1,  0,  0,  0,  0, 35,  0,104,  0,  0,  0,154,  1,  0,  0,  0,  0, 35,  0, 44,  0,  0,  0,155,  1,  0,  0,
+  0,  0, 35,  0,103,  0,  0,  0,155,  1,  0,  0,  0,  0, 35,  0, 42,  0,  0,  0,156,  1,  0,  0,  0,  0, 35,  0,103,  0,  0,  0,
+156,  1,  0,  0,  0,  0, 35,  0, 42,  0,  0,  0,157,  1,  0,  0,  0,  0, 33,  0, 44,  0,  0,  0,157,  1,  0,  0,  0,  0, 33,  0,
+ 50,  0,  0,  0,158,  1,  0,  0,  0,  0, 35,  0,105,  0,  0,  0,158,  1,  0,  0,  0,  0, 35,  0, 43,  0,  0,  0,159,  1,  0,  0,
+  0,  0, 33,  0, 50,  0,  0,  0,159,  1,  0,  0,  0,  0, 33,  0, 43,  0,  0,  0,160,  1,  0,  0,  0,  0, 35,  0,105,  0,  0,  0,
+160,  1,  0,  0,  0,  0, 35,  0,105,  0,  0,  0,161,  1,  0,  0,  0,  0, 35,  0,106,  0,  0,  0,161,  1,  0,  0,  0,  0, 35,  0,
+106,  0,  0,  0,162,  1,  0,  0,  0,  0, 35,  0,107,  0,  0,  0,162,  1,  0,  0,  0,  0, 35,  0,105,  0,  0,  0,163,  1,  0,  0,
+  0,  0, 35,  0,107,  0,  0,  0,163,  1,  0,  0,  0,  0, 35,  0, 49,  0,  0,  0,164,  1,  0,  0,  0,  0, 33,  0, 51,  0,  0,  0,
+164,  1,  0,  0,  0,  0, 33,  0, 51,  0,  0,  0,165,  1,  0,  0,  0,  0, 35,  0,107,  0,  0,  0,165,  1,  0,  0,  0,  0, 35,  0,
+ 49,  0,  0,  0,166,  1,  0,  0,  0,  0, 35,  0,107,  0,  0,  0,166,  1,  0,  0,  0,  0, 35,  0, 48,  0,  0,  0,167,  1,  0,  0,
+  0,  0, 35,  0,106,  0,  0,  0,167,  1,  0,  0,  0,  0, 35,  0, 42,  0,  0,  0,168,  1,  0,  0,  0,  0, 35,  0,106,  0,  0,  0,
+168,  1,  0,  0,  0,  0, 35,  0, 42,  0,  0,  0,169,  1,  0,  0,  0,  0, 33,  0, 48,  0,  0,  0,169,  1,  0,  0,  0,  0, 33,  0,
+ 54,  0,  0,  0,170,  1,  0,  0,  0,  0, 35,  0,108,  0,  0,  0,170,  1,  0,  0,  0,  0, 35,  0, 45,  0,  0,  0,171,  1,  0,  0,
+  0,  0, 33,  0, 54,  0,  0,  0,171,  1,  0,  0,  0,  0, 33,  0, 45,  0,  0,  0,172,  1,  0,  0,  0,  0, 35,  0,108,  0,  0,  0,
+172,  1,  0,  0,  0,  0, 35,  0,108,  0,  0,  0,173,  1,  0,  0,  0,  0, 35,  0,109,  0,  0,  0,173,  1,  0,  0,  0,  0, 35,  0,
+109,  0,  0,  0,174,  1,  0,  0,  0,  0, 35,  0,110,  0,  0,  0,174,  1,  0,  0,  0,  0, 35,  0,108,  0,  0,  0,175,  1,  0,  0,
+  0,  0, 35,  0,110,  0,  0,  0,175,  1,  0,  0,  0,  0, 35,  0, 53,  0,  0,  0,176,  1,  0,  0,  0,  0, 33,  0, 55,  0,  0,  0,
+176,  1,  0,  0,  0,  0, 33,  0, 55,  0,  0,  0,177,  1,  0,  0,  0,  0, 35,  0,110,  0,  0,  0,177,  1,  0,  0,  0,  0, 35,  0,
+ 53,  0,  0,  0,178,  1,  0,  0,  0,  0, 35,  0,110,  0,  0,  0,178,  1,  0,  0,  0,  0, 35,  0, 52,  0,  0,  0,179,  1,  0,  0,
+  0,  0, 35,  0,109,  0,  0,  0,179,  1,  0,  0,  0,  0, 35,  0, 44,  0,  0,  0,180,  1,  0,  0,  0,  0, 35,  0,109,  0,  0,  0,
+180,  1,  0,  0,  0,  0, 35,  0, 44,  0,  0,  0,181,  1,  0,  0,  0,  0, 33,  0, 52,  0,  0,  0,181,  1,  0,  0,  0,  0, 33,  0,
+ 58,  0,  0,  0,182,  1,  0,  0,  0,  0, 35,  0,111,  0,  0,  0,182,  1,  0,  0,  0,  0, 35,  0, 53,  0,  0,  0,183,  1,  0,  0,
+  0,  0, 33,  0, 58,  0,  0,  0,183,  1,  0,  0,  0,  0, 33,  0, 53,  0,  0,  0,184,  1,  0,  0,  0,  0, 35,  0,111,  0,  0,  0,
+184,  1,  0,  0,  0,  0, 35,  0,111,  0,  0,  0,185,  1,  0,  0,  0,  0, 35,  0,112,  0,  0,  0,185,  1,  0,  0,  0,  0, 35,  0,
+112,  0,  0,  0,186,  1,  0,  0,  0,  0, 35,  0,113,  0,  0,  0,186,  1,  0,  0,  0,  0, 35,  0,111,  0,  0,  0,187,  1,  0,  0,
+  0,  0, 35,  0,113,  0,  0,  0,187,  1,  0,  0,  0,  0, 35,  0, 57,  0,  0,  0,188,  1,  0,  0,  0,  0, 33,  0, 59,  0,  0,  0,
+188,  1,  0,  0,  0,  0, 33,  0, 59,  0,  0,  0,189,  1,  0,  0,  0,  0, 35,  0,113,  0,  0,  0,189,  1,  0,  0,  0,  0, 35,  0,
+ 57,  0,  0,  0,190,  1,  0,  0,  0,  0, 35,  0,113,  0,  0,  0,190,  1,  0,  0,  0,  0, 35,  0, 56,  0,  0,  0,191,  1,  0,  0,
+  0,  0, 35,  0,112,  0,  0,  0,191,  1,  0,  0,  0,  0, 35,  0, 52,  0,  0,  0,192,  1,  0,  0,  0,  0, 35,  0,112,  0,  0,  0,
+192,  1,  0,  0,  0,  0, 35,  0, 52,  0,  0,  0,193,  1,  0,  0,  0,  0, 33,  0, 56,  0,  0,  0,193,  1,  0,  0,  0,  0, 33,  0,
+ 60,  0,  0,  0,194,  1,  0,  0,  0,  0, 35,  0,114,  0,  0,  0,194,  1,  0,  0,  0,  0, 35,  0, 57,  0,  0,  0,195,  1,  0,  0,
+  0,  0, 33,  0, 60,  0,  0,  0,195,  1,  0,  0,  0,  0, 33,  0, 57,  0,  0,  0,196,  1,  0,  0,  0,  0, 35,  0,114,  0,  0,  0,
+196,  1,  0,  0,  0,  0, 35,  0,114,  0,  0,  0,197,  1,  0,  0,  0,  0, 35,  0,115,  0,  0,  0,197,  1,  0,  0,  0,  0, 35,  0,
+115,  0,  0,  0,198,  1,  0,  0,  0,  0, 35,  0,116,  0,  0,  0,198,  1,  0,  0,  0,  0, 35,  0,114,  0,  0,  0,199,  1,  0,  0,
+  0,  0, 35,  0,116,  0,  0,  0,199,  1,  0,  0,  0,  0, 35,  0, 49,  0,  0,  0,200,  1,  0,  0,  0,  0, 33,  0, 61,  0,  0,  0,
+200,  1,  0,  0,  0,  0, 33,  0, 61,  0,  0,  0,201,  1,  0,  0,  0,  0, 35,  0,116,  0,  0,  0,201,  1,  0,  0,  0,  0, 35,  0,
+ 49,  0,  0,  0,202,  1,  0,  0,  0,  0, 35,  0,116,  0,  0,  0,202,  1,  0,  0,  0,  0, 35,  0, 48,  0,  0,  0,203,  1,  0,  0,
+  0,  0, 35,  0,115,  0,  0,  0,203,  1,  0,  0,  0,  0, 35,  0, 56,  0,  0,  0,204,  1,  0,  0,  0,  0, 35,  0,115,  0,  0,  0,
+204,  1,  0,  0,  0,  0, 35,  0, 48,  0,  0,  0,205,  1,  0,  0,  0,  0, 33,  0, 56,  0,  0,  0,205,  1,  0,  0,  0,  0, 33,  0,
+ 64,  0,  0,  0,206,  1,  0,  0,  0,  0, 35,  0,117,  0,  0,  0,206,  1,  0,  0,  0,  0, 35,  0, 50,  0,  0,  0,207,  1,  0,  0,
+  0,  0, 33,  0, 64,  0,  0,  0,207,  1,  0,  0,  0,  0, 33,  0, 50,  0,  0,  0,208,  1,  0,  0,  0,  0, 35,  0,117,  0,  0,  0,
+208,  1,  0,  0,  0,  0, 35,  0,117,  0,  0,  0,209,  1,  0,  0,  0,  0, 35,  0,118,  0,  0,  0,209,  1,  0,  0,  0,  0, 35,  0,
+118,  0,  0,  0,210,  1,  0,  0,  0,  0, 35,  0,119,  0,  0,  0,210,  1,  0,  0,  0,  0, 35,  0,117,  0,  0,  0,211,  1,  0,  0,
+  0,  0, 35,  0,119,  0,  0,  0,211,  1,  0,  0,  0,  0, 35,  0, 63,  0,  0,  0,212,  1,  0,  0,  0,  0, 33,  0, 65,  0,  0,  0,
+212,  1,  0,  0,  0,  0, 33,  0, 65,  0,  0,  0,213,  1,  0,  0,  0,  0, 35,  0,119,  0,  0,  0,213,  1,  0,  0,  0,  0, 35,  0,
+ 63,  0,  0,  0,214,  1,  0,  0,  0,  0, 35,  0,119,  0,  0,  0,214,  1,  0,  0,  0,  0, 35,  0, 62,  0,  0,  0,215,  1,  0,  0,
+  0,  0, 35,  0,118,  0,  0,  0,215,  1,  0,  0,  0,  0, 35,  0, 51,  0,  0,  0,216,  1,  0,  0,  0,  0, 35,  0,118,  0,  0,  0,
+216,  1,  0,  0,  0,  0, 35,  0, 51,  0,  0,  0,217,  1,  0,  0,  0,  0, 33,  0, 62,  0,  0,  0,217,  1,  0,  0,  0,  0, 33,  0,
+ 68,  0,  0,  0,218,  1,  0,  0,  0,  0, 35,  0,120,  0,  0,  0,218,  1,  0,  0,  0,  0, 35,  0, 47,  0,  0,  0,219,  1,  0,  0,
+  0,  0, 33,  0, 68,  0,  0,  0,219,  1,  0,  0,  0,  0, 33,  0, 47,  0,  0,  0,220,  1,  0,  0,  0,  0, 35,  0,120,  0,  0,  0,
+220,  1,  0,  0,  0,  0, 35,  0,120,  0,  0,  0,221,  1,  0,  0,  0,  0, 35,  0,121,  0,  0,  0,221,  1,  0,  0,  0,  0, 35,  0,
+121,  0,  0,  0,222,  1,  0,  0,  0,  0, 35,  0,122,  0,  0,  0,222,  1,  0,  0,  0,  0, 35,  0,120,  0,  0,  0,223,  1,  0,  0,
+  0,  0, 35,  0,122,  0,  0,  0,223,  1,  0,  0,  0,  0, 35,  0, 67,  0,  0,  0,224,  1,  0,  0,  0,  0, 33,  0, 69,  0,  0,  0,
+224,  1,  0,  0,  0,  0, 33,  0, 69,  0,  0,  0,225,  1,  0,  0,  0,  0, 35,  0,122,  0,  0,  0,225,  1,  0,  0,  0,  0, 35,  0,
+ 67,  0,  0,  0,226,  1,  0,  0,  0,  0, 35,  0,122,  0,  0,  0,226,  1,  0,  0,  0,  0, 35,  0, 66,  0,  0,  0,227,  1,  0,  0,
+  0,  0, 35,  0,121,  0,  0,  0,227,  1,  0,  0,  0,  0, 35,  0, 46,  0,  0,  0,228,  1,  0,  0,  0,  0, 35,  0,121,  0,  0,  0,
+228,  1,  0,  0,  0,  0, 35,  0, 46,  0,  0,  0,229,  1,  0,  0,  0,  0, 33,  0, 66,  0,  0,  0,229,  1,  0,  0,  0,  0, 33,  0,
+ 72,  0,  0,  0,230,  1,  0,  0,  0,  0, 35,  0,123,  0,  0,  0,230,  1,  0,  0,  0,  0, 35,  0, 55,  0,  0,  0,231,  1,  0,  0,
+  0,  0, 33,  0, 72,  0,  0,  0,231,  1,  0,  0,  0,  0, 33,  0, 55,  0,  0,  0,232,  1,  0,  0,  0,  0, 35,  0,123,  0,  0,  0,
+232,  1,  0,  0,  0,  0, 35,  0,123,  0,  0,  0,233,  1,  0,  0,  0,  0, 35,  0,124,  0,  0,  0,233,  1,  0,  0,  0,  0, 35,  0,
+124,  0,  0,  0,234,  1,  0,  0,  0,  0, 35,  0,125,  0,  0,  0,234,  1,  0,  0,  0,  0, 35,  0,123,  0,  0,  0,235,  1,  0,  0,
+  0,  0, 35,  0,125,  0,  0,  0,235,  1,  0,  0,  0,  0, 35,  0, 71,  0,  0,  0,236,  1,  0,  0,  0,  0, 33,  0, 73,  0,  0,  0,
+236,  1,  0,  0,  0,  0, 33,  0, 73,  0,  0,  0,237,  1,  0,  0,  0,  0, 35,  0,125,  0,  0,  0,237,  1,  0,  0,  0,  0, 35,  0,
+ 71,  0,  0,  0,238,  1,  0,  0,  0,  0, 35,  0,125,  0,  0,  0,238,  1,  0,  0,  0,  0, 35,  0, 70,  0,  0,  0,239,  1,  0,  0,
+  0,  0, 35,  0,124,  0,  0,  0,239,  1,  0,  0,  0,  0, 35,  0, 54,  0,  0,  0,240,  1,  0,  0,  0,  0, 35,  0,124,  0,  0,  0,
+240,  1,  0,  0,  0,  0, 35,  0, 54,  0,  0,  0,241,  1,  0,  0,  0,  0, 33,  0, 70,  0,  0,  0,241,  1,  0,  0,  0,  0, 33,  0,
+ 76,  0,  0,  0,242,  1,  0,  0,  0,  0, 35,  0,126,  0,  0,  0,242,  1,  0,  0,  0,  0, 35,  0, 59,  0,  0,  0,243,  1,  0,  0,
+  0,  0, 33,  0, 76,  0,  0,  0,243,  1,  0,  0,  0,  0, 33,  0, 59,  0,  0,  0,244,  1,  0,  0,  0,  0, 35,  0,126,  0,  0,  0,
+244,  1,  0,  0,  0,  0, 35,  0,126,  0,  0,  0,245,  1,  0,  0,  0,  0, 35,  0,127,  0,  0,  0,245,  1,  0,  0,  0,  0, 35,  0,
+127,  0,  0,  0,246,  1,  0,  0,  0,  0, 35,  0,128,  0,  0,  0,246,  1,  0,  0,  0,  0, 35,  0,126,  0,  0,  0,247,  1,  0,  0,
+  0,  0, 35,  0,128,  0,  0,  0,247,  1,  0,  0,  0,  0, 35,  0, 75,  0,  0,  0,248,  1,  0,  0,  0,  0, 33,  0, 77,  0,  0,  0,
+248,  1,  0,  0,  0,  0, 33,  0, 77,  0,  0,  0,249,  1,  0,  0,  0,  0, 35,  0,128,  0,  0,  0,249,  1,  0,  0,  0,  0, 35,  0,
+ 75,  0,  0,  0,250,  1,  0,  0,  0,  0, 35,  0,128,  0,  0,  0,250,  1,  0,  0,  0,  0, 35,  0, 74,  0,  0,  0,251,  1,  0,  0,
+  0,  0, 35,  0,127,  0,  0,  0,251,  1,  0,  0,  0,  0, 35,  0, 58,  0,  0,  0,252,  1,  0,  0,  0,  0, 35,  0,127,  0,  0,  0,
+252,  1,  0,  0,  0,  0, 35,  0, 58,  0,  0,  0,253,  1,  0,  0,  0,  0, 33,  0, 74,  0,  0,  0,253,  1,  0,  0,  0,  0, 33,  0,
+ 80,  0,  0,  0,254,  1,  0,  0,  0,  0, 35,  0,129,  0,  0,  0,254,  1,  0,  0,  0,  0, 35,  0, 61,  0,  0,  0,255,  1,  0,  0,
+  0,  0, 33,  0, 80,  0,  0,  0,255,  1,  0,  0,  0,  0, 33,  0, 61,  0,  0,  0,  0,  2,  0,  0,  0,  0, 35,  0,129,  0,  0,  0,
+  0,  2,  0,  0,  0,  0, 35,  0,129,  0,  0,  0,  1,  2,  0,  0,  0,  0, 35,  0,130,  0,  0,  0,  1,  2,  0,  0,  0,  0, 35,  0,
+130,  0,  0,  0,  2,  2,  0,  0,  0,  0, 35,  0,131,  0,  0,  0,  2,  2,  0,  0,  0,  0, 35,  0,129,  0,  0,  0,  3,  2,  0,  0,
+  0,  0, 35,  0,131,  0,  0,  0,  3,  2,  0,  0,  0,  0, 35,  0, 79,  0,  0,  0,  4,  2,  0,  0,  0,  0, 33,  0, 81,  0,  0,  0,
+  4,  2,  0,  0,  0,  0, 33,  0, 81,  0,  0,  0,  5,  2,  0,  0,  0,  0, 35,  0,131,  0,  0,  0,  5,  2,  0,  0,  0,  0, 35,  0,
+ 79,  0,  0,  0,  6,  2,  0,  0,  0,  0, 35,  0,131,  0,  0,  0,  6,  2,  0,  0,  0,  0, 35,  0, 78,  0,  0,  0,  7,  2,  0,  0,
+  0,  0, 35,  0,130,  0,  0,  0,  7,  2,  0,  0,  0,  0, 35,  0, 60,  0,  0,  0,  8,  2,  0,  0,  0,  0, 35,  0,130,  0,  0,  0,
+  8,  2,  0,  0,  0,  0, 35,  0, 60,  0,  0,  0,  9,  2,  0,  0,  0,  0, 33,  0, 78,  0,  0,  0,  9,  2,  0,  0,  0,  0, 33,  0,
+ 83,  0,  0,  0, 10,  2,  0,  0,  0,  0, 35,  0,132,  0,  0,  0, 10,  2,  0,  0,  0,  0, 35,  0, 65,  0,  0,  0, 11,  2,  0,  0,
+  0,  0, 33,  0, 83,  0,  0,  0, 11,  2,  0,  0,  0,  0, 33,  0, 65,  0,  0,  0, 12,  2,  0,  0,  0,  0, 35,  0,132,  0,  0,  0,
+ 12,  2,  0,  0,  0,  0, 35,  0,132,  0,  0,  0, 13,  2,  0,  0,  0,  0, 35,  0,133,  0,  0,  0, 13,  2,  0,  0,  0,  0, 35,  0,
+133,  0,  0,  0, 14,  2,  0,  0,  0,  0, 35,  0,134,  0,  0,  0, 14,  2,  0,  0,  0,  0, 35,  0,132,  0,  0,  0, 15,  2,  0,  0,
+  0,  0, 35,  0,134,  0,  0,  0, 15,  2,  0,  0,  0,  0, 35,  0, 67,  0,  0,  0, 16,  2,  0,  0,  0,  0, 33,  0, 82,  0,  0,  0,
+ 16,  2,  0,  0,  0,  0, 33,  0, 82,  0,  0,  0, 17,  2,  0,  0,  0,  0, 35,  0,134,  0,  0,  0, 17,  2,  0,  0,  0,  0, 35,  0,
+ 67,  0,  0,  0, 18,  2,  0,  0,  0,  0, 35,  0,134,  0,  0,  0, 18,  2,  0,  0,  0,  0, 35,  0, 66,  0,  0,  0, 19,  2,  0,  0,
+  0,  0, 35,  0,133,  0,  0,  0, 19,  2,  0,  0,  0,  0, 35,  0, 64,  0,  0,  0, 20,  2,  0,  0,  0,  0, 35,  0,133,  0,  0,  0,
+ 20,  2,  0,  0,  0,  0, 35,  0, 64,  0,  0,  0, 21,  2,  0,  0,  0,  0, 33,  0, 66,  0,  0,  0, 21,  2,  0,  0,  0,  0, 33,  0,
+ 84,  0,  0,  0, 22,  2,  0,  0,  0,  0, 35,  0,135,  0,  0,  0, 22,  2,  0,  0,  0,  0, 35,  0, 69,  0,  0,  0, 23,  2,  0,  0,
+  0,  0, 33,  0, 84,  0,  0,  0, 23,  2,  0,  0,  0,  0, 33,  0, 69,  0,  0,  0, 24,  2,  0,  0,  0,  0, 35,  0,135,  0,  0,  0,
+ 24,  2,  0,  0,  0,  0, 35,  0,135,  0,  0,  0, 25,  2,  0,  0,  0,  0, 35,  0,136,  0,  0,  0, 25,  2,  0,  0,  0,  0, 35,  0,
+136,  0,  0,  0, 26,  2,  0,  0,  0,  0, 35,  0,137,  0,  0,  0, 26,  2,  0,  0,  0,  0, 35,  0,135,  0,  0,  0, 27,  2,  0,  0,
+  0,  0, 35,  0,137,  0,  0,  0, 27,  2,  0,  0,  0,  0, 35,  0, 71,  0,  0,  0, 28,  2,  0,  0,  0,  0, 33,  0, 85,  0,  0,  0,
+ 28,  2,  0,  0,  0,  0, 33,  0, 85,  0,  0,  0, 29,  2,  0,  0,  0,  0, 35,  0,137,  0,  0,  0, 29,  2,  0,  0,  0,  0, 35,  0,
+ 71,  0,  0,  0, 30,  2,  0,  0,  0,  0, 35,  0,137,  0,  0,  0, 30,  2,  0,  0,  0,  0, 35,  0, 70,  0,  0,  0, 31,  2,  0,  0,
+  0,  0, 35,  0,136,  0,  0,  0, 31,  2,  0,  0,  0,  0, 35,  0, 68,  0,  0,  0, 32,  2,  0,  0,  0,  0, 35,  0,136,  0,  0,  0,
+ 32,  2,  0,  0,  0,  0, 35,  0, 68,  0,  0,  0, 33,  2,  0,  0,  0,  0, 33,  0, 70,  0,  0,  0, 33,  2,  0,  0,  0,  0, 33,  0,
+ 86,  0,  0,  0, 34,  2,  0,  0,  0,  0, 35,  0,138,  0,  0,  0, 34,  2,  0,  0,  0,  0, 35,  0, 73,  0,  0,  0, 35,  2,  0,  0,
+  0,  0, 33,  0, 86,  0,  0,  0, 35,  2,  0,  0,  0,  0, 33,  0, 73,  0,  0,  0, 36,  2,  0,  0,  0,  0, 35,  0,138,  0,  0,  0,
+ 36,  2,  0,  0,  0,  0, 35,  0,138,  0,  0,  0, 37,  2,  0,  0,  0,  0, 35,  0,139,  0,  0,  0, 37,  2,  0,  0,  0,  0, 35,  0,
+139,  0,  0,  0, 38,  2,  0,  0,  0,  0, 35,  0,140,  0,  0,  0, 38,  2,  0,  0,  0,  0, 35,  0,138,  0,  0,  0, 39,  2,  0,  0,
+  0,  0, 35,  0,140,  0,  0,  0, 39,  2,  0,  0,  0,  0, 35,  0, 75,  0,  0,  0, 40,  2,  0,  0,  0,  0, 33,  0, 87,  0,  0,  0,
+ 40,  2,  0,  0,  0,  0, 33,  0, 87,  0,  0,  0, 41,  2,  0,  0,  0,  0, 35,  0,140,  0,  0,  0, 41,  2,  0,  0,  0,  0, 35,  0,
+ 75,  0,  0,  0, 42,  2,  0,  0,  0,  0, 35,  0,140,  0,  0,  0, 42,  2,  0,  0,  0,  0, 35,  0, 74,  0,  0,  0, 43,  2,  0,  0,
+  0,  0, 35,  0,139,  0,  0,  0, 43,  2,  0,  0,  0,  0, 35,  0, 72,  0,  0,  0, 44,  2,  0,  0,  0,  0, 35,  0,139,  0,  0,  0,
+ 44,  2,  0,  0,  0,  0, 35,  0, 72,  0,  0,  0, 45,  2,  0,  0,  0,  0, 33,  0, 74,  0,  0,  0, 45,  2,  0,  0,  0,  0, 33,  0,
+ 88,  0,  0,  0, 46,  2,  0,  0,  0,  0, 35,  0,141,  0,  0,  0, 46,  2,  0,  0,  0,  0, 35,  0, 77,  0,  0,  0, 47,  2,  0,  0,
+  0,  0, 33,  0, 88,  0,  0,  0, 47,  2,  0,  0,  0,  0, 33,  0, 77,  0,  0,  0, 48,  2,  0,  0,  0,  0, 35,  0,141,  0,  0,  0,
+ 48,  2,  0,  0,  0,  0, 35,  0,141,  0,  0,  0, 49,  2,  0,  0,  0,  0, 35,  0,142,  0,  0,  0, 49,  2,  0,  0,  0,  0, 35,  0,
+142,  0,  0,  0, 50,  2,  0,  0,  0,  0, 35,  0,143,  0,  0,  0, 50,  2,  0,  0,  0,  0, 35,  0,141,  0,  0,  0, 51,  2,  0,  0,
+  0,  0, 35,  0,143,  0,  0,  0, 51,  2,  0,  0,  0,  0, 35,  0, 79,  0,  0,  0, 52,  2,  0,  0,  0,  0, 33,  0, 89,  0,  0,  0,
+ 52,  2,  0,  0,  0,  0, 33,  0, 89,  0,  0,  0, 53,  2,  0,  0,  0,  0, 35,  0,143,  0,  0,  0, 53,  2,  0,  0,  0,  0, 35,  0,
+ 79,  0,  0,  0, 54,  2,  0,  0,  0,  0, 35,  0,143,  0,  0,  0, 54,  2,  0,  0,  0,  0, 35,  0, 78,  0,  0,  0, 55,  2,  0,  0,
+  0,  0, 35,  0,142,  0,  0,  0, 55,  2,  0,  0,  0,  0, 35,  0, 76,  0,  0,  0, 56,  2,  0,  0,  0,  0, 35,  0,142,  0,  0,  0,
+ 56,  2,  0,  0,  0,  0, 35,  0, 76,  0,  0,  0, 57,  2,  0,  0,  0,  0, 33,  0, 78,  0,  0,  0, 57,  2,  0,  0,  0,  0, 33,  0,
+ 90,  0,  0,  0, 58,  2,  0,  0,  0,  0, 35,  0,144,  0,  0,  0, 58,  2,  0,  0,  0,  0, 35,  0, 81,  0,  0,  0, 59,  2,  0,  0,
+  0,  0, 33,  0, 90,  0,  0,  0, 59,  2,  0,  0,  0,  0, 33,  0, 81,  0,  0,  0, 60,  2,  0,  0,  0,  0, 35,  0,144,  0,  0,  0,
+ 60,  2,  0,  0,  0,  0, 35,  0,144,  0,  0,  0, 61,  2,  0,  0,  0,  0, 35,  0,145,  0,  0,  0, 61,  2,  0,  0,  0,  0, 35,  0,
+145,  0,  0,  0, 62,  2,  0,  0,  0,  0, 35,  0,146,  0,  0,  0, 62,  2,  0,  0,  0,  0, 35,  0,144,  0,  0,  0, 63,  2,  0,  0,
+  0,  0, 35,  0,146,  0,  0,  0, 63,  2,  0,  0,  0,  0, 35,  0, 63,  0,  0,  0, 64,  2,  0,  0,  0,  0, 33,  0, 91,  0,  0,  0,
+ 64,  2,  0,  0,  0,  0, 33,  0, 91,  0,  0,  0, 65,  2,  0,  0,  0,  0, 35,  0,146,  0,  0,  0, 65,  2,  0,  0,  0,  0, 35,  0,
+ 63,  0,  0,  0, 66,  2,  0,  0,  0,  0, 35,  0,146,  0,  0,  0, 66,  2,  0,  0,  0,  0, 35,  0, 62,  0,  0,  0, 67,  2,  0,  0,
+  0,  0, 35,  0,145,  0,  0,  0, 67,  2,  0,  0,  0,  0, 35,  0, 80,  0,  0,  0, 68,  2,  0,  0,  0,  0, 35,  0,145,  0,  0,  0,
+ 68,  2,  0,  0,  0,  0, 35,  0, 62,  0,  0,  0, 69,  2,  0,  0,  0,  0, 33,  0, 80,  0,  0,  0, 69,  2,  0,  0,  0,  0, 33,  0,
+ 94,  0,  0,  0, 70,  2,  0,  0,  0,  0, 35,  0,147,  0,  0,  0, 70,  2,  0,  0,  0,  0, 35,  0, 82,  0,  0,  0, 71,  2,  0,  0,
+  0,  0, 33,  0, 94,  0,  0,  0, 71,  2,  0,  0,  0,  0, 33,  0, 82,  0,  0,  0, 72,  2,  0,  0,  0,  0, 35,  0,147,  0,  0,  0,
+ 72,  2,  0,  0,  0,  0, 35,  0,147,  0,  0,  0, 73,  2,  0,  0,  0,  0, 35,  0,148,  0,  0,  0, 73,  2,  0,  0,  0,  0, 35,  0,
+148,  0,  0,  0, 74,  2,  0,  0,  0,  0, 35,  0,149,  0,  0,  0, 74,  2,  0,  0,  0,  0, 35,  0,147,  0,  0,  0, 75,  2,  0,  0,
+  0,  0, 35,  0,149,  0,  0,  0, 75,  2,  0,  0,  0,  0, 35,  0, 93,  0,  0,  0, 76,  2,  0,  0,  0,  0, 33,  0, 95,  0,  0,  0,
+ 76,  2,  0,  0,  0,  0, 33,  0, 95,  0,  0,  0, 77,  2,  0,  0,  0,  0, 35,  0,149,  0,  0,  0, 77,  2,  0,  0,  0,  0, 35,  0,
+ 93,  0,  0,  0, 78,  2,  0,  0,  0,  0, 35,  0,149,  0,  0,  0, 78,  2,  0,  0,  0,  0, 35,  0, 92,  0,  0,  0, 79,  2,  0,  0,
+  0,  0, 35,  0,148,  0,  0,  0, 79,  2,  0,  0,  0,  0, 35,  0, 83,  0,  0,  0, 80,  2,  0,  0,  0,  0, 35,  0,148,  0,  0,  0,
+ 80,  2,  0,  0,  0,  0, 35,  0, 83,  0,  0,  0, 81,  2,  0,  0,  0,  0, 33,  0, 92,  0,  0,  0, 81,  2,  0,  0,  0,  0, 33,  0,
+ 96,  0,  0,  0, 82,  2,  0,  0,  0,  0, 35,  0,150,  0,  0,  0, 82,  2,  0,  0,  0,  0, 35,  0, 85,  0,  0,  0, 83,  2,  0,  0,
+  0,  0, 33,  0, 96,  0,  0,  0, 83,  2,  0,  0,  0,  0, 33,  0, 85,  0,  0,  0, 84,  2,  0,  0,  0,  0, 35,  0,150,  0,  0,  0,
+ 84,  2,  0,  0,  0,  0, 35,  0,150,  0,  0,  0, 85,  2,  0,  0,  0,  0, 35,  0,151,  0,  0,  0, 85,  2,  0,  0,  0,  0, 35,  0,
+151,  0,  0,  0, 86,  2,  0,  0,  0,  0, 35,  0,152,  0,  0,  0, 86,  2,  0,  0,  0,  0, 35,  0,150,  0,  0,  0, 87,  2,  0,  0,
+  0,  0, 35,  0,152,  0,  0,  0, 87,  2,  0,  0,  0,  0, 35,  0, 95,  0,  0,  0, 88,  2,  0,  0,  0,  0, 33,  0, 97,  0,  0,  0,
+ 88,  2,  0,  0,  0,  0, 33,  0, 97,  0,  0,  0, 89,  2,  0,  0,  0,  0, 35,  0,152,  0,  0,  0, 89,  2,  0,  0,  0,  0, 35,  0,
+ 95,  0,  0,  0, 90,  2,  0,  0,  0,  0, 35,  0,152,  0,  0,  0, 90,  2,  0,  0,  0,  0, 35,  0, 94,  0,  0,  0, 91,  2,  0,  0,
+  0,  0, 35,  0,151,  0,  0,  0, 91,  2,  0,  0,  0,  0, 35,  0, 84,  0,  0,  0, 92,  2,  0,  0,  0,  0, 35,  0,151,  0,  0,  0,
+ 92,  2,  0,  0,  0,  0, 35,  0, 84,  0,  0,  0, 93,  2,  0,  0,  0,  0, 33,  0, 94,  0,  0,  0, 93,  2,  0,  0,  0,  0, 33,  0,
+ 98,  0,  0,  0, 94,  2,  0,  0,  0,  0, 35,  0,153,  0,  0,  0, 94,  2,  0,  0,  0,  0, 35,  0, 87,  0,  0,  0, 95,  2,  0,  0,
+  0,  0, 33,  0, 98,  0,  0,  0, 95,  2,  0,  0,  0,  0, 33,  0, 87,  0,  0,  0, 96,  2,  0,  0,  0,  0, 35,  0,153,  0,  0,  0,
+ 96,  2,  0,  0,  0,  0, 35,  0,153,  0,  0,  0, 97,  2,  0,  0,  0,  0, 35,  0,154,  0,  0,  0, 97,  2,  0,  0,  0,  0, 35,  0,
+154,  0,  0,  0, 98,  2,  0,  0,  0,  0, 35,  0,155,  0,  0,  0, 98,  2,  0,  0,  0,  0, 35,  0,153,  0,  0,  0, 99,  2,  0,  0,
+  0,  0, 35,  0,155,  0,  0,  0, 99,  2,  0,  0,  0,  0, 35,  0, 97,  0,  0,  0,100,  2,  0,  0,  0,  0, 33,  0, 99,  0,  0,  0,
+100,  2,  0,  0,  0,  0, 33,  0, 99,  0,  0,  0,101,  2,  0,  0,  0,  0, 35,  0,155,  0,  0,  0,101,  2,  0,  0,  0,  0, 35,  0,
+ 97,  0,  0,  0,102,  2,  0,  0,  0,  0, 35,  0,155,  0,  0,  0,102,  2,  0,  0,  0,  0, 35,  0, 96,  0,  0,  0,103,  2,  0,  0,
+  0,  0, 35,  0,154,  0,  0,  0,103,  2,  0,  0,  0,  0, 35,  0, 86,  0,  0,  0,104,  2,  0,  0,  0,  0, 35,  0,154,  0,  0,  0,
+104,  2,  0,  0,  0,  0, 35,  0, 86,  0,  0,  0,105,  2,  0,  0,  0,  0, 33,  0, 96,  0,  0,  0,105,  2,  0,  0,  0,  0, 33,  0,
+100,  0,  0,  0,106,  2,  0,  0,  0,  0, 35,  0,156,  0,  0,  0,106,  2,  0,  0,  0,  0, 35,  0, 89,  0,  0,  0,107,  2,  0,  0,
+  0,  0, 33,  0,100,  0,  0,  0,107,  2,  0,  0,  0,  0, 33,  0, 89,  0,  0,  0,108,  2,  0,  0,  0,  0, 35,  0,156,  0,  0,  0,
+108,  2,  0,  0,  0,  0, 35,  0,156,  0,  0,  0,109,  2,  0,  0,  0,  0, 35,  0,157,  0,  0,  0,109,  2,  0,  0,  0,  0, 35,  0,
+157,  0,  0,  0,110,  2,  0,  0,  0,  0, 35,  0,158,  0,  0,  0,110,  2,  0,  0,  0,  0, 35,  0,156,  0,  0,  0,111,  2,  0,  0,
+  0,  0, 35,  0,158,  0,  0,  0,111,  2,  0,  0,  0,  0, 35,  0, 99,  0,  0,  0,112,  2,  0,  0,  0,  0, 33,  0,101,  0,  0,  0,
+112,  2,  0,  0,  0,  0, 33,  0,101,  0,  0,  0,113,  2,  0,  0,  0,  0, 35,  0,158,  0,  0,  0,113,  2,  0,  0,  0,  0, 35,  0,
+ 99,  0,  0,  0,114,  2,  0,  0,  0,  0, 35,  0,158,  0,  0,  0,114,  2,  0,  0,  0,  0, 35,  0, 98,  0,  0,  0,115,  2,  0,  0,
+  0,  0, 35,  0,157,  0,  0,  0,115,  2,  0,  0,  0,  0, 35,  0, 88,  0,  0,  0,116,  2,  0,  0,  0,  0, 35,  0,157,  0,  0,  0,
+116,  2,  0,  0,  0,  0, 35,  0, 88,  0,  0,  0,117,  2,  0,  0,  0,  0, 33,  0, 98,  0,  0,  0,117,  2,  0,  0,  0,  0, 33,  0,
+ 92,  0,  0,  0,118,  2,  0,  0,  0,  0, 35,  0,159,  0,  0,  0,118,  2,  0,  0,  0,  0, 35,  0, 91,  0,  0,  0,119,  2,  0,  0,
+  0,  0, 33,  0, 92,  0,  0,  0,119,  2,  0,  0,  0,  0, 33,  0, 91,  0,  0,  0,120,  2,  0,  0,  0,  0, 35,  0,159,  0,  0,  0,
+120,  2,  0,  0,  0,  0, 35,  0,159,  0,  0,  0,121,  2,  0,  0,  0,  0, 35,  0,160,  0,  0,  0,121,  2,  0,  0,  0,  0, 35,  0,
+160,  0,  0,  0,122,  2,  0,  0,  0,  0, 35,  0,161,  0,  0,  0,122,  2,  0,  0,  0,  0, 35,  0,159,  0,  0,  0,123,  2,  0,  0,
+  0,  0, 35,  0,161,  0,  0,  0,123,  2,  0,  0,  0,  0, 35,  0, 93,  0,  0,  0,124,  2,  0,  0,  0,  0, 33,  0,101,  0,  0,  0,
+124,  2,  0,  0,  0,  0, 33,  0, 93,  0,  0,  0,125,  2,  0,  0,  0,  0, 35,  0,161,  0,  0,  0,125,  2,  0,  0,  0,  0, 35,  0,
+101,  0,  0,  0,126,  2,  0,  0,  0,  0, 35,  0,161,  0,  0,  0,126,  2,  0,  0,  0,  0, 35,  0,100,  0,  0,  0,127,  2,  0,  0,
+  0,  0, 35,  0,160,  0,  0,  0,127,  2,  0,  0,  0,  0, 35,  0, 90,  0,  0,  0,128,  2,  0,  0,  0,  0, 35,  0,160,  0,  0,  0,
+128,  2,  0,  0,  0,  0, 35,  0, 90,  0,  0,  0,129,  2,  0,  0,  0,  0, 33,  0,100,  0,  0,  0,129,  2,  0,  0,  0,  0, 33,  0,
+ 27,  1,  0,  0,146,  1,  0,  0,  0,  0, 35,  0,171,  0,  0,  0,146,  1,  0,  0,  0,  0, 35,  0,171,  0,  0,  0, 27,  1,  0,  0,
+  0,  0, 35,  0,146,  1,  0,  0,147,  1,  0,  0,  0,  0, 35,  0,146,  1,  0,  0,148,  1,  0,  0,  0,  0, 35,  0,147,  1,  0,  0,
+148,  1,  0,  0,  0,  0, 35,  0,165,  0,  0,  0, 26,  1,  0,  0,  0,  0, 35,  0,165,  0,  0,  0,148,  1,  0,  0,  0,  0, 35,  0,
+ 26,  1,  0,  0,148,  1,  0,  0,  0,  0, 35,  0,164,  0,  0,  0,147,  1,  0,  0,  0,  0, 35,  0,164,  0,  0,  0,170,  0,  0,  0,
+  0,  0, 35,  0,170,  0,  0,  0,147,  1,  0,  0,  0,  0, 35,  0, 26,  1,  0,  0,149,  1,  0,  0,  0,  0, 35,  0, 28,  1,  0,  0,
+149,  1,  0,  0,  0,  0, 35,  0, 26,  1,  0,  0, 28,  1,  0,  0,  0,  0, 35,  0,149,  1,  0,  0,150,  1,  0,  0,  0,  0, 35,  0,
+149,  1,  0,  0,151,  1,  0,  0,  0,  0, 35,  0,150,  1,  0,  0,151,  1,  0,  0,  0,  0, 35,  0, 27,  1,  0,  0, 31,  1,  0,  0,
+  0,  0, 35,  0, 31,  1,  0,  0,151,  1,  0,  0,  0,  0, 35,  0, 27,  1,  0,  0,151,  1,  0,  0,  0,  0, 35,  0, 30,  1,  0,  0,
+150,  1,  0,  0,  0,  0, 35,  0, 29,  1,  0,  0, 30,  1,  0,  0,  0,  0, 35,  0, 29,  1,  0,  0,150,  1,  0,  0,  0,  0, 35,  0,
+168,  0,  0,  0,152,  1,  0,  0,  0,  0, 35,  0,172,  0,  0,  0,152,  1,  0,  0,  0,  0, 35,  0,168,  0,  0,  0,172,  0,  0,  0,
+  0,  0, 35,  0,152,  1,  0,  0,153,  1,  0,  0,  0,  0, 35,  0,152,  1,  0,  0,154,  1,  0,  0,  0,  0, 35,  0,153,  1,  0,  0,
+154,  1,  0,  0,  0,  0, 35,  0,169,  0,  0,  0, 30,  1,  0,  0,  0,  0, 35,  0, 30,  1,  0,  0,154,  1,  0,  0,  0,  0, 35,  0,
+169,  0,  0,  0,154,  1,  0,  0,  0,  0, 35,  0, 31,  1,  0,  0,153,  1,  0,  0,  0,  0, 35,  0,173,  0,  0,  0, 31,  1,  0,  0,
+  0,  0, 35,  0,173,  0,  0,  0,153,  1,  0,  0,  0,  0, 35,  0,167,  0,  0,  0,155,  1,  0,  0,  0,  0, 35,  0, 29,  1,  0,  0,
+155,  1,  0,  0,  0,  0, 35,  0,167,  0,  0,  0, 29,  1,  0,  0,  0,  0, 35,  0,155,  1,  0,  0,156,  1,  0,  0,  0,  0, 35,  0,
+155,  1,  0,  0,157,  1,  0,  0,  0,  0, 35,  0,156,  1,  0,  0,157,  1,  0,  0,  0,  0, 35,  0,162,  0,  0,  0,166,  0,  0,  0,
+  0,  0, 35,  0,162,  0,  0,  0,157,  1,  0,  0,  0,  0, 35,  0,166,  0,  0,  0,157,  1,  0,  0,  0,  0, 35,  0,163,  0,  0,  0,
+156,  1,  0,  0,  0,  0, 35,  0,163,  0,  0,  0, 28,  1,  0,  0,  0,  0, 35,  0, 28,  1,  0,  0,156,  1,  0,  0,  0,  0, 35,  0,
+ 33,  1,  0,  0,158,  1,  0,  0,  0,  0, 35,  0,179,  0,  0,  0, 33,  1,  0,  0,  0,  0, 35,  0,179,  0,  0,  0,158,  1,  0,  0,
+  0,  0, 35,  0,158,  1,  0,  0,159,  1,  0,  0,  0,  0, 35,  0,159,  1,  0,  0,160,  1,  0,  0,  0,  0, 35,  0,158,  1,  0,  0,
+160,  1,  0,  0,  0,  0, 35,  0,165,  0,  0,  0, 32,  1,  0,  0,  0,  0, 35,  0, 32,  1,  0,  0,160,  1,  0,  0,  0,  0, 35,  0,
+165,  0,  0,  0,160,  1,  0,  0,  0,  0, 35,  0,164,  0,  0,  0,159,  1,  0,  0,  0,  0, 35,  0,178,  0,  0,  0,159,  1,  0,  0,
+  0,  0, 35,  0,164,  0,  0,  0,178,  0,  0,  0,  0,  0, 35,  0, 32,  1,  0,  0,161,  1,  0,  0,  0,  0, 35,  0, 32,  1,  0,  0,
+ 34,  1,  0,  0,  0,  0, 35,  0, 34,  1,  0,  0,161,  1,  0,  0,  0,  0, 35,  0,161,  1,  0,  0,162,  1,  0,  0,  0,  0, 35,  0,
+162,  1,  0,  0,163,  1,  0,  0,  0,  0, 35,  0,161,  1,  0,  0,163,  1,  0,  0,  0,  0, 35,  0, 33,  1,  0,  0, 37,  1,  0,  0,
+  0,  0, 35,  0, 33,  1,  0,  0,163,  1,  0,  0,  0,  0, 35,  0, 37,  1,  0,  0,163,  1,  0,  0,  0,  0, 35,  0, 36,  1,  0,  0,
+162,  1,  0,  0,  0,  0, 35,  0, 35,  1,  0,  0,162,  1,  0,  0,  0,  0, 35,  0, 35,  1,  0,  0, 36,  1,  0,  0,  0,  0, 35,  0,
+176,  0,  0,  0,164,  1,  0,  0,  0,  0, 35,  0,176,  0,  0,  0,180,  0,  0,  0,  0,  0, 35,  0,180,  0,  0,  0,164,  1,  0,  0,
+  0,  0, 35,  0,164,  1,  0,  0,165,  1,  0,  0,  0,  0, 35,  0,165,  1,  0,  0,166,  1,  0,  0,  0,  0, 35,  0,164,  1,  0,  0,
+166,  1,  0,  0,  0,  0, 35,  0,177,  0,  0,  0, 36,  1,  0,  0,  0,  0, 35,  0,177,  0,  0,  0,166,  1,  0,  0,  0,  0, 35,  0,
+ 36,  1,  0,  0,166,  1,  0,  0,  0,  0, 35,  0, 37,  1,  0,  0,165,  1,  0,  0,  0,  0, 35,  0,181,  0,  0,  0,165,  1,  0,  0,
+  0,  0, 35,  0,181,  0,  0,  0, 37,  1,  0,  0,  0,  0, 35,  0,175,  0,  0,  0,167,  1,  0,  0,  0,  0, 35,  0,175,  0,  0,  0,
+ 35,  1,  0,  0,  0,  0, 35,  0, 35,  1,  0,  0,167,  1,  0,  0,  0,  0, 35,  0,167,  1,  0,  0,168,  1,  0,  0,  0,  0, 35,  0,
+168,  1,  0,  0,169,  1,  0,  0,  0,  0, 35,  0,167,  1,  0,  0,169,  1,  0,  0,  0,  0, 35,  0,162,  0,  0,  0,174,  0,  0,  0,
+  0,  0, 35,  0,174,  0,  0,  0,169,  1,  0,  0,  0,  0, 35,  0,162,  0,  0,  0,169,  1,  0,  0,  0,  0, 35,  0,163,  0,  0,  0,
+168,  1,  0,  0,  0,  0, 35,  0, 34,  1,  0,  0,168,  1,  0,  0,  0,  0, 35,  0,163,  0,  0,  0, 34,  1,  0,  0,  0,  0, 35,  0,
+ 39,  1,  0,  0,170,  1,  0,  0,  0,  0, 35,  0,187,  0,  0,  0,170,  1,  0,  0,  0,  0, 35,  0,187,  0,  0,  0, 39,  1,  0,  0,
+  0,  0, 35,  0,170,  1,  0,  0,171,  1,  0,  0,  0,  0, 35,  0,170,  1,  0,  0,172,  1,  0,  0,  0,  0, 35,  0,171,  1,  0,  0,
+172,  1,  0,  0,  0,  0, 35,  0,169,  0,  0,  0, 38,  1,  0,  0,  0,  0, 35,  0,169,  0,  0,  0,172,  1,  0,  0,  0,  0, 35,  0,
+ 38,  1,  0,  0,172,  1,  0,  0,  0,  0, 35,  0,168,  0,  0,  0,171,  1,  0,  0,  0,  0, 35,  0,168,  0,  0,  0,186,  0,  0,  0,
+  0,  0, 35,  0,186,  0,  0,  0,171,  1,  0,  0,  0,  0, 35,  0, 38,  1,  0,  0,173,  1,  0,  0,  0,  0, 35,  0, 40,  1,  0,  0,
+173,  1,  0,  0,  0,  0, 35,  0, 38,  1,  0,  0, 40,  1,  0,  0,  0,  0, 35,  0,173,  1,  0,  0,174,  1,  0,  0,  0,  0, 35,  0,
+173,  1,  0,  0,175,  1,  0,  0,  0,  0, 35,  0,174,  1,  0,  0,175,  1,  0,  0,  0,  0, 35,  0, 39,  1,  0,  0, 43,  1,  0,  0,
+  0,  0, 35,  0, 43,  1,  0,  0,175,  1,  0,  0,  0,  0, 35,  0, 39,  1,  0,  0,175,  1,  0,  0,  0,  0, 35,  0, 42,  1,  0,  0,
+174,  1,  0,  0,  0,  0, 35,  0, 41,  1,  0,  0, 42,  1,  0,  0,  0,  0, 35,  0, 41,  1,  0,  0,174,  1,  0,  0,  0,  0, 35,  0,
+184,  0,  0,  0,176,  1,  0,  0,  0,  0, 35,  0,188,  0,  0,  0,176,  1,  0,  0,  0,  0, 35,  0,184,  0,  0,  0,188,  0,  0,  0,
+  0,  0, 35,  0,176,  1,  0,  0,177,  1,  0,  0,  0,  0, 35,  0,176,  1,  0,  0,178,  1,  0,  0,  0,  0, 35,  0,177,  1,  0,  0,
+178,  1,  0,  0,  0,  0, 35,  0,185,  0,  0,  0, 42,  1,  0,  0,  0,  0, 35,  0, 42,  1,  0,  0,178,  1,  0,  0,  0,  0, 35,  0,
+185,  0,  0,  0,178,  1,  0,  0,  0,  0, 35,  0, 43,  1,  0,  0,177,  1,  0,  0,  0,  0, 35,  0,189,  0,  0,  0, 43,  1,  0,  0,
+  0,  0, 35,  0,189,  0,  0,  0,177,  1,  0,  0,  0,  0, 35,  0,183,  0,  0,  0,179,  1,  0,  0,  0,  0, 35,  0, 41,  1,  0,  0,
+179,  1,  0,  0,  0,  0, 35,  0,183,  0,  0,  0, 41,  1,  0,  0,  0,  0, 35,  0,179,  1,  0,  0,180,  1,  0,  0,  0,  0, 35,  0,
+179,  1,  0,  0,181,  1,  0,  0,  0,  0, 35,  0,180,  1,  0,  0,181,  1,  0,  0,  0,  0, 35,  0,166,  0,  0,  0,182,  0,  0,  0,
+  0,  0, 35,  0,166,  0,  0,  0,181,  1,  0,  0,  0,  0, 35,  0,182,  0,  0,  0,181,  1,  0,  0,  0,  0, 35,  0,167,  0,  0,  0,
+180,  1,  0,  0,  0,  0, 35,  0,167,  0,  0,  0, 40,  1,  0,  0,  0,  0, 35,  0, 40,  1,  0,  0,180,  1,  0,  0,  0,  0, 35,  0,
+ 45,  1,  0,  0,182,  1,  0,  0,  0,  0, 35,  0,195,  0,  0,  0,182,  1,  0,  0,  0,  0, 35,  0,195,  0,  0,  0, 45,  1,  0,  0,
+  0,  0, 35,  0,182,  1,  0,  0,183,  1,  0,  0,  0,  0, 35,  0,182,  1,  0,  0,184,  1,  0,  0,  0,  0, 35,  0,183,  1,  0,  0,
+184,  1,  0,  0,  0,  0, 35,  0,185,  0,  0,  0, 44,  1,  0,  0,  0,  0, 35,  0,185,  0,  0,  0,184,  1,  0,  0,  0,  0, 35,  0,
+ 44,  1,  0,  0,184,  1,  0,  0,  0,  0, 35,  0,184,  0,  0,  0,183,  1,  0,  0,  0,  0, 35,  0,184,  0,  0,  0,194,  0,  0,  0,
+  0,  0, 35,  0,194,  0,  0,  0,183,  1,  0,  0,  0,  0, 35,  0, 44,  1,  0,  0,185,  1,  0,  0,  0,  0, 35,  0, 46,  1,  0,  0,
+185,  1,  0,  0,  0,  0, 35,  0, 44,  1,  0,  0, 46,  1,  0,  0,  0,  0, 35,  0,185,  1,  0,  0,186,  1,  0,  0,  0,  0, 35,  0,
+185,  1,  0,  0,187,  1,  0,  0,  0,  0, 35,  0,186,  1,  0,  0,187,  1,  0,  0,  0,  0, 35,  0, 45,  1,  0,  0, 49,  1,  0,  0,
+  0,  0, 35,  0, 49,  1,  0,  0,187,  1,  0,  0,  0,  0, 35,  0, 45,  1,  0,  0,187,  1,  0,  0,  0,  0, 35,  0, 48,  1,  0,  0,
+186,  1,  0,  0,  0,  0, 35,  0, 47,  1,  0,  0, 48,  1,  0,  0,  0,  0, 35,  0, 47,  1,  0,  0,186,  1,  0,  0,  0,  0, 35,  0,
+192,  0,  0,  0,188,  1,  0,  0,  0,  0, 35,  0,196,  0,  0,  0,188,  1,  0,  0,  0,  0, 35,  0,192,  0,  0,  0,196,  0,  0,  0,
+  0,  0, 35,  0,188,  1,  0,  0,189,  1,  0,  0,  0,  0, 35,  0,188,  1,  0,  0,190,  1,  0,  0,  0,  0, 35,  0,189,  1,  0,  0,
+190,  1,  0,  0,  0,  0, 35,  0,193,  0,  0,  0, 48,  1,  0,  0,  0,  0, 35,  0, 48,  1,  0,  0,190,  1,  0,  0,  0,  0, 35,  0,
+193,  0,  0,  0,190,  1,  0,  0,  0,  0, 35,  0, 49,  1,  0,  0,189,  1,  0,  0,  0,  0, 35,  0,197,  0,  0,  0, 49,  1,  0,  0,
+  0,  0, 35,  0,197,  0,  0,  0,189,  1,  0,  0,  0,  0, 35,  0,191,  0,  0,  0,191,  1,  0,  0,  0,  0, 35,  0, 47,  1,  0,  0,
+191,  1,  0,  0,  0,  0, 35,  0,191,  0,  0,  0, 47,  1,  0,  0,  0,  0, 35,  0,191,  1,  0,  0,192,  1,  0,  0,  0,  0, 35,  0,
+191,  1,  0,  0,193,  1,  0,  0,  0,  0, 35,  0,192,  1,  0,  0,193,  1,  0,  0,  0,  0, 35,  0,182,  0,  0,  0,190,  0,  0,  0,
+  0,  0, 35,  0,182,  0,  0,  0,193,  1,  0,  0,  0,  0, 35,  0,190,  0,  0,  0,193,  1,  0,  0,  0,  0, 35,  0,183,  0,  0,  0,
+192,  1,  0,  0,  0,  0, 35,  0,183,  0,  0,  0, 46,  1,  0,  0,  0,  0, 35,  0, 46,  1,  0,  0,192,  1,  0,  0,  0,  0, 35,  0,
+ 51,  1,  0,  0,194,  1,  0,  0,  0,  0, 35,  0,199,  0,  0,  0,194,  1,  0,  0,  0,  0, 35,  0,199,  0,  0,  0, 51,  1,  0,  0,
+  0,  0, 35,  0,194,  1,  0,  0,195,  1,  0,  0,  0,  0, 35,  0,194,  1,  0,  0,196,  1,  0,  0,  0,  0, 35,  0,195,  1,  0,  0,
+196,  1,  0,  0,  0,  0, 35,  0,193,  0,  0,  0, 50,  1,  0,  0,  0,  0, 35,  0,193,  0,  0,  0,196,  1,  0,  0,  0,  0, 35,  0,
+ 50,  1,  0,  0,196,  1,  0,  0,  0,  0, 35,  0,192,  0,  0,  0,195,  1,  0,  0,  0,  0, 35,  0,192,  0,  0,  0,198,  0,  0,  0,
+  0,  0, 35,  0,198,  0,  0,  0,195,  1,  0,  0,  0,  0, 35,  0, 50,  1,  0,  0,197,  1,  0,  0,  0,  0, 35,  0, 53,  1,  0,  0,
+197,  1,  0,  0,  0,  0, 35,  0, 50,  1,  0,  0, 53,  1,  0,  0,  0,  0, 35,  0,197,  1,  0,  0,198,  1,  0,  0,  0,  0, 35,  0,
+197,  1,  0,  0,199,  1,  0,  0,  0,  0, 35,  0,198,  1,  0,  0,199,  1,  0,  0,  0,  0, 35,  0, 51,  1,  0,  0, 55,  1,  0,  0,
+  0,  0, 35,  0, 55,  1,  0,  0,199,  1,  0,  0,  0,  0, 35,  0, 51,  1,  0,  0,199,  1,  0,  0,  0,  0, 35,  0, 54,  1,  0,  0,
+198,  1,  0,  0,  0,  0, 35,  0, 52,  1,  0,  0, 54,  1,  0,  0,  0,  0, 35,  0, 52,  1,  0,  0,198,  1,  0,  0,  0,  0, 35,  0,
+176,  0,  0,  0,200,  1,  0,  0,  0,  0, 35,  0,200,  0,  0,  0,200,  1,  0,  0,  0,  0, 35,  0,176,  0,  0,  0,200,  0,  0,  0,
+  0,  0, 35,  0,200,  1,  0,  0,201,  1,  0,  0,  0,  0, 35,  0,200,  1,  0,  0,202,  1,  0,  0,  0,  0, 35,  0,201,  1,  0,  0,
+202,  1,  0,  0,  0,  0, 35,  0,177,  0,  0,  0, 54,  1,  0,  0,  0,  0, 35,  0, 54,  1,  0,  0,202,  1,  0,  0,  0,  0, 35,  0,
+177,  0,  0,  0,202,  1,  0,  0,  0,  0, 35,  0, 55,  1,  0,  0,201,  1,  0,  0,  0,  0, 35,  0,201,  0,  0,  0, 55,  1,  0,  0,
+  0,  0, 35,  0,201,  0,  0,  0,201,  1,  0,  0,  0,  0, 35,  0,175,  0,  0,  0,203,  1,  0,  0,  0,  0, 35,  0, 52,  1,  0,  0,
+203,  1,  0,  0,  0,  0, 35,  0,175,  0,  0,  0, 52,  1,  0,  0,  0,  0, 35,  0,203,  1,  0,  0,204,  1,  0,  0,  0,  0, 35,  0,
+203,  1,  0,  0,205,  1,  0,  0,  0,  0, 35,  0,204,  1,  0,  0,205,  1,  0,  0,  0,  0, 35,  0,174,  0,  0,  0,190,  0,  0,  0,
+  0,  0, 35,  0,190,  0,  0,  0,205,  1,  0,  0,  0,  0, 35,  0,174,  0,  0,  0,205,  1,  0,  0,  0,  0, 35,  0,191,  0,  0,  0,
+204,  1,  0,  0,  0,  0, 35,  0,191,  0,  0,  0, 53,  1,  0,  0,  0,  0, 35,  0, 53,  1,  0,  0,204,  1,  0,  0,  0,  0, 35,  0,
+ 57,  1,  0,  0,206,  1,  0,  0,  0,  0, 35,  0,207,  0,  0,  0, 57,  1,  0,  0,  0,  0, 35,  0,207,  0,  0,  0,206,  1,  0,  0,
+  0,  0, 35,  0,206,  1,  0,  0,207,  1,  0,  0,  0,  0, 35,  0,207,  1,  0,  0,208,  1,  0,  0,  0,  0, 35,  0,206,  1,  0,  0,
+208,  1,  0,  0,  0,  0, 35,  0,179,  0,  0,  0, 56,  1,  0,  0,  0,  0, 35,  0, 56,  1,  0,  0,208,  1,  0,  0,  0,  0, 35,  0,
+179,  0,  0,  0,208,  1,  0,  0,  0,  0, 35,  0,178,  0,  0,  0,207,  1,  0,  0,  0,  0, 35,  0,206,  0,  0,  0,207,  1,  0,  0,
+  0,  0, 35,  0,178,  0,  0,  0,206,  0,  0,  0,  0,  0, 35,  0, 56,  1,  0,  0,209,  1,  0,  0,  0,  0, 35,  0, 56,  1,  0,  0,
+ 58,  1,  0,  0,  0,  0, 35,  0, 58,  1,  0,  0,209,  1,  0,  0,  0,  0, 35,  0,209,  1,  0,  0,210,  1,  0,  0,  0,  0, 35,  0,
+210,  1,  0,  0,211,  1,  0,  0,  0,  0, 35,  0,209,  1,  0,  0,211,  1,  0,  0,  0,  0, 35,  0, 57,  1,  0,  0, 61,  1,  0,  0,
+  0,  0, 35,  0, 57,  1,  0,  0,211,  1,  0,  0,  0,  0, 35,  0, 61,  1,  0,  0,211,  1,  0,  0,  0,  0, 35,  0, 60,  1,  0,  0,
+210,  1,  0,  0,  0,  0, 35,  0, 59,  1,  0,  0,210,  1,  0,  0,  0,  0, 35,  0, 59,  1,  0,  0, 60,  1,  0,  0,  0,  0, 35,  0,
+204,  0,  0,  0,212,  1,  0,  0,  0,  0, 35,  0,204,  0,  0,  0,208,  0,  0,  0,  0,  0, 35,  0,208,  0,  0,  0,212,  1,  0,  0,
+  0,  0, 35,  0,212,  1,  0,  0,213,  1,  0,  0,  0,  0, 35,  0,213,  1,  0,  0,214,  1,  0,  0,  0,  0, 35,  0,212,  1,  0,  0,
+214,  1,  0,  0,  0,  0, 35,  0,205,  0,  0,  0, 60,  1,  0,  0,  0,  0, 35,  0,205,  0,  0,  0,214,  1,  0,  0,  0,  0, 35,  0,
+ 60,  1,  0,  0,214,  1,  0,  0,  0,  0, 35,  0, 61,  1,  0,  0,213,  1,  0,  0,  0,  0, 35,  0,209,  0,  0,  0,213,  1,  0,  0,
+  0,  0, 35,  0,209,  0,  0,  0, 61,  1,  0,  0,  0,  0, 35,  0,203,  0,  0,  0,215,  1,  0,  0,  0,  0, 35,  0,203,  0,  0,  0,
+ 59,  1,  0,  0,  0,  0, 35,  0, 59,  1,  0,  0,215,  1,  0,  0,  0,  0, 35,  0,215,  1,  0,  0,216,  1,  0,  0,  0,  0, 35,  0,
+216,  1,  0,  0,217,  1,  0,  0,  0,  0, 35,  0,215,  1,  0,  0,217,  1,  0,  0,  0,  0, 35,  0,180,  0,  0,  0,202,  0,  0,  0,
+  0,  0, 35,  0,202,  0,  0,  0,217,  1,  0,  0,  0,  0, 35,  0,180,  0,  0,  0,217,  1,  0,  0,  0,  0, 35,  0,181,  0,  0,  0,
+216,  1,  0,  0,  0,  0, 35,  0, 58,  1,  0,  0,216,  1,  0,  0,  0,  0, 35,  0,181,  0,  0,  0, 58,  1,  0,  0,  0,  0, 35,  0,
+ 63,  1,  0,  0,218,  1,  0,  0,  0,  0, 35,  0,215,  0,  0,  0, 63,  1,  0,  0,  0,  0, 35,  0,215,  0,  0,  0,218,  1,  0,  0,
+  0,  0, 35,  0,218,  1,  0,  0,219,  1,  0,  0,  0,  0, 35,  0,219,  1,  0,  0,220,  1,  0,  0,  0,  0, 35,  0,218,  1,  0,  0,
+220,  1,  0,  0,  0,  0, 35,  0,173,  0,  0,  0, 62,  1,  0,  0,  0,  0, 35,  0, 62,  1,  0,  0,220,  1,  0,  0,  0,  0, 35,  0,
+173,  0,  0,  0,220,  1,  0,  0,  0,  0, 35,  0,172,  0,  0,  0,219,  1,  0,  0,  0,  0, 35,  0,214,  0,  0,  0,219,  1,  0,  0,
+  0,  0, 35,  0,172,  0,  0,  0,214,  0,  0,  0,  0,  0, 35,  0, 62,  1,  0,  0,221,  1,  0,  0,  0,  0, 35,  0, 62,  1,  0,  0,
+ 64,  1,  0,  0,  0,  0, 35,  0, 64,  1,  0,  0,221,  1,  0,  0,  0,  0, 35,  0,221,  1,  0,  0,222,  1,  0,  0,  0,  0, 35,  0,
+222,  1,  0,  0,223,  1,  0,  0,  0,  0, 35,  0,221,  1,  0,  0,223,  1,  0,  0,  0,  0, 35,  0, 63,  1,  0,  0, 67,  1,  0,  0,
+  0,  0, 35,  0, 63,  1,  0,  0,223,  1,  0,  0,  0,  0, 35,  0, 67,  1,  0,  0,223,  1,  0,  0,  0,  0, 35,  0, 66,  1,  0,  0,
+222,  1,  0,  0,  0,  0, 35,  0, 65,  1,  0,  0,222,  1,  0,  0,  0,  0, 35,  0, 65,  1,  0,  0, 66,  1,  0,  0,  0,  0, 35,  0,
+212,  0,  0,  0,224,  1,  0,  0,  0,  0, 35,  0,212,  0,  0,  0,216,  0,  0,  0,  0,  0, 35,  0,216,  0,  0,  0,224,  1,  0,  0,
+  0,  0, 35,  0,224,  1,  0,  0,225,  1,  0,  0,  0,  0, 35,  0,225,  1,  0,  0,226,  1,  0,  0,  0,  0, 35,  0,224,  1,  0,  0,
+226,  1,  0,  0,  0,  0, 35,  0,213,  0,  0,  0, 66,  1,  0,  0,  0,  0, 35,  0,213,  0,  0,  0,226,  1,  0,  0,  0,  0, 35,  0,
+ 66,  1,  0,  0,226,  1,  0,  0,  0,  0, 35,  0, 67,  1,  0,  0,225,  1,  0,  0,  0,  0, 35,  0,217,  0,  0,  0,225,  1,  0,  0,
+  0,  0, 35,  0,217,  0,  0,  0, 67,  1,  0,  0,  0,  0, 35,  0,211,  0,  0,  0,227,  1,  0,  0,  0,  0, 35,  0,211,  0,  0,  0,
+ 65,  1,  0,  0,  0,  0, 35,  0, 65,  1,  0,  0,227,  1,  0,  0,  0,  0, 35,  0,227,  1,  0,  0,228,  1,  0,  0,  0,  0, 35,  0,
+228,  1,  0,  0,229,  1,  0,  0,  0,  0, 35,  0,227,  1,  0,  0,229,  1,  0,  0,  0,  0, 35,  0,170,  0,  0,  0,210,  0,  0,  0,
+  0,  0, 35,  0,210,  0,  0,  0,229,  1,  0,  0,  0,  0, 35,  0,170,  0,  0,  0,229,  1,  0,  0,  0,  0, 35,  0,171,  0,  0,  0,
+228,  1,  0,  0,  0,  0, 35,  0, 64,  1,  0,  0,228,  1,  0,  0,  0,  0, 35,  0,171,  0,  0,  0, 64,  1,  0,  0,  0,  0, 35,  0,
+ 69,  1,  0,  0,230,  1,  0,  0,  0,  0, 35,  0,223,  0,  0,  0, 69,  1,  0,  0,  0,  0, 35,  0,223,  0,  0,  0,230,  1,  0,  0,
+  0,  0, 35,  0,230,  1,  0,  0,231,  1,  0,  0,  0,  0, 35,  0,231,  1,  0,  0,232,  1,  0,  0,  0,  0, 35,  0,230,  1,  0,  0,
+232,  1,  0,  0,  0,  0, 35,  0,189,  0,  0,  0, 68,  1,  0,  0,  0,  0, 35,  0, 68,  1,  0,  0,232,  1,  0,  0,  0,  0, 35,  0,
+189,  0,  0,  0,232,  1,  0,  0,  0,  0, 35,  0,188,  0,  0,  0,231,  1,  0,  0,  0,  0, 35,  0,222,  0,  0,  0,231,  1,  0,  0,
+  0,  0, 35,  0,188,  0,  0,  0,222,  0,  0,  0,  0,  0, 35,  0, 68,  1,  0,  0,233,  1,  0,  0,  0,  0, 35,  0, 68,  1,  0,  0,
+ 70,  1,  0,  0,  0,  0, 35,  0, 70,  1,  0,  0,233,  1,  0,  0,  0,  0, 35,  0,233,  1,  0,  0,234,  1,  0,  0,  0,  0, 35,  0,
+234,  1,  0,  0,235,  1,  0,  0,  0,  0, 35,  0,233,  1,  0,  0,235,  1,  0,  0,  0,  0, 35,  0, 69,  1,  0,  0, 73,  1,  0,  0,
+  0,  0, 35,  0, 69,  1,  0,  0,235,  1,  0,  0,  0,  0, 35,  0, 73,  1,  0,  0,235,  1,  0,  0,  0,  0, 35,  0, 72,  1,  0,  0,
+234,  1,  0,  0,  0,  0, 35,  0, 71,  1,  0,  0,234,  1,  0,  0,  0,  0, 35,  0, 71,  1,  0,  0, 72,  1,  0,  0,  0,  0, 35,  0,
+220,  0,  0,  0,236,  1,  0,  0,  0,  0, 35,  0,220,  0,  0,  0,224,  0,  0,  0,  0,  0, 35,  0,224,  0,  0,  0,236,  1,  0,  0,
+  0,  0, 35,  0,236,  1,  0,  0,237,  1,  0,  0,  0,  0, 35,  0,237,  1,  0,  0,238,  1,  0,  0,  0,  0, 35,  0,236,  1,  0,  0,
+238,  1,  0,  0,  0,  0, 35,  0,221,  0,  0,  0, 72,  1,  0,  0,  0,  0, 35,  0,221,  0,  0,  0,238,  1,  0,  0,  0,  0, 35,  0,
+ 72,  1,  0,  0,238,  1,  0,  0,  0,  0, 35,  0, 73,  1,  0,  0,237,  1,  0,  0,  0,  0, 35,  0,225,  0,  0,  0,237,  1,  0,  0,
+  0,  0, 35,  0,225,  0,  0,  0, 73,  1,  0,  0,  0,  0, 35,  0,219,  0,  0,  0,239,  1,  0,  0,  0,  0, 35,  0,219,  0,  0,  0,
+ 71,  1,  0,  0,  0,  0, 35,  0, 71,  1,  0,  0,239,  1,  0,  0,  0,  0, 35,  0,239,  1,  0,  0,240,  1,  0,  0,  0,  0, 35,  0,
+240,  1,  0,  0,241,  1,  0,  0,  0,  0, 35,  0,239,  1,  0,  0,241,  1,  0,  0,  0,  0, 35,  0,186,  0,  0,  0,218,  0,  0,  0,
+  0,  0, 35,  0,218,  0,  0,  0,241,  1,  0,  0,  0,  0, 35,  0,186,  0,  0,  0,241,  1,  0,  0,  0,  0, 35,  0,187,  0,  0,  0,
+240,  1,  0,  0,  0,  0, 35,  0, 70,  1,  0,  0,240,  1,  0,  0,  0,  0, 35,  0,187,  0,  0,  0, 70,  1,  0,  0,  0,  0, 35,  0,
+ 75,  1,  0,  0,242,  1,  0,  0,  0,  0, 35,  0,231,  0,  0,  0, 75,  1,  0,  0,  0,  0, 35,  0,231,  0,  0,  0,242,  1,  0,  0,
+  0,  0, 35,  0,242,  1,  0,  0,243,  1,  0,  0,  0,  0, 35,  0,243,  1,  0,  0,244,  1,  0,  0,  0,  0, 35,  0,242,  1,  0,  0,
+244,  1,  0,  0,  0,  0, 35,  0,197,  0,  0,  0, 74,  1,  0,  0,  0,  0, 35,  0, 74,  1,  0,  0,244,  1,  0,  0,  0,  0, 35,  0,
+197,  0,  0,  0,244,  1,  0,  0,  0,  0, 35,  0,196,  0,  0,  0,243,  1,  0,  0,  0,  0, 35,  0,230,  0,  0,  0,243,  1,  0,  0,
+  0,  0, 35,  0,196,  0,  0,  0,230,  0,  0,  0,  0,  0, 35,  0, 74,  1,  0,  0,245,  1,  0,  0,  0,  0, 35,  0, 74,  1,  0,  0,
+ 76,  1,  0,  0,  0,  0, 35,  0, 76,  1,  0,  0,245,  1,  0,  0,  0,  0, 35,  0,245,  1,  0,  0,246,  1,  0,  0,  0,  0, 35,  0,
+246,  1,  0,  0,247,  1,  0,  0,  0,  0, 35,  0,245,  1,  0,  0,247,  1,  0,  0,  0,  0, 35,  0, 75,  1,  0,  0, 79,  1,  0,  0,
+  0,  0, 35,  0, 75,  1,  0,  0,247,  1,  0,  0,  0,  0, 35,  0, 79,  1,  0,  0,247,  1,  0,  0,  0,  0, 35,  0, 78,  1,  0,  0,
+246,  1,  0,  0,  0,  0, 35,  0, 77,  1,  0,  0,246,  1,  0,  0,  0,  0, 35,  0, 77,  1,  0,  0, 78,  1,  0,  0,  0,  0, 35,  0,
+228,  0,  0,  0,248,  1,  0,  0,  0,  0, 35,  0,228,  0,  0,  0,232,  0,  0,  0,  0,  0, 35,  0,232,  0,  0,  0,248,  1,  0,  0,
+  0,  0, 35,  0,248,  1,  0,  0,249,  1,  0,  0,  0,  0, 35,  0,249,  1,  0,  0,250,  1,  0,  0,  0,  0, 35,  0,248,  1,  0,  0,
+250,  1,  0,  0,  0,  0, 35,  0,229,  0,  0,  0, 78,  1,  0,  0,  0,  0, 35,  0,229,  0,  0,  0,250,  1,  0,  0,  0,  0, 35,  0,
+ 78,  1,  0,  0,250,  1,  0,  0,  0,  0, 35,  0, 79,  1,  0,  0,249,  1,  0,  0,  0,  0, 35,  0,233,  0,  0,  0,249,  1,  0,  0,
+  0,  0, 35,  0,233,  0,  0,  0, 79,  1,  0,  0,  0,  0, 35,  0,227,  0,  0,  0,251,  1,  0,  0,  0,  0, 35,  0,227,  0,  0,  0,
+ 77,  1,  0,  0,  0,  0, 35,  0, 77,  1,  0,  0,251,  1,  0,  0,  0,  0, 35,  0,251,  1,  0,  0,252,  1,  0,  0,  0,  0, 35,  0,
+252,  1,  0,  0,253,  1,  0,  0,  0,  0, 35,  0,251,  1,  0,  0,253,  1,  0,  0,  0,  0, 35,  0,194,  0,  0,  0,226,  0,  0,  0,
+  0,  0, 35,  0,226,  0,  0,  0,253,  1,  0,  0,  0,  0, 35,  0,194,  0,  0,  0,253,  1,  0,  0,  0,  0, 35,  0,195,  0,  0,  0,
+252,  1,  0,  0,  0,  0, 35,  0, 76,  1,  0,  0,252,  1,  0,  0,  0,  0, 35,  0,195,  0,  0,  0, 76,  1,  0,  0,  0,  0, 35,  0,
+ 81,  1,  0,  0,254,  1,  0,  0,  0,  0, 35,  0,239,  0,  0,  0, 81,  1,  0,  0,  0,  0, 35,  0,239,  0,  0,  0,254,  1,  0,  0,
+  0,  0, 35,  0,254,  1,  0,  0,255,  1,  0,  0,  0,  0, 35,  0,255,  1,  0,  0,  0,  2,  0,  0,  0,  0, 35,  0,254,  1,  0,  0,
+  0,  2,  0,  0,  0,  0, 35,  0,201,  0,  0,  0, 80,  1,  0,  0,  0,  0, 35,  0, 80,  1,  0,  0,  0,  2,  0,  0,  0,  0, 35,  0,
+201,  0,  0,  0,  0,  2,  0,  0,  0,  0, 35,  0,200,  0,  0,  0,255,  1,  0,  0,  0,  0, 35,  0,238,  0,  0,  0,255,  1,  0,  0,
+  0,  0, 35,  0,200,  0,  0,  0,238,  0,  0,  0,  0,  0, 35,  0, 80,  1,  0,  0,  1,  2,  0,  0,  0,  0, 35,  0, 80,  1,  0,  0,
+ 82,  1,  0,  0,  0,  0, 35,  0, 82,  1,  0,  0,  1,  2,  0,  0,  0,  0, 35,  0,  1,  2,  0,  0,  2,  2,  0,  0,  0,  0, 35,  0,
+  2,  2,  0,  0,  3,  2,  0,  0,  0,  0, 35,  0,  1,  2,  0,  0,  3,  2,  0,  0,  0,  0, 35,  0, 81,  1,  0,  0, 85,  1,  0,  0,
+  0,  0, 35,  0, 81,  1,  0,  0,  3,  2,  0,  0,  0,  0, 35,  0, 85,  1,  0,  0,  3,  2,  0,  0,  0,  0, 35,  0, 84,  1,  0,  0,
+  2,  2,  0,  0,  0,  0, 35,  0, 83,  1,  0,  0,  2,  2,  0,  0,  0,  0, 35,  0, 83,  1,  0,  0, 84,  1,  0,  0,  0,  0, 35,  0,
+236,  0,  0,  0,  4,  2,  0,  0,  0,  0, 35,  0,236,  0,  0,  0,240,  0,  0,  0,  0,  0, 35,  0,240,  0,  0,  0,  4,  2,  0,  0,
+  0,  0, 35,  0,  4,  2,  0,  0,  5,  2,  0,  0,  0,  0, 35,  0,  5,  2,  0,  0,  6,  2,  0,  0,  0,  0, 35,  0,  4,  2,  0,  0,
+  6,  2,  0,  0,  0,  0, 35,  0,237,  0,  0,  0, 84,  1,  0,  0,  0,  0, 35,  0,237,  0,  0,  0,  6,  2,  0,  0,  0,  0, 35,  0,
+ 84,  1,  0,  0,  6,  2,  0,  0,  0,  0, 35,  0, 85,  1,  0,  0,  5,  2,  0,  0,  0,  0, 35,  0,241,  0,  0,  0,  5,  2,  0,  0,
+  0,  0, 35,  0,241,  0,  0,  0, 85,  1,  0,  0,  0,  0, 35,  0,235,  0,  0,  0,  7,  2,  0,  0,  0,  0, 35,  0,235,  0,  0,  0,
+ 83,  1,  0,  0,  0,  0, 35,  0, 83,  1,  0,  0,  7,  2,  0,  0,  0,  0, 35,  0,  7,  2,  0,  0,  8,  2,  0,  0,  0,  0, 35,  0,
+  8,  2,  0,  0,  9,  2,  0,  0,  0,  0, 35,  0,  7,  2,  0,  0,  9,  2,  0,  0,  0,  0, 35,  0,198,  0,  0,  0,234,  0,  0,  0,
+  0,  0, 35,  0,234,  0,  0,  0,  9,  2,  0,  0,  0,  0, 35,  0,198,  0,  0,  0,  9,  2,  0,  0,  0,  0, 35,  0,199,  0,  0,  0,
+  8,  2,  0,  0,  0,  0, 35,  0, 82,  1,  0,  0,  8,  2,  0,  0,  0,  0, 35,  0,199,  0,  0,  0, 82,  1,  0,  0,  0,  0, 35,  0,
+ 87,  1,  0,  0, 10,  2,  0,  0,  0,  0, 35,  0,245,  0,  0,  0, 10,  2,  0,  0,  0,  0, 35,  0,245,  0,  0,  0, 87,  1,  0,  0,
+  0,  0, 35,  0, 10,  2,  0,  0, 11,  2,  0,  0,  0,  0, 35,  0, 10,  2,  0,  0, 12,  2,  0,  0,  0,  0, 35,  0, 11,  2,  0,  0,
+ 12,  2,  0,  0,  0,  0, 35,  0,209,  0,  0,  0, 86,  1,  0,  0,  0,  0, 35,  0,209,  0,  0,  0, 12,  2,  0,  0,  0,  0, 35,  0,
+ 86,  1,  0,  0, 12,  2,  0,  0,  0,  0, 35,  0,208,  0,  0,  0, 11,  2,  0,  0,  0,  0, 35,  0,208,  0,  0,  0,244,  0,  0,  0,
+  0,  0, 35,  0,244,  0,  0,  0, 11,  2,  0,  0,  0,  0, 35,  0, 86,  1,  0,  0, 13,  2,  0,  0,  0,  0, 35,  0, 88,  1,  0,  0,
+ 13,  2,  0,  0,  0,  0, 35,  0, 86,  1,  0,  0, 88,  1,  0,  0,  0,  0, 35,  0, 13,  2,  0,  0, 14,  2,  0,  0,  0,  0, 35,  0,
+ 13,  2,  0,  0, 15,  2,  0,  0,  0,  0, 35,  0, 14,  2,  0,  0, 15,  2,  0,  0,  0,  0, 35,  0, 87,  1,  0,  0, 91,  1,  0,  0,
+  0,  0, 35,  0, 91,  1,  0,  0, 15,  2,  0,  0,  0,  0, 35,  0, 87,  1,  0,  0, 15,  2,  0,  0,  0,  0, 35,  0, 90,  1,  0,  0,
+ 14,  2,  0,  0,  0,  0, 35,  0, 89,  1,  0,  0, 90,  1,  0,  0,  0,  0, 35,  0, 89,  1,  0,  0, 14,  2,  0,  0,  0,  0, 35,  0,
+212,  0,  0,  0, 16,  2,  0,  0,  0,  0, 35,  0,242,  0,  0,  0, 16,  2,  0,  0,  0,  0, 35,  0,212,  0,  0,  0,242,  0,  0,  0,
+  0,  0, 35,  0, 16,  2,  0,  0, 17,  2,  0,  0,  0,  0, 35,  0, 16,  2,  0,  0, 18,  2,  0,  0,  0,  0, 35,  0, 17,  2,  0,  0,
+ 18,  2,  0,  0,  0,  0, 35,  0,213,  0,  0,  0, 90,  1,  0,  0,  0,  0, 35,  0, 90,  1,  0,  0, 18,  2,  0,  0,  0,  0, 35,  0,
+213,  0,  0,  0, 18,  2,  0,  0,  0,  0, 35,  0, 91,  1,  0,  0, 17,  2,  0,  0,  0,  0, 35,  0,243,  0,  0,  0, 91,  1,  0,  0,
+  0,  0, 35,  0,243,  0,  0,  0, 17,  2,  0,  0,  0,  0, 35,  0,211,  0,  0,  0, 19,  2,  0,  0,  0,  0, 35,  0, 89,  1,  0,  0,
+ 19,  2,  0,  0,  0,  0, 35,  0,211,  0,  0,  0, 89,  1,  0,  0,  0,  0, 35,  0, 19,  2,  0,  0, 20,  2,  0,  0,  0,  0, 35,  0,
+ 19,  2,  0,  0, 21,  2,  0,  0,  0,  0, 35,  0, 20,  2,  0,  0, 21,  2,  0,  0,  0,  0, 35,  0,206,  0,  0,  0,210,  0,  0,  0,
+  0,  0, 35,  0,206,  0,  0,  0, 21,  2,  0,  0,  0,  0, 35,  0,210,  0,  0,  0, 21,  2,  0,  0,  0,  0, 35,  0,207,  0,  0,  0,
+ 20,  2,  0,  0,  0,  0, 35,  0,207,  0,  0,  0, 88,  1,  0,  0,  0,  0, 35,  0, 88,  1,  0,  0, 20,  2,  0,  0,  0,  0, 35,  0,
+ 93,  1,  0,  0, 22,  2,  0,  0,  0,  0, 35,  0,247,  0,  0,  0, 22,  2,  0,  0,  0,  0, 35,  0,247,  0,  0,  0, 93,  1,  0,  0,
+  0,  0, 35,  0, 22,  2,  0,  0, 23,  2,  0,  0,  0,  0, 35,  0, 22,  2,  0,  0, 24,  2,  0,  0,  0,  0, 35,  0, 23,  2,  0,  0,
+ 24,  2,  0,  0,  0,  0, 35,  0,217,  0,  0,  0, 92,  1,  0,  0,  0,  0, 35,  0,217,  0,  0,  0, 24,  2,  0,  0,  0,  0, 35,  0,
+ 92,  1,  0,  0, 24,  2,  0,  0,  0,  0, 35,  0,216,  0,  0,  0, 23,  2,  0,  0,  0,  0, 35,  0,216,  0,  0,  0,246,  0,  0,  0,
+  0,  0, 35,  0,246,  0,  0,  0, 23,  2,  0,  0,  0,  0, 35,  0, 92,  1,  0,  0, 25,  2,  0,  0,  0,  0, 35,  0, 94,  1,  0,  0,
+ 25,  2,  0,  0,  0,  0, 35,  0, 92,  1,  0,  0, 94,  1,  0,  0,  0,  0, 35,  0, 25,  2,  0,  0, 26,  2,  0,  0,  0,  0, 35,  0,
+ 25,  2,  0,  0, 27,  2,  0,  0,  0,  0, 35,  0, 26,  2,  0,  0, 27,  2,  0,  0,  0,  0, 35,  0, 93,  1,  0,  0, 97,  1,  0,  0,
+  0,  0, 35,  0, 97,  1,  0,  0, 27,  2,  0,  0,  0,  0, 35,  0, 93,  1,  0,  0, 27,  2,  0,  0,  0,  0, 35,  0, 96,  1,  0,  0,
+ 26,  2,  0,  0,  0,  0, 35,  0, 95,  1,  0,  0, 96,  1,  0,  0,  0,  0, 35,  0, 95,  1,  0,  0, 26,  2,  0,  0,  0,  0, 35,  0,
+220,  0,  0,  0, 28,  2,  0,  0,  0,  0, 35,  0,248,  0,  0,  0, 28,  2,  0,  0,  0,  0, 35,  0,220,  0,  0,  0,248,  0,  0,  0,
+  0,  0, 35,  0, 28,  2,  0,  0, 29,  2,  0,  0,  0,  0, 35,  0, 28,  2,  0,  0, 30,  2,  0,  0,  0,  0, 35,  0, 29,  2,  0,  0,
+ 30,  2,  0,  0,  0,  0, 35,  0,221,  0,  0,  0, 96,  1,  0,  0,  0,  0, 35,  0, 96,  1,  0,  0, 30,  2,  0,  0,  0,  0, 35,  0,
+221,  0,  0,  0, 30,  2,  0,  0,  0,  0, 35,  0, 97,  1,  0,  0, 29,  2,  0,  0,  0,  0, 35,  0,249,  0,  0,  0, 97,  1,  0,  0,
+  0,  0, 35,  0,249,  0,  0,  0, 29,  2,  0,  0,  0,  0, 35,  0,219,  0,  0,  0, 31,  2,  0,  0,  0,  0, 35,  0, 95,  1,  0,  0,
+ 31,  2,  0,  0,  0,  0, 35,  0,219,  0,  0,  0, 95,  1,  0,  0,  0,  0, 35,  0, 31,  2,  0,  0, 32,  2,  0,  0,  0,  0, 35,  0,
+ 31,  2,  0,  0, 33,  2,  0,  0,  0,  0, 35,  0, 32,  2,  0,  0, 33,  2,  0,  0,  0,  0, 35,  0,214,  0,  0,  0,218,  0,  0,  0,
+  0,  0, 35,  0,214,  0,  0,  0, 33,  2,  0,  0,  0,  0, 35,  0,218,  0,  0,  0, 33,  2,  0,  0,  0,  0, 35,  0,215,  0,  0,  0,
+ 32,  2,  0,  0,  0,  0, 35,  0,215,  0,  0,  0, 94,  1,  0,  0,  0,  0, 35,  0, 94,  1,  0,  0, 32,  2,  0,  0,  0,  0, 35,  0,
+ 99,  1,  0,  0, 34,  2,  0,  0,  0,  0, 35,  0,251,  0,  0,  0, 34,  2,  0,  0,  0,  0, 35,  0,251,  0,  0,  0, 99,  1,  0,  0,
+  0,  0, 35,  0, 34,  2,  0,  0, 35,  2,  0,  0,  0,  0, 35,  0, 34,  2,  0,  0, 36,  2,  0,  0,  0,  0, 35,  0, 35,  2,  0,  0,
+ 36,  2,  0,  0,  0,  0, 35,  0,225,  0,  0,  0, 98,  1,  0,  0,  0,  0, 35,  0,225,  0,  0,  0, 36,  2,  0,  0,  0,  0, 35,  0,
+ 98,  1,  0,  0, 36,  2,  0,  0,  0,  0, 35,  0,224,  0,  0,  0, 35,  2,  0,  0,  0,  0, 35,  0,224,  0,  0,  0,250,  0,  0,  0,
+  0,  0, 35,  0,250,  0,  0,  0, 35,  2,  0,  0,  0,  0, 35,  0, 98,  1,  0,  0, 37,  2,  0,  0,  0,  0, 35,  0,100,  1,  0,  0,
+ 37,  2,  0,  0,  0,  0, 35,  0, 98,  1,  0,  0,100,  1,  0,  0,  0,  0, 35,  0, 37,  2,  0,  0, 38,  2,  0,  0,  0,  0, 35,  0,
+ 37,  2,  0,  0, 39,  2,  0,  0,  0,  0, 35,  0, 38,  2,  0,  0, 39,  2,  0,  0,  0,  0, 35,  0, 99,  1,  0,  0,103,  1,  0,  0,
+  0,  0, 35,  0,103,  1,  0,  0, 39,  2,  0,  0,  0,  0, 35,  0, 99,  1,  0,  0, 39,  2,  0,  0,  0,  0, 35,  0,102,  1,  0,  0,
+ 38,  2,  0,  0,  0,  0, 35,  0,101,  1,  0,  0,102,  1,  0,  0,  0,  0, 35,  0,101,  1,  0,  0, 38,  2,  0,  0,  0,  0, 35,  0,
+228,  0,  0,  0, 40,  2,  0,  0,  0,  0, 35,  0,252,  0,  0,  0, 40,  2,  0,  0,  0,  0, 35,  0,228,  0,  0,  0,252,  0,  0,  0,
+  0,  0, 35,  0, 40,  2,  0,  0, 41,  2,  0,  0,  0,  0, 35,  0, 40,  2,  0,  0, 42,  2,  0,  0,  0,  0, 35,  0, 41,  2,  0,  0,
+ 42,  2,  0,  0,  0,  0, 35,  0,229,  0,  0,  0,102,  1,  0,  0,  0,  0, 35,  0,102,  1,  0,  0, 42,  2,  0,  0,  0,  0, 35,  0,
+229,  0,  0,  0, 42,  2,  0,  0,  0,  0, 35,  0,103,  1,  0,  0, 41,  2,  0,  0,  0,  0, 35,  0,253,  0,  0,  0,103,  1,  0,  0,
+  0,  0, 35,  0,253,  0,  0,  0, 41,  2,  0,  0,  0,  0, 35,  0,227,  0,  0,  0, 43,  2,  0,  0,  0,  0, 35,  0,101,  1,  0,  0,
+ 43,  2,  0,  0,  0,  0, 35,  0,227,  0,  0,  0,101,  1,  0,  0,  0,  0, 35,  0, 43,  2,  0,  0, 44,  2,  0,  0,  0,  0, 35,  0,
+ 43,  2,  0,  0, 45,  2,  0,  0,  0,  0, 35,  0, 44,  2,  0,  0, 45,  2,  0,  0,  0,  0, 35,  0,222,  0,  0,  0,226,  0,  0,  0,
+  0,  0, 35,  0,222,  0,  0,  0, 45,  2,  0,  0,  0,  0, 35,  0,226,  0,  0,  0, 45,  2,  0,  0,  0,  0, 35,  0,223,  0,  0,  0,
+ 44,  2,  0,  0,  0,  0, 35,  0,223,  0,  0,  0,100,  1,  0,  0,  0,  0, 35,  0,100,  1,  0,  0, 44,  2,  0,  0,  0,  0, 35,  0,
+105,  1,  0,  0, 46,  2,  0,  0,  0,  0, 35,  0,255,  0,  0,  0, 46,  2,  0,  0,  0,  0, 35,  0,255,  0,  0,  0,105,  1,  0,  0,
+  0,  0, 35,  0, 46,  2,  0,  0, 47,  2,  0,  0,  0,  0, 35,  0, 46,  2,  0,  0, 48,  2,  0,  0,  0,  0, 35,  0, 47,  2,  0,  0,
+ 48,  2,  0,  0,  0,  0, 35,  0,233,  0,  0,  0,104,  1,  0,  0,  0,  0, 35,  0,233,  0,  0,  0, 48,  2,  0,  0,  0,  0, 35,  0,
+104,  1,  0,  0, 48,  2,  0,  0,  0,  0, 35,  0,232,  0,  0,  0, 47,  2,  0,  0,  0,  0, 35,  0,232,  0,  0,  0,254,  0,  0,  0,
+  0,  0, 35,  0,254,  0,  0,  0, 47,  2,  0,  0,  0,  0, 35,  0,104,  1,  0,  0, 49,  2,  0,  0,  0,  0, 35,  0,106,  1,  0,  0,
+ 49,  2,  0,  0,  0,  0, 35,  0,104,  1,  0,  0,106,  1,  0,  0,  0,  0, 35,  0, 49,  2,  0,  0, 50,  2,  0,  0,  0,  0, 35,  0,
+ 49,  2,  0,  0, 51,  2,  0,  0,  0,  0, 35,  0, 50,  2,  0,  0, 51,  2,  0,  0,  0,  0, 35,  0,105,  1,  0,  0,109,  1,  0,  0,
+  0,  0, 35,  0,109,  1,  0,  0, 51,  2,  0,  0,  0,  0, 35,  0,105,  1,  0,  0, 51,  2,  0,  0,  0,  0, 35,  0,108,  1,  0,  0,
+ 50,  2,  0,  0,  0,  0, 35,  0,107,  1,  0,  0,108,  1,  0,  0,  0,  0, 35,  0,107,  1,  0,  0, 50,  2,  0,  0,  0,  0, 35,  0,
+236,  0,  0,  0, 52,  2,  0,  0,  0,  0, 35,  0,  0,  1,  0,  0, 52,  2,  0,  0,  0,  0, 35,  0,236,  0,  0,  0,  0,  1,  0,  0,
+  0,  0, 35,  0, 52,  2,  0,  0, 53,  2,  0,  0,  0,  0, 35,  0, 52,  2,  0,  0, 54,  2,  0,  0,  0,  0, 35,  0, 53,  2,  0,  0,
+ 54,  2,  0,  0,  0,  0, 35,  0,237,  0,  0,  0,108,  1,  0,  0,  0,  0, 35,  0,108,  1,  0,  0, 54,  2,  0,  0,  0,  0, 35,  0,
+237,  0,  0,  0, 54,  2,  0,  0,  0,  0, 35,  0,109,  1,  0,  0, 53,  2,  0,  0,  0,  0, 35,  0,  1,  1,  0,  0,109,  1,  0,  0,
+  0,  0, 35,  0,  1,  1,  0,  0, 53,  2,  0,  0,  0,  0, 35,  0,235,  0,  0,  0, 55,  2,  0,  0,  0,  0, 35,  0,107,  1,  0,  0,
+ 55,  2,  0,  0,  0,  0, 35,  0,235,  0,  0,  0,107,  1,  0,  0,  0,  0, 35,  0, 55,  2,  0,  0, 56,  2,  0,  0,  0,  0, 35,  0,
+ 55,  2,  0,  0, 57,  2,  0,  0,  0,  0, 35,  0, 56,  2,  0,  0, 57,  2,  0,  0,  0,  0, 35,  0,230,  0,  0,  0,234,  0,  0,  0,
+  0,  0, 35,  0,230,  0,  0,  0, 57,  2,  0,  0,  0,  0, 35,  0,234,  0,  0,  0, 57,  2,  0,  0,  0,  0, 35,  0,231,  0,  0,  0,
+ 56,  2,  0,  0,  0,  0, 35,  0,231,  0,  0,  0,106,  1,  0,  0,  0,  0, 35,  0,106,  1,  0,  0, 56,  2,  0,  0,  0,  0, 35,  0,
+111,  1,  0,  0, 58,  2,  0,  0,  0,  0, 35,  0,  3,  1,  0,  0, 58,  2,  0,  0,  0,  0, 35,  0,  3,  1,  0,  0,111,  1,  0,  0,
+  0,  0, 35,  0, 58,  2,  0,  0, 59,  2,  0,  0,  0,  0, 35,  0, 58,  2,  0,  0, 60,  2,  0,  0,  0,  0, 35,  0, 59,  2,  0,  0,
+ 60,  2,  0,  0,  0,  0, 35,  0,241,  0,  0,  0,110,  1,  0,  0,  0,  0, 35,  0,241,  0,  0,  0, 60,  2,  0,  0,  0,  0, 35,  0,
+110,  1,  0,  0, 60,  2,  0,  0,  0,  0, 35,  0,240,  0,  0,  0, 59,  2,  0,  0,  0,  0, 35,  0,240,  0,  0,  0,  2,  1,  0,  0,
+  0,  0, 35,  0,  2,  1,  0,  0, 59,  2,  0,  0,  0,  0, 35,  0,110,  1,  0,  0, 61,  2,  0,  0,  0,  0, 35,  0,113,  1,  0,  0,
+ 61,  2,  0,  0,  0,  0, 35,  0,110,  1,  0,  0,113,  1,  0,  0,  0,  0, 35,  0, 61,  2,  0,  0, 62,  2,  0,  0,  0,  0, 35,  0,
+ 61,  2,  0,  0, 63,  2,  0,  0,  0,  0, 35,  0, 62,  2,  0,  0, 63,  2,  0,  0,  0,  0, 35,  0,111,  1,  0,  0,115,  1,  0,  0,
+  0,  0, 35,  0,115,  1,  0,  0, 63,  2,  0,  0,  0,  0, 35,  0,111,  1,  0,  0, 63,  2,  0,  0,  0,  0, 35,  0,114,  1,  0,  0,
+ 62,  2,  0,  0,  0,  0, 35,  0,112,  1,  0,  0,114,  1,  0,  0,  0,  0, 35,  0,112,  1,  0,  0, 62,  2,  0,  0,  0,  0, 35,  0,
+204,  0,  0,  0, 64,  2,  0,  0,  0,  0, 35,  0,  4,  1,  0,  0, 64,  2,  0,  0,  0,  0, 35,  0,204,  0,  0,  0,  4,  1,  0,  0,
+  0,  0, 35,  0, 64,  2,  0,  0, 65,  2,  0,  0,  0,  0, 35,  0, 64,  2,  0,  0, 66,  2,  0,  0,  0,  0, 35,  0, 65,  2,  0,  0,
+ 66,  2,  0,  0,  0,  0, 35,  0,205,  0,  0,  0,114,  1,  0,  0,  0,  0, 35,  0,114,  1,  0,  0, 66,  2,  0,  0,  0,  0, 35,  0,
+205,  0,  0,  0, 66,  2,  0,  0,  0,  0, 35,  0,115,  1,  0,  0, 65,  2,  0,  0,  0,  0, 35,  0,  5,  1,  0,  0,115,  1,  0,  0,
+  0,  0, 35,  0,  5,  1,  0,  0, 65,  2,  0,  0,  0,  0, 35,  0,203,  0,  0,  0, 67,  2,  0,  0,  0,  0, 35,  0,112,  1,  0,  0,
+ 67,  2,  0,  0,  0,  0, 35,  0,203,  0,  0,  0,112,  1,  0,  0,  0,  0, 35,  0, 67,  2,  0,  0, 68,  2,  0,  0,  0,  0, 35,  0,
+ 67,  2,  0,  0, 69,  2,  0,  0,  0,  0, 35,  0, 68,  2,  0,  0, 69,  2,  0,  0,  0,  0, 35,  0,202,  0,  0,  0,238,  0,  0,  0,
+  0,  0, 35,  0,238,  0,  0,  0, 69,  2,  0,  0,  0,  0, 35,  0,202,  0,  0,  0, 69,  2,  0,  0,  0,  0, 35,  0,239,  0,  0,  0,
+ 68,  2,  0,  0,  0,  0, 35,  0,239,  0,  0,  0,113,  1,  0,  0,  0,  0, 35,  0,113,  1,  0,  0, 68,  2,  0,  0,  0,  0, 35,  0,
+117,  1,  0,  0, 70,  2,  0,  0,  0,  0, 35,  0, 11,  1,  0,  0,117,  1,  0,  0,  0,  0, 35,  0, 11,  1,  0,  0, 70,  2,  0,  0,
+  0,  0, 35,  0, 70,  2,  0,  0, 71,  2,  0,  0,  0,  0, 35,  0, 71,  2,  0,  0, 72,  2,  0,  0,  0,  0, 35,  0, 70,  2,  0,  0,
+ 72,  2,  0,  0,  0,  0, 35,  0,243,  0,  0,  0,116,  1,  0,  0,  0,  0, 35,  0,116,  1,  0,  0, 72,  2,  0,  0,  0,  0, 35,  0,
+243,  0,  0,  0, 72,  2,  0,  0,  0,  0, 35,  0,242,  0,  0,  0, 71,  2,  0,  0,  0,  0, 35,  0, 10,  1,  0,  0, 71,  2,  0,  0,
+  0,  0, 35,  0,242,  0,  0,  0, 10,  1,  0,  0,  0,  0, 35,  0,116,  1,  0,  0, 73,  2,  0,  0,  0,  0, 35,  0,116,  1,  0,  0,
+118,  1,  0,  0,  0,  0, 35,  0,118,  1,  0,  0, 73,  2,  0,  0,  0,  0, 35,  0, 73,  2,  0,  0, 74,  2,  0,  0,  0,  0, 35,  0,
+ 74,  2,  0,  0, 75,  2,  0,  0,  0,  0, 35,  0, 73,  2,  0,  0, 75,  2,  0,  0,  0,  0, 35,  0,117,  1,  0,  0,121,  1,  0,  0,
+  0,  0, 35,  0,117,  1,  0,  0, 75,  2,  0,  0,  0,  0, 35,  0,121,  1,  0,  0, 75,  2,  0,  0,  0,  0, 35,  0,120,  1,  0,  0,
+ 74,  2,  0,  0,  0,  0, 35,  0,119,  1,  0,  0, 74,  2,  0,  0,  0,  0, 35,  0,119,  1,  0,  0,120,  1,  0,  0,  0,  0, 35,  0,
+  8,  1,  0,  0, 76,  2,  0,  0,  0,  0, 35,  0,  8,  1,  0,  0, 12,  1,  0,  0,  0,  0, 35,  0, 12,  1,  0,  0, 76,  2,  0,  0,
+  0,  0, 35,  0, 76,  2,  0,  0, 77,  2,  0,  0,  0,  0, 35,  0, 77,  2,  0,  0, 78,  2,  0,  0,  0,  0, 35,  0, 76,  2,  0,  0,
+ 78,  2,  0,  0,  0,  0, 35,  0,  9,  1,  0,  0,120,  1,  0,  0,  0,  0, 35,  0,  9,  1,  0,  0, 78,  2,  0,  0,  0,  0, 35,  0,
+120,  1,  0,  0, 78,  2,  0,  0,  0,  0, 35,  0,121,  1,  0,  0, 77,  2,  0,  0,  0,  0, 35,  0, 13,  1,  0,  0, 77,  2,  0,  0,
+  0,  0, 35,  0, 13,  1,  0,  0,121,  1,  0,  0,  0,  0, 35,  0,  7,  1,  0,  0, 79,  2,  0,  0,  0,  0, 35,  0,  7,  1,  0,  0,
+119,  1,  0,  0,  0,  0, 35,  0,119,  1,  0,  0, 79,  2,  0,  0,  0,  0, 35,  0, 79,  2,  0,  0, 80,  2,  0,  0,  0,  0, 35,  0,
+ 80,  2,  0,  0, 81,  2,  0,  0,  0,  0, 35,  0, 79,  2,  0,  0, 81,  2,  0,  0,  0,  0, 35,  0,244,  0,  0,  0,  6,  1,  0,  0,
+  0,  0, 35,  0,  6,  1,  0,  0, 81,  2,  0,  0,  0,  0, 35,  0,244,  0,  0,  0, 81,  2,  0,  0,  0,  0, 35,  0,245,  0,  0,  0,
+ 80,  2,  0,  0,  0,  0, 35,  0,118,  1,  0,  0, 80,  2,  0,  0,  0,  0, 35,  0,245,  0,  0,  0,118,  1,  0,  0,  0,  0, 35,  0,
+123,  1,  0,  0, 82,  2,  0,  0,  0,  0, 35,  0, 15,  1,  0,  0,123,  1,  0,  0,  0,  0, 35,  0, 15,  1,  0,  0, 82,  2,  0,  0,
+  0,  0, 35,  0, 82,  2,  0,  0, 83,  2,  0,  0,  0,  0, 35,  0, 83,  2,  0,  0, 84,  2,  0,  0,  0,  0, 35,  0, 82,  2,  0,  0,
+ 84,  2,  0,  0,  0,  0, 35,  0,249,  0,  0,  0,122,  1,  0,  0,  0,  0, 35,  0,122,  1,  0,  0, 84,  2,  0,  0,  0,  0, 35,  0,
+249,  0,  0,  0, 84,  2,  0,  0,  0,  0, 35,  0,248,  0,  0,  0, 83,  2,  0,  0,  0,  0, 35,  0, 14,  1,  0,  0, 83,  2,  0,  0,
+  0,  0, 35,  0,248,  0,  0,  0, 14,  1,  0,  0,  0,  0, 35,  0,122,  1,  0,  0, 85,  2,  0,  0,  0,  0, 35,  0,122,  1,  0,  0,
+124,  1,  0,  0,  0,  0, 35,  0,124,  1,  0,  0, 85,  2,  0,  0,  0,  0, 35,  0, 85,  2,  0,  0, 86,  2,  0,  0,  0,  0, 35,  0,
+ 86,  2,  0,  0, 87,  2,  0,  0,  0,  0, 35,  0, 85,  2,  0,  0, 87,  2,  0,  0,  0,  0, 35,  0,123,  1,  0,  0,127,  1,  0,  0,
+  0,  0, 35,  0,123,  1,  0,  0, 87,  2,  0,  0,  0,  0, 35,  0,127,  1,  0,  0, 87,  2,  0,  0,  0,  0, 35,  0,126,  1,  0,  0,
+ 86,  2,  0,  0,  0,  0, 35,  0,125,  1,  0,  0, 86,  2,  0,  0,  0,  0, 35,  0,125,  1,  0,  0,126,  1,  0,  0,  0,  0, 35,  0,
+ 12,  1,  0,  0, 88,  2,  0,  0,  0,  0, 35,  0, 12,  1,  0,  0, 16,  1,  0,  0,  0,  0, 35,  0, 16,  1,  0,  0, 88,  2,  0,  0,
+  0,  0, 35,  0, 88,  2,  0,  0, 89,  2,  0,  0,  0,  0, 35,  0, 89,  2,  0,  0, 90,  2,  0,  0,  0,  0, 35,  0, 88,  2,  0,  0,
+ 90,  2,  0,  0,  0,  0, 35,  0, 13,  1,  0,  0,126,  1,  0,  0,  0,  0, 35,  0, 13,  1,  0,  0, 90,  2,  0,  0,  0,  0, 35,  0,
+126,  1,  0,  0, 90,  2,  0,  0,  0,  0, 35,  0,127,  1,  0,  0, 89,  2,  0,  0,  0,  0, 35,  0, 17,  1,  0,  0, 89,  2,  0,  0,
+  0,  0, 35,  0, 17,  1,  0,  0,127,  1,  0,  0,  0,  0, 35,  0, 11,  1,  0,  0, 91,  2,  0,  0,  0,  0, 35,  0, 11,  1,  0,  0,
+125,  1,  0,  0,  0,  0, 35,  0,125,  1,  0,  0, 91,  2,  0,  0,  0,  0, 35,  0, 91,  2,  0,  0, 92,  2,  0,  0,  0,  0, 35,  0,
+ 92,  2,  0,  0, 93,  2,  0,  0,  0,  0, 35,  0, 91,  2,  0,  0, 93,  2,  0,  0,  0,  0, 35,  0,246,  0,  0,  0, 10,  1,  0,  0,
+  0,  0, 35,  0, 10,  1,  0,  0, 93,  2,  0,  0,  0,  0, 35,  0,246,  0,  0,  0, 93,  2,  0,  0,  0,  0, 35,  0,247,  0,  0,  0,
+ 92,  2,  0,  0,  0,  0, 35,  0,124,  1,  0,  0, 92,  2,  0,  0,  0,  0, 35,  0,247,  0,  0,  0,124,  1,  0,  0,  0,  0, 35,  0,
+129,  1,  0,  0, 94,  2,  0,  0,  0,  0, 35,  0, 19,  1,  0,  0,129,  1,  0,  0,  0,  0, 35,  0, 19,  1,  0,  0, 94,  2,  0,  0,
+  0,  0, 35,  0, 94,  2,  0,  0, 95,  2,  0,  0,  0,  0, 35,  0, 95,  2,  0,  0, 96,  2,  0,  0,  0,  0, 35,  0, 94,  2,  0,  0,
+ 96,  2,  0,  0,  0,  0, 35,  0,253,  0,  0,  0,128,  1,  0,  0,  0,  0, 35,  0,128,  1,  0,  0, 96,  2,  0,  0,  0,  0, 35,  0,
+253,  0,  0,  0, 96,  2,  0,  0,  0,  0, 35,  0,252,  0,  0,  0, 95,  2,  0,  0,  0,  0, 35,  0, 18,  1,  0,  0, 95,  2,  0,  0,
+  0,  0, 35,  0,252,  0,  0,  0, 18,  1,  0,  0,  0,  0, 35,  0,128,  1,  0,  0, 97,  2,  0,  0,  0,  0, 35,  0,128,  1,  0,  0,
+130,  1,  0,  0,  0,  0, 35,  0,130,  1,  0,  0, 97,  2,  0,  0,  0,  0, 35,  0, 97,  2,  0,  0, 98,  2,  0,  0,  0,  0, 35,  0,
+ 98,  2,  0,  0, 99,  2,  0,  0,  0,  0, 35,  0, 97,  2,  0,  0, 99,  2,  0,  0,  0,  0, 35,  0,129,  1,  0,  0,133,  1,  0,  0,
+  0,  0, 35,  0,129,  1,  0,  0, 99,  2,  0,  0,  0,  0, 35,  0,133,  1,  0,  0, 99,  2,  0,  0,  0,  0, 35,  0,132,  1,  0,  0,
+ 98,  2,  0,  0,  0,  0, 35,  0,131,  1,  0,  0, 98,  2,  0,  0,  0,  0, 35,  0,131,  1,  0,  0,132,  1,  0,  0,  0,  0, 35,  0,
+ 16,  1,  0,  0,100,  2,  0,  0,  0,  0, 35,  0, 16,  1,  0,  0, 20,  1,  0,  0,  0,  0, 35,  0, 20,  1,  0,  0,100,  2,  0,  0,
+  0,  0, 35,  0,100,  2,  0,  0,101,  2,  0,  0,  0,  0, 35,  0,101,  2,  0,  0,102,  2,  0,  0,  0,  0, 35,  0,100,  2,  0,  0,
+102,  2,  0,  0,  0,  0, 35,  0, 17,  1,  0,  0,132,  1,  0,  0,  0,  0, 35,  0, 17,  1,  0,  0,102,  2,  0,  0,  0,  0, 35,  0,
+132,  1,  0,  0,102,  2,  0,  0,  0,  0, 35,  0,133,  1,  0,  0,101,  2,  0,  0,  0,  0, 35,  0, 21,  1,  0,  0,101,  2,  0,  0,
+  0,  0, 35,  0, 21,  1,  0,  0,133,  1,  0,  0,  0,  0, 35,  0, 15,  1,  0,  0,103,  2,  0,  0,  0,  0, 35,  0, 15,  1,  0,  0,
+131,  1,  0,  0,  0,  0, 35,  0,131,  1,  0,  0,103,  2,  0,  0,  0,  0, 35,  0,103,  2,  0,  0,104,  2,  0,  0,  0,  0, 35,  0,
+104,  2,  0,  0,105,  2,  0,  0,  0,  0, 35,  0,103,  2,  0,  0,105,  2,  0,  0,  0,  0, 35,  0,250,  0,  0,  0, 14,  1,  0,  0,
+  0,  0, 35,  0, 14,  1,  0,  0,105,  2,  0,  0,  0,  0, 35,  0,250,  0,  0,  0,105,  2,  0,  0,  0,  0, 35,  0,251,  0,  0,  0,
+104,  2,  0,  0,  0,  0, 35,  0,130,  1,  0,  0,104,  2,  0,  0,  0,  0, 35,  0,251,  0,  0,  0,130,  1,  0,  0,  0,  0, 35,  0,
+135,  1,  0,  0,106,  2,  0,  0,  0,  0, 35,  0, 23,  1,  0,  0,135,  1,  0,  0,  0,  0, 35,  0, 23,  1,  0,  0,106,  2,  0,  0,
+  0,  0, 35,  0,106,  2,  0,  0,107,  2,  0,  0,  0,  0, 35,  0,107,  2,  0,  0,108,  2,  0,  0,  0,  0, 35,  0,106,  2,  0,  0,
+108,  2,  0,  0,  0,  0, 35,  0,  1,  1,  0,  0,134,  1,  0,  0,  0,  0, 35,  0,134,  1,  0,  0,108,  2,  0,  0,  0,  0, 35,  0,
+  1,  1,  0,  0,108,  2,  0,  0,  0,  0, 35,  0,  0,  1,  0,  0,107,  2,  0,  0,  0,  0, 35,  0, 22,  1,  0,  0,107,  2,  0,  0,
+  0,  0, 35,  0,  0,  1,  0,  0, 22,  1,  0,  0,  0,  0, 35,  0,134,  1,  0,  0,109,  2,  0,  0,  0,  0, 35,  0,134,  1,  0,  0,
+136,  1,  0,  0,  0,  0, 35,  0,136,  1,  0,  0,109,  2,  0,  0,  0,  0, 35,  0,109,  2,  0,  0,110,  2,  0,  0,  0,  0, 35,  0,
+110,  2,  0,  0,111,  2,  0,  0,  0,  0, 35,  0,109,  2,  0,  0,111,  2,  0,  0,  0,  0, 35,  0,135,  1,  0,  0,139,  1,  0,  0,
+  0,  0, 35,  0,135,  1,  0,  0,111,  2,  0,  0,  0,  0, 35,  0,139,  1,  0,  0,111,  2,  0,  0,  0,  0, 35,  0,138,  1,  0,  0,
+110,  2,  0,  0,  0,  0, 35,  0,137,  1,  0,  0,110,  2,  0,  0,  0,  0, 35,  0,137,  1,  0,  0,138,  1,  0,  0,  0,  0, 35,  0,
+ 20,  1,  0,  0,112,  2,  0,  0,  0,  0, 35,  0, 20,  1,  0,  0, 24,  1,  0,  0,  0,  0, 35,  0, 24,  1,  0,  0,112,  2,  0,  0,
+  0,  0, 35,  0,112,  2,  0,  0,113,  2,  0,  0,  0,  0, 35,  0,113,  2,  0,  0,114,  2,  0,  0,  0,  0, 35,  0,112,  2,  0,  0,
+114,  2,  0,  0,  0,  0, 35,  0, 21,  1,  0,  0,138,  1,  0,  0,  0,  0, 35,  0, 21,  1,  0,  0,114,  2,  0,  0,  0,  0, 35,  0,
+138,  1,  0,  0,114,  2,  0,  0,  0,  0, 35,  0,139,  1,  0,  0,113,  2,  0,  0,  0,  0, 35,  0, 25,  1,  0,  0,113,  2,  0,  0,
+  0,  0, 35,  0, 25,  1,  0,  0,139,  1,  0,  0,  0,  0, 35,  0, 19,  1,  0,  0,115,  2,  0,  0,  0,  0, 35,  0, 19,  1,  0,  0,
+137,  1,  0,  0,  0,  0, 35,  0,137,  1,  0,  0,115,  2,  0,  0,  0,  0, 35,  0,115,  2,  0,  0,116,  2,  0,  0,  0,  0, 35,  0,
+116,  2,  0,  0,117,  2,  0,  0,  0,  0, 35,  0,115,  2,  0,  0,117,  2,  0,  0,  0,  0, 35,  0,254,  0,  0,  0, 18,  1,  0,  0,
+  0,  0, 35,  0, 18,  1,  0,  0,117,  2,  0,  0,  0,  0, 35,  0,254,  0,  0,  0,117,  2,  0,  0,  0,  0, 35,  0,255,  0,  0,  0,
+116,  2,  0,  0,  0,  0, 35,  0,136,  1,  0,  0,116,  2,  0,  0,  0,  0, 35,  0,255,  0,  0,  0,136,  1,  0,  0,  0,  0, 35,  0,
+141,  1,  0,  0,118,  2,  0,  0,  0,  0, 35,  0,  7,  1,  0,  0,141,  1,  0,  0,  0,  0, 35,  0,  7,  1,  0,  0,118,  2,  0,  0,
+  0,  0, 35,  0,118,  2,  0,  0,119,  2,  0,  0,  0,  0, 35,  0,119,  2,  0,  0,120,  2,  0,  0,  0,  0, 35,  0,118,  2,  0,  0,
+120,  2,  0,  0,  0,  0, 35,  0,  5,  1,  0,  0,140,  1,  0,  0,  0,  0, 35,  0,140,  1,  0,  0,120,  2,  0,  0,  0,  0, 35,  0,
+  5,  1,  0,  0,120,  2,  0,  0,  0,  0, 35,  0,  4,  1,  0,  0,119,  2,  0,  0,  0,  0, 35,  0,  6,  1,  0,  0,119,  2,  0,  0,
+  0,  0, 35,  0,  4,  1,  0,  0,  6,  1,  0,  0,  0,  0, 35,  0,140,  1,  0,  0,121,  2,  0,  0,  0,  0, 35,  0,140,  1,  0,  0,
+142,  1,  0,  0,  0,  0, 35,  0,142,  1,  0,  0,121,  2,  0,  0,  0,  0, 35,  0,121,  2,  0,  0,122,  2,  0,  0,  0,  0, 35,  0,
+122,  2,  0,  0,123,  2,  0,  0,  0,  0, 35,  0,121,  2,  0,  0,123,  2,  0,  0,  0,  0, 35,  0,141,  1,  0,  0,144,  1,  0,  0,
+  0,  0, 35,  0,141,  1,  0,  0,123,  2,  0,  0,  0,  0, 35,  0,144,  1,  0,  0,123,  2,  0,  0,  0,  0, 35,  0,145,  1,  0,  0,
+122,  2,  0,  0,  0,  0, 35,  0,143,  1,  0,  0,122,  2,  0,  0,  0,  0, 35,  0,143,  1,  0,  0,145,  1,  0,  0,  0,  0, 35,  0,
+ 24,  1,  0,  0,124,  2,  0,  0,  0,  0, 35,  0,  8,  1,  0,  0, 24,  1,  0,  0,  0,  0, 35,  0,  8,  1,  0,  0,124,  2,  0,  0,
+  0,  0, 35,  0,124,  2,  0,  0,125,  2,  0,  0,  0,  0, 35,  0,125,  2,  0,  0,126,  2,  0,  0,  0,  0, 35,  0,124,  2,  0,  0,
+126,  2,  0,  0,  0,  0, 35,  0, 25,  1,  0,  0,145,  1,  0,  0,  0,  0, 35,  0, 25,  1,  0,  0,126,  2,  0,  0,  0,  0, 35,  0,
+145,  1,  0,  0,126,  2,  0,  0,  0,  0, 35,  0,144,  1,  0,  0,125,  2,  0,  0,  0,  0, 35,  0,  9,  1,  0,  0,125,  2,  0,  0,
+  0,  0, 35,  0,  9,  1,  0,  0,144,  1,  0,  0,  0,  0, 35,  0, 23,  1,  0,  0,127,  2,  0,  0,  0,  0, 35,  0, 23,  1,  0,  0,
+143,  1,  0,  0,  0,  0, 35,  0,143,  1,  0,  0,127,  2,  0,  0,  0,  0, 35,  0,127,  2,  0,  0,128,  2,  0,  0,  0,  0, 35,  0,
+128,  2,  0,  0,129,  2,  0,  0,  0,  0, 35,  0,127,  2,  0,  0,129,  2,  0,  0,  0,  0, 35,  0,  2,  1,  0,  0, 22,  1,  0,  0,
+  0,  0, 35,  0, 22,  1,  0,  0,129,  2,  0,  0,  0,  0, 35,  0,  2,  1,  0,  0,129,  2,  0,  0,  0,  0, 35,  0,  3,  1,  0,  0,
+128,  2,  0,  0,  0,  0, 35,  0,142,  1,  0,  0,128,  2,  0,  0,  0,  0, 35,  0,  3,  1,  0,  0,142,  1,  0,  0,  0,  0, 35,  0,
+ 68, 65, 84, 65,  8,  2,  0,  0,152, 37,196,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  0,  0,  0, 16,  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, 85, 86, 84,101,120,  0, 97, 99,
+101, 45, 86,101,114,116,101,120,  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,200,138,200,  4,  0,  0,  0,  0,
+ 17,  0,  0,  0, 12,  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,
+ 67,111,108,  0, 32, 70, 97, 99,101, 45, 86,101,114,116,101,120,  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,
+184,198,195,  4,  0,  0,  0,  0, 26,  0,  0,  0, 16,  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, 78, 71,111,110, 32, 70, 97, 99,101, 45, 86,101,114,116,101,120,  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, 40,194,199,  4,  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,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,  0,180,  0,  0,200,138,200,  4,  0,  0,  0,  0, 61,  0,  0,  0,  0, 15,  0,  0,166,222,110, 63,  9,205, 55, 63,
+  0,  0,  0,  0,212,132,105, 63,201,236, 65, 63,  0,  0,  0,  0,218,153,103, 63,119,155, 54, 63,  0,  0,  0,  0,218,153,103, 63,
+119,155, 54, 63,  0,  0,  0,  0,118,148,108, 63,211,160, 44, 63,  0,  0,  0,  0,166,222,110, 63,  9,205, 55, 63,  0,  0,  0,  0,
+ 36, 51,115, 63, 36, 28, 45, 63,  0,  0,  0,  0,166,222,110, 63,  9,205, 55, 63,  0,  0,  0,  0,118,148,108, 63,211,160, 44, 63,
+  0,  0,  0,  0,118,148,108, 63,211,160, 44, 63,  0,  0,  0,  0,218,153,103, 63,119,155, 54, 63,  0,  0,  0,  0, 87, 17,102, 63,
+229, 52, 43, 63,  0,  0,  0,  0, 56, 81, 96, 63,170, 55, 52, 63,  0,  0,  0,  0, 87, 17,102, 63,229, 52, 43, 63,  0,  0,  0,  0,
+218,153,103, 63,119,155, 54, 63,  0,  0,  0,  0,218,153,103, 63,119,155, 54, 63,  0,  0,  0,  0,  9, 75, 97, 63, 92,233, 63, 63,
+  0,  0,  0,  0, 56, 81, 96, 63,170, 55, 52, 63,  0,  0,  0,  0,138,153, 89, 63, 49, 86, 60, 63,  0,  0,  0,  0, 56, 81, 96, 63,
+170, 55, 52, 63,  0,  0,  0,  0,  9, 75, 97, 63, 92,233, 63, 63,  0,  0,  0,  0,  9, 75, 97, 63, 92,233, 63, 63,  0,  0,  0,  0,
+218,153,103, 63,119,155, 54, 63,  0,  0,  0,  0,212,132,105, 63,201,236, 65, 63,  0,  0,  0,  0,103,167, 98, 63,168, 39, 75, 63,
+  0,  0,  0,  0,138,153, 89, 63, 39,228, 82, 63,  0,  0,  0,  0,139,153, 89, 63,255,153, 71, 63,  0,  0,  0,  0,139,153, 89, 63,
+255,153, 71, 63,  0,  0,  0,  0,  9, 75, 97, 63, 92,233, 63, 63,  0,  0,  0,  0,103,167, 98, 63,168, 39, 75, 63,  0,  0,  0,  0,
+212,132,105, 63,201,236, 65, 63,  0,  0,  0,  0,103,167, 98, 63,168, 39, 75, 63,  0,  0,  0,  0,  9, 75, 97, 63, 92,233, 63, 63,
+  0,  0,  0,  0,  9, 75, 97, 63, 92,233, 63, 63,  0,  0,  0,  0,139,153, 89, 63,255,153, 71, 63,  0,  0,  0,  0,138,153, 89, 63,
+ 49, 86, 60, 63,  0,  0,  0,  0, 56, 81, 96, 63,170, 55, 52, 63,  0,  0,  0,  0,138,153, 89, 63, 49, 86, 60, 63,  0,  0,  0,  0,
+139,153, 89, 63, 79, 12, 49, 63,  0,  0,  0,  0,139,153, 89, 63, 79, 12, 49, 63,  0,  0,  0,  0,205,182, 95, 63,222,228, 40, 63,
+  0,  0,  0,  0, 56, 81, 96, 63,170, 55, 52, 63,  0,  0,  0,  0, 87, 17,102, 63,229, 52, 43, 63,  0,  0,  0,  0, 56, 81, 96, 63,
+170, 55, 52, 63,  0,  0,  0,  0,205,182, 95, 63,222,228, 40, 63,  0,  0,  0,  0,205,182, 95, 63,222,228, 40, 63,  0,  0,  0,  0,
+139,153, 89, 63, 79, 12, 49, 63,  0,  0,  0,  0,139,153, 89, 63, 45,200, 37, 63,  0,  0,  0,  0,103,167, 98, 63,168, 39, 75, 63,
+  0,  0,  0,  0,212,132,105, 63,201,236, 65, 63,  0,  0,  0,  0,168, 83,109, 63,207, 83, 78, 63,  0,  0,  0,  0,168, 83,109, 63,
+207, 83, 78, 63,  0,  0,  0,  0,135, 85,101, 63,148, 64, 88, 63,  0,  0,  0,  0,103,167, 98, 63,168, 39, 75, 63,  0,  0,  0,  0,
+138,153, 89, 63, 39,228, 82, 63,  0,  0,  0,  0,103,167, 98, 63,168, 39, 75, 63,  0,  0,  0,  0,135, 85,101, 63,148, 64, 88, 63,
+  0,  0,  0,  0,135, 85,101, 63,148, 64, 88, 63,  0,  0,  0,  0,168, 83,109, 63,207, 83, 78, 63,  0,  0,  0,  0, 36, 51,115, 63,
+ 22, 56, 90, 63,  0,  0,  0,  0,162, 18,121, 63,207, 83, 78, 63,  0,  0,  0,  0, 36, 51,115, 63, 22, 56, 90, 63,  0,  0,  0,  0,
+168, 83,109, 63,207, 83, 78, 63,  0,  0,  0,  0,168, 83,109, 63,207, 83, 78, 63,  0,  0,  0,  0, 36, 51,115, 63,115, 23, 67, 63,
+  0,  0,  0,  0,162, 18,121, 63,207, 83, 78, 63,  0,  0,  0,  0,116,225,124, 63,202,236, 65, 63,  0,  0,  0,  0,162, 18,121, 63,
+207, 83, 78, 63,  0,  0,  0,  0, 36, 51,115, 63,115, 23, 67, 63,  0,  0,  0,  0, 36, 51,115, 63,115, 23, 67, 63,  0,  0,  0,  0,
+168, 83,109, 63,207, 83, 78, 63,  0,  0,  0,  0,212,132,105, 63,201,236, 65, 63,  0,  0,  0,  0,166,222,110, 63,  9,205, 55, 63,
+  0,  0,  0,  0, 36, 51,115, 63, 36, 28, 45, 63,  0,  0,  0,  0,163,135,119, 63, 11,205, 55, 63,  0,  0,  0,  0,163,135,119, 63,
+ 11,205, 55, 63,  0,  0,  0,  0, 36, 51,115, 63,115, 23, 67, 63,  0,  0,  0,  0,166,222,110, 63,  9,205, 55, 63,  0,  0,  0,  0,
+212,132,105, 63,201,236, 65, 63,  0,  0,  0,  0,166,222,110, 63,  9,205, 55, 63,  0,  0,  0,  0, 36, 51,115, 63,115, 23, 67, 63,
+  0,  0,  0,  0, 36, 51,115, 63,115, 23, 67, 63,  0,  0,  0,  0,163,135,119, 63, 11,205, 55, 63,  0,  0,  0,  0,116,225,124, 63,
+202,236, 65, 63,  0,  0,  0,  0,162, 18,121, 63,207, 83, 78, 63,  0,  0,  0,  0,116,225,124, 63,202,236, 65, 63,  0,  0,  0,  0,
+113,223,129, 63,170, 39, 75, 63,  0,  0,  0,  0,113,223,129, 63,170, 39, 75, 63,  0,  0,  0,  0, 98,136,128, 63,148, 64, 88, 63,
+  0,  0,  0,  0,162, 18,121, 63,207, 83, 78, 63,  0,  0,  0,  0, 36, 51,115, 63, 22, 56, 90, 63,  0,  0,  0,  0,162, 18,121, 63,
+207, 83, 78, 63,  0,  0,  0,  0, 98,136,128, 63,148, 64, 88, 63,  0,  0,  0,  0, 95, 98,136, 59,148, 64, 88, 63,  0,  0,  0,  0,
+160,184,111, 60,170, 39, 75, 63,  0,  0,  0,  0,243,203, 76, 61, 41,228, 82, 63,  0,  0,  0,  0,243,203, 76, 61, 82, 12, 49, 63,
+  0,  0,  0,  0,246,203, 76, 61, 53, 86, 60, 63,  0,  0,  0,  0, 31,162,194, 60,172, 55, 52, 63,  0,  0,  0,  0, 31,162,194, 60,
+172, 55, 52, 63,  0,  0,  0,  0,111,239,213, 60,223,228, 40, 63,  0,  0,  0,  0,243,203, 76, 61, 82, 12, 49, 63,  0,  0,  0,  0,
+246,203, 76, 61, 48,200, 37, 63,  0,  0,  0,  0,243,203, 76, 61, 82, 12, 49, 63,  0,  0,  0,  0,111,239,213, 60,223,228, 40, 63,
+  0,  0,  0,  0,111,239,213, 60,223,228, 40, 63,  0,  0,  0,  0, 31,162,194, 60,172, 55, 52, 63,  0,  0,  0,  0,120,226,169, 58,
+230, 52, 43, 63,  0,  0,  0,  0,111,204,126, 63,121,155, 54, 63,  0,  0,  0,  0,121, 42,128, 63,230, 52, 43, 63,  0,  0,  0,  0,
+136, 10,131, 63,172, 55, 52, 63,  0,  0,  0,  0,136, 10,131, 63,172, 55, 52, 63,  0,  0,  0,  0,160,141,130, 63, 95,233, 63, 63,
+  0,  0,  0,  0,111,204,126, 63,121,155, 54, 63,  0,  0,  0,  0,116,225,124, 63,202,236, 65, 63,  0,  0,  0,  0,111,204,126, 63,
+121,155, 54, 63,  0,  0,  0,  0,160,141,130, 63, 95,233, 63, 63,  0,  0,  0,  0, 11,104,163, 60, 95,233, 63, 63,  0,  0,  0,  0,
+ 31,162,194, 60,172, 55, 52, 63,  0,  0,  0,  0,246,203, 76, 61, 53, 86, 60, 63,  0,  0,  0,  0,244,203, 76, 61,  2,154, 71, 63,
+  0,  0,  0,  0,243,203, 76, 61, 41,228, 82, 63,  0,  0,  0,  0,160,184,111, 60,170, 39, 75, 63,  0,  0,  0,  0,160,184,111, 60,
+170, 39, 75, 63,  0,  0,  0,  0, 11,104,163, 60, 95,233, 63, 63,  0,  0,  0,  0,244,203, 76, 61,  2,154, 71, 63,  0,  0,  0,  0,
+246,203, 76, 61, 53, 86, 60, 63,  0,  0,  0,  0,244,203, 76, 61,  2,154, 71, 63,  0,  0,  0,  0, 11,104,163, 60, 95,233, 63, 63,
+  0,  0,  0,  0,160,141,130, 63, 95,233, 63, 63,  0,  0,  0,  0,113,223,129, 63,170, 39, 75, 63,  0,  0,  0,  0,116,225,124, 63,
+202,236, 65, 63,  0,  0,  0,  0,111,204,126, 63,121,155, 54, 63,  0,  0,  0,  0,116,225,124, 63,202,236, 65, 63,  0,  0,  0,  0,
+163,135,119, 63, 11,205, 55, 63,  0,  0,  0,  0,163,135,119, 63, 11,205, 55, 63,  0,  0,  0,  0,210,209,121, 63,212,160, 44, 63,
+  0,  0,  0,  0,111,204,126, 63,121,155, 54, 63,  0,  0,  0,  0,121, 42,128, 63,230, 52, 43, 63,  0,  0,  0,  0,111,204,126, 63,
+121,155, 54, 63,  0,  0,  0,  0,210,209,121, 63,212,160, 44, 63,  0,  0,  0,  0,210,209,121, 63,212,160, 44, 63,  0,  0,  0,  0,
+163,135,119, 63, 11,205, 55, 63,  0,  0,  0,  0, 36, 51,115, 63, 36, 28, 45, 63,  0,  0,  0,  0, 95,102,134, 63, 79, 46, 94, 63,
+  0,  0,  0,  0, 95,102,134, 63, 22,114,105, 63,  0,  0,  0,  0, 52,205,124, 63, 58, 26, 99, 63,  0,  0,  0,  0, 52,205,124, 63,
+ 58, 26, 99, 63,  0,  0,  0,  0, 98,136,128, 63,148, 64, 88, 63,  0,  0,  0,  0, 95,102,134, 63, 79, 46, 94, 63,  0,  0,  0,  0,
+243,203, 76, 61, 41,228, 82, 63,  0,  0,  0,  0,234,203, 76, 61, 79, 46, 94, 63,  0,  0,  0,  0, 95, 98,136, 59,148, 64, 88, 63,
+  0,  0,  0,  0, 98,136,128, 63,148, 64, 88, 63,  0,  0,  0,  0, 52,205,124, 63, 58, 26, 99, 63,  0,  0,  0,  0, 36, 51,115, 63,
+ 22, 56, 90, 63,  0,  0,  0,  0, 21,153,105, 63, 58, 26, 99, 63,  0,  0,  0,  0, 36, 51,115, 63, 22, 56, 90, 63,  0,  0,  0,  0,
+ 52,205,124, 63, 58, 26, 99, 63,  0,  0,  0,  0, 52,205,124, 63, 58, 26, 99, 63,  0,  0,  0,  0, 32, 51,115, 63,212,154,109, 63,
+  0,  0,  0,  0, 21,153,105, 63, 58, 26, 99, 63,  0,  0,  0,  0,138,153, 89, 63, 19,114,105, 63,  0,  0,  0,  0, 21,153,105, 63,
+ 58, 26, 99, 63,  0,  0,  0,  0, 32, 51,115, 63,212,154,109, 63,  0,  0,  0,  0, 32, 51,115, 63,212,154,109, 63,  0,  0,  0,  0,
+ 52,205,124, 63, 58, 26, 99, 63,  0,  0,  0,  0, 95,102,134, 63, 22,114,105, 63,  0,  0,  0,  0, 95,102,134, 63,242,187,116, 63,
+  0,  0,  0,  0,  3,153, 59, 63,  0,  0,128, 63,  0,  0,  0,  0,136,153, 89, 63,242,187,116, 63,  0,  0,  0,  0,136,153, 89, 63,
+242,187,116, 63,  0,  0,  0,  0, 32, 51,115, 63,212,154,109, 63,  0,  0,  0,  0, 95,102,134, 63,242,187,116, 63,  0,  0,  0,  0,
+ 95,102,134, 63, 22,114,105, 63,  0,  0,  0,  0, 95,102,134, 63,242,187,116, 63,  0,  0,  0,  0, 32, 51,115, 63,212,154,109, 63,
+  0,  0,  0,  0, 32, 51,115, 63,212,154,109, 63,  0,  0,  0,  0,136,153, 89, 63,242,187,116, 63,  0,  0,  0,  0,138,153, 89, 63,
+ 19,114,105, 63,  0,  0,  0,  0, 21,153,105, 63, 58, 26, 99, 63,  0,  0,  0,  0,138,153, 89, 63, 19,114,105, 63,  0,  0,  0,  0,
+138,153, 89, 63, 77, 46, 94, 63,  0,  0,  0,  0,138,153, 89, 63, 77, 46, 94, 63,  0,  0,  0,  0,135, 85,101, 63,148, 64, 88, 63,
+  0,  0,  0,  0, 21,153,105, 63, 58, 26, 99, 63,  0,  0,  0,  0, 36, 51,115, 63, 22, 56, 90, 63,  0,  0,  0,  0, 21,153,105, 63,
+ 58, 26, 99, 63,  0,  0,  0,  0,135, 85,101, 63,148, 64, 88, 63,  0,  0,  0,  0,135, 85,101, 63,148, 64, 88, 63,  0,  0,  0,  0,
+138,153, 89, 63, 77, 46, 94, 63,  0,  0,  0,  0,138,153, 89, 63, 39,228, 82, 63,  0,  0,  0,  0, 67,153, 75, 63,113,155, 54, 63,
+  0,  0,  0,  0, 74,174, 73, 63,193,236, 65, 63,  0,  0,  0,  0,124, 84, 68, 63,255,204, 55, 63,  0,  0,  0,  0,124, 84, 68, 63,
+255,204, 55, 63,  0,  0,  0,  0,169,158, 70, 63,200,160, 44, 63,  0,  0,  0,  0, 67,153, 75, 63,113,155, 54, 63,  0,  0,  0,  0,
+196, 33, 77, 63,221, 52, 43, 63,  0,  0,  0,  0, 67,153, 75, 63,113,155, 54, 63,  0,  0,  0,  0,169,158, 70, 63,200,160, 44, 63,
+  0,  0,  0,  0,169,158, 70, 63,200,160, 44, 63,  0,  0,  0,  0,124, 84, 68, 63,255,204, 55, 63,  0,  0,  0,  0,  0,  0, 64, 63,
+ 24, 28, 45, 63,  0,  0,  0,  0, 67,153, 75, 63,113,155, 54, 63,  0,  0,  0,  0,196, 33, 77, 63,221, 52, 43, 63,  0,  0,  0,  0,
+225,225, 82, 63,165, 55, 52, 63,  0,  0,  0,  0,225,225, 82, 63,165, 55, 52, 63,  0,  0,  0,  0, 16,232, 81, 63, 89,233, 63, 63,
+  0,  0,  0,  0, 67,153, 75, 63,113,155, 54, 63,  0,  0,  0,  0, 74,174, 73, 63,193,236, 65, 63,  0,  0,  0,  0, 67,153, 75, 63,
+113,155, 54, 63,  0,  0,  0,  0, 16,232, 81, 63, 89,233, 63, 63,  0,  0,  0,  0, 16,232, 81, 63, 89,233, 63, 63,  0,  0,  0,  0,
+225,225, 82, 63,165, 55, 52, 63,  0,  0,  0,  0,138,153, 89, 63, 49, 86, 60, 63,  0,  0,  0,  0,139,153, 89, 63,255,153, 71, 63,
+  0,  0,  0,  0,138,153, 89, 63, 39,228, 82, 63,  0,  0,  0,  0,179,139, 80, 63,164, 39, 75, 63,  0,  0,  0,  0,179,139, 80, 63,
+164, 39, 75, 63,  0,  0,  0,  0, 16,232, 81, 63, 89,233, 63, 63,  0,  0,  0,  0,139,153, 89, 63,255,153, 71, 63,  0,  0,  0,  0,
+138,153, 89, 63, 49, 86, 60, 63,  0,  0,  0,  0,139,153, 89, 63,255,153, 71, 63,  0,  0,  0,  0, 16,232, 81, 63, 89,233, 63, 63,
+  0,  0,  0,  0, 16,232, 81, 63, 89,233, 63, 63,  0,  0,  0,  0,179,139, 80, 63,164, 39, 75, 63,  0,  0,  0,  0, 74,174, 73, 63,
+193,236, 65, 63,  0,  0,  0,  0,139,153, 89, 63, 79, 12, 49, 63,  0,  0,  0,  0,138,153, 89, 63, 49, 86, 60, 63,  0,  0,  0,  0,
+225,225, 82, 63,165, 55, 52, 63,  0,  0,  0,  0,225,225, 82, 63,165, 55, 52, 63,  0,  0,  0,  0, 75,124, 83, 63,217,228, 40, 63,
+  0,  0,  0,  0,139,153, 89, 63, 79, 12, 49, 63,  0,  0,  0,  0,139,153, 89, 63, 45,200, 37, 63,  0,  0,  0,  0,139,153, 89, 63,
+ 79, 12, 49, 63,  0,  0,  0,  0, 75,124, 83, 63,217,228, 40, 63,  0,  0,  0,  0, 75,124, 83, 63,217,228, 40, 63,  0,  0,  0,  0,
+225,225, 82, 63,165, 55, 52, 63,  0,  0,  0,  0,196, 33, 77, 63,221, 52, 43, 63,  0,  0,  0,  0,120,223, 69, 63,198, 83, 78, 63,
+  0,  0,  0,  0, 74,174, 73, 63,193,236, 65, 63,  0,  0,  0,  0,179,139, 80, 63,164, 39, 75, 63,  0,  0,  0,  0,179,139, 80, 63,
+164, 39, 75, 63,  0,  0,  0,  0,148,221, 77, 63,140, 64, 88, 63,  0,  0,  0,  0,120,223, 69, 63,198, 83, 78, 63,  0,  0,  0,  0,
+  0,  0, 64, 63, 12, 56, 90, 63,  0,  0,  0,  0,120,223, 69, 63,198, 83, 78, 63,  0,  0,  0,  0,148,221, 77, 63,140, 64, 88, 63,
+  0,  0,  0,  0,148,221, 77, 63,140, 64, 88, 63,  0,  0,  0,  0,179,139, 80, 63,164, 39, 75, 63,  0,  0,  0,  0,138,153, 89, 63,
+ 39,228, 82, 63,  0,  0,  0,  0,120,223, 69, 63,198, 83, 78, 63,  0,  0,  0,  0,  0,  0, 64, 63, 12, 56, 90, 63,  0,  0,  0,  0,
+136, 32, 58, 63,198, 83, 78, 63,  0,  0,  0,  0,136, 32, 58, 63,198, 83, 78, 63,  0,  0,  0,  0,  0,  0, 64, 63,106, 23, 67, 63,
+  0,  0,  0,  0,120,223, 69, 63,198, 83, 78, 63,  0,  0,  0,  0, 74,174, 73, 63,193,236, 65, 63,  0,  0,  0,  0,120,223, 69, 63,
+198, 83, 78, 63,  0,  0,  0,  0,  0,  0, 64, 63,106, 23, 67, 63,  0,  0,  0,  0,  0,  0, 64, 63,106, 23, 67, 63,  0,  0,  0,  0,
+136, 32, 58, 63,198, 83, 78, 63,  0,  0,  0,  0,182, 81, 54, 63,193,236, 65, 63,  0,  0,  0,  0,132,171, 59, 63,255,204, 55, 63,
+  0,  0,  0,  0,  0,  0, 64, 63, 24, 28, 45, 63,  0,  0,  0,  0,124, 84, 68, 63,255,204, 55, 63,  0,  0,  0,  0,124, 84, 68, 63,
+255,204, 55, 63,  0,  0,  0,  0,  0,  0, 64, 63,106, 23, 67, 63,  0,  0,  0,  0,132,171, 59, 63,255,204, 55, 63,  0,  0,  0,  0,
+182, 81, 54, 63,193,236, 65, 63,  0,  0,  0,  0,132,171, 59, 63,255,204, 55, 63,  0,  0,  0,  0,  0,  0, 64, 63,106, 23, 67, 63,
+  0,  0,  0,  0,  0,  0, 64, 63,106, 23, 67, 63,  0,  0,  0,  0,124, 84, 68, 63,255,204, 55, 63,  0,  0,  0,  0, 74,174, 73, 63,
+193,236, 65, 63,  0,  0,  0,  0, 77,116, 47, 63,164, 39, 75, 63,  0,  0,  0,  0,182, 81, 54, 63,193,236, 65, 63,  0,  0,  0,  0,
+136, 32, 58, 63,198, 83, 78, 63,  0,  0,  0,  0,136, 32, 58, 63,198, 83, 78, 63,  0,  0,  0,  0,108, 34, 50, 63,140, 64, 88, 63,
+  0,  0,  0,  0, 77,116, 47, 63,164, 39, 75, 63,  0,  0,  0,  0,118,102, 38, 63, 38,228, 82, 63,  0,  0,  0,  0, 77,116, 47, 63,
+164, 39, 75, 63,  0,  0,  0,  0,108, 34, 50, 63,140, 64, 88, 63,  0,  0,  0,  0,108, 34, 50, 63,140, 64, 88, 63,  0,  0,  0,  0,
+136, 32, 58, 63,198, 83, 78, 63,  0,  0,  0,  0,  0,  0, 64, 63, 12, 56, 90, 63,  0,  0,  0,  0, 31, 30, 45, 63,165, 55, 52, 63,
+  0,  0,  0,  0,117,102, 38, 63, 50, 86, 60, 63,  0,  0,  0,  0,117,102, 38, 63, 78, 12, 49, 63,  0,  0,  0,  0,117,102, 38, 63,
+ 78, 12, 49, 63,  0,  0,  0,  0,181,131, 44, 63,216,228, 40, 63,  0,  0,  0,  0, 31, 30, 45, 63,165, 55, 52, 63,  0,  0,  0,  0,
+ 60,222, 50, 63,221, 52, 43, 63,  0,  0,  0,  0, 31, 30, 45, 63,165, 55, 52, 63,  0,  0,  0,  0,181,131, 44, 63,216,228, 40, 63,
+  0,  0,  0,  0,181,131, 44, 63,216,228, 40, 63,  0,  0,  0,  0,117,102, 38, 63, 78, 12, 49, 63,  0,  0,  0,  0,117,102, 38, 63,
+ 45,200, 37, 63,  0,  0,  0,  0, 31, 30, 45, 63,165, 55, 52, 63,  0,  0,  0,  0, 60,222, 50, 63,221, 52, 43, 63,  0,  0,  0,  0,
+189,102, 52, 63,113,155, 54, 63,  0,  0,  0,  0,189,102, 52, 63,113,155, 54, 63,  0,  0,  0,  0,240, 23, 46, 63, 89,233, 63, 63,
+  0,  0,  0,  0, 31, 30, 45, 63,165, 55, 52, 63,  0,  0,  0,  0,117,102, 38, 63, 50, 86, 60, 63,  0,  0,  0,  0, 31, 30, 45, 63,
+165, 55, 52, 63,  0,  0,  0,  0,240, 23, 46, 63, 89,233, 63, 63,  0,  0,  0,  0,240, 23, 46, 63, 89,233, 63, 63,  0,  0,  0,  0,
+189,102, 52, 63,113,155, 54, 63,  0,  0,  0,  0,182, 81, 54, 63,193,236, 65, 63,  0,  0,  0,  0, 77,116, 47, 63,164, 39, 75, 63,
+  0,  0,  0,  0,118,102, 38, 63, 38,228, 82, 63,  0,  0,  0,  0,117,102, 38, 63,255,153, 71, 63,  0,  0,  0,  0,117,102, 38, 63,
+255,153, 71, 63,  0,  0,  0,  0,240, 23, 46, 63, 89,233, 63, 63,  0,  0,  0,  0, 77,116, 47, 63,164, 39, 75, 63,  0,  0,  0,  0,
+182, 81, 54, 63,193,236, 65, 63,  0,  0,  0,  0, 77,116, 47, 63,164, 39, 75, 63,  0,  0,  0,  0,240, 23, 46, 63, 89,233, 63, 63,
+  0,  0,  0,  0,240, 23, 46, 63, 89,233, 63, 63,  0,  0,  0,  0,117,102, 38, 63,255,153, 71, 63,  0,  0,  0,  0,117,102, 38, 63,
+ 50, 86, 60, 63,  0,  0,  0,  0,132,171, 59, 63,255,204, 55, 63,  0,  0,  0,  0,182, 81, 54, 63,193,236, 65, 63,  0,  0,  0,  0,
+189,102, 52, 63,113,155, 54, 63,  0,  0,  0,  0,189,102, 52, 63,113,155, 54, 63,  0,  0,  0,  0, 87, 97, 57, 63,200,160, 44, 63,
+  0,  0,  0,  0,132,171, 59, 63,255,204, 55, 63,  0,  0,  0,  0,  0,  0, 64, 63, 24, 28, 45, 63,  0,  0,  0,  0,132,171, 59, 63,
+255,204, 55, 63,  0,  0,  0,  0, 87, 97, 57, 63,200,160, 44, 63,  0,  0,  0,  0, 87, 97, 57, 63,200,160, 44, 63,  0,  0,  0,  0,
+189,102, 52, 63,113,155, 54, 63,  0,  0,  0,  0, 60,222, 50, 63,221, 52, 43, 63,  0,  0,  0,  0,250,101, 54, 63, 51, 26, 99, 63,
+  0,  0,  0,  0,118,102, 38, 63, 19,114,105, 63,  0,  0,  0,  0,118,102, 38, 63, 77, 46, 94, 63,  0,  0,  0,  0,118,102, 38, 63,
+ 77, 46, 94, 63,  0,  0,  0,  0,108, 34, 50, 63,140, 64, 88, 63,  0,  0,  0,  0,250,101, 54, 63, 51, 26, 99, 63,  0,  0,  0,  0,
+  0,  0, 64, 63, 12, 56, 90, 63,  0,  0,  0,  0,250,101, 54, 63, 51, 26, 99, 63,  0,  0,  0,  0,108, 34, 50, 63,140, 64, 88, 63,
+  0,  0,  0,  0,108, 34, 50, 63,140, 64, 88, 63,  0,  0,  0,  0,118,102, 38, 63, 77, 46, 94, 63,  0,  0,  0,  0,118,102, 38, 63,
+ 38,228, 82, 63,  0,  0,  0,  0,250,101, 54, 63, 51, 26, 99, 63,  0,  0,  0,  0,  0,  0, 64, 63, 12, 56, 90, 63,  0,  0,  0,  0,
+  6,154, 73, 63, 51, 26, 99, 63,  0,  0,  0,  0,  6,154, 73, 63, 51, 26, 99, 63,  0,  0,  0,  0,  0,  0, 64, 63,206,154,109, 63,
+  0,  0,  0,  0,250,101, 54, 63, 51, 26, 99, 63,  0,  0,  0,  0,118,102, 38, 63, 19,114,105, 63,  0,  0,  0,  0,250,101, 54, 63,
+ 51, 26, 99, 63,  0,  0,  0,  0,  0,  0, 64, 63,206,154,109, 63,  0,  0,  0,  0,  0,  0, 64, 63,206,154,109, 63,  0,  0,  0,  0,
+  6,154, 73, 63, 51, 26, 99, 63,  0,  0,  0,  0,138,153, 89, 63, 19,114,105, 63,  0,  0,  0,  0,136,153, 89, 63,242,187,116, 63,
+  0,  0,  0,  0,  3,153, 59, 63,  0,  0,128, 63,  0,  0,  0,  0,120,102, 38, 63,242,187,116, 63,  0,  0,  0,  0,120,102, 38, 63,
+242,187,116, 63,  0,  0,  0,  0,  0,  0, 64, 63,206,154,109, 63,  0,  0,  0,  0,136,153, 89, 63,242,187,116, 63,  0,  0,  0,  0,
+138,153, 89, 63, 19,114,105, 63,  0,  0,  0,  0,136,153, 89, 63,242,187,116, 63,  0,  0,  0,  0,  0,  0, 64, 63,206,154,109, 63,
+  0,  0,  0,  0,  0,  0, 64, 63,206,154,109, 63,  0,  0,  0,  0,120,102, 38, 63,242,187,116, 63,  0,  0,  0,  0,118,102, 38, 63,
+ 19,114,105, 63,  0,  0,  0,  0,138,153, 89, 63, 77, 46, 94, 63,  0,  0,  0,  0,138,153, 89, 63, 19,114,105, 63,  0,  0,  0,  0,
+  6,154, 73, 63, 51, 26, 99, 63,  0,  0,  0,  0,  6,154, 73, 63, 51, 26, 99, 63,  0,  0,  0,  0,148,221, 77, 63,140, 64, 88, 63,
+  0,  0,  0,  0,138,153, 89, 63, 77, 46, 94, 63,  0,  0,  0,  0,138,153, 89, 63, 39,228, 82, 63,  0,  0,  0,  0,138,153, 89, 63,
+ 77, 46, 94, 63,  0,  0,  0,  0,148,221, 77, 63,140, 64, 88, 63,  0,  0,  0,  0,148,221, 77, 63,140, 64, 88, 63,  0,  0,  0,  0,
+  6,154, 73, 63, 51, 26, 99, 63,  0,  0,  0,  0,  0,  0, 64, 63, 12, 56, 90, 63,  0,  0,  0,  0,167, 71,  8, 62,  7,205, 55, 63,
+  0,  0,  0,  0,170,192,229, 61,200,236, 65, 63,  0,  0,  0,  0,203,104,214, 61,120,155, 54, 63,  0,  0,  0,  0,203,104,214, 61,
+120,155, 54, 63,  0,  0,  0,  0,201, 61,254, 61,207,160, 44, 63,  0,  0,  0,  0,167, 71,  8, 62,  7,205, 55, 63,  0,  0,  0,  0,
+173,153, 25, 62, 27, 28, 45, 63,  0,  0,  0,  0,167, 71,  8, 62,  7,205, 55, 63,  0,  0,  0,  0,201, 61,254, 61,207,160, 44, 63,
+  0,  0,  0,  0,201, 61,254, 61,207,160, 44, 63,  0,  0,  0,  0,203,104,214, 61,120,155, 54, 63,  0,  0,  0,  0,175, 36,202, 61,
+228, 52, 43, 63,  0,  0,  0,  0,145, 35,156, 61,172, 55, 52, 63,  0,  0,  0,  0,175, 36,202, 61,228, 52, 43, 63,  0,  0,  0,  0,
+203,104,214, 61,120,155, 54, 63,  0,  0,  0,  0,203,104,214, 61,120,155, 54, 63,  0,  0,  0,  0, 32,242,163, 61, 96,233, 63, 63,
+  0,  0,  0,  0,145, 35,156, 61,172, 55, 52, 63,  0,  0,  0,  0,246,203, 76, 61, 53, 86, 60, 63,  0,  0,  0,  0,145, 35,156, 61,
+172, 55, 52, 63,  0,  0,  0,  0, 32,242,163, 61, 96,233, 63, 63,  0,  0,  0,  0, 32,242,163, 61, 96,233, 63, 63,  0,  0,  0,  0,
+203,104,214, 61,120,155, 54, 63,  0,  0,  0,  0,170,192,229, 61,200,236, 65, 63,  0,  0,  0,  0, 17,213,174, 61,171, 39, 75, 63,
+  0,  0,  0,  0,243,203, 76, 61, 41,228, 82, 63,  0,  0,  0,  0,244,203, 76, 61,  2,154, 71, 63,  0,  0,  0,  0,244,203, 76, 61,
+  2,154, 71, 63,  0,  0,  0,  0, 32,242,163, 61, 96,233, 63, 63,  0,  0,  0,  0, 17,213,174, 61,171, 39, 75, 63,  0,  0,  0,  0,
+170,192,229, 61,200,236, 65, 63,  0,  0,  0,  0, 17,213,174, 61,171, 39, 75, 63,  0,  0,  0,  0, 32,242,163, 61, 96,233, 63, 63,
+  0,  0,  0,  0, 32,242,163, 61, 96,233, 63, 63,  0,  0,  0,  0,244,203, 76, 61,  2,154, 71, 63,  0,  0,  0,  0,246,203, 76, 61,
+ 53, 86, 60, 63,  0,  0,  0,  0,145, 35,156, 61,172, 55, 52, 63,  0,  0,  0,  0,246,203, 76, 61, 53, 86, 60, 63,  0,  0,  0,  0,
+243,203, 76, 61, 82, 12, 49, 63,  0,  0,  0,  0,243,203, 76, 61, 82, 12, 49, 63,  0,  0,  0,  0, 53, 80,151, 61,223,228, 40, 63,
+  0,  0,  0,  0,145, 35,156, 61,172, 55, 52, 63,  0,  0,  0,  0,175, 36,202, 61,228, 52, 43, 63,  0,  0,  0,  0,145, 35,156, 61,
+172, 55, 52, 63,  0,  0,  0,  0, 53, 80,151, 61,223,228, 40, 63,  0,  0,  0,  0, 53, 80,151, 61,223,228, 40, 63,  0,  0,  0,  0,
+243,203, 76, 61, 82, 12, 49, 63,  0,  0,  0,  0,246,203, 76, 61, 48,200, 37, 63,  0,  0,  0,  0, 17,213,174, 61,171, 39, 75, 63,
+  0,  0,  0,  0,170,192,229, 61,200,236, 65, 63,  0,  0,  0,  0,169, 27,  2, 62,204, 83, 78, 63,  0,  0,  0,  0,169, 27,  2, 62,
+204, 83, 78, 63,  0,  0,  0,  0, 23, 70,196, 61,147, 64, 88, 63,  0,  0,  0,  0, 17,213,174, 61,171, 39, 75, 63,  0,  0,  0,  0,
+243,203, 76, 61, 41,228, 82, 63,  0,  0,  0,  0, 17,213,174, 61,171, 39, 75, 63,  0,  0,  0,  0, 23, 70,196, 61,147, 64, 88, 63,
+  0,  0,  0,  0, 23, 70,196, 61,147, 64, 88, 63,  0,  0,  0,  0,169, 27,  2, 62,204, 83, 78, 63,  0,  0,  0,  0,160,153, 25, 62,
+ 14, 56, 90, 63,  0,  0,  0,  0,162, 23, 49, 62,195, 83, 78, 63,  0,  0,  0,  0,160,153, 25, 62, 14, 56, 90, 63,  0,  0,  0,  0,
+169, 27,  2, 62,204, 83, 78, 63,  0,  0,  0,  0,169, 27,  2, 62,204, 83, 78, 63,  0,  0,  0,  0,172,153, 25, 62,108, 23, 67, 63,
+  0,  0,  0,  0,162, 23, 49, 62,195, 83, 78, 63,  0,  0,  0,  0,240, 82, 64, 62,183,236, 65, 63,  0,  0,  0,  0,162, 23, 49, 62,
+195, 83, 78, 63,  0,  0,  0,  0,172,153, 25, 62,108, 23, 67, 63,  0,  0,  0,  0,172,153, 25, 62,108, 23, 67, 63,  0,  0,  0,  0,
+169, 27,  2, 62,204, 83, 78, 63,  0,  0,  0,  0,170,192,229, 61,200,236, 65, 63,  0,  0,  0,  0,167, 71,  8, 62,  7,205, 55, 63,
+  0,  0,  0,  0,173,153, 25, 62, 27, 28, 45, 63,  0,  0,  0,  0,173,235, 42, 62,254,204, 55, 63,  0,  0,  0,  0,173,235, 42, 62,
+254,204, 55, 63,  0,  0,  0,  0,172,153, 25, 62,108, 23, 67, 63,  0,  0,  0,  0,167, 71,  8, 62,  7,205, 55, 63,  0,  0,  0,  0,
+170,192,229, 61,200,236, 65, 63,  0,  0,  0,  0,167, 71,  8, 62,  7,205, 55, 63,  0,  0,  0,  0,172,153, 25, 62,108, 23, 67, 63,
+  0,  0,  0,  0,172,153, 25, 62,108, 23, 67, 63,  0,  0,  0,  0,173,235, 42, 62,254,204, 55, 63,  0,  0,  0,  0,240, 82, 64, 62,
+183,236, 65, 63,  0,  0,  0,  0,162, 23, 49, 62,195, 83, 78, 63,  0,  0,  0,  0,240, 82, 64, 62,183,236, 65, 63,  0,  0,  0,  0,
+166,200, 91, 62,147, 39, 75, 63,  0,  0,  0,  0,166,200, 91, 62,147, 39, 75, 63,  0,  0,  0,  0, 34, 16, 81, 62,131, 64, 88, 63,
+  0,  0,  0,  0,162, 23, 49, 62,195, 83, 78, 63,  0,  0,  0,  0,160,153, 25, 62, 14, 56, 90, 63,  0,  0,  0,  0,162, 23, 49, 62,
+195, 83, 78, 63,  0,  0,  0,  0, 34, 16, 81, 62,131, 64, 88, 63,  0,  0,  0,  0, 34, 16, 81, 62,131, 64, 88, 63,  0,  0,  0,  0,
+166,200, 91, 62,147, 39, 75, 63,  0,  0,  0,  0,  0,  0,128, 62, 13,228, 82, 63,  0,  0,  0,  0,  0,  0,128, 62, 47, 12, 49, 63,
+  0,  0,  0,  0,  0,  0,128, 62, 19, 86, 60, 63,  0,  0,  0,  0, 92, 33,101, 62,146, 55, 52, 63,  0,  0,  0,  0, 92, 33,101, 62,
+146, 55, 52, 63,  0,  0,  0,  0, 14,139,103, 62,199,228, 40, 63,  0,  0,  0,  0,  0,  0,128, 62, 47, 12, 49, 63,  0,  0,  0,  0,
+  0,  0,128, 62, 23,200, 37, 63,  0,  0,  0,  0,  0,  0,128, 62, 47, 12, 49, 63,  0,  0,  0,  0, 14,139,103, 62,199,228, 40, 63,
+  0,  0,  0,  0, 14,139,103, 62,199,228, 40, 63,  0,  0,  0,  0, 92, 33,101, 62,146, 55, 52, 63,  0,  0,  0,  0,230, 32, 78, 62,
+211, 52, 43, 63,  0,  0,  0,  0,223,254, 71, 62,102,155, 54, 63,  0,  0,  0,  0,230, 32, 78, 62,211, 52, 43, 63,  0,  0,  0,  0,
+ 92, 33,101, 62,146, 55, 52, 63,  0,  0,  0,  0, 92, 33,101, 62,146, 55, 52, 63,  0,  0,  0,  0, 23, 58, 97, 62, 69,233, 63, 63,
+  0,  0,  0,  0,223,254, 71, 62,102,155, 54, 63,  0,  0,  0,  0,240, 82, 64, 62,183,236, 65, 63,  0,  0,  0,  0,223,254, 71, 62,
+102,155, 54, 63,  0,  0,  0,  0, 23, 58, 97, 62, 69,233, 63, 63,  0,  0,  0,  0, 23, 58, 97, 62, 69,233, 63, 63,  0,  0,  0,  0,
+ 92, 33,101, 62,146, 55, 52, 63,  0,  0,  0,  0,  0,  0,128, 62, 19, 86, 60, 63,  0,  0,  0,  0,  0,  0,128, 62,228,153, 71, 63,
+  0,  0,  0,  0,  0,  0,128, 62, 13,228, 82, 63,  0,  0,  0,  0,166,200, 91, 62,147, 39, 75, 63,  0,  0,  0,  0,166,200, 91, 62,
+147, 39, 75, 63,  0,  0,  0,  0, 23, 58, 97, 62, 69,233, 63, 63,  0,  0,  0,  0,  0,  0,128, 62,228,153, 71, 63,  0,  0,  0,  0,
+  0,  0,128, 62, 19, 86, 60, 63,  0,  0,  0,  0,  0,  0,128, 62,228,153, 71, 63,  0,  0,  0,  0, 23, 58, 97, 62, 69,233, 63, 63,
+  0,  0,  0,  0, 23, 58, 97, 62, 69,233, 63, 63,  0,  0,  0,  0,166,200, 91, 62,147, 39, 75, 63,  0,  0,  0,  0,240, 82, 64, 62,
+183,236, 65, 63,  0,  0,  0,  0,223,254, 71, 62,102,155, 54, 63,  0,  0,  0,  0,240, 82, 64, 62,183,236, 65, 63,  0,  0,  0,  0,
+173,235, 42, 62,254,204, 55, 63,  0,  0,  0,  0,173,235, 42, 62,254,204, 55, 63,  0,  0,  0,  0,105, 20, 52, 62,198,160, 44, 63,
+  0,  0,  0,  0,223,254, 71, 62,102,155, 54, 63,  0,  0,  0,  0,230, 32, 78, 62,211, 52, 43, 63,  0,  0,  0,  0,223,254, 71, 62,
+102,155, 54, 63,  0,  0,  0,  0,105, 20, 52, 62,198,160, 44, 63,  0,  0,  0,  0,105, 20, 52, 62,198,160, 44, 63,  0,  0,  0,  0,
+173,235, 42, 62,254,204, 55, 63,  0,  0,  0,  0,173,153, 25, 62, 27, 28, 45, 63,  0,  0,  0,  0,  0,  0,128, 62, 58, 46, 94, 63,
+  0,  0,  0,  0,  0,  0,128, 62,  8,114,105, 63,  0,  0,  0,  0,230,  1, 64, 62, 49, 26, 99, 63,  0,  0,  0,  0,230,  1, 64, 62,
+ 49, 26, 99, 63,  0,  0,  0,  0, 34, 16, 81, 62,131, 64, 88, 63,  0,  0,  0,  0,  0,  0,128, 62, 58, 46, 94, 63,  0,  0,  0,  0,
+  0,  0,128, 62, 13,228, 82, 63,  0,  0,  0,  0,  0,  0,128, 62, 58, 46, 94, 63,  0,  0,  0,  0, 34, 16, 81, 62,131, 64, 88, 63,
+  0,  0,  0,  0, 34, 16, 81, 62,131, 64, 88, 63,  0,  0,  0,  0,230,  1, 64, 62, 49, 26, 99, 63,  0,  0,  0,  0,160,153, 25, 62,
+ 14, 56, 90, 63,  0,  0,  0,  0,164, 98,230, 61, 58, 26, 99, 63,  0,  0,  0,  0,160,153, 25, 62, 14, 56, 90, 63,  0,  0,  0,  0,
+230,  1, 64, 62, 49, 26, 99, 63,  0,  0,  0,  0,230,  1, 64, 62, 49, 26, 99, 63,  0,  0,  0,  0,159,153, 25, 62,210,154,109, 63,
+  0,  0,  0,  0,164, 98,230, 61, 58, 26, 99, 63,  0,  0,  0,  0,237,203, 76, 61, 22,114,105, 63,  0,  0,  0,  0,164, 98,230, 61,
+ 58, 26, 99, 63,  0,  0,  0,  0,159,153, 25, 62,210,154,109, 63,  0,  0,  0,  0,159,153, 25, 62,210,154,109, 63,  0,  0,  0,  0,
+230,  1, 64, 62, 49, 26, 99, 63,  0,  0,  0,  0,  0,  0,128, 62,  8,114,105, 63,  0,  0,  0,  0,  0,  0,128, 62,232,187,116, 63,
+  0,  0,  0,  0,  3,153, 59, 63,  0,  0,128, 63,  0,  0,  0,  0, 95,102,134, 63,242,187,116, 63,  0,  0,  0,  0,210,203, 76, 61,
+242,187,116, 63,  0,  0,  0,  0,159,153, 25, 62,210,154,109, 63,  0,  0,  0,  0,  0,  0,128, 62,232,187,116, 63,  0,  0,  0,  0,
+  0,  0,128, 62,  8,114,105, 63,  0,  0,  0,  0,  0,  0,128, 62,232,187,116, 63,  0,  0,  0,  0,159,153, 25, 62,210,154,109, 63,
+  0,  0,  0,  0,159,153, 25, 62,210,154,109, 63,  0,  0,  0,  0,210,203, 76, 61,242,187,116, 63,  0,  0,  0,  0,237,203, 76, 61,
+ 22,114,105, 63,  0,  0,  0,  0,164, 98,230, 61, 58, 26, 99, 63,  0,  0,  0,  0,237,203, 76, 61, 22,114,105, 63,  0,  0,  0,  0,
+234,203, 76, 61, 79, 46, 94, 63,  0,  0,  0,  0,234,203, 76, 61, 79, 46, 94, 63,  0,  0,  0,  0, 23, 70,196, 61,147, 64, 88, 63,
+  0,  0,  0,  0,164, 98,230, 61, 58, 26, 99, 63,  0,  0,  0,  0,160,153, 25, 62, 14, 56, 90, 63,  0,  0,  0,  0,164, 98,230, 61,
+ 58, 26, 99, 63,  0,  0,  0,  0, 23, 70,196, 61,147, 64, 88, 63,  0,  0,  0,  0, 23, 70,196, 61,147, 64, 88, 63,  0,  0,  0,  0,
+234,203, 76, 61, 79, 46, 94, 63,  0,  0,  0,  0,243,203, 76, 61, 41,228, 82, 63,  0,  0,  0,  0, 42,138,170, 62,254,204, 55, 63,
+  0,  0,  0,  0,136,214,159, 62,183,236, 65, 63,  0,  0,  0,  0,145,  0,156, 62,102,155, 54, 63,  0,  0,  0,  0,145,  0,156, 62,
+102,155, 54, 63,  0,  0,  0,  0,204,245,165, 62,198,160, 44, 63,  0,  0,  0,  0, 42,138,170, 62,254,204, 55, 63,  0,  0,  0,  0,
+ 42, 51,179, 62, 28, 28, 45, 63,  0,  0,  0,  0, 42,138,170, 62,254,204, 55, 63,  0,  0,  0,  0,204,245,165, 62,198,160, 44, 63,
+  0,  0,  0,  0,204,245,165, 62,198,160, 44, 63,  0,  0,  0,  0,145,  0,156, 62,102,155, 54, 63,  0,  0,  0,  0,141,239,152, 62,
+211, 52, 43, 63,  0,  0,  0,  0, 82,111,141, 62,146, 55, 52, 63,  0,  0,  0,  0,141,239,152, 62,211, 52, 43, 63,  0,  0,  0,  0,
+145,  0,156, 62,102,155, 54, 63,  0,  0,  0,  0,145,  0,156, 62,102,155, 54, 63,  0,  0,  0,  0,245, 98,143, 62, 68,233, 63, 63,
+  0,  0,  0,  0, 82,111,141, 62,146, 55, 52, 63,  0,  0,  0,  0,  0,  0,128, 62, 19, 86, 60, 63,  0,  0,  0,  0, 82,111,141, 62,
+146, 55, 52, 63,  0,  0,  0,  0,245, 98,143, 62, 68,233, 63, 63,  0,  0,  0,  0,245, 98,143, 62, 68,233, 63, 63,  0,  0,  0,  0,
+145,  0,156, 62,102,155, 54, 63,  0,  0,  0,  0,136,214,159, 62,183,236, 65, 63,  0,  0,  0,  0,173, 27,146, 62,147, 39, 75, 63,
+  0,  0,  0,  0,  0,  0,128, 62, 13,228, 82, 63,  0,  0,  0,  0,  0,  0,128, 62,228,153, 71, 63,  0,  0,  0,  0,  0,  0,128, 62,
+228,153, 71, 63,  0,  0,  0,  0,245, 98,143, 62, 68,233, 63, 63,  0,  0,  0,  0,173, 27,146, 62,147, 39, 75, 63,  0,  0,  0,  0,
+136,214,159, 62,183,236, 65, 63,  0,  0,  0,  0,173, 27,146, 62,147, 39, 75, 63,  0,  0,  0,  0,245, 98,143, 62, 68,233, 63, 63,
+  0,  0,  0,  0,245, 98,143, 62, 68,233, 63, 63,  0,  0,  0,  0,  0,  0,128, 62,228,153, 71, 63,  0,  0,  0,  0,  0,  0,128, 62,
+ 19, 86, 60, 63,  0,  0,  0,  0, 82,111,141, 62,146, 55, 52, 63,  0,  0,  0,  0,  0,  0,128, 62, 19, 86, 60, 63,  0,  0,  0,  0,
+  0,  0,128, 62, 47, 12, 49, 63,  0,  0,  0,  0,  0,  0,128, 62, 47, 12, 49, 63,  0,  0,  0,  0,121, 58,140, 62,199,228, 40, 63,
+  0,  0,  0,  0, 82,111,141, 62,146, 55, 52, 63,  0,  0,  0,  0,141,239,152, 62,211, 52, 43, 63,  0,  0,  0,  0, 82,111,141, 62,
+146, 55, 52, 63,  0,  0,  0,  0,121, 58,140, 62,199,228, 40, 63,  0,  0,  0,  0,121, 58,140, 62,199,228, 40, 63,  0,  0,  0,  0,
+  0,  0,128, 62, 47, 12, 49, 63,  0,  0,  0,  0,  0,  0,128, 62, 23,200, 37, 63,  0,  0,  0,  0,173, 27,146, 62,147, 39, 75, 63,
+  0,  0,  0,  0,136,214,159, 62,183,236, 65, 63,  0,  0,  0,  0, 47,116,167, 62,195, 83, 78, 63,  0,  0,  0,  0, 47,116,167, 62,
+195, 83, 78, 63,  0,  0,  0,  0,239,119,151, 62,131, 64, 88, 63,  0,  0,  0,  0,173, 27,146, 62,147, 39, 75, 63,  0,  0,  0,  0,
+  0,  0,128, 62, 13,228, 82, 63,  0,  0,  0,  0,173, 27,146, 62,147, 39, 75, 63,  0,  0,  0,  0,239,119,151, 62,131, 64, 88, 63,
+  0,  0,  0,  0,239,119,151, 62,131, 64, 88, 63,  0,  0,  0,  0, 47,116,167, 62,195, 83, 78, 63,  0,  0,  0,  0, 49, 51,179, 62,
+ 14, 56, 90, 63,  0,  0,  0,  0, 44,242,190, 62,205, 83, 78, 63,  0,  0,  0,  0, 49, 51,179, 62, 14, 56, 90, 63,  0,  0,  0,  0,
+ 47,116,167, 62,195, 83, 78, 63,  0,  0,  0,  0, 47,116,167, 62,195, 83, 78, 63,  0,  0,  0,  0, 42, 51,179, 62,108, 23, 67, 63,
+  0,  0,  0,  0, 44,242,190, 62,205, 83, 78, 63,  0,  0,  0,  0,214,143,198, 62,200,236, 65, 63,  0,  0,  0,  0, 44,242,190, 62,
+205, 83, 78, 63,  0,  0,  0,  0, 42, 51,179, 62,108, 23, 67, 63,  0,  0,  0,  0, 42, 51,179, 62,108, 23, 67, 63,  0,  0,  0,  0,
+ 47,116,167, 62,195, 83, 78, 63,  0,  0,  0,  0,136,214,159, 62,183,236, 65, 63,  0,  0,  0,  0, 42,138,170, 62,254,204, 55, 63,
+  0,  0,  0,  0, 42, 51,179, 62, 28, 28, 45, 63,  0,  0,  0,  0, 45,220,187, 62,  7,205, 55, 63,  0,  0,  0,  0, 45,220,187, 62,
+  7,205, 55, 63,  0,  0,  0,  0, 42, 51,179, 62,108, 23, 67, 63,  0,  0,  0,  0, 42,138,170, 62,254,204, 55, 63,  0,  0,  0,  0,
+136,214,159, 62,183,236, 65, 63,  0,  0,  0,  0, 42,138,170, 62,254,204, 55, 63,  0,  0,  0,  0, 42, 51,179, 62,108, 23, 67, 63,
+  0,  0,  0,  0, 42, 51,179, 62,108, 23, 67, 63,  0,  0,  0,  0, 45,220,187, 62,  7,205, 55, 63,  0,  0,  0,  0,214,143,198, 62,
+200,236, 65, 63,  0,  0,  0,  0, 44,242,190, 62,205, 83, 78, 63,  0,  0,  0,  0,214,143,198, 62,200,236, 65, 63,  0,  0,  0,  0,
+188, 74,212, 62,171, 39, 75, 63,  0,  0,  0,  0,188, 74,212, 62,171, 39, 75, 63,  0,  0,  0,  0,122,238,206, 62,147, 64, 88, 63,
+  0,  0,  0,  0, 44,242,190, 62,205, 83, 78, 63,  0,  0,  0,  0, 49, 51,179, 62, 14, 56, 90, 63,  0,  0,  0,  0, 44,242,190, 62,
+205, 83, 78, 63,  0,  0,  0,  0,122,238,206, 62,147, 64, 88, 63,  0,  0,  0,  0,122,238,206, 62,147, 64, 88, 63,  0,  0,  0,  0,
+188, 74,212, 62,171, 39, 75, 63,  0,  0,  0,  0,130,102,230, 62, 41,228, 82, 63,  0,  0,  0,  0,130,102,230, 62, 82, 12, 49, 63,
+  0,  0,  0,  0,129,102,230, 62, 53, 86, 60, 63,  0,  0,  0,  0, 28,247,216, 62,172, 55, 52, 63,  0,  0,  0,  0, 28,247,216, 62,
+172, 55, 52, 63,  0,  0,  0,  0,243, 43,218, 62,223,228, 40, 63,  0,  0,  0,  0,130,102,230, 62, 82, 12, 49, 63,  0,  0,  0,  0,
+129,102,230, 62, 48,200, 37, 63,  0,  0,  0,  0,130,102,230, 62, 82, 12, 49, 63,  0,  0,  0,  0,243, 43,218, 62,223,228, 40, 63,
+  0,  0,  0,  0,243, 43,218, 62,223,228, 40, 63,  0,  0,  0,  0, 28,247,216, 62,172, 55, 52, 63,  0,  0,  0,  0,212,118,205, 62,
+228, 52, 43, 63,  0,  0,  0,  0,206,101,202, 62,120,155, 54, 63,  0,  0,  0,  0,212,118,205, 62,228, 52, 43, 63,  0,  0,  0,  0,
+ 28,247,216, 62,172, 55, 52, 63,  0,  0,  0,  0, 28,247,216, 62,172, 55, 52, 63,  0,  0,  0,  0,120,  3,215, 62, 95,233, 63, 63,
+  0,  0,  0,  0,206,101,202, 62,120,155, 54, 63,  0,  0,  0,  0,214,143,198, 62,200,236, 65, 63,  0,  0,  0,  0,206,101,202, 62,
+120,155, 54, 63,  0,  0,  0,  0,120,  3,215, 62, 95,233, 63, 63,  0,  0,  0,  0,120,  3,215, 62, 95,233, 63, 63,  0,  0,  0,  0,
+ 28,247,216, 62,172, 55, 52, 63,  0,  0,  0,  0,129,102,230, 62, 53, 86, 60, 63,  0,  0,  0,  0,130,102,230, 62,  1,154, 71, 63,
+  0,  0,  0,  0,130,102,230, 62, 41,228, 82, 63,  0,  0,  0,  0,188, 74,212, 62,171, 39, 75, 63,  0,  0,  0,  0,188, 74,212, 62,
+171, 39, 75, 63,  0,  0,  0,  0,120,  3,215, 62, 95,233, 63, 63,  0,  0,  0,  0,130,102,230, 62,  1,154, 71, 63,  0,  0,  0,  0,
+129,102,230, 62, 53, 86, 60, 63,  0,  0,  0,  0,130,102,230, 62,  1,154, 71, 63,  0,  0,  0,  0,120,  3,215, 62, 95,233, 63, 63,
+  0,  0,  0,  0,120,  3,215, 62, 95,233, 63, 63,  0,  0,  0,  0,188, 74,212, 62,171, 39, 75, 63,  0,  0,  0,  0,214,143,198, 62,
+200,236, 65, 63,  0,  0,  0,  0,206,101,202, 62,120,155, 54, 63,  0,  0,  0,  0,214,143,198, 62,200,236, 65, 63,  0,  0,  0,  0,
+ 45,220,187, 62,  7,205, 55, 63,  0,  0,  0,  0, 45,220,187, 62,  7,205, 55, 63,  0,  0,  0,  0,142,112,192, 62,207,160, 44, 63,
+  0,  0,  0,  0,206,101,202, 62,120,155, 54, 63,  0,  0,  0,  0,212,118,205, 62,228, 52, 43, 63,  0,  0,  0,  0,206,101,202, 62,
+120,155, 54, 63,  0,  0,  0,  0,142,112,192, 62,207,160, 44, 63,  0,  0,  0,  0,142,112,192, 62,207,160, 44, 63,  0,  0,  0,  0,
+ 45,220,187, 62,  7,205, 55, 63,  0,  0,  0,  0, 42, 51,179, 62, 28, 28, 45, 63,  0,  0,  0,  0,131,102,230, 62, 79, 46, 94, 63,
+  0,  0,  0,  0,131,102,230, 62, 22,114,105, 63,  0,  0,  0,  0, 87,103,198, 62, 58, 26, 99, 63,  0,  0,  0,  0, 87,103,198, 62,
+ 58, 26, 99, 63,  0,  0,  0,  0,122,238,206, 62,147, 64, 88, 63,  0,  0,  0,  0,131,102,230, 62, 79, 46, 94, 63,  0,  0,  0,  0,
+130,102,230, 62, 41,228, 82, 63,  0,  0,  0,  0,131,102,230, 62, 79, 46, 94, 63,  0,  0,  0,  0,122,238,206, 62,147, 64, 88, 63,
+  0,  0,  0,  0,122,238,206, 62,147, 64, 88, 63,  0,  0,  0,  0, 87,103,198, 62, 58, 26, 99, 63,  0,  0,  0,  0, 49, 51,179, 62,
+ 14, 56, 90, 63,  0,  0,  0,  0, 14,255,159, 62, 49, 26, 99, 63,  0,  0,  0,  0, 49, 51,179, 62, 14, 56, 90, 63,  0,  0,  0,  0,
+ 87,103,198, 62, 58, 26, 99, 63,  0,  0,  0,  0, 87,103,198, 62, 58, 26, 99, 63,  0,  0,  0,  0, 49, 51,179, 62,210,154,109, 63,
+  0,  0,  0,  0, 14,255,159, 62, 49, 26, 99, 63,  0,  0,  0,  0,  0,  0,128, 62,  8,114,105, 63,  0,  0,  0,  0, 14,255,159, 62,
+ 49, 26, 99, 63,  0,  0,  0,  0, 49, 51,179, 62,210,154,109, 63,  0,  0,  0,  0, 49, 51,179, 62,210,154,109, 63,  0,  0,  0,  0,
+ 87,103,198, 62, 58, 26, 99, 63,  0,  0,  0,  0,131,102,230, 62, 22,114,105, 63,  0,  0,  0,  0,134,102,230, 62,242,187,116, 63,
+  0,  0,  0,  0,  3,153, 59, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 62,232,187,116, 63,  0,  0,  0,  0,  0,  0,128, 62,
+232,187,116, 63,  0,  0,  0,  0, 49, 51,179, 62,210,154,109, 63,  0,  0,  0,  0,134,102,230, 62,242,187,116, 63,  0,  0,  0,  0,
+131,102,230, 62, 22,114,105, 63,  0,  0,  0,  0,134,102,230, 62,242,187,116, 63,  0,  0,  0,  0, 49, 51,179, 62,210,154,109, 63,
+  0,  0,  0,  0, 49, 51,179, 62,210,154,109, 63,  0,  0,  0,  0,  0,  0,128, 62,232,187,116, 63,  0,  0,  0,  0,  0,  0,128, 62,
+  8,114,105, 63,  0,  0,  0,  0, 14,255,159, 62, 49, 26, 99, 63,  0,  0,  0,  0,  0,  0,128, 62,  8,114,105, 63,  0,  0,  0,  0,
+  0,  0,128, 62, 58, 46, 94, 63,  0,  0,  0,  0,  0,  0,128, 62, 58, 46, 94, 63,  0,  0,  0,  0,239,119,151, 62,131, 64, 88, 63,
+  0,  0,  0,  0, 14,255,159, 62, 49, 26, 99, 63,  0,  0,  0,  0, 49, 51,179, 62, 14, 56, 90, 63,  0,  0,  0,  0, 14,255,159, 62,
+ 49, 26, 99, 63,  0,  0,  0,  0,239,119,151, 62,131, 64, 88, 63,  0,  0,  0,  0,239,119,151, 62,131, 64, 88, 63,  0,  0,  0,  0,
+  0,  0,128, 62, 58, 46, 94, 63,  0,  0,  0,  0,  0,  0,128, 62, 13,228, 82, 63,  0,  0,  0,  0, 93,120,  8, 63, 11,205, 55, 63,
+  0,  0,  0,  0,140, 30,  3, 63,201,236, 65, 63,  0,  0,  0,  0,145, 51,  1, 63,121,155, 54, 63,  0,  0,  0,  0,145, 51,  1, 63,
+121,155, 54, 63,  0,  0,  0,  0, 46, 46,  6, 63,211,160, 44, 63,  0,  0,  0,  0, 93,120,  8, 63, 11,205, 55, 63,  0,  0,  0,  0,
+220,204, 12, 63, 35, 28, 45, 63,  0,  0,  0,  0, 93,120,  8, 63, 11,205, 55, 63,  0,  0,  0,  0, 46, 46,  6, 63,211,160, 44, 63,
+  0,  0,  0,  0, 46, 46,  6, 63,211,160, 44, 63,  0,  0,  0,  0,145, 51,  1, 63,121,155, 54, 63,  0,  0,  0,  0, 30, 86,255, 62,
+230, 52, 43, 63,  0,  0,  0,  0,222,213,243, 62,172, 55, 52, 63,  0,  0,  0,  0, 30, 86,255, 62,230, 52, 43, 63,  0,  0,  0,  0,
+145, 51,  1, 63,121,155, 54, 63,  0,  0,  0,  0,145, 51,  1, 63,121,155, 54, 63,  0,  0,  0,  0,128,201,245, 62, 94,233, 63, 63,
+  0,  0,  0,  0,222,213,243, 62,172, 55, 52, 63,  0,  0,  0,  0,129,102,230, 62, 53, 86, 60, 63,  0,  0,  0,  0,222,213,243, 62,
+172, 55, 52, 63,  0,  0,  0,  0,128,201,245, 62, 94,233, 63, 63,  0,  0,  0,  0,128,201,245, 62, 94,233, 63, 63,  0,  0,  0,  0,
+145, 51,  1, 63,121,155, 54, 63,  0,  0,  0,  0,140, 30,  3, 63,201,236, 65, 63,  0,  0,  0,  0, 59,130,248, 62,169, 39, 75, 63,
+  0,  0,  0,  0,130,102,230, 62, 41,228, 82, 63,  0,  0,  0,  0,130,102,230, 62,  1,154, 71, 63,  0,  0,  0,  0,130,102,230, 62,
+  1,154, 71, 63,  0,  0,  0,  0,128,201,245, 62, 94,233, 63, 63,  0,  0,  0,  0, 59,130,248, 62,169, 39, 75, 63,  0,  0,  0,  0,
+140, 30,  3, 63,201,236, 65, 63,  0,  0,  0,  0, 59,130,248, 62,169, 39, 75, 63,  0,  0,  0,  0,128,201,245, 62, 94,233, 63, 63,
+  0,  0,  0,  0,128,201,245, 62, 94,233, 63, 63,  0,  0,  0,  0,130,102,230, 62,  1,154, 71, 63,  0,  0,  0,  0,129,102,230, 62,
+ 53, 86, 60, 63,  0,  0,  0,  0,222,213,243, 62,172, 55, 52, 63,  0,  0,  0,  0,129,102,230, 62, 53, 86, 60, 63,  0,  0,  0,  0,
+130,102,230, 62, 82, 12, 49, 63,  0,  0,  0,  0,130,102,230, 62, 82, 12, 49, 63,  0,  0,  0,  0,  9,161,242, 62,223,228, 40, 63,
+  0,  0,  0,  0,222,213,243, 62,172, 55, 52, 63,  0,  0,  0,  0, 30, 86,255, 62,230, 52, 43, 63,  0,  0,  0,  0,222,213,243, 62,
+172, 55, 52, 63,  0,  0,  0,  0,  9,161,242, 62,223,228, 40, 63,  0,  0,  0,  0,  9,161,242, 62,223,228, 40, 63,  0,  0,  0,  0,
+130,102,230, 62, 82, 12, 49, 63,  0,  0,  0,  0,129,102,230, 62, 48,200, 37, 63,  0,  0,  0,  0, 59,130,248, 62,169, 39, 75, 63,
+  0,  0,  0,  0,140, 30,  3, 63,201,236, 65, 63,  0,  0,  0,  0, 94,237,  6, 63,207, 83, 78, 63,  0,  0,  0,  0, 94,237,  6, 63,
+207, 83, 78, 63,  0,  0,  0,  0,118,222,253, 62,148, 64, 88, 63,  0,  0,  0,  0, 59,130,248, 62,169, 39, 75, 63,  0,  0,  0,  0,
+130,102,230, 62, 41,228, 82, 63,  0,  0,  0,  0, 59,130,248, 62,169, 39, 75, 63,  0,  0,  0,  0,118,222,253, 62,148, 64, 88, 63,
+  0,  0,  0,  0,118,222,253, 62,148, 64, 88, 63,  0,  0,  0,  0, 94,237,  6, 63,207, 83, 78, 63,  0,  0,  0,  0,220,204, 12, 63,
+ 22, 56, 90, 63,  0,  0,  0,  0, 88,172, 18, 63,207, 83, 78, 63,  0,  0,  0,  0,220,204, 12, 63, 22, 56, 90, 63,  0,  0,  0,  0,
+ 94,237,  6, 63,207, 83, 78, 63,  0,  0,  0,  0, 94,237,  6, 63,207, 83, 78, 63,  0,  0,  0,  0,220,204, 12, 63,115, 23, 67, 63,
+  0,  0,  0,  0, 88,172, 18, 63,207, 83, 78, 63,  0,  0,  0,  0, 44,123, 22, 63,201,236, 65, 63,  0,  0,  0,  0, 88,172, 18, 63,
+207, 83, 78, 63,  0,  0,  0,  0,220,204, 12, 63,115, 23, 67, 63,  0,  0,  0,  0,220,204, 12, 63,115, 23, 67, 63,  0,  0,  0,  0,
+ 94,237,  6, 63,207, 83, 78, 63,  0,  0,  0,  0,140, 30,  3, 63,201,236, 65, 63,  0,  0,  0,  0, 93,120,  8, 63, 11,205, 55, 63,
+  0,  0,  0,  0,220,204, 12, 63, 35, 28, 45, 63,  0,  0,  0,  0, 91, 33, 17, 63,  9,205, 55, 63,  0,  0,  0,  0, 91, 33, 17, 63,
+  9,205, 55, 63,  0,  0,  0,  0,220,204, 12, 63,115, 23, 67, 63,  0,  0,  0,  0, 93,120,  8, 63, 11,205, 55, 63,  0,  0,  0,  0,
+140, 30,  3, 63,201,236, 65, 63,  0,  0,  0,  0, 93,120,  8, 63, 11,205, 55, 63,  0,  0,  0,  0,220,204, 12, 63,115, 23, 67, 63,
+  0,  0,  0,  0,220,204, 12, 63,115, 23, 67, 63,  0,  0,  0,  0, 91, 33, 17, 63,  9,205, 55, 63,  0,  0,  0,  0, 44,123, 22, 63,
+201,236, 65, 63,  0,  0,  0,  0, 88,172, 18, 63,207, 83, 78, 63,  0,  0,  0,  0, 44,123, 22, 63,201,236, 65, 63,  0,  0,  0,  0,
+153, 88, 29, 63,167, 39, 75, 63,  0,  0,  0,  0,153, 88, 29, 63,167, 39, 75, 63,  0,  0,  0,  0,121,170, 26, 63,147, 64, 88, 63,
+  0,  0,  0,  0, 88,172, 18, 63,207, 83, 78, 63,  0,  0,  0,  0,220,204, 12, 63, 22, 56, 90, 63,  0,  0,  0,  0, 88,172, 18, 63,
+207, 83, 78, 63,  0,  0,  0,  0,121,170, 26, 63,147, 64, 88, 63,  0,  0,  0,  0,121,170, 26, 63,147, 64, 88, 63,  0,  0,  0,  0,
+153, 88, 29, 63,167, 39, 75, 63,  0,  0,  0,  0,118,102, 38, 63, 38,228, 82, 63,  0,  0,  0,  0,117,102, 38, 63, 78, 12, 49, 63,
+  0,  0,  0,  0,117,102, 38, 63, 50, 86, 60, 63,  0,  0,  0,  0,200,174, 31, 63,169, 55, 52, 63,  0,  0,  0,  0,200,174, 31, 63,
+169, 55, 52, 63,  0,  0,  0,  0, 51, 73, 32, 63,221,228, 40, 63,  0,  0,  0,  0,117,102, 38, 63, 78, 12, 49, 63,  0,  0,  0,  0,
+117,102, 38, 63, 45,200, 37, 63,  0,  0,  0,  0,117,102, 38, 63, 78, 12, 49, 63,  0,  0,  0,  0, 51, 73, 32, 63,221,228, 40, 63,
+  0,  0,  0,  0, 51, 73, 32, 63,221,228, 40, 63,  0,  0,  0,  0,200,174, 31, 63,169, 55, 52, 63,  0,  0,  0,  0,169,238, 25, 63,
+229, 52, 43, 63,  0,  0,  0,  0, 39,102, 24, 63,119,155, 54, 63,  0,  0,  0,  0,169,238, 25, 63,229, 52, 43, 63,  0,  0,  0,  0,
+200,174, 31, 63,169, 55, 52, 63,  0,  0,  0,  0,200,174, 31, 63,169, 55, 52, 63,  0,  0,  0,  0,246,180, 30, 63, 92,233, 63, 63,
+  0,  0,  0,  0, 39,102, 24, 63,119,155, 54, 63,  0,  0,  0,  0, 44,123, 22, 63,201,236, 65, 63,  0,  0,  0,  0, 39,102, 24, 63,
+119,155, 54, 63,  0,  0,  0,  0,246,180, 30, 63, 92,233, 63, 63,  0,  0,  0,  0,246,180, 30, 63, 92,233, 63, 63,  0,  0,  0,  0,
+200,174, 31, 63,169, 55, 52, 63,  0,  0,  0,  0,117,102, 38, 63, 50, 86, 60, 63,  0,  0,  0,  0,117,102, 38, 63,255,153, 71, 63,
+  0,  0,  0,  0,118,102, 38, 63, 38,228, 82, 63,  0,  0,  0,  0,153, 88, 29, 63,167, 39, 75, 63,  0,  0,  0,  0,153, 88, 29, 63,
+167, 39, 75, 63,  0,  0,  0,  0,246,180, 30, 63, 92,233, 63, 63,  0,  0,  0,  0,117,102, 38, 63,255,153, 71, 63,  0,  0,  0,  0,
+117,102, 38, 63, 50, 86, 60, 63,  0,  0,  0,  0,117,102, 38, 63,255,153, 71, 63,  0,  0,  0,  0,246,180, 30, 63, 92,233, 63, 63,
+  0,  0,  0,  0,246,180, 30, 63, 92,233, 63, 63,  0,  0,  0,  0,153, 88, 29, 63,167, 39, 75, 63,  0,  0,  0,  0, 44,123, 22, 63,
+201,236, 65, 63,  0,  0,  0,  0, 39,102, 24, 63,119,155, 54, 63,  0,  0,  0,  0, 44,123, 22, 63,201,236, 65, 63,  0,  0,  0,  0,
+ 91, 33, 17, 63,  9,205, 55, 63,  0,  0,  0,  0, 91, 33, 17, 63,  9,205, 55, 63,  0,  0,  0,  0,138,107, 19, 63,211,160, 44, 63,
+  0,  0,  0,  0, 39,102, 24, 63,119,155, 54, 63,  0,  0,  0,  0,169,238, 25, 63,229, 52, 43, 63,  0,  0,  0,  0, 39,102, 24, 63,
+119,155, 54, 63,  0,  0,  0,  0,138,107, 19, 63,211,160, 44, 63,  0,  0,  0,  0,138,107, 19, 63,211,160, 44, 63,  0,  0,  0,  0,
+ 91, 33, 17, 63,  9,205, 55, 63,  0,  0,  0,  0,220,204, 12, 63, 35, 28, 45, 63,  0,  0,  0,  0,118,102, 38, 63, 77, 46, 94, 63,
+  0,  0,  0,  0,118,102, 38, 63, 19,114,105, 63,  0,  0,  0,  0,235,102, 22, 63, 59, 26, 99, 63,  0,  0,  0,  0,235,102, 22, 63,
+ 59, 26, 99, 63,  0,  0,  0,  0,121,170, 26, 63,147, 64, 88, 63,  0,  0,  0,  0,118,102, 38, 63, 77, 46, 94, 63,  0,  0,  0,  0,
+118,102, 38, 63, 38,228, 82, 63,  0,  0,  0,  0,118,102, 38, 63, 77, 46, 94, 63,  0,  0,  0,  0,121,170, 26, 63,147, 64, 88, 63,
+  0,  0,  0,  0,121,170, 26, 63,147, 64, 88, 63,  0,  0,  0,  0,235,102, 22, 63, 59, 26, 99, 63,  0,  0,  0,  0,220,204, 12, 63,
+ 22, 56, 90, 63,  0,  0,  0,  0,204, 50,  3, 63, 58, 26, 99, 63,  0,  0,  0,  0,220,204, 12, 63, 22, 56, 90, 63,  0,  0,  0,  0,
+235,102, 22, 63, 59, 26, 99, 63,  0,  0,  0,  0,235,102, 22, 63, 59, 26, 99, 63,  0,  0,  0,  0,224,204, 12, 63,212,154,109, 63,
+  0,  0,  0,  0,204, 50,  3, 63, 58, 26, 99, 63,  0,  0,  0,  0,131,102,230, 62, 22,114,105, 63,  0,  0,  0,  0,204, 50,  3, 63,
+ 58, 26, 99, 63,  0,  0,  0,  0,224,204, 12, 63,212,154,109, 63,  0,  0,  0,  0,224,204, 12, 63,212,154,109, 63,  0,  0,  0,  0,
+235,102, 22, 63, 59, 26, 99, 63,  0,  0,  0,  0,118,102, 38, 63, 19,114,105, 63,  0,  0,  0,  0,120,102, 38, 63,242,187,116, 63,
+  0,  0,  0,  0,  3,153, 59, 63,  0,  0,128, 63,  0,  0,  0,  0,134,102,230, 62,242,187,116, 63,  0,  0,  0,  0,134,102,230, 62,
+242,187,116, 63,  0,  0,  0,  0,224,204, 12, 63,212,154,109, 63,  0,  0,  0,  0,120,102, 38, 63,242,187,116, 63,  0,  0,  0,  0,
+118,102, 38, 63, 19,114,105, 63,  0,  0,  0,  0,120,102, 38, 63,242,187,116, 63,  0,  0,  0,  0,224,204, 12, 63,212,154,109, 63,
+  0,  0,  0,  0,224,204, 12, 63,212,154,109, 63,  0,  0,  0,  0,134,102,230, 62,242,187,116, 63,  0,  0,  0,  0,131,102,230, 62,
+ 22,114,105, 63,  0,  0,  0,  0,204, 50,  3, 63, 58, 26, 99, 63,  0,  0,  0,  0,131,102,230, 62, 22,114,105, 63,  0,  0,  0,  0,
+131,102,230, 62, 79, 46, 94, 63,  0,  0,  0,  0,131,102,230, 62, 79, 46, 94, 63,  0,  0,  0,  0,118,222,253, 62,148, 64, 88, 63,
+  0,  0,  0,  0,204, 50,  3, 63, 58, 26, 99, 63,  0,  0,  0,  0,220,204, 12, 63, 22, 56, 90, 63,  0,  0,  0,  0,204, 50,  3, 63,
+ 58, 26, 99, 63,  0,  0,  0,  0,118,222,253, 62,148, 64, 88, 63,  0,  0,  0,  0,118,222,253, 62,148, 64, 88, 63,  0,  0,  0,  0,
+131,102,230, 62, 79, 46, 94, 63,  0,  0,  0,  0,130,102,230, 62, 41,228, 82, 63,  0,  0,  0,  0,213,233, 76, 63, 35, 48, 21, 63,
+  0,  0,  0,  0,176,235, 70, 63,226,209, 22, 63,  0,  0,  0,  0, 80,234, 73, 63,146,111, 11, 63,  0,  0,  0,  0, 80,234, 73, 63,
+146,111, 11, 63,  0,  0,  0,  0,  1,200, 79, 63, 94,152,  9, 63,  0,  0,  0,  0,213,233, 76, 63, 35, 48, 21, 63,  0,  0,  0,  0,
+ 19,215, 82, 63,252, 29, 19, 63,  0,  0,  0,  0,213,233, 76, 63, 35, 48, 21, 63,  0,  0,  0,  0,  1,200, 79, 63, 94,152,  9, 63,
+  0,  0,  0,  0,  1,200, 79, 63, 94,152,  9, 63,  0,  0,  0,  0, 80,234, 73, 63,146,111, 11, 63,  0,  0,  0,  0,193,204, 76, 63,
+  0,  0,  0, 63,  0,  0,  0,  0,213,233, 76, 63, 35, 48, 21, 63,  0,  0,  0,  0, 19,215, 82, 63,252, 29, 19, 63,  0,  0,  0,  0,
+220, 41, 80, 63,105, 60, 31, 63,  0,  0,  0,  0,220, 41, 80, 63,105, 60, 31, 63,  0,  0,  0,  0,164,219, 73, 63,173, 23, 33, 63,
+  0,  0,  0,  0,213,233, 76, 63, 35, 48, 21, 63,  0,  0,  0,  0,176,235, 70, 63,226,209, 22, 63,  0,  0,  0,  0,213,233, 76, 63,
+ 35, 48, 21, 63,  0,  0,  0,  0,164,219, 73, 63,173, 23, 33, 63,  0,  0,  0,  0,164,219, 73, 63,173, 23, 33, 63,  0,  0,  0,  0,
+220, 41, 80, 63,105, 60, 31, 63,  0,  0,  0,  0,196, 33, 77, 63,221, 52, 43, 63,  0,  0,  0,  0,169,158, 70, 63,200,160, 44, 63,
+  0,  0,  0,  0,  0,  0, 64, 63, 24, 28, 45, 63,  0,  0,  0,  0,  5,171, 67, 63,216, 17, 34, 63,  0,  0,  0,  0,  5,171, 67, 63,
+216, 17, 34, 63,  0,  0,  0,  0,164,219, 73, 63,173, 23, 33, 63,  0,  0,  0,  0,169,158, 70, 63,200,160, 44, 63,  0,  0,  0,  0,
+196, 33, 77, 63,221, 52, 43, 63,  0,  0,  0,  0,169,158, 70, 63,200,160, 44, 63,  0,  0,  0,  0,164,219, 73, 63,173, 23, 33, 63,
+  0,  0,  0,  0,164,219, 73, 63,173, 23, 33, 63,  0,  0,  0,  0,  5,171, 67, 63,216, 17, 34, 63,  0,  0,  0,  0,176,235, 70, 63,
+226,209, 22, 63,  0,  0,  0,  0, 75,124, 83, 63,217,228, 40, 63,  0,  0,  0,  0,196, 33, 77, 63,221, 52, 43, 63,  0,  0,  0,  0,
+220, 41, 80, 63,105, 60, 31, 63,  0,  0,  0,  0,220, 41, 80, 63,105, 60, 31, 63,  0,  0,  0,  0,218, 20, 86, 63,143,140, 28, 63,
+  0,  0,  0,  0, 75,124, 83, 63,217,228, 40, 63,  0,  0,  0,  0,139,153, 89, 63, 45,200, 37, 63,  0,  0,  0,  0, 75,124, 83, 63,
+217,228, 40, 63,  0,  0,  0,  0,218, 20, 86, 63,143,140, 28, 63,  0,  0,  0,  0,218, 20, 86, 63,143,140, 28, 63,  0,  0,  0,  0,
+220, 41, 80, 63,105, 60, 31, 63,  0,  0,  0,  0, 19,215, 82, 63,252, 29, 19, 63,  0,  0,  0,  0,  0,  0, 64, 63,182, 32, 23, 63,
+  0,  0,  0,  0,176,235, 70, 63,226,209, 22, 63,  0,  0,  0,  0,  5,171, 67, 63,216, 17, 34, 63,  0,  0,  0,  0,  5,171, 67, 63,
+216, 17, 34, 63,  0,  0,  0,  0,251, 84, 60, 63,216, 17, 34, 63,  0,  0,  0,  0,  0,  0, 64, 63,182, 32, 23, 63,  0,  0,  0,  0,
+ 80, 20, 57, 63,226,209, 22, 63,  0,  0,  0,  0,  0,  0, 64, 63,182, 32, 23, 63,  0,  0,  0,  0,251, 84, 60, 63,216, 17, 34, 63,
+  0,  0,  0,  0,251, 84, 60, 63,216, 17, 34, 63,  0,  0,  0,  0,  5,171, 67, 63,216, 17, 34, 63,  0,  0,  0,  0,  0,  0, 64, 63,
+ 24, 28, 45, 63,  0,  0,  0,  0,  0,  0, 64, 63,182, 32, 23, 63,  0,  0,  0,  0, 80, 20, 57, 63,226,209, 22, 63,  0,  0,  0,  0,
+169,156, 60, 63, 96,116, 11, 63,  0,  0,  0,  0,169,156, 60, 63, 96,116, 11, 63,  0,  0,  0,  0, 87, 99, 67, 63, 96,116, 11, 63,
+  0,  0,  0,  0,  0,  0, 64, 63,182, 32, 23, 63,  0,  0,  0,  0,176,235, 70, 63,226,209, 22, 63,  0,  0,  0,  0,  0,  0, 64, 63,
+182, 32, 23, 63,  0,  0,  0,  0, 87, 99, 67, 63, 96,116, 11, 63,  0,  0,  0,  0, 87, 99, 67, 63, 96,116, 11, 63,  0,  0,  0,  0,
+169,156, 60, 63, 96,116, 11, 63,  0,  0,  0,  0,  0,  0, 64, 63,  0,  0,  0, 63,  0,  0,  0,  0, 96,102, 70, 63,244,  1,  0, 63,
+  0,  0,  0,  0,193,204, 76, 63,  0,  0,  0, 63,  0,  0,  0,  0, 80,234, 73, 63,146,111, 11, 63,  0,  0,  0,  0, 80,234, 73, 63,
+146,111, 11, 63,  0,  0,  0,  0, 87, 99, 67, 63, 96,116, 11, 63,  0,  0,  0,  0, 96,102, 70, 63,244,  1,  0, 63,  0,  0,  0,  0,
+  0,  0, 64, 63,  0,  0,  0, 63,  0,  0,  0,  0, 96,102, 70, 63,244,  1,  0, 63,  0,  0,  0,  0, 87, 99, 67, 63, 96,116, 11, 63,
+  0,  0,  0,  0, 87, 99, 67, 63, 96,116, 11, 63,  0,  0,  0,  0, 80,234, 73, 63,146,111, 11, 63,  0,  0,  0,  0,176,235, 70, 63,
+226,209, 22, 63,  0,  0,  0,  0,160,153, 57, 63,244,  1,  0, 63,  0,  0,  0,  0,  0,  0, 64, 63,  0,  0,  0, 63,  0,  0,  0,  0,
+169,156, 60, 63, 96,116, 11, 63,  0,  0,  0,  0,169,156, 60, 63, 96,116, 11, 63,  0,  0,  0,  0,176, 21, 54, 63,146,111, 11, 63,
+  0,  0,  0,  0,160,153, 57, 63,244,  1,  0, 63,  0,  0,  0,  0, 63, 51, 51, 63,  0,  0,  0, 63,  0,  0,  0,  0,160,153, 57, 63,
+244,  1,  0, 63,  0,  0,  0,  0,176, 21, 54, 63,146,111, 11, 63,  0,  0,  0,  0,176, 21, 54, 63,146,111, 11, 63,  0,  0,  0,  0,
+169,156, 60, 63, 96,116, 11, 63,  0,  0,  0,  0, 80, 20, 57, 63,226,209, 22, 63,  0,  0,  0,  0,  0,  0, 64, 63, 93, 58,217, 62,
+  0,  0,  0,  0,144, 61, 57, 63, 19,196,217, 62,  0,  0,  0,  0, 85,123, 60, 63,253,230,198, 62,  0,  0,  0,  0, 85,123, 60, 63,
+253,230,198, 62,  0,  0,  0,  0,171,132, 67, 63,253,230,198, 62,  0,  0,  0,  0,  0,  0, 64, 63, 93, 58,217, 62,  0,  0,  0,  0,
+112,194, 70, 63, 19,196,217, 62,  0,  0,  0,  0,  0,  0, 64, 63, 93, 58,217, 62,  0,  0,  0,  0,171,132, 67, 63,253,230,198, 62,
+  0,  0,  0,  0,171,132, 67, 63,253,230,198, 62,  0,  0,  0,  0, 85,123, 60, 63,253,230,198, 62,  0,  0,  0,  0,  0,  0, 64, 63,
+211,111,180, 62,  0,  0,  0,  0,  0,  0, 64, 63, 93, 58,217, 62,  0,  0,  0,  0,112,194, 70, 63, 19,196,217, 62,  0,  0,  0,  0,
+125, 84, 67, 63, 42,211,236, 62,  0,  0,  0,  0,125, 84, 67, 63, 42,211,236, 62,  0,  0,  0,  0,131,171, 60, 63, 42,211,236, 62,
+  0,  0,  0,  0,  0,  0, 64, 63, 93, 58,217, 62,  0,  0,  0,  0,144, 61, 57, 63, 19,196,217, 62,  0,  0,  0,  0,  0,  0, 64, 63,
+ 93, 58,217, 62,  0,  0,  0,  0,131,171, 60, 63, 42,211,236, 62,  0,  0,  0,  0,131,171, 60, 63, 42,211,236, 62,  0,  0,  0,  0,
+125, 84, 67, 63, 42,211,236, 62,  0,  0,  0,  0,  0,  0, 64, 63,  0,  0,  0, 63,  0,  0,  0,  0,160,153, 57, 63,244,  1,  0, 63,
+  0,  0,  0,  0, 63, 51, 51, 63,  0,  0,  0, 63,  0,  0,  0,  0,128, 46, 54, 63, 75,207,236, 62,  0,  0,  0,  0,128, 46, 54, 63,
+ 75,207,236, 62,  0,  0,  0,  0,131,171, 60, 63, 42,211,236, 62,  0,  0,  0,  0,160,153, 57, 63,244,  1,  0, 63,  0,  0,  0,  0,
+  0,  0, 64, 63,  0,  0,  0, 63,  0,  0,  0,  0,160,153, 57, 63,244,  1,  0, 63,  0,  0,  0,  0,131,171, 60, 63, 42,211,236, 62,
+  0,  0,  0,  0,131,171, 60, 63, 42,211,236, 62,  0,  0,  0,  0,128, 46, 54, 63, 75,207,236, 62,  0,  0,  0,  0,144, 61, 57, 63,
+ 19,196,217, 62,  0,  0,  0,  0, 96,102, 70, 63,244,  1,  0, 63,  0,  0,  0,  0,  0,  0, 64, 63,  0,  0,  0, 63,  0,  0,  0,  0,
+125, 84, 67, 63, 42,211,236, 62,  0,  0,  0,  0,125, 84, 67, 63, 42,211,236, 62,  0,  0,  0,  0,128,209, 73, 63, 75,207,236, 62,
+  0,  0,  0,  0, 96,102, 70, 63,244,  1,  0, 63,  0,  0,  0,  0,193,204, 76, 63,  0,  0,  0, 63,  0,  0,  0,  0, 96,102, 70, 63,
+244,  1,  0, 63,  0,  0,  0,  0,128,209, 73, 63, 75,207,236, 62,  0,  0,  0,  0,128,209, 73, 63, 75,207,236, 62,  0,  0,  0,  0,
+125, 84, 67, 63, 42,211,236, 62,  0,  0,  0,  0,112,194, 70, 63, 19,196,217, 62,  0,  0,  0,  0, 43, 22, 51, 63, 35, 48, 21, 63,
+  0,  0,  0,  0,237, 40, 45, 63,252, 29, 19, 63,  0,  0,  0,  0,255, 55, 48, 63, 94,152,  9, 63,  0,  0,  0,  0,255, 55, 48, 63,
+ 94,152,  9, 63,  0,  0,  0,  0,176, 21, 54, 63,146,111, 11, 63,  0,  0,  0,  0, 43, 22, 51, 63, 35, 48, 21, 63,  0,  0,  0,  0,
+ 80, 20, 57, 63,226,209, 22, 63,  0,  0,  0,  0, 43, 22, 51, 63, 35, 48, 21, 63,  0,  0,  0,  0,176, 21, 54, 63,146,111, 11, 63,
+  0,  0,  0,  0,176, 21, 54, 63,146,111, 11, 63,  0,  0,  0,  0,255, 55, 48, 63, 94,152,  9, 63,  0,  0,  0,  0, 63, 51, 51, 63,
+  0,  0,  0, 63,  0,  0,  0,  0, 43, 22, 51, 63, 35, 48, 21, 63,  0,  0,  0,  0, 80, 20, 57, 63,226,209, 22, 63,  0,  0,  0,  0,
+ 91, 36, 54, 63,173, 23, 33, 63,  0,  0,  0,  0, 91, 36, 54, 63,173, 23, 33, 63,  0,  0,  0,  0, 36,214, 47, 63,105, 60, 31, 63,
+  0,  0,  0,  0, 43, 22, 51, 63, 35, 48, 21, 63,  0,  0,  0,  0,237, 40, 45, 63,252, 29, 19, 63,  0,  0,  0,  0, 43, 22, 51, 63,
+ 35, 48, 21, 63,  0,  0,  0,  0, 36,214, 47, 63,105, 60, 31, 63,  0,  0,  0,  0, 36,214, 47, 63,105, 60, 31, 63,  0,  0,  0,  0,
+ 91, 36, 54, 63,173, 23, 33, 63,  0,  0,  0,  0, 60,222, 50, 63,221, 52, 43, 63,  0,  0,  0,  0,181,131, 44, 63,216,228, 40, 63,
+  0,  0,  0,  0,117,102, 38, 63, 45,200, 37, 63,  0,  0,  0,  0, 38,235, 41, 63,141,140, 28, 63,  0,  0,  0,  0, 38,235, 41, 63,
+141,140, 28, 63,  0,  0,  0,  0, 36,214, 47, 63,105, 60, 31, 63,  0,  0,  0,  0,181,131, 44, 63,216,228, 40, 63,  0,  0,  0,  0,
+ 60,222, 50, 63,221, 52, 43, 63,  0,  0,  0,  0,181,131, 44, 63,216,228, 40, 63,  0,  0,  0,  0, 36,214, 47, 63,105, 60, 31, 63,
+  0,  0,  0,  0, 36,214, 47, 63,105, 60, 31, 63,  0,  0,  0,  0, 38,235, 41, 63,141,140, 28, 63,  0,  0,  0,  0,237, 40, 45, 63,
+252, 29, 19, 63,  0,  0,  0,  0, 87, 97, 57, 63,200,160, 44, 63,  0,  0,  0,  0, 60,222, 50, 63,221, 52, 43, 63,  0,  0,  0,  0,
+ 91, 36, 54, 63,173, 23, 33, 63,  0,  0,  0,  0, 91, 36, 54, 63,173, 23, 33, 63,  0,  0,  0,  0,251, 84, 60, 63,216, 17, 34, 63,
+  0,  0,  0,  0, 87, 97, 57, 63,200,160, 44, 63,  0,  0,  0,  0,  0,  0, 64, 63, 24, 28, 45, 63,  0,  0,  0,  0, 87, 97, 57, 63,
+200,160, 44, 63,  0,  0,  0,  0,251, 84, 60, 63,216, 17, 34, 63,  0,  0,  0,  0,251, 84, 60, 63,216, 17, 34, 63,  0,  0,  0,  0,
+ 91, 36, 54, 63,173, 23, 33, 63,  0,  0,  0,  0, 80, 20, 57, 63,226,209, 22, 63,  0,  0,  0,  0,134, 14,128, 63, 39, 48, 21, 63,
+  0,  0,  0,  0,227, 30,122, 63,233,209, 22, 63,  0,  0,  0,  0,138, 29,125, 63,150,111, 11, 63,  0,  0,  0,  0,138, 29,125, 63,
+150,111, 11, 63,  0,  0,  0,  0,159,125,129, 63, 94,152,  9, 63,  0,  0,  0,  0,134, 14,128, 63, 39, 48, 21, 63,  0,  0,  0,  0,
+174, 73,193, 60,253, 29, 19, 63,  0,  0,  0,  0,209, 92,232, 57, 39, 48, 21, 63,  0,  0,  0,  0,114,207, 62, 60, 94,152,  9, 63,
+  0,  0,  0,  0,159,125,129, 63, 94,152,  9, 63,  0,  0,  0,  0,138, 29,125, 63,150,111, 11, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0, 63,  0,  0,  0,  0,209, 92,232, 57, 39, 48, 21, 63,  0,  0,  0,  0,174, 73,193, 60,253, 29, 19, 63,  0,  0,  0,  0,
+214, 67, 87, 60,110, 60, 31, 63,  0,  0,  0,  0,136,174,129, 63,110, 60, 31, 63,  0,  0,  0,  0,213, 14,125, 63,180, 23, 33, 63,
+  0,  0,  0,  0,134, 14,128, 63, 39, 48, 21, 63,  0,  0,  0,  0,227, 30,122, 63,233,209, 22, 63,  0,  0,  0,  0,134, 14,128, 63,
+ 39, 48, 21, 63,  0,  0,  0,  0,213, 14,125, 63,180, 23, 33, 63,  0,  0,  0,  0,213, 14,125, 63,180, 23, 33, 63,  0,  0,  0,  0,
+136,174,129, 63,110, 60, 31, 63,  0,  0,  0,  0,121, 42,128, 63,230, 52, 43, 63,  0,  0,  0,  0,210,209,121, 63,212,160, 44, 63,
+  0,  0,  0,  0, 36, 51,115, 63, 36, 28, 45, 63,  0,  0,  0,  0, 49,222,118, 63,226, 17, 34, 63,  0,  0,  0,  0, 49,222,118, 63,
+226, 17, 34, 63,  0,  0,  0,  0,213, 14,125, 63,180, 23, 33, 63,  0,  0,  0,  0,210,209,121, 63,212,160, 44, 63,  0,  0,  0,  0,
+121, 42,128, 63,230, 52, 43, 63,  0,  0,  0,  0,210,209,121, 63,212,160, 44, 63,  0,  0,  0,  0,213, 14,125, 63,180, 23, 33, 63,
+  0,  0,  0,  0,213, 14,125, 63,180, 23, 33, 63,  0,  0,  0,  0, 49,222,118, 63,226, 17, 34, 63,  0,  0,  0,  0,227, 30,122, 63,
+233,209, 22, 63,  0,  0,  0,  0,111,239,213, 60,223,228, 40, 63,  0,  0,  0,  0,120,226,169, 58,230, 52, 43, 63,  0,  0,  0,  0,
+214, 67, 87, 60,110, 60, 31, 63,  0,  0,  0,  0,214, 67, 87, 60,110, 60, 31, 63,  0,  0,  0,  0, 13,129, 20, 61,143,140, 28, 63,
+  0,  0,  0,  0,111,239,213, 60,223,228, 40, 63,  0,  0,  0,  0,246,203, 76, 61, 48,200, 37, 63,  0,  0,  0,  0,111,239,213, 60,
+223,228, 40, 63,  0,  0,  0,  0, 13,129, 20, 61,143,140, 28, 63,  0,  0,  0,  0, 13,129, 20, 61,143,140, 28, 63,  0,  0,  0,  0,
+214, 67, 87, 60,110, 60, 31, 63,  0,  0,  0,  0,174, 73,193, 60,253, 29, 19, 63,  0,  0,  0,  0, 44, 51,115, 63,188, 32, 23, 63,
+  0,  0,  0,  0,227, 30,122, 63,233,209, 22, 63,  0,  0,  0,  0, 49,222,118, 63,226, 17, 34, 63,  0,  0,  0,  0, 49,222,118, 63,
+226, 17, 34, 63,  0,  0,  0,  0, 31,136,111, 63,225, 17, 34, 63,  0,  0,  0,  0, 44, 51,115, 63,188, 32, 23, 63,  0,  0,  0,  0,
+116, 71,108, 63,232,209, 22, 63,  0,  0,  0,  0, 44, 51,115, 63,188, 32, 23, 63,  0,  0,  0,  0, 31,136,111, 63,225, 17, 34, 63,
+  0,  0,  0,  0, 31,136,111, 63,225, 17, 34, 63,  0,  0,  0,  0, 49,222,118, 63,226, 17, 34, 63,  0,  0,  0,  0, 36, 51,115, 63,
+ 36, 28, 45, 63,  0,  0,  0,  0, 44, 51,115, 63,188, 32, 23, 63,  0,  0,  0,  0,116, 71,108, 63,232,209, 22, 63,  0,  0,  0,  0,
+213,207,111, 63,100,116, 11, 63,  0,  0,  0,  0,213,207,111, 63,100,116, 11, 63,  0,  0,  0,  0,138,150,118, 63,101,116, 11, 63,
+  0,  0,  0,  0, 44, 51,115, 63,188, 32, 23, 63,  0,  0,  0,  0,227, 30,122, 63,233,209, 22, 63,  0,  0,  0,  0, 44, 51,115, 63,
+188, 32, 23, 63,  0,  0,  0,  0,138,150,118, 63,101,116, 11, 63,  0,  0,  0,  0,138,150,118, 63,101,116, 11, 63,  0,  0,  0,  0,
+213,207,111, 63,100,116, 11, 63,  0,  0,  0,  0, 51, 51,115, 63,  0,  0,  0, 63,  0,  0,  0,  0,154,153,121, 63,244,  1,  0, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,138, 29,125, 63,150,111, 11, 63,  0,  0,  0,  0,138, 29,125, 63,
+150,111, 11, 63,  0,  0,  0,  0,138,150,118, 63,101,116, 11, 63,  0,  0,  0,  0,154,153,121, 63,244,  1,  0, 63,  0,  0,  0,  0,
+ 51, 51,115, 63,  0,  0,  0, 63,  0,  0,  0,  0,154,153,121, 63,244,  1,  0, 63,  0,  0,  0,  0,138,150,118, 63,101,116, 11, 63,
+  0,  0,  0,  0,138,150,118, 63,101,116, 11, 63,  0,  0,  0,  0,138, 29,125, 63,150,111, 11, 63,  0,  0,  0,  0,227, 30,122, 63,
+233,209, 22, 63,  0,  0,  0,  0,205,204,108, 63,244,  1,  0, 63,  0,  0,  0,  0, 51, 51,115, 63,  0,  0,  0, 63,  0,  0,  0,  0,
+213,207,111, 63,100,116, 11, 63,  0,  0,  0,  0,213,207,111, 63,100,116, 11, 63,  0,  0,  0,  0,213, 72,105, 63,149,111, 11, 63,
+  0,  0,  0,  0,205,204,108, 63,244,  1,  0, 63,  0,  0,  0,  0,101,102,102, 63,  0,  0,  0, 63,  0,  0,  0,  0,205,204,108, 63,
+244,  1,  0, 63,  0,  0,  0,  0,213, 72,105, 63,149,111, 11, 63,  0,  0,  0,  0,213, 72,105, 63,149,111, 11, 63,  0,  0,  0,  0,
+213,207,111, 63,100,116, 11, 63,  0,  0,  0,  0,116, 71,108, 63,232,209, 22, 63,  0,  0,  0,  0, 58, 51,115, 63, 73, 58,217, 62,
+  0,  0,  0,  0,192,112,108, 63,  4,196,217, 62,  0,  0,  0,  0,139,174,111, 63,223,230,198, 62,  0,  0,  0,  0,139,174,111, 63,
+223,230,198, 62,  0,  0,  0,  0,239,183,118, 63,227,230,198, 62,  0,  0,  0,  0, 58, 51,115, 63, 73, 58,217, 62,  0,  0,  0,  0,
+179,245,121, 63,  6,196,217, 62,  0,  0,  0,  0, 58, 51,115, 63, 73, 58,217, 62,  0,  0,  0,  0,239,183,118, 63,227,230,198, 62,
+  0,  0,  0,  0,239,183,118, 63,227,230,198, 62,  0,  0,  0,  0,139,174,111, 63,223,230,198, 62,  0,  0,  0,  0, 65, 51,115, 63,
+160,111,180, 62,  0,  0,  0,  0, 58, 51,115, 63, 73, 58,217, 62,  0,  0,  0,  0,179,245,121, 63,  6,196,217, 62,  0,  0,  0,  0,
+185,135,118, 63, 30,211,236, 62,  0,  0,  0,  0,185,135,118, 63, 30,211,236, 62,  0,  0,  0,  0,180,222,111, 63, 30,211,236, 62,
+  0,  0,  0,  0, 58, 51,115, 63, 73, 58,217, 62,  0,  0,  0,  0,192,112,108, 63,  4,196,217, 62,  0,  0,  0,  0, 58, 51,115, 63,
+ 73, 58,217, 62,  0,  0,  0,  0,180,222,111, 63, 30,211,236, 62,  0,  0,  0,  0,180,222,111, 63, 30,211,236, 62,  0,  0,  0,  0,
+185,135,118, 63, 30,211,236, 62,  0,  0,  0,  0, 51, 51,115, 63,  0,  0,  0, 63,  0,  0,  0,  0,205,204,108, 63,244,  1,  0, 63,
+  0,  0,  0,  0,101,102,102, 63,  0,  0,  0, 63,  0,  0,  0,  0,170, 97,105, 63, 65,207,236, 62,  0,  0,  0,  0,170, 97,105, 63,
+ 65,207,236, 62,  0,  0,  0,  0,180,222,111, 63, 30,211,236, 62,  0,  0,  0,  0,205,204,108, 63,244,  1,  0, 63,  0,  0,  0,  0,
+ 51, 51,115, 63,  0,  0,  0, 63,  0,  0,  0,  0,205,204,108, 63,244,  1,  0, 63,  0,  0,  0,  0,180,222,111, 63, 30,211,236, 62,
+  0,  0,  0,  0,180,222,111, 63, 30,211,236, 62,  0,  0,  0,  0,170, 97,105, 63, 65,207,236, 62,  0,  0,  0,  0,192,112,108, 63,
+  4,196,217, 62,  0,  0,  0,  0,154,153,121, 63,244,  1,  0, 63,  0,  0,  0,  0, 51, 51,115, 63,  0,  0,  0, 63,  0,  0,  0,  0,
+185,135,118, 63, 30,211,236, 62,  0,  0,  0,  0,185,135,118, 63, 30,211,236, 62,  0,  0,  0,  0,194,  4,125, 63, 67,207,236, 62,
+  0,  0,  0,  0,154,153,121, 63,244,  1,  0, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,154,153,121, 63,
+244,  1,  0, 63,  0,  0,  0,  0,194,  4,125, 63, 67,207,236, 62,  0,  0,  0,  0,194,  4,125, 63, 67,207,236, 62,  0,  0,  0,  0,
+185,135,118, 63, 30,211,236, 62,  0,  0,  0,  0,179,245,121, 63,  6,196,217, 62,  0,  0,  0,  0, 76, 73,102, 63, 38, 48, 21, 63,
+  0,  0,  0,  0, 11, 92, 96, 63,253, 29, 19, 63,  0,  0,  0,  0, 33,107, 99, 63, 94,152,  9, 63,  0,  0,  0,  0, 33,107, 99, 63,
+ 94,152,  9, 63,  0,  0,  0,  0,213, 72,105, 63,149,111, 11, 63,  0,  0,  0,  0, 76, 73,102, 63, 38, 48, 21, 63,  0,  0,  0,  0,
+116, 71,108, 63,232,209, 22, 63,  0,  0,  0,  0, 76, 73,102, 63, 38, 48, 21, 63,  0,  0,  0,  0,213, 72,105, 63,149,111, 11, 63,
+  0,  0,  0,  0,213, 72,105, 63,149,111, 11, 63,  0,  0,  0,  0, 33,107, 99, 63, 94,152,  9, 63,  0,  0,  0,  0,101,102,102, 63,
+  0,  0,  0, 63,  0,  0,  0,  0, 76, 73,102, 63, 38, 48, 21, 63,  0,  0,  0,  0,116, 71,108, 63,232,209, 22, 63,  0,  0,  0,  0,
+124, 87,105, 63,180, 23, 33, 63,  0,  0,  0,  0,124, 87,105, 63,180, 23, 33, 63,  0,  0,  0,  0, 65,  9, 99, 63,109, 60, 31, 63,
+  0,  0,  0,  0, 76, 73,102, 63, 38, 48, 21, 63,  0,  0,  0,  0, 11, 92, 96, 63,253, 29, 19, 63,  0,  0,  0,  0, 76, 73,102, 63,
+ 38, 48, 21, 63,  0,  0,  0,  0, 65,  9, 99, 63,109, 60, 31, 63,  0,  0,  0,  0, 65,  9, 99, 63,109, 60, 31, 63,  0,  0,  0,  0,
+124, 87,105, 63,180, 23, 33, 63,  0,  0,  0,  0, 87, 17,102, 63,229, 52, 43, 63,  0,  0,  0,  0,205,182, 95, 63,222,228, 40, 63,
+  0,  0,  0,  0,139,153, 89, 63, 45,200, 37, 63,  0,  0,  0,  0, 63, 30, 93, 63,143,140, 28, 63,  0,  0,  0,  0, 63, 30, 93, 63,
+143,140, 28, 63,  0,  0,  0,  0, 65,  9, 99, 63,109, 60, 31, 63,  0,  0,  0,  0,205,182, 95, 63,222,228, 40, 63,  0,  0,  0,  0,
+ 87, 17,102, 63,229, 52, 43, 63,  0,  0,  0,  0,205,182, 95, 63,222,228, 40, 63,  0,  0,  0,  0, 65,  9, 99, 63,109, 60, 31, 63,
+  0,  0,  0,  0, 65,  9, 99, 63,109, 60, 31, 63,  0,  0,  0,  0, 63, 30, 93, 63,143,140, 28, 63,  0,  0,  0,  0, 11, 92, 96, 63,
+253, 29, 19, 63,  0,  0,  0,  0,118,148,108, 63,211,160, 44, 63,  0,  0,  0,  0, 87, 17,102, 63,229, 52, 43, 63,  0,  0,  0,  0,
+124, 87,105, 63,180, 23, 33, 63,  0,  0,  0,  0,124, 87,105, 63,180, 23, 33, 63,  0,  0,  0,  0, 31,136,111, 63,225, 17, 34, 63,
+  0,  0,  0,  0,118,148,108, 63,211,160, 44, 63,  0,  0,  0,  0, 36, 51,115, 63, 36, 28, 45, 63,  0,  0,  0,  0,118,148,108, 63,
+211,160, 44, 63,  0,  0,  0,  0, 31,136,111, 63,225, 17, 34, 63,  0,  0,  0,  0, 31,136,111, 63,225, 17, 34, 63,  0,  0,  0,  0,
+124, 87,105, 63,180, 23, 33, 63,  0,  0,  0,  0,116, 71,108, 63,232,209, 22, 63,  0,  0,  0,  0, 65, 65, 77, 62, 32, 48, 21, 63,
+  0,  0,  0,  0,152, 72, 53, 62,229,209, 22, 63,  0,  0,  0,  0, 47, 67, 65, 62,147,111, 11, 63,  0,  0,  0,  0, 47, 67, 65, 62,
+147,111, 11, 63,  0,  0,  0,  0,255,185, 88, 62, 90,152,  9, 63,  0,  0,  0,  0, 65, 65, 77, 62, 32, 48, 21, 63,  0,  0,  0,  0,
+ 64,246,100, 62,246, 29, 19, 63,  0,  0,  0,  0, 65, 65, 77, 62, 32, 48, 21, 63,  0,  0,  0,  0,255,185, 88, 62, 90,152,  9, 63,
+  0,  0,  0,  0,255,185, 88, 62, 90,152,  9, 63,  0,  0,  0,  0, 47, 67, 65, 62,147,111, 11, 63,  0,  0,  0,  0,254,204, 76, 62,
+  0,  0,  0, 63,  0,  0,  0,  0, 65, 65, 77, 62, 32, 48, 21, 63,  0,  0,  0,  0, 64,246,100, 62,246, 29, 19, 63,  0,  0,  0,  0,
+ 89, 65, 90, 62, 94, 60, 31, 63,  0,  0,  0,  0, 89, 65, 90, 62, 94, 60, 31, 63,  0,  0,  0,  0,107,  8, 65, 62,170, 23, 33, 63,
+  0,  0,  0,  0, 65, 65, 77, 62, 32, 48, 21, 63,  0,  0,  0,  0,152, 72, 53, 62,229,209, 22, 63,  0,  0,  0,  0, 65, 65, 77, 62,
+ 32, 48, 21, 63,  0,  0,  0,  0,107,  8, 65, 62,170, 23, 33, 63,  0,  0,  0,  0,107,  8, 65, 62,170, 23, 33, 63,  0,  0,  0,  0,
+ 89, 65, 90, 62, 94, 60, 31, 63,  0,  0,  0,  0,230, 32, 78, 62,211, 52, 43, 63,  0,  0,  0,  0,105, 20, 52, 62,198,160, 44, 63,
+  0,  0,  0,  0,173,153, 25, 62, 27, 28, 45, 63,  0,  0,  0,  0,216, 69, 40, 62,220, 17, 34, 63,  0,  0,  0,  0,216, 69, 40, 62,
+220, 17, 34, 63,  0,  0,  0,  0,107,  8, 65, 62,170, 23, 33, 63,  0,  0,  0,  0,105, 20, 52, 62,198,160, 44, 63,  0,  0,  0,  0,
+230, 32, 78, 62,211, 52, 43, 63,  0,  0,  0,  0,105, 20, 52, 62,198,160, 44, 63,  0,  0,  0,  0,107,  8, 65, 62,170, 23, 33, 63,
+  0,  0,  0,  0,107,  8, 65, 62,170, 23, 33, 63,  0,  0,  0,  0,216, 69, 40, 62,220, 17, 34, 63,  0,  0,  0,  0,152, 72, 53, 62,
+229,209, 22, 63,  0,  0,  0,  0, 14,139,103, 62,199,228, 40, 63,  0,  0,  0,  0,230, 32, 78, 62,211, 52, 43, 63,  0,  0,  0,  0,
+ 89, 65, 90, 62, 94, 60, 31, 63,  0,  0,  0,  0, 89, 65, 90, 62, 94, 60, 31, 63,  0,  0,  0,  0, 83,237,113, 62,130,140, 28, 63,
+  0,  0,  0,  0, 14,139,103, 62,199,228, 40, 63,  0,  0,  0,  0,  0,  0,128, 62, 23,200, 37, 63,  0,  0,  0,  0, 14,139,103, 62,
+199,228, 40, 63,  0,  0,  0,  0, 83,237,113, 62,130,140, 28, 63,  0,  0,  0,  0, 83,237,113, 62,130,140, 28, 63,  0,  0,  0,  0,
+ 89, 65, 90, 62, 94, 60, 31, 63,  0,  0,  0,  0, 64,246,100, 62,246, 29, 19, 63,  0,  0,  0,  0,180,153, 25, 62,185, 32, 23, 63,
+  0,  0,  0,  0,152, 72, 53, 62,229,209, 22, 63,  0,  0,  0,  0,216, 69, 40, 62,220, 17, 34, 63,  0,  0,  0,  0,216, 69, 40, 62,
+220, 17, 34, 63,  0,  0,  0,  0,133,237, 10, 62,219, 17, 34, 63,  0,  0,  0,  0,180,153, 25, 62,185, 32, 23, 63,  0,  0,  0,  0,
+147,213,251, 61,228,209, 22, 63,  0,  0,  0,  0,180,153, 25, 62,185, 32, 23, 63,  0,  0,  0,  0,133,237, 10, 62,219, 17, 34, 63,
+  0,  0,  0,  0,133,237, 10, 62,219, 17, 34, 63,  0,  0,  0,  0,216, 69, 40, 62,220, 17, 34, 63,  0,  0,  0,  0,173,153, 25, 62,
+ 27, 28, 45, 63,  0,  0,  0,  0,180,153, 25, 62,185, 32, 23, 63,  0,  0,  0,  0,147,213,251, 61,228,209, 22, 63,  0,  0,  0,  0,
+ 67, 12, 12, 62, 98,116, 11, 63,  0,  0,  0,  0, 67, 12, 12, 62, 98,116, 11, 63,  0,  0,  0,  0, 34, 39, 39, 62, 98,116, 11, 63,
+  0,  0,  0,  0,180,153, 25, 62,185, 32, 23, 63,  0,  0,  0,  0,152, 72, 53, 62,229,209, 22, 63,  0,  0,  0,  0,180,153, 25, 62,
+185, 32, 23, 63,  0,  0,  0,  0, 34, 39, 39, 62, 98,116, 11, 63,  0,  0,  0,  0, 34, 39, 39, 62, 98,116, 11, 63,  0,  0,  0,  0,
+ 67, 12, 12, 62, 98,116, 11, 63,  0,  0,  0,  0,181,153, 25, 62,  0,  0,  0, 63,  0,  0,  0,  0, 92, 51, 51, 62,244,  1,  0, 63,
+  0,  0,  0,  0,254,204, 76, 62,  0,  0,  0, 63,  0,  0,  0,  0, 47, 67, 65, 62,147,111, 11, 63,  0,  0,  0,  0, 47, 67, 65, 62,
+147,111, 11, 63,  0,  0,  0,  0, 34, 39, 39, 62, 98,116, 11, 63,  0,  0,  0,  0, 92, 51, 51, 62,244,  1,  0, 63,  0,  0,  0,  0,
+181,153, 25, 62,  0,  0,  0, 63,  0,  0,  0,  0, 92, 51, 51, 62,244,  1,  0, 63,  0,  0,  0,  0, 34, 39, 39, 62, 98,116, 11, 63,
+  0,  0,  0,  0, 34, 39, 39, 62, 98,116, 11, 63,  0,  0,  0,  0, 47, 67, 65, 62,147,111, 11, 63,  0,  0,  0,  0,152, 72, 53, 62,
+229,209, 22, 63,  0,  0,  0,  0,  8,  0,  0, 62,244,  1,  0, 63,  0,  0,  0,  0,181,153, 25, 62,  0,  0,  0, 63,  0,  0,  0,  0,
+ 67, 12, 12, 62, 98,116, 11, 63,  0,  0,  0,  0, 67, 12, 12, 62, 98,116, 11, 63,  0,  0,  0,  0,109,224,227, 61,147,111, 11, 63,
+  0,  0,  0,  0,  8,  0,  0, 62,244,  1,  0, 63,  0,  0,  0,  0,215,204,204, 61,  0,  0,  0, 63,  0,  0,  0,  0,  8,  0,  0, 62,
+244,  1,  0, 63,  0,  0,  0,  0,109,224,227, 61,147,111, 11, 63,  0,  0,  0,  0,109,224,227, 61,147,111, 11, 63,  0,  0,  0,  0,
+ 67, 12, 12, 62, 98,116, 11, 63,  0,  0,  0,  0,147,213,251, 61,228,209, 22, 63,  0,  0,  0,  0,196,153, 25, 62, 73, 58,217, 62,
+  0,  0,  0,  0,171, 31,253, 61,  6,196,217, 62,  0,  0,  0,  0,  1,135, 11, 62,228,230,198, 62,  0,  0,  0,  0,  1,135, 11, 62,
+228,230,198, 62,  0,  0,  0,  0,153,172, 39, 62,230,230,198, 62,  0,  0,  0,  0,196,153, 25, 62, 73, 58,217, 62,  0,  0,  0,  0,
+179,163, 52, 62,  7,196,217, 62,  0,  0,  0,  0,196,153, 25, 62, 73, 58,217, 62,  0,  0,  0,  0,153,172, 39, 62,230,230,198, 62,
+  0,  0,  0,  0,153,172, 39, 62,230,230,198, 62,  0,  0,  0,  0,  1,135, 11, 62,228,230,198, 62,  0,  0,  0,  0,214,153, 25, 62,
+165,111,180, 62,  0,  0,  0,  0,196,153, 25, 62, 73, 58,217, 62,  0,  0,  0,  0,179,163, 52, 62,  7,196,217, 62,  0,  0,  0,  0,
+202,235, 38, 62, 33,211,236, 62,  0,  0,  0,  0,202,235, 38, 62, 33,211,236, 62,  0,  0,  0,  0,173, 71, 12, 62, 31,211,236, 62,
+  0,  0,  0,  0,196,153, 25, 62, 73, 58,217, 62,  0,  0,  0,  0,171, 31,253, 61,  6,196,217, 62,  0,  0,  0,  0,196,153, 25, 62,
+ 73, 58,217, 62,  0,  0,  0,  0,173, 71, 12, 62, 31,211,236, 62,  0,  0,  0,  0,173, 71, 12, 62, 31,211,236, 62,  0,  0,  0,  0,
+202,235, 38, 62, 33,211,236, 62,  0,  0,  0,  0,181,153, 25, 62,  0,  0,  0, 63,  0,  0,  0,  0,  8,  0,  0, 62,244,  1,  0, 63,
+  0,  0,  0,  0,215,204,204, 61,  0,  0,  0, 63,  0,  0,  0,  0,251,166,228, 61, 67,207,236, 62,  0,  0,  0,  0,251,166,228, 61,
+ 67,207,236, 62,  0,  0,  0,  0,173, 71, 12, 62, 31,211,236, 62,  0,  0,  0,  0,  8,  0,  0, 62,244,  1,  0, 63,  0,  0,  0,  0,
+181,153, 25, 62,  0,  0,  0, 63,  0,  0,  0,  0,  8,  0,  0, 62,244,  1,  0, 63,  0,  0,  0,  0,173, 71, 12, 62, 31,211,236, 62,
+  0,  0,  0,  0,173, 71, 12, 62, 31,211,236, 62,  0,  0,  0,  0,251,166,228, 61, 67,207,236, 62,  0,  0,  0,  0,171, 31,253, 61,
+  6,196,217, 62,  0,  0,  0,  0, 92, 51, 51, 62,244,  1,  0, 63,  0,  0,  0,  0,181,153, 25, 62,  0,  0,  0, 63,  0,  0,  0,  0,
+202,235, 38, 62, 33,211,236, 62,  0,  0,  0,  0,202,235, 38, 62, 33,211,236, 62,  0,  0,  0,  0,251,223, 64, 62, 67,207,236, 62,
+  0,  0,  0,  0, 92, 51, 51, 62,244,  1,  0, 63,  0,  0,  0,  0,254,204, 76, 62,  0,  0,  0, 63,  0,  0,  0,  0, 92, 51, 51, 62,
+244,  1,  0, 63,  0,  0,  0,  0,251,223, 64, 62, 67,207,236, 62,  0,  0,  0,  0,251,223, 64, 62, 67,207,236, 62,  0,  0,  0,  0,
+202,235, 38, 62, 33,211,236, 62,  0,  0,  0,  0,179,163, 52, 62,  7,196,217, 62,  0,  0,  0,  0, 42,228,203, 61, 37, 48, 21, 63,
+  0,  0,  0,  0,  1,122,156, 61,254, 29, 19, 63,  0,  0,  0,  0,172,242,180, 61, 96,152,  9, 63,  0,  0,  0,  0,172,242,180, 61,
+ 96,152,  9, 63,  0,  0,  0,  0,109,224,227, 61,147,111, 11, 63,  0,  0,  0,  0, 42,228,203, 61, 37, 48, 21, 63,  0,  0,  0,  0,
+147,213,251, 61,228,209, 22, 63,  0,  0,  0,  0, 42,228,203, 61, 37, 48, 21, 63,  0,  0,  0,  0,109,224,227, 61,147,111, 11, 63,
+  0,  0,  0,  0,109,224,227, 61,147,111, 11, 63,  0,  0,  0,  0,172,242,180, 61, 96,152,  9, 63,  0,  0,  0,  0,215,204,204, 61,
+  0,  0,  0, 63,  0,  0,  0,  0, 42,228,203, 61, 37, 48, 21, 63,  0,  0,  0,  0,147,213,251, 61,228,209, 22, 63,  0,  0,  0,  0,
+208, 85,228, 61,179, 23, 33, 63,  0,  0,  0,  0,208, 85,228, 61,179, 23, 33, 63,  0,  0,  0,  0,212,227,177, 61,110, 60, 31, 63,
+  0,  0,  0,  0, 42,228,203, 61, 37, 48, 21, 63,  0,  0,  0,  0,  1,122,156, 61,254, 29, 19, 63,  0,  0,  0,  0, 42,228,203, 61,
+ 37, 48, 21, 63,  0,  0,  0,  0,212,227,177, 61,110, 60, 31, 63,  0,  0,  0,  0,212,227,177, 61,110, 60, 31, 63,  0,  0,  0,  0,
+208, 85,228, 61,179, 23, 33, 63,  0,  0,  0,  0,175, 36,202, 61,228, 52, 43, 63,  0,  0,  0,  0, 53, 80,151, 61,223,228, 40, 63,
+  0,  0,  0,  0,246,203, 76, 61, 48,200, 37, 63,  0,  0,  0,  0,166,139,130, 61,145,140, 28, 63,  0,  0,  0,  0,166,139,130, 61,
+145,140, 28, 63,  0,  0,  0,  0,212,227,177, 61,110, 60, 31, 63,  0,  0,  0,  0, 53, 80,151, 61,223,228, 40, 63,  0,  0,  0,  0,
+175, 36,202, 61,228, 52, 43, 63,  0,  0,  0,  0, 53, 80,151, 61,223,228, 40, 63,  0,  0,  0,  0,212,227,177, 61,110, 60, 31, 63,
+  0,  0,  0,  0,212,227,177, 61,110, 60, 31, 63,  0,  0,  0,  0,166,139,130, 61,145,140, 28, 63,  0,  0,  0,  0,  1,122,156, 61,
+254, 29, 19, 63,  0,  0,  0,  0,201, 61,254, 61,207,160, 44, 63,  0,  0,  0,  0,175, 36,202, 61,228, 52, 43, 63,  0,  0,  0,  0,
+208, 85,228, 61,179, 23, 33, 63,  0,  0,  0,  0,208, 85,228, 61,179, 23, 33, 63,  0,  0,  0,  0,133,237, 10, 62,219, 17, 34, 63,
+  0,  0,  0,  0,201, 61,254, 61,207,160, 44, 63,  0,  0,  0,  0,173,153, 25, 62, 27, 28, 45, 63,  0,  0,  0,  0,201, 61,254, 61,
+207,160, 44, 63,  0,  0,  0,  0,133,237, 10, 62,219, 17, 34, 63,  0,  0,  0,  0,133,237, 10, 62,219, 17, 34, 63,  0,  0,  0,  0,
+208, 85,228, 61,179, 23, 33, 63,  0,  0,  0,  0,147,213,251, 61,228,209, 22, 63,  0,  0,  0,  0,245,  6,205, 62, 37, 48, 21, 63,
+  0,  0,  0,  0,155, 10,193, 62,229,209, 22, 63,  0,  0,  0,  0,229,  7,199, 62,147,111, 11, 63,  0,  0,  0,  0,229,  7,199, 62,
+147,111, 11, 63,  0,  0,  0,  0, 85,195,210, 62, 96,152,  9, 63,  0,  0,  0,  0,245,  6,205, 62, 37, 48, 21, 63,  0,  0,  0,  0,
+128,225,216, 62,254, 29, 19, 63,  0,  0,  0,  0,245,  6,205, 62, 37, 48, 21, 63,  0,  0,  0,  0, 85,195,210, 62, 96,152,  9, 63,
+  0,  0,  0,  0, 85,195,210, 62, 96,152,  9, 63,  0,  0,  0,  0,229,  7,199, 62,147,111, 11, 63,  0,  0,  0,  0,202,204,204, 62,
+  0,  0,  0, 63,  0,  0,  0,  0,245,  6,205, 62, 37, 48, 21, 63,  0,  0,  0,  0,128,225,216, 62,254, 29, 19, 63,  0,  0,  0,  0,
+ 11,135,211, 62,110, 60, 31, 63,  0,  0,  0,  0, 11,135,211, 62,110, 60, 31, 63,  0,  0,  0,  0,140,234,198, 62,179, 23, 33, 63,
+  0,  0,  0,  0,245,  6,205, 62, 37, 48, 21, 63,  0,  0,  0,  0,155, 10,193, 62,229,209, 22, 63,  0,  0,  0,  0,245,  6,205, 62,
+ 37, 48, 21, 63,  0,  0,  0,  0,140,234,198, 62,179, 23, 33, 63,  0,  0,  0,  0,140,234,198, 62,179, 23, 33, 63,  0,  0,  0,  0,
+ 11,135,211, 62,110, 60, 31, 63,  0,  0,  0,  0,212,118,205, 62,228, 52, 43, 63,  0,  0,  0,  0,142,112,192, 62,207,160, 44, 63,
+  0,  0,  0,  0, 42, 51,179, 62, 28, 28, 45, 63,  0,  0,  0,  0, 61,137,186, 62,219, 17, 34, 63,  0,  0,  0,  0, 61,137,186, 62,
+219, 17, 34, 63,  0,  0,  0,  0,140,234,198, 62,179, 23, 33, 63,  0,  0,  0,  0,142,112,192, 62,207,160, 44, 63,  0,  0,  0,  0,
+212,118,205, 62,228, 52, 43, 63,  0,  0,  0,  0,142,112,192, 62,207,160, 44, 63,  0,  0,  0,  0,140,234,198, 62,179, 23, 33, 63,
+  0,  0,  0,  0,140,234,198, 62,179, 23, 33, 63,  0,  0,  0,  0, 61,137,186, 62,219, 17, 34, 63,  0,  0,  0,  0,155, 10,193, 62,
+229,209, 22, 63,  0,  0,  0,  0,243, 43,218, 62,223,228, 40, 63,  0,  0,  0,  0,212,118,205, 62,228, 52, 43, 63,  0,  0,  0,  0,
+ 11,135,211, 62,110, 60, 31, 63,  0,  0,  0,  0, 11,135,211, 62,110, 60, 31, 63,  0,  0,  0,  0, 22, 93,223, 62,145,140, 28, 63,
+  0,  0,  0,  0,243, 43,218, 62,223,228, 40, 63,  0,  0,  0,  0,129,102,230, 62, 48,200, 37, 63,  0,  0,  0,  0,243, 43,218, 62,
+223,228, 40, 63,  0,  0,  0,  0, 22, 93,223, 62,145,140, 28, 63,  0,  0,  0,  0, 22, 93,223, 62,145,140, 28, 63,  0,  0,  0,  0,
+ 11,135,211, 62,110, 60, 31, 63,  0,  0,  0,  0,128,225,216, 62,254, 29, 19, 63,  0,  0,  0,  0, 38, 51,179, 62,185, 32, 23, 63,
+  0,  0,  0,  0,155, 10,193, 62,229,209, 22, 63,  0,  0,  0,  0, 61,137,186, 62,219, 17, 34, 63,  0,  0,  0,  0, 61,137,186, 62,
+219, 17, 34, 63,  0,  0,  0,  0, 20,221,171, 62,219, 17, 34, 63,  0,  0,  0,  0, 38, 51,179, 62,185, 32, 23, 63,  0,  0,  0,  0,
+180, 91,165, 62,229,209, 22, 63,  0,  0,  0,  0, 38, 51,179, 62,185, 32, 23, 63,  0,  0,  0,  0, 20,221,171, 62,219, 17, 34, 63,
+  0,  0,  0,  0, 20,221,171, 62,219, 17, 34, 63,  0,  0,  0,  0, 61,137,186, 62,219, 17, 34, 63,  0,  0,  0,  0, 42, 51,179, 62,
+ 28, 28, 45, 63,  0,  0,  0,  0, 38, 51,179, 62,185, 32, 23, 63,  0,  0,  0,  0,180, 91,165, 62,229,209, 22, 63,  0,  0,  0,  0,
+111,108,172, 62, 98,116, 11, 63,  0,  0,  0,  0,111,108,172, 62, 98,116, 11, 63,  0,  0,  0,  0,222,249,185, 62, 98,116, 11, 63,
+  0,  0,  0,  0, 38, 51,179, 62,185, 32, 23, 63,  0,  0,  0,  0,155, 10,193, 62,229,209, 22, 63,  0,  0,  0,  0, 38, 51,179, 62,
+185, 32, 23, 63,  0,  0,  0,  0,222,249,185, 62, 98,116, 11, 63,  0,  0,  0,  0,222,249,185, 62, 98,116, 11, 63,  0,  0,  0,  0,
+111,108,172, 62, 98,116, 11, 63,  0,  0,  0,  0, 38, 51,179, 62,  0,  0,  0, 63,  0,  0,  0,  0,252,255,191, 62,244,  1,  0, 63,
+  0,  0,  0,  0,202,204,204, 62,  0,  0,  0, 63,  0,  0,  0,  0,229,  7,199, 62,147,111, 11, 63,  0,  0,  0,  0,229,  7,199, 62,
+147,111, 11, 63,  0,  0,  0,  0,222,249,185, 62, 98,116, 11, 63,  0,  0,  0,  0,252,255,191, 62,244,  1,  0, 63,  0,  0,  0,  0,
+ 38, 51,179, 62,  0,  0,  0, 63,  0,  0,  0,  0,252,255,191, 62,244,  1,  0, 63,  0,  0,  0,  0,222,249,185, 62, 98,116, 11, 63,
+  0,  0,  0,  0,222,249,185, 62, 98,116, 11, 63,  0,  0,  0,  0,229,  7,199, 62,147,111, 11, 63,  0,  0,  0,  0,155, 10,193, 62,
+229,209, 22, 63,  0,  0,  0,  0, 82,102,166, 62,244,  1,  0, 63,  0,  0,  0,  0, 38, 51,179, 62,  0,  0,  0, 63,  0,  0,  0,  0,
+111,108,172, 62, 98,116, 11, 63,  0,  0,  0,  0,111,108,172, 62, 98,116, 11, 63,  0,  0,  0,  0,104, 94,159, 62,147,111, 11, 63,
+  0,  0,  0,  0, 82,102,166, 62,244,  1,  0, 63,  0,  0,  0,  0,129,153,153, 62,  0,  0,  0, 63,  0,  0,  0,  0, 82,102,166, 62,
+244,  1,  0, 63,  0,  0,  0,  0,104, 94,159, 62,147,111, 11, 63,  0,  0,  0,  0,104, 94,159, 62,147,111, 11, 63,  0,  0,  0,  0,
+111,108,172, 62, 98,116, 11, 63,  0,  0,  0,  0,180, 91,165, 62,229,209, 22, 63,  0,  0,  0,  0, 30, 51,179, 62, 73, 58,217, 62,
+  0,  0,  0,  0, 39,174,165, 62,  7,196,217, 62,  0,  0,  0,  0,180, 41,172, 62,227,230,198, 62,  0,  0,  0,  0,180, 41,172, 62,
+227,230,198, 62,  0,  0,  0,  0,127, 60,186, 62,225,230,198, 62,  0,  0,  0,  0, 30, 51,179, 62, 73, 58,217, 62,  0,  0,  0,  0,
+ 21,184,192, 62,  6,196,217, 62,  0,  0,  0,  0, 30, 51,179, 62, 73, 58,217, 62,  0,  0,  0,  0,127, 60,186, 62,225,230,198, 62,
+  0,  0,  0,  0,127, 60,186, 62,225,230,198, 62,  0,  0,  0,  0,180, 41,172, 62,227,230,198, 62,  0,  0,  0,  0, 21, 51,179, 62,
+165,111,180, 62,  0,  0,  0,  0, 30, 51,179, 62, 73, 58,217, 62,  0,  0,  0,  0, 21,184,192, 62,  6,196,217, 62,  0,  0,  0,  0,
+ 42,220,185, 62, 31,211,236, 62,  0,  0,  0,  0, 42,220,185, 62, 31,211,236, 62,  0,  0,  0,  0, 27,138,172, 62, 33,211,236, 62,
+  0,  0,  0,  0, 30, 51,179, 62, 73, 58,217, 62,  0,  0,  0,  0, 39,174,165, 62,  7,196,217, 62,  0,  0,  0,  0, 30, 51,179, 62,
+ 73, 58,217, 62,  0,  0,  0,  0, 27,138,172, 62, 33,211,236, 62,  0,  0,  0,  0, 27,138,172, 62, 33,211,236, 62,  0,  0,  0,  0,
+ 42,220,185, 62, 31,211,236, 62,  0,  0,  0,  0, 38, 51,179, 62,  0,  0,  0, 63,  0,  0,  0,  0, 82,102,166, 62,244,  1,  0, 63,
+  0,  0,  0,  0,129,153,153, 62,  0,  0,  0, 63,  0,  0,  0,  0,  3,144,159, 62, 67,207,236, 62,  0,  0,  0,  0,  3,144,159, 62,
+ 67,207,236, 62,  0,  0,  0,  0, 27,138,172, 62, 33,211,236, 62,  0,  0,  0,  0, 82,102,166, 62,244,  1,  0, 63,  0,  0,  0,  0,
+ 38, 51,179, 62,  0,  0,  0, 63,  0,  0,  0,  0, 82,102,166, 62,244,  1,  0, 63,  0,  0,  0,  0, 27,138,172, 62, 33,211,236, 62,
+  0,  0,  0,  0, 27,138,172, 62, 33,211,236, 62,  0,  0,  0,  0,  3,144,159, 62, 67,207,236, 62,  0,  0,  0,  0, 39,174,165, 62,
+  7,196,217, 62,  0,  0,  0,  0,252,255,191, 62,244,  1,  0, 63,  0,  0,  0,  0, 38, 51,179, 62,  0,  0,  0, 63,  0,  0,  0,  0,
+ 42,220,185, 62, 31,211,236, 62,  0,  0,  0,  0, 42,220,185, 62, 31,211,236, 62,  0,  0,  0,  0, 65,214,198, 62, 67,207,236, 62,
+  0,  0,  0,  0,252,255,191, 62,244,  1,  0, 63,  0,  0,  0,  0,202,204,204, 62,  0,  0,  0, 63,  0,  0,  0,  0,252,255,191, 62,
+244,  1,  0, 63,  0,  0,  0,  0, 65,214,198, 62, 67,207,236, 62,  0,  0,  0,  0, 65,214,198, 62, 67,207,236, 62,  0,  0,  0,  0,
+ 42,220,185, 62, 31,211,236, 62,  0,  0,  0,  0, 21,184,192, 62,  6,196,217, 62,  0,  0,  0,  0, 95, 95,153, 62, 32, 48, 21, 63,
+  0,  0,  0,  0,224,132,141, 62,246, 29, 19, 63,  0,  0,  0,  0,  1,163,147, 62, 91,152,  9, 63,  0,  0,  0,  0,  1,163,147, 62,
+ 91,152,  9, 63,  0,  0,  0,  0,104, 94,159, 62,147,111, 11, 63,  0,  0,  0,  0, 95, 95,153, 62, 32, 48, 21, 63,  0,  0,  0,  0,
+180, 91,165, 62,229,209, 22, 63,  0,  0,  0,  0, 95, 95,153, 62, 32, 48, 21, 63,  0,  0,  0,  0,104, 94,159, 62,147,111, 11, 63,
+  0,  0,  0,  0,104, 94,159, 62,147,111, 11, 63,  0,  0,  0,  0,  1,163,147, 62, 91,152,  9, 63,  0,  0,  0,  0,129,153,153, 62,
+  0,  0,  0, 63,  0,  0,  0,  0, 95, 95,153, 62, 32, 48, 21, 63,  0,  0,  0,  0,180, 91,165, 62,229,209, 22, 63,  0,  0,  0,  0,
+203,123,159, 62,170, 23, 33, 63,  0,  0,  0,  0,203,123,159, 62,170, 23, 33, 63,  0,  0,  0,  0, 84,223,146, 62, 94, 60, 31, 63,
+  0,  0,  0,  0, 95, 95,153, 62, 32, 48, 21, 63,  0,  0,  0,  0,224,132,141, 62,246, 29, 19, 63,  0,  0,  0,  0, 95, 95,153, 62,
+ 32, 48, 21, 63,  0,  0,  0,  0, 84,223,146, 62, 94, 60, 31, 63,  0,  0,  0,  0, 84,223,146, 62, 94, 60, 31, 63,  0,  0,  0,  0,
+203,123,159, 62,170, 23, 33, 63,  0,  0,  0,  0,141,239,152, 62,211, 52, 43, 63,  0,  0,  0,  0,121, 58,140, 62,199,228, 40, 63,
+  0,  0,  0,  0,  0,  0,128, 62, 23,200, 37, 63,  0,  0,  0,  0, 86,  9,135, 62,130,140, 28, 63,  0,  0,  0,  0, 86,  9,135, 62,
+130,140, 28, 63,  0,  0,  0,  0, 84,223,146, 62, 94, 60, 31, 63,  0,  0,  0,  0,121, 58,140, 62,199,228, 40, 63,  0,  0,  0,  0,
+141,239,152, 62,211, 52, 43, 63,  0,  0,  0,  0,121, 58,140, 62,199,228, 40, 63,  0,  0,  0,  0, 84,223,146, 62, 94, 60, 31, 63,
+  0,  0,  0,  0, 84,223,146, 62, 94, 60, 31, 63,  0,  0,  0,  0, 86,  9,135, 62,130,140, 28, 63,  0,  0,  0,  0,224,132,141, 62,
+246, 29, 19, 63,  0,  0,  0,  0,204,245,165, 62,198,160, 44, 63,  0,  0,  0,  0,141,239,152, 62,211, 52, 43, 63,  0,  0,  0,  0,
+203,123,159, 62,170, 23, 33, 63,  0,  0,  0,  0,203,123,159, 62,170, 23, 33, 63,  0,  0,  0,  0, 20,221,171, 62,219, 17, 34, 63,
+  0,  0,  0,  0,204,245,165, 62,198,160, 44, 63,  0,  0,  0,  0, 42, 51,179, 62, 28, 28, 45, 63,  0,  0,  0,  0,204,245,165, 62,
+198,160, 44, 63,  0,  0,  0,  0, 20,221,171, 62,219, 17, 34, 63,  0,  0,  0,  0, 20,221,171, 62,219, 17, 34, 63,  0,  0,  0,  0,
+203,123,159, 62,170, 23, 33, 63,  0,  0,  0,  0,180, 91,165, 62,229,209, 22, 63,  0,  0,  0,  0,180,182, 25, 63, 38, 48, 21, 63,
+  0,  0,  0,  0,140,184, 19, 63,232,209, 22, 63,  0,  0,  0,  0, 43,183, 22, 63,149,111, 11, 63,  0,  0,  0,  0, 43,183, 22, 63,
+149,111, 11, 63,  0,  0,  0,  0,223,148, 28, 63, 94,152,  9, 63,  0,  0,  0,  0,180,182, 25, 63, 38, 48, 21, 63,  0,  0,  0,  0,
+245,163, 31, 63,253, 29, 19, 63,  0,  0,  0,  0,180,182, 25, 63, 38, 48, 21, 63,  0,  0,  0,  0,223,148, 28, 63, 94,152,  9, 63,
+  0,  0,  0,  0,223,148, 28, 63, 94,152,  9, 63,  0,  0,  0,  0, 43,183, 22, 63,149,111, 11, 63,  0,  0,  0,  0,155,153, 25, 63,
+  0,  0,  0, 63,  0,  0,  0,  0,180,182, 25, 63, 38, 48, 21, 63,  0,  0,  0,  0,245,163, 31, 63,253, 29, 19, 63,  0,  0,  0,  0,
+191,246, 28, 63,109, 60, 31, 63,  0,  0,  0,  0,191,246, 28, 63,109, 60, 31, 63,  0,  0,  0,  0,132,168, 22, 63,180, 23, 33, 63,
+  0,  0,  0,  0,180,182, 25, 63, 38, 48, 21, 63,  0,  0,  0,  0,140,184, 19, 63,232,209, 22, 63,  0,  0,  0,  0,180,182, 25, 63,
+ 38, 48, 21, 63,  0,  0,  0,  0,132,168, 22, 63,180, 23, 33, 63,  0,  0,  0,  0,132,168, 22, 63,180, 23, 33, 63,  0,  0,  0,  0,
+191,246, 28, 63,109, 60, 31, 63,  0,  0,  0,  0,169,238, 25, 63,229, 52, 43, 63,  0,  0,  0,  0,138,107, 19, 63,211,160, 44, 63,
+  0,  0,  0,  0,220,204, 12, 63, 35, 28, 45, 63,  0,  0,  0,  0,225,119, 16, 63,225, 17, 34, 63,  0,  0,  0,  0,225,119, 16, 63,
+225, 17, 34, 63,  0,  0,  0,  0,132,168, 22, 63,180, 23, 33, 63,  0,  0,  0,  0,138,107, 19, 63,211,160, 44, 63,  0,  0,  0,  0,
+169,238, 25, 63,229, 52, 43, 63,  0,  0,  0,  0,138,107, 19, 63,211,160, 44, 63,  0,  0,  0,  0,132,168, 22, 63,180, 23, 33, 63,
+  0,  0,  0,  0,132,168, 22, 63,180, 23, 33, 63,  0,  0,  0,  0,225,119, 16, 63,225, 17, 34, 63,  0,  0,  0,  0,140,184, 19, 63,
+232,209, 22, 63,  0,  0,  0,  0, 51, 73, 32, 63,221,228, 40, 63,  0,  0,  0,  0,169,238, 25, 63,229, 52, 43, 63,  0,  0,  0,  0,
+191,246, 28, 63,109, 60, 31, 63,  0,  0,  0,  0,191,246, 28, 63,109, 60, 31, 63,  0,  0,  0,  0,192,225, 34, 63,142,140, 28, 63,
+  0,  0,  0,  0, 51, 73, 32, 63,221,228, 40, 63,  0,  0,  0,  0,117,102, 38, 63, 45,200, 37, 63,  0,  0,  0,  0, 51, 73, 32, 63,
+221,228, 40, 63,  0,  0,  0,  0,192,225, 34, 63,142,140, 28, 63,  0,  0,  0,  0,192,225, 34, 63,142,140, 28, 63,  0,  0,  0,  0,
+191,246, 28, 63,109, 60, 31, 63,  0,  0,  0,  0,245,163, 31, 63,253, 29, 19, 63,  0,  0,  0,  0,212,204, 12, 63,188, 32, 23, 63,
+  0,  0,  0,  0,140,184, 19, 63,232,209, 22, 63,  0,  0,  0,  0,225,119, 16, 63,225, 17, 34, 63,  0,  0,  0,  0,225,119, 16, 63,
+225, 17, 34, 63,  0,  0,  0,  0,207, 33,  9, 63,226, 17, 34, 63,  0,  0,  0,  0,212,204, 12, 63,188, 32, 23, 63,  0,  0,  0,  0,
+ 29,225,  5, 63,233,209, 22, 63,  0,  0,  0,  0,212,204, 12, 63,188, 32, 23, 63,  0,  0,  0,  0,207, 33,  9, 63,226, 17, 34, 63,
+  0,  0,  0,  0,207, 33,  9, 63,226, 17, 34, 63,  0,  0,  0,  0,225,119, 16, 63,225, 17, 34, 63,  0,  0,  0,  0,220,204, 12, 63,
+ 35, 28, 45, 63,  0,  0,  0,  0,212,204, 12, 63,188, 32, 23, 63,  0,  0,  0,  0, 29,225,  5, 63,233,209, 22, 63,  0,  0,  0,  0,
+118,105,  9, 63,101,116, 11, 63,  0,  0,  0,  0,118,105,  9, 63,101,116, 11, 63,  0,  0,  0,  0, 43, 48, 16, 63,100,116, 11, 63,
+  0,  0,  0,  0,212,204, 12, 63,188, 32, 23, 63,  0,  0,  0,  0,140,184, 19, 63,232,209, 22, 63,  0,  0,  0,  0,212,204, 12, 63,
+188, 32, 23, 63,  0,  0,  0,  0, 43, 48, 16, 63,100,116, 11, 63,  0,  0,  0,  0, 43, 48, 16, 63,100,116, 11, 63,  0,  0,  0,  0,
+118,105,  9, 63,101,116, 11, 63,  0,  0,  0,  0,205,204, 12, 63,  0,  0,  0, 63,  0,  0,  0,  0, 51, 51, 19, 63,244,  1,  0, 63,
+  0,  0,  0,  0,155,153, 25, 63,  0,  0,  0, 63,  0,  0,  0,  0, 43,183, 22, 63,149,111, 11, 63,  0,  0,  0,  0, 43,183, 22, 63,
+149,111, 11, 63,  0,  0,  0,  0, 43, 48, 16, 63,100,116, 11, 63,  0,  0,  0,  0, 51, 51, 19, 63,244,  1,  0, 63,  0,  0,  0,  0,
+205,204, 12, 63,  0,  0,  0, 63,  0,  0,  0,  0, 51, 51, 19, 63,244,  1,  0, 63,  0,  0,  0,  0, 43, 48, 16, 63,100,116, 11, 63,
+  0,  0,  0,  0, 43, 48, 16, 63,100,116, 11, 63,  0,  0,  0,  0, 43,183, 22, 63,149,111, 11, 63,  0,  0,  0,  0,140,184, 19, 63,
+232,209, 22, 63,  0,  0,  0,  0,102,102,  6, 63,244,  1,  0, 63,  0,  0,  0,  0,205,204, 12, 63,  0,  0,  0, 63,  0,  0,  0,  0,
+118,105,  9, 63,101,116, 11, 63,  0,  0,  0,  0,118,105,  9, 63,101,116, 11, 63,  0,  0,  0,  0,118,226,  2, 63,149,111, 11, 63,
+  0,  0,  0,  0,102,102,  6, 63,244,  1,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0,  0,102,102,  6, 63,
+244,  1,  0, 63,  0,  0,  0,  0,118,226,  2, 63,149,111, 11, 63,  0,  0,  0,  0,118,226,  2, 63,149,111, 11, 63,  0,  0,  0,  0,
+118,105,  9, 63,101,116, 11, 63,  0,  0,  0,  0, 29,225,  5, 63,233,209, 22, 63,  0,  0,  0,  0,198,204, 12, 63, 72, 58,217, 62,
+  0,  0,  0,  0, 77, 10,  6, 63,  6,196,217, 62,  0,  0,  0,  0, 17, 72,  9, 63,227,230,198, 62,  0,  0,  0,  0, 17, 72,  9, 63,
+227,230,198, 62,  0,  0,  0,  0,117, 81, 16, 63,223,230,198, 62,  0,  0,  0,  0,198,204, 12, 63, 72, 58,217, 62,  0,  0,  0,  0,
+ 64,143, 19, 63,  4,196,217, 62,  0,  0,  0,  0,198,204, 12, 63, 72, 58,217, 62,  0,  0,  0,  0,117, 81, 16, 63,223,230,198, 62,
+  0,  0,  0,  0,117, 81, 16, 63,223,230,198, 62,  0,  0,  0,  0, 17, 72,  9, 63,227,230,198, 62,  0,  0,  0,  0,191,204, 12, 63,
+160,111,180, 62,  0,  0,  0,  0,198,204, 12, 63, 72, 58,217, 62,  0,  0,  0,  0, 64,143, 19, 63,  4,196,217, 62,  0,  0,  0,  0,
+ 76, 33, 16, 63, 30,211,236, 62,  0,  0,  0,  0, 76, 33, 16, 63, 30,211,236, 62,  0,  0,  0,  0, 71,120,  9, 63, 30,211,236, 62,
+  0,  0,  0,  0,198,204, 12, 63, 72, 58,217, 62,  0,  0,  0,  0, 77, 10,  6, 63,  6,196,217, 62,  0,  0,  0,  0,198,204, 12, 63,
+ 72, 58,217, 62,  0,  0,  0,  0, 71,120,  9, 63, 30,211,236, 62,  0,  0,  0,  0, 71,120,  9, 63, 30,211,236, 62,  0,  0,  0,  0,
+ 76, 33, 16, 63, 30,211,236, 62,  0,  0,  0,  0,205,204, 12, 63,  0,  0,  0, 63,  0,  0,  0,  0,102,102,  6, 63,244,  1,  0, 63,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0,  0, 62,251,  2, 63, 67,207,236, 62,  0,  0,  0,  0, 62,251,  2, 63,
+ 67,207,236, 62,  0,  0,  0,  0, 71,120,  9, 63, 30,211,236, 62,  0,  0,  0,  0,102,102,  6, 63,244,  1,  0, 63,  0,  0,  0,  0,
+205,204, 12, 63,  0,  0,  0, 63,  0,  0,  0,  0,102,102,  6, 63,244,  1,  0, 63,  0,  0,  0,  0, 71,120,  9, 63, 30,211,236, 62,
+  0,  0,  0,  0, 71,120,  9, 63, 30,211,236, 62,  0,  0,  0,  0, 62,251,  2, 63, 67,207,236, 62,  0,  0,  0,  0, 77, 10,  6, 63,
+  6,196,217, 62,  0,  0,  0,  0, 51, 51, 19, 63,244,  1,  0, 63,  0,  0,  0,  0,205,204, 12, 63,  0,  0,  0, 63,  0,  0,  0,  0,
+ 76, 33, 16, 63, 30,211,236, 62,  0,  0,  0,  0, 76, 33, 16, 63, 30,211,236, 62,  0,  0,  0,  0, 86,158, 22, 63, 65,207,236, 62,
+  0,  0,  0,  0, 51, 51, 19, 63,244,  1,  0, 63,  0,  0,  0,  0,155,153, 25, 63,  0,  0,  0, 63,  0,  0,  0,  0, 51, 51, 19, 63,
+244,  1,  0, 63,  0,  0,  0,  0, 86,158, 22, 63, 65,207,236, 62,  0,  0,  0,  0, 86,158, 22, 63, 65,207,236, 62,  0,  0,  0,  0,
+ 76, 33, 16, 63, 30,211,236, 62,  0,  0,  0,  0, 64,143, 19, 63,  4,196,217, 62,  0,  0,  0,  0,233,197,255, 62, 39, 48, 21, 63,
+  0,  0,  0,  0,101,235,243, 62,252, 29, 19, 63,  0,  0,  0,  0,132,  9,250, 62, 94,152,  9, 63,  0,  0,  0,  0,132,  9,250, 62,
+ 94,152,  9, 63,  0,  0,  0,  0,118,226,  2, 63,149,111, 11, 63,  0,  0,  0,  0,233,197,255, 62, 39, 48, 21, 63,  0,  0,  0,  0,
+ 29,225,  5, 63,233,209, 22, 63,  0,  0,  0,  0,233,197,255, 62, 39, 48, 21, 63,  0,  0,  0,  0,118,226,  2, 63,149,111, 11, 63,
+  0,  0,  0,  0,118,226,  2, 63,149,111, 11, 63,  0,  0,  0,  0,132,  9,250, 62, 94,152,  9, 63,  0,  0,  0,  0,  0,  0,  0, 63,
+  0,  0,  0, 63,  0,  0,  0,  0,233,197,255, 62, 39, 48, 21, 63,  0,  0,  0,  0, 29,225,  5, 63,233,209, 22, 63,  0,  0,  0,  0,
+ 43,241,  2, 63,181, 23, 33, 63,  0,  0,  0,  0, 43,241,  2, 63,181, 23, 33, 63,  0,  0,  0,  0,225, 69,249, 62,110, 60, 31, 63,
+  0,  0,  0,  0,233,197,255, 62, 39, 48, 21, 63,  0,  0,  0,  0,101,235,243, 62,252, 29, 19, 63,  0,  0,  0,  0,233,197,255, 62,
+ 39, 48, 21, 63,  0,  0,  0,  0,225, 69,249, 62,110, 60, 31, 63,  0,  0,  0,  0,225, 69,249, 62,110, 60, 31, 63,  0,  0,  0,  0,
+ 43,241,  2, 63,181, 23, 33, 63,  0,  0,  0,  0, 30, 86,255, 62,230, 52, 43, 63,  0,  0,  0,  0,  9,161,242, 62,223,228, 40, 63,
+  0,  0,  0,  0,129,102,230, 62, 48,200, 37, 63,  0,  0,  0,  0,222,111,237, 62,143,140, 28, 63,  0,  0,  0,  0,222,111,237, 62,
+143,140, 28, 63,  0,  0,  0,  0,225, 69,249, 62,110, 60, 31, 63,  0,  0,  0,  0,  9,161,242, 62,223,228, 40, 63,  0,  0,  0,  0,
+ 30, 86,255, 62,230, 52, 43, 63,  0,  0,  0,  0,  9,161,242, 62,223,228, 40, 63,  0,  0,  0,  0,225, 69,249, 62,110, 60, 31, 63,
+  0,  0,  0,  0,225, 69,249, 62,110, 60, 31, 63,  0,  0,  0,  0,222,111,237, 62,143,140, 28, 63,  0,  0,  0,  0,101,235,243, 62,
+252, 29, 19, 63,  0,  0,  0,  0, 46, 46,  6, 63,211,160, 44, 63,  0,  0,  0,  0, 30, 86,255, 62,230, 52, 43, 63,  0,  0,  0,  0,
+ 43,241,  2, 63,181, 23, 33, 63,  0,  0,  0,  0, 43,241,  2, 63,181, 23, 33, 63,  0,  0,  0,  0,207, 33,  9, 63,226, 17, 34, 63,
+  0,  0,  0,  0, 46, 46,  6, 63,211,160, 44, 63,  0,  0,  0,  0,220,204, 12, 63, 35, 28, 45, 63,  0,  0,  0,  0, 46, 46,  6, 63,
+211,160, 44, 63,  0,  0,  0,  0,207, 33,  9, 63,226, 17, 34, 63,  0,  0,  0,  0,207, 33,  9, 63,226, 17, 34, 63,  0,  0,  0,  0,
+ 43,241,  2, 63,181, 23, 33, 63,  0,  0,  0,  0, 29,225,  5, 63,233,209, 22, 63,  0,  0,  0,  0,138,238, 85, 63, 72,220,187, 62,
+  0,  0,  0,  0,218,173, 82, 63, 55, 92,210, 62,  0,  0,  0,  0,229,189, 79, 63,173,208,189, 62,  0,  0,  0,  0,229,189, 79, 63,
+173,208,189, 62,  0,  0,  0,  0,230,250, 82, 63,117,190,166, 62,  0,  0,  0,  0,138,238, 85, 63, 72,220,187, 62,  0,  0,  0,  0,
+149,153, 89, 63,201,199,165, 62,  0,  0,  0,  0,138,238, 85, 63, 72,220,187, 62,  0,  0,  0,  0,230,250, 82, 63,117,190,166, 62,
+  0,  0,  0,  0,230,250, 82, 63,117,190,166, 62,  0,  0,  0,  0,229,189, 79, 63,173,208,189, 62,  0,  0,  0,  0,198,119, 76, 63,
+ 90,150,169, 62,  0,  0,  0,  0,170,111, 73, 63, 68,135,193, 62,  0,  0,  0,  0,198,119, 76, 63, 90,150,169, 62,  0,  0,  0,  0,
+229,189, 79, 63,173,208,189, 62,  0,  0,  0,  0,229,189, 79, 63,173,208,189, 62,  0,  0,  0,  0,176,175, 76, 63,192,159,213, 62,
+  0,  0,  0,  0,170,111, 73, 63, 68,135,193, 62,  0,  0,  0,  0,112,194, 70, 63, 19,196,217, 62,  0,  0,  0,  0,170,111, 73, 63,
+ 68,135,193, 62,  0,  0,  0,  0,176,175, 76, 63,192,159,213, 62,  0,  0,  0,  0,176,175, 76, 63,192,159,213, 62,  0,  0,  0,  0,
+229,189, 79, 63,173,208,189, 62,  0,  0,  0,  0,218,173, 82, 63, 55, 92,210, 62,  0,  0,  0,  0, 52,175, 79, 63,218, 32,233, 62,
+  0,  0,  0,  0,193,204, 76, 63,  0,  0,  0, 63,  0,  0,  0,  0,128,209, 73, 63, 75,207,236, 62,  0,  0,  0,  0,128,209, 73, 63,
+ 75,207,236, 62,  0,  0,  0,  0,176,175, 76, 63,192,159,213, 62,  0,  0,  0,  0, 52,175, 79, 63,218, 32,233, 62,  0,  0,  0,  0,
+218,173, 82, 63, 55, 92,210, 62,  0,  0,  0,  0, 52,175, 79, 63,218, 32,233, 62,  0,  0,  0,  0,176,175, 76, 63,192,159,213, 62,
+  0,  0,  0,  0,176,175, 76, 63,192,159,213, 62,  0,  0,  0,  0,128,209, 73, 63, 75,207,236, 62,  0,  0,  0,  0,112,194, 70, 63,
+ 19,196,217, 62,  0,  0,  0,  0,170,111, 73, 63, 68,135,193, 62,  0,  0,  0,  0,112,194, 70, 63, 19,196,217, 62,  0,  0,  0,  0,
+171,132, 67, 63,253,230,198, 62,  0,  0,  0,  0,171,132, 67, 63,253,230,198, 62,  0,  0,  0,  0, 61, 29, 70, 63,114, 54,174, 62,
+  0,  0,  0,  0,170,111, 73, 63, 68,135,193, 62,  0,  0,  0,  0,198,119, 76, 63, 90,150,169, 62,  0,  0,  0,  0,170,111, 73, 63,
+ 68,135,193, 62,  0,  0,  0,  0, 61, 29, 70, 63,114, 54,174, 62,  0,  0,  0,  0, 61, 29, 70, 63,114, 54,174, 62,  0,  0,  0,  0,
+171,132, 67, 63,253,230,198, 62,  0,  0,  0,  0,  0,  0, 64, 63,211,111,180, 62,  0,  0,  0,  0, 52,175, 79, 63,218, 32,233, 62,
+  0,  0,  0,  0,218,173, 82, 63, 55, 92,210, 62,  0,  0,  0,  0, 56, 54, 86, 63, 58, 23,233, 62,  0,  0,  0,  0, 56, 54, 86, 63,
+ 58, 23,233, 62,  0,  0,  0,  0, 41, 51, 83, 63, 24,252,255, 62,  0,  0,  0,  0, 52,175, 79, 63,218, 32,233, 62,  0,  0,  0,  0,
+193,204, 76, 63,  0,  0,  0, 63,  0,  0,  0,  0, 52,175, 79, 63,218, 32,233, 62,  0,  0,  0,  0, 41, 51, 83, 63, 24,252,255, 62,
+  0,  0,  0,  0, 41, 51, 83, 63, 24,252,255, 62,  0,  0,  0,  0, 56, 54, 86, 63, 58, 23,233, 62,  0,  0,  0,  0,147,153, 89, 63,
+  0,  0,  0, 63,  0,  0,  0,  0,239,252, 92, 63, 58, 23,233, 62,  0,  0,  0,  0,147,153, 89, 63,  0,  0,  0, 63,  0,  0,  0,  0,
+ 56, 54, 86, 63, 58, 23,233, 62,  0,  0,  0,  0, 56, 54, 86, 63, 58, 23,233, 62,  0,  0,  0,  0,147,153, 89, 63,143,190,209, 62,
+  0,  0,  0,  0,239,252, 92, 63, 58, 23,233, 62,  0,  0,  0,  0, 78,133, 96, 63, 55, 92,210, 62,  0,  0,  0,  0,239,252, 92, 63,
+ 58, 23,233, 62,  0,  0,  0,  0,147,153, 89, 63,143,190,209, 62,  0,  0,  0,  0,147,153, 89, 63,143,190,209, 62,  0,  0,  0,  0,
+ 56, 54, 86, 63, 58, 23,233, 62,  0,  0,  0,  0,218,173, 82, 63, 55, 92,210, 62,  0,  0,  0,  0,138,238, 85, 63, 72,220,187, 62,
+  0,  0,  0,  0,149,153, 89, 63,201,199,165, 62,  0,  0,  0,  0,159, 68, 93, 63, 72,220,187, 62,  0,  0,  0,  0,159, 68, 93, 63,
+ 72,220,187, 62,  0,  0,  0,  0,147,153, 89, 63,143,190,209, 62,  0,  0,  0,  0,138,238, 85, 63, 72,220,187, 62,  0,  0,  0,  0,
+218,173, 82, 63, 55, 92,210, 62,  0,  0,  0,  0,138,238, 85, 63, 72,220,187, 62,  0,  0,  0,  0,147,153, 89, 63,143,190,209, 62,
+  0,  0,  0,  0,147,153, 89, 63,143,190,209, 62,  0,  0,  0,  0,159, 68, 93, 63, 72,220,187, 62,  0,  0,  0,  0, 78,133, 96, 63,
+ 55, 92,210, 62,  0,  0,  0,  0,239,252, 92, 63, 58, 23,233, 62,  0,  0,  0,  0, 78,133, 96, 63, 55, 92,210, 62,  0,  0,  0,  0,
+242,131, 99, 63,218, 32,233, 62,  0,  0,  0,  0,242,131, 99, 63,218, 32,233, 62,  0,  0,  0,  0,254,255, 95, 63, 24,252,255, 62,
+  0,  0,  0,  0,239,252, 92, 63, 58, 23,233, 62,  0,  0,  0,  0,147,153, 89, 63,  0,  0,  0, 63,  0,  0,  0,  0,239,252, 92, 63,
+ 58, 23,233, 62,  0,  0,  0,  0,254,255, 95, 63, 24,252,255, 62,  0,  0,  0,  0,254,255, 95, 63, 24,252,255, 62,  0,  0,  0,  0,
+242,131, 99, 63,218, 32,233, 62,  0,  0,  0,  0,101,102,102, 63,  0,  0,  0, 63,  0,  0,  0,  0,139,174,111, 63,223,230,198, 62,
+  0,  0,  0,  0,192,112,108, 63,  4,196,217, 62,  0,  0,  0,  0,133,195,105, 63, 37,135,193, 62,  0,  0,  0,  0,133,195,105, 63,
+ 37,135,193, 62,  0,  0,  0,  0,249, 21,109, 63, 65, 54,174, 62,  0,  0,  0,  0,139,174,111, 63,223,230,198, 62,  0,  0,  0,  0,
+ 65, 51,115, 63,160,111,180, 62,  0,  0,  0,  0,139,174,111, 63,223,230,198, 62,  0,  0,  0,  0,249, 21,109, 63, 65, 54,174, 62,
+  0,  0,  0,  0,249, 21,109, 63, 65, 54,174, 62,  0,  0,  0,  0,133,195,105, 63, 37,135,193, 62,  0,  0,  0,  0,106,187,102, 63,
+ 54,150,169, 62,  0,  0,  0,  0, 70,117, 99, 63,155,208,189, 62,  0,  0,  0,  0,106,187,102, 63, 54,150,169, 62,  0,  0,  0,  0,
+133,195,105, 63, 37,135,193, 62,  0,  0,  0,  0,133,195,105, 63, 37,135,193, 62,  0,  0,  0,  0,123,131,102, 63,181,159,213, 62,
+  0,  0,  0,  0, 70,117, 99, 63,155,208,189, 62,  0,  0,  0,  0, 78,133, 96, 63, 55, 92,210, 62,  0,  0,  0,  0, 70,117, 99, 63,
+155,208,189, 62,  0,  0,  0,  0,123,131,102, 63,181,159,213, 62,  0,  0,  0,  0,123,131,102, 63,181,159,213, 62,  0,  0,  0,  0,
+133,195,105, 63, 37,135,193, 62,  0,  0,  0,  0,192,112,108, 63,  4,196,217, 62,  0,  0,  0,  0,170, 97,105, 63, 65,207,236, 62,
+  0,  0,  0,  0,101,102,102, 63,  0,  0,  0, 63,  0,  0,  0,  0,242,131, 99, 63,218, 32,233, 62,  0,  0,  0,  0,242,131, 99, 63,
+218, 32,233, 62,  0,  0,  0,  0,123,131,102, 63,181,159,213, 62,  0,  0,  0,  0,170, 97,105, 63, 65,207,236, 62,  0,  0,  0,  0,
+192,112,108, 63,  4,196,217, 62,  0,  0,  0,  0,170, 97,105, 63, 65,207,236, 62,  0,  0,  0,  0,123,131,102, 63,181,159,213, 62,
+  0,  0,  0,  0,123,131,102, 63,181,159,213, 62,  0,  0,  0,  0,242,131, 99, 63,218, 32,233, 62,  0,  0,  0,  0, 78,133, 96, 63,
+ 55, 92,210, 62,  0,  0,  0,  0, 70,117, 99, 63,155,208,189, 62,  0,  0,  0,  0, 78,133, 96, 63, 55, 92,210, 62,  0,  0,  0,  0,
+159, 68, 93, 63, 72,220,187, 62,  0,  0,  0,  0,159, 68, 93, 63, 72,220,187, 62,  0,  0,  0,  0, 71, 56, 96, 63, 99,190,166, 62,
+  0,  0,  0,  0, 70,117, 99, 63,155,208,189, 62,  0,  0,  0,  0,106,187,102, 63, 54,150,169, 62,  0,  0,  0,  0, 70,117, 99, 63,
+155,208,189, 62,  0,  0,  0,  0, 71, 56, 96, 63, 99,190,166, 62,  0,  0,  0,  0, 71, 56, 96, 63, 99,190,166, 62,  0,  0,  0,  0,
+159, 68, 93, 63, 72,220,187, 62,  0,  0,  0,  0,149,153, 89, 63,201,199,165, 62,  0,  0,  0,  0, 33,107, 99, 63, 94,152,  9, 63,
+  0,  0,  0,  0, 11, 92, 96, 63,253, 29, 19, 63,  0,  0,  0,  0, 21,238, 92, 63,112,150,  9, 63,  0,  0,  0,  0, 21,238, 92, 63,
+112,150,  9, 63,  0,  0,  0,  0,254,255, 95, 63, 24,252,255, 62,  0,  0,  0,  0, 33,107, 99, 63, 94,152,  9, 63,  0,  0,  0,  0,
+101,102,102, 63,  0,  0,  0, 63,  0,  0,  0,  0, 33,107, 99, 63, 94,152,  9, 63,  0,  0,  0,  0,254,255, 95, 63, 24,252,255, 62,
+  0,  0,  0,  0,254,255, 95, 63, 24,252,255, 62,  0,  0,  0,  0, 21,238, 92, 63,112,150,  9, 63,  0,  0,  0,  0,147,153, 89, 63,
+  0,  0,  0, 63,  0,  0,  0,  0, 14, 69, 86, 63,112,150,  9, 63,  0,  0,  0,  0,147,153, 89, 63,  0,  0,  0, 63,  0,  0,  0,  0,
+ 21,238, 92, 63,112,150,  9, 63,  0,  0,  0,  0, 21,238, 92, 63,112,150,  9, 63,  0,  0,  0,  0,143,153, 89, 63,219, 98, 19, 63,
+  0,  0,  0,  0, 14, 69, 86, 63,112,150,  9, 63,  0,  0,  0,  0, 19,215, 82, 63,252, 29, 19, 63,  0,  0,  0,  0, 14, 69, 86, 63,
+112,150,  9, 63,  0,  0,  0,  0,143,153, 89, 63,219, 98, 19, 63,  0,  0,  0,  0,143,153, 89, 63,219, 98, 19, 63,  0,  0,  0,  0,
+ 21,238, 92, 63,112,150,  9, 63,  0,  0,  0,  0, 11, 92, 96, 63,253, 29, 19, 63,  0,  0,  0,  0, 63, 30, 93, 63,143,140, 28, 63,
+  0,  0,  0,  0,139,153, 89, 63, 45,200, 37, 63,  0,  0,  0,  0,218, 20, 86, 63,143,140, 28, 63,  0,  0,  0,  0,218, 20, 86, 63,
+143,140, 28, 63,  0,  0,  0,  0,143,153, 89, 63,219, 98, 19, 63,  0,  0,  0,  0, 63, 30, 93, 63,143,140, 28, 63,  0,  0,  0,  0,
+ 11, 92, 96, 63,253, 29, 19, 63,  0,  0,  0,  0, 63, 30, 93, 63,143,140, 28, 63,  0,  0,  0,  0,143,153, 89, 63,219, 98, 19, 63,
+  0,  0,  0,  0,143,153, 89, 63,219, 98, 19, 63,  0,  0,  0,  0,218, 20, 86, 63,143,140, 28, 63,  0,  0,  0,  0, 19,215, 82, 63,
+252, 29, 19, 63,  0,  0,  0,  0, 14, 69, 86, 63,112,150,  9, 63,  0,  0,  0,  0, 19,215, 82, 63,252, 29, 19, 63,  0,  0,  0,  0,
+  1,200, 79, 63, 94,152,  9, 63,  0,  0,  0,  0,  1,200, 79, 63, 94,152,  9, 63,  0,  0,  0,  0, 41, 51, 83, 63, 24,252,255, 62,
+  0,  0,  0,  0, 14, 69, 86, 63,112,150,  9, 63,  0,  0,  0,  0,147,153, 89, 63,  0,  0,  0, 63,  0,  0,  0,  0, 14, 69, 86, 63,
+112,150,  9, 63,  0,  0,  0,  0, 41, 51, 83, 63, 24,252,255, 62,  0,  0,  0,  0, 41, 51, 83, 63, 24,252,255, 62,  0,  0,  0,  0,
+  1,200, 79, 63, 94,152,  9, 63,  0,  0,  0,  0,193,204, 76, 63,  0,  0,  0, 63,  0,  0,  0,  0,237, 28, 18, 61, 60,220,187, 62,
+  0,  0,  0,  0,151, 35,188, 60, 46, 92,210, 62,  0,  0,  0,  0,218, 74, 60, 60,150,208,189, 62,  0,  0,  0,  0,218, 74, 60, 60,
+150,208,189, 62,  0,  0,  0,  0,195,197,197, 60, 89,190,166, 62,  0,  0,  0,  0,237, 28, 18, 61, 60,220,187, 62,  0,  0,  0,  0,
+194,205, 76, 61,186,199,165, 62,  0,  0,  0,  0,237, 28, 18, 61, 60,220,187, 62,  0,  0,  0,  0,195,197,197, 60, 89,190,166, 62,
+  0,  0,  0,  0, 23, 23,131, 63, 89,190,166, 62,  0,  0,  0,  0,150,120,129, 63,150,208,189, 62,  0,  0,  0,  0, 15,171,127, 63,
+ 52,150,169, 62,  0,  0,  0,  0,241,162,124, 63, 36,135,193, 62,  0,  0,  0,  0, 15,171,127, 63, 52,150,169, 62,  0,  0,  0,  0,
+150,120,129, 63,150,208,189, 62,  0,  0,  0,  0,150,120,129, 63,150,208,189, 62,  0,  0,  0,  0,244,226,127, 63,179,159,213, 62,
+  0,  0,  0,  0,241,162,124, 63, 36,135,193, 62,  0,  0,  0,  0,179,245,121, 63,  6,196,217, 62,  0,  0,  0,  0,241,162,124, 63,
+ 36,135,193, 62,  0,  0,  0,  0,244,226,127, 63,179,159,213, 62,  0,  0,  0,  0,244,226,127, 63,179,159,213, 62,  0,  0,  0,  0,
+150,120,129, 63,150,208,189, 62,  0,  0,  0,  0,142,240,130, 63, 46, 92,210, 62,  0,  0,  0,  0, 59,113,129, 63,214, 32,233, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,194,  4,125, 63, 67,207,236, 62,  0,  0,  0,  0,194,  4,125, 63,
+ 67,207,236, 62,  0,  0,  0,  0,244,226,127, 63,179,159,213, 62,  0,  0,  0,  0, 59,113,129, 63,214, 32,233, 62,  0,  0,  0,  0,
+142,240,130, 63, 46, 92,210, 62,  0,  0,  0,  0, 59,113,129, 63,214, 32,233, 62,  0,  0,  0,  0,244,226,127, 63,179,159,213, 62,
+  0,  0,  0,  0,244,226,127, 63,179,159,213, 62,  0,  0,  0,  0,194,  4,125, 63, 67,207,236, 62,  0,  0,  0,  0,179,245,121, 63,
+  6,196,217, 62,  0,  0,  0,  0,241,162,124, 63, 36,135,193, 62,  0,  0,  0,  0,179,245,121, 63,  6,196,217, 62,  0,  0,  0,  0,
+239,183,118, 63,227,230,198, 62,  0,  0,  0,  0,239,183,118, 63,227,230,198, 62,  0,  0,  0,  0,133, 80,121, 63, 65, 54,174, 62,
+  0,  0,  0,  0,241,162,124, 63, 36,135,193, 62,  0,  0,  0,  0, 15,171,127, 63, 52,150,169, 62,  0,  0,  0,  0,241,162,124, 63,
+ 36,135,193, 62,  0,  0,  0,  0,133, 80,121, 63, 65, 54,174, 62,  0,  0,  0,  0,133, 80,121, 63, 65, 54,174, 62,  0,  0,  0,  0,
+239,183,118, 63,227,230,198, 62,  0,  0,  0,  0, 65, 51,115, 63,160,111,180, 62,  0,  0,  0,  0,110,157, 56, 60,214, 32,233, 62,
+  0,  0,  0,  0,151, 35,188, 60, 46, 92,210, 62,  0,  0,  0,  0, 95,151, 22, 61, 55, 23,233, 62,  0,  0,  0,  0, 95,151, 22, 61,
+ 55, 23,233, 62,  0,  0,  0,  0,176,204,204, 60, 24,252,255, 62,  0,  0,  0,  0,110,157, 56, 60,214, 32,233, 62,  0,  0,  0,  0,
+167, 79, 11, 38,  0,  0,  0, 63,  0,  0,  0,  0,110,157, 56, 60,214, 32,233, 62,  0,  0,  0,  0,176,204,204, 60, 24,252,255, 62,
+  0,  0,  0,  0,176,204,204, 60, 24,252,255, 62,  0,  0,  0,  0, 95,151, 22, 61, 55, 23,233, 62,  0,  0,  0,  0,215,204, 76, 61,
+  0,  0,  0, 63,  0,  0,  0,  0, 87,129,129, 61, 57, 23,233, 62,  0,  0,  0,  0,215,204, 76, 61,  0,  0,  0, 63,  0,  0,  0,  0,
+ 95,151, 22, 61, 55, 23,233, 62,  0,  0,  0,  0, 95,151, 22, 61, 55, 23,233, 62,  0,  0,  0,  0, 68,205, 76, 61,135,190,209, 62,
+  0,  0,  0,  0, 87,129,129, 61, 57, 23,233, 62,  0,  0,  0,  0, 92,196,157, 61, 49, 92,210, 62,  0,  0,  0,  0, 87,129,129, 61,
+ 57, 23,233, 62,  0,  0,  0,  0, 68,205, 76, 61,135,190,209, 62,  0,  0,  0,  0, 68,205, 76, 61,135,190,209, 62,  0,  0,  0,  0,
+ 95,151, 22, 61, 55, 23,233, 62,  0,  0,  0,  0,151, 35,188, 60, 46, 92,210, 62,  0,  0,  0,  0,237, 28, 18, 61, 60,220,187, 62,
+  0,  0,  0,  0,194,205, 76, 61,186,199,165, 62,  0,  0,  0,  0,  7,191,131, 61, 62,220,187, 62,  0,  0,  0,  0,  7,191,131, 61,
+ 62,220,187, 62,  0,  0,  0,  0, 68,205, 76, 61,135,190,209, 62,  0,  0,  0,  0,237, 28, 18, 61, 60,220,187, 62,  0,  0,  0,  0,
+151, 35,188, 60, 46, 92,210, 62,  0,  0,  0,  0,237, 28, 18, 61, 60,220,187, 62,  0,  0,  0,  0, 68,205, 76, 61,135,190,209, 62,
+  0,  0,  0,  0, 68,205, 76, 61,135,190,209, 62,  0,  0,  0,  0,  7,191,131, 61, 62,220,187, 62,  0,  0,  0,  0, 92,196,157, 61,
+ 49, 92,210, 62,  0,  0,  0,  0, 87,129,129, 61, 57, 23,233, 62,  0,  0,  0,  0, 92,196,157, 61, 49, 92,210, 62,  0,  0,  0,  0,
+ 89,185,181, 61,214, 32,233, 62,  0,  0,  0,  0, 89,185,181, 61,214, 32,233, 62,  0,  0,  0,  0,154,153,153, 61, 25,252,255, 62,
+  0,  0,  0,  0, 87,129,129, 61, 57, 23,233, 62,  0,  0,  0,  0,215,204, 76, 61,  0,  0,  0, 63,  0,  0,  0,  0, 87,129,129, 61,
+ 57, 23,233, 62,  0,  0,  0,  0,154,153,153, 61, 25,252,255, 62,  0,  0,  0,  0,154,153,153, 61, 25,252,255, 62,  0,  0,  0,  0,
+ 89,185,181, 61,214, 32,233, 62,  0,  0,  0,  0,215,204,204, 61,  0,  0,  0, 63,  0,  0,  0,  0,  1,135, 11, 62,228,230,198, 62,
+  0,  0,  0,  0,171, 31,253, 61,  6,196,217, 62,  0,  0,  0,  0,251,181,231, 61, 38,135,193, 62,  0,  0,  0,  0,251,181,231, 61,
+ 38,135,193, 62,  0,  0,  0,  0,204, 36,  1, 62, 70, 54,174, 62,  0,  0,  0,  0,  1,135, 11, 62,228,230,198, 62,  0,  0,  0,  0,
+214,153, 25, 62,165,111,180, 62,  0,  0,  0,  0,  1,135, 11, 62,228,230,198, 62,  0,  0,  0,  0,204, 36,  1, 62, 70, 54,174, 62,
+  0,  0,  0,  0,204, 36,  1, 62, 70, 54,174, 62,  0,  0,  0,  0,251,181,231, 61, 38,135,193, 62,  0,  0,  0,  0, 70,117,207, 61,
+ 54,150,169, 62,  0,  0,  0,  0, 35, 68,181, 61,153,208,189, 62,  0,  0,  0,  0, 70,117,207, 61, 54,150,169, 62,  0,  0,  0,  0,
+251,181,231, 61, 38,135,193, 62,  0,  0,  0,  0,251,181,231, 61, 38,135,193, 62,  0,  0,  0,  0,164,181,205, 61,180,159,213, 62,
+  0,  0,  0,  0, 35, 68,181, 61,153,208,189, 62,  0,  0,  0,  0, 92,196,157, 61, 49, 92,210, 62,  0,  0,  0,  0, 35, 68,181, 61,
+153,208,189, 62,  0,  0,  0,  0,164,181,205, 61,180,159,213, 62,  0,  0,  0,  0,164,181,205, 61,180,159,213, 62,  0,  0,  0,  0,
+251,181,231, 61, 38,135,193, 62,  0,  0,  0,  0,171, 31,253, 61,  6,196,217, 62,  0,  0,  0,  0,251,166,228, 61, 67,207,236, 62,
+  0,  0,  0,  0,215,204,204, 61,  0,  0,  0, 63,  0,  0,  0,  0, 89,185,181, 61,214, 32,233, 62,  0,  0,  0,  0, 89,185,181, 61,
+214, 32,233, 62,  0,  0,  0,  0,164,181,205, 61,180,159,213, 62,  0,  0,  0,  0,251,166,228, 61, 67,207,236, 62,  0,  0,  0,  0,
+171, 31,253, 61,  6,196,217, 62,  0,  0,  0,  0,251,166,228, 61, 67,207,236, 62,  0,  0,  0,  0,164,181,205, 61,180,159,213, 62,
+  0,  0,  0,  0,164,181,205, 61,180,159,213, 62,  0,  0,  0,  0, 89,185,181, 61,214, 32,233, 62,  0,  0,  0,  0, 92,196,157, 61,
+ 49, 92,210, 62,  0,  0,  0,  0, 35, 68,181, 61,153,208,189, 62,  0,  0,  0,  0, 92,196,157, 61, 49, 92,210, 62,  0,  0,  0,  0,
+  7,191,131, 61, 62,220,187, 62,  0,  0,  0,  0,  7,191,131, 61, 62,220,187, 62,  0,  0,  0,  0, 79, 92,155, 61, 91,190,166, 62,
+  0,  0,  0,  0, 35, 68,181, 61,153,208,189, 62,  0,  0,  0,  0, 70,117,207, 61, 54,150,169, 62,  0,  0,  0,  0, 35, 68,181, 61,
+153,208,189, 62,  0,  0,  0,  0, 79, 92,155, 61, 91,190,166, 62,  0,  0,  0,  0, 79, 92,155, 61, 91,190,166, 62,  0,  0,  0,  0,
+  7,191,131, 61, 62,220,187, 62,  0,  0,  0,  0,194,205, 76, 61,186,199,165, 62,  0,  0,  0,  0,172,242,180, 61, 96,152,  9, 63,
+  0,  0,  0,  0,  1,122,156, 61,254, 29, 19, 63,  0,  0,  0,  0,100, 10,129, 61,113,150,  9, 63,  0,  0,  0,  0,100, 10,129, 61,
+113,150,  9, 63,  0,  0,  0,  0,154,153,153, 61, 25,252,255, 62,  0,  0,  0,  0,172,242,180, 61, 96,152,  9, 63,  0,  0,  0,  0,
+215,204,204, 61,  0,  0,  0, 63,  0,  0,  0,  0,172,242,180, 61, 96,152,  9, 63,  0,  0,  0,  0,154,153,153, 61, 25,252,255, 62,
+  0,  0,  0,  0,154,153,153, 61, 25,252,255, 62,  0,  0,  0,  0,100, 10,129, 61,113,150,  9, 63,  0,  0,  0,  0,215,204, 76, 61,
+  0,  0,  0, 63,  0,  0,  0,  0,109,132, 23, 61,113,150,  9, 63,  0,  0,  0,  0,215,204, 76, 61,  0,  0,  0, 63,  0,  0,  0,  0,
+100, 10,129, 61,113,150,  9, 63,  0,  0,  0,  0,100, 10,129, 61,113,150,  9, 63,  0,  0,  0,  0, 91,204, 76, 61,220, 98, 19, 63,
+  0,  0,  0,  0,109,132, 23, 61,113,150,  9, 63,  0,  0,  0,  0,174, 73,193, 60,253, 29, 19, 63,  0,  0,  0,  0,109,132, 23, 61,
+113,150,  9, 63,  0,  0,  0,  0, 91,204, 76, 61,220, 98, 19, 63,  0,  0,  0,  0, 91,204, 76, 61,220, 98, 19, 63,  0,  0,  0,  0,
+100, 10,129, 61,113,150,  9, 63,  0,  0,  0,  0,  1,122,156, 61,254, 29, 19, 63,  0,  0,  0,  0,166,139,130, 61,145,140, 28, 63,
+  0,  0,  0,  0,246,203, 76, 61, 48,200, 37, 63,  0,  0,  0,  0, 13,129, 20, 61,143,140, 28, 63,  0,  0,  0,  0, 13,129, 20, 61,
+143,140, 28, 63,  0,  0,  0,  0, 91,204, 76, 61,220, 98, 19, 63,  0,  0,  0,  0,166,139,130, 61,145,140, 28, 63,  0,  0,  0,  0,
+  1,122,156, 61,254, 29, 19, 63,  0,  0,  0,  0,166,139,130, 61,145,140, 28, 63,  0,  0,  0,  0, 91,204, 76, 61,220, 98, 19, 63,
+  0,  0,  0,  0, 91,204, 76, 61,220, 98, 19, 63,  0,  0,  0,  0, 13,129, 20, 61,143,140, 28, 63,  0,  0,  0,  0,174, 73,193, 60,
+253, 29, 19, 63,  0,  0,  0,  0,109,132, 23, 61,113,150,  9, 63,  0,  0,  0,  0,174, 73,193, 60,253, 29, 19, 63,  0,  0,  0,  0,
+114,207, 62, 60, 94,152,  9, 63,  0,  0,  0,  0,114,207, 62, 60, 94,152,  9, 63,  0,  0,  0,  0,176,204,204, 60, 24,252,255, 62,
+  0,  0,  0,  0,109,132, 23, 61,113,150,  9, 63,  0,  0,  0,  0,215,204, 76, 61,  0,  0,  0, 63,  0,  0,  0,  0,109,132, 23, 61,
+113,150,  9, 63,  0,  0,  0,  0,176,204,204, 60, 24,252,255, 62,  0,  0,  0,  0,176,204,204, 60, 24,252,255, 62,  0,  0,  0,  0,
+114,207, 62, 60, 94,152,  9, 63,  0,  0,  0,  0,167, 79, 11, 38,  0,  0,  0, 63,  0,  0,  0,  0,237, 83,113, 62, 79,220,187, 62,
+  0,  0,  0,  0, 63, 81,100, 62, 60, 92,210, 62,  0,  0,  0,  0,110,145, 88, 62,167,208,189, 62,  0,  0,  0,  0,110,145, 88, 62,
+167,208,189, 62,  0,  0,  0,  0, 91,133,101, 62,112,190,166, 62,  0,  0,  0,  0,237, 83,113, 62, 79,220,187, 62,  0,  0,  0,  0,
+  0,  0,128, 62,206,199,165, 62,  0,  0,  0,  0,237, 83,113, 62, 79,220,187, 62,  0,  0,  0,  0, 91,133,101, 62,112,190,166, 62,
+  0,  0,  0,  0, 91,133,101, 62,112,190,166, 62,  0,  0,  0,  0,110,145, 88, 62,167,208,189, 62,  0,  0,  0,  0,239,120, 75, 62,
+ 70,150,169, 62,  0,  0,  0,  0,144, 88, 63, 62, 46,135,193, 62,  0,  0,  0,  0,239,120, 75, 62, 70,150,169, 62,  0,  0,  0,  0,
+110,145, 88, 62,167,208,189, 62,  0,  0,  0,  0,110,145, 88, 62,167,208,189, 62,  0,  0,  0,  0,170, 88, 76, 62,187,159,213, 62,
+  0,  0,  0,  0,144, 88, 63, 62, 46,135,193, 62,  0,  0,  0,  0,179,163, 52, 62,  7,196,217, 62,  0,  0,  0,  0,144, 88, 63, 62,
+ 46,135,193, 62,  0,  0,  0,  0,170, 88, 76, 62,187,159,213, 62,  0,  0,  0,  0,170, 88, 76, 62,187,159,213, 62,  0,  0,  0,  0,
+110,145, 88, 62,167,208,189, 62,  0,  0,  0,  0, 63, 81,100, 62, 60, 92,210, 62,  0,  0,  0,  0,190, 86, 88, 62,221, 32,233, 62,
+  0,  0,  0,  0,254,204, 76, 62,  0,  0,  0, 63,  0,  0,  0,  0,251,223, 64, 62, 67,207,236, 62,  0,  0,  0,  0,251,223, 64, 62,
+ 67,207,236, 62,  0,  0,  0,  0,170, 88, 76, 62,187,159,213, 62,  0,  0,  0,  0,190, 86, 88, 62,221, 32,233, 62,  0,  0,  0,  0,
+ 63, 81,100, 62, 60, 92,210, 62,  0,  0,  0,  0,190, 86, 88, 62,221, 32,233, 62,  0,  0,  0,  0,170, 88, 76, 62,187,159,213, 62,
+  0,  0,  0,  0,170, 88, 76, 62,187,159,213, 62,  0,  0,  0,  0,251,223, 64, 62, 67,207,236, 62,  0,  0,  0,  0,179,163, 52, 62,
+  7,196,217, 62,  0,  0,  0,  0,144, 88, 63, 62, 46,135,193, 62,  0,  0,  0,  0,179,163, 52, 62,  7,196,217, 62,  0,  0,  0,  0,
+153,172, 39, 62,230,230,198, 62,  0,  0,  0,  0,153,172, 39, 62,230,230,198, 62,  0,  0,  0,  0,213, 14, 50, 62, 78, 54,174, 62,
+  0,  0,  0,  0,144, 88, 63, 62, 46,135,193, 62,  0,  0,  0,  0,239,120, 75, 62, 70,150,169, 62,  0,  0,  0,  0,144, 88, 63, 62,
+ 46,135,193, 62,  0,  0,  0,  0,213, 14, 50, 62, 78, 54,174, 62,  0,  0,  0,  0,213, 14, 50, 62, 78, 54,174, 62,  0,  0,  0,  0,
+153,172, 39, 62,230,230,198, 62,  0,  0,  0,  0,214,153, 25, 62,165,111,180, 62,  0,  0,  0,  0,190, 86, 88, 62,221, 32,233, 62,
+  0,  0,  0,  0, 63, 81,100, 62, 60, 92,210, 62,  0,  0,  0,  0,166,114,114, 62, 63, 23,233, 62,  0,  0,  0,  0,166,114,114, 62,
+ 63, 23,233, 62,  0,  0,  0,  0,126,102,102, 62, 25,252,255, 62,  0,  0,  0,  0,190, 86, 88, 62,221, 32,233, 62,  0,  0,  0,  0,
+254,204, 76, 62,  0,  0,  0, 63,  0,  0,  0,  0,190, 86, 88, 62,221, 32,233, 62,  0,  0,  0,  0,126,102,102, 62, 25,252,255, 62,
+  0,  0,  0,  0,126,102,102, 62, 25,252,255, 62,  0,  0,  0,  0,166,114,114, 62, 63, 23,233, 62,  0,  0,  0,  0,  0,  0,128, 62,
+  0,  0,  0, 63,  0,  0,  0,  0,173,198,134, 62, 63, 23,233, 62,  0,  0,  0,  0,  0,  0,128, 62,  0,  0,  0, 63,  0,  0,  0,  0,
+166,114,114, 62, 63, 23,233, 62,  0,  0,  0,  0,166,114,114, 62, 63, 23,233, 62,  0,  0,  0,  0,  0,  0,128, 62,149,190,209, 62,
+  0,  0,  0,  0,173,198,134, 62, 63, 23,233, 62,  0,  0,  0,  0, 97,215,141, 62, 60, 92,210, 62,  0,  0,  0,  0,173,198,134, 62,
+ 63, 23,233, 62,  0,  0,  0,  0,  0,  0,128, 62,149,190,209, 62,  0,  0,  0,  0,  0,  0,128, 62,149,190,209, 62,  0,  0,  0,  0,
+166,114,114, 62, 63, 23,233, 62,  0,  0,  0,  0, 63, 81,100, 62, 60, 92,210, 62,  0,  0,  0,  0,237, 83,113, 62, 79,220,187, 62,
+  0,  0,  0,  0,  0,  0,128, 62,206,199,165, 62,  0,  0,  0,  0,  9, 86,135, 62, 79,220,187, 62,  0,  0,  0,  0,  9, 86,135, 62,
+ 79,220,187, 62,  0,  0,  0,  0,  0,  0,128, 62,149,190,209, 62,  0,  0,  0,  0,237, 83,113, 62, 79,220,187, 62,  0,  0,  0,  0,
+ 63, 81,100, 62, 60, 92,210, 62,  0,  0,  0,  0,237, 83,113, 62, 79,220,187, 62,  0,  0,  0,  0,  0,  0,128, 62,149,190,209, 62,
+  0,  0,  0,  0,  0,  0,128, 62,149,190,209, 62,  0,  0,  0,  0,  9, 86,135, 62, 79,220,187, 62,  0,  0,  0,  0, 97,215,141, 62,
+ 60, 92,210, 62,  0,  0,  0,  0,173,198,134, 62, 63, 23,233, 62,  0,  0,  0,  0, 97,215,141, 62, 60, 92,210, 62,  0,  0,  0,  0,
+161,212,147, 62,221, 32,233, 62,  0,  0,  0,  0,161,212,147, 62,221, 32,233, 62,  0,  0,  0,  0,193,204,140, 62, 25,252,255, 62,
+  0,  0,  0,  0,173,198,134, 62, 63, 23,233, 62,  0,  0,  0,  0,  0,  0,128, 62,  0,  0,  0, 63,  0,  0,  0,  0,173,198,134, 62,
+ 63, 23,233, 62,  0,  0,  0,  0,193,204,140, 62, 25,252,255, 62,  0,  0,  0,  0,193,204,140, 62, 25,252,255, 62,  0,  0,  0,  0,
+161,212,147, 62,221, 32,233, 62,  0,  0,  0,  0,129,153,153, 62,  0,  0,  0, 63,  0,  0,  0,  0,180, 41,172, 62,227,230,198, 62,
+  0,  0,  0,  0, 39,174,165, 62,  7,196,217, 62,  0,  0,  0,  0,184, 83,160, 62, 46,135,193, 62,  0,  0,  0,  0,184, 83,160, 62,
+ 46,135,193, 62,  0,  0,  0,  0,150,248,166, 62, 78, 54,174, 62,  0,  0,  0,  0,180, 41,172, 62,227,230,198, 62,  0,  0,  0,  0,
+ 21, 51,179, 62,165,111,180, 62,  0,  0,  0,  0,180, 41,172, 62,227,230,198, 62,  0,  0,  0,  0,150,248,166, 62, 78, 54,174, 62,
+  0,  0,  0,  0,150,248,166, 62, 78, 54,174, 62,  0,  0,  0,  0,184, 83,160, 62, 46,135,193, 62,  0,  0,  0,  0,137, 67,154, 62,
+ 70,150,169, 62,  0,  0,  0,  0, 73,183,147, 62,167,208,189, 62,  0,  0,  0,  0,137, 67,154, 62, 70,150,169, 62,  0,  0,  0,  0,
+184, 83,160, 62, 46,135,193, 62,  0,  0,  0,  0,184, 83,160, 62, 46,135,193, 62,  0,  0,  0,  0,171,211,153, 62,187,159,213, 62,
+  0,  0,  0,  0, 73,183,147, 62,167,208,189, 62,  0,  0,  0,  0, 97,215,141, 62, 60, 92,210, 62,  0,  0,  0,  0, 73,183,147, 62,
+167,208,189, 62,  0,  0,  0,  0,171,211,153, 62,187,159,213, 62,  0,  0,  0,  0,171,211,153, 62,187,159,213, 62,  0,  0,  0,  0,
+184, 83,160, 62, 46,135,193, 62,  0,  0,  0,  0, 39,174,165, 62,  7,196,217, 62,  0,  0,  0,  0,  3,144,159, 62, 67,207,236, 62,
+  0,  0,  0,  0,129,153,153, 62,  0,  0,  0, 63,  0,  0,  0,  0,161,212,147, 62,221, 32,233, 62,  0,  0,  0,  0,161,212,147, 62,
+221, 32,233, 62,  0,  0,  0,  0,171,211,153, 62,187,159,213, 62,  0,  0,  0,  0,  3,144,159, 62, 67,207,236, 62,  0,  0,  0,  0,
+ 39,174,165, 62,  7,196,217, 62,  0,  0,  0,  0,  3,144,159, 62, 67,207,236, 62,  0,  0,  0,  0,171,211,153, 62,187,159,213, 62,
+  0,  0,  0,  0,171,211,153, 62,187,159,213, 62,  0,  0,  0,  0,161,212,147, 62,221, 32,233, 62,  0,  0,  0,  0, 97,215,141, 62,
+ 60, 92,210, 62,  0,  0,  0,  0, 73,183,147, 62,167,208,189, 62,  0,  0,  0,  0, 97,215,141, 62, 60, 92,210, 62,  0,  0,  0,  0,
+  9, 86,135, 62, 79,220,187, 62,  0,  0,  0,  0,  9, 86,135, 62, 79,220,187, 62,  0,  0,  0,  0, 82, 61,141, 62,112,190,166, 62,
+  0,  0,  0,  0, 73,183,147, 62,167,208,189, 62,  0,  0,  0,  0,137, 67,154, 62, 70,150,169, 62,  0,  0,  0,  0, 73,183,147, 62,
+167,208,189, 62,  0,  0,  0,  0, 82, 61,141, 62,112,190,166, 62,  0,  0,  0,  0, 82, 61,141, 62,112,190,166, 62,  0,  0,  0,  0,
+  9, 86,135, 62, 79,220,187, 62,  0,  0,  0,  0,  0,  0,128, 62,206,199,165, 62,  0,  0,  0,  0,  1,163,147, 62, 91,152,  9, 63,
+  0,  0,  0,  0,224,132,141, 62,246, 29, 19, 63,  0,  0,  0,  0,251,168,134, 62,107,150,  9, 63,  0,  0,  0,  0,251,168,134, 62,
+107,150,  9, 63,  0,  0,  0,  0,193,204,140, 62, 25,252,255, 62,  0,  0,  0,  0,  1,163,147, 62, 91,152,  9, 63,  0,  0,  0,  0,
+129,153,153, 62,  0,  0,  0, 63,  0,  0,  0,  0,  1,163,147, 62, 91,152,  9, 63,  0,  0,  0,  0,193,204,140, 62, 25,252,255, 62,
+  0,  0,  0,  0,193,204,140, 62, 25,252,255, 62,  0,  0,  0,  0,251,168,134, 62,107,150,  9, 63,  0,  0,  0,  0,  0,  0,128, 62,
+  0,  0,  0, 63,  0,  0,  0,  0, 11,174,114, 62,107,150,  9, 63,  0,  0,  0,  0,  0,  0,128, 62,  0,  0,  0, 63,  0,  0,  0,  0,
+251,168,134, 62,107,150,  9, 63,  0,  0,  0,  0,251,168,134, 62,107,150,  9, 63,  0,  0,  0,  0,  0,  0,128, 62,209, 98, 19, 63,
+  0,  0,  0,  0, 11,174,114, 62,107,150,  9, 63,  0,  0,  0,  0, 64,246,100, 62,246, 29, 19, 63,  0,  0,  0,  0, 11,174,114, 62,
+107,150,  9, 63,  0,  0,  0,  0,  0,  0,128, 62,209, 98, 19, 63,  0,  0,  0,  0,  0,  0,128, 62,209, 98, 19, 63,  0,  0,  0,  0,
+251,168,134, 62,107,150,  9, 63,  0,  0,  0,  0,224,132,141, 62,246, 29, 19, 63,  0,  0,  0,  0, 86,  9,135, 62,130,140, 28, 63,
+  0,  0,  0,  0,  0,  0,128, 62, 23,200, 37, 63,  0,  0,  0,  0, 83,237,113, 62,130,140, 28, 63,  0,  0,  0,  0, 83,237,113, 62,
+130,140, 28, 63,  0,  0,  0,  0,  0,  0,128, 62,209, 98, 19, 63,  0,  0,  0,  0, 86,  9,135, 62,130,140, 28, 63,  0,  0,  0,  0,
+224,132,141, 62,246, 29, 19, 63,  0,  0,  0,  0, 86,  9,135, 62,130,140, 28, 63,  0,  0,  0,  0,  0,  0,128, 62,209, 98, 19, 63,
+  0,  0,  0,  0,  0,  0,128, 62,209, 98, 19, 63,  0,  0,  0,  0, 83,237,113, 62,130,140, 28, 63,  0,  0,  0,  0, 64,246,100, 62,
+246, 29, 19, 63,  0,  0,  0,  0, 11,174,114, 62,107,150,  9, 63,  0,  0,  0,  0, 64,246,100, 62,246, 29, 19, 63,  0,  0,  0,  0,
+255,185, 88, 62, 90,152,  9, 63,  0,  0,  0,  0,255,185, 88, 62, 90,152,  9, 63,  0,  0,  0,  0,126,102,102, 62, 25,252,255, 62,
+  0,  0,  0,  0, 11,174,114, 62,107,150,  9, 63,  0,  0,  0,  0,  0,  0,128, 62,  0,  0,  0, 63,  0,  0,  0,  0, 11,174,114, 62,
+107,150,  9, 63,  0,  0,  0,  0,126,102,102, 62, 25,252,255, 62,  0,  0,  0,  0,126,102,102, 62, 25,252,255, 62,  0,  0,  0,  0,
+255,185, 88, 62, 90,152,  9, 63,  0,  0,  0,  0,254,204, 76, 62,  0,  0,  0, 63,  0,  0,  0,  0, 63, 16,223, 62, 62,220,187, 62,
+  0,  0,  0,  0,233,142,216, 62, 49, 92,210, 62,  0,  0,  0,  0,248,174,210, 62,153,208,189, 62,  0,  0,  0,  0,248,174,210, 62,
+153,208,189, 62,  0,  0,  0,  0,237, 40,217, 62, 91,190,166, 62,  0,  0,  0,  0, 63, 16,223, 62, 62,220,187, 62,  0,  0,  0,  0,
+ 72,102,230, 62,183,199,165, 62,  0,  0,  0,  0, 63, 16,223, 62, 62,220,187, 62,  0,  0,  0,  0,237, 40,217, 62, 91,190,166, 62,
+  0,  0,  0,  0,237, 40,217, 62, 91,190,166, 62,  0,  0,  0,  0,248,174,210, 62,153,208,189, 62,  0,  0,  0,  0,175, 34,204, 62,
+ 54,150,169, 62,  0,  0,  0,  0,129, 18,198, 62, 37,135,193, 62,  0,  0,  0,  0,175, 34,204, 62, 54,150,169, 62,  0,  0,  0,  0,
+248,174,210, 62,153,208,189, 62,  0,  0,  0,  0,248,174,210, 62,153,208,189, 62,  0,  0,  0,  0,151,146,204, 62,180,159,213, 62,
+  0,  0,  0,  0,129, 18,198, 62, 37,135,193, 62,  0,  0,  0,  0, 21,184,192, 62,  6,196,217, 62,  0,  0,  0,  0,129, 18,198, 62,
+ 37,135,193, 62,  0,  0,  0,  0,151,146,204, 62,180,159,213, 62,  0,  0,  0,  0,151,146,204, 62,180,159,213, 62,  0,  0,  0,  0,
+248,174,210, 62,153,208,189, 62,  0,  0,  0,  0,233,142,216, 62, 49, 92,210, 62,  0,  0,  0,  0,170,145,210, 62,214, 32,233, 62,
+  0,  0,  0,  0,202,204,204, 62,  0,  0,  0, 63,  0,  0,  0,  0, 65,214,198, 62, 67,207,236, 62,  0,  0,  0,  0, 65,214,198, 62,
+ 67,207,236, 62,  0,  0,  0,  0,151,146,204, 62,180,159,213, 62,  0,  0,  0,  0,170,145,210, 62,214, 32,233, 62,  0,  0,  0,  0,
+233,142,216, 62, 49, 92,210, 62,  0,  0,  0,  0,170,145,210, 62,214, 32,233, 62,  0,  0,  0,  0,151,146,204, 62,180,159,213, 62,
+  0,  0,  0,  0,151,146,204, 62,180,159,213, 62,  0,  0,  0,  0, 65,214,198, 62, 67,207,236, 62,  0,  0,  0,  0, 21,184,192, 62,
+  6,196,217, 62,  0,  0,  0,  0,129, 18,198, 62, 37,135,193, 62,  0,  0,  0,  0, 21,184,192, 62,  6,196,217, 62,  0,  0,  0,  0,
+127, 60,186, 62,225,230,198, 62,  0,  0,  0,  0,127, 60,186, 62,225,230,198, 62,  0,  0,  0,  0,154,109,191, 62, 68, 54,174, 62,
+  0,  0,  0,  0,129, 18,198, 62, 37,135,193, 62,  0,  0,  0,  0,175, 34,204, 62, 54,150,169, 62,  0,  0,  0,  0,129, 18,198, 62,
+ 37,135,193, 62,  0,  0,  0,  0,154,109,191, 62, 68, 54,174, 62,  0,  0,  0,  0,154,109,191, 62, 68, 54,174, 62,  0,  0,  0,  0,
+127, 60,186, 62,225,230,198, 62,  0,  0,  0,  0, 21, 51,179, 62,165,111,180, 62,  0,  0,  0,  0,170,145,210, 62,214, 32,233, 62,
+  0,  0,  0,  0,233,142,216, 62, 49, 92,210, 62,  0,  0,  0,  0,171,159,223, 62, 57, 23,233, 62,  0,  0,  0,  0,171,159,223, 62,
+ 57, 23,233, 62,  0,  0,  0,  0,154,153,217, 62, 24,252,255, 62,  0,  0,  0,  0,170,145,210, 62,214, 32,233, 62,  0,  0,  0,  0,
+202,204,204, 62,  0,  0,  0, 63,  0,  0,  0,  0,170,145,210, 62,214, 32,233, 62,  0,  0,  0,  0,154,153,217, 62, 24,252,255, 62,
+  0,  0,  0,  0,154,153,217, 62, 24,252,255, 62,  0,  0,  0,  0,171,159,223, 62, 57, 23,233, 62,  0,  0,  0,  0,101,102,230, 62,
+  0,  0,  0, 63,  0,  0,  0,  0, 20, 45,237, 62, 55, 23,233, 62,  0,  0,  0,  0,101,102,230, 62,  0,  0,  0, 63,  0,  0,  0,  0,
+171,159,223, 62, 57, 23,233, 62,  0,  0,  0,  0,171,159,223, 62, 57, 23,233, 62,  0,  0,  0,  0, 88,102,230, 62,135,190,209, 62,
+  0,  0,  0,  0, 20, 45,237, 62, 55, 23,233, 62,  0,  0,  0,  0,199, 61,244, 62, 46, 92,210, 62,  0,  0,  0,  0, 20, 45,237, 62,
+ 55, 23,233, 62,  0,  0,  0,  0, 88,102,230, 62,135,190,209, 62,  0,  0,  0,  0, 88,102,230, 62,135,190,209, 62,  0,  0,  0,  0,
+171,159,223, 62, 57, 23,233, 62,  0,  0,  0,  0,233,142,216, 62, 49, 92,210, 62,  0,  0,  0,  0, 63, 16,223, 62, 62,220,187, 62,
+  0,  0,  0,  0, 72,102,230, 62,183,199,165, 62,  0,  0,  0,  0, 99,188,237, 62, 60,220,187, 62,  0,  0,  0,  0, 99,188,237, 62,
+ 60,220,187, 62,  0,  0,  0,  0, 88,102,230, 62,135,190,209, 62,  0,  0,  0,  0, 63, 16,223, 62, 62,220,187, 62,  0,  0,  0,  0,
+233,142,216, 62, 49, 92,210, 62,  0,  0,  0,  0, 63, 16,223, 62, 62,220,187, 62,  0,  0,  0,  0, 88,102,230, 62,135,190,209, 62,
+  0,  0,  0,  0, 88,102,230, 62,135,190,209, 62,  0,  0,  0,  0, 99,188,237, 62, 60,220,187, 62,  0,  0,  0,  0,199, 61,244, 62,
+ 46, 92,210, 62,  0,  0,  0,  0, 20, 45,237, 62, 55, 23,233, 62,  0,  0,  0,  0,199, 61,244, 62, 46, 92,210, 62,  0,  0,  0,  0,
+ 21, 59,250, 62,213, 32,233, 62,  0,  0,  0,  0, 21, 59,250, 62,213, 32,233, 62,  0,  0,  0,  0, 53, 51,243, 62, 24,252,255, 62,
+  0,  0,  0,  0, 20, 45,237, 62, 55, 23,233, 62,  0,  0,  0,  0,101,102,230, 62,  0,  0,  0, 63,  0,  0,  0,  0, 20, 45,237, 62,
+ 55, 23,233, 62,  0,  0,  0,  0, 53, 51,243, 62, 24,252,255, 62,  0,  0,  0,  0, 53, 51,243, 62, 24,252,255, 62,  0,  0,  0,  0,
+ 21, 59,250, 62,213, 32,233, 62,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0,  0, 17, 72,  9, 63,227,230,198, 62,
+  0,  0,  0,  0, 77, 10,  6, 63,  6,196,217, 62,  0,  0,  0,  0, 15, 93,  3, 63, 36,135,193, 62,  0,  0,  0,  0, 15, 93,  3, 63,
+ 36,135,193, 62,  0,  0,  0,  0,123,175,  6, 63, 65, 54,174, 62,  0,  0,  0,  0, 17, 72,  9, 63,227,230,198, 62,  0,  0,  0,  0,
+191,204, 12, 63,160,111,180, 62,  0,  0,  0,  0, 17, 72,  9, 63,227,230,198, 62,  0,  0,  0,  0,123,175,  6, 63, 65, 54,174, 62,
+  0,  0,  0,  0,123,175,  6, 63, 65, 54,174, 62,  0,  0,  0,  0, 15, 93,  3, 63, 36,135,193, 62,  0,  0,  0,  0,241, 84,  0, 63,
+ 52,150,169, 62,  0,  0,  0,  0,169, 29,250, 62,150,208,189, 62,  0,  0,  0,  0,241, 84,  0, 63, 52,150,169, 62,  0,  0,  0,  0,
+ 15, 93,  3, 63, 36,135,193, 62,  0,  0,  0,  0, 15, 93,  3, 63, 36,135,193, 62,  0,  0,  0,  0, 12, 29,  0, 63,179,159,213, 62,
+  0,  0,  0,  0,169, 29,250, 62,150,208,189, 62,  0,  0,  0,  0,199, 61,244, 62, 46, 92,210, 62,  0,  0,  0,  0,169, 29,250, 62,
+150,208,189, 62,  0,  0,  0,  0, 12, 29,  0, 63,179,159,213, 62,  0,  0,  0,  0, 12, 29,  0, 63,179,159,213, 62,  0,  0,  0,  0,
+ 15, 93,  3, 63, 36,135,193, 62,  0,  0,  0,  0, 77, 10,  6, 63,  6,196,217, 62,  0,  0,  0,  0, 62,251,  2, 63, 67,207,236, 62,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0,  0, 21, 59,250, 62,213, 32,233, 62,  0,  0,  0,  0, 21, 59,250, 62,
+213, 32,233, 62,  0,  0,  0,  0, 12, 29,  0, 63,179,159,213, 62,  0,  0,  0,  0, 62,251,  2, 63, 67,207,236, 62,  0,  0,  0,  0,
+ 77, 10,  6, 63,  6,196,217, 62,  0,  0,  0,  0, 62,251,  2, 63, 67,207,236, 62,  0,  0,  0,  0, 12, 29,  0, 63,179,159,213, 62,
+  0,  0,  0,  0, 12, 29,  0, 63,179,159,213, 62,  0,  0,  0,  0, 21, 59,250, 62,213, 32,233, 62,  0,  0,  0,  0,199, 61,244, 62,
+ 46, 92,210, 62,  0,  0,  0,  0,169, 29,250, 62,150,208,189, 62,  0,  0,  0,  0,199, 61,244, 62, 46, 92,210, 62,  0,  0,  0,  0,
+ 99,188,237, 62, 60,220,187, 62,  0,  0,  0,  0, 99,188,237, 62, 60,220,187, 62,  0,  0,  0,  0,164,163,243, 62, 89,190,166, 62,
+  0,  0,  0,  0,169, 29,250, 62,150,208,189, 62,  0,  0,  0,  0,241, 84,  0, 63, 52,150,169, 62,  0,  0,  0,  0,169, 29,250, 62,
+150,208,189, 62,  0,  0,  0,  0,164,163,243, 62, 89,190,166, 62,  0,  0,  0,  0,164,163,243, 62, 89,190,166, 62,  0,  0,  0,  0,
+ 99,188,237, 62, 60,220,187, 62,  0,  0,  0,  0, 72,102,230, 62,183,199,165, 62,  0,  0,  0,  0,132,  9,250, 62, 94,152,  9, 63,
+  0,  0,  0,  0,101,235,243, 62,252, 29, 19, 63,  0,  0,  0,  0,114, 15,237, 62,113,150,  9, 63,  0,  0,  0,  0,114, 15,237, 62,
+113,150,  9, 63,  0,  0,  0,  0, 53, 51,243, 62, 24,252,255, 62,  0,  0,  0,  0,132,  9,250, 62, 94,152,  9, 63,  0,  0,  0,  0,
+  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0,  0,132,  9,250, 62, 94,152,  9, 63,  0,  0,  0,  0, 53, 51,243, 62, 24,252,255, 62,
+  0,  0,  0,  0, 53, 51,243, 62, 24,252,255, 62,  0,  0,  0,  0,114, 15,237, 62,113,150,  9, 63,  0,  0,  0,  0,101,102,230, 62,
+  0,  0,  0, 63,  0,  0,  0,  0,103,189,223, 62,112,150,  9, 63,  0,  0,  0,  0,101,102,230, 62,  0,  0,  0, 63,  0,  0,  0,  0,
+114, 15,237, 62,113,150,  9, 63,  0,  0,  0,  0,114, 15,237, 62,113,150,  9, 63,  0,  0,  0,  0,117,102,230, 62,220, 98, 19, 63,
+  0,  0,  0,  0,103,189,223, 62,112,150,  9, 63,  0,  0,  0,  0,128,225,216, 62,254, 29, 19, 63,  0,  0,  0,  0,103,189,223, 62,
+112,150,  9, 63,  0,  0,  0,  0,117,102,230, 62,220, 98, 19, 63,  0,  0,  0,  0,117,102,230, 62,220, 98, 19, 63,  0,  0,  0,  0,
+114, 15,237, 62,113,150,  9, 63,  0,  0,  0,  0,101,235,243, 62,252, 29, 19, 63,  0,  0,  0,  0,222,111,237, 62,143,140, 28, 63,
+  0,  0,  0,  0,129,102,230, 62, 48,200, 37, 63,  0,  0,  0,  0, 22, 93,223, 62,145,140, 28, 63,  0,  0,  0,  0, 22, 93,223, 62,
+145,140, 28, 63,  0,  0,  0,  0,117,102,230, 62,220, 98, 19, 63,  0,  0,  0,  0,222,111,237, 62,143,140, 28, 63,  0,  0,  0,  0,
+101,235,243, 62,252, 29, 19, 63,  0,  0,  0,  0,222,111,237, 62,143,140, 28, 63,  0,  0,  0,  0,117,102,230, 62,220, 98, 19, 63,
+  0,  0,  0,  0,117,102,230, 62,220, 98, 19, 63,  0,  0,  0,  0, 22, 93,223, 62,145,140, 28, 63,  0,  0,  0,  0,128,225,216, 62,
+254, 29, 19, 63,  0,  0,  0,  0,103,189,223, 62,112,150,  9, 63,  0,  0,  0,  0,128,225,216, 62,254, 29, 19, 63,  0,  0,  0,  0,
+ 85,195,210, 62, 96,152,  9, 63,  0,  0,  0,  0, 85,195,210, 62, 96,152,  9, 63,  0,  0,  0,  0,154,153,217, 62, 24,252,255, 62,
+  0,  0,  0,  0,103,189,223, 62,112,150,  9, 63,  0,  0,  0,  0,101,102,230, 62,  0,  0,  0, 63,  0,  0,  0,  0,103,189,223, 62,
+112,150,  9, 63,  0,  0,  0,  0,154,153,217, 62, 24,252,255, 62,  0,  0,  0,  0,154,153,217, 62, 24,252,255, 62,  0,  0,  0,  0,
+ 85,195,210, 62, 96,152,  9, 63,  0,  0,  0,  0,202,204,204, 62,  0,  0,  0, 63,  0,  0,  0,  0, 97,187, 34, 63, 72,220,187, 62,
+  0,  0,  0,  0,178,122, 31, 63, 55, 92,210, 62,  0,  0,  0,  0,186,138, 28, 63,155,208,189, 62,  0,  0,  0,  0,186,138, 28, 63,
+155,208,189, 62,  0,  0,  0,  0,185,199, 31, 63, 96,190,166, 62,  0,  0,  0,  0, 97,187, 34, 63, 72,220,187, 62,  0,  0,  0,  0,
+107,102, 38, 63,201,199,165, 62,  0,  0,  0,  0, 97,187, 34, 63, 72,220,187, 62,  0,  0,  0,  0,185,199, 31, 63, 96,190,166, 62,
+  0,  0,  0,  0,185,199, 31, 63, 96,190,166, 62,  0,  0,  0,  0,186,138, 28, 63,155,208,189, 62,  0,  0,  0,  0,150, 68, 25, 63,
+ 54,150,169, 62,  0,  0,  0,  0,123, 60, 22, 63, 36,135,193, 62,  0,  0,  0,  0,150, 68, 25, 63, 54,150,169, 62,  0,  0,  0,  0,
+186,138, 28, 63,155,208,189, 62,  0,  0,  0,  0,186,138, 28, 63,155,208,189, 62,  0,  0,  0,  0,133,124, 25, 63,181,159,213, 62,
+  0,  0,  0,  0,123, 60, 22, 63, 36,135,193, 62,  0,  0,  0,  0, 64,143, 19, 63,  4,196,217, 62,  0,  0,  0,  0,123, 60, 22, 63,
+ 36,135,193, 62,  0,  0,  0,  0,133,124, 25, 63,181,159,213, 62,  0,  0,  0,  0,133,124, 25, 63,181,159,213, 62,  0,  0,  0,  0,
+186,138, 28, 63,155,208,189, 62,  0,  0,  0,  0,178,122, 31, 63, 55, 92,210, 62,  0,  0,  0,  0, 14,124, 28, 63,218, 32,233, 62,
+  0,  0,  0,  0,155,153, 25, 63,  0,  0,  0, 63,  0,  0,  0,  0, 86,158, 22, 63, 65,207,236, 62,  0,  0,  0,  0, 86,158, 22, 63,
+ 65,207,236, 62,  0,  0,  0,  0,133,124, 25, 63,181,159,213, 62,  0,  0,  0,  0, 14,124, 28, 63,218, 32,233, 62,  0,  0,  0,  0,
+178,122, 31, 63, 55, 92,210, 62,  0,  0,  0,  0, 14,124, 28, 63,218, 32,233, 62,  0,  0,  0,  0,133,124, 25, 63,181,159,213, 62,
+  0,  0,  0,  0,133,124, 25, 63,181,159,213, 62,  0,  0,  0,  0, 86,158, 22, 63, 65,207,236, 62,  0,  0,  0,  0, 64,143, 19, 63,
+  4,196,217, 62,  0,  0,  0,  0,123, 60, 22, 63, 36,135,193, 62,  0,  0,  0,  0, 64,143, 19, 63,  4,196,217, 62,  0,  0,  0,  0,
+117, 81, 16, 63,223,230,198, 62,  0,  0,  0,  0,117, 81, 16, 63,223,230,198, 62,  0,  0,  0,  0,  7,234, 18, 63, 65, 54,174, 62,
+  0,  0,  0,  0,123, 60, 22, 63, 36,135,193, 62,  0,  0,  0,  0,150, 68, 25, 63, 54,150,169, 62,  0,  0,  0,  0,123, 60, 22, 63,
+ 36,135,193, 62,  0,  0,  0,  0,  7,234, 18, 63, 65, 54,174, 62,  0,  0,  0,  0,  7,234, 18, 63, 65, 54,174, 62,  0,  0,  0,  0,
+117, 81, 16, 63,223,230,198, 62,  0,  0,  0,  0,191,204, 12, 63,160,111,180, 62,  0,  0,  0,  0, 14,124, 28, 63,218, 32,233, 62,
+  0,  0,  0,  0,178,122, 31, 63, 55, 92,210, 62,  0,  0,  0,  0, 17,  3, 35, 63, 58, 23,233, 62,  0,  0,  0,  0, 17,  3, 35, 63,
+ 58, 23,233, 62,  0,  0,  0,  0,  2,  0, 32, 63, 24,252,255, 62,  0,  0,  0,  0, 14,124, 28, 63,218, 32,233, 62,  0,  0,  0,  0,
+155,153, 25, 63,  0,  0,  0, 63,  0,  0,  0,  0, 14,124, 28, 63,218, 32,233, 62,  0,  0,  0,  0,  2,  0, 32, 63, 24,252,255, 62,
+  0,  0,  0,  0,  2,  0, 32, 63, 24,252,255, 62,  0,  0,  0,  0, 17,  3, 35, 63, 58, 23,233, 62,  0,  0,  0,  0,109,102, 38, 63,
+  0,  0,  0, 63,  0,  0,  0,  0,200,201, 41, 63, 58, 23,233, 62,  0,  0,  0,  0,109,102, 38, 63,  0,  0,  0, 63,  0,  0,  0,  0,
+ 17,  3, 35, 63, 58, 23,233, 62,  0,  0,  0,  0, 17,  3, 35, 63, 58, 23,233, 62,  0,  0,  0,  0,109,102, 38, 63,143,190,209, 62,
+  0,  0,  0,  0,200,201, 41, 63, 58, 23,233, 62,  0,  0,  0,  0, 38, 82, 45, 63, 55, 92,210, 62,  0,  0,  0,  0,200,201, 41, 63,
+ 58, 23,233, 62,  0,  0,  0,  0,109,102, 38, 63,143,190,209, 62,  0,  0,  0,  0,109,102, 38, 63,143,190,209, 62,  0,  0,  0,  0,
+ 17,  3, 35, 63, 58, 23,233, 62,  0,  0,  0,  0,178,122, 31, 63, 55, 92,210, 62,  0,  0,  0,  0, 97,187, 34, 63, 72,220,187, 62,
+  0,  0,  0,  0,107,102, 38, 63,201,199,165, 62,  0,  0,  0,  0,118, 17, 42, 63, 72,220,187, 62,  0,  0,  0,  0,118, 17, 42, 63,
+ 72,220,187, 62,  0,  0,  0,  0,109,102, 38, 63,143,190,209, 62,  0,  0,  0,  0, 97,187, 34, 63, 72,220,187, 62,  0,  0,  0,  0,
+178,122, 31, 63, 55, 92,210, 62,  0,  0,  0,  0, 97,187, 34, 63, 72,220,187, 62,  0,  0,  0,  0,109,102, 38, 63,143,190,209, 62,
+  0,  0,  0,  0,109,102, 38, 63,143,190,209, 62,  0,  0,  0,  0,118, 17, 42, 63, 72,220,187, 62,  0,  0,  0,  0, 38, 82, 45, 63,
+ 55, 92,210, 62,  0,  0,  0,  0,200,201, 41, 63, 58, 23,233, 62,  0,  0,  0,  0, 38, 82, 45, 63, 55, 92,210, 62,  0,  0,  0,  0,
+204, 80, 48, 63,218, 32,233, 62,  0,  0,  0,  0,204, 80, 48, 63,218, 32,233, 62,  0,  0,  0,  0,215,204, 44, 63, 23,252,255, 62,
+  0,  0,  0,  0,200,201, 41, 63, 58, 23,233, 62,  0,  0,  0,  0,109,102, 38, 63,  0,  0,  0, 63,  0,  0,  0,  0,200,201, 41, 63,
+ 58, 23,233, 62,  0,  0,  0,  0,215,204, 44, 63, 23,252,255, 62,  0,  0,  0,  0,215,204, 44, 63, 23,252,255, 62,  0,  0,  0,  0,
+204, 80, 48, 63,218, 32,233, 62,  0,  0,  0,  0, 63, 51, 51, 63,  0,  0,  0, 63,  0,  0,  0,  0, 85,123, 60, 63,253,230,198, 62,
+  0,  0,  0,  0,144, 61, 57, 63, 19,196,217, 62,  0,  0,  0,  0, 86,144, 54, 63, 68,135,193, 62,  0,  0,  0,  0, 86,144, 54, 63,
+ 68,135,193, 62,  0,  0,  0,  0,196,226, 57, 63,114, 54,174, 62,  0,  0,  0,  0, 85,123, 60, 63,253,230,198, 62,  0,  0,  0,  0,
+  0,  0, 64, 63,211,111,180, 62,  0,  0,  0,  0, 85,123, 60, 63,253,230,198, 62,  0,  0,  0,  0,196,226, 57, 63,114, 54,174, 62,
+  0,  0,  0,  0,196,226, 57, 63,114, 54,174, 62,  0,  0,  0,  0, 86,144, 54, 63, 68,135,193, 62,  0,  0,  0,  0, 58,136, 51, 63,
+ 90,150,169, 62,  0,  0,  0,  0, 27, 66, 48, 63,173,208,189, 62,  0,  0,  0,  0, 58,136, 51, 63, 90,150,169, 62,  0,  0,  0,  0,
+ 86,144, 54, 63, 68,135,193, 62,  0,  0,  0,  0, 86,144, 54, 63, 68,135,193, 62,  0,  0,  0,  0, 80, 80, 51, 63,192,159,213, 62,
+  0,  0,  0,  0, 27, 66, 48, 63,173,208,189, 62,  0,  0,  0,  0, 38, 82, 45, 63, 55, 92,210, 62,  0,  0,  0,  0, 27, 66, 48, 63,
+173,208,189, 62,  0,  0,  0,  0, 80, 80, 51, 63,192,159,213, 62,  0,  0,  0,  0, 80, 80, 51, 63,192,159,213, 62,  0,  0,  0,  0,
+ 86,144, 54, 63, 68,135,193, 62,  0,  0,  0,  0,144, 61, 57, 63, 19,196,217, 62,  0,  0,  0,  0,128, 46, 54, 63, 75,207,236, 62,
+  0,  0,  0,  0, 63, 51, 51, 63,  0,  0,  0, 63,  0,  0,  0,  0,204, 80, 48, 63,218, 32,233, 62,  0,  0,  0,  0,204, 80, 48, 63,
+218, 32,233, 62,  0,  0,  0,  0, 80, 80, 51, 63,192,159,213, 62,  0,  0,  0,  0,128, 46, 54, 63, 75,207,236, 62,  0,  0,  0,  0,
+144, 61, 57, 63, 19,196,217, 62,  0,  0,  0,  0,128, 46, 54, 63, 75,207,236, 62,  0,  0,  0,  0, 80, 80, 51, 63,192,159,213, 62,
+  0,  0,  0,  0, 80, 80, 51, 63,192,159,213, 62,  0,  0,  0,  0,204, 80, 48, 63,218, 32,233, 62,  0,  0,  0,  0, 38, 82, 45, 63,
+ 55, 92,210, 62,  0,  0,  0,  0, 27, 66, 48, 63,173,208,189, 62,  0,  0,  0,  0, 38, 82, 45, 63, 55, 92,210, 62,  0,  0,  0,  0,
+118, 17, 42, 63, 72,220,187, 62,  0,  0,  0,  0,118, 17, 42, 63, 72,220,187, 62,  0,  0,  0,  0, 26,  5, 45, 63,117,190,166, 62,
+  0,  0,  0,  0, 27, 66, 48, 63,173,208,189, 62,  0,  0,  0,  0, 58,136, 51, 63, 90,150,169, 62,  0,  0,  0,  0, 27, 66, 48, 63,
+173,208,189, 62,  0,  0,  0,  0, 26,  5, 45, 63,117,190,166, 62,  0,  0,  0,  0, 26,  5, 45, 63,117,190,166, 62,  0,  0,  0,  0,
+118, 17, 42, 63, 72,220,187, 62,  0,  0,  0,  0,107,102, 38, 63,201,199,165, 62,  0,  0,  0,  0,255, 55, 48, 63, 94,152,  9, 63,
+  0,  0,  0,  0,237, 40, 45, 63,252, 29, 19, 63,  0,  0,  0,  0,242,186, 41, 63,112,150,  9, 63,  0,  0,  0,  0,242,186, 41, 63,
+112,150,  9, 63,  0,  0,  0,  0,215,204, 44, 63, 23,252,255, 62,  0,  0,  0,  0,255, 55, 48, 63, 94,152,  9, 63,  0,  0,  0,  0,
+ 63, 51, 51, 63,  0,  0,  0, 63,  0,  0,  0,  0,255, 55, 48, 63, 94,152,  9, 63,  0,  0,  0,  0,215,204, 44, 63, 23,252,255, 62,
+  0,  0,  0,  0,215,204, 44, 63, 23,252,255, 62,  0,  0,  0,  0,242,186, 41, 63,112,150,  9, 63,  0,  0,  0,  0,109,102, 38, 63,
+  0,  0,  0, 63,  0,  0,  0,  0,235, 17, 35, 63,112,150,  9, 63,  0,  0,  0,  0,109,102, 38, 63,  0,  0,  0, 63,  0,  0,  0,  0,
+242,186, 41, 63,112,150,  9, 63,  0,  0,  0,  0,242,186, 41, 63,112,150,  9, 63,  0,  0,  0,  0,113,102, 38, 63,219, 98, 19, 63,
+  0,  0,  0,  0,235, 17, 35, 63,112,150,  9, 63,  0,  0,  0,  0,245,163, 31, 63,253, 29, 19, 63,  0,  0,  0,  0,235, 17, 35, 63,
+112,150,  9, 63,  0,  0,  0,  0,113,102, 38, 63,219, 98, 19, 63,  0,  0,  0,  0,113,102, 38, 63,219, 98, 19, 63,  0,  0,  0,  0,
+242,186, 41, 63,112,150,  9, 63,  0,  0,  0,  0,237, 40, 45, 63,252, 29, 19, 63,  0,  0,  0,  0, 38,235, 41, 63,141,140, 28, 63,
+  0,  0,  0,  0,117,102, 38, 63, 45,200, 37, 63,  0,  0,  0,  0,192,225, 34, 63,142,140, 28, 63,  0,  0,  0,  0,192,225, 34, 63,
+142,140, 28, 63,  0,  0,  0,  0,113,102, 38, 63,219, 98, 19, 63,  0,  0,  0,  0, 38,235, 41, 63,141,140, 28, 63,  0,  0,  0,  0,
+237, 40, 45, 63,252, 29, 19, 63,  0,  0,  0,  0, 38,235, 41, 63,141,140, 28, 63,  0,  0,  0,  0,113,102, 38, 63,219, 98, 19, 63,
+  0,  0,  0,  0,113,102, 38, 63,219, 98, 19, 63,  0,  0,  0,  0,192,225, 34, 63,142,140, 28, 63,  0,  0,  0,  0,245,163, 31, 63,
+253, 29, 19, 63,  0,  0,  0,  0,235, 17, 35, 63,112,150,  9, 63,  0,  0,  0,  0,245,163, 31, 63,253, 29, 19, 63,  0,  0,  0,  0,
+223,148, 28, 63, 94,152,  9, 63,  0,  0,  0,  0,223,148, 28, 63, 94,152,  9, 63,  0,  0,  0,  0,  2,  0, 32, 63, 24,252,255, 62,
+  0,  0,  0,  0,235, 17, 35, 63,112,150,  9, 63,  0,  0,  0,  0,109,102, 38, 63,  0,  0,  0, 63,  0,  0,  0,  0,235, 17, 35, 63,
+112,150,  9, 63,  0,  0,  0,  0,  2,  0, 32, 63, 24,252,255, 62,  0,  0,  0,  0,  2,  0, 32, 63, 24,252,255, 62,  0,  0,  0,  0,
+223,148, 28, 63, 94,152,  9, 63,  0,  0,  0,  0,155,153, 25, 63,  0,  0,  0, 63,  0,  0,  0,  0,188,129,107, 63, 66, 45,128, 62,
+  0,  0,  0,  0,235, 71, 99, 63,222, 76,120, 62,  0,  0,  0,  0, 94, 37,106, 63, 84, 97, 83, 62,  0,  0,  0,  0, 94, 37,106, 63,
+ 84, 97, 83, 62,  0,  0,  0,  0, 65, 51,115, 63,248,151, 97, 62,  0,  0,  0,  0,188,129,107, 63, 66, 45,128, 62,  0,  0,  0,  0,
+ 65, 51,115, 63,151, 83,135, 62,  0,  0,  0,  0,188,129,107, 63, 66, 45,128, 62,  0,  0,  0,  0, 65, 51,115, 63,248,151, 97, 62,
+  0,  0,  0,  0, 65, 51,115, 63,248,151, 97, 62,  0,  0,  0,  0, 94, 37,106, 63, 84, 97, 83, 62,  0,  0,  0,  0, 65, 51,115, 63,
+ 90,111, 52, 62,  0,  0,  0,  0,188,129,107, 63, 66, 45,128, 62,  0,  0,  0,  0, 65, 51,115, 63,151, 83,135, 62,  0,  0,  0,  0,
+142,123,108, 63,169,144,151, 62,  0,  0,  0,  0,142,123,108, 63,169,144,151, 62,  0,  0,  0,  0,231, 50,101, 63, 17,201,146, 62,
+  0,  0,  0,  0,188,129,107, 63, 66, 45,128, 62,  0,  0,  0,  0,235, 71, 99, 63,222, 76,120, 62,  0,  0,  0,  0,188,129,107, 63,
+ 66, 45,128, 62,  0,  0,  0,  0,231, 50,101, 63, 17,201,146, 62,  0,  0,  0,  0,231, 50,101, 63, 17,201,146, 62,  0,  0,  0,  0,
+142,123,108, 63,169,144,151, 62,  0,  0,  0,  0,106,187,102, 63, 54,150,169, 62,  0,  0,  0,  0, 71, 56, 96, 63, 99,190,166, 62,
+  0,  0,  0,  0,149,153, 89, 63,201,199,165, 62,  0,  0,  0,  0, 22,238, 93, 63,243,101,144, 62,  0,  0,  0,  0, 22,238, 93, 63,
+243,101,144, 62,  0,  0,  0,  0,231, 50,101, 63, 17,201,146, 62,  0,  0,  0,  0, 71, 56, 96, 63, 99,190,166, 62,  0,  0,  0,  0,
+106,187,102, 63, 54,150,169, 62,  0,  0,  0,  0, 71, 56, 96, 63, 99,190,166, 62,  0,  0,  0,  0,231, 50,101, 63, 17,201,146, 62,
+  0,  0,  0,  0,231, 50,101, 63, 17,201,146, 62,  0,  0,  0,  0, 22,238, 93, 63,243,101,144, 62,  0,  0,  0,  0,235, 71, 99, 63,
+222, 76,120, 62,  0,  0,  0,  0,249, 21,109, 63, 65, 54,174, 62,  0,  0,  0,  0,106,187,102, 63, 54,150,169, 62,  0,  0,  0,  0,
+142,123,108, 63,169,144,151, 62,  0,  0,  0,  0,142,123,108, 63,169,144,151, 62,  0,  0,  0,  0, 65, 51,115, 63, 93,231,157, 62,
+  0,  0,  0,  0,249, 21,109, 63, 65, 54,174, 62,  0,  0,  0,  0, 65, 51,115, 63,160,111,180, 62,  0,  0,  0,  0,249, 21,109, 63,
+ 65, 54,174, 62,  0,  0,  0,  0, 65, 51,115, 63, 93,231,157, 62,  0,  0,  0,  0, 65, 51,115, 63, 93,231,157, 62,  0,  0,  0,  0,
+142,123,108, 63,169,144,151, 62,  0,  0,  0,  0, 65, 51,115, 63,151, 83,135, 62,  0,  0,  0,  0,149,153, 89, 63, 79,162,115, 62,
+  0,  0,  0,  0,235, 71, 99, 63,222, 76,120, 62,  0,  0,  0,  0, 22,238, 93, 63,243,101,144, 62,  0,  0,  0,  0, 22,238, 93, 63,
+243,101,144, 62,  0,  0,  0,  0, 21, 69, 85, 63,  3,102,144, 62,  0,  0,  0,  0,149,153, 89, 63, 79,162,115, 62,  0,  0,  0,  0,
+ 68,235, 79, 63, 37, 77,120, 62,  0,  0,  0,  0,149,153, 89, 63, 79,162,115, 62,  0,  0,  0,  0, 21, 69, 85, 63,  3,102,144, 62,
+  0,  0,  0,  0, 21, 69, 85, 63,  3,102,144, 62,  0,  0,  0,  0, 22,238, 93, 63,243,101,144, 62,  0,  0,  0,  0,149,153, 89, 63,
+201,199,165, 62,  0,  0,  0,  0,149,153, 89, 63, 79,162,115, 62,  0,  0,  0,  0, 68,235, 79, 63, 37, 77,120, 62,  0,  0,  0,  0,
+ 24,186, 83, 63,245,176, 70, 62,  0,  0,  0,  0, 24,186, 83, 63,245,176, 70, 62,  0,  0,  0,  0, 22,121, 95, 63,204,176, 70, 62,
+  0,  0,  0,  0,149,153, 89, 63, 79,162,115, 62,  0,  0,  0,  0,235, 71, 99, 63,222, 76,120, 62,  0,  0,  0,  0,149,153, 89, 63,
+ 79,162,115, 62,  0,  0,  0,  0, 22,121, 95, 63,204,176, 70, 62,  0,  0,  0,  0, 22,121, 95, 63,204,176, 70, 62,  0,  0,  0,  0,
+ 24,186, 83, 63,245,176, 70, 62,  0,  0,  0,  0,152,153, 89, 63,198, 31, 23, 62,  0,  0,  0,  0, 61,119,103, 63,179,253, 30, 62,
+  0,  0,  0,  0, 65, 51,115, 63, 90,111, 52, 62,  0,  0,  0,  0, 94, 37,106, 63, 84, 97, 83, 62,  0,  0,  0,  0, 94, 37,106, 63,
+ 84, 97, 83, 62,  0,  0,  0,  0, 22,121, 95, 63,204,176, 70, 62,  0,  0,  0,  0, 61,119,103, 63,179,253, 30, 62,  0,  0,  0,  0,
+152,153, 89, 63,198, 31, 23, 62,  0,  0,  0,  0, 61,119,103, 63,179,253, 30, 62,  0,  0,  0,  0, 22,121, 95, 63,204,176, 70, 62,
+  0,  0,  0,  0, 22,121, 95, 63,204,176, 70, 62,  0,  0,  0,  0, 94, 37,106, 63, 84, 97, 83, 62,  0,  0,  0,  0,235, 71, 99, 63,
+222, 76,120, 62,  0,  0,  0,  0,248,187, 75, 63,241,253, 30, 62,  0,  0,  0,  0,152,153, 89, 63,198, 31, 23, 62,  0,  0,  0,  0,
+ 24,186, 83, 63,245,176, 70, 62,  0,  0,  0,  0, 24,186, 83, 63,245,176, 70, 62,  0,  0,  0,  0,214, 13, 73, 63,181, 97, 83, 62,
+  0,  0,  0,  0,248,187, 75, 63,241,253, 30, 62,  0,  0,  0,  0,  0,  0, 64, 63,202,111, 52, 62,  0,  0,  0,  0,248,187, 75, 63,
+241,253, 30, 62,  0,  0,  0,  0,214, 13, 73, 63,181, 97, 83, 62,  0,  0,  0,  0,214, 13, 73, 63,181, 97, 83, 62,  0,  0,  0,  0,
+ 24,186, 83, 63,245,176, 70, 62,  0,  0,  0,  0, 68,235, 79, 63, 37, 77,120, 62,  0,  0,  0,  0,152,153, 89, 63,111, 41,147, 61,
+  0,  0,  0,  0,  0,  0, 64, 63,195,111,180, 61,  0,  0,  0,  0,  0,  0, 64, 63,111, 65, 52, 61,  0,  0,  0,  0,  0,  0, 64, 63,
+111, 65, 52, 61,  0,  0,  0,  0, 38, 49,117, 63,225, 64, 52, 61,  0,  0,  0,  0,152,153, 89, 63,111, 41,147, 61,  0,  0,  0,  0,
+ 65, 51,115, 63, 83,111,180, 61,  0,  0,  0,  0,152,153, 89, 63,111, 41,147, 61,  0,  0,  0,  0, 38, 49,117, 63,225, 64, 52, 61,
+  0,  0,  0,  0, 38, 49,117, 63,225, 64, 52, 61,  0,  0,  0,  0,  0,  0, 64, 63,111, 65, 52, 61,  0,  0,  0,  0,208,222,121, 63,
+102,  9,239,178,  0,  0,  0,  0,152,153, 89, 63,111, 41,147, 61,  0,  0,  0,  0, 65, 51,115, 63, 83,111,180, 61,  0,  0,  0,  0,
+172, 51, 99, 63, 48, 46,231, 61,  0,  0,  0,  0,172, 51, 99, 63, 48, 46,231, 61,  0,  0,  0,  0,135,255, 79, 63,120, 46,231, 61,
+  0,  0,  0,  0,152,153, 89, 63,111, 41,147, 61,  0,  0,  0,  0,  0,  0, 64, 63,195,111,180, 61,  0,  0,  0,  0,152,153, 89, 63,
+111, 41,147, 61,  0,  0,  0,  0,135,255, 79, 63,120, 46,231, 61,  0,  0,  0,  0,135,255, 79, 63,120, 46,231, 61,  0,  0,  0,  0,
+172, 51, 99, 63, 48, 46,231, 61,  0,  0,  0,  0,152,153, 89, 63,198, 31, 23, 62,  0,  0,  0,  0,248,187, 75, 63,241,253, 30, 62,
+  0,  0,  0,  0,  0,  0, 64, 63,202,111, 52, 62,  0,  0,  0,  0,  0,  0, 64, 63, 24, 71,  7, 62,  0,  0,  0,  0,  0,  0, 64, 63,
+ 24, 71,  7, 62,  0,  0,  0,  0,135,255, 79, 63,120, 46,231, 61,  0,  0,  0,  0,248,187, 75, 63,241,253, 30, 62,  0,  0,  0,  0,
+152,153, 89, 63,198, 31, 23, 62,  0,  0,  0,  0,248,187, 75, 63,241,253, 30, 62,  0,  0,  0,  0,135,255, 79, 63,120, 46,231, 61,
+  0,  0,  0,  0,135,255, 79, 63,120, 46,231, 61,  0,  0,  0,  0,  0,  0, 64, 63, 24, 71,  7, 62,  0,  0,  0,  0,  0,  0, 64, 63,
+195,111,180, 61,  0,  0,  0,  0, 61,119,103, 63,179,253, 30, 62,  0,  0,  0,  0,152,153, 89, 63,198, 31, 23, 62,  0,  0,  0,  0,
+172, 51, 99, 63, 48, 46,231, 61,  0,  0,  0,  0,172, 51, 99, 63, 48, 46,231, 61,  0,  0,  0,  0, 66, 51,115, 63,199, 70,  7, 62,
+  0,  0,  0,  0, 61,119,103, 63,179,253, 30, 62,  0,  0,  0,  0, 65, 51,115, 63, 90,111, 52, 62,  0,  0,  0,  0, 61,119,103, 63,
+179,253, 30, 62,  0,  0,  0,  0, 66, 51,115, 63,199, 70,  7, 62,  0,  0,  0,  0, 66, 51,115, 63,199, 70,  7, 62,  0,  0,  0,  0,
+172, 51, 99, 63, 48, 46,231, 61,  0,  0,  0,  0, 65, 51,115, 63, 83,111,180, 61,  0,  0,  0,  0,122,177, 71, 63,120, 45,128, 62,
+  0,  0,  0,  0,  0,  0, 64, 63,218, 83,135, 62,  0,  0,  0,  0,  0,  0, 64, 63,115,152, 97, 62,  0,  0,  0,  0,  0,  0, 64, 63,
+115,152, 97, 62,  0,  0,  0,  0,214, 13, 73, 63,181, 97, 83, 62,  0,  0,  0,  0,122,177, 71, 63,120, 45,128, 62,  0,  0,  0,  0,
+ 68,235, 79, 63, 37, 77,120, 62,  0,  0,  0,  0,122,177, 71, 63,120, 45,128, 62,  0,  0,  0,  0,214, 13, 73, 63,181, 97, 83, 62,
+  0,  0,  0,  0,214, 13, 73, 63,181, 97, 83, 62,  0,  0,  0,  0,  0,  0, 64, 63,115,152, 97, 62,  0,  0,  0,  0,  0,  0, 64, 63,
+202,111, 52, 62,  0,  0,  0,  0,122,177, 71, 63,120, 45,128, 62,  0,  0,  0,  0, 68,235, 79, 63, 37, 77,120, 62,  0,  0,  0,  0,
+ 72,  0, 78, 63, 52,201,146, 62,  0,  0,  0,  0, 72,  0, 78, 63, 52,201,146, 62,  0,  0,  0,  0,169,183, 70, 63,219,144,151, 62,
+  0,  0,  0,  0,122,177, 71, 63,120, 45,128, 62,  0,  0,  0,  0,  0,  0, 64, 63,218, 83,135, 62,  0,  0,  0,  0,122,177, 71, 63,
+120, 45,128, 62,  0,  0,  0,  0,169,183, 70, 63,219,144,151, 62,  0,  0,  0,  0,169,183, 70, 63,219,144,151, 62,  0,  0,  0,  0,
+ 72,  0, 78, 63, 52,201,146, 62,  0,  0,  0,  0,198,119, 76, 63, 90,150,169, 62,  0,  0,  0,  0, 61, 29, 70, 63,114, 54,174, 62,
+  0,  0,  0,  0,  0,  0, 64, 63,211,111,180, 62,  0,  0,  0,  0,  0,  0, 64, 63,162,231,157, 62,  0,  0,  0,  0,  0,  0, 64, 63,
+162,231,157, 62,  0,  0,  0,  0,169,183, 70, 63,219,144,151, 62,  0,  0,  0,  0, 61, 29, 70, 63,114, 54,174, 62,  0,  0,  0,  0,
+198,119, 76, 63, 90,150,169, 62,  0,  0,  0,  0, 61, 29, 70, 63,114, 54,174, 62,  0,  0,  0,  0,169,183, 70, 63,219,144,151, 62,
+  0,  0,  0,  0,169,183, 70, 63,219,144,151, 62,  0,  0,  0,  0,  0,  0, 64, 63,162,231,157, 62,  0,  0,  0,  0,  0,  0, 64, 63,
+218, 83,135, 62,  0,  0,  0,  0,230,250, 82, 63,117,190,166, 62,  0,  0,  0,  0,198,119, 76, 63, 90,150,169, 62,  0,  0,  0,  0,
+ 72,  0, 78, 63, 52,201,146, 62,  0,  0,  0,  0, 72,  0, 78, 63, 52,201,146, 62,  0,  0,  0,  0, 21, 69, 85, 63,  3,102,144, 62,
+  0,  0,  0,  0,230,250, 82, 63,117,190,166, 62,  0,  0,  0,  0,149,153, 89, 63,201,199,165, 62,  0,  0,  0,  0,230,250, 82, 63,
+117,190,166, 62,  0,  0,  0,  0, 21, 69, 85, 63,  3,102,144, 62,  0,  0,  0,  0, 21, 69, 85, 63,  3,102,144, 62,  0,  0,  0,  0,
+ 72,  0, 78, 63, 52,201,146, 62,  0,  0,  0,  0, 68,235, 79, 63, 37, 77,120, 62,  0,  0,  0,  0,179,167,245, 61, 72, 45,128, 62,
+  0,  0,  0,  0, 94,217,179, 61,222, 76,120, 62,  0,  0,  0,  0,202,196,234, 61,100, 97, 83, 62,  0,  0,  0,  0,202,196,234, 61,
+100, 97, 83, 62,  0,  0,  0,  0,212,153, 25, 62,  2,152, 97, 62,  0,  0,  0,  0,179,167,245, 61, 72, 45,128, 62,  0,  0,  0,  0,
+214,153, 25, 62,156, 83,135, 62,  0,  0,  0,  0,179,167,245, 61, 72, 45,128, 62,  0,  0,  0,  0,212,153, 25, 62,  2,152, 97, 62,
+  0,  0,  0,  0,212,153, 25, 62,  2,152, 97, 62,  0,  0,  0,  0,202,196,234, 61,100, 97, 83, 62,  0,  0,  0,  0,214,153, 25, 62,
+106,111, 52, 62,  0,  0,  0,  0,179,167,245, 61, 72, 45,128, 62,  0,  0,  0,  0,214,153, 25, 62,156, 83,135, 62,  0,  0,  0,  0,
+ 62,118,253, 61,174,144,151, 62,  0,  0,  0,  0, 62,118,253, 61,174,144,151, 62,  0,  0,  0,  0, 53, 49,195, 61, 17,201,146, 62,
+  0,  0,  0,  0,179,167,245, 61, 72, 45,128, 62,  0,  0,  0,  0, 94,217,179, 61,222, 76,120, 62,  0,  0,  0,  0,179,167,245, 61,
+ 72, 45,128, 62,  0,  0,  0,  0, 53, 49,195, 61, 17,201,146, 62,  0,  0,  0,  0, 53, 49,195, 61, 17,201,146, 62,  0,  0,  0,  0,
+ 62,118,253, 61,174,144,151, 62,  0,  0,  0,  0, 70,117,207, 61, 54,150,169, 62,  0,  0,  0,  0, 79, 92,155, 61, 91,190,166, 62,
+  0,  0,  0,  0,194,205, 76, 61,186,199,165, 62,  0,  0,  0,  0,212, 10,137, 61,238,101,144, 62,  0,  0,  0,  0,212, 10,137, 61,
+238,101,144, 62,  0,  0,  0,  0, 53, 49,195, 61, 17,201,146, 62,  0,  0,  0,  0, 79, 92,155, 61, 91,190,166, 62,  0,  0,  0,  0,
+ 70,117,207, 61, 54,150,169, 62,  0,  0,  0,  0, 79, 92,155, 61, 91,190,166, 62,  0,  0,  0,  0, 53, 49,195, 61, 17,201,146, 62,
+  0,  0,  0,  0, 53, 49,195, 61, 17,201,146, 62,  0,  0,  0,  0,212, 10,137, 61,238,101,144, 62,  0,  0,  0,  0, 94,217,179, 61,
+222, 76,120, 62,  0,  0,  0,  0,204, 36,  1, 62, 70, 54,174, 62,  0,  0,  0,  0, 70,117,207, 61, 54,150,169, 62,  0,  0,  0,  0,
+ 62,118,253, 61,174,144,151, 62,  0,  0,  0,  0, 62,118,253, 61,174,144,151, 62,  0,  0,  0,  0,213,153, 25, 62,100,231,157, 62,
+  0,  0,  0,  0,204, 36,  1, 62, 70, 54,174, 62,  0,  0,  0,  0,214,153, 25, 62,165,111,180, 62,  0,  0,  0,  0,204, 36,  1, 62,
+ 70, 54,174, 62,  0,  0,  0,  0,213,153, 25, 62,100,231,157, 62,  0,  0,  0,  0,213,153, 25, 62,100,231,157, 62,  0,  0,  0,  0,
+ 62,118,253, 61,174,144,151, 62,  0,  0,  0,  0,214,153, 25, 62,156, 83,135, 62,  0,  0,  0,  0,188,205, 76, 61, 53,162,115, 62,
+  0,  0,  0,  0, 94,217,179, 61,222, 76,120, 62,  0,  0,  0,  0,212, 10,137, 61,238,101,144, 62,  0,  0,  0,  0,212, 10,137, 61,
+238,101,144, 62,  0,  0,  0,  0,207,133,  7, 61,236,101,144, 62,  0,  0,  0,  0,188,205, 76, 61, 53,162,115, 62,  0,  0,  0,  0,
+255,162, 71, 60,216, 76,120, 62,  0,  0,  0,  0,188,205, 76, 61, 53,162,115, 62,  0,  0,  0,  0,207,133,  7, 61,236,101,144, 62,
+  0,  0,  0,  0,207,133,  7, 61,236,101,144, 62,  0,  0,  0,  0,212, 10,137, 61,238,101,144, 62,  0,  0,  0,  0,194,205, 76, 61,
+186,199,165, 62,  0,  0,  0,  0,188,205, 76, 61, 53,162,115, 62,  0,  0,  0,  0,255,162, 71, 60,216, 76,120, 62,  0,  0,  0,  0,
+190,171,221, 60,194,176, 70, 62,  0,  0,  0,  0,190,171,221, 60,194,176, 70, 62,  0,  0,  0,  0,194, 98,149, 61,194,176, 70, 62,
+  0,  0,  0,  0,188,205, 76, 61, 53,162,115, 62,  0,  0,  0,  0, 94,217,179, 61,222, 76,120, 62,  0,  0,  0,  0,188,205, 76, 61,
+ 53,162,115, 62,  0,  0,  0,  0,194, 98,149, 61,194,176, 70, 62,  0,  0,  0,  0,194, 98,149, 61,194,176, 70, 62,  0,  0,  0,  0,
+190,171,221, 60,194,176, 70, 62,  0,  0,  0,  0,193,205, 76, 61,168, 31, 23, 62,  0,  0,  0,  0,198, 83,213, 61,179,253, 30, 62,
+  0,  0,  0,  0,214,153, 25, 62,106,111, 52, 62,  0,  0,  0,  0,202,196,234, 61,100, 97, 83, 62,  0,  0,  0,  0,202,196,234, 61,
+100, 97, 83, 62,  0,  0,  0,  0,194, 98,149, 61,194,176, 70, 62,  0,  0,  0,  0,198, 83,213, 61,179,253, 30, 62,  0,  0,  0,  0,
+193,205, 76, 61,168, 31, 23, 62,  0,  0,  0,  0,198, 83,213, 61,179,253, 30, 62,  0,  0,  0,  0,194, 98,149, 61,194,176, 70, 62,
+  0,  0,  0,  0,194, 98,149, 61,194,176, 70, 62,  0,  0,  0,  0,202,196,234, 61,100, 97, 83, 62,  0,  0,  0,  0, 94,217,179, 61,
+222, 76,120, 62,  0,  0,  0,  0, 59,239,126, 63,174,253, 30, 62,  0,  0,  0,  0,154,105,131, 63,168, 31, 23, 62,  0,  0,  0,  0,
+175,118,131, 63,194,176, 70, 62,  0,  0,  0,  0,175,118,131, 63,194,176, 70, 62,  0,  0,  0,  0, 30, 65,124, 63, 90, 97, 83, 62,
+  0,  0,  0,  0, 59,239,126, 63,174,253, 30, 62,  0,  0,  0,  0, 65, 51,115, 63, 90,111, 52, 62,  0,  0,  0,  0, 59,239,126, 63,
+174,253, 30, 62,  0,  0,  0,  0, 30, 65,124, 63, 90, 97, 83, 62,  0,  0,  0,  0, 30, 65,124, 63, 90, 97, 83, 62,  0,  0,  0,  0,
+175,118,131, 63,194,176, 70, 62,  0,  0,  0,  0, 70,143,129, 63,216, 76,120, 62,  0,  0,  0,  0,156,105,131, 63,101, 41,147, 61,
+  0,  0,  0,  0, 65, 51,115, 63, 83,111,180, 61,  0,  0,  0,  0, 38, 49,117, 63,225, 64, 52, 61,  0,  0,  0,  0, 38, 49,117, 63,
+225, 64, 52, 61,  0,  0,  0,  0,232,148,135, 63,144,158,125, 60,  0,  0,  0,  0,156,105,131, 63,101, 41,147, 61,  0,  0,  0,  0,
+215,153, 25, 62,104,111,180, 61,  0,  0,  0,  0,122,245,128, 61,101, 41,147, 61,  0,  0,  0,  0,224,153, 25, 62,225, 64, 52, 61,
+  0,  0,  0,  0,232,148,135, 63,144,158,125, 60,  0,  0,  0,  0, 38, 49,117, 63,225, 64, 52, 61,  0,  0,  0,  0,208,222,121, 63,
+102,  9,239,178,  0,  0,  0,  0,122,245,128, 61,101, 41,147, 61,  0,  0,  0,  0,215,153, 25, 62,104,111,180, 61,  0,  0,  0,  0,
+ 89, 55,179, 61, 38, 46,231, 61,  0,  0,  0,  0, 89, 55,179, 61, 38, 46,231, 61,  0,  0,  0,  0, 96,147,208, 60, 48, 46,231, 61,
+  0,  0,  0,  0,122,245,128, 61,101, 41,147, 61,  0,  0,  0,  0, 65, 51,115, 63, 83,111,180, 61,  0,  0,  0,  0,156,105,131, 63,
+101, 41,147, 61,  0,  0,  0,  0,102,153,129, 63, 48, 46,231, 61,  0,  0,  0,  0, 96,147,208, 60, 48, 46,231, 61,  0,  0,  0,  0,
+ 89, 55,179, 61, 38, 46,231, 61,  0,  0,  0,  0,193,205, 76, 61,168, 31, 23, 62,  0,  0,  0,  0, 59,239,126, 63,174,253, 30, 62,
+  0,  0,  0,  0, 65, 51,115, 63, 90,111, 52, 62,  0,  0,  0,  0, 66, 51,115, 63,199, 70,  7, 62,  0,  0,  0,  0, 66, 51,115, 63,
+199, 70,  7, 62,  0,  0,  0,  0,102,153,129, 63, 48, 46,231, 61,  0,  0,  0,  0, 59,239,126, 63,174,253, 30, 62,  0,  0,  0,  0,
+154,105,131, 63,168, 31, 23, 62,  0,  0,  0,  0, 59,239,126, 63,174,253, 30, 62,  0,  0,  0,  0,102,153,129, 63, 48, 46,231, 61,
+  0,  0,  0,  0,102,153,129, 63, 48, 46,231, 61,  0,  0,  0,  0, 66, 51,115, 63,199, 70,  7, 62,  0,  0,  0,  0, 65, 51,115, 63,
+ 83,111,180, 61,  0,  0,  0,  0,198, 83,213, 61,179,253, 30, 62,  0,  0,  0,  0,193,205, 76, 61,168, 31, 23, 62,  0,  0,  0,  0,
+ 89, 55,179, 61, 38, 46,231, 61,  0,  0,  0,  0, 89, 55,179, 61, 38, 46,231, 61,  0,  0,  0,  0,217,153, 25, 62,204, 70,  7, 62,
+  0,  0,  0,  0,198, 83,213, 61,179,253, 30, 62,  0,  0,  0,  0,214,153, 25, 62,106,111, 52, 62,  0,  0,  0,  0,198, 83,213, 61,
+179,253, 30, 62,  0,  0,  0,  0,217,153, 25, 62,204, 70,  7, 62,  0,  0,  0,  0,217,153, 25, 62,204, 70,  7, 62,  0,  0,  0,  0,
+ 89, 55,179, 61, 38, 46,231, 61,  0,  0,  0,  0,215,153, 25, 62,104,111,180, 61,  0,  0,  0,  0,192,228,122, 63, 66, 45,128, 62,
+  0,  0,  0,  0, 65, 51,115, 63,151, 83,135, 62,  0,  0,  0,  0, 65, 51,115, 63,248,151, 97, 62,  0,  0,  0,  0, 65, 51,115, 63,
+248,151, 97, 62,  0,  0,  0,  0, 30, 65,124, 63, 90, 97, 83, 62,  0,  0,  0,  0,192,228,122, 63, 66, 45,128, 62,  0,  0,  0,  0,
+ 70,143,129, 63,216, 76,120, 62,  0,  0,  0,  0,192,228,122, 63, 66, 45,128, 62,  0,  0,  0,  0, 30, 65,124, 63, 90, 97, 83, 62,
+  0,  0,  0,  0, 30, 65,124, 63, 90, 97, 83, 62,  0,  0,  0,  0, 65, 51,115, 63,248,151, 97, 62,  0,  0,  0,  0, 65, 51,115, 63,
+ 90,111, 52, 62,  0,  0,  0,  0,192,228,122, 63, 66, 45,128, 62,  0,  0,  0,  0, 70,143,129, 63,216, 76,120, 62,  0,  0,  0,  0,
+201,153,128, 63, 14,201,146, 62,  0,  0,  0,  0,201,153,128, 63, 14,201,146, 62,  0,  0,  0,  0,239,234,121, 63,169,144,151, 62,
+  0,  0,  0,  0,192,228,122, 63, 66, 45,128, 62,  0,  0,  0,  0, 65, 51,115, 63,151, 83,135, 62,  0,  0,  0,  0,192,228,122, 63,
+ 66, 45,128, 62,  0,  0,  0,  0,239,234,121, 63,169,144,151, 62,  0,  0,  0,  0,239,234,121, 63,169,144,151, 62,  0,  0,  0,  0,
+201,153,128, 63, 14,201,146, 62,  0,  0,  0,  0, 15,171,127, 63, 52,150,169, 62,  0,  0,  0,  0,133, 80,121, 63, 65, 54,174, 62,
+  0,  0,  0,  0, 65, 51,115, 63,160,111,180, 62,  0,  0,  0,  0, 65, 51,115, 63, 93,231,157, 62,  0,  0,  0,  0, 65, 51,115, 63,
+ 93,231,157, 62,  0,  0,  0,  0,239,234,121, 63,169,144,151, 62,  0,  0,  0,  0,133, 80,121, 63, 65, 54,174, 62,  0,  0,  0,  0,
+ 15,171,127, 63, 52,150,169, 62,  0,  0,  0,  0,133, 80,121, 63, 65, 54,174, 62,  0,  0,  0,  0,239,234,121, 63,169,144,151, 62,
+  0,  0,  0,  0,239,234,121, 63,169,144,151, 62,  0,  0,  0,  0, 65, 51,115, 63, 93,231,157, 62,  0,  0,  0,  0, 65, 51,115, 63,
+151, 83,135, 62,  0,  0,  0,  0, 23, 23,131, 63, 89,190,166, 62,  0,  0,  0,  0, 15,171,127, 63, 52,150,169, 62,  0,  0,  0,  0,
+201,153,128, 63, 14,201,146, 62,  0,  0,  0,  0,136,200,153, 59, 14,201,146, 62,  0,  0,  0,  0,207,133,  7, 61,236,101,144, 62,
+  0,  0,  0,  0,195,197,197, 60, 89,190,166, 62,  0,  0,  0,  0,194,205, 76, 61,186,199,165, 62,  0,  0,  0,  0,195,197,197, 60,
+ 89,190,166, 62,  0,  0,  0,  0,207,133,  7, 61,236,101,144, 62,  0,  0,  0,  0,207,133,  7, 61,236,101,144, 62,  0,  0,  0,  0,
+136,200,153, 59, 14,201,146, 62,  0,  0,  0,  0,255,162, 71, 60,216, 76,120, 62,  0,  0,  0,  0, 32,208,163, 62, 79, 45,128, 62,
+  0,  0,  0,  0,147, 92,147, 62,252, 76,120, 62,  0,  0,  0,  0,102, 23,161, 62,115, 97, 83, 62,  0,  0,  0,  0,102, 23,161, 62,
+115, 97, 83, 62,  0,  0,  0,  0, 22, 51,179, 62,  2,152, 97, 62,  0,  0,  0,  0, 32,208,163, 62, 79, 45,128, 62,  0,  0,  0,  0,
+ 21, 51,179, 62,156, 83,135, 62,  0,  0,  0,  0, 32,208,163, 62, 79, 45,128, 62,  0,  0,  0,  0, 22, 51,179, 62,  2,152, 97, 62,
+  0,  0,  0,  0, 22, 51,179, 62,  2,152, 97, 62,  0,  0,  0,  0,102, 23,161, 62,115, 97, 83, 62,  0,  0,  0,  0, 21, 51,179, 62,
+101,111, 52, 62,  0,  0,  0,  0, 32,208,163, 62, 79, 45,128, 62,  0,  0,  0,  0, 21, 51,179, 62,156, 83,135, 62,  0,  0,  0,  0,
+194,195,165, 62,181,144,151, 62,  0,  0,  0,  0,194,195,165, 62,181,144,151, 62,  0,  0,  0,  0,134, 50,151, 62, 29,201,146, 62,
+  0,  0,  0,  0, 32,208,163, 62, 79, 45,128, 62,  0,  0,  0,  0,147, 92,147, 62,252, 76,120, 62,  0,  0,  0,  0, 32,208,163, 62,
+ 79, 45,128, 62,  0,  0,  0,  0,134, 50,151, 62, 29,201,146, 62,  0,  0,  0,  0,134, 50,151, 62, 29,201,146, 62,  0,  0,  0,  0,
+194,195,165, 62,181,144,151, 62,  0,  0,  0,  0,137, 67,154, 62, 70,150,169, 62,  0,  0,  0,  0, 82, 61,141, 62,112,190,166, 62,
+  0,  0,  0,  0,  0,  0,128, 62,206,199,165, 62,  0,  0,  0,  0,247,168,136, 62,  3,102,144, 62,  0,  0,  0,  0,247,168,136, 62,
+  3,102,144, 62,  0,  0,  0,  0,134, 50,151, 62, 29,201,146, 62,  0,  0,  0,  0, 82, 61,141, 62,112,190,166, 62,  0,  0,  0,  0,
+137, 67,154, 62, 70,150,169, 62,  0,  0,  0,  0, 82, 61,141, 62,112,190,166, 62,  0,  0,  0,  0,134, 50,151, 62, 29,201,146, 62,
+  0,  0,  0,  0,134, 50,151, 62, 29,201,146, 62,  0,  0,  0,  0,247,168,136, 62,  3,102,144, 62,  0,  0,  0,  0,147, 92,147, 62,
+252, 76,120, 62,  0,  0,  0,  0,150,248,166, 62, 78, 54,174, 62,  0,  0,  0,  0,137, 67,154, 62, 70,150,169, 62,  0,  0,  0,  0,
+194,195,165, 62,181,144,151, 62,  0,  0,  0,  0,194,195,165, 62,181,144,151, 62,  0,  0,  0,  0, 21, 51,179, 62, 98,231,157, 62,
+  0,  0,  0,  0,150,248,166, 62, 78, 54,174, 62,  0,  0,  0,  0, 21, 51,179, 62,165,111,180, 62,  0,  0,  0,  0,150,248,166, 62,
+ 78, 54,174, 62,  0,  0,  0,  0, 21, 51,179, 62, 98,231,157, 62,  0,  0,  0,  0, 21, 51,179, 62, 98,231,157, 62,  0,  0,  0,  0,
+194,195,165, 62,181,144,151, 62,  0,  0,  0,  0, 21, 51,179, 62,156, 83,135, 62,  0,  0,  0,  0,  0,  0,128, 62, 89,162,115, 62,
+  0,  0,  0,  0,147, 92,147, 62,252, 76,120, 62,  0,  0,  0,  0,247,168,136, 62,  3,102,144, 62,  0,  0,  0,  0,247,168,136, 62,
+  3,102,144, 62,  0,  0,  0,  0, 18,174,110, 62,  3,102,144, 62,  0,  0,  0,  0,  0,  0,128, 62, 89,162,115, 62,  0,  0,  0,  0,
+217, 70, 89, 62,252, 76,120, 62,  0,  0,  0,  0,  0,  0,128, 62, 89,162,115, 62,  0,  0,  0,  0, 18,174,110, 62,  3,102,144, 62,
+  0,  0,  0,  0, 18,174,110, 62,  3,102,144, 62,  0,  0,  0,  0,247,168,136, 62,  3,102,144, 62,  0,  0,  0,  0,  0,  0,128, 62,
+206,199,165, 62,  0,  0,  0,  0,  0,  0,128, 62, 89,162,115, 62,  0,  0,  0,  0,217, 70, 89, 62,252, 76,120, 62,  0,  0,  0,  0,
+ 30,130,104, 62,230,176, 70, 62,  0,  0,  0,  0, 30,130,104, 62,230,176, 70, 62,  0,  0,  0,  0,241,190,139, 62,230,176, 70, 62,
+  0,  0,  0,  0,  0,  0,128, 62, 89,162,115, 62,  0,  0,  0,  0,147, 92,147, 62,252, 76,120, 62,  0,  0,  0,  0,  0,  0,128, 62,
+ 89,162,115, 62,  0,  0,  0,  0,241,190,139, 62,230,176, 70, 62,  0,  0,  0,  0,241,190,139, 62,230,176, 70, 62,  0,  0,  0,  0,
+ 30,130,104, 62,230,176, 70, 62,  0,  0,  0,  0,  0,  0,128, 62,208, 31, 23, 62,  0,  0,  0,  0, 41,187,155, 62,205,253, 30, 62,
+  0,  0,  0,  0, 21, 51,179, 62,101,111, 52, 62,  0,  0,  0,  0,102, 23,161, 62,115, 97, 83, 62,  0,  0,  0,  0,102, 23,161, 62,
+115, 97, 83, 62,  0,  0,  0,  0,241,190,139, 62,230,176, 70, 62,  0,  0,  0,  0, 41,187,155, 62,205,253, 30, 62,  0,  0,  0,  0,
+  0,  0,128, 62,208, 31, 23, 62,  0,  0,  0,  0, 41,187,155, 62,205,253, 30, 62,  0,  0,  0,  0,241,190,139, 62,230,176, 70, 62,
+  0,  0,  0,  0,241,190,139, 62,230,176, 70, 62,  0,  0,  0,  0,102, 23,161, 62,115, 97, 83, 62,  0,  0,  0,  0,147, 92,147, 62,
+252, 76,120, 62,  0,  0,  0,  0,174,137, 72, 62,205,253, 30, 62,  0,  0,  0,  0,  0,  0,128, 62,208, 31, 23, 62,  0,  0,  0,  0,
+ 30,130,104, 62,230,176, 70, 62,  0,  0,  0,  0, 30,130,104, 62,230,176, 70, 62,  0,  0,  0,  0, 51,209, 61, 62,115, 97, 83, 62,
+  0,  0,  0,  0,174,137, 72, 62,205,253, 30, 62,  0,  0,  0,  0,214,153, 25, 62,106,111, 52, 62,  0,  0,  0,  0,174,137, 72, 62,
+205,253, 30, 62,  0,  0,  0,  0, 51,209, 61, 62,115, 97, 83, 62,  0,  0,  0,  0, 51,209, 61, 62,115, 97, 83, 62,  0,  0,  0,  0,
+ 30,130,104, 62,230,176, 70, 62,  0,  0,  0,  0,217, 70, 89, 62,252, 76,120, 62,  0,  0,  0,  0,255,255,127, 62,141, 41,147, 61,
+  0,  0,  0,  0,215,153, 25, 62,104,111,180, 61,  0,  0,  0,  0,224,153, 25, 62,225, 64, 52, 61,  0,  0,  0,  0,224,153, 25, 62,
+225, 64, 52, 61,  0,  0,  0,  0, 15, 51,179, 62,225, 64, 52, 61,  0,  0,  0,  0,255,255,127, 62,141, 41,147, 61,  0,  0,  0,  0,
+ 20, 51,179, 62,104,111,180, 61,  0,  0,  0,  0,255,255,127, 62,141, 41,147, 61,  0,  0,  0,  0, 15, 51,179, 62,225, 64, 52, 61,
+  0,  0,  0,  0, 15, 51,179, 62,225, 64, 52, 61,  0,  0,  0,  0,224,153, 25, 62,225, 64, 52, 61,  0,  0,  0,  0,144,175,161, 62,
+102,  9,239,178,  0,  0,  0,  0,255,255,127, 62,141, 41,147, 61,  0,  0,  0,  0, 20, 51,179, 62,104,111,180, 61,  0,  0,  0,  0,
+ 12, 52,147, 62,109, 46,231, 61,  0,  0,  0,  0, 12, 52,147, 62,109, 46,231, 61,  0,  0,  0,  0,231,151, 89, 62,109, 46,231, 61,
+  0,  0,  0,  0,255,255,127, 62,141, 41,147, 61,  0,  0,  0,  0,215,153, 25, 62,104,111,180, 61,  0,  0,  0,  0,255,255,127, 62,
+141, 41,147, 61,  0,  0,  0,  0,231,151, 89, 62,109, 46,231, 61,  0,  0,  0,  0,231,151, 89, 62,109, 46,231, 61,  0,  0,  0,  0,
+ 12, 52,147, 62,109, 46,231, 61,  0,  0,  0,  0,  0,  0,128, 62,208, 31, 23, 62,  0,  0,  0,  0,174,137, 72, 62,205,253, 30, 62,
+  0,  0,  0,  0,214,153, 25, 62,106,111, 52, 62,  0,  0,  0,  0,217,153, 25, 62,204, 70,  7, 62,  0,  0,  0,  0,217,153, 25, 62,
+204, 70,  7, 62,  0,  0,  0,  0,231,151, 89, 62,109, 46,231, 61,  0,  0,  0,  0,174,137, 72, 62,205,253, 30, 62,  0,  0,  0,  0,
+  0,  0,128, 62,208, 31, 23, 62,  0,  0,  0,  0,174,137, 72, 62,205,253, 30, 62,  0,  0,  0,  0,231,151, 89, 62,109, 46,231, 61,
+  0,  0,  0,  0,231,151, 89, 62,109, 46,231, 61,  0,  0,  0,  0,217,153, 25, 62,204, 70,  7, 62,  0,  0,  0,  0,215,153, 25, 62,
+104,111,180, 61,  0,  0,  0,  0, 41,187,155, 62,205,253, 30, 62,  0,  0,  0,  0,  0,  0,128, 62,208, 31, 23, 62,  0,  0,  0,  0,
+ 12, 52,147, 62,109, 46,231, 61,  0,  0,  0,  0, 12, 52,147, 62,109, 46,231, 61,  0,  0,  0,  0, 19, 51,179, 62,204, 70,  7, 62,
+  0,  0,  0,  0, 41,187,155, 62,205,253, 30, 62,  0,  0,  0,  0, 21, 51,179, 62,101,111, 52, 62,  0,  0,  0,  0, 41,187,155, 62,
+205,253, 30, 62,  0,  0,  0,  0, 19, 51,179, 62,204, 70,  7, 62,  0,  0,  0,  0, 19, 51,179, 62,204, 70,  7, 62,  0,  0,  0,  0,
+ 12, 52,147, 62,109, 46,231, 61,  0,  0,  0,  0, 20, 51,179, 62,104,111,180, 61,  0,  0,  0,  0,192, 95, 56, 62, 79, 45,128, 62,
+  0,  0,  0,  0,214,153, 25, 62,156, 83,135, 62,  0,  0,  0,  0,212,153, 25, 62,  2,152, 97, 62,  0,  0,  0,  0,212,153, 25, 62,
+  2,152, 97, 62,  0,  0,  0,  0, 51,209, 61, 62,115, 97, 83, 62,  0,  0,  0,  0,192, 95, 56, 62, 79, 45,128, 62,  0,  0,  0,  0,
+217, 70, 89, 62,252, 76,120, 62,  0,  0,  0,  0,192, 95, 56, 62, 79, 45,128, 62,  0,  0,  0,  0, 51,209, 61, 62,115, 97, 83, 62,
+  0,  0,  0,  0, 51,209, 61, 62,115, 97, 83, 62,  0,  0,  0,  0,212,153, 25, 62,  2,152, 97, 62,  0,  0,  0,  0,214,153, 25, 62,
+106,111, 52, 62,  0,  0,  0,  0,192, 95, 56, 62, 79, 45,128, 62,  0,  0,  0,  0,217, 70, 89, 62,252, 76,120, 62,  0,  0,  0,  0,
+245,154, 81, 62, 29,201,146, 62,  0,  0,  0,  0,245,154, 81, 62, 29,201,146, 62,  0,  0,  0,  0,125,120, 52, 62,181,144,151, 62,
+  0,  0,  0,  0,192, 95, 56, 62, 79, 45,128, 62,  0,  0,  0,  0,214,153, 25, 62,156, 83,135, 62,  0,  0,  0,  0,192, 95, 56, 62,
+ 79, 45,128, 62,  0,  0,  0,  0,125,120, 52, 62,181,144,151, 62,  0,  0,  0,  0,125,120, 52, 62,181,144,151, 62,  0,  0,  0,  0,
+245,154, 81, 62, 29,201,146, 62,  0,  0,  0,  0,239,120, 75, 62, 70,150,169, 62,  0,  0,  0,  0,213, 14, 50, 62, 78, 54,174, 62,
+  0,  0,  0,  0,214,153, 25, 62,165,111,180, 62,  0,  0,  0,  0,213,153, 25, 62,100,231,157, 62,  0,  0,  0,  0,213,153, 25, 62,
+100,231,157, 62,  0,  0,  0,  0,125,120, 52, 62,181,144,151, 62,  0,  0,  0,  0,213, 14, 50, 62, 78, 54,174, 62,  0,  0,  0,  0,
+239,120, 75, 62, 70,150,169, 62,  0,  0,  0,  0,213, 14, 50, 62, 78, 54,174, 62,  0,  0,  0,  0,125,120, 52, 62,181,144,151, 62,
+  0,  0,  0,  0,125,120, 52, 62,181,144,151, 62,  0,  0,  0,  0,213,153, 25, 62,100,231,157, 62,  0,  0,  0,  0,214,153, 25, 62,
+156, 83,135, 62,  0,  0,  0,  0, 91,133,101, 62,112,190,166, 62,  0,  0,  0,  0,239,120, 75, 62, 70,150,169, 62,  0,  0,  0,  0,
+245,154, 81, 62, 29,201,146, 62,  0,  0,  0,  0,245,154, 81, 62, 29,201,146, 62,  0,  0,  0,  0, 18,174,110, 62,  3,102,144, 62,
+  0,  0,  0,  0, 91,133,101, 62,112,190,166, 62,  0,  0,  0,  0,  0,  0,128, 62,206,199,165, 62,  0,  0,  0,  0, 91,133,101, 62,
+112,190,166, 62,  0,  0,  0,  0, 18,174,110, 62,  3,102,144, 62,  0,  0,  0,  0, 18,174,110, 62,  3,102,144, 62,  0,  0,  0,  0,
+245,154, 81, 62, 29,201,146, 62,  0,  0,  0,  0,217, 70, 89, 62,252, 76,120, 62,  0,  0,  0,  0, 64, 27,  5, 63, 66, 45,128, 62,
+  0,  0,  0,  0,232,194,249, 62,216, 76,120, 62,  0,  0,  0,  0,226,190,  3, 63, 90, 97, 83, 62,  0,  0,  0,  0,226,190,  3, 63,
+ 90, 97, 83, 62,  0,  0,  0,  0,191,204, 12, 63,248,151, 97, 62,  0,  0,  0,  0, 64, 27,  5, 63, 66, 45,128, 62,  0,  0,  0,  0,
+191,204, 12, 63,149, 83,135, 62,  0,  0,  0,  0, 64, 27,  5, 63, 66, 45,128, 62,  0,  0,  0,  0,191,204, 12, 63,248,151, 97, 62,
+  0,  0,  0,  0,191,204, 12, 63,248,151, 97, 62,  0,  0,  0,  0,226,190,  3, 63, 90, 97, 83, 62,  0,  0,  0,  0,191,204, 12, 63,
+ 90,111, 52, 62,  0,  0,  0,  0, 64, 27,  5, 63, 66, 45,128, 62,  0,  0,  0,  0,191,204, 12, 63,149, 83,135, 62,  0,  0,  0,  0,
+ 17, 21,  6, 63,169,144,151, 62,  0,  0,  0,  0, 17, 21,  6, 63,169,144,151, 62,  0,  0,  0,  0,222,152,253, 62, 14,201,146, 62,
+  0,  0,  0,  0, 64, 27,  5, 63, 66, 45,128, 62,  0,  0,  0,  0,232,194,249, 62,216, 76,120, 62,  0,  0,  0,  0, 64, 27,  5, 63,
+ 66, 45,128, 62,  0,  0,  0,  0,222,152,253, 62, 14,201,146, 62,  0,  0,  0,  0,222,152,253, 62, 14,201,146, 62,  0,  0,  0,  0,
+ 17, 21,  6, 63,169,144,151, 62,  0,  0,  0,  0,241, 84,  0, 63, 52,150,169, 62,  0,  0,  0,  0,164,163,243, 62, 89,190,166, 62,
+  0,  0,  0,  0, 72,102,230, 62,183,199,165, 62,  0,  0,  0,  0, 70, 15,239, 62,233,101,144, 62,  0,  0,  0,  0, 70, 15,239, 62,
+233,101,144, 62,  0,  0,  0,  0,222,152,253, 62, 14,201,146, 62,  0,  0,  0,  0,164,163,243, 62, 89,190,166, 62,  0,  0,  0,  0,
+241, 84,  0, 63, 52,150,169, 62,  0,  0,  0,  0,164,163,243, 62, 89,190,166, 62,  0,  0,  0,  0,222,152,253, 62, 14,201,146, 62,
+  0,  0,  0,  0,222,152,253, 62, 14,201,146, 62,  0,  0,  0,  0, 70, 15,239, 62,233,101,144, 62,  0,  0,  0,  0,232,194,249, 62,
+216, 76,120, 62,  0,  0,  0,  0,123,175,  6, 63, 65, 54,174, 62,  0,  0,  0,  0,241, 84,  0, 63, 52,150,169, 62,  0,  0,  0,  0,
+ 17, 21,  6, 63,169,144,151, 62,  0,  0,  0,  0, 17, 21,  6, 63,169,144,151, 62,  0,  0,  0,  0,191,204, 12, 63, 90,231,157, 62,
+  0,  0,  0,  0,123,175,  6, 63, 65, 54,174, 62,  0,  0,  0,  0,191,204, 12, 63,160,111,180, 62,  0,  0,  0,  0,123,175,  6, 63,
+ 65, 54,174, 62,  0,  0,  0,  0,191,204, 12, 63, 90,231,157, 62,  0,  0,  0,  0,191,204, 12, 63, 90,231,157, 62,  0,  0,  0,  0,
+ 17, 21,  6, 63,169,144,151, 62,  0,  0,  0,  0,191,204, 12, 63,149, 83,135, 62,  0,  0,  0,  0, 72,102,230, 62, 53,162,115, 62,
+  0,  0,  0,  0,232,194,249, 62,216, 76,120, 62,  0,  0,  0,  0, 70, 15,239, 62,233,101,144, 62,  0,  0,  0,  0, 70, 15,239, 62,
+233,101,144, 62,  0,  0,  0,  0, 75,189,221, 62,238,101,144, 62,  0,  0,  0,  0, 72,102,230, 62, 53,162,115, 62,  0,  0,  0,  0,
+168,  9,211, 62,222, 76,120, 62,  0,  0,  0,  0, 72,102,230, 62, 53,162,115, 62,  0,  0,  0,  0, 75,189,221, 62,238,101,144, 62,
+  0,  0,  0,  0, 75,189,221, 62,238,101,144, 62,  0,  0,  0,  0, 70, 15,239, 62,233,101,144, 62,  0,  0,  0,  0, 72,102,230, 62,
+183,199,165, 62,  0,  0,  0,  0, 72,102,230, 62, 53,162,115, 62,  0,  0,  0,  0,168,  9,211, 62,222, 76,120, 62,  0,  0,  0,  0,
+ 80,167,218, 62,194,176, 70, 62,  0,  0,  0,  0, 80,167,218, 62,194,176, 70, 62,  0,  0,  0,  0, 68, 37,242, 62,194,176, 70, 62,
+  0,  0,  0,  0, 72,102,230, 62, 53,162,115, 62,  0,  0,  0,  0,232,194,249, 62,216, 76,120, 62,  0,  0,  0,  0, 72,102,230, 62,
+ 53,162,115, 62,  0,  0,  0,  0, 68, 37,242, 62,194,176, 70, 62,  0,  0,  0,  0, 68, 37,242, 62,194,176, 70, 62,  0,  0,  0,  0,
+ 80,167,218, 62,194,176, 70, 62,  0,  0,  0,  0, 72,102,230, 62,168, 31, 23, 62,  0,  0,  0,  0,197, 16,  1, 63,174,253, 30, 62,
+  0,  0,  0,  0,191,204, 12, 63, 90,111, 52, 62,  0,  0,  0,  0,226,190,  3, 63, 90, 97, 83, 62,  0,  0,  0,  0,226,190,  3, 63,
+ 90, 97, 83, 62,  0,  0,  0,  0, 68, 37,242, 62,194,176, 70, 62,  0,  0,  0,  0,197, 16,  1, 63,174,253, 30, 62,  0,  0,  0,  0,
+ 72,102,230, 62,168, 31, 23, 62,  0,  0,  0,  0,197, 16,  1, 63,174,253, 30, 62,  0,  0,  0,  0, 68, 37,242, 62,194,176, 70, 62,
+  0,  0,  0,  0, 68, 37,242, 62,194,176, 70, 62,  0,  0,  0,  0,226,190,  3, 63, 90, 97, 83, 62,  0,  0,  0,  0,232,194,249, 62,
+216, 76,120, 62,  0,  0,  0,  0, 14,171,202, 62,179,253, 30, 62,  0,  0,  0,  0, 72,102,230, 62,168, 31, 23, 62,  0,  0,  0,  0,
+ 80,167,218, 62,194,176, 70, 62,  0,  0,  0,  0, 80,167,218, 62,194,176, 70, 62,  0,  0,  0,  0,205, 78,197, 62, 95, 97, 83, 62,
+  0,  0,  0,  0, 14,171,202, 62,179,253, 30, 62,  0,  0,  0,  0, 21, 51,179, 62,101,111, 52, 62,  0,  0,  0,  0, 14,171,202, 62,
+179,253, 30, 62,  0,  0,  0,  0,205, 78,197, 62, 95, 97, 83, 62,  0,  0,  0,  0,205, 78,197, 62, 95, 97, 83, 62,  0,  0,  0,  0,
+ 80,167,218, 62,194,176, 70, 62,  0,  0,  0,  0,168,  9,211, 62,222, 76,120, 62,  0,  0,  0,  0, 63,102,230, 62,101, 41,147, 61,
+  0,  0,  0,  0, 20, 51,179, 62,104,111,180, 61,  0,  0,  0,  0, 15, 51,179, 62,225, 64, 52, 61,  0,  0,  0,  0, 15, 51,179, 62,
+225, 64, 52, 61,  0,  0,  0,  0,189,204, 12, 63,225, 64, 52, 61,  0,  0,  0,  0, 63,102,230, 62,101, 41,147, 61,  0,  0,  0,  0,
+191,204, 12, 63, 83,111,180, 61,  0,  0,  0,  0, 63,102,230, 62,101, 41,147, 61,  0,  0,  0,  0,189,204, 12, 63,225, 64, 52, 61,
+  0,  0,  0,  0,189,204, 12, 63,225, 64, 52, 61,  0,  0,  0,  0, 15, 51,179, 62,225, 64, 52, 61,  0,  0,  0,  0,144,175,161, 62,
+102,  9,239,178,  0,  0,  0,  0, 63,102,230, 62,101, 41,147, 61,  0,  0,  0,  0,191,204, 12, 63, 83,111,180, 61,  0,  0,  0,  0,
+104,154,249, 62, 48, 46,231, 61,  0,  0,  0,  0,104,154,249, 62, 48, 46,231, 61,  0,  0,  0,  0, 42, 50,211, 62, 48, 46,231, 61,
+  0,  0,  0,  0, 63,102,230, 62,101, 41,147, 61,  0,  0,  0,  0, 20, 51,179, 62,104,111,180, 61,  0,  0,  0,  0, 63,102,230, 62,
+101, 41,147, 61,  0,  0,  0,  0, 42, 50,211, 62, 48, 46,231, 61,  0,  0,  0,  0, 42, 50,211, 62, 48, 46,231, 61,  0,  0,  0,  0,
+104,154,249, 62, 48, 46,231, 61,  0,  0,  0,  0, 72,102,230, 62,168, 31, 23, 62,  0,  0,  0,  0, 14,171,202, 62,179,253, 30, 62,
+  0,  0,  0,  0, 21, 51,179, 62,101,111, 52, 62,  0,  0,  0,  0, 19, 51,179, 62,204, 70,  7, 62,  0,  0,  0,  0, 19, 51,179, 62,
+204, 70,  7, 62,  0,  0,  0,  0, 42, 50,211, 62, 48, 46,231, 61,  0,  0,  0,  0, 14,171,202, 62,179,253, 30, 62,  0,  0,  0,  0,
+ 72,102,230, 62,168, 31, 23, 62,  0,  0,  0,  0, 14,171,202, 62,179,253, 30, 62,  0,  0,  0,  0, 42, 50,211, 62, 48, 46,231, 61,
+  0,  0,  0,  0, 42, 50,211, 62, 48, 46,231, 61,  0,  0,  0,  0, 19, 51,179, 62,204, 70,  7, 62,  0,  0,  0,  0, 20, 51,179, 62,
+104,111,180, 61,  0,  0,  0,  0,197, 16,  1, 63,174,253, 30, 62,  0,  0,  0,  0, 72,102,230, 62,168, 31, 23, 62,  0,  0,  0,  0,
+104,154,249, 62, 48, 46,231, 61,  0,  0,  0,  0,104,154,249, 62, 48, 46,231, 61,  0,  0,  0,  0,191,204, 12, 63,199, 70,  7, 62,
+  0,  0,  0,  0,197, 16,  1, 63,174,253, 30, 62,  0,  0,  0,  0,191,204, 12, 63, 90,111, 52, 62,  0,  0,  0,  0,197, 16,  1, 63,
+174,253, 30, 62,  0,  0,  0,  0,191,204, 12, 63,199, 70,  7, 62,  0,  0,  0,  0,191,204, 12, 63,199, 70,  7, 62,  0,  0,  0,  0,
+104,154,249, 62, 48, 46,231, 61,  0,  0,  0,  0,191,204, 12, 63, 83,111,180, 61,  0,  0,  0,  0, 19,150,194, 62, 72, 45,128, 62,
+  0,  0,  0,  0, 21, 51,179, 62,156, 83,135, 62,  0,  0,  0,  0, 22, 51,179, 62,  2,152, 97, 62,  0,  0,  0,  0, 22, 51,179, 62,
+  2,152, 97, 62,  0,  0,  0,  0,205, 78,197, 62, 95, 97, 83, 62,  0,  0,  0,  0, 19,150,194, 62, 72, 45,128, 62,  0,  0,  0,  0,
+168,  9,211, 62,222, 76,120, 62,  0,  0,  0,  0, 19,150,194, 62, 72, 45,128, 62,  0,  0,  0,  0,205, 78,197, 62, 95, 97, 83, 62,
+  0,  0,  0,  0,205, 78,197, 62, 95, 97, 83, 62,  0,  0,  0,  0, 22, 51,179, 62,  2,152, 97, 62,  0,  0,  0,  0, 21, 51,179, 62,
+101,111, 52, 62,  0,  0,  0,  0, 19,150,194, 62, 72, 45,128, 62,  0,  0,  0,  0,168,  9,211, 62,222, 76,120, 62,  0,  0,  0,  0,
+179, 51,207, 62, 17,201,146, 62,  0,  0,  0,  0,179, 51,207, 62, 17,201,146, 62,  0,  0,  0,  0,113,162,192, 62,174,144,151, 62,
+  0,  0,  0,  0, 19,150,194, 62, 72, 45,128, 62,  0,  0,  0,  0, 21, 51,179, 62,156, 83,135, 62,  0,  0,  0,  0, 19,150,194, 62,
+ 72, 45,128, 62,  0,  0,  0,  0,113,162,192, 62,174,144,151, 62,  0,  0,  0,  0,113,162,192, 62,174,144,151, 62,  0,  0,  0,  0,
+179, 51,207, 62, 17,201,146, 62,  0,  0,  0,  0,175, 34,204, 62, 54,150,169, 62,  0,  0,  0,  0,154,109,191, 62, 68, 54,174, 62,
+  0,  0,  0,  0, 21, 51,179, 62,165,111,180, 62,  0,  0,  0,  0, 21, 51,179, 62, 98,231,157, 62,  0,  0,  0,  0, 21, 51,179, 62,
+ 98,231,157, 62,  0,  0,  0,  0,113,162,192, 62,174,144,151, 62,  0,  0,  0,  0,154,109,191, 62, 68, 54,174, 62,  0,  0,  0,  0,
+175, 34,204, 62, 54,150,169, 62,  0,  0,  0,  0,154,109,191, 62, 68, 54,174, 62,  0,  0,  0,  0,113,162,192, 62,174,144,151, 62,
+  0,  0,  0,  0,113,162,192, 62,174,144,151, 62,  0,  0,  0,  0, 21, 51,179, 62, 98,231,157, 62,  0,  0,  0,  0, 21, 51,179, 62,
+156, 83,135, 62,  0,  0,  0,  0,237, 40,217, 62, 91,190,166, 62,  0,  0,  0,  0,175, 34,204, 62, 54,150,169, 62,  0,  0,  0,  0,
+179, 51,207, 62, 17,201,146, 62,  0,  0,  0,  0,179, 51,207, 62, 17,201,146, 62,  0,  0,  0,  0, 75,189,221, 62,238,101,144, 62,
+  0,  0,  0,  0,237, 40,217, 62, 91,190,166, 62,  0,  0,  0,  0, 72,102,230, 62,183,199,165, 62,  0,  0,  0,  0,237, 40,217, 62,
+ 91,190,166, 62,  0,  0,  0,  0, 75,189,221, 62,238,101,144, 62,  0,  0,  0,  0, 75,189,221, 62,238,101,144, 62,  0,  0,  0,  0,
+179, 51,207, 62, 17,201,146, 62,  0,  0,  0,  0,168,  9,211, 62,222, 76,120, 62,  0,  0,  0,  0,134, 78, 56, 63,117, 45,128, 62,
+  0,  0,  0,  0,188, 20, 48, 63, 37, 77,120, 62,  0,  0,  0,  0, 42,242, 54, 63,181, 97, 83, 62,  0,  0,  0,  0, 42,242, 54, 63,
+181, 97, 83, 62,  0,  0,  0,  0,  0,  0, 64, 63,115,152, 97, 62,  0,  0,  0,  0,134, 78, 56, 63,117, 45,128, 62,  0,  0,  0,  0,
+  0,  0, 64, 63,218, 83,135, 62,  0,  0,  0,  0,134, 78, 56, 63,117, 45,128, 62,  0,  0,  0,  0,  0,  0, 64, 63,115,152, 97, 62,
+  0,  0,  0,  0,  0,  0, 64, 63,115,152, 97, 62,  0,  0,  0,  0, 42,242, 54, 63,181, 97, 83, 62,  0,  0,  0,  0,  0,  0, 64, 63,
+202,111, 52, 62,  0,  0,  0,  0,134, 78, 56, 63,117, 45,128, 62,  0,  0,  0,  0,  0,  0, 64, 63,218, 83,135, 62,  0,  0,  0,  0,
+ 87, 72, 57, 63,219,144,151, 62,  0,  0,  0,  0, 87, 72, 57, 63,219,144,151, 62,  0,  0,  0,  0,184,255, 49, 63, 52,201,146, 62,
+  0,  0,  0,  0,134, 78, 56, 63,117, 45,128, 62,  0,  0,  0,  0,188, 20, 48, 63, 37, 77,120, 62,  0,  0,  0,  0,134, 78, 56, 63,
+117, 45,128, 62,  0,  0,  0,  0,184,255, 49, 63, 52,201,146, 62,  0,  0,  0,  0,184,255, 49, 63, 52,201,146, 62,  0,  0,  0,  0,
+ 87, 72, 57, 63,219,144,151, 62,  0,  0,  0,  0, 58,136, 51, 63, 90,150,169, 62,  0,  0,  0,  0, 26,  5, 45, 63,117,190,166, 62,
+  0,  0,  0,  0,107,102, 38, 63,201,199,165, 62,  0,  0,  0,  0,235,186, 42, 63,  5,102,144, 62,  0,  0,  0,  0,235,186, 42, 63,
+  5,102,144, 62,  0,  0,  0,  0,184,255, 49, 63, 52,201,146, 62,  0,  0,  0,  0, 26,  5, 45, 63,117,190,166, 62,  0,  0,  0,  0,
+ 58,136, 51, 63, 90,150,169, 62,  0,  0,  0,  0, 26,  5, 45, 63,117,190,166, 62,  0,  0,  0,  0,184,255, 49, 63, 52,201,146, 62,
+  0,  0,  0,  0,184,255, 49, 63, 52,201,146, 62,  0,  0,  0,  0,235,186, 42, 63,  5,102,144, 62,  0,  0,  0,  0,188, 20, 48, 63,
+ 37, 77,120, 62,  0,  0,  0,  0,196,226, 57, 63,114, 54,174, 62,  0,  0,  0,  0, 58,136, 51, 63, 90,150,169, 62,  0,  0,  0,  0,
+ 87, 72, 57, 63,219,144,151, 62,  0,  0,  0,  0, 87, 72, 57, 63,219,144,151, 62,  0,  0,  0,  0,  0,  0, 64, 63,162,231,157, 62,
+  0,  0,  0,  0,196,226, 57, 63,114, 54,174, 62,  0,  0,  0,  0,  0,  0, 64, 63,211,111,180, 62,  0,  0,  0,  0,196,226, 57, 63,
+114, 54,174, 62,  0,  0,  0,  0,  0,  0, 64, 63,162,231,157, 62,  0,  0,  0,  0,  0,  0, 64, 63,162,231,157, 62,  0,  0,  0,  0,
+ 87, 72, 57, 63,219,144,151, 62,  0,  0,  0,  0,  0,  0, 64, 63,218, 83,135, 62,  0,  0,  0,  0,107,102, 38, 63, 79,162,115, 62,
+  0,  0,  0,  0,188, 20, 48, 63, 37, 77,120, 62,  0,  0,  0,  0,235,186, 42, 63,  5,102,144, 62,  0,  0,  0,  0,235,186, 42, 63,
+  5,102,144, 62,  0,  0,  0,  0,234, 17, 34, 63,243,101,144, 62,  0,  0,  0,  0,107,102, 38, 63, 79,162,115, 62,  0,  0,  0,  0,
+ 21,184, 28, 63,222, 76,120, 62,  0,  0,  0,  0,107,102, 38, 63, 79,162,115, 62,  0,  0,  0,  0,234, 17, 34, 63,243,101,144, 62,
+  0,  0,  0,  0,234, 17, 34, 63,243,101,144, 62,  0,  0,  0,  0,235,186, 42, 63,  5,102,144, 62,  0,  0,  0,  0,107,102, 38, 63,
+201,199,165, 62,  0,  0,  0,  0,107,102, 38, 63, 79,162,115, 62,  0,  0,  0,  0, 21,184, 28, 63,222, 76,120, 62,  0,  0,  0,  0,
+234,134, 32, 63,204,176, 70, 62,  0,  0,  0,  0,234,134, 32, 63,204,176, 70, 62,  0,  0,  0,  0,233, 69, 44, 63,245,176, 70, 62,
+  0,  0,  0,  0,107,102, 38, 63, 79,162,115, 62,  0,  0,  0,  0,188, 20, 48, 63, 37, 77,120, 62,  0,  0,  0,  0,107,102, 38, 63,
+ 79,162,115, 62,  0,  0,  0,  0,233, 69, 44, 63,245,176, 70, 62,  0,  0,  0,  0,233, 69, 44, 63,245,176, 70, 62,  0,  0,  0,  0,
+234,134, 32, 63,204,176, 70, 62,  0,  0,  0,  0,104,102, 38, 63,198, 31, 23, 62,  0,  0,  0,  0,  9, 68, 52, 63,241,253, 30, 62,
+  0,  0,  0,  0,  0,  0, 64, 63,202,111, 52, 62,  0,  0,  0,  0, 42,242, 54, 63,181, 97, 83, 62,  0,  0,  0,  0, 42,242, 54, 63,
+181, 97, 83, 62,  0,  0,  0,  0,233, 69, 44, 63,245,176, 70, 62,  0,  0,  0,  0,  9, 68, 52, 63,241,253, 30, 62,  0,  0,  0,  0,
+104,102, 38, 63,198, 31, 23, 62,  0,  0,  0,  0,  9, 68, 52, 63,241,253, 30, 62,  0,  0,  0,  0,233, 69, 44, 63,245,176, 70, 62,
+  0,  0,  0,  0,233, 69, 44, 63,245,176, 70, 62,  0,  0,  0,  0, 42,242, 54, 63,181, 97, 83, 62,  0,  0,  0,  0,188, 20, 48, 63,
+ 37, 77,120, 62,  0,  0,  0,  0,195,136, 24, 63,179,253, 30, 62,  0,  0,  0,  0,104,102, 38, 63,198, 31, 23, 62,  0,  0,  0,  0,
+234,134, 32, 63,204,176, 70, 62,  0,  0,  0,  0,234,134, 32, 63,204,176, 70, 62,  0,  0,  0,  0,162,218, 21, 63, 84, 97, 83, 62,
+  0,  0,  0,  0,195,136, 24, 63,179,253, 30, 62,  0,  0,  0,  0,191,204, 12, 63, 90,111, 52, 62,  0,  0,  0,  0,195,136, 24, 63,
+179,253, 30, 62,  0,  0,  0,  0,162,218, 21, 63, 84, 97, 83, 62,  0,  0,  0,  0,162,218, 21, 63, 84, 97, 83, 62,  0,  0,  0,  0,
+234,134, 32, 63,204,176, 70, 62,  0,  0,  0,  0, 21,184, 28, 63,222, 76,120, 62,  0,  0,  0,  0,104,102, 38, 63,111, 41,147, 61,
+  0,  0,  0,  0,191,204, 12, 63, 83,111,180, 61,  0,  0,  0,  0,189,204, 12, 63,225, 64, 52, 61,  0,  0,  0,  0,189,204, 12, 63,
+225, 64, 52, 61,  0,  0,  0,  0,  0,  0, 64, 63,111, 65, 52, 61,  0,  0,  0,  0,104,102, 38, 63,111, 41,147, 61,  0,  0,  0,  0,
+  0,  0, 64, 63,195,111,180, 61,  0,  0,  0,  0,104,102, 38, 63,111, 41,147, 61,  0,  0,  0,  0,  0,  0, 64, 63,111, 65, 52, 61,
+  0,  0,  0,  0,  0,  0, 64, 63,111, 65, 52, 61,  0,  0,  0,  0,189,204, 12, 63,225, 64, 52, 61,  0,  0,  0,  0,208,222,121, 63,
+102,  9,239,178,  0,  0,  0,  0,104,102, 38, 63,111, 41,147, 61,  0,  0,  0,  0,  0,  0, 64, 63,195,111,180, 61,  0,  0,  0,  0,
+122,  0, 48, 63,120, 46,231, 61,  0,  0,  0,  0,122,  0, 48, 63,120, 46,231, 61,  0,  0,  0,  0, 85,204, 28, 63, 48, 46,231, 61,
+  0,  0,  0,  0,104,102, 38, 63,111, 41,147, 61,  0,  0,  0,  0,191,204, 12, 63, 83,111,180, 61,  0,  0,  0,  0,104,102, 38, 63,
+111, 41,147, 61,  0,  0,  0,  0, 85,204, 28, 63, 48, 46,231, 61,  0,  0,  0,  0, 85,204, 28, 63, 48, 46,231, 61,  0,  0,  0,  0,
+122,  0, 48, 63,120, 46,231, 61,  0,  0,  0,  0,104,102, 38, 63,198, 31, 23, 62,  0,  0,  0,  0,195,136, 24, 63,179,253, 30, 62,
+  0,  0,  0,  0,191,204, 12, 63, 90,111, 52, 62,  0,  0,  0,  0,191,204, 12, 63,199, 70,  7, 62,  0,  0,  0,  0,191,204, 12, 63,
+199, 70,  7, 62,  0,  0,  0,  0, 85,204, 28, 63, 48, 46,231, 61,  0,  0,  0,  0,195,136, 24, 63,179,253, 30, 62,  0,  0,  0,  0,
+104,102, 38, 63,198, 31, 23, 62,  0,  0,  0,  0,195,136, 24, 63,179,253, 30, 62,  0,  0,  0,  0, 85,204, 28, 63, 48, 46,231, 61,
+  0,  0,  0,  0, 85,204, 28, 63, 48, 46,231, 61,  0,  0,  0,  0,191,204, 12, 63,199, 70,  7, 62,  0,  0,  0,  0,191,204, 12, 63,
+ 83,111,180, 61,  0,  0,  0,  0,  9, 68, 52, 63,241,253, 30, 62,  0,  0,  0,  0,104,102, 38, 63,198, 31, 23, 62,  0,  0,  0,  0,
+122,  0, 48, 63,120, 46,231, 61,  0,  0,  0,  0,122,  0, 48, 63,120, 46,231, 61,  0,  0,  0,  0,  0,  0, 64, 63, 24, 71,  7, 62,
+  0,  0,  0,  0,  9, 68, 52, 63,241,253, 30, 62,  0,  0,  0,  0,  0,  0, 64, 63,202,111, 52, 62,  0,  0,  0,  0,  9, 68, 52, 63,
+241,253, 30, 62,  0,  0,  0,  0,  0,  0, 64, 63, 24, 71,  7, 62,  0,  0,  0,  0,  0,  0, 64, 63, 24, 71,  7, 62,  0,  0,  0,  0,
+122,  0, 48, 63,120, 46,231, 61,  0,  0,  0,  0,  0,  0, 64, 63,195,111,180, 61,  0,  0,  0,  0, 68,126, 20, 63, 64, 45,128, 62,
+  0,  0,  0,  0,191,204, 12, 63,149, 83,135, 62,  0,  0,  0,  0,191,204, 12, 63,248,151, 97, 62,  0,  0,  0,  0,191,204, 12, 63,
+248,151, 97, 62,  0,  0,  0,  0,162,218, 21, 63, 84, 97, 83, 62,  0,  0,  0,  0, 68,126, 20, 63, 64, 45,128, 62,  0,  0,  0,  0,
+ 21,184, 28, 63,222, 76,120, 62,  0,  0,  0,  0, 68,126, 20, 63, 64, 45,128, 62,  0,  0,  0,  0,162,218, 21, 63, 84, 97, 83, 62,
+  0,  0,  0,  0,162,218, 21, 63, 84, 97, 83, 62,  0,  0,  0,  0,191,204, 12, 63,248,151, 97, 62,  0,  0,  0,  0,191,204, 12, 63,
+ 90,111, 52, 62,  0,  0,  0,  0, 68,126, 20, 63, 64, 45,128, 62,  0,  0,  0,  0, 21,184, 28, 63,222, 76,120, 62,  0,  0,  0,  0,
+ 25,205, 26, 63, 14,201,146, 62,  0,  0,  0,  0, 25,205, 26, 63, 14,201,146, 62,  0,  0,  0,  0,114,132, 19, 63,169,144,151, 62,
+  0,  0,  0,  0, 68,126, 20, 63, 64, 45,128, 62,  0,  0,  0,  0,191,204, 12, 63,149, 83,135, 62,  0,  0,  0,  0, 68,126, 20, 63,
+ 64, 45,128, 62,  0,  0,  0,  0,114,132, 19, 63,169,144,151, 62,  0,  0,  0,  0,114,132, 19, 63,169,144,151, 62,  0,  0,  0,  0,
+ 25,205, 26, 63, 14,201,146, 62,  0,  0,  0,  0,150, 68, 25, 63, 54,150,169, 62,  0,  0,  0,  0,  7,234, 18, 63, 65, 54,174, 62,
+  0,  0,  0,  0,191,204, 12, 63,160,111,180, 62,  0,  0,  0,  0,191,204, 12, 63, 90,231,157, 62,  0,  0,  0,  0,191,204, 12, 63,
+ 90,231,157, 62,  0,  0,  0,  0,114,132, 19, 63,169,144,151, 62,  0,  0,  0,  0,  7,234, 18, 63, 65, 54,174, 62,  0,  0,  0,  0,
+150, 68, 25, 63, 54,150,169, 62,  0,  0,  0,  0,  7,234, 18, 63, 65, 54,174, 62,  0,  0,  0,  0,114,132, 19, 63,169,144,151, 62,
+  0,  0,  0,  0,114,132, 19, 63,169,144,151, 62,  0,  0,  0,  0,191,204, 12, 63, 90,231,157, 62,  0,  0,  0,  0,191,204, 12, 63,
+149, 83,135, 62,  0,  0,  0,  0,185,199, 31, 63, 96,190,166, 62,  0,  0,  0,  0,150, 68, 25, 63, 54,150,169, 62,  0,  0,  0,  0,
+ 25,205, 26, 63, 14,201,146, 62,  0,  0,  0,  0, 25,205, 26, 63, 14,201,146, 62,  0,  0,  0,  0,234, 17, 34, 63,243,101,144, 62,
+  0,  0,  0,  0,185,199, 31, 63, 96,190,166, 62,  0,  0,  0,  0,107,102, 38, 63,201,199,165, 62,  0,  0,  0,  0,185,199, 31, 63,
+ 96,190,166, 62,  0,  0,  0,  0,234, 17, 34, 63,243,101,144, 62,  0,  0,  0,  0,234, 17, 34, 63,243,101,144, 62,  0,  0,  0,  0,
+ 25,205, 26, 63, 14,201,146, 62,  0,  0,  0,  0, 21,184, 28, 63,222, 76,120, 62,  0,  0,  0,  0, 68, 65, 84, 65,  0, 60,  0,  0,
+184,198,195,  4,  0,  0,  0,  0, 62,  0,  0,  0,  0, 15,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
@@ -13268,57 +13187,2459 @@ char datatoc_preview_blend[]= {
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 68, 65, 84, 65,  0,120,  0,  0, 40,194,199,  4,  0,  0,  0,  0,
+ 59,  0,  0,  0,  0, 15,  0,  0, 27,  1,  0,  0,243,  0,  0,  0,102,  0,  0,  0,225,  1,  0,  0,146,  1,  0,  0,192,  3,  0,  0,
+146,  1,  0,  0,193,  3,  0,  0,171,  0,  0,  0,194,  3,  0,  0, 27,  1,  0,  0,192,  3,  0,  0, 14,  0,  0,  0,242,  0,  0,  0,
+ 27,  1,  0,  0,194,  3,  0,  0,171,  0,  0,  0, 18,  0,  0,  0,171,  0,  0,  0,193,  3,  0,  0,146,  1,  0,  0,224,  1,  0,  0,
+ 46,  0,  0,  0, 19,  0,  0,  0,147,  1,  0,  0,227,  1,  0,  0, 46,  0,  0,  0,224,  1,  0,  0,146,  1,  0,  0,195,  3,  0,  0,
+146,  1,  0,  0,196,  3,  0,  0,148,  1,  0,  0,197,  3,  0,  0,147,  1,  0,  0,195,  3,  0,  0, 43,  0,  0,  0,226,  1,  0,  0,
+147,  1,  0,  0,197,  3,  0,  0,148,  1,  0,  0,228,  1,  0,  0,148,  1,  0,  0,196,  3,  0,  0,146,  1,  0,  0,225,  1,  0,  0,
+102,  0,  0,  0,229,  1,  0,  0, 26,  1,  0,  0,240,  0,  0,  0, 12,  0,  0,  0,  6,  0,  0,  0,165,  0,  0,  0,198,  3,  0,  0,
+165,  0,  0,  0,199,  3,  0,  0,148,  1,  0,  0,200,  3,  0,  0, 26,  1,  0,  0,198,  3,  0,  0,102,  0,  0,  0,241,  0,  0,  0,
+ 26,  1,  0,  0,200,  3,  0,  0,148,  1,  0,  0,229,  1,  0,  0,148,  1,  0,  0,199,  3,  0,  0,165,  0,  0,  0,  7,  0,  0,  0,
+ 43,  0,  0,  0,228,  1,  0,  0,147,  1,  0,  0,226,  1,  0,  0, 43,  0,  0,  0,  5,  0,  0,  0,164,  0,  0,  0,201,  3,  0,  0,
+164,  0,  0,  0,202,  3,  0,  0,170,  0,  0,  0,203,  3,  0,  0,147,  1,  0,  0,201,  3,  0,  0, 46,  0,  0,  0,227,  1,  0,  0,
+147,  1,  0,  0,203,  3,  0,  0,170,  0,  0,  0, 17,  0,  0,  0,170,  0,  0,  0,202,  3,  0,  0,164,  0,  0,  0,  4,  0,  0,  0,
+  1,  0,  0,  0, 16,  0,  0,  0, 26,  1,  0,  0,241,  0,  0,  0,102,  0,  0,  0,230,  1,  0,  0,149,  1,  0,  0,204,  3,  0,  0,
+149,  1,  0,  0,205,  3,  0,  0, 28,  1,  0,  0,206,  3,  0,  0, 26,  1,  0,  0,204,  3,  0,  0, 12,  0,  0,  0,240,  0,  0,  0,
+ 26,  1,  0,  0,206,  3,  0,  0, 28,  1,  0,  0,244,  0,  0,  0, 28,  1,  0,  0,205,  3,  0,  0,149,  1,  0,  0,231,  1,  0,  0,
+103,  0,  0,  0,245,  0,  0,  0,150,  1,  0,  0,232,  1,  0,  0,103,  0,  0,  0,231,  1,  0,  0,149,  1,  0,  0,207,  3,  0,  0,
+149,  1,  0,  0,208,  3,  0,  0,151,  1,  0,  0,209,  3,  0,  0,150,  1,  0,  0,207,  3,  0,  0,104,  0,  0,  0,233,  1,  0,  0,
+150,  1,  0,  0,209,  3,  0,  0,151,  1,  0,  0,235,  1,  0,  0,151,  1,  0,  0,208,  3,  0,  0,149,  1,  0,  0,230,  1,  0,  0,
+102,  0,  0,  0,234,  1,  0,  0, 27,  1,  0,  0,242,  0,  0,  0, 14,  0,  0,  0,250,  0,  0,  0, 31,  1,  0,  0,210,  3,  0,  0,
+ 31,  1,  0,  0,211,  3,  0,  0,151,  1,  0,  0,212,  3,  0,  0, 27,  1,  0,  0,210,  3,  0,  0,102,  0,  0,  0,243,  0,  0,  0,
+ 27,  1,  0,  0,212,  3,  0,  0,151,  1,  0,  0,234,  1,  0,  0,151,  1,  0,  0,211,  3,  0,  0, 31,  1,  0,  0,251,  0,  0,  0,
+104,  0,  0,  0,235,  1,  0,  0,150,  1,  0,  0,233,  1,  0,  0,104,  0,  0,  0,249,  0,  0,  0, 30,  1,  0,  0,213,  3,  0,  0,
+ 30,  1,  0,  0,214,  3,  0,  0, 29,  1,  0,  0,215,  3,  0,  0,150,  1,  0,  0,213,  3,  0,  0,103,  0,  0,  0,232,  1,  0,  0,
+150,  1,  0,  0,215,  3,  0,  0, 29,  1,  0,  0,247,  0,  0,  0, 29,  1,  0,  0,214,  3,  0,  0, 30,  1,  0,  0,248,  0,  0,  0,
+ 13,  0,  0,  0,246,  0,  0,  0,168,  0,  0,  0, 13,  0,  0,  0, 45,  0,  0,  0,236,  1,  0,  0,152,  1,  0,  0,216,  3,  0,  0,
+152,  1,  0,  0,217,  3,  0,  0,172,  0,  0,  0,218,  3,  0,  0,168,  0,  0,  0,216,  3,  0,  0,  2,  0,  0,  0, 12,  0,  0,  0,
+168,  0,  0,  0,218,  3,  0,  0,172,  0,  0,  0, 20,  0,  0,  0,172,  0,  0,  0,217,  3,  0,  0,152,  1,  0,  0,237,  1,  0,  0,
+ 47,  0,  0,  0, 21,  0,  0,  0,153,  1,  0,  0,238,  1,  0,  0, 47,  0,  0,  0,237,  1,  0,  0,152,  1,  0,  0,219,  3,  0,  0,
+152,  1,  0,  0,220,  3,  0,  0,154,  1,  0,  0,221,  3,  0,  0,153,  1,  0,  0,219,  3,  0,  0,104,  0,  0,  0,239,  1,  0,  0,
+153,  1,  0,  0,221,  3,  0,  0,154,  1,  0,  0,241,  1,  0,  0,154,  1,  0,  0,220,  3,  0,  0,152,  1,  0,  0,236,  1,  0,  0,
+ 45,  0,  0,  0,240,  1,  0,  0,169,  0,  0,  0, 14,  0,  0,  0, 13,  0,  0,  0,248,  0,  0,  0, 30,  1,  0,  0,222,  3,  0,  0,
+ 30,  1,  0,  0,223,  3,  0,  0,154,  1,  0,  0,224,  3,  0,  0,169,  0,  0,  0,222,  3,  0,  0, 45,  0,  0,  0, 15,  0,  0,  0,
+169,  0,  0,  0,224,  3,  0,  0,154,  1,  0,  0,240,  1,  0,  0,154,  1,  0,  0,223,  3,  0,  0, 30,  1,  0,  0,249,  0,  0,  0,
+104,  0,  0,  0,241,  1,  0,  0,153,  1,  0,  0,239,  1,  0,  0,104,  0,  0,  0,251,  0,  0,  0, 31,  1,  0,  0,225,  3,  0,  0,
+ 31,  1,  0,  0,226,  3,  0,  0,173,  0,  0,  0,227,  3,  0,  0,153,  1,  0,  0,225,  3,  0,  0, 47,  0,  0,  0,238,  1,  0,  0,
+153,  1,  0,  0,227,  3,  0,  0,173,  0,  0,  0, 23,  0,  0,  0,173,  0,  0,  0,226,  3,  0,  0, 31,  1,  0,  0,250,  0,  0,  0,
+ 14,  0,  0,  0, 22,  0,  0,  0,167,  0,  0,  0, 11,  0,  0,  0, 44,  0,  0,  0,242,  1,  0,  0,155,  1,  0,  0,228,  3,  0,  0,
+155,  1,  0,  0,229,  3,  0,  0, 29,  1,  0,  0,230,  3,  0,  0,167,  0,  0,  0,228,  3,  0,  0, 13,  0,  0,  0, 10,  0,  0,  0,
+167,  0,  0,  0,230,  3,  0,  0, 29,  1,  0,  0,246,  0,  0,  0, 29,  1,  0,  0,229,  3,  0,  0,155,  1,  0,  0,243,  1,  0,  0,
+103,  0,  0,  0,247,  0,  0,  0,156,  1,  0,  0,245,  1,  0,  0,103,  0,  0,  0,243,  1,  0,  0,155,  1,  0,  0,231,  3,  0,  0,
+155,  1,  0,  0,232,  3,  0,  0,157,  1,  0,  0,233,  3,  0,  0,156,  1,  0,  0,231,  3,  0,  0, 42,  0,  0,  0,244,  1,  0,  0,
+156,  1,  0,  0,233,  3,  0,  0,157,  1,  0,  0,246,  1,  0,  0,157,  1,  0,  0,232,  3,  0,  0,155,  1,  0,  0,242,  1,  0,  0,
+ 44,  0,  0,  0,247,  1,  0,  0,166,  0,  0,  0,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,162,  0,  0,  0,234,  3,  0,  0,
+162,  0,  0,  0,235,  3,  0,  0,157,  1,  0,  0,236,  3,  0,  0,166,  0,  0,  0,234,  3,  0,  0, 44,  0,  0,  0,  9,  0,  0,  0,
+166,  0,  0,  0,236,  3,  0,  0,157,  1,  0,  0,247,  1,  0,  0,157,  1,  0,  0,235,  3,  0,  0,162,  0,  0,  0,  1,  0,  0,  0,
+ 42,  0,  0,  0,246,  1,  0,  0,156,  1,  0,  0,244,  1,  0,  0, 42,  0,  0,  0,  3,  0,  0,  0,163,  0,  0,  0,237,  3,  0,  0,
+163,  0,  0,  0,238,  3,  0,  0, 28,  1,  0,  0,239,  3,  0,  0,156,  1,  0,  0,237,  3,  0,  0,103,  0,  0,  0,245,  1,  0,  0,
+156,  1,  0,  0,239,  3,  0,  0, 28,  1,  0,  0,245,  0,  0,  0, 28,  1,  0,  0,238,  3,  0,  0,163,  0,  0,  0,  2,  0,  0,  0,
+ 12,  0,  0,  0,244,  0,  0,  0,158,  1,  0,  0,249,  1,  0,  0,105,  0,  0,  0,255,  0,  0,  0, 33,  1,  0,  0,240,  3,  0,  0,
+ 33,  1,  0,  0,241,  3,  0,  0,179,  0,  0,  0,242,  3,  0,  0,158,  1,  0,  0,240,  3,  0,  0, 50,  0,  0,  0,248,  1,  0,  0,
+158,  1,  0,  0,242,  3,  0,  0,179,  0,  0,  0, 35,  0,  0,  0,179,  0,  0,  0,241,  3,  0,  0, 33,  1,  0,  0,254,  0,  0,  0,
+ 16,  0,  0,  0, 34,  0,  0,  0,158,  1,  0,  0,248,  1,  0,  0, 50,  0,  0,  0,251,  1,  0,  0,159,  1,  0,  0,243,  3,  0,  0,
+159,  1,  0,  0,244,  3,  0,  0,160,  1,  0,  0,245,  3,  0,  0,158,  1,  0,  0,243,  3,  0,  0,105,  0,  0,  0,249,  1,  0,  0,
+158,  1,  0,  0,245,  3,  0,  0,160,  1,  0,  0,253,  1,  0,  0,160,  1,  0,  0,244,  3,  0,  0,159,  1,  0,  0,250,  1,  0,  0,
+ 43,  0,  0,  0,252,  1,  0,  0,165,  0,  0,  0,  6,  0,  0,  0, 12,  0,  0,  0,252,  0,  0,  0, 32,  1,  0,  0,246,  3,  0,  0,
+ 32,  1,  0,  0,247,  3,  0,  0,160,  1,  0,  0,248,  3,  0,  0,165,  0,  0,  0,246,  3,  0,  0, 43,  0,  0,  0,  7,  0,  0,  0,
+165,  0,  0,  0,248,  3,  0,  0,160,  1,  0,  0,252,  1,  0,  0,160,  1,  0,  0,247,  3,  0,  0, 32,  1,  0,  0,253,  0,  0,  0,
+105,  0,  0,  0,253,  1,  0,  0,164,  0,  0,  0,  5,  0,  0,  0, 43,  0,  0,  0,250,  1,  0,  0,159,  1,  0,  0,249,  3,  0,  0,
+159,  1,  0,  0,250,  3,  0,  0,178,  0,  0,  0,251,  3,  0,  0,164,  0,  0,  0,249,  3,  0,  0,  1,  0,  0,  0,  4,  0,  0,  0,
+164,  0,  0,  0,251,  3,  0,  0,178,  0,  0,  0, 32,  0,  0,  0,178,  0,  0,  0,250,  3,  0,  0,159,  1,  0,  0,251,  1,  0,  0,
+ 50,  0,  0,  0, 33,  0,  0,  0,161,  1,  0,  0,254,  1,  0,  0,105,  0,  0,  0,253,  0,  0,  0, 32,  1,  0,  0,252,  3,  0,  0,
+ 32,  1,  0,  0,253,  3,  0,  0, 34,  1,  0,  0,254,  3,  0,  0,161,  1,  0,  0,252,  3,  0,  0,106,  0,  0,  0,255,  1,  0,  0,
+161,  1,  0,  0,254,  3,  0,  0, 34,  1,  0,  0,  1,  1,  0,  0, 34,  1,  0,  0,253,  3,  0,  0, 32,  1,  0,  0,252,  0,  0,  0,
+ 12,  0,  0,  0,  0,  1,  0,  0,161,  1,  0,  0,255,  1,  0,  0,106,  0,  0,  0,  0,  2,  0,  0,162,  1,  0,  0,255,  3,  0,  0,
+162,  1,  0,  0,  0,  4,  0,  0,163,  1,  0,  0,  1,  4,  0,  0,161,  1,  0,  0,255,  3,  0,  0,105,  0,  0,  0,254,  1,  0,  0,
+161,  1,  0,  0,  1,  4,  0,  0,163,  1,  0,  0,  2,  2,  0,  0,163,  1,  0,  0,  0,  4,  0,  0,162,  1,  0,  0,  1,  2,  0,  0,
+107,  0,  0,  0,  3,  2,  0,  0, 37,  1,  0,  0,  6,  1,  0,  0, 16,  0,  0,  0,254,  0,  0,  0, 33,  1,  0,  0,  2,  4,  0,  0,
+ 33,  1,  0,  0,  3,  4,  0,  0,163,  1,  0,  0,  4,  4,  0,  0, 37,  1,  0,  0,  2,  4,  0,  0,107,  0,  0,  0,  7,  1,  0,  0,
+ 37,  1,  0,  0,  4,  4,  0,  0,163,  1,  0,  0,  3,  2,  0,  0,163,  1,  0,  0,  3,  4,  0,  0, 33,  1,  0,  0,255,  0,  0,  0,
+105,  0,  0,  0,  2,  2,  0,  0, 36,  1,  0,  0,  5,  1,  0,  0,107,  0,  0,  0,  1,  2,  0,  0,162,  1,  0,  0,  5,  4,  0,  0,
+162,  1,  0,  0,  6,  4,  0,  0, 35,  1,  0,  0,  7,  4,  0,  0, 36,  1,  0,  0,  5,  4,  0,  0, 15,  0,  0,  0,  4,  1,  0,  0,
+ 36,  1,  0,  0,  7,  4,  0,  0, 35,  1,  0,  0,  2,  1,  0,  0, 35,  1,  0,  0,  6,  4,  0,  0,162,  1,  0,  0,  0,  2,  0,  0,
+106,  0,  0,  0,  3,  1,  0,  0,164,  1,  0,  0,  4,  2,  0,  0, 49,  0,  0,  0, 29,  0,  0,  0,176,  0,  0,  0,  8,  4,  0,  0,
+176,  0,  0,  0,  9,  4,  0,  0,180,  0,  0,  0, 10,  4,  0,  0,164,  1,  0,  0,  8,  4,  0,  0, 51,  0,  0,  0,  5,  2,  0,  0,
+164,  1,  0,  0, 10,  4,  0,  0,180,  0,  0,  0, 37,  0,  0,  0,180,  0,  0,  0,  9,  4,  0,  0,176,  0,  0,  0, 28,  0,  0,  0,
+  5,  0,  0,  0, 36,  0,  0,  0,164,  1,  0,  0,  5,  2,  0,  0, 51,  0,  0,  0,  6,  2,  0,  0,165,  1,  0,  0, 11,  4,  0,  0,
+165,  1,  0,  0, 12,  4,  0,  0,166,  1,  0,  0, 13,  4,  0,  0,164,  1,  0,  0, 11,  4,  0,  0, 49,  0,  0,  0,  4,  2,  0,  0,
+164,  1,  0,  0, 13,  4,  0,  0,166,  1,  0,  0,  8,  2,  0,  0,166,  1,  0,  0, 12,  4,  0,  0,165,  1,  0,  0,  7,  2,  0,  0,
+107,  0,  0,  0,  9,  2,  0,  0, 36,  1,  0,  0,  4,  1,  0,  0, 15,  0,  0,  0, 30,  0,  0,  0,177,  0,  0,  0, 14,  4,  0,  0,
+177,  0,  0,  0, 15,  4,  0,  0,166,  1,  0,  0, 16,  4,  0,  0, 36,  1,  0,  0, 14,  4,  0,  0,107,  0,  0,  0,  5,  1,  0,  0,
+ 36,  1,  0,  0, 16,  4,  0,  0,166,  1,  0,  0,  9,  2,  0,  0,166,  1,  0,  0, 15,  4,  0,  0,177,  0,  0,  0, 31,  0,  0,  0,
+ 49,  0,  0,  0,  8,  2,  0,  0, 37,  1,  0,  0,  7,  1,  0,  0,107,  0,  0,  0,  7,  2,  0,  0,165,  1,  0,  0, 17,  4,  0,  0,
+165,  1,  0,  0, 18,  4,  0,  0,181,  0,  0,  0, 19,  4,  0,  0, 37,  1,  0,  0, 17,  4,  0,  0, 16,  0,  0,  0,  6,  1,  0,  0,
+ 37,  1,  0,  0, 19,  4,  0,  0,181,  0,  0,  0, 38,  0,  0,  0,181,  0,  0,  0, 18,  4,  0,  0,165,  1,  0,  0,  6,  2,  0,  0,
+ 51,  0,  0,  0, 39,  0,  0,  0,167,  1,  0,  0, 10,  2,  0,  0, 48,  0,  0,  0, 27,  0,  0,  0,175,  0,  0,  0, 20,  4,  0,  0,
+175,  0,  0,  0, 21,  4,  0,  0, 35,  1,  0,  0, 22,  4,  0,  0,167,  1,  0,  0, 20,  4,  0,  0,106,  0,  0,  0, 11,  2,  0,  0,
+167,  1,  0,  0, 22,  4,  0,  0, 35,  1,  0,  0,  3,  1,  0,  0, 35,  1,  0,  0, 21,  4,  0,  0,175,  0,  0,  0, 26,  0,  0,  0,
+ 15,  0,  0,  0,  2,  1,  0,  0,167,  1,  0,  0, 11,  2,  0,  0,106,  0,  0,  0, 13,  2,  0,  0,168,  1,  0,  0, 23,  4,  0,  0,
+168,  1,  0,  0, 24,  4,  0,  0,169,  1,  0,  0, 25,  4,  0,  0,167,  1,  0,  0, 23,  4,  0,  0, 48,  0,  0,  0, 10,  2,  0,  0,
+167,  1,  0,  0, 25,  4,  0,  0,169,  1,  0,  0, 15,  2,  0,  0,169,  1,  0,  0, 24,  4,  0,  0,168,  1,  0,  0, 12,  2,  0,  0,
+ 42,  0,  0,  0, 14,  2,  0,  0,162,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24,  0,  0,  0,174,  0,  0,  0, 26,  4,  0,  0,
+174,  0,  0,  0, 27,  4,  0,  0,169,  1,  0,  0, 28,  4,  0,  0,162,  0,  0,  0, 26,  4,  0,  0, 42,  0,  0,  0,  1,  0,  0,  0,
+162,  0,  0,  0, 28,  4,  0,  0,169,  1,  0,  0, 14,  2,  0,  0,169,  1,  0,  0, 27,  4,  0,  0,174,  0,  0,  0, 25,  0,  0,  0,
+ 48,  0,  0,  0, 15,  2,  0,  0,163,  0,  0,  0,  3,  0,  0,  0, 42,  0,  0,  0, 12,  2,  0,  0,168,  1,  0,  0, 29,  4,  0,  0,
+168,  1,  0,  0, 30,  4,  0,  0, 34,  1,  0,  0, 31,  4,  0,  0,163,  0,  0,  0, 29,  4,  0,  0, 12,  0,  0,  0,  2,  0,  0,  0,
+163,  0,  0,  0, 31,  4,  0,  0, 34,  1,  0,  0,  0,  1,  0,  0, 34,  1,  0,  0, 30,  4,  0,  0,168,  1,  0,  0, 13,  2,  0,  0,
+106,  0,  0,  0,  1,  1,  0,  0, 39,  1,  0,  0, 11,  1,  0,  0,108,  0,  0,  0, 17,  2,  0,  0,170,  1,  0,  0, 32,  4,  0,  0,
+170,  1,  0,  0, 33,  4,  0,  0,187,  0,  0,  0, 34,  4,  0,  0, 39,  1,  0,  0, 32,  4,  0,  0, 18,  0,  0,  0, 10,  1,  0,  0,
+ 39,  1,  0,  0, 34,  4,  0,  0,187,  0,  0,  0, 50,  0,  0,  0,187,  0,  0,  0, 33,  4,  0,  0,170,  1,  0,  0, 16,  2,  0,  0,
+ 54,  0,  0,  0, 51,  0,  0,  0,171,  1,  0,  0, 19,  2,  0,  0, 54,  0,  0,  0, 16,  2,  0,  0,170,  1,  0,  0, 35,  4,  0,  0,
+170,  1,  0,  0, 36,  4,  0,  0,172,  1,  0,  0, 37,  4,  0,  0,171,  1,  0,  0, 35,  4,  0,  0, 45,  0,  0,  0, 18,  2,  0,  0,
+171,  1,  0,  0, 37,  4,  0,  0,172,  1,  0,  0, 20,  2,  0,  0,172,  1,  0,  0, 36,  4,  0,  0,170,  1,  0,  0, 17,  2,  0,  0,
+108,  0,  0,  0, 21,  2,  0,  0, 38,  1,  0,  0,  8,  1,  0,  0, 13,  0,  0,  0, 14,  0,  0,  0,169,  0,  0,  0, 38,  4,  0,  0,
+169,  0,  0,  0, 39,  4,  0,  0,172,  1,  0,  0, 40,  4,  0,  0, 38,  1,  0,  0, 38,  4,  0,  0,108,  0,  0,  0,  9,  1,  0,  0,
+ 38,  1,  0,  0, 40,  4,  0,  0,172,  1,  0,  0, 21,  2,  0,  0,172,  1,  0,  0, 39,  4,  0,  0,169,  0,  0,  0, 15,  0,  0,  0,
+ 45,  0,  0,  0, 20,  2,  0,  0,171,  1,  0,  0, 18,  2,  0,  0, 45,  0,  0,  0, 13,  0,  0,  0,168,  0,  0,  0, 41,  4,  0,  0,
+168,  0,  0,  0, 42,  4,  0,  0,186,  0,  0,  0, 43,  4,  0,  0,171,  1,  0,  0, 41,  4,  0,  0, 54,  0,  0,  0, 19,  2,  0,  0,
+171,  1,  0,  0, 43,  4,  0,  0,186,  0,  0,  0, 49,  0,  0,  0,186,  0,  0,  0, 42,  4,  0,  0,168,  0,  0,  0, 12,  0,  0,  0,
+  2,  0,  0,  0, 48,  0,  0,  0, 38,  1,  0,  0,  9,  1,  0,  0,108,  0,  0,  0, 22,  2,  0,  0,173,  1,  0,  0, 44,  4,  0,  0,
+173,  1,  0,  0, 45,  4,  0,  0, 40,  1,  0,  0, 46,  4,  0,  0, 38,  1,  0,  0, 44,  4,  0,  0, 13,  0,  0,  0,  8,  1,  0,  0,
+ 38,  1,  0,  0, 46,  4,  0,  0, 40,  1,  0,  0, 12,  1,  0,  0, 40,  1,  0,  0, 45,  4,  0,  0,173,  1,  0,  0, 23,  2,  0,  0,
+109,  0,  0,  0, 13,  1,  0,  0,174,  1,  0,  0, 24,  2,  0,  0,109,  0,  0,  0, 23,  2,  0,  0,173,  1,  0,  0, 47,  4,  0,  0,
+173,  1,  0,  0, 48,  4,  0,  0,175,  1,  0,  0, 49,  4,  0,  0,174,  1,  0,  0, 47,  4,  0,  0,110,  0,  0,  0, 25,  2,  0,  0,
+174,  1,  0,  0, 49,  4,  0,  0,175,  1,  0,  0, 27,  2,  0,  0,175,  1,  0,  0, 48,  4,  0,  0,173,  1,  0,  0, 22,  2,  0,  0,
+108,  0,  0,  0, 26,  2,  0,  0, 39,  1,  0,  0, 10,  1,  0,  0, 18,  0,  0,  0, 18,  1,  0,  0, 43,  1,  0,  0, 50,  4,  0,  0,
+ 43,  1,  0,  0, 51,  4,  0,  0,175,  1,  0,  0, 52,  4,  0,  0, 39,  1,  0,  0, 50,  4,  0,  0,108,  0,  0,  0, 11,  1,  0,  0,
+ 39,  1,  0,  0, 52,  4,  0,  0,175,  1,  0,  0, 26,  2,  0,  0,175,  1,  0,  0, 51,  4,  0,  0, 43,  1,  0,  0, 19,  1,  0,  0,
+110,  0,  0,  0, 27,  2,  0,  0,174,  1,  0,  0, 25,  2,  0,  0,110,  0,  0,  0, 17,  1,  0,  0, 42,  1,  0,  0, 53,  4,  0,  0,
+ 42,  1,  0,  0, 54,  4,  0,  0, 41,  1,  0,  0, 55,  4,  0,  0,174,  1,  0,  0, 53,  4,  0,  0,109,  0,  0,  0, 24,  2,  0,  0,
+174,  1,  0,  0, 55,  4,  0,  0, 41,  1,  0,  0, 15,  1,  0,  0, 41,  1,  0,  0, 54,  4,  0,  0, 42,  1,  0,  0, 16,  1,  0,  0,
+ 17,  0,  0,  0, 14,  1,  0,  0,184,  0,  0,  0, 45,  0,  0,  0, 53,  0,  0,  0, 28,  2,  0,  0,176,  1,  0,  0, 56,  4,  0,  0,
+176,  1,  0,  0, 57,  4,  0,  0,188,  0,  0,  0, 58,  4,  0,  0,184,  0,  0,  0, 56,  4,  0,  0,  3,  0,  0,  0, 44,  0,  0,  0,
+184,  0,  0,  0, 58,  4,  0,  0,188,  0,  0,  0, 52,  0,  0,  0,188,  0,  0,  0, 57,  4,  0,  0,176,  1,  0,  0, 29,  2,  0,  0,
+ 55,  0,  0,  0, 53,  0,  0,  0,177,  1,  0,  0, 30,  2,  0,  0, 55,  0,  0,  0, 29,  2,  0,  0,176,  1,  0,  0, 59,  4,  0,  0,
+176,  1,  0,  0, 60,  4,  0,  0,178,  1,  0,  0, 61,  4,  0,  0,177,  1,  0,  0, 59,  4,  0,  0,110,  0,  0,  0, 31,  2,  0,  0,
+177,  1,  0,  0, 61,  4,  0,  0,178,  1,  0,  0, 33,  2,  0,  0,178,  1,  0,  0, 60,  4,  0,  0,176,  1,  0,  0, 28,  2,  0,  0,
+ 53,  0,  0,  0, 32,  2,  0,  0,185,  0,  0,  0, 46,  0,  0,  0, 17,  0,  0,  0, 16,  1,  0,  0, 42,  1,  0,  0, 62,  4,  0,  0,
+ 42,  1,  0,  0, 63,  4,  0,  0,178,  1,  0,  0, 64,  4,  0,  0,185,  0,  0,  0, 62,  4,  0,  0, 53,  0,  0,  0, 47,  0,  0,  0,
+185,  0,  0,  0, 64,  4,  0,  0,178,  1,  0,  0, 32,  2,  0,  0,178,  1,  0,  0, 63,  4,  0,  0, 42,  1,  0,  0, 17,  1,  0,  0,
+110,  0,  0,  0, 33,  2,  0,  0,177,  1,  0,  0, 31,  2,  0,  0,110,  0,  0,  0, 19,  1,  0,  0, 43,  1,  0,  0, 65,  4,  0,  0,
+ 43,  1,  0,  0, 66,  4,  0,  0,189,  0,  0,  0, 67,  4,  0,  0,177,  1,  0,  0, 65,  4,  0,  0, 55,  0,  0,  0, 30,  2,  0,  0,
+177,  1,  0,  0, 67,  4,  0,  0,189,  0,  0,  0, 55,  0,  0,  0,189,  0,  0,  0, 66,  4,  0,  0, 43,  1,  0,  0, 18,  1,  0,  0,
+ 18,  0,  0,  0, 54,  0,  0,  0,183,  0,  0,  0, 43,  0,  0,  0, 52,  0,  0,  0, 34,  2,  0,  0,179,  1,  0,  0, 68,  4,  0,  0,
+179,  1,  0,  0, 69,  4,  0,  0, 41,  1,  0,  0, 70,  4,  0,  0,183,  0,  0,  0, 68,  4,  0,  0, 17,  0,  0,  0, 42,  0,  0,  0,
+183,  0,  0,  0, 70,  4,  0,  0, 41,  1,  0,  0, 14,  1,  0,  0, 41,  1,  0,  0, 69,  4,  0,  0,179,  1,  0,  0, 35,  2,  0,  0,
+109,  0,  0,  0, 15,  1,  0,  0,180,  1,  0,  0, 37,  2,  0,  0,109,  0,  0,  0, 35,  2,  0,  0,179,  1,  0,  0, 71,  4,  0,  0,
+179,  1,  0,  0, 72,  4,  0,  0,181,  1,  0,  0, 73,  4,  0,  0,180,  1,  0,  0, 71,  4,  0,  0, 44,  0,  0,  0, 36,  2,  0,  0,
+180,  1,  0,  0, 73,  4,  0,  0,181,  1,  0,  0, 38,  2,  0,  0,181,  1,  0,  0, 72,  4,  0,  0,179,  1,  0,  0, 34,  2,  0,  0,
+ 52,  0,  0,  0, 39,  2,  0,  0,182,  0,  0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  8,  0,  0,  0,166,  0,  0,  0, 74,  4,  0,  0,
+166,  0,  0,  0, 75,  4,  0,  0,181,  1,  0,  0, 76,  4,  0,  0,182,  0,  0,  0, 74,  4,  0,  0, 52,  0,  0,  0, 41,  0,  0,  0,
+182,  0,  0,  0, 76,  4,  0,  0,181,  1,  0,  0, 39,  2,  0,  0,181,  1,  0,  0, 75,  4,  0,  0,166,  0,  0,  0,  9,  0,  0,  0,
+ 44,  0,  0,  0, 38,  2,  0,  0,180,  1,  0,  0, 36,  2,  0,  0, 44,  0,  0,  0, 11,  0,  0,  0,167,  0,  0,  0, 77,  4,  0,  0,
+167,  0,  0,  0, 78,  4,  0,  0, 40,  1,  0,  0, 79,  4,  0,  0,180,  1,  0,  0, 77,  4,  0,  0,109,  0,  0,  0, 37,  2,  0,  0,
+180,  1,  0,  0, 79,  4,  0,  0, 40,  1,  0,  0, 13,  1,  0,  0, 40,  1,  0,  0, 78,  4,  0,  0,167,  0,  0,  0, 10,  0,  0,  0,
+ 13,  0,  0,  0, 12,  1,  0,  0, 45,  1,  0,  0, 23,  1,  0,  0,111,  0,  0,  0, 41,  2,  0,  0,182,  1,  0,  0, 80,  4,  0,  0,
+182,  1,  0,  0, 81,  4,  0,  0,195,  0,  0,  0, 82,  4,  0,  0, 45,  1,  0,  0, 80,  4,  0,  0, 20,  0,  0,  0, 22,  1,  0,  0,
+ 45,  1,  0,  0, 82,  4,  0,  0,195,  0,  0,  0, 66,  0,  0,  0,195,  0,  0,  0, 81,  4,  0,  0,182,  1,  0,  0, 40,  2,  0,  0,
+ 58,  0,  0,  0, 67,  0,  0,  0,183,  1,  0,  0, 43,  2,  0,  0, 58,  0,  0,  0, 40,  2,  0,  0,182,  1,  0,  0, 83,  4,  0,  0,
+182,  1,  0,  0, 84,  4,  0,  0,184,  1,  0,  0, 85,  4,  0,  0,183,  1,  0,  0, 83,  4,  0,  0, 53,  0,  0,  0, 42,  2,  0,  0,
+183,  1,  0,  0, 85,  4,  0,  0,184,  1,  0,  0, 44,  2,  0,  0,184,  1,  0,  0, 84,  4,  0,  0,182,  1,  0,  0, 41,  2,  0,  0,
+111,  0,  0,  0, 45,  2,  0,  0, 44,  1,  0,  0, 20,  1,  0,  0, 17,  0,  0,  0, 46,  0,  0,  0,185,  0,  0,  0, 86,  4,  0,  0,
+185,  0,  0,  0, 87,  4,  0,  0,184,  1,  0,  0, 88,  4,  0,  0, 44,  1,  0,  0, 86,  4,  0,  0,111,  0,  0,  0, 21,  1,  0,  0,
+ 44,  1,  0,  0, 88,  4,  0,  0,184,  1,  0,  0, 45,  2,  0,  0,184,  1,  0,  0, 87,  4,  0,  0,185,  0,  0,  0, 47,  0,  0,  0,
+ 53,  0,  0,  0, 44,  2,  0,  0,183,  1,  0,  0, 42,  2,  0,  0, 53,  0,  0,  0, 45,  0,  0,  0,184,  0,  0,  0, 89,  4,  0,  0,
+184,  0,  0,  0, 90,  4,  0,  0,194,  0,  0,  0, 91,  4,  0,  0,183,  1,  0,  0, 89,  4,  0,  0, 58,  0,  0,  0, 43,  2,  0,  0,
+183,  1,  0,  0, 91,  4,  0,  0,194,  0,  0,  0, 65,  0,  0,  0,194,  0,  0,  0, 90,  4,  0,  0,184,  0,  0,  0, 44,  0,  0,  0,
+  3,  0,  0,  0, 64,  0,  0,  0, 44,  1,  0,  0, 21,  1,  0,  0,111,  0,  0,  0, 46,  2,  0,  0,185,  1,  0,  0, 92,  4,  0,  0,
+185,  1,  0,  0, 93,  4,  0,  0, 46,  1,  0,  0, 94,  4,  0,  0, 44,  1,  0,  0, 92,  4,  0,  0, 17,  0,  0,  0, 20,  1,  0,  0,
+ 44,  1,  0,  0, 94,  4,  0,  0, 46,  1,  0,  0, 24,  1,  0,  0, 46,  1,  0,  0, 93,  4,  0,  0,185,  1,  0,  0, 47,  2,  0,  0,
+112,  0,  0,  0, 25,  1,  0,  0,186,  1,  0,  0, 48,  2,  0,  0,112,  0,  0,  0, 47,  2,  0,  0,185,  1,  0,  0, 95,  4,  0,  0,
+185,  1,  0,  0, 96,  4,  0,  0,187,  1,  0,  0, 97,  4,  0,  0,186,  1,  0,  0, 95,  4,  0,  0,113,  0,  0,  0, 49,  2,  0,  0,
+186,  1,  0,  0, 97,  4,  0,  0,187,  1,  0,  0, 51,  2,  0,  0,187,  1,  0,  0, 96,  4,  0,  0,185,  1,  0,  0, 46,  2,  0,  0,
+111,  0,  0,  0, 50,  2,  0,  0, 45,  1,  0,  0, 22,  1,  0,  0, 20,  0,  0,  0, 30,  1,  0,  0, 49,  1,  0,  0, 98,  4,  0,  0,
+ 49,  1,  0,  0, 99,  4,  0,  0,187,  1,  0,  0,100,  4,  0,  0, 45,  1,  0,  0, 98,  4,  0,  0,111,  0,  0,  0, 23,  1,  0,  0,
+ 45,  1,  0,  0,100,  4,  0,  0,187,  1,  0,  0, 50,  2,  0,  0,187,  1,  0,  0, 99,  4,  0,  0, 49,  1,  0,  0, 31,  1,  0,  0,
+113,  0,  0,  0, 51,  2,  0,  0,186,  1,  0,  0, 49,  2,  0,  0,113,  0,  0,  0, 29,  1,  0,  0, 48,  1,  0,  0,101,  4,  0,  0,
+ 48,  1,  0,  0,102,  4,  0,  0, 47,  1,  0,  0,103,  4,  0,  0,186,  1,  0,  0,101,  4,  0,  0,112,  0,  0,  0, 48,  2,  0,  0,
+186,  1,  0,  0,103,  4,  0,  0, 47,  1,  0,  0, 27,  1,  0,  0, 47,  1,  0,  0,102,  4,  0,  0, 48,  1,  0,  0, 28,  1,  0,  0,
+ 19,  0,  0,  0, 26,  1,  0,  0,192,  0,  0,  0, 61,  0,  0,  0, 57,  0,  0,  0, 52,  2,  0,  0,188,  1,  0,  0,104,  4,  0,  0,
+188,  1,  0,  0,105,  4,  0,  0,196,  0,  0,  0,106,  4,  0,  0,192,  0,  0,  0,104,  4,  0,  0,  4,  0,  0,  0, 60,  0,  0,  0,
+192,  0,  0,  0,106,  4,  0,  0,196,  0,  0,  0, 68,  0,  0,  0,196,  0,  0,  0,105,  4,  0,  0,188,  1,  0,  0, 53,  2,  0,  0,
+ 59,  0,  0,  0, 69,  0,  0,  0,189,  1,  0,  0, 54,  2,  0,  0, 59,  0,  0,  0, 53,  2,  0,  0,188,  1,  0,  0,107,  4,  0,  0,
+188,  1,  0,  0,108,  4,  0,  0,190,  1,  0,  0,109,  4,  0,  0,189,  1,  0,  0,107,  4,  0,  0,113,  0,  0,  0, 55,  2,  0,  0,
+189,  1,  0,  0,109,  4,  0,  0,190,  1,  0,  0, 57,  2,  0,  0,190,  1,  0,  0,108,  4,  0,  0,188,  1,  0,  0, 52,  2,  0,  0,
+ 57,  0,  0,  0, 56,  2,  0,  0,193,  0,  0,  0, 62,  0,  0,  0, 19,  0,  0,  0, 28,  1,  0,  0, 48,  1,  0,  0,110,  4,  0,  0,
+ 48,  1,  0,  0,111,  4,  0,  0,190,  1,  0,  0,112,  4,  0,  0,193,  0,  0,  0,110,  4,  0,  0, 57,  0,  0,  0, 63,  0,  0,  0,
+193,  0,  0,  0,112,  4,  0,  0,190,  1,  0,  0, 56,  2,  0,  0,190,  1,  0,  0,111,  4,  0,  0, 48,  1,  0,  0, 29,  1,  0,  0,
+113,  0,  0,  0, 57,  2,  0,  0,189,  1,  0,  0, 55,  2,  0,  0,113,  0,  0,  0, 31,  1,  0,  0, 49,  1,  0,  0,113,  4,  0,  0,
+ 49,  1,  0,  0,114,  4,  0,  0,197,  0,  0,  0,115,  4,  0,  0,189,  1,  0,  0,113,  4,  0,  0, 59,  0,  0,  0, 54,  2,  0,  0,
+189,  1,  0,  0,115,  4,  0,  0,197,  0,  0,  0, 71,  0,  0,  0,197,  0,  0,  0,114,  4,  0,  0, 49,  1,  0,  0, 30,  1,  0,  0,
+ 20,  0,  0,  0, 70,  0,  0,  0,191,  0,  0,  0, 59,  0,  0,  0, 56,  0,  0,  0, 58,  2,  0,  0,191,  1,  0,  0,116,  4,  0,  0,
+191,  1,  0,  0,117,  4,  0,  0, 47,  1,  0,  0,118,  4,  0,  0,191,  0,  0,  0,116,  4,  0,  0, 19,  0,  0,  0, 58,  0,  0,  0,
+191,  0,  0,  0,118,  4,  0,  0, 47,  1,  0,  0, 26,  1,  0,  0, 47,  1,  0,  0,117,  4,  0,  0,191,  1,  0,  0, 59,  2,  0,  0,
+112,  0,  0,  0, 27,  1,  0,  0,192,  1,  0,  0, 61,  2,  0,  0,112,  0,  0,  0, 59,  2,  0,  0,191,  1,  0,  0,119,  4,  0,  0,
+191,  1,  0,  0,120,  4,  0,  0,193,  1,  0,  0,121,  4,  0,  0,192,  1,  0,  0,119,  4,  0,  0, 52,  0,  0,  0, 60,  2,  0,  0,
+192,  1,  0,  0,121,  4,  0,  0,193,  1,  0,  0, 62,  2,  0,  0,193,  1,  0,  0,120,  4,  0,  0,191,  1,  0,  0, 58,  2,  0,  0,
+ 56,  0,  0,  0, 63,  2,  0,  0,190,  0,  0,  0, 56,  0,  0,  0,  0,  0,  0,  0, 40,  0,  0,  0,182,  0,  0,  0,122,  4,  0,  0,
+182,  0,  0,  0,123,  4,  0,  0,193,  1,  0,  0,124,  4,  0,  0,190,  0,  0,  0,122,  4,  0,  0, 56,  0,  0,  0, 57,  0,  0,  0,
+190,  0,  0,  0,124,  4,  0,  0,193,  1,  0,  0, 63,  2,  0,  0,193,  1,  0,  0,123,  4,  0,  0,182,  0,  0,  0, 41,  0,  0,  0,
+ 52,  0,  0,  0, 62,  2,  0,  0,192,  1,  0,  0, 60,  2,  0,  0, 52,  0,  0,  0, 43,  0,  0,  0,183,  0,  0,  0,125,  4,  0,  0,
+183,  0,  0,  0,126,  4,  0,  0, 46,  1,  0,  0,127,  4,  0,  0,192,  1,  0,  0,125,  4,  0,  0,112,  0,  0,  0, 61,  2,  0,  0,
+192,  1,  0,  0,127,  4,  0,  0, 46,  1,  0,  0, 25,  1,  0,  0, 46,  1,  0,  0,126,  4,  0,  0,183,  0,  0,  0, 42,  0,  0,  0,
+ 17,  0,  0,  0, 24,  1,  0,  0, 51,  1,  0,  0, 35,  1,  0,  0,114,  0,  0,  0, 65,  2,  0,  0,194,  1,  0,  0,128,  4,  0,  0,
+194,  1,  0,  0,129,  4,  0,  0,199,  0,  0,  0,130,  4,  0,  0, 51,  1,  0,  0,128,  4,  0,  0, 21,  0,  0,  0, 34,  1,  0,  0,
+ 51,  1,  0,  0,130,  4,  0,  0,199,  0,  0,  0, 74,  0,  0,  0,199,  0,  0,  0,129,  4,  0,  0,194,  1,  0,  0, 64,  2,  0,  0,
+ 60,  0,  0,  0, 75,  0,  0,  0,195,  1,  0,  0, 67,  2,  0,  0, 60,  0,  0,  0, 64,  2,  0,  0,194,  1,  0,  0,131,  4,  0,  0,
+194,  1,  0,  0,132,  4,  0,  0,196,  1,  0,  0,133,  4,  0,  0,195,  1,  0,  0,131,  4,  0,  0, 57,  0,  0,  0, 66,  2,  0,  0,
+195,  1,  0,  0,133,  4,  0,  0,196,  1,  0,  0, 68,  2,  0,  0,196,  1,  0,  0,132,  4,  0,  0,194,  1,  0,  0, 65,  2,  0,  0,
+114,  0,  0,  0, 69,  2,  0,  0, 50,  1,  0,  0, 32,  1,  0,  0, 19,  0,  0,  0, 62,  0,  0,  0,193,  0,  0,  0,134,  4,  0,  0,
+193,  0,  0,  0,135,  4,  0,  0,196,  1,  0,  0,136,  4,  0,  0, 50,  1,  0,  0,134,  4,  0,  0,114,  0,  0,  0, 33,  1,  0,  0,
+ 50,  1,  0,  0,136,  4,  0,  0,196,  1,  0,  0, 69,  2,  0,  0,196,  1,  0,  0,135,  4,  0,  0,193,  0,  0,  0, 63,  0,  0,  0,
+ 57,  0,  0,  0, 68,  2,  0,  0,195,  1,  0,  0, 66,  2,  0,  0, 57,  0,  0,  0, 61,  0,  0,  0,192,  0,  0,  0,137,  4,  0,  0,
+192,  0,  0,  0,138,  4,  0,  0,198,  0,  0,  0,139,  4,  0,  0,195,  1,  0,  0,137,  4,  0,  0, 60,  0,  0,  0, 67,  2,  0,  0,
+195,  1,  0,  0,139,  4,  0,  0,198,  0,  0,  0, 73,  0,  0,  0,198,  0,  0,  0,138,  4,  0,  0,192,  0,  0,  0, 60,  0,  0,  0,
+  4,  0,  0,  0, 72,  0,  0,  0, 50,  1,  0,  0, 33,  1,  0,  0,114,  0,  0,  0, 70,  2,  0,  0,197,  1,  0,  0,140,  4,  0,  0,
+197,  1,  0,  0,141,  4,  0,  0, 53,  1,  0,  0,142,  4,  0,  0, 50,  1,  0,  0,140,  4,  0,  0, 19,  0,  0,  0, 32,  1,  0,  0,
+ 50,  1,  0,  0,142,  4,  0,  0, 53,  1,  0,  0, 38,  1,  0,  0, 53,  1,  0,  0,141,  4,  0,  0,197,  1,  0,  0, 71,  2,  0,  0,
+115,  0,  0,  0, 39,  1,  0,  0,198,  1,  0,  0, 72,  2,  0,  0,115,  0,  0,  0, 71,  2,  0,  0,197,  1,  0,  0,143,  4,  0,  0,
+197,  1,  0,  0,144,  4,  0,  0,199,  1,  0,  0,145,  4,  0,  0,198,  1,  0,  0,143,  4,  0,  0,116,  0,  0,  0, 73,  2,  0,  0,
+198,  1,  0,  0,145,  4,  0,  0,199,  1,  0,  0, 75,  2,  0,  0,199,  1,  0,  0,144,  4,  0,  0,197,  1,  0,  0, 70,  2,  0,  0,
+114,  0,  0,  0, 74,  2,  0,  0, 51,  1,  0,  0, 34,  1,  0,  0, 21,  0,  0,  0, 42,  1,  0,  0, 55,  1,  0,  0,146,  4,  0,  0,
+ 55,  1,  0,  0,147,  4,  0,  0,199,  1,  0,  0,148,  4,  0,  0, 51,  1,  0,  0,146,  4,  0,  0,114,  0,  0,  0, 35,  1,  0,  0,
+ 51,  1,  0,  0,148,  4,  0,  0,199,  1,  0,  0, 74,  2,  0,  0,199,  1,  0,  0,147,  4,  0,  0, 55,  1,  0,  0, 43,  1,  0,  0,
+116,  0,  0,  0, 75,  2,  0,  0,198,  1,  0,  0, 73,  2,  0,  0,116,  0,  0,  0, 41,  1,  0,  0, 54,  1,  0,  0,149,  4,  0,  0,
+ 54,  1,  0,  0,150,  4,  0,  0, 52,  1,  0,  0,151,  4,  0,  0,198,  1,  0,  0,149,  4,  0,  0,115,  0,  0,  0, 72,  2,  0,  0,
+198,  1,  0,  0,151,  4,  0,  0, 52,  1,  0,  0, 37,  1,  0,  0, 52,  1,  0,  0,150,  4,  0,  0, 54,  1,  0,  0, 40,  1,  0,  0,
+ 15,  0,  0,  0, 36,  1,  0,  0,176,  0,  0,  0, 29,  0,  0,  0, 49,  0,  0,  0, 76,  2,  0,  0,200,  1,  0,  0,152,  4,  0,  0,
+200,  1,  0,  0,153,  4,  0,  0,200,  0,  0,  0,154,  4,  0,  0,176,  0,  0,  0,152,  4,  0,  0,  5,  0,  0,  0, 28,  0,  0,  0,
+176,  0,  0,  0,154,  4,  0,  0,200,  0,  0,  0, 76,  0,  0,  0,200,  0,  0,  0,153,  4,  0,  0,200,  1,  0,  0, 77,  2,  0,  0,
+ 61,  0,  0,  0, 77,  0,  0,  0,201,  1,  0,  0, 78,  2,  0,  0, 61,  0,  0,  0, 77,  2,  0,  0,200,  1,  0,  0,155,  4,  0,  0,
+200,  1,  0,  0,156,  4,  0,  0,202,  1,  0,  0,157,  4,  0,  0,201,  1,  0,  0,155,  4,  0,  0,116,  0,  0,  0, 79,  2,  0,  0,
+201,  1,  0,  0,157,  4,  0,  0,202,  1,  0,  0, 81,  2,  0,  0,202,  1,  0,  0,156,  4,  0,  0,200,  1,  0,  0, 76,  2,  0,  0,
+ 49,  0,  0,  0, 80,  2,  0,  0,177,  0,  0,  0, 30,  0,  0,  0, 15,  0,  0,  0, 40,  1,  0,  0, 54,  1,  0,  0,158,  4,  0,  0,
+ 54,  1,  0,  0,159,  4,  0,  0,202,  1,  0,  0,160,  4,  0,  0,177,  0,  0,  0,158,  4,  0,  0, 49,  0,  0,  0, 31,  0,  0,  0,
+177,  0,  0,  0,160,  4,  0,  0,202,  1,  0,  0, 80,  2,  0,  0,202,  1,  0,  0,159,  4,  0,  0, 54,  1,  0,  0, 41,  1,  0,  0,
+116,  0,  0,  0, 81,  2,  0,  0,201,  1,  0,  0, 79,  2,  0,  0,116,  0,  0,  0, 43,  1,  0,  0, 55,  1,  0,  0,161,  4,  0,  0,
+ 55,  1,  0,  0,162,  4,  0,  0,201,  0,  0,  0,163,  4,  0,  0,201,  1,  0,  0,161,  4,  0,  0, 61,  0,  0,  0, 78,  2,  0,  0,
+201,  1,  0,  0,163,  4,  0,  0,201,  0,  0,  0, 79,  0,  0,  0,201,  0,  0,  0,162,  4,  0,  0, 55,  1,  0,  0, 42,  1,  0,  0,
+ 21,  0,  0,  0, 78,  0,  0,  0,175,  0,  0,  0, 27,  0,  0,  0, 48,  0,  0,  0, 82,  2,  0,  0,203,  1,  0,  0,164,  4,  0,  0,
+203,  1,  0,  0,165,  4,  0,  0, 52,  1,  0,  0,166,  4,  0,  0,175,  0,  0,  0,164,  4,  0,  0, 15,  0,  0,  0, 26,  0,  0,  0,
+175,  0,  0,  0,166,  4,  0,  0, 52,  1,  0,  0, 36,  1,  0,  0, 52,  1,  0,  0,165,  4,  0,  0,203,  1,  0,  0, 83,  2,  0,  0,
+115,  0,  0,  0, 37,  1,  0,  0,204,  1,  0,  0, 85,  2,  0,  0,115,  0,  0,  0, 83,  2,  0,  0,203,  1,  0,  0,167,  4,  0,  0,
+203,  1,  0,  0,168,  4,  0,  0,205,  1,  0,  0,169,  4,  0,  0,204,  1,  0,  0,167,  4,  0,  0, 56,  0,  0,  0, 84,  2,  0,  0,
+204,  1,  0,  0,169,  4,  0,  0,205,  1,  0,  0, 87,  2,  0,  0,205,  1,  0,  0,168,  4,  0,  0,203,  1,  0,  0, 82,  2,  0,  0,
+ 48,  0,  0,  0, 86,  2,  0,  0,174,  0,  0,  0, 24,  0,  0,  0,  0,  0,  0,  0, 56,  0,  0,  0,190,  0,  0,  0,170,  4,  0,  0,
+190,  0,  0,  0,171,  4,  0,  0,205,  1,  0,  0,172,  4,  0,  0,174,  0,  0,  0,170,  4,  0,  0, 48,  0,  0,  0, 25,  0,  0,  0,
+174,  0,  0,  0,172,  4,  0,  0,205,  1,  0,  0, 86,  2,  0,  0,205,  1,  0,  0,171,  4,  0,  0,190,  0,  0,  0, 57,  0,  0,  0,
+ 56,  0,  0,  0, 87,  2,  0,  0,204,  1,  0,  0, 84,  2,  0,  0, 56,  0,  0,  0, 59,  0,  0,  0,191,  0,  0,  0,173,  4,  0,  0,
+191,  0,  0,  0,174,  4,  0,  0, 53,  1,  0,  0,175,  4,  0,  0,204,  1,  0,  0,173,  4,  0,  0,115,  0,  0,  0, 85,  2,  0,  0,
+204,  1,  0,  0,175,  4,  0,  0, 53,  1,  0,  0, 39,  1,  0,  0, 53,  1,  0,  0,174,  4,  0,  0,191,  0,  0,  0, 58,  0,  0,  0,
+ 19,  0,  0,  0, 38,  1,  0,  0,206,  1,  0,  0, 89,  2,  0,  0,117,  0,  0,  0, 47,  1,  0,  0, 57,  1,  0,  0,176,  4,  0,  0,
+ 57,  1,  0,  0,177,  4,  0,  0,207,  0,  0,  0,178,  4,  0,  0,206,  1,  0,  0,176,  4,  0,  0, 64,  0,  0,  0, 88,  2,  0,  0,
+206,  1,  0,  0,178,  4,  0,  0,207,  0,  0,  0, 91,  0,  0,  0,207,  0,  0,  0,177,  4,  0,  0, 57,  1,  0,  0, 46,  1,  0,  0,
+ 23,  0,  0,  0, 90,  0,  0,  0,206,  1,  0,  0, 88,  2,  0,  0, 64,  0,  0,  0, 91,  2,  0,  0,207,  1,  0,  0,179,  4,  0,  0,
+207,  1,  0,  0,180,  4,  0,  0,208,  1,  0,  0,181,  4,  0,  0,206,  1,  0,  0,179,  4,  0,  0,117,  0,  0,  0, 89,  2,  0,  0,
+206,  1,  0,  0,181,  4,  0,  0,208,  1,  0,  0, 93,  2,  0,  0,208,  1,  0,  0,180,  4,  0,  0,207,  1,  0,  0, 90,  2,  0,  0,
+ 50,  0,  0,  0, 92,  2,  0,  0,179,  0,  0,  0, 34,  0,  0,  0, 16,  0,  0,  0, 44,  1,  0,  0, 56,  1,  0,  0,182,  4,  0,  0,
+ 56,  1,  0,  0,183,  4,  0,  0,208,  1,  0,  0,184,  4,  0,  0,179,  0,  0,  0,182,  4,  0,  0, 50,  0,  0,  0, 35,  0,  0,  0,
+179,  0,  0,  0,184,  4,  0,  0,208,  1,  0,  0, 92,  2,  0,  0,208,  1,  0,  0,183,  4,  0,  0, 56,  1,  0,  0, 45,  1,  0,  0,
+117,  0,  0,  0, 93,  2,  0,  0,178,  0,  0,  0, 33,  0,  0,  0, 50,  0,  0,  0, 90,  2,  0,  0,207,  1,  0,  0,185,  4,  0,  0,
+207,  1,  0,  0,186,  4,  0,  0,206,  0,  0,  0,187,  4,  0,  0,178,  0,  0,  0,185,  4,  0,  0,  1,  0,  0,  0, 32,  0,  0,  0,
+178,  0,  0,  0,187,  4,  0,  0,206,  0,  0,  0, 88,  0,  0,  0,206,  0,  0,  0,186,  4,  0,  0,207,  1,  0,  0, 91,  2,  0,  0,
+ 64,  0,  0,  0, 89,  0,  0,  0,209,  1,  0,  0, 94,  2,  0,  0,117,  0,  0,  0, 45,  1,  0,  0, 56,  1,  0,  0,188,  4,  0,  0,
+ 56,  1,  0,  0,189,  4,  0,  0, 58,  1,  0,  0,190,  4,  0,  0,209,  1,  0,  0,188,  4,  0,  0,118,  0,  0,  0, 95,  2,  0,  0,
+209,  1,  0,  0,190,  4,  0,  0, 58,  1,  0,  0, 49,  1,  0,  0, 58,  1,  0,  0,189,  4,  0,  0, 56,  1,  0,  0, 44,  1,  0,  0,
+ 16,  0,  0,  0, 48,  1,  0,  0,209,  1,  0,  0, 95,  2,  0,  0,118,  0,  0,  0, 96,  2,  0,  0,210,  1,  0,  0,191,  4,  0,  0,
+210,  1,  0,  0,192,  4,  0,  0,211,  1,  0,  0,193,  4,  0,  0,209,  1,  0,  0,191,  4,  0,  0,117,  0,  0,  0, 94,  2,  0,  0,
+209,  1,  0,  0,193,  4,  0,  0,211,  1,  0,  0, 98,  2,  0,  0,211,  1,  0,  0,192,  4,  0,  0,210,  1,  0,  0, 97,  2,  0,  0,
+119,  0,  0,  0, 99,  2,  0,  0, 61,  1,  0,  0, 54,  1,  0,  0, 23,  0,  0,  0, 46,  1,  0,  0, 57,  1,  0,  0,194,  4,  0,  0,
+ 57,  1,  0,  0,195,  4,  0,  0,211,  1,  0,  0,196,  4,  0,  0, 61,  1,  0,  0,194,  4,  0,  0,119,  0,  0,  0, 55,  1,  0,  0,
+ 61,  1,  0,  0,196,  4,  0,  0,211,  1,  0,  0, 99,  2,  0,  0,211,  1,  0,  0,195,  4,  0,  0, 57,  1,  0,  0, 47,  1,  0,  0,
+117,  0,  0,  0, 98,  2,  0,  0, 60,  1,  0,  0, 53,  1,  0,  0,119,  0,  0,  0, 97,  2,  0,  0,210,  1,  0,  0,197,  4,  0,  0,
+210,  1,  0,  0,198,  4,  0,  0, 59,  1,  0,  0,199,  4,  0,  0, 60,  1,  0,  0,197,  4,  0,  0, 22,  0,  0,  0, 52,  1,  0,  0,
+ 60,  1,  0,  0,199,  4,  0,  0, 59,  1,  0,  0, 50,  1,  0,  0, 59,  1,  0,  0,198,  4,  0,  0,210,  1,  0,  0, 96,  2,  0,  0,
+118,  0,  0,  0, 51,  1,  0,  0,212,  1,  0,  0,100,  2,  0,  0, 63,  0,  0,  0, 85,  0,  0,  0,204,  0,  0,  0,200,  4,  0,  0,
+204,  0,  0,  0,201,  4,  0,  0,208,  0,  0,  0,202,  4,  0,  0,212,  1,  0,  0,200,  4,  0,  0, 65,  0,  0,  0,101,  2,  0,  0,
+212,  1,  0,  0,202,  4,  0,  0,208,  0,  0,  0, 93,  0,  0,  0,208,  0,  0,  0,201,  4,  0,  0,204,  0,  0,  0, 84,  0,  0,  0,
+ 10,  0,  0,  0, 92,  0,  0,  0,212,  1,  0,  0,101,  2,  0,  0, 65,  0,  0,  0,102,  2,  0,  0,213,  1,  0,  0,203,  4,  0,  0,
+213,  1,  0,  0,204,  4,  0,  0,214,  1,  0,  0,205,  4,  0,  0,212,  1,  0,  0,203,  4,  0,  0, 63,  0,  0,  0,100,  2,  0,  0,
+212,  1,  0,  0,205,  4,  0,  0,214,  1,  0,  0,104,  2,  0,  0,214,  1,  0,  0,204,  4,  0,  0,213,  1,  0,  0,103,  2,  0,  0,
+119,  0,  0,  0,105,  2,  0,  0, 60,  1,  0,  0, 52,  1,  0,  0, 22,  0,  0,  0, 86,  0,  0,  0,205,  0,  0,  0,206,  4,  0,  0,
+205,  0,  0,  0,207,  4,  0,  0,214,  1,  0,  0,208,  4,  0,  0, 60,  1,  0,  0,206,  4,  0,  0,119,  0,  0,  0, 53,  1,  0,  0,
+ 60,  1,  0,  0,208,  4,  0,  0,214,  1,  0,  0,105,  2,  0,  0,214,  1,  0,  0,207,  4,  0,  0,205,  0,  0,  0, 87,  0,  0,  0,
+ 63,  0,  0,  0,104,  2,  0,  0, 61,  1,  0,  0, 55,  1,  0,  0,119,  0,  0,  0,103,  2,  0,  0,213,  1,  0,  0,209,  4,  0,  0,
+213,  1,  0,  0,210,  4,  0,  0,209,  0,  0,  0,211,  4,  0,  0, 61,  1,  0,  0,209,  4,  0,  0, 23,  0,  0,  0, 54,  1,  0,  0,
+ 61,  1,  0,  0,211,  4,  0,  0,209,  0,  0,  0, 94,  0,  0,  0,209,  0,  0,  0,210,  4,  0,  0,213,  1,  0,  0,102,  2,  0,  0,
+ 65,  0,  0,  0, 95,  0,  0,  0,215,  1,  0,  0,106,  2,  0,  0, 62,  0,  0,  0, 83,  0,  0,  0,203,  0,  0,  0,212,  4,  0,  0,
+203,  0,  0,  0,213,  4,  0,  0, 59,  1,  0,  0,214,  4,  0,  0,215,  1,  0,  0,212,  4,  0,  0,118,  0,  0,  0,107,  2,  0,  0,
+215,  1,  0,  0,214,  4,  0,  0, 59,  1,  0,  0, 51,  1,  0,  0, 59,  1,  0,  0,213,  4,  0,  0,203,  0,  0,  0, 82,  0,  0,  0,
+ 22,  0,  0,  0, 50,  1,  0,  0,215,  1,  0,  0,107,  2,  0,  0,118,  0,  0,  0,109,  2,  0,  0,216,  1,  0,  0,215,  4,  0,  0,
+216,  1,  0,  0,216,  4,  0,  0,217,  1,  0,  0,217,  4,  0,  0,215,  1,  0,  0,215,  4,  0,  0, 62,  0,  0,  0,106,  2,  0,  0,
+215,  1,  0,  0,217,  4,  0,  0,217,  1,  0,  0,111,  2,  0,  0,217,  1,  0,  0,216,  4,  0,  0,216,  1,  0,  0,108,  2,  0,  0,
+ 51,  0,  0,  0,110,  2,  0,  0,180,  0,  0,  0, 36,  0,  0,  0,  5,  0,  0,  0, 80,  0,  0,  0,202,  0,  0,  0,218,  4,  0,  0,
+202,  0,  0,  0,219,  4,  0,  0,217,  1,  0,  0,220,  4,  0,  0,180,  0,  0,  0,218,  4,  0,  0, 51,  0,  0,  0, 37,  0,  0,  0,
+180,  0,  0,  0,220,  4,  0,  0,217,  1,  0,  0,110,  2,  0,  0,217,  1,  0,  0,219,  4,  0,  0,202,  0,  0,  0, 81,  0,  0,  0,
+ 62,  0,  0,  0,111,  2,  0,  0,181,  0,  0,  0, 39,  0,  0,  0, 51,  0,  0,  0,108,  2,  0,  0,216,  1,  0,  0,221,  4,  0,  0,
+216,  1,  0,  0,222,  4,  0,  0, 58,  1,  0,  0,223,  4,  0,  0,181,  0,  0,  0,221,  4,  0,  0, 16,  0,  0,  0, 38,  0,  0,  0,
+181,  0,  0,  0,223,  4,  0,  0, 58,  1,  0,  0, 48,  1,  0,  0, 58,  1,  0,  0,222,  4,  0,  0,216,  1,  0,  0,109,  2,  0,  0,
+118,  0,  0,  0, 49,  1,  0,  0,218,  1,  0,  0,113,  2,  0,  0,120,  0,  0,  0, 59,  1,  0,  0, 63,  1,  0,  0,224,  4,  0,  0,
+ 63,  1,  0,  0,225,  4,  0,  0,215,  0,  0,  0,226,  4,  0,  0,218,  1,  0,  0,224,  4,  0,  0, 68,  0,  0,  0,112,  2,  0,  0,
+218,  1,  0,  0,226,  4,  0,  0,215,  0,  0,  0,107,  0,  0,  0,215,  0,  0,  0,225,  4,  0,  0, 63,  1,  0,  0, 58,  1,  0,  0,
+ 25,  0,  0,  0,106,  0,  0,  0,218,  1,  0,  0,112,  2,  0,  0, 68,  0,  0,  0,115,  2,  0,  0,219,  1,  0,  0,227,  4,  0,  0,
+219,  1,  0,  0,228,  4,  0,  0,220,  1,  0,  0,229,  4,  0,  0,218,  1,  0,  0,227,  4,  0,  0,120,  0,  0,  0,113,  2,  0,  0,
+218,  1,  0,  0,229,  4,  0,  0,220,  1,  0,  0,117,  2,  0,  0,220,  1,  0,  0,228,  4,  0,  0,219,  1,  0,  0,114,  2,  0,  0,
+ 47,  0,  0,  0,116,  2,  0,  0,173,  0,  0,  0, 22,  0,  0,  0, 14,  0,  0,  0, 56,  1,  0,  0, 62,  1,  0,  0,230,  4,  0,  0,
+ 62,  1,  0,  0,231,  4,  0,  0,220,  1,  0,  0,232,  4,  0,  0,173,  0,  0,  0,230,  4,  0,  0, 47,  0,  0,  0, 23,  0,  0,  0,
+173,  0,  0,  0,232,  4,  0,  0,220,  1,  0,  0,116,  2,  0,  0,220,  1,  0,  0,231,  4,  0,  0, 62,  1,  0,  0, 57,  1,  0,  0,
+120,  0,  0,  0,117,  2,  0,  0,172,  0,  0,  0, 21,  0,  0,  0, 47,  0,  0,  0,114,  2,  0,  0,219,  1,  0,  0,233,  4,  0,  0,
+219,  1,  0,  0,234,  4,  0,  0,214,  0,  0,  0,235,  4,  0,  0,172,  0,  0,  0,233,  4,  0,  0,  2,  0,  0,  0, 20,  0,  0,  0,
+172,  0,  0,  0,235,  4,  0,  0,214,  0,  0,  0,104,  0,  0,  0,214,  0,  0,  0,234,  4,  0,  0,219,  1,  0,  0,115,  2,  0,  0,
+ 68,  0,  0,  0,105,  0,  0,  0,221,  1,  0,  0,118,  2,  0,  0,120,  0,  0,  0, 57,  1,  0,  0, 62,  1,  0,  0,236,  4,  0,  0,
+ 62,  1,  0,  0,237,  4,  0,  0, 64,  1,  0,  0,238,  4,  0,  0,221,  1,  0,  0,236,  4,  0,  0,121,  0,  0,  0,119,  2,  0,  0,
+221,  1,  0,  0,238,  4,  0,  0, 64,  1,  0,  0, 61,  1,  0,  0, 64,  1,  0,  0,237,  4,  0,  0, 62,  1,  0,  0, 56,  1,  0,  0,
+ 14,  0,  0,  0, 60,  1,  0,  0,221,  1,  0,  0,119,  2,  0,  0,121,  0,  0,  0,120,  2,  0,  0,222,  1,  0,  0,239,  4,  0,  0,
+222,  1,  0,  0,240,  4,  0,  0,223,  1,  0,  0,241,  4,  0,  0,221,  1,  0,  0,239,  4,  0,  0,120,  0,  0,  0,118,  2,  0,  0,
+221,  1,  0,  0,241,  4,  0,  0,223,  1,  0,  0,122,  2,  0,  0,223,  1,  0,  0,240,  4,  0,  0,222,  1,  0,  0,121,  2,  0,  0,
+122,  0,  0,  0,123,  2,  0,  0, 67,  1,  0,  0, 66,  1,  0,  0, 25,  0,  0,  0, 58,  1,  0,  0, 63,  1,  0,  0,242,  4,  0,  0,
+ 63,  1,  0,  0,243,  4,  0,  0,223,  1,  0,  0,244,  4,  0,  0, 67,  1,  0,  0,242,  4,  0,  0,122,  0,  0,  0, 67,  1,  0,  0,
+ 67,  1,  0,  0,244,  4,  0,  0,223,  1,  0,  0,123,  2,  0,  0,223,  1,  0,  0,243,  4,  0,  0, 63,  1,  0,  0, 59,  1,  0,  0,
+120,  0,  0,  0,122,  2,  0,  0, 66,  1,  0,  0, 65,  1,  0,  0,122,  0,  0,  0,121,  2,  0,  0,222,  1,  0,  0,245,  4,  0,  0,
+222,  1,  0,  0,246,  4,  0,  0, 65,  1,  0,  0,247,  4,  0,  0, 66,  1,  0,  0,245,  4,  0,  0, 24,  0,  0,  0, 64,  1,  0,  0,
+ 66,  1,  0,  0,247,  4,  0,  0, 65,  1,  0,  0, 62,  1,  0,  0, 65,  1,  0,  0,246,  4,  0,  0,222,  1,  0,  0,120,  2,  0,  0,
+121,  0,  0,  0, 63,  1,  0,  0,224,  1,  0,  0,124,  2,  0,  0, 67,  0,  0,  0,101,  0,  0,  0,212,  0,  0,  0,248,  4,  0,  0,
+212,  0,  0,  0,249,  4,  0,  0,216,  0,  0,  0,250,  4,  0,  0,224,  1,  0,  0,248,  4,  0,  0, 69,  0,  0,  0,125,  2,  0,  0,
+224,  1,  0,  0,250,  4,  0,  0,216,  0,  0,  0,109,  0,  0,  0,216,  0,  0,  0,249,  4,  0,  0,212,  0,  0,  0,100,  0,  0,  0,
+  6,  0,  0,  0,108,  0,  0,  0,224,  1,  0,  0,125,  2,  0,  0, 69,  0,  0,  0,126,  2,  0,  0,225,  1,  0,  0,251,  4,  0,  0,
+225,  1,  0,  0,252,  4,  0,  0,226,  1,  0,  0,253,  4,  0,  0,224,  1,  0,  0,251,  4,  0,  0, 67,  0,  0,  0,124,  2,  0,  0,
+224,  1,  0,  0,253,  4,  0,  0,226,  1,  0,  0,128,  2,  0,  0,226,  1,  0,  0,252,  4,  0,  0,225,  1,  0,  0,127,  2,  0,  0,
+122,  0,  0,  0,129,  2,  0,  0, 66,  1,  0,  0, 64,  1,  0,  0, 24,  0,  0,  0,102,  0,  0,  0,213,  0,  0,  0,254,  4,  0,  0,
+213,  0,  0,  0,255,  4,  0,  0,226,  1,  0,  0,  0,  5,  0,  0, 66,  1,  0,  0,254,  4,  0,  0,122,  0,  0,  0, 65,  1,  0,  0,
+ 66,  1,  0,  0,  0,  5,  0,  0,226,  1,  0,  0,129,  2,  0,  0,226,  1,  0,  0,255,  4,  0,  0,213,  0,  0,  0,103,  0,  0,  0,
+ 67,  0,  0,  0,128,  2,  0,  0, 67,  1,  0,  0, 67,  1,  0,  0,122,  0,  0,  0,127,  2,  0,  0,225,  1,  0,  0,  1,  5,  0,  0,
+225,  1,  0,  0,  2,  5,  0,  0,217,  0,  0,  0,  3,  5,  0,  0, 67,  1,  0,  0,  1,  5,  0,  0, 25,  0,  0,  0, 66,  1,  0,  0,
+ 67,  1,  0,  0,  3,  5,  0,  0,217,  0,  0,  0,110,  0,  0,  0,217,  0,  0,  0,  2,  5,  0,  0,225,  1,  0,  0,126,  2,  0,  0,
+ 69,  0,  0,  0,111,  0,  0,  0,227,  1,  0,  0,130,  2,  0,  0, 66,  0,  0,  0, 99,  0,  0,  0,211,  0,  0,  0,  4,  5,  0,  0,
+211,  0,  0,  0,  5,  5,  0,  0, 65,  1,  0,  0,  6,  5,  0,  0,227,  1,  0,  0,  4,  5,  0,  0,121,  0,  0,  0,131,  2,  0,  0,
+227,  1,  0,  0,  6,  5,  0,  0, 65,  1,  0,  0, 63,  1,  0,  0, 65,  1,  0,  0,  5,  5,  0,  0,211,  0,  0,  0, 98,  0,  0,  0,
+ 24,  0,  0,  0, 62,  1,  0,  0,227,  1,  0,  0,131,  2,  0,  0,121,  0,  0,  0,133,  2,  0,  0,228,  1,  0,  0,  7,  5,  0,  0,
+228,  1,  0,  0,  8,  5,  0,  0,229,  1,  0,  0,  9,  5,  0,  0,227,  1,  0,  0,  7,  5,  0,  0, 66,  0,  0,  0,130,  2,  0,  0,
+227,  1,  0,  0,  9,  5,  0,  0,229,  1,  0,  0,135,  2,  0,  0,229,  1,  0,  0,  8,  5,  0,  0,228,  1,  0,  0,132,  2,  0,  0,
+ 46,  0,  0,  0,134,  2,  0,  0,170,  0,  0,  0, 16,  0,  0,  0,  1,  0,  0,  0, 96,  0,  0,  0,210,  0,  0,  0, 10,  5,  0,  0,
+210,  0,  0,  0, 11,  5,  0,  0,229,  1,  0,  0, 12,  5,  0,  0,170,  0,  0,  0, 10,  5,  0,  0, 46,  0,  0,  0, 17,  0,  0,  0,
+170,  0,  0,  0, 12,  5,  0,  0,229,  1,  0,  0,134,  2,  0,  0,229,  1,  0,  0, 11,  5,  0,  0,210,  0,  0,  0, 97,  0,  0,  0,
+ 66,  0,  0,  0,135,  2,  0,  0,171,  0,  0,  0, 19,  0,  0,  0, 46,  0,  0,  0,132,  2,  0,  0,228,  1,  0,  0, 13,  5,  0,  0,
+228,  1,  0,  0, 14,  5,  0,  0, 64,  1,  0,  0, 15,  5,  0,  0,171,  0,  0,  0, 13,  5,  0,  0, 14,  0,  0,  0, 18,  0,  0,  0,
+171,  0,  0,  0, 15,  5,  0,  0, 64,  1,  0,  0, 60,  1,  0,  0, 64,  1,  0,  0, 14,  5,  0,  0,228,  1,  0,  0,133,  2,  0,  0,
+121,  0,  0,  0, 61,  1,  0,  0,230,  1,  0,  0,137,  2,  0,  0,123,  0,  0,  0, 71,  1,  0,  0, 69,  1,  0,  0, 16,  5,  0,  0,
+ 69,  1,  0,  0, 17,  5,  0,  0,223,  0,  0,  0, 18,  5,  0,  0,230,  1,  0,  0, 16,  5,  0,  0, 72,  0,  0,  0,136,  2,  0,  0,
+230,  1,  0,  0, 18,  5,  0,  0,223,  0,  0,  0,123,  0,  0,  0,223,  0,  0,  0, 17,  5,  0,  0, 69,  1,  0,  0, 70,  1,  0,  0,
+ 27,  0,  0,  0,122,  0,  0,  0,230,  1,  0,  0,136,  2,  0,  0, 72,  0,  0,  0,139,  2,  0,  0,231,  1,  0,  0, 19,  5,  0,  0,
+231,  1,  0,  0, 20,  5,  0,  0,232,  1,  0,  0, 21,  5,  0,  0,230,  1,  0,  0, 19,  5,  0,  0,123,  0,  0,  0,137,  2,  0,  0,
+230,  1,  0,  0, 21,  5,  0,  0,232,  1,  0,  0,141,  2,  0,  0,232,  1,  0,  0, 20,  5,  0,  0,231,  1,  0,  0,138,  2,  0,  0,
+ 55,  0,  0,  0,140,  2,  0,  0,189,  0,  0,  0, 54,  0,  0,  0, 18,  0,  0,  0, 68,  1,  0,  0, 68,  1,  0,  0, 22,  5,  0,  0,
+ 68,  1,  0,  0, 23,  5,  0,  0,232,  1,  0,  0, 24,  5,  0,  0,189,  0,  0,  0, 22,  5,  0,  0, 55,  0,  0,  0, 55,  0,  0,  0,
+189,  0,  0,  0, 24,  5,  0,  0,232,  1,  0,  0,140,  2,  0,  0,232,  1,  0,  0, 23,  5,  0,  0, 68,  1,  0,  0, 69,  1,  0,  0,
+123,  0,  0,  0,141,  2,  0,  0,188,  0,  0,  0, 53,  0,  0,  0, 55,  0,  0,  0,138,  2,  0,  0,231,  1,  0,  0, 25,  5,  0,  0,
+231,  1,  0,  0, 26,  5,  0,  0,222,  0,  0,  0, 27,  5,  0,  0,188,  0,  0,  0, 25,  5,  0,  0,  3,  0,  0,  0, 52,  0,  0,  0,
+188,  0,  0,  0, 27,  5,  0,  0,222,  0,  0,  0,120,  0,  0,  0,222,  0,  0,  0, 26,  5,  0,  0,231,  1,  0,  0,139,  2,  0,  0,
+ 72,  0,  0,  0,121,  0,  0,  0,233,  1,  0,  0,142,  2,  0,  0,123,  0,  0,  0, 69,  1,  0,  0, 68,  1,  0,  0, 28,  5,  0,  0,
+ 68,  1,  0,  0, 29,  5,  0,  0, 70,  1,  0,  0, 30,  5,  0,  0,233,  1,  0,  0, 28,  5,  0,  0,124,  0,  0,  0,143,  2,  0,  0,
+233,  1,  0,  0, 30,  5,  0,  0, 70,  1,  0,  0, 73,  1,  0,  0, 70,  1,  0,  0, 29,  5,  0,  0, 68,  1,  0,  0, 68,  1,  0,  0,
+ 18,  0,  0,  0, 72,  1,  0,  0,233,  1,  0,  0,143,  2,  0,  0,124,  0,  0,  0,144,  2,  0,  0,234,  1,  0,  0, 31,  5,  0,  0,
+234,  1,  0,  0, 32,  5,  0,  0,235,  1,  0,  0, 33,  5,  0,  0,233,  1,  0,  0, 31,  5,  0,  0,123,  0,  0,  0,142,  2,  0,  0,
+233,  1,  0,  0, 33,  5,  0,  0,235,  1,  0,  0,146,  2,  0,  0,235,  1,  0,  0, 32,  5,  0,  0,234,  1,  0,  0,145,  2,  0,  0,
+125,  0,  0,  0,147,  2,  0,  0, 73,  1,  0,  0, 78,  1,  0,  0, 27,  0,  0,  0, 70,  1,  0,  0, 69,  1,  0,  0, 34,  5,  0,  0,
+ 69,  1,  0,  0, 35,  5,  0,  0,235,  1,  0,  0, 36,  5,  0,  0, 73,  1,  0,  0, 34,  5,  0,  0,125,  0,  0,  0, 79,  1,  0,  0,
+ 73,  1,  0,  0, 36,  5,  0,  0,235,  1,  0,  0,147,  2,  0,  0,235,  1,  0,  0, 35,  5,  0,  0, 69,  1,  0,  0, 71,  1,  0,  0,
+123,  0,  0,  0,146,  2,  0,  0, 72,  1,  0,  0, 77,  1,  0,  0,125,  0,  0,  0,145,  2,  0,  0,234,  1,  0,  0, 37,  5,  0,  0,
+234,  1,  0,  0, 38,  5,  0,  0, 71,  1,  0,  0, 39,  5,  0,  0, 72,  1,  0,  0, 37,  5,  0,  0, 26,  0,  0,  0, 76,  1,  0,  0,
+ 72,  1,  0,  0, 39,  5,  0,  0, 71,  1,  0,  0, 74,  1,  0,  0, 71,  1,  0,  0, 38,  5,  0,  0,234,  1,  0,  0,144,  2,  0,  0,
+124,  0,  0,  0, 75,  1,  0,  0,236,  1,  0,  0,148,  2,  0,  0, 71,  0,  0,  0,117,  0,  0,  0,220,  0,  0,  0, 40,  5,  0,  0,
+220,  0,  0,  0, 41,  5,  0,  0,224,  0,  0,  0, 42,  5,  0,  0,236,  1,  0,  0, 40,  5,  0,  0, 73,  0,  0,  0,149,  2,  0,  0,
+236,  1,  0,  0, 42,  5,  0,  0,224,  0,  0,  0,125,  0,  0,  0,224,  0,  0,  0, 41,  5,  0,  0,220,  0,  0,  0,116,  0,  0,  0,
+  7,  0,  0,  0,124,  0,  0,  0,236,  1,  0,  0,149,  2,  0,  0, 73,  0,  0,  0,150,  2,  0,  0,237,  1,  0,  0, 43,  5,  0,  0,
+237,  1,  0,  0, 44,  5,  0,  0,238,  1,  0,  0, 45,  5,  0,  0,236,  1,  0,  0, 43,  5,  0,  0, 71,  0,  0,  0,148,  2,  0,  0,
+236,  1,  0,  0, 45,  5,  0,  0,238,  1,  0,  0,152,  2,  0,  0,238,  1,  0,  0, 44,  5,  0,  0,237,  1,  0,  0,151,  2,  0,  0,
+125,  0,  0,  0,153,  2,  0,  0, 72,  1,  0,  0, 76,  1,  0,  0, 26,  0,  0,  0,118,  0,  0,  0,221,  0,  0,  0, 46,  5,  0,  0,
+221,  0,  0,  0, 47,  5,  0,  0,238,  1,  0,  0, 48,  5,  0,  0, 72,  1,  0,  0, 46,  5,  0,  0,125,  0,  0,  0, 77,  1,  0,  0,
+ 72,  1,  0,  0, 48,  5,  0,  0,238,  1,  0,  0,153,  2,  0,  0,238,  1,  0,  0, 47,  5,  0,  0,221,  0,  0,  0,119,  0,  0,  0,
+ 71,  0,  0,  0,152,  2,  0,  0, 73,  1,  0,  0, 79,  1,  0,  0,125,  0,  0,  0,151,  2,  0,  0,237,  1,  0,  0, 49,  5,  0,  0,
+237,  1,  0,  0, 50,  5,  0,  0,225,  0,  0,  0, 51,  5,  0,  0, 73,  1,  0,  0, 49,  5,  0,  0, 27,  0,  0,  0, 78,  1,  0,  0,
+ 73,  1,  0,  0, 51,  5,  0,  0,225,  0,  0,  0,126,  0,  0,  0,225,  0,  0,  0, 50,  5,  0,  0,237,  1,  0,  0,150,  2,  0,  0,
+ 73,  0,  0,  0,127,  0,  0,  0,239,  1,  0,  0,154,  2,  0,  0, 70,  0,  0,  0,115,  0,  0,  0,219,  0,  0,  0, 52,  5,  0,  0,
+219,  0,  0,  0, 53,  5,  0,  0, 71,  1,  0,  0, 54,  5,  0,  0,239,  1,  0,  0, 52,  5,  0,  0,124,  0,  0,  0,155,  2,  0,  0,
+239,  1,  0,  0, 54,  5,  0,  0, 71,  1,  0,  0, 75,  1,  0,  0, 71,  1,  0,  0, 53,  5,  0,  0,219,  0,  0,  0,114,  0,  0,  0,
+ 26,  0,  0,  0, 74,  1,  0,  0,239,  1,  0,  0,155,  2,  0,  0,124,  0,  0,  0,157,  2,  0,  0,240,  1,  0,  0, 55,  5,  0,  0,
+240,  1,  0,  0, 56,  5,  0,  0,241,  1,  0,  0, 57,  5,  0,  0,239,  1,  0,  0, 55,  5,  0,  0, 70,  0,  0,  0,154,  2,  0,  0,
+239,  1,  0,  0, 57,  5,  0,  0,241,  1,  0,  0,159,  2,  0,  0,241,  1,  0,  0, 56,  5,  0,  0,240,  1,  0,  0,156,  2,  0,  0,
+ 54,  0,  0,  0,158,  2,  0,  0,186,  0,  0,  0, 48,  0,  0,  0,  2,  0,  0,  0,112,  0,  0,  0,218,  0,  0,  0, 58,  5,  0,  0,
+218,  0,  0,  0, 59,  5,  0,  0,241,  1,  0,  0, 60,  5,  0,  0,186,  0,  0,  0, 58,  5,  0,  0, 54,  0,  0,  0, 49,  0,  0,  0,
+186,  0,  0,  0, 60,  5,  0,  0,241,  1,  0,  0,158,  2,  0,  0,241,  1,  0,  0, 59,  5,  0,  0,218,  0,  0,  0,113,  0,  0,  0,
+ 70,  0,  0,  0,159,  2,  0,  0,187,  0,  0,  0, 51,  0,  0,  0, 54,  0,  0,  0,156,  2,  0,  0,240,  1,  0,  0, 61,  5,  0,  0,
+240,  1,  0,  0, 62,  5,  0,  0, 70,  1,  0,  0, 63,  5,  0,  0,187,  0,  0,  0, 61,  5,  0,  0, 18,  0,  0,  0, 50,  0,  0,  0,
+187,  0,  0,  0, 63,  5,  0,  0, 70,  1,  0,  0, 72,  1,  0,  0, 70,  1,  0,  0, 62,  5,  0,  0,240,  1,  0,  0,157,  2,  0,  0,
+124,  0,  0,  0, 73,  1,  0,  0,242,  1,  0,  0,161,  2,  0,  0,126,  0,  0,  0, 83,  1,  0,  0, 75,  1,  0,  0, 64,  5,  0,  0,
+ 75,  1,  0,  0, 65,  5,  0,  0,231,  0,  0,  0, 66,  5,  0,  0,242,  1,  0,  0, 64,  5,  0,  0, 76,  0,  0,  0,160,  2,  0,  0,
+242,  1,  0,  0, 66,  5,  0,  0,231,  0,  0,  0,139,  0,  0,  0,231,  0,  0,  0, 65,  5,  0,  0, 75,  1,  0,  0, 82,  1,  0,  0,
+ 29,  0,  0,  0,138,  0,  0,  0,242,  1,  0,  0,160,  2,  0,  0, 76,  0,  0,  0,163,  2,  0,  0,243,  1,  0,  0, 67,  5,  0,  0,
+243,  1,  0,  0, 68,  5,  0,  0,244,  1,  0,  0, 69,  5,  0,  0,242,  1,  0,  0, 67,  5,  0,  0,126,  0,  0,  0,161,  2,  0,  0,
+242,  1,  0,  0, 69,  5,  0,  0,244,  1,  0,  0,165,  2,  0,  0,244,  1,  0,  0, 68,  5,  0,  0,243,  1,  0,  0,162,  2,  0,  0,
+ 59,  0,  0,  0,164,  2,  0,  0,197,  0,  0,  0, 70,  0,  0,  0, 20,  0,  0,  0, 80,  1,  0,  0, 74,  1,  0,  0, 70,  5,  0,  0,
+ 74,  1,  0,  0, 71,  5,  0,  0,244,  1,  0,  0, 72,  5,  0,  0,197,  0,  0,  0, 70,  5,  0,  0, 59,  0,  0,  0, 71,  0,  0,  0,
+197,  0,  0,  0, 72,  5,  0,  0,244,  1,  0,  0,164,  2,  0,  0,244,  1,  0,  0, 71,  5,  0,  0, 74,  1,  0,  0, 81,  1,  0,  0,
+126,  0,  0,  0,165,  2,  0,  0,196,  0,  0,  0, 69,  0,  0,  0, 59,  0,  0,  0,162,  2,  0,  0,243,  1,  0,  0, 73,  5,  0,  0,
+243,  1,  0,  0, 74,  5,  0,  0,230,  0,  0,  0, 75,  5,  0,  0,196,  0,  0,  0, 73,  5,  0,  0,  4,  0,  0,  0, 68,  0,  0,  0,
+196,  0,  0,  0, 75,  5,  0,  0,230,  0,  0,  0,136,  0,  0,  0,230,  0,  0,  0, 74,  5,  0,  0,243,  1,  0,  0,163,  2,  0,  0,
+ 76,  0,  0,  0,137,  0,  0,  0,245,  1,  0,  0,166,  2,  0,  0,126,  0,  0,  0, 81,  1,  0,  0, 74,  1,  0,  0, 76,  5,  0,  0,
+ 74,  1,  0,  0, 77,  5,  0,  0, 76,  1,  0,  0, 78,  5,  0,  0,245,  1,  0,  0, 76,  5,  0,  0,127,  0,  0,  0,167,  2,  0,  0,
+245,  1,  0,  0, 78,  5,  0,  0, 76,  1,  0,  0, 85,  1,  0,  0, 76,  1,  0,  0, 77,  5,  0,  0, 74,  1,  0,  0, 80,  1,  0,  0,
+ 20,  0,  0,  0, 84,  1,  0,  0,245,  1,  0,  0,167,  2,  0,  0,127,  0,  0,  0,168,  2,  0,  0,246,  1,  0,  0, 79,  5,  0,  0,
+246,  1,  0,  0, 80,  5,  0,  0,247,  1,  0,  0, 81,  5,  0,  0,245,  1,  0,  0, 79,  5,  0,  0,126,  0,  0,  0,166,  2,  0,  0,
+245,  1,  0,  0, 81,  5,  0,  0,247,  1,  0,  0,170,  2,  0,  0,247,  1,  0,  0, 80,  5,  0,  0,246,  1,  0,  0,169,  2,  0,  0,
+128,  0,  0,  0,171,  2,  0,  0, 79,  1,  0,  0, 90,  1,  0,  0, 29,  0,  0,  0, 82,  1,  0,  0, 75,  1,  0,  0, 82,  5,  0,  0,
+ 75,  1,  0,  0, 83,  5,  0,  0,247,  1,  0,  0, 84,  5,  0,  0, 79,  1,  0,  0, 82,  5,  0,  0,128,  0,  0,  0, 91,  1,  0,  0,
+ 79,  1,  0,  0, 84,  5,  0,  0,247,  1,  0,  0,171,  2,  0,  0,247,  1,  0,  0, 83,  5,  0,  0, 75,  1,  0,  0, 83,  1,  0,  0,
+126,  0,  0,  0,170,  2,  0,  0, 78,  1,  0,  0, 89,  1,  0,  0,128,  0,  0,  0,169,  2,  0,  0,246,  1,  0,  0, 85,  5,  0,  0,
+246,  1,  0,  0, 86,  5,  0,  0, 77,  1,  0,  0, 87,  5,  0,  0, 78,  1,  0,  0, 85,  5,  0,  0, 28,  0,  0,  0, 88,  1,  0,  0,
+ 78,  1,  0,  0, 87,  5,  0,  0, 77,  1,  0,  0, 86,  1,  0,  0, 77,  1,  0,  0, 86,  5,  0,  0,246,  1,  0,  0,168,  2,  0,  0,
+127,  0,  0,  0, 87,  1,  0,  0,248,  1,  0,  0,172,  2,  0,  0, 75,  0,  0,  0,133,  0,  0,  0,228,  0,  0,  0, 88,  5,  0,  0,
+228,  0,  0,  0, 89,  5,  0,  0,232,  0,  0,  0, 90,  5,  0,  0,248,  1,  0,  0, 88,  5,  0,  0, 77,  0,  0,  0,173,  2,  0,  0,
+248,  1,  0,  0, 90,  5,  0,  0,232,  0,  0,  0,141,  0,  0,  0,232,  0,  0,  0, 89,  5,  0,  0,228,  0,  0,  0,132,  0,  0,  0,
+  8,  0,  0,  0,140,  0,  0,  0,248,  1,  0,  0,173,  2,  0,  0, 77,  0,  0,  0,174,  2,  0,  0,249,  1,  0,  0, 91,  5,  0,  0,
+249,  1,  0,  0, 92,  5,  0,  0,250,  1,  0,  0, 93,  5,  0,  0,248,  1,  0,  0, 91,  5,  0,  0, 75,  0,  0,  0,172,  2,  0,  0,
+248,  1,  0,  0, 93,  5,  0,  0,250,  1,  0,  0,176,  2,  0,  0,250,  1,  0,  0, 92,  5,  0,  0,249,  1,  0,  0,175,  2,  0,  0,
+128,  0,  0,  0,177,  2,  0,  0, 78,  1,  0,  0, 88,  1,  0,  0, 28,  0,  0,  0,134,  0,  0,  0,229,  0,  0,  0, 94,  5,  0,  0,
+229,  0,  0,  0, 95,  5,  0,  0,250,  1,  0,  0, 96,  5,  0,  0, 78,  1,  0,  0, 94,  5,  0,  0,128,  0,  0,  0, 89,  1,  0,  0,
+ 78,  1,  0,  0, 96,  5,  0,  0,250,  1,  0,  0,177,  2,  0,  0,250,  1,  0,  0, 95,  5,  0,  0,229,  0,  0,  0,135,  0,  0,  0,
+ 75,  0,  0,  0,176,  2,  0,  0, 79,  1,  0,  0, 91,  1,  0,  0,128,  0,  0,  0,175,  2,  0,  0,249,  1,  0,  0, 97,  5,  0,  0,
+249,  1,  0,  0, 98,  5,  0,  0,233,  0,  0,  0, 99,  5,  0,  0, 79,  1,  0,  0, 97,  5,  0,  0, 29,  0,  0,  0, 90,  1,  0,  0,
+ 79,  1,  0,  0, 99,  5,  0,  0,233,  0,  0,  0,142,  0,  0,  0,233,  0,  0,  0, 98,  5,  0,  0,249,  1,  0,  0,174,  2,  0,  0,
+ 77,  0,  0,  0,143,  0,  0,  0,251,  1,  0,  0,178,  2,  0,  0, 74,  0,  0,  0,131,  0,  0,  0,227,  0,  0,  0,100,  5,  0,  0,
+227,  0,  0,  0,101,  5,  0,  0, 77,  1,  0,  0,102,  5,  0,  0,251,  1,  0,  0,100,  5,  0,  0,127,  0,  0,  0,179,  2,  0,  0,
+251,  1,  0,  0,102,  5,  0,  0, 77,  1,  0,  0, 87,  1,  0,  0, 77,  1,  0,  0,101,  5,  0,  0,227,  0,  0,  0,130,  0,  0,  0,
+ 28,  0,  0,  0, 86,  1,  0,  0,251,  1,  0,  0,179,  2,  0,  0,127,  0,  0,  0,181,  2,  0,  0,252,  1,  0,  0,103,  5,  0,  0,
+252,  1,  0,  0,104,  5,  0,  0,253,  1,  0,  0,105,  5,  0,  0,251,  1,  0,  0,103,  5,  0,  0, 74,  0,  0,  0,178,  2,  0,  0,
+251,  1,  0,  0,105,  5,  0,  0,253,  1,  0,  0,183,  2,  0,  0,253,  1,  0,  0,104,  5,  0,  0,252,  1,  0,  0,180,  2,  0,  0,
+ 58,  0,  0,  0,182,  2,  0,  0,194,  0,  0,  0, 64,  0,  0,  0,  3,  0,  0,  0,128,  0,  0,  0,226,  0,  0,  0,106,  5,  0,  0,
+226,  0,  0,  0,107,  5,  0,  0,253,  1,  0,  0,108,  5,  0,  0,194,  0,  0,  0,106,  5,  0,  0, 58,  0,  0,  0, 65,  0,  0,  0,
+194,  0,  0,  0,108,  5,  0,  0,253,  1,  0,  0,182,  2,  0,  0,253,  1,  0,  0,107,  5,  0,  0,226,  0,  0,  0,129,  0,  0,  0,
+ 74,  0,  0,  0,183,  2,  0,  0,195,  0,  0,  0, 67,  0,  0,  0, 58,  0,  0,  0,180,  2,  0,  0,252,  1,  0,  0,109,  5,  0,  0,
+252,  1,  0,  0,110,  5,  0,  0, 76,  1,  0,  0,111,  5,  0,  0,195,  0,  0,  0,109,  5,  0,  0, 20,  0,  0,  0, 66,  0,  0,  0,
+195,  0,  0,  0,111,  5,  0,  0, 76,  1,  0,  0, 84,  1,  0,  0, 76,  1,  0,  0,110,  5,  0,  0,252,  1,  0,  0,181,  2,  0,  0,
+127,  0,  0,  0, 85,  1,  0,  0,254,  1,  0,  0,185,  2,  0,  0,129,  0,  0,  0, 95,  1,  0,  0, 81,  1,  0,  0,112,  5,  0,  0,
+ 81,  1,  0,  0,113,  5,  0,  0,239,  0,  0,  0,114,  5,  0,  0,254,  1,  0,  0,112,  5,  0,  0, 80,  0,  0,  0,184,  2,  0,  0,
+254,  1,  0,  0,114,  5,  0,  0,239,  0,  0,  0,155,  0,  0,  0,239,  0,  0,  0,113,  5,  0,  0, 81,  1,  0,  0, 94,  1,  0,  0,
+ 31,  0,  0,  0,154,  0,  0,  0,254,  1,  0,  0,184,  2,  0,  0, 80,  0,  0,  0,187,  2,  0,  0,255,  1,  0,  0,115,  5,  0,  0,
+255,  1,  0,  0,116,  5,  0,  0,  0,  2,  0,  0,117,  5,  0,  0,254,  1,  0,  0,115,  5,  0,  0,129,  0,  0,  0,185,  2,  0,  0,
+254,  1,  0,  0,117,  5,  0,  0,  0,  2,  0,  0,189,  2,  0,  0,  0,  2,  0,  0,116,  5,  0,  0,255,  1,  0,  0,186,  2,  0,  0,
+ 61,  0,  0,  0,188,  2,  0,  0,201,  0,  0,  0, 78,  0,  0,  0, 21,  0,  0,  0, 92,  1,  0,  0, 80,  1,  0,  0,118,  5,  0,  0,
+ 80,  1,  0,  0,119,  5,  0,  0,  0,  2,  0,  0,120,  5,  0,  0,201,  0,  0,  0,118,  5,  0,  0, 61,  0,  0,  0, 79,  0,  0,  0,
+201,  0,  0,  0,120,  5,  0,  0,  0,  2,  0,  0,188,  2,  0,  0,  0,  2,  0,  0,119,  5,  0,  0, 80,  1,  0,  0, 93,  1,  0,  0,
+129,  0,  0,  0,189,  2,  0,  0,200,  0,  0,  0, 77,  0,  0,  0, 61,  0,  0,  0,186,  2,  0,  0,255,  1,  0,  0,121,  5,  0,  0,
+255,  1,  0,  0,122,  5,  0,  0,238,  0,  0,  0,123,  5,  0,  0,200,  0,  0,  0,121,  5,  0,  0,  5,  0,  0,  0, 76,  0,  0,  0,
+200,  0,  0,  0,123,  5,  0,  0,238,  0,  0,  0,152,  0,  0,  0,238,  0,  0,  0,122,  5,  0,  0,255,  1,  0,  0,187,  2,  0,  0,
+ 80,  0,  0,  0,153,  0,  0,  0,  1,  2,  0,  0,190,  2,  0,  0,129,  0,  0,  0, 93,  1,  0,  0, 80,  1,  0,  0,124,  5,  0,  0,
+ 80,  1,  0,  0,125,  5,  0,  0, 82,  1,  0,  0,126,  5,  0,  0,  1,  2,  0,  0,124,  5,  0,  0,130,  0,  0,  0,191,  2,  0,  0,
+  1,  2,  0,  0,126,  5,  0,  0, 82,  1,  0,  0, 97,  1,  0,  0, 82,  1,  0,  0,125,  5,  0,  0, 80,  1,  0,  0, 92,  1,  0,  0,
+ 21,  0,  0,  0, 96,  1,  0,  0,  1,  2,  0,  0,191,  2,  0,  0,130,  0,  0,  0,192,  2,  0,  0,  2,  2,  0,  0,127,  5,  0,  0,
+  2,  2,  0,  0,128,  5,  0,  0,  3,  2,  0,  0,129,  5,  0,  0,  1,  2,  0,  0,127,  5,  0,  0,129,  0,  0,  0,190,  2,  0,  0,
+  1,  2,  0,  0,129,  5,  0,  0,  3,  2,  0,  0,194,  2,  0,  0,  3,  2,  0,  0,128,  5,  0,  0,  2,  2,  0,  0,193,  2,  0,  0,
+131,  0,  0,  0,195,  2,  0,  0, 85,  1,  0,  0,102,  1,  0,  0, 31,  0,  0,  0, 94,  1,  0,  0, 81,  1,  0,  0,130,  5,  0,  0,
+ 81,  1,  0,  0,131,  5,  0,  0,  3,  2,  0,  0,132,  5,  0,  0, 85,  1,  0,  0,130,  5,  0,  0,131,  0,  0,  0,103,  1,  0,  0,
+ 85,  1,  0,  0,132,  5,  0,  0,  3,  2,  0,  0,195,  2,  0,  0,  3,  2,  0,  0,131,  5,  0,  0, 81,  1,  0,  0, 95,  1,  0,  0,
+129,  0,  0,  0,194,  2,  0,  0, 84,  1,  0,  0,101,  1,  0,  0,131,  0,  0,  0,193,  2,  0,  0,  2,  2,  0,  0,133,  5,  0,  0,
+  2,  2,  0,  0,134,  5,  0,  0, 83,  1,  0,  0,135,  5,  0,  0, 84,  1,  0,  0,133,  5,  0,  0, 30,  0,  0,  0,100,  1,  0,  0,
+ 84,  1,  0,  0,135,  5,  0,  0, 83,  1,  0,  0, 98,  1,  0,  0, 83,  1,  0,  0,134,  5,  0,  0,  2,  2,  0,  0,192,  2,  0,  0,
+130,  0,  0,  0, 99,  1,  0,  0,  4,  2,  0,  0,196,  2,  0,  0, 79,  0,  0,  0,149,  0,  0,  0,236,  0,  0,  0,136,  5,  0,  0,
+236,  0,  0,  0,137,  5,  0,  0,240,  0,  0,  0,138,  5,  0,  0,  4,  2,  0,  0,136,  5,  0,  0, 81,  0,  0,  0,197,  2,  0,  0,
+  4,  2,  0,  0,138,  5,  0,  0,240,  0,  0,  0,157,  0,  0,  0,240,  0,  0,  0,137,  5,  0,  0,236,  0,  0,  0,148,  0,  0,  0,
+  9,  0,  0,  0,156,  0,  0,  0,  4,  2,  0,  0,197,  2,  0,  0, 81,  0,  0,  0,198,  2,  0,  0,  5,  2,  0,  0,139,  5,  0,  0,
+  5,  2,  0,  0,140,  5,  0,  0,  6,  2,  0,  0,141,  5,  0,  0,  4,  2,  0,  0,139,  5,  0,  0, 79,  0,  0,  0,196,  2,  0,  0,
+  4,  2,  0,  0,141,  5,  0,  0,  6,  2,  0,  0,200,  2,  0,  0,  6,  2,  0,  0,140,  5,  0,  0,  5,  2,  0,  0,199,  2,  0,  0,
+131,  0,  0,  0,201,  2,  0,  0, 84,  1,  0,  0,100,  1,  0,  0, 30,  0,  0,  0,150,  0,  0,  0,237,  0,  0,  0,142,  5,  0,  0,
+237,  0,  0,  0,143,  5,  0,  0,  6,  2,  0,  0,144,  5,  0,  0, 84,  1,  0,  0,142,  5,  0,  0,131,  0,  0,  0,101,  1,  0,  0,
+ 84,  1,  0,  0,144,  5,  0,  0,  6,  2,  0,  0,201,  2,  0,  0,  6,  2,  0,  0,143,  5,  0,  0,237,  0,  0,  0,151,  0,  0,  0,
+ 79,  0,  0,  0,200,  2,  0,  0, 85,  1,  0,  0,103,  1,  0,  0,131,  0,  0,  0,199,  2,  0,  0,  5,  2,  0,  0,145,  5,  0,  0,
+  5,  2,  0,  0,146,  5,  0,  0,241,  0,  0,  0,147,  5,  0,  0, 85,  1,  0,  0,145,  5,  0,  0, 31,  0,  0,  0,102,  1,  0,  0,
+ 85,  1,  0,  0,147,  5,  0,  0,241,  0,  0,  0,158,  0,  0,  0,241,  0,  0,  0,146,  5,  0,  0,  5,  2,  0,  0,198,  2,  0,  0,
+ 81,  0,  0,  0,159,  0,  0,  0,  7,  2,  0,  0,202,  2,  0,  0, 78,  0,  0,  0,147,  0,  0,  0,235,  0,  0,  0,148,  5,  0,  0,
+235,  0,  0,  0,149,  5,  0,  0, 83,  1,  0,  0,150,  5,  0,  0,  7,  2,  0,  0,148,  5,  0,  0,130,  0,  0,  0,203,  2,  0,  0,
+  7,  2,  0,  0,150,  5,  0,  0, 83,  1,  0,  0, 99,  1,  0,  0, 83,  1,  0,  0,149,  5,  0,  0,235,  0,  0,  0,146,  0,  0,  0,
+ 30,  0,  0,  0, 98,  1,  0,  0,  7,  2,  0,  0,203,  2,  0,  0,130,  0,  0,  0,205,  2,  0,  0,  8,  2,  0,  0,151,  5,  0,  0,
+  8,  2,  0,  0,152,  5,  0,  0,  9,  2,  0,  0,153,  5,  0,  0,  7,  2,  0,  0,151,  5,  0,  0, 78,  0,  0,  0,202,  2,  0,  0,
+  7,  2,  0,  0,153,  5,  0,  0,  9,  2,  0,  0,207,  2,  0,  0,  9,  2,  0,  0,152,  5,  0,  0,  8,  2,  0,  0,204,  2,  0,  0,
+ 60,  0,  0,  0,206,  2,  0,  0,198,  0,  0,  0, 72,  0,  0,  0,  4,  0,  0,  0,144,  0,  0,  0,234,  0,  0,  0,154,  5,  0,  0,
+234,  0,  0,  0,155,  5,  0,  0,  9,  2,  0,  0,156,  5,  0,  0,198,  0,  0,  0,154,  5,  0,  0, 60,  0,  0,  0, 73,  0,  0,  0,
+198,  0,  0,  0,156,  5,  0,  0,  9,  2,  0,  0,206,  2,  0,  0,  9,  2,  0,  0,155,  5,  0,  0,234,  0,  0,  0,145,  0,  0,  0,
+ 78,  0,  0,  0,207,  2,  0,  0,199,  0,  0,  0, 75,  0,  0,  0, 60,  0,  0,  0,204,  2,  0,  0,  8,  2,  0,  0,157,  5,  0,  0,
+  8,  2,  0,  0,158,  5,  0,  0, 82,  1,  0,  0,159,  5,  0,  0,199,  0,  0,  0,157,  5,  0,  0, 21,  0,  0,  0, 74,  0,  0,  0,
+199,  0,  0,  0,159,  5,  0,  0, 82,  1,  0,  0, 96,  1,  0,  0, 82,  1,  0,  0,158,  5,  0,  0,  8,  2,  0,  0,205,  2,  0,  0,
+130,  0,  0,  0, 97,  1,  0,  0, 87,  1,  0,  0,107,  1,  0,  0,132,  0,  0,  0,209,  2,  0,  0, 10,  2,  0,  0,160,  5,  0,  0,
+ 10,  2,  0,  0,161,  5,  0,  0,245,  0,  0,  0,162,  5,  0,  0, 87,  1,  0,  0,160,  5,  0,  0, 32,  0,  0,  0,106,  1,  0,  0,
+ 87,  1,  0,  0,162,  5,  0,  0,245,  0,  0,  0,166,  0,  0,  0,245,  0,  0,  0,161,  5,  0,  0, 10,  2,  0,  0,208,  2,  0,  0,
+ 83,  0,  0,  0,167,  0,  0,  0, 11,  2,  0,  0,211,  2,  0,  0, 83,  0,  0,  0,208,  2,  0,  0, 10,  2,  0,  0,163,  5,  0,  0,
+ 10,  2,  0,  0,164,  5,  0,  0, 12,  2,  0,  0,165,  5,  0,  0, 11,  2,  0,  0,163,  5,  0,  0, 65,  0,  0,  0,210,  2,  0,  0,
+ 11,  2,  0,  0,165,  5,  0,  0, 12,  2,  0,  0,212,  2,  0,  0, 12,  2,  0,  0,164,  5,  0,  0, 10,  2,  0,  0,209,  2,  0,  0,
+132,  0,  0,  0,213,  2,  0,  0, 86,  1,  0,  0,104,  1,  0,  0, 23,  0,  0,  0, 94,  0,  0,  0,209,  0,  0,  0,166,  5,  0,  0,
+209,  0,  0,  0,167,  5,  0,  0, 12,  2,  0,  0,168,  5,  0,  0, 86,  1,  0,  0,166,  5,  0,  0,132,  0,  0,  0,105,  1,  0,  0,
+ 86,  1,  0,  0,168,  5,  0,  0, 12,  2,  0,  0,213,  2,  0,  0, 12,  2,  0,  0,167,  5,  0,  0,209,  0,  0,  0, 95,  0,  0,  0,
+ 65,  0,  0,  0,212,  2,  0,  0, 11,  2,  0,  0,210,  2,  0,  0, 65,  0,  0,  0, 93,  0,  0,  0,208,  0,  0,  0,169,  5,  0,  0,
+208,  0,  0,  0,170,  5,  0,  0,244,  0,  0,  0,171,  5,  0,  0, 11,  2,  0,  0,169,  5,  0,  0, 83,  0,  0,  0,211,  2,  0,  0,
+ 11,  2,  0,  0,171,  5,  0,  0,244,  0,  0,  0,165,  0,  0,  0,244,  0,  0,  0,170,  5,  0,  0,208,  0,  0,  0, 92,  0,  0,  0,
+ 10,  0,  0,  0,164,  0,  0,  0, 86,  1,  0,  0,105,  1,  0,  0,132,  0,  0,  0,214,  2,  0,  0, 13,  2,  0,  0,172,  5,  0,  0,
+ 13,  2,  0,  0,173,  5,  0,  0, 88,  1,  0,  0,174,  5,  0,  0, 86,  1,  0,  0,172,  5,  0,  0, 23,  0,  0,  0,104,  1,  0,  0,
+ 86,  1,  0,  0,174,  5,  0,  0, 88,  1,  0,  0,108,  1,  0,  0, 88,  1,  0,  0,173,  5,  0,  0, 13,  2,  0,  0,215,  2,  0,  0,
+133,  0,  0,  0,109,  1,  0,  0, 14,  2,  0,  0,216,  2,  0,  0,133,  0,  0,  0,215,  2,  0,  0, 13,  2,  0,  0,175,  5,  0,  0,
+ 13,  2,  0,  0,176,  5,  0,  0, 15,  2,  0,  0,177,  5,  0,  0, 14,  2,  0,  0,175,  5,  0,  0,134,  0,  0,  0,217,  2,  0,  0,
+ 14,  2,  0,  0,177,  5,  0,  0, 15,  2,  0,  0,219,  2,  0,  0, 15,  2,  0,  0,176,  5,  0,  0, 13,  2,  0,  0,214,  2,  0,  0,
+132,  0,  0,  0,218,  2,  0,  0, 87,  1,  0,  0,106,  1,  0,  0, 32,  0,  0,  0,114,  1,  0,  0, 91,  1,  0,  0,178,  5,  0,  0,
+ 91,  1,  0,  0,179,  5,  0,  0, 15,  2,  0,  0,180,  5,  0,  0, 87,  1,  0,  0,178,  5,  0,  0,132,  0,  0,  0,107,  1,  0,  0,
+ 87,  1,  0,  0,180,  5,  0,  0, 15,  2,  0,  0,218,  2,  0,  0, 15,  2,  0,  0,179,  5,  0,  0, 91,  1,  0,  0,115,  1,  0,  0,
+134,  0,  0,  0,219,  2,  0,  0, 14,  2,  0,  0,217,  2,  0,  0,134,  0,  0,  0,113,  1,  0,  0, 90,  1,  0,  0,181,  5,  0,  0,
+ 90,  1,  0,  0,182,  5,  0,  0, 89,  1,  0,  0,183,  5,  0,  0, 14,  2,  0,  0,181,  5,  0,  0,133,  0,  0,  0,216,  2,  0,  0,
+ 14,  2,  0,  0,183,  5,  0,  0, 89,  1,  0,  0,111,  1,  0,  0, 89,  1,  0,  0,182,  5,  0,  0, 90,  1,  0,  0,112,  1,  0,  0,
+ 24,  0,  0,  0,110,  1,  0,  0,212,  0,  0,  0,101,  0,  0,  0, 67,  0,  0,  0,220,  2,  0,  0, 16,  2,  0,  0,184,  5,  0,  0,
+ 16,  2,  0,  0,185,  5,  0,  0,242,  0,  0,  0,186,  5,  0,  0,212,  0,  0,  0,184,  5,  0,  0,  6,  0,  0,  0,100,  0,  0,  0,
+212,  0,  0,  0,186,  5,  0,  0,242,  0,  0,  0,160,  0,  0,  0,242,  0,  0,  0,185,  5,  0,  0, 16,  2,  0,  0,221,  2,  0,  0,
+ 82,  0,  0,  0,161,  0,  0,  0, 17,  2,  0,  0,222,  2,  0,  0, 82,  0,  0,  0,221,  2,  0,  0, 16,  2,  0,  0,187,  5,  0,  0,
+ 16,  2,  0,  0,188,  5,  0,  0, 18,  2,  0,  0,189,  5,  0,  0, 17,  2,  0,  0,187,  5,  0,  0,134,  0,  0,  0,223,  2,  0,  0,
+ 17,  2,  0,  0,189,  5,  0,  0, 18,  2,  0,  0,225,  2,  0,  0, 18,  2,  0,  0,188,  5,  0,  0, 16,  2,  0,  0,220,  2,  0,  0,
+ 67,  0,  0,  0,224,  2,  0,  0,213,  0,  0,  0,102,  0,  0,  0, 24,  0,  0,  0,112,  1,  0,  0, 90,  1,  0,  0,190,  5,  0,  0,
+ 90,  1,  0,  0,191,  5,  0,  0, 18,  2,  0,  0,192,  5,  0,  0,213,  0,  0,  0,190,  5,  0,  0, 67,  0,  0,  0,103,  0,  0,  0,
+213,  0,  0,  0,192,  5,  0,  0, 18,  2,  0,  0,224,  2,  0,  0, 18,  2,  0,  0,191,  5,  0,  0, 90,  1,  0,  0,113,  1,  0,  0,
+134,  0,  0,  0,225,  2,  0,  0, 17,  2,  0,  0,223,  2,  0,  0,134,  0,  0,  0,115,  1,  0,  0, 91,  1,  0,  0,193,  5,  0,  0,
+ 91,  1,  0,  0,194,  5,  0,  0,243,  0,  0,  0,195,  5,  0,  0, 17,  2,  0,  0,193,  5,  0,  0, 82,  0,  0,  0,222,  2,  0,  0,
+ 17,  2,  0,  0,195,  5,  0,  0,243,  0,  0,  0,163,  0,  0,  0,243,  0,  0,  0,194,  5,  0,  0, 91,  1,  0,  0,114,  1,  0,  0,
+ 32,  0,  0,  0,162,  0,  0,  0,211,  0,  0,  0, 99,  0,  0,  0, 66,  0,  0,  0,226,  2,  0,  0, 19,  2,  0,  0,196,  5,  0,  0,
+ 19,  2,  0,  0,197,  5,  0,  0, 89,  1,  0,  0,198,  5,  0,  0,211,  0,  0,  0,196,  5,  0,  0, 24,  0,  0,  0, 98,  0,  0,  0,
+211,  0,  0,  0,198,  5,  0,  0, 89,  1,  0,  0,110,  1,  0,  0, 89,  1,  0,  0,197,  5,  0,  0, 19,  2,  0,  0,227,  2,  0,  0,
+133,  0,  0,  0,111,  1,  0,  0, 20,  2,  0,  0,229,  2,  0,  0,133,  0,  0,  0,227,  2,  0,  0, 19,  2,  0,  0,199,  5,  0,  0,
+ 19,  2,  0,  0,200,  5,  0,  0, 21,  2,  0,  0,201,  5,  0,  0, 20,  2,  0,  0,199,  5,  0,  0, 64,  0,  0,  0,228,  2,  0,  0,
+ 20,  2,  0,  0,201,  5,  0,  0, 21,  2,  0,  0,230,  2,  0,  0, 21,  2,  0,  0,200,  5,  0,  0, 19,  2,  0,  0,226,  2,  0,  0,
+ 66,  0,  0,  0,231,  2,  0,  0,210,  0,  0,  0, 96,  0,  0,  0,  1,  0,  0,  0, 88,  0,  0,  0,206,  0,  0,  0,202,  5,  0,  0,
+206,  0,  0,  0,203,  5,  0,  0, 21,  2,  0,  0,204,  5,  0,  0,210,  0,  0,  0,202,  5,  0,  0, 66,  0,  0,  0, 97,  0,  0,  0,
+210,  0,  0,  0,204,  5,  0,  0, 21,  2,  0,  0,231,  2,  0,  0, 21,  2,  0,  0,203,  5,  0,  0,206,  0,  0,  0, 89,  0,  0,  0,
+ 64,  0,  0,  0,230,  2,  0,  0, 20,  2,  0,  0,228,  2,  0,  0, 64,  0,  0,  0, 91,  0,  0,  0,207,  0,  0,  0,205,  5,  0,  0,
+207,  0,  0,  0,206,  5,  0,  0, 88,  1,  0,  0,207,  5,  0,  0, 20,  2,  0,  0,205,  5,  0,  0,133,  0,  0,  0,229,  2,  0,  0,
+ 20,  2,  0,  0,207,  5,  0,  0, 88,  1,  0,  0,109,  1,  0,  0, 88,  1,  0,  0,206,  5,  0,  0,207,  0,  0,  0, 90,  0,  0,  0,
+ 23,  0,  0,  0,108,  1,  0,  0, 93,  1,  0,  0,119,  1,  0,  0,135,  0,  0,  0,233,  2,  0,  0, 22,  2,  0,  0,208,  5,  0,  0,
+ 22,  2,  0,  0,209,  5,  0,  0,247,  0,  0,  0,210,  5,  0,  0, 93,  1,  0,  0,208,  5,  0,  0, 33,  0,  0,  0,118,  1,  0,  0,
+ 93,  1,  0,  0,210,  5,  0,  0,247,  0,  0,  0,170,  0,  0,  0,247,  0,  0,  0,209,  5,  0,  0, 22,  2,  0,  0,232,  2,  0,  0,
+ 84,  0,  0,  0,171,  0,  0,  0, 23,  2,  0,  0,235,  2,  0,  0, 84,  0,  0,  0,232,  2,  0,  0, 22,  2,  0,  0,211,  5,  0,  0,
+ 22,  2,  0,  0,212,  5,  0,  0, 24,  2,  0,  0,213,  5,  0,  0, 23,  2,  0,  0,211,  5,  0,  0, 69,  0,  0,  0,234,  2,  0,  0,
+ 23,  2,  0,  0,213,  5,  0,  0, 24,  2,  0,  0,236,  2,  0,  0, 24,  2,  0,  0,212,  5,  0,  0, 22,  2,  0,  0,233,  2,  0,  0,
+135,  0,  0,  0,237,  2,  0,  0, 92,  1,  0,  0,116,  1,  0,  0, 25,  0,  0,  0,110,  0,  0,  0,217,  0,  0,  0,214,  5,  0,  0,
+217,  0,  0,  0,215,  5,  0,  0, 24,  2,  0,  0,216,  5,  0,  0, 92,  1,  0,  0,214,  5,  0,  0,135,  0,  0,  0,117,  1,  0,  0,
+ 92,  1,  0,  0,216,  5,  0,  0, 24,  2,  0,  0,237,  2,  0,  0, 24,  2,  0,  0,215,  5,  0,  0,217,  0,  0,  0,111,  0,  0,  0,
+ 69,  0,  0,  0,236,  2,  0,  0, 23,  2,  0,  0,234,  2,  0,  0, 69,  0,  0,  0,109,  0,  0,  0,216,  0,  0,  0,217,  5,  0,  0,
+216,  0,  0,  0,218,  5,  0,  0,246,  0,  0,  0,219,  5,  0,  0, 23,  2,  0,  0,217,  5,  0,  0, 84,  0,  0,  0,235,  2,  0,  0,
+ 23,  2,  0,  0,219,  5,  0,  0,246,  0,  0,  0,169,  0,  0,  0,246,  0,  0,  0,218,  5,  0,  0,216,  0,  0,  0,108,  0,  0,  0,
+  6,  0,  0,  0,168,  0,  0,  0, 92,  1,  0,  0,117,  1,  0,  0,135,  0,  0,  0,238,  2,  0,  0, 25,  2,  0,  0,220,  5,  0,  0,
+ 25,  2,  0,  0,221,  5,  0,  0, 94,  1,  0,  0,222,  5,  0,  0, 92,  1,  0,  0,220,  5,  0,  0, 25,  0,  0,  0,116,  1,  0,  0,
+ 92,  1,  0,  0,222,  5,  0,  0, 94,  1,  0,  0,120,  1,  0,  0, 94,  1,  0,  0,221,  5,  0,  0, 25,  2,  0,  0,239,  2,  0,  0,
+136,  0,  0,  0,121,  1,  0,  0, 26,  2,  0,  0,240,  2,  0,  0,136,  0,  0,  0,239,  2,  0,  0, 25,  2,  0,  0,223,  5,  0,  0,
+ 25,  2,  0,  0,224,  5,  0,  0, 27,  2,  0,  0,225,  5,  0,  0, 26,  2,  0,  0,223,  5,  0,  0,137,  0,  0,  0,241,  2,  0,  0,
+ 26,  2,  0,  0,225,  5,  0,  0, 27,  2,  0,  0,243,  2,  0,  0, 27,  2,  0,  0,224,  5,  0,  0, 25,  2,  0,  0,238,  2,  0,  0,
+135,  0,  0,  0,242,  2,  0,  0, 93,  1,  0,  0,118,  1,  0,  0, 33,  0,  0,  0,126,  1,  0,  0, 97,  1,  0,  0,226,  5,  0,  0,
+ 97,  1,  0,  0,227,  5,  0,  0, 27,  2,  0,  0,228,  5,  0,  0, 93,  1,  0,  0,226,  5,  0,  0,135,  0,  0,  0,119,  1,  0,  0,
+ 93,  1,  0,  0,228,  5,  0,  0, 27,  2,  0,  0,242,  2,  0,  0, 27,  2,  0,  0,227,  5,  0,  0, 97,  1,  0,  0,127,  1,  0,  0,
+137,  0,  0,  0,243,  2,  0,  0, 26,  2,  0,  0,241,  2,  0,  0,137,  0,  0,  0,125,  1,  0,  0, 96,  1,  0,  0,229,  5,  0,  0,
+ 96,  1,  0,  0,230,  5,  0,  0, 95,  1,  0,  0,231,  5,  0,  0, 26,  2,  0,  0,229,  5,  0,  0,136,  0,  0,  0,240,  2,  0,  0,
+ 26,  2,  0,  0,231,  5,  0,  0, 95,  1,  0,  0,123,  1,  0,  0, 95,  1,  0,  0,230,  5,  0,  0, 96,  1,  0,  0,124,  1,  0,  0,
+ 26,  0,  0,  0,122,  1,  0,  0,220,  0,  0,  0,117,  0,  0,  0, 71,  0,  0,  0,244,  2,  0,  0, 28,  2,  0,  0,232,  5,  0,  0,
+ 28,  2,  0,  0,233,  5,  0,  0,248,  0,  0,  0,234,  5,  0,  0,220,  0,  0,  0,232,  5,  0,  0,  7,  0,  0,  0,116,  0,  0,  0,
+220,  0,  0,  0,234,  5,  0,  0,248,  0,  0,  0,172,  0,  0,  0,248,  0,  0,  0,233,  5,  0,  0, 28,  2,  0,  0,245,  2,  0,  0,
+ 85,  0,  0,  0,173,  0,  0,  0, 29,  2,  0,  0,246,  2,  0,  0, 85,  0,  0,  0,245,  2,  0,  0, 28,  2,  0,  0,235,  5,  0,  0,
+ 28,  2,  0,  0,236,  5,  0,  0, 30,  2,  0,  0,237,  5,  0,  0, 29,  2,  0,  0,235,  5,  0,  0,137,  0,  0,  0,247,  2,  0,  0,
+ 29,  2,  0,  0,237,  5,  0,  0, 30,  2,  0,  0,249,  2,  0,  0, 30,  2,  0,  0,236,  5,  0,  0, 28,  2,  0,  0,244,  2,  0,  0,
+ 71,  0,  0,  0,248,  2,  0,  0,221,  0,  0,  0,118,  0,  0,  0, 26,  0,  0,  0,124,  1,  0,  0, 96,  1,  0,  0,238,  5,  0,  0,
+ 96,  1,  0,  0,239,  5,  0,  0, 30,  2,  0,  0,240,  5,  0,  0,221,  0,  0,  0,238,  5,  0,  0, 71,  0,  0,  0,119,  0,  0,  0,
+221,  0,  0,  0,240,  5,  0,  0, 30,  2,  0,  0,248,  2,  0,  0, 30,  2,  0,  0,239,  5,  0,  0, 96,  1,  0,  0,125,  1,  0,  0,
+137,  0,  0,  0,249,  2,  0,  0, 29,  2,  0,  0,247,  2,  0,  0,137,  0,  0,  0,127,  1,  0,  0, 97,  1,  0,  0,241,  5,  0,  0,
+ 97,  1,  0,  0,242,  5,  0,  0,249,  0,  0,  0,243,  5,  0,  0, 29,  2,  0,  0,241,  5,  0,  0, 85,  0,  0,  0,246,  2,  0,  0,
+ 29,  2,  0,  0,243,  5,  0,  0,249,  0,  0,  0,175,  0,  0,  0,249,  0,  0,  0,242,  5,  0,  0, 97,  1,  0,  0,126,  1,  0,  0,
+ 33,  0,  0,  0,174,  0,  0,  0,219,  0,  0,  0,115,  0,  0,  0, 70,  0,  0,  0,250,  2,  0,  0, 31,  2,  0,  0,244,  5,  0,  0,
+ 31,  2,  0,  0,245,  5,  0,  0, 95,  1,  0,  0,246,  5,  0,  0,219,  0,  0,  0,244,  5,  0,  0, 26,  0,  0,  0,114,  0,  0,  0,
+219,  0,  0,  0,246,  5,  0,  0, 95,  1,  0,  0,122,  1,  0,  0, 95,  1,  0,  0,245,  5,  0,  0, 31,  2,  0,  0,251,  2,  0,  0,
+136,  0,  0,  0,123,  1,  0,  0, 32,  2,  0,  0,253,  2,  0,  0,136,  0,  0,  0,251,  2,  0,  0, 31,  2,  0,  0,247,  5,  0,  0,
+ 31,  2,  0,  0,248,  5,  0,  0, 33,  2,  0,  0,249,  5,  0,  0, 32,  2,  0,  0,247,  5,  0,  0, 68,  0,  0,  0,252,  2,  0,  0,
+ 32,  2,  0,  0,249,  5,  0,  0, 33,  2,  0,  0,254,  2,  0,  0, 33,  2,  0,  0,248,  5,  0,  0, 31,  2,  0,  0,250,  2,  0,  0,
+ 70,  0,  0,  0,255,  2,  0,  0,218,  0,  0,  0,112,  0,  0,  0,  2,  0,  0,  0,104,  0,  0,  0,214,  0,  0,  0,250,  5,  0,  0,
+214,  0,  0,  0,251,  5,  0,  0, 33,  2,  0,  0,252,  5,  0,  0,218,  0,  0,  0,250,  5,  0,  0, 70,  0,  0,  0,113,  0,  0,  0,
+218,  0,  0,  0,252,  5,  0,  0, 33,  2,  0,  0,255,  2,  0,  0, 33,  2,  0,  0,251,  5,  0,  0,214,  0,  0,  0,105,  0,  0,  0,
+ 68,  0,  0,  0,254,  2,  0,  0, 32,  2,  0,  0,252,  2,  0,  0, 68,  0,  0,  0,107,  0,  0,  0,215,  0,  0,  0,253,  5,  0,  0,
+215,  0,  0,  0,254,  5,  0,  0, 94,  1,  0,  0,255,  5,  0,  0, 32,  2,  0,  0,253,  5,  0,  0,136,  0,  0,  0,253,  2,  0,  0,
+ 32,  2,  0,  0,255,  5,  0,  0, 94,  1,  0,  0,121,  1,  0,  0, 94,  1,  0,  0,254,  5,  0,  0,215,  0,  0,  0,106,  0,  0,  0,
+ 25,  0,  0,  0,120,  1,  0,  0, 99,  1,  0,  0,131,  1,  0,  0,138,  0,  0,  0,  1,  3,  0,  0, 34,  2,  0,  0,  0,  6,  0,  0,
+ 34,  2,  0,  0,  1,  6,  0,  0,251,  0,  0,  0,  2,  6,  0,  0, 99,  1,  0,  0,  0,  6,  0,  0, 34,  0,  0,  0,130,  1,  0,  0,
+ 99,  1,  0,  0,  2,  6,  0,  0,251,  0,  0,  0,178,  0,  0,  0,251,  0,  0,  0,  1,  6,  0,  0, 34,  2,  0,  0,  0,  3,  0,  0,
+ 86,  0,  0,  0,179,  0,  0,  0, 35,  2,  0,  0,  3,  3,  0,  0, 86,  0,  0,  0,  0,  3,  0,  0, 34,  2,  0,  0,  3,  6,  0,  0,
+ 34,  2,  0,  0,  4,  6,  0,  0, 36,  2,  0,  0,  5,  6,  0,  0, 35,  2,  0,  0,  3,  6,  0,  0, 73,  0,  0,  0,  2,  3,  0,  0,
+ 35,  2,  0,  0,  5,  6,  0,  0, 36,  2,  0,  0,  4,  3,  0,  0, 36,  2,  0,  0,  4,  6,  0,  0, 34,  2,  0,  0,  1,  3,  0,  0,
+138,  0,  0,  0,  5,  3,  0,  0, 98,  1,  0,  0,128,  1,  0,  0, 27,  0,  0,  0,126,  0,  0,  0,225,  0,  0,  0,  6,  6,  0,  0,
+225,  0,  0,  0,  7,  6,  0,  0, 36,  2,  0,  0,  8,  6,  0,  0, 98,  1,  0,  0,  6,  6,  0,  0,138,  0,  0,  0,129,  1,  0,  0,
+ 98,  1,  0,  0,  8,  6,  0,  0, 36,  2,  0,  0,  5,  3,  0,  0, 36,  2,  0,  0,  7,  6,  0,  0,225,  0,  0,  0,127,  0,  0,  0,
+ 73,  0,  0,  0,  4,  3,  0,  0, 35,  2,  0,  0,  2,  3,  0,  0, 73,  0,  0,  0,125,  0,  0,  0,224,  0,  0,  0,  9,  6,  0,  0,
+224,  0,  0,  0, 10,  6,  0,  0,250,  0,  0,  0, 11,  6,  0,  0, 35,  2,  0,  0,  9,  6,  0,  0, 86,  0,  0,  0,  3,  3,  0,  0,
+ 35,  2,  0,  0, 11,  6,  0,  0,250,  0,  0,  0,177,  0,  0,  0,250,  0,  0,  0, 10,  6,  0,  0,224,  0,  0,  0,124,  0,  0,  0,
+  7,  0,  0,  0,176,  0,  0,  0, 98,  1,  0,  0,129,  1,  0,  0,138,  0,  0,  0,  6,  3,  0,  0, 37,  2,  0,  0, 12,  6,  0,  0,
+ 37,  2,  0,  0, 13,  6,  0,  0,100,  1,  0,  0, 14,  6,  0,  0, 98,  1,  0,  0, 12,  6,  0,  0, 27,  0,  0,  0,128,  1,  0,  0,
+ 98,  1,  0,  0, 14,  6,  0,  0,100,  1,  0,  0,132,  1,  0,  0,100,  1,  0,  0, 13,  6,  0,  0, 37,  2,  0,  0,  7,  3,  0,  0,
+139,  0,  0,  0,133,  1,  0,  0, 38,  2,  0,  0,  8,  3,  0,  0,139,  0,  0,  0,  7,  3,  0,  0, 37,  2,  0,  0, 15,  6,  0,  0,
+ 37,  2,  0,  0, 16,  6,  0,  0, 39,  2,  0,  0, 17,  6,  0,  0, 38,  2,  0,  0, 15,  6,  0,  0,140,  0,  0,  0,  9,  3,  0,  0,
+ 38,  2,  0,  0, 17,  6,  0,  0, 39,  2,  0,  0, 11,  3,  0,  0, 39,  2,  0,  0, 16,  6,  0,  0, 37,  2,  0,  0,  6,  3,  0,  0,
+138,  0,  0,  0, 10,  3,  0,  0, 99,  1,  0,  0,130,  1,  0,  0, 34,  0,  0,  0,138,  1,  0,  0,103,  1,  0,  0, 18,  6,  0,  0,
+103,  1,  0,  0, 19,  6,  0,  0, 39,  2,  0,  0, 20,  6,  0,  0, 99,  1,  0,  0, 18,  6,  0,  0,138,  0,  0,  0,131,  1,  0,  0,
+ 99,  1,  0,  0, 20,  6,  0,  0, 39,  2,  0,  0, 10,  3,  0,  0, 39,  2,  0,  0, 19,  6,  0,  0,103,  1,  0,  0,139,  1,  0,  0,
+140,  0,  0,  0, 11,  3,  0,  0, 38,  2,  0,  0,  9,  3,  0,  0,140,  0,  0,  0,137,  1,  0,  0,102,  1,  0,  0, 21,  6,  0,  0,
+102,  1,  0,  0, 22,  6,  0,  0,101,  1,  0,  0, 23,  6,  0,  0, 38,  2,  0,  0, 21,  6,  0,  0,139,  0,  0,  0,  8,  3,  0,  0,
+ 38,  2,  0,  0, 23,  6,  0,  0,101,  1,  0,  0,135,  1,  0,  0,101,  1,  0,  0, 22,  6,  0,  0,102,  1,  0,  0,136,  1,  0,  0,
+ 28,  0,  0,  0,134,  1,  0,  0,228,  0,  0,  0,133,  0,  0,  0, 75,  0,  0,  0, 12,  3,  0,  0, 40,  2,  0,  0, 24,  6,  0,  0,
+ 40,  2,  0,  0, 25,  6,  0,  0,252,  0,  0,  0, 26,  6,  0,  0,228,  0,  0,  0, 24,  6,  0,  0,  8,  0,  0,  0,132,  0,  0,  0,
+228,  0,  0,  0, 26,  6,  0,  0,252,  0,  0,  0,180,  0,  0,  0,252,  0,  0,  0, 25,  6,  0,  0, 40,  2,  0,  0, 13,  3,  0,  0,
+ 87,  0,  0,  0,181,  0,  0,  0, 41,  2,  0,  0, 14,  3,  0,  0, 87,  0,  0,  0, 13,  3,  0,  0, 40,  2,  0,  0, 27,  6,  0,  0,
+ 40,  2,  0,  0, 28,  6,  0,  0, 42,  2,  0,  0, 29,  6,  0,  0, 41,  2,  0,  0, 27,  6,  0,  0,140,  0,  0,  0, 15,  3,  0,  0,
+ 41,  2,  0,  0, 29,  6,  0,  0, 42,  2,  0,  0, 17,  3,  0,  0, 42,  2,  0,  0, 28,  6,  0,  0, 40,  2,  0,  0, 12,  3,  0,  0,
+ 75,  0,  0,  0, 16,  3,  0,  0,229,  0,  0,  0,134,  0,  0,  0, 28,  0,  0,  0,136,  1,  0,  0,102,  1,  0,  0, 30,  6,  0,  0,
+102,  1,  0,  0, 31,  6,  0,  0, 42,  2,  0,  0, 32,  6,  0,  0,229,  0,  0,  0, 30,  6,  0,  0, 75,  0,  0,  0,135,  0,  0,  0,
+229,  0,  0,  0, 32,  6,  0,  0, 42,  2,  0,  0, 16,  3,  0,  0, 42,  2,  0,  0, 31,  6,  0,  0,102,  1,  0,  0,137,  1,  0,  0,
+140,  0,  0,  0, 17,  3,  0,  0, 41,  2,  0,  0, 15,  3,  0,  0,140,  0,  0,  0,139,  1,  0,  0,103,  1,  0,  0, 33,  6,  0,  0,
+103,  1,  0,  0, 34,  6,  0,  0,253,  0,  0,  0, 35,  6,  0,  0, 41,  2,  0,  0, 33,  6,  0,  0, 87,  0,  0,  0, 14,  3,  0,  0,
+ 41,  2,  0,  0, 35,  6,  0,  0,253,  0,  0,  0,183,  0,  0,  0,253,  0,  0,  0, 34,  6,  0,  0,103,  1,  0,  0,138,  1,  0,  0,
+ 34,  0,  0,  0,182,  0,  0,  0,227,  0,  0,  0,131,  0,  0,  0, 74,  0,  0,  0, 18,  3,  0,  0, 43,  2,  0,  0, 36,  6,  0,  0,
+ 43,  2,  0,  0, 37,  6,  0,  0,101,  1,  0,  0, 38,  6,  0,  0,227,  0,  0,  0, 36,  6,  0,  0, 28,  0,  0,  0,130,  0,  0,  0,
+227,  0,  0,  0, 38,  6,  0,  0,101,  1,  0,  0,134,  1,  0,  0,101,  1,  0,  0, 37,  6,  0,  0, 43,  2,  0,  0, 19,  3,  0,  0,
+139,  0,  0,  0,135,  1,  0,  0, 44,  2,  0,  0, 21,  3,  0,  0,139,  0,  0,  0, 19,  3,  0,  0, 43,  2,  0,  0, 39,  6,  0,  0,
+ 43,  2,  0,  0, 40,  6,  0,  0, 45,  2,  0,  0, 41,  6,  0,  0, 44,  2,  0,  0, 39,  6,  0,  0, 72,  0,  0,  0, 20,  3,  0,  0,
+ 44,  2,  0,  0, 41,  6,  0,  0, 45,  2,  0,  0, 22,  3,  0,  0, 45,  2,  0,  0, 40,  6,  0,  0, 43,  2,  0,  0, 18,  3,  0,  0,
+ 74,  0,  0,  0, 23,  3,  0,  0,226,  0,  0,  0,128,  0,  0,  0,  3,  0,  0,  0,120,  0,  0,  0,222,  0,  0,  0, 42,  6,  0,  0,
+222,  0,  0,  0, 43,  6,  0,  0, 45,  2,  0,  0, 44,  6,  0,  0,226,  0,  0,  0, 42,  6,  0,  0, 74,  0,  0,  0,129,  0,  0,  0,
+226,  0,  0,  0, 44,  6,  0,  0, 45,  2,  0,  0, 23,  3,  0,  0, 45,  2,  0,  0, 43,  6,  0,  0,222,  0,  0,  0,121,  0,  0,  0,
+ 72,  0,  0,  0, 22,  3,  0,  0, 44,  2,  0,  0, 20,  3,  0,  0, 72,  0,  0,  0,123,  0,  0,  0,223,  0,  0,  0, 45,  6,  0,  0,
+223,  0,  0,  0, 46,  6,  0,  0,100,  1,  0,  0, 47,  6,  0,  0, 44,  2,  0,  0, 45,  6,  0,  0,139,  0,  0,  0, 21,  3,  0,  0,
+ 44,  2,  0,  0, 47,  6,  0,  0,100,  1,  0,  0,133,  1,  0,  0,100,  1,  0,  0, 46,  6,  0,  0,223,  0,  0,  0,122,  0,  0,  0,
+ 27,  0,  0,  0,132,  1,  0,  0,105,  1,  0,  0,143,  1,  0,  0,141,  0,  0,  0, 25,  3,  0,  0, 46,  2,  0,  0, 48,  6,  0,  0,
+ 46,  2,  0,  0, 49,  6,  0,  0,255,  0,  0,  0, 50,  6,  0,  0,105,  1,  0,  0, 48,  6,  0,  0, 35,  0,  0,  0,142,  1,  0,  0,
+105,  1,  0,  0, 50,  6,  0,  0,255,  0,  0,  0,186,  0,  0,  0,255,  0,  0,  0, 49,  6,  0,  0, 46,  2,  0,  0, 24,  3,  0,  0,
+ 88,  0,  0,  0,187,  0,  0,  0, 47,  2,  0,  0, 27,  3,  0,  0, 88,  0,  0,  0, 24,  3,  0,  0, 46,  2,  0,  0, 51,  6,  0,  0,
+ 46,  2,  0,  0, 52,  6,  0,  0, 48,  2,  0,  0, 53,  6,  0,  0, 47,  2,  0,  0, 51,  6,  0,  0, 77,  0,  0,  0, 26,  3,  0,  0,
+ 47,  2,  0,  0, 53,  6,  0,  0, 48,  2,  0,  0, 28,  3,  0,  0, 48,  2,  0,  0, 52,  6,  0,  0, 46,  2,  0,  0, 25,  3,  0,  0,
+141,  0,  0,  0, 29,  3,  0,  0,104,  1,  0,  0,140,  1,  0,  0, 29,  0,  0,  0,142,  0,  0,  0,233,  0,  0,  0, 54,  6,  0,  0,
+233,  0,  0,  0, 55,  6,  0,  0, 48,  2,  0,  0, 56,  6,  0,  0,104,  1,  0,  0, 54,  6,  0,  0,141,  0,  0,  0,141,  1,  0,  0,
+104,  1,  0,  0, 56,  6,  0,  0, 48,  2,  0,  0, 29,  3,  0,  0, 48,  2,  0,  0, 55,  6,  0,  0,233,  0,  0,  0,143,  0,  0,  0,
+ 77,  0,  0,  0, 28,  3,  0,  0, 47,  2,  0,  0, 26,  3,  0,  0, 77,  0,  0,  0,141,  0,  0,  0,232,  0,  0,  0, 57,  6,  0,  0,
+232,  0,  0,  0, 58,  6,  0,  0,254,  0,  0,  0, 59,  6,  0,  0, 47,  2,  0,  0, 57,  6,  0,  0, 88,  0,  0,  0, 27,  3,  0,  0,
+ 47,  2,  0,  0, 59,  6,  0,  0,254,  0,  0,  0,185,  0,  0,  0,254,  0,  0,  0, 58,  6,  0,  0,232,  0,  0,  0,140,  0,  0,  0,
+  8,  0,  0,  0,184,  0,  0,  0,104,  1,  0,  0,141,  1,  0,  0,141,  0,  0,  0, 30,  3,  0,  0, 49,  2,  0,  0, 60,  6,  0,  0,
+ 49,  2,  0,  0, 61,  6,  0,  0,106,  1,  0,  0, 62,  6,  0,  0,104,  1,  0,  0, 60,  6,  0,  0, 29,  0,  0,  0,140,  1,  0,  0,
+104,  1,  0,  0, 62,  6,  0,  0,106,  1,  0,  0,144,  1,  0,  0,106,  1,  0,  0, 61,  6,  0,  0, 49,  2,  0,  0, 31,  3,  0,  0,
+142,  0,  0,  0,145,  1,  0,  0, 50,  2,  0,  0, 32,  3,  0,  0,142,  0,  0,  0, 31,  3,  0,  0, 49,  2,  0,  0, 63,  6,  0,  0,
+ 49,  2,  0,  0, 64,  6,  0,  0, 51,  2,  0,  0, 65,  6,  0,  0, 50,  2,  0,  0, 63,  6,  0,  0,143,  0,  0,  0, 33,  3,  0,  0,
+ 50,  2,  0,  0, 65,  6,  0,  0, 51,  2,  0,  0, 35,  3,  0,  0, 51,  2,  0,  0, 64,  6,  0,  0, 49,  2,  0,  0, 30,  3,  0,  0,
+141,  0,  0,  0, 34,  3,  0,  0,105,  1,  0,  0,142,  1,  0,  0, 35,  0,  0,  0,150,  1,  0,  0,109,  1,  0,  0, 66,  6,  0,  0,
+109,  1,  0,  0, 67,  6,  0,  0, 51,  2,  0,  0, 68,  6,  0,  0,105,  1,  0,  0, 66,  6,  0,  0,141,  0,  0,  0,143,  1,  0,  0,
+105,  1,  0,  0, 68,  6,  0,  0, 51,  2,  0,  0, 34,  3,  0,  0, 51,  2,  0,  0, 67,  6,  0,  0,109,  1,  0,  0,151,  1,  0,  0,
+143,  0,  0,  0, 35,  3,  0,  0, 50,  2,  0,  0, 33,  3,  0,  0,143,  0,  0,  0,149,  1,  0,  0,108,  1,  0,  0, 69,  6,  0,  0,
+108,  1,  0,  0, 70,  6,  0,  0,107,  1,  0,  0, 71,  6,  0,  0, 50,  2,  0,  0, 69,  6,  0,  0,142,  0,  0,  0, 32,  3,  0,  0,
+ 50,  2,  0,  0, 71,  6,  0,  0,107,  1,  0,  0,147,  1,  0,  0,107,  1,  0,  0, 70,  6,  0,  0,108,  1,  0,  0,148,  1,  0,  0,
+ 30,  0,  0,  0,146,  1,  0,  0,236,  0,  0,  0,149,  0,  0,  0, 79,  0,  0,  0, 36,  3,  0,  0, 52,  2,  0,  0, 72,  6,  0,  0,
+ 52,  2,  0,  0, 73,  6,  0,  0,  0,  1,  0,  0, 74,  6,  0,  0,236,  0,  0,  0, 72,  6,  0,  0,  9,  0,  0,  0,148,  0,  0,  0,
+236,  0,  0,  0, 74,  6,  0,  0,  0,  1,  0,  0,188,  0,  0,  0,  0,  1,  0,  0, 73,  6,  0,  0, 52,  2,  0,  0, 37,  3,  0,  0,
+ 89,  0,  0,  0,189,  0,  0,  0, 53,  2,  0,  0, 38,  3,  0,  0, 89,  0,  0,  0, 37,  3,  0,  0, 52,  2,  0,  0, 75,  6,  0,  0,
+ 52,  2,  0,  0, 76,  6,  0,  0, 54,  2,  0,  0, 77,  6,  0,  0, 53,  2,  0,  0, 75,  6,  0,  0,143,  0,  0,  0, 39,  3,  0,  0,
+ 53,  2,  0,  0, 77,  6,  0,  0, 54,  2,  0,  0, 41,  3,  0,  0, 54,  2,  0,  0, 76,  6,  0,  0, 52,  2,  0,  0, 36,  3,  0,  0,
+ 79,  0,  0,  0, 40,  3,  0,  0,237,  0,  0,  0,150,  0,  0,  0, 30,  0,  0,  0,148,  1,  0,  0,108,  1,  0,  0, 78,  6,  0,  0,
+108,  1,  0,  0, 79,  6,  0,  0, 54,  2,  0,  0, 80,  6,  0,  0,237,  0,  0,  0, 78,  6,  0,  0, 79,  0,  0,  0,151,  0,  0,  0,
+237,  0,  0,  0, 80,  6,  0,  0, 54,  2,  0,  0, 40,  3,  0,  0, 54,  2,  0,  0, 79,  6,  0,  0,108,  1,  0,  0,149,  1,  0,  0,
+143,  0,  0,  0, 41,  3,  0,  0, 53,  2,  0,  0, 39,  3,  0,  0,143,  0,  0,  0,151,  1,  0,  0,109,  1,  0,  0, 81,  6,  0,  0,
+109,  1,  0,  0, 82,  6,  0,  0,  1,  1,  0,  0, 83,  6,  0,  0, 53,  2,  0,  0, 81,  6,  0,  0, 89,  0,  0,  0, 38,  3,  0,  0,
+ 53,  2,  0,  0, 83,  6,  0,  0,  1,  1,  0,  0,191,  0,  0,  0,  1,  1,  0,  0, 82,  6,  0,  0,109,  1,  0,  0,150,  1,  0,  0,
+ 35,  0,  0,  0,190,  0,  0,  0,235,  0,  0,  0,147,  0,  0,  0, 78,  0,  0,  0, 42,  3,  0,  0, 55,  2,  0,  0, 84,  6,  0,  0,
+ 55,  2,  0,  0, 85,  6,  0,  0,107,  1,  0,  0, 86,  6,  0,  0,235,  0,  0,  0, 84,  6,  0,  0, 30,  0,  0,  0,146,  0,  0,  0,
+235,  0,  0,  0, 86,  6,  0,  0,107,  1,  0,  0,146,  1,  0,  0,107,  1,  0,  0, 85,  6,  0,  0, 55,  2,  0,  0, 43,  3,  0,  0,
+142,  0,  0,  0,147,  1,  0,  0, 56,  2,  0,  0, 45,  3,  0,  0,142,  0,  0,  0, 43,  3,  0,  0, 55,  2,  0,  0, 87,  6,  0,  0,
+ 55,  2,  0,  0, 88,  6,  0,  0, 57,  2,  0,  0, 89,  6,  0,  0, 56,  2,  0,  0, 87,  6,  0,  0, 76,  0,  0,  0, 44,  3,  0,  0,
+ 56,  2,  0,  0, 89,  6,  0,  0, 57,  2,  0,  0, 46,  3,  0,  0, 57,  2,  0,  0, 88,  6,  0,  0, 55,  2,  0,  0, 42,  3,  0,  0,
+ 78,  0,  0,  0, 47,  3,  0,  0,234,  0,  0,  0,144,  0,  0,  0,  4,  0,  0,  0,136,  0,  0,  0,230,  0,  0,  0, 90,  6,  0,  0,
+230,  0,  0,  0, 91,  6,  0,  0, 57,  2,  0,  0, 92,  6,  0,  0,234,  0,  0,  0, 90,  6,  0,  0, 78,  0,  0,  0,145,  0,  0,  0,
+234,  0,  0,  0, 92,  6,  0,  0, 57,  2,  0,  0, 47,  3,  0,  0, 57,  2,  0,  0, 91,  6,  0,  0,230,  0,  0,  0,137,  0,  0,  0,
+ 76,  0,  0,  0, 46,  3,  0,  0, 56,  2,  0,  0, 44,  3,  0,  0, 76,  0,  0,  0,139,  0,  0,  0,231,  0,  0,  0, 93,  6,  0,  0,
+231,  0,  0,  0, 94,  6,  0,  0,106,  1,  0,  0, 95,  6,  0,  0, 56,  2,  0,  0, 93,  6,  0,  0,142,  0,  0,  0, 45,  3,  0,  0,
+ 56,  2,  0,  0, 95,  6,  0,  0,106,  1,  0,  0,145,  1,  0,  0,106,  1,  0,  0, 94,  6,  0,  0,231,  0,  0,  0,138,  0,  0,  0,
+ 29,  0,  0,  0,144,  1,  0,  0,111,  1,  0,  0,155,  1,  0,  0,144,  0,  0,  0, 49,  3,  0,  0, 58,  2,  0,  0, 96,  6,  0,  0,
+ 58,  2,  0,  0, 97,  6,  0,  0,  3,  1,  0,  0, 98,  6,  0,  0,111,  1,  0,  0, 96,  6,  0,  0, 36,  0,  0,  0,154,  1,  0,  0,
+111,  1,  0,  0, 98,  6,  0,  0,  3,  1,  0,  0,194,  0,  0,  0,  3,  1,  0,  0, 97,  6,  0,  0, 58,  2,  0,  0, 48,  3,  0,  0,
+ 90,  0,  0,  0,195,  0,  0,  0, 59,  2,  0,  0, 51,  3,  0,  0, 90,  0,  0,  0, 48,  3,  0,  0, 58,  2,  0,  0, 99,  6,  0,  0,
+ 58,  2,  0,  0,100,  6,  0,  0, 60,  2,  0,  0,101,  6,  0,  0, 59,  2,  0,  0, 99,  6,  0,  0, 81,  0,  0,  0, 50,  3,  0,  0,
+ 59,  2,  0,  0,101,  6,  0,  0, 60,  2,  0,  0, 52,  3,  0,  0, 60,  2,  0,  0,100,  6,  0,  0, 58,  2,  0,  0, 49,  3,  0,  0,
+144,  0,  0,  0, 53,  3,  0,  0,110,  1,  0,  0,152,  1,  0,  0, 31,  0,  0,  0,158,  0,  0,  0,241,  0,  0,  0,102,  6,  0,  0,
+241,  0,  0,  0,103,  6,  0,  0, 60,  2,  0,  0,104,  6,  0,  0,110,  1,  0,  0,102,  6,  0,  0,144,  0,  0,  0,153,  1,  0,  0,
+110,  1,  0,  0,104,  6,  0,  0, 60,  2,  0,  0, 53,  3,  0,  0, 60,  2,  0,  0,103,  6,  0,  0,241,  0,  0,  0,159,  0,  0,  0,
+ 81,  0,  0,  0, 52,  3,  0,  0, 59,  2,  0,  0, 50,  3,  0,  0, 81,  0,  0,  0,157,  0,  0,  0,240,  0,  0,  0,105,  6,  0,  0,
+240,  0,  0,  0,106,  6,  0,  0,  2,  1,  0,  0,107,  6,  0,  0, 59,  2,  0,  0,105,  6,  0,  0, 90,  0,  0,  0, 51,  3,  0,  0,
+ 59,  2,  0,  0,107,  6,  0,  0,  2,  1,  0,  0,193,  0,  0,  0,  2,  1,  0,  0,106,  6,  0,  0,240,  0,  0,  0,156,  0,  0,  0,
+  9,  0,  0,  0,192,  0,  0,  0,110,  1,  0,  0,153,  1,  0,  0,144,  0,  0,  0, 54,  3,  0,  0, 61,  2,  0,  0,108,  6,  0,  0,
+ 61,  2,  0,  0,109,  6,  0,  0,113,  1,  0,  0,110,  6,  0,  0,110,  1,  0,  0,108,  6,  0,  0, 31,  0,  0,  0,152,  1,  0,  0,
+110,  1,  0,  0,110,  6,  0,  0,113,  1,  0,  0,158,  1,  0,  0,113,  1,  0,  0,109,  6,  0,  0, 61,  2,  0,  0, 55,  3,  0,  0,
+145,  0,  0,  0,159,  1,  0,  0, 62,  2,  0,  0, 56,  3,  0,  0,145,  0,  0,  0, 55,  3,  0,  0, 61,  2,  0,  0,111,  6,  0,  0,
+ 61,  2,  0,  0,112,  6,  0,  0, 63,  2,  0,  0,113,  6,  0,  0, 62,  2,  0,  0,111,  6,  0,  0,146,  0,  0,  0, 57,  3,  0,  0,
+ 62,  2,  0,  0,113,  6,  0,  0, 63,  2,  0,  0, 59,  3,  0,  0, 63,  2,  0,  0,112,  6,  0,  0, 61,  2,  0,  0, 54,  3,  0,  0,
+144,  0,  0,  0, 58,  3,  0,  0,111,  1,  0,  0,154,  1,  0,  0, 36,  0,  0,  0,162,  1,  0,  0,115,  1,  0,  0,114,  6,  0,  0,
+115,  1,  0,  0,115,  6,  0,  0, 63,  2,  0,  0,116,  6,  0,  0,111,  1,  0,  0,114,  6,  0,  0,144,  0,  0,  0,155,  1,  0,  0,
+111,  1,  0,  0,116,  6,  0,  0, 63,  2,  0,  0, 58,  3,  0,  0, 63,  2,  0,  0,115,  6,  0,  0,115,  1,  0,  0,163,  1,  0,  0,
+146,  0,  0,  0, 59,  3,  0,  0, 62,  2,  0,  0, 57,  3,  0,  0,146,  0,  0,  0,161,  1,  0,  0,114,  1,  0,  0,117,  6,  0,  0,
+114,  1,  0,  0,118,  6,  0,  0,112,  1,  0,  0,119,  6,  0,  0, 62,  2,  0,  0,117,  6,  0,  0,145,  0,  0,  0, 56,  3,  0,  0,
+ 62,  2,  0,  0,119,  6,  0,  0,112,  1,  0,  0,157,  1,  0,  0,112,  1,  0,  0,118,  6,  0,  0,114,  1,  0,  0,160,  1,  0,  0,
+ 22,  0,  0,  0,156,  1,  0,  0,204,  0,  0,  0, 85,  0,  0,  0, 63,  0,  0,  0, 60,  3,  0,  0, 64,  2,  0,  0,120,  6,  0,  0,
+ 64,  2,  0,  0,121,  6,  0,  0,  4,  1,  0,  0,122,  6,  0,  0,204,  0,  0,  0,120,  6,  0,  0, 10,  0,  0,  0, 84,  0,  0,  0,
+204,  0,  0,  0,122,  6,  0,  0,  4,  1,  0,  0,196,  0,  0,  0,  4,  1,  0,  0,121,  6,  0,  0, 64,  2,  0,  0, 61,  3,  0,  0,
+ 91,  0,  0,  0,197,  0,  0,  0, 65,  2,  0,  0, 62,  3,  0,  0, 91,  0,  0,  0, 61,  3,  0,  0, 64,  2,  0,  0,123,  6,  0,  0,
+ 64,  2,  0,  0,124,  6,  0,  0, 66,  2,  0,  0,125,  6,  0,  0, 65,  2,  0,  0,123,  6,  0,  0,146,  0,  0,  0, 63,  3,  0,  0,
+ 65,  2,  0,  0,125,  6,  0,  0, 66,  2,  0,  0, 65,  3,  0,  0, 66,  2,  0,  0,124,  6,  0,  0, 64,  2,  0,  0, 60,  3,  0,  0,
+ 63,  0,  0,  0, 64,  3,  0,  0,205,  0,  0,  0, 86,  0,  0,  0, 22,  0,  0,  0,160,  1,  0,  0,114,  1,  0,  0,126,  6,  0,  0,
+114,  1,  0,  0,127,  6,  0,  0, 66,  2,  0,  0,128,  6,  0,  0,205,  0,  0,  0,126,  6,  0,  0, 63,  0,  0,  0, 87,  0,  0,  0,
+205,  0,  0,  0,128,  6,  0,  0, 66,  2,  0,  0, 64,  3,  0,  0, 66,  2,  0,  0,127,  6,  0,  0,114,  1,  0,  0,161,  1,  0,  0,
+146,  0,  0,  0, 65,  3,  0,  0, 65,  2,  0,  0, 63,  3,  0,  0,146,  0,  0,  0,163,  1,  0,  0,115,  1,  0,  0,129,  6,  0,  0,
+115,  1,  0,  0,130,  6,  0,  0,  5,  1,  0,  0,131,  6,  0,  0, 65,  2,  0,  0,129,  6,  0,  0, 91,  0,  0,  0, 62,  3,  0,  0,
+ 65,  2,  0,  0,131,  6,  0,  0,  5,  1,  0,  0,199,  0,  0,  0,  5,  1,  0,  0,130,  6,  0,  0,115,  1,  0,  0,162,  1,  0,  0,
+ 36,  0,  0,  0,198,  0,  0,  0,203,  0,  0,  0, 83,  0,  0,  0, 62,  0,  0,  0, 66,  3,  0,  0, 67,  2,  0,  0,132,  6,  0,  0,
+ 67,  2,  0,  0,133,  6,  0,  0,112,  1,  0,  0,134,  6,  0,  0,203,  0,  0,  0,132,  6,  0,  0, 22,  0,  0,  0, 82,  0,  0,  0,
+203,  0,  0,  0,134,  6,  0,  0,112,  1,  0,  0,156,  1,  0,  0,112,  1,  0,  0,133,  6,  0,  0, 67,  2,  0,  0, 67,  3,  0,  0,
+145,  0,  0,  0,157,  1,  0,  0, 68,  2,  0,  0, 69,  3,  0,  0,145,  0,  0,  0, 67,  3,  0,  0, 67,  2,  0,  0,135,  6,  0,  0,
+ 67,  2,  0,  0,136,  6,  0,  0, 69,  2,  0,  0,137,  6,  0,  0, 68,  2,  0,  0,135,  6,  0,  0, 80,  0,  0,  0, 68,  3,  0,  0,
+ 68,  2,  0,  0,137,  6,  0,  0, 69,  2,  0,  0, 71,  3,  0,  0, 69,  2,  0,  0,136,  6,  0,  0, 67,  2,  0,  0, 66,  3,  0,  0,
+ 62,  0,  0,  0, 70,  3,  0,  0,202,  0,  0,  0, 80,  0,  0,  0,  5,  0,  0,  0,152,  0,  0,  0,238,  0,  0,  0,138,  6,  0,  0,
+238,  0,  0,  0,139,  6,  0,  0, 69,  2,  0,  0,140,  6,  0,  0,202,  0,  0,  0,138,  6,  0,  0, 62,  0,  0,  0, 81,  0,  0,  0,
+202,  0,  0,  0,140,  6,  0,  0, 69,  2,  0,  0, 70,  3,  0,  0, 69,  2,  0,  0,139,  6,  0,  0,238,  0,  0,  0,153,  0,  0,  0,
+ 80,  0,  0,  0, 71,  3,  0,  0, 68,  2,  0,  0, 68,  3,  0,  0, 80,  0,  0,  0,155,  0,  0,  0,239,  0,  0,  0,141,  6,  0,  0,
+239,  0,  0,  0,142,  6,  0,  0,113,  1,  0,  0,143,  6,  0,  0, 68,  2,  0,  0,141,  6,  0,  0,145,  0,  0,  0, 69,  3,  0,  0,
+ 68,  2,  0,  0,143,  6,  0,  0,113,  1,  0,  0,159,  1,  0,  0,113,  1,  0,  0,142,  6,  0,  0,239,  0,  0,  0,154,  0,  0,  0,
+ 31,  0,  0,  0,158,  1,  0,  0, 70,  2,  0,  0, 73,  3,  0,  0,147,  0,  0,  0,167,  1,  0,  0,117,  1,  0,  0,144,  6,  0,  0,
+117,  1,  0,  0,145,  6,  0,  0, 11,  1,  0,  0,146,  6,  0,  0, 70,  2,  0,  0,144,  6,  0,  0, 94,  0,  0,  0, 72,  3,  0,  0,
+ 70,  2,  0,  0,146,  6,  0,  0, 11,  1,  0,  0,211,  0,  0,  0, 11,  1,  0,  0,145,  6,  0,  0,117,  1,  0,  0,166,  1,  0,  0,
+ 38,  0,  0,  0,210,  0,  0,  0, 70,  2,  0,  0, 72,  3,  0,  0, 94,  0,  0,  0, 75,  3,  0,  0, 71,  2,  0,  0,147,  6,  0,  0,
+ 71,  2,  0,  0,148,  6,  0,  0, 72,  2,  0,  0,149,  6,  0,  0, 70,  2,  0,  0,147,  6,  0,  0,147,  0,  0,  0, 73,  3,  0,  0,
+ 70,  2,  0,  0,149,  6,  0,  0, 72,  2,  0,  0, 77,  3,  0,  0, 72,  2,  0,  0,148,  6,  0,  0, 71,  2,  0,  0, 74,  3,  0,  0,
+ 82,  0,  0,  0, 76,  3,  0,  0,243,  0,  0,  0,162,  0,  0,  0, 32,  0,  0,  0,164,  1,  0,  0,116,  1,  0,  0,150,  6,  0,  0,
+116,  1,  0,  0,151,  6,  0,  0, 72,  2,  0,  0,152,  6,  0,  0,243,  0,  0,  0,150,  6,  0,  0, 82,  0,  0,  0,163,  0,  0,  0,
+243,  0,  0,  0,152,  6,  0,  0, 72,  2,  0,  0, 76,  3,  0,  0, 72,  2,  0,  0,151,  6,  0,  0,116,  1,  0,  0,165,  1,  0,  0,
+147,  0,  0,  0, 77,  3,  0,  0,242,  0,  0,  0,161,  0,  0,  0, 82,  0,  0,  0, 74,  3,  0,  0, 71,  2,  0,  0,153,  6,  0,  0,
+ 71,  2,  0,  0,154,  6,  0,  0, 10,  1,  0,  0,155,  6,  0,  0,242,  0,  0,  0,153,  6,  0,  0,  6,  0,  0,  0,160,  0,  0,  0,
+242,  0,  0,  0,155,  6,  0,  0, 10,  1,  0,  0,208,  0,  0,  0, 10,  1,  0,  0,154,  6,  0,  0, 71,  2,  0,  0, 75,  3,  0,  0,
+ 94,  0,  0,  0,209,  0,  0,  0, 73,  2,  0,  0, 78,  3,  0,  0,147,  0,  0,  0,165,  1,  0,  0,116,  1,  0,  0,156,  6,  0,  0,
+116,  1,  0,  0,157,  6,  0,  0,118,  1,  0,  0,158,  6,  0,  0, 73,  2,  0,  0,156,  6,  0,  0,148,  0,  0,  0, 79,  3,  0,  0,
+ 73,  2,  0,  0,158,  6,  0,  0,118,  1,  0,  0,169,  1,  0,  0,118,  1,  0,  0,157,  6,  0,  0,116,  1,  0,  0,164,  1,  0,  0,
+ 32,  0,  0,  0,168,  1,  0,  0, 73,  2,  0,  0, 79,  3,  0,  0,148,  0,  0,  0, 80,  3,  0,  0, 74,  2,  0,  0,159,  6,  0,  0,
+ 74,  2,  0,  0,160,  6,  0,  0, 75,  2,  0,  0,161,  6,  0,  0, 73,  2,  0,  0,159,  6,  0,  0,147,  0,  0,  0, 78,  3,  0,  0,
+ 73,  2,  0,  0,161,  6,  0,  0, 75,  2,  0,  0, 82,  3,  0,  0, 75,  2,  0,  0,160,  6,  0,  0, 74,  2,  0,  0, 81,  3,  0,  0,
+149,  0,  0,  0, 83,  3,  0,  0,121,  1,  0,  0,174,  1,  0,  0, 38,  0,  0,  0,166,  1,  0,  0,117,  1,  0,  0,162,  6,  0,  0,
+117,  1,  0,  0,163,  6,  0,  0, 75,  2,  0,  0,164,  6,  0,  0,121,  1,  0,  0,162,  6,  0,  0,149,  0,  0,  0,175,  1,  0,  0,
+121,  1,  0,  0,164,  6,  0,  0, 75,  2,  0,  0, 83,  3,  0,  0, 75,  2,  0,  0,163,  6,  0,  0,117,  1,  0,  0,167,  1,  0,  0,
+147,  0,  0,  0, 82,  3,  0,  0,120,  1,  0,  0,173,  1,  0,  0,149,  0,  0,  0, 81,  3,  0,  0, 74,  2,  0,  0,165,  6,  0,  0,
+ 74,  2,  0,  0,166,  6,  0,  0,119,  1,  0,  0,167,  6,  0,  0,120,  1,  0,  0,165,  6,  0,  0, 37,  0,  0,  0,172,  1,  0,  0,
+120,  1,  0,  0,167,  6,  0,  0,119,  1,  0,  0,170,  1,  0,  0,119,  1,  0,  0,166,  6,  0,  0, 74,  2,  0,  0, 80,  3,  0,  0,
+148,  0,  0,  0,171,  1,  0,  0, 76,  2,  0,  0, 84,  3,  0,  0, 93,  0,  0,  0,205,  0,  0,  0,  8,  1,  0,  0,168,  6,  0,  0,
+  8,  1,  0,  0,169,  6,  0,  0, 12,  1,  0,  0,170,  6,  0,  0, 76,  2,  0,  0,168,  6,  0,  0, 95,  0,  0,  0, 85,  3,  0,  0,
+ 76,  2,  0,  0,170,  6,  0,  0, 12,  1,  0,  0,213,  0,  0,  0, 12,  1,  0,  0,169,  6,  0,  0,  8,  1,  0,  0,204,  0,  0,  0,
+ 11,  0,  0,  0,212,  0,  0,  0, 76,  2,  0,  0, 85,  3,  0,  0, 95,  0,  0,  0, 86,  3,  0,  0, 77,  2,  0,  0,171,  6,  0,  0,
+ 77,  2,  0,  0,172,  6,  0,  0, 78,  2,  0,  0,173,  6,  0,  0, 76,  2,  0,  0,171,  6,  0,  0, 93,  0,  0,  0, 84,  3,  0,  0,
+ 76,  2,  0,  0,173,  6,  0,  0, 78,  2,  0,  0, 88,  3,  0,  0, 78,  2,  0,  0,172,  6,  0,  0, 77,  2,  0,  0, 87,  3,  0,  0,
+149,  0,  0,  0, 89,  3,  0,  0,120,  1,  0,  0,172,  1,  0,  0, 37,  0,  0,  0,206,  0,  0,  0,  9,  1,  0,  0,174,  6,  0,  0,
+  9,  1,  0,  0,175,  6,  0,  0, 78,  2,  0,  0,176,  6,  0,  0,120,  1,  0,  0,174,  6,  0,  0,149,  0,  0,  0,173,  1,  0,  0,
+120,  1,  0,  0,176,  6,  0,  0, 78,  2,  0,  0, 89,  3,  0,  0, 78,  2,  0,  0,175,  6,  0,  0,  9,  1,  0,  0,207,  0,  0,  0,
+ 93,  0,  0,  0, 88,  3,  0,  0,121,  1,  0,  0,175,  1,  0,  0,149,  0,  0,  0, 87,  3,  0,  0, 77,  2,  0,  0,177,  6,  0,  0,
+ 77,  2,  0,  0,178,  6,  0,  0, 13,  1,  0,  0,179,  6,  0,  0,121,  1,  0,  0,177,  6,  0,  0, 38,  0,  0,  0,174,  1,  0,  0,
+121,  1,  0,  0,179,  6,  0,  0, 13,  1,  0,  0,214,  0,  0,  0, 13,  1,  0,  0,178,  6,  0,  0, 77,  2,  0,  0, 86,  3,  0,  0,
+ 95,  0,  0,  0,215,  0,  0,  0, 79,  2,  0,  0, 90,  3,  0,  0, 92,  0,  0,  0,203,  0,  0,  0,  7,  1,  0,  0,180,  6,  0,  0,
+  7,  1,  0,  0,181,  6,  0,  0,119,  1,  0,  0,182,  6,  0,  0, 79,  2,  0,  0,180,  6,  0,  0,148,  0,  0,  0, 91,  3,  0,  0,
+ 79,  2,  0,  0,182,  6,  0,  0,119,  1,  0,  0,171,  1,  0,  0,119,  1,  0,  0,181,  6,  0,  0,  7,  1,  0,  0,202,  0,  0,  0,
+ 37,  0,  0,  0,170,  1,  0,  0, 79,  2,  0,  0, 91,  3,  0,  0,148,  0,  0,  0, 93,  3,  0,  0, 80,  2,  0,  0,183,  6,  0,  0,
+ 80,  2,  0,  0,184,  6,  0,  0, 81,  2,  0,  0,185,  6,  0,  0, 79,  2,  0,  0,183,  6,  0,  0, 92,  0,  0,  0, 90,  3,  0,  0,
+ 79,  2,  0,  0,185,  6,  0,  0, 81,  2,  0,  0, 95,  3,  0,  0, 81,  2,  0,  0,184,  6,  0,  0, 80,  2,  0,  0, 92,  3,  0,  0,
+ 83,  0,  0,  0, 94,  3,  0,  0,244,  0,  0,  0,164,  0,  0,  0, 10,  0,  0,  0,200,  0,  0,  0,  6,  1,  0,  0,186,  6,  0,  0,
+  6,  1,  0,  0,187,  6,  0,  0, 81,  2,  0,  0,188,  6,  0,  0,244,  0,  0,  0,186,  6,  0,  0, 83,  0,  0,  0,165,  0,  0,  0,
+244,  0,  0,  0,188,  6,  0,  0, 81,  2,  0,  0, 94,  3,  0,  0, 81,  2,  0,  0,187,  6,  0,  0,  6,  1,  0,  0,201,  0,  0,  0,
+ 92,  0,  0,  0, 95,  3,  0,  0,245,  0,  0,  0,167,  0,  0,  0, 83,  0,  0,  0, 92,  3,  0,  0, 80,  2,  0,  0,189,  6,  0,  0,
+ 80,  2,  0,  0,190,  6,  0,  0,118,  1,  0,  0,191,  6,  0,  0,245,  0,  0,  0,189,  6,  0,  0, 32,  0,  0,  0,166,  0,  0,  0,
+245,  0,  0,  0,191,  6,  0,  0,118,  1,  0,  0,168,  1,  0,  0,118,  1,  0,  0,190,  6,  0,  0, 80,  2,  0,  0, 93,  3,  0,  0,
+148,  0,  0,  0,169,  1,  0,  0, 82,  2,  0,  0, 97,  3,  0,  0,150,  0,  0,  0,179,  1,  0,  0,123,  1,  0,  0,192,  6,  0,  0,
+123,  1,  0,  0,193,  6,  0,  0, 15,  1,  0,  0,194,  6,  0,  0, 82,  2,  0,  0,192,  6,  0,  0, 96,  0,  0,  0, 96,  3,  0,  0,
+ 82,  2,  0,  0,194,  6,  0,  0, 15,  1,  0,  0,219,  0,  0,  0, 15,  1,  0,  0,193,  6,  0,  0,123,  1,  0,  0,178,  1,  0,  0,
+ 39,  0,  0,  0,218,  0,  0,  0, 82,  2,  0,  0, 96,  3,  0,  0, 96,  0,  0,  0, 99,  3,  0,  0, 83,  2,  0,  0,195,  6,  0,  0,
+ 83,  2,  0,  0,196,  6,  0,  0, 84,  2,  0,  0,197,  6,  0,  0, 82,  2,  0,  0,195,  6,  0,  0,150,  0,  0,  0, 97,  3,  0,  0,
+ 82,  2,  0,  0,197,  6,  0,  0, 84,  2,  0,  0,101,  3,  0,  0, 84,  2,  0,  0,196,  6,  0,  0, 83,  2,  0,  0, 98,  3,  0,  0,
+ 85,  0,  0,  0,100,  3,  0,  0,249,  0,  0,  0,174,  0,  0,  0, 33,  0,  0,  0,176,  1,  0,  0,122,  1,  0,  0,198,  6,  0,  0,
+122,  1,  0,  0,199,  6,  0,  0, 84,  2,  0,  0,200,  6,  0,  0,249,  0,  0,  0,198,  6,  0,  0, 85,  0,  0,  0,175,  0,  0,  0,
+249,  0,  0,  0,200,  6,  0,  0, 84,  2,  0,  0,100,  3,  0,  0, 84,  2,  0,  0,199,  6,  0,  0,122,  1,  0,  0,177,  1,  0,  0,
+150,  0,  0,  0,101,  3,  0,  0,248,  0,  0,  0,173,  0,  0,  0, 85,  0,  0,  0, 98,  3,  0,  0, 83,  2,  0,  0,201,  6,  0,  0,
+ 83,  2,  0,  0,202,  6,  0,  0, 14,  1,  0,  0,203,  6,  0,  0,248,  0,  0,  0,201,  6,  0,  0,  7,  0,  0,  0,172,  0,  0,  0,
+248,  0,  0,  0,203,  6,  0,  0, 14,  1,  0,  0,216,  0,  0,  0, 14,  1,  0,  0,202,  6,  0,  0, 83,  2,  0,  0, 99,  3,  0,  0,
+ 96,  0,  0,  0,217,  0,  0,  0, 85,  2,  0,  0,102,  3,  0,  0,150,  0,  0,  0,177,  1,  0,  0,122,  1,  0,  0,204,  6,  0,  0,
+122,  1,  0,  0,205,  6,  0,  0,124,  1,  0,  0,206,  6,  0,  0, 85,  2,  0,  0,204,  6,  0,  0,151,  0,  0,  0,103,  3,  0,  0,
+ 85,  2,  0,  0,206,  6,  0,  0,124,  1,  0,  0,181,  1,  0,  0,124,  1,  0,  0,205,  6,  0,  0,122,  1,  0,  0,176,  1,  0,  0,
+ 33,  0,  0,  0,180,  1,  0,  0, 85,  2,  0,  0,103,  3,  0,  0,151,  0,  0,  0,104,  3,  0,  0, 86,  2,  0,  0,207,  6,  0,  0,
+ 86,  2,  0,  0,208,  6,  0,  0, 87,  2,  0,  0,209,  6,  0,  0, 85,  2,  0,  0,207,  6,  0,  0,150,  0,  0,  0,102,  3,  0,  0,
+ 85,  2,  0,  0,209,  6,  0,  0, 87,  2,  0,  0,106,  3,  0,  0, 87,  2,  0,  0,208,  6,  0,  0, 86,  2,  0,  0,105,  3,  0,  0,
+152,  0,  0,  0,107,  3,  0,  0,127,  1,  0,  0,186,  1,  0,  0, 39,  0,  0,  0,178,  1,  0,  0,123,  1,  0,  0,210,  6,  0,  0,
+123,  1,  0,  0,211,  6,  0,  0, 87,  2,  0,  0,212,  6,  0,  0,127,  1,  0,  0,210,  6,  0,  0,152,  0,  0,  0,187,  1,  0,  0,
+127,  1,  0,  0,212,  6,  0,  0, 87,  2,  0,  0,107,  3,  0,  0, 87,  2,  0,  0,211,  6,  0,  0,123,  1,  0,  0,179,  1,  0,  0,
+150,  0,  0,  0,106,  3,  0,  0,126,  1,  0,  0,185,  1,  0,  0,152,  0,  0,  0,105,  3,  0,  0, 86,  2,  0,  0,213,  6,  0,  0,
+ 86,  2,  0,  0,214,  6,  0,  0,125,  1,  0,  0,215,  6,  0,  0,126,  1,  0,  0,213,  6,  0,  0, 38,  0,  0,  0,184,  1,  0,  0,
+126,  1,  0,  0,215,  6,  0,  0,125,  1,  0,  0,182,  1,  0,  0,125,  1,  0,  0,214,  6,  0,  0, 86,  2,  0,  0,104,  3,  0,  0,
+151,  0,  0,  0,183,  1,  0,  0, 88,  2,  0,  0,108,  3,  0,  0, 95,  0,  0,  0,213,  0,  0,  0, 12,  1,  0,  0,216,  6,  0,  0,
+ 12,  1,  0,  0,217,  6,  0,  0, 16,  1,  0,  0,218,  6,  0,  0, 88,  2,  0,  0,216,  6,  0,  0, 97,  0,  0,  0,109,  3,  0,  0,
+ 88,  2,  0,  0,218,  6,  0,  0, 16,  1,  0,  0,221,  0,  0,  0, 16,  1,  0,  0,217,  6,  0,  0, 12,  1,  0,  0,212,  0,  0,  0,
+ 11,  0,  0,  0,220,  0,  0,  0, 88,  2,  0,  0,109,  3,  0,  0, 97,  0,  0,  0,110,  3,  0,  0, 89,  2,  0,  0,219,  6,  0,  0,
+ 89,  2,  0,  0,220,  6,  0,  0, 90,  2,  0,  0,221,  6,  0,  0, 88,  2,  0,  0,219,  6,  0,  0, 95,  0,  0,  0,108,  3,  0,  0,
+ 88,  2,  0,  0,221,  6,  0,  0, 90,  2,  0,  0,112,  3,  0,  0, 90,  2,  0,  0,220,  6,  0,  0, 89,  2,  0,  0,111,  3,  0,  0,
+152,  0,  0,  0,113,  3,  0,  0,126,  1,  0,  0,184,  1,  0,  0, 38,  0,  0,  0,214,  0,  0,  0, 13,  1,  0,  0,222,  6,  0,  0,
+ 13,  1,  0,  0,223,  6,  0,  0, 90,  2,  0,  0,224,  6,  0,  0,126,  1,  0,  0,222,  6,  0,  0,152,  0,  0,  0,185,  1,  0,  0,
+126,  1,  0,  0,224,  6,  0,  0, 90,  2,  0,  0,113,  3,  0,  0, 90,  2,  0,  0,223,  6,  0,  0, 13,  1,  0,  0,215,  0,  0,  0,
+ 95,  0,  0,  0,112,  3,  0,  0,127,  1,  0,  0,187,  1,  0,  0,152,  0,  0,  0,111,  3,  0,  0, 89,  2,  0,  0,225,  6,  0,  0,
+ 89,  2,  0,  0,226,  6,  0,  0, 17,  1,  0,  0,227,  6,  0,  0,127,  1,  0,  0,225,  6,  0,  0, 39,  0,  0,  0,186,  1,  0,  0,
+127,  1,  0,  0,227,  6,  0,  0, 17,  1,  0,  0,222,  0,  0,  0, 17,  1,  0,  0,226,  6,  0,  0, 89,  2,  0,  0,110,  3,  0,  0,
+ 97,  0,  0,  0,223,  0,  0,  0, 91,  2,  0,  0,114,  3,  0,  0, 94,  0,  0,  0,211,  0,  0,  0, 11,  1,  0,  0,228,  6,  0,  0,
+ 11,  1,  0,  0,229,  6,  0,  0,125,  1,  0,  0,230,  6,  0,  0, 91,  2,  0,  0,228,  6,  0,  0,151,  0,  0,  0,115,  3,  0,  0,
+ 91,  2,  0,  0,230,  6,  0,  0,125,  1,  0,  0,183,  1,  0,  0,125,  1,  0,  0,229,  6,  0,  0, 11,  1,  0,  0,210,  0,  0,  0,
+ 38,  0,  0,  0,182,  1,  0,  0, 91,  2,  0,  0,115,  3,  0,  0,151,  0,  0,  0,117,  3,  0,  0, 92,  2,  0,  0,231,  6,  0,  0,
+ 92,  2,  0,  0,232,  6,  0,  0, 93,  2,  0,  0,233,  6,  0,  0, 91,  2,  0,  0,231,  6,  0,  0, 94,  0,  0,  0,114,  3,  0,  0,
+ 91,  2,  0,  0,233,  6,  0,  0, 93,  2,  0,  0,119,  3,  0,  0, 93,  2,  0,  0,232,  6,  0,  0, 92,  2,  0,  0,116,  3,  0,  0,
+ 84,  0,  0,  0,118,  3,  0,  0,246,  0,  0,  0,168,  0,  0,  0,  6,  0,  0,  0,208,  0,  0,  0, 10,  1,  0,  0,234,  6,  0,  0,
+ 10,  1,  0,  0,235,  6,  0,  0, 93,  2,  0,  0,236,  6,  0,  0,246,  0,  0,  0,234,  6,  0,  0, 84,  0,  0,  0,169,  0,  0,  0,
+246,  0,  0,  0,236,  6,  0,  0, 93,  2,  0,  0,118,  3,  0,  0, 93,  2,  0,  0,235,  6,  0,  0, 10,  1,  0,  0,209,  0,  0,  0,
+ 94,  0,  0,  0,119,  3,  0,  0,247,  0,  0,  0,171,  0,  0,  0, 84,  0,  0,  0,116,  3,  0,  0, 92,  2,  0,  0,237,  6,  0,  0,
+ 92,  2,  0,  0,238,  6,  0,  0,124,  1,  0,  0,239,  6,  0,  0,247,  0,  0,  0,237,  6,  0,  0, 33,  0,  0,  0,170,  0,  0,  0,
+247,  0,  0,  0,239,  6,  0,  0,124,  1,  0,  0,180,  1,  0,  0,124,  1,  0,  0,238,  6,  0,  0, 92,  2,  0,  0,117,  3,  0,  0,
+151,  0,  0,  0,181,  1,  0,  0, 94,  2,  0,  0,121,  3,  0,  0,153,  0,  0,  0,191,  1,  0,  0,129,  1,  0,  0,240,  6,  0,  0,
+129,  1,  0,  0,241,  6,  0,  0, 19,  1,  0,  0,242,  6,  0,  0, 94,  2,  0,  0,240,  6,  0,  0, 98,  0,  0,  0,120,  3,  0,  0,
+ 94,  2,  0,  0,242,  6,  0,  0, 19,  1,  0,  0,227,  0,  0,  0, 19,  1,  0,  0,241,  6,  0,  0,129,  1,  0,  0,190,  1,  0,  0,
+ 40,  0,  0,  0,226,  0,  0,  0, 94,  2,  0,  0,120,  3,  0,  0, 98,  0,  0,  0,123,  3,  0,  0, 95,  2,  0,  0,243,  6,  0,  0,
+ 95,  2,  0,  0,244,  6,  0,  0, 96,  2,  0,  0,245,  6,  0,  0, 94,  2,  0,  0,243,  6,  0,  0,153,  0,  0,  0,121,  3,  0,  0,
+ 94,  2,  0,  0,245,  6,  0,  0, 96,  2,  0,  0,125,  3,  0,  0, 96,  2,  0,  0,244,  6,  0,  0, 95,  2,  0,  0,122,  3,  0,  0,
+ 87,  0,  0,  0,124,  3,  0,  0,253,  0,  0,  0,182,  0,  0,  0, 34,  0,  0,  0,188,  1,  0,  0,128,  1,  0,  0,246,  6,  0,  0,
+128,  1,  0,  0,247,  6,  0,  0, 96,  2,  0,  0,248,  6,  0,  0,253,  0,  0,  0,246,  6,  0,  0, 87,  0,  0,  0,183,  0,  0,  0,
+253,  0,  0,  0,248,  6,  0,  0, 96,  2,  0,  0,124,  3,  0,  0, 96,  2,  0,  0,247,  6,  0,  0,128,  1,  0,  0,189,  1,  0,  0,
+153,  0,  0,  0,125,  3,  0,  0,252,  0,  0,  0,181,  0,  0,  0, 87,  0,  0,  0,122,  3,  0,  0, 95,  2,  0,  0,249,  6,  0,  0,
+ 95,  2,  0,  0,250,  6,  0,  0, 18,  1,  0,  0,251,  6,  0,  0,252,  0,  0,  0,249,  6,  0,  0,  8,  0,  0,  0,180,  0,  0,  0,
+252,  0,  0,  0,251,  6,  0,  0, 18,  1,  0,  0,224,  0,  0,  0, 18,  1,  0,  0,250,  6,  0,  0, 95,  2,  0,  0,123,  3,  0,  0,
+ 98,  0,  0,  0,225,  0,  0,  0, 97,  2,  0,  0,126,  3,  0,  0,153,  0,  0,  0,189,  1,  0,  0,128,  1,  0,  0,252,  6,  0,  0,
+128,  1,  0,  0,253,  6,  0,  0,130,  1,  0,  0,254,  6,  0,  0, 97,  2,  0,  0,252,  6,  0,  0,154,  0,  0,  0,127,  3,  0,  0,
+ 97,  2,  0,  0,254,  6,  0,  0,130,  1,  0,  0,193,  1,  0,  0,130,  1,  0,  0,253,  6,  0,  0,128,  1,  0,  0,188,  1,  0,  0,
+ 34,  0,  0,  0,192,  1,  0,  0, 97,  2,  0,  0,127,  3,  0,  0,154,  0,  0,  0,128,  3,  0,  0, 98,  2,  0,  0,255,  6,  0,  0,
+ 98,  2,  0,  0,  0,  7,  0,  0, 99,  2,  0,  0,  1,  7,  0,  0, 97,  2,  0,  0,255,  6,  0,  0,153,  0,  0,  0,126,  3,  0,  0,
+ 97,  2,  0,  0,  1,  7,  0,  0, 99,  2,  0,  0,130,  3,  0,  0, 99,  2,  0,  0,  0,  7,  0,  0, 98,  2,  0,  0,129,  3,  0,  0,
+155,  0,  0,  0,131,  3,  0,  0,133,  1,  0,  0,198,  1,  0,  0, 40,  0,  0,  0,190,  1,  0,  0,129,  1,  0,  0,  2,  7,  0,  0,
+129,  1,  0,  0,  3,  7,  0,  0, 99,  2,  0,  0,  4,  7,  0,  0,133,  1,  0,  0,  2,  7,  0,  0,155,  0,  0,  0,199,  1,  0,  0,
+133,  1,  0,  0,  4,  7,  0,  0, 99,  2,  0,  0,131,  3,  0,  0, 99,  2,  0,  0,  3,  7,  0,  0,129,  1,  0,  0,191,  1,  0,  0,
+153,  0,  0,  0,130,  3,  0,  0,132,  1,  0,  0,197,  1,  0,  0,155,  0,  0,  0,129,  3,  0,  0, 98,  2,  0,  0,  5,  7,  0,  0,
+ 98,  2,  0,  0,  6,  7,  0,  0,131,  1,  0,  0,  7,  7,  0,  0,132,  1,  0,  0,  5,  7,  0,  0, 39,  0,  0,  0,196,  1,  0,  0,
+132,  1,  0,  0,  7,  7,  0,  0,131,  1,  0,  0,194,  1,  0,  0,131,  1,  0,  0,  6,  7,  0,  0, 98,  2,  0,  0,128,  3,  0,  0,
+154,  0,  0,  0,195,  1,  0,  0,100,  2,  0,  0,132,  3,  0,  0, 97,  0,  0,  0,221,  0,  0,  0, 16,  1,  0,  0,  8,  7,  0,  0,
+ 16,  1,  0,  0,  9,  7,  0,  0, 20,  1,  0,  0, 10,  7,  0,  0,100,  2,  0,  0,  8,  7,  0,  0, 99,  0,  0,  0,133,  3,  0,  0,
+100,  2,  0,  0, 10,  7,  0,  0, 20,  1,  0,  0,229,  0,  0,  0, 20,  1,  0,  0,  9,  7,  0,  0, 16,  1,  0,  0,220,  0,  0,  0,
+ 11,  0,  0,  0,228,  0,  0,  0,100,  2,  0,  0,133,  3,  0,  0, 99,  0,  0,  0,134,  3,  0,  0,101,  2,  0,  0, 11,  7,  0,  0,
+101,  2,  0,  0, 12,  7,  0,  0,102,  2,  0,  0, 13,  7,  0,  0,100,  2,  0,  0, 11,  7,  0,  0, 97,  0,  0,  0,132,  3,  0,  0,
+100,  2,  0,  0, 13,  7,  0,  0,102,  2,  0,  0,136,  3,  0,  0,102,  2,  0,  0, 12,  7,  0,  0,101,  2,  0,  0,135,  3,  0,  0,
+155,  0,  0,  0,137,  3,  0,  0,132,  1,  0,  0,196,  1,  0,  0, 39,  0,  0,  0,222,  0,  0,  0, 17,  1,  0,  0, 14,  7,  0,  0,
+ 17,  1,  0,  0, 15,  7,  0,  0,102,  2,  0,  0, 16,  7,  0,  0,132,  1,  0,  0, 14,  7,  0,  0,155,  0,  0,  0,197,  1,  0,  0,
+132,  1,  0,  0, 16,  7,  0,  0,102,  2,  0,  0,137,  3,  0,  0,102,  2,  0,  0, 15,  7,  0,  0, 17,  1,  0,  0,223,  0,  0,  0,
+ 97,  0,  0,  0,136,  3,  0,  0,133,  1,  0,  0,199,  1,  0,  0,155,  0,  0,  0,135,  3,  0,  0,101,  2,  0,  0, 17,  7,  0,  0,
+101,  2,  0,  0, 18,  7,  0,  0, 21,  1,  0,  0, 19,  7,  0,  0,133,  1,  0,  0, 17,  7,  0,  0, 40,  0,  0,  0,198,  1,  0,  0,
+133,  1,  0,  0, 19,  7,  0,  0, 21,  1,  0,  0,230,  0,  0,  0, 21,  1,  0,  0, 18,  7,  0,  0,101,  2,  0,  0,134,  3,  0,  0,
+ 99,  0,  0,  0,231,  0,  0,  0,103,  2,  0,  0,138,  3,  0,  0, 96,  0,  0,  0,219,  0,  0,  0, 15,  1,  0,  0, 20,  7,  0,  0,
+ 15,  1,  0,  0, 21,  7,  0,  0,131,  1,  0,  0, 22,  7,  0,  0,103,  2,  0,  0, 20,  7,  0,  0,154,  0,  0,  0,139,  3,  0,  0,
+103,  2,  0,  0, 22,  7,  0,  0,131,  1,  0,  0,195,  1,  0,  0,131,  1,  0,  0, 21,  7,  0,  0, 15,  1,  0,  0,218,  0,  0,  0,
+ 39,  0,  0,  0,194,  1,  0,  0,103,  2,  0,  0,139,  3,  0,  0,154,  0,  0,  0,141,  3,  0,  0,104,  2,  0,  0, 23,  7,  0,  0,
+104,  2,  0,  0, 24,  7,  0,  0,105,  2,  0,  0, 25,  7,  0,  0,103,  2,  0,  0, 23,  7,  0,  0, 96,  0,  0,  0,138,  3,  0,  0,
+103,  2,  0,  0, 25,  7,  0,  0,105,  2,  0,  0,143,  3,  0,  0,105,  2,  0,  0, 24,  7,  0,  0,104,  2,  0,  0,140,  3,  0,  0,
+ 86,  0,  0,  0,142,  3,  0,  0,250,  0,  0,  0,176,  0,  0,  0,  7,  0,  0,  0,216,  0,  0,  0, 14,  1,  0,  0, 26,  7,  0,  0,
+ 14,  1,  0,  0, 27,  7,  0,  0,105,  2,  0,  0, 28,  7,  0,  0,250,  0,  0,  0, 26,  7,  0,  0, 86,  0,  0,  0,177,  0,  0,  0,
+250,  0,  0,  0, 28,  7,  0,  0,105,  2,  0,  0,142,  3,  0,  0,105,  2,  0,  0, 27,  7,  0,  0, 14,  1,  0,  0,217,  0,  0,  0,
+ 96,  0,  0,  0,143,  3,  0,  0,251,  0,  0,  0,179,  0,  0,  0, 86,  0,  0,  0,140,  3,  0,  0,104,  2,  0,  0, 29,  7,  0,  0,
+104,  2,  0,  0, 30,  7,  0,  0,130,  1,  0,  0, 31,  7,  0,  0,251,  0,  0,  0, 29,  7,  0,  0, 34,  0,  0,  0,178,  0,  0,  0,
+251,  0,  0,  0, 31,  7,  0,  0,130,  1,  0,  0,192,  1,  0,  0,130,  1,  0,  0, 30,  7,  0,  0,104,  2,  0,  0,141,  3,  0,  0,
+154,  0,  0,  0,193,  1,  0,  0,106,  2,  0,  0,145,  3,  0,  0,156,  0,  0,  0,203,  1,  0,  0,135,  1,  0,  0, 32,  7,  0,  0,
+135,  1,  0,  0, 33,  7,  0,  0, 23,  1,  0,  0, 34,  7,  0,  0,106,  2,  0,  0, 32,  7,  0,  0,100,  0,  0,  0,144,  3,  0,  0,
+106,  2,  0,  0, 34,  7,  0,  0, 23,  1,  0,  0,235,  0,  0,  0, 23,  1,  0,  0, 33,  7,  0,  0,135,  1,  0,  0,202,  1,  0,  0,
+ 41,  0,  0,  0,234,  0,  0,  0,106,  2,  0,  0,144,  3,  0,  0,100,  0,  0,  0,147,  3,  0,  0,107,  2,  0,  0, 35,  7,  0,  0,
+107,  2,  0,  0, 36,  7,  0,  0,108,  2,  0,  0, 37,  7,  0,  0,106,  2,  0,  0, 35,  7,  0,  0,156,  0,  0,  0,145,  3,  0,  0,
+106,  2,  0,  0, 37,  7,  0,  0,108,  2,  0,  0,149,  3,  0,  0,108,  2,  0,  0, 36,  7,  0,  0,107,  2,  0,  0,146,  3,  0,  0,
+ 89,  0,  0,  0,148,  3,  0,  0,  1,  1,  0,  0,190,  0,  0,  0, 35,  0,  0,  0,200,  1,  0,  0,134,  1,  0,  0, 38,  7,  0,  0,
+134,  1,  0,  0, 39,  7,  0,  0,108,  2,  0,  0, 40,  7,  0,  0,  1,  1,  0,  0, 38,  7,  0,  0, 89,  0,  0,  0,191,  0,  0,  0,
+  1,  1,  0,  0, 40,  7,  0,  0,108,  2,  0,  0,148,  3,  0,  0,108,  2,  0,  0, 39,  7,  0,  0,134,  1,  0,  0,201,  1,  0,  0,
+156,  0,  0,  0,149,  3,  0,  0,  0,  1,  0,  0,189,  0,  0,  0, 89,  0,  0,  0,146,  3,  0,  0,107,  2,  0,  0, 41,  7,  0,  0,
+107,  2,  0,  0, 42,  7,  0,  0, 22,  1,  0,  0, 43,  7,  0,  0,  0,  1,  0,  0, 41,  7,  0,  0,  9,  0,  0,  0,188,  0,  0,  0,
+  0,  1,  0,  0, 43,  7,  0,  0, 22,  1,  0,  0,232,  0,  0,  0, 22,  1,  0,  0, 42,  7,  0,  0,107,  2,  0,  0,147,  3,  0,  0,
+100,  0,  0,  0,233,  0,  0,  0,109,  2,  0,  0,150,  3,  0,  0,156,  0,  0,  0,201,  1,  0,  0,134,  1,  0,  0, 44,  7,  0,  0,
+134,  1,  0,  0, 45,  7,  0,  0,136,  1,  0,  0, 46,  7,  0,  0,109,  2,  0,  0, 44,  7,  0,  0,157,  0,  0,  0,151,  3,  0,  0,
+109,  2,  0,  0, 46,  7,  0,  0,136,  1,  0,  0,205,  1,  0,  0,136,  1,  0,  0, 45,  7,  0,  0,134,  1,  0,  0,200,  1,  0,  0,
+ 35,  0,  0,  0,204,  1,  0,  0,109,  2,  0,  0,151,  3,  0,  0,157,  0,  0,  0,152,  3,  0,  0,110,  2,  0,  0, 47,  7,  0,  0,
+110,  2,  0,  0, 48,  7,  0,  0,111,  2,  0,  0, 49,  7,  0,  0,109,  2,  0,  0, 47,  7,  0,  0,156,  0,  0,  0,150,  3,  0,  0,
+109,  2,  0,  0, 49,  7,  0,  0,111,  2,  0,  0,154,  3,  0,  0,111,  2,  0,  0, 48,  7,  0,  0,110,  2,  0,  0,153,  3,  0,  0,
+158,  0,  0,  0,155,  3,  0,  0,139,  1,  0,  0,210,  1,  0,  0, 41,  0,  0,  0,202,  1,  0,  0,135,  1,  0,  0, 50,  7,  0,  0,
+135,  1,  0,  0, 51,  7,  0,  0,111,  2,  0,  0, 52,  7,  0,  0,139,  1,  0,  0, 50,  7,  0,  0,158,  0,  0,  0,211,  1,  0,  0,
+139,  1,  0,  0, 52,  7,  0,  0,111,  2,  0,  0,155,  3,  0,  0,111,  2,  0,  0, 51,  7,  0,  0,135,  1,  0,  0,203,  1,  0,  0,
+156,  0,  0,  0,154,  3,  0,  0,138,  1,  0,  0,209,  1,  0,  0,158,  0,  0,  0,153,  3,  0,  0,110,  2,  0,  0, 53,  7,  0,  0,
+110,  2,  0,  0, 54,  7,  0,  0,137,  1,  0,  0, 55,  7,  0,  0,138,  1,  0,  0, 53,  7,  0,  0, 40,  0,  0,  0,208,  1,  0,  0,
+138,  1,  0,  0, 55,  7,  0,  0,137,  1,  0,  0,206,  1,  0,  0,137,  1,  0,  0, 54,  7,  0,  0,110,  2,  0,  0,152,  3,  0,  0,
+157,  0,  0,  0,207,  1,  0,  0,112,  2,  0,  0,156,  3,  0,  0, 99,  0,  0,  0,229,  0,  0,  0, 20,  1,  0,  0, 56,  7,  0,  0,
+ 20,  1,  0,  0, 57,  7,  0,  0, 24,  1,  0,  0, 58,  7,  0,  0,112,  2,  0,  0, 56,  7,  0,  0,101,  0,  0,  0,157,  3,  0,  0,
+112,  2,  0,  0, 58,  7,  0,  0, 24,  1,  0,  0,237,  0,  0,  0, 24,  1,  0,  0, 57,  7,  0,  0, 20,  1,  0,  0,228,  0,  0,  0,
+ 11,  0,  0,  0,236,  0,  0,  0,112,  2,  0,  0,157,  3,  0,  0,101,  0,  0,  0,158,  3,  0,  0,113,  2,  0,  0, 59,  7,  0,  0,
+113,  2,  0,  0, 60,  7,  0,  0,114,  2,  0,  0, 61,  7,  0,  0,112,  2,  0,  0, 59,  7,  0,  0, 99,  0,  0,  0,156,  3,  0,  0,
+112,  2,  0,  0, 61,  7,  0,  0,114,  2,  0,  0,160,  3,  0,  0,114,  2,  0,  0, 60,  7,  0,  0,113,  2,  0,  0,159,  3,  0,  0,
+158,  0,  0,  0,161,  3,  0,  0,138,  1,  0,  0,208,  1,  0,  0, 40,  0,  0,  0,230,  0,  0,  0, 21,  1,  0,  0, 62,  7,  0,  0,
+ 21,  1,  0,  0, 63,  7,  0,  0,114,  2,  0,  0, 64,  7,  0,  0,138,  1,  0,  0, 62,  7,  0,  0,158,  0,  0,  0,209,  1,  0,  0,
+138,  1,  0,  0, 64,  7,  0,  0,114,  2,  0,  0,161,  3,  0,  0,114,  2,  0,  0, 63,  7,  0,  0, 21,  1,  0,  0,231,  0,  0,  0,
+ 99,  0,  0,  0,160,  3,  0,  0,139,  1,  0,  0,211,  1,  0,  0,158,  0,  0,  0,159,  3,  0,  0,113,  2,  0,  0, 65,  7,  0,  0,
+113,  2,  0,  0, 66,  7,  0,  0, 25,  1,  0,  0, 67,  7,  0,  0,139,  1,  0,  0, 65,  7,  0,  0, 41,  0,  0,  0,210,  1,  0,  0,
+139,  1,  0,  0, 67,  7,  0,  0, 25,  1,  0,  0,238,  0,  0,  0, 25,  1,  0,  0, 66,  7,  0,  0,113,  2,  0,  0,158,  3,  0,  0,
+101,  0,  0,  0,239,  0,  0,  0,115,  2,  0,  0,162,  3,  0,  0, 98,  0,  0,  0,227,  0,  0,  0, 19,  1,  0,  0, 68,  7,  0,  0,
+ 19,  1,  0,  0, 69,  7,  0,  0,137,  1,  0,  0, 70,  7,  0,  0,115,  2,  0,  0, 68,  7,  0,  0,157,  0,  0,  0,163,  3,  0,  0,
+115,  2,  0,  0, 70,  7,  0,  0,137,  1,  0,  0,207,  1,  0,  0,137,  1,  0,  0, 69,  7,  0,  0, 19,  1,  0,  0,226,  0,  0,  0,
+ 40,  0,  0,  0,206,  1,  0,  0,115,  2,  0,  0,163,  3,  0,  0,157,  0,  0,  0,165,  3,  0,  0,116,  2,  0,  0, 71,  7,  0,  0,
+116,  2,  0,  0, 72,  7,  0,  0,117,  2,  0,  0, 73,  7,  0,  0,115,  2,  0,  0, 71,  7,  0,  0, 98,  0,  0,  0,162,  3,  0,  0,
+115,  2,  0,  0, 73,  7,  0,  0,117,  2,  0,  0,167,  3,  0,  0,117,  2,  0,  0, 72,  7,  0,  0,116,  2,  0,  0,164,  3,  0,  0,
+ 88,  0,  0,  0,166,  3,  0,  0,254,  0,  0,  0,184,  0,  0,  0,  8,  0,  0,  0,224,  0,  0,  0, 18,  1,  0,  0, 74,  7,  0,  0,
+ 18,  1,  0,  0, 75,  7,  0,  0,117,  2,  0,  0, 76,  7,  0,  0,254,  0,  0,  0, 74,  7,  0,  0, 88,  0,  0,  0,185,  0,  0,  0,
+254,  0,  0,  0, 76,  7,  0,  0,117,  2,  0,  0,166,  3,  0,  0,117,  2,  0,  0, 75,  7,  0,  0, 18,  1,  0,  0,225,  0,  0,  0,
+ 98,  0,  0,  0,167,  3,  0,  0,255,  0,  0,  0,187,  0,  0,  0, 88,  0,  0,  0,164,  3,  0,  0,116,  2,  0,  0, 77,  7,  0,  0,
+116,  2,  0,  0, 78,  7,  0,  0,136,  1,  0,  0, 79,  7,  0,  0,255,  0,  0,  0, 77,  7,  0,  0, 35,  0,  0,  0,186,  0,  0,  0,
+255,  0,  0,  0, 79,  7,  0,  0,136,  1,  0,  0,204,  1,  0,  0,136,  1,  0,  0, 78,  7,  0,  0,116,  2,  0,  0,165,  3,  0,  0,
+157,  0,  0,  0,205,  1,  0,  0,118,  2,  0,  0,169,  3,  0,  0,159,  0,  0,  0,215,  1,  0,  0,141,  1,  0,  0, 80,  7,  0,  0,
+141,  1,  0,  0, 81,  7,  0,  0,  7,  1,  0,  0, 82,  7,  0,  0,118,  2,  0,  0, 80,  7,  0,  0, 92,  0,  0,  0,168,  3,  0,  0,
+118,  2,  0,  0, 82,  7,  0,  0,  7,  1,  0,  0,203,  0,  0,  0,  7,  1,  0,  0, 81,  7,  0,  0,141,  1,  0,  0,214,  1,  0,  0,
+ 37,  0,  0,  0,202,  0,  0,  0,118,  2,  0,  0,168,  3,  0,  0, 92,  0,  0,  0,171,  3,  0,  0,119,  2,  0,  0, 83,  7,  0,  0,
+119,  2,  0,  0, 84,  7,  0,  0,120,  2,  0,  0, 85,  7,  0,  0,118,  2,  0,  0, 83,  7,  0,  0,159,  0,  0,  0,169,  3,  0,  0,
+118,  2,  0,  0, 85,  7,  0,  0,120,  2,  0,  0,173,  3,  0,  0,120,  2,  0,  0, 84,  7,  0,  0,119,  2,  0,  0,170,  3,  0,  0,
+ 91,  0,  0,  0,172,  3,  0,  0,  5,  1,  0,  0,198,  0,  0,  0, 36,  0,  0,  0,212,  1,  0,  0,140,  1,  0,  0, 86,  7,  0,  0,
+140,  1,  0,  0, 87,  7,  0,  0,120,  2,  0,  0, 88,  7,  0,  0,  5,  1,  0,  0, 86,  7,  0,  0, 91,  0,  0,  0,199,  0,  0,  0,
+  5,  1,  0,  0, 88,  7,  0,  0,120,  2,  0,  0,172,  3,  0,  0,120,  2,  0,  0, 87,  7,  0,  0,140,  1,  0,  0,213,  1,  0,  0,
+159,  0,  0,  0,173,  3,  0,  0,  4,  1,  0,  0,197,  0,  0,  0, 91,  0,  0,  0,170,  3,  0,  0,119,  2,  0,  0, 89,  7,  0,  0,
+119,  2,  0,  0, 90,  7,  0,  0,  6,  1,  0,  0, 91,  7,  0,  0,  4,  1,  0,  0, 89,  7,  0,  0, 10,  0,  0,  0,196,  0,  0,  0,
+  4,  1,  0,  0, 91,  7,  0,  0,  6,  1,  0,  0,200,  0,  0,  0,  6,  1,  0,  0, 90,  7,  0,  0,119,  2,  0,  0,171,  3,  0,  0,
+ 92,  0,  0,  0,201,  0,  0,  0,121,  2,  0,  0,174,  3,  0,  0,159,  0,  0,  0,213,  1,  0,  0,140,  1,  0,  0, 92,  7,  0,  0,
+140,  1,  0,  0, 93,  7,  0,  0,142,  1,  0,  0, 94,  7,  0,  0,121,  2,  0,  0, 92,  7,  0,  0,160,  0,  0,  0,175,  3,  0,  0,
+121,  2,  0,  0, 94,  7,  0,  0,142,  1,  0,  0,217,  1,  0,  0,142,  1,  0,  0, 93,  7,  0,  0,140,  1,  0,  0,212,  1,  0,  0,
+ 36,  0,  0,  0,216,  1,  0,  0,121,  2,  0,  0,175,  3,  0,  0,160,  0,  0,  0,176,  3,  0,  0,122,  2,  0,  0, 95,  7,  0,  0,
+122,  2,  0,  0, 96,  7,  0,  0,123,  2,  0,  0, 97,  7,  0,  0,121,  2,  0,  0, 95,  7,  0,  0,159,  0,  0,  0,174,  3,  0,  0,
+121,  2,  0,  0, 97,  7,  0,  0,123,  2,  0,  0,178,  3,  0,  0,123,  2,  0,  0, 96,  7,  0,  0,122,  2,  0,  0,177,  3,  0,  0,
+161,  0,  0,  0,179,  3,  0,  0,144,  1,  0,  0,220,  1,  0,  0, 37,  0,  0,  0,214,  1,  0,  0,141,  1,  0,  0, 98,  7,  0,  0,
+141,  1,  0,  0, 99,  7,  0,  0,123,  2,  0,  0,100,  7,  0,  0,144,  1,  0,  0, 98,  7,  0,  0,161,  0,  0,  0,221,  1,  0,  0,
+144,  1,  0,  0,100,  7,  0,  0,123,  2,  0,  0,179,  3,  0,  0,123,  2,  0,  0, 99,  7,  0,  0,141,  1,  0,  0,215,  1,  0,  0,
+159,  0,  0,  0,178,  3,  0,  0,145,  1,  0,  0,223,  1,  0,  0,161,  0,  0,  0,177,  3,  0,  0,122,  2,  0,  0,101,  7,  0,  0,
+122,  2,  0,  0,102,  7,  0,  0,143,  1,  0,  0,103,  7,  0,  0,145,  1,  0,  0,101,  7,  0,  0, 41,  0,  0,  0,222,  1,  0,  0,
+145,  1,  0,  0,103,  7,  0,  0,143,  1,  0,  0,218,  1,  0,  0,143,  1,  0,  0,102,  7,  0,  0,122,  2,  0,  0,176,  3,  0,  0,
+160,  0,  0,  0,219,  1,  0,  0,124,  2,  0,  0,181,  3,  0,  0,101,  0,  0,  0,237,  0,  0,  0, 24,  1,  0,  0,104,  7,  0,  0,
+ 24,  1,  0,  0,105,  7,  0,  0,  8,  1,  0,  0,106,  7,  0,  0,124,  2,  0,  0,104,  7,  0,  0, 93,  0,  0,  0,180,  3,  0,  0,
+124,  2,  0,  0,106,  7,  0,  0,  8,  1,  0,  0,205,  0,  0,  0,  8,  1,  0,  0,105,  7,  0,  0, 24,  1,  0,  0,236,  0,  0,  0,
+ 11,  0,  0,  0,204,  0,  0,  0,124,  2,  0,  0,180,  3,  0,  0, 93,  0,  0,  0,182,  3,  0,  0,125,  2,  0,  0,107,  7,  0,  0,
+125,  2,  0,  0,108,  7,  0,  0,126,  2,  0,  0,109,  7,  0,  0,124,  2,  0,  0,107,  7,  0,  0,101,  0,  0,  0,181,  3,  0,  0,
+124,  2,  0,  0,109,  7,  0,  0,126,  2,  0,  0,184,  3,  0,  0,126,  2,  0,  0,108,  7,  0,  0,125,  2,  0,  0,183,  3,  0,  0,
+161,  0,  0,  0,185,  3,  0,  0,145,  1,  0,  0,222,  1,  0,  0, 41,  0,  0,  0,238,  0,  0,  0, 25,  1,  0,  0,110,  7,  0,  0,
+ 25,  1,  0,  0,111,  7,  0,  0,126,  2,  0,  0,112,  7,  0,  0,145,  1,  0,  0,110,  7,  0,  0,161,  0,  0,  0,223,  1,  0,  0,
+145,  1,  0,  0,112,  7,  0,  0,126,  2,  0,  0,185,  3,  0,  0,126,  2,  0,  0,111,  7,  0,  0, 25,  1,  0,  0,239,  0,  0,  0,
+101,  0,  0,  0,184,  3,  0,  0,144,  1,  0,  0,221,  1,  0,  0,161,  0,  0,  0,183,  3,  0,  0,125,  2,  0,  0,113,  7,  0,  0,
+125,  2,  0,  0,114,  7,  0,  0,  9,  1,  0,  0,115,  7,  0,  0,144,  1,  0,  0,113,  7,  0,  0, 37,  0,  0,  0,220,  1,  0,  0,
+144,  1,  0,  0,115,  7,  0,  0,  9,  1,  0,  0,206,  0,  0,  0,  9,  1,  0,  0,114,  7,  0,  0,125,  2,  0,  0,182,  3,  0,  0,
+ 93,  0,  0,  0,207,  0,  0,  0,127,  2,  0,  0,186,  3,  0,  0,100,  0,  0,  0,235,  0,  0,  0, 23,  1,  0,  0,116,  7,  0,  0,
+ 23,  1,  0,  0,117,  7,  0,  0,143,  1,  0,  0,118,  7,  0,  0,127,  2,  0,  0,116,  7,  0,  0,160,  0,  0,  0,187,  3,  0,  0,
+127,  2,  0,  0,118,  7,  0,  0,143,  1,  0,  0,219,  1,  0,  0,143,  1,  0,  0,117,  7,  0,  0, 23,  1,  0,  0,234,  0,  0,  0,
+ 41,  0,  0,  0,218,  1,  0,  0,127,  2,  0,  0,187,  3,  0,  0,160,  0,  0,  0,189,  3,  0,  0,128,  2,  0,  0,119,  7,  0,  0,
+128,  2,  0,  0,120,  7,  0,  0,129,  2,  0,  0,121,  7,  0,  0,127,  2,  0,  0,119,  7,  0,  0,100,  0,  0,  0,186,  3,  0,  0,
+127,  2,  0,  0,121,  7,  0,  0,129,  2,  0,  0,191,  3,  0,  0,129,  2,  0,  0,120,  7,  0,  0,128,  2,  0,  0,188,  3,  0,  0,
+ 90,  0,  0,  0,190,  3,  0,  0,  2,  1,  0,  0,192,  0,  0,  0,  9,  0,  0,  0,232,  0,  0,  0, 22,  1,  0,  0,122,  7,  0,  0,
+ 22,  1,  0,  0,123,  7,  0,  0,129,  2,  0,  0,124,  7,  0,  0,  2,  1,  0,  0,122,  7,  0,  0, 90,  0,  0,  0,193,  0,  0,  0,
+  2,  1,  0,  0,124,  7,  0,  0,129,  2,  0,  0,190,  3,  0,  0,129,  2,  0,  0,123,  7,  0,  0, 22,  1,  0,  0,233,  0,  0,  0,
+100,  0,  0,  0,191,  3,  0,  0,  3,  1,  0,  0,195,  0,  0,  0, 90,  0,  0,  0,188,  3,  0,  0,128,  2,  0,  0,125,  7,  0,  0,
+128,  2,  0,  0,126,  7,  0,  0,142,  1,  0,  0,127,  7,  0,  0,  3,  1,  0,  0,125,  7,  0,  0, 36,  0,  0,  0,194,  0,  0,  0,
+  3,  1,  0,  0,127,  7,  0,  0,142,  1,  0,  0,216,  1,  0,  0,142,  1,  0,  0,126,  7,  0,  0,128,  2,  0,  0,189,  3,  0,  0,
+160,  0,  0,  0,217,  1,  0,  0, 68, 65, 84, 65,  8,  2,  0,  0, 72, 35,196,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  0,  0,  0,
+ 15,  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,
+ 85, 86, 84,101,120,  0, 97, 99,101,  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,  0,  0,  0,  0,  0,
+120, 58,200,  4,  0,  0,  0,  0, 25,  0,  0,  0, 16,  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, 78, 71,111,110, 32, 70, 97, 99,101,  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,  0,  0,  0,  0,  0,104,138,195,  4,  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,  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,  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,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  0, 80,  0,  0,120, 58,200,  4,  0,  0,  0,  0, 60,  0,  0,  0,  0,  5,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,  0, 60,  0,  0,104,138,195,  4,  0,  0,  0,  0, 58,  0,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,  3,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  6,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  9,  0,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 12,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 15,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 18,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 21,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 24,  0,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 27,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 30,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 33,  0,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 36,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 39,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 42,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 45,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 48,  0,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 51,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 54,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 57,  0,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 60,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 63,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 66,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 69,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 72,  0,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 75,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 78,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 81,  0,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 84,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 87,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 90,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 93,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 96,  0,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 99,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,102,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,105,  0,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,108,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,111,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+114,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,117,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,120,  0,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,123,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,126,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,129,  0,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,132,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,135,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+138,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,141,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,144,  0,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,147,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,150,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,153,  0,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,156,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,159,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+162,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,165,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,168,  0,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,171,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,174,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,177,  0,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,180,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,183,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+186,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,189,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,192,  0,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,195,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,198,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,201,  0,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,204,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,207,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+210,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,213,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,216,  0,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,219,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,222,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,225,  0,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,228,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,231,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+234,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,237,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,240,  0,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,243,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,246,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,249,  0,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,252,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,255,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+  2,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  5,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  8,  1,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 11,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 14,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 17,  1,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 20,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 23,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 26,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 29,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 32,  1,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 35,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 38,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 41,  1,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 44,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 47,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 50,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 53,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 56,  1,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 59,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 62,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 65,  1,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 68,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 71,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 74,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 77,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 80,  1,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 83,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 86,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 89,  1,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 92,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 95,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 98,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,101,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,104,  1,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,107,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,110,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,113,  1,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,116,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,119,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+122,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,125,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,128,  1,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,131,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,134,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,137,  1,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,140,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,143,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+146,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,149,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,152,  1,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,155,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,158,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,161,  1,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,164,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,167,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+170,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,173,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,176,  1,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,179,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,182,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,185,  1,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,188,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,191,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+194,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,197,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,200,  1,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,203,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,206,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,209,  1,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,212,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,215,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+218,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,221,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,224,  1,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,227,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,230,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,233,  1,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,236,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,239,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+242,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,245,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,248,  1,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,251,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,254,  1,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  1,  2,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,  4,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  7,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 10,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 13,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 16,  2,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 19,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 22,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 25,  2,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 28,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 31,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 34,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 37,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 40,  2,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 43,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 46,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 49,  2,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 52,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 55,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 58,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 61,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 64,  2,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 67,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 70,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 73,  2,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 76,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 79,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 82,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 85,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 88,  2,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 91,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 94,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 97,  2,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,100,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,103,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+106,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,109,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,112,  2,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,115,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,118,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,121,  2,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,124,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,127,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+130,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,133,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,136,  2,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,139,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,142,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,145,  2,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,148,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,151,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+154,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,157,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,160,  2,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,163,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,166,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,169,  2,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,172,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,175,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+178,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,181,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,184,  2,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,187,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,190,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,193,  2,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,196,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,199,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+202,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,205,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,208,  2,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,211,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,214,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,217,  2,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,220,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,223,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+226,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,229,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,232,  2,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,235,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,238,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,241,  2,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,244,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,247,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+250,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,253,  2,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  0,  3,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,  3,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  6,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  9,  3,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 12,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 15,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 18,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 21,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 24,  3,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 27,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 30,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 33,  3,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 36,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 39,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 42,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 45,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 48,  3,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 51,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 54,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 57,  3,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 60,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 63,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 66,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 69,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 72,  3,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 75,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 78,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 81,  3,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 84,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 87,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 90,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 93,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 96,  3,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 99,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,102,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,105,  3,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,108,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,111,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+114,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,117,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,120,  3,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,123,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,126,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,129,  3,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,132,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,135,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+138,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,141,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,144,  3,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,147,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,150,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,153,  3,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,156,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,159,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+162,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,165,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,168,  3,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,171,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,174,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,177,  3,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,180,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,183,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+186,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,189,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,192,  3,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,195,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,198,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,201,  3,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,204,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,207,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+210,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,213,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,216,  3,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,219,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,222,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,225,  3,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,228,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,231,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+234,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,237,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,240,  3,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,243,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,246,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,249,  3,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,252,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,255,  3,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+  2,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  5,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  8,  4,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 11,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 14,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 17,  4,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 20,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 23,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 26,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 29,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 32,  4,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 35,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 38,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 41,  4,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 44,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 47,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 50,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 53,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 56,  4,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 59,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 62,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 65,  4,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 68,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 71,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 74,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 77,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 80,  4,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 83,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 86,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 89,  4,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 92,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 95,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 98,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,101,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,104,  4,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,107,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,110,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,113,  4,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,116,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,119,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+122,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,125,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,128,  4,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,131,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,134,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,137,  4,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,140,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,143,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+146,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,149,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,152,  4,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,155,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,158,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,161,  4,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,164,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,167,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+170,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,173,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,176,  4,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,179,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,182,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,185,  4,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,188,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,191,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+194,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,197,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,200,  4,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,203,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,206,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,209,  4,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,212,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,215,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+218,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,221,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,224,  4,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,227,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,230,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,233,  4,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,236,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,239,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+242,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,245,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,248,  4,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,251,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,254,  4,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  1,  5,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,  4,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  7,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 10,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 13,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 16,  5,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 19,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 22,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 25,  5,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 28,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 31,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 34,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 37,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 40,  5,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 43,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 46,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 49,  5,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 52,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 55,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 58,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 61,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 64,  5,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 67,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 70,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 73,  5,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 76,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 79,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 82,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 85,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 88,  5,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 91,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 94,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 97,  5,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,100,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,103,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+106,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,109,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,112,  5,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,115,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,118,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,121,  5,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,124,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,127,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+130,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,133,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,136,  5,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,139,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,142,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,145,  5,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,148,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,151,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+154,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,157,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,160,  5,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,163,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,166,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,169,  5,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,172,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,175,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+178,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,181,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,184,  5,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,187,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,190,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,193,  5,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,196,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,199,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+202,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,205,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,208,  5,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,211,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,214,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,217,  5,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,220,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,223,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+226,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,229,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,232,  5,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,235,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,238,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,241,  5,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,244,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,247,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+250,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,253,  5,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  0,  6,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,  3,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  6,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  9,  6,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 12,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 15,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 18,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 21,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 24,  6,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 27,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 30,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 33,  6,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 36,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 39,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 42,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 45,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 48,  6,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 51,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 54,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 57,  6,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 60,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 63,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 66,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 69,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 72,  6,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 75,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 78,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 81,  6,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 84,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 87,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 90,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 93,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 96,  6,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 99,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,102,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,105,  6,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,108,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,111,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+114,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,117,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,120,  6,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,123,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,126,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,129,  6,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,132,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,135,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+138,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,141,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,144,  6,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,147,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,150,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,153,  6,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,156,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,159,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+162,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,165,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,168,  6,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,171,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,174,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,177,  6,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,180,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,183,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+186,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,189,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,192,  6,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,195,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,198,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,201,  6,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,204,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,207,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+210,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,213,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,216,  6,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,219,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,222,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,225,  6,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,228,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,231,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+234,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,237,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,240,  6,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,243,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,246,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,249,  6,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,252,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,255,  6,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+  2,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  5,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  8,  7,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 11,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 14,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 17,  7,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 20,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 23,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 26,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 29,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 32,  7,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 35,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 38,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 41,  7,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 44,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 47,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 50,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 53,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 56,  7,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 59,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 62,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 65,  7,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 68,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 71,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 74,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 77,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 80,  7,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 83,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 86,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 89,  7,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 92,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 95,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 98,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,101,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,104,  7,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,107,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,110,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,113,  7,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,116,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,119,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+122,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,125,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,128,  7,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,131,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,134,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,137,  7,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,140,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,143,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+146,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,149,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,152,  7,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,155,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,158,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,161,  7,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,164,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,167,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+170,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,173,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,176,  7,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,179,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,182,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,185,  7,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,188,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,191,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+194,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,197,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,200,  7,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,203,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,206,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,209,  7,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,212,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,215,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+218,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,221,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,224,  7,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,227,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,230,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,233,  7,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,236,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,239,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+242,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,245,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,248,  7,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,251,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,254,  7,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  1,  8,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,  4,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  7,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 10,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 13,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 16,  8,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 19,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 22,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 25,  8,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 28,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 31,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 34,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 37,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 40,  8,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 43,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 46,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 49,  8,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 52,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 55,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 58,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 61,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 64,  8,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 67,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 70,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 73,  8,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 76,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 79,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 82,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 85,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 88,  8,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 91,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 94,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 97,  8,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,100,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,103,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+106,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,109,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,112,  8,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,115,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,118,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,121,  8,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,124,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,127,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+130,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,133,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,136,  8,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,139,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,142,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,145,  8,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,148,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,151,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+154,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,157,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,160,  8,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,163,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,166,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,169,  8,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,172,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,175,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+178,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,181,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,184,  8,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,187,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,190,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,193,  8,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,196,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,199,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+202,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,205,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,208,  8,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,211,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,214,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,217,  8,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,220,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,223,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+226,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,229,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,232,  8,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,235,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,238,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,241,  8,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,244,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,247,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+250,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,253,  8,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  0,  9,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,  3,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  6,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  9,  9,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 12,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 15,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 18,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 21,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 24,  9,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 27,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 30,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 33,  9,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 36,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 39,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 42,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 45,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 48,  9,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 51,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 54,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 57,  9,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 60,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 63,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 66,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 69,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 72,  9,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 75,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 78,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 81,  9,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 84,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 87,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 90,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 93,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 96,  9,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 99,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,102,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,105,  9,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,108,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,111,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+114,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,117,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,120,  9,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,123,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,126,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,129,  9,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,132,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,135,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+138,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,141,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,144,  9,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,147,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,150,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,153,  9,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,156,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,159,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+162,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,165,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,168,  9,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,171,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,174,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,177,  9,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,180,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,183,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+186,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,189,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,192,  9,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,195,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,198,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,201,  9,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,204,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,207,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+210,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,213,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,216,  9,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,219,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,222,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,225,  9,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,228,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,231,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+234,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,237,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,240,  9,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,243,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,246,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,249,  9,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,252,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,255,  9,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+  2, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  5, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  8, 10,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 11, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 14, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 17, 10,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 20, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 23, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 26, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 29, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 32, 10,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 35, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 38, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 41, 10,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 44, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 47, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 50, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 53, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 56, 10,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 59, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 62, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 65, 10,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 68, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 71, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 74, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 77, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 80, 10,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 83, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 86, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 89, 10,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 92, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 95, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 98, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,101, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,104, 10,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,107, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,110, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,113, 10,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,116, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,119, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+122, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,125, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,128, 10,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,131, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,134, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,137, 10,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,140, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,143, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+146, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,149, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,152, 10,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,155, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,158, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,161, 10,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,164, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,167, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+170, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,173, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,176, 10,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,179, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,182, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,185, 10,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,188, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,191, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+194, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,197, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,200, 10,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,203, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,206, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,209, 10,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,212, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,215, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+218, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,221, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,224, 10,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,227, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,230, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,233, 10,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,236, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,239, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+242, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,245, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,248, 10,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,251, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,254, 10,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  1, 11,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,  4, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  7, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 10, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 13, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 16, 11,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 19, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 22, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 25, 11,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 28, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 31, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 34, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 37, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 40, 11,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 43, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 46, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 49, 11,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 52, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 55, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 58, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 61, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 64, 11,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 67, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 70, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 73, 11,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 76, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 79, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 82, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 85, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 88, 11,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 91, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 94, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 97, 11,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,100, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,103, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+106, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,109, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,112, 11,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,115, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,118, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,121, 11,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,124, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,127, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+130, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,133, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,136, 11,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,139, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,142, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,145, 11,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,148, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,151, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+154, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,157, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,160, 11,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,163, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,166, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,169, 11,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,172, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,175, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+178, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,181, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,184, 11,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,187, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,190, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,193, 11,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,196, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,199, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+202, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,205, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,208, 11,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,211, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,214, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,217, 11,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,220, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,223, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+226, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,229, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,232, 11,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,235, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,238, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,241, 11,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,244, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,247, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+250, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,253, 11,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  0, 12,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,  3, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  6, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  9, 12,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 12, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 15, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 18, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 21, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 24, 12,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 27, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 30, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 33, 12,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 36, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 39, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 42, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 45, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 48, 12,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 51, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 54, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 57, 12,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 60, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 63, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 66, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 69, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 72, 12,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 75, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 78, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 81, 12,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 84, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 87, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 90, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 93, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 96, 12,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 99, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,102, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,105, 12,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,108, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,111, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+114, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,117, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,120, 12,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,123, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,126, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,129, 12,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,132, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,135, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+138, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,141, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,144, 12,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,147, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,150, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,153, 12,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,156, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,159, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+162, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,165, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,168, 12,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,171, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,174, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,177, 12,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,180, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,183, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+186, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,189, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,192, 12,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,195, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,198, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,201, 12,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,204, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,207, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+210, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,213, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,216, 12,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,219, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,222, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,225, 12,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,228, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,231, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+234, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,237, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,240, 12,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,243, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,246, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,249, 12,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,252, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,255, 12,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+  2, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  5, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  8, 13,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 11, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 14, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 17, 13,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 20, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 23, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 26, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 29, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 32, 13,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 35, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 38, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 41, 13,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 44, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 47, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 50, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 53, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 56, 13,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 59, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 62, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 65, 13,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 68, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 71, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 74, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 77, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 80, 13,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 83, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 86, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 89, 13,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 92, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 95, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 98, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,101, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,104, 13,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,107, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,110, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,113, 13,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,116, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,119, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+122, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,125, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,128, 13,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,131, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,134, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,137, 13,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,140, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,143, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+146, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,149, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,152, 13,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,155, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,158, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,161, 13,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,164, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,167, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+170, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,173, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,176, 13,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,179, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,182, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,185, 13,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,188, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,191, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+194, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,197, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,200, 13,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,203, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,206, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,209, 13,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,212, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,215, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+218, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,221, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,224, 13,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,227, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,230, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,233, 13,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,236, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,239, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+242, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,245, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,248, 13,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,251, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,254, 13,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  1, 14,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,  4, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  7, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 10, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 13, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 16, 14,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 19, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 22, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 25, 14,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 28, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 31, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 34, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 37, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 40, 14,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 43, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 46, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 49, 14,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 52, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 55, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 58, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 61, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 64, 14,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 67, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 70, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 73, 14,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0, 76, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 79, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+ 82, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 85, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 88, 14,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0, 91, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 94, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 97, 14,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,100, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,103, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+106, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,109, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,112, 14,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,115, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,118, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,121, 14,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,124, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,127, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+130, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,133, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,136, 14,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,139, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,142, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,145, 14,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,148, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,151, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+154, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,157, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,160, 14,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,163, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,166, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,169, 14,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,172, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,175, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+178, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,181, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,184, 14,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,187, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,190, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,193, 14,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,196, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,199, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+202, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,205, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,208, 14,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,211, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,214, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,217, 14,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,220, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,223, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+226, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,229, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,232, 14,  0,  0,  3,  0,  0,  0,
+  0,  0,  3,  0,235, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,238, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,241, 14,  0,  0,
+  3,  0,  0,  0,  0,  0,  3,  0,244, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,247, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,
+250, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,253, 14,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0, 77, 69,  0,  0,232,  4,  0,  0,
+232,105,198,  4,  0,  0,  0,  0, 50,  0,  0,  0,  1,  0,  0,  0,200,120,198,  4,  0,  0,  0,  0,200, 43,196,  4,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 69,112,114,101,118,105,101,119, 46, 48, 48, 50,  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,  0,  0,  0,  0,  0,  1,  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,  0, 24,111,198,  4,  0,  0,  0,  0,136,130, 27,  4,  0,  0,  0,  0, 88,  5,196,  4,  0,  0,  0,  0,
+ 56, 42,196,  4,  0,  0,  0,  0,184,  5,196,  4,  0,  0,  0,  0, 56,  6,196,  4,  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,184,113,198,  4,  0,  0,  0,  0,184,116,198,  4,  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,  0,  0,104,111,198,  4,  0,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  1,  0,  0,  0,  5,  0,  0,  0, 24,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+104,114,198,  4,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,  0,  0,  0,  0,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  1,  0,  0,  0,  5,  0,  0,  0, 12,  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,  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,  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,  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,
+232, 39,196,  4,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,  1,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  2,  0,  0,  0,  5,  0,  0,  0, 28,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,  3,196,  4,  0,  0,  0,  0,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  0,  0,  0,  0,  1,  0,  0,  0,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  2,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  3,  0,  0,  0,  5,  0,  0,  0, 24,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  5,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,179,
+  0,  0, 64, 52,235, 92,142,188,  0,  0,128, 63,  2,  0,128, 63,235, 92,142, 60,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0, 67,  0, 30,  0,  4,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  8,  0,  0,  0,
+ 24,111,198,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,120,164, 26,  4,  0,  0,  0,  0, 68, 65, 84, 65,  8,  2,  0,  0,
+104,111,198,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  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,  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,184,113,198,  4,  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,  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,  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,  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,  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,  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,
+  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,100,  0,  0,  0,
+184,113,198,  4,  0,  0,  0,  0, 56,  0,  0,  0,  5,  0,  0,  0,  0,116,  6, 65,254,255,127, 63, 42,117,228, 39,  0,  0,  0,  0,
+255,127,  3,  0,  0,116,  6, 65,254,255,127,191, 43, 59,177,167,  0,  0,  0,  0,255,127,  3,  0,  0,116,  6,193,250,255,127,191,
+ 39,117,228,167,  0,  0,  0,  0,255,127,  3,  0,252,115,  6,193,  1,  0,128, 63, 49, 59,177, 39,  0,  0,  0,  0,255,127,  3,  0,
+  0,239,110, 59,131,164, 26, 60,235, 92, 14,189,228, 12, 95, 33, 28,133,  3,  0, 68, 65, 84, 65,  8,  2,  0,  0,104,114,198,  4,
+  0,  0,  0,  0,124,  1,  0,  0,  5,  0,  0,  0,  3,  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,  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,184,116,198,  4,  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,  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,  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,  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,  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,  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,  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,  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,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0,184,116,198,  4,
+  0,  0,  0,  0, 53,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,  2,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+  0,  0, 35,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0, 35,  0,  2,  0,  0,  0,  3,  0,  0,  0,  0,  0, 35,  0, 68, 65, 84, 65,
+  8,  2,  0,  0,  8,  3,196,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  0,  0,  0, 16,  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, 85, 86, 84,101,120,  0, 97, 99,101, 45, 86,101,
+114,116,101,120,  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,184,  5,196,  4,  0,  0,  0,  0, 17,  0,  0,  0,
+ 12,  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, 67,111,108,  0,
+ 32, 70, 97, 99,101, 45, 86,101,114,116,101,120,  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, 56,  6,196,  4,
+  0,  0,  0,  0, 26,  0,  0,  0, 16,  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, 78, 71,111,110, 32, 70, 97, 99,101, 45, 86,101,114,116,101,120,  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, 56, 42,196,  4,  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,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0,184,  5,196,  4,  0,  0,  0,  0, 61,  0,  0,  0,  4,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0, 56,  6,196,  4,  0,  0,  0,  0, 62,  0,  0,  0,  4,  0,  0,  0,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255, 68, 65, 84, 65, 32,  0,  0,  0, 56, 42,196,  4,  0,  0,  0,  0, 59,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  3,  0,  0,  0,  3,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+  1,  0,  0,  0, 68, 65, 84, 65,  8,  2,  0,  0,232, 39,196,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  0,  0,  0, 15,  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, 85, 86, 84,101,
+120,  0, 97, 99,101,  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,  0,  0,  0,  0,  0, 88,  5,196,  4,
+  0,  0,  0,  0, 25,  0,  0,  0, 16,  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, 78, 71,111,110, 32, 70, 97, 99,101,  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,  0,
+  0,  0,  0,  0,136,130, 27,  4,  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,  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,  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,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0, 88,  5,196,  4,  0,  0,  0,  0, 60,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 68, 65, 84, 65, 12,  0,  0,  0,136,130, 27,  4,  0,  0,  0,  0, 58,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  2,  0, 77, 69,  0,  0,232,  4,  0,  0,200,120,198,  4,  0,  0,  0,  0,
+ 50,  0,  0,  0,  1,  0,  0,  0, 56,142,198,  4,  0,  0,  0,  0,232,105,198,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 77, 69,112,114,101,118,105,101,119, 46, 48, 48, 51,  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,  0,  0,  0,  0,  0,  1,  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,  0,
+248,125,198,  4,  0,  0,  0,  0,168, 42,196,  4,  0,  0,  0,  0,152,102, 27,  4,  0,  0,  0,  0,232, 18,196,  4,  0,  0,  0,  0,
+120,103, 27,  4,  0,  0,  0,  0,120,105, 27,  4,  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,152,128,198,  4,  0,  0,  0,  0,  8,134,198,  4,  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,  0,  0, 72,126,198,  4,  0,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  1,  0,  0,  0,  5,  0,  0,  0,
+ 24,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,184,131,198,  4,  0,  0,  0,  0,
+255,255,255,255,255,255,255,255,255,255,255,255,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,  1,  0,  0,  0,  5,  0,  0,  0, 12,  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,  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,  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,  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, 56,117,198,  4,  0,  0,  0,  0,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  0,  0,  0,  0,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,  1,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,  2,  0,  0,  0,  5,  0,  0,  0, 28,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 72,100, 27,  4,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  0,  0,  0,  0,  1,  0,  0,  0,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  2,  0,  0,  0,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  3,  0,  0,  0,  5,  0,  0,  0,
+ 24,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 36,  0,  0,  0, 36,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0, 36,  0,  0,  0,  7,  0,  0,  0,  0,  0,128,179,  0,  0, 64, 52,  0,  0,192, 28,
+  0,  0,128, 63,  2,  0,128, 63,172,197, 39, 55,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 67,  0, 30,  0,  4,  0,
+  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  8,  0,  0,  0,248,125,198,  4,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,216,189, 26,  4,  0,  0,  0,  0, 68, 65, 84, 65,  8,  2,  0,  0, 72,126,198,  4,  0,  0,  0,  0,
+124,  1,  0,  0,  5,  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,  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,152,128,198,  4,  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,  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,  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,  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,  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,  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,  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,  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,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,208,  2,  0,  0,152,128,198,  4,  0,  0,  0,  0,
+ 56,  0,  0,  0, 36,  0,  0,  0,  0,  0,128, 63,255,255,127, 63,255,255,251, 39,  0,  0,  0,  0,254,127,  2,  0,  0,  0,128, 63,
+  0,  0,128,191,  0,  0,  2,168,  0,  0,  0,  0,255,127,  2,  0,  1,  0,128,191,253,255,127,191,253,255,251,167,  0,  0,  0,  0,
+255,127,  2,  0,250,255,127,191,  3,  0,128, 63,  3,  0,  2, 40,  0,  0,  0,  0,255,127,  2,  0,113,250, 63, 64,  7,  3,128, 63,
+ 79,201,113, 48,  0,  0,  0,  0,  1,128,  2,  0,114,250, 63, 64,242,249,127,191,107,200,113, 48,  0,  0,  0,  0,  1,128,  2,  0,
+206,233,127, 63,245,249,127,191, 95,200,113, 48,  0,  0,  0,  0,  1,128,  2,  0,206,233,127, 63,  3,  3,128, 63, 63,201,113, 48,
+  0,  0,  0,  0,  1,128,  2,  0,185,235, 63,192,197,  9,128, 63,138, 82,171, 51,  0,  0,  0,  0,  1,128,  2,  0,185,235, 63,192,
+113,236,127,191,137, 82,171, 51,  0,  0,  0,  0,  1,128,  2,  0,232,174,127,191,110,236,127,191,137, 82,171, 51,  0,  0,  0,  0,
+  1,128,  2,  0,236,174,127,191,201,  9,128, 63,138, 82,171, 51,  0,  0,  0,  0,  1,128,  2,  0,181,242,159,192, 32, 15,128, 63,
+175,196, 41, 43,  0,  0,  0,  0,255,127,  2,  0,182,242,159,192,194,225,127,191,175,196, 37, 43,  0,  0,  0,  0,255,127,  2,  0,
+108,229, 63,192,197,225,127,191,175,180, 37, 43,  0,  0,  0,  0,255,127,  2,  0,108,229, 63,192, 29, 15,128, 63,175,180, 41, 43,
+  0,  0,  0,  0,254,127,  2,  0,112,253,159, 64,242, 18,128, 63, 85,138, 18, 51,  0,  0,  0,  0,254,127,  2,  0,112,253,159, 64,
+ 27,218,127,191, 81,138, 18, 51,  0,  0,  0,  0,255,127,  2,  0,223,250, 63, 64, 24,218,127,191, 81,138, 18, 51,  0,  0,  0,  0,
+255,127,  2,  0,225,250, 63, 64,245, 18,128, 63, 85,138, 18, 51,  0,  0,  0,  0,255,127,  2,  0,178,236,223,192, 32, 14,128, 63,
+ 81,158,216,175,  0,  0,  0,  0,254,127,  2,  0,178,236,223,192,192,227,127,191, 81,160,216,175,  0,  0,  0,  0,255,127,  2,  0,
+ 89,246, 15,193,188,227,127,191, 73,160,216,175,  0,  0,  0,  0,254,127,  2,  0, 89,246, 15,193, 35, 14,128, 63, 73,158,216,175,
+  0,  0,  0,  0,255,127,  2,  0,217,239,159,192,204,  8,128, 63,151,121,170, 51,  0,  0,  0,  0,  1,128,  2,  0,217,239,159,192,
+104,238,127,191,150,121,170, 51,  0,  0,  0,  0,  2,128,  2,  0,217,239,223,192,108,238,127,191,150,121,170, 51,  0,  0,  0,  0,
+  1,128,  2,  0,217,239,223,192,200,  8,128, 63,151,121,170, 51,  0,  0,  0,  0,  1,128,  2,  0,233,247,223, 64,219, 24,128, 63,
+ 78,136,155,180,  0,  0,  0,  0,255,127,  3,  0,233,247,223, 64, 76,206,127,191, 79,136,155,180,  0,  0,  0,  0,254,127,  3,  0,
+245,251, 15, 65, 80,206,127,191, 79,136,155,180,  0,  0,  0,  0,255,127,  3,  0,245,251, 15, 65,216, 24,128, 63, 78,136,155,180,
+  0,  0,  0,  0,254,127,  3,  0,179,247,159, 64,233,  8,128, 63,180, 96,173,180,  0,  0,  0,  0,  1,128,  3,  0,179,247,159, 64,
+ 42,238,127,191,181, 96,173,180,  0,  0,  0,  0,  1,128,  3,  0,178,247,223, 64, 38,238,127,191,181, 96,173,180,  0,  0,  0,  0,
+  1,128,  3,  0,177,247,223, 64,237,  8,128, 63,180, 96,173,180,  0,  0,  0,  0,  1,128,  3,  0, 68, 65, 84, 65,  8,  2,  0,  0,
+184,131,198,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  0,  0,  0,  3,  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,  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,  8,134,198,  4,  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,  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,  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,  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,  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,  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,
+  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,176,  1,  0,  0,
+  8,134,198,  4,  0,  0,  0,  0, 53,  0,  0,  0, 36,  0,  0,  0,  1,  0,  0,  0,  2,  0,  0,  0,  0,  0, 34,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,  0,  0, 34,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0, 34,  0,  2,  0,  0,  0,  3,  0,  0,  0,  0,  0, 34,  0,
+  4,  0,  0,  0,  5,  0,  0,  0,  0,  0, 34,  0,  4,  0,  0,  0,  7,  0,  0,  0,  0,  0, 34,  0,  6,  0,  0,  0,  7,  0,  0,  0,
+  0,  0, 34,  0,  5,  0,  0,  0,  6,  0,  0,  0,  0,  0, 34,  0,  9,  0,  0,  0, 10,  0,  0,  0,  0,  0, 34,  0,  8,  0,  0,  0,
+  9,  0,  0,  0,  0,  0, 34,  0,  8,  0,  0,  0, 11,  0,  0,  0,  0,  0, 34,  0, 10,  0,  0,  0, 11,  0,  0,  0,  0,  0, 34,  0,
+ 12,  0,  0,  0, 13,  0,  0,  0,  0,  0, 34,  0, 12,  0,  0,  0, 15,  0,  0,  0,  0,  0, 34,  0, 14,  0,  0,  0, 15,  0,  0,  0,
+  0,  0, 34,  0, 13,  0,  0,  0, 14,  0,  0,  0,  0,  0, 34,  0, 17,  0,  0,  0, 18,  0,  0,  0,  0,  0, 34,  0, 16,  0,  0,  0,
+ 17,  0,  0,  0,  0,  0, 34,  0, 16,  0,  0,  0, 19,  0,  0,  0,  0,  0, 34,  0, 18,  0,  0,  0, 19,  0,  0,  0,  0,  0, 34,  0,
+ 21,  0,  0,  0, 22,  0,  0,  0,  0,  0, 34,  0, 21,  0,  0,  0, 20,  0,  0,  0,  0,  0, 34,  0, 20,  0,  0,  0, 23,  0,  0,  0,
+  0,  0, 34,  0, 22,  0,  0,  0, 23,  0,  0,  0,  0,  0, 34,  0, 24,  0,  0,  0, 25,  0,  0,  0,  0,  0, 34,  0, 24,  0,  0,  0,
+ 27,  0,  0,  0,  0,  0, 34,  0, 26,  0,  0,  0, 27,  0,  0,  0,  0,  0, 34,  0, 25,  0,  0,  0, 26,  0,  0,  0,  0,  0, 34,  0,
+ 29,  0,  0,  0, 28,  0,  0,  0,  0,  0, 35,  0, 31,  0,  0,  0, 28,  0,  0,  0,  0,  0, 35,  0, 31,  0,  0,  0, 30,  0,  0,  0,
+  0,  0, 35,  0, 29,  0,  0,  0, 30,  0,  0,  0,  0,  0, 35,  0, 34,  0,  0,  0, 33,  0,  0,  0,  0,  0, 35,  0, 32,  0,  0,  0,
+ 33,  0,  0,  0,  0,  0, 35,  0, 35,  0,  0,  0, 32,  0,  0,  0,  0,  0, 35,  0, 34,  0,  0,  0, 35,  0,  0,  0,  0,  0, 35,  0,
+ 68, 65, 84, 65,  8,  2,  0,  0, 72,100, 27,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  0,  0,  0, 16,  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, 85, 86, 84,101,120,  0, 97, 99,
+101, 45, 86,101,114,116,101,120,  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,120,103, 27,  4,  0,  0,  0,  0,
+ 17,  0,  0,  0, 12,  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,
+ 67,111,108,  0, 32, 70, 97, 99,101, 45, 86,101,114,116,101,120,  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,
+120,105, 27,  4,  0,  0,  0,  0, 26,  0,  0,  0, 16,  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, 78, 71,111,110, 32, 70, 97, 99,101, 45, 86,101,114,116,101,120,  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,232, 18,196,  4,  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,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,176,  1,  0,  0,120,103, 27,  4,  0,  0,  0,  0, 61,  0,  0,  0, 36,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0, 68, 65, 84, 65,144,  0,  0,  0,120,105, 27,  4,  0,  0,  0,  0, 62,  0,  0,  0, 36,  0,  0,  0,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 68, 65, 84, 65, 32,  1,  0,  0,232, 18,196,  4,  0,  0,  0,  0,
+ 59,  0,  0,  0, 36,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  3,  0,  0,  0,  3,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,  1,  0,  0,  0,  7,  0,  0,  0,  5,  0,  0,  0,  4,  0,  0,  0,  4,  0,  0,  0,  5,  0,  0,  0,  7,  0,  0,  0,
+  6,  0,  0,  0,  6,  0,  0,  0,  8,  0,  0,  0, 10,  0,  0,  0, 11,  0,  0,  0, 11,  0,  0,  0, 10,  0,  0,  0,  8,  0,  0,  0,
+  9,  0,  0,  0,  9,  0,  0,  0, 15,  0,  0,  0, 13,  0,  0,  0, 12,  0,  0,  0, 12,  0,  0,  0, 13,  0,  0,  0, 15,  0,  0,  0,
+ 14,  0,  0,  0, 14,  0,  0,  0, 16,  0,  0,  0, 18,  0,  0,  0, 19,  0,  0,  0, 19,  0,  0,  0, 18,  0,  0,  0, 16,  0,  0,  0,
+ 17,  0,  0,  0, 17,  0,  0,  0, 20,  0,  0,  0, 22,  0,  0,  0, 23,  0,  0,  0, 23,  0,  0,  0, 22,  0,  0,  0, 20,  0,  0,  0,
+ 21,  0,  0,  0, 21,  0,  0,  0, 27,  0,  0,  0, 25,  0,  0,  0, 24,  0,  0,  0, 24,  0,  0,  0, 25,  0,  0,  0, 27,  0,  0,  0,
+ 26,  0,  0,  0, 26,  0,  0,  0, 31,  0,  0,  0, 29,  0,  0,  0, 28,  0,  0,  0, 28,  0,  0,  0, 29,  0,  0,  0, 31,  0,  0,  0,
+ 30,  0,  0,  0, 30,  0,  0,  0, 32,  0,  0,  0, 34,  0,  0,  0, 35,  0,  0,  0, 35,  0,  0,  0, 34,  0,  0,  0, 32,  0,  0,  0,
+ 33,  0,  0,  0, 33,  0,  0,  0, 68, 65, 84, 65,  8,  2,  0,  0, 56,117,198,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  0,  0,  0,
+ 15,  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,
+ 85, 86, 84,101,120,  0, 97, 99,101,  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,  0,  0,  0,  0,  0,
+152,102, 27,  4,  0,  0,  0,  0, 25,  0,  0,  0, 16,  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, 78, 71,111,110, 32, 70, 97, 99,101,  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,  0,  0,  0,  0,  0,168, 42,196,  4,  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,  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,  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,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,144,  0,  0,  0,152,102, 27,  4,  0,  0,  0,  0, 60,  0,  0,  0,  9,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  3,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  3,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  3,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  3,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  3,  0,  0,  0,  0,  0, 68, 65, 84, 65,108,  0,  0,  0,168, 42,196,  4,  0,  0,  0,  0,
+ 58,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+  8,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 12,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 16,  0,  0,  0,  4,  0,  0,  0,
+  0,  0,  0,  0, 20,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 24,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 28,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  2,  0, 32,  0,  0,  0,  4,  0,  0,  0,  0,  0,  2,  0, 77, 69,  0,  0,232,  4,  0,  0, 56,142,198,  4,
+  0,  0,  0,  0, 50,  0,  0,  0,  1,  0,  0,  0,  8,157,198,  4,  0,  0,  0,  0,200,120,198,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 69,112,114,101,118,105,101,119, 46, 48, 48, 52,  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,  0,  0,  0,  0,  0,  1,  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,  0,104,147,198,  4,  0,  0,  0,  0,104, 43,196,  4,  0,  0,  0,  0,168,140,198,  4,  0,  0,  0,  0,152,  6,196,  4,
+  0,  0,  0,  0,  8,141,198,  4,  0,  0,  0,  0,136,141,198,  4,  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,  8,150,198,  4,  0,  0,  0,  0,248,152,198,  4,  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,  0,  0,184,147,198,  4,  0,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  1,  0,  0,  0,
+  5,  0,  0,  0, 24,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,168,150,198,  4,
+  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,  1,  0,  0,  0,  5,  0,  0,  0, 12,  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,  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,  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,  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,  8,136,198,  4,
+  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,  1,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,  2,  0,  0,  0,  5,  0,  0,  0, 28,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 88,138,198,  4,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 77, 69,  0,  0,
-152,  1,  0,  0, 88,192, 55,  3,  0,  0,  0,  0, 46,  0,  0,  0,  1,  0,  0,  0,  8,202, 55,  3,  0,  0,  0,  0,104,135, 53,  3,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 69,112,114,101,118,105,101,119, 46, 48, 48,
- 50,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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, 56,194, 55,  3,
-  0,  0,  0,  0,200,200, 55,  3,  0,  0,  0,  0, 40,201, 55,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 56,196, 55,  3,
-  0,  0,  0,  0,152,198, 55,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,168,201, 55,  3,  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,136,194, 55,  3,
-  0,  0,  0,  0,  1,  0,  0,  0,  5,  0,  0,  0, 24,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,232,196, 55,  3,  0,  0,  0,  0,  1,  0,  0,  0,  5,  0,  0,  0, 12,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24,199, 55,  3,  0,  0,  0,  0,  3,  0,  0,  0,  5,  0,  0,  0, 80,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,179,  0,  0, 64, 52,235, 92,142,188,  0,  0,128, 63,  2,  0,128, 63,235, 92,142, 60,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 67,  0, 30,  0,  4,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  8,  0,  0,  0, 56,194, 55,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,168,238, 51,  3,  0,  0,  0,  0, 68, 65, 84, 65,104,  1,  0,  0,136,194, 55,  3,  0,  0,  0,  0, 84,  1,  0,  0,
-  5,  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,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  0,  0,  0,  0,  1,  0,  0,  0,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  2,  0,  0,  0,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  3,  0,  0,  0,
+  5,  0,  0,  0, 24,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,179,  0,  0, 64, 52,
+  0,  0,192, 28,  0,  0,128, 63,  2,  0,128, 63,172,197, 39, 55,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0, 67,  0,
+ 30,  0,  4,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  8,  0,  0,  0,104,147,198,  4,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,232,198, 26,  4,  0,  0,  0,  0, 68, 65, 84, 65,  8,  2,  0,  0,184,147,198,  4,
+  0,  0,  0,  0,124,  1,  0,  0,  5,  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,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 56,196, 55,  3,  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,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,150,198,  4,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -13326,96 +15647,64 @@ char datatoc_preview_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,100,  0,  0,  0, 56,196, 55,  3,  0,  0,  0,  0, 52,  0,  0,  0,
-  5,  0,  0,  0,  0,116,  6, 65,254,255,127, 63, 42,117,228, 39,  0,  0,  0,  0,255,127,  3,  0,  0,116,  6, 65,254,255,127,191,
- 43, 59,177,167,  0,  0,  0,  0,255,127,  3,  0,  0,116,  6,193,250,255,127,191, 39,117,228,167,  0,  0,  0,  0,255,127,  3,  0,
-252,115,  6,193,  1,  0,128, 63, 49, 59,177, 39,  0,  0,  0,  0,255,127,  3,  0,  0,239,110, 59,131,164, 26, 60,235, 92, 14,189,
-228, 12, 95, 33, 28,133,  3,  0, 68, 65, 84, 65,104,  1,  0,  0,232,196, 55,  3,  0,  0,  0,  0, 84,  1,  0,  0,  5,  0,  0,  0,
-  3,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-152,198, 55,  3,  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,  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,  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,  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, 68, 65, 84, 65, 80,  0,  0,  0,  8,150,198,  4,
+  0,  0,  0,  0, 56,  0,  0,  0,  4,  0,  0,  0, 50, 49,175, 64,255,255,127, 63, 28,159,152, 51,  0,  0,  0,  0,255,127,  3,  0,
+ 50, 49,175, 64,  0,  0,128,191, 33,159,152,179,  0,  0,  0,  0,255,127,  3,  0, 50, 49,175,192,252,255,127,191, 31,159,152,179,
+  0,  0,  0,  0,255,127,  3,  0, 45, 49,175,192,  4,  0,128, 63, 33,159,152, 51,  0,  0,  0,  0,255,127,  3,  0, 68, 65, 84, 65,
+  8,  2,  0,  0,168,150,198,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  0,  0,  0,  3,  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,  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,248,152,198,  4,  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,  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, 68, 65, 84, 65, 48,  0,  0,  0,152,198, 55,  3,  0,  0,  0,  0, 49,  0,  0,  0,  4,  0,  0,  0,
-  1,  0,  0,  0,  2,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0,  0,  3,  0,  0,  0,
-  0,  0, 35,  0,  2,  0,  0,  0,  3,  0,  0,  0,  0,  0, 35,  0, 68, 65, 84, 65,104,  1,  0,  0, 24,199, 55,  3,  0,  0,  0,  0,
- 84,  1,  0,  0,  5,  0,  0,  0,  4,  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, 86, 84,101,120,  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,200,200, 55,  3,  0,  0,  0,  0,  5,  0,  0,  0, 20,  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, 85, 86, 84,101,120,  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, 40,201, 55,  3,  0,  0,  0,  0,  6,  0,  0,  0, 64,  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, 67,111,108,  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,168,201, 55,  3,  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,  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,
   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, 68, 65, 84, 65, 20,  0,  0,  0,200,200, 55,  3,  0,  0,  0,  0,
- 48,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  2, 68, 65, 84, 65,
- 48,  0,  0,  0, 40,201, 55,  3,  0,  0,  0,  0, 59,  0,  0,  0,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0,168,201, 55,  3,  0,  0,  0,  0, 53,  0,  0,  0,  4,  0,  0,  0,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255, 77, 69,  0,  0,152,  1,  0,  0,  8,202, 55,  3,  0,  0,  0,  0, 46,  0,  0,  0,
-  1,  0,  0,  0, 72,218, 55,  3,  0,  0,  0,  0, 88,192, 55,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 77, 69,112,114,101,118,105,101,119, 46, 48, 48, 51,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,232,203, 55,  3,  0,  0,  0,  0,104,214, 55,  3,  0,  0,  0,  0,104,215, 55,  3,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232,205, 55,  3,  0,  0,  0,  0,184,210, 55,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,104,217, 55,  3,  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, 56,204, 55,  3,  0,  0,  0,  0,  1,  0,  0,  0,  5,  0,  0,  0, 24,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,209, 55,  3,  0,  0,  0,  0,  1,  0,  0,  0,
-  5,  0,  0,  0, 12,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,184,212, 55,  3,
-  0,  0,  0,  0,  3,  0,  0,  0,  5,  0,  0,  0, 80,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 36,  0,  0,  0, 36,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  7,  0,  0,  0,  0,  0,128,179,  0,  0, 64, 52,
-  0,  0,192, 28,  0,  0,128, 63,  2,  0,128, 63,172,197, 39, 55,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 67,  0,
- 30,  0,  4,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
-  8,  0,  0,  0,232,203, 55,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,136,  7, 52,  3,  0,  0,  0,  0, 68, 65, 84, 65,
-104,  1,  0,  0, 56,204, 55,  3,  0,  0,  0,  0, 84,  1,  0,  0,  5,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232,205, 55,  3,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0,248,152,198,  4,  0,  0,  0,  0, 53,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,  2,  0,  0,  0,  0,  0, 35,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0, 35,  0,  2,  0,  0,  0,  3,  0,  0,  0,
+  0,  0, 35,  0, 68, 65, 84, 65,  8,  2,  0,  0, 88,138,198,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  0,  0,  0, 16,  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, 85, 86, 84,101,
+120,  0, 97, 99,101, 45, 86,101,114,116,101,120,  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,  8,141,198,  4,
+  0,  0,  0,  0, 17,  0,  0,  0, 12,  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, 67,111,108,  0, 32, 70, 97, 99,101, 45, 86,101,114,116,101,120,  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,136,141,198,  4,  0,  0,  0,  0, 26,  0,  0,  0, 16,  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, 78, 71,111,110, 32, 70, 97, 99,101, 45, 86,101,114,116,101,120,  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,152,  6,196,  4,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
-208,  2,  0,  0,232,205, 55,  3,  0,  0,  0,  0, 52,  0,  0,  0, 36,  0,  0,  0,  0,  0,128, 63,255,255,127, 63,255,255,251, 39,
-  0,  0,  0,  0,254,127,  2,  0,  0,  0,128, 63,  0,  0,128,191,  0,  0,  2,168,  0,  0,  0,  0,255,127,  2,  0,  1,  0,128,191,
-253,255,127,191,253,255,251,167,  0,  0,  0,  0,255,127,  2,  0,250,255,127,191,  3,  0,128, 63,  3,  0,  2, 40,  0,  0,  0,  0,
-255,127,  2,  0,113,250, 63, 64,  7,  3,128, 63, 79,201,113, 48,  0,  0,  0,  0,  1,128,  2,  0,114,250, 63, 64,242,249,127,191,
-107,200,113, 48,  0,  0,  0,  0,  1,128,  2,  0,206,233,127, 63,245,249,127,191, 95,200,113, 48,  0,  0,  0,  0,  1,128,  2,  0,
-206,233,127, 63,  3,  3,128, 63, 63,201,113, 48,  0,  0,  0,  0,  1,128,  2,  0,185,235, 63,192,197,  9,128, 63,138, 82,171, 51,
-  0,  0,  0,  0,  1,128,  2,  0,185,235, 63,192,113,236,127,191,137, 82,171, 51,  0,  0,  0,  0,  1,128,  2,  0,232,174,127,191,
-110,236,127,191,137, 82,171, 51,  0,  0,  0,  0,  1,128,  2,  0,236,174,127,191,201,  9,128, 63,138, 82,171, 51,  0,  0,  0,  0,
-  1,128,  2,  0,181,242,159,192, 32, 15,128, 63,175,196, 41, 43,  0,  0,  0,  0,255,127,  2,  0,182,242,159,192,194,225,127,191,
-175,196, 37, 43,  0,  0,  0,  0,255,127,  2,  0,108,229, 63,192,197,225,127,191,175,180, 37, 43,  0,  0,  0,  0,255,127,  2,  0,
-108,229, 63,192, 29, 15,128, 63,175,180, 41, 43,  0,  0,  0,  0,254,127,  2,  0,112,253,159, 64,242, 18,128, 63, 85,138, 18, 51,
-  0,  0,  0,  0,254,127,  2,  0,112,253,159, 64, 27,218,127,191, 81,138, 18, 51,  0,  0,  0,  0,255,127,  2,  0,223,250, 63, 64,
- 24,218,127,191, 81,138, 18, 51,  0,  0,  0,  0,255,127,  2,  0,225,250, 63, 64,245, 18,128, 63, 85,138, 18, 51,  0,  0,  0,  0,
-255,127,  2,  0,178,236,223,192, 32, 14,128, 63, 81,158,216,175,  0,  0,  0,  0,254,127,  2,  0,178,236,223,192,192,227,127,191,
- 81,160,216,175,  0,  0,  0,  0,255,127,  2,  0, 89,246, 15,193,188,227,127,191, 73,160,216,175,  0,  0,  0,  0,254,127,  2,  0,
- 89,246, 15,193, 35, 14,128, 63, 73,158,216,175,  0,  0,  0,  0,255,127,  2,  0,217,239,159,192,204,  8,128, 63,151,121,170, 51,
-  0,  0,  0,  0,  1,128,  2,  0,217,239,159,192,104,238,127,191,150,121,170, 51,  0,  0,  0,  0,  2,128,  2,  0,217,239,223,192,
-108,238,127,191,150,121,170, 51,  0,  0,  0,  0,  1,128,  2,  0,217,239,223,192,200,  8,128, 63,151,121,170, 51,  0,  0,  0,  0,
-  1,128,  2,  0,233,247,223, 64,219, 24,128, 63, 78,136,155,180,  0,  0,  0,  0,255,127,  3,  0,233,247,223, 64, 76,206,127,191,
- 79,136,155,180,  0,  0,  0,  0,254,127,  3,  0,245,251, 15, 65, 80,206,127,191, 79,136,155,180,  0,  0,  0,  0,255,127,  3,  0,
-245,251, 15, 65,216, 24,128, 63, 78,136,155,180,  0,  0,  0,  0,254,127,  3,  0,179,247,159, 64,233,  8,128, 63,180, 96,173,180,
-  0,  0,  0,  0,  1,128,  3,  0,179,247,159, 64, 42,238,127,191,181, 96,173,180,  0,  0,  0,  0,  1,128,  3,  0,178,247,223, 64,
- 38,238,127,191,181, 96,173,180,  0,  0,  0,  0,  1,128,  3,  0,177,247,223, 64,237,  8,128, 63,180, 96,173,180,  0,  0,  0,  0,
-  1,128,  3,  0, 68, 65, 84, 65,104,  1,  0,  0,  8,209, 55,  3,  0,  0,  0,  0, 84,  1,  0,  0,  5,  0,  0,  0,  3,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,184,210, 55,  3,
   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, 68, 65, 84, 65, 48,  0,  0,  0,  8,141,198,  4,  0,  0,  0,  0, 61,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0,136,141,198,  4,  0,  0,  0,  0, 62,  0,  0,  0,
+  4,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 68, 65, 84, 65, 32,  0,  0,  0,152,  6,196,  4,
+  0,  0,  0,  0, 59,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  3,  0,  0,  0,  3,  0,  0,  0,  2,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0, 68, 65, 84, 65,  8,  2,  0,  0,  8,136,198,  4,  0,  0,  0,  0,124,  1,  0,  0,
+  5,  0,  0,  0, 15,  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, 85, 86, 84,101,120,  0, 97, 99,101,  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,  0,
+  0,  0,  0,  0,168,140,198,  4,  0,  0,  0,  0, 25,  0,  0,  0, 16,  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, 78, 71,111,110, 32, 70, 97, 99,101,  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,  0,  0,  0,  0,  0,104, 43,196,  4,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -13423,91 +15712,61 @@ char datatoc_preview_blend[]= {
   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,  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, 68, 65, 84, 65,176,  1,  0,  0,184,210, 55,  3,  0,  0,  0,  0, 49,  0,  0,  0, 36,  0,  0,  0,  1,  0,  0,  0,
-  2,  0,  0,  0,  0,  0, 34,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0, 34,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0, 34,  0,
-  2,  0,  0,  0,  3,  0,  0,  0,  0,  0, 34,  0,  4,  0,  0,  0,  5,  0,  0,  0,  0,  0, 34,  0,  4,  0,  0,  0,  7,  0,  0,  0,
-  0,  0, 34,  0,  6,  0,  0,  0,  7,  0,  0,  0,  0,  0, 34,  0,  5,  0,  0,  0,  6,  0,  0,  0,  0,  0, 34,  0,  9,  0,  0,  0,
- 10,  0,  0,  0,  0,  0, 34,  0,  8,  0,  0,  0,  9,  0,  0,  0,  0,  0, 34,  0,  8,  0,  0,  0, 11,  0,  0,  0,  0,  0, 34,  0,
- 10,  0,  0,  0, 11,  0,  0,  0,  0,  0, 34,  0, 12,  0,  0,  0, 13,  0,  0,  0,  0,  0, 34,  0, 12,  0,  0,  0, 15,  0,  0,  0,
-  0,  0, 34,  0, 14,  0,  0,  0, 15,  0,  0,  0,  0,  0, 34,  0, 13,  0,  0,  0, 14,  0,  0,  0,  0,  0, 34,  0, 17,  0,  0,  0,
- 18,  0,  0,  0,  0,  0, 34,  0, 16,  0,  0,  0, 17,  0,  0,  0,  0,  0, 34,  0, 16,  0,  0,  0, 19,  0,  0,  0,  0,  0, 34,  0,
- 18,  0,  0,  0, 19,  0,  0,  0,  0,  0, 34,  0, 21,  0,  0,  0, 22,  0,  0,  0,  0,  0, 34,  0, 21,  0,  0,  0, 20,  0,  0,  0,
-  0,  0, 34,  0, 20,  0,  0,  0, 23,  0,  0,  0,  0,  0, 34,  0, 22,  0,  0,  0, 23,  0,  0,  0,  0,  0, 34,  0, 24,  0,  0,  0,
- 25,  0,  0,  0,  0,  0, 34,  0, 24,  0,  0,  0, 27,  0,  0,  0,  0,  0, 34,  0, 26,  0,  0,  0, 27,  0,  0,  0,  0,  0, 34,  0,
- 25,  0,  0,  0, 26,  0,  0,  0,  0,  0, 34,  0, 29,  0,  0,  0, 28,  0,  0,  0,  0,  0, 35,  0, 31,  0,  0,  0, 28,  0,  0,  0,
-  0,  0, 35,  0, 31,  0,  0,  0, 30,  0,  0,  0,  0,  0, 35,  0, 29,  0,  0,  0, 30,  0,  0,  0,  0,  0, 35,  0, 34,  0,  0,  0,
- 33,  0,  0,  0,  0,  0, 35,  0, 32,  0,  0,  0, 33,  0,  0,  0,  0,  0, 35,  0, 35,  0,  0,  0, 32,  0,  0,  0,  0,  0, 35,  0,
- 34,  0,  0,  0, 35,  0,  0,  0,  0,  0, 35,  0, 68, 65, 84, 65,104,  1,  0,  0,184,212, 55,  3,  0,  0,  0,  0, 84,  1,  0,  0,
-  5,  0,  0,  0,  4,  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, 86, 84,101,120,  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,104,214, 55,  3,  0,  0,  0,  0,  5,  0,  0,  0, 20,  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, 85, 86, 84,101,120,  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,104,215, 55,  3,  0,  0,  0,  0,  6,  0,  0,  0, 64,  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, 67,111,108,  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,104,217, 55,  3,  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,  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, 68, 65, 84, 65, 16,  0,  0,  0,168,140,198,  4,  0,  0,  0,  0, 60,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 68, 65, 84, 65, 12,  0,  0,  0,104, 43,196,  4,
+  0,  0,  0,  0, 58,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  2,  0, 77, 69,  0,  0,232,  4,  0,  0,
+  8,157,198,  4,  0,  0,  0,  0, 50,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 56,142,198,  4,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 69, 67,117, 98,101,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0, 56,162,198,  4,  0,  0,  0,  0,136,119,198,  4,  0,  0,  0,  0, 24,120,198,  4,  0,  0,  0,  0,
+ 40, 36, 27,  4,  0,  0,  0,  0,168,108, 27,  4,  0,  0,  0,  0, 24,110, 27,  4,  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,216,164,198,  4,  0,  0,  0,  0, 24,168,198,  4,  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, 68, 65, 84, 65,180,  0,  0,  0,104,214, 55,  3,  0,  0,  0,  0, 48,  0,  0,  0,
-  9,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  7,  0,  0,  0,  4,  0,  0,  0,
-  5,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  8,  0,  0,  0, 11,  0,  0,  0, 10,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
- 15,  0,  0,  0, 12,  0,  0,  0, 13,  0,  0,  0, 14,  0,  0,  0,  0,  0,  0,  0, 16,  0,  0,  0, 19,  0,  0,  0, 18,  0,  0,  0,
- 17,  0,  0,  0,  0,  0,  0,  0, 20,  0,  0,  0, 23,  0,  0,  0, 22,  0,  0,  0, 21,  0,  0,  0,  0,  0,  0,  0, 27,  0,  0,  0,
- 24,  0,  0,  0, 25,  0,  0,  0, 26,  0,  0,  0,  0,  0,  0,  0, 31,  0,  0,  0, 28,  0,  0,  0, 29,  0,  0,  0, 30,  0,  0,  0,
-  0,  0,  0,  2, 32,  0,  0,  0, 35,  0,  0,  0, 34,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0,  2, 68, 65, 84, 65,176,  1,  0,  0,
-104,215, 55,  3,  0,  0,  0,  0, 59,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  3,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  3,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  3,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  3,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  3,  0,  0,  0,  0,  0,
- 68, 65, 84, 65,144,  0,  0,  0,104,217, 55,  3,  0,  0,  0,  0, 53,  0,  0,  0, 36,  0,  0,  0,255,255,255,255,255,255,255,255,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,136,162,198,  4,  0,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255, 77, 69,  0,  0,152,  1,  0,  0, 72,218, 55,  3,  0,  0,  0,  0, 46,  0,  0,  0,  1,  0,  0,  0,
-232,227, 55,  3,  0,  0,  0,  0,  8,202, 55,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 77, 69,112,114,101,118,105,101,119, 46, 48, 48, 52,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,  5,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+200,165,198,  4,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,  0,  0,  0,  0,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  1,  0,  0,  0,  5,  0,  0,  0, 12,  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,  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, 40,220, 55,  3,  0,  0,  0,  0,168,226, 55,  3,  0,  0,  0,  0,  8,227, 55,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 40,222, 55,  3,  0,  0,  0,  0,120,224, 55,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-136,227, 55,  3,  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,120,220, 55,  3,  0,  0,  0,  0,  1,  0,  0,  0,  5,  0,  0,  0, 24,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200,222, 55,  3,  0,  0,  0,  0,  1,  0,  0,  0,  5,  0,  0,  0,
- 12,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,248,224, 55,  3,  0,  0,  0,  0,
-  3,  0,  0,  0,  5,  0,  0,  0, 80,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  4,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,179,  0,  0, 64, 52,  0,  0,192, 28,
-  0,  0,128, 63,  2,  0,128, 63,172,197, 39, 55,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0, 67,  0, 30,  0,  4,  0,
-  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  8,  0,  0,  0,
- 40,220, 55,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 24, 16, 52,  3,  0,  0,  0,  0, 68, 65, 84, 65,104,  1,  0,  0,
-120,220, 55,  3,  0,  0,  0,  0, 84,  1,  0,  0,  5,  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,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40,222, 55,  3,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,
+120,153,198,  4,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,  1,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  2,  0,  0,  0,  5,  0,  0,  0, 28,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 88,106, 27,  4,  0,  0,  0,  0,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  0,  0,  0,  0,  1,  0,  0,  0,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  2,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  3,  0,  0,  0,  5,  0,  0,  0, 24,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  8,  0,  0,  0, 12,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0, 24,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 51,
+  0,  0,  0,180,  0,  0,  0,  0,  4,  0,128, 63,  4,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0, 67,  0, 30,  0,  4,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  8,  0,  0,  0,
+ 56,162,198,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,120,164, 26,  4,  0,  0,  0,  0, 68, 65, 84, 65,  8,  2,  0,  0,
+136,162,198,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  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,  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,216,164,198,  4,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 80,  0,  0,  0,
- 40,222, 55,  3,  0,  0,  0,  0, 52,  0,  0,  0,  4,  0,  0,  0, 50, 49,175, 64,255,255,127, 63, 28,159,152, 51,  0,  0,  0,  0,
-255,127,  3,  0, 50, 49,175, 64,  0,  0,128,191, 33,159,152,179,  0,  0,  0,  0,255,127,  3,  0, 50, 49,175,192,252,255,127,191,
- 31,159,152,179,  0,  0,  0,  0,255,127,  3,  0, 45, 49,175,192,  4,  0,128, 63, 33,159,152, 51,  0,  0,  0,  0,255,127,  3,  0,
- 68, 65, 84, 65,104,  1,  0,  0,200,222, 55,  3,  0,  0,  0,  0, 84,  1,  0,  0,  5,  0,  0,  0,  3,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,120,224, 55,  3,  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,  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,
@@ -13515,398 +15774,416 @@ char datatoc_preview_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0,
+216,164,198,  4,  0,  0,  0,  0, 56,  0,  0,  0,  8,  0,  0,  0,  0,  0,128, 63,255,255,127, 63,  0,  0,128,191,230, 73,230, 73,
+ 26,182,  3,  0,  0,  0,128, 63,  0,  0,128,191,  0,  0,128,191,230, 73, 26,182, 26,182,  3,  0,  1,  0,128,191,253,255,127,191,
+  0,  0,128,191, 26,182, 26,182, 26,182,  3,  0,250,255,127,191,  3,  0,128, 63,  0,  0,128,191, 26,182,230, 73, 26,182,  3,  0,
+  4,  0,128, 63,247,255,127, 63,  0,  0,128, 63,230, 73,230, 73,230, 73,  3,  0,245,255,127, 63,  5,  0,128,191,  0,  0,128, 63,
+230, 73, 26,182,230, 73,  3,  0,  3,  0,128,191,250,255,127,191,  0,  0,128, 63, 26,182, 26,182,230, 73,  3,  0,255,255,127,191,
+  0,  0,128, 63,  0,  0,128, 63, 26,182,230, 73,230, 73,  3,  0, 68, 65, 84, 65,  8,  2,  0,  0,200,165,198,  4,  0,  0,  0,  0,
+124,  1,  0,  0,  5,  0,  0,  0,  3,  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,  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,
- 68, 65, 84, 65, 48,  0,  0,  0,120,224, 55,  3,  0,  0,  0,  0, 49,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,  2,  0,  0,  0,
-  0,  0, 35,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0, 35,  0,  2,  0,  0,  0,
-  3,  0,  0,  0,  0,  0, 35,  0, 68, 65, 84, 65,104,  1,  0,  0,248,224, 55,  3,  0,  0,  0,  0, 84,  1,  0,  0,  5,  0,  0,  0,
-  4,  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, 86, 84,101,120,  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,
-168,226, 55,  3,  0,  0,  0,  0,  5,  0,  0,  0, 20,  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, 85, 86, 84,101,120,  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,  8,227, 55,  3,  0,  0,  0,  0,  6,  0,  0,  0, 64,  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, 67,111,108,  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,136,227, 55,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 24,168,198,  4,  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,  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,  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,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,168,226, 55,  3,  0,  0,  0,  0, 48,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  3,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  2, 68, 65, 84, 65, 48,  0,  0,  0,  8,227, 55,  3,
-  0,  0,  0,  0, 59,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 16,  0,  0,  0,136,227, 55,  3,  0,  0,  0,  0, 53,  0,  0,  0,  4,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255, 77, 69,  0,  0,152,  1,  0,  0,232,227, 55,  3,  0,  0,  0,  0, 46,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 72,218, 55,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 69, 67,117,
- 98,101,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,200,229, 55,  3,  0,  0,  0,  0,248,236, 55,  3,  0,  0,  0,  0,184,237, 55,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,200,231, 55,  3,  0,  0,  0,  0,104,234, 55,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40,239, 55,  3,
   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, 24,230, 55,  3,  0,  0,  0,  0,  1,  0,  0,  0,  5,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,184,232, 55,  3,  0,  0,  0,  0,  1,  0,  0,  0,  5,  0,  0,  0, 12,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72,235, 55,  3,  0,  0,  0,  0,  3,  0,  0,  0,
-  5,  0,  0,  0, 80,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,  0,  0,  0,
- 12,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 51,  0,  0,  0,180,  0,  0,  0,  0,  4,  0,128, 63,
-  4,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0, 67,  0, 30,  0,  4,  0,  0,  0,  0,  0,
-  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  8,  0,  0,  0,200,229, 55,  3,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,168,238, 51,  3,  0,  0,  0,  0, 68, 65, 84, 65,104,  1,  0,  0, 24,230, 55,  3,
-  0,  0,  0,  0, 84,  1,  0,  0,  5,  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,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200,231, 55,  3,  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,  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,  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,  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, 68, 65, 84, 65,144,  0,  0,  0, 24,168,198,  4,  0,  0,  0,  0,
+ 53,  0,  0,  0, 12,  0,  0,  0,  1,  0,  0,  0,  2,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0, 35,  0,
+  0,  0,  0,  0,  3,  0,  0,  0,  0,  0, 35,  0,  2,  0,  0,  0,  3,  0,  0,  0,  0,  0, 35,  0,  4,  0,  0,  0,  5,  0,  0,  0,
+  0,  0, 35,  0,  5,  0,  0,  0,  6,  0,  0,  0,  0,  0, 35,  0,  6,  0,  0,  0,  7,  0,  0,  0,  0,  0, 35,  0,  4,  0,  0,  0,
+  7,  0,  0,  0,  0,  0, 35,  0,  1,  0,  0,  0,  5,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0, 35,  0,
+  2,  0,  0,  0,  6,  0,  0,  0,  0,  0, 35,  0,  3,  0,  0,  0,  7,  0,  0,  0,  0,  0, 35,  0, 68, 65, 84, 65,  8,  2,  0,  0,
+ 88,106, 27,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  0,  0,  0, 16,  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, 85, 86, 84,101,120,  0, 97, 99,101, 45, 86,101,114,116,101,120,
   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,168,108, 27,  4,  0,  0,  0,  0, 17,  0,  0,  0, 12,  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, 67,111,108,  0, 32, 70, 97, 99,
+101, 45, 86,101,114,116,101,120,  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, 24,110, 27,  4,  0,  0,  0,  0,
+ 26,  0,  0,  0, 16,  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,
+ 78, 71,111,110, 32, 70, 97, 99,101, 45, 86,101,114,116,101,120,  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,
+ 40, 36, 27,  4,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0,200,231, 55,  3,
-  0,  0,  0,  0, 52,  0,  0,  0,  8,  0,  0,  0,  0,  0,128, 63,255,255,127, 63,  0,  0,128,191,230, 73,230, 73, 26,182,  3,  0,
-  0,  0,128, 63,  0,  0,128,191,  0,  0,128,191,230, 73, 26,182, 26,182,  3,  0,  1,  0,128,191,253,255,127,191,  0,  0,128,191,
- 26,182, 26,182, 26,182,  3,  0,250,255,127,191,  3,  0,128, 63,  0,  0,128,191, 26,182,230, 73, 26,182,  3,  0,  4,  0,128, 63,
-247,255,127, 63,  0,  0,128, 63,230, 73,230, 73,230, 73,  3,  0,245,255,127, 63,  5,  0,128,191,  0,  0,128, 63,230, 73, 26,182,
-230, 73,  3,  0,  3,  0,128,191,250,255,127,191,  0,  0,128, 63, 26,182, 26,182,230, 73,  3,  0,255,255,127,191,  0,  0,128, 63,
-  0,  0,128, 63, 26,182,230, 73,230, 73,  3,  0, 68, 65, 84, 65,104,  1,  0,  0,184,232, 55,  3,  0,  0,  0,  0, 84,  1,  0,  0,
-  5,  0,  0,  0,  3,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,104,234, 55,  3,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 32,  1,  0,  0,
+168,108, 27,  4,  0,  0,  0,  0, 61,  0,  0,  0, 24,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0, 68, 65, 84, 65, 96,  0,  0,  0, 24,110, 27,  4,  0,  0,  0,  0,
+ 62,  0,  0,  0, 24,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255, 68, 65, 84, 65,192,  0,  0,  0, 40, 36, 27,  4,  0,  0,  0,  0, 59,  0,  0,  0, 24,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  3,  0,  0,  0,  3,  0,  0,  0,  2,  0,  0,  0,
+  4,  0,  0,  0,  7,  0,  0,  0,  7,  0,  0,  0,  6,  0,  0,  0,  6,  0,  0,  0,  5,  0,  0,  0,  5,  0,  0,  0,  4,  0,  0,  0,
+  0,  0,  0,  0,  9,  0,  0,  0,  4,  0,  0,  0,  4,  0,  0,  0,  5,  0,  0,  0,  8,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  1,  0,  0,  0,  8,  0,  0,  0,  5,  0,  0,  0,  5,  0,  0,  0,  6,  0,  0,  0, 10,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,
+  2,  0,  0,  0, 10,  0,  0,  0,  6,  0,  0,  0,  6,  0,  0,  0,  7,  0,  0,  0, 11,  0,  0,  0,  3,  0,  0,  0,  3,  0,  0,  0,
+  4,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  3,  0,  0,  0, 11,  0,  0,  0,  7,  0,  0,  0,  7,  0,  0,  0,
+ 68, 65, 84, 65,  8,  2,  0,  0,120,153,198,  4,  0,  0,  0,  0,124,  1,  0,  0,  5,  0,  0,  0, 15,  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, 85, 86, 84,101,120,  0, 97, 99,
+101,  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,  0,  0,  0,  0,  0, 24,120,198,  4,  0,  0,  0,  0,
+ 25,  0,  0,  0, 16,  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,
+ 78, 71,111,110, 32, 70, 97, 99,101,  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,  0,  0,  0,  0,  0,
+136,119,198,  4,  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,  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,  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,  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, 68, 65, 84, 65,144,  0,  0,  0,104,234, 55,  3,  0,  0,  0,  0, 49,  0,  0,  0,
- 12,  0,  0,  0,  1,  0,  0,  0,  2,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0,  0,
-  3,  0,  0,  0,  0,  0, 35,  0,  2,  0,  0,  0,  3,  0,  0,  0,  0,  0, 35,  0,  4,  0,  0,  0,  5,  0,  0,  0,  0,  0, 35,  0,
-  5,  0,  0,  0,  6,  0,  0,  0,  0,  0, 35,  0,  6,  0,  0,  0,  7,  0,  0,  0,  0,  0, 35,  0,  4,  0,  0,  0,  7,  0,  0,  0,
-  0,  0, 35,  0,  1,  0,  0,  0,  5,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0, 35,  0,  2,  0,  0,  0,
-  6,  0,  0,  0,  0,  0, 35,  0,  3,  0,  0,  0,  7,  0,  0,  0,  0,  0, 35,  0, 68, 65, 84, 65,104,  1,  0,  0, 72,235, 55,  3,
-  0,  0,  0,  0, 84,  1,  0,  0,  5,  0,  0,  0,  4,  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,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,248,236, 55,  3,  0,  0,  0,  0,  5,  0,  0,  0, 20,  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, 85, 86, 84,101,120,  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,184,237, 55,  3,  0,  0,  0,  0,  6,  0,  0,  0,
- 64,  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, 67,111,108,  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, 40,239, 55,  3,
   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,  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,
+ 68, 65, 84, 65, 96,  0,  0,  0, 24,120,198,  4,  0,  0,  0,  0, 60,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 68, 65, 84, 65, 72,  0,  0,  0,
+136,119,198,  4,  0,  0,  0,  0, 58,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  2,  0,  4,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  2,  0,  8,  0,  0,  0,  4,  0,  0,  0,  0,  0,  2,  0, 12,  0,  0,  0,  4,  0,  0,  0,  0,  0,  2,  0,
+ 16,  0,  0,  0,  4,  0,  0,  0,  0,  0,  2,  0, 20,  0,  0,  0,  4,  0,  0,  0,  0,  0,  2,  0, 80, 65,  0,  0, 16,  3,  0,  0,
+ 40,174,198,  4,  0,  0,  0,  0,136,  1,  0,  0,  1,  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, 80, 65, 80, 83,121,115,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,120,  0,  0,  0,248,236, 55,  3,
-  0,  0,  0,  0, 48,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  2,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  2,
-  4,  0,  0,  0,  7,  0,  0,  0,  6,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  4,  0,  0,  0,  5,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  2,  1,  0,  0,  0,  5,  0,  0,  0,  6,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  2,  2,  0,  0,  0,
-  6,  0,  0,  0,  7,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  2,  4,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  7,  0,  0,  0,
-  0,  0,  0,  2, 68, 65, 84, 65, 32,  1,  0,  0,184,237, 55,  3,  0,  0,  0,  0, 59,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 96,  0,  0,  0, 40,239, 55,  3,  0,  0,  0,  0, 53,  0,  0,  0, 24,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
-255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 80, 65,  0,  0,208,  2,  0,  0,216,239, 55,  3,
-  0,  0,  0,  0, 96,  1,  0,  0,  1,  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, 80, 65, 80, 83,121,115,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  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,248,242, 55,  3,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  2,  0,  1,  0,
-  0,  0,  0,  0,  1,  0,  2,  0,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,  4,  0,  6,  0,  8,  0,
-  5,  0,  5,  0,  3,  0,100,  0,  1,  0,  0,  0,  0,  0,  1,  0,  0,  0,  2,  0,  3,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128,  7,  0,  0,128, 63,205,204,204, 61,205,204, 76, 63,  0,  0,128, 63,  0,  0,200, 66,  0,  0, 72, 66,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,150,  0,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0,  0,  0,  0,  0,
-128, 41,182, 63,  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,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,240,214, 35,189,  0,  0,  0,  0,184,155,196,189,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,205,204, 76, 62,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,205,204, 76, 62,  0,  0,  0, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  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, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,
+136,177,198,  4,  0,  0,  0,  0,  2,  2,  0,  0,  0,  0,  0,  0,  2,  0,  1,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0,  0,  0,
+  0,  0, 10,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,  4,  0,  6,  0,  8,  0,  5,  0,  5,  0,  3,  0,100,  0,  1,  0,  0,  0,
+  0,  0,  1,  0,  0,  0,  2,  0,  3,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,  7,  0,  0,128, 63,205,204,204, 61,
+205,204, 76, 63,  0,  0,128, 63,  0,  0,200, 66,  0,  0, 72, 66,  0,  0,  0,  0,  0,  0,128, 63,205,204, 76, 62,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,150,  0,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,128, 41,182, 63,  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,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,240,214, 35,189,  0,  0,  0,  0,184,155,196,189,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,205,204, 76, 62,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,205,204, 76, 62,  0,  0,  0, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  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, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
   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,  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,  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,  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, 68, 65, 84, 65,
- 72,  0,  0,  0,248,242, 55,  3,  0,  0,  0,  0,120,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 72,  0,  0,  0,136,177,198,  4,  0,  0,  0,  0,133,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
   0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 60, 85, 32, 60,  0,  0,  0,  0,  0,  0,  0,  0, 68, 78, 65, 49,
-148,230,  0,  0, 56,212, 56,  3,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 83, 68, 78, 65, 78, 65, 77, 69, 10, 12,  0,  0,
- 42,110,101,120,116,  0, 42,112,114,101,118,  0, 42,100, 97,116, 97,  0, 42,102,105,114,115,116,  0, 42,108, 97,115,116,  0,120,
-  0,121,  0,120,109,105,110,  0,120,109, 97,120,  0,121,109,105,110,  0,121,109, 97,120,  0, 42,112,111,105,110,116,101,114,  0,
-103,114,111,117,112,  0,118, 97,108,  0,118, 97,108, 50,  0,116,121,112,101,  0,115,117, 98,116,121,112,101,  0,102,108, 97,103,
-  0,110, 97,109,101, 91, 51, 50, 93,  0,115, 97,118,101,100,  0,100, 97,116, 97,  0,108,101,110,  0,116,111,116, 97,108,108,101,
-110,  0, 42,110,101,119,105,100,  0, 42,108,105, 98,  0,110, 97,109,101, 91, 50, 52, 93,  0,117,115,  0,105, 99,111,110, 95,105,
-100,  0, 42,112,114,111,112,101,114,116,105,101,115,  0,105,100,  0, 42,105,100, 98,108,111, 99,107,  0, 42,102,105,108,101,100,
- 97,116, 97,  0,110, 97,109,101, 91, 50, 52, 48, 93,  0,102,105,108,101,112, 97,116,104, 91, 50, 52, 48, 93,  0,116,111,116,  0,
-112, 97,100,  0, 42,112, 97,114,101,110,116,  0,119, 91, 50, 93,  0,104, 91, 50, 93,  0, 99,104, 97,110,103,101,100, 91, 50, 93,
-  0, 99,104, 97,110,103,101,100, 95,116,105,109,101,115,116, 97,109,112, 91, 50, 93,  0, 42,114,101, 99,116, 91, 50, 93,  0, 42,
-111, 98,  0, 98,108,111, 99,107,116,121,112,101,  0, 97,100,114, 99,111,100,101,  0,110, 97,109,101, 91, 49, 50, 56, 93,  0, 42,
- 98,112,  0, 42, 98,101,122,116,  0,109, 97,120,114, 99,116,  0,116,111,116,114, 99,116,  0,118, 97,114,116,121,112,101,  0,116,
-111,116,118,101,114,116,  0,105,112,111,  0,101,120,116,114, 97,112,  0,114,116,  0, 98,105,116,109, 97,115,107,  0,115,108,105,
-100,101, 95,109,105,110,  0,115,108,105,100,101, 95,109, 97,120,  0, 99,117,114,118, 97,108,  0, 42,100,114,105,118,101,114,  0,
- 99,117,114,118,101,  0, 99,117,114,  0,115,104,111,119,107,101,121,  0,109,117,116,101,105,112,111,  0,112,111,115,  0,114,101,
-108, 97,116,105,118,101,  0,116,111,116,101,108,101,109,  0,112, 97,100, 50,  0, 42,119,101,105,103,104,116,115,  0,118,103,114,
-111,117,112, 91, 51, 50, 93,  0,115,108,105,100,101,114,109,105,110,  0,115,108,105,100,101,114,109, 97,120,  0, 42, 97,100,116,
-  0, 42,114,101,102,107,101,121,  0,101,108,101,109,115,116,114, 91, 51, 50, 93,  0,101,108,101,109,115,105,122,101,  0, 98,108,
-111, 99,107,  0, 42,105,112,111,  0, 42,102,114,111,109,  0,116,111,116,107,101,121,  0,115,108,117,114,112,104,  0, 42,108,105,
-110,101,  0, 42,102,111,114,109, 97,116,  0, 98,108,101,110,  0,108,105,110,101,110,111,  0,115,116, 97,114,116,  0,101,110,100,
-  0,112, 97,100, 49,  0,102,108, 97,103,115,  0, 99,111,108,111,114, 91, 52, 93,  0,112, 97,100, 91, 52, 93,  0, 42,110, 97,109,
-101,  0,110,108,105,110,101,115,  0,108,105,110,101,115,  0, 42, 99,117,114,108,  0, 42,115,101,108,108,  0, 99,117,114, 99,  0,
-115,101,108, 99,  0,109, 97,114,107,101,114,115,  0, 42,117,110,100,111, 95, 98,117,102,  0,117,110,100,111, 95,112,111,115,  0,
-117,110,100,111, 95,108,101,110,  0, 42, 99,111,109,112,105,108,101,100,  0,109,116,105,109,101,  0,115,105,122,101,  0,115,101,
-101,107,  0,100,116,120,  0,112, 97,115,115,101,112, 97,114,116, 97,108,112,104, 97,  0, 99,108,105,112,115,116, 97,  0, 99,108,
-105,112,101,110,100,  0,108,101,110,115,  0,111,114,116,104,111, 95,115, 99, 97,108,101,  0,100,114, 97,119,115,105,122,101,  0,
-115,104,105,102,116,120,  0,115,104,105,102,116,121,  0, 89, 70, 95,100,111,102,100,105,115,116,  0, 42,100,111,102, 95,111, 98,
-  0, 42,115, 99,101,110,101,  0,102,114, 97,109,101,110,114,  0,102,114, 97,109,101,115,  0,111,102,102,115,101,116,  0,115,102,
-114, 97,  0,102,105,101, 95,105,109, 97,  0, 99,121, 99,108,  0,111,107,  0,109,117,108,116,105, 95,105,110,100,101,120,  0,108,
- 97,121,101,114,  0,112, 97,115,115,  0,105, 98,117,102,115,  0, 42,103,112,117,116,101,120,116,117,114,101,  0, 42, 97,110,105,
-109,  0, 42,114,114,  0, 42,114,101,110,100,101,114,115, 91, 56, 93,  0,114,101,110,100,101,114, 95,115,108,111,116,  0,108, 97,
-115,116, 95,114,101,110,100,101,114, 95,115,108,111,116,  0,115,111,117,114, 99,101,  0,108, 97,115,116,102,114, 97,109,101,  0,
-116,112, 97,103,101,102,108, 97,103,  0,116,111,116, 98,105,110,100,  0,120,114,101,112,  0,121,114,101,112,  0,116,119,115,116,
- 97,  0,116,119,101,110,100,  0, 98,105,110,100, 99,111,100,101,  0, 42,114,101,112, 98,105,110,100,  0, 42,112, 97, 99,107,101,
-100,102,105,108,101,  0, 42,112,114,101,118,105,101,119,  0,108, 97,115,116,117,112,100, 97,116,101,  0,108, 97,115,116,117,115,
-101,100,  0, 97,110,105,109,115,112,101,101,100,  0,103,101,110, 95,120,  0,103,101,110, 95,121,  0,103,101,110, 95,116,121,112,
-101,  0, 97,115,112,120,  0, 97,115,112,121,  0,116,101,120, 99,111,  0,109, 97,112,116,111,  0,109, 97,112,116,111,110,101,103,
-  0, 98,108,101,110,100,116,121,112,101,  0, 42,111, 98,106,101, 99,116,  0, 42,116,101,120,  0,117,118,110, 97,109,101, 91, 51,
- 50, 93,  0,112,114,111,106,120,  0,112,114,111,106,121,  0,112,114,111,106,122,  0,109, 97,112,112,105,110,103,  0,111,102,115,
- 91, 51, 93,  0,115,105,122,101, 91, 51, 93,  0,114,111,116,  0,116,101,120,102,108, 97,103,  0, 99,111,108,111,114,109,111,100,
-101,108,  0,112,109, 97,112,116,111,  0,112,109, 97,112,116,111,110,101,103,  0,110,111,114,109, 97,112,115,112, 97, 99,101,  0,
-119,104,105, 99,104, 95,111,117,116,112,117,116,  0, 98,114,117,115,104, 95,109, 97,112, 95,109,111,100,101,  0,112, 97,100, 91,
- 55, 93,  0,114,  0,103,  0, 98,  0,107,  0,100,101,102, 95,118, 97,114,  0, 99,111,108,102, 97, 99,  0,118, 97,114,102, 97, 99,
-  0,110,111,114,102, 97, 99,  0,100,105,115,112,102, 97, 99,  0,119, 97,114,112,102, 97, 99,  0, 99,111,108,115,112,101, 99,102,
- 97, 99,  0,109,105,114,114,102, 97, 99,  0, 97,108,112,104, 97,102, 97, 99,  0,100,105,102,102,102, 97, 99,  0,115,112,101, 99,
-102, 97, 99,  0,101,109,105,116,102, 97, 99,  0,104, 97,114,100,102, 97, 99,  0,114, 97,121,109,105,114,114,102, 97, 99,  0,116,
-114, 97,110,115,108,102, 97, 99,  0, 97,109, 98,102, 97, 99,  0, 99,111,108,101,109,105,116,102, 97, 99,  0, 99,111,108,114,101,
-102,108,102, 97, 99,  0, 99,111,108,116,114, 97,110,115,102, 97, 99,  0,100,101,110,115,102, 97, 99,  0,115, 99, 97,116,116,101,
-114,102, 97, 99,  0,114,101,102,108,102, 97, 99,  0,116,105,109,101,102, 97, 99,  0,108,101,110,103,116,104,102, 97, 99,  0, 99,
-108,117,109,112,102, 97, 99,  0,100, 97,109,112,102, 97, 99,  0,107,105,110,107,102, 97, 99,  0,114,111,117,103,104,102, 97, 99,
-  0,112, 97,100,101,110,115,102, 97, 99,  0,103,114, 97,118,105,116,121,102, 97, 99,  0,108,105,102,101,102, 97, 99,  0,115,105,
-122,101,102, 97, 99,  0,105,118,101,108,102, 97, 99,  0,102,105,101,108,100,102, 97, 99,  0,115,104, 97,100,111,119,102, 97, 99,
-  0,122,101,110,117,112,102, 97, 99,  0,122,101,110,100,111,119,110,102, 97, 99,  0, 98,108,101,110,100,102, 97, 99,  0,110, 97,
-109,101, 91, 49, 54, 48, 93,  0, 42,104, 97,110,100,108,101,  0, 42,112,110, 97,109,101,  0, 42,115,116,110, 97,109,101,115,  0,
-115,116,121,112,101,115,  0,118, 97,114,115,  0, 42,118, 97,114,115,116,114,  0, 42,114,101,115,117,108,116,  0, 42, 99,102,114,
- 97,  0,100, 97,116, 97, 91, 51, 50, 93,  0, 40, 42,100,111,105,116, 41, 40, 41,  0, 40, 42,105,110,115,116, 97,110, 99,101, 95,
-105,110,105,116, 41, 40, 41,  0, 40, 42, 99, 97,108,108, 98, 97, 99,107, 41, 40, 41,  0,118,101,114,115,105,111,110,  0, 97,  0,
-105,112,111,116,121,112,101,  0, 42,105,109, 97,  0, 42, 99,117, 98,101, 91, 54, 93,  0,105,109, 97,116, 91, 52, 93, 91, 52, 93,
-  0,111, 98,105,109, 97,116, 91, 51, 93, 91, 51, 93,  0,115,116,121,112,101,  0,118,105,101,119,115, 99, 97,108,101,  0,110,111,
-116,108, 97,121,  0, 99,117, 98,101,114,101,115,  0,100,101,112,116,104,  0,114,101, 99, 97,108, 99,  0,108, 97,115,116,115,105,
-122,101,  0,102, 97,108,108,111,102,102, 95,116,121,112,101,  0,102, 97,108,108,111,102,102, 95,115,111,102,116,110,101,115,115,
-  0,114, 97,100,105,117,115,  0, 99,111,108,111,114, 95,115,111,117,114, 99,101,  0,116,111,116,112,111,105,110,116,115,  0,112,
-100,112, 97,100,  0,112,115,121,115,  0,112,115,121,115, 95, 99, 97, 99,104,101, 95,115,112, 97, 99,101,  0,111, 98, 95, 99, 97,
- 99,104,101, 95,115,112, 97, 99,101,  0, 42,112,111,105,110,116, 95,116,114,101,101,  0, 42,112,111,105,110,116, 95,100, 97,116,
- 97,  0,110,111,105,115,101, 95,115,105,122,101,  0,110,111,105,115,101, 95,100,101,112,116,104,  0,110,111,105,115,101, 95,105,
-110,102,108,117,101,110, 99,101,  0,110,111,105,115,101, 95, 98, 97,115,105,115,  0,112,100,112, 97,100, 51, 91, 51, 93,  0,110,
-111,105,115,101, 95,102, 97, 99,  0,115,112,101,101,100, 95,115, 99, 97,108,101,  0,102, 97,108,108,111,102,102, 95,115,112,101,
-101,100, 95,115, 99, 97,108,101,  0,112,100,112, 97,100, 50,  0, 42, 99,111, 98, 97,  0, 42,102, 97,108,108,111,102,102, 95, 99,
-117,114,118,101,  0,114,101,115,111,108, 91, 51, 93,  0,105,110,116,101,114,112, 95,116,121,112,101,  0,102,105,108,101, 95,102,
-111,114,109, 97,116,  0,101,120,116,101,110,100,  0,115,109,111,107,101,100, 95,116,121,112,101,  0,105,110,116, 95,109,117,108,
-116,105,112,108,105,101,114,  0,115,116,105,108,108, 95,102,114, 97,109,101,  0,115,111,117,114, 99,101, 95,112, 97,116,104, 91,
- 50, 52, 48, 93,  0, 42,100, 97,116, 97,115,101,116,  0, 99, 97, 99,104,101,100,102,114, 97,109,101,  0,110,111,105,115,101,115,
-105,122,101,  0,116,117,114, 98,117,108,  0, 98,114,105,103,104,116,  0, 99,111,110,116,114, 97,115,116,  0,115, 97,116,117,114,
- 97,116,105,111,110,  0,114,102, 97, 99,  0,103,102, 97, 99,  0, 98,102, 97, 99,  0,102,105,108,116,101,114,115,105,122,101,  0,
-109,103, 95, 72,  0,109,103, 95,108, 97, 99,117,110, 97,114,105,116,121,  0,109,103, 95,111, 99,116, 97,118,101,115,  0,109,103,
- 95,111,102,102,115,101,116,  0,109,103, 95,103, 97,105,110,  0,100,105,115,116, 95, 97,109,111,117,110,116,  0,110,115, 95,111,
-117,116,115, 99, 97,108,101,  0,118,110, 95,119, 49,  0,118,110, 95,119, 50,  0,118,110, 95,119, 51,  0,118,110, 95,119, 52,  0,
-118,110, 95,109,101,120,112,  0,118,110, 95,100,105,115,116,109,  0,118,110, 95, 99,111,108,116,121,112,101,  0,110,111,105,115,
-101,100,101,112,116,104,  0,110,111,105,115,101,116,121,112,101,  0,110,111,105,115,101, 98, 97,115,105,115,  0,110,111,105,115,
-101, 98, 97,115,105,115, 50,  0,105,109, 97,102,108, 97,103,  0, 99,114,111,112,120,109,105,110,  0, 99,114,111,112,121,109,105,
-110,  0, 99,114,111,112,120,109, 97,120,  0, 99,114,111,112,121,109, 97,120,  0,116,101,120,102,105,108,116,101,114,  0, 97,102,
-109, 97,120,  0,120,114,101,112,101, 97,116,  0,121,114,101,112,101, 97,116,  0, 99,104,101, 99,107,101,114,100,105,115,116,  0,
-110, 97, 98,108, 97,  0,105,117,115,101,114,  0, 42,110,111,100,101,116,114,101,101,  0, 42,112,108,117,103,105,110,  0, 42,101,
-110,118,  0, 42,112,100,  0, 42,118,100,  0,117,115,101, 95,110,111,100,101,115,  0,108,111, 99, 91, 51, 93,  0,114,111,116, 91,
- 51, 93,  0,109, 97,116, 91, 52, 93, 91, 52, 93,  0,109,105,110, 91, 51, 93,  0,109, 97,120, 91, 51, 93,  0,109,111,100,101,  0,
-116,111,116,101,120,  0,115,104,100,119,114,  0,115,104,100,119,103,  0,115,104,100,119, 98,  0,115,104,100,119,112, 97,100,  0,
-101,110,101,114,103,121,  0,100,105,115,116,  0,115,112,111,116,115,105,122,101,  0,115,112,111,116, 98,108,101,110,100,  0,104,
- 97,105,110,116,  0, 97,116,116, 49,  0, 97,116,116, 50,  0, 42, 99,117,114,102, 97,108,108,111,102,102,  0,115,104, 97,100,115,
-112,111,116,115,105,122,101,  0, 98,105, 97,115,  0,115,111,102,116,  0, 99,111,109,112,114,101,115,115,116,104,114,101,115,104,
-  0,112, 97,100, 53, 91, 51, 93,  0, 98,117,102,115,105,122,101,  0,115, 97,109,112,  0, 98,117,102,102,101,114,115,  0,102,105,
-108,116,101,114,116,121,112,101,  0, 98,117,102,102,108, 97,103,  0, 98,117,102,116,121,112,101,  0,114, 97,121, 95,115, 97,109,
-112,  0,114, 97,121, 95,115, 97,109,112,121,  0,114, 97,121, 95,115, 97,109,112,122,  0,114, 97,121, 95,115, 97,109,112, 95,116,
-121,112,101,  0, 97,114,101, 97, 95,115,104, 97,112,101,  0, 97,114,101, 97, 95,115,105,122,101,  0, 97,114,101, 97, 95,115,105,
-122,101,121,  0, 97,114,101, 97, 95,115,105,122,101,122,  0, 97,100, 97,112,116, 95,116,104,114,101,115,104,  0,114, 97,121, 95,
-115, 97,109,112, 95,109,101,116,104,111,100,  0,116,101,120, 97, 99,116,  0,115,104, 97,100,104, 97,108,111,115,116,101,112,  0,
-115,117,110, 95,101,102,102,101, 99,116, 95,116,121,112,101,  0,115,107,121, 98,108,101,110,100,116,121,112,101,  0,104,111,114,
-105,122,111,110, 95, 98,114,105,103,104,116,110,101,115,115,  0,115,112,114,101, 97,100,  0,115,117,110, 95, 98,114,105,103,104,
-116,110,101,115,115,  0,115,117,110, 95,115,105,122,101,  0, 98, 97, 99,107,115, 99, 97,116,116,101,114,101,100, 95,108,105,103,
-104,116,  0,115,117,110, 95,105,110,116,101,110,115,105,116,121,  0, 97,116,109, 95,116,117,114, 98,105,100,105,116,121,  0, 97,
-116,109, 95,105,110,115, 99, 97,116,116,101,114,105,110,103, 95,102, 97, 99,116,111,114,  0, 97,116,109, 95,101,120,116,105,110,
- 99,116,105,111,110, 95,102, 97, 99,116,111,114,  0, 97,116,109, 95,100,105,115,116, 97,110, 99,101, 95,102, 97, 99,116,111,114,
-  0,115,107,121, 98,108,101,110,100,102, 97, 99,  0,115,107,121, 95,101,120,112,111,115,117,114,101,  0,115,107,121, 95, 99,111,
-108,111,114,115,112, 97, 99,101,  0,112, 97,100, 52, 91, 54, 93,  0, 42,109,116,101,120, 91, 49, 56, 93,  0,112,114, 95,116,101,
-120,116,117,114,101,  0,112, 97,100, 54, 91, 54, 93,  0,100,101,110,115,105,116,121,  0,101,109,105,115,115,105,111,110,  0,115,
- 99, 97,116,116,101,114,105,110,103,  0,114,101,102,108,101, 99,116,105,111,110,  0,101,109,105,115,115,105,111,110, 95, 99,111,
-108, 91, 51, 93,  0,116,114, 97,110,115,109,105,115,115,105,111,110, 95, 99,111,108, 91, 51, 93,  0,114,101,102,108,101, 99,116,
-105,111,110, 95, 99,111,108, 91, 51, 93,  0,100,101,110,115,105,116,121, 95,115, 99, 97,108,101,  0,100,101,112,116,104, 95, 99,
-117,116,111,102,102,  0, 97,115,121,109,109,101,116,114,121,  0,115,116,101,112,115,105,122,101, 95,116,121,112,101,  0,115,104,
- 97,100,101,102,108, 97,103,  0,115,104, 97,100,101, 95,116,121,112,101,  0,112,114,101, 99, 97, 99,104,101, 95,114,101,115,111,
-108,117,116,105,111,110,  0,115,116,101,112,115,105,122,101,  0,109,115, 95,100,105,102,102,  0,109,115, 95,105,110,116,101,110,
-115,105,116,121,  0,109,115, 95,115,112,114,101, 97,100,  0,109, 97,116,101,114,105, 97,108, 95,116,121,112,101,  0,115,112,101,
- 99,114,  0,115,112,101, 99,103,  0,115,112,101, 99, 98,  0,109,105,114,114,  0,109,105,114,103,  0,109,105,114, 98,  0, 97,109,
- 98,114,  0, 97,109, 98, 98,  0, 97,109, 98,103,  0, 97,109, 98,  0,101,109,105,116,  0, 97,110,103,  0,115,112,101, 99,116,114,
- 97,  0,114, 97,121, 95,109,105,114,114,111,114,  0, 97,108,112,104, 97,  0,114,101,102,  0,115,112,101, 99,  0,122,111,102,102,
-115,  0, 97,100,100,  0,116,114, 97,110,115,108,117, 99,101,110, 99,121,  0,118,111,108,  0,102,114,101,115,110,101,108, 95,109,
-105,114,  0,102,114,101,115,110,101,108, 95,109,105,114, 95,105,  0,102,114,101,115,110,101,108, 95,116,114, 97,  0,102,114,101,
-115,110,101,108, 95,116,114, 97, 95,105,  0,102,105,108,116,101,114,  0,116,120, 95,108,105,109,105,116,  0,116,120, 95,102, 97,
-108,108,111,102,102,  0,114, 97,121, 95,100,101,112,116,104,  0,114, 97,121, 95,100,101,112,116,104, 95,116,114, 97,  0,104, 97,
-114,  0,115,101,101,100, 49,  0,115,101,101,100, 50,  0,103,108,111,115,115, 95,109,105,114,  0,103,108,111,115,115, 95,116,114,
- 97,  0,115, 97,109,112, 95,103,108,111,115,115, 95,109,105,114,  0,115, 97,109,112, 95,103,108,111,115,115, 95,116,114, 97,  0,
- 97,100, 97,112,116, 95,116,104,114,101,115,104, 95,109,105,114,  0, 97,100, 97,112,116, 95,116,104,114,101,115,104, 95,116,114,
- 97,  0, 97,110,105,115,111, 95,103,108,111,115,115, 95,109,105,114,  0,100,105,115,116, 95,109,105,114,  0,102, 97,100,101,116,
-111, 95,109,105,114,  0,115,104, 97,100,101, 95,102,108, 97,103,  0,109,111,100,101, 95,108,  0,102,108, 97,114,101, 99,  0,115,
-116, 97,114, 99,  0,108,105,110,101, 99,  0,114,105,110,103, 99,  0,104, 97,115,105,122,101,  0,102,108, 97,114,101,115,105,122,
-101,  0,115,117, 98,115,105,122,101,  0,102,108, 97,114,101, 98,111,111,115,116,  0,115,116,114, 97,110,100, 95,115,116, 97,  0,
-115,116,114, 97,110,100, 95,101,110,100,  0,115,116,114, 97,110,100, 95,101, 97,115,101,  0,115,116,114, 97,110,100, 95,115,117,
-114,102,110,111,114,  0,115,116,114, 97,110,100, 95,109,105,110,  0,115,116,114, 97,110,100, 95,119,105,100,116,104,102, 97,100,
-101,  0,115,116,114, 97,110,100, 95,117,118,110, 97,109,101, 91, 51, 50, 93,  0,115, 98,105, 97,115,  0,108, 98,105, 97,115,  0,
-115,104, 97,100, 95, 97,108,112,104, 97,  0,115,101,112,116,101,120,  0,114,103, 98,115,101,108,  0,112,114, 95,116,121,112,101,
-  0,112,114, 95, 98, 97, 99,107,  0,112,114, 95,108, 97,109,112,  0,109,108, 95,102,108, 97,103,  0,100,105,102,102, 95,115,104,
- 97,100,101,114,  0,115,112,101, 99, 95,115,104, 97,100,101,114,  0,114,111,117,103,104,110,101,115,115,  0,114,101,102,114, 97,
- 99,  0,112, 97,114, 97,109, 91, 52, 93,  0,114,109,115,  0,100, 97,114,107,110,101,115,115,  0, 42,114, 97,109,112, 95, 99,111,
-108,  0, 42,114, 97,109,112, 95,115,112,101, 99,  0,114, 97,109,112,105,110, 95, 99,111,108,  0,114, 97,109,112,105,110, 95,115,
-112,101, 99,  0,114, 97,109,112, 98,108,101,110,100, 95, 99,111,108,  0,114, 97,109,112, 98,108,101,110,100, 95,115,112,101, 99,
-  0,114, 97,109,112, 95,115,104,111,119,  0,112, 97,100, 51,  0,114, 97,109,112,102, 97, 99, 95, 99,111,108,  0,114, 97,109,112,
-102, 97, 99, 95,115,112,101, 99,  0, 42,103,114,111,117,112,  0,102,114,105, 99,116,105,111,110,  0,102,104,  0,114,101,102,108,
-101, 99,116,  0,102,104,100,105,115,116,  0,120,121,102,114,105, 99,116,  0,100,121,110, 97,109,111,100,101,  0,115,115,115, 95,
-114, 97,100,105,117,115, 91, 51, 93,  0,115,115,115, 95, 99,111,108, 91, 51, 93,  0,115,115,115, 95,101,114,114,111,114,  0,115,
-115,115, 95,115, 99, 97,108,101,  0,115,115,115, 95,105,111,114,  0,115,115,115, 95, 99,111,108,102, 97, 99,  0,115,115,115, 95,
-116,101,120,102, 97, 99,  0,115,115,115, 95,102,114,111,110,116,  0,115,115,115, 95, 98, 97, 99,107,  0,115,115,115, 95,102,108,
- 97,103,  0,115,115,115, 95,112,114,101,115,101,116,  0,109, 97,112,116,111, 95,116,101,120,116,117,114,101,100,  0,115,104, 97,
-100,111,119,111,110,108,121, 95,102,108, 97,103,  0,105,110,100,101,120,  0,103,112,117,109, 97,116,101,114,105, 97,108,  0,110,
- 97,109,101, 91, 50, 53, 54, 93,  0, 42, 98, 98,  0,105, 49,  0,106, 49,  0,107, 49,  0,105, 50,  0,106, 50,  0,107, 50,  0,115,
-101,108, 99,111,108, 49,  0,115,101,108, 99,111,108, 50,  0,122,  0,113,117, 97,116, 91, 52, 93,  0,101,120,112,120,  0,101,120,
-112,121,  0,101,120,112,122,  0,114, 97,100,  0,114, 97,100, 50,  0,115,  0, 42,109, 97,116,  0, 42,105,109, 97,116,  0,101,108,
-101,109,115,  0,100,105,115,112,  0, 42,101,100,105,116,101,108,101,109,115,  0, 42, 42,109, 97,116,  0,102,108, 97,103, 50,  0,
-116,111,116, 99,111,108,  0,119,105,114,101,115,105,122,101,  0,114,101,110,100,101,114,115,105,122,101,  0,116,104,114,101,115,
-104,  0, 42,108, 97,115,116,101,108,101,109,  0,118,101, 99, 91, 51, 93, 91, 51, 93,  0, 97,108,102, 97,  0,119,101,105,103,104,
-116,  0,104, 49,  0,104, 50,  0,102, 49,  0,102, 50,  0,102, 51,  0,104,105,100,101,  0,118,101, 99, 91, 52, 93,  0,109, 97,116,
- 95,110,114,  0,112,110,116,115,117,  0,112,110,116,115,118,  0,114,101,115,111,108,117,  0,114,101,115,111,108,118,  0,111,114,
-100,101,114,117,  0,111,114,100,101,114,118,  0,102,108, 97,103,117,  0,102,108, 97,103,118,  0, 42,107,110,111,116,115,117,  0,
- 42,107,110,111,116,115,118,  0,116,105,108,116, 95,105,110,116,101,114,112,  0,114, 97,100,105,117,115, 95,105,110,116,101,114,
-112,  0, 99,104, 97,114,105,100,120,  0,107,101,114,110,  0,119,  0,104,  0,110,117,114, 98,115,  0, 42,107,101,121,105,110,100,
-101,120,  0,115,104, 97,112,101,110,114,  0,110,117,114, 98,  0, 42,101,100,105,116,110,117,114, 98,  0, 42, 98,101,118,111, 98,
-106,  0, 42,116, 97,112,101,114,111, 98,106,  0, 42,116,101,120,116,111,110, 99,117,114,118,101,  0, 42,112, 97,116,104,  0, 42,
-107,101,121,  0, 98,101,118,  0,100,114, 97,119,102,108, 97,103,  0,116,119,105,115,116, 95,109,111,100,101,  0,116,119,105,115,
-116, 95,115,109,111,111,116,104,  0,115,109, 97,108,108, 99, 97,112,115, 95,115, 99, 97,108,101,  0,112, 97,116,104,108,101,110,
-  0, 98,101,118,114,101,115,111,108,  0,119,105,100,116,104,  0,101,120,116, 49,  0,101,120,116, 50,  0,114,101,115,111,108,117,
- 95,114,101,110,  0,114,101,115,111,108,118, 95,114,101,110,  0, 97, 99,116,110,117,  0, 42,108, 97,115,116,115,101,108,  0,115,
-112, 97, 99,101,109,111,100,101,  0,115,112, 97, 99,105,110,103,  0,108,105,110,101,100,105,115,116,  0,115,104,101, 97,114,  0,
-102,115,105,122,101,  0,119,111,114,100,115,112, 97, 99,101,  0,117,108,112,111,115,  0,117,108,104,101,105,103,104,116,  0,120,
-111,102,  0,121,111,102,  0,108,105,110,101,119,105,100,116,104,  0, 42,115,116,114,  0, 42,115,101,108, 98,111,120,101,115,  0,
- 42,101,100,105,116,102,111,110,116,  0,102, 97,109,105,108,121, 91, 50, 52, 93,  0, 42,118,102,111,110,116,  0, 42,118,102,111,
-110,116, 98,  0, 42,118,102,111,110,116,105,  0, 42,118,102,111,110,116, 98,105,  0,115,101,112, 99,104, 97,114,  0, 99,116,105,
-109,101,  0,116,111,116, 98,111,120,  0, 97, 99,116, 98,111,120,  0, 42,116, 98,  0,115,101,108,115,116, 97,114,116,  0,115,101,
-108,101,110,100,  0, 42,115,116,114,105,110,102,111,  0, 99,117,114,105,110,102,111,  0, 42,109,102, 97, 99,101,  0, 42,109,116,
-102, 97, 99,101,  0, 42,116,102, 97, 99,101,  0, 42,109,118,101,114,116,  0, 42,109,101,100,103,101,  0, 42,100,118,101,114,116,
-  0, 42,109, 99,111,108,  0, 42,109,115,116,105, 99,107,121,  0, 42,116,101,120, 99,111,109,101,115,104,  0, 42,109,115,101,108,
-101, 99,116,  0, 42,101,100,105,116, 95,109,101,115,104,  0,118,100, 97,116, 97,  0,101,100, 97,116, 97,  0,102,100, 97,116, 97,
-  0,116,111,116,101,100,103,101,  0,116,111,116,102, 97, 99,101,  0,116,111,116,115,101,108,101, 99,116,  0, 97, 99,116, 95,102,
- 97, 99,101,  0,115,109,111,111,116,104,114,101,115,104,  0,115,117, 98,100,105,118,  0,115,117, 98,100,105,118,114,  0,115,117,
- 98,115,117,114,102,116,121,112,101,  0,101,100,105,116,102,108, 97,103,  0, 42,109,114,  0, 42,112,118,  0, 42,116,112, 97,103,
-101,  0,117,118, 91, 52, 93, 91, 50, 93,  0, 99,111,108, 91, 52, 93,  0,116,114, 97,110,115,112,  0,116,105,108,101,  0,117,110,
-119,114, 97,112,  0,118, 49,  0,118, 50,  0,118, 51,  0,118, 52,  0,101,100, 99,111,100,101,  0, 99,114,101, 97,115,101,  0, 98,
-119,101,105,103,104,116,  0,100,101,102, 95,110,114,  0, 42,100,119,  0,116,111,116,119,101,105,103,104,116,  0, 99,111, 91, 51,
- 93,  0,110,111, 91, 51, 93,  0,117,118, 91, 50, 93,  0, 99,111, 91, 50, 93,  0,102,  0,105,  0,115, 91, 50, 53, 54, 93,  0,116,
-111,116,100,105,115,112,  0, 40, 42,100,105,115,112,115, 41, 40, 41,  0,118, 91, 52, 93,  0,109,105,100,  0,112, 97,100, 91, 50,
- 93,  0,118, 91, 50, 93,  0, 42,102, 97, 99,101,115,  0, 42, 99,111,108,102, 97, 99,101,115,  0, 42,101,100,103,101,115,  0, 42,
-118,101,114,116,115,  0,108,101,118,101,108,115,  0,108,101,118,101,108, 95, 99,111,117,110,116,  0, 99,117,114,114,101,110,116,
-  0,110,101,119,108,118,108,  0,101,100,103,101,108,118,108,  0,112,105,110,108,118,108,  0,114,101,110,100,101,114,108,118,108,
-  0,117,115,101, 95, 99,111,108,  0, 42,101,100,103,101, 95,102,108, 97,103,115,  0, 42,101,100,103,101, 95, 99,114,101, 97,115,
-101,115,  0, 42,118,101,114,116, 95,109, 97,112,  0, 42,101,100,103,101, 95,109, 97,112,  0, 42,111,108,100, 95,102, 97, 99,101,
-115,  0, 42,111,108,100, 95,101,100,103,101,115,  0,115,116, 97, 99,107,105,110,100,101,120,  0, 42,101,114,114,111,114,  0,109,
-111,100,105,102,105,101,114,  0, 42,116,101,120,116,117,114,101,  0, 42,109, 97,112, 95,111, 98,106,101, 99,116,  0,117,118,108,
- 97,121,101,114, 95,110, 97,109,101, 91, 51, 50, 93,  0,117,118,108, 97,121,101,114, 95,116,109,112,  0,116,101,120,109, 97,112,
-112,105,110,103,  0,115,117, 98,100,105,118, 84,121,112,101,  0,114,101,110,100,101,114, 76,101,118,101,108,115,  0, 42,101,109,
- 67, 97, 99,104,101,  0, 42,109, 67, 97, 99,104,101,  0,100,101,102, 97,120,105,115,  0,112, 97,100, 91, 54, 93,  0,108,101,110,
-103,116,104,  0,114, 97,110,100,111,109,105,122,101,  0,115,101,101,100,  0, 42,111, 98, 95, 97,114,109,  0, 42,115,116, 97,114,
-116, 95, 99, 97,112,  0, 42,101,110,100, 95, 99, 97,112,  0, 42, 99,117,114,118,101, 95,111, 98,  0, 42,111,102,102,115,101,116,
- 95,111, 98,  0,111,102,102,115,101,116, 91, 51, 93,  0,115, 99, 97,108,101, 91, 51, 93,  0,109,101,114,103,101, 95,100,105,115,
-116,  0,102,105,116, 95,116,121,112,101,  0,111,102,102,115,101,116, 95,116,121,112,101,  0, 99,111,117,110,116,  0, 97,120,105,
-115,  0,116,111,108,101,114, 97,110, 99,101,  0, 42,109,105,114,114,111,114, 95,111, 98,  0,115,112,108,105,116, 95, 97,110,103,
-108,101,  0,118, 97,108,117,101,  0,114,101,115,  0,118, 97,108, 95,102,108, 97,103,115,  0,108,105,109, 95,102,108, 97,103,115,
-  0,101, 95,102,108, 97,103,115,  0, 98,101,118,101,108, 95, 97,110,103,108,101,  0,100,101,102,103,114,112, 95,110, 97,109,101,
- 91, 51, 50, 93,  0, 42,100,111,109, 97,105,110,  0, 42,102,108,111,119,  0, 42, 99,111,108,108,  0,116,105,109,101,  0,112, 97,
-100, 49, 48,  0,115,116,114,101,110,103,116,104,  0,100,105,114,101, 99,116,105,111,110,  0,109,105,100,108,101,118,101,108,  0,
- 42,112,114,111,106,101, 99,116,111,114,115, 91, 49, 48, 93,  0, 42,105,109, 97,103,101,  0,110,117,109, 95,112,114,111,106,101,
- 99,116,111,114,115,  0, 97,115,112,101, 99,116,120,  0, 97,115,112,101, 99,116,121,  0,115, 99, 97,108,101,120,  0,115, 99, 97,
-108,101,121,  0,112,101,114, 99,101,110,116,  0,102, 97, 99,101, 67,111,117,110,116,  0,102, 97, 99,  0,114,101,112,101, 97,116,
-  0, 42,111, 98,106,101, 99,116, 99,101,110,116,101,114,  0,115,116, 97,114,116,120,  0,115,116, 97,114,116,121,  0,104,101,105,
-103,104,116,  0,110, 97,114,114,111,119,  0,115,112,101,101,100,  0,100, 97,109,112,  0,102, 97,108,108,111,102,102,  0,116,105,
-109,101,111,102,102,115,  0,108,105,102,101,116,105,109,101,  0,100,101,102,111,114,109,102,108, 97,103,  0,109,117,108,116,105,
-  0, 42,112,114,101,118, 67,111,115,  0,115,117, 98,116, 97,114,103,101,116, 91, 51, 50, 93,  0,112, 97,114,101,110,116,105,110,
-118, 91, 52, 93, 91, 52, 93,  0, 99,101,110,116, 91, 51, 93,  0, 42,105,110,100,101,120, 97,114,  0,116,111,116,105,110,100,101,
-120,  0,102,111,114, 99,101,  0, 42, 99,108,111,116,104, 79, 98,106,101, 99,116,  0, 42,115,105,109, 95,112, 97,114,109,115,  0,
- 42, 99,111,108,108, 95,112, 97,114,109,115,  0, 42,112,111,105,110,116, 95, 99, 97, 99,104,101,  0,112,116, 99, 97, 99,104,101,
-115,  0, 42,120,  0, 42,120,110,101,119,  0, 42,120,111,108,100,  0, 42, 99,117,114,114,101,110,116, 95,120,110,101,119,  0, 42,
- 99,117,114,114,101,110,116, 95,120,  0, 42, 99,117,114,114,101,110,116, 95,118,  0, 42,109,102, 97, 99,101,115,  0,110,117,109,
-118,101,114,116,115,  0,110,117,109,102, 97, 99,101,115,  0,116,105,109,101, 95,120,  0,116,105,109,101, 95,120,110,101,119,  0,
- 42, 98,118,104,116,114,101,101,  0, 42,118,  0, 42,100,109,  0, 99,102,114, 97,  0,111,112,101,114, 97,116,105,111,110,  0,118,
-101,114,116,101,120,  0,116,111,116,105,110,102,108,117,101,110, 99,101,  0,103,114,105,100,115,105,122,101,  0, 42, 98,105,110,
-100,105,110,102,108,117,101,110, 99,101,115,  0, 42, 98,105,110,100,111,102,102,115,101,116,115,  0, 42, 98,105,110,100, 99, 97,
-103,101, 99,111,115,  0,116,111,116, 99, 97,103,101,118,101,114,116,  0, 42,100,121,110,103,114,105,100,  0, 42,100,121,110,105,
-110,102,108,117,101,110, 99,101,115,  0, 42,100,121,110,118,101,114,116,115,  0, 42,112, 97,100, 50,  0,100,121,110,103,114,105,
-100,115,105,122,101,  0,100,121,110, 99,101,108,108,109,105,110, 91, 51, 93,  0,100,121,110, 99,101,108,108,119,105,100,116,104,
-  0, 98,105,110,100,109, 97,116, 91, 52, 93, 91, 52, 93,  0, 42, 98,105,110,100,119,101,105,103,104,116,115,  0, 42, 98,105,110,
-100, 99,111,115,  0, 40, 42, 98,105,110,100,102,117,110, 99, 41, 40, 41,  0, 42,112,115,121,115,  0,116,111,116,100,109,118,101,
-114,116,  0,116,111,116,100,109,101,100,103,101,  0,116,111,116,100,109,102, 97, 99,101,  0,112,111,115,105,116,105,111,110,  0,
-114, 97,110,100,111,109, 95,112,111,115,105,116,105,111,110,  0, 42,102, 97, 99,101,112, 97,  0,118,103,114,111,117,112,  0,112,
-114,111,116,101, 99,116,  0,108,118,108,  0,115, 99,117,108,112,116,108,118,108,  0,116,111,116,108,118,108,  0,115,105,109,112,
-108,101,  0, 42,102,115,115,  0, 42,116, 97,114,103,101,116,  0, 42, 97,117,120, 84, 97,114,103,101,116,  0,118,103,114,111,117,
-112, 95,110, 97,109,101, 91, 51, 50, 93,  0,107,101,101,112, 68,105,115,116,  0,115,104,114,105,110,107, 84,121,112,101,  0,115,
-104,114,105,110,107, 79,112,116,115,  0,112,114,111,106, 65,120,105,115,  0,115,117, 98,115,117,114,102, 76,101,118,101,108,115,
-  0, 42,111,114,105,103,105,110,  0,102, 97, 99,116,111,114,  0,108,105,109,105,116, 91, 50, 93,  0,111,114,105,103,105,110, 79,
-112,116,115,  0,111,102,102,115,101,116, 95,102, 97, 99,  0, 99,114,101, 97,115,101, 95,105,110,110,101,114,  0, 99,114,101, 97,
-115,101, 95,111,117,116,101,114,  0, 99,114,101, 97,115,101, 95,114,105,109,  0,109, 97,116, 95,111,102,115,  0,109, 97,116, 95,
-111,102,115, 95,114,105,109,  0, 42,111, 98, 95, 97,120,105,115,  0,115,116,101,112,115,  0,114,101,110,100,101,114, 95,115,116,
-101,112,115,  0,105,116,101,114,  0,115, 99,114,101,119, 95,111,102,115,  0, 97,110,103,108,101,  0, 42,111, 98,106,101, 99,116,
- 95,102,114,111,109,  0, 42,111, 98,106,101, 99,116, 95,116,111,  0,102, 97,108,108,111,102,102, 95,114, 97,100,105,117,115,  0,
- 42,108, 97,116,116,  0,112,110,116,115,119,  0,111,112,110,116,115,117,  0,111,112,110,116,115,118,  0,111,112,110,116,115,119,
-  0,116,121,112,101,117,  0,116,121,112,101,118,  0,116,121,112,101,119,  0,102,117,  0,102,118,  0,102,119,  0,100,117,  0,100,
-118,  0,100,119,  0, 42,100,101,102,  0, 42,108, 97,116,116,105, 99,101,100, 97,116, 97,  0,108, 97,116,109, 97,116, 91, 52, 93,
- 91, 52, 93,  0, 42,101,100,105,116,108, 97,116,116,  0,118,101, 99, 91, 56, 93, 91, 51, 93,  0, 42,115, 99,117,108,112,116,  0,
-112, 97,114,116,121,112,101,  0,112, 97,114, 49,  0,112, 97,114, 50,  0,112, 97,114, 51,  0,112, 97,114,115,117, 98,115,116,114,
- 91, 51, 50, 93,  0, 42,116,114, 97, 99,107,  0, 42,112,114,111,120,121,  0, 42,112,114,111,120,121, 95,103,114,111,117,112,  0,
- 42,112,114,111,120,121, 95,102,114,111,109,  0, 42, 97, 99,116,105,111,110,  0, 42,112,111,115,101,108,105, 98,  0, 42,112,111,
-115,101,  0, 42,103,112,100,  0, 97,118,115,  0, 42,109,112, 97,116,104,  0, 99,111,110,115,116,114, 97,105,110,116, 67,104, 97,
-110,110,101,108,115,  0,101,102,102,101, 99,116,  0,100,101,102, 98, 97,115,101,  0,109,111,100,105,102,105,101,114,115,  0,114,
-101,115,116,111,114,101, 95,109,111,100,101,  0, 42,109, 97,116, 98,105,116,115,  0, 97, 99,116, 99,111,108,  0,100,108,111, 99,
- 91, 51, 93,  0,111,114,105,103, 91, 51, 93,  0,100,115,105,122,101, 91, 51, 93,  0,100,114,111,116, 91, 51, 93,  0,100,113,117,
- 97,116, 91, 52, 93,  0,114,111,116, 65,120,105,115, 91, 51, 93,  0,100,114,111,116, 65,120,105,115, 91, 51, 93,  0,114,111,116,
- 65,110,103,108,101,  0,100,114,111,116, 65,110,103,108,101,  0,111, 98,109, 97,116, 91, 52, 93, 91, 52, 93,  0, 99,111,110,115,
-116,105,110,118, 91, 52, 93, 91, 52, 93,  0,105,109, 97,116, 95,114,101,110, 91, 52, 93, 91, 52, 93,  0,108, 97,121,  0, 99,111,
-108, 98,105,116,115,  0,116,114, 97,110,115,102,108, 97,103,  0,112,114,111,116,101, 99,116,102,108, 97,103,  0,116,114, 97, 99,
-107,102,108, 97,103,  0,117,112,102,108, 97,103,  0,110,108, 97,102,108, 97,103,  0,105,112,111,102,108, 97,103,  0,105,112,111,
-119,105,110,  0,115, 99, 97,102,108, 97,103,  0,115, 99, 97,118,105,115,102,108, 97,103,  0, 98,111,117,110,100,116,121,112,101,
-  0,100,117,112,111,110,  0,100,117,112,111,102,102,  0,100,117,112,115,116, 97,  0,100,117,112,101,110,100,  0,115,102,  0,109,
- 97,115,115,  0,100, 97,109,112,105,110,103,  0,105,110,101,114,116,105, 97,  0,102,111,114,109,102, 97, 99,116,111,114,  0,114,
-100, 97,109,112,105,110,103,  0,109, 97,114,103,105,110,  0,109, 97,120, 95,118,101,108,  0,109,105,110, 95,118,101,108,  0,109,
- 95, 99,111,110,116, 97, 99,116, 80,114,111, 99,101,115,115,105,110,103, 84,104,114,101,115,104,111,108,100,  0,114,111,116,109,
-111,100,101,  0,100,116,  0,101,109,112,116,121, 95,100,114, 97,119,116,121,112,101,  0,112, 97,100, 49, 91, 51, 93,  0,101,109,
-112,116,121, 95,100,114, 97,119,115,105,122,101,  0,100,117,112,102, 97, 99,101,115, 99, 97,  0,112,114,111,112,  0,115,101,110,
-115,111,114,115,  0, 99,111,110,116,114,111,108,108,101,114,115,  0, 97, 99,116,117, 97,116,111,114,115,  0, 98, 98,115,105,122,
-101, 91, 51, 93,  0, 97, 99,116,100,101,102,  0,103, 97,109,101,102,108, 97,103,  0,103, 97,109,101,102,108, 97,103, 50,  0, 42,
- 98,115,111,102,116,  0,115,111,102,116,102,108, 97,103,  0, 97,110,105,115,111,116,114,111,112,105, 99, 70,114,105, 99,116,105,
-111,110, 91, 51, 93,  0, 99,111,110,115,116,114, 97,105,110,116,115,  0,110,108, 97,115,116,114,105,112,115,  0,104,111,111,107,
-115,  0,112, 97,114,116,105, 99,108,101,115,121,115,116,101,109,  0, 42,115,111,102,116,  0, 42,100,117,112, 95,103,114,111,117,
-112,  0,102,108,117,105,100,115,105,109, 70,108, 97,103,  0,114,101,115,116,114,105, 99,116,102,108, 97,103,  0,115,104, 97,112,
-101,102,108, 97,103,  0,114,101, 99, 97,108, 99,111,  0, 98,111,100,121, 95,116,121,112,101,  0, 42,102,108,117,105,100,115,105,
-109, 83,101,116,116,105,110,103,115,  0, 42,100,101,114,105,118,101,100, 68,101,102,111,114,109,  0, 42,100,101,114,105,118,101,
-100, 70,105,110, 97,108,  0,108, 97,115,116, 68, 97,116, 97, 77, 97,115,107,  0, 99,117,115,116,111,109,100, 97,116, 97, 95,109,
- 97,115,107,  0,115,116, 97,116,101,  0,105,110,105,116, 95,115,116, 97,116,101,  0,103,112,117,108, 97,109,112,  0,112, 99, 95,
-105,100,115,  0, 42,100,117,112,108,105,108,105,115,116,  0,105,109, 97, 95,111,102,115, 91, 50, 93,  0,112, 97,100, 51, 91, 56,
- 93,  0, 99,117,114,105,110,100,101,120,  0, 97, 99,116,105,118,101,  0,111,114,105,103,108, 97,121,  0,110,111, 95,100,114, 97,
-119,  0, 97,110,105,109, 97,116,101,100,  0,111,109, 97,116, 91, 52, 93, 91, 52, 93,  0,111,114, 99,111, 91, 51, 93,  0,100,101,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 60, 85, 32, 60,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 78, 65, 49,144,  4,  1,  0,184, 21, 22,  4,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 83, 68, 78, 65, 78, 65, 77, 69,
+ 58, 13,  0,  0, 42,110,101,120,116,  0, 42,112,114,101,118,  0, 42,100, 97,116, 97,  0, 42,102,105,114,115,116,  0, 42,108, 97,
+115,116,  0,120,  0,121,  0,122,  0,120,109,105,110,  0,120,109, 97,120,  0,121,109,105,110,  0,121,109, 97,120,  0, 42,112,111,
+105,110,116,101,114,  0,103,114,111,117,112,  0,118, 97,108,  0,118, 97,108, 50,  0,116,121,112,101,  0,115,117, 98,116,121,112,
+101,  0,102,108, 97,103,  0,110, 97,109,101, 91, 54, 52, 93,  0,115, 97,118,101,100,  0,100, 97,116, 97,  0,108,101,110,  0,116,
+111,116, 97,108,108,101,110,  0, 42,110,101,119,105,100,  0, 42,108,105, 98,  0,110, 97,109,101, 91, 54, 54, 93,  0,112, 97,100,
+  0,117,115,  0,105, 99,111,110, 95,105,100,  0,112, 97,100, 50,  0, 42,112,114,111,112,101,114,116,105,101,115,  0,105,100,  0,
+ 42,105,100, 98,108,111, 99,107,  0, 42,102,105,108,101,100, 97,116, 97,  0,110, 97,109,101, 91, 49, 48, 50, 52, 93,  0,102,105,
+108,101,112, 97,116,104, 91, 49, 48, 50, 52, 93,  0,116,111,116,  0, 42,112, 97,114,101,110,116,  0,119, 91, 50, 93,  0,104, 91,
+ 50, 93,  0, 99,104, 97,110,103,101,100, 91, 50, 93,  0, 99,104, 97,110,103,101,100, 95,116,105,109,101,115,116, 97,109,112, 91,
+ 50, 93,  0, 42,114,101, 99,116, 91, 50, 93,  0, 42,111, 98,  0, 98,108,111, 99,107,116,121,112,101,  0, 97,100,114, 99,111,100,
+101,  0,110, 97,109,101, 91, 49, 50, 56, 93,  0, 42, 98,112,  0, 42, 98,101,122,116,  0,109, 97,120,114, 99,116,  0,116,111,116,
+114, 99,116,  0,118, 97,114,116,121,112,101,  0,116,111,116,118,101,114,116,  0,105,112,111,  0,101,120,116,114, 97,112,  0,114,
+116,  0, 98,105,116,109, 97,115,107,  0,115,108,105,100,101, 95,109,105,110,  0,115,108,105,100,101, 95,109, 97,120,  0, 99,117,
+114,118, 97,108,  0, 42,100,114,105,118,101,114,  0, 99,117,114,118,101,  0, 99,117,114,  0,115,104,111,119,107,101,121,  0,109,
+117,116,101,105,112,111,  0,112,111,115,  0,114,101,108, 97,116,105,118,101,  0,116,111,116,101,108,101,109,  0, 42,119,101,105,
+103,104,116,115,  0,118,103,114,111,117,112, 91, 54, 52, 93,  0,115,108,105,100,101,114,109,105,110,  0,115,108,105,100,101,114,
+109, 97,120,  0,117,105,100,  0,112, 97,100, 51,  0, 42, 97,100,116,  0, 42,114,101,102,107,101,121,  0,101,108,101,109,115,116,
+114, 91, 54, 52, 93,  0,101,108,101,109,115,105,122,101,  0, 98,108,111, 99,107,  0, 42,105,112,111,  0, 42,102,114,111,109,  0,
+116,111,116,107,101,121,  0,115,108,117,114,112,104,  0, 99,116,105,109,101,  0,117,105,100,103,101,110,  0, 42,108,105,110,101,
+  0, 42,102,111,114,109, 97,116,  0, 98,108,101,110,  0,108,105,110,101,110,111,  0,115,116, 97,114,116,  0,101,110,100,  0,112,
+ 97,100, 49,  0,102,108, 97,103,115,  0, 99,111,108,111,114, 91, 52, 93,  0,112, 97,100, 91, 52, 93,  0, 42,110, 97,109,101,  0,
+110,108,105,110,101,115,  0,108,105,110,101,115,  0, 42, 99,117,114,108,  0, 42,115,101,108,108,  0, 99,117,114, 99,  0,115,101,
+108, 99,  0,109, 97,114,107,101,114,115,  0, 42,117,110,100,111, 95, 98,117,102,  0,117,110,100,111, 95,112,111,115,  0,117,110,
+100,111, 95,108,101,110,  0, 42, 99,111,109,112,105,108,101,100,  0,109,116,105,109,101,  0,115,105,122,101,  0,115,101,101,107,
+  0,100,116,120,  0,112, 97,115,115,101,112, 97,114,116, 97,108,112,104, 97,  0, 99,108,105,112,115,116, 97,  0, 99,108,105,112,
+101,110,100,  0,108,101,110,115,  0,111,114,116,104,111, 95,115, 99, 97,108,101,  0,100,114, 97,119,115,105,122,101,  0,115,101,
+110,115,111,114, 95,120,  0,115,101,110,115,111,114, 95,121,  0,115,104,105,102,116,120,  0,115,104,105,102,116,121,  0, 89, 70,
+ 95,100,111,102,100,105,115,116,  0, 42,100,111,102, 95,111, 98,  0,115,101,110,115,111,114, 95,102,105,116,  0,112, 97,100, 91,
+ 55, 93,  0, 42,115, 99,101,110,101,  0,102,114, 97,109,101,110,114,  0,102,114, 97,109,101,115,  0,111,102,102,115,101,116,  0,
+115,102,114, 97,  0,102,105,101, 95,105,109, 97,  0, 99,121, 99,108,  0,111,107,  0,109,117,108,116,105, 95,105,110,100,101,120,
+  0,108, 97,121,101,114,  0,112, 97,115,115,  0,105, 98,117,102,115,  0, 42,103,112,117,116,101,120,116,117,114,101,  0, 42, 97,
+110,105,109,  0, 42,114,114,  0, 42,114,101,110,100,101,114,115, 91, 56, 93,  0,114,101,110,100,101,114, 95,115,108,111,116,  0,
+108, 97,115,116, 95,114,101,110,100,101,114, 95,115,108,111,116,  0,115,111,117,114, 99,101,  0,108, 97,115,116,102,114, 97,109,
+101,  0,116,112, 97,103,101,102,108, 97,103,  0,116,111,116, 98,105,110,100,  0,120,114,101,112,  0,121,114,101,112,  0,116,119,
+115,116, 97,  0,116,119,101,110,100,  0, 98,105,110,100, 99,111,100,101,  0, 42,114,101,112, 98,105,110,100,  0, 42,112, 97, 99,
+107,101,100,102,105,108,101,  0, 42,112,114,101,118,105,101,119,  0,108, 97,115,116,117,112,100, 97,116,101,  0,108, 97,115,116,
+117,115,101,100,  0, 97,110,105,109,115,112,101,101,100,  0,103,101,110, 95,120,  0,103,101,110, 95,121,  0,103,101,110, 95,116,
+121,112,101,  0,103,101,110, 95,102,108, 97,103,  0, 97,115,112,120,  0, 97,115,112,121,  0,116,101,120, 99,111,  0,109, 97,112,
+116,111,  0,109, 97,112,116,111,110,101,103,  0, 98,108,101,110,100,116,121,112,101,  0, 42,111, 98,106,101, 99,116,  0, 42,116,
+101,120,  0,117,118,110, 97,109,101, 91, 54, 52, 93,  0,112,114,111,106,120,  0,112,114,111,106,121,  0,112,114,111,106,122,  0,
+109, 97,112,112,105,110,103,  0,111,102,115, 91, 51, 93,  0,115,105,122,101, 91, 51, 93,  0,114,111,116,  0,116,101,120,102,108,
+ 97,103,  0, 99,111,108,111,114,109,111,100,101,108,  0,112,109, 97,112,116,111,  0,112,109, 97,112,116,111,110,101,103,  0,110,
+111,114,109, 97,112,115,112, 97, 99,101,  0,119,104,105, 99,104, 95,111,117,116,112,117,116,  0, 98,114,117,115,104, 95,109, 97,
+112, 95,109,111,100,101,  0,114,  0,103,  0, 98,  0,107,  0,100,101,102, 95,118, 97,114,  0, 99,111,108,102, 97, 99,  0,118, 97,
+114,102, 97, 99,  0,110,111,114,102, 97, 99,  0,100,105,115,112,102, 97, 99,  0,119, 97,114,112,102, 97, 99,  0, 99,111,108,115,
+112,101, 99,102, 97, 99,  0,109,105,114,114,102, 97, 99,  0, 97,108,112,104, 97,102, 97, 99,  0,100,105,102,102,102, 97, 99,  0,
+115,112,101, 99,102, 97, 99,  0,101,109,105,116,102, 97, 99,  0,104, 97,114,100,102, 97, 99,  0,114, 97,121,109,105,114,114,102,
+ 97, 99,  0,116,114, 97,110,115,108,102, 97, 99,  0, 97,109, 98,102, 97, 99,  0, 99,111,108,101,109,105,116,102, 97, 99,  0, 99,
+111,108,114,101,102,108,102, 97, 99,  0, 99,111,108,116,114, 97,110,115,102, 97, 99,  0,100,101,110,115,102, 97, 99,  0,115, 99,
+ 97,116,116,101,114,102, 97, 99,  0,114,101,102,108,102, 97, 99,  0,116,105,109,101,102, 97, 99,  0,108,101,110,103,116,104,102,
+ 97, 99,  0, 99,108,117,109,112,102, 97, 99,  0,100, 97,109,112,102, 97, 99,  0,107,105,110,107,102, 97, 99,  0,114,111,117,103,
+104,102, 97, 99,  0,112, 97,100,101,110,115,102, 97, 99,  0,103,114, 97,118,105,116,121,102, 97, 99,  0,108,105,102,101,102, 97,
+ 99,  0,115,105,122,101,102, 97, 99,  0,105,118,101,108,102, 97, 99,  0,102,105,101,108,100,102, 97, 99,  0,115,104, 97,100,111,
+119,102, 97, 99,  0,122,101,110,117,112,102, 97, 99,  0,122,101,110,100,111,119,110,102, 97, 99,  0, 98,108,101,110,100,102, 97,
+ 99,  0, 42,104, 97,110,100,108,101,  0, 42,112,110, 97,109,101,  0, 42,115,116,110, 97,109,101,115,  0,115,116,121,112,101,115,
+  0,118, 97,114,115,  0, 42,118, 97,114,115,116,114,  0, 42,114,101,115,117,108,116,  0, 42, 99,102,114, 97,  0,100, 97,116, 97,
+ 91, 51, 50, 93,  0, 40, 42,100,111,105,116, 41, 40, 41,  0, 40, 42,105,110,115,116, 97,110, 99,101, 95,105,110,105,116, 41, 40,
+ 41,  0, 40, 42, 99, 97,108,108, 98, 97, 99,107, 41, 40, 41,  0,118,101,114,115,105,111,110,  0, 97,  0,105,112,111,116,121,112,
+101,  0, 42,105,109, 97,  0, 42, 99,117, 98,101, 91, 54, 93,  0,105,109, 97,116, 91, 52, 93, 91, 52, 93,  0,111, 98,105,109, 97,
+116, 91, 51, 93, 91, 51, 93,  0,115,116,121,112,101,  0,118,105,101,119,115, 99, 97,108,101,  0,110,111,116,108, 97,121,  0, 99,
+117, 98,101,114,101,115,  0,100,101,112,116,104,  0,114,101, 99, 97,108, 99,  0,108, 97,115,116,115,105,122,101,  0,102, 97,108,
+108,111,102,102, 95,116,121,112,101,  0,102, 97,108,108,111,102,102, 95,115,111,102,116,110,101,115,115,  0,114, 97,100,105,117,
+115,  0, 99,111,108,111,114, 95,115,111,117,114, 99,101,  0,116,111,116,112,111,105,110,116,115,  0,112,100,112, 97,100,  0,112,
+115,121,115,  0,112,115,121,115, 95, 99, 97, 99,104,101, 95,115,112, 97, 99,101,  0,111, 98, 95, 99, 97, 99,104,101, 95,115,112,
+ 97, 99,101,  0, 42,112,111,105,110,116, 95,116,114,101,101,  0, 42,112,111,105,110,116, 95,100, 97,116, 97,  0,110,111,105,115,
+101, 95,115,105,122,101,  0,110,111,105,115,101, 95,100,101,112,116,104,  0,110,111,105,115,101, 95,105,110,102,108,117,101,110,
+ 99,101,  0,110,111,105,115,101, 95, 98, 97,115,105,115,  0,112,100,112, 97,100, 51, 91, 51, 93,  0,110,111,105,115,101, 95,102,
+ 97, 99,  0,115,112,101,101,100, 95,115, 99, 97,108,101,  0,102, 97,108,108,111,102,102, 95,115,112,101,101,100, 95,115, 99, 97,
+108,101,  0,112,100,112, 97,100, 50,  0, 42, 99,111, 98, 97,  0, 42,102, 97,108,108,111,102,102, 95, 99,117,114,118,101,  0,114,
+101,115,111,108, 91, 51, 93,  0,105,110,116,101,114,112, 95,116,121,112,101,  0,102,105,108,101, 95,102,111,114,109, 97,116,  0,
+101,120,116,101,110,100,  0,115,109,111,107,101,100, 95,116,121,112,101,  0,105,110,116, 95,109,117,108,116,105,112,108,105,101,
+114,  0,115,116,105,108,108, 95,102,114, 97,109,101,  0,115,111,117,114, 99,101, 95,112, 97,116,104, 91, 49, 48, 50, 52, 93,  0,
+ 42,100, 97,116, 97,115,101,116,  0, 99, 97, 99,104,101,100,102,114, 97,109,101,  0,111, 99,101, 97,110,109,111,100, 91, 54, 52,
+ 93,  0,111,117,116,112,117,116,  0,110,111,105,115,101,115,105,122,101,  0,116,117,114, 98,117,108,  0, 98,114,105,103,104,116,
+  0, 99,111,110,116,114, 97,115,116,  0,115, 97,116,117,114, 97,116,105,111,110,  0,114,102, 97, 99,  0,103,102, 97, 99,  0, 98,
+102, 97, 99,  0,102,105,108,116,101,114,115,105,122,101,  0,109,103, 95, 72,  0,109,103, 95,108, 97, 99,117,110, 97,114,105,116,
+121,  0,109,103, 95,111, 99,116, 97,118,101,115,  0,109,103, 95,111,102,102,115,101,116,  0,109,103, 95,103, 97,105,110,  0,100,
+105,115,116, 95, 97,109,111,117,110,116,  0,110,115, 95,111,117,116,115, 99, 97,108,101,  0,118,110, 95,119, 49,  0,118,110, 95,
+119, 50,  0,118,110, 95,119, 51,  0,118,110, 95,119, 52,  0,118,110, 95,109,101,120,112,  0,118,110, 95,100,105,115,116,109,  0,
+118,110, 95, 99,111,108,116,121,112,101,  0,110,111,105,115,101,100,101,112,116,104,  0,110,111,105,115,101,116,121,112,101,  0,
+110,111,105,115,101, 98, 97,115,105,115,  0,110,111,105,115,101, 98, 97,115,105,115, 50,  0,105,109, 97,102,108, 97,103,  0, 99,
+114,111,112,120,109,105,110,  0, 99,114,111,112,121,109,105,110,  0, 99,114,111,112,120,109, 97,120,  0, 99,114,111,112,121,109,
+ 97,120,  0,116,101,120,102,105,108,116,101,114,  0, 97,102,109, 97,120,  0,120,114,101,112,101, 97,116,  0,121,114,101,112,101,
+ 97,116,  0, 99,104,101, 99,107,101,114,100,105,115,116,  0,110, 97, 98,108, 97,  0,105,117,115,101,114,  0, 42,110,111,100,101,
+116,114,101,101,  0, 42,112,108,117,103,105,110,  0, 42,101,110,118,  0, 42,112,100,  0, 42,118,100,  0, 42,111,116,  0,117,115,
+101, 95,110,111,100,101,115,  0,108,111, 99, 91, 51, 93,  0,114,111,116, 91, 51, 93,  0,109, 97,116, 91, 52, 93, 91, 52, 93,  0,
+109,105,110, 91, 51, 93,  0,109, 97,120, 91, 51, 93,  0, 99,111, 98, 97,  0, 98,108,101,110,100, 95, 99,111,108,111,114, 91, 51,
+ 93,  0, 98,108,101,110,100, 95,102, 97, 99,116,111,114,  0, 98,108,101,110,100, 95,116,121,112,101,  0,112, 97,100, 91, 51, 93,
+  0,109,111,100,101,  0,116,111,116,101,120,  0,115,104,100,119,114,  0,115,104,100,119,103,  0,115,104,100,119, 98,  0,115,104,
+100,119,112, 97,100,  0,101,110,101,114,103,121,  0,100,105,115,116,  0,115,112,111,116,115,105,122,101,  0,115,112,111,116, 98,
+108,101,110,100,  0,104, 97,105,110,116,  0, 97,116,116, 49,  0, 97,116,116, 50,  0, 42, 99,117,114,102, 97,108,108,111,102,102,
+  0,115,104, 97,100,115,112,111,116,115,105,122,101,  0, 98,105, 97,115,  0,115,111,102,116,  0, 99,111,109,112,114,101,115,115,
+116,104,114,101,115,104,  0,112, 97,100, 53, 91, 51, 93,  0, 98,117,102,115,105,122,101,  0,115, 97,109,112,  0, 98,117,102,102,
+101,114,115,  0,102,105,108,116,101,114,116,121,112,101,  0, 98,117,102,102,108, 97,103,  0, 98,117,102,116,121,112,101,  0,114,
+ 97,121, 95,115, 97,109,112,  0,114, 97,121, 95,115, 97,109,112,121,  0,114, 97,121, 95,115, 97,109,112,122,  0,114, 97,121, 95,
+115, 97,109,112, 95,116,121,112,101,  0, 97,114,101, 97, 95,115,104, 97,112,101,  0, 97,114,101, 97, 95,115,105,122,101,  0, 97,
+114,101, 97, 95,115,105,122,101,121,  0, 97,114,101, 97, 95,115,105,122,101,122,  0, 97,100, 97,112,116, 95,116,104,114,101,115,
+104,  0,114, 97,121, 95,115, 97,109,112, 95,109,101,116,104,111,100,  0,116,101,120, 97, 99,116,  0,115,104, 97,100,104, 97,108,
+111,115,116,101,112,  0,115,117,110, 95,101,102,102,101, 99,116, 95,116,121,112,101,  0,115,107,121, 98,108,101,110,100,116,121,
+112,101,  0,104,111,114,105,122,111,110, 95, 98,114,105,103,104,116,110,101,115,115,  0,115,112,114,101, 97,100,  0,115,117,110,
+ 95, 98,114,105,103,104,116,110,101,115,115,  0,115,117,110, 95,115,105,122,101,  0, 98, 97, 99,107,115, 99, 97,116,116,101,114,
+101,100, 95,108,105,103,104,116,  0,115,117,110, 95,105,110,116,101,110,115,105,116,121,  0, 97,116,109, 95,116,117,114, 98,105,
+100,105,116,121,  0, 97,116,109, 95,105,110,115, 99, 97,116,116,101,114,105,110,103, 95,102, 97, 99,116,111,114,  0, 97,116,109,
+ 95,101,120,116,105,110, 99,116,105,111,110, 95,102, 97, 99,116,111,114,  0, 97,116,109, 95,100,105,115,116, 97,110, 99,101, 95,
+102, 97, 99,116,111,114,  0,115,107,121, 98,108,101,110,100,102, 97, 99,  0,115,107,121, 95,101,120,112,111,115,117,114,101,  0,
+115,107,121, 95, 99,111,108,111,114,115,112, 97, 99,101,  0,112, 97,100, 52, 91, 54, 93,  0, 42,109,116,101,120, 91, 49, 56, 93,
+  0,112,114, 95,116,101,120,116,117,114,101,  0,112, 97,100, 54, 91, 52, 93,  0,100,101,110,115,105,116,121,  0,101,109,105,115,
+115,105,111,110,  0,115, 99, 97,116,116,101,114,105,110,103,  0,114,101,102,108,101, 99,116,105,111,110,  0,101,109,105,115,115,
+105,111,110, 95, 99,111,108, 91, 51, 93,  0,116,114, 97,110,115,109,105,115,115,105,111,110, 95, 99,111,108, 91, 51, 93,  0,114,
+101,102,108,101, 99,116,105,111,110, 95, 99,111,108, 91, 51, 93,  0,100,101,110,115,105,116,121, 95,115, 99, 97,108,101,  0,100,
+101,112,116,104, 95, 99,117,116,111,102,102,  0, 97,115,121,109,109,101,116,114,121,  0,115,116,101,112,115,105,122,101, 95,116,
+121,112,101,  0,115,104, 97,100,101,102,108, 97,103,  0,115,104, 97,100,101, 95,116,121,112,101,  0,112,114,101, 99, 97, 99,104,
+101, 95,114,101,115,111,108,117,116,105,111,110,  0,115,116,101,112,115,105,122,101,  0,109,115, 95,100,105,102,102,  0,109,115,
+ 95,105,110,116,101,110,115,105,116,121,  0,109,115, 95,115,112,114,101, 97,100,  0, 97,108,112,104, 97, 95, 98,108,101,110,100,
+  0,102, 97, 99,101, 95,111,114,105,101,110,116, 97,116,105,111,110,  0,109, 97,116,101,114,105, 97,108, 95,116,121,112,101,  0,
+115,112,101, 99,114,  0,115,112,101, 99,103,  0,115,112,101, 99, 98,  0,109,105,114,114,  0,109,105,114,103,  0,109,105,114, 98,
+  0, 97,109, 98,114,  0, 97,109, 98, 98,  0, 97,109, 98,103,  0, 97,109, 98,  0,101,109,105,116,  0, 97,110,103,  0,115,112,101,
+ 99,116,114, 97,  0,114, 97,121, 95,109,105,114,114,111,114,  0, 97,108,112,104, 97,  0,114,101,102,  0,115,112,101, 99,  0,122,
+111,102,102,115,  0, 97,100,100,  0,116,114, 97,110,115,108,117, 99,101,110, 99,121,  0,118,111,108,  0,103, 97,109,101,  0,102,
+114,101,115,110,101,108, 95,109,105,114,  0,102,114,101,115,110,101,108, 95,109,105,114, 95,105,  0,102,114,101,115,110,101,108,
+ 95,116,114, 97,  0,102,114,101,115,110,101,108, 95,116,114, 97, 95,105,  0,102,105,108,116,101,114,  0,116,120, 95,108,105,109,
+105,116,  0,116,120, 95,102, 97,108,108,111,102,102,  0,114, 97,121, 95,100,101,112,116,104,  0,114, 97,121, 95,100,101,112,116,
+104, 95,116,114, 97,  0,104, 97,114,  0,115,101,101,100, 49,  0,115,101,101,100, 50,  0,103,108,111,115,115, 95,109,105,114,  0,
+103,108,111,115,115, 95,116,114, 97,  0,115, 97,109,112, 95,103,108,111,115,115, 95,109,105,114,  0,115, 97,109,112, 95,103,108,
+111,115,115, 95,116,114, 97,  0, 97,100, 97,112,116, 95,116,104,114,101,115,104, 95,109,105,114,  0, 97,100, 97,112,116, 95,116,
+104,114,101,115,104, 95,116,114, 97,  0, 97,110,105,115,111, 95,103,108,111,115,115, 95,109,105,114,  0,100,105,115,116, 95,109,
+105,114,  0,102, 97,100,101,116,111, 95,109,105,114,  0,115,104, 97,100,101, 95,102,108, 97,103,  0,109,111,100,101, 95,108,  0,
+102,108, 97,114,101, 99,  0,115,116, 97,114, 99,  0,108,105,110,101, 99,  0,114,105,110,103, 99,  0,104, 97,115,105,122,101,  0,
+102,108, 97,114,101,115,105,122,101,  0,115,117, 98,115,105,122,101,  0,102,108, 97,114,101, 98,111,111,115,116,  0,115,116,114,
+ 97,110,100, 95,115,116, 97,  0,115,116,114, 97,110,100, 95,101,110,100,  0,115,116,114, 97,110,100, 95,101, 97,115,101,  0,115,
+116,114, 97,110,100, 95,115,117,114,102,110,111,114,  0,115,116,114, 97,110,100, 95,109,105,110,  0,115,116,114, 97,110,100, 95,
+119,105,100,116,104,102, 97,100,101,  0,115,116,114, 97,110,100, 95,117,118,110, 97,109,101, 91, 54, 52, 93,  0,115, 98,105, 97,
+115,  0,108, 98,105, 97,115,  0,115,104, 97,100, 95, 97,108,112,104, 97,  0,115,101,112,116,101,120,  0,114,103, 98,115,101,108,
+  0,112,114, 95,116,121,112,101,  0,112,114, 95, 98, 97, 99,107,  0,112,114, 95,108, 97,109,112,  0,109,108, 95,102,108, 97,103,
+  0,100,105,102,102, 95,115,104, 97,100,101,114,  0,115,112,101, 99, 95,115,104, 97,100,101,114,  0,114,111,117,103,104,110,101,
+115,115,  0,114,101,102,114, 97, 99,  0,112, 97,114, 97,109, 91, 52, 93,  0,114,109,115,  0,100, 97,114,107,110,101,115,115,  0,
+ 42,114, 97,109,112, 95, 99,111,108,  0, 42,114, 97,109,112, 95,115,112,101, 99,  0,114, 97,109,112,105,110, 95, 99,111,108,  0,
+114, 97,109,112,105,110, 95,115,112,101, 99,  0,114, 97,109,112, 98,108,101,110,100, 95, 99,111,108,  0,114, 97,109,112, 98,108,
+101,110,100, 95,115,112,101, 99,  0,114, 97,109,112, 95,115,104,111,119,  0,114, 97,109,112,102, 97, 99, 95, 99,111,108,  0,114,
+ 97,109,112,102, 97, 99, 95,115,112,101, 99,  0, 42,103,114,111,117,112,  0,102,114,105, 99,116,105,111,110,  0,102,104,  0,114,
+101,102,108,101, 99,116,  0,102,104,100,105,115,116,  0,120,121,102,114,105, 99,116,  0,100,121,110, 97,109,111,100,101,  0,115,
+115,115, 95,114, 97,100,105,117,115, 91, 51, 93,  0,115,115,115, 95, 99,111,108, 91, 51, 93,  0,115,115,115, 95,101,114,114,111,
+114,  0,115,115,115, 95,115, 99, 97,108,101,  0,115,115,115, 95,105,111,114,  0,115,115,115, 95, 99,111,108,102, 97, 99,  0,115,
+115,115, 95,116,101,120,102, 97, 99,  0,115,115,115, 95,102,114,111,110,116,  0,115,115,115, 95, 98, 97, 99,107,  0,115,115,115,
+ 95,102,108, 97,103,  0,115,115,115, 95,112,114,101,115,101,116,  0,109, 97,112,116,111, 95,116,101,120,116,117,114,101,100,  0,
+115,104, 97,100,111,119,111,110,108,121, 95,102,108, 97,103,  0,105,110,100,101,120,  0,103,112,117,109, 97,116,101,114,105, 97,
+108,  0, 42, 98, 98,  0,115,101,108, 99,111,108, 49,  0,115,101,108, 99,111,108, 50,  0,113,117, 97,116, 91, 52, 93,  0,101,120,
+112,120,  0,101,120,112,121,  0,101,120,112,122,  0,114, 97,100,  0,114, 97,100, 50,  0,115,  0, 42,109, 97,116,  0, 42,105,109,
+ 97,116,  0,101,108,101,109,115,  0,100,105,115,112,  0, 42,101,100,105,116,101,108,101,109,115,  0, 42, 42,109, 97,116,  0,102,
+108, 97,103, 50,  0,116,111,116, 99,111,108,  0,119,105,114,101,115,105,122,101,  0,114,101,110,100,101,114,115,105,122,101,  0,
+116,104,114,101,115,104,  0, 42,108, 97,115,116,101,108,101,109,  0,118,101, 99, 91, 51, 93, 91, 51, 93,  0, 97,108,102, 97,  0,
+119,101,105,103,104,116,  0,104, 49,  0,104, 50,  0,102, 49,  0,102, 50,  0,102, 51,  0,104,105,100,101,  0,118,101, 99, 91, 52,
+ 93,  0,109, 97,116, 95,110,114,  0,112,110,116,115,117,  0,112,110,116,115,118,  0,114,101,115,111,108,117,  0,114,101,115,111,
+108,118,  0,111,114,100,101,114,117,  0,111,114,100,101,114,118,  0,102,108, 97,103,117,  0,102,108, 97,103,118,  0, 42,107,110,
+111,116,115,117,  0, 42,107,110,111,116,115,118,  0,116,105,108,116, 95,105,110,116,101,114,112,  0,114, 97,100,105,117,115, 95,
+105,110,116,101,114,112,  0, 99,104, 97,114,105,100,120,  0,107,101,114,110,  0,119,  0,104,  0,110,117,114, 98,115,  0, 42,107,
+101,121,105,110,100,101,120,  0,115,104, 97,112,101,110,114,  0,110,117,114, 98,  0, 42,101,100,105,116,110,117,114, 98,  0, 42,
+ 98,101,118,111, 98,106,  0, 42,116, 97,112,101,114,111, 98,106,  0, 42,116,101,120,116,111,110, 99,117,114,118,101,  0, 42,112,
+ 97,116,104,  0, 42,107,101,121,  0, 98,101,118,  0,100,114, 97,119,102,108, 97,103,  0,116,119,105,115,116, 95,109,111,100,101,
+  0,116,119,105,115,116, 95,115,109,111,111,116,104,  0,115,109, 97,108,108, 99, 97,112,115, 95,115, 99, 97,108,101,  0,112, 97,
+116,104,108,101,110,  0, 98,101,118,114,101,115,111,108,  0,119,105,100,116,104,  0,101,120,116, 49,  0,101,120,116, 50,  0,114,
+101,115,111,108,117, 95,114,101,110,  0,114,101,115,111,108,118, 95,114,101,110,  0, 97, 99,116,110,117,  0, 42,108, 97,115,116,
+115,101,108,  0,115,112, 97, 99,101,109,111,100,101,  0,115,112, 97, 99,105,110,103,  0,108,105,110,101,100,105,115,116,  0,115,
+104,101, 97,114,  0,102,115,105,122,101,  0,119,111,114,100,115,112, 97, 99,101,  0,117,108,112,111,115,  0,117,108,104,101,105,
+103,104,116,  0,120,111,102,  0,121,111,102,  0,108,105,110,101,119,105,100,116,104,  0, 42,115,116,114,  0, 42,115,101,108, 98,
+111,120,101,115,  0, 42,101,100,105,116,102,111,110,116,  0,102, 97,109,105,108,121, 91, 50, 52, 93,  0, 42,118,102,111,110,116,
+  0, 42,118,102,111,110,116, 98,  0, 42,118,102,111,110,116,105,  0, 42,118,102,111,110,116, 98,105,  0,115,101,112, 99,104, 97,
+114,  0,116,111,116, 98,111,120,  0, 97, 99,116, 98,111,120,  0, 42,116, 98,  0,115,101,108,115,116, 97,114,116,  0,115,101,108,
+101,110,100,  0, 42,115,116,114,105,110,102,111,  0, 99,117,114,105,110,102,111,  0, 42,109,112,111,108,121,  0, 42,109,116,112,
+111,108,121,  0, 42,109,108,111,111,112,  0, 42,109,108,111,111,112,117,118,  0, 42,109,108,111,111,112, 99,111,108,  0, 42,109,
+102, 97, 99,101,  0, 42,109,116,102, 97, 99,101,  0, 42,116,102, 97, 99,101,  0, 42,109,118,101,114,116,  0, 42,109,101,100,103,
+101,  0, 42,100,118,101,114,116,  0, 42,109, 99,111,108,  0, 42,109,115,116,105, 99,107,121,  0, 42,116,101,120, 99,111,109,101,
+115,104,  0, 42,109,115,101,108,101, 99,116,  0, 42,101,100,105,116, 95, 98,116,109,101,115,104,  0,118,100, 97,116, 97,  0,101,
+100, 97,116, 97,  0,102,100, 97,116, 97,  0,112,100, 97,116, 97,  0,108,100, 97,116, 97,  0,116,111,116,101,100,103,101,  0,116,
+111,116,102, 97, 99,101,  0,116,111,116,115,101,108,101, 99,116,  0,116,111,116,112,111,108,121,  0,116,111,116,108,111,111,112,
+  0, 97, 99,116, 95,102, 97, 99,101,  0,115,109,111,111,116,104,114,101,115,104,  0,115,117, 98,100,105,118,  0,115,117, 98,100,
+105,118,114,  0,115,117, 98,115,117,114,102,116,121,112,101,  0,101,100,105,116,102,108, 97,103,  0, 42,109,114,  0, 42,116,112,
+ 97,103,101,  0,117,118, 91, 52, 93, 91, 50, 93,  0, 99,111,108, 91, 52, 93,  0,116,114, 97,110,115,112,  0,116,105,108,101,  0,
+117,110,119,114, 97,112,  0,118, 49,  0,118, 50,  0,118, 51,  0,118, 52,  0,101,100, 99,111,100,101,  0, 99,114,101, 97,115,101,
+  0, 98,119,101,105,103,104,116,  0,100,101,102, 95,110,114,  0, 42,100,119,  0,116,111,116,119,101,105,103,104,116,  0, 99,111,
+ 91, 51, 93,  0,110,111, 91, 51, 93,  0,108,111,111,112,115,116, 97,114,116,  0,118,  0,101,  0,117,118, 91, 50, 93,  0, 99,111,
+ 91, 50, 93,  0,102,  0,105,  0,115, 91, 50, 53, 54, 93,  0,116,111,116,100,105,115,112,  0,108,101,118,101,108,  0, 40, 42,100,
+105,115,112,115, 41, 40, 41,  0, 42,104,105,100,100,101,110,  0,118, 91, 52, 93,  0,109,105,100,  0,112, 97,100, 91, 50, 93,  0,
+118, 91, 50, 93,  0, 42,102, 97, 99,101,115,  0, 42, 99,111,108,102, 97, 99,101,115,  0, 42,101,100,103,101,115,  0, 42,118,101,
+114,116,115,  0,108,101,118,101,108,115,  0,108,101,118,101,108, 95, 99,111,117,110,116,  0, 99,117,114,114,101,110,116,  0,110,
+101,119,108,118,108,  0,101,100,103,101,108,118,108,  0,112,105,110,108,118,108,  0,114,101,110,100,101,114,108,118,108,  0,117,
+115,101, 95, 99,111,108,  0, 42,101,100,103,101, 95,102,108, 97,103,115,  0, 42,101,100,103,101, 95, 99,114,101, 97,115,101,115,
+  0,115,116, 97, 99,107,105,110,100,101,120,  0, 42,101,114,114,111,114,  0,109,111,100,105,102,105,101,114,  0, 42,116,101,120,
+116,117,114,101,  0, 42,109, 97,112, 95,111, 98,106,101, 99,116,  0,117,118,108, 97,121,101,114, 95,110, 97,109,101, 91, 54, 52,
+ 93,  0,117,118,108, 97,121,101,114, 95,116,109,112,  0,116,101,120,109, 97,112,112,105,110,103,  0,115,117, 98,100,105,118, 84,
+121,112,101,  0,114,101,110,100,101,114, 76,101,118,101,108,115,  0, 42,101,109, 67, 97, 99,104,101,  0, 42,109, 67, 97, 99,104,
+101,  0,115,116,114,101,110,103,116,104,  0,100,101,102, 97,120,105,115,  0,112, 97,100, 91, 54, 93,  0,108,101,110,103,116,104,
+  0,114, 97,110,100,111,109,105,122,101,  0,115,101,101,100,  0, 42,111, 98, 95, 97,114,109,  0, 42,115,116, 97,114,116, 95, 99,
+ 97,112,  0, 42,101,110,100, 95, 99, 97,112,  0, 42, 99,117,114,118,101, 95,111, 98,  0, 42,111,102,102,115,101,116, 95,111, 98,
+  0,111,102,102,115,101,116, 91, 51, 93,  0,115, 99, 97,108,101, 91, 51, 93,  0,109,101,114,103,101, 95,100,105,115,116,  0,102,
+105,116, 95,116,121,112,101,  0,111,102,102,115,101,116, 95,116,121,112,101,  0, 99,111,117,110,116,  0, 97,120,105,115,  0,116,
+111,108,101,114, 97,110, 99,101,  0, 42,109,105,114,114,111,114, 95,111, 98,  0,115,112,108,105,116, 95, 97,110,103,108,101,  0,
+118, 97,108,117,101,  0,114,101,115,  0,118, 97,108, 95,102,108, 97,103,115,  0,108,105,109, 95,102,108, 97,103,115,  0,101, 95,
+102,108, 97,103,115,  0, 98,101,118,101,108, 95, 97,110,103,108,101,  0,100,101,102,103,114,112, 95,110, 97,109,101, 91, 54, 52,
+ 93,  0, 42,100,111,109, 97,105,110,  0, 42,102,108,111,119,  0, 42, 99,111,108,108,  0,116,105,109,101,  0,100,105,114,101, 99,
+116,105,111,110,  0,109,105,100,108,101,118,101,108,  0, 42,112,114,111,106,101, 99,116,111,114,115, 91, 49, 48, 93,  0, 42,105,
+109, 97,103,101,  0,110,117,109, 95,112,114,111,106,101, 99,116,111,114,115,  0, 97,115,112,101, 99,116,120,  0, 97,115,112,101,
+ 99,116,121,  0,115, 99, 97,108,101,120,  0,115, 99, 97,108,101,121,  0,112,101,114, 99,101,110,116,  0,102, 97, 99,101, 67,111,
+117,110,116,  0,102, 97, 99,  0,114,101,112,101, 97,116,  0, 42,111, 98,106,101, 99,116, 99,101,110,116,101,114,  0,115,116, 97,
+114,116,120,  0,115,116, 97,114,116,121,  0,104,101,105,103,104,116,  0,110, 97,114,114,111,119,  0,115,112,101,101,100,  0,100,
+ 97,109,112,  0,102, 97,108,108,111,102,102,  0,116,105,109,101,111,102,102,115,  0,108,105,102,101,116,105,109,101,  0,100,101,
+102,111,114,109,102,108, 97,103,  0,109,117,108,116,105,  0, 42,112,114,101,118, 67,111,115,  0,115,117, 98,116, 97,114,103,101,
+116, 91, 54, 52, 93,  0,112, 97,114,101,110,116,105,110,118, 91, 52, 93, 91, 52, 93,  0, 99,101,110,116, 91, 51, 93,  0, 42,105,
+110,100,101,120, 97,114,  0,116,111,116,105,110,100,101,120,  0,102,111,114, 99,101,  0, 42, 99,108,111,116,104, 79, 98,106,101,
+ 99,116,  0, 42,115,105,109, 95,112, 97,114,109,115,  0, 42, 99,111,108,108, 95,112, 97,114,109,115,  0, 42,112,111,105,110,116,
+ 95, 99, 97, 99,104,101,  0,112,116, 99, 97, 99,104,101,115,  0, 42,120,  0, 42,120,110,101,119,  0, 42,120,111,108,100,  0, 42,
+ 99,117,114,114,101,110,116, 95,120,110,101,119,  0, 42, 99,117,114,114,101,110,116, 95,120,  0, 42, 99,117,114,114,101,110,116,
+ 95,118,  0, 42,109,102, 97, 99,101,115,  0,110,117,109,118,101,114,116,115,  0,110,117,109,102, 97, 99,101,115,  0,116,105,109,
+101, 95,120,  0,116,105,109,101, 95,120,110,101,119,  0, 42, 98,118,104,116,114,101,101,  0, 42,118,  0, 42,100,109,  0, 99,102,
+114, 97,  0,111,112,101,114, 97,116,105,111,110,  0,118,101,114,116,101,120,  0,116,111,116,105,110,102,108,117,101,110, 99,101,
+  0,103,114,105,100,115,105,122,101,  0, 42, 98,105,110,100,105,110,102,108,117,101,110, 99,101,115,  0, 42, 98,105,110,100,111,
+102,102,115,101,116,115,  0, 42, 98,105,110,100, 99, 97,103,101, 99,111,115,  0,116,111,116, 99, 97,103,101,118,101,114,116,  0,
+ 42,100,121,110,103,114,105,100,  0, 42,100,121,110,105,110,102,108,117,101,110, 99,101,115,  0, 42,100,121,110,118,101,114,116,
+115,  0, 42,112, 97,100, 50,  0,100,121,110,103,114,105,100,115,105,122,101,  0,100,121,110, 99,101,108,108,109,105,110, 91, 51,
+ 93,  0,100,121,110, 99,101,108,108,119,105,100,116,104,  0, 98,105,110,100,109, 97,116, 91, 52, 93, 91, 52, 93,  0, 42, 98,105,
+110,100,119,101,105,103,104,116,115,  0, 42, 98,105,110,100, 99,111,115,  0, 40, 42, 98,105,110,100,102,117,110, 99, 41, 40, 41,
+  0, 42,112,115,121,115,  0,116,111,116,100,109,118,101,114,116,  0,116,111,116,100,109,101,100,103,101,  0,116,111,116,100,109,
+102, 97, 99,101,  0,112,111,115,105,116,105,111,110,  0,114, 97,110,100,111,109, 95,112,111,115,105,116,105,111,110,  0, 42,102,
+ 97, 99,101,112, 97,  0,118,103,114,111,117,112,  0,112,114,111,116,101, 99,116,  0,108,118,108,  0,115, 99,117,108,112,116,108,
+118,108,  0,116,111,116,108,118,108,  0,115,105,109,112,108,101,  0, 42,102,115,115,  0, 42,116, 97,114,103,101,116,  0, 42, 97,
+117,120, 84, 97,114,103,101,116,  0,118,103,114,111,117,112, 95,110, 97,109,101, 91, 54, 52, 93,  0,107,101,101,112, 68,105,115,
+116,  0,115,104,114,105,110,107, 84,121,112,101,  0,115,104,114,105,110,107, 79,112,116,115,  0,112,114,111,106, 65,120,105,115,
+  0,115,117, 98,115,117,114,102, 76,101,118,101,108,115,  0, 42,111,114,105,103,105,110,  0,102, 97, 99,116,111,114,  0,108,105,
+109,105,116, 91, 50, 93,  0,111,114,105,103,105,110, 79,112,116,115,  0,111,102,102,115,101,116, 95,102, 97, 99,  0,111,102,102,
+115,101,116, 95,102, 97, 99, 95,118,103,  0, 99,114,101, 97,115,101, 95,105,110,110,101,114,  0, 99,114,101, 97,115,101, 95,111,
+117,116,101,114,  0, 99,114,101, 97,115,101, 95,114,105,109,  0,109, 97,116, 95,111,102,115,  0,109, 97,116, 95,111,102,115, 95,
+114,105,109,  0, 42,111, 98, 95, 97,120,105,115,  0,115,116,101,112,115,  0,114,101,110,100,101,114, 95,115,116,101,112,115,  0,
+105,116,101,114,  0,115, 99,114,101,119, 95,111,102,115,  0, 97,110,103,108,101,  0, 42,111, 99,101, 97,110,  0, 42,111, 99,101,
+ 97,110, 99, 97, 99,104,101,  0,114,101,115,111,108,117,116,105,111,110,  0,115,112, 97,116,105, 97,108, 95,115,105,122,101,  0,
+119,105,110,100, 95,118,101,108,111, 99,105,116,121,  0,115,109, 97,108,108,101,115,116, 95,119, 97,118,101,  0,119, 97,118,101,
+ 95, 97,108,105,103,110,109,101,110,116,  0,119, 97,118,101, 95,100,105,114,101, 99,116,105,111,110,  0,119, 97,118,101, 95,115,
+ 99, 97,108,101,  0, 99,104,111,112, 95, 97,109,111,117,110,116,  0,102,111, 97,109, 95, 99,111,118,101,114, 97,103,101,  0, 98,
+ 97,107,101,115,116, 97,114,116,  0, 98, 97,107,101,101,110,100,  0, 99, 97, 99,104,101,112, 97,116,104, 91, 49, 48, 50, 52, 93,
+  0,102,111, 97,109,108, 97,121,101,114,110, 97,109,101, 91, 54, 52, 93,  0, 99, 97, 99,104,101,100,  0,103,101,111,109,101,116,
+114,121, 95,109,111,100,101,  0,114,101,102,114,101,115,104,  0,114,101,112,101, 97,116, 95,120,  0,114,101,112,101, 97,116, 95,
+121,  0,102,111, 97,109, 95,102, 97,100,101,  0, 42,111, 98,106,101, 99,116, 95,102,114,111,109,  0, 42,111, 98,106,101, 99,116,
+ 95,116,111,  0,102, 97,108,108,111,102,102, 95,114, 97,100,105,117,115,  0,101,100,105,116, 95,102,108, 97,103,115,  0,100,101,
+102, 97,117,108,116, 95,119,101,105,103,104,116,  0, 42, 99,109, 97,112, 95, 99,117,114,118,101,  0, 97,100,100, 95,116,104,114,
+101,115,104,111,108,100,  0,114,101,109, 95,116,104,114,101,115,104,111,108,100,  0,109, 97,115,107, 95, 99,111,110,115,116, 97,
+110,116,  0,109, 97,115,107, 95,100,101,102,103,114,112, 95,110, 97,109,101, 91, 54, 52, 93,  0,109, 97,115,107, 95,116,101,120,
+ 95,117,115,101, 95, 99,104, 97,110,110,101,108,  0, 42,109, 97,115,107, 95,116,101,120,116,117,114,101,  0, 42,109, 97,115,107,
+ 95,116,101,120, 95,109, 97,112, 95,111, 98,106,  0,109, 97,115,107, 95,116,101,120, 95,109, 97,112,112,105,110,103,  0,109, 97,
+115,107, 95,116,101,120, 95,117,118,108, 97,121,101,114, 95,110, 97,109,101, 91, 54, 52, 93,  0,112, 97,100, 95,105, 49,  0,100,
+101,102,103,114,112, 95,110, 97,109,101, 95, 97, 91, 54, 52, 93,  0,100,101,102,103,114,112, 95,110, 97,109,101, 95, 98, 91, 54,
+ 52, 93,  0,100,101,102, 97,117,108,116, 95,119,101,105,103,104,116, 95, 97,  0,100,101,102, 97,117,108,116, 95,119,101,105,103,
+104,116, 95, 98,  0,109,105,120, 95,109,111,100,101,  0,109,105,120, 95,115,101,116,  0,112, 97,100, 95, 99, 49, 91, 54, 93,  0,
+112,114,111,120,105,109,105,116,121, 95,109,111,100,101,  0,112,114,111,120,105,109,105,116,121, 95,102,108, 97,103,115,  0, 42,
+112,114,111,120,105,109,105,116,121, 95,111, 98, 95,116, 97,114,103,101,116,  0,109,105,110, 95,100,105,115,116,  0,109, 97,120,
+ 95,100,105,115,116,  0,112, 97,100, 95,115, 49,  0, 42, 99, 97,110,118, 97,115,  0, 42, 98,114,117,115,104,  0,116,104,114,101,
+115,104,111,108,100,  0,115, 99, 97,108,101,  0,104,101,114,109,105,116,101, 95,110,117,109,  0, 42,108, 97,116,116,  0,112,110,
+116,115,119,  0,111,112,110,116,115,117,  0,111,112,110,116,115,118,  0,111,112,110,116,115,119,  0,116,121,112,101,117,  0,116,
+121,112,101,118,  0,116,121,112,101,119,  0,102,117,  0,102,118,  0,102,119,  0,100,117,  0,100,118,  0,100,119,  0, 42,100,101,
+102,  0, 42,108, 97,116,116,105, 99,101,100, 97,116, 97,  0,108, 97,116,109, 97,116, 91, 52, 93, 91, 52, 93,  0, 42,101,100,105,
+116,108, 97,116,116,  0,118,101, 99, 91, 56, 93, 91, 51, 93,  0, 42,115, 99,117,108,112,116,  0,112, 97,114,116,121,112,101,  0,
+112, 97,114, 49,  0,112, 97,114, 50,  0,112, 97,114, 51,  0,112, 97,114,115,117, 98,115,116,114, 91, 54, 52, 93,  0, 42,116,114,
+ 97, 99,107,  0, 42,112,114,111,120,121,  0, 42,112,114,111,120,121, 95,103,114,111,117,112,  0, 42,112,114,111,120,121, 95,102,
+114,111,109,  0, 42, 97, 99,116,105,111,110,  0, 42,112,111,115,101,108,105, 98,  0, 42,112,111,115,101,  0, 42,103,112,100,  0,
+ 97,118,115,  0, 42,109,112, 97,116,104,  0, 99,111,110,115,116,114, 97,105,110,116, 67,104, 97,110,110,101,108,115,  0,101,102,
+102,101, 99,116,  0,100,101,102, 98, 97,115,101,  0,109,111,100,105,102,105,101,114,115,  0,114,101,115,116,111,114,101, 95,109,
+111,100,101,  0, 42,109, 97,116, 98,105,116,115,  0, 97, 99,116, 99,111,108,  0,100,108,111, 99, 91, 51, 93,  0,111,114,105,103,
+ 91, 51, 93,  0,100,115,105,122,101, 91, 51, 93,  0,100,115, 99, 97,108,101, 91, 51, 93,  0,100,114,111,116, 91, 51, 93,  0,100,
+113,117, 97,116, 91, 52, 93,  0,114,111,116, 65,120,105,115, 91, 51, 93,  0,100,114,111,116, 65,120,105,115, 91, 51, 93,  0,114,
+111,116, 65,110,103,108,101,  0,100,114,111,116, 65,110,103,108,101,  0,111, 98,109, 97,116, 91, 52, 93, 91, 52, 93,  0, 99,111,
+110,115,116,105,110,118, 91, 52, 93, 91, 52, 93,  0,105,109, 97,116, 95,114,101,110, 91, 52, 93, 91, 52, 93,  0,108, 97,121,  0,
+112, 97,100, 54,  0, 99,111,108, 98,105,116,115,  0,116,114, 97,110,115,102,108, 97,103,  0,112,114,111,116,101, 99,116,102,108,
+ 97,103,  0,116,114, 97, 99,107,102,108, 97,103,  0,117,112,102,108, 97,103,  0,110,108, 97,102,108, 97,103,  0,105,112,111,102,
+108, 97,103,  0,115, 99, 97,102,108, 97,103,  0,115, 99, 97,118,105,115,102,108, 97,103,  0,112, 97,100, 53,  0,100,117,112,111,
+110,  0,100,117,112,111,102,102,  0,100,117,112,115,116, 97,  0,100,117,112,101,110,100,  0,115,102,  0,109, 97,115,115,  0,100,
+ 97,109,112,105,110,103,  0,105,110,101,114,116,105, 97,  0,102,111,114,109,102, 97, 99,116,111,114,  0,114,100, 97,109,112,105,
+110,103,  0,109, 97,114,103,105,110,  0,109, 97,120, 95,118,101,108,  0,109,105,110, 95,118,101,108,  0,109, 95, 99,111,110,116,
+ 97, 99,116, 80,114,111, 99,101,115,115,105,110,103, 84,104,114,101,115,104,111,108,100,  0,111, 98,115,116, 97, 99,108,101, 82,
+ 97,100,  0,114,111,116,109,111,100,101,  0, 98,111,117,110,100,116,121,112,101,  0, 99,111,108,108,105,115,105,111,110, 95, 98,
+111,117,110,100,116,121,112,101,  0,114,101,115,116,114,105, 99,116,102,108, 97,103,  0,100,116,  0,101,109,112,116,121, 95,100,
+114, 97,119,116,121,112,101,  0,101,109,112,116,121, 95,100,114, 97,119,115,105,122,101,  0,100,117,112,102, 97, 99,101,115, 99,
+ 97,  0,112,114,111,112,  0,115,101,110,115,111,114,115,  0, 99,111,110,116,114,111,108,108,101,114,115,  0, 97, 99,116,117, 97,
+116,111,114,115,  0, 98, 98,115,105,122,101, 91, 51, 93,  0, 97, 99,116,100,101,102,  0,103, 97,109,101,102,108, 97,103,  0,103,
+ 97,109,101,102,108, 97,103, 50,  0, 42, 98,115,111,102,116,  0,115,111,102,116,102,108, 97,103,  0, 97,110,105,115,111,116,114,
+111,112,105, 99, 70,114,105, 99,116,105,111,110, 91, 51, 93,  0, 99,111,110,115,116,114, 97,105,110,116,115,  0,110,108, 97,115,
+116,114,105,112,115,  0,104,111,111,107,115,  0,112, 97,114,116,105, 99,108,101,115,121,115,116,101,109,  0, 42,115,111,102,116,
+  0, 42,100,117,112, 95,103,114,111,117,112,  0, 98,111,100,121, 95,116,121,112,101,  0,115,104, 97,112,101,102,108, 97,103,  0,
+ 42,102,108,117,105,100,115,105,109, 83,101,116,116,105,110,103,115,  0, 42,100,101,114,105,118,101,100, 68,101,102,111,114,109,
+  0, 42,100,101,114,105,118,101,100, 70,105,110, 97,108,  0,108, 97,115,116, 68, 97,116, 97, 77, 97,115,107,  0, 99,117,115,116,
+111,109,100, 97,116, 97, 95,109, 97,115,107,  0,115,116, 97,116,101,  0,105,110,105,116, 95,115,116, 97,116,101,  0,103,112,117,
+108, 97,109,112,  0,112, 99, 95,105,100,115,  0, 42,100,117,112,108,105,108,105,115,116,  0,105,109, 97, 95,111,102,115, 91, 50,
+ 93,  0, 99,117,114,105,110,100,101,120,  0, 97, 99,116,105,118,101,  0,111,114,105,103,108, 97,121,  0,111,109, 97,116, 91, 52,
+ 93, 91, 52, 93,  0,111,114, 99,111, 91, 51, 93,  0,110,111, 95,100,114, 97,119,  0, 97,110,105,109, 97,116,101,100,  0,100,101,
 102,108,101, 99,116,  0,102,111,114, 99,101,102,105,101,108,100,  0,115,104, 97,112,101,  0,116,101,120, 95,109,111,100,101,  0,
 107,105,110,107,  0,107,105,110,107, 95, 97,120,105,115,  0,122,100,105,114,  0,102, 95,115,116,114,101,110,103,116,104,  0,102,
  95,100, 97,109,112,  0,102, 95,102,108,111,119,  0,102, 95,115,105,122,101,  0,102, 95,112,111,119,101,114,  0,109, 97,120,100,
@@ -13921,708 +16198,809 @@ char datatoc_preview_blend[]= {
 121,  0,114,116, 91, 51, 93,  0,116,111,116,100, 97,116, 97,  0,102,114, 97,109,101,  0,116,111,116,112,111,105,110,116,  0,100,
  97,116, 97, 95,116,121,112,101,115,  0, 42,100, 97,116, 97, 91, 56, 93,  0, 42, 99,117,114, 91, 56, 93,  0,101,120,116,114, 97,
 100, 97,116, 97,  0,115,116,101,112,  0,115,105,109,102,114, 97,109,101,  0,115,116, 97,114,116,102,114, 97,109,101,  0,101,110,
-100,102,114, 97,109,101,  0,101,100,105,116,102,114, 97,109,101,  0,108, 97,115,116, 95,101,120, 97, 99,116,  0, 99,111,109,112,
-114,101,115,115,105,111,110,  0,110, 97,109,101, 91, 54, 52, 93,  0,112,114,101,118, 95,110, 97,109,101, 91, 54, 52, 93,  0,105,
-110,102,111, 91, 54, 52, 93,  0,112, 97,116,104, 91, 50, 52, 48, 93,  0, 42, 99, 97, 99,104,101,100, 95,102,114, 97,109,101,115,
-  0,109,101,109, 95, 99, 97, 99,104,101,  0, 42,101,100,105,116,  0, 40, 42,102,114,101,101, 95,101,100,105,116, 41, 40, 41,  0,
-108,105,110, 83,116,105,102,102,  0, 97,110,103, 83,116,105,102,102,  0,118,111,108,117,109,101,  0,118,105,116,101,114, 97,116,
-105,111,110,115,  0,112,105,116,101,114, 97,116,105,111,110,115,  0,100,105,116,101,114, 97,116,105,111,110,115,  0, 99,105,116,
-101,114, 97,116,105,111,110,115,  0,107, 83, 82, 72, 82, 95, 67, 76,  0,107, 83, 75, 72, 82, 95, 67, 76,  0,107, 83, 83, 72, 82,
- 95, 67, 76,  0,107, 83, 82, 95, 83, 80, 76, 84, 95, 67, 76,  0,107, 83, 75, 95, 83, 80, 76, 84, 95, 67, 76,  0,107, 83, 83, 95,
- 83, 80, 76, 84, 95, 67, 76,  0,107, 86, 67, 70,  0,107, 68, 80,  0,107, 68, 71,  0,107, 76, 70,  0,107, 80, 82,  0,107, 86, 67,
-  0,107, 68, 70,  0,107, 77, 84,  0,107, 67, 72, 82,  0,107, 75, 72, 82,  0,107, 83, 72, 82,  0,107, 65, 72, 82,  0, 99,111,108,
-108,105,115,105,111,110,102,108, 97,103,115,  0,110,117,109, 99,108,117,115,116,101,114,105,116,101,114, 97,116,105,111,110,115,
-  0,119,101,108,100,105,110,103,  0,116,111,116,115,112,114,105,110,103,  0, 42, 98,112,111,105,110,116,  0, 42, 98,115,112,114,
-105,110,103,  0,109,115,103, 95,108,111, 99,107,  0,109,115,103, 95,118, 97,108,117,101,  0,110,111,100,101,109, 97,115,115,  0,
-110, 97,109,101,100, 86, 71, 95, 77, 97,115,115, 91, 51, 50, 93,  0,103,114, 97,118,  0,109,101,100,105, 97,102,114,105, 99,116,
-  0,114,107,108,105,109,105,116,  0,112,104,121,115,105, 99,115, 95,115,112,101,101,100,  0,103,111, 97,108,115,112,114,105,110,
-103,  0,103,111, 97,108,102,114,105, 99,116,  0,109,105,110,103,111, 97,108,  0,109, 97,120,103,111, 97,108,  0,100,101,102,103,
-111, 97,108,  0,118,101,114,116,103,114,111,117,112,  0,110, 97,109,101,100, 86, 71, 95, 83,111,102,116,103,111, 97,108, 91, 51,
- 50, 93,  0,102,117,122,122,121,110,101,115,115,  0,105,110,115,112,114,105,110,103,  0,105,110,102,114,105, 99,116,  0,110, 97,
-109,101,100, 86, 71, 95, 83,112,114,105,110,103, 95, 75, 91, 51, 50, 93,  0,101,102,114, 97,  0,105,110,116,101,114,118, 97,108,
-  0,108,111, 99, 97,108,  0,115,111,108,118,101,114,102,108, 97,103,115,  0, 42, 42,107,101,121,115,  0,116,111,116,112,111,105,
-110,116,107,101,121,  0,115,101, 99,111,110,100,115,112,114,105,110,103,  0, 99,111,108, 98, 97,108,108,  0, 98, 97,108,108,100,
- 97,109,112,  0, 98, 97,108,108,115,116,105,102,102,  0,115, 98, 99, 95,109,111,100,101,  0, 97,101,114,111,101,100,103,101,  0,
-109,105,110,108,111,111,112,115,  0,109, 97,120,108,111,111,112,115,  0, 99,104,111,107,101,  0,115,111,108,118,101,114, 95, 73,
- 68,  0,112,108, 97,115,116,105, 99,  0,115,112,114,105,110,103,112,114,101,108,111, 97,100,  0, 42,115, 99,114, 97,116, 99,104,
-  0,115,104,101, 97,114,115,116,105,102,102,  0,105,110,112,117,115,104,  0, 42,112,111,105,110,116, 99, 97, 99,104,101,  0, 42,
-101,102,102,101, 99,116,111,114, 95,119,101,105,103,104,116,115,  0,108, 99,111,109, 91, 51, 93,  0,108,114,111,116, 91, 51, 93,
- 91, 51, 93,  0,108,115, 99, 97,108,101, 91, 51, 93, 91, 51, 93,  0,112, 97,100, 52, 91, 52, 93,  0,118,101,108, 91, 51, 93,  0,
- 42,102,109,100,  0,115,104,111,119, 95, 97,100,118, 97,110, 99,101,100,111,112,116,105,111,110,115,  0,114,101,115,111,108,117,
-116,105,111,110,120,121,122,  0,112,114,101,118,105,101,119,114,101,115,120,121,122,  0,114,101, 97,108,115,105,122,101,  0,103,
-117,105, 68,105,115,112,108, 97,121, 77,111,100,101,  0,114,101,110,100,101,114, 68,105,115,112,108, 97,121, 77,111,100,101,  0,
-118,105,115, 99,111,115,105,116,121, 86, 97,108,117,101,  0,118,105,115, 99,111,115,105,116,121, 77,111,100,101,  0,118,105,115,
- 99,111,115,105,116,121, 69,120,112,111,110,101,110,116,  0,103,114, 97,118, 91, 51, 93,  0, 97,110,105,109, 83,116, 97,114,116,
-  0, 97,110,105,109, 69,110,100,  0, 98, 97,107,101, 83,116, 97,114,116,  0, 98, 97,107,101, 69,110,100,  0,103,115,116, 97,114,
-  0,109, 97,120, 82,101,102,105,110,101,  0,105,110,105, 86,101,108,120,  0,105,110,105, 86,101,108,121,  0,105,110,105, 86,101,
-108,122,  0, 42,111,114,103, 77,101,115,104,  0, 42,109,101,115,104, 66, 66,  0,115,117,114,102,100, 97,116, 97, 80, 97,116,104,
- 91, 50, 52, 48, 93,  0, 98, 98, 83,116, 97,114,116, 91, 51, 93,  0, 98, 98, 83,105,122,101, 91, 51, 93,  0,116,121,112,101, 70,
-108, 97,103,115,  0,100,111,109, 97,105,110, 78,111,118,101, 99,103,101,110,  0,118,111,108,117,109,101, 73,110,105,116, 84,121,
-112,101,  0,112, 97,114,116, 83,108,105,112, 86, 97,108,117,101,  0,103,101,110,101,114, 97,116,101, 84,114, 97, 99,101,114,115,
-  0,103,101,110,101,114, 97,116,101, 80, 97,114,116,105, 99,108,101,115,  0,115,117,114,102, 97, 99,101, 83,109,111,111,116,104,
-105,110,103,  0,115,117,114,102, 97, 99,101, 83,117, 98,100,105,118,115,  0,112, 97,114,116,105, 99,108,101, 73,110,102, 83,105,
-122,101,  0,112, 97,114,116,105, 99,108,101, 73,110,102, 65,108,112,104, 97,  0,102, 97,114, 70,105,101,108,100, 83,105,122,101,
-  0, 42,109,101,115,104, 86,101,108,111, 99,105,116,105,101,115,  0, 99,112,115, 84,105,109,101, 83,116, 97,114,116,  0, 99,112,
-115, 84,105,109,101, 69,110,100,  0, 99,112,115, 81,117, 97,108,105,116,121,  0, 97,116,116,114, 97, 99,116,102,111,114, 99,101,
- 83,116,114,101,110,103,116,104,  0, 97,116,116,114, 97, 99,116,102,111,114, 99,101, 82, 97,100,105,117,115,  0,118,101,108,111,
- 99,105,116,121,102,111,114, 99,101, 83,116,114,101,110,103,116,104,  0,118,101,108,111, 99,105,116,121,102,111,114, 99,101, 82,
- 97,100,105,117,115,  0,108, 97,115,116,103,111,111,100,102,114, 97,109,101,  0,109,105,115,116,121,112,101,  0,104,111,114,114,
-  0,104,111,114,103,  0,104,111,114, 98,  0,122,101,110,114,  0,122,101,110,103,  0,122,101,110, 98,  0,102, 97,115,116, 99,111,
-108,  0,101,120,112,111,115,117,114,101,  0,101,120,112,  0,114, 97,110,103,101,  0,108,105,110,102, 97, 99,  0,108,111,103,102,
- 97, 99,  0,103,114, 97,118,105,116,121,  0, 97, 99,116,105,118,105,116,121, 66,111,120, 82, 97,100,105,117,115,  0,115,107,121,
-116,121,112,101,  0,111, 99, 99,108,117,115,105,111,110, 82,101,115,  0,112,104,121,115,105, 99,115, 69,110,103,105,110,101,  0,
-116,105, 99,114, 97,116,101,  0,109, 97,120,108,111,103,105, 99,115,116,101,112,  0,112,104,121,115,117, 98,115,116,101,112,  0,
-109, 97,120,112,104,121,115,116,101,112,  0,109,105,115,105,  0,109,105,115,116,115,116, 97,  0,109,105,115,116,100,105,115,116,
-  0,109,105,115,116,104,105,  0,115,116, 97,114,114,  0,115,116, 97,114,103,  0,115,116, 97,114, 98,  0,115,116, 97,114,107,  0,
-115,116, 97,114,115,105,122,101,  0,115,116, 97,114,109,105,110,100,105,115,116,  0,115,116, 97,114,100,105,115,116,  0,115,116,
- 97,114, 99,111,108,110,111,105,115,101,  0,100,111,102,115,116, 97,  0,100,111,102,101,110,100,  0,100,111,102,109,105,110,  0,
-100,111,102,109, 97,120,  0, 97,111,100,105,115,116,  0, 97,111,100,105,115,116,102, 97, 99,  0, 97,111,101,110,101,114,103,121,
-  0, 97,111, 98,105, 97,115,  0, 97,111,109,111,100,101,  0, 97,111,115, 97,109,112,  0, 97,111,109,105,120,  0, 97,111, 99,111,
-108,111,114,  0, 97,111, 95, 97,100, 97,112,116, 95,116,104,114,101,115,104,  0, 97,111, 95, 97,100, 97,112,116, 95,115,112,101,
-101,100, 95,102, 97, 99,  0, 97,111, 95, 97,112,112,114,111,120, 95,101,114,114,111,114,  0, 97,111, 95, 97,112,112,114,111,120,
- 95, 99,111,114,114,101, 99,116,105,111,110,  0, 97,111, 95,105,110,100,105,114,101, 99,116, 95,101,110,101,114,103,121,  0, 97,
-111, 95,101,110,118, 95,101,110,101,114,103,121,  0, 97,111, 95,112, 97,100, 50,  0, 97,111, 95,105,110,100,105,114,101, 99,116,
- 95, 98,111,117,110, 99,101,115,  0, 97,111, 95,112, 97,100,  0, 97,111, 95,115, 97,109,112, 95,109,101,116,104,111,100,  0, 97,
-111, 95,103, 97,116,104,101,114, 95,109,101,116,104,111,100,  0, 97,111, 95, 97,112,112,114,111,120, 95,112, 97,115,115,101,115,
-  0, 42, 97,111,115,112,104,101,114,101,  0, 42, 97,111,116, 97, 98,108,101,115,  0,112, 97,100, 91, 51, 93,  0,115,101,108, 99,
-111,108,  0,115,120,  0,115,121,  0, 42,108,112, 70,111,114,109, 97,116,  0, 42,108,112, 80, 97,114,109,115,  0, 99, 98, 70,111,
-114,109, 97,116,  0, 99, 98, 80, 97,114,109,115,  0,102, 99, 99, 84,121,112,101,  0,102, 99, 99, 72, 97,110,100,108,101,114,  0,
-100,119, 75,101,121, 70,114, 97,109,101, 69,118,101,114,121,  0,100,119, 81,117, 97,108,105,116,121,  0,100,119, 66,121,116,101,
-115, 80,101,114, 83,101, 99,111,110,100,  0,100,119, 70,108, 97,103,115,  0,100,119, 73,110,116,101,114,108,101, 97,118,101, 69,
-118,101,114,121,  0, 97,118,105, 99,111,100,101, 99,110, 97,109,101, 91, 49, 50, 56, 93,  0, 42, 99,100, 80, 97,114,109,115,  0,
- 42,112, 97,100,  0, 99,100, 83,105,122,101,  0,113,116, 99,111,100,101, 99,110, 97,109,101, 91, 49, 50, 56, 93,  0, 99,111,100,
-101, 99, 84,121,112,101,  0, 99,111,100,101, 99, 83,112, 97,116,105, 97,108, 81,117, 97,108,105,116,121,  0, 99,111,100,101, 99,
-  0, 99,111,100,101, 99, 70,108, 97,103,115,  0, 99,111,108,111,114, 68,101,112,116,104,  0, 99,111,100,101, 99, 84,101,109,112,
-111,114, 97,108, 81,117, 97,108,105,116,121,  0,109,105,110, 83,112, 97,116,105, 97,108, 81,117, 97,108,105,116,121,  0,109,105,
-110, 84,101,109,112,111,114, 97,108, 81,117, 97,108,105,116,121,  0,107,101,121, 70,114, 97,109,101, 82, 97,116,101,  0, 98,105,
-116, 82, 97,116,101,  0, 97,117,100,105,111, 99,111,100,101, 99, 84,121,112,101,  0, 97,117,100,105,111, 83, 97,109,112,108,101,
- 82, 97,116,101,  0, 97,117,100,105,111, 66,105,116, 68,101,112,116,104,  0, 97,117,100,105,111, 67,104, 97,110,110,101,108,115,
-  0, 97,117,100,105,111, 67,111,100,101, 99, 70,108, 97,103,115,  0, 97,117,100,105,111, 66,105,116, 82, 97,116,101,  0, 97,117,
-100,105,111, 95, 99,111,100,101, 99,  0,118,105,100,101,111, 95, 98,105,116,114, 97,116,101,  0, 97,117,100,105,111, 95, 98,105,
-116,114, 97,116,101,  0, 97,117,100,105,111, 95,109,105,120,114, 97,116,101,  0, 97,117,100,105,111, 95,118,111,108,117,109,101,
-  0,103,111,112, 95,115,105,122,101,  0,114, 99, 95,109,105,110, 95,114, 97,116,101,  0,114, 99, 95,109, 97,120, 95,114, 97,116,
-101,  0,114, 99, 95, 98,117,102,102,101,114, 95,115,105,122,101,  0,109,117,120, 95,112, 97, 99,107,101,116, 95,115,105,122,101,
-  0,109,117,120, 95,114, 97,116,101,  0,109,105,120,114, 97,116,101,  0,109, 97,105,110,  0,115,112,101,101,100, 95,111,102, 95,
-115,111,117,110,100,  0,100,111,112,112,108,101,114, 95,102, 97, 99,116,111,114,  0,100,105,115,116, 97,110, 99,101, 95,109,111,
-100,101,108,  0, 42,109, 97,116, 95,111,118,101,114,114,105,100,101,  0, 42,108,105,103,104,116, 95,111,118,101,114,114,105,100,
-101,  0,108, 97,121, 95,122,109, 97,115,107,  0,108, 97,121,102,108, 97,103,  0,112, 97,115,115,102,108, 97,103,  0,112, 97,115,
-115, 95,120,111,114,  0, 42, 97,118,105, 99,111,100,101, 99,100, 97,116, 97,  0, 42,113,116, 99,111,100,101, 99,100, 97,116, 97,
-  0,113,116, 99,111,100,101, 99,115,101,116,116,105,110,103,115,  0,102,102, 99,111,100,101, 99,100, 97,116, 97,  0,115,117, 98,
-102,114, 97,109,101,  0,112,115,102,114, 97,  0,112,101,102,114, 97,  0,105,109, 97,103,101,115,  0,102,114, 97,109, 97,112,116,
-111,  0,116,104,114,101, 97,100,115,  0,102,114, 97,109,101,108,101,110,  0, 98,108,117,114,102, 97, 99,  0,101,100,103,101, 82,
-  0,101,100,103,101, 71,  0,101,100,103,101, 66,  0,102,117,108,108,115, 99,114,101,101,110,  0,120,112,108, 97,121,  0,121,112,
-108, 97,121,  0,102,114,101,113,112,108, 97,121,  0, 97,116,116,114,105, 98,  0,102,114, 97,109,101, 95,115,116,101,112,  0,115,
-116,101,114,101,111,109,111,100,101,  0,100,105,109,101,110,115,105,111,110,115,112,114,101,115,101,116,  0,109, 97,120,105,109,
-115,105,122,101,  0,120,115, 99,104,  0,121,115, 99,104,  0,120,112, 97,114,116,115,  0,121,112, 97,114,116,115,  0,112,108, 97,
-110,101,115,  0,105,109,116,121,112,101,  0,115,117, 98,105,109,116,121,112,101,  0,113,117, 97,108,105,116,121,  0,100,105,115,
-112,108, 97,121,109,111,100,101,  0,115, 99,101,109,111,100,101,  0,114, 97,121,116,114, 97, 99,101, 95,111,112,116,105,111,110,
-115,  0,114, 97,121,116,114, 97, 99,101, 95,115,116,114,117, 99,116,117,114,101,  0,114,101,110,100,101,114,101,114,  0,111, 99,
-114,101,115,  0,112, 97,100, 52,  0, 97,108,112,104, 97,109,111,100,101,  0,111,115, 97,  0,102,114,115, 95,115,101, 99,  0,101,
-100,103,101,105,110,116,  0,115, 97,102,101,116,121,  0, 98,111,114,100,101,114,  0,100,105,115,112,114,101, 99,116,  0,108, 97,
-121,101,114,115,  0, 97, 99,116,108, 97,121,  0,109, 98,108,117,114, 95,115, 97,109,112,108,101,115,  0,120, 97,115,112,  0,121,
- 97,115,112,  0,102,114,115, 95,115,101, 99, 95, 98, 97,115,101,  0,103, 97,117,115,115,  0, 99,111,108,111,114, 95,109,103,116,
- 95,102,108, 97,103,  0,112,111,115,116,103, 97,109,109, 97,  0,112,111,115,116,104,117,101,  0,112,111,115,116,115, 97,116,  0,
-100,105,116,104,101,114, 95,105,110,116,101,110,115,105,116,121,  0, 98, 97,107,101, 95,111,115, 97,  0, 98, 97,107,101, 95,102,
-105,108,116,101,114,  0, 98, 97,107,101, 95,109,111,100,101,  0, 98, 97,107,101, 95,102,108, 97,103,  0, 98, 97,107,101, 95,110,
-111,114,109, 97,108, 95,115,112, 97, 99,101,  0, 98, 97,107,101, 95,113,117, 97,100, 95,115,112,108,105,116,  0, 98, 97,107,101,
- 95,109, 97,120,100,105,115,116,  0, 98, 97,107,101, 95, 98,105, 97,115,100,105,115,116,  0, 98, 97,107,101, 95,112, 97,100,  0,
-112,105, 99, 91, 50, 52, 48, 93,  0,115,116, 97,109,112,  0,115,116, 97,109,112, 95,102,111,110,116, 95,105,100,  0,115,116, 97,
-109,112, 95,117,100, 97,116, 97, 91, 49, 54, 48, 93,  0,102,103, 95,115,116, 97,109,112, 91, 52, 93,  0, 98,103, 95,115,116, 97,
-109,112, 91, 52, 93,  0,115,101,113, 95,112,114,101,118, 95,116,121,112,101,  0,115,101,113, 95,114,101,110,100, 95,116,121,112,
-101,  0,115,101,113, 95,102,108, 97,103,  0,112, 97,100, 53, 91, 53, 93,  0,115,105,109,112,108,105,102,121, 95,102,108, 97,103,
-  0,115,105,109,112,108,105,102,121, 95,115,117, 98,115,117,114,102,  0,115,105,109,112,108,105,102,121, 95,115,104, 97,100,111,
-119,115, 97,109,112,108,101,115,  0,115,105,109,112,108,105,102,121, 95,112, 97,114,116,105, 99,108,101,115,  0,115,105,109,112,
-108,105,102,121, 95, 97,111,115,115,115,  0, 99,105,110,101,111,110,119,104,105,116,101,  0, 99,105,110,101,111,110, 98,108, 97,
- 99,107,  0, 99,105,110,101,111,110,103, 97,109,109, 97,  0,106,112, 50, 95,112,114,101,115,101,116,  0,106,112, 50, 95,100,101,
-112,116,104,  0,114,112, 97,100, 51,  0,100,111,109,101,114,101,115,  0,100,111,109,101,109,111,100,101,  0,100,111,109,101, 97,
-110,103,108,101,  0,100,111,109,101,116,105,108,116,  0,100,111,109,101,114,101,115, 98,117,102,  0, 42,100,111,109,101,116,101,
-120,116,  0,101,110,103,105,110,101, 91, 51, 50, 93,  0,112, 97,114,116,105, 99,108,101, 95,112,101,114, 99,  0,115,117, 98,115,
-117,114,102, 95,109, 97,120,  0,115,104, 97,100, 98,117,102,115, 97,109,112,108,101, 95,109, 97,120,  0, 97,111, 95,101,114,114,
-111,114,  0,116,105,108,116,  0,114,101,115, 98,117,102,  0, 42,119, 97,114,112,116,101,120,116,  0, 99,111,108, 91, 51, 93,  0,
-109, 97,116,109,111,100,101,  0,102,114, 97,109,105,110,103,  0,114,116, 49,  0,114,116, 50,  0,100,111,109,101,  0,115,116,101,
-114,101,111,102,108, 97,103,  0,101,121,101,115,101,112, 97,114, 97,116,105,111,110,  0, 42, 99, 97,109,101,114, 97,  0, 42, 98,
-114,117,115,104,  0, 42,112, 97,105,110,116, 95, 99,117,114,115,111,114,  0,112, 97,105,110,116, 95, 99,117,114,115,111,114, 95,
- 99,111,108, 91, 52, 93,  0,112, 97,105,110,116,  0,115,101, 97,109, 95, 98,108,101,101,100,  0,110,111,114,109, 97,108, 95, 97,
-110,103,108,101,  0,115, 99,114,101,101,110, 95,103,114, 97, 98, 95,115,105,122,101, 91, 50, 93,  0, 42,112, 97,105,110,116, 99,
-117,114,115,111,114,  0,105,110,118,101,114,116,  0,116,111,116,114,101,107,101,121,  0,116,111,116, 97,100,100,107,101,121,  0,
- 98,114,117,115,104,116,121,112,101,  0, 98,114,117,115,104, 91, 55, 93,  0,101,109,105,116,116,101,114,100,105,115,116,  0,115,
-101,108,101, 99,116,109,111,100,101,  0,101,100,105,116,116,121,112,101,  0,100,114, 97,119, 95,115,116,101,112,  0,102, 97,100,
-101, 95,102,114, 97,109,101,115,  0,110, 97,109,101, 91, 51, 54, 93,  0,109, 97,116, 91, 51, 93, 91, 51, 93,  0,114, 97,100,105,
- 97,108, 95,115,121,109,109, 91, 51, 93,  0,108, 97,115,116, 95,120,  0,108, 97,115,116, 95,121,  0,108, 97,115,116, 95, 97,110,
-103,108,101,  0,100,114, 97,119, 95, 97,110, 99,104,111,114,101,100,  0, 97,110, 99,104,111,114,101,100, 95,115,105,122,101,  0,
- 97,110, 99,104,111,114,101,100, 95,108,111, 99, 97,116,105,111,110, 91, 51, 93,  0, 97,110, 99,104,111,114,101,100, 95,105,110,
-105,116,105, 97,108, 95,109,111,117,115,101, 91, 50, 93,  0,100,114, 97,119, 95,112,114,101,115,115,117,114,101,  0,112,114,101,
-115,115,117,114,101, 95,118, 97,108,117,101,  0,115,112,101, 99,105, 97,108, 95,114,111,116, 97,116,105,111,110,  0, 42,118,112,
- 97,105,110,116, 95,112,114,101,118,  0, 42,119,112, 97,105,110,116, 95,112,114,101,118,  0, 42,118,112, 97,105,110,116,  0, 42,
-119,112, 97,105,110,116,  0,118,103,114,111,117,112, 95,119,101,105,103,104,116,  0, 99,111,114,110,101,114,116,121,112,101,  0,
-101,100,105,116, 98,117,116,102,108, 97,103,  0,106,111,105,110,116,114,105,108,105,109,105,116,  0,100,101,103,114,  0,116,117,
-114,110,  0,101,120,116,114, 95,111,102,102,115,  0,100,111,117, 98,108,105,109,105,116,  0,110,111,114,109, 97,108,115,105,122,
-101,  0, 97,117,116,111,109,101,114,103,101,  0,115,101,103,109,101,110,116,115,  0,114,105,110,103,115,  0,118,101,114,116,105,
- 99,101,115,  0,117,110,119,114, 97,112,112,101,114,  0,117,118, 99, 97,108, 99, 95,114, 97,100,105,117,115,  0,117,118, 99, 97,
-108, 99, 95, 99,117, 98,101,115,105,122,101,  0,117,118, 99, 97,108, 99, 95,109, 97,114,103,105,110,  0,117,118, 99, 97,108, 99,
- 95,109, 97,112,100,105,114,  0,117,118, 99, 97,108, 99, 95,109, 97,112, 97,108,105,103,110,  0,117,118, 99, 97,108, 99, 95,102,
-108, 97,103,  0,117,118, 95,102,108, 97,103,  0,117,118, 95,115,101,108,101, 99,116,109,111,100,101,  0,117,118, 95,112, 97,100,
-  0,103,112,101,110, 99,105,108, 95,102,108, 97,103,115,  0, 97,117,116,111,105,107, 95, 99,104, 97,105,110,108,101,110,  0,105,
-109, 97,112, 97,105,110,116,  0,112, 97,114,116,105, 99,108,101,  0,112,114,111,112,111,114,116,105,111,110, 97,108, 95,115,105,
-122,101,  0,115,101,108,101, 99,116, 95,116,104,114,101,115,104,  0, 99,108,101, 97,110, 95,116,104,114,101,115,104,  0, 97,117,
-116,111,107,101,121, 95,109,111,100,101,  0, 97,117,116,111,107,101,121, 95,102,108, 97,103,  0,114,101,116,111,112,111, 95,109,
-111,100,101,  0,114,101,116,111,112,111, 95,112, 97,105,110,116, 95,116,111,111,108,  0,108,105,110,101, 95,100,105,118,  0,101,
-108,108,105,112,115,101, 95,100,105,118,  0,114,101,116,111,112,111, 95,104,111,116,115,112,111,116,  0,109,117,108,116,105,114,
-101,115, 95,115,117, 98,100,105,118, 95,116,121,112,101,  0,115,107,103,101,110, 95,114,101,115,111,108,117,116,105,111,110,  0,
-115,107,103,101,110, 95,116,104,114,101,115,104,111,108,100, 95,105,110,116,101,114,110, 97,108,  0,115,107,103,101,110, 95,116,
-104,114,101,115,104,111,108,100, 95,101,120,116,101,114,110, 97,108,  0,115,107,103,101,110, 95,108,101,110,103,116,104, 95,114,
- 97,116,105,111,  0,115,107,103,101,110, 95,108,101,110,103,116,104, 95,108,105,109,105,116,  0,115,107,103,101,110, 95, 97,110,
-103,108,101, 95,108,105,109,105,116,  0,115,107,103,101,110, 95, 99,111,114,114,101,108, 97,116,105,111,110, 95,108,105,109,105,
-116,  0,115,107,103,101,110, 95,115,121,109,109,101,116,114,121, 95,108,105,109,105,116,  0,115,107,103,101,110, 95,114,101,116,
- 97,114,103,101,116, 95, 97,110,103,108,101, 95,119,101,105,103,104,116,  0,115,107,103,101,110, 95,114,101,116, 97,114,103,101,
-116, 95,108,101,110,103,116,104, 95,119,101,105,103,104,116,  0,115,107,103,101,110, 95,114,101,116, 97,114,103,101,116, 95,100,
-105,115,116, 97,110, 99,101, 95,119,101,105,103,104,116,  0,115,107,103,101,110, 95,111,112,116,105,111,110,115,  0,115,107,103,
-101,110, 95,112,111,115,116,112,114,111,  0,115,107,103,101,110, 95,112,111,115,116,112,114,111, 95,112, 97,115,115,101,115,  0,
-115,107,103,101,110, 95,115,117, 98,100,105,118,105,115,105,111,110,115, 91, 51, 93,  0,115,107,103,101,110, 95,109,117,108,116,
-105, 95,108,101,118,101,108,  0, 42,115,107,103,101,110, 95,116,101,109,112,108, 97,116,101,  0, 98,111,110,101, 95,115,107,101,
-116, 99,104,105,110,103,  0, 98,111,110,101, 95,115,107,101,116, 99,104,105,110,103, 95, 99,111,110,118,101,114,116,  0,115,107,
-103,101,110, 95,115,117, 98,100,105,118,105,115,105,111,110, 95,110,117,109, 98,101,114,  0,115,107,103,101,110, 95,114,101,116,
- 97,114,103,101,116, 95,111,112,116,105,111,110,115,  0,115,107,103,101,110, 95,114,101,116, 97,114,103,101,116, 95,114,111,108,
-108,  0,115,107,103,101,110, 95,115,105,100,101, 95,115,116,114,105,110,103, 91, 56, 93,  0,115,107,103,101,110, 95,110,117,109,
- 95,115,116,114,105,110,103, 91, 56, 93,  0,101,100,103,101, 95,109,111,100,101,  0,101,100,103,101, 95,109,111,100,101, 95,108,
-105,118,101, 95,117,110,119,114, 97,112,  0,115,110, 97,112, 95,109,111,100,101,  0,115,110, 97,112, 95,102,108, 97,103,  0,115,
-110, 97,112, 95,116, 97,114,103,101,116,  0,112,114,111,112,111,114,116,105,111,110, 97,108,  0,112,114,111,112, 95,109,111,100,
-101,  0,112,114,111,112,111,114,116,105,111,110, 97,108, 95,111, 98,106,101, 99,116,115,  0, 97,117,116,111, 95,110,111,114,109,
- 97,108,105,122,101,  0,115, 99,117,108,112,116, 95,112, 97,105,110,116, 95,115,101,116,116,105,110,103,115,  0,115, 99,117,108,
-112,116, 95,112, 97,105,110,116, 95,117,110,105,102,105,101,100, 95,115,105,122,101,  0,115, 99,117,108,112,116, 95,112, 97,105,
-110,116, 95,117,110,105,102,105,101,100, 95,117,110,112,114,111,106,101, 99,116,101,100, 95,114, 97,100,105,117,115,  0,115, 99,
-117,108,112,116, 95,112, 97,105,110,116, 95,117,110,105,102,105,101,100, 95, 97,108,112,104, 97,  0,116,111,116,111, 98,106,  0,
-116,111,116,108, 97,109,112,  0,116,111,116,111, 98,106,115,101,108,  0,116,111,116, 99,117,114,118,101,  0,116,111,116,109,101,
-115,104,  0,116,111,116, 97,114,109, 97,116,117,114,101,  0,115, 99, 97,108,101, 95,108,101,110,103,116,104,  0,115,121,115,116,
-101,109,  0,115,121,115,116,101,109, 95,114,111,116, 97,116,105,111,110,  0,103,114, 97,118,105,116,121, 91, 51, 93,  0,113,117,
-105, 99,107, 95, 99, 97, 99,104,101, 95,115,116,101,112,  0, 42,119,111,114,108,100,  0, 42,115,101,116,  0, 98, 97,115,101,  0,
- 42, 98, 97,115, 97, 99,116,  0, 42,111, 98,101,100,105,116,  0, 99,117,114,115,111,114, 91, 51, 93,  0,116,119, 99,101,110,116,
- 91, 51, 93,  0,116,119,109,105,110, 91, 51, 93,  0,116,119,109, 97,120, 91, 51, 93,  0,108, 97,121, 97, 99,116,  0,108, 97,121,
- 95,117,112,100, 97,116,101,100,  0, 99,117,115,116,111,109,100, 97,116, 97, 95,109, 97,115,107, 95,109,111,100, 97,108,  0, 42,
-101,100,  0, 42,116,111,111,108,115,101,116,116,105,110,103,115,  0, 42,115,116, 97,116,115,  0, 97,117,100,105,111,  0,116,114,
- 97,110,115,102,111,114,109, 95,115,112, 97, 99,101,115,  0, 42,115,111,117,110,100, 95,115, 99,101,110,101,  0, 42,115,111,117,
-110,100, 95,115, 99,101,110,101, 95,104, 97,110,100,108,101,  0, 42,115,111,117,110,100, 95,115, 99,114,117, 98, 95,104, 97,110,
-100,108,101,  0, 42,102,112,115, 95,105,110,102,111,  0, 42,116,104,101, 68, 97,103,  0,100, 97,103,105,115,118, 97,108,105,100,
-  0,100, 97,103,102,108, 97,103,115,  0,112, 97,100, 54,  0,112, 97,100, 53,  0, 97, 99,116,105,118,101, 95,107,101,121,105,110,
-103,115,101,116,  0,107,101,121,105,110,103,115,101,116,115,  0,103,109,  0,117,110,105,116,  0,112,104,121,115,105, 99,115, 95,
-115,101,116,116,105,110,103,115,  0, 98,108,101,110,100,  0,118,105,101,119,  0,119,105,110,109, 97,116, 91, 52, 93, 91, 52, 93,
-  0,118,105,101,119,109, 97,116, 91, 52, 93, 91, 52, 93,  0,118,105,101,119,105,110,118, 91, 52, 93, 91, 52, 93,  0,112,101,114,
-115,109, 97,116, 91, 52, 93, 91, 52, 93,  0,112,101,114,115,105,110,118, 91, 52, 93, 91, 52, 93,  0,118,105,101,119,109, 97,116,
-111, 98, 91, 52, 93, 91, 52, 93,  0,112,101,114,115,109, 97,116,111, 98, 91, 52, 93, 91, 52, 93,  0,116,119,109, 97,116, 91, 52,
- 93, 91, 52, 93,  0,118,105,101,119,113,117, 97,116, 91, 52, 93,  0,122,102, 97, 99,  0, 99, 97,109,100,120,  0, 99, 97,109,100,
-121,  0,112,105,120,115,105,122,101,  0, 99, 97,109,122,111,111,109,  0,116,119,100,114, 97,119,102,108, 97,103,  0,105,115, 95,
-112,101,114,115,112,  0,114,102,108, 97,103,  0,118,105,101,119,108,111, 99,107,  0,112,101,114,115,112,  0, 99,108,105,112, 91,
- 54, 93, 91, 52, 93,  0, 99,108,105,112, 95,108,111, 99, 97,108, 91, 54, 93, 91, 52, 93,  0, 42, 99,108,105,112, 98, 98,  0, 42,
-108,111, 99, 97,108,118,100,  0, 42,114,105,  0, 42,100,101,112,116,104,115,  0, 42,115,109,115,  0, 42,115,109,111,111,116,104,
- 95,116,105,109,101,114,  0,108,118,105,101,119,113,117, 97,116, 91, 52, 93,  0,108,112,101,114,115,112,  0,108,118,105,101,119,
-  0,103,114,105,100,118,105,101,119,  0,116,119, 97,110,103,108,101, 91, 51, 93,  0,112, 97,100,102,  0,114,101,103,105,111,110,
- 98, 97,115,101,  0,115,112, 97, 99,101,116,121,112,101,  0, 98,108,111, 99,107,115, 99, 97,108,101,  0, 98,108,111, 99,107,104,
- 97,110,100,108,101,114, 91, 56, 93,  0,108, 97,121, 95,117,115,101,100,  0, 42,111, 98, 95, 99,101,110,116,114,101,  0, 98,103,
-112,105, 99, 98, 97,115,101,  0, 42, 98,103,112,105, 99,  0,111, 98, 95, 99,101,110,116,114,101, 95, 98,111,110,101, 91, 51, 50,
- 93,  0,100,114, 97,119,116,121,112,101,  0,111, 98, 95, 99,101,110,116,114,101, 95, 99,117,114,115,111,114,  0,115, 99,101,110,
-101,108,111, 99,107,  0, 97,114,111,117,110,100,  0,103,114,105,100,  0,110,101, 97,114,  0,102, 97,114,  0,109,111,100,101,115,
-101,108,101, 99,116,  0,103,114,105,100,108,105,110,101,115,  0,103,114,105,100,115,117, 98,100,105,118,  0,103,114,105,100,102,
-108, 97,103,  0,116,119,116,121,112,101,  0,116,119,109,111,100,101,  0,116,119,102,108, 97,103,  0,112, 97,100, 50, 91, 50, 93,
-  0, 97,102,116,101,114,100,114, 97,119, 95,116,114, 97,110,115,112,  0, 97,102,116,101,114,100,114, 97,119, 95,120,114, 97,121,
-  0, 97,102,116,101,114,100,114, 97,119, 95,120,114, 97,121,116,114, 97,110,115,112,  0,122, 98,117,102,  0,120,114, 97,121,  0,
-110,100,111,102,109,111,100,101,  0,110,100,111,102,102,105,108,116,101,114,  0, 42,112,114,111,112,101,114,116,105,101,115, 95,
-115,116,111,114, 97,103,101,  0,118,101,114,116,  0,104,111,114,  0,109, 97,115,107,  0,109,105,110, 91, 50, 93,  0,109, 97,120,
- 91, 50, 93,  0,109,105,110,122,111,111,109,  0,109, 97,120,122,111,111,109,  0,115, 99,114,111,108,108,  0,115, 99,114,111,108,
-108, 95,117,105,  0,107,101,101,112,116,111,116,  0,107,101,101,112,122,111,111,109,  0,107,101,101,112,111,102,115,  0, 97,108,
-105,103,110,  0,119,105,110,120,  0,119,105,110,121,  0,111,108,100,119,105,110,120,  0,111,108,100,119,105,110,121,  0, 42,116,
- 97, 98, 95,111,102,102,115,101,116,  0,116, 97, 98, 95,110,117,109,  0,116, 97, 98, 95, 99,117,114,  0,114,112,116, 95,109, 97,
-115,107,  0,118, 50,100,  0, 42, 97,100,115,  0,103,104,111,115,116, 67,117,114,118,101,115,  0, 97,117,116,111,115,110, 97,112,
-  0, 99,117,114,115,111,114, 86, 97,108,  0,109, 97,105,110, 98,  0,109, 97,105,110, 98,111,  0,109, 97,105,110, 98,117,115,101,
-114,  0,114,101, 95, 97,108,105,103,110,  0,112,114,101,118,105,101,119,  0,116,101,120,116,117,114,101, 95, 99,111,110,116,101,
-120,116,  0,112, 97,116,104,102,108, 97,103,  0,100, 97,116, 97,105, 99,111,110,  0, 42,112,105,110,105,100,  0,114,101,110,100,
-101,114, 95,115,105,122,101,  0, 99,104, 97,110,115,104,111,119,110,  0,122,101, 98,114, 97,  0,122,111,111,109,  0,116,105,116,
-108,101, 91, 51, 50, 93,  0,100,105,114, 91, 50, 52, 48, 93,  0,102,105,108,101, 91, 56, 48, 93,  0,114,101,110, 97,109,101,102,
-105,108,101, 91, 56, 48, 93,  0,114,101,110, 97,109,101,101,100,105,116, 91, 56, 48, 93,  0,102,105,108,116,101,114, 95,103,108,
-111, 98, 91, 54, 52, 93,  0, 97, 99,116,105,118,101, 95,102,105,108,101,  0,115,101,108, 95,102,105,114,115,116,  0,115,101,108,
- 95,108, 97,115,116,  0,115,111,114,116,  0,100,105,115,112,108, 97,121,  0,102, 95,102,112,  0,102,112, 95,115,116,114, 91, 56,
- 93,  0,115, 99,114,111,108,108, 95,111,102,102,115,101,116,  0, 42,112, 97,114, 97,109,115,  0, 42,102,105,108,101,115,  0, 42,
-102,111,108,100,101,114,115, 95,112,114,101,118,  0, 42,102,111,108,100,101,114,115, 95,110,101,120,116,  0, 42,111,112,  0, 42,
-115,109,111,111,116,104,115, 99,114,111,108,108, 95,116,105,109,101,114,  0, 42,108, 97,121,111,117,116,  0,114,101, 99,101,110,
-116,110,114,  0, 98,111,111,107,109, 97,114,107,110,114,  0,115,121,115,116,101,109,110,114,  0,116,114,101,101,  0, 42,116,114,
-101,101,115,116,111,114,101,  0,115,101, 97,114, 99,104, 95,115,116,114,105,110,103, 91, 51, 50, 93,  0,115,101, 97,114, 99,104,
- 95,116,115,101,  0,111,117,116,108,105,110,101,118,105,115,  0,115,116,111,114,101,102,108, 97,103,  0,115,101, 97,114, 99,104,
- 95,102,108, 97,103,115,  0, 42, 99,117,109, 97,112,  0,115, 99,111,112,101,115,  0,115, 97,109,112,108,101, 95,108,105,110,101,
- 95,104,105,115,116,  0, 99,117,114,115,111,114, 91, 50, 93,  0, 99,101,110,116,120,  0, 99,101,110,116,121,  0, 99,117,114,116,
-105,108,101,  0,105,109,116,121,112,101,110,114,  0,108,111, 99,107,  0,112,105,110,  0,100,116, 95,117,118,  0,115,116,105, 99,
-107,121,  0,100,116, 95,117,118,115,116,114,101,116, 99,104,  0, 42,116,101,120,116,  0,116,111,112,  0,118,105,101,119,108,105,
-110,101,115,  0,109,101,110,117,110,114,  0,108,104,101,105,103,104,116,  0, 99,119,105,100,116,104,  0,108,105,110,101,110,114,
-115, 95,116,111,116,  0,108,101,102,116,  0,115,104,111,119,108,105,110,101,110,114,115,  0,116, 97, 98,110,117,109, 98,101,114,
-  0,115,104,111,119,115,121,110,116, 97,120,  0,108,105,110,101, 95,104,108,105,103,104,116,  0,111,118,101,114,119,114,105,116,
-101,  0,108,105,118,101, 95,101,100,105,116,  0,112,105,120, 95,112,101,114, 95,108,105,110,101,  0,116,120,116,115, 99,114,111,
-108,108,  0,116,120,116, 98, 97,114,  0,119,111,114,100,119,114, 97,112,  0,100,111,112,108,117,103,105,110,115,  0,102,105,110,
-100,115,116,114, 91, 50, 53, 54, 93,  0,114,101,112,108, 97, 99,101,115,116,114, 91, 50, 53, 54, 93,  0,109, 97,114,103,105,110,
- 95, 99,111,108,117,109,110,  0, 42,100,114, 97,119, 99, 97, 99,104,101,  0, 42,112,121, 95,100,114, 97,119,  0, 42,112,121, 95,
-101,118,101,110,116,  0, 42,112,121, 95, 98,117,116,116,111,110,  0, 42,112,121, 95, 98,114,111,119,115,101,114, 99, 97,108,108,
- 98, 97, 99,107,  0, 42,112,121, 95,103,108,111, 98, 97,108,100,105, 99,116,  0,108, 97,115,116,115,112, 97, 99,101,  0,115, 99,
-114,105,112,116,110, 97,109,101, 91, 50, 53, 54, 93,  0,115, 99,114,105,112,116, 97,114,103, 91, 50, 53, 54, 93,  0, 42,115, 99,
-114,105,112,116,  0, 42, 98,117,116, 95,114,101,102,115,  0, 42, 97,114,114, 97,121,  0, 99, 97, 99,104,101,115,  0, 99, 97, 99,
-104,101, 95,100,105,115,112,108, 97,121,  0,114,101,100,114, 97,119,115,  0, 42,105,100,  0, 97,115,112,101, 99,116,  0, 42, 99,
-117,114,102,111,110,116,  0,109,120,  0,109,121,  0, 42,101,100,105,116,116,114,101,101,  0,116,114,101,101,116,121,112,101,  0,
-116,101,120,102,114,111,109,  0,108,105,110,107,100,114, 97,103,  0,116,105,116,108,101, 91, 50, 52, 93,  0,109,101,110,117,  0,
-110,117,109,116,105,108,101,115,120,  0,110,117,109,116,105,108,101,115,121,  0,115,101,108,115,116, 97,116,101,  0,118,105,101,
-119,114,101, 99,116,  0, 98,111,111,107,109, 97,114,107,114,101, 99,116,  0,115, 99,114,111,108,108,112,111,115,  0,115, 99,114,
-111,108,108,104,101,105,103,104,116,  0,115, 99,114,111,108,108, 97,114,101, 97,  0,114,101,116,118, 97,108,  0, 97, 99,116,105,
-118,101, 95, 98,111,111,107,109, 97,114,107,  0,112,114,118, 95,119,  0,112,114,118, 95,104,  0, 40, 42,114,101,116,117,114,110,
-102,117,110, 99, 41, 40, 41,  0, 40, 42,114,101,116,117,114,110,102,117,110, 99, 95,101,118,101,110,116, 41, 40, 41,  0, 40, 42,
-114,101,116,117,114,110,102,117,110, 99, 95, 97,114,103,115, 41, 40, 41,  0, 42, 97,114,103, 49,  0, 42, 97,114,103, 50,  0, 42,
-109,101,110,117,112,  0, 42,112,117,112,109,101,110,117,  0, 42,105,109,103,  0,108,101,110, 95, 97,108,108,111, 99,  0, 99,117,
-114,115,111,114,  0,115, 99,114,111,108,108, 98, 97, 99,107,  0,104,105,115,116,111,114,121,  0,112,114,111,109,112,116, 91, 50,
- 53, 54, 93,  0,108, 97,110,103,117, 97,103,101, 91, 51, 50, 93,  0,115,101,108, 95,115,116, 97,114,116,  0,115,101,108, 95,101,
-110,100,  0,102,105,108,116,101,114, 91, 54, 52, 93,  0, 42, 97,114,101, 97,  0, 42,115,111,117,110,100,  0,115,110,100,110,114,
-  0,102,105,108,101,110, 97,109,101, 91, 50, 53, 54, 93,  0, 98,108,102, 95,105,100,  0,117,105,102,111,110,116, 95,105,100,  0,
-114, 95,116,111, 95,108,  0,112,111,105,110,116,115,  0,107,101,114,110,105,110,103,  0,105,116, 97,108,105, 99,  0, 98,111,108,
-100,  0,115,104, 97,100,111,119,  0,115,104, 97,100,120,  0,115,104, 97,100,121,  0,115,104, 97,100,111,119, 97,108,112,104, 97,
-  0,115,104, 97,100,111,119, 99,111,108,111,114,  0,112, 97,110,101,108,116,105,116,108,101,  0,103,114,111,117,112,108, 97, 98,
-101,108,  0,119,105,100,103,101,116,108, 97, 98,101,108,  0,119,105,100,103,101,116,  0,112, 97,110,101,108,122,111,111,109,  0,
-109,105,110,108, 97, 98,101,108, 99,104, 97,114,115,  0,109,105,110,119,105,100,103,101,116, 99,104, 97,114,115,  0, 99,111,108,
-117,109,110,115,112, 97, 99,101,  0,116,101,109,112,108, 97,116,101,115,112, 97, 99,101,  0, 98,111,120,115,112, 97, 99,101,  0,
- 98,117,116,116,111,110,115,112, 97, 99,101,120,  0, 98,117,116,116,111,110,115,112, 97, 99,101,121,  0,112, 97,110,101,108,115,
-112, 97, 99,101,  0,112, 97,110,101,108,111,117,116,101,114,  0,112, 97,100, 91, 49, 93,  0,111,117,116,108,105,110,101, 91, 52,
- 93,  0,105,110,110,101,114, 91, 52, 93,  0,105,110,110,101,114, 95,115,101,108, 91, 52, 93,  0,105,116,101,109, 91, 52, 93,  0,
-116,101,120,116, 91, 52, 93,  0,116,101,120,116, 95,115,101,108, 91, 52, 93,  0,115,104, 97,100,101,100,  0,115,104, 97,100,101,
-116,111,112,  0,115,104, 97,100,101,100,111,119,110,  0, 97,108,112,104, 97, 95, 99,104,101, 99,107,  0,105,110,110,101,114, 95,
- 97,110,105,109, 91, 52, 93,  0,105,110,110,101,114, 95, 97,110,105,109, 95,115,101,108, 91, 52, 93,  0,105,110,110,101,114, 95,
-107,101,121, 91, 52, 93,  0,105,110,110,101,114, 95,107,101,121, 95,115,101,108, 91, 52, 93,  0,105,110,110,101,114, 95,100,114,
-105,118,101,110, 91, 52, 93,  0,105,110,110,101,114, 95,100,114,105,118,101,110, 95,115,101,108, 91, 52, 93,  0,119, 99,111,108,
- 95,114,101,103,117,108, 97,114,  0,119, 99,111,108, 95,116,111,111,108,  0,119, 99,111,108, 95,116,101,120,116,  0,119, 99,111,
-108, 95,114, 97,100,105,111,  0,119, 99,111,108, 95,111,112,116,105,111,110,  0,119, 99,111,108, 95,116,111,103,103,108,101,  0,
-119, 99,111,108, 95,110,117,109,  0,119, 99,111,108, 95,110,117,109,115,108,105,100,101,114,  0,119, 99,111,108, 95,109,101,110,
-117,  0,119, 99,111,108, 95,112,117,108,108,100,111,119,110,  0,119, 99,111,108, 95,109,101,110,117, 95, 98, 97, 99,107,  0,119,
- 99,111,108, 95,109,101,110,117, 95,105,116,101,109,  0,119, 99,111,108, 95, 98,111,120,  0,119, 99,111,108, 95,115, 99,114,111,
-108,108,  0,119, 99,111,108, 95,112,114,111,103,114,101,115,115,  0,119, 99,111,108, 95,108,105,115,116, 95,105,116,101,109,  0,
-119, 99,111,108, 95,115,116, 97,116,101,  0,105, 99,111,110,102,105,108,101, 91, 56, 48, 93,  0, 98, 97, 99,107, 91, 52, 93,  0,
-116,105,116,108,101, 91, 52, 93,  0,116,101,120,116, 95,104,105, 91, 52, 93,  0,104,101, 97,100,101,114, 91, 52, 93,  0,104,101,
- 97,100,101,114, 95,116,105,116,108,101, 91, 52, 93,  0,104,101, 97,100,101,114, 95,116,101,120,116, 91, 52, 93,  0,104,101, 97,
-100,101,114, 95,116,101,120,116, 95,104,105, 91, 52, 93,  0, 98,117,116,116,111,110, 91, 52, 93,  0, 98,117,116,116,111,110, 95,
-116,105,116,108,101, 91, 52, 93,  0, 98,117,116,116,111,110, 95,116,101,120,116, 91, 52, 93,  0, 98,117,116,116,111,110, 95,116,
-101,120,116, 95,104,105, 91, 52, 93,  0,108,105,115,116, 91, 52, 93,  0,108,105,115,116, 95,116,105,116,108,101, 91, 52, 93,  0,
-108,105,115,116, 95,116,101,120,116, 91, 52, 93,  0,108,105,115,116, 95,116,101,120,116, 95,104,105, 91, 52, 93,  0,112, 97,110,
-101,108, 91, 52, 93,  0,112, 97,110,101,108, 95,116,105,116,108,101, 91, 52, 93,  0,112, 97,110,101,108, 95,116,101,120,116, 91,
- 52, 93,  0,112, 97,110,101,108, 95,116,101,120,116, 95,104,105, 91, 52, 93,  0,115,104, 97,100,101, 49, 91, 52, 93,  0,115,104,
- 97,100,101, 50, 91, 52, 93,  0,104,105,108,105,116,101, 91, 52, 93,  0,103,114,105,100, 91, 52, 93,  0,119,105,114,101, 91, 52,
- 93,  0,115,101,108,101, 99,116, 91, 52, 93,  0,108, 97,109,112, 91, 52, 93,  0, 97, 99,116,105,118,101, 91, 52, 93,  0,103,114,
-111,117,112, 91, 52, 93,  0,103,114,111,117,112, 95, 97, 99,116,105,118,101, 91, 52, 93,  0,116,114, 97,110,115,102,111,114,109,
- 91, 52, 93,  0,118,101,114,116,101,120, 91, 52, 93,  0,118,101,114,116,101,120, 95,115,101,108,101, 99,116, 91, 52, 93,  0,101,
-100,103,101, 91, 52, 93,  0,101,100,103,101, 95,115,101,108,101, 99,116, 91, 52, 93,  0,101,100,103,101, 95,115,101, 97,109, 91,
- 52, 93,  0,101,100,103,101, 95,115,104, 97,114,112, 91, 52, 93,  0,101,100,103,101, 95,102, 97, 99,101,115,101,108, 91, 52, 93,
-  0,101,100,103,101, 95, 99,114,101, 97,115,101, 91, 52, 93,  0,102, 97, 99,101, 91, 52, 93,  0,102, 97, 99,101, 95,115,101,108,
-101, 99,116, 91, 52, 93,  0,102, 97, 99,101, 95,100,111,116, 91, 52, 93,  0,101,120,116,114, 97, 95,101,100,103,101, 95,108,101,
-110, 91, 52, 93,  0,101,120,116,114, 97, 95,102, 97, 99,101, 95, 97,110,103,108,101, 91, 52, 93,  0,101,120,116,114, 97, 95,102,
- 97, 99,101, 95, 97,114,101, 97, 91, 52, 93,  0,112, 97,100, 51, 91, 52, 93,  0,110,111,114,109, 97,108, 91, 52, 93,  0,118,101,
-114,116,101,120, 95,110,111,114,109, 97,108, 91, 52, 93,  0, 98,111,110,101, 95,115,111,108,105,100, 91, 52, 93,  0, 98,111,110,
-101, 95,112,111,115,101, 91, 52, 93,  0,115,116,114,105,112, 91, 52, 93,  0,115,116,114,105,112, 95,115,101,108,101, 99,116, 91,
- 52, 93,  0, 99,102,114, 97,109,101, 91, 52, 93,  0,110,117,114, 98, 95,117,108,105,110,101, 91, 52, 93,  0,110,117,114, 98, 95,
-118,108,105,110,101, 91, 52, 93,  0, 97, 99,116, 95,115,112,108,105,110,101, 91, 52, 93,  0,110,117,114, 98, 95,115,101,108, 95,
-117,108,105,110,101, 91, 52, 93,  0,110,117,114, 98, 95,115,101,108, 95,118,108,105,110,101, 91, 52, 93,  0,108, 97,115,116,115,
-101,108, 95,112,111,105,110,116, 91, 52, 93,  0,104, 97,110,100,108,101, 95,102,114,101,101, 91, 52, 93,  0,104, 97,110,100,108,
-101, 95, 97,117,116,111, 91, 52, 93,  0,104, 97,110,100,108,101, 95,118,101, 99,116, 91, 52, 93,  0,104, 97,110,100,108,101, 95,
- 97,108,105,103,110, 91, 52, 93,  0,104, 97,110,100,108,101, 95,115,101,108, 95,102,114,101,101, 91, 52, 93,  0,104, 97,110,100,
-108,101, 95,115,101,108, 95, 97,117,116,111, 91, 52, 93,  0,104, 97,110,100,108,101, 95,115,101,108, 95,118,101, 99,116, 91, 52,
- 93,  0,104, 97,110,100,108,101, 95,115,101,108, 95, 97,108,105,103,110, 91, 52, 93,  0,100,115, 95, 99,104, 97,110,110,101,108,
- 91, 52, 93,  0,100,115, 95,115,117, 98, 99,104, 97,110,110,101,108, 91, 52, 93,  0, 99,111,110,115,111,108,101, 95,111,117,116,
-112,117,116, 91, 52, 93,  0, 99,111,110,115,111,108,101, 95,105,110,112,117,116, 91, 52, 93,  0, 99,111,110,115,111,108,101, 95,
-105,110,102,111, 91, 52, 93,  0, 99,111,110,115,111,108,101, 95,101,114,114,111,114, 91, 52, 93,  0, 99,111,110,115,111,108,101,
- 95, 99,117,114,115,111,114, 91, 52, 93,  0,118,101,114,116,101,120, 95,115,105,122,101,  0,111,117,116,108,105,110,101, 95,119,
-105,100,116,104,  0,102, 97, 99,101,100,111,116, 95,115,105,122,101,  0, 98,112, 97,100,  0,115,121,110,116, 97,120,108, 91, 52,
- 93,  0,115,121,110,116, 97,120,110, 91, 52, 93,  0,115,121,110,116, 97,120, 98, 91, 52, 93,  0,115,121,110,116, 97,120,118, 91,
- 52, 93,  0,115,121,110,116, 97,120, 99, 91, 52, 93,  0,109,111,118,105,101, 91, 52, 93,  0,105,109, 97,103,101, 91, 52, 93,  0,
-115, 99,101,110,101, 91, 52, 93,  0, 97,117,100,105,111, 91, 52, 93,  0,101,102,102,101, 99,116, 91, 52, 93,  0,112,108,117,103,
-105,110, 91, 52, 93,  0,116,114, 97,110,115,105,116,105,111,110, 91, 52, 93,  0,109,101,116, 97, 91, 52, 93,  0,101,100,105,116,
-109,101,115,104, 95, 97, 99,116,105,118,101, 91, 52, 93,  0,104, 97,110,100,108,101, 95,118,101,114,116,101,120, 91, 52, 93,  0,
-104, 97,110,100,108,101, 95,118,101,114,116,101,120, 95,115,101,108,101, 99,116, 91, 52, 93,  0,104, 97,110,100,108,101, 95,118,
-101,114,116,101,120, 95,115,105,122,101,  0,104,112, 97,100, 91, 55, 93,  0,112,114,101,118,105,101,119, 95, 98, 97, 99,107, 91,
- 52, 93,  0,115,111,108,105,100, 91, 52, 93,  0,116,117,105,  0,116, 98,117,116,115,  0,116,118, 51,100,  0,116,102,105,108,101,
-  0,116,105,112,111,  0,116,105,110,102,111,  0,116,115,110,100,  0,116, 97, 99,116,  0,116,110,108, 97,  0,116,115,101,113,  0,
-116,105,109, 97,  0,116,105,109, 97,115,101,108,  0,116,101,120,116,  0,116,111,111,112,115,  0,116,116,105,109,101,  0,116,110,
-111,100,101,  0,116,108,111,103,105, 99,  0,116,117,115,101,114,112,114,101,102,  0,116, 99,111,110,115,111,108,101,  0,116, 97,
-114,109, 91, 50, 48, 93,  0, 97, 99,116,105,118,101, 95,116,104,101,109,101, 95, 97,114,101, 97,  0,109,111,100,117,108,101, 91,
- 54, 52, 93,  0,115,112,101, 99, 91, 52, 93,  0,100,117,112,102,108, 97,103,  0,115, 97,118,101,116,105,109,101,  0,116,101,109,
-112,100,105,114, 91, 49, 54, 48, 93,  0,102,111,110,116,100,105,114, 91, 49, 54, 48, 93,  0,114,101,110,100,101,114,100,105,114,
- 91, 50, 52, 48, 93,  0,116,101,120,116,117,100,105,114, 91, 49, 54, 48, 93,  0,112,108,117,103,116,101,120,100,105,114, 91, 49,
- 54, 48, 93,  0,112,108,117,103,115,101,113,100,105,114, 91, 49, 54, 48, 93,  0,112,121,116,104,111,110,100,105,114, 91, 49, 54,
- 48, 93,  0,115,111,117,110,100,100,105,114, 91, 49, 54, 48, 93,  0,105,109, 97,103,101, 95,101,100,105,116,111,114, 91, 50, 52,
- 48, 93,  0, 97,110,105,109, 95,112,108, 97,121,101,114, 91, 50, 52, 48, 93,  0, 97,110,105,109, 95,112,108, 97,121,101,114, 95,
-112,114,101,115,101,116,  0,118, 50,100, 95,109,105,110, 95,103,114,105,100,115,105,122,101,  0,116,105,109,101, 99,111,100,101,
- 95,115,116,121,108,101,  0,118,101,114,115,105,111,110,115,  0,100, 98,108, 95, 99,108,105, 99,107, 95,116,105,109,101,  0,103,
- 97,109,101,102,108, 97,103,115,  0,119,104,101,101,108,108,105,110,101,115, 99,114,111,108,108,  0,117,105,102,108, 97,103,  0,
-108, 97,110,103,117, 97,103,101,  0,117,115,101,114,112,114,101,102,  0,118,105,101,119,122,111,111,109,  0,109,105,120, 98,117,
-102,115,105,122,101,  0, 97,117,100,105,111,100,101,118,105, 99,101,  0, 97,117,100,105,111,114, 97,116,101,  0, 97,117,100,105,
-111,102,111,114,109, 97,116,  0, 97,117,100,105,111, 99,104, 97,110,110,101,108,115,  0,100,112,105,  0,101,110, 99,111,100,105,
-110,103,  0,116,114, 97,110,115,111,112,116,115,  0,109,101,110,117,116,104,114,101,115,104,111,108,100, 49,  0,109,101,110,117,
-116,104,114,101,115,104,111,108,100, 50,  0,116,104,101,109,101,115,  0,117,105,102,111,110,116,115,  0,117,105,115,116,121,108,
-101,115,  0,107,101,121,109, 97,112,115,  0, 97,100,100,111,110,115,  0,107,101,121, 99,111,110,102,105,103,115,116,114, 91, 54,
- 52, 93,  0,117,110,100,111,115,116,101,112,115,  0,117,110,100,111,109,101,109,111,114,121,  0,103,112, 95,109, 97,110,104, 97,
-116,116,101,110,100,105,115,116,  0,103,112, 95,101,117, 99,108,105,100,101, 97,110,100,105,115,116,  0,103,112, 95,101,114, 97,
-115,101,114,  0,103,112, 95,115,101,116,116,105,110,103,115,  0,116, 98, 95,108,101,102,116,109,111,117,115,101,  0,116, 98, 95,
-114,105,103,104,116,109,111,117,115,101,  0,108,105,103,104,116, 91, 51, 93,  0,116,119, 95,104,111,116,115,112,111,116,  0,116,
-119, 95,102,108, 97,103,  0,116,119, 95,104, 97,110,100,108,101,115,105,122,101,  0,116,119, 95,115,105,122,101,  0,116,101,120,
-116,105,109,101,111,117,116,  0,116,101,120, 99,111,108,108,101, 99,116,114, 97,116,101,  0,119,109,100,114, 97,119,109,101,116,
-104,111,100,  0,100,114, 97,103,116,104,114,101,115,104,111,108,100,  0,109,101,109, 99, 97, 99,104,101,108,105,109,105,116,  0,
-112,114,101,102,101,116, 99,104,102,114, 97,109,101,115,  0,102,114, 97,109,101,115,101,114,118,101,114,112,111,114,116,  0,112,
- 97,100, 95,114,111,116, 95, 97,110,103,108,101,  0,111, 98, 99,101,110,116,101,114, 95,100,105, 97,  0,114,118,105,115,105,122,
-101,  0,114,118,105, 98,114,105,103,104,116,  0,114,101, 99,101,110,116, 95,102,105,108,101,115,  0,115,109,111,111,116,104, 95,
-118,105,101,119,116,120,  0,103,108,114,101,115,108,105,109,105,116,  0,110,100,111,102, 95,112, 97,110,  0,110,100,111,102, 95,
-114,111,116, 97,116,101,  0, 99,117,114,115,115,105,122,101,  0, 99,111,108,111,114, 95,112,105, 99,107,101,114, 95,116,121,112,
-101,  0,105,112,111, 95,110,101,119,  0,107,101,121,104, 97,110,100,108,101,115, 95,110,101,119,  0,115, 99,114, 99, 97,115,116,
-102,112,115,  0,115, 99,114, 99, 97,115,116,119, 97,105,116,  0,119,105,100,103,101,116, 95,117,110,105,116,  0, 97,110,105,115,
-111,116,114,111,112,105, 99, 95,102,105,108,116,101,114,  0,118,101,114,115,101,109, 97,115,116,101,114, 91, 49, 54, 48, 93,  0,
-118,101,114,115,101,117,115,101,114, 91, 49, 54, 48, 93,  0,103,108, 97,108,112,104, 97, 99,108,105,112,  0,116,101,120,116, 95,
-114,101,110,100,101,114,  0,112, 97,100, 57,  0, 99,111, 98, 97, 95,119,101,105,103,104,116,  0,115, 99,117,108,112,116, 95,112,
- 97,105,110,116, 95,111,118,101,114,108, 97,121, 95, 99,111,108, 91, 51, 93,  0, 97,117,116,104,111,114, 91, 56, 48, 93,  0,118,
-101,114,116, 98, 97,115,101,  0,101,100,103,101, 98, 97,115,101,  0, 97,114,101, 97, 98, 97,115,101,  0, 42,110,101,119,115, 99,
-101,110,101,  0,114,101,100,114, 97,119,115, 95,102,108, 97,103,  0,102,117,108,108,  0,116,101,109,112,  0,119,105,110,105,100,
-  0,100,111, 95,100,114, 97,119,  0,100,111, 95,114,101,102,114,101,115,104,  0,100,111, 95,100,114, 97,119, 95,103,101,115,116,
-117,114,101,  0,100,111, 95,100,114, 97,119, 95,112, 97,105,110,116, 99,117,114,115,111,114,  0,100,111, 95,100,114, 97,119, 95,
-100,114, 97,103,  0,115,119, 97,112,  0,109, 97,105,110,119,105,110,  0,115,117, 98,119,105,110, 97, 99,116,105,118,101,  0, 42,
- 97,110,105,109,116,105,109,101,114,  0, 42, 99,111,110,116,101,120,116,  0,104, 97,110,100,108,101,114, 91, 56, 93,  0, 42,110,
-101,119,118,  0,118,101, 99,  0, 42,118, 49,  0, 42,118, 50,  0, 42,116,121,112,101,  0,112, 97,110,101,108,110, 97,109,101, 91,
- 54, 52, 93,  0,116, 97, 98,110, 97,109,101, 91, 54, 52, 93,  0,100,114, 97,119,110, 97,109,101, 91, 54, 52, 93,  0,111,102,115,
-120,  0,111,102,115,121,  0,115,105,122,101,120,  0,115,105,122,101,121,  0,108, 97, 98,101,108,111,102,115,  0,114,117,110,116,
-105,109,101, 95,102,108, 97,103,  0, 99,111,110,116,114,111,108,  0,115,110, 97,112,  0,115,111,114,116,111,114,100,101,114,  0,
- 42,112, 97,110,101,108,116, 97, 98,  0, 42, 97, 99,116,105,118,101,100, 97,116, 97,  0,108,105,115,116, 95,115, 99,114,111,108,
-108,  0,108,105,115,116, 95,115,105,122,101,  0,108,105,115,116, 95,108, 97,115,116, 95,108,101,110,  0,108,105,115,116, 95,103,
-114,105,112, 95,115,105,122,101,  0,108,105,115,116, 95,115,101, 97,114, 99,104, 91, 54, 52, 93,  0, 42,118, 51,  0, 42,118, 52,
-  0, 42,102,117,108,108,  0, 98,117,116,115,112, 97, 99,101,116,121,112,101,  0,104,101, 97,100,101,114,116,121,112,101,  0,115,
-112, 97, 99,101,100, 97,116, 97,  0,104, 97,110,100,108,101,114,115,  0, 97, 99,116,105,111,110,122,111,110,101,115,  0,119,105,
-110,114, 99,116,  0,100,114, 97,119,114, 99,116,  0,115,119,105,110,105,100,  0,114,101,103,105,111,110,116,121,112,101,  0, 97,
-108,105,103,110,109,101,110,116,  0,100,111, 95,100,114, 97,119, 95,111,118,101,114,108, 97,121,  0,117,105, 98,108,111, 99,107,
-115,  0,112, 97,110,101,108,115,  0, 42,104,101, 97,100,101,114,115,116,114,  0, 42,114,101,103,105,111,110,100, 97,116, 97,  0,
-115,117, 98,118,115,116,114, 91, 52, 93,  0,115,117, 98,118,101,114,115,105,111,110,  0,112, 97,100,115,  0,109,105,110,118,101,
-114,115,105,111,110,  0,109,105,110,115,117, 98,118,101,114,115,105,111,110,  0,119,105,110,112,111,115,  0, 42, 99,117,114,115,
- 99,114,101,101,110,  0, 42, 99,117,114,115, 99,101,110,101,  0,102,105,108,101,102,108, 97,103,115,  0,103,108,111, 98, 97,108,
-102,  0,114,101,118,105,115,105,111,110,  0,102,105,108,101,110, 97,109,101, 91, 50, 52, 48, 93,  0,110, 97,109,101, 91, 56, 48,
- 93,  0,111,114,105,103, 95,119,105,100,116,104,  0,111,114,105,103, 95,104,101,105,103,104,116,  0, 98,111,116,116,111,109,  0,
-114,105,103,104,116,  0,120,111,102,115,  0,121,111,102,115,  0,108,105,102,116, 91, 51, 93,  0,103, 97,109,109, 97, 91, 51, 93,
-  0,103, 97,105,110, 91, 51, 93,  0,100,105,114, 91, 49, 54, 48, 93,  0,100,111,110,101,  0,115,116, 97,114,116,115,116,105,108,
-108,  0,101,110,100,115,116,105,108,108,  0, 42,115,116,114,105,112,100, 97,116, 97,  0, 42, 99,114,111,112,  0, 42,116,114, 97,
-110,115,102,111,114,109,  0, 42, 99,111,108,111,114, 95, 98, 97,108, 97,110, 99,101,  0, 42,105,110,115,116, 97,110, 99,101, 95,
-112,114,105,118, 97,116,101, 95,100, 97,116, 97,  0, 42, 42, 99,117,114,114,101,110,116, 95,112,114,105,118, 97,116,101, 95,100,
- 97,116, 97,  0, 42,116,109,112,  0,115,116, 97,114,116,111,102,115,  0,101,110,100,111,102,115,  0,109, 97, 99,104,105,110,101,
-  0,115,116, 97,114,116,100,105,115,112,  0,101,110,100,100,105,115,112,  0,115, 97,116,  0,109,117,108,  0,104, 97,110,100,115,
-105,122,101,  0, 97,110,105,109, 95,112,114,101,115,101,101,107,  0, 42,115,116,114,105,112,  0, 42,115, 99,101,110,101, 95, 99,
- 97,109,101,114, 97,  0,101,102,102,101, 99,116, 95,102, 97,100,101,114,  0,115,112,101,101,100, 95,102, 97,100,101,114,  0, 42,
-115,101,113, 49,  0, 42,115,101,113, 50,  0, 42,115,101,113, 51,  0,115,101,113, 98, 97,115,101,  0, 42,115, 99,101,110,101, 95,
-115,111,117,110,100,  0,108,101,118,101,108,  0,112, 97,110,  0,115, 99,101,110,101,110,114,  0,109,117,108,116,105, 99, 97,109,
- 95,115,111,117,114, 99,101,  0,115,116,114,111, 98,101,  0, 42,101,102,102,101, 99,116,100, 97,116, 97,  0, 97,110,105,109, 95,
-115,116, 97,114,116,111,102,115,  0, 97,110,105,109, 95,101,110,100,111,102,115,  0, 98,108,101,110,100, 95,109,111,100,101,  0,
- 98,108,101,110,100, 95,111,112, 97, 99,105,116,121,  0, 42,111,108,100, 98, 97,115,101,112,  0, 42,112, 97,114,115,101,113,  0,
- 42,115,101,113, 98, 97,115,101,112,  0,109,101,116, 97,115,116, 97, 99,107,  0, 42, 97, 99,116, 95,115,101,113,  0, 97, 99,116,
- 95,105,109, 97,103,101,100,105,114, 91, 50, 53, 54, 93,  0, 97, 99,116, 95,115,111,117,110,100,100,105,114, 91, 50, 53, 54, 93,
-  0,111,118,101,114, 95,111,102,115,  0,111,118,101,114, 95, 99,102,114, 97,  0,111,118,101,114, 95,102,108, 97,103,  0,111,118,
-101,114, 95, 98,111,114,100,101,114,  0,101,100,103,101, 87,105,100,116,104,  0,102,111,114,119, 97,114,100,  0,119,105,112,101,
-116,121,112,101,  0,102, 77,105,110,105,  0,102, 67,108, 97,109,112,  0,102, 66,111,111,115,116,  0,100, 68,105,115,116,  0,100,
- 81,117, 97,108,105,116,121,  0, 98, 78,111, 67,111,109,112,  0, 83, 99, 97,108,101,120, 73,110,105,  0, 83, 99, 97,108,101,121,
- 73,110,105,  0, 83, 99, 97,108,101,120, 70,105,110,  0, 83, 99, 97,108,101,121, 70,105,110,  0,120, 73,110,105,  0,120, 70,105,
-110,  0,121, 73,110,105,  0,121, 70,105,110,  0,114,111,116, 73,110,105,  0,114,111,116, 70,105,110,  0,105,110,116,101,114,112,
-111,108, 97,116,105,111,110,  0,117,110,105,102,111,114,109, 95,115, 99, 97,108,101,  0, 42,102,114, 97,109,101, 77, 97,112,  0,
-103,108,111, 98, 97,108, 83,112,101,101,100,  0,108, 97,115,116, 86, 97,108,105,100, 70,114, 97,109,101,  0, 98,117,116,116,121,
-112,101,  0,117,115,101,114,106,105,116,  0,115,116, 97,  0,116,111,116,112, 97,114,116,  0,110,111,114,109,102, 97, 99,  0,111,
- 98,102, 97, 99,  0,114, 97,110,100,102, 97, 99,  0,116,101,120,102, 97, 99,  0,114, 97,110,100,108,105,102,101,  0,102,111,114,
- 99,101, 91, 51, 93,  0,118,101, 99,116,115,105,122,101,  0,109, 97,120,108,101,110,  0,100,101,102,118,101, 99, 91, 51, 93,  0,
-109,117,108,116, 91, 52, 93,  0,108,105,102,101, 91, 52, 93,  0, 99,104,105,108,100, 91, 52, 93,  0,109, 97,116, 91, 52, 93,  0,
-116,101,120,109, 97,112,  0, 99,117,114,109,117,108,116,  0,115,116, 97,116,105, 99,115,116,101,112,  0,111,109, 97,116,  0,116,
-105,109,101,116,101,120,  0,115,112,101,101,100,116,101,120,  0,102,108, 97,103, 50,110,101,103,  0,118,101,114,116,103,114,111,
-117,112, 95,118,  0,118,103,114,111,117,112,110, 97,109,101, 91, 51, 50, 93,  0,118,103,114,111,117,112,110, 97,109,101, 95,118,
- 91, 51, 50, 93,  0, 42,107,101,121,115,  0,109,105,110,102, 97, 99,  0,110,114,  0,117,115,101,100,  0,117,115,101,100,101,108,
-101,109,  0, 42,112,111,105,110,  0,114,101,115,101,116,100,105,115,116,  0,108, 97,115,116,118, 97,108,  0, 42,109, 97,  0,107,
-101,121,  0,113,117, 97,108,  0,113,117, 97,108, 50,  0,116, 97,114,103,101,116, 78, 97,109,101, 91, 51, 50, 93,  0,116,111,103,
-103,108,101, 78, 97,109,101, 91, 51, 50, 93,  0,118, 97,108,117,101, 91, 51, 50, 93,  0,109, 97,120,118, 97,108,117,101, 91, 51,
- 50, 93,  0,100,101,108, 97,121,  0,100,117,114, 97,116,105,111,110,  0,109, 97,116,101,114,105, 97,108, 78, 97,109,101, 91, 51,
- 50, 93,  0,100, 97,109,112,116,105,109,101,114,  0,112,114,111,112,110, 97,109,101, 91, 51, 50, 93,  0,109, 97,116,110, 97,109,
-101, 91, 51, 50, 93,  0, 97,120,105,115,102,108, 97,103,  0,112,111,115,101, 99,104, 97,110,110,101,108, 91, 51, 50, 93,  0, 99,
-111,110,115,116,114, 97,105,110,116, 91, 51, 50, 93,  0, 42,102,114,111,109, 79, 98,106,101, 99,116,  0,115,117, 98,106,101, 99,
-116, 91, 51, 50, 93,  0, 98,111,100,121, 91, 51, 50, 93,  0,111,116,121,112,101,  0,112,117,108,115,101,  0,102,114,101,113,  0,
-116,111,116,108,105,110,107,115,  0, 42, 42,108,105,110,107,115,  0,116, 97,112,  0,106,111,121,105,110,100,101,120,  0, 97,120,
-105,115, 95,115,105,110,103,108,101,  0, 97,120,105,115,102,  0, 98,117,116,116,111,110,  0,104, 97,116,  0,104, 97,116,102,  0,
-112,114,101, 99,105,115,105,111,110,  0,115,116,114, 91, 49, 50, 56, 93,  0, 42,109,121,110,101,119,  0,105,110,112,117,116,115,
-  0,116,111,116,115,108,105,110,107,115,  0, 42, 42,115,108,105,110,107,115,  0,118, 97,108,111,  0,115,116, 97,116,101, 95,109,
- 97,115,107,  0, 42, 97, 99,116,  0,102,114, 97,109,101, 80,114,111,112, 91, 51, 50, 93,  0, 98,108,101,110,100,105,110,  0,112,
-114,105,111,114,105,116,121,  0,101,110,100, 95,114,101,115,101,116,  0,115,116,114,105,100,101, 97,120,105,115,  0,115,116,114,
-105,100,101,108,101,110,103,116,104,  0,109,105,110, 95,103, 97,105,110,  0,109, 97,120, 95,103, 97,105,110,  0,114,101,102,101,
-114,101,110, 99,101, 95,100,105,115,116, 97,110, 99,101,  0,109, 97,120, 95,100,105,115,116, 97,110, 99,101,  0,114,111,108,108,
-111,102,102, 95,102, 97, 99,116,111,114,  0, 99,111,110,101, 95,105,110,110,101,114, 95, 97,110,103,108,101,  0, 99,111,110,101,
- 95,111,117,116,101,114, 95, 97,110,103,108,101,  0, 99,111,110,101, 95,111,117,116,101,114, 95,103, 97,105,110,  0,112, 97,100,
- 51, 91, 50, 93,  0,112,105,116, 99,104,  0,115,111,117,110,100, 51, 68,  0,112, 97,100, 54, 91, 49, 93,  0, 42,109,101,  0,108,
-105,110, 86,101,108,111, 99,105,116,121, 91, 51, 93,  0, 97,110,103, 86,101,108,111, 99,105,116,121, 91, 51, 93,  0,108,111, 99,
- 97,108,102,108, 97,103,  0,100,121,110, 95,111,112,101,114, 97,116,105,111,110,  0,102,111,114, 99,101,108,111, 99, 91, 51, 93,
-  0,102,111,114, 99,101,114,111,116, 91, 51, 93,  0,108,105,110,101, 97,114,118,101,108,111, 99,105,116,121, 91, 51, 93,  0, 97,
-110,103,117,108, 97,114,118,101,108,111, 99,105,116,121, 91, 51, 93,  0, 42,114,101,102,101,114,101,110, 99,101,  0,109,105,110,
-  0,109, 97,120,  0,114,111,116,100, 97,109,112,  0,109,105,110,108,111, 99, 91, 51, 93,  0,109, 97,120,108,111, 99, 91, 51, 93,
-  0,109,105,110,114,111,116, 91, 51, 93,  0,109, 97,120,114,111,116, 91, 51, 93,  0,109, 97,116,112,114,111,112, 91, 51, 50, 93,
-  0, 98,117,116,115,116, 97,  0, 98,117,116,101,110,100,  0,100,105,115,116,114,105, 98,117,116,105,111,110,  0,105,110,116, 95,
- 97,114,103, 95, 49,  0,105,110,116, 95, 97,114,103, 95, 50,  0,102,108,111, 97,116, 95, 97,114,103, 95, 49,  0,102,108,111, 97,
-116, 95, 97,114,103, 95, 50,  0,116,111, 80,114,111,112, 78, 97,109,101, 91, 51, 50, 93,  0, 42,116,111, 79, 98,106,101, 99,116,
-  0, 98,111,100,121, 84,121,112,101,  0,102,105,108,101,110, 97,109,101, 91, 54, 52, 93,  0,108,111, 97,100, 97,110,105,110, 97,
-109,101, 91, 54, 52, 93,  0,105,110,116, 95, 97,114,103,  0,102,108,111, 97,116, 95, 97,114,103,  0, 42,115,117, 98,116, 97,114,
-103,101,116,  0,103,111,  0, 42,110,101,119,112, 97, 99,107,101,100,102,105,108,101,  0, 97,116,116,101,110,117, 97,116,105,111,
-110,  0,100,105,115,116, 97,110, 99,101,  0, 42, 99, 97, 99,104,101,  0, 42,112,108, 97,121, 98, 97, 99,107, 95,104, 97,110,100,
-108,101,  0, 42,108, 97,109,112,114,101,110,  0,103,111, 98,106,101, 99,116,  0,100,117,112,108,105, 95,111,102,115, 91, 51, 93,
-  0, 42,112,114,111,112,  0, 99,104,105,108,100, 98, 97,115,101,  0,114,111,108,108,  0,104,101, 97,100, 91, 51, 93,  0,116, 97,
-105,108, 91, 51, 93,  0, 98,111,110,101, 95,109, 97,116, 91, 51, 93, 91, 51, 93,  0, 97,114,109, 95,104,101, 97,100, 91, 51, 93,
-  0, 97,114,109, 95,116, 97,105,108, 91, 51, 93,  0, 97,114,109, 95,109, 97,116, 91, 52, 93, 91, 52, 93,  0, 97,114,109, 95,114,
-111,108,108,  0,120,119,105,100,116,104,  0,122,119,105,100,116,104,  0,101, 97,115,101, 49,  0,101, 97,115,101, 50,  0,114, 97,
-100, 95,104,101, 97,100,  0,114, 97,100, 95,116, 97,105,108,  0, 98,111,110,101, 98, 97,115,101,  0, 99,104, 97,105,110, 98, 97,
-115,101,  0, 42,101,100, 98,111,  0, 42, 97, 99,116, 95, 98,111,110,101,  0, 42, 97, 99,116, 95,101,100, 98,111,110,101,  0, 42,
-115,107,101,116, 99,104,  0,108, 97,121,101,114, 95,117,115,101,100,  0,108, 97,121,101,114, 95,112,114,111,116,101, 99,116,101,
-100,  0,103,104,111,115,116,101,112,  0,103,104,111,115,116,115,105,122,101,  0,103,104,111,115,116,116,121,112,101,  0,112, 97,
-116,104,115,105,122,101,  0,103,104,111,115,116,115,102,  0,103,104,111,115,116,101,102,  0,112, 97,116,104,115,102,  0,112, 97,
-116,104,101,102,  0,112, 97,116,104, 98, 99,  0,112, 97,116,104, 97, 99,  0, 42,112,111,105,110,116,115,  0,115,116, 97,114,116,
- 95,102,114, 97,109,101,  0,101,110,100, 95,102,114, 97,109,101,  0,103,104,111,115,116, 95,115,102,  0,103,104,111,115,116, 95,
-101,102,  0,103,104,111,115,116, 95, 98, 99,  0,103,104,111,115,116, 95, 97, 99,  0,103,104,111,115,116, 95,116,121,112,101,  0,
-103,104,111,115,116, 95,115,116,101,112,  0,103,104,111,115,116, 95,102,108, 97,103,  0,112, 97,116,104, 95,116,121,112,101,  0,
-112, 97,116,104, 95,115,116,101,112,  0,112, 97,116,104, 95,118,105,101,119,102,108, 97,103,  0,112, 97,116,104, 95, 98, 97,107,
-101,102,108, 97,103,  0,112, 97,116,104, 95,115,102,  0,112, 97,116,104, 95,101,102,  0,112, 97,116,104, 95, 98, 99,  0,112, 97,
-116,104, 95, 97, 99,  0, 99,111,110,115,116,102,108, 97,103,  0,105,107,102,108, 97,103,  0,115,101,108,101, 99,116,102,108, 97,
-103,  0, 97,103,114,112, 95,105,110,100,101,120,  0, 42, 98,111,110,101,  0, 42, 99,104,105,108,100,  0,105,107,116,114,101,101,
-  0, 42, 99,117,115,116,111,109,  0, 42, 99,117,115,116,111,109, 95,116,120,  0,101,117,108, 91, 51, 93,  0, 99,104, 97,110, 95,
-109, 97,116, 91, 52, 93, 91, 52, 93,  0,112,111,115,101, 95,109, 97,116, 91, 52, 93, 91, 52, 93,  0,112,111,115,101, 95,104,101,
- 97,100, 91, 51, 93,  0,112,111,115,101, 95,116, 97,105,108, 91, 51, 93,  0,108,105,109,105,116,109,105,110, 91, 51, 93,  0,108,
-105,109,105,116,109, 97,120, 91, 51, 93,  0,115,116,105,102,102,110,101,115,115, 91, 51, 93,  0,105,107,115,116,114,101,116, 99,
-104,  0,105,107,114,111,116,119,101,105,103,104,116,  0,105,107,108,105,110,119,101,105,103,104,116,  0, 99,104, 97,110, 98, 97,
-115,101,  0, 42, 99,104, 97,110,104, 97,115,104,  0,112,114,111,120,121, 95,108, 97,121,101,114,  0,115,116,114,105,100,101, 95,
-111,102,102,115,101,116, 91, 51, 93,  0, 99,121, 99,108,105, 99, 95,111,102,102,115,101,116, 91, 51, 93,  0, 97,103,114,111,117,
-112,115,  0, 97, 99,116,105,118,101, 95,103,114,111,117,112,  0,105,107,115,111,108,118,101,114,  0, 42,105,107,100, 97,116, 97,
-  0, 42,105,107,112, 97,114, 97,109,  0,112,114,111,120,121, 95, 97, 99,116, 95, 98,111,110,101, 91, 51, 50, 93,  0,110,117,109,
-105,116,101,114,  0,110,117,109,115,116,101,112,  0,109,105,110,115,116,101,112,  0,109, 97,120,115,116,101,112,  0,115,111,108,
-118,101,114,  0,102,101,101,100, 98, 97, 99,107,  0,109, 97,120,118,101,108,  0,100, 97,109,112,109, 97,120,  0,100, 97,109,112,
-101,112,115,  0, 99,104, 97,110,110,101,108,115,  0, 99,117,115,116,111,109, 67,111,108,  0, 99,115,  0, 99,117,114,118,101,115,
-  0,103,114,111,117,112,115,  0, 97, 99,116,105,118,101, 95,109, 97,114,107,101,114,  0,105,100,114,111,111,116,  0, 42,115,111,
-117,114, 99,101,  0, 42,102,105,108,116,101,114, 95,103,114,112,  0,115,101, 97,114, 99,104,115,116,114, 91, 54, 52, 93,  0,102,
-105,108,116,101,114,102,108, 97,103,  0, 97,100,115,  0,116,105,109,101,115,108,105,100,101,  0, 42,103,114,112,  0,110, 97,109,
-101, 91, 51, 48, 93,  0,111,119,110,115,112, 97, 99,101,  0,116, 97,114,115,112, 97, 99,101,  0,101,110,102,111,114, 99,101,  0,
-104,101, 97,100,116, 97,105,108,  0,108,105,110, 95,101,114,114,111,114,  0,114,111,116, 95,101,114,114,111,114,  0, 42,116, 97,
-114,  0,109, 97,116,114,105,120, 91, 52, 93, 91, 52, 93,  0,115,112, 97, 99,101,  0,114,111,116, 79,114,100,101,114,  0,116, 97,
-114,110,117,109,  0,116, 97,114,103,101,116,115,  0,105,116,101,114, 97,116,105,111,110,115,  0,114,111,111,116, 98,111,110,101,
-  0,109, 97,120, 95,114,111,111,116, 98,111,110,101,  0, 42,112,111,108,101,116, 97,114,  0,112,111,108,101,115,117, 98,116, 97,
-114,103,101,116, 91, 51, 50, 93,  0,112,111,108,101, 97,110,103,108,101,  0,111,114,105,101,110,116,119,101,105,103,104,116,  0,
-103,114, 97, 98,116, 97,114,103,101,116, 91, 51, 93,  0,110,117,109,112,111,105,110,116,115,  0, 99,104, 97,105,110,108,101,110,
-  0,120,122, 83, 99, 97,108,101, 77,111,100,101,  0,114,101,115,101,114,118,101,100, 49,  0,114,101,115,101,114,118,101,100, 50,
-  0,109,105,110,109, 97,120,102,108, 97,103,  0,115,116,117, 99,107,  0, 99, 97, 99,104,101, 91, 51, 93,  0,108,111, 99,107,102,
-108, 97,103,  0,102,111,108,108,111,119,102,108, 97,103,  0,118,111,108,109,111,100,101,  0,112,108, 97,110,101,  0,111,114,103,
-108,101,110,103,116,104,  0, 98,117,108,103,101,  0,112,105,118, 88,  0,112,105,118, 89,  0,112,105,118, 90,  0, 97,120, 88,  0,
- 97,120, 89,  0, 97,120, 90,  0,109,105,110, 76,105,109,105,116, 91, 54, 93,  0,109, 97,120, 76,105,109,105,116, 91, 54, 93,  0,
-101,120,116,114, 97, 70,122,  0,105,110,118,109, 97,116, 91, 52, 93, 91, 52, 93,  0,102,114,111,109,  0,116,111,  0,109, 97,112,
- 91, 51, 93,  0,101,120,112,111,  0,102,114,111,109, 95,109,105,110, 91, 51, 93,  0,102,114,111,109, 95,109, 97,120, 91, 51, 93,
-  0,116,111, 95,109,105,110, 91, 51, 93,  0,116,111, 95,109, 97,120, 91, 51, 93,  0,114,111,116, 65,120,105,115,  0,122,109,105,
-110,  0,122,109, 97,120,  0,112, 97,100, 91, 57, 93,  0, 99,104, 97,110,110,101,108, 91, 51, 50, 93,  0,110,111, 95,114,111,116,
+100,102,114, 97,109,101,  0,101,100,105,116,102,114, 97,109,101,  0,108, 97,115,116, 95,101,120, 97, 99,116,  0,108, 97,115,116,
+ 95,118, 97,108,105,100,  0, 99,111,109,112,114,101,115,115,105,111,110,  0,112,114,101,118, 95,110, 97,109,101, 91, 54, 52, 93,
+  0,105,110,102,111, 91, 54, 52, 93,  0,112, 97,116,104, 91, 49, 48, 50, 52, 93,  0, 42, 99, 97, 99,104,101,100, 95,102,114, 97,
+109,101,115,  0,109,101,109, 95, 99, 97, 99,104,101,  0, 42,101,100,105,116,  0, 40, 42,102,114,101,101, 95,101,100,105,116, 41,
+ 40, 41,  0,108,105,110, 83,116,105,102,102,  0, 97,110,103, 83,116,105,102,102,  0,118,111,108,117,109,101,  0,118,105,116,101,
+114, 97,116,105,111,110,115,  0,112,105,116,101,114, 97,116,105,111,110,115,  0,100,105,116,101,114, 97,116,105,111,110,115,  0,
+ 99,105,116,101,114, 97,116,105,111,110,115,  0,107, 83, 82, 72, 82, 95, 67, 76,  0,107, 83, 75, 72, 82, 95, 67, 76,  0,107, 83,
+ 83, 72, 82, 95, 67, 76,  0,107, 83, 82, 95, 83, 80, 76, 84, 95, 67, 76,  0,107, 83, 75, 95, 83, 80, 76, 84, 95, 67, 76,  0,107,
+ 83, 83, 95, 83, 80, 76, 84, 95, 67, 76,  0,107, 86, 67, 70,  0,107, 68, 80,  0,107, 68, 71,  0,107, 76, 70,  0,107, 80, 82,  0,
+107, 86, 67,  0,107, 68, 70,  0,107, 77, 84,  0,107, 67, 72, 82,  0,107, 75, 72, 82,  0,107, 83, 72, 82,  0,107, 65, 72, 82,  0,
+ 99,111,108,108,105,115,105,111,110,102,108, 97,103,115,  0,110,117,109, 99,108,117,115,116,101,114,105,116,101,114, 97,116,105,
+111,110,115,  0,119,101,108,100,105,110,103,  0,116,111,116,115,112,114,105,110,103,  0, 42, 98,112,111,105,110,116,  0, 42, 98,
+115,112,114,105,110,103,  0,109,115,103, 95,108,111, 99,107,  0,109,115,103, 95,118, 97,108,117,101,  0,110,111,100,101,109, 97,
+115,115,  0,110, 97,109,101,100, 86, 71, 95, 77, 97,115,115, 91, 54, 52, 93,  0,103,114, 97,118,  0,109,101,100,105, 97,102,114,
+105, 99,116,  0,114,107,108,105,109,105,116,  0,112,104,121,115,105, 99,115, 95,115,112,101,101,100,  0,103,111, 97,108,115,112,
+114,105,110,103,  0,103,111, 97,108,102,114,105, 99,116,  0,109,105,110,103,111, 97,108,  0,109, 97,120,103,111, 97,108,  0,100,
+101,102,103,111, 97,108,  0,118,101,114,116,103,114,111,117,112,  0,110, 97,109,101,100, 86, 71, 95, 83,111,102,116,103,111, 97,
+108, 91, 54, 52, 93,  0,102,117,122,122,121,110,101,115,115,  0,105,110,115,112,114,105,110,103,  0,105,110,102,114,105, 99,116,
+  0,110, 97,109,101,100, 86, 71, 95, 83,112,114,105,110,103, 95, 75, 91, 54, 52, 93,  0,101,102,114, 97,  0,105,110,116,101,114,
+118, 97,108,  0,108,111, 99, 97,108,  0,115,111,108,118,101,114,102,108, 97,103,115,  0, 42, 42,107,101,121,115,  0,116,111,116,
+112,111,105,110,116,107,101,121,  0,115,101, 99,111,110,100,115,112,114,105,110,103,  0, 99,111,108, 98, 97,108,108,  0, 98, 97,
+108,108,100, 97,109,112,  0, 98, 97,108,108,115,116,105,102,102,  0,115, 98, 99, 95,109,111,100,101,  0, 97,101,114,111,101,100,
+103,101,  0,109,105,110,108,111,111,112,115,  0,109, 97,120,108,111,111,112,115,  0, 99,104,111,107,101,  0,115,111,108,118,101,
+114, 95, 73, 68,  0,112,108, 97,115,116,105, 99,  0,115,112,114,105,110,103,112,114,101,108,111, 97,100,  0, 42,115, 99,114, 97,
+116, 99,104,  0,115,104,101, 97,114,115,116,105,102,102,  0,105,110,112,117,115,104,  0, 42,112,111,105,110,116, 99, 97, 99,104,
+101,  0, 42,101,102,102,101, 99,116,111,114, 95,119,101,105,103,104,116,115,  0,108, 99,111,109, 91, 51, 93,  0,108,114,111,116,
+ 91, 51, 93, 91, 51, 93,  0,108,115, 99, 97,108,101, 91, 51, 93, 91, 51, 93,  0,108, 97,115,116, 95,102,114, 97,109,101,  0,118,
+101,108, 91, 51, 93,  0, 42,102,109,100,  0,115,104,111,119, 95, 97,100,118, 97,110, 99,101,100,111,112,116,105,111,110,115,  0,
+114,101,115,111,108,117,116,105,111,110,120,121,122,  0,112,114,101,118,105,101,119,114,101,115,120,121,122,  0,114,101, 97,108,
+115,105,122,101,  0,103,117,105, 68,105,115,112,108, 97,121, 77,111,100,101,  0,114,101,110,100,101,114, 68,105,115,112,108, 97,
+121, 77,111,100,101,  0,118,105,115, 99,111,115,105,116,121, 86, 97,108,117,101,  0,118,105,115, 99,111,115,105,116,121, 77,111,
+100,101,  0,118,105,115, 99,111,115,105,116,121, 69,120,112,111,110,101,110,116,  0,103,114, 97,118, 91, 51, 93,  0, 97,110,105,
+109, 83,116, 97,114,116,  0, 97,110,105,109, 69,110,100,  0, 98, 97,107,101, 83,116, 97,114,116,  0, 98, 97,107,101, 69,110,100,
+  0,102,114, 97,109,101, 79,102,102,115,101,116,  0,103,115,116, 97,114,  0,109, 97,120, 82,101,102,105,110,101,  0,105,110,105,
+ 86,101,108,120,  0,105,110,105, 86,101,108,121,  0,105,110,105, 86,101,108,122,  0, 42,111,114,103, 77,101,115,104,  0, 42,109,
+101,115,104, 66, 66,  0,115,117,114,102,100, 97,116, 97, 80, 97,116,104, 91, 49, 48, 50, 52, 93,  0, 98, 98, 83,116, 97,114,116,
+ 91, 51, 93,  0, 98, 98, 83,105,122,101, 91, 51, 93,  0,116,121,112,101, 70,108, 97,103,115,  0,100,111,109, 97,105,110, 78,111,
+118,101, 99,103,101,110,  0,118,111,108,117,109,101, 73,110,105,116, 84,121,112,101,  0,112, 97,114,116, 83,108,105,112, 86, 97,
+108,117,101,  0,103,101,110,101,114, 97,116,101, 84,114, 97, 99,101,114,115,  0,103,101,110,101,114, 97,116,101, 80, 97,114,116,
+105, 99,108,101,115,  0,115,117,114,102, 97, 99,101, 83,109,111,111,116,104,105,110,103,  0,115,117,114,102, 97, 99,101, 83,117,
+ 98,100,105,118,115,  0,112, 97,114,116,105, 99,108,101, 73,110,102, 83,105,122,101,  0,112, 97,114,116,105, 99,108,101, 73,110,
+102, 65,108,112,104, 97,  0,102, 97,114, 70,105,101,108,100, 83,105,122,101,  0, 42,109,101,115,104, 86,101,108,111, 99,105,116,
+105,101,115,  0, 99,112,115, 84,105,109,101, 83,116, 97,114,116,  0, 99,112,115, 84,105,109,101, 69,110,100,  0, 99,112,115, 81,
+117, 97,108,105,116,121,  0, 97,116,116,114, 97, 99,116,102,111,114, 99,101, 83,116,114,101,110,103,116,104,  0, 97,116,116,114,
+ 97, 99,116,102,111,114, 99,101, 82, 97,100,105,117,115,  0,118,101,108,111, 99,105,116,121,102,111,114, 99,101, 83,116,114,101,
+110,103,116,104,  0,118,101,108,111, 99,105,116,121,102,111,114, 99,101, 82, 97,100,105,117,115,  0,108, 97,115,116,103,111,111,
+100,102,114, 97,109,101,  0, 97,110,105,109, 82, 97,116,101,  0,109,105,115,116,121,112,101,  0,104,111,114,114,  0,104,111,114,
+103,  0,104,111,114, 98,  0,122,101,110,114,  0,122,101,110,103,  0,122,101,110, 98,  0,102, 97,115,116, 99,111,108,  0,101,120,
+112,111,115,117,114,101,  0,101,120,112,  0,114, 97,110,103,101,  0,108,105,110,102, 97, 99,  0,108,111,103,102, 97, 99,  0,103,
+114, 97,118,105,116,121,  0, 97, 99,116,105,118,105,116,121, 66,111,120, 82, 97,100,105,117,115,  0,115,107,121,116,121,112,101,
+  0,111, 99, 99,108,117,115,105,111,110, 82,101,115,  0,112,104,121,115,105, 99,115, 69,110,103,105,110,101,  0,116,105, 99,114,
+ 97,116,101,  0,109, 97,120,108,111,103,105, 99,115,116,101,112,  0,112,104,121,115,117, 98,115,116,101,112,  0,109, 97,120,112,
+104,121,115,116,101,112,  0,109,105,115,105,  0,109,105,115,116,115,116, 97,  0,109,105,115,116,100,105,115,116,  0,109,105,115,
+116,104,105,  0,115,116, 97,114,114,  0,115,116, 97,114,103,  0,115,116, 97,114, 98,  0,115,116, 97,114,107,  0,115,116, 97,114,
+115,105,122,101,  0,115,116, 97,114,109,105,110,100,105,115,116,  0,115,116, 97,114,100,105,115,116,  0,115,116, 97,114, 99,111,
+108,110,111,105,115,101,  0,100,111,102,115,116, 97,  0,100,111,102,101,110,100,  0,100,111,102,109,105,110,  0,100,111,102,109,
+ 97,120,  0, 97,111,100,105,115,116,  0, 97,111,100,105,115,116,102, 97, 99,  0, 97,111,101,110,101,114,103,121,  0, 97,111, 98,
+105, 97,115,  0, 97,111,109,111,100,101,  0, 97,111,115, 97,109,112,  0, 97,111,109,105,120,  0, 97,111, 99,111,108,111,114,  0,
+ 97,111, 95, 97,100, 97,112,116, 95,116,104,114,101,115,104,  0, 97,111, 95, 97,100, 97,112,116, 95,115,112,101,101,100, 95,102,
+ 97, 99,  0, 97,111, 95, 97,112,112,114,111,120, 95,101,114,114,111,114,  0, 97,111, 95, 97,112,112,114,111,120, 95, 99,111,114,
+114,101, 99,116,105,111,110,  0, 97,111, 95,105,110,100,105,114,101, 99,116, 95,101,110,101,114,103,121,  0, 97,111, 95,101,110,
+118, 95,101,110,101,114,103,121,  0, 97,111, 95,112, 97,100, 50,  0, 97,111, 95,105,110,100,105,114,101, 99,116, 95, 98,111,117,
+110, 99,101,115,  0, 97,111, 95,112, 97,100,  0, 97,111, 95,115, 97,109,112, 95,109,101,116,104,111,100,  0, 97,111, 95,103, 97,
+116,104,101,114, 95,109,101,116,104,111,100,  0, 97,111, 95, 97,112,112,114,111,120, 95,112, 97,115,115,101,115,  0, 42, 97,111,
+115,112,104,101,114,101,  0, 42, 97,111,116, 97, 98,108,101,115,  0,115,101,108, 99,111,108,  0,115,120,  0,115,121,  0, 42,108,
+112, 70,111,114,109, 97,116,  0, 42,108,112, 80, 97,114,109,115,  0, 99, 98, 70,111,114,109, 97,116,  0, 99, 98, 80, 97,114,109,
+115,  0,102, 99, 99, 84,121,112,101,  0,102, 99, 99, 72, 97,110,100,108,101,114,  0,100,119, 75,101,121, 70,114, 97,109,101, 69,
+118,101,114,121,  0,100,119, 81,117, 97,108,105,116,121,  0,100,119, 66,121,116,101,115, 80,101,114, 83,101, 99,111,110,100,  0,
+100,119, 70,108, 97,103,115,  0,100,119, 73,110,116,101,114,108,101, 97,118,101, 69,118,101,114,121,  0, 97,118,105, 99,111,100,
+101, 99,110, 97,109,101, 91, 49, 50, 56, 93,  0, 42, 99,100, 80, 97,114,109,115,  0, 42,112, 97,100,  0, 99,100, 83,105,122,101,
+  0,113,116, 99,111,100,101, 99,110, 97,109,101, 91, 49, 50, 56, 93,  0, 99,111,100,101, 99, 84,121,112,101,  0, 99,111,100,101,
+ 99, 83,112, 97,116,105, 97,108, 81,117, 97,108,105,116,121,  0, 99,111,100,101, 99,  0, 99,111,100,101, 99, 70,108, 97,103,115,
+  0, 99,111,108,111,114, 68,101,112,116,104,  0, 99,111,100,101, 99, 84,101,109,112,111,114, 97,108, 81,117, 97,108,105,116,121,
+  0,109,105,110, 83,112, 97,116,105, 97,108, 81,117, 97,108,105,116,121,  0,109,105,110, 84,101,109,112,111,114, 97,108, 81,117,
+ 97,108,105,116,121,  0,107,101,121, 70,114, 97,109,101, 82, 97,116,101,  0, 98,105,116, 82, 97,116,101,  0, 97,117,100,105,111,
+ 99,111,100,101, 99, 84,121,112,101,  0, 97,117,100,105,111, 83, 97,109,112,108,101, 82, 97,116,101,  0, 97,117,100,105,111, 66,
+105,116, 68,101,112,116,104,  0, 97,117,100,105,111, 67,104, 97,110,110,101,108,115,  0, 97,117,100,105,111, 67,111,100,101, 99,
+ 70,108, 97,103,115,  0, 97,117,100,105,111, 66,105,116, 82, 97,116,101,  0, 97,117,100,105,111, 95, 99,111,100,101, 99,  0,118,
+105,100,101,111, 95, 98,105,116,114, 97,116,101,  0, 97,117,100,105,111, 95, 98,105,116,114, 97,116,101,  0, 97,117,100,105,111,
+ 95,109,105,120,114, 97,116,101,  0, 97,117,100,105,111, 95, 99,104, 97,110,110,101,108,115,  0, 97,117,100,105,111, 95,112, 97,
+100,  0, 97,117,100,105,111, 95,118,111,108,117,109,101,  0,103,111,112, 95,115,105,122,101,  0,114, 99, 95,109,105,110, 95,114,
+ 97,116,101,  0,114, 99, 95,109, 97,120, 95,114, 97,116,101,  0,114, 99, 95, 98,117,102,102,101,114, 95,115,105,122,101,  0,109,
+117,120, 95,112, 97, 99,107,101,116, 95,115,105,122,101,  0,109,117,120, 95,114, 97,116,101,  0,109,105,120,114, 97,116,101,  0,
+109, 97,105,110,  0,115,112,101,101,100, 95,111,102, 95,115,111,117,110,100,  0,100,111,112,112,108,101,114, 95,102, 97, 99,116,
+111,114,  0,100,105,115,116, 97,110, 99,101, 95,109,111,100,101,108,  0, 42,109, 97,116, 95,111,118,101,114,114,105,100,101,  0,
+ 42,108,105,103,104,116, 95,111,118,101,114,114,105,100,101,  0,108, 97,121, 95,122,109, 97,115,107,  0,108, 97,121,102,108, 97,
+103,  0,112, 97,115,115,102,108, 97,103,  0,112, 97,115,115, 95,120,111,114,  0,105,109,116,121,112,101,  0,112,108, 97,110,101,
+115,  0,113,117, 97,108,105,116,121,  0, 99,111,109,112,114,101,115,115,  0,101,120,114, 95, 99,111,100,101, 99,  0, 99,105,110,
+101,111,110, 95,102,108, 97,103,  0, 99,105,110,101,111,110, 95,119,104,105,116,101,  0, 99,105,110,101,111,110, 95, 98,108, 97,
+ 99,107,  0, 99,105,110,101,111,110, 95,103, 97,109,109, 97,  0,106,112, 50, 95,102,108, 97,103,  0,105,109, 95,102,111,114,109,
+ 97,116,  0, 42, 97,118,105, 99,111,100,101, 99,100, 97,116, 97,  0, 42,113,116, 99,111,100,101, 99,100, 97,116, 97,  0,113,116,
+ 99,111,100,101, 99,115,101,116,116,105,110,103,115,  0,102,102, 99,111,100,101, 99,100, 97,116, 97,  0,115,117, 98,102,114, 97,
+109,101,  0,112,115,102,114, 97,  0,112,101,102,114, 97,  0,105,109, 97,103,101,115,  0,102,114, 97,109, 97,112,116,111,  0,116,
+104,114,101, 97,100,115,  0,102,114, 97,109,101,108,101,110,  0, 98,108,117,114,102, 97, 99,  0,101,100,103,101, 82,  0,101,100,
+103,101, 71,  0,101,100,103,101, 66,  0,102,117,108,108,115, 99,114,101,101,110,  0,120,112,108, 97,121,  0,121,112,108, 97,121,
+  0,102,114,101,113,112,108, 97,121,  0, 97,116,116,114,105, 98,  0,102,114, 97,109,101, 95,115,116,101,112,  0,115,116,101,114,
+101,111,109,111,100,101,  0,100,105,109,101,110,115,105,111,110,115,112,114,101,115,101,116,  0,109, 97,120,105,109,115,105,122,
+101,  0,120,115, 99,104,  0,121,115, 99,104,  0,120,112, 97,114,116,115,  0,121,112, 97,114,116,115,  0,115,117, 98,105,109,116,
+121,112,101,  0,100,105,115,112,108, 97,121,109,111,100,101,  0,115, 99,101,109,111,100,101,  0,114, 97,121,116,114, 97, 99,101,
+ 95,111,112,116,105,111,110,115,  0,114, 97,121,116,114, 97, 99,101, 95,115,116,114,117, 99,116,117,114,101,  0,111, 99,114,101,
+115,  0,112, 97,100, 52,  0, 97,108,112,104, 97,109,111,100,101,  0,111,115, 97,  0,102,114,115, 95,115,101, 99,  0,101,100,103,
+101,105,110,116,  0,115, 97,102,101,116,121,  0, 98,111,114,100,101,114,  0,100,105,115,112,114,101, 99,116,  0,108, 97,121,101,
+114,115,  0, 97, 99,116,108, 97,121,  0,109, 98,108,117,114, 95,115, 97,109,112,108,101,115,  0,120, 97,115,112,  0,121, 97,115,
+112,  0,102,114,115, 95,115,101, 99, 95, 98, 97,115,101,  0,103, 97,117,115,115,  0, 99,111,108,111,114, 95,109,103,116, 95,102,
+108, 97,103,  0,112,111,115,116,103, 97,109,109, 97,  0,112,111,115,116,104,117,101,  0,112,111,115,116,115, 97,116,  0,100,105,
+116,104,101,114, 95,105,110,116,101,110,115,105,116,121,  0, 98, 97,107,101, 95,111,115, 97,  0, 98, 97,107,101, 95,102,105,108,
+116,101,114,  0, 98, 97,107,101, 95,109,111,100,101,  0, 98, 97,107,101, 95,102,108, 97,103,  0, 98, 97,107,101, 95,110,111,114,
+109, 97,108, 95,115,112, 97, 99,101,  0, 98, 97,107,101, 95,113,117, 97,100, 95,115,112,108,105,116,  0, 98, 97,107,101, 95,109,
+ 97,120,100,105,115,116,  0, 98, 97,107,101, 95, 98,105, 97,115,100,105,115,116,  0, 98, 97,107,101, 95,112, 97,100,  0,112,105,
+ 99, 91, 49, 48, 50, 52, 93,  0,115,116, 97,109,112,  0,115,116, 97,109,112, 95,102,111,110,116, 95,105,100,  0,115,116, 97,109,
+112, 95,117,100, 97,116, 97, 91, 55, 54, 56, 93,  0,102,103, 95,115,116, 97,109,112, 91, 52, 93,  0, 98,103, 95,115,116, 97,109,
+112, 91, 52, 93,  0,115,101,113, 95,112,114,101,118, 95,116,121,112,101,  0,115,101,113, 95,114,101,110,100, 95,116,121,112,101,
+  0,115,101,113, 95,102,108, 97,103,  0,112, 97,100, 53, 91, 53, 93,  0,115,105,109,112,108,105,102,121, 95,102,108, 97,103,  0,
+115,105,109,112,108,105,102,121, 95,115,117, 98,115,117,114,102,  0,115,105,109,112,108,105,102,121, 95,115,104, 97,100,111,119,
+115, 97,109,112,108,101,115,  0,115,105,109,112,108,105,102,121, 95,112, 97,114,116,105, 99,108,101,115,  0,115,105,109,112,108,
+105,102,121, 95, 97,111,115,115,115,  0, 99,105,110,101,111,110,119,104,105,116,101,  0, 99,105,110,101,111,110, 98,108, 97, 99,
+107,  0, 99,105,110,101,111,110,103, 97,109,109, 97,  0,106,112, 50, 95,112,114,101,115,101,116,  0,106,112, 50, 95,100,101,112,
+116,104,  0,114,112, 97,100, 51,  0,100,111,109,101,114,101,115,  0,100,111,109,101,109,111,100,101,  0,100,111,109,101, 97,110,
+103,108,101,  0,100,111,109,101,116,105,108,116,  0,100,111,109,101,114,101,115, 98,117,102,  0, 42,100,111,109,101,116,101,120,
+116,  0,101,110,103,105,110,101, 91, 51, 50, 93,  0,110, 97,109,101, 91, 51, 50, 93,  0,112, 97,114,116,105, 99,108,101, 95,112,
+101,114, 99,  0,115,117, 98,115,117,114,102, 95,109, 97,120,  0,115,104, 97,100, 98,117,102,115, 97,109,112,108,101, 95,109, 97,
+120,  0, 97,111, 95,101,114,114,111,114,  0,116,105,108,116,  0,114,101,115, 98,117,102,  0, 42,119, 97,114,112,116,101,120,116,
+  0, 99,111,108, 91, 51, 93,  0, 99,101,108,108,115,105,122,101,  0, 99,101,108,108,104,101,105,103,104,116,  0, 97,103,101,110,
+116,109, 97,120,115,108,111,112,101,  0, 97,103,101,110,116,109, 97,120, 99,108,105,109, 98,  0, 97,103,101,110,116,104,101,105,
+103,104,116,  0, 97,103,101,110,116,114, 97,100,105,117,115,  0,101,100,103,101,109, 97,120,108,101,110,  0,101,100,103,101,109,
+ 97,120,101,114,114,111,114,  0,114,101,103,105,111,110,109,105,110,115,105,122,101,  0,114,101,103,105,111,110,109,101,114,103,
+101,115,105,122,101,  0,118,101,114,116,115,112,101,114,112,111,108,121,  0,100,101,116, 97,105,108,115, 97,109,112,108,101,100,
+105,115,116,  0,100,101,116, 97,105,108,115, 97,109,112,108,101,109, 97,120,101,114,114,111,114,  0,102,114, 97,109,105,110,103,
+  0,112,108, 97,121,101,114,102,108, 97,103,  0,114,116, 49,  0,114,116, 50,  0, 97, 97,115, 97,109,112,108,101,115,  0,112, 97,
+100, 52, 91, 51, 93,  0,100,111,109,101,  0,115,116,101,114,101,111,102,108, 97,103,  0,101,121,101,115,101,112, 97,114, 97,116,
+105,111,110,  0,114,101, 99, 97,115,116, 68, 97,116, 97,  0,109, 97,116,109,111,100,101,  0,101,120,105,116,107,101,121,  0,111,
+ 98,115,116, 97, 99,108,101, 83,105,109,117,108, 97,116,105,111,110,  0,108,101,118,101,108, 72,101,105,103,104,116,  0, 42, 99,
+ 97,109,101,114, 97,  0, 42,112, 97,105,110,116, 95, 99,117,114,115,111,114,  0,112, 97,105,110,116, 95, 99,117,114,115,111,114,
+ 95, 99,111,108, 91, 52, 93,  0,112, 97,105,110,116,  0,115,101, 97,109, 95, 98,108,101,101,100,  0,110,111,114,109, 97,108, 95,
+ 97,110,103,108,101,  0,115, 99,114,101,101,110, 95,103,114, 97, 98, 95,115,105,122,101, 91, 50, 93,  0, 42,112, 97,105,110,116,
+ 99,117,114,115,111,114,  0,105,110,118,101,114,116,  0,116,111,116,114,101,107,101,121,  0,116,111,116, 97,100,100,107,101,121,
+  0, 98,114,117,115,104,116,121,112,101,  0, 98,114,117,115,104, 91, 55, 93,  0,101,109,105,116,116,101,114,100,105,115,116,  0,
+115,101,108,101, 99,116,109,111,100,101,  0,101,100,105,116,116,121,112,101,  0,100,114, 97,119, 95,115,116,101,112,  0,102, 97,
+100,101, 95,102,114, 97,109,101,115,  0,114, 97,100,105, 97,108, 95,115,121,109,109, 91, 51, 93,  0,108, 97,115,116, 95,120,  0,
+108, 97,115,116, 95,121,  0,108, 97,115,116, 95, 97,110,103,108,101,  0,100,114, 97,119, 95, 97,110, 99,104,111,114,101,100,  0,
+ 97,110, 99,104,111,114,101,100, 95,115,105,122,101,  0, 97,110, 99,104,111,114,101,100, 95,108,111, 99, 97,116,105,111,110, 91,
+ 51, 93,  0, 97,110, 99,104,111,114,101,100, 95,105,110,105,116,105, 97,108, 95,109,111,117,115,101, 91, 50, 93,  0,100,114, 97,
+119, 95,112,114,101,115,115,117,114,101,  0,112,114,101,115,115,117,114,101, 95,118, 97,108,117,101,  0,115,112,101, 99,105, 97,
+108, 95,114,111,116, 97,116,105,111,110,  0, 42,118,112, 97,105,110,116, 95,112,114,101,118,  0, 42,119,112, 97,105,110,116, 95,
+112,114,101,118,  0,109, 97,116, 91, 51, 93, 91, 51, 93,  0,117,110,112,114,111,106,101, 99,116,101,100, 95,114, 97,100,105,117,
+115,  0, 42,118,112, 97,105,110,116,  0, 42,119,112, 97,105,110,116,  0, 42,117,118,115, 99,117,108,112,116,  0,118,103,114,111,
+117,112, 95,119,101,105,103,104,116,  0, 99,111,114,110,101,114,116,121,112,101,  0,101,100,105,116, 98,117,116,102,108, 97,103,
+  0,106,111,105,110,116,114,105,108,105,109,105,116,  0,100,101,103,114,  0,116,117,114,110,  0,101,120,116,114, 95,111,102,102,
+115,  0,100,111,117, 98,108,105,109,105,116,  0,110,111,114,109, 97,108,115,105,122,101,  0, 97,117,116,111,109,101,114,103,101,
+  0,115,101,103,109,101,110,116,115,  0,114,105,110,103,115,  0,118,101,114,116,105, 99,101,115,  0,117,110,119,114, 97,112,112,
+101,114,  0,117,118, 99, 97,108, 99, 95,114, 97,100,105,117,115,  0,117,118, 99, 97,108, 99, 95, 99,117, 98,101,115,105,122,101,
+  0,117,118, 99, 97,108, 99, 95,109, 97,114,103,105,110,  0,117,118, 99, 97,108, 99, 95,109, 97,112,100,105,114,  0,117,118, 99,
+ 97,108, 99, 95,109, 97,112, 97,108,105,103,110,  0,117,118, 99, 97,108, 99, 95,102,108, 97,103,  0,117,118, 95,102,108, 97,103,
+  0,117,118, 95,115,101,108,101, 99,116,109,111,100,101,  0,117,118, 95,115,117, 98,115,117,114,102, 95,108,101,118,101,108,  0,
+103,112,101,110, 99,105,108, 95,102,108, 97,103,115,  0, 97,117,116,111,105,107, 95, 99,104, 97,105,110,108,101,110,  0,105,109,
+ 97,112, 97,105,110,116,  0,112, 97,114,116,105, 99,108,101,  0,112,114,111,112,111,114,116,105,111,110, 97,108, 95,115,105,122,
+101,  0,115,101,108,101, 99,116, 95,116,104,114,101,115,104,  0, 99,108,101, 97,110, 95,116,104,114,101,115,104,  0, 97,117,116,
+111,107,101,121, 95,109,111,100,101,  0, 97,117,116,111,107,101,121, 95,102,108, 97,103,  0,109,117,108,116,105,114,101,115, 95,
+115,117, 98,100,105,118, 95,116,121,112,101,  0,112, 97,100, 50, 91, 53, 93,  0,115,107,103,101,110, 95,114,101,115,111,108,117,
+116,105,111,110,  0,115,107,103,101,110, 95,116,104,114,101,115,104,111,108,100, 95,105,110,116,101,114,110, 97,108,  0,115,107,
+103,101,110, 95,116,104,114,101,115,104,111,108,100, 95,101,120,116,101,114,110, 97,108,  0,115,107,103,101,110, 95,108,101,110,
+103,116,104, 95,114, 97,116,105,111,  0,115,107,103,101,110, 95,108,101,110,103,116,104, 95,108,105,109,105,116,  0,115,107,103,
+101,110, 95, 97,110,103,108,101, 95,108,105,109,105,116,  0,115,107,103,101,110, 95, 99,111,114,114,101,108, 97,116,105,111,110,
+ 95,108,105,109,105,116,  0,115,107,103,101,110, 95,115,121,109,109,101,116,114,121, 95,108,105,109,105,116,  0,115,107,103,101,
+110, 95,114,101,116, 97,114,103,101,116, 95, 97,110,103,108,101, 95,119,101,105,103,104,116,  0,115,107,103,101,110, 95,114,101,
+116, 97,114,103,101,116, 95,108,101,110,103,116,104, 95,119,101,105,103,104,116,  0,115,107,103,101,110, 95,114,101,116, 97,114,
+103,101,116, 95,100,105,115,116, 97,110, 99,101, 95,119,101,105,103,104,116,  0,115,107,103,101,110, 95,111,112,116,105,111,110,
+115,  0,115,107,103,101,110, 95,112,111,115,116,112,114,111,  0,115,107,103,101,110, 95,112,111,115,116,112,114,111, 95,112, 97,
+115,115,101,115,  0,115,107,103,101,110, 95,115,117, 98,100,105,118,105,115,105,111,110,115, 91, 51, 93,  0,115,107,103,101,110,
+ 95,109,117,108,116,105, 95,108,101,118,101,108,  0, 42,115,107,103,101,110, 95,116,101,109,112,108, 97,116,101,  0, 98,111,110,
+101, 95,115,107,101,116, 99,104,105,110,103,  0, 98,111,110,101, 95,115,107,101,116, 99,104,105,110,103, 95, 99,111,110,118,101,
+114,116,  0,115,107,103,101,110, 95,115,117, 98,100,105,118,105,115,105,111,110, 95,110,117,109, 98,101,114,  0,115,107,103,101,
+110, 95,114,101,116, 97,114,103,101,116, 95,111,112,116,105,111,110,115,  0,115,107,103,101,110, 95,114,101,116, 97,114,103,101,
+116, 95,114,111,108,108,  0,115,107,103,101,110, 95,115,105,100,101, 95,115,116,114,105,110,103, 91, 56, 93,  0,115,107,103,101,
+110, 95,110,117,109, 95,115,116,114,105,110,103, 91, 56, 93,  0,101,100,103,101, 95,109,111,100,101,  0,101,100,103,101, 95,109,
+111,100,101, 95,108,105,118,101, 95,117,110,119,114, 97,112,  0,115,110, 97,112, 95,109,111,100,101,  0,115,110, 97,112, 95,102,
+108, 97,103,  0,115,110, 97,112, 95,116, 97,114,103,101,116,  0,112,114,111,112,111,114,116,105,111,110, 97,108,  0,112,114,111,
+112, 95,109,111,100,101,  0,112,114,111,112,111,114,116,105,111,110, 97,108, 95,111, 98,106,101, 99,116,115,  0,112, 97,100, 91,
+ 53, 93,  0, 97,117,116,111, 95,110,111,114,109, 97,108,105,122,101,  0,109,117,108,116,105,112, 97,105,110,116,  0,117,115,101,
+ 95,117,118, 95,115, 99,117,108,112,116,  0,117,118, 95,115, 99,117,108,112,116, 95,115,101,116,116,105,110,103,115,  0,117,118,
+ 95,115, 99,117,108,112,116, 95,116,111,111,108,  0,117,118, 95,114,101,108, 97,120, 95,109,101,116,104,111,100,  0,115, 99,117,
+108,112,116, 95,112, 97,105,110,116, 95,115,101,116,116,105,110,103,115,  0,115, 99,117,108,112,116, 95,112, 97,105,110,116, 95,
+117,110,105,102,105,101,100, 95,115,105,122,101,  0,115, 99,117,108,112,116, 95,112, 97,105,110,116, 95,117,110,105,102,105,101,
+100, 95,117,110,112,114,111,106,101, 99,116,101,100, 95,114, 97,100,105,117,115,  0,115, 99,117,108,112,116, 95,112, 97,105,110,
+116, 95,117,110,105,102,105,101,100, 95, 97,108,112,104, 97,  0,117,110,105,102,105,101,100, 95,112, 97,105,110,116, 95,115,101,
+116,116,105,110,103,115,  0,116,111,116,111, 98,106,  0,116,111,116,108, 97,109,112,  0,116,111,116,111, 98,106,115,101,108,  0,
+116,111,116, 99,117,114,118,101,  0,116,111,116,109,101,115,104,  0,116,111,116, 97,114,109, 97,116,117,114,101,  0,115, 99, 97,
+108,101, 95,108,101,110,103,116,104,  0,115,121,115,116,101,109,  0,115,121,115,116,101,109, 95,114,111,116, 97,116,105,111,110,
+  0,103,114, 97,118,105,116,121, 91, 51, 93,  0,113,117,105, 99,107, 95, 99, 97, 99,104,101, 95,115,116,101,112,  0, 42,119,111,
+114,108,100,  0, 42,115,101,116,  0, 98, 97,115,101,  0, 42, 98, 97,115, 97, 99,116,  0, 42,111, 98,101,100,105,116,  0, 99,117,
+114,115,111,114, 91, 51, 93,  0,116,119, 99,101,110,116, 91, 51, 93,  0,116,119,109,105,110, 91, 51, 93,  0,116,119,109, 97,120,
+ 91, 51, 93,  0,108, 97,121, 97, 99,116,  0,108, 97,121, 95,117,112,100, 97,116,101,100,  0, 42,101,100,  0, 42,116,111,111,108,
+115,101,116,116,105,110,103,115,  0, 42,115,116, 97,116,115,  0, 97,117,100,105,111,  0,116,114, 97,110,115,102,111,114,109, 95,
+115,112, 97, 99,101,115,  0, 42,115,111,117,110,100, 95,115, 99,101,110,101,  0, 42,115,111,117,110,100, 95,115, 99,101,110,101,
+ 95,104, 97,110,100,108,101,  0, 42,115,111,117,110,100, 95,115, 99,114,117, 98, 95,104, 97,110,100,108,101,  0, 42,115,112,101,
+ 97,107,101,114, 95,104, 97,110,100,108,101,115,  0, 42,102,112,115, 95,105,110,102,111,  0, 42,116,104,101, 68, 97,103,  0,100,
+ 97,103,105,115,118, 97,108,105,100,  0,100, 97,103,102,108, 97,103,115,  0, 97, 99,116,105,118,101, 95,107,101,121,105,110,103,
+115,101,116,  0,107,101,121,105,110,103,115,101,116,115,  0,103,109,  0,117,110,105,116,  0,112,104,121,115,105, 99,115, 95,115,
+101,116,116,105,110,103,115,  0, 42, 99,108,105,112,  0, 99,117,115,116,111,109,100, 97,116, 97, 95,109, 97,115,107, 95,109,111,
+100, 97,108,  0, 99,117,115,101,114,  0, 98,108,101,110,100,  0,118,105,101,119,  0,119,105,110,109, 97,116, 91, 52, 93, 91, 52,
+ 93,  0,118,105,101,119,109, 97,116, 91, 52, 93, 91, 52, 93,  0,118,105,101,119,105,110,118, 91, 52, 93, 91, 52, 93,  0,112,101,
+114,115,109, 97,116, 91, 52, 93, 91, 52, 93,  0,112,101,114,115,105,110,118, 91, 52, 93, 91, 52, 93,  0,118,105,101,119,109, 97,
+116,111, 98, 91, 52, 93, 91, 52, 93,  0,112,101,114,115,109, 97,116,111, 98, 91, 52, 93, 91, 52, 93,  0, 99,108,105,112, 91, 54,
+ 93, 91, 52, 93,  0, 99,108,105,112, 95,108,111, 99, 97,108, 91, 54, 93, 91, 52, 93,  0, 42, 99,108,105,112, 98, 98,  0, 42,108,
+111, 99, 97,108,118,100,  0, 42,114,105,  0, 42,114,101,110,100,101,114, 95,101,110,103,105,110,101,  0, 42,100,101,112,116,104,
+115,  0, 42,115,109,115,  0, 42,115,109,111,111,116,104, 95,116,105,109,101,114,  0,116,119,109, 97,116, 91, 52, 93, 91, 52, 93,
+  0,118,105,101,119,113,117, 97,116, 91, 52, 93,  0,122,102, 97, 99,  0, 99, 97,109,100,120,  0, 99, 97,109,100,121,  0,112,105,
+120,115,105,122,101,  0, 99, 97,109,122,111,111,109,  0,105,115, 95,112,101,114,115,112,  0,112,101,114,115,112,  0,118,105,101,
+119,108,111, 99,107,  0,116,119,100,114, 97,119,102,108, 97,103,  0,114,102,108, 97,103,  0,108,118,105,101,119,113,117, 97,116,
+ 91, 52, 93,  0,108,112,101,114,115,112,  0,108,118,105,101,119,  0,103,114,105,100,118,105,101,119,  0,116,119, 97,110,103,108,
+101, 91, 51, 93,  0,114,111,116, 95, 97,110,103,108,101,  0,114,111,116, 95, 97,120,105,115, 91, 51, 93,  0,114,101,103,105,111,
+110, 98, 97,115,101,  0,115,112, 97, 99,101,116,121,112,101,  0, 98,108,111, 99,107,115, 99, 97,108,101,  0, 98,108,111, 99,107,
+104, 97,110,100,108,101,114, 91, 56, 93,  0, 98,117,110,100,108,101, 95,115,105,122,101,  0, 98,117,110,100,108,101, 95,100,114,
+ 97,119,116,121,112,101,  0,108, 97,121, 95,117,115,101,100,  0, 42,111, 98, 95, 99,101,110,116,114,101,  0, 98,103,112,105, 99,
+ 98, 97,115,101,  0, 42, 98,103,112,105, 99,  0,111, 98, 95, 99,101,110,116,114,101, 95, 98,111,110,101, 91, 54, 52, 93,  0,100,
+114, 97,119,116,121,112,101,  0,111, 98, 95, 99,101,110,116,114,101, 95, 99,117,114,115,111,114,  0,115, 99,101,110,101,108,111,
+ 99,107,  0, 97,114,111,117,110,100,  0,103,114,105,100,  0,110,101, 97,114,  0,102, 97,114,  0,109,111,100,101,115,101,108,101,
+ 99,116,  0,103,114,105,100,108,105,110,101,115,  0,103,114,105,100,115,117, 98,100,105,118,  0,103,114,105,100,102,108, 97,103,
+  0,116,119,116,121,112,101,  0,116,119,109,111,100,101,  0,116,119,102,108, 97,103,  0,112, 97,100, 50, 91, 50, 93,  0, 97,102,
+116,101,114,100,114, 97,119, 95,116,114, 97,110,115,112,  0, 97,102,116,101,114,100,114, 97,119, 95,120,114, 97,121,  0, 97,102,
+116,101,114,100,114, 97,119, 95,120,114, 97,121,116,114, 97,110,115,112,  0,122, 98,117,102,  0,120,114, 97,121,  0,112, 97,100,
+ 51, 91, 50, 93,  0, 42,112,114,111,112,101,114,116,105,101,115, 95,115,116,111,114, 97,103,101,  0,118,101,114,116,  0,104,111,
+114,  0,109, 97,115,107,  0,109,105,110, 91, 50, 93,  0,109, 97,120, 91, 50, 93,  0,109,105,110,122,111,111,109,  0,109, 97,120,
+122,111,111,109,  0,115, 99,114,111,108,108,  0,115, 99,114,111,108,108, 95,117,105,  0,107,101,101,112,116,111,116,  0,107,101,
+101,112,122,111,111,109,  0,107,101,101,112,111,102,115,  0, 97,108,105,103,110,  0,119,105,110,120,  0,119,105,110,121,  0,111,
+108,100,119,105,110,120,  0,111,108,100,119,105,110,121,  0, 42,116, 97, 98, 95,111,102,102,115,101,116,  0,116, 97, 98, 95,110,
+117,109,  0,116, 97, 98, 95, 99,117,114,  0,114,112,116, 95,109, 97,115,107,  0,118, 50,100,  0, 42, 97,100,115,  0,103,104,111,
+115,116, 67,117,114,118,101,115,  0, 97,117,116,111,115,110, 97,112,  0, 99,117,114,115,111,114, 86, 97,108,  0,109, 97,105,110,
+ 98,  0,109, 97,105,110, 98,111,  0,109, 97,105,110, 98,117,115,101,114,  0,114,101, 95, 97,108,105,103,110,  0,112,114,101,118,
+105,101,119,  0,116,101,120,116,117,114,101, 95, 99,111,110,116,101,120,116,  0,112, 97,116,104,102,108, 97,103,  0,100, 97,116,
+ 97,105, 99,111,110,  0, 42,112,105,110,105,100,  0, 42,116,101,120,117,115,101,114,  0,114,101,110,100,101,114, 95,115,105,122,
+101,  0, 99,104, 97,110,115,104,111,119,110,  0,122,101, 98,114, 97,  0,122,111,111,109,  0,116,105,116,108,101, 91, 51, 50, 93,
+  0,100,105,114, 91, 49, 48, 53, 54, 93,  0,102,105,108,101, 91, 50, 53, 54, 93,  0,114,101,110, 97,109,101,102,105,108,101, 91,
+ 50, 53, 54, 93,  0,114,101,110, 97,109,101,101,100,105,116, 91, 50, 53, 54, 93,  0,102,105,108,116,101,114, 95,103,108,111, 98,
+ 91, 54, 52, 93,  0, 97, 99,116,105,118,101, 95,102,105,108,101,  0,115,101,108, 95,102,105,114,115,116,  0,115,101,108, 95,108,
+ 97,115,116,  0,115,111,114,116,  0,100,105,115,112,108, 97,121,  0,102, 95,102,112,  0,102,112, 95,115,116,114, 91, 56, 93,  0,
+115, 99,114,111,108,108, 95,111,102,102,115,101,116,  0, 42,112, 97,114, 97,109,115,  0, 42,102,105,108,101,115,  0, 42,102,111,
+108,100,101,114,115, 95,112,114,101,118,  0, 42,102,111,108,100,101,114,115, 95,110,101,120,116,  0, 42,111,112,  0, 42,115,109,
+111,111,116,104,115, 99,114,111,108,108, 95,116,105,109,101,114,  0, 42,108, 97,121,111,117,116,  0,114,101, 99,101,110,116,110,
+114,  0, 98,111,111,107,109, 97,114,107,110,114,  0,115,121,115,116,101,109,110,114,  0,116,114,101,101,  0, 42,116,114,101,101,
+115,116,111,114,101,  0,115,101, 97,114, 99,104, 95,115,116,114,105,110,103, 91, 51, 50, 93,  0,115,101, 97,114, 99,104, 95,116,
+115,101,  0,111,117,116,108,105,110,101,118,105,115,  0,115,116,111,114,101,102,108, 97,103,  0,115,101, 97,114, 99,104, 95,102,
+108, 97,103,115,  0, 42, 99,117,109, 97,112,  0,115, 99,111,112,101,115,  0,115, 97,109,112,108,101, 95,108,105,110,101, 95,104,
+105,115,116,  0, 99,117,114,115,111,114, 91, 50, 93,  0, 99,101,110,116,120,  0, 99,101,110,116,121,  0, 99,117,114,116,105,108,
+101,  0,108,111, 99,107,  0,112,105,110,  0,100,116, 95,117,118,  0,115,116,105, 99,107,121,  0,100,116, 95,117,118,115,116,114,
+101,116, 99,104,  0, 42,116,101,120,116,  0,116,111,112,  0,118,105,101,119,108,105,110,101,115,  0,109,101,110,117,110,114,  0,
+108,104,101,105,103,104,116,  0, 99,119,105,100,116,104,  0,108,105,110,101,110,114,115, 95,116,111,116,  0,108,101,102,116,  0,
+115,104,111,119,108,105,110,101,110,114,115,  0,116, 97, 98,110,117,109, 98,101,114,  0,115,104,111,119,115,121,110,116, 97,120,
+  0,108,105,110,101, 95,104,108,105,103,104,116,  0,111,118,101,114,119,114,105,116,101,  0,108,105,118,101, 95,101,100,105,116,
+  0,112,105,120, 95,112,101,114, 95,108,105,110,101,  0,116,120,116,115, 99,114,111,108,108,  0,116,120,116, 98, 97,114,  0,119,
+111,114,100,119,114, 97,112,  0,100,111,112,108,117,103,105,110,115,  0,102,105,110,100,115,116,114, 91, 50, 53, 54, 93,  0,114,
+101,112,108, 97, 99,101,115,116,114, 91, 50, 53, 54, 93,  0,109, 97,114,103,105,110, 95, 99,111,108,117,109,110,  0, 42,100,114,
+ 97,119, 99, 97, 99,104,101,  0, 42,112,121, 95,100,114, 97,119,  0, 42,112,121, 95,101,118,101,110,116,  0, 42,112,121, 95, 98,
+117,116,116,111,110,  0, 42,112,121, 95, 98,114,111,119,115,101,114, 99, 97,108,108, 98, 97, 99,107,  0, 42,112,121, 95,103,108,
+111, 98, 97,108,100,105, 99,116,  0,108, 97,115,116,115,112, 97, 99,101,  0,115, 99,114,105,112,116,110, 97,109,101, 91, 49, 48,
+ 50, 52, 93,  0,115, 99,114,105,112,116, 97,114,103, 91, 50, 53, 54, 93,  0, 42,115, 99,114,105,112,116,  0, 42, 98,117,116, 95,
+114,101,102,115,  0, 42, 97,114,114, 97,121,  0, 99, 97, 99,104,101,115,  0, 99, 97, 99,104,101, 95,100,105,115,112,108, 97,121,
+  0, 42,105,100,  0, 97,115,112,101, 99,116,  0,112, 97,100,102,  0,109,120,  0,109,121,  0, 42,101,100,105,116,116,114,101,101,
+  0,116,114,101,101,116,121,112,101,  0,116,101,120,102,114,111,109,  0,115,104, 97,100,101,114,102,114,111,109,  0,108,105,110,
+107,100,114, 97,103,  0,108,101,110, 95, 97,108,108,111, 99,  0, 99,117,114,115,111,114,  0,115, 99,114,111,108,108, 98, 97, 99,
+107,  0,104,105,115,116,111,114,121,  0,112,114,111,109,112,116, 91, 50, 53, 54, 93,  0,108, 97,110,103,117, 97,103,101, 91, 51,
+ 50, 93,  0,115,101,108, 95,115,116, 97,114,116,  0,115,101,108, 95,101,110,100,  0,102,105,108,116,101,114, 91, 54, 52, 93,  0,
+120,108,111, 99,107,111,102,  0,121,108,111, 99,107,111,102,  0,117,115,101,114,  0,112, 97,116,104, 95,108,101,110,103,116,104,
+  0,108,111, 99, 91, 50, 93,  0,115,116, 97, 98,109, 97,116, 91, 52, 93, 91, 52, 93,  0,117,110,105,115,116, 97, 98,109, 97,116,
+ 91, 52, 93, 91, 52, 93,  0,112,111,115,116,112,114,111, 99, 95,102,108, 97,103,  0,114,117,110,116,105,109,101, 95,102,108, 97,
+103,  0,102,105,108,101,110, 97,109,101, 91, 49, 48, 50, 52, 93,  0, 98,108,102, 95,105,100,  0,117,105,102,111,110,116, 95,105,
+100,  0,114, 95,116,111, 95,108,  0,112,111,105,110,116,115,  0,107,101,114,110,105,110,103,  0,105,116, 97,108,105, 99,  0, 98,
+111,108,100,  0,115,104, 97,100,111,119,  0,115,104, 97,100,120,  0,115,104, 97,100,121,  0,115,104, 97,100,111,119, 97,108,112,
+104, 97,  0,115,104, 97,100,111,119, 99,111,108,111,114,  0,112, 97,110,101,108,116,105,116,108,101,  0,103,114,111,117,112,108,
+ 97, 98,101,108,  0,119,105,100,103,101,116,108, 97, 98,101,108,  0,119,105,100,103,101,116,  0,112, 97,110,101,108,122,111,111,
+109,  0,109,105,110,108, 97, 98,101,108, 99,104, 97,114,115,  0,109,105,110,119,105,100,103,101,116, 99,104, 97,114,115,  0, 99,
+111,108,117,109,110,115,112, 97, 99,101,  0,116,101,109,112,108, 97,116,101,115,112, 97, 99,101,  0, 98,111,120,115,112, 97, 99,
+101,  0, 98,117,116,116,111,110,115,112, 97, 99,101,120,  0, 98,117,116,116,111,110,115,112, 97, 99,101,121,  0,112, 97,110,101,
+108,115,112, 97, 99,101,  0,112, 97,110,101,108,111,117,116,101,114,  0,111,117,116,108,105,110,101, 91, 52, 93,  0,105,110,110,
+101,114, 91, 52, 93,  0,105,110,110,101,114, 95,115,101,108, 91, 52, 93,  0,105,116,101,109, 91, 52, 93,  0,116,101,120,116, 91,
+ 52, 93,  0,116,101,120,116, 95,115,101,108, 91, 52, 93,  0,115,104, 97,100,101,100,  0,115,104, 97,100,101,116,111,112,  0,115,
+104, 97,100,101,100,111,119,110,  0, 97,108,112,104, 97, 95, 99,104,101, 99,107,  0,105,110,110,101,114, 95, 97,110,105,109, 91,
+ 52, 93,  0,105,110,110,101,114, 95, 97,110,105,109, 95,115,101,108, 91, 52, 93,  0,105,110,110,101,114, 95,107,101,121, 91, 52,
+ 93,  0,105,110,110,101,114, 95,107,101,121, 95,115,101,108, 91, 52, 93,  0,105,110,110,101,114, 95,100,114,105,118,101,110, 91,
+ 52, 93,  0,105,110,110,101,114, 95,100,114,105,118,101,110, 95,115,101,108, 91, 52, 93,  0,104,101, 97,100,101,114, 91, 52, 93,
+  0,115,104,111,119, 95,104,101, 97,100,101,114,  0,119, 99,111,108, 95,114,101,103,117,108, 97,114,  0,119, 99,111,108, 95,116,
+111,111,108,  0,119, 99,111,108, 95,116,101,120,116,  0,119, 99,111,108, 95,114, 97,100,105,111,  0,119, 99,111,108, 95,111,112,
+116,105,111,110,  0,119, 99,111,108, 95,116,111,103,103,108,101,  0,119, 99,111,108, 95,110,117,109,  0,119, 99,111,108, 95,110,
+117,109,115,108,105,100,101,114,  0,119, 99,111,108, 95,109,101,110,117,  0,119, 99,111,108, 95,112,117,108,108,100,111,119,110,
+  0,119, 99,111,108, 95,109,101,110,117, 95, 98, 97, 99,107,  0,119, 99,111,108, 95,109,101,110,117, 95,105,116,101,109,  0,119,
+ 99,111,108, 95,116,111,111,108,116,105,112,  0,119, 99,111,108, 95, 98,111,120,  0,119, 99,111,108, 95,115, 99,114,111,108,108,
+  0,119, 99,111,108, 95,112,114,111,103,114,101,115,115,  0,119, 99,111,108, 95,108,105,115,116, 95,105,116,101,109,  0,119, 99,
+111,108, 95,115,116, 97,116,101,  0,112, 97,110,101,108,  0,105, 99,111,110,102,105,108,101, 91, 50, 53, 54, 93,  0,105, 99,111,
+110, 95, 97,108,112,104, 97,  0, 98, 97, 99,107, 91, 52, 93,  0,116,105,116,108,101, 91, 52, 93,  0,116,101,120,116, 95,104,105,
+ 91, 52, 93,  0,104,101, 97,100,101,114, 95,116,105,116,108,101, 91, 52, 93,  0,104,101, 97,100,101,114, 95,116,101,120,116, 91,
+ 52, 93,  0,104,101, 97,100,101,114, 95,116,101,120,116, 95,104,105, 91, 52, 93,  0, 98,117,116,116,111,110, 91, 52, 93,  0, 98,
+117,116,116,111,110, 95,116,105,116,108,101, 91, 52, 93,  0, 98,117,116,116,111,110, 95,116,101,120,116, 91, 52, 93,  0, 98,117,
+116,116,111,110, 95,116,101,120,116, 95,104,105, 91, 52, 93,  0,108,105,115,116, 91, 52, 93,  0,108,105,115,116, 95,116,105,116,
+108,101, 91, 52, 93,  0,108,105,115,116, 95,116,101,120,116, 91, 52, 93,  0,108,105,115,116, 95,116,101,120,116, 95,104,105, 91,
+ 52, 93,  0,112, 97,110,101,108, 91, 52, 93,  0,112, 97,110,101,108, 95,116,105,116,108,101, 91, 52, 93,  0,112, 97,110,101,108,
+ 95,116,101,120,116, 91, 52, 93,  0,112, 97,110,101,108, 95,116,101,120,116, 95,104,105, 91, 52, 93,  0,115,104, 97,100,101, 49,
+ 91, 52, 93,  0,115,104, 97,100,101, 50, 91, 52, 93,  0,104,105,108,105,116,101, 91, 52, 93,  0,103,114,105,100, 91, 52, 93,  0,
+119,105,114,101, 91, 52, 93,  0,115,101,108,101, 99,116, 91, 52, 93,  0,108, 97,109,112, 91, 52, 93,  0,115,112,101, 97,107,101,
+114, 91, 52, 93,  0,101,109,112,116,121, 91, 52, 93,  0, 99, 97,109,101,114, 97, 91, 52, 93,  0,112, 97,100, 91, 56, 93,  0, 97,
+ 99,116,105,118,101, 91, 52, 93,  0,103,114,111,117,112, 91, 52, 93,  0,103,114,111,117,112, 95, 97, 99,116,105,118,101, 91, 52,
+ 93,  0,116,114, 97,110,115,102,111,114,109, 91, 52, 93,  0,118,101,114,116,101,120, 91, 52, 93,  0,118,101,114,116,101,120, 95,
+115,101,108,101, 99,116, 91, 52, 93,  0,101,100,103,101, 91, 52, 93,  0,101,100,103,101, 95,115,101,108,101, 99,116, 91, 52, 93,
+  0,101,100,103,101, 95,115,101, 97,109, 91, 52, 93,  0,101,100,103,101, 95,115,104, 97,114,112, 91, 52, 93,  0,101,100,103,101,
+ 95,102, 97, 99,101,115,101,108, 91, 52, 93,  0,101,100,103,101, 95, 99,114,101, 97,115,101, 91, 52, 93,  0,102, 97, 99,101, 91,
+ 52, 93,  0,102, 97, 99,101, 95,115,101,108,101, 99,116, 91, 52, 93,  0,102, 97, 99,101, 95,100,111,116, 91, 52, 93,  0,101,120,
+116,114, 97, 95,101,100,103,101, 95,108,101,110, 91, 52, 93,  0,101,120,116,114, 97, 95,102, 97, 99,101, 95, 97,110,103,108,101,
+ 91, 52, 93,  0,101,120,116,114, 97, 95,102, 97, 99,101, 95, 97,114,101, 97, 91, 52, 93,  0,112, 97,100, 51, 91, 52, 93,  0,110,
+111,114,109, 97,108, 91, 52, 93,  0,118,101,114,116,101,120, 95,110,111,114,109, 97,108, 91, 52, 93,  0, 98,111,110,101, 95,115,
+111,108,105,100, 91, 52, 93,  0, 98,111,110,101, 95,112,111,115,101, 91, 52, 93,  0,115,116,114,105,112, 91, 52, 93,  0,115,116,
+114,105,112, 95,115,101,108,101, 99,116, 91, 52, 93,  0, 99,102,114, 97,109,101, 91, 52, 93,  0,110,117,114, 98, 95,117,108,105,
+110,101, 91, 52, 93,  0,110,117,114, 98, 95,118,108,105,110,101, 91, 52, 93,  0, 97, 99,116, 95,115,112,108,105,110,101, 91, 52,
+ 93,  0,110,117,114, 98, 95,115,101,108, 95,117,108,105,110,101, 91, 52, 93,  0,110,117,114, 98, 95,115,101,108, 95,118,108,105,
+110,101, 91, 52, 93,  0,108, 97,115,116,115,101,108, 95,112,111,105,110,116, 91, 52, 93,  0,104, 97,110,100,108,101, 95,102,114,
+101,101, 91, 52, 93,  0,104, 97,110,100,108,101, 95, 97,117,116,111, 91, 52, 93,  0,104, 97,110,100,108,101, 95,118,101, 99,116,
+ 91, 52, 93,  0,104, 97,110,100,108,101, 95, 97,108,105,103,110, 91, 52, 93,  0,104, 97,110,100,108,101, 95, 97,117,116,111, 95,
+ 99,108, 97,109,112,101,100, 91, 52, 93,  0,104, 97,110,100,108,101, 95,115,101,108, 95,102,114,101,101, 91, 52, 93,  0,104, 97,
+110,100,108,101, 95,115,101,108, 95, 97,117,116,111, 91, 52, 93,  0,104, 97,110,100,108,101, 95,115,101,108, 95,118,101, 99,116,
+ 91, 52, 93,  0,104, 97,110,100,108,101, 95,115,101,108, 95, 97,108,105,103,110, 91, 52, 93,  0,104, 97,110,100,108,101, 95,115,
+101,108, 95, 97,117,116,111, 95, 99,108, 97,109,112,101,100, 91, 52, 93,  0,100,115, 95, 99,104, 97,110,110,101,108, 91, 52, 93,
+  0,100,115, 95,115,117, 98, 99,104, 97,110,110,101,108, 91, 52, 93,  0, 99,111,110,115,111,108,101, 95,111,117,116,112,117,116,
+ 91, 52, 93,  0, 99,111,110,115,111,108,101, 95,105,110,112,117,116, 91, 52, 93,  0, 99,111,110,115,111,108,101, 95,105,110,102,
+111, 91, 52, 93,  0, 99,111,110,115,111,108,101, 95,101,114,114,111,114, 91, 52, 93,  0, 99,111,110,115,111,108,101, 95, 99,117,
+114,115,111,114, 91, 52, 93,  0,118,101,114,116,101,120, 95,115,105,122,101,  0,111,117,116,108,105,110,101, 95,119,105,100,116,
+104,  0,102, 97, 99,101,100,111,116, 95,115,105,122,101,  0,110,111,111,100,108,101, 95, 99,117,114,118,105,110,103,  0,115,121,
+110,116, 97,120,108, 91, 52, 93,  0,115,121,110,116, 97,120,110, 91, 52, 93,  0,115,121,110,116, 97,120, 98, 91, 52, 93,  0,115,
+121,110,116, 97,120,118, 91, 52, 93,  0,115,121,110,116, 97,120, 99, 91, 52, 93,  0,109,111,118,105,101, 91, 52, 93,  0,109,111,
+118,105,101, 99,108,105,112, 91, 52, 93,  0,105,109, 97,103,101, 91, 52, 93,  0,115, 99,101,110,101, 91, 52, 93,  0, 97,117,100,
+105,111, 91, 52, 93,  0,101,102,102,101, 99,116, 91, 52, 93,  0,112,108,117,103,105,110, 91, 52, 93,  0,116,114, 97,110,115,105,
+116,105,111,110, 91, 52, 93,  0,109,101,116, 97, 91, 52, 93,  0,101,100,105,116,109,101,115,104, 95, 97, 99,116,105,118,101, 91,
+ 52, 93,  0,104, 97,110,100,108,101, 95,118,101,114,116,101,120, 91, 52, 93,  0,104, 97,110,100,108,101, 95,118,101,114,116,101,
+120, 95,115,101,108,101, 99,116, 91, 52, 93,  0,104, 97,110,100,108,101, 95,118,101,114,116,101,120, 95,115,105,122,101,  0,109,
+ 97,114,107,101,114, 95,111,117,116,108,105,110,101, 91, 52, 93,  0,109, 97,114,107,101,114, 91, 52, 93,  0, 97, 99,116, 95,109,
+ 97,114,107,101,114, 91, 52, 93,  0,115,101,108, 95,109, 97,114,107,101,114, 91, 52, 93,  0,100,105,115, 95,109, 97,114,107,101,
+114, 91, 52, 93,  0,108,111, 99,107, 95,109, 97,114,107,101,114, 91, 52, 93,  0, 98,117,110,100,108,101, 95,115,111,108,105,100,
+ 91, 52, 93,  0,112, 97,116,104, 95, 98,101,102,111,114,101, 91, 52, 93,  0,112, 97,116,104, 95, 97,102,116,101,114, 91, 52, 93,
+  0, 99, 97,109,101,114, 97, 95,112, 97,116,104, 91, 52, 93,  0,104,112, 97,100, 91, 55, 93,  0,112,114,101,118,105,101,119, 95,
+ 98, 97, 99,107, 91, 52, 93,  0,112,114,101,118,105,101,119, 95,115,116,105,116, 99,104, 95,102, 97, 99,101, 91, 52, 93,  0,112,
+114,101,118,105,101,119, 95,115,116,105,116, 99,104, 95,101,100,103,101, 91, 52, 93,  0,112,114,101,118,105,101,119, 95,115,116,
+105,116, 99,104, 95,118,101,114,116, 91, 52, 93,  0,112,114,101,118,105,101,119, 95,115,116,105,116, 99,104, 95,115,116,105,116,
+ 99,104, 97, 98,108,101, 91, 52, 93,  0,112,114,101,118,105,101,119, 95,115,116,105,116, 99,104, 95,117,110,115,116,105,116, 99,
+104, 97, 98,108,101, 91, 52, 93,  0,112,114,101,118,105,101,119, 95,115,116,105,116, 99,104, 95, 97, 99,116,105,118,101, 91, 52,
+ 93,  0,109, 97,116, 99,104, 91, 52, 93,  0,115,101,108,101, 99,116,101,100, 95,104,105,103,104,108,105,103,104,116, 91, 52, 93,
+  0,115,111,108,105,100, 91, 52, 93,  0,116,117,105,  0,116, 98,117,116,115,  0,116,118, 51,100,  0,116,102,105,108,101,  0,116,
+105,112,111,  0,116,105,110,102,111,  0,116, 97, 99,116,  0,116,110,108, 97,  0,116,115,101,113,  0,116,105,109, 97,  0,116,101,
+120,116,  0,116,111,111,112,115,  0,116,116,105,109,101,  0,116,110,111,100,101,  0,116,108,111,103,105, 99,  0,116,117,115,101,
+114,112,114,101,102,  0,116, 99,111,110,115,111,108,101,  0,116, 99,108,105,112,  0,116, 97,114,109, 91, 50, 48, 93,  0, 97, 99,
+116,105,118,101, 95,116,104,101,109,101, 95, 97,114,101, 97,  0,109,111,100,117,108,101, 91, 54, 52, 93,  0,115,112,101, 99, 91,
+ 52, 93,  0,100,117,112,102,108, 97,103,  0,115, 97,118,101,116,105,109,101,  0,116,101,109,112,100,105,114, 91, 55, 54, 56, 93,
+  0,102,111,110,116,100,105,114, 91, 55, 54, 56, 93,  0,114,101,110,100,101,114,100,105,114, 91, 49, 48, 50, 52, 93,  0,116,101,
+120,116,117,100,105,114, 91, 55, 54, 56, 93,  0,112,108,117,103,116,101,120,100,105,114, 91, 55, 54, 56, 93,  0,112,108,117,103,
+115,101,113,100,105,114, 91, 55, 54, 56, 93,  0,112,121,116,104,111,110,100,105,114, 91, 55, 54, 56, 93,  0,115,111,117,110,100,
+100,105,114, 91, 55, 54, 56, 93,  0,105,109, 97,103,101, 95,101,100,105,116,111,114, 91, 49, 48, 50, 52, 93,  0, 97,110,105,109,
+ 95,112,108, 97,121,101,114, 91, 49, 48, 50, 52, 93,  0, 97,110,105,109, 95,112,108, 97,121,101,114, 95,112,114,101,115,101,116,
+  0,118, 50,100, 95,109,105,110, 95,103,114,105,100,115,105,122,101,  0,116,105,109,101, 99,111,100,101, 95,115,116,121,108,101,
+  0,118,101,114,115,105,111,110,115,  0,100, 98,108, 95, 99,108,105, 99,107, 95,116,105,109,101,  0,103, 97,109,101,102,108, 97,
+103,115,  0,119,104,101,101,108,108,105,110,101,115, 99,114,111,108,108,  0,117,105,102,108, 97,103,  0,108, 97,110,103,117, 97,
+103,101,  0,117,115,101,114,112,114,101,102,  0,118,105,101,119,122,111,111,109,  0,109,105,120, 98,117,102,115,105,122,101,  0,
+ 97,117,100,105,111,100,101,118,105, 99,101,  0, 97,117,100,105,111,114, 97,116,101,  0, 97,117,100,105,111,102,111,114,109, 97,
+116,  0, 97,117,100,105,111, 99,104, 97,110,110,101,108,115,  0,100,112,105,  0,101,110, 99,111,100,105,110,103,  0,116,114, 97,
+110,115,111,112,116,115,  0,109,101,110,117,116,104,114,101,115,104,111,108,100, 49,  0,109,101,110,117,116,104,114,101,115,104,
+111,108,100, 50,  0,116,104,101,109,101,115,  0,117,105,102,111,110,116,115,  0,117,105,115,116,121,108,101,115,  0,107,101,121,
+109, 97,112,115,  0,117,115,101,114, 95,107,101,121,109, 97,112,115,  0, 97,100,100,111,110,115,  0,107,101,121, 99,111,110,102,
+105,103,115,116,114, 91, 54, 52, 93,  0,117,110,100,111,115,116,101,112,115,  0,117,110,100,111,109,101,109,111,114,121,  0,103,
+112, 95,109, 97,110,104, 97,116,116,101,110,100,105,115,116,  0,103,112, 95,101,117, 99,108,105,100,101, 97,110,100,105,115,116,
+  0,103,112, 95,101,114, 97,115,101,114,  0,103,112, 95,115,101,116,116,105,110,103,115,  0,116, 98, 95,108,101,102,116,109,111,
+117,115,101,  0,116, 98, 95,114,105,103,104,116,109,111,117,115,101,  0,108,105,103,104,116, 91, 51, 93,  0,116,119, 95,104,111,
+116,115,112,111,116,  0,116,119, 95,102,108, 97,103,  0,116,119, 95,104, 97,110,100,108,101,115,105,122,101,  0,116,119, 95,115,
+105,122,101,  0,116,101,120,116,105,109,101,111,117,116,  0,116,101,120, 99,111,108,108,101, 99,116,114, 97,116,101,  0,119,109,
+100,114, 97,119,109,101,116,104,111,100,  0,100,114, 97,103,116,104,114,101,115,104,111,108,100,  0,109,101,109, 99, 97, 99,104,
+101,108,105,109,105,116,  0,112,114,101,102,101,116, 99,104,102,114, 97,109,101,115,  0,102,114, 97,109,101,115,101,114,118,101,
+114,112,111,114,116,  0,112, 97,100, 95,114,111,116, 95, 97,110,103,108,101,  0,111, 98, 99,101,110,116,101,114, 95,100,105, 97,
+  0,114,118,105,115,105,122,101,  0,114,118,105, 98,114,105,103,104,116,  0,114,101, 99,101,110,116, 95,102,105,108,101,115,  0,
+115,109,111,111,116,104, 95,118,105,101,119,116,120,  0,103,108,114,101,115,108,105,109,105,116,  0, 99,117,114,115,115,105,122,
+101,  0, 99,111,108,111,114, 95,112,105, 99,107,101,114, 95,116,121,112,101,  0,105,112,111, 95,110,101,119,  0,107,101,121,104,
+ 97,110,100,108,101,115, 95,110,101,119,  0,115, 99,114, 99, 97,115,116,102,112,115,  0,115, 99,114, 99, 97,115,116,119, 97,105,
+116,  0,119,105,100,103,101,116, 95,117,110,105,116,  0, 97,110,105,115,111,116,114,111,112,105, 99, 95,102,105,108,116,101,114,
+  0,117,115,101, 95, 49, 54, 98,105,116, 95,116,101,120,116,117,114,101,115,  0,112, 97,100, 56,  0,110,100,111,102, 95,115,101,
+110,115,105,116,105,118,105,116,121,  0,110,100,111,102, 95,102,108, 97,103,  0,103,108, 97,108,112,104, 97, 99,108,105,112,  0,
+116,101,120,116, 95,114,101,110,100,101,114,  0,112, 97,100, 57,  0, 99,111, 98, 97, 95,119,101,105,103,104,116,  0,115, 99,117,
+108,112,116, 95,112, 97,105,110,116, 95,111,118,101,114,108, 97,121, 95, 99,111,108, 91, 51, 93,  0,116,119,101, 97,107, 95,116,
+104,114,101,115,104,111,108,100,  0, 97,117,116,104,111,114, 91, 56, 48, 93,  0, 99,111,109,112,117,116,101, 95,100,101,118,105,
+ 99,101, 95,116,121,112,101,  0, 99,111,109,112,117,116,101, 95,100,101,118,105, 99,101, 95,105,100,  0,102, 99,117, 95,105,110,
+ 97, 99,116,105,118,101, 95, 97,108,112,104, 97,  0,118,101,114,116, 98, 97,115,101,  0,101,100,103,101, 98, 97,115,101,  0, 97,
+114,101, 97, 98, 97,115,101,  0, 42,110,101,119,115, 99,101,110,101,  0,114,101,100,114, 97,119,115, 95,102,108, 97,103,  0,102,
+117,108,108,  0,116,101,109,112,  0,119,105,110,105,100,  0,100,111, 95,100,114, 97,119,  0,100,111, 95,114,101,102,114,101,115,
+104,  0,100,111, 95,100,114, 97,119, 95,103,101,115,116,117,114,101,  0,100,111, 95,100,114, 97,119, 95,112, 97,105,110,116, 99,
+117,114,115,111,114,  0,100,111, 95,100,114, 97,119, 95,100,114, 97,103,  0,115,119, 97,112,  0,109, 97,105,110,119,105,110,  0,
+115,117, 98,119,105,110, 97, 99,116,105,118,101,  0, 42, 97,110,105,109,116,105,109,101,114,  0, 42, 99,111,110,116,101,120,116,
+  0,104, 97,110,100,108,101,114, 91, 56, 93,  0, 42,110,101,119,118,  0,118,101, 99,  0, 42,118, 49,  0, 42,118, 50,  0, 42,116,
+121,112,101,  0,112, 97,110,101,108,110, 97,109,101, 91, 54, 52, 93,  0,116, 97, 98,110, 97,109,101, 91, 54, 52, 93,  0,100,114,
+ 97,119,110, 97,109,101, 91, 54, 52, 93,  0,111,102,115,120,  0,111,102,115,121,  0,115,105,122,101,120,  0,115,105,122,101,121,
+  0,108, 97, 98,101,108,111,102,115,  0, 99,111,110,116,114,111,108,  0,115,110, 97,112,  0,115,111,114,116,111,114,100,101,114,
+  0, 42,112, 97,110,101,108,116, 97, 98,  0, 42, 97, 99,116,105,118,101,100, 97,116, 97,  0,108,105,115,116, 95,115, 99,114,111,
+108,108,  0,108,105,115,116, 95,115,105,122,101,  0,108,105,115,116, 95,108, 97,115,116, 95,108,101,110,  0,108,105,115,116, 95,
+103,114,105,112, 95,115,105,122,101,  0,108,105,115,116, 95,115,101, 97,114, 99,104, 91, 54, 52, 93,  0, 42,118, 51,  0, 42,118,
+ 52,  0, 42,102,117,108,108,  0, 98,117,116,115,112, 97, 99,101,116,121,112,101,  0,104,101, 97,100,101,114,116,121,112,101,  0,
+115,112, 97, 99,101,100, 97,116, 97,  0,104, 97,110,100,108,101,114,115,  0, 97, 99,116,105,111,110,122,111,110,101,115,  0,119,
+105,110,114, 99,116,  0,100,114, 97,119,114, 99,116,  0,115,119,105,110,105,100,  0,114,101,103,105,111,110,116,121,112,101,  0,
+ 97,108,105,103,110,109,101,110,116,  0,100,111, 95,100,114, 97,119, 95,111,118,101,114,108, 97,121,  0,117,105, 98,108,111, 99,
+107,115,  0,112, 97,110,101,108,115,  0, 42,104,101, 97,100,101,114,115,116,114,  0, 42,114,101,103,105,111,110,100, 97,116, 97,
+  0,115,117, 98,118,115,116,114, 91, 52, 93,  0,115,117, 98,118,101,114,115,105,111,110,  0,112, 97,100,115,  0,109,105,110,118,
+101,114,115,105,111,110,  0,109,105,110,115,117, 98,118,101,114,115,105,111,110,  0,119,105,110,112,111,115,  0, 42, 99,117,114,
+115, 99,114,101,101,110,  0, 42, 99,117,114,115, 99,101,110,101,  0,102,105,108,101,102,108, 97,103,115,  0,103,108,111, 98, 97,
+108,102,  0,114,101,118,105,115,105,111,110,  0,110, 97,109,101, 91, 50, 53, 54, 93,  0,111,114,105,103, 95,119,105,100,116,104,
+  0,111,114,105,103, 95,104,101,105,103,104,116,  0, 98,111,116,116,111,109,  0,114,105,103,104,116,  0,120,111,102,115,  0,121,
+111,102,115,  0,108,105,102,116, 91, 51, 93,  0,103, 97,109,109, 97, 91, 51, 93,  0,103, 97,105,110, 91, 51, 93,  0,100,105,114,
+ 91, 55, 54, 56, 93,  0,116, 99,  0, 98,117,105,108,100, 95,115,105,122,101, 95,102,108, 97,103,115,  0, 98,117,105,108,100, 95,
+116, 99, 95,102,108, 97,103,115,  0,100,111,110,101,  0,115,116, 97,114,116,115,116,105,108,108,  0,101,110,100,115,116,105,108,
+108,  0, 42,115,116,114,105,112,100, 97,116, 97,  0, 42, 99,114,111,112,  0, 42,116,114, 97,110,115,102,111,114,109,  0, 42, 99,
+111,108,111,114, 95, 98, 97,108, 97,110, 99,101,  0, 42,105,110,115,116, 97,110, 99,101, 95,112,114,105,118, 97,116,101, 95,100,
+ 97,116, 97,  0, 42, 42, 99,117,114,114,101,110,116, 95,112,114,105,118, 97,116,101, 95,100, 97,116, 97,  0, 42,116,109,112,  0,
+115,116, 97,114,116,111,102,115,  0,101,110,100,111,102,115,  0,109, 97, 99,104,105,110,101,  0,115,116, 97,114,116,100,105,115,
+112,  0,101,110,100,100,105,115,112,  0,115, 97,116,  0,109,117,108,  0,104, 97,110,100,115,105,122,101,  0, 97,110,105,109, 95,
+112,114,101,115,101,101,107,  0,115,116,114,101, 97,109,105,110,100,101,120,  0,109,117,108,116,105, 99, 97,109, 95,115,111,117,
+114, 99,101,  0, 99,108,105,112, 95,102,108, 97,103,  0, 42,115,116,114,105,112,  0, 42,115, 99,101,110,101, 95, 99, 97,109,101,
+114, 97,  0,101,102,102,101, 99,116, 95,102, 97,100,101,114,  0,115,112,101,101,100, 95,102, 97,100,101,114,  0, 42,115,101,113,
+ 49,  0, 42,115,101,113, 50,  0, 42,115,101,113, 51,  0,115,101,113, 98, 97,115,101,  0, 42,115,111,117,110,100,  0, 42,115, 99,
+101,110,101, 95,115,111,117,110,100,  0,112,105,116, 99,104,  0,112, 97,110,  0,115,116,114,111, 98,101,  0, 42,101,102,102,101,
+ 99,116,100, 97,116, 97,  0, 97,110,105,109, 95,115,116, 97,114,116,111,102,115,  0, 97,110,105,109, 95,101,110,100,111,102,115,
+  0, 98,108,101,110,100, 95,109,111,100,101,  0, 98,108,101,110,100, 95,111,112, 97, 99,105,116,121,  0, 42,111,108,100, 98, 97,
+115,101,112,  0, 42,112, 97,114,115,101,113,  0, 42,115,101,113, 98, 97,115,101,112,  0,109,101,116, 97,115,116, 97, 99,107,  0,
+ 42, 97, 99,116, 95,115,101,113,  0, 97, 99,116, 95,105,109, 97,103,101,100,105,114, 91, 49, 48, 50, 52, 93,  0, 97, 99,116, 95,
+115,111,117,110,100,100,105,114, 91, 49, 48, 50, 52, 93,  0,111,118,101,114, 95,111,102,115,  0,111,118,101,114, 95, 99,102,114,
+ 97,  0,111,118,101,114, 95,102,108, 97,103,  0,111,118,101,114, 95, 98,111,114,100,101,114,  0,101,100,103,101, 87,105,100,116,
+104,  0,102,111,114,119, 97,114,100,  0,119,105,112,101,116,121,112,101,  0,102, 77,105,110,105,  0,102, 67,108, 97,109,112,  0,
+102, 66,111,111,115,116,  0,100, 68,105,115,116,  0,100, 81,117, 97,108,105,116,121,  0, 98, 78,111, 67,111,109,112,  0, 83, 99,
+ 97,108,101,120, 73,110,105,  0, 83, 99, 97,108,101,121, 73,110,105,  0,120, 73,110,105,  0,121, 73,110,105,  0,114,111,116, 73,
+110,105,  0,105,110,116,101,114,112,111,108, 97,116,105,111,110,  0,117,110,105,102,111,114,109, 95,115, 99, 97,108,101,  0, 42,
+102,114, 97,109,101, 77, 97,112,  0,103,108,111, 98, 97,108, 83,112,101,101,100,  0,108, 97,115,116, 86, 97,108,105,100, 70,114,
+ 97,109,101,  0, 98,117,116,116,121,112,101,  0,117,115,101,114,106,105,116,  0,115,116, 97,  0,116,111,116,112, 97,114,116,  0,
+110,111,114,109,102, 97, 99,  0,111, 98,102, 97, 99,  0,114, 97,110,100,102, 97, 99,  0,116,101,120,102, 97, 99,  0,114, 97,110,
+100,108,105,102,101,  0,102,111,114, 99,101, 91, 51, 93,  0,118,101, 99,116,115,105,122,101,  0,109, 97,120,108,101,110,  0,100,
+101,102,118,101, 99, 91, 51, 93,  0,109,117,108,116, 91, 52, 93,  0,108,105,102,101, 91, 52, 93,  0, 99,104,105,108,100, 91, 52,
+ 93,  0,109, 97,116, 91, 52, 93,  0,116,101,120,109, 97,112,  0, 99,117,114,109,117,108,116,  0,115,116, 97,116,105, 99,115,116,
+101,112,  0,111,109, 97,116,  0,116,105,109,101,116,101,120,  0,115,112,101,101,100,116,101,120,  0,102,108, 97,103, 50,110,101,
+103,  0,118,101,114,116,103,114,111,117,112, 95,118,  0,118,103,114,111,117,112,110, 97,109,101, 91, 54, 52, 93,  0,118,103,114,
+111,117,112,110, 97,109,101, 95,118, 91, 54, 52, 93,  0, 42,107,101,121,115,  0,109,105,110,102, 97, 99,  0,110,114,  0,117,115,
+101,100,  0,117,115,101,100,101,108,101,109,  0, 42,112,111,105,110,  0,114,101,115,101,116,100,105,115,116,  0,108, 97,115,116,
+118, 97,108,  0, 42,109, 97,  0,107,101,121,  0,113,117, 97,108,  0,113,117, 97,108, 50,  0,116, 97,114,103,101,116, 78, 97,109,
+101, 91, 54, 52, 93,  0,116,111,103,103,108,101, 78, 97,109,101, 91, 54, 52, 93,  0,118, 97,108,117,101, 91, 54, 52, 93,  0,109,
+ 97,120,118, 97,108,117,101, 91, 54, 52, 93,  0,100,101,108, 97,121,  0,100,117,114, 97,116,105,111,110,  0,109, 97,116,101,114,
+105, 97,108, 78, 97,109,101, 91, 54, 52, 93,  0,100, 97,109,112,116,105,109,101,114,  0,112,114,111,112,110, 97,109,101, 91, 54,
+ 52, 93,  0,109, 97,116,110, 97,109,101, 91, 54, 52, 93,  0, 97,120,105,115,102,108, 97,103,  0,112,111,115,101, 99,104, 97,110,
+110,101,108, 91, 54, 52, 93,  0, 99,111,110,115,116,114, 97,105,110,116, 91, 54, 52, 93,  0, 42,102,114,111,109, 79, 98,106,101,
+ 99,116,  0,115,117, 98,106,101, 99,116, 91, 54, 52, 93,  0, 98,111,100,121, 91, 54, 52, 93,  0,111,116,121,112,101,  0,112,117,
+108,115,101,  0,102,114,101,113,  0,116,111,116,108,105,110,107,115,  0, 42, 42,108,105,110,107,115,  0,116, 97,112,  0,106,111,
+121,105,110,100,101,120,  0, 97,120,105,115, 95,115,105,110,103,108,101,  0, 97,120,105,115,102,  0, 98,117,116,116,111,110,  0,
+104, 97,116,  0,104, 97,116,102,  0,112,114,101, 99,105,115,105,111,110,  0,115,116,114, 91, 49, 50, 56, 93,  0, 42,109,121,110,
+101,119,  0,105,110,112,117,116,115,  0,116,111,116,115,108,105,110,107,115,  0, 42, 42,115,108,105,110,107,115,  0,118, 97,108,
+111,  0,115,116, 97,116,101, 95,109, 97,115,107,  0, 42, 97, 99,116,  0,102,114, 97,109,101, 80,114,111,112, 91, 54, 52, 93,  0,
+ 98,108,101,110,100,105,110,  0,112,114,105,111,114,105,116,121,  0,101,110,100, 95,114,101,115,101,116,  0,115,116,114,105,100,
+101, 97,120,105,115,  0,115,116,114,105,100,101,108,101,110,103,116,104,  0,108, 97,121,101,114, 95,119,101,105,103,104,116,  0,
+109,105,110, 95,103, 97,105,110,  0,109, 97,120, 95,103, 97,105,110,  0,114,101,102,101,114,101,110, 99,101, 95,100,105,115,116,
+ 97,110, 99,101,  0,109, 97,120, 95,100,105,115,116, 97,110, 99,101,  0,114,111,108,108,111,102,102, 95,102, 97, 99,116,111,114,
+  0, 99,111,110,101, 95,105,110,110,101,114, 95, 97,110,103,108,101,  0, 99,111,110,101, 95,111,117,116,101,114, 95, 97,110,103,
+108,101,  0, 99,111,110,101, 95,111,117,116,101,114, 95,103, 97,105,110,  0,115,110,100,110,114,  0,115,111,117,110,100, 51, 68,
+  0,112, 97,100, 54, 91, 49, 93,  0, 42,109,101,  0,108,105,110, 86,101,108,111, 99,105,116,121, 91, 51, 93,  0, 97,110,103, 86,
+101,108,111, 99,105,116,121, 91, 51, 93,  0,108,111, 99, 97,108,102,108, 97,103,  0,100,121,110, 95,111,112,101,114, 97,116,105,
+111,110,  0,102,111,114, 99,101,108,111, 99, 91, 51, 93,  0,102,111,114, 99,101,114,111,116, 91, 51, 93,  0,112, 97,100, 49, 91,
+ 51, 93,  0,108,105,110,101, 97,114,118,101,108,111, 99,105,116,121, 91, 51, 93,  0, 97,110,103,117,108, 97,114,118,101,108,111,
+ 99,105,116,121, 91, 51, 93,  0, 42,114,101,102,101,114,101,110, 99,101,  0,109,105,110,  0,109, 97,120,  0,114,111,116,100, 97,
+109,112,  0,109,105,110,108,111, 99, 91, 51, 93,  0,109, 97,120,108,111, 99, 91, 51, 93,  0,109,105,110,114,111,116, 91, 51, 93,
+  0,109, 97,120,114,111,116, 91, 51, 93,  0,109, 97,116,112,114,111,112, 91, 54, 52, 93,  0, 98,117,116,115,116, 97,  0, 98,117,
+116,101,110,100,  0,100,105,115,116,114,105, 98,117,116,105,111,110,  0,105,110,116, 95, 97,114,103, 95, 49,  0,105,110,116, 95,
+ 97,114,103, 95, 50,  0,102,108,111, 97,116, 95, 97,114,103, 95, 49,  0,102,108,111, 97,116, 95, 97,114,103, 95, 50,  0,116,111,
+ 80,114,111,112, 78, 97,109,101, 91, 54, 52, 93,  0, 42,116,111, 79, 98,106,101, 99,116,  0, 98,111,100,121, 84,121,112,101,  0,
+102,105,108,101,110, 97,109,101, 91, 54, 52, 93,  0,108,111, 97,100, 97,110,105,110, 97,109,101, 91, 54, 52, 93,  0,105,110,116,
+ 95, 97,114,103,  0,102,108,111, 97,116, 95, 97,114,103,  0,105,110,102,108,117,101,110, 99,101,  0, 42,115,117, 98,116, 97,114,
+103,101,116,  0,102, 97, 99,105,110,103, 97,120,105,115,  0,118,101,108,111, 99,105,116,121,  0, 97, 99, 99,101,108,101,114, 97,
+116,105,111,110,  0,116,117,114,110,115,112,101,101,100,  0,117,112,100, 97,116,101, 84,105,109,101,  0, 42,110, 97,118,109,101,
+115,104,  0,103,111,  0, 42,110,101,119,112, 97, 99,107,101,100,102,105,108,101,  0, 97,116,116,101,110,117, 97,116,105,111,110,
+  0,100,105,115,116, 97,110, 99,101,  0, 42, 99, 97, 99,104,101,  0, 42,119, 97,118,101,102,111,114,109,  0, 42,112,108, 97,121,
+ 98, 97, 99,107, 95,104, 97,110,100,108,101,  0, 42,108, 97,109,112,114,101,110,  0,103,111, 98,106,101, 99,116,  0,100,117,112,
+108,105, 95,111,102,115, 91, 51, 93,  0, 42,112,114,111,112,  0, 99,104,105,108,100, 98, 97,115,101,  0,114,111,108,108,  0,104,
+101, 97,100, 91, 51, 93,  0,116, 97,105,108, 91, 51, 93,  0, 98,111,110,101, 95,109, 97,116, 91, 51, 93, 91, 51, 93,  0, 97,114,
+109, 95,104,101, 97,100, 91, 51, 93,  0, 97,114,109, 95,116, 97,105,108, 91, 51, 93,  0, 97,114,109, 95,109, 97,116, 91, 52, 93,
+ 91, 52, 93,  0, 97,114,109, 95,114,111,108,108,  0,120,119,105,100,116,104,  0,122,119,105,100,116,104,  0,101, 97,115,101, 49,
+  0,101, 97,115,101, 50,  0,114, 97,100, 95,104,101, 97,100,  0,114, 97,100, 95,116, 97,105,108,  0,112, 97,100, 91, 49, 93,  0,
+ 98,111,110,101, 98, 97,115,101,  0, 99,104, 97,105,110, 98, 97,115,101,  0, 42,101,100, 98,111,  0, 42, 97, 99,116, 95, 98,111,
+110,101,  0, 42, 97, 99,116, 95,101,100, 98,111,110,101,  0, 42,115,107,101,116, 99,104,  0,103,101,118,101,114,116,100,101,102,
+111,114,109,101,114,  0,108, 97,121,101,114, 95,117,115,101,100,  0,108, 97,121,101,114, 95,112,114,111,116,101, 99,116,101,100,
+  0,103,104,111,115,116,101,112,  0,103,104,111,115,116,115,105,122,101,  0,103,104,111,115,116,116,121,112,101,  0,112, 97,116,
+104,115,105,122,101,  0,103,104,111,115,116,115,102,  0,103,104,111,115,116,101,102,  0,112, 97,116,104,115,102,  0,112, 97,116,
+104,101,102,  0,112, 97,116,104, 98, 99,  0,112, 97,116,104, 97, 99,  0, 42,112,111,105,110,116,115,  0,115,116, 97,114,116, 95,
+102,114, 97,109,101,  0,101,110,100, 95,102,114, 97,109,101,  0,103,104,111,115,116, 95,115,102,  0,103,104,111,115,116, 95,101,
+102,  0,103,104,111,115,116, 95, 98, 99,  0,103,104,111,115,116, 95, 97, 99,  0,103,104,111,115,116, 95,116,121,112,101,  0,103,
+104,111,115,116, 95,115,116,101,112,  0,103,104,111,115,116, 95,102,108, 97,103,  0,112, 97,116,104, 95,116,121,112,101,  0,112,
+ 97,116,104, 95,115,116,101,112,  0,112, 97,116,104, 95,118,105,101,119,102,108, 97,103,  0,112, 97,116,104, 95, 98, 97,107,101,
+102,108, 97,103,  0,112, 97,116,104, 95,115,102,  0,112, 97,116,104, 95,101,102,  0,112, 97,116,104, 95, 98, 99,  0,112, 97,116,
+104, 95, 97, 99,  0,105,107,102,108, 97,103,  0, 97,103,114,112, 95,105,110,100,101,120,  0, 99,111,110,115,116,102,108, 97,103,
+  0,115,101,108,101, 99,116,102,108, 97,103,  0,112, 97,100, 48, 91, 54, 93,  0, 42, 98,111,110,101,  0, 42, 99,104,105,108,100,
+  0,105,107,116,114,101,101,  0,115,105,107,116,114,101,101,  0, 42, 99,117,115,116,111,109,  0, 42, 99,117,115,116,111,109, 95,
+116,120,  0,101,117,108, 91, 51, 93,  0, 99,104, 97,110, 95,109, 97,116, 91, 52, 93, 91, 52, 93,  0,112,111,115,101, 95,109, 97,
+116, 91, 52, 93, 91, 52, 93,  0,112,111,115,101, 95,104,101, 97,100, 91, 51, 93,  0,112,111,115,101, 95,116, 97,105,108, 91, 51,
+ 93,  0,108,105,109,105,116,109,105,110, 91, 51, 93,  0,108,105,109,105,116,109, 97,120, 91, 51, 93,  0,115,116,105,102,102,110,
+101,115,115, 91, 51, 93,  0,105,107,115,116,114,101,116, 99,104,  0,105,107,114,111,116,119,101,105,103,104,116,  0,105,107,108,
+105,110,119,101,105,103,104,116,  0, 42,116,101,109,112,  0, 99,104, 97,110, 98, 97,115,101,  0, 42, 99,104, 97,110,104, 97,115,
+104,  0,112,114,111,120,121, 95,108, 97,121,101,114,  0,115,116,114,105,100,101, 95,111,102,102,115,101,116, 91, 51, 93,  0, 99,
+121, 99,108,105, 99, 95,111,102,102,115,101,116, 91, 51, 93,  0, 97,103,114,111,117,112,115,  0, 97, 99,116,105,118,101, 95,103,
+114,111,117,112,  0,105,107,115,111,108,118,101,114,  0, 42,105,107,100, 97,116, 97,  0, 42,105,107,112, 97,114, 97,109,  0,112,
+114,111,120,121, 95, 97, 99,116, 95, 98,111,110,101, 91, 54, 52, 93,  0,110,117,109,105,116,101,114,  0,110,117,109,115,116,101,
+112,  0,109,105,110,115,116,101,112,  0,109, 97,120,115,116,101,112,  0,115,111,108,118,101,114,  0,102,101,101,100, 98, 97, 99,
+107,  0,109, 97,120,118,101,108,  0,100, 97,109,112,109, 97,120,  0,100, 97,109,112,101,112,115,  0, 99,104, 97,110,110,101,108,
+115,  0, 99,117,115,116,111,109, 67,111,108,  0, 99,115,  0, 99,117,114,118,101,115,  0,103,114,111,117,112,115,  0, 97, 99,116,
+105,118,101, 95,109, 97,114,107,101,114,  0,105,100,114,111,111,116,  0, 42,115,111,117,114, 99,101,  0, 42,102,105,108,116,101,
+114, 95,103,114,112,  0,115,101, 97,114, 99,104,115,116,114, 91, 54, 52, 93,  0,102,105,108,116,101,114,102,108, 97,103,  0,114,
+101,110, 97,109,101, 73,110,100,101,120,  0, 97,100,115,  0,116,105,109,101,115,108,105,100,101,  0, 42,103,114,112,  0,110, 97,
+109,101, 91, 51, 48, 93,  0,111,119,110,115,112, 97, 99,101,  0,116, 97,114,115,112, 97, 99,101,  0,101,110,102,111,114, 99,101,
+  0,104,101, 97,100,116, 97,105,108,  0,108,105,110, 95,101,114,114,111,114,  0,114,111,116, 95,101,114,114,111,114,  0, 42,116,
+ 97,114,  0,109, 97,116,114,105,120, 91, 52, 93, 91, 52, 93,  0,115,112, 97, 99,101,  0,114,111,116, 79,114,100,101,114,  0,116,
+ 97,114,110,117,109,  0,116, 97,114,103,101,116,115,  0,105,116,101,114, 97,116,105,111,110,115,  0,114,111,111,116, 98,111,110,
+101,  0,109, 97,120, 95,114,111,111,116, 98,111,110,101,  0, 42,112,111,108,101,116, 97,114,  0,112,111,108,101,115,117, 98,116,
+ 97,114,103,101,116, 91, 54, 52, 93,  0,112,111,108,101, 97,110,103,108,101,  0,111,114,105,101,110,116,119,101,105,103,104,116,
+  0,103,114, 97, 98,116, 97,114,103,101,116, 91, 51, 93,  0,110,117,109,112,111,105,110,116,115,  0, 99,104, 97,105,110,108,101,
+110,  0,120,122, 83, 99, 97,108,101, 77,111,100,101,  0,114,101,115,101,114,118,101,100, 49,  0,114,101,115,101,114,118,101,100,
+ 50,  0,109,105,110,109, 97,120,102,108, 97,103,  0,115,116,117, 99,107,  0, 99, 97, 99,104,101, 91, 51, 93,  0,108,111, 99,107,
+102,108, 97,103,  0,102,111,108,108,111,119,102,108, 97,103,  0,118,111,108,109,111,100,101,  0,112,108, 97,110,101,  0,111,114,
+103,108,101,110,103,116,104,  0, 98,117,108,103,101,  0,112,105,118, 88,  0,112,105,118, 89,  0,112,105,118, 90,  0, 97,120, 88,
+  0, 97,120, 89,  0, 97,120, 90,  0,109,105,110, 76,105,109,105,116, 91, 54, 93,  0,109, 97,120, 76,105,109,105,116, 91, 54, 93,
+  0,101,120,116,114, 97, 70,122,  0,105,110,118,109, 97,116, 91, 52, 93, 91, 52, 93,  0,102,114,111,109,  0,116,111,  0,109, 97,
+112, 91, 51, 93,  0,101,120,112,111,  0,102,114,111,109, 95,109,105,110, 91, 51, 93,  0,102,114,111,109, 95,109, 97,120, 91, 51,
+ 93,  0,116,111, 95,109,105,110, 91, 51, 93,  0,116,111, 95,109, 97,120, 91, 51, 93,  0,114,111,116, 65,120,105,115,  0,122,109,
+105,110,  0,122,109, 97,120,  0,112, 97,100, 91, 57, 93,  0,116,114, 97, 99,107, 91, 54, 52, 93,  0,111, 98,106,101, 99,116, 91,
+ 54, 52, 93,  0, 42,100,101,112,116,104, 95,111, 98,  0, 99,104, 97,110,110,101,108, 91, 51, 50, 93,  0,110,111, 95,114,111,116,
  95, 97,120,105,115,  0,115,116,114,105,100,101, 95, 97,120,105,115,  0, 99,117,114,109,111,100,  0, 97, 99,116,115,116, 97,114,
-116,  0, 97, 99,116,101,110,100,  0, 97, 99,116,111,102,102,115,  0,115,116,114,105,100,101,108,101,110,  0,115, 99, 97,108,101,
-  0, 98,108,101,110,100,111,117,116,  0,115,116,114,105,100,101, 99,104, 97,110,110,101,108, 91, 51, 50, 93,  0,111,102,102,115,
- 95, 98,111,110,101, 91, 51, 50, 93,  0,104, 97,115,105,110,112,117,116,  0,104, 97,115,111,117,116,112,117,116,  0,100, 97,116,
- 97,116,121,112,101,  0,115,111, 99,107,101,116,116,121,112,101,  0, 42,110,101,119, 95,115,111, 99,107,  0,110,115,  0,108,105,
-109,105,116,  0,115,116, 97, 99,107, 95,116,121,112,101,  0, 42,115,116, 97, 99,107, 95,112,116,114,  0,115,116, 97, 99,107, 95,
-105,110,100,101,120,  0,108,111, 99,120,  0,108,111, 99,121,  0,111,119,110, 95,105,110,100,101,120,  0, 42,103,114,111,117,112,
-115,111, 99,107,  0,116,111, 95,105,110,100,101,120,  0, 42,108,105,110,107,  0, 42,114,101, 99,116,  0,120,115,105,122,101,  0,
-121,115,105,122,101,  0, 42,110,101,119, 95,110,111,100,101,  0,108, 97,115,116,121,  0,111,117,116,112,117,116,115,  0, 42,115,
-116,111,114, 97,103,101,  0,109,105,110,105,119,105,100,116,104,  0,108, 97, 98,101,108, 91, 51, 50, 93,  0, 99,117,115,116,111,
-109, 49,  0, 99,117,115,116,111,109, 50,  0, 99,117,115,116,111,109, 51,  0, 99,117,115,116,111,109, 52,  0,110,101,101,100, 95,
-101,120,101, 99,  0,101,120,101, 99,  0, 42,116,104,114,101, 97,100,100, 97,116, 97,  0,116,111,116,114,  0, 98,117,116,114,  0,
-112,114,118,114,  0, 42, 98,108,111, 99,107,  0, 42,116,121,112,101,105,110,102,111,  0, 42,102,114,111,109,110,111,100,101,  0,
- 42,116,111,110,111,100,101,  0, 42,102,114,111,109,115,111, 99,107,  0, 42,116,111,115,111, 99,107,  0,110,111,100,101,115,  0,
-108,105,110,107,115,  0, 42,115,116, 97, 99,107,  0, 42,116,104,114,101, 97,100,115,116, 97, 99,107,  0,105,110,105,116,  0,115,
-116, 97, 99,107,115,105,122,101,  0, 99,117,114, 95,105,110,100,101,120,  0, 97,108,108,116,121,112,101,115,  0, 40, 42,112,114,
-111,103,114,101,115,115, 41, 40, 41,  0, 40, 42,115,116, 97,116,115, 95,100,114, 97,119, 41, 40, 41,  0, 40, 42,116,101,115,116,
- 95, 98,114,101, 97,107, 41, 40, 41,  0, 42,116, 98,104,  0, 42,112,114,104,  0, 42,115,100,104,  0, 99,121, 99,108,105, 99,  0,
+116,  0, 97, 99,116,101,110,100,  0, 97, 99,116,111,102,102,115,  0,115,116,114,105,100,101,108,101,110,  0, 98,108,101,110,100,
+111,117,116,  0,115,116,114,105,100,101, 99,104, 97,110,110,101,108, 91, 51, 50, 93,  0,111,102,102,115, 95, 98,111,110,101, 91,
+ 51, 50, 93,  0,104, 97,115,105,110,112,117,116,  0,104, 97,115,111,117,116,112,117,116,  0,100, 97,116, 97,116,121,112,101,  0,
+115,111, 99,107,101,116,116,121,112,101,  0,105,115, 95, 99,111,112,121,  0,101,120,116,101,114,110, 97,108,  0, 42,110,101,119,
+ 95,115,111, 99,107,  0, 42,115,116,111,114, 97,103,101,  0,108,105,109,105,116,  0,115,116,114,117, 99,116, 95,116,121,112,101,
+  0,108,111, 99,120,  0,108,111, 99,121,  0, 42,100,101,102, 97,117,108,116, 95,118, 97,108,117,101,  0,115,116, 97, 99,107, 95,
+105,110,100,101,120,  0,115,116, 97, 99,107, 95,116,121,112,101,  0,111,119,110, 95,105,110,100,101,120,  0,116,111, 95,105,110,
+100,101,120,  0, 42,103,114,111,117,112,115,111, 99,107,  0, 42,108,105,110,107,  0,110,115,  0, 42,114,101, 99,116,  0,120,115,
+105,122,101,  0,121,115,105,122,101,  0, 42,110,101,119, 95,110,111,100,101,  0,108, 97,115,116,121,  0,111,117,116,112,117,116,
+115,  0,109,105,110,105,119,105,100,116,104,  0,117,112,100, 97,116,101,  0,108, 97, 98,101,108, 91, 54, 52, 93,  0, 99,117,115,
+116,111,109, 49,  0, 99,117,115,116,111,109, 50,  0, 99,117,115,116,111,109, 51,  0, 99,117,115,116,111,109, 52,  0,110,101,101,
+100, 95,101,120,101, 99,  0,101,120,101, 99,  0, 42,116,104,114,101, 97,100,100, 97,116, 97,  0,116,111,116,114,  0, 98,117,116,
+114,  0,112,114,118,114,  0, 42, 98,108,111, 99,107,  0, 42,116,121,112,101,105,110,102,111,  0, 42,102,114,111,109,110,111,100,
+101,  0, 42,116,111,110,111,100,101,  0, 42,102,114,111,109,115,111, 99,107,  0, 42,116,111,115,111, 99,107,  0,110,111,100,101,
+115,  0,108,105,110,107,115,  0,105,110,105,116,  0, 99,117,114, 95,105,110,100,101,120,  0,110,111,100,101,116,121,112,101,  0,
+ 42,101,120,101, 99,100, 97,116, 97,  0, 40, 42,112,114,111,103,114,101,115,115, 41, 40, 41,  0, 40, 42,115,116, 97,116,115, 95,
+100,114, 97,119, 41, 40, 41,  0, 40, 42,116,101,115,116, 95, 98,114,101, 97,107, 41, 40, 41,  0, 42,116, 98,104,  0, 42,112,114,
+104,  0, 42,115,100,104,  0,118, 97,108,117,101, 91, 51, 93,  0,118, 97,108,117,101, 91, 52, 93,  0, 99,121, 99,108,105, 99,  0,
 109,111,118,105,101,  0,115, 97,109,112,108,101,115,  0,109, 97,120,115,112,101,101,100,  0,109,105,110,115,112,101,101,100,  0,
  99,117,114,118,101,100,  0,112,101,114, 99,101,110,116,120,  0,112,101,114, 99,101,110,116,121,  0, 98,111,107,101,104,  0,103,
  97,109,109, 97,  0,105,109, 97,103,101, 95,105,110, 95,119,105,100,116,104,  0,105,109, 97,103,101, 95,105,110, 95,104,101,105,
 103,104,116,  0, 99,101,110,116,101,114, 95,120,  0, 99,101,110,116,101,114, 95,121,  0,115,112,105,110,  0,119,114, 97,112,  0,
-115,105,103,109, 97, 95, 99,111,108,111,114,  0,115,105,103,109, 97, 95,115,112, 97, 99,101,  0,104,117,101,  0,116, 49,  0,116,
- 50,  0,116, 51,  0,102,115,116,114,101,110,103,116,104,  0,102, 97,108,112,104, 97,  0,107,101,121, 91, 52, 93,  0, 97,108,103,
-111,114,105,116,104,109,  0, 99,104, 97,110,110,101,108,  0,120, 49,  0,120, 50,  0,121, 49,  0,121, 50,  0,102, 97, 99, 95,120,
- 49,  0,102, 97, 99, 95,120, 50,  0,102, 97, 99, 95,121, 49,  0,102, 97, 99, 95,121, 50,  0, 99,111,108,110, 97,109,101, 91, 51,
- 50, 93,  0, 98,107,116,121,112,101,  0,114,111,116, 97,116,105,111,110,  0,103, 97,109, 99,111,  0,110,111, 95,122, 98,117,102,
-  0,102,115,116,111,112,  0,109, 97,120, 98,108,117,114,  0, 98,116,104,114,101,115,104,  0, 42,100,105, 99,116,  0, 42,110,111,
-100,101,  0, 97,110,103,108,101, 95,111,102,115,  0, 99,111,108,109,111,100,  0,109,105,120,  0,116,104,114,101,115,104,111,108,
-100,  0,102, 97,100,101,  0,109,  0, 99,  0,106,105,116,  0,112,114,111,106,  0,102,105,116,  0,115,108,111,112,101, 91, 51, 93,
-  0,112,111,119,101,114, 91, 51, 93,  0,108,105,102,116, 95,108,103,103, 91, 51, 93,  0,103, 97,109,109, 97, 95,105,110,118, 91,
- 51, 93,  0,108,105,109, 99,104, 97,110,  0,117,110,115,112,105,108,108,  0,108,105,109,115, 99, 97,108,101,  0,117,115,112,105,
-108,108,114,  0,117,115,112,105,108,108,103,  0,117,115,112,105,108,108, 98,  0,115,104,111,114,116,121,  0,109,105,110,116, 97,
- 98,108,101,  0,109, 97,120,116, 97, 98,108,101,  0,101,120,116, 95,105,110, 91, 50, 93,  0,101,120,116, 95,111,117,116, 91, 50,
- 93,  0, 42, 99,117,114,118,101,  0, 42,116, 97, 98,108,101,  0, 42,112,114,101,109,117,108,116, 97, 98,108,101,  0,112,114,101,
-115,101,116,  0, 99,104, 97,110,103,101,100, 95,116,105,109,101,115,116, 97,109,112,  0, 99,117,114,114,  0, 99,108,105,112,114,
-  0, 99,109, 91, 52, 93,  0, 98,108, 97, 99,107, 91, 51, 93,  0,119,104,105,116,101, 91, 51, 93,  0, 98,119,109,117,108, 91, 51,
- 93,  0,115, 97,109,112,108,101, 91, 51, 93,  0,120, 95,114,101,115,111,108,117,116,105,111,110,  0,100, 97,116, 97, 95,114, 91,
- 50, 53, 54, 93,  0,100, 97,116, 97, 95,103, 91, 50, 53, 54, 93,  0,100, 97,116, 97, 95, 98, 91, 50, 53, 54, 93,  0,100, 97,116,
- 97, 95,108,117,109, 97, 91, 50, 53, 54, 93,  0,115, 97,109,112,108,101, 95,102,117,108,108,  0,115, 97,109,112,108,101, 95,108,
-105,110,101,115,  0, 97, 99, 99,117,114, 97, 99,121,  0,119, 97,118,101,102,114,109, 95,109,111,100,101,  0,119, 97,118,101,102,
-114,109, 95, 97,108,112,104, 97,  0,119, 97,118,101,102,114,109, 95,121,102, 97, 99,  0,119, 97,118,101,102,114,109, 95,104,101,
-105,103,104,116,  0,118,101, 99,115, 99,111,112,101, 95, 97,108,112,104, 97,  0,118,101, 99,115, 99,111,112,101, 95,104,101,105,
-103,104,116,  0,109,105,110,109, 97,120, 91, 51, 93, 91, 50, 93,  0,104,105,115,116,  0, 42,119, 97,118,101,102,111,114,109, 95,
- 49,  0, 42,119, 97,118,101,102,111,114,109, 95, 50,  0, 42,119, 97,118,101,102,111,114,109, 95, 51,  0, 42,118,101, 99,115, 99,
-111,112,101,  0,119, 97,118,101,102,111,114,109, 95,116,111,116,  0,111,102,102,115,101,116, 91, 50, 93,  0, 99,108,111,110,101,
-  0,109,116,101,120,  0, 42,105, 99,111,110, 95,105,109, 98,117,102,  0,105, 99,111,110, 95,102,105,108,101,112, 97,116,104, 91,
- 50, 52, 48, 93,  0,110,111,114,109, 97,108, 95,119,101,105,103,104,116,  0,111, 98, 95,109,111,100,101,  0,106,105,116,116,101,
-114,  0,115,109,111,111,116,104, 95,115,116,114,111,107,101, 95,114, 97,100,105,117,115,  0,115,109,111,111,116,104, 95,115,116,
-114,111,107,101, 95,102, 97, 99,116,111,114,  0,114, 97,116,101,  0,114,103, 98, 91, 51, 93,  0,115, 99,117,108,112,116, 95,112,
-108, 97,110,101,  0,112,108, 97,110,101, 95,111,102,102,115,101,116,  0,115, 99,117,108,112,116, 95,116,111,111,108,  0,118,101,
-114,116,101,120,112, 97,105,110,116, 95,116,111,111,108,  0,105,109, 97,103,101,112, 97,105,110,116, 95,116,111,111,108,  0,112,
- 97,100, 51, 91, 53, 93,  0, 97,117,116,111,115,109,111,111,116,104, 95,102, 97, 99,116,111,114,  0, 99,114,101, 97,115,101, 95,
-112,105,110, 99,104, 95,102, 97, 99,116,111,114,  0,112,108, 97,110,101, 95,116,114,105,109,  0,116,101,120,116,117,114,101, 95,
-115, 97,109,112,108,101, 95, 98,105, 97,115,  0,116,101,120,116,117,114,101, 95,111,118,101,114,108, 97,121, 95, 97,108,112,104,
- 97,  0,117,110,112,114,111,106,101, 99,116,101,100, 95,114, 97,100,105,117,115,  0, 97,100,100, 95, 99,111,108, 91, 51, 93,  0,
-115,117, 98, 95, 99,111,108, 91, 51, 93,  0, 97, 99,116,105,118,101, 95,114,110,100,  0, 97, 99,116,105,118,101, 95, 99,108,111,
-110,101,  0, 97, 99,116,105,118,101, 95,109, 97,115,107,  0, 42,108, 97,121,101,114,115,  0,116,111,116,108, 97,121,101,114,  0,
-109, 97,120,108, 97,121,101,114,  0,116,111,116,115,105,122,101,  0, 42,112,111,111,108,  0, 42,101,120,116,101,114,110, 97,108,
-  0,114,111,116, 91, 52, 93,  0, 97,118,101, 91, 51, 93,  0, 42,103,114,111,117,110,100,  0,119, 97,110,100,101,114, 91, 51, 93,
-  0,114,101,115,116, 95,108,101,110,103,116,104,  0,112, 97,114,116,105, 99,108,101, 95,105,110,100,101,120, 91, 50, 93,  0,100,
-101,108,101,116,101, 95,102,108, 97,103,  0,110,117,109,  0,112, 97,114,101,110,116,  0,112, 97, 91, 52, 93,  0,119, 91, 52, 93,
-  0,102,117,118, 91, 52, 93,  0,102,111,102,102,115,101,116,  0,114,116, 91, 50, 93,  0,112,114,101,118, 95,115,116, 97,116,101,
-  0, 42,104, 97,105,114,  0, 42, 98,111,105,100,  0,100,105,101,116,105,109,101,  0,110,117,109, 95,100,109, 99, 97, 99,104,101,
-  0,104, 97,105,114, 95,105,110,100,101,120,  0, 97,108,105,118,101,  0,115,112,114,105,110,103, 95,107,  0,112,108, 97,115,116,
-105, 99,105,116,121, 95, 99,111,110,115,116, 97,110,116,  0,121,105,101,108,100, 95,114, 97,116,105,111,  0,112,108, 97,115,116,
-105, 99,105,116,121, 95, 98, 97,108, 97,110, 99,101,  0,121,105,101,108,100, 95, 98, 97,108, 97,110, 99,101,  0,118,105,115, 99,
-111,115,105,116,121, 95,111,109,101,103, 97,  0,118,105,115, 99,111,115,105,116,121, 95, 98,101,116, 97,  0,115,116,105,102,102,
-110,101,115,115, 95,107,  0,115,116,105,102,102,110,101,115,115, 95,107,110,101, 97,114,  0,114,101,115,116, 95,100,101,110,115,
-105,116,121,  0, 98,117,111,121, 97,110, 99,121,  0,115,112,114,105,110,103, 95,102,114, 97,109,101,115,  0, 42, 98,111,105,100,
-115,  0, 42,102,108,117,105,100,  0,100,105,115,116,114,  0,112,104,121,115,116,121,112,101,  0, 97,118,101,109,111,100,101,  0,
-114,101, 97, 99,116,101,118,101,110,116,  0,100,114, 97,119,  0,100,114, 97,119, 95, 97,115,  0,100,114, 97,119, 95,115,105,122,
-101,  0, 99,104,105,108,100,116,121,112,101,  0,114,101,110, 95, 97,115,  0,115,117, 98,102,114, 97,109,101,115,  0,100,114, 97,
-119, 95, 99,111,108,  0,114,101,110, 95,115,116,101,112,  0,104, 97,105,114, 95,115,116,101,112,  0,107,101,121,115, 95,115,116,
-101,112,  0, 97,100, 97,112,116, 95, 97,110,103,108,101,  0, 97,100, 97,112,116, 95,112,105,120,  0,114,111,116,102,114,111,109,
-  0,105,110,116,101,103,114, 97,116,111,114,  0, 98, 98, 95, 97,108,105,103,110,  0, 98, 98, 95,117,118, 95,115,112,108,105,116,
-  0, 98, 98, 95, 97,110,105,109,  0, 98, 98, 95,115,112,108,105,116, 95,111,102,102,115,101,116,  0, 98, 98, 95,116,105,108,116,
-  0, 98, 98, 95,114, 97,110,100, 95,116,105,108,116,  0, 98, 98, 95,111,102,102,115,101,116, 91, 50, 93,  0, 98, 98, 95,115,105,
-122,101, 91, 50, 93,  0, 98, 98, 95,118,101,108, 95,104,101, 97,100,  0, 98, 98, 95,118,101,108, 95,116, 97,105,108,  0, 99,111,
-108,111,114, 95,118,101, 99, 95,109, 97,120,  0,115,105,109,112,108,105,102,121, 95,114,101,102,115,105,122,101,  0,115,105,109,
-112,108,105,102,121, 95,114, 97,116,101,  0,115,105,109,112,108,105,102,121, 95,116,114, 97,110,115,105,116,105,111,110,  0,115,
-105,109,112,108,105,102,121, 95,118,105,101,119,112,111,114,116,  0,116,105,109,101,116,119,101, 97,107,  0,106,105,116,102, 97,
- 99,  0,101,102,102, 95,104, 97,105,114,  0,103,114,105,100, 95,114, 97,110,100,  0,103,114,105,100, 95,114,101,115,  0,101,102,
-102,101, 99,116,111,114, 95, 97,109,111,117,110,116,  0,112, 97,114,116,102, 97, 99,  0,116, 97,110,102, 97, 99,  0,116, 97,110,
-112,104, 97,115,101,  0,114,101, 97, 99,116,102, 97, 99,  0,111, 98, 95,118,101,108, 91, 51, 93,  0, 97,118,101,102, 97, 99,  0,
-112,104, 97,115,101,102, 97, 99,  0,114, 97,110,100,114,111,116,102, 97, 99,  0,114, 97,110,100,112,104, 97,115,101,102, 97, 99,
-  0,114, 97,110,100,115,105,122,101,  0, 97, 99, 99, 91, 51, 93,  0,100,114, 97,103,102, 97, 99,  0, 98,114,111,119,110,102, 97,
- 99,  0,114, 97,110,100,108,101,110,103,116,104,  0, 99,104,105,108,100, 95,110, 98,114,  0,114,101,110, 95, 99,104,105,108,100,
- 95,110, 98,114,  0,112, 97,114,101,110,116,115,  0, 99,104,105,108,100,115,105,122,101,  0, 99,104,105,108,100,114, 97,110,100,
-115,105,122,101,  0, 99,104,105,108,100,114, 97,100,  0, 99,104,105,108,100,102,108, 97,116,  0, 99,108,117,109,112,112,111,119,
-  0,107,105,110,107, 95,102,108, 97,116,  0,107,105,110,107, 95, 97,109,112, 95, 99,108,117,109,112,  0,114,111,117,103,104, 49,
-  0,114,111,117,103,104, 49, 95,115,105,122,101,  0,114,111,117,103,104, 50,  0,114,111,117,103,104, 50, 95,115,105,122,101,  0,
-114,111,117,103,104, 50, 95,116,104,114,101,115,  0,114,111,117,103,104, 95,101,110,100,  0,114,111,117,103,104, 95,101,110,100,
- 95,115,104, 97,112,101,  0, 99,108,101,110,103,116,104,  0, 99,108,101,110,103,116,104, 95,116,104,114,101,115,  0,112, 97,114,
-116,105,110,103, 95,102, 97, 99,  0,112, 97,114,116,105,110,103, 95,109,105,110,  0,112, 97,114,116,105,110,103, 95,109, 97,120,
-  0, 98,114, 97,110, 99,104, 95,116,104,114,101,115,  0,100,114, 97,119, 95,108,105,110,101, 91, 50, 93,  0,112, 97,116,104, 95,
-115,116, 97,114,116,  0,112, 97,116,104, 95,101,110,100,  0,116,114, 97,105,108, 95, 99,111,117,110,116,  0,107,101,121,101,100,
- 95,108,111,111,112,115,  0,100,117,112,108,105,119,101,105,103,104,116,115,  0, 42,101,102,102, 95,103,114,111,117,112,  0, 42,
-100,117,112, 95,111, 98,  0, 42, 98, 98, 95,111, 98,  0, 42,112,100, 50,  0, 42,112, 97,114,116,  0, 42,112, 97,114,116,105, 99,
-108,101,115,  0, 42, 42,112, 97,116,104, 99, 97, 99,104,101,  0, 42, 42, 99,104,105,108,100, 99, 97, 99,104,101,  0,112, 97,116,
-104, 99, 97, 99,104,101, 98,117,102,115,  0, 99,104,105,108,100, 99, 97, 99,104,101, 98,117,102,115,  0, 42, 99,108,109,100,  0,
- 42,104, 97,105,114, 95,105,110, 95,100,109,  0, 42,104, 97,105,114, 95,111,117,116, 95,100,109,  0, 42,116, 97,114,103,101,116,
- 95,111, 98,  0, 42,108, 97,116,116,105, 99,101,  0,116,114,101,101, 95,102,114, 97,109,101,  0, 98,118,104,116,114,101,101, 95,
-102,114, 97,109,101,  0, 99,104,105,108,100, 95,115,101,101,100,  0,116,111,116,117,110,101,120,105,115,116,  0,116,111,116, 99,
-104,105,108,100,  0,116,111,116, 99, 97, 99,104,101,100,  0,116,111,116, 99,104,105,108,100, 99, 97, 99,104,101,  0,116, 97,114,
-103,101,116, 95,112,115,121,115,  0,116,111,116,107,101,121,101,100,  0, 98, 97,107,101,115,112, 97, 99,101,  0, 98, 98, 95,117,
-118,110, 97,109,101, 91, 51, 93, 91, 51, 50, 93,  0,118,103,114,111,117,112, 91, 49, 50, 93,  0,118,103, 95,110,101,103,  0,114,
-116, 51,  0, 42,114,101,110,100,101,114,100, 97,116, 97,  0, 42,101,102,102,101, 99,116,111,114,115,  0, 42,102,108,117,105,100,
- 95,115,112,114,105,110,103,115,  0,116,111,116, 95,102,108,117,105,100,115,112,114,105,110,103,115,  0, 97,108,108,111, 99, 95,
-102,108,117,105,100,115,112,114,105,110,103,115,  0, 42,116,114,101,101,  0, 42,112,100,100,  0, 42,102,114, 97,110,100,  0, 67,
-100,105,115,  0, 67,118,105,  0,115,116,114,117, 99,116,117,114, 97,108,  0, 98,101,110,100,105,110,103,  0,109, 97,120, 95, 98,
-101,110,100,  0,109, 97,120, 95,115,116,114,117, 99,116,  0,109, 97,120, 95,115,104,101, 97,114,  0, 97,118,103, 95,115,112,114,
-105,110,103, 95,108,101,110,  0,116,105,109,101,115, 99, 97,108,101,  0,101,102,102, 95,102,111,114, 99,101, 95,115, 99, 97,108,
-101,  0,101,102,102, 95,119,105,110,100, 95,115, 99, 97,108,101,  0,115,105,109, 95,116,105,109,101, 95,111,108,100,  0,118,101,
-108,111, 99,105,116,121, 95,115,109,111,111,116,104,  0, 99,111,108,108,105,100,101,114, 95,102,114,105, 99,116,105,111,110,  0,
-115,116,101,112,115, 80,101,114, 70,114, 97,109,101,  0,112,114,101,114,111,108,108,  0,109, 97,120,115,112,114,105,110,103,108,
-101,110,  0,115,111,108,118,101,114, 95,116,121,112,101,  0,118,103,114,111,117,112, 95, 98,101,110,100,  0,118,103,114,111,117,
-112, 95,109, 97,115,115,  0,118,103,114,111,117,112, 95,115,116,114,117, 99,116,  0,115,104, 97,112,101,107,101,121, 95,114,101,
-115,116,  0,112,114,101,115,101,116,115,  0,114,101,115,101,116,  0, 42, 99,111,108,108,105,115,105,111,110, 95,108,105,115,116,
-  0,101,112,115,105,108,111,110,  0,115,101,108,102, 95,102,114,105, 99,116,105,111,110,  0,115,101,108,102,101,112,115,105,108,
-111,110,  0,114,101,112,101,108, 95,102,111,114, 99,101,  0,100,105,115,116, 97,110, 99,101, 95,114,101,112,101,108,  0,115,101,
-108,102, 95,108,111,111,112, 95, 99,111,117,110,116,  0,108,111,111,112, 95, 99,111,117,110,116,  0,112,114,101,115,115,117,114,
-101,  0,116,104,105, 99,107,110,101,115,115,  0,115,116,114,111,107,101,115,  0,102,114, 97,109,101,110,117,109,  0, 42, 97, 99,
-116,102,114, 97,109,101,  0,103,115,116,101,112,  0,105,110,102,111, 91, 49, 50, 56, 93,  0,115, 98,117,102,102,101,114, 95,115,
-105,122,101,  0,115, 98,117,102,102,101,114, 95,115,102,108, 97,103,  0, 42,115, 98,117,102,102,101,114,  0,108,105,115,116,  0,
-112,114,105,110,116,108,101,118,101,108,  0,115,116,111,114,101,108,101,118,101,108,  0, 42,114,101,112,111,114,116,116,105,109,
-101,114,  0, 42,119,105,110,100,114, 97,119, 97, 98,108,101,  0, 42,119,105,110, 97, 99,116,105,118,101,  0,119,105,110,100,111,
-119,115,  0,105,110,105,116,105, 97,108,105,122,101,100,  0,102,105,108,101, 95,115, 97,118,101,100,  0,111,112, 95,117,110,100,
-111, 95,100,101,112,116,104,  0,111,112,101,114, 97,116,111,114,115,  0,113,117,101,117,101,  0,114,101,112,111,114,116,115,  0,
-106,111, 98,115,  0,112, 97,105,110,116, 99,117,114,115,111,114,115,  0,100,114, 97,103,115,  0,107,101,121, 99,111,110,102,105,
-103,115,  0, 42,100,101,102, 97,117,108,116, 99,111,110,102,  0,116,105,109,101,114,115,  0, 42, 97,117,116,111,115, 97,118,101,
-116,105,109,101,114,  0, 42,103,104,111,115,116,119,105,110,  0,103,114, 97, 98, 99,117,114,115,111,114,  0, 42,115, 99,114,101,
-101,110,  0, 42,110,101,119,115, 99,114,101,101,110,  0,115, 99,114,101,101,110,110, 97,109,101, 91, 51, 50, 93,  0,112,111,115,
-120,  0,112,111,115,121,  0,119,105,110,100,111,119,115,116, 97,116,101,  0,109,111,110,105,116,111,114,  0,108, 97,115,116, 99,
-117,114,115,111,114,  0,109,111,100, 97,108, 99,117,114,115,111,114,  0, 97,100,100,109,111,117,115,101,109,111,118,101,  0, 42,
-101,118,101,110,116,115,116, 97,116,101,  0, 42, 99,117,114,115,119,105,110,  0, 42,116,119,101, 97,107,  0,100,114, 97,119,109,
-101,116,104,111,100,  0,100,114, 97,119,102, 97,105,108,  0, 42,100,114, 97,119,100, 97,116, 97,  0,109,111,100, 97,108,104, 97,
-110,100,108,101,114,115,  0,115,117, 98,119,105,110,100,111,119,115,  0,103,101,115,116,117,114,101,  0,105,100,110, 97,109,101,
- 91, 54, 52, 93,  0,112,114,111,112,118, 97,108,117,101,  0,115,104,105,102,116,  0, 99,116,114,108,  0, 97,108,116,  0,111,115,
-107,101,121,  0,107,101,121,109,111,100,105,102,105,101,114,  0,109, 97,112,116,121,112,101,  0, 42,112,116,114,  0,105,116,101,
-109,115,  0,115,112, 97, 99,101,105,100,  0,114,101,103,105,111,110,105,100,  0,107,109,105, 95,105,100,  0, 40, 42,112,111,108,
-108, 41, 40, 41,  0, 42,109,111,100, 97,108, 95,105,116,101,109,115,  0, 98, 97,115,101,110, 97,109,101, 91, 54, 52, 93,  0, 97,
- 99,116,107,101,121,109, 97,112,  0, 42, 99,117,115,116,111,109,100, 97,116, 97,  0, 42,112,121, 95,105,110,115,116, 97,110, 99,
-101,  0, 42,114,101,112,111,114,116,115,  0,109, 97, 99,114,111,  0, 42,111,112,109,  0, 42,101,100, 97,116, 97,  0,105,110,102,
-108,117,101,110, 99,101,  0, 42, 99,111,101,102,102,105, 99,105,101,110,116,115,  0, 97,114,114, 97,121,115,105,122,101,  0,112,
-111,108,121, 95,111,114,100,101,114,  0, 97,109,112,108,105,116,117,100,101,  0,112,104, 97,115,101, 95,109,117,108,116,105,112,
-108,105,101,114,  0,112,104, 97,115,101, 95,111,102,102,115,101,116,  0,118, 97,108,117,101, 95,111,102,102,115,101,116,  0,109,
-105,100,118, 97,108,  0, 98,101,102,111,114,101, 95,109,111,100,101,  0, 97,102,116,101,114, 95,109,111,100,101,  0, 98,101,102,
-111,114,101, 95, 99,121, 99,108,101,115,  0, 97,102,116,101,114, 95, 99,121, 99,108,101,115,  0,114,101, 99,116,  0,112,104, 97,
-115,101,  0,109,111,100,105,102,105, 99, 97,116,105,111,110,  0,115,116,101,112, 95,115,105,122,101,  0, 42,114,110, 97, 95,112,
- 97,116,104,  0,112, 99,104, 97,110, 95,110, 97,109,101, 91, 51, 50, 93,  0,116,114, 97,110,115, 67,104, 97,110,  0,105,100,116,
-121,112,101,  0,116, 97,114,103,101,116,115, 91, 56, 93,  0,110,117,109, 95,116, 97,114,103,101,116,115,  0,118, 97,114,105, 97,
- 98,108,101,115,  0,101,120,112,114,101,115,115,105,111,110, 91, 50, 53, 54, 93,  0, 42,101,120,112,114, 95, 99,111,109,112,  0,
-118,101, 99, 91, 50, 93,  0, 42,102,112,116,  0, 97,114,114, 97,121, 95,105,110,100,101,120,  0, 99,111,108,111,114, 95,109,111,
-100,101,  0, 99,111,108,111,114, 91, 51, 93,  0,102,114,111,109, 91, 49, 50, 56, 93,  0,116,111, 91, 49, 50, 56, 93,  0,109, 97,
-112,112,105,110,103,115,  0,115,116,114,105,112,115,  0, 42,114,101,109, 97,112,  0,102, 99,117,114,118,101,115,  0,115,116,114,
-105,112, 95,116,105,109,101,  0, 98,108,101,110,100,109,111,100,101,  0,101,120,116,101,110,100,109,111,100,101,  0,103,114,111,
-117,112, 91, 54, 52, 93,  0,103,114,111,117,112,109,111,100,101,  0,107,101,121,105,110,103,102,108, 97,103,  0,112, 97,116,104,
-115,  0,116,121,112,101,105,110,102,111, 91, 54, 52, 93,  0, 97, 99,116,105,118,101, 95,112, 97,116,104,  0, 42,116,109,112, 97,
- 99,116,  0,110,108, 97, 95,116,114, 97, 99,107,115,  0, 42, 97, 99,116,115,116,114,105,112,  0,100,114,105,118,101,114,115,  0,
-111,118,101,114,114,105,100,101,115,  0, 97, 99,116, 95, 98,108,101,110,100,109,111,100,101,  0, 97, 99,116, 95,101,120,116,101,
-110,100,109,111,100,101,  0, 97, 99,116, 95,105,110,102,108,117,101,110, 99,101,  0,114,117,108,101,  0,111,112,116,105,111,110,
-115,  0,102,101, 97,114, 95,102, 97, 99,116,111,114,  0,115,105,103,110, 97,108, 95,105,100,  0,108,111,111,107, 95, 97,104,101,
- 97,100,  0,111,108,111, 99, 91, 51, 93,  0,113,117,101,117,101, 95,115,105,122,101,  0,119, 97,110,100,101,114,  0,102,108,101,
-101, 95,100,105,115,116, 97,110, 99,101,  0,104,101, 97,108,116,104,  0,115,116, 97,116,101, 95,105,100,  0,114,117,108,101,115,
-  0, 99,111,110,100,105,116,105,111,110,115,  0, 97, 99,116,105,111,110,115,  0,114,117,108,101,115,101,116, 95,116,121,112,101,
-  0,114,117,108,101, 95,102,117,122,122,105,110,101,115,115,  0,108, 97,115,116, 95,115,116, 97,116,101, 95,105,100,  0,108, 97,
-110,100,105,110,103, 95,115,109,111,111,116,104,110,101,115,115,  0, 98, 97,110,107,105,110,103,  0, 97,103,103,114,101,115,115,
-105,111,110,  0, 97,105,114, 95,109,105,110, 95,115,112,101,101,100,  0, 97,105,114, 95,109, 97,120, 95,115,112,101,101,100,  0,
- 97,105,114, 95,109, 97,120, 95, 97, 99, 99,  0, 97,105,114, 95,109, 97,120, 95, 97,118,101,  0, 97,105,114, 95,112,101,114,115,
-111,110, 97,108, 95,115,112, 97, 99,101,  0,108, 97,110,100, 95,106,117,109,112, 95,115,112,101,101,100,  0,108, 97,110,100, 95,
-109, 97,120, 95,115,112,101,101,100,  0,108, 97,110,100, 95,109, 97,120, 95, 97, 99, 99,  0,108, 97,110,100, 95,109, 97,120, 95,
- 97,118,101,  0,108, 97,110,100, 95,112,101,114,115,111,110, 97,108, 95,115,112, 97, 99,101,  0,108, 97,110,100, 95,115,116,105,
- 99,107, 95,102,111,114, 99,101,  0,115,116, 97,116,101,115,  0, 42,115,109,100,  0, 42,102,108,117,105,100, 95,103,114,111,117,
-112,  0, 42, 99,111,108,108, 95,103,114,111,117,112,  0, 42,119,116,  0, 42,116,101,120, 95,119,116,  0, 42,116,101,120, 95,115,
-104, 97,100,111,119,  0, 42,115,104, 97,100,111,119,  0,112, 48, 91, 51, 93,  0,112, 49, 91, 51, 93,  0,100,120,  0,111,109,101,
-103, 97,  0,116,101,109,112, 65,109, 98,  0, 98,101,116, 97,  0,114,101,115, 91, 51, 93,  0, 97,109,112,108,105,102,121,  0,109,
- 97,120,114,101,115,  0,118,105,101,119,115,101,116,116,105,110,103,115,  0,110,111,105,115,101,  0,100,105,115,115, 95,112,101,
-114, 99,101,110,116,  0,100,105,115,115, 95,115,112,101,101,100,  0,114,101,115, 95,119,116, 91, 51, 93,  0,100,120, 95,119,116,
-  0,118, 51,100,110,117,109,  0, 99, 97, 99,104,101, 95, 99,111,109,112,  0, 99, 97, 99,104,101, 95,104,105,103,104, 95, 99,111,
-109,112,  0, 42,112,111,105,110,116, 95, 99, 97, 99,104,101, 91, 50, 93,  0,112,116, 99, 97, 99,104,101,115, 91, 50, 93,  0, 98,
-111,114,100,101,114, 95, 99,111,108,108,105,115,105,111,110,115,  0,116,105,109,101, 95,115, 99, 97,108,101,  0,118,111,114,116,
-105, 99,105,116,121,  0,118,101,108,111, 99,105,116,121, 91, 50, 93,  0,118,101,108, 95,109,117,108,116,105,  0,118,103,114,112,
- 95,104,101, 97,116, 95,115, 99, 97,108,101, 91, 50, 93,  0,118,103,114,111,117,112, 95,102,108,111,119,  0,118,103,114,111,117,
-112, 95,100,101,110,115,105,116,121,  0,118,103,114,111,117,112, 95,104,101, 97,116,  0, 42,112,111,105,110,116,115, 95,111,108,
-100,  0, 42,118,101,108,  0,109, 97,116, 95,111,108,100, 91, 52, 93, 91, 52, 93,  0,  0,  0,  0, 84, 89, 80, 69,205,  1,  0,  0,
- 99,104, 97,114,  0,117, 99,104, 97,114,  0,115,104,111,114,116,  0,117,115,104,111,114,116,  0,105,110,116,  0,108,111,110,103,
-  0,117,108,111,110,103,  0,102,108,111, 97,116,  0,100,111,117, 98,108,101,  0,118,111,105,100,  0, 76,105,110,107,  0, 76,105,
-110,107, 68, 97,116, 97,  0, 76,105,115,116, 66, 97,115,101,  0,118,101, 99, 50,115,  0,118,101, 99, 50,102,  0,114, 99,116,105,
-  0,114, 99,116,102,  0, 73, 68, 80,114,111,112,101,114,116,121, 68, 97,116, 97,  0, 73, 68, 80,114,111,112,101,114,116,121,  0,
- 73, 68,  0, 76,105, 98,114, 97,114,121,  0, 70,105,108,101, 68, 97,116, 97,  0, 80,114,101,118,105,101,119, 73,109, 97,103,101,
-  0, 73,112,111, 68,114,105,118,101,114,  0, 79, 98,106,101, 99,116,  0, 73,112,111, 67,117,114,118,101,  0, 66, 80,111,105,110,
-116,  0, 66,101,122, 84,114,105,112,108,101,  0, 73,112,111,  0, 75,101,121, 66,108,111, 99,107,  0, 75,101,121,  0, 65,110,105,
-109, 68, 97,116, 97,  0, 84,101,120,116, 76,105,110,101,  0, 84,101,120,116, 77, 97,114,107,101,114,  0, 84,101,120,116,  0, 80,
- 97, 99,107,101,100, 70,105,108,101,  0, 67, 97,109,101,114, 97,  0, 73,109, 97,103,101, 85,115,101,114,  0, 83, 99,101,110,101,
-  0, 73,109, 97,103,101,  0, 71, 80, 85, 84,101,120,116,117,114,101,  0, 97,110,105,109,  0, 82,101,110,100,101,114, 82,101,115,
-117,108,116,  0, 77, 84,101,120,  0, 84,101,120,  0, 80,108,117,103,105,110, 84,101,120,  0, 67, 66, 68, 97,116, 97,  0, 67,111,
-108,111,114, 66, 97,110,100,  0, 69,110,118, 77, 97,112,  0, 73,109, 66,117,102,  0, 80,111,105,110,116, 68,101,110,115,105,116,
-121,  0, 67,117,114,118,101, 77, 97,112,112,105,110,103,  0, 86,111,120,101,108, 68, 97,116, 97,  0, 98, 78,111,100,101, 84,114,
-101,101,  0, 84,101,120, 77, 97,112,112,105,110,103,  0, 76, 97,109,112,  0, 86,111,108,117,109,101, 83,101,116,116,105,110,103,
-115,  0, 77, 97,116,101,114,105, 97,108,  0, 71,114,111,117,112,  0, 86, 70,111,110,116,  0, 86, 70,111,110,116, 68, 97,116, 97,
-  0, 77,101,116, 97, 69,108,101,109,  0, 66,111,117,110,100, 66,111,120,  0, 77,101,116, 97, 66, 97,108,108,  0, 78,117,114, 98,
-  0, 67,104, 97,114, 73,110,102,111,  0, 84,101,120,116, 66,111,120,  0, 69,100,105,116, 78,117,114, 98,  0, 71, 72, 97,115,104,
-  0, 67,117,114,118,101,  0, 80, 97,116,104,  0, 83,101,108, 66,111,120,  0, 69,100,105,116, 70,111,110,116,  0, 77,101,115,104,
-  0, 77, 70, 97, 99,101,  0, 77, 84, 70, 97, 99,101,  0, 84, 70, 97, 99,101,  0, 77, 86,101,114,116,  0, 77, 69,100,103,101,  0,
- 77, 68,101,102,111,114,109, 86,101,114,116,  0, 77, 67,111,108,  0, 77, 83,116,105, 99,107,121,  0, 77, 83,101,108,101, 99,116,
-  0, 69,100,105,116, 77,101,115,104,  0, 67,117,115,116,111,109, 68, 97,116, 97,  0, 77,117,108,116,105,114,101,115,  0, 80, 97,
-114,116,105, 97,108, 86,105,115,105, 98,105,108,105,116,121,  0, 77, 68,101,102,111,114,109, 87,101,105,103,104,116,  0, 77, 84,
-101,120, 80,111,108,121,  0, 77, 76,111,111,112, 85, 86,  0, 77, 76,111,111,112, 67,111,108,  0, 77, 70,108,111, 97,116, 80,114,
-111,112,101,114,116,121,  0, 77, 73,110,116, 80,114,111,112,101,114,116,121,  0, 77, 83,116,114,105,110,103, 80,114,111,112,101,
-114,116,121,  0, 79,114,105,103, 83,112, 97, 99,101, 70, 97, 99,101,  0, 77, 68,105,115,112,115,  0, 77,117,108,116,105,114,101,
-115, 67,111,108,  0, 77,117,108,116,105,114,101,115, 67,111,108, 70, 97, 99,101,  0, 77,117,108,116,105,114,101,115, 70, 97, 99,
-101,  0, 77,117,108,116,105,114,101,115, 69,100,103,101,  0, 77,117,108,116,105,114,101,115, 76,101,118,101,108,  0, 77,111,100,
+115,105,103,109, 97, 95, 99,111,108,111,114,  0,115,105,103,109, 97, 95,115,112, 97, 99,101,  0,104,117,101,  0, 98, 97,115,101,
+ 95,112, 97,116,104, 91, 49, 48, 50, 52, 93,  0,102,111,114,109, 97,116,  0, 97, 99,116,105,118,101, 95,105,110,112,117,116,  0,
+117,115,101, 95,114,101,110,100,101,114, 95,102,111,114,109, 97,116,  0,117,115,101, 95,110,111,100,101, 95,102,111,114,109, 97,
+116,  0,116, 49,  0,116, 50,  0,116, 51,  0,102,115,116,114,101,110,103,116,104,  0,102, 97,108,112,104, 97,  0,107,101,121, 91,
+ 52, 93,  0, 97,108,103,111,114,105,116,104,109,  0, 99,104, 97,110,110,101,108,  0,120, 49,  0,120, 50,  0,121, 49,  0,121, 50,
+  0,102, 97, 99, 95,120, 49,  0,102, 97, 99, 95,120, 50,  0,102, 97, 99, 95,121, 49,  0,102, 97, 99, 95,121, 50,  0, 99,111,108,
+110, 97,109,101, 91, 54, 52, 93,  0, 98,107,116,121,112,101,  0,112, 97,100, 95, 99, 49,  0,103, 97,109, 99,111,  0,110,111, 95,
+122, 98,117,102,  0,102,115,116,111,112,  0,109, 97,120, 98,108,117,114,  0, 98,116,104,114,101,115,104,  0,114,111,116, 97,116,
+105,111,110,  0,112, 97,100, 95,102, 49,  0, 42,100,105, 99,116,  0, 42,110,111,100,101,  0, 99,111,108,109,111,100,  0,109,105,
+120,  0,102, 97,100,101,  0, 97,110,103,108,101, 95,111,102,115,  0,109,  0, 99,  0,106,105,116,  0,112,114,111,106,  0,102,105,
+116,  0,115,108,111,112,101, 91, 51, 93,  0,112,111,119,101,114, 91, 51, 93,  0,108,105,102,116, 95,108,103,103, 91, 51, 93,  0,
+103, 97,109,109, 97, 95,105,110,118, 91, 51, 93,  0,108,105,109, 99,104, 97,110,  0,117,110,115,112,105,108,108,  0,108,105,109,
+115, 99, 97,108,101,  0,117,115,112,105,108,108,114,  0,117,115,112,105,108,108,103,  0,117,115,112,105,108,108, 98,  0,116,101,
+120, 95,109, 97,112,112,105,110,103,  0, 99,111,108,111,114, 95,109, 97,112,112,105,110,103,  0,115,117,110, 95,100,105,114,101,
+ 99,116,105,111,110, 91, 51, 93,  0,116,117,114, 98,105,100,105,116,121,  0, 99,111,108,111,114, 95,115,112, 97, 99,101,  0,112,
+114,111,106,101, 99,116,105,111,110,  0,103,114, 97,100,105,101,110,116, 95,116,121,112,101,  0, 99,111,108,111,114,105,110,103,
+  0,109,117,115,103,114, 97,118,101, 95,116,121,112,101,  0,119, 97,118,101, 95,116,121,112,101,  0,115,104,111,114,116,121,  0,
+109,105,110,116, 97, 98,108,101,  0,109, 97,120,116, 97, 98,108,101,  0,101,120,116, 95,105,110, 91, 50, 93,  0,101,120,116, 95,
+111,117,116, 91, 50, 93,  0, 42, 99,117,114,118,101,  0, 42,116, 97, 98,108,101,  0, 42,112,114,101,109,117,108,116, 97, 98,108,
+101,  0,112,114,101,115,101,116,  0, 99,104, 97,110,103,101,100, 95,116,105,109,101,115,116, 97,109,112,  0, 99,117,114,114,  0,
+ 99,108,105,112,114,  0, 99,109, 91, 52, 93,  0, 98,108, 97, 99,107, 91, 51, 93,  0,119,104,105,116,101, 91, 51, 93,  0, 98,119,
+109,117,108, 91, 51, 93,  0,115, 97,109,112,108,101, 91, 51, 93,  0,120, 95,114,101,115,111,108,117,116,105,111,110,  0,100, 97,
+116, 97, 95,114, 91, 50, 53, 54, 93,  0,100, 97,116, 97, 95,103, 91, 50, 53, 54, 93,  0,100, 97,116, 97, 95, 98, 91, 50, 53, 54,
+ 93,  0,100, 97,116, 97, 95,108,117,109, 97, 91, 50, 53, 54, 93,  0,115, 97,109,112,108,101, 95,102,117,108,108,  0,115, 97,109,
+112,108,101, 95,108,105,110,101,115,  0, 97, 99, 99,117,114, 97, 99,121,  0,119, 97,118,101,102,114,109, 95,109,111,100,101,  0,
+119, 97,118,101,102,114,109, 95, 97,108,112,104, 97,  0,119, 97,118,101,102,114,109, 95,121,102, 97, 99,  0,119, 97,118,101,102,
+114,109, 95,104,101,105,103,104,116,  0,118,101, 99,115, 99,111,112,101, 95, 97,108,112,104, 97,  0,118,101, 99,115, 99,111,112,
+101, 95,104,101,105,103,104,116,  0,109,105,110,109, 97,120, 91, 51, 93, 91, 50, 93,  0,104,105,115,116,  0, 42,119, 97,118,101,
+102,111,114,109, 95, 49,  0, 42,119, 97,118,101,102,111,114,109, 95, 50,  0, 42,119, 97,118,101,102,111,114,109, 95, 51,  0, 42,
+118,101, 99,115, 99,111,112,101,  0,119, 97,118,101,102,111,114,109, 95,116,111,116,  0,111,102,102,115,101,116, 91, 50, 93,  0,
+ 99,108,111,110,101,  0,109,116,101,120,  0, 42,105, 99,111,110, 95,105,109, 98,117,102,  0,105, 99,111,110, 95,102,105,108,101,
+112, 97,116,104, 91, 49, 48, 50, 52, 93,  0,110,111,114,109, 97,108, 95,119,101,105,103,104,116,  0,111, 98, 95,109,111,100,101,
+  0,106,105,116,116,101,114,  0,115,109,111,111,116,104, 95,115,116,114,111,107,101, 95,114, 97,100,105,117,115,  0,115,109,111,
+111,116,104, 95,115,116,114,111,107,101, 95,102, 97, 99,116,111,114,  0,114, 97,116,101,  0,114,103, 98, 91, 51, 93,  0,115, 99,
+117,108,112,116, 95,112,108, 97,110,101,  0,112,108, 97,110,101, 95,111,102,102,115,101,116,  0,115, 99,117,108,112,116, 95,116,
+111,111,108,  0,118,101,114,116,101,120,112, 97,105,110,116, 95,116,111,111,108,  0,105,109, 97,103,101,112, 97,105,110,116, 95,
+116,111,111,108,  0,112, 97,100, 51, 91, 53, 93,  0, 97,117,116,111,115,109,111,111,116,104, 95,102, 97, 99,116,111,114,  0, 99,
+114,101, 97,115,101, 95,112,105,110, 99,104, 95,102, 97, 99,116,111,114,  0,112,108, 97,110,101, 95,116,114,105,109,  0,116,101,
+120,116,117,114,101, 95,115, 97,109,112,108,101, 95, 98,105, 97,115,  0,116,101,120,116,117,114,101, 95,111,118,101,114,108, 97,
+121, 95, 97,108,112,104, 97,  0, 97,100,100, 95, 99,111,108, 91, 51, 93,  0,115,117, 98, 95, 99,111,108, 91, 51, 93,  0, 97, 99,
+116,105,118,101, 95,114,110,100,  0, 97, 99,116,105,118,101, 95, 99,108,111,110,101,  0, 97, 99,116,105,118,101, 95,109, 97,115,
+107,  0, 42,108, 97,121,101,114,115,  0,116,121,112,101,109, 97,112, 91, 51, 52, 93,  0,116,111,116,108, 97,121,101,114,  0,109,
+ 97,120,108, 97,121,101,114,  0,116,111,116,115,105,122,101,  0, 42,112,111,111,108,  0, 42,101,120,116,101,114,110, 97,108,  0,
+114,111,116, 91, 52, 93,  0, 97,118,101, 91, 51, 93,  0, 42,103,114,111,117,110,100,  0,119, 97,110,100,101,114, 91, 51, 93,  0,
+114,101,115,116, 95,108,101,110,103,116,104,  0,112, 97,114,116,105, 99,108,101, 95,105,110,100,101,120, 91, 50, 93,  0,100,101,
+108,101,116,101, 95,102,108, 97,103,  0,110,117,109,  0,112, 97,114,101,110,116,  0,112, 97, 91, 52, 93,  0,119, 91, 52, 93,  0,
+102,117,118, 91, 52, 93,  0,102,111,102,102,115,101,116,  0,112,114,101,118, 95,115,116, 97,116,101,  0, 42,104, 97,105,114,  0,
+ 42, 98,111,105,100,  0,100,105,101,116,105,109,101,  0,110,117,109, 95,100,109, 99, 97, 99,104,101,  0,104, 97,105,114, 95,105,
+110,100,101,120,  0, 97,108,105,118,101,  0,115,112,114,105,110,103, 95,107,  0,112,108, 97,115,116,105, 99,105,116,121, 95, 99,
+111,110,115,116, 97,110,116,  0,121,105,101,108,100, 95,114, 97,116,105,111,  0,112,108, 97,115,116,105, 99,105,116,121, 95, 98,
+ 97,108, 97,110, 99,101,  0,121,105,101,108,100, 95, 98, 97,108, 97,110, 99,101,  0,118,105,115, 99,111,115,105,116,121, 95,111,
+109,101,103, 97,  0,118,105,115, 99,111,115,105,116,121, 95, 98,101,116, 97,  0,115,116,105,102,102,110,101,115,115, 95,107,  0,
+115,116,105,102,102,110,101,115,115, 95,107,110,101, 97,114,  0,114,101,115,116, 95,100,101,110,115,105,116,121,  0, 98,117,111,
+121, 97,110, 99,121,  0,115,112,114,105,110,103, 95,102,114, 97,109,101,115,  0, 42, 98,111,105,100,115,  0, 42,102,108,117,105,
+100,  0,100,105,115,116,114,  0,112,104,121,115,116,121,112,101,  0, 97,118,101,109,111,100,101,  0,114,101, 97, 99,116,101,118,
+101,110,116,  0,100,114, 97,119,  0,100,114, 97,119, 95, 97,115,  0,100,114, 97,119, 95,115,105,122,101,  0, 99,104,105,108,100,
+116,121,112,101,  0,114,101,110, 95, 97,115,  0,115,117, 98,102,114, 97,109,101,115,  0,100,114, 97,119, 95, 99,111,108,  0,114,
+101,110, 95,115,116,101,112,  0,104, 97,105,114, 95,115,116,101,112,  0,107,101,121,115, 95,115,116,101,112,  0, 97,100, 97,112,
+116, 95, 97,110,103,108,101,  0, 97,100, 97,112,116, 95,112,105,120,  0,114,111,116,102,114,111,109,  0,105,110,116,101,103,114,
+ 97,116,111,114,  0, 98, 98, 95, 97,108,105,103,110,  0, 98, 98, 95,117,118, 95,115,112,108,105,116,  0, 98, 98, 95, 97,110,105,
+109,  0, 98, 98, 95,115,112,108,105,116, 95,111,102,102,115,101,116,  0, 98, 98, 95,116,105,108,116,  0, 98, 98, 95,114, 97,110,
+100, 95,116,105,108,116,  0, 98, 98, 95,111,102,102,115,101,116, 91, 50, 93,  0, 98, 98, 95,115,105,122,101, 91, 50, 93,  0, 98,
+ 98, 95,118,101,108, 95,104,101, 97,100,  0, 98, 98, 95,118,101,108, 95,116, 97,105,108,  0, 99,111,108,111,114, 95,118,101, 99,
+ 95,109, 97,120,  0,115,105,109,112,108,105,102,121, 95,114,101,102,115,105,122,101,  0,115,105,109,112,108,105,102,121, 95,114,
+ 97,116,101,  0,115,105,109,112,108,105,102,121, 95,116,114, 97,110,115,105,116,105,111,110,  0,115,105,109,112,108,105,102,121,
+ 95,118,105,101,119,112,111,114,116,  0,116,105,109,101,116,119,101, 97,107,  0, 99,111,117,114, 97,110,116, 95,116, 97,114,103,
+101,116,  0,106,105,116,102, 97, 99,  0,101,102,102, 95,104, 97,105,114,  0,103,114,105,100, 95,114, 97,110,100,  0,112,115, 95,
+111,102,102,115,101,116, 91, 49, 93,  0,103,114,105,100, 95,114,101,115,  0,101,102,102,101, 99,116,111,114, 95, 97,109,111,117,
+110,116,  0,116,105,109,101, 95,102,108, 97,103,  0,116,105,109,101, 95,112, 97,100, 91, 51, 93,  0,112, 97,114,116,102, 97, 99,
+  0,116, 97,110,102, 97, 99,  0,116, 97,110,112,104, 97,115,101,  0,114,101, 97, 99,116,102, 97, 99,  0,111, 98, 95,118,101,108,
+ 91, 51, 93,  0, 97,118,101,102, 97, 99,  0,112,104, 97,115,101,102, 97, 99,  0,114, 97,110,100,114,111,116,102, 97, 99,  0,114,
+ 97,110,100,112,104, 97,115,101,102, 97, 99,  0,114, 97,110,100,115,105,122,101,  0, 97, 99, 99, 91, 51, 93,  0,100,114, 97,103,
+102, 97, 99,  0, 98,114,111,119,110,102, 97, 99,  0,114, 97,110,100,108,101,110,103,116,104,  0, 99,104,105,108,100, 95,110, 98,
+114,  0,114,101,110, 95, 99,104,105,108,100, 95,110, 98,114,  0,112, 97,114,101,110,116,115,  0, 99,104,105,108,100,115,105,122,
+101,  0, 99,104,105,108,100,114, 97,110,100,115,105,122,101,  0, 99,104,105,108,100,114, 97,100,  0, 99,104,105,108,100,102,108,
+ 97,116,  0, 99,108,117,109,112,112,111,119,  0,107,105,110,107, 95,102,108, 97,116,  0,107,105,110,107, 95, 97,109,112, 95, 99,
+108,117,109,112,  0,114,111,117,103,104, 49,  0,114,111,117,103,104, 49, 95,115,105,122,101,  0,114,111,117,103,104, 50,  0,114,
+111,117,103,104, 50, 95,115,105,122,101,  0,114,111,117,103,104, 50, 95,116,104,114,101,115,  0,114,111,117,103,104, 95,101,110,
+100,  0,114,111,117,103,104, 95,101,110,100, 95,115,104, 97,112,101,  0, 99,108,101,110,103,116,104,  0, 99,108,101,110,103,116,
+104, 95,116,104,114,101,115,  0,112, 97,114,116,105,110,103, 95,102, 97, 99,  0,112, 97,114,116,105,110,103, 95,109,105,110,  0,
+112, 97,114,116,105,110,103, 95,109, 97,120,  0, 98,114, 97,110, 99,104, 95,116,104,114,101,115,  0,100,114, 97,119, 95,108,105,
+110,101, 91, 50, 93,  0,112, 97,116,104, 95,115,116, 97,114,116,  0,112, 97,116,104, 95,101,110,100,  0,116,114, 97,105,108, 95,
+ 99,111,117,110,116,  0,107,101,121,101,100, 95,108,111,111,112,115,  0,100,117,112,108,105,119,101,105,103,104,116,115,  0, 42,
+101,102,102, 95,103,114,111,117,112,  0, 42,100,117,112, 95,111, 98,  0, 42, 98, 98, 95,111, 98,  0, 42,112,100, 50,  0, 42,112,
+ 97,114,116,  0, 42,112, 97,114,116,105, 99,108,101,115,  0, 42, 42,112, 97,116,104, 99, 97, 99,104,101,  0, 42, 42, 99,104,105,
+108,100, 99, 97, 99,104,101,  0,112, 97,116,104, 99, 97, 99,104,101, 98,117,102,115,  0, 99,104,105,108,100, 99, 97, 99,104,101,
+ 98,117,102,115,  0, 42, 99,108,109,100,  0, 42,104, 97,105,114, 95,105,110, 95,100,109,  0, 42,104, 97,105,114, 95,111,117,116,
+ 95,100,109,  0, 42,116, 97,114,103,101,116, 95,111, 98,  0, 42,108, 97,116,116,105, 99,101,  0,116,114,101,101, 95,102,114, 97,
+109,101,  0, 98,118,104,116,114,101,101, 95,102,114, 97,109,101,  0, 99,104,105,108,100, 95,115,101,101,100,  0,116,111,116,117,
+110,101,120,105,115,116,  0,116,111,116, 99,104,105,108,100,  0,116,111,116, 99, 97, 99,104,101,100,  0,116,111,116, 99,104,105,
+108,100, 99, 97, 99,104,101,  0,116, 97,114,103,101,116, 95,112,115,121,115,  0,116,111,116,107,101,121,101,100,  0, 98, 97,107,
+101,115,112, 97, 99,101,  0, 98, 98, 95,117,118,110, 97,109,101, 91, 51, 93, 91, 54, 52, 93,  0,118,103,114,111,117,112, 91, 49,
+ 50, 93,  0,118,103, 95,110,101,103,  0,114,116, 51,  0, 42,114,101,110,100,101,114,100, 97,116, 97,  0, 42,101,102,102,101, 99,
+116,111,114,115,  0, 42,102,108,117,105,100, 95,115,112,114,105,110,103,115,  0,116,111,116, 95,102,108,117,105,100,115,112,114,
+105,110,103,115,  0, 97,108,108,111, 99, 95,102,108,117,105,100,115,112,114,105,110,103,115,  0, 42,116,114,101,101,  0, 42,112,
+100,100,  0, 42,102,114, 97,110,100,  0,100,116, 95,102,114, 97, 99,  0, 95,112, 97,100,  0, 67,100,105,115,  0, 67,118,105,  0,
+115,116,114,117, 99,116,117,114, 97,108,  0, 98,101,110,100,105,110,103,  0,109, 97,120, 95, 98,101,110,100,  0,109, 97,120, 95,
+115,116,114,117, 99,116,  0,109, 97,120, 95,115,104,101, 97,114,  0, 97,118,103, 95,115,112,114,105,110,103, 95,108,101,110,  0,
+116,105,109,101,115, 99, 97,108,101,  0,101,102,102, 95,102,111,114, 99,101, 95,115, 99, 97,108,101,  0,101,102,102, 95,119,105,
+110,100, 95,115, 99, 97,108,101,  0,115,105,109, 95,116,105,109,101, 95,111,108,100,  0,118,101,108,111, 99,105,116,121, 95,115,
+109,111,111,116,104,  0, 99,111,108,108,105,100,101,114, 95,102,114,105, 99,116,105,111,110,  0,118,101,108, 95,100, 97,109,112,
+105,110,103,  0,115,116,101,112,115, 80,101,114, 70,114, 97,109,101,  0,112,114,101,114,111,108,108,  0,109, 97,120,115,112,114,
+105,110,103,108,101,110,  0,115,111,108,118,101,114, 95,116,121,112,101,  0,118,103,114,111,117,112, 95, 98,101,110,100,  0,118,
+103,114,111,117,112, 95,109, 97,115,115,  0,118,103,114,111,117,112, 95,115,116,114,117, 99,116,  0,115,104, 97,112,101,107,101,
+121, 95,114,101,115,116,  0,112,114,101,115,101,116,115,  0,114,101,115,101,116,  0, 42, 99,111,108,108,105,115,105,111,110, 95,
+108,105,115,116,  0,101,112,115,105,108,111,110,  0,115,101,108,102, 95,102,114,105, 99,116,105,111,110,  0,115,101,108,102,101,
+112,115,105,108,111,110,  0,114,101,112,101,108, 95,102,111,114, 99,101,  0,100,105,115,116, 97,110, 99,101, 95,114,101,112,101,
+108,  0,115,101,108,102, 95,108,111,111,112, 95, 99,111,117,110,116,  0,108,111,111,112, 95, 99,111,117,110,116,  0,112,114,101,
+115,115,117,114,101,  0,116,104,105, 99,107,110,101,115,115,  0,115,116,114,111,107,101,115,  0,102,114, 97,109,101,110,117,109,
+  0, 42, 97, 99,116,102,114, 97,109,101,  0,103,115,116,101,112,  0,105,110,102,111, 91, 49, 50, 56, 93,  0,115, 98,117,102,102,
+101,114, 95,115,105,122,101,  0,115, 98,117,102,102,101,114, 95,115,102,108, 97,103,  0, 42,115, 98,117,102,102,101,114,  0,108,
+105,115,116,  0,112,114,105,110,116,108,101,118,101,108,  0,115,116,111,114,101,108,101,118,101,108,  0, 42,114,101,112,111,114,
+116,116,105,109,101,114,  0, 42,119,105,110,100,114, 97,119, 97, 98,108,101,  0, 42,119,105,110, 97, 99,116,105,118,101,  0,119,
+105,110,100,111,119,115,  0,105,110,105,116,105, 97,108,105,122,101,100,  0,102,105,108,101, 95,115, 97,118,101,100,  0,111,112,
+ 95,117,110,100,111, 95,100,101,112,116,104,  0,111,112,101,114, 97,116,111,114,115,  0,113,117,101,117,101,  0,114,101,112,111,
+114,116,115,  0,106,111, 98,115,  0,112, 97,105,110,116, 99,117,114,115,111,114,115,  0,100,114, 97,103,115,  0,107,101,121, 99,
+111,110,102,105,103,115,  0, 42,100,101,102, 97,117,108,116, 99,111,110,102,  0, 42, 97,100,100,111,110, 99,111,110,102,  0, 42,
+117,115,101,114, 99,111,110,102,  0,116,105,109,101,114,115,  0, 42, 97,117,116,111,115, 97,118,101,116,105,109,101,114,  0, 42,
+103,104,111,115,116,119,105,110,  0,103,114, 97, 98, 99,117,114,115,111,114,  0, 42,115, 99,114,101,101,110,  0, 42,110,101,119,
+115, 99,114,101,101,110,  0,115, 99,114,101,101,110,110, 97,109,101, 91, 54, 52, 93,  0,112,111,115,120,  0,112,111,115,121,  0,
+119,105,110,100,111,119,115,116, 97,116,101,  0,109,111,110,105,116,111,114,  0,108, 97,115,116, 99,117,114,115,111,114,  0,109,
+111,100, 97,108, 99,117,114,115,111,114,  0, 97,100,100,109,111,117,115,101,109,111,118,101,  0, 42,101,118,101,110,116,115,116,
+ 97,116,101,  0, 42, 99,117,114,115,119,105,110,  0, 42,116,119,101, 97,107,  0,100,114, 97,119,109,101,116,104,111,100,  0,100,
+114, 97,119,102, 97,105,108,  0, 42,100,114, 97,119,100, 97,116, 97,  0,109,111,100, 97,108,104, 97,110,100,108,101,114,115,  0,
+115,117, 98,119,105,110,100,111,119,115,  0,103,101,115,116,117,114,101,  0,105,100,110, 97,109,101, 91, 54, 52, 93,  0,112,114,
+111,112,118, 97,108,117,101,  0,115,104,105,102,116,  0, 99,116,114,108,  0, 97,108,116,  0,111,115,107,101,121,  0,107,101,121,
+109,111,100,105,102,105,101,114,  0,109, 97,112,116,121,112,101,  0, 42,112,116,114,  0, 42,114,101,109,111,118,101, 95,105,116,
+101,109,  0, 42, 97,100,100, 95,105,116,101,109,  0,105,116,101,109,115,  0,100,105,102,102, 95,105,116,101,109,115,  0,115,112,
+ 97, 99,101,105,100,  0,114,101,103,105,111,110,105,100,  0,107,109,105, 95,105,100,  0, 40, 42,112,111,108,108, 41, 40, 41,  0,
+ 42,109,111,100, 97,108, 95,105,116,101,109,115,  0, 98, 97,115,101,110, 97,109,101, 91, 54, 52, 93,  0, 97, 99,116,107,101,121,
+109, 97,112,  0, 42, 99,117,115,116,111,109,100, 97,116, 97,  0, 42,112,121, 95,105,110,115,116, 97,110, 99,101,  0, 42,114,101,
+112,111,114,116,115,  0,109, 97, 99,114,111,  0, 42,111,112,109,  0, 42,101,100, 97,116, 97,  0, 42, 99,111,101,102,102,105, 99,
+105,101,110,116,115,  0, 97,114,114, 97,121,115,105,122,101,  0,112,111,108,121, 95,111,114,100,101,114,  0, 97,109,112,108,105,
+116,117,100,101,  0,112,104, 97,115,101, 95,109,117,108,116,105,112,108,105,101,114,  0,112,104, 97,115,101, 95,111,102,102,115,
+101,116,  0,118, 97,108,117,101, 95,111,102,102,115,101,116,  0,109,105,100,118, 97,108,  0, 98,101,102,111,114,101, 95,109,111,
+100,101,  0, 97,102,116,101,114, 95,109,111,100,101,  0, 98,101,102,111,114,101, 95, 99,121, 99,108,101,115,  0, 97,102,116,101,
+114, 95, 99,121, 99,108,101,115,  0,114,101, 99,116,  0,112,104, 97,115,101,  0,109,111,100,105,102,105, 99, 97,116,105,111,110,
+  0,115,116,101,112, 95,115,105,122,101,  0, 42,114,110, 97, 95,112, 97,116,104,  0,112, 99,104, 97,110, 95,110, 97,109,101, 91,
+ 51, 50, 93,  0,116,114, 97,110,115, 67,104, 97,110,  0,105,100,116,121,112,101,  0,116, 97,114,103,101,116,115, 91, 56, 93,  0,
+110,117,109, 95,116, 97,114,103,101,116,115,  0,118, 97,114,105, 97, 98,108,101,115,  0,101,120,112,114,101,115,115,105,111,110,
+ 91, 50, 53, 54, 93,  0, 42,101,120,112,114, 95, 99,111,109,112,  0,118,101, 99, 91, 50, 93,  0, 42,102,112,116,  0, 97,114,114,
+ 97,121, 95,105,110,100,101,120,  0, 99,111,108,111,114, 95,109,111,100,101,  0, 99,111,108,111,114, 91, 51, 93,  0,102,114,111,
+109, 91, 49, 50, 56, 93,  0,116,111, 91, 49, 50, 56, 93,  0,109, 97,112,112,105,110,103,115,  0,115,116,114,105,112,115,  0, 42,
+114,101,109, 97,112,  0,102, 99,117,114,118,101,115,  0,115,116,114,105,112, 95,116,105,109,101,  0, 98,108,101,110,100,109,111,
+100,101,  0,101,120,116,101,110,100,109,111,100,101,  0, 42,115,112,101, 97,107,101,114, 95,104, 97,110,100,108,101,  0,103,114,
+111,117,112, 91, 54, 52, 93,  0,103,114,111,117,112,109,111,100,101,  0,107,101,121,105,110,103,102,108, 97,103,  0,112, 97,116,
+104,115,  0,100,101,115, 99,114,105,112,116,105,111,110, 91, 50, 52, 48, 93,  0,116,121,112,101,105,110,102,111, 91, 54, 52, 93,
+  0, 97, 99,116,105,118,101, 95,112, 97,116,104,  0, 42,116,109,112, 97, 99,116,  0,110,108, 97, 95,116,114, 97, 99,107,115,  0,
+ 42, 97, 99,116,115,116,114,105,112,  0,100,114,105,118,101,114,115,  0,111,118,101,114,114,105,100,101,115,  0, 97, 99,116, 95,
+ 98,108,101,110,100,109,111,100,101,  0, 97, 99,116, 95,101,120,116,101,110,100,109,111,100,101,  0, 97, 99,116, 95,105,110,102,
+108,117,101,110, 99,101,  0,114,117,108,101,  0,111,112,116,105,111,110,115,  0,102,101, 97,114, 95,102, 97, 99,116,111,114,  0,
+115,105,103,110, 97,108, 95,105,100,  0,108,111,111,107, 95, 97,104,101, 97,100,  0,111,108,111, 99, 91, 51, 93,  0,113,117,101,
+117,101, 95,115,105,122,101,  0,119, 97,110,100,101,114,  0,102,108,101,101, 95,100,105,115,116, 97,110, 99,101,  0,104,101, 97,
+108,116,104,  0,115,116, 97,116,101, 95,105,100,  0,114,117,108,101,115,  0, 99,111,110,100,105,116,105,111,110,115,  0, 97, 99,
+116,105,111,110,115,  0,114,117,108,101,115,101,116, 95,116,121,112,101,  0,114,117,108,101, 95,102,117,122,122,105,110,101,115,
+115,  0,108, 97,115,116, 95,115,116, 97,116,101, 95,105,100,  0,108, 97,110,100,105,110,103, 95,115,109,111,111,116,104,110,101,
+115,115,  0, 98, 97,110,107,105,110,103,  0, 97,103,103,114,101,115,115,105,111,110,  0, 97,105,114, 95,109,105,110, 95,115,112,
+101,101,100,  0, 97,105,114, 95,109, 97,120, 95,115,112,101,101,100,  0, 97,105,114, 95,109, 97,120, 95, 97, 99, 99,  0, 97,105,
+114, 95,109, 97,120, 95, 97,118,101,  0, 97,105,114, 95,112,101,114,115,111,110, 97,108, 95,115,112, 97, 99,101,  0,108, 97,110,
+100, 95,106,117,109,112, 95,115,112,101,101,100,  0,108, 97,110,100, 95,109, 97,120, 95,115,112,101,101,100,  0,108, 97,110,100,
+ 95,109, 97,120, 95, 97, 99, 99,  0,108, 97,110,100, 95,109, 97,120, 95, 97,118,101,  0,108, 97,110,100, 95,112,101,114,115,111,
+110, 97,108, 95,115,112, 97, 99,101,  0,108, 97,110,100, 95,115,116,105, 99,107, 95,102,111,114, 99,101,  0,115,116, 97,116,101,
+115,  0, 42,115,109,100,  0, 42,102,108,117,105,100, 95,103,114,111,117,112,  0, 42, 99,111,108,108, 95,103,114,111,117,112,  0,
+ 42,119,116,  0, 42,116,101,120, 95,119,116,  0, 42,116,101,120, 95,115,104, 97,100,111,119,  0, 42,115,104, 97,100,111,119,  0,
+112, 48, 91, 51, 93,  0,112, 49, 91, 51, 93,  0,100,120,  0,111,109,101,103, 97,  0,116,101,109,112, 65,109, 98,  0, 98,101,116,
+ 97,  0,114,101,115, 91, 51, 93,  0, 97,109,112,108,105,102,121,  0,109, 97,120,114,101,115,  0,118,105,101,119,115,101,116,116,
+105,110,103,115,  0,110,111,105,115,101,  0,100,105,115,115, 95,112,101,114, 99,101,110,116,  0,100,105,115,115, 95,115,112,101,
+101,100,  0,114,101,115, 95,119,116, 91, 51, 93,  0,100,120, 95,119,116,  0,118, 51,100,110,117,109,  0, 99, 97, 99,104,101, 95,
+ 99,111,109,112,  0, 99, 97, 99,104,101, 95,104,105,103,104, 95, 99,111,109,112,  0, 42,112,111,105,110,116, 95, 99, 97, 99,104,
+101, 91, 50, 93,  0,112,116, 99, 97, 99,104,101,115, 91, 50, 93,  0, 98,111,114,100,101,114, 95, 99,111,108,108,105,115,105,111,
+110,115,  0,116,105,109,101, 95,115, 99, 97,108,101,  0,118,111,114,116,105, 99,105,116,121,  0,118,101,108,111, 99,105,116,121,
+ 91, 50, 93,  0,118,101,108, 95,109,117,108,116,105,  0,118,103,114,112, 95,104,101, 97,116, 95,115, 99, 97,108,101, 91, 50, 93,
+  0,118,103,114,111,117,112, 95,102,108,111,119,  0,118,103,114,111,117,112, 95,100,101,110,115,105,116,121,  0,118,103,114,111,
+117,112, 95,104,101, 97,116,  0, 42,112,111,105,110,116,115, 95,111,108,100,  0, 42,118,101,108,  0,109, 97,116, 95,111,108,100,
+ 91, 52, 93, 91, 52, 93,  0,118,111,108,117,109,101, 95,109, 97,120,  0,118,111,108,117,109,101, 95,109,105,110,  0,100,105,115,
+116, 97,110, 99,101, 95,109, 97,120,  0,100,105,115,116, 97,110, 99,101, 95,114,101,102,101,114,101,110, 99,101,  0, 99,111,110,
+101, 95, 97,110,103,108,101, 95,111,117,116,101,114,  0, 99,111,110,101, 95, 97,110,103,108,101, 95,105,110,110,101,114,  0, 99,
+111,110,101, 95,118,111,108,117,109,101, 95,111,117,116,101,114,  0,114,101,110,100,101,114, 95,102,108, 97,103,  0, 98,117,105,
+108,100, 95,115,105,122,101, 95,102,108, 97,103,  0, 98,117,105,108,100, 95,116, 99, 95,102,108, 97,103,  0,108, 97,115,116,115,
+105,122,101, 91, 50, 93,  0,116,114, 97, 99,107,105,110,103,  0, 42,116,114, 97, 99,107,105,110,103, 95, 99,111,110,116,101,120,
+116,  0,112,114,111,120,121,  0,116,114, 97, 99,107, 95,112,114,101,118,105,101,119, 95,104,101,105,103,104,116,  0, 42,116,114,
+ 97, 99,107, 95,112,114,101,118,105,101,119,  0,116,114, 97, 99,107, 95,112,111,115, 91, 50, 93,  0,116,114, 97, 99,107, 95,100,
+105,115, 97, 98,108,101,100,  0, 42,109, 97,114,107,101,114,  0,115,108,105,100,101, 95,115, 99, 97,108,101, 91, 50, 93,  0,101,
+114,114,111,114,  0, 42,105,110,116,114,105,110,115,105, 99,115,  0,115,101,110,115,111,114, 95,119,105,100,116,104,  0,112,105,
+120,101,108, 95, 97,115,112,101, 99,116,  0,102,111, 99, 97,108,  0,117,110,105,116,115,  0,112,114,105,110, 99,105,112, 97,108,
+ 91, 50, 93,  0,107, 49,  0,107, 50,  0,107, 51,  0,112,111,115, 91, 50, 93,  0,112, 97,116, 95,109,105,110, 91, 50, 93,  0,112,
+ 97,116, 95,109, 97,120, 91, 50, 93,  0,115,101, 97,114, 99,104, 95,109,105,110, 91, 50, 93,  0,115,101, 97,114, 99,104, 95,109,
+ 97,120, 91, 50, 93,  0,109, 97,114,107,101,114,115,110,114,  0,108, 97,115,116, 95,109, 97,114,107,101,114,  0, 42,109, 97,114,
+107,101,114,115,  0, 98,117,110,100,108,101, 95,112,111,115, 91, 51, 93,  0,112, 97,116, 95,102,108, 97,103,  0,115,101, 97,114,
+ 99,104, 95,102,108, 97,103,  0,102,114, 97,109,101,115, 95,108,105,109,105,116,  0,112, 97,116,116,101,114,110, 95,109, 97,116,
+ 99,104,  0,116,114, 97, 99,107,101,114,  0,112,121,114, 97,109,105,100, 95,108,101,118,101,108,115,  0,109,105,110,105,109,117,
+109, 95, 99,111,114,114,101,108, 97,116,105,111,110,  0,100,101,102, 97,117,108,116, 95,116,114, 97, 99,107,101,114,  0,100,101,
+102, 97,117,108,116, 95,112,121,114, 97,109,105,100, 95,108,101,118,101,108,115,  0,100,101,102, 97,117,108,116, 95,109,105,110,
+105,109,117,109, 95, 99,111,114,114,101,108, 97,116,105,111,110,  0,100,101,102, 97,117,108,116, 95,112, 97,116,116,101,114,110,
+ 95,115,105,122,101,  0,100,101,102, 97,117,108,116, 95,115,101, 97,114, 99,104, 95,115,105,122,101,  0,100,101,102, 97,117,108,
+116, 95,102,114, 97,109,101,115, 95,108,105,109,105,116,  0,100,101,102, 97,117,108,116, 95,109, 97,114,103,105,110,  0,100,101,
+102, 97,117,108,116, 95,112, 97,116,116,101,114,110, 95,109, 97,116, 99,104,  0,100,101,102, 97,117,108,116, 95,102,108, 97,103,
+  0,112,111,100,  0,107,101,121,102,114, 97,109,101, 49,  0,107,101,121,102,114, 97,109,101, 50,  0,114,101,102,105,110,101, 95,
+ 99, 97,109,101,114, 97, 95,105,110,116,114,105,110,115,105, 99,115,  0,112, 97,100, 50, 51,  0, 99,108,101, 97,110, 95,102,114,
+ 97,109,101,115,  0, 99,108,101, 97,110, 95, 97, 99,116,105,111,110,  0, 99,108,101, 97,110, 95,101,114,114,111,114,  0,111, 98,
+106,101, 99,116, 95,100,105,115,116, 97,110, 99,101,  0,116,111,116, 95,116,114, 97, 99,107,  0, 97, 99,116, 95,116,114, 97, 99,
+107,  0,109, 97,120,115, 99, 97,108,101,  0, 42,114,111,116, 95,116,114, 97, 99,107,  0,108,111, 99,105,110,102,  0,115, 99, 97,
+108,101,105,110,102,  0,114,111,116,105,110,102,  0, 42,115, 99, 97,108,101,105, 98,117,102,  0,108, 97,115,116, 95, 99, 97,109,
+101,114, 97,  0, 99, 97,109,110,114,  0, 42, 99, 97,109,101,114, 97,115,  0,116,114, 97, 99,107,115,  0,114,101, 99,111,110,115,
+116,114,117, 99,116,105,111,110,  0,109,101,115,115, 97,103,101, 91, 50, 53, 54, 93,  0,115,101,116,116,105,110,103,115,  0, 99,
+ 97,109,101,114, 97,  0,115,116, 97, 98,105,108,105,122, 97,116,105,111,110,  0, 42, 97, 99,116, 95,116,114, 97, 99,107,  0,111,
+ 98,106,101, 99,116,115,  0,111, 98,106,101, 99,116,110,114,  0,116,111,116, 95,111, 98,106,101, 99,116,  0, 42, 98,114,117,115,
+104, 95,103,114,111,117,112,  0, 99,117,114,114,101,110,116, 95,102,114, 97,109,101,  0,100,105,115,112, 95,116,121,112,101,  0,
+105,109, 97,103,101, 95,102,105,108,101,102,111,114,109, 97,116,  0,101,102,102,101, 99,116, 95,117,105,  0,112,114,101,118,105,
+101,119, 95,105,100,  0,105,110,105,116, 95, 99,111,108,111,114, 95,116,121,112,101,  0,112, 97,100, 95,115,  0,105,109, 97,103,
+101, 95,114,101,115,111,108,117,116,105,111,110,  0,115,117, 98,115,116,101,112,115,  0,105,110,105,116, 95, 99,111,108,111,114,
+ 91, 52, 93,  0, 42,105,110,105,116, 95,116,101,120,116,117,114,101,  0,105,110,105,116, 95,108, 97,121,101,114,110, 97,109,101,
+ 91, 54, 52, 93,  0,100,114,121, 95,115,112,101,101,100,  0, 99,111,108,111,114, 95,100,114,121, 95,116,104,114,101,115,104,111,
+108,100,  0,100,101,112,116,104, 95, 99,108, 97,109,112,  0,100,105,115,112, 95,102, 97, 99,116,111,114,  0,115,112,114,101, 97,
+100, 95,115,112,101,101,100,  0, 99,111,108,111,114, 95,115,112,114,101, 97,100, 95,115,112,101,101,100,  0,115,104,114,105,110,
+107, 95,115,112,101,101,100,  0,100,114,105,112, 95,118,101,108,  0,100,114,105,112, 95, 97, 99, 99,  0,105,110,102,108,117,101,
+110, 99,101, 95,115, 99, 97,108,101,  0,114, 97,100,105,117,115, 95,115, 99, 97,108,101,  0,119, 97,118,101, 95,100, 97,109,112,
+105,110,103,  0,119, 97,118,101, 95,115,112,101,101,100,  0,119, 97,118,101, 95,116,105,109,101,115, 99, 97,108,101,  0,119, 97,
+118,101, 95,115,112,114,105,110,103,  0,105,109, 97,103,101, 95,111,117,116,112,117,116, 95,112, 97,116,104, 91, 49, 48, 50, 52,
+ 93,  0,111,117,116,112,117,116, 95,110, 97,109,101, 91, 54, 52, 93,  0,111,117,116,112,117,116, 95,110, 97,109,101, 50, 91, 54,
+ 52, 93,  0, 42,112,109,100,  0,115,117,114,102, 97, 99,101,115,  0, 97, 99,116,105,118,101, 95,115,117,114,  0,101,114,114,111,
+114, 91, 54, 52, 93,  0, 99,111,108,108,105,115,105,111,110,  0,119,101,116,110,101,115,115,  0,112, 97,114,116,105, 99,108,101,
+ 95,114, 97,100,105,117,115,  0,112, 97,114,116,105, 99,108,101, 95,115,109,111,111,116,104,  0,112, 97,105,110,116, 95,100,105,
+115,116, 97,110, 99,101,  0, 42,112, 97,105,110,116, 95,114, 97,109,112,  0, 42,118,101,108, 95,114, 97,109,112,  0,112,114,111,
+120,105,109,105,116,121, 95,102, 97,108,108,111,102,102,  0,114, 97,121, 95,100,105,114,  0,119, 97,118,101, 95,102, 97, 99,116,
+111,114,  0,119, 97,118,101, 95, 99,108, 97,109,112,  0,109, 97,120, 95,118,101,108,111, 99,105,116,121,  0,115,109,117,100,103,
+101, 95,115,116,114,101,110,103,116,104,  0,  0, 84, 89, 80, 69, 16,  2,  0,  0, 99,104, 97,114,  0,117, 99,104, 97,114,  0,115,
+104,111,114,116,  0,117,115,104,111,114,116,  0,105,110,116,  0,108,111,110,103,  0,117,108,111,110,103,  0,102,108,111, 97,116,
+  0,100,111,117, 98,108,101,  0,105,110,116, 54, 52, 95,116,  0,117,105,110,116, 54, 52, 95,116,  0,118,111,105,100,  0, 76,105,
+110,107,  0, 76,105,110,107, 68, 97,116, 97,  0, 76,105,115,116, 66, 97,115,101,  0,118,101, 99, 50,115,  0,118,101, 99, 50,102,
+  0,118,101, 99, 51,102,  0,114, 99,116,105,  0,114, 99,116,102,  0, 73, 68, 80,114,111,112,101,114,116,121, 68, 97,116, 97,  0,
+ 73, 68, 80,114,111,112,101,114,116,121,  0, 73, 68,  0, 76,105, 98,114, 97,114,121,  0, 70,105,108,101, 68, 97,116, 97,  0, 80,
+114,101,118,105,101,119, 73,109, 97,103,101,  0, 73,112,111, 68,114,105,118,101,114,  0, 79, 98,106,101, 99,116,  0, 73,112,111,
+ 67,117,114,118,101,  0, 66, 80,111,105,110,116,  0, 66,101,122, 84,114,105,112,108,101,  0, 73,112,111,  0, 75,101,121, 66,108,
+111, 99,107,  0, 75,101,121,  0, 65,110,105,109, 68, 97,116, 97,  0, 84,101,120,116, 76,105,110,101,  0, 84,101,120,116, 77, 97,
+114,107,101,114,  0, 84,101,120,116,  0, 80, 97, 99,107,101,100, 70,105,108,101,  0, 67, 97,109,101,114, 97,  0, 73,109, 97,103,
+101, 85,115,101,114,  0, 83, 99,101,110,101,  0, 73,109, 97,103,101,  0, 71, 80, 85, 84,101,120,116,117,114,101,  0, 97,110,105,
+109,  0, 82,101,110,100,101,114, 82,101,115,117,108,116,  0, 77, 84,101,120,  0, 84,101,120,  0, 80,108,117,103,105,110, 84,101,
+120,  0, 67, 66, 68, 97,116, 97,  0, 67,111,108,111,114, 66, 97,110,100,  0, 69,110,118, 77, 97,112,  0, 73,109, 66,117,102,  0,
+ 80,111,105,110,116, 68,101,110,115,105,116,121,  0, 67,117,114,118,101, 77, 97,112,112,105,110,103,  0, 86,111,120,101,108, 68,
+ 97,116, 97,  0, 79, 99,101, 97,110, 84,101,120,  0, 98, 78,111,100,101, 84,114,101,101,  0, 84,101,120, 77, 97,112,112,105,110,
+103,  0, 67,111,108,111,114, 77, 97,112,112,105,110,103,  0, 76, 97,109,112,  0, 86,111,108,117,109,101, 83,101,116,116,105,110,
+103,115,  0, 71, 97,109,101, 83,101,116,116,105,110,103,115,  0, 77, 97,116,101,114,105, 97,108,  0, 71,114,111,117,112,  0, 86,
+ 70,111,110,116,  0, 86, 70,111,110,116, 68, 97,116, 97,  0, 77,101,116, 97, 69,108,101,109,  0, 66,111,117,110,100, 66,111,120,
+  0, 77,101,116, 97, 66, 97,108,108,  0, 78,117,114, 98,  0, 67,104, 97,114, 73,110,102,111,  0, 84,101,120,116, 66,111,120,  0,
+ 69,100,105,116, 78,117,114, 98,  0, 71, 72, 97,115,104,  0, 67,117,114,118,101,  0, 80, 97,116,104,  0, 83,101,108, 66,111,120,
+  0, 69,100,105,116, 70,111,110,116,  0, 77,101,115,104,  0, 77, 80,111,108,121,  0, 77, 84,101,120, 80,111,108,121,  0, 77, 76,
+111,111,112,  0, 77, 76,111,111,112, 85, 86,  0, 77, 76,111,111,112, 67,111,108,  0, 77, 70, 97, 99,101,  0, 77, 84, 70, 97, 99,
+101,  0, 84, 70, 97, 99,101,  0, 77, 86,101,114,116,  0, 77, 69,100,103,101,  0, 77, 68,101,102,111,114,109, 86,101,114,116,  0,
+ 77, 67,111,108,  0, 77, 83,116,105, 99,107,121,  0, 77, 83,101,108,101, 99,116,  0, 66, 77, 69,100,105,116, 77,101,115,104,  0,
+ 67,117,115,116,111,109, 68, 97,116, 97,  0, 77,117,108,116,105,114,101,115,  0, 77, 68,101,102,111,114,109, 87,101,105,103,104,
+116,  0, 77, 70,108,111, 97,116, 80,114,111,112,101,114,116,121,  0, 77, 73,110,116, 80,114,111,112,101,114,116,121,  0, 77, 83,
+116,114,105,110,103, 80,114,111,112,101,114,116,121,  0, 79,114,105,103, 83,112, 97, 99,101, 70, 97, 99,101,  0, 79,114,105,103,
+ 83,112, 97, 99,101, 76,111,111,112,  0, 77, 68,105,115,112,115,  0, 77,117,108,116,105,114,101,115, 67,111,108,  0, 77,117,108,
+116,105,114,101,115, 67,111,108, 70, 97, 99,101,  0, 77,117,108,116,105,114,101,115, 70, 97, 99,101,  0, 77,117,108,116,105,114,
+101,115, 69,100,103,101,  0, 77,117,108,116,105,114,101,115, 76,101,118,101,108,  0, 77, 82,101, 99, 97,115,116,  0, 77,111,100,
 105,102,105,101,114, 68, 97,116, 97,  0, 77, 97,112,112,105,110,103, 73,110,102,111, 77,111,100,105,102,105,101,114, 68, 97,116,
  97,  0, 83,117, 98,115,117,114,102, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 76, 97,116,116,105, 99,101, 77,111,100,
 105,102,105,101,114, 68, 97,116, 97,  0, 67,117,114,118,101, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 66,117,105,108,
@@ -14652,841 +17030,953 @@ char datatoc_preview_blend[]= {
 110,103,115,  0, 83,104,114,105,110,107,119,114, 97,112, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 83,105,109,112,108,
 101, 68,101,102,111,114,109, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 83,104, 97,112,101, 75,101,121, 77,111,100,105,
 102,105,101,114, 68, 97,116, 97,  0, 83,111,108,105,100,105,102,121, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 83, 99,
-114,101,119, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 87, 97,114,112, 77,111,100,105,102,105,101,114, 68, 97,116, 97,
-  0, 69,100,105,116, 76, 97,116,116,  0, 76, 97,116,116,105, 99,101,  0, 98, 68,101,102,111,114,109, 71,114,111,117,112,  0, 83,
- 99,117,108,112,116, 83,101,115,115,105,111,110,  0, 98, 65, 99,116,105,111,110,  0, 98, 80,111,115,101,  0, 98, 71, 80,100, 97,
-116, 97,  0, 98, 65,110,105,109, 86,105,122, 83,101,116,116,105,110,103,115,  0, 98, 77,111,116,105,111,110, 80, 97,116,104,  0,
- 66,117,108,108,101,116, 83,111,102,116, 66,111,100,121,  0, 80, 97,114,116, 68,101,102,108,101, 99,116,  0, 83,111,102,116, 66,
-111,100,121,  0, 79, 98, 72,111,111,107,  0, 68,117,112,108,105, 79, 98,106,101, 99,116,  0, 82, 78, 71,  0, 69,102,102,101, 99,
-116,111,114, 87,101,105,103,104,116,115,  0, 80, 84, 67, 97, 99,104,101, 69,120,116,114, 97,  0, 80, 84, 67, 97, 99,104,101, 77,
-101,109,  0, 80, 84, 67, 97, 99,104,101, 69,100,105,116,  0, 83, 66, 86,101,114,116,101,120,  0, 66,111,100,121, 80,111,105,110,
-116,  0, 66,111,100,121, 83,112,114,105,110,103,  0, 83, 66, 83, 99,114, 97,116, 99,104,  0, 70,108,117,105,100, 86,101,114,116,
-101,120, 86,101,108,111, 99,105,116,121,  0, 87,111,114,108,100,  0, 66, 97,115,101,  0, 65,118,105, 67,111,100,101, 99, 68, 97,
-116, 97,  0, 81,117,105, 99,107,116,105,109,101, 67,111,100,101, 99, 68, 97,116, 97,  0, 81,117,105, 99,107,116,105,109,101, 67,
-111,100,101, 99, 83,101,116,116,105,110,103,115,  0, 70, 70, 77,112,101,103, 67,111,100,101, 99, 68, 97,116, 97,  0, 65,117,100,
-105,111, 68, 97,116, 97,  0, 83, 99,101,110,101, 82,101,110,100,101,114, 76, 97,121,101,114,  0, 82,101,110,100,101,114, 68, 97,
-116, 97,  0, 82,101,110,100,101,114, 80,114,111,102,105,108,101,  0, 71, 97,109,101, 68,111,109,101,  0, 71, 97,109,101, 70,114,
- 97,109,105,110,103,  0, 71, 97,109,101, 68, 97,116, 97,  0, 84,105,109,101, 77, 97,114,107,101,114,  0, 80, 97,105,110,116,  0,
- 66,114,117,115,104,  0, 73,109, 97,103,101, 80, 97,105,110,116, 83,101,116,116,105,110,103,115,  0, 80, 97,114,116,105, 99,108,
-101, 66,114,117,115,104, 68, 97,116, 97,  0, 80, 97,114,116,105, 99,108,101, 69,100,105,116, 83,101,116,116,105,110,103,115,  0,
- 84,114, 97,110,115,102,111,114,109, 79,114,105,101,110,116, 97,116,105,111,110,  0, 83, 99,117,108,112,116,  0, 86, 80, 97,105,
-110,116,  0, 84,111,111,108, 83,101,116,116,105,110,103,115,  0, 98, 83,116, 97,116,115,  0, 85,110,105,116, 83,101,116,116,105,
-110,103,115,  0, 80,104,121,115,105, 99,115, 83,101,116,116,105,110,103,115,  0, 69,100,105,116,105,110,103,  0, 83, 99,101,110,
-101, 83,116, 97,116,115,  0, 68, 97,103, 70,111,114,101,115,116,  0, 66, 71,112,105, 99,  0, 82,101,103,105,111,110, 86,105,101,
-119, 51, 68,  0, 82,101,110,100,101,114, 73,110,102,111,  0, 86,105,101,119, 68,101,112,116,104,115,  0, 83,109,111,111,116,104,
- 86,105,101,119, 83,116,111,114,101,  0,119,109, 84,105,109,101,114,  0, 86,105,101,119, 51, 68,  0, 83,112, 97, 99,101, 76,105,
-110,107,  0, 86,105,101,119, 50, 68,  0, 83,112, 97, 99,101, 73,110,102,111,  0, 83,112, 97, 99,101, 73,112,111,  0, 98, 68,111,
-112,101, 83,104,101,101,116,  0, 83,112, 97, 99,101, 66,117,116,115,  0, 83,112, 97, 99,101, 83,101,113,  0, 70,105,108,101, 83,
-101,108,101, 99,116, 80, 97,114, 97,109,115,  0, 83,112, 97, 99,101, 70,105,108,101,  0, 70,105,108,101, 76,105,115,116,  0,119,
-109, 79,112,101,114, 97,116,111,114,  0, 70,105,108,101, 76, 97,121,111,117,116,  0, 83,112, 97, 99,101, 79,111,112,115,  0, 84,
-114,101,101, 83,116,111,114,101,  0, 84,114,101,101, 83,116,111,114,101, 69,108,101,109,  0, 83,112, 97, 99,101, 73,109, 97,103,
-101,  0, 83, 99,111,112,101,115,  0, 72,105,115,116,111,103,114, 97,109,  0, 83,112, 97, 99,101, 78,108, 97,  0, 83,112, 97, 99,
-101, 84,101,120,116,  0, 83, 99,114,105,112,116,  0, 83,112, 97, 99,101, 83, 99,114,105,112,116,  0, 83,112, 97, 99,101, 84,105,
-109,101, 67, 97, 99,104,101,  0, 83,112, 97, 99,101, 84,105,109,101,  0, 83,112, 97, 99,101, 78,111,100,101,  0, 83,112, 97, 99,
-101, 76,111,103,105, 99,  0, 83,112, 97, 99,101, 73,109, 97, 83,101,108,  0, 67,111,110,115,111,108,101, 76,105,110,101,  0, 83,
-112, 97, 99,101, 67,111,110,115,111,108,101,  0, 83,112, 97, 99,101, 85,115,101,114, 80,114,101,102,  0, 83,112, 97, 99,101, 83,
-111,117,110,100,  0, 83, 99,114, 65,114,101, 97,  0, 98, 83,111,117,110,100,  0,117,105, 70,111,110,116,  0,117,105, 70,111,110,
-116, 83,116,121,108,101,  0,117,105, 83,116,121,108,101,  0,117,105, 87,105,100,103,101,116, 67,111,108,111,114,115,  0,117,105,
- 87,105,100,103,101,116, 83,116, 97,116,101, 67,111,108,111,114,115,  0, 84,104,101,109,101, 85, 73,  0, 84,104,101,109,101, 83,
-112, 97, 99,101,  0, 84,104,101,109,101, 87,105,114,101, 67,111,108,111,114,  0, 98, 84,104,101,109,101,  0, 98, 65,100,100,111,
-110,  0, 83,111,108,105,100, 76,105,103,104,116,  0, 85,115,101,114, 68,101,102,  0, 98, 83, 99,114,101,101,110,  0, 83, 99,114,
- 86,101,114,116,  0, 83, 99,114, 69,100,103,101,  0, 80, 97,110,101,108,  0, 80, 97,110,101,108, 84,121,112,101,  0,117,105, 76,
- 97,121,111,117,116,  0, 83,112, 97, 99,101, 84,121,112,101,  0, 65, 82,101,103,105,111,110,  0, 65, 82,101,103,105,111,110, 84,
-121,112,101,  0, 70,105,108,101, 71,108,111, 98, 97,108,  0, 83,116,114,105,112, 69,108,101,109,  0, 83,116,114,105,112, 67,114,
-111,112,  0, 83,116,114,105,112, 84,114, 97,110,115,102,111,114,109,  0, 83,116,114,105,112, 67,111,108,111,114, 66, 97,108, 97,
-110, 99,101,  0, 83,116,114,105,112, 80,114,111,120,121,  0, 83,116,114,105,112,  0, 80,108,117,103,105,110, 83,101,113,  0, 83,
-101,113,117,101,110, 99,101,  0, 77,101,116, 97, 83,116, 97, 99,107,  0, 87,105,112,101, 86, 97,114,115,  0, 71,108,111,119, 86,
- 97,114,115,  0, 84,114, 97,110,115,102,111,114,109, 86, 97,114,115,  0, 83,111,108,105,100, 67,111,108,111,114, 86, 97,114,115,
-  0, 83,112,101,101,100, 67,111,110,116,114,111,108, 86, 97,114,115,  0, 69,102,102,101, 99,116,  0, 66,117,105,108,100, 69,102,
-102,  0, 80, 97,114,116, 69,102,102,  0, 80, 97,114,116,105, 99,108,101,  0, 87, 97,118,101, 69,102,102,  0, 98, 80,114,111,112,
-101,114,116,121,  0, 98, 78,101, 97,114, 83,101,110,115,111,114,  0, 98, 77,111,117,115,101, 83,101,110,115,111,114,  0, 98, 84,
-111,117, 99,104, 83,101,110,115,111,114,  0, 98, 75,101,121, 98,111, 97,114,100, 83,101,110,115,111,114,  0, 98, 80,114,111,112,
-101,114,116,121, 83,101,110,115,111,114,  0, 98, 65, 99,116,117, 97,116,111,114, 83,101,110,115,111,114,  0, 98, 68,101,108, 97,
-121, 83,101,110,115,111,114,  0, 98, 67,111,108,108,105,115,105,111,110, 83,101,110,115,111,114,  0, 98, 82, 97,100, 97,114, 83,
-101,110,115,111,114,  0, 98, 82, 97,110,100,111,109, 83,101,110,115,111,114,  0, 98, 82, 97,121, 83,101,110,115,111,114,  0, 98,
- 65,114,109, 97,116,117,114,101, 83,101,110,115,111,114,  0, 98, 77,101,115,115, 97,103,101, 83,101,110,115,111,114,  0, 98, 83,
-101,110,115,111,114,  0, 98, 67,111,110,116,114,111,108,108,101,114,  0, 98, 74,111,121,115,116,105, 99,107, 83,101,110,115,111,
-114,  0, 98, 69,120,112,114,101,115,115,105,111,110, 67,111,110,116,  0, 98, 80,121,116,104,111,110, 67,111,110,116,  0, 98, 65,
- 99,116,117, 97,116,111,114,  0, 98, 65,100,100, 79, 98,106,101, 99,116, 65, 99,116,117, 97,116,111,114,  0, 98, 65, 99,116,105,
-111,110, 65, 99,116,117, 97,116,111,114,  0, 83,111,117,110,100, 51, 68,  0, 98, 83,111,117,110,100, 65, 99,116,117, 97,116,111,
-114,  0, 98, 69,100,105,116, 79, 98,106,101, 99,116, 65, 99,116,117, 97,116,111,114,  0, 98, 83, 99,101,110,101, 65, 99,116,117,
- 97,116,111,114,  0, 98, 80,114,111,112,101,114,116,121, 65, 99,116,117, 97,116,111,114,  0, 98, 79, 98,106,101, 99,116, 65, 99,
-116,117, 97,116,111,114,  0, 98, 73,112,111, 65, 99,116,117, 97,116,111,114,  0, 98, 67, 97,109,101,114, 97, 65, 99,116,117, 97,
-116,111,114,  0, 98, 67,111,110,115,116,114, 97,105,110,116, 65, 99,116,117, 97,116,111,114,  0, 98, 71,114,111,117,112, 65, 99,
-116,117, 97,116,111,114,  0, 98, 82, 97,110,100,111,109, 65, 99,116,117, 97,116,111,114,  0, 98, 77,101,115,115, 97,103,101, 65,
- 99,116,117, 97,116,111,114,  0, 98, 71, 97,109,101, 65, 99,116,117, 97,116,111,114,  0, 98, 86,105,115,105, 98,105,108,105,116,
-121, 65, 99,116,117, 97,116,111,114,  0, 98, 84,119,111, 68, 70,105,108,116,101,114, 65, 99,116,117, 97,116,111,114,  0, 98, 80,
- 97,114,101,110,116, 65, 99,116,117, 97,116,111,114,  0, 98, 83,116, 97,116,101, 65, 99,116,117, 97,116,111,114,  0, 98, 65,114,
-109, 97,116,117,114,101, 65, 99,116,117, 97,116,111,114,  0, 71,114,111,117,112, 79, 98,106,101, 99,116,  0, 66,111,110,101,  0,
- 98, 65,114,109, 97,116,117,114,101,  0, 98, 77,111,116,105,111,110, 80, 97,116,104, 86,101,114,116,  0, 98, 80,111,115,101, 67,
-104, 97,110,110,101,108,  0, 98, 73, 75, 80, 97,114, 97,109,  0, 98, 73,116, 97,115, 99,  0, 98, 65, 99,116,105,111,110, 71,114,
-111,117,112,  0, 83,112, 97, 99,101, 65, 99,116,105,111,110,  0, 98, 65, 99,116,105,111,110, 67,104, 97,110,110,101,108,  0, 98,
- 67,111,110,115,116,114, 97,105,110,116, 67,104, 97,110,110,101,108,  0, 98, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 67,
-111,110,115,116,114, 97,105,110,116, 84, 97,114,103,101,116,  0, 98, 80,121,116,104,111,110, 67,111,110,115,116,114, 97,105,110,
-116,  0, 98, 75,105,110,101,109, 97,116,105, 99, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 83,112,108,105,110,101, 73, 75,
- 67,111,110,115,116,114, 97,105,110,116,  0, 98, 84,114, 97, 99,107, 84,111, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 82,
-111,116, 97,116,101, 76,105,107,101, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 76,111, 99, 97,116,101, 76,105,107,101, 67,
-111,110,115,116,114, 97,105,110,116,  0, 98, 83,105,122,101, 76,105,107,101, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 83,
- 97,109,101, 86,111,108,117,109,101, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 84,114, 97,110,115, 76,105,107,101, 67,111,
-110,115,116,114, 97,105,110,116,  0, 98, 77,105,110, 77, 97,120, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 65, 99,116,105,
-111,110, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 76,111, 99,107, 84,114, 97, 99,107, 67,111,110,115,116,114, 97,105,110,
-116,  0, 98, 68, 97,109,112, 84,114, 97, 99,107, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 70,111,108,108,111,119, 80, 97,
-116,104, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 83,116,114,101,116, 99,104, 84,111, 67,111,110,115,116,114, 97,105,110,
-116,  0, 98, 82,105,103,105,100, 66,111,100,121, 74,111,105,110,116, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 67,108, 97,
-109,112, 84,111, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 67,104,105,108,100, 79,102, 67,111,110,115,116,114, 97,105,110,
-116,  0, 98, 84,114, 97,110,115,102,111,114,109, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 80,105,118,111,116, 67,111,110,
-115,116,114, 97,105,110,116,  0, 98, 76,111, 99, 76,105,109,105,116, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 82,111,116,
- 76,105,109,105,116, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 83,105,122,101, 76,105,109,105,116, 67,111,110,115,116,114,
- 97,105,110,116,  0, 98, 68,105,115,116, 76,105,109,105,116, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 83,104,114,105,110,
-107,119,114, 97,112, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 65, 99,116,105,111,110, 77,111,100,105,102,105,101,114,  0,
- 98, 65, 99,116,105,111,110, 83,116,114,105,112,  0, 98, 78,111,100,101, 83,116, 97, 99,107,  0, 98, 78,111,100,101, 83,111, 99,
-107,101,116,  0, 98, 78,111,100,101, 76,105,110,107,  0, 98, 78,111,100,101, 80,114,101,118,105,101,119,  0, 98, 78,111,100,101,
-  0,117,105, 66,108,111, 99,107,  0, 98, 78,111,100,101, 84,121,112,101,  0, 78,111,100,101, 73,109, 97,103,101, 65,110,105,109,
-  0, 78,111,100,101, 66,108,117,114, 68, 97,116, 97,  0, 78,111,100,101, 68, 66,108,117,114, 68, 97,116, 97,  0, 78,111,100,101,
- 66,105,108, 97,116,101,114, 97,108, 66,108,117,114, 68, 97,116, 97,  0, 78,111,100,101, 72,117,101, 83, 97,116,  0, 78,111,100,
-101, 73,109, 97,103,101, 70,105,108,101,  0, 78,111,100,101, 67,104,114,111,109, 97,  0, 78,111,100,101, 84,119,111, 88, 89,115,
-  0, 78,111,100,101, 84,119,111, 70,108,111, 97,116,115,  0, 78,111,100,101, 71,101,111,109,101,116,114,121,  0, 78,111,100,101,
- 86,101,114,116,101,120, 67,111,108,  0, 78,111,100,101, 68,101,102,111, 99,117,115,  0, 78,111,100,101, 83, 99,114,105,112,116,
- 68,105, 99,116,  0, 78,111,100,101, 71,108, 97,114,101,  0, 78,111,100,101, 84,111,110,101,109, 97,112,  0, 78,111,100,101, 76,
-101,110,115, 68,105,115,116,  0, 78,111,100,101, 67,111,108,111,114, 66, 97,108, 97,110, 99,101,  0, 78,111,100,101, 67,111,108,
-111,114,115,112,105,108,108,  0, 84,101,120, 78,111,100,101, 79,117,116,112,117,116,  0, 67,117,114,118,101, 77, 97,112, 80,111,
-105,110,116,  0, 67,117,114,118,101, 77, 97,112,  0, 66,114,117,115,104, 67,108,111,110,101,  0, 67,117,115,116,111,109, 68, 97,
-116, 97, 76, 97,121,101,114,  0, 67,117,115,116,111,109, 68, 97,116, 97, 69,120,116,101,114,110, 97,108,  0, 72, 97,105,114, 75,
-101,121,  0, 80, 97,114,116,105, 99,108,101, 75,101,121,  0, 66,111,105,100, 80, 97,114,116,105, 99,108,101,  0, 66,111,105,100,
- 68, 97,116, 97,  0, 80, 97,114,116,105, 99,108,101, 83,112,114,105,110,103,  0, 67,104,105,108,100, 80, 97,114,116,105, 99,108,
-101,  0, 80, 97,114,116,105, 99,108,101, 84, 97,114,103,101,116,  0, 80, 97,114,116,105, 99,108,101, 68,117,112,108,105, 87,101,
-105,103,104,116,  0, 80, 97,114,116,105, 99,108,101, 68, 97,116, 97,  0, 83, 80, 72, 70,108,117,105,100, 83,101,116,116,105,110,
-103,115,  0, 80, 97,114,116,105, 99,108,101, 83,101,116,116,105,110,103,115,  0, 66,111,105,100, 83,101,116,116,105,110,103,115,
-  0, 80, 97,114,116,105, 99,108,101, 67, 97, 99,104,101, 75,101,121,  0, 75, 68, 84,114,101,101,  0, 80, 97,114,116,105, 99,108,
-101, 68,114, 97,119, 68, 97,116, 97,  0, 76,105,110,107, 78,111,100,101,  0, 98, 71, 80, 68,115,112,111,105,110,116,  0, 98, 71,
- 80, 68,115,116,114,111,107,101,  0, 98, 71, 80, 68,102,114, 97,109,101,  0, 98, 71, 80, 68,108, 97,121,101,114,  0, 82,101,112,
-111,114,116, 76,105,115,116,  0,119,109, 87,105,110,100,111,119, 77, 97,110, 97,103,101,114,  0,119,109, 87,105,110,100,111,119,
-  0,119,109, 75,101,121, 67,111,110,102,105,103,  0,119,109, 69,118,101,110,116,  0,119,109, 83,117, 98, 87,105,110,100,111,119,
-  0,119,109, 71,101,115,116,117,114,101,  0,119,109, 75,101,121, 77, 97,112, 73,116,101,109,  0, 80,111,105,110,116,101,114, 82,
- 78, 65,  0,119,109, 75,101,121, 77, 97,112,  0,119,109, 79,112,101,114, 97,116,111,114, 84,121,112,101,  0, 70, 77,111,100,105,
-102,105,101,114,  0, 70, 77,111,100, 95, 71,101,110,101,114, 97,116,111,114,  0, 70, 77,111,100, 95, 70,117,110, 99,116,105,111,
-110, 71,101,110,101,114, 97,116,111,114,  0, 70, 67, 77, 95, 69,110,118,101,108,111,112,101, 68, 97,116, 97,  0, 70, 77,111,100,
- 95, 69,110,118,101,108,111,112,101,  0, 70, 77,111,100, 95, 67,121, 99,108,101,115,  0, 70, 77,111,100, 95, 80,121,116,104,111,
-110,  0, 70, 77,111,100, 95, 76,105,109,105,116,115,  0, 70, 77,111,100, 95, 78,111,105,115,101,  0, 70, 77,111,100, 95, 83,116,
-101,112,112,101,100,  0, 68,114,105,118,101,114, 84, 97,114,103,101,116,  0, 68,114,105,118,101,114, 86, 97,114,  0, 67,104, 97,
-110,110,101,108, 68,114,105,118,101,114,  0, 70, 80,111,105,110,116,  0, 70, 67,117,114,118,101,  0, 65,110,105,109, 77, 97,112,
- 80, 97,105,114,  0, 65,110,105,109, 77, 97,112,112,101,114,  0, 78,108, 97, 83,116,114,105,112,  0, 78,108, 97, 84,114, 97, 99,
-107,  0, 75, 83, 95, 80, 97,116,104,  0, 75,101,121,105,110,103, 83,101,116,  0, 65,110,105,109, 79,118,101,114,114,105,100,101,
-  0, 73,100, 65,100,116, 84,101,109,112,108, 97,116,101,  0, 66,111,105,100, 82,117,108,101,  0, 66,111,105,100, 82,117,108,101,
- 71,111, 97,108, 65,118,111,105,100,  0, 66,111,105,100, 82,117,108,101, 65,118,111,105,100, 67,111,108,108,105,115,105,111,110,
-  0, 66,111,105,100, 82,117,108,101, 70,111,108,108,111,119, 76,101, 97,100,101,114,  0, 66,111,105,100, 82,117,108,101, 65,118,
-101,114, 97,103,101, 83,112,101,101,100,  0, 66,111,105,100, 82,117,108,101, 70,105,103,104,116,  0, 66,111,105,100, 83,116, 97,
-116,101,  0, 70, 76, 85, 73, 68, 95, 51, 68,  0, 87, 84, 85, 82, 66, 85, 76, 69, 78, 67, 69,  0, 84, 76, 69, 78,  1,  0,  1,  0,
-  2,  0,  2,  0,  4,  0,  4,  0,  4,  0,  4,  0,  8,  0,  0,  0, 16,  0, 24,  0, 16,  0,  4,  0,  8,  0, 16,  0, 16,  0, 32,  0,
- 96,  0, 72,  0, 72,  2,  0,  0, 40,  0,144,  0, 32,  5,112,  0, 36,  0, 56,  0,112,  0,128,  0,168,  0, 96,  0, 40,  0, 48,  0,
-176,  0, 16,  0,136,  0, 40,  0,184,  5,240,  1,  0,  0,  0,  0,  0,  0, 24,  1,112,  1,120,  1, 24,  0,  8,  3,200,  0,  0,  0,
-104,  0, 64,  1, 40,  1,  8,  1,136,  0,216,  1, 88,  0, 32,  3,104,  0, 88,  1,  0,  0,128,  0,104,  0,208,  0, 80,  0,  8,  0,
- 16,  0, 32,  0,  0,  0,216,  1,  0,  0,  0,  0,  0,  0,152,  1, 20,  0, 48,  0, 64,  0, 20,  0, 12,  0, 16,  0,  4,  0,  8,  0,
-  8,  0,  0,  0, 40,  0,128,  0, 48,  0,  8,  0, 16,  0,  8,  0,  8,  0,  4,  0,  4,  0,  0,  1, 32,  0, 16,  0, 16,  0, 64,  0,
- 24,  0, 12,  0, 64,  0, 80,  0,136,  0,104,  0,120,  0,128,  0, 96,  0,128,  0,160,  0, 96,  0, 88,  0,136,  0, 88,  0,112,  0,
- 16,  1, 56,  0,192,  0,184,  0,232,  0, 88,  0,120,  0,136,  0,224,  0,136,  0,248,  0, 80,  0,136,  0,  0,  0,152,  0, 48,  0,
- 16,  2,160,  0,  0,  0,120,  0,  0,  0,  0,  0, 96,  0,  8,  0,  8,  0, 48,  1,112,  0, 16,  2,104,  0,128,  0, 88,  0, 96,  0,
-200,  1,144,  0,136,  0, 80,  0,144,  0,112,  0,208,  0, 16,  0, 16,  1, 48,  0,  0,  0,152,  0,184,  0,104,  0, 48,  0, 24,  0,
-120,  0,152,  0,120,  1,224,  0,192,  0,  0,  0, 72,  0, 32,  0,176,  0,  0,  0, 16,  0,  0,  0,  0,  0,  0,  0, 12,  0,224,  1,
- 40,  0,184,  0,152,  0, 64,  0, 64,  0, 24,  0, 88,  0,168,  3, 64,  0, 24,  0, 16,  0,104,  0, 96,  0, 24,  0,248,  2, 48,  0,
- 16,  0,168,  0, 88,  0, 96,  0, 56,  0,192,  1, 32,  0,  8,  0, 24,  0, 80,  2,  0,  0,  0,  0, 88,  0, 96,  3,  0,  0,  0,  0,
-  0,  0,  0,  0, 56,  1, 56,  0,144,  0, 64,  0,240,  0,104,  0,248,  0,240,  0, 96,  2,104,  0,  0,  0,168,  0,  0,  0, 24,  1,
- 16,  0, 16,  0, 40, 33,128, 16, 24, 16,216,  0,160,  2,120,  2, 64,  0, 24,  0,216,  0, 48,  1, 72,  0,200,  2, 40,  0,136,  1,
-104,  0,216,  0,160,  0,136,  1, 24,  1, 32,  0,232,  0, 32,  0, 32,  0,112,  2,120,  1, 16,  0, 88, 30, 80,  0, 56,  0,184, 13,
-216,  0, 32,  0, 40,  0, 88,  1,  0,  0,  0,  0,  0,  0, 40,  1,  0,  0, 32,  1, 88,  0, 16,  0,  8,  0, 44,  0,  0,  1,240,  0,
-200,  1, 32,  1, 32,  0, 12,  0, 24,  0, 52,  0, 16,  0, 24,  0, 24,  0, 32,  0, 72,  1,  0,  0, 64,  0, 64,  0, 48,  0,  8,  0,
- 48,  0, 72,  0,104,  0, 40,  0,  8,  0, 72,  0, 44,  0, 40,  0,108,  0, 72,  0, 72,  0, 96,  0,104,  0, 60,  0,128,  0, 80,  0,
- 80,  0, 16,  0, 96,  0, 32,  0, 72,  0, 88,  0, 24,  0, 80,  0,112,  0, 84,  0, 32,  0, 96,  0, 56,  0, 56,  0,112,  0,140,  0,
-  4,  0, 24,  0, 16,  0,  8,  0, 88,  0, 40,  0, 40,  1,200,  0, 16,  0,248,  1,  4,  0, 40,  0,120,  0, 64,  1, 88,  0, 56,  0,
- 88,  0,128,  0, 80,  0,120,  0, 24,  0, 56,  0, 48,  0, 48,  0, 48,  0,  8,  0, 40,  0, 72,  0, 72,  0, 48,  0, 48,  0, 24,  0,
- 56,  0,104,  0, 16,  0,112,  0, 96,  0, 56,  0, 28,  0, 28,  0, 28,  0, 56,  0, 24,  0, 72,  0,168,  0, 40,  0,152,  0, 56,  0,
- 16,  0,  8,  1,  0,  0,  0,  0, 16,  0, 40,  0, 28,  0, 12,  0, 12,  0, 16,  1, 44,  0, 24,  0,  8,  0, 64,  0, 32,  0, 24,  0,
- 16,  0, 24,  0, 32,  0,  8,  0, 96,  0, 20,  0, 32,  0, 12,  0, 56,  0, 24,  0, 72,  0,240,  0, 24,  0, 56,  0, 56,  0, 20,  0,
- 16,  0, 64,  0, 40,  0, 32,  0,192,  0, 60,  0,208,  2,104,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16,  0, 32,  0, 40,  0,192,  0,
- 40,  0, 24,  1,224,  0,168,  0,  0,  0,  0,  0,  0,  0,120,  0,  0,  0,120,  0,  0,  0,104,  0, 24,  0, 24,  0, 16,  0, 24,  0,
-  8,  0, 16,  0, 24,  0, 20,  0, 20,  0, 56,  0, 24,  2, 40,  1, 16,  0,104,  0,  0,  1, 40,  0,200,  0,104,  0,112,  0,168,  0,
- 32,  0, 80,  0, 56,  0, 80,  0, 64,  0,104,  0, 72,  0, 64,  0,128,  0,  0,  0,  0,  0,  0,  0, 83, 84, 82, 67,148,  1,  0,  0,
- 10,  0,  2,  0, 10,  0,  0,  0, 10,  0,  1,  0, 11,  0,  3,  0, 11,  0,  0,  0, 11,  0,  1,  0,  9,  0,  2,  0, 12,  0,  2,  0,
-  9,  0,  3,  0,  9,  0,  4,  0, 13,  0,  2,  0,  2,  0,  5,  0,  2,  0,  6,  0, 14,  0,  2,  0,  7,  0,  5,  0,  7,  0,  6,  0,
- 15,  0,  4,  0,  4,  0,  7,  0,  4,  0,  8,  0,  4,  0,  9,  0,  4,  0, 10,  0, 16,  0,  4,  0,  7,  0,  7,  0,  7,  0,  8,  0,
-  7,  0,  9,  0,  7,  0, 10,  0, 17,  0,  4,  0,  9,  0, 11,  0, 12,  0, 12,  0,  4,  0, 13,  0,  4,  0, 14,  0, 18,  0, 10,  0,
- 18,  0,  0,  0, 18,  0,  1,  0,  0,  0, 15,  0,  0,  0, 16,  0,  2,  0, 17,  0,  0,  0, 18,  0,  4,  0, 19,  0, 17,  0, 20,  0,
-  4,  0, 21,  0,  4,  0, 22,  0, 19,  0,  9,  0,  9,  0,  0,  0,  9,  0,  1,  0, 19,  0, 23,  0, 20,  0, 24,  0,  0,  0, 25,  0,
-  2,  0, 26,  0,  2,  0, 17,  0,  4,  0, 27,  0, 18,  0, 28,  0, 20,  0,  8,  0, 19,  0, 29,  0, 19,  0, 30,  0, 21,  0, 31,  0,
-  0,  0, 32,  0,  0,  0, 33,  0,  4,  0, 34,  0,  4,  0, 35,  0, 20,  0, 36,  0, 22,  0,  5,  0,  4,  0, 37,  0,  4,  0, 38,  0,
-  2,  0, 39,  0,  2,  0, 40,  0,  4,  0, 41,  0, 23,  0,  6,  0, 24,  0, 42,  0,  2,  0, 43,  0,  2,  0, 44,  0,  2,  0, 15,  0,
-  2,  0, 17,  0,  0,  0, 45,  0, 25,  0, 21,  0, 25,  0,  0,  0, 25,  0,  1,  0, 26,  0, 46,  0, 27,  0, 47,  0, 16,  0, 48,  0,
- 16,  0, 49,  0,  2,  0, 43,  0,  2,  0, 44,  0,  2,  0, 50,  0,  2,  0, 51,  0,  2,  0, 52,  0,  2,  0, 53,  0,  2,  0, 17,  0,
-  2,  0, 54,  0,  7,  0,  9,  0,  7,  0, 10,  0,  4,  0, 55,  0,  7,  0, 56,  0,  7,  0, 57,  0,  7,  0, 58,  0, 23,  0, 59,  0,
- 28,  0,  7,  0, 19,  0, 29,  0, 12,  0, 60,  0, 16,  0, 61,  0,  2,  0, 43,  0,  2,  0, 62,  0,  2,  0, 63,  0,  2,  0, 35,  0,
- 29,  0, 16,  0, 29,  0,  0,  0, 29,  0,  1,  0,  7,  0, 64,  0,  7,  0, 58,  0,  2,  0, 15,  0,  2,  0, 44,  0,  2,  0, 65,  0,
-  2,  0, 17,  0,  4,  0, 66,  0,  4,  0, 67,  0,  9,  0,  2,  0,  7,  0, 68,  0,  0,  0, 18,  0,  0,  0, 69,  0,  7,  0, 70,  0,
-  7,  0, 71,  0, 30,  0, 13,  0, 19,  0, 29,  0, 31,  0, 72,  0, 29,  0, 73,  0,  0,  0, 74,  0,  4,  0, 75,  0,  7,  0, 58,  0,
- 12,  0, 76,  0, 28,  0, 77,  0, 19,  0, 78,  0,  2,  0, 15,  0,  2,  0, 79,  0,  2,  0, 80,  0,  2,  0, 17,  0, 32,  0,  6,  0,
- 32,  0,  0,  0, 32,  0,  1,  0,  0,  0, 81,  0,  0,  0, 82,  0,  4,  0, 21,  0,  4,  0, 83,  0, 33,  0, 10,  0, 33,  0,  0,  0,
- 33,  0,  1,  0,  4,  0, 84,  0,  4,  0, 85,  0,  4,  0, 86,  0,  4,  0, 87,  0,  4,  0, 12,  0,  4,  0, 88,  0,  0,  0, 89,  0,
-  0,  0, 90,  0, 34,  0, 15,  0, 19,  0, 29,  0,  0,  0, 91,  0,  4,  0, 88,  0,  4,  0, 92,  0, 12,  0, 93,  0, 32,  0, 94,  0,
- 32,  0, 95,  0,  4,  0, 96,  0,  4,  0, 97,  0, 12,  0, 98,  0,  0,  0, 99,  0,  4,  0,100,  0,  4,  0,101,  0,  9,  0,102,  0,
-  8,  0,103,  0, 35,  0,  3,  0,  4,  0,104,  0,  4,  0,105,  0,  9,  0,  2,  0, 36,  0, 16,  0, 19,  0, 29,  0, 31,  0, 72,  0,
-  0,  0, 15,  0,  0,  0,106,  0,  2,  0, 17,  0,  7,  0,107,  0,  7,  0,108,  0,  7,  0,109,  0,  7,  0,110,  0,  7,  0,111,  0,
-  7,  0,112,  0,  7,  0,113,  0,  7,  0,114,  0,  7,  0,115,  0, 28,  0, 77,  0, 24,  0,116,  0, 37,  0, 14,  0, 38,  0,117,  0,
-  4,  0,118,  0,  4,  0,119,  0,  4,  0,120,  0,  4,  0,121,  0,  0,  0,122,  0,  0,  0,123,  0,  0,  0,124,  0,  0,  0, 35,  0,
-  2,  0,125,  0,  2,  0,126,  0,  2,  0,127,  0,  2,  0, 17,  0,  4,  0, 67,  0, 39,  0, 32,  0, 19,  0, 29,  0,  0,  0, 32,  0,
- 12,  0,128,  0, 40,  0,129,  0, 41,  0,130,  0, 42,  0,131,  0, 42,  0,132,  0,  2,  0,133,  0,  2,  0,134,  0,  2,  0,124,  0,
-  2,  0, 17,  0,  2,  0,135,  0,  2,  0, 15,  0,  4,  0,136,  0,  2,  0,137,  0,  2,  0,138,  0,  2,  0,139,  0,  2,  0,140,  0,
-  2,  0,141,  0,  2,  0,142,  0,  4,  0,143,  0,  4,  0,144,  0, 35,  0,145,  0, 22,  0,146,  0,  7,  0,147,  0,  4,  0,148,  0,
-  2,  0,149,  0,  2,  0,150,  0,  2,  0,151,  0,  2,  0,152,  0,  7,  0,153,  0,  7,  0,154,  0, 43,  0, 65,  0,  2,  0,155,  0,
-  2,  0,156,  0,  2,  0,157,  0,  2,  0,158,  0, 24,  0,159,  0, 44,  0,160,  0,  0,  0,161,  0,  0,  0,162,  0,  0,  0,163,  0,
-  0,  0,164,  0,  0,  0,165,  0,  7,  0,166,  0,  7,  0,167,  0,  7,  0,168,  0,  2,  0,169,  0,  2,  0,170,  0,  2,  0,171,  0,
-  2,  0,172,  0,  2,  0,173,  0,  2,  0,174,  0,  0,  0,175,  0,  0,  0,176,  0,  7,  0,177,  0,  7,  0,178,  0,  7,  0,179,  0,
-  7,  0,180,  0,  7,  0,181,  0,  7,  0, 54,  0,  7,  0,182,  0,  7,  0,183,  0,  7,  0,184,  0,  7,  0,185,  0,  7,  0,186,  0,
-  7,  0,187,  0,  7,  0,188,  0,  7,  0,189,  0,  7,  0,190,  0,  7,  0,191,  0,  7,  0,192,  0,  7,  0,193,  0,  7,  0,194,  0,
+114,101,119, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 79, 99,101, 97,110, 77,111,100,105,102,105,101,114, 68, 97,116,
+ 97,  0, 79, 99,101, 97,110,  0, 79, 99,101, 97,110, 67, 97, 99,104,101,  0, 87, 97,114,112, 77,111,100,105,102,105,101,114, 68,
+ 97,116, 97,  0, 87,101,105,103,104,116, 86, 71, 69,100,105,116, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 87,101,105,
+103,104,116, 86, 71, 77,105,120, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 87,101,105,103,104,116, 86, 71, 80,114,111,
+120,105,109,105,116,121, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 68,121,110, 97,109,105, 99, 80, 97,105,110,116, 77,
+111,100,105,102,105,101,114, 68, 97,116, 97,  0, 68,121,110, 97,109,105, 99, 80, 97,105,110,116, 67, 97,110,118, 97,115, 83,101,
+116,116,105,110,103,115,  0, 68,121,110, 97,109,105, 99, 80, 97,105,110,116, 66,114,117,115,104, 83,101,116,116,105,110,103,115,
+  0, 82,101,109,101,115,104, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 69,100,105,116, 76, 97,116,116,  0, 76, 97,116,
+116,105, 99,101,  0, 98, 68,101,102,111,114,109, 71,114,111,117,112,  0, 83, 99,117,108,112,116, 83,101,115,115,105,111,110,  0,
+ 98, 65, 99,116,105,111,110,  0, 98, 80,111,115,101,  0, 98, 71, 80,100, 97,116, 97,  0, 98, 65,110,105,109, 86,105,122, 83,101,
+116,116,105,110,103,115,  0, 98, 77,111,116,105,111,110, 80, 97,116,104,  0, 66,117,108,108,101,116, 83,111,102,116, 66,111,100,
+121,  0, 80, 97,114,116, 68,101,102,108,101, 99,116,  0, 83,111,102,116, 66,111,100,121,  0, 79, 98, 72,111,111,107,  0, 68,117,
+112,108,105, 79, 98,106,101, 99,116,  0, 82, 78, 71,  0, 69,102,102,101, 99,116,111,114, 87,101,105,103,104,116,115,  0, 80, 84,
+ 67, 97, 99,104,101, 69,120,116,114, 97,  0, 80, 84, 67, 97, 99,104,101, 77,101,109,  0, 80, 84, 67, 97, 99,104,101, 69,100,105,
+116,  0, 83, 66, 86,101,114,116,101,120,  0, 66,111,100,121, 80,111,105,110,116,  0, 66,111,100,121, 83,112,114,105,110,103,  0,
+ 83, 66, 83, 99,114, 97,116, 99,104,  0, 70,108,117,105,100, 86,101,114,116,101,120, 86,101,108,111, 99,105,116,121,  0, 87,111,
+114,108,100,  0, 66, 97,115,101,  0, 65,118,105, 67,111,100,101, 99, 68, 97,116, 97,  0, 81,117,105, 99,107,116,105,109,101, 67,
+111,100,101, 99, 68, 97,116, 97,  0, 81,117,105, 99,107,116,105,109,101, 67,111,100,101, 99, 83,101,116,116,105,110,103,115,  0,
+ 70, 70, 77,112,101,103, 67,111,100,101, 99, 68, 97,116, 97,  0, 65,117,100,105,111, 68, 97,116, 97,  0, 83, 99,101,110,101, 82,
+101,110,100,101,114, 76, 97,121,101,114,  0, 73,109, 97,103,101, 70,111,114,109, 97,116, 68, 97,116, 97,  0, 82,101,110,100,101,
+114, 68, 97,116, 97,  0, 82,101,110,100,101,114, 80,114,111,102,105,108,101,  0, 71, 97,109,101, 68,111,109,101,  0, 71, 97,109,
+101, 70,114, 97,109,105,110,103,  0, 82,101, 99, 97,115,116, 68, 97,116, 97,  0, 71, 97,109,101, 68, 97,116, 97,  0, 84,105,109,
+101, 77, 97,114,107,101,114,  0, 80, 97,105,110,116,  0, 66,114,117,115,104,  0, 73,109, 97,103,101, 80, 97,105,110,116, 83,101,
+116,116,105,110,103,115,  0, 80, 97,114,116,105, 99,108,101, 66,114,117,115,104, 68, 97,116, 97,  0, 80, 97,114,116,105, 99,108,
+101, 69,100,105,116, 83,101,116,116,105,110,103,115,  0, 83, 99,117,108,112,116,  0, 85,118, 83, 99,117,108,112,116,  0, 86, 80,
+ 97,105,110,116,  0, 84,114, 97,110,115,102,111,114,109, 79,114,105,101,110,116, 97,116,105,111,110,  0, 85,110,105,102,105,101,
+100, 80, 97,105,110,116, 83,101,116,116,105,110,103,115,  0, 84,111,111,108, 83,101,116,116,105,110,103,115,  0, 98, 83,116, 97,
+116,115,  0, 85,110,105,116, 83,101,116,116,105,110,103,115,  0, 80,104,121,115,105, 99,115, 83,101,116,116,105,110,103,115,  0,
+ 69,100,105,116,105,110,103,  0, 83, 99,101,110,101, 83,116, 97,116,115,  0, 68, 97,103, 70,111,114,101,115,116,  0, 77,111,118,
+105,101, 67,108,105,112,  0, 66, 71,112,105, 99,  0, 77,111,118,105,101, 67,108,105,112, 85,115,101,114,  0, 82,101,103,105,111,
+110, 86,105,101,119, 51, 68,  0, 82,101,110,100,101,114, 73,110,102,111,  0, 82,101,110,100,101,114, 69,110,103,105,110,101,  0,
+ 86,105,101,119, 68,101,112,116,104,115,  0, 83,109,111,111,116,104, 86,105,101,119, 83,116,111,114,101,  0,119,109, 84,105,109,
+101,114,  0, 86,105,101,119, 51, 68,  0, 83,112, 97, 99,101, 76,105,110,107,  0, 86,105,101,119, 50, 68,  0, 83,112, 97, 99,101,
+ 73,110,102,111,  0, 83,112, 97, 99,101, 73,112,111,  0, 98, 68,111,112,101, 83,104,101,101,116,  0, 83,112, 97, 99,101, 66,117,
+116,115,  0, 83,112, 97, 99,101, 83,101,113,  0, 70,105,108,101, 83,101,108,101, 99,116, 80, 97,114, 97,109,115,  0, 83,112, 97,
+ 99,101, 70,105,108,101,  0, 70,105,108,101, 76,105,115,116,  0,119,109, 79,112,101,114, 97,116,111,114,  0, 70,105,108,101, 76,
+ 97,121,111,117,116,  0, 83,112, 97, 99,101, 79,111,112,115,  0, 84,114,101,101, 83,116,111,114,101,  0, 84,114,101,101, 83,116,
+111,114,101, 69,108,101,109,  0, 83,112, 97, 99,101, 73,109, 97,103,101,  0, 83, 99,111,112,101,115,  0, 72,105,115,116,111,103,
+114, 97,109,  0, 83,112, 97, 99,101, 78,108, 97,  0, 83,112, 97, 99,101, 84,101,120,116,  0, 83, 99,114,105,112,116,  0, 83,112,
+ 97, 99,101, 83, 99,114,105,112,116,  0, 83,112, 97, 99,101, 84,105,109,101, 67, 97, 99,104,101,  0, 83,112, 97, 99,101, 84,105,
+109,101,  0, 83,112, 97, 99,101, 78,111,100,101,  0, 83,112, 97, 99,101, 76,111,103,105, 99,  0, 67,111,110,115,111,108,101, 76,
+105,110,101,  0, 83,112, 97, 99,101, 67,111,110,115,111,108,101,  0, 83,112, 97, 99,101, 85,115,101,114, 80,114,101,102,  0, 83,
+112, 97, 99,101, 67,108,105,112,  0, 77,111,118,105,101, 67,108,105,112, 83, 99,111,112,101,115,  0,117,105, 70,111,110,116,  0,
+117,105, 70,111,110,116, 83,116,121,108,101,  0,117,105, 83,116,121,108,101,  0,117,105, 87,105,100,103,101,116, 67,111,108,111,
+114,115,  0,117,105, 87,105,100,103,101,116, 83,116, 97,116,101, 67,111,108,111,114,115,  0,117,105, 80, 97,110,101,108, 67,111,
+108,111,114,115,  0, 84,104,101,109,101, 85, 73,  0, 84,104,101,109,101, 83,112, 97, 99,101,  0, 84,104,101,109,101, 87,105,114,
+101, 67,111,108,111,114,  0, 98, 84,104,101,109,101,  0, 98, 65,100,100,111,110,  0, 83,111,108,105,100, 76,105,103,104,116,  0,
+ 85,115,101,114, 68,101,102,  0, 98, 83, 99,114,101,101,110,  0, 83, 99,114, 86,101,114,116,  0, 83, 99,114, 69,100,103,101,  0,
+ 80, 97,110,101,108,  0, 80, 97,110,101,108, 84,121,112,101,  0,117,105, 76, 97,121,111,117,116,  0, 83, 99,114, 65,114,101, 97,
+  0, 83,112, 97, 99,101, 84,121,112,101,  0, 65, 82,101,103,105,111,110,  0, 65, 82,101,103,105,111,110, 84,121,112,101,  0, 70,
+105,108,101, 71,108,111, 98, 97,108,  0, 83,116,114,105,112, 69,108,101,109,  0, 83,116,114,105,112, 67,114,111,112,  0, 83,116,
+114,105,112, 84,114, 97,110,115,102,111,114,109,  0, 83,116,114,105,112, 67,111,108,111,114, 66, 97,108, 97,110, 99,101,  0, 83,
+116,114,105,112, 80,114,111,120,121,  0, 83,116,114,105,112,  0, 80,108,117,103,105,110, 83,101,113,  0, 83,101,113,117,101,110,
+ 99,101,  0, 98, 83,111,117,110,100,  0, 77,101,116, 97, 83,116, 97, 99,107,  0, 87,105,112,101, 86, 97,114,115,  0, 71,108,111,
+119, 86, 97,114,115,  0, 84,114, 97,110,115,102,111,114,109, 86, 97,114,115,  0, 83,111,108,105,100, 67,111,108,111,114, 86, 97,
+114,115,  0, 83,112,101,101,100, 67,111,110,116,114,111,108, 86, 97,114,115,  0, 69,102,102,101, 99,116,  0, 66,117,105,108,100,
+ 69,102,102,  0, 80, 97,114,116, 69,102,102,  0, 80, 97,114,116,105, 99,108,101,  0, 87, 97,118,101, 69,102,102,  0, 98, 80,114,
+111,112,101,114,116,121,  0, 98, 78,101, 97,114, 83,101,110,115,111,114,  0, 98, 77,111,117,115,101, 83,101,110,115,111,114,  0,
+ 98, 84,111,117, 99,104, 83,101,110,115,111,114,  0, 98, 75,101,121, 98,111, 97,114,100, 83,101,110,115,111,114,  0, 98, 80,114,
+111,112,101,114,116,121, 83,101,110,115,111,114,  0, 98, 65, 99,116,117, 97,116,111,114, 83,101,110,115,111,114,  0, 98, 68,101,
+108, 97,121, 83,101,110,115,111,114,  0, 98, 67,111,108,108,105,115,105,111,110, 83,101,110,115,111,114,  0, 98, 82, 97,100, 97,
+114, 83,101,110,115,111,114,  0, 98, 82, 97,110,100,111,109, 83,101,110,115,111,114,  0, 98, 82, 97,121, 83,101,110,115,111,114,
+  0, 98, 65,114,109, 97,116,117,114,101, 83,101,110,115,111,114,  0, 98, 77,101,115,115, 97,103,101, 83,101,110,115,111,114,  0,
+ 98, 83,101,110,115,111,114,  0, 98, 67,111,110,116,114,111,108,108,101,114,  0, 98, 74,111,121,115,116,105, 99,107, 83,101,110,
+115,111,114,  0, 98, 69,120,112,114,101,115,115,105,111,110, 67,111,110,116,  0, 98, 80,121,116,104,111,110, 67,111,110,116,  0,
+ 98, 65, 99,116,117, 97,116,111,114,  0, 98, 65,100,100, 79, 98,106,101, 99,116, 65, 99,116,117, 97,116,111,114,  0, 98, 65, 99,
+116,105,111,110, 65, 99,116,117, 97,116,111,114,  0, 83,111,117,110,100, 51, 68,  0, 98, 83,111,117,110,100, 65, 99,116,117, 97,
+116,111,114,  0, 98, 69,100,105,116, 79, 98,106,101, 99,116, 65, 99,116,117, 97,116,111,114,  0, 98, 83, 99,101,110,101, 65, 99,
+116,117, 97,116,111,114,  0, 98, 80,114,111,112,101,114,116,121, 65, 99,116,117, 97,116,111,114,  0, 98, 79, 98,106,101, 99,116,
+ 65, 99,116,117, 97,116,111,114,  0, 98, 73,112,111, 65, 99,116,117, 97,116,111,114,  0, 98, 67, 97,109,101,114, 97, 65, 99,116,
+117, 97,116,111,114,  0, 98, 67,111,110,115,116,114, 97,105,110,116, 65, 99,116,117, 97,116,111,114,  0, 98, 71,114,111,117,112,
+ 65, 99,116,117, 97,116,111,114,  0, 98, 82, 97,110,100,111,109, 65, 99,116,117, 97,116,111,114,  0, 98, 77,101,115,115, 97,103,
+101, 65, 99,116,117, 97,116,111,114,  0, 98, 71, 97,109,101, 65, 99,116,117, 97,116,111,114,  0, 98, 86,105,115,105, 98,105,108,
+105,116,121, 65, 99,116,117, 97,116,111,114,  0, 98, 84,119,111, 68, 70,105,108,116,101,114, 65, 99,116,117, 97,116,111,114,  0,
+ 98, 80, 97,114,101,110,116, 65, 99,116,117, 97,116,111,114,  0, 98, 83,116, 97,116,101, 65, 99,116,117, 97,116,111,114,  0, 98,
+ 65,114,109, 97,116,117,114,101, 65, 99,116,117, 97,116,111,114,  0, 98, 83,116,101,101,114,105,110,103, 65, 99,116,117, 97,116,
+111,114,  0, 71,114,111,117,112, 79, 98,106,101, 99,116,  0, 66,111,110,101,  0, 98, 65,114,109, 97,116,117,114,101,  0, 98, 77,
+111,116,105,111,110, 80, 97,116,104, 86,101,114,116,  0, 98, 80,111,115,101, 67,104, 97,110,110,101,108,  0, 98, 73, 75, 80, 97,
+114, 97,109,  0, 98, 73,116, 97,115, 99,  0, 98, 65, 99,116,105,111,110, 71,114,111,117,112,  0, 83,112, 97, 99,101, 65, 99,116,
+105,111,110,  0, 98, 65, 99,116,105,111,110, 67,104, 97,110,110,101,108,  0, 98, 67,111,110,115,116,114, 97,105,110,116, 67,104,
+ 97,110,110,101,108,  0, 98, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 67,111,110,115,116,114, 97,105,110,116, 84, 97,114,
+103,101,116,  0, 98, 80,121,116,104,111,110, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 75,105,110,101,109, 97,116,105, 99,
+ 67,111,110,115,116,114, 97,105,110,116,  0, 98, 83,112,108,105,110,101, 73, 75, 67,111,110,115,116,114, 97,105,110,116,  0, 98,
+ 84,114, 97, 99,107, 84,111, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 82,111,116, 97,116,101, 76,105,107,101, 67,111,110,
+115,116,114, 97,105,110,116,  0, 98, 76,111, 99, 97,116,101, 76,105,107,101, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 83,
+105,122,101, 76,105,107,101, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 83, 97,109,101, 86,111,108,117,109,101, 67,111,110,
+115,116,114, 97,105,110,116,  0, 98, 84,114, 97,110,115, 76,105,107,101, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 77,105,
+110, 77, 97,120, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 65, 99,116,105,111,110, 67,111,110,115,116,114, 97,105,110,116,
+  0, 98, 76,111, 99,107, 84,114, 97, 99,107, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 68, 97,109,112, 84,114, 97, 99,107,
+ 67,111,110,115,116,114, 97,105,110,116,  0, 98, 70,111,108,108,111,119, 80, 97,116,104, 67,111,110,115,116,114, 97,105,110,116,
+  0, 98, 83,116,114,101,116, 99,104, 84,111, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 82,105,103,105,100, 66,111,100,121,
+ 74,111,105,110,116, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 67,108, 97,109,112, 84,111, 67,111,110,115,116,114, 97,105,
+110,116,  0, 98, 67,104,105,108,100, 79,102, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 84,114, 97,110,115,102,111,114,109,
+ 67,111,110,115,116,114, 97,105,110,116,  0, 98, 80,105,118,111,116, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 76,111, 99,
+ 76,105,109,105,116, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 82,111,116, 76,105,109,105,116, 67,111,110,115,116,114, 97,
+105,110,116,  0, 98, 83,105,122,101, 76,105,109,105,116, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 68,105,115,116, 76,105,
+109,105,116, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 83,104,114,105,110,107,119,114, 97,112, 67,111,110,115,116,114, 97,
+105,110,116,  0, 98, 70,111,108,108,111,119, 84,114, 97, 99,107, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 67, 97,109,101,
+114, 97, 83,111,108,118,101,114, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 79, 98,106,101, 99,116, 83,111,108,118,101,114,
+ 67,111,110,115,116,114, 97,105,110,116,  0, 98, 65, 99,116,105,111,110, 77,111,100,105,102,105,101,114,  0, 98, 65, 99,116,105,
+111,110, 83,116,114,105,112,  0, 98, 78,111,100,101, 83,116, 97, 99,107,  0, 98, 78,111,100,101, 83,111, 99,107,101,116,  0, 98,
+ 78,111,100,101, 76,105,110,107,  0, 98, 78,111,100,101, 80,114,101,118,105,101,119,  0, 98, 78,111,100,101,  0,117,105, 66,108,
+111, 99,107,  0, 98, 78,111,100,101, 84,121,112,101,  0, 98, 78,111,100,101, 84,114,101,101, 69,120,101, 99,  0, 98, 78,111,100,
+101, 83,111, 99,107,101,116, 86, 97,108,117,101, 73,110,116,  0, 98, 78,111,100,101, 83,111, 99,107,101,116, 86, 97,108,117,101,
+ 70,108,111, 97,116,  0, 98, 78,111,100,101, 83,111, 99,107,101,116, 86, 97,108,117,101, 66,111,111,108,101, 97,110,  0, 98, 78,
+111,100,101, 83,111, 99,107,101,116, 86, 97,108,117,101, 86,101, 99,116,111,114,  0, 98, 78,111,100,101, 83,111, 99,107,101,116,
+ 86, 97,108,117,101, 82, 71, 66, 65,  0, 78,111,100,101, 73,109, 97,103,101, 65,110,105,109,  0, 78,111,100,101, 66,108,117,114,
+ 68, 97,116, 97,  0, 78,111,100,101, 68, 66,108,117,114, 68, 97,116, 97,  0, 78,111,100,101, 66,105,108, 97,116,101,114, 97,108,
+ 66,108,117,114, 68, 97,116, 97,  0, 78,111,100,101, 72,117,101, 83, 97,116,  0, 78,111,100,101, 73,109, 97,103,101, 70,105,108,
+101,  0, 78,111,100,101, 73,109, 97,103,101, 77,117,108,116,105, 70,105,108,101,  0, 78,111,100,101, 73,109, 97,103,101, 77,117,
+108,116,105, 70,105,108,101, 83,111, 99,107,101,116,  0, 78,111,100,101, 67,104,114,111,109, 97,  0, 78,111,100,101, 84,119,111,
+ 88, 89,115,  0, 78,111,100,101, 84,119,111, 70,108,111, 97,116,115,  0, 78,111,100,101, 71,101,111,109,101,116,114,121,  0, 78,
+111,100,101, 86,101,114,116,101,120, 67,111,108,  0, 78,111,100,101, 68,101,102,111, 99,117,115,  0, 78,111,100,101, 83, 99,114,
+105,112,116, 68,105, 99,116,  0, 78,111,100,101, 71,108, 97,114,101,  0, 78,111,100,101, 84,111,110,101,109, 97,112,  0, 78,111,
+100,101, 76,101,110,115, 68,105,115,116,  0, 78,111,100,101, 67,111,108,111,114, 66, 97,108, 97,110, 99,101,  0, 78,111,100,101,
+ 67,111,108,111,114,115,112,105,108,108,  0, 78,111,100,101, 84,101,120, 66, 97,115,101,  0, 78,111,100,101, 84,101,120, 83,107,
+121,  0, 78,111,100,101, 84,101,120, 73,109, 97,103,101,  0, 78,111,100,101, 84,101,120, 67,104,101, 99,107,101,114,  0, 78,111,
+100,101, 84,101,120, 69,110,118,105,114,111,110,109,101,110,116,  0, 78,111,100,101, 84,101,120, 71,114, 97,100,105,101,110,116,
+  0, 78,111,100,101, 84,101,120, 78,111,105,115,101,  0, 78,111,100,101, 84,101,120, 86,111,114,111,110,111,105,  0, 78,111,100,
+101, 84,101,120, 77,117,115,103,114, 97,118,101,  0, 78,111,100,101, 84,101,120, 87, 97,118,101,  0, 78,111,100,101, 84,101,120,
+ 77, 97,103,105, 99,  0, 78,111,100,101, 83,104, 97,100,101,114, 65,116,116,114,105, 98,117,116,101,  0, 84,101,120, 78,111,100,
+101, 79,117,116,112,117,116,  0, 67,117,114,118,101, 77, 97,112, 80,111,105,110,116,  0, 67,117,114,118,101, 77, 97,112,  0, 66,
+114,117,115,104, 67,108,111,110,101,  0, 67,117,115,116,111,109, 68, 97,116, 97, 76, 97,121,101,114,  0, 67,117,115,116,111,109,
+ 68, 97,116, 97, 69,120,116,101,114,110, 97,108,  0, 72, 97,105,114, 75,101,121,  0, 80, 97,114,116,105, 99,108,101, 75,101,121,
+  0, 66,111,105,100, 80, 97,114,116,105, 99,108,101,  0, 66,111,105,100, 68, 97,116, 97,  0, 80, 97,114,116,105, 99,108,101, 83,
+112,114,105,110,103,  0, 67,104,105,108,100, 80, 97,114,116,105, 99,108,101,  0, 80, 97,114,116,105, 99,108,101, 84, 97,114,103,
+101,116,  0, 80, 97,114,116,105, 99,108,101, 68,117,112,108,105, 87,101,105,103,104,116,  0, 80, 97,114,116,105, 99,108,101, 68,
+ 97,116, 97,  0, 83, 80, 72, 70,108,117,105,100, 83,101,116,116,105,110,103,115,  0, 80, 97,114,116,105, 99,108,101, 83,101,116,
+116,105,110,103,115,  0, 66,111,105,100, 83,101,116,116,105,110,103,115,  0, 80, 97,114,116,105, 99,108,101, 67, 97, 99,104,101,
+ 75,101,121,  0, 75, 68, 84,114,101,101,  0, 80, 97,114,116,105, 99,108,101, 68,114, 97,119, 68, 97,116, 97,  0, 76,105,110,107,
+ 78,111,100,101,  0, 98, 71, 80, 68,115,112,111,105,110,116,  0, 98, 71, 80, 68,115,116,114,111,107,101,  0, 98, 71, 80, 68,102,
+114, 97,109,101,  0, 98, 71, 80, 68,108, 97,121,101,114,  0, 82,101,112,111,114,116, 76,105,115,116,  0,119,109, 87,105,110,100,
+111,119, 77, 97,110, 97,103,101,114,  0,119,109, 87,105,110,100,111,119,  0,119,109, 75,101,121, 67,111,110,102,105,103,  0,119,
+109, 69,118,101,110,116,  0,119,109, 83,117, 98, 87,105,110,100,111,119,  0,119,109, 71,101,115,116,117,114,101,  0,119,109, 75,
+101,121, 77, 97,112, 73,116,101,109,  0, 80,111,105,110,116,101,114, 82, 78, 65,  0,119,109, 75,101,121, 77, 97,112, 68,105,102,
+102, 73,116,101,109,  0,119,109, 75,101,121, 77, 97,112,  0,119,109, 79,112,101,114, 97,116,111,114, 84,121,112,101,  0, 70, 77,
+111,100,105,102,105,101,114,  0, 70, 77,111,100, 95, 71,101,110,101,114, 97,116,111,114,  0, 70, 77,111,100, 95, 70,117,110, 99,
+116,105,111,110, 71,101,110,101,114, 97,116,111,114,  0, 70, 67, 77, 95, 69,110,118,101,108,111,112,101, 68, 97,116, 97,  0, 70,
+ 77,111,100, 95, 69,110,118,101,108,111,112,101,  0, 70, 77,111,100, 95, 67,121, 99,108,101,115,  0, 70, 77,111,100, 95, 80,121,
+116,104,111,110,  0, 70, 77,111,100, 95, 76,105,109,105,116,115,  0, 70, 77,111,100, 95, 78,111,105,115,101,  0, 70, 77,111,100,
+ 95, 83,116,101,112,112,101,100,  0, 68,114,105,118,101,114, 84, 97,114,103,101,116,  0, 68,114,105,118,101,114, 86, 97,114,  0,
+ 67,104, 97,110,110,101,108, 68,114,105,118,101,114,  0, 70, 80,111,105,110,116,  0, 70, 67,117,114,118,101,  0, 65,110,105,109,
+ 77, 97,112, 80, 97,105,114,  0, 65,110,105,109, 77, 97,112,112,101,114,  0, 78,108, 97, 83,116,114,105,112,  0, 78,108, 97, 84,
+114, 97, 99,107,  0, 75, 83, 95, 80, 97,116,104,  0, 75,101,121,105,110,103, 83,101,116,  0, 65,110,105,109, 79,118,101,114,114,
+105,100,101,  0, 73,100, 65,100,116, 84,101,109,112,108, 97,116,101,  0, 66,111,105,100, 82,117,108,101,  0, 66,111,105,100, 82,
+117,108,101, 71,111, 97,108, 65,118,111,105,100,  0, 66,111,105,100, 82,117,108,101, 65,118,111,105,100, 67,111,108,108,105,115,
+105,111,110,  0, 66,111,105,100, 82,117,108,101, 70,111,108,108,111,119, 76,101, 97,100,101,114,  0, 66,111,105,100, 82,117,108,
+101, 65,118,101,114, 97,103,101, 83,112,101,101,100,  0, 66,111,105,100, 82,117,108,101, 70,105,103,104,116,  0, 66,111,105,100,
+ 83,116, 97,116,101,  0, 70, 76, 85, 73, 68, 95, 51, 68,  0, 87, 84, 85, 82, 66, 85, 76, 69, 78, 67, 69,  0, 83,112,101, 97,107,
+101,114,  0, 77,111,118,105,101, 67,108,105,112, 80,114,111,120,121,  0, 77,111,118,105,101, 67,108,105,112, 67, 97, 99,104,101,
+  0, 77,111,118,105,101, 84,114, 97, 99,107,105,110,103,  0, 77,111,118,105,101, 84,114, 97, 99,107,105,110,103, 84,114, 97, 99,
+107,  0, 77,111,118,105,101, 84,114, 97, 99,107,105,110,103, 77, 97,114,107,101,114,  0, 77,111,118,105,101, 82,101, 99,111,110,
+115,116,114,117, 99,116,101,100, 67, 97,109,101,114, 97,  0, 77,111,118,105,101, 84,114, 97, 99,107,105,110,103, 67, 97,109,101,
+114, 97,  0, 77,111,118,105,101, 84,114, 97, 99,107,105,110,103, 83,101,116,116,105,110,103,115,  0, 77,111,118,105,101, 84,114,
+ 97, 99,107,105,110,103, 83,116, 97, 98,105,108,105,122, 97,116,105,111,110,  0, 77,111,118,105,101, 84,114, 97, 99,107,105,110,
+103, 82,101, 99,111,110,115,116,114,117, 99,116,105,111,110,  0, 77,111,118,105,101, 84,114, 97, 99,107,105,110,103, 79, 98,106,
+101, 99,116,  0, 77,111,118,105,101, 84,114, 97, 99,107,105,110,103, 83,116, 97,116,115,  0, 68,121,110, 97,109,105, 99, 80, 97,
+105,110,116, 83,117,114,102, 97, 99,101,  0, 80, 97,105,110,116, 83,117,114,102, 97, 99,101, 68, 97,116, 97,  0, 84, 76, 69, 78,
+  1,  0,  1,  0,  2,  0,  2,  0,  4,  0,  4,  0,  4,  0,  4,  0,  8,  0,  8,  0,  8,  0,  0,  0, 16,  0, 24,  0, 16,  0,  4,  0,
+  8,  0, 12,  0, 16,  0, 16,  0, 32,  0,128,  0,120,  0,152,  8,  0,  0, 40,  0,144,  0,112,  5,112,  0, 36,  0, 56,  0,160,  0,
+200,  0,  0,  1, 96,  0, 40,  0, 48,  0,224,  0, 16,  0,200,  0, 40,  0,216, 11, 48,  5,  0,  0,  0,  0,  0,  0, 56,  1,168,  1,
+216,  4, 24,  0,  8,  3,200,  0,  0,  0,104,  0, 64,  1, 56,  4, 80,  0, 24,  1,144,  0, 56,  3, 16,  2, 88,  0, 16,  0,128,  3,
+152,  0,136,  4,  0,  0,104,  0,104,  0,  0,  1, 80,  0,  8,  0, 16,  0, 32,  0,  0,  0,  8,  2,  0,  0,  0,  0,  0,  0,232,  4,
+ 12,  0, 16,  0,  8,  0, 12,  0,  4,  0, 20,  0, 48,  0, 64,  0, 20,  0, 12,  0, 16,  0,  4,  0,  8,  0,  8,  0,  0,  0,176,  0,
+144,  1,  8,  0,  4,  0,  4,  0,  0,  1, 32,  0,  8,  0, 24,  0, 16,  0, 64,  0, 24,  0, 12,  0, 64,  0,  4,  0,112,  0,200,  0,
+136,  0,192,  0,192,  0,128,  0,192,  0,192,  0,128,  0,120,  0,200,  0,120,  0,144,  0, 16,  1, 56,  0,192,  0, 24,  1, 40,  1,
+120,  0,184,  0,200,  0, 64,  1,200,  0, 88,  1,112,  0,168,  0,  0,  0,152,  0, 48,  0, 40,  5,192,  0,  0,  0,152,  0,  0,  0,
+  0,  0,128,  0,  8,  0,  8,  0,112,  1,144,  0,152,  2,136,  0,192,  0,120,  0,128,  0,224,  4,208,  0,200,  0,112,  0,208,  0,
+144,  0, 16,  5,  0,  0,  0,  0, 48,  1,104,  1,160,  1,104,  1,136,  0,104,  0,112,  0,128,  0, 16,  0, 96,  1, 88,  0,  0,  0,
+200,  0,216,  0,152,  0, 48,  0, 24,  0,120,  0,152,  0,216,  1,  0,  1,184,  0,  0,  0, 72,  0, 32,  0,176,  0,  0,  0, 16,  0,
+  0,  0,  0,  0,  0,  0, 12,  0, 24,  2, 40,  0,184,  0,152,  0, 64,  0, 72,  0, 32,  0,120,  0, 24,  0, 56,  9, 64,  0, 24,  0,
+ 16,  0, 56,  0,168,  0, 96,  0, 24,  0, 88,  6, 48,  0, 16,  0,168,  0, 96,  0, 24,  0, 56,  0,120,  0, 16,  0,232,  1, 32,  0,
+  8,  0, 24,  0, 80,  8,  0,  0,  0,  0,192,  8,104,  0,  8,  0,112,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 96,  1, 56,  0,
+144,  0, 64,  0,240,  0,112,  0,248,  0,240,  0,160,  7,104,  0,  0,  0,168,  0,  0,  0, 24,  1, 16,  0, 16,  0, 40, 33,128, 16,
+ 24, 16,216,  0,160,  2,168,  5, 64,  0, 24,  0,208,  0, 48,  1, 72,  0, 40,  0,136,  1,104,  0, 40,  1, 56,  0, 24,  4, 32,  0,
+232,  0, 32,  0, 32,  0,  8,  0, 80,  3,224,  1, 16,  0,168, 36, 80,  0, 56,  0,112, 38,  8,  1, 32,  0, 40,  0, 88,  1,  0,  0,
+  0,  0,160,  0,  0,  0, 40,  1,  0,  0, 48,  4,  8,  1, 16,  0,  8,  0, 44,  0, 16,  4, 72,  3,200,  4, 80,  1,208,  4, 32,  0,
+ 12,  0, 24,  0, 32,  0, 16,  0, 24,  0, 24,  0, 32,  0,136,  1,  0,  0, 64,  0, 96,  0, 80,  0,  8,  0, 80,  0,136,  0,200,  0,
+ 72,  0,  8,  0,136,  0, 76,  0, 72,  0,204,  0,136,  0,136,  0,128,  0,136,  0, 92,  0,128,  0, 80,  0,112,  0, 16,  0,168,  0,
+ 32,  0, 72,  0,120,  0, 24,  0,144,  0,112,  0,148,  0, 32,  0,128,  0, 88,  0, 88,  0,208,  0,140,  0,  4,  0, 24,  0, 16,  0,
+  8,  0,160,  0, 48,  0, 40,  0, 72,  1,  0,  1, 16,  0, 32,  2,  4,  0, 40,  0,120,  0, 72,  1,120,  0, 56,  0,120,  0,160,  0,
+112,  0,184,  0, 24,  0, 88,  0, 80,  0, 80,  0, 80,  0,  8,  0, 72,  0,104,  0,104,  0, 80,  0, 80,  0, 24,  0, 88,  0,104,  0,
+ 16,  0,144,  0,128,  0, 88,  0, 28,  0, 28,  0, 28,  0, 88,  0, 24,  0,160,  0, 16,  0,152,  0, 72,  0,168,  0, 48,  0,208,  0,
+ 56,  0, 16,  0, 88,  1,  0,  0,  0,  0,  0,  0, 16,  0, 16,  0,  4,  0, 24,  0, 16,  0, 16,  0, 40,  0, 28,  0, 12,  0, 12,  0,
+ 32,  4, 40,  4, 32,  0, 44,  0, 24,  0,  8,  0,128,  0, 64,  0, 32,  0, 16,  0, 32,  0, 32,  0,  8,  0, 96,  0, 20,  0,200,  3,
+216,  3,208,  3,200,  3,208,  3,208,  3,200,  3,208,  3,208,  3,208,  3,208,  3, 64,  0, 64,  0, 12,  0, 56,  0, 24,  0,104,  0,
+  0,  4, 24,  0, 56,  0, 56,  0, 20,  0, 16,  0, 64,  0, 40,  0, 32,  0,192,  0, 60,  0, 16,  3,104,  0,  0,  0,  0,  0,  0,  0,
+  0,  0, 16,  0, 32,  0, 40,  0,192,  0, 40,  0, 88,  1,  0,  1,168,  0,  0,  0,  0,  0,  0,  0,120,  0,  0,  0, 32,  0,136,  0,
+  0,  0,120,  0, 24,  0, 24,  0, 16,  0, 24,  0,  8,  0, 16,  0, 24,  0, 20,  0, 20,  0, 56,  0, 24,  2, 40,  1, 16,  0,104,  0,
+  0,  1, 40,  0,208,  0,104,  0,112,  0,216,  1, 32,  0,128,  0, 56,  0, 80,  0, 64,  0,104,  0, 72,  0, 64,  0,128,  0,  0,  0,
+  0,  0,184,  0,  8,  3,  0,  0,248,  0,192,  0, 16,  0, 72,  0, 48,  0, 64,  0, 56,  0, 24,  0,128,  0,  0,  1, 16,  6,  0,  0,
+ 83, 84, 82, 67,207,  1,  0,  0, 12,  0,  2,  0, 12,  0,  0,  0, 12,  0,  1,  0, 13,  0,  3,  0, 13,  0,  0,  0, 13,  0,  1,  0,
+ 11,  0,  2,  0, 14,  0,  2,  0, 11,  0,  3,  0, 11,  0,  4,  0, 15,  0,  2,  0,  2,  0,  5,  0,  2,  0,  6,  0, 16,  0,  2,  0,
+  7,  0,  5,  0,  7,  0,  6,  0, 17,  0,  3,  0,  7,  0,  5,  0,  7,  0,  6,  0,  7,  0,  7,  0, 18,  0,  4,  0,  4,  0,  8,  0,
+  4,  0,  9,  0,  4,  0, 10,  0,  4,  0, 11,  0, 19,  0,  4,  0,  7,  0,  8,  0,  7,  0,  9,  0,  7,  0, 10,  0,  7,  0, 11,  0,
+ 20,  0,  4,  0, 11,  0, 12,  0, 14,  0, 13,  0,  4,  0, 14,  0,  4,  0, 15,  0, 21,  0, 10,  0, 21,  0,  0,  0, 21,  0,  1,  0,
+  0,  0, 16,  0,  0,  0, 17,  0,  2,  0, 18,  0,  0,  0, 19,  0,  4,  0, 20,  0, 20,  0, 21,  0,  4,  0, 22,  0,  4,  0, 23,  0,
+ 22,  0, 11,  0, 11,  0,  0,  0, 11,  0,  1,  0, 22,  0, 24,  0, 23,  0, 25,  0,  0,  0, 26,  0,  2,  0, 27,  0,  2,  0, 28,  0,
+  2,  0, 18,  0,  4,  0, 29,  0,  4,  0, 30,  0, 21,  0, 31,  0, 23,  0,  8,  0, 22,  0, 32,  0, 22,  0, 33,  0, 24,  0, 34,  0,
+  0,  0, 35,  0,  0,  0, 36,  0,  4,  0, 37,  0,  4,  0, 27,  0, 23,  0, 38,  0, 25,  0,  5,  0,  4,  0, 39,  0,  4,  0, 40,  0,
+  2,  0, 41,  0,  2,  0, 42,  0,  4,  0, 43,  0, 26,  0,  6,  0, 27,  0, 44,  0,  2,  0, 45,  0,  2,  0, 46,  0,  2,  0, 16,  0,
+  2,  0, 18,  0,  0,  0, 47,  0, 28,  0, 21,  0, 28,  0,  0,  0, 28,  0,  1,  0, 29,  0, 48,  0, 30,  0, 49,  0, 19,  0, 50,  0,
+ 19,  0, 51,  0,  2,  0, 45,  0,  2,  0, 46,  0,  2,  0, 52,  0,  2,  0, 53,  0,  2,  0, 54,  0,  2,  0, 55,  0,  2,  0, 18,  0,
+  2,  0, 56,  0,  7,  0, 10,  0,  7,  0, 11,  0,  4,  0, 57,  0,  7,  0, 58,  0,  7,  0, 59,  0,  7,  0, 60,  0, 26,  0, 61,  0,
+ 31,  0,  7,  0, 22,  0, 32,  0, 14,  0, 62,  0, 19,  0, 63,  0,  2,  0, 45,  0,  2,  0, 64,  0,  2,  0, 65,  0,  2,  0, 27,  0,
+ 32,  0, 18,  0, 32,  0,  0,  0, 32,  0,  1,  0,  7,  0, 66,  0,  7,  0, 60,  0,  2,  0, 16,  0,  2,  0, 46,  0,  2,  0, 67,  0,
+  2,  0, 18,  0,  4,  0, 68,  0,  4,  0, 30,  0, 11,  0,  2,  0,  7,  0, 69,  0,  0,  0, 19,  0,  0,  0, 70,  0,  7,  0, 71,  0,
+  7,  0, 72,  0,  4,  0, 73,  0,  4,  0, 74,  0, 33,  0, 15,  0, 22,  0, 32,  0, 34,  0, 75,  0, 32,  0, 76,  0,  0,  0, 77,  0,
+  4,  0, 78,  0,  7,  0, 60,  0, 14,  0, 79,  0, 31,  0, 80,  0, 22,  0, 81,  0,  2,  0, 16,  0,  2,  0, 82,  0,  2,  0, 83,  0,
+  2,  0, 18,  0,  7,  0, 84,  0,  4,  0, 85,  0, 35,  0,  6,  0, 35,  0,  0,  0, 35,  0,  1,  0,  0,  0, 86,  0,  0,  0, 87,  0,
+  4,  0, 22,  0,  4,  0, 88,  0, 36,  0, 10,  0, 36,  0,  0,  0, 36,  0,  1,  0,  4,  0, 89,  0,  4,  0, 90,  0,  4,  0, 91,  0,
+  4,  0, 92,  0,  4,  0, 13,  0,  4,  0, 93,  0,  0,  0, 94,  0,  0,  0, 95,  0, 37,  0, 15,  0, 22,  0, 32,  0,  0,  0, 96,  0,
+  4,  0, 93,  0,  4,  0, 97,  0, 14,  0, 98,  0, 35,  0, 99,  0, 35,  0,100,  0,  4,  0,101,  0,  4,  0,102,  0, 14,  0,103,  0,
+  0,  0,104,  0,  4,  0,105,  0,  4,  0,106,  0, 11,  0,107,  0,  8,  0,108,  0, 38,  0,  3,  0,  4,  0,109,  0,  4,  0,110,  0,
+ 11,  0,  2,  0, 39,  0, 20,  0, 22,  0, 32,  0, 34,  0, 75,  0,  0,  0, 16,  0,  0,  0,111,  0,  2,  0, 18,  0,  7,  0,112,  0,
+  7,  0,113,  0,  7,  0,114,  0,  7,  0,115,  0,  7,  0,116,  0,  7,  0,117,  0,  7,  0,118,  0,  7,  0,119,  0,  7,  0,120,  0,
+  7,  0,121,  0,  7,  0,122,  0, 31,  0, 80,  0, 27,  0,123,  0,  0,  0,124,  0,  0,  0,125,  0, 40,  0, 14,  0, 41,  0,126,  0,
+  4,  0,127,  0,  4,  0,128,  0,  4,  0,129,  0,  4,  0,130,  0,  0,  0,131,  0,  0,  0,132,  0,  0,  0,133,  0,  0,  0, 27,  0,
+  2,  0,134,  0,  2,  0,135,  0,  2,  0,136,  0,  2,  0, 18,  0,  4,  0, 30,  0, 42,  0, 33,  0, 22,  0, 32,  0,  0,  0, 35,  0,
+ 14,  0,137,  0, 43,  0,138,  0, 44,  0,139,  0, 45,  0,140,  0, 45,  0,141,  0,  2,  0,142,  0,  2,  0,143,  0,  2,  0,133,  0,
+  2,  0, 18,  0,  2,  0,144,  0,  2,  0, 16,  0,  4,  0,145,  0,  2,  0,146,  0,  2,  0,147,  0,  2,  0,148,  0,  2,  0,149,  0,
+  2,  0,150,  0,  2,  0,151,  0,  4,  0,152,  0,  4,  0,153,  0, 38,  0,154,  0, 25,  0,155,  0,  7,  0,156,  0,  4,  0,157,  0,
+  2,  0,158,  0,  2,  0,159,  0,  2,  0,160,  0,  0,  0,161,  0,  0,  0,162,  0,  7,  0,163,  0,  7,  0,164,  0, 46,  0, 65,  0,
+  2,  0,165,  0,  2,  0,166,  0,  2,  0,167,  0,  2,  0,168,  0, 27,  0,169,  0, 47,  0,170,  0,  0,  0,171,  0,  0,  0,172,  0,
+  0,  0,173,  0,  0,  0,174,  0,  0,  0,175,  0,  7,  0,176,  0,  7,  0,177,  0,  7,  0,178,  0,  2,  0,179,  0,  2,  0,180,  0,
+  2,  0,181,  0,  2,  0,182,  0,  2,  0,183,  0,  2,  0,184,  0,  0,  0,185,  0,  0,  0,125,  0,  7,  0,186,  0,  7,  0,187,  0,
+  7,  0,188,  0,  7,  0,189,  0,  7,  0,190,  0,  7,  0, 56,  0,  7,  0,191,  0,  7,  0,192,  0,  7,  0,193,  0,  7,  0,194,  0,
   7,  0,195,  0,  7,  0,196,  0,  7,  0,197,  0,  7,  0,198,  0,  7,  0,199,  0,  7,  0,200,  0,  7,  0,201,  0,  7,  0,202,  0,
   7,  0,203,  0,  7,  0,204,  0,  7,  0,205,  0,  7,  0,206,  0,  7,  0,207,  0,  7,  0,208,  0,  7,  0,209,  0,  7,  0,210,  0,
   7,  0,211,  0,  7,  0,212,  0,  7,  0,213,  0,  7,  0,214,  0,  7,  0,215,  0,  7,  0,216,  0,  7,  0,217,  0,  7,  0,218,  0,
- 45,  0, 15,  0,  0,  0,219,  0,  9,  0,220,  0,  0,  0,221,  0,  0,  0,222,  0,  4,  0,223,  0,  4,  0,224,  0,  9,  0,225,  0,
-  7,  0,226,  0,  7,  0,227,  0,  7,  0,228,  0,  4,  0,229,  0,  9,  0,230,  0,  9,  0,231,  0,  4,  0,232,  0,  4,  0, 35,  0,
- 46,  0,  6,  0,  7,  0,177,  0,  7,  0,178,  0,  7,  0,179,  0,  7,  0,233,  0,  7,  0, 64,  0,  4,  0, 61,  0, 47,  0,  5,  0,
-  2,  0, 17,  0,  2,  0, 34,  0,  2,  0, 61,  0,  2,  0,234,  0, 46,  0,228,  0, 48,  0, 17,  0, 24,  0,159,  0, 39,  0,235,  0,
- 49,  0,236,  0,  7,  0,237,  0,  7,  0,238,  0,  2,  0, 15,  0,  2,  0,239,  0,  7,  0,108,  0,  7,  0,109,  0,  7,  0,240,  0,
-  4,  0,241,  0,  2,  0,242,  0,  2,  0,243,  0,  4,  0,124,  0,  4,  0,136,  0,  2,  0,244,  0,  2,  0,245,  0, 50,  0, 25,  0,
-  2,  0, 17,  0,  2,  0,246,  0,  7,  0,247,  0,  7,  0,248,  0,  2,  0,135,  0,  2,  0,249,  0,  4,  0,250,  0,  4,  0,251,  0,
- 24,  0,159,  0,  4,  0,252,  0,  2,  0,253,  0,  2,  0,254,  0,  9,  0,255,  0,  7,  0,  0,  1,  7,  0,  1,  1,  2,  0,  2,  1,
-  2,  0,  3,  1,  2,  0,  4,  1,  2,  0,  5,  1,  7,  0,  6,  1,  7,  0,  7,  1,  7,  0,  8,  1,  7,  0,  9,  1, 47,  0, 10,  1,
- 51,  0, 11,  1, 52,  0, 13,  0,  4,  0, 12,  1,  4,  0, 13,  1,  2,  0, 14,  1,  2,  0, 17,  0,  2,  0, 15,  1,  2,  0, 16,  1,
- 24,  0,159,  0,  7,  0, 17,  1,  4,  0, 18,  1,  0,  0, 19,  1,  7,  0, 20,  1,  4,  0, 21,  1,  4,  0,124,  0, 44,  0, 63,  0,
- 19,  0, 29,  0, 31,  0, 72,  0,  7,  0, 22,  1,  7,  0, 23,  1,  7,  0, 24,  1,  7,  0, 25,  1,  7,  0, 26,  1,  7,  0, 27,  1,
-  7,  0, 28,  1,  7,  0, 29,  1,  7,  0, 30,  1,  7,  0, 67,  0,  7,  0, 31,  1,  7,  0, 32,  1,  7,  0, 33,  1,  7,  0, 34,  1,
-  7,  0, 35,  1,  7,  0, 36,  1,  7,  0, 37,  1,  7,  0, 38,  1,  7,  0, 39,  1,  7,  0, 40,  1,  7,  0, 41,  1,  7,  0, 42,  1,
-  2,  0, 43,  1,  2,  0, 44,  1,  2,  0, 45,  1,  2,  0, 46,  1,  2,  0, 47,  1,  2,  0, 48,  1,  2,  0, 49,  1,  2,  0, 17,  0,
-  2,  0, 15,  0,  2,  0,239,  0,  7,  0, 50,  1,  7,  0, 51,  1,  7,  0, 52,  1,  7,  0, 53,  1,  4,  0, 54,  1,  4,  0, 55,  1,
-  2,  0, 56,  1,  2,  0, 57,  1,  2,  0, 15,  1,  2,  0,122,  0,  4,  0, 21,  0,  4,  0,119,  0,  4,  0,120,  0,  4,  0,121,  0,
-  7,  0, 58,  1,  7,  0, 59,  1,  7,  0, 87,  0, 37,  0, 60,  1, 53,  0, 61,  1, 28,  0, 77,  0, 39,  0,235,  0, 45,  0, 62,  1,
- 47,  0, 10,  1, 48,  0, 63,  1, 22,  0,146,  0, 50,  0, 64,  1, 52,  0, 65,  1,  0,  0, 66,  1,  0,  0,176,  0, 54,  0,  8,  0,
-  7,  0, 67,  1,  7,  0, 68,  1,  7,  0,167,  0,  4,  0, 17,  0,  7,  0, 69,  1,  7,  0, 70,  1,  7,  0, 71,  1, 24,  0, 42,  0,
- 55,  0, 72,  0, 19,  0, 29,  0, 31,  0, 72,  0,  2,  0, 15,  0,  2,  0, 17,  0,  4,  0, 72,  1,  2,  0,170,  0,  2,  0, 73,  1,
-  7,  0,177,  0,  7,  0,178,  0,  7,  0,179,  0,  7,  0,180,  0,  7,  0, 74,  1,  7,  0, 75,  1,  7,  0, 76,  1,  7,  0, 77,  1,
-  7,  0, 78,  1,  7,  0, 79,  1,  7,  0, 80,  1,  7,  0, 81,  1,  7,  0, 82,  1,  7,  0, 83,  1,  7,  0, 84,  1, 51,  0, 85,  1,
-  2,  0,246,  0,  2,  0, 67,  0,  7,  0,108,  0,  7,  0,109,  0,  7,  0, 86,  1,  7,  0, 87,  1,  7,  0, 88,  1,  7,  0, 89,  1,
-  7,  0, 90,  1,  2,  0, 91,  1,  2,  0, 92,  1,  2,  0, 93,  1,  2,  0, 94,  1,  0,  0, 95,  1,  0,  0, 96,  1,  2,  0, 97,  1,
-  2,  0, 98,  1,  2,  0, 99,  1,  2,  0,100,  1,  2,  0,101,  1,  7,  0,102,  1,  7,  0,103,  1,  7,  0,104,  1,  7,  0,105,  1,
-  2,  0,106,  1,  2,  0, 87,  0,  2,  0,107,  1,  2,  0,108,  1,  2,  0,109,  1,  2,  0,110,  1,  7,  0,111,  1,  7,  0,112,  1,
-  7,  0,113,  1,  7,  0,114,  1,  7,  0,115,  1,  7,  0,116,  1,  7,  0,117,  1,  7,  0,118,  1,  7,  0,119,  1,  7,  0,120,  1,
-  7,  0,121,  1,  7,  0,122,  1,  2,  0,123,  1,  0,  0,124,  1, 28,  0, 77,  0, 43,  0,125,  1,  2,  0,126,  1,  0,  0,127,  1,
- 22,  0,146,  0, 56,  0, 18,  0,  7,  0,128,  1,  7,  0,129,  1,  7,  0,130,  1,  7,  0,131,  1,  7,  0,132,  1,  7,  0,133,  1,
-  7,  0,134,  1,  7,  0,135,  1,  7,  0,136,  1,  7,  0,137,  1,  2,  0,138,  1,  2,  0,139,  1,  2,  0,140,  1,  2,  0,141,  1,
-  7,  0,142,  1,  7,  0,143,  1,  7,  0,144,  1,  7,  0,145,  1, 57,  0,125,  0, 19,  0, 29,  0, 31,  0, 72,  0,  2,  0,146,  1,
-  2,  0, 17,  0,  7,  0,177,  0,  7,  0,178,  0,  7,  0,179,  0,  7,  0,147,  1,  7,  0,148,  1,  7,  0,149,  1,  7,  0,150,  1,
-  7,  0,151,  1,  7,  0,152,  1,  7,  0,153,  1,  7,  0,154,  1,  7,  0,155,  1,  7,  0,156,  1,  7,  0,157,  1,  7,  0,158,  1,
-  7,  0,159,  1,  7,  0,160,  1,  7,  0,161,  1,  7,  0,162,  1,  7,  0,163,  1,  7,  0,164,  1,  7,  0,165,  1,  7,  0,166,  1,
- 56,  0,167,  1,  7,  0,168,  1,  7,  0,169,  1,  7,  0,170,  1,  7,  0,171,  1,  7,  0,172,  1,  7,  0,173,  1,  7,  0,174,  1,
-  2,  0,175,  1,  2,  0,176,  1,  2,  0,177,  1,  0,  0,178,  1,  0,  0,179,  1,  7,  0,180,  1,  7,  0,181,  1,  2,  0,182,  1,
-  2,  0,183,  1,  7,  0,184,  1,  7,  0,185,  1,  7,  0,186,  1,  7,  0,187,  1,  2,  0,188,  1,  2,  0,189,  1,  4,  0, 72,  1,
-  4,  0,190,  1,  2,  0,191,  1,  2,  0,192,  1,  2,  0,193,  1,  2,  0,194,  1,  7,  0,195,  1,  7,  0,196,  1,  7,  0,197,  1,
-  7,  0,198,  1,  7,  0,199,  1,  7,  0,200,  1,  7,  0,201,  1,  7,  0,202,  1,  7,  0,203,  1,  7,  0,204,  1,  0,  0,205,  1,
-  7,  0,206,  1,  7,  0,207,  1,  7,  0,208,  1,  4,  0,209,  1,  0,  0,210,  1,  0,  0,107,  1,  0,  0,211,  1,  0,  0, 66,  1,
-  2,  0,212,  1,  2,  0,213,  1,  2,  0,126,  1,  2,  0,214,  1,  2,  0,215,  1,  2,  0,216,  1,  7,  0,217,  1,  7,  0,218,  1,
-  7,  0,219,  1,  7,  0,220,  1,  7,  0,221,  1,  2,  0,155,  0,  2,  0,156,  0, 47,  0,222,  1, 47,  0,223,  1,  0,  0,224,  1,
-  0,  0,225,  1,  0,  0,226,  1,  0,  0,227,  1,  2,  0,228,  1,  2,  0,229,  1,  7,  0,230,  1,  7,  0,231,  1, 43,  0,125,  1,
- 53,  0, 61,  1, 28,  0, 77,  0, 58,  0,232,  1, 22,  0,146,  0,  7,  0,233,  1,  7,  0,234,  1,  7,  0,235,  1,  7,  0,236,  1,
-  7,  0,237,  1,  2,  0,238,  1,  2,  0, 67,  0,  7,  0,239,  1,  7,  0,240,  1,  7,  0,241,  1,  7,  0,242,  1,  7,  0,243,  1,
-  7,  0,244,  1,  7,  0,245,  1,  7,  0,246,  1,  7,  0,247,  1,  2,  0,248,  1,  2,  0,249,  1,  4,  0,250,  1,  2,  0,251,  1,
-  2,  0,252,  1, 12,  0,253,  1, 59,  0,  4,  0, 19,  0, 29,  0,  0,  0,254,  1, 60,  0,  2,  0, 35,  0,145,  0, 61,  0, 26,  0,
- 61,  0,  0,  0, 61,  0,  1,  0, 62,  0,255,  1,  4,  0,  0,  2,  4,  0,  1,  2,  4,  0,  2,  2,  4,  0,  3,  2,  4,  0,  4,  2,
-  4,  0,  5,  2,  2,  0, 15,  0,  2,  0, 17,  0,  2,  0,  6,  2,  2,  0,  7,  2,  7,  0,  5,  0,  7,  0,  6,  0,  7,  0,  8,  2,
-  7,  0,  9,  2,  7,  0, 10,  2,  7,  0, 11,  2,  7,  0, 12,  2,  7,  0, 13,  2,  7,  0, 14,  2,  7,  0, 15,  2,  7,  0, 21,  0,
-  7,  0, 16,  2,  7,  0, 17,  2, 63,  0, 20,  0, 19,  0, 29,  0, 31,  0, 72,  0, 62,  0,255,  1, 12,  0, 18,  2, 12,  0, 19,  2,
- 12,  0, 20,  2, 28,  0, 77,  0, 57,  0, 21,  2,  0,  0, 17,  0,  0,  0, 22,  2,  2,  0, 23,  2,  2,  0,169,  0,  2,  0, 35,  0,
-  7,  0, 67,  1,  7,  0,167,  0,  7,  0, 68,  1,  7,  0, 24,  2,  7,  0, 25,  2,  7,  0, 26,  2, 61,  0, 27,  2, 27,  0, 11,  0,
-  7,  0, 28,  2,  7,  0, 29,  2,  7,  0, 30,  2,  7,  0,248,  0,  2,  0, 52,  0,  0,  0, 31,  2,  0,  0, 32,  2,  0,  0, 33,  2,
-  0,  0, 34,  2,  0,  0, 35,  2,  0,  0, 36,  2, 26,  0,  7,  0,  7,  0, 37,  2,  7,  0, 29,  2,  7,  0, 30,  2,  2,  0, 33,  2,
-  2,  0, 36,  2,  7,  0,248,  0,  7,  0, 35,  0, 64,  0, 21,  0, 64,  0,  0,  0, 64,  0,  1,  0,  2,  0, 15,  0,  2,  0, 38,  2,
-  2,  0, 36,  2,  2,  0, 17,  0,  2,  0, 39,  2,  2,  0, 40,  2,  2,  0, 41,  2,  2,  0, 42,  2,  2,  0, 43,  2,  2,  0, 44,  2,
-  2,  0, 45,  2,  2,  0, 46,  2,  7,  0, 47,  2,  7,  0, 48,  2, 26,  0, 46,  0, 27,  0, 47,  0,  2,  0, 49,  2,  2,  0, 50,  2,
-  4,  0, 51,  2, 65,  0,  5,  0,  2,  0, 52,  2,  2,  0, 38,  2,  0,  0, 17,  0,  0,  0, 35,  0,  2,  0, 67,  0, 66,  0,  4,  0,
-  7,  0,  5,  0,  7,  0,  6,  0,  7,  0, 53,  2,  7,  0, 54,  2, 67,  0,  4,  0, 12,  0, 55,  2, 68,  0, 56,  2,  4,  0, 57,  2,
-  0,  0, 90,  0, 69,  0, 68,  0, 19,  0, 29,  0, 31,  0, 72,  0, 62,  0,255,  1, 12,  0, 58,  2, 12,  0, 19,  2, 67,  0, 59,  2,
- 24,  0, 60,  2, 24,  0, 61,  2, 24,  0, 62,  2, 28,  0, 77,  0, 70,  0, 63,  2, 30,  0, 64,  2, 57,  0, 21,  2, 12,  0, 65,  2,
-  7,  0, 67,  1,  7,  0,167,  0,  7,  0, 68,  1,  2,  0,169,  0,  2,  0, 87,  0,  2,  0, 66,  2,  2,  0, 67,  2,  7,  0, 68,  2,
-  7,  0, 69,  2,  4,  0, 70,  2,  2,  0, 35,  0,  2,  0, 23,  2,  2,  0, 17,  0,  2,  0, 71,  2,  7,  0, 72,  2,  7,  0, 73,  2,
-  7,  0, 74,  2,  2,  0, 41,  2,  2,  0, 42,  2,  2,  0, 75,  2,  2,  0, 76,  2,  4,  0, 77,  2,  9,  0, 78,  2,  2,  0, 21,  0,
-  2,  0, 93,  0,  2,  0, 64,  0,  2,  0, 79,  2,  7,  0, 80,  2,  7,  0, 81,  2,  7,  0, 82,  2,  7,  0, 83,  2,  7,  0, 84,  2,
-  7,  0, 85,  2,  7,  0, 86,  2,  7,  0, 87,  2,  7,  0, 88,  2,  7,  0, 89,  2,  0,  0, 90,  2, 71,  0, 91,  2, 72,  0, 92,  2,
-  0,  0, 93,  2, 59,  0, 94,  2, 59,  0, 95,  2, 59,  0, 96,  2, 59,  0, 97,  2,  4,  0, 98,  2,  7,  0, 99,  2,  4,  0,100,  2,
-  4,  0,101,  2, 66,  0,102,  2,  4,  0,103,  2,  4,  0,104,  2, 65,  0,105,  2, 65,  0,106,  2, 73,  0, 39,  0, 19,  0, 29,  0,
- 31,  0, 72,  0, 62,  0,255,  1, 28,  0, 77,  0, 30,  0, 64,  2, 57,  0, 21,  2, 74,  0,107,  2, 75,  0,108,  2, 76,  0,109,  2,
- 77,  0,110,  2, 78,  0,111,  2, 79,  0,112,  2, 80,  0,113,  2, 81,  0,114,  2, 73,  0,115,  2, 82,  0,116,  2, 83,  0,117,  2,
- 84,  0,118,  2, 84,  0,119,  2, 84,  0,120,  2,  4,  0, 51,  0,  4,  0,121,  2,  4,  0,122,  2,  4,  0,123,  2,  4,  0,124,  2,
-  7,  0, 67,  1,  7,  0,167,  0,  7,  0, 68,  1,  2,  0,169,  0,  2,  0, 66,  2,  2,  0,125,  2,  2,  0, 17,  0,  2,  0,126,  2,
-  2,  0,127,  2,  0,  0,128,  2,  0,  0,129,  2,  2,  0, 23,  2, 85,  0,130,  2, 86,  0,131,  2, 76,  0,  8,  0,  9,  0,132,  2,
-  7,  0,133,  2,  4,  0,134,  2,  0,  0, 17,  0,  0,  0,135,  2,  2,  0, 72,  1,  2,  0,136,  2,  2,  0,137,  2, 74,  0,  7,  0,
-  4,  0,138,  2,  4,  0,139,  2,  4,  0,140,  2,  4,  0,141,  2,  2,  0, 38,  2,  0,  0,142,  2,  0,  0, 17,  0, 78,  0,  5,  0,
-  4,  0,138,  2,  4,  0,139,  2,  0,  0,143,  2,  0,  0,144,  2,  2,  0, 17,  0, 87,  0,  2,  0,  4,  0,145,  2,  7,  0, 30,  2,
- 79,  0,  3,  0, 87,  0,146,  2,  4,  0,147,  2,  4,  0, 17,  0, 77,  0,  4,  0,  7,  0,148,  2,  2,  0,149,  2,  0,  0, 17,  0,
-  0,  0,144,  2, 80,  0,  4,  0,  0,  0,233,  0,  0,  0,177,  0,  0,  0,178,  0,  0,  0,179,  0, 88,  0,  6,  0, 39,  0,132,  2,
-  0,  0, 17,  0,  0,  0,135,  2,  2,  0, 72,  1,  2,  0,136,  2,  2,  0,137,  2, 89,  0,  1,  0,  7,  0,150,  2, 90,  0,  5,  0,
-  0,  0,233,  0,  0,  0,177,  0,  0,  0,178,  0,  0,  0,179,  0,  4,  0, 35,  0, 81,  0,  1,  0,  7,  0,151,  2, 82,  0,  2,  0,
-  4,  0,252,  1,  4,  0, 15,  0, 75,  0,  7,  0,  7,  0,133,  2, 39,  0,132,  2,  0,  0, 17,  0,  0,  0,135,  2,  2,  0, 72,  1,
-  2,  0,136,  2,  2,  0,137,  2, 91,  0,  1,  0,  7,  0,152,  2, 92,  0,  1,  0,  4,  0,153,  2, 93,  0,  1,  0,  0,  0,154,  2,
- 94,  0,  1,  0,  7,  0,133,  2, 95,  0,  3,  0,  4,  0,155,  2,  0,  0, 90,  0,  7,  0,156,  2, 96,  0,  4,  0,  7,  0,233,  0,
-  7,  0,177,  0,  7,  0,178,  0,  7,  0,179,  0, 97,  0,  1,  0, 96,  0,134,  2, 98,  0,  5,  0,  4,  0,157,  2,  4,  0,158,  2,
-  0,  0, 17,  0,  0,  0, 38,  2,  0,  0,159,  2, 99,  0,  2,  0,  4,  0,160,  2,  4,  0,158,  2,100,  0, 10,  0,100,  0,  0,  0,
-100,  0,  1,  0, 98,  0,161,  2, 97,  0,162,  2, 99,  0,163,  2,  4,  0, 51,  0,  4,  0,122,  2,  4,  0,121,  2,  4,  0, 35,  0,
- 77,  0,164,  2, 85,  0, 14,  0, 12,  0,165,  2, 77,  0,164,  2,  0,  0,166,  2,  0,  0,167,  2,  0,  0,168,  2,  0,  0,169,  2,
-  0,  0,170,  2,  0,  0,171,  2,  0,  0,172,  2,  0,  0, 17,  0, 84,  0,118,  2, 84,  0,120,  2,  2,  0,173,  2,  0,  0,174,  2,
- 86,  0,  8,  0,  4,  0,175,  2,  4,  0,176,  2, 74,  0,177,  2, 78,  0,178,  2,  4,  0,122,  2,  4,  0,121,  2,  4,  0, 51,  0,
-  4,  0, 35,  0,101,  0,  9,  0,101,  0,  0,  0,101,  0,  1,  0,  4,  0, 15,  0,  4,  0, 72,  1,  4,  0,179,  2,  4,  0, 35,  0,
-  0,  0, 18,  0, 38,  0,117,  0,  0,  0,180,  2,102,  0,  6,  0,101,  0,181,  2, 44,  0,182,  2, 24,  0,183,  2,  0,  0,184,  2,
-  4,  0,185,  2,  4,  0,186,  2,103,  0,  7,  0,101,  0,181,  2,  2,  0,187,  2,  2,  0,165,  2,  2,  0,188,  2,  2,  0, 88,  0,
-  9,  0,189,  2,  9,  0,190,  2,104,  0,  3,  0,101,  0,181,  2, 24,  0,159,  0,  0,  0, 18,  0,105,  0,  5,  0,101,  0,181,  2,
- 24,  0,159,  0,  0,  0, 18,  0,  2,  0,191,  2,  0,  0,192,  2,106,  0,  5,  0,101,  0,181,  2,  7,  0, 85,  0,  7,  0,193,  2,
-  4,  0,194,  2,  4,  0,195,  2,107,  0,  5,  0,101,  0,181,  2, 24,  0,196,  2,  0,  0, 69,  0,  4,  0, 72,  1,  4,  0, 17,  0,
-108,  0, 13,  0,101,  0,181,  2, 24,  0,197,  2, 24,  0,198,  2, 24,  0,199,  2, 24,  0,200,  2,  7,  0,201,  2,  7,  0,202,  2,
-  7,  0,193,  2,  7,  0,203,  2,  4,  0,204,  2,  4,  0,205,  2,  4,  0, 88,  0,  4,  0,206,  2,109,  0,  5,  0,101,  0,181,  2,
-  2,  0,207,  2,  2,  0, 17,  0,  7,  0,208,  2, 24,  0,209,  2,110,  0,  3,  0,101,  0,181,  2,  7,  0,210,  2,  4,  0, 88,  0,
-111,  0, 10,  0,101,  0,181,  2,  7,  0,211,  2,  4,  0,212,  2,  4,  0, 35,  0,  2,  0, 88,  0,  2,  0,213,  2,  2,  0,214,  2,
-  2,  0,215,  2,  7,  0,216,  2,  0,  0,217,  2,112,  0,  3,  0,101,  0,181,  2,  7,  0, 35,  0,  4,  0, 15,  0,113,  0,  6,  0,
-101,  0,181,  2,114,  0,218,  2,115,  0,219,  2,116,  0,220,  2,  7,  0,221,  2,  4,  0, 15,  0,117,  0, 11,  0,101,  0,181,  2,
- 44,  0,182,  2, 24,  0,183,  2,  0,  0,184,  2,  4,  0,185,  2,  4,  0,186,  2,  4,  0,222,  2,  7,  0,223,  2,  4,  0,224,  2,
-  0,  0,217,  2,  7,  0,225,  2,118,  0, 12,  0,101,  0,181,  2, 24,  0,226,  2, 39,  0,227,  2,  4,  0, 88,  0,  4,  0,228,  2,
-  7,  0,229,  2,  7,  0,230,  2,  7,  0,231,  2,  7,  0,232,  2,  0,  0,184,  2,  4,  0,185,  2,  4,  0, 35,  0,119,  0,  3,  0,
-101,  0,181,  2,  7,  0,233,  2,  4,  0,234,  2,120,  0,  5,  0,101,  0,181,  2,  7,  0,235,  2,  0,  0,217,  2,  2,  0, 17,  0,
-  2,  0,236,  2,121,  0,  8,  0,101,  0,181,  2, 24,  0,159,  0,  7,  0,235,  2,  7,  0,248,  0,  7,  0,104,  0,  0,  0,217,  2,
-  2,  0, 17,  0,  2,  0, 15,  0,122,  0, 21,  0,101,  0,181,  2, 24,  0,237,  2,  0,  0,217,  2, 44,  0,182,  2, 24,  0,183,  2,
-  2,  0, 17,  0,  2,  0, 35,  0,  7,  0,238,  2,  7,  0,239,  2,  7,  0,240,  2,  7,  0, 72,  2,  7,  0,241,  2,  7,  0,242,  2,
-  7,  0,243,  2,  7,  0,244,  2,  4,  0,186,  2,  4,  0,185,  2,  0,  0,184,  2,  7,  0,245,  2,  7,  0,246,  2,  7,  0, 87,  0,
-123,  0,  7,  0,101,  0,181,  2,  2,  0,247,  2,  2,  0,248,  2,  4,  0, 67,  0, 24,  0,159,  0,  7,  0,249,  2,  0,  0,217,  2,
-124,  0, 10,  0,101,  0,181,  2, 24,  0,159,  0,  0,  0,250,  2,  7,  0,251,  2,  7,  0,252,  2,  7,  0,244,  2,  4,  0,253,  2,
-  4,  0,254,  2,  7,  0,255,  2,  0,  0, 18,  0,125,  0,  1,  0,101,  0,181,  2,126,  0,  7,  0,101,  0,181,  2, 38,  0,117,  0,
-127,  0,  0,  3,128,  0,  1,  3,129,  0,  2,  3,130,  0,  3,  3, 12,  0,  4,  3,131,  0, 13,  0,101,  0,181,  2, 77,  0,  5,  3,
- 77,  0,  6,  3, 77,  0,  7,  3, 77,  0,  8,  3, 77,  0,  9,  3, 77,  0, 10,  3, 74,  0, 11,  3,  4,  0, 12,  3,  4,  0, 13,  3,
-  7,  0, 14,  3,  7,  0, 15,  3,132,  0, 16,  3,133,  0,  7,  0,101,  0,181,  2, 77,  0,  5,  3, 77,  0, 17,  3,134,  0, 18,  3,
-135,  0, 16,  3,  4,  0, 19,  3,  4,  0, 12,  3,136,  0,  4,  0,101,  0,181,  2, 24,  0,159,  0,  4,  0, 20,  3,  4,  0, 35,  0,
-137,  0,  2,  0,  4,  0, 21,  3,  7,  0, 30,  2,138,  0,  2,  0,  4,  0,120,  0,  4,  0, 22,  3,139,  0, 24,  0,101,  0,181,  2,
- 24,  0,159,  0,  0,  0,217,  2,  2,  0, 23,  3,  2,  0, 17,  0,  2,  0, 72,  1,  2,  0, 35,  0,137,  0, 24,  3,  4,  0, 25,  3,
-  7,  0, 26,  3,  4,  0, 51,  0,  4,  0, 27,  3,138,  0, 28,  3,137,  0, 29,  3,  4,  0, 30,  3,  4,  0, 31,  3,  4,  0, 32,  3,
-  4,  0, 22,  3,  7,  0, 33,  3,  7,  0, 34,  3,  7,  0, 35,  3,  7,  0, 36,  3,  7,  0, 37,  3,  9,  0, 38,  3,140,  0,  8,  0,
-101,  0,181,  2,141,  0, 39,  3,134,  0, 18,  3,  4,  0, 40,  3,  4,  0, 41,  3,  4,  0, 42,  3,  2,  0, 17,  0,  2,  0, 54,  0,
-142,  0,  8,  0,101,  0,181,  2, 24,  0, 42,  0,  2,  0,252,  0,  2,  0, 17,  0,  2,  0,207,  2,  2,  0, 54,  0,  7,  0, 43,  3,
-  7,  0, 44,  3,143,  0,  6,  0,101,  0,181,  2,  4,  0, 45,  3,  2,  0, 17,  0,  2,  0, 46,  3,  7,  0, 47,  3,  0,  0,161,  0,
-144,  0,  8,  0,101,  0,181,  2,  0,  0, 48,  3,  0,  0, 49,  3,  0,  0,171,  2,  0,  0, 50,  3,  0,  0, 51,  3,  0,  0, 88,  0,
-  0,  0,159,  2,145,  0,  3,  0,101,  0,181,  2,146,  0, 52,  3,130,  0,  3,  3,147,  0, 10,  0,101,  0,181,  2, 24,  0, 53,  3,
- 24,  0, 54,  3,  0,  0, 55,  3,  7,  0, 56,  3,  2,  0, 57,  3,  2,  0, 58,  3,  0,  0, 59,  3,  0,  0, 60,  3,  0,  0,192,  2,
-148,  0,  9,  0,101,  0,181,  2, 24,  0, 61,  3,  0,  0, 55,  3,  7,  0, 62,  3,  7,  0, 63,  3,  0,  0, 72,  1,  0,  0,207,  2,
-  0,  0, 64,  3,  0,  0, 35,  0,149,  0,  1,  0,101,  0,181,  2,150,  0, 11,  0,101,  0,181,  2,  0,  0,217,  2,  7,  0,120,  0,
-  7,  0, 65,  3,  7,  0, 66,  3,  7,  0, 67,  3,  7,  0, 68,  3,  4,  0, 17,  0,  2,  0, 69,  3,  2,  0, 70,  3,  4,  0, 35,  0,
-151,  0,  9,  0,101,  0,181,  2, 24,  0, 71,  3,  4,  0, 72,  3,  4,  0, 73,  3,  4,  0, 74,  3,  7,  0, 75,  3,  7,  0, 76,  3,
-  2,  0,207,  2,  2,  0, 17,  0,152,  0, 16,  0,101,  0,181,  2, 44,  0,182,  2, 24,  0,183,  2,  0,  0,184,  2,  4,  0,185,  2,
-  4,  0,186,  2,  4,  0,222,  2,  7,  0,223,  2, 24,  0, 77,  3, 24,  0, 78,  3, 51,  0, 85,  1,  0,  0,217,  2,  7,  0, 79,  3,
-  0,  0, 17,  0,  0,  0,246,  0,  0,  0,159,  2,153,  0,  3,  0,154,  0, 80,  3,  4,  0, 57,  2,  0,  0, 90,  0,154,  0, 29,  0,
- 19,  0, 29,  0, 31,  0, 72,  0,  2,  0, 39,  2,  2,  0, 40,  2,  2,  0, 81,  3,  2,  0, 17,  0,  2,  0, 82,  3,  2,  0, 83,  3,
-  2,  0, 84,  3,  2,  0, 67,  0,  0,  0, 85,  3,  0,  0, 86,  3,  0,  0, 87,  3,  0,  0,229,  1,  4,  0, 35,  0,  7,  0, 88,  3,
-  7,  0, 89,  3,  7,  0, 90,  3,  7,  0, 91,  3,  7,  0, 92,  3,  7,  0, 93,  3, 26,  0, 94,  3, 28,  0, 77,  0, 30,  0, 64,  2,
- 79,  0,112,  2,  0,  0, 69,  0,  7,  0, 95,  3,  7,  0, 96,  3,153,  0, 97,  3,155,  0,  3,  0,155,  0,  0,  0,155,  0,  1,  0,
-  0,  0, 18,  0, 62,  0,  3,  0,  7,  0, 98,  3,  4,  0, 17,  0,  4,  0, 35,  0, 24,  0,129,  0, 19,  0, 29,  0, 31,  0, 72,  0,
-156,  0, 99,  3,  2,  0, 15,  0,  2,  0,100,  3,  4,  0,101,  3,  4,  0,102,  3,  4,  0,103,  3,  0,  0,104,  3, 24,  0, 36,  0,
- 24,  0,105,  3, 24,  0,106,  3, 24,  0,107,  3, 24,  0,108,  3, 28,  0, 77,  0, 70,  0, 63,  2, 62,  0,255,  1,157,  0,109,  3,
-157,  0,110,  3,158,  0,111,  3,  9,  0,  2,  0,159,  0,112,  3,160,  0,113,  3,161,  0,114,  3, 12,  0,115,  3, 12,  0,116,  3,
- 12,  0, 19,  2, 12,  0,117,  3, 12,  0,118,  3,  4,  0, 72,  1,  4,  0,119,  3, 57,  0, 21,  2,  0,  0,120,  3,  4,  0, 23,  2,
-  4,  0,121,  3,  7,  0, 67,  1,  7,  0,122,  3,  7,  0,123,  3,  7,  0,167,  0,  7,  0,124,  3,  7,  0, 68,  1,  7,  0,125,  3,
-  7,  0,  9,  2,  7,  0,126,  3,  7,  0,127,  3,  7,  0,128,  3,  7,  0,129,  3,  7,  0,130,  3,  7,  0,131,  3,  7,  0,251,  2,
-  7,  0,132,  3,  7,  0,237,  0,  7,  0,133,  3,  4,  0,134,  3,  2,  0, 17,  0,  2,  0,135,  3,  2,  0,136,  3,  2,  0,137,  3,
-  2,  0,138,  3,  2,  0,139,  3,  2,  0,140,  3,  2,  0,141,  3,  2,  0,142,  3,  2,  0,143,  3,  2,  0,144,  3,  2,  0,145,  3,
-  4,  0,146,  3,  4,  0,147,  3,  4,  0,148,  3,  4,  0,149,  3,  7,  0,150,  3,  7,  0, 99,  2,  7,  0,151,  3,  7,  0,152,  3,
-  7,  0,153,  3,  7,  0,154,  3,  7,  0,155,  3,  7,  0,212,  0,  7,  0,156,  3,  7,  0,157,  3,  7,  0,158,  3,  7,  0,159,  3,
-  2,  0,160,  3,  0,  0,161,  3,  0,  0,106,  0,  0,  0,162,  3,  0,  0,163,  3,  7,  0,164,  3,  7,  0,165,  3, 12,  0,166,  3,
- 12,  0,167,  3, 12,  0,168,  3, 12,  0,169,  3,  7,  0,170,  3,  2,  0,252,  1,  2,  0,171,  3,  7,  0,134,  2,  4,  0,172,  3,
-  4,  0,173,  3,162,  0,174,  3,  2,  0,175,  3,  2,  0,244,  0,  7,  0,176,  3, 12,  0,177,  3, 12,  0,178,  3, 12,  0,179,  3,
- 12,  0,180,  3,163,  0, 64,  1,164,  0,181,  3, 58,  0,182,  3,  2,  0,183,  3,  2,  0,184,  3,  2,  0, 57,  2,  2,  0,185,  3,
-  7,  0,125,  2,  2,  0,186,  3,  2,  0,187,  3,146,  0,188,  3,134,  0,189,  3,134,  0,190,  3,  4,  0,191,  3,  4,  0,192,  3,
-  4,  0,193,  3,  4,  0,194,  3, 12,  0,195,  3, 12,  0,196,  3, 12,  0,197,  3,  7,  0,198,  3,  0,  0,199,  3,165,  0, 14,  0,
-165,  0,  0,  0,165,  0,  1,  0, 24,  0, 36,  0,  7,  0,251,  2,  7,  0, 69,  1,  7,  0,252,  2,  7,  0,244,  2,  0,  0, 18,  0,
-  4,  0,253,  2,  4,  0,254,  2,  4,  0,200,  3,  2,  0, 15,  0,  2,  0,201,  3,  7,  0,255,  2,166,  0, 12,  0,166,  0,  0,  0,
-166,  0,  1,  0, 24,  0, 42,  0,  4,  0,202,  3,  4,  0,252,  1,  4,  0,203,  3,  4,  0, 15,  0,  4,  0,204,  3,  7,  0, 69,  1,
-  7,  0,205,  3,  7,  0,206,  3,  7,  0,150,  2,163,  0, 40,  0,  4,  0, 17,  0,  2,  0,207,  3,  2,  0,208,  3,  2,  0,244,  2,
-  2,  0,209,  3,  2,  0,210,  3,  2,  0,211,  3,  2,  0,212,  3,  2,  0,213,  3,  7,  0,214,  3,  7,  0,215,  3,  7,  0,216,  3,
-  7,  0,217,  3,  7,  0,218,  3,  7,  0,219,  3,  7,  0,220,  3,  7,  0,221,  3,  7,  0,222,  3,  7,  0,223,  3,  7,  0,224,  3,
-  7,  0,225,  3,  7,  0,226,  3,  7,  0,227,  3,  7,  0,228,  3,  7,  0,229,  3,  7,  0,230,  3,  7,  0,231,  3,  7,  0,232,  3,
-  7,  0,233,  3,  7,  0,234,  3,  7,  0,235,  3,  7,  0,236,  3,  7,  0,237,  3,  7,  0,238,  3,  7,  0,239,  3,  7,  0,240,  3,
- 44,  0,160,  0,167,  0,241,  3,  7,  0,242,  3,  4,  0,195,  2,168,  0,  5,  0, 58,  0,232,  1,  7,  0,243,  3,  7,  0,244,  3,
-  2,  0, 17,  0,  2,  0,245,  3,169,  0,  5,  0,169,  0,  0,  0,169,  0,  1,  0,  4,  0, 15,  0,  4,  0,246,  3,  9,  0,  2,  0,
-170,  0,  9,  0,170,  0,  0,  0,170,  0,  1,  0,  4,  0,247,  3,  4,  0,248,  3,  4,  0,249,  3,  4,  0, 17,  0,  9,  0,250,  3,
-  9,  0,251,  3, 12,  0,252,  3,130,  0, 21,  0,130,  0,  0,  0,130,  0,  1,  0,  4,  0, 17,  0,  4,  0,253,  3,  4,  0,254,  3,
-  4,  0,255,  3,  4,  0,  0,  4,  4,  0,  1,  4,  4,  0,  2,  4,  4,  0,248,  3,  4,  0,252,  1,  2,  0,  3,  4,  2,  0, 54,  0,
-  0,  0,  4,  4,  0,  0,  5,  4,  0,  0,  6,  4,  0,  0,  7,  4,  0,  0,  8,  4, 12,  0,  9,  4,171,  0, 10,  4,  9,  0, 11,  4,
-172,  0,  1,  0,  7,  0, 37,  2,162,  0, 30,  0,  4,  0, 17,  0,  7,  0, 12,  4,  7,  0, 13,  4,  7,  0, 14,  4,  4,  0, 15,  4,
-  4,  0, 16,  4,  4,  0, 17,  4,  4,  0, 18,  4,  7,  0, 19,  4,  7,  0, 20,  4,  7,  0, 21,  4,  7,  0, 22,  4,  7,  0, 23,  4,
-  7,  0, 24,  4,  7,  0, 25,  4,  7,  0, 26,  4,  7,  0, 27,  4,  7,  0, 28,  4,  7,  0, 29,  4,  7,  0, 30,  4,  7,  0, 31,  4,
-  7,  0, 32,  4,  7,  0, 33,  4,  7,  0, 34,  4,  7,  0, 35,  4,  7,  0, 36,  4,  4,  0, 37,  4,  4,  0, 38,  4,  7,  0, 39,  4,
-  7,  0,156,  3,164,  0, 54,  0,  4,  0,248,  3,  4,  0, 40,  4,173,  0, 41,  4,174,  0, 42,  4,  0,  0, 35,  0,  0,  0, 43,  4,
-  2,  0, 44,  4,  7,  0, 45,  4,  0,  0, 46,  4,  7,  0, 47,  4,  7,  0, 48,  4,  7,  0, 49,  4,  7,  0, 50,  4,  7,  0, 51,  4,
-  7,  0, 52,  4,  7,  0, 53,  4,  7,  0, 54,  4,  7,  0, 55,  4,  2,  0, 56,  4,  0,  0, 57,  4,  2,  0, 58,  4,  7,  0, 59,  4,
-  7,  0, 60,  4,  0,  0, 61,  4,  4,  0,121,  0,  4,  0, 62,  4,  4,  0, 63,  4,  2,  0, 64,  4,  2,  0, 65,  4,172,  0, 66,  4,
-  4,  0, 67,  4,  4,  0, 79,  0,  7,  0, 68,  4,  7,  0, 69,  4,  7,  0, 70,  4,  7,  0, 71,  4,  2,  0, 72,  4,  2,  0, 73,  4,
-  2,  0, 74,  4,  2,  0, 75,  4,  2,  0, 76,  4,  2,  0, 77,  4,  2,  0, 78,  4,  2,  0, 79,  4,175,  0, 80,  4,  7,  0, 81,  4,
-  7,  0, 82,  4,130,  0, 83,  4, 12,  0,  4,  3,168,  0, 84,  4,  7,  0, 85,  4,  7,  0, 86,  4,  7,  0, 87,  4,  0,  0, 88,  4,
-176,  0,  1,  0,  7,  0, 89,  4,146,  0, 50,  0,145,  0, 90,  4,  2,  0, 15,  0,  2,  0, 91,  4,  2,  0, 92,  4,  2,  0, 93,  4,
-  7,  0, 94,  4,  2,  0, 95,  4,  2,  0, 96,  4,  7,  0, 97,  4,  2,  0, 98,  4,  2,  0, 99,  4,  7,  0,100,  4,  7,  0,101,  4,
-  7,  0,102,  4,  4,  0,103,  4,  4,  0,104,  4,  7,  0,105,  4,  4,  0,106,  4,  7,  0,107,  4,  7,  0,108,  4,  7,  0,109,  4,
- 73,  0,110,  4, 73,  0,111,  4,  0,  0,112,  4,  7,  0,113,  4,  7,  0,114,  4, 28,  0, 77,  0,  2,  0,115,  4,  0,  0,116,  4,
-  0,  0,117,  4,  7,  0,118,  4,  4,  0,119,  4,  7,  0,120,  4,  7,  0,121,  4,  4,  0,122,  4,  4,  0, 17,  0,  7,  0,123,  4,
-  7,  0,124,  4,  7,  0,125,  4,176,  0,126,  4,  4,  0, 51,  0,  7,  0,127,  4,  7,  0,128,  4,  7,  0,129,  4,  7,  0,130,  4,
-  7,  0,131,  4,  7,  0,132,  4,  7,  0,133,  4,  4,  0,134,  4,  4,  0, 35,  0,177,  0, 76,  0, 19,  0, 29,  0, 31,  0, 72,  0,
-  2,  0,170,  0,  2,  0, 73,  1,  2,  0,107,  1,  2,  0,135,  4,  7,  0,136,  4,  7,  0,137,  4,  7,  0,138,  4,  7,  0,139,  4,
-  7,  0,140,  4,  7,  0,141,  4,  7,  0,153,  1,  7,  0,155,  1,  7,  0,154,  1,  7,  0, 67,  0,  4,  0,142,  4,  7,  0,143,  4,
-  7,  0,144,  4,  7,  0,145,  4,  7,  0,146,  4,  7,  0,147,  4,  7,  0,148,  4,  7,  0,149,  4,  2,  0,150,  4,  2,  0, 72,  1,
-  2,  0,151,  4,  2,  0,152,  4,  2,  0,153,  4,  2,  0,154,  4,  2,  0,155,  4,  2,  0,156,  4,  7,  0,157,  4,  7,  0,158,  4,
-  7,  0,159,  4,  7,  0,160,  4,  7,  0,161,  4,  7,  0,162,  4,  7,  0,163,  4,  7,  0,164,  4,  7,  0,165,  4,  7,  0,166,  4,
-  7,  0,167,  4,  7,  0,168,  4,  2,  0,169,  4,  2,  0,170,  4,  2,  0,171,  4,  2,  0,172,  4,  7,  0,173,  4,  7,  0,174,  4,
-  7,  0,175,  4,  7,  0,176,  4,  2,  0,177,  4,  2,  0,178,  4,  2,  0,179,  4,  2,  0,180,  4,  7,  0,181,  4,  7,  0,182,  4,
-  7,  0,183,  4,  7,  0,184,  4,  7,  0,185,  4,  7,  0,186,  4,  7,  0,187,  4,  2,  0,188,  4,  2,  0,189,  4,  2,  0,190,  4,
-  2,  0,191,  4,  2,  0,192,  4,  2,  0, 17,  0,  7,  0,193,  4,  7,  0,194,  4, 28,  0, 77,  0, 43,  0,125,  1,  2,  0,126,  1,
-  2,  0,195,  4, 22,  0,146,  0,178,  0,  8,  0,178,  0,  0,  0,178,  0,  1,  0,  4,  0,134,  3,  4,  0,196,  4,  4,  0, 17,  0,
-  2,  0,197,  4,  2,  0,198,  4, 24,  0,159,  0,179,  0, 13,  0,  9,  0,199,  4,  9,  0,200,  4,  4,  0,201,  4,  4,  0,202,  4,
-  4,  0,203,  4,  4,  0,204,  4,  4,  0,205,  4,  4,  0,206,  4,  4,  0,207,  4,  4,  0,208,  4,  4,  0,209,  4,  4,  0, 35,  0,
-  0,  0,210,  4,180,  0,  5,  0,  9,  0,211,  4,  9,  0,212,  4,  4,  0,213,  4,  4,  0, 67,  0,  0,  0,214,  4,181,  0, 17,  0,
-  4,  0,215,  4,  4,  0,216,  4,  4,  0,217,  4,  4,  0,218,  4,  4,  0,219,  4,  4,  0,220,  4,  4,  0,221,  4,  4,  0,222,  4,
-  4,  0,223,  4,  4,  0,224,  4,  4,  0,225,  4,  4,  0,226,  4,  2,  0,227,  4,  2,  0,228,  4,  4,  0,229,  4,  4,  0,230,  4,
-  4,  0, 87,  0,182,  0, 15,  0,  4,  0, 15,  0,  4,  0,217,  4,  4,  0,231,  4,  4,  0,232,  4,  4,  0,233,  4,  4,  0,234,  4,
-  7,  0,235,  4,  4,  0,236,  4,  4,  0, 88,  0,  4,  0,237,  4,  4,  0,238,  4,  4,  0,239,  4,  4,  0,240,  4,  4,  0,241,  4,
- 18,  0, 28,  0,183,  0,  7,  0,  4,  0,242,  4,  7,  0,243,  4,  7,  0,244,  4,  7,  0,245,  4,  4,  0,246,  4,  2,  0, 17,  0,
-  2,  0, 35,  0,184,  0, 11,  0,184,  0,  0,  0,184,  0,  1,  0,  0,  0, 18,  0, 57,  0,247,  4, 58,  0,248,  4,  4,  0,134,  3,
-  4,  0,249,  4,  4,  0,250,  4,  4,  0, 35,  0,  4,  0,251,  4,  4,  0,252,  4,185,  0,105,  0,179,  0,253,  4,180,  0,254,  4,
-181,  0,255,  4,182,  0,  0,  5,  4,  0, 19,  3,  4,  0,121,  0,  4,  0, 62,  4,  7,  0,  1,  5,  4,  0,  2,  5,  4,  0,  3,  5,
-  4,  0,  4,  5,  4,  0,  5,  5,  2,  0, 17,  0,  2,  0,  6,  5,  7,  0,  7,  5,  7,  0,  8,  5,  7,  0,  9,  5,  7,  0, 10,  5,
-  7,  0, 11,  5,  2,  0, 12,  5,  2,  0, 13,  5,  2,  0, 14,  5,  2,  0, 15,  5,  2,  0,243,  0,  2,  0, 16,  5,  4,  0, 17,  5,
-  2,  0, 18,  5,  2,  0, 19,  5,  2,  0, 94,  1,  2,  0,104,  0,  2,  0, 20,  5,  2,  0, 21,  5,  2,  0, 22,  5,  2,  0, 23,  5,
-  2,  0, 24,  5,  2,  0, 25,  5,  2,  0, 26,  5,  2,  0, 27,  5,  2,  0, 28,  5,  2,  0, 29,  5,  4,  0, 30,  5,  4,  0, 72,  1,
-  4,  0, 31,  5,  2,  0, 32,  5,  2,  0, 33,  5,  2,  0, 34,  5,  2,  0, 35,  5,  2,  0, 36,  5,  2,  0, 37,  5,  2,  0, 38,  5,
-  2,  0, 39,  5, 16,  0, 40,  5, 16,  0, 41,  5, 15,  0, 42,  5, 12,  0, 43,  5,  2,  0, 44,  5,  2,  0, 45,  5,  7,  0, 46,  5,
-  7,  0, 47,  5,  7,  0, 48,  5,  7,  0, 49,  5,  4,  0, 50,  5,  7,  0, 51,  5,  7,  0, 52,  5,  7,  0, 53,  5,  7,  0, 54,  5,
-  2,  0, 55,  5,  2,  0, 56,  5,  2,  0, 57,  5,  2,  0, 58,  5,  2,  0, 59,  5,  2,  0, 60,  5,  7,  0, 61,  5,  7,  0, 62,  5,
-  7,  0, 63,  5,  0,  0, 64,  5,  4,  0, 65,  5,  2,  0, 66,  5,  2,  0,229,  1,  0,  0, 67,  5,  7,  0, 68,  5,  7,  0, 69,  5,
-  0,  0, 70,  5,  0,  0, 71,  5,  0,  0, 72,  5,  0,  0, 73,  5,  4,  0, 74,  5,  2,  0, 75,  5,  2,  0, 76,  5,  7,  0, 77,  5,
-  7,  0, 78,  5,  2,  0, 79,  5,  2,  0, 80,  5,  7,  0, 81,  5,  2,  0, 82,  5,  2,  0, 83,  5,  4,  0, 84,  5,  2,  0, 85,  5,
-  2,  0, 86,  5,  2,  0, 87,  5,  2,  0, 88,  5,  7,  0, 89,  5,  7,  0, 67,  0, 34,  0, 90,  5,  0,  0, 91,  5,186,  0,  9,  0,
-186,  0,  0,  0,186,  0,  1,  0,  0,  0, 18,  0,  2,  0, 92,  5,  2,  0, 93,  5,  2,  0, 94,  5,  2,  0, 87,  0,  7,  0, 95,  5,
-  7,  0, 67,  0,187,  0,  7,  0,  2,  0,212,  2,  2,  0, 72,  1,  2,  0, 76,  3,  2,  0, 96,  5,  7,  0, 97,  5,  7,  0, 67,  0,
- 34,  0, 98,  5,188,  0,  5,  0,  7,  0, 99,  5,  0,  0, 15,  0,  0,  0, 87,  0,  0,  0, 67,  0,  0,  0,229,  1,189,  0, 28,  0,
-  7,  0,148,  4,  7,  0,149,  4,  2,  0, 72,  1,  2,  0, 17,  0,  2,  0,100,  5,  2,  0,195,  4,  2,  0,151,  4,  2,  0,152,  4,
-  2,  0,153,  4,  2,  0,154,  4,  2,  0,155,  4,  2,  0,156,  4,188,  0,101,  5,  2,  0, 12,  5,  2,  0, 13,  5,  2,  0, 14,  5,
-  2,  0, 15,  5,  2,  0,243,  0,  2,  0, 16,  5,  2,  0,102,  5,  2,  0,103,  5,187,  0,104,  5,  2,  0,105,  5,  2,  0, 18,  5,
-  2,  0, 21,  5,  2,  0, 22,  5,  7,  0,106,  5,  7,  0, 87,  0,190,  0,  6,  0,190,  0,  0,  0,190,  0,  1,  0,  4,  0,247,  3,
-  0,  0,  4,  4,  4,  0, 17,  0, 24,  0,107,  5,191,  0,  4,  0,192,  0,108,  5,  9,  0,109,  5,  0,  0,110,  5,  4,  0, 88,  0,
-193,  0,  8,  0,191,  0,111,  5,  2,  0, 17,  0,  2,  0, 35,  0,  2,  0,112,  5,  2,  0,113,  5,  2,  0,114,  5,  4,  0, 87,  0,
-  9,  0,115,  5,194,  0,  6,  0,  2,  0,104,  0,  2,  0,253,  3,  2,  0,116,  5,  2,  0,206,  2,  4,  0, 17,  0,  7,  0,223,  2,
-195,  0, 14,  0,  2,  0, 17,  0,  2,  0,117,  5,  2,  0,118,  5,  2,  0,119,  5,194,  0,120,  5,  9,  0,115,  5,  7,  0,121,  5,
-  7,  0, 54,  0,  4,  0,122,  5,  4,  0,123,  5,  4,  0,124,  5,  4,  0,125,  5, 38,  0,117,  0, 24,  0,159,  0,196,  0,  4,  0,
-196,  0,  0,  0,196,  0,  1,  0,  0,  0,126,  5,  7,  0,127,  5,197,  0, 14,  0,191,  0,111,  5,  4,  0, 88,  0,  4,  0,128,  5,
-  7,  0,129,  5,  7,  0,130,  5,  7,  0,131,  5,  4,  0,132,  5,  4,  0,133,  5,  7,  0,134,  5,  7,  0,135,  5,  4,  0,136,  5,
-  7,  0,137,  5,  7,  0,138,  5,  4,  0, 35,  0,198,  0,  7,  0,191,  0,111,  5,  2,  0, 17,  0,  2,  0, 35,  0,  4,  0, 34,  0,
-  4,  0,139,  5, 79,  0,140,  5,  9,  0,115,  5,199,  0, 82,  0,198,  0,141,  5,198,  0,142,  5,197,  0, 99,  3,  7,  0,143,  5,
-  2,  0,144,  5,  2,  0,145,  5,  7,  0,146,  5,  7,  0,147,  5,  2,  0,253,  3,  2,  0,148,  5,  7,  0,149,  5,  7,  0,150,  5,
-  7,  0,151,  5,  2,  0,152,  5,  2,  0,122,  5,  2,  0,153,  5,  2,  0,154,  5,  2,  0,155,  5,  2,  0,156,  5,  7,  0,157,  5,
-  7,  0,158,  5,  7,  0,159,  5,  2,  0,160,  5,  2,  0,161,  5,  2,  0,162,  5,  2,  0,163,  5,  2,  0,164,  5,  2,  0,165,  5,
-  2,  0,166,  5,  2,  0,167,  5,193,  0,168,  5,195,  0,169,  5,  7,  0,170,  5,  7,  0,171,  5,  7,  0,172,  5,  2,  0,173,  5,
-  2,  0,174,  5,  0,  0,175,  5,  0,  0,176,  5,  0,  0,177,  5,  0,  0,178,  5,  0,  0,179,  5,  0,  0,180,  5,  2,  0,181,  5,
-  7,  0,182,  5,  7,  0,183,  5,  7,  0,184,  5,  7,  0,185,  5,  7,  0,186,  5,  7,  0,187,  5,  7,  0,188,  5,  7,  0,189,  5,
-  7,  0,190,  5,  7,  0,191,  5,  2,  0,192,  5,  0,  0,193,  5,  0,  0,194,  5,  0,  0,195,  5,  0,  0,196,  5, 24,  0,197,  5,
-  0,  0,198,  5,  0,  0,199,  5,  0,  0,200,  5,  0,  0,201,  5,  0,  0,202,  5,  0,  0,203,  5,  0,  0,204,  5,  0,  0,205,  5,
-  0,  0,206,  5,  0,  0,207,  5,  2,  0,208,  5,  2,  0,209,  5,  2,  0,210,  5,  2,  0,211,  5,  0,  0,212,  5,  0,  0,195,  4,
-  4,  0,213,  5,  2,  0,214,  5,  2,  0, 87,  0,  4,  0,215,  5,  7,  0,216,  5,  7,  0,217,  5,200,  0,  8,  0,  4,  0,218,  5,
-  4,  0,219,  5,  4,  0,220,  5,  4,  0,221,  5,  4,  0,222,  5,  4,  0,223,  5,  4,  0, 51,  0,  4,  0,122,  2,201,  0,  4,  0,
-  7,  0,224,  5,  0,  0,225,  5,  0,  0,226,  5,  2,  0, 17,  0,202,  0,  4,  0,  7,  0,227,  5,  4,  0, 17,  0,  4,  0,228,  5,
-  4,  0, 54,  0, 38,  0, 44,  0, 19,  0, 29,  0, 31,  0, 72,  0, 24,  0,107,  5,177,  0,229,  5, 38,  0,230,  5, 12,  0,231,  5,
-178,  0,232,  5, 24,  0,233,  5,  7,  0,234,  5,  7,  0,235,  5,  7,  0,236,  5,  7,  0,237,  5,  4,  0,134,  3,  4,  0,238,  5,
-  4,  0,239,  5,  4,  0,192,  3,  4,  0,240,  5,  2,  0, 17,  0,  2,  0, 66,  1, 53,  0, 61,  1,203,  0,241,  5,199,  0,242,  5,
-204,  0,243,  5,185,  0,177,  0,183,  0,244,  5, 12,  0, 98,  0, 12,  0,245,  5,  9,  0,246,  5,  9,  0,247,  5,  9,  0,248,  5,
-  9,  0,249,  5,205,  0,250,  5,  2,  0,251,  5,  2,  0,252,  5,  2,  0,244,  0,  2,  0,253,  5,  4,  0,254,  5,  4,  0,255,  5,
- 12,  0,  0,  6,188,  0,101,  5,189,  0,  1,  6,201,  0,  2,  6,159,  0,112,  3,202,  0,  3,  6,206,  0, 11,  0,206,  0,  0,  0,
-206,  0,  1,  0, 39,  0,235,  0, 37,  0, 60,  1,  7,  0, 87,  2,  7,  0, 88,  2,  7,  0,104,  0,  7,  0,  4,  6,  2,  0,  5,  6,
-  2,  0, 17,  0,  7,  0, 67,  0,207,  0, 38,  0,  7,  0,  6,  6,  7,  0,  7,  6,  7,  0,  8,  6,  7,  0,  9,  6,  7,  0, 10,  6,
-  7,  0, 11,  6,  7,  0, 12,  6,  7,  0, 13,  6,  7,  0, 14,  6,  7,  0, 79,  1,  7,  0, 15,  6,  7,  0, 16,  6,  7,  0, 17,  6,
-  7,  0, 18,  6,  7,  0,166,  0,  2,  0, 19,  6,  2,  0, 20,  6,  0,  0, 21,  6,  0,  0,195,  4,  2,  0, 22,  6,  2,  0, 23,  6,
-  2,  0, 24,  6,  2,  0,  5,  6,  7,  0, 25,  6,  7,  0, 26,  6, 62,  0, 27,  6,159,  0,112,  3,207,  0, 28,  6,208,  0, 29,  6,
-209,  0, 30,  6,210,  0, 31,  6,211,  0, 32,  6,  7,  0, 33,  6,  2,  0, 34,  6,  2,  0, 35,  6,  7,  0, 36,  6,  7,  0, 37,  6,
-  7,  0, 38,  6,212,  0, 50,  0,213,  0,  0,  0,213,  0,  1,  0, 12,  0, 39,  6,  4,  0, 40,  6,  7,  0, 41,  6,  2,  0, 42,  6,
-  7,  0, 14,  6,  7,  0, 79,  1,  7,  0, 87,  0,  4,  0, 43,  6,  2,  0, 24,  6,  2,  0,  5,  6, 24,  0,107,  5, 24,  0, 44,  6,
- 12,  0, 45,  6,206,  0, 46,  6,212,  0, 28,  6,  0,  0, 47,  6,  4,  0,134,  3,  4,  0,238,  5,  2,  0, 48,  6,  2,  0, 49,  6,
-  2,  0, 50,  6,  2,  0, 51,  6,  2,  0, 17,  0,  2,  0, 22,  2,  7,  0,110,  0,  7,  0, 52,  6,  7,  0, 53,  6,  7,  0, 54,  6,
-  7,  0,166,  0,  7,  0,234,  5,  2,  0, 55,  6,  2,  0, 56,  6,  2,  0, 57,  6,  0,  0, 58,  6,  0,  0, 59,  6,  0,  0, 60,  6,
-  0,  0, 61,  6,  0,  0, 62,  6, 12,  0, 63,  6, 12,  0, 64,  6, 12,  0, 65,  6,  2,  0, 66,  6,  2,  0,135,  2,  2,  0, 67,  6,
-  0,  0, 68,  6,  0,  0, 69,  6,  9,  0, 70,  6,159,  0,112,  3,214,  0, 24,  0, 16,  0, 34,  0, 16,  0, 61,  0, 15,  0, 71,  6,
- 15,  0, 72,  6, 15,  0, 73,  6,  7,  0, 74,  6,  7,  0, 75,  6,  7,  0, 76,  6,  7,  0, 77,  6,  2,  0, 78,  6,  2,  0, 79,  6,
-  2,  0, 80,  6,  2,  0, 81,  6,  2,  0, 82,  6,  2,  0, 17,  0,  2,  0, 83,  6,  2,  0, 84,  6,  2,  0, 85,  6,  2,  0, 86,  6,
-  2,  0, 87,  6,  2,  0, 51,  6,  7,  0, 88,  6,  4,  0, 89,  6,  4,  0, 90,  6,213,  0,  6,  0,213,  0,  0,  0,213,  0,  1,  0,
- 12,  0, 39,  6,  4,  0, 40,  6,  7,  0, 41,  6,  2,  0, 42,  6,215,  0,  8,  0,213,  0,  0,  0,213,  0,  1,  0, 12,  0, 39,  6,
-  4,  0, 40,  6,  7,  0, 41,  6,  2,  0, 42,  6,  0,  0, 91,  6,  0,  0,176,  0,216,  0, 14,  0,213,  0,  0,  0,213,  0,  1,  0,
- 12,  0, 39,  6,  4,  0, 40,  6,  7,  0, 41,  6,  2,  0, 42,  6,214,  0, 92,  6,217,  0, 93,  6, 12,  0, 94,  6,  2,  0, 72,  1,
-  2,  0, 95,  6,  4,  0, 17,  0,  7,  0, 96,  6,  4,  0, 51,  6,218,  0, 21,  0,213,  0,  0,  0,213,  0,  1,  0, 12,  0, 39,  6,
-  4,  0, 40,  6,  7,  0, 41,  6,  2,  0, 42,  6,208,  0, 29,  6,214,  0, 92,  6,  2,  0, 97,  6,  2,  0, 98,  6,  2,  0, 99,  6,
-  2,  0,100,  6,  2,  0, 83,  6,  2,  0,101,  6,  2,  0,102,  6,  0,  0, 17,  0,  0,  0, 35,  0,  9,  0, 63,  2,  4,  0,103,  6,
-  4,  0,104,  6, 19,  0,105,  6,219,  0, 18,  0,213,  0,  0,  0,213,  0,  1,  0, 12,  0, 39,  6,  4,  0, 40,  6,  7,  0, 41,  6,
-  2,  0, 42,  6,214,  0, 92,  6,  7,  0, 87,  2,  7,  0, 88,  2,  2,  0, 97,  6,  2,  0,106,  6,  2,  0,107,  6,  2,  0,108,  6,
-  4,  0, 17,  0,  7,  0,109,  6,  4,  0,  5,  6,  4,  0, 35,  0,159,  0,112,  3,220,  0, 16,  0,  0,  0,110,  6,  0,  0,111,  6,
-  0,  0,112,  6,  0,  0,113,  6,  0,  0,114,  6,  0,  0,115,  6,  4,  0,116,  6,  4,  0,117,  6,  4,  0,118,  6,  2,  0, 15,  0,
-  2,  0, 17,  0,  2,  0,119,  6,  2,  0,120,  6,  2,  0,172,  1,  2,  0,121,  6,  0,  0,122,  6,221,  0, 16,  0,213,  0,  0,  0,
-213,  0,  1,  0, 12,  0, 39,  6,  4,  0, 40,  6,  4,  0,123,  6,220,  0,124,  6,222,  0,125,  6, 12,  0,126,  6, 12,  0,127,  6,
-223,  0,128,  6,211,  0,129,  6,224,  0,130,  6,  2,  0,131,  6,  2,  0,132,  6,  2,  0,133,  6,  2,  0, 67,  0,225,  0, 15,  0,
-213,  0,  0,  0,213,  0,  1,  0, 12,  0, 39,  6,  4,  0, 40,  6,  7,  0, 41,  6,  2,  0, 42,  6,214,  0, 92,  6, 12,  0,134,  6,
-226,  0,135,  6,  0,  0,136,  6,227,  0,137,  6,  2,  0, 17,  0,  2,  0,138,  6,  2,  0,139,  6,  2,  0,140,  6,228,  0, 25,  0,
-213,  0,  0,  0,213,  0,  1,  0, 12,  0, 39,  6,  4,  0, 40,  6,  4,  0, 17,  0, 39,  0,227,  2, 37,  0, 60,  1, 51,  0,141,  6,
-229,  0,142,  6,230,  0,143,  6,159,  0,112,  3,  7,  0,144,  6,  7,  0, 87,  2,  7,  0, 88,  2,  7,  0,109,  6,  7,  0,145,  6,
-  7,  0,146,  6,  2,  0,147,  6,  2,  0,148,  6,  2,  0,149,  6,  2,  0,150,  6,  0,  0,151,  6,  0,  0,152,  6,  0,  0,153,  6,
-  0,  0, 51,  6,231,  0, 11,  0,213,  0,  0,  0,213,  0,  1,  0, 12,  0, 39,  6,  4,  0, 40,  6,  7,  0, 41,  6,  2,  0, 42,  6,
-  2,  0, 95,  6,  2,  0, 17,  0,  4,  0, 35,  0,217,  0, 93,  6,214,  0, 92,  6,232,  0, 31,  0,213,  0,  0,  0,213,  0,  1,  0,
- 12,  0, 39,  6,  4,  0, 40,  6,  7,  0, 41,  6,  2,  0, 42,  6, 34,  0,154,  6,  4,  0,155,  6,  4,  0,156,  6,  2,  0, 88,  0,
-  2,  0,157,  6,  2,  0,158,  6,  0,  0,159,  6,  0,  0,160,  6,  4,  0,161,  6,  4,  0,162,  6,  4,  0,163,  6,  2,  0,164,  6,
-  2,  0,165,  6,  2,  0,166,  6,  2,  0,167,  6,  7,  0,168,  6, 15,  0,169,  6, 15,  0,170,  6,  4,  0,171,  6,  4,  0,172,  6,
-  0,  0,173,  6,  0,  0,174,  6,  2,  0,175,  6,  0,  0,192,  2,  9,  0,176,  6,233,  0, 10,  0, 19,  0, 29,  0,  9,  0,177,  6,
-  9,  0,178,  6,  9,  0,179,  6,  9,  0,180,  6,  9,  0,181,  6,  4,  0, 88,  0,  4,  0,182,  6,  0,  0,183,  6,  0,  0,184,  6,
-234,  0, 10,  0,213,  0,  0,  0,213,  0,  1,  0, 12,  0, 39,  6,  4,  0, 40,  6,  7,  0, 41,  6,233,  0,185,  6,  2,  0, 88,  0,
-  2,  0,157,  6,  4,  0, 87,  0,  9,  0,186,  6,235,  0,  3,  0,235,  0,  0,  0,235,  0,  1,  0,  7,  0,187,  6,236,  0, 11,  0,
-213,  0,  0,  0,213,  0,  1,  0, 12,  0, 39,  6,  4,  0, 40,  6,  7,  0, 41,  6,214,  0, 92,  6, 12,  0,188,  6,  4,  0,189,  6,
-  4,  0, 35,  0,  4,  0, 17,  0,  4,  0,190,  6,237,  0, 26,  0,213,  0,  0,  0,213,  0,  1,  0, 12,  0, 39,  6,  4,  0, 40,  6,
-  7,  0, 41,  6,  2,  0, 42,  6,214,  0, 92,  6, 19,  0,191,  6, 19,  0, 78,  0,  2,  0, 17,  0,  2,  0,157,  6,  7,  0,192,  6,
-  9,  0,193,  6,  7,  0, 87,  2,  7,  0, 88,  2,  7,  0,109,  6,  7,  0, 38,  6,  7,  0,194,  6,  7,  0,195,  6, 53,  0, 61,  1,
- 53,  0,196,  6,  4,  0,197,  6,  2,  0,198,  6,  2,  0,244,  0, 12,  0,199,  6,159,  0,112,  3,238,  0, 10,  0,213,  0,  0,  0,
-213,  0,  1,  0, 12,  0, 39,  6,  4,  0, 40,  6,  7,  0, 41,  6,  2,  0, 42,  6,  2,  0, 17,  0,  2,  0,143,  3,  4,  0, 35,  0,
-159,  0,112,  3,239,  0, 42,  0,213,  0,  0,  0,213,  0,  1,  0, 12,  0, 39,  6,  4,  0, 40,  6,  7,  0, 41,  6,  2,  0, 42,  6,
-214,  0, 92,  6,222,  0,125,  6,  0,  0,200,  6,  0,  0,111,  6,  0,  0,112,  6,  2,  0, 15,  0,  2,  0,201,  6,  2,  0, 17,  0,
-  2,  0,119,  6,  9,  0,193,  6,  4,  0,116,  6,  4,  0,202,  6,  4,  0,203,  6,  4,  0,204,  6, 15,  0,205,  6, 15,  0,206,  6,
-  7,  0,207,  6,  7,  0,208,  6,  7,  0,209,  6,  7,  0,192,  6,  2,  0,210,  6,  2,  0,234,  0,  2,  0,172,  1,  2,  0,211,  6,
-  2,  0, 35,  0,  2,  0, 87,  0,  2,  0,212,  6,  2,  0,213,  6,  9,  0,214,  6,  9,  0,215,  6,  9,  0,216,  6,  9,  0,217,  6,
-  9,  0,218,  6,  2,  0,219,  6,  0,  0,220,  6, 49,  0,221,  6,240,  0,  7,  0,240,  0,  0,  0,240,  0,  1,  0,  4,  0,222,  6,
-  4,  0, 21,  0,  0,  0, 81,  0,  4,  0,223,  6,  4,  0, 15,  0,241,  0, 14,  0,213,  0,  0,  0,213,  0,  1,  0, 12,  0, 39,  6,
-  4,  0, 40,  6,  7,  0, 41,  6,  2,  0, 42,  6,  4,  0,158,  6,  4,  0, 35,  0, 12,  0,224,  6, 12,  0,225,  6,  0,  0,226,  6,
-  0,  0,227,  6,  4,  0,228,  6,  4,  0,229,  6,242,  0,  6,  0,213,  0,  0,  0,213,  0,  1,  0, 12,  0, 39,  6,  4,  0, 40,  6,
-  4,  0, 35,  0,  0,  0,230,  6,243,  0, 15,  0,213,  0,  0,  0,213,  0,  1,  0, 12,  0, 39,  6,  4,  0, 40,  6,  7,  0, 41,  6,
-244,  0,231,  6,214,  0, 92,  6,245,  0,232,  6,  2,  0, 72,  1,  2,  0,233,  6,  2,  0, 87,  2,  2,  0, 88,  2,  2,  0, 17,  0,
-  2,  0,149,  6,  4,  0, 67,  0,246,  0,  7,  0,246,  0,  0,  0,246,  0,  1,  0,  0,  0,234,  6,  2,  0,235,  6,  2,  0,236,  6,
-  2,  0,237,  6,  2,  0, 35,  0,247,  0, 12,  0,  2,  0,236,  6,  2,  0,238,  6,  2,  0,239,  6,  0,  0,192,  2,  2,  0,240,  6,
-  2,  0,241,  6,  2,  0,242,  6,  2,  0,243,  6,  2,  0,244,  6,  2,  0, 83,  6,  7,  0,245,  6,  7,  0,246,  6,248,  0, 18,  0,
-248,  0,  0,  0,248,  0,  1,  0,  0,  0,  4,  4,247,  0,247,  6,247,  0,248,  6,247,  0,249,  6,247,  0,250,  6,  7,  0,251,  6,
-  2,  0,252,  6,  2,  0,253,  6,  2,  0,254,  6,  2,  0,255,  6,  2,  0,  0,  7,  2,  0,  1,  7,  2,  0,  2,  7,  2,  0,  3,  7,
-  2,  0,  4,  7,  2,  0,  5,  7,249,  0, 10,  0,  0,  0,  6,  7,  0,  0,  7,  7,  0,  0,  8,  7,  0,  0,  9,  7,  0,  0, 10,  7,
-  0,  0, 11,  7,  2,  0, 12,  7,  2,  0, 13,  7,  2,  0, 14,  7,  2,  0, 15,  7,250,  0,  8,  0,  0,  0, 16,  7,  0,  0, 17,  7,
-  0,  0, 18,  7,  0,  0, 19,  7,  0,  0, 20,  7,  0,  0, 21,  7,  7,  0,  4,  6,  7,  0, 35,  0,251,  0, 18,  0,249,  0, 22,  7,
-249,  0, 23,  7,249,  0, 24,  7,249,  0, 25,  7,249,  0, 26,  7,249,  0, 27,  7,249,  0, 28,  7,249,  0, 29,  7,249,  0, 30,  7,
-249,  0, 31,  7,249,  0, 32,  7,249,  0, 33,  7,249,  0, 34,  7,249,  0, 35,  7,249,  0, 36,  7,249,  0, 37,  7,250,  0, 38,  7,
-  0,  0, 39,  7,252,  0, 97,  0,  0,  0, 40,  7,  0,  0, 41,  7,  0,  0, 10,  7,  0,  0, 42,  7,  0,  0, 43,  7,  0,  0, 44,  7,
-  0,  0, 45,  7,  0,  0, 46,  7,  0,  0, 47,  7,  0,  0, 48,  7,  0,  0, 49,  7,  0,  0, 50,  7,  0,  0, 51,  7,  0,  0, 52,  7,
-  0,  0, 53,  7,  0,  0, 54,  7,  0,  0, 55,  7,  0,  0, 56,  7,  0,  0, 57,  7,  0,  0, 58,  7,  0,  0, 59,  7,  0,  0, 60,  7,
-  0,  0, 61,  7,  0,  0, 62,  7,  0,  0, 63,  7,  0,  0, 64,  7,  0,  0, 65,  7,  0,  0, 66,  7,  0,  0, 67,  7,  0,  0, 68,  7,
-  0,  0, 69,  7,  0,  0, 70,  7,  0,  0, 71,  7,  0,  0, 72,  7,  0,  0, 73,  7,  0,  0, 74,  7,  0,  0, 75,  7,  0,  0, 76,  7,
-  0,  0, 77,  7,  0,  0, 78,  7,  0,  0, 79,  7,  0,  0, 80,  7,  0,  0, 81,  7,  0,  0, 82,  7,  0,  0, 83,  7,  0,  0, 84,  7,
-  0,  0, 85,  7,  0,  0, 86,  7,  0,  0, 87,  7,  0,  0, 88,  7,  0,  0, 89,  7,  0,  0, 90,  7,  0,  0, 91,  7,  0,  0, 92,  7,
-  0,  0, 93,  7,  0,  0, 94,  7,  0,  0, 95,  7,  0,  0, 96,  7,  0,  0, 97,  7,  0,  0, 98,  7,  0,  0, 99,  7,  0,  0,100,  7,
-  0,  0,101,  7,  0,  0,102,  7,  0,  0,103,  7,  0,  0,104,  7,  0,  0,105,  7,  0,  0,106,  7,  0,  0,107,  7,  0,  0,108,  7,
-  0,  0,109,  7,  0,  0,110,  7,  0,  0,111,  7,  0,  0,112,  7,  0,  0,113,  7,  0,  0,114,  7,  0,  0,115,  7,  0,  0,116,  7,
-  0,  0,117,  7,  0,  0,118,  7,  0,  0,119,  7,  0,  0,120,  7,  0,  0,121,  7,  0,  0,122,  7,  0,  0,123,  7,  0,  0,124,  7,
-  0,  0,125,  7,  0,  0,126,  7,  0,  0,127,  7,  0,  0,128,  7,  0,  0,129,  7,  0,  0,130,  7,  0,  0,131,  7,  0,  0,132,  7,
-  0,  0,133,  7,  0,  0,134,  7,  0,  0,135,  7,253,  0,  5,  0,  0,  0,136,  7,  0,  0, 64,  7,  0,  0, 66,  7,  2,  0, 17,  0,
-  2,  0, 35,  0,254,  0, 25,  0,254,  0,  0,  0,254,  0,  1,  0,  0,  0, 18,  0,251,  0,137,  7,252,  0,138,  7,252,  0,139,  7,
-252,  0,140,  7,252,  0,141,  7,252,  0,142,  7,252,  0,143,  7,252,  0,144,  7,252,  0,145,  7,252,  0,146,  7,252,  0,147,  7,
-252,  0,148,  7,252,  0,149,  7,252,  0,150,  7,252,  0,151,  7,252,  0,152,  7,252,  0,153,  7,252,  0,154,  7,252,  0,155,  7,
-253,  0,156,  7,  4,  0,157,  7,  4,  0, 35,  0,255,  0,  3,  0,255,  0,  0,  0,255,  0,  1,  0,  0,  0,158,  7,  0,  1,  5,  0,
-  4,  0, 17,  0,  4,  0, 35,  0,  7,  0,134,  2,  7,  0,159,  7,  7,  0, 37,  2,  1,  1, 89,  0,  4,  0, 17,  0,  4,  0,160,  7,
-  4,  0,161,  7,  0,  0,162,  7,  0,  0,163,  7,  0,  0,164,  7,  0,  0,165,  7,  0,  0,166,  7,  0,  0,167,  7,  0,  0,168,  7,
-  0,  0,169,  7,  0,  0,170,  7,  0,  0,171,  7,  4,  0,172,  7,  2,  0,173,  7,  2,  0,174,  7,  2,  0,175,  7,  2,  0,176,  7,
-  4,  0,177,  7,  4,  0,178,  7,  4,  0,179,  7,  4,  0,180,  7,  2,  0,181,  7,  2,  0,182,  7,  4,  0,183,  7,  4,  0,184,  7,
-  4,  0,185,  7,  4,  0,186,  7,  4,  0,187,  7,  4,  0,224,  6,  4,  0,188,  7,  2,  0,189,  7,  2,  0,190,  7,  2,  0,191,  7,
-  2,  0,192,  7, 12,  0,193,  7, 12,  0,194,  7, 12,  0,195,  7, 12,  0,196,  7, 12,  0,197,  7,  0,  0,198,  7,  2,  0,199,  7,
-  2,  0,200,  7,  2,  0,201,  7,  2,  0,202,  7,  2,  0,203,  7,  2,  0,204,  7,  2,  0,205,  7,  2,  0,206,  7,  0,  1,207,  7,
-  2,  0,208,  7,  2,  0,209,  7,  2,  0,210,  7,  2,  0,211,  7,  2,  0,212,  7,  2,  0,213,  7,  2,  0,214,  7,  2,  0,215,  7,
-  4,  0,216,  7,  4,  0,217,  7,  2,  0,218,  7,  2,  0,219,  7,  2,  0,220,  7,  2,  0,221,  7,  2,  0,222,  7,  2,  0,223,  7,
-  2,  0,224,  7,  2,  0,225,  7,  2,  0,226,  7,  2,  0,227,  7,  2,  0,228,  7,  2,  0,229,  7,  2,  0,230,  7,  2,  0,231,  7,
-  2,  0,232,  7,  2,  0,233,  7,  2,  0,234,  7,  2,  0,235,  7,  0,  0,236,  7,  0,  0,237,  7,  7,  0,238,  7,  2,  0,173,  5,
-  2,  0,174,  5,  2,  0,239,  7,  2,  0,240,  7, 47,  0,241,  7,  7,  0,242,  7,  4,  0,229,  1,  0,  0,243,  7,  2,  1, 24,  0,
- 19,  0, 29,  0, 12,  0,244,  7, 12,  0,245,  7, 12,  0,246,  7, 12,  0, 39,  6, 38,  0,117,  0, 38,  0,247,  7,  4,  0,248,  7,
-  4,  0, 87,  0,  2,  0,249,  7,  2,  0,250,  7,  2,  0,251,  7,  2,  0,252,  7,  2,  0,253,  7,  2,  0,254,  7,  2,  0,255,  7,
-  2,  0,  0,  8,  2,  0,  1,  8,  2,  0,  2,  8,  2,  0,  3,  8,  2,  0, 35,  0,211,  0,  4,  8,  9,  0,  5,  8,  2,  0,  6,  8,
-  3,  1,  5,  0,  3,  1,  0,  0,  3,  1,  1,  0,  3,  1,  7,  8, 13,  0,  8,  8,  4,  0, 17,  0,  4,  1,  7,  0,  4,  1,  0,  0,
-  4,  1,  1,  0,  3,  1,  9,  8,  3,  1, 10,  8,  2,  0, 41,  5,  2,  0, 17,  0,  4,  0, 35,  0,  5,  1, 25,  0,  5,  1,  0,  0,
-  5,  1,  1,  0,  6,  1, 11,  8,  7,  1,130,  6,  0,  0, 12,  8,  0,  0, 13,  8,  0,  0, 14,  8,  2,  0, 15,  8,  2,  0, 16,  8,
-  2,  0, 17,  8,  2,  0, 18,  8,  2,  0, 19,  8,  2,  0, 35,  0,  2,  0, 17,  0,  2,  0, 20,  8,  2,  0, 21,  8,  2,  0, 22,  8,
-  4,  0, 23,  8,  5,  1, 24,  8,  9,  0, 25,  8,  4,  0, 26,  8,  4,  0, 27,  8,  4,  0, 28,  8,  4,  0, 29,  8,  0,  0, 30,  8,
-244,  0, 22,  0,244,  0,  0,  0,244,  0,  1,  0,  3,  1,  9,  8,  3,  1, 10,  8,  3,  1, 31,  8,  3,  1, 32,  8,  2,  1, 33,  8,
- 15,  0, 49,  0,  0,  0, 40,  6,  0,  0, 34,  8,  2,  0, 84,  6,  2,  0, 85,  6,  2,  0, 35,  8,  2,  0, 35,  0,  2,  0,253,  7,
-  2,  0,223,  6,  2,  0, 17,  0,  8,  1, 11,  8, 12,  0, 36,  8, 12,  0, 39,  6, 12,  0, 37,  8, 12,  0, 38,  8,  9,  1, 24,  0,
-  9,  1,  0,  0,  9,  1,  1,  0,214,  0, 92,  6, 15,  0, 39,  8, 15,  0, 40,  8,  2,  0, 84,  6,  2,  0, 85,  6,  2,  0, 41,  8,
-  2,  0, 42,  8,  2,  0, 43,  8,  2,  0, 17,  0,  7,  0, 83,  2,  2,  0, 17,  8,  2,  0, 18,  8,  2,  0,252,  7,  2,  0, 44,  8,
-  2,  0,  1,  8,  2,  0,195,  4, 10,  1, 11,  8, 12,  0, 45,  8, 12,  0, 46,  8, 12,  0, 37,  8,  0,  0, 47,  8,  9,  0, 48,  8,
- 11,  1, 14,  0,  0,  0, 49,  8,  2,  0, 50,  8,  2,  0, 51,  8,  2,  0, 52,  8,  2,  0, 53,  8,  2,  0, 29,  5,  2,  0, 54,  8,
-  2,  1, 55,  8, 38,  0, 56,  8,  4,  0, 57,  8,  4,  0, 58,  8,  4,  0, 59,  8,  4,  0, 35,  0,  0,  0, 60,  8, 12,  1,  3,  0,
-  0,  0, 61,  8,  4,  0, 62,  8,  4,  0, 63,  8, 13,  1,  4,  0,  4,  0,155,  6,  4,  0, 64,  8,  4,  0,161,  6,  4,  0, 65,  8,
- 14,  1,  2,  0,  4,  0, 66,  8,  4,  0, 67,  8, 15,  1,  5,  0,  7,  0, 68,  8,  7,  0, 69,  8,  7,  0, 70,  8,  4,  0, 17,  0,
-  4,  0, 35,  0, 16,  1,  6,  0,  0,  0, 71,  8,  0,  0,112,  6, 41,  0,130,  0,  2,  0,104,  0,  2,  0, 28,  5,  4,  0, 35,  0,
- 17,  1, 14,  0, 17,  1,  0,  0, 17,  1,  1,  0,  4,  0, 54,  0,  4,  0, 21,  0,  4,  0, 26,  0,  4,  0, 72,  8,  4,  0, 73,  8,
-  4,  0, 74,  8, 12,  1, 75,  8,  0,  0, 71,  8, 16,  1,106,  3, 13,  1, 76,  8, 14,  1, 77,  8, 15,  1, 78,  8, 18,  1, 12,  0,
-  0,  0,254,  1,  9,  0,220,  0,  0,  0,221,  0,  4,  0,224,  0,  4,  0,232,  0,  9,  0,225,  0,  7,  0,227,  0,  7,  0,228,  0,
-  9,  0, 79,  8,  9,  0, 80,  8,  9,  0,229,  0,  9,  0,231,  0, 19,  1, 48,  0, 19,  1,  0,  0, 19,  1,  1,  0,  9,  0, 81,  8,
-  9,  0, 24,  0,  0,  0, 25,  0,  4,  0, 17,  0,  4,  0, 15,  0,  4,  0, 21,  0,  4,  0, 85,  0,  4,  0, 82,  8,  4,  0, 83,  8,
-  4,  0, 73,  8,  4,  0, 74,  8,  4,  0, 84,  8,  4,  0,243,  0,  4,  0, 85,  8,  4,  0, 86,  8,  7,  0, 87,  8,  7,  0, 35,  0,
-  7,  0, 88,  8,  7,  0, 89,  8,  4,  0,121,  0,  4,  0, 90,  8, 17,  1, 91,  8, 28,  0, 77,  0, 38,  0,117,  0, 24,  0, 92,  8,
- 41,  0,130,  0,  7,  0, 93,  8,  7,  0, 94,  8, 18,  1, 62,  1, 19,  1, 95,  8, 19,  1, 96,  8, 19,  1, 97,  8, 12,  0, 98,  8,
-245,  0,232,  6,  9,  0, 99,  8,  7,  0, 14,  4,  7,  0,100,  8,  7,  0,101,  8,  4,  0,102,  8,  4,  0,103,  8,  7,  0,104,  8,
-  9,  0,105,  8,  4,  0,106,  8,  4,  0,107,  8,  4,  0,108,  8,  7,  0,109,  8, 20,  1,  4,  0, 20,  1,  0,  0, 20,  1,  1,  0,
- 12,  0,110,  8, 19,  1,111,  8,203,  0, 11,  0, 12,  0,112,  8, 12,  0, 98,  8, 12,  0,113,  8, 19,  1,114,  8,  0,  0,115,  8,
-  0,  0,116,  8,  4,  0,117,  8,  4,  0,118,  8,  4,  0,119,  8,  4,  0, 35,  0, 16,  0,120,  8, 21,  1,  4,  0,  7,  0,121,  8,
-  7,  0, 76,  3,  2,  0,122,  8,  2,  0,123,  8, 22,  1,  6,  0,  7,  0,124,  8,  7,  0,125,  8,  7,  0,126,  8,  7,  0,127,  8,
-  4,  0,128,  8,  4,  0,129,  8, 23,  1, 13,  0,  7,  0,130,  8,  7,  0,131,  8,  7,  0,132,  8,  7,  0,133,  8,  7,  0,134,  8,
-  7,  0,135,  8,  7,  0,136,  8,  7,  0,137,  8,  7,  0,138,  8,  7,  0,139,  8,  4,  0,233,  2,  4,  0,140,  8,  4,  0,141,  8,
- 24,  1,  2,  0,  7,  0, 99,  5,  7,  0, 35,  0, 25,  1,  5,  0,  7,  0,142,  8,  7,  0,143,  8,  4,  0, 88,  0,  4,  0,193,  2,
-  4,  0,144,  8, 26,  1,  6,  0, 26,  1,  0,  0, 26,  1,  1,  0,  2,  0, 15,  0,  2,  0, 17,  0,  2,  0,145,  8,  2,  0, 54,  0,
- 27,  1,  8,  0, 27,  1,  0,  0, 27,  1,  1,  0,  2,  0, 15,  0,  2,  0, 17,  0,  2,  0,145,  8,  2,  0, 54,  0,  7,  0, 21,  0,
-  7,  0,121,  0, 28,  1, 45,  0, 28,  1,  0,  0, 28,  1,  1,  0,  2,  0, 15,  0,  2,  0, 17,  0,  2,  0,145,  8,  2,  0,239,  0,
-  2,  0, 56,  4,  2,  0,146,  8,  7,  0,147,  8,  7,  0, 86,  0,  7,  0,246,  2,  4,  0,148,  8,  4,  0, 79,  0,  4,  0,195,  2,
-  7,  0,149,  8,  7,  0,150,  8,  7,  0,151,  8,  7,  0,152,  8,  7,  0,153,  8,  7,  0,154,  8,  7,  0,243,  2,  7,  0, 59,  1,
-  7,  0,155,  8,  7,  0,156,  8,  7,  0, 35,  0,  7,  0,157,  8,  7,  0,158,  8,  7,  0,159,  8,  2,  0,160,  8,  2,  0,161,  8,
-  2,  0,162,  8,  2,  0,163,  8,  2,  0,164,  8,  2,  0,165,  8,  2,  0,166,  8,  2,  0,167,  8,  2,  0, 22,  2,  2,  0,168,  8,
-  2,  0, 19,  2,  2,  0,169,  8,  0,  0,170,  8,  0,  0,171,  8,  7,  0,237,  0, 29,  1,172,  8, 58,  0,232,  1, 30,  1, 16,  0,
- 30,  1,  0,  0, 30,  1,  1,  0,  2,  0, 15,  0,  2,  0, 17,  0,  2,  0,145,  8,  2,  0,239,  0,  7,  0,238,  2,  7,  0,239,  2,
-  7,  0,240,  2,  7,  0, 72,  2,  7,  0,241,  2,  7,  0,242,  2,  7,  0,173,  8,  7,  0,243,  2,  7,  0,245,  2,  7,  0,246,  2,
-227,  0,  5,  0,  2,  0, 15,  0,  2,  0,174,  8,  2,  0, 17,  0,  2,  0,175,  8, 19,  0,191,  6,226,  0,  3,  0,  4,  0, 66,  0,
-  4,  0,176,  8,227,  0,  2,  0, 31,  1,  7,  0, 31,  1,  0,  0, 31,  1,  1,  0,  0,  0, 18,  0,  2,  0, 15,  0,  2,  0, 17,  0,
-  4,  0, 20,  0,  9,  0,177,  8, 32,  1,  5,  0,  0,  0, 18,  0,  7,  0, 79,  1,  7,  0,178,  8,  4,  0,179,  8,  4,  0, 35,  0,
- 33,  1,  4,  0,  2,  0, 15,  0,  2,  0, 17,  0,  2,  0, 87,  0,  2,  0, 67,  0, 34,  1,  4,  0,  0,  0, 18,  0, 57,  0,180,  8,
-  7,  0, 79,  1,  7,  0, 35,  0, 35,  1,  6,  0,  2,  0,181,  8,  2,  0,182,  8,  2,  0, 15,  0,  2,  0,183,  8,  0,  0,184,  8,
-  0,  0,185,  8, 36,  1,  5,  0,  4,  0, 15,  0,  4,  0, 35,  0,  0,  0, 18,  0,  0,  0,186,  8,  0,  0,187,  8, 37,  1,  3,  0,
-  4,  0, 15,  0,  4,  0, 35,  0,  0,  0, 18,  0, 38,  1,  4,  0,  2,  0,188,  8,  2,  0,189,  8,  2,  0, 17,  0,  2,  0, 35,  0,
- 39,  1,  6,  0,  0,  0, 18,  0,  0,  0,190,  8,  2,  0,191,  8,  2,  0,243,  2,  2,  0, 72,  1,  2,  0, 67,  0, 40,  1,  5,  0,
-  0,  0, 18,  0,  7,  0, 76,  3,  7,  0,145,  4,  2,  0, 17,  0,  2,  0,207,  2, 41,  1,  3,  0,  0,  0, 18,  0,  4,  0,195,  2,
-  4,  0,188,  8, 42,  1,  7,  0,  0,  0, 18,  0,  7,  0,145,  4,  0,  0,192,  8,  0,  0,193,  8,  2,  0, 72,  1,  2,  0, 87,  0,
-  4,  0,194,  8, 43,  1,  4,  0,  0,  0,195,  8,  0,  0,196,  8,  4,  0, 15,  0,  7,  0,211,  2, 44,  1,  3,  0, 24,  0,197,  8,
-  0,  0,198,  8,  0,  0,199,  8, 45,  1, 18,  0, 45,  1,  0,  0, 45,  1,  1,  0,  2,  0, 15,  0,  2,  0,200,  8,  2,  0, 17,  0,
-  2,  0,201,  8,  2,  0,202,  8,  2,  0,203,  8,  2,  0, 87,  0,  2,  0, 67,  0,  0,  0, 18,  0,  9,  0,  2,  0, 46,  1,204,  8,
- 24,  0, 42,  0,  2,  0,116,  5,  2,  0,100,  8,  2,  0,205,  8,  2,  0, 35,  0, 47,  1, 11,  0,  0,  0, 18,  0,  0,  0, 15,  0,
-  0,  0,206,  8,  2,  0, 17,  0,  2,  0,207,  2,  2,  0,207,  8,  4,  0,208,  8,  4,  0,209,  8,  4,  0,210,  8,  4,  0,211,  8,
-  4,  0,212,  8, 48,  1,  1,  0,  0,  0,213,  8, 49,  1,  4,  0, 34,  0,154,  6,  0,  0,158,  7,  4,  0, 72,  1,  4,  0, 17,  0,
- 46,  1, 18,  0, 46,  1,  0,  0, 46,  1,  1,  0, 46,  1,214,  8,  2,  0, 15,  0,  2,  0, 17,  0,  2,  0,215,  8,  2,  0,203,  8,
-  2,  0,200,  8,  2,  0,216,  8,  2,  0, 67,  0,  2,  0,229,  1,  0,  0, 18,  0,  9,  0,  2,  0, 50,  1,204,  8, 45,  1,217,  8,
-  2,  0, 13,  0,  2,  0,218,  8,  4,  0,219,  8, 51,  1,  3,  0,  4,  0,221,  2,  4,  0, 35,  0, 24,  0, 42,  0, 52,  1, 12,  0,
-157,  0,220,  8,  2,  0, 15,  0,  2,  0, 17,  0,  7,  0,147,  8,  7,  0, 86,  0,  0,  0, 18,  0,  0,  0,221,  8,  2,  0,222,  8,
-  2,  0,223,  8,  2,  0,224,  8,  2,  0,225,  8,  7,  0,226,  8, 53,  1,  8,  0,  7,  0,227,  8,  7,  0,228,  8,  7,  0,229,  8,
-  7,  0,230,  8,  7,  0,231,  8,  7,  0,232,  8,  7,  0,233,  8,  7,  0,234,  8, 54,  1, 13,  0,  2,  0, 17,  0,  2,  0,233,  6,
-  4,  0, 87,  0,  4,  0, 67,  0,  2,  0,235,  8,  7,  0, 14,  4,  7,  0,236,  8,245,  0,232,  6, 53,  1,237,  8,  2,  0, 15,  0,
-  2,  0, 35,  5,  2,  0,254,  5,  2,  0,238,  8, 55,  1, 11,  0,  4,  0,221,  2,  2,  0, 15,  0,  2,  0, 17,  0, 24,  0, 42,  0,
- 73,  0,239,  8,  0,  0, 18,  0,  7,  0,240,  8,  7,  0,241,  8,  7,  0,151,  3,  2,  0,242,  8,  2,  0,243,  8, 56,  1,  5,  0,
-  2,  0, 15,  0,  2,  0, 87,  0,  4,  0, 35,  0, 38,  0,117,  0, 24,  0,107,  5, 57,  1,  5,  0,  4,  0, 35,  0,  4,  0, 15,  0,
-  0,  0, 18,  0,  0,  0,186,  8, 24,  0, 42,  0, 58,  1, 13,  0,  2,  0, 17,  0,  2,  0, 15,  0,  2,  0,200,  8,  2,  0,152,  3,
-  7,  0,244,  8,  7,  0,245,  8,  7,  0,195,  4,  7,  0,163,  3,  7,  0,122,  3,  7,  0,125,  3,  7,  0,246,  8,  7,  0,247,  8,
- 24,  0,248,  8, 59,  1, 10,  0,  2,  0, 17,  0,  2,  0, 15,  0,  7,  0,147,  8,  7,  0, 86,  0,  0,  0, 18,  0,  0,  0,221,  8,
-  2,  0, 87,  0,  2,  0, 67,  0,  2,  0,229,  1,  2,  0, 35,  5, 60,  1,  8,  0, 24,  0, 42,  0,  7,  0,240,  2,  7,  0,249,  8,
-  7,  0,250,  8,  7,  0,152,  3,  2,  0, 87,  0,  2,  0,207,  2,  7,  0, 67,  0, 61,  1, 12,  0,  2,  0, 15,  0,  2,  0, 72,  1,
-  2,  0, 17,  0,  2,  0,243,  2,  2,  0,221,  2,  2,  0,251,  8,  4,  0, 35,  0,  7,  0,252,  8,  7,  0,253,  8,  7,  0,254,  8,
-  7,  0,255,  8,  0,  0,  0,  9, 62,  1,  9,  0,  2,  0, 17,  0,  2,  0, 15,  0,  4,  0,147,  8,  4,  0, 86,  0,  0,  0, 18,  0,
-  2,  0,195,  4,  2,  0, 61,  0,  2,  0,  1,  9,  2,  0,  2,  9, 63,  1,  7,  0,  4,  0,195,  2,  4,  0,  3,  9,  4,  0,  4,  9,
-  4,  0,  5,  9,  7,  0,  6,  9,  7,  0,  7,  9,  0,  0,192,  8, 64,  1,  7,  0,  0,  0,  8,  9, 24,  0,  9,  9,  0,  0,198,  8,
-  2,  0, 10,  9,  2,  0, 87,  0,  4,  0, 67,  0,  0,  0,199,  8, 65,  1,  6,  0,  2,  0, 17,  0,  2,  0, 15,  0,  4,  0,147,  8,
-  4,  0, 86,  0,  0,  0, 11,  9,  0,  0, 12,  9, 66,  1,  1,  0,  4,  0, 17,  0, 67,  1,  6,  0,  0,  0, 90,  0,  2,  0, 15,  0,
-  2,  0, 17,  0,  4,  0, 13,  9,  7,  0, 14,  9, 34,  0,154,  6, 68,  1,  4,  0,  0,  0,159,  2,  2,  0, 17,  0,  4,  0, 15,  0,
- 24,  0, 42,  0, 69,  1,  2,  0,  4,  0, 15,  0,  4,  0, 73,  6, 70,  1,  6,  0,  0,  0,195,  8,  0,  0,196,  8,  4,  0, 15,  0,
-  7,  0, 30,  2, 24,  0, 53,  3, 24,  0, 15,  9, 50,  1, 10,  0, 50,  1,  0,  0, 50,  1,  1,  0, 50,  1,214,  8,  2,  0, 15,  0,
-  2,  0, 17,  0,  2,  0,200,  8,  2,  0, 16,  9,  0,  0, 18,  0,  9,  0,  2,  0, 24,  0, 42,  0,245,  0, 16,  0, 19,  0, 29,  0,
-  0,  0, 32,  0, 35,  0,145,  0,  9,  0,220,  0, 35,  0, 17,  9, 28,  0, 77,  0,  7,  0, 14,  4,  7,  0, 18,  9,  7,  0,236,  8,
-  7,  0,227,  8,  7,  0,228,  8,  7,  0, 19,  9,  4,  0, 88,  0,  4,  0, 35,  0,  9,  0, 20,  9,  9,  0, 21,  9, 71,  1,  6,  0,
- 71,  1,  0,  0, 71,  1,  1,  0, 24,  0, 42,  0,  9,  0, 22,  9,  2,  0,244,  0,  0,  0,192,  2, 58,  0,  4,  0, 19,  0, 29,  0,
- 12,  0, 23,  9,  4,  0,126,  0,  7,  0, 24,  9, 72,  1, 28,  0, 72,  1,  0,  0, 72,  1,  1,  0, 18,  0, 25,  9, 72,  1, 36,  0,
- 12,  0, 26,  9,  0,  0, 18,  0,  7,  0, 27,  9,  7,  0, 28,  9,  7,  0, 29,  9,  7,  0, 30,  9,  4,  0, 17,  0,  7,  0, 31,  9,
-  7,  0, 32,  9,  7,  0, 33,  9,  7,  0, 34,  9,  7,  0, 79,  1,  7,  0, 30,  2,  7,  0, 35,  9,  7,  0,193,  2,  7,  0, 36,  9,
-  7,  0, 37,  9,  7,  0, 38,  9,  7,  0, 39,  9,  7,  0, 40,  9,  7,  0,167,  0,  4,  0,126,  0,  2,  0,153,  5,  2,  0,  5,  7,
- 73,  1, 25,  0, 19,  0, 29,  0, 31,  0, 72,  0, 12,  0, 41,  9, 12,  0, 42,  9, 12,  0, 43,  9, 72,  1, 44,  9,  9,  0, 45,  9,
-  9,  0, 46,  9,  4,  0, 17,  0,  4,  0, 48,  6,  2,  0,247,  2,  2,  0,103,  6,  4,  0, 47,  9,  4,  0,126,  0,  4,  0, 48,  9,
-  2,  0, 49,  9,  2,  0, 50,  9,  2,  0, 51,  9,  2,  0, 52,  9,  4,  0, 53,  9,  4,  0, 54,  9,  4,  0, 55,  9,  4,  0, 56,  9,
-  4,  0, 57,  9,  4,  0, 58,  9, 74,  1,  2,  0,  7,  0,148,  2,  4,  0, 17,  0,161,  0,  5,  0, 74,  1, 59,  9,  4,  0,193,  2,
-  4,  0, 60,  9,  4,  0, 61,  9,  4,  0, 17,  0,160,  0, 16,  0,  4,  0, 62,  9,  4,  0, 63,  9,  4,  0, 64,  9,  4,  0, 65,  9,
-  2,  0, 66,  9,  2,  0, 67,  9,  2,  0, 68,  9,  2,  0,244,  0,  2,  0, 69,  9,  2,  0, 70,  9,  2,  0, 71,  9,  2,  0, 72,  9,
-  4,  0, 73,  9,  4,  0, 74,  9,  4,  0, 75,  9,  4,  0, 76,  9, 75,  1, 41,  0, 75,  1,  0,  0, 75,  1,  1,  0, 18,  0, 25,  9,
- 12,  0,177,  3,  0,  0, 18,  0,  2,  0, 17,  0,  2,  0, 77,  9,  2,  0, 78,  9,  2,  0, 79,  9,  2,  0,137,  3,  2,  0, 80,  9,
-  4,  0, 70,  2,  4,  0, 55,  9,  4,  0, 56,  9, 72,  1, 81,  9, 75,  1, 36,  0, 75,  1, 82,  9, 12,  0, 83,  9,161,  0,114,  3,
- 24,  0, 84,  9, 75,  1, 85,  9,  7,  0, 67,  1,  7,  0,167,  0,  7,  0, 86,  9,  7,  0,  9,  2,  7,  0,127,  3,  7,  0,129,  3,
-  2,  0,160,  3,  2,  0, 35,  0,  7,  0, 87,  9,  7,  0, 88,  9,  7,  0,132,  3,  7,  0, 89,  9,  7,  0, 90,  9,  7,  0, 91,  9,
-  7,  0, 92,  9,  7,  0, 93,  9,  7,  0, 94,  9,  7,  0, 95,  9,  7,  0, 96,  9,  7,  0, 63,  2,158,  0, 16,  0, 12,  0, 97,  9,
- 68,  0, 98,  9,  2,  0, 17,  0,  2,  0, 35,  0,  4,  0, 99,  9,  4,  0, 87,  0,  7,  0, 99,  2,  7,  0,100,  9,  7,  0,101,  9,
- 12,  0,102,  9,  4,  0,103,  9,  4,  0,104,  9,  9,  0,105,  9,  9,  0,106,  9,160,  0,113,  3,  0,  0,107,  9, 76,  1,  1,  0,
-  4,  0,104,  9, 77,  1, 12,  0,  4,  0,104,  9,  7,  0,212,  8,  2,  0,108,  9,  2,  0,109,  9,  7,  0,110,  9,  7,  0,111,  9,
-  2,  0,112,  9,  2,  0, 17,  0,  7,  0,113,  9,  7,  0,114,  9,  7,  0,115,  9,  7,  0,116,  9, 78,  1,  7,  0, 78,  1,  0,  0,
- 78,  1,  1,  0, 12,  0,117,  9,  4,  0, 17,  0,  4,  0,118,  9,  0,  0,  4,  4,253,  0,119,  9,157,  0,  9,  0, 19,  0, 29,  0,
- 12,  0,120,  9, 12,  0, 97,  9, 12,  0,121,  9, 12,  0, 98,  0,  4,  0, 17,  0,  4,  0,122,  9,  4,  0,123,  9,  4,  0, 35,  0,
-217,  0,  6,  0, 19,  0,124,  9, 12,  0, 97,  9, 58,  0,125,  9,  0,  0,126,  9,  4,  0,127,  9,  4,  0, 17,  0, 79,  1, 13,  0,
-213,  0,  0,  0,213,  0,  1,  0, 12,  0, 39,  6,  4,  0, 40,  6,  7,  0, 41,  6,  2,  0, 42,  6,214,  0, 92,  6,157,  0,109,  3,
-217,  0,128,  9,  0,  0, 72,  1,  0,  0, 95,  6,  2,  0, 17,  0,  7,  0,129,  9, 80,  1,  8,  0, 80,  1,  0,  0, 80,  1,  1,  0,
- 78,  1,130,  9, 28,  0, 77,  0, 12,  0,115,  3,  4,  0, 17,  0,  0,  0, 18,  0,  4,  0,250,  7, 81,  1,  5,  0, 81,  1,  0,  0,
- 81,  1,  1,  0, 28,  0, 77,  0,  2,  0, 17,  0,  0,  0,131,  9, 82,  1, 14,  0, 82,  1,  0,  0, 82,  1,  1,  0,  9,  0,  2,  0,
-  2,  0, 15,  0,  2,  0, 17,  0,  0,  0,132,  9,  0,  0,133,  9,  0,  0,131,  9,  7,  0,134,  9,  7,  0,135,  9,  4,  0, 35,  0,
- 28,  0, 77,  0,  7,  0,136,  9,  7,  0,137,  9, 83,  1,  9,  0, 83,  1,  0,  0, 83,  1,  1,  0, 24,  0,138,  9,  0,  0,250,  2,
-  7,  0,139,  9,  2,  0,140,  9,  2,  0, 17,  0,  2,  0, 15,  0,  2,  0,141,  9, 84,  1,  7,  0, 34,  0,154,  6, 18,  0, 25,  9,
-  4,  0, 17,  0,  4,  0,142,  9, 12,  0,143,  9, 24,  0,138,  9,  0,  0,250,  2, 85,  1, 15,  0, 24,  0,138,  9,  2,  0,144,  9,
-  2,  0, 17,  0,  2,  0,145,  9,  2,  0,146,  9,  0,  0,250,  2, 24,  0,147,  9,  0,  0,148,  9,  7,  0,149,  9,  7,  0, 30,  2,
-  7,  0,150,  9,  7,  0,151,  9,  2,  0, 15,  0,  2,  0, 72,  1,  7,  0, 79,  1, 86,  1,  6,  0, 24,  0,138,  9,  7,  0, 59,  9,
-  2,  0,152,  9,  2,  0,153,  9,  2,  0, 17,  0,  2,  0,154,  9, 87,  1,  6,  0, 24,  0,138,  9,  4,  0,155,  9,  4,  0,156,  9,
-  4,  0, 88,  0,  4,  0, 35,  0,  0,  0,250,  2, 88,  1,  4,  0, 24,  0,138,  9,  4,  0, 17,  0,  4,  0,155,  9,  0,  0,250,  2,
- 89,  1,  4,  0, 24,  0,138,  9,  4,  0, 17,  0,  4,  0,155,  9,  0,  0,250,  2, 90,  1,  4,  0, 24,  0,138,  9,  4,  0, 17,  0,
-  4,  0,155,  9,  0,  0,250,  2, 91,  1,  2,  0,  4,  0, 17,  0,  7,  0, 14,  4, 92,  1,  2,  0, 24,  0,138,  9,  0,  0,250,  2,
- 93,  1, 10,  0, 24,  0,138,  9,  4,  0,157,  9,  7,  0,120,  0,  4,  0, 17,  0,  2,  0,152,  6,  2,  0,158,  9,  2,  0, 87,  0,
-  2,  0, 67,  0,  7,  0,159,  9,  0,  0,250,  2, 94,  1, 10,  0, 24,  0,138,  9,  2,  0, 15,  0,  2,  0, 64,  4,  4,  0, 85,  0,
-  4,  0, 86,  0,  7,  0,249,  8,  7,  0,250,  8,  4,  0, 35,  0,157,  0,220,  8,  0,  0,250,  2, 95,  1,  4,  0, 24,  0,138,  9,
-  4,  0,138,  3,  4,  0,160,  9,  0,  0,250,  2, 96,  1,  4,  0, 24,  0,138,  9,  4,  0,138,  3,  4,  0, 35,  0,  0,  0,250,  2,
- 97,  1,  6,  0, 24,  0,138,  9,  7,  0,120,  0,  7,  0, 65,  3,  4,  0,161,  9,  2,  0,138,  3,  2,  0,139,  3, 98,  1,  6,  0,
- 24,  0,138,  9,  4,  0,162,  9,  4,  0,163,  9,  7,  0,164,  9,  7,  0,165,  9,  0,  0,250,  2, 99,  1, 16,  0, 24,  0,138,  9,
- 24,  0, 82,  9,  4,  0, 15,  0,  7,  0,166,  9,  7,  0,167,  9,  7,  0,168,  9,  7,  0,169,  9,  7,  0,170,  9,  7,  0,171,  9,
-  7,  0,172,  9,  7,  0,173,  9,  7,  0,174,  9,  2,  0, 17,  0,  2,  0, 35,  0,  2,  0, 87,  0,  2,  0, 67,  0,100,  1,  3,  0,
- 24,  0,138,  9,  4,  0, 17,  0,  4,  0, 22,  2,101,  1,  5,  0, 24,  0,138,  9,  4,  0, 17,  0,  4,  0, 35,  0,  7,  0,175,  9,
-  0,  0,250,  2,102,  1, 10,  0, 24,  0,138,  9,  0,  0,250,  2,  2,  0,176,  9,  2,  0,177,  9,  0,  0,178,  9,  0,  0,179,  9,
-  7,  0,180,  9,  7,  0,181,  9,  7,  0,182,  9,  7,  0,183,  9,103,  1,  5,  0, 24,  0,138,  9,  0,  0,250,  2,  7,  0,201,  2,
-  2,  0,184,  9,  2,  0, 17,  0,104,  1,  8,  0,  7,  0,  7,  0,  7,  0,  8,  0,  7,  0,  9,  0,  7,  0, 10,  0,  7,  0,185,  9,
-  7,  0,186,  9,  2,  0, 17,  0,  2,  0, 22,  2,105,  1,  8,  0,  7,  0,  7,  0,  7,  0,  8,  0,  7,  0,  9,  0,  7,  0, 10,  0,
-  7,  0,185,  9,  7,  0,186,  9,  2,  0, 17,  0,  2,  0, 22,  2,106,  1,  8,  0,  7,  0,  7,  0,  7,  0,  8,  0,  7,  0,  9,  0,
-  7,  0, 10,  0,  7,  0,185,  9,  7,  0,186,  9,  2,  0, 17,  0,  2,  0, 22,  2,107,  1,  7,  0, 24,  0,138,  9,  0,  0,250,  2,
-  7,  0, 79,  1,  7,  0, 88,  1,  2,  0, 17,  0,  2,  0, 72,  1,  4,  0, 35,  0,108,  1,  5,  0, 24,  0, 53,  3,  7,  0, 79,  1,
-  2,  0, 57,  3,  0,  0, 59,  3,  0,  0,187,  9,109,  1, 10,  0,109,  1,  0,  0,109,  1,  1,  0,  2,  0, 15,  0,  2,  0, 17,  0,
-  0,  0,188,  9,  7,  0, 22,  1,  7,  0, 23,  1,  2,  0,117,  9,  2,  0,189,  9, 24,  0, 42,  0,110,  1, 22,  0,110,  1,  0,  0,
-110,  1,  1,  0,  2,  0, 17,  0,  2,  0, 72,  1,  2,  0,190,  9,  2,  0,191,  9, 28,  0, 77,  0,157,  0,220,  8, 24,  0,159,  0,
-  7,  0, 85,  0,  7,  0, 86,  0,  7,  0,192,  9,  7,  0,193,  9,  7,  0,194,  9,  7,  0,195,  9,  7,  0,236,  2,  7,  0,196,  9,
-  7,  0,222,  8,  7,  0,197,  9,  0,  0,198,  9,  0,  0,199,  9, 12,  0,118,  3,111,  1,  8,  0,  7,  0, 37,  2,  7,  0,249,  8,
-  7,  0,250,  8,  9,  0,  2,  0,  2,  0,200,  9,  2,  0,201,  9,  2,  0,202,  9,  2,  0,203,  9,112,  1, 19,  0,112,  1,  0,  0,
-112,  1,  1,  0,112,  1,204,  9,  0,  0, 18,  0,111,  1,205,  9,  2,  0, 15,  0,  2,  0, 17,  0,  2,  0,206,  9,  2,  0,207,  9,
-111,  1,208,  9,  2,  0,209,  9,  2,  0, 87,  0,  7,  0,210,  9,  7,  0,211,  9,  4,  0,212,  9,112,  1,213,  9,  4,  0,214,  9,
-  4,  0, 67,  0,113,  1,215,  9,114,  1,  4,  0,  0,  0,216,  9,  2,  0,217,  9,  2,  0,218,  9,  4,  0, 35,  0,115,  1, 34,  0,
-115,  1,  0,  0,115,  1,  1,  0,115,  1,219,  9,  0,  0, 18,  0,  2,  0, 15,  0,  2,  0, 17,  0,  2,  0, 72,  8,  2,  0,100,  8,
-  2,  0,220,  9,  2,  0,157,  6,  2,  0,209,  9,  2,  0,174,  8, 12,  0,215,  8, 12,  0,221,  9, 19,  0,191,  6,  9,  0,222,  9,
-  7,  0,210,  9,  7,  0,211,  9,  7,  0, 72,  2,  7,  0,223,  9,  0,  0,224,  9,  2,  0,225,  9,  2,  0,226,  9,  7,  0,227,  9,
-  7,  0,228,  9,  2,  0,229,  9,  2,  0,230,  9,  9,  0,231,  9, 16,  0,232,  9, 16,  0,233,  9, 16,  0,234,  9,114,  1,146,  0,
-116,  1,235,  9,117,  1,236,  9,113,  1,  8,  0,113,  1,  0,  0,113,  1,  1,  0,115,  1,237,  9,115,  1,238,  9,112,  1,239,  9,
-112,  1,240,  9,  4,  0, 17,  0,  4,  0, 35,  0, 53,  0, 23,  0, 19,  0, 29,  0, 31,  0, 72,  0,159,  0,112,  3, 12,  0,241,  9,
- 12,  0,242,  9,111,  1,243,  9, 12,  0,244,  9,  4,  0, 15,  0,  4,  0,245,  9,  4,  0,246,  9,  4,  0,247,  9,  4,  0, 17,  0,
-  4,  0, 35,  0, 12,  0,248,  9, 12,  0,215,  8, 12,  0,221,  9,  4,  0, 62,  6,  9,  0,249,  9,  9,  0,250,  9,  4,  0,251,  9,
-  9,  0,252,  9,  9,  0,253,  9,  9,  0,254,  9,118,  1,  6,  0,  4,  0,119,  0,  4,  0,121,  0,  4,  0,174,  8,  0,  0,255,  9,
-  0,  0,  0, 10,  2,  0, 35,  0,119,  1, 16,  0,  2,  0, 17,  8,  2,  0, 18,  8,  2,  0,  1, 10,  2,  0,  2, 10,  2,  0,  3, 10,
-  2,  0, 65,  0,  2,  0,192,  6,  2,  0,  4, 10,  7,  0,235,  2,  7,  0,  5, 10,  7,  0,  6, 10,  2,  0, 94,  1,  0,  0,  7, 10,
-  0,  0,  8, 10,  4,  0,  9, 10,  4,  0, 10, 10,120,  1,  9,  0,  7,  0, 11, 10,  7,  0, 12, 10,  7,  0, 19,  9,  7,  0, 76,  3,
-  7,  0, 13, 10,  7,  0,109,  6,  2,  0, 74,  3,  0,  0, 14, 10,  0,  0, 35,  0,121,  1,  4,  0,  7,  0, 15, 10,  7,  0, 16, 10,
-  2,  0, 74,  3,  2,  0, 35,  0,122,  1,  3,  0,  7,  0, 17, 10,  7,  0, 87,  8,  7,  0, 13,  0,123,  1,  7,  0,  0,  0,254,  1,
-  2,  0, 26,  5,  2,  0, 27,  5,  2,  0, 28,  5,  2,  0,217,  4,  4,  0,121,  0,  4,  0, 62,  4,124,  1,  9,  0,  7,  0, 18, 10,
-  7,  0, 19, 10,  7,  0, 20, 10,  7,  0, 83,  2,  7,  0, 21, 10,  7,  0, 22, 10,  7,  0, 23, 10,  2,  0, 24, 10,  2,  0, 25, 10,
-125,  1,  8,  0,  2,  0, 26, 10,  2,  0, 27, 10,  2,  0, 28, 10,  2,  0, 29, 10,  7,  0, 30, 10,  7,  0, 31, 10,  7,  0, 32, 10,
-  7,  0, 33, 10,126,  1,  2,  0,  7,  0,  5,  0,  7,  0,  6,  0,127,  1,  2,  0,  0,  0,161,  0,  0,  0, 34, 10,128,  1,  1,  0,
-  0,  0, 18,  0,129,  1, 10,  0,  0,  0, 35, 10,  0,  0, 36, 10,  0,  0,101,  6,  0,  0, 37, 10,  2,  0,  1, 10,  2,  0, 38, 10,
-  7,  0, 39, 10,  7,  0, 40, 10,  7,  0, 41, 10,  7,  0,196,  9,130,  1,  2,  0,  9,  0, 42, 10,  9,  0, 43, 10,131,  1, 11,  0,
-  0,  0, 28,  5,  0,  0, 15,  0,  0,  0, 74,  3,  0,  0, 76,  3,  0,  0, 44, 10,  0,  0,104,  0,  0,  0,159,  2,  7,  0, 45, 10,
-  7,  0, 46, 10,  7,  0, 47, 10,  7,  0, 48, 10,132,  1,  8,  0,  7,  0,181,  8,  7,  0,120,  0,  7,  0,  8, 10,  7,  0,152,  2,
-  7,  0, 49, 10,  7,  0,233,  0,  7,  0, 50, 10,  4,  0, 15,  0,133,  1,  4,  0,  2,  0, 51, 10,  2,  0, 52, 10,  2,  0, 53, 10,
-  2,  0, 35,  0,134,  1,  8,  0,  7,  0, 54, 10,  7,  0,201,  2,  7,  0, 55, 10,  7,  0, 68,  8,  7,  0, 69,  8,  7,  0, 70,  8,
-  7,  0, 56, 10,  7,  0, 57, 10,135,  1,  6,  0,  2,  0, 58, 10,  2,  0, 59, 10,  7,  0, 60, 10,  7,  0, 61, 10,  7,  0, 62, 10,
-  7,  0, 63, 10,136,  1,  1,  0,  0,  0, 18,  0,137,  1,  4,  0,  7,  0,  5,  0,  7,  0,  6,  0,  2,  0, 17,  0,  2,  0, 64, 10,
-138,  1, 10,  0,  2,  0,248,  3,  2,  0, 17,  0,  7,  0,145,  4,  7,  0, 65, 10,  7,  0, 66, 10,  7,  0, 67, 10,  7,  0, 68, 10,
-137,  1, 69, 10,137,  1, 70, 10,137,  1, 71, 10, 51,  0, 11,  0,  4,  0, 17,  0,  4,  0, 61,  0,  4,  0, 72, 10,  4,  0, 73, 10,
- 16,  0, 74, 10, 16,  0, 75, 10,138,  1, 76, 10,  7,  0, 77, 10,  7,  0, 78, 10,  7,  0, 79, 10,  7,  0, 80, 10,230,  0, 10,  0,
-  4,  0,117,  9,  4,  0, 81, 10,  7,  0, 82, 10,  7,  0, 83, 10,  7,  0, 84, 10,  7,  0, 85, 10,  7,  0,  8,  0,  7,  0, 10,  0,
-  4,  0, 72,  1,  4,  0,240,  2,229,  0, 18,  0,  4,  0,124,  0,  4,  0, 86, 10,  4,  0, 87, 10,  7,  0, 88, 10,  4,  0, 89, 10,
-  7,  0, 90, 10,  7,  0, 91, 10,  4,  0, 92, 10,  7,  0, 93, 10,  4,  0, 94, 10,  7,  0, 95, 10,230,  0, 96, 10,  7,  0, 97, 10,
-  7,  0, 98, 10,  7,  0, 99, 10,  7,  0,100, 10,  4,  0,101, 10,  4,  0, 35,  0,139,  1,  4,  0, 39,  0,227,  2,  7,  0,102, 10,
-  7,  0,161,  1,  7,  0, 35,  0,192,  0, 34,  0, 19,  0, 29,  0,139,  1,103, 10, 51,  0, 69, 10, 43,  0,104, 10, 49,  0,105, 10,
- 22,  0,146,  0,  0,  0,106, 10,  7,  0,107, 10,  2,  0,  4,  6,  2,  0,108, 10,  4,  0,104,  0,  4,  0, 17,  0,  7,  0,109, 10,
-  4,  0, 80,  2,  4,  0,110, 10,  7,  0,111, 10,  7,  0,112, 10,  7,  0,113, 10,  7,  0,161,  1,  4,  0,114, 10,  7,  0,115, 10,
-  0,  0,116, 10,  0,  0,117, 10,  0,  0,118, 10,  0,  0,119, 10,  7,  0,120, 10,  7,  0,121, 10,  7,  0,122, 10,  7,  0,240,  2,
-  7,  0,123, 10,  4,  0,124, 10,  7,  0,125, 10,  7,  0,126, 10,  7,  0,127, 10,140,  1, 10,  0,  4,  0, 15,  0,  4,  0,120,  0,
-  4,  0, 17,  0,  4,  0,201,  3,  4,  0,128, 10,  4,  0,129, 10,  4,  0,130, 10,  0,  0, 90,  0,  0,  0, 18,  0,  9,  0,  2,  0,
-141,  1,  1,  0,  0,  0, 60,  8, 84,  0,  7,  0,140,  1,131, 10,  4,  0,132, 10,  4,  0,133, 10,  4,  0,134, 10,  4,  0, 35,  0,
-  9,  0,135, 10,141,  1,136, 10,142,  1,  5,  0,  7,  0,148,  2,  7,  0,221,  2,  7,  0, 30,  2,  2,  0,129,  2,  2,  0, 35,  0,
-143,  1,  5,  0,  7,  0,148,  2,  7,  0, 89,  4,  7,  0,137, 10,  7,  0,138, 10,  7,  0,221,  2,144,  1,  5,  0, 24,  0,139, 10,
-145,  1, 20,  0,  7,  0,227,  5,  7,  0,140, 10,  7,  0, 54,  0,146,  1,  3,  0,  7,  0,141, 10,  4,  0,142, 10,  4,  0,143, 10,
-147,  1,  7,  0,  4,  0,144, 10,  4,  0,145, 10,  4,  0,146, 10,  7,  0,147, 10,  7,  0,148, 10,  7,  0,149, 10,  7,  0, 54,  0,
-148,  1,  8,  0,148,  1,  0,  0,148,  1,  1,  0, 24,  0, 42,  0,  4,  0,252,  0,  2,  0, 17,  0,  2,  0, 72,  1,  7,  0,221,  2,
-  7,  0,189,  8,149,  1,  6,  0,149,  1,  0,  0,149,  1,  1,  0, 24,  0, 42,  0,  2,  0,206,  2,  2,  0, 17,  0,  2,  0,150, 10,
-150,  1, 17,  0,143,  1,193,  3,143,  1,151, 10,142,  1,152, 10,143,  1,172,  8,144,  1,153, 10,  4,  0, 79,  0,  7,  0,221,  2,
-  7,  0,246,  2,  7,  0,154, 10,  4,  0,144, 10,  4,  0,155, 10,  7,  0,148, 10,  7,  0,149, 10,  7,  0,104,  0,  4,  0,156, 10,
-  2,  0, 17,  0,  2,  0,157, 10,151,  1, 15,  0,  7,  0,248,  0,  7,  0,158, 10,  7,  0,141, 10,  7,  0,159, 10,  7,  0,160, 10,
-  7,  0,161, 10,  7,  0,162, 10,  7,  0,163, 10,  7,  0,164, 10,  7,  0,165, 10,  7,  0,166, 10,  7,  0,167, 10,  7,  0,168, 10,
-  4,  0, 17,  0,  4,  0,169, 10,152,  1,124,  0, 19,  0, 29,  0, 31,  0, 72,  0,153,  1,170, 10,151,  1,171, 10,168,  0, 84,  4,
-  4,  0, 17,  0,  4,  0, 54,  0,  2,  0, 15,  0,  2,  0,176,  9,  2,  0,172, 10,  2,  0,107,  1,  2,  0,173, 10,  2,  0,160,  3,
-  2,  0,174, 10,  2,  0,175, 10,  2,  0,176, 10,  2,  0,177, 10,  2,  0,178, 10,  2,  0,179, 10,  2,  0,180, 10,  2,  0,181, 10,
-  2,  0,182, 10,  2,  0,124,  5,  2,  0,183, 10,  2,  0,184, 10,  2,  0,185, 10,  2,  0,186, 10,  2,  0,187, 10,  2,  0, 19,  2,
-  2,  0,165,  8,  2,  0,140,  8,  2,  0,188, 10,  2,  0,189, 10,  2,  0,211,  3,  2,  0,212,  3,  2,  0,190, 10,  2,  0,191, 10,
-  2,  0,192, 10,  2,  0,193, 10,  7,  0,194, 10,  7,  0,195, 10,  7,  0,196, 10,  7,  0,197, 10,  7,  0,198, 10,  7,  0,199, 10,
-  7,  0,200, 10,  2,  0, 74,  5,  2,  0,201, 10,  7,  0,202, 10,  7,  0,203, 10,  7,  0,204, 10,  7,  0,147,  8,  7,  0, 86,  0,
-  7,  0,246,  2,  7,  0,153,  8,  7,  0,205, 10,  7,  0,206, 10,  7,  0,207, 10,  7,  0,208, 10,  4,  0,148,  8,  4,  0,146,  8,
-  4,  0,209, 10,  4,  0,210, 10,  7,  0,149,  8,  7,  0,150,  8,  7,  0,151,  8,  7,  0,211, 10,  7,  0,212, 10,  7,  0,213, 10,
-  7,  0,214, 10,  7,  0,215, 10,  7,  0,216, 10,  7,  0,217, 10,  7,  0,218, 10,  7,  0,219, 10,  7,  0,151,  3,  7,  0,104,  0,
-  7,  0,220, 10,  7,  0,221, 10,  7,  0,222, 10,  7,  0,223, 10,  7,  0,206,  0,  7,  0,224, 10,  4,  0,225, 10,  4,  0,226, 10,
-  7,  0,227, 10,  7,  0,228, 10,  7,  0,229, 10,  7,  0,230, 10,  7,  0,231, 10,  7,  0,205,  0,  7,  0,232, 10,  7,  0,238,  3,
-  7,  0,236,  3,  7,  0,237,  3,  7,  0,233, 10,  7,  0,234, 10,  7,  0,235, 10,  7,  0,236, 10,  7,  0,237, 10,  7,  0,238, 10,
-  7,  0,239, 10,  7,  0,240, 10,  7,  0,241, 10,  7,  0,242, 10,  7,  0,243, 10,  7,  0,244, 10,  7,  0,245, 10,  7,  0,246, 10,
-  7,  0,247, 10,  7,  0,248, 10,  7,  0,249, 10,  7,  0,250, 10,  4,  0,251, 10,  4,  0,252, 10, 43,  0,125,  1, 58,  0,182,  3,
- 12,  0,253, 10, 58,  0,254, 10, 24,  0,255, 10, 24,  0,  0, 11, 28,  0, 77,  0,163,  0, 64,  1,163,  0,  1, 11,141,  0, 50,  0,
-141,  0,  0,  0,141,  0,  1,  0,152,  1,  2, 11,150,  1,  3, 11,147,  1, 82,  9,171,  0, 10,  4,  9,  0, 11,  4,154,  1,  4, 11,
-154,  1,  5, 11, 12,  0,  6, 11, 12,  0,  7, 11,126,  0,  8, 11,134,  0,  9, 11,134,  0, 10, 11, 24,  0, 11, 11, 24,  0, 12, 11,
- 24,  0, 36,  0, 12,  0,143,  9,  0,  0, 18,  0,  7,  0,237,  0,  7,  0, 19,  3,  7,  0, 13, 11,  7,  0, 14, 11,  4,  0,195,  2,
-  4,  0, 15, 11,  4,  0, 17,  0,  4,  0,148,  8,  4,  0, 16, 11,  4,  0, 17, 11,  4,  0, 18, 11,  4,  0, 19, 11,  2,  0,244,  0,
-  2,  0, 20, 11,  2,  0, 21, 11,  2,  0, 22, 11,  0,  0, 23, 11,  2,  0, 24, 11,  2,  0, 25, 11,  2,  0, 26, 11,  9,  0, 27, 11,
-130,  0, 83,  4, 12,  0,  4,  3, 12,  0, 28, 11,146,  1, 29, 11,  4,  0, 30, 11,  4,  0, 31, 11,155,  1, 32, 11,132,  0, 16,  3,
-156,  1, 33, 11,  7,  0, 34, 11,128,  0, 37,  0,157,  1, 20,  9,  7,  0, 53,  4,  7,  0, 35, 11,  7,  0, 36, 11,  7,  0,227,  5,
-  7,  0,161,  3,  7,  0,151,  3,  7,  0, 37, 11,  7,  0, 82,  2,  7,  0, 38, 11,  7,  0, 39, 11,  7,  0, 40, 11,  7,  0, 41, 11,
-  7,  0, 42, 11,  7,  0, 43, 11,  7,  0, 54,  4,  7,  0, 44, 11,  7,  0, 45, 11,  7,  0, 46, 11,  7,  0, 55,  4,  7,  0, 51,  4,
-  7,  0, 52,  4,  7,  0, 47, 11,  7,  0, 48, 11,  4,  0, 49, 11,  4,  0, 88,  0,  4,  0, 50, 11,  4,  0, 51, 11,  2,  0, 52, 11,
-  2,  0, 53, 11,  2,  0, 54, 11,  2,  0, 55, 11,  2,  0, 56, 11,  2,  0, 57, 11,  2,  0, 58, 11,  2,  0,195,  4,168,  0, 84,  4,
-129,  0, 11,  0,157,  1, 59, 11,  7,  0, 60, 11,  7,  0, 61, 11,  7,  0,233,  1,  7,  0, 62, 11,  7,  0, 63, 11,  7,  0, 64, 11,
-  4,  0, 88,  0,  2,  0, 65, 11,  2,  0, 66, 11, 58,  0,232,  1,158,  1,  4,  0,  7,  0,  5,  0,  7,  0,  6,  0,  7,  0,  8,  2,
-  7,  0, 67, 11,159,  1,  6,  0,159,  1,  0,  0,159,  1,  1,  0,158,  1, 59,  9,  4,  0,250,  0,  2,  0, 68, 11,  2,  0, 17,  0,
-160,  1,  5,  0,160,  1,  0,  0,160,  1,  1,  0, 12,  0, 69, 11,  4,  0, 70, 11,  4,  0, 17,  0,161,  1,  9,  0,161,  1,  0,  0,
-161,  1,  1,  0, 12,  0,119,  0,160,  1, 71, 11,  4,  0, 17,  0,  2,  0, 68, 11,  2,  0, 72, 11,  7,  0, 89,  0,  0,  0, 73, 11,
-159,  0,  6,  0, 19,  0, 29,  0, 12,  0, 43,  5,  4,  0, 17,  0,  2,  0, 74, 11,  2,  0, 75, 11,  9,  0, 76, 11,162,  1,  6,  0,
- 12,  0, 77, 11,  4,  0, 78, 11,  4,  0, 79, 11,  4,  0, 17,  0,  4,  0, 35,  0,211,  0, 80, 11,163,  1, 17,  0, 19,  0, 29,  0,
-164,  1, 81, 11,164,  1, 82, 11, 12,  0, 83, 11,  4,  0, 84, 11,  2,  0, 85, 11,  2,  0, 86, 11, 12,  0, 87, 11, 12,  0, 88, 11,
-162,  1, 89, 11, 12,  0, 90, 11, 12,  0, 91, 11, 12,  0, 92, 11, 12,  0, 93, 11,165,  1, 94, 11, 12,  0, 95, 11,211,  0, 96, 11,
-164,  1, 32,  0,164,  1,  0,  0,164,  1,  1,  0,  9,  0, 97, 11,  4,  0,251,  7,  2,  0, 98, 11,  2,  0, 35,  0,  2,  1, 99, 11,
-  2,  1,100, 11,  0,  0,101, 11,  2,  0,102, 11,  2,  0,103, 11,  2,  0, 17,  8,  2,  0, 18,  8,  2,  0,104, 11,  2,  0,105, 11,
-  2,  0,201,  3,  2,  0,223,  6,  2,  0,106, 11,  2,  0,107, 11,  2,  0,108, 11,  2,  0, 67,  0,166,  1,109, 11,167,  1,110, 11,
-168,  1,111, 11,  4,  0,112, 11,  4,  0,113, 11,  9,  0,114, 11, 12,  0, 88, 11, 12,  0, 37,  8, 12,  0,115, 11, 12,  0,116, 11,
- 12,  0,117, 11,169,  1, 17,  0,169,  1,  0,  0,169,  1,  1,  0,  0,  0,118, 11, 18,  0, 28,  0,  2,  0,119, 11,  2,  0, 15,  0,
-  2,  0, 13,  0,  2,  0,120, 11,  2,  0,121, 11,  2,  0,122, 11,  2,  0,123, 11,  2,  0,124, 11,  2,  0, 17,  0,  2,  0,125, 11,
-  2,  0, 29,  0,  2,  0, 35,  0,170,  1,126, 11,171,  1, 10,  0,171,  1,  0,  0,171,  1,  1,  0, 12,  0,127, 11,  0,  0,118, 11,
-  2,  0,128, 11,  2,  0,129, 11,  2,  0, 17,  0,  2,  0,130, 11,  4,  0,131, 11,  9,  0,132, 11,165,  1,  7,  0,165,  1,  0,  0,
-165,  1,  1,  0,  0,  0,118, 11,  0,  0,133, 11, 12,  0,196,  7,  4,  0,134, 11,  4,  0, 17,  0,223,  0, 14,  0,223,  0,  0,  0,
-223,  0,  1,  0,  0,  0,118, 11, 18,  0, 28,  0,172,  1, 11,  8,  9,  0,135, 11,  9,  0,136, 11,170,  1,126, 11,162,  1,137, 11,
- 12,  0,138, 11,223,  0,139, 11,  7,  1,130,  6,  2,  0, 17,  0,  2,  0,195,  4,173,  1,  8,  0,173,  1,  0,  0,173,  1,  1,  0,
-  9,  0,  2,  0,  9,  0,140, 11,  0,  0,  4,  4,  2,  0, 15,  0,  2,  0, 17,  0,  7,  0,141, 11,174,  1,  5,  0,  7,  0,142, 11,
-  4,  0,143, 11,  4,  0,144, 11,  4,  0, 72,  1,  4,  0, 17,  0,175,  1,  6,  0,  7,  0,145, 11,  7,  0,146, 11,  7,  0,147, 11,
-  7,  0,148, 11,  4,  0, 15,  0,  4,  0, 17,  0,176,  1,  5,  0,  7,  0,249,  8,  7,  0,250,  8,  7,  0,221,  2,  2,  0, 33,  2,
-  2,  0, 34,  2,177,  1,  5,  0,176,  1,  2,  0,  4,  0, 51,  0,  7,  0,149, 11,  7,  0,249,  8,  7,  0,250,  8,178,  1,  4,  0,
-  2,  0,150, 11,  2,  0,151, 11,  2,  0,152, 11,  2,  0,153, 11,179,  1,  2,  0, 34,  0,185,  6, 18,  0, 25,  9,180,  1,  3,  0,
- 16,  0,154, 11,  4,  0, 17,  0,  4,  0, 35,  0,181,  1,  6,  0,  7,  0,104,  0,  7,  0,223,  2,  7,  0,155, 11,  7,  0, 35,  0,
-  2,  0,243,  0,  2,  0,156, 11,182,  1,  5,  0,  7,  0,157, 11,  7,  0,120,  0,  7,  0, 60,  9,  7,  0, 61,  9,  4,  0, 17,  0,
-183,  1,  6,  0, 19,  0,191,  6,  0,  0,158, 11,  0,  0,159, 11,  2,  0,160, 11,  2,  0, 17,  0,  4,  0,161, 11,184,  1,  7,  0,
-184,  1,  0,  0,184,  1,  1,  0,  0,  0,  4,  4,183,  1,162, 11,  2,  0,163, 11,  2,  0, 15,  0,  7,  0, 58,  0,185,  1,  7,  0,
- 12,  0,164, 11,  0,  0,165, 11,  9,  0,166, 11,  7,  0, 58,  0,  7,  0,141, 11,  4,  0, 15,  0,  4,  0, 17,  0,186,  1,  3,  0,
-  7,  0,167, 11,  4,  0, 17,  0,  4,  0, 35,  0,187,  1, 15,  0,187,  1,  0,  0,187,  1,  1,  0, 78,  1,130,  9,185,  1, 59,  0,
- 12,  0,118,  3, 27,  0, 47,  0,186,  1,168, 11,  4,  0, 51,  0,  7,  0, 58,  0,  2,  0, 17,  0,  2,  0, 15,  1,  4,  0,169, 11,
-  0,  0,158, 11,  4,  0,170, 11,  7,  0,171, 11,188,  1,  2,  0,  0,  0,172, 11,  0,  0,173, 11,189,  1,  4,  0,189,  1,  0,  0,
-189,  1,  1,  0,157,  0, 53,  3, 12,  0,174, 11,190,  1, 24,  0,190,  1,  0,  0,190,  1,  1,  0, 12,  0,175, 11,157,  0,220,  8,
-189,  1,176, 11, 12,  0,177, 11, 12,  0,118,  3,  0,  0,  4,  4,  7,  0,141, 11,  7,  0,178, 11,  7,  0, 85,  0,  7,  0, 86,  0,
-  7,  0,192,  9,  7,  0,193,  9,  7,  0,236,  2,  7,  0,196,  9,  7,  0,222,  8,  7,  0,197,  9,  2,  0,179, 11,  2,  0,180, 11,
-  2,  0, 87,  0,  2,  0, 15,  0,  4,  0, 17,  0,  4,  0, 67,  0,191,  1,  6,  0,191,  1,  0,  0,191,  1,  1,  0, 12,  0,175, 11,
-  4,  0, 17,  0,  4,  0,252,  1,  0,  0,  4,  4,192,  1, 11,  0,192,  1,  0,  0,192,  1,  1,  0, 19,  0,191,  6,  0,  0,181, 11,
-  4,  0,161, 11,  2,  0,182, 11,  2,  0, 35,  0,  0,  0,158, 11,  4,  0,169, 11,  2,  0, 17,  0,  2,  0,183, 11,193,  1,  8,  0,
-193,  1,  0,  0,193,  1,  1,  0, 12,  0,184, 11,  0,  0,  4,  4,  0,  0,185, 11,  2,  0, 17,  0,  2,  0,183, 11,  4,  0,186, 11,
-194,  1,  5,  0,194,  1,  0,  0,194,  1,  1,  0,  0,  0,158, 11,  4,  0,169, 11,  7,  0,211,  2, 31,  0, 12,  0,157,  0,109,  3,
-157,  0,187, 11,189,  1,176, 11, 12,  0,188, 11,190,  1,189, 11, 12,  0,190, 11, 12,  0,191, 11,  4,  0, 17,  0,  4,  0,244,  0,
-  2,  0,192, 11,  2,  0,193, 11,  7,  0,194, 11,195,  1,  2,  0, 19,  0, 29,  0, 31,  0, 72,  0,196,  1,  5,  0,196,  1,  0,  0,
-196,  1,  1,  0,  4,  0, 15,  0,  4,  0, 17,  0,  0,  0, 18,  0,197,  1,  6,  0,196,  1,195, 11, 24,  0, 42,  0,  4,  0,196, 11,
-  7,  0,197, 11,  4,  0,198, 11,  4,  0,117,  9,198,  1,  3,  0,196,  1,195, 11,  4,  0,196, 11,  7,  0,199, 11,199,  1,  8,  0,
-196,  1,195, 11, 24,  0, 42,  0,  7,  0, 67,  1,  7,  0,200, 11,  7,  0, 19,  3,  7,  0, 19,  9,  4,  0,196, 11,  4,  0,201, 11,
-200,  1,  5,  0,196,  1,195, 11,  7,  0,202, 11,  7,  0,100,  8,  7,  0,242,  2,  7,  0, 54,  0,201,  1,  3,  0,196,  1,195, 11,
-  7,  0, 19,  9,  7,  0,203, 11,145,  1,  4,  0,  7,  0,204, 11,  7,  0,221, 10,  2,  0,205, 11,  2,  0, 72,  1,202,  1, 14,  0,
-202,  1,  0,  0,202,  1,  1,  0, 12,  0,206, 11, 12,  0,207, 11, 12,  0,208, 11,  0,  0, 18,  0,  4,  0, 29,  0,  4,  0, 17,  0,
-  4,  0,209, 11,  7,  0,210, 11,  4,  0,198, 11,  4,  0,117,  9,  7,  0, 14,  4,  7,  0,244,  2,153,  1, 23,  0,  4,  0,196, 11,
-  4,  0,211, 11,  7,  0,212, 11,  7,  0,240,  2,  7,  0,213, 11,  7,  0,236,  8,  7,  0,204, 11,  7,  0,214, 11,  7,  0,223,  2,
-  7,  0, 88, 10,  7,  0,145,  4,  7,  0,215, 11,  7,  0,216, 11,  7,  0,217, 11,  7,  0,218, 11,  7,  0,219, 11,  7,  0,220, 11,
-  7,  0,221, 11,  7,  0,222, 11,  7,  0,223, 11,  7,  0,224, 11,  7,  0,225, 11, 12,  0,226, 11,114,  0, 40,  0,113,  0,227, 11,
-203,  1,171, 10, 58,  0,228, 11, 58,  0,254, 10, 58,  0,229, 11,204,  1,230, 11, 40,  0,160,  0, 40,  0,231, 11, 40,  0,232, 11,
-  7,  0,233, 11,  7,  0,234, 11,  7,  0,235, 11,  7,  0,236, 11,  7,  0,237, 11,  7,  0,250,  7,  7,  0,238, 11,  7,  0,161,  1,
-  7,  0,239, 11,  4,  0,240, 11,  4,  0,241, 11,  4,  0,242, 11,  4,  0, 88,  0,  4,  0, 35,  0,  4,  0,243, 11,  2,  0,244, 11,
-  2,  0,245, 11,  4,  0,246, 11,  7,  0,223,  2,  4,  0,247, 11,  7,  0,248, 11,  4,  0,249, 11,  4,  0,250, 11,  4,  0,251, 11,
-130,  0,252, 11, 12,  0,253, 11,168,  0, 84,  4,  4,  0,254, 11,  7,  0,255, 11,  7,  0,  0, 12,  4,  0, 67,  0,115,  0, 12,  0,
-113,  0,227, 11,141,  0, 39,  3,  7,  0,128,  1,  7,  0,250,  7,  7,  0,  1, 12,  7,  0,  2, 12,  7,  0,  3, 12,  2,  0,  4, 12,
-  2,  0,  5, 12,  2,  0,  6, 12,  2,  0, 15,  0,  4,  0, 88,  0,116,  0, 13,  0,113,  0,227, 11,132,  0, 16,  3,134,  0, 18,  3,
-  7,  0, 59,  9,  7,  0,  7, 12,  7,  0,  8, 12,  7,  0, 69,  1,  7,  0,  9, 12,  4,  0,152,  9,  4,  0, 12,  3,  2,  0, 15,  0,
-  2,  0, 35,  0,  4,  0, 67,  0, 69, 78, 68, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  7,  0,219,  0,  7,  0,220,  0,  7,  0,221,  0,  7,  0,222,  0,  7,  0,223,  0,  7,  0,224,  0,  7,  0,225,  0,  7,  0,226,  0,
+  7,  0,227,  0, 48,  0, 15,  0,  0,  0, 35,  0, 11,  0,228,  0,  0,  0,229,  0,  0,  0,230,  0,  4,  0,231,  0,  4,  0,232,  0,
+ 11,  0,233,  0,  7,  0,234,  0,  7,  0,235,  0,  7,  0,236,  0,  4,  0,237,  0, 11,  0,238,  0, 11,  0,239,  0,  4,  0,240,  0,
+  4,  0, 27,  0, 49,  0,  6,  0,  7,  0,186,  0,  7,  0,187,  0,  7,  0,188,  0,  7,  0,241,  0,  7,  0, 66,  0,  4,  0, 63,  0,
+ 50,  0,  5,  0,  2,  0, 18,  0,  2,  0, 37,  0,  2,  0, 63,  0,  2,  0,242,  0, 49,  0,236,  0, 51,  0, 17,  0, 27,  0,169,  0,
+ 42,  0,243,  0, 52,  0,244,  0,  7,  0,245,  0,  7,  0,246,  0,  2,  0, 16,  0,  2,  0,247,  0,  7,  0,113,  0,  7,  0,114,  0,
+  7,  0,248,  0,  4,  0,249,  0,  2,  0,250,  0,  2,  0,251,  0,  4,  0,133,  0,  4,  0,145,  0,  2,  0,252,  0,  2,  0,253,  0,
+ 53,  0, 25,  0,  2,  0, 18,  0,  2,  0,254,  0,  7,  0,255,  0,  7,  0,  0,  1,  2,  0,144,  0,  2,  0,  1,  1,  4,  0,  2,  1,
+  4,  0,  3,  1, 27,  0,169,  0,  4,  0,  4,  1,  2,  0,  5,  1,  2,  0,  6,  1, 11,  0,  7,  1,  7,  0,  8,  1,  7,  0,  9,  1,
+  2,  0, 10,  1,  2,  0, 11,  1,  2,  0, 12,  1,  2,  0, 13,  1,  7,  0, 14,  1,  7,  0, 15,  1,  7,  0, 16,  1,  7,  0, 17,  1,
+ 50,  0, 18,  1, 54,  0, 19,  1, 55,  0, 13,  0,  4,  0, 20,  1,  4,  0, 21,  1,  2,  0, 22,  1,  2,  0, 18,  0,  2,  0, 23,  1,
+  2,  0, 24,  1, 27,  0,169,  0,  7,  0, 25,  1,  4,  0, 26,  1,  0,  0, 27,  1,  7,  0, 28,  1,  4,  0, 29,  1,  4,  0,133,  0,
+ 56,  0,  4,  0, 27,  0,169,  0,  0,  0, 30,  1,  4,  0, 31,  1,  4,  0, 27,  0, 47,  0, 64,  0, 22,  0, 32,  0, 34,  0, 75,  0,
+  7,  0, 32,  1,  7,  0, 33,  1,  7,  0, 34,  1,  7,  0, 35,  1,  7,  0, 36,  1,  7,  0, 37,  1,  7,  0, 38,  1,  7,  0, 39,  1,
+  7,  0, 40,  1,  7,  0, 30,  0,  7,  0, 41,  1,  7,  0, 42,  1,  7,  0, 43,  1,  7,  0, 44,  1,  7,  0, 45,  1,  7,  0, 46,  1,
+  7,  0, 47,  1,  7,  0, 48,  1,  7,  0, 49,  1,  7,  0, 50,  1,  7,  0, 51,  1,  7,  0, 52,  1,  2,  0, 53,  1,  2,  0, 54,  1,
+  2,  0, 55,  1,  2,  0, 56,  1,  2,  0, 57,  1,  2,  0, 58,  1,  2,  0, 59,  1,  2,  0, 18,  0,  2,  0, 16,  0,  2,  0,247,  0,
+  7,  0, 60,  1,  7,  0, 61,  1,  7,  0, 62,  1,  7,  0, 63,  1,  4,  0, 64,  1,  4,  0, 65,  1,  2,  0, 66,  1,  2,  0, 67,  1,
+  2,  0, 23,  1,  2,  0,131,  0,  4,  0, 22,  0,  4,  0,128,  0,  4,  0,129,  0,  4,  0,130,  0,  7,  0, 68,  1,  7,  0, 69,  1,
+  7,  0, 92,  0, 40,  0, 70,  1, 57,  0, 71,  1, 31,  0, 80,  0, 42,  0,243,  0, 48,  0, 72,  1, 50,  0, 18,  1, 51,  0, 73,  1,
+ 25,  0,155,  0, 53,  0, 74,  1, 55,  0, 75,  1, 56,  0, 76,  1,  0,  0, 77,  1,  0,  0,125,  0, 58,  0, 13,  0,  7,  0, 78,  1,
+  7,  0, 79,  1,  7,  0,177,  0,  4,  0, 18,  0,  0,  0,172,  0,  0,  0,173,  0,  0,  0,174,  0,  0,  0,175,  0,  4,  0, 27,  0,
+  7,  0, 80,  1,  7,  0, 81,  1,  7,  0, 82,  1, 27,  0, 44,  0, 59,  0,  9,  0, 50,  0, 83,  1,  7,  0, 34,  1,  7,  0, 35,  1,
+  7,  0, 36,  1,  4,  0, 18,  0,  7,  0, 84,  1,  7,  0, 85,  1,  4,  0, 86,  1,  4,  0, 87,  1, 60,  0, 74,  0, 22,  0, 32,  0,
+ 34,  0, 75,  0,  2,  0, 16,  0,  2,  0, 18,  0,  4,  0, 88,  1,  2,  0,180,  0,  2,  0, 89,  1,  7,  0,186,  0,  7,  0,187,  0,
+  7,  0,188,  0,  7,  0,189,  0,  7,  0, 90,  1,  7,  0, 91,  1,  7,  0, 92,  1,  7,  0, 93,  1,  7,  0, 94,  1,  7,  0, 95,  1,
+  7,  0, 96,  1,  7,  0, 97,  1,  7,  0, 98,  1,  7,  0, 99,  1,  7,  0,100,  1, 54,  0,101,  1,  2,  0,254,  0,  2,  0, 30,  0,
+  7,  0,113,  0,  7,  0,114,  0,  7,  0,102,  1,  7,  0,103,  1,  7,  0,104,  1,  7,  0,105,  1,  7,  0,106,  1,  2,  0,107,  1,
+  2,  0,108,  1,  2,  0,109,  1,  2,  0,110,  1,  0,  0,111,  1,  0,  0,112,  1,  2,  0,113,  1,  2,  0,114,  1,  2,  0,115,  1,
+  2,  0,116,  1,  2,  0,117,  1,  7,  0,118,  1,  7,  0,119,  1,  7,  0,120,  1,  7,  0,121,  1,  2,  0,122,  1,  2,  0, 92,  0,
+  2,  0,123,  1,  2,  0,124,  1,  2,  0,125,  1,  2,  0,126,  1,  7,  0,127,  1,  7,  0,128,  1,  7,  0,129,  1,  7,  0,130,  1,
+  7,  0,131,  1,  7,  0,132,  1,  7,  0,133,  1,  7,  0,134,  1,  7,  0,135,  1,  7,  0,136,  1,  7,  0,137,  1,  7,  0,138,  1,
+  2,  0,139,  1,  0,  0,140,  1, 31,  0, 80,  0, 46,  0,141,  1,  2,  0,142,  1,  2,  0, 77,  1,  0,  0,143,  1, 25,  0,155,  0,
+ 57,  0, 71,  1, 61,  0, 18,  0,  7,  0,144,  1,  7,  0,145,  1,  7,  0,146,  1,  7,  0,147,  1,  7,  0,148,  1,  7,  0,149,  1,
+  7,  0,150,  1,  7,  0,151,  1,  7,  0,152,  1,  7,  0,153,  1,  2,  0,154,  1,  2,  0,155,  1,  2,  0,156,  1,  2,  0,157,  1,
+  7,  0,158,  1,  7,  0,159,  1,  7,  0,160,  1,  7,  0,161,  1, 62,  0,  4,  0,  4,  0, 18,  0,  4,  0,162,  1,  4,  0,163,  1,
+  4,  0, 92,  0, 63,  0,126,  0, 22,  0, 32,  0, 34,  0, 75,  0,  2,  0,164,  1,  2,  0, 18,  0,  7,  0,186,  0,  7,  0,187,  0,
+  7,  0,188,  0,  7,  0,165,  1,  7,  0,166,  1,  7,  0,167,  1,  7,  0,168,  1,  7,  0,169,  1,  7,  0,170,  1,  7,  0,171,  1,
+  7,  0,172,  1,  7,  0,173,  1,  7,  0,174,  1,  7,  0,175,  1,  7,  0,176,  1,  7,  0,177,  1,  7,  0,178,  1,  7,  0,179,  1,
+  7,  0,180,  1,  7,  0,181,  1,  7,  0,182,  1,  7,  0,183,  1,  7,  0,184,  1, 61,  0,185,  1, 62,  0,186,  1,  7,  0,187,  1,
+  7,  0,188,  1,  7,  0,189,  1,  7,  0,190,  1,  7,  0,191,  1,  7,  0,192,  1,  7,  0,193,  1,  2,  0,194,  1,  2,  0,195,  1,
+  2,  0,196,  1,  0,  0,197,  1,  0,  0,198,  1,  7,  0,199,  1,  7,  0,200,  1,  2,  0,201,  1,  2,  0,202,  1,  7,  0,203,  1,
+  7,  0,204,  1,  7,  0,205,  1,  7,  0,206,  1,  2,  0,207,  1,  2,  0,208,  1,  4,  0, 88,  1,  4,  0,209,  1,  2,  0,210,  1,
+  2,  0,211,  1,  2,  0,212,  1,  2,  0,213,  1,  7,  0,214,  1,  7,  0,215,  1,  7,  0,216,  1,  7,  0,217,  1,  7,  0,218,  1,
+  7,  0,219,  1,  7,  0,220,  1,  7,  0,221,  1,  7,  0,222,  1,  7,  0,223,  1,  0,  0,224,  1,  7,  0,225,  1,  7,  0,226,  1,
+  7,  0,227,  1,  4,  0,228,  1,  0,  0,229,  1,  0,  0,123,  1,  0,  0,230,  1,  0,  0, 77,  1,  2,  0,231,  1,  2,  0,232,  1,
+  2,  0,142,  1,  2,  0,233,  1,  2,  0,234,  1,  2,  0,235,  1,  7,  0,236,  1,  7,  0,237,  1,  7,  0,238,  1,  7,  0,239,  1,
+  7,  0,240,  1,  2,  0,165,  0,  2,  0,166,  0, 50,  0,241,  1, 50,  0,242,  1,  0,  0,243,  1,  0,  0,244,  1,  0,  0,245,  1,
+  0,  0,246,  1,  2,  0,247,  1,  2,  0, 74,  0,  7,  0,248,  1,  7,  0,249,  1, 46,  0,141,  1, 57,  0, 71,  1, 31,  0, 80,  0,
+ 64,  0,250,  1, 25,  0,155,  0,  7,  0,251,  1,  7,  0,252,  1,  7,  0,253,  1,  7,  0,254,  1,  7,  0,255,  1,  2,  0,  0,  2,
+  2,  0, 30,  0,  7,  0,  1,  2,  7,  0,  2,  2,  7,  0,  3,  2,  7,  0,  4,  2,  7,  0,  5,  2,  7,  0,  6,  2,  7,  0,  7,  2,
+  7,  0,  8,  2,  7,  0,  9,  2,  2,  0, 10,  2,  2,  0, 11,  2,  4,  0, 12,  2,  2,  0, 13,  2,  2,  0, 14,  2, 14,  0, 15,  2,
+ 65,  0,  4,  0, 22,  0, 32,  0,  0,  0, 35,  0, 66,  0,  2,  0, 38,  0,154,  0, 67,  0, 20,  0, 67,  0,  0,  0, 67,  0,  1,  0,
+ 68,  0, 16,  2,  2,  0, 16,  0,  2,  0, 18,  0,  2,  0, 17,  2,  2,  0, 18,  2,  7,  0,  5,  0,  7,  0,  6,  0,  7,  0,  7,  0,
+  7,  0, 19,  2,  7,  0, 20,  2,  7,  0, 21,  2,  7,  0, 22,  2,  7,  0, 23,  2,  7,  0, 24,  2,  7,  0, 25,  2,  7,  0, 22,  0,
+  7,  0, 26,  2,  7,  0, 27,  2, 69,  0, 20,  0, 22,  0, 32,  0, 34,  0, 75,  0, 68,  0, 16,  2, 14,  0, 28,  2, 14,  0, 29,  2,
+ 14,  0, 30,  2, 31,  0, 80,  0, 63,  0, 31,  2,  0,  0, 18,  0,  0,  0, 32,  2,  2,  0, 33,  2,  2,  0,179,  0,  2,  0, 27,  0,
+  7,  0, 78,  1,  7,  0,177,  0,  7,  0, 79,  1,  7,  0, 34,  2,  7,  0, 35,  2,  7,  0, 36,  2, 67,  0, 37,  2, 30,  0, 11,  0,
+  7,  0, 38,  2,  7,  0, 39,  2,  7,  0, 40,  2,  7,  0,  0,  1,  2,  0, 54,  0,  0,  0, 41,  2,  0,  0, 42,  2,  0,  0, 43,  2,
+  0,  0, 44,  2,  0,  0, 45,  2,  0,  0, 46,  2, 29,  0,  7,  0,  7,  0, 47,  2,  7,  0, 39,  2,  7,  0, 40,  2,  2,  0, 43,  2,
+  2,  0, 46,  2,  7,  0,  0,  1,  7,  0, 27,  0, 70,  0, 21,  0, 70,  0,  0,  0, 70,  0,  1,  0,  2,  0, 16,  0,  2,  0, 48,  2,
+  2,  0, 46,  2,  2,  0, 18,  0,  2,  0, 49,  2,  2,  0, 50,  2,  2,  0, 51,  2,  2,  0, 52,  2,  2,  0, 53,  2,  2,  0, 54,  2,
+  2,  0, 55,  2,  2,  0, 56,  2,  7,  0, 57,  2,  7,  0, 58,  2, 29,  0, 48,  0, 30,  0, 49,  0,  2,  0, 59,  2,  2,  0, 60,  2,
+  4,  0, 61,  2, 71,  0,  5,  0,  2,  0, 62,  2,  2,  0, 48,  2,  0,  0, 18,  0,  0,  0, 27,  0,  2,  0, 30,  0, 72,  0,  4,  0,
+  7,  0,  5,  0,  7,  0,  6,  0,  7,  0, 63,  2,  7,  0, 64,  2, 73,  0,  4,  0, 14,  0, 65,  2, 74,  0, 66,  2,  4,  0, 67,  2,
+  0,  0, 95,  0, 75,  0, 68,  0, 22,  0, 32,  0, 34,  0, 75,  0, 68,  0, 16,  2, 14,  0, 68,  2, 14,  0, 29,  2, 73,  0, 69,  2,
+ 27,  0, 70,  2, 27,  0, 71,  2, 27,  0, 72,  2, 31,  0, 80,  0, 76,  0, 73,  2, 33,  0, 74,  2, 63,  0, 31,  2, 14,  0, 75,  2,
+  7,  0, 78,  1,  7,  0,177,  0,  7,  0, 79,  1,  2,  0, 16,  0,  2,  0,179,  0,  2,  0, 76,  2,  2,  0, 77,  2,  7,  0, 78,  2,
+  7,  0, 79,  2,  4,  0, 80,  2,  2,  0, 27,  0,  2,  0, 33,  2,  2,  0, 18,  0,  2,  0, 81,  2,  7,  0, 82,  2,  7,  0, 83,  2,
+  7,  0, 84,  2,  2,  0, 51,  2,  2,  0, 52,  2,  2,  0, 85,  2,  2,  0, 86,  2,  4,  0, 87,  2, 11,  0, 88,  2,  2,  0, 22,  0,
+  2,  0, 98,  0,  2,  0, 66,  0,  2,  0, 89,  2,  7,  0, 90,  2,  7,  0, 91,  2,  7,  0, 92,  2,  7,  0, 93,  2,  7,  0, 94,  2,
+  7,  0, 95,  2,  7,  0, 96,  2,  7,  0, 97,  2,  7,  0, 98,  2,  7,  0, 99,  2,  0,  0,100,  2, 77,  0,101,  2, 78,  0,102,  2,
+  0,  0,103,  2, 65,  0,104,  2, 65,  0,105,  2, 65,  0,106,  2, 65,  0,107,  2,  4,  0,108,  2,  7,  0, 84,  0,  4,  0,109,  2,
+  4,  0,110,  2, 72,  0,111,  2,  4,  0,112,  2,  4,  0,113,  2, 71,  0,114,  2, 71,  0,115,  2, 79,  0, 47,  0, 22,  0, 32,  0,
+ 34,  0, 75,  0, 68,  0, 16,  2, 31,  0, 80,  0, 33,  0, 74,  2, 63,  0, 31,  2, 80,  0,116,  2, 81,  0,117,  2, 82,  0,118,  2,
+ 83,  0,119,  2, 84,  0,120,  2, 85,  0,121,  2, 86,  0,122,  2, 87,  0,123,  2, 88,  0,124,  2, 89,  0,125,  2, 90,  0,126,  2,
+ 91,  0,127,  2, 92,  0,128,  2, 79,  0,129,  2, 93,  0,130,  2, 94,  0,131,  2, 95,  0,132,  2, 95,  0,133,  2, 95,  0,134,  2,
+ 95,  0,135,  2, 95,  0,136,  2,  4,  0, 53,  0,  4,  0,137,  2,  4,  0,138,  2,  4,  0,139,  2,  4,  0,140,  2,  4,  0,141,  2,
+  4,  0,142,  2,  7,  0, 78,  1,  7,  0,177,  0,  7,  0, 79,  1,  2,  0,179,  0,  2,  0, 76,  2,  2,  0,143,  2,  2,  0, 18,  0,
+  2,  0,144,  2,  2,  0,145,  2,  0,  0,146,  2,  0,  0,147,  2,  2,  0, 33,  2, 96,  0,148,  2, 87,  0,  8,  0, 11,  0,149,  2,
+  7,  0,150,  2,  4,  0,151,  2,  0,  0, 18,  0,  0,  0,152,  2,  2,  0, 88,  1,  2,  0,153,  2,  2,  0,154,  2, 85,  0,  7,  0,
+  4,  0,155,  2,  4,  0,156,  2,  4,  0,157,  2,  4,  0,158,  2,  2,  0, 48,  2,  0,  0,159,  2,  0,  0, 18,  0, 89,  0,  5,  0,
+  4,  0,155,  2,  4,  0,156,  2,  0,  0,160,  2,  0,  0,161,  2,  2,  0, 18,  0, 97,  0,  2,  0,  4,  0,162,  2,  7,  0, 40,  2,
+ 90,  0,  3,  0, 97,  0,163,  2,  4,  0,164,  2,  4,  0, 18,  0, 88,  0,  4,  0,  7,  0,165,  2,  2,  0,166,  2,  0,  0, 18,  0,
+  0,  0,161,  2, 91,  0,  4,  0,  0,  0,241,  0,  0,  0,186,  0,  0,  0,187,  0,  0,  0,188,  0, 80,  0,  5,  0,  4,  0,167,  2,
+  4,  0,141,  2,  2,  0, 48,  2,  0,  0, 18,  0,  0,  0, 27,  0, 82,  0,  2,  0,  4,  0,168,  2,  4,  0,169,  2, 81,  0,  6,  0,
+ 42,  0,149,  2,  0,  0, 18,  0,  0,  0,152,  2,  2,  0, 88,  1,  2,  0,153,  2,  2,  0,154,  2, 83,  0,  2,  0,  7,  0,170,  2,
+  4,  0, 18,  0, 84,  0,  4,  0,  0,  0,186,  0,  0,  0,187,  0,  0,  0,188,  0,  0,  0,241,  0, 92,  0,  1,  0,  7,  0,171,  2,
+ 93,  0,  2,  0,  4,  0, 14,  2,  4,  0, 16,  0, 86,  0,  7,  0,  7,  0,150,  2, 42,  0,149,  2,  0,  0, 18,  0,  0,  0,152,  2,
+  2,  0, 88,  1,  2,  0,153,  2,  2,  0,154,  2, 98,  0,  1,  0,  7,  0,172,  2, 99,  0,  1,  0,  4,  0,173,  2,100,  0,  1,  0,
+  0,  0,174,  2,101,  0,  1,  0,  7,  0,150,  2,102,  0,  1,  0,  7,  0,170,  2,103,  0,  4,  0,  4,  0,175,  2,  4,  0,176,  2,
+  7,  0,177,  2,  4,  0,178,  2,104,  0,  4,  0,  7,  0,241,  0,  7,  0,186,  0,  7,  0,187,  0,  7,  0,188,  0,105,  0,  1,  0,
+104,  0,151,  2,106,  0,  5,  0,  4,  0,179,  2,  4,  0,180,  2,  0,  0, 18,  0,  0,  0, 48,  2,  0,  0,181,  2,107,  0,  2,  0,
+  4,  0,182,  2,  4,  0,180,  2,108,  0, 10,  0,108,  0,  0,  0,108,  0,  1,  0,106,  0,183,  2,105,  0,184,  2,107,  0,185,  2,
+  4,  0, 53,  0,  4,  0,138,  2,  4,  0,137,  2,  4,  0, 27,  0, 88,  0,186,  2, 96,  0, 14,  0, 14,  0,187,  2, 88,  0,186,  2,
+  0,  0,188,  2,  0,  0,189,  2,  0,  0,190,  2,  0,  0,191,  2,  0,  0,192,  2,  0,  0,193,  2,  0,  0,194,  2,  0,  0, 18,  0,
+ 95,  0,132,  2, 95,  0,134,  2,  2,  0,195,  2,  0,  0,196,  2,109,  0,  1,  0,  4,  0,173,  2,110,  0,  9,  0,110,  0,  0,  0,
+110,  0,  1,  0,  4,  0, 16,  0,  4,  0, 88,  1,  4,  0,197,  2,  4,  0, 27,  0,  0,  0, 19,  0, 41,  0,126,  0,  0,  0,198,  2,
+111,  0,  6,  0,110,  0,199,  2, 47,  0,200,  2, 27,  0,201,  2,  0,  0,202,  2,  4,  0,203,  2,  4,  0,204,  2,112,  0,  7,  0,
+110,  0,199,  2,  2,  0,205,  2,  2,  0,187,  2,  2,  0,206,  2,  2,  0, 93,  0, 11,  0,207,  2, 11,  0,208,  2,113,  0,  5,  0,
+110,  0,199,  2, 27,  0,169,  0,  0,  0, 19,  0,  7,  0,209,  2,  0,  0, 95,  0,114,  0,  5,  0,110,  0,199,  2, 27,  0,169,  0,
+  0,  0, 19,  0,  2,  0,210,  2,  0,  0,211,  2,115,  0,  5,  0,110,  0,199,  2,  7,  0, 90,  0,  7,  0,212,  2,  4,  0,213,  2,
+  4,  0,214,  2,116,  0,  5,  0,110,  0,199,  2, 27,  0,215,  2,  0,  0, 70,  0,  4,  0, 88,  1,  4,  0, 18,  0,117,  0, 13,  0,
+110,  0,199,  2, 27,  0,216,  2, 27,  0,217,  2, 27,  0,218,  2, 27,  0,219,  2,  7,  0,220,  2,  7,  0,221,  2,  7,  0,212,  2,
+  7,  0,222,  2,  4,  0,223,  2,  4,  0,224,  2,  4,  0, 93,  0,  4,  0,225,  2,118,  0,  5,  0,110,  0,199,  2,  2,  0,226,  2,
+  2,  0, 18,  0,  7,  0,227,  2, 27,  0,228,  2,119,  0,  3,  0,110,  0,199,  2,  7,  0,229,  2,  4,  0, 93,  0,120,  0, 10,  0,
+110,  0,199,  2,  7,  0,230,  2,  4,  0,231,  2,  4,  0, 27,  0,  2,  0, 93,  0,  2,  0,232,  2,  2,  0,233,  2,  2,  0,234,  2,
+  7,  0,235,  2,  0,  0,236,  2,121,  0,  3,  0,110,  0,199,  2,  7,  0, 27,  0,  4,  0, 16,  0,122,  0,  6,  0,110,  0,199,  2,
+123,  0,237,  2,124,  0,238,  2,125,  0,239,  2,  7,  0,240,  2,  4,  0, 16,  0,126,  0, 11,  0,110,  0,199,  2, 47,  0,200,  2,
+ 27,  0,201,  2,  0,  0,202,  2,  4,  0,203,  2,  4,  0,204,  2,  7,  0,209,  2,  4,  0,241,  2,  0,  0,236,  2,  7,  0,242,  2,
+  4,  0, 27,  0,127,  0, 12,  0,110,  0,199,  2, 27,  0,243,  2, 42,  0,244,  2,  4,  0, 93,  0,  4,  0,245,  2,  7,  0,246,  2,
+  7,  0,247,  2,  7,  0,248,  2,  7,  0,249,  2,  0,  0,202,  2,  4,  0,203,  2,  4,  0, 27,  0,128,  0,  3,  0,110,  0,199,  2,
+  7,  0,250,  2,  4,  0,251,  2,129,  0,  5,  0,110,  0,199,  2,  7,  0,252,  2,  0,  0,236,  2,  2,  0, 18,  0,  2,  0,253,  2,
+130,  0,  8,  0,110,  0,199,  2, 27,  0,169,  0,  7,  0,252,  2,  7,  0,  0,  1,  7,  0,109,  0,  0,  0,236,  2,  2,  0, 18,  0,
+  2,  0, 16,  0,131,  0, 21,  0,110,  0,199,  2, 47,  0,200,  2, 27,  0,201,  2,  0,  0,202,  2,  4,  0,203,  2,  4,  0,204,  2,
+ 27,  0,254,  2,  0,  0,236,  2,  2,  0, 18,  0,  2,  0, 27,  0,  7,  0,255,  2,  7,  0,  0,  3,  7,  0,  1,  3,  7,  0, 82,  2,
+  7,  0,  2,  3,  7,  0,  3,  3,  7,  0,  4,  3,  7,  0,  5,  3,  7,  0,  6,  3,  7,  0,  7,  3,  7,  0, 92,  0,132,  0,  7,  0,
+110,  0,199,  2,  2,  0,  8,  3,  2,  0,  9,  3,  4,  0, 30,  0, 27,  0,169,  0,  7,  0, 10,  3,  0,  0,236,  2,133,  0, 10,  0,
+110,  0,199,  2, 27,  0,169,  0,  0,  0, 11,  3,  7,  0, 12,  3,  7,  0, 13,  3,  7,  0,  5,  3,  4,  0, 14,  3,  4,  0, 15,  3,
+  7,  0, 16,  3,  0,  0, 19,  0,134,  0,  1,  0,110,  0,199,  2,135,  0,  7,  0,110,  0,199,  2, 41,  0,126,  0,136,  0, 17,  3,
+137,  0, 18,  3,138,  0, 19,  3,139,  0, 20,  3, 14,  0, 21,  3,140,  0, 13,  0,110,  0,199,  2, 88,  0, 22,  3, 88,  0, 23,  3,
+ 88,  0, 24,  3, 88,  0, 25,  3, 88,  0, 26,  3, 88,  0, 27,  3, 85,  0, 28,  3,  4,  0, 29,  3,  4,  0, 30,  3,  7,  0, 31,  3,
+  7,  0, 32,  3,141,  0, 33,  3,142,  0,  7,  0,110,  0,199,  2, 88,  0, 22,  3, 88,  0, 34,  3,143,  0, 35,  3,144,  0, 33,  3,
+  4,  0, 36,  3,  4,  0, 29,  3,145,  0,  4,  0,110,  0,199,  2, 27,  0,169,  0,  4,  0, 37,  3,  4,  0, 27,  0,146,  0,  2,  0,
+  4,  0, 38,  3,  7,  0, 40,  2,147,  0,  2,  0,  4,  0,129,  0,  4,  0, 39,  3,148,  0, 24,  0,110,  0,199,  2, 27,  0,169,  0,
+  0,  0,236,  2,  2,  0, 40,  3,  2,  0, 18,  0,  2,  0, 88,  1,  2,  0, 27,  0,146,  0, 41,  3,  4,  0, 42,  3,  7,  0, 43,  3,
+  4,  0, 53,  0,  4,  0, 44,  3,147,  0, 45,  3,146,  0, 46,  3,  4,  0, 47,  3,  4,  0, 48,  3,  4,  0, 49,  3,  4,  0, 39,  3,
+  7,  0, 50,  3,  7,  0, 51,  3,  7,  0, 52,  3,  7,  0, 53,  3,  7,  0, 54,  3, 11,  0, 55,  3,149,  0,  8,  0,110,  0,199,  2,
+150,  0, 56,  3,143,  0, 35,  3,  4,  0, 57,  3,  4,  0, 58,  3,  4,  0, 59,  3,  2,  0, 18,  0,  2,  0, 56,  0,151,  0,  8,  0,
+110,  0,199,  2, 27,  0, 44,  0,  2,  0,  4,  1,  2,  0, 18,  0,  2,  0,226,  2,  2,  0, 56,  0,  7,  0, 60,  3,  7,  0, 61,  3,
+152,  0,  6,  0,110,  0,199,  2,  4,  0, 62,  3,  2,  0, 18,  0,  2,  0, 63,  3,  7,  0, 64,  3,  0,  0,171,  0,153,  0,  8,  0,
+110,  0,199,  2,  0,  0, 65,  3,  0,  0, 66,  3,  0,  0,193,  2,  0,  0, 67,  3,  0,  0, 68,  3,  0,  0, 93,  0,  0,  0,181,  2,
+154,  0,  3,  0,110,  0,199,  2,155,  0, 69,  3,139,  0, 20,  3,156,  0, 10,  0,110,  0,199,  2, 27,  0, 70,  3, 27,  0, 71,  3,
+  0,  0, 72,  3,  7,  0, 73,  3,  2,  0, 74,  3,  2,  0, 75,  3,  0,  0, 76,  3,  0,  0, 77,  3,  0,  0,211,  2,157,  0,  9,  0,
+110,  0,199,  2, 27,  0, 78,  3,  0,  0, 72,  3,  7,  0, 79,  3,  7,  0, 80,  3,  0,  0, 88,  1,  0,  0,226,  2,  0,  0, 81,  3,
+  0,  0, 27,  0,158,  0,  1,  0,110,  0,199,  2,159,  0, 11,  0,110,  0,199,  2,  0,  0,236,  2,  7,  0,129,  0,  7,  0, 82,  3,
+  7,  0, 83,  3,  7,  0, 84,  3,  7,  0, 85,  3,  7,  0, 86,  3,  4,  0, 18,  0,  2,  0, 87,  3,  2,  0, 88,  3,160,  0,  9,  0,
+110,  0,199,  2, 27,  0, 89,  3,  4,  0, 90,  3,  4,  0, 91,  3,  4,  0, 92,  3,  7,  0, 93,  3,  7,  0, 94,  3,  2,  0,226,  2,
+  2,  0, 18,  0,161,  0, 29,  0,110,  0,199,  2,162,  0, 95,  3,163,  0, 96,  3,  4,  0, 97,  3,  4,  0, 98,  3,  7,  0, 99,  3,
+  7,  0,  4,  3,  7,  0,100,  3,  7,  0,251,  0,  7,  0,101,  3,  7,  0,102,  3,  7,  0,103,  3,  7,  0,104,  3,  7,  0,105,  3,
+  7,  0,240,  2,  4,  0,106,  3,  4,  0,107,  3,  0,  0,108,  3,  0,  0,109,  3,  0,  0,110,  3,  0,  0,111,  3,  0,  0, 18,  0,
+  0,  0,112,  3,  2,  0,113,  3,  2,  0,114,  3,  4,  0,214,  2,  7,  0,109,  0,  7,  0,115,  3,  4,  0, 27,  0,164,  0, 15,  0,
+110,  0,199,  2, 47,  0,200,  2, 27,  0,201,  2,  0,  0,202,  2,  4,  0,203,  2,  4,  0,204,  2, 27,  0,116,  3, 27,  0,117,  3,
+ 54,  0,101,  1,  0,  0,236,  2,  7,  0,209,  2,  7,  0,118,  3,  0,  0, 18,  0,  0,  0,254,  0,  0,  0,211,  2,165,  0, 16,  0,
+110,  0,199,  2,  0,  0,236,  2,  2,  0,119,  3,  2,  0,254,  0,  7,  0,120,  3, 54,  0,121,  3,  7,  0,122,  3,  7,  0,123,  3,
+  7,  0,124,  3,  0,  0,125,  3,  4,  0,126,  3, 47,  0,127,  3, 27,  0,128,  3,  4,  0,129,  3,  0,  0,130,  3,  4,  0,131,  3,
+166,  0, 16,  0,110,  0,199,  2,  0,  0,132,  3,  0,  0,133,  3,  7,  0,134,  3,  7,  0,135,  3,  0,  0,136,  3,  0,  0,137,  3,
+  0,  0,138,  3,  7,  0,124,  3,  0,  0,125,  3,  4,  0,126,  3, 47,  0,127,  3, 27,  0,128,  3,  4,  0,129,  3,  0,  0,130,  3,
+  4,  0,131,  3,167,  0, 16,  0,110,  0,199,  2,  0,  0,236,  2,  4,  0,139,  3,  4,  0,140,  3, 27,  0,141,  3,  7,  0,124,  3,
+  0,  0,125,  3,  4,  0,126,  3, 47,  0,127,  3, 27,  0,128,  3,  4,  0,129,  3,  0,  0,130,  3,  7,  0,142,  3,  7,  0,143,  3,
+  2,  0,254,  0,  2,  0,144,  3,168,  0,  5,  0,110,  0,199,  2,169,  0,145,  3,170,  0,146,  3,  4,  0, 16,  0,  4,  0, 27,  0,
+171,  0,  8,  0,110,  0,199,  2,  7,  0,147,  3,  7,  0,148,  3,  7,  0,149,  3,  0,  0,251,  0,  0,  0, 18,  0,  0,  0, 88,  1,
+  0,  0, 27,  0,172,  0,  3,  0,173,  0,150,  3,  4,  0, 67,  2,  0,  0, 95,  0,173,  0, 29,  0, 22,  0, 32,  0, 34,  0, 75,  0,
+  2,  0, 49,  2,  2,  0, 50,  2,  2,  0,151,  3,  2,  0, 18,  0,  2,  0,152,  3,  2,  0,153,  3,  2,  0,154,  3,  2,  0, 30,  0,
+  0,  0,155,  3,  0,  0,156,  3,  0,  0,157,  3,  0,  0, 74,  0,  4,  0, 27,  0,  7,  0,158,  3,  7,  0,159,  3,  7,  0,160,  3,
+  7,  0,161,  3,  7,  0,162,  3,  7,  0,163,  3, 29,  0,164,  3, 31,  0, 80,  0, 33,  0, 74,  2, 90,  0,126,  2,  0,  0, 70,  0,
+  7,  0,165,  3,  7,  0,166,  3,172,  0,167,  3,174,  0,  5,  0,174,  0,  0,  0,174,  0,  1,  0,  0,  0, 19,  0,  0,  0, 18,  0,
+  0,  0,125,  0, 68,  0,  3,  0,  7,  0,168,  3,  4,  0, 18,  0,  4,  0, 27,  0, 27,  0,128,  0, 22,  0, 32,  0, 34,  0, 75,  0,
+175,  0,169,  3,  2,  0, 16,  0,  2,  0,170,  3,  4,  0,171,  3,  4,  0,172,  3,  4,  0,173,  3,  0,  0,174,  3, 27,  0, 38,  0,
+ 27,  0,175,  3, 27,  0,176,  3, 27,  0,177,  3, 27,  0,178,  3, 31,  0, 80,  0, 68,  0, 16,  2,176,  0,179,  3,176,  0,180,  3,
+177,  0,181,  3, 11,  0,  2,  0,178,  0,182,  3,179,  0,183,  3,180,  0,184,  3, 14,  0,185,  3, 14,  0,186,  3, 14,  0, 29,  2,
+ 14,  0,187,  3, 14,  0,188,  3,  4,  0, 88,  1,  4,  0,189,  3, 63,  0, 31,  2,  0,  0,190,  3,  4,  0, 33,  2,  4,  0,191,  3,
+  7,  0, 78,  1,  7,  0,192,  3,  7,  0,193,  3,  7,  0,177,  0,  7,  0,194,  3,  7,  0,195,  3,  7,  0, 79,  1,  7,  0,196,  3,
+  7,  0, 19,  2,  7,  0,197,  3,  7,  0,198,  3,  7,  0,199,  3,  7,  0,200,  3,  7,  0,201,  3,  7,  0,202,  3,  7,  0, 12,  3,
+  7,  0,203,  3,  7,  0,245,  0,  7,  0,204,  3,  4,  0,205,  3,  4,  0,206,  3,  2,  0, 18,  0,  2,  0,207,  3,  2,  0,208,  3,
+  2,  0,209,  3,  2,  0,210,  3,  2,  0,211,  3,  2,  0,212,  3,  2,  0,213,  3,  2,  0,214,  3,  0,  0,215,  3,  0,  0,216,  3,
+  4,  0,217,  3,  4,  0,218,  3,  4,  0,219,  3,  4,  0,220,  3,  7,  0,221,  3,  7,  0, 84,  0,  7,  0,222,  3,  7,  0,223,  3,
+  7,  0,224,  3,  7,  0,225,  3,  7,  0,226,  3,  7,  0,221,  0,  7,  0,227,  3,  7,  0,228,  3,  7,  0,229,  3,  7,  0,230,  3,
+  7,  0,231,  3,  2,  0,232,  3,  0,  0,233,  3,  0,  0,234,  3,  0,  0,235,  3,  0,  0,236,  3,  0,  0,111,  0,  0,  0,237,  3,
+  7,  0,238,  3,  7,  0,239,  3, 14,  0,240,  3, 14,  0,241,  3, 14,  0,242,  3, 14,  0,243,  3,  7,  0,244,  3,  2,  0, 14,  2,
+  2,  0,245,  3,  7,  0,151,  2,  4,  0,246,  3,  4,  0,247,  3,181,  0,248,  3,  2,  0,249,  3,  2,  0,252,  0,  7,  0,250,  3,
+ 14,  0,251,  3, 14,  0,252,  3, 14,  0,253,  3, 14,  0,254,  3,182,  0, 74,  1,183,  0,255,  3, 64,  0,  0,  4,  0,  0,  1,  4,
+  0,  0,  2,  4,  2,  0, 67,  2,  7,  0,143,  2,155,  0,  3,  4,143,  0,  4,  4,143,  0,  5,  4, 10,  0,  6,  4, 10,  0,  7,  4,
+  4,  0,  8,  4,  4,  0,  9,  4, 14,  0, 10,  4, 14,  0, 11,  4, 14,  0, 12,  4,  7,  0, 13,  4,184,  0, 14,  0,184,  0,  0,  0,
+184,  0,  1,  0, 27,  0, 38,  0,  7,  0, 12,  3,  7,  0, 80,  1,  7,  0, 13,  3,  7,  0,  5,  3,  0,  0, 19,  0,  4,  0, 14,  3,
+  4,  0, 15,  3,  4,  0, 14,  4,  2,  0, 16,  0,  2,  0, 15,  4,  7,  0, 16,  3,185,  0, 12,  0,185,  0,  0,  0,185,  0,  1,  0,
+ 27,  0, 44,  0,  4,  0, 16,  4,  4,  0, 14,  2,  7,  0, 80,  1,  7,  0, 17,  4,  7,  0, 18,  4,  7,  0,170,  2,  2,  0, 16,  0,
+  0,  0, 19,  4,  0,  0, 20,  4,182,  0, 40,  0,  4,  0, 18,  0,  2,  0, 21,  4,  2,  0, 22,  4,  2,  0,  5,  3,  2,  0, 23,  4,
+  2,  0, 24,  4,  2,  0, 25,  4,  2,  0, 26,  4,  2,  0, 27,  4,  7,  0, 28,  4,  7,  0, 29,  4,  7,  0, 30,  4,  7,  0, 31,  4,
+  7,  0, 32,  4,  7,  0, 33,  4,  7,  0, 34,  4,  7,  0, 35,  4,  7,  0, 36,  4,  7,  0, 37,  4,  7,  0, 38,  4,  7,  0, 39,  4,
+  7,  0, 40,  4,  7,  0, 41,  4,  7,  0, 42,  4,  7,  0, 43,  4,  7,  0, 44,  4,  7,  0, 45,  4,  7,  0, 46,  4,  7,  0, 47,  4,
+  7,  0, 48,  4,  7,  0, 49,  4,  7,  0, 50,  4,  7,  0, 51,  4,  7,  0, 52,  4,  7,  0, 53,  4,  7,  0, 54,  4, 47,  0,170,  0,
+186,  0, 55,  4,  7,  0, 56,  4,  4,  0,214,  2,187,  0,  5,  0, 64,  0,250,  1,  7,  0, 57,  4,  7,  0, 58,  4,  2,  0, 18,  0,
+  2,  0, 59,  4,188,  0,  5,  0,188,  0,  0,  0,188,  0,  1,  0,  4,  0, 16,  0,  4,  0, 60,  4, 11,  0,  2,  0,189,  0,  9,  0,
+189,  0,  0,  0,189,  0,  1,  0,  4,  0, 61,  4,  4,  0, 62,  4,  4,  0, 63,  4,  4,  0, 18,  0, 11,  0, 64,  4, 11,  0, 65,  4,
+ 14,  0, 66,  4,139,  0, 23,  0,139,  0,  0,  0,139,  0,  1,  0,  4,  0, 18,  0,  4,  0, 67,  4,  4,  0, 68,  4,  4,  0, 69,  4,
+  4,  0, 70,  4,  4,  0, 71,  4,  4,  0, 72,  4,  4,  0, 73,  4,  4,  0, 27,  0,  4,  0, 62,  4,  4,  0, 14,  2,  2,  0, 74,  4,
+  2,  0, 56,  0,  0,  0, 19,  0,  0,  0, 75,  4,  0,  0, 76,  4,  0,  0, 77,  4,  0,  0, 78,  4, 14,  0, 79,  4,190,  0, 80,  4,
+ 11,  0, 81,  4,191,  0,  1,  0,  7,  0, 47,  2,181,  0, 30,  0,  4,  0, 18,  0,  7,  0, 82,  4,  7,  0, 83,  4,  7,  0, 84,  4,
+  4,  0, 85,  4,  4,  0, 86,  4,  4,  0, 87,  4,  4,  0, 88,  4,  7,  0, 89,  4,  7,  0, 90,  4,  7,  0, 91,  4,  7,  0, 92,  4,
+  7,  0, 93,  4,  7,  0, 94,  4,  7,  0, 95,  4,  7,  0, 96,  4,  7,  0, 97,  4,  7,  0, 98,  4,  7,  0, 99,  4,  7,  0,100,  4,
+  7,  0,101,  4,  7,  0,102,  4,  7,  0,103,  4,  7,  0,104,  4,  7,  0,105,  4,  7,  0,106,  4,  4,  0,107,  4,  4,  0,108,  4,
+  7,  0,109,  4,  7,  0,227,  3,183,  0, 54,  0,  4,  0, 62,  4,  4,  0,110,  4,192,  0,111,  4,193,  0,112,  4,  0,  0, 27,  0,
+  0,  0,113,  4,  2,  0,114,  4,  7,  0,115,  4,  0,  0,116,  4,  7,  0,117,  4,  7,  0,118,  4,  7,  0,119,  4,  7,  0,120,  4,
+  7,  0,121,  4,  7,  0,122,  4,  7,  0,123,  4,  7,  0,124,  4,  7,  0,125,  4,  2,  0,126,  4,  0,  0,127,  4,  2,  0,128,  4,
+  7,  0,129,  4,  7,  0,130,  4,  0,  0,131,  4,  4,  0,130,  0,  4,  0,132,  4,  4,  0,133,  4,  2,  0,134,  4,  2,  0,135,  4,
+191,  0,136,  4,  4,  0,137,  4,  4,  0, 82,  0,  7,  0,138,  4,  7,  0,139,  4,  7,  0,140,  4,  7,  0,141,  4,  2,  0,142,  4,
+  2,  0,143,  4,  2,  0,144,  4,  2,  0,145,  4,  2,  0,146,  4,  2,  0,147,  4,  2,  0,148,  4,  2,  0,149,  4,194,  0,150,  4,
+  7,  0,151,  4,  7,  0,152,  4,139,  0,153,  4, 14,  0, 21,  3,187,  0,154,  4,  7,  0,155,  4,  7,  0,156,  4,  7,  0,157,  4,
+  4,  0,158,  4,195,  0,  1,  0,  7,  0,159,  4,155,  0, 52,  0,154,  0,160,  4,  2,  0, 16,  0,  2,  0,161,  4,  2,  0,162,  4,
+  2,  0,163,  4,  7,  0,164,  4,  2,  0,165,  4,  2,  0,166,  4,  7,  0,167,  4,  2,  0,168,  4,  2,  0,169,  4,  7,  0,170,  4,
+  7,  0,171,  4,  7,  0,172,  4,  4,  0,173,  4,  4,  0,174,  4,  4,  0,175,  4,  4,  0, 27,  0,  7,  0,176,  4,  4,  0,177,  4,
+  7,  0,178,  4,  7,  0,179,  4,  7,  0,180,  4, 79,  0,181,  4, 79,  0,182,  4,  0,  0,183,  4,  7,  0,184,  4,  7,  0,185,  4,
+ 31,  0, 80,  0,  2,  0,186,  4,  0,  0,187,  4,  0,  0,188,  4,  7,  0,189,  4,  4,  0,190,  4,  7,  0,191,  4,  7,  0,192,  4,
+  4,  0,193,  4,  4,  0, 18,  0,  7,  0,194,  4,  7,  0,195,  4,  7,  0,196,  4,195,  0,197,  4,  4,  0, 53,  0,  7,  0,198,  4,
+  7,  0,199,  4,  7,  0,200,  4,  7,  0,201,  4,  7,  0,202,  4,  7,  0,203,  4,  7,  0,204,  4,  4,  0,205,  4,  7,  0,206,  4,
+196,  0, 78,  0, 22,  0, 32,  0, 34,  0, 75,  0,  2,  0,180,  0,  2,  0, 89,  1,  2,  0,123,  1,  2,  0,207,  4,  7,  0,208,  4,
+  7,  0,209,  4,  7,  0,210,  4,  7,  0,211,  4,  7,  0,212,  4,  7,  0,213,  4,  7,  0,171,  1,  7,  0,173,  1,  7,  0,172,  1,
+  7,  0, 30,  0,  4,  0,214,  4,  7,  0,215,  4,  7,  0,216,  4,  7,  0,217,  4,  7,  0,218,  4,  7,  0,219,  4,  7,  0,220,  4,
+  7,  0,221,  4,  2,  0,222,  4,  2,  0, 88,  1,  2,  0,223,  4,  2,  0,224,  4,  2,  0,225,  4,  2,  0,226,  4,  2,  0,227,  4,
+  2,  0,228,  4,  7,  0,229,  4,  7,  0,230,  4,  7,  0,231,  4,  7,  0,232,  4,  7,  0,233,  4,  7,  0,234,  4,  7,  0,235,  4,
+  7,  0,236,  4,  7,  0,237,  4,  7,  0,238,  4,  7,  0,239,  4,  7,  0,240,  4,  2,  0,241,  4,  2,  0,242,  4,  2,  0,243,  4,
+  2,  0,244,  4,  7,  0,245,  4,  7,  0,246,  4,  7,  0,247,  4,  7,  0,248,  4,  2,  0,249,  4,  2,  0,250,  4,  2,  0,251,  4,
+  2,  0,252,  4,  7,  0,253,  4,  7,  0,254,  4,  7,  0,255,  4,  7,  0,  0,  5,  7,  0,  1,  5,  7,  0,  2,  5,  7,  0,  3,  5,
+  2,  0,  4,  5,  2,  0,  5,  5,  2,  0,  6,  5,  2,  0,  7,  5,  2,  0,  8,  5,  2,  0, 18,  0,  7,  0,  9,  5,  7,  0, 10,  5,
+ 31,  0, 80,  0, 46,  0,141,  1,  2,  0,142,  1,  2,  0, 77,  1,  2,  0,181,  2, 25,  0,155,  0, 57,  0, 71,  1,197,  0,  8,  0,
+197,  0,  0,  0,197,  0,  1,  0,  4,  0,205,  3,  4,  0, 11,  5,  4,  0, 18,  0,  2,  0, 12,  5,  2,  0, 13,  5, 27,  0,169,  0,
+198,  0, 13,  0, 11,  0, 14,  5, 11,  0, 15,  5,  4,  0, 16,  5,  4,  0, 17,  5,  4,  0, 18,  5,  4,  0, 19,  5,  4,  0, 20,  5,
+  4,  0, 21,  5,  4,  0, 22,  5,  4,  0, 23,  5,  4,  0, 24,  5,  4,  0, 27,  0,  0,  0, 25,  5,199,  0,  5,  0, 11,  0, 26,  5,
+ 11,  0, 27,  5,  4,  0, 28,  5,  4,  0, 30,  0,  0,  0, 29,  5,200,  0, 17,  0,  4,  0, 30,  5,  4,  0, 31,  5,  4,  0, 32,  5,
+  4,  0, 33,  5,  4,  0, 34,  5,  4,  0, 35,  5,  4,  0, 36,  5,  4,  0, 37,  5,  4,  0, 38,  5,  4,  0, 39,  5,  4,  0, 40,  5,
+  4,  0, 41,  5,  2,  0, 42,  5,  2,  0, 43,  5,  4,  0, 44,  5,  4,  0, 45,  5,  4,  0, 92,  0,201,  0, 17,  0,  4,  0, 16,  0,
+  4,  0, 32,  5,  4,  0, 46,  5,  4,  0, 47,  5,  4,  0, 48,  5,  4,  0, 49,  5,  4,  0, 50,  5,  4,  0, 51,  5,  7,  0, 52,  5,
+  4,  0, 53,  5,  4,  0, 93,  0,  4,  0, 54,  5,  4,  0, 55,  5,  4,  0, 56,  5,  4,  0, 57,  5,  4,  0, 58,  5, 21,  0, 31,  0,
+202,  0,  9,  0,  4,  0, 59,  5,  7,  0, 60,  5,  7,  0, 61,  5,  7,  0, 62,  5,  4,  0, 63,  5,  2,  0, 18,  0,  2,  0, 27,  0,
+  7,  0, 84,  4,  7,  0, 30,  0,203,  0, 11,  0,203,  0,  0,  0,203,  0,  1,  0,  0,  0, 19,  0, 63,  0, 64,  5, 64,  0, 65,  5,
+  4,  0,205,  3,  4,  0, 66,  5,  4,  0, 67,  5,  4,  0, 27,  0,  4,  0, 68,  5,  4,  0, 69,  5,204,  0, 13,  0,  0,  0, 70,  5,
+  0,  0,251,  0,  0,  0, 71,  5,  0,  0, 18,  0,  0,  0, 72,  5,  0,  0, 73,  5,  0,  0, 74,  5,  0,  0, 75,  5,  2,  0, 76,  5,
+  2,  0, 77,  5,  7,  0, 78,  5,  0,  0, 79,  5,  0,  0,125,  0,205,  0,106,  0,204,  0, 80,  5,198,  0, 81,  5,199,  0, 82,  5,
+200,  0, 83,  5,201,  0, 84,  5,  4,  0, 36,  3,  4,  0,130,  0,  4,  0,132,  4,  7,  0, 85,  5,  4,  0, 86,  5,  4,  0, 87,  5,
+  4,  0, 88,  5,  4,  0, 89,  5,  2,  0, 18,  0,  2,  0, 90,  5,  7,  0, 91,  5,  7,  0, 92,  5,  7,  0, 93,  5,  7,  0, 94,  5,
+  7,  0, 95,  5,  2,  0, 96,  5,  2,  0, 97,  5,  2,  0, 98,  5,  2,  0, 99,  5,  2,  0,251,  0,  2,  0,100,  5,  4,  0,101,  5,
+  2,  0,102,  5,  2,  0,103,  5,  2,  0,110,  1,  2,  0,109,  0,  2,  0,104,  5,  2,  0,105,  5,  2,  0,106,  5,  2,  0,107,  5,
+  2,  0,108,  5,  2,  0, 71,  5,  2,  0, 70,  5,  2,  0,109,  5,  2,  0, 72,  5,  2,  0,110,  5,  4,  0,111,  5,  4,  0, 88,  1,
+  4,  0,112,  5,  2,  0,113,  5,  2,  0, 92,  0,  2,  0,114,  5,  2,  0,115,  5,  2,  0,116,  5,  2,  0,117,  5,  2,  0,118,  5,
+  2,  0,119,  5, 19,  0,120,  5, 19,  0,121,  5, 18,  0,122,  5, 14,  0,123,  5,  2,  0,124,  5,  2,  0,125,  5,  7,  0,126,  5,
+  7,  0,127,  5,  7,  0,128,  5,  7,  0,129,  5,  4,  0,130,  5,  7,  0,131,  5,  7,  0,132,  5,  7,  0,133,  5,  7,  0,134,  5,
+  2,  0,135,  5,  2,  0,136,  5,  2,  0,137,  5,  2,  0,138,  5,  2,  0,139,  5,  2,  0,140,  5,  7,  0,141,  5,  7,  0,142,  5,
+  7,  0,143,  5,  0,  0,144,  5,  4,  0,145,  5,  2,  0,146,  5,  2,  0, 74,  0,  0,  0,147,  5,  7,  0,148,  5,  7,  0,149,  5,
+  0,  0,150,  5,  0,  0,151,  5,  0,  0,152,  5,  0,  0,153,  5,  4,  0,154,  5,  2,  0,155,  5,  2,  0,156,  5,  7,  0,157,  5,
+  7,  0,158,  5,  2,  0,159,  5,  2,  0,160,  5,  7,  0,161,  5,  2,  0,162,  5,  2,  0,163,  5,  4,  0,164,  5,  2,  0,165,  5,
+  2,  0,166,  5,  2,  0,167,  5,  2,  0,168,  5,  7,  0,169,  5,  7,  0, 30,  0, 37,  0,170,  5,  0,  0,171,  5,206,  0,  9,  0,
+206,  0,  0,  0,206,  0,  1,  0,  0,  0,172,  5,  2,  0,173,  5,  2,  0,174,  5,  2,  0,175,  5,  2,  0, 92,  0,  7,  0,176,  5,
+  7,  0, 30,  0,207,  0,  7,  0,  2,  0,231,  2,  2,  0, 88,  1,  2,  0, 94,  3,  2,  0,177,  5,  7,  0,178,  5,  7,  0, 30,  0,
+ 37,  0,179,  5,208,  0,  5,  0,  7,  0,180,  5,  0,  0, 16,  0,  0,  0, 92,  0,  0,  0, 30,  0,  0,  0, 74,  0,209,  0, 15,  0,
+  7,  0,181,  5,  7,  0,182,  5,  7,  0,183,  5,  7,  0,184,  5,  7,  0,185,  5,  7,  0,186,  5,  7,  0,187,  5,  7,  0,188,  5,
+  7,  0,189,  5,  7,  0,190,  5,  4,  0,191,  5,  7,  0,192,  5,  7,  0,193,  5,  2,  0, 92,  0,  2,  0, 30,  0,210,  0, 32,  0,
+208,  0,194,  5,  2,  0,195,  5,  2,  0, 97,  5,  2,  0, 98,  5,  2,  0, 99,  5,  2,  0,251,  0,  2,  0,100,  5,  2,  0,196,  5,
+  2,  0,197,  5,  2,  0,198,  5,  2,  0,199,  5,207,  0,200,  5,  2,  0,201,  5,  2,  0,102,  5,  7,  0,202,  5,209,  0,203,  5,
+  7,  0,220,  4,  7,  0,221,  4,  4,  0, 18,  0,  2,  0, 88,  1,  2,  0,204,  5,  2,  0,223,  4,  2,  0,224,  4,  2,  0,205,  5,
+  2,  0, 27,  0,  2,  0,225,  4,  2,  0,226,  4,  2,  0,227,  4,  2,  0,228,  4,  2,  0,206,  5,  2,  0, 92,  0,  7,  0,207,  5,
+211,  0,  6,  0,211,  0,  0,  0,211,  0,  1,  0,  4,  0, 61,  4,  0,  0, 19,  0,  4,  0, 18,  0, 27,  0,208,  5,212,  0,  4,  0,
+213,  0,146,  3, 11,  0,209,  5,  0,  0,210,  5,  4,  0, 93,  0,214,  0,  8,  0,212,  0,211,  5,  2,  0, 18,  0,  2,  0, 27,  0,
+  2,  0,212,  5,  2,  0,213,  5,  2,  0,214,  5,  4,  0, 92,  0, 11,  0,215,  5,215,  0,  6,  0,  2,  0,109,  0,  2,  0, 67,  4,
+  2,  0,216,  5,  2,  0,225,  2,  4,  0, 18,  0,  7,  0,209,  2,216,  0, 14,  0,  2,  0, 18,  0,  2,  0,217,  5,  2,  0,218,  5,
+  2,  0,219,  5,215,  0,220,  5, 11,  0,215,  5,  7,  0,221,  5,  7,  0, 56,  0,  4,  0,222,  5,  4,  0,223,  5,  4,  0,224,  5,
+  4,  0,225,  5, 41,  0,126,  0, 27,  0,169,  0,217,  0, 14,  0,212,  0,211,  5,  4,  0, 93,  0,  4,  0,226,  5,  7,  0,227,  5,
+  7,  0,228,  5,  7,  0,229,  5,  4,  0,230,  5,  4,  0,231,  5,  7,  0,232,  5,  7,  0,233,  5,  4,  0,234,  5,  7,  0,235,  5,
+  7,  0,236,  5,  4,  0, 27,  0,218,  0,  1,  0,212,  0,211,  5,219,  0,  7,  0,212,  0,211,  5,  2,  0, 18,  0,  2,  0, 27,  0,
+  4,  0, 37,  0,  4,  0,237,  5, 90,  0,238,  5, 11,  0,215,  5,220,  0,  5,  0,220,  0,  0,  0,220,  0,  1,  0,  0,  0, 19,  0,
+  7,  0,239,  5,  4,  0, 27,  0,221,  0,  4,  0,  4,  0,109,  0,  7,  0,240,  5,  7,  0,179,  1,  4,  0, 18,  0,222,  0, 85,  0,
+219,  0,241,  5,219,  0,242,  5,217,  0,169,  3,218,  0,243,  5,  7,  0,244,  5,  2,  0,245,  5,  2,  0,246,  5,  7,  0,247,  5,
+  7,  0,248,  5,  2,  0, 67,  4,  2,  0,249,  5,  7,  0,250,  5,  7,  0,251,  5,  7,  0,252,  5,  2,  0,253,  5,  2,  0,222,  5,
+  2,  0,254,  5,  2,  0,255,  5,  2,  0,  0,  6,  2,  0,  1,  6,  7,  0,  2,  6,  7,  0,  3,  6,  7,  0,  4,  6,  2,  0,  5,  6,
+  2,  0,  6,  6,  2,  0,  7,  6,  2,  0,  8,  6,  2,  0,  9,  6,  2,  0, 10,  6,  2,  0, 11,  6,  2,  0, 12,  6,214,  0, 13,  6,
+216,  0, 14,  6,  7,  0, 15,  6,  7,  0, 16,  6,  7,  0, 17,  6,  2,  0, 18,  6,  2,  0, 19,  6,  0,  0, 20,  6,  0,  0, 21,  6,
+  2,  0, 22,  6,  7,  0, 23,  6,  7,  0, 24,  6,  7,  0, 25,  6,  7,  0, 26,  6,  7,  0, 27,  6,  7,  0, 28,  6,  7,  0, 29,  6,
+  7,  0, 30,  6,  7,  0, 31,  6,  7,  0, 32,  6,  2,  0, 33,  6,  0,  0, 34,  6,  0,  0, 35,  6,  0,  0, 36,  6,  0,  0, 37,  6,
+ 27,  0, 38,  6,  0,  0, 39,  6,  0,  0, 40,  6,  0,  0, 41,  6,  0,  0, 42,  6,  0,  0, 43,  6,  0,  0, 44,  6,  0,  0, 45,  6,
+  0,  0, 46,  6,  0,  0, 47,  6,  0,  0, 48,  6,  2,  0, 49,  6,  2,  0, 50,  6,  2,  0, 51,  6,  2,  0, 52,  6,  0,  0, 53,  6,
+  0,  0, 54,  6,  0,  0, 55,  6,  0,  0, 56,  6,  4,  0, 57,  6,  4,  0, 58,  6,  4,  0, 59,  6,  4,  0, 60,  6,  2,  0, 61,  6,
+  2,  0, 92,  0,  4,  0, 62,  6,  7,  0, 63,  6,  7,  0, 64,  6,221,  0, 65,  6,223,  0,  8,  0,  4,  0, 66,  6,  4,  0, 67,  6,
+  4,  0, 68,  6,  4,  0, 69,  6,  4,  0, 70,  6,  4,  0, 71,  6,  4,  0, 53,  0,  4,  0,138,  2,224,  0,  4,  0,  7,  0, 72,  6,
+  0,  0, 73,  6,  0,  0, 74,  6,  2,  0, 18,  0,225,  0,  4,  0,  7,  0, 75,  6,  4,  0, 18,  0,  4,  0, 76,  6,  4,  0, 56,  0,
+ 41,  0, 46,  0, 22,  0, 32,  0, 34,  0, 75,  0, 27,  0,208,  5,196,  0, 77,  6, 41,  0, 78,  6, 14,  0, 79,  6,197,  0, 80,  6,
+ 27,  0, 81,  6,  7,  0, 82,  6,  7,  0, 83,  6,  7,  0, 84,  6,  7,  0, 85,  6,  4,  0,205,  3,  4,  0, 86,  6,  4,  0, 87,  6,
+  2,  0, 18,  0,  2,  0, 77,  1, 57,  0, 71,  1,226,  0, 88,  6,222,  0, 89,  6,227,  0, 90,  6,205,  0,186,  0,202,  0, 91,  6,
+ 14,  0,103,  0, 14,  0, 92,  6, 11,  0, 93,  6, 11,  0, 94,  6, 11,  0, 95,  6, 11,  0, 96,  6, 11,  0, 97,  6,228,  0, 98,  6,
+  2,  0, 99,  6,  2,  0,100,  6,  2,  0,252,  0,  2,  0,206,  3,  4,  0,216,  3,  4,  0,101,  6, 14,  0,102,  6,208,  0,194,  5,
+210,  0,103,  6,224,  0,104,  6,178,  0,182,  3,225,  0,105,  6,229,  0,106,  6, 10,  0,  7,  4, 10,  0,107,  6,230,  0, 14,  0,
+230,  0,  0,  0,230,  0,  1,  0, 42,  0,243,  0, 40,  0, 70,  1,229,  0,106,  6,231,  0,108,  6,  7,  0, 97,  2,  7,  0, 98,  2,
+  7,  0,109,  0,  7,  0,109,  6,  2,  0,110,  6,  2,  0, 18,  0,  2,  0,144,  0,  2,  0, 27,  0,232,  0, 39,  0,  7,  0,111,  6,
+  7,  0,112,  6,  7,  0,113,  6,  7,  0,114,  6,  7,  0,115,  6,  7,  0,116,  6,  7,  0,117,  6,  7,  0,118,  6,  7,  0,119,  6,
+ 68,  0,120,  6,178,  0,182,  3,232,  0,121,  6,233,  0,122,  6,234,  0,123,  6,235,  0,124,  6,236,  0,125,  6,237,  0,126,  6,
+  7,  0,127,  6,  7,  0,128,  6,  7,  0, 95,  1,  7,  0,129,  6,  7,  0,130,  6,  7,  0,131,  6,  7,  0,132,  6,  7,  0,176,  0,
+  7,  0,133,  6,  0,  0,134,  6,  0,  0,135,  6,  0,  0,110,  6,  0,  0,136,  6,  2,  0,137,  6,  2,  0,138,  6,  7,  0,139,  6,
+  2,  0,140,  6,  2,  0,141,  6,  7,  0,142,  6,  7,  0,143,  6,  7,  0,144,  6,  7,  0,145,  6,238,  0, 51,  0,239,  0,  0,  0,
+239,  0,  1,  0, 14,  0,146,  6,  4,  0,147,  6,  7,  0,148,  6,  2,  0,149,  6,  7,  0,128,  6,  7,  0, 95,  1,  7,  0,150,  6,
+  2,  0,151,  6,  0,  0,211,  2,  4,  0,152,  6,  2,  0,135,  6,  2,  0,110,  6, 27,  0,208,  5, 27,  0,153,  6, 14,  0,154,  6,
+230,  0,155,  6,238,  0,121,  6,  0,  0,156,  6,  4,  0,205,  3,  4,  0, 86,  6,  2,  0,157,  6,  2,  0,158,  6,  2,  0,159,  6,
+  2,  0,160,  6,  2,  0, 18,  0,  2,  0, 32,  2,  7,  0,115,  0,  7,  0,161,  6,  7,  0,162,  6,  7,  0,163,  6,  7,  0,176,  0,
+  7,  0, 82,  6,  2,  0,164,  6,  2,  0,165,  6,  2,  0,166,  6,  0,  0,167,  6,  0,  0,168,  6,  0,  0,169,  6,  0,  0,170,  6,
+  0,  0,171,  6, 14,  0,172,  6, 14,  0,173,  6, 14,  0,174,  6,  2,  0,175,  6,  2,  0,152,  2,  2,  0,176,  6,  0,  0,177,  6,
+ 11,  0,178,  6,178,  0,182,  3,240,  0, 24,  0, 19,  0, 37,  0, 19,  0, 63,  0, 18,  0,179,  6, 18,  0,180,  6, 18,  0,181,  6,
+  7,  0,182,  6,  7,  0,183,  6,  7,  0,184,  6,  7,  0,185,  6,  2,  0,186,  6,  2,  0,187,  6,  2,  0,188,  6,  2,  0,189,  6,
+  2,  0,190,  6,  2,  0, 18,  0,  2,  0,191,  6,  2,  0,192,  6,  2,  0,193,  6,  2,  0,194,  6,  2,  0,195,  6,  2,  0,160,  6,
+  7,  0,196,  6,  4,  0,197,  6,  4,  0,198,  6,239,  0,  6,  0,239,  0,  0,  0,239,  0,  1,  0, 14,  0,146,  6,  4,  0,147,  6,
+  7,  0,148,  6,  2,  0,149,  6,241,  0,  8,  0,239,  0,  0,  0,239,  0,  1,  0, 14,  0,146,  6,  4,  0,147,  6,  7,  0,148,  6,
+  2,  0,149,  6,  0,  0,199,  6,  0,  0,125,  0,242,  0, 14,  0,239,  0,  0,  0,239,  0,  1,  0, 14,  0,146,  6,  4,  0,147,  6,
+  7,  0,148,  6,  2,  0,149,  6,240,  0,200,  6,243,  0,201,  6, 14,  0,202,  6,  2,  0, 88,  1,  2,  0,203,  6,  4,  0, 18,  0,
+  7,  0,204,  6,  4,  0,160,  6,244,  0, 21,  0,239,  0,  0,  0,239,  0,  1,  0, 14,  0,146,  6,  4,  0,147,  6,  7,  0,148,  6,
+  2,  0,149,  6,240,  0,200,  6,  2,  0,205,  6,  2,  0,206,  6,  2,  0,207,  6,  2,  0,208,  6,  2,  0,191,  6,  2,  0,209,  6,
+  2,  0,210,  6,  0,  0, 18,  0,  0,  0, 27,  0, 11,  0, 73,  2,  4,  0,211,  6,  4,  0,212,  6, 22,  0,213,  6, 11,  0,214,  6,
+245,  0, 18,  0,239,  0,  0,  0,239,  0,  1,  0, 14,  0,146,  6,  4,  0,147,  6,  7,  0,148,  6,  2,  0,149,  6,240,  0,200,  6,
+  7,  0, 97,  2,  7,  0, 98,  2,  2,  0,205,  6,  2,  0,215,  6,  2,  0,216,  6,  2,  0,217,  6,  4,  0, 18,  0,  7,  0,218,  6,
+  4,  0,110,  6,  4,  0, 27,  0,178,  0,182,  3,246,  0, 16,  0,  0,  0,219,  6,  0,  0,220,  6,  0,  0,221,  6,  0,  0,222,  6,
+  0,  0,223,  6,  0,  0,224,  6,  4,  0,225,  6,  4,  0,226,  6,  4,  0,227,  6,  2,  0, 16,  0,  2,  0, 18,  0,  2,  0,228,  6,
+  2,  0,229,  6,  2,  0,191,  1,  2,  0,230,  6,  0,  0,231,  6,247,  0, 16,  0,239,  0,  0,  0,239,  0,  1,  0, 14,  0,146,  6,
+  4,  0,147,  6,  4,  0,232,  6,246,  0,233,  6,248,  0,234,  6, 14,  0,235,  6, 14,  0,236,  6,249,  0,237,  6,237,  0,238,  6,
+250,  0,239,  6,  2,  0,240,  6,  2,  0,241,  6,  2,  0,242,  6,  2,  0, 30,  0,251,  0, 15,  0,239,  0,  0,  0,239,  0,  1,  0,
+ 14,  0,146,  6,  4,  0,147,  6,  7,  0,148,  6,  2,  0,149,  6,240,  0,200,  6, 14,  0,243,  6,252,  0,244,  6,  0,  0,245,  6,
+253,  0,246,  6,  2,  0, 18,  0,  2,  0,247,  6,  2,  0,248,  6,  2,  0,249,  6,254,  0, 25,  0,239,  0,  0,  0,239,  0,  1,  0,
+ 14,  0,146,  6,  4,  0,147,  6,  4,  0, 18,  0, 42,  0,244,  2, 40,  0, 70,  1, 54,  0,250,  6,255,  0,251,  6,  0,  1,252,  6,
+178,  0,182,  3,  7,  0,253,  6,  7,  0, 97,  2,  7,  0, 98,  2,  7,  0,218,  6,  7,  0,254,  6,  7,  0,255,  6,  2,  0,  0,  7,
+  2,  0, 27,  0,  2,  0,  1,  7,  2,  0,  2,  7,  0,  0,  3,  7,  0,  0,  4,  7,  0,  0,  5,  7,  0,  0,160,  6,  1,  1, 11,  0,
+239,  0,  0,  0,239,  0,  1,  0, 14,  0,146,  6,  4,  0,147,  6,  7,  0,148,  6,  2,  0,149,  6,  2,  0,203,  6,  2,  0, 18,  0,
+  4,  0, 27,  0,243,  0,201,  6,240,  0,200,  6,  2,  1, 31,  0,239,  0,  0,  0,239,  0,  1,  0, 14,  0,146,  6,  4,  0,147,  6,
+  7,  0,148,  6,  2,  0,149,  6, 37,  0,  6,  7,  4,  0,  7,  7,  4,  0,  8,  7,  2,  0, 93,  0,  2,  0,  9,  7,  2,  0, 10,  7,
+  0,  0, 11,  7,  0,  0, 12,  7,  4,  0, 13,  7,  4,  0, 14,  7,  4,  0, 15,  7,  2,  0, 16,  7,  2,  0, 17,  7,  2,  0, 18,  7,
+  2,  0, 19,  7,  7,  0, 20,  7, 18,  0, 21,  7, 18,  0, 22,  7,  4,  0, 23,  7,  4,  0, 24,  7,  0,  0, 25,  7,  0,  0, 26,  7,
+  2,  0, 27,  7,  0,  0,211,  2, 11,  0, 28,  7,  3,  1, 10,  0, 22,  0, 32,  0, 11,  0, 29,  7, 11,  0, 30,  7, 11,  0, 31,  7,
+ 11,  0, 32,  7, 11,  0, 33,  7,  4,  0, 93,  0,  4,  0, 34,  7,  0,  0, 35,  7,  0,  0, 36,  7,  4,  1, 10,  0,239,  0,  0,  0,
+239,  0,  1,  0, 14,  0,146,  6,  4,  0,147,  6,  7,  0,148,  6,  3,  1, 37,  7,  2,  0, 93,  0,  2,  0,  9,  7,  4,  0, 92,  0,
+ 11,  0, 38,  7,  5,  1,  3,  0,  5,  1,  0,  0,  5,  1,  1,  0,  7,  0, 39,  7,  6,  1,  9,  0,239,  0,  0,  0,239,  0,  1,  0,
+ 14,  0,146,  6,  4,  0,147,  6,  7,  0,148,  6,240,  0,200,  6, 14,  0, 40,  7,  4,  0, 41,  7,  4,  0, 18,  0,  7,  1, 27,  0,
+239,  0,  0,  0,239,  0,  1,  0, 14,  0,146,  6,  4,  0,147,  6,  7,  0,148,  6,  2,  0,149,  6,240,  0,200,  6, 22,  0, 42,  7,
+ 22,  0, 81,  0,  2,  0, 18,  0,  2,  0, 92,  0,  7,  0, 43,  7,  7,  0, 97,  2,  7,  0, 98,  2,  7,  0,218,  6,  7,  0, 44,  7,
+  7,  0, 45,  7,  7,  0, 46,  7, 57,  0, 71,  1, 57,  0, 47,  7,  4,  0, 48,  7,  2,  0, 49,  7,  2,  0, 50,  7,  2,  0,252,  0,
+  2,  0, 87,  1, 14,  0, 51,  7,178,  0,182,  3,  8,  1, 10,  0,239,  0,  0,  0,239,  0,  1,  0, 14,  0,146,  6,  4,  0,147,  6,
+  7,  0,148,  6,  2,  0,149,  6,  2,  0, 18,  0,  2,  0,214,  3,  4,  0, 27,  0,178,  0,182,  3,  9,  1,  7,  0,  9,  1,  0,  0,
+  9,  1,  1,  0,  4,  0, 52,  7,  4,  0, 22,  0,  0,  0, 86,  0,  4,  0, 53,  7,  4,  0, 16,  0, 10,  1, 14,  0,239,  0,  0,  0,
+239,  0,  1,  0, 14,  0,146,  6,  4,  0,147,  6,  7,  0,148,  6,  2,  0,149,  6,  4,  0, 10,  7,  4,  0, 27,  0, 14,  0, 54,  7,
+ 14,  0, 55,  7,  0,  0, 56,  7,  0,  0, 57,  7,  4,  0, 58,  7,  4,  0, 59,  7, 11,  1,  6,  0,239,  0,  0,  0,239,  0,  1,  0,
+ 14,  0,146,  6,  4,  0,147,  6,  4,  0, 27,  0,  0,  0, 60,  7, 12,  1, 24,  0,239,  0,  0,  0,239,  0,  1,  0, 14,  0,146,  6,
+  4,  0,147,  6,  7,  0, 97,  2,  7,  0, 98,  2,  7,  0, 61,  7,  7,  0, 62,  7,  7,  0,218,  6,231,  0, 63,  7,229,  0,106,  6,
+ 13,  1,251,  6,  4,  0, 18,  0,  2,  0, 88,  1,  2,  0,110,  6,  4,  0, 64,  7,  7,  0, 65,  7,  7,  0,148,  3,  7,  0, 94,  3,
+  4,  0, 27,  0,  7,  0, 66,  7,  7,  0, 67,  7,  4,  0, 68,  7,  4,  0, 69,  7, 14,  1,  7,  0, 14,  1,  0,  0, 14,  1,  1,  0,
+  0,  0, 70,  7,  2,  0, 71,  7,  2,  0, 72,  7,  2,  0, 73,  7,  2,  0, 27,  0, 15,  1, 12,  0,  2,  0, 72,  7,  2,  0, 74,  7,
+  2,  0, 75,  7,  0,  0,211,  2,  2,  0, 76,  7,  2,  0, 77,  7,  2,  0, 78,  7,  2,  0, 79,  7,  2,  0, 80,  7,  2,  0,191,  6,
+  7,  0, 81,  7,  7,  0, 82,  7, 16,  1, 18,  0, 16,  1,  0,  0, 16,  1,  1,  0,  0,  0, 19,  0, 15,  1, 83,  7, 15,  1, 84,  7,
+ 15,  1, 85,  7, 15,  1, 86,  7,  7,  0, 87,  7,  2,  0, 88,  7,  2,  0, 89,  7,  2,  0, 90,  7,  2,  0, 91,  7,  2,  0, 92,  7,
+  2,  0, 93,  7,  2,  0, 94,  7,  2,  0, 95,  7,  2,  0, 96,  7,  2,  0, 27,  0, 17,  1, 10,  0,  0,  0, 97,  7,  0,  0, 98,  7,
+  0,  0, 99,  7,  0,  0,100,  7,  0,  0,101,  7,  0,  0,102,  7,  2,  0,103,  7,  2,  0,104,  7,  2,  0,105,  7,  2,  0,106,  7,
+ 18,  1,  8,  0,  0,  0,107,  7,  0,  0,108,  7,  0,  0,109,  7,  0,  0,110,  7,  0,  0,111,  7,  0,  0,112,  7,  7,  0,109,  6,
+  7,  0, 27,  0, 19,  1,  3,  0,  0,  0,113,  7,  2,  0,114,  7,  2,  0, 27,  0, 20,  1, 22,  0, 17,  1,115,  7, 17,  1,116,  7,
+ 17,  1,117,  7, 17,  1,118,  7, 17,  1,119,  7, 17,  1,120,  7, 17,  1,121,  7, 17,  1,122,  7, 17,  1,123,  7, 17,  1,124,  7,
+ 17,  1,125,  7, 17,  1,126,  7, 17,  1,127,  7, 17,  1,128,  7, 17,  1,129,  7, 17,  1,130,  7, 17,  1,131,  7, 18,  1,132,  7,
+ 19,  1,133,  7,  0,  0,134,  7,  7,  0,135,  7,  7,  0, 27,  0, 21,  1,122,  0,  0,  0,136,  7,  0,  0,137,  7,  0,  0,101,  7,
+  0,  0,138,  7,  0,  0,113,  7,  0,  0,139,  7,  0,  0,140,  7,  0,  0,141,  7,  0,  0,142,  7,  0,  0,143,  7,  0,  0,144,  7,
+  0,  0,145,  7,  0,  0,146,  7,  0,  0,147,  7,  0,  0,148,  7,  0,  0,149,  7,  0,  0,150,  7,  0,  0,151,  7,  0,  0,152,  7,
+  0,  0,153,  7,  0,  0,154,  7,  0,  0,155,  7,  0,  0,156,  7,  0,  0,157,  7,  0,  0,158,  7,  0,  0,159,  7,  0,  0,160,  7,
+  0,  0,161,  7,  0,  0,162,  7,  0,  0,163,  7,  0,  0,164,  7,  0,  0,165,  7,  0,  0,166,  7,  0,  0,167,  7,  0,  0,168,  7,
+  0,  0,169,  7,  0,  0,170,  7,  0,  0,171,  7,  0,  0,172,  7,  0,  0,173,  7,  0,  0,174,  7,  0,  0,175,  7,  0,  0,176,  7,
+  0,  0,177,  7,  0,  0,178,  7,  0,  0,179,  7,  0,  0,180,  7,  0,  0,181,  7,  0,  0,182,  7,  0,  0,183,  7,  0,  0,184,  7,
+  0,  0,185,  7,  0,  0,186,  7,  0,  0,187,  7,  0,  0,188,  7,  0,  0,189,  7,  0,  0,190,  7,  0,  0,191,  7,  0,  0,192,  7,
+  0,  0,193,  7,  0,  0,194,  7,  0,  0,195,  7,  0,  0,196,  7,  0,  0,197,  7,  0,  0,198,  7,  0,  0,199,  7,  0,  0,200,  7,
+  0,  0,201,  7,  0,  0,202,  7,  0,  0,203,  7,  0,  0,204,  7,  0,  0,205,  7,  0,  0,206,  7,  0,  0,207,  7,  0,  0,208,  7,
+  0,  0,209,  7,  0,  0,210,  7,  0,  0,211,  7,  0,  0,212,  7,  0,  0,213,  7,  0,  0,214,  7,  0,  0,215,  7,  0,  0,216,  7,
+  0,  0,217,  7,  0,  0,218,  7,  0,  0,219,  7,  0,  0,220,  7,  0,  0,221,  7,  0,  0,222,  7,  0,  0,223,  7,  0,  0,224,  7,
+  0,  0,225,  7,  0,  0,226,  7,  0,  0,227,  7,  0,  0,228,  7,  0,  0,229,  7,  0,  0,230,  7,  0,  0,231,  7,  0,  0,232,  7,
+  0,  0,233,  7,  0,  0,234,  7,  0,  0,235,  7,  0,  0,236,  7,  0,  0,237,  7,  0,  0,238,  7,  0,  0,239,  7,  0,  0,240,  7,
+  0,  0,241,  7,  0,  0,242,  7,  0,  0,243,  7,  0,  0,244,  7,  0,  0,245,  7,  0,  0,246,  7,  0,  0,247,  7,  0,  0,248,  7,
+  0,  0,249,  7,  0,  0,250,  7,  0,  0,251,  7,  0,  0,252,  7,  0,  0,253,  7,  0,  0,254,  7,  0,  0,255,  7, 22,  1,  5,  0,
+  0,  0,  0,  8,  0,  0,159,  7,  0,  0,165,  7,  2,  0, 18,  0,  2,  0, 27,  0, 23,  1, 24,  0, 23,  1,  0,  0, 23,  1,  1,  0,
+  0,  0,172,  5, 20,  1,  1,  8, 21,  1,  2,  8, 21,  1,  3,  8, 21,  1,  4,  8, 21,  1,  5,  8, 21,  1,  6,  8, 21,  1,  7,  8,
+ 21,  1,  8,  8, 21,  1,  9,  8, 21,  1, 10,  8, 21,  1, 11,  8, 21,  1, 12,  8, 21,  1, 13,  8, 21,  1, 14,  8, 21,  1, 15,  8,
+ 21,  1, 16,  8, 21,  1, 17,  8, 21,  1, 18,  8, 22,  1, 19,  8,  4,  0, 20,  8,  4,  0, 27,  0, 24,  1,  3,  0, 24,  1,  0,  0,
+ 24,  1,  1,  0,  0,  0, 21,  8, 25,  1,  5,  0,  4,  0, 18,  0,  4,  0, 27,  0,  7,  0,151,  2,  7,  0, 22,  8,  7,  0, 47,  2,
+ 26,  1, 95,  0,  4,  0, 18,  0,  4,  0, 23,  8,  4,  0, 24,  8,  0,  0, 25,  8,  0,  0, 26,  8,  0,  0, 27,  8,  0,  0, 28,  8,
+  0,  0, 29,  8,  0,  0, 30,  8,  0,  0, 31,  8,  0,  0, 32,  8,  0,  0, 33,  8,  0,  0, 34,  8,  4,  0, 35,  8,  2,  0, 36,  8,
+  2,  0, 37,  8,  2,  0, 38,  8,  2,  0, 39,  8,  4,  0, 40,  8,  4,  0, 41,  8,  4,  0, 42,  8,  4,  0, 43,  8,  2,  0, 44,  8,
+  2,  0, 45,  8,  4,  0, 46,  8,  4,  0, 47,  8,  4,  0, 48,  8,  4,  0, 49,  8,  4,  0, 50,  8,  4,  0, 54,  7,  4,  0, 51,  8,
+  2,  0, 52,  8,  2,  0, 53,  8,  2,  0, 54,  8,  2,  0, 55,  8, 14,  0, 56,  8, 14,  0, 57,  8, 14,  0, 58,  8, 14,  0, 59,  8,
+ 14,  0, 60,  8, 14,  0, 61,  8,  0,  0, 62,  8,  2,  0, 63,  8,  2,  0, 64,  8,  2,  0, 65,  8,  2,  0, 66,  8,  2,  0, 67,  8,
+  2,  0, 68,  8,  2,  0, 69,  8,  2,  0, 70,  8, 25,  1, 71,  8,  2,  0, 72,  8,  2,  0, 73,  8,  2,  0, 74,  8,  2,  0, 75,  8,
+  2,  0, 76,  8,  2,  0, 77,  8,  2,  0, 78,  8,  2,  0, 79,  8,  4,  0, 80,  8,  4,  0, 81,  8,  2,  0, 82,  8,  2,  0, 83,  8,
+  2,  0, 84,  8,  2,  0, 85,  8,  2,  0, 86,  8,  2,  0, 87,  8,  2,  0, 88,  8,  2,  0, 89,  8,  2,  0, 90,  8,  2,  0, 91,  8,
+  2,  0, 92,  8,  2,  0, 93,  8,  2,  0, 94,  8,  2,  0, 95,  8,  2,  0, 96,  8,  2,  0, 97,  8,  2,  0, 98,  8,  2,  0, 99,  8,
+  7,  0,100,  8,  4,  0,101,  8,  7,  0,102,  8,  2,  0, 18,  6,  2,  0, 19,  6,  2,  0,103,  8,  2,  0,104,  8, 50,  0,105,  8,
+  7,  0,106,  8,  2,  0,107,  8,  2,  0, 74,  0,  0,  0,108,  8,  4,  0,109,  8,  4,  0,110,  8,  7,  0,111,  8,  7,  0, 27,  0,
+ 27,  1, 24,  0, 22,  0, 32,  0, 14,  0,112,  8, 14,  0,113,  8, 14,  0,114,  8, 14,  0,146,  6, 41,  0,126,  0, 41,  0,115,  8,
+  4,  0,116,  8,  4,  0, 92,  0,  2,  0,117,  8,  2,  0,118,  8,  2,  0,119,  8,  2,  0,120,  8,  2,  0,121,  8,  2,  0,122,  8,
+  2,  0,123,  8,  2,  0,124,  8,  2,  0,125,  8,  2,  0,126,  8,  2,  0,127,  8,  2,  0, 27,  0,237,  0,128,  8, 11,  0,129,  8,
+  2,  0,130,  8, 28,  1,  5,  0, 28,  1,  0,  0, 28,  1,  1,  0, 28,  1,131,  8, 15,  0,132,  8,  4,  0, 18,  0, 29,  1,  7,  0,
+ 29,  1,  0,  0, 29,  1,  1,  0, 28,  1,133,  8, 28,  1,134,  8,  2,  0,121,  5,  2,  0, 18,  0,  4,  0, 27,  0, 30,  1, 25,  0,
+ 30,  1,  0,  0, 30,  1,  1,  0, 31,  1,135,  8, 32,  1,239,  6,  0,  0,136,  8,  0,  0,137,  8,  0,  0,138,  8,  2,  0,139,  8,
+  2,  0,140,  8,  2,  0,141,  8,  2,  0,142,  8,  2,  0,143,  8,  2,  0, 27,  0,  2,  0, 18,  0,  2,  0, 69,  7,  2,  0,144,  8,
+  2,  0,145,  8,  4,  0,146,  8, 30,  1,147,  8, 11,  0,148,  8,  4,  0,149,  8,  4,  0,150,  8,  4,  0,151,  8,  4,  0,152,  8,
+  0,  0,153,  8, 33,  1, 22,  0, 33,  1,  0,  0, 33,  1,  1,  0, 28,  1,133,  8, 28,  1,134,  8, 28,  1,154,  8, 28,  1,155,  8,
+ 27,  1,156,  8, 18,  0, 51,  0,  0,  0,147,  6,  0,  0,157,  8,  2,  0,192,  6,  2,  0,193,  6,  2,  0,158,  8,  2,  0, 27,  0,
+  2,  0,121,  8,  2,  0, 53,  7,  2,  0, 18,  0, 34,  1,135,  8, 14,  0,159,  8, 14,  0,146,  6, 14,  0,160,  8, 14,  0,161,  8,
+ 35,  1, 24,  0, 35,  1,  0,  0, 35,  1,  1,  0,240,  0,200,  6, 18,  0,162,  8, 18,  0,163,  8,  2,  0,192,  6,  2,  0,193,  6,
+  2,  0,164,  8,  2,  0,165,  8,  2,  0,166,  8,  2,  0, 18,  0,  7,  0, 93,  2,  2,  0,141,  8,  2,  0,142,  8,  2,  0,120,  8,
+  2,  0,167,  8,  2,  0,125,  8,  2,  0, 87,  1, 36,  1,135,  8, 14,  0,168,  8, 14,  0,169,  8, 14,  0,160,  8,  0,  0,170,  8,
+ 11,  0,171,  8, 37,  1, 14,  0,  0,  0,172,  8,  2,  0,173,  8,  2,  0,174,  8,  2,  0,175,  8,  2,  0,176,  8,  2,  0,110,  5,
+  2,  0,177,  8, 27,  1,178,  8, 41,  0,179,  8,  4,  0,180,  8,  4,  0,181,  8,  4,  0,182,  8,  4,  0, 27,  0,  0,  0, 70,  7,
+ 38,  1,  3,  0,  0,  0,183,  8,  4,  0,184,  8,  4,  0,185,  8, 39,  1,  4,  0,  4,  0,  7,  7,  4,  0,186,  8,  4,  0, 13,  7,
+  4,  0,187,  8, 40,  1,  2,  0,  4,  0,188,  8,  4,  0,189,  8, 41,  1,  5,  0,  7,  0,190,  8,  7,  0,191,  8,  7,  0,192,  8,
+  4,  0, 18,  0,  4,  0, 27,  0, 42,  1,  7,  0,  0,  0,193,  8,  0,  0,221,  6, 44,  0,139,  0,  2,  0,194,  8,  2,  0, 72,  5,
+  2,  0,195,  8,  2,  0,196,  8, 43,  1, 12,  0, 43,  1,  0,  0, 43,  1,  1,  0,  4,  0, 28,  0,  4,  0,197,  8,  4,  0,198,  8,
+  4,  0,199,  8, 38,  1,200,  8,  0,  0,193,  8, 42,  1,176,  3, 39,  1,201,  8, 40,  1,202,  8, 41,  1,203,  8, 44,  1, 12,  0,
+  0,  0, 35,  0, 11,  0,228,  0,  0,  0,229,  0,  4,  0,232,  0,  4,  0,240,  0, 11,  0,233,  0,  7,  0,235,  0,  7,  0,236,  0,
+ 11,  0,204,  8, 11,  0,205,  8, 11,  0,237,  0, 11,  0,239,  0, 45,  1, 50,  0, 45,  1,  0,  0, 45,  1,  1,  0, 11,  0,206,  8,
+ 11,  0, 25,  0,  0,  0, 19,  0,  4,  0, 18,  0,  4,  0, 16,  0,  4,  0, 22,  0,  4,  0, 90,  0,  4,  0,207,  8,  4,  0,208,  8,
+  4,  0,198,  8,  4,  0,199,  8,  4,  0,209,  8,  4,  0,251,  0,  4,  0,210,  8,  4,  0,211,  8,  7,  0,212,  8,  7,  0,213,  8,
+  7,  0,214,  8,  2,  0,215,  8,  2,  0,216,  8,  4,  0,217,  8,  4,  0,218,  8, 43,  1,219,  8, 31,  0, 80,  0, 41,  0,126,  0,
+ 27,  0,220,  8, 44,  0,139,  0,229,  0,106,  6,  7,  0,221,  8,  7,  0,222,  8, 44,  1, 72,  1, 45,  1,223,  8, 45,  1,224,  8,
+ 45,  1,225,  8, 14,  0,226,  8, 46,  1,227,  8, 11,  0,228,  8,  7,  0, 84,  4,  7,  0,229,  8,  7,  0,230,  8,  7,  0,231,  8,
+ 11,  0,232,  8,  4,  0,233,  8,  4,  0,234,  8,  4,  0,235,  8,  7,  0,236,  8,  4,  0,130,  0,  4,  0, 27,  0, 47,  1,  4,  0,
+ 47,  1,  0,  0, 47,  1,  1,  0, 14,  0,237,  8, 45,  1,238,  8,226,  0, 11,  0, 14,  0,239,  8, 14,  0,226,  8, 14,  0,240,  8,
+ 45,  1,241,  8,  0,  0,242,  8,  0,  0,243,  8,  4,  0,244,  8,  4,  0,245,  8,  4,  0,246,  8,  4,  0, 27,  0, 19,  0,247,  8,
+ 48,  1,  4,  0,  7,  0,248,  8,  7,  0, 94,  3,  2,  0,249,  8,  2,  0,250,  8, 49,  1,  6,  0,  7,  0,251,  8,  7,  0,252,  8,
+  7,  0,253,  8,  7,  0,254,  8,  4,  0,255,  8,  4,  0,  0,  9, 50,  1,  8,  0,  7,  0,  1,  9,  7,  0,  2,  9,  7,  0,  3,  9,
+  7,  0,  4,  9,  7,  0,  5,  9,  4,  0,250,  2,  4,  0,  6,  9,  4,  0,  7,  9, 51,  1,  2,  0,  7,  0,180,  5,  7,  0, 27,  0,
+ 52,  1,  5,  0,  7,  0,  8,  9,  7,  0,  9,  9,  4,  0, 93,  0,  4,  0,212,  2,  4,  0, 10,  9, 53,  1,  6,  0, 53,  1,  0,  0,
+ 53,  1,  1,  0,  2,  0, 16,  0,  2,  0, 18,  0,  2,  0, 11,  9,  2,  0, 56,  0, 54,  1,  8,  0, 54,  1,  0,  0, 54,  1,  1,  0,
+  2,  0, 16,  0,  2,  0, 18,  0,  2,  0, 11,  9,  2,  0, 56,  0,  7,  0, 22,  0,  7,  0,130,  0, 55,  1, 45,  0, 55,  1,  0,  0,
+ 55,  1,  1,  0,  2,  0, 16,  0,  2,  0, 18,  0,  2,  0, 11,  9,  2,  0,247,  0,  2,  0,126,  4,  2,  0, 12,  9,  7,  0, 13,  9,
+  7,  0, 91,  0,  7,  0,  7,  3,  4,  0, 14,  9,  4,  0, 82,  0,  4,  0,214,  2,  7,  0, 15,  9,  7,  0, 16,  9,  7,  0, 17,  9,
+  7,  0, 18,  9,  7,  0, 19,  9,  7,  0, 20,  9,  7,  0,  4,  3,  7,  0, 69,  1,  7,  0, 21,  9,  7,  0, 22,  9,  7,  0, 27,  0,
+  7,  0, 23,  9,  7,  0, 24,  9,  7,  0, 25,  9,  2,  0, 26,  9,  2,  0, 27,  9,  2,  0, 28,  9,  2,  0, 29,  9,  2,  0, 30,  9,
+  2,  0, 31,  9,  2,  0, 32,  9,  2,  0, 33,  9,  2,  0, 32,  2,  2,  0, 34,  9,  2,  0, 29,  2,  2,  0, 35,  9,  0,  0, 36,  9,
+  0,  0, 37,  9,  7,  0,245,  0, 56,  1, 38,  9, 64,  0,250,  1, 57,  1, 16,  0, 57,  1,  0,  0, 57,  1,  1,  0,  2,  0, 16,  0,
+  2,  0, 18,  0,  2,  0, 11,  9,  2,  0,247,  0,  7,  0,255,  2,  7,  0,  0,  3,  7,  0,  1,  3,  7,  0, 82,  2,  7,  0,  2,  3,
+  7,  0,  3,  3,  7,  0, 39,  9,  7,  0,  4,  3,  7,  0,  6,  3,  7,  0,  7,  3,253,  0,  5,  0,  2,  0, 16,  0,  2,  0, 40,  9,
+  2,  0, 18,  0,  2,  0, 41,  9, 22,  0, 42,  7,252,  0,  3,  0,  4,  0, 68,  0,  4,  0, 42,  9,253,  0,  2,  0, 58,  1,  7,  0,
+ 58,  1,  0,  0, 58,  1,  1,  0,  0,  0, 19,  0,  2,  0, 16,  0,  2,  0, 18,  0,  4,  0, 21,  0, 11,  0, 43,  9, 59,  1,  5,  0,
+  0,  0, 19,  0,  7,  0, 95,  1,  7,  0, 44,  9,  4,  0, 45,  9,  4,  0, 27,  0, 60,  1,  4,  0,  2,  0, 16,  0,  2,  0, 18,  0,
+  2,  0, 92,  0,  2,  0, 30,  0, 61,  1,  4,  0,  0,  0, 19,  0, 63,  0, 46,  9,  7,  0, 95,  1,  7,  0, 27,  0, 62,  1,  6,  0,
+  2,  0, 47,  9,  2,  0, 48,  9,  2,  0, 16,  0,  2,  0, 49,  9,  0,  0, 50,  9,  0,  0, 51,  9, 63,  1,  5,  0,  4,  0, 16,  0,
+  4,  0, 27,  0,  0,  0, 19,  0,  0,  0, 52,  9,  0,  0, 53,  9, 64,  1,  3,  0,  4,  0, 16,  0,  4,  0, 27,  0,  0,  0, 19,  0,
+ 65,  1,  4,  0,  2,  0, 54,  9,  2,  0, 55,  9,  2,  0, 18,  0,  2,  0, 27,  0, 66,  1,  6,  0,  0,  0, 19,  0,  0,  0, 56,  9,
+  2,  0, 57,  9,  2,  0,  4,  3,  2,  0, 88,  1,  2,  0, 30,  0, 67,  1,  5,  0,  0,  0, 19,  0,  7,  0, 94,  3,  7,  0,217,  4,
+  2,  0, 18,  0,  2,  0,226,  2, 68,  1,  3,  0,  0,  0, 19,  0,  4,  0,214,  2,  4,  0, 54,  9, 69,  1,  7,  0,  0,  0, 19,  0,
+  7,  0,217,  4,  0,  0, 58,  9,  0,  0, 59,  9,  2,  0, 88,  1,  2,  0, 92,  0,  4,  0, 60,  9, 70,  1,  4,  0,  0,  0, 61,  9,
+  0,  0, 62,  9,  4,  0, 16,  0,  7,  0,230,  2, 71,  1,  3,  0, 27,  0, 63,  9,  0,  0, 64,  9,  0,  0, 65,  9, 72,  1, 18,  0,
+ 72,  1,  0,  0, 72,  1,  1,  0,  2,  0, 16,  0,  2,  0, 66,  9,  2,  0, 18,  0,  2,  0, 67,  9,  2,  0, 68,  9,  2,  0, 69,  9,
+  2,  0, 92,  0,  2,  0, 30,  0,  0,  0, 19,  0, 11,  0,  2,  0, 73,  1, 70,  9, 27,  0, 44,  0,  2,  0,216,  5,  2,  0,176,  2,
+  2,  0, 71,  9,  2,  0, 27,  0, 74,  1, 11,  0,  0,  0, 19,  0,  0,  0, 16,  0,  0,  0, 72,  9,  2,  0, 18,  0,  2,  0,226,  2,
+  2,  0, 73,  9,  4,  0, 74,  9,  4,  0, 75,  9,  4,  0, 76,  9,  4,  0, 77,  9,  4,  0, 78,  9, 75,  1,  1,  0,  0,  0, 79,  9,
+ 76,  1,  4,  0, 37,  0,  6,  7,  0,  0, 21,  8,  4,  0, 88,  1,  4,  0, 18,  0, 73,  1, 18,  0, 73,  1,  0,  0, 73,  1,  1,  0,
+ 73,  1, 80,  9,  2,  0, 16,  0,  2,  0, 18,  0,  2,  0, 81,  9,  2,  0, 69,  9,  2,  0, 66,  9,  2,  0, 82,  9,  2,  0, 30,  0,
+  2,  0, 74,  0,  0,  0, 19,  0, 11,  0,  2,  0, 77,  1, 70,  9, 72,  1, 83,  9,  2,  0, 14,  0,  2,  0, 84,  9,  4,  0, 85,  9,
+ 78,  1,  3,  0,  4,  0,240,  2,  4,  0, 27,  0, 27,  0, 44,  0, 79,  1, 15,  0,176,  0, 86,  9,  2,  0, 16,  0,  2,  0, 18,  0,
+  7,  0, 13,  9,  7,  0, 91,  0,  0,  0, 19,  0,  0,  0, 87,  9,  2,  0, 88,  9,  2,  0, 89,  9,  2,  0,135,  0,  2,  0, 90,  9,
+  2,  0, 91,  9,  2,  0, 27,  0,  7,  0, 92,  9,  7,  0, 93,  9, 80,  1,  8,  0,  7,  0, 94,  9,  7,  0, 95,  9,  7,  0, 96,  9,
+  7,  0, 97,  9,  7,  0, 98,  9,  7,  0, 99,  9,  7,  0,100,  9,  7,  0,101,  9, 81,  1, 13,  0,  2,  0, 18,  0,  2,  0,102,  9,
+  4,  0, 92,  0,  4,  0, 30,  0,  2,  0,177,  6,  7,  0, 84,  4,  7,  0,229,  8, 46,  1,227,  8, 80,  1,103,  9,  2,  0, 16,  0,
+  2,  0,115,  5,  2,  0,216,  3,  2,  0,104,  9, 82,  1, 11,  0,  4,  0,240,  2,  2,  0, 16,  0,  2,  0, 18,  0, 27,  0, 44,  0,
+ 79,  0,105,  9,  0,  0, 19,  0,  7,  0,106,  9,  7,  0,107,  9,  7,  0,222,  3,  2,  0,108,  9,  2,  0,109,  9, 83,  1,  5,  0,
+  2,  0, 16,  0,  2,  0, 92,  0,  4,  0, 27,  0, 41,  0,126,  0, 27,  0,208,  5, 84,  1,  5,  0,  4,  0, 27,  0,  4,  0, 16,  0,
+  0,  0, 19,  0,  0,  0, 52,  9, 27,  0, 44,  0, 85,  1, 13,  0,  2,  0, 18,  0,  2,  0, 16,  0,  2,  0, 66,  9,  2,  0,223,  3,
+  7,  0,110,  9,  7,  0,111,  9,  7,  0, 87,  1,  7,  0,112,  9,  7,  0,192,  3,  7,  0,196,  3,  7,  0,113,  9,  7,  0,114,  9,
+ 27,  0,115,  9, 86,  1, 10,  0,  2,  0, 18,  0,  2,  0, 16,  0,  7,  0, 13,  9,  7,  0, 91,  0,  0,  0, 19,  0,  0,  0, 87,  9,
+  2,  0, 92,  0,  2,  0, 30,  0,  2,  0, 74,  0,  2,  0,115,  5, 87,  1,  8,  0, 27,  0, 44,  0,  7,  0,  1,  3,  7,  0,116,  9,
+  7,  0,117,  9,  7,  0,223,  3,  2,  0, 92,  0,  2,  0,226,  2,  7,  0, 30,  0, 88,  1, 12,  0,  2,  0, 16,  0,  2,  0, 88,  1,
+  2,  0, 18,  0,  2,  0,  4,  3,  2,  0,240,  2,  2,  0,118,  9,  4,  0, 27,  0,  7,  0,119,  9,  7,  0,120,  9,  7,  0,121,  9,
+  7,  0,122,  9,  0,  0,123,  9, 89,  1,  9,  0,  2,  0, 18,  0,  2,  0, 16,  0,  4,  0, 13,  9,  4,  0, 91,  0,  0,  0, 19,  0,
+  2,  0, 87,  1,  2,  0, 63,  0,  2,  0,124,  9,  2,  0,125,  9, 90,  1,  7,  0,  4,  0,214,  2,  4,  0,126,  9,  4,  0,127,  9,
+  4,  0,128,  9,  7,  0,129,  9,  7,  0,130,  9,  0,  0, 58,  9, 91,  1,  7,  0,  0,  0,131,  9, 27,  0,132,  9,  0,  0, 64,  9,
+  2,  0,133,  9,  2,  0, 92,  0,  4,  0, 30,  0,  0,  0, 65,  9, 92,  1,  6,  0,  2,  0, 18,  0,  2,  0, 16,  0,  4,  0, 13,  9,
+  4,  0, 91,  0,  0,  0,134,  9,  0,  0,135,  9, 93,  1,  1,  0,  4,  0, 18,  0, 94,  1,  6,  0,  0,  0, 95,  0,  2,  0, 16,  0,
+  2,  0, 18,  0,  4,  0,136,  9,  7,  0,137,  9, 37,  0,  6,  7, 95,  1,  4,  0,  0,  0,181,  2,  2,  0, 18,  0,  4,  0, 16,  0,
+ 27,  0, 44,  0, 96,  1,  2,  0,  4,  0, 16,  0,  4,  0,181,  6, 97,  1,  8,  0,  0,  0, 61,  9,  0,  0, 62,  9,  4,  0, 16,  0,
+  7,  0, 40,  2,  7,  0,138,  9,  7,  0, 27,  0, 27,  0, 70,  3, 27,  0,139,  9, 98,  1, 11,  0,  0,  0, 54,  6,  0,  0, 18,  0,
+  2,  0,140,  9,  4,  0, 16,  0,  7,  0, 95,  1,  7,  0,141,  9,  7,  0,142,  9,  7,  0,143,  9,  4,  0,144,  9, 27,  0, 70,  3,
+ 27,  0,145,  9, 77,  1, 10,  0, 77,  1,  0,  0, 77,  1,  1,  0, 77,  1, 80,  9,  2,  0, 16,  0,  2,  0, 18,  0,  2,  0, 66,  9,
+  2,  0,146,  9,  0,  0, 19,  0, 11,  0,  2,  0, 27,  0, 44,  0, 46,  1, 17,  0, 22,  0, 32,  0,  0,  0, 35,  0, 38,  0,154,  0,
+ 11,  0,228,  0, 38,  0,147,  9, 31,  0, 80,  0,  7,  0, 84,  4,  7,  0,148,  9,  7,  0,229,  8,  7,  0, 94,  9,  7,  0, 95,  9,
+  7,  0,149,  9,  4,  0, 93,  0,  4,  0, 27,  0, 11,  0,150,  9, 11,  0,151,  9, 11,  0,152,  9, 99,  1,  6,  0, 99,  1,  0,  0,
+ 99,  1,  1,  0, 27,  0, 44,  0, 11,  0,153,  9,  2,  0,252,  0,  0,  0,211,  2, 64,  0,  4,  0, 22,  0, 32,  0, 14,  0,154,  9,
+  4,  0,135,  0,  7,  0,155,  9,100,  1, 28,  0,100,  1,  0,  0,100,  1,  1,  0, 21,  0,156,  9,100,  1, 38,  0, 14,  0,157,  9,
+  0,  0, 19,  0,  7,  0,158,  9,  7,  0,159,  9,  7,  0,160,  9,  7,  0,161,  9,  4,  0, 18,  0,  7,  0,162,  9,  7,  0,163,  9,
+  7,  0,164,  9,  7,  0,165,  9,  7,  0, 95,  1,  7,  0, 40,  2,  7,  0,166,  9,  7,  0,212,  2,  7,  0,167,  9,  7,  0,168,  9,
+  7,  0,169,  9,  7,  0,170,  9,  7,  0,171,  9,  7,  0,177,  0,  4,  0,135,  0,  2,  0,254,  5,  2,  0,172,  9,101,  1, 27,  0,
+ 22,  0, 32,  0, 34,  0, 75,  0, 14,  0,173,  9, 14,  0,174,  9, 14,  0,175,  9,100,  1,176,  9, 11,  0,177,  9, 11,  0,178,  9,
+  4,  0, 18,  0,  4,  0,157,  6,  4,  0,179,  9,  4,  0, 27,  0,  2,  0,  8,  3,  2,  0,211,  6,  4,  0,180,  9,  4,  0,135,  0,
+  4,  0,181,  9,  2,  0,182,  9,  2,  0,183,  9,  2,  0,184,  9,  2,  0,185,  9,  4,  0,186,  9,  4,  0,187,  9,  4,  0,188,  9,
+  4,  0,189,  9,  4,  0,190,  9,  4,  0,191,  9,102,  1,  2,  0,  7,  0,165,  2,  4,  0, 18,  0,180,  0,  5,  0,102,  1,192,  9,
+  4,  0,212,  2,  4,  0,193,  9,  4,  0,194,  9,  4,  0, 18,  0,179,  0, 16,  0,  4,  0,195,  9,  4,  0,196,  9,  4,  0,197,  9,
+  4,  0,198,  9,  2,  0,199,  9,  2,  0,200,  9,  2,  0,201,  9,  2,  0,252,  0,  2,  0,202,  9,  2,  0,203,  9,  2,  0,204,  9,
+  2,  0,205,  9,  4,  0,206,  9,  4,  0,207,  9,  4,  0,208,  9,  4,  0,209,  9,103,  1, 40,  0,103,  1,  0,  0,103,  1,  1,  0,
+ 21,  0,156,  9, 14,  0,251,  3,  0,  0, 19,  0,  2,  0, 18,  0,  2,  0,210,  9,  2,  0,209,  3,  2,  0,211,  9,  0,  0,212,  9,
+  0,  0,213,  9,  0,  0,214,  9,100,  1,215,  9,103,  1, 38,  0,103,  1,216,  9, 14,  0,217,  9, 14,  0,218,  9,180,  0,184,  3,
+ 27,  0,219,  9,103,  1,220,  9,  7,  0, 78,  1,  7,  0,177,  0,  7,  0,221,  9,  7,  0, 19,  2,  7,  0,198,  3,  7,  0,200,  3,
+  2,  0,232,  3,  2,  0, 27,  0,  7,  0,222,  9,  7,  0,223,  9,  7,  0,203,  3,  7,  0,224,  9,  7,  0,225,  9,  7,  0,226,  9,
+  7,  0,227,  9,  7,  0,228,  9,  7,  0,229,  9,  7,  0,230,  9,  7,  0,231,  9, 11,  0,232,  9,177,  0, 16,  0, 14,  0,233,  9,
+ 74,  0,234,  9,  2,  0, 18,  0,  2,  0, 27,  0,  4,  0,235,  9,  4,  0, 92,  0,  7,  0, 84,  0,  7,  0,236,  9,  7,  0,237,  9,
+ 14,  0,238,  9,  4,  0,239,  9,  4,  0,240,  9, 11,  0,241,  9, 11,  0,242,  9,179,  0,183,  3,  0,  0,243,  9,104,  1,  1,  0,
+  4,  0,240,  9,105,  1, 12,  0,  4,  0,240,  9,  7,  0, 78,  9,  2,  0,244,  9,  2,  0,245,  9,  7,  0,246,  9,  7,  0,247,  9,
+  2,  0,248,  9,  2,  0, 18,  0,  7,  0,249,  9,  7,  0,250,  9,  7,  0,251,  9,  7,  0,252,  9,106,  1,  7,  0,106,  1,  0,  0,
+106,  1,  1,  0, 14,  0,253,  9,  4,  0, 18,  0,  4,  0,254,  9,  0,  0, 19,  0, 22,  1,255,  9,176,  0,  9,  0, 22,  0, 32,  0,
+ 14,  0,  0, 10, 14,  0,233,  9, 14,  0,  1, 10, 14,  0,103,  0,  4,  0, 18,  0,  4,  0,  2, 10,  4,  0,  3, 10,  4,  0, 27,  0,
+243,  0,  8,  0, 22,  0,  4, 10, 14,  0,233,  9, 64,  0,  5, 10,  0,  0,  6, 10,  4,  0,  7, 10,  4,  0, 18,  0,  4,  0,  8, 10,
+  4,  0, 27,  0,107,  1, 13,  0,239,  0,  0,  0,239,  0,  1,  0, 14,  0,146,  6,  4,  0,147,  6,  7,  0,148,  6,  2,  0,149,  6,
+240,  0,200,  6,176,  0,179,  3,243,  0,  9, 10,  0,  0, 88,  1,  0,  0,203,  6,  2,  0, 18,  0,  7,  0, 10, 10,108,  1,  8,  0,
+108,  1,  0,  0,108,  1,  1,  0,106,  1, 11, 10, 31,  0, 80,  0, 14,  0,185,  3,  4,  0, 18,  0,  0,  0, 19,  0,  4,  0,118,  8,
+109,  1,  5,  0,109,  1,  0,  0,109,  1,  1,  0, 31,  0, 80,  0,  2,  0, 18,  0,  0,  0, 12, 10,110,  1, 14,  0,110,  1,  0,  0,
+110,  1,  1,  0, 11,  0,  2,  0,  2,  0, 16,  0,  2,  0, 18,  0,  0,  0, 13, 10,  0,  0, 14, 10,  0,  0, 19,  0,  2,  0, 27,  0,
+  7,  0, 15, 10,  7,  0, 16, 10, 31,  0, 80,  0,  7,  0, 17, 10,  7,  0, 18, 10,111,  1,  9,  0,111,  1,  0,  0,111,  1,  1,  0,
+ 27,  0, 19, 10,  0,  0, 11,  3,  7,  0, 20, 10,  2,  0, 21, 10,  2,  0, 18,  0,  2,  0, 16,  0,  2,  0, 22, 10,112,  1,  7,  0,
+ 37,  0,  6,  7, 21,  0,156,  9,  4,  0, 18,  0,  4,  0, 23, 10, 14,  0, 24, 10, 27,  0, 19, 10,  0,  0, 11,  3,113,  1, 15,  0,
+ 27,  0, 19, 10,  2,  0, 25, 10,  2,  0, 18,  0,  2,  0, 26, 10,  2,  0, 27, 10,  0,  0, 11,  3, 27,  0, 28, 10,  0,  0, 29, 10,
+  7,  0, 30, 10,  7,  0, 40,  2,  7,  0, 31, 10,  7,  0, 32, 10,  2,  0, 16,  0,  2,  0, 88,  1,  7,  0, 95,  1,114,  1,  6,  0,
+ 27,  0, 19, 10,  7,  0,192,  9,  2,  0, 33, 10,  2,  0, 34, 10,  2,  0, 18,  0,  2,  0, 35, 10,115,  1,  6,  0, 27,  0, 19, 10,
+  4,  0, 36, 10,  4,  0, 37, 10,  4,  0, 93,  0,  4,  0, 27,  0,  0,  0, 11,  3,116,  1,  4,  0, 27,  0, 19, 10,  4,  0, 18,  0,
+  4,  0, 36, 10,  0,  0, 11,  3,117,  1,  4,  0, 27,  0, 19, 10,  4,  0, 18,  0,  4,  0, 36, 10,  0,  0, 11,  3,118,  1,  4,  0,
+ 27,  0, 19, 10,  4,  0, 18,  0,  4,  0, 36, 10,  0,  0, 11,  3,119,  1,  2,  0,  4,  0, 18,  0,  7,  0, 84,  4,120,  1,  2,  0,
+ 27,  0, 19, 10,  0,  0, 11,  3,121,  1, 10,  0, 27,  0, 19, 10,  4,  0, 38, 10,  7,  0,129,  0,  4,  0, 18,  0,  2,  0,  4,  7,
+  2,  0, 39, 10,  2,  0, 92,  0,  2,  0, 30,  0,  7,  0, 40, 10,  0,  0, 11,  3,122,  1, 10,  0, 27,  0, 19, 10,  2,  0, 16,  0,
+  2,  0,134,  4,  4,  0, 90,  0,  4,  0, 91,  0,  7,  0,116,  9,  7,  0,117,  9,  4,  0, 27,  0,176,  0, 86,  9,  0,  0, 11,  3,
+123,  1,  4,  0, 27,  0, 19, 10,  4,  0,210,  3,  4,  0, 41, 10,  0,  0, 11,  3,124,  1,  4,  0, 27,  0, 19, 10,  4,  0,210,  3,
+  4,  0, 27,  0,  0,  0, 11,  3,125,  1,  6,  0, 27,  0, 19, 10,  7,  0,129,  0,  7,  0, 82,  3,  4,  0, 42, 10,  2,  0,210,  3,
+  2,  0,211,  3,126,  1,  6,  0, 27,  0, 19, 10,  4,  0, 43, 10,  4,  0, 44, 10,  7,  0, 45, 10,  7,  0, 46, 10,  0,  0, 11,  3,
+127,  1, 16,  0, 27,  0, 19, 10, 27,  0,216,  9,  4,  0, 16,  0,  7,  0, 47, 10,  7,  0, 48, 10,  7,  0, 49, 10,  7,  0, 50, 10,
+  7,  0, 51, 10,  7,  0, 52, 10,  7,  0, 53, 10,  7,  0, 54, 10,  7,  0, 55, 10,  2,  0, 18,  0,  2,  0, 27,  0,  2,  0, 92,  0,
+  2,  0, 30,  0,128,  1,  3,  0, 27,  0, 19, 10,  4,  0, 18,  0,  4,  0, 32,  2,129,  1,  5,  0, 27,  0, 19, 10,  4,  0, 18,  0,
+  4,  0, 27,  0,  7,  0, 56, 10,  0,  0, 11,  3,130,  1, 10,  0, 27,  0, 19, 10,  0,  0, 11,  3,  2,  0, 57, 10,  2,  0, 58, 10,
+  0,  0, 59, 10,  0,  0, 60, 10,  7,  0, 61, 10,  7,  0, 62, 10,  7,  0, 63, 10,  7,  0, 64, 10,131,  1,  5,  0, 27,  0, 19, 10,
+  0,  0, 11,  3,  7,  0,220,  2,  2,  0, 65, 10,  2,  0, 18,  0,132,  1,  8,  0,  7,  0,  8,  0,  7,  0,  9,  0,  7,  0, 10,  0,
+  7,  0, 11,  0,  7,  0, 66, 10,  7,  0, 67, 10,  2,  0, 18,  0,  2,  0, 32,  2,133,  1,  8,  0,  7,  0,  8,  0,  7,  0,  9,  0,
+  7,  0, 10,  0,  7,  0, 11,  0,  7,  0, 66, 10,  7,  0, 67, 10,  2,  0, 18,  0,  2,  0, 32,  2,134,  1,  8,  0,  7,  0,  8,  0,
+  7,  0,  9,  0,  7,  0, 10,  0,  7,  0, 11,  0,  7,  0, 66, 10,  7,  0, 67, 10,  2,  0, 18,  0,  2,  0, 32,  2,135,  1,  7,  0,
+ 27,  0, 19, 10,  0,  0, 11,  3,  7,  0, 95,  1,  7,  0,104,  1,  2,  0, 18,  0,  2,  0, 88,  1,  4,  0, 27,  0,136,  1,  5,  0,
+ 27,  0, 70,  3,  7,  0, 95,  1,  2,  0, 74,  3,  0,  0, 76,  3,  0,  0, 68, 10,137,  1,  7,  0,229,  0,106,  6,  0,  0, 69, 10,
+  4,  0, 18,  0,  4,  0, 27,  0,  0,  0, 70, 10, 27,  0,208,  5, 27,  0, 71, 10,138,  1,  3,  0,229,  0,106,  6,  4,  0, 18,  0,
+  4,  0, 27,  0,139,  1,  6,  0,229,  0,106,  6,  4,  0, 18,  0,  4,  0, 27,  0,  0,  0, 70, 10,  7,  0, 56, 10, 27,  0,208,  5,
+140,  1, 10,  0,140,  1,  0,  0,140,  1,  1,  0,  2,  0, 16,  0,  2,  0, 18,  0,  0,  0, 72, 10,  7,  0, 32,  1,  7,  0, 33,  1,
+  2,  0,253,  9,  2,  0, 73, 10, 27,  0, 44,  0,141,  1, 22,  0,141,  1,  0,  0,141,  1,  1,  0,  2,  0, 18,  0,  2,  0, 88,  1,
+  2,  0, 74, 10,  2,  0, 75, 10, 31,  0, 80,  0,176,  0, 86,  9, 27,  0,169,  0,  7,  0, 90,  0,  7,  0, 91,  0,  7,  0, 76, 10,
+  7,  0, 77, 10,  7,  0, 78, 10,  7,  0, 79, 10,  7,  0,253,  2,  7,  0,148,  3,  7,  0, 88,  9,  7,  0, 80, 10,  0,  0, 81, 10,
+  0,  0, 82, 10, 14,  0,188,  3,142,  1, 11,  0,  7,  0, 47,  2,  7,  0,116,  9,  7,  0,117,  9, 11,  0,  2,  0,  2,  0, 83, 10,
+  2,  0, 84, 10,  2,  0, 85, 10,  2,  0, 86, 10,  2,  0, 87, 10,  2,  0, 88, 10,  2,  0,181,  2,143,  1, 21,  0,143,  1,  0,  0,
+143,  1,  1,  0,143,  1, 89, 10,  0,  0, 19,  0, 11,  0, 90, 10,  2,  0, 16,  0,  2,  0, 18,  0,  2,  0, 91, 10,  2,  0, 92, 10,
+  7,  0, 93, 10,  7,  0, 94, 10, 11,  0, 95, 10,  2,  0, 96, 10,  2,  0, 97, 10,  4,  0, 74,  0, 11,  0,150,  9,  4,  0, 98, 10,
+  4,  0, 99, 10,143,  1,100, 10,144,  1,101, 10,142,  1,102, 10,145,  1,  4,  0,  0,  0,103, 10,  2,  0,104, 10,  2,  0,105, 10,
+  4,  0, 27,  0,146,  1, 37,  0,146,  1,  0,  0,146,  1,  1,  0,146,  1,106, 10,  0,  0, 19,  0,  2,  0, 16,  0,  2,  0, 18,  0,
+  2,  0,197,  8,  2,  0,176,  2,  2,  0,107, 10,  2,  0,  9,  7,  2,  0, 96, 10,  2,  0, 40,  9, 14,  0, 81,  9, 14,  0,108, 10,
+146,  1, 38,  0, 22,  0, 42,  7, 11,  0, 90, 10,  7,  0, 93, 10,  7,  0, 94, 10,  7,  0, 82,  2,  7,  0,  1,  3,  7,  0,109, 10,
+  4,  0,110, 10,  0,  0,111, 10,  2,  0,112, 10,  2,  0,113, 10,  7,  0,114, 10,  7,  0,115, 10,  2,  0,116, 10,  2,  0,117, 10,
+ 11,  0,118, 10, 19,  0,119, 10, 19,  0,120, 10, 19,  0,121, 10,145,  1,155,  0,147,  1,122, 10,148,  1,123, 10,144,  1,  8,  0,
+144,  1,  0,  0,144,  1,  1,  0,146,  1,124, 10,146,  1,125, 10,143,  1,126, 10,143,  1,127, 10,  4,  0, 18,  0,  4,  0, 27,  0,
+ 57,  0, 20,  0, 22,  0, 32,  0, 34,  0, 75,  0,178,  0,182,  3, 14,  0,128, 10, 14,  0,129, 10,  4,  0, 16,  0,  4,  0,130, 10,
+  4,  0,131, 10,  4,  0, 18,  0,  4,  0,110, 10,  4,  0,132, 10, 14,  0, 81,  9, 14,  0,108, 10,149,  1,133, 10, 11,  0,134, 10,
+ 11,  0,135, 10,  4,  0,136, 10, 11,  0,137, 10, 11,  0,138, 10, 11,  0,139, 10,150,  1,  4,  0,  4,  0, 17,  0,  4,  0,230,  2,
+  4,  0,116,  9,  4,  0,117,  9,151,  1,  4,  0,  4,  0, 17,  0,  7,  0,230,  2,  7,  0,116,  9,  7,  0,117,  9,152,  1,  2,  0,
+  0,  0,230,  2,  0,  0, 87,  1,153,  1,  4,  0,  4,  0, 17,  0,  7,  0,140, 10,  7,  0,116,  9,  7,  0,117,  9,154,  1,  1,  0,
+  7,  0,141, 10,155,  1,  6,  0,  4,  0,128,  0,  4,  0,130,  0,  4,  0, 40,  9,  0,  0,142, 10,  0,  0,143, 10,  2,  0, 27,  0,
+156,  1, 16,  0,  2,  0,141,  8,  2,  0,142,  8,  2,  0,144, 10,  2,  0,145, 10,  2,  0,146, 10,  2,  0, 67,  0,  2,  0, 43,  7,
+  2,  0,147, 10,  7,  0,252,  2,  7,  0,148, 10,  7,  0,149, 10,  2,  0,110,  1,  0,  0,150, 10,  0,  0,151, 10,  4,  0,152, 10,
+  4,  0,153, 10,157,  1,  9,  0,  7,  0,154, 10,  7,  0,155, 10,  7,  0,149,  9,  7,  0, 94,  3,  7,  0,156, 10,  7,  0,218,  6,
+  2,  0, 92,  3,  0,  0,157, 10,  0,  0, 27,  0,158,  1,  4,  0,  7,  0,158, 10,  7,  0,159, 10,  2,  0, 92,  3,  2,  0, 27,  0,
+159,  1,  3,  0,  7,  0,160, 10,  7,  0,212,  8,  7,  0, 14,  0,160,  1,  4,  0,  0,  0, 35,  0,204,  0, 80,  5,  4,  0,130,  0,
+  4,  0,132,  4,161,  1,  6,  0,  0,  0,161, 10,204,  0,162, 10,  4,  0,130,  0,  4,  0,132,  4,  4,  0,163, 10,  4,  0, 27,  0,
+162,  1,  4,  0,  2,  0,164, 10,  2,  0,165, 10,  4,  0, 30,  0,204,  0,162, 10,163,  1,  9,  0,  7,  0,166, 10,  7,  0,167, 10,
+  7,  0,168, 10,  7,  0, 93,  2,  7,  0,169, 10,  7,  0,170, 10,  7,  0,171, 10,  2,  0,172, 10,  2,  0,173, 10,164,  1,  8,  0,
+  2,  0,174, 10,  2,  0,175, 10,  2,  0,176, 10,  2,  0,177, 10,  7,  0,178, 10,  7,  0,179, 10,  7,  0,180, 10,  7,  0,181, 10,
+165,  1,  2,  0,  7,  0,  5,  0,  7,  0,  6,  0,166,  1,  2,  0,  0,  0,171,  0,  0,  0,182, 10,167,  1,  1,  0,  0,  0, 19,  0,
+168,  1, 12,  0,  0,  0,183, 10,  0,  0,184, 10,  0,  0,209,  6,  0,  0,185, 10,  2,  0,144, 10,  2,  0,186, 10,  7,  0,187, 10,
+  7,  0,188, 10,  7,  0,189, 10,  7,  0,148,  3,  7,  0,190, 10,  7,  0,191, 10,169,  1,  2,  0, 11,  0,192, 10, 11,  0,193, 10,
+170,  1, 13,  0,  0,  0, 72,  5,  0,  0, 16,  0,  0,  0, 92,  3,  0,  0, 94,  3,  0,  0,184, 10,  0,  0,109,  0,  0,  0,181,  2,
+  7,  0,194, 10,  7,  0,195, 10,  7,  0,147,  3,  7,  0,196, 10,  7,  0,197, 10,  7,  0,191, 10,171,  1,  8,  0,  7,  0, 47,  9,
+  7,  0,129,  0,  7,  0,151, 10,  7,  0,172,  2,  7,  0,198, 10,  7,  0,241,  0,  7,  0,199, 10,  4,  0, 16,  0,172,  1,  4,  0,
+  2,  0,200, 10,  2,  0,201, 10,  2,  0,202, 10,  2,  0, 27,  0,173,  1,  8,  0,  7,  0,203, 10,  7,  0,220,  2,  7,  0,204, 10,
+  7,  0,190,  8,  7,  0,191,  8,  7,  0,192,  8,  7,  0,205, 10,  7,  0,206, 10,174,  1,  6,  0,  2,  0,207, 10,  2,  0,208, 10,
+  7,  0,209, 10,  7,  0,210, 10,  7,  0,211, 10,  7,  0,212, 10,175,  1,  2,  0, 58,  0,213, 10, 59,  0,214, 10,176,  1,  3,  0,
+175,  1, 79,  6,  7,  0,215, 10,  7,  0,216, 10,177,  1,  3,  0,175,  1, 79,  6,  4,  0,217, 10,  4,  0, 27,  0,178,  1,  1,  0,
+175,  1, 79,  6,179,  1,  3,  0,175,  1, 79,  6,  4,  0,217, 10,  4,  0,218, 10,180,  1,  3,  0,175,  1, 79,  6,  4,  0,219, 10,
+  4,  0, 27,  0,181,  1,  1,  0,175,  1, 79,  6,182,  1,  3,  0,175,  1, 79,  6,  4,  0,220, 10,  4,  0, 27,  0,183,  1,  3,  0,
+175,  1, 79,  6,  4,  0,221, 10,  4,  0, 27,  0,184,  1,  3,  0,175,  1, 79,  6,  4,  0,222, 10,  4,  0, 27,  0,185,  1,  3,  0,
+175,  1, 79,  6,  4,  0,251,  0,  4,  0, 27,  0,186,  1,  1,  0,  0,  0, 19,  0,187,  1,  1,  0,  0,  0, 19,  0,188,  1,  4,  0,
+  7,  0,  5,  0,  7,  0,  6,  0,  2,  0, 18,  0,  2,  0,223, 10,189,  1, 10,  0,  2,  0, 62,  4,  2,  0, 18,  0,  7,  0,217,  4,
+  7,  0,224, 10,  7,  0,225, 10,  7,  0,226, 10,  7,  0,227, 10,188,  1,228, 10,188,  1,229, 10,188,  1,230, 10, 54,  0, 11,  0,
+  4,  0, 18,  0,  4,  0, 63,  0,  4,  0,231, 10,  4,  0,232, 10, 19,  0,233, 10, 19,  0,234, 10,189,  1,235, 10,  7,  0,236, 10,
+  7,  0,237, 10,  7,  0,238, 10,  7,  0,239, 10,  0,  1, 10,  0,  4,  0,253,  9,  4,  0,240, 10,  7,  0,241, 10,  7,  0,242, 10,
+  7,  0,243, 10,  7,  0,244, 10,  7,  0,  9,  0,  7,  0, 11,  0,  4,  0, 88,  1,  4,  0,  1,  3,255,  0, 18,  0,  4,  0,133,  0,
+  4,  0,245, 10,  4,  0,246, 10,  7,  0,247, 10,  4,  0,248, 10,  7,  0,249, 10,  7,  0,250, 10,  4,  0,251, 10,  7,  0,252, 10,
+  4,  0,253, 10,  7,  0,254, 10,  0,  1,255, 10,  7,  0,  0, 11,  7,  0,  1, 11,  7,  0,  2, 11,  7,  0,  3, 11,  4,  0,  4, 11,
+  4,  0, 27,  0,190,  1,  4,  0, 42,  0,244,  2,  7,  0,  5, 11,  7,  0,179,  1,  7,  0, 27,  0,213,  0, 34,  0, 22,  0, 32,  0,
+190,  1,  6, 11, 54,  0,228, 10, 46,  0,  7, 11, 52,  0,  8, 11, 25,  0,155,  0,  0,  0,  9, 11,  7,  0, 10, 11,  2,  0,109,  6,
+  2,  0, 11, 11,  4,  0,109,  0,  4,  0, 18,  0,  7,  0, 12, 11,  4,  0, 90,  2,  4,  0, 13, 11,  7,  0, 14, 11,  7,  0, 15, 11,
+  7,  0, 16, 11,  7,  0,179,  1,  4,  0, 17, 11,  7,  0, 18, 11,  0,  0, 19, 11,  0,  0, 20, 11,  0,  0, 21, 11,  0,  0, 22, 11,
+  7,  0, 23, 11,  7,  0, 24, 11,  7,  0, 25, 11,  7,  0,  1,  3,  7,  0, 26, 11,  4,  0, 27, 11,  7,  0,240,  5,  7,  0, 28, 11,
+  7,  0, 29, 11,191,  1, 10,  0,  4,  0, 16,  0,  4,  0,129,  0,  4,  0, 18,  0,  4,  0, 15,  4,  4,  0, 30, 11,  4,  0, 31, 11,
+  4,  0, 32, 11,  4,  0, 73,  0,  0,  0, 19,  0, 11,  0,  2,  0,192,  1,  1,  0,  0,  0, 70,  7, 95,  0,  8,  0,191,  1, 33, 11,
+  4,  0, 34, 11,  4,  0, 35, 11,  4,  0, 36, 11,  4,  0, 37, 11,  4,  0, 30,  0, 11,  0, 38, 11,192,  1, 39, 11,193,  1,  5,  0,
+  7,  0,165,  2,  7,  0,240,  2,  7,  0, 40,  2,  2,  0,147,  2,  2,  0, 27,  0,194,  1,  5,  0,  7,  0,165,  2,  7,  0,159,  4,
+  7,  0, 40, 11,  7,  0, 41, 11,  7,  0,240,  2,195,  1,  5,  0, 27,  0, 42, 11,196,  1, 21,  0,  7,  0, 75,  6,  7,  0, 43, 11,
+  7,  0, 56,  0,197,  1,  3,  0,  7,  0, 44, 11,  4,  0, 45, 11,  4,  0, 46, 11,198,  1,  7,  0,  4,  0, 47, 11,  4,  0, 48, 11,
+  4,  0, 49, 11,  7,  0, 50, 11,  7,  0, 51, 11,  7,  0, 52, 11,  7,  0, 56,  0,199,  1,  8,  0,199,  1,  0,  0,199,  1,  1,  0,
+ 27,  0, 44,  0,  4,  0,  4,  1,  2,  0, 18,  0,  2,  0, 88,  1,  7,  0,240,  2,  7,  0, 55,  9,200,  1,  7,  0,200,  1,  0,  0,
+200,  1,  1,  0, 27,  0, 44,  0,  2,  0,225,  2,  2,  0, 18,  0,  2,  0, 14,  2,  2,  0, 56,  0,201,  1, 17,  0,194,  1,  8,  4,
+194,  1, 53, 11,193,  1, 54, 11,194,  1, 38,  9,195,  1, 55, 11,  4,  0, 82,  0,  7,  0,240,  2,  7,  0,  7,  3,  7,  0, 56, 11,
+  4,  0, 47, 11,  4,  0, 57, 11,  7,  0, 51, 11,  7,  0, 52, 11,  7,  0,109,  0,  4,  0, 58, 11,  2,  0, 18,  0,  2,  0, 59, 11,
+202,  1, 15,  0,  7,  0,  0,  1,  7,  0, 60, 11,  7,  0, 44, 11,  7,  0, 61, 11,  7,  0, 62, 11,  7,  0, 63, 11,  7,  0, 64, 11,
+  7,  0, 65, 11,  7,  0, 66, 11,  7,  0, 67, 11,  7,  0, 68, 11,  7,  0, 69, 11,  7,  0, 70, 11,  4,  0, 18,  0,  4,  0, 71, 11,
+203,  1,128,  0, 22,  0, 32,  0, 34,  0, 75,  0,204,  1, 72, 11,202,  1, 73, 11,187,  0,154,  4,  4,  0, 18,  0,  4,  0, 56,  0,
+  2,  0, 16,  0,  2,  0, 57, 10,  2,  0, 74, 11,  2,  0,123,  1,  2,  0, 75, 11,  2,  0,232,  3,  2,  0, 76, 11,  2,  0, 77, 11,
+  2,  0, 78, 11,  2,  0, 79, 11,  2,  0, 80, 11,  2,  0, 81, 11,  2,  0, 82, 11,  2,  0, 83, 11,  2,  0, 84, 11,  2,  0,224,  5,
+  2,  0, 85, 11,  2,  0, 86, 11,  2,  0, 87, 11,  2,  0, 88, 11,  2,  0, 89, 11,  2,  0, 29,  2,  2,  0, 31,  9,  2,  0,  6,  9,
+  2,  0, 90, 11,  2,  0, 91, 11,  2,  0, 25,  4,  2,  0, 26,  4,  2,  0, 92, 11,  2,  0, 93, 11,  2,  0, 94, 11,  2,  0, 95, 11,
+  7,  0, 96, 11,  7,  0, 97, 11,  7,  0, 98, 11,  7,  0, 99, 11,  7,  0,100, 11,  7,  0,101, 11,  7,  0,102, 11,  2,  0,154,  5,
+  2,  0,103, 11,  7,  0,104, 11,  7,  0,105, 11,  7,  0,106, 11,  7,  0, 13,  9,  7,  0, 91,  0,  7,  0,  7,  3,  7,  0, 19,  9,
+  7,  0,107, 11,  7,  0,108, 11,  7,  0,109, 11,  7,  0,110, 11,  7,  0,111, 11,  7,  0,112, 11,  4,  0, 14,  9,  4,  0, 12,  9,
+  4,  0,113, 11,  4,  0,114, 11,  2,  0,115, 11,  2,  0,116, 11,  7,  0, 15,  9,  7,  0, 16,  9,  7,  0, 17,  9,  7,  0,117, 11,
+  7,  0,118, 11,  7,  0,119, 11,  7,  0,120, 11,  7,  0,121, 11,  7,  0,122, 11,  7,  0,123, 11,  7,  0,124, 11,  7,  0,125, 11,
+  7,  0,222,  3,  7,  0,109,  0,  7,  0,126, 11,  7,  0,127, 11,  7,  0,128, 11,  7,  0,129, 11,  7,  0,215,  0,  7,  0,130, 11,
+  4,  0,131, 11,  4,  0,132, 11,  7,  0,133, 11,  7,  0,134, 11,  7,  0,135, 11,  7,  0,136, 11,  7,  0,137, 11,  7,  0,214,  0,
+  7,  0,138, 11,  7,  0, 52,  4,  7,  0, 50,  4,  7,  0, 51,  4,  7,  0,139, 11,  7,  0,140, 11,  7,  0,141, 11,  7,  0,142, 11,
+  7,  0,143, 11,  7,  0,144, 11,  7,  0,145, 11,  7,  0,146, 11,  7,  0,147, 11,  7,  0,148, 11,  7,  0,149, 11,  7,  0,150, 11,
+  7,  0,151, 11,  7,  0,152, 11,  7,  0,153, 11,  7,  0,154, 11,  7,  0,155, 11,  7,  0,156, 11,  4,  0,157, 11,  4,  0,158, 11,
+ 46,  0,141,  1, 64,  0,  0,  4, 14,  0,159, 11, 64,  0,160, 11, 27,  0,161, 11, 27,  0,162, 11, 31,  0, 80,  0,182,  0, 74,  1,
+182,  0,163, 11,150,  0, 52,  0,150,  0,  0,  0,150,  0,  1,  0,203,  1,164, 11,201,  1,165, 11,198,  1,216,  9,190,  0, 80,  4,
+ 11,  0, 81,  4,205,  1,166, 11,205,  1,167, 11, 14,  0,168, 11, 14,  0,169, 11,135,  0,170, 11,143,  0,171, 11,143,  0,172, 11,
+ 27,  0,173, 11, 27,  0,174, 11, 27,  0, 38,  0, 14,  0, 24, 10,  0,  0, 19,  0,  7,  0,245,  0,  7,  0, 36,  3,  7,  0,175, 11,
+  7,  0,176, 11,  4,  0,214,  2,  4,  0,177, 11,  4,  0, 18,  0,  4,  0, 14,  9,  4,  0,178, 11,  4,  0,179, 11,  4,  0,180, 11,
+  4,  0,181, 11,  2,  0,252,  0,  2,  0,182, 11,  2,  0,183, 11,  2,  0,184, 11,  0,  0,185, 11,  2,  0,186, 11,  2,  0,187, 11,
+  2,  0,188, 11, 11,  0,189, 11,139,  0,153,  4, 14,  0, 21,  3, 14,  0,190, 11,197,  1,191, 11,  4,  0,192, 11,  4,  0,193, 11,
+206,  1,194, 11,141,  0, 33,  3,207,  1,195, 11,  7,  0,196, 11,  7,  0,197, 11,  7,  0,198, 11,137,  0, 38,  0,208,  1,150,  9,
+  7,  0,123,  4,  7,  0,199, 11,  7,  0,200, 11,  7,  0, 75,  6,  7,  0,236,  3,  7,  0,222,  3,  7,  0,201, 11,  7,  0, 92,  2,
+  7,  0,202, 11,  7,  0,203, 11,  7,  0,204, 11,  7,  0,205, 11,  7,  0,206, 11,  7,  0,207, 11,  7,  0,124,  4,  7,  0,208, 11,
+  7,  0,209, 11,  7,  0,210, 11,  7,  0,125,  4,  7,  0,121,  4,  7,  0,122,  4,  7,  0,211, 11,  7,  0,212, 11,  7,  0,213, 11,
+  4,  0,214, 11,  4,  0, 93,  0,  4,  0,215, 11,  4,  0,216, 11,  2,  0,217, 11,  2,  0,218, 11,  2,  0,219, 11,  2,  0,220, 11,
+  2,  0,221, 11,  2,  0,222, 11,  2,  0,223, 11,  2,  0, 27,  0,187,  0,154,  4,138,  0, 11,  0,208,  1,224, 11,  7,  0,225, 11,
+  7,  0,226, 11,  7,  0,251,  1,  7,  0,227, 11,  7,  0,228, 11,  7,  0,229, 11,  4,  0, 93,  0,  2,  0,230, 11,  2,  0,231, 11,
+ 64,  0,250,  1,209,  1,  4,  0,  7,  0,  5,  0,  7,  0,  6,  0,  7,  0,  7,  0,  7,  0,232, 11,210,  1,  6,  0,210,  1,  0,  0,
+210,  1,  1,  0,209,  1,192,  9,  4,  0,  2,  1,  2,  0,233, 11,  2,  0, 18,  0,211,  1,  5,  0,211,  1,  0,  0,211,  1,  1,  0,
+ 14,  0,234, 11,  4,  0,235, 11,  4,  0, 18,  0,212,  1,  9,  0,212,  1,  0,  0,212,  1,  1,  0, 14,  0,128,  0,211,  1,236, 11,
+  4,  0, 18,  0,  2,  0,233, 11,  2,  0,237, 11,  7,  0, 94,  0,  0,  0,238, 11,178,  0,  6,  0, 22,  0, 32,  0, 14,  0,123,  5,
+  4,  0, 18,  0,  2,  0,239, 11,  2,  0,240, 11, 11,  0,241, 11,213,  1,  6,  0, 14,  0,242, 11,  4,  0,243, 11,  4,  0,244, 11,
+  4,  0, 18,  0,  4,  0, 27,  0,237,  0,245, 11,214,  1, 19,  0, 22,  0, 32,  0,215,  1,246, 11,215,  1,247, 11, 14,  0,248, 11,
+  4,  0,249, 11,  2,  0,250, 11,  2,  0,251, 11, 14,  0,252, 11, 14,  0,253, 11,213,  1,254, 11, 14,  0,255, 11, 14,  0,  0, 12,
+ 14,  0,  1, 12, 14,  0,  2, 12,216,  1,  3, 12,216,  1,  4, 12,216,  1,  5, 12, 14,  0,  6, 12,237,  0,  7, 12,215,  1, 32,  0,
+215,  1,  0,  0,215,  1,  1,  0, 11,  0,  8, 12,  4,  0,119,  8,  2,  0,  9, 12,  2,  0, 27,  0, 27,  1, 10, 12, 27,  1, 11, 12,
+  0,  0, 12, 12,  2,  0, 13, 12,  2,  0, 14, 12,  2,  0,141,  8,  2,  0,142,  8,  2,  0, 15, 12,  2,  0, 16, 12,  2,  0, 15,  4,
+  2,  0, 53,  7,  2,  0, 17, 12,  2,  0, 18, 12,  2,  0, 19, 12,  2,  0, 30,  0,217,  1, 20, 12,218,  1, 21, 12,219,  1, 22, 12,
+  4,  0, 23, 12,  4,  0, 24, 12, 11,  0, 25, 12, 14,  0,253, 11, 14,  0,160,  8, 14,  0, 26, 12, 14,  0, 27, 12, 14,  0, 28, 12,
+220,  1, 17,  0,220,  1,  0,  0,220,  1,  1,  0,  0,  0, 29, 12, 21,  0, 31,  0,  2,  0, 30, 12,  2,  0, 16,  0,  2,  0, 14,  0,
+  2,  0, 31, 12,  2,  0, 32, 12,  2,  0, 33, 12,  2,  0, 34, 12,  2,  0, 35, 12,  2,  0, 18,  0,  2,  0, 36, 12,  2,  0, 32,  0,
+  2,  0, 27,  0,221,  1, 37, 12,222,  1,  4,  0,222,  1,  0,  0,222,  1,  1,  0,220,  1, 38, 12,220,  1, 39, 12,223,  1, 11,  0,
+223,  1,  0,  0,223,  1,  1,  0, 14,  0, 40, 12, 14,  0, 41, 12,  0,  0, 29, 12,  2,  0, 42, 12,  2,  0, 43, 12,  2,  0, 18,  0,
+  2,  0, 44, 12,  4,  0, 45, 12, 11,  0, 46, 12,216,  1,  7,  0,216,  1,  0,  0,216,  1,  1,  0,  0,  0, 29, 12,  0,  0, 47, 12,
+ 14,  0, 59,  8,  4,  0, 48, 12,  4,  0, 18,  0,249,  0, 14,  0,249,  0,  0,  0,249,  0,  1,  0,  0,  0, 29, 12, 21,  0, 31,  0,
+224,  1,135,  8, 11,  0, 49, 12, 11,  0, 50, 12,221,  1, 37, 12,213,  1, 51, 12, 14,  0, 52, 12,249,  0, 53, 12, 32,  1,239,  6,
+  2,  0, 18,  0,  2,  0, 87,  1,225,  1, 12,  0,225,  1,  0,  0,225,  1,  1,  0, 11,  0,  2,  0, 11,  0, 54, 12,  0,  0, 19,  0,
+  2,  0, 16,  0,  2,  0, 18,  0,  7,  0,138,  9,  7,  0,130,  0,  7,  0,132,  4,  7,  0, 88,  9,  7,  0, 80, 10,226,  1,  5,  0,
+  7,  0, 55, 12,  4,  0, 56, 12,  4,  0, 57, 12,  4,  0, 88,  1,  4,  0, 18,  0,227,  1,  6,  0,  7,  0, 58, 12,  7,  0, 59, 12,
+  7,  0, 60, 12,  7,  0, 61, 12,  4,  0, 16,  0,  4,  0, 18,  0,228,  1,  5,  0,  7,  0,116,  9,  7,  0,117,  9,  7,  0,240,  2,
+  2,  0, 43,  2,  2,  0, 44,  2,229,  1,  5,  0,228,  1,  2,  0,  4,  0, 53,  0,  7,  0, 62, 12,  7,  0,116,  9,  7,  0,117,  9,
+230,  1,  4,  0,  2,  0, 63, 12,  2,  0, 64, 12,  2,  0, 65, 12,  2,  0, 66, 12,231,  1,  2,  0, 37,  0, 37,  7, 21,  0,156,  9,
+232,  1,  3,  0, 19,  0, 67, 12,  4,  0, 18,  0,  4,  0, 27,  0,233,  1,  6,  0,  7,  0,109,  0,  7,  0,209,  2,  7,  0, 68, 12,
+  7,  0, 27,  0,  2,  0,251,  0,  2,  0, 69, 12,234,  1,  5,  0,  7,  0, 70, 12,  7,  0,129,  0,  7,  0,193,  9,  7,  0,194,  9,
+  4,  0, 18,  0,235,  1,  6,  0, 22,  0, 42,  7,  0,  0, 71, 12,  0,  0, 72, 12,  2,  0, 73, 12,  2,  0, 18,  0,  4,  0, 74, 12,
+236,  1,  7,  0,236,  1,  0,  0,236,  1,  1,  0,  0,  0, 19,  0,235,  1, 75, 12,  2,  0, 76, 12,  2,  0, 16,  0,  7,  0, 60,  0,
+237,  1,  7,  0, 14,  0, 77, 12,  0,  0, 78, 12, 11,  0, 79, 12,  7,  0, 60,  0,  7,  0,138,  9,  4,  0, 16,  0,  4,  0, 18,  0,
+238,  1,  3,  0,  7,  0, 80, 12,  4,  0, 18,  0,  4,  0, 27,  0,239,  1, 15,  0,239,  1,  0,  0,239,  1,  1,  0,106,  1, 11, 10,
+237,  1, 61,  0, 14,  0,188,  3, 30,  0, 49,  0,238,  1, 81, 12,  4,  0, 53,  0,  7,  0, 60,  0,  2,  0, 18,  0,  2,  0, 23,  1,
+  4,  0, 82, 12,  0,  0, 71, 12,  4,  0, 83, 12,  7,  0, 84, 12,240,  1,  2,  0,  0,  0, 85, 12,  0,  0, 86, 12,241,  1,  4,  0,
+241,  1,  0,  0,241,  1,  1,  0,176,  0, 70,  3, 14,  0, 87, 12,242,  1, 25,  0,242,  1,  0,  0,242,  1,  1,  0, 14,  0, 88, 12,
+176,  0, 86,  9,241,  1, 89, 12, 14,  0, 90, 12, 14,  0,188,  3,  0,  0, 19,  0,  7,  0,138,  9,  7,  0, 91, 12,  7,  0, 90,  0,
+  7,  0, 91,  0,  7,  0, 76, 10,  7,  0, 77, 10,  7,  0,253,  2,  7,  0,148,  3,  7,  0, 88,  9,  7,  0, 80, 10,  2,  0, 92, 12,
+  2,  0, 93, 12,  2,  0, 92,  0,  2,  0, 16,  0, 11,  0, 94, 12,  4,  0, 18,  0,  4,  0, 30,  0,243,  1,  6,  0,243,  1,  0,  0,
+243,  1,  1,  0, 14,  0, 88, 12,  4,  0, 18,  0,  4,  0, 14,  2,  0,  0, 19,  0,244,  1, 11,  0,244,  1,  0,  0,244,  1,  1,  0,
+ 22,  0, 42,  7,  0,  0, 95, 12,  4,  0, 74, 12,  2,  0, 96, 12,  2,  0, 27,  0,  0,  0, 71, 12,  4,  0, 82, 12,  2,  0, 18,  0,
+  2,  0, 97, 12,245,  1, 10,  0,245,  1,  0,  0,245,  1,  1,  0, 14,  0, 98, 12,  0,  0, 29, 12,  0,  0, 19,  0,  0,  0, 99, 12,
+  0,  0,100, 12,  2,  0, 18,  0,  2,  0, 97, 12,  4,  0,101, 12,246,  1,  5,  0,246,  1,  0,  0,246,  1,  1,  0,  0,  0, 71, 12,
+  4,  0, 82, 12,  7,  0,230,  2, 34,  0, 12,  0,176,  0,179,  3,176,  0,102, 12,241,  1, 89, 12, 14,  0,103, 12,242,  1,104, 12,
+ 14,  0,105, 12, 14,  0,106, 12,  4,  0, 18,  0,  4,  0,252,  0,  2,  0,107, 12,  2,  0,108, 12,  7,  0,109, 12,247,  1,  2,  0,
+ 22,  0, 32,  0, 34,  0, 75,  0,248,  1,  5,  0,248,  1,  0,  0,248,  1,  1,  0,  4,  0, 16,  0,  4,  0, 18,  0,  0,  0,172,  5,
+249,  1,  6,  0,248,  1,110, 12, 27,  0, 44,  0,  4,  0,111, 12,  7,  0,112, 12,  4,  0,113, 12,  4,  0,253,  9,250,  1,  3,  0,
+248,  1,110, 12,  4,  0,111, 12,  7,  0,114, 12,251,  1,  8,  0,248,  1,110, 12, 27,  0, 44,  0,  7,  0, 78,  1,  7,  0,115, 12,
+  7,  0, 36,  3,  7,  0,149,  9,  4,  0,111, 12,  4,  0,116, 12,252,  1,  5,  0,248,  1,110, 12,  7,  0,117, 12,  7,  0,176,  2,
+  7,  0,  3,  3,  7,  0, 56,  0,253,  1,  3,  0,248,  1,110, 12,  7,  0,149,  9,  7,  0,118, 12,196,  1,  4,  0,  7,  0,119, 12,
+  7,  0,127, 11,  2,  0,120, 12,  2,  0, 88,  1,254,  1, 14,  0,254,  1,  0,  0,254,  1,  1,  0, 14,  0,121, 12, 14,  0,122, 12,
+ 14,  0,123, 12,  0,  0,172,  5,  4,  0, 32,  0,  4,  0, 18,  0,  4,  0,124, 12,  7,  0,125, 12,  4,  0,113, 12,  4,  0,253,  9,
+  7,  0, 84,  4,  7,  0,  5,  3,204,  1, 23,  0,  4,  0,111, 12,  4,  0,126, 12,  7,  0,127, 12,  7,  0,  1,  3,  7,  0,128, 12,
+  7,  0,229,  8,  7,  0,119, 12,  7,  0,129, 12,  7,  0,209,  2,  7,  0,247, 10,  7,  0,217,  4,  7,  0,130, 12,  7,  0,131, 12,
+  7,  0,132, 12,  7,  0,133, 12,  7,  0,134, 12,  7,  0,135, 12,  7,  0,136, 12,  7,  0,137, 12,  7,  0,138, 12,  7,  0,139, 12,
+  7,  0,140, 12, 14,  0,141, 12,123,  0, 40,  0,122,  0,142, 12,255,  1, 73, 11, 64,  0,143, 12, 64,  0,160, 11, 64,  0,144, 12,
+  0,  2,145, 12, 43,  0,170,  0, 43,  0,146, 12, 43,  0,147, 12,  7,  0,148, 12,  7,  0,149, 12,  7,  0,150, 12,  7,  0,151, 12,
+  7,  0,152, 12,  7,  0,118,  8,  7,  0,153, 12,  7,  0,179,  1,  7,  0,154, 12,  4,  0,155, 12,  4,  0,156, 12,  4,  0,157, 12,
+  4,  0, 93,  0,  4,  0, 27,  0,  4,  0,158, 12,  2,  0,159, 12,  2,  0,160, 12,  4,  0,161, 12,  7,  0,209,  2,  4,  0,162, 12,
+  7,  0,163, 12,  4,  0,164, 12,  4,  0,165, 12,  4,  0,166, 12,139,  0,167, 12, 14,  0,168, 12,187,  0,154,  4,  4,  0,169, 12,
+  7,  0,170, 12,  7,  0,171, 12,  4,  0, 30,  0,124,  0, 12,  0,122,  0,142, 12,150,  0, 56,  3,  7,  0,144,  1,  7,  0,118,  8,
+  7,  0,172, 12,  7,  0,173, 12,  7,  0,174, 12,  2,  0,175, 12,  2,  0,176, 12,  2,  0,177, 12,  2,  0, 16,  0,  4,  0, 93,  0,
+125,  0, 13,  0,122,  0,142, 12,141,  0, 33,  3,143,  0, 35,  3,  7,  0,192,  9,  7,  0,178, 12,  7,  0,179, 12,  7,  0, 80,  1,
+  7,  0,180, 12,  4,  0, 33, 10,  4,  0, 29,  3,  2,  0, 16,  0,  2,  0, 27,  0,  4,  0, 30,  0,  1,  2, 15,  0, 22,  0, 32,  0,
+ 34,  0, 75,  0, 46,  1,227,  8,  7,  0,181, 12,  7,  0,182, 12,  7,  0,183, 12,  7,  0,184, 12,  7,  0,148,  9,  7,  0,185, 12,
+  7,  0,186, 12,  7,  0,187, 12,  7,  0, 84,  4,  7,  0,229,  8,  2,  0, 18,  0,  2,  0,112,  9,231,  0,  3,  0,  4,  0,127,  0,
+  2,  0,215,  6,  2,  0,188, 12,  2,  2,  5,  0,  0,  0,193,  8,  2,  0,194,  8,  2,  0, 72,  5,  2,  0,189, 12,  2,  0,190, 12,
+229,  0, 16,  0, 22,  0, 32,  0, 34,  0, 75,  0,  0,  0, 35,  0,  4,  0,144,  0,  4,  0,145,  0,  4,  0,191, 12,  7,  0,163,  0,
+  7,  0,164,  0, 44,  0,139,  0,  3,  2,150,  9,178,  0,182,  3,  4,  2,192, 12, 11,  0,193, 12,  2,  2,194, 12,  4,  0, 18,  0,
+  4,  0, 22,  0, 13,  1, 10,  0,  4,  0,133,  0,  4,  0,195, 12, 52,  0,196, 12,  7,  0,197, 12,  2,  0,198, 12,  0,  0,181,  2,
+  4,  0,127,  0,  5,  2,175,  3,  6,  2,199, 12,  7,  0,200, 12,  7,  2,  3,  0,  4,  0,127,  0,  7,  0,201, 12,  7,  0, 80,  1,
+  8,  2, 11,  0, 11,  0,202, 12,  7,  0,203, 12,  7,  0,204, 12,  7,  0, 27,  0,  7,  0,205, 12,  2,  0,206, 12,  2,  0, 92,  0,
+  7,  0,207, 12,  7,  0,208, 12,  7,  0,209, 12,  7,  0,210, 12,  6,  2,  3,  0,  7,  0,211, 12,  4,  0,127,  0,  4,  0, 18,  0,
+  5,  2, 24,  0,  5,  2,  0,  0,  5,  2,  1,  0,  0,  0, 19,  0,  7,  0,212, 12,  7,  0,213, 12,  7,  0,214, 12,  7,  0,215, 12,
+  7,  0,  5, 11,  4,  0,216, 12,  4,  0,217, 12,  6,  2,218, 12,  7,  0,219, 12,  7,  0,201, 12,  4,  0, 18,  0,  4,  0,220, 12,
+  4,  0,221, 12,  7,  0, 84, 12,  2,  0,222, 12,  2,  0,227,  3,  2,  0,223, 12,  2,  0,224, 12,  2,  0,225, 12,  2,  0, 30,  0,
+  7,  0,226, 12,  9,  2, 22,  0,  4,  0, 18,  0,  2,  0,227, 12,  2,  0,228, 12,  7,  0,229, 12,  2,  0,230, 12,  2,  0,231, 12,
+  2,  0,232, 12,  2,  0,233, 12,  2,  0,234, 12,  2,  0,235, 12,  2,  0,236, 12,  2,  0,  3,  3,  4,  0,237, 12,  4,  0,238, 12,
+  2,  0,239, 12,  2,  0,240, 12,  7,  0, 95,  1,  4,  0,241, 12,  4,  0,242, 12,  7,  0,243, 12,  7,  0,244, 12,  4,  0, 74,  0,
+ 10,  2, 12,  0,  4,  0, 18,  0,  4,  0,245, 12,  4,  0,246, 12,  7,  0,247, 12,  5,  2,248, 12,  7,  0,249, 12,  7,  0,250, 12,
+  7,  0,251, 12,  4,  0,191,  1,  4,  0,133,  0,  7,  0,148,  3, 52,  0,252, 12, 11,  2,  5,  0,  4,  0, 18,  0,  7,  0,201, 12,
+  4,  0,253, 12,  4,  0,254, 12,  7,  2,255, 12, 12,  2,  7,  0, 12,  2,  0,  0, 12,  2,  1,  0,  0,  0, 19,  0,  4,  0, 18,  0,
+  7,  0,148,  3, 14,  0,  0, 13, 11,  2,  1, 13, 13,  2,  1,  0,  0,  0,  2, 13,  4,  2, 10,  0,  9,  2,  3, 13,  8,  2,  4, 13,
+ 14,  0,  0, 13, 11,  2,  1, 13, 10,  2,  5, 13,  5,  2,  6, 13, 14,  0,  7, 13,  4,  0,  8, 13,  4,  0,  9, 13, 13,  2, 90,  6,
+ 14,  2, 48,  0, 14,  2,  0,  0, 14,  2,  1,  0,169,  0,145,  3, 15,  2,  2,  0, 64,  0, 10, 13,187,  0,154,  4,139,  0,153,  4,
+ 14,  0, 21,  3,  4,  0, 11, 13,  0,  0, 19,  0,  2,  0,162, 10,  2,  0, 16,  0,  2,  0, 12, 13,  2,  0, 13, 13,  2,  0, 14, 13,
+  2,  0, 15, 13,  2,  0, 16, 13,  2,  0, 17, 13,  4,  0, 93,  0,  4,  0,186,  3,  4,  0, 18, 13,  4,  0, 19, 13,  4,  0,193,  9,
+  4,  0,194,  9,  4,  0, 27,  0,  7,  0, 20, 13, 47,  0, 21, 13,  0,  0, 22, 13,  4,  0, 23, 13,  4,  0,161, 12,  7,  0, 24, 13,
+  7,  0, 25, 13,  7,  0, 26, 13,  7,  0, 27, 13,  7,  0, 28, 13,  7,  0, 29, 13,  7,  0, 30, 13,  7,  0, 31, 13,  7,  0, 32, 13,
+  7,  0, 33, 13,  7,  0, 34, 13,  7,  0, 35, 13,  7,  0, 36, 13,  7,  0, 37, 13,  0,  0,202,  2,  0,  0, 38, 13,  0,  0, 39, 13,
+  0,  0, 40, 13,169,  0,  7,  0,168,  0, 41, 13,143,  0, 35,  3, 14,  0, 42, 13,  2,  0, 43, 13,  2,  0, 93,  0,  4,  0, 27,  0,
+  0,  0, 44, 13,170,  0, 24,  0,168,  0, 41, 13,143,  0, 35,  3,150,  0, 56,  3, 63,  0, 26,  2,  4,  0, 93,  0,  4,  0, 45, 13,
+  7,  0,186,  0,  7,  0,187,  0,  7,  0,188,  0,  7,  0,179,  1,  7,  0, 46, 13,  7,  0, 47, 13,  7,  0, 48, 13,  7,  0, 49, 13,
+ 50,  0, 50, 13, 50,  0, 51, 13,  2,  0, 52, 13,  2,  0,222, 10,  2,  0, 53, 13,  2,  0, 27,  0,  7,  0, 54, 13,  7,  0, 55, 13,
+  7,  0, 56, 13,  7,  0, 57, 13, 69, 78, 68, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
   0};
 
diff --git a/source/blender/editors/datafiles/splash.png.c b/source/blender/editors/datafiles/splash.png.c
index 0b313dc..2c4d6b0 100644
--- a/source/blender/editors/datafiles/splash.png.c
+++ b/source/blender/editors/datafiles/splash.png.c
@@ -1,5898 +1,7181 @@
 /* DataToC output of file <splash_png> */
 
-int datatoc_splash_png_size= 188517;
-char datatoc_splash_png[]= {
-137, 80, 78, 71, 13,
- 10, 26, 10,  0,  0,  0, 13, 73, 72, 68, 82,  0,  0,  1,245,  0,  0,  1, 26,  8,  6,  0,  0,  0,  8, 90,206, 70,  0,  0, 10, 79,
-105, 67, 67, 80, 80,104,111,116,111,115,104,111,112, 32, 73, 67, 67, 32,112,114,111,102,105,108,101,  0,  0,120,218,157, 83,103,
- 84, 83,233, 22, 61,247,222,244, 66, 75,136,128,148, 75,111, 82, 21,  8, 32, 82, 66,139,128, 20,145, 38, 42, 33,  9, 16, 74,136,
- 33,161,217, 21, 81,193, 17, 69, 69,  4, 27,200,160,136,  3,142,142,128,140, 21, 81, 44, 12,138, 10,216,  7,228, 33,162,142,131,
-163,136,138,202,251,225,123,163,107,214,188,247,230,205,254,181,215, 62,231,172,243,157,179,207,  7,192,  8, 12,150, 72, 51, 81,
- 53,128, 12,169, 66, 30, 17,224,131,199,196,198,225,228, 46, 64,129, 10, 36,112,  0, 16,  8,179,100, 33,115,253, 35,  1,  0,248,
-126, 60, 60, 43, 34,192,  7,190,  0,  1,120,211, 11,  8,  0,192, 77,155,192, 48, 28,135,255, 15,234, 66,153, 92,  1,128,132,  1,
-192,116,145, 56, 75,  8,128, 20,  0, 64,122,142, 66,166,  0, 64, 70,  1,128,157,152, 38, 83,  0,160,  4,  0, 96,203, 99, 98,227,
-  0, 80, 45,  0, 96, 39,127,230,211,  0,128,157,248,153,123,  1,  0, 91,148, 33, 21,  1,160,145,  0, 32, 19,101,136, 68,  0,104,
- 59,  0,172,207, 86,138, 69,  0, 88, 48,  0, 20,102, 75,196, 57,  0,216, 45,  0, 48, 73, 87,102, 72,  0,176,183,  0,192,206, 16,
- 11,178,  0,  8, 12,  0, 48, 81,136,133, 41,  0,  4,123,  0, 96,200, 35, 35,120,  0,132,153,  0, 20, 70,242, 87, 60,241, 43,174,
- 16,231, 42,  0,  0,120,153,178, 60,185, 36, 57, 69,129, 91,  8, 45,113,  7, 87, 87, 46, 30, 40,206, 73, 23, 43, 20, 54, 97,  2,
- 97,154, 64, 46,194,121,153, 25, 50,129, 52, 15,224,243,204,  0,  0,160,145, 21, 17,224,131,243,253,120,206, 14,174,206,206, 54,
-142,182, 14, 95, 45,234,191,  6,255, 34, 98, 98,227,254,229,207,171,112, 64,  0,  0,225,116,126,209,254, 44, 47,179, 26,128, 59,
-  6,128,109,254,162, 37,238,  4,104, 94, 11,160,117,247,139,102,178, 15, 64,181,  0,160,233,218, 87,243,112,248,126, 60, 60, 69,
-161,144,185,217,217,229,228,228,216, 74,196, 66, 91, 97,202, 87,125,254,103,194, 95,192, 87,253,108,249,126, 60,252,247,245,224,
-190,226, 36,129, 50, 93,129, 71,  4,248,224,194,204,244, 76,165, 28,207,146,  9,132, 98,220,230,143, 71,252,183, 11,255,252, 29,
-211, 34,196, 73, 98,185, 88, 42, 20,227, 81, 18,113,142, 68,154,140,243, 50,165, 34,137, 66,146, 41,197, 37,210,255,100,226,223,
- 44,251,  3, 62,223, 53,  0,176,106, 62,  1,123,145, 45,168, 93, 99,  3,246, 75, 39, 16, 88,116,192,226,247,  0,  0,242,187,111,
-193,212, 40,  8,  3,128,104,131,225,207,119,255,239, 63,253, 71,160, 37,  0,128,102, 73,146,113,  0,  0, 94, 68, 36, 46, 84,202,
-179, 63,199,  8,  0,  0, 68,160,129, 42,176, 65, 27,244,193, 24, 44,192,  6, 28,193,  5,220,193, 11,252, 96, 54,132, 66, 36,196,
-194, 66, 16, 66, 10,100,128, 28,114, 96, 41,172,130, 66, 40,134,205,176, 29, 42, 96, 47,212, 64, 29, 52,192, 81,104,134,147,112,
- 14, 46,194, 85,184, 14, 61,112, 15,250, 97,  8,158,193, 40,188,129,  9,  4, 65,200,  8, 19, 97, 33,218,136,  1, 98,138, 88, 35,
-142,  8, 23,153,133,248, 33,193, 72,  4, 18,139, 36, 32,201,136, 20, 81, 34, 75,145, 53, 72, 49, 82,138, 84, 32, 85, 72, 29,242,
- 61,114,  2, 57,135, 92, 70,186,145, 59,200,  0, 50,130,252,134,188, 71, 49,148,129,178, 81, 61,212, 12,181, 67,185,168, 55, 26,
-132, 70,162, 11,208,100,116, 49,154,143, 22,160,155,208,114,180, 26, 61,140, 54,161,231,208,171,104, 15,218,143, 62, 67,199, 48,
-192,232, 24,  7, 51,196,108, 48, 46,198,195, 66,177, 56, 44,  9,147, 99,203,177, 34,172, 12,171,198, 26,176, 86,172,  3,187,137,
-245, 99,207,177,119,  4, 18,129, 69,192,  9, 54,  4,119, 66, 32, 97, 30, 65, 72, 88, 76, 88, 78,216, 72,168, 32, 28, 36, 52, 17,
-218,  9, 55,  9,  3,132, 81,194, 39, 34,147,168, 75,180, 38,186, 17,249,196, 24, 98, 50, 49,135, 88, 72, 44, 35,214, 18,143, 19,
- 47, 16,123,136, 67,196, 55, 36, 18,137, 67, 50, 39,185,144,  2, 73,177,164, 84,210, 18,210, 70,210,110, 82, 35,233, 44,169,155,
- 52, 72, 26, 35,147,201,218,100,107,178,  7, 57,148, 44, 32, 43,200,133,228,157,228,195,228, 51,228, 27,228, 33,242, 91, 10,157,
- 98, 64,113,164,248, 83,226, 40, 82,202,106, 74, 25,229, 16,229, 52,229,  6,101,152, 50, 65, 85,163,154, 82,221,168,161, 84, 17,
- 53,143, 90, 66,173,161,182, 82,175, 81,135,168, 19, 52,117,154, 57,205,131, 22, 73, 75,165,173,162,149,211, 26,104, 23,104,247,
-105,175,232,116,186, 17,221,149, 30, 78,151,208, 87,210,203,233, 71,232,151,232,  3,244,119, 12, 13,134, 21,131,199,136,103, 40,
- 25,155, 24,  7, 24,103, 25,119, 24,175,152, 76,166, 25,211,139, 25,199, 84, 48, 55, 49,235,152,231,153, 15,153,111, 85, 88, 42,
-182, 42,124, 21,145,202, 10,149, 74,149, 38,149, 27, 42, 47, 84,169,170,166,170,222,170, 11, 85,243, 85,203, 84,143,169, 94, 83,
-125,174, 70, 85, 51, 83,227,169,  9,212,150,171, 85,170,157, 80,235, 83, 27, 83,103,169, 59,168,135,170,103,168,111, 84, 63,164,
-126, 89,253,137,  6, 89,195, 76,195, 79, 67,164, 81,160,177, 95,227,188,198, 32, 11, 99, 25,179,120, 44, 33,107, 13,171,134,117,
-129, 53,196, 38,177,205,217,124,118, 42,187,152,253, 29,187,139, 61,170,169,161, 57, 67, 51, 74, 51, 87,179, 82,243,148,102, 63,
-  7,227,152,113,248,156,116, 78,  9,231, 40,167,151,243,126,138,222, 20,239, 41,226, 41, 27,166, 52, 76,185, 49,101, 92,107,170,
-150,151,150, 88,171, 72,171, 81,171, 71,235,189, 54,174,237,167,157,166,189, 69,187, 89,251,129, 14, 65,199, 74, 39, 92, 39, 71,
-103,143,206,  5,157,231, 83,217, 83,221,167, 10,167, 22, 77, 61, 58,245,174, 46,170,107,165, 27,161,187, 68,119,191,110,167,238,
-152,158,190, 94,128,158, 76,111,167,222,121,189,231,250, 28,125, 47,253, 84,253,109,250,167,245, 71, 12, 88,  6,179, 12, 36,  6,
-219, 12,206, 24, 60,197, 53,113,111, 60, 29, 47,199,219,241, 81, 67, 93,195, 64, 67,165, 97,149, 97,151,225,132,145,185,209, 60,
-163,213, 70,141, 70, 15,140,105,198, 92,227, 36,227,109,198,109,198,163, 38,  6, 38, 33, 38, 75, 77,234, 77,238,154, 82, 77,185,
-166, 41,166, 59, 76, 59, 76,199,205,204,205,162,205,214,153, 53,155, 61, 49,215, 50,231,155,231,155,215,155,223,183, 96, 90,120,
- 90, 44,182,168,182,184,101, 73,178,228, 90,166, 89,238,182,188,110,133, 90, 57, 89,165, 88, 85, 90, 93,179, 70,173,157,173, 37,
-214,187,173,187,167, 17,167,185, 78,147, 78,171,158,214,103,195,176,241,182,201,182,169,183, 25,176,229,216,  6,219,174,182,109,
-182,125, 97,103, 98, 23,103,183,197,174,195,238,147,189,147,125,186,125,141,253, 61,  7, 13,135,217, 14,171, 29, 90, 29,126,115,
-180,114, 20, 58, 86, 58,222,154,206,156,238, 63,125,197,244,150,233, 47,103, 88,207, 16,207,216, 51,227,182, 19,203, 41,196,105,
-157, 83,155,211, 71,103, 23,103,185,115,131,243,136,139,137, 75,130,203, 46,151, 62, 46,155, 27,198,221,200,189,228, 74,116,245,
-113, 93,225,122,210,245,157,155,179,155,194,237,168,219,175,238, 54,238,105,238,135,220,159,204, 52,159, 41,158, 89, 51,115,208,
-195,200, 67,224, 81,229,209, 63, 11,159,149, 48,107,223,172,126, 79, 67, 79,129,103,181,231, 35, 47, 99, 47,145, 87,173,215,176,
-183,165,119,170,247, 97,239, 23, 62,246, 62,114,159,227, 62,227, 60, 55,222, 50,222, 89, 95,204, 55,192,183,200,183,203, 79,195,
-111,158, 95,133,223, 67,127, 35,255,100,255,122,255,209,  0,167,128, 37,  1,103,  3,137,129, 65,129, 91,  2,251,248,122,124, 33,
-191,142, 63, 58,219,101,246,178,217,237, 65,140,160,185, 65, 21, 65,143,130,173,130,229,193,173, 33,104,200,236,144,173, 33,247,
-231,152,206,145,206,105, 14,133, 80,126,232,214,208,  7, 97,230, 97,139,195,126, 12, 39,133,135,133, 87,134, 63,142,112,136, 88,
- 26,209, 49,151, 53,119,209,220, 67,115,223, 68,250, 68,150, 68,222,155,103, 49, 79, 57,175, 45, 74, 53, 42, 62,170, 46,106, 60,
-218, 55,186, 52,186, 63,198, 46,102, 89,204,213, 88,157, 88, 73,108, 75, 28, 57, 46, 42,174, 54,110,108,190,223,252,237,243,135,
-226,157,226, 11,227,123, 23,152, 47,200, 93,112,121,161,206,194,244,133,167, 22,169, 46, 18, 44, 58,150, 64, 76,136, 78, 56,148,
-240, 65, 16, 42,168, 22,140, 37,242, 19,119, 37,142, 10,121,194, 29,194,103, 34, 47,209, 54,209,136,216, 67, 92, 42, 30, 78,242,
- 72, 42, 77,122,146,236,145,188, 53,121, 36,197, 51,165, 44,229,185,132, 39,169,144,188, 76, 13, 76,221,155, 58,158, 22,154,118,
- 32,109, 50, 61, 58,189, 49,131,146,145,144,113, 66,170, 33, 77,147,182,103,234,103,230,102,118,203,172,101,133,178,254,197,110,
-139,183, 47, 30,149,  7,201,107,179,144,172,  5, 89, 45, 10,182, 66,166,232, 84, 90, 40,215, 42,  7,178,103,101, 87,102,191,205,
-137,202, 57,150,171,158, 43,205,237,204,179,202,219,144, 55,156,239,159,255,237, 18,194, 18,225,146,182,165,134, 75, 87, 45, 29,
- 88,230,189,172,106, 57,178, 60,113,121,219, 10,227, 21,  5, 43,134, 86,  6,172, 60,184,138,182, 42,109,213, 79,171,237, 87,151,
-174,126,189, 38,122, 77,107,129, 94,193,202,130,193,181,  1,107,235, 11, 85, 10,229,133,125,235,220,215,237, 93, 79, 88, 47, 89,
-223,181, 97,250,134,157, 27, 62, 21,137,138,174, 20,219, 23,151, 21,127,216, 40,220,120,229, 27,135,111,202,191,153,220,148,180,
-169,171,196,185,100,207,102,210,102,233,230,222, 45,158, 91, 14,150,170,151,230,151, 14,110, 13,217,218,180, 13,223, 86,180,237,
-245,246, 69,219, 47,151,205, 40,219,187,131,182, 67,185,163,191, 60,184,188,101,167,201,206,205, 59, 63, 84,164, 84,244, 84,250,
- 84, 54,238,210,221,181, 97,215,248,110,209,238, 27,123,188,246, 52,236,213,219, 91,188,247,253, 62,201,190,219, 85,  1, 85, 77,
-213,102,213,101,251, 73,251,179,247, 63,174,137,170,233,248,150,251,109, 93,173, 78,109,113,237,199,  3,210,  3,253,  7, 35, 14,
-182,215,185,212,213, 29,210, 61, 84, 82,143,214, 43,235, 71, 14,199, 31,190,254,157,239,119, 45, 13, 54, 13, 85,141,156,198,226,
- 35,112, 68,121,228,233,247,  9,223,247, 30, 13, 58,218,118,140,123,172,225,  7,211, 31,118, 29,103, 29, 47,106, 66,154,242,154,
- 70,155, 83,154,251, 91, 98, 91,186, 79,204, 62,209,214,234,222,122,252, 71,219, 31, 15,156, 52, 60, 89,121, 74,243, 84,201,105,
-218,233,130,211,147,103,242,207,140,157,149,157,125,126, 46,249,220, 96,219,162,182,123,231, 99,206,223,106, 15,111,239,186, 16,
-116,225,210, 69,255,139,231, 59,188, 59,206, 92,242,184,116,242,178,219,229, 19, 87,184, 87,154,175, 58, 95,109,234,116,234, 60,
-254,147,211, 79,199,187,156,187,154,174,185, 92,107,185,238,122,189,181,123,102,247,233, 27,158, 55,206,221,244,189,121,241, 22,
-255,214,213,158, 57, 61,221,189,243,122,111,247,197,247,245,223, 22,221,126,114, 39,253,206,203,187,217,119, 39,238,173,188, 79,
-188, 95,244, 64,237, 65,217, 67,221,135,213, 63, 91,254,220,216,239,220,127,106,192,119,160,243,209,220, 71,247,  6,133,131,207,
-254,145,245,143, 15, 67,  5,143,153,143,203,134, 13,134,235,158, 56, 62, 57, 57,226, 63,114,253,233,252,167, 67,207,100,207, 38,
-158, 23,254,162,254,203,174, 23, 22, 47,126,248,213,235,215,206,209,152,209,161,151,242,151,147,191,109,124,165,253,234,192,235,
- 25,175,219,198,194,198, 30,190,201,120, 51, 49, 94,244, 86,251,237,193,119,220,119, 29,239,163,223, 15, 79,228,124, 32,127, 40,
-255,104,249,177,245, 83,208,167,251,147, 25,147,147,255,  4,  3,152,243,252, 99, 51, 45,219,  0,  0,  0,  6, 98, 75, 71, 68,  0,
-  0,  0,  0,  0,  0,249, 67,187,127,  0,  0,  0,  9,112, 72, 89,115,  0,  0, 11, 19,  0,  0, 11, 19,  1,  0,154,156, 24,  0,  0,
-  0,  7,116, 73, 77, 69,  7,220,  2, 15, 16, 38, 41, 22,193,141,250,  0,  0, 32,  0, 73, 68, 65, 84,120,218,236,189,121,220,101,
- 87, 85,231,253, 93,123,159, 59, 60,207, 83,115, 85,170, 50,146,137,132,132, 81,  8,208, 54, 40, 70,  9, 32, 40, 42, 72,130,208,
-138, 10, 10,221, 14,221,106, 55,130,173,253,170,175,162,  4,  7,212, 87,232, 38,109,191,190,106,171, 40,210, 14,216, 56, 16, 20,
- 25, 84,196,200, 76,152, 50, 48,101,170,212,252, 12,247,222,115,246, 94,239, 31,123,237,115,246,189,169, 74, 42, 69,134,170,244,
- 89,245,121, 62,245, 12,247,158,123,134,189,247,111,173,223,250,173,181,161,183,222,122,235,173,183,222,122,235,173,183,222,122,
-235,173,183,222,122,235,173,183,222,122,235,173,183,222,122,235,173,183,222,122,235,173,183,222,122,235,173,183,222,122,235,173,
-183,222,122,235,173,183,222,122,235,173,183,222,122,235,173,183,222,122,235,173,183,222, 30, 16,243, 15,240,231,137,125,141,129,
- 11,156,227, 52, 85,214,129,218,126,223, 91,111,189,245,214, 91,111,189,157,  2, 38,128,115, 78, 30,254,227, 87, 62,238,205, 31,
-250,197,111,185,227, 99,191,242,188,125, 63,247,237, 79,248,211, 97,229, 46, 43, 94,211, 91,111,189,245,214, 91,111,189,157,228,
-145,186,  0,195,239,123,246, 35, 94,243,139, 47,184,228, 37,123,234,141,149,211,182,172, 44,125,245,191,186,232, 17, 95,117,201,
-105, 87,188,247,250,219,110, 59,176, 58,251, 52,160, 61,184,247,214, 91,111,189,245,214,219,201, 13,234, 14, 88,254,154,243,150,
-190,245,153,187,155, 71,111,236,221, 79,125, 96, 31,205,198,148,139, 47, 62,119,251, 11,190,234,194,231,126,234, 75,  7,252,103,
-110, 57,252, 97, 96,163,  7,246,222,122,235,173,183,222,122, 59,185, 35,245,209,251,111, 62,124,219,206,173,195,199, 62,245,194,
- 45,167,107,163,132, 35,135,105,142, 28, 97,251,238,221,213,139,158,254,200,175,  9,177,185,232,189,159,184,237,131,192,190, 30,
-216,123,235,173,183,222,122,235,237,228,  4,117,  0, 81,229,200,219, 63,113,232, 67,183,111,132,157,207,184,116,219,197, 99, 95,
- 81,111,108, 16, 14,238,135,209, 50,207,120,234, 35, 47,125,236,185, 91, 47,255,187,143,221,114,243,234,164,185,177,127, 68,189,
-245,214, 91,111,189,245,118,252,209,243,  3,253,121, 99, 96, 43,112,246, 87, 61,124,243,119,254,207, 23, 93,240, 61,231, 46, 85,
-227,245,245, 26,188,199,157,121, 30,227,115,206,225,134, 91,246, 29,126,197,175,191,235,231,223,249,161, 47,189, 17, 56, 98,239,
-215,147,249,102,170,234,101,192,118,251,241, 70, 17,121, 72, 59, 37,255,167, 93,111,111,189,245,214, 91, 15,234, 71, 55,  7,108,
-  1,246,156,190,165,250,166, 63,248,206, 11,127,228,171, 78, 95, 57,125,178, 17,128,136,236, 57,155,165,135,157,207, 76, 35,255,
-233, 55,223,247,219,255,207,159,126,244, 39,128, 47,216,249,126,217,192,174,170, 23,  0, 23, 28,231,203, 15,136,200,117,199,121,
-220,119,  0, 87,216,143,175, 22,145,171, 31,226,160,254,127,212,245,246,214, 91,111,189,157,236, 86,125, 25,160, 28,129,205, 59,
- 55, 13, 30,179,115,165,218, 25, 85,100,206, 83, 16, 16, 17,209,252, 27,201,191,111,255, 90,  1,203,117,208,141, 31,126,251, 29,
-127,249, 43,223,114,206,183, 60,101,247,202,182, 89,173,112, 96, 31,147,229, 77, 12,118,238,225,215, 94,113,249, 75, 46,123,248,
-158, 71,252,208,155,222,253,202,131,171,179,247,222, 71,192,126, 37,240,218,123,  1, 94,  0,111,  1,174, 21,145,107,250, 97,243,
-144,117, 82, 60,240,175,128,175,  3,158,  4, 60, 10,216,  3,140,128,131,192,231,128,127,  4,126, 79, 68,254,225,126, 58,135, 39,
-  3, 87,  1, 95, 11,156,  5,236,  4,214,237,179, 63,  2,188,  7,120,187,136,124,225,100,189,134,222,122,235,237,212,138,212,  5,
-112, 43, 35,255, 21, 63,251,236,115,127,238, 69,143,219,125,249,214,165,193, 48,138, 75,128,237, 92,250, 18, 65, 42, 63,247, 51,
-206, 33,222,119, 63, 75,250, 91, 68,180, 86,137,227,170,242,148,199,241, 30,135, 48, 88, 25,243,145,155,110,223,251,178,215, 95,
-251,147,255,252,233,189,191,  9, 76,191, 28, 96, 87,213, 87,221, 27, 80, 95,176,107,129,171, 68,228, 64, 31,169, 63,116,174, 87,
- 85,255, 43,240,124, 96,247,113,190,229, 93,192, 75, 69,228,166,251,232,243,207,  2,222,  0,124,243,113,188,252,157, 34,114,197,
-201,118, 13,189,245,214,219,169, 27,169,159,246,186,231,158,255,250,239,123,202, 89, 95, 61, 91,143,104, 20,188,147, 20,192,171,
-164, 47, 28, 18, 37, 65,175,  2, 78, 82,108, 31, 21, 60,136, 72,138,247, 21,188,136, 84, 78,188, 69,196,  9,212, 21, 80, 37,138,
- 48, 93,159,241,216,115,119,159,246,142,159,123,254,175,127,223, 27,255,246,162,223,255,155, 79,255, 60,176,247, 62,138,218, 51,
- 80, 31,203,174, 56,202,207,239, 80,213,103, 28, 13,216,123, 59,101,237,223, 30,229,119,251, 44,178, 61,104, 17,243,163,233,196,
-165,151,  3,255,172,170, 95, 35, 34, 31,251, 50,  1,253, 81,  6,176,187,138, 95, 31,  2,110,  4, 14,  0,155,129,139, 73, 90,148,
-147,242, 26,122,235,173,183, 83, 23,212,101, 52,112, 23,124,227,165,219,159,164,107, 53,245,100, 10, 49, 38,144,110,153,117,131,
- 91,145, 14,119,189,195,237,220,109,224, 30, 17,  7, 68, 99,241,  5, 90,132,119, 49,  1,191,115, 16,108,249, 17,152, 77,107,182,
- 14,135,238,247,126,244, 57, 63,252,164, 71,156,254,152, 31,251,141,247,253,232,180, 14, 31,186, 47,128, 93, 68,158,113, 15,139,
-110,166,235,115, 30,254, 50,224,229, 64,159, 67,126,232,217, 39,129,223,  4,254, 92, 68, 62,177, 48, 14,118,  0,255, 17,120,149,
-141,204, 29,192,219, 84,245, 82, 17,153,156, 32,160,159, 15,188,179,  0,244, 15,  2, 63,102,209,120,179,240,218, 71,  3,207,  3,
-206, 63,153,174,161,183,222,122, 59,121,204,157,192,123,252,172,142,251,222,252,145,189,239, 23, 55,101,101, 24, 88, 89,130,229,
-177,218, 87,236,190, 31, 69,198,110,  6,161, 70, 70,203,  9,228, 99,132, 24,105,163,114,  0,102, 16, 39, 16, 55, 64, 39,192, 52,
-253,172, 51,123,189,162, 26,169, 67,164,153,  6,126,248, 91,159,116,197, 59, 94,247,173,127,114,222,158, 45,207,183,133,201,221,
-159, 55, 73, 68,222,  2, 60,195,162,166,108, 87,246,195,231, 33,101,239,  7,158, 35, 34,151,138,200,235, 22,193,208,198,193,126,
- 17,249,113,224, 37,197,175,207, 59, 70,132,124,188,246,223, 73, 57,111,128, 63,  0,158, 36, 34,127,181,  8,232,246,249, 31, 19,
-145,159, 17,145,151,158,100,215,208, 91,111,189,157, 36,118, 34, 57,245,  1,137,  6,124,212,215, 92,184,233,249,151,158,190,116,
-174,128,139,170, 49, 31, 50,106,130,236,245, 89,116,143,127,216,230, 71,126,239,211, 30,126,193,184, 26,187,  8,144,115,234,  8,
- 52,235,136, 23,220, 57,143,195,157,246,112,100,203,233,200,120, 11, 52, 83,226,218, 94,244,200,173,196,189,159,134,102,  2,126,
-201,114,237, 30,193, 49, 92, 25,241,233, 91,246, 29,250,250, 87,255,175,151,223,116,235,161,183, 90,180, 30,143, 51, 58,154,203,
-169,139,136, 28,231,251,222,100, 17,250, 81,223,119, 34, 57,102, 85,221,110,145,127,182,235,238, 11, 90,127, 65,225,127, 66,229,
-102,247,116,140,147,229,122, 23,206,243,186,  7, 34, 45,162,170,127,  9, 60,203,126,124,143,136, 60,237,  4,142,241, 34,224,247,
-236,199,143,  3,143, 23,145,250,129,154,252,247,197, 53,244,214, 91,111, 39,151,157,  8,253, 30,128, 53,224,250,191,187, 97,245,
-245,127,119,195,234, 18, 71,111, 98,179,243,217,143,221,253,178,231, 63,241,252, 51,150,221,208, 53, 81, 19,245, 62,153,160,211,
- 53,  8,107,248,139,191,154,234,137, 47,198,159,255,149,199,164, 16,116,255,205, 52, 55,188,147,240,185,247, 33,126,  8,170,168,
-192,108,125,198,197,103,238,220,250, 39, 63,253,205,111,120,250, 43,255,112,255,157,135, 38,127,195,125,151, 99, 63,150,221, 39,
-117,216,  6,108, 47,183,104,255,178,163,252,253, 70,224, 26,224,154, 99,  1,148,170,190,182,120,239, 91, 68,228,154,226,184, 47,
-103,161,100,207,142,121,245,241,168,247, 85,245,229, 36,122,246,130,123,123, 94,247,199,245,222,205,181,190,202,142,187,189,120,
-249,181,198,170,220,223,246,103,  5, 32, 94,122,130,199,248,247,197,247,175,122, 32,  1,253, 62,188,134,222,122,235,237, 20,  7,
-245,  8, 76,128,134,212, 20,198,178,222,109,212,175, 34, 60,242,234, 23, 92,252, 83,175,188,252,188,203,195, 12,102, 33,160,245,
- 20,157,172, 67, 51,133, 74, 25, 61,231,199,168,158,248,162,123,166, 18,118,156,199, 96,199,203,112,167, 63,150,230,  3,191,  1,
- 46, 36,200, 23, 97,182, 94,243,216,139,206,216,245,250,127,119,249,235,190,227,181,127,249,124,224,243,247, 51,168,151,224,113,
- 66,209,160,170, 94,  1,252,225,194,177, 22,237,  2, 99, 18, 94,174,170, 87, 29,163, 78,254,178, 34, 74,190,214, 26,193,188,233,
-104,160, 89, 28,243, 77,170,122,153,136,188,226,110,192,247, 77, 28, 59,181,144,207,235, 74, 85,125,198,  3,120,189, 71,187,214,
-119,220,195, 49,239,111,219, 87,124,191,229,  4,198,193, 35,129,236,205,222,  1,252,229,169,118, 13,189,245,214,219, 67,  3,212,
- 49,224,172,237,139,  2,208,253,185,187,198,207,125,211,139, 46,185,250, 89, 23,239,186,104,186, 17,  9,161,134,233,  6, 52, 53,
-136, 34,  3, 24, 61,239,231,241,143,254,134,246, 96,135, 55,166,252,213,135,110,230,175, 62,124, 51,251, 87, 55, 24,120,225,210,
- 51,119,240, 77, 79,124, 56, 79,184,240,140,116,224,115,158,132, 12, 55, 83,191,247,151, 96, 88,165, 83,112, 66,179, 58,229,219,
-159,254,232,199,255,207,119,126,242,101,127,245,129,155, 95,195,151, 89,238,118, 15,209,230,149, 11, 17,225,189, 61,198,149,  6,
-112,165, 93,103,199,202, 78, 66, 25,205, 94, 64,167,180,191,238, 30,156,141, 63, 44, 34,235,183,216,113, 51, 32,150,231,253,114,
- 85,189,241, 24, 84,249,107,143,  2,232,229,177,242,185, 93,118,148,235,120,160,174,119,251,  2,160, 31, 40,206,239,130,  7,112,
-238,156, 87,124,191,247,  4,222, 95, 58, 69,239, 22,145,240, 32,204,255, 47,247, 26,122,235,173,183,135,  8,168,207,  5,211,  6,
-162, 91,159,253,232, 29, 63,124,205, 85,143,248,209,179, 55, 45, 45,109,172,  5, 52, 76,161,158,218, 39,121,164, 89, 99,240,212,
-239,153,  3,244,127,252,204,173,188,242,119,223,195,141,119, 30, 97, 60, 26, 48,168, 28, 78,225,195, 95,216,207, 31,253,195, 39,
-121,238, 19, 47,228,191, 92,249,213, 44,143,  6,184, 61,151, 80, 61,250, 42,154, 15,254, 38,108,222,  3,104, 74,162,171,240,211,
- 47,121,202,247,252,245, 63,223,252, 71,170,124,140,148, 34,184,175,  1,253, 77, 11,160,113,205,189, 60,198,  5,118,140,108, 55,
-  2,175, 16,145, 69,231,224,234,133,232, 54,127,246, 19,239,230,240,175, 42,  0,248, 21,139, 20,182,125,246, 31, 22,224,249, 42,
- 85,157,163,186,141,114,127,249,  2,248, 94,181,144, 71, 47,207,237,138,  7,233,122, 95, 85, 28,239,213, 38, 98, 92,124, 86, 15,
-132,189,160,248,254,253, 39,240,254, 39, 21,223,127,196,206,125, 39,240, 50, 59,246,133,192,178,129,237,191,144,168,242,223,185,
-143, 41,250, 47,247, 26,122,235,173,183,135, 24,168,103, 64, 63,255,135,190,238,172,159,121,237,179,207,251, 55, 85,172, 88,159,
-214, 16,102, 16,154,148, 71, 23, 64,  3,178,235, 28,170, 39,119,162,219,207,220,118,128,151,188,225,175,184, 99,163, 97,121,101,
-137,218,123,  6,  3,207,208, 11, 94,135, 72,104,120,235,251, 63,139,119,142,159,125,241,229, 41, 98,127,248,215, 18, 62,245,151,
- 16, 86,161, 90, 74,122,187, 89,205,227, 47,220,125,250,147, 47, 61,253, 89,239,255,196,109,215,147, 82,  4,199, 29,173,155,112,
-238, 88,118,197, 81,  0,236,104,224,116, 79,246,166,133,232,242,137,199,202, 75,139,200,181, 70,111,231,136,244, 50, 85,125,249,
- 61,228,195,175, 21,145,171,142,113,188, 27, 85,245,213,118,188, 28,237, 94, 97, 78,192, 34, 88,102,192, 60,106, 29,126,113,110,
-255,252, 32, 94,239,141,199, 58,222,  3, 36,146,123,198,130,211,241,251, 39,112,152,199, 22,223,223,170,170,207,  4,126, 11, 56,
-125,225,117,231,216,215, 55,  3, 63,174,170, 47, 20,145,127, 62, 73,174,161,183,222,122, 59,201,236,203, 41,  5, 19, 64,118,172,
- 84, 87,188,249,187, 30,241,199,175,255,198,243,254, 13, 53, 76, 99,157,202,209, 36,192,192, 65, 37, 80,  9,202, 12,127,241,211,
-144, 77, 93,127,141, 87,255,238,251,248,204, 23, 15,113,168, 17,110, 93,109,248,194,161, 25,159,189,115,131, 27,239,220,224,192,
- 36,160, 85,197,214,173,155,248,147,127,250, 12,215,126,216,154, 94,249, 10,127,193,211,208,195,123,193, 59, 16, 37, 10, 12,151,
-134,188,240,242, 71, 92, 65,202, 13,222, 91, 85,255,107,239,230,235,138,133,232,252, 25,247,182, 85,172,229,128,203,227,188,250,
-158,192,199,232,231,107, 22,156,139,187,179, 87,220,195,241,174,165,163,169, 41, 89,  7,163,201, 75, 22,226,234,187, 59,191,163,
-156,219,  3,125,189, 87, 63, 88,141,127, 84,117,235,  2,  3,241, 65,224,173, 39,112,168,157,197,247,143,179, 72, 60,  3,250, 29,
-164,118,176,255,  0, 28, 94,120,102,127,167,170, 79, 57, 73,174,161,183,222,122,123,  8,128,122, 22,197,109,250,234, 11, 55,255,
-200,251,190,255, 81,127,244,194, 75,119, 60,110,125, 61, 16,  8, 16,235,116, 84, 47,136, 23,164, 18,196, 59,164, 18,220,153,143,
-110, 15,114,211,237,  7,249,139, 15,125, 30,150,151,186, 50, 55,239,  9, 56,142, 76,  3, 55,237, 93,231,198, 59,214,169, 85,136,
-222,243,206,143,126,174, 59,129, 93, 15, 71, 55, 14,  3,141,157,141, 66, 19,185,228,236, 29, 23,  2,103,112,255,109, 84,115,165,
- 69,145,247,150,226, 45,  1,234,192,189,112, 10,174, 93,248,236, 99,217,117,199, 89,178,118,221, 49,206,233,138,  5,128, 61,158,
-243,123,203,131,116,189, 55, 62, 88,253,247, 85,213, 89, 52,157,155,191,204,128,151,181, 91, 28,220, 59, 43,187,195,253,  0,169,
- 55,251,237,164,230, 50,167,139,200,211, 68,228, 41,192,105,192,247,147,196,169,144, 40,249, 55,171,234,150,147,224, 26,122,235,
-173,183,147,204,238, 45,253,158,233,246, 51, 95,250,149,167,253,212, 27,159,123,238,247, 14,162,103,125, 22,193, 43,104, 68, 20,
- 36, 10,234,197,168,247,244, 22,169,134,184,237, 15,107, 15,116,243,222,195,108,172,215,176,101,212,249,  9,121, 89,113, 14, 84,
- 57,184, 90, 83,207, 26,206,222, 90,113,100,210,165, 18,101,243, 30,192,195,116, 29, 89,218,140,162,208, 52,156,191,103,243,238,
-209,208,159, 62,157,133,235,239,229,117,189,250,110,254,118,129,129,212,  5, 36,106,184, 85,127,223,139,104,241,138, 99,  0, 43,
-247, 20, 93,151, 77,122, 76,185,126,221, 61,128,225,221,217,141,119,115,141,247,234, 88,139,231,246,  0, 94,239,117, 15,226,124,
-249, 37,230,123,179,191, 82, 68, 62,120,130,199, 26, 47,252,188,  6,124,173,136, 92,191,112, 79,102,192, 27, 85,245,115,192,159,
-219,175,207,  1,254, 29, 39,214,209,240,190,188,134,222,122,235,237, 20,  6,117,  1,216, 60,246, 79,249,133,111, 56,251,117,175,
-184,236,180,167,206,102, 48, 25,164,150,175, 26, 20,169, 35,195,161,227, 80,  8,113,  9,231,168,124, 91,193, 46,  0,218, 53,201,
-218,189,117, 25, 63, 28, 16, 34,214, 47, 94, 13,212,237,127, 21,240,142,181,245,154,207, 77, 38,140, 30, 87,156,170,  6,208, 58,
- 53,165,113, 91, 16,141,104,140,236, 88, 25, 44,111, 93, 30,110,191, 99,182,113,175, 24,136,227,108,154,242, 42, 82,222, 57, 55,
- 79,121,  7,119, 47, 94, 43,173, 44, 51,187,192,154,182,156,136, 29,139, 33,248,114,169,232, 19,  2, 97,123,237,101, 15,240,245,
- 62, 40,160,174,170,255, 23,240, 67,197,175,222, 32, 34,191,246,101, 28,114,157,212,211, 61,219,213,139,128,190, 48, 70,255,183,
-170,190,165, 96, 48,190,251,222,130,250,253,112, 13,189,245,214,219, 41,  8,234,153,202, 30, 92,178,103,252,226,223,125,225,249,
- 87, 63, 97,247,242,238,141, 89,132, 81,149,  0,189,142, 84,117,100,184,228,249,241,119,126,233,195,231,110, 27,110,251,222,203,
- 78, 59,119,162, 32, 57, 90,175,107,226,157,159,197,157,147, 68,191,151,158,181,147,127,117,209,110,254,254,250,189, 80, 85,  9,
-196,157,206,247,133,139,233,189,147,253,107, 92,116,122,183,190,235,225, 91, 96,122, 24,157,110, 67,108,199, 24,141,217, 41,192,
-113, 63,208,239, 34,114,181, 69,145,185, 19,221,241,136,215,142,  6, 78,247,102, 47,247,  7,195, 14,220,  7,175, 61,149,174,247,
-120,192,240, 63,  1, 63, 93,252,234,119,129, 31,252, 50, 15,187,186,  0,234,191,125, 28,239,249,173,  2,212, 31,161,170,187, 69,
-228,142,  7,241, 26,122,235,173,183, 83, 12,212, 51,221,190,251,170,175,216,241,202, 95,125,206,217,255,254,244,241, 96,184, 30,
-  5, 89, 78, 33,184,206, 34,227,168, 76,134,240,131,111,251,220,219,174,121,223, 29,127,252, 63,174, 58,239, 71, 69,141,121,247,
-166,126,175, 28,122,123,183, 17,148,115,194, 79, 60,239,137, 60,231, 19,127, 14,147, 26, 70, 67,219,221,205, 64, 61,  2, 26, 97,
-117,157,199, 63,242, 44,190,227,107, 30,213,190, 55,222,113, 61,170, 53, 18,102,233,133,170, 56, 81,246,175, 78, 54, 14,175,207,
-142,220, 95, 55,203,128,189,220,178,245, 74,238,101,105, 27,137,  2, 63,209,206,116,167,226,174,112,167,244,245,170,234, 15,  0,
-191, 80,252,234,143,129,239,186, 15,114,208,119,146,244, 31,  0,251, 68,228,115,199,201,140,176,224, 48,221,241, 32, 94, 67,111,
-189,245,118, 10,129,186,  0, 82,121,185,248, 53, 95,127,230,175,190,242, 95,159,254,172,166,129,245,202, 33, 35,135, 70, 69, 55,
-  2, 43,149,112,243,180,153,124,247,255,188,233, 55,222,245,233,195,191, 11,196,207, 31,170,111, 71,244, 18,109, 35,117, 96,188,
- 76,184,249,189, 84,  7,110, 70,182,159,  7,192,179, 31,127, 30,215,252,187,175,229,135,254,199,123, 88, 63, 56,133,241, 40, 41,
-218, 85, 97, 86,195,250,  6, 79,184,100, 15,127,244,202,111, 96,101, 60, 72,103, 85,111, 16, 62,241, 86,100, 56, 74, 10,123,141,
-104, 12,224, 28, 55,220,118,112,239,100, 22,246,114,255,  9,229, 32,229,156, 51, 93,125,197,  9,188,255,154,135,250, 62,235, 15,
-149,235,181,218,253,146,158,254,107,224,219,142,182,217,202,  9,216, 39,129,199,100, 80, 63,206,247,236,187, 27, 70,228,193,184,
-134,222,122,235,237, 36, 51,119, 15,160,190,251,181,207, 57,235, 13, 63,250,212,211,159, 53,105,160, 94,174,144, 37,143, 70, 96,
- 61,176, 50,246,252,237, 45,107,183, 95,254,198, 79,254,228,187, 62,125,248,191,  2, 55,  3, 95,250,212,157,147, 79,225,  4,130,
-  5,  2,222, 37,138,189, 89,165,126,239,235,231, 62,228,123,159,254, 40,254,225,231, 95,192, 15,125,227, 99, 56,127,199,136,177,
-214,108,114,129,167, 92,180,139, 95,255,190,175,227,221,175,185,146,243,247,116, 66,225,230,  3,191,129, 30,188, 25,  6, 35,212,
- 68,120, 52,  1,156,240,169, 47, 30,248, 28,169, 89, 71, 60,201,238,243,177, 84,231,167,250,249, 93,113,138, 94,239,241,  0,250,
-119,  3,255,173,112, 16,223, 13,124,139,  9,215,238, 11,251,120,241,253,232, 56,223,179, 40,174,155, 60,200,215,208, 91,111,189,
-157, 66,145, 58,231,108, 31, 94,254,221,143,217,241,244,217, 36,194,166,  1, 50, 20,116,166,248, 73,195,104,197,243, 59, 31,222,
-247,201, 31,248,163,155,127,225,240, 70,120,143, 69, 17,107,192,248,221, 55, 28,249,167, 91,143,212, 47,221,181, 60,168,130,106,
- 87,  4,183,180, 76,252,252,187,105,222,247, 43, 84, 79,237,244, 58,143, 61,119, 23,175,127,233,211,248,249,239,104,184,109,255,
- 26,195, 65,197,153, 59, 86,238,114, 62,225, 19,127, 74,243,145,223,129,241,114,242, 58,156, 71, 67, 68, 66,164,158, 76,121,235,
-123,110,120, 31,169, 31,253,253,  9,234, 39,146, 31, 46,  5,101, 87,168,234,246,  7,171,206,250, 24,118, 99,113,126,151, 29, 39,
-232, 93,118, 10, 95,239, 61, 93,219,139,129,223, 40,192,240,253,192, 55,138,200,198,125,248, 49,239, 46,190, 63, 83, 85,199,199,
-177,159,249,226, 62,234,183, 63,200,215,208, 91,111,189,157, 66,145,122,117,222,142,209, 69,219, 71,158, 38, 38,117,187,174,  7,
-134,179,128,140,132, 87,254,213, 23,174,125,201,239,220,240, 31, 15,111,132,119,218,226,114,136, 84,243, 90,223,114,112,246, 79,
-111,189,254,192,135,  6, 21,232, 36,  0,138, 56, 82,189,250,242,102,194, 71,126,155,250,218,159, 64,215,239,156, 15, 67,  6, 21,
-231,237,217,122, 87, 64,175, 55,  8,239,127, 35,205,123, 94,131,140,134,136,247, 41, 95, 63, 24, 65,221, 48,112,240,143,159,186,
-245,182,191,255,196,237,215,146,122,191,223, 47,160,190,176,197,231, 98, 68,122,119,182, 88, 38,246,242,147,108, 28,148,231,183,
-221,218,182,158,104,148,126, 42, 92,239,221, 61,227,111, 37,137,214,242,220,248, 32,240,245, 34,114, 95,107, 53,222, 77, 71,167,
- 15,128,203,143,227, 61,207, 42,190, 63, 72,162,240, 31,204,107,232,173,183,222, 78, 33, 80,247,159,184,125,227,211, 95,156,133,
-102,121,217,179, 92,  7,150, 61,172,250,168,223,254,135, 55,254,254, 47,190,227,214,159,  2, 62, 76, 18,252,172,145,250,173,231,
-141, 94,110,255,213,191,187,253, 45,135,234, 64, 85,  7,168,163,237,133, 78, 18,206,173,108, 38,222,240, 23,204,222,250, 18,194,
-199,223,138, 30,254,210,209, 23,216,181,189,196, 27,174,101,246,199, 47,165,249,224,127,135,241, 24,124,149,154,205,136, 32,110,
-128, 76,106,240,202,207,190,249,131,127, 12,124,214, 62,255, 62,  7,117,107, 56,179,184, 57,201, 91,142,231,189,214,159,188, 20,
-139,189,234, 30, 34,221,  7,218,222,194,188, 40,237, 85,199,113, 47, 94,117, 10, 95,239,177,174,235,185,164,118,169,121, 43,225,
-143,  3,207, 20,145,131,247,245,103,217,  6, 46,165,226,253,199, 84, 85,238,230,220, 54, 51,175, 86,127,187,136,196,  7,243, 26,
-122,235,173,183,147,207,238,150,126,223,183,218,124,224,133,191,127,211,213, 63,244,180, 61, 87,238, 92,174,182, 94,127,231,228,
-139,255,237,189,119,188,237,227,183,172,255, 25,112,171, 69, 11,179,  5, 16, 13,192,198,103,247, 78,254,226, 53,127,115,219, 21,
-175,251,134,115,158,209,172, 54, 80, 57,100,228, 59, 50,112,121, 11, 52,135,168,223,251,115,200,112, 19,178,243, 18,220,142, 11,
-161, 26, 67,172,137,  7, 63,143,238,253, 56, 76, 14,194, 96,  0, 43, 69,  3, 46,  5,162, 67,167,194,112,147,227,183,174,253,212,
- 39,254,250, 95,190,244,251, 36,234,253, 62,221,147,218,162,243, 43,184,235,254,226,  7,184,119,202,247, 87, 48,223,123,253, 29,
-182,205,232,181,199,241,249, 87, 26, 16,220, 47,130, 51, 17, 57,160,170, 87,211,149,235, 93,161,170,111, 58,218, 22,173,  6,232,
-199,179,237,233, 73,123,189,199,248,220,103,154,115, 99,138, 76, 62, 13, 92, 33, 34,119,126, 25,199, 44,213,229,207, 19,145, 63,
- 89,120,201,207,  3,223, 67, 42,109,123, 26,240,122, 85,253,145, 69,176, 86,213,101,224,205,164,166, 51,216,124,187,250,129,184,
-134,222,122,235,237,161,  3,234, 53,176,255, 31,110, 60,242,255,254,195,141, 71,222, 97, 11,207, 62,224, 54, 18,213,190,106,175,
- 89, 44,139,201,251,173,223,246, 75,239,188,245,245,143, 63,103,249,252, 23, 61,110,231,195, 55, 14,207,144, 45, 67, 24,185,212,
-105, 14,133,193,  0, 25, 12,146,130,125,223,135,105,238,184,174, 61,156,184, 10,170, 33,172,108, 90, 88,185,128, 89, 64,227, 18,
-227,209,144,235, 62,115,251,129,255,240,223,223,255, 58,139,210, 55, 56,129, 29,218,244,110, 90,163,221, 29,104,221,155, 60,177,
-117, 75,123,  5, 93,207,237, 12,116,215,146,232,234,197,190,236,217,153,200, 17,238,171,239,231,177,112, 13,243,219,160,190,220,
-104,248,107,138,115,187,130, 68,165,111,183, 72,252,  0,199,200,193,159,  2,215,187,104,127,194,188, 96,109, 29,248,255,142,119,
-104,136,200,215,159,128, 51,181,215,202,205,126,203,126,245, 31,128,167,169,234,111,  0,215,219,252,124,  2,169,123,220,185,197,
- 91,255,111, 17,249,200,201,112, 13,189,245,214,219,169,  3,234,193,128,187, 49, 16,119,246,187,169,125,  5,142,189, 19, 90,  3,
-172, 70,213,143,254,219, 55,223,244,179, 59, 87,170,215, 60,243,225, 91,207,154, 28,154,193,230,  1, 50,246, 93,253,122, 66,112,
- 24,142,239,190, 14, 77,129,168, 48, 13,196,195, 51,150,206,216,195,245,183, 30, 88,189,234,234,191,187,250,208, 90,253,158,194,
-201,184,191,237, 58,  3,244,123,221,217, 76, 68,174, 41, 26,216,108, 47,128,242, 65, 87,136, 91,180,126,149, 69,215, 23, 20, 96,
-251,218,163,188,252,  0,112,213, 49,254,118, 74, 92,239, 81,108,105,225,231,175,120,128,238,251,111,171,234, 25,192,207,217, 28,
-123, 60,240,134,187,121,203,175,  0, 63,115, 50, 93, 67,111,189,245,118,242,152,187,  7, 24,109, 72,249,242,  3,192,126, 18,221,
-190,110,191,215,123,120,239, 20, 56,116,120, 35,188,235,121,215,124,250, 63,255,206,  7,247,125,114, 60,116, 12, 14,215,196, 67,
- 53, 76, 98,123, 20, 65, 16, 57,202,151,253, 35,  0,179,136, 30,110,144,  3, 83,150,182,111,227, 93, 55, 30,186,237, 89, 63,121,
-237, 79,222,120,251,234,255,178,115, 91,231,254, 83,189, 95,107, 17,235, 85, 34,242,196, 19,  1,244, 18,232, 72,237,101,175,225,
-248,154,171,188,133, 68,101,223,239,155,152,216,166, 48, 79,188,135,207,186,150,180,237,233,117,167,250,245,158, 44,102,105,134,
-203,129,127,186,155,151,125,  4,248, 38, 17,249,225,163,229,210,123,235,173,183,222,224,254,109,210,  2, 73,172,179,108, 81,218,
-163,190,251, 41,187,191,231,103,158,125,214, 55,157,181,117, 88, 53, 83,165,169,  4,198, 30,169, 92,138,220, 93,113, 58,170, 16,
- 64,155,  8,147,128,175, 35,131,129,112, 56,192,207,189,103,255,223,254,242,219,110,120, 83, 29,226,  7,232, 74,233, 78,201,102,
- 26, 70,113, 47, 82,216, 55,146,118, 55,187,246, 65, 60,175, 76,135,151,123,162, 95,123,156,187,193,157,114,215,123, 18,141,135,
-139,128, 39,  1,103,218,252,188, 13,248, 71, 17,249, 76,191, 92,245,214, 91,111, 15, 54,168,103, 96, 31,147,182,154, 60,253, 97,
- 59, 70, 95,247,242,175,222,253, 45,223,121,217,174, 39,159,189,121, 48, 64,  5, 85, 37,138, 16,139,179,113, 10, 78, 53,149,174,
-  9,236,155,132,248,  7, 31,222,255,209, 55,189,239,142,183,125,228, 11,107,111,  7,190,104,204,193,198,169, 10,232,189,245,214,
- 91,111,189,245,118,170,129,122,254,156, 33,176,  2,108,  1, 78,223,177,169,250,138, 39,159,183,233,201, 47,120,220,142, 39, 61,
-238,172,229, 51,182,143,252,202, 74, 37,195,202,137,107, 34,186, 30,226,236,208, 44,174,127,230,142,141,189,111,249,208,254,127,
-249,251, 27, 87,255,233,150,131,179,235,128, 47,  1,135, 73, 57,244,251,173, 38,189,183,222,122,235,173,183,222,122, 80,191,251,
-207,114, 36,117,238,178,125,109,  6,118,  0,123,150, 71,110,231,184,114, 91,  6, 94,134, 77,212,102,210,232,145,245,105,216,167,
-202, 29, 36,138,253, 48, 41,111,190,198, 61, 11,245,122,235,173,183,222,122,235,173,  7,245,  7, 16,220,  7, 22,189,231,175,138,
-174, 97,  6, 22,129,215,246, 53, 51, 32,111,122, 48,239,173,183,222,122,235,173,183,147,  7,212, 23, 63, 63,131,124,254,191,  4,
-117, 45,254,239,129,188,183,222,122,235,173,183,222, 78, 98, 80,191,187,243,233, 65,188,183,222,122,235,173,183,222,122,235,173,
-183,222,122,235,173,183,222,122,235,173,183,222,122,235,173,183,222,122,235,173,183,222,122,235,173,183,222,122,235,173,183,222,
-122,235,173,183,222,122,235,173,183,222,122,235,173,183,222,122,235,173,183,222,122,235,173,183,222,122,235,173,183,222,122,235,
-173,183,222,122,235,173,183,222,122,235,237,126, 50,185,236,180, 93,170,128, 56, 16, 60, 14,240,206, 33, 78, 82, 39, 24,201,173,
-222, 28, 34,224, 36,245,135,241,222,225,108, 31,116,239, 82, 35, 56,  5,188, 19,196,  9,131,252,122,  0, 17,236,109,120, 71,251,
- 62, 39,224, 17,162,166, 93, 87,157, 19,124,126, 33,138, 23,193,171, 18, 81,156,203,251,174, 87,136,  6, 28,130, 31,  8, 62,  4,
- 70, 78,240, 40, 30, 80,167, 16, 97,136, 50, 85, 37,160,108, 21, 88,169, 28,195, 42,245,163,165,242, 92, 60,155,240,132, 11,  4,
-249,198, 11,224, 43,214,144, 29,207,131,241, 51, 96,184,  2,178,  9,100, 37, 93,188,206, 64, 87,161,190, 29,142,188, 14,253,244,
- 77,240,143, 99,226, 71,239, 96,114,243, 97, 14, 15,132,102,101,204,157,107,240,169, 53,144,  8, 91,  6,176,105,224,112, 46, 82,
- 71, 88,171,133,105,128,129,128,162,  4, 32, 58, 65, 67, 32, 70,104, 52,221, 59, 81,235,190,163,160,  2, 66,218,165, 78, 28,169,
- 57,110,126,104,154,254,182,216, 83,183,253,187,245,237,145,246,169,104,123,255,219,215,216,126,245,115,191,  3, 84, 28, 98, 71,
- 83,181, 70,126, 66,219, 10, 72, 36,245,242,245,214, 11, 80,  4, 42, 15, 81, 29, 81, 99,215, 49, 72, 23,143,156,118,211,109,255,
-164,224,237, 69, 51,210, 56,113,  2,  3,  7,227, 42, 29,171,137, 16,  3, 72, 37, 12, 61,108, 95,169,216,188,175,230,172, 93, 75,
- 84,223,117, 22, 60, 50,192,142,139, 96,211, 85, 48,126,108,250,128,250, 19,176,246,103, 48,109, 64, 46,128,112,115, 58,250, 48,
-192,182, 43, 97,240,104, 82, 71,226, 85, 88,127, 39,124,238,191,193, 39, 60,251,174,190,137, 27, 42,229,208,192, 81,  7, 88,118,
-214,203, 88, 32,186,244, 92,163,192, 76, 29,177, 14,204, 80, 98,128,105,132,160, 16,  4, 66, 80,102, 81, 17, 32,106,250,125,190,
-110,  5,156, 83,198,164,107,209,152,126, 31, 21, 26,148,202,158,231, 84, 96, 26,210, 51, 70,211,120, 73,131, 99,126,140, 84, 54,
-142, 28,218,182, 98,172, 28, 12, 68, 24, 58,216,228, 97,164,202, 29,181,114,103,147, 78, 98,164, 80,  9,172,  6,216, 80,109,231,
-221, 88, 96, 87,  5, 35,129, 89,132,101,129,109, 14,238, 12,202,135,167,112, 48, 40,162,202, 52, 20,231,148,199, 93,241,115,110,
-255, 88, 14,153,114, 24,196,252,224, 17, 68,180, 29,125,206,190,198,164,243,139,105, 10, 19,237,218,134,164,251,155,199,123, 69,
-234, 49,173, 54,130, 29,202,200,254, 94,147,238,187, 22,195, 48,146,174,119, 18,187,115,245,246,229,138,249,147,223,211,144,239,
-143,180, 45, 47, 21,165, 18, 88,178,175,129, 77, 73, 87,206, 51, 73,107,219, 80, 96, 69,210, 39,205, 20,234,252,252,237, 61,209,
-198,132,147,180, 17,198, 72, 28, 94,210,239, 39,170, 76,219,215,203,220,156,174,128,136, 16,236,247,145,124,108,101,136,176,221,
- 41, 75,192,134,194,106, 76,115,113, 93,149,219,163,114, 32,166,223, 47,139,112,182, 75,235,239, 94, 85, 86, 53,125,102, 19,243,
-241,148, 90,161, 70,105,138, 49,156,103,177,179,103,148,231,171,144,215,175,180, 80, 69,164,125,  6, 51,148,105, 84,136, 17,161,
-235,239, 93,142,137, 60, 36,212,174, 81,224, 46,227, 34,127,137, 20,231,144, 23,163, 98,237,155, 91, 95, 22,142,131,192,192,121,
-156,147, 22,195, 70, 26,113,162,108, 68,152,218,170,231,129, 74,187, 57,165,118,222,  1,233,182,  2, 21,193, 11, 12, 92,197,168,
-170, 24,120, 79,227, 61,235,245,140,122, 54, 67, 99, 64,  5,230, 27,164,118,239,165, 56,175,104, 63,167,239,243,249,187,118, 13,
-135,132,185,222, 87, 68,160, 81,197,197,200,226,162,172,237,189, 77,227, 20, 85, 69, 52, 29, 72,109, 11, 84, 81,219,226, 92,139,
-187, 99,223, 56, 17, 68,237,160, 78,218,  1,235,178, 23,160, 66,144,180, 72, 57,215,157,158, 72,247,254,116,234,206, 62, 43,218,
-244,180,133,  6,  1,231,210, 77,117,180,206,133, 83, 69,109, 53, 20,177,197, 33,223, 16,192,185,118,229, 64,129, 74,  4,111, 94,
-137,243, 48,208,  4,144,  3, 34,  1, 73,103, 16,  3, 90, 76,205,110,186,147, 30,167, 12, 64, 54, 67,165, 48,126,  1,114,246, 47,
-161,151, 68,220,193,237,140,238,156,178,114,100,131,189,190,225,112, 28,224,156, 50,240,201,121, 24,136,226,241, 68,133,202,219,
- 57, 69,  5, 17,  6,164,133, 60, 22,231,174, 24,144,219,205,116,206,208,132,136,196, 60,197, 99, 58, 51,129,136, 75,131,217, 97,
-175, 41, 39, 95, 66,128,202, 29,107, 11, 59,215, 78,160,114,  2, 36,160, 79,231, 40,136, 57, 22,121,193,138,243,147,206,  0, 61,
-109,141,235, 24, 58,101,214,164,201,157, 23,210, 60,233,165,123, 44, 54, 86,180,  3,128,242,243, 21,115,222, 34,106,231,226,134,
-130, 87, 24, 58,112,123, 39,236,172, 61,213,183,236,129,199,  4,216,122, 38, 44, 93,  1,163, 75,210, 50, 31,111,129,141, 15,193,
-250, 45, 32,231,147,118,230,  5,164,  2,105,138,229, 33,164,101,193,237,132,241, 18,108,153, 49, 64, 88, 82, 69, 42, 24, 84,224,
-196, 17, 52, 18, 98,  2, 58,196,158, 31,218, 62,180,236,103,229,169, 32,  2, 35, 73,139, 67, 99, 99,185,156, 62, 18,211,177,199,
- 62, 57, 50,117, 76,227,219,197,244,158,  1,105, 81,198,165,191, 57,233,  6,197,220,115,178,181, 97,104,192,224, 13, 76, 42,215,
- 57,132,211, 38,237,124,180, 63,164,  5, 54,131,144, 23, 24,219,235,130,129,231,192,198,221,192,  9, 42,105, 54,228,215, 45, 11,
- 28,178, 25, 49, 20,  3, 37,251,140,202,156,153,238,153, 43,206,238, 67, 67, 90, 59,202,  5,220,139,206,129, 67, 40,158,200,178,
- 36, 80,143,  6,110, 83, 45,150, 29, 77,159,237,153,239, 29,157,207, 91,165,115,192, 26,187,166,198,  0,222,171, 50, 64,216,148,
-150, 20, 54, 52,189, 70, 10, 80,145,226,222,  6, 32,168,166,177,216,190, 70,147, 19, 75,218,128,  2, 77,199, 31, 73,186,255,106,
-  7, 25,230,115,162,  3,241, 65,  1, 42,106,159, 91,231,207, 85, 69,196, 17, 36,129,115,176,187,181,100, 19, 76,237, 94, 52, 10,
-162,  9,136, 43,  3,180, 96,231, 80,  9,  8,142,101,129, 37, 17, 20,101,162,145,198,230, 83,  0,106, 21, 14,  3, 51, 85, 60,202,
- 70, 84, 84,160, 65,136, 54,162,156,164,135, 53, 18, 97, 44, 74,208,132,  3,141, 57,143,216,243,172,138,235,105,180,187,150,228,
-128, 69, 60, 14, 17,161, 22, 80, 21,162,179,207,137, 58,119,159, 99, 17,160,116,200,210, 61,149,242,181,249,222, 75,225,212, 57,
-145,185, 77, 64, 90, 80, 84,230, 28,  3,230, 86,245,136,199, 83,  1,155,156, 48,148,138,195, 54, 94,199,121, 12,199,128, 67, 65,
-149,218,214,232, 88,  2,122,123,254, 66,144, 52,143, 91,108,243,  3,130, 11,136,166, 59,226,142,178,198,249, 34, 62,139,249,170,
-139, 49,172,133, 91,226,128,177,243, 44, 47, 47,227, 70, 99,234,160,204, 66, 77,168,107, 66,140, 52, 33,164,232,160,112,145, 68,
-161,138,237, 66, 33,173, 71, 40,154,135,178,164, 69,  7,105,189, 36,177, 40, 27,115,  0,164, 13,187,156, 69,245, 98,139,185,189,
- 63,135, 23,237, 49, 12,204,180, 59,249,204, 10,136,218,205, 17,177,133, 95,108, 48,119,222,178, 35,180,171,154,152,135,216,104,
-158,116, 58,  7, 16,222,188, 37,181,133,111,232, 34, 34, 46,121, 50,  2,113, 45,224,107,187, 41, 98,199,197,131,248, 98,184,196,
- 52,140,252,102, 24, 61,  1, 54,127, 29,114,209,219,209,195,219,112,251,182, 48,254,212, 12, 38, 13,181,171, 24,  8,108,114,145,
- 37,192,139,208,152, 71,229, 21,212, 67, 84, 37,218,125,112, 34, 56,169,168,189,226, 66, 36,154,119,136, 43, 34,118, 27,220, 62,
- 33, 10,209,158, 79,200,215,234,238, 58,136,219,255,157,177, 31,230, 32,229,209, 21, 53,226,237, 25, 32,221,164,202, 32,221, 29,
- 36, 13, 74,113,198, 20,196,  4, 74,190, 93,196, 28, 34, 49,129,138, 70,212,238,119,142,212, 18, 56, 59,134, 30, 26, 34, 46, 64,
-140,218,122,230,184, 52,144, 99, 72,  3, 93,204,  9,112,146,198,128,139,  9, 48,  6,164,232,125,115,173,156,113, 40,176,233,249,
-103,194, 83,129,173,123, 96,252, 20, 88,186, 12,220,102,208,195, 48,253, 16,172,127, 18,166,147,132, 16, 58,  3,183, 12,126, 25,
-  6,203, 32,203, 54,173,166,246, 76,183,193,210, 54,216,117, 59,195,229,  1,123,102,235,204,150, 29,179,  0,235,117,100, 18, 32,
- 24,120,103, 70, 37,196,  4,244, 33, 58, 52, 51, 19, 58,207,152, 68,187,137, 78,230,129, 61, 47,232, 85,147,174,221,107,154,  7,
-193,165,215, 52, 81, 24, 59,101, 57,194,204,117,142, 80,158,163,217,113,136, 54,126, 70,249,158, 21,127,247, 46,157,235,106,132,
-181, 90,187, 69,199, 94, 27,237, 57,143,108,236,212,161,  3,193, 28,169,  4,151, 22,171,  1,  9,216,110, 13, 65, 13,  0,  0, 32,
-  0, 73, 68, 65, 84, 43,  1,167,233,122,102,115, 32, 93, 70,235,105,177,109,138,107,141,210,177, 20, 57,174,174,200, 44, 83,199,
-174,  5,123,223,212,  0, 44, 59,  0,211,194,241,240,154, 64,116, 84, 56,149,100,167, 66,161,145, 14,112, 92,187,  6, 40, 51,133,
- 41,202,  8, 88, 17, 88, 66, 88,151, 20,141,182,247, 83,187,  8, 50, 44, 68,148, 33,  3,140,118,247,186,124,206,121,157, 89, 18,
-216, 36,146,152, 16,133,117, 77, 78,151, 20, 14, 94,158,203, 30,152,153, 51, 84, 91, 52, 95, 58, 59, 67, 18, 83, 20,237,158,172,
- 27,224,136,  8, 67,187,155,181,157, 55,118, 95,182,122, 71,133,178, 30,148, 96, 75,195, 58,112, 40, 10, 19,251,124,204, 89,186,
-131,116,110,209,220,177,236,148,169, 64, 84,105, 29, 85, 81,101,217,214,250,166, 24,135,195,  5, 86, 35,154,147,225, 84,113,162,
-157,147,105, 78,206,196, 57, 26, 18, 43, 25, 11, 71, 42,127,102, 11,108,  5, 22, 57, 41,162,236,133,144, 75,237,115, 97,158, 17,
-114,204,163,185,204,133, 49,105, 77,246, 34, 44,  9,140, 69, 88,  5, 38,230, 60,165, 64, 85, 17, 39,104, 84, 84, 59, 64,159,139,
-139,165,163, 12,242,216,142, 22, 68, 69,186,193, 41,234,138,160,136,121,224, 45, 93, 74,157,103, 50,165,192, 78, 15, 12,125,133,
- 27,140,136, 49, 82, 57,  7,126, 68, 13, 56,141, 72,240, 52,245, 12,140,149,201,  8, 94, 73, 62, 82, 11,  6, 29,233, 35, 70, 23,
- 43, 98, 19, 37, 17,  3,233, 14, 10, 34, 41,226, 75,236,123,114, 55,196, 37,170,206, 25, 37,159,192, 74, 18,230,171, 38,208, 54,
-207, 36,104, 76,224,134,107,207, 33, 15,108,143,162,  6,246, 94, 44,142,183,155, 46,133,135,227,236,116, 84,211, 93, 21, 39,184,
-168,105, 80,  8,204, 52, 34,234,104, 66, 36,  0,163, 33, 12,124,132,224,136,107,147,196,159,102, 36,109,151,181, 50,162,163,139,
-236,  6, 59, 96,211,139, 33,126, 14,185,248,227,112,235, 38,170,189,107,108,254,194, 42,131, 81,205,166,225,144, 97, 52,170,187,
-136, 82, 43,187, 61,181, 72,235,237,  2,212, 26, 91,146, 77,132, 20,198,133,136,132,  8, 81,169,156, 35,198,216, 69,228,  2, 33,
- 96, 76,  5,109,116,158, 28,161,244, 88, 93,177,224,198,121,222,179, 29,233,145, 69,  0,119, 93, 40,217, 78,  2,181,129, 14, 18,
-204, 55, 21,240,226, 16,151,134,123, 57,216, 69, 36, 57, 18,193,174,221, 39,  6,166,202,  3, 95,192,121, 65, 85,237,245,142, 58,
- 68, 99,110,186,153, 87,217, 98,130, 64,133, 48, 18,216,236,148, 93,119,204,216,122,217, 14,120,233, 16,182,157, 13,163,231,192,
-248,  9,224, 79, 79, 80, 57,187, 17, 86,255,  9, 38,251,147,167, 16,107,155, 33,219,192, 85,  9,220,197,205, 47,  1,126, 59,140,
-118,192,150,219,169,182, 13,217,186, 62, 97,125,160, 76,106, 97,221,168,245,236, 96, 69,163,171,243, 68,110,136,115, 52, 71,122,
-157,125, 19,211,152, 47, 41,188, 28,107,199,152, 22,100,209, 14,  0,  7,230,236,  4,187, 23,227, 10,124, 20,154,168,212,230,236,
-249, 60,225,205,225,117,146, 35,186,110,133,205,167, 51, 85,152,198,152,156, 34,205, 35, 90,168, 68, 25,155,227,148,  1,211,134,
- 19, 83,133, 42,106, 98, 69,128,245,144,206,125, 11,176,226,146,147,144,253,200,188, 64,184, 12, 90, 54,  7, 51,112,197,133,  5,
-183,164, 90, 27, 59,151, 96,224,144, 23,249, 90,231, 29,130,146,201,201, 79,172, 46,162,223, 80,240,235, 82,208,175,195,246, 51,
- 58,208,  9,230, 44, 52,154,128,125, 51, 48,201, 81,150,205,211, 90,139,221,163,180, 59,215, 88,210,176,246,252,189, 43,159,107,
- 74,245,173, 24,224,175,197, 68,121,207,232, 28, 35,236,220, 59, 96,207,169, 53,153, 75,163,  5, 59,199, 13, 99,133,198, 22, 36,
-169,118, 84,120, 14,128, 26, 77,115, 52, 81,253, 48,176, 52,101,142,246, 55, 20, 14, 42,236,183,239,  7, 70,245,214, 10,107,182,
-126,108,146,148,198,153,229, 96,  3,193,139,182,142, 57, 34,  4,115,192, 42,160, 54,103,104,163, 24, 59,161, 24,123,129, 60,231,
- 93,139, 25, 67,115,110,107,113,212, 46, 57,255, 65, 59,167,168,100,245, 88, 96,163, 50,205, 94,178, 41, 81,230,157,228, 98,105,
- 76,  1, 71,  1,254, 37, 53, 95, 89,170,119, 44, 48,114,  9,208, 55, 16,162,116,243,116, 36,137,101,216,  0, 38,182,238,106,166,
-183,219,220, 87,183,112,230,111, 27,148, 24, 26, 52,198,196, 78,101, 86, 70,239,194,184,183,209, 57, 28, 13,240,101, 46, 56, 19,
- 28,181,  0,205,140,161,171, 24, 12, 61,222,251,196, 88,169, 50,211,136,162,196,186, 78, 44,182, 57,103, 85,233,253,228,153,145,
-105,114,140,134,202, 51,121,145,118,117, 54,163,180,205,121,100, 34, 91,230, 40, 93,231,186,139,203, 78, 68, 75,247,138,180,224,
-157,239,153,119,201, 99,116, 46,141,154,104, 81,130, 20,185,123,215,185, 53,237,194,155, 40,119,135,151,148, 43, 25,186, 20,128,
- 55,196,228,113,169, 34,150,219,198, 59,130, 42,172,213, 72,227, 33,206,204, 61, 21,208,169,  1, 92,181,176,180, 12, 97,112, 38,
-172,252, 32,156,253,147,112,217, 94,228,200, 78,182,220,182,193,174,245, 25,119,110,246, 12,156,183, 72, 56, 45,236,138, 18, 37,
-233,  6, 90,180, 39, 22,212, 81,108,239, 81,212,128,134,142,122,137, 26,237, 94,217, 42, 18, 99,231, 44,104,231,222, 75,155, 51,
-207, 83, 41,182,209,226, 92,  4,142,182,212,144, 55,250, 62, 77,144,208, 29,215,242, 51, 30, 73,192, 28, 19, 29,158, 39,140, 72,
-196, 57, 71,140, 57,221,145,216, 15,103, 90,  6,181,  8,195, 41, 12,109, 96,121,213, 54,234,143, 33, 13,184, 38,216, 34, 39, 93,
-228, 53,176,232,222,161,233, 25, 57,216,132,178,235, 64,205,182, 51,151,113, 63,189, 27,118,157, 15,195, 23,193,232, 49, 41, 45,
-130, 66,216, 11,147, 15,192,198, 29, 48, 91, 55, 26, 32,130,140,192,173, 44,196, 95,  5, 76,184, 61,176,244, 66,216,118, 13,114,
-254,  1,248,176,167,158, 42,235, 33, 69,176,190,160,100, 23,193,169, 90,136, 68,195, 28,252, 24,195, 17, 22, 83, 95, 50, 15,126,
-246,127, 48, 71, 43, 42, 52, 17,182, 84, 48, 26,192,122, 16,134,209,232,109,  3,247, 68,177, 11, 99, 20,231,211, 34,225, 84,209,
-144,162, 58, 53,154,115, 32, 66, 20,157, 75,129, 12, 93,202,247, 86,162,212, 77, 90,156,113, 41,189,160, 49, 13,175, 97,118,134,
- 73, 57,244, 32,176, 25,161,118,202,186,118,115,173,140,144,114,110, 94,138, 84,196,188, 80,131, 57,178, 59,211,146,181,148, 26,
-129,238, 94,138,116,121,241, 18,220,109,136, 49, 43, 86,195,234, 40,121,241,146, 61, 41,211, 63, 27, 36,176, 93, 49, 29,193,192,
- 34,225,104,128,144, 29,156,166,252,204,  5,112,  8, 22, 89,139,165, 31, 42, 27,188,171,  6,200, 13, 41, 82,206,251, 69,  7,186,
-207,106, 36, 81,251,217,185, 79,243, 34, 57,174, 10, 76,236,164,167,118, 44,117,194,192, 64,191,182,200,186,142,210,134, 27,  3,
- 18,115, 81, 17,  9,154,158,207, 17, 21, 99, 39, 36,233,  8, 52,209,223, 57, 39,159, 89,145,153,129, 50, 45,251,145,214,172,136,
-165, 61,165, 99, 22, 70,118, 94,119,198,196, 66, 76, 99, 58, 31, 41,243,225,118, 13, 30, 24, 69,165,114, 90,168,123, 82, 36, 60,
-192, 37,214,110, 65,103,145,103,167, 44, 12,155, 57, 64, 47,242,233,177,136,106, 89,  0,118, 41,194,178, 88,230,211, 69, 88,118,
-233,107, 34,194, 70, 76,201,196,161,116,250,162, 37,129, 70, 18,243,219,136,107,169,109, 45,128,217, 21,224,235, 77, 67, 22,112,
-104,108,210,  4,106,255,106, 17,249,162,150,233, 40,233,245,204, 76,148,227, 87,236,238,141,157,103,105, 52,102, 88, 13,113,206,
-211,  8,224, 60,206, 57, 54,204,201,156,134,136,196,208,  6, 79,149,138, 16,164,136,136, 45, 47, 35,  5,240, 58,243,192,112,174,
-163,  8, 52,  3,124,167,224,113, 20, 33,170, 57,  7,206,120,  9,231,100, 30,132, 72,130, 58, 41,126, 70,210,255,193,  0, 67,131,
-154,152, 78, 11,106, 66, 58, 82, 68, 93,235,116,180,185, 70,141,168,  1, 86,144, 72, 37,201, 49,169, 13,  4,189, 40,  3, 39,184,
- 10,154,153,192,145, 26,234,204, 47, 23,183, 93, 39, 73, 48, 55, 71,172,218, 84, 26, 61,  2,182,252,103,228,226,255,130, 78,214,
- 24,125,118, 43,103,127,124, 31,113, 58,101, 99,105, 41,129,156, 68, 26, 81, 84,197,162,180,124,220, 72,204, 98, 52, 11,107,  6,
-106,116, 46,193,174,209,181,217,174,214,191,139, 54, 69, 92,151, 51,239, 22, 54, 37,250,124,  9,177, 29,125, 34,106,193,183,107,
- 35,237,110,216,107, 55,185,164,244, 16, 93, 98, 63, 92,196,101, 70, 64, 58,141, 67, 90,121, 35, 85,166,225, 93, 90,234,188,166,
- 72, 61,143,139, 44,  2, 10,222,232,197,144,120,225,  0,196,  6,154, 16, 91, 33,101,  6,246,161,131,177,139,109,158,184, 18,216,
- 58, 13,137,214,124,213, 30, 56,237,124,168, 94, 12,227,199,219,114,166,105,233,156,124,  0, 86, 63,  6,211, 35, 48,155, 66,181,
-100, 87, 51, 52, 90, 34, 64, 92, 77,116,124, 27, 15, 54,105,217, 24,158, 13,205, 89,200,198,117,212,  7,103,172, 15,  6,132,152,
- 62,187,141,220,196,  0,154,121,103,182,133,241, 76,101,186,196,106,136,104,151,234, 42, 28, 23, 41,132, 69,229,236,110,138,  8,
-119,102,145,213, 54,159,206, 97,170, 66,200, 14,144,  9,246,  6, 62, 69, 64, 98, 81,149,152,246,  4, 77,116,162, 15, 74,229, 82,
-158, 48, 90,142, 56, 83,178,170,202,134,194, 68,133,169, 42, 49,182,119,177, 91,128, 67, 58,215,195, 49,229,246, 71, 22,173, 55,
- 81,152,233,130,192,205,156,198, 16, 19,179,163,134,168,177, 88,104, 23,183, 91, 12,133,170,169,196,251,170, 20,145, 37,101, 69,
- 33,  0,234,156,167, 65, 17, 61, 75, 41,220, 42,192,193, 27, 75,161,210,  1, 88,206, 79,175,106,146,171,140,109, 20, 53,210, 69,
-202, 72,231,172, 21,153,162,185,  8,176,164,142, 21,101,  2,166, 49,154, 95,180, 35, 73,112, 54, 44, 34,199, 60,135,242,241,134,
-162,140, 16,214,201, 57,110, 12, 92,211,154, 53,176,235,173,109,213,115,  6,242, 21,176,100, 26, 12, 85,101, 29,216, 31,147,232,
- 77, 16,166,118,157, 65,231, 29,160,148, 11, 23,102, 40,107, 70,195, 15,115,158,190,125,114,243,201, 60, 65, 88, 35,165, 20,102,
-106, 84,188, 46,228,139,181,123,182, 65,149,129, 42,  3,  7, 42,182,186, 27, 62,  8,142, 72,180,244,107, 10,176,  6, 44, 56,112,
- 69,144,182, 64, 70,205,253,174, 20,144,198, 34,186,239,158, 77, 55,174,150, 36,105, 70,214, 17,166,154, 65, 89, 25, 26,230, 69,
- 96,146,157,157, 28,181,170,131, 66, 87,228, 76, 48, 30,165,116, 36,164,197, 52, 39,166,131,144,133,188,254, 81, 88,  8, 22,116,
-  2,165, 19,169, 54, 70, 86,  6, 21,219, 55,111,193, 47, 45, 35, 49,226, 92, 69,101,236, 73,211,164,232,220, 13, 42,240,130,134,
-180, 78,251,148,134,210,206,187, 40, 78,166, 20, 76,181,143,184, 64,116,165,  3, 89,147,156,117, 17,164,204,107,175,165, 77, 24,
-228, 92,141, 44,136, 36,180,163,126,213,117,209,162, 40, 78, 92,  7,250,154, 40,226,246,115,181,115, 62,202, 69,214,145,162, 71,
-212, 49,112,129, 42,118,169,139, 74, 28,222, 69,124, 37, 52,235,  2,119,212,232,116,104, 82,  8,223,221,122, 61,156, 68,114,140,
-138, 24,192,150,  6, 25,166, 72,113,235,171,145, 71,252, 56,250,244, 49,155, 14,110,229, 97,183, 31,226,118, 55, 97,178, 52, 78,
-  2,194,168,166, 81,144,118,145,104, 31, 97, 76, 30,151,198,144, 68, 37,196,116, 63,188, 51, 47, 85,146,226,186,205,155,107,118,
-121, 83,116,163, 14, 79, 82, 83,133, 16,230,133,114,153,154,207,207,211,199,130, 54, 77, 30,168,  6,185, 75, 46, 93, 76,116,135,
-229,122, 93,142,214, 53, 61, 87, 87, 16,201,106,142,155, 51, 47,179, 18,197,187, 52, 57,242, 34,171,249,177, 42, 68, 23, 83,148,
-158,159,131,239, 34,222,156, 87,243,146, 34,197,170, 74, 81,208,146,135,205,107,202,224, 41,219,224,162,211, 65,254, 53, 12, 31,
-105,207,164, 78,255, 55,119,192,250,251, 97, 99, 63, 76,102, 80, 15, 83,200,175, 83,144,237, 73, 32, 23, 39, 48,219,  7,203,107,
-197, 50,221,101,191,241, 91, 96,155, 75,169,  3,215,229, 79, 75,138,215, 89, 14,188,157,176, 85,138,230, 93,236,198,241, 44, 22,
- 30, 77,232,132,161,170,138,120,215, 58,102, 90,140,253,210,  6,133,194, 91, 20,150, 28, 84, 33,249,156,117,166, 95, 37,127, 22,
- 45,128,102,  2,168,105,186,  8,119,104, 90,136, 38, 38,149,190,179,  8,112, 18,104, 41,208, 28, 81, 54,154, 41, 96,139,  2, 21,
-106, 99,182,166,116,170,251, 37,201, 57,108,155,243,210, 69, 69, 51,151,216,  4, 47,194,212,216,  3, 89, 88,104, 83,174,177,212,
-138,148,162,161,206,221,170,142, 34,237,212, 66, 88,151,165,158,194,188,142, 70, 23, 22,198,202,126, 25,237,134, 74,235, 96,195,
-196,158,229,184,112,172,114,164,185,178, 16,197,151,145, 96, 22, 17,102,  5,254,192,128, 54, 85,218, 36, 17,172, 20,224,239, 74,
-138,121,225,153,143, 12,108,  2,202, 84,165,213,204, 84,139, 14, 80, 91, 21,160,140,115,228,111, 58,162,  0,172,199, 68,181, 79,
- 45,114, 11, 40,  7, 45,106, 63,150, 34,124,102,207,119, 36,137,245, 41,215,106,135, 82,107,202,197,231,156,255,196, 28,133, 70,
-165,173,120,136, 11,122,146,188,198,100,209, 95,140, 80, 57, 65,165, 67, 88, 21, 65, 53, 69,236,165,115, 88, 21,168,151, 83,135,
-193,158, 81,208,121,  0, 47,211, 51,190, 76,  9,105,231,100,182,207,173,  8,150,167, 69,165,205,208, 38, 77,134,180,172,112,143,
-  8,149, 19,164, 74,235,106,204,194,108,  5,231, 92,155,214,117,  6,252,222,156,150, 38,139, 13, 77,128, 20,109,157,206, 58,140,
-120, 23,  2, 75,138,212,169, 51,109,135, 90,197, 81, 98, 72, 42, 95,225,171,  4,228,226, 43,188, 23,106, 28,135,102, 83, 38,235,
-135, 25,185,  1,163,225,144,102, 56,166,137, 19,203,173,155,250,221, 75,151,211,142, 54, 49, 59, 79, 35,166, 73,236, 76,177,190,
- 16,165,119, 96,161,173,158,186, 19,188,217, 68,201, 37,109, 11,131,218,201,252,136,203,185, 97, 17,109,193,189,144, 64, 24,173,
-221, 81, 31,106,220,157, 47,156,  3,113,  9,236,209,208,130, 68,109, 74, 77, 39, 32, 46,178,105,217,177,115,139, 32,107,  2,235,
-  1,153, 68,139,204, 93,151,  1,211,181,132,168,238,140,163, 80,183,211, 68,237,142,191, 18,118,255, 40,124,205, 47,226,116, 51,
-155,255,188, 98,240,197,253, 28,116, 19,142, 44, 47,209,136,152, 74,191,243,247,197, 70,153, 11,130,196,216, 10,117,208,164, 30,
- 21,205, 17,109,102, 72,192,123, 73,164, 85,  8, 45,161, 32, 57,215,174,225,174,138,244, 54,162, 52,117,181, 82, 76,192,142, 33,
-192,165,170,  0, 23,211,100,203,185,119,103, 30, 31,150, 46,145,214,205, 11,243,229, 45, 98,142,151, 79, 66,170,236, 97, 71, 59,
-126,180,114, 30,138,212,138,179,103, 23,165, 91,252,242,128,247, 70,193,143, 92,  2,184,165, 38, 48, 82,143,123,248, 10, 34, 35,
-240, 59,192,143, 76, 85,227,147,111, 61,253, 24, 76, 14, 66,152, 66,157, 22, 12,209,  8,113,154,158, 97, 16, 83,190, 71,  8,  7,
- 97,176,  1, 44,207,187,250,238, 52,228, 49,203,200,255, 62,140,175,187,136, 56,171,183,157, 81, 18,222, 60,167,218,137,229, 55,
-211,133, 36,226,178,211,118,168,206,235,121, 37, 59, 98,133, 18, 82,140,  5,169,116,158,118,171,108,  5,170, 99,114,124,  6, 46,
-221, 23,  9,105,241,214,152,233, 83,109, 35,120,236, 51, 51,107, 48, 52,237,133,138, 50, 11,105,177,143, 64, 29,147, 58,125, 96,
- 11,119,166, 63,115,148, 91, 23,165,113, 85, 76, 63, 79,141,229, 26, 91,117,201,160, 85,253, 91,212,104, 74,247,129, 69, 56, 81,
-211,179,115, 72, 82,145, 23,202,111, 45,227,192,  5,102,178,140,182,178, 35,225,139,212, 96,118,104,114,154, 34, 22,116,108,233,
- 60,100,189, 72, 25,  9, 38,109, 77, 87,106,213, 42,221, 77,104, 55, 44,114,246, 13,221,245, 45,205,187,126, 45,152,123,  3,253,
-145,192,216, 68,100,171,  6,100, 94, 74,250, 87,231,104,228, 88,204,155,202,  4,110, 41, 45, 96, 37,135,210,229, 99,  7,197,121,
-137,221, 95, 44, 50, 95,178, 99, 76, 45, 58,207, 57,238,124,239, 14,107,202,237, 75,  1,214,186,144, 50,105, 10, 13, 65, 64, 24,
- 74,186,142,105, 78, 63, 88, 30,191, 54,  6,161, 49,182, 39, 75,235, 18, 80,207, 59,  3,177,248, 33,144,242,239,121,253,136,115,
-225,170,182, 65, 89,171, 89, 40,216,150, 12,196, 57,229, 23,115,153, 99,145,146, 41,211,174,229,161,245,104, 37,109, 54, 70, 99,
- 72,250,175,202, 74,250,130,233, 12,  2, 88,181, 77,  2,105,135, 80, 59, 95,212,235,165, 40,124, 32,157, 38,196,105,  2,127,111,
-215,227, 92,170,150,193,214,  2, 87,232,  4, 92,113,127,180, 43, 16,179, 74, 17,135, 56,151,212,252,170,169, 44, 56, 42, 65,148,
- 67,117,205,198,129,253, 44,143,134,108, 26, 47,195,112,196,106,211,176,177,177,198,146, 10, 75,227, 33, 50, 28,227,196,179, 46,
- 66, 51,155,161, 49, 82, 85,222,163, 69, 60, 46,  5,229, 85, 10,230, 22,201, 37, 89, 16, 73, 81, 68,233,106, 94, 96,101, 81,156,
-162,230,141, 40,206,120, 66, 39,157,194,175, 84,213,231,168,222,187,124,209,230, 40,152, 71,227,219, 76,180,182,245,134,185,224,
-171,242, 41,194,117, 46, 57,  0, 34, 48,240, 14,135,209,197, 70,157, 74,136,172, 29, 22,198, 81,208, 89,128,141,136,232,106, 17,
-238, 55,160, 53,232, 45, 32, 59, 44, 98,159, 46,144, 65,211, 20,177,143,159,137,236,110,208,203,127, 25, 25,140, 25,191,125,  7,
-167,125,254, 32,195,141,  9,245,112,204,186, 13, 72, 23, 35,161, 74,209,183,134, 60,  1,186,154, 31,135,164, 18,184,185, 28,190,
- 24,239,160, 29, 93,239, 58, 30, 80, 26,157,207,207,148,160, 89,148,200,205,179,189, 46,157,128,221,120,137, 93,153, 89,118, 10,
-156, 83,163, 64,179,126, 34, 73,191,115,121,161,216,162, 22,189,121,186, 81,231, 40, 39,141,185,254,218,142,151,129, 74,141,190,
- 82, 24,104,164,170,186,219,237, 36, 45,114,198,244, 51, 20,101,105, 18,169, 70, 35,228,172,101, 88, 94,129,225,206,228,133,228,
- 24,175,249, 34,108,252, 11, 52, 19,168, 29,218,116,206, 41,177, 78, 58,  9, 89,  7,153, 89,  8,179,  6,113, 13,220,210,188,204,
- 70,119, 32,103, 47,227, 70, 73,100,169, 46, 57, 53, 90,  0,135,203,207, 37,231,117, 53, 69,198,141,198,148, 59, 21,136, 49,141,
-251,236,228,102, 70,170,117, 56, 77,172, 22,138,249, 83,121, 73,202,122,186, 82, 50, 33,249,147,177,  0,118, 33,229, 50,215,173,
-196,174,142, 41,194,174, 45, 15,239, 10,138,117, 10, 12, 93,226,156,115,137, 87, 44,114,255,121,190, 13, 11, 49, 74,206,141,175,
- 91, 73, 76,  6,142,153,192,154,166,235,205,181,213,162,243,226,166, 17, 93,165,194, 44, 11,232,114,132,146,197,120, 34,212,170,
-237,226, 13, 66, 83, 36,166,100, 65,219, 35, 71,139,190,115,228, 70,238,113, 32,115, 85,  1,101,224,144, 34, 94,105,131,129, 12,
-182,205, 66, 89,149, 73, 96,169, 92,138,222, 91,  7, 40,215, 44, 27,184, 74,177, 80,187, 34,159, 61, 22, 97,127, 84,142, 20,218,
-128, 97,113,237,163,226,190,180, 14,183, 22, 12,135, 57,  3,149, 69,253, 81, 18,101, 47, 69,105,168, 24, 77,159,105,228, 92,143,
-191, 17,211,251,243,156,159,216,243,219, 80,230,202,101, 41, 34,225,122, 65,160,134,166,103,156,203,170,178,168, 48, 26,160,215,
-154,  0, 62,208,105, 59, 40,198, 80,180,126,  3,178,208,131, 34,139,172,155, 24,147,246,166, 88,171,219,212, 76, 33, 20,244,139,
- 37,176,116, 41,188,172, 59,169,181, 19, 28,230,178,202, 50,192, 88,172,101,207,247,174,177,241, 59,144,200, 88,133,202, 22,203,
-152,233,242,150, 11, 79,192, 29,140, 89, 16,231, 58,221,150,253,189, 50,119, 56, 87, 93,164,190, 46, 21, 65, 26,211,165, 68,123,
-182,137,101, 78,142,174,118,  2,225, 18, 71, 11, 38, 47, 90,  9,118, 16, 79,144,136,134, 72,136,129,213,201,  6,235,211, 13, 14,
-173,173, 83, 13,135,248,170, 98, 92, 85,248,106, 64,140,145, 81,140,140, 70, 35, 54,166, 27,192, 52, 57,140,177,200,145,137,116,
- 37,102,217,207, 19, 91,233,133, 46, 47,158, 20,160,  9,173,212,114,188, 71,243,142,200,234,110,171, 85, 79,107, 72,202,153,106,
- 22,157,123,  3,106, 21, 84,211,136,205, 84, 71, 37, 86,156,159, 75,157,180,149,186, 91, 46, 63,226,189,239,234, 26, 69, 76, 77,
- 31, 77,237,152, 38,229,104, 40,104,132,145, 75,147,123, 54,205, 34, 35,208,105, 68,214,  3,196,  3, 54,229, 77,247,170, 13,196,
-125,224,110,  5, 57,183,144, 76,149,196,225, 20,100, 12, 75, 95,143,236,174,225,105,111,132,173, 99,170,183,239, 97,219,245,119,
-194,234,  6,245,120, 76,172,160,  9, 66,136, 41,199,158,242,134, 93,238, 42,149,237,  5,139,186,164,168, 95, 82,188, 26,109,237,
-181, 40, 65, 75,130, 56,113, 57,158,215,246,  9,120,107,108, 50, 95,255,201,188,236,199,128, 39, 77,134, 46,223,158, 91, 30,100,
- 92,234, 74,131,140, 47,111,153,  1, 37,122,103,244,123, 90,176,221,130,184,165, 89,200, 33, 55,161,203,253,182,  3,191,144, 59,
-139,229,144, 43,159,  0,105,105, 26, 25,132, 10,247, 85, 59,145, 39,109,135,173,103,193,224, 92,139, 83,  2,196, 47,193,218,251,
- 97,122, 16,226, 12,157,  6,152,249,212,100, 38, 24,113,169, 13,200,106,  2,120, 87, 37, 10,126,180, 31,220, 22,107,117,146,117,
- 20, 35, 56,109, 51, 50,116,248, 89, 96,176,228, 83, 62,215, 82, 12,106,233,181, 12,146, 77,209, 92,166,182,200, 53,196,110,193,
-235,228,175, 11, 10, 93, 19,146,182,213,  2,246,152, 71,149, 48,200,148,182,129,123, 29,140, 30,142,176,201,209,214,160, 79,162,
- 50,177,  8,125,166, 41,151,157,129,211, 39, 85, 70, 74, 76,196,142,  2,246,101,196,233,210,177, 71,185, 54,220,193, 52,216,115,
-119,169,241,205, 84,161,246,233,239, 75, 10, 27, 34, 73,183,145,243,255,190,203, 57,123,132,113, 33, 10, 27, 26,128,110,100,149,
-127, 33,136, 26,216, 98,233,173, 84, 44,150, 81, 56, 29, 56,233, 49,213,193,243,130, 56,183,176,160,231,232, 19,101,142,154,207,
-141,109,198, 93,102,132, 13,237, 42,  0,102,  2, 99, 77,209,112, 44,152,199,137, 69,188, 67,129,205, 38,174,243, 69,  9,225,200,
- 30,245, 17,  3,155, 97,209, 92,102,  0, 44, 91, 83,172, 18, 72,157, 57, 70,195,  5,128,115,  6,  4,193,214,184,144,157, 63, 77,
-140,193, 38,103,206,135,116, 32, 21,115, 74, 72,231, 25,  5,218,230, 68,157,227,228,143,114, 55,131,233, 22, 66,225,  4,228,231,
-218, 20, 77,124, 90,165,186,106, 91, 65,222,222,247,  5,133,247, 93,250, 41,228,242, 43,113, 45,111,224, 45,135,237, 76,111, 80,
- 54,152,169,164,211, 86,148,140, 99,118, 20, 43, 19, 88,230,117,170,233, 42,123,231,203, 59,237,222, 52,116,172,115, 80,101, 18,
-  3, 85, 72,248,149, 75,248, 52,139,229, 12,208,165,168,  0,234,202,109, 19,197, 46, 22,140,138,233,163, 68, 18,147,234,226,  0,
- 37,208,208, 20,138,  4, 77,213, 66,222, 19, 98, 76,245,177,229, 56,176, 26,222, 84, 85, 19, 83,245,152, 56,188, 56,130, 79,245,
-190,222,198, 88,211,212, 12, 52,178,105,105, 39,245,210,152,  3,  7, 15,224,166, 19, 54,111,218,140, 46,175, 16, 66,131,134, 72,
- 52,231,175, 16, 30,104, 91, 50,225,164,204, 99,148,253,109,116, 94,244, 38,119,109,225,224,140,194, 72,199, 43, 84,239, 86, 19,
-168,153,198,207,  3, 65,170, 68,225, 34,214, 85,174,163,113,165,168,111, 79,145,173, 22,170,193, 20,245,121,103, 74,197,  8, 90,
-229,154, 90, 97,224,146,168,104,105, 32,196, 58, 82,185, 20, 41,229,142,104, 51, 95, 17, 39, 83,170,181,149, 36,176,210,198, 70,
-245,204,142,183,150, 58,148, 13,119, 89,141,243, 17,136,251,193,237,182, 41, 92, 39, 10, 88, 70, 48,126, 46,236,220,130, 92,246,
-107,232,150, 35,248,183,157,198,142,143, 30,196, 31,152,242,249, 65,197,161,145, 16,131,213,199,230,188,118,214, 35,228,112,218,
-123,187, 79,161,229,145,162, 81, 85, 41,125,222,117,123, 75, 13,156,124,155,131,213,216, 32,174,  3,100, 22,196, 26,221, 19, 10,
-214,225, 47, 87, 42,116, 93,224,212,101,181,123, 26,196,149,151,142,177, 23,235,134, 18,115,159,129,104,147, 80,230, 22, 88,236,
- 28,106, 27,195,209,190,111, 98,202,145, 59, 19,200,229,  6, 37,222, 74,132,  6,214, 32,104, 73, 96,101, 18, 25,174, 58,252, 37,
-219,144, 23,238,130, 51,207,129,193,183,  1, 15,179,176,242,150,212, 53,110,245, 75,208,172,195,108,  2,117,101,209,184,107,117,
-  1,105,182,248,244, 60,101,  9,102, 95,132,233,118,112,219,193, 13, 58, 24,145,  1,108, 94,198,109,245, 12,246,  5,134,155, 96,
-214, 24,253,151,187,139, 24,120,139, 69,208,161, 33,  9,205,172, 40, 65, 85,231,230, 72,219,123, 33,211,167,  5,245,230,139,116,
- 68,101,236,209,216,244,  8,141, 74, 91, 23, 95,219, 61,170,130, 81,234,182,152, 55,157, 94, 49, 57,192, 69, 90,171,113, 73, 28,
- 57, 49, 10,119,224,210,189,111, 29,116, 59,207,154, 84,218, 83,209, 41,228,107, 59,159,117, 77,140,192, 88,146, 96,175,209,212,
-200, 38,218,245,  7, 59,118,165, 93, 62, 52, 47,196, 19,186,198, 44, 25, 28,114,115,150,236, 96,148,206,160,106,234,187, 16,138,
-104, 47, 71,196,113, 81,201, 94,140,233,160, 41,245,147,197,159,161,204,173, 23,236,131,155,203,195,167,241, 42,170,173,211, 95,
-219,178, 50,147, 78, 92,229,205,  1,153, 88,249,215, 33,133, 85, 96,139,192, 78,103,  0,107,192,220, 81,212,243,181, 50, 43, 46,
-141,229,181,216,229,126, 75, 86, 34, 20, 76,129,180, 37, 87, 41,173,226,138,206,129,222,114,164, 89, 33, 94,118,167, 91,182,244,
-194, 42, 73,249,238,109, 85, 26,219,177,  6, 40,107,154,158,137, 90, 57,242,144,178, 97, 76,210, 71,228, 58,116,191, 72, 19, 23,
-234,246,174, 10,161, 77,178,182,209,182, 71,231,196,132, 37, 21,238, 77,203, 80,229,124, 58,169, 75,168,183, 52,105, 62, 78,217,
- 25, 81,100,222, 17,213,194, 17, 10,208,150,201,  6,201, 93, 58, 11,177,158, 20,142,146, 72, 18, 75, 22,247, 58, 68,101,166,129,
-202, 41,195,170, 66,156,  7, 39, 22, 51, 73,219,212,  6,115,152,213, 20,237,218,130,189,173,193,177,171,123,247, 86,105,146,115,
-236,177, 76,109,169, 50, 16,135,120, 71,144,144,142, 87,  8,172,114,119,208, 44,182, 77,125, 88, 92,170, 48,178,106,165, 28,235,
-213, 49,114, 96,245, 48,205,250, 42, 97, 58, 65, 84,169, 15, 31, 66, 87,143, 88,218,156, 36,166,115,237, 35,234,162,  7,209, 46,
- 78,111, 35,110,233, 34,119, 41,101,189, 38,150,202,171, 84,110, 32,130, 22,224,159,219,238,229, 34,127,203, 33, 56, 39, 56,151,
- 98,147,172, 42,118,210, 29, 63, 55, 52, 17,237,142,167, 42,109, 45, 96,  9, 86,137, 42, 49,  1,142, 79, 20, 75,101,229,113, 46,
- 42,226,133,145, 79,142,192, 76,  3,218, 40, 99,  7, 58,137,169, 48,180,153, 38,186,150,104,229,109, 27,105,101,157,125, 22,220,
-185, 48,184, 40,249,230, 58,129,230, 35,224, 47, 73,234,120, 53,137,143, 27,193,210,229, 32,155,144, 71,190,  1,182,125, 30, 62,
-184,157,109,239,158, 48,248,232, 17,110,154,212,236,223, 50,192,161,204, 98,164,206, 15,213, 91, 94,166,209,244, 96,136,105, 80,
- 72, 87, 11,233,178, 42,221,165,156,177,203,250,216,162, 69,231,124,221,250, 66,196,147,251,  0, 19,239,162,118,159, 43,173, 48,
-167,206,137,195, 59, 77, 30,182,189,181, 66,105, 52,206, 45,206,226,230, 83,244,181,130,183,104, 54,104,162,137,163,137,179, 70,
- 30, 42,151, 38,132, 51,111, 61,216,108, 21, 15,  3,167, 44, 57, 88,170, 35,163,137,163,122,204, 22,220,203,182,193,249,103,194,
-224, 74,224, 18,251,212, 47,194,198, 91,224,240,199, 82,135,150,112,208,138,142,165, 11,151,188,128, 27, 90,211,157,218, 34,246,
- 38,157,216,228,147, 48, 56,  3,134,155,128, 21,  3,245, 37, 24,109, 66,206, 24, 81,237,157,225, 53, 38,  1,140, 38,218, 51, 88,
-198,162,141,204, 67,162,190,179,239, 80,138, 32,157,148,229,156, 93,169,150, 95,232, 15,224,114,231, 54, 39,140,124,215, 95,128,
-144, 88,141,118, 33, 13,169, 70,124, 40,194, 52,198,182,181,108,249,153,101, 30, 49,218,138,156, 85,200, 49, 88, 78,223,106,231,
-115, 75,134, 72,114,186,188,  1,112,180, 38, 63, 81, 82,117,194,  6,137,118,223,229, 96, 91,149,110,225,204,198, 82,147,117, 44,
- 22,113,229,226,165,202, 58,146,121,133,169, 40, 78,211,130,159,137,139, 78,180, 54,175,105,118,243, 18,213,246, 94,229,181, 73,
- 23,114,147, 20, 45, 53,187,158,111,243, 29,185,114,133, 78, 85,170,232,164, 43, 95, 27, 22, 93,209,196,238, 65,101, 17,252,154,
- 74, 91,235, 62, 48,103,106,221,190, 14, 42,108, 86,216, 33,176,213,132,131,185, 21,108, 46,115, 92,145,228,  0, 76, 76, 41, 94,
-149,138,108,187, 15,117,241,204, 42,211,254,168,206, 63, 75, 45, 20,251, 19, 77, 99, 43,106,138,110, 51,115,176,106,192,236,138,
-161,239,117, 94, 96,231,108, 61, 31,146,244, 42,179,104,105,  6, 45,  1, 60,165, 71,186,246,185,185, 99,219,188, 32, 78,138,231,
-157,157, 36,103,141,132, 68,230,149,240,173,248, 83, 82,137,170,138,164,158,  6, 42,109,251,240,204,110, 13,138,138,131,178,215,
- 65, 60, 74,207,129,129,165,234, 26,233, 28,214,185, 54,171,218,117,155, 83,233, 82, 64,177,240, 84,166, 49, 18,155,134,202,167,
-117, 79,173,189, 50,209,225,188,  3, 26, 66, 12, 38, 60, 75, 35,207, 75,234, 34, 39, 86, 98, 93, 57, 97,224, 28,149, 56,106,  9,
- 56, 13,105,188,183,159,157,114,228, 18,  2,131,193,  0,231, 61, 33,  4, 66, 12, 72, 91,254,166,115, 42,249,220,208, 45,  5,123,
- 62, 21, 63,155,224, 58,  0,245,108,210,  9,197,157,233, 27, 66,176, 57,145,220,197, 74,117, 62,151,145, 85,230, 74,  7,206,210,
-130,168,116, 53,236, 57, 19,111,139,159, 20, 57, 17,213, 12,206,157,104,206,185,228,125, 56,111,255,163,133, 48, 43, 90,111,249,
-121, 69,171,107,203,234,204,163, 12,214,169,204, 46,220, 57,105,197,113, 73, 20,230, 82, 71, 35,  7,203,190, 19,214,205, 80,134,
-214,120,164, 65,169, 53,189, 14, 95,161,177, 78, 97, 73, 51,161,109,250,167,117,  2,239, 16, 97,118,  8,252,  7,192,239, 78, 17,
-158,236,129,240, 73,208, 59,193,127, 37,200,206, 20,159,104, 99, 17,251,147,193,239,130,193,239, 35,187,222, 15,143, 13,108,122,
-215, 54, 46,252,189,131,184,253, 51,142,236, 28,160, 78,152, 54,166,230,205,194, 35,187, 95,161,200,191,122,159, 35,239, 68,203,
- 26,166,162, 69,223,108,114,207,251, 28,229,120, 91, 51, 11,245,181,148,110,236, 92,121,219,124,219, 81, 17,143,115,145, 74, 99,
-187, 56,100,189,123,202,163, 75,145,234,  0,141, 89,108,162,233,123, 91,220,156, 75,183, 78,213,165, 22,150, 46, 80, 85,150,231,
-  5,124,236, 90,  2, 84, 30,198, 78,216,228,149, 77, 77, 96,188,230,168, 46,221,140,123,217,102,184,224, 76, 88,190, 10,120,172,
-141,137, 59, 96,253,191,194,129, 15,145,187,123,232,172, 73,180,187, 77,146,212,109,101,  4,110,156,150, 83,157,153, 91, 31,146,
-218,108,114,  0,170,191, 79,207,200, 95,144,116, 17, 84, 73,206,190,107, 96,148, 89, 74, 99,228, 14, 88,  3, 81, 26, 99, 45, 98,
- 80, 26,235, 52, 55, 47,202,145, 98,220,206, 51, 36,217,183, 29, 59, 65,188,166,146, 57,151,169,201,121, 26, 86, 13, 68,172,  2,
- 48, 49, 29, 62, 69,235, 51, 21,243,230,173,165,232, 81,196,167,149,149,104, 57,237,212,195,169,185,205,124, 62, 52,152, 40, 42,
-183, 53,117, 22,125, 46,217,128,  8, 22,225,109,196,  4,  4,155,156,112, 36,106,218,179,160, 21,  3,130,119,106, 98,193, 68, 93,
- 86,  5,149,155,243,164, 90, 54,118, 41, 96,184, 76, 17,137,204, 83,182,190, 80, 83,119,244,176,180,139, 96,197, 93, 36, 38,201,
- 25,208, 78,153, 55,199, 88, 45, 28, 63, 11,241,196,  0,126, 40, 93, 84,216,180,101,134,106, 45,157,187,250,238,117,133,181,  0,
-123,173,223, 60,153, 77,177, 24,103,139,192, 14,235, 16,152,115,219,173,232,107, 17, 24,237, 57,141,236, 58,214,179,118,161,232,
-212,151, 89,158, 65,161,151, 25,200, 93,234, 55,230, 58,174,229, 28,126, 83,  8,232,218, 64, 41,166,116,201, 90, 25,189,218,184,
-194,156,176, 28,253,134,130,162,143,119,109,128,214, 82,212,  3,235,139,144, 53, 26, 25, 60,171,133,250,108,103, 79,177,145,252,
-124,114,  9,150,182,109,169, 85,117,174,221,107,181, 80,178, 86, 21,101,148,190,232,192,153, 91,166,213,185, 74, 66,187,231, 25,
-203,118,197, 69, 61, 92,136,145, 72,211,122,  3, 42, 14,231, 60, 33,  8, 33,  6, 92,140,109, 13,187, 43, 74,213, 48,103,102,224,
- 28,  3,163,237, 69, 60, 34, 77, 81, 64,175, 93,173, 80,108,112,141, 48, 24, 14,113,131,  1,174,113,168, 75, 81,187,138,  9,123,
-115,185,118,218,132,  5,109, 27,168, 57,162,116,209,125, 46,155,155, 99, 96,139,214,196, 49, 70, 42,181, 22,130,222,149,141, 64,
-202,198,142, 50,  7,248,206,205, 55, 28,144,210,219,208, 34, 10,148,148,124,243,222,225,157,199,121,105, 85,192, 20,253,114, 83,
- 84,216,149,212, 37, 47, 78,186,182,175, 69,157, 99,110,125,154,107,227,197, 34, 29,103,185, 43,113,169,148,102,224,187,235, 73,
- 93,235, 60,149,213, 63, 27,105,159,110, 14,145, 32, 30, 93,141, 72,109,138,119,197,208, 98,218,209,183,179,155, 97,116, 59,184,
-173,169,225,137,127, 52,132,143, 66,248, 48,248, 71,128,236,162,221,252,133, 33, 12, 31, 14,254,  7, 97,244, 44,216,242,110, 56,
-235, 93, 44,159,215,112,225,107,215,248,194,254,154,176, 99,192,164,130, 80,203, 92, 61,111,119, 95,  6,133,  7, 23, 91, 97,160,
- 20,202,209,114,186, 68,163, 19, 51,117,216, 57, 97, 58, 39, 51,158,107, 66, 99,157,162, 84,138,188,149,164,218,244,202, 38, 93,
- 44, 22,124,172,169,143,134, 46,130,204, 10,  4,181,222,229, 41,130, 76,139,124,229, 18,159,238, 61, 12, 27,207, 82,149,192, 31,
- 13,169,217,144,165, 77,150, 92,100, 84, 69, 54,133,200,120, 29,170,115, 87,112,255,118, 59,114,225,165,176,252,221,224, 31, 99,
- 25,209,195,176,241, 39,112,231,223,167, 29, 73,214,  6,104, 93, 37, 69, 89, 19, 90, 23, 94,134, 77, 42, 81,195,106,213,115, 83,
- 33,167,198,196,  8,108,220,  4,163,207,129, 63,183,203,226,250, 49,178,213, 83,225,169,172,254, 59,228,197, 45, 74,167,232,151,
-174,251,153, 22,250,145,156,109,148,130,135,204,185, 64,135,105,  5,124,242,242,107,235, 37,148,231, 66, 44, 74,233,234,144,212,
-230,161,145,156,109, 74,254,136,104,171, 84, 15,139,125,168, 10, 65,100,152,235, 51, 45,212,134, 12,  3, 73, 77,144, 92,212, 86,
-164, 89, 42,171, 53, 66, 99,105,144,145,135, 81,147, 64,127,205,186,176, 45,249,178,139,152, 24,157,155,158,125,219,109,173,165,
- 97,165,141,132,103, 22,149,249, 66, 79, 80,219, 25,122,233, 68, 66,101,254,191,141,168, 23,218,237,150,101,116, 25,196, 93,217,
- 11,159,252,124,148, 70, 58, 70,195, 47,168,237,197, 40,248, 80,232, 63,102, 22,137,175,197, 34,197,145,169, 97, 43,225,245, 11,
-145,244,204,126,183, 34,176,197,193, 86,  7,187,114,103, 57,157,103, 15, 22,235,172,115,254,119,104,121,250,213, 96, 81,119,209,
-  1,186, 44,161,203,116,250,208,198,228, 97,163,146,181,  0,180,220,122,216,119, 29, 28,218,220,117,119,207,148,173,  8, 19,  7,
-  7, 98,231,184,102, 96,159,153,224,174, 44, 27, 91,100,134, 68,231,203,197,114, 95,  9,111,218,139,156, 78,105, 59, 22,182, 84,
-116, 94, 75,186,115,173,172,204, 88,172, 13,246, 64, 82, 47,132, 88, 56,  7,200,252,198, 47,142,  5, 81,158, 93,127, 85, 86, 48,
- 20,226, 79, 93, 16,124,199,133, 40, 62,177,173,202, 58,129, 97,140,224, 93,219,236,  9,107,252,165, 20, 37,106,222,155,248,210,
-208, 81,  5,245, 66, 12,190, 91,  3,231, 74,239,148, 89,104, 24,212, 80, 25,176,107,244,196, 24, 76, 68,151, 78,180,109,198, 38,
-146, 54, 38,107,215, 20,103,167, 24,139,206,149,101, 40,161, 93,185,168,152, 16,112, 49,239,218,121,192,106, 98, 56,215,129,119,
-209,  2, 76,139,182,164, 45,237,104,162,  8,113, 21,174,242,214,109, 44,183, 19,143,150,103,113,115,191,111,213,247,185,182, 90,
-156, 85,151, 41,206,249,162, 17, 14,182,139,155,229,  6,179,154,214,169,149, 97,165,186,111,103,194,166, 76, 47, 13,173,215,117,
-162,144, 21, 85,215,230,243, 98,180, 36, 98, 19, 19,168,103,129, 85,140, 86,235,188, 53, 21, 78,179,110, 15, 95,192, 89,110, 55,
-126, 30,194, 13,224,215, 65,206,164,173,110,213,202,202,175,158, 12,225,177, 48,124, 38, 60,253,151, 25,251,235,121,216,207,110,
- 16, 14,215, 76, 54,109,164, 86, 87,  0,  0, 32,  0, 73, 68, 65, 84, 13,208, 40,204,172,172, 13,117, 86, 74, 21, 16,141,120,201,
-145,121,209, 47, 64,244,232,125,222,181, 83,190,107,177,106,204,111,242,146,115,222,182,249,139,116,212,190,  3,196,107,218,240,
- 38, 59, 14,174, 75,173,136,183, 62,251,182,  0,135,  8,117, 78,158, 23,249,202, 88,212, 58, 59, 67,180, 61, 59,  6,156,254,228,
-205,204,110,217,224,246,235, 55,208,232, 80,137,120,107,240, 50,116,202, 74,163,140, 86,149,106,251, 50,238,223,239, 68, 46,126,
-  6,172,124, 27,248,179,211, 61,141,  7, 97,227, 47, 96,223, 31,194,190, 25, 28, 89, 70, 39,210,133, 63,217, 59, 30, 89,171, 93,
- 89, 74, 83,187,217, 72,165,109,177,  6,181,120, 72,150, 32, 12,160, 57,104,101,140,227,244,188,137,200,138,107, 55,239,112,  8,
- 98,247,170,178, 46,  6, 98,224,215,138,154,178, 76, 81,230,119,  8,201,142,144,196, 98,247, 52,159,247, 52,176,232, 35, 42,234,
-147,130, 94, 85,137, 77,162,  1,235,188,235, 91, 73,227,105, 18, 80, 13, 13,212,146,198, 65, 90,125, 73, 17, 28,204,139, 85,233,
- 20,204, 57, 63,235, 45,146,207,115, 35, 88,  4, 95, 73, 98, 80,106,159, 82, 40,174, 16,126,173,  6, 83, 93, 91,241,126, 46, 11,
-171,173,244,105,174, 65,140,129,187, 47, 34, 77,151,233, 92,203,217,143,236, 30,  4, 43,221, 35, 90, 35, 36, 55,191,209, 71,217,
- 11, 60,231,156,231,183, 93,234, 26, 40,185, 98, 83,140,170,136,238,181,248,123, 25,132,100,186,119,106,117,222, 89,  0,217,230,
-174,139, 50,182,177,149,190,197,185,  8, 53,117,130,219, 36,202, 22,139,208,243,  6, 51,235,154, 90,149, 12,164,235,170, 22, 84,
-219,136, 87,205,145,202,180,251,145,152, 54,205, 81, 91, 65,202, 46,121,180,245,240,176,100, 13, 92, 98,  1,218, 27,218, 53,228,
-177,154,156, 54, 90,141,197,255,174,232,172, 55, 20,216, 41, 41,107,181,186, 64,251,151, 84,123,174, 47, 47,219, 28,151,243, 61,
-235, 41,188,  9,243,252, 28, 91,107,247,172,108, 74, 99,205,110,  6,237, 30, 33,202,216, 54,169,137,226,152,105, 74, 75,206, 49,
- 42, 11, 93, 39,243,248,  9,116,142,151, 22,165,144,181,118, 44, 90, 60, 74,137, 91,236,218, 82,165, 29, 66,173,169, 79,118,202,
-157, 53, 43, 11, 70, 73,136,235,182,151,105, 53, 25, 62,  9,175,243, 53,121, 47,109,247,208,178,226,168,235,157,146, 38,103,221,
- 52,104, 84,134,131,  1, 50, 24,128,247, 52, 26,105,130,109,239, 37, 69,251,115, 75, 53,231, 52,135, 58, 33, 70,215,130,186, 22,
-122, 55, 10,167, 46,179, 27,173,242,175,108,229,160,133,104,161,108,174,172,161, 19,191,209,182, 88, 44, 55, 40, 20, 42,239,169,
-  6,  3,219,116, 69,219, 19,240, 57,143, 46,105, 55,143,174,239,124, 74,196, 59, 21,156, 79, 91,185,138,184,164, 42, 52,241, 66,
-234, 45, 46,157,112, 46,154,208, 76, 18,  5,152, 23,142,129,171,210,131,144,180,229, 95,202,245, 40,131, 65,100, 36,145,213, 25,
-168,183, 93,192,170,172,116, 17, 43,129,154, 90,136,107, 84, 45, 13,140,182,194,240, 76,235, 46, 55,235,166,143, 59,195, 92,199,
-195, 73, 57, 47, 51,112,103, 89,158, 54,231,113, 43,240, 43,224,159,  0,254,106,248,218, 31, 99,116,240,163,156,251, 11,107,108,
- 12,132,125,227,  1, 97,102, 37,110, 14, 42,141, 86,163,191,176,125,170, 83, 19,164, 56,212,182, 49,108,159,141,115,136, 79,187,
-215,137,179,146,108,149, 86,240,182,216,162, 80,212, 33, 46,  9, 50, 68,230,235,102, 41,104, 45, 53,192,240, 89,160,232,160, 14,
-210, 46,226,174,227, 14,238,210, 21, 52, 90,165,196,146,  8, 59,207, 24,176,233,235,246,176,241,215, 95,164,250, 72,164,118,169,
-191,184,143,138,175, 34, 35,  7,163, 41, 84,155,150,144, 23,111, 69, 46,185, 28,150,191, 29,252, 25,166,186,219,128,213,191,133,
- 35,127,  4,  7,215,208, 91,151,173,152, 54,116, 53,112, 89,181, 84,169,209,238, 46, 37,134,227,134,129,183,218,243,200, 59,223,
- 53, 16, 15,147, 50,199,131,228,132,229,221, 51,170, 28, 81, 88,149,134,164,252,185, 20,125,165,130, 21,193,184,146, 82,141,166,
-148, 53, 79, 41,198, 46,130, 25,121,211, 78,132,142,122,174, 85,209,186, 83,209,151,189,229,203,157,208,162,213, 38,138,149,222,
-168,237, 45,208, 53, 54, 41, 34, 89,235,  6,169, 11, 27,193,248,162, 31,122,110, 88,130, 36, 86,139,130,117,136,164,241,147,155,
-224,212, 69,243,150,105, 76,206,243,192,162,200,188, 11, 90,166, 77,115,143,139, 44,228,202, 98,215,156, 14,240,  2,155, 69,152,
-137, 48,139, 16,102, 41, 91,181,236,148,218,218,156, 46,164,191,231, 42,105,124,177, 80, 58,165,213,207, 80, 68,236,177,232,242,
- 85, 89,202,168,235,248,215,  1, 90,217,113,174,234,146,110, 93,202,160, 43, 54,201, 11,100, 91,149, 80,  2,217, 72,186,146,181,
- 97,225, 80,143,172,246, 56, 59,103,153,101,136,196,174, 63,129,209,232, 19,203,211, 79,138,  8, 59,  2, 35, 73,187,203, 73,219,
- 66, 54, 57, 93, 91, 92,102,210, 18,104, 30,116,112,208,154, 30,141,173,252,176, 46,168,247,134, 46,135, 31,179,  0,205,156,184,
- 45,214,195, 35, 26, 72,104, 17,249,181, 75,254,209, 90,  2, 46, 52,173,202, 14,195,176, 45,111,236,214,137,220,242, 55,167, 66,
- 93, 78, 45,154,192,174,220, 68, 39,231,216,115, 91, 91, 45,158,213,162,163,154,230,136,180,192,159,  5,154,117,209,130,185,116,
- 54,145,249, 84, 69,238,117,223, 54,190,210,174, 26, 37,111, 98, 86, 70,195,101,202, 39, 20, 27,190,232,194,118,177,185,147,100,
- 87,226,215, 61, 67, 80,154,216,160,179, 72, 21, 35,126, 52,196,251, 10,156, 35, 74,147, 34,124, 85,156,119,120, 95, 17, 68,168,
- 67, 64,235,218, 82,216,243,169,175, 50, 13, 94, 74,213, 43, 76, 81, 45, 90,182,113,237,132,106,226, 92,231, 33, 47,108,186,146,
- 85,172,105,115,151, 20, 85,123,231, 16, 95,181,106,245,188, 53,167, 56,151, 64, 61,119,  5,114, 98,226,175, 20,174, 59,231, 24,
- 84,149,  9,232, 82,225,191,119,130,183, 99, 58, 17,196,167,200, 31,180,109,220, 34,206,227, 84,241, 18,210,228,210,152, 60, 41,
- 81, 70,218, 88,119,180,  6, 95, 69, 42,175, 12, 53,166, 14, 90, 62,166,156,143, 75,139,107,218, 68,229,136,221, 22, 43,210, 25,
-140,210, 78, 94,126, 79,  2,104, 61,146,186,148,101,223, 88,150, 82, 52, 79,128,184, 14,220,  4,178, 59,213,182, 35, 41, 55, 47,
- 86,224,226,207,129,229,159,130,231,124, 63, 75,255,252, 37, 46,120,199, 42,205,110, 33, 12, 43,166,117,154,236, 81, 99, 90,140,
-124,161, 98,199,132,126,178, 56,217,180,235,113,158,127, 31, 45,154, 95,216,  3, 89,138,189,207, 93,238,223, 94, 76,150,178,113,
- 77, 37,243, 11,107, 91,106, 29,157,245,162,183,221,152,108,177,206,173, 98, 67,148,118,235, 94,205,251, 21, 19,217,248,226, 12,
-255,219,159, 99,237, 11, 83,178, 94,207, 71,197,123,101,105,  0,203,179,200, 64, 60,238,210, 49,242,148, 11, 97,229,155,147,126,
- 33,235, 95,103,159,129,181,191,134,201, 26,122,104,  9, 14,154,148, 62,187,255,  3, 91,106,  7,214, 66, 77, 12, 25,227, 97,  8,
- 71, 18,113,  2,200,104,106, 66,199, 17,232, 56,109,240,162, 70,216,233, 65,104,214,208, 91,103,201,121,114,138,107,253,248,172,
-120,215,162,191,123,177, 64,200,194,150,138, 11, 17,115,219, 89, 47, 40,193,  9, 33,104, 42, 67, 11,133,128, 39,206,111,112,145,
-201,135, 58, 80,180,230,237,162,199,178, 43,149, 22, 98,179,118,175,112,233, 22,115,219, 80,217,132,109, 93,139, 90,231, 32,  6,
-105,119, 33, 11,182,169, 71,  6, 22,111, 73,201,124, 94, 83, 75, 19,148, 61,217, 61,221,126,208, 89, 37, 92, 21,170,245, 96,224,
- 53, 44,  6,227,118,149,255,159,175, 55, 15,182,109,187,202,251,190, 49,230, 92,123,239,115,238,185,247,190, 70, 79,122, 79, 72,
-168, 65,  2, 44,  4, 18,141, 19, 11,132, 93,136, 96,226, 34,193, 21, 87,108,210,144, 30, 87, 58, 10, 59,142,157, 96,167, 41, 39,
- 16, 92,130, 74,140, 93,216, 36, 85,164, 82, 41, 39,184,202,105, 42, 78,170, 82,128,177, 33,216, 70,142,145, 82, 70, 52, 22,168,
-  1,233, 73, 79,175,185,253,105,246,222,107,173, 57, 70,254, 24, 99,204, 57,215, 58,231,137,170,139,164,251,238,187,231,156,189,
-247,154,115, 52,223,247,251,240, 13,207,111,240,238,127,250, 20,191,250, 51,151,248,229,151, 71, 12, 94,140,172,179,187,155, 37,
-170,  5, 55, 37,180, 11,125,109,125, 91,252,158, 23, 45,117,204,234,  7,173,233, 12, 26, 79, 32, 32, 48, 65, 16,228, 21, 14,150,
- 59,202,220, 83,108, 69, 65,176,217,137,150,239,130, 58,  9,114,195,214,128, 76,106,159,155,  8, 66, 98,  5,178, 79, 18, 35, 10,
-247, 92,180, 75,108,232,138, 37,165, 26, 55,139,238,243,181, 87,224, 68, 91, 88,244,  9, 89,105,122,207,185,240, 99,160, 95,125,
-  0, 41,107, 59, 29, 90, 44, 46,193,196,126, 76,134,140,141, 11, 73,137,174, 91,  8, 87,177,166,180,230, 99,116, 36,183, 89, 67,
-121,174, 85,192,166, 93,163, 18,120, 86,168,125,254,250, 53, 72,192,109,242,130,218,215, 19,225,168,119,229,214,  9,203, 81,151,
- 19, 30,244,144,154, 27, 26,143,122,182,117,  5, 72, 16, 46, 89, 21,224,212,245,178,237,153, 39,177,210,132, 58,142,  5,  0,204,
- 46,188,235,197,200, 88,217,  4,209,225,136,117,158,236,188,223,108,145,242,  0, 30, 54,182, 99, 71,100,105,152,181, 45,229,  1,
- 99, 74, 40,211,100,192, 49,135,128,232,226, 51,175,221, 24, 30,200,188,130,185, 48,150, 59, 91,234,212, 62,177, 51,172,249,230,
- 61,182,134, 19, 56,101, 83,155,147, 81,232, 82, 74, 32, 50,188, 93,100,168,163,238, 85,172, 99,207, 41, 25,  2, 47, 15, 24,134,
- 12, 38,118,242, 27,213,164, 26,114,149,124, 70, 67,242,162,248,241, 19,  2, 41, 78, 38,192, 98,182, 52, 54,178, 23, 95,164,216,
-238, 35,145,217, 40,252, 82, 25,152, 76,229,152, 25,213,195,160,126,108,146,195, 30,105,107,177,158,228,131, 72,189,112,107,219,
- 73,231,247,187,242, 93,237, 96,255,153, 30,248,205,249, 92,231, 16,118, 86, 23,191,  3,184,251,131,192,159,252,115,184,243,153,
- 25,239,248,212,  5,248,141,183,112,127, 59, 96, 62, 26, 69,206, 94, 23, 93, 10,125,180,239,140,109,174,107,111,100, 89,172, 75,
- 40,185, 11,192,137, 35,245,208,241,247,132,185, 57, 27,210,106,150,198, 43,128,141,118,188,205,  4,211, 38, 12, 84,236, 98,170,
- 23,  6, 67,252,240, 39,  7,240,219, 56, 90, 92,129,201,184, 60, 31,113,249, 91, 19,116, 86, 80, 86,100,143,103,220, 50,176,157,
- 20,121,  2,248,214,  6,244,221, 79,129,222,240, 33, 32,191,195,156,  4,162,192,241, 55,128,199, 63,  6, 92,190,  6,125,204,192,
- 61,  0,151,179,181,141, 89,141,159, 26,105,170,224,118,178,232, 19, 96, 26,161,135,226,179,208,160,125, 28,172, 56,147, 51,212,
- 17,  9,200, 71, 37, 19,176, 87,240,134, 45,104,131,151,193, 19,157,147,176, 98,124,165,178,178, 13,196,211,175, 59,120, 85, 80,
-  9, 89,232,138,136,182, 56,215,174,139,212,110,119,169,175,211, 28,173,125,192,137, 26, 47, 92, 59, 44,171,118, 95, 91,169, 57,
-252, 42,191,220, 21,236,228, 73,120,232,226, 81,197,219, 51,233,144,170,179,171,254,143, 26,194, 62,237,186, 74,237,180, 52,203,
-232, 99,234,118,207, 91, 50, 94,253, 11, 74,120,255, 31, 60,197,233,191,121,  7,219,159,189,170,214, 53,238, 18,227,184,187, 48,
-146, 94, 79,227,162,142,140,113, 83, 42, 87, 15,138,209,213,161, 26,123,216,210, 21, 38, 49, 54, 47, 21,108,211,237,163,187,253,
-118,118, 91,219, 72,192, 99,233,149,217,129,252,180, 17,230,232,113,203,226,191, 71,110, 55, 82,191,240,  7, 87,197,239,213, 46,
-208,193,223,176,  9,237,163, 26, 52,181,216,229, 39,143, 52,141,124,128,212,105, 41,118,190, 34, 56,135,141,242,147,183, 37,167,
-158,135, 62,106,103,159,243,226,176,207, 40, 63,243, 21,229, 57,155, 48, 82,174, 73, 63,175, 99, 78,251,157,255,224, 95,239,110,
-108, 50,189, 43, 15,145,221, 50, 19, 93, 61,164,198,181, 30,221,180,111,215, 67,179, 16,104,106, 15,209,137, 85, 81,247,204,  4,
-211,127,238,192, 72,181, 19,167, 37, 65, 79, 87, 52,123, 44,120, 42,161,159,208, 58,238, 78,126,206,217,100, 84,155,211,136,130,
- 43, 98, 55,231, 92, 10,142,211,132,195, 60,161, 76, 99,181,160,  1,203,253,127,191,223,142,226, 71,165,128,230,201,154,221,148,
- 81,105, 92,206, 49, 97, 21,156,230, 13,238,156,222,194, 40,130,253,120,196,241,112,133, 50, 78, 62,169,190, 62,137, 85, 27, 88,
- 54, 59,219, 98,180,162, 77,125, 30, 98,170,200, 48,143, 87,141,252, 93, 53,101,123,170, 34,  8,179,172, 49, 56,101,100, 78,181,
-155,108,188, 94,139, 98,205, 57, 33,109,118,200,195, 96,127,142,185,238, 10,153, 21, 36, 77, 46,166,101,114,236,100,100,114,183,
- 15, 93, 82, 49,161, 15,181, 29,196,204,130,193,173, 20,  3,169,119,187,193,231, 85, 83, 54, 66,124, 47,191,241,169,122, 36,146,
-240,162,118,180, 83, 81,157, 35, 30, 62,117,106,219,175,249, 69, 64,146, 21,  1,229,  4,200,123,159,213, 60,239,221,224,108,227,
-121,218,218,158,253,203,254,109,208,135,127,  2,207,254, 25,194,240,233, 43,108,158,222,226,254,201, 22,147, 88,138,121, 17, 65,
-138,220,120,132,117, 40,222,167,226,247,122,248,139,169,225, 52,125, 44,100,183,120,  0,101,196, 20,241, 10,176,219,225,  8,166,
-255,163,149,107,129,186, 93, 89, 28,126,169,250,147,217, 94, 67, 16,144, 61,148,193, 25,176,197, 17,183, 85,105, 81, 59, 24, 65,
-113,101,188,178, 93,150, 67, 17, 12,131,133, 61, 12,163, 32, 99,  0,127,231, 25,240,190,247,  2,187,239, 48,135,129, 42,112,249,
-191,  1, 79,126, 10,120,248,  4,122,121,215,230,140,231, 19, 48,205, 14, 62,247, 10, 98,172,251,  2,159,245,205,192, 60, 67,247,
- 98, 39,220,193,143,164, 13,  3,233,224,116,158, 51,160, 92,180,121,169,138,193,105, 78, 18,176,201,224, 50,129,187, 21,211,130,
-234,129, 46,165, 80,219, 62, 14,162,203,  0,130,190,227,171,216, 92,109,160,144,213,  5,190, 16,244,116,118, 42,155, 37,120,103,
-121,195,154, 35, 50,204, 37, 89,107, 28,104, 12,174,208,145, 54, 81,209,110, 12,207, 97,241,210,118,145,  9,154,165, 38, 58,138,
-112, 52, 76,142, 13,141, 75, 44, 84,248,245, 66,247, 14, 56,124,232,115, 80,  7, 97,105,100,145, 66,246,185,164,248,153,255,245,
- 28,227, 79,159,227, 69,  8,118,201,192, 76,  2,198,134,212,138, 31, 93,122,164, 99,146,128, 46,103, 59,105,135, 17,213,102,117,
-138,215, 54, 16,212,140,101,154,215, 90,115, 48,160,157,117,234,175,217,220,145,200,212,161, 65,147, 11,200,230, 78,123, 42, 29,
- 72, 72, 17,161, 71, 46,248,165, 38, 51, 30,200, 45, 73,218,  0, 50,123,255,187,178, 11, 86,135, 14,113,155, 86,106,247,173,167,
-140,165, 46,177,237,177,127,223, 33,180,123,150, 45, 29,237,  1,  3, 79, 92,184,122,219,133,199,231,164,139, 80,155, 30,248, 19,
-175,195, 22,150, 53,176,247,130,101,132,122,182,122,179,  7,246,250,171, 30, 78,149,  3,236,211,239,186,125,242, 19, 58,129,109,
-247,239, 14,174,152,135, 11,155, 79, 42,165,143,112, 80,197,168, 38,150,139,145,249,184,198, 46,175,172,110,  3, 53,138,223, 76,
-141, 58, 55,119,197,219,210, 47,212, 79, 40,173,233, 65,209,133,126,131,137,171,223, 92, 59, 38,187,177, 86,212,166, 64,100, 90,
-155, 89,108, 68, 30,233, 72,175, 59, 25,168,  5,166,103,147,184, 90,157,138,149, 64,137, 25, 41,155, 23,160, 68,234,155,152,120,
-249,108,179, 67,202,  3, 84, 21,135,162, 80,153, 22,200,183,102, 51,180,239,223, 47,111, 90, 82,243,251, 31,154, 86,187,245,168,
-112,220,119,206,204,200,236,187,111,207, 89,207,105,112,197,238, 12,242,  2, 32,172,103,214, 88, 15,200,219, 19,228, 97, 99, 94,
-117, 17,171, 62,  2, 74,224, 47,114,242,  7, 69,157,186, 67,162,213,187,170,126,177, 23, 53,166,245, 76, 82,247, 53,  2, 69, 73,
-126,121,176,237,233, 21,230, 63, 54, 86,175, 29, 16,137,213,194, 77,152,124, 20,171,109, 96,232,227,123, 83,172,133,173,224,137,
-237,107,233,204, 21,242,  5, 24, 95,  3,142,143, 77,117, 77,  3,144, 79,129,225, 37, 96,243,110, 19,123,213,180, 55,191, 60,242,
- 63,  3,188,227, 17,232, 47,254, 52,238,254, 88,198, 87,254,202, 37,238,239,103,124,241,108,131,139, 77,178,145,148,174, 19,162,
- 18,136,220, 55, 46,182,163,141,189,121,140, 58,219,174,181,184,163,192,239, 62,170,102,132,166,204,142, 29, 30, 45, 85,182,253,
-199,159,107,209,228,108,113,127,255,  6, 17, 28, 99,100,235,133, 87, 32,130, 99, 95,184,113, 31,103, 17,134,170,243,195, 60, 24,
- 60, 51,176,133, 98, 56,  0,252,230, 45,248, 59,159,  5,206,254, 89,128,223, 98,213,198,254,231,129,123, 31,  6, 30,110,161, 47,
-223, 54,176,246,254,104, 34,185, 67,177, 83,109,195,141,249,121,226, 55,176,  8,116,242, 69,225, 69,  1,206,221,112,157,  0, 61,
-177,211,148,240,196, 94,136,233, 41, 19,224,165,231,171, 12,150,178,128, 88,145,242, 42,124,163,187,175, 67,112, 54,251,115,195,
-222,209, 74, 71, 73,161, 46, 59, 65,168, 89,213, 84,174,119,225,235, 78,162, 14,209,220,221, 82, 96,242,142,  5,134,243,134, 61,
- 39,  9,181,177, 52, 53, 25,188, 80,243,169, 43,150,118,163, 45, 90,166,120, 14,237,138,103,106,143,254,158,151,174,224,224, 27,
-138,  0,234,244, 24,236, 68,174, 89,  9, 39,158,247, 61,193, 41,138,218,152,245,191,182,159, 77,254,192, 54,234, 20, 81,100,106,
-251,253, 25,203,144,142,254,181, 41,171, 66, 40,198,253,209, 54,164,232,230,176, 76, 87,171,129, 31, 61,228,100,161,134,239,132,
- 79,104,169,101,232,196,169,163, 51,222,115, 55, 42,159, 53,244, 39,132,141,104,197, 11,247, 69, 90,114,187, 84, 38,251,185,199,
- 96, 58,132, 86,128,218,196,115,232,206, 86,233,128, 50,240,139,153,187,215,124,116,145, 95, 15, 56,186,235,108,142, 43, 69,229,
-196,159,184, 90,254, 42, 58, 94, 93, 70,218,198, 69, 60,120, 98,219, 93,182,221,252,209, 19,221, 84,151,112,153,133,245,208, 95,
-196, 43,255,126,230,110, 85, 64, 93,191,223, 79, 78,102, 88,138, 91,134, 37,132, 62,113, 61, 74,248,248,237,245,233,199,226,180,
-184,136,123,234,101, 20,159,135,206,  9,145, 58,152, 79,193,114,101,164,253,247, 83,159, 81,178,152, 15,245, 32, 21, 78,224,100,
-234,244, 41, 10,148, 88,121,116,141, 45,251,152, 28, 85,241,174,139, 78,125,237,179, 39,220,140, 91, 87,111, 74, 33,132,132, 12,
-164,228,162, 59,182,130,250,176,  7,246, 87, 72, 57, 99, 59,108, 32,219,217, 52, 57,101, 94, 17, 20,151,249, 17,139,228,152, 20,
- 80,128, 62,193,171,114,225, 27,175,157,153,145, 82, 66, 78,102, 93, 35,230,186, 67, 87, 82,187,128, 69, 64,201,246,157,236,248,
-215,180, 25,144,182, 39,200,121,176, 10, 89,102,219, 19,248,195, 81,105,176,158,116, 86,197, 10,209,129, 42,217, 11, 17,112,148,
-216, 93,177,248,152, 73, 43, 31, 24,126, 72, 19,139,189,185,190,231,103,  5,242, 64,224, 29, 65, 95, 30,129,105,219, 41, 50,182,
-166,138,198, 19,127, 12,142, 62,154, 15,193,149, 63, 30,202,192,124,110, 59,222,241,137,185, 63,105,231, 23,251,203,192,240, 89,
- 96,120, 43,176,121, 59, 48, 60,239, 99,124, 15, 10,200,255, 18,240,229,111,133,254,240,127,139,237, 71, 30,226,133,191,126,196,
- 83,159, 58,224,181,243,  9,247,239,102, 92,109,178,117,238,218,209, 76,209, 68, 54, 73, 58,251, 18,213,230,220,170,181, 14,161,
-197,196,190, 79,181, 27,197, 68,216,126,136, 72, 53, 67, 88,145,227,153,188,218,169, 54, 99,247,234,120,187,107,176, 21,237,233,
- 72, 93, 32,200, 54,163,138, 36,139,171,182, 51,  3,155,172, 56, 17, 96,251, 64,144,110,157,128,255,253, 59,192,243, 31,  0,248,
-247,218,235,115,252, 40,240,218, 15, 66,191,144,128,151,110,  1,175, 78, 54,114, 31,103,232,249, 84,151,163,116, 39,219,141, 53,
-251,109, 73,126, 85,205, 98,180,150,203,217, 10,128,139, 14,202,141,193,103,172,175,  0,121,  0, 78, 63,  1,156,190,217,199,253,
-163,189,206,131,171,253, 75,  7,192,232,162, 87,209,141,109,227,105,234, 93, 32,125, 55,223, 79, 61,194, 47, 43,235,157,223,181,
-225, 89,  7, 93,238,196, 97,182, 54,234,108,132,221, 94,176,103,124,235, 13,136,218,190,227, 85, 90, 18,218, 34,164, 36, 98,149,
-231, 98,147,129,156,196,189,238, 77,181,189,130, 13, 47,190, 15, 38, 67, 62,159, 49,225, 93, 91, 35, 61,126,238,114,198,232,239,
-151,168,249,251,137,237, 48,159, 96,228,187,212, 89, 98,  3,122,146,169,187,188,169,167, 36, 82,229, 96,160, 83,119,215,239, 75,
-163,203,210,133, 40, 74,209,209,145,125, 13,216,  3,159,137, 60,167, 66,155, 16,107,232,132,192,221,219,129, 43,116,240, 30,109,
- 44,117, 82,235,222, 12,  8,146,172,  8,246, 96, 36,203,194, 16,100,111, 72,198,107,121, 12, 81, 88,153,204,118,203,158,168, 23,
- 95,211, 39, 60, 83,199,220,231, 94,  0,136,118, 25,238,221,134,120,161,209,225, 42,  6, 34,156,145,105,115,174,168,249,231,165,
-251, 28,104,199,133, 39,239,188,181, 75,129, 41, 55,116,185, 11,203,157, 95,138,167,141,179,233,226, 64, 90,132,200,132,248,110,
- 82,193, 78,200,160, 74,176,201,192,149, 90,240, 75,113,186,154,212,166,237,250,180, 37,246,231,165,251,140,207,139,123,170, 75,
-246,139,238,153,172, 96,141,  2, 42, 43, 28, 40,195,152,181, 88,195,226,205,105,143,157, 21, 98, 71,221,182, 37,125,242, 63,171,
- 76,208, 34,142,121,189,174,245,160,245,115,210, 63,131, 53, 54,220,102, 68, 42,  2, 41,214,177,111, 56, 65, 61, 56,106,158,103,
- 20,153, 49, 31, 38,228,205, 22,219, 97,107, 63,239,  4,232, 44, 46,193,108, 95,120, 49,126, 15,255,166, 89,201,120, 17,124,223,
-103,199,134,162,143,185,243,160, 83,219,129, 51, 86, 51, 47, 38, 91,250, 19,192,121, 64,222,238,144, 55,131,125, 40, 75,  1,100,
-246,  7,183,137,223, 64,228,227,100,187,220,137, 77, 49,207,108, 30, 66, 22,174, 84,181,218,223,104, 40,241,125, 20, 77,246,145,
-202, 68,  6, 26, 16,123,240,  6, 88,103,192, 16, 28, 68, 48,188,116, 64,126,114,  2, 26,238,248, 13, 58,  0,252,148,177,223,213,
-163, 59,245,178, 13,126,244,202, 46,124,221,  1,227,203,246,234,150,  2, 76,159,243,131,126,  0,242, 22, 56, 14, 64,254, 28,144,
- 62,106,185,221,249,141, 54,186,207, 79,  1,252, 12,144,190, 21,244,244, 87,  0,223,241,215, 64,223,244, 81,156,254,163,115,188,
-245,127, 24,241,244,111, 30,112,255, 86,193,195,167,  7, 92, 73,131, 49,196, 97, 22,196,164,152,160, 80, 93,151,232, 34, 24,131,
- 28,239, 26,  7, 63,177, 19,235,  4,117,124, 26, 81,139, 89,165,217, 49,252,  2, 33,191,200,227,214, 96, 47, 42, 70, 89,101, 18,
-248,200, 95, 33, 72,108,100,166, 20,104, 95,182,247,104,195,138, 13, 91,215,176,125, 44,200, 60, 32,253, 71,119, 65,239,251, 61,
-192,246, 95,  4,210,179,192,252, 24,120,244, 95, 65,239, 29,129,151,223,  4,188, 54,  2,247,142,208,227,108,254,118, 47,254,128,
-  4, 28,  5,148,  5,216,165, 38,  4, 40,197, 78,178,189, 71,154, 61,118,144,121,  2,112, 96, 96, 18,232,209,210,241,112,122, 31,
- 24,239,  1,167,129,  4, 46,192,156,128,109,  2,205, 51,136,172,235, 27,177,236,106,226, 69,147,213, 94,177, 79,161,142,124,229,
-196, 22,214,194,115,120,103,253,105,211, 37,136,164,183,101,205,235,253,111,252, 79,159, 96,241,170,203,234,133, 97,189, 24,105,
- 13,111, 70,103,219,193,106, 47, 31,207,238,  9, 24,111,123, 46, 99, 36,197,103,238,205, 40, 52,215,142,149,186,125,183,220, 84,
-192, 16,225, 14, 17,190,249,185, 13,222,242,238,  1, 31,255,196,136,223,186,156, 23,135, 92,216,220,142,176,231, 48,173,232,135,
-189,176,176,247,227, 19, 53,171,228, 90,145,189,176, 63,145, 39,131, 81,103, 81,234, 68, 98, 21,221, 73,109,  7,171, 93,144, 85,
-172, 29,135,174,235, 27,125,215, 30,218,128,177,155,116, 72, 71,216,204, 68, 70,211, 99,219, 37, 83,213, 24,152, 48, 18, 82, 64,
- 40, 85,161,173, 94,  8,164,238, 82, 61,141,203, 52,112,168, 20,175,151,141,163,117,229, 99,239,187,231,210, 93,202,  2,197,  1,
-132,135,254,209,223, 46, 86, 43,218, 32, 61,125, 52,173, 23, 84,115,215,197,110, 98, 50, 67,203,247,191,191,147,194,182,120,226,
-187,253, 30,235, 90,250,245,201,162, 51,181,239,245, 74,  4, 59,102,100, 88, 10,224, 93, 40, 46, 65,120, 66,192,209,223,100,233,
- 86, 65,252, 58, 83,174, 88, 77,245, 89,  0,189,182, 34, 92, 83,235,209,219, 64,192,  9, 39,204,153,113, 80,215,103, 69,  8,139,
- 20, 72, 41,134, 20,  6, 32,204,139,203,152,217,246,224, 51, 39,232,100,202,245, 30,115, 44,175, 35,226,148,192,110, 71,222,168,
-168,107,161,172, 16, 44, 34, 32, 21,155,  2, 56, 53,142, 55,  3,198,194,152,143, 71,148,113, 66,222,110,176,217,108,189, 56,157,
-236,140, 81, 99,170,132,179,161,238, 35,123,242, 82,148,247,139, 93,187,118,123,105, 31, 81,112, 78, 45,137,173,194, 26,218, 40,
- 79, 89,145,192,246,103, 19, 35,101,147,241,179, 20,148,105,118, 48,130,250, 37,220, 14,175, 70, 10,234, 87,  0,236,255, 92,220,
-180, 47,104, 39,164,141,236, 75,114,159, 33, 21,187,252, 85, 65, 69,161, 78,242,178, 58, 90, 48, 36,197,113, 82, 60, 24,129,187,
-  7,193,201,253,  2,228, 59,221, 41,117,199, 61,204,238, 87, 47,143, 93, 16,183,113, 97,213,  3,239,212, 15,246,159,170,192,241,
-  2,120,164, 80,246,233,196, 86, 45,171,114, 24,128,225, 55,129,124,  2,164, 51, 32,191,201,114,193,183,239,183, 78,126,251,131,
-192,155, 62, 11,124,251,223,  4,127,211, 47,226,206,207, 61,193,233, 95, 61,226,238, 23,143,184,247,108,194,227, 13, 99, 82, 66,
-145, 22, 40,172,218,239,  5, 61, 88, 71,189, 93,151,149,240, 45,172,105,210, 82,189, 50,195, 17,137, 45,134, 51,117, 99,124,237,
-132, 58,209,  8,167,254, 50, 17,223, 67,106,105, 65, 47,108,169, 99,153, 26,108,132,201, 84,188, 57,  1,187, 34, 56,217,  3, 89,
- 50,210,127,124, 23,244, 45, 31,  0, 54,127, 28,200,239,178,111,244,248, 17,224,252, 37,224,252, 25,224,188,  0,143, 39,232,126,
-130,202,232,227, 41, 95,242,110,124, 32, 71,158, 69, 26,163,163, 25,192,113,178, 86,229, 48,155,124,124, 95,108,143,126,167, 24,
-166,173, 36,168, 38,208,120,116, 15,251,209,233,129, 78,218,219,154,234,149,198,229, 72, 43,186,162, 88,121,228, 58, 10, 39,204,
- 22,140,187,184, 64, 99, 76, 23,175,225,228,251,119,238,133,112,157,112, 38,119,187, 92,237, 68,106,253, 57, 36,180, 68,243,162,
-131,111, 68, 68, 37, 24,160, 98,  5,150, 82,191,139, 84, 27,165,118, 23,251, 12, 96,235, 87,226, 83,204,248,125, 31, 60,195, 27,
-254,194, 11,120,245,207,126,  1,159,250, 59,179,243,174, 27,226,185, 87, 29,235, 74,152,182, 35,224,133,129,145,  7,224, 31,127,
-102,194,199, 30,140, 53,250, 56,246,185, 17,229,155, 86,153,  4,165,195,124,246, 73,112, 88, 81,211,214, 34, 65,209,101,244, 42,
-212, 25,220,157, 35, 64,186, 17,113, 19,124,209, 34,231,156,176, 20, 90,201,234,130,232, 33, 42, 49,209, 52, 75,150,239,248,201,
- 58,206,  1,166,235, 17, 87, 29,176, 42,164,216, 33,157,124, 58, 80,193, 40,145,201,237,123,242,  1,141,230, 55,118, 98,193,209,
- 87, 22,235,238,111,125,185,150,134, 21, 89,188, 94, 83, 23, 85, 29, 84,190,129, 90, 19, 36,212,118,178,218,141,203,201,245, 17,
- 73,151,118,193,254,125, 15,  1,219,222,139,166,125,199,250, 23,234, 47,179, 54,133, 58, 70,178, 96,  8, 51,197, 46,161,157, 11,
-229, 50,247,206,141,246,179, 73, 87, 12,233, 74,216,169, 93,166, 58,187,250, 63,185, 45, 45,  7,228,104, 85,  8, 36,  0, 39, 76,
-216,229,132, 43, 78, 96, 50, 31, 72,124,174, 98,242, 34,218,214,204,228,  5, 68,114, 33, 93, 78, 70,  7,  5,180,114, 18,250,162,
-171, 47,172,117,241,153,215, 14, 17,219,141,245,189, 24,157,139,233,189,192,132, 76,140, 97,216, 32,109,  7, 28, 64,152,199,  3,
-100,182,142, 93, 55,155, 54,110,137,194, 70,125,149,101, 85,101,199,238,236,128, 38,  1,156,169,149,180,170,  5,137,228,140, 60,
- 12,246,207,164,212,200,204, 32,190,241,144,253,211, 27, 73, 54,  9,156, 51, 56, 49,168, 20,136,204, 80, 41, 80,  7,232,179, 42,
-152,115,165,197,177,123,131, 99,164,111, 19,  4,139,164,171, 47,150, 10,164,204,181,116, 47, 69, 48,137, 88, 55, 79,254,248,178,
-121,134, 38, 81, 20,255,129, 51,219,155,240,104, 86,156, 23,197, 41, 19,228,179,151, 72, 28, 53,237,224,244, 56, 87,189,203,  4,
-140,143,128,233,220, 99, 59,189,143,144,217, 41, 55,197, 61,209,  9,250,144,128,203,226, 86, 47,  1,210,  0,108,  4,184,117,  4,
- 54, 87,160, 91,175,  1, 39,191,  3,156,126, 12, 56,249,  8,112,250, 71,129,221,215,  2,249,107,140, 39,255,220,191,  0,252,177,
-255, 14,249,  3,191,140,167,127,232, 10,183, 62,122,196,131,167, 20,175,158, 38, 92,177,145,205,180,248, 69,236,243,161,226, 43,
-127,144,127,201, 24,203,166,198,191, 14,241,202,228,116,179,129, 66,217,171,222,173, 53,219,143, 22, 44,  4, 24, 97,245,176,192,
- 24, 66,164, 32,155, 99, 91,235,  1,149, 56, 33,195, 94, 95, 26,  8, 36,100,126, 76, 98, 12, 40,216, 22, 32, 29, 18,210,119,237,
- 64, 31,250, 32,176,253,  1, 32,189,221,118,220,227, 39,129,199,127, 21,250, 88,129,171,  1,184, 56, 64,175, 70,232, 60,154, 80,
- 37,164,215,147,135,203,108, 59,226, 78, 96, 14,103,  7,148, 31,102, 99,121,206,165,209, 40,164,  3,214, 87, 14,190, 99, 44, 40,
- 25, 41,240,105,  6, 31,  7, 80, 73, 72,251,185, 93,  2,106, 21, 60,121, 81,107, 35, 59,191,156,184, 49,224,129,101,152,206,181,
-145,181, 46, 53, 41,178,218,189,133,240,148, 58,185, 49,173, 56,225,241, 32, 14,238,102,156,252,247,178,239,249, 69,218, 51,203,
-170,182,250,208, 22,214,  3,237, 44, 88,158,  6,118,139,  8,207,159, 18, 18,  4, 95,248, 51, 95,196, 71,255,193, 30,133, 21,236,
-227,126,137, 14,182,142, 78,237,178, 72, 30, 25, 26,  0,143,  7,170,248,200, 43, 19, 62, 63,154, 62,102,227, 99,213,190,211,207,
-206, 20,239, 23,129,125,209,180,238,114,210, 74,115, 16, 59,113,193, 82,231, 16,228,183,212,133,187, 20,119, 41,172,199,160, 10,
- 93, 30,178, 29, 42, 91,169, 53, 19,145, 11,111, 54, 48,138,  0,100, 36,143,232,132, 11,179,226, 16,159,213, 71,168,106,196,244,
-172, 97,205,210, 90,115, 22,109,182, 81, 90, 41,200,185, 35,233,237, 60,253,237,194,247, 47,195,202,170, 90, 47,225,213, 37,222,
- 10,126, 59, 63,139, 39,191,197,180, 35, 57,211, 32,146,210,160,171, 41, 19,150,176,149,158, 37,191,166,226, 21,135,247,204, 30,
-120, 67, 14,224, 25,130, 82,184,176, 72,155,197, 47,166, 29,213, 89, 64,138,137, 25,163,  2,231, 80, 15,227,  2,230,110, 79, 21,
-133,100,233, 26,144, 21,173,182, 70,232, 82,151, 46,154,233,186,206, 85, 59, 24, 82,160,203,137,184,174,155,227,253,158, 92, 38,
- 71,157,118,172,196, 63, 39,152,176,155,236,206,113, 38,118, 43, 98,110,  0, 65,233, 13, 66, 77,237, 94,237,228, 43,106, 35, 88,
-218,132, 32, 30, 90, 34, 32,243, 14, 39,187, 45,142,  4,200, 52, 65, 75,193,144,  7,232,206,182,195, 82,196,159,123,110,121,  7,
-113, 96,145,106,173,240, 35, 48,190, 39,186, 41, 28,147, 55,100,195,215, 21, 35,104,176,251,208,137, 25,196,  9, 57, 15, 64, 82,
- 87,109,251,229,222,147,234,136, 77,225, 94, 49,131, 92,177,177,213, 35, 79,214,  1,234,108,150, 32,134,123,160, 41, 24,244,228,
-251,245,134, 80,181,221,165, 56,145,139,192, 62,119, 19,241,205,131, 10,114,178,136,201,215, 14, 86, 60,104, 82,232,111, 78,192,
-120,101,101, 30, 50,192,103, 64,122, 26, 40,  7,187,212,203, 30,152, 30, 57,100,102,107, 74,118,157, 60,233,131, 91,194, 91,114,
-162,196, 49,146, 77, 74,  4, 34,  3, 57, 65,135,236, 92,201,  9,244,220, 63,  2,158,251, 12, 80,254, 40,112,251,187,205, 19,143,
-175,  4,248,135,128,119,254, 50,232, 39,254, 10, 54,255,211,103,241,220, 79, 29,112, 50, 77,120,229,169,  1, 23,196,152,185,133,
-185, 80, 63, 10, 15,166,187,239,175,147,154,248,222,  4, 90,140, 82, 74, 99, 53, 39, 31,189,138,221,105, 34,203, 11, 41, 18,245,
-170,  8, 63,217,133, 62, 73, 49, 37,178, 74, 23,180, 97, 43,152,224, 70,167, 68,160,217, 71,172,172,200, 52, 99, 43, 64, 86, 70,
-122, 62,129,191,231,221,192,233,127,  0,208, 91, 92,180,246, 10,240,248, 47,  0,247, 94,  4, 30, 63,227,212,140,  2, 29, 71,211,
- 78, 68,168,135,167,149,144,114,123, 42,134,  8,188, 38,139, 86,219, 23,127,237, 11,112,144,142, 21,170, 30, 31,235,129,225,105,
-103,235, 16, 20, 63,213, 19,240,116,  2, 61, 86,240,101,  6,243, 92,245, 28,236,187, 81,113,  5,114,176,159,227,196,  9, 60,230,
-216,133, 93,  4,226,180,160,209,225,174,169,175,169, 89,152,250,188,106,213,165,102, 53,210,192,164,235,145,139,119, 35, 73,218,
-133, 24,137,108,203,195, 89,187,  3,180,253,190, 84,184,135, 66, 50,240,138, 42,190,248,145, 61,238,237,  5, 83, 82,108, 32,158,
- 40,104,170,100, 66, 88,149, 26, 47, 94, 59,223,242,164,138,  7, 99,241,245, 65, 88,225,186,159, 69, 91,161, 67,157, 82,189,199,
-127,234,170,147, 90,239,204,141, 11,222,132, 78, 11,237,174, 71, 78,198,229, 92,148, 42,199, 29,221,142,188,  6,165,116,214,205,
- 38,226,178,247,121, 88,121,182, 75,  8,183,186, 78,171,238,125,197,138,166, 66,234, 10,125,109,130, 55, 52,164,109,255,222,231,
-110,108, 28,246, 53, 80,243, 90,199, 24,251, 82,  2,220,210,  8,108,201,223,199, 64,217, 82,119,233,  6, 24,103, 19,100, 58, 23,
-215, 77,213, 57,160,173, 83,247,115,190,172, 71,195,218,108,204,158,132,189,152,156, 96, 53,161,137,220,245,192, 30, 23,103, 36,
-204,126,193,111,220,140, 51,122,212,237,232,231,117,116,224,234, 32,170, 72, 65, 99,109,226, 54,234, 71,146, 55,234, 67, 91,193,
- 86,145,181,126,233,  6,207,127,234, 86,  4,189,120,143, 18, 67,136, 49,139, 66,146,175,146,161,102,211, 37,245,213,101,139, 30,
- 55,  0,145,  9,  7,136,109, 28, 95, 68,204,159, 46,101,241,157,209, 77,147,165,149, 45,176, 29, 31, 38,174,219,228,  1, 24,  6,
-204,211, 12,153,103,168,171,222,145, 18,138, 40,104, 30,145,242,128,147,237, 14, 37, 15, 40,101,178, 36,205,221, 45, 28, 41,161,
-140, 71,228,196,160,156, 77,184, 10,255, 97,250, 47,198, 62, 99,165,152,237,251,  1,192, 41, 33, 15, 22, 89, 39, 50, 87,191, 28,
-197,222,155,204,255,205,137, 45,205,102, 16, 96,158, 33,197, 54, 62, 84,188, 91,135,237, 54,197,103,137,196,201,253,228,210, 20,
-125,222,101, 19,168,146,212, 64,  4, 77,230,103,  7, 19, 56,251, 94,190,113,243,236, 34,240,138, 84,139,225, 56,171,193,221,187,
-254, 39,147,226, 98, 84,220, 25, 20,178, 97,148,207, 95, 33,239,127,221, 70,226,128, 73, 86,248, 13,128,190,  2, 76,143,237,114,
-150,131,117,228,124,102, 23,112,192, 75, 72,218,163,234, 19,  5,236,103,191,156, 86,165,116, 34, 83,110,111, 19,244,139,103,192,
- 91, 47, 64,111,255,239,  1,122,  8,220,250, 94, 32, 63,  7,240, 45,128,190, 29, 56,251, 58,208,247,253,215, 72, 95,243,243,184,
-243,159,141,216, 62,152,241,224,142,224,225,134,112, 84,170,137, 92, 49, 46,227, 16, 84,105, 39,162,153,151,202,146,193, 71, 92,
- 21, 70,227, 39, 91,136, 66,226, 19, 41, 62,128,168,158,209,  4,140,163,160,136, 89,155,  2,153, 26,127,145,138,  5,233, 36, 38,
- 36,175, 16,152, 20,  3, 41, 54, 89,145,103,182, 66,240,219,111,  3,207,255,187,230, 10,208,  1, 56,252, 58,240,232,135,160,175,
-252, 14,240,210,109,123, 29, 47,246,144,151, 14,144,199, 19, 52,140,202,170,203,116, 20,245,211,119,203,253,242,209,118,233, 87,
-  5,216,139,165, 23, 41, 64,194,109, 30,216, 51, 64,137,219,220, 62, 13,192,150, 64, 91,  6,157, 16,240,200, 34, 35,169,227,235,
- 71, 81, 73, 36, 94, 44, 82, 45, 62,133,  0, 46,253,104, 48,240,174,173,133,162,200, 84,184, 97, 31,220,119,165,133,250,188,114,
- 63,176, 57,108,113,221,191, 35,254,169,163,118, 64, 14, 68, 40,172, 77, 83,161, 84,187, 83,238,118,156,169, 59,  4,199, 89, 48,
-122, 81,183,205,246,231,132,218,216,151,161,181, 91,231,149, 15, 62,193,106, 90,246,213, 78,212, 79,226, 57,226,169, 59,196,122,
-191,248,188,210, 35,160,219,  7, 43,150,151, 77,191, 46, 96,213,133, 91,148,234,240,  0,  0, 32,  0, 73, 68, 65, 84, 31,153,171,
-160,137, 22,250,132,232,152,230,  8, 25,234, 68,129, 61,  9, 49, 44,128,201,171,217,158, 63,111,151,191,165,207,165, 46,128, 90,
-220,222, 55,118, 94,106,214,182, 99, 15,250, 92,162,165,127,126, 61,186, 14, 24, 80,234, 70,203, 59,255,217,206,213,  4,109,141,
-139,160,109,229,163,215,  3, 61,178,182, 92,  2,114, 90, 94,228,220,119, 91,187,133, 58,188,116,195, 46,233, 68,108,125, 71, 43,
-120,253,255, 91, 43,210,129, 38,230,155,123, 39,129, 54,215,132, 86, 44,107, 87, 32,213,167,172,217, 10,171,127,124, 45,144, 83,
-186,214,165,175, 59,223,254,178, 79,139, 41,143,143,228,217,194, 65,  4, 97,131, 22,156, 16, 35,167,140,189, 42,138, 76, 94,116,
-115,253,160, 55,122,139, 57,169,192,108, 22,213, 18,197,255,117,225,227, 53,135,202,235, 88, 43,225,  1, 90,156,135,246,249,242,
-149, 52, 68,193,217, 34, 85, 45,161, 84,176,201, 25,154,179,253, 60,121,192,201,102,  3, 85,193,164,132,253,113,223,212,239,210,
-129,100,184,243,123,163,235,226, 65, 14,148, 73,  9, 36,197,147, 40,154,104,160,134,191,248,172,196,160, 49, 25,154,  0,153, 39,
-232, 52,161,232, 17,154,146, 81,227,180, 89,112, 36,  9, 56,  9,  4,201,210,215,220,234, 66, 29,175,176,248,131, 69,170, 16,110,
- 94, 63,234,248,124, 97, 47, 10,111,225,236,220,236,224,117, 15,217, 42,239,131,  0,156,252,128,216, 50,244,162,  0,247,190,  8,
- 60, 51,187,101,109,107,160, 25, 69,227,135,207,  7, 79,109, 59,119,198,228,109,179, 96,233, 33,228,191,230,101,175,234, 21,241,
-244,143,150,203, 11,  2,232,130,129, 29,  3,151,  9,120,116,  2,125,124,  0,126,207,223,  0,189,241, 51,192,217,159,  0,134,119,
- 24, 36,133,223,  4, 12,127, 30,244, 45, 95,  5,252,228, 79, 97,247,103, 47,240,198,151,102,236,238, 20,220,219, 38, 28,  8, 40,
-243,210,165, 96,  9,104,188,176,255,176, 15,226,114, 28,230,188, 76,  7, 51,235,224,242,  1, 10,208, 16, 59, 83, 64, 38, 64,102,
-241,  0,132,110, 84,111,177, 56,182, 99,100, 32,177,212,170, 62,145, 98, 96, 27,191, 51, 18,240,108,  6,222,247, 14, 96,251, 94,
-123,220,198,223,  1,126,231, 95,129,126,122,  2,246,207,  1,219, 45,128,  9,250,185,  3,228,254,222,166, 64, 91,110, 65,237,125,
-203, 23,144,239, 80,229,205,197,160, 52,163,119,233,197, 59,245, 32,251, 30,139,143,239,197,166, 43,228,156, 52,190,101,171,150,
-156,157,194,145,129,204,245, 66,239,205, 52, 33, 46,148, 30, 16,210,227,231,147,125, 89,237, 60,193,232,186,247,222,242,214,187,
-  8,  4, 43,223,115,167,158,143,253, 98, 86, 11, 92, 49,  7,130, 46,  4, 78,150, 87, 99,250,149,112, 95,134,178, 93,253,210, 45,
-165,161, 55,163,181, 81, 81, 92,138, 59, 65, 68, 43,100, 67, 96,227, 79,118, 62,118,189,216,123,114, 94,191,203, 21,173, 65, 26,
-220,113,201, 55, 88,166,  0, 78,139,198,139, 58,116, 15, 86,199,177, 94, 83, 12, 23,159,142,104, 71,244, 91,231,104,211,194, 66,
-214, 52, 62, 49, 82,  7,173, 70,237,126,193,136,175, 46,106,209,210,141, 82,161,186,140,129,173,107,132,182,142,208,149,152,146,
- 87,204,135, 78,146,116,237, 64, 79, 93,238,124,164,177, 21, 31, 81, 71,120,205, 41, 20,183,253,243, 48,  5, 32,199,183, 81,243,
- 10,180, 19, 93,238,142, 34,169,205, 68,115, 12, 43, 82, 65, 13,169,189, 24,101,251, 65, 44, 43,161,165,126,137, 75,125,125,161,
-235,106, 45, 16, 59,119, 46,173,158, 94, 90, 20,151,214,217,254,127,151,174,164, 75,189,149, 51,180, 94,175,243,189,197,251, 51,
-117,133, 78, 95,128, 36, 88,211, 41, 68, 85, 60, 73,106,211, 69, 73, 12, 45,115, 13, 70,169,207,106,112,209, 35, 66,220, 87,194,
-179,216,106,111,137,214,165,165, 72,149,174,179, 37,214,203,  3, 17, 69,153, 38,228,141,218, 72,221,197, 20,  5,  5,165, 20,164,
-153, 64,121,  3,100,155,182,202, 60,130, 83, 54, 16,216, 52, 34,113,130,228,140,195,126,143,195,229,185,133,105,181, 13, 76,111,
- 89,105,221,121,123,184,200,127, 32,179, 17,113,189,208, 19,200, 43,151, 33,  0, 12, 82, 32, 58,131, 99,172,206, 12, 42, 30, 16,
-163,  5,202,106, 98,178, 24,135,184, 15, 75,165, 88,133,162,178,176,183, 85, 43,128, 16,180, 20, 15,183, 79,190,119, 12,232,138,
-214, 75, 93,138, 66,216, 20,199,179, 42, 54,170,102,103, 80,224, 40,  6, 56, 32, 47,  7,101,  3,232,213,  0,253,236,167, 65,239,
-126,  4,224,118, 67, 50,200,149,209,199,202,  8,204,151,192,116,207,163, 62, 47,  0,253,114, 71,197,138,225, 71,  7,110,237, 64,
-148,223,179, 64,167,210, 78,126, 88,178, 21, 10,  3,251, 25,196, 19,240, 56,  3,143, 79,161, 95,243, 43,160, 47,255, 83,192,237,
-239,  3,182,127,  0, 72,119,157, 96,247,189,160,175,122, 30,250, 87,126,  4,233,135,174,112,231,227, 71, 12, 34,120,176, 83,156,
- 15,102, 69, 34, 37, 83,251, 43, 32, 65, 74,243, 90,155,179, 64,103, 79,184,242,198,214, 25, 60,237,225,236,198,248,204, 12,113,
-144,  2,147, 32,185, 85, 70,168, 29,118, 34,189,216,203, 58,242,228,226, 26, 37, 32,179, 98, 67,138,129,216,130,125, 52,129,222,
-117, 10,126,203, 31,180,176,155,178,  7, 30,254,151,208,127,188,  7,238,125, 25,240,  6, 31, 80,221, 63, 64, 62,123,  5,221,143,
- 16,182, 27,135,  6,251,188, 17,183,153, 45, 81, 76, 60,178,203,148,139,253, 58, 22, 96, 20,232, 36, 70,148,  3, 64, 51,217,133,
- 63,139,181,193, 19,128,105, 50,159, 58,109,129,244,156,121,214,  6,  1, 78,  0, 26, 60, 57, 80,101,161, 95, 13,209, 79,100, 84,
-179,243, 14,138, 24,135,154, 85, 65,137, 48,206,122,227,  1,174,235,173,165,243,224, 75, 47,156,235,109,138, 93, 80, 75, 20, 81,
-212,117,204, 49,112, 24,188,165,154,117, 53,218,235,148,223, 68,215,  3, 78,230, 58,248,112,133,118,236, 12,125, 44,220, 46, 68,
- 47,109,146,231,179,119, 93,207, 28,157,181,182, 80,145, 96,181,247,227,234,170, 58,167,235, 63, 43, 58,210,157,160, 21,169,113,
-121,246,226, 53,185, 14,249, 91,136,146,184,147,101,149, 21, 88,169, 31,157,231, 85, 97,162,171,108,119,238,222,177,132,150, 43,
- 94,180,233, 31, 56,236,177,253,165,175, 75,121, 24,173,144,194, 33,234, 26,186, 21, 66,  4,  3,109,124,248, 52,249,  5,127,230,
- 29,250, 25,128, 51,127,255,142,218,166, 16, 19, 34, 60,198,143, 27,180,176,156,106, 81,163,102, 11,  3, 53,253,  3,117, 94,252,
-121, 81, 72,182, 43, 42,246,204,210,165,178, 21, 93, 94,196,114,205,131,221,245, 52,218, 38,125,210, 77, 51,214,228,114,245,196,
-179, 62,222,149, 52, 46,116,189,214,168,243,202,167,142, 85, 40,153,116,108,133, 76,141,237, 15, 23,184,153,147,202,126, 70,113,
-120,135,166,140,189, 10,202, 60,219,116, 33, 37,204,254,190, 16,147,173,146,  0, 48, 25,182,124, 38,134,200,100,174,  6,106,226,
-214,158,170,184,198,237,106,231,115,215, 14,205, 13, 85, 31,185, 23, 80, 26,144,136, 33, 57,153, 99, 75, 11,166,  2,224,120,192,
- 70,  5,105,216, 96, 82,193, 56, 30,204, 77, 35, 70,232,204,195,  6,137, 19,182,155, 77,219,169,115, 61,176,233,154,215,214, 64,
-243, 62, 86, 55,181, 84,181,193, 69,224,138, 93,242,212,160, 39, 62, 27, 86, 42,149,  4, 69,185, 11,170, 86,181, 68, 55, 78, 72,
-193,138,247,203, 92, 59,245,138,129, 15,108,103, 47,253,195,162, 82,231,158,245,107,121,153,166,110,  3,155,  3, 19,206, 97,225,
- 50, 16,198, 56, 43,166,  2,191,136, 60, 77, 40, 15,208,223,126, 13,244,173, 47,  1,155,231,125,215,234, 53,180,122,223, 37,151,
-192,213,  4, 61, 20,208,217, 43,192, 89,  1,134, 55,199,163,100,221,245,137, 95, 14,137,237, 73, 59,250,210,243, 40, 45,210,182,
-192,236, 88,179, 53,250, 64,  1,253, 86,  2, 30,156, 65,223,115, 31,120,215,143,130,158,253, 57,224,244,251,129,225,157,  0, 15,
-  0,190,  3,244,194, 51,160, 31,249, 79,129,255,230, 33, 78, 63, 34, 24,142,123,236,146,224,113,102,204, 81, 99, 83,120, 54, 61,
-180, 69, 21, 50,181,195, 45,187,126,143,104, 57, 26, 69, 87,188,133,255,159,147,137,165, 36, 89,  7, 88,  5,116,140,133,119, 37,
-113,140, 64,141, 33,192, 76, 78,242, 19,208,176,  1,113,  2,109, 19,248,253, 47,  0,111,248, 22, 59,178, 14,191, 12,124,241,227,
-192,195,103, 13,125, 37, 51,240,242, 12,249,212, 99,200,147,189,173,101, 60,198, 75,149,237,179, 67,190, 23, 96, 79,210, 56, 73,
-174,129,240,214,102, 47,214,137, 79, 98, 30,117, 87,198,171,  8,104, 44, 13, 17,118, 36,155,186,200,185,105, 33,120,103,199,226,
-142,129,147, 12, 26,134,101,228,176,118, 93, 54, 80, 81,190, 91,183,145, 49,181,112, 19, 89, 41,100,200,145,161,177, 87,207,104,
-151,120,221,219,173,227, 33,125, 15,162, 98,175,191,114,235,126,  8,141, 98,151, 82,187,160,145, 76,143,169,190, 79,174,239,103,
-231,243,142,  9, 65,137,238,147, 90,215,143,106,103,212, 26,158, 18,161, 39, 53,  6, 51, 34,108,163,211, 45,214,249,  0, 90, 71,
-126, 85,157, 28,196, 61,106,  7,119,191,179,213,238, 20,174,217,224,157,231, 62,190,247,121, 61,205,236, 33, 60,157,238, 64,226,
-251,236, 70,174,172,205,224,220,239,238,235,184, 95,219,115, 64, 43, 53,124,234, 58,109,234,126,134, 56,172, 99,243,148,180, 93,
-134,212,173, 88,218,110, 88, 23,197, 84,124,173,141,255,125, 83,247,251,161,130,151,149,223,122, 14,154, 29,217,134,105, 77, 30,
-148,142,234, 22, 16,107, 14, 34, 32,181, 96, 23,238,160,213, 82,109,144,122,173, 99,174, 13, 30,209, 66, 23,113,205, 91,127, 77,
- 96,119,253,159, 75,245,137,199,179,177, 44,120,150,221, 62, 45,154,200,155,106,191,254, 25,187,169, 19,110,133, 27, 97, 36,197,
- 73,133, 41, 89,134,  9, 59, 30,156,138,235,192,216,216,139,133, 25,101, 26, 49,139, 32,147,171,206,115,134, 50, 99, 42,  5, 92,
-138,221,119,137, 64,100,165, 70, 93,239,213,103,  9, 43, 13,128,118, 63, 87, 23, 53,215,137, 30,201,167,228,115,153, 49, 29, 15,
-200,158, 76,202,238,141, 87, 78, 80,102,140,243,140, 34,  5,105,158, 77,112, 78,108, 22,230,204, 21, 19, 13, 15, 57,203,232, 16,
-177, 11, 95, 39,173,153,203,218,240,152,104, 18,255, 42,178, 67, 75, 92, 35,239,152,217, 59,104,142,191,197,133,  7, 20, 10,121,
- 47, 18, 44,230,211,195,125, 85,186,  8,184,174,234,241,175, 17,226,  5, 18,  1, 58,175,122,248,220, 65, 14,203, 80, 27,143,216,
-197,110,254,105,187,248,  5,123,117,248,129, 51,214, 11, 51,202,150,161,191, 53,  2,231,191,  4, 60,251,181,150,141, 78,228,227,
-117, 31,189,207,  7,232, 21,  1,143,  1,189,100, 80,185, 15,220,153,157, 74,150,205,155,126,114,176,203,102, 59, 55,115,236,209,
-245,190,165,235,214, 67,133, 50,  2,152, 14,192,158,129,203, 25,116,127, 11,124, 94,172,107,127,219, 15,  0,119,255, 29, 96,247,
- 33,179,216,165,127,  2,120,234, 47,129,255,212,159,  6,253,181,251,224, 95, 24,240,236,241,  2, 67, 41,120,156,146,  5, 56, 84,
-212,185, 86,145,119,168, 49, 19,181,216,208,165,224, 69,151,229,156,127,143, 73, 60,204,164,120, 33, 18, 15,153,120, 32,  8, 89,
-  4,161,104, 27, 80, 68,225,144,161,224,221,  0, 30, 50,104, 47,224,175,221,  2,239,255, 16,176,123,155, 37,167, 61,248,  9,232,
- 23, 21,216,238,236,111,125, 52, 67, 62,123,137,242,202, 17, 50,205,174,139, 48,  5,189,169,182,115,149,225, 83,180,167, 91,246,
- 16,237,226,221,183,120,151, 94,172, 83,159,172,112, 34,153,129,139,193, 63, 95,108,100,140,177,  0,122,191, 49,176,248,204,200,
-116,187,198,188, 12, 17,210, 84,109,126,228,105,108,126,128,179,177,236,139, 18,148,237,175,172,130, 67,255,156,195,167, 77,220,
-173, 45,146,179,191,225, 34,186,250,103,227,223,139,132, 43,183,117,198,229,115, 45,192,164,235,154, 74,168,116,213,234,158, 96,
- 89, 67,201,133, 92,209, 37,234, 34,196, 98,173,214, 13,187, 28, 51, 48,148, 62,110, 52, 80,181, 13,168, 94,237, 63,180,170,245,
-176,204,171, 22,186, 14,221,161, 53,237,173,126,121,186,  6,241,192, 74, 60,183, 24,109,118,182, 64, 90, 29,165,225,222, 17,159,
- 52,244,157,182,116,171, 69,172, 88,235,164,109, 28,222,  2,123, 26,245,172,248,235, 90, 22,133,136,253,128, 57, 66,171,220,125,
- 64,221,197,222,143,220, 77,100, 70,181,120,161, 14, 41, 60,250,190, 94, 61,242,183,  0, 56,248,229, 58,118,212,189,202, 84,138,
- 49,183,195, 95,158,234, 84,232,201,153, 20,199,176,  1,162,165,145,149, 27, 58,109,237,214, 69,253,235,  5,186, 33, 44,101,245,
- 62,210, 13,124,245,  5,  9,113,133,122,229, 53,195,  0,221,103,120,169,145, 91,237,166, 91,236,240, 77,133, 69,241, 38,117, 14,
- 42, 29, 25,172, 44, 19, 99,224,108,239, 13,145, 37,164,145,193,101,138,223,  5, 33, 12, 79, 76,216, 12,131,199,199,218,250, 52,
- 56, 17, 66,134,119,133,136,  7, 38,117,174, 10, 98,183, 90, 99,  5,166, 69,213,173, 45,220,  6,241,108,139, 69,179,218,186, 88,
- 77,124, 39,218, 77, 21,128, 82, 20,162, 35,118, 68,216,158,156, 66,136, 48,205, 35,166,105,198, 60, 30,237,240, 73,169,237,212,
-171,200,164, 83,186, 47, 72, 97, 17,207, 74, 93,200, 11,  5,217, 45,132, 33,161,108, 12,133,178,120,242,140,214, 72, 81, 21,139,
-  8,101, 54, 54,124, 74,185, 70,141,154,202,158,171,240,139,216,170,149,102,174, 66,151, 59,174,208,185,248,126,  4, 32, 45,158,
-177,142,234, 39,156, 84,205,202, 38, 90,  5, 56,179,239, 66,138, 63,229,156,128,  9,138,137,  1,253, 93, 64, 63,253,113,208,221,
-207,187,119, 58, 74,123, 87, 87,149,163, 33,165,174, 12,219,164,  2,144, 94,  0,119, 94,  4,248, 57,128, 78, 64,187, 43,232,110,
-242, 16,237,220,186,246,163,137,247, 80,252, 45,157,165, 43,181, 21, 50,205,160,195, 12, 58,206,160,243,  1,244,210, 41,244, 61,
- 87,160,175,251, 81,224, 77,127, 31, 56,249,126, 32,125, 25,192, 95, 13,220,249, 49,208,247,254,135,192, 83, 79,192, 63,115, 23,
-119,206,207,177,153, 38, 60, 32,198,101,183,227, 21,105,220,113, 67,235, 19, 56,149,133,127,154,208,129, 25,116,185,231,171,226,
- 37,233, 56,  6,221,135, 49,188,153, 22,213, 73,200,201, 14,250,172,130,156,  9,124, 58,128,246,  9,124, 10,208, 31,126, 55,232,
-249,239,177, 77,235,254,231,128,151, 62,  5, 92,221,178, 47,118,255,  8,125,188,135,220, 59, 66,198,  9, 74,226, 43,152, 80, 75,
-118, 27, 87, 98,208,134,173,112, 58,165,166,206,185,154,235,232, 29,147,216, 26,103,246,196,187, 89,129,139,  2,154,197,190,222,
-158,160, 71,  6, 77,151,174, 36,212,198,211,221, 36,208,192,181,253,150,212, 29,198,206, 52, 39,136,211,225,200, 87, 75,142, 46,
-136,206, 36,244, 39,126, 99, 30, 21, 72,217, 45,102, 98,240,159, 24,115,135, 95, 55, 87,145, 92,179, 19, 13, 93,240,138,250,215,
-168,209, 11,245,242, 51, 22,117,236,140,197,117, 16,209,246, 43,135, 51,166,165,174,113,103, 73,234,121,214,138,118,112,215, 98,
- 70,187,213, 87,127, 72,135, 31,219,  9, 93, 27,168,213, 87,126, 64,204, 46, 38,139,144,148,210,217,167,180,  3,183, 96,213,153,
-221, 52,150,167,107,102,171, 78,248,212,109,187,214,141,200, 66,105,172, 13,101, 32, 55,136,188,168,175, 87, 86,170,251,212, 77,
- 50,218,101,164,238,185,167,174, 30,210, 10, 24,210,110,146, 25,241,197, 65,204, 76,126, 97, 30,187, 75, 46, 20,249, 19,150,185,
-238,203, 85,131, 46,  0, 56,232, 46,247, 40, 66, 70,191, 20,  7, 50,100,172,120, 12,240,163,206,243, 31, 49,189,220,  1,129,168,
- 31, 25,251,231,202,178,217,245,154, 56,239,245,132,106,215,183,219,184,  1,140,186,116,101, 80, 21, 42,182,152,214,235,255,166,
- 94, 95, 99,241,106,194,213,125, 51, 92, 11,102,194, 94, 20,  3,171,195,207, 12,206,161, 72,208,164,216,176, 81, 80, 15,176, 56,
- 85,168, 34,229,100,246,235,148,170,195, 59, 51,163, 48,219,120,156,201,154,153, 50,251,122, 46,132,116,104, 73,167, 55,124,207,
-235, 19, 55,190,249, 90,172,171, 57,147,200,145,233, 38,  8,247,180, 54,166, 10,100, 19,215, 73,148,253, 21, 52, 37, 76,211,132,
-121,158,236,123,131, 77,246, 50, 86, 99,166,122,185,  6,201,205, 71, 88, 28,163,118, 52,  1, 81, 29,108, 57,169, 45, 81, 83, 48,
- 88, 68, 67, 83,164,104,153,187,248, 86, 63, 12,105, 65, 40,240, 44,106,235,134, 56, 25,129,142, 52, 50,164,217, 47,150,138,218,
-240,139,124,185, 80,  9,197,170,192,192, 15,147, 43, 76, 69,  4,  5,130, 50,199, 14, 52,  4, 48, 30, 54,145,129, 91, 23, 10,254,
-123,175,128,190,234, 23,129, 59,111,111, 57,220,234,137,198,243,  4,140,108,179, 48,135, 89,107, 33,227,142,157,221,  7,210,214,
- 46,243, 91,  4,220, 98,235,190,175,162,210,114,112,138,175,  7,234, 55,155,162,108, 86, 40,102,232, 56,131,198, 17,180,223,128,
- 95,219, 64, 63,191,  5,190,233,239,130,222,253,219,174,142,255,  0,128,119,  2,183,127, 28,244, 93,127, 26,188,125,  0,250,249,
-187, 56,185,119,137,231,174,246,216, 64,113,158,147, 77, 40,188,155,216,100, 96, 67,197,222, 15,181, 29,209,226, 41,147,118,240,
-193,243,119,152, 29,237,233,127, 79, 79,125,168,200,222,142, 60, 53,184, 61, 49,147, 32, 11,192,155, 12, 26, 18,120, 18,208,191,
-250,229,160,175,254, 97,179,144, 29, 62, 15,156,255,117,232, 33,219,160,176,204,208,139, 35,228,229,  3,100, 63, 26,114,177, 75,
- 61, 81, 85,208,224,175, 27, 17,184,144,237,216, 79, 96, 52, 57,130,141,218,227, 50, 63, 20,232, 97,130, 30,213,254, 46,144,  5,
-209,236, 39, 27,207,159,101, 63,193,213,198,239, 50,218, 62, 93, 11,144,196,  2,250, 78,179,127,210,123,241,168,223,251,174,125,
- 84, 53,145, 98,248,127,165,227,164,167, 80, 90, 51,131,148,113,247,132,112, 85,  4,227,108,233,133,161, 70,150,213, 97,217,139,
-104, 66,237,108, 69,167,213,149, 57, 89, 45, 24,187,194,226,234,123,235,238,219,206, 81,113,125,241, 76,137,160, 73, 77,  3,170,
-173, 59, 87, 63,144, 42, 57,204,219,163,121,117, 57,114, 47, 10,211, 54,221, 73,222, 25,  7,232,131, 60,115, 29, 76,166, 83,244,
-203,125, 34, 50,146, 92,119, 41,177, 46,155,132,178,154, 34, 93,  3,193,248, 68,162,223,165,167,149,117,172, 23,168,201,234, 53,
-150,149,152,171,223, 11, 75, 55,254,214,206,134,168,238, 43,143,113,122,179,240,217,235,223,127,189, 16,244,197, 20,  4, 98,201,
-151, 27,102, 20, 85, 76, 46,170,154,171,213,177, 37,218, 77,190, 21,106,161, 59, 84,139, 12,215,194, 86, 52,113,207,240,143,215,
- 40,182, 83,123,109,252,117,192,142,162,128, 27, 61,118,236,111, 10,109, 72,216, 27,227,118, 36,174,166, 18,134,122,232, 76, 11,
- 51,145, 27,212,105,175, 55,146,215, 27, 13,104,215,231,234,109,205, 69, 43, 80, 11,181,159,150,218,223, 88, 73,131, 66,184, 41,
-167,162, 95,207, 20,143,152,102,181,228,207,156, 24,153, 50,100, 48, 43,219,196, 70,  1, 36, 40, 68, 76,129, 62,164,140, 33,103,
- 36,206, 85,171, 52,112,  2, 13,  4, 21,103,194,  3, 75,155, 75,157, 30, 52,188,172,122,209,173,215, 94,147,206,218, 73,237,103,
- 21, 81,232, 60, 99,216,236,176,221,109,160,100,186,166,226,150,185, 82,138,163,150, 11, 74,153,129, 34, 86,124,108, 54,200, 57,
-163, 20,179,151, 75, 41, 72,239, 56,187,245,231,205,137, 70,117, 55,196,157,242,175,250,255,124,255,192,201, 43,153,110,251, 18,
- 72, 77, 78,185,118,116,129, 20,141,249,161,237,204, 75,133,202,176, 87, 73, 86,253,219,238,151,201,202,134, 72,208, 76,253,104,
- 40,152,229,180, 34, 45,244, 10, 20,127, 10,  9, 10,214, 82, 59,166, 45, 19, 78, 72,107,215, 31,154,169,129, 20, 39, 25,216, 56,
- 54,118, 11, 65,126, 66,224,247, 93,  1,207,124,192,112,175,243,203,192,116,  1, 76,175,  2,151,247, 45, 45,108,111,150, 41,131,
- 56,251,  9,153, 21,196,197,151,203,206, 82, 29, 21, 56, 40,104, 22,131,167,140,106,221,122,168,148,180,193,156,181,204,174,204,
- 86,232, 52,  3,165, 64,231, 25,116,159, 64,159,219,  1,251, 75, 96,243, 17, 80,250, 37, 35, 80,211,123,129,221,119,129,222,254,
- 27,160, 23, 94,  3, 94, 59, 65,158, 18,118,165, 96,152,102, 72, 34,136, 71,160, 14,201,134,  6,213,254,163, 30,134,163,205,191,
- 92, 71,128,172,245, 53, 44, 74,152,103,187,220, 69,220, 85,224,  0, 14,142,145, 36, 41,134,164,216,102,181,120,205,164, 24, 50,
-131, 79, 18,210,  4,240, 63,117,  6,250, 67,127, 17,216,125, 53,112,252, 93,224,201,143,  2,247, 63,  9,220, 59,181,225,225,213,
- 12,125,233, 10,229,222,  1,114, 28,109,100, 94,167, 61, 54,102,167,236,191,  6,251,197,183, 55,192,243, 27,224,118,182, 19,239,
- 73, 49, 11,225,161,  0, 87,  5, 58, 10,244, 24, 68, 30,107, 73,185, 48,232, 77,  3,112, 39,219,172,242,153,  2,186,157,129,211,
-111,177,144,157,195,111,128, 30,126,  6, 56,156, 24,205,238, 11,151,152, 15,  5, 83,166,214,193,114, 23, 18,231,194,180, 18, 20,
- 47, 87,165, 39,127,110,114, 98,156,164,140,247,126,215, 29,188,245,159,187,141, 71, 31, 59,226,226, 74,124,240,160,215,198,152,
- 90, 47, 56, 90,248,216,193,109,175, 13,191, 96,226,114, 37,130,237,248,194,230, 67,171, 95,171, 86,138, 92,244, 19,115,206,220,
- 92,158,246, 76, 58,148, 36,209,138,128,213,119,233,188,162,153,117, 24, 85,  1, 33,251, 25,188,241,205, 72, 36,142,197,207,153,
-253, 87, 20, 62,220,229, 77, 36, 90, 94,146,253,127,207,221, 21, 64,171,253,116,164,128, 13,180, 92,  3,193, 71,220,189,141,236,
- 38, 97, 23,110,224,117, 99,177, 79,191,190, 39,174,105,100, 43,213,117, 47,220,170,222,119,120,129,151,216, 38, 24, 43, 27, 95,
-241,127, 65,170, 45,140,170,238,162,116,151,156,184,240,173, 39,182, 97,133,211,149,181,109, 14,246, 94,156,144,109,157,142, 17,
-216, 76,109, 69,100,188,125,187,224,238,144, 21,  2,  7,  0,247, 69, 13,  9,221,105, 28,150,190, 44,194,186, 63, 88,119,229,181,
-  9,164,213, 31, 12,234,168, 79,249, 18, 59,220,103, 61,115,167,133, 35,183,141,220,233,102,123, 27,174,173, 57,184,114, 10,110,
- 13,  3,118,219, 29,178,231,161, 19, 51,132,185,146,  9, 55,156,144, 83, 70, 98, 83,199,199, 36, 33,249,142,125,195, 12,164,100,
- 97, 42,243,220, 61,164,180,200,230, 96,231,173, 16,249,167,187, 54,164, 55,121,  7,154,126,161, 20,197, 56, 30, 49,143, 71, 72,
- 49, 30,200, 52, 77,152,198, 17,243, 52,162,204,118, 47,  4,149, 42, 86,  2,182,202, 78,190,102,208,198,208,168, 25,200, 76,139,
- 14,133,152,151,239, 69, 39, 26,130, 54,219,155,104, 71,213,169,135,178,172,126,152,104, 15,156,181, 93,216,159, 86,109, 56, 74,
-182, 17, 60, 57,149,137,164, 83,222, 71,118,181,167,190,233,194, 95,133,154,233,220,122,121, 96, 46,138, 35,  3,147,135, 54, 20,
-175, 60,149,236,111, 27,103,197, 46,153,176,174,108,  8,250,  8,208, 79,188,  4,122,251,167,129,147,247,251,  9, 58,219,142,189,
-192, 78,244,131, 24,130,116, 22,160,116, 25,184,207,  2,116, 58, 88,168,195, 45,182, 29,237,  9,  3, 83,  2,237,109,239,171,179,
-223,  2,220,117,234,226,221, 41,164,234,242,136, 10,104, 44,208, 97,  6,149,  1,252,247, 78, 64,159, 28,160, 95,113, 15,248,138,
-255, 17,244,182,159,  1,206,254, 36,176,251, 17,224, 27,255,103,208,151,253, 95,192,255,  1,228, 79,220,198,217,189, 43, 12,151,
-123,156, 51, 99,220,248,107,210, 89,121,224,  9,111,186, 48, 96,248,  1, 86, 20,196,166,114, 62,198,154, 34,198,129,254,239, 15,
-138, 38,  8,226,214,201,108, 54,192, 80,  8,148, 19, 72, 18,232,180,128, 62,244,109,192,201,123,128,249,  8, 28, 63,  6, 92,124,
-  2,122,145,129,121,  0, 46,103,232, 75, 23,144,151,246,144,171,  9, 58, 22,155,178,132,128, 41, 62, 92,153,107, 41, 78,204,192,
-169,191,174,228,114,224, 41,110, 88, 65,173, 84, 42,145, 67,161, 76, 86,137,239, 61,206,144,220, 31,118,188,  0,202, 19, 96,120,
-155,177,231,115,178, 44,159,129,145,134, 45,118,105,194, 33,219, 65, 83, 68, 33,174,193,235,247,195,125, 22,121, 53,173,251, 66,
-121,115, 66, 72, 73,113,239, 23, 14,184, 58,159, 49, 36,  3,129, 68, 23,167, 43, 79, 53, 86, 66, 58,248,164,172,248,197, 85,168,
- 29,148,138,198,145,175,103, 52, 55,132,175, 58,175,160, 72,159, 85,238,145,172,  3, 97,154, 27,148,166, 66,132, 40, 58,205,134,
- 18, 61,160,137,193,208,133,  0,245,240,150, 16,166,205,106,129, 33, 59, 47,200, 51,  3, 91,167,222,157,  1,216,129,112,128,173,
- 48,194,167,109, 96, 36,127,250,107,254,128,217, 87,117,181, 84, 79, 93,253, 94, 86, 52,182,109,175,114,167,101, 23,216,194, 75,
-150,105, 99, 61, 18,168,116, 23, 97,174,240,160,213,168,191,147, 18,111, 29,226,164, 95,162, 48, 96,191,136, 73, 45, 91, 97,195,
-  9,156, 50,174,202,140, 89,154,  8, 78,160, 53, 38, 52,190,207,138, 71,213,165, 34, 29, 30,142,148,180, 17, 97,162,209, 46,184,
-206, 89, 23,175,202,  6,178,245,  8,135, 54, 64, 35,205,203,206,210,141,203,125, 39,  0, 47, 43,225,190, 40, 14,210, 94,163,202,
-171,232,214, 37,129, 52, 94,160,249,190,132,237,109,209,105,247,184, 91,186,121, 71,175,164, 43,239, 55,117, 97, 74, 54,145,125,
- 61, 39, 69,109,166,201,137,134,100,225, 99,179,154, 67,104,203, 38,232, 53, 43, 42,129, 57,161,116,154, 39,230, 54, 78,175,250,
- 22,226, 54,117, 86,  1, 51, 53,189,139,116, 19, 51,234, 19, 24,216, 38,202,224,197, 74, 65,  8, 85, 59,130,138,234, 21,136,144,
-113, 87,166,169, 85,231, 85, 41,207,157,254,198,218,106, 17,  1,198, 17,188,129,117,236,228, 36,189,107,204,247,106,103,235, 62,
-160,126,217,135,106, 29, 30, 59,  9, 87,149, 67,109,127,206, 76,203,203,187,251,230,217, 31,216, 22,186, 82, 64,147, 56,185, 51,
- 85, 85,113, 10,200,135,219,212, 82,133, 94, 80,141,  7,213,240, 84,137,161, 58,137,185, 82,137, 52, 14, 30, 17, 76, 80, 92, 78,
-132,219,108,161, 34, 86,123,152,114,103,138, 29, 22,187,200, 65,197, 42,225, 79, 78,160, 15,254, 42,176,123,175,117,235,228, 60,
-173, 34,246,135,131, 65, 94,212, 58, 68,214,170, 10, 86, 37,208,105,178,147,237,118,182,142,126, 78,160, 67,134, 78,198,129, 86,
-  4, 90,212,231,110,  3, 87,181,125, 20, 42, 26,154, 65, 85,208, 36,208,113,  2,141,  3,248,181, 29,232,227, 59,232,215,221,  3,
-125,243,127,  1, 60,251,  3, 64,250,215, 65,111,253, 86,224, 95,251, 73,224,111,255, 42,210, 47,158, 98,247,128, 49, 60,217, 99,
- 47,130,227, 96,241,  1,145, 36, 43,165, 75,  3, 35,172,  6, 95,  2,  8, 97,238, 18,197, 18,128, 13,123,230,179, 46,211,157,  2,
-131, 57, 40,144,102,  5,239, 50,104,147,192, 71,  1,255,145, 51,224,249,127,163,121,249,203, 99, 15,189,219,218,229,250,240,128,
-242,187,  7,148, 39, 35,100,154,141, 88,150, 90,129,201, 66, 70,234,181,120, 63,251,223, 39,108,221,246, 46, 53,236,214,104,163,
- 23, 45,190, 27, 46, 46,146,235, 25, 51, 83, 49, 61, 68,118, 61,195,165,152,176, 49, 61,  5,240, 41,144, 78,129, 84,128,179,  4,
-204,  9,124,220,225,116, 16,204,116,196,145,197,196,159,165,143,254,164,154, 66,215,123, 90, 99,215, 39, 16, 92,237, 11,126,245,
-111,158,227,106, 82, 36,167, 43,182,245, 75,187,196,231,213,164, 50,252,228,197,  1, 34, 83,183, 39,148,186,255,165,202, 23, 40,
- 62, 63, 86, 23,  6, 17,181,162,109,147,154,254, 84, 73,235, 46, 62,101, 23, 64,106,195, 63,151, 88,187, 69, 86,  0, 19, 82,209,
-186,118, 72, 29,161,171,142,174,185,  6,  0,250,190,207,138,210,201,121,222, 17,141,218, 51, 18,102,105, 52, 62,138, 61,161,147,
- 49,138,218, 52, 43,185,202, 57, 46,169,238, 14,115,183,141,214, 11,253,196, 11,203,212, 37,187, 69, 36,170,174,224, 35, 88,129,
-109,176,126, 93, 97,231,130,118, 66, 52,238,148,219,235,221,109, 15,188,145,222,254,213, 93, 82,197,207,164, 13, 10, 78, 57, 65,
-152,113,161, 82, 51,234, 75,183, 31,159,110,240,136, 23,175, 28,  7, 86,231,  4,144,231,149, 47, 39, 16,218,209,221,114, 39,112,
-102, 31,181, 55,127,122,179, 25, 26,144,209, 78,128,199,  0, 30,137, 73,134,142,226, 93,179, 94,119, 31,132, 72,186,237,218, 59,
-181, 34,186,203,170,187,140,  9, 55, 49,208,123,141,  2, 93,179,197,209,235,208,227,168, 83,239,115,111,181, 93,173,115, 66,188,
-150,136,161, 41,225,137, 40,112, 56, 32, 19,176, 29, 54, 22, 38,227,223,179, 20, 19, 33, 13, 62, 81, 41,228,235, 55,215,205,100,
-183,191, 77, 90,204, 82,189,246,138,177,137,122,149,100,241,154,217,100,165, 37,192, 47,168,157,220,135, 20,217,  8, 46,132,172,
-125, 97,208,239,229, 21, 46, 28,134, 39,  2,186, 78, 71,199,209,176,205,105,176,159,169,230,109,243,242,133, 11,197, 85,140, 17,
-226,247,168, 42,184,165,137,234, 20,144, 50, 27,255,189,203,152,165, 34,141,103,221,115,121,136, 22, 35, 66,173,227,122,123,242,
-205, 58, 71, 32,157,125,239, 45,245,210,163,  0,237,163,117,161, 65,116,214,142,191, 12, 21,211, 59,169,226, 48,  3,187,141,117,
-251, 90, 45, 63,161, 52,140,142,206,171,172, 47, 42,240,228, 69,224,153,209,201,113,212, 44,110,117, 58,160,214,177,  7,237,172,
-104, 69,117,105,180, 41,183,  1, 28,179,141,235,111,  3, 60, 22,136,  8,116, 95, 34, 53,160,181, 86,  9,158,181,168,245,235,232,
-172, 85, 78,194, 51,108,255, 60, 23,240, 52,129, 63,178,129, 30, 11,232,219,254, 18,240,134, 13, 64,127,  0,120,230,199, 65,223,
-253,211,192,237,159, 66,250,153, 29,240,244,128,147,151, 47,145, 14,214,113,206,153,106, 81, 67, 43,236, 71,  5,173, 36, 50,120,
- 30, 90, 46,111, 13,236, 33,243,216, 75,119, 88,102,242,241, 62, 41, 82,102,208,105,  6, 31, 51,248, 61, 71,224, 67,223, 15,228,
-175, 52,111,255,229,255,  9,156,255, 44,244,  0,211, 37,220, 63, 66, 62,117,  9,121,184, 71, 57,142,152,146, 39,207, 45,173,225,
-118, 33, 39,139, 67,  5, 49,104,151,128, 51,239,220,143,197,230,225,174,114,199, 44, 38, 72, 60,106,139,117, 10, 68, 64, 81,224,
- 56,251,114, 26,192,  3,  1,142, 71,160, 60,  2,232,237, 22,178,147, 29, 74,243, 85, 39,192,191,245,118,240,167,239, 99,251,159,
-124,194,243,227,169,142, 78, 85,177, 82, 88, 59, 50, 65,188,147,245,207,156,206,197,222,189,100,212,172, 34, 29, 54,181,239,164,
- 56,232,111,232,236, 58, 85, 14,103,124,117,242,194, 90,116,201, 49,247,131,185, 56, 76, 38,147,197,154,194,191,159, 57, 14,186,
-108, 53,203,132,182,122, 73, 41, 46, 62,203,147,214, 16, 68,170,237, 27, 55,162,216,184, 82,126,138,105, 12,145,241,220,181,165,
-198,193, 57,244,113,209,141, 93, 52,105,246, 17,173,248,165,155,188,179,179,177, 61,213, 75, 43,220,134,228, 65, 41,113,225,103,
-159,  2,206,157, 24, 45, 70,171,201,187,205, 74,110,163,200,124,167, 69, 31, 94,133,190,218, 18, 15,165,187,170,116,161,252,182,
-175, 61,119,226, 58,116,196,186,155,118,201,165,147, 69, 69, 63, 45,218,164,205,177,203, 47,162,216,161, 96, 67,140, 45, 19,198,
-210,237,238,129,197,174,188,215, 13,100, 10, 20,113, 23,204, 66,228,193, 40,246,153, 60,174,246,236, 92, 73, 27,214,165, 87, 21,
-187,251,244,137, 76,220,184,245,253,254, 61,  0,143,197,222,215,176, 72,233, 10,125,218,226,111,123,156,146, 94,123, 69,214, 94,
-236,165,  5,143, 32, 43, 69, 36,117, 83,162, 40, 24,230,110, 31,157,110,208, 65,244, 19,174, 30, 97,219,131,106, 42, 85,142, 13,
-  9, 59, 22,243,229, 18, 49,212,183,112, 19,137,157,119, 78, 44, 45, 12,104, 17, 91, 31,167,132,  6,149, 51,252,185,138, 63,211,
- 74, 38,248,166,150, 92,170, 20,205,218,242, 98,  7, 39,168,175,152,209,  9, 97,117, 33,216, 20, 40,241,170,168,161,102,253,236,
- 65,107, 61,140, 34,138, 18,181,142, 93,147, 70,167, 78,139,252,103, 68,230,108,163,228,181,157, 29,  4,162,  2, 71,204, 88,231,
-169, 49, 14, 47,208,194, 43,197,163, 46,146,226,137,227,239,215,142,182,228, 46, 79,223,183,131,217,133,121, 12, 85,  6,102, 15,
-159, 23, 75, 94, 35, 54,123,  0, 81,251,112,136, 95,142, 42, 98,112,155,216, 59,168, 98,  6,225,232, 19,243, 74,165,242,177,102,
-137, 20, 41, 34, 80,178, 75, 77,207,  1,189,184, 15,210,  3,144,159,182,116,181,254, 21,157,252, 66,159, 66, 53, 86,154,148, 56,
- 24,156,119,178,117,235, 79, 39, 83,225,137,  2, 99,  6, 29,  4,196,147, 21, 16,197, 31,138,136,101,202,214,150, 69, 54,175,138,
-212,215,173, 76,  0,207,130,114, 44,208, 91,  5,186,153,145, 62,126,  6,189, 53,  1,191,255, 39, 65,249,205,192,240, 53,192,233,
-247,129,190,253,105, 40,127, 24,233,111,109,129,183,222,193,246, 11, 15,129,125,193,145, 24, 19, 45, 33,  9,220, 89,127,168,243,
-  9,101,138,247,169,117, 17,234, 36,147,250, 96,137, 54, 81, 24,  0,222, 37, 32, 37,240,197, 30,244, 47,191,  7,184,251,199,128,
-249, 33,112,254, 55,128,139, 95,  2,174, 30,  0,151, 59,224,209, 12,125,105,143,114,239, 10,229,106,196, 68,132,105,110,121, 66,
-236, 12,159, 96,233, 19,179, 49,232,111, 39,224, 78,  2,110,123, 59, 95,196, 39, 33, 98, 58,132,105,134, 28,102,219,119, 85, 75,
- 12,129,166,226,197,140, 27,122, 54,  0, 94, 81,232,227,115,208,151,125, 30,192, 55,154,123, 33,121,  5,240,252,206,190,137, 95,
- 59,183,207, 91,118,  4,172,239,252,168,223, 49,118,227,207,208,153,132, 91,192, 14, 92, 66,210, 54, 38,212,174,139,169,123,113,
-189,174, 38,170, 99, 58, 24,208,134, 92,187, 17,164,184, 56,164,181,223, 62,101,199,245,106,119,169,244,107,130,232,102,195,137,
-226, 58,129,  8,129, 89, 36,177, 69,225, 70,118, 49,195, 47, 68,113,200, 76, 47,156,210,213,161, 10, 63,160,143, 65,112, 80, 11,
-195,200,220, 44, 86,210,237,140,103,255,251,185,139, 17,206,104,148,154, 68,140,172, 10, 33,131, 70, 73,116,159,164,139,196,178,
-133,137,163,107,197,121,117, 25,243, 77, 10,124, 93, 93, 77,206,218, 31,195,  3,238,132,188,224, 75,197,198, 71, 23, 69, 30, 85,
-164,104,115,  1,117,150, 69,119,227, 36, 54,158,254, 38,153, 13, 50,148,241,218,169,182,  5,205,126,154,213,116, 63,  3,181,131,
- 62,121, 69, 56,249,170, 98,175, 77, 80,135,174, 91, 23,255,172,156,116,175, 83,234,126, 29, 84,241,138, 90,150,249,236,159,239,
-242, 37, 72,114,180,250,255, 92, 87, 64, 90,145,187, 75, 32, 12, 93,227, 42,210, 13,  4, 57,138, 41,172, 51, 25, 88, 90, 48,205,
-154, 98,136,133,112,146,170, 51, 69,187,  9, 75,205, 68,247,206,160,248,116,119, 67,  6,160,217, 36,127,117, 37,238,  2, 53,108,
-249,236, 78,174,148,157, 24,105,234,243,136,150,102,192,  8,110,241, 13,106,203,136, 18,110, 31, 62,237,155, 94,152, 98,158, 97,
-147, 96,136,214,134, 86,107, 84, 48, 45,  8,  5,181,163,119, 97,185,174, 38, 16,132,229, 33, 84, 73,170,101, 70, 14,127, 57,199,
- 24,165,219,129,215, 15, 72,120,196,131,105,236,151, 57, 85,108,171,137,229,200,  2,210,155,194, 39,150,248, 98,241,167, 97,205,
- 73,220,213,189,106,  2,182,228,251, 67, 21, 63,196,216, 92,125,154,146,231,167,219, 97,164, 14,174, 97,136,135,191, 16,138,  6,
- 73,141, 42,234,140,176,  4, 83, 76,210,236, 18, 61,157, 74,252,110,158,196,246,200, 56,245,147,236,225,104, 52,185,205,155,129,
-237,155,129,139, 19, 16, 43,180, 26, 90, 75,179,168, 93,145, 43,180, 99,166,234, 18,210, 51, 54, 21,252, 27,146,123,168,  7,208,
- 85,  1,149, 12, 61,204, 45, 98,169,151, 41,160, 59, 41, 82,167,255, 35,  7,232,140,  5,170, 71,232,169,  2,233, 18,252,177, 83,
-208, 83,247,129,175,255, 49,128,254,156,193,106,182,127, 24,244,251,175,160,227,143, 35,253,194, 14,120,219, 83,216,188,120,  1,
-156,143,192,174,225,211,235, 67,230,151, 53,137, 85,172,236,  7,188,118,163, 51,168,235, 17,164, 13, 23,200,249, 58, 25, 64, 26,
-  8, 56, 77,224,251, 10,250, 32,  3, 95,254,239, 89,197,180,255,187,192,254, 87,128,195,  5,244, 49,123,164,234,  8,185,191,135,
- 92,142,214,104,231,214,237,176, 15, 48, 34,104,134,114,140, 90, 13, 96,131, 59,185, 37, 98, 60,113,182,193,100, 23,187,204,102,
- 99, 67, 20,110,226,104,  7,245,145,213,222, 85, 93, 91,  0,123,  2, 46,142,246, 30,  3, 54,126,247, 21, 16,254,223,199,192, 95,
-254, 60,228,165, 39, 24,183,179,219,219,155, 88, 16,171,195,113,132,253,189,235,240,145, 69,103,161,122,109,229,184,228, 23, 70,
-255,  0,  0, 32,  0, 73, 68, 65, 84,210, 28, 53,188,174, 31,198,228,  2,178,226,133,142,189,230, 14,165,209,230,129, 71,231,135,
-166,  4, 80,105, 94,247,232, 32,147,182, 61,229, 28,180,176, 32, 14,122, 92,113,158, 61, 63,158,  9,217,255,174, 65, 98,251, 65,
-152,252, 48, 18,215, 85,136,175, 14, 68,151,235,129,120,125,  6,247, 69, 31,  0,100, 31, 53,199,222,177,231,160,199, 81, 48,107,
- 20, 29,230,168, 40,220,104,135,117,127,219, 11,166,186,101,108,251,175,122,163,176,109,209,119,174,186, 59,186,246,158,208,  2,
- 64,147,212,125,251, 78,118, 75,  4,236,153,141,119,209, 29,208,241, 51,196,212,177, 21,129, 90, 31,117, 19, 85,218,243,181,117,
-197,251, 33, 50,  4, 86,176, 81,238,148,253, 67, 39, 28,142, 93,252, 12,155,202,140,221,239, 45, 94,255,174, 74,233,245, 15, 17,
-166,243, 68,129,123,170,216,135, 26,223, 63,163,250, 58, 54, 53, 90,119,228, 43, 47,217,235,241,216, 35,224, 72, 87,234,131,182,
-250, 37, 95,195,104,189,180,248,  6,193,223,250,217,161,170, 47,137,142, 61,168,111, 29,220,217,255,160, 72,  8,112, 25, 74,102,
- 81, 99,255, 84,132, 29, 59, 98, 45,227,162, 79,196, 78, 61,181,215,121,158,205,118,150,114,118,203,108,105,239,189,195, 96,140,
-131, 86, 58, 27,101,148, 58,220, 10, 29,234,167, 26, 95,130, 60, 25, 84,108,238, 45, 98, 90,227,150, 65,214,120,139,118, 43, 48,
-181, 34,176, 62,240,203, 49, 75, 83, 55, 50, 47,  9, 75,236,  8,215, 16, 77, 84,146, 88,236,193, 61,110,149, 72, 91,167, 47,221,
-222,163, 26,168,169,250, 37,169,250,209,109, 52,204,148,192,100,161,239,148, 76, 17, 15,  9,207,180,174, 34,248, 26, 25,169,207,
-170, 69,103,221,241,115, 31, 91,238, 42,156, 48,245,147,217,220,230, 42,178, 74,192,227,189,237,129,177,  3, 54, 47,  0,155,167,
-236,132, 67, 19, 66, 97,114,218, 72,113, 83,143,120,185, 28, 49,105, 57,  3,167, 25,184,179,113, 44, 20,128,125,  2, 29,179, 41,
-226,103,105,158, 27, 88,187,107,232,248,118,  4, 41,122, 97,150,161,111,249, 80,204, 51,239,115,242,244,247, 79,161,233,211,160,
-175,253,207,129,179, 31,  0,182,239,  3, 78,190,  7,244, 29,167, 80,124, 24,233, 23,  6,224, 45,183,176,249, 60,192, 87, 35,166,
-220,235,  8,204,134, 36, 21,233,168, 93, 74, 19, 53,208,  3,199,235,140,154,154, 22, 67,137,  4, 69,218, 24, 14,152,166, 25,244,
-237,111,  5,242, 55,  2,227,139,192,213,175,  3,101, 52,100,235, 67,  6, 30, 78,208,251,  7,200,131,  3,230,253,140,  9,240,238,
-171,225, 76,107, 81,182,105,196, 54,218, 50,232,204, 69,114, 57, 59,231,125,110,239, 65,180, 78,208, 74, 44,212,248,240,219,220,
- 23,122, 33,160,113,  2,182, 27,203, 38, 56,122,229, 16,175,127, 41, 64,154,  1, 18,232,217,140,233,214,132,227,209, 68,114,234,
-124,115,197, 82,253, 61,105,111,172,209,107,192,137,133,249,121, 65,205, 90, 30,157,212, 61,124,210,205, 24,109,108,109,159,175,
-112, 46,148,234, 71,215,182,183,243,216,202, 48, 29,  7,121,203,  3,139, 45, 97,206,215, 86, 97,227,108, 59,118,170,149,212,160,
-190,223,238,242,190,217,119,212,129,  9, 21, 34, 47,114,122,149,247, 50,168,102,205,110, 23,109,160,163,222, 11,158,252,210, 22,
-183,232,137,175, 32,102,255,253,224,207,199,  8,223,128, 86,228,151,152,214,157,125, 43,212, 59,122, 93,255,234,170, 46,198,227,
-  1,128, 41,175,115,129,101,183,106,134, 90,127,232,214, 81,170,234,  4, 55, 67, 77, 79, 98,235,149,126, 28,221, 94,143,126, 88,
-221, 10, 60,248, 56,253,212,191,255,201, 73, 81,125,144, 79,138, 98, 32,240,172, 85,248,101,133,210, 92, 37,198,126, 33,119,219,
- 59, 10,173,  6, 26,195, 96,246, 63,187,  7,240, 80,129, 71,218,255,189,215, 89,239,132,215,191,224, 95,239,207,172,135,241,180,
- 50,183,105,231,247,167,170,181,160,234,143, 15,189, 17,223,112,153,247,205,102,234,247,240,125,113,135,  6,250,169,236, 20,159,
- 42, 82, 88,118, 65, 22, 96,196, 98, 16, 26,  0, 27,  7,208,204,197,226,189,133,138,219,160,129, 73,  4,179,122,196,170, 79,145,
-173, 91,215, 58,245,181,123, 55,  1,172, 16,245,130,129,185,174,107,105,245,106, 69,209,135,222,214, 74, 84,109,214, 93,181,224,
- 32,169, 30, 55,188, 68,254, 80,247,185, 38, 32,216,239, 90, 35, 79,227, 33,173,118,  3,114, 74, 82,  8,229, 86,102,156,228, 25,
-174,232,222, 68, 20, 11,207,224,148,186, 93, 45,183,144, 16,138, 78,159, 91, 64,188,143, 22, 73, 45, 93, 75,217, 98,228, 56,101,
- 59,164,217,105, 63,153,189,244, 22, 55,233,115, 87,241,105,203, 94,215,235, 21,228,236, 42,217, 56,100, 40,246,122,234, 90,171,
-248, 36,109,  9,250,234, 37, 80,206,253, 82,120, 14,216,189, 27,216,254,127,192,110,182, 11, 59,212, 92, 97,107, 67,129,102,155,
- 72,224,145,119,252,187, 64, 59,145,249,163,239, 20,224, 50,217,  5,181, 79,166,138,244,184, 88, 83,110,251, 46,254, 40, 77,197,
- 92, 71, 46,237, 48,228,108, 16,159,116, 57,  3,229, 18,152,128,244,183, 78,160,227, 75,160,247,127, 24,184,243, 39,128,221,  7,
-129,147,127, 30,244, 29, 27,104,249, 97,164,255,103, 11,188,229, 20,244, 26,128,199,118, 61,149,193,119,205,125, 37, 77, 77,196,
- 13,182,175,197,196, 38,126,202, 90,197, 85, 82, 98,114,227, 93,227,134, 65,143,  1,122,129,128,183,189,207,110,187,253,111,  2,
-211,139,208,195, 99,224, 66,172,179,190,152,161, 15, 14, 40,231, 35, 38, 17, 28, 19, 87,142,188, 82,168, 76,131, 80,152,252,251,
-240,185,236, 54,128, 51, 98,251,241,209,198, 44,122,112,214,251,140,234,115, 15, 33,165,198, 84,104,240, 41,206,229, 12,236, 12,
-198,105,159,177, 55,250,233, 62,185,248,209,170, 92,161, 25,101,158,172,242,166,138,241,175,106,221,224, 88,151,197,  1,214,230,
-241, 13,230, 97,  2,190, 27,189, 81, 55,128, 51,  8,180,216,199,153, 24,145,205,123, 76, 75, 13,109,196,103, 82,143, 94,101,191,
- 68, 74, 99,100,115, 87, 38,146,155,189, 19, 90, 87,102,202,117, 66, 97, 31, 13,250,205, 82,164,185, 34,184,227,120,  7,195, 98,
- 16,131,147,192, 71,211,165,235, 24,215,  7,126,245,197, 67, 59,150,120,235,178,226,128, 86,106, 69,122,  4,174,204,157,143, 89,
-253, 57,239,  3,137, 34,140,101,115, 67,142,125, 37,238,173, 73,115,218, 46,236,254,222,231, 78,212, 23, 93,114,252, 57,162,150,
- 95,111,235, 10, 83, 26, 23,166, 26,121,203, 93,199, 40, 55, 20, 55,138,158, 30, 71,216,185, 82,241,138,129, 25,140,209, 95,127,
-170,226, 65,155,112,136,119,246, 45, 85,147,106,145, 39,157,215,190, 63,161,171,162, 62, 34, 80,253,159, 93,194,114,218,195,142,
-217,  7,  8,  9,214,162,205,155,193, 50,116,173,111,199,151,180,151,181,255,161, 11, 61, 73,205,102, 15, 61,148, 59,107,  4,215,
-227, 94,105,229, 56, 33, 90,105, 33,186,162, 58,194, 91, 90,120,146,214,  0,170, 40, 52, 98,180, 45,201, 62, 37,165,204,254, 76,
- 16,198, 34,152,167, 17, 74, 84,  1, 63, 80,159, 56,167,100,141,166,154,151, 92, 35,124,140, 93,127, 70,221, 78,202, 71,108, 53,
-208,139,121,241, 26,104, 47,213, 15, 26, 97, 21, 19,117,233,134,212, 86, 69, 11,240,167, 58, 88,170,211,166,229,240, 46,199, 87,
- 73,213,103,167,254,159,173, 51,177,228,170,230, 79,175, 94,244,240,165,219,156,  3,234,163, 13, 94,236,  8,219,135, 85,212,246,
- 39, 49,214,215, 58,191,243, 31, 68, 92, 62, 11,216,168, 35,101, 19,220,185,255, 79,184,249,187,235,115,170,237,  0, 66,135, 17,
-228, 10,152, 33,204,162, 30, 17, 75,208, 98, 30,107,174, 74, 99, 69,137, 52,181, 93,  6, 94, 62,130,246,159,  5,110,253,147,150,
-159,190,251, 10,224,244, 14,112,242,170,207,133,219,108, 95, 75, 76, 33,164,138, 37,232, 53,106,151,250,157,108,145, 65,183,217,
-124,238,167,  9, 56, 20, 80, 33,232,145,150, 80,106,114,245,207,212,118,117, 90,137,101,214,165, 20,239,188, 84, 10,112,225,162,
-187,164, 72,191,116, 10,197, 67,208,215,255,101,227,153, 15,223,  0,108,190, 19,244,161,223,134,158,255,239,224, 95,219,  0, 47,
- 40,114,  1,112, 57, 90, 44, 45, 58,225,106, 66, 85,200, 27,205, 34, 16,190,246,189,133,186,184, 72,  4, 62,152,243, 32,101,247,
- 15,159, 43,232,143,156,  0,219,119,  1,135, 87,129,253, 47,  2,135,207,  0, 15, 20,184,175,192,197,  4,125,124, 68,121,120, 68,
-185,156,113,100,178,176,130,154,  2,232, 81,150,108, 54,147,214, 78,145, 81,222,110, 51, 48, 12,118,195,158,187, 64, 78, 44,200,
- 69,103,255, 85,252,  1,146,149,  1,124,240, 35,100, 15,187,216, 15,197, 57,160,113,242, 91,149,173, 83,105, 34, 59, 47,182, 52,
- 19,102, 49,247,128,176, 29,144,202,192, 60, 95,199, 37,172,113,169,212,237,176, 67,173, 91,104,181,119,212,235,104,179,122, 96,
-121,117,144, 83, 51, 89,244, 24,214,216, 59,  6, 52,  8,157, 64,201,146,216, 90,119, 25,206,  5, 74,181, 46, 94,170,144,137,161,
- 89,236,115,233, 44,  5,245,228,185, 74,189,227,118,123,115, 38,112, 49, 81,224, 20, 24, 82, 93,130, 88, 24,138,169,187,176, 43,
- 69, 43,114, 26,170, 56,110, 89, 32,233, 13,157, 31,176,236,202,121,213,189, 17,154,  7, 92,213,133, 75,234,144, 36,146,250, 81,
-136,203, 55,225,  6,198,187, 23, 65, 76, 75,202, 98,241,169, 76,234,136,126,161,141,141,215,165, 72, 28,200, 13,163,219,176,180,
-198, 32, 79,186, 84,183, 39, 38,220,242, 29,242, 35,109,221,218,164,150,133,174, 62, 37,  8, 81, 96,181,175, 81,123,189,162,219,
-157,189, 64, 80, 16, 70, 63, 91, 83,119, 21,132, 93,242,216,197,160,214, 60,249,174,104, 91, 20,138,175,211,161,235, 13, 94,127,
-220,208,233,211,181, 97,187, 94,143, 26, 14,212,184,234,245,231,103, 69,252,187,105,100, 93,187,122, 63,147,215, 95, 87,187, 48,
- 45, 84,189,137, 88,130,104,232, 82, 72,234,180,  3,228,224, 53,191, 92,179,163, 98,197,157, 95, 44,230,111, 87,103,  6,216,103,
- 89, 22, 47, 70,124,190,169,118,156,188,180,223,233, 53,174,174,255,252, 22,235,170,244,250,133, 82,235,202,169, 90,161, 67,107,
- 65,213,170,232, 24,215,228,151,120,186,198,120,215,106,172,143,202, 32,229,228, 99,135, 14, 66,227,112,139,154,214, 85,230,110,
- 71,175,149,248, 73, 53,161,200,235, 53,181,  3,147,108, 25,224, 86,161, 25, 50,155, 23, 39,229,236,140,173,226,233, 98,102,123,
-  9,  4,106,132, 99, 48,181, 55,172,127,225,194,234,102,135,154, 98, 96,211,  0,212, 45,128,218,  3, 95,216,158, 92, 58, 77,192,
-200,208,251,191,  9,122,174,  0,186,  1,134, 23,140, 91,126,251,229, 70,114,153,220, 62, 87,164, 58,248, 56,249, 71,236,156,128,
-151,124,129,149,217,189, 35,100,161, 33, 91,  6,109,200,172,110,147, 88,106, 27,100,233,163,153,  1, 34,113,162, 30,170,152, 39,
-224, 12,147, 43, 90,139,  0,155,253,209,194, 86,102, 65,250,133, 91,208,227, 35,208, 55,252, 48,112,247,219,  0,254, 67, 64,254,
- 46,208,135,126, 21,184,255, 34,248,213, 13,228,169, 17,188,  7,134,163,162,108, 60,132, 34,160, 38,131,  5,210,105,169,128,106,
-228, 29, 97,251,149, 59, 28,239, 77, 56,124, 97, 90,104,  2,205,172, 64,254,186,101,224,221,103, 64,121, 14,152, 62,  9, 28, 62,
-  1,125,181,  0, 15,  8,120, 92,160,143, 39,200,171, 87, 40, 15,143,166, 51,164,198,170,103,136, 11,198,188,  0, 36, 11,113,161,
- 68,224, 76,118,161,223,102, 32,139,181, 26, 71,231,188,239,197, 46,115,  9,230,123,105, 40, 94,238,144,199,148,236,247,231, 98,
- 28,121, 36,128,199, 46, 89, 36,162,115, 93, 13,229,102,107,114, 70,168,248,231, 99,227,197,246, 88, 86,251,207, 21, 91, 35, 45,
- 84,209,173,189,144,110,151, 86, 15,172,132,101,128,117, 20,210, 97, 91,235, 97, 76,113, 33,178,143,154, 67, 13,223,157,128, 86,
-  7,233,226, 84, 84,223,191, 65,154, 46,130,250,175,231,207,143,106,194, 20, 11,224,  4,179,180,117,231,  0,119, 17,166,129, 27,
- 29,224,184,104, 44,233,120,212, 93,192,189, 99, 32, 14,244, 41, 70,240,145, 59, 79,215, 47,134,168,245,103, 89,238, 80,231,238,
-114, 56,106,203,  7,143, 93,115,133,163,116, 59,199,212,177,  0, 66,246,146,180,159,128,180, 81,119,175,157,239, 83,191,234,100,
- 35,132,166,161, 27,242,  3,211,234, 73,170,230,101,238, 24,230,179,  3,127,224,227,114,192,206, 74, 86,197,142,128, 19, 53,113,
-225, 72,228,197,128,113,235, 51, 20,165,203,160, 47,129, 10, 69,248,182,  9, 59,163,122,184,189, 45,240,195, 84,115, 51,162,144,
-236,127,159,171, 96,177,195,151,214,158,183,157,249,170, 95,202,106,246,165,187,116, 93,119,248,215, 19, 90, 42, 91, 93,181,125,
-237,228, 94,110, 93,105, 38,234, 46, 61, 46,103,194,194,129,181, 96,  5,  4,218, 92,122, 24, 81,151,200, 39,237, 25, 13,103, 74,
-157, 70,145,193,209,214, 69,138,101,142, 21, 16, 89, 50, 41,177,180,221,183, 83, 47,137,150,133,235,178,217,108,254,121,186,  9,
-162,235,119, 48, 92, 92, 87, 95,199,170,121,107,163,122,187,234,186, 72,111,255, 90, 57,178,203,147, 87,167,138,181,120,199,241,
-156,107,178, 91,221,230,184, 80,142,  9,156,125,156, 94,189,184,113, 97,248, 91, 85, 12,255, 74,145, 58,133,142,235, 30, 94,246,
-154,194,  6,191, 44, 45, 83,136,216, 70, 30, 80,177,177,  7, 90,162, 91, 36,224,196, 36, 96,157,207, 87,247,138, 94,161, 14,209,
- 53,177,118,234, 68,135, 98,136, 34,179,128,230, 12,124,246,147,192,187, 30,  0,252,188,197,160,238,190, 26,116,251,163,208, 77,
-105, 39,175,103,202,235,104,136, 81,241,253,138,238,253,199,126,149, 13,233,116, 55,217,105,114,151,129,243, 12,202, 51,148, 11,
-104,199,160,131, 93,236,117, 27, 68,189,242, 81, 59,179,107,219,213, 73,176,198, 61, 88,101,115, 60,  2, 15, 11,100,156,145,127,
-254, 22,240,202, 30,120,255,255, 13,122,203, 63,180, 81,252,237,111,  6, 62,248,179,160,255,229, 33,210,110,  7,188, 65,128,135,
- 19,184, 20,168,159, 60, 82,108,  2, 80, 52, 68, 87,118,136, 83,  1,240, 96,194,197,171, 51,246,179,214, 92,241, 29,155,  6,128,
- 78,  9,116,197,160,223,123, 10,122,211,115, 64,153,129,227,223,129,190,118,  1,124, 97, 11, 60, 60,  2,143, 39,219,163,191,188,
-199,248,100,196, 33, 51,142,165,211,123,  6,175, 94,235, 56,192,192,235,202,160, 77,  2,221,202,198,123, 87, 24,231,125,223,161,
- 97, 39,133, 30, 20,178,159,161, 71,159, 92, 12,238,107, 47,  0,111, 24,180,181,255,110,144,108,182, 89, 38,147,125,190,212,175,
-153,228, 33,204, 27, 24,193,142, 24, 12, 27,201, 77,197, 95, 11,183,252,181,209, 52,215, 49,109, 85,179,251,134,136, 74, 11, 71,
-146, 14,206, 17, 54,152,224,110,107, 99, 57,213,200,207,184,208,213,112,244,214, 33,122, 93, 34,253,254,218,  5, 70, 77, 60,230,
-138,245,210, 35, 99,125,231, 22, 30,250,200,206, 22, 93,100,141,199, 62, 47,226, 63,213,191, 86, 78,230, 79, 19,135, 66,145,235,
- 40,138,134,168, 79,107,177, 82,191,218, 42,121,142,125, 42, 35,157, 91,101, 88,236,223,181,139,221, 92,238, 96, 85,232, 90,135,
- 24,245,200,216,133,213,100,162,150, 72,215,253, 26,252, 57, 65,135,130,221,186,143, 62,  0, 71,225, 34,152, 98,255,172, 75,197,
-117, 79,145,107, 99,234,200, 97,111,183, 75, 80,242,138, 87, 77,228,137,145,165, 27, 19,251,233, 85, 35,107, 99,228,127,215,139,
-151,135, 98,255,174,185,  4,  4,  7,109,154,218, 40,238,234, 20,175,131,199,  8,140, 96, 93,188,  5,210,  5,  8,199,125,237, 74,
-216,185, 56,175, 26,129,253, 80,  9, 20,114,209,155,179,210,251,223,227, 27, 58,243,215,219,127,119,181,227,226, 47,109, 84, 66,
- 93, 68,223, 74,115,100,131,169, 81,230,250, 32, 35,189,  1,108,163,171,194,154,233,186, 48,175, 77,103,216,255,191, 96,170,249,
- 36, 49,225,113,142,191, 68, 81,214,126, 26,209,  2, 42, 38,236,206, 41,119,107,170, 46,106, 55,180, 72,221,228, 64, 87,118,221,
-197, 40,189,183,151,241, 42,238,208,149,114,150,235, 66, 45, 33, 49,214, 73,125, 94,124,104, 53,226,133,163,107,240,186, 62,102,
- 18, 21, 71,151, 22,194, 54, 50,100, 44,115,243, 47,182,214,203,109,106, 84, 95, 48,174, 23,184,184,247,189, 75,237,241,194,  2,
-157,168,164,150, 86, 53,196, 55,217,158,149, 77, 20,164,197,222,148, 89,  5,204,169,218,178,156, 33,212, 69,225,105,221,141,204,
- 98, 37,123,124,128,171, 29, 95, 60,221, 74, 92,128,117,107,  7,252,206, 19,224,240, 41,224,244,121,251, 40,108,222,  9,108,111,
-  1,219,243,142,105, 79,208,217,119,227, 14,233, 22,144,169,182, 47,103,208,189, 88,160, 13,192,217,198,160, 41,103,  0,206, 25,
-116, 72,141, 55,234,185,145, 90, 74,135,124,212,  5, 70, 84,187,241, 81,104,162, 10,128, 34,100, 98,191,177, 96, 83,174,  0,153,
-145,254,193, 41,232,119,183,192,251, 30,  2,239,249, 89,208,155,222, 14,122,231,155,161,223, 86,192,127,251,  2,120, 14,192,238,
-  0,121, 56, 65,142,179, 63,165,234,182,111,155, 98,176, 40,230,  4, 28,175, 20,227,163,201,124,181,126,184,108,  7,155, 36,164,
-228,134,196,153, 65,239,223,  0,195, 91,140,210,118,249,162,  9,227,206,103,224,201,136,242,218, 30,229,229, 61,166,251, 19,206,
-137,219,223,165, 38,118,138,181,115,188,221,217,127, 88, 74,  0,221, 74,192, 29,159,118,204, 98, 43,135,163,216,216,125,180,238,
- 92,199,201,225, 64,102, 95, 35,  1, 56,101,228,103,119,224,119,238, 32,159, 57,122, 96,183,199,178,130, 12, 64, 51,189,232,175,
-240, 96,183,102, 78, 86,245,109,168,222,212,226, 39, 68,114,175, 88, 47,142, 99,191,128,235, 33,195, 90,179,234,235, 46,122, 33,
- 62,181, 98, 41,245,  9, 93,171,118,128,169,169,176, 77, 32,166,216,116, 11,217,234, 20,224,128,129,116,118, 50,191,108,213, 11,
- 66,113, 74, 96,  5,135,112,219,163, 22,174,102,145,197,197,198, 93, 33, 18, 10,238, 56,  3,184,179, 10, 38,210,  5,155, 93, 52,
- 18, 26,215, 97,154,141,  2,201,193,148, 32,120, 16, 20, 85,186, 28,186, 61, 42,117,211,128,198,255,198, 53, 31,111,188, 30,  7,
-  7, 32, 69,178, 30,119, 99,107,243,122,219,139,181,131,226,148,  2,186,226,151,152, 56,173,175, 19,106,114, 71,123,211,174, 91,
- 95,159,143,189,129, 37,206,179,236,197, 86,129, 11, 10,125, 18,161,218, 60,239,189, 55, 41,200,113,  3,  1,119,200, 20,241, 79,
-212, 10, 70, 37,198, 36,197, 24,224,110,173,227, 53, 14, 53,192, 92,176,142, 63,107,155, 90,246,249,242,179,127,135,183, 59,245,
- 59,200,215,121,205, 86,191, 24,171,  7,140,136, 86, 30,248,215, 27,201,223,212,177,215,224, 22,255,220, 44, 46,249, 40, 45, 92,
- 83, 37,184,249,235,172,217,238,139,187,131,156,113,177,  2, 56,209, 10, 14,132, 78,115, 33, 90,  0, 98,204,165,120,231,205, 85,
- 67, 22,  5,170,168,184, 12,220,222, 67,213, 98, 54, 53,181,116,198, 33, 39, 28, 60,128, 69,231,210,105,211,204,115, 30,214,237,
- 94, 23,181, 12,198,105, 33,105,186,250,112,171,234,  2,  8, 23, 86,239,  5, 67,160,183,215,118,226,136,220, 95,222, 11, 43, 69,
-215,181,171,239,108,134,196, 93,229,205, 72,217, 46,116, 18,133, 56,101,103, 65,161,163,190,  3,247, 23,183,120, 71, 47, 22, 29,
- 70, 29,216,161, 97,  8,189, 43,170,163,127,243,252,177,179, 41,153, 18,204,212,102,  3,168,172,108, 59, 67, 54,145,  2,117,187,
-196,120,136,106,101, 44,132,145, 21,  3, 45, 71, 65, 10, 96,  2, 97, 26,  5,219, 39, 51,244, 41,  0, 47, 23,208,131,127,  8,156,
-125,192, 46,221,252, 20,112,114, 23, 56,125,140,106,226, 71,228,216,250,104,100, 38, 43, 42, 84,173,  8,185,240,241,244,206, 23,
-163, 27,  0,119,  1, 92,100,208,149,  9,188,120, 16, 72, 41, 54,242,214,235,130,105,149,182, 63,237, 33, 21,161,143, 40,158,168,
- 53,123, 58,214,246,201,  1,121, 63, 33, 29,182,200, 15, 79, 64, 47, 19,244,247,125,  1,244,182,167, 65,223,240, 12,244,188,128,
-127, 67, 65, 59,167,123,157, 43,228,114, 70, 81, 96,156, 20,199, 66, 11,143,173, 56,228, 98,164, 38,100,225,122, 88,  2,184,  2,
-248, 93,183,128,183,109,  1,121,  6,192,185,155,104,147,229,207,191, 58,162,124,113,143,233,254,  1, 79, 70, 96,239,194,162,210,
-209, 85, 19, 55,114,176,166, 21,248,154,201,  4,114,196,192,147, 17, 56,159,  0,177,203, 92,198,217, 58,245, 89,128, 99,177,131,
- 83,140,194,151,158,201,224, 63,254, 38,224,168,160, 79,222, 51,237,195, 35,  1,222,154,128,111,217,  1,211, 30,184,250,152,249,
-233,161,150,124,115,178, 74,238,112,227,108,124,126, 39, 68,148,102, 75,150,170, 33, 72, 21,226,228, 69,133,218,207, 34,101,181,
-251,149,128,213,248,123,156,154,102, 65,168,159,136, 53, 23, 71,  4,118,204,107,100, 42, 26, 99, 54,249,  8, 54,190,  7, 13, 27,
- 39,119,151, 15,147,137, 28,181, 41,164,251, 28,241,224,138,135,144,172,196,254,152, 21, 92,150, 59, 76,210,166, 56,  7,217,  0,
-100, 46, 77,137, 22, 48, 29,234, 24,227,234, 99,228, 44,237,178,184,150,138,230,226, 51,146, 54,129,  8, 82, 94,205, 15,143, 38,
- 65,123, 14,185,214, 21,197, 16,138,245,216,128, 57,249,112, 19,170,246, 14, 66, 51,119, 84,182, 62, 87,189, 58, 79,168,105, 40,
-215, 23,133, 84, 94,128,221,164, 19,  8, 91,106, 66, 56, 37,211, 25, 69,220,110,184,  8, 82, 45,128,216,255, 14,155,184,100, 54,
-254,250,222, 33, 81,129,150,157,203,140, 89,230, 58,246, 79,157,238,172,208,178, 43,182,129,147,107, 10, 58,249, 88,238,126,182,
-187,254,135,207,197,146,221,116,101,125,147,158, 97,161,171,120, 94,220,156,163,190,206, 26,232,221, 16,116,237,146,239,189,236,
- 88,169,185,151,127, 22,171, 34,224,154,181, 78,227,190,106,109, 49,215,176,161,229, 61,  0, 38, 23,126, 39,204,170,152, 74, 65,
- 82,173,233, 66,169, 91, 55, 36, 15,226,153,165, 56,103,189,205, 23, 44,122, 85,145, 83, 66, 73, 25,101, 46,109,246, 17, 14,176,
-133, 37,184, 41, 41,235,190,189,254,115,170,218,153,126, 53, 87,109,145, 62,247, 87, 18, 44,205,200,254,222, 74,139, 62, 87,102,
-243,169, 83,181,174, 81, 21,140,244,187,194,196,140,156,216,187,  8, 70,206, 25,156,147,121,104,231,217, 41, 87, 33, 46,241, 81,
-187, 56,218,115, 81,165,249,  7, 93,164,230,206,114,141,175,236, 55, 12, 90,191, 31,138, 25, 98,177,165, 95,  8,221,108, 20,202,
-  0,101, 16, 44,197,134, 96, 33, 46, 66, 12,114, 97, 76,237, 44, 84,160,106,160,254, 18,177,137,157, 30,138,184,137, 72,110, 93,
- 58,121,108,206,208, 23,127, 13,244,214,189,213,200,124, 98,214,182,211,207,181, 36, 20, 54,130,144, 42, 42,250,149,130,245,152,
- 93, 29,127, 14,208,203, 62,235,123,118,107,229,246,211,217,196,114,158,  1,142, 98, 99, 29,157,157, 15,223,193,  9,122,152, 70,
-139,150,109, 67,145,232,231,139,211,190, 70, 34,108, 39,193,246,201, 30,122,156,145, 14,179,135,116,100,208,219,206, 64, 31,184,
- 11, 61,  8,232, 11, 64,122,214, 22,142,186, 47, 40,123,207,114, 22, 64,192, 21,  0,163,  2,140,213,163,109, 16, 12, 48, 76,104,
-152,  0, 62,  2,252,245, 59,208, 16,201,107, 23,118, 67,157, 37, 96,231, 76,247,243, 25,135,163,224, 64,  9,135, 82,  3,235,236,
-107,144,219,154,130,192, 43,106, 23,123, 60,184, 91,216,132, 67, 11,112, 25,204,125,177, 14,116, 20, 72,237,216,255,127,198,222,
- 45,214,186, 44,187,239,250,141, 49,231, 90,123,159,115,190,239,171, 75,119,117,117,181,187,221,118,219,177, 29,108, 18, 59,177,
-157,155, 29,146, 16, 64, 40, 79, 33, 68, 81,128,135,  4,164, 16,  9,129,120,  8,239, 65, 32, 16,215,  7,224, 33, 40,188,192, 19,
- 10,  2,  9, 41, 70, 74, 32,196, 36, 16,133, 64, 18, 39,142,113,220,238,118,187,219, 93,221,213,117,253,110,231,156,189,215,154,
-115, 14, 30,198,152,107,205,125,170, 58,144,168,228,170,254, 46,103, 95,214, 90, 99,142, 49,254,255,223,191,109,118, 48, 81,113,
- 83,241, 87,239,176,191,125, 71,187, 45,126, 45, 93, 37,248,210,236,175,237, 27,  2,245,180, 47,182,147,238,214,136,117,168,176,
- 38, 81,119,119,160,133, 12,234,104, 19,208,100,100,243,  3, 16,205, 46, 70,110,250, 32, 80, 37,169,132,170,222,208,  7, 39, 97,
-189,160, 45,246,233,152,109,154,193,126,198,209,  7, 15,212, 20, 98, 45,237,215,160,250, 24, 86, 59, 76,100, 56,  8, 20,113,112,
-203, 50, 82,204,228,210, 55,222,163,100, 83,116,212,246,160, 93,147,173,127,240, 14,217,  2,232, 39,189, 57, 48,127,166,148,113,
-  4, 31, 98,188, 50, 48,222,215, 22, 98,213, 33, 93,172,201,206,208,238,191, 38,131, 24,118, 76, 69,235,  5,186, 79,249,242, 48,
- 57,232,221,120,119,188,108,170,246,193,130,215,226,160, 86, 54, 62,254, 94,236,107, 28,244,237, 98,159,126,105, 53, 45,131, 54,
- 64, 90, 80,136, 17,159,  6,244,160, 22, 81,154,212,109,220,190,154,119, 83,115,208, 51,251, 99,115, 59, 88,  8, 28,195,215,239,
- 78,164,180,  1, 76, 74, 93,247,156,140, 88,125, 20,219, 73,110, 53,254,220, 14,247,186, 68,180, 90,199,246,138,175, 89,102,133,
-167,230,124,130, 58,236,228,245,  1, 32,233,130, 14,103,151, 99,239, 81, 32,122, 81,184,135,206, 83,185,204,101, 31,133,114, 31,
-215,212,127,130,189,250, 19,211,225, 46,251,125, 29,212,152,194,190,126,234,255,187,108, 33, 50, 26,250,  7, 15, 24,219,109,134,
-157, 70,232,127, 71,109, 70,109,213,181, 97,145, 23, 66, 36,128,214, 90,161, 86, 14, 57, 83,115,166, 46,203,160, 84,237,141,222,
- 30,191,219, 68, 55,163,229, 37, 88,134, 45, 36,201, 66,173, 63,102, 65,192,238, 65,255,216,126, 62,180, 44,194,110, 87,218, 26,
-173,126, 52, 72,114,121, 10,245,184,186, 68,206,126,230,201, 41,145,167,217,111,242, 90,247, 93,222,166,164,216,227, 88, 85,186,
-221,109, 15,214, 27, 71, 86,  4,172,166, 35, 94,251,254,184,159,198, 71,101,171, 10,113,106,175, 36, 75, 30,105, 24,163,246,166,
-234,224,148,174,174,143,211, 47, 10,137, 11, 79,216, 32,104,150, 93,  0, 56,  4,157,136,193, 57, 65,185,171,232,243, 21,121,116,
-128,175,188, 11, 63,249, 54, 76, 63,  4,233, 10,242,247,192,205, 47,186,133, 11, 13,143,164,186, 95, 90,109,112, 74,198, 72, 41,
- 27,122,231,186,  3, 14,103,127, 10, 61, 14,255,250,107, 13, 57, 53,184,173,232, 57,209,104, 97,135,169, 99,102,142,255,109, 50,
-140,220,251,248,125,195, 58,198,124,163,249, 94,113, 85, 71, 32, 22,140,235,187, 51, 83, 49,248,  7, 74, 58, 42,150, 64,190,231,
-  6,126,215, 19,248, 95, 27,170,110, 33,108, 31,158,177,231,141,146,166,136,165,245,207,116, 83, 76,203, 62, 82, 22,133,137, 40,
- 52, 77, 32,207,240,197, 43, 44,221, 32,245, 29, 40,223,118,208, 75, 82, 47,172, 55,254,225, 23, 81,135, 56, 52,134, 14,172,143,
-133,119,247,182, 89,196,156, 87, 65,102, 69, 30, 37,111,  3,215,230,187,244, 90,177,197,104,119, 43,237,222,211,236,108,173,251,
- 67, 49,108,113,235,251,247,216,127,191,  4, 60, 61,161,175, 95,195,143,100,228,149, 43,176,199,208,190,  1,211,167, 65,174, 92,
- 52, 39,  2,231, 21, 78,234, 35,253,184,198, 71, 79,121,227,242,115,232,187,241,238,215,215,161,155,126,136,193,244,149,153,109,
-194,183, 54,140,194, 68, 46, 28, 63, 91,244,166,138,175, 39,242, 32,255, 61, 74,247, 32, 59,161,173,231, 37,148, 16,122,109,106,
-225,100,212,234, 93, 91, 11,141, 73,  7,185,172,178,147,238, 76,119,110,120,181, 93, 65, 91,  6,156,170, 60,200, 50,207,178,191,
-207,113,199,175,195,238,216,134,226,144,128, 41, 41,214,  4, 93,140, 22, 81,176, 23, 29,157,141,107,132,253, 64,128,108,209, 10,
-241,235,126, 40,185, 22,119,142,106,240,203,117, 40,238,189,240,204,161, 79,245,113,188, 31,232,235,112, 95,149, 65, 81, 95,135,
-169, 65, 31,183,143, 92,117,196,134, 60,123,255,188, 78,241,185,245,201,100,137,239,193, 26, 28,213,  2,147,171, 17,107,219,182,
-238,235, 62, 14, 12,115,136,138, 25, 28,  8, 34,112,101,198, 25,227, 44, 29,203,236,182,133,148,140,220,124, 12,156, 98, 28,255,
-188, 99, 98,  7,240,237, 39, 97, 85, 71, 69,249, 20,248,216,  3,240,170,248,159,127,106,254,119,209,184, 16,104,217, 39,116,216,
-246, 96, 74,242, 73, 49,171,227,218,169, 31, 42,251,225, 32,125,146, 16,220, 46, 27,202, 11,246,195,240, 35, 26,123,124, 44,193,
-126,239,153,236,109, 16,152,118, 91,143, 88,136,102,187,112, 78, 28,217, 44, 67,168, 82, 11,187,154,201,110, 23,221,142,114, 54,
-116,202,219,228,162, 81, 91, 37,155,215,200, 53,197, 51,163, 61,220,255, 71,231,190,  5,178,216,158, 99, 60, 28, 93, 68,190,139,
-129,208, 62,225,127, 29,214,107, 61, 81,179,119,  4,210,105,160,200,104,235,136, 81,158,122,234, 75,202, 19, 42, 48,165,228,169,
- 52,165, 96,181,184,234, 54,167, 61,166,117, 16,248,104,223,187, 15, 86,158,189, 11,217, 25,243,180,134, 73, 10,200,130,207,227,
-198,174,158,190,235,232,179,159,152,  8,152,164, 77, 49, 44,177, 92, 76,129, 13,109,214, 80,177,205,111,232,210,199, 97,227,101,
-182,185,118, 91,220,173,146,252,102, 95, 13,150, 38,172,107, 99,250,112,197, 94, 57,194, 55,238,145, 15,255, 38,188,245, 35, 80,
-103, 56,252, 38,228,201, 95,193,166, 53,210,195,  4, 73, 13, 59,143, 75, 40,245,180, 51, 51,172,130,205, 70,187, 19,244,125,129,
-195,226, 10,179, 43,133, 87,147,251,214, 75, 70,175, 93,189, 45,197,144, 82, 47, 18,212, 90, 40,224,123,129,237,227,223,106,178,
- 41,117,187,181,105,141, 12,224,170,208, 84, 48, 21,110,150,130,124,248, 18,249, 37, 65,143,134, 77,138,188, 57, 99, 63,253,  4,
-254, 90, 69,175, 27,114,179, 48,127,180,146,172,208,204, 85,195,155,176,164,139,103,162,203,153,155,243,222,147,250,232, 61,253,
-200, 12,175,205, 72,170,176,126, 21,158, 47,216,123, 13,238, 23, 56,175,113, 98,110,152,122,145,217, 60,170,109, 31, 51,183,  7,
-196, 53,233,208,161, 89,124,159,158, 92, 65,207,157,139,227,218,253, 74,187, 43, 78,118, 90, 43,245,108,145,179,220,173, 66, 70,
- 43,149, 85,141,212, 38,242,205,  1,126,230,  0, 63, 32,112,252, 45,206,231,124,244,127,186, 93,177,171,219,106,241,133,230,210,
-176,151,149,182,238,126,217, 58, 88, 62, 91,218,187,207, 52,176,199,183,180, 51,251,132, 16,146, 17, 12,209,117,  4, 35,254, 49,
-108,139, 93, 68,170, 98,155,105, 98,138,207, 93,163,221,153,227,254,220,167,113, 29,149,233,226, 79,171, 67, 16, 96, 12, 56,212,
- 70,110,183, 95,186,107, 40,171,187,205,205,234,142,141,221,114,161,183,  7,169,108, 29,222,106,195,238,115,  0, 97, 72, 29,112,
-208,114, 25, 69, 74, 20,222, 47,228,196, 15,253,233,215, 56,253,218,202,207,255, 79, 47, 88,180,110,185,240, 34,187, 55,125,204,
-207,110, 31, 43, 25,141, 73,125, 35,115,140, 29,250, 33, 58,246,195,224, 61, 47,195, 33, 97, 14,183, 76,141,233,192,194,254, 93,
-241,  9,133, 47,109,  5,209,182,247, 62,160,187,221, 34,187,117,233, 62,182,173,155, 23,168,139,224,124, 20,223,209,164, 30, 88,
-211, 11,155,110, 19,130,110,255,237,105,135, 26,118, 56, 84, 67, 87,208,168,230, 35,252,132,112,147,179,143,119, 91,221,  2,160,
- 22,115,241,219,102, 53, 30, 62,187,244, 64, 96,120,148,125,125,145,250,103, 38,240,174, 25, 95,110,178,225,127,215,161, 32,247,
-107,185,125, 12,129, 40,223, 85,241,254,208, 87,126, 97,249,250, 46, 52,191,209,197,253,208,223,223,203,192,212,143, 46, 50,122,
-210,173, 27,187, 46,184,240, 12, 53,173, 79,138, 26,144, 74,101, 74, 74,155, 18,101,141, 48,175,176,172, 89,232,197, 58,201,109,
-139, 56,189, 96, 68, 64,173,149, 82, 11,146, 60,103,189,172,235, 62,102,231, 50,215,100,131,196,116,191,185,236,159,128,141, 29,
-248, 54, 95,177,253,122,219,141, 72,241,190,122,188, 97,219,185, 21,131, 48, 47, 51, 60,152, 70,116, 93, 74,137,249,112,140,204,
-102,239,212,235,178,108,180,174,113, 28,214,187,100, 21,245,135,141,237,227, 57, 29,200,114,189,208,111,167, 50,147,176,132,196,
-120, 36, 58,119,207,136,238,127,191, 99, 62, 83,192,107, 90, 51, 68, 42,154, 52,190,196,120, 88,137,239,213,173,  4,127,217,243,
- 75,221, 46, 23,199,202,142, 63, 85,118, 85,124,231,199,247, 81,218, 25,225,100,141,171,219, 51,172, 87, 32, 87,216,215,254, 26,
-242,214, 31,243, 39,223,244, 37,120,244, 58, 60,249, 22,124, 71,246,150, 77,234,222,210,230,234, 92,247,136,254,172, 40, 58, 23,
-228, 37,200,119, 98,  4,252,153,131,255,223, 79,185,239, 90,106, 67,215,176,117, 88,130,243,128,100,221, 66,225,194,198, 22, 94,
-245, 58,140, 10,155,237,161,136,219,174, 51, 32, 33, 96,112, 90,224, 91,183,228,100,232,141, 96,250,  8, 62,115,132, 31,187, 70,
-254,247,149,244,202,204,244,209,137, 71,207, 43, 77,109,139,214,236, 87, 69,177,184,217,197,200, 41, 56,222,193,193,151,159,188,
-114,170,222,169,120,200,202,211, 21, 62, 90,225,105,161,125,176,210,158,158,169,167,194, 34,187,224, 40,244,128, 27,112, 38,201,
-131,174, 44, 43, 50,137,115,222,175,162,226,220, 45,112, 46,212, 82,105,167, 74, 91,156,202,103,167,230, 73, 69,253,230,173,248,
-159,157,  4,121,169,164,215, 15,200,207, 94, 33,191, 45,193,107,223, 15,135,159,  5,251,187,240,248, 10, 30,253, 33, 79, 59, 97,
-129,245, 12,207,103, 56,249,123,105,193,106,110,131,235, 35,133,229,176,213, 88, 89,109,247,207, 78,112,179,225,193,218,134, 29,
-120,191,207, 90,252, 55,131,208,173,197,110,116,251, 59,163,160, 31,196, 41,136,185, 19,228, 34, 67,189,239,254,182, 60,244,200,
- 56,  0,241, 49,188,121,241,213,176,207,140, 99,250,115,172,138,114, 40,249,123, 71,166, 49,146,181, 40,248,173,249,195,114,137,
-247,144,135,177,234, 22,192,216,125,230,106, 14,111,106, 59,161,178, 92, 76,232,  4, 45,198,231,127,112,230, 83,127,234,179,124,
-231,223,125, 59, 44,100,186, 17, 40,221,158,231,175,127,244,208, 39,118,133,123,127,228,215, 10,171,  6,139, 61, 62,199, 28,121,
-240,121,155, 20, 94, 10,255,186,176, 49,197,251, 28,133,124,187,132,218,  6,145,217,131, 76,249, 49,161, 79, 60,181,176,170,231,
- 74,180,177,131,141, 66,127,  6,212,132,169, 55, 58,106, 78,245,139,233, 94,137,213,200, 58,  0,121,196,218,246,185, 46, 64,221,
-158,183,190,210,172,145, 24, 54,171, 70,132,109,227,208,140,123,115,189, 64,137,  9,  0,230,107,178,113, 85,209, 15, 61,115, 92,
- 87, 19,194,  1,227,213, 16,170,126, 20,135,236,105,216,239, 86,219,225, 64, 29, 73,108,  3,195,236, 99,180,188, 79,240,168, 63,
-220,185,203, 39,  2,107,228,193,129, 96,224, 52,  6,169, 84,135, 73,212, 40,251, 22,121,200, 55,176, 75,229,189,236,  1, 65, 18,
-153,227,158,175,145, 72,  8, 53,188,109,210,247,225,253, 61,181, 29,242, 42,195,200,193,164,139, 63, 43,173, 22, 44,133, 83, 70,
-118,135,217,199,135, 23, 97, 27, 31,222,153,116,177,182,141,244,184, 75,101,193,197,103,170, 67,117, 31, 79,204,162,177,234, 22,
-154, 53,239,212,181, 83,225,162, 70, 77, 41, 49, 29, 15,190, 55, 87,197, 90,161, 45,107,100, 53,142,175,115,143,147, 75,227,130,
-127,179, 39,200, 38,102,209, 62,254,136, 27,184,191, 72, 29, 80, 12,210,153,238, 12, 62, 19, 11, 96,140, 73, 88,218,162,179,219,
-104,114,187,186, 64, 52,147,181,120,102,238,134, 55, 77,180,230,  9, 57,157,102,183,239, 88, 90,252,247,136,118,244,132,170,114,
-106,200,179, 21,125,243,  6,254,254,219,200, 79,124, 21, 14, 63, 10,211,235,112,253,121,120,229,155,142, 43,213,206,236, 12,238,
-120, 53,247,160,  7, 75,222,215, 48, 70, 43,  6,147,145,146, 56,152,230, 74,225,149, 12,175,206,126, 92,191,173,200,148,144, 67,
- 69,170, 98, 75, 95,137,184,  0,168,218,  3,161, 92,221,213,193, 45,212,146, 59,220,223,127, 61,137,231, 97, 91, 92, 12,122,119,
-130,183,141,233, 23, 50,146,179, 43,137,126,248, 10,222, 61,145,254,110,193,222,186,230, 81,121,  9,247,198,253, 72,136,136,182,
-167,  4, 24, 38,107, 24, 17, 42,104,155,224,211, 71,191,251,159, 23,231,203,191, 40,240,188, 97, 79,207,180,119,238,168,239,156,
- 57,173, 94, 76, 74,187, 84, 92,111,240, 37,219, 39, 47,106,230,142,138,163, 34, 61, 24,103,109,240, 34,138,248, 82,177,123,215,
- 61, 88,169,212,210,252, 80, 19,123,232, 52, 59,121, 80, 94, 10,249,250,128,254,204, 53,242, 59, 21, 94,255, 18, 28,127,  7, 60,
-250, 97,104,191,232, 18,254,252,134,115, 72, 85, 93,  0,  0, 32,  0, 73, 68, 65, 84,223,250,245,  4,167,  2, 47, 38,184, 95,105,
-247,171,103,168,199, 94,183, 67,153, 44, 68,130, 45, 78,220, 73,205, 31,218,195,216,118,203,188,139, 40,223, 60, 20, 17,141, 81,
- 92, 69, 46,246,145, 41,212,236,155,142, 37, 30,188,199,188, 25, 19,252, 48,  5,148,102, 14, 58,209,216,  1,246,131,127,219,145,
-171, 23, 65, 50,253,220,105,126,224,233,211,191,201,220,221,176, 70, 92,234, 20, 42,226,142, 65, 61,197,132, 70,101,232,214, 69,
- 54, 55, 74,221,198,235,182, 17, 26, 77, 46, 19,198,198, 17,235, 57, 11,191,248,246,153,175,252,142, 47,243,206,169, 81,242,160,
-180,111,123, 23,165, 54,132,214,236,228,219,173, 67, 86,204,187,210,104,  2, 90,136, 46,171,250,123,201, 15,  8,115, 41,246,215,
-141,198, 57, 26,146,212,181, 41, 24, 41,104,149,107, 32,114,203, 16, 94,147,135, 17,189, 61, 40, 64, 61,188,165, 13, 10,103, 17,
- 15, 70,233,175, 97, 17, 35, 53, 97,214, 93, 44,136, 53,154,213, 77, 85,191,142, 97, 44, 18,223,175,217,214,165, 75,240,188,187,
-206, 66, 27,220,168,176,138,146,178,178,214,198,201,154, 31,228,  6,157, 71,126,160,148,159,  6, 58,222, 97,136,170,189, 53,191,
- 55,207,248, 65, 69,255, 81,133,119,176,120,201,102,177,147, 61,206,214,246,231,127, 26, 86, 40,233, 19,236,111, 23, 42,240,255,
-207,162,127,169,253,224, 31,137,175, 29,138,228, 32,156, 67,253,117,106,107,241,217, 23,212, 52, 82, 22, 53, 38,101,117, 72, 82,
-220,201,115, 26,240, 24,179, 65,148,230, 32,127,102, 81, 74,210,143, 71,250,142, 25,  5, 49,126, 55,227,  1, 65,199,235, 27, 49,
-173,186, 32,  1, 92,188, 87,217, 18,  4,205, 46,231, 28, 35,243,130, 62, 13, 84,118,110,123, 18, 97, 58, 30,200,121,114,243,253,
-186,210,150,101, 51,196,143,126,112,137,211,189,198,194, 80,  6, 99,188,196,155, 87,235,102,122,219, 82,216,186,165, 67,182,227,
-190,108,226, 56,137, 83,148, 14,129, 48, 18, 66, 55,105,145,187,206, 78, 31,186,200,207, 85,104,154,209,182,110, 97, 36,116,113,
- 68, 43,174,218, 86,139,  8,203,222, 17,201, 54, 89,232,236,229,  5, 88,170,146,111,213, 49,  8,223, 17,236,237,255, 14,249,193,
-223, 28, 32,154,239, 67, 30,255,173,128, 85, 93,178, 41, 77,125,207,220,106, 48,225,107,116, 32,217,104,201,124, 92,253, 29, 65,
-166,228,119,217,227, 12,175, 39,120, 49, 35,165,185,111,124,109,200, 65,161, 42,170,141,244, 80,144,189,183, 12, 91, 81,111, 35,
- 55,112,120,  0,166,234,163,185,151, 49, 98,189,185, 59,163, 95,123, 65, 62, 38, 56, 26,252,224, 53,252,212,171,240,110, 33,189,
-231, 21,247,250,237, 91,210,226,147,232,206,121,111,125, 12,220, 15, 70,102,112,111,232,167, 50,242,102,134,251,213, 69,108,239,
-173,240,108,197, 94, 20,234,123,247,180,119,110, 57, 61,175,188,192,155,248, 90,247,211,127,239, 96, 71, 94,245, 22,  5, 60, 43,
-122,157,145, 39, 49,143,190,109,112, 50,218,185, 98,119,149,182, 84, 90,105,180,210,188,139,139,167,134, 22, 33, 29, 18,106,  9,
-101, 34,253,236, 19,228,167,129, 79,125,  1,110,254, 41,184,250, 41, 79,222, 75, 97, 97,179,219,120,  1,247,216,121,133,187, 35,
-237,174,210,238, 43, 69,246,232,210,222,221,173,163, 88, 77, 26, 71, 21,166,201, 11,156, 68, 18,108, 22,219,114,177, 51,123,199,
- 36,195,200,119, 79,180,178,205,186,214, 39,104, 89,118,254,205,228,146, 17,166,  8, 20,233,157,185,198,153,186, 14,237,144,137,
-109,215,159, 14,254,172,120,246, 92,104,  1,164,237,153,240, 50, 20,209,222,149,118,139,149,170,176,110,129, 49,251,  3,210,226,
-243,104,195, 92, 52, 17,168,229, 46, 26, 77, 46,220,235, 35,102, 17,227,221, 72,204, 35,251,103, 35,173,131, 82,246, 70,160,155,
-226,114,116,251, 15, 65, 58,189,251,190,183, 61,142,225, 44,126,125,245,177,249, 33, 10,215,213, 54, 94,222,119,179, 59,244,134,
- 77, 23,116,148,189,211, 61,  5, 22, 56, 43,204,205, 29, 37, 13, 15,214,185,136, 92, 21,219,184,  1,237,129, 13,171, 14, 44,250,
-210,237,117,157,  5,208, 44,  4, 90,126, 72,234,180,178, 46,158,244,  8,137, 78, 48,219,249, 29, 19,178,137,239, 92,160,232,211,
-200, 87, 85,169,147,240,172, 26,169,213, 13,125,173, 92, 38,  2,110,126,123, 51,238,205, 11, 92,143,201,205,230,177, 10,175,170,
-112,107, 54,232, 34, 46, 15,102, 15,197,108,124,  2,150,119,196,192,238,184,100,249,255,  5,173,185, 40,238,221, 49,241, 96,124,
-255,241,  0,158,125,226, 85,135,189,143,134,199,123,211,  3,217,160, 12,176,248,118,154, 55,180,118, 33,110,145,139,156,248,174,
-117, 32,116, 76, 94,136,117, 83,181, 39,129,156, 50, 69, 19,180,117,143,151, 29, 87,205, 92, 38, 59, 94, 88, 56,101,176,183,198,
-184,199, 62, 86,172, 71, 55,201, 78, 46, 20,233, 41,111,251,100, 55,239,187,239,230,113,134,135,153,124,188, 34,231, 68, 59,159,
-105,181, 92,188, 16,177, 75,190,110, 47,212,105,195, 70,201,198,235,238,170,248,144, 21,122, 40,252,118,234,105, 23, 56,  6, 98,
-143,216, 57,242,253, 82, 81,188,107,115, 50, 80,195, 84, 54, 46, 61,244,  3,133, 51,120, 83,200,117, 37,130, 96,104,  1,212, 81,
- 37,137, 71,178,118, 84,167,199,123,122,130,156, 13,240,189, 42,194,170,202,189,192,225,233,  9,125,166,112,117,196,254,254,223,
- 65,190,248, 27, 32,111,130,188, 10, 87, 25,142,134,204,186,181, 82, 22,119,178,117,175, 82, 11, 90, 92,143,131, 43,134, 93, 11,
-237,110, 33,189,167,112, 35,158,226,118,152, 28,  6,115,154,144,165,160,167,134, 29,156, 97, 46, 39,127, 95,170,251,133,121, 73,
- 80,218, 31, 10,151,227,155,253, 33,223,173,240, 32, 72, 49,210,135,247,240,171, 66,190,137,133,223,247, 63,130,223,243, 24,249,
-249, 70,154,  3, 10,242,173, 91,244, 92, 57,171, 68,142, 65, 15,249,136,194, 30, 64, 54,253,109, 87, 48, 37,120,247,  4,239, 23,
-248,176, 98, 79, 23,234, 71, 39,202, 59,119,156,158, 87,158, 54,120, 81, 61, 63,186,180, 61,193,204,199, 97,187, 74,215,245,141,
-222,137,104, 86,228, 70, 93,165, 46,  2,119,133,118,183, 14, 54,182,234,187,245, 98,155, 42, 61, 37,225,240,138, 34,166,232, 71,
-202,244,123,158,192,239, 86,120,227, 51,112,243, 71,225,250,183, 67,122,205,203,133,253, 26, 76,143,156, 31, 64,117,  8,205,189,
- 23, 40, 91, 10,182,182, 13,194, 65,108, 87, 84,108, 27,231,117,240,220, 85,246,215,188,244,  2, 43,206,197,239,132, 51, 77,254,
- 17,155, 93,210,209,210,  0,183,238,153,  5,157,  1, 49,169,187,235,166, 96,170,107,222, 59, 44, 27, 70,244, 77,217,196, 62, 22,
-124,239,162,157, 26,108,172,131, 72, 85,185,132,126,116,216, 76, 71, 63,183,225,129, 57,169,123,115,171,117, 47,249, 46,166,235,
- 22,170,132, 68,199,214,194,110, 25,159, 73,243,137,142,  4, 70, 53,133,210,184, 63, 88,167,176, 71,166, 16, 76,246, 14, 63,133,
-114, 59,162,145, 28,207,178,141, 93,119, 17, 37,114, 41,202,187,141, 67,120,239, 58,167,240,105, 47,195,196, 96, 18, 23,118,246,
-248,212,145,145,158,250,225, 50, 10,246, 42, 67, 42,156,176,129, 99,232,124,252, 14,113,161, 99, 97, 47, 11,155, 92,252,251, 62,
- 34,214,136, 92,213,176, 95,245,103, 99,194,152,172, 81,194, 93,178, 91,233,236, 99,214,174,106, 70,193, 56, 53, 97, 73,209, 85,
- 55, 99,166,241, 24,223,217, 44, 42, 44, 45,128, 42, 67,183,105,155,109,215, 63, 47, 98, 10,213, 15, 79,136,235, 14, 94, 65,120,
- 79,132,151,151,219,243,139,240,145,203, 49,187,241,113, 42,249, 88, 47,  2, 64,246,  9, 44,130, 11, 42,229, 39, 40,222,101,236,
- 94, 47,244, 12,131,148, 99,176,226, 61, 44,244, 91,126,187,236,113,214,163,134,204, 34,196,203,137,  2,186,231, 55,116,146, 92,
- 36, 22, 73,136, 29, 77,221,181,142,133, 91,203,246,231,109,202, 57, 26,206,117,211, 76,140,209,213,221,171, 79, 28,  6,250, 74,
-120, 44,174, 54, 40,227, 62, 17,191, 59,172,102, 68, 46,167, 39,163,184, 47,239, 66, 55, 15, 96,153,175,174, 56,222, 60, 66, 13,
-214, 82, 49, 89, 54, 30, 50, 54,224, 96,199,209,206,112, 44,219, 22,251,125,116, 46, 50,124,113, 93, 16, 23, 31,148, 10,153,206,
-185, 13,220,234,166,126,207,155,100,  6,243,215,230, 22,161, 72,136,139, 14,187, 43,130, 84,117, 51,247,183,148,227, 20, 94,  7,
- 64,155,143,239, 69,133, 89,125, 84,149, 69, 93,104, 21,187, 61, 83,165,102,199,100,158,109, 97, 61, 11,249, 37,216,103, 30,193,
- 55,159, 97, 31,252, 37,228,181, 63, 14,114,240,167,114,210,253,248, 61, 68, 36,153,183, 75,126,114,138,163,188, 53,193,146,250,
-136,183,  1,207,238, 73,239,167, 24,193, 11, 60,158,224,117, 67,238,162,168,227,105, 65, 84, 69,215,186,141, 41,229, 99,  8, 82,
-219, 18,201,218,  5,220,146, 13,133,216,247,160,247,236,170,183,199,239,222, 33,191,148, 72,143,131,212,246,249, 43,248,241,138,
-252,125,200,159,143, 86,229,131, 59,218,125,243,142, 43,126,198,  5, 73,234,  4,242,165,217, 91,164,119, 87,120,231, 76,187, 47,
-212, 15, 78,212,247,238,185,127, 86,121, 86,133,167,213,184, 47,134, 85,185, 16,196,169,218,118,  0,236, 74,105,237,236,247, 89,
-209, 87, 39,127, 10,159, 10, 60,107,216, 18, 97, 63,231,138,157, 42,165, 52,106,140,196,105, 62, 10,151, 44,200,251,144, 62,117,
-133,252,222, 25,222,184,134,171, 63,  0, 55, 63, 13, 50,131, 62,130,122, 15,167, 95,129,116, 19,173,223, 45,172, 95,246, 15,232,
- 84,225, 84,169,181,  5, 19,168,167,145,237,174,140,254,136,243, 61,185,109, 58,146, 37, 62,235,154,246,128,162, 67,238,122,221,
- 93, 24,168, 92, 38,177,233,224, 62,201,  2,179, 26,  7,132, 89, 93,144,168,182,187, 53, 82,188, 38,213,157, 61,190, 67, 90,188,
-160, 53, 31,161,237,116,190, 40,138, 73,135, 84,174,  7, 10,101, 29,198, 94,169,249,123,104,197,167, 52,105,219, 37,126,188,235,
-235,157, 84, 27, 12, 59,221, 51,124,165, 78,194,234,118,157, 37, 14,  9,217,130,129,207,158,220,216,215, 14,125,228, 93, 59,107,
-162, 55, 78,245,242, 64,178, 29, 12,163,219,236, 31,231,201,188, 51, 31,  5, 98, 41, 62,156, 49,109,210,  6,165,180, 70,150, 68,
-199,176,118,238,144,176, 49,161,252,121, 40,193,178, 24,124,245, 50, 88, 12,235,224, 20,105,  3,176,166,110, 10,106,247, 72,247,
-200,212,214, 53, 68,253, 61,119,101,181,217, 37,183,195,220,239,222,197,188, 69,140,181,117, 26,158, 95, 23,199,232,252, 23, 81,
-214,156, 57,181,198, 82, 43, 45,136,151,122,129,184,253, 56, 91,125,  9,173, 78, 18,225,177, 24,207,251, 65,244,  1, 31,227,227,
-133,134,125,138,123,241,252,145,193,138, 43,219,161,201, 46,214,225,114, 33,132,227, 19,121,242,118, 17,169, 59,162,130, 31,172,
-214, 47,166,182,163, 83, 52,199,180,100,200,117,219,242,206,205,122,236,170,215,170,108,221, 85,149,176,  0,203,140,  2,242,237,
-136, 35,234, 17,225, 49, 73,158, 82, 34,205, 19,165, 44,113, 61, 63,160, 42,110,127, 71, 28,114,205,134,116,188,161,155, 55,185,
-108,205,226, 90,223,119, 15,163,221, 80,246, 67, 65,219,185, 34, 89,  6, 27,219,124, 60,114,245,248, 21,242,225,192,249,131,247,
- 40,167,123, 31, 51,200,195, 14,209, 30,124,248, 59, 61,106,159, 96,200,  0,222, 31,113,173,251,254, 93,163, 43,239,161, 43,158,
-165,221, 16,139,164,155, 36, 23,  9, 52, 26, 65, 49, 27, 86,182, 43, 50,107,137,240,145, 20, 10, 97,143,198,147,240,195,170,169,
-147,207,180,109,235,130, 89, 93,156, 86, 55, 98,195,228, 96,142,174,140,159,175, 89, 21,230, 23,  2,247,130,220, 63,193,126,225,
-231,145,159,253,253,160,175, 70,250, 78, 60, 77,102,245,153,221, 54, 19,143, 95, 43,182, 17,177,164, 25, 90, 26,173,234,230,151,
-209, 15,207,200,147,104,229,110, 50,188, 38,240,114, 66, 78, 21,213, 70,171,174,136,215,185,146,150, 30, 77,250,144,216, 53,192,
-106,236, 65,  0,134,109,  3,146,109,223,182,169, 66,139,241,248, 91, 47,145,127,144,208, 39, 17,105,250,155,174,225,100,200,215,
- 32,127,111,131, 12,243,219,183,222, 13,203,112, 93,137, 63, 61,229,160,232, 15, 93,193,211,  5,222, 59, 83,223, 61, 83,159,157,
-168, 79, 23,238,111, 43,207, 26, 60, 43,198,237,234, 15,229, 58,100,124,107,116, 68,132, 31,125,180, 81,106, 22,228, 38, 33,143,
-226,105,185, 86,236, 28, 59,244,147,239,212,203,218, 28, 26, 18,226,161, 41,246, 38,246,162,162,118, 36,253,190,107,248,172,192,
-213,143,195,227, 63, 18,237,193, 11,224,173, 40,224,207,224,250, 71,233,137,232,180,251,120,106,155,179,228, 67, 36,103, 38, 23,
- 29, 79,191,137, 59, 73,174,131, 80, 38,221, 69,244,214,132,163, 42,143, 94,203,220,222, 22,238, 79, 49, 94,237,154,152,  1, 82,
-211, 49,159, 83,116,234,  7,109, 28,146,112,200,198,193,134, 34,221, 25,240, 93,203,208,115,160, 85, 28,112, 19,123,129,181,237,
-248,224,169,238, 59,238, 62,157,234, 32,156,180,209,235,252,201, 82, 91, 15,156,  9, 10, 93, 27,138, 94, 20, 12,135,203,216, 86,
-252, 54, 46,184,236,140,241,237, 59, 84,245, 12,136,197, 56,100,119, 49,220, 53, 99,109,126,  8,107,181,243,187, 45, 16,175,187,
- 53,172, 61,120,176, 79,230, 22,188, 49,253, 76,147,131,110,182,247, 38,123,102,121, 25,196,109, 26,157,105,223,163,223,196,247,
-181, 12,200,229,126, 48, 40, 15, 15,196,241,123,231, 88, 33,230,152,108, 60, 84,201,111,106,247, 11, 38,254, 30,122,196,246,222,
-124,196,111,  3,  6,116,140,123,232,222,248, 62, 66,110, 23,196,181, 29,155,112, 68,220,166, 55, 92,151, 77, 60,179,126,109,198,
- 65,132, 43, 77, 44, 41,113, 42,133, 86,203,118,253,245,255,215, 39, 25, 45, 80, 26,121,179,  5, 10,111,  8,220,137,240, 65,172,
- 61,234,128,223,181,  7, 48,154,109,170,208,131,187,100,111,252, 54,193,219, 39,140,222,117, 80,183,203,  3,240,144, 12,204,253,
-139, 38,197,134, 12,  4,216, 84,250, 99,226,218,229, 78,122,239,126, 45,116, 27,253,154, 32, 56, 39, 93,159,165, 61,153, 16,113,
-155, 90,132,176,116,228,107, 74,137, 98, 30,250,226, 35,123,191,198,179, 42, 73,149,148,148, 60,205,212,116,218,109,108,181,125,
-204,137,223,177,234,150, 98, 12,212,227,202,217,195,159, 44,104,130, 66,231,226,219,197,228, 99,163,181,246,207,224,  1,109, 47,
-111, 31,164,  8, 87,175, 60,225,240,232, 17,119,239,190,203,249,233, 71,126,114, 57,206,190,119,174,109, 43,232, 23,123,141, 22,
- 30,242,180,199,220,165, 17, 26, 32,125,252,210, 87,253,178,117,253,180,126,243, 15, 75,255, 48,238, 75,210,125,236, 30,106,211,
- 36,138, 78, 93, 26,235, 93,188,106,192,108,226, 68,154,114, 70,146,  4, 75,221, 89,213, 41, 37,180, 70,152, 97, 50, 82,242, 81,
- 19,154,144, 57, 83, 83, 70, 34,124, 70, 85,209, 57, 33,182, 82,234, 74, 57, 41,250, 66,145,207,222, 96, 95,121, 15,251,241,191,
-130, 92,255, 65,152, 31,131,125,228,130,172, 28,147,131,214, 47,246,186,157,194,182,116,159,184, 33, 82, 11,161, 87, 18,218, 82,
-208,119,206,254, 69,125, 17,143, 22,253, 28,176, 22,228,157,134,166,134,205,  9, 43,149, 92, 42,107,227, 19,191,  3,121,168, 54,
- 29,191,225,158,191, 45,193,139, 55,243, 60, 19,133,116, 46,200,215,111,153, 63, 61, 35,175,101, 47,236, 63,114,  5,181, 32,  7,
- 23,231,180,251,194,244,238,125, 32, 47,135,179,243,169, 34,143,102,239,242,191,118, 79,123,127,165,190,127,166, 60, 63,113,186,
-107, 60, 67,120,182, 56,166,125, 41, 59, 79,154, 65,255,240, 48,141, 84, 35,220, 67,115, 70, 31,101, 15,112, 49,188, 75,127,233,
-222, 92,107,141,118,170,148, 98,172, 58, 28,109, 36,114,  5,238,148,252,133,107,248, 97,156,254,119,243, 47,248, 33,108,253, 57,
-200, 63,  1,182,192,179, 63, 31,145, 91,223, 27,109, 85,129,250,190,119,233,173, 97,165,243,176, 47, 52,184,254, 80,172, 46,108,
-209,208, 27,180,120,210,206,201,  5, 81,147,249,195,241,205, 63,242, 58,135,127,252,154,119,254,163,111,177,158,171,119, 97,109,
- 87,185,247,142, 61,199, 67,112, 22, 99, 82,227,144, 60, 25,246,208,131, 94,218, 37, 58, 53,137, 96, 57,206,147, 53,214, 46, 45,
-196,144,177,166, 41, 65,146, 43, 33,172,147,  0,140, 39, 49, 86,241,137, 86, 23,191,101,213, 96,102,216,214, 33, 62, 20, 55,141,
- 15,194, 44,123,183, 39,109,119,143,244,  7,177,178,231,185,191,218, 18, 63,250,251,175,121,252, 86,230,151,255,226, 75,168,149,
-151,129,140,197, 42, 41,251, 52,128, 56,108,168,143,  5,250,237,189,117, 44, 45,124,233,133,125,167,223,  6,192, 79, 29, 56, 20,
- 58,168,221,115,220, 11,157,228,150,187,147,128,125, 35,216,133,141, 43,182,137,213,212, 46,  9,115, 58, 48,  5,186,127,127,212,
-243,104,216,172,250,129, 98,215,136,236,133,162, 35,114,243, 54, 29,240, 61,137,217, 64,223, 28,145,189,177,107, 87,118, 16,209,
-136, 14, 85,196, 85,234,236,233,207,253,190, 55, 51,180, 25,  7, 77, 72, 78,156, 85,184,175,149, 18, 66,231,142,165,173, 49,144,
-219, 33, 74,254, 30,102,224,179, 98,220,197,116,207, 98,218, 32, 23,134, 43, 63,108, 62,124,175,250, 93, 68,108,198,101, 70,250,
-  5,156,230,193,234, 34,141, 43, 12,217,247,206,227,248, 93, 47,208,203,253, 51,116,155, 47,210,182, 67,131,154, 11, 89,221,158,
- 45,204,121, 98, 78,153,148, 53,108,133,198,221,186,114, 94,150, 40,236,141, 82, 93,232,168, 41,109,  7,  8,149,152, 42,167,180,
-117,206,190, 89,210,168, 97,137, 41,103,214, 52, 97,  1,181, 25, 11,178,116,135, 86, 63,204,  4,241,172,239,195,183,137, 68,172,
-140,233,124,130,152, 76,143,228,169, 77,159,208, 63,144, 90,183,160,165,102, 70,206,170,136, 53,166,121,230,250,149,215,169,203,
-202,249,217, 71,187, 24,160,214, 77, 36, 48, 18,  9, 58, 36,134,192,178,118,159,142, 14,251, 14,137,238, 96, 19, 27,168, 70,135,
- 32, 91, 40,132, 14,251,133,125,180,153,  3, 54,177,211,230,146,166,  0, 51, 40,170, 57, 10,167,111, 83,147,122,102,168, 89,133,
-214, 85,240,182,229, 75,251,168, 36, 88, 96,234, 10,244, 60, 37,208,188,133,209, 88,155,252,131,233,106,131,249,136,233, 53,205,
- 42,237, 30,100,173,112,186,194,222,254, 91,200, 15,253, 62,120,242, 57,184,249,  0,158, 38,223,171,231,184,251,171,245,133,233,
- 86,  0, 91,  0, 16, 90,216, 82,178, 85, 90, 21,184, 95,247,143,245, 70,225,179,147,231,174,191,113, 64,150,134,182,138,181,236,
- 40,217, 83, 35, 75,243,157,223, 56, 14, 26, 10,  4, 23, 65, 15,195,141,110,123,158,112, 75, 65,194, 74,110,105,202, 47, 78,164,
- 47,191, 32,191, 49,195,147,  9,222,186,130, 31,186,129, 89,144, 73,200,167, 66,123, 94, 40, 47, 22,202,188,255, 32, 59, 27,250,
-195, 19,162,  9,251,176,210, 94,172,212,211,194,122,106,188,140,100,212,251,  2,167, 98, 30, 91,218, 46, 79,243, 26,  0,  5,123,
- 16,252,160, 13, 15,185,121, 53,121,146,201,185,193,139,117,207, 73, 95, 10,237,220, 92,224, 19, 95,149,171,151, 45,212,248, 25,
-249,169,  4,159,  1,174,255,  0, 28,126,  4,150,255, 27,110,255,  2,188,242,187,225,252, 53,248,234,207,193,147,207,134,210,172,
-184, 56, 96,253,  0,206, 96,119,254,148,148, 42,164,201, 79,237,162, 66, 43,254,218,214,236,135,157,164, 61,242,120,239,192, 83,
-246,209,242, 49, 11,105, 53,206,127,249, 41,229,220,200, 17,105,219,185,235,157,212, 54, 73,223, 97,155,239,209,213,199,245,199,
-208, 44,108,216,220, 58, 78,191,100, 19,150,238, 88,207,248,255, 25, 82,141,123,173,117, 27, 82,240,243,155, 23,211,221,222, 37,
-177, 87,180,109, 55, 44,234, 66,198,109, 79,152,118,235, 97,211, 30, 80, 35,219,100,173,127,111,235,192,138, 63, 35, 28,129,207,
-136,240,227, 63,113,228,213, 63,251, 22,207,255,139, 15,184, 93,140, 41, 11, 95,122, 34, 92, 63, 86,190,252,109,227,229,185, 49,
-137,120,134,184,244,195,254,195, 88, 89,118,201, 86,127, 13,  3,167,189, 63,204,100, 24,185, 78, 33,142,139,212, 94,150,232, 94,
-206,192,157,193,213,131, 29,120,177, 29,130,212,199,237,149, 49, 54,245,  1, 36, 37,186,197,142,142,237, 57, 64,109,  3,246,216,
-133, 90,191,178,107,141, 82,128, 95, 68, 19,102,141,181,219,218,108,199,213,122,190,189,109,175,227, 48,192,136, 42,198,179,102,
-172,102,220,136,112, 80,223,245,223,197,251,235,175,249,100, 70,181, 66,149,152,233,164,140,137, 58,106,182,218, 86,208,235, 48,
- 46,239,253,244,106, 14,181,121, 75,224,237, 33,108,187, 12,123,155,135,246,181,110,137,188,212,180, 95, 98, 95,237,  1,135,221,
- 30,144,  9,101,224,216,203,240,186,218,131, 70,230,227, 94,120, 25,208,170,241, 89,199,207,154, 68,152,231, 25, 81,229,160,202,
- 33,254,189,198, 84, 35, 11, 60, 57, 30,184, 21,225,188, 44,  1,156,106,172,197,208, 86,201,154, 72, 57, 83,171, 11, 60, 53,128,
-103, 42,194, 60, 77,204,121,242,102, 34,108,224,170,234,161, 47,146,144,109, 39, 31,112, 53,213,203,168,191, 56,208,111, 66,185,
-168,185,200, 16, 23, 59,  0,115,250, 73, 92, 58,251,165,167, 46, 90,187,248,172,115, 47, 16,211,213, 53, 34,202,249,195,247,177,
- 86, 73, 49,234,182,230,  1, 20,219,152,183,141,187, 45,187,136,147,235,129, 15, 50,228,225, 89,219,173, 58, 59, 80,120,143, 94,
- 53,177, 75, 11, 69,196,112,138,166, 16,  4,197, 62, 49,101, 68,213,243,129,251, 95,106,178,143,101, 84,125, 92, 29,159,152,166,
-228, 16, 22,171,219,233,162,219, 45,242,148, 73,243,140,106, 34,139,255,156, 86,154,103,229,138,208,242, 68, 17,104,234, 65,142,
-182, 86,236,121, 65, 30, 77,216, 47, 60,133, 47,254, 26, 60,250, 61,240,195,255,  0,222, 87,164, 30,144,171,130,220, 23,135,208,
-212,225, 65,180,141,193,219, 32,234, 48,244, 84,177,164,148, 21,210,210, 72, 61,180,228, 83,192, 27,  9,214,140,190,172,216,109,
-197, 84,105, 42,228,192, 80,246, 24,198,214, 62, 94,212,251, 15,113, 79,187,109,206,195,174,158, 95,171, 63,128,170,193, 11,132,
-  9, 99,122,247, 30,253,198, 75,244,205,  9, 30, 39,228,213, 35,246,  5, 71,215,166,231, 71,242,119,206, 76,183, 11,231, 26, 98,
- 30,241, 39, 72,250,173, 71, 79, 73, 59, 87,108, 41,212,219,194, 73,125,197,126,110, 91, 58, 42,181,250,131, 43,119,110,252,176,
- 23,221, 31,226, 94,236,179,129, 94, 37,164,199,172, 62, 55,236, 46,118,233,203, 74,123, 89, 57,135, 29, 30,237, 15, 84,191, 57,
-245,165,146,127,246, 10,249, 25,131,199, 95,132,155,127, 30,218,115,120,250,231,160, 28,225,230,125,248,234,191,135,253,124, 67,
-254,153, 21,202,119,160,188,112,107,226,122,139,156, 58,223,160,145,102,229, 40,153,169, 56,194, 94,196, 56,215,202, 20,136,226,
-121,240,214,247,110, 37,197,237, 80, 90,229,163,255,229, 67,172, 64,206,198, 77, 51,206,145, 69,211, 98,164, 62, 77,151,178,140,
- 94,208,181,119,101,113, 16,242,137,211, 80,180, 58,119,160,236, 11, 68, 17,217,  3,157,194,251,170,125,160, 21,254,121,146,175,
- 42,188,232,105,164,159, 93,238,253,146,169,131,117,194,179,219,  6, 38,168, 12, 55,104, 31,101,143, 93,171, 13,251,232,163, 40,
-143,111, 18,203,  2,191,242, 47,125,131, 95,255,230, 25,142, 62,193,120,114,149, 88,171,112,223,217,255,227,142, 48,152,237,231,
- 17,244,210, 71,188,136, 71,101,110,  9,145,251,186,198,  6,176, 84, 30,186,245, 14,140, 89,227, 78, 60, 15,196,191,137, 97,234,
-240, 32,103,162,171,215, 11,151,118,186,135, 10,237, 49,100, 68,113, 29,196,210, 99, 79,195,106,184, 69,208,198,250, 43,111,207,
- 71,161,104,102,105,133, 37,210, 38,235, 64,181,235,  5, 61,110,181,120, 95, 18, 44, 13, 47,250, 39, 51,142,182, 79, 78, 12,184,
- 55,225,212,191,187, 77,136, 90,157,133, 46, 66,211, 41,172,  9,118, 49,254, 39,  2,175,122,242, 92,197,157,  3,111,  0,223, 30,
-150,214, 77,118, 17, 95,226,227, 80, 25,249, 46,126,245,241, 23,210, 72,103,124, 16,190,178,233,133,162,144,183,225,226,146,143,
-129,110,236,162,248,251, 33,207,127, 80,238,135,224,128, 24,204,170, 78,126,179,176,154, 86,219,234, 11,  8,215,243,140,136,176,
-156,207, 62,245,141,212,202,181, 57,248, 71,123, 81,166, 23,244,204, 52,249,  1, 33,135,114, 85,194,182,184, 29, 56,181,139, 73,
-251,159, 29, 35, 89,  7,173,205, 40, 69, 84, 15,241,233,246,241,109, 58, 34, 26,153, 12,109,111,134,154,131,202,198,252,217,200,
-108,240, 14,238,112, 56, 96,101,101,185,125,177,239, 55, 25, 58,146,202,150,235,189, 73, 13, 98,124,176,157, 73,173,133, 77,104,
- 80,207,137, 12, 40,200, 22,  2,162,174, 53,220, 97, 15,253, 43, 75,236,130, 58,149,180,219,232,196, 51,220,181,245, 55, 57, 90,
- 23, 64,152,104,211,238,239, 52, 81, 87,104, 71,106,154,166,196,156,148, 89,  3, 76,146,149,164, 25,116,242,177,208,212,  3, 89,
- 10,181, 54, 86,171, 84,170,127,192,171, 97, 47,110,189,139,126, 87,176,111,253, 60,242,165,127, 21,249,210,247, 97, 31,126, 29,
-249,135,  9, 93,103,236, 84,145,114,142,194,240,192,110, 55,140,157, 22,224, 80, 27,237, 92,208,212,124,207,249,222,  9,189, 81,
- 56, 28,225, 58,160, 52, 47,162,248, 83,177, 50,161, 47, 27, 89, 93, 36, 19, 43,159, 13, 50,163,253, 59,130,216,199,199, 13,210,
-  6, 97, 83,183,204,244,221, 82,133,231,147,112,188,175,164,175,220, 50,127,238,  8,111,100, 56, 36,228,181, 71,190,199,126, 94,
- 73,111, 29,152,158,159,152, 63, 44,156,230,254,176, 85,228, 11, 51,118, 42,216,203, 70,123, 89,176,106, 59, 71,187, 26,107,101,
- 75, 99, 75,195, 67,106, 76,127,178,237, 70, 15, 22,127, 18,244, 73,114,232, 12,158,116,215,238, 35,137,237,222, 71,239,139, 25,
- 75,235,211,159,184,129,138,248, 65,244, 79,190,  1,159,250,157, 48,255, 49,152,222,128,167,127, 30,158,253, 58,188,242,187,224,
-254, 47,194,127,242, 11,112,243,  4,251,104, 69,222,248,  8,202, 45,200, 17,150,123, 88, 61,156, 72, 87, 33,201,196,141, 78,164,
-183,142, 44,182,242,193,251,103, 82,114, 30,180,  6,216,163,167, 74, 69,102,  7, 53, 84,214,102,198,169,143,188, 67, 89,125,115,
-244,110,189, 87,  9,213,125,188,154,197,187,216,237,144,208, 15, 79,246,128,110,221,175,169, 18,197,221,100,115,121,244, 15, 56,
-137,119,236,210,161, 50, 33,  0,235, 93,134,163,228,216,216,195, 45,130, 43,208,228, 15,175, 22,105,137,114,233,155,149,102,212,
-136,218,181,145,229, 30, 34,186,202, 14, 46,153, 50,124, 88,225,221, 95, 57,113, 90, 43,105,246,142,250, 84,141,191,247,237,133,
-115,219,229, 40,213, 46,109, 98,163,112,175,  7,232,200,199,210,186,100,139, 18,221,195,235,108, 75,173,235,136,217, 50,226,119,
-101,136,106, 53, 47, 88,155, 56, 45,174,191,177, 19,111,118,121, 96,233,130,177, 54, 92,191, 57, 38, 22,123, 96,138,127,118,182,
- 89, 80,213, 15, 14, 97, 31,107,  6,247,213,173,173, 41, 92, 57,146, 18, 82,108, 83,213,111, 49,209, 92, 54,117,155,252,164,147,
-253,226,247, 85,235,148, 63,225,206,224, 30,219,112,191,102, 59, 68, 42,137, 33, 45,214,152,120,150, 71,193, 40,165,239,219,133,
- 81,164,222, 51,233, 39,241, 80,201,219,176, 65, 54, 60, 59,160,223,184,163,120,242,187,121,204,211,102, 69,148, 77,227, 49,254,
-190,244, 64,180, 55,198,139,242,  0, 79, 60,166, 26,118,123,180,245, 70,  9,221, 82, 14,251, 10,163,103, 53,168,250,180,130,208,
- 55,229, 16, 91,247,224, 50, 21, 31,205,183, 90,169,107, 27, 54,224, 30,222,226,186,  1, 69,163, 27, 79,154,226, 30,236,209,227,
-138, 53,219,130,135,182, 87,168,186,217,207,122, 82,219,229,218,177,141,121,115,113, 16,145,224, 54,196,113, 53,103,255,253,181,
-110,212, 57, 19,243, 70,180,121,103, 48,240,107, 28, 41, 45,  2,109, 93, 56, 61,251,  0, 43,  5, 85,137,209, 96, 87,221,202,102,
-146,183,118,233,127, 28, 61,130,221,226,214,195, 26,122,164,107, 31,207,247, 81,225, 22,231, 55, 96,253, 44,126,221, 85,237,213,
-197,114,216, 46,204,107, 30,120,226,187,246,200,217,238,118,163, 96, 90, 39,149, 45,173,216, 68,156, 20,166, 57,  0, 19, 19,135,
- 57,197, 14,113,  9, 42, 93,242, 49,137, 37,207,124, 43, 11, 22,178,228,138,112,110,194, 25, 35,151,123,148, 10,247,  7,228,201,
- 12, 95,254, 50,124,113,133, 87,254, 36,252,214,255, 24,202, 61,250, 75, 51,118, 88,177,121,193,206, 50,140, 78,108,195,229,142,
-118,156,130,145,207,197,217,245, 87,130,188, 80,228,189, 16,206, 29, 20, 30, 77,240, 61, 13, 89,103,244, 93,207,162,183, 86,153,
-111, 87,150,136,195,237,157,146,251, 51,219, 38,212,234, 57,222,163,136,194,194, 74,214,113,175, 29, 17,128,192, 85, 54, 14, 31,
-156,200,255,240,  5,250,169, 25,187, 81,100,158,145,215,174,177, 79,175,232,103,102,210,251, 71, 14,207,111, 61, 59,120, 49,166,
- 89,145,207, 29,225, 89,241, 36,182,115,219,198,145, 37, 52, 34,173,123,148, 35,183,219, 70,229,170, 93,166, 56,117,149,178, 94,
- 41,242, 56,195, 44,216,125,133,151,  5, 91,188,123,110,119,133,117, 53, 78,230, 83,128, 20, 15, 29,  5,228, 30,210,111,203,240,
-250, 15,193,213,159,130,252, 38, 44, 95,133,167,255, 35, 76,103,120,235, 26,254,231,191, 12,255,143, 32,127, 80,177, 91,243, 42,
- 91, 79,174, 40, 91, 94,192,115, 65,238,253, 53,206,249,136,254,137,183,224,247,126, 31,249,231,126,149, 23,255,237,219, 76, 89,
-209,115,221, 73,120,  3,247,157,  1,188,210,177,174,125,132,234,144, 65,225,224, 27,159, 56,  4,244,220,  1,127,192, 75, 44,239,
-172,140,236,244, 93, 81,188,249,247,211, 94,137,100, 82,180,122,213,238,124,233,150,118,149,188,  5, 27,190,197, 31,105,170,123,
-209,139,184, 97,205,137,154,179,119, 46,141,141,165,173, 13,215,125,152,  7, 47,245,112, 26,217, 73,200,126, 24,141, 80,154, 20,
- 29, 82,  1,150,210, 40,197,255, 93,147,113,182,240,171,211,  3, 51,188,163, 95, 30,200,169, 55, 88,201,246, 44,113, 62,121, 25,
- 14,197, 91,  7, 46,186,177, 48, 54,  1,227,144, 52, 82,  7,245, 80,142,239,105,142, 29,193, 26,180,189,218, 97, 44,225,135,110,
-  1, 25, 42,109, 31, 77,143, 68,180, 78,163, 76,182, 91,236, 26, 66,141,168, 77, 53,227, 96,141,151,205,239,111,217, 52, 69,193,
-127,143,235, 33, 85, 95,  1,170,184,128,215, 90, 76,162,182,130,238, 33, 45, 54,132,109,141, 14,174, 26,123,250, 37, 38, 14,218,
-140, 59,220,123,190,  6,222,181,  4,227,126,233, 62,104,219,227,173,175,  5, 30,137, 32, 41,145,179,178,182, 18, 78,137,221, 27,
-159,  7,183,213,163,248,236,239,245,242,128,110,195, 52,164,141,106,182, 40,224, 50,136, 73, 63,201,186,246, 73, 88,217, 49,126,
-102, 51,100, 14,146,246,190,251,135, 75,102, 65,138,233, 71, 26,232,124,125,159, 62,231,204,164,153,166,123,250,103,214, 20,159,
-181,120, 97,196,255,183,148, 18,117, 29,243, 24, 36,  4,143, 14, 12,114, 30,195, 52,172, 29,188,232,175,165,112, 62,159,246,125,
- 85, 47,214,162, 81,216, 99, 50, 50,178,225,187, 63,222,218,112,205,219,230,145, 23, 77,144,252,184,105, 53,186,234,176,202, 89,
-  4,202,108,235,240, 97, 39,149,189,219, 19,150, 23,207, 99,148,199, 94,140, 67, 41,222, 51, 75,164,237, 84,254,109,  7,208,125,
-176,155,  2, 54,132,115,106, 23, 35,117, 25,114,217,181, 95,  5, 18,103,238,142,146,181,253,103,123,235,211,144, 41,145,196,247,
-254, 82,107,188,158,136,124, 29,148, 22,162,126,186,202,105,194, 52,251,216, 35, 79,126, 58,107,141, 84, 11,185,174,126, 27,204,
-215, 30,202, 37, 13,105, 37, 50,217,129,150,168, 65,189,195,217, 42,104,105,204,210, 72, 77,105,119,134,188, 34,200,251, 43,220,
-253, 29,120,245,159, 67, 62,253, 39,176, 31,251,243,240, 62,200,203,  9, 57, 77,200,121, 55,151,105,218, 71,167,125,159,170,  3,
-232, 99, 90, 26,118,172,212, 86,144,143, 22,210, 87,194, 59,254,217, 25, 94,157,224,243,134,174,206, 59, 55,105,112, 94,209,123,
-219, 44, 80,163,250,180,200,101,190, 51,219,110,210, 46, 58,157,190, 59, 92,155,239,161,159,171,112, 93,141,249,155,247,204, 95,
-191,131, 79, 37,184,190,135,199,215,200,167, 39,236,245,153,252,217, 35,237, 69,225,234,195,123,202,210,200, 79, 38,228,149,  9,
-222,190,195,110, 27,173,122, 44,100,107,194,186, 70, 65, 11,121,109,103,138,247, 19,170, 93,156, 84,101,219,181, 37,112,224,204,
-167, 34,211,252,133, 97,119, 94,208,157, 34, 87,125,180, 95,221,186, 52, 53,227,216,161, 51,162,200, 19,131,114, 15,122,140, 27,
-224,  8,239,124,  7,126,236,  7,224,244, 62,252,185,167,158,208,118, 29,  0,236, 52,197,  7,120, 11,235,135, 91, 59,167,139,194,
-143, 92,195,111,255, 52,188,253, 33,203, 95,253,144, 90, 27, 89,140, 26, 64,149,238, 21, 31,133, 89, 58,236, 10,219, 39,196, 83,
- 54,131, 41,137,199,174, 86,187, 12,158,216, 86, 41, 35, 53, 97,223, 25,106,216,245, 46,158,136, 37,148,180,178,175,195, 52, 78,
-114, 54, 27,156,186,141, 75, 40, 37, 30,180,213, 88, 66,237, 62,205,217,173, 59,165,110,215, 77,149,232,127,196,187,153,146,161,
-157,135,196, 52, 25, 14, 24, 23, 22, 57,219,216,244, 75,  8, 58, 20, 99,137,174,186,198,137, 39,165,192,108,118, 69,222,158, 31,
-187,117,163,235,134,247,188, 28,195,187,168,183,  3,129,188,251,221, 35, 72,109, 19,234,245,168,212, 78,238,115,112,203, 30,109,
-171,120,150,248,135, 13, 14,209,181, 31,  4,110, 68,184, 18,227,118, 16,198,173,157,138, 57,116,229,105, 56,110,173,131, 23,165,
-231,157, 79,248, 65, 70,104, 84,243,226, 57,245,149, 99,196,177,182, 45, 53,206,187, 63,107,142,136,110, 56,236,167,109,233,116,
-131, 15,124, 83,209,239,249,225,125,219,183,154, 31, 86,150, 88,  1,172,155, 32,206,226, 85,235,  6, 46,170, 13, 42, 53, 98,105,
-133, 67,154,168,102, 44,173,114, 54,219,120,248, 50, 28,108,110,100,136, 30, 30, 58,244, 98,151,161, 56,123,167, 61,136,  0, 31,
-104, 24, 46, 16,174, 99, 71,223,181, 41, 67, 34,226, 30,246,181, 23,253, 61,238,119,228,188, 15, 52,205,254,247,105, 98,202, 19,
- 57, 79,126,152,214, 60,208,233,108, 43,252,253, 26, 81,140,115, 74,225,168,104, 33,232,213,193,162,183,199,170,246,105,192,106,
-141,211,233,158,245,174, 81, 75,217,236, 20, 93,  8, 71, 76,  4, 58, 79,196,185, 18,  3,191,101,176,  1, 42,130,230, 20,161, 84,
-234,148, 76,139,  3,159, 57,120,173,  9,180, 18,201,113, 99,131, 20,112, 39, 33,117,248,204,238,237, 16,217,115,162, 53,  4,  1,
-163, 54, 81, 31, 36,202,136,250, 30, 67, 30,230, 59, 52, 11,172,171, 93, 38,191,117, 53,109,236,  6,205,218, 54, 42,212,129,190,
-211,  3, 11,114,139,145,  7,169,115,122,182, 81,155,198, 29,111,146, 34,130, 53, 78, 63, 41,185, 48,196,124,207, 46, 20,178, 52,
- 38, 51,180,174,  8,179,183, 76,156,125,239, 81, 28,142,223, 90,115,111,123, 92,158, 42,226, 44,248,166, 28,214,226,  9, 97,103,
- 64, 50,246,141,191,130,124,250, 15,195,213, 63,129,188,249,247,176,239,255,235,232, 59, 19,237,148,144, 91,193,206, 27,135,242,
-130,122,100,131,250,187,198,193, 43,175, 21,206, 66,109, 62,122,209,183,197,213, 60,175, 31,225,205,217, 47,162,197,125,198,118,
- 87,152, 94,156, 72, 27,242,112, 87,188, 39,221,253,188, 29, 70, 48,  2, 50, 30,142,178, 44,150,135,103,133,231,  9,142,207, 22,
-244,107,119,228,207,206,216,107, 25,153, 19,188,126,  3,159, 62, 33,119,  7,242, 93,113, 63,231,243, 19,250, 36,111,214, 54, 43,
- 45, 28,124,110, 89, 90,205, 40,205, 73,118,173,231,139,219,254, 96,218, 78,171,186,143,231, 82,115,224, 74,122, 37, 33,143, 34,
-  7,247,105,120,211,173,209,150, 70, 57, 25,103,224, 92,124, 63, 76, 26, 85,245,  2,223, 94,160, 78,238, 71,151,  5, 94,252, 60,
- 60, 21, 56, 37,236,143,255,111,176, 20,228, 39,175,176,215, 20, 94, 83,208, 79,  7, 45,232,153,179,241,107,168,211, 14, 10,185,
-210,254,203,175,176,252,157, 91,158, 47,103,150,107,176, 83, 40,214,181,143,184, 98, 74, 16, 32,163,  1, 70,181,237, 43, 85,118,
- 97,153,246,144,  8,193,221, 34,179,250,205, 95,119, 22,170,204,138,148,134, 84,223,233,181, 16, 22,166,126,  3,173, 33,122, 20,
-193,170, 57,164,103,245, 20, 22, 75, 46,197, 54,240,140,121,226,231,212,128,230,152,177,  6,149,108,186,154, 96, 62, 80,207,197,
-247,129,214,227,131,157, 31, 42,109,191, 88, 53,117, 49,142,108,157,122,178, 93,  4, 11,161, 79,159,  0,  0, 32,  0, 73, 68, 65,
- 84,218,119,254,181,107, 86,226, 33,185,118,190, 69,127, 24, 70, 65,219,125,207,187, 53,213,198,209,178,237, 22, 88, 27,188,185,
-186,141,194,101, 19, 65,141,224,151,141,182, 21,146,  3, 29, 20,213,182, 29,190,132, 89,225,101,137,  0,167, 16,207,245,115,222,
- 85,124,  4, 79,217,227, 90,123,166,250,238,248,191, 92,  7, 48,216,166, 68,140, 99,168,198,155,249, 88,157,234,197, 65,  3,195,
-186, 39, 91,249,148,102, 78,217, 57,240,107,217, 26,164, 17, 62, 83,227,103,106, 76, 74,138,236,170,253, 14,254,177, 56, 20, 45,
-113,160, 40,246, 48,153,173, 33,161,207, 40,192, 18, 14,130, 85, 96,150,198,181, 42,105,154, 41,235,194,210,124,234,214,115,225,
-123,209, 62,196,189, 90,  6,145, 96,150, 62,129, 12, 48,143, 13,140,128,161,208,202, 39,224, 93,199,181,203,244,224,247, 43,151,
-180, 68,100,183,113, 93, 10,233,252, 59, 77, 26,246,179,152, 20, 95,105,230,230,120,224,120, 56,122,224,138,106,236,184, 97, 41,
- 37,226,191,247,134, 32,247,196,197,136, 22,111,117,136, 81, 29,174,196,205, 18, 88, 27,118, 62,179,134,101,176,139, 88, 69,117,
- 56,148,135, 35, 76,  6, 72,140, 74, 88,221,118,207,177,  4, 66, 86, 83,222,190,251, 62, 29,176, 90,220,205,160,201,233,131,181,
- 68, 65,127,160,242, 80, 54, 91,119,102,243,141,239,234,204, 78,153, 75,125,116,228,179, 27, 87,192,142,128,123,145,109, 44,181,
-205,228,  6, 70, 49, 22, 96, 14, 46,253,133, 58,140,215, 82, 20,231, 62,218,218,176,136,219,127,183, 24,153,168,143,222,123,146,
- 81,107, 27,222, 79,106,245, 17,191,102,127,120,148,213, 95,163, 18,  7, 17,223,129, 38,205, 62,156, 47, 11,102,  5,180,  4,121,
-203, 93, 77, 37,212,138,104,194,154, 80,214, 91, 88,207,220, 82,184, 90, 23,174,164, 96, 79, 10,246,228,  6,249,229,223,128, 31,
-250, 27,240,232,159,134,249,119,192,155,127, 19, 30,173,200, 71, 17, 95,214, 60,158,207, 58,115, 59,152,220,125, 18,223,  6,238,
-171, 86, 67,239, 42,109,242,116, 53,126, 67,209,171,236,187,245, 39,179,  7,175,220,  6, 94,242,118, 98,154,207, 28,151,253, 20,
- 45,131, 95,115,156, 83,118, 38, 54, 17,  6,115, 97,  3,209,126, 34,246,145,252,189,192, 93, 53,230,111,223,145,190,126,240, 14,
-253, 42, 35, 79,110,144,239,123,140,157, 26,169,197,204,251,215, 43,233,  7,143, 94,205, 22,159,168,180,210, 35, 45, 29,186, 83,
-154,251,136,229, 34, 69, 40, 30, 46, 50, 90, 81,188, 64, 77,106,228,172,232, 43,147,199,111, 85,131,219, 16, 41, 90,195,238,220,
-210,231,255, 56,178,115,238,118,156,102,200,169, 32,127,248, 77,120,245,223,244, 61,121,249,171,240,115,255,  1,188,249, 58,245,
-223,254, 85,202,219,207,209,159,188, 33, 29, 28,  8, 40,175, 92,185,165, 77,143,192,215,225,105,241, 39,188, 25, 77, 10,235, 87,
-110, 41,119, 43,119, 90,185,191, 17, 87,175, 75,115, 48, 73,132,218,244,107, 61, 39,182,160,142,141,  3, 80,217,114,  5,246, 52,
- 55,223,107, 70, 14,104,252,225,120, 82,174, 97,231, 82, 55, 17,123, 86,129,197,131, 60,190,176,138,199,243, 70,197,115, 55, 73,
- 66, 14, 19,124, 54,211, 62, 58, 83,111, 87, 90,169,206,173,239, 37,167,249,131, 34,153,184, 82,247,234,138, 38, 19,117,219,209,
-249,225, 33, 73,218, 50,163,201, 96,107, 37,181,134,170, 58,  9,144, 22,211,180, 80,  1, 87,217,166, 19,157,110,231, 69, 32, 94,
-165, 92,174, 89,250,  8,191,239,172,107,140,150,183,220,  2, 51, 46,229, 80,182, 69,212, 78, 61,111, 60, 40, 94, 83,172, 57,122,
-209, 47, 12, 76,242, 56,155,117,  2,224,180, 41,184,109,235, 78, 83, 20,164,147,121, 33,186, 13, 10, 93,223,177,107,  0,100,166,
-  0,218,116,159,255,204, 62,222,183,129,251, 96,  3, 24,234,198,195, 11,185,239,244,185, 64, 92, 39,205, 91, 16, 72,128, 55, 16,
-224, 32, 66, 77,153, 22, 99,248,174,110,182,209,150, 58, 20,232, 98, 22, 62,123,219,194, 98,170,  8,103,219,229, 18,123, 65,183,
-139, 67, 61,  3,111,190,191,238, 53,124,218, 51,120, 80, 76, 82,106,109, 44, 49,225, 24,133,129, 83,232, 15,214, 97,218,168,155,
- 94, 38, 14,182,182,163,143,219,131, 88, 54,249, 46,136,216,198,152,  6,103,152,126,188,128, 63, 60,  8,140,133,212,226,161,146,
- 36,113,147, 18, 55,243,236, 58,177, 16, 84,211, 26, 21,165,212, 74, 45,101,215, 44, 52,115, 59,170, 78, 20,145,184, 79,213, 65,
- 97,181,238, 19, 79,219,167,103, 77, 60,104,167, 69,  4,249, 38,250, 86, 63,104,123,131,154,  6, 75,119, 76, 83,205,127, 79,132,
- 54, 68,234,232,222,209,183,230,225,101,173,131,216, 58,  5,175,119, 63,165, 68,248,145,108,107,157,126,212,208, 24,243,107,206,
-100, 25,136,114,253,100, 65,236,201, 68,245,162, 16,168, 61, 32,247,200, 62,154,178,139,184, 68,217,184,184,210,197, 11,129,141,
-237, 85, 77,104, 36,113,139,155, 36,221, 72,113,238, 49, 84, 87, 18,183, 26,233,109,186,193, 62, 82,206,254,  6, 54, 75, 79,247,
-181, 68,146,145,102,191,149, 90, 69,242, 76,158, 31,147,165,160,231, 91,223,127,154, 33,231,151, 52, 10, 54, 79, 88,154,105,154,
-105,214,147,223,192,202,194,114,186, 71,207,119, 52, 86,212, 10,119,245,196,177,173,216,115,131, 55,142, 80,143,240,171,255, 53,
-252,150,159,  6,249, 28,204, 71, 56, 84,247,172,207,193,  9, 94,161,101, 48,181,205, 91,216,253,205, 99, 84,111,105,144, 82, 35,
-173, 43,245, 62, 30,108,223, 16,228, 21,245, 68,143, 27,133, 47, 28,144, 83, 67,239, 87,242,107,  7,174, 62, 56, 81,240, 98,211,
-207, 34,205,188,112,248,158,168,143,180,109, 27,249,111,135,165,100, 27,139, 58, 69,210, 21, 17,184,177,222,173,228,111,158,200,
-223,211, 69,115, 10,143, 30,193,231,207,174, 10,111,192,113, 69,191, 24, 33, 46,107,236,251,235,206, 34,239,225, 51,136,219,109,
- 50,184,165,176, 93, 10,127,186,208, 45,137,113, 48, 35, 29,  5,121, 45,121,149,252,168,210,206, 22,251, 70, 79, 98, 91, 49, 22,
- 83,106, 28, 72,114, 18, 14,147,161,103, 67,222,173,200, 23,127,  4,236, 10,218,207,195, 95,255, 79,177,191,  1,235,250, 17,167,
-255,235, 41,233,173, 76,174, 43,201, 14,158,241,158,143,120,127,150,252, 17,252,124,141,236,119,197,158,195,242,116,225, 20, 94,
-221,186,218,150,158,149,115,212,188,208,221,244,207, 89, 99,175, 33,  9, 74, 17, 90,218,235,182,141,163,249,108, 72,100,197,155,
- 52, 44,123,113, 14, 89, 52, 29, 26,191,241,218,133, 11,120,135, 54,221,  1, 47,147, 32, 83,134,127,229, 83,240,217,  3,250, 31,
-126,155, 90,206,209, 33,250,248,142, 16, 75,  9, 74,158, 50,109, 58,210, 52, 99,203,234,121,  8,230, 10,221,174, 34,119, 34, 76,
-220, 95, 73, 60,199, 64,149,140,  4, 86,179,186,194, 56, 64, 25, 93,  9,223,237,163, 27,246,181,119,120, 50,186,216,227, 97,148,
-148,220,252,190,232, 59, 92,186, 14,166, 23,180,232,224,147,  5,146,182,107, 24,108, 23, 85,150,232, 30,189,122, 72,164,209,185,
-224,203,109,142,251,216, 60, 61, 56,  0,116,133,119,138,193,106,142,115,213, 93,180,111,147,200,214,141,246,131,207,129,221,  5,
-176,196,159,207,221,246, 54,  8,149,166,112,100,200, 24,211, 73, 35, 91,219, 58,185, 53,158,119, 41,190, 91, 47,166, 57, 24,240,
- 53, 58, 94,217,180, 18,140, 89,239,  3,225,173,  4, 95,160,138,196,107,186,156, 37, 92,166,125,217, 22, 37,219,189,215,206, 45,
- 40,220, 33,156,106, 29, 92, 58,145, 11, 63, 56, 10,122,241, 61,117,221,204, 96,161,179, 49,196, 75,228, 65,158,123, 80, 31,237,
-227, 43, 41, 99,156,184, 94,234,108, 24,179, 46,198,157,251,198, 60,215,141,141, 34,102, 28, 82,226, 38,103, 14,243,129,150,148,
-165,181, 93, 81, 30,  7, 38, 66, 24,106,102,155,202,125, 19, 99,143,  8, 86,213, 13, 45,251,177,180,181,139,148,180, 33,252,165,
-219, 78,194,107, 43,131, 13, 45,245,218,106,230,254,254,222,221,105,119,174,236,194,195, 86,155,119,153,189,224,  3,181,182, 13,
-  3,155, 84,145,148, 99, 50,177,187,170, 36, 80,222, 89, 31,208,124,210, 86,  0,132,172,222, 49,212, 56,161,203,192,187, 87,185,
- 68,245,245,140, 88,221,  0, 51,177, 87,136,108,224, 52, 18,132,122,129, 27, 99, 25, 69, 34, 69, 77,162,115,151, 29, 43, 27, 69,
- 90,215,197,127,125,158, 64, 83,172,  2,116,179, 26, 32, 62, 98, 17, 19,106,109,176,158,152,144, 24,173, 24,106,133,105, 58,160,
-201,123,212,146, 19, 77, 60,197,205, 90,117, 98,217,249,142,118,127,199,178, 44,110,255,201,141,180, 20,238,109,101,181,194,225,
-217,138,125,180, 32,159,187,194,126,225, 61,228, 11,255,  3, 60,250,189,254,180,111,241,137,206, 62, 70,103,245, 44,116,170, 92,
- 38,235,244,200,189,182,231,138, 87,115,134,115, 58, 25, 53, 36,193,249,107, 33, 26,251,236,  1, 94,205,240,189,  7,210,237,138,
-189, 92,201,167,202,241,197,202, 26,184,208, 62,230,222, 34,108, 59,113,108,244,135,198,200,184, 19,208,146,185, 23,121,246,151,
-140,102,163, 90,163,189, 56, 99,223, 57, 33,159,155,176, 71,138,228,140,124,230, 53,236,124,134, 50,163,175, 77,200,103, 15,108,
- 56, 53,  1,157,140, 52,240, 51, 83,191,184,  2,166,160,241,179,219, 40, 78,138,127, 38, 60, 69, 75, 94,155,224,117,215, 64,240,
-188, 97, 47,156,245,110, 75,165, 46,141,181,121,130,149,138,211,205, 14,201,121,222,233,235,149,233, 95,255, 34,124,223,207,192,
-242,239,211,254,143, 95,164,252,217,247, 40,175, 43, 79,223, 95,169,175, 43,143,154,145,238,171,183, 40, 93,236,208,112, 47, 66,
-249, 22,156, 86,120,114,128,183, 23,206,207, 10,167,218, 56,103,161, 54,227, 92,155, 31, 62,205,109,102, 26,216,210, 22,130,208,
-139, 67, 83, 88,201, 44,198,148, 26, 63,202, 74,  8, 23, 75,207, 65,119, 37,189,220, 25,121, 54,183, 52,166,228, 54,190,178, 35,
- 35, 21,115, 71, 64,168, 98,233, 43, 42,  9,107,202,181,194,219, 39,248,171,183,180,231, 43, 45,  9,182, 70,215, 26,160,120, 83,
- 33, 77,  9,201, 19,150, 39,214,197, 71,143, 85, 50, 83,134,156,101,179,175,105, 41, 20,109,216,234,  7,195, 22, 49,200, 22,113,
-198, 34, 50,196,146,238,225, 43,227,126,148, 36,180,234, 83,  9, 85, 33, 37,161, 52,143,133,244,  7, 72,194,164,109, 90,147, 26,
-220,130,145,142,168,177,219,223, 16,210, 67,129,157,162,  8,183,182,139,167, 82,138,243, 80,181, 11, 17,203,212,113,190, 67,151,
- 55,133,108,133,225,191,143, 93, 91,100,123,179, 98,145, 83, 94,204,187,123, 17, 23, 16, 55,177,109, 95,205,192,228,144,200,152,
- 72, 50, 52, 72,157,157, 47,194, 74,115, 61, 70, 74,174,254, 15,118, 68,127, 50, 76,154,104,201,182,233, 99,217,112,179,118,177,
-179,174,131,118,102, 51, 50, 68,113,242,169,171,186,216,113,179,208,170,251,210, 99,111,223, 45,164, 85, 52,182, 62,254,190, 59,
-224,166,181,182,163,110,  5, 22,179, 77,148, 86,135,  3,145,217,199,107, 94, 79, 48,235,135,137, 29, 56, 35,151,108,118,123,160,
-104,223,101,113,251,245,100,151,201,124,219, 36, 64,252,154,106, 65, 42,154,128, 67,158,152,210,228,147,  7,129,108,131,191,123,
-195, 17,251,169, 80,209, 13,180, 84, 99,105,211,237,191,147, 40, 45,103, 50,194, 89,148, 90, 86,135,161,141, 19,199, 49,224, 53,
- 10,184,201, 16, 39,168,186,143,222,187, 58, 90, 34,123, 52,224, 53,214,  6,213, 77, 76,114,144, 20, 43,176, 26, 71, 47,191,203,
- 90, 43,219,129, 88, 73,190, 70, 32, 72,170, 61, 41, 53,154,113,171,149,156,162,235,117,  1,155,108,  2,183,142,235,179, 45,224,
-192,250,148,  0, 21,121,128, 83,220,232,234, 67,231,190, 71, 62,105,156,110,250, 27,149,  7,194,162,174,114,223, 79,226,123, 70,
-187, 52, 23,179,137, 26, 82, 26,180, 21, 59,199,206,124,158,144, 52,185,135, 93,  4,210, 76,210, 41,252,183, 11,186, 44,100,169,
-232,225, 49,114,120, 66,182,194,148, 82, 88,105, 86,150,218, 72,117, 37, 89,193,202,153,118,190,141,194, 85,200, 42,152, 40, 38,
-141,214, 10, 43,141,251,214,152, 94,156,225,163,123,228,205, 25,185, 61, 98,191,246,151,145, 31,123, 29, 14,175,192,244,220, 47,
-199,236,237,175, 46,126,145, 86,147, 45,219,220,189,199,131,191,179,251,143,155,209, 84,152,107, 35,175,171,239,226,191,149,200,
-175,  6,233,237,149,201,211,220,190,112,133,190, 88, 73,231,194,241,180,178,172, 70,233, 93,200,168,  6,102,207,229,182,234, 15,
-206, 45, 80,174,  7,188,196,119,187, 11,215,124,236,213,206, 70,123,111, 37,125,112,118,209,220,225, 57,204, 95,128, 79, 63,135,
-151,207,145, 31,156,225,115,115, 60, 69,187, 23,180,187, 16,100,251,185,  7,219, 89,233,157,105,172,145,230,149, 98,122,147,122,
-146,214, 81, 72,159,202, 14,225, 41,134,189,112, 52,172,105, 11,101,189,133,136,203,233,109,135,100, 92, 41,228,175, 22, 14,191,
-249,  9,250,167,255, 48,180,175,194, 55,127,149,243,191,241,117,238,175, 26,207,158, 43,167, 43, 33, 39, 56, 84, 56,158,138,175,
- 11,172, 47,250, 15, 96, 79,225,244, 45,120, 23,248,112,165,252,234,137,178, 86,202, 12, 53, 11,247, 47,161,172, 46,193,184,146,
- 80, 82,235,  5,253, 56,210,155, 66, 56,180,  4,186,118,  0, 65, 72,140,226, 39,221,169,114,152, 79, 49, 76, 64, 86, 67,151,230,
- 26,  6,113,211,186,158,131,152,152, 18,122, 76,129, 72,139,252, 85,  9,156,237,210,176,251,  5,249,159, 10,237,206,168,186,250,
-212, 36, 46, 46,205,208, 44,199, 62, 46,147,166, 76, 42,161, 27, 17, 65, 38, 31, 77, 90,144,180,106, 35,198,142,141,166, 33, 30,
- 13, 30,128,180,182,175, 55,119,251,202,238,100,217,144, 21, 97,141,154,148,137, 68,163, 97,166,148, 13,228, 62,144,187,123, 48,
- 14, 26,116, 50,127,148,229,224,117, 71,  3, 78,  9, 22,108, 70, 73, 52, 50, 70,177,230,163,112,177, 16, 28,183, 45, 54,180,196,
-129,  9, 60, 91,125,142,103,203, 93,140,241,175,  4,158,168,112,109,112, 10,246,195, 49, 58,236,243, 70,161,243,251,170,167,152,
-117,113,218, 36, 66, 22,183,175,217,208, 53,215,216,199, 79,  2, 47,251,245,109,187,245, 20,122, 42,154, 59,117,178,  8,107,140,
- 53,250,190,217,175, 17,165, 90,114,107,110,107,219,238,124,  3,226,244,  2,223,187, 97,187, 84,232, 35,158,223,110, 81,176,251,
-110,126, 22,193,242, 52,240,224,123,112,137,108,164,185,190, 43,209,141,208,231, 95,106, 21,  7,207,108, 93,185, 13, 69,157,143,
- 91,218,122, 83,214,223,243, 88,  4,229, 65, 72,184, 92, 68,109,126, 18,152,102,215,163,116,252,240,134, 46,111, 45,154, 79,223,
-131,123,168,147, 50, 69,195,215, 84, 88, 90,193,106,219,159,137,150,182, 58, 54,133,102,204,  6,209,165, 69,125, 75, 57, 51, 29,
-103,238,238,149,243,253,125,104, 67,100, 23, 46,198, 33,175,141, 17,225, 67, 78,137,  6,156,101,231, 39,117, 55,148,110, 78, 13,
-209, 20,182,187, 18,127, 69, 36, 24, 70,184, 26,170,174,155,137, 21, 67, 39,212,149, 97, 45,208,231, 39,170,  1,  2,243, 64,151,
-125, 95, 34,  3, 31, 62,233, 30, 63,183, 77,238,101,207, 72,239,191,177,251,  4,183, 40, 86,141,168,209, 17, 27,185, 65, 38, 98,
-200, 31, 97,241, 27,242, 48, 50,211,117, 80,179, 74, 23,119,152, 43,180, 37,132, 14,130,159, 54,165, 84,172, 45, 52,156,248, 35,
- 57, 35,185, 32, 92,193,116,100,150, 35,201, 26,233,248, 10,114, 56,162,173,162,166,225,217,172, 44,171,113, 62,159, 56,148,133,
-163,174,200,122, 66,150, 83, 60,235, 51, 18, 74, 19,169,133,110,250, 94, 69, 56,175,149,227,187,103,236,205,  5,121,114,  5,191,
-112,  7, 95,252, 75,200,117,198,222,152,145, 95, 59, 35, 77,221,110, 52,123, 24, 75,137, 56,197, 14,251, 96, 80,128, 91,140,207,
- 20,217, 92,  1,102,198,116,191, 80, 95, 42,242, 53, 37, 61,202,222, 78, 31, 21, 62, 51,161, 31, 30, 73,207, 86,218,205,196,213,
-243, 53,132, 49, 62,102, 29, 17,164, 91,162, 26,251, 73,187, 71,157,174,198, 22,182,209, 85,164,214,101, 17,147, 97,119,158,184,
-198,109,133, 87, 23,247, 72, 62,250, 65,236, 83,191,  8,223,223, 60,136,166,196,245,177,198,202, 37,137, 39,202,201,174,221,216,
-188,215,116,254,121,140, 89,213,152,213, 56, 38,113, 33,250,213,132,126,102,242, 23,248,180,209, 94, 44,180, 82,105, 75,195,238,
- 43,181,238,190,227, 99, 96,126, 15,239, 84,142, 73,200,255,213, 63,235, 67,193,242,235,172,127,230, 55,184, 79,133,219, 55, 39,
- 78,109,128,135,116,195,248,105,204,172, 45, 94,212, 95,188,  3,239, 24,237,246, 76, 89, 79, 44,217,184, 59,  9,119, 75,163, 86,
-139,117,133, 79,124, 14,129, 25,222, 66, 94, 82,  0, 98,100,127,208,117,156,175,196,238,178,117,184, 76, 40,198,123, 75,219, 25,
-205,210, 97, 32,173,185, 54, 36,118, 34, 58, 41,114, 29,106,192,106,187, 90, 60, 78,206,118,223,168, 90,209,121,162,229, 74, 91,
-188,123,151, 52,163,150,162,  7,201, 17, 97,170, 78,148,107,177,  3, 76,130,213,234,133, 42,  9,199,199,137,229,108,220,190,104,
-126,244,146, 26,221,183,161,213, 15,244,190,207, 86,215,165, 12,166, 98, 25, 14, 43, 18,213, 93,213, 61,191,107,243, 81,163, 63,
-227,211, 54,195,109, 67,186, 84,138,110,178,137,143,122, 19,251,222,162,197,206,210,129, 63,141,220, 26,171, 53, 23,211,185, 88,
- 36, 28, 29,230, 59,116, 97,219,251, 75,168,209,231,  7, 42,109, 17, 56,102,225, 81,172,  0,102, 92,245, 62,197,234,232,212, 59,
-217, 22,118,181, 65, 92, 54, 13,141, 72,143,144,238,135,180, 24,210,109,187,126,217,226, 86,117, 43,106,  5,139,231, 73,242,236,
-117,107, 36, 75,219,110,187,196,206,197,215,136, 21,107, 45,120,240,145,106,215,131, 98, 46,118,230,114, 49,206,150,176,114,105,
-206,172, 49, 86,151, 86,185, 81, 37, 77,137,186,174,100, 85,102, 77,241,153,  8,117, 72, 49, 83, 27,211,230,108,171,  0, 93,127,
- 83,237, 19, 40,123,246,176,235,230, 19, 98, 91, 47,169,114,194,  3, 58,230,229,241,100,  3,  5,117, 91,181, 38,231,172,247,  6,
- 70,163, 19, 46,214,208, 90,120, 52, 31,152,231,153, 36,194,  9, 56, 45, 43,247,235,226,171,220,172,204,  6,115,118,194,129, 70,
-231,155, 85, 31,184,112,196,153, 13,165,144, 74,229, 56,207,212, 90,105,203,178,249, 86,229, 65, 83,187,129,198,182,131, 81, 26,
- 98, 87, 29, 99, 46,195,193,165,131,108,188,187,175,219, 24, 94,100,248,189,234,135,119, 77, 62,234,107,197, 17,217,182, 37,214,
-201,230,164,144, 97,125, 64, 10,161, 92, 22,241, 34,187,169,145,247,124,116,  6,128, 67, 15,161,232,153,204, 61,178,112,200,146,
-243,223,151,186, 96,192,  6,245,124,139,241,248, 14, 15,216, 24,190, 49,122, 79, 15,144,143,186, 61,191, 26,201, 90,144,233, 52,
- 14, 13,  1,178, 49, 67,214,157,  5, 47,226,172,247,252,248, 13,180,  9,106,  5,106,217, 78,143,102,149, 82, 87,218,114,166,214,
-133,181,173,174,138,111,  5, 53, 39,217,137, 42, 45,180,164, 82, 87, 18,174, 64, 92, 12,238, 17,242,237,138, 62, 93,177,199, 19,
-242,109,195,126,249, 41,242, 91, 95,133, 47, 92, 33,255,240,228,  7,132, 99, 66,107, 65,138, 56, 75,124,176, 58, 49,142,150, 58,
-  6, 63,188,193, 77,216,176,136,114,187, 80,179, 32, 95,141, 76,250,239, 61, 56, 31,254,123,103,244,249, 76,186, 47,228,251,202,
- 85,171,180, 96,126, 91,172,116, 82,236,238, 37,254,219,162,136,212,193,118,210, 71, 79,253,  6,110,221,184, 43,  6,  7,195, 78,
-  5,121,214,176,215, 22,100,126, 10,250,143, 33,175,127, 14,251,220,215,144,227, 17,206, 11, 76,  9,185,  6, 61, 10,243, 29,187,
- 48,178,231,144, 91,143,163, 29,252,232,106, 27, 69,237, 42,195, 85,138, 46,253,181,236, 79,148, 23, 94,200,237,212,176, 82, 89,
-207,141,115,236,146,115,130,131, 26,215,207,141,235,247, 27,135,191,240, 59,225,181,239,131,250,183,105,255,205,175,115,255,203,
-207,185,251,129,196,125,136,245, 54, 81, 38,  3, 46,183,198,206,163,189, 15,229,171,216,183,111,225,214,168,207, 23,214, 83,229,
- 14,225,188,  6,253, 45,118,179, 73, 96,158,247,245,212,164, 67, 38,250,228,154,130,108,226, 33, 35,137, 13,130, 68,  4, 68, 28,
-212,161, 44, 86,119, 52,103,210, 56,133, 75,132,252, 20,131, 99,114,172,235,117,232, 25, 68,161,149,184,103,186, 90,222,224, 62,
-188,197,139, 33,147, 97,211,236, 31,206,148,193, 20, 61,133,143,176, 21,106, 43, 36,102,144,138,152,211,197, 74, 13,161, 79, 60,
-137,143,215, 74, 89, 45,242,220, 91, 20,141, 22, 22, 59, 11, 62,133, 23, 46,107, 59,155,194,146,132,227, 98, 39, 40, 90, 18,106,
-171,155,109,104, 23,110,218,  6,157,234,249,237,210, 31, 32,205, 59,118,149,202, 18,226, 50, 34,184,166, 90,115,239,127, 51,154,
-181,173,251,222,233,109,238, 65,151,104, 40, 52,200, 90, 41, 50,213, 43, 66, 49, 99,138,208,154, 42,158,147,254, 40, 68, 66, 55,
- 24,143, 66, 76,123, 14,245,253,125,147,109, 59, 93,163, 43, 94,204,191, 99,141,226,118, 97,233,165,179,225, 29, 38,212,243,229,
-109,244, 85,119,220,170, 25, 90, 11,154,178, 71,211, 70, 87,219, 66,112, 88, 91,159,138,250, 29, 91, 91,163,152, 79, 14, 90, 95,
- 67, 12,225, 54,109, 40,132, 98, 70, 13, 79,188,150,178,117,181,103,132, 84, 11,211, 52,123, 23, 26, 64, 22,217,152,239, 35, 25,
-225,178, 88,239, 98,187,189, 32,136,109, 81, 50,151,177,170, 23,249,114, 50, 28, 57,118, 70,133, 13,107,215, 20, 35,242, 50,116,
-187, 35, 17, 80,251,103,170,238,169,239, 19,177,141,170, 22,211,201, 89,132, 73,149,220, 29, 75,235, 66, 41, 43,143, 83,246, 64,
- 33, 77,155, 48, 17,221,179, 70, 69, 98,234, 17,171,146, 20,130,183,165, 53, 78,203, 25, 13,203, 97, 75,142, 76,255, 88,186,172,
-202,142,243,147,135,  0, 30,217, 14,  9, 61, 21,110, 43,200, 41,111, 68, 77,215,175, 57, 79, 69,165, 33, 41, 15,127,198,175,121,
- 11,143,188,196,122,101, 19, 30,251,206,218,127, 95, 88,190,115,146, 94,196,  7,191, 92, 87, 21,142, 24,190, 30,152, 16, 70,122,
-177,221,155,238,169, 52,122,153,166,163,151,244, 48,185,176, 53, 92,142, 91,236, 65, 84, 94, 15,150,215,126,160, 48,115,163,125,
- 50, 52, 77,152,212,232,110,186,186,216, 80,107,104, 91,209,150, 72,229, 68, 62,223,146,174, 95,113, 59, 79,  4,206, 52,204, 85,
-218,205, 48, 10,218,140,165, 24, 42, 43, 55, 52,116,242,113, 72, 46,133, 66,245, 29,162, 85, 68,252,193,178,152,144, 84, 40, 84,
-166,151, 11,118,154,125,156,248, 43, 11,246,249, 59,248,204,  4, 95, 58, 34,207,  3, 66,160,201, 17,141,186,147,179,236,129,208,
-133, 14,153,  8,167, 67,233,227,204,228, 76,215,249,197, 61,124, 27,242, 98,232,  1,223,175,223,100,228,139, 87,164,143, 86,210,
-237,202,213,234,194,154, 83, 20,102,139,170, 58, 69,231, 94,213, 17,231,171,236, 69,174,119, 24,107, 53,230,  0,162,228,201,255,
- 33,187, 77,141,219,234,  2,178,115,134,250,  2,202,123, 48,127, 30,121,243, 27, 48,205,158,212,114,173,164,155,153, 41, 47,208,
-224,145, 54, 78, 83,140, 10,207, 70, 75, 59,225,169,169,167,169,165,216, 97,206, 73,184, 50, 72,179,122,151,126, 61,249,232,253,
-174, 96, 75, 88,  6,106,165,174,230,123, 61, 17,142,201,184,169,112,245, 27, 43,215,255,214,247, 34, 63,245,135,160,254, 93,248,
-165,239,176,252,103,223,102,249,158,196,162,176,174,238,147, 79, 41, 20,173,253,  3, 63,168,135,208,144, 97,253,154,255,243, 94,
-197, 14,126, 83,148,210, 40,230, 55,125,138,148, 45, 11,237,129,180, 16, 29, 70,173,213, 14,  0,103,183,118,164,  9,210,226,221,
-122, 45,126, 17, 79, 73,252, 51,142,162, 30,231, 91,159,148, 76, 61, 20, 41,238,185,158, 66,146, 35,189,239,190, 33,209, 36,200,
- 33, 78,104,247,133,214,247,230,243, 68,187,186, 70,152,253,128,107, 32,101,161, 74,133, 86, 60, 92, 34,207, 80,205,173, 55,161,
- 83,217,227, 33,149,151,167,198,139,175,159, 41,171,145,115,127, 16,245,123,175,109,185,  1,169, 99, 69,101, 55,151, 98,227,248,
- 56, 96, 53,109,223, 53,118, 85,187, 53,118,165,182,238, 34,192,109,108,169,196,129, 59,236,164,205, 11,167,  2, 55, 98,204, 41,
-108,178, 81, 80,196, 60,141,108,238,252,252,120,170, 46,209,121, 37, 13, 81,108, 56, 64,102,220, 50,121, 37,198,141, 65,214, 70,
- 50, 15, 28,138,109, 89, 60, 23,124,152,115, 14, 54,184, 19,121, 53,148,213,221,183,174, 91, 23, 75,216,169, 82,232,130,146, 40,
-215,129, 45,182, 45,122, 90,  6, 94,157, 11,165, 22, 51,164,214, 16, 11,123, 33,209, 13,124,101,219,107,233, 98,186, 66,172,238,
- 34,205,178, 62,200,133, 87,131, 41,  5, 25, 48,246,253,165,249,207,152,187,176,170, 85,178,121, 76,117, 63, 20, 16,116, 53,213,
-208, 22, 89,123,144,189,185, 79,  5,182, 67,224, 69,124,237,174, 81,223,145,166, 18, 62,243,113, 29, 40,157,155, 18, 94,255,189,
- 32, 84,187,204, 87,235,  5, 49,117,141, 85,242,155,171, 95, 82,125,197,210, 35,193, 15, 41,115, 61, 31,152,166,137, 69,132,181,
- 84, 82, 51,174,231,153, 73,117, 32,245,133,117, 46,234,193,214,188,118, 33, 95,252,251,100, 80, 83, 98,137,157,186,104, 66,163,
-  8,167,160,196,245, 28,143,113,207,190, 43,229,189,187, 74,219, 97, 45,242,220,219, 30,236,226,  3,183, 70,211,208,141,116,209,
-185, 78,238,226,194,168, 45,212,199,107, 25,178,212,195,198,217,239, 75, 42, 86,195, 21, 54,101,242,116,240,162, 46,221, 99, 25,
- 93,250, 88, 84,115,156,  3,251,169, 96,227,229,110,233, 51, 67,118,174, 61,  0,250,199,131,163,143,242,253,130,244, 11,127, 31,
- 89,200,198,148, 47, 33,154,146,160,206, 73, 31,247,  7,227, 84,106, 65,114, 70,167,201, 71,167, 33, 96,240,177,125, 35,203,180,
- 37, 89,229,186,144,150, 19, 58, 77, 33,250,240,130,190,134,247, 55, 77, 71, 82,169,148,213, 56, 47,149, 99,134,156, 39,214,101,
-197, 20,180, 86, 39,204,217, 46,  5,170,166, 20,171,126, 48,123,185, 96,167,234, 47,248,195,130,188, 91,224,179, 71,248,129, 43,
-244,155, 39,236,219,133,118,181,146,238, 61,220, 99, 29, 68, 37,109, 96, 70,111,105,193, 67,144, 70,  1,172, 68, 26,215,189,113,
-144,123,184,111,228,217,208,171, 87,225, 21,133,215, 51,250,197, 35,233,101,161, 45,149,235,211, 26,116,171, 62,234,222, 39, 41,
- 83,160, 93, 79, 65,249,202,189,195,244,160, 58,146,121, 50,216,156,118, 50,154,157, 27,246,172, 33,183,  6,207, 43, 60,186,  7,
-249, 22,200, 91,240,228,245,  8, 66, 89,163,147, 20,178,206,232, 79, 28,121,242,141, 59,206, 31, 22, 22, 51,  7,158,196,107,104,
-178,239,232,102, 53, 30,101,229, 38,195,181, 24,249,241,132,190, 53,123,165,127, 81,220,227, 31, 48,161, 13, 35, 43,238,150, 56,
- 34,220,124, 99,229,234,159,252, 20,250,167,254, 69,168, 95,129,167,191,193,250,175,125,149,245,181,198,250, 88, 40, 75,140, 89,
-213, 34,159, 28,242, 44,232, 49, 35,175, 39,143,185, 77, 25,234,219,216,203,  2,183,130, 61, 50,135,251,100,183,202,117,228,173,
-245,135, 11, 46, 96,156,122,104, 81,236, 24, 58,201,184,143,157, 36, 41, 51, 70,142,208,140,102, 30,216,162,215, 26,137,107, 70,
-214,240,143,  7,171, 65, 82,140,190, 38,233,150,129, 56,208,164, 93,169, 98, 65,144, 58,227, 91,229, 99,114, 61,246, 60,251, 53,
- 88, 22,228,182,248,228,100, 58, 96,156,225,254, 76, 59, 36, 40, 46, 18,213,161, 19, 18,141, 71,238, 82,188,152,171,112,152, 92,
-136,216, 12,114,147,144,234,  4,  9, 43, 86, 60,151, 15, 95,183,224,136, 64,233,194, 67,149,205,122,227,173,243,  8, 81,209, 45,
-106,150, 80,206,203, 64, 50,171,190,163,218, 82,186,174, 98, 61,116, 29, 98,189,206,166, 80,243, 85,207, 78,147,219,131, 89, 52,
-108,115, 41, 32, 87,130,241, 72,140,163,134,157, 13,120, 36,198, 85,242,209,252, 83,217, 61,237,247,  1,156,186, 53, 47,236,247,
-225, 99,239,212,198, 98, 18, 49,165, 18, 65, 41,225,194,136,231, 91,147, 68, 82,229, 17,112, 85,205, 25,236,209,173,237,132,224,
- 40,120, 98, 44,120,104,136, 84, 65,226, 73,219,  6,149,187,197,201,167, 99,181,183, 92,141, 78, 66, 27, 60,222,143, 82,226,234,
-112,160, 73,226,108,141,218, 92,135, 82,204,208,214,200,234,150,224, 28, 66,197,132,175, 19,155,213,173, 67, 77,193, 23,175,173,
-109,220,117, 25,236,102, 15, 49,176,250,192,189,173, 97,173,234,148, 61, 25,208,182, 91,212,234, 32,163,223,119,242,151, 60,127,
- 17,225,144,156,213,222, 15,  7,205,204, 41,125,182,103,  6,136,193,181, 40,143,230,  3,215,199,153, 98,110, 11, 43,117,197,172,
-113, 94,171,167,204,137, 79,129,114, 82, 74,206,254, 51,154, 81,117,159, 73,244,235,184,198,122, 55,139,135,191,156,154, 91,203,
-146, 42,150,220,121, 69, 78, 46,196,142, 52,209,206, 16,222,210,215,182, 32, 50,221, 14,161, 61,144,193,194,217,225,159, 19, 33,
-248,219,237,141, 93,  4, 87,171,255, 76,119, 65, 52,184,  8,180, 29,184, 39,157,114,152,103,242, 97,118, 74,160, 88, 88, 87,122,
-250,146, 74,248, 95,141, 36,251,120, 96,191,184,  2,201, 23, 71, 53, 13,244,100,139,236,114,122,135, 30,194,168,141,248,164, 67,
- 18,141,236,169, 64,187, 27,113, 23,120, 73, 87,253,234,238, 99, 86, 12, 41, 11, 36, 69, 15, 71, 36,103, 39,206,181,182,137,175,
- 84,253, 20, 53,165,196,148,  5,105,103,100,173, 52,157, 41,129,237,236, 76,102, 13, 63, 87,170, 43,181, 44,156, 16,174,167, 22,
-239,185,251,  4,125,132,216,237, 62,221, 67, 89, 68,169,119, 13,121, 94, 92,149,254,116, 69,190,181,192, 77, 48,203,191,255, 26,
-121,122,130, 37, 35,199, 66, 90, 27, 97,123,220,160, 16, 18,113,134,102,251,158,189,217, 16,  9, 41,134, 85,113,255,239,217,200,
- 47, 78,208, 26,249, 58,161, 63,250,200,237, 87,111, 29,200, 31,172,216,217, 35, 67,231,165, 58, 73,106,208, 70, 72,  4,136, 28,
- 38, 31, 91,175,129,146, 76,120,129,186, 74,177,  3,236, 93,123, 63,168, 95,137, 63,245,238, 11,188,200,216,203,132, 76,207,189,
- 21,205,175,130,156, 65,110,247,157,204,191,252, 26,250,227,143, 56,252, 59,223, 68,191,245,130, 44, 70,202,205, 87, 32, 98, 17,
-239, 27,254,226,  4,215,185,241, 24, 99, 62, 78,164,207,207,240,218,236, 77,221, 51,224,189,234,106,163,190, 14,154,225,170,130,
-170, 49,127,171, 49,191,117,133,254,231,127, 20,236, 67, 40, 95,165,254,153, 95,163,220,159, 56,125,175,112, 90, 59, 10,221, 59,
-144,131,250,168, 54, 29, 18,250, 74, 70,222,200, 94,212,173,193,253, 61, 60, 51,120,182,208,158, 47,212,151,197, 21,237,177,255,
-206,225, 97,238,158,230,156,136,247,165,200, 33,102,165,159,196,186,188,241, 56,225,180, 24,118, 10,171,207,148,134,104,225,160,
-100,217,126, 51,115,136, 49,252, 41,204,248,115, 66, 87,131,165, 33, 57,193,245,140,149,105,131,247, 52,245, 17, 29,107,129,219,
-  6,215,205, 11,181,202,255, 75,215,187,198,218,150,101,247, 93,191, 49,230, 92,107,239,125,206,185,239,186,245,174,174,174,114,
- 87,187, 95,238,216,198,118, 28, 36, 68, 94,  8, 41, 33, 65, 68, 40, 49,  8,137, 15, 17,144,  8,129,136,248, 18, 66,  4,124, 32,
- 10,124,228, 67,132,  0,  5, 41, 34, 18,137, 18, 18, 57, 74,  8, 81,162, 32,199,177, 99, 76,251, 17,219,221,233,118, 63,171,186,
-222,117,235,190,206, 99,239,189,214,154,115,240, 97,140,185,214, 58,213,198, 82,169,219,213,247,158,199,222,123,205, 57, 30,255,
-255,239,143,217,132, 92, 29, 66,104,174,238,161, 47, 70, 74,134, 78, 26,100,171,224, 11,  4,154,204, 45,116,186, 36,194,133,237,
-180,145,227, 28,227,108, 51, 19, 93,215, 99,223, 48, 36,123, 70, 68, 93, 44, 98, 81, 16,215, 54, 41,105,207,127,112,251,179,250,
-207,165,113, 96,167,168,228, 45, 70,224,187, 16,176, 53, 36,114, 31, 45,253, 28,247,218, 20,228,213, 24,196,187,251,109, 53, 54,
- 24,155,152,225,102, 51,127, 47,155, 67,193, 55, 28,108,146,143,201,235,136,175,106, 90,202, 92,187,200, 87,148,179, 41, 38, 19,
- 37,136,110, 53,110, 39, 93,197,225, 74,179,147, 69,150,249,221, 84,216, 35, 12,243,  9,167,179,127,123, 46, 98, 48,174,106, 97,
- 50,119,113,136, 38,191,116,155,128,173,117,210,234, 40,235, 36, 53, 16,178,161,188,143,247,225, 68,133, 27,253, 22, 82,102, 31,
- 10,247,100, 70,175,  9, 83,165,212,  8,171,210, 37, 58,203,163,  3, 92, 40,214,  4,120, 77,185,174,162,113, 54,213, 89, 39,114,
-141, 24,247,137,139,220, 86, 24,216, 18,107, 27,189,  6,230, 89,121,188,171,204,208, 33, 93,197,250,182,198,177, 71, 56, 73,137,
- 77,191,225, 40,194, 52, 77,115,119, 95,205,102, 17,117,  1, 78, 68,184,185,221,176,219,245, 20,131,171, 50,113,113, 56, 80,198,
- 66,210,134, 28,110, 59,231, 74, 53,245, 53, 13,194,104, 21, 43, 50,147, 78, 97,137, 52,157, 67, 90, 36, 99,253,134, 50,142, 62,
- 49,233, 58, 76,149,161, 20,108, 58,206,238,134,182, 14,152, 87,198, 49,189,105, 59,255,164,134,106,142,149,156,107,138,106,153,
-144, 41,244, 69,184,189,206,112,215, 86,109,191,115, 78,212,113,188,238,156, 90, 79,211, 53,185, 29,188,235,125,239,110,134, 78,
- 35,185,209,110,146, 88,252, 48, 13,251,186,188, 41,105, 22,207,173,  2, 88,108, 81,175, 54,118,132, 10,171,172,216, 54,198, 95,
-109, 90,196,171,108, 23,  4,233,108, 99, 19,107,187,188, 37, 36, 97,238, 98,194,139,167, 81,226,217,112,240,175,189, 57,129,148,
- 17, 70,143,112, 77, 41,236, 41, 70,103,  5,173,  6, 82,220,246, 33, 27,175, 74,169,241,245, 12,246,  7,216, 95,160, 86, 48, 77,
- 28, 20,100,156, 56,209, 26,118, 17, 39, 48,165,198,171,196,211,142, 42, 49,206, 54, 72, 79,134, 24,147, 42,245, 27, 71,244,165,
-141, 43,213, 63,181, 65,223,222, 98, 99,161,142, 19,249, 48,146, 71, 99,140,162,168,169,207,215,226,145, 89,197, 26,  7, 76,198,
-119,144,213,252, 98,207, 90,217, 61, 60,194,215, 47,232,118,130,124,118,  7, 39,  9,121,109, 67, 26, 38,236, 56,209, 31, 11, 35,
- 49,102, 15, 98,157,197,195,211,169,199, 52, 86, 60, 16,166,226,108,155, 77,110, 41,110,174, 36,146,236,163,127,233,241,194, 33,
-197, 50,113, 12,227,116,154, 32,221,129,238,  4,248,216, 47,127,128, 95, 61,192, 47, 92,113,124,115,160,244,126, 66,246,147,143,
-242,187,184,212, 53,116, 19,189,192, 89,129, 93,175,164,155, 29,122,167, 71, 78, 51,100,144, 27,  9,249,209, 45,250,  0,236,109,
-239, 76, 21, 79, 53,211,143, 42,221,101,162,251,235, 63,  1,105, 15,229,155,212,255,249,251, 28,126,233, 49, 23,175, 43, 23, 71,
- 31,167,150, 54,161,104,187,251,  4,218,169, 83,240,158,237,252, 84,183, 61,118, 81,224,195,  3,245,205,  3,211, 59,123,142, 79,
- 39,246,189, 95, 66,225,  6, 35,169,197, 78, 47,190,102,167,232,205,206, 33, 49,182, 36,136, 72,  9, 91,209,228,221,187, 24, 88,
-175,115, 39, 47,185,241,130, 99, 15,110,235,232, 92,  9, 79,120,109,202, 32,215,139,140,130,222,190,  9, 63,114, 11,  6,165,126,
-235, 10, 27, 14, 78, 80,196,224,120,  5,135,  1,203,201,139,220,228, 11,111,187, 26, 40, 67,133,109,239,232,200, 18, 62, 58,131,
-100, 19,211,116,221,127,155,128,105,138, 52,198,134,100,166,  6, 79,123, 57,112,167,249, 32, 95,248,218,  9, 15,238,105,235, 54,
- 31, 41,250,225, 45, 17, 67,170,248, 33,183, 22,221,106,251,194,169, 93,226,204, 77, 67, 75, 60,219, 38,143,178, 77, 10,155,176,
-137,165, 86,  8,151, 74,103,117,158, 62, 72,117,161,220,214, 99,  3,226,185,181,217,249,215,244, 13, 38, 53,104,150,139,157,237,
- 18,175,165, 26,188,133, 85, 62, 56,234,249, 16,230,179, 15,199,235,134,160,175, 29,178, 85,220,254,155, 76, 24,129, 93, 82,238,
-  3, 15, 98,234,209, 37, 15,185, 26,163,123,254,100,146,217,100,149, 99,153,232, 85, 81, 73,116, 98,177,178, 75, 76,181,206,235,
-201,169,250,153, 80, 26,247, 82,124, 34,209, 73, 98, 82,229,106, 26, 25,166,137,222,224,164,235,208,156, 29, 37,145, 36,194,184,
-116,241,130,199, 51,178,209, 68, 73,142, 10, 46,120,  1,208, 70,176,134,206,226,214,235, 29, 98,109, 50,102,111,220, 86,184,227,
- 58, 47,102,214,177,202,205, 41, 16,103,122,156, 73,149,235,107,215,132,115,218,181,239,184, 52,152,166, 17,177, 58,143,248, 83,
- 43,136,128, 83, 21,238,108, 54,156,156,156,112,196,216, 15, 19,231,227,145, 50,142, 97,135, 91,241, 87, 26, 15,164,184,214, 67,
- 83,132,126,155,145, 34, 12,  5, 19,114, 78, 46,198,171,222,201,214,184,179,186,156,200, 57,163, 57,177,159, 38,234,126,152,195,
-142, 70, 98, 12, 82,  0,  0, 32,  0, 73, 68, 65, 84,100, 61,177,142,238, 60,229, 20,223, 35, 68,109,154,130,  0, 89,252, 66, 87,
-161,142, 81,148,118,201, 87, 33, 17,  6,227, 90, 52,241,206, 39,172,214, 51,223, 97, 94,109, 11,218,117,104,234,144,228, 36, 61,
-139, 17,143,249, 61, 26,129, 12,113,161,187,197,173,141, 82,108,222,165,251, 47,111,115, 50,206,236,213,  8,218, 92, 90,177,198,
-175,133, 74,173,197,117,171,218,205,137, 89, 30,163,144, 84,220,163, 45,159, 64,206,174,162, 25,197, 19, 38,252,191,143,  7,191,
-156,251, 29, 41,119,179,192, 45,165, 52, 71,238,121, 84, 93, 98, 40, 19,133, 35,208, 35,177,208,116, 64,254, 68, 46,197, 83,209,
-106, 97,154, 38, 46,199,209,173, 75, 86,232,196, 40,105,237,173,176, 25,  5, 89, 13,166, 82,232,175, 10,182, 29,253, 34,255,184,
- 98,223, 72,200, 23,207,252, 20,121,227, 12,189, 24,168,135, 14,221, 78,  1, 62,241,241,102,147, 20,213,232,210,235, 10, 29,219,
-130, 23,166,128, 79,148,160, 17, 13,225,191,188,245,209, 21,124, 85,232, 78,  4,249,212,  9, 60,211,161,251, 13,250,100,162,187,
- 42,236,246, 19, 99,136,230,202,234, 61, 81,241,105, 65, 19,109,137,192, 73,246,142,170,101,147,159,116,208, 63,151, 73,187,  4,
-123,195,158, 76, 88, 82,100,175,112, 72, 80, 50,108,134, 88,153,220,  3,253, 62,236, 70,143,140,253,213,115,234,229,196,208, 85,
-232, 96,115,244,  2, 33,137,103,133,111,213, 65, 33, 93,251,172,117, 74,186,223,147, 94,219, 33, 63,116,226,254,244,139, 10,187,
-138,222,239, 96, 55, 81,190,191, 28,190,250,212,208,183, 10,253, 95,124, 13, 94,126, 17,134,223,134,175,124,204,241, 47,189,199,
-229, 11,194, 83,131, 97, 50,134, 41, 54,124,137,217,146,101,120,112,137,220,202,112,214, 33,155,228,183,255,177,194,199,  3,245,
-225,192,244,112,100,175,206, 21, 47,171, 24,211, 28,192,152, 90,133,205, 70, 72, 55,178,239,223,  6,107, 33,210,126,116,180,185,
-105,245, 86,207,250,152, 67,237,146, 87,104,166,158,112,150, 13,180, 32, 99,228,131,155,  3,101,100, 20,164, 38,140, 66,213,  4,
-121,139,228, 45,242,133,219,240,233, 29,124,237, 17,114, 12,242,119, 49, 24,143,179, 87, 78,108,  5, 81,221, 79,110,253,236, 58,
-167, 87,237, 27,133,202,144,105,154, 45,140,204,211, 52,127,230, 58, 13, 57,148, 22,116,114,177, 85,242,164, 24,223, 97,202, 90,
-229, 28,227,230, 16,177, 57,110, 88, 22, 16, 77,219,237,199, 65,221,  5,230, 54,205,200,100,175,152, 70,241,237,180,  0, 82,204,
- 99,109, 81,122, 42,167,169,210,155,119, 57, 89,133,190,198,184, 51,198,201,106,190, 71,239,108, 97, 34, 52,199,  9, 26,137,120,
-106, 43, 86,108,  3, 37, 41, 83,177, 25,161, 60, 69,177, 50,196, 20,111,190,104, 37,113, 72,137,130,172,228,164, 50, 59,128,150,
-151,161,169,194, 23, 38,185,161,220,204,194,157, 82,157,172, 40,145,135,209, 32, 56,226,239,117,155,110,182,250,106, 50,159, 86,
-172, 87,154, 35, 30,229,123, 52,207, 80, 47, 33, 22,172, 43,127,122,  1,134, 90,217, 79, 19,157, 21, 54,185, 39,165,124,221, 78,
- 53,131,197, 90,231, 93, 99, 21, 36,228,148,221,243, 95, 67, 46, 87, 22,176, 87, 35,141, 54, 16,139,217,114, 46,175, 19,211,248,
-  4,179,192, 86, 75,121,227, 19, 57,186,171,228,187,101,223,238,121,231,169,203,238,131, 95,173, 87, 45,206,221,214,160,108, 85,
-185,209,247,244,253,142,139,105,226,106,154,152,202,228,116,183,150,146,214,242,215, 87,191,179,198, 24,159, 82,189,240, 22, 13,
-202,160,206,113,164, 54, 67,149,108,229, 76,114, 96,205,  4,179,230, 67, 86, 48, 47,211,180,248,243,163,186, 45,181,132, 30, 34,
- 45,235,138,  0,218,248, 42, 73,208,212,161, 93,231,133,218, 52,185, 69, 47,231,248,125,149, 58,121, 46, 59,215,  0, 84,113,161,
-119,157,107, 13, 34,166,181, 80,103,222, 74,150,192, 87, 58,136, 36,199, 51, 16,192,144,160, 57,181,156, 88, 89, 91, 22,164,117,
-210,139,162,213,154, 78, 82,100,137,212, 91,147,122,140, 25,153,233, 85,185, 95,228,206, 24,110,227,169, 37,115,220, 43,240, 69,
-149,223, 10, 16, 49, 96, 60,186,122,180,219, 32,217,129, 50, 93, 74, 33,126, 80, 38,212,195,  7, 74,129,114,  9,226, 57,185,146,
-178,123,177, 49, 87,130,  6,129,173,214,137, 90, 43,135,201, 15,146, 19,117,161, 84,153,194, 75, 58,115,152,226,124, 16,168,211,
-132,158, 39,108,116, 89,182,253, 11, 69, 62,123,234,106,181,187,  9,121,225,  4,189, 26,169,251,145,124, 53,145,165, 48,182,137,
- 67,120,114,219,254,219,194,233,178,142, 34,156,  9, 82, 85,226,242, 53,108,130, 59,239, 94,162, 95, 85,242, 89,130,231, 54,200,
-243, 27,210,147,138, 93, 76,228,177,176, 25, 11, 99,  8, 52, 90, 70,114,139,222,148,128,151,109, 49,118, 59, 65,122, 33, 63,246,
-110,160, 59, 83,244, 70, 66, 78, 19, 92,196,110,247,178,192, 69,129,167, 19,118, 43, 33,155, 61,228,167,192, 13,255, 66,201, 96,
-107,112, 35,118, 67,131,119, 76, 57,138,177, 28,126,245, 19, 96,115,166,200,221,140,156, 40, 88, 38,223,233,209, 31, 62,129,231,
- 59,159,109, 94, 84,236,219, 71,234,135, 71,170, 76, 62,134,142,  0, 21,222, 44,244,191,247, 30,250,199,222,128,195,155,240,232,
-192,240,103,222, 97,184, 47,140,119, 18,245,202, 69,143,174, 19,104,192,155, 80,218, 91, 66,183, 29,242, 92,  7, 55, 60, 97,201,
- 46, 39, 24, 10,118, 94,195, 15,236,227, 17, 53, 15,186,105, 62,254, 17, 97,168,222,  1,230,248, 25, 37,132, 17, 94,176, 46,237,
-174,133,220, 94,178, 46, 97, 14,130,143, 67,170, 11, 39, 92,121,175, 81,164, 86, 82,205,232,233, 22,254,216, 11,254, 26,252,181,
- 39, 72, 45,216,118,  3,247, 51,182,221,195,215,174,176, 55, 71,108,179, 65,108, 32, 93, 14, 62,109, 32,251,154,104,147,225, 94,
-239, 54, 68,  5,170,162, 71, 79, 94,180,134,163,148, 58, 91, 28,115,245, 75,168,117, 76, 62,154,140, 67,170,113,133, 67,189,222,
-114,213,211, 42,  6, 85, 34,202, 19,107, 44, 31,187,198,165,104,149,112,167,174,153,192, 92,132, 54,177, 32,217,124, 12, 95, 60,
- 57,204,140, 94,161,163,178,203,198,137, 25,189, 88,232,100, 42,105,178, 57, 18,182,171,204,154,  4, 77,126,137,203,182,141,249,
-252, 61, 52,109, 56,218,216, 21, 92, 78,112, 48,198,193, 24,173, 54, 66, 39, 67,248,212, 75, 60,103, 87,  6,  7, 83,174, 52, 81,
- 77,200,237, 54, 88, 97, 79,155,248,169,185,127,170,197, 68, 35,132,114,168,114,196,232, 49,238,102,227,114,132, 75, 81,178, 86,
-166,178,116, 90,110,255,108, 81,164,110, 87,115, 81, 86,  9,237,146,206,112,152,169,165,167,205,177,157, 45,242,211, 47,222, 81,
-148, 82, 38,183,239,229,206, 99, 65,215,128, 48, 91, 58,234, 34, 11,156,162, 70,115,213,139, 96, 17,100, 66, 89,244, 85,173, 67,
- 87,105,132,137,  5, 94, 51,195,195, 68, 87,138,246,197,143,110, 43,118,189,179, 11,236,218,212,246,147,220,246,134, 85,157,170,
-133,240,122,217,119,183,180,201, 12,108, 83,162,203,153,162,153,115, 43,236,199,  1,105,226,202,217, 42,108,139, 18,223, 22,  4,
-250,218,251,222, 52, 26,196,  5, 43,171,253,125,219,217,183, 66,189,121,196,169, 49,117,233,250, 85,120,139,251,230,153,  3, 86,
-154,138, 95,230,132, 57, 23,171,118, 94, 96,148,202, 38, 37, 58,221,206,130,200,105, 28, 40,165,248,179, 92, 11,168,250,125, 84,
-166,216,213,199, 94, 62,185, 18,223,125,227,205, 38, 61, 49,141, 35,101,114, 81,172,133,181,114,166, 33,229, 80, 69,206, 56,213,
-230,121, 14,165,110, 83,232,206,113,111, 49, 64,153,247, 42, 81,249,172,  7, 76,178,234,216,219,161,226, 74,209, 22,137, 56,167,
-179,207,204,248,197,202,182, 88, 30, 48,255, 59,218,  2,235,235,228,221,138,129,110,149,156, 55,164,228,  7,246, 84, 43,227, 56,
- 96,157,  7,223,215,241,136,217, 49,126,164, 62, 58, 27,255, 32,187, 98,126, 36, 89, 13,  5,100, 88, 96,170,209,213, 66,166, 50,
-181,204,160,216,145,212, 16,205,236,199,194,166,236, 73, 99,134, 83,168,211, 17,249,246, 21,242,229, 19,120,111,132,151, 54,232,
-199, 61,118,121, 68,247,137,124,152, 72,161,130,100, 78,253, 89,108, 42,165, 46,108,225,107, 49, 58,141,126, 36,158, 46,149, 71,
- 35,189,123,133,124, 51,147, 78,  4, 78, 59,244, 83, 27,242,121,161,150,194,201, 71,133,146,124, 95,105,173,  0, 97, 41,168, 54,
-163,113,114, 91, 73, 47,119,176,201,232,217, 72,125, 80,208, 93,242, 67, 82,  4,185, 25,149,107, 50,120, 92,145,179,  2,119,138,
- 19, 54, 78, 30, 67,221,185,120,107, 10,185,240,165,161,  7, 71, 24, 38,169,140, 42, 36, 42, 39, 25, 78,179,120,177,112,183, 39,
- 61,223, 33,197,105,  7,114,175,131, 27, 25,134,248,  4, 13, 30,179,106, 67,161,166,226,118,207, 78,168,111, 87,186,215,110,208,
-253,165,207,195,241, 28, 46,  6,234,127,248, 38,165, 76,112,187, 35, 87, 69, 58, 63,168,164, 84,180,214,153,148,183,153,140,116,
- 75,209, 23, 58,120,182,119, 66, 95,173,126,154, 31, 10,236,253,123, 73, 31, 58, 53,112,236,108, 13,113,147,152,211,208,162, 72,
-234, 70,159, 44,117, 40,253,105,162, 30, 42,146,234,117, 74, 86,246,238, 55, 50, 61,253, 54,220,184,216, 65,102,242, 12, 72,238,
-161,219,193,139,183,224,245, 23,224,159, 63, 66,166,228, 10,248,103, 43,246,170, 97, 39,138,188,237,251, 53, 59, 76,144,139,175,
- 60,162,210, 21, 83,172, 83, 56, 53,184,161,112,186,243, 61,252,211,  3,105, 16,236, 32, 14,223, 48,168,154, 72,181,132, 47,220,
-174, 81, 31,101,197, 19,104, 71,159,202,146,106,214,148,224, 22,241,157,115, 50,151, 44, 97, 46,237, 83,157,212, 45, 99,205,250,
-213,148,218,199,226, 57,  7, 41, 45,  7,110,159, 96, 23,174,134,173,193,137, 86,250, 90,232,173,178,105,221,109, 76, 20,146,170,
- 11, 14,183,201,157,  0,219, 16, 27,206,  4, 35,159, 81,203,177, 98, 79, 39,120, 50, 49, 94, 85,142, 67,229, 88,224, 74, 96,180,
- 37,139,189, 21,211,163,193, 30,229, 42,176,169, 73,213, 83, 45,219,142,117,150,123, 89,136,192,154, 45,207, 60,101, 77,117, 53,
-176, 55,143, 16, 16,225,166,  8,119,181, 50, 33, 84, 81, 58,113,212,113,138,253,249, 36, 30, 34,229,144,150,130, 21,167,185,169,
- 36, 84,109, 41, 78, 85,209, 90,231,233,145,138,239,132,107, 49,122, 21,186,228, 23,107,142,152, 81, 85,117,133,124,248,224,137,
- 51, 83, 26,146,148, 21,136,170, 17,228,204, 47,253,172,194, 72,195, 34, 54, 94,191,175, 63, 77,212,145,215, 86,127, 64, 74,194,
-117,211,219,181,  0,151,181,224,100, 33,136,  6,124, 74,163, 96,152, 39,150,203,184,191,157,133,105, 30,205, 43,170,221,236,245,
- 31,135,  8, 55,177, 69,127,211,172,105,242,131,230,179,101,119,222,194,127, 44,144,171, 45,241,115,149,133, 94,106,101, 42,197,
- 31,225,  6,146,105, 59,253,190, 99, 76,202,116, 28,194,206,162, 75, 60, 50, 66,210, 24,191,207,150,209, 64,218,154, 83, 30,114,
-151, 57,212,202,120,181,103, 26, 71,191,  7,106,197,198, 33,166,193, 29,101, 26, 34, 90, 85, 80,241,221,185, 38,127,111,253, 18,
- 77,212, 50, 57,199,190, 70,151, 94,252,147,153,  9,155, 73, 10,149,184,136, 43,127,173,145,191, 84,  2,189, 26,151,130,206,193,
-216,177,167,105,241,172,109, 76, 35,243, 88,121,237, 57, 71,150, 74,183,141,161,116,133, 14,154,185,207, 51,140, 98,153,240,203,
-106,151,183,142, 90,148, 50,130, 36,180, 78,174,168,239,182, 76,213,152, 38,183,  2,204,222,222, 90, 60, 98, 85, 20,155, 92,241,
- 36,145,189,158, 39,131, 50, 33, 86, 73, 41,194,  1,202,196, 97,172, 94,120, 40,228, 18,225,133, 77, 19,148, 18,135, 82, 41,166,
-212,108,236, 14,131,167, 21,221, 76,212,175, 94,145,222,216,121,107,122, 41,200, 43, 59,228, 98, 64, 46, 71,186, 99,242,  7, 91,
-130,240, 22,192,142,186, 60, 67,115, 23, 33,  1, 25,145,186,160, 37, 90, 19,116,149,133,221,213,132,126,231, 10, 57, 83,244,135,
- 21,110,103,228,141, 45,121, 63, 98,151,133,211,203, 17,203, 45,213, 43,124,234,201, 19,164, 54,  9,244,153, 14,189,215,185,215,
-103,183, 65,243,136, 13,206,112,145,157, 34,219,132, 29, 98,199,123,172,240,164,132,167,100,  3,117,128,242,158,127,160,115,246,
-101,228,105, 70,255,232, 13,182,191,126,201,254, 55, 39, 14, 81,180,157,221, 16,210,203, 61,122,163, 35,221,238,144,187, 91,111,
-137, 30, 84,164,207,  1,106,136,209,223,227, 56,140,183,113,201,236,  5,222,129, 60,109,232,255,242,103,137,136, 37,234,127,249,
- 38,211,119,174,232, 62,123, 66,255,217,158,124, 20,158,126,247, 10,100,244, 11, 55,246,158, 59,131,126,147, 72,119, 55,232,203,
- 61,220,237, 97, 11,118, 89,124, 63,241,120,164, 62, 25,176, 99,133,228,233, 98,  0,150,161,143,145,171, 69, 17, 46, 57,176,161,
-  8,118,  5,247,222,232,217,124, 97,199,254,231,159, 80,167, 64,228,138, 63, 43,154, 19,100,245,142, 61,133,176,235,170,169,177,
-212,211,224,250,140,229, 30,235, 51,246,209,132,252,247,223,130,243, 17,187,161,216,231,123,184,215,193,243, 59,120,167, 82, 47,
- 46,224,252,232,109,180,134,242,177,165,170,  5, 85,197,206,179,155,254,115,245, 64,163,222,176,152,  6,200, 20,203, 98,117,165,
-151,172, 58, 45,141,164, 53,109, 34,190, 40,100,218,122, 72, 89, 58,217, 18, 49,158, 35,194,168,161,208,229,122, 28,172, 70,151,
-172,226, 23,250,184,  2, 91,101, 93,254, 96, 39,198, 38,  9,155,208, 62,156, 88,229, 84, 10, 39,165,210, 71, 66,216, 76,224,234,
- 19,178, 75, 62,225,185,145,144, 27,177,210,216,  5,252,189, 55,108, 50,120,107,194,222, 29,168, 79, 38,134, 67,225,105, 49, 46,
-204, 47,243,171,234,255, 84, 96, 23,215,180,138,112, 18, 15,245, 52, 45,250,161,106, 50,243, 52, 52,110, 11,155, 67,170, 36,138,
-238,184,238,213,173, 81,173, 64,119, 21,188,139,207,182, 34,220, 87,184, 50, 99,164,250,235, 28, 13,129, 91,148,108,190,100, 85,
-132, 73,112, 76,179,249,233,155,227,210, 81, 81,191,228,235,146,227,222,137,  3,107, 54, 97, 71,107,194, 38, 51,119, 36, 76,248,
-160,107, 95, 10,105, 26,233,187, 46, 84,248,118, 77,212,217,  4,104,196,165,110,113,224, 78, 97,205,146,153,201, 31,246, 61,145,
-134,110,153,187,241,202, 15, 78, 99,249,129,156,116,215, 95, 88,216,185, 18,171,188,  1, 91,220, 24, 51, 78,103, 21, 22,211,183,
-194, 73, 96,180,137,132, 50, 74,165,150, 50,143,217,181,202,170, 63,151,235, 13,101,184,186,108, 21,243, 75,  8,149, 83,245, 34,
-162,125, 30,108,165,254,207, 81, 80,185,112,145, 69,204, 29,147,156, 34, 19, 86,167, 57,132,172,169,215, 83,140,197, 91,164,146,
-198,228, 36,171,159,  7, 19,194,112, 28, 92,128,215, 30,154,176,155,146,242,226,227,207,157,127,254,115, 10,248, 90, 66,179,199,
-131, 79,199,  1,155, 70,127,207, 91, 80, 68,220,179,158,114, 24,135,145, 69, 58,140, 71, 58, 58,105, 74, 98, 12,175, 43,171,219,
- 92,193, 53, 81, 93,243,237,198, 11, 53, 67,246, 35, 86,206,116,  5,176, 97,149,  4,183,  6,246,155,255, 12, 57,118,100,109, 60,
-178,192,  8,108,222,193,164, 32, 90,165,248,185,  5,163,150, 49,  2, 69, 90, 32,125, 69,166,227, 76, 88,210, 90,150,111,222, 76,
-217,  5,  7,203,120,  2, 68, 76,218,108,222,221,141, 82,103, 21, 62,  1, 32, 27,195, 83, 97,146,232,204,144, 58,209,245,160, 99,
- 65,143, 19,232,145,250,115, 79,208, 63,116, 23,158, 94,193, 89,135, 62,183,193,158,140,164, 99,161,191, 58, 50,168,112,108,187,
-205,182,227,250,132,143,125,102, 82,196,135,176,173,  8,179,186,170,248, 28,208, 15,247,240, 53,200, 55, 21,253,244,  9,114,191,
- 35,253,240, 14,187, 42,216, 59,149,147,171,  9, 73,194, 73, 32,162,114,245, 67, 32,223, 75,190,183, 22,133,167,174,182,150,109,
-116,136, 17,106, 36,  2,210,139,251,122,106,129,190,243,150,166,  4, 98,178, 14,222,161,159, 36,152, 20,126, 87, 15, 63,117, 74,
-250,202,185, 71,135, 70,151, 55, 94, 26,185,130, 62,147,145,179,141,163, 73,159,  3, 78, 59, 55,127,111,212, 47,219,247, 15,158,
- 15,222,131,157,155,  7, 56, 95, 26,242, 64,216,252,229,215,224,246, 22,142, 21,251,251,239, 51,252,210, 83,242,167,119,228,127,
-231, 89,248, 55, 63,207,238,255,250, 22,219,111,126,207, 39, 18, 82,233, 58,255,157,183, 34,116, 55, 18,233,165, 13,188,184, 69,
-110,  6,159,255,220,253,239, 60, 41,216,197,132,237,189,186, 50, 53,196,148, 62, 53, 97,186, 95,244,150,108, 86,246, 14,230, 25,
-227,251,247,  6,134,119,221,144,222,249,  0,  8,233,196, 81,175,125,246,223, 83, 98, 60, 60, 40,212, 30, 54,209, 41,245, 57,212,
-226,142,166,179,113,240, 23,252,133,140,125,241, 20, 94,238,225,214, 41, 60, 29,224,205, 71,240,120,239,  0,154,182,147, 55,139,
-156,231,234,221,251,113,114,150,192,137,139, 41,204, 12,142,145,112, 87, 66, 45, 63, 57, 39,160, 61,116,205,102,152,231, 85, 87,
-179,246, 48, 91,217, 36, 69,112, 73,105, 25,218, 50, 71,107,106,203,176, 15,241,171,204,193, 28,  1, 80, 10, 65,237,166,105,112,
- 48,138, 46,  0,155, 77,130,157, 85,122, 42, 39,165,112,130,171,221, 19,226, 36,189,118,153,223,202,200,115, 25,158, 81,228, 86,
-176, 88,123,223,254, 48, 26,246,208,224,205,  1,190, 53, 80, 62, 24,184, 58, 20, 30,  2, 79,170,  3, 87, 46,205, 56,196, 20,126,
-108,207, 89, 82,182, 34, 76,193,165, 79,209, 29, 78,215,206,167,166, 16,111,231,154,204, 59,230, 54, 50, 47,  1, 58, 73, 22,218,
- 11,149, 25, 12, 83,112,209,220,137,192, 93, 17,246, 38,179,232,109,161, 44, 74,232,150,150,166,129,152, 18,106,173,212, 44, 36,
-171,228,232,146, 81, 91, 49,213,101,209, 14,181, 38,167, 77, 18, 67,200, 38,225, 24,200, 41,209,137, 50, 97,241,191,217,181,  0,
- 46,  2, 62, 67,235, 68,213,139,207,162,182,226,187, 47,  9,154,105,165, 22,175,181, 46, 17, 50,171, 81,177,201,239, 20,204,210,
-104,106,139,162,254, 90,216, 78,243,115,179,172, 33,179, 38, 36,137,163,130,131,148, 39, 34,140,165, 46, 23,250, 39,114,217,215,
-223, 91, 90,134,192,234,207, 53, 71,189,  6,136, 72,107,197,212,139,154,186, 74,224,211,176,158,205,162,184,249,103, 12, 17,109,
-151,168, 99, 13,101,241,114,169,207,150,182,  6,163,176,133, 89,128,122, 46,130, 85,135,164,213,185,120, 82,180,235,145,174,167,
-212, 66,210, 76, 74, 46,128,149,118, 17,168,227,131,203,225,128, 77, 83, 36,254, 69,113,223,118,238, 34,100,139,209, 80,169,  1,
-123, 41, 94, 37,117,234, 30,186,214,105,119, 73,219, 86,197,243,150,227,135,112, 16,240,212,244,114, 94, 17,181,238, 91, 29,  9,
-219,120,186,106, 62,146,101,221,109,135,247,212,253,196,238,159,108,255,158, 21, 85, 46,107, 27,217,217, 50,234,176, 16, 64, 37,
-165, 76, 19,101,216, 35,221, 54,118,105,163,239,213, 52,207, 98,  0,207,151, 14, 73,159,116, 80, 70,176,137, 46, 57, 40,191,148,
- 33,  0, 12, 54,231, 82, 79,213,149,174,197,188, 97, 45, 53,188,221,201, 75,210, 99,245, 81, 99, 46, 21, 61,140,176,203,216,135,
-123,248,104,128,151,119,240,141, 61,114,239,  4,125,118,  4, 70,186,177,208, 29, 10,189, 44, 34,157, 57,189, 96,101, 29, 97,242,
-110,103,253,137,173, 97,169, 27, 90, 65, 96,194,157,119,246,200,111,248, 30, 92,158,221, 32,207,246,228,207,237, 96, 52,228,163,
- 61, 93,173,206, 11,  6,236, 10,100, 43,164,103, 59,127,253,223, 45,243,  2, 95,182,138,188,164,158, 66,119,238,193,  0,114, 51,
- 33,183,179, 99,182,  0,246, 96,147,249,133,165,119, 96,247,216, 97,231,207,103,248,205, 11,120,255, 67,202, 55,247, 88, 54,202,
- 16, 98,164, 17,234,247, 39, 84, 38,236,108, 64,110,119,200,235, 59,248,236,206, 47,160,168,224,108,244,184, 79, 94,234,144,239,
- 87,228,201,  4, 95, 55,242,127,246,  2,124,241, 25, 56, 31,176,255,247,125, 14,127,225, 29,236,126, 70,191,176,133, 63,248, 18,
- 92, 12,140,255,231,  3,135,148,244, 48,142,142,144, 61, 21,232, 79, 18,122,127,135,126,106,  7,119, 59, 56,203,161, 10,244,177,
-187, 61, 29,177,125, 13, 48,132,  5,170,209, 72, 49, 47, 86,133,148,205, 21,170,157, 98,147,177,153,194,223,186,119, 21,117,218,
- 40,218,139, 23, 69,189,248,244,161,207, 72,151, 80, 50,169,116,158,180,119, 67, 60,119, 62,197,129, 90, 28, 17, 41,150,144,103,
-182,240,194,  6,123,101, 11,247, 54,200, 78,252,178,254,214, 83,120,116,128,174, 66,111,212, 41,194,129,178, 32, 83,197,246,174,
-106, 55,  4,174,  6,159,202, 84,111,209,172, 84, 10,149,105,117,101, 91,169,254, 92,233,178, 63,151, 25,146,210, 84,110, 97, 95,
-139,145,186,  7,100,248,243,137,185,247,190, 68,102, 58,218,226, 87,151,231,181, 29,120,173,123,203,210,164,169, 65,229, 83, 99,
-107,213, 49,191,165,114,106,198, 46, 59, 96, 68, 52,185,149,111,151,144,251, 29,242, 74,134, 79,101,184,105,193,123,141, 31,234,
- 80,225,253,130,253,214,128,125,123,160, 60, 30,185,220, 23, 30,152,241,200,101, 15,222,149,135, 61,173, 90,195, 89,235,162, 82,
- 14,193,207, 80,195, 42, 23,254, 97, 11,220,177,152,143,176,107, 16,189, 90, 22,252,250,154, 26,173,101,168, 11, 59,243, 61,186,
- 69,248, 77,193,139,111,  5, 54, 42,156, 90, 98, 84, 95,  3, 24, 45,252, 69, 81,173,140,101, 90, 40,154, 40, 69,234,188,211,157,
- 68,230,102,166,  9,227, 82, 28,140,170, 50,251,157,139,234,188,251,183, 88,137,102,220, 14,151,  2, 57, 58, 89,120,223,109,105,
-167, 91,138, 96, 13, 40, 75,155, 26,116,113,177,215,182,150,156,247,226,178,140,185,227, 18,171,149,165,163,255, 68, 94,186,173,
- 98, 91, 85,210,  2, 35, 90, 69, 66,219,130,123,156, 47,233, 36,206,112,183,184,192, 75,208,  1, 69, 18,147,249, 51,107,115,144,
-205,226,180, 90,  3, 90,180, 17,215,104,201,127,139,219,164, 89,183, 85, 21,117, 91, 87, 56, 11,162,128,137,104,111,230,100,205,
- 40,120, 99,223,239,171,204, 20, 32, 52,115,125,215,204,221,158,131, 16,102, 65,120,139,220, 85, 73,241,247,253, 65,209,200,155,
-149,216,151, 23,195,207, 94, 85, 82,246,188,  6, 11,253, 67,173,149, 50,140,254, 53,115,166, 78, 83, 76, 75,234, 42, 44,206,200,
- 37, 46,117, 68, 80,243,110, 54,169, 99, 23,243, 60, 54,243, 11,221,218, 14,124,101, 79,149, 85,133,104, 44, 17,138, 18, 35,245,
-198,166,109,221,118, 35, 25,249,  7,210, 47,174,142,240,255,  6,251, 90,114,176,125,103, 40,194, 53,164, 77, 64,108, 28,  2,144,
-146, 98,184,117,195,198,176,187,229,157,255, 18,101,136, 49,142,181,156, 69,183,190,168, 91, 21,132,  9, 43,230,223, 59, 65,169,
- 66, 77,254,230, 54,226,218,241,  8, 23, 19,212, 28,168, 73,129, 13,  5,180,167,152,143,210, 71,107, 49,140,  2,163,239, 60,235,
-207, 63, 70,255,232,125,120, 33,195,247, 38,228,217, 13, 92,140,232,105, 97, 51, 78,140,147, 19,182,138,254, 78,214, 54, 79, 13,
- 74,182,140, 68,155, 99, 96,148,101, 28,106, 49,210,186,245,214, 21,178, 17,210, 79, 10,114,179,131,151,183,228,131,191,150, 42,
- 19,245, 48,145,206,139,191,127,247, 50,122, 47,183, 40, 35,183,145,245,130,220, 76,110, 97,219, 23,175,254, 46,194,163,156,197,
-133, 88, 27, 89, 90, 54, 49,176, 27, 94,249,109,222,133, 47,108,225,231,207,169,239,236, 49,171,116,251,194,174, 86,183,180,103,
-153, 81, 78,114, 55, 68, 37, 99,208,134,212,145,168, 54, 24, 92, 21,167,167,221, 21,120,166, 67,126,126, 32,253,225, 59,232,191,
-253, 18,156, 31,224,131,115,246,127,238,109,134,155,  5,238,119,116,119, 13,249,197,119, 25,254,214, 19, 46, 63,184, 32,109, 11,
-194, 68,234,220,171,156, 59, 37,221,234, 72, 47,237,224,197, 30,185,157, 32,157,225,  6,166, 10, 15, 39,236,131,129,122,238,241,
-105, 18, 99,123,201,130,156,168,163,151, 53, 98,116,147,179,252, 91,214,164,181, 92,  0,109,234,246, 60, 79,128,164, 79, 72,159,
-145, 41,163,251, 30, 94, 61,133, 63,246, 34,188,187, 71,254,206,199,112,  3, 76,139,219, 92,110,119,200,167,122,120,105,  3,253,
- 14,145,201,129, 67, 71,224,235, 23,240,230,  1, 58, 67,212, 99,104,209, 58,167,251, 89, 68,131, 89, 54, 56, 19,108, 76, 48, 77,
-126, 48, 23, 11, 91,153,215, 47, 85,108,  6, 19, 73, 89,  2,132,214, 86, 47, 13, 17,150,  7, 82, 44,161, 29, 50, 45, 98,170,150,
-161, 93,139,135,228,156,152,115,251,109,171, 60, 25, 61,  0,166,206, 17,155, 66, 63,119, 97,174, 84,223,137,145,205,232,171,179,
-  3, 54, 93,116,227, 57, 33, 93, 70,111, 37,127, 61,190,160,240, 98,242,105,205,104,208, 69,139,189,  7,222,169,216,175, 12,216,
- 55, 14,148, 71,  3, 87, 67,225, 67,131,119,128, 39,109, 63, 85,151,226,184,160, 51, 57,172,161,146, 83, 76, 26,146,194,161,250,
-101,222,197, 78,250, 72,140, 22,211, 10,230, 47,173,107,111,140,109,157,247,182, 38,194, 33, 10,  6,204,216, 97,215,252,236, 41,
-254,220, 86, 92, 59,128,250, 62,127,170, 54,251,151, 83,  8,122, 45,  4,113,109,171,146,107, 33, 39, 79,252,234,197,129, 53, 14,
-147,177,136,183, 14,122,158,180,203,221,226,156, 93, 64, 21,235,168,227, 74, 93,159,210, 43, 38, 72,200,186, 66, 48, 89, 98,202,
-210,194, 78,174, 57,155,214,209,168,179,170,126,161,211,124,210,174,167, 43, 40, 77,155,114,204, 65, 72,107,117,252,108,199, 18,
-122, 77,104, 86,166,226, 42,114,157,131,116, 52,222,146, 37, 76, 71, 87,169,159,203, 42,168,217,209,100,165,196, 95, 46,255,164,
- 66, 78, 77,156, 39, 51, 32,166,173,152,234, 42, 31, 65, 85,231,157,185, 89, 89,105,171,124,215,158,115,246, 53, 76, 78, 46,112,
-  4,186,156, 33,103,198,105,140, 70,215, 39, 45,174, 78,111,154,  4,185,246, 90,182, 76,248, 50, 28, 61,199, 93,148,113,156, 24,
-142,199, 57, 82,188,148,137, 58, 77,115,218,165, 77,211, 53,  4,241,172,141,227, 90, 12,170, 63,208, 27,117, 95,179,243,129,151,
-168, 71, 89,237, 97, 18,130, 78,227, 42,169, 42,198, 42, 43,187, 86, 90,193,253,155,114,147,153,145, 28,197,195, 60,138, 55, 71,
-178, 18, 59,164,248,160,165,213,135, 69,172, 85,212, 45,102, 85, 65,210, 66, 60, 42,  5,134,  3,104, 70,180,199,202, 56,239,210,
-125,102,228,227,114,145,142,206, 38,170,133,130, 49,  9, 41, 11,221, 84, 93,  4,167, 78, 64, 61, 31,220, 34,117, 12, 28,212,105,
- 32, 79, 83,112,187,173,122, 14,251,100,133, 50, 85, 63,172, 81,172,102,100, 28,177,175, 60, 65,126,223, 61,120, 90,145,143, 38,
-244,185, 45, 28, 70,186,195, 64,127, 89, 24,  5,  6,177,136,226, 92,176,139,141,192, 85,108,141,218,181,107,174, 16,137,240,140,
-243, 44,164,253,196,205,111, 95,193,153,146,126,228,204,197, 96,111,156,144,206, 18,242,222,145,250, 80,169, 54, 33,157,160,207,
-119,232, 46,218,243,187,218,192,  0,200, 29,193,158, 26, 54, 86,232,139,199,119, 62, 42,216, 78,209, 19,129, 59,217,125,105,147,
- 57,243,125,243, 49,112,  6, 39, 27,248,148,193,239, 59,129, 95,157,144, 42,236,222,133, 77, 41, 62,182,238,133,244,122, 66,118,
-134,108, 99, 15,170,  5, 30, 76, 46,238,186,211,195,126,116, 37,250, 69,241, 66,227, 59, 35,250,165, 83,244,207,188, 22,240,155,
-129,225, 79,125,151,  3, 19,251,103, 51,106,198,241, 55, 47,201,191,116, 69, 46, 35,249,212, 11,210, 82,220, 55,218,137,144,182,
-153,244,236,  6,121,165,135,103,179, 11,200,234,  9,240,216,223,243,125,133, 98,200, 86,208,211,212,160,176, 62,177, 72, 26, 59,
-113,153,217,186,218, 39,183,250,152,239,220, 37,105,116,253,241,217, 74,206,120,214,146,225,216, 35,187,130,188, 54,194,143,157,
-195,115,223,133,116,132,159, 25,131,207, 16,211,142,231,182,112,231,  5,247,122, 93, 61,134,203, 91,238, 52,248,245,167,240,207,
-158, 98,251, 35,232,136, 93, 14,212, 67,137, 46,186,186, 54, 39, 69,199, 99,134,102, 79, 17,145,179,228, 35,105, 41,200,224,221,
-118,138,176,115,139, 92,251,166, 82, 78,234, 97, 38,109, 45,169,107,113, 83, 84,151, 57, 78,101,  7, 24,  5, 80, 38,102,239, 61,
-194,253, 62,113,251,191,120,  1,123,103,224,251,255,227,135, 92,198,100,201, 98,237,223,114,197,251,208, 55,228,166,137,233,179,
- 79, 55,250, 30,217,101,244, 94, 15, 95,204,240,133,  4,207, 69,202,161,212,224,135, 86,159, 20,125,187, 96,255,244,136,125,109,
-207,244,240,200,213, 88,120, 32,240,145,  9, 31,  1, 23, 53, 34,139,195,173,179, 19,137, 61,180,255, 74, 35, 11, 11, 62,205,222,
-123, 97, 34,197,142,186,178,  9,  5,124, 11,159,146, 85, 67,226,137,141,203, 69,213,180, 72,109,236,123,136, 21,229, 54,  0, 75,
- 67,216, 82,197,218, 42,194,245,  3,110, 91, 21,246,  8, 99,117, 27, 83, 82,165, 79, 57, 40,130, 53,136,143,144,172,  9,223,210,
-194, 59,111,209,169,159, 24, 57,167,182,155,101,161,119,206, 58,  8, 51,142,102, 28,235,132, 20,167,203,169,164,121,181,103,171,
-150, 76,126, 32,198,117,233,112,203, 44,238,189,238, 53,215,  8,173, 17,179,107, 87,122,  3,149,201, 44, 36,180, 31,184,208, 63,
-121, 39,100, 81,247,113, 87,155,119,246,142,  1,150,101,154, 18,255, 62,175,130,115,218,123, 97, 13,  5,187, 66,220,182,213, 68,
- 19, 29,118,177,159,174,226,154,153,180,122, 77,231, 46, 93,  3,115, 19,159,247,246,171,173,247,245,170, 74,146,206, 99,189, 53,
-251,164, 47,116, 38, 41,231,160, 37, 70,212,238, 10,197, 46,230, 63,199, 84, 74,  4,184,120, 16,203, 20, 83, 20, 19,160, 76,140,
-227, 24, 25,240,190,139,182,208,180,216, 60,145, 89,154, 62,105,200, 91, 21,178, 56, 46, 42,118, 72,254,224,122, 85, 36,116,129,
-  1,107,223, 56,233,122, 81,226,187, 52,139, 93, 55,186, 84, 91,179,  9, 49,142,202, 82, 87,190, 62,245,175, 19,134,156, 85,252,
-234,178,151,107,187,140,217, 98,186, 66,  8,154, 53,177, 74,162,180, 89, 98,163,182, 80,145,209,117,185,218,157, 69,252, 96,137,
-241, 96, 19,165, 20,146,  9, 88, 70, 74,241,  3, 81,179, 79,  9,178,  3,186, 46, 38,184, 60,194, 16,120, 87, 34, 55,187,148, 74,
-205, 62,166, 76,211,132,100, 65, 45,251, 79,168, 17,124, 79,124,  8, 78, 18,242,120,132,183, 14,240,198, 41,236,  7,228,208, 35,
-183, 55,164,171,194,118,184,100, 28, 35,121, 41, 86, 12,195, 39,196,162,182,210,117, 92, 11,193, 41, 94,120,136,194,161, 24, 23,
- 42,116,151, 19,187,111, 92,162,183, 19,242,185, 27,112, 43, 47, 36,190,206, 17,169,220, 84,116,167,126,  2, 25,126, 73, 39,247,
-255,114, 20,236,162, 80,175,138,135,169,236,131,154,181, 55,120, 65,225,182,194,141,222,253,235,143, 65,110, 63,129,211,201,119,
- 17, 93,129,159, 56, 67,198,129,244,124,239,135,224,113,164,252,220, 30,123,234, 35,254,250,107,  3,233,142,192,191,183,131, 91,
- 27,151,241,183, 10,169,138, 91,231, 30, 86,248,229,  9,121,189, 71,255,252, 15,121,145,182, 63, 50,253,119,223,167,158, 15,232,
-179, 14, 34, 58, 28, 11,114, 89, 56, 21, 33,159,248,129, 89,139,239,238,169,130, 72, 66,251,140,222,222,192,253, 62,148,252,119,
-160, 30,177, 97,242, 11, 29, 67,238, 37,100,215,147,164, 58,154,182,  4,152, 72,213,209,173, 57,  4, 90,157,193, 86,231,100, 36,
-114,236, 78, 34,115,211, 16,100, 76,112,165,240, 76, 65,126,252, 17,188,190,131,103,159,135,221,179,144, 94,131, 87,110,194, 75,
-226, 43, 31, 20,210,109,232,182,192,235,192, 57,116,191,  0,242,219,240,181, 75,236, 23, 31, 98, 79, 15, 14,154,153, 70, 31,167,
- 31, 29, 79, 60,  8, 30, 26, 83,150,241, 56, 21, 78,122,216,245,161,141,184,153,224, 10,244, 98,241, 13,231,100,243,  7,202,204,
-199,240,141, 30,183,160, 58, 27,167,223,230, 56,213, 28,155,130,174, 50,143,170, 37, 40,182,218, 65,253,198,145,253, 47, 94, 32,
- 98,108,179, 69, 30,144, 79,153, 54,209,145,247,169,229, 96,119,190,150, 56,235,144, 91, 61, 60, 47,240,147, 25, 94, 79,240,140,
- 11,131,168,145, 59, 80,213, 89,  2,239, 21,248,133,  9,251,197, 11,166,247,143, 92,150,145,135, 10, 31, 36,225,178,192, 57,112,
- 48,135, 52,109,114, 98,241,228, 64,103, 70,149, 58,139,180, 90,163,160,225,  5, 79, 49,145,155, 16,182, 73,185, 97,198,121,129,
- 99,156,109,218, 46,238,192,128, 74,220, 96, 75, 40,211, 50, 46, 54, 17,174,226, 24,220, 90,116,221, 24,135,213,110, 55,137,178,
-177, 58,167,107, 77, 85, 40,181,210, 25,244,169, 35,145, 16,117,239,191, 52, 43,214, 60, 74,110,103,175,206,158,118, 93, 34,133,
- 98, 77,233, 14, 13,247,205,123, 87,111,230,103,216,222, 42,135,113,164,175,149,148, 59,191,104,155, 66,190,214,200,247, 94,243,
- 69,150,139,176,196,101,154,227, 83, 82,100,249,243,218, 32, 52,178,104, 50,218,103, 41, 53,129,218, 15,156,225, 92,211,112,180,
- 75, 57,171, 99,145,215,145,174, 26, 49,188,104,186,126,161,207,220,249, 69,155,213, 46,245,209,150, 48,157,  6, 65, 75,226,  2,
-214,164,201, 95, 75,241,187,166,214,128, 77, 69,154,226,188,158,136,117, 64,109,130,230, 90,103, 98, 65,109, 43,  4,  3, 77, 77,
-189, 31, 64,169,107, 97, 43, 14, 60, 86,105,160, 30,157,253,242, 57,103, 95,103, 69,242, 98,181,234, 15,118,131, 36,197,207, 48,
-103,167,183,132,182, 85,174,187,243,175,116,145,  7, 70, 68,107,214,121,100, 83,231, 11,189, 23,101,163,158,122, 83,130,152, 51,
- 43,220,237, 19,113,115, 49, 70,159, 13,242,178,140, 71, 90,153,223,242,179,197,156,147,156, 98,245,208,198,  5, 18, 33,  5,109,
-  7, 65, 41,136, 26, 41,118, 42,106,139, 26,114, 78,251, 74, 14,151,241,113,186,147,165, 44,128,194, 58,  1, 92, 65,248,214,117,
- 93,177,213, 58, 51, 35, 85,253, 82,150, 90, 24, 74, 97, 42,198, 85, 17, 46,139, 50,212, 26,249,238, 54,103, 24, 23,188,130,172,
-  5, 76, 43,185, 22, 82,246,194,101, 38,200,180, 56,205,155,201,105, 89,191,113,142, 60,211,193,231,110, 34,191,252,  8, 57,235,
-144,155, 29,221,126,195,174, 28, 40, 89, 60,252,195, 66,184,220,198, 99,178, 90, 51,217, 50,106, 42,109,236,212, 64, 16, 49,149,
-212,  4,250,232,136,254,198, 37,249, 76,209, 23, 78,188,114,188,179,245,255,236,131, 83,127, 47,185, 56, 78,162,109,153, 12,158,
-184, 40,205,198,138,125, 20,194,177, 27, 17, 32,241,116,130,115,139,181, 66,124,240,158, 52,139,230,165,171, 53, 15,  6, 83,165,
-190, 85,177,243,  2,159,205, 78,178,217, 28,224,188, 96,239, 87,100,111,212,103, 50,105,112,224, 11,131,192,125,239,130,165, 86,
-172, 40,156, 11,242, 76,143,254,231,175,248,  7,230, 98,162,254,215,239, 97, 95,185, 32,255, 27,167,200, 55,143,216,187,  3,185,
- 51,250, 36,244,183, 28, 96, 99,183,  4,125, 28, 32,150, 62,161,154, 72, 93,143,188,188,113, 81,222,230,  6,200, 45,168,223,241,
-125,236,211, 40, 92, 38,127, 16,109, 12,133,122, 23, 98, 80,151, 21, 35,103,217,167, 11,237, 56,186, 12, 43,154,198, 85,217, 59,
- 71, 94, 70,129, 50,192,231, 31,192, 31,184, 13, 47,252,105,232,254, 45,224,121,207,108,151, 46, 88,232, 65,228,171, 71,144,  3,
-212,115,159,111,151,103,225,240,119,177,175,125,140,253,147,131,179,211,111,185, 19,129,171, 52, 23,118, 58, 86,210, 80, 29,130,
- 17,248,210,166, 93,188,186, 18, 54,135,202,217,101,229,244, 78,135,158,184, 66, 87,198,176,128,154,204,147,  6, 49,135, 96, 88,
-117,139, 25,230,132, 71,196,150,223,127, 21,201, 75,195, 22, 71,167, 94, 42,140,201,184,184, 26,185,250, 43, 31,120, 80,207,198,
-216, 82,201,117,233,210,211, 54, 35, 39, 49,  5, 49, 69, 78, 50,242,106,  7, 95, 20,248,172,192,203,138,156,158, 65,218,250, 37,
- 94, 47,161,142,238, 14,120, 48,193, 47,143,216, 63,186,160,188,189,231,184, 31,120,164,240,113, 39, 60,173,254, 18,141,209,193,
-245, 41, 99,125,239,170,226,232, 70, 59,170, 79, 26,155,247, 56,246,235, 45,206,115, 11,140,234,191,191,171, 93,156,  5,113, 43,
- 25,143, 45,128, 49, 22,135,102,195,123,198,218, 79, 67, 16,103,230, 22, 91, 68,231,177,243,227,226, 86,216, 83,140, 46, 41,163,
-233, 34,100,138,127,250, 56,124,173, 10,135,201, 41,233, 83,224, 98, 27,125,111, 18, 97, 50,119,156, 44,216,209,153,160, 30,124,
-124,185, 70,101,211,101,250, 76, 49,153,181, 34,237, 76,174, 86,153,226,159, 84,151,203,166, 52,113,240, 58, 88,132,101,154,193,
- 58,109, 79,150,181,131,205,222,121,167,233, 89,114,166,  6, 53, 76,127,162,215,246,236,242,131, 46,179,153,125,146,219,159,181,
- 31,156,225,155,224,175,197,234,252,159,  0,147, 70,213,134,169,213,  0,  0, 32,  0, 73, 68, 65, 84,219,243,216, 94,230,232,156,
-229,117, 81, 34,189, 45, 37, 71,169,182,163,186,169,145, 87, 29, 58,161,189,160,121,193,215,197,155,217,181, 21,115,173,205, 29,
-226,186,136, 38,244,158,181, 91,179, 15, 62,220,  9,145,116,216, 88, 46, 42,194, 38,103,106,238, 56, 76, 19,101,127, 21, 94,247,
-186,160, 17, 26, 44,103, 70,168,235, 98,  9,211,104, 64, 98, 37, 33,171,220,149,156,212, 33, 48,126, 57,250,222,162,235, 28,126,
-239, 31, 88, 91,184,239,114,253, 47, 55,193,  1,107,  5,109,187,212, 91,118,114, 68,166,170,168,219,227,176, 89, 37, 43,241, 48,
-172,195,219,136,110, 61,215,226,187, 48,117,170,211,252,  1, 66,230,136,171, 42,110, 87,107,244,187,166,184,165, 86,106, 25, 16,
-237,253,227,159, 82, 68,109, 78, 48, 77,232,102,231,220,209, 38,224,195, 56, 86,115,  6,116,129, 94, 42, 53,169, 11, 22, 98,196,
-227, 85,177,131, 98,199,234,232, 83,195,133, 15,218,210,214,170,127,218,228, 52,193,105,194,246,193,227,254,229,167,200,191,122,
-  7, 62,127,130,124,101, 66,238, 22,228, 80,216, 49, 81, 47, 29,242, 81,164, 37,131,213,107, 84, 62, 20,234,180,  8, 75, 52, 38,
-224, 98,254,193, 98, 21,  0,  1,130,188,179,103,251,255, 64,254,145,138,222,223, 64,206,200,105, 12,244,  6,115, 92,233,189,  4,
- 27, 23, 78,241,113,136,128,202,228,  2,200, 27,234,218,131, 59,138, 22,151,194,219,183, 71,228, 94,204,181,178,250,133,124,225,
-151, 34,125,137,156,242,  9,180, 80,127,241, 10,121,148,144,151, 51,114, 38,212,201, 24, 62,172,164,141, 32, 54,192,207, 61, 65,
-106,135,220,223,248,248, 59, 11,156, 40,242,108,143,252,161, 14,249,201, 59,112,214,123, 58,220,111, 60, 69,191, 62,160,255,238,
- 61,236,203, 25,185,115,197,201,223, 59,199,198,130,126,170, 67, 94,223,192,171,  9,123,175, 80, 59,245, 58,110,147,157, 82,119,
-127,  7, 47,103,184,221, 65,126, 45,218,218,163,119,233, 79,221,162,103,143,152,215, 47,162, 32, 39,177,227,109,227,244, 11,131,
-239, 71, 20,236, 16, 64,147,123, 61,220,203,112,191,131,103, 50, 60,179,129,179, 11,184, 11,188,242, 71,224,230,159,  3,121, 41,
- 14, 35, 69,  2, 40,106,172, 96,216,186,195,108,239,119,230,240, 45,184,250,111,224, 43,223,130,191,123,  3,121,207,224, 86, 20,
-158,210,193,198, 47, 92,219, 86,247,224, 95, 78,116, 67,101, 26,  3, 90, 34,194,216, 30, 53, 19,198,201,168, 79, 99,196,218,132,
-129,173, 74, 28,205, 63,224, 18,  2, 86,107,201, 26,159, 56, 72, 87, 49,202,243,129, 30,  0,163,126,170,148, 99,245,120,119, 51,
-172,103,129, 13,149,184,244,118, 29,122,218, 33,157, 11,  6,229,134,194, 27, 10, 63, 90,225,211,138,220, 62,133,254, 14,216, 45,
- 40, 91,183, 23,118, 31,131,156, 99, 15, 43,252,194,128,253,131, 75,234,119,174, 24, 14,  3,231, 98,124,156,133, 39,184,244,162,
- 70, 55,147, 82, 34,145, 24,147,131,166,106,241,255, 49,  5,204, 42,169, 81,138, 70, 81, 94, 87, 23,137,132,146, 60,176,201,  6,
- 99, 21, 87,234,139,113, 10, 92,218,178, 59,157,130,209,191,140,225,101,161,101, 70,130,155,  2, 67,169, 12,101,138,125,185,175,
- 47, 83,114, 16, 22, 34,228, 16,  3,154,248,104,189, 72,165,168,139,245, 26, 60,101,136,  8,205,150,206,134, 46, 23,185,172,246,
-199,204, 96,153,  6,178, 90,198,204,178, 18,167, 21, 26, 94,215, 71,225, 89,252,220,172,113,190, 90,112,171,173, 69, 89,207,231,
- 78,203,244, 88,160, 50, 33, 77, 91,130, 71, 90,228,174, 45,194, 48,239, 30,211, 53,122,220,245,224, 89, 89,208,200, 43,104,143,
-173, 26,198,182,178,224,154, 59,106, 65,202,216, 74,104, 87,131, 23, 48,179, 81,218, 20, 64,150, 11, 93,147,219,192, 26,114,213,
- 77,  3, 41,138,159,152,254, 94, 83,175,199,253,210, 22,247,171, 95,100,206, 82,151,181,189,122,121,110, 26,174, 28,187, 94,185,
- 52, 16,205,172,197,104,147, 24, 77,216, 56, 56,132,172,148,120, 31, 63, 25,128,187, 48,219,219,152,189, 70,  6,132,181, 98, 39,
-214,  1,104, 34,167, 80, 26, 54, 79,122,206,201, 89,183, 86,188,203,142, 28,227,  6,167,111, 54, 54,154,146,180, 77,156,117,  5,
- 21,142, 56, 57,135, 22, 52,128,194,194,149, 95,239,240,172,182,177,150,205, 74,195, 20, 44,232,218, 80,123, 44, 94,238, 22,205,
-218,144,126,181, 86, 23,195,232,226,221, 53, 83,204, 70,175,108,251, 46,194,232,189,197, 80,138, 31,218,147, 43, 35,154, 69, 35,
-169,144, 10, 76, 84,127,248,114,199,200, 68,157,196,163, 91,101, 17, 15,149,234, 85,254,134,234, 36,188, 36,238,  5,158,189, 24,
-201, 91, 26,137, 95,228,195, 43,236, 31, 22,228, 95,123,  6,249,124, 69,127,163,192,179,133, 42,198, 73,189, 66,174,202,156,226,
-116, 40, 62, 13,152,234,242,192,174,247, 67, 83, 89,141,252,108, 53,162,  7,158,  4, 30,243,254,247, 92, 48,216,253, 46,224,150,
-231,243,202,253,236, 63,188,  6,  5,110,140, 11,253,227,137,250,212,187, 72,233,  4,189,149, 32, 11,178, 83,244, 52, 56,233,147,
-186,244,255,129,193,157,120, 17, 46,195, 51,125,244,139,222,142, 21,158, 23,236,215, 39,236,235, 35,122,123,139, 60,231,201, 40,
-195,165, 79, 59, 78,223, 26,217, 94,  8,246,156, 33, 87,  6,255,124, 66,222, 29,208, 55, 78,144,207,236,224,133,157,139,239,206,
- 71,120,114,240,116,184, 63,255, 60,156, 10, 98,133,252,147, 91,244,133, 51,236,241,136,156, 41,220, 21,236,124, 96,250,222, 17,
-206,139,207,137,239,246, 72,233,225,197, 14, 94, 76, 72,247, 50,112, 31,236, 55,176,195,209,131, 98,246,147, 95,108, 55, 64,246,
- 41,172, 13,130,140,234,209, 96, 59,117,144,203, 11,  9, 94,  2,121,190, 67,238,168, 71,217,157, 37,231, 50,119, 29,108, 59, 36,
-159,123, 64,204,201,223,132,252, 67, 96,  7,252,155,156,198,144,112,189, 59, 92,119, 60, 27,255,185,116, 15,246, 25,236, 70, 15,
-191,255, 33,236,207,145,247, 11,242,254,  1,222, 29,176,144,114,219, 20,123,201, 65,177, 81,200, 17,220,225, 68, 59,239,226, 40,
-201, 57, 12, 71,247,111,201,109,215, 66, 72, 17, 56,138,171,199,219, 65, 81,  2, 19, 55,185,223,203,142,129,  2,157,220,179, 63,
- 35, 86,187,198,202,117,103, 12, 83, 37,111, 42,233,106,162, 55,  9, 33,159,139,  8,165,203,200, 89,143,222,200,200,221, 14, 94,
-168,240, 70, 69, 62, 83, 93, 63,176,187,  7,250, 50,216, 11,174,199,168,151,160, 79, 97,251,109,216,127,136,253,218,  8,255,251,
-129,250, 91, 79, 25, 46,143, 60, 81,120,148,224, 41,202,165,197,206, 92,124,245,102,125,162,144, 24,131,  6, 88,235, 98, 11,173,
-225,199,238, 90,160, 71,235,192,102, 11,149,119,229, 86, 23, 36, 74,141,189,120,138, 67, 63, 71,215,213,198,224,211, 42,199,187,
-  1,119,  8,251,108,173,149,169, 86, 74, 83,177,171, 50,168,114,133, 43,220,219,  4, 51,209,130, 95,252, 60, 57, 11, 86,198, 85,
-236,171, 75,228, 82, 28,195,177,210,226, 74, 91, 90,187,239, 83,151,152,207, 54,181,107,151, 89, 35,200,217, 28, 44,162,115,126,
-117, 70,217,197,200,119,140,179,217, 21,252, 49,250,173, 17,101,208,162,117, 87,163,110,107,251,234, 21, 77,206, 47, 70,153,109,
-192,173,246,107, 54, 64, 51, 89,165,170,203,130,  9,151,117,244,248, 66,140, 55, 18, 41,186,254,250,137, 26, 83, 35,164,234, 90,
-108,227,156, 75, 34,171,  8, 95,153, 47,230, 44, 74,151,148, 28,107,218, 98,117,190,115,154,160,173,113,248, 87,154,181,184,124,
-101,101, 17,188, 62, 89,208, 54, 94,215,  8,253,194,174, 79,176,195,182,214,146,229,148,235,174, 16,107,247,104,236,162,199, 82,
-152,198,  1,155,202,220,184, 54,123,159,  3,215, 22,225,223,124,130,212, 58,175,162,175,197,165,167, 72,226,203,186,228,  9,103,
-241,127,145,196, 51,151,211,156, 90, 35,159, 24,191,200,146,161, 28,168, 88,105,114,248,168, 74, 93,108,192,188,155,202, 45,155,
-121,189,  7,170,126,216,183,230,123, 86,165, 54,250, 25,209, 93,  7, 66,176,174, 94, 12, 52, 33,165, 98, 26,138,219, 98, 75,254,
- 37, 62,147, 76, 12,152, 36, 76,195,122, 87,195,  2,100, 78,164,107,193, 49,105,138,208,135, 24,111, 53, 59, 72,171, 82,221,169,
-224,113,130,181,217,122, 66, 76,100, 54,162, 83,136,240, 84,252, 66,200,213, 41,105, 10,182,137, 41,193,175, 63,129,187, 32, 63,
-253, 44,114, 57, 34,223, 50,228,190,223,255, 39, 15,174,176,125,153,157,  1,173,198,169, 43, 38,192,114,193,  7, 56, 33, 14,150,
-186,202,103,239, 12,158, 36, 72, 86,185,247,206, 21,114, 75,201,159,109, 28,222,236,106,226,171,234, 62,237,161,192, 59, 19,246,
-177,143,248,228, 52,222,183,187, 29,114, 43,102, 92,247,123,  7,125, 28, 35, 21,227,213,173, 47, 86, 63,246, 17, 54, 59,247,228,
-217,195,  1,182, 21,238,184, 80,171,124, 52,192,183,  5,253,169, 45,233, 86,162,255,120,226, 88, 52,154,229,130,156,184, 69, 73,
- 48,236,171, 71,234, 87, 38,244,207,158,249,  7,241,209,232, 85,214, 51, 27,248,153, 31,  3,158,194,111,127,215,147,200, 78, 39,
-244,139, 91,224, 20,123,162,240,193, 17,251,213,  3,188,239,  2, 59,189,211,145,158,239,224,229,206,119,180,155,231,192,222,136,
-177,238,  3, 56,132,223,233,  2,120,108,200,211, 16,152, 61,215,195,171,217,157, 10,207,116,176,235,130,  5, 29, 50,234,193,124,
- 18, 49, 21,255,221,199,  2,169, 64,189,194,110,191,139,124,225,207,  2,207,192,248,115,241,193,253,162, 91, 41, 63,153,147,136,
- 93,199,206, 49,184,114,176,255, 79,144, 47, 30,224, 71,  0,221,196, 31, 63,135,242, 17, 82,222,134,171,127,  1, 79, 63,134,143,
-223,135, 15, 62,194,158, 94,194,135, 35,246,142, 33, 79, 42,156,251,186,138,223, 43,240,211, 55,224,191,189,192,222, 44, 88,144,
-241,216,182,168,173,234,130,140, 62,140,219,146,252,193, 63, 77, 46, 97,235,182,110, 49,212,248, 20,214,240,113,182,104, 54, 19,
-191,244,179, 91, 30, 73,113,161,107,  8, 11, 95,234,144, 47, 41,188,106,240, 66, 65,110,  3, 55,110, 67,255, 58,232,143,  1, 47,
-248,243, 57,137,175,199, 54,191,  9,245,171,240,214,199,216, 95, 27,176,255,251,130,233,225,129, 39, 76, 60,232,132,199,  8,251,
-234,186,145, 42,226,199,126,206, 78,167,171, 44,155,218, 18,211,123, 91, 68,165,251,144,217,108, 88,118,211, 54, 71,207,198,152,
- 27,239,134, 55,205,162, 21,193, 39, 21,241, 12,114, 81,247, 19,199,122,171,145,228,166,150, 32, 97, 48,213, 41, 18, 29,189, 88,
-232, 82,162,170, 35, 71, 47,195, 37,152,163,113,232,162, 70, 42, 65,121, 20,132,211,152,  0, 28, 35,209,205,226, 28, 25,165,197,
- 39,219, 34,101, 51, 16,169,215, 46, 29, 89,141,143,107,236,227,230,169,158, 56,146,184,134,251, 32,167,224,170,151, 50, 55, 86,
-172,144,172,149,  5, 22,182, 14,209, 54,187,174,110, 23,214,105, 44,114,237,251,137, 74, 32,135,109,190, 64,215, 95,207,184, 62,
-150,149,185, 75,142, 56,217, 38, 20, 91, 53,140,245,255,199, 40, 39,235, 78, 89,184,246,253,100,134, 38,249,138, 36,205,190,126,
-153,199,243,105,245,107,148, 64,233, 74, 48, 22, 26, 66,215,102, 77,153,223, 45,147,212, 89,135, 50, 77,  5, 49,111,  2,105,  4,
-185, 90,175,249,247, 85, 82,120,221,203, 60, 97,105,130,231,169, 26,195,112,164, 14, 67,228, 51,172,108,119,117, 73, 73,186,206,
-240, 95, 23, 25, 50,223, 25, 77,151,160,170,228, 20, 21,109, 78,121,190,208, 83,140,143,242,250,235,124,  2, 93,170, 18,152,201,
-150,139,220,162,234,  0,173, 83,112,221,151, 61,131,  4,100,161, 37, 55, 49, 91,178,196,141,255, 45,123,221,150,168,214,212,  0,
-251,177,255,209, 24,125,153,102,175,174,109,106,132, 93,175, 44,219,104,205,138,243,179, 11,212, 58, 33, 37,249,215,  8,238,165,
-213, 35, 73,179, 71, 75,214, 37, 80, 48,135,221, 36, 69,151,162,171,143, 81, 99,209,143,204, 25, 54,222,236,104,117,130, 86, 96,
-114, 57,137,  8,183, 41, 72, 49, 49,190,177, 51,193,126,238,  9,250,220, 22,249,242, 61,116,  4,190,103,216, 29,255,218,167, 31,
- 95, 81,169,243, 95,173,  6, 71, 91, 72,  8,117,165, 26, 45,174,247,155, 43,225,118,230,246,234,213,231,195, 14,242,193,184,243,
-157, 75,228, 76, 73,175,135,134, 55,103,207, 90,109, 85,193, 14, 23,139, 73,134,251,234, 93,232,211, 58, 47,231,164,198,222,248,
-134,122, 65,240,194,214,255,238,253,226,127,110, 35, 62, 38,255,230,232,251,241, 91, 61,250,233, 13,245, 43,  3,246,173,  9, 94,
- 49,228,249,158,221,135,149,109,137,  4,184, 27, 14,102, 17,245,  5,173,124,191, 32, 63,115, 11,238,237,224,209,224, 47,228, 78,
-225,254, 77,191,112, 14,111,195,221,143,225, 62,208,191,  8,249,167, 64,  7,100,247,107,216,163,131, 35,108, 79,157, 89,159, 62,
-117,130,124,238,  4, 62,147,144,155, 55,193, 94,  3,185, 15,246, 43, 46,190,186, 48,120, 88, 96, 20,228, 51, 91,120,181,247,  2,
-224,102, 92,226, 67,117,113,214,249,224, 58,130,171, 10, 23, 99, 24,159,109,102,237, 26,  9,217, 11,156, 61, 66,254,196,151,160,
-255,  9,168, 63, 11,233, 11,144,190, 12,114,242, 59, 34, 50,103, 57, 79,189,128,242, 16,198,223,134,195,223,131,171,127, 14,199,
-209,197,115,253,103, 97,247,123,225,236, 71, 97,247,101,191,120,111, 43,188,216, 76, 90, 83,132,114,142, 72,189,  4,123,  4,245,
- 41,232, 99, 72, 39,192,247,225,175,254, 77,228,195,115,228,234, 42,242,110, 55,144,183,254,143,246,208,159, 46,237, 86, 29,192,
- 46,144,178,135,195, 17,251,184,194, 91,192,219, 21, 62, 44, 62,  1, 25,218, 92, 53,136,116,187,166,234, 44,112, 91,224,229, 10,
-159,  6, 94, 50,184,  9,108, 79,160,127, 30,242,151, 32,255, 75,144,158,245,  3,170, 28, 96, 58, 64,247,  4,228, 31,195,197,215,
-176,127,120,133,253,111, 71,234,187, 87,236,199,129,  7, 73,248, 72,213, 35, 80, 43, 92, 85,191, 40, 69,124,207,108,205, 63,111,
-174, 63, 73, 11, 31,116, 57, 20,227,130, 24, 34,213,173,111,209,152,178, 64,176,  8, 81, 83, 22,245, 51, 72, 22,232,158,219,139,
- 82,116,114,161,201,145,121,152,232,234,246, 72, 87,163, 46,212,183, 44,206, 16,159, 86, 97, 77,197, 96, 66,231,232,217, 13,149,
-141,250,247, 26,  2, 41,187, 77,126,214,106, 93,198,219,134, 56, 27, 28, 23,135,174, 47, 66,189,182,111,150,217, 10,219, 34,117,
- 77,100, 86,180,139,174, 24,255, 77,241,175,138,153,135,141,232,202,119,110, 51,  8, 37, 56,246,232,204, 50, 95, 39,167,219, 39,
-138,213, 70, 98, 99,181,151, 22, 89, 26,191, 38,140,187, 14,139, 93,161,101,101,  9,225, 86, 22, 21,251,156,238, 38,215, 87, 65,
-178, 90, 69, 40, 77,200,184, 32,237,106, 60, 33,217,152,117,  3,105,206,118, 95,170,139,102,243, 43,198,108, 53,107, 99,255,164,
-193, 77, 88,133,206,172,147,210,220,250,173, 43, 55, 82,  3,245, 84, 74,248, 73,125, 61, 29, 94,126,147,153,217,223,190,196,100,
-238, 59,111,169,165, 86, 27,159,192, 63, 87, 42, 21, 82,154,153,249,213, 86, 32,231,185, 88, 10,215,152, 36, 84, 59, 82,238,200,
- 77,114,191,217,116, 51,198, 85,165,144,195, 24,191,238,173, 53,164,234,201,236, 26,237, 77,108,  5,143,152,  6,239,244,105,227,
- 31, 89,249,  4, 67,121,186, 94,213,173,108, 34,178,178,112, 37, 93,254,255,118,105,163,130,229,140,165,236, 47,112, 90,152,187,
- 85,193,138, 82,169, 81, 93,199,200,172, 20,180, 20,114, 25,155,219,208,253,188,125,118,241, 95,169,136, 84,103, 98, 87,247,239,
- 26,197, 61,164,210,242,205,109,245,102,187, 38,170, 82, 41, 90,177, 24, 36, 36, 85,116,171, 72,191,202, 80,149,  4, 79, 35,246,
-242,134,131, 91,234, 95,255,128,244,167, 55,240,163,119,208, 82,169,111,181,  7,195,184,241,193,149, 19,138,146,240, 52,128,253,
-199,218, 42, 73,155, 31,222,107,235,150,102, 27,143,232,207, 18,202,232,143, 54,160, 15, 43,183,127,235, 10,233,149,244, 25,  7,
-123,112,171,135, 33, 67, 55,120, 44,232, 24, 48,143, 83,117, 64,203, 11,241,130,190, 95,225,142,194,153,250, 30,250,253, 10, 87,
-151,158,166,118, 43,193,115,157, 75,174,159,139,247,243,209,209, 11,141, 47,111, 73,223, 60,192,169,162, 47,111,225, 83, 91,228,
- 75,  3,250, 96,130,183, 39,159,146,220, 72,216,133, 98,239, 86,244, 79,222, 67,126,207,125,248,248, 16,193, 27, 46,160,226,248,
-  1, 12, 95,117,255,216,157, 87, 64,254, 21,168, 63,237,225, 60,245,171,254, 75, 63, 28,224, 82,208, 91,189, 19,242,126,104,  7,
-175,109,145,123, 10,242, 58,232, 75, 80, 63,242,203,115,127,132,205,  9,242,211, 59,184,165,176, 81, 31,191, 30, 10,156, 79,177,
-103, 31,253,253,122, 28,246,186, 67,157,105,115,140,192,133, 33, 31,  2,151, 21,235, 14,200, 95,248, 44, 60,247, 23,221,179,159,
-255,  4,232, 41,252, 14,204,233, 69,109,246,  1,140,127, 23,246,255,  0,198, 39, 48,156, 71,215, 93,225, 34,123, 80,206,243,223,
- 71,238,252, 54,240, 71,224,236,247, 67,122,198, 71,245, 54, 45,125,133,244, 46,245,210, 91,192, 43,145, 51,202, 34,  3, 59,253,
-227,240,218, 99, 15,167, 47, 87, 32,167, 32,103,113, 27,111, 99, 74, 16, 26,  3,187,128,241,187,112,245, 79,192,126,  5,185,253,
- 33,232, 30,187,  1,188, 26,168,222, 42, 78,204,219,154, 35,210,110, 87,184, 49,132,158, 98,227, 63, 79,222,130, 62, 11,221,231,
- 33,255, 36,228, 79,129,222, 92,174,128,186,  7,219,131,126, 13,166,191, 15,223,120,143,250, 63, 13,216,175,236, 25,247,  7,158,
- 36,227, 65, 47, 60,  9,242,155, 43,251,149,174,239,226,130,115,124,117, 13, 33, 81,105,112, 72, 42, 57,185, 87,120,196, 60, 19,
- 30,155,213,238,132,  0, 46,199,136, 59,  1, 91, 49, 54, 89, 49,201,  8,137,177,194,113,154,188,171,195,249,252, 85, 28,  0, 34,
-171, 11, 67,227,119,153, 98,154,151,196,133,116, 26,170,237, 38,188,202, 77, 88, 43,115,204,  3,  5, 97, 31,159,135,147,  0,210,
-244, 38, 12,  6, 23, 49,  2, 63,137, 61,237,133,153,239,214,155,165,107,181,127, 94,152,237,204, 29,246, 58,137,172, 89,162,106,
-227,124,132,205,184,138,255, 35, 86,233,196, 39,119,226,109,233,210,237,175,244, 19,237, 27,213,149, 51, 98,181,225, 93, 21, 14,
-173,249,209,217,253, 35,200, 53,  1,154,172,110,210,165, 52,168,215, 60,109, 77,112, 55, 95,160,216, 15, 20,  0,242,137, 11, 86,
-227,194,111, 34,226,220, 20,244,234,197,154,139,184,151, 75, 93, 34,160,169,214, 74,169,133, 49, 84,255, 98,139,255, 35,169,144,
- 82, 14,225, 40,139,142, 34,252,235,165,150, 80,200,175,130,107, 12, 82, 78,244,125, 79,206,137,220,229,121,229, 43,179, 71, 63,
- 18,240,172,204, 83, 93,141,232,230,165,131, 15,100,111,245, 59,183,189, 95, 13, 85, 44,154, 22,188,112,107,188,204,167, 49, 41,
- 39,210,166, 67, 82, 34,119, 73,217,110, 55,164, 44,104,141,144,  2, 77,193, 62, 46,238,243,156,133,109,204, 41,105, 26,242,177,
-132,146,146,  6, 78,182,196,108,191, 71,202, 20, 99,148,136, 97, 76, 33,112,168,203,104,217, 52,154,194, 57,175, 60,186,119,149,
- 57,242,117, 22,125, 88,165,162, 88, 74, 30,  7, 90, 42,166,  1,125,152, 21,131,193, 39,142,159,173,138,161,117,242,157,240, 84,
-124, 23,170,  2,195,209, 63,132,147, 87,103,201, 10,181, 76, 14,206, 39,  4, 73, 76, 51,206, 17, 98, 77, 16,227,255,212,185,210,
-190,134, 40,252, 84,253, 16,113,144,117, 14,127,173,192, 73,113,218,222,100, 46,  6,163, 96,111, 23,202, 95,125,139,244, 31,125,
- 26,126,252,182,215,165,239,184, 30, 64,171,113,147,  3,245,178, 56, 38, 60,158,140,163, 57,244,100,  8, 94, 12,182,140,227, 89,
-  9, 70,172,  5, 27, 84, 79,135,122,144, 32,127, 60,114,243,235, 87,200, 46,161,157, 58,158,245,102,130,220, 59, 36, 96, 95,151,
-123,231,194,124, 87,252, 98,246,221,185,138,119,170, 35,126,233,215,138,189,125, 68,190, 93, 96,151,176,231, 21,121,238, 12, 94,
- 59, 69, 94,216, 33, 31, 94, 82,119,134,254,112,128,180,207,122, 36,101,244,217,  4, 47, 11, 60, 59, 34, 79, 38,108, 35,112,150,
-208,223,183, 67, 94, 63,131, 15, 47,189, 27,124, 55,148,246, 55, 30,194,243,103,208,253, 97,144,223, 13,124, 17,236,204, 47, 33,
-121, 31,236, 39,160,252, 83,236,106,132,219, 29,122, 59,195,203, 27,244,213, 13, 60, 43,208,191, 12,188, 28, 47,222,175,129,222,
- 68,238,124, 10,158,185,  2,121,  2,199, 11,236,145,  7,126,240,120,132,199,145, 68,247,168, 96,231,  5, 27, 70,191,239,142, 14,
-225,225,129, 33, 15, 42,178, 73,200,231, 78,144, 63,117, 23,249,242,151,224,238,127, 12,233,243, 33,115,109,186,234,244,137, 75,
-125,  0,123, 27, 14,255, 11,246,224,103,145,183, 46,176,243, 14,116,  7, 99,  7, 79, 51, 60, 10, 54,124,238,224, 92,177,215,223,
- 70,244,103,125, 68,189,251, 61,208,189, 24, 23,115, 23, 66,138, 97, 37,112,107,160, 17, 93, 57,150, 51,240, 44,200,243,110, 89,
- 92, 59,155,109,117,160,178,241,175,219, 63,  3,233, 21,232,222,128,252,243,176,123, 31,185,255, 16,198, 67, 44,158, 99,234,180,
- 81,159,244,156,108,160,251, 12,240, 98,168,213, 95,134,242, 10,200,203,160,119,125, 36, 51,127,191,201, 39, 19,211,155, 96, 63,
- 11,143,190,130,253, 31, 23,216,223,152, 40, 15,247, 92,216,196,195, 14, 30,198,168,125, 40, 62,178,164,235, 24, 45,  5,203,220,
-102, 72, 14, 56,154,182,159,247,137,158,185, 46,201,123,188, 17,193,202, 34, 78, 34,216, 27,189, 72, 64,165, 92, 96, 39,157, 82,
-138, 48, 77,222,169,149, 22,153,105,203, 94,121,238, 32,163,211,213,224,209,180, 81,115, 86, 31,181,175, 59,191,166, 25, 90, 70,
-217,203,158,212, 48,246,209,185,159, 86,225, 44,106,102,173,198,211,234,112,171,141,192, 72,101, 95, 38, 95,157, 70, 97,161,145,
-220,134,234,236, 61,111,180,178, 58,239,210, 35, 33, 44, 84,244, 22,194,230, 28, 76,247, 49,  2, 38,100,222, 93,203,156,188,  6,
-215,115,222,235,138, 84,246, 59,148,167,222,169, 26,115, 26, 89,224,219,174, 21, 27, 63,168,119,151, 31,184,218,215, 93,119,138,
-174, 91, 44,118,212, 65, 17, 77,235,192, 47,145, 85, 42,104,176,225,213,129, 53,224,107,160,100,174,253, 42,  2, 67, 41,243, 26,
-163, 90,101,170,230,233,103, 13,218, 19,129, 46,235, 88,221, 38,134,115,213,187,119,239, 99, 45,158,132, 86,150, 53,105,179,144,
-  9, 66, 29, 38,255, 89,250,126, 22,139,207,138,  1, 51,166, 90,  3,209,235, 36, 58, 82,192,162, 98,100,127,125,125, 93,231,160,
-165,106,174,242,119,242, 93, 76,195, 67,227, 85,103, 65, 96,135,118, 27,239,246,173,146,187,205,134,254,244,148,178,223, 71, 46,
-121,144,114,146,  5, 38,176,128,133,241, 93, 90,101,225,123,105, 69,209, 46,121,188,101,236,149, 60,141,166,206,170,120,153, 63,
- 13,178,132,146,204,232,189,182,149,247,175, 55,103,236,202,  2, 87,153,213,134,104, 88, 39,194, 35,217,186,104,153, 69,246, 49,
-222,119,155,193,236, 25, 47, 21,177,209, 45,  0,154,124, 12, 59,140,200,166,247, 85,253,228,157,122, 91,213,251,  7,172,186,146,
-151, 69, 89, 58, 91, 51, 42,115,158,252,228,161, 80,254,160,116,145,165, 91, 88, 80,129, 13,234, 62,198,133,127,154, 97,119,196,
- 30, 12,148,191,242,125,210,159,124, 21,249,242,109,127,131,222,241,  7, 33, 77,198, 45,142,110,185, 10, 53, 76, 73,144,171, 43,
-201, 11,203, 36,116,109,121,107,123,174, 41, 42, 90, 45,190, 58,126,154, 97,251,224,136,124,219,119,153, 42,  2,175,158,192,173,
-236,  0,238,227,232,139,190,193,224, 81,248, 36,139,186, 17,121,  8,206,251, 78,225, 86,196,124, 62,184,164,126,247,128,189, 83,
-176,193,208, 47, 63, 65,126,215, 25, 60,187, 69, 94,217, 34,210, 35, 39,  9,123,127,132, 62, 33,231, 81,157, 28, 60,130,212,196,
-176, 11,144,159, 56, 67,158,219,192,219, 71, 31,251,107,130, 77,129,231, 30,194,107,  2,249,223,  7,253, 67,113, 73,156, 70,226,
-205, 30,228,  6,148,247, 97, 56,247, 46,227,115,157, 19,232, 94,232, 29, 92,114,186,133,250,252,210, 53,111,126, 36, 12,168,223,
-133,241,125,184, 24,177, 71,  5, 30,140,240,104,194, 30,150,185, 91,175, 87,158, 71,108, 79, 11,246,110,133,135, 46, 50,212,151,
-183,232,159,185,131,254,158,123,240,236, 43,208,189,228, 29,175,253, 44,156,255, 53,236,209,119,224,193, 19,120,174, 67,238,220,
-133,252, 47,131,117,254, 61,247,191,130,189,243, 93,248,202, 21,252,218,142,122, 56,117,225,223,109,  3, 29,176,209,176,115, 63,
-108,117,167,112,209,193,101,194,222,120, 23,121,254,111,192,254,159,193,230,115,190,151,238,223,128,252, 42,200,205, 21,181, 67,
- 86,216,207,166,174, 28,227, 63,235,234,  2,255,228,241,188, 62,120, 51,164,231,225,228, 95,135,237,143, 67,121, 23,166, 15,192,
- 46,221,126, 71,129,116,  3,250,155,144,111,129,190, 30,109, 60,160, 23,110, 88,239,108,245, 61,197,255, 94,189,132,250,  8,134,
-127, 12,195,223,134,223,122, 23,251, 31, 10,245,171,  7, 46,167,129,135, 25, 62,238,148,167,213,152, 38, 95, 44,164,212, 65,191,
-137,156,104, 67, 73,145, 65,109,115,112,133,103, 96,183,209, 54, 84,153, 72,116, 75,102,130, 45, 29,223,132,123,193,253, 92,203,
- 88,206, 76, 98,140,165, 64,241,115,167,152,139, 93,205,165,212,243,206,213, 59, 50,157,169,159,197,100,241, 91, 95, 19,166, 53,
-255,155,205, 35,210,165,131,149,107, 29,107,109, 10,247,  8, 92, 57,195,216, 70, 20,235,185,  9,131, 85, 54,110,  8,  9,136,158,
-231,127,155,120,113, 50, 75,254, 86,137, 99,115,119,221,190,191,249,122,212,240, 66,129,153, 53,183,232,232,155, 64,120,134,150,
-204,187,217,213,213,109,215, 69,100,215, 18,207,  2,168, 51, 39,191,253, 78, 68, 57, 91,186,235, 31,252, 63,157, 99,188,117,102,
-194,235, 66,128,139,247,177,217,249,186, 70, 45, 85, 13, 81,100,241, 34, 45,  2, 88,142,213, 47,190,110,140,194,103,170, 46,162,
-140, 66,166,129,208, 84,160, 15,122, 27,179,  7,220,155, 59, 13,150,190, 52,143,122,116,244,165, 86,191,  7,139, 93,195,225, 46,
- 58, 21,159, 25,149, 90,152,166,  9, 82,231,151,171,248,  4,123,178, 74, 45,109,164,238, 77,240,  8, 28,143,  7,108,104,201,108,
- 54, 23,157,182,210,172,181,119,172,154,161,165,248, 68,188,115,224,154, 76,174,230,215,148,253,125,  8,  1, 93,238, 54, 27, 44,
-  5,253, 70, 12, 73,222,202, 99,101,246, 45, 90,178,101, 31,216, 36,215,226, 41, 84, 57, 41, 93, 45,241,176, 69,151,172, 75,162,
- 13, 51,153, 41, 70, 54,213, 13,251,213, 42,165,122,199, 43,193,137,111,185,191, 13,229,170,115,122, 20,148,172, 94,225, 76,213,
- 19,197,114, 63,143,113,102,128, 65,168,243,173, 44,161, 36,169, 20,218, 64,174, 69, 12, 82,  6, 24, 58,196,170, 11,250, 40,241,
-168,232,252,115,107, 27,225,229, 32,137,133,245,133, 85, 53,222, 62,189,131,193,201,100,110,153,168,  5,114,242, 39,250,104,238,
-225,110,138,197,211,  4,167,138, 29,  6,236, 27,231,240,191,190, 69,250, 15, 94,133, 47,223, 65, 53, 83,223,242,215, 39, 99,220,
- 26, 15,243,244, 66,134,120,102, 90,246,115, 89, 18,172,109,245, 51,213,120, 16,199, 58,  3,254, 56, 23, 56, 25, 13,253,254,  1,
-106, 66, 78,  5,185,147,224,238, 14, 78,178, 43,137,174,226, 50,191, 29,202,110, 12,246,129, 26,203,  9,187, 28,124,215,220,  9,
-246,193,145,250,205,  3,118, 82,160,135,250,235, 71,248,165, 11,120,117,131,124,170, 71, 94, 76, 46, 54,123, 53, 35, 99, 14, 48,
-139,193,183,  6,255,248, 92, 84,228,139, 59,228, 78,143,189,115,112,213,249, 85,  0,244,127,248,  9,188,120,  3,186,255, 10,244,
- 15,196,229,213, 55,229, 72,140,161,  5,234, 55,225,248,  0,166, 12,187,206, 35, 92,159,243,177, 62,242, 67, 32, 47, 68, 33,240,
-  0,244, 28,236, 91,112,120, 12, 31, 11,124, 84,144,183,  7,236,193,232,124,117, 49,234,177, 96, 15, 11,246,222,136,125, 80,144,
-154,208,251, 27,210,127,122, 11,249,221,183,144, 23,206, 96,211, 65,237,224,240, 33,188,247, 13,234,191,120, 76,253,123,143,225,
-235,  7,236,194,227, 31,229,134, 34,247, 19,188,252,143,252,198,233,  5,222, 83,236, 42, 83,199, 12,249,128,157, 30, 97,175, 46,
-210,155,119,236,161,112,189,236,208,203,130, 78, 29, 92,244,216,167, 15,240,252, 55,145,179, 55, 97,123,  6,221,125,216,126, 22,
-250, 31,135,252,162,119,251,146, 22,  3,147, 18, 35,246, 28,169, 39,233,250,168,243, 19,  6,163,235,189, 87,  1,217,122,209,144,
- 94,  9, 32,122,157,243,207, 67,232, 50,227, 64,150, 80,130,109, 40, 77, 74,196, 80,118,241, 30, 29,160,188,  5,227, 95,198, 62,
-252, 37,248,219,  7,236,111, 21,134, 15,175,120, 40,149,247, 54,194,  5,190, 55, 79,197, 87,128, 57,119,254,137,175,149, 74,245,
- 67, 78,149, 12, 76,146,168,  9, 36,249,250,172,214,226,218, 61, 96, 44, 70,169,147,159, 33,101, 57,152, 27, 68,101, 68,153,178,
-146, 52, 81,106, 97, 63, 20,178,154, 83,202, 88,180, 58, 37,197,247,142, 67, 88,100,189, 31,118,213,123,173,182, 34,139,249, 37,
-209,246,231,134,163, 92, 91,145,221,118,193,237,252,171, 43,155, 96,169,198, 85, 32,101,219,197,126,150,224,188, 58,163,253, 68,
-132,162,198, 80, 74, 48,230,109, 57,161, 86,  2,185, 53,239,189,174,222,235,201,184,166,188,110,231,236, 18,111, 18,201,141, 97,
-251, 42,164,217,143,125, 93, 15,178,254, 94,204, 28,122,137, 11,253,218,118,221,214,187,112, 91,177,165,116, 14,198,177,133,112,
-194,122,190,180, 14,252,106, 59,232,182,183, 78, 73,188,128,171, 54,171,196, 91,240,203,156, 64, 41,202, 70,124, 21, 82, 98,231,
-172,234,175,121, 10,167, 66,109, 34,233,153, 96,186, 56, 17,210,252, 57,119,200, 88,177,226,220,251, 32,184,105,117,138,100, 69,
-174,241,243,125, 58, 82,188,161, 11,171,113, 78,186,228, 13,168, 80, 75,241,152,232, 40,102, 38, 51,142,227,192, 52, 28,195, 54,
- 29, 13,225, 28,147, 27, 39,255, 39,  8,125,213, 28,104,162, 34,142, 86,206,105,150,213,207,179, 32, 19,114,234,187,200, 19,169,
-164,156,200,187, 29, 89,171, 39,142,197, 40,220,125,141,214,138, 81, 87,170, 39,175,158,196,204,125,153, 45, 47, 61, 40, 51,201,
-150, 48, 24,109, 96, 26,243,164,205,106, 94,133,205,  9, 64,178,108, 97,196, 22,122,146, 52, 17, 70, 82,239,190,109,194,180,247,
-170,170, 76, 88,118,248, 76,173, 37, 42,191, 28, 63, 92,248, 85, 17,196, 38,116,170,164,188,161,150,228,219,185, 58, 33,195, 33,
-126,166, 18, 74, 75, 91, 60,245,197,189,242,189, 24, 35, 30,191,170,  1,115,104,108,235,130,  6,204, 33,128, 28,147, 57,210, 54,
-235,210, 53,197,  7,147,205, 18, 12, 44,119, 50,246,209,  1,186, 66,253,234, 83,228,175,191,131,254,204,203,240,165, 51,164, 55,
-210,119,124,172,223, 85,184,245,241, 62,188,220, 54,251, 98,143,133,120,205,155, 55,125,113, 37,180,236, 97, 86, 89,209, 37,214,
-181,253, 97, 66,222,219, 35, 91, 37,223,  8, 97,216,189,141,175, 11,186, 50,123, 51,103,101,222,105,130,171,201, 67, 67, 30, 77,
-240, 65,133, 23,  5,158, 73, 62, 69,120, 58, 96,155,  8, 54,153,128,223,218, 99,223,240, 16,115, 41,226, 17,174,127,248, 22,250,
- 83, 55,177,179, 30,126,  8,120,119, 68, 63,123,138,221,234,176,119,246,254,195,137,250,222,246,228,145,219,158,182,127,213,199,
-237,178,249,132,218,181,149,239,125, 92,234,  7,144, 91, 72,151,224,134, 32,103, 29,228, 31,243, 17,112, 25,192,190,231,151,249,
-244,158, 71,118,189, 43,240,193,  4, 31,141,240,209, 64,189, 56, 82,135,  9,158, 26,246,176, 32,143,196, 73,103,127,252, 14,250,
-  7,239,192, 43,103, 17, 13,171,176, 63, 96,111, 62,161,254,220, 35,166,127,112,206,240,189, 43, 31,205,111,160,222, 16,210,173,
-140,116,160,147,160, 31,128,188, 55,198,231, 80,188, 88,233,253,194,177,106,240, 36, 56,248,125, 94, 70, 46, 18, 62,249,174, 96,
-214, 97,181,146,174, 12,206,123,248,190, 96,119, 39,184,255,  8,185,253, 24, 78,222,130,237,255, 71,215,187,198,106,150,165,119,
-125,191,103,173,181,247,251,158,107, 85, 87, 85,223,123, 60, 61,211,227, 25, 27, 15, 54, 54, 54, 25,108, 19, 18,  8, 96, 72, 72,
- 36,164, 68, 10,136, 64, 72, 66,  4, 81, 34,132, 20, 69,185,  8, 72, 20, 62, 68,202,  7,  4,  9, 81, 66, 20, 43, 16, 66, 32, 22,
-118,226, 27, 96, 99, 25, 12,182, 99,123,152,177,103, 60,198,115,233,238,153,158,190, 85,117,215,237,156,243, 94,246, 94,107, 61,
-249,240, 60,107,239,253,158,106,143,212, 83,125,169, 58,239,109,191,123, 61,151,255,255,247,255,167,198,177,143, 71,254,217, 39,
-187,200,194, 17,116,223,  0,171,143, 67,255, 50,200, 51,254, 62,118, 79,190,143,135,136,145, 73,132, 55,237,112, 14,212,182, 58,
- 83, 63, 36, 47, 96,156,145, 37, 37,193, 14,244,  0,229, 17,228,127,  4, 87,255,  3,250,185,183,224,251,133,250,217, 29, 87,187,
- 61,111, 39,184, 27,133, 93,101,186, 89,210,245,118,176, 86,181,239,184,107, 72,178, 66, 40,194,190,157, 53, 49,152,255, 62,118,
- 12, 49, 81,115, 65, 60, 53,176, 58,241, 45, 37,247, 87,187,216, 72,  5,134,152,216, 81,185,145, 71, 11, 73,241,123, 78,144, 64,
-212, 72,145, 72, 13,230, 99,206,181,113,115,195,180,175, 69,196, 89, 25, 62, 49,208, 22,254,195,148, 92,214,102, 34,205,219,220,
- 68,196,180,113,177,204, 59, 80, 21,161,136,129,143,182,110,213,203,190,103, 63, 10, 80,106,160, 70, 56,166, 80, 84,184, 82,235,
-238,135,146, 73,181, 90, 40, 85,179,202, 45,242,193, 85,235,181,132,243, 25,119, 59,128,117,139,112, 96,227, 10,158,237, 33, 64,
-174,101,242,187, 79,179,133, 73, 11, 53,215,128,211, 21, 83, 23,  2,188, 57, 32,122, 78,145, 91,136,217,104,215,255,181, 57, 81,
-219,133, 91,148, 77, 99,220, 91,214,188,197,208, 86,106,153, 31,184,221,161,218,121,146,  4, 82, 72,102,167, 84,139,180,174, 30,
- 29, 94,125,223, 45, 11,101,252,196,196,247,207,177, 86, 27,203,207, 72,218,121,252, 78, 99,178,187,109, 17,130,219,254, 22,200,
-238,182, 82, 14, 30,214,228,164, 63,137,209,138, 24, 85,198,156, 41,206, 60,  9,193,222,183,113, 24,166,206, 90, 26,120, 71,220,
-103,169,243,185, 87,235, 92,  2, 77,218, 10,159,136, 55,212,104, 75,162, 19,183,153,167, 20,162,251,201,133,110,125, 76, 58,127,
- 10,125,252,158, 37,132, 77, 21,154, 93, 60, 69,213, 32,247,206, 49, 22,172,170,201, 30, 48,144, 68, 38, 25, 78, 20, 27, 41, 77,
- 52,184, 22, 54,239, 29,250, 20, 67, 55,117,189, 45, 36, 99,190,232, 68,162, 39,189,225,162,  3,235,216,170, 68,163, 22,101,143,
-203, 43,217,246,141,169,237, 70, 34,168,101,221,106,181,200,173, 82, 11, 50, 14, 19, 30, 48,120,240,223,228,131, 81,243,176,167,
-166,184,196,200,119,169,216,  7,152, 61, 91, 89,167, 11,192, 84,150,163,170,  5, 15, 56,204, 67, 58,177, 55,160, 89,128,206, 60,
-160,251,162, 88,172,232,237,104,163,248,113,132,115,165,126,246, 33,114, 43, 33,127,224,121,228,155,  3,122, 20,  9,175, 61,166,
- 70,161,139,112,243,254,142,180, 41,246,146,  4,210,104,249,208, 82, 32,143, 30, 13,233, 23, 89, 55, 97,120,125,189, 81,108,146,
-158,139,146,163,165,132,213,109, 70, 95,219, 25, 39,252, 36,153,189, 41, 70,179,108, 61, 54,245,185,118,174,224,127,223,148,153,
- 12, 35,250, 86, 49, 53,250, 43, 61,242,114,100,252,185,145,253,202,154,215,110,173,196, 34, 68, 41,176, 55, 77, 20,119, 43,221,
-223, 28,173,113,252,228, 77,187, 48,111,218,161,207,221, 45,250,230,  8,199,150, 44, 71,205,240,209, 12, 71,255, 29,200,183, 58,
-250,119,176,207,244, 16, 94,105, 59,218,242, 89,180, 70,228, 41, 87,243,223,  9, 54,158,150, 15,217,243,149, 43,208, 79,195,238,
- 17,220, 15,240,134,192,251,  5, 86,142, 34,123, 48,194, 87,246,232,123,133,240, 76, 79,248,246,155,132, 63,120,  3,190,225, 24,
- 78, 58,227, 38,108, 50,250,234,125,202, 79, 61,102,251, 19, 23,108,223,216, 49,230, 74, 57,129,122, 35, 80,142,226,212, 94,180,
- 36,193,216, 43,253,202,109,153,110,125,145,216, 12,197,109,125, 35, 22,170,178,203,182,  7,246, 60,111, 55,247,130,100,235,252,
- 70, 37,142,  5,185,136,112, 47,193, 59,  9,189, 17,224,198,  8,231, 91, 75,200,235,189, 24,238,177,  9, 75, 60,182,128,157,237,
-171,176,126,  1,142,126, 51,164,151,125,133,225, 59,116,130,137,227, 24,141,104, 87,223,135,242,190,141,218,117, 99,  7,115, 88,
-249,190,253, 24,194,218,121,178, 30, 15,155,206,205,107,206,173,  5,152, 83,236, 73,168,152, 48,113, 74, 85,137,214,  0,  0, 32,
-  0, 73, 68, 65, 84,255, 87,224,238, 15,162, 63, 94,224,239, 66,126,251,138,251,101,228,173, 20,184, 47, 86,203, 37,223, 99,203,
- 58, 81,107,245,137,154,211, 18,  3, 19, 78,115,234, 68, 69,201,165, 80,139, 97,128, 99,234, 88,117, 29,165, 51,226,158,142,197,
-239, 45, 75,232, 71, 35,110, 85,114,182, 14,232, 40,  9,151,213,240,168,125,138,116,  4,114,181,100, 44,114,177,251,158, 52,111,
-182, 44, 60, 83,122,144,113,113,120,128,169,219,152,102,107,152, 58, 42,183, 97,101,157, 11,104, 16, 20,236, 64, 47,254,218, 10,
-138, 22,163,222,117,162, 28,185, 55,189,212,202,137, 59, 43, 55, 24,190,182,104,177,166, 35,122, 55, 39,184, 56,184, 30, 98, 16,
-166,243,120,182, 16, 79,180, 79,153,253,252,209,  3, 71,144,121,172,172, 79, 56,201,213,139,  7,153,136,104, 77,207,163,194, 36,
- 72,148,197,129, 57,163,191,229, 96,148, 47,173,  3,151,131,176, 56, 86,190,255,180, 18,209,116, 14,162, 70,229,211, 16,208,106,
-199,249, 88,125,130, 35, 54,105, 73,193,198,209,197,155, 59, 69,167, 91,122,112, 87,150, 65,118,132, 82,148,170,217,227, 74,109,
-157, 83, 23, 30,251, 24,230,233,195,236, 81,183,247,182,162,158,170,120, 61, 44,126, 30,197, 55,143,251, 80,172,216, 92,117,189,
-189, 39, 46,156,110, 51,146,146,139, 33,199,181, 78,227,123,185,174, 89,240,107, 36,132, 89, 77, 62,137, 38, 39,218,221, 44,206,
-108, 92,  2,149, 64, 18,  2,165, 22, 82,234, 73, 71, 39, 86, 97, 20,219,  7, 52, 75,198, 36, 16, 75,238,131,243, 71, 31,106, 37,
-151,106, 95,206,  0,189,170, 69,183,166, 72,138,129, 72, 37, 77, 81,117,118,200, 83, 26,186,199,199, 31, 85, 80,169,  7,246,  6,
- 22, 99,251, 16,131,141,181,101, 65, 83,242,192,  2,243,157,207,240,  3,145,  4,201, 14,175, 32,214,205,139, 58, 75, 89,138, 69,
-236,169,229,231, 74, 35, 37,249,222, 81,171,113, 90,197,171,254,214,238,  6, 26,186, 85,102,107,129,255,251, 34,144,213,170,238,
- 92,171, 97, 71,219,217, 83,176, 36,152,149,192, 90,109,167, 92,197,169,161,  9, 61, 90,155, 82, 62,  6,234,231,175,  8,183,223,
- 67,126,251,179,200, 55, 10,172,133,208, 39,106, 23,136, 41,112,254,222,134,112, 89,  8, 98, 58, 50,196,148,190,120,218, 19,190,
-163, 11,139,207,187, 49, 67, 86, 73, 89, 91,104,144, 77,164, 99,165,190,157,  9,221,222, 14,156, 19, 23, 95, 93,101,120, 35, 83,
- 31,100,184,169,246,156, 95,207,104, 15,242, 82,  7, 55, 61,164,250,162, 32,223,210,193, 63,177,178,134,181, 48, 22, 24, 81,116,
-132, 97,180, 26,166,127, 70, 56,189,200,132, 97,132,215, 55,222,198,  4,184,187,131,207,239,209,207,108,145,151, 87,200, 31,234,
-224,198,  5,220,252, 70,  8,191,207,133,101, 23, 30,152,221, 63, 97,160,161, 60,128,242,203,166,224,191,221, 35, 47,172,224,104,
- 15,229,194, 70,237,225,  4,198, 95,134,203,  7,112,127, 13, 15,170,105,  2,190,239,134,165,189,253,133,119,224,125, 37,124,252,
-140,240,199,215,240,219,111,194,233,202,238,156,187,130,188,254,144,242, 11,143, 25,126,248, 49, 23,191,190,225,241, 88,184, 60,
- 18,120, 42, 26,115, 96,122, 30,158, 17, 36, 86, 75, 38, 79,233, 43,105, 17, 23,172, 86,124, 33,115,210, 96,  8,205, 54,165,  7,
- 52, 59, 79,191,176,235, 48,248,  1,181, 85, 66,169,200,182, 32,219, 12, 15, 83, 75, 91,178,241,248, 26,243,149, 31,251, 53,118,
-126,137,220,186,128,211,135,144, 31,195,254, 49,172,191, 12,253, 43,144,110, 59,216,224,161, 29,188,245,109,216,191, 14,195,149,
- 21, 80,165, 90, 17, 21,125,164, 31,130, 29,252,169,154,  5, 46,125,  7,196,223, 14,188,232, 93,122,235, 77,131, 21,  0, 53,155,
- 91, 97,251,231,208, 47,255, 26,252, 47,137,250,207,  6,118,155, 29,119, 69,121, 43,  5,182, 14,110, 10,222,  1, 73,144,137,119,
-221, 20,237, 97,233, 97,246, 27,107, 84,166,213,158,162,228, 98,223,200,174, 91,147, 98,178, 14,186,139,140,197,110,216,115, 55,
-198,140,244,172,160,157,176, 74,129,203, 12, 67, 16,207, 22, 42,104, 41,118,159, 11, 62,221,155,212,226, 30,117,231,145,210,165,
-161, 57,107, 59,216,120, 98,140, 76,163, 90,186,104,104, 82,166, 47, 50, 38,101,193, 59,173, 14, 25,217,250, 72,254, 72,140,151,
-191, 14, 66,142,129,162,133,163, 86,247, 85, 27,221,182, 26,176,121,210,203,116,208,201, 19,163,240,209,133,126, 77,133, 95,151,
-178,  7,108,109, 17,167,164,206,234,246, 57, 57,184, 31,107,187, 39, 30, 80,222,174, 67, 89,230, 61,120,153, 10,  3,109,137,198,
- 51,244,101,209,109, 90,113,209, 80,187, 38, 96, 28,171, 33,191, 87, 33,206, 60,246,162, 20,205,182,223,246,142,186,199,  8,125,
-218, 37,114, 81, 74,105,170,242, 38,101,170, 19,191, 99,116, 22,190, 44,232,112,243,218, 82,166,102, 50,132,198,100,145,137,  9,
- 82,139,250,132,134,195,132,185,197, 27, 49,233,190,252,156,171, 77,251, 17,170,139, 38, 93,192,232,212,211,234,170,120,209, 37,
-172,134,131,194, 76, 61,210,220,180, 96,179,181,112, 38,177,232,129,252, 80,196,192,113,164,142, 84, 74, 53,177, 91, 58,178, 23,
- 50,152,226, 85,101,  6,243,182,157, 19,110, 21, 72,162,236, 75, 97,168, 58,171, 69,181, 13,108, 44,135, 56, 33,116,174, 84,149,
-160, 68,204,207, 93, 99, 68,181,152, 48, 78,116,254,248,165,153,233,195,252,  3, 29, 97, 40,117, 54,237, 91,122,145,250,248,202,
- 51,112,213, 58,184, 32,160,161, 35,116,130,196,  4,219,209, 46,198, 82, 76,252, 86,153, 47,220,106,129,217,177,165,165,120,  5,
-179,220, 76, 77,158, 88, 89, 38,243,224,254,119,183,222, 86,200, 85, 24, 58,229,120, 83,224,225, 96,202,241,170,176,117,224,244,
- 38,152, 61,234,212, 99,154,206,162, 77, 69,215,193, 82,193, 66,128, 47, 95,161,199,247,144,239,184, 13,175,156, 88,252,231,113,
- 64, 58,187,193,156,197, 13,242, 56, 19, 86, 74, 26,109, 98,157, 60, 77,110, 26,251,133,153,177,191, 10,112,220, 41, 55,215,202,
- 81,132,116,105,231,165,244,126, 34, 93,101,120,144, 12,163,229,222,122,189, 40,212,207, 95,152,232,233,165, 96,122,171, 71, 66,
- 88, 87,219,147,191, 89,224,173, 17,190,183,163,255,151,142, 24,254,241, 21,229, 68,173,176,241,102,180,  4, 19,233,140,254,133,
- 36, 96,  9, 57, 95,119,170,208,195, 10,247, 50,225, 60, 34, 87,152,234,252,197, 29,172,254,109, 59,213,202, 23, 77, 12, 23,158,
-126,242,206,161,  3,148,207,192,238,158,237,127, 95, 88,217, 11,213,  8, 97, 15,241, 10,242,231,224,254, 59,240,110,178,105,200,
-163,  0, 31,235,224,108,  5, 63,251,  0,126,239, 25,252,214, 99,228,153,181,137,162,134, 17,222,126,140,126,105, 67,249,193,  7,
-236,126,101,195,230,114,100,119, 36, 92,222, 20,182,125,100, 91,124,127,154,231, 27, 84, 18,166,152,226,137,236,167,138, 22,153,
- 50,170,139,123,138, 37, 96, 59,209, 22, 58,238,142, 15,233,197, 60,251,218,162,255,100,214,187, 69,108,210,164,106,218,129,157,
- 65,111,100, 31,204,205,177,242,234,160, 11, 38,120,116, 71,129,222, 23,184,115,129,220,217,194,241, 21,228, 75, 67,176,246,183,
- 77,224, 23, 86,110,146,117,  5,102, 13, 86,133, 21, 19,196, 50,110,237, 48,151,199,208, 93, 65,255,109,208,255, 81, 72,223,228,
-163,252,236,217,176,109, 68,176, 54,117,251,246,111,193,213,255,140,254,202,  5,250,191,246,228, 47, 92,113, 57,236,120,167, 19,
-238,138,161, 80,131, 19,219,136, 66,  9, 54,109, 91, 78,189, 90, 79,104,105, 85,243,184,177, 70,163,217,185,127,196,187, 60, 37,
-103,115,162, 83,125,101, 23,163,133,201,184, 56,137,226, 55,201, 40, 12, 17,118,158, 75, 20,  5,246,165,146, 61,212, 37,250,148,
-209, 10,119,  3, 91,101,135, 67,136,139,242,170,159, 22, 65,155, 19,230, 80, 86,118, 16, 12, 93, 77,149, 62,161,181, 91,239,171,
- 79, 26,189,213, 79,223,236, 43,135, 73, 92,230, 81,173, 33, 38,118, 82,  9,197, 82, 29,119, 49,204, 96,148,133,194,125,210,249,
- 44,159,153,204,121,240,178,160,235,181,195,182,  0, 99,173,  6,215,241,108,113,173,213,195, 89,194,194,230,182, 56,208,101,238,
- 84,151, 56,107,117, 17,113, 59,100,  2,115, 86, 19,141, 90, 26,194, 92, 32,248,123,213,137, 16, 67,  7, 98, 41,101,117,114, 50,
-217,189,219,168,109, 50, 29,230, 77,209, 17, 67, 36, 36,139,220, 46,101, 36,123,220, 96, 97,206,197,152,217, 42,115, 17,177, 76,
-116, 91, 12, 16,102,222,160,206, 58,173,234,202,116, 14, 96, 56, 75,246,237,181,207,223,213,244,234,128,159,125, 25, 97, 15, 37,
-231,197,246,171,253, 76,153,200,112,184,141,186,217,235,218,148, 69,155,208, 27, 19,220,233,129, 95,126, 94,219,197,224,147,171,
-126,141,166,142,164, 81,  8,235, 35,200, 35,227, 48, 16,171, 93,140,237, 34,175,137, 57,227, 72,132, 40, 86, 81,218, 95, 21,245,
- 69,110,179,156, 24,147,194,126, 95, 23,102, 36, 99,154,198, 79, 17, 77,130, 76, 86,  3, 27, 35, 53,219,129, 52,177,137,127, 25,
-164,206, 22, 10,  7,220,122,  0,140,237, 30, 76, 85,232,240,131, 97, 11,169, 35,134,  8,171, 19,180,236,208,113,239, 39,141,137,
-216,196, 43, 91, 25, 71,155, 48,250, 14,172,224, 55, 53, 15, 42, 40,234, 57,242, 90, 33, 55,251,136,241,173, 91,193,209, 38,236,
- 99, 85,219,177,239, 43,225,190,  9,202,164,183, 19, 95,  7,117,143,113, 65, 30,244,126,242, 97,255,253, 78,135,164,  0,217, 88,
-236,188,182, 69,211, 67,228,219,206,225, 27, 78, 44,171,251, 36, 16,142, 34,117, 21, 56,150, 13,225,241,224, 56, 69,187,120,227,
-202,198,240,227,130, 60,215, 46,186, 20,149,152,160,223, 64,119,212,209,255,235, 55,  8, 47,244,118,243, 59,139,118, 24, 94,218,
- 88, 93,111, 39, 27, 79,127, 45, 82,191,188,131, 13,134,121, 61, 14,232,133,227, 72,215,130,190, 54, 32,191, 10,225,251,206, 88,
-127,110,224,242,225,136,158, 47,214,178,193,242,182, 79, 43,172,190,115,101,213,241, 47,109,225,249,158,240,189, 39, 70,127, 59,
- 57, 50,159, 94,142,240,209,  4, 31,138, 16,191, 27,234, 93,168, 95,128,248,123, 22,160,244,197,222,183,188, 11,229, 47, 89, 55,
-123,243,204,184,244,187,140,116,157, 29, 64,229,211,112,111, 15, 95, 19,120,119,240,215,182,182, 47,207,166,192,119,220, 48, 15,
-145,102,184,220, 81,191,116, 65,249,233, 11,234, 47, 94,146,223,221,145, 99,229,209,177,176,187, 25, 24, 68,184,242,201,195, 80,
-204, 23, 26,213,166,220, 41, 64,109, 43,241, 57, 57, 98, 50, 59, 20,153,101,100,141,179, 48,223,213,125,  2,213,  5, 66, 10, 83,
-178,147,116,174, 45, 73, 62,229,161,117, 98, 21,173, 35,146,221,198,153, 61,124, 70,220, 75,219,196, 19,163,152,234,108,140, 48,
- 88,200,142, 60,243, 46,156,108, 32,191,  8,101, 15,249,  2,186,231,236,175,244, 52,196, 79,192,234, 33,212, 71,246,222, 14, 95,
- 51,135, 64,200,112,252,109,112,252,199,160,255,164,143,227,247,254, 87, 27,108,250,162,109,124, 13,182,255, 13,188,247,243,232,
- 63,  9,232,143,118,148,215, 46,184, 40,123,222, 88,  5, 30,170,189,245,125,152,245,122,134,134, 46, 19,205,172,248,158,145,197,
-120,183,101,190,183,155,103,136, 66, 41,198,116, 87,135, 52,170, 91,130, 36, 89,100,161, 20, 83, 40, 87,169,132, 24,109,160,  0,
-164, 24,169, 57,179,203,  5, 77,214,249,151, 42,140, 81,233,146, 16, 75,160, 83,179, 83, 21,204,250,213, 40,113, 38,176,  2,117,
- 86,122,110,222,101,157,221, 60,237,239, 99,179,133,133,198,135,119,174,249, 53,117,184, 89,231,116,154, 36,204,191, 26,140,166,
-115,175,123,115,201, 70,255,121,235,162,142, 76,144,169,104,172, 94, 24, 45,  0,163,115,113,225, 75,198, 41,174, 85,219, 64, 89,
- 60,205,172, 82,106,165, 80, 73, 26,233, 66, 36,164,206,114,187,151, 34, 45,213,107,135,215,225,252, 76,125,226,217, 94,179,133,
-104,133,131, 88, 85, 59,152,151,172,120, 91,103,166, 96,247,220, 65,149, 82,203,100,251,154, 44,130,238,163,143,194, 98,223,111,
-151,253,144, 51,185,152, 14, 66,155,142, 97,217, 68, 59, 14,182, 86,253, 64,137,232, 18,207,222,220, 90,234, 69,217,100,169,114,
-241,153,  4, 62,200,  6,176,240,217,  7,155,  4, 59, 58, 56, 52, 70,123,153, 19,237,138,206, 63, 91,181,186, 61,110,241,100,106,
-225,  9,173, 98, 59,252, 91,209,218,  8,142,106,194,108,243,133, 71, 86,125,207,106,125,196,160,149, 36, 33, 17,251, 35, 40,197,
- 98,248,114, 54, 24, 75,106, 21,135, 78, 72, 84, 99, 92, 84,178,  4, 50, 62, 54,147, 73,103,106,157,179,139, 75,134,170,236, 67,
-160, 23,103,238,186,113, 51,136,139,206, 38,168,131,206,201,107,237,255,155,130,180, 46,144,133,218,152,242,234, 54,181,234,123,
- 20,245, 16,  7,161, 14, 35,116,123, 88, 37, 40,163,249,218, 67,  7,169,186,  7, 93,  9,193,199,103,121, 36,116,238,128, 12, 30,
-203, 68,157,  5, 20,170, 84,  9,147, 82, 20,148, 80,149,197,196,196,118, 30,213, 88,202, 89,109,204, 19, 47, 71, 11,113,121,170,
-243,145,110,181,187,116, 20,116, 55, 90, 73,142, 98, 51,113,151,132,  6,231,150,135,  2, 95,186,180,113,207,111,190,  1,207,244,
- 72, 58, 71, 86,  1, 89,  9,146,132,163,183,149,244, 96, 36,105,229,162, 51,208,153,168, 29,236,197, 89, 50,102, 43,174,108, 71,
-187, 95, 31, 21, 88,253,137,155,132,223,122,  3,222,202,232,107, 91,234,107,174, 50,201,198,110,151,151, 87,112,179, 35,254,171,
-103,240, 51, 80,191,180,131,175,102,116,173,240,114,111,202,238,231, 18,114, 21,169,159,222,193, 42,209,255,190, 35, 86, 63, 80,
-216,239, 21, 93, 51,141, 74,143,  3,156,127, 44, 34, 79,  7,248,197,193,172,110,191,255, 12,118, 22,201, 74, 16,228,102,178,209,
-255,109,133,243,155, 16, 62,100, 93,120,184,  9,225,169, 39,187,244,122,  1,187, 63, 13, 15,190,108,190,232, 22, 26, 81,253, 96,
- 31,130, 57, 10,190,224,  5, 73,  4, 62,126,  4,223,116,  2, 55, 79, 92,184, 56,194,171, 87,212,127,252,144,252, 19, 23,148,247,
-246, 20, 10,122, 44, 12,207, 89, 23,180, 27,224,170,  8, 67, 54, 81, 98, 46, 77, 79,161,211,152, 76,174,145,226, 68,231,239,221,
-193,223,135, 89, 43,201, 98, 52, 27,212, 86, 81,210, 71,226, 81, 34,220,233,168,247,178, 21,168,209, 44,161,166, 65, 83,116,112,
-193,165,135,233, 72,115,123,104,157,226, 81, 29,131,232, 24, 66, 87,217,150,132,230,136, 60,243, 24, 78, 71,123,237,106, 28, 51,
- 83, 71, 61,111, 35,249,240,146, 11,220,178,145,233, 16,251, 44,186,151,252,240,222, 64,189, 15,225,212, 14,113,241,  3,189,238,
- 97,255,147,112,249, 23,209, 87,239,194,223,233,208, 95,175,148, 71, 27,246,101,207, 59,125,224,113, 49, 81, 90, 87,175,225,114,
-181,137,184, 28,208, 82, 57,200,179,182,173,196, 98,188,216, 68,117,141, 75, 46,193, 18,186,130,143, 73,115,165, 76,119,199, 98,
-252, 12, 17, 74,  8, 83, 20,166,196,142, 81,173, 64, 75,177,253,206, 74, 47,144,162, 48,146,168, 90, 25,198,226,147,130,106,102,
-219, 73,143, 36,104,148,137,120,214,196, 82,234,  2, 91, 59,204,108,175,153,105,163,247, 67,251,211,212, 37,234,236,  5,111,112,
-175,176,112, 39,142, 13,156, 35, 70,136, 11,170,142,180,181,217,136,184,112,175,168,146,107,246,149,103, 90,246,155,214, 43,235,
-204,254, 40,205,119,221, 60,245,142, 63,181, 32, 23, 83,  2,152,191, 59, 80, 67,128,146,231,  0,173, 32,  7, 81,179,211, 89,182,
-152,248, 79, 13,133,180,199,156,191, 43,213,133,216, 77,119, 21, 38, 40, 76,164,138,237,207,171,251,193, 39,128, 14,115, 74,153,
- 46,166, 16, 19,112,198, 47,154,170,117, 18, 43,206,135,185, 28, 60, 47,185, 22, 19, 87, 93,144,221,180,  3,246,124,226, 12, 25,
-107, 98, 72,173,211,107, 21,157,  3, 89, 38,157,153,179,118, 67, 48,103, 69,234,122, 98, 50,129,156,113,209,195,204,207,247, 21,
-128,230,106,159, 69,206, 72,201,147,126, 99,186, 40, 22,232,220,131, 59, 77,173,132, 24, 38, 66,107,173, 94,120,186,142, 64,244,
-152,152, 18,117,216,147, 82,  3,184,172, 86,200,214, 56,198,213,241,129,181, 56,131, 41,  4,106,173, 36, 42, 42,129, 18, 18,140,
-197,184,234,178,172, 13,235,116,200, 23,183,122, 13, 26, 72,216,126,221,186,203, 74, 10,209, 88,187, 62, 22,210,108, 35,159,118,
-129,183, 40,195, 57,185,196,165, 26,165,221, 49, 77,113,152,125, 60, 46,126,217,170,102, 24,118,232,234, 24, 66, 79, 25,242,132,
- 45, 52,171,157,  3,105,220,207, 30,125,  7, 84,149,201,167,217, 10, 13, 27,171, 23,215,222, 69,255,146,251,151, 99,106,206,108,
- 95,167,193,178,145,199,  4, 93,173,132,199,158,  6, 20, 65,119,131,141,184,143, 76,157,104, 82,122,236,228,243, 73,166,  4, 80,
- 87,236, 75,172,240,203,143,208,199, 35,242,157,231, 70,112,147, 35,100,  5, 97,149, 44, 73,236,141, 13, 79,221,223,147,174, 70,
- 86, 21,182,193,190,240,187, 98,194,190, 16,117,  2,101,108, 54, 74, 60, 75,132, 23,123,248,218,158,242,115, 27,234,171, 91,234,
-222,118, 80,225,220,158, 83,120,184, 34,252,166, 99, 56, 10,132,223,113,138,124,234,  4,253,245, 45,250, 83, 87,232,175, 15,240,
-116,178,  3,231, 27, 87,132,123, 10, 63,159,145,127,173,231,248,183,174, 24,126, 97,203,110, 29,136,  1,214, 43,225,164,171,232,
-166,194, 47,110,145,231,142,144,239, 89,193,195, 66,109,201,110, 27, 69,198,140, 60,  4,121, 74, 29,170,178,247, 89,245,167,230,
- 15,125,146,219,142,144,255, 11,244,205,159, 65,127,254, 41,216, 95,193, 75,  9,249,200,218, 90,192,161, 82, 63,243, 24,253,145,
- 75,228,155, 59,228,119,156,193, 51,189, 21, 13,162,240,254, 99,120,235,138,250,163, 15, 25,254,209, 35,198,253,200,120,164,212,
- 27,198,197, 47, 62, 97,106, 19, 15,116,206,176,143,190, 82,104, 73, 84, 50,225,141,231, 52,168, 70,172,122, 18, 11, 59, 31,232,
- 77, 15, 39, 56,211, 32, 89,101,159,190,235,196, 24,  0, 63,125,105, 75,248,149,218,  3,150,122,200,239,144, 15,192,128,204,200,
-197, 89,208, 94, 22, 23,233, 94,209,171,132,172, 55,144,238, 67, 93,249, 29,246,129, 29,210,113,109, 22,184,240, 28,112,195, 85,
-244,209,160,  2,229,211, 80,223,128,240,113,  8, 31,118,209, 98,111,  7,123,125,  7,182,127, 17,222,255, 41,248,172,194,223,238,
- 41,239, 12, 84,221, 83,135,145,247, 84,120, 80, 12,204, 20, 38,244,154, 78, 55,218,162, 51,155,187,202,161,227,174, 69,151,  4,
- 87, 92,151,  3,221,190,225, 84,107,181,158,180,180,213, 71,227, 40,199, 64,223,117,212,216,145,165, 30,120,248, 99, 16, 84,122,
-118, 73,145,154,161, 20,  6,133, 53, 66,167,176,209,226, 26,154,138,113, 41, 27, 62,180,250,152,211,198,199,227,242,  0,209,150,
-222,216,196,124,206,218,104,236,240, 41,172,190,241, 54, 60, 75,162, 69,167, 10,  7,  8,214, 54,114,173, 30,117, 59,205, 45,170,
- 31,136,106, 26,158, 70, 36,203,126, 31, 99,234,148,195,100,223,106,241,172, 58,  1,117,234,244, 24,149,153, 86,215, 16,185, 85,
-109, 20, 47,238,215,174, 33, 24,154, 82, 14,125,246,211, 52, 64,229,112,188,189,236,128,213, 58,178,160, 97, 66,133, 79,238, 40,
-153, 81,174,109, 74, 81,180, 26, 55, 96,194,204,206,241,163,117,242,207,207,128,247,150,174,215,212,231,162, 79, 82, 24,194, 18,
-157, 35,215, 88,246,117,246,228, 91,164,184, 77, 52, 74, 91, 85,120,192,205, 65, 17, 26, 22,253,125, 43,102,166,244,210, 72,234,
-123,186,174,119, 49,184, 18, 98, 71, 70,168,227,222, 14, 95,127, 14, 99,173,228, 60, 82,134,189,185,184, 66,242,247,184,248, 22,
-120,214,115, 89,140, 74,123,205, 97,242,185,183,198,146, 20,209,156, 41,165,178,221, 94,145, 67, 96, 63, 12,164, 20, 59,111,241,
-213,186,219,106,177,163,141,117,156,146,  1, 28, 98,176, 14, 66, 99, 68,170,197,217,213, 54,162,152, 30, 37,216, 27, 28,231, 10,
-174,138,121, 32,155, 80,200,130, 94, 44,231,188,186,221, 65,163,  3,245, 75,157, 50,117, 39,133,102,157,191, 64,211, 93,209,237,
- 46, 89,231,184,213,218, 72, 45,227,136,110, 47,225,252, 54,116, 61,100,131,229,215, 92,201, 49,146,212,137, 83, 65, 39,157,187,
-150, 58,101,210,106,177,113, 75,117,197,163, 42,196, 46,162,163,117, 51, 86, 95,206,233,110,197, 59,175,236, 35,251,146,188,170,
-186, 28,124,122,227,126,255, 65,141,202,214, 88,179,155,106,255,174,130, 30, 69,219,191,203, 96, 35,172, 46, 33, 95,188, 68,223,
- 31,144,239,189,  1,183,122,171,218,215,230, 51,231, 40, 17,222,220,112,254,254,150,245, 85,102,179,169, 36,179,148, 51,250, 55,
-180, 97, 52,143, 69,233, 95, 76, 48,  8,250,238, 72,189, 59, 80,182,153,242,104,160,236, 43,188,  5, 41,  6,210, 88,208,167, 42,
- 18, 58,164,235,144,103, 34,225,251,158, 34,124,104,133,254,245,  7,232,207,239,145, 99, 75,253,138,223,217, 67,237,209, 87, 71,
-194, 55,175,184,241, 78,134,119, 10,199, 47,219,106,100,247,  0,106, 81,228,161,114,186, 26,205, 74,182,142, 86,133,237, 44,204,
- 69, 87,126,210,237, 18, 50,220,133,245,175, 64,252,148, 29, 46,  7, 55,138, 45,228,255, 26,238,253,159,240,206, 29,  8, 17,253,
-226,  6,126, 13,228,247, 43,188,176, 66,223, 25,224, 65, 65,254,189,115,228,165, 35,187,216,135, 17,253,220, 35,244, 11, 27,244,
-231,183,232,227,129,124, 57,176, 61, 86,118,119,132, 18, 13, 35, 28, 93,184,217,186,197, 36,126, 67, 13, 66,245, 21, 75,194,166,
-219,105,113,107,  8,213,133,155, 81,231,200,202,131, 96,137,197, 89,219, 20,242, 78, 86,164, 11, 72,242, 17,234,231,183,  6, 24,
-106, 15, 62,122,135,144,117, 78, 71,235, 13,156, 68,100,202, 61,111, 48, 37,250, 86, 40, 70, 88,123,194,220, 58,192, 13,129,155,
-138,156, 84, 72,199,190, 15, 31, 93,252,182,130,248, 60,196,143,184,138, 29,251,247,186,247,101,254,235,160,239, 64,248, 46,  8,
- 47,248,201,220,217, 62,189,252,125,120,240, 23,224,213,247,224, 31, 28,161, 63, 87, 40,247, 47,201, 12, 16,225, 74, 42, 27, 17,
-122,175,100, 10,106,156,139, 50,231, 23,132,133,204,110,178,194,251,141, 50, 46,118,181,130,121,131,181,250,132,162,141,140, 29,
-253, 42,205, 99,238,225, 43, 72, 36, 83,205,226, 26, 93,240, 80,237,251,152,213, 52, 29,251, 34, 28, 33,244, 65, 24, 71, 43,202,
- 59,143,131, 78, 10,217,105,150,118,178,130,134,234,158,103,123,156,224, 66, 39, 60,189, 18,  9,212, 58, 31, 32, 19,208,117,154,
-234,232,188,187,157,176,172, 58,105,121,116, 17,200, 52,  1,165, 60,123,155,150,139,238,247,196,222,239,153,123,135,158, 36,148,
- 85,  8, 38, 82, 93, 36,142,225, 65, 38,202, 50,  3,124, 81, 28,  9,  7, 33, 46,147, 31,218,237,149,145, 22,121,141,211,206,230,
- 63, 39, 58,239,150,155,186,125, 74, 86,211,217, 15, 97,112, 26, 83,124,183, 69, 90,157, 86, 17, 76, 35,166,230,181,111,106,248,
-166, 15,154, 18,206,196, 83, 60, 23, 95, 48,245,184,213,170,242,129, 96, 27, 89,144,255,166,195,119,  9,196,241,209,188, 44,  2,
-105, 74, 45,102,  9,212,185,234,156,106, 50,239,236,  9,130,106, 88, 92,180,243,234, 97,154, 34, 85, 53, 42,107, 12,204,177, 34,
- 58,177,218,171, 86,234, 56,160,197, 10,181,144,226, 20, 26,163,186,180,142,250,160,192,195,196, 66,180,230,187,122,113, 28, 36,
- 26,136,199, 63,151,113,204,236, 31, 61,162,106, 37,133,245, 17, 73, 34, 82, 50,101, 40, 86, 37,165, 96,254,237,104,  4, 31,138,
-120, 60,106, 68, 37, 34, 82, 92,153,222,217, 94,203, 69, 64, 97,162,192, 57,213, 73,109,247, 93,  5,118, 85,  8, 42,244,209, 76,
- 28, 34,145,168,193,  4,  2,190,139, 41,193, 71,253, 50,239,154,236, 12,143, 19,127, 94, 91, 23,189,192, 57,106,219,211,212,130,
-146,209, 97,131, 12, 71,196,245,154,186,223, 88,112, 72,187,216,171, 17,228,168,205, 63, 25, 27, 56,221,110, 28,174, 19,  8, 14,
-147,146,166,156, 12,  2, 53, 17, 53, 19,220,151, 27,131,117,233, 19, 39,190,141,140,  4,106,118,191,161,231,212,139,131,119, 44,
- 30, 15, 24, 10,186,115, 11,156, 67,189,216,153,168, 79,131,143, 97,223, 82,244,199,222, 71,190,247, 28, 62,180,182,223,179, 62,
- 37,156,119,200,121, 71,120,167, 35,222,221,177,186,187,101,253,190,169,100,183, 29,228, 44,148,193,178,175,207,179, 18,146,193,
- 31,180,250,234, 98, 13,108,148, 77,134,161,135,117,174,156,189,177,183,130,225,134, 34,231,106,153,231,177, 67, 62,245, 52,116,
-145,252,191,221, 71, 63, 55, 32, 47, 20,248,214, 53, 60,219, 35,143, 20,121, 92,  8,223,220,115,246,238,142,205,219,202, 24,141,
- 91,  0,214,  8,174,223, 43,196, 95,218,192, 55,120,138,155,122,235,219,251,183,248,235,247,225,165, 45,220,124,121,113,160,183,
-255,189, 11,143,126, 47,250,107,175,195,163, 59,104,238,225,217,130,252,174, 53, 60,  2,189, 28,225, 45,247,125,127,247, 49,218,
- 43,245,253, 45,124,246,146,250, 75, 87,212,207, 95, 81,114, 65,215,166,252,223, 63,  5, 67,177,195,188, 22, 79,  5,140,246,249,
- 44,181,220,173, 99, 10,206, 16,138,101,246,212, 78,117,165,216,181, 30,220,130,213,156, 78, 97,177, 71,159,226, 62,197,214,212,
-161, 11,200, 73, 64, 86,173,184, 83,202,206, 15,160,233, 64,159,184,200,118,129, 37,207,183, 79,214,221,131, 32,235,232,225,  8,
-  1,142,146, 77,125, 78, 35, 28,  3, 55,  4, 57, 83, 56, 21, 88, 29,217, 11, 79,183,236,195,232,111,154,205,173,255,152,113,218,
- 57,245,  7,219, 45,138,168,106,214,192,248,145,197,171,233, 64,239,195,240, 87,224,241,223,129, 71, 61,124,246, 57,248,177,251,
-148,225,130,139, 50,146, 83,165, 11,194, 85,181, 55,232,200,183, 79,251,114, 56, 60, 96,138, 71,101,130,184,168, 23,230,178, 56,
- 56,166,184, 73, 13,196, 24, 45,118,213,  3, 84,130, 31,246, 34,129, 46, 68,136,137,189,239, 50,181,206,  4, 58,123, 45,205,141,
- 34,148, 97,100, 19,224,184, 15,172,251,142, 34,133,172,133,149, 42,125,234,216,102, 83,194,219, 87,221,233,147,174,249,105, 54,
-174, 66, 99,168,227,205,  4, 51,231,162,221,228, 61,134, 90,117, 30,  5,215, 41, 52,196, 44,104, 85,213, 59, 67, 31, 84, 47, 98,
- 83,179,119,167,145,246, 62, 68,178, 39, 97,118, 46, 18, 30,171, 34,165,208,123,183, 57,122,217,179,220,173, 87, 14, 19,185,194,
-193,129,207,  4,227, 82, 14, 61,218,226,186, 77,117, 59,224,148,131,206,161,248, 76, 88,118,146,203,213,138, 29,215,185, 90,166,
- 69, 84, 87,170, 95,147, 23,182,169,193,116,152, 45, 60,255, 45,144, 85,150,113,109,141,132,215, 20,234, 11,  1, 31, 83, 97, 40,
-147,198,225,218,208,108,154,194, 46, 48,250, 11,144,216, 34,179, 67, 23,133,166, 78,193,163,243,195,180,157,182,200,140, 43,111,
-239,163,235, 27,198, 90, 25,114, 70,179,175, 49, 66, 56, 76,152,243,224, 32, 98, 68,115, 49,161,234,193,194, 64,124, 13,189,120,
-237,237,222, 83,235, 36,142,211,206,184, 22,101,204, 30, 61,174,164,213,241,  9,186,189, 66,179,  7, 10,  6,191,168,170,219, 78,
-166, 91,147,221,217, 74,173,232, 88, 38,104, 12, 33, 32,181, 26,115, 69,131,193, 94,124, 76,144,164, 41, 59,133, 93, 49, 59,217,
-105, 80, 86,238,225, 84,196,246, 15, 98, 34,138,152,140, 24,167, 11,196,160, 86,183, 72,136, 39,224, 76, 41,102,117, 38, 55,233,
-194,154, 80,179, 65,102, 54, 87,132,227, 99,143, 83,181, 74,168, 22,179, 60,164,201, 59, 99,193,  6, 85,198,137,241,107,182, 59,
-199,220, 98, 17,136, 97,204, 62, 94, 51,156,100, 40, 77,188,  3, 71, 94,117, 71,247,139, 51,248, 23,187,200,196,218, 22, 92, 97,
- 37,  9, 57, 78,230, 55,219,169,101,176, 55, 37,180, 10,172, 34,122,229,169, 88,158,217,203,152,209, 31,122, 96, 35,229, 79, 30,
- 91,152, 74,232,224,230, 41,225, 78,143,124,245, 10,237, 18,221,217,192,201,253,145,171,135, 35,195, 94, 73, 43,161,127,161, 35,
- 92, 65, 60,239, 77,160,246,110,153,124, 67,233,169,192,106, 95,216,  1, 67,103,112,139,248,245, 61, 50,122, 91,121,222, 89,  2,
-218, 94,224, 83,183,  9,111, 12,232, 63,124,136, 94,140,212, 55,  6,194, 55,245,240,114,  7, 87,  2,151,145,213, 11,  9,121,144,
- 25, 70,216,111,236, 61,232,147,216,254,114,155, 33, 20,180, 75,150,226,117,100,221,147,254,210,125,228,119,141,112,231, 71, 64,
- 62,230, 95,231,  2, 92, 65,253, 73,120,244,159, 81,255,222, 61,244, 87,206,224,163, 32, 71, 14,188, 81,191,229,  5,177,160,132,
-168,232,151,175,208,127,190, 67, 63,125, 69,253,250,158,172,149,253, 49,228, 83,161,246,126, 30,148, 25, 96, 17,188,190,136,  1,
-186, 84,173, 35, 84,123,235,139,206,169,171,147,216,181, 66,  8, 11,210,161,219,  7,251,100,162, 80,170,219,214,220,131, 27,162,
-185, 52,162,143,140,195, 81, 64,250, 72, 88,205,211, 44, 13, 62,150,109,126, 46, 89, 94,151,157,237,221, 99, 64, 66,180,239, 97,
-114,241,215, 73,103,234,247,211,  8,103,201,186,242, 27,138,156,  0,235, 35, 72,103,166, 77,144, 51,243,153,167, 59,144,158,131,
-245,135, 76,  5, 79,  0,125,108,246, 54, 81, 59,248, 57, 95, 20, 83, 14,162,105, 98,184,225,215, 96,243,231,224,237, 47,192,120,
- 11, 62,249, 73,120,248, 14,250, 63,189,205,101, 44,188,151, 44,161,172, 43,202,174,161,226,125,147,144, 69,200, 69, 15,184, 55,
-115,  7,211, 50, 31,116,194,216,212, 41,  0, 67,124, 59, 14, 65,170, 89,191,  8,196,100, 83,195,210,226,152,221,121,209,  2, 87,
-138,183, 87,181,180, 67, 66,167, 81,116,136,145, 81,148, 44,182,211,237, 98,162,184, 37, 53,185, 79, 61, 54,215,  2, 66,141,201,
- 83,207,124, 52, 91,171,169,224,253,167,230,101, 60,137, 28,118,235, 65,130,143,185,231, 40,147, 38, 62,171,126, 48,239,171,122,
-  6,187,122, 34,152, 28,168,218,167,219,131,107,101,178, 90,119,110, 93, 95,157,126, 22, 46, 98,230,218, 39,200, 98,245,211,108,
-175,109, 47,222, 92,  7, 34, 76, 74,247, 54, 54,168, 54, 82, 93,104,159,154,208, 78,184,182,158,158, 15,201,133,146,159,105, 74,
-128, 35,198, 93,189,238,135,110,  8,243, 61, 92, 39,106,155,167,116,186,247,218,104,110,243,251, 49,  5,186,136,240, 27,129,103,
-101,202, 65,208,  3,235,153,180,201,192,162,112,106,235, 52,245, 85,  7, 77, 27,225,110,149,133,202,117, 46,104,244, 80, 92,215,
-188,255, 33, 70, 27,187,187,123,160,164, 72, 25, 51,227, 56, 82,115,182,255, 86, 50, 99,206,118,128, 79, 79,172,165,144,150,249,
-249, 74,120, 34,158,182, 58, 69, 44,196,100, 76, 17,181,213,120,208,138, 44,180,  0, 37,103,219,169,215, 16, 32,143, 84,  7,181,
-104, 72,211,158,202,200, 69, 62,250, 86,235, 94,165, 24, 11, 87,  9, 14,173,113,177,128,122,118,172,218,191,139,  2,201,131,  5,
-134, 10,151,106, 30,203, 49, 11,103,181,114,220, 85, 58, 23,178,168, 86, 98, 52,251, 66,116,158,123, 45,150,201,158, 21, 36,216,
-  7, 92,171,179,158,235, 60,158, 16,175,226,202, 34,115, 92, 90, 84,217,110,103,245,158, 68,  6,132, 84, 44,220, 64,156,158, 38,
- 30,213, 18,180,237,173,156,192, 68,  0, 49,117,126,168,115,110,124,213, 66,209, 98,227,247,160,116, 10,171,160,164,150,149, 92,
- 43,177,120,142,118,182,238, 42,164,  0,103,  9, 89,247,200, 89, 79,184,213,219, 73,242,200, 15,216,206,191,182, 33, 66, 18,164,
-207, 86, 16, 36,133, 99,144,236,111,200, 23,247,246,154,190,249,196,232,105,157,125,192,210, 41,242,237,103,240,172, 16,254,242,
-187,156,111,182,212,111,239,144,111,137,112, 30,208,183, 33,156,247,200,211, 43, 27,251,190, 57, 34,111, 14,240,116,199,209, 83,
- 80,238,154, 85,102, 92, 65,218, 42,221,151,118,132, 43,129,103, 87, 30,107, 84,225,228,148,240, 61,167,148, 31,127,159,225, 94,
-102,  4,250,183,  6, 86,159,236,145,111, 95,193,135, 35,220, 57,162,191,165,244,247, 10, 71,239,142, 48, 40,225, 56, 33, 47,184,
-  5, 43, 86,194,169,199, 27,254,244, 30,254,233, 37,225, 63,137,200,239,249, 25,139,232,212,183,160,252,143,112,241,195,176,191,
-132, 55, 31, 81, 95, 59, 66,223,191,141,202,  0, 95,221,216,238, 57, 26, 61,150,155, 25,221, 43,250,245,130,126,102,143,190,177,
-  7, 45,232, 80, 24,110, 91,248,205, 85, 17,  6,231,166,148,169,203, 54, 81, 37,165,241,188,253, 35,192, 10,186, 58, 90, 45,213,
- 71, 87,189, 86,216, 50, 31,214, 49,120,135,239, 81,183, 93,139,237,141, 11,158, 67,243,173,  7, 63,216,215, 17, 57,142, 72, 10,
-150,111, 30,197,161, 29, 77,  5, 38, 83, 28,174,  4,239,196,171,255,254, 46,152, 83,226,168,141,215,163,225,112,111, 36, 11,230,
-185, 89,145,227,206,186,112,185,227,201,109,167, 86,248,201,202,118,231, 97,109, 95,152,253,219,144,191,104,246,191,238,196,120,
-239,241,195, 24,132, 64,175,233,  1,142,237, 34,222,254, 67,184,252,139,112,247, 61,248,251,103,240,106,129,151,127, 21,126,242,
- 33,251,163,145,141, 10,161,216,186,103,159, 29, 81,188,192,133, 73,157, 53, 64,149,  3,151, 25,193, 15,152, 16, 26, 81,140,105,
-181,213, 66,149,113, 59,109,139, 16,213, 24,168, 14,165,114,123,243,116,191,202, 42,140,213,116, 52,105, 33,178,147, 48,231,190,
-103,132,  1,101,237,196,185,145, 96,156,  1,129,148, 28, 93, 45, 70,147,179, 78, 35,206,168,212,169,251,151,233,218, 97, 81,140,
-232,162,167, 93, 56,162,167,169, 99, 11,129,106, 74,119, 93,140,127,171,205,250, 29, 84,237, 13, 99, 75,100, 19, 35,206, 53, 38,
-134, 53, 40,149,229, 64, 90,150,121, 26, 11,205, 66, 83,113,215,101, 51,218, 16,178,110, 49,107,216, 85,213, 37, 36,102,142, 85,
- 21,117,209,180,204, 14,165, 89,229,160,211,  6,246, 58,102,118, 58, 99,219,136, 58,196, 41, 30,183,141,155,117, 10,192,209, 73,
-151, 34,110, 13,107,153,241,217,223, 12,113,168,153,203,  0,103, 24, 16, 51,235,126,122,253,122,189,250,144, 39,116, 27,211,140,
-125,249,201,181,169,192,245,156,214,169,188, 10,215, 52,  4, 78,114, 11,134, 33,111,159, 75, 46,133, 60,142,144, 51, 37,  6,242,
- 80,125,170, 45,211, 25, 37, 49,249,103,173, 31,152,204,176, 84,232,171,182, 41,114,227,196, 87,234,110,231,127,222,194,102,106,
-206,214, 96,151,171, 43, 34, 80,134,189, 85,167,109, 23, 24, 45,103,120,168,130, 72, 66,130, 82, 69,209,209,222,224, 16,150, 11,
-177, 64,168, 38,143, 75, 33,210,  7,165,147, 74,114, 17,218, 14, 97, 32, 80, 37,240,184,140,140,217,110,106,103,189,154,162, 47,
- 87,131, 86, 77,193,  8,139, 16,248, 86, 14, 21,157,  2, 21,108,121,163,147, 14,198,200, 64, 50,121, 12,147,102,235,216, 71, 69,
- 71, 47, 86,154,154,180,120,209,182,234,  8, 65, 72, 37,179,119, 37, 97,237, 92, 27,226, 31,125,169,133, 36, 74, 23,231,125, 79,
- 42,150, 96,154,  4, 86,162, 28, 85,123,157, 93,  7,233,104,109,157,184, 84, 24,253,210,139, 17,233, 59,194,113,135,220, 94,193,
-211, 61,220,116, 96,198, 17,112,190,114, 82,140,211, 74,210, 76,194,146,222,239,130, 21, 83, 39,143,126,154,172, 86,112,162,112,
- 30,108, 79,159, 43,124,105, 15,223,120, 78,248,195,183,  8, 73,169,191,112, 65,249,185, 29,114, 59, 33,191,169,135, 59, 61,236,
- 32,172,123,232, 71,116, 45,196, 79, 68,206,227, 72,125, 63, 83, 51,232,168,112,165,132,103, 10, 60,151,204,219, 93, 48,218, 92,
- 16,234,174, 50,174, 97, 60,134,237, 80,233,126,105,207,234, 11, 35,171, 23, 35,225,153, 72, 40, 86, 69,134,103, 18,108, 10,114,
- 81,208, 87, 43,250,213, 10,239, 85,194, 43, 91,120,170,135, 31,187, 36,252, 91, 71,200, 31,251, 69,  8, 47,  3,159,135,171, 63,
-  3,175,125, 22,174,214,112,117,130,126,253,182, 17,212, 62, 86,224,215,246,102,200, 47,198,170,215, 17,244,211, 25,125, 59, 79,
- 86, 16,206, 93,224, 56, 42, 57, 43, 67,129,161, 10,251,106, 10,246,216,108,103,136,173,161,219,247,182, 65, 95, 80,198, 97,206,
-166,206,121, 70, 34,247,190,102,235,130,155, 59,163, 76,171,236,118,208, 55,  2, 99,240,206, 60, 85,136, 71,226,233,120,177, 45,
-235,231,  4,176,150, 12,213,130, 45,130,229,204,227, 35,122,186, 56, 31,230,199,190, 39, 63,241,148,189,227,  0,103,  1, 57, 77,
- 54, 90, 15, 47, 66,184,227, 29,119, 48,235,153, 14,160, 15, 77, 20,167, 91,211, 38,232,  8,113,231,123,248,223,  6,225,121,195,
-234, 82,175, 29,232,103, 70,151,219,252,  8, 92,254, 85,120,253, 33,252,196, 26,253,149, 29,188,183,163,252,220, 72, 62, 42,108,
-162, 82,139, 77, 48,182,197, 14,244,206,117, 90,131,241,115, 60, 35,188,137,102, 27, 22,148, 73,196,  5,134,156, 22,119, 17,132,
- 96,123,100,170,131,155,238,211,161,  0,  0, 32,  0, 73, 68, 65, 84, 64,162,141, 83, 99, 20, 74, 13,211,  1, 32,110,239, 82, 31,
- 25,183,  3, 52,250, 77, 62,133,214, 65, 51,219,145,252, 16, 41, 85, 61,167, 69,201,181, 48,168,208,  5, 33,117, 29,195, 62,219,
-222, 59,248,190,179,206, 24,214,134,146, 86,149,169,145, 99,146,191,233, 34,203,125,217,214,233,148, 92, 86, 23, 89,218, 58, 69,
-212,203, 19, 19,226,218,124,251,202,193,161,215,242,219,155,128,108, 57, 25, 72,162,140, 42, 19,244,165, 49,224,218,204,165, 89,
-196,240,206,183,137,249,106,117, 13,194,188, 61,246,131, 59, 76, 66,191,233, 39, 42,215,152,103, 76,107,137,235,147,238,230,  4,
-104,192,176,105,182,208,136,156,122,216,250,198,107,195,231, 40,  1,124, 29, 43, 83,244,173, 16,157, 35,175,147,150, 74, 38,106,
- 30,215,222,247, 67,233,187, 30, 88,197,130, 44,156, 17,238, 94,208,  3,164,203, 82,137, 62,199,243,204,187,125, 47,112, 66, 32,
-197,  8, 41,146,139,149,162, 20, 15,134,114,  7, 65, 85,165, 14,123,  7, 75, 89, 19, 27, 16, 72,105, 70,251,202,147,150,185, 58,
-137,242,100,222,253, 23, 75, 20,109,137,164, 90,236,139,214,108,115,150,149, 48,108,  8, 88, 43,175, 97, 49,191,143,193,176,162,
- 68,232, 19,253, 88, 24,181, 46,170, 47,231, 39, 43, 22,192, 42,133, 24,132, 30,101,133,135, 37, 68,171, 94, 70, 21,207, 50,182,
- 96,149, 29,133, 71, 85,144, 26, 56,150, 66,172,206,203,245,177,199, 18,141, 23,189, 34,158,173,158,179, 88, 78,252,102, 91,180,
-117,  0, 58,  5,179,212,113, 68, 58, 87,212,215, 98, 69,135,180,189,164, 95,196,238,151,213,226,226,151,209,146,233,218, 27, 29,
-155,213,164, 42, 41, 84,122, 79,216, 89,229,194,170, 22,142,214,145,208,175,144, 62, 34, 39,157, 47, 18,131,135,198,  8,114, 35,
- 34, 31,238,145,143,218, 14,154,147, 14, 57,238, 97, 45, 77,160,234,207, 35, 88,132,101,219,  1, 54, 16, 72, 12,254,247,213,246,
-154,102,206,132,205,222,198,175,201,199,252,247,  7,120, 54,193,119, 61, 11, 99,134, 47,220, 71, 63,159, 77,124,119,183,160,191,
-186, 71,190,123,109, 29,224, 71,143,136,157, 93, 12,102, 87,235,136, 31,170,200,251, 25,222,203,132,167, 35,242, 45,107,116, 23,
-224, 67,182, 38,208, 55, 46,237,231, 70,227, 55, 23, 49,152,199,246,168, 18,179, 34, 95,206,244, 95,177,241,115,106, 14, 89,129,
- 85,179,125,136,216, 77,246, 11, 35,250,222, 64,248,115, 79, 33,127,252,103,129,167,129, 31,128, 87,255, 43,248,220, 37,244, 47,
- 66,159, 44,251,124,191, 71,190,190, 71,191,184,135,127,190, 67,206, 61,254,187,171,232,215,246,148, 77, 38,244, 98,182,185,211,
- 96,231,216,227, 98,167,117,117,173,217,168,236,139,117,116, 37,205,234,172,208, 34,  2,188, 30, 24,124,250,211,196,114, 45, 94,
-184,237,197, 59,177,115, 80,130,144,130,176,118,125, 90,195, 93,  6,207,155,  9,170,196,206, 22, 86,210,  7,130,195,133, 32,248,
- 90, 71, 17, 49,163,123,  8, 29,114,228,122,149,147,104,127,127, 28,237, 16, 95,118,230,235,100,191,246,254, 36, 82,132, 35,207,
-109,145,115,144,167, 45, 43,157,  0,122,215, 44,104,229, 93, 35,236,141,123,179,158,  9, 70, 29,234,206, 29, 88,243, 10,116,159,
-130,240,177,165,100,205,111, 92, 39,230,131,188,252,126,184,250,187,232,219, 27,248,241, 21,245, 51,151,212,171, 29,101, 28, 25,
-206, 96, 95,117,234,204,  7,204,194,154,125,234,209,182,180,  3,230,187,214,121, 51, 63,127,125,151, 93, 73, 85, 71,116, 54,157,
-210,116,131,177, 34, 92, 22,126,104,177, 79,133,224, 98, 50, 79,121,100, 49, 30,174, 46, 20,109,123,226,168,129, 18,116,138, 11,
-221,187,106,189, 96,130,224, 65,173,169, 72, 65,144,148,108, 69, 71,240,192, 24,235,142,100, 33,222, 42,  7,254,109,249, 13,204,
-207,135, 29,151, 52,250, 91, 59,168,219,222,240,  3,216,233, 19,203,125,250,213, 10,145,166,  4, 87, 79,245,106,247, 67, 93,184,
-113,116,214,185, 79, 63,190,177, 63,196,225, 44,142,120,153, 49,165, 28,250,184,229,122,152, 75, 19,184, 29, 72,238,158, 92, 87,
-135,246,126,136,175,168,130,184,206,170,229,189,215,137,229,160,  7, 73,237,135, 23, 68, 59,135,163, 55,117, 65,227, 68, 26,204,
- 45, 65,109, 49,234,111, 34, 23, 93, 76, 10,130,  3, 44, 89, 20, 36, 83, 16, 77, 43, 54,124, 69, 98,133,210,252,103,117, 17, 46,
-131, 28, 34,129,151,239, 82, 16,211, 10,196,190,183,207, 40, 23,186, 46, 77,175,173,113,254,107,201, 76, 80, 22, 92,135,147,108,
-106, 81,115, 93, 88,216,150, 27,141,230,168,104,246, 88,243,168, 87, 85,231, 51,148,195, 93,192,226,127,169,147, 64,221,109, 64,
-173, 43, 13, 25, 74,159,108, 20, 93, 70,250,213, 26, 77,  9,169,153, 16,162,209,217, 16,247,202,154,242,155,104, 57,234, 17,179,
-137,105,157, 43,194,170,129, 82,125,119, 62, 85,169,194, 88,  3, 23,163,237,195,142,129, 35,153, 25,241, 56, 74, 82, 83,176,189,
-243,193, 84,199, 15, 99, 17, 23,154, 96,143, 97,206, 77,243, 62, 86,  8, 20,116,  8, 83,158,123,208,106, 86, 22, 77,118, 65,228,
-108,157,145,152,167,187,226,226, 19, 45, 19, 23, 56,106,229, 40, 20, 86, 10,235, 82, 89, 69,219,159,166,  8,225,244, 24,185,177,
-134,216, 25,187,247,118,130, 91, 43,228, 27, 18,242, 98,111,232,170,179,118,247,247, 86,193, 99, 35,101,111,109,160,142, 62,163,
- 44,121,142,241,139, 97,170,215, 37,233, 34,218, 40, 79,156, 95,146,251,145,239,123, 23,255, 77,231, 70, 21,123,123,  3,111,109,
-225,205,108,135,202, 55,174,224,202,231,199,167,  9,158, 62, 65, 62, 60,192, 93,179,152, 73, 86,244, 42, 19,200,  6,250,120,144,
-237,241, 54, 88, 90,217,203,138,110,  7,216,102,120, 46, 18,110, 37,194,189,236,196, 44, 33, 38,140,227,223,195, 46, 40, 65,133,
-152,161, 31,132, 94,160,123, 54, 18,110,122, 96,203,187,138,190, 85,144,191,252,  2,242,  7,126,220, 78,232,242,167,208,191,253,
- 15,224,255,222, 35,127,248, 25,243,233, 63, 30,224,113, 65, 94, 29, 96,159,145, 80, 96, 45,240,187,142,209,143, 71,234, 95,123,
-200,120, 53, 50,220, 48, 50,213,209,101, 33,186, 60, 93,179, 82,163,227,234,221,250, 63,125, 41, 42,132,100,116,178,236,133, 99,
-241,183,122,159,231, 47,241,164,187,137,134,120, 21,119, 32, 70, 21,250, 40, 28,175,236,233,180, 80,165,246,179, 37,  6,130, 31,
-188, 33, 69, 36,137,117,219, 94,156,137,128, 28, 91, 55, 46, 55,146, 21,151,167,  6, 23, 98, 21,225,212, 59,240,174,253, 21,109,
-197,210,166, 55,147, 95,205,219,207,173, 64,122, 12,241,210, 57,237, 21,202,  6,198,  1, 46, 10,186, 43, 48,216, 40, 65,206,139,
-105,226, 66,129,227,151,224,228,143, 64,252,168,247,112,121,113, 99, 56, 50, 46,252,229,247,195,197, 15,160, 95,223,195, 47,246,
-232,215, 55,148,205,150,188, 29,216,139,133,177,236,178,125,246, 89,241,112, 33, 59, 72,246, 62,161,204, 24,191,161,168,255, 55,
-209, 39, 18,185,166,219,165, 26,164, 35, 53,160,138, 50,167,162,249,216,181, 28,160, 85,156,161, 63,221,106,101, 78,134,244,174,
- 94,170, 78,129, 32, 18, 70, 68, 83, 91,128, 50, 38,181,131, 34,152,226,187, 58,164,101,138, 34, 85,223,161, 59, 66,118,138, 95,
-246,155,108,156,116,219, 50,251,167,221,115,190, 28,115,139, 28, 18,161,102,240,204,108, 93,178,135, 91,236,170, 23, 10,242,210,
-188,205,181, 58, 55, 67,158,136, 56,106,244, 66,157,212,232, 44, 14, 54,239,240, 68,166,209,122,235,206,181,221,111,166,177,183,
- 28,216,191,116,138,138, 17, 22,121,130,139,254,188, 77,170,101, 33,  5,145, 73, 48, 58,133,221, 72,176,176,156,101, 62, 56,122,
-173, 45, 93,140,205, 49,113,157,106, 91,193,120,129,224, 13,133, 77,108,245,144,238,230,159,203,162,138, 57, 40, 20,230,195, 92,
- 28, 85,235,100, 59, 42, 37,143,211,  7,166,  7, 66,192,112,232,115,215,229, 13,194, 95,103,  8,164,174,  7,223,161,  7, 47,168,
- 74,173,148,113,116,189,128, 80,243, 56, 75,241, 91,113,209,220, 99, 13, 25,187,136,232, 93, 86, 19,203,231,222, 86, 41,234,186,
-138, 22, 44, 52, 27, 24,212, 53,215,170,212,253, 30,138,146, 66, 64, 83, 48, 14,139, 42,132, 72,  8, 43, 56,185, 67,208,187,148,
- 97, 55, 17,126,218,147,193,169,111, 33,136, 21,  5,142,127,173, 46,182,219, 18,201,152,133, 77, 69,193, 51, 96,107,  8, 12, 88,
- 20, 98, 27,254,172,181,177,151,153, 42,203,118,187, 13,139,100, 28,255,  4, 91,160,141, 61,213,106,119,226,226,234,210,128, 16,
-194, 72, 80,  3,200,180,162, 67, 74, 38,104,165, 75,133,168,149,160,149, 30,165,196,202,152,149,162,129,132,178, 14,149,163, 92,
-184, 81, 43,171,163, 72, 56, 90, 33,171,222,158, 93,151,144,167, 79,145,231, 86,240,145,136, 60,223,153,159,252, 52,218, 77,184,
-  6, 59, 41, 46, 10, 20,219, 47, 51,142,222,145, 59,250,176,168,117,151,142, 18,108, 74, 33,233,252, 74,236, 20,237,189, 67,139,
- 98, 45,144, 20,  7,214,248, 88,190, 84,228,169,149,253,243, 59, 87,240,206,222,126,239,135, 87,182,211,127,127,128,247, 28,  9,
-250,176,194, 29, 65,110,223,132,103, 51, 60,222,193, 38, 35,123, 69,182,197,114,213, 95, 24,225,178,160, 27,144, 91,105, 98,  2,
-176,182,195, 33,124,228,152,254,245, 29,117,173, 28,221, 14,236, 71,243,193,135,106,231,146, 65, 67,149,254,165,142,240,241,206,
-146,222,110,116,240,154,194, 29, 69,254,210, 43,240, 45,255, 57,232,143,194,246,111, 80,255,252,235,232,255,181,129,111, 91, 17,
-175, 54,176,141,112,175,216, 57,115,166, 22,179,121,187,131,239,232,225,118, 15,175,218,245,151, 49,166, 79,241,208,176,147, 17,
- 75,106,219, 11,236,117,194,184, 30,119,106, 43, 81, 13,104,181,  3, 61, 70,157, 10,204,232,137,128, 34,243,232, 52,  6, 19,109,
-166, 22, 95,235,149,230,186,192,185, 40,199,119, 58,195,156, 62,214,217, 99, 29,133,176,142,200, 42, 90, 23,208,251,232,220,173,
- 86,178,142,214,177,159,  5,179,246,157, 68, 43,178,250,  8,235,222,244,104, 93,178, 41,131,  0,213,145,105,237,203, 61,248,139,
-205, 62, 77,106,157, 83,103,215,  9, 97, 99,187,250,171, 10, 15, 76,204, 46,131,133, 59,112, 11,184, 37,176, 90,195,233,199,224,
-236, 79,248, 30,125, 92, 28,232, 13,249, 90, 96,247,163,112,245, 35,232,215,118,240,211, 61,188,177,163,198, 17, 58,235,242,118,
- 98,  5, 83,187, 65, 55,193,126,112,223,145,122,209, 81, 23, 55, 74, 93,  8,182,162, 46, 51,162,231,214, 68,157,160,156, 75, 75,
-205, 50,252,175,136,154,112,183,221,216,196,108,162, 45, 61, 45, 80, 41,132,201,113, 33,109,108, 93,161,235, 44,172, 74, 67, 52,
-139,153,119,139,121,180,123, 88, 23,152, 20,214,131,206,  1,166,170, 24,178, 84,237,177,169,213,247,236, 54, 14,142,186, 84, 96,
-205, 42,106, 89,208,219,100,  1,213,154,125, 92, 58, 17,213,230,103, 59,171,210,235, 98,124,111, 41,117,117, 26, 87, 47, 69,155,
-186, 80, 67,183, 20,184,122, 45,204,101,182,  5, 55,220, 45,147,186,187,237,208, 91,228,168, 54, 36,236,  2, 12,212,120,231, 13,
- 62, 19,100,217, 88,201,148,228, 46, 44,214,  0, 45, 42,155,  5, 77, 79,196,155, 52,109,154, 96,158,192,166,201,226, 39,202,100,
-116, 59,140,133,115, 54, 65,144,249,196,174,203,179, 91,159,156, 30, 28,132, 18, 78,  5,100,157,130,116,170,187,158,224, 16,121,
-123,192,232,127, 98,172, 63,251,243, 83,  8,132,174, 51,110, 66,173,134, 38,111,171, 17,143, 90, 53,135,129, 57,  9, 38,  5,125,
-  8,166, 87, 27,243, 34, 58, 87, 63,176,235, 22, 79,113, 19,241,235,183, 44,102, 37, 97,177,  0,210,185, 34, 75,101,183, 53, 37,
- 93,176,202, 72, 17,142, 17,164, 10, 49, 38,234,249, 29, 88,223, 66, 30,223,179,145,168,195,  9,230, 74,211,252,157,161, 88,104,
- 72, 12, 66, 45,202, 88,237,195, 25, 67, 48,223,115,181,185,127,104, 87, 92,  8,212, 40,176, 11, 92,234,124,137,172,211, 92,245,
- 81,236,201, 70, 53, 76,167, 20,187, 33, 87, 22, 42,197,210,206,121,177, 17, 85, 81, 74,178,157, 81, 95, 42, 81,140,200,148, 68,
- 45,155,151,202, 42, 64,143,141,222, 67,201,160,153, 85, 54, 59,217,145, 22, 11, 84,168, 74,191, 74,132, 91, 29,114,163, 71, 82,
- 15, 39, 17,121,182, 67, 94, 57,134,151,143,204,129,181, 42, 54,219,221, 87,120,188,135,203,106, 92,245,109,129,139,108, 54,181,
-156,189, 43, 87,216, 87,116, 91,231, 32,153, 93, 99, 84,187,  2,218, 85, 88,178,138,102,119, 91,187, 80,106,237,203,221,163,100,
- 11,195,155,  9,110,119, 22,141,250,181, 43, 27,193,159,  4,184,217,193,170, 71, 86,  1,125,216,193,173,193,238,196,185,218,172,
- 52,121,238,117,178,139, 66,212,161,220, 69, 32, 71,116, 95,236,181,108,178,165,184,157,118,246,252, 70,144,223,125,131,244,197,
- 29,199,239,239,204,191,175,176,206,208,157, 11,221,179,129, 48,  6,228, 78,130,127,249,200,112,165, 95,169,240, 83, 25,126,199,
- 57,252,201,239, 50,228,104,249,235,112,239, 11,212,127,255, 77,244,215,182,240, 50, 68,  6,248,210,  6,237,162, 93,156,125, 64,
-143,  3,178, 86,244,178, 32, 95, 85, 88,101,228, 41, 69,190,169,163,191, 28,185, 26,149,156,218,238, 91,145,143,175,144,231, 43,
-241, 51, 91,130,216,217,153,196,182, 20,217, 45, 98,181,218,205, 47, 10,238, 88, 16, 63,244,103,146,161, 49,  7,230,  6,171,238,
-148,190,194,250, 36,210, 63,211, 17,158,237,168, 91,  8,217, 87, 51,209,132,109,114,154, 76, 12,231,159,149, 28,119,118,232, 30,
-123,  8,203, 81,176,131,187,247, 78,188,217,213,130,216,225, 94, 60, 82,175, 41,206,  6,181,195, 60, 55, 72,183,211,255,170,139,
- 58,214, 30,109, 53,184,152,242,145,194, 99, 95,252,223,173,246,223,110, 40,156,101, 56, 57,133,227, 79,192,249, 31,181,212, 54,
-221, 93,215, 71,219,120,126,124, 29,174,254, 95,120,255,  1,252,114,  7, 95,217, 81,134,  1, 93, 87,116, 45,112, 97, 69, 78,240,
- 46, 90,101,166,189, 37, 21,130,216,193, 63,137,249,195,242, 97,230,206,218,172,164, 11,131,182, 51,172,115,209,  9, 97,170,158,
- 15, 95,107,157,178,194, 67,240,124,  6,223, 47, 74,245,238, 85,172, 25,168,254,178, 63,242,220,138,155,159, 92,241,198,103,246,
-188,127, 81,124,124, 94, 45, 79,187, 40,187, 90,217,150,204,154,202,202,173,113, 85,210,180,188,157,  4,103,190,174,211, 18,230,
-116,178,234, 25,220,254,138,150,203, 11, 75, 74, 20, 70,173,243, 14, 30,174,165,148, 57, 37,206,111,238, 85,231, 48, 16,220,206,
- 86, 23,157,189,253,252, 25, 56,210,196, 98,211,143, 13,139,181,228,181, 49,246,172, 70,247,240, 22, 85,191,127, 51,  1,190, 84,
-100, 10, 25, 65,231,144,154, 73,211,196,161,157,140, 15, 96, 32,  5, 93, 28,172,142,  5,151,224, 42,246,197,107,251,128, 13,197,
-204,117,208,182,226, 14,211,163,197,246,222, 46, 55, 28, 65,  8,213,223,121,109,  2,105,157,131,104,132,  5,253, 78, 38,139,234,
-245,157,143,106,153,247,208,215,153, 81,139, 85, 67,235,138,175, 63,251,136, 16, 83,111,231, 88,206,166,217,137,174,218, 47,254,
-179,131, 57,169, 90,246,188,101,164, 87, 23, 11, 54,204,235,172, 73, 16, 62,112,181,110,254,248,166,220,215,107, 80,170,195,122,
-  6, 69, 73,101,220, 59, 30, 85, 38,123,129,136,197,126,118, 93, 79, 89,157,  0,  3, 50, 92, 17,114,153,222,184,192,124, 17, 88,
- 32,130,195, 26, 84, 60,179,216, 20,242, 69,172, 51,149, 24,145,148,208,253,206,170,174, 90, 93,228, 96,  4,151,189,127,217, 85,
-108, 20, 31,124, 44,215,234,152,160,173,153, 85, 31, 66,250, 56,175,  6, 68, 44,114,177,182, 84, 31,111, 78, 35,133,236, 48,145,
-136, 16,170, 29,242,157, 84,  2,137,144, 51,253,104,214,141, 85,115,237,118,145,176,138, 70,111, 59, 75,240, 82,143, 60,219,219,
- 65,254, 97,239,176,130,139,211,246,  5, 30, 20,184,220, 91, 39,124,127, 64, 31,143,240, 40,163,155,193, 14,111,247, 71,105,167,
- 70,225,219,120,183,229,162, 29,180,162, 67, 70, 51, 19,164, 67,146,141,  9, 37,185,128,185,239,144, 51, 59,  4, 36,  5,228,212,
-199,253,247,147,253,172,205,  8,131, 88,112,204,152, 77,140,118,106,138,107,238,172,236,141, 73,192,123, 25, 61,222,120,124,152,
-115,199, 31, 87, 19, 63, 14, 94,132, 60,168,232, 87,  6,155,196,124, 34,195,183,158,218, 52, 64, 45,247, 35,252,233,167,  9,119,
-119,144, 11,233, 34, 35, 59,243,129, 51,  2, 23,216,110,127,155, 44, 72,229,103, 51,172, 87,240,239,124,204, 38, 14,227, 79,195,
-151,222,166,254,145,175,145, 47,183,140, 31,  9,232,169,176, 74, 74,247,246, 30,142, 34, 37,  6,203,108,223,248,205,110, 47,200,
-168,132,167, 34,218,  7,116, 29, 73,207, 70,214,111,101,198, 98, 89, 39,245, 82,137,239, 90,148,107,240, 14,156,208,232, 85, 83,
-138,131,237,205,247, 54,110,236,188, 99,  8,213,173,152,174,242,149, 98,213,112, 21,144,226,129,  9, 79,247,132,143,174,  9,119,
- 86, 48,184, 32,250,134, 21, 31,156, 70,228, 36,218,161,125,106,212, 61,214,193, 42,220,206,219, 65,137, 11,127,204,194,  0, 91,
- 21,246,  2,143, 71,247, 45,101,251,231,173,211,104,246, 83,204,148,147,113, 34,122, 22,108,218,190,242,169,208,101,133,187,217,
- 96, 70,191,239,150,237,226,127,240,158,221,237,142, 11,114,187,194,241,211,112,246,125,144, 62,234,168,216,114,237,174,177,182,
-117,200,246, 39, 96,243, 58,250,149, 14,190, 92,168,251,129,186,217,163,151,197, 44, 53,189, 16,139,103,160, 79, 70,173, 69, 42,
-152,207, 97, 61,120,109,178,159, 54, 66,156,223,211,236,209,235, 44, 52, 86,171,212, 61, 60,201,186,154, 32,209, 59, 42,166,177,
-178,137,113,173,101, 44,141,196,166, 50,229, 81,139,194,153,  4, 94,248,109, 43,226, 55,119,232, 47,108,169, 46, 86,106,229, 68,
-187,125,238,213, 92, 46,189,219, 19,107, 40, 38,236,155,218,225,105, 14,237, 29,126, 59,216,235,  2, 58,194,129, 72,172,163,237,
-234,231, 68,180, 57,192,211,254, 62,105,153,192,176,  7,242, 46,209,153,142,183,232,136,131,101,172, 30,218,168,218,125,238,186,
-183, 95, 15,201,124,237, 94, 89,166,108,113,157,189,206,174, 69,170, 75,222,122,235,254,245, 73, 96,203, 12, 99,145,107,112,242,
-107,105,103,115, 30,209,244,249, 76, 96, 63,230, 64,149,214,113, 87,153,  1, 54,210, 68, 84,117, 97, 61, 91, 38,238,137, 89,161,
-171, 51,152, 13,161, 59,139,196,102,  8,217, 60, 46,175, 11,  7,128,180, 66,209,181,  4,242,100,190,206, 44, 76,107, 54, 73,105,
-161, 57,126, 22,121,210, 92, 76, 29,161, 75, 94, 12, 85, 66,234, 38, 91, 95,235,210, 45,140,102,142,169,211,170, 72,169,208,165,
- 73,201,190,124,252, 15, 68,203, 79,168, 99,215,140,232,194, 74, 34, 79,212,140,150, 49, 79,169,179,136,204,195, 15,146,  8,146,
- 51,244,107, 98,201,144,214, 54, 50,240, 10,211,198,200,214,117, 55,178,154,165,176,153, 63,189,168,101,215,142, 84, 74, 53, 22,
- 58, 37, 32,235, 21, 49,196,105, 52, 31, 22,251,188,172,129,193, 22, 41, 20, 81,207,107,159, 63,160, 56,141,232,132,218, 62,244,
- 92,168,152, 53, 76, 39,133,169,221,148,109, 66,109, 55,207,147,104,142,177,158, 74, 71, 97, 85, 42,235,146,233, 99, 34,158,175,
-144, 35, 11,253,178,120, 98,223,195, 63,171,200,119,174,225,195, 39,200,173, 35, 59,112,107,133,109,133,171, 61, 60, 84,120,111,
-128,  7,  3,250,238,136,222,219,163,155,209, 14,243,161, 88,190,115,219, 93,165,134,215, 86,234, 88, 93,128,232, 23,187, 24,164,
- 97,142,185,117,251, 20,  3, 49, 57, 77,168, 31,  8, 15, 77,124, 37,235, 64,216, 36,194,174,131, 55, 92, 46,140,237, 79,229, 44,
- 34,251,  8,143, 21,185, 25,204,107,126,171,179,195,231, 81,134, 55,119,112,158,224, 70, 68, 78,131,117,225, 87, 25,222,202,112,
- 97,156,113,233, 42,242,162,160, 23,138,222, 43,200, 91, 35,220, 62,130, 27, 29,242,160,162,253, 10,158,143,208, 41,242,104,132,
-  7,131,141,250, 69,145, 91,197,172, 86, 23,192,223,218,194,247,158,194,127,249,113, 56,238, 97,115, 23,254,201,219,212,255,248,
- 53,134, 52,178,125, 37, 48,  6,161,238, 97,119,161, 60, 69,241,179, 79,169, 95,119,245,218,157,136,222,138,132,211,128,174,133,
-186, 41,232, 69, 57,232, 38,170,147,  5,211,253,138,110,108,215,223,149,198,233, 23, 66,178,200, 96,201,134, 61,175, 98,201,119,
- 33,137,229,198, 71,103, 49,  4, 69,114, 32,156,118,200,211,137,250,110, 65, 99, 48,161,227, 75,107,228,233,206, 30,244,210,119,
-220, 61,232,177,143,  3,130, 75,224,167,229, 98,103,191, 14, 98, 73,104,185,204,244,149,236,183,153,226,135,198,142,217,144,156,
- 77,241,169, 69,172, 83,223, 57,223, 64, 43,114,218, 27,163,224, 76,140,236,151, 58,120,184,133,175,239,109,101,209,  9,188,185,
-135,247,178,  5,  2,220,  8,246,121,156, 29,193,241,119,194,234,183,248,215,126,184,118,219, 88, 89,209,177,255, 60,236,126, 24,
-189,183,135, 47,247,232,227, 29,249,222,150,178, 25, 28,126, 99, 45, 89,170, 48,202,194,251,221, 82, 11, 91,184,201,  2,202,165,
- 11,130,220,146,197,221,178,210, 61,203,102, 49,142,158,168, 62, 62, 22,159,187,219,232,247, 26, 79,  8, 37,121,234, 99,113, 84,
-165,136,109, 45, 54, 65,249,220,143, 95,176,251, 97,101, 47,141,141,109,227,236,136, 80,156, 64,215, 55,221,105, 16,142,164,161,
- 67, 27,169,114,150,172,181,196,177,  6,108,105,217,202,193, 59,223, 50,185,188,197, 34,158,157, 35,149,181,129, 58,101, 49,250,
- 85,146, 67, 69,  6,223, 11,183,177,118,110,141,138,204, 80,155,165, 27,235,176, 27, 91,132,253, 77, 52,186,121,188, 20, 16,167,
-109, 46,138,132,198,253,152,148,224,117, 10,194, 20, 39,149, 29,100,177, 47,133,126,186, 32,104,126,  0,146, 85, 69,174, 53,239,
-166,149,146,197,206,160, 97,113,163,139,218,170,151,  1,  9,139,145,150,134, 79, 43,115,241,193, 34,213,112,210,112,205,212,148,
- 39, 78,194, 57,132, 38,120, 12, 44, 79,  8,251, 84,117,  1, 10,250,141,242, 89,218, 53,117,125, 57,223, 86, 17, 66,236,187,137,
-  4, 23,155, 71, 93,157, 76,151,179,221,163, 92,143,129,204,133,141,189,223,209, 14,254,246,124, 15, 88, 57, 11,106,229,114,151,
-222,214, 84, 58,123,250,209, 15, 24,216,  7, 33,229,106,136, 81, 45, 74,215,  7, 82, 76,  4, 81, 36,117,196,184, 66,227, 26, 73,
-167,212,106, 67,176, 78, 93,109,170, 25,145,206,144,120,248,151,172, 24, 41,174,198,196,128, 65, 39,  2,197,224, 32, 68,194,144,
-160,139,118, 64, 59,109,173, 46, 88,202,170,106, 80, 53,236,198,209,252,223,193,239, 14, 73, 60,159,183, 26,174, 47, 16,209, 80,
-217,143,197, 94,100,246,225, 94, 47,136, 22,118, 57,179, 18, 56, 78,194, 73,138,172,168, 28,111, 11,125,  8,196, 27, 61,242,244,
-  9,242, 66,111,  2,226,126, 68,184,132,167,247,200, 43, 43,184,243, 50,156,220, 52, 37,240,110,111,251,241,135,213,242,192,223,
- 26,208,119,246,232,251, 25,221,236,169,155, 17,174, 70,234,174, 80,107, 33,123, 61, 95, 69,169, 81,144,193,191, 40,193,242,207,
- 75,145, 86, 23, 77,228,172,226, 49,182, 13,157,153,  4,194,  8, 49, 40,105, 83,232,163, 18,163,146, 58, 33, 62, 20, 66,181,238,
- 36, 28, 91,150,189,238,132,112, 20,  9, 47,174,144,211,106,104,185,149, 32,187,  8,131,162,143, 70,216, 23,164, 56,121,250,162,
-192, 90,209, 62,194,105, 64,  7, 65, 71,179, 44,134,181,117,152, 82,176, 63,247,222,206,166, 22,231,107,232,  7,248,106,133, 51,
-144,149,131,116,246,  3,218, 85,228,158,194, 15,111,224,215, 51,252,201,231,224,207,124,163, 93,113,239, 95,192,223,120,157,242,
- 87,223,102,123, 86,216, 61, 39,236,131, 82,243,172, 31,169, 10, 49, 87, 52,249,170,119, 91,225, 45, 11,196,209,231, 19,117,175,
-104, 22,100, 87, 25,223,203,108, 42,142, 23,182,115, 83,179, 39,149,157, 68,194,  0, 97,167, 48,186, 53,243,164, 67,142, 18, 58,
- 66,237,  5, 61,241, 74,223,149,232,146, 32,196,222,246,222, 47,246,240,220,138,240,176,192,205,104, 83,143,243,100,171,139, 77,
-134,219,106,207, 81,152, 91,129, 81,237,191,143,222, 31,141,217, 66,101,176,184, 84, 70,172,  3,223,249, 33,159,220,215,165,213,
-146,234, 66,227, 75, 87,215, 99,248,216,105,133,209,231,238,244,  6,153, 89, 97, 34,187,130, 21, 98,175, 22,227, 29, 72,129, 13,
-240,247, 30,216,168,255, 70,132,155,  5,238, 20, 88,191,  0,235,239, 54,255,250, 20,153,186, 16,198, 73,130,241, 85,184,250,239,
-209,247,222,132,207,173,168, 95,186, 34,127,233,130,113,200,140,209,  1, 49,101,182,232,118,209,110,160,163,251,169,  7,153, 91,
-211,202, 33,242,244,131,136, 40,181,109,224,220,139, 29, 43,139,108,182, 54,182,159,163, 50,147, 52,142,185,186,154,218,111,184,
-157,117,199, 77, 17, 95,220,158,245,184,100,187, 79,232, 60,  5,168, 40, 35,202,190, 40,161,113, 47, 48,186, 32, 49,248,110, 94,
-167,149,158,248,159,159, 32, 40,211,227,232,204,255,215,249,144,111, 62,237,226, 19,196,212,148,232,139,110, 81,197, 64, 44,201,
-195, 88, 28,  9, 62, 29,226, 97, 41, 34,116,229,116, 89, 88,225,174,183,117,203,230, 92,171, 78,157,112, 27,179,183, 69,177, 30,
-236,241,117,145,186,118,168,112, 23,102, 11,222, 97,116,209,172,111,138,174,164,215,133, 72,238, 48,241, 76, 14, 70,216, 19, 64,
-133, 58,101,120,180, 71,175,174,113,152, 64, 79,190, 86,109,227,109,  9,205,214, 53,139,246,170, 43,166,150,225, 46, 70,146,170,
-211,115, 84, 89, 18,224, 90,142,192,108,169, 19,253,128,116,  6,209, 67,181,192, 53, 82,157, 46, 44,110, 41,153, 56,186, 17,249,
- 66, 76,102,171, 22,168,227,136, 22,215, 65,212,178,152, 50,184,222,160,235, 92, 18, 86, 93,171,113,232,226,230,137,207,101, 46,
- 52,108,244, 94, 15,162,111, 15, 28, 11,126,  1,165, 90, 43, 59,131,252,210, 75, 79, 82,165,171, 35, 93,215, 19,211,218,190,171,
-187,135,176,223,210, 21, 83,152, 27, 39,221,198,239, 41, 26,116,165,115,161,204, 94,139,147,210, 58,243,211, 73,165,247,175,122,
-148,129,152, 86,212, 16,209, 82,166,106, 75,252,159,115,197,253,168,179, 32, 69,131,144,130,135,176,160, 88,238,201,108,107, 16,
-194,172, 84, 22,151, 79,104,177,253, 92,133, 16, 42,235, 16,184, 81, 51,235, 42,164,243, 21,242,194, 25,242,202, 41,242,225,  0,
-207,111,145, 27, 27,100,157,225,244, 14, 60,245,135, 32,126,151,205,117,203, 15,161,151, 95,133,215, 42,188,150,209,175,110,225,
-253,129,122, 49, 82,119,131,249, 17,135, 66, 29, 70,114,174,100, 17, 70, 85, 70,103, 94,215, 98, 35,223,214,200,105,181,213,233,
-232,107,244, 54, 85,240,168,102,178,152,158, 78,147,107,226, 26, 45, 84, 44,153, 53, 22,136, 89,137, 87, 74, 79,161,235,160,219,
-184,216, 37,  4,180,239,224,  1,132, 75,181,113,253,168,232,101,134,119, 70, 83,182,223, 72,118, 51,236, 93,  3,240,254,  0,167,
- 61,188,208,217,225,241, 32,160, 95, 46,232,221,  1,217,251,158,255,182,160,249,210,202,238,151, 78, 44, 87, 61, 87,203,247, 88,
-  5, 56,173,200,235,  5,126,122, 15,255,223, 22,206,122,248,177,239,129, 79, 60, 13,219,119,225,157,135,240,231, 95, 99,248,199,
-247,217, 62, 15,155, 51, 75, 64,171,213,181,  3,206, 60,144,216, 70,123,158, 80,118,132,141,148,239, 86,116,175,240,116,231,232,
-211, 66,206,238, 63,246,223, 94, 70,195,222, 18,  2,114,158,108, 20,174,  1,185,  2, 25, 20,110,246,240,145, 53,114, 18,  9, 93,
-107, 67,220, 54,214,153,151,156,211,222,185,233,213, 86,  5, 31, 63,118,  5,122,180, 67,249,129,143,173,163, 34, 67,245,192, 51,
-117,237,132,162,123,191,137, 94, 96, 69,208,191, 48, 88,164,108,135, 31,248,106, 93,254,214,171, 16,162,117,219,219,206, 84,234,
- 53, 33,197,219,139,216,153, 31,253,142,147,227,250, 96,202,189, 62, 34, 87,  5, 94, 31,225, 81,181,247,232, 65, 99,131, 87,251,
- 61,157, 88,193,245,210,  0, 55,111,194,201,239,134,254,227,126,103, 41,179,185, 76, 86,246,103,246,191, 12,155,255, 22,238,189,
- 10,191,208, 81,126,228, 49,227,155, 23,140,146, 25,250, 48,121,156,227, 33, 97,133, 62, 78, 43,195,233, 95, 47,119,232,203,236,
-107, 28,158,210,254, 23, 15, 90,205,235,120, 81,143, 92,117,  6,123,  4,122,105,192,151, 89,108, 84, 93, 96, 22,220,165, 82, 68,
-167,169, 65, 20, 83,223,151,228,221,147,119,168, 90, 33, 68, 63,132,253,126,178, 87,  8,165,176, 90,220,219, 83,180, 90,204,183,
- 97,126,168, 86,115, 50, 48,243, 14,116, 49, 73, 92,246,170, 77,168, 89,188,121, 17,213,  5,144,198, 68,127,  9,241,235, 95, 23,
- 99,105,251,190, 79,197,145,206, 86,171,249,140, 20,174,199,122, 31,168,225, 85,167, 67, 34,120, 19,164, 85, 39, 49,149, 48, 79,
-  5, 88,  4,180,132,  5, 56, 39,200,108, 15, 92,  6,185,206,217,107, 79,214, 24,237,185,196,133,214, 96,145,240,242,  1, 61,177,
-206, 37,129, 44,130, 96,154,102, 56,204,222,255,  6,  9,159, 34, 95,117, 54,238,  5,105,118,189,176, 88, 35, 60,177,246,159, 67,
-109,244,240, 61,147,131,229,129, 78,123,235,105,  2,225,142,165, 22,170,210, 73, 32,244,189, 79,134,235,148,154,214, 68,113,154,
-203,  4,138,145,133, 28, 82, 29,190, 19, 66,116, 33,168, 78, 83,168, 67, 73,158, 28,136, 13, 38,226,100,176,231,178, 32,230,114,
- 61, 13,182,189,158, 20,125,238, 63,168,144,115, 33,239,246,116,235, 68,212, 64, 24,246,112, 60, 32,247,223, 36,212,140,132, 58,
- 89,188,149, 74,162,176, 86, 33,105,153,112,138,150,164,102, 28,204, 20,196,141,241,150,126, 36,  8, 26, 19,132, 68, 13, 13,198,
- 81,208, 96, 92,120, 10, 84, 15,187, 15, 94,225,110, 75,165,171, 74,239,222, 71, 81, 27,243,131,141,241,115, 41, 86, 45, 17, 12,
-227, 89,139,165,203,185, 10,127, 45,112,179, 84,206, 82, 15,207,172,145, 79,156, 34,159,236,145,143, 14,200,237, 45,172,143, 97,
-253, 59,161,251, 30,232,127, 27,132,103,161,108, 97,248,155,232, 59,255, 16,126,174,194,167, 51,245, 98, 75,221,143,  6,179,201,
- 35,117,167,104,168,148, 82,173, 81, 11, 66,198,179,142,139,255,234,254,249, 36,190,135,108,122, 52,191,246,134, 10,181,202,228,
- 40,104,118,158, 60,216,205,101,240,155,131,136,105,167, 58,177,149,104,136,112, 20,133,149, 42, 43,133,163,160, 68, 41, 72, 53,
-197,179,158, 20,244,204, 10,  3, 94,223,161,247, 71, 99,221,223, 74,112,220, 77,221,  5, 67,133,221, 96,144,153,231, 59, 27,223,
-247,  5,238, 68,228,237,  1,189,168,112, 92,209,251, 21,253,244, 99,100,183,183,131, 47, 10,250,214,158, 48, 84, 59, 48, 69,144,
-109,132,255,232, 89,248, 15,255, 77, 88,127, 28,234,143,194,107,239,195,127,240, 37,118,239, 94,177,125, 89, 24, 79,204,113, 85,
- 23,128,138, 62, 90, 82, 46,216,181, 99, 69,142,141,159, 21,172,123,206,106,218,133,125, 37,191, 58,178, 27,205, 15,142,219,139,
-210, 70, 45,158,246,230, 10,238,244,246,235,145, 69,219,202,168,230,233,126,190,131, 91,106,246,174,228,115,227, 32, 51, 13,101,
- 53,218,254, 63, 62, 99, 97,233,187, 75,123,162, 23, 21, 94,191,178,  2,104, 83, 97,168,232,174,160,219, 98,255,156, 21,221,121,
- 39, 55,  8,220,221, 33,127,106,141,124,235,191, 11,235, 63, 52,  7,169,232, 61,224, 43, 80,190,  0,229, 61,208, 43,168, 27,243,
-147,215,141, 85, 38, 57,216, 56, 60, 90,102,171,210, 65,233,124,108,175,200,155, 91,248,213,157, 49, 15,126,247, 45,248,226,  3,
-120, 99,107,223,171, 36,246, 70,222, 22,248,196, 22, 94, 88,195,201,247,192,250,123,124,183, 52,206,135, 57, 21,202, 61,216,253,
- 24,108,255,119,244,205,  7,232,255, 35,148,127,244,128,252, 96,203,238,  8,118, 41, 48, 44, 52, 57,141, 63, 16,253,  0,232,252,
- 62, 51, 78, 22,214,153, 22,215,249,239, 25,125,239, 91, 29, 27,123,144,204, 22,150,221,251,162,111,108,128, 23,204, 46,155,130,
-229, 69,104,139,171,245,181,156,184,141, 78,131, 77,185,130, 90,132,106,243,118,143, 10,251, 50,135, 50,129,216, 58,133,176, 80,
-221,155,112, 50,  3,235, 96,163,241, 82,237, 16, 25,125,159, 27,131, 21,222,197,195, 56,100, 98,110,133,  5,252,253,154, 57,253,
- 32,215,124,145,212,230, 97, 46,237, 30,221, 47,198,200, 73, 22, 30,246,230,197,174, 58,143,215, 15,211,203, 15,142,197,101,235,
-214,186,253,220, 20,241,234,169,115, 50, 75, 21,101,241,185,134,131,194, 96,113,  8, 45,215, 37,139,193,112,253,141,230,214,204,
- 84,185, 72, 53, 76,110,235,196,157, 12,215, 44,111,185, 33,106,213,227, 94,130,120,238,185, 23, 72, 65, 38,248, 78, 27,181,  7,
- 76,196, 90,189, 18,140, 62,201,136, 11, 86,190,  4, 99,132,148,122,200,132, 87,157,139, 26,189,166,116, 95,190,155,141,250,231,
-172,226,201, 41,208, 20,232,  1, 72, 93,239,104, 86, 59,180, 99, 76,190,110, 80,202,176,119,216,197, 98,247, 68, 43,186, 23, 25,
- 32,238, 60, 88, 36,198, 60,  9,189,145, 57,215,100,161,244,152, 16,138,242, 65, 48,  4, 47,120, 82, 41,149, 40,202, 81, 17,143,
-223,195,130, 60,134,129,176,238, 96,191, 37, 94,220,155,200, 67, 73, 76, 29,220, 41, 28,147, 73, 19, 53, 74,141,241, 92,133, 81,
-161,200, 72, 12,105, 26, 11,165, 10,149,140, 14,  3, 28, 37, 59,124, 68,145,236, 59,228, 34,179,  2, 83, 32,212, 58,125,  0, 89,
- 45,215, 56,149, 58, 67, 31, 52, 19, 67,180, 70,106,172, 68,242, 84, 37, 15, 62, 79, 56, 11,240, 66, 45,156,173,123,248,232, 41,
-225,149, 53,242, 91, 64, 94,217,192,217, 57,116,255, 10,172,254, 32,164,143,248, 30, 52, 66,185, 11,251,191,134,190,254, 67,240,
- 35, 17,253, 98,166,236,246,134,209,221, 13,212,161, 76,192,155,138,218, 33, 29,230,220,237,234,135,181, 78, 98, 20,133, 69,192,
- 92,109,187,161,214,157,235,225, 40,173,197,248, 14,238,145,110, 97,  2, 69, 13,230,209,196, 16, 67,133, 85,134,163,106,137,154,
-199, 40,221,163,193, 46,220,167,  2,172, 50,245,205, 75,184,178,116,183,112, 35, 33, 47,174, 12, 45,106,112,108,123,240,187,163,
- 61,169, 23,214,112,123,109, 10,250, 59,  3,188,176, 69,182,  5,237, 11,220,219,193, 63,219, 82,127,230,190,237,128,111, 37,179,
-225, 17,  8,191,121,109,177,156,127,246, 89,248,238,223,105, 63,123,252, 65,248,217,215,225, 63,253, 42,101,183, 97,248,136,144,
-147, 50,248, 67,  5,177,142,169,247, 72,121,170,157,107, 65, 43,146,155, 13,  7,100,109,209,168,147,129,229,189,202,240,168,162,
- 29, 30, 12,100,124,241,245, 51, 29,242,145, 99,228,229, 19,228,217, 53,242,204, 10,158,  2, 78,119,230, 78,232,  5,122,133,238,
- 41, 72,207, 24,180, 69,143,156, 82, 19, 33,158, 66,119, 11,228, 55,  1, 47,  0,127,  7,134, 95,178,  9,199,167,175, 96, 63,192,
-219, 35,188, 61,152, 23,121,168,168,157, 42,104, 39, 22,165,122, 63, 34,175,109,  8,127, 54, 34,159,250,  1,224, 21,  7, 10,173,
- 32,172, 64, 62, 14,252,139,243, 11,214,193, 72,111,186,113,133,225, 99,144,199,246,247,245, 17,148, 47, 35,250,171,176, 11,232,
-189, 17,253,252, 35,228,115, 27,187, 70, 63,220,193,151, 31,193,175,236, 32,  6,244, 52,152,150,225, 86,133, 15,239,144, 91, 79,
-193,233,167,224,244,223,128,244,226,162,103, 22, 40, 15, 97,248, 89,216,253, 31,240,232,255,167,235, 93,131,109,203,174,251,174,
-223,152,115,174,181,247,121,221,103,119,223,238, 86,235,237,150,228,182,172,216,178, 99, 89,118, 98, 59,113, 98,226, 56,113, 66,
-133, 24, 19, 82, 36, 69,  2,  5, 36, 80, 20, 85, 64, 97, 10,202, 64,133, 47, 64, 65, 21, 36, 85,144,144,132, 36, 80,  9,224,138,
-147, 24,236, 56,196,137,223,145, 45, 63,164, 88, 45,181, 30, 45,169, 91,253,186,239,199, 57,103,239,189,214,156,115,240, 97,140,
-185,214,218,231,182, 63,180,125,213,125,239, 57,231,238,189,246, 28,115,140,241,255,255,254, 47,161,159,174,212,191, 93,109,220,
- 46,133,237,229,192,166, 24,151,188,137,218,162, 90,231,219,162, 80, 87,113, 46,192, 93,180,188,244, 77,245, 14,205,211, 10,117,
- 70, 60, 77,241, 28,121, 49,122, 37,136,173,223, 90,231,219,160,  1, 77, 71, 88,108,200,154,170,249,206,163, 71,144, 70,102,221,
- 97,174, 70, 81,107,157,100,205,190,247,247,201, 69,198,200,130,101, 54,151, 91,132,102, 93,236,159,  5,  6, 21,182, 62,110, 15,
-226,145,164,193, 32, 53,181,234,148, 30, 23, 69, 38,209,153,161, 87, 93,240, 37,139, 84,177,139,225,187, 50,235,  0,194, 98, 50,
- 61,179,206,231,223, 29, 91,167,190, 76, 19,107,197, 91,116,143,233, 23, 91, 21, 98,  0,  0, 32,  0, 73, 68, 65, 84,190,196,195,
-182, 60,131,122,129,136,166,203,142,118, 65,167,211, 54,106,214,165, 57,109,169,187,210, 69,239,186, 47,190,171,250,152,248,122,
-175,227,213,169, 43,222,247,232,135,197, 42,162, 57,  7,194,197,191, 79,144,125,207,252,133,184,227,226,127,151, 37,217,174,168,
- 62,230,126,  3,125, 12, 28, 35,139,164,188,139,194,184,  9, 56,113,113,234,162, 30, 76, 38,102,217,238, 83, 34,244, 43,203,134,
- 87, 37, 46,128, 48,181,100,223,165,235,212,133,207,193, 44, 76, 40,217,101,118,250,194,133,246,182, 23, 37,109, 95,195,  3, 99,
-168,245,241, 49,196, 66,111,208,236,135,137,146,233,162,129, 68, 14, 99, 79,  9,129, 97, 55, 80,210,142,116,114, 29, 57,191, 75,
- 28, 55,150, 39, 60, 20, 83,101, 75, 32,105,225,160,190, 29, 61,201,104,114,165, 84,  6,231,170,183, 14, 53,146,169, 99,128, 52,
- 66,114,239,104, 48,251, 28,238, 15,157,  2,239, 27,160,193,189,150,141, 24,215,169, 34,193,197,  2,213,148,235,113,113,112,  0,
-116,162,156,  8, 60, 83, 50, 55, 18,196, 27,  7,200,251, 58,228, 91, 10,242, 65, 96,253, 65,232,254, 37, 56,248, 78,136,151, 13,
-161, 57,126, 14,182, 63,  5,143,254, 17,250,153, 91,240, 83, 61,229,141,145, 58,238,168,187,  1,221,101,178, 26,139,190,248,144,
-161,104,139,237,243,125,184,131, 56, 20,223,247, 90,108, 51, 33, 76,205,151,233,167,176,241, 94,219, 45, 54,108,101, 45,251,118,
-200,106,182,126,107, 42,219,135,195, 79,142, 33, 67, 78,166, 91,208, 29, 12, 17, 14,138,114, 92,  6,226, 77,168,159, 24,225, 53,
-181, 92,241, 15, 28,154,  5,174, 98, 10,247, 36, 45, 81,  1,185,181, 65, 95,181,220,119,121,246,208,105,120,246,131,232,249,  0,
-255,228, 33,229,179, 91,134,123,153, 92, 13,179,123,184,141,132,143,172,209, 91,138,254,250,136,252,240,  9,188,255, 18, 60,122,
-209,252,239,127,247, 77,248, 95,111,194,149, 29,229,105, 35,124, 85,103, 60,196,101,182,177,143,222, 87, 71,129,238,122, 52,152,
- 78,176, 14,133, 65,205,210,135,160, 81,172, 48,103,241,113,172, 83,254,182,176, 74, 17,121,223, 17,242,190, 99,228,125,135,200,
-179,  7,112,253, 12, 57,201,208,191,  7,194,135, 65, 62, 12,188, 27,228,138,207,245,197,230,180,205,171, 29,139, 23,214, 10,124,
- 26,118,191, 97, 54,193, 31,127,  8, 95,222,194,  7,162, 81,236,238,143,212,228,118,152, 13,200, 70,144,115,236,226, 68, 38,252,
- 87, 87,145,223,251,163,192, 19, 80, 63, 15,245, 31,128, 60,  3,250,141, 16,158,  3,185,106, 33, 43,178, 54, 11, 25,199,246,115,
-200,214, 72,112, 13, 88, 16,111,  1, 95,129,123, 27,244,197, 17,253,212, 41,124,121,103,135,201, 73,130, 79, 84,123,208, 14,  4,
-158,234,224,201, 12,207, 13,198,247, 63,124, 15,172,191,  7, 14,190,  7,186,119,187,255, 92, 65, 31,217,238,124,247,183,224,244,
- 23,208,151,  7,248,105,161,124, 98, 36,223, 63,103, 88, 43,103, 49,176, 41, 86,228,218,  4,169,157, 53, 69,188, 59,119, 87,221,
-232,207, 98,244,206,124, 43, 76, 99,226,226,191,191,214,185, 75,106, 26,246,169,168,142, 83,182,144, 77,232, 90,240,138, 39,230,
-  5,148, 88,253,247, 47,246,173,117,218,117, 47,247,185,222,161,183, 17, 64, 16,170, 36,250,232,246,200,226,231,135, 40,181, 56,
-223,162, 61,133,238,  1,223,170, 19, 17,  3,172,170,146, 92,218,208,192, 54,161, 46,213,209,179,216, 47,180,127,225, 44,250,134,
- 47,157,124,217, 62,126, 15, 11, 62,123,245, 51, 68, 22,180, 23,161,  5,  0, 49,  9,250,130,171,189, 77,  4, 38,123, 19,  0,157,
- 66, 89, 22,197,118,  9,167,209,102,134,147,233,156,105,187,249,160,251, 72,218,134,113,189, 56, 88,175, 23,108, 86,243,152,126,
-191,207, 13, 11,200,186,250,109, 33, 92, 48, 77, 46,227,201,219,152,190,178, 39, 32,152, 11,174,200,111, 19,217, 50, 55,192,181,
- 49,225,223,142,108,215, 58,166,197, 94, 95,228,241,145,251,108, 89,147,233,245,108,118,235, 37,204, 69, 98, 48, 59,116,191,114,
-151,140,131,182,186,206,129, 67,234,176,153,165,192,110,201,149, 55, 45, 66,104, 81,169,191,221,168,131, 69,138,249,146,208,164,
- 50,185,165,116, 41,242,211,249, 66,215,114,  4,140, 77,150, 11, 42,145, 85,  8,172,164, 50,212,145, 48, 22,186,206,226, 29,227,
-253,123,132, 98, 10,238,164, 74,172,133,181, 64, 39,117, 98, 98, 91, 28, 29,148,234,177,119,181,206, 64, 24, 12,187, 90,105,182,
-128,  2,187, 45, 34, 43,247, 74,218,  7,183,214, 72,168,131,139,137,171, 79,230,189, 27, 10, 45, 34, 47, 24,170,214,199, 88, 65,
-237,103, 82, 15,189,140, 56,219,131,194,181,237,142, 75, 73,137, 79, 29, 35,239, 89,195,183,123, 16, 88,247,173, 16,127,  8, 86,
- 31, 50,145, 80,254, 28,108,255, 50,220,254, 57,244,229, 13,252, 90, 68, 95,138,148, 71, 91,106, 25,208, 49, 83,182,153, 34,134,
-188,108,190,212,218,232, 76, 52,170, 29,251,170,236,210, 62,104, 23,198, 86,109,183, 62,237, 34,237, 80, 40, 89,167,215,114,185,
-159,242,201,171, 37,149,250,175, 59,139,228,118,175,163, 11,149,212, 50, 60, 34, 74,248,242,142,113,  7,241, 84, 57,122,125, 71,
-220, 40, 74, 66,174, 41,196,100,222,189,147, 14,206,  6,120,121,139,126,173,194,173,  1,190, 97, 68,179,192, 39,207,209,223,122,
-  4,111,109, 25, 67,102,123, 41, 80,174, 26, 48, 93, 70, 69, 15,125, 31,126, 41,194, 15, 93,129, 23,142,225,214, 41,220,189,  7,
-175,141,240, 19,247,224,201,140, 30,214,153, 66,185, 80,245,234, 34, 75, 33,136,208, 63,159,144, 99,129,251, 62, 38,172, 13, 16,
-238,135,250,177,195,218, 79, 18,221, 93, 69, 94, 29,140,152,119, 57, 66, 72,200,213, 53,242,145, 19,228,106,  7, 79,222, 70,142,
- 46, 65,252,211, 16,255, 32,196,119,128, 28, 46,108,101,186, 56,102,182,214, 21,203, 93,  7,237,108, 32,255, 56,124,254, 45,248,
- 63,182,148, 23, 79,169, 97,132, 95, 80, 27,185,111,173,128,235,185,105, 57,194,229, 68,120, 97,141,252,190, 43,200,199, 62,132,
-188,247, 47,122, 56, 74,129,244, 46, 40, 87, 29, 77,247,140,113, 93, 37, 61,158, 48, 37,173, 44, 30,248,255,255, 44,236,126, 20,
- 94,188,137,254,114,164,254,243,141,  1,155,142,237, 57,169, 67,181,232,226, 85, 68,159,142,240,174,140,188,171,192,229,231,160,
-255, 56, 28,124, 28,210,243,126, 89,141, 80, 55, 54,125,218,254, 18,236,126, 12,189,245, 10,252, 42,232,255,171,228, 91,231,212,
- 58,176, 61, 80, 30, 97,242,128, 93,101, 82,216,198,  6, 81,145,137,141,100,201,235,237, 96,246, 11,103,146,121, 39, 27, 29, 13,
- 91,242,190,250, 71,226,140,239,149, 11,157,108, 83,167,155,199, 87,246, 98, 38, 39, 37,245,212, 37,202,156,112,229,197,116,130,
-160,120,174,249, 56, 81,191,204,213,208, 43,156, 47,236, 96, 34,  1,209,185,175, 13,213,109, 78, 46,124,212, 54, 98,111,  2, 51,
-157, 47,  1,193,187,238,185, 24,153, 40, 46, 54,179,195,124,125, 33,182, 68,182,229, 16,251, 66, 71, 47,147,168,176, 78, 10,243,
-206, 19,234,170,202,133,210,184,152,234,121,  1, 42, 94,124,157,158,239,103, 83,157, 18,199,150, 99,241,165,214,161, 94,228,178,
-188,205, 36,119,249,221,101, 31,163,126,161, 67,159, 27,221, 37, 61, 79,246, 44, 15,115, 65,111, 23,131, 40,226, 92,  2,153,255,
-124,203,  3,240,236,120, 93, 88,241,166, 39, 66,218,  4, 73,166,221,114,101,145, 95, 47,238, 98,242,103,106,185, 10,145,  6,156,
- 10, 50,171,235,125,188,174, 11, 76,175,182,149,129, 79, 20, 82,138,132,152,236,189, 84, 69, 82,178, 66, 91, 43,185, 20, 75, 95,
-163,238,241,230,247,200,121, 33, 80, 67,160,148,108,161, 47, 19, 23,192, 52, 22, 42, 51,251,128, 69,158,193,164,198,208,178,135,
-136, 23,185,128, 21, 92, 68,224, 38, 36, 52, 14, 10,161, 84,214,100, 86,154, 81, 57,129,221,134,114,250,  8,137, 38,213,142,  8,
-157, 40, 93, 44,244,197, 30,223, 34, 66,  8, 38, 56, 41, 85,208, 26,201,213, 68,106,181,152, 77, 41,104,157,124,126,218,104, 49,
- 91, 65,250,222, 14, 71,140,252, 37,163,119,164,181,129,115,117,142,189, 68, 40,154,247, 62, 72, 45,172, 33,214, 74,162,114, 88,
- 11, 87, 74,225, 40, 64, 58,234,145, 43,107,228, 15,172,224,119,101,228,137, 75,208,125, 63,196,239,134,110,132,221,223,129,237,
- 47,192,253,151,208,207,111,224,147,  9,125,185,167,158,141,212, 60,160,117,152, 72, 65, 53,217, 77,191,150,166,216,100,102, 24,
-203,227,162,140, 61,239, 14,139,192,130,197,248,105,250,196, 92,136,  4, 94, 94, 71,155,186,177,113,140,165,206, 47, 75,251, 80,
-  4,119,  9,172,215,118,184,158, 15,240, 96,103, 93,213,245,104,183, 76,182,160,103,138, 94, 18,228, 60,195, 67,108,102,250,176,
-192, 65, 52,141,194,203,  5,121, 54,163,215, 59,248, 72,135, 92, 91,195,111, 41,241, 13, 88,  7, 33,171,192,202, 82,136,234,231,
-171,169,142,255,253,235,200,147,  7,112,115, 99, 41,114,193,242,188,249,222,158,242,226,128,190, 57, 34, 81, 89,128,114,231,196,
- 46,103,169,  4,224,252,165, 76, 95,252,113,182, 58,141, 30,  7, 83,187, 99,241,187,168, 88,113,255,112,164,187,218,193,135,123,
-163,205,189, 41,200,251, 15,144, 67,224,224, 85,228,232, 67,208,253, 37,232, 62, 48,167,147,253,182,215,226,100, 72,186, 18,108,
-215,156,255,  2,124,238, 37,248,107, 35,229,139,103,148,211,108, 81,184,143, 42, 82,132,112,220, 35, 31, 58, 38,252, 11,151,144,
-111,190,140,188,243,253,112,244, 97, 72,223,  9,114,205, 11,248,  8, 53, 67,121,217,119, 39, 79,248,252, 53,188,253,207,162, 25,
-228, 30,232, 79,194,238,111,194, 27,175,192,207,117,240,203,  1,221,157,195, 42, 27,227, 32,  6, 36,118,118,187, 91,  5,244, 70,
-130,247,239,144,247,  6, 56,254, 14, 56,248,227,208,127,  3,132,195,197,237,241, 12,242, 87,224,252,255,134,243,159, 69,191,250,
- 16,126,178,163,190,184,163, 12,231,148,152, 25, 68, 57, 43,182,238, 25, 90, 68,230, 66,223,212,208,205, 77, 76, 93, 44,112,207,
- 30, 93,119,167, 36,148, 94,132, 97,121, 25, 93,136,154,132,101,178,214, 92,224,202, 66,225, 27, 38,234,153, 46,210, 18,141,174,
-146, 11,148, 32, 70,236,242,206, 10,215,228,168, 23,232,246, 76, 21, 85, 52, 43, 69,139,243, 54,132, 21, 66,205,202, 80,235,  4,
-231,147, 11, 99, 78,241, 11, 67,213,249, 66, 17,188,235, 44, 58,255, 90,177,207, 91,179, 35,137, 24,221, 55,  8,220, 45,243,120,
- 58,136,208, 97,208,171,176,176,173,114, 65,212,214, 76,230,170, 50,141,211,219,247, 14,139,130,222, 14,241,186,136, 29,217,191,
- 28,201,228,162,215, 61, 21,157, 46,211, 81,253,125,219,167,239,201,194,192,215,158,210, 42,179,149,109, 89,136,117, 49, 29,145,
-199, 85,130,254,188,204,153,236,149,101, 22,138, 78, 32,161, 25,198, 42, 83,246, 89,149,253,142, 63, 46,  4,145,186,140, 87, 69,
-167, 92,245, 54, 53,105, 77, 99, 27,225,  7,177, 73,176,248,229, 46, 68,235,148, 69,162,173, 76,130,236,121,224,165,121,231,221,
- 19, 30, 93, 85,175,110,119, 20,135,244,140, 30,214, 18, 83,242,177,123, 65,199,209, 34,127,107,181, 41,227,130,224,143,175,109,
-164,235,205,202, 93,234,196,154, 87,239,242,219, 67, 35, 81, 30,163,236, 77,160,154,162, 51,161,175, 77, 40,218, 11, 35,251, 50,
-248,164,197,126,176, 65, 18, 53, 23,250, 80,233, 36, 32,169, 39,156, 62, 98,172,149, 34,145, 64,101,229,194,179,180,  8,125, 79,
-193, 60,143,187,106, 34, 19,  3,203,204,190,235, 80,203, 20,191, 23, 53,184, 88,166, 16,242, 56,101, 68,119,238,223,212,152,168,
-227,232,188,118,127,108,106,157,185, 29,117,113,227, 13, 16,171,221, 84,187, 90,185, 92, 50, 87, 68,232,143,215,200,165, 21,242,
- 97,133,239, 79,200,  7,158,128,248, 93, 16,126, 31,240,  0,118,255, 19,188,246, 34,250,250, 25,124, 13,120, 41,162,175,245,212,
-243, 76,213,173,169, 23,107,153, 33, 19, 50, 71, 11,234,226,  1,154,212,186,139,235,108, 27,211,237,125,136, 10,110,153,154,  3,
-197,216, 67, 62,202,219,166,244,168, 94,184,132, 45,254, 99,235,148, 86, 81,233, 59, 39,200, 10,156,111,109,186,222,101,120, 74,
-225,248,133,  3,248,214, 35,194,234,  0,174, 29,216,174,121,147, 93,142, 47,150,189,221, 85,228,219,119,112, 71,225,134,203,161,
-142, 42,242,206, 35,248,214,142,244,185, 45,233,179, 35,171,175, 95, 81,127,229,156,241,203,  3,233,195,135,200,191,251,132,133,
-141,124,225,  1,124,126, 11,175, 43,124,104,  5,215,122,244,201, 14,125,119,111,236,246,251,195,188, 55,146, 25,122, 33, 69, 41,
-209,124,198, 53, 43,185,179,184,211, 85,198,210,231,214,  1,118,126,196,100, 39,183,109,130,217,204,158, 92, 25,237,238,174, 34,
-151, 59,131,177,231,183,144, 39,191,  9,214,127, 11,210,117, 27,171,235,153,183,136,235,183,217,  2,250, 13, 66, 15, 64, 30,192,
-240, 31,193, 47,255, 58,245,191,129,250,234,150, 58, 22,184,220, 19,223,125, 68,248,174, 35,228,187,174, 32,207, 29,195,225, 26,
-186, 99,251,115,163,192,163, 79,160, 55,255, 30,250,217,219,232, 43,  3,225,247, 95, 67,158,255, 51,176,250, 30, 39,227,108,108,
-132,194,193,133,154,126,  6,250,  5,216,253,117,184,255, 51,240,210,125,187, 88,254, 86,143,106, 70,201,212,206,189,141,213, 93,
-225, 93, 48,160,208, 51, 17, 62,176, 67,222, 25,225,232,123,224,232, 79, 65,255,254, 57,161,205,114, 23, 97,252, 26,156,253,117,
-120,248, 75,232,103, 51,250,143,123,244,230, 72,233,183,212,243,204, 80, 42,103,152, 32, 63,123, 62,120,104,123,215, 38, 46, 11,
- 30,173, 60, 59,105,102,138,151,103, 15, 73,128,174,170, 91,219,108,224, 47,161, 49,225,103,222,187,138,238, 57,157,130,234,162,
- 27,217,183,116,165,230,237, 13, 80, 26,160,164, 84,235,148,177,241,125, 13, 22,136, 81,151,118,173, 90,173,243,118,161,211, 80,
-237,188, 90,251,104, 91, 20,206,202,156,115,158, 23, 99,255,  6,250, 16, 92,221,175,115,136, 72,155,  7,182,103, 39, 47,125,199,
-218,252,237,226,150, 54, 59, 20,218,190,183, 42,123, 69, 78, 23,175, 95, 93,  4,175, 84,199,255, 46,127,239, 52, 90,175,139,221,
-244, 36,121,171,123,103,200,236, 75,223,135,  2,161, 60,150, 63, 22,216, 23,141,181, 64, 24, 97, 57,109,120,188,147, 23,246,173,
- 84,203,189,241,148, 64,216,150,161,178,223,157,207,246,182,139, 73,100,138,134,102, 44,191, 72,133,123,108,233,224,147, 15,217,
-215, 45, 41,116, 49, 16, 83,164, 15,137, 24, 19, 33, 70,243,144,203, 68,206,113,226,161, 78,255, 84,173,190,218,173, 19, 43,191,
-169,234, 83,215,209,197,142,212,119,196, 16, 38, 33, 94, 74,157, 79, 11,132,243, 97,199,176, 90, 51,148, 66,206, 35,165, 20, 74,
- 85,198, 50, 82,198,129,154, 71, 68, 13,139,174,165,236, 65,111,150,186,  9,  9, 50,191,234, 77,192,235,211,134, 41,201,237,237,
-116,253,178, 39,201, 68,204, 89,161, 84,  9, 12, 33,178, 11,129, 94, 34, 93,239, 55,233, 97, 75,  8,129, 24, 18, 41, 70,122,170,
-225, 86,147,249, 58, 27,222,180, 86, 33,103,101, 91, 96,168, 25,213, 56,177,161,139, 42,181, 75, 70,254, 41,101,242,148,138,102,
-187, 28,168,  5,204,135, 46,145, 83, 66,106,153, 70, 19, 97, 82,130,122,  8,135,191,201, 61, 66,168,153, 64,101,157, 43, 87, 75,
-229,136, 68,184,118,128,124, 52, 16,126,  0,248,134, 15,192,193, 15,130,126, 39,212, 35, 24,127,  2,125,253,175,193, 47,158,193,
- 75, 29, 60, 90,161,231,153,186,115,129, 67, 53,119,185, 58,111,185,169, 33,107, 35,213,213,253,220,228,233, 17, 43,115,236,227,
- 18,210,208, 58, 25, 60,158,179,237,215,162, 52,177, 78,179,177,232, 20, 69,168, 11,161, 76,149,  9, 68, 52,141,169,219, 39,196,
-223,255,233,235, 14, 21, 78,207,224,108, 52,149,241,115,  1,142,159, 95, 33,223,127,213,138,208, 46, 26,188,100,157,204,239,220,
- 24,170,138, 21,196,163,222,198,229,219,130,190,248,  8,253,201,251,  4, 45,200,147, 98, 20,189, 63,127,221,114,  0,126,106,199,
-234,251,143,224,  7, 47, 25,124,253,215,239,194, 63, 60,133,251,  5,190,227,  0, 46,245,182, 31, 88, 11,114,163, 55,143,251,205,
-209,118,153, 46, 38, 44,101, 74, 32, 53,203, 80, 81,182,126,217,137, 10,114, 37, 32, 43,161, 12,190,115, 56,138, 70,165,234,163,
- 41,218,123,215,  6,124,169, 90,168,201,251,128,243,219,200,  7,190, 17, 46,253, 24,232,  3,208,191,231, 84,151,111,  4,158,127,
-251,130,222,110, 24,245, 77,184,247,175,162,127,251,139,212,191,210, 91,134,253,247, 95, 35,253,192, 37,194,  7, 46,193,165, 67,
- 91,180,138, 39,228, 61, 56, 69, 95,121,131,250, 43, 15,169, 63,123, 74,125,109,139,222, 43,  6,175, 73, 80,255,230, 45,194,135,
-126,  4,249,143, 63, 66,120,225, 47, 64,247,188,127,191,  7, 46,130,251, 77,216,254, 19,120,248,179,232,171,111,161,159,170,240,
- 27,107,244,245, 14, 98,166,166,115,232, 21,237,188, 53,206,201, 58,140,131,136, 92,234,224,217, 21,242,117, 91,120,199,122, 46,
-232,221,123, 93, 31,176,155,180,234,228, 91, 48,252, 61,120,244,139,232,175, 84,244,147,  9,221,141, 20,217,160,247,182,236,182,
-112,234, 17,169,109,125, 20,151, 49,162,190,227, 93,238, 68,219,180,178,  4,115, 86, 68,204,157, 23,247,104, 97,179,184,142,104,
-248,232,182,136,174,194,222,165, 92,203,133, 69, 41,182, 62,178,253,180, 81, 46, 41,173,147,174, 22,187,233, 23,133, 16,125, 87,
-238,116, 57,251, 18,117,  6,212,104,219,237,234, 36, 66,139,106,160,191,222,141, 31, 59,223, 95,123, 42,182,239, 37,117,218, 47,
- 71, 95,  5,166,226, 89, 22, 30,241, 89,246,118,195, 86,208,207,213,132,123, 54,222,173,123,148,175,101,231,220,  4,107,114,161,
- 73,104, 83,172,246, 26, 38,167,198,  5,229,226,198,122,138,173, 21,239,229,151, 17,168,123,211,238, 58,219,196,248,109, 24,112,
-178, 40,242,203, 79, 73, 81,221,179,123,233,126,  9, 95, 76,153,229, 49, 42,218, 98,  8,137, 59, 87,169, 75, 11,123, 99, 83, 52,
-107,180,159,109, 77,  9,175, 11,191,127,184,168,190, 95,236,186,155,250,109, 21, 34,253,170,167, 79,189, 77, 38,101, 86,139,103,
-247,139, 55,193,246,228,252,241,155,102,148,232,150,226, 64,173,126, 17,107,209,187, 37,163,209,242,  3, 36, 70,183,112,167, 41,
-108,104,204,133, 92,202, 76, 11, 76,137, 46, 38, 42, 74, 87,123,198,213, 26,205,227,164,142,207, 11,161,247,180,142, 16, 22,163,
-243,233,176,159,169, 63,211, 62,136,189, 36, 57, 31, 29,237,121,218,155,195, 32,165,100, 30,113,201,202, 86, 11,171,160, 22,  4,
- 49,236, 40,187,115, 98, 54, 86,112, 18,251,144, 75,  4, 73, 29, 33, 85, 59,228, 20, 80, 27, 85,103,215,239, 84, 45, 83, 96,131,
-229,164,103, 98,138,136, 99,  3, 82,  3, 17, 20,179,186,105, 13,140,181, 24, 35, 94,162,129,109, 88,176,139, 77,209,231, 99,124,
- 37, 81,233,107,229, 68, 11,199,187, 64,234,214,132,247,118,200,159,  0,249,248,187,225,202,191,  6,225,247, 64,184,102,150,161,
-179,191,128,126,225,167,225,199, 59,120, 45, 81,115, 54, 48, 64, 41,104,205,118,192,  4, 75, 77,211,176,175,236,208,197,195,180,
- 55, 62,126, 27,143,160, 46, 88,198,161, 50,133,216,180, 67, 44,121,151,170,222, 44,215, 11,176, 34,163,183, 90,210, 93,187, 68,
-168,103,186,136,168,177, 77, 60,200, 45,186,205,109,244, 67, 96,200,246,231,159, 70,185,244,142, 30,190,249,192,178,220, 31,130,
-156,103,219,  1,  5, 87,191, 71, 93, 40,128,189, 19,222,217,  7, 76,207,171,161, 71,213, 41,104, 47, 13,240, 98,182,246,235, 15,
-172,225, 27,162,113,218,255,241,134,242,202,104,241,173, 69,233, 62,179,133, 39,  2,188,223,101,233, 59,224, 41,231,161,223,207,
-148,245, 62,199, 89, 27,  9,206,195,128,114, 86,202, 65, 64, 46,  1,119,213,186,232,203,193, 72,110, 87,123, 51,234,171,229, 22,
- 79, 57,158,183, 10,242,234, 93,228,187, 34, 92,249,159,173,251,149, 53,240, 61,192,203,192,  7,125, 87,253, 54,142, 90,205, 48,
-252, 99,120,240,231,208, 79, 63,128,235,207, 16,254,198, 49,188,243, 18,172,220, 15,189, 27,224,193, 67,244,107,231,212, 95,124,
- 64,254,249,115,202,171, 27,242,131,209, 48,200, 43,208,163,136, 62,  3,161, 19, 58, 17,186, 26,136, 95,  1,249,215,127,  3,253,
-221, 63,136,252,145,107,200,213,222,214, 29,247,  6,120,237, 12,125, 69,224,206,  1,122,247, 16, 54,138,134,140, 94,221, 77,221,
-152,133,183, 40,172, 44,  8, 70,106, 68,142, 59,228,157,  9,190,225, 28,158,186, 12,135, 63,  0,  7,127, 12,210,115,166,164,183,
-113,134,245,201,186,131,252, 51,112,231,239,163,191,148,209,127,190, 70,183, 91,202,253,115,202, 27, 27,206,179,114, 38, 98,153,
-231, 42,115, 54,119,219, 31,239,229, 99,207, 71,186, 22,235, 80, 69,103,145, 21,227,140, 40, 77, 14,207, 11,139,  2, 86,131, 23,
- 38,173, 38,158,243,162, 91,124, 15,149,252, 89,239,253, 86, 43,110, 81,203, 77,205,173,179,245,172,226,220,236,246, 51,121, 72,
- 75, 93,164, 55,  6,143,  9,147,170,150,237,238,227, 93, 31,246, 76,135,121,138, 50, 55, 30,  4,106, 10,116, 77, 47, 83,161,102,
- 27,116, 31, 68, 37,138,173, 19,243, 20,184, 34,123,126,251, 81,149, 17, 49, 79,126, 19,244, 77, 34,172, 38,172,155, 63,232,177,
-101,128,235, 50,249,108,150,198,139, 66,148,234,129, 67, 77,  7,208,188,227,117,178,131, 70,183,208, 22,213,125,  4,220, 82,198,
-182,224,179,215, 11,133,120, 41,154,187,168,100,159,123,  8, 93,128,105,228, 49,192,218,227, 10,248,133, 50,223, 45,118,211, 14,
-152,118,249,114,174,251, 34, 14, 53, 74, 36,122,114,217, 88,171,101,  9,132, 54, 22,183, 12,245,177, 20,155,160,185,107, 33, 74,
-160, 75, 29,169,235,  9, 41, 78,176, 30, 45,121, 47,223, 94, 38,207,119,152, 50,222, 67,176,175,107, 35,121,219,223,103,119,120,
-149,106, 23,187, 20,125,  9, 36, 98,235, 28, 21,  6,169, 72, 45,140,170,108,135, 29, 99, 46, 20,167,195, 45,133,138,168, 61,127,
-177, 95, 17,186,158, 93, 30,145, 16, 41,195, 72, 45,  6,168,153,128, 57, 23,111, 68, 58,135,181, 40, 51,183, 96,207,202,118,193,
-235, 63,  9,  1,171,146,242, 80, 44,236, 32, 12,236, 42,156, 82,169, 49, 81,119,149,176,217, 17,164, 78,232, 84,170,239, 22,197,
-195, 41,142,123, 24, 10,186,117,116,107,105,162, 49,117,209, 76,180, 34,165,149,190, 40,169, 55,254,186, 37, 48,153, 37, 68, 85,
-169,238, 47, 55,250, 92,103,187,206, 90,136,213,110,223,154, 71,208, 74,196,194, 86, 86, 89,185, 50, 42,171,176, 34, 60,181, 34,
-252,145,138,252,192,101,120,250,207, 66,247,135,129,107, 62,255,251, 10, 60,250, 81,244, 51,191,  9,255,160, 71, 95, 55,108,173,
- 82,156,244,229,  4,179,184,  8, 83, 17,157,176,179,109,103, 94,203,252,122,199,199,200,217,186, 76,213,155, 62,148,102,127, 94,
-140,213,235, 28, 92, 16,124,156, 25, 23, 23,129,230, 16, 16,223,147,247,189, 71,136,186,202,120,229,128,157, 92,140, 69,146,157,
-123,146, 92, 28,184, 78,194, 81, 81,174,157,  4,228,235,122, 56, 11,240,178,229,163,211,139, 41,203,215,217,150,237, 71,222,174,
-164, 96,150,177, 85,178, 47,184, 29,145, 15,154,255, 90,223,218, 34,247, 71,144,  1, 94, 29,224,155, 86,182, 43,254,177, 45,249,
-179, 59, 54,219,204,112,100, 83,154,213,137, 32,247, 11,233,231,206,205,  7,255, 76, 15,135, 22, 16, 35,223,216,211,253, 82, 65,
-182, 22,209,186, 87, 90,117,246,145,170,  8,227, 80, 25,190,  4,105, 29,225,122,176,164,184, 75, 78,125, 83,144, 65,224,190,213,
-118,182,231, 72,127,142,124,223, 21,120,225,199, 49, 91, 67, 92,124,117,119, 53,224,222,239,229,199,161,110, 96,252, 77, 24,254,
- 50,244,151,145,111,123,  7,196,  3,187,205,111,118,232,171,143, 40,191,250,128,242, 51,143,216,125,246,156,241,225,200, 80, 43,
-185, 19,198, 99, 65,159, 17, 74,151, 88,202, 63, 66,177,184,217,117,172,172,175, 10,171, 49,194,175,  1,191,118,215, 46,  9,135,
- 46, 22,  8,107,155, 58, 60, 33,112,185,160, 93, 65,183,217, 81,109,205,180, 12, 72, 66, 46, 37,194, 81, 71,168,157,141,220, 63,
- 50,192,179,239,134,195, 63,  6,253,239, 51,149, 61,163,167,170, 36,187,208,232, 22, 54,127,  7,253,234, 95,132,159, 29,208,155,
-135,212,  7,103,148, 55,207, 24,239, 13, 54,110, 23, 97,172,236,199, 97,182,255,221,198,204,139, 73, 80,172, 83, 48,226, 36, 26,
- 83,109,177,165,115,164,106, 90, 36,131,181, 32,141,184, 88,253, 37,255,156,100,221,135,173, 20,153, 85,230,109, 93, 88, 23,163,
-222,226,251,199,204, 92, 36,140,157, 45,143,133,119, 68, 22,185,234, 64,231,208,142, 34,182,182, 42, 42,148, 96,157, 86, 41,118,
- 96,135,208,236,188,179,176, 73,189,226, 14, 84,122, 49, 61, 17,226,198, 89,245, 64, 40,255,187,108,105, 10,119,231, 74,  0,131,
-234, 98,251,189,124,230,213, 35, 89,101, 66,207, 46,  3, 61,130, 95,122,218,142,125, 18,215, 79,141,132, 76,231,203, 76,135,243,
-124,246,197, 94,126,207,211,188,112, 88,201,219,164,128, 45,235, 73,148, 89,  4,172,178,180,202,201, 50, 47,101,138, 62,213,133,
- 61, 45,184,235, 97,210,134,225,129, 59, 58, 19,239,218, 42,184,177,223, 45,125,204, 60,237,181,214,133,216,205,117, 24,205,102,
- 40, 17,237,172,  3,143,197,128,101,171,148,  8, 93, 15, 18,200,254,103,155,134, 35,180,191,140,119,105,109,188,173,126, 45,211,
-150, 36, 40,197, 38,197, 33,152,102, 44, 38,194, 42, 18,137,211,100, 73, 28, 24, 19, 68,168,181, 48,162,108,119, 59, 74,206,211,
-168,158, 16, 93,147,225,147, 94,199, 18,167,212,161, 33,208,197,104,206,142,110, 69,209, 66, 41,133, 90,178, 93,168,115,165,120,
-161,159, 58,238, 16,125,151,206, 30,197,144, 32,147,166, 33, 44, 40, 52,138, 76,226,201, 68, 49,  2,206,224,235,187,141, 84,164,
- 10, 33, 27, 10, 54, 52,177, 69,117,144,129,  8, 34,217, 89,215,214, 50, 86,  2, 37,  4, 98,200,172,198,106, 33, 42,192,202,183,
- 31,198,136,175,200,232, 31, 10, 41,147,194,143, 26,220,152,143, 37,153,213, 64,151,162,141,195,199,  1,212,242,187, 87, 94,127,
-142,134,202,241, 86,232, 47, 29, 34,223, 25,  8,127, 50,194,251,191, 23, 14,255, 67,144,119,216,155, 88,111,193,238,239,194,157,
-191,129,254,198, 67,248,153, 21,245, 86,246, 27,146,119,232,158,184, 68, 85,164, 10,218,114, 19,202,156,198,212,110,237,203, 29,
-121,184,144,142,163,236,135, 45, 44,133,113,234, 31,242,118,104,182,209,121, 10,179,216, 46,182, 81,188,119, 52, 77, 19,214, 69,
- 56,232,108, 60, 58,250,215, 57, 58,180,236, 22,173, 48,238,102,110, 74,136,230, 20,184,210, 41,253, 19,189, 21,141, 51, 69, 98,
-133,119,121, 46, 55, 61,220, 88, 27,228,100,187, 80, 63,117,142,171,235,128,212, 33,207, 95,182,221,251,237,173,177,196,239,110,
-224,214,104, 56,210,223,170,112, 69,144, 94,201, 89, 25,130, 61,112,171, 67,168, 61,232,205,140,124,226, 12,126,175, 88, 49, 46,
-192, 90,233,158,207, 28,189, 56, 24,116, 71, 22,169, 73,126, 44,212, 98, 44,237, 20, 33,174, 34, 60,149,224,106, 66,142,  2,156,
- 11,122,223, 46,150,  6, 54,218, 32,223,164,240,245, 79,192, 59,127,  4,142,254, 48,112,228,163,129,193, 59,243,222,186,118, 10,
-112,105,255,  2, 86,238, 67,249,103,192,255,  5,241, 14,148,  3, 11,177,249,226,215,168, 63,255,128,252,243,143,216,125,109,199,
-102, 24,217,246,129,124, 24, 40, 55,160,244,145,170, 22,209,105,171,169, 89, 77, 29,130,144,212,120,  5, 69, 97, 68,201,177,208,
- 95, 18, 18,129,208,249, 62,185,203, 72,231, 91,230, 18,141, 36,215, 18, 80,155,223,175,243, 78,179,139,132,117, 36, 28,216,202,
- 68, 62, 88,224,153,103,225,210,159,131,240,113,143, 31,202,126,212,247, 86,208,235, 91,112,255, 63, 69,127,227,167,209, 79,159,
-192,157,  3,234,171,143,200,175,159,115,186,203, 60, 20,177, 32,184, 58,219, 76,169,179,103, 90,155,142,197,171, 70, 83,129, 19,
- 76, 68, 91, 36, 76,151,221, 41,251,154, 11,  4,185, 69,140,104,150,  5,240, 99, 49,197,234, 74,155, 43,168,101,109, 87,101, 25,
-135,141,175,165,162,119,217,226, 29,105,235,216, 91, 33,105,187,116,243,146,219,119, 25,140, 45,138,  4, 83,144,219,175,211, 12,
-180,114,235, 89,245, 27,122, 85, 65,181, 80,135,106,127,231, 69,251, 89, 34,108,137, 32,193,158, 77,183,175,138, 51, 93, 27,103,
- 66, 84,167,184,231, 56, 81,217,116, 47, 55,125,222,161,234,100,169, 43, 83,131,224,182, 50,159, 75, 23,140,245, 81,117,129,133,
-209,185, 36,  5,143, 91, 45,203,216,211,133,104,109, 46,184,179,200,172,157,195,203,166, 94,222, 38, 57,109,201,211,152,146,218,
-150, 65, 11, 75,113,225,158,147,158, 61, 79,249,146, 31, 63, 71, 27, 47,244, 21,139, 75, 70, 20,153, 28, 69,139,235,220,100,235,
- 85,239,156,251, 24, 72,171, 21, 99, 46,172, 17,250,126,133,  6,115, 68,209, 44,142,139,231,175, 46,198,221, 90,152, 46,225,203,
- 85, 66, 16, 38, 12,112, 12, 66,138,137,149,246,196, 78,136, 18,168, 18, 76,221, 14, 20, 50, 21, 97, 44,153, 50,142,243, 36,203,
-187,126,131,168, 25,217,174, 74,182, 29,189,197, 64, 18, 37, 16,131,173, 61,149,206,214,210,165, 80,171, 82,180,146, 75,166, 44,
- 20,244, 85, 21, 29,199,169, 80, 52,128, 79, 99, 22, 72, 11,158,241, 55, 88, 23,102,247, 84,203,104, 35,  0,177, 15,206,161,152,
-  0,173, 25,221, 27,106, 85,170, 16,131, 18,163,237, 60,109,214, 84, 97,151,237,  3, 65, 96,157,162,229, 18, 47,136, 62, 59, 23,
-118,153,138,221,225,247, 45,161, 76,236,107, 35,193,114,216,181, 82,243,134,113, 51, 18,138,133,204,119, 33, 88, 24, 86, 80, 14,
- 55,149,131,146,136,239, 57, 36,252,153,138,252,174,167,225,234,143, 64,252,221,216, 44,244, 28,134, 95,129, 71,255, 29,124,249,
- 43,232, 63,235,225, 83,  7,212,179, 29,165,238, 12,155, 58, 65,246, 27,  1,102,225, 89,109, 81,174, 77,225,209, 48,143, 45,136,
-128, 69,103, 22,108, 95,152,219,110,204, 79,181,198, 49,174, 11,192, 76,155,168,182, 93,159, 52,253,147, 43,137, 71,247,189,167,
-133, 26, 37,  2, 71,  7,150,156,121, 54,216, 23, 57,232,172, 89, 62,117,131,111, 10,182, 38,239, 20, 46,103, 56,186,222, 89,238,
-248,198, 69, 63, 87,147,125,147, 46,192,183, 94,131, 43,199,240,202, 29,187, 61,244,  2,125, 54,122, 75,116,108,108,131, 81, 95,
- 90,219,254,250,114,  7,183, 18, 60,177, 67,223,218,193,121, 65,174, 42,241, 61,129,227,255,231,140,250, 96,164,174,172,209,143,
-107,195,147,242, 32,195,231,183,132,119,173,108,157, 49, 40,250,129,158,131,219,153,237,173,202, 89,191, 63, 10, 20,236,185,143,
-206,153,  9,215, 44,137, 77, 82, 64,118,  1,198, 64,184, 19,224, 16,248, 24,240, 29, 31,132,167,254, 51,144,223,225, 87,167, 87,
- 97,247, 15,224, 19,127,  5, 62,247, 38,124,236,221,240,142, 63, 12, 39,223,  4,171,239, 53,168, 11,  5,244, 33,148, 95,135,252,
-191,193,246, 11,232,131, 13,250, 98, 64,127,106,195,248,243, 15, 25,238,237,216, 69,101, 56, 20,118,215,133,177, 75, 12, 34,174,
- 11,241,100, 84, 15, 79,107, 63,255, 44,236,178, 15, 92,244,223,155, 11,108,131,125, 48,147, 40,105,204, 46,168, 10, 72,177,  7,
- 37,244, 78, 56,233, 60,237,173, 90, 90,161, 68,131, 84, 72, 31,  9, 99,176,142,253,134,194, 13,129,163, 63,228,  5,253, 10,243,
- 83,117,226,192,159, 95, 67,191,244, 39,225, 87, 79,225,245, 39,208, 91,149,242,133,123,108,239,110,121, 20,148,211, 96,132,184,
- 80, 61,217, 76,205, 18,170, 50,135,141,236, 73, 55,235, 60, 70,204,158, 73, 52,169,214,253,247,166, 69,119,231,122,251,137, 56,
- 87,  2, 72,149,105,132,222, 10,203,116,206,138,135,207, 85,157, 71,249, 14,230,208,133,136, 42,  6,136,181,169,148, 43,227,172,
-180,153,172, 90,211,168, 85, 26, 29, 28, 79,  7,243,160,146,226,121,214, 49, 46,186,233,202,206,  5, 51, 90,150,183,117,153, 80,
-172, 21,211,130,156, 41,164, 81, 89, 75,157, 88,226,203,  0,166,224, 93,178,250,152, 46,136, 93,242, 26, 25,207,118,196, 46,109,
-107,217, 22, 23, 35, 78, 23,211,190,234, 65, 49,117, 26,174,154,130,126, 18,221, 53,237, 64,235,116,167,232, 96,153,243,205,247,
-242,213,231,225,121,185, 80,208,151,232,243,165, 30,232, 49,239,186, 46,236,119,111,115, 33,104, 25, 30,123, 49,167,178, 15, 78,
-159,158,149,230,  4,241,213,155, 44, 64, 53,210, 28,242,238,150,106,148,247,166,198, 63, 73, 61, 97,157, 16,  2,185, 22,134, 90,
- 38, 37, 57, 90,167, 75,128, 46,  0,183, 75,146,253,242,181,144,197, 37,132,134,107,245,207,118, 41,133, 56,137, 38, 35,136, 48,
-214,202,152, 51,121, 28,231, 63, 31,  2, 81,194,  4, 16,209, 96,126,174, 64, 71,140,102,187,204,165, 64, 80, 15,126,137,182,106,
-206,  6, 79, 91,247,  9, 73,145, 49, 23,198, 82, 24,134,157, 53,157,  2,163,215,167,170,185,233,228,155,  1, 16, 87,140, 78, 60,
-151,229,223, 51,137,223, 22,186, 20, 72, 98, 56,214,136, 49,205,197,193,229,198, 85,175,182,127,  9,126,  8,197, 54,139,174,118,
-163,144, 72,144, 72, 31,109,100, 98, 67,238,234,160,136,  6,139,176,244,182, 16,133, 80, 33, 68,143, 87,205, 35, 99, 19,210, 53,
-202, 82,176,155,217, 90,148,147, 12,199, 69,233,226,  1,225,219, 86,132, 63, 39,240,254, 31,132,245,127,  0,242,164, 47,251,190,
- 10,155,255,  1,222,250, 89,244,211, 25, 62,121,136,190, 81,168,155,115,223,159, 87,106,174,179,191,116, 17,125,164,137,249,218,
-173,123, 27,242, 89,160,230,173,119,235,166,171,206, 69,122,138,140, 92, 20,171,184,192, 65,206,171,210,197,247,244, 59,132,191,
-111,243, 77, 57, 48,141,178,250,  0,235, 35,123, 61, 74,113,140,120, 50,146,220,218, 79,212, 67,224,210, 78, 57,188,158,144, 27,
-107, 88,117, 22,237,167, 66, 56, 15,134, 87, 93,117,240,214,  6,238,109,173,152, 95,139, 54, 30,239,122,  8, 79,128, 94,133,248,
-121,200, 91,139,251,108,137, 98,193,178,192,245, 48, 82,159,235,145,179, 98,162,176, 35,161,251,174, 67,174,254,211,115,106, 41,
-164,147, 54, 94, 16, 56, 16,228, 97,133,215, 70,228,190,137,139,234, 13, 33,188,167,231,202,102,135, 14,202,249,194, 31, 35,126,
-152, 30,  6,232, 14,131,161, 60, 75, 64,206,  5,222,244,232,210,111, 63,128,223,127,  3,158,253, 62,144, 63,226,127,248,239,194,
-253,255, 29,126,227, 37,248,171,103,240,115, 25,214, 61,172,191,  6, 31,251,139,240,111,119,240,194, 85,208, 39, 13, 87,183,219,
-192,221, 51,120, 69,168,255, 60, 82,127,102,160,190,114, 78,201,  3, 15, 66,229,193, 59,  2,181, 11,214,105, 23, 19, 64, 86,103,
-212,140,139,160,157,234,177,231,173,164, 38,241,226, 37,179,192,177, 86,203,121,151,232, 59, 95,177,125,115,200,214, 45, 74,  0,
-221, 41,178,170,150,197,126,152,144, 28,145,222,  4,129, 82,130,253,129, 62,194,141, 10,239,221,194,209,215, 67,250, 54,239,208,
- 23,  9,107,188,  1,183,255, 29,120,241, 19,240,171,  7,232,163, 27,212,219, 91,234,151, 79,217, 62,216,113,191, 19,118, 68,131,
- 32, 45, 46,140,193,185,211,206,129,153,149,208,178,192,117, 98,197,223, 36, 50, 66, 23,236,215,203,238, 92, 22, 32, 56,  9, 74,
-167,208,  5,101, 20,119,247, 85,123,189,180,204,119, 70,125, 27,241,147, 46,163,183,150,194, 94,181,110,115,237, 44,110, 93, 60,
-158,178,176,137, 52,118,154,103,238, 89, 71,174,226, 54, 41, 11,161, 42,163, 53, 48,113,234, 98, 61, 17, 46,137,255, 61,100, 82,
-196, 55,145,153,250,185,145, 17,106,132,181, 71,113, 54,162,164,250, 40,221, 86,  9,182,130,  9,173, 59,109,241,167, 50,143,245,
-138,143,236,203,210, 98,172,115,215,186,180,247,  7, 47,230, 81,247, 98,233,109, 21, 48,249,206,245,130,162, 93,246, 34, 90,245,
-194,170,182, 29,103,225,  2, 51,126, 63,135,116,182,138, 61,150,209,242,219,140,238,213,187,109, 89,196,172,182, 61,179,232,172,
- 79, 91, 50,229,219,191,171,186, 79,152,175, 62,253,  8,  8, 41, 69,186,148, 72, 33,178,142,137,163,131,  3, 82,234,184, 95, 10,
-219, 51, 27,129,215,150, 29,208, 38, 62,139,215, 69,101,150, 42,234,196,252,247, 61,254,130,250, 30,146,117,233, 49,118,123,183,
-158,160, 74,234,146,231,206,  7,116, 28,253, 89, 45,134,169, 85,165,198,197,  7, 72,148, 16,  3,171, 16, 72,253,202,206,136, 80,
- 40,181,184,246,161,210,135,136,174, 18,104,165,139,  9,237, 58, 42, 59, 74, 45,134,215, 85, 91,199,245, 93, 79, 77,206, 54, 16,
-198,  0,  0, 32,  0, 73, 68, 65, 84, 29,121, 28, 40,195, 48, 17, 87,223, 86,247, 59, 73, 24, 43, 73,125,199,211,169,178, 70, 56,
- 10, 16,171,221, 44,  2,115,192,253,  4,  0,104,172,140, 86,  8,147,189, 44, 53, 23,178,103,  9, 38,  7,209,107, 85,  6,212, 16,
-167,158,234, 20, 68,  9,197, 68, 16, 49, 59,141,162, 40,154,236,192, 91,185, 40,111, 37,202, 97, 86,142, 11,172, 74, 36, 94, 57,
- 32,252, 81, 65,126,232, 50, 60,253, 35, 16,191,207,126, 24,125,  0,219,159,134,135,127, 25,125,249, 13,248,100, 15, 47, 29,162,
-219,145,146, 71, 84,109, 17, 93, 27,237, 37,212, 11,128,221,201,231, 96, 66,165,  9,123,102, 35,143, 24,230, 32,  1,149,249,  1,
- 23,153,120,136,118,  3,150, 61,198,130,143, 44,231, 47, 23, 88, 48,165, 23,187, 43,113,144,204, 84,232, 23,142,  6,201,144, 78,
-  2, 71,201,138, 64, 12,246, 62, 29,172,129,157,210,141,202, 74,132,116,117,133,124,203, 17, 28,186,250,243,106, 50, 31, 93, 39,
-166, 72,127,114,101, 66,173, 85,180,157,247,170,194,106, 13,188,  7,248, 93, 32,191,229,239,107,178,255, 22,139,189, 47,181,122,
- 14,112, 64, 66,135, 30,  5,216,  6,100, 20,184, 46,132,239, 14,132,135,174,208,219, 85,120,171,218,173,164,157,108,217, 46,132,
-225, 77,168,125, 36, 62, 17, 57,188, 93, 24,243,226,254,228, 69,166, 79, 32,  7,222,169,222,  7,110,  3,223,122,  8,127,234, 89,
-120,223,101, 72,239,180,181, 74,249,207, 97,247, 26,188,120, 19, 62,149,225,142,239,168,255,141, 30, 62,118, 12,239, 62,178,226,
-206,  8, 95, 62,131,  7,119,224,213, 17,190, 34,112,119,109,240,152,113,160,202, 14,189,156, 57,143,112,175,  6, 30,141, 50,167,
-146,234,140,181, 44, 45,255,219,253,170,  5,177,176,161,133,191,185, 11,211,144,103,154,232, 88,241,145,169,  3,170,213,138,158,
-102, 87, 68, 38,139,210, 13, 41, 17, 14,220,153,112, 20,225,138,192,129,218,251,112, 56, 90, 30,250,181,119,155, 15, 61,220,240,
-217, 87, 48,  2,221,248, 99,240,202,127, 13,191,242,144,250,202,147,232, 78,208,219, 27,202,203,167,108,206, 70, 30,174,  2, 91,
-181,159,151,216, 58,107, 33,  6,123, 95,203,232, 89,219, 11,223,115,173,112, 33,146,122, 38,144,233,204, 91, 40,173,184,214,249,
- 18, 90,171,109, 20, 90,  7,223,123, 67,182,115,119, 67, 90, 98, 66,167,184, 81,220,194, 42,147,127, 26,157,133, 63,182, 79,182,
-162,107,176, 43,247, 53,123,145, 84,113, 53,122,176,228, 70,141, 97,206,234,198,184, 10,170,150, 25,190,155, 80,176, 22, 49, 29,
- 68,232,163,208, 41,236, 90, 96, 72,211,211,212, 58,185,190,  9, 86, 34,  6, 31,139,118,190,131,159, 39, 27, 86, 52, 82, 16,122,
- 95, 73, 13,101,145, 88,119, 65, 81, 43, 45,  6, 86,247,181, 58, 77,  0,183,212, 38, 72,109,107, 14,157,188,219,226, 10,124, 93,
- 20, 66, 46,248,199,  3,198,173,175,174,123,216,  3,191,200, 99,246,242,125,182,251,194,163,190, 52, 39,232,219,216,219,150,202,
-121,149,253, 92,111,120, 92, 80,215,  8,161,178, 72,190,155, 57, 62,246, 85, 83,128,195,144,136, 93, 71,  8,209,168,163, 34,100,
-132, 77, 46, 83,180,172, 77,208,202,130, 90,184,164,234, 53, 87,124,251, 94, 97,159,196, 38,251, 34,197,189, 85, 66,245, 64,153,
- 90, 33, 69,114,181,124,143, 97,216,161, 37, 19, 68, 40, 49,162, 57,147,107,133, 60, 58,232, 40, 16, 66, 36,106, 96, 72, 66,201,
-163, 93, 50, 67, 32,164,206,197,129,117, 62,248, 67, 34, 11, 12,187, 29,195,176,163,148,108,245, 37,165,201,254, 22, 99, 32,172,
-215,148,174,243, 41,115,245, 61,188,101,156, 32,198,128, 89, 86,248, 20,177,236,242, 75, 65, 57,  8,112, 37, 64,231,180,182,233,
- 54, 40, 86,144, 68, 22,254, 44, 49,159,153,186,132, 81,213,118,  3,177,  6, 52, 65, 31, 13,138, 94,170,221, 52,211,146,216, 34,
- 74,240,204,243,160, 74,151,108,148,124,160,202,186,192, 65,169,172,178,176, 42,129,120,184, 34,188,144,144, 63, 29,145,223,249,
-117,112,252, 95, 66,248,128,237, 70,199, 79,193,249, 95, 69,111,125,  6, 62, 23,224,215, 14,225,150, 26,163,189,100, 83,150,213,
-249,103,244,128,223,185, 42,199,253,228,169,105, 39,213, 12, 22,113,126, 80,100,162,255,204, 15,112, 88,136, 65,227,226, 80, 87,
-157,199,241,141, 47, 66,116,129,141,204, 15, 84,239, 19,128, 84,109, 47,222,110,183, 73,236,223,165, 12,117, 35,196,171,201, 86,
-195,143, 42,171, 92,233, 59, 67,229,134,152,144,247, 31, 34, 47,184, 15,253,176,183,  3,241,114,156,130, 87, 88, 39, 43,230,177,
-206,109,228, 14, 72,231,208,191,110, 33, 35,250, 34,156,122,242, 87, 91,189,236, 42,228, 98,171,136,195, 54, 47, 13,240,132,162,
- 15, 19,104, 68,222,233,121,236,247,138, 49,214,215,213,105,167,193,248,228,207, 39,248,212,  6,185,  7,210,249,216,119,227,163,
-250,182,147,173,118, 71,140, 91,144,187,  1,217,  9, 60,119,  0, 63,250, 52,124,211,211,176,234, 45, 96,231,214,167,224,183,238,
-194,235, 91,232, 59, 56,237,160, 91,193,135,  4, 62,186, 54,209, 38, 61,188, 54, 88, 34,206, 70,225, 81,128, 39,175,194,199,158,
-133,119,221,134,127,244,150,241,209, 79, 21,118, 88,129,221,250,161, 84,103,  4,116, 85, 40, 65, 39,187,162, 52, 66, 32,243,238,
- 79,253,240, 69, 46,228, 79, 87, 23, 60,122,  1,200, 75,120,134,216,100,194, 70,236,129,208,173,  8,151, 87,240, 68,180, 15,222,
- 51,138, 60, 81,225,104, 13,209,255,233,190, 14,214,191, 23,186, 23, 76,184, 16,  6,168, 95,132,219,127, 22, 94,122, 21, 62,123,
- 21,189,115,  3,125,144,169,119,118,228,215, 55,108, 54,133,211, 46,184,226,219,217,213, 58,219, 54,106,133,162,230,106,  9, 65,
-137,121,127,215, 24, 22,182,166,101, 38,  1,133, 69, 39,180,176, 97, 57,251,124, 84,251, 62,237,210, 19,221,207, 77,158, 11, 87,
-179, 40, 73,115,120,248,202, 74, 23, 59, 84,130,141,101,163,226,249,227, 54,245, 72,  2,169, 88, 49, 44, 65,125,183, 40, 11, 38,
-121, 37,151,106,  1, 31, 69,167,156,113, 69, 24, 49,119, 66,136, 54,134, 23,153,  3, 59,130,127, 22,179,170,253,188,117, 46, 60,
- 83, 76,168,143, 28,139,218, 14,223, 46,233,230,230,105,231, 64,223,246,250,106,178,149,140,238, 37,130,237, 45, 56, 26,148,103,
-223, 43,102, 41,113, 50, 91,202,218,254,116, 54,146,249,120, 93,116,186,112,133, 61,106,165,206, 53,  3,153, 48,174, 75, 17,100,
-185, 16,102,178,159,  0, 39,123,  5,253,109,140,160,139,209,251, 98,180,125,161,123,156,196, 92,141,131,180, 92, 53,248,207, 19,
-131, 77, 66,131, 43,211,145, 64, 10,129, 36,  1, 77,137, 90, 43, 35,118,110,137, 42, 49, 70,134, 90,232,179,178,234, 87,108, 98,
-152, 18,231,116, 47, 79, 46, 60,134,189,155,167, 14, 98,246, 83,153,125,238, 34,139, 14,163,148,233,123, 75, 20,106,169,148, 90,
-217,141,  3, 37,231,105, 26, 16, 66, 64, 99,164,150,226,170,121, 99, 40,132, 16, 72, 53,161,170, 12, 46,164,107,187,250,148, 58,
-186,104,226,140, 25,152,163,116, 34, 72,191, 34,151, 72, 41,133, 33,143,166, 31, 41, 54,  9,111, 96, 28,141,  9,173, 22, 96, 38,
- 93,240,226,159,173,216,151,249, 54,158,174,138,114, 18,133, 46, 41,235,  8, 39, 46,  8,  9,117,126,203,165, 46,246,193,107,191,
-242,143,  5,189,107, 25,154, 34, 86,168,179,143,233, 83, 21,186, 20, 73, 43, 99,126,111,115, 53,175,159,199, 42,118,190, 15,238,
-  5,214,170, 28,231,202,122,132,131, 26,232, 37, 16, 82,143, 92, 23,228, 27,  2,242,  7, 35,242,209,103,224,218,159,128,240,  3,
-182, 35,222,252,127,176,251, 63,225,193,231,208, 87,182,240,210, 26,190, 18,224,254, 72,221, 20,187,153,227,243,190,160,115,241,
-110, 50,210, 86,185,235, 66,125,158,  4, 41,113,126,247,187,246,201,240,150,162,180,194,236, 99,245,186,255,228,215, 89, 56, 63,
-143,222,252, 97, 78,209,126,236, 62,186,168,173,206,208, 47,201,222,165,122, 71, 79,163, 34, 37, 11, 10,  9, 93, 48,161,207, 81,
-176, 14,206,211,138,100,140, 86,208,127,231,101,228, 82,111,127,137, 85,244, 46,208,179, 76,197,196, 22,242, 32,219, 15, 54,120,
- 27,114,210, 89, 40,203,213, 71, 16,126,218, 68,226, 15,131,209,107, 54,174, 55,216,121, 83,120, 90,224, 97,177, 46, 42, 84,216,
- 96,182,183,195,232,241,171, 98, 94,247,195,  8,231,254,154,175, 34,124,244,216, 78,167, 87, 11,156,237,  8,  7,  2,199,149, 85,
-168, 12,  3, 72, 82,250, 32,164, 67,136,103, 32, 55,  5,186, 14,126,228, 25,248,222,119,194,149, 39, 96, 56,133, 55,239,192, 75,
- 15,208,159,188, 71,189, 89,144, 39, 35,225,253, 10,215,253, 85, 63,  3,238,136,197,191,173, 51, 60, 29, 97,221,153,247,254, 93,
- 21, 62,244, 78, 88,191, 31, 54,183,224, 36,192,189,140,222, 83,179,218, 61,145, 88,191, 81, 57, 42,202, 46,193,214,223,103,149,
-121,160,211,194, 56,150,194, 72,145,153,188, 37,111,131,219,156,173, 40, 50, 29,248,161,  5, 46,244,193,  4,112,235, 72,184,214,
-195,123,123,120, 78,145, 39, 43, 28,158,192,193, 11,208,127,135,165,197,133,  4, 28, 66,247, 36,200, 17,108,191,  2,103,255, 45,
-188,246, 73,248,226, 10,253,210, 13,244, 65, 65,135, 29,245,246,142,242,198,150,237,160,156, 39, 60, 81, 45,184,178, 91,124,252,
-183, 24,225, 78,228, 56,155,144,141,126,200,137,182,216, 79,155, 52,  4,157, 57,224,131,238, 39,123,197,198,205, 14,179,224,110,
-172,179, 10, 90,196,185,  4, 75,218, 73,181,189, 39, 85, 38,222,185, 15,117, 76,175,224,175, 87, 82,245, 61,190,191,206, 69, 73,
- 81, 88, 43, 12, 45,183, 96, 74, 64,210,249,148, 12,243, 56,120,  9,117,232,130, 32, 18, 73, 98,162, 54, 45,213,133,108, 86,156,
-181,218,254, 94,125, 26, 48,248,152,123, 17, 75,190,  7, 78,137,173,115,246,170,157,100, 22,197,142,126,174,164, 22,106,179, 16,
-135,202,130, 93,174,139,184,209,198,110,151,118, 17,241,135,109,154,130,200, 82, 59, 48,187, 11,154, 20,168,125,175,221, 66, 62,
-201,222,158,219,214, 18,210,152,252,162,251, 68, 57,153,145,189,242, 54,204,119,189,160,168,147,133, 80,238, 34, 94,182,157,177,
- 23,237,114,181,  9,  9,221,166, 22, 83, 98, 21, 19, 33, 90,134,103,241,142,123,212, 74, 29,243,100,228, 86,170,217, 19, 67, 71,
- 46,133,206, 87, 40, 65,228,130, 13, 79, 46, 44, 36,246,163, 90, 13, 44,228, 83,161,133,114, 63,138, 93,180,181, 86, 52,206, 14,
-154,234,  2,200,237,144, 25,119,219,233,245, 12,205,187, 30,130,191, 63, 70, 30,181, 21, 83,182, 77,174, 79, 57, 81, 53,242,103,
-140,164,152,233,186, 68, 74,137, 24, 35, 41, 70,143,250,141, 38,142, 44,182,111,239, 82,154,160, 58,185, 20, 70,135,216,104, 67,
-203, 54, 76,186,  8, 53, 38, 67,220,  6, 91, 95,215, 90, 73, 79,118,214,153,131,  5, 89,181,136,196,138, 78,196, 39, 17,143,  7,
-237, 39,207,  8,250,198, 14, 61,205,200,165, 72, 76, 74, 26,117,250, 48, 73,173,196, 92, 57,192,  2, 20, 30,102,101,231,123,167,
- 20,224, 48, 42,199, 69,185,146,149,163, 18,233,250, 21,225, 70, 36,188, 67,225,163, 32, 31, 89,193,251,142,224,218,215,193,193,
- 15, 64,248, 54,168,199, 70,200, 58,255, 49,216,254, 18,122,235, 20,190,216,193, 87, 78,224, 86,134, 71,163,129,100,234,136, 90,
- 48,251,158,164,115,202,199, 85,157, 37,189,109,165, 32,179,135,167,197, 24,180,225, 13,213, 80,183, 68,255,119, 90,237,146, 83,
-152, 70, 98,101,202, 36,152,139,249,164,242,144, 57,117, 44,137, 53,204,211,135,194, 11,183,244, 16, 86,201, 14,124,196,210, 49,
-143, 18,114,220,217,165,234, 56, 34, 81, 45, 87,252, 78,177, 91,194,183, 31, 19,190,254,  4,158, 58,180,219,209,232, 97,237,197,
-105, 52, 99,134,156,209,187,  3,122,223,119,229, 77,104,113, 28, 97,179,130, 77,239,  9, 51, 10,167, 25,182,163,123,232,252,214,
- 94, 21,238,143,150, 86,166,254, 23,192, 10,190,108, 60, 11,118,231,151,159, 85,176, 19,229,216,151,198,159,222,217,107,253, 84,
-103, 39,206,195, 12, 55,160, 63,173, 92,121, 45, 83,171,144, 18,200, 46,160, 33,194,191,114,  5,249,163, 55,224,169, 19,107,139,
-111,223,129, 79,191,  5,191,249,200,186,239, 71,217, 60,240,  7,  6,129,209,151,  3,108, 21,185,158,224,125, 43,120,102,  5,207,
- 94,130,171, 55, 96,243,  0,238,158, 27, 32,231,139,111, 66,249, 42,220, 42,118,145, 57,207,200, 58, 65, 81,228,178, 16,179,114,
-242,198,192, 78,149, 44, 98,186, 66,239, 88, 90,120,136,122, 39, 95, 23,251,191,165,159, 55, 44,243, 27, 26, 52, 40,216,243, 30,
- 81,186,  2, 49, 10, 97, 21,237,159,190, 35,172,122,184, 17,225,131, 35,242,244, 19,134,181,237,191, 17,214, 31,183, 85,131, 68,
-159,  5, 87, 40,  3,122,250,223,195,221,191, 15,111, 10,188,114, 21,190, 12,245,230, 14,221,141,212,243,145,114,115,100, 87,148,
- 97,229,221,158,206,151,204,230,177, 22,223, 91, 75, 50,171,143, 97,121, 61, 18,116, 82, 77,203, 98, 15,204, 84, 88, 27,241,172,
-237,225,219,122, 66,208,  9, 27,187,164, 31,139,143,178,167, 76,  4,167,118, 93,180, 84,103,239,116,163, 71,173, 78, 23,  0, 49,
-238, 69, 66,167,240, 22, 29,173,  0, 31, 40,156, 45, 50, 33, 22,227, 68, 19, 88,201, 62,105, 43,  6,131,207, 72, 45,174, 82,103,
- 10,143,106,130, 60,173, 70,156, 91,251, 69,163, 20,139, 83, 94,246,167, 45, 53, 75, 85, 41, 11, 69,119,139, 71,142, 11,245,120,
-184, 64, 94,147,230,253, 95, 50,232,117, 63,169,188, 17,207,178, 95, 86, 38,143,250, 66,133, 80,153,125,235,178,184, 80,244, 23,
- 80,224,117, 65,190, 92,150, 58,245,115,184,121,237,117,154,198,202, 62,199, 93, 23,248,220,197, 20,129, 11, 56,119, 46, 92,106,
- 91,162,228,172,146,183,131, 48,138,176, 10,198, 79,183,145,122, 32,186, 85,122,172,202,160,133, 96, 59, 42, 63,167,179,117,239,
-126,233,138, 93,111,147,163, 90,140,149, 80,205,138, 70,  8,179,250,114,159,209,249,182,113,102, 42, 51,196, 69,104,197, 54,122,
-  7, 47,132,148,246,124,254,187, 97,100,216,237,208,156,125,210, 22,140, 18,234, 59, 87, 21, 72, 33, 16, 82,240,159,175,101,114,
-148,105,169,213,106,105, 46,149,161,100, 82,140,116,169,163,235, 58, 43,242, 49,209,133,200, 65,223, 35,190, 78,218,229, 76, 46,
-217,156, 78,181,112,190, 57,183,241,127, 54,  5, 76,169,197, 58,244,102,  3,116,197,113,136,145, 68,176,145, 82,187, 21,166,133,
-218,116,218,195,184, 88, 67,220, 66,206,253,129,205,157, 29,131,  8, 39, 91,123, 17,123,143, 62,220, 72,129, 80, 57,146, 22,143,
- 41,156,169,176,243,204,220,203, 90,185, 49, 84, 46,145, 72,215,214,132,143,  4,228,123, 10,124,211, 17, 60,249, 33, 56,248, 54,
-232,126, 39,200,123, 77,229, 91, 43,212,155,176,249, 57, 56,255,135,176,249, 60,250,250,  8, 95, 57,132, 55, 42,220, 25,225,180,
- 80,115,158,110, 75,230, 25,115,187,214,162, 64, 91,151, 45,237, 52,152,176,109,210,205,159, 70,209,184, 31, 62, 88,227,158,  2,
-180,133, 71, 75,110,170,225,106,129, 55,237, 81,170, 70,135, 17,153,205,185,234, 17,126,225, 32,248,161,111, 99, 10,233,  2,178,
-138,200,229,128, 28, 37,228, 48, 88,  7,124, 24,152, 60,124,125,176,127, 78, 43,188,178,179,177,248,123,122,228,119, 92,129,167,
- 14,102, 19,189,170,177,220, 31,142,232,121,134, 71,150, 44,199,221, 29,250,208, 59,244,  3,219, 45,201,221,132,108, 42,114,154,
-225,216, 47, 63, 15, 43, 58,229, 79,122, 20,154,211, 67,204, 74,102,251,242,240,116,176,238,120,  0,206,133,122,154,209,123,133,
-112, 46,200,161,204,185,156,111,100,235,224,175, 38,120,223, 33,220,207,240,230, 22,158,128,248,206, 74,124, 54,194,175, 91,244,
-169,252, 91, 79,193,251,175,217,101,228,141, 71,240,218, 22, 62,183,129,219,131,189,222,151, 10,114, 89,  9, 15, 10,250, 85,165,
- 62, 97,165, 67,158, 95,193,187, 86,240,196, 26,222,117,  4,215,158,182,240,150,221, 93,139,200,187,189,131,135,213, 30,196, 36,
-134,159,125,111, 71,120,103, 64,239,  6,184, 63,160,215, 43,235,161,114,245,110, 49, 74,148,111, 32,202,130, 38, 72,181, 86, 40,
-102,243,221,182,238, 41,122,250, 94, 59, 91,146,107,  5,251, 96, 98,177,228, 35,250, 24, 35,241, 48, 18,214,129, 16, 58, 98, 88,
- 33, 79,172,224,249,  1,121,250, 89, 56,250, 55,173, 67, 15,151, 32, 28, 65,184,108,223,161, 60,130,205, 63, 68, 31,253,143,112,
-231, 54,220,185,  2,183, 34,122,115, 68, 31,110,169, 12,232,249, 64,189, 59, 48,170, 80, 86,182,143,148,234,244, 62,194,228,189,
- 14, 18, 45, 37, 49,202, 36, 18,  8, 75,236,113,176, 85, 72, 89,236,120,165,169,185,151,140,  6, 23,136,181,244, 47,169,243, 65,
-186, 36,137, 73, 89, 70,140,218,184,127,137, 46, 45,158, 83,222, 20,241,163, 31,127,193, 45,105,154,196,121,219, 13,231, 58,111,
- 63, 87,201,198,228,131, 66,149, 48, 33,165,117,193,112,105,251,246, 78,103,188, 52, 50,119,180,109, 12,155,139,175,213,194,156,
- 69,176,138, 86,200,238,251,  1, 45, 11, 49,158, 76,252,237,150, 60,201, 20, 55, 90,177, 44,241,  4,108,116, 86,228, 79,212,184,
-198,151, 95, 12,190,195,162,195,180,100, 59,159, 36,176,100, 93,232, 94,108,123,123, 93,155,254, 38, 46,196,108,157, 31, 67, 89,
-247,169,110,203,108,244,198, 28,176, 49,178,236, 69,127,234,226, 82, 22,189,160, 23, 30,239,202,121,187,252,239, 11,191, 39,197,
-104,  5, 47, 68,159, 28,138, 71,149, 54,133,191, 21, 45,245, 15, 89,157,198,167, 30, 78, 35,106,131,199,148,208, 24,168,217, 26,
-170, 28, 64, 71,195,121,  7,145,  9,143, 59,229,192, 47,  0, 73,179,185, 79,247, 35, 78,171, 78,202,117,  9,166,175,144, 69,151,
-174,170,140,217,212,232, 53,103,150, 15,175,249,220, 61, 43,222, 39, 64, 13,104, 99,211, 53,220,175,238, 60,  5,132,170, 78,157,
-244, 53,245,168,149, 84, 70,226,104,157,123,159, 58,250,190,103,213,117,244,169, 35,166,196,110, 28,201,121, 52,183,212,241,  9,
- 67, 57,100, 55,236,236,223,229,209, 70,254, 45,149, 78,194,116, 65, 75,237,234, 23, 69, 56,112,245,251, 52,214, 90,160,250, 66,
-244,236,232, 90,209,123, 35,111,102, 91,157,214, 77,229,168, 55,177,144,160,236,138,141,200, 82,128,117, 23, 56,140, 29,135, 39,
-145,235,231,153,124, 54,112, 37,195,250,228,128,240,194, 33,242,167, 10,124,248, 26,156,252, 48,244,255, 34,132,103, 45,146,178,
- 69, 57,149, 83,208,155,176,251, 36,156,253, 12, 12,175,160,183, 10,188,210, 91,231,245, 48, 27, 40,133,130,250, 41,210,  0, 39,
-226,170, 13,117, 35,120,227,224,139,170, 47,250,124,116,188, 18,199,144,202,158,170, 69,116,161,153, 92, 46,203,  9, 11,150,121,
-107,133, 22,114, 82, 89, 64, 30,130, 76, 93,126,232,  5, 14, 34,116, 66, 88, 71,147,123, 31,  4,228,146,167,166,173, 34, 28, 38,
- 59,117,218,213,191,217, 22,  2,112, 82,225, 56, 34, 71,  9,110,172,145,203,107,211,233,158,102, 99, 84,142, 25,125,115, 64,239,
-156,193,131,  1,189,183, 67,111,102, 67,252, 13, 10, 71, 32,151, 34,218, 69, 84, 11, 50, 84, 36, 41,194,202, 94,179,131, 41,255,
-113,206,212,212, 96,133,112, 19,  9, 59, 63, 17, 91,129,116,165,148,228, 96, 95,127, 61, 23,191,233,228,126,  4,220,170,214, 73,
-191,183,183,204,239,195, 17,182,110,190,255,161, 67,248,208, 85,251,190,175,159,195,107,231,232,103,182,240,112,132,203, 10,183,
- 54,200,189,140,174,162,125,173, 43, 61,242,237,107,120,225,192,108,120,103,213,104,176,247,119, 38,  8,188,247,101,187,168,245,
-201,126,254, 19,191,124,180,  7,114, 21,237,181,122, 40,200,218, 35, 69,182,129,122,216,177,122, 88,185, 52,154,247,126,231,  7,
- 71,245, 38, 32, 72,179, 32,  9, 73,103,149,111,231,110,193,117,116,167,130, 88,176,137,233, 72,197,242,150, 87,209,196,112,135,
- 29,225,160, 35, 92,238,225,125, 17, 62, 84,144,247, 62,  9,135,255, 50, 28,125, 28,194, 21, 79,113, 11,150,195,190,253,101,244,
-225,127,  1,119, 94,133, 91,135,240,224, 58,220, 83,244,246,128,222,222,162,155, 17, 61, 31,209, 71,153, 58,130,244, 74, 10, 50,
- 91, 44,125, 38, 62, 33, 79,163,225, 89,162, 39, 38, 78,197,175,122,224, 72, 89,110,168,236,112, 13, 77,228, 41,179,133, 83,147,
- 71, 10, 55,206,131,119,160, 41,206, 54,184,166, 43,104,  7, 97, 81,221,203, 75,104, 60,136,165, 80,108,250,189,110,251,138,227,
- 12, 33,145, 32,147,170,187,250,101, 42, 53, 98,165,226,201,110, 30,186, 49,173, 14,230, 96,153,214,245, 38,111,111, 67,235,198,
- 61,110,181,182,247,119, 18,243, 10,125,180, 59,233,110, 17,135, 28,218, 97, 77, 91,151,  9, 33, 90,103,154, 17,134,106,163,220,
-118,110,102,220,221,163, 58,165,136,233, 34,229,177,173, 53,226, 36, 22, 83,127,207, 46, 20,216,182, 91, 95, 22, 85,149, 61,121,
-208, 18,126,213,108,123,121, 97, 85,219,243,103, 47,134, 27, 23,131,224,154, 78, 34, 94,132,144,234,190,253,109,143,207,161,109,
- 37, 97,207, 60,206, 73,143, 33, 78,138,254, 38, 59,172,165,184,213,111,174,188, 51, 31, 97, 47,228,140,168, 66, 10,  1,233, 18,
- 37,207,152,241,162, 74,206, 35, 57,231, 41, 98, 86, 22,160, 16,213,199,111, 30,109,202,210, 94,103,  9,129,228,163,127,183,225,
-236, 41, 26,179,  8,195,104,141,162,104,155,212,186,221,109, 10,100,169, 86, 27, 48,126, 75,219,155, 75,140, 19, 52, 41,151, 66,
- 41,251,130,203, 82,109,245,147, 67, 37,213,202, 88, 10,197, 45,109,187, 49,211,117,153, 46,  6,142,186,142,176, 62, 96, 40,133,
- 49,143, 28,212, 74, 56, 58, 50, 42, 94,  8,164, 24, 72,126, 97, 42, 90, 25, 75,102, 44,133, 84, 29,215,113, 20,204,  7, 29,167,
-187,141,206,226, 22,117,145, 92, 18, 56, 47,156,109, 10,111, 84, 24,138,249, 41,111,  4,187, 33, 30, 69,216,121,202, 65, 95, 33,
-105, 36,252,240,117,210, 31,186,194,193,159,127,141,114,167, 34,207, 28, 34,127, 48, 33, 63, 88,224, 93,223,  2,235, 31,181,168,
- 72,137,134,183,212,211, 57, 65, 75, 31, 65,254, 34,156,254, 18, 12, 95, 67, 31,156,193, 87, 19,220, 46,112,199, 11,186,227, 28,
- 77, 30,107,169, 78,226, 45,133,214,133,239,166, 42,146, 23,243,164,  3, 65, 86,  9, 89, 41,212, 56, 49, 92, 85,231,  2, 45,117,
- 65,153,155, 76,162,134, 48, 21, 89, 48, 28,179, 71,249,245, 45, 50,212,126, 22,233,196,187,110,111,223,150,191, 62,104, 62, 39,
-117,131,182,  7,174, 55,234, 13, 46, 86, 27,125, 30,167, 98, 81,167,207, 88, 48,136,222,223,217,226,119, 87,225,171, 91,234,173,
- 45,220,223,160,183,119,214,225, 62, 28,144, 71, 70, 44,146,  8, 60, 10,232,198,216,233,114,201, 95,147,243,130, 30,102,219,177,
-119,254,243, 81,231,211,112,180,221, 57,199,157,245, 55, 67,129,135,234,168, 89,191,237,106, 50,165,219,206,215,  3, 62, 27,212,
- 67, 65, 86, 98, 93,126,174,112,176,130,167, 59,184,148,173,240,199,  4,215,122, 27,239,223,220,218, 68,225,229,209,  2,117,142,
- 20,190, 52,160,159, 26,144, 33,195,211, 61,242, 29,199,200, 55, 31, 33,151, 86,112,210, 91, 17,  7,155,195,238, 92,229,118,234,
-235,135, 52,218,195,248,238, 35,184,190,131,211,157,193,  0,206,  2,108, 35,114,167,162, 37, 18, 46,117,112,211, 91,202, 19,229,
-104, 59,176, 14,198,240,182,131,200,138,228,232,155,133,157,103,222,139, 23,150, 54, 76, 89,161,244, 85,233, 86,209,114, 17, 82,
- 32,116, 29, 97,149,144,147,158,112, 45,193,211,  9,121, 26,219,249, 63,217, 33,151,159,131,254,247,192,250,219, 12,103, 44, 43,
-200,111,193,246, 23,225,236,127, 65,239,127,  1,238, 31,193,221,167,225,243, 25, 61,223, 64, 45,212,135,  5,125, 56,162, 37,219,
-251,131, 32,  7,166,116,158, 66, 12,235,156,127,149,196,144,171, 76,157,163, 76, 98,181,234, 85, 49,103,  3,  0,181,  1, 93,112,
- 97, 93,240,207,117,151,246,193,  2, 37,248,134, 71,102, 85,245,162, 25,158,212,213,170,109, 47,121,129, 73,190,215,185,250,224,
-204, 63, 98, 59,223,165,199,101,162, 89, 89, 72,204,196, 34, 11,251,153,197,106, 30,244, 16,166, 40, 21,161,238,171,175,  9,211,
-238,187,122,170, 92, 23,196, 35,139,133,224,121, 19, 13, 22,147,253,163,221,139,253,236,121,143, 12,167,251,202,113, 21,  6, 23,
-212,141,174,162, 46,139,224,245, 82,155, 70,193, 59,201,176,240,124,233,108,143, 83, 23, 37, 44,139,116, 93, 92,130,150,170,245,
-186,192, 49, 46, 11,189, 94, 96,199,183, 21,201, 99,133,120,249,218,214,121,188,177, 92,141, 60,102, 93, 91,224,200,151, 28,247,
- 32,145, 24,141,152,150,156,170,150,157,123,144,181, 78,234,251,170, 13,170,226,110, 10,153,121,  0,147,234, 88,102,128, 76,240,
- 93,119,232,146,167,126,150, 89,197, 95,242,  4,207,178,137,145, 92, 64,216, 94,208,233,203,227,126,254, 20,162, 21,223,182,122,
-154, 64,236,206, 17, 24,182,104,246, 85, 77, 10,251,126,125,103, 17,132, 96,194, 55, 17, 39,198,117,157,237,219,  9,126, 17,197,
-179,  2,116,226,202,171, 95,162, 67,136,196, 16,173, 48,167,206,112,183, 49,210,117, 29,171,152,232,251,158, 46,173, 88,165,142,
-216,173,204,255,224,235,221, 90, 70,170,119,251,155, 97,112, 17,159, 78, 65, 72,105,141,218,200, 80,148, 88,230,107,115,171, 89,
- 77, 93,105,137,116,  5,125, 88,185, 51,216,104,170, 96,100, 51, 85,120,106,109, 34,187, 90,205, 71,125, 16, 64, 98, 15,111,  5,
-248, 75,103,112, 51, 18, 63,122, 12, 63,156,225,163,192,181,239,131,245,127,  2,233,134,217,143,244,209,226,241, 77, 80, 31,194,
-248, 69,120,244,179,176,123, 29, 78, 31,192,215,146,117,126,247, 42,156, 59, 44,165, 57, 84,163, 76,234, 77, 19,186,217,216, 77,
-170,162,217,219, 12,193, 10, 77, 23,144,131, 48, 69, 49, 73, 83,175,101,108, 31, 31,188,144,166,105,113,104,191, 14,243,126,158,
-206,137, 52,205,222,119,236, 92,242,132,  1, 93,186,246,245,235,204,142,140,179, 38, 97,154, 59, 14, 10,167, 64, 29,172,139,108,
- 59,234,109, 70,207,189,125, 90, 99,132,151, 23, 21, 62, 60, 34, 87, 15,172,155, 61,233, 96,237,233, 63,159, 62, 71,207,183, 48,
-142,112,111, 71, 61, 31, 25, 93, 36,152,178, 18,118,209,170, 83,103,218, 43, 80,244,188, 34,187,106,151,154,149,120,156,156, 78,
- 28,109,162, 26,128,102,240, 57,244,166,152,114,188,175, 30, 67,233,151,219, 46, 65, 42,246,218,157,154,149, 90,170, 95,104,250,
-100, 15,202,170,115,158,185,216, 68,226,238,  8, 47,159,218,123,121, 54,162, 59, 69, 87, 38, 76,226, 65,181,215,246, 59, 14,224,
-134, 32,207,246,112,121,101,175,197,198,115,130,235,104,151,144,203,157, 59, 50, 28,162,147,177,231,233, 32, 66,249, 48, 28, 62,
-130,131, 55, 97,216,192,209,153, 89,197, 14, 18,114, 22,145,183,  4,222, 97,225, 68,218,239,  8, 93,135,102, 69,118,197,242,192,
-179,162,185,144, 11, 12,131, 78,184, 82, 17,179,109,198, 32,116, 17,219,147,175, 35,225,176, 71, 14, 59,194, 73,132,107,  9,121,
- 42,192, 51,  1,185, 33,232,241, 10, 57, 56,130,254, 25,  8,207,155,131, 35, 60,  9,165,131,225,117,216,254,  4, 60,250, 27,112,
-126, 31,189,119,  0, 55,159, 49,245,254,189, 17,125,101, 75,205,197,133,151,117,142,  2, 12,254,156,103,166,100,196,170,222,113,
- 72,153, 96,  8,161, 21, 88,215,130, 84, 79,167,170, 85, 38, 24, 74,113,149,184,101,163,155,223, 60,186, 61, 45,234,140, 49, 54,
- 21,174,123,189,235,220,  1,230,133,181,205, 38,252,173, 19,223,111,153, 90, 65,207,162,123,227,218,246,171,213, 98, 39,186, 23,
- 28, 66,157, 62, 58, 80,109,173,209,236,110, 90,124,221,208, 44,120,115, 78,183,138, 19,184,196,188,235,179, 61, 53,144,168,  4,
-181,149,138,132, 64,168,213,  1, 67,246, 94,  7,173,211,223,105,162,148,181, 24, 21, 23,168,237,234,140,175, 13, 33,208,  7, 33,
-187, 80, 76, 22,110, 10,157,186,200,186,232, 30,101, 22,201,181,245,132, 79, 89, 42, 74, 21, 23,  4, 46, 80,188, 75,246,254, 84,
-108,125,130,209,172,176,181,217,246,218,126,254,226,220, 92, 46, 48,222,127,187, 28,139,139,127, 76,141,140,214,133,232,  9,104,
-113, 26, 61,131, 21, 25,173,118, 17,106,  1, 86,197, 83,198,180,182,149,143,236, 69,133,202,254,255,153, 96, 51, 81,132,174, 51,
-203,151,230,178,184,  8,185,245,216,127,240,224,152,217,  9, 20,118, 81,173,191,200, 25,111,207, 88,112,  7, 74, 35, 15, 70,119,
-163,168, 24, 13,110, 24,179,141,250,155, 29,198, 29, 36,136,184,248,212, 84,250, 49,218,197,160,234,130, 44,160, 70,  3,237, 82,
- 71,231,130, 56, 66,176, 90,153, 71,  7,159,205,170,196,198,160,111, 17,171,187,113,228,108,183,163,158,157, 82,  9,214,125,143,
- 35, 73,132,227,131, 67,174, 28,159,112,114,114,153,148, 58,106, 45,108,117,199,237,179, 71,108,206, 78, 45,161, 48,  4,210, 90,
-172,168, 71,117,107,145, 46,253,216,182,103,115,160, 14,100,216,237, 42, 55, 71,211, 32,137,216, 25,127,123,180,179,245, 10,202,
- 73, 85, 98, 22,250,245,  1,242,220,  9,124,139,192,229,115,248,  3,131,141, 29,175, 61, 15,235,127,207, 20,190,225,200,252,182,
-228,230,108,117,117,205, 61, 24, 63, 15,167, 63,  1,231, 95,131,221, 45,244, 86,133, 55,131, 37,130,109, 11, 19,175, 51,129,236,
-162,169,213, 61, 77,115,105,142,212,162, 38, 72, 91, 89,  4,159,172, 93,118,223,219, 40,220,138,181, 63,100,217, 17,144,203, 20,
-151,126,241,105, 73, 94,168,215, 10, 43,  7,167,116,237,228,115,219,124,148, 61,136,  3, 89,173, 40,102, 71,141, 85, 31,  9,231,
-140,110, 20,182, 21, 61,171,112, 58, 26,125,173, 40,210, 41,117, 83,172, 11,149,128, 92,139,200,213,  8, 95, 46,200,155, 91,248,
-253,106, 47,219, 87,182,240,142, 14, 93, 21,248, 64,128, 23, 49,198,187, 84,180, 91,120, 72,187,104,157,235,229,100, 33,235,  4,
-116,107,205, 33, 35, 54, 79,173,189, 95,124,218,172, 85,145,218,193,218, 46, 15, 42,190,231,124,100, 63,147,198,246,112, 22,223,
- 59, 10,210, 11,122,172,237, 84,183,145,249,213, 96,  5,246,161,139,221,  6,239,168, 71, 95,127,132,130, 30,131,246,160,135,192,
-224,131,191, 43,157,145, 11,139,162,111,129,188,145,209, 67,208,227, 74, 56,200,246,247,  9,  1,142, 58,184, 22, 76,237, 94,157,
-153,149,  4,210,161,125, 65,201,150,105,126,114,217,  2,103,158,123, 19,206,223,128,187, 59,120,135, 34,103,192, 61,144, 27,137,
-112,174,232,206,184,  9,241,180,218,  5, 98, 80,250,179,202,193,166,152, 86,193,187, 43, 57,  8, 70,182, 58, 12,200, 73, 15, 79,
- 36,228,138,192,147,  1,185,134,175, 26,214,144, 86,208, 61,137,196,119,131, 60, 15,122,205,247,134,175,195,248,105,216,124,198,
-166, 80,103, 91, 56, 63,132,  7, 79,195, 77,181, 91,243,217, 72, 61, 29,208, 33, 83,123,157,165,213, 83,232,203,156,148, 88,212,
- 34, 74,235,130, 21, 94, 28,129,169, 98,111,113,174, 58, 19,183,188,202,235,194, 31,221,238,157,201, 89,217, 73,204,122,214,184,
- 11,237, 66, 16,252,190,171, 23,124,216, 85, 76,116, 43,238,155,202,173,179,214,253, 98,161, 64,168,246,115,197,133,240, 75, 39,
- 64,192, 34,193, 74, 27,121,114,177,  7,158,228,172,208, 69, 33, 84,243, 45, 15, 42,211,238,157,118,169,152,130,224,253,107,180,
-110, 76, 42,157,204,194, 41,105,176, 29, 55,192, 72,109,107, 11,157,  4, 99, 65, 91,130, 91, 48, 64,150,204, 83,157, 32,176,241,
- 73,222, 70,101,242,211,215, 69,186,246,126,124,169,211,223, 60,168,166,238, 13,  2,234, 66, 25,175,123, 94,239,233,124, 94,  0,
- 98,170,238,211, 96,150,  2,190, 36,251,214,195, 73, 27,176,176,157, 93,244,159,179,200,132,151,104,215, 26, 17, 33,134, 64,  8,
-201,119,228, 70, 88,203, 90, 39,130,168, 76,171,  5,247, 82,235,156, 17,176,140,145, 94, 18,109,116,  1,187,105,118,147, 40, 66,
- 23, 12,192,164, 62,  2,175, 19,125,176,145, 16,103,214,185, 44,  5,172,186,152,232, 72,216,251, 59,181, 75, 76, 10, 97,234,166,
- 99,138,142,120, 53,250,224, 56,142,118,129,110, 29,188,204,121,236,180,204, 63, 17,138,  8,165, 20,164,100, 31,187, 39,223,109,
-219,186, 97,187,219, 48,158,219,232,189,186, 98, 32,231, 66,169,213,190, 71,201,115,170, 94,251, 60,  6, 65, 67,176, 63, 83,178,
-217,235,166,232, 85,108, 34,144, 58, 78, 46, 93,226,210,149,171,164,213,  1, 15,199,145,123,183,222, 36,159,157,186, 61, 48,144,
-142,188,182,173,130,137, 50,228,194,195,215, 53,197,118, 18,100, 20,242,185,157, 37,135, 97,254, 48, 94,170,202,225, 89,229,100,
-157,  8,151,215,200, 65,135,188,119,  5,127, 98,  7,223,185,133,120,  5,134,239,134,244,199, 33,124,179, 23,243, 17,107,235,154,
-249, 35, 65, 61,133,242, 50,148,183,172, 67, 63,191,  9,195, 93, 19, 60,189,150,108,135, 94, 93,  5,178,178,226, 40,209, 70,233,
-211,211,218,162,150,188, 59,150, 86,144, 87, 94,128,219,239, 95, 57,241,164,243,125,107,242,147,171,225,180, 84,231,147,164,181,
- 31,157,125, 13,209, 22,190,209,174,253,206,139,173, 94,192,183,213,186,218,161,218,136,251, 44,195,166,154, 48,168, 42,186,173,
-134, 80, 61, 27,209,179, 98,162,143,188,240,208, 39,199,171, 14, 62,230,201,145,112,210, 89,135,253,106, 33,126, 26,120,225,  4,
-190,186,129, 87, 54,240,177, 21,188,175, 67, 46,117,232,203, 10, 95,174,196,  7, 74, 24,108,  5,160, 39,  9,174,118,112,185,179,
-124,164,131,104,133,190, 93, 88, 54,192,186,216,114,184,154, 34,122,154, 78,104,130, 67, 69,162, 32,199, 17, 61,173,176, 45,246,
-117,165,162,155,  2,143,252,232, 73,246,250,132,236,151, 43, 21,184,151,109, 60, 30,125, 18, 81,  5,174,  9, 92,141,176, 41,232,
-105,181,191,107,239,239,209,145,243,115,183,192, 93, 15,151,201,190,228, 59, 23,228,161,247, 99,  7,110,219, 59,216,185, 22,225,
-220,253,222, 43,180,  7, 57, 28, 64, 62,  5,219, 83, 15,159,191, 14,253, 31,  7, 62,  4,233,111, 67,121, 19,142, 30, 34,249, 33,
- 58,238,160, 14, 72, 30,144,172,134, 19, 30,124,106,178,  3,182,  2, 15, 20,206,100,158,111,246,254, 51, 92, 22,155, 76,156, 68,
-207, 90, 95, 67, 56,129,244, 52,196,103,160,255,152,197,175,202,145, 65,115,182,191,  0,187,127,  2,103,111,160,167,231,176,  9,
-112,218,195,233,161, 77, 40,182, 59, 56,171,212,157,101,155,214, 97, 68,163,175, 97,134,108, 58,130,232,113,241, 91,179,102,101,
-156, 23,238,235,  2,173,144,139,237,121,219,199,165,137,182,106, 85, 87,176,235, 36,134,106,141, 82, 66, 77, 56, 85,101, 66,223,
-138, 40,161, 92, 40, 28,117, 14,  9,209, 37, 65, 12, 93,116, 91,214, 44, 84,239,240,171,119,196,180,244, 46,159,254,165,186, 36,
-165,205,240,147, 42,115,100,153,248,208, 40,133,121,223, 25,171, 19, 26, 69,232,  4,196,247,139, 89,149,161,154, 69, 74, 68,109,
- 61, 39, 58, 29,248,161,249,239, 85,201, 85,167, 29,190,234,156,107,142, 83,240,204,210,103, 95,191,138,237,197, 11,179,230,104,
-244,206, 93, 93, 77,254,160,194,153,119,214,213,167,134,121,207,  6,215, 84,230,205, 91,191,132,166, 56,224,107, 15,127, 43,123,
- 24,141, 37,252,103,233,127, 47,178, 63,117,174,139, 83,117,229,125, 69, 88, 36,121, 77,  5,126,210, 10, 44,246, 46,222, 77, 39,
-137, 19, 76, 69,188, 88,205,137,101, 54, 14,207,165,236,101,183,139,187,  8,204,229,160, 11,177,181,139, 50, 69, 22,153,240,243,
-127,219,139,131, 21,136, 90,  9,105, 53,143,221, 23,184, 93,212,192, 48, 83,218,156, 78,115,129,125,200,207,226,134,163,170,211,
-235, 30, 93, 28,103, 64,152, 52,113, 35,170, 10,195, 56, 80, 70,243,150,167, 24, 32,122,168, 75,169, 83,145,159, 12, 17, 90, 13,
- 56, 35,129,172,202,102,187,101, 28, 71,219,151,215, 74,201,153,210,  2, 90,166,105, 64, 68, 67, 52,101,124, 41,211,206,106, 10,
-232,145, 96, 62,244, 92, 60,240,204, 39,131, 97,246, 63,140,227,142, 59,183,111,114,251,206, 45,255,254, 22,146,214,210,244, 10,
-144,142,124, 85,190,198, 98, 48,151, 47,113,112,177, 66, 12,129,176,238,136, 53,114,242, 76,199, 11,119,183, 60, 58, 43, 72, 85,
-214, 69, 57, 14,129,213,122, 77,124,231, 17,242,241,  8,223,188, 67,222,119,  6,215,159,131,250, 39, 33,254, 33, 56,120,202, 31,
-235,193,247,230, 46,101,209,222,162, 35,235,151, 96,248,  5,168,107,216,126,  1, 54,119, 96,120,  4,103,143,208,183,162, 29,102,
-163, 23,215, 67, 31, 49,186, 61,219, 72, 96,213,119,213,177, 93,171,103,193, 87,114, 84, 93, 31,109,239,126,232,162,169,  3,143,
- 56,235, 13,206, 98,113,155,243, 50, 79,229,235, 21,  0,  0, 32,  0, 73, 68, 65, 84,203, 94,120,223,123,231,226,190,166, 96,183,
-154, 51,179, 45,144, 49,111,247,121,177, 34,117, 94, 77,196,244,168, 90, 62,249,198,195, 34,212, 14, 96, 69,169, 67,165,110, 43,
-117, 44, 12, 62, 34,181,189,162,117,233,186,243,124,241,149,  5,105,116,119, 11,125,180,245,  0, 15, 10,252,211,129,248,117, 43,
-248,150,206,162, 81,191,116,110, 80,150,156,225,  3,157,177,219, 63, 23,144, 71,126,251,186,150,224,160,179,163,164, 15,200,245,
-149, 41,244,175, 36,228,200, 25, 85,186,152, 58,244, 14, 18,168,254, 54,  5,177, 36, 25,  2,114,160,232,105, 65,135,236, 80,145,
-104,251, 93,166,214,201, 46, 31, 21,120, 75,225, 74,130,119,245,240,153, 17,174, 68,  3,197,188,190,133,109,161,158, 85,184,239,
-  2,152, 43,209,225, 70,209,110,166, 99,133, 65,108,154,161,158,233, 43, 17,185,226, 33, 40,215, 77,223,193, 23,183,182, 75, 94,
-169,173, 64,174,244,232,229,  4, 47,100,164,127, 96,227,253,163,  4,221,155,176,250,113,195, 10,111,158,  2,253, 48,132, 83, 72,
- 61, 18,119, 46, 74,116,235,158, 12,136,110,161,110,161, 62,  2, 61,131,225, 28,134,193, 82, 62,196, 95,167,110, 13,105,109, 59,
-241,248, 14,144,167,161,123, 15,252,255,116,189,217,179, 37,217,117,222,247, 91,123,239,204,115,238, 84,115, 79,213,232,  9,  3,
-  1,130,  0, 65,144, 20,105,138,146,104,153,150, 44, 59,100, 59, 68,234,193,118,132,195, 47,140,144,159,236, 71,251,145, 79,142,
-240, 63,224,  7,135, 31,236,  7,  7, 67,180, 77,155, 14,153, 14,112, 16,  1, 73,  4, 45,145, 24,  9,128, 32,134,106,116, 55,170,
-199,154,110,213,189,247,156,147,153,123, 47, 63,172,181, 51,247,185,213, 68, 68,161,167,170,123,239, 57, 39, 51,215, 94,107,125,
-223,239,235, 94,132,254, 54,196, 43,182,210,200, 23,176,253, 38,108,126, 11,206,191,130,222, 27,225,199, 61,188,219,163,239,140,
-232,147,115,116,227, 15,194,232,235, 17,197, 14, 13,131,191,246,161,160,143,252,239,163, 77,160,114,182,113,241, 38, 91,244,231,
-164, 74,206,194,152,153, 99, 78, 75,171,100,111, 10,110, 77, 76,139, 77, 44,104,213,101,182,222,252,200, 62,194,147,178,124, 93,
- 65,231,196,192,210,242, 26, 92, 48,215,137, 43,149,115, 45, 50, 46,150,194,236, 99,169, 10,213,130, 21,237, 88,143,  6,209,191,
-102, 97, 14,176,232,130, 33, 88,167, 98,197,180, 22,198, 92, 20, 13, 66, 87,247,150, 89,231,196, 46,117,113, 82,231,173,190,186,
- 10, 63,212,221,183, 46, 61,180, 22,157, 87, 24, 26, 23,181,121, 86,246,250,217,208,164,170, 21, 89, 68,107, 45,238, 86,102, 22,
-221,146,191,158,170,  0,209, 99, 68, 67,179, 95, 69,108, 85,168,243, 60, 93,247,226, 90,139,239,221, 91,188,233, 83, 10,244,230,
- 51,  8, 18,102,225, 88,231, 27,175,209, 59,226, 82,121, 24,178,172, 43, 77,212, 27,231,144,173,218,157, 70,177, 80, 19,196,210,
-199,114,241,247,184, 24,246,180, 22,203, 42,118, 43, 37,207,211,135,118,188,190,100,249,233,124, 48,144, 38, 22,119, 65, 14,155,
-183, 61,198,  8, 49, 81,198,237,178,150,104,198,231,178,151,235,254,148,155,126,  6,203,208, 70,175,170, 21, 71, 43,234,102,101,
- 19,183,162, 77,192,110, 55,146,199,145,104,121,228, 16,  2, 99, 49, 46,116,125, 79, 98,144, 57, 26,118,114,232, 75, 81,236,112,
-227,  7, 98,  9,193,215, 20, 70,146, 83, 89, 88, 10,190, 16, 34,166,158, 41, 38,202,176,243,231, 90, 35,116,172,168, 91,177,206,
-188,157,166, 89, 62,140, 52, 89,236,186, 63,206,247,201, 66,186,174, 74, 18, 33,244,193,229,249, 13,  5,194,239,250,176,238,136,
- 71, 43,228, 87, 14, 72, 31,239,184,245,223, 63,224,250,110,  7, 71,145,112,146,144,231, 58,248, 88,129, 95,222,193, 39, 35, 92,
-125, 21, 14,127,  3, 86,255,192, 30,108,  6, 89,180,228,172,121,167,212,129,118,134,254, 28,190, 12,219,223,  6,249, 12, 76,135,
-176,125,207,150,245,195, 35,235, 94, 54, 30, 70,126,226, 82,213,226, 79,172,202,153,172,209, 80, 61,115,202,213,140,122,234,101,
-201, 39,141,106,146,214, 85,180, 56,204,149, 43,185, 43,222,170,238,145,119,184,183,201,118,219,140,217, 67,192, 50, 92,140,232,
-214,139,206, 70,209,205,132,158, 43, 58,140,148, 33, 91, 33, 31, 10,101,107, 31,116,201, 19, 90, 28,118, 80, 76,116,179,155, 96,
- 40, 66, 78, 97, 30, 23,197, 58,234,241, 12,122,141,234,196, 50,219, 51,119,111, 79,196,104,163,167,254,209,150,245, 63,187, 71,
-250,175, 95,132, 79,118, 76,255,237,143,217,190,126,129,156,  4,250,111,  6,226,223, 63, 54,133,248,143, 10,220,140,200, 58, 89,
-218,115, 15,114,165, 67,158,237, 44,176,229, 40,186,109,193,223,219, 19,247,192, 31, 38, 27, 91,151,206,170,195,129,218, 88,252,
- 34,195,217,136, 76,  5,178, 23,223, 67, 31,196, 62, 25, 77, 13,127, 88, 76, 76,247,221,  9, 94,238,224, 87,175,194,149, 43,240,
-234,198,138,238,153,117,162,170, 10,157,162,189,239,113, 58, 49,181,102, 31,144,209, 42,140,198,209,234,236,125, 69, 79,139,233,
- 32,126, 42,217, 19,234,206, 14, 61,157,224,137,229, 31,235,104,137,110, 60, 24,  9, 93,132,183,182,232,161,141,214,120,121,101,
-  7,149,221, 27,208,191,  3,252,164,117,236, 60, 99,226, 76,142, 65, 94,104,198,130,238,250,141,197,100,216,229, 20,226, 27,112,
-252,142, 21,120, 70,151,198,247,150,  2, 23, 94,130,240, 41, 43,236,233,196, 21, 95, 63,  0, 30, 65,254,190,141,217,119,119,208,
-211,199,112, 55,192, 15, 18,122,231,  9,249,221, 29,229, 34,163, 58,217, 61, 87, 39, 73, 79,236,193, 64,  4,189,240,202,226, 92,
- 97, 45,120,225,114,177, 90,182, 75,116,114, 81, 87, 41, 97, 78, 16, 19, 47,158, 45, 57, 69,212, 30,156, 41,176,128, 73,252,236,
-150,177, 48,167,122,235,212,  4, 65,109,182,171, 53, 38,119, 70,119, 20,155,240,101,153,221,158,115,145,150, 96, 95,175, 22,192,
-212, 60,236, 67,133, 51,121,200, 76,146,101, 88, 54,  5,165, 27,189, 19,159, 67, 50,124,116, 42,246, 26,166,166, 43, 37, 87,132,
-234,100,156,244,102,191, 46, 69,205,185,154,189, 11,244,148,182,169, 22, 34,153, 13, 45,246,221,130, 29,112,151,124,234, 50,119,
-147, 21,223, 58, 79, 62,154, 66,187,148, 21,117,248,  8,115,116, 39, 51, 20,165,150,161,128,136,206,202,123,113,117,254,  2,183,
-209,197, 10,216,216,207,234,231,116,121,223, 61,199,170, 74, 64, 36,217,126, 88,133,108,126, 49,146,139, 36,237,177,238,207, 59,
-106, 78,121,240,246, 51,204, 69,189,102,140,215, 46, 87,243, 52,235, 12,236,176,101, 63,133,237,165, 13,188, 98,221,180, 31, 17,
-100,137,146, 85,105, 57,245,251,232,185,210,202,  0, 93,192,153, 68,136,221,138, 73, 39,178,157,234,104,178,223,102, 20,109,237,
-150, 91, 59,157,162,151,130,102,116,222, 53,  4,  9,214,156,138, 32, 49, 33,209,186,245,130, 48,110,119,228,113,156,201,118, 89,
- 76,165,111, 27,215, 52,103,173, 15,227,192, 48, 77, 76,195, 96,247,167,239,195,163,251,239, 13, 85, 92,220, 38, 88,102,166, 64,
-153, 39, 36,101,  6,185, 69,  9,208,117,228, 50, 44, 20, 64, 93,130,149,102,199, 66,251,254,233,165, 36, 29,223,245,107,105, 93,
- 87,144,214,171, 30,214,  1,233,236,195,149, 38,231,150,226, 10,241,171,  9,185, 17,225,137,194,239,236,224,153,158,248,185, 21,
-252, 68,129, 79,140,240,242, 57, 92, 63,128,195, 95,130,213,127,  5,221,103, 33, 28, 47, 35,118,205,151,242,199,221,182,150,255,
- 18,118,191,  3,143,255, 21,164,159,130,248, 60,236,190,106,224,148,178,181,113, 99,167,240,108,182, 14,105,151,247,153,131, 49,
- 46,225,229,181,237,136,141,197, 76,196,196, 83,161, 52,187,243,228, 79, 28,187, 24,101,240, 39,203, 96,123,122, 61,155, 12,125,
- 58,170,237, 84, 47, 28,125,186,153,236,191,159, 91,209,214,193,140,255,101, 44, 54, 78, 25, 51,186, 41, 22,167,151,133, 82,138,
-125,152,193,  0, 12, 25,101, 64, 24,178,113,240,139,231,180,215, 83,119,244, 31, 57, 86,107,145, 10,121, 92, 48,157,231, 34,116,
- 42, 68, 41,164, 35, 97,247,141,115,174,252,143,119,137, 63,145, 56, 63,221,241,248,186,208, 29,194,225,227,137,195, 63, 62, 39,
-252,167, 55,144,163,  3, 24,  2,114,179,135,171, 61,114,128,169, 25,143, 35,164,236, 29,167,195,110, 86,  9,186,107,208, 29,248,
-211,117,131,205,192, 19, 28,190,104,209,158,247,190,  7,231,131,219,195,140, 28,167, 33, 27,169,237,208, 64,233, 26, 10,124, 97,
- 99,133,249,205, 12, 31, 57,135, 79,249,154,163, 38,135,244,  2,143, 65,199,226,147,145, 98, 95, 79,146, 23, 54,111, 21,119, 85,
-255, 96, 85, 66, 94,142,102,155,122,103,164,188,185, 51, 31,254, 88, 40, 27, 53,126, 66,176, 74, 82,142, 34,114, 22,145, 20, 41,
-187, 64,124, 48, 34,155, 12, 47,172,225,240, 12,174,127, 29,142,238,129,126, 20,228,154, 77,142,198,239, 65,186,109,133, 89,189,
-191, 13, 35,240, 30,240,151,176,121, 11, 30,159,195,195, 11,244,113,237,164,125, 98,112,242, 45,100,245, 69,136,  7,158,231,185,
-177,226, 95,118,118,  0,188, 24,225,126,132,183,  3,122,103, 71,254,241,134,252,120,231,240,  8, 55,123,199,138,250,170,211, 34,
-187,196,183,155, 76,  9,145, 16,  5,137, 50,251,231, 39, 63,211,214,181,250, 20,116,217,  9, 55, 69, 64, 90,216, 73, 37,160,133,
- 96,153,  8,193, 11,162, 23, 22,187,240,194,188,183,150,134, 39,190, 87,218,179,119,171, 42,123, 57,224,115,180,101, 54,107, 88,
-108, 54, 87,194,165,224,110, 23, 94,101, 89,178,148, 10, 66, 44, 58,191, 13,201,247,243,147,235,  2, 43, 91, 73,157, 93, 95, 67,
-149,150,157,100,125,141,102, 87,171,221,118,169,145,199,106,116, 76,130, 61, 18,202,236, 34,107,147,228,196,105,124, 50,143,229,
-103,107,171, 39,241, 85,191,254, 50, 54,213,198, 21, 38, 53, 74, 98, 22, 80, 85,159,189,241,173,100, 14,211,169, 54, 53,109,130,
-118,148,194,174, 48, 35,176,130, 67,173, 44, 72,106,233,123,103,137, 97,112,205,127, 21,173,133, 84,223, 20,130, 83,176,212, 43,
-122,237,146, 17, 83,169, 75,176, 78, 92,137,179,182, 64,221,173, 80,166, 76, 41,217, 86, 50,254,232, 44,222, 91, 91,137,240,134,
-164, 20, 15,145,125, 42, 97,100,158,244,148,102,153, 31,100, 57,236,204,217,240,213,174,167, 74,215,117, 16,  3,121, 24,104, 94,
-226, 66,229,187, 28,198,213, 28, 76,219, 67,170,206,185, 37,203, 65, 37,132, 90,128,109, 42,168,  2,227, 48, 50, 57,115,221, 14,
- 77, 54, 13, 75, 18,136, 93,162,168,178, 29,  7,118,219, 45,211, 56,248, 68, 33, 56,164,198,167, 26, 33, 46,185,  5,179, 52,192,
-131,133,106,170, 95,179,239,215, 82,124,148, 31, 41,174, 27,168,  7, 57,213, 75,200,156, 75,228, 65,116, 95, 55,177,255,123, 29,
-181,155, 94,187,  2,135,139,159,154,236,136,212,  2, 28, 41, 92, 87,184, 61,194, 11,163,253,251,159, 83,184,154, 45,120,226,106,
- 15,183, 94,129,254,215,129,127,  0,188,228,155,156, 13,232,195,167, 53,149, 51,141, 97, 11,229, 59, 48,254, 30, 60,254, 35,144,
-235,176,254, 28, 12, 95,179,110, 94,176,217,243,225, 51,176,218, 32, 87,119, 46,160,187,180, 27,104,149, 23,101,223,250, 66, 14,
- 78,150, 19, 27,161, 79, 30, 58, 50,248,150, 43,251, 94, 82,189,229,185, 80,171, 99,231,101, 17,115,109,138, 21,240,157,147,123,
-138,218, 63, 79,254, 75,138,141,135,182, 25,157,148, 60,186,191, 89,116,206,103,175,153,236, 99, 17, 46,178,107,229, 26,209,198,
-212, 36, 27,213, 56,214, 41, 47, 15,140,186, 51, 59,159,124, 77, 18, 44,  2,247,236, 40,112,250,111, 46,232,255, 28,166,  3, 40,
- 43,235,238,166,117, 64,223,157, 76,221,253,111, 93,135,215,109,162, 34,175,174,225, 70,135,244,157, 83,132,138,141,150, 67,129,
-120, 19,120,222,  2, 67,226,123,192,199,129,191,  9,252, 79,192,251, 32,207, 66,121,100,135, 42, 73,112,100, 25,164,250,230, 57,
-122,103,135,190, 51,160,119,183, 86,164,175, 11,233,113,177, 41,192,127,126,  3, 94, 78,176, 27,173, 64, 31,123,215,114,210,161,
-103, 25, 57, 72,232, 65, 54,109, 68,151,108,  4, 24, 93,206, 59, 21,179,156, 92,235,237, 49,217,  7,251,154, 27, 40,167,153,114,
-238,113,132, 67, 97,218, 21,166,179, 74,236,202,132,  7,163, 97,118, 49, 85,122,217, 21,210, 90,  9,103,230,245,231, 86,129, 23,
-126,  0, 71,239,129,124,  4,228,138,143,199,255, 16, 86,207,195,193, 85, 43,208,225, 28, 46,238,193,143,206,225,  7,  5,222,119,
-241,156,170,241, 15,174, 39,228,102,132,213, 14, 13, 79,172,200, 31,122, 21,121,162, 86,156,239,187,177,227,108,160,108, 38,202,
-253,145,252,112, 71, 25, 39, 52,249, 41,222, 15,120, 18,218,129,165,144, 11,108, 82,180,226,148, 21, 53, 19,181,123,160,253, 35,
-204,150, 73, 62, 15, 38, 75,227, 93,110,144,174,245, 65, 76, 40,104,246,189,110,169, 44,241, 86,101, 46,115, 33, 14,205,190,180,
- 90,207,114,110,138,159, 44,133,139,178,140, 58,101,143, 47,190,144,214,170,204,162,212, 29,178, 83,156,167,217, 78,165,140,109,
- 87,231, 95, 55,120,129, 28, 93,132,148,115, 67, 72,203, 51, 30,142,146,171,119, 70,200, 18,216,130, 41,152, 61,246, 57, 87, 17,
- 96,185,172,200,215,133,  2,199, 50,118,151,153,144,102,133, 71, 85, 61,  7,190,109,152,132,168, 50,239, 61,139, 44,185,  6, 50,
-251,243,117,137,231, 37,120,119,181, 47,158, 91, 34, 97,101,222,240, 45,  7, 49, 89, 70,253, 92,202, 38,119, 17, 27, 33, 80,138,
- 26, 34,187,242,193,125,100, 44,  8,177, 75, 36, 76, 92, 90, 36,250,180,197,222,159, 49, 23,198,113,154,119,215, 53,142,122,246,
-203,123, 71,234,196, 21,  3,190,224,187,102,205,123, 62,120,213,125, 69,187,238,241,217, 22, 44,109,165, 19,138,123,198,241,240,
- 44, 73,157,173, 79,234, 68, 87,151,233,199,124,152,209, 38,113,174,201,117,173,  0,162,253,158,221, 38, 35,193,247,232,196,104,
-127, 46,  8,211, 84,152,198,113, 17,172, 85,146, 95,176,124,128,237,148,173,152, 15, 91,212, 99,195, 67,140,206, 62,241, 72,154,
- 16,230,201,196,158, 88,193,125,248,226,171,144, 90,152, 85,139,175, 41, 10,164,132,196,100,220,246,236,235,205,198, 58,184,231,
-146,104,171,184,238,255,181,138, 38, 43,188, 58,201, 63, 62, 52,208,199, 65,177,241,117,180,189, 46, 73,205,170, 36,209, 66, 53,
-250,235,144,174, 90,  7,222,189,  2,233,147,208,127,210,198,142,230,145,114,185,243,105, 51, 98,111, 11,122, 89,110,241,242, 14,
-148,183, 61, 59,244, 53, 88,255,134, 35,187, 86, 22, 12,178,187,  7,195,  7, 16, 55,126,215, 14,190,176,154,230, 11,203, 78, 33,
- 14, 87,209, 12, 97,  7,113,  7,211,102,177,166,141,117,215,173, 70, 22,219,168, 21,166,209,121,238, 59,111, 17,182,  5,182,166,
-124, 86,177,147,154, 58,102,175,100,155,213,105, 54,246,185, 37,185,249,184,105, 82,139,116, 45,197,132, 74,201, 82,145,102,  8,
-  7, 58,127,249,157, 15,  3,170, 10,119,239,124,162, 54,178, 42, 14, 56, 25,155, 17,104, 22,115,169,109, 70,119,204,245, 78,128,
-205,102,207,139,110,121,239, 39,223,201,109, 20,121,182,183, 11,230,160,135,151, 12,167,106, 16,143, 12,225,121,123,175,195, 45,
- 63,209,191,  7,121, 13, 97,107,138,236,153, 32,253, 29,215, 63, 76,176,253,115,123,255, 70,183,215,125,245,148,242,187,143, 40,
-111,109,209,149, 89,172,166,179,145, 41, 90,206,142,136,176,186, 40,244,255,230,140,144,  3,242,145, 43,118, 13,141,238, 30,184,
-218, 35,155,130,238, 38,228, 57, 63,201, 28, 56,201,101,240,207,183,179,193,177,172,124, 14,252,234,202, 46,179, 31,238,224,145,
- 82, 30,219, 46,126, 10,133,173, 42, 91,135, 92, 68,135,197,164, 65,233,243,196, 74,139, 77, 17,222, 85,226, 54,219,250, 97,219,
-193,174,135,151, 47,144,171, 31,128, 30, 64,255,243,160,223,135, 15,222,128,241,161,173,107,206,  4,126,152,225, 13,224,141,  9,
- 29,118,140, 97, 52,246,149, 68,228, 40, 18, 14,147, 29, 74,114, 64,142,147,  5,179,100, 76,224,183, 85, 83,239,110,139, 77,108,
-130, 31,  4,187, 50, 83,213,138, 66,118,107,153, 78,205,131, 59,152,130,122,204, 53, 28,198,108, 98,102, 80, 88, 34, 72, 53, 44,
-236,239,150,132, 45, 65,141,214,167,152,195,160, 52, 97,  7,158,180, 82,233,120,104,153,147,172,106, 65,183, 97,201,126, 39,201,
-164,205,238,216, 30, 52,129, 42,192, 23,155, 38, 96,123,242,132, 37,157, 85,200, 74,100,  9, 45,178, 64,153,197,101, 19,106,  7,
-222,  6,140, 84, 57,  7, 11, 49,109,172, 67,255,214,143,229,202,107, 27,165,  7,138,  4, 82,178,123, 40,229,194,228, 95,173, 20,
-245,115,188,206,118, 47,230, 14,116,177,141,105,179,159,108,219, 64,109,254, 93,161,233,246,165,142,235,195,204,115,175,231, 39,
-209, 50,175, 33,230,174, 43, 84,100,172,238,237,137,235, 88, 57, 58,  0,108,210,133,159,223,226,138,231,  3, 81,171,126,114, 37,
-184, 52, 92,240,162, 75,108, 90, 81,161, 72,161, 72, 38,187,136, 48, 35,228, 58, 54,111,242, 89,219,169,204,  2, 83, 12, 51, 67,
- 61,180,147,155, 89,192,182,175, 48,111, 55,224,250, 84, 37,104,200,110, 77,247, 25, 80, 98,236,153, 80,166,113,154,129, 65, 69,
-100, 86,210,239,101,193,238,215,243,249, 51,179,243, 65, 43,244,132, 16, 29, 21, 28,163,239,211,147,101,151,143, 59, 74,153,154,
- 61,191, 29, 48, 74,136,236,198,129,113,187,165,140,163,237,169, 59,159,128,200, 18, 53,104, 59,244, 56,159, 50,102, 17, 98, 67,
- 31,172,  2,189,122,125, 76,121,178,248, 86, 85, 68, 38, 36, 70, 66, 12,100,141,115, 50,168, 54,239,226,135, 89, 11, 91,187,158,
-162, 75, 65,151,154,167,254,169,104,118,160,238,186,117,204,241,196,112,149,114,197,254, 62, 29,251,174,240,153,  5, 97, 41,  7,
- 16,250,198,  0, 51,184, 53,109,247, 33,177, 22,122,  9,241, 83,172, 35, 12, 47, 64,252, 85, 43,226, 26,172,187,143,207, 67, 62,
-135,112, 10,241, 45,  8, 63,182,140,239,105,235,187, 77,  7, 64,171, 64,153,188,224,143, 62,234, 28, 96, 28, 77, 88,181, 43, 86,
-176, 55,174,160,126, 48,153,213,171,130, 80, 38, 69, 39, 87,152, 79,182, 31, 87,241,130, 93,199, 85,142,119,157,159, 34,163,239,
- 56,165,194,251,189,107, 47,197,236, 13,149,249, 62, 85,166,181, 48,168, 48,100,101,240,145, 98, 29, 16,168,  7, 10,180, 17,128,
- 41, 56,164, 32,251,122,191, 14, 78,196, 10,248,197,104,231,174,177,179,214, 97,167,246,210,123, 79, 88, 77,209, 30,142,235,171,
-145,240,211,  7,139,234,233,102, 63, 11,224,116, 83,144,225, 14, 28,156,128,220,116,130,217, 43,160,223,128,242, 99,200, 55, 96,
-250, 52,164,191,  2,254,149, 41,150,206,183,240,208,216,240,250,112, 64,191,244,128,242,127, 61,  2, 70,228, 25, 65,111,249,120,
-252,205,128,134,133, 18,166,219,130,126,225,  9,253, 31,110,144,191, 53, 16,126,253, 25, 23,232,169, 41,223,233,145,251,226,150,
-163, 26,154, 99,254, 73, 89,  1,169,216,190, 47,129,172, 19,218,129, 60,155,204, 50,248,254,  0, 63,  8,228, 71,  3, 79,164,176,
-233,226,194,220,143,190,207, 12, 22,114, 54,105,161,159, 70,242,123,133,114,145,137, 79, 38,194,  7, 35,242,206,132, 12,  7,232,
-107,167,200,245, 31,  3, 47,194,225,103,224,246, 49,220,185,  3,111,  2,253, 26,126,229, 16,110,159,192,255,240, 67,242,239, 63,
- 97, 76, 19, 37, 23,164,159,  8, 99, 36, 12,147, 39, 38,  5,100,154,224,253, 96,206,138,173, 11,175,178,171,175,179, 35,140,179,
-209,247, 36,  9, 97,231,  7,185,236,202, 85, 93,196, 86,129,194,164,193,245, 24,203,142, 88,231,251, 41,204,161, 34, 82, 71,124,
- 90, 22, 27, 79, 85,172,  5,157, 71,236, 85,136,150,103,101,142,117,233, 65,133,236,227, 84,109, 18,229,146, 44,201,131,101, 98,
-239,241, 98, 80, 22,103, 21,169, 61,188, 82, 22,250,209, 15, 33,107, 97,138, 48, 77,166,159, 72, 85, 64,215,216,148,117,  6,229,
-232,135,242,196,235,195, 63, 70, 51,155, 76,121,217,125, 87, 14,212,108,183, 11,113,182,145,137, 22, 66, 85,249,123,209,175,126,
-252,122, 88, 86,151,113, 72,131,193, 85, 31,233,  7,127,143,181,237,154,154,154, 50, 71,151,122, 33,152,227,249,170, 12,177,  9,
-254,217,235, 85,125,244, 60, 71, 60, 95,202, 37,175,169,110, 53, 35, 35,233,194,134,  9, 21,219,218,172, 82,104,  2, 77,170,184,
- 78,102,190,154,197,  4,211,100,155,139, 71,237,105,147,230, 86,230, 96, 31, 63,214,204, 98,  1,247,222,123, 33,203, 78, 80, 11,
-206,102, 47, 57,207, 70, 60,253,235,208,177,151,171,210,222,239, 93,142, 53, 69, 11, 41, 38, 74, 76,142,251,206,205,238,200,231,
- 39,186,140, 56,171,221,186,  6,210, 46,171, 38, 27,169,231,106,177, 19,  8, 33,121,135,157, 12,246,146, 18,163, 42,187,209,147,
- 60, 93, 33, 42,238,118, 42,192,110,183,101,220,237, 16,205,196,202,128,166, 10,  2,125, 49, 50,227,111,109,213,218, 28, 45, 22,
- 25, 69,123,204,246, 67, 64, 36,154,123, 96,154, 16,103,214,139, 79, 66, 74,153,154,251,251, 82,102,125,  8,243,195, 97,209, 80,
-212,116, 59,177, 41, 77,153,252,128, 95,128,178,130,233, 25,136,215,125, 28,121, 27,250,107,176,242,206, 60, 28,154, 37, 39, 30,
-215,244,112,208, 11,104, 73, 62,243, 81, 47, 95,218,230, 95,254,184,131, 29, 10, 72,149, 83,  9,229, 30,148,115,203, 70, 47,239,
-194,248, 46,140,239,121,177,158, 42, 93,195, 63,216,201,118,150,249,137,169,138,199, 29, 12, 25, 29,188, 35, 61,247,104,209,199,
- 19,220, 87,120,127,132,243,236,156,105,179,146,217,238,215,119,186,217, 69, 91, 46,248,208,170,124, 15, 11,107, 82, 91,212, 82,
-108,242,215, 29,185,169,141, 35,100,242,134,118,235,107,249,154,225,172,165,197, 14,235,254,122, 81,108,140, 58, 23, 68,149, 25,
-114,178, 27,149,141,219,199, 71,181,174, 93,154,189, 74,246, 73,  0, 59,120,110,  5,171,143,118,139,240, 44,  4, 88,247,166,251,
-162, 88,100, 41, 43,152, 30, 66,186, 11,225,115,222,141, 71, 40, 55, 64, 62,  6,211, 21, 59, 88,233, 53,251, 92,182,192, 54,163,
-111, 94, 80,190,240,152,242,149, 51, 67,172, 30, 36,251,168, 55,  1, 58, 37,158,153,117, 45, 36, 31, 37,215,125,230,227,  9,249,
-127, 78,145,103, 87,200, 63,188,229, 99,133,100,157,198,160,240,100, 50,111,120,244,125,110,125, 98,119, 17, 73,142,159, 13,  1,
-121,111, 64,223, 24,224, 16,194, 47,246,164,219, 10, 95,132,131,239,238,200,231,138,118,182,250,216, 70, 65,163,208, 37, 27, 10,
- 76, 65,152, 78, 21,221,140,244,253, 68,186, 58, 33, 33,146, 78, 38,235, 70, 59,208,248, 16, 57, 81, 79,152,251,  4,252,228, 21,
-120,243,155,246,207,183, 86,240,246, 19,248,218,134,210,153, 21, 82, 39,108,106,147, 60, 29,169, 19,130, 20,239,104,155, 15, 61,
- 96, 69, 61,248,228, 40,251,  3, 61,213, 66,228, 15,168,178,128,  4,107,206,124,240,223, 59, 11,171,124, 65, 89,229, 41, 81,150,
-188,110,209,118,140, 91, 40,181,124,171,169,198,172,147, 10,203, 38,214,199,207, 26,196, 84,244,190, 71,175, 26,111, 13,150,138,
-166, 49, 32,217,192, 33, 14, 91, 94,236, 72,179,127, 37, 32,  1,142,187,196,213,103,122, 14,126,233,  4,121,109,205,240,187, 15,
-120,239,251,231,168, 40,147, 83,197,122, 12,101,187,228,138, 87, 63,244,126,  0,  9,245,128, 86,106,176,155, 41,139,251,106,141,
-107,159, 44,209,211,198,213,239, 95,239,218,187, 96, 15,247,220, 28,136,132,229,251,212, 40,151,168, 85, 91,235,100, 50,241,110,
-119, 38,239,177,167,108, 95,188,226, 50,219,239,180,  1,200,212,113,104, 96,  9,150, 17,247,246,207,193, 46, 46,122,144,230,160,
- 49, 43,222,101, 89,153,204,123,246, 37,128,110,182,180, 61,181,193,150,  5, 17,107, 67,148,138,171,149,166,136,102,251,140, 29,
- 93, 27,244,175,249, 58, 44,  0,178, 89, 60, 93,178,119,156,181, 33, 41, 79, 63,218,165, 57,189, 92, 70,201,206,129, 56,251,157,
- 44,238,255,143,169,243, 85,165,121,185,237,163,  8, 51,108,168,253, 98, 90,202,126,104,187, 67, 92,234, 74,167,106, 21,130,  4,
- 35,172,185,143, 60,197, 72, 22, 97,179,219, 82,166,209,223, 99,239,112, 69,152,114,102, 26, 71,114,158,252,125, 14, 75, 16, 76,
- 61,132,120,247, 29,176,113, 86, 29, 64,235, 37,204,210,222,132,171,174,120,138, 57, 47, 44,201, 10,202, 48, 17,198,  9,233, 19,
-154,162,231,120,232,165,  9,135, 23,124,196,234, 32,245, 58,169, 33, 67,126,152,111,116, 22, 73,223, 47,200,179,167,176,254, 62,
-164, 27,  6,126,209,183, 64,111,129, 62, 15,253,203,208,221,114,140,235,129,119,119,218,242, 40,155,113,136,254, 53,233,187,149,
- 20, 87,247, 50,247,161,220,133,252, 77,144,143,218,109, 87,222,134,233,  3,200, 15, 44, 70,115,154,108,217, 86, 38,163,135,149,
-108, 69,127, 60, 51,123,209, 46, 27,113,109,235, 12,207,237,104,  5,104,147,173,176, 63,200,112,207,  4,109,133,105, 22,247,204,
-180,180,236, 35,245, 97,241, 85, 86, 91, 75,173,174,179, 68,166,217, 45, 34, 11,224, 70, 69,140,102, 59, 45, 33,105, 59,183,167,
-239,170,218,180, 57,185,207,172,234, 75, 55,102,244,206,190,126, 48,117,159, 55,154,163,130,169,134,167,  9,116,147, 79,166,213,
-186,243, 24,204,105,117,178, 18, 78,142,109,  3,162, 90,144,215, 55,232,107, 23,200,141,130, 62,216, 25,180,231, 90,  7, 55, 54,
-200,245, 11,232, 63,106,221, 41,175,131,188,228,199,255, 27, 80, 94,  3,254, 22,200,191,128,233,174,185, 15,222, 53,139, 30,159,
- 91, 17,126,121,133, 92,241,192,232, 71, 62,126, 27, 51,218, 95, 16, 30, 78,164,149, 63, 69, 79,  4, 89, 11,242, 40, 32,234, 14,
-137,179, 12, 39,201, 60, 54,169,131, 81,145,139, 26,143,107,159,195,172,230, 74,106, 19,128, 85,231,  6,221, 17,254,242,  2,253,
-241, 68,201, 35,124, 92,232,126,227, 42,105, 55,113,248,207, 55,148,119,204, 34,183,253,160,176, 27,236, 97,190, 58,176,209,215,
-147,173,146,163,144,178,178,126, 48,210,203,132, 14,  5, 78,132,120,226,160,145,143, 60, 52,237,  6, 64,255, 34,188, 38,240,206,
-183,225, 15,222,133, 31,143,112,162,232, 99,115, 72, 72,175,243,168, 75,  5,100, 40,104,231,139, 80, 48, 92,110, 46, 54, 78,111,
-  1,231,131,117,235, 50, 45, 18,112,201,251,137, 91, 97, 14,212,104, 78,254,149, 31, 81,230, 77,158,141,178,117,177,152,205,164,
-176, 16,144,121,212, 94,246,133, 69,178, 63, 69, 51,177,152,143, 30,181,198,123,186, 34,189, 65,103,214,192, 20,105,250, 44, 81,
-232, 29,  6, 18, 99,228,224, 36,112,244,179,199,132,255,236, 57,152, 70,244,119,238,205, 72, 41,113,111,248, 80, 51,189,221,186,
-148,231,  7,145,238,137,156,234,248,170,218,239, 42,120, 36, 52, 60,247, 50, 43,174,212, 44,145,234, 74,255,102,199, 95,209, 18,
-161,186, 94,117,153,250, 78, 46,239, 90, 53,124,251, 57, 90, 83,108,220, 28,154,  3,132,204, 36, 55,153,117, 16,212,127,174,152,
-215,153,135,198,172, 85, 48, 13, 68,196,229,104,182,219,247,162,222, 98, 95,133,  5, 36, 99, 12,251,101,207,223,242,172,230,  0,
-158,218,173,106,237, 89, 27, 90, 30,213,203, 45,151,176,182,178,112,220, 29,117,188, 72,157, 26,227,186, 44,241,181, 13,175,103,
-217,221,150,210,214,211, 15, 65,209, 85, 36,238,126,177,111,231, 22,203,250,160,144, 66, 66, 82, 50,111,183,175,  4,130, 23,111,
-213,167, 73,120,203,  7, 41,123,125,101, 21, 76,202,101,113, 92,140, 22,189, 27, 35,187,221,142, 60, 14,246,186, 66,244, 21,131,
-146,115, 38, 15, 35, 37,231,185, 33, 89, 70, 74, 45,157, 46,248, 72, 63,204, 65, 45, 13, 33,127,111, 68, 94,119,251,165, 89,111,
-137,107, 18, 36, 38,198, 14,116, 24,144,169, 16,186, 68,137,145, 50, 57, 33,181,221,197, 87, 56,143, 68,135, 22, 55,181, 76, 23,
-123, 31, 85, 40,199,251,217, 22,255, 87,207,145,227,157,141,190,245, 42,228,251,176,125, 23,242,219,144, 95, 53,255,109,218, 24,
- 88, 67,142,188,219,246, 25,176, 78,205,  6,236,242,167,236,223, 76, 19,148,251, 80,238,128,254, 24,198,191,130,221,215, 33,189,
-  6,221,175,249, 92,170,131,114,  2,229,194,108, 68,101,176, 95,195, 19,152, 30,195,197, 57,122,110,176, 19,  6,177, 59,117,151,
- 29, 18,162,139, 98,253, 81,182,228,182,209, 21,234,243,145,223, 59,242,188,112,222,231,211,189,255, 55,202, 62,151,218,  8, 73,
-126, 58,149,125,177,125,241,130, 58,142,214, 97,141, 62,249,207,174,216, 76, 77,148,239, 30, 68,162,241,162,218, 84,192, 47,239,
-178,236,165, 70,181,232,211,204,140, 57,158, 31,184,163,219, 70, 68,237,236,115, 24,225,133,171, 16,186,128,246,166,146,230,222,
-132,254,193, 67, 27,191,175,221,223,125, 52,194,250, 28,142,255, 49,132,255,  0,184,135,  5,147, 43,112,100,135, 56, 62,  9,225,
-143, 96,247, 47,225,237, 29,250,230,132,158,142,144, 51,114, 45,161,201,222,107, 57,138,240, 66, 66,146,160,187, 12,159, 58,182,
- 11,109,114, 69,223,129, 93, 96, 33,  8,226, 33, 42,156, 21,120, 82,204, 86, 24, 28, 65,123,225,171, 17,  5,217,150,101,163, 83,
- 71, 94,100,123,226,158, 36, 27,219,223, 29, 40,111,141,148,239,142,200,183,182,132,159,233,136,191,188, 38, 93, 51,144,196,250,
-237,145,252,229, 29,249, 71, 35,225,102, 68,142,133,241,207, 71,206, 86,202, 32, 86, 88,226,164, 28, 61,154, 56,124,125,  3, 35,
-196, 11, 69,206, 15,208, 79,108,144,107,119,204,175, 30, 95,132,231, 62, 13,219,111,187,102,163, 67,182,  9,189,231, 63, 79,242,
- 61,104,189, 32,134,236,162, 45,153,201,128,182,238,105,242, 75,107,180,105,158,159, 73,148,236,201,129, 13, 89, 45,200,194,113,
-183,219,167,241,157,137,122,215,141,237,201,181, 54, 44,106,171,137, 98,187, 58,234,  3,177, 29, 11,178,204,114,151,253,189,204,
-137,107,120,231, 94, 84, 81, 49,124,110,110, 84,240,161,238, 29, 27,245,182,170,237,175, 31, 61,158, 24,126,255,148,254,247, 79,
- 25, 55,133,115, 50,155,152,201,121, 25,127, 87,146, 92,168, 35,110,191,134,235,121, 35,205, 29,187, 54, 51,238,198,111,239,208,
-145, 25,219,234,185,232, 45, 54, 85,230, 87,106,249,232,120,166,123,152, 97, 57,234, 60,114,102, 13,198, 28,190,164,203,  1,170,
-138,  4,163, 44, 93,178, 94, 10,101,169,194, 47,101,127, 15, 42,174,158,175,202,232, 24, 28,114,162, 25,134,237, 37,251,218,  2,
- 84,175,215, 68, 93,231,213,132, 60,154,228, 52,209,125,181,119, 22,230, 33,244, 76,116,171, 74,232,214, 83,191, 23,224,186,252,
-249,232,135,143, 86,114,161,173, 35,220,253,253,226,  7,133,122,192, 42,151,188,225,237,212, 56,248,148,241, 67,255, 87,199,198,
- 24,146, 53,  9,164,174,159,125,238,179,240,178, 90, 39, 75,251, 19,237, 23,205,102,232,227,216,227, 37,219, 32,  4, 99,199, 71,
-239,208, 67,234,184,152, 38,118,195,206,255,123,116,165, 63, 76, 99, 38, 79,147, 89,245,218, 81,186,163, 25,149,229, 64, 39, 40,
- 49, 36, 23, 38, 22, 27,163,123, 66,219, 83,236,155, 70,112,160,174, 93,209,121, 74,101, 59,254,210,117,110,155,132,144, 58,159,
- 22, 47,201,125, 79,191,125,242,212,103,104,211,131, 56,139, 55, 18,127, 57,192,195,100, 36,175,103, 39,184,122, 10,199,143,224,
-224, 46,172, 86, 80, 14, 96,188,  5,253,107,150,249, 28,175, 67,188,225, 59,241,155, 16, 14,172,200,235,232, 54, 40,125,122,145,
- 50, 31,213,162,251,128,158,129, 48, 25,184, 99,248, 54,148, 47, 65,247,139, 54,  5,144,119, 32,223,243, 14,125,107, 94,245,139,
-  7,112, 54,160, 15,  4,206,130, 11,221,116,153,111,111,124,116,186,117,239,248,153,117, 98,138,157,250,108, 89,105,150, 33,173,
- 65, 47, 85,205, 94,253, 51,165,238,153, 90,138, 83,123, 10, 95, 94,130, 58, 56,174,178,  3,134, 98, 33,  6, 53,179, 58,250,239,
-147, 92, 19,156,116, 62, 40,212,241,223, 76,134,218,187,153, 60, 31,166,117,229,  5,219,151, 20,255, 67,  5,232,130,  1, 40,198,
- 73, 89, 37,120,233,170, 53,181, 42,193, 72,113,135,193,128, 43,193,176,181,114, 43,193,237,  2,183, 55,200,245,127,  4,241, 63,
-180,137,140,161,214,128,231, 64,126,210, 98, 75,229, 15,225,201,111,161,223,  5,222, 75, 40, 35,250,100,180,177,193,219, 59,195,
-151, 30,  6,244,165, 14,169,249,233,197,218, 39,217, 22,152,196, 14, 94, 15,118,  6,167,121, 49, 89,248, 74, 12,150,173,254,252,
-161, 61,185,118, 59, 15,190,  9,203,211,188,171,106,161, 88, 23,158,120, 96,177, 81,240,158,237,209,231,  6,228,129, 21,206,221,
-215,183,236,190,182, 37,246, 66,186,153, 88, 61, 31,233,126,101, 69,252, 76, 71,136, 66, 88,117,132,207, 38,142,223, 63,103,120,
-125, 96,119,100,194,179,139, 34,236,128,252,112,226,100,216,160,163,146,  6, 63, 89,191, 40,200, 51, 63,130,131, 71, 16, 62, 10,
- 47,191,  6,219, 59,240,104, 34,190,182, 34,142, 35,211,227,178, 56,138,  7, 31,133,201, 37,220,101,237,214, 28,129, 32, 77,122,
-148,178, 20,185, 82,100, 86,138, 27, 77,203,174,207,169,237,212,155, 10, 96,177,201,165,137,144, 14,139,176, 43, 96,123,186,210,
-230, 74, 75,227,111,181,199, 82, 41, 62,101, 42,204,158,233, 69,250,189, 32, 32, 82, 16,130,219,231, 52,168,119, 17,203, 53, 94,
- 83,213,152,148, 11, 10,187,113, 55, 15,239, 74, 80, 74,182, 12,233,185,171, 11,194, 80, 92,  3, 80,133, 70,186, 31,237,186,236,
-140,181,153,100, 73, 99,133,178,123, 87,212,138,118,209,203,221,209,172,179,158,173,113, 21,224, 82, 42, 40, 70,150,103,212, 84,
-215, 97,106,218,  0, 11, 18, 49, 43, 93,214,253,192, 20,  9,115, 50,232,222,100,178, 13, 21,145, 75,237,171,221,223,147,185, 22,
-131,218,232, 85,131, 97,162, 85,231,144, 71,105, 19,212,180,216,202,162, 73, 88,147,102,164,155,116,113, 23,132,134, 48,151,129,
-209,117, 18, 53,236,100,105, 76,116,239, 32, 34,173,214,176,174,  5,154, 52,158,224,100,185, 34, 62,238,110,148,232,121, 79,161,
-214,248,168,165, 85,228,115,169, 43,151,249, 16, 41,141, 85, 45,197, 14,237, 18,101,202, 75,240,204,124,176, 43, 79,229,187,138,
- 95,207, 82, 49,179,205,156, 95,154, 81,124, 10,209, 58,116,207, 45,223,169,178,219,110,  9,197, 24,253, 38, 80, 45,214,161,231,
- 66, 46,227, 12,126,177,209,250,194,140, 87,173,153, 31, 46,188, 11,129,130,237,192,161, 32, 33,205,  7,166, 42,116,171, 90,152,
-138,127,149,134,253,191, 56,  4,140, 57, 95, 60,178, 59,166,132,166, 14,157,166,230,117,201,226,120,208,188,119, 44,171, 48, 35,
-156,248, 87,155,211, 84,190,113,134,188,190, 34,116,201,210,183,142, 48,150,246,141, 17, 78, 54,232,141,135,200,173,187,112,244,
- 29, 88,253,190,229,197,166, 99,136,183, 32,222, 54,127,121,255, 11,208,125,204,115,160,139, 89,214,102, 83,114,125,199,179,  9,
-241,136,144, 15, 33,118, 32,190,179, 31,191, 14,211, 19,  8, 63, 13,225, 89,232, 78, 13, 25,187, 23, 25, 36,182,251, 13, 78,142,
-216,120, 87, 62, 86,210,195,130,104, 85, 87,164,171,150,134, 83,153, 41,141, 18,105,191,160,107, 67,202,210,197,178,211,138, 45,
-195,146,163, 49,102, 59, 63,100, 53,171, 90,  5, 97, 36, 22,238,118,237,172,179,159,146,217,123, 72, 85, 31,163,182,168,107,  2,
-203,225, 64, 29,237,168,254,128, 65,157,104,235, 12,157,226, 40,250, 87,175,194,209,202, 66, 32, 36, 69, 75,169, 19, 87,153, 95,
-233,145,219, 29,242, 82,129, 23,118,200,201,223,135,240,107, 80, 30,248, 46, 93, 13,188, 18, 20,194,187, 80,126,  7,253,224, 91,
-240, 77, 69,223, 14,112,115,128, 39, 25,253,192,115,205, 71,243,221,201,218, 22,252,250,246,206, 62,159, 67,247,147,171,154, 78,
-225,193,136,190, 49,153, 20,226,123, 35,242,194,  8,207,117,246,125,122,223,245,247, 30,115,118,144,144,110, 64,163, 19,254,206,
-213,152,247,167, 88,236,235, 73,231,184,177,  2,215,  2,225,163, 43,148,137, 32,153,124, 58,241, 24, 24,139, 18,223, 25,232,222,
- 20, 14,191, 53,112,248,108,224,224,118, 79,248,116,130, 65, 88,253,195,  3,174,252,211,145,199, 23,202, 32, 54, 28,216,185,211,
- 81, 54, 19,199,239,110, 97,  5, 41, 43,178, 21,116, 44,200,205,251,112,184,131,195,103,225, 99,183,208,205,  7,132,243, 66,186,
-182,166, 60,217,144, 55, 19,154,202,124, 58,171,162, 40,237,  4, 73, 46, 66,211,197, 47, 45,141,119,121,190,182,180, 94,111,179,
-242,170,121,142, 45,227,220, 69, 41, 44,203, 44,172, 25,117,214, 69,172,212, 81,255,135,200,150,202, 76,240,210,153,141, 86,217,
-234,185,105,  7, 13,109, 26,216,136,113,230, 67,168,157,160,175, 74,231, 75, 57,216, 79,162, 33,217,  0,  0, 32,  0, 73, 68, 65,
- 84,232,209, 71,217, 33,219,225,183, 56,103,190,222,122,161,146,219,116, 17,161, 73, 48,224, 76,112, 27,103,221,202, 21, 93,238,
-143, 58,208,180, 53,131, 16, 66, 85,117,251,180,173,181,234,105,155,105,206, 82,172,217,223, 58,168,103,116,171,238,171,187, 69,
-197,197,131,174,102, 15,166, 21, 40, 33, 16, 84, 44,174,214, 81,156, 33,248,104,188,242,185, 92, 73,254, 97,225, 36, 51,141, 47,
- 40, 33, 23,195,127,122, 82,155, 86, 85,119, 21,180, 73, 99, 97,213,229,185,177,247,243,203,135,  9, 10,101, 22, 56,230,166,128,
-207, 82, 52, 49, 97,228,130,154,213, 61, 27,157,206, 93,189,238,229,209, 75,163,170,215,218,109,214, 21,101,101,215,107,139,184,
-101, 46,130,251,251,117, 26,234,217,190,247, 58,138,144,250,222,126,238,146,151,239, 53,143, 55,195, 94,183, 90,213,236,104, 45,
-182,251, 25,233,117,236, 30,131, 69,192,246,221,138, 85,151,152,128,237,102,235,129, 39, 66,145,192,148, 39,242, 56,249, 14, 63,
-207,238,  1,145,125,171,180,250,158, 98, 81,177, 27,159,189, 30,154, 69,154,159,209,179,211, 85,150,227,101,104,118,234,186,143,
-197,153,245,103,130,225, 97,201,133, 24, 35, 83,113,248,132, 44, 26,171,118,116, 23,100,241,164, 51,243,255,139,119, 15, 66,252,
-111,142,195,111,134,179,  1, 30,101,164, 15,240, 83, 29,252,233,  0, 95,221,161,223, 86,244, 91,130,188, 21,224, 97, 48, 95,213,
-110,128,199,143, 97,251, 14,240, 38,232,159,193,240,251,144,191,106,136,215,112,213,199,243, 71, 70,230,178, 28,212,230, 82,140,
-214,222,208, 65, 88, 67,186,  9,241, 99,150, 46,162,247,188, 91,191,238, 68,179, 39,246, 53, 66, 15,253,100, 56,207, 81,236,215,
-224,221,122, 85, 20,111,176,253,248, 69, 54,145, 91,171,110, 81, 83, 33,207,127, 95, 22, 79,226,114,204, 95, 64, 47, 34,139, 90,
- 81, 60,233,172,102, 68,143,234,150,178, 57, 43, 90,230,  7, 80,239, 77,101,181, 27, 77,186,255,160,129, 37, 47, 37,122,236,183,
-238,199, 25,251,120,107,223, 99, 92, 85,179,171, 74,180,245,227,249, 43,215,224,250, 33,  4,141,132,163,206, 64, 65,  7, 29,241,
-164, 67,174,174,  9, 47,175,144, 87, 10,242, 66, 65, 14,255, 14,132,255,  4,244,129, 59, 21,220,  8, 27,254,  2, 46,254, 55, 56,
-253,  3,244,141,247,208,255,119, 64,191, 61,161,219,  1,213, 17,221, 12,240, 32, 83, 78, 71,235,144,130, 53,247,146,252,226,125,
- 99, 68,191,185,177, 19,207,218, 77,189,131, 91,  9,119,197, 82,196,114, 65,222, 26,225,139, 23,240,141, 11, 31,189, 39,123, 65,
-170,232, 27, 91,248, 96, 50, 17,221,177, 24, 69,237,194,131, 34, 38,103,199,111,178,135, 14,128,188,150,224,176, 80,238,140, 76,
-217, 68,114,244,130,174,133, 45,194,249,  6,134,251,133,248,195,129, 48, 22,244,134, 50,124,127,228, 98, 43,156, 15,194,217, 96,
- 35,217,209,207,123,113, 87,232,118,197, 39,253,138,236, 28, 69, 75, 70,194,185,217,  3,111, 69,120, 50, 33,239, 41,114,108,128,
-  1,189,176,107, 74,147,204,133,122,238,126,178,146, 75, 99,113,172,100,169,250,176,208,165,208,104, 83, 97,100,217, 18,205,254,
-235,160,203,206, 57,184, 66,123, 63, 36, 59, 92,138,157, 44,243,195,158,189,225,165,236, 35,221, 42,157,165,202,193, 43,189, 37,
-120,209,206,193,199,159, 94,252, 43, 31,199,159,254, 86,116,170, 86, 95, 93,189,175, 51, 50,162,222,126, 85,252,151,231,235, 91,
- 23, 97, 92,176,  2, 60,186,184, 42,121, 54,123,  5, 97, 69, 49, 58, 87,167, 74, 39, 54,177,218, 53,  1, 50,226,  4,187,106,160,
- 48, 83,251,146, 89, 94,191, 79,174,187,211,246, 93,144,202, 37, 23,183,149,182,122,172, 74,212,140,144,186,166,251,109,193, 62,
-254,249,248,222,164,130, 73, 44,  9, 44, 16,146,131, 78, 80, 68, 11, 82,178, 27,112,124, 34, 24,  2, 26,163,233, 32,136,116, 49,
-178,238, 87, 72,119, 64, 73, 43, 52,246, 16, 19,154,146, 49, 27, 66,104,120,242, 50, 11,188,234, 20, 98,182,177, 53,107,  1,219,
-126, 52,106,  8,109,136,  4,149, 25,224, 34,202, 89,225, 80, 89,233,158,192, 54,167,149, 53, 67,205,176,167, 95, 95,198,  5, 81,
-246, 73,119, 34, 77,225, 19,220, 47,110, 86,203, 46, 38,194,170, 39, 79,217, 20,225, 90,109,114,186,168,251, 61,129,173,238,199,
-231,217,137,234, 62,208,197,197,164, 49,134, 37,194,180,235, 32, 37, 46,118,131,129, 99,196,223,191,105,162, 76, 19,228,137,201,
-241,221, 85,177,110,159,223, 66,107, 19, 49,207,122,168,246,180,104,197,180, 74,231,230,215, 55,  7,204,216,215,144, 69,193,176,
-151, 74,183,136,  0,154, 57,134,184,200, 79,157,205, 65,205, 34,112, 85, 87, 89, 14, 16, 50,131,115, 76, 32, 87,180,204,147, 20,
-179,147,  6,210, 91, 91,225,250,182,112, 24, 54, 28, 94,  7,249,202, 68,121, 99, 67, 25,242,172,166,208,187, 29,242,221, 21,225,
-217,222,236, 95,231, 10, 55, 34,242,241, 12, 31,153,224,246,  6,174,255, 49, 92,251, 18, 28,220,132,245,207, 66,252,183,161,251,
-121,235,188,195, 85, 87,204, 15, 86,172,227,179,160,143, 93,241,126,  0,241,208,126,143,158, 65,190, 11,242,216,118,154,161, 51,
-100,108, 92,217,168, 62,222, 71, 14, 30,161,  7,152, 77,235, 84,108, 71,171,  1,210,100,133, 61,136,133,114, 20,167, 39,209,180,
-219,173, 76,248, 67,148,155,243,190,188, 34, 44, 85,109, 60, 90,149,233, 85, 57,235, 99, 67,101,201,130,137,193, 58,143,202,193,
-174,162,184,188, 23, 33,185, 88, 50, 82,180, 67,195, 84,149,200,205, 46,191,158,238,196,  9, 84,189, 71, 99, 38, 89,116, 99,207,
-118,112, 99,  5, 65,140,223, 46, 87,122,194, 81, 71,184,218, 35, 47, 30,160, 47, 68,120,121, 68,110,158, 64,247, 43, 16,255,174,
- 23,243, 17,244, 24,194, 35,224,159,161,239,126, 29,253,215, 59,202,151,  7,244,225,100,148,182, 94,209,164,200,155, 62,157,247,
-145,163, 14,130,116,222,113,108, 20,185, 42,104,202,198,126,255,171,201, 34, 69,174,121,162,206, 21,187,195, 53, 66, 94, 43,225,
- 72,225, 64,145,  7, 19,242,222,214, 44, 99, 69, 61,192,165,160,255,252,  9,122, 91,144,191,125,136, 60,159,140, 32,248,126,182,
- 64,152, 39,  5,253,222,136,158,102, 88, 25,122, 55, 51,145, 58, 97,221, 57, 85, 13,211,222, 73, 48,248,223,233,160,232,166,208,
-127,107,203,244, 53,229,113, 22,198, 32,108,179,178,205, 86, 16,214,  2,154,157,153,252, 56,115,172, 91,232, 32,  5, 69,206,122,
-120,152,209, 23,129,103, 50,114,114,  0, 63,123, 21,121,172,164,215, 33, 92, 23,194,235,129,233,193,232, 34,115,157,  9,198,140,
- 62,  2,109, 14,101,115,189, 13,127,141,255,231,178,222, 72,155,249,106,217, 79,161,122, 58, 50,186,217, 65, 95,234,227, 22,172,
-171,236,  5,166,204,160,166,121,228, 26,125,199,237,249,215, 25,207,193,110,236, 89, 25, 31, 87,137,255,113,153,195, 52,108, 50,
- 97,193, 24,153,154,208, 85,187,127,157,213,236,168, 46,123, 95,223,160, 85,139,210, 65,128,181,143,124, 75,195, 99,175,204,236,
-196,  2, 27,116, 92,196, 28, 51,154,125,151,123,153,180,165,151,252,113,210, 68,158,202,165,128,149, 54,202,116,242,206, 71, 85,
-200, 49, 89, 16,199, 52, 34, 20,231,122,123, 58,219, 28, 20, 99, 16,160, 34, 22, 50, 21,252,207,148, 26,252, 65,178, 81,175, 84,
-170,155,139,  5,253,161,108,151,134, 15,204, 75, 54,239,123,140, 75,200,135, 24,226, 20, 53,118,134,150,105,254,115,165,105, 72,
-234, 97, 35,184,117, 81,155,157,255,236,181,247, 17,246,158,189, 76, 47,137,216,170,186,124,182,249, 86,172,171,159,  1, 89, 94,
-123, 45, 76, 79, 73,231,154,108,215,250,255,209,161, 97, 81,160,235,123, 63,252,149,167, 48,105,218,138, 69,133,253, 29,125, 83,
-208,101, 94,142, 58, 10,214,177,173,125, 74,132,148,184,152, 38,242, 52, 16,130,101,219, 79,211, 72,241,253,121,174,205, 94,115,
-144, 43,141, 27, 97,182,167,248, 61,180,231,138,151, 89,178,106,214,219,138,205,189,164,236, 88, 16,185,  6, 40,162, 10, 45,103,
- 44,236,146, 42,103,209,200,230,206, 97,246,184,251, 10,182,177,140, 20,103,240,183,148,199,202,251,151, 24, 72,155, 16,136,209,
-166,158,135,119,118,240,189, 13,131, 51, 31,147,192, 90, 11,235,221, 72,218,108, 41,119, 35,101, 99,167,154,116,144,224, 47,146,
-137,117, 14, 34,114, 34,240,209,  2,159,126, 23,249,248,255, 13, 47,252, 30, 92, 63,134,245,199,160,251, 71,144,254,166, 97, 56,
-195,145, 63,132,214,134,225, 84,247,155,151, 83,147,110,135,107,134,150, 45, 24,228,102,245, 14,108,191,103,243,238,248,  2,244,
- 71,200,250,125, 56, 26,208,247,177,214,245,188, 24,217,194,125,172,236,196,200, 98, 23, 66, 41,226,207,171, 96,138,228,232, 99,
- 74,105,118, 99,178,  8,142,196, 33,207,101,242,110,174,168, 71, 90,170,227, 29,217,  3,103, 38,207,140,209,232, 23, 77,222, 87,
- 35,199, 70,221, 90,253,166, 53,167, 62,151, 75,138,120,239,196,170, 37, 67,188,107, 73, 98,138,233, 46, 40,135,  1, 14, 11, 60,
-119, 69, 72, 71,  9, 89,119,132,  3, 67,249,198, 27,107,120,177,135,151, 34,225,118,129,147, 23, 32,253,187, 16, 63,235,140,243,
- 96,254,244,248, 87,112,241, 63,163,223,249,128,242,123, 91,242, 55, 47,200,247,119, 22,125,218,155,  6, 82,122,177, 36, 57,127,
-250,202, 42,216,123,124,205,212,235, 82, 10,186,197,186,249,152,209,247, 39,228, 98, 66, 62, 62, 33,107,167, 54, 93,241,207, 38,
- 42,217, 74,  4, 92, 40,241,125,179,108, 49, 40,252,196, 33, 92, 13,232,170, 48,253,127, 27,248,242, 99,194,171, 29,225,167, 59,
- 75, 69, 27, 60,151,253,182, 32, 69, 40,119, 70,202,189, 17,174, 65,217,  8,105,172,126,106,241,248, 96, 37, 37,235,192,183, 69,
-121,112,  1,219, 81, 24,124, 92, 56,184, 75, 33,123, 51,158, 60,  2, 30, 32, 63,201, 92,121,115,107,209,171, 87, 11,114,154, 77,
- 39, 48,246,232,173,  0, 55, 59,248,187,215,144, 17,194,131, 72,247,217, 14,185,179,101,122, 48,218, 65,103,212,121, 26,222, 42,
- 98,247,206,150,165,217, 13,183, 81,151,141,  7,186,236,141,110,132,210,108,141,235, 42, 71, 84,246,145, 30, 66,227, 70,113,239,
-251, 37,187,105, 21, 67,201,222, 30,186,  1, 93, 56, 32, 99,102,126,235,228,254,238, 64,167,197,114,196,235, 20, 41,152,162,189,
-  0, 57,139,175, 26,172,  8,150, 25,177,202,220,209,236,145, 68,159, 82,123,195, 58, 64,103, 35, 40,138, 42, 67,118,191,185, 23,
- 40,117,211, 77,251,222,168,238,167,151,213,226,158, 91,139, 92,245,221,  4,  8, 26, 22, 79,127,147, 10, 38, 31,162,109,194,187,
-167, 73, 77, 12, 53, 54,121,221, 73, 76,105, 95, 37, 32,197, 31,190, 65,132, 18, 35, 18, 59, 99,136,171, 71, 57,251, 33,103,244,
- 78, 81,220, 75, 95, 60,127, 92, 93, 87, 80,161,244,165,  2, 99,114,178,102,162,212,180, 46, 43,251, 29, 32, 18,153,130,123,188,
-103,130,159,237,187,231,241, 56,151,140, 15,218,252,172,212,173,141,173, 15,164,  1, 96,181,160,206, 60, 43,172,151,104,213,125,
- 91, 90, 43,144,171,144, 30,109,248, 48,178,160, 90, 29, 81, 43, 10,177, 75, 72,234,200,211,248,148, 35,142,189, 78,223, 39,  6,
- 65,230,216, 96,217, 27,100,215, 57, 85,245,142,139,229,152,119, 29,131, 22,198,237,214,176,190, 18,200,101, 32, 79, 19,154, 39,
-255, 90,101,175, 99,174,133,214,137, 77,243, 72,190,226, 99,  5, 63,216,214, 48,156,217,211,175,174,196,119,182,124, 21,205,169,
- 77,166,171,160,148,102,205,146,203,178, 72, 81,215,  8,132,228,236,120, 64,250,142, 60,142, 38,164, 21,  3,109,233,222, 33,129,
- 61,176,141, 89, 15, 45,174, 54,254,147,231, 15,127,179,115,201,237, 16,132,243, 24, 56,147,192,185,  8,103,  8,231, 42,148, 96,
- 23,213,249,144, 57, 45,133, 33, 22,138, 20,134, 97, 96, 60, 31,152, 30,111, 41, 31,236,208, 59, 35,124,  5,248, 82, 68,255, 84,
-224,173,  1, 57,127,  7,228,139, 32,191, 11,250,117, 43,230,114,203,189,239,189, 23,154,232,197,254, 25,235,236,229, 69, 43,224,
-225, 58,196,231,160,123,198,232,118,156, 58,147,251, 10, 28,128,156,236, 96, 93, 22,190,106, 87, 79, 56, 97, 70,248,121, 12,149,
- 91,115,150, 43, 81, 90, 26, 66,176, 44,240,250,123,203,180, 48,181, 43,163,125,102, 16,248,205, 16,  5, 82, 20, 58,119,234,229,
- 73,103, 82, 86,185,116,209,215, 67,111,244,  8,240,206,215, 33,227,162,105,154,213,173,193, 85,190,177, 89, 61, 31,116,194,202,
-199,238,215, 50, 60,251, 92,164,127,110, 69, 56,233,  9, 39, 43,226,173, 53,225,246,  1,124,180,135,143,  9,242, 66, 15,135, 31,
- 55,184, 15, 47,219, 45, 47,226,170,174,127,138,190,247,127,192, 31, 63, 36,255,175, 23, 76, 95,127,204,227,237,192,233, 90,121,
-146, 96, 80, 37,  4, 11,111, 56,223, 40, 59,207,139,150, 11, 53, 61,198,181, 68,184,209, 67,143,165,181,157, 78,232,131,209,176,
-173, 23,217,146,225,178,218, 52,229,  8, 75,169,187,155, 41, 63, 28,209, 15, 50,122,191, 32, 71,  1,249, 72,132, 51, 69,142,109,
- 26,160,113,162, 92, 12,236, 94,223,112,246,198,142,139,191,216, 81,222,218, 33, 79, 38,228,186, 16,126, 97,141,124,126, 77,120,
-181, 39,124,106, 69,120,177, 51,209, 75, 54,122,220,202,109,248,235, 35, 97,213, 43,195,  4,167, 91, 97, 82, 97,235,197, 96, 48,
- 83,  4,131, 86,  2,155, 80,130, 44, 78,135,  8, 97, 80,210, 46, 47,214,133,173,189,118, 75, 35,  1, 78,122,120,121,133,188, 63,
- 64, 17,226,115, 29,193,151,160, 53,221,172,  6,243,  8,210,  6, 40, 45, 69,254, 82,138,149, 94,162,115, 20,246,187,241,189,223,
-223,196, 35,  7,167,183,153,114, 59, 46,192, 87,185,100, 60,158, 83,187,100,190,208,164,249,  1,130,167,101, 77,197, 56, 19,234,
-243,253, 18,116,246, 52,151,185,251,150, 89,147, 82,153,236,197,185,237,243,175,  6,129,106,126,110,153,247,193,210,116,109,201,
- 15,197,125,130, 85, 12, 36, 49,215,192,144, 97, 82,221,167, 46, 58,133,113,200, 31,190,210, 74,  1, 58, 31,163,103, 17,247,198,
-203, 98, 41,144,250, 90,131,143, 59,  3, 53,149, 57, 86,  8,141,180,130,172,101,149, 48,185, 37,111,116,212,108, 85, 94, 71, 87,
- 61,219,180,219, 16,164, 65,162,107,106,220, 83, 92, 20, 77,201, 15, 58,117,159, 95,156, 74,233,  3, 19, 17,186, 40,164, 32, 75,
-  4,172,199,228, 22,138, 13,199,213,156,  8,234,175, 33,  5, 33,164,206,198,210,212,247, 95,103,172,108, 16, 89,160, 53,254,179,
-170,200,211,158,242,102, 20, 95,199,136,245,181,137, 29,227,150,126, 94, 91,234,159,238,  7,139,104,227,125,170, 30,106, 93,  4,
- 73, 22,181,107,201,104, 81, 32,174, 14,252, 64, 56,205,187,116,109,  2, 77,236, 32, 22,136, 30,  1,171, 85, 32,217,220, 52,218,
- 72,239,140,235, 30,232, 82,207,122,213, 83, 98, 98,179,221, 32, 37, 67,180, 41,137,141,221,  7, 11,128,210,203,200, 28,153,223,
-131,138,221, 53,247, 66,216,211, 47,204, 83,  3,145,189,110,219,244,  6,121,185,113,253,123,180,160,229,197, 37, 33,203,184,195,
- 79,216, 85, 64, 87,170, 69, 83,156,248, 55,141, 14,227,105,217,184,230, 93, 15, 18, 45,152, 70, 76, 20, 40, 41,154,219,226,191,
-124,246,240, 55,147, 27, 53, 11,194, 64, 96,  7, 70,179,242,  4, 31,137, 48,168, 24, 88, 76,132,173,  8,155,108,182,240,199, 17,
-206,162,112, 30,149, 49, 20,114,158, 40,155,  1,121, 48,193,157,130,126,165, 67,190,209,193,102, 68,210, 29, 83, 87,151, 63,176,
- 81,187,220,246, 29,188, 35, 95,101,106,150, 93, 14,169,  9,215, 76,148,151,110, 67,255, 12,132, 11,131,105,107,130,238,  0, 57,
- 84,228,218,  0, 87, 11, 28, 57,219,187,143,150,246,229,209,122, 18,237, 36, 99,170,156,138, 76,117,193, 69,146, 69,125, 61,184,
- 98,183,217,197,213,247, 63,213,164, 40, 23,107, 71, 49, 21,122,113,210, 85,181,140,176,247, 16, 95, 38, 80, 33,154,170,182, 51,
- 81,186,237, 17,235,206,181,209,102,204,130,112, 63,163, 28,  4,179,172, 29, 71, 56,217, 40,215,111,116,244, 31, 63, 32,244, 43,
-226,141,  3,194,237,181,101,215,127, 60, 32,175,  4,228,218,179,176,250, 60,196,159, 55, 42,160, 76,222,230, 60,130,241,127, 65,
-223,254, 38,124,185,144,255,112,195,238,205, 51,238,167,204,253,149,112,166,182,107, 62,203,246, 64, 60,219,  9,143,118,194,102,
-244,144,176,  2, 93, 22,194,245,104, 35,118,  1,253, 96,162,220, 29,152, 30, 78, 51, 46, 32,111, 50,242, 36, 19,206,213,114,228,
-223,203,148,187, 19,250,129, 89, 15,195,115,  9,249, 72, 71,120,161,179,234,250,110,134,105,160,188,189, 65, 31, 14,156,159, 21,
-222,139,118,173,157,110,149,241, 97, 38,252,104, 36,190, 51, 18,158,137,200,107,  7,200,203,107,228,246,138,248, 82, 32,220,140,
-196, 40,164, 67,232,110,  5,226,181,128,158, 41,167, 79,224, 34,135,121,165, 49, 78,230,126,156,178,237, 24, 83,172, 39,106,153,
-187,178,236,159,163,168, 18, 55,254, 48,149,154, 75, 84,233, 97, 10,215,123,120,190, 71,238, 26, 66, 82,158, 75,200,198,191, 81,
-242,192,135,184, 60,232, 68,247,211,169,246,241,150, 11, 35, 91, 26,161, 84,227,128,219, 91,197,  5, 22,123, 86,106,246,241, 33,
-232,158,233, 68,218,125,186,196,249,139,213, 68,171,217,102,227, 86,174,162,178, 32,152,235,175, 36,243, 20,161, 52, 83, 37,196,
- 19,187,128, 66, 88,246,231,218, 60,238,157,119, 94,  2,205,247,182, 78, 38,122, 88, 75, 77, 74, 78,224,185,240,202, 38, 11,219,
- 22,246, 82, 41,113, 52,224,193,150,218, 86,197,167,158,174,140,109, 63, 24,170,149,203,119,229,177, 41,216,234, 93,117,240,  2,
- 22,188, 16, 90,199, 83,215, 95, 58, 11,217,212,225, 31, 90,242,114,152,168,138,230, 70,164, 92, 21,202, 82,227, 58,125,250,161,
- 49,153,142,160,100,119,228,152, 45,169, 52,184,240,250,115, 76,237,  7, 30, 22, 37,248,172, 76,247,  3,  9, 41,206,251,233, 16,
- 59,223,175,218, 26,160,175,190,123,177,178,220,137,165,159,153, 37,177,204,182, 50,221,187,246,164, 25,149,219,243, 81, 69,246,
-124,225,101,239,242,213,189,195,128, 60,125, 78,152,133,101,181,232, 74,140,  4,132,212,245,214,165,231,105, 57,232,180,250, 38,
-239, 66,103, 94,187,132, 69,  8, 22,132,167, 96,180, 62,114, 79,201, 52,  9,113,213,179, 25, 71,166,221,206, 72,131, 37, 51,229,
-201,196,210,165, 44,163,107,221, 79, 61,146, 86,101, 31,130,255,114, 17,170,255, 60, 93, 76,116, 93, 79,136,209, 14, 89, 94,128,
-149, 96,160,167,185,235,215,217,103, 95, 49,183,165,  2,206, 40,174, 43, 89,126,158,146,173,139,148,102,255,102,105,123,186,103,
- 69,173, 48,160,224,201,112, 82,181,  6, 62, 33, 10, 18,136,255,228,249,227,223, 76,110, 13,153,138,237, 27,183,165, 42, 69,157,
-103, 21,  2, 59, 21,206,179, 48, 98,234,234, 18,133, 93, 17,182, 69,217,169, 37,144, 93,136,176, 11,194, 38,  9, 83, 80,162,102,
-194, 52, 89,123,116, 39,194, 55, 58,120, 91,225,226, 62,116, 95, 70,226, 23,172,157,139,175,120,  1, 58, 48,196, 23,161,153,  1,
-137,137,232,194, 53,203,173,238, 94,128,238, 42,244,147, 37,141,165,222,232, 99,199,130, 92,203,200,245,  1,174,103, 56,193,212,
-213,201,192,  6,210,133,229,131, 74, 11,171, 82,130,123, 33, 39,245,128, 23,165,234, 66,234,141,218,121, 49, 78,209,111,190,232,
- 65, 15,197, 44, 73,237,184, 61,200, 37,212,165, 44,112,139,152,236,225, 49,233, 62, 37, 74,196, 58,254,228,162,245,181,135,158,
- 29, 39, 51, 35, 28,  5, 88, 35, 28, 61,211,179,250,236, 49,225,228,144,240,194, 10,121,173,135, 79,  4,120, 45, 34, 55,175,195,
-193,103,172,152,199,143,  2,174, 99,144, 96,106,247,233,183,209,  7,119,225, 59,145,252,197, 51,118,175,159,242, 65, 46,124,224,
-  7,180, 41, 91,214,205,206,245,104,231,158,  6, 42,193, 58,136,149,194,250, 40, 18, 95, 94, 17,110,116,246, 30,110, 76, 64,183,
-221, 42,143, 51,108, 85,216,170,112, 49,193,230, 65, 97,120, 47, 19,207,149,120, 40,200,237,100,221,245, 47, 31, 32,183, 18,250,
-142, 41,158,202,247,183,148,247,  7,166, 63,185, 96,251,112,226,145,103,166, 76,110,118,216, 69,216, 78, 74,185, 59, 18,191,186,
- 69,238, 77,179, 93,144, 46, 34,193,198,251, 37, 23,244, 73,161, 60, 42,236, 46,148,179, 81,216,101,153, 95,211, 99,255,107,138,
- 86,208,131, 68,255,188,150, 66, 23,196,172,100, 89,108,142,155, 54,101,230,105,115, 86,144, 51, 69, 14,253,  3,189,209,195,205,
-  4, 63,154,144,117, 64,142,  2,250, 32,155,171, 33, 25, 54, 54,164,104,145,198,200, 94,199,189,116,244,117,124,185, 60,164, 90,
- 77,198,194, 16, 95, 58,220, 24, 27,206,251,188,107, 92,148,187,114, 57,193, 41,132, 26,206,108,191, 55, 93,154,161,138, 93,195,
-243,232, 81, 91,162,152,236,  9, 56, 39, 87,186,151, 25,194, 18,108, 53, 85,154,189,174,119,219,203,136, 93, 23, 37, 59,150, 85,
-208, 71,235,112,131,207,115,173, 11,134, 11, 21, 70, 31,249,106, 67,155, 75,254,217,132, 70, 16,215, 24,  2,230,131, 77,242,221,
-124,141,118,152, 27,116,135,208,172,130,160,151, 86, 14,117,102, 17,252,160, 31, 28, 98, 83,154,221, 63, 78, 81,107,243,205,235,
-103, 90, 90, 15,121, 51,117,169,185,221, 26, 92,217,172,217,  4,103,170, 51,102, 87, 47, 77, 27,180, 10,179,106,161,245,221,115,
-253,123,149,128,132, 72,137,201,139,126,130,212,161,211, 96, 62,237, 70,253, 62,239,164,133,134,199,111,141,197,222,126,189,249,
- 61, 75, 38,183,189, 31, 42, 97,111,135,141, 11, 61,151,117,146, 46, 63,248,229,162,126,185,171, 76, 70,145, 76, 18, 72,171,181,
-173,110,178,189, 11,165,148, 61,155, 66,181,172,133,154,128,134,161, 88, 45,  0, 70, 46,145, 76,237,189, 78, 49,178,234, 87,172,
- 86, 43,134,162,236,182,155,217, 89,148,167,201,173,205,121,129, 70,181,247, 73,179,187,183,  2,153, 22,145, 99,213, 63,  4,119,
- 21,185,242, 93,221, 26, 87,113,177, 18,189,  1,110, 24,  1,141,126,112,161,  9,126,152,164,203,237, 11,179,170, 61,134,246,  6,
- 95,152, 38, 78,178, 11,226, 93,121, 12,132, 24,188, 67, 79,243,247, 73,193, 97,  7,  8,236,138,199,130,170,123, 17, 85, 40,158,
-220, 54,170, 48, 86, 11,150, 58, 71, 58, 70,198,146,  9,110,247,144, 82,216,169, 18, 35,108,  5,182,162, 28, 78,153, 62,103,186,
-243, 29,221,251,145,240,122, 79,248,227,158,240,249, 53,250, 31,223, 67, 62,241,223,193,201,111, 67,255,239, 67,250,101, 27,205,
-203,161, 21,114,137,205,192, 78, 32, 30, 89, 97, 15, 47,195,234,151, 12, 85,171, 27,243,181,231,  7,  6,180, 25,127,132,108,238,
-194,246, 33,156,239,208,135,  1,222, 11,112, 47, 34,167,  9,121,164, 48,140,200,110,162,236,  2, 58,100, 66, 54,180,168,246,138,
-140, 98,224,137,156, 73,106, 83, 10, 89,  7, 27,207, 79,214,201,215,241,162, 20,217, 75,196,154,109, 12,141, 66, 84,154, 28,104,
- 84,108, 55,231,191,127,229,250,164,212, 80,244, 87,106, 39,109, 27,183,  7,226,145, 16, 83, 71, 56,234,136,159, 61, 68,174,247,
- 22,247,249,140, 88, 86,250,209, 53,136, 47, 65,120,205, 98, 68, 37,154,131, 64, 31,185,100,127,  7,211, 23,209, 39,239,194,247,
-  2,229, 95, 63,102,124,253,  9,247, 39,248, 64,  2,231,147,204, 86,161,177,250,168, 39,251,153, 87,126,245, 69, 85, 86,  2,225,
- 70, 34,220,234,  9,199,201,146,235,130, 61,233, 71,204,230, 55, 84,125, 73,177,  7,228,245, 91,166,115,  8, 31,237,  8,159, 62,
- 48,128,119, 14,232,159,109,209, 15,132,248, 55,122,228, 35,  9,125, 50, 50,141,133,109,191,116,211, 67, 94,114, 93,114,  7,186,
- 10,148, 60,113,237,171,103,116, 15, 39,226, 11, 61,178,142,148,123, 19,211,219,  3,211,253,129, 39, 99, 97, 27, 33,135, 96, 63,
- 79,134,179,193,214,250,227, 84,117, 47,118, 83,104,130, 62,218, 40,112,187,181,113,123,116,111,233, 78,224,113, 50,146,223,241,
-253,137,245,227, 76, 60,152,208, 65, 73,189, 89,160,136,  1,158, 59,128,191,  1,124,245,  2,185, 46,196,155,153,252,227,193,140,
- 31,149,233, 62,170, 45,238, 55,153, 32,197,212,250, 90,133,152,142,106, 45, 11,251,189, 37, 60,148,176,175,237, 20,177,183, 80,
- 23, 25,200,242,192,111, 81,150, 94,237,212,219,254,121, 72, 16,170,  4, 95,125,255, 44, 85,227,118, 89, 81, 54, 63,108, 66,168,
- 63, 87,125,192,  4, 38,191,186,117,198,182, 26,247,191,140,101,166,178, 73, 85,189,207,216, 83,211, 88,  7,159,134, 20,241,174,
- 84, 27,229,186,238,143,122,235,215,233, 92,155, 66, 83,208,105,242, 92,234,136, 92,138,199, 28,  8,172, 28,224, 82, 71,245, 49,
- 88, 81, 47,126, 24,183,189,166, 54,244,252,133,254, 84, 59,251,209,127,134,224,239, 67,104,172,167,200, 94, 56,157, 77,  4,  2,
- 77,167,102, 74,108,153, 70,235,192, 42,221, 46,  5,239,218, 23,171, 88,104, 68, 97,170, 75,135, 44,168,237,239,  3,236, 84,102,
-174,123,  8,201,  4,120, 10,196, 14,101,103, 36, 52,255,190, 83, 61,172,168,204, 92,179, 73, 13,101, 28,129,222,223,155,249,240,
-243, 33, 12,208,162,151,131, 67,234,103,210,232, 54, 46,195, 81,218,110,215,167, 96,162,190,  6, 21, 33,170,210,245, 43,  8, 17,
-245,104, 85, 81,221, 79,117,243,247, 68, 90,  7,130,182,234,144,197,119, 87, 61,229, 97, 46,234, 61, 37,  4,134,205,150, 80, 89,
-238,117, 26, 48, 90, 28, 80,144,200, 42,  5, 52,216,103,150, 27, 52,171, 93,226,145,152, 18, 93,215,205,240,155,226,160,163,162,
- 22, 82,148, 27, 75,164,173, 21,146,173, 60, 82, 90,186,110,221,223,251,235, 37,191,253,190, 32,209, 68, 86,245,112, 95, 17,225,
-162, 32, 41,218,100,106,154,252,144,211, 30, 34,236,160, 17,194,  2, 26, 50,  7, 73,144,121, 31, 51,  2,147,216, 15, 61,185,106,
-117, 66,216,249, 15, 49,250,155,222,213, 27,215,119, 73, 18, 29,171, 88,160, 99, 66,180, 48, 40,236,180,112,234, 76,145, 21,112,
-156, 39, 14,207, 38,186, 39, 23,164, 63,236,145, 63,235,  9,175,101,228,231,190, 14, 31,251,  6,242, 98,128,171,  7, 22,125,217,
-157,216,158, 61,173, 65, 78, 32,253, 12,164,159,131,240,138,237,218,229, 25, 22,163, 76,163, 52, 42,231,214,153, 14,223,132,205,
- 23,144,231,190,  7, 47, 61,130, 39, 91,244,161,192,155, 17,222, 78,132,123, 29, 34, 35,154, 50,165,207,115, 50,155,157,170, 27,
-245, 71,  7,244,  1, 29, 45,130, 53,228,209,139,185, 86,247, 12,157,143,210,170, 69,106,142, 81,172, 55,108,116, 17,203, 76,176,
-242, 29,125,180,140,231,228,251,246, 20,133, 24,  3, 97,109,145,161,225, 56, 17,174,116,200, 65, 66, 62,217,195, 11, 17,174,129,
- 92, 89,195,250,186, 79, 56, 94,114,113,161,130,108,236,223,229, 55,161, 60,182,201, 71,249, 62,236,222,128,215,  3,229, 79,207,
-152,190,245,152,199, 67,230, 65, 20,158, 56, 13,175,158,188, 39,167,140,197,149,189,236,226,163,200, 94,160,235,  3,225,102,103,
-163,247, 20,188,245, 85,202,206, 10,250,136, 21, 78,124,191,121,120, 37,178, 62, 14,132, 11, 67,193,234,195,  9,221,128,126,175,
- 32, 93, 36,254,108,135,220,240,216,200, 81,225, 43, 66,159,148,131,  4,103, 59, 22,102,183, 26,129,237,  2, 40,209, 72, 46,215,
-222,219,161, 39, 66, 58, 84,  3,226, 93,  4, 56,181,135,245,105, 14, 84,237, 77,241, 88,207,106,149,138, 53,  6, 52, 66,223,  5,
- 62,254,249, 67,158,220, 31,249,209, 95,110, 76, 97, 30,173,238,141, 46,234, 26,197, 14, 25,  7,131,114,117, 26,231, 27, 48,173,
-163,217, 63, 99,132,151, 14,108,180,240,253, 45,225,213, 53,114, 14,122, 62, 17, 79,108,119,146,207, 38,244,116, 48,225, 97, 49,
-152, 75, 81,157, 33, 70,165,232,  2, 86,201,203,228,187, 92, 66, 94, 87, 81,230, 44,116,247,247,134,230,159,159,222, 18,178,191,
-255,204,151,214,  0, 82,139,188, 49, 85,181,185,157,172,234,235, 66,156,115,229,242,232,226,174, 50,103,144,  7, 51,138, 85,161,
-206, 12, 60,241,  0, 16,196,174,117,223,101,217,110,190,236,231,151, 87,250,153,180, 80,168, 37,200,101, 22,153, 46,176,233,  5,
-222,211, 12, 30, 70, 42, 93,216,246,199,187,106, 19, 84, 37,168,204,247,229,194, 90,175, 83,135,101,  4, 92,194,114, 88,216, 91,
-159,205,135,243,101, 87, 93,119,217, 58, 79,124,100, 22, 10,106, 76,150, 12, 87, 44, 61,174,166,122,197,152,172, 56,228,130, 78,
- 19, 57, 27, 85, 45, 72,211, 61, 42,179, 66, 94, 27,229,191,109,127, 50, 90, 70,  8,201,222,247,225,194, 24, 26,213, 49, 80, 61,
-220,190,225,174,247, 80, 13,242, 25,253, 32, 21,155,149, 68,110,196,126,168,208, 14,230,231,228, 57,173,154,  3,105, 20,219, 50,
-179, 22,120,170,104,201,156, 82,134,239,253, 87,171, 21,221,106,205,118,156, 90,103,221,194, 96,111, 38, 47,115, 44,235,158, 52,
- 68,246,200,199, 53,208, 36,  5, 43,232,146, 18,227, 52, 89, 80,139, 59, 15,114,182,168, 83, 45, 21,237, 92,220, 30,231,137,109,
- 68,  7,208,100, 23, 38, 71,250,149, 29, 60, 74,158,252,221, 95,246,230,168, 54,215,110,153, 25,250, 22, 24, 19,144,148,128,201,
-244, 13, 69,247,209, 59,210,236,211,139,101,  0, 84,237, 87,169, 86,194,246,186, 11,158, 84,217, 89,250, 32,174, 51,  8, 33, 44,
- 59,127,191,182,202,124, 24, 86, 82, 41,206,124, 22,179,162, 84,207,232,  6,191, 17,138, 25,226, 17,153,173, 67, 89,101, 30, 31,
- 34,193, 34,  6, 93,241, 90,196,198, 78,  5,227,227,166, 98, 93,255,128,146,131, 48,117, 74, 15, 28,234, 72, 58, 29,  9, 95,139,
-200,215,163,239,188,  3,114,248, 24,185,254, 24,110,  1, 30, 28,199, 21,133, 27,191,135,188, 18,224,197, 99,184,246, 73, 56,252,
- 47,160,251,  5,  8, 55, 61, 74,212, 91,159,152,140,122,215,189,  6,135,255,158,117,241,227, 29,216,253, 57,178,251, 50,188,250,
-  6,122,111, 11,175, 71,228,135,  9,121,208, 17,114,221,215,248,227, 47,251, 77, 85,178, 49,201,139,129,110, 74,202,104, 74,168,
-102, 98, 81,210,228, 98,136,201,118,105,165,152, 98,188,120,236, 34,201,131, 56, 74,158,115,168,235,222, 60,  6,155, 14,196, 40,
-150,240,117, 20,  9,171,100, 83,129,227,132, 92,239,144, 43,201,222,135,219,192, 51, 43,164, 63, 49, 93,129,124,196,243,207, 87,
-214,163,148,187,192, 99,136,159, 48,178,223,244, 61, 43,246,211,219,160,223, 69,223, 41,232,183,183, 76,223, 57,229,236,108,228,
- 81, 18,182, 59,131,132,100,160, 83, 27,135, 74,103,157, 75,242, 61,126,240,189,126, 63,  9,241, 70, 34,220, 92, 33,199,209, 42,
-227, 35, 12,135, 90, 44, 59, 62,142, 16,163,  5,118,172, 18,200, 88, 56,255,192,104,190,221,157,204,234, 71,153,120, 18,137,215,
- 58,226,231,123, 68, 35, 92, 24, 30, 75, 78, 18,161,143,232, 38,179, 58, 22, 11,133,217,249, 65,210,249,  0,243,  3, 47, 26,110,
-246,218,155, 59,228, 68,136, 47,117,164, 85,135,110, 38,142,222, 29,216,  1, 15,139,  5,234,132, 58, 13,  9,206,206,247, 14, 34,
-250, 40,229,237, 31,108, 57, 63,205, 11,145,214,  7,159,163,175,206,147, 56,172, 16,115, 31, 92, 57,157, 64, 46,144,215,133,212,
-249,174,164, 83,248,216,177,  9,234,238,239,144, 79, 31,192,191,184,128,151,123,248,123,107,194,151,158,160,239, 41,218,179, 71,
-242, 82,109,243,178, 23, 52,106,171,232,110,133,150,179,142,206, 71,247, 84, 45,  6,218,128,167,116,217,151,151,253,209, 40, 13,
-103, 93,171,184,206,164,213,196,138, 37, 45, 77, 50,161, 87,181,146,173,123, 33, 66, 16,207,146,207,130,134,122,221,123,239, 60,
- 93, 66, 87,  6, 33, 21,153, 83,199, 74,168, 28,124,157, 11, 73,165,112,133, 69, 85,199, 20,162, 63,  0, 77,249, 94,167, 10,179,
-189,190,138,192,252,  1, 22,154,201,151,248, 78,186, 23,232,171, 71,155,  5, 30, 80,234,193,192,109, 65,193,  5,114,185,161,174,
- 40,206,178,154,173,136, 50, 91, 75,235, 62,179, 30, 90,234, 55,158,115,189,213,173,174, 33,154,255, 60,103, 74,140, 51,105,178,
- 79,137, 28, 34, 69, 18, 49, 41, 41,140, 72,182,144, 42,113,127,118,  3,255,195, 66,167,131,231,183, 23, 71,235, 66, 41, 22, 70,
- 82, 98, 50,124, 51,173, 51,103,102,141,241, 52,138, 67,246,121, 94, 77, 54,124, 17, 59,130, 21, 95,  7,137, 86,246,187,204, 57,
-242,251, 35,118,153, 35, 94,165,237,166,165, 25, 29, 35,115,146, 89, 23, 18,221,234,208,237,142, 77,158,176, 54,  0, 46,183, 84,
- 46, 98, 60,217,203,173,159,109,201,243,244,199, 33, 51,169, 35,246, 61,147, 42,227, 48, 56, 62, 87,152, 38, 11,135,209,113,156,
- 89,219,138,185,148,132, 60, 35,137,139,179,236, 83,234,232,250,149,105, 40,114,158, 39,214,185,174,  7,244, 50,202,169,174,230,
- 29, 78, 36,246, 44, 15, 49, 94, 10,121,113, 28,114,104,167, 30,101,241,181,187, 38,160,136,160,121,108, 88,238,246,223, 82, 12,
-224, 40,221, 86,115, 80,149,157,170, 75,  6,  0, 64,146,104, 29,206,232,136,193,209, 97,109,163, 95,  0, 81,  5, 25, 50, 18, 35,
-147,  8,145,192, 40,236,219, 10, 84,232, 66, 32,198, 64, 25, 97,146,108, 54,175, 92,201,105, 54,194,202, 82, 49,167, 86,228, 87,
- 65, 89,147,  9,100,207, 76,142,200, 20,145, 15,  4,238, 86,207,133,239,192, 83, 32, 28,  7,228,246, 22,126,241, 43,200,231,190,
- 14,207,223,132,107,159,129,245,175, 88,190,123,188,  5,242,156,121,223,137,  6,192, 73,135,144, 94,130,131,191, 13,229, 55,224,
-234, 29,228,198,111,193,179,127,130,126,236, 49,188,  5,220, 79, 48, 90, 91, 32, 71,190,199, 28, 50,108,221, 86,245, 16,232, 51,
- 97,116, 10, 29,101,137, 79, 84, 39, 61,121, 48, 12, 59, 79,130,171,109,161, 47, 35,235, 72, 91, 86,130,116, 98,160,152,181, 64,
- 31,145, 99,219,201,154, 95, 45, 26,227,252, 42,214,149, 31,175,224,224,182,197,213,202,243, 70,128, 67,141,  8,151,239, 25,176,
- 71, 51,164, 23, 32,188,  4,195, 31, 66,233,205, 22,168,223, 67, 31, 94,192,119, 38,242, 55,207, 24, 78,119, 60, 10,194,227,209,
-120,221,197, 39,178, 93,178, 61, 62,190,239, 79,  1,214,201, 16,180, 43,224, 64,132,120,163, 39, 92, 79,  8,209,  0, 63, 15, 21,
-206,204,207, 28,  4, 86,201,234, 91,181,118, 14, 19, 60, 25,237,198, 93, 71,229,170, 22,142, 21,226,173, 14,185,217, 35,215, 87,
-240,126, 49, 10,224,113, 38, 30,  7,219, 24,172, 23,  1, 98,110,146,188,166, 98, 41,108,165,152, 31,189,127,152, 57,121,125, 68,
-186, 64,120,161,163,123,237,  0, 57, 83,202,163, 76,174,215,244,100,  7,168,164, 21,175, 45, 51,212, 37, 79,133,247,223,207,172,
- 68,109, 44,234,237, 88,197,243, 22,199,163, 86, 21,214,217, 36,  4, 81,174,156, 22,132, 45,225, 71,102, 65, 33,  4,248,104, 66,
- 62,125,  8, 95, 43,112, 18,225, 51,  5,190,191, 67,255, 56, 51,125,111,135, 70,157,103,157,243, 16, 72,246,163,122,171,  2, 61,
-243, 52,144,104, 22,212,150, 57,102,126,121, 92,  4,246, 58,  2,109,177, 96,123,187, 60,239, 40,213, 24,241,245,125,144,182,147,
- 47,251,129, 40,245,235,148,217, 43,223, 88,211,138,223,224,186, 48,142, 23,113, 94, 65,220,148,162, 46,246,145, 58,234,246,231,
-114,186, 52, 69,168, 73,107, 50, 22, 52,  6, 98, 74,243,  8,201, 24, 13, 54, 73,180, 28,246, 68,233, 35,162,153, 48, 88,216, 83,
-156, 11,251, 82, 24,163, 79, 91,234,208, 88,125, 95, 30,103,135, 65,217,243, 93, 47,226, 68,239, 86,181,217,183, 59,217,177,168,
- 65,133,148, 50, 43,215, 43, 60, 68, 53, 83, 52, 52,194,155,138,180, 30, 17, 85, 70,205,140, 26, 40,253,218,154,131, 90, 44, 66,
- 50,142, 61, 54,202, 13,165, 64,153,102,120,149,250, 78,151, 82, 76, 92,133,144,243, 56,115,171,107, 49, 85, 45,179,112,109,137,
-240,253, 16,112,183,180, 81, 91,203,161, 37,212,174,189,233,152,107,120,141, 92, 78, 93,155,197,143,186, 76, 44,184,188,159,183,
-247, 34,137,176, 90,175, 33, 36,166,113,240, 34, 84,201,119, 31, 22, 21,199,156, 64, 86,156,146,182,183,175,175,163,119,137,  6,
-154, 89,245, 72,136, 76,195,206, 56,234, 33,144,199,113,206, 46,159,111,234,122, 76,168,  7,179,146,253, 62, 40, 86,208, 87, 43,
- 99,221,187,221,176,134,203, 80,218, 57,216,211, 60,118,117, 37,105,113,230,124,  8,  1,141,117, 54,226,138,247, 57,  1,168,198,
- 77,215,207,201,225, 82, 98,235, 86,149,110, 78, 13, 69,148, 24,  3, 49,245, 75,178, 91,158,236,240,221,120,247,139,195,105,172,
- 55,205,164, 18,  3, 90, 44,127,184,  4,231, 66,123,199, 30, 84,152,234,  3,207,223,172, 89,150, 95,253,142,193,253,195,106,230,
-123,213, 72,206, 16,181, 48,170,141,221,234,232, 33, 20,171,145,235, 40, 28,196,192, 65, 40, 28, 38,165, 67, 89,171,113,169,196,
-247, 32, 98, 71, 63,  0,  0, 32,  0, 73, 68, 65, 84, 17,117,175, 20, 74, 33,102,135, 55,156,  9,225, 78, 71,248, 97,135,252,239,
- 32,215,238,193, 39,255,  8,174,255, 17, 92, 87,228,165, 14, 94,125, 14,110,190, 12,135,191,102, 60,249,240,188, 39,203, 37, 43,
-250,235, 27,208,127, 10, 14,223, 66,174,253,115,184,253, 39, 70,199, 27,183,118,165,118,  9,210,202,115, 84,207,208,211, 45,188,
-157,225,110, 68, 30,138,241,206,119,178,204,115,235,174,114,106, 18, 89,166,198,198, 80, 47,254,149, 35, 82, 87,174,204, 63, 12,
-232,145,121,252,103,100,234,177,255,245,176, 67,250,171,166, 43, 72, 31,177, 86,189,170,166,202,133,237,203,203,153,179,246, 11,
-132, 91,144, 62,  7,195,159, 65,126,  8,225, 19,160,175, 27, 55,255,174, 82,190,127,206,244,254,  5,103,  5, 78, 85,216, 78, 14,
-228,243, 44,156, 50, 25,181,183,143,152,142, 96,182,111, 20,214,  2,171,103, 18,225, 51,107,228,181, 53, 28,116,200,189,193,230,
-162, 43,  8,189,176,246,177,237,144,173,144,154, 37,  9,114, 46,230, 86, 84,216, 37, 56,212, 98, 63,242, 22, 19,153, 29,216, 75,
-144,126, 36,220,236,137, 63,222, 65,150,217,164, 48,168,165,104,209, 32, 74, 69,160, 36,216,  5, 88,223,155,144,195, 68,124,182,
- 71, 62,218,145, 56,224,248,219, 27,244,126, 38, 39, 99, 19, 73,150,153,165, 31,171, 23, 56,  7, 36, 40,125, 92,198,170, 18, 27,
- 78,193,222, 67, 38, 88,142,119,130,243,108,239,205,201,249,132,156, 14,116,119,109, 77,194, 42,193, 43,  7,240,147, 71,240, 87,
- 23,240,153,  3,244,206,192,248,229,115,244, 89, 95, 10, 95, 84, 28,234, 50, 95,107,159,105,161, 17, 90,181,236,  2,105,188,192,
- 21,  0, 39,205,181,101,197,210,193,  7,109,182,118, 19,108,210,166, 98,105, 51, 10,176,125,161,167,105, 53, 86,162, 82,187,214,
-218,217, 21, 32, 22,202,232,232,229,169, 32,197, 12,239,218, 20,115,145,253, 20,183, 42, 37, 11,165, 85, 52,219,142, 56, 54,114,
-106,117,133,251,232,130,184,145, 70, 37, 23, 18,218,217,115,104,202,117,135, 47, 22, 66, 69, 68, 53,144,198, 45,157,102, 43,206,
-237,250,162,174, 14,230, 17,123, 29,191,107,131, 44,185,148,149,217,172,205,140,200,230,227, 85, 89,  2, 30,231,  2, 92,173,112,
-158,250, 50,205,225, 76, 58,251,254, 53, 38, 86, 34,196, 82, 24, 52, 27,217, 12,  5, 57,176, 46, 50, 79, 11,107,189,235,136, 39,
- 55,172,176,108,206,208,237,214, 70, 37,117,205, 16,  2,185,136,251,219,179,  9,122,163,146, 99,164,196, 30,213, 97,  1,185, 52,
-188,250, 57,  6,185,233,206, 67, 93, 21, 72,141,212, 21,211, 73,201,178,126,144,214,245,123, 41, 76,165, 85,201,163,234,201,128,
-245,144, 80,199,204, 54, 34,238,251, 53,177, 91, 49,148, 50, 35, 89, 89,230, 29, 79, 37, 97, 70, 26,186,159,234, 30,133, 77, 36,
-122,138, 25,196, 24, 89,117,189,121,210,243, 68,158, 76, 56, 51,150, 98,144,153,108,212,184,122,  3,205,234,125,167,200, 21,191,
-206, 82,  8,196,212,249, 26, 89,153,138,241,224, 43,205,173,213,121, 32,173,192,209,199,102,213,146,230, 10, 87,165,248, 33,112,
- 57,220,168, 51,244,115,201, 75,160, 83,187, 94, 40,217,  5,133, 29, 37,218,164, 64,167,201,  2,105, 58, 83,185,171,136,  9,121,
- 93,143,176,172, 44,202,162,182, 47,153, 84,219,145, 82,187,147, 58,114,172,185,196, 13, 13, 77, 84,233, 28,196,210, 38, 56, 91,
-174,236,228,162,136,142,162,194, 46,143, 78, 71,178,145, 88, 93,215,173,130, 61,168,143,114,225, 56, 10,185,192, 65, 20,203,164,
-214,224,249,193,101, 62, 92,168, 70,186,169,176, 26, 71, 82, 20,244,  8,242,129, 18,186, 68, 24, 58,228,251,  7,232,  7, 35,229,
-189, 29, 12, 59,194,141, 55,144,159,120, 11,254,222,159, 34, 63,125,  2,207,127, 12,142,127, 21,186,207, 67,120,198,232, 42, 56,
-158,246,248,215,225,224, 63,130,233,212,109,114,163,101,198,167,107,134,166, 45,143,144,107, 95,134,231,190,  4,159,120,  7,125,
-114, 97,168,220,236, 94,215,154,141, 93,124,247, 49, 86,168,127,244, 89, 96, 66,164, 44,102,216,222, 21,115, 49, 65, 95,153,152,
- 62,251, 77,226,193, 26, 29,228, 53,156, 95, 88,235,187,254,121,  3,243,200, 19,251, 57,203,153, 85, 69,221,185,186,125, 13,233,
- 19, 48,189,  5,155, 63,131,254,103,140, 28,167,239,161,247,  7,248,238,150,233,238,134,237, 38,243, 40,  8,231, 91, 35,184,106,
-150, 25,215,185, 43, 86,208,241,169, 88,196, 14, 95, 69,  3,199,100,116, 27,144, 28, 23, 21,146,  5,131,219,235,247,220,249,177,
- 30, 18, 10,156, 15,176, 43, 38,152,236, 93,188, 84,218,124,130,173,167,211,  4,177,223,112,210, 19,158,235,232, 86, 22, 77,216,
- 39,179,131,159, 95, 24, 20,169,243,183, 45, 68,123,240, 15, 25, 70, 31,155,234, 54,163,143, 50,225,181, 21,241, 39, 15,144,152,
- 56,249,230, 25,250, 96, 66, 69, 56,171,249,129,137,153, 10,168, 98,187,222,232,226,166, 32,  6,174,  9, 77,220,165, 52, 33,154,
-248, 41,216,241, 61,164, 65,  9, 15,  7, 83,182,175, 34,114, 16,209,131,128,124,100, 13,175,172,225,157, 29,242,239, 28, 33,255,
-167,117,145,210, 21, 52,137, 39,  3,250,251, 80, 22,122,153, 40,104, 84,226, 36, 51,142,184,137,181,110, 73,198, 76,126, 15,149,
-204,252,222,207,221, 64,190, 36,120, 43,151, 30,142,181,197,217,115,244, 52, 44, 87, 31,242,206, 45, 91, 21,131,105, 65,166,134,
-214,230, 28,118, 90, 86,184,239,168,231, 26, 25, 92,164,231, 95, 39,214,209,119, 12, 30, 65,106, 45,179, 56,  9,174,184, 35,187,
-119, 12,236,136,233, 91, 68,237,223, 79, 49,146,177, 73, 82, 41,217,210,217, 98, 32,249,153,169,111,152,239, 89, 13, 54, 82, 26,
-149,246,194,221,119,193,158,191, 93,213,111,220,202,197,130, 86,220,169, 94,  2,221, 44, 19,143,250,185,197,176, 64,129,212, 21,
-227, 69, 11,108,207,209, 16,221, 59, 29, 73,177,179,243,126,183,140,128,139, 19,234,138, 39,126,201, 48, 80, 54,103,196,245, 49,
-101,117,108, 87,219,230,204, 94,175,216, 94,213,114,183, 11,185, 12, 22, 40,162,246,122,136, 61, 26, 59,131, 65,185, 70,160,204,
-130,185,198,126,230,175, 53, 87,178, 89, 61,122,105, 67,  9,110, 69,152,232, 94,  0,139, 74,104,116,255,141, 66, 59, 52,113,170,
-179,141, 77,232,186, 21,253,122,141,  6,241, 36, 52, 43,166,218,232, 42,158,202,110,173,  2,185, 82,156,179, 94,173,151,139,253,
-174, 82,227,186, 85,111,  7, 66, 15,132, 81, 17,198,113, 36,103, 87,220,214,105,211,124,168,113,237,212, 12, 45,183,180,180,144,
-162,127, 46, 94,208,125,154, 48, 67,119,116, 57, 16,171, 79,110,184,196,114,159,189,246,132,185, 27, 23,191,230, 67,116,144, 80,
- 30, 80,151,154,154, 78,193, 52,105, 85,252,166, 51,227,  2, 98,234,172, 75, 15, 97, 33, 52, 58, 50, 87, 36, 88,106,158,235, 79,
- 74,206,115,  4,113,138, 30, 72,145, 51,108,199,194,182,216,  8,222,186,  0,102,225, 72,168,105, 79, 30,176, 16, 93,249, 74,201,
-110, 17,139, 20,133,190, 79,  4,141,140, 27,101, 44,153,186, 41,170, 34,141,169, 40, 35,197, 70,169,  2, 57,  8,121,178,209,255,
- 81, 18,186,100, 98, 49,123,130,217, 60, 55, 28, 69, 79, 78, 10, 14,157, 73,246, 32, 61, 12,112,  8,220, 78,200,185,119,207, 41,
-217,213,249,197,130,126, 97,  7, 71, 95,135,231,191, 14,159, 16,228,213, 53, 28, 31,195,122,237,124,215, 99,232, 79,160,191,  5,
-233, 21,232, 62,  9,221, 21, 72, 87, 92,129,255,140,141,238,251,191,  3,235, 31, 35, 55,223,128,252, 30,228, 45,232,128,144, 23,
- 34,158, 15, 79, 69,182, 32,131,181,160,165,238,114,234,  5, 22,102,106, 20, 83, 54,156,237,198, 44,127, 70,103,115, 21,221,238,
-255,167,235,221, 98,109,203,210,251,174,223, 55,198,152,115,174,125, 57,183, 58,117,239,174,238,118,119,187,219, 54, 77,219,177,
-163, 36, 68,113, 68, 98, 19,130,148, 60, 32,  2,146,133,184,  8,  9,161, 32, 33,  4, 88,  8,241,128,242,196, 59, 32,241,130, 16,
-138, 20,204, 67,  0, 33,  8, 82,  2,137,130,131, 37,156,142,113,140,237,166,239,238, 91, 85,117,117,213,185,238,203, 90,107,206,
- 57,198,248,120,248,190, 49,231, 92,187,154,150,142,186,251,212,169,179,247, 94,107,174, 49,190,203,255,255,251, 63,129,233, 57,
-242,199,127,213,125,230, 31, 88,193, 81,247,118,153,215,131,119,233,201, 58,249,154, 97,255,119, 64, 46,173,107,215,111,194,248,
-  2,222,171,148,111, 31,200, 63, 62,242,162, 40, 47,179,112,200, 22, 61, 31,150,247, 84,137,222,  5, 73,176,  6,188,197, 77,118,
- 64, 39,129,240, 48, 33,103,193,100,228, 31, 29,169,223, 58,146,255,104,100,254,225,204,109,132,253, 12, 71,159,196,198,  8, 23,
-189,185, 13,115,241, 31, 93,160, 70, 89, 94,  2,223,245,216, 31,246,223, 11,143,122,239, 22, 12,114,115, 57,192,163, 12, 79, 71,
-219,171,231,128,233,  0, 20,138,243, 88,135, 51,232,174, 11,241, 73, 33,124,  2,228,245,158,240,165, 68, 55, 85,238,253,254,158,
-114,157, 41,157, 29, 52,199, 54, 80,217,238,178, 67, 19, 96,233, 50, 14, 94, 60,205, 34,167,227, 62,255, 76, 28,139, 23, 25,199,
- 74,120, 49, 33,103,137,244, 94,132, 20,236, 98,127,109,176,215,233, 50,144,254,108, 37,255,239, 47,145,215, 65,250,106, 76,251,
-122, 26,118, 17, 60,189,164,206,246, 58,116,237,194,150, 19, 11,237,210, 41,213,226,216,129, 40, 72,169,166,253,208, 59, 84,186,
-147,237,103,221,228, 88,175, 56,217, 69,248, 67,155,105,111, 71,  2,178, 97,210,235,250,251,106,221,135,212,181, 67, 89,214,168,
- 42,196,160,107,124,176,174, 48, 23,113,113, 34,149,197, 57,162,110,194,182,241,173,137, 69, 37, 84,134,100,218,157,118, 14,217,
-247,215, 56,105,118,184,205,213,206,133,164, 74,212, 74,143, 46,106,245,217, 59,254,122,167,171,172,170, 76,181,122,238, 66,203,
-115,223,164,223,169, 46, 74,253,229,215, 18, 20,104,175, 65,110,161, 42,186,138, 93,219,235, 88,253, 66, 47, 77,139,147,109,222,
- 89,163, 59,136, 82,180,166,167,  6,170,199,126,134,197,238,230, 96,153,170,228,253, 53,189, 42, 12,231, 72, 76, 72,215,163,135,
- 91,170,102,170, 68,123, 33, 99, 34, 12,103,232, 60,219,  8, 57, 23,168, 19, 53, 68,155,108,108,138, 23,105, 35, 32,116,137,147,
-173, 63, 65,149,221,152,  0,193,233, 72,210,246,205, 13, 72,163,235,101, 27, 54, 41,150,237,217, 10, 75, 58,158,137,183,162,  4,
- 98, 55,208, 13,  3, 33, 38,198,108,157,180,120,193,161,101, 21,152, 44,206, 13,109,223,115, 88, 38, 46, 13,214,228,  8,248,  5,
-150,100,130,182, 30, 77,137,105,154,236,117,148,192, 92, 50,101,158,109,181, 81,170,137,235, 54, 72, 92,221, 96, 12,131, 64,138,
-137,152, 58, 23,214,153, 96,174,117,219, 39,101,221,118,159,237,235,172, 32,186,174,118, 54, 41,109, 34, 66,149,232,145,223,234,
-137,130,174, 92, 79, 59,106, 42,246,231, 66, 36,196,224,  4,193, 74,205,198, 55,  8, 49, 34, 77,125,175, 74,206,197, 39,  1,246,
-169, 12,209,179,  0,156,149, 95,171, 17,231,162,  8, 97, 56, 35,229,106,118, 13,149, 96, 35,200, 90,233,124,127,165, 45,234, 83,
-214, 56, 68,169,129,144,172,210,108, 63, 96,108, 10,207, 32,132,110,176,221,210, 56,115,116,196, 93, 16,243,180,207, 42, 36,205,
-  4,133,189,143, 88, 74,182, 70,247,178,  6,204,114, 44,156, 11,244,157,165,129,233,101, 66, 30,236,208, 65, 32,216,155, 36,231,
-189,167,130,121,213, 60,184,118,255, 38, 91, 39,125,168,214,142, 22,224,105, 71,252, 97, 64,190,209,161,159, 15,240,240,104, 54,
-184,177, 66,254, 49, 92,249, 73,253, 90, 68, 62,135,137,158,222,122, 19,206,238, 91,196,172,244,118,129,206, 71, 63,248, 58, 59,
- 85,195,153,135,208,236,124,190,117,180,246,102,206,232,126,143,236,175,205,236, 45,193, 47,113,151, 85, 87, 59,121,116, 95,236,
-251,172, 30, 86,210,139,  5,154, 68,129,239, 30,224, 79,191, 10,151,127,  2,230, 31,122,190,124,177, 40,218, 58,217,197, 46,172,
- 17,184,227, 87, 96,124,  9,247,126, 17,184,  5,253, 33,250,116, 66,191,115,164,124,112,224,230, 86,121,166,129,253,108,251,192,
-236,135,217,208,  0, 38, 98, 62, 97,153,221,250,218,  0, 59, 10, 41,  6,194,227,132, 60,238,236, 95,120, 94,169,207, 50,249,233,
-204, 62, 87, 94,102,235,204, 75, 59, 25,252, 71,142,254,247, 84,255,224, 22, 86,196, 46, 55,126,250, 62, 22,184,181,165,183, 60,
- 48,111,168, 76, 21,233, 97,232,225, 85, 87,188, 30,102,181,177,163, 23, 31, 45, 87, 62,  6, 19,228, 61,248,250,145,112, 30,137,
- 15, 58,228,149, 68,248,249, 11,186,163,114,255,171,123,242,177, 90,224,139,152,210, 63,248,158,119, 59,102, 95,156, 10,178, 73,
-145, 58,101,128, 44,159,235, 42,112,244,196,188,238, 54, 19,158, 79,200, 46, 18,207, 45,242, 86,135,132,188,115,134,254,224, 22,
-126,225,156,240,245, 35,245,199,123, 99,220, 15, 66, 56,110, 14,214,176,233,216,189,232, 24,156, 19, 51, 42, 39,225, 33,213,221,
- 37,217,104,199,164,168,222,137,182,236,128, 37,208,215,179, 11,182,180, 16, 87,177, 47,191,181,166,173, 84,255, 92,171,132, 83,
-139,146,239, 70,181,165, 82,149,214,197,213, 69, 64, 37,226,148, 65, 93, 39,145, 49,232, 18,164,104, 77,191, 44,219,235,224,234,
-229,172,186,  6,164, 86, 59,107, 26,118, 53,169, 57, 66,  6, 10, 41,  4,195, 52,251,159,151,176, 58, 75, 16,232,180,218,216,221,
- 69,113,147,218,133, 94,100,221, 41, 27,190,214,252,245,145,192,188, 88,197, 86,204,109, 92,176,170,237, 82,210,147, 12,243,232,
-254,117,  9, 86,148,196, 77, 39,187,  4,162,196,132,226,226,184, 82,125,132,236,  1, 37,197, 59, 64,173, 72,181,208,141, 26, 58,
- 66,151,176,102,219,160, 35, 18,173, 59,173,227,222,153, 26,137, 20, 19, 12,  3,117, 60, 90,199,158, 11, 85,102, 36,117,132,212,
-129,118,212,108,151,154, 53,  5,137, 24, 59,223,233,250,165, 18, 76,175,100,  5, 85, 65,213, 46,233, 37,145, 82,215,212,175,234,
- 43,207,181, 99,151, 37, 12,163,234,221,100,239,187,197,129,141,222,219, 56, 59,165,142, 16,123, 38,167,185,209, 24,  7, 14, 96,
-161,  5,205,184, 18,156, 37,166,212, 39, 23, 65,238,176, 28,154,155, 34,210,197,142,216,245,182,247, 46, 54,162,202,192, 60,205,
- 94,228,172,147,132,186,201, 34,208,205, 52, 46,132,104,254,249,152,236, 57, 41,229, 14,  5,174,126, 92,144, 80, 55,188,252, 13,
- 97, 78, 54, 43,131,208,188,234,162, 11,114, 57,  0,187,126, 48, 97,121,173,116,201, 96, 49, 99, 45, 28,166,145, 50,142, 14,189,
-113,198, 65,215, 45, 69, 74,174,166,226,215, 90,156, 56,106,161, 47,185, 20,242,116, 68,170, 18, 37,216,212, 34, 37, 82,242, 61,
- 66,212,194,121,  4,145,196,160,133,169,216, 11, 33, 46, 46,201, 62,126,145, 32, 20, 73, 84,169, 11, 53,202,192,133,182,223,203,
-125,100,154, 10,211, 92,104,  5, 67,169, 48, 23, 37, 72,229, 92,108,135,129,  7,173,133, 98,190,236,131, 79,117, 45,197, 72,184,
-168, 74, 31,148,184, 87,139,184, 44,222,229, 14,246,193,209, 32, 75, 26,132,238,149,250, 66,169,199, 64,157, 50, 76,147,137,104,
- 34,132, 93, 68,207,123,226,107,129,240,112,103,221,252,177,218, 92,247, 38, 83, 63,152,209, 39,  5,190, 94,145,223,141,200,195,
- 61,132,175,195,179,201, 78,188, 93,180,121,103,136,200, 89,  7, 15,  2,124, 50,193,219,157,159, 46, 56,197, 78,225, 70,224, 71,
- 25,158,  9,122, 13, 60, 10,240,122, 92, 85,155, 13, 85,151,196,  4, 98,183,110,200,153, 10, 92,249,102,224,137,130,142,200,151,
-126,  5,202, 45,148, 23,158, 45,127,176, 75, 93,111,253,239,115,  1, 96,253,  8,230,119,161,123,211,126, 79,191,142,222,188,128,
-239,102,234, 31,237,153, 94, 78, 60, 15,112, 61, 25,100,166, 20,139,189,204,108,172, 81, 69,204,218,222,146,182, 16, 82, 80,  6,
-133,238,126, 36,188,218, 27,  1, 39, 11,245, 42, 83,158,204,228,219,204,173, 26, 87,125,159,173, 88,104,147, 91, 41,107,199,219,
- 59, 75, 97,241,102,103, 63, 69,167,138,244,209,170,226,164,200,189, 72,188,215,209,189,200,164,170,140,213, 44, 96,187,  4, 53,
-  8,251,227, 74, 85, 44,197, 10,193,171,201,182, 21,114,149,121,248,213,  3,114, 63, 18,126,225, 18,121, 99, 32,126, 25,250, 27,
-229,225,119,247,212,162, 92,  1,  7, 17, 39,202,157,100,165, 16, 88,106, 68, 31,175,174, 76,240,120, 39,  0, 72, 93,188,116, 84,
-232, 50,214,173,239,  2,210,  7,194, 16,224,222, 17, 62,115,137,124, 98,135,190,156,  8,127,225, 62,241,191,158, 96,151,221,116,
-111,185,228,155,245,243,230,114, 48,109,195,208, 40,133,171,190,103, 25,249, 90, 97,161, 39,252,244, 59,167,237,154, 64,184,137,
- 29, 19, 86, 20,106, 46, 91,229,173,189,206,167, 35,119, 57,  9,150, 17,223,187,139, 10,162,  1, 77, 66,210,178,184, 38, 40,117,
-241,131, 47, 26, 32,100,  9, 41,218, 42,203,181,165,134, 45,113,158,235, 48,183, 20,124, 82, 35, 72,138,  4, 85, 82, 45,118, 54,
- 86, 83, 35,119, 18,108,100, 25,212,249,  9,149, 36,202,173,130,207,206, 78,134,185,230, 97,111,113,183,186, 92,202,141, 11, 81,
-165, 69, 28,183, 97,133, 46,187,249,246, 60, 71,239,202,113,151, 95,216,108, 44,172,153, 73, 62,114, 45, 70, 21,243, 73, 87, 43,
- 32, 45, 90,180, 50,249,206,190, 11, 21,173, 35,185, 36,159,134,219,154, 51, 68,199, 91,215,130,206, 35,117,151,168,  2, 93,215,
-219, 69, 55,103,114, 41,134, 14,157, 70, 66,204,132,212,147,186,193,  5,124,246,208,212, 50,251,207,100, 78,129, 20,  2, 85, 12,
- 35,172,165, 16, 81,119, 40,201, 42,  6,245, 11,253,132, 98,232,107,  8,245,243, 95, 54,197,207,106,199,112, 17, 97, 35,244,133,
- 72, 12, 61,161,235,144,216, 83,180,146, 75, 89,162, 99, 43,117, 51,122,111,104,216,182,191,174,104, 72, 75, 17,215, 16,179,150,
- 79, 94, 23, 56, 76,138,137,212,119, 16,133, 60,102, 11,101, 17,131,204,148,121,242,142,185,110,188,255,107,112,202,154,198,102,
-190,242, 16,147,209, 36,107,246,148, 56,255,190,234, 70,212,162,219,156,144, 85, 28,217,170,254,224,250,129,182,222,169,181, 16,
- 98, 34,164, 14, 81,216,197,200,253,251,247,144,110, 96,154, 38, 74,173,204,170,148, 60, 49,231, 66,153, 51, 81,108, 45, 91,169,
-148,108,  1, 62, 49,217,106, 32,249,190,188,106, 37, 16,208, 16,188,179,159, 77,232, 60,236,  8, 93, 34, 87,101, 60, 28, 72,103,
-154, 73, 49,114,214, 65, 41,202, 49, 22,139, 24, 45,190,191,114, 49,213, 81,125, 21, 90,149,218, 71,178,  4, 68,103, 84,133, 33,
- 24, 26, 83,231,130, 20, 72,233,140, 24,111, 57, 23,245, 61, 88,165,  6, 56, 19,229,204, 61,185, 81,108,212,154,130,125,160, 26,
-184,100,170,166,156,190, 81, 97,168,112, 62, 41,195, 97,166, 83, 37, 14,160, 15, 88,103,161,213,104, 28,122, 93,201,  7,101, 76,
-  1, 21, 37,244,129, 46,122,108, 67, 12,118, 74,158,187, 89,118,244, 98, 32, 84,106, 84,116,  7,245, 21, 19,  2,113, 25, 76,189,
-254, 12,244,104,102, 15,153,252, 65,232, 33, 12,138,148, 64,232,147, 77,191,251, 96,151,249, 92,225,170,160, 79,170,157,198,103,
- 98, 13,254,212,153,167,171,110, 20,197,183, 10,151,222,114, 30,109, 70,173, 30,251, 41, 47,129,111,140,240,239,189,  1,195,167,
- 97,255,129, 95,230, 51,212,209, 60,248, 76, 38,209, 15,175, 64,184,  7,183,191,  9,211, 75,184,252, 83,160, 63, 66,231, 31,194,
-  7, 25,253,214,145,242,254,129,155, 12, 47,171, 48,218,121,195, 84,151,  4,223,165, 19, 45,155, 14,181,177,162,135,  0,103, 10,
-241,161,199,142,122,252,153, 62, 49,206,251,177,  8,147,192,232,253, 77, 81,187,172, 60,216,207,238,136, 96,250,207,157,172,246,
- 40,252,245,180,150, 41,192,224,  2,204,  7, 61,225,237,129, 97,154,185,189,205,220,102, 27,195, 86,  3,198, 49, 58, 16,170,115,
-156,255,236, 31,176,235,  0, 93, 23,232,159,102,228,247,142,244,247, 58,228, 11,103,200, 39,122,210, 47, 94, 48, 28, 42, 15,222,
- 59,154,128, 73, 12, 65,154,235,218,  1,167, 53, 55,229,164, 51,113, 30,132,141, 88,239, 28,116,234, 59,246,  3,144, 70,219,175,
-203, 16,237, 87, 23,209,157, 32,239, 60, 66,138,160,159,129,240,103,238, 81,127,235, 37,242, 72, 33,  7,100,170, 54,170,222,100,
-137,107, 93, 55, 53, 49,194,176,137, 24, 61, 73,103,243,248,209, 37,116,124,129, 92,164,211, 97,106, 27,157,120,229, 18,217,116,
-246, 85, 79, 76,110,178,165,172, 53,122,218,242,255,195,186, 50,113,129, 85,148,202,224, 48, 21,203,241, 86, 36, 52,120,145,120,
- 84,100,195,160,174,214, 31,226, 70,168,231, 54,170, 22, 13, 26,124, 50,100,182,159,  0, 69, 73,126, 25,196, 54,  2,199, 58,224,
-157, 27,187, 67,206,156, 73,165,136,145,232, 50,171,216,173,141,198,131, 26,146,182,222, 65,165,136, 95,236, 81, 54, 89,230,178,
-138,234,216,224, 99,131,172,100,191,197,219,173, 44,172,247,186,132, 90,215,165,219, 87,169,174, 36,151, 69,127,144,117,229, 62,
- 12,  1, 83,103,235,186, 94,137,213, 61,212,162, 84,157, 45, 42, 54, 68, 66,133, 97,119, 78, 77,133,227, 60, 34,206, 50,215,106,
- 88,238,160,213,  0, 40, 33, 57,134, 86, 23,236,109,140,105, 65,222, 74,  8, 22,108, 85, 11,193,195,119,216,234, 10,228, 84,192,
-185,237,146,131,216,243, 19,116, 77, 12, 83,  9,171,114, 94,162,237,133,131,  5,181,132,216,249,229,104, 41,117, 21,239,130,203,
-230, 66,119,253, 84, 91,234,139,248,216, 61,207, 70, 77,107, 19, 51, 87, 99,218,235, 31,232, 59,183,176, 21, 37,231,188, 52, 35,
-243, 60,129,110, 80,171, 34,190,191, 95,217,235,226, 46,171, 16,147,217,237, 98,240, 46,120,237,191, 91,110,124,115, 18,168,224,
-168,241,184,136,219,194,170,100,217,192,130,236, 12, 61,239,122,206,207, 47,  8, 41,129, 42,187,174,163,219,237,184,158, 38, 14,
- 57, 51,205, 19,243, 60, 51,231, 12, 57, 47, 59,247,230,188,176, 58,185, 56, 16, 52,210,133, 72, 28,118, 75, 94,122,  6,234, 52,
- 50,132, 72,127,126,142,246,  3,251,227,145,227,237, 21,121, 28, 73,247,165,144,212, 62, 60,115,176, 17,121, 86,165, 68, 33, 19,
- 32,218,135,245,166, 40, 47,139, 85,249,147,135,193,207,193,132, 42, 69, 33, 82,173, 59,158, 71,226,249,125, 46,206,118,212, 82,
-108,151, 50, 91,135,126,233,190,245,234, 56,189,132, 44, 73, 71,147,218,225, 16, 16,166, 42,116,106,168,212, 89, 34,247, 66, 34,
- 74,161,237,255,169,213, 46,230, 93,183,158,178,157, 11, 18,212, 41, 67,168, 69, 23,166, 72,184,223, 17, 30,196,133,239,222,210,
-180, 24,128,135, 54,230,210, 92,208, 23, 51,229, 69, 70,231,106,115,192, 24,  8, 93, 48,241,252, 25,232, 99,129, 71, 98,176,154,
- 25,184, 26,209,155,138,126, 56,163, 71,181,244,178,123, 29,225, 97,176, 19,111, 44,200, 21,107,200,112,241, 54,175,141, 37,230,
- 66,125,153,209,209,124, 97,225,  3, 37,124, 54,194,151,127, 30,142, 87,144,111,188, 18, 24,237, 82,215,217, 78,189,152,160,251,
-164,117,241,227,247,253,146,239, 97,254, 14,124,116,128,111, 78,148,111, 31, 56,222,204,188,116,225,218,177,192, 92,215, 28,226,
- 70,245,138,209,212,189,169,241,230,253,215,160,102, 45,147,203,132, 92,118,118, 88,238,161, 94, 21,242, 77,101, 18, 49, 72,203,
- 98,225, 20, 74, 59, 36,106,165, 74, 32,121, 16, 78, 39,246,126,196,212, 22,246,109, 73, 29, 44,156, 39,221,192, 43,129,240,169,
- 68,124, 47,210,213, 98,121,  3,115,195, 30,194,121,  7,215, 94,148,132,141, 45, 44,136,112, 19,220,180,240,193,145,240,187,145,
-116,158,144,119,122,228,157,129,244,229,202,110, 84, 30,124, 52,217,197, 30,173,174,219,118,201,203,  1, 16,100,109,153,101,131,
-254,188,147, 42,169, 62,205, 40,246,206,144,110, 10,242, 98, 38,116,126,176,221, 75,232,195, 91,228,254, 99, 36, 62,133, 95,189,
- 71,252,135,123,184, 81,116, 23,168, 59, 69,167, 53, 41,203,101,249, 39,221,118, 23, 45,246,119,210,211, 38, 58,108,114,202, 79,
-149,250,121, 99,199, 88, 11,145,213, 66,237,226, 52,221, 50, 26, 87,119,  6,213,231,218,245, 39, 68,101,121,196,231, 22,185,186,
- 11, 91, 37,248,218,217,108,  7, 82,186,217,  0, 44,246,101,133, 16, 43, 90, 44,221,173,253,153,234,  0,148, 66, 64, 84,  8,222,
-253,203,182,252, 16, 67, 54, 95,116,173,211,183, 68,171,189,174, 98,220, 37,161,178,145,224,196,214,137, 56,136, 40,159,136,251,
-172,139, 23,  2,157, 88, 26, 99, 27,217,139,174,221,185,178, 30, 57,181,217,183, 60, 72, 67, 92,100,105,  1, 45,234,239, 64,117,
-120,146, 80,125,212,189, 20, 50, 21,102,207,119, 24,188,151,208,101,108,219,178,100,  3, 90, 10,146, 71,164, 63, 71,131,  9,185,
-134,152, 80, 44, 99, 67, 84,140,150, 86,138, 65, 82,202,228,108,245,176,174, 41,162, 77, 88,230,227,100, 26,202,152,252, 11,  5,
- 19,234,233,102, 97,125, 34, 12,213, 77,  0,143,108,162, 86, 29,162, 83, 27, 48,200,226, 97, 67, 76,254,111,  6,231,145, 71,143,
-252,245,253,184, 83, 56, 75, 46,182, 38,104,232,217, 86, 96,106,181,233, 71, 23,169,217, 60,251, 18,172, 35,181,101,122, 93, 24,
- 18, 11, 28, 38,  6,202, 56,217, 62,217, 71,209,117,206, 62,206,175,190, 82, 98,237,250,217, 16,232, 98, 48,113, 92,140,214, 89,
-107,221, 68,208,110,199,244,226, 48,173,136,196,184, 38, 24,214,109,145,184,134, 35,197, 20, 57, 31,118,220,191,184, 36,118,157,
- 23, 60,129, 26, 19,207, 14,  7,174,110,110, 25,199,163,237,156,155,215, 60, 69, 74,173, 76,227,209,206,200,216, 17,186,110, 89,
- 83,132,109,108,107,203, 90,207,217,113,187,145, 57,  4, 14, 55, 87, 76,251,189, 71,  3, 67,186,223, 53, 69,189,146,188, 18,110,
- 69,126,145, 98,163,143, 40,156,163,220, 19,225, 16,148,105, 80,142, 53,112, 28,179,225, 11, 43,196,208, 89, 10, 79, 85,130, 22,
-186, 24,152,242, 68, 71,129,104,147,229,179,  8,179,151,127, 70,251, 82,180, 90,230,118,231,251,176,200, 42,242, 40,130,  9,  6,
- 58,251, 97,232,234, 26, 47,185,235,224, 44, 89,121,191, 87, 66,174,244,101,178,197, 94,159,144, 92,145,162, 72, 19, 47, 61, 76,
-182,187,174,117, 25,167, 72,239,158,210, 51,129,235,136, 30,142, 86,  8,  4,  1,177,  7, 43, 92,118,200,131,132,184,221, 76,231,
-140,238, 21,189, 42,232,211,140, 30,124,192,248, 48, 32,143, 58,120, 45,192, 78,208,235, 10,123,108,196,124,230,153,239,197,243,
- 86,247,118,250,105,  1, 61,216, 56, 74,178,192,139, 10,191,254, 25,224, 21,152, 95,216, 37, 46, 25,242,232, 72,220, 98,187,252,
-248,134,141,218,143,255,  0,174, 95,192, 43,159,  3, 62,128,155, 23,240,157, 76,253,218,158,249,201,129,171,201,226,230, 75,105,
- 89,189,235,  5,149,252, 12,239, 69, 40, 98,187,208,222,119,233, 22,247, 42,196, 62, 16, 94,237, 44, 66, 21,165,190,156,169,207,
-179,141,143,196,189,227,109,116,186, 81,117,215, 24, 76,112, 23, 86,213,122,140,178,162, 31, 27, 98, 80, 34,240, 22,232, 75,228,
-124,132, 55,  7,226,227,145,243,155,153,123,179,114,136, 54,181,153,171, 29,130,247, 59,184,153, 87,207, 58,213,104,115, 41,155,
-122,127, 80, 37,254,224,136,252, 65, 36,222,143,200,163,142,240,133, 51,186, 91,133,223,171,232,203,153, 26,101, 73,200,107,187,
-224,185,248,  7,243, 20,125,110,135,153,108,206, 21, 93,183,137,234,  2,153, 89, 77,233, 31,174, 39,194,185,165, 36,201,187,  9,
- 94, 13,  6,238,223,125, 26, 57,255, 22,225, 95,187, 64,255,179,153,250, 86, 68,118,192,148,215,233, 94,105,  4, 41,  7,187, 84,
- 27, 15,246,193, 62, 31,249,206,126, 93,151,148, 85,189, 99,241,221, 64, 49, 62,166,132,210, 69,214,108,219, 32,239, 40,117, 19,
- 68,180, 32,189, 78,151,136, 90, 87,201, 80, 69,233,162,  9,190,212, 69, 69,232, 10,173, 89,194, 86,188,208,219,  2, 62,107, 86,
-162, 47, 37,117,113,180,123,113,224, 23,140, 84,231,108, 55,160,138,  4, 39,194,217,175, 42, 74, 46,149, 94, 76,244, 54, 85, 56,
-186,154,123,141, 10,117, 15,185,251,182,163,197,  4,120,126,185,189,247,139, 82,190,178, 56, 84,194,230, 53, 43, 62, 89,138,209,
- 62,186,115, 11,180,145,200,236, 29,170,111,209,  9, 81, 72, 90,209,160, 11,100,170,250,131, 19,212, 60,246, 85, 54,238,172, 70,
- 55, 12,230,163,111,113,187,165, 90, 16, 77, 46,222, 13, 78, 19,210, 13,132, 52,160, 33, 33, 90,232, 98, 36,207,147,123,155, 35,
-210, 37,136,113, 21,135, 57,114, 48, 68, 43,254,141,123, 94,124, 29, 82,150, 56, 88,139,122,209, 37, 73,254, 84, 52, 39, 27,217,
-219,122, 29,158,228,159, 72, 32,132,100,217, 26,186, 78,117,212,187,254,208,246,248, 40, 85,220, 10,233,223, 71, 27, 59, 45, 95,
-165,130,116,209,237,224,237,235,234, 29,235,122,219,215, 71,250,174,183, 88,213,108,194,182,138,146,231,121,121,129,151,213,142,
-171, 71, 23,200, 17, 45,  8, 37, 46,232,218,186, 86,142,171,213,110, 99, 53, 51,117,122, 92, 86,  0,237,239,194,119,254, 45,252,
- 37, 70, 11,148, 73,169,115, 52, 65, 38,134,200, 49, 20,174,110,111,217,223,222,216,174,223,197,116, 33,218,251, 54,151,108,241,
-179,197, 61,243,213, 86, 25,169, 23,162,116,166,154,175,149, 60,207,238, 54,146, 37, 66,247,118, 28, 25, 15,  7,234, 60, 45,254,
-123, 17, 33, 37,130, 31, 88,149,168,106,202,203, 32,203, 62,170,248,135,182, 79, 66,170, 74, 95,172, 58, 63, 14, 61,251, 25, 38,
-175,234,164, 15,104, 13,110,150, 55,196, 30,243, 68,  9, 22, 43, 56,136, 24,215,188,147,101, 47, 89, 16,106, 88, 67, 19,162,239,
-180, 58,169, 12,213, 71, 99,231, 59, 87,147, 58,147, 60,138,181,101, 93,242, 79,106, 65,206, 35,177,  8,122,125, 52, 97,138, 70,
-179,149,  5, 65, 30, 13,200, 59, 59,163, 36, 29, 42, 39,124, 66, 13, 32,197,254,206,203, 72,144,  1,121, 92,151,110, 77,186,128,
-188, 18,145,251,166, 24,172, 31, 77,232,203,217, 46,245,209,253,244,247, 13, 38, 99, 94, 61, 27,171,215,131,192,222, 81,160,169,
- 34, 93,112,159,142,127,114,179,218,218, 96,116, 27, 66, 47,240,  3, 69,126,177,135,207,254, 52,220,222,154, 32,142, 12,249, 96,
-106,251,166, 64, 11,103,144,222,132,227,223,133,247,191,141, 78,  3,242,166,192,248,125,244,195,138,254, 96, 36,191,119,228,112,
- 83,121,137,112,204,106,233,105,173, 32, 95,  1, 91,110,171, 88,  3, 28,108,108,105, 68,185,190, 64,119, 47, 33,175, 59, 22,246,
- 80,225, 89, 70,111,138,121,209, 89,248,  8, 11,155,193,215, 66, 86, 20,248,230, 67,219,133,152, 86, 48, 13, 17,211, 42,196,100,
-150, 60,122,216, 61,133,183,247,132,215,  7,250, 39, 19, 23, 47, 38,  6,177,172,243,105, 90,239, 36,113, 75,101,213, 53, 26,119,
- 44,112, 59,155,103,190, 27, 11,241,155, 71, 43,198,254, 88,128,139,142,248,115,103,112, 44,156,125,109, 79,190,202, 75, 67,107,
- 59,107,219,207, 22,189, 75,223, 58, 85,169,109,108,204,171,213,204,245,126, 33,  8,221, 94,137, 47,102,106, 23,145, 15, 39,228,
-135, 17,125,253, 71,200,163, 63,  7,220, 71,126,249,155,132,223,219, 19,254,254,  1, 62, 19,169,103, 21,142,198,147,214, 98, 93,
- 69,187,208, 93, 19, 68,236,132,110,182,139, 46,111, 78,184,186,193, 85,126,124,153,126,138,120, 93, 67, 90,196,135, 69, 13,253,
-186,118,164,139,159,189, 52,199,154,218,229,220,198,222,245,  4,143,109,105, 85, 94,128,176, 92,168,235, 14,191, 29,124,213,213,
-127, 90, 65,114, 93,121,  3,181, 41,134,117,179,247,182,231, 36, 44,186,123, 89, 28, 26, 22, 27,106,127,235,132, 85,147, 41, 42,
-193, 71,145,121, 93,214, 47,108,238,  6, 78,105,100,192, 90, 79,147,222,178,158,178,219, 41, 75, 40,157,123,230,253,242, 85,187,
-139,138,  4,183,149,217,235,150,212,222,119, 75,108,172, 20,255,203, 27,222,216,194, 61,236, 66, 79,205,109,232,120,233, 40,167,
-233,114,213, 15,105, 91, 35,136,115,218, 65, 74, 38, 78, 19, 33, 14, 22, 33,234, 62,237, 24, 34,101, 26, 77, 56,215, 50,161,187,
-100,168,235, 90,150,213,135,230, 66,205,121,157,203,108, 39,  6,109,236, 46, 97,  9,  2,218, 22,181,117,219,183,183,128, 23,115,
-178, 59,127, 60, 25, 53, 79, 45, 97,143,208,138, 49, 35,170, 25, 73,206, 59,104, 79, 39,115, 37,182,147,221,116,241,129, 75,244,
- 46,116,154, 86, 37,253,162,184,247,207, 93, 85,179,120,117, 29, 69,132,113,154, 55, 23,185, 46, 28, 21, 90,240,139,132,211,120,
- 94, 23,175, 53,251,152,169,221,117, 25,255, 47,118,181,229, 51, 97, 85,158, 46,  1, 48,155, 88, 88, 17,251,123,220,206, 29, 61,
- 41, 47,  5, 11,175,169, 34,140,121,102,158,247, 76,165, 80,202,140,180,  4, 54,199,230,206,165, 80,219,186, 96,153,154, 52, 40,
- 78,165,228,138,138,141, 38,139,255, 76,120, 12,108,174,133,105, 26,169,211,  4,181, 18,150,131,213, 83, 68,195,152,208, 82,  9,
- 85,156,  0,101,214, 48,  5,106,168,134,134,213,134,206,244, 39,176, 20,186,243,196,174,235, 72,197, 46, 69,213, 76,150, 64,191,
-235, 41, 65,232,181,208,  7, 27,105, 73, 48, 42,153,  0,169,197, 57,122,151,158, 55,163,224, 22,127, 73,123, 44,165, 67,134, 51,
-228,184, 55,156, 98,  3,169, 15,131,221, 28,209, 80,172, 60,  8, 72,202,118, 84,185,162, 72,187,136,220,235,  9, 63,117,102,135,
-220, 17,187,236,131,213,232,198, 20, 87,191,157, 76, 40, 38,175,247,107,254,250,253, 96, 93,126, 48, 23,173,126, 48,219,197, 92,
-  4, 46, 20,238,153,141, 79,162,237, 14,234,161, 34,135,201, 70,246, 23, 62, 65,  8,174,108, 45, 98,130,132,169,174,126,170, 32,
-118,217,139,129,  1,228,165, 34,255,210, 39,160, 94, 66,190,246, 55,224, 96,151,123,157,124,197,144, 44,165,174,124, 27, 62,250,
- 38,250,141, 10, 95,126,  8,241, 37,250,209,  1,222,203,212,247, 70,202,237,200, 53,112,157,197, 59, 82,179,108,205,254, 97, 73,
- 11,210,209,209,153,193,208,153, 45, 98,118,  0,118,  9,226,163,142,240,176, 55, 95,227,237, 76,125, 81,168, 83,101, 18, 28,130,
-209, 44,246, 74,104,  0, 48,223, 13, 23, 63,231, 67,241, 76,122,245,203,189,108, 88,167,109,236, 39, 15, 32, 62,128,183,174,  8,
- 63,125, 78,120, 58,114,126,152,185,172,202, 53,194,209,239, 40,241, 75,167,147,213, 91,219,169,173, 21,142,  5, 98,134,151,  9,
-210,205,140,124,125, 79,255, 56, 34, 95, 56,131, 87,122,226,207, 92,210, 29,149,139,111,236,157,144,104,113,194,234,167,191,108,
-156,183, 69, 87, 15,121,106, 69, 73,219,173, 53,225, 88,219,195,183,172,118,132,116, 91,144,243,153, 48,116,200,147, 10,207,110,
-225,149,167,208,253, 37,232,190, 68,248, 55,254,123,194,223,251, 67,244,208, 33, 59, 19,205,233,180,138,204,234,221, 64,151,  2,
- 93,244, 47,146, 27, 43,109, 67, 50,228, 99,121, 26,126, 80,182, 36,173,211, 63,113,194,232, 14, 62,185, 89,212,240,101,  3,249,
- 88,185,227, 84, 57, 77, 29,116,  1,220, 26,116,177,218,156,138,114,199, 15,109, 63, 84,208,181,103,207, 91, 49,150,174,175,163,
- 58,162, 54,251, 20,161,101,116, 71,183,154, 37, 87,191,183,159, 67,151,236,241,246,122,212, 13, 15, 94, 22,101,123,243, 24,207,
-155,188,239,178,185,180, 54,132,224,213,246,180,233, 92,149,150,196,229,197,100, 41, 36,196,158, 11,132, 81,  5,157, 43,147,159,
-145, 89,197,206, 80, 17,  7,244,216,103,174, 84, 22,164,234,150, 77,166,136,229,107, 96,128, 29,109,197,112, 43,218,188, 35, 52,
-165,183, 18, 36,179,243,177,244, 56,207, 11,194, 52, 72,132,190, 51, 65, 97,206,238, 44,240,229,200, 38, 66, 85,182,188,  8,217,
-128, 98,238,132,  4,109, 83,208, 44,209, 48, 44,144,154,144,210, 26, 68,228, 59,242,160, 38, 96,140,169,179,221,184,  8,115, 41,
-140,243, 76,158, 70,247,214,215, 69,240,216, 62,104, 33,  8,244,189, 23, 31,171, 40,205, 10,206,234,  3,115, 75, 86,236,251,158,
-216,155,154,126,154,102, 71,242,138, 49, 11,220,163,170, 57,175, 29, 64, 91, 47,137,119,220,206,124, 15, 33, 46, 48, 24,221,236,
-224,106,243,150,139,239,252, 84, 54,150, 59,143, 60,197,252,153,109, 36,110, 26,  8, 97,  8,194,217,238,140, 28, 34, 55,227,200,
- 52, 30,172,216,241,203, 95,162,189,118,  5,152,243,236,142,  5, 93, 53,184, 27,203, 96, 69,125,165,146,109,  4, 47,  6, 38,210,
-220, 50,225,179,157,213,169,115,241,236, 54,171, 93, 73,242,231,  3,242, 52,192,147,100,203,198,138,161,245,230, 76, 61, 40, 53,
-154, 82,122,210,150,188, 38,148, 98,172,217,185, 63,163,140,  7,179, 64,212, 66,223, 71, 66, 85,152, 71,170,147,150,196,167,219,
-182,254,142,116, 81,136,234, 24,217,224,187,176, 16,172, 63,143,220,  0,  0, 32,  0, 73, 68, 65, 84,152, 84, 56,150, 74,214, 74,
- 23,236,247,228,124, 71,236,122,226,237, 11, 95,222,218, 44, 76,187,  1, 57, 23, 68, 39,123,241,207, 34, 50, 84, 56,219,217, 15,
- 54, 43, 66, 36,188,209, 35,175,245,254, 41,206,112, 17,209,210, 33,227,228,251,233, 22,150,110,249,166,114,105,114,109,149, 98,
- 41, 56,179, 80,111,205,132, 93,159,101,171,234,206,253, 22, 60,100,116,159,151,169,  6,135,138, 78,106, 10,167,206, 25,208, 55,
-138,220, 55,101, 44,147,117,238,  4, 65,179, 34,179, 34, 15,  2, 97,223,193, 31, 78,132,159,233,225,157,119,224,230,104, 35,137,
- 90,237, 50, 47,163, 83,227, 58, 11,184,  9, 17,174,127, 31,253,110,133,235,132, 60, 78,176,127,  1, 31,205,232,251, 19,245,106,
-102,174,166,143,200, 77,168, 83,237,210, 78,219, 76,233,134, 14,246, 66, 63,138, 29, 84,125,128, 65,148,212,  7,194, 27,157, 97,
- 79, 85,109,250,127, 85, 40,199, 74,222,120, 51, 83,180,131, 42,103,150, 72, 89,201,141,254,102, 21,232, 92, 44, 44, 38,119,172,
-105, 88, 85, 86,153,154, 36,208, 55,145,139, 39,232,167, 50,241,123, 59,250,167, 51, 23,243, 72, 95,109,106,112, 88,224, 78,171,
-162,167, 29,216, 30, 69,204, 88,132,235,  0, 59,148,238,233, 68,248,131, 61,221, 89,  7,159, 78,240, 86, 71,204,231,244,183, 10,
-239, 29,144,169,176, 15,107,  8,143, 21,175,174,120,175, 27,160,217, 73, 96,138,156,164, 81,137,223, 26, 85, 97,138,208,205, 74,
-188, 45,212,243,140,220,102,228, 22,208,143,140,125,208,125, 30,222,122,139,240,107,255, 62,250,223,222,194,207, 38, 35,180, 29,
- 42, 57,183,253,235,170,118,223, 66, 93,  6,177,209,252,220,146,189,234,157,192,150,192,194,180, 61,193,190,254, 36,252,166,167,
- 46,182,220,162,182,207, 44, 62, 54, 21,223,109,223,197, 97,110,215, 18,150,165, 46, 75,236,235,  6,127,115,  2,159, 49, 58,164,
- 15,119,253,114, 54,122,156,250,200, 93, 28,122,181,118,236,139,210, 88,194,162, 36, 95,173,242,118,168,246,254,231,230,170, 76,
- 85, 40,190, 19,173,122, 39,232,165,178,229,161, 46,  5, 69,217,118,160, 77,216, 25,214, 11,173,180,247, 58,250,238, 72,155,207,
-219,173, 94,193,236,113,147,194, 88, 42,217,  3,176,114,179,104, 57,146,205,239, 36, 99, 53,180, 68, 52,245,239, 95,130, 11,197,
-132, 89,124,188, 95,219,254,222,  5,167,209, 51, 49,170,249,154,205, 52,148,172,187, 78, 25,205,213,163, 93, 87,177, 89,  8,137,
- 48,116,238,106,169,126, 49,182, 66, 84,209,208,118,197,193,131, 86,100,249,122, 43, 70,214,254,121, 11, 27, 65,130, 79,250, 92,
-208,165, 74,205,117,141,153, 77,182, 87,143, 41,217, 36, 13,152, 75, 49,165,247, 52,218, 69, 94,171,231,139, 87,247,129,251,192,
-172,235,237,253,119, 81,100,187,216,150,139,212,239,231, 46,245, 12,195, 14, 66,100, 30,109, 74, 33,209, 21,231,117,182,239,211,
-211, 53, 55, 50, 96,179,197,185,125, 13, 49, 13,  0, 14, 14,211,141, 57,109, 83,197, 45,222,214,214,241,171,200,114,226,180,255,
- 21,163,  1, 96, 68, 96,151, 18,195,238,140, 41,  4,174,111,175,169,243, 76,148, 96, 40, 96, 47, 17,171,  4, 74,201,228,226,190,
-114, 79,124,195, 67, 93,  8,193,190,108, 12, 27, 82,156,117,231,179, 86,166,155,107,202,120, 68,106,117, 77, 64,178,245, 71, 12,
- 14,  4,210,101,133,150,194,127,244,  6,204,123,216,223,160, 31,102,248,221, 11,248, 63, 59,120,119, 34,228,137,110, 63, 26,138,
- 50, 86,166, 16,184, 21,203, 74,215,121,166, 74, 71, 14,137, 58,103,186, 24,169,177, 67,166,105,121,177,178, 38,227, 94, 43,164,
- 82,  9,169, 50, 96,251,167, 40, 32, 73, 40, 33, 80,106, 37,182,180,162,222, 71, 79, 53,210,237,  6,250,121,164,203,217,121,186,
-  9,238,157,193,189,206, 72,100,231,103, 72,159, 45,212, 96, 82,120,212, 59,201,202, 78, 99,217,  5,179,139,197,100,251,119,173,
-182,  5, 75, 59,100, 31,144,161,160, 23,238,113, 74, 88, 18,219,117,134,155, 74,185,202,112,116,142,187,248, 40,221,253,148,122,
- 44,102,163,107,106,197,132, 93,246,131,239, 18,198, 66,185,205, 72,141,132,183, 58,240,  8, 82, 28,154, 98,164, 23, 59, 96,195,
- 89,130,144,145,127,253, 19, 80,238,155, 56, 78,171,217,215,202,108,197,  7, 45, 93,229, 77,235,183,175,247,240, 61, 53,107,221,
-160,232,143,103,248, 81, 70,127, 52, 81,110,103,227,186,155,110,143, 17,155,190,132,118, 99,232,234,201, 78, 54,245, 50,123, 79,
-187,220,  3,116,  5,186,243, 72,120,173,131,157,183,201, 79,103,234,209,187,202, 96, 69, 75,112, 27,210,178,131,212,187,233, 86,
-126,104,139, 43,225,179,154,160,112,242,253,139, 84, 83,246,235,193,120,253,225, 53,120,188, 39,188,181, 35,188,123,228,252,122,
-226,126, 54, 93,225, 81, 78,119,180,114, 71,188, 86,212,132,123, 83,128,171, 32,116,185, 18, 62,152,  8, 95,187, 37,158,  9,188,
-181, 67,222,222,145,126,193,235,130, 15,143,200, 33,115, 76, 54,205,136, 97,221,142,212,176, 65,183,202,102,191,168, 39, 13,204,
-199, 46,188, 18,160,238, 51,117, 95,136,185,192, 62, 65,126,110,175,123,247, 26,200,125,194, 95,249,139,232,255,250, 55,209, 23,
-230, 91,215, 98, 22,206,188,181,216,137,251,165, 27,229,207,217,250,169, 42, 83,222,172, 49,218,250,187,222,233,142, 27, 99,122,
- 51,126, 80, 62, 14,147,183, 67, 95, 92, 21,191,134,175,148,176,109,242,117, 81,114,181,215, 60, 87,159,232,213,109,215,189,190,
-102, 77, 45,215,184,  4,205, 51, 95, 89,215,122, 45, 52,165, 46,157,241, 93,125,128,  3,173, 48,166, 58,190,167, 77, 94,232, 76,
-165, 50,185, 60,165, 16,  9,162,116,161, 82,171,186, 15,126, 19, 12,162,235,183,216,194,129,182,239, 99,227, 19, 76, 77,112,231,
- 35,210,165,106, 68,137,181, 34,161,105,  6,132, 89,132,169,218,247,209,178,230, 23,207,122, 93, 71,181, 13,151,159, 17,170,  8,
-157, 88,160, 80,221,168,186,181,182,181,139,  3,108,157,120,102,117,141, 17,206, 12,230, 99,223,108, 37, 64,234,145,100, 80,147,
-128, 43,184, 53,155, 39,218, 71,229, 75, 64,149,119,151,161,133,  1,249,104,186,170,175, 53, 54,249,231, 77, 24,183, 92,236,222,
-  0, 68, 49,176, 77,  3,142,  5,223, 51, 75,176,241, 51, 33, 81,197,246,197, 69, 33,231,153, 60, 79, 80,243,130, 48, 93,119, 56,
-130,148,130,164,100,148, 60,103,128,200, 73,218, 81, 88, 70,241, 73,  2,195,176, 35, 14, 61,199, 92,200,121, 38,  4,219,215,235,
- 60,155,142, 43, 37,234, 56,218, 62, 60,218,121, 41, 77,119,224, 48,155,232,239,107,169, 45, 29, 45,218,179,181, 88, 26,101,137,
-222, 93, 32,  5,219,108,244,118,161,  7,103,178, 32, 12, 41, 17,186,142,155,156, 57, 28, 15,224,104, 87,137,209, 83,250, 10, 37,
- 59, 30,214,167, 17, 18,215,231, 90,189,112,176,232,214,206,128, 67,110, 91, 45,185, 50,229,137, 50,142,148,146,237, 30, 86,161,
-150, 66,150, 98,144, 51, 57, 77,198, 11, 64,226,193,111, 26, 56,165,190,135,188,249,159,195,103,254, 30,252,177,  9,190, 61, 32,
- 95,191, 64,190,115, 78,250,104,102,120, 54,115,185, 31,185,159, 11,207,146,114,211, 23, 74,151,208,216,145,210,206, 59, 22,179,
- 99,148, 90,201,146, 40,209, 84, 90, 85,102, 38, 81, 58,181,125,131,198,134,218, 19, 68, 51,177, 88,114, 91,223,153, 40, 33,  6,
- 65, 14, 19,253,229, 64, 87, 38,122,177, 86, 95, 46,206,145,221,206, 60,206, 82,140,253,156,  3,114,123, 64, 59,123, 72, 92,253,
-101,  7, 74,209,149,136, 82,163,237,159,230, 10, 41,161, 15,  6, 27, 29, 93,143,232,  7,123,235,186,167,140,142,149,122,171,246,
-  6, 84, 19,204,145,  2,225,194,  2, 39,202,213,108,  7,211,130, 35,179, 17,101, 80,108,122,208, 69,187,244, 71,251, 59,234,211,
-137,240,102, 66, 30, 69,120,233,115,192,217, 31,215,234, 30,248,127,177,131,207,188,  3,123,167,211,213,217, 58,116, 29,157,177,
-217, 65,234,161,255, 50,148,223,131,169, 32,207, 20,254,244,206,138,150,167, 51,250,124,164,220,204,228, 99,177, 45,129,159, 73,
- 73, 76,140, 83,155,224, 40,216,222, 50,134,213,122,214,162, 31,131,119,234,157, 96,138,247,123,201, 94,131,171, 66,125, 62, 83,
-246,133, 41,251, 78,178,200,178,119, 92, 15, 79, 59, 72, 75,221,144, 30,117,211, 77,183, 25,237,114,177, 31,237,245, 45,183, 16,
-118,160, 15,225,242,  3,120, 59, 19,238,247,244,221,145,243, 99,161,235, 44, 55,160,212,230,180,216, 40,184,155,237,164, 29,218,
-  5,142,  1,110,147, 48,236, 11,225,253,  3,242,176, 39,156, 39,120,144,144,207, 12,116,163,243,170, 63,130, 48, 22, 38,191,216,
-131,216,248,183,137,232, 66, 16, 82, 16, 75,223,219,142,141,221,222,180, 37, 69,182, 93,106, 41, 16,143,217,224, 71, 55,189, 65,
-129,242, 55,129, 47, 26,180,232,209, 63, 71,248,245,255,131,250,215,158, 89,246, 80, 88,193, 45, 86,114,110,152,156,117,213,175,
-137,191, 95,125, 88,117,202,101,227,183, 95, 92, 85,156, 70,188,173,223,183, 95,116,133,213, 67,231,174,208,149, 60, 23,169,193,
- 10,211,192,202,133, 95, 44, 65,155,113,100,105,169,101,117,189,247, 91, 33, 39,185,145,181, 60,168,198,119,226,213, 47,219,186,
- 20,129,250, 19,139,164,101,197, 32,178,  8,238,106, 27,138,251,251, 61, 58,230,193, 87,245,  4,132,206, 59,183,105, 73,118, 51,
- 78,122,254,216,110,245,227, 49,181,230,217, 14,248, 18,111,243, 26, 42,  9, 93,236,123,206,141,244,208,159,122,  2,161, 41,205,
- 23, 93, 54,187,224, 38,249,242, 53,100, 64, 93,  3,176,186, 40, 52,  8, 73,  2,153, 96, 17,160,178, 38,159,213,106,211, 75,235,
-194,237, 97,201,190,126,144, 54, 98, 14, 98,163, 48, 23, 88,202,202, 39,181,188,245, 90,214, 78, 83,130,167, 72,174,130, 79,196,
-199,224, 33, 46,113,170,108,166, 53, 65, 44,102,184,233,180, 36,246,246, 62,214, 21, 41,216,210,246,170,  4,230,121, 98,158, 39,
-239,208,213,  3, 82,140,254,103, 49,163, 38, 20,211,152,124,175,172, 39,122,149,101, 22,231, 98,206,174, 55, 50,157,198,200,124,
- 56,218,186,184,235,200,174,254,151,198,  2,152,103,223,119,219, 97, 22,155,171, 69, 65,106, 65,186,206, 59,251, 66, 12, 22,149,
- 90,169, 86, 68,181,168, 87,239,108,108, 66, 32, 43,163,221,  9,112, 54,149,240, 85, 67,  8,212, 24,217, 79, 35,101,158, 22, 33,
-158,196,232,133, 77,166,228,201,  5,114,155, 41, 37,235, 24,201,196,127,137,110, 24,144,126,160,148,194,148, 39,230,105, 50,207,
-125,201,110,163,147,211,216,228, 45,143,162, 37, 44,250, 89,156,136, 59,224, 30,240, 42,196,255, 18, 30,252, 16,249,242,223,129,
-159,251,159,225,159,121, 23, 94,222,194,  7, 17,249,127,  7,194, 87, 47,121,229,247,247, 60,248,241,145,219,219,145,167,103,145,
-151,231,231,148,148, 12,  8,147,122,251,248,141, 35,104,101,154, 45, 90, 48, 71, 53,152,134, 31, 21, 83,181, 75, 37, 69, 19, 42,
-149,224, 10,108,236,197,175, 83,165, 83, 69,135,  1,158, 31,153, 52, 64, 55, 64,183, 67, 94,102,226,152,  9,181, 32,146,  9,211,
-104,240,146,115, 80,153,225, 92,144, 55,122, 52,  5, 36, 76, 54,206,232,173, 75,151,108,187,118,  8,232,141,162, 31,102,234,187,
- 35,243,213, 76, 61,102, 51,253, 91,  0, 51,210,131, 68, 27, 77, 74,173,212,234,  7,154,143,181,151, 64,  7, 31, 71,114,163,132,
-  2,225,205,206,148,242, 25,234,143,103,202,251, 19, 97,215, 17,191, 28, 76,129,127,163,200,220, 66, 97, 34,188,  3,242, 39,223,
-128,124,223,118,233,181,218,101, 87, 71,155, 99,203,224, 51,187, 47, 65,255, 69, 56,252,109,120, 89,224,162,131, 55,  7,184,154,
-145, 39, 25,125,154,169,215,153, 50, 25, 29,174, 41,124, 61,209,150,226,137,123, 65, 44,246,213,138,126, 37,185, 48, 46,  5,207,
- 77, 23,232, 37, 16, 31,154, 53, 11,  5,189,206,212,103,133,114,240,  4, 52, 87,164,235,162,  8,150, 53,132,196, 59, 62,241,139,
- 60,250,101,210, 58,249, 50, 41, 58, 42, 50,123,142,183, 96,220,253,250,  4,226,219, 72,255,  0,125,109, 36,188,217, 19,223,235,
- 56,223, 23, 46, 10, 28, 61,121, 77, 54,130,182, 46,  8, 26,117,201,  1, 87,177,130, 99,246,  3,255, 44, 40,233,101, 37,124,255,
- 64,191, 19,248,210, 37,114,127,128,207,  7,186,217, 23,184,207,143,132,177, 18,211,218,177, 53,203, 92,240,177, 91, 12, 45, 45,
-107,205,239,145,141,141,187, 93,172,110, 85,166, 30, 42,229,118, 38,125, 56,160, 31, 78,200,197,223,130,248, 73, 24,190,  0,115,
-143,124,233, 83,200,163, 23,232,143, 39,100,103, 54, 45,241, 48,165,150,134,189, 44,125,151,221,116,181,194, 75,238,112,244,117,
-147,154,229,157, 82,235, 60,150,162, 64, 86,187, 14,117, 19,238, 34,156,192,105,116,177,116,121,184,146,  3, 74,244,174,225,169,
-229, 90,215,182,115, 85,138, 46, 81,110,158,251,108,239,111,192,226, 52,139,174,113,146,170,119,109,115,178, 57,175, 90,191,212,
-246,  3, 77,205,111,234,229,193,247, 19,147, 23,121,109, 39,154,125,218, 96, 25,236,235,197, 89,221,251, 92, 89, 95, 63,217,236,
-206,219, 89, 89,  8, 11,114,247, 36,217, 66, 21,159,220, 26,132,178,138,235, 82,170,191, 30,234,154, 32, 49, 16, 77,169,203,  8,
- 62,122,204,111,241, 28,139,224,133,109,241,244, 74, 75, 59, 50, 91,110,168,153,144,231, 37, 30, 88,154,189, 82,140,117, 63, 78,
-  6, 26,145,104,239,  9, 33, 17,130, 41,167,181, 89,190,100,179,  8, 49, 68, 29,177,235, 61, 93,175,248,206,216,157, 56,110, 71,
- 19, 54,158,205,102, 33,107,115,142,170, 11,217,206, 46,110,123, 40,151,240, 16,116, 29,107,187,232,121,158,102,230,105,180,251,
-192,199,237, 91,241,157,180,226, 36, 37,202,220,192, 49,110, 21, 91,132,188,222,240,133, 64,215,117,244,253, 64,232, 59,142, 57,
-147,231,217,186,218, 16,208, 89,109,245,219,245,  6,228,241,137,174,249,245,173,144,180, 26,182, 24,122,188,165,190,121, 65,169,
-234,152,229,166,149, 73,209,  4,123, 13, 34,227,  1, 80,  1, 83,221,199,174,183,  2, 10, 37,249,250, 98,156,103,131,192, 56,120,
- 71, 60,198,120,158,103,242, 60, 90,227,184, 20,169, 97,227,172, 49, 28,108,140,137,216, 15,182,130,158, 38,166,227,129,121, 58,
-218, 26, 65,218,132, 76, 78, 48,208,252, 68,190,196,106,255, 76,242,225,159,128,123, 95,128,238,179, 16,223, 66,229, 13,  8,191,
-  4,225, 87,161, 87,228,193, 15,224, 19,127, 11,190,244,219,112,245, 28,253,214,  5,241,127, 59,231,254, 63,158, 57,127,145,120,
- 92, 18, 55, 73,216,239,  6,198,190,163, 28,143,148, 58, 19,242,100,111,172,216, 88,201, 66, 20,140,232,149, 69,136, 18,173,163,
-204,133, 73,205, 82, 39,126,  1,132,169,112,126,121,193,144,206,209,253, 51, 36, 14,132,112, 15, 61, 84,166, 81,169,  7,165, 79,
-129,238,246, 64, 55, 30, 56, 79, 66, 26, 18, 81,133, 24, 10,225,195,  9,162,169,214,229,237,138,124,242, 12, 46,146, 29,120,199,
-138, 94, 85,202,211, 76,253,254,129,195,213,145, 43,  9,148,110, 71,234, 33, 81,232, 37, 19, 45, 93,216,171, 88, 91,136, 73, 10,
-132,251,  3,220, 90,199,154, 58,150, 28, 99,201,106,182,180,217,214, 10,225, 81,103,252,231,171, 66,254,222,209,168,125,159, 31,
-  8,175,184, 12,252,104, 45,177,124,241, 12,238,189, 99, 70,114, 81, 23,197, 29, 13, 50,163,254,161, 79,  3, 12,127,  6,234,143,
-225,240,  3,248,102,129, 79, 14,166,254,127,126,139,190,152,168, 55,153,114,156, 25,139,217,  6,219,126, 46,184,192, 40,109, 46,
-159,118,113,  5,223,163,167, 32,116,161,218,255, 86,  8,187,128,220,235,221,107,175,150,122,118,147,201, 69, 77, 36,215,118,161,
-106, 32,148,176,209, 87, 45,143, 92,109, 51, 18,161, 95, 38,106, 62, 82,174, 78,213,205, 25,210,193, 14,154,239,127,  3, 62,247,
- 16,194, 99,184,124,134,188,209, 17,239,119,156,189, 24, 57,175,112, 83, 76,108, 52, 97,187,212,182,251,236,116, 69, 73, 46,121,
- 37, 30, 29,124, 91, 97,151, 11,241,106, 38,127,127, 34, 61,152,224, 51,150, 29,192, 23,206,237, 98,255,142,194,139,153,144,179,
-141,118, 13,118,215,226,182,236,188,  9, 38,248, 59,129,114,132,245,210,148,205, 69, 81, 34,212, 92,168, 87, 51,250,116, 66,190,
-113,134, 94,124, 15,145,255, 10,230, 95,131,240,  0,250, 55,  8,127,225, 12,254,139, 35,241,211,174,206, 86,221,216,202,238,254,
-167, 46,  4, 58,145, 21,152,115,162, 92, 63, 13,173,244,234, 62,178,196,180,  4,124,236,104,130, 39,238,140,188, 33,248, 72,189,
- 46,138,246, 86, 64,157,100,160,123, 14,145, 44,186, 10, 79,227,162,154, 86,164,157, 93,101,  5,116,108, 25,246, 77,172, 28,219,
-107,187,116, 67, 27,241, 88, 19,118,105,245,194, 74, 23, 11,230,174,237,211,117,189,208, 75, 53,198,211,194,199,103, 85, 44,175,
-119,214, 38,176, 69, 88, 44,137, 34,107, 87, 42, 85, 23,186,156,184,111, 60,122,161,155,213, 92, 22, 89,149, 94, 42, 29,149,178,
-241, 60,154,157,183,122,168,203, 10,180,105,  1,142,109, 29, 82,138,241, 52,250, 70,137, 43,153, 90,178, 91,248,100, 17,  4,  6,
-177, 46, 80, 67,103,202,123,218, 14, 54,227,158, 37, 98, 10,148, 26, 29, 61, 26, 60, 25, 44,184,157, 78,168, 46, 98,147, 16,109,
-207, 92,178,237,212, 67, 92,133, 95, 98,221,191, 46,194,200, 86,166,132,197, 43,174, 34,148,146,109,132, 92,117,  5, 85,  5, 79,
- 15,115, 79,250, 60,102,166,241,136,214, 76, 45,142,111,221, 20,107, 11,197, 48,117,246,207,180, 56,211,221,139, 61,223, 53,203,
- 18,150,147,232, 58, 19,199, 21, 96, 26,237,146, 76,187,222, 38, 76,213, 34, 83,107,223,145,247,123,175, 75,130, 79,  3, 32, 23,
- 11,205,137,193, 20,249,101, 89,139,232, 34, 26, 53, 58,173, 39,241,165,232,238, 12,221, 20,178,129, 46, 70, 82, 99,177,187,112,
-173,  8, 20, 87,223,199, 16,189,216, 10,228,134,117,157, 39, 23, 17,234,146, 64,103,231, 70, 88, 66, 39, 36,216, 10, 96, 42,133,
-121,191,247,232,216,188,234, 26,126,146, 53,117, 51,210,210, 45, 85,114, 19,178,147,202, 47,127,141,240,137,175, 33, 95, 72,240,
-115, 17,249,147,  3,188,125,142, 62,122,  0,221,231, 64,126,  5,228, 95,129,240, 87,225,236,219,200,227,191,  1,159,251, 26,250,
-143,119,196,175, 92,112,249,245,204,249,115, 24,199,204,129, 61,199, 62,112,211,247,  4,157,157,225, 43, 12, 82, 25,164, 46,123,
-233, 54, 82,202,197,132, 38,227,146, 71,108,135, 73, 42, 74,188,247, 10, 90, 59,142, 53, 18, 46, 31, 34, 50, 80,247,  7, 38,141,
-148,144, 97,156, 97,154,185,  8,194, 69, 12,156,107,165, 11,137, 46, 36,250,155, 66,156, 15,196,151,145, 48, 59, 13,227, 97, 71,
-221, 11,220, 84,244, 22,244,166,146, 75,101,127,185,227, 56, 43,181,206, 70, 22, 14,137,210, 91,186, 90,157, 51,177,181, 36,206,
-108, 15, 40,177,183, 17,229, 33, 55, 88,139, 34, 73,136, 41,160, 89,225, 96,173, 93,120,188,131,203,153,242,193, 76,249,246,193,
-108, 97,159, 30,  8,111, 12,240, 40, 34,143, 35,188,246, 10, 76,131,117,171, 57,175,  4, 57,205,  6,148,  9,201,194,102,244,  5,
- 28,255, 71,120,118,133,126, 15,228, 47,247, 86,  8, 60,155,225,186, 82,246,153, 50,155, 10,187,141,146,183,108,243, 70, 66,146,
- 85,139, 98, 58,160, 69, 32, 23,216, 73,101,168, 74,188,236,144, 55,147,157,188, 71, 69, 95, 22,244,214,172,108,217, 51,215,205,
-230,100,251,216,237, 90, 71,188,149,213,184,  9, 24,241,139,183,110,119,189, 69,208, 89,145,238, 96, 99,214,255,103, 68, 30,125,
- 23, 94,255, 60,114,126,134,190, 62, 19, 94, 31,232, 62, 24,185, 87,102,110,146,121,214, 75,216, 72,149, 55,177,144, 33,108,146,
-192,144,101, 58, 48,  2,105,159,  9, 47, 39,226,247,142,112, 25,144, 55, 35,188, 50, 32, 63,171,164, 12,212, 35, 50,  9, 33, 87,
- 56, 22, 66,217,140,182,195,186, 58,168,245, 52, 79, 90, 54,169, 86, 49,174,246,190, 82,149,112, 51, 17,158, 38,210,144,224,172,
- 67,245, 91,200,107,255,  3,236,126, 13,244,179,132, 95,253,  3,226, 95,191,161,222,204,164, 11,239, 52,239, 36, 54, 75, 93, 69,
- 60,218,118,232,213, 61,206,149,141,222,117,211,180,111,130, 48, 52,152,  7,120,233,218,117,133,206,212, 37,166,204, 21,222,146,
-144,133,179,238,107,113, 49,210, 97,109,136, 54, 87,168,171,235,120,162,  4,230,160,230,131,174,167,249,237, 45, 49,107,123, 16,
- 45,  7,229, 86,125,200, 42, 54, 92, 47,223,150,203,237, 62,240, 22,190,225,226,170,162,106,251, 96,214,189,252,228, 54,199,186,
-233,245,215,194, 69, 61,160,101,197,213,202, 29,174,190,110,230,242,226, 33, 63, 17, 39, 24,218,199,192, 72,132, 33,218, 69, 31,
- 33, 87, 11, 46,169,139, 48, 78, 79,173, 97,178,249,187,219,168, 61,117, 72,215, 33, 82,137,197,199,171, 45,254, 86,172,120,137,
-254,  1,205, 93, 79,137,253,226,102, 56,177,164,210,242,187,157,104, 23,182,209,167, 38,158, 82, 49, 30,124,168,230, 52,145,212,
-249,106, 33, 44, 19, 23, 33,248,106, 32, 26,132, 69, 51, 90,149, 89, 29, 37, 44, 45,215,188, 44, 83, 24, 17,199,102,167,184,136,
-  2,231, 82,152,199,131, 39,232, 21,143,148,245,120,215, 38,  8, 83,247,163,151, 12,185, 88,183,141,241, 58, 44,148, 68,151, 91,
- 74, 82, 36,245,157,197,142,118,137,113, 46,204,243, 76,151, 34,221,112,198,205,225, 96, 13,202,176,227, 56,155, 32, 47,248,133,
-169, 33, 88, 65, 83,138, 17, 16, 99, 90, 43,254,150,190, 38, 44,151,110,155, 24, 46, 84,101,145, 69,195, 16,188,176,153,107,117,
-251,157, 21,197,154,243,210,157, 35,230, 92,152, 91,192, 78,105,197,207, 50, 66, 91,246,221, 49, 69,170,123,207, 75, 41,148,105,
- 50,198, 64,206,139,117, 72,183, 46,146, 45, 77,242,206,133,126,  2,196,218,  8, 85,227,191,124,214,253,181,253,135,194,248,213,
- 74,254,  7, 21,253,155,153,240, 55, 70,248,219, 55,132, 63,252, 33,114,241, 91,112,254,191, 64,255,155,144,246,144,190, 12,231,
- 63,134,199, 19,250,250, 61,244,205, 14,121,116, 78,247,226,150,179,195,200,133,118,236, 36,209,213, 66,212, 66, 39,149,115,102,
-118,193, 60,155, 65,203,134,102,101, 97, 14, 83,179,198,248,  8,169,203,149,203,159,254, 34,212,217,146,125, 30, 63,164, 30,142,
- 86,105,157, 13,132,156,153, 15,183,140,227,136,  6,167,210, 53,188,101, 12,212, 46, 49,135,200, 52,103,226,205, 12, 47, 50,250,
-222,  4, 79, 38,180, 56,209, 36,155,177, 37,136, 61,104, 34,221,134,117,239,248,131, 46,185,183, 50, 34, 73,168, 53,112,123,176,
- 74,173,195, 86,224, 22,174, 97, 84,169, 24,132,112,110,190,110,125,225, 73, 64,175,245, 11, 20,142, 99, 69, 62, 40,132, 93,135,
-124,170,135,159,234,225,222, 39,236,123, 41,142,130,229, 22,230,201, 91,178,  1,226, 61,232, 94,129,233, 43,176,255, 54,124,173,
-194,187,138,252,211,247,225,102, 66,127, 56,162, 31, 29, 41, 31,140,204,135,204,193,116,122,107, 46,247, 86,179,233,159,253,216,
-118,232,126, 25,117,209,224, 45,231, 65, 57,139,145,254,237, 29,241,139,231,200,121, 66, 95,102,202,119,143,204, 79, 38, 14, 69,
- 57, 98,107,252,169,220, 25,221,222,137,122,144,150,209,236, 54,144, 62,153,150,240, 60,  5,210,235, 59,194, 39,118,240, 40, 25,
- 79,127, 62,194,255,125,  3,243,  1,249,236,  3,255, 91, 70,228,186,160, 79, 11,220,102, 70,207, 10,216,122,226,171,255, 44,166,
- 94, 54,  1, 75, 39,226,187,240,166,236, 55, 58, 97, 44,237,176, 14,112, 30,225,178,243,220,122, 65, 70,204, 86,216,155,205, 43,
-228,  6,131,193,  5, 49, 43, 30,180,110, 70,244,219, 32,152,200,218,125, 74,109, 35,122,227, 97, 75,142,182, 63,120,244, 17,114,
-246, 24,194, 47,192,229,119,144,219,103,212,223, 25,225,210,109, 93, 91,173,192,146,131,173,167,203,198,205, 88, 88,183,222,121,
- 95,178,159,144,230,116,165,214,217,153,180, 22, 59,117, 19,195, 41,193,118,128,181, 49,184,197,133, 91,126, 25,182, 65,115,101,
- 13, 61,137, 81, 72, 98,182,163,166,230,109, 49,160,178,137, 42, 69,215,174,120,171, 75,216, 90,234,195,102, 52,111,227,124,241,
-233,145, 65,144,186,205,115, 27,197, 40,112,163,174,107,129,236, 19,161,217, 11,170,178, 93, 79,248,247,211,254, 93,145,141,247,
-184,129, 30, 37, 80, 52, 80,176, 14, 76,252,189, 77, 98,151, 58,  2,163, 10,179, 36, 52,  6,186, 32,164,100,244,187, 73,132,217,
-247,180,219, 52,210,224,207,101,117,192,141,138,160,169,183, 15, 92,158,144, 50, 47,214, 46,189,251,249, 12, 54,206,183,149,165,
-141,132, 99,240,113,121,136,214,141, 46, 22, 62, 89, 46,166,208, 28,  9, 62, 46,175, 62,122,246,212, 30,227,178,123,110, 56, 30,
-186, 18, 83, 90,226, 98, 45,143,219,186,236,198, 39, 81, 86, 32, 74, 16, 83,124,135,212,209, 13, 59, 19,124,149, 74,174,153,121,
-154,108,234, 80, 11, 90,102, 47,222,101,233,140,  5, 75,208, 84,112,251,154, 11, 41,131, 56, 47,189,158, 68,  1,119,253,192,217,
-249,  5,221,238,140, 18,  2,227,241,136,214,194,249,238, 12,217, 13, 76,135, 91, 82,236, 24, 67,224,240,242,  5,226,188,117,137,
-201,138, 16,143, 33,141,169, 35, 72,112, 77,199,170,111, 88, 29, 45, 94,244,  5,  7,210,176, 22, 46,203, 51,169, 77, 20,111,212,
- 73,205,133,228, 54, 67, 21,152,181, 26,228,199,247,223,141,  9,176,157, 60,181,247, 86, 99,103,240,174,105, 34,143, 71,243,154,
- 55,229,255,102,213,117,114,161,235, 54, 34,152,143, 29,186,119, 49, 61,233,183,  6, 56,219,  9,247, 68, 56, 87,184, 95, 42,151,
-165,114,249,213,137,139,223,135,179,223,136,116, 15,247,132, 47,190, 64,254,249,111,193, 63,117,137,190,254,  0,118,103,200,107,
-  9, 36,161,111,  2, 63,117,  6,239, 38,194,243,129,203, 31, 84,206,191,119,203,195,227,200, 94, 51,210,139,117, 60,162, 76,174,
-200,156,189, 27,152, 49, 33,123,219, 97, 76,185, 48,164,142,238,141, 55, 56,252,224, 93,194,163,199, 48, 41,229, 56,154, 29, 32,
-194,116, 56,144,143, 35, 85,101,209,157, 69,169,198, 53,158,179,193, 45, 98, 71, 25,206,152,242,204,238, 56,123,164,104, 50, 97,
- 79,136,104, 12, 72, 10,236,114, 37,234,145,177, 31,152,217,185, 15,117, 66,234,178,168,179,195,172,219, 81, 66,101, 63, 39,142,
-115,230,181,243,202,227,168,220, 28,108,151, 30,147, 32, 67,103,252,204,226,169, 89,123, 65,111, 33, 60,238,209,108, 62,119, 57,
-239,221, 79, 89,145,123,151, 80,122,219,161,151, 17,244,165, 93,232, 57, 26,167,149,100, 49,176,249,143, 96,255, 61,248, 64,209,
-111, 84,228,103,122, 83,243,127,255, 22, 14,230,117,174, 83,179, 70,173,193, 31, 91,212,105,220,220, 12,193,243,128,163,119,183,
- 73,236, 82,239,  9,164,203, 68,124,189, 67,238,123, 95,116,101,182,171,130,154, 42,218,187, 88,217, 88,133,164,169,106,239, 76,
-142,151, 29,102,216,252,163,246,185,137,234, 56,173,  3,204,217,  2,109,190, 53,195, 47,188, 15,175,188,137,220,127,129,190,221,
- 19,223, 28, 24,158, 31,121,176,207,236, 59,155, 18,136, 31,148,113,233,252,214,226, 97,123,169,169,243,126,246, 64,154, 11,114,
- 59, 35, 31, 77,164,206,  9, 57,175, 38,139,107,205,144,138, 82,158,143,112, 95, 16,157,145, 81, 41,162,139,122, 95, 93,121, 29,
-116,229,180,155,237,104,211,  1,183, 51, 32,249,126,125, 46,148,219,  9,185,138,200,251, 59,120,179,192,131,223,129,244,167, 64,
-254, 34,225,215,222, 35,253, 79,123,234,245, 76,119,223,161, 76,242, 19,  6,108, 46, 36,106, 29,116,101,195,  1,192,213,250,126,
-249, 55, 74,158,129, 92, 92,237,189,128, 20,149, 26,124, 87, 88,183,170,112, 19,148,181, 75,166,182, 49,165, 10, 53,250,101,173,
- 43,132,164, 74, 96,212, 66,170, 78,199,114, 33, 27,155, 68,182,197,239, 45, 56,146, 84,204,230,234, 26, 20, 81, 61, 25,187, 23,
-239,234,140,151, 96, 34,164, 78,  3,209, 81,176,101, 97,  8,152,186, 93,151,140,116,219,135,151,230, 79,119,108,109, 92,214, 76,
- 62,210,110,194,185, 77,119,223, 64, 63, 85,221,254,185, 28,246,234,194, 57, 43, 48,134, 40, 36, 17,131,237,108,172,121, 57,  8,
-115,118, 87,135,199,249, 53,237, 88,243, 90, 55,200, 22, 24,214, 53, 22, 43,113, 74,104,234,110, 89, 96, 52,219, 40,207,162, 30,
- 80, 82,143, 36, 31, 31,175, 33, 59,117, 17,  2,106,195,183, 53,209, 74, 16,148, 98,221,164,154,187, 65,156,160, 38,226,192,148,
-100,227,248, 42, 88,183,216,246,242,186,146,  7, 91,118,250,106,177,180,142, 62,  4, 33,246,118,161,231,121, 54,149,187, 11,214,
- 74,173,214,113,150,246, 76,110,166, 51, 41,217, 51,208, 58,248, 38,156,172, 80, 75,221,100, 24,120, 86,122, 63,208,167, 14, 73,
-157,137,198,242, 76, 31,  2,221,217, 25,251,105, 34, 84,165,238, 18,135,171, 43,116,158,221,226,101,163,247,226,246,185,246,255,
-115,219, 69,202,221,181,150,158, 88,213, 84,117, 97,111, 44,102,183,170, 14, 65,138,190,158,114,210,161,  7,184, 76, 37, 91,  2,
- 93, 93, 71,100, 75,158,253, 70,241, 47, 98,207, 83, 29,143, 20, 95,185,232,182,112,186,139,118,102,227,187,228, 14,228, 81,185,
-195,169, 56, 61,120, 83, 44, 48,162, 28,189, 34,254,192,197, 29, 23, 59,191,228,115,229,222,126,228,193,111, 31,185,248,191,  2,
-187,179, 91,226, 63,121, 69,248, 87, 47,209,159,127,132,190,253,  8,189, 22,244,252,  1,124,186,194,225,  0, 63,170,132,223,191,
-224,242,155,133,139,143,110,169,115, 65, 43,204, 81,152, 98, 37, 39,187,140, 83, 88,105, 82,165,218,161, 54,228, 66,119,255, 33,
-250,240, 85,228, 71, 31, 65,223, 51,125,244,  1,211,113, 68, 83, 64,111,111, 40,135,  3, 69, 10,125, 39, 11,215,153, 12,218, 57,
-  7,184, 66,208, 74, 37, 48,165,142, 46,  5,130,206, 22,231, 55, 77,208,117,  4, 49,251,  0,131,144,242,140,212,217, 24,248, 65,
-  8,201, 44,104,246,154,187,192,166,228, 13,157, 42, 48,206,194,197,195,200,131,  7, 21,125,110,126, 80,233, 65,118,129,250, 36,
- 55,101,154,165,126,160,200,121,103,241,160, 95,216,193,167,  6,248,116,132,238,  1,228,  9,116,  2,110,236, 98,159,226,218,170,
-197, 11,208, 27, 24,223,135, 15,  3,188,155,225,122,134, 63,123,110,139,223, 27,171,104, 52,219,127,215,182,235,194,201, 86, 27,
-117,116, 59,144,  9,206,170, 22, 76, 36,215, 58, 18, 49,144, 75,188,236,144,183,  7,203,  0,205,106, 57,239,179, 90,166,140,195,
- 90, 90, 12, 98,139, 37,213,159,176,  6,222,142,249, 83,104, 93,172,156,206, 61,125, 88,174,207,179,217, 41,223,  8,240,213,151,
-200,159,125,  8,195, 61,228,205, 76,248,116, 38,125, 52,114,241,254,158,251, 69,153, 35, 28,252,176,109,227,193,184,233,226,156,
-254,184,156, 79,179,147, 41,227, 12,247,174, 51, 97,152,145,120, 36,246, 64,119,110, 62,252,183,123,194, 92,224, 91,192,149,141,
-165, 19,153, 48, 87, 27,189,183,213,169,172,151,168,110, 88,236,225, 78,135, 29,218, 94,238, 88, 41,177, 16,110, 38, 98,223,193,
-203,  8,211, 19,184, 60, 64,252, 37,120,237, 93,210,191,243, 27,148,255,244, 37,220,247, 11,174, 29, 40,245,227, 94,115,101, 19,
-213, 26, 54, 99,185, 59,  5,213, 66, 79, 91,118,134,235, 31,169,158, 95,223,130, 75,140,127,190,170,115,219, 78,113,251,245, 84,
- 54,142,204,106,201,138,133, 74,  9,234,240,186,181,227,180,  2, 65, 23, 56, 80,113,116,235, 18,146,177,249,118,215,128,185, 53,
-159, 58,168,144,168,116, 42, 30,184,178, 22,111,217,157,144,213, 23, 44, 45, 36,165,104, 93,  5,125, 75,161,105,190,223,206,122,
- 93,  8,155,120, 96,214,215, 36,251,246, 60,139,172, 61,115,144, 37,173, 48,110, 10,168, 45,160,101,150,192, 92, 12, 89,171, 75,
- 97,228,  5,141,174,  5, 85,241, 76,132,198,170,239, 93, 64, 55, 59, 98,185, 77,  3, 82,155, 54,182,159,177,218,249,181, 20,230,
-213, 11,178,205,164,115, 29,157, 55,117,189, 91,228, 84, 23,193,106,187, 80,196,149,243,165, 22,164, 40, 26, 13, 26, 97, 99,239,
-108,175, 89,140,132,254,204, 41,147,141, 33, 80, 55,163,228,149, 65,158,115,161, 78,147,137,205, 74, 65,107, 70,107, 94,126,120,
- 89, 86,126,178,140,172,107,201,235,110,185, 61,  3,165,249,215,213,221, 80, 66, 55,244,116, 67, 79,232,122, 99,164, 56,188,102,
-119,118, 14,169, 99,186,185, 97,  2,198,171, 43,234,254,150,232, 22, 54,109,130,187, 86,117, 71,187,224,107, 45,238, 99,151, 83,
-  8,132, 63,  8,182,174, 96, 41,108,218,132, 65,181,161,138,163, 23,101,149, 24,  3, 41, 36,106,136,140,243, 68,157,166,229, 25,
- 22,183,204, 89,162,154, 46,145,186, 16, 60, 62, 53, 59, 89,111,187,255,145, 77, 65,115,183,230,144, 19,202,229,233, 34,125,251,
- 27,119, 46,245,229, 60,168,202,232,202, 61,193,194, 51,130,171,189,207,  6,225,114,128,135,192,195,121,230,149,127, 52,242,224,
- 31, 93,113,246,234, 71,196,191,124, 15,249, 23, 30,162,159,120,149, 58, 93, 34,207,  4,186, 35,188, 38,240, 37, 65,190, 54, 16,
-159, 76,240,188, 16,159, 22,250,253,209,162, 88, 35, 28,130, 46,163,137,189,167,145,134,185,112,241,230, 91,196,183,223, 34,124,
-243, 27, 76,251, 43,242,225,214,  0,145, 37, 65,153,232,165, 48,196,232,251, 54, 99,196,103, 31,177,198,206, 71,102,170, 46,  9,
-154,137,146, 44,231,125,178,139, 93,231, 76,149,142, 16,171,137, 72,250,129, 64,161,159, 50,193,217,146,218,  8, 82,234,202, 46,
-177,216,187, 33, 21,230, 16,153,107,101,190, 86,250,207,158,195, 91, 21,253,238,232, 73, 62,254, 33,235,212, 40,117,209,238,235,
-120,191, 35,124, 98,128, 79, 15,240,185,  8,143, 31, 64, 57,179, 11, 93,247,118,161, 31,227,102,110, 58,152, 72,110,254,177, 49,
-225,175, 20,125, 81,204,102,246,120,128,235,108, 59,122, 15,138,209, 90,151,131,190,113,204,131,172,137, 83,178, 29,233,184, 80,
- 40, 96, 35,212, 20,161, 43, 74,220,  5,194,195, 14,121,165,183,155,248, 88, 96,175, 14,185,112,138,220,194,102,112, 25,148,119,
- 95,  4, 54,  1, 28, 91,164,232,230, 87, 48, 37,180,164, 22, 79,230, 63,235, 71, 35,220, 22, 27,139,127, 43,195,103,158,192, 59,
- 15,225,209, 25,124,166, 16,223, 63, 50, 60, 27,185, 63, 23, 14, 81,150,241,106, 59,200,219,238,115, 89, 45,202, 50,113,180,130,
-113,118,189,225, 65,137,215, 51,165, 19,228,195, 64, 56,143,232, 39,119,200,101,132,119,206, 44,207,253, 91,178,100,239,176, 47,
-200, 92,220,225,192, 73, 94,178,174,247,235, 58, 46,151,205, 47,127,108,116,172,232,141,194,195,106, 19,152,154, 65,158,194,217,
-151,161,254, 21,228, 47,125,155,244,215,255, 46,122,101, 67,153,234, 80,149,117,220,177,225,122,182,139,120,115,161, 47,227,185,
- 13,120, 69, 55, 93,109,  3,188, 44,235, 24,117, 95,180, 24, 28,165, 40,139,128,201,192, 72,156,176,217,173,128, 51, 27,149,248,
-173, 88, 75,182, 93,186,108, 46,105,101,193,247, 54, 66, 86,241,174,127,205,178,118,  0,204,  9,235, 67, 87, 65,231,146,  2,135,
-227, 85,133,206, 79,176,124, 23, 44,227,211,190,153, 53, 35, 94,253, 32, 79,209,236, 74, 73,103,162, 26, 21,179, 46, 29,145,219,
-209,252,224,182,112,150,184,120,234, 67,114,123,170, 86, 43, 50,216, 68,148,182,233, 66, 16,230, 90,201, 89,151, 66,172, 52,180,
-238, 86, 61,239, 26, 33,245,175, 23,177, 78, 87,100,  9,220, 90,  4,136, 45,237,172, 81,242,138, 43,246,163,239,132,107, 53,207,
-186,116, 61,226,209,165,102, 63,247,224,147, 48, 19,139,159,167,218,168,124,237,162,171,  4,103, 93, 20,140, 49, 94,107,241,239,
-177, 58,210, 54,152, 71, 58, 88,160, 14, 34, 68, 85, 66,138,150,194,167, 94,168,182,238,126,158, 44, 69,206, 41,113, 11,  0, 39,
-156,100,148, 46,187,250,234,133, 67,216,232, 38,212,178,219, 78,170,214,152, 18,221,176, 35,117, 61, 53,  4,  3,205,228,153, 33,
- 68, 98, 63, 48,205, 19,135,105,226,120,115, 13,121,118,187, 93, 58,185,148,109, 58,225, 96,154,210,186,225,186,168,247, 37,108,
-180, 61,173, 24,212,149,150,160,117,213,149,  7,127, 13, 75, 53, 96, 90,215, 37,164,235, 56, 78, 35,121, 28, 87,241,223,146,167,
-238, 54,193,150,173,128, 90,103, 94,243,162,188, 23,130,231,173,215,117, 92,223,166, 73,155,144,169, 53,198,248,244, 30,215,143,
- 67, 39, 78,  6, 17, 41,109, 42,231,217, 31,204,134, 79,188,174,150,149, 29, 49, 42,220,135, 17,206,147,112,255, 65,228,126, 85,
- 30,223, 76,188,246,223, 60,225,222,111,188, 96,248,165, 15,137,255,246, 99,244,243,143,209,113,  7, 79,177,236,206,135,192,190,
-179,125,242,183, 43,241,187,137,248,209, 76,186,206,116,204,164, 14,134,100,129, 49,215,147, 85,164,203,244,181, 98,  0,  0, 32,
-  0, 73, 68, 65, 84,221, 91,159, 66, 47,206,  8,199,  3,245,230,  6,166,145, 46,218, 40,174,148,  9,237,130,251,150,237, 69, 42,
- 85,201,193,188,238, 45,218, 48,182,189, 97, 45,  6,190, 33,160,169, 51,250,212,156,209,227, 30,173, 29, 49, 38,228,124,135,116,
-103,200, 48, 33, 58,195, 14,100, 84,194,172, 54,202,154,109, 87, 18, 99, 36, 45,104,213, 64, 29, 43,245,163,137,244,197,115,248,
- 66,103,129, 49,147,121, 49,101, 23,144,179,232, 17,145,129,240,184,135, 47,236,224, 51,  1, 30,222, 71,242, 67,247,104, 31,160,
-236, 77, 88,208,102,140,187,  8,221, 25,240, 18,158,237,225,185, 67,113,114,134,199, 14,210,121,182, 55,207,113,239, 31,182,186,
- 17, 88, 56, 98, 57,212, 38, 86, 82, 79,254,114,199,156,179,220, 98, 83,190, 11,244, 81,  9,151, 29,225,149, 14,206, 19, 34, 17,
- 61,204,166,  6, 44,186, 68,104, 86, 86, 16,159,186, 25,119, 85, 96,234,169,  2, 94,252, 18,111,251, 66, 85, 36, 53, 35,124,179,
-207,  8, 60, 47,232, 84,108,219,219,  5,244, 43, 55,200,235,231,112,150,144, 55,123,194, 39,  7,226,  7, 59, 46, 14,  7, 30, 70,
-251, 89, 14,229, 84, 49,205,102,239,218,158,231,226,109, 65,244,125,252, 65,148,120, 93,216,133, 25, 25,  2,242,131,128,116,  1,
- 13,  3,114,153,224,173,128, 28,109,167,169, 85,208, 50, 81, 35,164, 99, 69, 68, 23,156,107, 83,162,  7, 61, 45, 94,100, 99,153,
-146,165,110,177,125,171, 30, 43,210,124, 86, 18,128, 29,132,183,225,254,127, 72,252, 79,190, 74,253,171,239,161,175, 36, 82, 46,
-228, 77, 90,239,137,  0,109,243,  1,174, 62,147, 94,185,212,171, 80,238, 46, 99,189,234, 41, 76,166,229,129, 47, 23,157,202,202,
-240,223, 72,110,164,173, 30,164,218,122,197, 47,180, 54,246,157,138,109,155, 90, 87, 94, 79, 46,120,150, 11,234, 36,137,109,251,
-117, 54,151,123,251,217,162, 40, 73, 34, 41,  8,103,174,135, 24, 91, 16, 75, 83, 80,187, 45,203,124,229,120,220,168,189,240,177,
-229, 88,251,110,175, 86,  7,191,232,194,123,114,194,152, 31,254,238,193,110,145,157, 65,117,137, 88,109,148,185,185,108,132,120,
- 98,201,121,177,174,170,230,186, 76, 16, 62, 62, 12, 93, 11, 45, 89,180, 44,202,250,223, 45,163, 61, 34, 39,130,168, 22,205,147,
-130,123,196,171,225, 65,187,126, 48,238,186, 90, 38,  0, 21,  3,193,164,206, 58,229,  5,103,106, 23,112, 21, 89, 38, 73,170,149,
- 16,162,189, 30, 57, 47, 42,137, 16,251, 37,171,214,196,114,193,149,238,213, 88,243, 46,136, 83, 87, 62,169, 43,197,107,198,172,
-100, 43,191,109,117, 18,184,202,212,178, 13,202, 70, 48, 18,214,204,242, 69,216,160, 30,220,  3, 49,117,116, 93, 71,140, 29,115,
-206,140,199,189,189, 39, 67,207, 62,103,110,166, 35,199,219, 27,152, 39, 83,241, 75,216,116,186,174, 42, 23,243,159,183,  9,192,
-214,215, 45,178,126, 77,221,120,245,101, 11,171,212,117,196,185, 29,137,247, 18,136,195, 25,183,243,196,180, 63,152,237, 44, 24,
- 91, 69,116,179, 14,241, 47, 84,188,152,105,251,253,187,134,180, 86, 70,180,194,118,219, 16,233,  6,207, 44,119,133,239,250,241,
-177,251,246, 31,165, 45,180, 63,249,131,159, 48,142,241,190, 42, 99,181, 81,204, 40,112, 85,225, 50, 40, 87, 98, 77,213,179,157,
-240,254, 46,240,106,174,188,241,219,215, 60,252,135,183,236,126,246, 35,194,191,251, 10,250, 79, 60, 66,231, 30, 25, 20,198,108,
- 63,240, 27,192,207, 36,248,163,137,240,189, 76,255,195, 91,226,205,204, 89, 52,132,232,189,122,164, 92,222, 99,250,229, 63,199,
-252, 59, 95, 33, 93, 61,103, 56, 94,147, 58, 83, 53,206,215, 47, 12, 20,224,166,127, 98,132, 26,208,154,153,  8,236,220,130, 98,
-  9, 72, 66, 23,253,192, 18,181,109, 91, 85,144,132,244,157,189, 33, 37, 35,121,134,121, 68,206,207,145,139, 29,114,110,164, 38,
- 66,133, 51,123, 48,120,105, 59,240, 42, 25, 81,203, 36, 14, 82,145,206,148,238,245,187, 71,226, 39,123,120, 61,193,179, 98,243,
-255,115, 65,206,  4, 25,133,240,102,  7,159, 31,224,179, 10,143, 30, 35,229,129, 75,155,179, 41,232,114,134,209, 88,244,210,230,
-225, 65,225,197, 21, 60, 81, 27,185,239, 13,151, 38, 63,229,113,179,123,239,210,123, 95, 61,232,122, 52, 54,180, 98,108,241,152,
- 85, 12,149, 47,  6,159,105,162,174,222, 89,  1,157,168,  1, 21,118,  9,121,212, 35,131,169, 82,153, 42,117, 86,223,177,110,210,
-165,124,252,203,169, 99,229,228,177,148,141,237,169, 46, 23,222, 50,103,116,147,187, 93, 24, 92,249,148,225,201, 68,124, 39,194,
- 77,134,175,189,132, 47, 63,130,123, 59,228,115, 23,164,247,103,234,237,204,189,167, 51, 57,185, 39,189,174, 43,134,200, 10,  7,
-217,126, 56, 74, 49,226, 95, 85, 24,197, 66,137,186,171, 66, 56,203, 72,154, 73,239,187,223, 47,  6,184, 76,240,233,193,120, 67,
-163,207,118,247, 80,123, 33,206,149,160,117, 25,197,159,168, 82,125, 92, 25,101,221,221,138, 99, 70,165,237,168,199,138, 76,213,
- 15,202, 25,164,115, 60,238,167,145, 63,254, 31, 16, 63,255,235,212,143, 42,241,190,109,109, 26,180, 71, 78, 62,176,178, 77,162,
- 89, 49,240,122, 39, 49, 85,148, 90,228,206,101,190,190, 81, 85,215,239, 89,116, 51,  6, 87,167,191, 21, 69,213,118,190, 82,170,
- 67, 85,252,  0,114,229,244,236,119,107,239,172,242, 82,218, 37, 87,239, 36,181,157,130,113, 22, 86,245,230,123,107,127, 38,160,
-110, 35,139,182, 63,245,189,209, 92,170,247, 89, 43,240, 68,169, 75,108,108,195,100,138,  8,146, 58,251,251,231,201,104, 94, 11,
- 68,199,113,199,106,254, 95,203,151,143,144, 44, 32,100,137,245,118,245,190,162, 75, 44,106, 70,236, 89, 19,235,247,230,172,158,
- 38,185, 94,216,139,179,195,159,122, 65,108,237,224,162,188,212,166, 73, 27, 18,105,245,106,180,122,241, 19,218,  5,179,196,156,
- 43,177, 51, 58, 89,172,166, 22,111,217,233,235,196,194, 59,209,208,161,204, 54, 93,104,138,248, 90,137, 81, 60,254, 51, 82,138,
- 79,111,234, 76,157, 45,166, 83, 99,178,179,174,174, 43,146,170,101, 93,  3,105, 37, 87,179,251, 45, 91,161,176,226, 12,197,253,
-218,134,103,149,117,  4, 45,193, 56,229, 37, 47,153,  9, 77,160, 38,158,179,222,232,109,213, 63, 80, 49, 90, 86,122,151,122, 52,
-  4,142,211,200, 60, 78,116, 49,114,156,102,170,142,204,165, 90, 14,200, 38,167,160,226,201,115, 18,189, 67,175,148,121, 51,  1,
- 16, 57,249,124,156,208,146, 56, 53, 98,180,  3,212,125,  1, 92,132,196,197,227, 87,217, 31, 15, 72,169, 28, 85, 57,222,222, 82,
-243,140,104, 37,134,206,233,122, 86, 52, 45, 22, 54,177, 98,166, 93,232,167,133,158,219,183, 55, 72,220, 19,231, 90,189,155, 15,
-240,255,131,124,190,171, 33, 90,118,234,232, 66, 55,109,217,205, 90, 12,222, 49, 55, 21,175,239,138, 50,240,172, 10,103,230, 12,
-227,182, 24,224,227, 42, 10, 79, 31,  8, 15,179,242,214,215,111,121,244,111,237,217,125,225, 25,225,215, 95,181,192,145,177,179,
-127,225, 76,224,126, 15,143, 19,250,217, 10,223, 72,196, 63, 56, 16, 95,140,116,185, 48,236, 97,254,103,127,133,253,171, 63, 69,
-247,238,127,199,120,251,220,236, 81,221,142,241,214,  4, 17,196,176, 16, 70, 69,226, 18, 13, 86,131, 82, 36, 27, 80, 37,177, 40,
- 65,205,167,109,150, 17,201, 74, 96,166,106, 64,163, 47, 63,107, 37,104, 33,220, 92, 67, 25,145,116,  9,151, 61, 18,138,  9,184,
- 10,132,123,138,206,150, 84, 22,102,165, 75,217,160, 42,179,209,230, 68,  2,250, 34, 35,169, 67, 94,  9, 80, 18, 18,  5,233,212,
-212,213,159,218,193, 79, 43,188,250, 73,136,127, 30,246, 95,241, 18,254,  0,249,104,108,211, 92,215, 37,109, 47, 48,223,194,147,
- 25,110, 51,154,189,109, 24, 20,222, 26,236, 38, 27,125,124,114,  8,182,146,199,224, 13, 97, 35,218, 90, 58,131, 54,250,246,189,
- 37, 77,221,219,242,211, 85,108,236,120,225, 44,249, 62,216,  5,244, 66,215, 56,171,237, 72,125,211,157,182, 29, 89,240, 72,239,
- 19,123,155,172,162,147,182, 83,151, 22,133, 21,163,141,193,178,249,224,245,210, 98,104,121, 50, 17,223, 24,208, 63, 56, 32,159,
- 56,131,199, 59,120,125,135,124,254,130,244, 60, 51, 28,111,184,184, 46,228,  4,199,236, 95,183,174, 10,226,213,206, 41, 39, 43,
-135,182, 27,206, 81, 56, 86,  8, 47,230, 37,208, 34,118,  1,237,  2,116, 88,204,236, 59,  3, 50, 85,226,204,  2,179,183,173,140,
- 16,167,122,130,112,219,  6, 66, 44, 62, 84,185,139,199,242, 27,250, 38,192,116,132,249,187,190,210,217, 25,147,224,236, 87,  9,
-255,241,231,  9,255,230, 55,  9,247,226,226, 36,111,251,241, 69,108,168,171, 53,113,113,133,149,143,119,136,181,174, 48, 69,253,
- 56, 29,246,132, 14,215,250,155, 18, 54, 75,112,191, 50,150,  8, 81,173, 70, 39, 67, 86,  4,170, 11,214,174,171,114,230,227,243,
-181,251, 98,131,221,244,142,184, 17,225,238,132,209,156,128, 94,196,189,214, 53, 35, 21,178, 68,102, 17,230, 54,194, 21,181,188,
-245,205,208,150,182,139,181, 54,157, 26, 34,101,158, 44,104, 74,252, 66,151,176,137,243,148,165,192,140, 41, 57, 65,175,174, 32,
-169,186,  6,216, 22,167, 11, 21,247,154, 87,133,172,213,186,255,205, 68, 42, 46,121,240,186, 92, 94,117,171,106,247, 41, 89, 23,
- 87,113,162,108,100, 90,237, 98, 95,157, 12,178, 64,130,226,112,238,157, 96, 98,206,133,233,112, 67,  9,137, 34,137, 34,222,169,
- 58, 36,166, 96,220,143,144, 44,133, 76, 61, 53,172,  8, 11,115,124,206, 51,250,255,209,245,118,177,182,101,217,125,215,111,140,
- 57,215, 90,123,159,143,251, 85,117,235,163,171,219, 93,238,110,219,109,119, 28, 39,178, 19,199, 73, 72,  8,249, 80,148, 32,100,
-132, 64,188, 16,161,136,  8,158, 64,138,120,  0,  5,162, 86,224,129,  7,144, 16,136,  7,  4, 15, 72,  8, 33,148, 40, 65, 74,136,
- 66,136,132, 29, 59,182,227,182,211,137,237, 78,140,251,195,238,118, 87,119, 87,215,199,173,251,113,206,222,123,173, 57,231,224,
- 97,140,185,214,190,183,170, 31,142,238,173, 91, 71,103,159,189,246, 90,115,206, 49,198,255,255,251,215,226,  7,151, 96,160,139,
- 26, 58,100, 68, 60,136, 74, 35,124,165,135,209,208, 43,205,200, 73,167,149,104, 15,199, 28, 89, 18, 41,197,231, 16,170,251,178,
-204, 33,138,123, 30, 99,138,177,118,111, 94, 84,135,169, 38,242, 56,145,198, 49,226, 75,103,196, 26, 85,178,231,137,164, 68,237,
-162,180, 56,  2,174,121, 68, 13, 52,249, 90, 79,192,125,214,145,128,157, 89, 75,122, 39,202, 54,253,196,122,152, 91,215, 12,191,
-110,123, 17, 94,185,127,143,116,125,205, 92, 27,207, 88,184,125,250,100, 37,189,233,121,141,220,147,221, 66,211, 80, 75,161,126,
-196,134,126, 78, 76, 20,145, 23,192, 75, 47, 90,216, 94,168,149, 94,216,221,237, 67,186,247,168,212,135, 14,236,232,  2,156,234,
- 21,249, 51,123, 17, 71, 23, 92,232,102,220,138,144, 35,211,250,164, 48, 55,227,166, 10,207,146,240,232,174,240,114,133, 87,191,
-122,195,131,255,224,192,248,185, 71,200, 95,121, 25, 62,117,215,191,249,113,  2, 93, 28,167, 58,  9, 92, 42,124,125, 68,191,254,
- 20, 30,188,  9,127,242, 47,178,251,250,111,162,239,189,199,188, 28, 25, 46, 39,110, 91,225,180, 84, 52,249,147, 87,173,173,228,
-172, 38, 41, 78,249,130,234,192,160,238, 45, 23,  1, 29, 98, 51,204, 18,152,191, 16,100, 52,219,136, 85,234, 22, 16,217, 73, 36,
- 87, 29,253,163,218,141, 78,170, 43,234,161, 44,167,134,188,  7,195,179, 19,106, 66, 27, 96, 89,140, 60, 20,164, 39,153, 61,170,
-200,107,  3,242,178, 15,251,164,138,171,200, 63,  1,188,114,  1,187,191, 16, 60,247, 91,151, 72,183, 19,204, 21, 59,133, 40, 32,
- 16,183,104,130,175, 62,243,168,211, 78, 93,155,  4,185,140,235,117,138,118,211,164,216, 77,243,254,160, 60, 47, 80,123, 78,117,
-190,218,171,156, 72,165,230,212,173, 20,155,122, 78,130,238,  7,244, 58,123,181,170,130,157,188, 27, 96,139, 11,101,200,241,126,
-100,155,136,173,155,121,220, 55, 61,224, 78,206,110,196,243,198, 67, 10, 26,135, 12,177,  8, 15,217, 75,190, 39,160, 15, 18,245,
-  4,237,189,130,236, 18,122, 55,218,240,127,106,132,187, 35,242,201, 61,233,131,133,241, 84,185, 58,221,120,199, 38,195,161, 42,
-170,182, 37,107,197,254,153,251, 24,226,133, 57,127,109,  1,243, 59, 25,211,211,133,146,207, 84,193, 73,145,151, 51,220, 25,176,
- 55, 65,231,216, 61, 31,187, 79,208,250, 14,219,236,204,188,199, 11, 97, 16, 81,150,117,254,106,239, 59,151,234, 57,178,239, 27,
- 60,252, 53,104,239, 64,186, 10,213,218, 53,242,123,255, 93,244,211,255, 25,242, 54,164,139,173,197,223,171,232, 62,207, 62,119,
-185, 61, 39, 88, 78,120,117, 30,149,120, 61, 39,192,173,161, 21, 27,161,202,100, 75,109,107,141,115,133,222, 58, 82, 89, 49,177,
-205, 43,139, 22,115,120, 83, 89, 19,243, 14, 65,118,155,158,179,167,157,221,  3, 38,129, 37,149, 51, 31, 93, 59,179,231,185, 70,
- 32,197, 76,151,168,173,231, 86, 60,181, 77, 51, 53, 57, 10,202,196,217,238,218,122, 69, 84,163, 77,105, 48,140,200,180,119,123,
- 86,109, 30, 46,164,225,249, 24,188, 85,211, 74,115,114, 28, 48,134, 61,236, 60,231,198,197,109,182,126,188, 37,198, 67,173, 54,
-170,184,135,191,213,237,222,110,173, 51, 18, 92,112, 90,250, 26, 26,182,185, 30, 89,148,  4,246,131,249, 89,189,109, 35,136,117,
-131,215,205,  1,144,  2, 72, 50,152,161,251,107,116,218, 83,159, 61,102, 62,222,114,210,129,197, 18, 85, 26,164, 70,149,228,126,
-119,  4, 77,153,166, 25,202,226,226,219,228, 85,120, 69,168, 75,161,116, 65, 91, 93, 34,213, 76, 67, 57, 47, 27, 75, 66,125, 51,
- 84,201,161, 78,143,123,190, 89, 79,110, 90,103,245,213,106,220,107,254, 89,166, 52,160, 57,252,215,243, 49, 54,212,231, 21,134,
- 98,207, 71,152,114, 54, 62, 19, 17,242, 48,145,199,  9,178, 50,207, 11,182,204,  1,183,113, 72,112,109,205,223, 95,216,229,120,
-206,186, 41, 43,202,214, 58, 96, 34, 54,117,211, 51,  4,232,139, 21,202,202, 17,  8, 47,130,120,152, 88,183,216,157, 16,242,241,
-136, 13,153,195,211,199,212,211, 41, 52,  4,172,209,172, 61, 81, 46,165,193,181, 21,181,248,200, 33,174,177,189,208, 38, 63,255,
- 85, 92,164,215,214, 81,206,139,169,136, 47,110,232,219,  4,254, 35,143, 10,190,230,150, 26,148, 46,188, 80,233,175, 58,116,235,
-107, 84,232,141,115,230,180, 81,205,103, 75,214, 28, 97, 94,154,255,219,209,224, 86,225,131, 43,229,165,  6,175,127,233,  9,247,
-254,194, 45,249,143,221, 69,254,227, 87,224, 99, 23,240,193,  8,143, 60, 71,220, 38,224,165,  4,156,104,175,127,  6,218,  7,164,
-250,187, 12,237,134, 97, 20,198,  1,242,237,  1, 83, 35,153, 80, 37, 78,202,  6, 86, 23, 52, 85,100, 26,208,164,238,131,151,140,
-100, 67, 99,246, 42, 23,206, 93,183, 15,234,154, 53, 44, 65, 17, 90,123,183, 99, 80,177,  6, 69,174, 51,146,129,203,134,212, 29,
- 28,103,207,139, 31, 20,203,194, 48, 87,228,253,133,121,134, 97,167, 94,121, 46,  5,118,226, 74,241, 15, 10,114, 63,123, 91,234,
- 22,184,151,224,161, 57,177, 79, 94, 66,150,191, 19,106,119,131,122,139, 45,226,171, 98,204,160,109, 55, 34, 79,102,236,231,159,
-193, 93,129,135,193,135,159,129, 59, 25,246,  9,222, 15,144,255, 78,182, 15,168,190, 72,205,242,177, 67,183, 55,201, 25,214, 86,
-113,244,101, 82, 23, 23,234, 40,232, 69, 70,238,142,  1, 23,151,213, 42,103,181, 33,203, 38,  0, 17,233, 41, 85,178,230, 67, 59,
-251,252,172,210, 56,243,114,247,155, 82,165,111, 50,201,211, 73, 58,110,235,212, 96, 39,232,189,  1,110,149,246,205,133,246,157,
-  5, 25, 19, 82, 11,124,233, 25,252,216, 53, 60,156,224, 83, 59,210,227,202,176, 24, 87,223, 57,120, 43, 54,193, 28, 49,176,233,
-  5, 59,223,249,  6,115, 46, 66, 49,  7,255,145, 15, 13, 25,139,115,204, 39, 69,190,157,176,  4,242,242,132,220, 25,177, 79, 53,
- 15,194, 41,128,204,180,217, 51,142,173,182, 15,141, 27, 76,195,159, 25,188,239, 85,178,221, 95,183, 26, 60,169,240,158,194,241,
- 29, 56,125, 17,242, 39,232,  3, 47,166, 63,140,254,107,215,232,127,253,152,124, 87, 73,173,177,156,209, 98, 95,172,186,251,230,
-210,133,144, 17,183,189,158,242,245, 92,127,164,231,221,132, 16, 26, 38, 11, 14,188,173, 94,103,107,219, 74, 82,123,245,216,147,
-219,218,182,  2,184,134,163,174,227,199, 67,176, 38, 70, 83,199,167,246, 10,207,124, 35,236, 98, 50,117,133,154,211,210,186,143,
-189, 67, 57,  6,223, 20, 82,241,150,110,193, 88,162, 98,172,154,144,148, 73,106,206,170,104, 53, 72,118,189, 37, 53, 96,187, 11,
-191, 30,167, 83,108,228,  3, 77, 19, 58,184,106,168, 30, 15,171, 47,186,105,162, 36,159, 19,151,184,  6,169,139, 36,218, 54, 38,
-144, 32,185,149, 56,147,181, 51, 48, 79, 63, 44,182, 23,132,154, 53, 64, 75,189,165, 59,132, 93,116, 10,177,199,218, 85, 57, 19,
- 65,244,182,123, 83, 33,103, 39, 99,234,197, 30,189,186, 71, 59, 29, 88,230, 19,183,115, 97, 81,165,132,210,187, 83,224,  2,108,
- 14,106,232,180,243,207,165, 69, 78,119, 39,214,244,239,139, 86,180, 68,139, 77, 52,193,144, 17,205,254,247, 94,169,170,103,120,
-180,226,164,123,205,201,197,104,209,246,182,214,168,165,  3,102,188, 58,214,148, 93, 76,187,148,176,153,186,176,167,133,119,240,
-195,176,148,179,229, 74, 97,208,196, 48,238, 72,121,160, 24,204,243, 28,209,165,217,157,  0, 34,148, 82,227,119,248,176,219, 70,
-147, 99, 87,171, 61,159, 54,103, 29,123, 43,182,229, 34,124,168, 52,246,103,182,131,102,106,173, 80, 11,  7, 73,220, 62,125,202,
- 43,151,151,124,208,140,229,224,244,203, 86,125, 92,184,234, 34,162, 80,108, 89,168,181, 98,165, 70, 39, 64,183,238,152,124,184,
-242, 22,209,179,124, 67,215, 31, 61,135,165,144,239,221,114,127,177,245,126,254,255,210,191,122, 55,127, 30, 44,172, 63,178,198,
-115,234,121,252,227, 11,189,253,118, 22, 34, 49,135,192,227,196,166,186, 94,162, 82,184, 81,225,118,231, 15,232,248,229, 91,242,
-223,185,241,121,226,143, 14,158,168, 54,203,202, 89, 39,123, 28,167,237,  4,145,119, 73,239,127, 29,185, 63,145,  7, 97,119,156,
-217,165, 16,115,201,134, 83,145,206,  4,181,202, 96,141,125, 86,174,166,204,176, 27,144, 65,209, 41, 33,151,  9,238, 13,126, 74,
- 60,201,122, 44,119,129, 67, 40,213,155,  7,128,203,253,  1,125,121,132, 33, 98,245,118, 78, 51,146,218,252,160,112,145,144,187,
-153,116, 87,201,248,130,111,197,189, 43,122,  1, 50,186, 21,206,145,237, 78, 91,145,151,  6,248,152,194,213, 15,128, 93, 32,135,
- 95,136, 39,251,  0,243, 18, 43, 98,103,103, 38,184,163,240,179, 79,224,183, 79,216,163, 25,153, 27,188,146, 96, 81,228,245,  9,
- 94,157,224,241,226, 23,120, 18,248,214, 66,251,237,  3,229,184, 56,247, 28,161, 54, 13, 21,177, 57, 36, 33, 52,105,201,186, 10,
- 93, 72, 89,124,206,103,158,200,150, 31, 76,164, 55,119,200, 43,147,223, 77,223,157,177,111, 30, 41,143,102,202,161,113, 60, 19,
-  3,153,109,160,160,222,194,110,182, 41,232, 58,236, 38,169, 48,168, 48, 38, 97, 63, 56,124,102,184, 59,144, 94,223, 35,175,141,
-112,223,145,187,124,115,134,251,  2, 23, 81,178, 28, 13, 57,128,220, 17,248,160, 34,175,100,184,183, 11, 16,140,162,181, 33,179,
-145,159, 45,171, 24,200,100, 19, 65,157,143,  8, 68,182,104, 77, 61, 19,211,145,194, 46, 85,226,126,200,126,205, 48,144, 81,224,
- 50,251, 97,106, 48,228,132,179,234,101, 27,136,174,247,207,224, 35,  5, 73,157, 87, 29,179,116,141,255,238,127, 31, 61,135,154,
-203,  4,175, 85,100, 47, 48,253,  4,200,126, 45,239,229,213, 95,194,254,250,239, 98, 57,129,182,231,230,234,231,170, 87,225,249,
-127,176,182,  9, 41, 42,231, 62, 86, 57,107,185, 75, 84, 22,182,169,249,215, 74,127, 83,173,251, 89,119,179,166,173,115, 62,219,
-  4, 69, 45, 42,229,206,198,239,249,229,213,132,114,230,205,174, 43,245,109,179,  5, 72,120,174, 53,123, 40,134,224, 30,240, 33,
- 39,210,144,201, 17,252, 81,  3,114,180, 52,143,173,148, 97,244,192,166,174, 38, 31,  6,218, 48,193,184,195,166,157,255,174,243,
-236,213,249,144, 33,143, 94, 49,151,133,118, 58,122, 12,108,242,182, 52,170,222,166, 87, 13,116,104, 91,149,207,117, 77,  2,220,
-188,145,174, 77,168,155, 29,171,139, 32,251,225,241,236,222,146,149,134,231,107,233, 46,206,176, 41,124,202,179, 41, 53,152,250,
- 93,196,217,131, 67,194, 45,237,133,241,229, 53, 88, 99,153,143, 28,151,202, 44,137,170,153,150, 39, 76,242,  6,118,233,136,218,
- 46, 16,196, 60,199,189,139,192,130,119,222,172,110, 48, 35,186, 64, 48,163, 17,225,169,113, 93, 92, 91,236, 48,149,243,239,105,
-214,176,226,213,121,181,141,152,166,241,218,152,209, 22,239,  2,108, 29,247,180, 97, 23,217,238, 53,206,245,104,226, 51,255,113,
- 24,153, 46, 46,200,227,196,220,140,211,225,198,127,102, 31,249,136,227,151,169,109,165, 43, 34, 91, 85,155, 66, 99,213, 98,166,
-221,  3,128,164, 39, 87,225, 86, 51,105,182,126, 96, 61, 86, 85, 67, 96,105,170, 72,171,228,148, 72,195, 68, 85, 23, 20, 30, 69,
-121,252,244,  9,229,116,136,238, 69,116, 67, 35,138, 86,196,159,237, 98, 80, 79,135, 24, 81,180, 45, 66,248,133,137, 62,  1, 65,
- 18,217,  6,109, 98, 91,128,147,124,  4, 96,230,121,157,187,125, 20,131,102,171,212, 69,  2,135,152, 66,225,217, 96,136,190,170,
-198,236,168,179,175,123,229,222,236,188,114,119,101,244,100,112,140,212,139,169, 91,108,212,125,197,199, 65,184, 25,149, 87, 14,
- 71, 30,252,247,111, 51,252,223, 55,200, 95,125, 25, 62,117, 15, 25, 34,239,252, 13,133,227,128,236, 27,242,206,251,200,165,186,
-180,246,100,228, 60,113,241,184, 50,206, 11, 83,105, 12,  5,230,106, 28,171,119,244,181,129,148,138,230,130,214,140, 12,151,176,
-223,251, 65, 97, 39,176, 31,189,229,127, 58, 65,137,184, 65,196, 45, 91, 39, 67,170,231,148,234,117, 70, 46,242, 26,130, 41, 26,
- 54,171,253,232, 37,237,212, 72, 53, 99,195,136,126, 48, 81,254,233, 13,203,239, 30,105, 55, 13,189, 82,184,219, 96, 17,172,  8,
-146, 11, 60,220,249, 83, 45,226, 41, 40,243, 63,246, 63,205,160,156,176, 99,196,176,246, 82,230, 66, 92,204,240, 79, 14,212,188,
-208, 78, 11,250,181,133,244,125,131,255, 30,151,161,124, 43,226,136,182,177,121,117, 72,  7, 36,244,116, 33, 11,245,238, 38, 44,
- 82, 54, 24, 77,138, 13,190, 11, 10,117, 76,232, 85,134,171,209,191,225,216,224, 81,165, 30, 10,118, 44, 44, 37, 40, 93,161,185,
- 72,201,219,237,125,243, 44,109, 83,153, 55,182,106, 53,197,220, 62,171,127, 20,178,243,205, 83,122,111, 60,121, 70, 59,173,151,
-123, 13,189, 74,216, 32,200, 28, 24, 89,105,216, 23,110,144, 63,185, 67,238,239,176, 55, 26,114,218, 51,136,103,212,223,121,231,
-128,101, 33, 69,247,230,140, 32,187,158,100,211,115,170,244, 13, 65,218,  4, 90, 49,100,110,180,165,210,142,  5,125,164, 88,255,
-165,239,140,200,171,187, 21,228,194,187,190, 33,182, 82,177, 98,235,125,228,130,163,173,156,150,190,211,174,146,235, 16,173, 44,
- 13,158,137,219, 17, 31,188,  5,237,125,208,  7,241, 84, 93,193,195,127,157,244,211,191, 74,251, 27,133,244,170,146, 91,101, 89,
- 67, 70,236, 57,226, 92, 39, 99, 57,237,139,109,241,235,115,194,118, 54,202,236, 77,169,216,112, 83, 84,236,231,  0,151, 53, 13,
-109, 85,116,  7, 31,123,  5,164,123, 62,173,213, 45,204,163,243,225,107,156, 73,157,199,238,180, 51,225,121, 98, 28,161, 52, 95,
- 15, 59,221, 87,237,242, 55,114,171, 12, 36,116, 72,216,169,156,217,181,146, 39, 34,214, 22,228,197,130,106,194,198, 17,149, 33,
-238,203,160,171, 13, 67,216,155, 20,155,143,216,124,112,190,  4,184,109, 45, 37,183,241,105,194,146, 15,184,235, 25,194, 84,195,
- 86,166, 57,109,222,242,224,230, 23,220,226,213,120, 94,200, 45,103,225, 89,221,138,215,100,155,209, 14, 41, 86, 19,243,188,117,
- 98,115, 39, 18, 18, 53,230, 44, 93,171, 96,102, 48, 78,180,101,102, 89, 22, 78,167, 19, 75, 53,150,136,231, 21,150,128,199, 68,
-117,151, 61,246,212, 84,221, 82, 59,237,189, 13, 94,230, 21, 23,219, 22,239,135,104, 18,134, 97,242,120,217, 62,211,213, 28, 65,
- 39,230, 52,184,142,130,213,158,211, 29,235,125, 41, 17, 21, 26,237,102, 17,199,196, 34, 78, 83, 91,102, 95, 20,206,139, 63,219,
-196,140,222,138,174,207, 69,225,246,153,114, 82, 37,143, 99,240,213,149, 82,143,107, 87,224, 57, 32, 82,171, 27,237,149, 13,202,
-162,113, 88,108,103,140, 56,255,124,210,154,  6,106,210,226, 61,217,218,193, 16,112,119, 65,140, 97,146,  8,105,156,200, 73,253,
-154,150,133,211, 60,115,120,252,129,163, 92, 45, 58,110,107,203,223, 15, 11,170, 66,213,196,114,184,197,150,226,225, 76,145, 89,
- 96,234,194,234,205,237, 17,249,  8,210, 43,117, 63,144,183,243,230,250, 11,221,  4,251,  8, 64,172,125, 68,213,222,255,146,239,
-134,120,163,136,123,211, 23,235, 73, 93,158, 97,125, 48,215,103,153,179, 72, 86,235,139,196,134, 63,190,208,205, 56,154,197,220,
-200,219,124,217, 60,  4,225,152,132,155,189,240,116,223,120,245, 43, 79,184,250, 75, 39,228,223,188, 69,254,226, 67,216, 11,150,
- 95,162,181, 55,145,227,140, 62,125, 31,153,129, 71,126,242,179,212,144,  1,116, 86,198,164, 92,139,249,102, 46,158, 60,214,250,
-195, 85, 64,150,226,182,180, 36,112,121,  9,247, 38,120,  9, 56, 10,242, 94,195,180, 33, 86,177,185,177,  6, 12,223,201,232,195,
-201,103,227,163, 64, 83,175,214,198, 16,  9,141, 97, 65, 58,156,224,105,245,104,191, 34,164, 87,  7,236, 73,161, 62,105,180, 15,
-140,180,107,222,182,190, 82,236,  8,178, 68,168,185, 42,212,103,200,252, 36,230, 60,  7,236, 20, 23,187, 68,127,111, 23,153,236,
-191,248,140,118, 40,216, 93,195,230, 74,125,180,160, 95, 62, 33, 63, 49,  5,173, 46, 46,248, 69, 88,163, 98, 39,147, 41,147,150,
-230,155,117,242, 89,104,171,207,159,250, 68,108,173, 84,221, 89, 38,164,164,232, 69,246,121,250,165,130, 41,118, 91,176,219,138,
- 29, 42, 45,162, 86,103,219,216,231, 22,221,229,210, 89,235,201, 63,231, 30,233,184,194,110,116, 99,178,187,129, 65,144,203, 12,
-187,193,231, 59, 57,195, 55,102,236, 59,  5, 94, 51,236,169,159, 28,229, 42,146,245,212,165,  7,242,126,195,126,227,  9,242,227,
-247,224,229,201,237,145, 18,234,232, 95, 51,238,190,127,226,105, 22,199, 13,159,181,172,107,188,251,132,121, 32, 86,131, 23,249,
- 55, 45,153, 47,214,115,163, 29, 61,249, 79,  6,133,189,122,231,101, 63,192,107,178,198,123,202,  7,254, 96,180,217,129, 67, 22,
-220, 90, 29,  4, 75,194,122,250,105, 94, 25,172,195,109, 11, 22,251,193,224,  3,224,245,247, 97,121,  7,134, 31,136, 82,123,128,
-244, 39,208,127,231,147,232,223,248, 50,169, 36, 70,169, 20,188,  2,174,103,208,148,142, 50,213,248, 71,167,198,217,214,146,238,
-226,186, 51, 25, 90,138, 10,176, 87,214, 43,199,253, 76,168,100,237, 69,  4,134,156,197,148,250,168,199,108, 99,161,154,232, 74,
-217, 90, 35, 54, 61,154,100, 83,238,214,136,173,140,217,185,160,158, 94, 38, 91,183, 71,226,144,144, 74, 65,166, 29,101,151, 54,
- 28,109,139,132,177,197,193, 25, 41,103,100,156,124,174, 27,164,196, 86,253,103,212,214,176,229,228,239,107,153,209, 90,124,212,
- 52, 12,174,126,111, 46, 14,107,187,168,194, 14,199,141,212, 19, 95,131, 24, 73,140, 83, 28,136, 37,198, 23, 82,206,104,113,241,
-231,144,182, 71,176,156,193, 94, 82, 56, 16,186,208,208, 35,131,109,245,172,247, 36,182, 28,  7,155,117, 20, 97,193,104,215,204,
- 92, 10,199,121, 94,237, 96, 22,209,188,114,170, 46, 92, 27,  6, 48,113, 92,112,110,212,154,160,229,141, 30, 41,201,  5,113, 73,
-145, 97,192,138,195,120,114,242, 77,166,210,199, 46, 78,191,244,106,126,243,153, 91,173, 88, 89, 34,156, 38,173, 51,103, 19,167,
-131,246, 19,163,213,182,206,126,252,254,178,231,157, 26, 91,196,208,246,239, 93,183, 32, 78,143,211,148,209, 60,146, 82,162,224,
-  8, 85,179,237, 48,233,152,227,182, 34,103,109, 67, 33, 70, 17, 33,235,166,184, 10,117, 53, 61,215, 89, 94,117, 14, 81,161,123,
-154,155,119, 34,104,182,134,185,148, 82, 67, 36,232, 98,205, 60,140, 44,165,  4,163,190,108, 58,128,232, 20,104, 10,204,114,107,
-212, 50,211, 37,153, 46,148,136, 92, 82,145, 77, 99,176,110,150,186,186,  2, 52,242,  3,186, 50,168,107, 94,158,171,210, 87, 90,
-221,247, 20,194,111,240,153, 31,105,198, 44,194, 81,224,113,134, 91,115,194, 92, 50, 97, 15, 92,246,  8,112, 92,159, 53, 27,236,
-194,175, 89,207,  5,179,103, 51,248, 19,190,145,239,154, 39,116,213, 80, 60, 46, 10, 55,131,242,236, 14,188,118,156,121,233,127,
-253, 46,227, 23, 79,240, 87,239,195,103, 62,  6,111, 63, 68,228,  9,122,231,  6,174,197,171,154, 91,127,168, 41,213, 31,174,136,
- 87, 28, 13,106,242,  5,163,103, 42, 39,241,133, 27,245, 42, 74, 70,241, 22,106, 18,184,186,194,246,  9,110,158,249, 83,218, 43,
-167,221,136,126,242, 18,185,151, 97,111,  1, 38,136,147, 77,242,157, 64, 84, 48, 43,176, 27,125, 99, 63, 85,152, 13,185, 72,164,
- 31,186, 66,190,189,248,  5, 42,225, 11,156,207,230,221,  6,164,201, 67, 90,218,201,167,143,167,234, 23,105,142, 50, 71,195,155,
-190, 24,246, 43,  7,236, 42, 34, 11, 23,127, 47,237, 91, 51,233, 88,131,242,214, 96,183,248, 97,229, 80, 92,220, 53, 37,164, 41,
- 67,107, 76, 33, 88,111,210, 61,198, 18,  9,121, 33,130, 49, 86,224, 76,198, 21,239, 58,102,184, 55, 34, 23, 41, 84,218,134, 61,
- 45,216,220,168, 39,227, 84,124,131, 44,214, 33, 13, 27, 26,182,179,216, 85, 55, 26,203,185, 88,111,101,118, 35,232, 62,163, 83,
-134,189,122,200,  9, 96,223,152,177,103, 11, 60,115, 31,172, 51, 93,  5,185, 56, 83,121,142,  5,249,154, 97, 15, 15,200,247, 93,
- 97, 15,155, 43,150, 71,101,104,  2,191,246, 24,158,156, 56,170,112, 74, 17, 52, 19, 93,164, 62,232,215,152,187,245, 89,155,134,
-229, 71, 82, 44,218,213,104,135,134,228, 70,122, 90, 96, 76,216,197,236,  7,184, 75,133,215,247, 80,253,100,157,222,181,213,223,
-218, 78,113, 82,104, 32,201,252,251,163,106, 94, 87,252,236,195, 85, 91, 26,114,106,240, 52,193,233,  6,230, 95,135,253, 31, 96,
-195,228,188,  2,175,255,123,164,159,254,207,177,191, 93,176,215, 19,195, 77,165,157, 55,222,206,132,136,171,136,110, 37,198,121,
-217,173,104,232, 30,206,221, 43,222, 81, 91,146,231,134,175,191, 99,237,109,204,120,208,215,104,213,168, 76,187, 55,146,236,149,
- 86,245,195, 33,205,144, 97,196,134, 17, 41,  5,155,103,154, 44, 97,137,218,184,239,172,249,  3,129,157,109,254,251,228, 30, 37,
-107,198,128,178,164,204,148, 35,222, 50,101,234,241,136,150,194, 14, 40,121, 96, 25, 19, 53,170,112,103,206, 87,199,207, 54, 67,
-171,145, 90,128, 80,186,157,104,157,181,102,210,144,  2, 40,100,180, 20,190,226,182,101,109,232, 89,130,156,103,214,251,207, 40,
-209,245,170, 97, 37,169,145, 51,207, 25,251,191,207,220, 91,219,186, 84,122,150,133,217, 66,107,100, 17, 93,168,146, 24,101, 99,
- 58,116,148,174,164,240,  7,  4,206,245, 84, 11,181,132, 42, 31, 89,175,149,147,217,150, 46,247,166,213,130,150,130,230,193,173,
-100,170,180,230,207,182,107,135, 22, 52, 42, 63, 77,105,229,246,155,165,109,179,169,109,157,235, 90,115,161, 23,165,110,246,180,
-216, 50, 85, 19, 41,185,248,171,118, 79,123,  7,170,164,240,185,247, 36,213,179, 80, 30,139,200, 85, 86,225,165,110,164,187, 24,
- 63,164,148,104,146, 56, 85,143, 87, 61, 55,243,187,149,113,123,173,243, 70, 88, 23, 38, 86, 51, 31,135, 18,121,234,113,223,119,
-193,162,157,209,  0,147,  8, 57,229, 85, 88,231,143,105,163,205, 14,136,169,173,145,172,177,155,118, 88,158,176,101,241,215, 54,
- 91,109,124, 93,123, 64,140, 82,106, 93,156,229,208, 71,  2,129,212,150,102,207,181,115, 36,184,  1,136,110,221,178, 78,  6,236,
-  7,225,100,103,176, 41,158, 63, 38,189,208,141,252, 80,158,163, 25,233,191,249,254,221,231,239, 53, 87,172,191, 92,225, 65,133,
-  7,102, 92, 38,184, 80,225, 78,242, 49,224,164, 49, 98, 92,163, 58,125,223, 26,116, 75,201,210,179,164,155,110,  3, 89, 45, 36,
- 81, 97,148,234,234,227,195, 78,169, 25,166,239, 28, 25,254,254,  9,253,216, 45,242,123,158, 66, 73,232,242, 12, 30,  0, 59,117,
- 25, 77,193, 91,229,161,100,180, 64,138,117,110,242, 16, 27,199,148, 96, 18, 37, 93,102,184, 28,225,206, 21,220,191,240,139,113,
- 92,188, 21,209,212, 91,165, 55, 62,195,214,143, 95, 32, 63,180,131,169, 70,208, 65,184,247, 53, 16,119, 41, 57, 25,206, 12, 73,
-230, 39,187,222, 94,108,234, 89,203,123,133,197, 49,132, 50,102, 84, 20,189,227,170,121, 30, 42, 60,188,  3,166, 72,121, 10, 86,
-176, 83,139, 19, 82,172,  8, 67,136,  5,191,122,130, 95,189,193, 94,194, 85,231, 53, 20,241, 71, 72,115, 66,126,226,210,239,148,
-233, 26, 46,127, 20,210, 35,228,155, 79,225,155,197,213,252,165,158, 59, 55,214,148, 49,141, 96,145,245,122, 41, 12, 73, 72, 99,
- 66,167, 76,126,105, 66,190,111,135,220,223,123,155,243,221,153,246,246,137,250,184, 80,231,194,161,201,170,147,232, 51,199,172,
-178, 10, 76,123, 80,130,200, 71,224, 97,197, 89, 57, 87, 10,195,253,145,244,112,135,188, 49,193,203,163, 71,141,253,253, 39,180,
-182, 96, 41, 42,166, 28,243,234, 11,221, 86, 73, 83,215, 60, 60, 51,120, 53, 35,119,198,240, 95, 26,114, 61,160,187,132,190,219,
-208,147,199,167,106, 98,101, 99,247,170, 48,105,132,144,196,172, 51,169,111,242, 57,185,157, 79, 34, 25,198, 15, 43, 26, 11, 67,
-140, 11, 38, 31,140,202, 20,243,242, 57,126,126, 55, 32,219,  6, 14,146,236, 17, 94,114,198,106,151, 20,115,119,146,119,  1,166,
-132,188,210,224,226,  8,187,159,132,244,160, 75,205, 64, 95, 67, 62,243, 51,216,223,122, 23, 27, 93,148, 86,187,158,225, 12,247,
-138, 88,180, 74,159,167, 81,105,100,216, 39,241, 38,209,144,146,207,162,199, 17,153,118,232, 56, 58, 57,175, 72, 48,217, 59,188,
-104,219,140, 87,255, 55, 96, 73, 49,205,129,  3, 13, 46,184, 14,136,186, 40, 72,202, 66,171,254, 44, 89,180, 73,251,205,215,206,
-185,214,218, 55,145,104,249,139,147,220, 44, 15,222, 74, 31,  6,210,224, 63, 99,110, 66,209, 76, 30,  6,210, 56,146,134,  1,146,
-122, 94,185, 53,134,230, 26,246,214, 60,222, 83, 59,218,181,197,225,165, 89,180,233,149, 60, 13, 30,189, 25,106,209, 78,207,236,
-204,244,180,  6,208, 88,176,  6,162,149,219,182,234,176, 91,241, 52,200,207,221, 99, 92,240,160,151, 99,245,231,163,244,103,164,
-111, 68,241, 48,166,222,214,143, 13, 63,197, 65,187,173,109,101, 54, 17,106, 30, 48, 29, 56, 45,133, 82,106,244, 61,226,231,134,
-192,215,234,102, 43,108,165,120, 91, 58, 70, 16, 12,227, 26,231, 38,113,250,118, 86, 69,  8,218,162,125, 86,154, 81,231, 25, 74,
-  4,203, 68,152, 79,247,255,107,140, 74, 58,119,185,123,192,123, 56,208,138,100,109,219,252,166,199,181,174,219,168,200,166,  0,
-183,118,134,  3,118,178,158,226,175,145,135,137, 97,218, 65, 26, 56,205,142, 94, 85,137,216,215, 24,145,180, 37, 14, 50,102,207,
-153, 77, 36, 14,  4, 73,213,  5,125,145, 12,234,113,195, 62,190,241,  2,191,110,  4,200, 30,222, 18,173,249,218,204,  5,110,173,
- 82,154,185,  0,219, 64,114,136,255,138, 19,244,182,153,179,191,166, 14, 99, 56, 23,132, 90,150,104,141,202,115, 41,169, 26,185,
-245,253,181, 36, 58, 84,170,186,142,128, 86, 44,109,173,107, 74,155,125,175, 93,251,133,192,151,243,178, 61, 50,222, 72,159,255,
- 31, 95,250,124,250,131, 19,249,135, 71,118, 15, 71,238, 92, 38,238, 37,229,193, 34,188, 92,140,  7,  5, 94,170,198,  3,117, 56,
-220,117, 18,174,146, 48,169,119,167, 99, 13, 99,140,205,117,212,205,194,148,227,212,175,122, 86,189,245,177,176,249, 60,188,142,
-202,112, 88, 24,126,110, 70,143,  7,244, 15,206, 94, 49,138,  7,110,144,  4, 57,186,145, 86,150,176,198,196,160, 71, 85, 24, 84,
- 25,212, 24, 21, 38,245,216, 86,189,235,100, 52,219, 93,120, 14,250,225,  0, 99, 67,110,193,170,248,140,195, 20,121, 56,160, 31,
- 27,224,218,243,189, 58, 12,119,167,  0,  0, 32,  0, 73, 68, 65, 84,101,182, 51,  5, 71,243,141,195, 12,217,165,181,135, 42,234,
- 27,187,244,214, 64,176,141,201, 62,255,215,203,140,220,155,144, 73, 60,183,251, 19, 25,238, 61, 64,150, 91, 40,183, 30, 98,114,
-140, 77,189,167,147,236, 20,174, 18,252,236, 51, 63, 53,143,134,157,236, 57,196,171, 62, 85,228, 15, 93, 64, 46,112,241,  3,112,
-249,103, 33,127,  3, 62,248, 22,252, 78, 11, 79,100, 64, 36, 94,196,179,190, 88, 53, 43, 12, 89,145, 81, 73, 23,  3,233,149,  9,
-190,111,239,191,239,161,193,219, 11,246,238, 76,187,153, 89,142,198,225,172, 74,108,108,237,123, 51,159, 15,202,121, 54, 91,236,
-232, 26, 27,127,138, 80,180,253,164,228,251,147,191,214,235, 59, 23,252, 61, 91,224,103,159,210,172,210, 74,195,110,154,111,126,
-147,250,  6, 56, 70,  6,123,197,239,  1,113,188,152,188, 26,  4,184,197,231,  0,242, 32,147,  6, 69,159,  9, 90,141,220,162,141,
- 74, 95, 60, 58,169, 76, 72,121,187,  6, 41,197, 67, 55,196, 38, 46,172, 68, 46,201,253,  1, 52, 24,241, 13,125, 28, 98,156, 18,
- 54,243,178,209,169,104,125, 45, 13,107,228, 62, 26,161,226,118, 52, 25,  4, 25, 82,220, 47, 25,238,128,220,185,133,225, 30, 12,
-159, 13,174,172,  1,123, 31,195, 60,250, 71,180, 47, 20,236,194,162,189,187,217,160, 56,163,218,157,  7,231,164,216,116,178, 12,
-232,180, 67, 46, 46,225,226, 26,219,141, 14, 39,137,236,131, 84, 22,172,213, 72,213,234,161, 53,103, 18, 67,217,238,109,107, 17,
-151,236, 50,113,127,221,181, 34,142,110, 93,173,216,178, 32,121,240,205,189,148, 77, 48,213, 89,218,189, 26, 73,217,121, 14, 81,
-145, 19,249,223, 18, 29,160,170,137,162,138,229, 28,112, 41, 79, 14,147,230,182, 33, 48,114,246, 22,190,136, 39,165, 57, 30,217,
- 92,200,213,140,214,138,183, 62,  7,  7,131, 72,107, 33,148,143,254, 74,140, 16, 68,206,208,219, 34, 46, 80, 76,  9,211,204,146,
-  7,106, 30,176, 60,161,211,222, 81,210,105,  8,134,186,135,165, 44,230,  7,144,115, 98,158,157,105, 74,250,193,118, 58,  3, 98,
- 73, 23, 69,245,192,151,102,190,145,152,145,205,  5, 87, 51,153,121, 94, 40, 22, 41,127,178, 89, 53, 27,155, 35,193, 86,125,200,
- 70, 46, 84,201,174, 78, 95, 22, 74, 51,202,178, 80,235,178,110, 20,162,222,249, 44,157,146, 25, 66,182,182, 58, 32,218,217,125,
- 21, 54,195,158,185,110,117,203,139,183,134, 68, 94,251, 74,148,139,  3,195, 42,100,238,248,214, 86,195, 73, 16, 80,171,179,180,
- 41, 17, 33,229,145, 97,154,144, 52,176,148,  5,169, 21, 19, 87,161,151, 90, 86,165,189,217, 25,237, 80,117,205, 91,207, 57,147,
-199,232,240,196,  1,167, 31, 94,218, 26,254, 19,202,255,176, 41,186, 88, 54,173,128,156, 46,112,236,188,118,213,228, 33, 58,170,
-148,184,191,207,249, 23, 67, 30, 96, 24,144, 82,177,236,160, 29,106,217,210,236,226,224,224,243,254,188, 50,  1,122, 10,161,179,
-  4,212,159,147,110,219,171,171,165,229, 67,184,237, 15,129,102, 94, 64,202,158,135, 64,100,251, 95,110,209, 79, 13,240, 35, 10,
-159, 28,224,206,132,102,152, 30, 87,198,111, 26,252,118,131,175, 20,236,187,149,250,164, 82, 22,227,184, 52, 14,  2, 55, 98,220,
-100,225,169,  9, 79,163, 61,191, 84, 56, 70,225, 90, 59,211, 57,102, 30, 37, 66, 67, 36, 42,246,163,  8,239, 42,212, 11,229,181,
-121,225,238, 95,127, 76,250,142,192, 95,126,  9,125,115, 71,251,170,194,103, 34,244,113, 20,248,182, 32,143, 10,217,132,148, 42,
-150, 98,209, 89,161, 21,134,142,186,149, 81, 30,216, 14,169, 98,247,119,112,167,193,147,131, 11,178,118,  6,247, 19,220,205,113,
-196,238, 84,164,110,253, 48, 56,198, 21, 27,170,251,183, 35,217, 65,174, 67, 16,228, 41,  8,112, 87,209,107,131,161, 56, 98,118,
-223,160,166,120,162,163,165, 93,159,122,151,224, 20,135,133,158, 35,154,204,219,187,223, 45,240,157,130,221,139,240,230,174,104,
-147,234, 20,187,139, 56, 53,169,192,248, 38, 92,254, 24, 28,190,  2, 15,254,  9,161,228,193,102,247,209,134,  6,109,  5,179,240,
-220,201, 17, 82,235, 85,168,207,179,184, 51,184, 64, 48, 80,145,148,182, 86, 84,245,156,101,189, 86, 26,231,173,172,176, 76,181,
-109,211, 57,167, 45, 38,245,137, 68, 30,252, 16,193,148, 99,160,159,225,157, 91, 23, 93,197, 33,134,102,180,103,138, 94,248,  2,
-205, 73,145,189,109, 38,104, 12,222, 45,216,151,158, 33,191,239, 14,242,112,244,  7,101,159,224, 39,  7,242,195,145,244,207, 14,
-180, 71,179,  3, 72, 78,149,214, 10,197,220, 46,132,198,181, 89,129, 46,174, 74,239, 30, 36,105,206,185,111,181, 33, 82,145, 97,
- 99,191, 90, 82,228,110, 70,174,  6,120,216, 28,  8,  4,200, 83,208, 91,176,157, 31, 76, 56,198,155,159, 21, 25,122,171,177,133,
- 42, 62, 62,239, 83,133,111,103,120,229, 22,118,127, 15,118, 63, 14,195,143,132,177,116,  4,253,113,244,223,120,  5,253,155,111,
-145,170,145, 66,113, 91,207,221,241,  1,186, 17,  4, 53, 63, 84,170, 38,223, 88,243,224, 21, 75, 53, 56,204, 62,103, 94,202,154,
-238,226, 52, 70, 37, 15,  3,165, 41,181,154,191,103, 26, 90, 60, 65, 76, 37, 81, 83,138, 46,132, 99,114,125, 61, 86,239,172,168,
- 98, 38, 88,202,232,110,196,106, 11, 54,249,128,236, 46,208,211, 28,156,116,175,222,172, 91,119, 36, 44,113,181, 34,230,130, 34,
-143, 54,245,251, 37, 91,137,170,213,157, 13, 38,142, 65,117,108,157, 87, 80, 41,194,160,176, 70,138, 67, 73,130,160,167,137,251,
-181, 25,144,113,128, 50, 99,102, 43, 44,198, 69,147, 78,152, 44,113,  0,110,  8, 45,101, 44, 57,236,166, 38, 65,135,  1,134,201,
-237,142,154, 17,140, 82, 10, 66, 37,215, 25, 93, 78,228,200,193, 46,102, 31,130,118,166,228,143,107, 94, 89, 14,178,218,244,123,
- 39,171,111,180, 53, 54,122, 81,111,197, 46,243,137,101, 41,158, 63, 17,113,167,137, 70,194,168,174,116, 12,171,152,109,163,147,
-230,237, 34,107,  5,116, 88, 49,189,180, 74, 91,142,142,123, 77,121,125, 72,107,139,208, 39,210, 74,189,107,181, 63, 24,105,157,
-237,183, 32,165,245,214,178,136,167,233,121,229,160,113, 64, 74,171,134,192,194,218, 74,  0,127, 86,  6,250, 89,122,217,106, 83,
- 55, 99, 84, 71,225,142,195, 72, 27, 51, 50,187, 31,189, 90,163,198, 61,213, 90,228,194,155,160, 73,221,254,152,178, 87,203, 41,
-187,112,143, 22,  9,106,178, 10,223,170,157,157,124,  3, 67, 75,116, 45, 45,249, 28,188, 44,209, 21,160,173,182,205,164,137, 33,
-103, 52, 37,183,149,  6, 21,111, 85,218, 35,200, 48,208,106,139, 67,164,249,136,163,179, 15,122,167,164,235, 20,154,231,186,119,
- 39, 64,159,235,183, 53,144, 74, 86,126,194, 71,123,207,237, 35,133,113,242,156,211,101,123,175,249,173, 95, 57,176,255,213, 35,
-187, 44, 12, 59, 37, 93, 41,250, 70, 70,126,104, 64, 62,151,224,115, 19,118,255,  2,185, 49,134, 15, 26,249,171,198,238,139, 51,
-247,126,103,161,189, 91, 89, 78,149, 83,109,220, 42, 60, 81,120, 60, 10, 55, 56, 64,238, 96, 27, 42,180,131, 72, 36,170,249, 73,
-182, 40,203, 69,224,209, 36,164, 90,185,254,133, 15,188,205,250,151, 95, 66, 62, 57,193,215, 20,126,112,143,237, 78,160,234,130,
-164, 99,246,211,193,209, 91,217,214,156,184,137,122,149,231, 67, 18,175, 74, 44,141,212, 87, 63,141,221,221,161,239,126,211,209,
-176, 47, 53,184,111,174,176,175, 53, 72, 37,190,209,154,216, 25,146, 43,200, 68, 39, 67,238,157, 97,218,196,144,187,209, 70, 61,
- 53,216,  3, 69,177,219, 80,185, 87, 28, 53,123, 87,195,166,117,240,121,249,162,222,210,239,189, 58,100, 83, 37,254,230,236, 21,
- 90,242, 84, 52, 43, 21, 59, 86, 56, 84,218,169, 97,178,243,159, 41,234,116,146,225, 14,212,207,194,149, 87,145, 82,156,221,185,
-212, 21,216, 70, 50,176, 49, 22,146, 53,111,193, 23, 28,153, 18, 58, 38, 31, 17,220,201, 46,  8, 19,117,181, 91, 87,154,  5, 62,
-179,139,223, 90,124,102,185, 67, 93,162,149,111,155, 69,123, 75, 32,236,220,159,  8,141, 97, 23, 39,223, 41,124, 62,  9,248, 86,
-193,114, 16,244,202, 86,229,154,121,117,110,179,107, 15,228, 94,246,141,189,199,174,189, 53, 99,251,103,200, 15,223,133,151,197,
- 43,254,151, 12, 62,113, 23,249, 49, 33,125, 61,145,126,125, 71,125,107,161,220, 28,209,227,236, 24, 83,193,187, 61,153,205,206,
-216,227,215,206,134, 85, 86, 27,237, 84,225, 54,218,149, 79,226, 90, 20, 69, 30, 36,236, 94,218,218,237,136,171, 72, 14, 29, 80,
-232,159,175, 73, 67,170, 56,  0, 41,192, 29,235,124,162, 25, 60, 73,216,187,  5,185,122, 11,118,255, 39,220,249, 56,232,101,128,
- 89, 30,192,195,215,208, 63,252, 54,252, 92, 35,221,137,241, 64,235,157, 18, 57,131,  9, 13,228, 72,168,210, 52,132,162,181, 66,
- 93,226, 96, 86,189, 66, 26, 70, 44,169,111, 13, 18, 76,182, 82,144, 82,144,101, 33, 45,149,166,153,186,219,187,128,177, 95,151,
-192, 68,163, 94,181,153, 66,121,250, 20, 59, 28, 28, 70, 19,212, 48, 29, 70,116,119,129, 13,131, 71, 94, 86,163,148,  5,171,213,
- 23,215,210,182, 20,175,243,182,108, 84,110, 75,245,246,111, 27, 92,196,212, 59,  1,100, 69,107, 88,153, 52,121, 35,122, 89,200,
-218,188, 29,175,130,204,133, 33,185, 34,190,106, 10,235, 21, 72,241, 64,151,108,142,186,173,103, 93, 14,149,234, 41,145,226, 17,
-164, 86, 11,165,186, 32, 74, 69,208,211,193,253,239,217,173,115,102, 80,155, 35, 12,115, 31,160,231,201, 23,241, 84,145,214, 60,
- 80, 37, 78,209,238, 93,223, 28, 33, 37,112, 20,205,188, 98,231,140,182,104, 18,207,106, 84,115,101, 89,162, 34, 55,106, 83,119,
-143, 12,217, 63,218,210,104,197,239,175,231,225, 96, 45, 42,244,153, 52, 76, 43,163,  2, 29,161, 85,172, 26,181, 85,180,182, 53,
-240,200, 34, 52,102,131,156,185, 34,218,219,236, 70,137, 16, 18,159, 84, 68,181, 94,159,239, 32, 18,  4,183,115, 76,234,154,216,
-103,109, 85,215,182,126, 47,174,  9,114,230,241,186,211,158,105,127, 65, 26,  7,150,102,204,167,133,121,153,253, 94, 48,243, 42,
-189, 85,  4,101,152,198,128,211,228,200, 56,240,251,184,181, 26,174, 28,215,126, 52,241,206,229,218,205,224, 57, 55,170,231,192,
- 75,162, 45,243, 42,120,179, 56,240,174,227,195,148,104,170,110,237, 67, 72,121, 88,253,232,195, 48, 58,142,120, 89,214,131,  5,
-185, 98, 53,196,163,182, 29, 36, 52,197,134,156,124,134,238,163,219, 45,111,221,171,110,221,170, 46,219,234,113,251, 30,114, 56,
- 59,211,128,240, 34,175, 30,200,255, 56,114,212,247,139,177,171,149,171,167,133,235,183,102, 46,190,160, 92, 12,194,116,157,200,
-175, 39,228, 71, 70,248,241, 17,249,  3,  3,246,167, 38,168,144,222,174,164,255,175,176,251,197,133,235,175,157,120,248,184, 49,
-159, 42, 71, 26,143, 19, 60,201,194, 77,  8,130,139, 60,143, 16,237,164,177,169,251,134, 21,110, 51,140, 75,101,250,205, 39,240,
- 95, 53,228, 47, 63,128, 31,188,128,127,161,200,247, 79,216,157,  1,222,159,144,247, 23,248,160, 97,143, 23,100,158,145, 42,207,
- 39,107, 36,133, 57, 86,240,131,120, 40,202,245, 53,246,240,190,223,140,119, 26,236,139, 51,233,137,152,212,229, 12,145, 89,  3,
-138, 82,193,118,138, 44,134,221,152, 87,179, 45, 54,253,172,176,111, 94,121,162,136, 85,159,141,223,198,162,253,122,242, 57,249,
-238,  2, 78,199,144,144, 23,182, 94,106, 28,225,167, 16,212,189, 95,224, 37,241, 54,135,129, 29, 13, 59,248, 65,163, 29,219, 54,
-235, 40,129, 23,179,147,127,117,168,192,168, 48, 38,210,220, 56,213,152,143,  6,231, 93,187,115,165, 17,115,178,132,236,146, 87,
-234, 87, 25,121, 48,192,206, 33, 29, 54,183,141,140, 22,121,155,154,125,108,145,226, 20,174,230,228,178,174,161,168,109,227,204,
-159,223,116,189,217, 48,164, 24, 81,140,201,  7,236,147,250,245,254,157, 19,114, 33,200,168,232,232,239, 77,162,180,177, 86,253,
- 26, 29,154, 47,154,215,209, 55,183,120,177,175,159,176,252, 20,249,204, 93,208,  2,186,135,235, 31,133,151,175,225,205, 95,195,
- 62,247, 91,164, 47,  8,250,203,153,242,254, 45, 44,139, 87,255,  1,190,247, 46, 92, 28,  0,149,231, 66,223,173,199, 87,222, 54,
- 76,221, 18,213,129,230,214,  6,184, 55,194,125,117,187,157, 76,222,214, 93, 60,130, 81, 39,176,108,216, 98,125,  5,247,241,205,
-178, 69, 82,130,193,105,129,119, 19, 60, 60,193,238,215, 97,255, 79, 97,250, 41, 23, 88,200, 29,224, 14,250,231, 39,210,207, 85,
- 82,115, 14,195, 18, 84, 20,141,177, 65, 78,222, 45, 82,107,164,148,  2,140, 83,250,240,149,170, 25,147,236, 29,  4,107,  1,155,
-153, 93, 77, 94,155,227, 62,155,243, 33,116, 24,104,227, 62, 14, 47, 33,205, 83,  9, 13,137, 87,236,173,  6, 31, 33,135,109,172,
- 86,154, 86,207,208, 62, 29,145, 60,146,246,123,200,147, 87,152,116,178,154, 56, 76, 72,166, 16, 57, 85, 15,  2, 41, 37,102,185,
-174,153, 47, 34, 17,237, 90, 17, 51,170, 10,102,213,231,155, 49,147,  7, 99, 10,198,190,228, 76,198, 96, 26, 97,186,164, 78, 59,
-210,188,128, 46, 44,117,113, 44,180,120, 37, 88, 17, 71,165,246,172,117,105,254,115,211,  6,153, 49,171,110,229, 19,208, 38,206,
-167,168,149, 90,107,204,191,235,154, 24,111,117,107, 69,155, 38, 39,218, 37,159,229,167, 86, 25,164,173, 27,250,233,140,229,223,
-187, 91,216, 25, 93, 44,100, 60,162,202,177, 20,150, 90, 87,202, 91,177,198,128,144, 98, 99,211,148, 61,195, 94, 92, 83, 96, 18,
-204,249,200,168, 71,132,188,191,164, 28, 15, 80,139,119, 20,243, 68,107, 39,170,249,238,155, 87,216,225,166, 77, 50,  9,197,184,
-166,216,224,219, 25,101, 48,116, 10,210,206,136,112,182, 30,  4, 86,237, 68,216,197,172,143,116,154, 87,217, 91, 76, 96, 88, 93,
-115,246,224,157, 33,147, 52, 57, 79,127, 41,204,165, 82,202,236,  7,227,206, 68, 23,111,117,167,113,242,141, 53,190,223, 67,124,
-188,171,150, 12, 36,167,117,102,237,159, 83,132,211,  6, 55,163,213, 18,173,117, 89,113,183,198, 86, 65,119,114,167, 11,106,147,
-243, 22,102, 31, 93, 16,116, 56, 17,101, 24,132, 52,142,222,180,237, 17,198, 61,165,206,156,210, 41,105,235,112,184, 83,172,190,
- 48, 35,119,167, 76,171,171, 49,207,133,216,108,162, 82, 59,115,160,219, 71,196, 90,159,195,225, 95,252,174,252,229,197,188,106,
- 22,200,205,  5, 69, 89,225,130,198,117,129,  7,239, 23, 30,190,  7,119,190,116,224,234,111, 37,198,187,137,225, 83, 35,242, 71,
- 38,236,247,143,216,159,184,128, 63, 45,200,163, 70,250,157,194,197, 47, 47,236,127,253,196,189,239,158, 88,142,149,185, 54,110,
-  7,113, 33,187,186,237,104,  6,154,186,144,164,198,252,189,152, 48,155,113, 51,129, 46, 30,246, 98,255,109, 66,255, 35,129, 31,
-190,192,126, 59, 33,159, 29,177, 35,240,237, 25,190, 60, 35, 39,193,170,120,123, 60,157,209,213, 74,108, 16,178, 64,109,232,119,
-223,130,203,167,240,202,222,231,162,185,249,124, 32,141, 62,172,173, 17,174,210, 43,137,106,216, 28, 11,127,113,178,154, 28,138,
-179,214, 59,236,185,246, 40,167,120, 90, 71,133,151,212,155, 51,115, 12,146,175,  7, 63, 68,156,138,183,193,151, 80, 24, 31,227,
-233,206,226,173,227,155,  6, 79,189, 36,182, 83,156,118,187, 42, 71, 67, 29,216,177, 98, 43,255,245, 25, 44,191,238,135,151, 69,
-125,244,144, 29,166,146,130, 91,189, 52,176,131,145,  6,143,164,213, 20,200,220,193, 55, 89,149,128,172,236,  6,239, 73,159,218,
-243, 97,215,230,194,136, 20,196, 52, 11,244,169, 74,231, 39,199,223,117,243,176,219, 70,  7,101,  8,221,133,230,128,198,236,146,
-107,  7, 46,  7, 23, 62,190, 91, 87,224,140,180,230, 35, 14,195,243,225,155, 34,131, 97,218,252,134,121, 26,194,201,148,253,115,
-154,178,  3,122, 46,158, 32,111,188, 12,135, 35,180, 59,176,255,183, 32,255, 37,228,226,239,193,197,127,  7,211,129,252,143,174,
-144, 15, 14, 94, 57,186, 36,117,179,151,232,153,194, 79,227, 51,  9,152,139,149,134,221,198, 98, 36,  6,143,226, 48, 86,  4, 30,
- 12,216,189,209, 53, 14,217, 63, 91,185,  1,158,  9,146,131, 60, 23,  7, 67,159, 67,  4,146,167, 11, 78, 26,206,237,255,160, 32,
-151,239,194,205,207,195,240,105,247,173,235,  4,250, 83,200, 27,191,140,190,158,209,239,156,152, 46, 61,195,187,246,200,220, 36,
-228, 88,220, 68, 70, 68, 51, 84,159, 71, 10,174,242,182, 90,124,243,172, 62,255,108,226, 42,255, 26,149, 73,141, 42, 76,114, 70,
-242,228, 85,123,199, 47, 71,  6,  4, 75,217,136,115,181,  4,246, 85,176, 97,  8, 50,153, 83,199, 90, 53, 88,102,172, 84,116, 60,
- 65,158,220, 74,150,167,245,126,160,248,  1, 96,141,192, 76,201,253,254,134,255,190,209,146, 84, 77, 94,205, 90, 99,142, 10, 44,
-229,236,135,  9, 19, 74, 54,234,168,107,117, 92,135, 29,146, 71, 70, 17, 74, 30, 97, 62,209,110,235,218,113,104, 98, 43,168,197,
- 90,245,138, 61,208,183, 26, 50,120, 85, 65, 99,  4,211,158, 19, 35, 57, 78, 90, 52,121,219,182, 86,172, 45,219, 92, 75,148, 20,
-248, 64, 77,  3, 50,141, 36, 42, 99, 89,160,250,  6, 93, 59, 82,180, 19,131,215, 42, 51,110,195,216,188,172, 25, 75, 93,188,179,
- 97,193,221, 15, 65, 94,238,177,162,109, 19,164, 33,  9,197, 91,233,162, 33, 34,107,133,122, 60,160,227, 68, 61, 25,182,212,136,
- 27,245,158,125, 13,162,166,132, 69,211,226, 61, 16,221, 17,135,166,132,229, 81, 66,240,169,  1,117,169,177, 70, 69, 43,187, 61,
- 23,155, 26, 91,139,181, 16,117,122,152,137,133, 45, 80,146,146,243,232,225, 39,225,139, 47,165, 96, 82,215,177,145,157,253, 28,
- 49, 97, 76, 35, 50,106,204,164, 99,105,106,117, 61, 84,136, 36,134,232,122,216, 89,220,116, 78,201,  9,143,177, 73,214,142, 85,
- 12, 18,161,196,193,196,171,253, 20,156, 15,141, 66,197, 29,  8, 37,  0, 60,173,  5,231,192, 42, 25,193,210, 64,105,222,125,106,
-165,197,178,108, 43, 80, 38,169,250,  1,163, 69,236,113,173, 33, 48, 13,205, 65,117,193,162,167, 94,182,176,152,198,181, 93, 67,
-185,228,123, 10,228,214, 42, 93, 94,228,208,108,147,247,124, 91,225,131, 56,189,105,204, 69,122,108,233,133,194, 78, 60,154,243,
-158,192,131,218,120,240,110,229,213,119,103,238,127,225,150,139, 75,101,248,248,132,254,145, 29,246,199,247,240,123,  6,236, 39,
- 46,224,105, 67,190, 50, 51,254,226,194,248, 47,142, 92,126,119,230,193,161,112, 59, 55,158, 42, 60, 27,133,219, 24, 43, 31,101,
-139,143,208, 32, 53,230,  1,212, 10,249,219,207,104,255,131,160,255, 62,200,103,175,176,247, 12,185,239,155,177, 29,131,  2,247,
-182,250,238, 53,  5,147,177,212, 77,205,181, 23,111,181, 78, 21,238,220, 64, 59, 98,179, 35, 15,209,140, 77, 13,169,147, 63,184,
- 41,146,217, 78,165,251,128, 66,  3, 21, 96,148, 20, 54,183, 59,195,115,209,124, 44, 49,184, 22, 65,238, 77, 62, 87, 47,192,221,
-228,135,128,229,128,149, 32,163,244, 77,221,226,130,167, 64,212,254,230,  1,150,134, 93,130, 29, 10,246,172,110,225,228,241, 64,
-112, 39,210, 90,108,128,241, 83,193,164,252,142, 19,217, 58, 35, 85,188,221,155, 22,235, 33,104, 20, 17,108,113, 27,155,142, 49,
-251, 24, 18, 58,170,207, 13,175,146, 75,211,163,213,202, 77,141,124,118,127,111,238,108,144,181,  5,223, 21,245,253, 32,143,201,
-202,124,239,205,  7,139, 42,126, 80, 15,145, 75,131,122,151,227,110, 14,139, 66,130,223,121,134, 61, 94,176,215,187, 39, 40,  4,
- 23,139,159,250,156,135, 28,106,242,165,109,171,225, 16,194,201, 33, 98,125,127,235,128, 77,143,145,151,238,194,241, 31, 66,249,
- 41,216,255, 17,200, 63, 13,118,131,252,161,255,  9,134, 35,249,103,119,200,141, 80,106,241,214,250, 25, 67, 86,244,108,115,175,
-125,  1,118, 95,117,107,134,158,234,154,220, 68, 57,185,205, 82,128,  7, 25,185,202, 30, 14, 36,138,188, 29,179,224, 67, 13, 59,
- 78,111,109, 38, 79, 43,236, 89,  3, 57,200,110, 75,131,167, 10,203,  2,243, 91, 80,223,  1,153, 64,238,193,248,167,225,206,255,
-140,254,177, 70,254, 63, 38, 76, 11, 23, 97, 23,109,173,249, 25, 52,103,200, 59,191, 79, 79,199,128,123,120,123,166,206,133,186,
- 84,154,149, 21, 41,155,186,234, 60,178, 19, 90,180,254,210, 48,122,136, 71,100, 38,180, 26,149,189,197, 40,164,127,175, 66,109,
-226,155,189,132,206,  0,127, 14,181,187,108, 69, 98, 62,191, 68,186, 91,168,239, 99, 67,110,167, 19,173,206,171,189,135, 14,250,
-104, 94,117,169, 40,150, 50, 77,189,147,196, 52, 98,201,171,116,137,236,238, 74,117,122,153, 25, 69, 71,218, 82, 24, 14, 55, 78,
-248, 34,193, 82,208, 90, 86,183,192,210,124, 62, 75, 11, 24, 72, 87, 74, 18,224,153,240, 53, 73,191,215,215,249,127,143,104, 45,
- 46,188,142,182, 45, 75,241,217,126,  2,165,117, 84,149,199, 66,227,179,107,221, 93, 80, 85, 97, 62,193,241,228,149, 98,124,223,
-220, 54, 22,122, 86, 33, 27, 40,149,210, 95, 39,150,251,190,102,151,160,252,229, 96, 46, 44, 86,157,185, 46,190,142,121,  0,157,
-  5,190,181, 32,183, 79, 25,199, 29,146,  7,218,241, 22,149,192,188,182,138,217,226, 51,231,228,130, 97,103,192,119,165,127, 13,
-104,239,246,254, 45, 41,174, 61,235,163,  5, 57,195,156,186,213,108,181, 94,181,182,165,243, 53,223,176, 82, 14,177,162, 38, 74,
-107, 44, 37, 44,107,205, 28, 11,156, 61,148,198,186, 54, 64,132,156,  7,114,118, 66,158,  9, 46, 84,171,171, 12,209,109,205, 57,
- 99, 42,148,165,132,  3, 34,236,139, 34, 12, 73,227,250,137, 87,243,173,249,216, 49,126,151,166, 10, 75,241,131, 78,192,107,170,
-128,182,186,  6,252,132,247,114, 21,203,250, 60,222, 29, 24, 22,179,114,107, 45, 28, 51,234,203, 73,159, 73,226,163,189,222, 33,
-235,182,189,166,186, 10, 29,215, 89,154, 74, 64,127,218, 11,  1,172, 31, 81,165,191,152, 42, 39,231,  2,185,109,204,144,254,192,
- 94, 63,223,139,200,163,193,108,226,130,183, 22, 73,108, 45,144,213, 38,188,103,240, 45, 17,190,153,132,239, 40,188,127,106,156,
-222, 91,224,139, 71,210, 63, 56,146,126,225,132, 62,110,240, 70,130, 31, 24,225, 39, 39,248, 67,123,228,205, 29, 58, 12, 76, 71,
-229,242, 88,185, 92,140,203, 30,240,209,125,123,177,182, 75,  4, 66, 37, 13, 81,221, 98,216,111, 25,242,  3,  9,121, 35,195,219,
-230, 22,178,251,142,108,229,158,248,  6, 58, 70,117,124,111,128,171,193,255,173,207,111,115,194, 87,196,134,220, 46,126, 50, 46,
- 11,210, 15,  0, 75,236, 84,199, 88,236,107,136,153,196, 85,234, 82, 28, 94, 66,210,168, 22,117,203,249,124,142,210, 31,253,238,
-189,122,238,249,157,228,172,203, 18, 39,152, 83, 92,228,110, 85,187,  8, 31,253,223,125,134,205,197,  5, 99,207, 10,237,209, 18,
-254,231,104,127,215, 68,122,243, 18,249,253,123,144, 17,174,127, 26,242, 67,223,196,126,247,171,216,111, 66, 45, 75, 84,184,182,
-182,250, 56,219,132, 83,204,210, 73,138, 94,103, 23,155, 92,142,240,241, 61,242,210,206,223,219, 51,131,247, 78,240,120,161, 61,
-153,169,207, 22, 63,117,203,115, 41,134, 94, 69,233, 38,154,227,  5,230, 58, 34,140, 34,236,146, 31, 12,243,229, 64,126,117,143,
-188,186,131,215,246,240,242,  0, 95,124, 74,251,242, 45,118, 41, 91, 37, 59,168,123, 75,  3,122, 46,221, 42, 22, 10,236, 62, 64,
-236,137,181, 82,  5,116,240, 46,199,117, 69,174, 39,120,246, 15, 97,124,  3,134,215, 32,127, 26,166,215,145,135,191,  1, 23, 71,
-244, 59, 25, 89,100,141,141,117, 11,154, 70, 91, 92, 86, 64,189,104, 90, 57,201,231,246, 64, 66,113,237, 76,228,248, 12,119, 26,
-163,143,205,168, 44,221,188,172,226,153,215, 35,200,190,219,220,196,131,140,114,228,  6,236, 19,114,183,193,120,  5,187, 79, 65,
-254,184,163, 99,211, 61,224, 55,144,139, 47, 99,191, 58, 96,183, 46,222,179,218,168,166,200,176, 67,246,147, 87,142,203, 66,173,
-149,138, 82,154, 58, 64,163,122,151,234,124,218,211,149,178, 45, 54,105, 65,169, 50,210, 36, 69,104,134, 87, 12, 93, 84,103,182,
-109, 88, 22, 45, 88, 59,135,128,212, 13, 71,234,239,103, 64,198, 93,159,109,108,243,204, 97,192, 82,222,146,163, 67,216, 83,197,
-253,209, 18,149,176,228, 33,190,124, 83,148,253,133, 91,169,140, 32, 49,122, 53,163,101,102,160, 81, 82,102,174,149,118, 56, 58,
-220, 72,140,211,233,200, 50, 31,161,245, 48,164,110,212, 98,157,211, 98,205, 59,146,201,159,229,  6,212, 26,232,219,213,193,177,
-129, 86,  4, 23,160,182,148, 61,215,178,121, 68,236, 16,238, 14,119, 63,170,171,229, 53,185,166, 96,220, 33,215,247,176,253, 61,
-170, 36,183, 69,213,122,230,179,246,194, 33, 99,164,228,135,196,197,132, 83, 21, 90,228,244,249, 51,213,179,201,187, 56,181,115,
-243,195, 82, 22, 15,157,230,140,232,232,127,166,228, 42,111, 17,202,233,224,155,117,202,190,177,135, 77, 46,231, 17,212, 69,102,
-173,213,149, 69,222,211,248, 68,  4, 13,123, 92,171,238, 73,151,190,  0,196,252,255,220, 98,166,225,175, 23, 81,  7,202,228,236,
-155,168,166,168,202, 23,202,105,166, 84,199,213,106,210,192,254,194,144, 51,211,232, 97, 46,118,174, 60,151, 62, 51,119,225,174,
-158,165, 32, 54, 51,106,109,212,110,201,107, 27,139, 67, 84, 73,162,228,193, 35, 92,171, 53,218, 82, 72,154,200,195, 16, 29,155,
-182, 22,146,162,178,206,213,205, 44, 28, 33,222,181,144,184, 46, 73,125, 92,160, 42, 36, 52, 68,143, 45, 14, 44, 26,174, 44,167,
-203,137, 38,135,251, 68, 40, 76,199, 71, 91,160,106,183,232, 97,255,236,106, 41, 62, 26, 92,119,194,239, 81,165,235,139,161,235,
-155,100, 78,206,182,245,244, 83, 23,250,121,214, 28,245,152,127,219, 86, 88,206,205, 79,150,135,232, 16, 63,109,240,212,132,247,
- 27,124, 71,132,111, 37,225,219, 34, 60, 58, 85,234,123, 11,250,207, 14,164,127,112, 75,250,245,130, 92, 24,188, 49,194,103, 71,
-228, 39,247,240, 99,123,244,114,100,168,153,221,177,113,117,104, 92,182,240,126,246,152,164,190, 87, 42,100,179, 80,185, 26,246,
- 85, 67, 62,149,145, 55,  6,236,253,  6,151,134,220,207,112, 21, 39,250, 34,222,166,189, 12,113, 90,247,171,140,177,240,  7,  5,
-142,147,192,222,206,200, 95, 45, 44, 58, 46, 18,243,232,190, 32,183,168,251,163, 93,169,146,145,166,112, 61,250, 70,220,129, 10,
-242,194,160, 67,146, 31, 42,238, 69,148,231, 28, 28,213,131,249,151,157, 33,137,238, 13,112, 91,177,127,126,194,172, 80, 31, 23,
-152,227, 67, 63, 86, 23,  9, 13,137,100,137,244,169, 61,242,185,236,232,185,235, 63,  3,249, 62, 28,255, 31,248,157,111, 96, 95,
-129,182, 20,183, 29, 45, 22,194,159, 77,237,174, 94,156,175,158, 73, 29,148,116, 53, 32, 15, 70,228,245, 29, 60,112,118, 51,143,
-102, 87,151,223, 46,212, 39, 11,237, 89,241, 86,165,156, 89,169,206, 38, 16, 93, 28,109, 47,228,103, 39, 96, 76,226,103,170,172,
-228, 59, 19,249,149, 11,248,248, 14, 94, 27, 97,202,216,223,124,159,118, 90,176,125,119, 16, 90,  8,204, 92,197,207, 18, 91, 64,
- 63,116,133,135,157,232, 26, 88,232,211, 56, 52, 79, 12,123,188,192,125, 65, 46, 47,225,217,207,195,248, 50,140,159,134,225,115,
-176,251,125,112,239, 23, 64,110,208,183, 50,178,180,192, 71,134, 96, 78,116, 75,156,145,228, 78,138,236,178,126, 57,179,185,117,
- 90,137,172, 89,156,145,228,177, 87, 63, 60,142,186,217, 94, 10,235, 34,168,200,234,113, 39, 71,252,108, 22,100,231,240,  7,185,
-223, 96,186, 11,187, 55, 97,252,193, 24,244, 78, 32, 63,  0,227,255,133,164, 19,246,203, 13,180,208, 82,102,217, 95, 99,121, 68,
-151,197, 63,247,158, 53,222, 51,156, 91,136,228, 58,205, 74,207,  5, 85, 97,137, 18,165,229,193,231,238,230,243, 61,234,130,198,
-102,184,  5, 79,184,218,121,197,134, 55, 91, 15,121,182,210,202,163, 89, 21,222,111,207, 62,238, 66, 14, 69,198,201,133, 71, 61,
-100, 36, 84,213, 68,101,168,195,228, 22,188,156,145,156, 93,232, 53, 14,206, 14,215,204,134,142, 87, 20, 35, 91,245,199,217,224,
- 52, 23, 76, 51,121,183, 39,103,165, 56, 72, 53,126,126, 67,107, 69,251, 98, 77,119,148,184,120, 51,  7,115,176,169,210, 52, 14,
-148, 91,244,218,218,154,150,168, 66,155, 38,167,217,117, 95,187,217, 74,228,157,205, 81,178,164,236,139,188,184,138,123, 54,133,
- 60,110, 96,156, 90, 86, 11,220, 42, 52,239, 26,208,230,108,248,118, 78,241, 59,247, 99,139,146,212, 86,232, 80, 99,131,188, 88,
-231,185,231, 33,220, 17,190,185,149,101,246,247, 20,155,156, 14, 83,164,254, 21, 90, 93,188, 61,220,159, 39,250,198, 44,225,162,
- 72,190, 89,245,226, 75,210, 58, 54,241,239, 75, 46, 20,203,206,142,239,110, 12, 19,168,214,220, 78, 87,252,192,217,149,229, 26,
-188,248,156,  7,134, 97, 96,202, 35, 87, 87,215, 92, 93,221, 97, 24,119, 44,101,161,149,226,153,232,177,161, 75, 44, 64, 61, 96,
-168,197,140,186,243,231, 83, 74,228,148,200, 67, 38,231,129,148, 51, 57,126,159, 82,235,115,155,117, 39, 50, 82,155,111,208,209,
-  5,178,208, 77,208,186,126, 98,115,  0,117,208,140, 35, 95, 59, 66, 55,186, 23, 42,107, 40,210,134,166,141, 67,155,109, 82, 90,
-215,132,168,199,209,174,174, 65,191, 38, 53, 68,173,172,225,192, 31, 45,142,227, 12, 58,213, 13, 90,124, 68,168, 75,250,227, 23,
-250,249,116,118, 70, 72,231, 85, 89,220, 80, 35,155,183,188, 70,245,126,219,188,176,125,210,124,212,248,190, 10,223, 76,240, 78,
- 18,110,231,138,124,253, 68,254, 71,  7,242,207, 31,145,167,  1, 13,121,115, 68,126,255, 30,249,189, 35,242,241, 29,169,100,166,
- 34, 92,206,149,203, 98,140,157,250,117, 38, 22,206, 61,202,185, 24,246,117, 67,190, 63, 35,223, 63,194,141,227, 68,229,101, 65,
-174,171,111,238, 67,248,232, 58,111,187,111, 57,115,180,119,251,134, 93,226,196,153,  3,204,108,134, 52, 87,176, 58, 38,237,140,
-176,221, 89,144,139, 67, 73,184,159, 87,178,155,156,103,123,118, 26,192, 36,112,119,240,116, 54,139,120,167, 78,143, 59,181,205,
-155, 62,136,207,144,223, 94,144,155,234,169, 89, 55,197, 55, 52,154,255,169,130,238,188,165,168,159,186, 64,126,104,242,138,229,
-242, 95,  2,189,128,155,191,  3, 95,121, 27,251,186,209,202,236,179,255,110, 43,209, 51,  5,186,194,144, 61, 46, 74,114, 66,115,
- 66,119,163,167,145,189, 58,186,242,253, 84,177,183, 79,142,230,125,186,208,110, 10,237,166,  6,210, 81, 54,255,118, 88, 48,180,
-135,151,172,139,190,172, 30,204,172,206,188,222, 53,152,118,153,244,112,135,126,108, 15,175, 15,240,234, 30,110, 10,252,253, 71,
-180,177, 98,251,104,231,214, 56,136,244, 21,235,133, 59,216, 96,107,155,198,120,193,154, 95, 83,185,169,254,217, 60, 43,225,106,
-184,  7,207,126,201,199, 20,227,247,129,126, 12,201,111,194,245,207,195,  7, 11,250,118, 66,  6, 54,133,102, 15,161,201, 26,194,
-108,137,185,229,243, 38,112, 89,229,202, 81,217,247,194,107,192, 15,122, 23,217, 31,150,238,146,168,108,200,200, 28, 66,193, 28,
- 85,206, 20, 80,138, 75, 65, 30,  8,236,238,193,229,167, 97,248,161,240,172, 23,200,175,130, 86,228, 99, 95,128, 95, 22,218,  7,
-123,236,222, 21,173, 37, 90, 57, 33,181,250,226, 46,157, 67,219,168,225, 61, 79, 49, 62,168,125, 97,  9, 74, 26,189,189,171,147,
-255, 25,240,141,182,156,192, 42,231,241, 19, 22,  7,133,126,232, 49,149, 51,175,176,108, 56,203,179, 46,142, 87,184, 81,237,229,
- 17,221,237,124, 35,204,131, 87, 37,125,129, 15,191,183,230,  1,166, 41,116, 34,  1, 30, 10, 59,144, 87,139,121, 93, 24, 53, 37,
-134,105,199,184,223, 49, 12,131,207,160,155,209, 46,174, 24,118, 59,111, 77,207, 39,230, 16,224,181,214,220, 86, 22,141, 19,123,
-206,153,225,170,114,111,165,198,248, 44, 15,126,160,227, 60,224,101, 83, 37, 55, 51,135,153, 12,147, 91,250,226,126,240,184,205,
- 46,238, 12,181,183,192, 82, 42,203,241, 72,149,112, 31, 72, 70,  8,145, 32,178,  6, 13,245,235,183,152,135,224,212,224,  6,120,
- 14,189,172,248,223, 14, 81,146, 72,131,179, 46,244,236, 33, 55,214, 66,247, 96,107,215, 99, 37, 72,228,  1, 29,  6,100,152, 64,
-149, 58, 31,195, 15,206,170,196,182, 94,241, 70,184, 75,175, 38,219, 89, 72,139,177,205,126,207,193, 41,173, 85, 90,113, 97, 92,
- 53, 91,253,222,221,175, 45,154, 24,242,192, 52,237,152,118,123,118,251, 11,198,221,  5,121, 28, 25,226, 96, 80, 69, 56,205, 51,
-243, 50,111,155,113,101,  3,208,148,186,122,212, 29, 96,163, 12, 57, 51, 78, 35,121, 28, 72, 41,123,213,159, 28, 92,116,106,141,
-211,233,232, 87, 71, 29, 80,147,146,227,134,172, 22, 15, 22, 10,203,101,105,174,152, 95,187, 80,237,172,117,190,242,225, 67,140,
-152, 18,165, 54,164,109,241,170, 61,160,197, 98,195, 95,115,145, 59,201, 46, 66,175,172,148, 51, 12,108,243,217,252, 82, 34, 48,
-233,249,198,175,189,152,233,242, 28,223,250,195, 62,246,117, 83,255, 87, 46,245,243,221, 75,201,202,  4, 63, 19,  5, 71,129, 59,
-156,  1, 76,242,198, 12, 98,110,193, 82,105,198,147, 38, 60, 70,120, 79,132,119, 70,225, 89,107,148, 71, 11,195, 23,111, 25,126,
-230,128,188, 83,225,245, 12, 31, 31,145, 31,220, 33, 63,234, 16, 18, 33, 49,204,202,238,212,216,151,198,132, 48,196, 60,163, 31,
- 56,100,114,  1,156,125,179, 33,159,136, 86,124,141, 56,210,187, 47, 35,247,223, 69,174, 12,230,209, 45, 72, 68,203,251,253,230,
-170,243,254,238,151,186, 65,202,119, 17,126,221,179, 42,171,251, 58,233, 74,210, 98, 62,  3, 40, 13,230,134, 92,171,119,  2,166,
-141, 47, 28, 12, 84,175, 34,171,248,  2,255, 90, 68,164, 30, 98, 54,222,249,186,199,182,109,  2,187,152,185,255,179,163,171, 74,
-123,158,108,109, 88,177,104,  9, 25,210,212, 83,148, 62,121,137,124,106,130,227,  9,246,159,241,159,243,228,239, 98,191,113,139,
-125,123,161, 30,150,149, 52,117,238,120, 92, 63,175, 93, 90,147,235,210, 46,163,187,  1,121,121, 68, 94, 25,124,179,121, 86,224,
-237,  5,110, 10,237,102,161, 61, 41, 62,131,169,103,172,136, 51,115, 65,143,162,238,247,110,183,143,244,255, 63, 70, 30,207,112,
-119, 34,191,182, 67, 62,177,115,161,226,131,  9,126,251,150,246,171, 79,104,151,177,226, 86,217,  4,101, 97,167,179,210,177,136,
-242, 33,210,130, 21, 91, 45, 21, 86,170,  7,128,156, 26,178,100, 63,117,222,175,200,197, 61,184,249,  5,200,247,124, 84, 33, 15,
-125,211,126,233, 75,240,172,161,143, 60,234, 83,  7,117,234, 94, 74, 17,131,217,103,174, 65,152, 27,206,218,159,189,101,177,248,
-109,227, 51,246,184, 40, 23,129, 88,220,  7,215,126, 58,123, 96, 36,136, 76,187, 51,219, 71,  7, 97, 92, 11,114, 23,216, 95, 59,
- 84,104,248,108,248, 51,139, 31,167,211,143,192,248, 27,200, 75,223,160,254,191, 23,200, 48,187, 78, 35, 88,219, 45,176,158,181,
-122, 44,101,179, 80,218,170,160,155, 51,115,157,123,150,230, 25,229, 69,148, 22,115,213,186,204,190, 32,191,176, 94,116,104,204,
- 26,195,186,130, 79,116,253,255,235,124,181, 15,160,243,132,236,246,174,204, 28, 28,120,211,230,217,171, 20, 51,218,233, 16,  7,
-136,  0,132, 12,227, 10,142, 89,169, 99,181,184,  2,190,206,104,168,143,181, 44,100, 53,134,120,196,114, 74,180,221,158,101,127,
-151, 50,236, 17, 49,210,241, 25,203,233,224,222,226,160,228,229,112, 95,244,228,184, 94, 89,245, 67, 73,141,153,105,194,153,239,
- 41,103, 76, 18,165,249, 38,222,191, 44,132, 80,158, 49,159,145,193,121,  0,222,  6,174,103, 78, 36,223, 32,139,102,170, 37, 74,
- 53, 74,153,177,148, 72,227, 30, 77,  3,182,156,188,136, 72, 66, 90,129, 53, 74, 21,165,116,109, 37,186,197,230,198,161,179,187,
- 77,232, 48,159,  8, 49,105, 43,124,198, 86, 97, 27,154,125,116,209, 59, 71, 42,171, 77, 81, 82, 38,143, 59,119, 72,212,176, 14,
- 70,229,173,154,221,186,184,230,  1,120,181,124,150,250,179,181,231,213, 19,208, 52, 90,253, 73, 93, 79,144,243, 72, 26, 38,210,
- 48,248,124,124,220, 49,140, 19,105, 24, 73, 99,142, 72, 84, 71,187,150,226, 85,170,  6,168,102, 41,133,101,153, 93, 68,215,  2,
- 69, 27,179,124, 81, 37,167,196, 48,100,118,211,196,126,191, 99, 26,167,240,148,103,  6, 85,246, 67,230, 42, 14,126, 39, 51,150,
-121,118,199,131,193, 24,223, 87,154,235,144,114,206, 62,235, 22, 88,150, 18, 35,158,179,248, 98,117,144, 12, 41,175, 89,242, 43,
-212,166, 99, 99,131,159,161,189,245, 30, 29, 64,108, 27, 21,244,103, 44,117,167,242,  0,  0, 32,  0, 73, 68, 65, 84,213,  2,117,
-107, 42,235,251,106,181,185, 11,228, 67, 91,249,134,131, 94,207,149, 31,218,208, 95, 76,107,243, 93, 63,253,153, 43,253,252,208,
- 23,224, 88,123,186,117,122,138,117,104,165,197,  1,163, 74,108, 20,209,221,142, 53, 45,120, 59,204,205, 71,179, 39,132, 15, 68,
-120,127, 16, 30, 39, 40,183,133,225, 75,183, 12, 63,115,139,188, 85,176,215, 18,242,137, 29,242,233,  9,249,236,  8,175, 15,  8,
-153, 52, 39,198,  5,  6, 19,  6,  2,152,159,226,166,235, 66,170,247, 64, 94, 85,120, 21,183,119,229, 63, 15,211,159,130,253, 23,
- 16,169,112,155, 92, 16,112,219, 98,134,221,251, 91,241,165,241, 97, 76, 93,201,206,166, 72,182, 13,170,237,192, 13,231,121,203,
- 24, 15,198, 40,200,133,183,234, 66,214,186, 17,184,150, 96,162,190, 26, 61,181, 67,164,222,116,224,204,201,182, 54,242,117,246,
-139,245, 43, 71,108,140, 14,193,114,150,252,165,226, 27, 78,206, 36,201,200, 39,247,200,247,141,112,123, 11,151,159,112,213,254,
-119,126, 17,190, 80,104, 79,139,183,164, 74, 91,  3, 95,186,152, 59, 53,208,125, 66,246, 25, 25, 18, 58, 37,116,151,209,171,  1,
- 94, 30,144,251,147,223,200,143, 11,188,183, 96, 55,133,118, 91,176,165, 98,179, 69, 71,218,182,112, 22,221,114,217,123,219,175,
-173,247,153,172,212,186,157,194,152,149,252,210,158,244,230,  5,124,108,231, 27,250, 85,194,254,238, 35,236,189, 35,118,135,149,
-173,105,241,160,117, 69,241,230,  1, 58,123, 72,122,128,117,243,246,153, 45,109,107,213, 47, 21, 57,178, 34, 25,185, 94, 96,119,
- 31,185,249, 85,168,223,138,159,251, 25,184,184,143,188,241,101,184, 56,109,145,149, 54,120, 59,113,136,154, 71, 53,108,111,178,
-126, 22,146,211,246, 16,213,232, 38,245,  3, 71,104, 31,188, 13, 63,120, 39,103, 12,233,255,160, 91,103,102, 12,147,127,207,181,
- 22,137, 74,221, 96,186, 15,251,143,195,248, 57,188,141, 16,237, 11,189,  2,249, 17,228,213,127,136,252,220,219,180,223,109,112,
-173,180,192,180,174, 95,173, 82,173,198,218,235,236,246, 30,149, 91, 99,173,232,183, 71,147,180, 85,233,  1,247, 96,157,120,111,
- 49,160,125,145,168, 56, 34,182,217, 89,115,176,123,107, 37,230, 59,226, 56, 89,157, 70,167,197,105,162,206, 39,150,195, 13,237,
-120,235, 18,148, 90, 87,242, 25,165, 56, 93,110,218,249,134, 88, 74, 55,139, 97,197,199,  0, 98, 37, 58,104, 11, 58, 31, 25, 78,
-183, 12,243,145,100,190,218,212, 52,178, 92,222,167, 93,222,117, 94,247,211,119, 93,113, 46,137, 66,168,219, 99, 39, 92, 44,180,
-198, 42,219,134,165, 94,241,246,251,214, 85,232,158,223, 62,147,125,182, 26, 85,108, 86,103,175,215,230,115, 39, 49,200,121,192,
-134,145,182, 44, 94,221,139, 31,120, 28,245,224, 64,155,138, 98,173, 80,170,183,115,251,136, 65, 74, 40,232, 37,226,118, 98, 86,
- 93, 16,138,157, 41,160,109,203, 68,239, 81,198, 26,213,121, 51,191,150,222, 86, 14,154,155,122, 26, 29,154,183, 16,144,110,241,
-138, 78,130,198,198, 43,195,206, 55, 44,156, 11,159,134,157,207,209,163,157,238,115,242,228,  7, 33, 81,114,192,170, 82,136,216,
- 28,  2,227,204,121, 37, 88,230,113,208,243, 42, 56,251,198, 57,100, 42, 49, 87, 47,133,218, 42,165, 86,230, 90, 88,230,197, 45,
-104,162,193,201, 55,150,226, 92,127,139,238, 76,206,153,253, 56,113,121,113,193,213,126,199,157,139, 43,246, 23, 23, 12,195,176,
-250,196,251, 60,125, 20,225,238,110,199,245,229, 53,170,202,220,169,137,205, 65, 49, 22, 68,193, 20,162, 58, 82, 98,110,141, 58,
-159, 34, 72, 65, 54, 34,167,186,242,190, 59,  3, 92,248, 23,234,253,200,117, 95,219,238, 18,136,220,222,129, 18, 65,114,246, 74,
-188, 91, 20,251,159,226,118, 73, 19,175,220, 91, 35, 14,155,124, 40,143,205,206, 82,128, 55, 91,160,125,207, 60,117, 17, 33,239,
- 98,156, 56,200, 22,171,106,103, 80,132,115,182,119, 23, 63,118, 10, 82, 87,102,250,201,116,203, 98, 55,131,178, 24, 79,178,219,
- 49, 14,  9,222, 25,132, 87,128, 55, 30,159,120,237,111,207, 92,253,226, 51,228,207,221,135,159,190,  3,175, 79,200, 43, 35,242,
-131, 23,216,151, 14,240,107, 39,244,173,147, 43,209, 91,219, 74,206,226,234,116,251,221, 19,252,140, 32,195, 53,188,121,132,246,
- 15, 64,254, 11,152,254, 83,120,237,191,132, 71,  2,143,  5,158,225, 27,247,  7,177,185,166, 51, 79,192,208, 23,164,216, 76, 52,
-193,212,223, 96, 72,187,171,108, 45,216,212,103,237, 81, 81,119,209, 66,238,161,212,234,149,247,189,104,179,222,148,168, 38,  3,
- 54,115,178,179,244,147, 80,161,127,115,113, 40,199, 33,178,119,147,111,192, 54, 24, 66, 70, 46, 61, 45, 78,158,102,184,138, 28,
-243, 19, 72,123,236,132,186,239,206,238,215, 95,249,173,177,209,196,124, 70, 76,220,  7,126,145,145, 49,123, 82,217, 20, 26,132,
-189,250, 76, 87,195, 61,240,180,248,193,227,118,139,219,148,157,211,191, 82, 85, 39,119,149,104,133,169,208, 74,216,107, 86,159,
-164,172, 33, 46,  3, 48, 52, 35, 93, 78,232,189, 17,238,143,174, 69,184, 84,127,157,127,126,192,174,252,100,104,183, 56,183,222,
-218, 89,160,119, 59,195, 38, 57, 60,197, 85,186,113,253, 59,119,186,198,134,110,230, 93,147,249,  8, 95,  7, 85,243, 95,226,211,
-111,195,229,235,112,251, 53, 56,124,205, 45, 99,211, 31,132, 87, 63,137,252,209,255, 29, 62,248, 26,246,206, 12,111, 41,242,141,
- 17,121, 63, 97, 83,245,174, 76, 87,174, 43,235,136,102,221,200, 70,159,169, 59, 96, 70,253,240,246,168,248, 38,158,178,131,137,
-242,128, 13, 33,154,188, 80, 23,163,132, 26,150,146,  2, 94,210, 47, 94,  8, 47,237,212,229,162,241,136, 86,176,163, 11,254, 46,
-255, 67,210,127,242, 87,208,191,120, 32,213,196, 40, 71, 74,243,  5,178,214, 74, 89, 91,168,189, 96,220, 62,155,174,135,104,125,
- 70,222,154,183,  9, 67,248, 70,108,128,125,230,222, 34, 73, 75,206, 89, 86,113,111,245,141,190, 43,117,155,177,250,163, 77,156,
-153, 46, 75, 13,155, 91,197,202,236,226,187,195, 77, 84,  1, 46,132, 19,240,107,212,231,144, 67, 14,255,122,129,121, 38, 81, 25,
-178,231, 42,139, 24,218,170,219,248,218, 66,187, 57, 80,110,158, 81,244,  3,218,229, 13,109,186,164, 45, 51,167,106,228,164,100,
-131,165,134,135,124,229, 26,133, 27, 94,212,157, 21,130,207,175,123,130, 92,  8,210, 82,245, 89,184,138,103,174,183,182, 97, 77,
-147,224,214,192,178,144, 38, 33,219, 66, 29, 47,105,211,222,187,114,209,102,117, 37,122, 60,134,121,240, 13, 69,220,219,159,  4,
-210,180,195,202,  5,237,246, 25,205, 36,114, 10, 88, 85,210,170,189, 94,136,145, 68, 92,243,214, 29, 57,193,215, 79,254,228,196,
- 97,162,219,177, 28,177,189, 30,158,204,231,197, 57, 43, 12,  3,229,120,242, 96,152, 60,162, 73,209, 97,231, 26,135,101,137,181,
- 41,252,222,177,193, 73,143,142, 13,103,148,158,121,169, 65,220, 62, 38, 25,203,254,134, 19,194,110,154,184,184,186,195,126,127,
-197, 48, 58,221,110, 46,133,121, 62, 80,230,197, 29, 40,213, 55,238, 82, 11,212,202, 48,122, 74, 27, 34, 92,239, 47, 92,209,222,
- 26, 57,132,127,217,220,218, 88,173,113, 44,149,185, 44,204,161,164,175,103,226,179,103,214,184, 61, 30,121,101, 89,184,184,186,
-230,122,183,135, 86, 93,103, 17,252,126, 75,  3,132, 35,185, 38, 63,124,154,181, 53,161, 78, 99, 12,164, 41,249,115, 82, 93,119,
-181,162, 93,123,122, 95,210,237, 58,197,103,219, 31, 58, 77,234,220,133, 16,120,246, 20,182, 85, 19,212,221,  2, 61, 32,160, 61,
- 95,165,219, 89, 31, 94,206,106, 77,249, 30,212,185, 30,101,107, 64,222,197,232,247, 58,109,137,107, 75,  4, 67,244, 10,227, 28,
- 53,186, 86,101,103, 48,133,174,101,234,248,108, 11,203, 83,111,235,151,234,133,115,201,240,120,167,124,215,224,227,143,142,188,
-250,191,125,151,221,207, 61,131,127,251,  1,242, 47, 95,193,103,118,200,199, 50,124,118,  7, 95,154,225, 75, 71,236,157,197,127,
- 64,178,213, 67,206, 50,195,111,131,253, 66, 66,228,  2,222,252,  6,240,215,192,254, 44,236, 94, 69, 94,122,132,189, 51,248,139,
-206,230, 11,235,108,225, 60, 59, 19, 11,204,192,253,120,130,250, 70,146,237,204,  4, 24, 87,114,136, 25,234, 62,218, 41,183,213,
-231,247,187,104, 89,156,226,110,191, 86, 87,227,167, 64,189,118, 27,214,210, 21,239,108, 20, 57, 12, 30, 53,184, 19,141,147, 18,
-100,161, 36,232,221,120,189, 18,191,198,189, 20,237,125, 54, 25,179, 29, 60,148,102, 62, 59,120,136, 99,101,  9,198, 52, 41, 56,
-234,125, 67, 31,146,243,199,199, 72,232,233,130,194, 83,  8,249,150,176,142, 20, 59,131, 52,132, 37,  1, 67,181,209,154,172, 26,
-168,185,196, 60,252, 44, 82, 50,197,121,105, 24,149,116,103, 68, 95,217,193, 75,131,111,232,151,  3,252,218, 99,236, 88,176, 87,
- 60,181,204,240,195,207,243,112,  6,123, 62,254,211,154, 39, 23, 21, 86,203,217,122, 56, 82,207,148,239,226,174,242,228, 22,253,
-226, 66,122, 82,253, 52,252,153,111, 34,119,222,132,229,101,152,191,230,134,247,203, 63,  7,247,254, 26,220,249, 10,242,218,207,
-193,247,255, 18,246,214, 35,248,173,140,124,125, 66,134,138,105,133, 99,243,101,179,143, 88, 74, 31, 67,232,230,107,151,230, 29,
-154, 67,129, 71, 10,227,  9,155, 60,241, 78,134, 12,187,132, 93, 21,223,212,159, 84,184,109,200,208,182, 78, 91, 98,227,235,150,
-199, 96,203, 11,105, 13,115,196,178,254,113,228,135,255, 40,195, 79,254, 61,236,151, 43,246, 96, 38, 91, 69,205, 34,158,181, 55,
- 58,252,126,232,173,247,149, 35,212,206, 44, 49,171,210,189,167,188,245, 25,185,157, 97, 10,122,230,180,174,179, 57, 43,178,206,
- 94,237, 44,131,180,245,138,208, 34,235, 92,195,166, 20,203,127, 19, 79, 22, 19, 18,114, 50,100,183, 71,247,151,209,190,116, 53,
-183,180, 68,109, 93, 80,229,135, 42,173,174,117,113,123, 96, 97,152, 38,114, 30, 56,156, 78,148, 22,175,187,156, 60, 33,110, 62,
- 49,179,101,235,182, 88,  9,251, 28,189,  4,146,182,231,208,247,181,174,153,172,169,126,162,234,209,197,  2,201, 26, 85,101, 93,
-204,106,168,164, 77,204, 55,245,189,231,127, 55, 77,232,254,138,122,186,245,116, 51,245,113, 14,106,171,173,170, 58, 38, 49,174,
-171,162,163,251,234,151,186, 56,194, 87,220, 35,223,219,228,106,222,250,245,243, 86,195, 66, 32,216, 66, 67,144,194,190, 37,227,
- 64,139,170,150,134, 83,212,210, 16,202,244, 77, 96,103, 64,  9,250, 89,218,237,169,203,236, 27,126, 40,214,117, 24,124,180, 16,
- 29, 31,143,203,141, 20,184,206,246, 23, 11,209,156,174,161, 36, 52,243, 90,104, 55,177,155,246, 30,204, 50, 12,140,195,158,113,
-116,229,187,207,195, 43, 41,121,107, 92, 46,  4, 21,111, 99,247,124,123,107,109, 85,204,215, 86, 41,167, 35,135,249,200,241,112,
-160,212,194, 82, 27,183,117, 97, 57, 45,156,150,194,113,153, 61,223,188,235, 46, 82, 90,215,141, 90,141,199,225,  6,185, 79,176,
- 57, 98, 32, 89,227, 57, 81, 51,146, 10, 69,149,219,211,137,122, 58,173,150, 53, 86, 93,151, 67,110, 90,140,  1,178,248,207,106,
- 34, 52, 43,126,222, 34, 57,198, 59, 90,239, 62,194,243,142, 67, 19,241, 17, 66,117,251,232,234,227, 23,239,152, 52,129,186, 20,
-111,191,159, 19, 45, 95, 88,  6,251,120,126,  3, 87,109, 40, 17,125,190, 81,191,118,119,254,127,190,222, 52,214,178,236,186,239,
-251,173,189,247, 57,231,222, 55,213,171,170,174,158,216,221,108,138, 83,115,146,168,209,177,100, 89,146, 37,197,178, 29,197,145,
-129,216,138,157,216,136,157,  1, 65,226,  0, 14,  2, 88,249, 96, 68, 64,  2,196,  8,224, 15, 73,156,192,  8,144, 15,129, 97,  4,
-  6,236,  0, 65,  2,120, 72, 96, 73,182, 18, 75, 20, 69,154, 17, 73, 73, 20,155,100,119,147, 61,212,208, 85,245,166,123,207, 57,
-123,239,149, 15,107,237,115,239,171,110, 69, 68,161,212, 53,188,186,239, 14,123,237,181,214,255,255,251,167, 35,191,137,173, 61,
-133,237,202,111,152, 33,236,216, 28, 53,236,246,169, 45,254,187, 21,244,160,242, 30,194,221,222,170,141,236, 77, 72,242,127,122,
-204,112, 63,193,246, 32,240,184, 86, 94,120,237,156, 27,255,205, 68,252,220,  9,252,165, 91,200,135, 14,224,149,132,220, 73,232,
- 11, 61,242,219, 91, 99,162, 63,158,124,198,111,222, 64,173, 21,121, 99, 68, 63, 23, 16, 89,193,139,223,128,252, 63,129, 28,161,
-  7, 29,242,148,152,130, 28,239,218, 46,170,101, 89, 87,143, 69,109,163,135, 18,140,252,246,216, 11, 91,  8, 54,179,110, 87,163,
-236,114,201,149,255,104,106,199,177, 94, 59,240, 88, 39,184,105,163, 81, 88, 91,215, 85,196, 45,  4, 94,164,178,238, 82,111,198,
-  2,111,204,232, 74, 17,141,104,170, 72, 49,208, 13,151,190,243, 47,102,133, 66,131, 25,250,131, 26, 63, 93, 86,118,216,135,118,
-  9, 49, 47,187,204,141,151,229,157,213, 96,221,184, 56, 62, 87,162,237, 88,164,119, 81,215,186,119,241, 96,195,214,178, 87,172,
-236, 96,146, 10,218,249, 27,161,  4, 36,215,157,150,176,238, 38,230, 13,  1,156, 68,232,181, 18, 14,  7,226,157,  1,158,233,225,
-180, 67,142, 59,160, 71,127,115,131,174,212,146,242, 54,234,194, 64,189,134, 71, 92,222,224, 98,124,  0,205, 78,210,217,223, 15,
-  6,183,149,197, 86, 24,119,187,191,122,150,209, 47,103,210,168,200,168,240,201,175,155,211, 64, 63, 12,249,117, 24,255, 55, 24,
-254,  2, 12, 63,  1,235, 63,  2,135,223, 70,142,255, 22,220,249,101,244,185,  9, 94, 93, 33,119, 19, 28,102, 36,251,165, 86,252,
-125,180, 47, 48,104,170,210,226,239,145,171,  2,143,130,177, 10,158,  1, 14,  6,  8,  3, 50,140,112,176, 69, 15, 20, 30, 72,203,
- 38,222,165,176,180,208,238,114, 14,229, 93,  3,208, 44,146,181, 10,108,204,187, 62,252,123,196,191,242,  5,226,159,126,157, 58,
- 87,146, 15,203,219,190,184,  5, 88,  4,175,230,139,238,176, 54,238,182,117,224,198,238, 94, 64,  3, 86,104,252,146,164,101,255,
- 58, 21, 44,105,177,134, 93,112,205,123, 90,  8, 19,  7,225,163,204,230, 55,110,235, 20,233,250,101,212,172,126,139,208,121, 50,
-  2,155, 19,194, 90,140, 40, 49, 17,242, 12, 49, 17, 17,162,203,123,141, 85, 63, 32,125,  2,157,169, 18,152,165,177, 36, 20, 26,
- 16, 36, 27, 54, 39, 55, 22,182,152,136, 45,171, 90,170,236,146, 90, 86,119, 35, 13,217,155, 68,106,243,222, 23, 75,159,172,187,
-125,115,222, 11, 53, 72, 40, 50,110,161, 27,168,146,168, 41,248, 74,163, 32, 90,156,109,212, 65, 23,173, 43,140, 62,161,153,183,
-148,188,133, 20, 73,135, 71,212,203,  3,242, 52,210, 48, 36,133,157,106, 58,180,124,242, 69, 40,170,139, 82, 63,184, 67, 64, 83,
- 71,154, 38,138,231, 21,104,205,198,121, 71,108,180,238,123, 91,139, 10, 53,225, 90,183, 58,160, 14, 86,216, 77,156, 85, 81,  2,
- 49, 25, 17, 79,203, 68, 41,211,226, 66,210,101,167,237, 78,128, 16,136, 62,114, 79, 33, 48,116, 43, 14, 86,135,172,214,  7,196,
-126, 69, 13,129,237,102,195,102,115,225,152,105,235,128,231, 82,152,199,201,128, 46,174,251, 88, 38, 72,142,121, 77,253,  0, 40,
-185, 20,174,166,145,203,237,150,121,154,188,129, 44,174,132, 55, 54,123,  8, 98, 93,188, 35,146, 91,231, 95,181,146,181,114, 57,
-207,232,249, 25, 67,191,162,247,203,130,230,236,169,149,246,190,222, 76, 19,211,118,227,151,131,157,106,209,226, 14,170, 43,213,
-237,226, 32,177,  3,137,206,121,119, 61,149,191, 33,154,  0, 79,124, 66, 82,197,196,133,185,228, 37, 15,222,240,186, 45,187,222,
-109,132, 45,150,245,125,218, 25,145, 61,182,140, 62,185, 71,223,173, 36,117, 95,141,215, 52,226,127,241,118,248,197,222,155,206,
- 27,205,214,237, 63,119,190,103, 95,  5,225,160,179,198,238, 56,152,253,250, 56, 90,243,181,142,112, 16,133,195,100,117,226, 32,
-218,143,195,  8,171, 40, 12,254,223,107,223,219, 55,238,113,242, 74,176, 29,  2,181, 20,134,111,108,137,159, 31, 97,165,200,179,
-214,221,201,157,136,220, 73,230, 73,143,193,124,201, 77,217,158, 92, 36, 60, 41,140,130, 28,174,237,  1,220,243,241,230,224, 55,
-203,236,114,253, 73, 29,106,162,230, 77,238,217,  9,  8, 86, 46,126,203, 45,227,124,127,215,238,136,211, 33, 58,248,220, 31, 67,
-113,222,250,198, 23,110,119, 34,220,153,225,224, 19,118,147,185,120,199, 70, 19,155, 98, 35,237,185,122, 78,173,251,234, 31, 84,
-248,173, 43,247, 59, 59,248,166,136, 83,193,220,131,125, 96,  2,183, 22, 12, 35, 31, 76,118, 64, 28,253,176,237,194,222,253, 42,
-188,169,230,229, 47,238,185, 79,150,  8, 22,134, 72, 56,244,231, 45,  6,187,177,118, 22, 79, 40,125,  7, 79,155,165,141,  8,250,
-184,192,187,179, 41,224,231, 74,157,219,242,213, 71,128, 77,189,227, 83,130,134,116,222,239,174,155,136,103, 85,148,190,139,164,
- 91,  7,196, 15, 31,192,203,135,112,123,141, 28,245,232,197,136,254,189,251,212,131, 98, 23,133,209,169,107,237,192,220, 27,117,
- 94,203, 87,204, 38, 30,212,201, 46, 62,173,160,154,127,121, 95, 65,130,233, 10,170,123,168, 47, 50,225, 93, 19, 37,202,201, 67,
- 56, 56,132,238,251, 33,127, 27,194, 59,102,119, 11,167,102, 15, 28,126, 20,214, 47, 33, 39, 95, 65, 78, 31,217, 40,125,238,161,
- 70,179,167,197,125,225, 91,243,195,202,110, 60,209,148, 44,201, 63, 96,157, 24,112, 38,221,  4,185,233, 69, 73,145,131,209, 19,
- 73,124,247, 63, 84, 11,173,233,143,161, 95,193,240, 65, 72,207, 63,129,139,242, 23,150,  3, 56,250, 14,124,241, 43,212, 87, 11,
-249, 16,143,253, 12,168, 54,  5, 47,139,125,107,153,236, 47,157,181,175,255, 61,222, 17,207,239,110,179,150,214,181, 46,123,  7,
- 15, 98,146, 39,149,184,178, 99, 86,171, 23,231,230, 51,103,112, 43, 90,234, 80,209, 37, 97,203, 91, 50, 40,  5,209,106,201,105,
- 93,111,190, 72, 88,124,236, 34, 66,208, 74, 71, 49,113,110, 74,212,213, 26,141,145,213,188, 33,205, 35,147, 86, 70,215, 12, 16,
- 34,181,239,109,168, 85,139,137,144, 22,157,135,238, 69, 64,251,250,202,127, 95, 61,254,115,  1,159,248,143,234,  2, 41,252,174,
- 91,252,207,238, 44,157, 66, 23,133, 78,109,237, 49, 13, 71,148,126,133,110, 47,108,119,234,164,178, 44,145,178, 58,180,206,110,
-158,172,  3, 23, 39,211,149, 76,208, 66,153, 38,234, 60, 46,232,224, 90,118,105,124,237,158, 43,169,167, 59,190, 97,123,227, 24,
-136,195,  1, 49,173,252,207, 91,218,158,150, 22, 78,227,128,152,108,238,130,176, 90,219,172,100, 79,165, 93,242,108,246,170, 82,
- 40,243,108, 99,230,176,147,214,198,152,232,250,129,174, 27,124,117, 80, 22,183, 71,  8,145,224,222,243, 24,205,150, 86, 69, 24,
-231,145,205,213, 21,211,184,101,154, 38,174, 54,151,108,175,174,200, 57,147, 75,113,146,163, 41,216, 55,211,150,205,118,203,229,
-246,138,203,171, 43, 46,175, 46,217,110,174,152,166,201, 64, 49,202,210,157,183, 66,142, 86, 82,  8,116, 33,209,167,142, 62, 37,
- 82, 76,214, 13,151,194,156,231,101, 28, 63,207, 51, 37,151,229,  8,169,236,160, 57,205,110, 55, 22,229,114,220,144,199,173, 93,
- 60,119, 35, 44,227, 39, 56, 71, 95, 80, 87,218, 71, 82,138, 22, 21, 92,170,133,148,185, 82, 56,136,113,249, 13,211,236, 78,136,
- 70,203,203,101,153,208,180,244, 76,117,171,158, 77, 26,174,227, 96,159,236,212,245,189,107,246,107,190, 98,217,151,197,203,242,
- 93, 16,255,243, 59,225, 23,111,154,  8,151,155, 17, 78,147,193,203, 14, 35, 28,138,112,146,132, 67, 47,228, 71, 94,172,111,138,
- 89,155, 79, 19,220,140,194, 13, 81,110,  6,225,166, 23,251,  3,129,195, 78, 56,242,191,119,226,100,208,163, 32, 28,251,215, 89,
- 11, 68, 21, 52,194,220, 25,250, 49, 61, 24, 73, 95, 24,145,  7,213,148,222,183, 58,235,242, 78,  3,226,183,  6,233,  3, 82, 93,
-100,148, 60,145,103,170,214,204,156, 56,140,230, 65,177, 98,125,224,158, 98,215, 28, 33,193,  2, 95,218, 51,181,114, 43, 82,181,
-219,138,156, 36,235,162,219, 62, 33, 25,151,124,241,157,172, 45,231, 91,146,  5,142,144, 61,201,173, 11,240, 82,134,155,199, 48,
-252, 25,200,223,132, 71,111,193,148,118, 49,171, 13, 17,218,251,205,232,205, 12,247,178,239,241, 13, 74,163, 23,197,206,210,228,
-233, 97, 67,180,164,176, 24,225, 56, 33, 47, 70,232, 19, 28,253, 56,164, 27,144,255, 57,188,173,112,102,197, 24,245,136, 79, 87,
-186,139,135,  8, 72, 12,222,169, 59,212,225, 56, 33, 79, 15,112,210, 27, 28,231,172,192,121,182,201,198, 84,157,128,183, 19,164,
- 45, 69, 87, 91,119,110, 51,202, 93, 14,180,233,161,251,  2,131,  8,233,104, 69,122,238, 16,249,248, 17,124, 96,141, 28,251,173,
-238,119,206,209,207, 93,160, 79, 97, 56,220,217,247,231,181,197,121, 94, 55,189,139, 91,108,150,124,157, 22, 48, 83, 93,206, 85,
-119,111,228,  5,  6,212,216,  1,222, 92,242,104, 38, 60,  0,142, 58,228,232,109, 99,254,167, 31,135,250, 16,226,100,182,177, 86,
-153,187, 87, 96,245,227,112,248,  0,185,245, 38,156,108,160,116, 22, 74,144, 89,132, 80, 75, 76,107,116,197,119,191,199,110,108,
-147,131,212, 18,230, 58,  8,183,205,190, 17,123,235, 80,135,140,244,217, 61,235,216,133,177, 59,130,110,  5,195,211, 14,160, 89,
-177, 43, 71, 13,103,153,128,137,240,202, 23,169,127,239,  2, 68,153, 58,216, 22, 37,231,189,227,161, 41,213, 69,118, 81,157,117,
- 15, 64,179,103, 23, 84,127,238,100,113,180,200,242,163,186,149,170,250,239, 87, 31,165, 47,250,130, 16,  9,195,129, 89,214, 66,
-112, 20,164,169,174,233,  7,131,157,148,130,150,217,241,179,182,127,143, 82,  9, 53,155,211, 36, 36,180, 89,175,180, 90,200, 71,
-  8,  4,170, 81, 16,187,206, 10,216,118, 67, 87, 38,227, 86, 72, 96, 86,203, 48, 87,100, 73,166, 83,183, 36,105,240,236,117,143,
-134, 85,215, 18, 52, 14, 56, 18, 60,216,200, 99,112, 99,220,123,238,100,249,251, 69,219,243, 39,110, 85, 82,162,  8,131,199, 73,
-231,156, 25, 75,133,131, 19, 83,204, 95, 89, 97, 47, 18,208,216, 81,250,  3,202,184,161,110, 46, 97, 30,237,217,237,122,215, 20,
-  4,106,158,168,121, 90, 70,228,138,236,249,211,237, 53,144,110,205,193,211, 31,176,206,188,186,112,102,222, 82,167, 43,211, 31,
-136, 88,  0,145,234,210,208, 53,156,106,138, 61,253,193,145, 41,235,115,166,230,108,232, 94, 39,173,229, 82, 28, 70, 99,192,151,
-216, 15, 38, 32, 75,201, 98,107, 83,231,224, 20, 99,206,235, 94,241, 43,165, 48,151,204, 52,141,204,211,200, 56,141,204,211, 68,
-158, 70,166,217, 66, 89,230,105,164, 56, 69,174,204,217, 19,208,236,185, 79, 18,233,146,137,241, 66, 48, 21,122, 20, 33,245, 38,
- 90, 77,238,139, 15, 41, 44,208,180,  6,189,156,107, 49, 50, 93, 41, 75, 81,175,217, 93,  7,213, 47,142, 14,161, 81,  9, 76,181,
-178,205,153, 49,207,108,166,153,237,118,187,236,209,171,238,101,211,187,131,160,221,224,130,236, 10,122,236,122, 95,123,151,101,
-204, 30, 84,233,162, 65,118, 26, 73,177,233,  4,170, 95, 94, 85,246,  4,114,109,240,187, 60,222,221,100,242, 73, 52,236, 34,146,
-171,187,226,189, 68,220,182,232,229,253,247,137,236, 46, 39,241,191,190, 19,127,241, 84,132, 91, 65,184,145,132, 27, 81,184,161,
-194, 77, 17,110,181,  2,142, 21,239,155, 34,156,138,112, 28,132, 35,  9,156,136,253,249,211, 40,156,248,143, 27, 34,220, 12,194,
-173,160,246,251,190,102,190, 33,112, 67,132,227,160,220,  8,194,113,216,  1,213,140,178, 41,148,  1,226,148,137, 95,159,224, 27,
-  5, 94,232,144,219,201,110, 10,199,130,156,116, 54, 66, 56,114,176, 75,136, 59,131,125, 21,184,172,200, 41,200,179,157,177,194,
- 69,224, 72,118,144,152, 82,173,128,175,147,  7,131,  0,135,178,120,205,165, 19,228, 48,186,156, 95, 97, 37, 59,210,216, 81, 66,
- 78,124,124, 17,131,237,161,213, 59,245, 65,224,197,140,156,126, 22, 89,253, 44,242,248,239,194,197, 37,140,221,174,168,171, 35,
- 97,215,174,136,126,148,225,162,216,147,208,177,131,225, 68, 89,  8, 68,168, 88,182,252, 42,217,  4,227,165,100,249,219,167, 63,
-101,221,156,254, 51,228,193,  5,220,139, 59,118,112, 47, 72,151,172,240,184, 13,164,185,  7,108,167,110, 62,122,121,186,223,  5,
-171, 60,202, 38, 96, 27, 11, 58,249,  5, 33,239,167, 80,248,162,209, 79,140,150, 77,220,  0,  8,226,  8,210, 65,148,238,160, 39,
- 61,117, 72,120,229,  8, 62, 50,216, 52, 96, 56,178,231,254,239,223, 55,246,247,145,160,219,106, 41,108,121,159,176,180,211,139,
- 44,163, 57,159,206,150,186,119,107, 13,123,150, 77,109,246, 50, 53,222,115,221,203,155, 13, 30,206,114,127, 34, 60,  4, 86, 61,
- 12,111, 34,235,119, 32,126, 55,212, 43,143,179,187,237, 95, 45,219,255, 63,252, 33, 88,125, 10, 57,120,  3,185,121,215, 46,  2,
- 87,157,173,183,147,236,192, 70, 14,147,129,189, 46,190,129,133,122,123, 82,100,141, 41,216, 99, 15, 97,101,164,184,120,  8, 73,
-145,222, 98,129,  9,  3,244,  7, 16, 87, 48, 28, 67,250,128,253,157,107,218,  2,247, 36, 79,111,193,209,111, 35, 95,191, 79,249,
-221,145,121,112,190,145,238,128, 36,236, 29, 21,212,150, 70,119,253,247,218, 33,138, 91,122, 26, 72,  6,177,241, 98, 89,146,182,
-118,133,254,122,244,227,206,  6, 69, 72,  4,228,154,207,177, 22, 71,226, 36,231, 60,212,217, 70,172, 49,144,162,137,138, 52,103,
- 52,207,158,189, 29,237,206, 27,  3, 93,223,155,245, 43,  8,186,189,162,142,219,  5,120,147,124, 74, 98,247,116,211, 91,  4,137,
-164, 97, 77, 23, 45, 37,209,194,140,124,255,233,223,131,132,214,169, 57,124, 38,  8, 93,136,212,152,124, 48,221, 14,210, 93,215,
-190,140,228,155,207,216,  1, 47, 93,216,109,211,230,121,178,143,199,241,169,133,128,108,174,204,174,213,173, 44, 58,116,220, 88,
- 86, 65,240, 56, 87, 47, 34, 50,172, 44,154, 51,103,167,218,201, 53,  4,171, 29,105, 70,166, 43,243, 76, 25,175, 80,223,193,147,
-199,165,  3,148, 16,150, 53,138,236,  3,107, 28,116, 19, 82, 79,119,116,195,116, 14,101, 38,196,222,117,  1,  6,117, 73,195,138,
-180, 90,145,134,181,105,104,124, 25,111, 96, 23,118,113,161, 13,110,227,220,244,170, 74, 45,  6,137,209,236,222,110,  7,238,228,
- 82, 40,217,252,248,165,100,114,206, 76,243,188,216,215,218,153, 81, 29,  8, 99,124,126, 27, 77,167, 96,231,111,110,169,125,222,
-249,182,110,124,204, 51,227, 52, 89, 71, 94,118,226,196,234, 86,228, 20,157,104, 23, 77, 15, 80,114, 89, 32, 54,165,148, 37, 63,
- 93,247,114,214,245,218, 85, 87,174, 43,201,163,197,176,106,136,212,146, 45,118, 53, 38, 15,225, 17, 98,215,163, 18,252,235, 22,
-114,245,201,212, 94,224, 13,206,101, 48,158,193, 76,157,235,222, 68,189, 94, 19,199,237, 79,195, 68,127, 63,149, 81, 43,123,118,
-  6, 73,104,186, 24,239, 29,251, 79, 30,152,  7, 77,217,121,216,102,167,159, 53,207, 48,251, 65, 38,114,109, 62, 32,253,254, 94,
-211,131,145,197,119,180,163,171,132,155,168, 38, 58, 45, 44,251, 97, 27,236,133,213, 89,169,157,223, 66,214, 66,221,100,228,139,
-143,224,191,154,225, 47,220, 66,254,240,177, 33, 97,  7,133, 67,224,169,104, 66,184,135,197, 84,199,147,119, 15,231, 25,190, 22,
-224,149, 98,130,187,251, 62,114,251, 64,135, 36, 31, 45, 94, 84,168,131,181, 46,219,201,  8,115, 39, 17,201,106, 98,166, 67, 69,
-142, 48,232,204, 70,119,123,143,149,223,167,170, 63,  7,226,  2,184, 22, 18,127, 80, 33,125,175,221,156,198,  7,150,167,222,210,
-223,148,107,163, 91, 83,  1, 71, 99,135,215,138,110,117, 71,191,155,247,148,136, 45, 29, 76,124, 49, 90, 35,172,110, 66,247, 12,
-132, 19,179, 64, 61,245,142, 89, 80, 82,132, 97,199, 95, 94, 72, 80,109, 15, 93,188, 24,117,238,161, 79,113, 39,228,203,117, 39,
-146,208,253, 24,198, 22,251, 19,216, 95,130,  5, 44,144, 33,  4, 33, 36, 11,191,137,170,164,190, 35,157,172,136, 47,174,225,101,
-115, 52,208,221, 54,238,247, 91, 15,209,239,204,232, 45, 65, 71, 19,144,180,128, 24,221, 11,209,104,133, 92, 60, 80,164, 77,109,
-117, 47,171,189, 61,198,208,132,143, 51,232,176,255, 24, 29, 48,164,230,  9, 45,  2,242,230, 21,233,171, 29,178, 93,163, 31,125,
- 21,158,191, 11,235, 15, 33,250,174,189,118,253, 39,140,214,167, 87, 38, 76, 91,253, 40,244,159,132,245,223, 71, 14,255, 54,122,
-120,  1,191, 51,192,  3,236,144,238,195, 46,212,103,  9,175,247,238, 61, 99, 26,141,195,100,236,239,244, 16,120,193,200,134,210,
- 65, 60,242,194,254, 16,210,185,249, 99,131,123,211,235,  5,212, 71,182, 87,151, 97,175, 91,247, 99, 64, 11,100,  8, 63,127, 72,
-252,229, 13,105,206,196,110,119, 20,233,158, 14,212,198,237, 74,173,114,141, 36, 29, 68, 40,209,215, 40,190, 83, 39,154,152, 76,
-179,119,244,126,200, 62, 89,204,131, 23,155,165,132,148,226,182,210, 72, 12,214, 41,217, 97,157,169,115,203,185,174,206,156, 80,
- 58, 17,122,183,245, 77,185, 50,215,153,176, 61, 35, 72, 37, 29, 28, 17,125,228, 91, 83,164, 22, 23,220,249, 90, 96,235,145,157,
-157,216, 99, 78,193, 53,156,243,134, 88, 86,196,131,  3,122, 81,174,198,137,169,218,254,217,238,228,118, 27, 45,197, 82,216, 66,
-234,232, 67,187,187,203,254,179,187,244, 66,230, 79,111,197,166, 45, 43,141, 62, 86, 66, 37,138,135,233,  0,243,197, 35,106,234,
-137,167, 79,219,101,102,187,177,254,161, 78, 54, 98,245,203, 79, 93,220, 47,198,215,151,217, 50,231,107,176,125,108,197, 56,244,
-193,149,250,241,224,152,154,  6, 74,158, 60, 44,199,188,212, 17,167,172,  9,  6,100,145,184,216,175,180, 88,167,106,159,155,194,
-120,113,198, 60,207,196, 97, 77, 90, 31,218,216, 55,171,137,230,250,129,126,117,176,187, 84,227,246,171, 82,150, 85,129, 21,144,
-232,199,126, 94, 70,241,210, 80,177,218,108,184, 97,185, 76, 52,116,176, 74, 52, 77, 78,132, 92, 11,185, 88, 81, 22,  7,235,104,
-131,185, 52,139, 30,182, 30, 72, 41,121, 76,105,  3,162,  5,136,145,226,150, 56,234,142,159,174,150, 22, 99,174,  1, 17, 59,  7,
-125, 18,177, 80, 21,231,226,217,231,181,129,138, 23,172,181,190, 39, 14,165, 57, 29,204, 19, 31,251,100,152,223, 50,123,170, 95,
- 90,244,173,209, 53, 36, 54, 41, 48,232, 78,241,238, 95,170, 46,132,199,224,177,191,213, 59,120,125, 34, 39, 93,246, 69,114,123,
- 72, 14,105, 19,199,186, 19,165,202, 19, 64, 26, 89,106, 11, 11,214, 54,201,159, 57,177,110,115,220,139, 20, 93,137, 21,250,141,
- 31, 18, 90, 77, 53,221, 36,237,121,207,163,122,225, 75,171,196, 78, 16,134,141,175,245,202, 35, 12, 54,190,223, 86,179, 76,233,
-214, 47,  2,213, 18,184,100,178, 81,172,122,166, 57, 43,207, 54,127,115,131,254,183,247,  8,175,101, 83,200, 63,213, 33,183, 65,
-215, 30, 16,114, 50,195, 73,183,228,142,147,  3,122, 89,145,111,122, 36,233,211,130,156,217,139,172,207,116, 72, 23,208,251, 46,
- 68,219,244, 22, 94,178,  5,142,246,118,229,163, 35,244,214,193, 46, 17,217,121,238,115,113,161,158,238,102, 65, 67,176,231,237,
-150,194,193,128,198, 15, 34,245,109,184, 58,131,122,219,139,190,143,132, 27,  6, 23, 39,179,156,  4,184,  8,240,184,192,153,137,
-176,164, 19,116,242,240,152,214,237,225,143,233,184, 21,216, 59, 86, 20,100,101, 86,167,147,223,116,113, 94,178,137,196,204, 46,
- 12,102, 73, 23,245,199, 58,196, 29,206, 52,237, 21,160, 73,159, 72,103,107,170,217,230,121,119, 92,107,139, 10, 20, 33,184,238,
- 64, 92, 69, 25,250, 72, 58, 93, 17,159, 61,130, 87,  6,228,165,  8,235, 15, 64,125, 26,228, 53,248,173,115,203,157, 63,  4,222,
-245,203,157,243, 41,155,245, 72, 91,198,124,221,249, 51,117,190, 94,208,  5, 22,101,175,202,206,113,193,182, 58,132,123,239, 55,
-240,139, 87, 18, 74,202,132,199, 91,226,183,129,199, 43,248,224,  4, 47,126, 25,189,249, 59, 48,254, 26,114,244, 39, 97,253,199,
- 32,158, 88, 60,169, 94, 66,184,  9, 71,127, 17,186, 87,144,244,215,209,195,239,192,239, 14,112,127,176,149, 79, 44, 11,186,150,
-196,226,148, 88, 46, 97,231, 21,189, 81,144,254, 49,164,167,108,127,207,104,157,121,124, 10,234,202, 46,103,245,204,247, 26,226,
-223,240,  6,123, 99, 14, 79, 44,211,170,253,250, 56,195, 83,145,248,177,  3,210,171,103,244,201, 18,134,213,231,114, 82,119,130,
-250, 39,243, 32,116,145, 70,136,167,129,217, 68, 65, 85,144,234,130,187, 54,134,220, 27,  9,239,168,113, 78,224,171, 24, 19,188,
- 78,132, 96,192,150,230,199, 93, 40,122,154, 45, 67, 61,103, 98,201, 36, 81,151,175,236, 44,156,166, 31,153,  8, 87,103,132, 58,
- 65, 50,159,180,122,196,102,238,214,150,125, 93,205, 67,158, 75, 38,186, 20, 38,137,144,162, 26,110,118,123, 70, 92,245,200,250,
-144,174, 86,166,113,166, 54, 50,100,234,118, 97, 55, 77,229,222,  5, 27, 89,186,137,191,168,137,201,  8,182, 34, 48,124,194,110,
-130,212, 46,218, 53,154,143,220, 38, 31,142,116, 85,200,103,247,  9,177,167,123,250, 37,242,249, 67,202,217, 67,148,108,154,133,
-234,207,111,232,150, 52,178,178,185,128,209, 32, 66,161, 52,159,115, 52,145,149, 22,232,215,132,213,161,141,137,125,124,173,101,
-182,243,187, 27,136,221,218,244,  6,181, 82,242, 68,215,173,145,126, 32, 76, 35,108, 54,104,193,161, 65, 48, 95,156, 17, 54, 23,
-172,110,220, 54,130, 95, 81,194, 48, 16, 98,103,220,113, 79, 62, 83,137,246,245,102,139, 63,221, 23,233,181, 98,109,  2,200,226,
- 52,205,176,211,146,180, 34, 89, 91,130, 90,112,253,231, 46, 66, 85,171,248,200, 91, 22,187,100,241, 14,187,122,163,176, 29, 71,
-250,156,145,148, 22,174, 65,206,230,175,111, 48, 23, 80,139,115, 14,201,199,247, 38,218, 83, 17,230,106,239,145,154,235, 66,133,
-171,194, 46,231,221,171,165, 44,  4,204,157,243, 38, 56,130, 51, 58,122, 86, 82, 52,151, 68,153, 13, 78,228,211, 35, 99,152, 88,
- 64,203, 92,173,251,183,132,188,253,108,  3, 22,170, 94, 65,204,233, 80,202,110,229,245,196, 39,243,189, 81, 46,215,241,219,242,
-158, 92, 23,217,233, 85,155,191,222,247,234, 73, 62, 59,236,172, 83,165,  9,127,194,174, 61,178,100, 69, 36,121,128, 69,183,231,
-101,155,177, 78,119, 18,244, 74,204,198,213,174, 18, 91,255,199,139, 23,154,217,113, 86, 37,152,192,172,197,164, 94,250,210,160,
-169,211,139,154,  4,255,188,160, 15, 43,220,155,169,255,203,187,132,111, 21,248,143,111, 27,176,230,164, 64, 15,122,146,224,150,
- 34,103,201, 46, 23,219,178,  3,204,188,153, 65, 18,114, 71,208, 53,200,198,119,232,235,136, 62,  2, 30,  7,163, 94,181, 66,222,
-169,  9,216,130,139,212, 98, 48, 15, 58,109, 58,225, 62,161,150,  6, 82,176,139,196, 36,214,233,197, 53,196, 59,232,230,171,246,
-248,115, 52,160, 70, 51,242, 39,150,132, 46, 14,125, 10,208,205,240,182, 47,140,  7, 31, 17,174, 89,248,174, 18,247,140,255,205,
- 62, 21, 79,119,163,216,244,156,141,243, 79,  4, 25, 13, 93,107,118, 20,221, 19,147,  7, 15,219,136, 86,220,163, 91,243,146,123,
-190,103, 87,110,203,245,162,126,237,255, 74,176, 76, 97,143, 99,107,158, 72,131, 93,  8, 66, 36, 30, 13,164,103, 14,225,123,123,
-248,184,192,141, 15,129,188,  2,221, 21, 92,158,195,151, 71, 56,182,168,220,154,125,158,190, 23, 62, 99,159,109,185,142,209,175,
-215,169,177,251,221,232,190,182,206,132, 43, 62, 97,122, 82,120, 18,247, 72,116,165,160,219,217, 82,222, 30, 38,120, 45,194,119,
-101,120,225, 53,244,198,127,  7, 71,255,  4, 57,253, 79,237,178, 36,157, 23,215,  4,171, 31,134, 91,255,  5, 18,254,  6, 28,252,
- 30,250,214,  4, 15,123,184, 18,123,110, 26,145,176, 83, 27, 51,224,162,199,  9,179,185,173, 55,208,157, 65,255, 52,132, 99,243,
-158,135,104, 35,246,144,236,107,212, 43,203,133,103,107,111,200,122, 14,241, 96,207,243, 86,221, 91,105,121,233,114,161,196,207,
-174, 72, 95, 63, 39,170,237,122,155,235,174,236,239,228,124, 87, 29, 90,  8, 69, 27,165, 47,226,119,135,255,  4, 93,162, 62,197,
- 85,209,203,110, 30, 75, 97,171, 94, 36,170,175,138,212,193, 40, 53,136,191,158,  5,149,184,219,145,135,106,190,245, 58, 19,169,
-244,  2, 61, 74, 71,117,113,150,239,245, 85, 16,157,209,205, 76,145, 64,  9, 29,165, 95, 83,186,158,210,117,148,212,251,168,126,
-178, 78, 46, 91, 84,171,173, 93,252,125, 48,142,212,199, 15, 72,167,119, 72,135, 39, 48, 63,244,125,241, 78, 11,160,112,205,247,
-  6,  0,  0, 32,  0, 73, 68, 65, 84, 49,184, 97,162, 18,155,103, 29, 69,197, 30,143,120, 91, 84,170,169,151,235,222, 56,219, 38,
- 67, 74,165,146,  3,100,148,185,216,207,234, 96,145,122,118,223,178,194, 79,110,145, 85,169,103, 15,145, 16,137,233,208,138, 65,
-236,168,211,104,222,125, 42,193,241,162,180, 81,182,136,121,227, 99, 36, 29, 28, 83, 98, 79, 45, 27, 43,188,158,154, 23, 14, 79,
-137,199,167, 22, 76,130, 16,181, 18, 75, 70,130, 21,248,164, 64,236,169,219,209,140, 66,221, 64,108, 62,236, 90,144,212, 35,125,
- 71,201,133,105,123,102,148,180,174,115, 91, 86,211,140, 36,160,144,167,201, 46,101,173,140,168, 49,228, 21, 35, 57, 74,104,143,
-223,223,155,254,121, 44,234, 98,200,230,111,246, 66, 95, 90, 90,158,191,171,170,178, 20,236, 37,248,196, 45,116,195,106,101, 98,
- 63,133, 46, 26,226,181, 79,137,218,245,104,177, 48,157,206, 31,119,174,117,241,170,199, 16,152, 68,152, 37,163, 69,252,189,213,
- 86,123,123,250,160, 16, 23, 85,191, 44,133,222,207, 53,215, 98, 52, 32, 82, 20,139,141, 53,164,114,113, 75, 97, 36,139,144,167,
-217, 50, 13,212,166,207,237,123, 85,143, 57, 86,127,124,213,237,109,139, 64,245,154,  9,141, 39,  6,241,123,213,123,111,106, 43,
- 79,136, 86,101, 15, 21, 41,158, 68,135,  4,146, 60,221,153,141,197,115, 51,101, 25,230,199, 37, 35,214,254, 59,129, 30,  1, 39,
-246,123, 58,250,225,179,  5, 29,205, 78,181,241, 39,172,184, 98, 90,154,183,215,111,238,181, 56,204,195, 37,212,165, 66,238,224,
- 42, 34,179,154,239,250, 74,208, 51, 51,182,203,187, 25,125, 56,195,215, 11,250,235,151,240, 11, 21,126,225,150,225,101, 15,214,
- 72, 63,195,225,  6,110, 22,155,154, 94,120,203,178,241,162,123, 63,163, 29,200,237, 14, 93,137,217,194,186, 96,138,242,181, 90,
-231,186, 31,113,218,186,111,221, 69,232,217,124,109,143,238,148,189,187, 25,129,183, 50,108, 29,144, 17, 86, 16,159,134,205,255,
-128,206, 62,122,111,233,108, 77, 17,221, 40, 63,135,105,201, 80,215,199, 25,110,123,224, 71,241,189,123,220, 75,121, 80, 87,160,
-143,  5,202,100,130,170, 32,222,226,216, 88, 74, 86,160, 41, 64,182, 34,187, 36, 59, 53,145,156,103,168, 19,204,174, 32, 43,  3,
- 81, 48,101, 19,197,201,222, 69, 45, 63, 33,187,148,189,229, 78,139,180,117, 17, 10,157,137, 92,210,170, 35,124,224,  8, 62, 43,
-200, 71, 20, 78, 62,  9,225, 15,184,253,240, 30,250,237,135,246,220,159, 84,244,194, 32, 55, 90,212, 17,148, 62,  5,216,219,163,
- 47,238,169,  6,228, 41, 92,187,225,134,228,  5,223,255, 76, 81,  8,179,238, 30,110,244,174, 95,174,243,218, 85, 43, 53, 43,161,
-155,141,104,246,122,128,  7, 17,222, 90,193,199, 20,110,127, 14,182,255, 17,220,250,203, 86,200,227,205,221, 88,160,255, 44,220,
-252,107,208,253, 93,228,224,215,225,242,161, 93,222,198,176,176,235, 81,  7,249,204,205,203,105, 23, 66, 61,155,172, 91,239,174,
- 32,173, 33, 29,237,177,118,111, 67,126,  8,122,207,108,138,201, 63, 95,136, 77, 11,228,198,222, 71, 57,154, 93, 50, 12,232,168,
-200, 58,210,221,233, 73,143, 70, 82, 15,163, 24, 14, 51,239,157,  5,178,175,112,108, 59,111,159,180,148,182,142,173,234, 93,173,
-109,214,203, 34,182,243,159,107,165,196,128, 70,  7,  0,249,254, 61,164,206, 46,198, 45, 69, 13,252,207,212,229, 82, 25, 82, 71,
-210, 66,151, 71,250, 96,235,146,166,113,237,130,216, 40, 63,196, 69, 68, 84,137, 76, 69,153,166,145, 50,207,132,110, 64,250, 21,
-161, 79, 30, 48, 50,195, 60, 81, 74, 97,148,200,236, 54, 62,213,194,106,115, 69, 12,239, 18,110, 62,139, 28,222, 64,207, 30,249,
-229,195,188,222,109,159, 37,216, 69,163,230,138, 22, 49,223,178,183, 67,217,193, 58, 45, 83,220,161,243,246,171,254,121,210, 96,
- 94,227,226,225, 42, 38, 26,180,196,179,242,238,219,164,227, 76, 92, 29, 19,179, 41,211,101, 24,208,121,164,206,147,249,245, 61,
- 79, 60, 58,104,166,165,158,137,211,199,218,229, 54, 12,  3,113,107,241,169,  5,156,165,127,100,150,190,162, 80, 50, 41, 40, 49,
-246,166, 28,247,120, 87,  9,193, 84,234, 85, 45, 92,135, 96,189,218,106,229,120, 86,150,180,176, 82, 10, 93, 48,203,214,226,135,
-142,201,102, 26,253, 64,201,209,148,224,186, 19,181, 72,112,231,134,219,229, 52, 25,207,162, 20,  3, 14, 89, 18,155,186,207,126,
- 39, 18,171,222,205,182,122,208,222, 95,210,200,161,178, 75, 41,139,170, 12,253,202,178,208, 75,118, 62,187,169,252, 39, 41,156,
- 79, 19,211,102, 99,123,245, 90,220,183, 45,116, 41, 18, 83, 67,209,122, 38, 61,123, 99,119,246, 14,153, 86, 22, 27,255, 94,119,
-227,112,123,109,146, 81,244, 60,117,173, 22, 43,232,125,215, 81, 99,100,158, 51,197, 83,239,212,147,227, 26,209,211,190,121, 49,
-157, 69,158, 22, 32,216,251,152,215,118,112, 88,121,162,159, 82,150, 38,234,122,173,151,107,182,113, 43, 19,150,126, 39, 26, 72,
-245, 31,159,155, 16,109, 91, 97, 16,244,212,228,233,114, 18,173,243,233, 61,194,180,207, 72, 26, 33,140,102,173,225, 96, 17, 81,
-216,193,151,145,195,214,241,123,135, 88,247,158,188,136,143, 19,147,197,135,134, 54,186, 25,237,199, 60,219,223,155, 42, 92,  5,
-203,153,190,  0, 57, 83,244,251, 11,188, 54,195,175,110,209,191,246, 46,252, 39,167,200, 31, 22,232, 94,178,127, 48,157, 33,135,
- 87,112,115,  3, 23, 51,250,168,179, 11,194, 12, 60, 82, 52,101,228,116, 13, 71, 61,112,233,197,162,183,199,182,153,151, 17,180,
-190, 91,144,219,158,186, 85,253, 29,222, 21,223,153,186,119, 92,124,153,187,194,  2, 74,186,  0, 79, 77, 16,191, 11,164, 71,207,
- 95,133, 50,120,204,170,143,182, 27,133,167,224, 69,181, 71,211,108, 22, 59,181,189,187, 32,230,253,107,251,145,171,186, 40,189,
-161,120, 12,212,108, 65, 46,116,126,177,138,215, 32,253, 18,108,220, 37, 26,118, 92,213,228,193, 53, 41,236, 86, 43,235,180,187,
-234,205,205,163, 46, 59,145, 53,187,188,120,209,104, 32,150,186, 67,158, 74, 76, 72,114,180,228,193, 64,248,240, 33,124, 47,200,
-203, 43, 88,127, 22,134,159,118,110,202,219, 80, 30,192,107, 19,218, 91, 46, 51, 89, 77,136, 87,119, 31, 34,220,130,116, 77, 44,
-178,183, 62,160,218,122, 34,204,123,159,197,180,123,235,209,226, 97,219,174,189,161,101,221,195,101,225, 82,230,137,183,220,110,
- 63,164, 99, 69,182,130,188,158,161, 30,192,139,207,160,183, 30,195,244,215,145,211, 31,128,131,159,131,254, 51, 54, 34,151,  0,
-221,119,193,141,255, 16,214, 63, 10,235,127,  0,243, 91, 48, 95, 88, 46, 88,197, 46, 93,185,216,123,121, 59,249,180,198,191,177,
-241, 17,116,247,161, 27, 96,248,184, 69,173,214,251,246, 89, 24,110, 67,125,206,186,240,120,195, 19,218,130,117,244, 76, 32, 79,
-237, 41,220,142,253,239, 36,200, 51,233,217,142,225,225,184, 36, 26,102,125, 18, 99,177, 11, 38,145, 38, 40, 13,166, 97,  8,197,
-186,240,220,254,148,238,124,186,186, 11,155, 55,  1,169, 68, 43,135, 49, 44, 16,146,216,175,220,222, 88,172,  8,122, 86,117,221,
-110,108, 30,144, 58, 98,136,116,235, 21,253, 38, 35, 90, 41, 34,100,148,132,208,249,228, 54,  7, 33, 99, 95, 63, 87,101,150,202,
- 84, 21,242, 68,205,153, 88, 10,105,181, 38,118, 29,162,  7,150,152, 88, 38, 74, 46,100, 13,126, 21,  9,118,151,218, 94, 17, 31,
-223, 39,222,120,150,120, 18,200,103,143,208,146, 17,241,228,185,154,109,199,238, 69, 77,202, 46,183,160, 74, 34, 19, 12, 58, 35,
-134,105,182,105, 84,103, 69,147, 93, 23,134,184,232, 84,227,178,139,182,240,147,153,233,241, 61,226,173,142,238,246, 51,212,237,
- 72,222,156, 81,167,  9,165,216, 22,190, 20, 42, 74,242,240, 26,245,118,177,248,197, 83, 42,232, 52,162,235,186, 64,160,240,100,
-178, 50,141,214, 37,214,108, 35,225, 52,216,152,221,249,225,161, 27,200,115,134,216, 25,242,214, 97, 62,161, 31,144,110,112, 21,
-252,214,142,153, 97,181, 84,147,138,141,221,197,147, 38,237,130,160,132, 20,209, 26,208,146, 23,222,185,248,254,187,161, 79, 53,
-  4,106,158, 45, 98, 85,213, 97, 97,102, 85, 22,183, 41,182,247,148, 56, 12, 70, 28,  0, 84,197, 46, 93,161,121,174,221,189,176,
-153, 38,143,151,236, 25,231,217, 94,175, 61,198, 64,138,129,185, 70,247,146,183, 21,138,229, 32,196,217,108,123,178, 48,237, 27,
- 48, 74,247,151,212,187,222,141, 29,205, 15, 60, 11,194, 49,185,134, 24, 54, 24, 79, 39,145,174,239, 40, 65,216,142, 51,121,158,
-141,239, 32, 98,221,120, 41, 75, 51,166,106,180,191,156,103,  3,208,236,237,191,244,218, 86,253,253,202,188, 59,125,244, 58,219,
- 93,126,255, 80,214,221,146, 76, 42, 41,255,103,247, 60, 64,163,101, 64, 67,186,217, 81, 63,177, 66, 38, 65, 31,168, 21,248,151,
- 35,242,153, 11,120,230,  1, 60,229,251,245, 77,112,252,170, 23,255,222, 81,169,  7,209,160, 41,238,  5,151,232, 59,199,208,192,
- 44,183, 64,111,130, 62,211,124, 71, 16, 51,112,  5,199, 35,114,235,161,117, 47,211,140, 94,  9,114,149,224,211,135,240,195, 25,
-253,194, 22,253, 59,151,112,145,145,159,121,  3,134,207,194,252, 97,144,115,232, 30,195,233,183,144,225,  2,125, 24,224,210, 59,
-230, 51, 69,229, 28,185,113, 12,199,199, 32,143, 64, 59,100, 18,152, 12, 79,201,161,143, 75, 71,239,128,211, 19,177,117,189, 79,
- 27,162,154,130,254, 57,255,243, 67,128,213, 22,226,  7,161,220,131,135,111,128,222,112, 52,108,221,189, 18,157,123, 11, 79,  6,
- 91,226,135,115,227,126, 39,168, 91,211,  3, 72,106,109, 86,241,152, 86,105, 50, 81,167,168,101,144, 35,175,116,157,141,111,147,
-123,236,  7,215, 58,204,123,240,156,230,177, 79,126,129,234,124,175,222,187,107,160,205,106,103,174,239,212, 61,209,110,  9,143,
- 40,209, 97, 75,123,232,200, 20,136,  7, 61,225,249,  3,248, 76, 64, 62,124,  4,199,255,186, 21, 60, 57,130,252, 22,212,119,208,
- 71,111,195, 93, 67,168,106,246,247,153,115, 85,212,189,179,251, 26, 61,226,130,196,182,207,192,188, 71,215,107,111, 97,223,237,
- 47,172,246,253, 27,174, 68,170, 68, 66,153,177,134, 98,199, 21, 96,107,118, 61,137,123,144,149,  4,108,183,240, 14, 72, 60,128,
-139, 27,112,121,129,222,248,127,144, 91, 95,128,211, 79,195,240, 51, 38,164,139,183,237, 57, 95,253, 65, 19,209,213,183, 96,126,
-219,196,109,122, 14,211, 59, 48,127,  7,166, 71,112,112,  9,121,130, 58,185, 88,114, 54,229,250,112,234,227,247,151, 33,222,  1,
-189,239,  1, 46,207,239,101, 41,174,188,192, 42,232, 99, 83,205,203,137, 95, 40,159,130,176, 70,142,  2,122, 27,194, 65,164, 63,
- 10,116,219, 74, 31,217,  9,224,124, 28,216,108,130, 97, 25,189,123,104,144,143,126, 85,212,  5,105,174,157,144,182,183,140, 22,
- 43,234,163, 15,109,123, 12,159,128,132, 16,157,149,110, 89,222, 57,  8, 69,130,113,222,183, 27,159,230,  8,177, 42,131, 88,120,
- 70,113,165,120, 16, 33,123,238,124,160, 90,104,139, 56, 49,109, 54,143,114,219,173,148, 32,200, 54, 35,117, 36, 12, 43,211, 80,
-116, 61, 26, 35, 57,206, 72,217,141, 80, 53,  8, 85, 42,108,206,  9,161, 39,157, 60,109,249,227,103,239, 82,203,180,236,118, 89,
-122,182,246,191, 64, 14,145, 18,123,136,206, 51,119,223,124,157,204, 99, 78,173,232, 60,249,228,171, 67, 67,178, 66, 59,141,228,
-105,180, 49,181,  8, 26,  7,100, 56,176, 20,180, 16,145,254,  0,166,129, 82,206,208,249,138,234, 23,167,216,  2, 37,117,145,152,
- 45, 22,166, 32, 66, 26,  6,223,250, 25,129,174, 19,219, 33,211, 69,139, 83, 45,149, 90, 11, 41,  4,210,224,118,179, 96, 49,183,
- 90,  3,121,218,144,231,201, 67, 90,140, 67,222, 50,226, 91, 87, 45, 82,141,225, 30, 58,132,106,151,164,217,152,251,203,100,209,
- 39, 10,213, 45,109,197,129, 44,173,211,  7, 40,217,126, 45, 40,196, 62, 89,134,185, 79,110,234,222,250,162,185, 11,218,122,176,
-250, 78,189,214,234,162, 87,215, 22, 84, 53,130,228,102,195,161,  8, 93, 63,176,189,186, 34,133,106,222,120,148, 84, 42, 93, 76,
-108, 82,100,154, 60, 66,182,148,107, 35,234, 90, 42, 34,213,243,213, 77,131, 81, 99,244,238,190, 46,103, 71, 88, 70,124,190, 78,
-108,137,107, 46,252, 75,  2, 93,234, 33, 38,182,165, 48,141,166,115, 16,159, 52,213, 82, 22, 69,189,131, 33,188,160, 79, 80,178,
- 71,184,202,251, 84,101,225,247,255,149,157,224,240, 61, 37, 95,158,164,206, 57,254, 86,236, 93,157,222, 28, 10,131,128,172,132,
-203,217, 68, 54, 39, 23,149,227,175,101,228, 78, 68,223, 41,240,166, 16,222, 73,200,107,157,249,193,159,235,172,155,125, 75,209,
- 11,181,238, 90,156,175, 94,197,154,248,163,100, 93,225,179, 29,124,184, 67,158,143,240, 92, 64,110, 95,192,241,125, 56, 92, 33,
-253,202,196, 72, 50,  0,167, 80,111, 65,237, 44, 71, 58, 61,128,248, 22,178, 62,135,211, 11, 19, 94, 62, 51, 32, 47, 13,240, 67,
- 35,252,230,140,254,195,251,200, 79,253,  6, 28,253, 33,152,111,251,119,245,105, 88,127, 19,137,111,193,186,162,151,189, 21,132,
-179,  8,114,142,220,232,144,227, 15,160,188,  9,115,132,210,217,190,189,100,180,137,157, 26,101,173, 41,142, 22, 84,143,207,136,
- 59,221, 65,193,181, 56,236,225, 37,216,190, 13,151,179,121,155,103,103,169, 87,221,243, 96,249,248, 93,231, 29,224,166,119,123,
-215, 69, 70, 52,217,161,179,113, 26, 87, 10,168, 70,139,132,173,225,122, 36, 41,186, 43,234,235,178,203,234, 22,139, 76, 52, 56,
-143, 88, 87, 19, 92,193,222, 57,239,189,139,150, 12,215, 42,105,218,217, 96, 22, 38,121,149,221,247, 55,237, 50,224, 37,186, 77,
-174, 75,132,163, 30, 94,136,230,159, 63,252, 19,112,248,175, 65,184, 97, 62,191,250,  8,228, 46,188,117, 31,238, 71, 52,206, 54,
- 21,169,142,222,100,207, 50,164, 59, 83, 73, 45,239,129, 44, 45, 67,135, 29,212,204, 61,242,169, 13, 20,148,128,184,163,162, 99,
- 39,139,182,142, 65, 60,177, 75,167,138, 92, 41,154,108,215, 74,149,197,147, 47,219,201,  4,148, 53,193,213, 10,222, 88,161,113,
- 11, 47,127, 14,121,233,203,176,126,  9,186,239,134,245, 79,193,240, 49, 43,200,241, 25, 72,243,110, 23, 80,183, 86,220,243,235,
- 48,125,  9,174,190,  2,243,185, 93,180,106,181,223,159,223,128,122, 10,242,125,150, 32,135, 23,118,237, 77,161, 41,105,231, 75,
-215, 75,223,235,191, 11,241,216, 39,240,207, 67,247,148,249,192,111, 77, 72,151,232,110,116, 12,155,145,173,191,204,197,239,127,
-181, 81,192, 84,233, 16,215,183,170,125,207,170,230,195,142,178,224, 92,  9, 22,202, 98,171, 50, 64, 50, 82, 92,184, 21,213,161,
- 50,209, 64, 49, 62,202,111, 65, 23, 69,  3, 58, 95,161, 87, 23,246, 34,198,158,160,217,146,207,242, 12,142, 47, 21,204, 53, 49,
- 19, 23,145, 25,218, 64, 35,251,157,139, 46,137,181,137, 10,121,164,214,108,250,137, 24, 45,  5, 45, 68, 98,138, 36,191,184, 69,
-157,161,206,204, 85,201,231, 15, 17,  2,221,173,231,209,212, 49, 61,124,199,172, 96, 13,154,227,139,214,140, 48,213,106,217,226,
- 82,173,185,232, 43,148,108, 17,162, 37, 35, 49, 18,251, 21,169, 95, 19,251,142,128, 50, 79, 51,101,187,161,204,141, 27, 30,237,
- 60,235,143,237,251,217, 92, 50, 94, 94, 16, 14, 79,208,148,  8,235,  3, 19,222, 77,163,119,130,118,177, 41,110,175,139,146,144,
-186,139,133,141,253,202,146,156, 15,143, 77,161, 94,103,219, 86,250,202,138, 24,168, 57, 51,109, 46,145,228, 23,144,121,182,203,
- 86,180,124,249,198, 20,  8,221,128,196,222,137,139,133, 24,211,178, 94, 80, 96, 46, 70,109,139, 41, 17, 83,191,139,143,109, 43,
-171,146,151,110, 51,165,222,  0, 42,165, 16, 90, 65, 22,183, 16,214,234,107,181,234,142, 22,251,108,135,150, 59, 46,215,  5, 50,
- 18,133,168,137,216, 60, 24,173,168,  7,  3,221, 32,  1, 41,133,227,213,  1,225,240,144,237,102, 67,170,149,213,208,147, 99,101,
-202,133,131,216,177, 90, 37,178, 86,166,108,105,133, 82, 93,133,142, 93,124,164,212,197,142, 24,163, 77, 72,170,211,238,100,223,
-162,201,110,220,237,238,111, 82, 52,246,252, 12, 76,211,104, 19, 17,173,182,230, 36, 44,217, 11,162,126, 33,118,164,112,206, 51,
- 58,103, 87,247,239,119,233,240,126, 82,185,247,  5,186,235,123, 75,190,136, 92,203, 91, 87,103, 17,214,189,110, 62,189, 21,196,
-132,209,  1,102, 17,206, 29, 73,254,114,169,156,204, 48, 31, 42,227,182,178, 46, 74,216, 86,228,204, 88,175,225,227, 29,156,128,
-110, 10,234,150, 17, 38,181,157,229, 28,144,115, 23,101,189, 29,144, 47,119,104, 67,213,137,249,188,229,102, 64, 94,137,240,241,
-183,144,167,  3,220,234,225,228,208,201,109,135,182,163, 14,213, 14,186,116, 12,221,165,249,122, 87,  9, 61, 94,193,139,  3,188,
- 58,162,255,252,  2,249,254, 95,129,211, 31,135,242, 28,132,183, 64, 95, 48, 58, 87,119, 23, 89,159,163, 23,  9,198,  1,221, 36,
- 36, 62, 52, 16,201,241,135,208,252, 13,184,244, 14,182,136, 21,175,206,  5,125, 97, 15,180,139,238,197,127,  6, 91,242,186,133,
-128,185,  9,217,158,131,241,243,150, 16,215, 72,119,237,235, 37,255, 58,  3,206, 48,159,109, 60, 63, 66,221, 20,139, 25,157, 42,
- 28, 90,161, 85, 15,131,145,117,176, 17, 96,239, 58,  5, 85,208,139, 93, 91, 29,143,161, 91,195,209,165, 21,234, 80,156,164,231,
-175,120,111,227, 61,243, 98,123,236, 94, 31,247,114, 56, 23,  0,246,162,118, 38,201, 50, 94,213,108,121,198, 82,117,207, 35,110,
-185,227, 97,136,166, 13,184,  9, 28,156, 88, 80, 74, 60,222, 61, 79,245, 18,174, 62, 15, 95, 25,161,118, 22,162,145, 45,129,139,
-154,109,247,218, 40, 88,173,160,191,143,206,141,125,171,214, 94, 97,183,200, 86,159, 36,184,157, 50,136,189,150, 58,244,134,108,
-173,101, 15,163,232,254,117,203, 30, 53,162, 93,181,110, 83,163,119, 15, 83,177,204,249,171, 10,155,138, 94,116,240,234,  0, 31,
-201,240,241, 87,145, 27,175,194,225,175,192,241,207,192,225,207, 65,252,192, 46,  0,136, 96,171, 17, 57,134,248, 28, 12,159,129,
-245, 59, 48,126,  1,166,175,192,252,200, 47,128,231,192, 55,129,135, 16, 62,224,182,134,167, 65, 31,250,184, 61,238,201,214, 71,
-208,119,172,219, 15,207,218, 30, 33, 28, 64,255,221,208,125,  1,110,157,193, 97, 34,174, 35,235, 36, 92, 86,101,148, 29,156,208,
-242,201,189, 19,209, 93, 90,147,237,132,155, 90,217,118,164,154,  2,237, 86,219, 12,134,185, 85,221, 96, 91, 89,149, 72,110, 40,
- 88,221,241,  0, 10, 66,221,110,209,121,235,124,116, 43,248, 93,205, 12,209,192, 24,165, 76,  8,193,212,234, 18,152, 37, 90, 38,
-184, 35, 67,231,118,181,  8, 46,102,107, 20,221, 96,157,162, 77,116,204, 54, 84,107, 33, 75,166,120,158,120,236,204,158,213,165,
- 53,154,131, 21,220,170,212,243,119,141,188,120,243,121, 11, 49,121,248, 54,184, 47, 30,129,210,224, 60,190,239, 45, 45, 71,123,
-220,186,165,205, 60,149, 49, 25, 52, 40,228, 12,213, 98,100,179, 88,174,186,148, 98, 26, 33,247,187,151,243,135,  6,149,113,145,
-161,204, 91, 66,191,166, 59, 56,130,213,177,165,143,229,173, 61,247,  5,178,  4, 75,108, 22,217,189, 68, 53, 48,111,206,169, 85,
-136,199,167,132,131,  3,168,106,202,238, 75,  3,217, 72,103,233, 97,217, 73,209, 18,237, 82, 48,231, 76, 17,179,237,117, 26, 40,
- 90, 92, 75,225,153,236,177, 51,112,148,119,119, 45, 92, 71, 20,  7,204,224,130,174,157,117,172, 98,132,180,226,204,245, 90, 89,
-138, 93,187,216,213, 90,125,252, 93,201,222,249,198,101, 50,178,163,185, 73,179, 89,138, 21,214,144,170,175, 48,118,161, 52, 49,
- 37, 91, 35,186,  0,174,215, 74,127,116,196, 35,181,243, 35, 41,244, 93, 79,144,204,228,197, 57,170, 16, 16,102,  9,228,154, 77,
-252, 89,138,  9,232,156,183, 27, 36,144,107, 48,  0, 78,140, 22,218,211, 40, 12, 98,176,153,184,100,181,219,132,163, 32,140, 45,
-218,184,113,  1,170,173, 11,179,103,200,155,117, 54,184,138,223,136,120,117,158,237,220,148,253,204,  5,253,125, 67, 89,158, 20,
-194,233, 30,146, 70, 91,216,177, 92, 23,212,233, 94, 14,235,110,199, 46,164, 92,119, 13,153, 79,136, 57, 87,184,  8,202,113,168,
-200,161,145,155,250, 78,  9, 87,246,141, 49, 43,186, 13,200,105,178,189,113,169,232,166, 48,  7,101,219, 97, 99, 18, 12,110, 17,
-178,216, 14,171,120, 49, 31, 77,224,171,239,  8,250, 53, 49,212,220, 65, 68,142,183,240,252,  6,189,115,128,222,  1,185,117,134,
-156,142,200,177, 32, 55, 58,184, 97,200, 83,214,213,146, 41, 59,224,123,214,232,163, 30,125,227,  2, 41,255,  4,110,253, 36,240,
- 33,224,235,118, 80,202, 51,112,112, 23,233, 94,131,241, 18,221,174, 97,234, 96,188,107,135,247,233,243,232,230,219,240, 86,179,
-118,249,104, 55,184,173,173,  5,165,180,133,173,250,220,120,222,185,139, 12,243, 26,140, 57,191,253, 26, 20, 27,203, 49,122,167,
-184,  0, 57,246, 98,239,166, 43,120, 87,225,145,101,160,163,216,158,121,107,193,  9,250,112,164, 62,206,200,105, 79,172,106,227,
-177, 41,160,155,138,148,  7, 94,225,162, 21,144,238, 24,250, 75,239,212,  3, 18, 20,205,123,243,232,125,188,105,220, 89,217,180,
-229,188,143,102, 43,220,221, 12, 93,229, 63,202,110,223, 94,118,153,206,162, 30,239,216, 59,136,103,104,170,108,113, 81, 76,133,
-242,  8,242, 23,209, 55, 95,131, 55, 58,180, 47,158,205,222,  2,121,212,187,106, 27,131,235,123, 60,154,186,  3,203,236,143,214,
- 91, 97,247,193,135, 54, 97,120,217,  9, 94, 68,  4, 73,189,105, 63,212,187,113,247,  6, 83, 48,116, 99,113, 75, 75,240,238, 93,
-130, 57, 36,122, 19,124,105,142,246,189, 20,129, 81,208,175,173,224, 98,128,211, 13,220,120, 27,249,174,191, 13,183,127,  3, 78,
-254, 42,244,175,248,251, 98,222,137,234,  8,118,131,235,190,203, 64, 50,235,127,  9,242,183,160,220,117,241,219,  5,112,215,191,
-145,198,146,127,202,226,116,235,  3,127,160, 29,148,183,160,190, 10,241, 19, 54,  1, 48,107,  4,244,159,134,120,108,193, 69,167,
- 25,190, 19,233,214, 66,188,220,187,208,181,240, 10,183,169,213, 61,158,123, 91,173,171,236,104,105, 82,132,162,217, 46,116, 41,
-162, 41, 81,114, 37,116, 16,164, 67,163,197,103,106,158,151, 93, 59, 85,169,157, 91,143,218,175, 71, 59,220, 18,149, 21,202,160,
-194, 40, 66,173,149, 46, 84,130,122,182,185, 43,200, 43, 38,168,170, 62,154, 13, 65,232, 37,120,114,154,113,212,  3,214, 81, 55,
-135, 90,240, 81,166,184, 90,160,150, 74,183,205,196,213, 10, 82,231,154,146,217,198,204,103, 15, 64, 18,233,198,211,228, 24,168,
- 15,223,129, 50,154, 64,207,159,131, 42,106, 90,128,118, 79,172,217,239,175,226,112,157,104, 54,172, 60, 81,199,201, 30, 75,191,
-118, 61,139, 32,193,214,  1, 58,110,209, 98, 43,  6, 13, 54,233,210,108,162, 62,219, 21, 71, 66,234,157,193, 48,146, 75, 38,107,
- 37, 68, 49,145, 56,129,185, 42,105,181,182, 46,143,128, 76, 19, 33,246,206, 49,168,132,213,218,117,198,197,209,179,  9, 73, 61,
- 49, 36,106,176,132,187,185, 20,230,185, 16,253, 57, 43, 87, 23,196,212, 19,250, 97,161,  1,  6, 32, 13, 43,214,  7,199,244,131,
- 41,205,203, 92,216,110, 47,152,234, 22,212,108, 93,177, 75,206, 52, 55,113, 93, 94, 10,187,217,197,196, 85,236,181, 20,211,171,
- 56, 44,166,214, 76,206,101, 25,211, 43, 59,177,106,219,203,183,233, 95,104,113,184, 94,212, 67,  8,134, 82,173,106, 96,165,121,
-230, 36, 38,230,213,138,203, 77,101, 44,133,224, 29,241, 14,233,106, 96, 35,  9, 16,138, 16,164, 16, 66,160, 22,115,  5,152,229,
- 78,246,118,222,118,132,166, 96,197, 61,133,176,192,163,218, 78,187,248,101,165,199,244,  7,147,154,128,211,148,251,213, 60,232,
-152,123,160, 46,148,189, 74,158, 38, 19, 41, 62,  9,130,218,211,189,255,126,241, 85,215,164,240,203, 17,168,123,244,184, 61,107,
- 94,219,165,239,123,219,137,164,140, 18,171, 44,225, 45,  7,  2,227,158,248, 58,246, 74, 10,234,249,205, 14,175,152, 11,122, 47,
- 35,183, 34,242, 84, 64,167,128, 94, 22,255,160,122, 98,155, 71,  3, 70,160,155,149, 48,219,184, 69,171, 80,170, 34,197,139,126,
-157,  9, 36,170, 36,228, 91, 19,252,238, 21,178,186, 64,159,126,138,154, 14,225,236, 10, 25, 39,136, 21,121, 94,144, 31,238,  9,
- 31, 79,200,109,139, 74,149,161,135, 27, 39,232,163, 11,228,221,127,  4,183,126,  2,228,135,128,239, 88, 34,151,222, 54,250, 90,
-250, 58,210,223,181, 46,185, 14,144,223,134,238,121,228,185,231,168,211, 91, 22,215,170,150,181,110,241,134,123, 50,236,165,178,
-236,  5, 65,204, 30,206,178,  6, 89, 31,217,179,250,240, 45,208,149, 23, 75,221,129,122,100,143,244, 57,  1,239, 22,184, 59, 81,
-239,205,118, 24,138, 53,105,234,254,174, 58, 86,242,182, 16,238,111, 76, 97,189, 82,226, 16,144, 71, 64,249,246, 94, 92,216,129,
-119,110,174,218,223,216,165, 67, 34, 59, 21,166,236,217, 21,147,119,234, 45, 70, 54, 59,108,122, 73,255, 48, 85,175,110,117, 23,
- 49,235, 93,141, 68, 47,234, 67,176,130, 46,201,218,229, 62,219,250, 68, 39,179, 97,213,115, 24,191, 12,231,255,  7,124,181,122,
- 22,113,177, 21, 67,118,213,187, 96,170,247, 37,157,109,135, 31,109, 42,214,253,205, 39,123,247,147, 86, 51,165,114, 45,124,  4,
-113,238,123,114,127,109,112, 33,225,126,120, 71,195,200, 78,160,189,151,186,224, 47,118, 27, 13,150,106, 23,159,236, 43,141,222,
- 11,252,121,133, 71, 17,206, 87,232,183,102,248,190, 47, 33, 47,255,  2,156,254,151, 48,124,175, 79, 40,182,123,159, 72, 23,128,
-146,172,203,238,239, 88, 97,214,251, 54,134,103,  6,238,  3, 47,238,169, 75, 87, 86,184,235, 99,123,204,227, 47,217,107, 29, 94,
-114, 40,142,211,136,210,203, 48,124,  8,142,222, 36,188, 88,224,247, 18,129, 64,175, 13, 60,180,203, 94,217, 57, 10,196,176,204,
- 93,135,206,121, 73,255,106,118,180, 37, 26,178,218,123, 67,165,218,158,174,216,231, 90,243,236, 93,181,227, 96,  5,180, 75, 54,
-222,205, 51, 69,108,252,184,184, 38, 69, 22,115, 73,213,221, 24,189, 74,100,174,118,  0, 22, 95, 21,181,184, 82,212,236, 67, 49,
- 37, 75,124, 43, 21,130, 46,217,218, 79,180, 36, 14,231, 16,146, 40, 93, 80,164,108, 33, 24,141, 78,114, 89,102, 14,245,241, 61,
-163,131,221,124,142, 26,  2,250,240, 77,170, 23,118,162,175,109,234,206,175,220,128,155,193,179,209, 21, 65,156,158, 70,205, 38,
- 24,172,149, 48, 12,148,170,148,237,149, 23,243, 22,108,211,140,136,254,252,170, 50,111, 46,156,238,216, 91,135, 27,  7,234, 28,
-209,121,  7,168, 81, 42, 50, 28, 18,143,111, 83,183, 87, 11,194, 54, 87, 69,231,173,237,200,135, 53, 97, 88,163,211,214, 10,181,
-199,215,230,121,180,221,174,135,178,162,222, 93, 74, 52,  1,158,139,186,114,173,104,169,190,113,179, 51, 98,154, 70, 66, 76, 84,
- 53,177, 92,243,194, 39,  9, 38, 78,108,179, 27,223, 99,151,190, 50, 59, 30,182,228,217,128, 62, 34,164,212,177,228,200,186, 82,
- 61,123,242,155,209,220, 10, 82,101,209,115,180,136,224,253,177,251,114,220,170,193,131,156, 89,198, 58, 70,182,195,138,113, 59,
- 82,146,178,157,103, 74, 53,197,119,  3,207,224, 83,170,152,  2,189,167,201,217,197,204,186,248,224,164, 78,117,204,116, 23,  2,
- 41, 24, 80,104,246,149, 66,174, 74,214,106,184,217,170,164,104,175,205,182, 86,166,105,132,106,159,149,166, 53,  8,126,217,205,
-165, 50,151,153, 50,206,203, 90, 67,222,131,137,227, 90,108,241,255,255,244, 93,223,143,  6,239,161,183,122, 77, 72,247,100, 54,
- 67,202,106,246,  1, 92, 59,181,138,194,202, 39,182, 90,236,236,142,193,254,145,217,155,214,132,208,159, 27, 47,156,219, 29,114,
- 51, 16,206,  3,105, 83,204, 82,227,206,175,169,133,170,181,129, 65,221, 75, 33,141, 74, 47,202, 80, 43,195, 69, 33,229,130, 30,
-  4,131,153, 48, 33,103, 19,220,184, 65,205,  9,238,206,112, 57,193,215, 20,253,229,142,186, 78,200,103,  2,225,103,  6,228,149,
-  1,185,145,144,131, 99, 56,223,192,227,127,  4,199, 23, 16,255, 21,235,134,228, 29,224,131,160, 31,131,238,235, 16,191,100,135,
-102,237,188,176, 63, 67,120,233, 14,250,232, 30,250, 45,127, 90, 98, 53, 79,171,132,235,166,104,217,251,113, 96, 99, 24,142,170,
-237, 70,235,119,224,209,235,118, 97,104,223,228,210, 45,  7, 59,195, 59, 15,152,185, 63,193,131,209,198,236,106,123, 17, 29, 43,
-122, 81,151,119, 66,233, 76, 40, 21, 74,166,142, 16,106, 68, 30, 70, 75,241,210,173, 89,157,164, 55,144,137, 56, 20, 40, 98, 79,
-190,232,142, 94, 39, 59, 56,138,237,211,221, 58, 55, 22,227, 10,140,126,  1, 96,207,210,150, 29,150,211,  9, 82, 93,  8,217, 70,
-185, 93,178, 76,246,152,224,164, 26, 68, 39, 60,103,197,107,190, 11,243,215, 97,252, 71,232,215,223,129,111,117,104,200, 38, 80,
-115,145, 90,187, 23, 45, 22,182,125, 24,195,242, 65,223,137,188,158,244,113,162,120, 76,237,245,203,146,186,237,205,132, 71,158,
- 72, 87,154,229, 96,  9,232,178,127,116,202, 86,240, 15, 35,210, 86, 66, 88,106,156,133,235,120,136, 76,241,231, 45, 57,235,158,
-106,169,111,191, 19,224,221,  1,253,  3,175, 35,159,250, 43,112,235,111,192,240,131,254,141,108,159,248,120,238, 41, 80,229,196,
-138,182,220,  7,238,  1,103,192, 99, 12,196,236,170, 69,185,101,157,252,230,127,134,243,175,194,250,123, 32,157, 65,124, 23,240,
-113,127, 56,130,245, 31,132,139, 47,193,203, 35,114, 59, 17,239, 37, 86,151,153, 74, 32, 39,155, 60,197,234,239, 45,191, 51,100,
- 81, 84,178, 25,156, 90, 39,233, 89,246, 90,240, 84, 49,  7,180, 84, 47,166,101,246,199,229,172,247,152,208,212,147,  5,243, 91,
-207,121, 73,247, 17,177, 78,125, 21,132,163, 40,196, 46, 50,230, 74,204,153,222, 95,132, 82,161, 96,200,204,186,151,198, 39, 46,
-160, 18,117,107,142, 43,200,236, 82,224,118,161,234,151,203,246,150, 84,107, 26,146, 88,162,155,212, 66,157, 38,232,147,241,232,
-167,201, 87, 48, 21,125,120, 23, 81, 33,221,126,150,148,  6,120,248, 29,202,120,229, 39,147, 34,209,120,228,197,253,243,193, 25,
- 12,100, 83,125,167, 16, 44,128,  6, 59,200,101,125,140, 14,  3,170,151,212,121,182, 29,117,158,140,191,230,133,  4,  9,166, 14,
-247,231, 39,231,130,150, 45, 93,234, 12,217, 28, 59,130,154, 98,181,184,  7,188, 63,126,202, 82,225,106,165, 27, 44, 47,160,186,
- 98, 58, 68,131,161, 72,201, 84,  9,244,195, 26, 73,145, 92,148,162,230, 43,159,171, 82, 66, 90, 46,182,226, 66,179,154,231, 37,
- 39,158,100,  2,213,113,156, 24,183, 38,232,139,157,103,140,135, 64, 74, 29,161,249,192, 29,  2, 20,170,177, 32,146, 11, 21,195,
-106, 77, 85,101,158,103,230,121, 98,154, 39,242, 60, 51, 23,131,228, 52, 34,220, 16,141,155,110,200,146,202, 84, 10,197,197, 99,
-141,250,182,104, 51, 60, 88,166,122,119,159,130,112, 35,118,220, 57,185,193,176, 58, 64, 46,206, 65,212, 26,199, 82, 40,185, 77,
- 84,204,102, 56,187,159,191, 93,208,163,152,183,189, 11,145, 16,133,136, 16,196, 44,190,234,232,216,109, 41,100,173,204,213,126,
-100,199,220, 26,144,199,214, 51,185, 90,  4,171,197,118,135,197,  5,160,130, 69,197,214,194, 60,153, 83,131,170,239,201, 57,223,
-157,117,250,190,181, 92,121, 66, 71,212,178, 45,174, 65,107,119, 54,211, 38,254,181,231,184,219, 35, 83,216,229, 40, 77,186,151,
-183,220,153,144,186,129,123,202,236, 60, 13, 49,224,132,224,184,187,168,196, 92,145,123,133,176, 22,228, 52,162, 87,149,244, 78,
- 37,141,186,131, 95, 40, 20, 21,182,218,130,190,236,131, 28, 69,232,170, 48,  5, 97, 20, 88,169,178,218,206,164,109, 32,117,130,
- 92,  5,228,234,  2,185,191, 37,164,  3,234,233,  9,156,246,176,157,237,240, 43,138,126,169,162,159,191,180,130,254, 99,  3,242,
-199, 15,  9, 47, 28, 89,177,222,254,223,208,223,133,238,207,249,206,242, 45,235,106,229, 71, 64, 94,  6,249,191,172,216,215,  9,
-230,123,144,158, 66, 62,125,104, 35,250,111,121,129,156, 20,142,117, 81,128,238, 60, 94,123,210,236,206, 70,222,196,  3, 24,127,
- 13,222,245,217,112,206, 22,148,210,  2, 62, 74,181, 91,210,141, 30,206,172,168,235,189,217, 20,179,157,171,145,175, 10,122,149,
- 45,196,229, 72,232,  6,161,230, 54,181,247,248,195,139,  4,211, 99,239,  0, 39,239,142,247, 96,192,109,204,238,182,165,133,247,
- 73, 48, 11,212,202, 15,243,234,214,193,246,194,204,186,151,161,234, 74,250,162,206,149,110,194, 57,219,239,135,163,  1, 57, 30,
-224, 52,192,199,102,228,230,243, 48,252,128,189,121,198,175,192,244, 91,112,247,171,240,197,104, 35,119,205,  6, 73,107, 30,206,
-246, 33,174,126,107,189, 38,150, 50,145, 16,125,114,112,200, 94, 65,126,  2,169,212, 36, 46,193,209,189, 34,230,145,150,220, 38,
-140,201,199, 34,126,201,137,178,227, 35, 87,215, 77,108,130,241, 10,210,222,  5, 97,244,223,155,125,138, 17,162, 77, 95, 92,163,
-160, 43,167,142,223,235,224,159, 30,160,243, 93,228,123,254, 50,220,254,239,189, 99, 15, 30,  8,240,164, 89,165,209,150, 34,200,
- 29,175,112,175, 66,253,135, 16, 62,  1,241,211,254,228,251, 56,103,254, 85, 19,207,233,224,153,222,231,246,186,139,133,166, 48,
-124, 10,142,239,192,  7,207,144,143,  9,233,141,158,213,227,137,195, 45, 92,134,224, 73, 99,106, 20, 47,236,114,110, 22,225,  4,
-201,248,223, 58,109, 13, 42,212,202,123, 21, 52, 68, 99,194,199,232,185,230,189, 21,172, 96,254,223, 18, 18, 37, 23,230,121,132,
- 92,155, 81,194,144,193,173, 75,239,132,222,157, 77, 33,  4,250,176,131,251, 21,177,139, 70,245,241,121,179, 59,  5, 85,  7, 25,
- 41, 81, 77,197,156, 21,230,178,231, 31, 14, 59,228,126,140,248, 24,217,132,102,226,241,129, 90, 11, 58,110, 32,249, 40, 62, 27,
- 52,165,212, 74,126,124,151, 33,  6,134, 59, 47, 66,215,163,239,124,147,122,117,101, 95, 39, 38,235,220, 21, 35,208,  5,183, 62,
-133, 74,234,  6, 82, 55, 32, 90,169,209, 86, 77, 26,204,179, 31,135,  3, 27, 55, 79,227,114,122,167,208, 48,204,182, 72,170, 82,
-209,160, 11, 14,185,250,123,182, 32,132,174, 39,106,180,116,198,216, 33,195,154,105,220, 26,192,167, 27,168,106,232,211, 42, 70,
-124, 11,254, 53, 66,111, 48,148, 80,246,146,192,250,222,222,183,165,154,250, 92,133,152, 58, 66, 63,120,  8,137,249,209,107, 41,
- 30, 42, 98,153,228,193, 59,203, 24,109,205,144,231,217, 62, 50, 49,185,115, 66,137, 24, 23,126,118, 12,109,244,213, 68, 31, 19,
-235,174, 67, 56, 98,170,133,105,158,153,199, 43, 74,174,204, 53,147,231,201,198,209, 98,192,150,117, 76,164,174,167, 11,150, 79,
- 81,213, 10,120,192,179,228,177,245, 94,215, 69,142,250, 21,  7,253,138,208,117, 92,109,174, 88,  9,140,195,138,237,118,227,211,
-  1,131,  7,141, 90, 25,199,140,186,143,188,105, 38, 50,202, 84,202, 50,221,169,110,163,221,239,122,131,135,117, 53,183, 72,109,
- 83,164,182, 54,208,166, 44, 23,183,236,205,136, 71,181, 26,193,174, 24,129,111,206,239,203,106, 23,185, 38,102,127, 95,167,250,
-147, 96,173,221,172,104, 79, 14,228,220,108,105,178, 96,221,249,213,209,110,207,237, 14,241,207,223,137,191,216,  7, 97,149,132,
- 30, 33,133,221,  4, 37,185, 78,126, 42, 70,101,202,123,177,174,162, 98,109,126,117, 91, 87,167,200,133,137,195,178, 55,131,185,
-194,168, 98, 31, 78,245,  4,210,197,  2,189, 75,128,202,200,222,206,204,189,196, 27,133, 77, 65, 98,129, 35, 69,110,172, 97, 53,
- 88,251,209, 85,184,217, 33,199,197,118,160,191, 51,193, 63, 30,209, 71, 17, 94, 88, 35, 55,215, 16,222,132,250, 37,144, 79,130,
- 60, 15,114,233,190,250,103,205, 62,196,125,144, 51,107,241,106,129, 97,128,167, 19,220, 47,240,157,178, 83,104,118,114,157,140,
- 18,247, 82,193,146,219,247,110, 36,244,242, 46,252,222,149,253,165, 11, 47,148,  1, 47,164,158, 81,251,204,  0,239,108,225,219,
- 35,250,206,214,195, 12,116, 23,160,162,246,231, 91, 55,194,228,225,  7,158,161, 28,110,245,200, 39,176,148,182,112,106,226,170,
-139, 95,134,179,199,240,174, 39,194,213,186,167,214,247, 19,119,101, 20, 59, 57,237,209,181,195, 66,206,178, 97,114, 47, 76,168,
-183,248,202,252, 16,221,117,249,118,179,141,177, 35,220, 92, 33,119, 14,224,165,  8,159,152,145, 23,143,224,232,167, 97,253,125,
- 80, 46, 96,250, 50, 92,253, 26,250,169,114,251, 17,  0,  0, 32,  0, 73, 68, 65, 84,107, 27,120, 75, 80,201,232, 88,168, 91,191,
-228,108,138,223,208,237,178,167,123, 84, 87,109, 35,180, 61, 32,133,244,105,137, 56, 92,118, 71,254,184, 44,149,104, 23,188, 32,
-205,237,174,  1, 14, 79, 32, 87, 36,111,175, 97, 21,  5, 75,192, 67,157,177, 31,205,174,101, 95,203,158,  3,105, 56, 76, 45,254,
- 92,218,141, 97,137,235,221,248, 42, 97, 16,184, 12,200, 55, 18, 12,231,200,237, 95,130,244, 65, 27,141, 91,138,203, 19, 81,137,
-126,243, 88, 62, 65, 39, 16,158,183, 63, 91,254, 25,212,175, 65,248,144,173, 50,194, 83,144, 62, 11,252,  6,232, 35, 72, 47,218,
-154, 37,220, 48,187, 32,  2,233,  0,134,111,131,124, 19,206, 70,248, 54,232,121, 70,199,153,243, 86, 12,171,239,138, 37, 80,131,
-197,161,198,104,169,104, 90,157, 97,239,183,123,195,178, 58,239, 59,244,150, 15, 30,130, 23,115,203,238, 46,170,228,113, 36, 79,
-219, 37,175, 92,154,205,209, 59,135,149,  8,  7,193, 21,241, 53,147,176,168,202, 73, 97,110,137,126, 33,238,184,222, 65, 12,247,
- 42, 74,223, 80,  8,126, 47,173, 40, 99,109,124, 40,117,210,178,253,108,130,166, 96, 50,145, 40, 22, 45, 28,130,195,136,204, 98,
-100,128,164, 97,103, 49, 82, 53,159, 55,133,238,240,148,178, 62,102,206,179,115, 16, 58,163,225,121, 54, 55,121,178, 93,109,236,
-124, 20,109, 83,136,130, 51,188, 85,208,144,108,199,188,185, 68,203,228, 81,157,178,224, 70,139,154,184,144, 16,173,227, 13,174,
- 71,113, 70,135,166,158,212,175,232, 87, 43, 66,236, 72,135, 39,164,147,167,200,170, 70,130,235,250,229,220, 41,213,226, 58, 67,
- 12, 72,215, 67,232,150,176, 41,155,100, 24, 33, 79,252,223,104, 83, 21,130,115,209, 99,180, 11,198,108, 29,187, 41,213, 11,129,
- 64,236,122,186, 24, 57, 60, 57,229, 71,127,254,207, 50,172, 15,120,116,247, 29,138,136,165,175,213,194, 39,127,234,143,240,185,
- 95,250, 63,185,247,224, 46,119,239,190,205,219,119,223,226,157,187,111,114,247,193, 93,238, 61,188,207,221,119,239,114,255,193,
- 61,206,206, 30,113,181,217, 50,205, 54,170,142, 98, 52, 56,245,154, 48,123,168,138,122, 34, 95, 31, 34,171,212,177,238,122, 14,
-251, 21,167,195,138, 59,199,167,220, 58,189,197, 48,172, 44,222,118,115, 73,158, 70,219,159,107, 69, 84, 57, 61, 62,225,199,255,
-220,159,229,213, 47,127,197, 59,244,178,156, 31,226,147, 18,107, 70,171,103,163,151, 61, 84,172,122, 70, 59,187,145,123,105, 49,
-177,197, 71,239,117,  7, 31,114,146,162,106, 93,152,248,  5,152,243, 68, 25, 39,211,233,236, 21,230, 39,169,112,186, 31,210,242,
- 62,230,181,182,250, 86,239,118,228,201, 77,186, 88,189, 21,194, 14,138,166, 21,149,226,188,196,221, 24, 89,130,144, 14, 61, 57,
-178,209,185,216,195,186,103,255, 64,181,228,208,236, 93, 97,135,  9, 59,194,172, 12,239,100, 27, 91,222,244,177, 93, 18, 27,213,
-136,144,189, 25,212,165, 25, 18,206,171,237,237, 69, 76, 68,227,182, 87, 70, 31,215,231, 96, 92, 23, 91,219,  9,177, 40,146, 55,
-232,168,232,234, 20, 14, 14,108,204, 94, 42, 58,116,136,142,246,111,231,130,254,250, 25,250,165, 45,252,200,128,252,203, 55,145,
-103,206,161,252, 77,208,159,  7,249, 12,240,192,138,123,120, 14,248,  9, 40,255,  0,120,219,104, 88,219, 13,178,234,145, 31, 89,
- 25,138,251,181,209, 58,236,117,128,126,159,110,178, 36, 97,120,135, 28, 80,221,194,131,201, 70,186,115,221,117,191,157,236, 58,
-227, 67,127,146, 31, 87,244,188, 80,183, 21, 58, 93, 70,210,210, 57,237,110, 72,190,151,171,132, 42, 30,219,231,212,178,123,  1,
-206, 46,225,206,107, 86, 64,242, 35,  3,158,148,189,180,141,208,172,111,123,124,250, 46,182, 48,123, 15,219,241,123,226,236, 35,
-235,232,168,206,104,143, 63,212,134,165,245, 98,152,  2,161, 27,224,233, 21,124, 12,120, 57, 35,199,119,224,240,143,195,250,199,
-236, 11,108,127, 11,166, 47,163,191,253,  8, 94,239,160, 27,225,170,152, 16, 45,219, 30, 79,252, 18, 83,159, 12,104,121,226,131,
- 32,186, 23, 10,148,146, 69,107,182,240, 16,252,  2, 20,158,128, 37,183, 55,123, 23, 27,208,244,186,114, 30, 15,142, 40,123, 41,
-166, 62, 61,208,236,170,255,192, 46,143,122,210,189,165,216,  8, 99,112,156,170,203, 83,174, 50,162, 51,114, 25,  8,255,251, 33,
- 90, 30, 33, 63,240, 11,112,243,207,195,240,115,198,122,151,190,209,115,124,106,224,214,207,234, 59,119, 18,132, 87, 44,160,167,
-252, 42,148, 95,129,244,211,182, 91,239, 62,  3,199,127, 21,182,127,211,213,242,207,216,100,198,  4, 29,198,123,168,159,133,241,
- 55,224,233, 51,228,131,137,244,118,199,193,163,137,195,154,217, 22, 89,  6, 18, 82,131,183,182, 74,165, 16, 82, 93,178,196,171,
-159,110, 26,219, 94, 82,172,227,147, 72, 80,139,230, 44,192, 56,110,209,121,244,104, 83,217,177,173, 91, 78,128,182,139,153, 79,
- 93, 36,208, 73, 32,105, 97,171,187, 97, 80,231,251,239, 33,  6,211,214, 44,251,241,176,100,193, 77,234, 69,172,217, 20,219, 39,
- 79,219, 68,  1,178, 86,186,  8, 67,  8,203,251, 85, 37, 18, 82,164,211, 66,168, 74,174, 19,193,  5, 86,121,154,137, 85, 81,205,
- 76, 15,239,153, 92,226,246, 75,172, 63,240, 41, 54,247, 95, 39,159,221, 71,197,233,107,193, 32,254, 18, 19,178, 58, 48, 11, 87,
-181,116,175, 50, 57,195, 91,146, 61, 31,243, 72,168,217, 27,146,232,145,174, 30, 39,171, 97, 81,123,107,173,182, 74,243,209,110,
-198, 86, 27, 21,208, 48,208,157,220, 38, 29,223, 68,227, 64,127, 96,194,194,178,189, 68,199, 43,164, 91,161,253, 26, 21,243,127,
- 75,177,195,188, 74,235, 52, 27,107,223,172,117,209, 97, 84,115,182, 84,183, 34, 24, 49, 14,155, 58,118,222,185,183, 61,120,  5,
-234, 60,115,231, 67, 31,226,222,183,223,224,198,179,207,112,118,126, 70,201, 51,115, 54, 75,223,118,115,193,246,226,140, 32,214,
-241,215,146, 45,143, 93,240, 75, 68,  0, 13, 11,141, 79,213, 82,248, 68,108,114,145,186,142, 33,245,196,100, 89,236, 83,136, 92,
-205, 35, 41, 68,250, 24,137,203,215, 80,130, 60, 32, 73, 96,136,145,148,204, 31,191,201,153,139,105,107, 32,154,156, 73,195, 64,
- 86,184, 28,183,182,235,102,183,117,212, 70,  8,109,110,138,134,123,209,221,123,169,161,101,151, 81, 58,187, 11,234,114, 14,133,
-176, 20,226, 36,130, 74,178, 49,125,206,228,236,197,188, 33,110,247, 36,112,239,217,152,251,170,104,247,165,229,125,187,244,107,
-169, 86,187,227,215,173,108,238,244,105, 99, 78, 41,123,171,250,188, 56, 12,170,118,196,191,248,108,252,197,  5, 12,231,147,214,
- 46,226,111, 12, 24,171,176, 45,215, 19, 68, 77, 16, 45,254,228,  9, 97,171,132,173, 46,208,139, 17, 97,204, 62,110,115,203, 75,
-138,118,200, 92,150, 93, 10,105, 23,109,156, 63, 86, 97,198,240,166,234,170,249, 78, 28,112,226, 34, 48,161,194, 52,219,205,187,
-239, 29, 18,131,225, 85, 59,103,167, 31,250,112,235,247, 38,248,167, 19,156,156, 34,207, 22, 24,126,211,111,188, 63,232, 42,162,
- 11,199,111, 86, 19,212,213, 45,148,222,254,123,165,240, 76,130,111, 84, 56,159,144, 99, 15,151,175,251,123,117, 31,171, 15, 98,
-187,245, 62,193, 55, 71,239,208,205, 14,101,194,  1,177, 98, 90,  5,158,239,172, 48,124,107, 68, 31,249, 62, 29,221,169,194,241,
-224,149, 24, 60,103, 59, 32, 67,180,159,147,221,192, 67, 72,240,145,138,220,121,202, 70,189,243, 59,112,249,107,240,232, 18,185,
-240,130, 85,116,201,243, 54,216,182,141,221,229, 32, 89,142,186,143,214,185, 40,240,200, 11, 88,187,117, 21, 89, 30, 11,209, 31,
- 67, 76,132, 97,128,103, 87,240,169,138,124, 12,228,244,135,224,244,223,135,131, 63,108,225, 50,229, 62, 76,191, 14,111,126,  1,
-190, 96,139, 83,205,  5,221, 90,148,171, 69,186,170,223,154, 93,  4,255, 62,206, 53,217,171,205, 44, 59,214,106, 62,125, 28,160,
-145,134, 38,242,240, 27,185,143,113,147,253,121,243, 11,175,145, 57,195,188,181, 61,152,143,121, 23,108,108,240,215, 47,201,146,
- 75,108,100,228,128, 36,208,209,237,136, 52, 53,121, 53,229,108,  8,203,250,135, 90,209, 41,163,204,212,115,144,175,172,145, 56,
- 33,183,190,  8,252,115, 35,233,213, 51,  8, 87,166,123,224,166, 91, 42,216, 79,189,246,125,245, 33,132,143,218,239,235, 35,239,
-198,171, 89,222,226,167,128,215,124,236,126,211,185, 14,106, 23,  6,141, 48,253,142,237,232,231, 25,222, 86,228,108, 70,230,202,
-165, 68, 54, 26,125,  5,100,  7,166, 86, 93,118,189,209,139,186,  6,179, 50, 73, 50, 21,181,136, 41,223, 69,132, 50,110, 41,243,
-104,176,147, 58, 47,128, 20,133, 37,230,182,229,109, 55, 15,173,101,  5,217, 62,180, 75, 70,227,218, 54,243,131,143,183,187,  0,
- 67, 74, 38,158,107,217, 59,162,118,166, 99, 54,162,162, 59,105, 74,117,161, 86, 11,193, 67, 96,242, 27, 97, 75, 91,171,109,194,
-226,224, 16, 66,192,254, 87,221, 38,213,155, 77,169,157,179,121, 50,192,206,250, 24, 57,186, 77,206, 35,249,234,177,189,231,146,
- 21,116,186,149, 89,213,230,217,244,  3,139,247,210,214,105, 33,245,198, 77,  7, 98,234,209, 52,144,250,193,214, 20, 68,106,195,
-202, 56,196, 71,177,177, 61,146, 60,  1, 77,136, 53,219,158,247,232,212,148,241,213, 34, 75,231,201,166, 76,105, 88, 17,134,  3,
- 52,152,205,171,230,108, 43,147,102, 41,116, 91, 95,241, 34, 37,213,147,241,180, 46,113,163,165, 84,166,105, 75,222,110,141, 35,
-239,244,183,121,158,184,188, 60,231,226,236, 17,151,151,231,124,215,247,125, 47, 95,250,229, 95,166, 91, 13, 76,219, 13,143,238,
-221,163,230, 76, 74,137,151, 62,249, 41,190,241,197, 47,129,192,234, 96,205,103,127,226, 39,249,232, 15,254,  0, 47,127,242,187,
-121,250,165,151,120,240,250, 27,148, 60,115,122,251, 54, 63,241,243,255,  6,111,127,235, 91,228,113,228,163,223,255,253,188,240,
-202, 39,120,245,171, 95,225,114,179, 37,163,124,236,135,127,132, 23, 62,253, 41,158,254,232, 71, 56,122,230, 25,222,126,253,117,
-202, 60,241,194,167, 63,197, 83, 47,191,204,219,111,188,193,166,100,230, 24,248,238,159,253, 89,190,246,255,126,137,243,237,150,
-139,105,203,229, 56, 50, 78, 19,164,200,243,159,120,133,223,250,220,111, 56,163,222,214, 16,171,195, 67,126,250,223,252,183,248,
-237,223,252, 60, 90, 43,253,225,  1, 63,249,103,255, 28, 95,249,252,231,153,114,230,248,246, 45,254,224,207,254, 44, 31,248,232,
- 71, 88, 31, 29,241, 67,127,244,143,242,213,207,255,  6,170,149,211, 59,119,248, 67, 63,251,175,242,145,239,249, 30, 94,248,240,
- 71,185,247,198,235,104, 41,188,242,131, 63,196, 51, 31,122,153,215, 94,125,149,113, 28,137, 49,240, 39,255,237,127,135,175,125,
-241,139,104,173,220,124,250,105,126,236,231,254, 20, 31,251,222,207,242,226, 71, 63,202,155,223,252, 22,121,158,249,228, 15,254,
- 32, 31,250,196, 39,248,246, 55,190,137, 96,143,237, 79,254,165,127,151,223,253, 23,255,194,116, 22,123,133,123, 73, 50,117,171,
- 97, 59, 21,131,236,  5,194,198,232,239,193,249,  9,202,220,110,127, 40, 18, 73,165,168,147,152, 92, 20,109,124,  2,170, 43, 87,
-199,106,  2,236,169, 81, 71, 27, 67,165,205,253,147,141,156, 58,103,156, 23,129,109, 22, 11,125, 51, 70,  2, 81,149, 80,205, 76,
-211,183, 20,209,176,171, 37,179,154,253,102,242,244,167,161,229,167,208, 40,116, 94,100,100,134,237, 35, 52, 29, 64,191,182, 67,
- 38, 21,100,188, 50,113, 91,113, 21,213,105,178,162,255, 63,222,167,126,254, 24,249, 83,  7,200,  7,127,201, 44, 67,250,167,125,
- 60,122, 31,194,  7,129,143, 64,250, 42,228, 45,228, 21, 16,145, 91, 21,254,196,128,254,157,  9,125,187, 88,142,123,220, 59,135,
-219,146, 35,248,188,112, 84, 43,144,213,139,116,131,181, 68,159, 57,117, 30,229,250,218,136,190, 53,161,103,  5, 93,155, 93, 10,
-164,189, 70, 46,110, 46,118, 82, 13,150, 14, 39, 93,103,227,248, 34,168,  6,228,221, 10,243, 55,160, 92,238,120,169,169, 29,220,
- 46, 51,214,186,  3,221,236, 61, 86, 93, 38,  7, 62, 73, 16,  7,  7,101,191,101,121, 11, 45, 37, 44,  1, 52, 97,232,224,176,183,
-203,196,  7,129, 27, 63,  6,199,255,129,165,197,169, 47,161,235, 25,108,190,136,190, 54,195,198,149,240,179,123, 56,103,143, 64,
-156, 43,185,168, 79,127,246,111,181,187,118,125,129, 46,197,134,199,109,169, 74,106, 24, 98,143,153, 36, 13,176, 26,108,143, 62,
- 79, 80,231, 37, 34, 87,106,240,184, 96,221,237,180, 90, 37,106,226,187,102,122, 15,126,  9,242,236,102,185, 84,116,112,159,248,
- 16, 96,170,214,197,119,134,182,211,130, 93,146,250,201,112,183, 83,166, 94,100,216,206,166, 21,249, 95,123,226, 55, 11,242,211,
-175, 34, 79,127, 27,214, 71,112,122,  8, 39,127, 12,248, 99,254,133,254,191,186,222, 45,214,178,235, 58,207,252,198,156,107,173,
-189,247,185, 86, 21, 89,188, 20,201, 98, 21, 69, 21, 73,241, 38, 81,150,168, 72,109,155,146,124,105,201,185, 57,134,221,128,186,
-129,142,131,110,244, 67, 39,  8, 16, 32, 15,121,243, 67, 16, 32, 15,121, 72,128,228, 45,221,  9,130,238,192,157,216, 29,199,136,
-218,138, 36, 43,113,219, 84,100,138,142, 69,145,180, 68,177,138, 34,171,120,169,219,185,159,125, 89,107,206, 57,242, 48,198, 90,
-123,159, 18, 93,130, 64,137, 85,117,206, 62,231,236, 53,231,184,252,255,247,223,107,130, 57, 61,230,164, 55, 50,248,251,209,119,
-179,253,239,197,139,192, 47, 67,121,217,232,114,218,250,199, 73,182,130,105,158,128,230, 42, 92,188,140, 60, 82, 19,174,143,216,
-152,103, 78,119,202, 60, 86,148, 90, 73, 26,157,144,149, 76, 35, 32,209,166,110,154,157,228,102,187,232, 92, 58,219,119,183,166,
-188,214,156,145, 98,138,119,237, 61,183,254, 83,139,197, 29, 11, 30,140,210, 79, 70,250, 85, 74,244,125,126, 43, 13,109,132,226,
-227,164,133, 66, 72, 86,240, 86,177, 70, 82, 59,188, 71, 75, 81, 22,142,229,108,197, 34,115, 85, 44,136, 38,123,182,118, 12, 80,
-  7, 75, 54,235,  9, 90,201,149,230, 22,214,178,116, 84, 12,164,219,188,160,202,137, 80,143,232, 70,149,137,223,114,135, 30, 94,
- 39, 86,145,209,250,221,196,115,151, 56, 30,111,208,221,252,177, 41,220, 43,227,142,247,121,232,161,167,140,149,132, 84,145, 56,
-217, 68, 70, 19, 11, 73,233,230,180,139, 25, 93,107, 14,129, 76,241,248,  9, 25,224, 35,254, 54,243,206,214, 19,198, 98,244,130,
-170,161,180,115,114,136,132,102, 50,236,190,213, 85, 37,154, 18,185, 36,114,182,137, 87, 73, 29, 85, 93, 19,234, 49, 85, 61, 54,
-138, 98, 76,195, 52,128,156,137, 33, 18, 37,146,154, 17, 26, 42,142, 14,118,153,207, 14, 17,137, 44,102,199, 94,152,197,129,132,
-182,125,215,221,160,176,243,193,251,140,214,198, 60,112,233,113,174,190,241,  3,162, 10,113,109,157,170,170,104,214,214,200, 41,
-241,220,207,253, 34,111,189,250, 42,239,189,117,133,110, 49,227,220, 35, 31,225,153,207,127,129,151,190,250, 31, 56,220,221,225,
-181, 23, 95,228,147, 95,252, 34,111,190,252, 50, 23,159,124,138,255,255,183,126,139,201,218, 58,109, 78,124,242,191,255, 18, 63,
-250,147, 63,225,221,203, 87, 40,100, 30,190,244, 56,143,124,252, 89, 94,254,143,255,145, 27, 47,190,200,207,127,229, 43,236, 77,
-167,212,170, 60,240,177,143,113,237, 71, 63, 98, 54,159,179, 40,  5,205,137,113,  8,104, 29, 76,136,157, 50,109,215, 90,110,188,
-136, 71, 47, 20, 83,241,123, 30,124,202,133,236,202,118, 84,249,228, 23,127,142,239,191,248, 71,188,119,249, 10, 79,124,234, 83,
- 54,173,136,145, 40,129,207,126,233,151,248,225, 75, 47,241,238,149, 43, 60,241,252,167,121,250,167,127,154, 23,127,239,247,120,
-253,123,127,202, 23,127,245, 87,105,231, 54, 33,190,240,228, 83,188,119,249,178, 21, 72,192,103,190,244, 37, 94,121,241, 69,174,
-253,232, 71, 60,243, 23, 62,199,115, 47,188,192,183,191,250, 85, 46,191,242, 10,191,244,235,191, 78,252,207,127, 64,234, 22,124,
-228,233,167,249,241, 15, 94, 39,185,192,111,245,204,147,161,103,148,225,200,150,213,229, 97,127, 94,149,229, 92, 64, 48, 59,158,
-196, 56,152,179, 80,165, 42,120, 44,170, 91,181, 23, 62, 46, 24,251,244, 49,123,211,146, 28,  8,145, 87, 48,230,  5, 15, 70,203,
- 30,189,238, 49,153,237,114, 61, 11,197,167,208,193,238,219, 94, 76, 67, 92,222,143,149, 96,251, 58,215,160, 45,130, 75,164,150,
- 12,197, 37,102, 53,117, 72,119,132, 78, 64,227,  6, 28,131,182, 53,194,194, 42, 16, 85, 24, 39,116, 18,225,158,132, 94, 62, 64,
-254,143,  9,242,215,198,132,167,191, 13,117,130,252, 63, 88,144,  6,173,141, 63,117, 10,241,170,115,232, 39,208,173, 33,231, 90,
-248,139,235,232,239, 30,193, 65,134,237,149, 60,244, 30,126, 82,123,149, 51, 93,185, 36,211,170,242,221,193, 36,181,  5,125,232,
-213,150,114,203, 61,158,163, 62,170, 83, 76,141,153,250,200,213, 94, 44,237,179,164,144,173,  2,170,163, 93,248,183, 35,204,111,
- 66,153, 25, 78, 52,142,140,128, 85,121,164,107, 81, 55,112,251, 62,165,128, 76,  2,172, 85, 54,241,136,149,245, 61,125,136, 79,
-101, 88, 89, 19,154, 69,164,246,207,215, 91,215, 38, 13, 92,140,200,133, 14, 78, 61,  9,155,255, 43,212,247,184,101,203, 79,205,
-124,  5,110,127,  0, 59,166,196,215,146, 41,157,243,181, 83,166, 28, 38,186, 69,166, 11, 70, 30, 43,170,119,136, 69,164, 39,188,
-218, 94, 59, 47,203, 80,233, 25,239, 14,201, 65, 18,116,  5,201, 17,105, 70,230,122,104,231, 72, 59,245, 34, 83, 44,124,130,100,
-223,207, 85,164,131, 56,  5,168, 91,193,133, 54,203,149,133,246, 35, 41, 17,100,156,125, 93,209, 71, 13,123, 78, 65,235,158,252,
-218, 58, 36,157,250, 90,170,206,196, 80,136,127, 84,168,174, 84,196,231, 21, 57,119,  0, 15, 28,194,163,255, 10,214,254,173,147,
-228,190,  4,205,151, 45, 97,143,145, 19,227,122, 94,111,190, 67, 66,147, 13,157, 28, 31,128,176, 14,229, 74, 31, 41,104, 84, 66,
-198,208,156, 55, 47,252,230, 13,120,100,143,120,101, 68,115,212,113,122,127,193, 94,154,179,183,112, 44,104, 31,214,225,151,176,
- 89,253,178,119,239,234, 35, 73, 89, 42,227, 83,231, 63,222,176, 92,229,244,188,217,149,104,223,210, 79, 83,252,105, 14, 82, 17,
-130, 41,234, 51, 74,194,247,249,161,178,174,180,168,213,176,185, 80, 99, 35,219,156,178,  1, 19, 17,186, 12,173,  7, 97, 20, 39,
-174,225, 32, 18,139,173,112,113,179,119,249,125,  8,203,188,152, 22,101,210,199,162,  6, 43, 46,178,  8,170,166,224, 46,139,169,
-233,  3,154,145,  1, 86,114, 71,218,123,159,160,133, 90,206,178,121,250,126,218,166, 97,113,251,154,141,142, 83,231,171, 18, 75,
- 24, 11, 36, 66, 51, 38,174,159,178,216,208,249, 33,101,118, 76,119,180,107,246,174, 30, 30, 41, 50,132,178,104,233, 69, 86, 12,
- 92,115,113, 34, 98, 41, 74,110,  2,180, 11,255,250,  2,218,182,228,146,173, 95, 11,  1, 98,133,212, 99, 36,  7, 98,207,189,232,
- 83,213, 98, 99,  5,151,139,205, 52, 39, 35,224, 41,  3,252,198,232,139,153, 24,  2,245,120, 98,233,217,205,200, 39,131,145,140,
-249,170, 31,126,242,105,222,191,252, 38,177,110,184,126,245, 93,158,252,220,207, 48,158,172,209,205,230,158, 22,105, 69,205,104,
- 50,225,236,131, 15, 50, 90, 95,227,177,231,159, 39,251, 74,161, 20, 19, 65,171, 42, 63,126,237, 53,238,186,239, 62,158,251,133,
- 95,224,197,223,249,119, 38,252,  3,154,209,152,123,207, 63,196,120, 60,230,169,207,126,118, 56,163, 66, 12,204, 75,226,120,119,
-151, 55, 95,123,157,241,189,247,240,246,235,175,243,204,  3,231,248,246,239,254, 46,243,163, 35, 34, 66, 21, 45,227, 92, 36, 80,
-151, 66, 37,194,233,201,  4, 29,143,135,248,214,241,120,194,168,170, 89, 27,217,191, 27, 53, 35,154,170, 98, 99, 52,166, 26, 53,
-156,189,251, 44,179,235, 55,217,222,216, 96,255,221,247, 24,127,234,211,108, 78,214,169, 70, 35,182,238,186,139,119,174, 92,102,
-145, 18,127,246,202, 43,252,244, 95,250, 75, 28, 31, 31,161,  7,  7,236, 93,191,193,  3, 15, 95,224,189, 43,111,241,200,147, 79,
-242,221,255,244, 45, 10, 74, 61,106,216, 58,125,134,171,111,252,  8,128, 31,191,241,  3, 62,255,203,191, 98,209, 23,139,  5, 87,
- 47, 95,230,226,199, 30,231,205, 87, 94,225, 35, 79, 63,195, 55,255,237,191, 57, 49,154, 15, 39,158,120, 93,225,116,200,  9,171,
- 90,191,110, 12, 49, 64,170,135,181, 71, 47, 30,237,105, 70, 90, 18,149,246,  0,  8,135, 66,244, 54, 52,245, 70, 47,137,178, 80,
- 25,104, 95,209,127, 63,  9,236, 36,223,133, 23,243, 41,110, 87,246,185,107,241,148,163, 21, 24, 91,238,201, 93,253,125,181, 18,
-104, 83,121,128, 91,167, 58,160,233,219, 98, 92,147,152, 10,212,213,202,168,201,159,148,217,145,117,100, 97,211, 14,230,131,  5,
-210,167,179, 29, 36,168,  5, 61,213,152,113,241, 22,240, 59, 35,202,124,130, 60,251, 50,178,190,  3,229, 43,230, 97,103, 14,241,
- 89, 59, 40,203, 21,179,139,149, 49,116,155,200, 37,129, 47,102,120, 57, 25, 61,173, 89,129,180, 52,193, 70, 10, 85,128,195,206,
-170,155,232, 21, 80, 15,117,214,108,161, 30,141,123,252, 14, 91,116,209,218,186,160,117, 65, 88, 16,116,179, 70, 22,217,246,235,
- 43, 63, 64, 67,109,249,188, 58,250,232,228, 38,144,102,118,184,199, 53, 11,248, 88, 27,193,150, 26,160,166,213,101, 54,119,194,
- 46,159,245,  8, 19,243,152, 59,205, 99,153, 31, 95,123,124,168,152,149, 15,169, 96,228,127,118,173,134,115, 17, 30, 93,192,246,
-189,176,245,235, 80,159,243,253,112,178,139, 38,239,195,236,235,232, 78, 54,175,127, 40,104,167, 30,228,167,148,189, 68,187, 40,
-119, 92,232,186, 28, 50,137,220, 17, 51,200, 48, 46,151,168,195,221, 38, 39,242,  6,253, 13,218, 46,236,123, 61, 26,153,182,160,
-237,236,235, 45, 62,158,119,105,118,112, 43,138,136, 85,182,182, 28,119, 87, 66, 27, 93,124,233, 69,155, 65,155,205, 96,112,106,
-130,108,143, 12,243, 58,243, 50, 86, 58, 35, 48,116, 17,138, 41, 81,187,166,161, 85, 33,146,105, 54, 43,154,219,145,234,155, 45,
-241, 66, 38,110,213, 48, 73,240,192, 46, 92,216,133,  7,255, 57,172,127,221,194, 98, 38,191,  8,241,140,119,223,126,185,175,202,
-252,135,242,187,179,117, 81,124,108,153,184,134,216,220, 43,156, 50,209, 92,125, 31,242,208,  1,156,171,136,183, 27,214,102,137,
-179,154, 57,204,234,186, 21,165, 45,203,172, 55,165,143,209,237,147,  0,123,126, 80,111,116,183, 29,156,250,  8, 79,122,142,129,
-  8,145,228, 53,150,107, 75, 98, 52,176, 74,172,136,149, 80,185, 13,104,142,208,246,133,173,216,239,143, 67,178, 21, 93, 81,166,
- 40,157,  6,203, 74,215, 94,226,144,201,206,239,183, 37, 69,241,145,186, 37, 83, 23,  9,182, 25,113,112, 76, 31,  2, 51, 47, 74,
- 69, 96, 96,147, 21,122,124,153, 91,147,132, 76, 36,183,115,155,238, 52,107, 72, 61,182,139,245,120,215,212,247,245, 58,147, 83,
-247, 19,183,238, 35, 95,253, 30,229,248,144, 48,218,160, 84, 35, 52,181,212,107, 27,200,250, 22,237,238,  7,164,131,219,196, 30,
- 96, 83,213, 70,170, 83, 37,137, 89,167,162, 31,186,134,225,237, 87, 60, 38, 62, 52,149,127, 64, 99,101, 66,183, 98, 81,176,185,
-100,210,124, 74,187,152, 19, 84,  9,205,  4,169, 71, 72,157,  8, 85,141,132,202,134,110, 33, 24,128,167, 20,180,180,214, 71, 56,
-193, 71, 17,138,102, 82,215,145,146, 93,184,226,209,165,177,174,141,135,142,129,188,138,143,235, 65,184,255,226, 35, 20, 85, 30,
-122,226, 99,131,214,225,129, 75,143,243,206,107,223, 55,226,160,170,179,228, 27, 20,248,246,239,252,123, 74, 49,149,120,215,195,
-104,234,134,146, 77,176,182,121,247, 89, 22,139,  5,213,104, 68,151,179, 77, 89, 60, 13,242, 91,191,249,155, 75,209, 90, 16, 98,
- 12,142,183, 21,174,188,246, 42,159,254,249, 95, 96, 49,155,114,251,198, 13, 62,120,255, 93,155,112, 12, 34, 53, 43, 46,214, 23,
- 91,204,231,115,142,142,142,136, 49, 16, 99,101,221,122, 49,132,107,116,106, 98, 83, 87,182,206,173, 34, 77, 85,185,150, 68, 76,
-157,159, 51,109,201, 28,204,103,144, 90,166,243, 25, 59,251,123, 20, 85, 42,135, 42,145,109,137,242,214,107,175,114,241,169,167,
- 56, 62, 56,160, 30,141,184,113,237,218,  9,189,199, 29, 75,240,225, 40,251,225,127,253, 19, 62,247,229, 47, 51,155, 78, 57,216,
-185,205,209,222,222,114,156, 46, 63, 25,163,170,  3,138, 97,121, 70, 14,186,160,212,111, 91, 60,191,190,116,148, 54,163,234,193,
- 57,254,193,170, 62, 11,186, 56,169,169,117, 65,123,113,182,118,239,224,202,197,  8,174,136, 13, 11,167,157, 53, 53,123, 30, 98,
-118,166, 86,102, 89,140,184, 26,150,152,199,192, 74,152, 91, 30, 72,163, 52, 50,232, 34,136,186,172,186, 43,143,193,107,139,  9,
-166, 99, 87,  8,199,201,226, 79,163,154, 85,132, 98, 23, 56,251, 48, 81,116,109, 11,109, 54, 96,182,139,134,108,232,233,133, 34,
-251, 45, 52, 53, 90,101,184, 90,224,183, 18,188,211,192,207, 92, 65,238,251,167, 16,255,  6,228,243,214, 49,  5,239, 72,202,187,
-118,177,231,117,208, 45,228,217,128,238, 31, 88,234,219,186,227,100,139,239,211,215, 21,198,121, 57,114, 15, 43,182,173,122,165,
- 20, 27, 11,236,122,130, 87, 40,131,175, 87,181,216, 30, 55,138,117,210, 51,247, 99,213, 50,132,158, 80, 44,  7, 90,251, 64,149,
-164,118,129,233, 28,170, 51,208,156,131,230,199,134,138, 61,170, 60, 79,158, 97, 68, 34, 19, 87,222, 79,188,219,119,100, 34,125,
-208, 75, 21,236,117, 39,123, 24,192,255,252,168,130,123,106,120,116,129,156,217,130,237,191, 98,232, 83, 60,148,135,177,253,239,
-238,  7,112,252, 14,124, 48,182,105, 68,127, 58, 31, 36,216,107, 73,243, 76, 23,196, 56,227,  3,220, 35,252,185,236,  5,237,249,
-198,125, 74,104,210, 15,205, 62, 16,108,156, 38,101,102,130,166,186, 70,218, 14,105,154, 21,213,126, 24,234, 93,211,128,217,229,
- 98,223,131,176,236, 60, 75,180,247,215,154, 87,165, 71,166,166,229, 32, 89, 97,116,255, 22,108,174,193,222, 20, 22,115,116,102,
-246,162, 50,222,134,109,235,116, 75, 46, 44, 82,102, 33,133, 73,187,203,104,119, 78,220, 47, 84,167,107,194,164, 65,190, 95, 17,
-238,169,225,217, 57, 60,245,  6,114,246,159,192,228,119, 97,227,127,129,241,231, 44,  9,142,185,173,136,250, 75, 91,100,168,192,
-151,123,156,213, 75, 93, 44,238,119,125,211,145,193,155,200,227,251,196,107, 13,213, 97,199,233, 46,115,186,134, 15,186,101,184,
-224,176,233,  9, 22,211,154, 89,126, 72,193,222,123,170,142, 23, 30, 58,114, 67,103,230, 42,130,227, 64,251,102, 32, 98,234,117,
-154, 53, 68, 51, 81,109,106,212,166, 68,171, 66, 23,204,122, 36, 34,228, 80, 51,207,230, 69, 87,167,196,165,178, 76,145, 54,134,
-249,114, 63,172, 20, 15,141, 49,117, 62, 30,  0,212, 39, 93,149, 96,112,151, 84, 10,173, 71,196,214, 30, 36,131,132,161, 46,182,
-241,189,160,177, 70,101,196,162, 93, 80,230, 51, 98, 46,196,181, 45,104, 38,174, 10,159, 18,118,174, 81,159, 57,207,246, 71,127,
-150,246,120,135,249,254,  7, 38,  0, 28,109, 16,183,239,231,232,250, 27,164,131, 93,123,  7, 86,181, 77, 58,162, 19, 12,179,119,
-216, 18,237,162, 18,161, 83,233, 33,234, 75, 15,134,  7,233, 80, 10,217,213,225, 82, 85,142, 91, 53,159,126,145, 72, 46,201,242,
- 18, 22,115, 83, 14,171,  9, 30, 99, 48,129,220,224, 32, 50,111,128, 89,228,202,138,109,180,255, 79, 74,102,193,115,155, 86,151,
- 23,230, 74,113, 30,193,125, 23, 31,225,248, 96,159,151,126,239,255,179,221,127, 46,108,157, 57,205,199, 63,255,  5,222,251,225,
- 15,134, 85, 70,140,145,156, 50,183,223,123,159,139,207, 62,203,155, 47,127,151,128, 48,170, 71,172,157,218,102,239,246,109, 82,
-215,241,228,103, 63,203,238,205,155, 92,254,250,215,248,220, 95,254,203,236,253,246,111, 51, 59, 62, 38, 45, 90,110,190,123,141,
- 75,159,254, 52,175,127,231,191, 16,138, 82, 85, 53,219,103,239, 97,127,103, 23, 68, 56,222,223,167,109, 23,124,252,103,126,150,
-151,126,255, 27, 14, 36, 98,136,101,205, 69, 41,218, 17,218, 57,139,174,101,255,248,136, 16,123, 71,  1,132,227, 35,142,231,115,
-102, 34, 28,238,239,114,246,177, 75, 28,205,102,220, 58,216,  7,224,250,141, 27,212,119,159,225,250,155,151,121,252,177,143, 50,
-157,207,217, 63,180, 92,249,189,155, 55,121,240,194, 69,174, 94,126,147,243,151, 30,227,198,181,171, 67,223,124,245,205, 55,120,
-238, 11,159,231,241, 79,253, 20,151, 95,125,213,126,126,222,141, 31,222,222,225,193, 71, 31,229,218,229, 55, 57,127,233, 18,215,
-223,189, 54,156, 83,123,183,110,179,152,205,248,169,207,127,129,151,190,249,141,159,244,158,175, 68,172,246,239,143,176, 18,132,
- 51,140,233,139, 82, 74,187,100,202,101,203,101,248,  9, 85,158, 64,252,159,207,202,111,200,  0, 21,147,165,181,217, 59,234,165,
- 69,192,206,187,185,159,215,187, 25,142,146,189,128,181,101,250,231,240,162,131,255,157,190,  1, 18,159, 80, 39, 12, 96, 48,142,
-125, 67,234, 36,160,126,141,235,127,183,239, 40, 34,182,131,211,185, 45,248,165, 95,242, 47,178,169,161,103,157,121,113, 39,155,
-254,244,154, 93, 34,140,100,136, 17, 52, 52,107,  7, 55, 90,120,179, 69,119,199,112,230, 24, 57,253, 26,132, 79,128,222,239,115,
-222,202,198,157,204,236, 51,151, 13,  8, 99,228,108, 11,187,157, 47,123,197,170,155,211, 25,182, 55,145,250, 44, 92,191,  5, 31,
-184,244,107,102,228, 52,233,179,211, 43, 79,174,123,171, 93,114,242,143, 12,190,208, 11,219,164, 10,198,108,239,245,  3,213,138,
- 48,175,216, 44, 81, 42, 49,166,254,153,136, 60,211,192,246,207, 65,117, 47,200, 20,218,183,108,133,208,  9,210,133,229, 52,161,
- 10,200,164,130,237, 10, 78, 69,168, 93,100,213,181,230, 47,156,103, 15, 35, 95,138,188,169,131,253,112,238,169,225, 98, 65,206,
-173,193,246, 47,192,214,175,153,160,203,140,236,254,207,  3, 56,250,199,232,251, 87,225,213,218, 71, 50, 11,116,127, 65,185, 62,
-163, 59,232,232, 68, 78, 96, 74,  7,251,211, 10,237,108, 53,254, 80,124,228, 27, 60,130,146, 85, 27,199,202,155,190,  7,213, 72,
-233,119,148,193, 10,128,245, 45, 19,247,165,185,125,140,222,230, 35,158, 41, 95, 87, 78,157,115, 59, 91,175, 49,232,127, 30, 56,
- 77,174,  3,102,115,216,107, 97,154,208,173,109,116,115, 11, 93, 84,104, 25,153, 96,179, 82, 56, 94, 80, 22,135,148,249, 33,233,
-240,128,197,209, 49,157,118,148,144,208,160,148,131,142,178,200,232,108, 78,185,221,193, 85,  8,239,215, 48,202, 72,184,  9,229,
- 15, 32,127,207, 82,254,234,251,188, 96, 10, 12, 34, 14, 89, 29,199,223,145,242, 32,209,216,230,205, 12, 38,235,176, 89,193,232,
- 26,114, 53, 32,183, 11,210,218,131,191,147,127,114,176, 95, 92,145,219,111,241, 42,177, 78, 86,  9,253,118,156, 74,139, 89,161,
-212, 70,232, 18, 45,105, 45,231,228,148,174, 96,197, 84, 51, 70,169,168, 52, 49,198, 20,193, 93, 81, 19,198,185,120,135,170,161,
- 84,145, 46, 21,218,146,232, 52,120, 71, 30, 28, 60, 82, 67, 61, 54, 38,124, 78,  3,152, 70,135,253,162,119,235,110, 13,235, 11,
-141, 24,  2, 29,193,115,208, 25, 44,115,161,106,208,102, 76,142, 21, 89, 42, 24,109, 18,214,182,144,102, 66, 71,164, 45,133,174,
-109, 45,164,195,  5,115, 97,253, 52, 52, 91,166,234,143, 53,245,169,243,132,241,182,197,110,174,159, 69, 54,207,177, 56,248,  0,
-157,238, 33,213,200, 44,128,174,207,208,  1, 88,184, 98, 73,213, 62,216,100,185,142,147,170, 34,122,193,145,179,137,226,200,  9,
- 66, 69,219,117,180,211,  3,180,155,123, 62,183, 27, 53, 67,244,160, 20, 67,159,246, 96,151,148, 18,109,219,210, 45, 22,204,167,
-199,180,243, 25, 41, 27,  4,165,148, 52,124,191, 76,156,106,122,148, 80,213,  4,137, 75,218, 90,  8, 60,254,153,207,240,254, 59,
-239,176,119,253, 58, 82,148, 24, 43,186,197,130,139, 79, 61,195,225,206, 46,139,249,156,135,159,120,130, 43,223,123,  5, 68,185,
-241,246, 59,156,123,228, 35,124,244,211,159,230,252, 19, 79,112,254, 99, 31,163,107, 23,236,124,240,  1,247, 94,184,200,131,143,
- 61,102, 99,243,233, 49,169, 77, 60,254,252,243,188,243,250,235, 20, 85, 62,248,241, 91, 60,116,233, 18, 79,126,246,115, 92,124,
-234, 41, 62,242,236,179,148,212,113,251,250,141, 33,212,165,168,114,246,193,  7,248,211,255,244,159, 17,145,161,136,233,173,106,
- 34,194,104, 60,230, 99,159,126,158, 71,159,121,134, 75,159,252, 36, 31,253,196,115,220,119,225,  2,111,189,246, 26,179,227, 41,
- 63,245,197, 47,242,192, 71, 30,101,127,103,135,211,247,222,203,171,223,249, 14,165, 20,110,223,184,193, 39, 95,120,129, 11, 79,
- 60,206, 98, 58, 99,227,212, 54, 63,248,238,203,136,  8, 55,223,123,159,231, 94,120,129,199, 63,241, 28,163,241,152,151,190,241,
-117,243,236,139, 33,114, 55, 79,159,225,226, 19, 79,242,226,215,126,143,206, 21,247,  0, 55,223,123,143,231,126,246,  5, 30,123,
-238, 19, 52,163,  9,127,252,245,111,144,187,165, 80,170,148,196,125,231, 31,246, 75,125,229, 90,239,247,230,186, 44,212,205, 94,
- 43, 67,218, 27, 20,180, 24,208, 71,115, 70,115,177,233, 65, 89, 30,139,119,198,178,202,215,158,  8,238,100, 19, 55,  2,217, 27,
-114,236,211,229, 24,237,110, 42, 42, 28,103, 99,167,180,142, 54, 79,197,124,166,107, 22,  0, 70, 19, 44,152,160,241,255, 95, 71,
-131, 80,244,217, 40,243,  2, 71,157,208,212, 54,205,150,225, 11,179, 14, 95,188,147, 16,167,119, 54,149,176, 30,237,227,244, 71,
-122, 40, 86, 93, 88,225, 30, 28, 12, 48, 34,159, 61, 11,227, 13,194,205,219,132, 60,181,139,169, 75, 54,199,111, 92, 25, 62,183,
-110, 84,198, 53,124,124, 11,249, 53, 37, 92,216,130,240,119,161,108,  3, 87, 65,255, 12,202,159, 65,158,131,158,178,220,248, 42,
-163,  7,111,195, 27, 83,219,185,111, 70,184,119,134,172, 63, 15,213, 58,250,221,175,193, 15,124,113,121,208,162, 11, 65,198,254,
- 77,220,176,177,189,190, 62,183,113,205, 88, 41,215, 22,232, 97,235,223, 36,183, 78,172,185,229,236,184,179,241,117,113,108,172,
- 11,107, 66,172,137, 90, 33,207, 52,200,175,222,  5,231,254,161,121,162,211,251,176,247,127,195,193,107,176,187,  7, 55, 28,112,
-211, 57, 68,103,171,130,123, 35,108,175, 25, 11,159, 29,216,219, 71, 63, 72,182, 63,233,220,166,208, 22,175,101,196,138,128,243,
-  1,185,168,112,230, 83,112,234,111, 65,125,214,  5, 93, 35,255,175, 64,247, 13,184,254, 15,208,239,204,224,135, 53, 58,202,148,
-119, 15, 41,239, 77, 73,211,100, 30,227,158, 10,118,  7,140,161, 47, 78,195,157,118,110,207, 62, 14,189,  7, 90,203,137,183,108,
- 16,245,221,187,215, 96, 26,236,144, 10, 35, 27,185,111,157,182,143, 49, 59,132,118,134, 52,209,240,251,157,207,174,106, 43,242,
- 36,228, 37, 19,134, 98,107, 11, 95,230,155, 11, 67,209,206,225, 45, 97, 12,219,247, 16,238,218, 68, 70, 29,204, 14,225,248, 24,
-142,230,232,180,163,107, 23,204,115,199,188,133,105,142,164, 16,105,164, 48, 10,197, 38, 82,165, 16,179, 18, 90,165,150, 64,179,
-209, 80, 93, 92, 71, 46,141,224,241,130,220,159, 77, 80,119,215, 23, 97,243,239,  0,231,253,133,237,184,118,161,156,  4,224,175,
- 94,234, 18,252,207,101,224,107,176,243,127,193, 31, 28,192,127,152,211,190,115,204,124,119,198,149,185,114,173, 27,190, 84, 27,
-115,159, 48,215,136,193,  8,253,132, 80, 15, 85,  9,170,212,177,  2,137,116, 85, 67,201,234, 74,248, 68,168, 27, 15,  3,  9,238,
-193,174,153,148,150,237,104,153, 81,139, 46, 81,122, 68,103,168, 13,246, 34,193, 97, 29, 11,180, 88,  7, 79,221,216, 69, 93,212,
- 88,240, 69, 93,188, 85,  6,104,136, 12, 19, 28, 83,145, 23,191, 32,131,152,194, 62, 75,164,195, 70,196, 81, 19, 35,148,170, 54,
- 94,189, 18, 40,213,136,220, 76,204,187,156,230, 44,102,199,204,230, 51,139, 12,117,  1, 92, 61, 89,103,114,247, 67,212,247, 92,
-178, 61,243,108,207,244,  1,107,103,144,102, 29,169,215,  8,163, 45, 22,121,202,222,229, 63, 98,250,254, 27,148,174, 51, 17,112,
- 20, 82,202, 44,146,141,188,163,168,193, 85,130,251,178,251,176, 71,223,167,  7,255, 58, 59,195,167, 81,215, 13, 97,125,155,174,
-107,209,197,220, 79,105,219,165,211,140,237,176, 31, 82,238,252,231,158, 90, 52,183,110,227, 54, 73,  0,  0, 20,143, 73, 68, 65,
- 84,148, 34, 36, 45,228,118, 97,  3,168, 88,217, 88, 62,119,182,202,236, 35, 68,  9, 38,104,172,226,114, 18, 83, 12, 27,155,181,
- 80,138, 18, 84,137, 85, 53,248,157, 87,  5,172,154,242, 96,  9, 43,217,241,172, 49,184,118, 74, 45, 72,166,109, 17,132,132,105,
-105,144, 37,185,173,248,170,199, 92,192,209, 95, 87, 15,128,137,131, 13, 13,129,103, 95,248, 89, 14,119,118,121,227,229,151, 93,
-223,106,187,250,226, 83, 92, 99, 93,232,128,  1,238, 33, 49, 61, 96, 94,  7,130, 91, 30,158,152,  8,182,134,168, 27, 23,184, 41,
-143,125,226, 57,238, 58,247,  0,223,250,119,191,181,130, 34, 81,183,101,174,184,114,188,161, 69,101,128,  7,157,200,164, 24,  2,
-167,194, 74, 28,234,242,215,243, 63,255,115, 28,237,239,241,250, 75,127,220,211, 50, 78, 92,234, 22,152, 85, 78,116,229,246,204,
-151,165,239,183,156, 28,213,  7,249,240,  0, 87,  1,226,255,116,143,252, 70, 41, 75, 55, 84,235, 65,247,189,158,181,232, 50, 64,
-126,  0,130,233, 82,  5,223,219,207,154, 21,  1, 93, 29,100,240,165, 87, 97,136,170, 53,155,138,255,249, 53, 15,109,235, 59,243,
-232,175,200, 39,103, 78,181,147, 97,132,100,144, 26, 75,115,106,135, 41,183, 29,186,228, 14,230, 29, 58, 30, 19, 70, 19,100, 92,
-112,181,136,141, 27,212, 42,104,197,225, 34,109, 66,110, 39,104,182,144,251, 91,100,242, 18,196,159, 54, 92,167,140,150, 57,214,
-154, 65,215,160, 84,200,218,189, 80,239,218,152, 98, 35,192,166, 32,213, 11,168, 28,192,229, 55,224,182,197,107,234, 84,151,190,
-243, 70,150,222,240,219,254,141, 27,121,103, 56,205,195,190,161,135, 72, 12,251,136,185, 99, 59,251,216,214,108, 15, 68, 40, 53,
-242,164, 32, 79,220, 11,155,127,213, 45, 78,107, 14, 33,123,  7, 56,178,203, 57,123,183, 62, 10, 86,128,108, 41, 52,150,195, 13,
-115, 11,148, 57,102,176,109,245,168,114, 68, 60,121, 45,194,195,  9, 57,117, 31,156,250,235,208, 92,242, 11,221,125,214, 52,144,
-175,194,254, 63, 66,175,222,130, 63,173,161, 18,244,120,134, 94, 61, 38, 29,182,  6, 29,186,227, 66,239, 15,136, 62,136,236,206,
- 11, 29,196,196,111,245,200,197,129, 50,168,224,135,200,227,254,177,232,167, 73, 18,  9, 82, 76, 52, 50,217,128,122,205,108, 61,
- 17, 83,204,  7,223, 53,245,203, 42,  7,114,144,210, 82,124, 71,131,  6,235, 36,181,  4,114, 87, 76,103, 18, 27,186,102, 68, 75,
- 36, 29, 29, 34,239,189, 79,220,187,137,132, 57, 18, 19,228,130,116,  9,237, 90, 27,129, 22,161, 43,202,162,179,177,170,132,138,
- 80,217,116, 39, 99,153, 10, 11, 32, 31,117,132,253, 22,217, 83,228, 70,  5,135,149,  9, 61,229,135,150,  2, 23,239,  7, 57,229,
- 93,123,239, 67,253,144,  8,  8,193, 83,104,  4,248, 17,116, 95, 51,102, 68,125,  8, 83,129, 27, 25, 89,100,154, 82, 56, 54,150,
-211, 16, 71,176, 90, 35,244, 65, 38,  1, 37,107,191,223, 86,167,136,171,139,178,106,138, 56,227, 59, 54, 84,163, 53, 74,172,124,
-215, 25,168, 66, 69, 29,  3,212, 53,139,148,200,169, 91, 78,  6,197, 72,101, 37,  4,114,168, 76, 65,174,106, 35,228, 80, 65, 51,
-182, 11,189, 51, 31,190,198,106, 96,193,179,146,117,173,  3,188, 37,250, 22, 44, 24, 18,194,187, 89,234,  6,173,199,150, 92,216,
-152, 29, 45, 52, 35,114,181, 70,231, 72, 92, 45,230,175, 78, 57, 15,212,182, 28, 43, 82,206, 44,142,118, 72,135, 55,200,221,212,
-215,  1,141,189,230,233,  1, 90, 18,117, 51,102,114,234, 33,214,238,255, 24,163,237,123,104,182,238,162,222, 58, 99,144,152, 24,
- 73, 18,141,111,158, 18,161,182,253, 81,155, 50,201, 67, 84,204,198,102, 93, 95,246,139,169,138,129, 48, 94,  3,177,215, 64,207,
- 50,175, 71, 84,155,167,237,235,  8,113, 24,207,171, 90,166,121,106,103,134,110,142, 21,197, 45,108, 18, 42, 19, 36, 74, 48,255,
-122,  8, 67, 76,170, 41,194, 77, 13,158, 82,103,162,186,254, 76,207,217,190,197,209,177,182,170, 43,113,200,206,114, 24,152,  1,
-118,134,246,187,237, 97,134, 52, 68, 40,171,107,133, 60,226,214, 71, 45, 85,  8,196, 24,169,171,134,170,170,137, 49,154,234, 60,
- 70,215,189,  8,147,141,117,126,230, 87,126,133,170,174,120,229, 15,255, 16, 41,101,136, 96,101, 69, 21,190,234, 55, 31, 94,171,
- 95, 76, 58, 92,236,197,255,185, 12, 61,137, 34,220,251,240, 69, 62,251,229, 95,226,177, 79,124,130,245,237,109,190,243,251, 95,
-167,157,205,221,147,174, 39,102, 98,220, 65,  6, 63,113,125,202, 79, 70,172,157, 80,171,  3,147,245,  9,191,248,149,175, 80,215,
- 53,223,253,214, 55, 61,120,102,229,163, 13,225, 50, 38, 90, 45,165,184, 93, 49, 19,244, 36,251, 93,244,142,215, 35, 39,197,118,
- 43, 71, 41, 85,151, 78, 98,236,122,126,118,111,182, 81,215,120,173, 69,165, 66,152, 88, 68, 55,173, 66, 85,150,152,240,232,123,
-244,210, 87, 26,209, 84,183,197, 73,155, 82,150,128,179,222,127, 87,245,182,181,232,184,144,180, 92, 37,247,138,191,164, 98, 66,
-  9, 79,240,201, 78,154, 66,133, 88,148,177,100,154, 32,196,197, 20,185,117, 11,125,244, 33,202,214, 25,194,219, 59, 80,101,251,
- 36,211, 76, 41,  9,245,240,134,144,149, 48, 93, 32, 95,223, 65, 55,238,129, 47, 28, 32,155,127, 31,194, 63,128,112,193, 20,  9,
-113,102,177,151,150,254, 97,130,183,187,158,131,197, 31,155, 80, 45,110,219,158, 91,111,218, 40, 27, 93,222, 96,125, 85,149, 87,
-102,157, 99, 96, 38,118,153,175, 87, 70,201,155, 39, 47,187, 92,  4,167,  5,105, 34, 26,141, 90,102,251,119, 29, 86, 20,140,  3,
-220, 93, 96,116,214,132, 83,106,144, 12,234,103, 97,237, 53, 88,236,193,214, 14,180,161,143, 32, 50,210, 79,179,102, 59,240,176,
-  6,229, 86,239, 59, 90,122,  7,219,108, 55,236, 72, 96, 43,194,217,130,108, 52,176,246,180,167,144,173, 42,179, 71,198,206,223,
-255,167,176,243, 22,252,176,178,172,251, 73, 66,119, 22,164,221,150, 69, 22, 22,142, 37, 45,189,170, 61, 47,  7, 79,154, 79, 18,
-147,134,177,124, 83, 27,212, 35,119,  4, 77, 72,231,127, 34,248, 28, 73,117,233, 53, 95,189,226,138, 26,132, 40,156,177, 13, 73,
-231,  3,255, 92,160, 88,199,130, 84,198,131,239,171, 10, 26, 84, 91, 83,205,106,182,148,173,106,141, 44, 53,121,148, 41,243, 57,
-105, 49,165,235, 22,104,155, 16, 45, 36, 85,210,190, 50,234, 10,213,182,225,114,117,180, 70,216, 89,163,242, 31,255,184,  4,242,
-162,208,118,137, 46,  4, 66,105,169, 82,242,247,117,160,  4,165, 27,  5,186, 89,102,237,234,  1,163,157, 57,213,187, 19,226,187,
- 99,228, 17,129, 91,151,225,252,255,  6, 27, 79,195,250,223,134,209,199, 65, 55,176, 42,236, 14, 58,133,170, 23, 89, 11, 96, 27,
-218, 11, 48, 63,182, 81,252,227,251,200, 59, 19,226,113,102,179, 43, 60,144, 50,135,153,161, 32, 22,129,174,232, 18,144, 24, 92,
-197,175,106, 26,115,  9, 67,170,116,  6,130, 11, 85,173,129,243,  4,171,156, 76,208, 85, 27,149, 44,136,146,170,134,188,104, 79,
-226, 56, 52,147,169, 40,120,184,  8,110,195,241,189,179, 21,183, 35,  7,195,231, 19,159,183,191,228, 76,104,214,239,163,173, 96,
- 42,106,130,188, 92,212,108,141,201, 68, 97,165,170, 81, 34, 85,176,174, 56,229,153, 51,231, 11,162,201,212,229, 65,236,245,100,
-179,183, 81,236,235, 91,236,188,143,222,122,151,166, 25, 51,185,231, 97,226,221, 23,236,210,235,166,148,116, 68, 61, 63, 96,180,
-253,  0,167, 31,120, 10, 46,126,202, 72,155,199, 59,164,233,174,101,122, 75,225,224,237,239,113,240,250, 31, 80,186,185,125,189,
-214,222,158,  8, 60,200, 67, 46,196,200, 58,249, 60,243,247,113, 70,170, 17,113,188, 14, 33, 14,  9,134,169,107,237,185,241,221,
-106, 46,197,207,201,228,243, 85,179,253,169,154, 69,173,228,100, 53,184, 66,  8, 53, 69,194,176,186,210, 82,252,251, 40,148,148,
- 41, 41, 13, 16,155,226,  9,112, 20, 87,218, 59,  6, 68, 42,139,173, 84,205,195,179, 91, 74,182,199,169, 40, 33, 88,170, 27,197,
- 86, 12,217,  9,108,125,  7, 29,253,243, 13,187,254, 21,112,145, 96, 78,128,249,241, 49,223,252,215,255,122, 73, 41,140,113,165,
-192,232, 19,253,138, 39,179,249,191,115,244,107, 63,  9, 24,136,113,220,193, 96,247, 49,224,  7,239,188,205,187, 63,126,203,240,
-180,168,137,225, 60,183,160,172, 38,175,200,114,  3,234, 42,174,225,212,  9,238,250,232,215, 46,114,167,151, 71,140,123, 49, 63,
- 62,230,171,255,242, 95,220,153, 67,228,103,142, 39, 82,149,178,178, 79,255,201,174, 91, 62, 36,141, 90, 62,164,182, 88,157, 26,
-196, 95, 59, 35,191,177,114, 23, 81, 84, 92, 76,179,252, 48, 69,122,138,233, 82,189, 46,158, 83, 82,123,167, 93,133, 59,232,164,
- 14,248, 80, 21,162, 95,222,115,160, 51,232,243, 32, 28, 23, 31,129,170,202,224, 93,199,181, 91, 61,220,102,136,253,246,138, 80,
-  4,114, 49,241, 85,231,189, 91, 29,148,208, 38,100,123,140,158,218,132,133, 32, 83, 27, 47,167, 89,161, 45, 74, 30,  2,125,149,
-208, 58, 77,231,106,  7,247,157, 70,206,237, 64,248,190,  7,193,172,219, 65, 41,135,160,  9,180,241,113,224,  3, 48,234,160,188,
- 13,163,187, 44, 18,179,251, 51,248,254, 45,243,156, 39,139, 79,181,149,168,152,  0,174, 14, 48,  9, 72,171,182,107,207,138,172,
-245,249,237,101,105,143, 11,190,243,141,  1, 90, 69, 23,101,217, 70,169, 18,186, 72,220, 30,193,103,  4,121,240,203,208,124,198,
- 15,243,108,  1, 31, 36,104,223, 48,171, 83,206,144, 42,216,176,179,158,234,148,239,211, 11,148, 35, 88,204,236,116,239, 60,118,
-117,225, 42,248,141, 10, 78, 87,112,182, 67, 54,239,134,237, 95,134,230,209, 21,239,180,235, 14,142,254, 61,236,255, 14,122,  5,
-248, 81,132, 81, 70,119,231,148,183,166,204,167,137,105, 37,203,159,151,172, 20,140, 75,178,204,201,203, 92, 34, 52,181,189, 23,
-218,185,141,199, 87, 43, 96, 31,201, 15,221,252, 48,167,247,199, 45, 23, 83,186,111,157,177,215,167, 45, 34,174,202, 76,221,160,
-150,215,226, 57,226,145, 65, 16,148, 67, 69, 38,208,117,129,182,  8,139, 54,209,150,138, 69, 28,145,230, 29,186,232,108,215, 92,
-143,161, 94, 35,175,175,  3, 19, 36,172,193,230,105,244,244, 22,170,181, 69,238,142, 54,208,209,216,136, 97,237,140, 46,181, 14,
- 45,233,195, 78,150, 99,188,206, 81, 10,165,205,232,222,  2,217,203,200, 13,  8,183, 26, 91,135,196,235,208,125,219,116, 11,245,
- 37,115, 57, 12,155, 91, 61, 57,250, 80, 32, 31,128,174,195,252,  6,164, 41, 84,135,246,189,154, 67, 56, 86, 38,179, 66, 46,194,
-129,211,177,196,159,231,158,221,222, 63,119,253, 92, 81,252,251,171, 30,  4,161, 37, 19, 37,208,169, 69,157,230,212,145,125,132,
-155, 85, 77, 36, 86, 50,165, 30, 89, 49, 95,140,245, 93,213, 13,161, 30, 91, 65,147,179, 75, 68, 26, 67,120,106,191, 47, 78,246,
-214, 12,209,108,112,197,188,216,214,228,219,251, 67, 98,133,198,  6,141, 53, 37, 68, 47, 24,151,196,107, 27,231,  6,183,197, 25,
-115, 92,157,168, 86,210,130,182, 93,176,104, 59, 82,215, 13,103, 93,231, 84,180, 92,242,137,227,209,104,190,166,234,158, 30,239,
-113,188,251, 62,237,241, 46,121, 49, 37,205, 15,232, 22,  7,148,197,  1,165, 77,  4, 10,213,218, 54,213,218, 22,218, 76, 88,164,
-150,195,119, 94,165,189,125,205, 18,189,220,150,167, 43,151,141,122,152,141,132,218, 46,170,236,225, 38, 10, 18, 26,194,100,157,
-148,149,118,122, 76,110, 91,114,106,173,160,141,145,210, 45,204, 99,175,253,152,214,169,127, 69, 45,246,115,177, 48, 22,121,234,
-134,175, 45, 97,244,190, 16,140,113, 79, 63,133,237, 89,232,197,155, 42,199,169, 90,181, 96,111,138, 80,138,  9, 81, 67, 88, 42,
- 58,180, 12,123, 95,213,158, 15,178, 18, 19, 26,130,107, 54,204, 47, 31,162, 79, 86, 92, 32,105, 95,235,146, 22,104,218,190, 66,
- 46,217, 63,127, 89, 82,215,202,178,251, 46, 62,234, 79, 57,155, 13,210, 39, 16, 69,203,201,203,109, 40,254,151,180,194, 62,210,
-117, 16, 80, 34, 38,200,212, 37,222, 82, 87,135, 96,194,159,219, 26,175,102, 22,220,121,177,202, 48, 75, 60,121,  9,171, 23, 57,
- 57,123,131,233,209,181,171,221,182,252, 57, 23,251,234, 72, 63,172, 20,  8,114, 39,184,171,183,136, 39,189, 67,127,227,173,114,
-118,133,169,122,188,118, 39, 66, 22,165,113,147, 63,197, 47,247,136, 43, 84,197, 85,155, 12,123, 16, 16,114,112,223,186,199,109,
- 15,239, 23,150,222, 89,252,135, 85,178,244,233,167,148, 96,132,179, 94,204, 45, 62,205, 54,152,196, 73, 42, 89, 31,215,185, 22,
- 10,241,189, 91,150,115, 50,222, 64,171,  9,180,153, 84, 23,102,179, 98,163,216, 74,204,150, 92, 67,140,  5, 61, 90,192,191,217,
- 71, 31,186, 11,121,248, 77,232,254, 25,212,127,199,160, 52,122,  8,114, 21,149,100,157,110,190,  5,213, 83,176,113,205, 58,  3,
-237,108,244, 63,235,145,163, 50, 92,194,140,117,169, 54, 92,175,160, 46, 72, 93,108, 93, 48, 23,194,134, 80,180, 50,178, 92,244,
- 93,166,  4,100,108,195,  1, 57, 84, 74,107, 99,248, 16, 60, 93,109, 29,228,116,128,250,169, 21, 31,179,223,152,245,  5, 27,177,
- 87,199, 48,105,173,192, 88,199,242,214,171, 45,  8, 99,175,158,202,242, 93, 91, 28,124,211, 99,185, 54, 35,156, 74,200,198, 24,
- 38, 15, 65,243,209,147,254,233, 48,134,242, 30,204,127, 27, 14, 18,114,121,100,157, 65,238, 40,239,206,232, 14, 59,142,235, 48,
-144,  7,195,138,223,242,206,234,178, 63,  0, 52,212, 48, 89, 71, 84, 41,243,163,161,122, 47, 62,153, 17,239,110,150,251,196, 21,
-193,167,167,179,105, 12,150,161, 45,238,251, 72,153,178,232, 92,116, 98,193, 27, 84,160,173, 65, 98,148,198,212,192, 57,163, 33,
-144, 52,210,230,204, 98,158,205,227,158,167,134, 35,158,108,194,246, 61,200,120,203,246, 94, 85,160,180, 29,139,212, 82,  4,154,
-157, 41,213,193, 28, 25, 67,104,  2, 85,183, 32, 79,143,168,167,199,196,156,233,146, 37, 27,106, 48, 28,107,232,148,170, 95, 51,
- 33,148, 90, 56,208,194, 34, 41,107,187, 83,198,199, 45,205,126,162, 62, 90,135,182,130, 75,183,161,252, 38,164,107,112,234,127,
-135,234, 60,203,242,120,101, 80,216, 43,172,217,132,250, 60, 76,119,160,190,  9,247, 76,  9, 15,140,  8,199, 74,245, 72,228,163,
- 63,110, 57,124,187,227,182, 31, 74,181,152, 54,134, 30,215,186, 18, 23, 53,236,238,176,233,152,148, 66,206, 45,226,113,162,214,
-176, 25, 87,190,170,215, 41,117, 77, 14,134, 72,149,201,  6, 50, 50,123, 83,234,195, 90,202,  2, 41, 74, 53, 26, 51,143, 21,121,
-145,125,100,107, 84,181, 72,182, 68, 50, 44,228,163,223,153,139, 11,134, 76,197, 30,220,239,157, 78,112,244,251,189,238,208,145,
-133,202,172,110,209,146,219, 52,103, 83,224,135, 72,215,119,177, 57,123, 66,157, 34, 33,218, 26,167,105, 28,153, 57, 67, 36, 82,
- 98,197,124,122, 64, 59, 63,182, 67,245,246,117,234,102,196,120,227, 20,245,218,186, 89,204, 98,133,134,138,249,236,136,195,253,
- 29,186,195,219, 72,106,105,234,106, 56,248,251, 17,116, 63,186, 78, 30, 16,130,191,182,130,  9,224, 66,109, 43,141,110, 62,179,
-167, 46,171,165,186, 53, 35,194,168, 38, 39, 79, 15, 43,198, 43, 86, 31,177, 11,129,210, 45, 12, 22, 20,  2,129, 72, 81,191,240,
-130,217, 72, 11,153,180, 48, 80, 72,239,147,215, 21,252,168,  1,136, 12, 31, 44,190, 50, 34,103,219,209,135,224,151,231, 10, 26,
-216,135, 94, 41,217,247, 56,136,  5,  1,101,177, 68,189, 12,  6,202, 81, 23, 73,245,190,121,197,109,103,  1, 41, 66,161,144,197,
-236,124, 37, 89, 78, 64, 22, 49, 12,110, 63,154,246, 19,163,167, 71, 87,206,224,207,217, 47, 21,231,172,232,202,  9, 51,116,251,
-125, 80,140,120,234,166,163,145,139, 90,250, 30,197,  3,118,134,221, 32, 39, 46,119, 86, 39,199,171,207,133,234,  9,152,187,172,
-172,  3,150,151,188, 23, 28, 89,  7,209,164, 14,207,127,127,225,203,106,146,203,135, 95,232, 39, 38,154, 39,163, 86,249,144,110,
-190, 18,150, 88,115,  5,162,119,180,125,135,149,220,157, 85, 84,153,187, 21, 35,246, 49,156, 43,  1,102,161,156,172, 88, 50, 56,
-245,201, 35,234,130, 12, 49,135,165,  8,217, 65,104, 41,247,  1, 50, 66,206,253,110,207, 71, 30,193, 35,191,157,203,210,174,252,
- 94,171, 38,130,239,173,112,227,190, 16,208,  5,178,183, 71,184, 59,192,233,177,229, 49,239,103, 22, 36, 42, 85,195, 91, 74, 48,
-241,155, 22,164, 42,112,245,136,242,255,212,196,191,117, 14,214,126, 31,218, 39,160,254,239,128,123,209,176,239,249,215, 78,133,
-209,  5,132,207, 66,249, 19, 68, 94, 71,231, 71, 62,238, 54,117,106,207,106,151,226, 34,133,224,227, 12,140,246, 38,168,143,209,
-  2,225,116,176,177,111,242, 78,  7,207,173,245,232,178, 92,220,209,157, 10,210,  4, 56, 19, 96,173,177,137,193,157,144,146,224,
-246,182,120,  3, 70,199,214,161, 78,214, 32,222,109, 40, 87,169,122,138,143, 67,110, 86, 60,132,184,200, 97, 91,145, 83,  1,154,
-187, 96,252,156,  5,136,244, 69,128,  7,171, 16, 94,130,173, 15,224,242,196, 26,248,168,148,119,231,228,155, 51,142,138, 50,147,
- 64,209, 64, 20, 99, 83, 87,206, 30, 64,  7,186,171, 63,128,246,160,105,255,186,114,242, 17,154, 12, 35,225,101, 66,156,117,168,
- 69,252,101,228, 21,255,122,191,112,106,156,128,150, 11, 26,  4, 73, 29, 37,116,214, 97,228, 76,153,183,100, 21, 91,231,164,150,
- 92, 53, 38,200, 91, 36,148,108,151, 69,168,208, 18,173, 88,235, 90, 27, 76,164,117,239,246, 35,154, 10,218,182, 16,133,197,236,
-136,210,205,105,214, 55,168, 51,  4,233,136, 58,165, 74, 51, 66, 84,234, 98, 19,166,226,180, 68, 77,182,159, 46, 98,212, 51,196,
- 38, 83, 37, 11,243,168,116, 33,144,187, 12,183,142,  8,149, 18,159, 62,  5,111,143, 96,122, 12,247,253, 33,164, 93, 56,243, 55,
-161,126,220,160, 67,204, 86,142, 28,119, 36,200,  1, 52,103, 96,116, 14,202,109,228,204, 85, 19, 73, 86, 35,184, 84, 51,254,127,
- 11,231,175,117, 28,182,194,169,173,200,250,134,240,246,245,196,113, 42,196,149, 89, 99,208,129, 91, 73,150,229,161, 26, 17, 74,
-172,109, 50, 82,  7,170, 56, 34,132, 10, 25, 79,172, 72, 41,153, 60,157, 65,233,108,215, 94, 58,178, 66, 83, 69, 66, 53, 34,212,
- 35,114,206, 70,  6,172, 70,230, 17, 87, 99,251, 84,165,163, 42, 86, 52,  8,193,133,117, 14,157,  9, 66,171, 22,127, 73,172, 16,
-137, 68,205,132, 98,151, 70, 17,177,132, 53,239, 38,135,208,152, 24, 40,146,172, 83, 11,193, 20,254,173,141,223,251,130, 79,170,
- 96,187,249, 30,255,170, 74,116,140,107, 81, 69,114,231,163, 99,243,130, 47,186, 57,233,224, 22,245,254,117, 82,234, 92,100, 86,
- 28,184,229, 86,186,186,182, 66, 72,151,125,146,138, 69,  2, 19,107, 75, 99, 19,147, 39, 22,130,249,218, 39, 19,138,  6,186,249,
- 20, 41,  9,234,145, 63,162, 54, 34,238,186,133,235,153,116,105, 79,114,190,123, 94, 76, 13,149,234,168,227, 32,134,  7,206, 33,
- 90,177,163,105,165,243,237, 63, 70, 25, 86, 44,  5, 99,185, 15,200, 81, 53, 49, 27, 85, 88, 78, 24, 68,150,184,229, 40, 22,203,
- 91,242,112,111,100, 31,147,103,247,164,211, 39, 46, 14, 86,186, 94, 72,230, 22, 69,207, 15, 89,105,148, 79, 76,135,251,177,123,
-242, 98,163,191, 44, 69,130,133,249,212,129, 42, 42,165, 24,195, 68,125,242, 80,252,230,151, 21,229,109, 20, 59,107, 66,  8, 30,
- 52,150,141,139,191,210, 41,235,170, 79,124,229,198,236,179,173,202,170, 13, 93,197,166, 84,114,114, 19,102, 76,  4, 91,211, 81,
-124, 93,184,114,201,243, 19,161, 46, 44,167,120,119, 52, 60,171,191,130,124,152,165,247, 67,215,250,214,169, 31, 55, 99,143,171,
-243, 75,156,147,  6,122, 17, 12,168,224,202,211, 62, 15, 35,  4, 60,159,246,164,149,173, 31, 17,228,202, 15,135, 21,  1,156,  6,
-232,212,254,206, 34,152, 15,126, 53,124,171, 13,134,151,173,221, 13, 86,130,208, 58,192,170, 79, 21, 13, 46, 69, 76, 89,152,149,
- 62,213, 73,152, 71, 24,141,204,110, 86,102, 25,142,167,118,209, 54, 99,142, 42, 56,168,231,108,199, 68,138,197,194, 43,114,182,
- 73, 67, 21,140,137,254,189,  5,242, 85,  8, 63,127,  6,194,255,  9,245,  8,229,148,197,110,102, 44,166, 85,  1,221,  1, 61,131,
-148,123,160, 92, 69,247, 61, 18,117,226,106,233, 54,192,196, 30, 88,201,  1, 98, 99, 29,124, 29, 96, 35,217,174,156,226,104, 62,
- 65,199, 54, 62,211,206, 61,127,199, 70,246, 73, 90,152, 42,132,160,140,163, 81,160,170, 51, 35,132, 13,131,161,228,206,161, 37,
- 44,243,174,203,  5,208,183,109,252, 94, 31,129,222, 13,229, 44,228, 26,178,115,192, 91,160,173, 44, 43, 92,176,203,188, 17, 24,
-215,176, 85,144,250, 12,132, 75, 32, 79, 56,236,127,230,212,131,  9,112, 13,184,  2,225, 65,152, 30,193,180, 51,108,254,187,133,
- 89, 27,217, 13, 21,173,135,  6, 84, 10, 18, 77,225, 91,245,218, 12, 89, 42, 55, 75,191, 43, 15,181, 29,242,173,239,240,134, 14,
-205,246,116, 34, 86, 56,200,170, 58,190,146,165, 13, 78, 21, 73,  9,105, 54,109,140, 15, 38,  8, 28,103, 72,115,138, 38, 83, 51,
-231,134, 86,160, 75,138,230,128, 38, 19,205,  5, 41, 86, 68,  4,123, 42, 83,172,209, 81,131,106, 68,170,  9, 18,199, 72,137,132,
-186,166,228, 22,169,106, 66,108, 16,153,210,141, 55, 56,102,196,248,104,202, 72, 23,132, 74, 41,163, 26,109, 43, 19,126,  5, 60,
-198,177,191,122,237, 98,143, 81,135, 17, 83,  9,234,227,111, 37, 53,208,102,101,235,160,208,124,107,  1,177,134,251, 38,240,241,
- 22, 46,188,  2, 71,127, 15,238,254, 31, 97,244,  5, 23,200,245,130,152,  9,148,202,222, 19,237, 28,242,  6,232, 57,136,187,112,
-166,131,131,  0,223, 92,160,135, 35, 54,239, 19,206,239, 22,170,179, 53,177,142,108,205, 91,230,199, 38, 26, 12, 94,108,228,232,
-157,156,101,225, 26,180,135,128,214, 53, 42, 53, 49,103,234,209, 58, 57, 86,  6,173,242,100, 52, 45,157,129,167, 42,161,202, 32,
-213,136,166, 25, 33,227, 53, 74,168, 77,156,149,210, 32,172, 11,193,170,246,162, 62,146,212, 66, 83,  5,106,137,110,135, 19,239,
-  2,173,174, 75, 89,145,186, 49, 21,179, 91,238,106,181,168,214,164, 86,241,169, 55, 36,189,163,102, 92, 85,148, 24, 72,177,177,
-140,237,197,145,169,235,251, 17,188,  8, 41,249,197,225,107,  6, 81,235, 80, 67, 85, 67, 12, 84,185, 16,163,216,123, 32, 84, 20,
- 45,132,212, 50, 86,163,227,117, 41, 83,123,176,199,137,  5,170, 10,181, 79, 60,113,156, 39,161, 50, 77, 64,172,236,140, 81,140,
- 24, 87,215,104,206,228,182,163,116,115,155, 86,169, 35,124, 83, 50, 59, 90, 93, 13,153,  8, 37, 23,218,156,144,197,140, 74,198,
- 52,205,216,214, 17,210, 43,215,109,141, 58, 68,145,170, 12, 98,189,129,209,224, 19, 48, 45,106,130,212,176,220, 17,  7, 49, 55,
- 78,201,166,235,137,209,255,174,150,225,239, 20, 45, 52,120,170,157,247,187, 37, 91,145, 19,156,126, 22,252,153,214,254,107,241,
- 75,183,191,  4,203, 80,248, 26,  2,119,200, 84, 17,251, 59,157, 22, 74,178,113,181,222, 57, 98,247, 88,212, 97, 53,224,171, 89,
-237, 87, 40,234,119,146,219,225,138, 64,151, 11, 33,117, 52,121,252,231,129, 50,126,162, 61,150, 21,206, 91, 24,174,127, 25, 46,
-255,129,232,231,106,117,209,  1,200,177,154,139, 53, 12,213,238,188,140,131, 79, 10,250,187, 83, 79,216,207,181,223, 24, 15,161,
-113,194, 10,  6, 91, 87,  9, 31,246,235,191,  1,  3, 19, 63,235,194,153, 66, 72,  0,  0,  0,  0, 73, 69, 78, 68,174, 66, 96,130,
+int datatoc_splash_png_size = 229594;
+char datatoc_splash_png[] = {
+137, 80, 78, 71, 13, 10, 26, 10,  0,  0,  0, 13, 73, 72, 68, 82,  0,  0,  1,245,  0,  0,  1, 26,  8,  6,
+  0,  0,  0,  8, 90,206, 70,  0,  0, 10, 79,105, 67, 67, 80, 80,104,111,116,111,115,104,111,112, 32, 73, 67, 67, 32,112,114,111,
+102,105,108,101,  0,  0,120,218,157, 83,103, 84, 83,233, 22, 61,247,222,244, 66, 75,136,128,148, 75,111, 82, 21,  8, 32, 82, 66,
+139,128, 20,145, 38, 42, 33,  9, 16, 74,136, 33,161,217, 21, 81,193, 17, 69, 69,  4, 27,200,160,136,  3,142,142,128,140, 21, 81,
+ 44, 12,138, 10,216,  7,228, 33,162,142,131,163,136,138,202,251,225,123,163,107,214,188,247,230,205,254,181,215, 62,231,172,243,
+157,179,207,  7,192,  8, 12,150, 72, 51, 81, 53,128, 12,169, 66, 30, 17,224,131,199,196,198,225,228, 46, 64,129, 10, 36,112,  0,
+ 16,  8,179,100, 33,115,253, 35,  1,  0,248,126, 60, 60, 43, 34,192,  7,190,  0,  1,120,211, 11,  8,  0,192, 77,155,192, 48, 28,
+135,255, 15,234, 66,153, 92,  1,128,132,  1,192,116,145, 56, 75,  8,128, 20,  0, 64,122,142, 66,166,  0, 64, 70,  1,128,157,152,
+ 38, 83,  0,160,  4,  0, 96,203, 99, 98,227,  0, 80, 45,  0, 96, 39,127,230,211,  0,128,157,248,153,123,  1,  0, 91,148, 33, 21,
+  1,160,145,  0, 32, 19,101,136, 68,  0,104, 59,  0,172,207, 86,138, 69,  0, 88, 48,  0, 20,102, 75,196, 57,  0,216, 45,  0, 48,
+ 73, 87,102, 72,  0,176,183,  0,192,206, 16, 11,178,  0,  8, 12,  0, 48, 81,136,133, 41,  0,  4,123,  0, 96,200, 35, 35,120,  0,
+132,153,  0, 20, 70,242, 87, 60,241, 43,174, 16,231, 42,  0,  0,120,153,178, 60,185, 36, 57, 69,129, 91,  8, 45,113,  7, 87, 87,
+ 46, 30, 40,206, 73, 23, 43, 20, 54, 97,  2, 97,154, 64, 46,194,121,153, 25, 50,129, 52, 15,224,243,204,  0,  0,160,145, 21, 17,
+224,131,243,253,120,206, 14,174,206,206, 54,142,182, 14, 95, 45,234,191,  6,255, 34, 98, 98,227,254,229,207,171,112, 64,  0,  0,
+225,116,126,209,254, 44, 47,179, 26,128, 59,  6,128,109,254,162, 37,238,  4,104, 94, 11,160,117,247,139,102,178, 15, 64,181,  0,
+160,233,218, 87,243,112,248,126, 60, 60, 69,161,144,185,217,217,229,228,228,216, 74,196, 66, 91, 97,202, 87,125,254,103,194, 95,
+192, 87,253,108,249,126, 60,252,247,245,224,190,226, 36,129, 50, 93,129, 71,  4,248,224,194,204,244, 76,165, 28,207,146,  9,132,
+ 98,220,230,143, 71,252,183, 11,255,252, 29,211, 34,196, 73, 98,185, 88, 42, 20,227, 81, 18,113,142, 68,154,140,243, 50,165, 34,
+137, 66,146, 41,197, 37,210,255,100,226,223, 44,251,  3, 62,223, 53,  0,176,106, 62,  1,123,145, 45,168, 93, 99,  3,246, 75, 39,
+ 16, 88,116,192,226,247,  0,  0,242,187,111,193,212, 40,  8,  3,128,104,131,225,207,119,255,239, 63,253, 71,160, 37,  0,128,102,
+ 73,146,113,  0,  0, 94, 68, 36, 46, 84,202,179, 63,199,  8,  0,  0, 68,160,129, 42,176, 65, 27,244,193, 24, 44,192,  6, 28,193,
+  5,220,193, 11,252, 96, 54,132, 66, 36,196,194, 66, 16, 66, 10,100,128, 28,114, 96, 41,172,130, 66, 40,134,205,176, 29, 42, 96,
+ 47,212, 64, 29, 52,192, 81,104,134,147,112, 14, 46,194, 85,184, 14, 61,112, 15,250, 97,  8,158,193, 40,188,129,  9,  4, 65,200,
+  8, 19, 97, 33,218,136,  1, 98,138, 88, 35,142,  8, 23,153,133,248, 33,193, 72,  4, 18,139, 36, 32,201,136, 20, 81, 34, 75,145,
+ 53, 72, 49, 82,138, 84, 32, 85, 72, 29,242, 61,114,  2, 57,135, 92, 70,186,145, 59,200,  0, 50,130,252,134,188, 71, 49,148,129,
+178, 81, 61,212, 12,181, 67,185,168, 55, 26,132, 70,162, 11,208,100,116, 49,154,143, 22,160,155,208,114,180, 26, 61,140, 54,161,
+231,208,171,104, 15,218,143, 62, 67,199, 48,192,232, 24,  7, 51,196,108, 48, 46,198,195, 66,177, 56, 44,  9,147, 99,203,177, 34,
+172, 12,171,198, 26,176, 86,172,  3,187,137,245, 99,207,177,119,  4, 18,129, 69,192,  9, 54,  4,119, 66, 32, 97, 30, 65, 72, 88,
+ 76, 88, 78,216, 72,168, 32, 28, 36, 52, 17,218,  9, 55,  9,  3,132, 81,194, 39, 34,147,168, 75,180, 38,186, 17,249,196, 24, 98,
+ 50, 49,135, 88, 72, 44, 35,214, 18,143, 19, 47, 16,123,136, 67,196, 55, 36, 18,137, 67, 50, 39,185,144,  2, 73,177,164, 84,210,
+ 18,210, 70,210,110, 82, 35,233, 44,169,155, 52, 72, 26, 35,147,201,218,100,107,178,  7, 57,148, 44, 32, 43,200,133,228,157,228,
+195,228, 51,228, 27,228, 33,242, 91, 10,157, 98, 64,113,164,248, 83,226, 40, 82,202,106, 74, 25,229, 16,229, 52,229,  6,101,152,
+ 50, 65, 85,163,154, 82,221,168,161, 84, 17, 53,143, 90, 66,173,161,182, 82,175, 81,135,168, 19, 52,117,154, 57,205,131, 22, 73,
+ 75,165,173,162,149,211, 26,104, 23,104,247,105,175,232,116,186, 17,221,149, 30, 78,151,208, 87,210,203,233, 71,232,151,232,  3,
+244,119, 12, 13,134, 21,131,199,136,103, 40, 25,155, 24,  7, 24,103, 25,119, 24,175,152, 76,166, 25,211,139, 25,199, 84, 48, 55,
+ 49,235,152,231,153, 15,153,111, 85, 88, 42,182, 42,124, 21,145,202, 10,149, 74,149, 38,149, 27, 42, 47, 84,169,170,166,170,222,
+170, 11, 85,243, 85,203, 84,143,169, 94, 83,125,174, 70, 85, 51, 83,227,169,  9,212,150,171, 85,170,157, 80,235, 83, 27, 83,103,
+169, 59,168,135,170,103,168,111, 84, 63,164,126, 89,253,137,  6, 89,195, 76,195, 79, 67,164, 81,160,177, 95,227,188,198, 32, 11,
+ 99, 25,179,120, 44, 33,107, 13,171,134,117,129, 53,196, 38,177,205,217,124,118, 42,187,152,253, 29,187,139, 61,170,169,161, 57,
+ 67, 51, 74, 51, 87,179, 82,243,148,102, 63,  7,227,152,113,248,156,116, 78,  9,231, 40,167,151,243,126,138,222, 20,239, 41,226,
+ 41, 27,166, 52, 76,185, 49,101, 92,107,170,150,151,150, 88,171, 72,171, 81,171, 71,235,189, 54,174,237,167,157,166,189, 69,187,
+ 89,251,129, 14, 65,199, 74, 39, 92, 39, 71,103,143,206,  5,157,231, 83,217, 83,221,167, 10,167, 22, 77, 61, 58,245,174, 46,170,
+107,165, 27,161,187, 68,119,191,110,167,238,152,158,190, 94,128,158, 76,111,167,222,121,189,231,250, 28,125, 47,253, 84,253,109,
+250,167,245, 71, 12, 88,  6,179, 12, 36,  6,219, 12,206, 24, 60,197, 53,113,111, 60, 29, 47,199,219,241, 81, 67, 93,195, 64, 67,
+165, 97,149, 97,151,225,132,145,185,209, 60,163,213, 70,141, 70, 15,140,105,198, 92,227, 36,227,109,198,109,198,163, 38,  6, 38,
+ 33, 38, 75, 77,234, 77,238,154, 82, 77,185,166, 41,166, 59, 76, 59, 76,199,205,204,205,162,205,214,153, 53,155, 61, 49,215, 50,
+231,155,231,155,215,155,223,183, 96, 90,120, 90, 44,182,168,182,184,101, 73,178,228, 90,166, 89,238,182,188,110,133, 90, 57, 89,
+165, 88, 85, 90, 93,179, 70,173,157,173, 37,214,187,173,187,167, 17,167,185, 78,147, 78,171,158,214,103,195,176,241,182,201,182,
+169,183, 25,176,229,216,  6,219,174,182,109,182,125, 97,103, 98, 23,103,183,197,174,195,238,147,189,147,125,186,125,141,253, 61,
+  7, 13,135,217, 14,171, 29, 90, 29,126,115,180,114, 20, 58, 86, 58,222,154,206,156,238, 63,125,197,244,150,233, 47,103, 88,207,
+ 16,207,216, 51,227,182, 19,203, 41,196,105,157, 83,155,211, 71,103, 23,103,185,115,131,243,136,139,137, 75,130,203, 46,151, 62,
+ 46,155, 27,198,221,200,189,228, 74,116,245,113, 93,225,122,210,245,157,155,179,155,194,237,168,219,175,238, 54,238,105,238,135,
+220,159,204, 52,159, 41,158, 89, 51,115,208,195,200, 67,224, 81,229,209, 63, 11,159,149, 48,107,223,172,126, 79, 67, 79,129,103,
+181,231, 35, 47, 99, 47,145, 87,173,215,176,183,165,119,170,247, 97,239, 23, 62,246, 62,114,159,227, 62,227, 60, 55,222, 50,222,
+ 89, 95,204, 55,192,183,200,183,203, 79,195,111,158, 95,133,223, 67,127, 35,255,100,255,122,255,209,  0,167,128, 37,  1,103,  3,
+137,129, 65,129, 91,  2,251,248,122,124, 33,191,142, 63, 58,219,101,246,178,217,237, 65,140,160,185, 65, 21, 65,143,130,173,130,
+229,193,173, 33,104,200,236,144,173, 33,247,231,152,206,145,206,105, 14,133, 80,126,232,214,208,  7, 97,230, 97,139,195,126, 12,
+ 39,133,135,133, 87,134, 63,142,112,136, 88, 26,209, 49,151, 53,119,209,220, 67,115,223, 68,250, 68,150, 68,222,155,103, 49, 79,
+ 57,175, 45, 74, 53, 42, 62,170, 46,106, 60,218, 55,186, 52,186, 63,198, 46,102, 89,204,213, 88,157, 88, 73,108, 75, 28, 57, 46,
+ 42,174, 54,110,108,190,223,252,237,243,135,226,157,226, 11,227,123, 23,152, 47,200, 93,112,121,161,206,194,244,133,167, 22,169,
+ 46, 18, 44, 58,150, 64, 76,136, 78, 56,148,240, 65, 16, 42,168, 22,140, 37,242, 19,119, 37,142, 10,121,194, 29,194,103, 34, 47,
+209, 54,209,136,216, 67, 92, 42, 30, 78,242, 72, 42, 77,122,146,236,145,188, 53,121, 36,197, 51,165, 44,229,185,132, 39,169,144,
+188, 76, 13, 76,221,155, 58,158, 22,154,118, 32,109, 50, 61, 58,189, 49,131,146,145,144,113, 66,170, 33, 77,147,182,103,234,103,
+230,102,118,203,172,101,133,178,254,197,110,139,183, 47, 30,149,  7,201,107,179,144,172,  5, 89, 45, 10,182, 66,166,232, 84, 90,
+ 40,215, 42,  7,178,103,101, 87,102,191,205,137,202, 57,150,171,158, 43,205,237,204,179,202,219,144, 55,156,239,159,255,237, 18,
+194, 18,225,146,182,165,134, 75, 87, 45, 29, 88,230,189,172,106, 57,178, 60,113,121,219, 10,227, 21,  5, 43,134, 86,  6,172, 60,
+184,138,182, 42,109,213, 79,171,237, 87,151,174,126,189, 38,122, 77,107,129, 94,193,202,130,193,181,  1,107,235, 11, 85, 10,229,
+133,125,235,220,215,237, 93, 79, 88, 47, 89,223,181, 97,250,134,157, 27, 62, 21,137,138,174, 20,219, 23,151, 21,127,216, 40,220,
+120,229, 27,135,111,202,191,153,220,148,180,169,171,196,185,100,207,102,210,102,233,230,222, 45,158, 91, 14,150,170,151,230,151,
+ 14,110, 13,217,218,180, 13,223, 86,180,237,245,246, 69,219, 47,151,205, 40,219,187,131,182, 67,185,163,191, 60,184,188,101,167,
+201,206,205, 59, 63, 84,164, 84,244, 84,250, 84, 54,238,210,221,181, 97,215,248,110,209,238, 27,123,188,246, 52,236,213,219, 91,
+188,247,253, 62,201,190,219, 85,  1, 85, 77,213,102,213,101,251, 73,251,179,247, 63,174,137,170,233,248,150,251,109, 93,173, 78,
+109,113,237,199,  3,210,  3,253,  7, 35, 14,182,215,185,212,213, 29,210, 61, 84, 82,143,214, 43,235, 71, 14,199, 31,190,254,157,
+239,119, 45, 13, 54, 13, 85,141,156,198,226, 35,112, 68,121,228,233,247,  9,223,247, 30, 13, 58,218,118,140,123,172,225,  7,211,
+ 31,118, 29,103, 29, 47,106, 66,154,242,154, 70,155, 83,154,251, 91, 98, 91,186, 79,204, 62,209,214,234,222,122,252, 71,219, 31,
+ 15,156, 52, 60, 89,121, 74,243, 84,201,105,218,233,130,211,147,103,242,207,140,157,149,157,125,126, 46,249,220, 96,219,162,182,
+123,231, 99,206,223,106, 15,111,239,186, 16,116,225,210, 69,255,139,231, 59,188, 59,206, 92,242,184,116,242,178,219,229, 19, 87,
+184, 87,154,175, 58, 95,109,234,116,234, 60,254,147,211, 79,199,187,156,187,154,174,185, 92,107,185,238,122,189,181,123,102,247,
+233, 27,158, 55,206,221,244,189,121,241, 22,255,214,213,158, 57, 61,221,189,243,122,111,247,197,247,245,223, 22,221,126,114, 39,
+253,206,203,187,217,119, 39,238,173,188, 79,188, 95,244, 64,237, 65,217, 67,221,135,213, 63, 91,254,220,216,239,220,127,106,192,
+119,160,243,209,220, 71,247,  6,133,131,207,254,145,245,143, 15, 67,  5,143,153,143,203,134, 13,134,235,158, 56, 62, 57, 57,226,
+ 63,114,253,233,252,167, 67,207,100,207, 38,158, 23,254,162,254,203,174, 23, 22, 47,126,248,213,235,215,206,209,152,209,161,151,
+242,151,147,191,109,124,165,253,234,192,235, 25,175,219,198,194,198, 30,190,201,120, 51, 49, 94,244, 86,251,237,193,119,220,119,
+ 29,239,163,223, 15, 79,228,124, 32,127, 40,255,104,249,177,245, 83,208,167,251,147, 25,147,147,255,  4,  3,152,243,252, 99, 51,
+ 45,219,  0,  0,  0,  9,112, 72, 89,115,  0,  0, 11, 19,  0,  0, 11, 19,  1,  0,154,156, 24,  0,  0,  0,  7,116, 73, 77, 69,  7,
+220,  4, 26, 17, 37, 54, 89,161,235,246,  0,  0, 32,  0, 73, 68, 65, 84,120,218,236,189,123,184,110, 87, 93,223,251,249,253,198,
+ 24,115,206,119,173,189,119,216, 33, 23, 18,238,225,242, 88,180,162, 36, 94, 16,139, 96, 55,167,199,123,233, 49,248,148,199, 43,
+167, 36, 94,122,144, 99,213,192,169, 85,218,199,138,212, 99,165, 96,149, 68,212, 90,107, 61,199,160, 85,171, 88, 32, 41, 94,224,
+ 40, 98,138, 90,193, 90, 32,  4, 80,  2,  9,201,190,173,245, 94,230, 24,227,247, 59,127,140,119,101,175, 44,118,246, 45, 59,  9,
+  9,243,243, 60,235, 89,239,251,174,249,142, 57,199,156,115,141,239,239, 54,199,128,137,137,137,137,137,137,137,137,137,137,137,
+137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,
+137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137, 51, 71, 30,138,157,250,175,191,228,133,100,127, 25,
+ 74,135,250, 27,248,251,255,238, 63,136,224,211,229,152,152,152,152,152,152,120, 24,137,186,255,198, 55, 63,159, 99,219,255,149,
+ 35,219,206,254, 11,224,162, 11,133, 50,254, 71,198, 99,215,202,139,110,220,154, 46,201,196,196,196,196,196,196,185,161, 15,250,
+ 30, 63,118,235, 38,183,223,  6,119,254,205,130, 15,255,213,156,219,110,157,227,225,197, 12,  7,255,220,127,251,165, 79,159, 46,
+201,196,196,196,196,196,196,195, 69,212,191,253, 29,191,205, 76, 95,201,190,110,  3, 33,114,231,199,140, 91,255,114,206, 50, 63,
+  9, 75,127,233,191,253,210,255,109,186, 44, 19, 19, 19, 19, 19, 19,103,143, 60, 84, 59,246,215,127,241, 87,176, 44,111, 98,229,
+ 61,181, 44,232,  6,229,  9, 79,141, 92,248,232,142,186,122, 45,218,189, 66,190,242,245,171,233, 18, 77, 76, 76, 76, 76, 76,124,
+154,139, 58,128, 95,127,229, 83,216, 14,111,102, 89,159, 78,174,115, 66,128,203,159,172, 60,230,242,  1,203,127, 70,240,191, 47,
+ 95,241,134,219, 30, 46, 39,211,221,175,  4, 14,174,223,222, 42, 34,183, 62,146,111,158,207,180,254, 78, 76, 76, 76, 76,162,126,
+ 58, 97,248,177,207,221, 36,165,255,192,220,191,150,236, 75, 48,184,244,241,194,101, 79,152, 17,100, 36,149,175,150,191,119,253,
+219,206,179, 24, 93,  1, 92,113,134,155, 31, 22,145, 91,206,176,221,183,  1,135,214,111, 95, 33, 34,175,121,132,139,250,103, 84,
+127,207,211, 57, 19, 17,153,158,244,152,152,152,120, 64,136,247,123,144,122,251,243, 34, 31,237,250,147,254,241,248, 40,236,239,
+ 28, 46,133, 75,129,163,203, 19, 70, 68,191, 95, 72, 43,129, 11,193,239,122, 57, 31,249, 72,207,150,253, 47, 24, 35,135, 63,  9,
+ 27,251,150, 60,234,226, 68,237,222,234,255,229, 31,255, 32,253, 95,188, 90,158,255,187,229, 60,245,251,106,224, 71,207, 98, 32,
+  6,184, 17,184, 73, 68,110,152,110,155, 71,132,184,170,136,216,158,168,195, 55,  0,207, 94, 27,124,  7,129,158, 19,117, 39,  6,
+ 44,128, 15,  2, 63, 37, 34,215,159,147, 21,125, 26, 65,119,247,207, 91,223,159,135,128,199,  2,151,  0, 35,240, 49,224,189,192,
+ 59,128,223, 18,145,191,186,143,239, 95, 14,124, 33,240,  5,192,149,192,229,192, 69,192,163,129, 79,  2,183,  2, 31,  2,222,  2,
+252,242,238,115, 48, 49, 49,241, 25,236,169,251,171, 94,165, 28,184,249, 26,170,252, 83, 68, 46, 34,  4, 67,  4, 84,219,143,  8,
+132, 32,168, 66, 88,191, 87,  5, 93,127, 38,  2,178,179,173, 86, 66, 88,225,178,137,236,218, 54,  4, 48,148,161, 75, 72,253, 61,
+102, 92, 45,207,125,253,157,231, 97, 64,191,238,108, 68,125, 15, 55,  1, 47, 18,145,195,147,167,254,200,233,175,175, 45,183,179,
+224, 40,240, 66, 17,121,251,121,218,255,229,192, 79,  0, 47, 58, 67,227, 64,206, 67, 63,222,  7,188, 82, 68,126,115, 26, 10, 39,
+ 38, 30, 25,156,123,245,251,163,110,254,110,208,159,166,112,  9, 38, 66, 37, 80, 37,180,223,235,215,133, 64,241, 64,246,246,122,
+244,192,104, 74,118,101,164,125,222,126, 58,114,221,135, 59,109, 10, 26,105,191,221, 65,197,200,117, 69,213, 47, 99, 46,255,195,
+111,254,174,103, 61,  0,231,225,166, 83,252,236,229, 16,240, 54,119, 63, 56,221, 62,159,209, 92,  0,220,236,238,223,112, 30,  4,
+253,179,129,247,156,169,160,159, 71,158,  1,252,186,187,127,221,116, 57, 39, 38, 30, 25,156, 83,248,221, 95,133, 98,254, 29,204,
+179, 83,115,166, 26,136, 72,243,251,165,249,255, 66,243,184, 17,230,185,110, 16, 20,125,244, 37, 16, 35, 84, 71,154,135, 14,106,
+237,119, 85, 80, 95,191,151, 29, 15,158,126, 72, 43,  4,168,140, 84, 14, 66,186,197,111,126,217,119,240,229,255,230,250,243,149,
+155, 20,145, 23,156,102,208,221,  9,215,239,228,225,175,  4,174,  1,166, 28,242, 35,147,191,  1,126,151, 22,162,126, 55,240, 17,
+ 90,  2,233, 31,  0,255, 24,120,210,206,173,  3,252,146,187,191, 93, 68,238, 56, 71, 65,127, 10,240,118,224,226,245, 71, 35,240,
+ 70,224,215,104,225,246, 79,  2,  3, 45, 20,255, 12,224, 57,192, 87,159,162,201,143,  1,239, 90,255,220,  2,220, 14,220,  1, 28,
+  3, 30, 71, 11,205,191, 10,120,250,174, 62,252,123,119,255,  2, 17,249,159,211,165,159,152,120,120,115,238,225,247,215, 61,231,
+ 90,142, 47,223, 64,169,107,241,222,213,154,200,137,215,165,218,124, 68,101,255, 65,100,255,254, 19, 97,247, 16, 16, 13,160,  2,
+178, 78,149,171,180,144,187,106,107, 76, 35,125, 63, 91,177,179, 29, 65, 16, 81,134, 24,193,222,196,252,130,111,145,175,125,213,
+252, 28,  6,210,123,133,223,239, 43,148,185,231, 59, 87,  0,127,194,137,106,239, 91, 68,228,170, 61,219, 76,225,247,135,207,177,
+119, 34, 50,238,122,191,  5,252, 50,112,157,136,220,125,154,239,254, 24,240,189,187, 62,122,179,136,124,213, 57, 28,131,172,141,
+135,231,174, 63,250,  0,240,149, 34,242,254,  7,184,239,195,250, 94,254,236, 93, 31,255,107, 17,249, 39,211,144, 56, 49,241, 25,
+232,169,  3,200,203,222,121,189,255,235,103,221, 76,208,167, 98, 42,136,237, 42,184,209,245,235,186,162,219,124,246,106, 57,252,
+232, 70,154, 97,102, 77,180,  5, 48,195,199, 45, 36,  8,250,248,103,162, 23, 63, 21, 57,240, 24,100, 56,  0,101,133,109,223,137,
+ 31,191,157,213,157,255,179,103,181,  5, 97,  6, 82, 65,  3,178,101,116,155,253,215,179,239,216,147,253, 45,223,251,101,242,247,
+254,239,237,  7,220,250, 17,185,213,221,111, 92,123,232, 59,222,250,249, 24, 96, 15,238,105,235,150,147,229,235,207,161,221,221,
+ 21,254,231,244,184,217,249,104,227,193,232,239,158,227, 60,163,246,118, 11,250,250,253,190,179,184, 23,190,207,221,159, 67, 43,
+170, 99,151, 40,159, 45,223,186,235,187,119,  3,207, 23,145,191,126, 16,238,229,165,187,127, 63,240,219,187, 62,190,106, 26, 14,
+ 39, 38, 62,131, 69, 29, 64,190,231,191,125, 96,237, 93,156,124,176,253,133,175,253, 92,150,229, 27,247,  5,167,152, 55,111,123,
+185,196, 87,219, 80,183,  9, 79,255, 59,196,171, 94, 76,120,242, 23,127,202,119,119,146,253,126,247,109,148, 15,222, 76,253,240,
+ 59,145,208,129, 59, 46, 48,206, 71,186,141,238, 74,130,191,217,255,228,154, 67,114,213, 13,249, 65, 56, 95,231,229, 57,236,181,
+176, 93, 67,171,114,190,242, 36,127,191, 21,184,  1,184,225,190,  4,202,221,127,116,215,119,111, 20,145, 27,118,181,123, 13,123,
+ 30,217, 91,183,249,154, 51,169,222,119,247,107,128,235,238,163,141, 83, 30,215,  3,209,223, 83,244,245,186,117,187,187,235, 27,
+110,  2, 94,240, 32,220, 11, 63,  4,188,117,253,122,243, 28,219,120,217,174,215,215, 61, 24,130,190,139,255,182,231,253,231, 77,
+195,225,196,196,103,184,168,159,114, 32,255,185, 23, 92,203,214,242, 13, 20,169,165, 58,158, 87,248,114, 14,101,  5,209,233,191,
+242,149,196,171,254,225,233, 13,135, 11,159, 68,186,240,127, 71, 31,243,185,148,119,191, 17,180, 54,201, 23,129,209, 70, 54,210,
+115, 57,188,241, 67,192, 15, 60,  8,231,107,183,120,156,147,119,233,238,135,128, 95,217,211,214, 94,174,160,165,  7,174,113,247,
+ 23,221,199,115,242, 87,114, 34,244,125,211,250,145,172,235, 79, 17, 65,184,  2,184,222,221,175, 20,145,107, 79, 33,190,215,175,
+197,247, 84,199,117,181,187,191,224, 65,236,239,201,250,250,182,211,180,249, 64,243,174,221,183,233, 57,220,  7, 87,237, 18,210,
+187,128, 95,124,144,143,127,175, 17,252,201,105, 56,156,152,152, 68,253, 83,  7,171,235,191,122,  3, 91,188,158,109,127,  9, 85,
+ 86,120,174,190,181,181, 65,201, 32,142, 36,232, 95,248,106,194,231,156, 72, 65, 30, 91,172,120,203,159,222,198, 91,254,236, 54,
+238,222, 90,144,130,240,183, 46,191,144,175,189,234,169, 60,235, 41,151,  1, 16, 30,255,  5, 72,183,159,252,142, 31,135, 46,  2,
+222,220,249, 69, 46,164,248, 79,253,237,255,231,191,147,231,255,196,  7, 30, 48, 35,165,  9,222,213,123, 60,194,179,109,227,234,
+181,192,237,230,150,117, 91, 59, 70,194,110,111,246, 10, 90,165,253, 11, 78, 51,  1,206,193,117,187, 59,158,245,141,235,118,119,
+  4,113,247,113, 95,227,238,183,222, 71,254,251, 71, 79, 34,232,187,219,218, 57,182, 43, 79,210,143,  7,171,191,  7,247,  8,250,
+225, 93,199,119,197,131,248,191,243,249,187, 94,215,115,248,254,151,239,122,253,159, 68,228,193,158, 18,249,153,123,222,255,233,
+ 52, 28, 78, 76, 76,162,126,239, 65,252, 13,207,125, 26,171,173, 55, 83,244,169, 56, 11,234,220,201, 43, 48,131, 24,144,178, 77,
+122,206, 63,186,151,160,255,209,251,111,231,251,126,233, 15,184,245,147,199, 25,250, 68,138,138, 58,252,217, 71,239,230, 77,127,
+248, 63,248,154,171,158,194, 63,187,250,239,176,209, 39,244,210,207, 34,126,206,139, 40,239,249,121,216,127,233, 78,133,189,225,
+  2, 37,252, 27,224,171, 30,136,147,180,203,131,221, 45, 26, 55,156,101, 27, 87,172,219,216,225, 86,224, 90, 17,217,107, 28,188,
+102,143,119,187,179,239, 83,229, 60,175,219, 37,192,215,238, 13, 97,175,247,253, 43,187,196,243, 58,119,191, 87,168,123, 29,114,
+191,102,143,248,190,104, 79, 30,125,247,177, 29,122,136,250,123,221,174,246, 94, 33, 34, 55,158,228, 90, 61, 24,236, 46,148, 59,
+151,185, 19,190,112,215,235, 63, 88, 31,251, 69,180, 60,251,215,175,239,181,  3,180, 92,251,  7,105,  5,117, 63,127,158,234, 26,
+ 34,247,158,167,193,128, 31,158,134,195,137,137, 73,212, 79, 12, 20,255,246, 75,255, 87, 22,254,235, 20, 34, 90,231,148, 17,106,
+ 89, 87,180, 11,120, 69, 46,122, 60,241, 11,191,249,158,239,188,255,227,135,249,230,127,251, 22,238, 88, 20, 54, 54,103,228, 16,
+ 72, 41,208,  5, 33,120,135,212,194,175,190,235,  3,  4, 85,126,248,197,207,107, 30,251, 83,159, 79,253,171,255,  2,117, 11,210,
+190, 38,236,181, 22,130, 28,242,223,127,249,101,242,220,215,222,126, 14,131,220,117,167,248,243,161,147,  8,216,201,196,233,116,
+ 92,191,199,187,188,234,190,242,210, 34,114,211, 58,188,189,227,145, 94,233,238,215,156, 38, 31,126,147,136,188,232, 62,218,187,
+213,221, 95,177,110,111,199,219, 61,180, 54,  2,246,138,229,142, 96,190,224,100,199,183,235,216,254,228, 33,236,239,173,247,213,
+222,249, 40, 50, 60,131,251,229, 82,224, 43,118,125,244,230,115,104,230, 25,187, 94,255,249,250, 89,241, 55,210,102,127,219,205,
+101,235,159, 47,  5, 94,233,238,111,  0,254,201,217,122,246,238,174,180, 71,218, 62,159,246, 72,219,231,237, 18,244,239, 21,145,
+247, 76,195,225,196,196, 36,234,248,245, 87, 38,150,179, 31,102,229,223, 79,145, 21,161,172,168, 45,212, 78,218, 41,119, 19, 60,
+143,196,167, 63, 23,217,119, 98,204,122,197, 47,189,147,247,255,245, 81,184, 96, 31, 71,183, 10, 72, 37,  8,108,  4,225,162,205,
+200,193, 89,228,130, 11,246,241,235,127,252,126,158,247,217, 79,228,208, 51,159, 12, 33, 18,174,120, 46,229, 79,127,  1, 54, 15,
+128, 91,155,160, 38,133,142,108, 95,  7,188,225, 28,186,113,166,179,203,221, 64, 43,212, 58, 43, 65, 95,231,128,119, 27,  6,175,
+ 56,157,248,136,200, 45,238,126,195, 46,177, 61,116,154,232,192,181,167,105,239, 38,119,191,133,123,135,186,119,142,239,234, 61,
+ 81,136,215,156,234,248,118, 29,219, 53, 15, 81,127, 95,243, 96,136,247, 41,120, 39, 16,214,175, 51,240,221,231,208,198,133,123,
+188,246, 55,112,250,220,124,  0,190, 11,248, 60,119, 63, 36, 34,203, 51,184,247, 78, 53,151,195,123,214,215,230,173,211, 80, 56,
+ 49,241,200,224,126,173,167,238,175,251,162,199,113, 60,189,147,101,253,126,178,207,145, 90,169,185, 13, 61, 81, 32,136, 16, 69,
+ 36, 40, 18,  5,189,252,115,238,249,238,135, 62,113,132,223,249,211,143,192,198,236,196,179,233, 33, 80, 81,142,175, 42, 31,186,
+115,206,173,119,204,201, 46, 88,  8,220,252,223, 63,124, 66,  0, 46,122, 42,190, 56,  6,148,117,  8,222,161, 24,216,189, 66,154,
+ 15,  4, 87,175,189,200,179, 13,241,238, 22,184,195,103, 49,127,252, 77,123,246,125, 95,220,114,134, 97,217, 91,238,227,152, 14,
+237, 17,216, 51, 57,190, 27, 31,162,254,222,250, 80,206,191,239,238,191, 14, 60,101,215, 71,175, 20,145,173,115,104,234, 81,187,
+ 94,191,118,151,160,223, 12,124, 29,109,178,155,110,253,251,235,128,255,186,107,251,231,  0, 63,121, 63,187,242,139,192, 63,156,
+  4,125, 98, 98,242,212,219,224,246,250, 47,126, 14,243,122, 51, 89, 19, 81,230,  4,107, 94,179, 35, 20, 17,162, 56, 65,214,179,
+195, 85, 36,118,232,193, 39,220,243,253,219,238, 60,198, 98,158,225, 64,207, 61, 83,208,237,248, 20,170,224,206,145,173, 76, 30,
+ 11,143,187, 32,114,124,121,162, 88, 87,246, 95,218,156,150,213, 54,204,246, 11,224,228,  2,145,103,186,191, 74, 69, 94,117,182,
+139, 84,188,226, 20,127,187, 98, 45, 82, 59,139,124,220, 83,253,125, 22,222,226,161,251, 16, 86,206,192,187,190,151,  7,124, 31,
+  5,100,103, 26, 57,184,245, 20,125, 60,171,182,246, 30,219,131,216,223, 91, 30,170,127, 22,119,255,169,181,192,238,240,123, 34,
+242,227,231,193,160,158,173,127,255, 11, 17,249,161, 61,219,221,  1,252, 38,240,155,238,254, 47,128,127,182,254,252,219,220,253,
+181, 34,242, 23,231,184,255,111,  2,190,105, 29,189,249, 54, 17,249,239,211,112, 56, 49,241, 25, 40,234,254, 43, 87,  7, 62,252,
+161,239,225,120,249, 87, 84, 25,233, 89,162, 38, 84,119,178,  9, 65, 58, 18,135,169,190, 73, 12,205,107,183,181, 27,226, 39, 22,
+ 89,187,228,130, 13, 66,151,168,  6,184,112, 98,222,247,245,111, 23,  8,202,246, 60,243,225,229,146,254,153,187, 14,213, 43,120,
+134,178,  4, 61,  0, 94,  5,170, 83,253,114,126,231,174,  4,156, 85,190,241, 76,102, 66, 91,231,221,175, 91, 11,251,206, 35, 85,
+103, 58, 97,199,238,199,204,174, 88,207,196,118, 46,220, 87,132,224,254,134,162,207, 73,132,215,219, 94,249, 32,247,247, 33, 17,
+117,119,127, 45,240, 29,187, 62,122,159,136, 60,239,126, 52,121,156,123,135,224,223,118, 18, 65,223,123,159,254,160,187, 63,123,
+125,189,148, 86, 84,247,189,167,249,142,172,143, 63,  2,143, 95, 27,112,255,136, 54,207,188,174,175,213,187,221,253, 37, 34,242,
+ 31,167, 33,113, 98,226, 51, 72,212,253,250, 43, 47,224,182, 15,190,137, 81, 14, 33,178, 96, 22, 64, 17,178, 57,171, 26,233,180,
+163,151,151,130, 95, 65,229, 21, 56, 75,180,133,223,201, 25,251,228,  7,208,199,127,  1,  0,127,235,177,143,230,139,158,118,  9,
+255,223, 95,222,217,230,131,119,105,115,191,123, 51,  2,  0,176,230,233, 47,239,222,230,105,143, 57, 49,190,251,177,143,193,234,
+ 24,140,115, 95, 91,  4, 96, 56, 10,204,142, 63, 32,107,196,139,200,107,214, 94,228, 78,254,253, 76,138,215, 78, 38, 78,103,179,
+150,251, 67,193,225,243,176,237,195,169,191,103, 34,232,175,167,205,249,190,195,135,248,212, 71,194,238,175,168,191,238, 12,191,
+247,186, 93, 70,216,243,207,226,254, 45,235,227,254, 16,109, 33,154,235,105,147,231, 36,218, 18,179, 55,184,251, 31,138,200,135,
+166, 97,113, 98,226, 51, 64,212,253,199,191,240,153,220, 85,255, 51, 69, 30, 79, 10,115,  6,109,226, 57,154, 51,214,129, 65,150,
+204,228,107,229,255,248,227,183,248,143, 95,245,195,152,  8,130,180,202,119,129,168,248, 39, 78, 68, 10, 85,133, 31,120,225, 85,
+124,229,251,126, 11,150, 25,250,174,109,199, 90,212,141, 22,206,223,154,243,249,207,120, 44,223,244,101, 39,166,169,182, 59,254,
+ 18,247, 12,117,108, 27,186,  3,166, 32,183,243,188, 39,141, 15,212,201, 90, 11,251,238,162,186,171, 57,203, 71,219,104, 33,240,
+115,125, 44,233,240,195,240, 30,123, 88,247,215,221,127, 26,248,246, 93, 31,253, 13,240, 89,107,145,188, 63,252, 53,240,196, 93,
+239,255,232, 12,191,183,123,187, 39,220,143,123,249,119,221,253,135,128, 31, 89,127,180, 73,155, 37,239, 91,167, 97,113, 98,226,
+ 17, 44,234, 14,194,143,125,254, 75, 88,214,159,193,164, 48, 11,115,122, 21,220,157, 69,117,204, 55,217, 23,254,138,153,124,141,
+124,251,187,214, 11, 81,200,  7, 16,  7,199, 81, 17, 84, 96,216,160,222,246, 14,226,225,219,144,131, 79,  2,224, 43, 62,255, 73,
+220,240, 29,207,231,229, 63,251,  7,204,143,172, 96,232,219,218,235,238, 48,102,152, 47,120,214,103, 93,202,155,190,239,171,216,
+ 28, 82,107, 58, 47,168,239,251, 85,164,235,219, 92,240,110, 96,214,188,244,232,239, 57,135,124,250,217,114,211, 46, 79,233,208,
+ 57,124,255,134, 71,250, 66, 47,143,148,254,186,251,207,  1,223,182,235,163, 79,  0, 79,223, 59,111,252, 57,242, 23,180,130,183,
+ 29,142,156,225,247,118,111,119,193,253, 60,134,223,222, 37,234,112,158,214, 51,152,152,152,120,232, 56,125,245,251,143, 95,117,
+ 13, 89,223,  8,186,100,127,202,204,130,224, 56,219, 21, 84, 54,217,  8,191,198,197,242,133, 39,  4, 29, 24,120, 47,218,210,220,
+ 64, 19,234, 24,161,108,145,223,241, 19,247,106,254,165,127,247,179,249,195, 87,127, 61, 47,255,234,191,205,147, 47,236, 25, 60,
+179, 79, 43, 95,242,180,139,248,201,239,252,114,126,255, 95, 94,205,147, 47, 61, 49,118,149,119,191, 17, 63,114, 27,164, 30,164,
+ 89, 14,148,245,243,240,226,183,124,154,158,231,251,170, 58,127,184, 31,223,161,135,105,127,207, 68,208,127,121,143,160,223,185,
+ 22,244,249,121,218,197,222, 25,220, 30,117,134,223,123,212, 57, 24,  2,247,197,222, 80,251, 19,167, 33,113, 98,226, 17,236,169,
+251,245, 87,110,112, 71,253, 17, 76, 70, 14,  4, 72, 34,100,119,230, 57,208,105, 79,210,127,197,144,127, 64,190,241,150,123,207,
+ 35, 29,237,189,136,126,148,106,143,193,189, 14, 93, 88, 34, 64,191,143,229, 71,126,127, 40,239,124, 45,241, 57, 47,191,103,243,
+207,125,226, 69,252,196, 75,158,203,171,191,169,240,241,187,183,233, 82,228,242, 11, 63,117,141,140,250,190,223,160,252,249, 47,
+194,176,177, 54, 73, 66, 43,208,171, 38,120,206,168,255,214,131,112,206,206, 37, 63,188,187,160,236,144,187, 31,124,136,159,179,
+222,203,173,187,142,239,140,188,181,245,179,232, 15,215,254,158,174,111,191,  6,188,112,215, 71,119,173,  5,253,216,121,220,205,
+127,  6,126,138, 19,143,178, 61,123,253,217,233,120,246,174,215, 31,190,159,199,240,185,123,222,191,111, 26, 18, 39, 38, 30,201,
+158,250,130,139,112, 14,130, 20,204,157,121,117,230,165,163, 19, 97, 63, 47,146,239,254,163,235,228,218, 91, 62,101,117, 52,185,
+246,150, 57,189,188, 30,241,196,178,250, 58,136, 47,168,138,108,236,167,254,249,191, 39,223,244,  3,248,252,222,107, 72, 12, 41,
+242,164, 75, 47,248, 84, 65,207, 11,234,187,126,138,242,  7,255, 18,233, 59, 36,132,182,132,123,234, 33,103, 48, 75, 80,223, 44,
+ 47,184,225, 35, 15,240, 96,191,183,232,235, 76, 35,  3,123, 31, 19,187,230,211,236, 62,216,125,124,  7,215,211,182,158,171,151,
+254,112,232,239,169,174,241,111,157, 68,208,159, 42, 34, 71,206,231,126, 68,228,111,128,119,236,250,232,101,103,248,213,221,219,
+221,124, 63, 15, 99,239, 92,  0,239,158,134,196,137,137, 71,178,168, 95,190,248, 56,179,112, 27, 73, 54,216,206, 27,152,109,176,
+ 33,199,217, 31,158, 43,215,254,241,141,167,142,  1,116,111, 36,112,148, 85,137,100,107,207,171,  7,218,148,177,155,251,177, 15,
+254, 14,227,175,126, 51,245,189,191,138, 31,251,155,147, 15,176,219,119, 98, 31,188,137,241, 63,189,132,242,158,159,129, 97,128,
+ 16,219,100, 51, 34, 32, 73, 88,100, 33, 56, 56,175,124,128,  7,251,157, 69, 83,118,115,227, 25, 14,224, 55,114,239, 98,177,235,
+ 78,227,233, 62,216,220,200,189,139,210,174, 59,131,115,113,221,195,184,191,247,213,175,183,114,239,245,  3,118, 60,244, 35, 15,
+208, 46,119,207,183,126,200,221,255,249,105,142,239,159,  3,127,119,253,182,  2, 63,123, 63,250,250, 82, 62,117, 38,188,223,155,
+134,196,137,137,135, 55,167, 12,191,203,139,222, 55,250,245, 95,250, 60,150,249,123, 48,125, 44,157,190,155, 89,250,121,121,201,
+ 31,156,118,  1, 11,249,206,119, 28,246,159,122,246, 75, 89,217,175,176, 85, 10, 81, 33,  4,105, 46, 54,176,113,  0,202, 81,242,
+ 59,126,  4,233,246, 33,143,254, 44,244,194,167, 64, 28,192, 50,118,228, 35,248,157,239,133,229, 17, 72,  9, 54,119,213,  4,237,
+ 20,187,143,234,244,116,120,121,181,124,205, 47,252,229,  3,232,157, 31,226, 83,215, 23, 63,204,217, 85,190, 95,203,189,231, 94,
+127,219,122,153,209,155,206, 96,255, 87,175,197,242,  1, 41, 56, 19,145,195,238,254, 26, 78, 60,174,119,200,221,175, 63,217, 18,
+173,107, 65, 63,147,101, 79, 63,109,251,123, 31,251,125, 59,240,188,147,  8,250,221,247,163, 77,223,117,142,229, 36,231,253,173,
+238,254, 27,156,152,208,230,  7,221,253, 75,104,143,173,253, 33, 45,103,254, 40, 90,200,253,101,123,162, 35, 63, 41, 34,239,223,
+179,191,219,104, 11,191,252, 30, 45,148,126,247,186, 31,199,105,115,202, 63,150,246, 40,222,119,113,239, 85,230,  0,126, 81, 68,
+222, 52, 13,137, 19, 19,143, 96, 81,  7,144,107,223,241, 17,224,229,231,212,250,119,254,225,155,248,201, 47,122, 45,197, 95,206,
+177,113,193,254, 78,  8,180,162, 54, 28, 82, 66, 82,  2, 55,252,174, 63,163,220,113, 11, 59,211,202,137, 70,136, 29,108,238,219,
+ 51, 82,  2, 99,197,109,  6, 26,122, 40,111,103,177,120,213,253, 28,208,253, 28,190,118,237,217,228,137,215,179,165, 93,203,137,
+149,203,118,132,238, 38, 90,184,122,119, 40,127, 39,204,127,136, 19,185,233, 87, 60,192,247,194, 13,220,123, 25,212,107,214, 97,
+248, 27,118, 29,219, 33, 90, 40,253,224,218, 19, 63,204,125,228,224, 31,  6,253,221,203,243,246,188,127, 52,112,215, 89,220, 26,
+ 79, 19,145,115, 89,250,247,155,214, 66,252,172, 93,231,248,116,233,143,183,  2,223,119,146,207,159,  8,124,203,250,231,108,120,
+ 23,240,210,105, 56,156,152,248, 12, 16,245,251,229,  1,130,123, 42,223,143,166, 75, 24,253,197, 28, 27,151, 62,  4,100,  8, 45,
+ 12,191,227,187,136, 66, 55,156,122, 53, 11,  7,204, 97, 85,177, 99, 35,179,203, 46,133, 80,111,161,196,127, 32, 47,186,113,124,
+ 16,207,217, 45,107, 65, 63,235, 74,123, 17,185, 97,215,  4, 54,  7,207, 98, 16,127,192, 89,123,235, 47, 90,123,215, 87,236, 18,
+219,147, 45,118,115,152, 54, 35,217,143, 62, 92,251,251,233,130,136, 28, 95, 27, 79,175,  3,190,241, 52,155,231,245,118,175, 56,
+ 15,207,201,  3,124,  4,248,  9,224,103, 30,130,245,220, 39, 38, 38, 30,110,162,222, 60,253, 91,178,191,234,121,223,194,197,203,
+191,166,240,253,233, 88,102, 92, 25,186, 17,219, 42,110,  1, 68,228,228,235, 83,173,157, 36,175,109,193, 22,159, 87,116, 62, 50,
+187,232, 32,108, 12,191,  6,199,190, 85, 94,248,155,199, 31,132,243,116,211,218, 51,189,105,239,250,221,231, 40,236, 55,209,194,
+249, 87,115,250, 48,246,141,235,253,223,248,128, 95,171,182, 68,235, 85,107, 17,190,230, 20,231,226,218,245,182, 15,235,254,126,
+ 26,  9,251, 97,218, 60,236, 63,  9,188,152, 54, 83,220,229,180,245,212, 15,  3, 31,160, 21,197,253,172,136,156,170,226,253,113,
+192, 23,209, 86,125,123, 22,240,152,117,196,225,209,192, 98, 45,226, 31, 93,255,188, 19,248,127,206,147,113, 48, 49, 49,241,233,
+ 50,158, 60,152, 59,243,159,254,146, 47,255,240, 29,243,155,159,120,176,167,172,156, 18,  5,134,128, 68,109,158,187,238, 58, 28,
+119,168,224,197, 96, 89,  9,217, 72, 73, 56, 86,225,192, 19, 47,123, 49,127,241,121,255,175,188,234,  1,159,104,230,129, 63, 39,
+205, 75,219, 27,194,190,149,182,186,217, 77, 15,225,113,237,132,195,119,175,137,126,211, 25,174,  6,247,176,235,239,196,196,196,
+196, 36,234,231, 50,168,191,238,139, 14, 48,200, 55,176,240,255, 11,243, 39,181,169, 97,221, 81, 53,148, 19, 34,109, 40,102, 74,
+123, 24, 14,130,222, 73,228,181,204,134,159,147,111,251,221,143, 79,151,110, 98, 98, 98, 98, 98,226, 33, 22,245,123,196,253,205,
+ 95,209,243,209, 35, 79, 39,219,215,131, 60,135,234,151, 97,246, 40,156, 14, 36, 19,229, 40, 65, 62,129,249,159,210,201, 47, 83,
+134,247,202,119,253,238,214,116,201, 38, 38, 38, 38, 38, 38, 62,205, 68,253, 83, 68,254,237,207,139,220, 70, 36,220, 29, 24, 54,
+141,195, 99, 57,217,196, 54, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ 19, 19, 19,159,134,200, 51,174,124,182,111,198,128, 16, 48,173, 36,132, 98,224, 46,168, 10,130, 80, 53, 35, 34,  4,  7, 71, 49,
+ 51,196, 21, 19,192,  4, 13,142,168, 32,110,136,  7,140, 74, 64,113,218,228,242, 70,193, 92, 81, 93,175,157,238, 17, 23,199, 13,
+ 36,128,  6,144, 42,184, 64, 80, 48,  4,149,128,148,140,170,146,113, 36,  9, 81,  3, 54, 86, 28, 33,196, 64, 80,197,221,136, 34,
+ 72, 72,168, 84,106,  5, 84,136,193, 32, 37, 48,  8,102, 24,142,152, 83,129, 90,156,216, 13,196,206,160, 10,227, 98,  4,169, 72,
+138,168, 42, 86, 42, 67, 18, 86,217,136,  8, 32,148, 24, 81,169,152,181,229, 96, 85,149,106, 70, 10, 74, 12, 29,  8,152, 26,162,
+142,102,197,107,197,113, 92,  5, 17, 65, 76, 17,117, 60, 40, 29, 48, 86,195, 67, 59,167, 34, 14,169, 67, 16, 52,130, 84, 99,149,
+ 43, 33, 40, 73,132, 98, 21, 65, 41,222,182, 79,106,140,213,  8,  4,170, 27, 42,142,116,  9,149,132, 68, 69,168,  4, 17, 16,193,
+179,  3,134,163,184, 26,193,149,226,  5,178, 97, 26, 41, 86, 32,  8, 82, 32,198, 13,106, 93,146, 98, 36,231,140,171,162, 81, 41,
+ 89, 25,130, 96,140,228,234, 68,237, 48, 55,132, 17,243, 72, 80,197,172, 29, 47, 65, 48, 23,130,  5, 68, 12, 79, 66, 39, 80,106,
+129, 16, 81,119, 52, 38,  4,  3,119, 28,152,197, 30,196, 89, 25,164, 88,177,209,209, 16, 25, 98,192,131,226, 84, 98, 23,240, 10,
+101,171, 16,250, 72, 13, 70, 48, 65, 61,226, 81,  9, 17,194,160,212,121,165,170, 48,  4,161,122,160,246, 78,153,103,186, 16, 48,
+119, 82,  7, 33,  5,198, 45, 33,170,227, 22,136,189, 80, 23,133,106,198,232, 25,137,  3,170,129,153,116,100, 27,241,100, 12, 26,
+153,111, 87,102, 73, 40,106,120, 31, 25,106,207,241,213, 28,239,149,224, 61,212,140,104, 66, 80, 22,121,129,231,  5,146,  4, 43,
+145, 40,138,107,193,179, 48,204,122,132, 64,208,142,176,161,232,166, 33, 38,196, 18,136, 30, 81,150,228,156,232,146, 51,103,100,
+195, 35,210,193,188, 20, 54, 82,164, 22,167,142,130,121,134, 90,177, 20, 97,125,175,205,100, 31,230, 35,227,184,100,144,136,118,
+142, 75,162,100,167,134,202, 16,123,204, 32,  5,199,197, 41, 49, 49,235,103,248,124, 27,168, 20,153, 97,121,139, 94, 55,169,238,
+ 44,243,138,136,179, 18,240,234,172, 22, 35,243,178,196, 67, 96, 53,102, 58, 82,235,119, 20,196,  4,241,158, 28, 70,168, 21, 92,
+ 16,119,172, 75, 68,156, 52,204, 24,231,133, 24, 19, 42,134, 27,148,114, 28,151,192,254,212, 51,175,130,139, 17,220, 41, 53,211,
+111,236,163,138,224, 57, 19, 24, 64,231, 96, 17,179, 64,149, 66,192, 48,173, 72,136,248, 98,196,112, 98, 12,120,113, 42, 70,215,
+109, 50,142, 43, 76, 42,158,231,228,218, 35,  1, 66,239, 96, 25,169, 51, 54, 14,244,132,234,184,247,  8, 75,  8,138,121, 32,120,
+164,248,138, 46,129,229,192, 42,103, 66,116,136,  3,238,149,152,122,196, 12, 74,197,235,138, 18,  7, 60, 67,218,220, 64,210,  2,
+219, 90, 33, 26,112,  2,157, 20, 86,210, 49,136, 16, 83,135,108, 84,108,140, 48, 86,250, 65, 40, 18, 80,239,232,170, 18,162, 16,
+ 58, 69,  7, 97, 49,135,253,170,212,206,128,192,144,  2, 75,139,132, 40, 12,226,140,222, 35,131, 18,115, 32,106, 38,104,101,181,
+ 50,186, 11, 34, 62, 42, 65, 21,197, 81,141,232,160,104,  5, 73,129, 94, 20, 69,144, 46,226, 42, 28,216,119,128, 75,174,120, 26,
+161,219,100, 83, 29,237, 20, 87,240,218, 86,196,222, 89, 33, 68, 12, 98,  0, 23, 40,208,198,239,245,235,163, 35,204,111,191,131,
+188,125,  4, 74,225,242, 75,246,179,113,217,227,219,178,155, 14,189,182,149,181, 29, 16,111,223,  3, 48, 64, 79,236,226,158,247,
+ 59,220, 97,112,215,109, 71, 41,199,111,103, 51, 85,158,240,228,199,146,102,143,186,103, 57,207,184,254,237,235, 31,217,245,158,
+ 93,109,237,252,125,231,253, 22,112,251, 49, 88,222,254,113,124,251,110,158,116,105,199,129,199, 94,177,103,239,231,206, 28,248,
+139, 59,224,174,247,221,138, 47, 63,132,213,145,229,241,145,213, 18,186,153,145, 92,217,178,145,186,170,132, 44, 44,181, 82, 61,
+113,112, 83,176,101, 97,107, 25,160,135,217,190,202,246,177, 66, 62,186,192, 83,160, 32,228,156,  9,117, 69, 73, 16, 45, 81, 74,
+ 69, 60,226, 62,103, 94,141,168, 33, 96, 94,193, 42,110, 70,  9,  9, 95, 75,177,139,129, 41,110,  1,193, 17, 12,167, 96,  4,144,
+138, 22,105, 23, 31,199,115,187, 90, 81, 29,171,142,168, 98,193,241,234, 36,  9, 68,192,220, 41,102,168, 20,100,125,183,136, 10,
+216,218, 40, 16,193, 49,130, 56,138, 82, 36, 80,176, 54, 32,186,128, 56, 34,  1,  9,109, 95,213, 10, 65,  3,174,138,215,145, 16,
+ 19, 67, 82, 22, 94, 49,  4,169, 59,119, 73, 32,186, 81,196,137,162, 72,114,140, 21, 99,110,219,196, 62, 96,197,209, 10, 65, 29,
+ 51, 97,185,172, 16, 64,136, 84,119,118, 44, 16,181, 74, 49,  3, 23, 98,  8, 20, 51,198, 58, 71, 60,172, 13, 15,197,172,160,162,
+ 84,109,119, 93, 66,112, 19,170, 56,  4,161,152, 17, 98, 51,108,  2,160,234,212, 90, 40,  4,196,140,190,182,155, 83, 35,140,185,
+130,  7,164, 90, 19, 73,  2, 99,109,255, 21,230,138,138,224,226,168,  9, 34, 32, 53, 83,  1, 98, 34,105,196, 40,132, 20, 41,165,
+ 80, 75,197,165, 73,124, 12, 74, 41,134,122, 64,196,201, 24, 90, 22,136, 56,  6,132,152,176, 82,192, 42,169,119,106, 81, 74, 81,
+ 16, 71,125,  5,162,152,  8,181, 26, 34,138,132,128, 85,163, 74, 37,104,162, 83,200, 56, 88, 96, 52,  7,  2, 18, 28,149,136, 89,
+165, 75, 16, 70, 97, 25,140, 76, 70, 67, 64,139,161,213, 80, 87,162, 10,  5, 67,172, 82,170,227, 69,219,181, 28, 34, 85,160,221,
+ 81, 21, 87, 16, 81, 40,  5,173,142,204, 54,232, 74, 37, 84,195,  8,248,214,138,144, 34, 34,134,141,134, 75, 71, 17,167,214, 17,
+173,138, 41,140,163,209, 97,104,175,200, 50, 16, 36, 17,186, 66,193, 81, 42, 37, 11,115, 28, 73,149,133, 25,213,  5, 86,134,204,
+ 64,106, 66,138, 97, 33, 99, 82,208,226, 64, 36,152, 99,105,131, 33,  4,150,227, 10,250,  8, 42,  4, 79, 84, 45,116,217,200, 86,
+241, 85, 96,179, 15,228, 18, 17, 95, 33,170,104, 80, 82, 40,148,218, 17,107,192,197, 24,151, 77,192,243, 16,145, 33, 96,115,129,
+133, 81,180, 32, 57, 17,168,136, 58, 43, 91,226,181, 66,  7,163,102, 82,223, 81, 74, 66,124, 65,159,148, 98,214, 78,227,198,126,
+242,184, 98, 35,175,  8,  6,161,219, 96, 21,230,164, 34,140, 37, 81,125, 69, 82,129,  3,130, 45, 29, 89, 26,149, 66,148, 14, 17,
+131,220,145, 68, 17, 81, 34,198,144,122, 86,181,176, 44,153,154,149,212,181,235,148, 60,224, 14, 86,115, 51,206,  6,197,234,  8,
+197, 48, 53, 98,  8,184,  7,138,197,102, 36, 26, 12,155,145, 98,210,  6,225, 84,214,134,121, 97,158, 71, 72, 25,177,128,214,200,
+104, 43, 92,155,193, 59,132, 72,149,230,104, 20,182,152,197, 77,130, 11, 53,  4,196,141, 28,  3, 27,169,195,163, 83,114, 38,165,
+158, 66,161,203,  3, 26, 14, 82,226,138,213,202,241, 82,232, 21, 60,100, 74, 72,104, 46,108, 70, 67,124,160, 74, 70,180,  9,222,
+184,189,160,239,155, 97,140,247,136, 87, 52,129,231, 45,130,  9,157,244,152,  3,106,104, 84, 54,131, 50, 35,176,240, 74, 25, 33,
+  5,101,227,130,158,154, 35,145,128,233,156,106, 70,169,  1, 17, 97, 22,149,110,191, 50,206, 29, 49,163, 80,137, 54, 35, 81,200,
+ 25, 86, 14,110, 14, 22, 33,  8, 81,193,164,  3, 10, 86,122, 66, 16,196, 87,132, 46, 34, 26, 48,  7, 29,148,128, 19, 98, 27, 79,
+ 59,109,162,254,184, 75,102, 92,246,232,125, 59,126,222,  9,101, 10,167, 81,174, 93,250, 23,103, 48,118,  3, 62,143,204,122,229,
+226, 11,247, 33,247,165,143,167, 88, 70,108,239, 46, 55, 20,182,162, 32,154,184, 96, 51,210,207,134,189,187,190,167, 73, 57,197,
+ 46,246,254,125,216, 49,  8,  4,102, 93, 96,223,129,254,188,  9,250, 78, 63, 20, 67, 37, 51,142,  5, 23,135,160,232,144,169, 42,
+148,209, 89,137,226,139, 37, 49, 10, 51, 13,212,  8, 43, 27,145, 89, 33, 34,108,244,251, 24, 23, 78,204, 66, 60,216,115,220, 20,
+ 61,178, 77,206, 75,180,131, 80,132, 84, 42,  5,160, 23, 60, 12,232,209, 54,118, 18, 93, 24,189, 32, 33, 80,202, 72,144,216, 60,
+219, 44,132,232, 77,144, 69, 41,213, 16,  5,241, 74,  8, 97, 61,160, 86,188,130,144, 48,140,234,165,157, 46,119,180, 86,204, 20,
+ 83,193,212, 80, 73,116,209,169,185, 98, 89,144,224,136,183,193, 90, 83,243,250,161,137,183,249, 72,  8,177,121, 98, 82, 17,  4,
+ 43,160, 98, 72, 74,  4,  4,138, 99, 46,136, 68,130, 26,213, 42,230, 70, 76,  1,119,  3,183,118,114, 67,196,  9,104,  6, 87, 24,
+196,192,  2,243,177,137, 44,106,164,117,255, 86,185,121, 77, 30, 65, 76, 49, 45,184,  8, 62, 58, 53,  8,157,116,184, 84,170, 26,
+234,144, 80, 50, 32, 24, 86, 64, 58, 80, 89,123,174, 34,184, 40, 54, 22, 92,  3,162, 80,115,165,  6, 39,136,182, 78,135, 74, 40,
+134,155, 19, 28,138, 85,114, 16,162,  4,188, 52, 27, 83,215,215,198,  9,212,154, 81, 29, 80, 42,149, 74, 34, 98, 42,132,181,209,
+ 69,234,  8,185,144,164,226,237, 62,162,100, 67, 36,145,218,101,193, 77,154,160,136,163, 81,219,117,145,178, 54,186, 28, 86, 75,
+ 98,136, 24, 32, 10, 49,  8,102,  5,204,233, 82, 36,133,158,108,149,106, 43, 84, 65,107,187,190, 18, 59, 58, 28,241,102, 36, 84,
+  7, 47, 11,148, 68,236,148, 50, 86,138, 56,196, 66,174,138,105,196,179,182,123, 77, 32,168,225, 69, 40,161, 35, 38, 69,139, 97,
+ 94,154,137, 89, 33, 12,134,187,175,163, 64, 21,130,226, 42, 12, 42,100,131,229, 24, 72,201,232, 85, 41,193, 72,230,  8, 29, 70,
+ 65, 81,130, 56,213,  5, 29,  3,170, 21, 83, 71,171,144,199,140,199, 64,113, 65,134,212, 12, 31,  7, 33,131, 68, 74,133, 96,129,
+ 24,  7,188,203,216,106, 65,172,206, 56, 86, 48, 69,187, 64, 93,140,224, 78,181, 37, 21, 37,136, 50,200,140, 72, 68,122,195,163,
+ 17,101, 64, 28,180, 24, 57, 25, 81, 19,148,204, 56, 55,116, 16, 92,218,144, 54, 90,  4,182,169,171, 76,236,135, 38,110, 26,216,
+232, 19,171, 60, 82,139,  0,133,144, 18, 93, 13,140,221, 72, 94,122,139, 54, 85,103,136, 27, 88,223,162, 56,178, 12,224, 25,137,
+198,134,110,144, 25,169, 37,179,181,117, 20,145,136,153, 19,107,198,234,146,161,239, 24,139,177, 57,236,167, 75, 74,  8,219,220,
+181,  5, 38, 17,153, 45,177,197,138, 98,214,238,  7, 89, 65, 78, 72, 52,164, 19,108,116, 48,193,213, 17, 29, 17, 87, 98, 73, 16,
+156, 20,140,133,  5,108,233,104,116,200,205,129, 16,171,200,144,136, 12, 20, 12, 47,112, 32, 14,132, 40, 88,141,200, 40,152, 71,
+162,100, 74, 82, 54, 57,128,  5, 69,171, 49,218,136,196,129, 33, 21, 74,152, 45,132,206,  0,  0, 32,  0, 73, 68, 65, 84,134,130,
+161,150,154,225, 29, 55,  9, 30,168,158,177,224,216, 88,233, 92, 25,125,132,170,136, 11,165, 38,102, 93, 36,234,140, 81, 87,100,
+150,196,174, 25,202, 33, 42,121,229, 12, 62, 50, 22,225, 88, 40, 72, 74, 72,137,132,188,194,  7,197,123, 40,150,168,121,197,108,
+232,  9, 36,196, 97, 75, 42,137,128,211, 81,226,138,228,138, 17, 25,231, 32,131,181,254,199, 68,172, 61,190, 90, 82,108, 36, 12,
+  3, 27,125,100,126,108,100,216,175,120, 89,177, 56, 26,233,135,125,172,100,139,200,140,125, 34,216, 56,178, 10, 25,181, 30, 24,
+208,148,200, 46,104, 41,120,152, 81, 99,193, 54,149, 20, 90,164,178,212,136,104,  7, 81,233, 53,227,174, 68, 87,212,123,138,173,
+218,184, 33,176, 49,219,184,223, 34,230, 14, 17,167,170, 50, 75,  5,233,186,243,163,142,  6,  1, 33,196,200,108,166, 64, 58,111,
+194, 27,189, 69,136,251,160,104, 63, 59,175, 33,240, 12,248,104, 32,  5, 73,  2, 57, 34,201,217,140,137,237, 60, 50, 95, 25,209,
+132,112, 32,177,176,202,254,208, 67,133,237,121,102, 51, 69,102, 27,153,213,246,156,149, 37,234,  0,146, 87,244,195,  1,124,182,
+193,102, 12,172,242,113,134, 24,169,161, 71, 10,216,226, 24, 58, 40, 78, 79,184,248,242,199,189, 42,184, 67,  8,132,144,214,230,
+140,180,171,100, 77,116,171,181,176,178,155, 83, 76,  8,205, 97,195, 69,144, 16,136,170, 32,149,160,  1, 83,  5,  1, 85, 65,109,
+ 45,208,193, 16,148, 24, 90, 72, 54,168,131, 74,243, 40,125,237, 29,227, 84,  7,  9, 10,190, 35,122,218,140, 39,131, 24, 20,241,
+ 10, 26, 80, 73, 68,117,240,230,185,167, 96,136, 64,206, 21,213,212, 66,153,205, 72,166, 90, 94,135, 95, 42,238,118, 79, 56, 72,
+ 20, 52, 40, 81,  3,201,156, 42, 80,130,160,185,133, 49, 53,208, 68, 57,128,187, 99, 98,152,131,107,109,131,101, 16,148,128,136,
+ 18, 66, 66,131, 96,162,184,129,209,172, 99, 80,194,144,112,  3,151,128, 74,160,223, 49, 23, 37,180,200,131,183,192,208, 50,151,
+181,161,232, 72,208,123,194, 69, 81,  4,119, 72,125,104,226,183, 78, 77,168,  8, 49,  6, 50,153, 32,144, 52, 96,234, 72,140,136,
+ 37, 60, 59,117,157,242,136, 24, 65,140,106,172,195,243,173,241, 22, 41,112, 28,195,131,222,243,223, 41, 30,240,224,235,176, 88,
+135,215, 54, 24,137,  8,230, 80, 28, 60,  8, 93,144,102,144,105,139, 24,152, 22,204, 13, 93,219,219,170,237, 62,170,107, 67,135,
+ 42,196,168,212, 10, 42,130, 56,152,121, 75,219, 84,161,186, 99, 82,137, 33,160,181,  9,176, 72,215,250, 26,104,169,  2,169,168,
+ 42,177,  8, 67,215, 65, 53, 82, 20, 66,151, 64,132,152,  4,143, 78,165,182, 72, 67,181,118, 28,210, 53,227,195,155, 72,  5, 42,
+ 21,165, 70, 65, 93, 49, 75,107,195, 66,200,238,148,209,155, 33, 87,154, 97,164, 65, 24,203,146, 90, 90, 28,171,235, 59,198,177,
+ 67,106, 33,134, 21, 49,  9,145,216,162,  0,120,187,249,196,241, 42,100, 31, 97,149,  9,149,102,212,248,136,  6, 33,154,225, 30,
+ 41, 54, 50, 11, 61, 42,144,151,115,164, 55,162,119, 88,140,164, 78, 72, 26, 16, 77, 44,243, 72,175,149, 88, 67, 51,102,131, 81,
+179, 99, 99,166,132,245, 45, 37,142, 57,228,170,104,105,  6, 56,140, 72,  7,203,226,  4, 21,186, 24,161, 42, 85, 71,186, 16,209,
+126,147, 36, 10,181,162, 58, 32, 33, 35, 29,100,  9, 96, 35,106, 29,117,125, 93, 86,197, 64,157,136,224,182, 66,106,166,139,  3,
+ 85, 34, 85,156, 56, 11, 12, 26, 48, 15, 52,231,196, 72,169, 39,132, 22,161, 49,105,158, 51,  4, 60,116,148,146, 41, 94,233, 66,
+130,212, 17,131, 82,165, 25,113,  9,195,125,164,170,160,125, 34, 13,145, 96, 61,206,136,166,158,104,142,122, 32,196,158,236, 43,
+136, 74,112,167, 75,137,209, 43,170,134,164,128, 75,  5, 21,108, 29, 65, 81,117, 82,216, 71,220, 31, 49,148, 90, 87,136,104,139,
+178,  8, 72, 12, 72, 14, 72, 48,102,113,134,133,136,185, 19,135,128,149,130, 86,161, 51, 33,151, 72,112,135, 40, 72, 85,114, 82,
+250, 40,104, 84,164,  8,163, 21,106,132, 46,  6, 52,130,107, 64, 67, 15,227, 72,139,111,128, 72, 70, 29,182,142, 45, 80,  4,180,
+237, 67,150,109,140, 29,235, 72, 68,217, 63, 27,144,226,160,  1, 87,129, 89, 71,119, 96,131,222,157, 52, 27,145, 62, 18,170,209,
+139,225,170,216,152, 91,100, 72,  2,226,153,150,172, 11,132, 36,136, 87,220,133, 62,118, 12, 93,224,178,199, 94, 66,236, 55,239,
+ 95,184,217, 96,117,108,142,231, 21,  7,  6,101,227,224,  5,187,130,227,231,206,162,192,246,177,  5, 82, 22, 92,120, 32, 18,103,
+  7, 56, 31, 43,134, 87,224,248,182, 49, 46,183, 56,144, 50,251, 46,220,  0, 61,127,194, 62,  7, 14,127,114,197,226,232, 39,208,
+186,162,122, 97,116,163, 46,173, 69,107, 11, 68, 83,100, 22, 24,151,  6,209, 32,130,198, 64,170,138,140, 45, 50,231,  1,186,153,
+ 98, 57, 51,120,101, 65,166,174, 70,  0, 74,236, 25,116, 31,149,163, 20,132, 89, 80,182,115,104, 41, 99,  7, 84, 28,188, 34, 85,
+ 64, 11,168, 32,180, 27, 72,  2,168, 27,182, 14,149,123,139,  8,163, 65,  9, 40, 42, 21, 68,209,216, 18, 44,  6,205, 43, 10, 45,
+119,163, 82, 17, 81, 92,192, 11,136, 10, 65, 13,173, 45,239,107, 34,168,213,245,128,100,168, 87,140,174,185, 75, 72, 19, 87,179,
+182, 83,111, 97,122,139,  1,220, 16,111,225, 89,237,215,255,104,158, 49,154, 97,209,199,  1,195,201, 99,203,233,167, 24, 81, 49,
+178,173,197,168,253, 15,  1, 66,178,128, 25,100, 42,186, 54, 42,106,169,120, 21,  8, 17, 73, 16,170, 96, 82, 16, 17,180, 40, 33,
+181,208,183, 81,  1, 39,  6,193,139,144,146, 96, 18, 48,171, 48,142,  4,119,172,229, 12,168,166,232,  0,120,203,241,162,181, 69,
+ 64, 16,240, 74,146, 72,112,193,196,113,132,168,130,161,140,235, 28,101,144,  4,234,160, 78, 10,138, 72, 36,155, 50, 55, 35,136,
+ 32, 11, 71, 67, 37, 36, 35,214,204,106,177,164, 20,105,209,148, 46,210,185,224,154,192,154,248,182,136,132, 33, 57,147,171,161,
+162,104, 52, 76,192, 10, 80, 70, 36, 65, 29, 91,193,131, 32, 20,117,130,107,179,140,  4,138,  4,188, 84,116,108,  3,156, 37, 67,
+108, 64, 44, 35, 49,210,249, 58,252,149, 12, 51,176, 90, 90,152, 57, 42, 93, 82,106,161, 25, 77,181, 16,102,145,202, 72, 94,180,
+ 16,127, 87, 33, 87,199, 99,165,154, 82, 86, 43,178, 87,168,129, 71, 93,114, 41,179,161, 71,189,133,222,157, 74, 44, 61,171,229,
+136,132,192,124,107,139, 35,199, 14,115,241,129, 11,216,216,127, 33,113,136,204,139, 96,186,194,189,226,121, 64,107,166, 22, 37,
+132, 64,246, 17,207, 66, 55,236, 35,216, 72,233,106,171, 37, 88,129,121, 69,212, 48,115, 66,106,198,103,223, 57,154,103,148, 49,
+163, 93,108,225,100,153, 33, 82,112,150, 96,153,108,153,152,  4,141,  3,110,134, 89, 33,224,104,129, 94,  7,114,202,120,215,163,
+ 40, 99,206,168,182,218,  1,201, 16,101,133,210, 17, 58, 33,231, 37,209,157,232, 27, 88, 52,130, 25, 30,193, 18,  4, 29,216,164,
+ 96,157,226, 75,167,154,161, 10, 41, 10,133,145,129,158,226,173,102,102,149,  3, 99,103,136, 86,186,110,131, 32,  6,203,109,114,
+ 82,138, 24,125,153, 19, 36,145, 23,  6,193, 41, 33, 65, 93, 17, 76, 48, 13, 12,  7, 34,203, 99, 11, 66, 80,124, 72, 45, 58,150,
+157, 28,115, 11,183,214,132,229,138,  6, 65, 67,196, 10,172,130, 35,217,113,  7,106,203,169,215, 82,137,234, 20,221, 32,212, 17,
+145, 64,164, 99,105,133,125, 18,161,135, 42, 35, 86,123,162, 87,164, 66, 30,141,101, 57,134,171,145,106, 33, 12,  1, 31,157, 98,
+133,160, 61,125, 72,184,143,148,108,184, 20, 10, 80,151,145,106, 17,234, 18, 15,134,155,182,240,184,174,232,150,155, 20,113,146,
+ 25,150,156,210, 41,113,169,140,101, 36,165, 25, 49, 12,148,228, 40,  1,219, 42,172,242, 10, 73, 61,244,138,174, 42,157, 26,101,
+213,181, 52,145,  6, 76, 87,152,117,104, 86, 86,186, 69,223,247,212, 26, 17, 23,246, 15,129,185,101, 40,134,123, 38,151, 99,224,
+137, 62,  5,204,149,216, 67,234, 18,226,133,100,  1,223,152,161,  2,155,117, 31, 23,236, 75,228, 26, 40, 41, 82, 93,232,  6, 88,
+149, 37, 54, 79,196, 26,136,105, 70, 89,174,176,218, 97,227, 18,157, 69, 98, 23, 72, 37, 82,212,  8,235,208,147, 14,218,234,138,
+ 66, 27,  7, 85,133,161, 31,208, 24,238,191, 72,174, 12,183,220, 66,204,225, 60,122,188, 25,130,228, 86,247, 19,187,243, 34,232,
+  0,163, 67,205, 25,165, 69,255,206,103,232, 29, 96, 81,161,140, 43,200, 14, 21,162, 27,169, 58,121,128, 88,148, 33, 26,177, 87,
+200,142, 23,167,215, 22,117, 17,135,229,170,213, 72,213, 84,169, 73, 25,150,128,110,176,  8, 66, 89, 44,240,110,147, 78,  5,182,
+182,240,176,197,144, 18,197, 20,179,237,150, 14,243,236, 72,171,179,193,204, 48, 23, 34,  9,113,167,120, 37,122,128, 10, 30,148,
+128,224, 33, 16,104,131,176, 10,152, 85,220, 50, 30, 59,172,180, 80,137,136, 96,230,205, 80,160,121, 71, 74,165, 90, 11, 57,160,
+ 96, 30, 81,154,215, 95,165,229,131, 93,215,169,107,109,161,172, 10,116,  2,174,134, 75, 11,135,  7,137,205, 10,201,133, 40,130,
+133,  0, 94,176,108,184, 43,130, 83,154,107,140,120,110, 65,135, 38,153,235,  1, 21, 98,140,136,181, 34, 45, 36, 16,164,146,243,
+ 58, 68, 27, 66, 43,226,208,132,135, 57,234,218, 78, 78,113, 98,132, 92, 65, 44,224,238,100, 27, 81,137, 80,  5,141,130,173, 11,
+ 71,188,100,136,235,188,185, 53,175, 30,175,120, 85,138,192,204, 34,172,163,  6,226,235,200,  4, 21,143,129,234, 21,163,229, 34,
+171, 11, 85,  2,142,209,187, 32,162,212,104,120,113, 20, 39,163, 84,247,230, 20, 38,109,121,181, 58, 71,114, 97,235,174, 35, 28,
+ 93, 56,166,105,157,247, 83,130,172,232, 59,101,163, 75,136, 36,232, 20,109, 81, 91,196, 91,184,220,204,176,146,233,250,141, 54,
+  8,187,227, 46, 68, 81,242,168, 96,133,216, 69, 92,157,156,141, 72, 32,  4,163, 72,110,213, 48,157,226, 43, 16,150,184, 58, 93,
+140, 72, 85, 36,  9, 57,183, 99,237, 52, 98,177,146,205, 24,250,117,200, 51, 84, 74, 54,242,209,109, 86, 11,103, 57, 63, 78,149,
+ 74,201, 74, 33, 35, 14, 73, 19,102,198,162, 20, 66, 63,240,216,191,189,159,139, 83,224,240,145, 45,114,110,181, 19,243,220,138,
+ 37, 85,157, 59,238,254,  4,159,248,228,156,143,221,113,152,139, 47, 57,194,229,151, 95, 74, 31, 15,160, 68, 86,217, 48, 90,205,
+128, 57,184,143, 80, 58,186, 32,200,114, 93,216,153,148,213, 88,214, 69,142, 70,135,160,161, 67, 66,162,150,177, 69,146, 98, 70,
+ 98,162,230, 22,209,137, 82,154,129, 59, 12,212,149, 65, 17, 74,134, 33,  8,197, 90, 78, 83,130, 48,154,160, 98,132,210, 68, 99,
+206,146,160, 51, 54,102,155,228,178, 98,244, 57, 51,113,146,119,172,182, 71, 66, 12,164, 16,168, 94, 40, 53, 97, 35,152,141, 40,
+149,148, 18, 35, 74,210, 68,208,142,101, 90, 32,106,176,161,248, 86, 79, 13, 21,239,156,148, 21, 99, 73,144,129, 26,149, 90, 51,
+ 67,104,255, 95, 99,201,196, 24,232, 59, 90,196,101,110,148,222, 41,  8,154, 51,113,232,216, 62,226,140, 94, 40, 46, 45, 85,102,
+218,238,237, 40, 12, 68, 68,157,101,172, 45, 99,105, 35, 26, 64,181,167, 19,165,178,164,118,145, 90,189, 21,116,166, 74,117, 39,
+185,226,253,128,196,142,213,184,160,235, 35,174,180, 98, 82, 15,168,131,149,136,164, 74,164,178,169, 61, 75, 45,  4, 43, 56, 25,
+ 98,196,169,148, 12, 50,174,240, 80,208,216, 82, 31,203,177,165, 29, 24, 91,  4, 43,169, 98, 99,165,168, 48,247,138, 82, 80, 45,
+ 84, 47,120, 21,196,  5,247, 76, 74,  9,196,201,203,145, 82, 34,155,177,  9,161, 97,132, 90,  8,  4,180, 11,164,101, 97,177, 79,
+176,226,212,186, 34,154, 65, 89,146,221, 24,147, 96,219, 75, 82,236,240, 46,112,248,216,162, 85,129,244, 74, 41,129,161, 19, 98,
+ 63, 99, 89, 35, 33,  4,102, 41,160, 67, 34,120, 70,150,137,126, 38,212,234,196, 82, 89,149, 86,243, 84,103,145, 92,140,152, 51,
+221,178, 96,143,158, 51, 31, 35,157,  9, 34, 61, 27, 51, 97,105,  3, 75,131,125,174,152, 20,186, 16,241, 40,116,  8,193,109,157,
+110, 19, 52, 70, 74, 23,208, 24,136, 97,184,127,161,119, 90,244, 46,210,156,180,216,199,243, 18, 38,223, 41,241, 21,167, 21, 70,
+167,254,188,137,110,109, 46, 22, 90,141,141,205,  8,247,243, 28,156, 36,107, 64,174,160, 82,112,  9,237,127, 63,209,198, 74, 12,
+117, 97,233,176,223, 13,143, 66, 89, 22, 74, 16, 66,  8,132,141,202,220,156,154,141,205,  0, 94, 11, 93, 13,148, 85, 75,225,185,
+ 47,  9, 86, 89,216,136, 14, 70,239, 61,228, 57,177,223,135,149,163, 68, 81,199,188,133,217, 53, 40,238,165,  9,145, 52, 15,189,
+ 82, 17,147,245,223,104,  5, 71, 42,  4,243, 86,249, 41,134,135,208,170,111,173, 21,184,137,180,220, 89,147,127, 97,180,102,165,
+107,144,150,159,174,235, 66, 55,117, 28, 71,221,113,109,129, 96, 49,199,  5, 52, 42,110, 45,103, 94,139, 19, 66,196,131, 80,169,
+ 68,105, 66, 83,173,213, 74,  6,109, 21,247,230, 17,213, 76, 31, 91,248, 78,140,117,117, 56,132,216, 34,  4,209,149,162,237, 31,
+216,220, 40, 53, 55,143,199,149,178,174,206, 15,162,212, 85,133, 24, 33,  4, 48,195,179,145,139, 97, 34,120,208, 22,209,200,144,
+146, 81,181, 21,178, 17, 90,214, 98, 92, 23, 15,105, 13,116, 23, 62,  1,205,119,177,216, 62, 70, 76, 45, 82, 81,106, 38,105, 36,
+ 68, 69,106,  5,107,245,  8, 82,155,181,232,102,172,162,183, 10, 85,175,184, 86, 52,117,212,172,152, 87, 66,  7,190,180,118,103,
+ 26,152,103,146, 37,198,213,156,213,124,155, 99, 71,140,227, 34, 36, 85,162, 45,201,101,108,  6,140, 71, 86,139,192, 34, 69, 98,
+ 76, 72, 15, 27, 49, 49,196,158, 16, 91, 38,176, 87,216, 30,141, 82, 43, 42, 21, 13,161,213, 69, 72, 70, 61, 96, 34,237,105,  2,
+ 17, 36, 54, 35,174,138,173,207,181,208,229, 30,247,138,197, 66,136,161, 21,255,100,103,  8,210, 12, 17, 51, 98, 23, 17, 89, 23,
+139,212,130, 70, 97,156,111,115,236,174,227, 28, 91,117,108,110,238, 99, 85, 90, 74,194, 37,162,235,168, 69,174, 43, 68, 19, 49,
+ 69, 44,175,184,228,130,253, 60,254,224, 38,159,252,248, 17,114,128,228,235, 28,183,116, 28,191,235, 19,220,126,231, 81, 54, 30,
+117, 57,125,136,204,183,143,241,209, 15,222, 70,234,  6, 46,126,204, 99,216,119,193,197,140,139,145,236,  5,233,  3,193, 21,245,
+246, 79,213,  6,249,  2, 99, 11,193,166, 52, 80,124,196,149, 38, 72,210, 19,146, 65,137,228, 58, 18,226, 58,239, 43,125, 75,199,
+228, 12,181,195,195,136,228,130, 81, 89,209, 55,175,192, 50,173, 74,197,113,109, 69,137,102, 70,116,  1, 70,198, 26, 49,  5,199,
+ 88, 89,100, 30,150,116,162,  4, 15,204,197,232, 76,153,251,146,141,125, 61, 41, 43,110, 17, 20, 66,173, 48,182, 58,128, 16, 91,
+ 97,107,222,106,181, 24,125,236, 24, 87,149, 81, 42,251,117,134,176, 65,149,  5,163, 45,241,212, 17, 61, 17, 61,224,181,213,115,
+228,117,137,178,148, 17,151, 74,145,196,184,204,140,101,217, 60, 62,239,218,255, 69, 40,136,111, 96,186, 36,206,  6,202,184,162,
+ 11, 27,104,167,176, 20,136, 21,195,113, 81,100, 95, 66, 77,137, 25,146, 27, 43,235, 90,154, 65,  2, 30, 35,186, 26,177,  0,193,
+ 33, 91, 33, 58, 80, 29,223,232,137, 56, 35, 35, 53, 27,  9,199, 70, 97,236,105,199, 98, 61, 49, 26,162,165, 25, 85, 52,195,175,
+172,203,181,163, 67, 10, 21,186,196,106,158, 33, 20,130,  7,156, 72,214,142,104,133, 49, 26,189,206,208,218,147,217, 34,142, 70,
+ 77,173,202, 91, 81,138, 85,250,184, 46,160,204,133,124,116,201, 50, 26, 93,104, 79, 33,104, 22,170, 23,196,135, 22,205,202,149,
+ 16,133,162, 74, 20, 39, 58,148,174, 99,144, 30, 75,129, 46,118,100, 59,202,102, 95,153,177,201, 98,181,141,205, 43,165, 70,220,
+ 70, 58, 89, 17,242,  6,139,232, 16,140, 33,111,128,192,106,105,216,152,241,141,128, 95,160, 32, 61,145, 14, 17,167,  4,103, 89,
+188,229,247, 99, 70,139, 16,246,117, 45, 74,164, 66, 52,109, 85, 55, 30,128, 74,180,136,122, 97, 24, 28,237,226,121,144, 49,199,
+ 35, 68, 51,250, 20,206,155,231, 43,214, 82,181, 73, 32,166,120,222, 68,215,141,123,106,185, 82, 60,191,185,122,  0, 51,168, 37,
+227,222, 34, 51, 26, 34,203,229,146, 96, 10, 38, 84, 10, 94, 71,142,199, 66, 23,133, 42, 66, 94, 25,186,168,204, 54, 54, 16,151,
+ 22,145, 21,133,161, 99, 57,102,198,156,155,147,103,199,241, 60, 96,195,128,213,  5, 98,133, 65, 58,142,215, 57, 33,116, 68,168,
+248, 58, 92,237,102, 45,204, 46, 77,108, 52,134, 86, 69, 46,180,220,175,182,240,141,172,159,101, 48, 49, 68,194, 58,111,211, 66,
+164,110,134, 75, 59,200, 90, 11,130,182,112,181,234,218,238,106, 23,  9,113,  4,199,204,113,137,136,210, 30, 45,145,102, 73, 86,
+ 49,204, 29, 83,105, 85,182, 42,235,  4,124,179,130,146,180,160,183,212, 17,183, 64, 81,232, 82, 69, 44, 96,165,162,  8, 53, 52,
+ 35,195,112,130, 64,169, 74, 22,133,149,177,180,202,108, 22,169,185, 80,150,137, 16,140, 40, 21,243,212,142, 73, 13,169,173,224,
+206,173,172, 31,229,232, 91,228,193, 10,170,177, 21,212,137,181, 71,235, 20,186, 96,216,168, 56, 74,176,140,  5,184,236,241,151,
+242,180,164,252,201,159,207, 57, 94, 13, 66, 19, 58, 17, 65,157, 22,154, 39,147, 84, 25,173, 34, 26,136, 49,144,180, 85,255, 86,
+ 10,120,171, 63, 48, 17,124,149,169, 93, 98,232,218,113,206,196, 89,141,115,142, 29, 94,114,116,203,200, 12, 84, 32,132,140,212,
+  5,243,197,138, 85,117,204,140, 64, 89,187,229,129,161,235,209,206, 24,187, 13,134, 80,233,251, 68,232,  2,105,150, 72,177,165,
+ 94, 70,175,104, 49, 66,215, 66,239,129, 86, 84, 41,  2, 86, 28,  9, 52,207, 77,157, 32,130, 86, 33,196, 74,169, 21,207,  1,145,
+138,105, 32,104,165,140,161,229, 81,125,132,234, 20, 11,104, 39, 88, 94,113,228, 19,135, 57,124,236, 24,139,165,209,111, 30, 64,
+ 67,199,170, 44,201,117, 36,174,115,143, 59,  6,147,149,150, 30, 25,129,237,197,130,203,159,113, 25,183, 94, 52,227,246, 59,182,
+  8,  2, 46, 17,100,201,209,163, 71,208,126,131, 11, 47, 24,216, 47,129, 44,151,176, 61,  6,238, 62,114, 23,135, 63,244, 97, 46,
+185,248,110, 46,189,248,113,244, 27,155,148, 85, 69,129, 24, 30,133,198, 57,105, 44,108, 85,  3,156, 32,177, 25,169,210,211,245,
+153, 82, 86, 88, 30,233,215, 79, 95, 72,  8,  4, 28, 82, 68,215,145,140, 81, 87,212, 26,  8,204,168, 97, 78,151,189, 21,235, 69,
+176,249,255,207,218,187,245, 72,150, 29, 89,122,159,217,190,156,227, 30,151,172, 11,139,108,146, 98,179,187,213, 45,116, 79,235,
+ 50, 45, 13,  4, 12,160,145,158,244,191,248,167,244,162,223,160,  7, 61,  8,141,145, 26, 28, 77, 95,201,170,188, 71,132,187,159,
+115,246,222,102,122,176,157, 73,189,  8,146, 80, 25,  0,  1, 22,193,204, 10,143,112, 63,123,219,178,181,190, 69, 60,252,138,226,
+ 24,228,202,169, 14, 52, 17,198, 38,187,145, 60,129, 62,210,184, 49,198,  1, 57,179, 12, 65, 49,186, 88,236,189,173,199,234, 32,
+ 85, 74,137,207, 88, 58,194, 72, 34,181,211,110,  3,115,167,214,196,182, 59,105, 93, 89,134,179, 15,208,250, 68,238, 17, 61,124,
+249,120,144,189,160,201,227,194, 41,194,154,160,229,193,117, 55,212, 20, 74, 65, 84,168,165,177, 15,167,230, 19,227, 56,208, 90,
+176,110,160, 21, 21,165,228, 74, 86,167,177, 33, 75,165, 31, 27, 75,209,240,215,164,133,235,209,201,201,145, 28,254,154, 36, 11,
+167,  7, 97,219,122,188, 95,186,114, 28, 66, 89,194,157,109,105, 39, 17,207, 26,241, 48,104, 30,227, 25, 89, 64,151,132,111, 66,
+247,103,170, 36,106, 94,105,182,113,236,157,211, 90,226, 18, 91, 43,227,114,197, 51,120,235,177,225, 77, 57, 46,128,169, 96,118,
+ 76,149,232, 20,134, 51, 49,202,249,132,121,166, 30, 79,116,205,208, 43, 35, 13,134,221,232, 71,167,171,226, 61, 46, 93, 55, 55,
+180,213, 48,227, 46,149, 86, 22, 28,227,180,156,121, 76,149,151,219, 65, 33, 33,154, 73,169,208,172,177,206, 11,  3,174, 92,183,
+ 78, 25, 23,100,141,203, 15,251,142,202,142,164, 19, 47,251,134,237, 78, 57,125,  5,115,152, 89,164, 80, 30, 23,188, 11,108, 30,
+ 41,128,118, 69,234,202,121, 45,216,101,196, 51,112, 81,212, 19, 36, 97, 59, 58, 15, 57, 97,110,120,142,213, 78,169,133,161, 66,
+113,229, 84,214, 31,125,160, 25, 17,243, 13,123,129,144, 74,249, 98,211,174,185,225, 54, 88,138,198,100,246,165, 14,117, 15,191,
+137, 26,228, 90,190,184,252,126, 52, 16,107,148,228,108, 12,220,102,242,234, 20,178,134,238, 32, 46,236,215, 65, 90, 42,231, 82,
+ 80,117,174,190,115, 60, 93,184, 63,159,177, 62,120,105,157,243, 93, 98, 32,120, 63, 81,229,160,237, 66, 83, 71,181,160,253,129,
+131, 27,221, 55,106, 46, 28, 71, 33, 35, 25,241,136,148,185, 15, 64,195,192,164, 26,147,245,208,207,175,215,220, 64, 50, 88, 11,
+ 73, 91,115, 28,248,128, 15, 99,140,216, 53, 38, 28, 12,  4,197, 60,166,244, 33,131,146,231,131, 61,129,245, 61,114,133, 26,242,
+157,247,129,251, 64,139,226,  3,116, 76,243, 93,  6,119,101,152, 32, 24, 41, 73,196,153,188, 77,  9, 59,178,219,106, 48,114, 39,
+229, 18, 89,249, 41, 81,187,199, 69,193,136,  9,188,211,201, 25,150,145, 66,174,215,185, 66, 72, 48,218,148,163,177,240, 18,244,
+ 78, 31, 29,205, 25,247,200,124,138,247, 57, 65, 11, 84,193, 40,168, 59,102, 74, 34,145,  5,154,109,180,174,164,212,120,243,219,
+255,149, 81,157,125,186, 11,173, 77, 53,255, 56,200,178,132,241,110,116,208,138,168,161, 73, 25,195, 73,150,145, 20,145, 48,215,
+144, 94,146,128,166,152,168,205, 26,251,190,241,241,165,241,225,121,103,179,153,  2, 72,141, 36, 59,182, 15, 46, 35,162,125, 70,
+248, 25,134,132,148, 37, 46, 92,143,  3,237,198,222, 52,190,191,227, 64,114,226,252,205,119,220,221, 87, 62,190,190,  6, 43, 64,
+ 51,168,227,219,193, 48,161,219, 65,169, 43,146, 50,227,  0,211, 48,196,173,185,114,120, 28,246,174,130, 74, 15,222,193,209, 99,
+106,177, 30, 43, 30, 28, 90, 39, 73,231,250,242,129,167,167, 15,124,120,238, 28,230,136, 56,185,111, 56, 95,163,105,161, 95, 14,
+ 70,106, 97,104, 36, 51, 92, 65, 58,221, 28, 21, 37,201,193,127,253,159,255,148,209,158,249,159,254,231,255,157,102,160, 90, 24,
+199, 21,183,196, 87,231, 19,169, 29,188,125,121,225,116,122,224,235,175,190,227,187,239,254,154,143, 47, 47,188,249,253, 63,242,
+230,245,191,231,143,126,246, 13,223,126,253,115,206,143, 95,209,246, 43, 38,198,186, 22,206, 30,174,119, 81, 71,108,167,212,130,
+250,202,170,202,166, 47,136, 74, 68,182,214, 21, 90,199,219,149, 83, 17,182,230, 72,202, 20,156,222,183, 88, 65, 45,153,126, 27,
+ 72, 17,252,172,113,136,102,197,117,128,118, 92,194, 45, 47,119,138, 30, 70, 59,  6,235, 84,202,142, 22, 70, 20,243, 48,144,105,
+ 90,168,230,248,165,179, 87, 69, 52,209,111,142, 90,225,112,200,107, 24, 45, 87,117,182,222,232,125,112,174,225,141, 41, 77,216,
+211,206, 80,143,239,161, 43,195,116, 94, 94,130, 49,208,198,  1,182,144, 79, 39, 82, 51,196,148,209, 54, 68, 79, 48,156, 49, 12,
+147, 75,172,157,172,163, 37,179,228,132,221,118,242,233,  1, 31,141,197,157,230, 70,202, 15,148, 82, 40, 52,158,111, 27, 85, 87,
+198,233, 32,159,156, 59, 18,125, 52, 76, 50,218,140,242,237,137,227,221,109,122, 38, 10, 35, 37,178,117,106, 79,236, 52,198,136,
+235,185, 72, 13,207, 65,135, 68, 39,167, 76,111,225, 77, 41,154,169,107, 24,  1,251,238,184, 14, 54, 55, 82,  3,225,140,248, 65,
+202,141,145, 11, 73, 51,218,149,221,110, 44,114, 66,232,160,157,222,194,124,123,115,167,111, 59, 75,238,100, 81,110,192,144, 30,
+198, 57, 95, 88,115,194,252,133,113, 50,170,148,240, 27,245, 22, 23,226, 82, 57,110,157,236,194,230, 87,186, 23,216, 14, 74, 27,
+108, 98, 28, 99,193, 77, 41,192,177, 30,208,157, 98, 32,169,144,238, 31,177,214, 24, 55,208,154, 72,105, 39,121,230, 65, 87,158,
+ 85,209,190, 65, 90, 80,132,147, 14,236,225, 76,139,253, 17,101, 41, 88,118, 14,230, 10,205, 18, 57,103, 54, 19, 74, 10,246, 72,
+169, 25, 73, 57,100,136, 84,168,107,249,209,123,234, 49, 71, 83,117, 67,220,191,200,142,254, 15,151,  5, 34,107,159,132,255,231,
+140,220,255,255,175, 62, 96,140, 78, 86, 35, 45,235, 23,219,213,127,250,121,140, 14, 58, 58,189,247, 80,185,213, 73, 35,225,123,
+ 35, 37,167, 38,199,199,160,120,  5, 51,174,215,131, 34,194,157,172,152,108,112, 26,220,146,147, 13,218, 21,172, 56, 35, 95, 41,
+205,120,113,168,115,197,109,150,200, 86,131,111,144, 43,164, 51,233,143,126,241,199,191, 41,105,198,246,199,244, 87,167,216,111,
+171,134, 49, 42, 79,121, 69, 16,146,204,  7, 64,  4,168,208,153,197,150,252, 73,130, 23, 82, 73,161, 90, 11,184, 42, 57,101,210,
+ 92,195,185,143, 48,181,187,204, 76,110, 10,202,129,  7,140,  6, 97,238,160, 53,114,242,238,  1,234, 40,  5, 45, 74, 34, 99,222,
+  2,176, 66,194,100,238,173, 73,136, 38,134,  9, 41,205,139,  9,196, 63,139,146,167,187,144, 17,113, 49,106,138,  9,208, 70,236,
+ 86, 82,152,119,204, 13,173,225,106, 55,111, 97, 28, 35,148,134, 54,122, 56,180, 61,192, 25, 38,241, 51, 48,226,127,179,153,217,
+ 30,238,211,221, 45,236,163,243,254,186,199,228,111,134,117, 67, 25,177,103,105,  7, 46, 66, 82, 97, 31,206, 24, 17, 49,241,102,
+ 52,179,152,142, 36,209,123,184, 85,201,153, 84, 29,235, 79,124,120,243,196,247, 31, 14, 94,122,130,162,241, 90,180,225,182,113,
+244,169,136, 76,233, 74,145,128,226,  0, 18,118,248,216,253, 15,167,143,  3,243,193,222, 99,106,249,197, 79,127,202, 47,190,174,
+188,127,190,177,223, 54, 94,158,223,113,187,190,240,244,241,137,231,203,133,143,207, 23,158, 95, 94, 24, 14,119,107, 65,181,198,
+ 95, 54, 52,128, 55, 22, 38, 30, 18,216, 16,186, 55,204,103,254,212, 59,163,117,182,231,143,124,120,255,  3,223,191,121,207,251,
+107, 15, 94,193,132, 29,229, 82,249,238,155,175,184, 91, 86,142, 99,139,181,132,135,145, 83, 61,110,111,214, 27,244,198,162,133,
+191,249,203, 95,241, 39, 63,251,138,191,251,199, 39,222, 94,247,144,133,199,198,240,131,156, 43,215,219,198,205,140, 54, 58,151,
+203, 27,164,191, 80,214,133,199,243, 79,233,238,188,121,243,129,143,111,127, 79,178,198,122, 87,169,158,240, 97,116, 31, 97,128,
+114, 35,159,214, 80, 85,134, 98, 73,200,222,145,  2, 62,  4, 59,224,126,133,214,226,189,159,165,162, 53,147,221,208,113,112, 76,
+178,131, 15,137,196, 69, 62, 49,134, 35,214, 25,110,228, 97, 12, 22,202,168,228,210,145,228, 88, 75,184, 77, 16,202,112,164, 19,
+123,113, 19, 24,194, 41, 47, 52,160,119, 71,151, 18,224,166, 30, 38, 69, 39,140,120,153,140, 46,149,222, 19,106, 78, 89,  6,189,
+ 31,244,121,105,204,106,212, 84,241, 84,177, 53,226,160, 41, 37,214,101,165,213, 20, 81,206,139,177,245,193, 16,165,181,131,205,
+ 99,253,208,183, 13, 81, 39,245,202,146, 87, 82, 54,198,176, 88,215,168,147,181,224,201, 89, 24, 36,133, 77,  2, 16, 85, 82,162,
+ 97, 20, 77, 20,207, 32, 39,228,214, 64, 11,  3, 98,191,222,143, 48, 18, 10,248, 72,241, 41, 55,167,239,161,106, 68,230,253, 96,
+ 45,113, 57, 53, 83,146, 41,146, 70,172, 79,236,142, 61, 53,134,117,116, 79,180, 30, 23, 74,119, 65,164,179,141,131,222, 65,165,
+134, 74, 54,182,112,199,219,224, 44,101,174, 27, 21,215, 59, 78, 53,  5, 19, 33, 43,231,122,138, 11, 14, 22, 23,251, 28, 74,136,
+ 31,134,168,146,206, 25, 29, 59, 93, 29,219,140,209, 15, 52, 45,145, 18, 34,163,230,140, 69, 24,217,168, 67,168, 89,112, 93, 66,
+124,172,133, 69,  5, 74,198,215,133,180,  9,181,156,201,154, 80,205,184, 20,138,215, 88,103,121,192,183,150, 44,156,239,148, 75,
+111, 12,115,106,  2, 58,200,110,164,109,160,165,224, 38,156, 22,  9,181,117,178, 31,210, 92,107,230,148, 88,180,240,147,111, 31,
+ 88,239, 31,127,156,153,205,224,242,124, 99,244,131, 34,131,135,199, 59, 72, 63, 62,210,214, 28, 46, 79, 59,118,220,184, 95,149,
+122,119,255, 69, 14, 95,  3, 94,110, 70,191, 94, 41,222,120,120, 40, 72,185,251, 98,135,122,  3,222,188,111, 92,222,190, 99,180,
+ 43,230,198,190, 31,140,209,226, 12,114,231,198, 32, 75,101,119,167,103,163,223,  2,110, 52,138,176,109,141,102, 47, 17,183, 59,
+223,177,223,174,232,166,140, 28,166,206,228,149, 38,  3,247, 28,151,190,179,210,  7,236,151, 39,182,235, 59,210, 79,126,254,199,
+191,201, 51,130,150,210,148, 89, 85,113,139, 55,130,194,220,241, 41, 37, 41, 62, 65, 48,174, 78,174,133,164,142,183, 17,123,107,
+143, 75, 64,164,205,226, 67,230,  6,168,199,100,251,233,224,158, 57, 53,145,132,206,195, 81, 68,200,154,227,154,147,  4,117,139,
+184,146,228,121, 11, 49,242,  8, 83,153,121,184,237, 19, 57, 60,  0, 51,226,158,210, 39,192, 73,  2, 27,177, 91,148,136,108, 73,
+174,244,214, 34,202,229,130, 73, 33,143,  1, 35,148,130,125,239,241, 32,241,120, 45,195, 27, 54,156, 82,115,196,213, 90,143,  7,
+108, 73,145,145, 86,157,119,145, 78, 74, 11, 69,116, 26,  8,  7,185,156,226,114, 82,148,156, 64, 75, 66,143,142,117,137, 67,214,
+253,243, 53, 41,139, 48,136, 41, 85, 20, 36,231,184,116,184,  7,145,202,231,238, 80,  5,177,141,203,199, 55,252,238,119, 55,158,
+246,133,161,  9, 77,176,172,137, 36,141,190, 31, 28,157,  9, 15,154,210,213,167,108, 54, 25,153,196,189, 16,114, 45, 36,202, 17,
+106,137,217, 96,223, 55,236,104,177,191,237,198,245,227, 19,111,222, 63,243,114,221,216,154,209, 71,120, 28,122,173,124,245,211,
+ 87,124,247,112,230,184, 28, 17, 69,148,198,104, 35,124,  9,132,223, 33,232,119,142,123,199,108,208,219,193,203,251, 55,124,255,
+230, 53,239, 94,118,204, 39,188,100,102,236, 98,194, 87,198,237,133,235,229,153,235,237,133,125,116,122,111, 28,183,157,253,104,
+225,129,240,240,129,124,124,255,145,114,255,138,255,225,191,251, 11,164, 57,127,247, 47,111,177,105,154,234,214,200,170,180,227,
+160,245,142,245,206, 72,202,211,118,227,118,123,135,182,141,188,156,184,187,251,  9,221, 18,191,127,253,134,167,119,175,201, 58,
+184,171, 39, 60, 45, 72,249,164, 74,229,136, 90,114,101,120, 35,175,107, 92,230, 90,163,139,211, 70, 67,150,204, 72, 43, 93,149,
+214,118,250,110,152, 36,134, 57, 72,162, 46,105, 78,186,113,120, 38, 58,201,136,139,154, 84,234,146, 40,192,229,104,168,198,131,
+  1,132,243,114,199,176, 22, 83, 62,198,209,  7,121,105, 84,237,248,176, 88,222,137,179,222, 45, 20, 45,248,216,201, 82, 64, 50,
+186,196,231,184,212,160,199,221,118,167,150,206,216,226, 66,172,  8,199,209, 81,  9,176,210,162, 74, 19, 56,110, 59,214,  6,123,
+151,152, 50, 59, 28, 42, 28, 22,123,110, 12,186, 27, 85,149,130,241,210,246,  9,131,  2, 41,107, 76,251,  9,106,169,164,147,210,
+ 53,179,228, 21, 45,130, 22,200,150, 89, 79,  5,245, 51, 71,143,125,124,213,206,209,156, 70, 99, 61,173,161, 94, 20,  1, 73,184,
+159, 41,169,227,218, 16,141, 72,220, 80,193, 74,161,158, 18,227, 24,225,201, 73,130,143,193,190, 95, 16, 27, 36,113, 54,187,146,
+ 90, 24, 29,199,100, 72,157,114,162, 42,168,156,130,135,224, 21,207,137,162, 39, 76, 13,242,  2, 42,172,229,192,250,136,103, 70,
+238,100,171,140,222,232,214, 24, 12, 48, 67,172, 49,124, 32,229,196,184, 12, 36,133, 54,182, 15,199,178,147,151,149, 98,145, 54,
+ 89,238, 86,242,169,178,172, 15,152, 15,244,124, 38,141, 65, 42, 80,101, 33,121,192,142, 74,142,100,140, 75,227,252, 80,208,180,
+224,117,144,186,208,125, 65,178,179, 32,124,120,110,200, 80, 30,214, 66, 61,192,199, 96,152, 80, 78, 39,238,139,144,242,140, 28,
+ 39, 72,154, 40, 75,250, 67, 28,182, 86, 78, 53,243,147,111,191,161,252,200,156,250,165, 67,219, 54,122,111,172,234,220,189,122,
+ 12,114,214,143,252,218, 28,110,151,  6,125,231,126, 77,148,243,221, 23, 57,212,119,224,118, 25,180,118, 35,251,193,227,227, 25,
+201, 95, 46,206,118,  1, 62,126, 24, 92, 63,126,192,246, 23,108, 42,219, 85, 74, 92, 32,187,147,125,112, 28, 17, 51,190,211, 28,
+145,229,220,185, 28,  7,173,  9, 71,235,148,121, 33,189,202,141, 62,  4,233, 27, 89,140,161,  3, 93,148,109,187,210,112, 84, 23,
+ 56,  6, 42, 43,102,144,126,254,235, 63,251, 77,118,139,105, 78,102, 28,102,146,162,196,231,  1,238, 80, 74, 72,211, 17,237,153,
+128, 62, 15,171, 62,104, 76,204, 30,121,116,149,136,100,105,170,177,167,159,230, 57,155,217,100, 33, 12,105,174, 22,217,113,211,
+153, 37,118, 72, 97, 30,242,153, 96, 27,102,152,196, 60,220, 90, 28,180, 72, 69, 75, 33,137, 33,195, 24, 90, 98,183,157,156, 42,
+ 51,235,169,147,234,227,  4,121, 46, 43, 62, 12, 41, 74,170, 14,  1,181,194, 11, 20,141,201, 62,238, 17,131, 97,142, 90, 28,174,
+ 41, 49,205, 14,142, 89,153, 59, 62, 71, 78,  9, 29,  3, 36,192, 47,137,200, 98,143, 20,  7,166, 72,162,148,105, 36,235,  3,213,
+128,139,  4,148,102, 34, 19, 75, 32,119,179, 13, 84,202,140,158, 52, 92,116,238, 92, 35, 38, 40,169,128,238, 92,223,191,225,251,
+ 15, 74, 75,103,114,145,160, 82, 45,  5, 31, 55,142,126,224, 54,147,  6, 30,153,250, 88,129, 88,208,222,122,251,188, 53,178, 57,
+ 57,206,197, 18,195,140,251,187,  7,206,119,143,116, 73, 52,235,236, 47,239,121,243,225,194,112,161,164, 76, 78, 53, 94,203,112,
+126,249,103,127,194,255,248,239,254,138,124,249,200, 63,188,121, 14, 85, 39, 71,244, 44,140, 45, 13,233,113,120, 41, 17,227,186,
+188, 60,241,254,245, 27,222, 61,239, 33,181,187, 78, 73,109,174,111,156,112,233,139,243,244,114,225,233,118,176,247,192,219, 98,
+206,152,223,103,146,132,106, 60,152,250,232,216, 72,252,155,191,249, 19,254,252, 63,253,138,223,254,159,239,121,253,230,198,178,
+158, 89,180,208,143, 78,235, 35,176,182,  2,226, 33,165,154, 65, 27,141,214,175,164,190,115,127,126,164,222,125,195,232,198,247,
+191,251, 23, 62, 60,255, 64,173,194, 82, 79,156,239, 87,164, 75,100, 13,106, 76, 76, 48,200,233, 20,138,210, 72,120,239,164,225,
+ 28,214,113, 14,100, 12,108, 76,184, 82, 50, 24,161,110, 45, 57, 50,195,162,145,  6,168,249,132,138,145, 37, 83, 52,115,140,128,
+205,  8, 32,169,134, 95, 37, 67,206, 74,183, 20,239, 53, 13,200, 75,235,138,187,163,106,104,174, 72,201,236,251,129,118, 65,244,
+158,230, 91, 92,106,135, 33, 57, 81,199, 74, 75,145,141, 85, 73,193, 65,144, 68,210,206,210, 65, 88, 35,159,223,161,183, 78, 58,
+ 58,187, 42,154, 51, 99,187, 49, 36,194,227,169,198,251,191, 44, 11, 99,190,223,  4,199, 60,145,215,138, 53,135,197,144,155,161,
+ 57,211, 44,179,236,241, 75, 30,101, 48,154,227, 73,200,167, 76,245, 48,145,157,214, 48,138,110,251,152,175,121,141,201, 56, 41,
+194, 17,176,161,226,184,  4,177,177, 31,  7, 70, 99,108,  7, 34, 70,235, 13, 90,103,219,247,121,216,  6,186,121,248,192,123,227,
+192,240, 84,201, 75,152,106,207,229,142,114,127, 79,146,196,146,  6, 35, 13,234,162,192, 96,223,198,140,240, 54,250,109, 48, 10,
+ 28,  7,248,  1,105, 52,198,128, 65,236,121,157,142,119,195,122,193,117,204,149,228, 58,221,246,149,122, 62,145,123, 40,116,105,
+209,216,169,114, 38,175, 43,232, 32, 31,  3, 22,161,166, 12,135,209,115, 13, 38, 65,114,238,152, 70,222, 53,209, 94,174, 88, 18,
+186, 11,125,187,114,151,148,230, 61, 20,128, 83,172, 96,214, 85,233, 75,  9,111, 75,118,200,  9, 75, 78,238, 33,127,202, 52,250,
+253,225, 80, 47,156,150,194,119, 63,251,246, 71,187,202,119,131,118,219,176, 54,184, 95, 19,235,195,195, 23,217, 81, 31,  6,219,
+181,225,253,202,227, 93, 37,175,231, 47, 35,189,  3,215, 91,103,220, 54,238,115,227,252,245, 99, 80,195,190,212, 62, 29,120,243,
+177,113,121,251, 26,111, 47,184, 88, 80, 39, 85,233, 30,135,114,247, 66, 27,157,189,109,144,140, 13,197,181,114,186,  9, 66, 67,
+ 74,130,182, 96, 99,199,250,  9, 49,199, 82, 97,116,231,168,141,211,178, 80, 53,135,113,243,184, 34,154,113,137,132, 81,250,217,
+ 47,126,254,155, 58,163,106, 17, 61,179,216,239,105, 24,204,116,  2, 45,  2, 37, 30,147,183,144, 99,  7, 15, 49,221,231, 68,177,
+ 21,194,  0,  0, 32,  0, 73, 68, 65, 84,132, 16,135,122,210, 12, 89, 80,151,208,230,221, 64,193,199,204, 47,234,188,107,185,144,
+116, 58,  1,125, 26,211, 84,241,110,100,137,105,210,231,  3,  3,203, 65, 66, 83, 38, 99, 62,205,195,111, 96, 34, 51,203, 62, 66,
+142, 99,238,  4,154,131,102,180,132,201, 79,154, 51, 98,150,142, 15,153,134, 41,200,124,238,180,201,193,150, 47, 57,216,243,180,
+ 64, 78,182, 17,152, 63, 98,202,144, 20,210,188, 90,142,125,158, 13, 36,  7,234,154,  4, 57, 39, 20, 13,167,123, 82,220,131, 37,
+143,200,204,250,134,220,214,123, 76,202, 33,203, 58,147,178,139, 23, 69, 44,190, 79,215,248, 51, 99,127,225,233,253, 51,175,159,
+ 18,105, 89, 88, 39,188,231,180, 56,139,237,188,108, 59, 71,159,224,155,222, 17,143,139, 80,100, 11, 36, 30, 64, 62,232,198, 52,
+ 57,  6,109,207, 49, 82, 86,212,149,245,116,207,207,190,125,197,154,225,250,244,150,119, 79,183, 88, 93,168,163, 58,141, 26, 34,
+172,175, 94,241, 55,255,234, 79,248,235,111,132,191,255,167,183,188,185,244,240, 37,244,184, 68,237,163,135,234, 51, 34,171,127,
+187, 62,243,238,245,247,188,126,247,204,203,209,255,192,120, 22, 72,162, 51,187,173, 80, 79,156,214, 19,231,229, 20,108,112,133,
+ 84,106,252,238,166,146,148, 83, 10,208,141, 74, 80,187,  4,110, 47,207,252,228,171,159,242,223,252,247,127,  5,183,157,255,240,
+247, 55,150,124, 98,185, 91,192,149,247,239, 63, 48,218, 17, 25,243,137,239,209, 65,236,231, 81,142,113,176, 31, 47,120,187,178,
+148, 68,215,149, 91,203,124,255,230, 45,251,245, 61,171, 36,238,238, 86,212, 66,137, 74, 54, 87, 36,214, 49,155,188,128, 18, 80,
+165,173, 53, 24,157,165, 46, 65, 81, 28,193,  2, 72,105,161,151, 18, 10,211, 17,236,248, 69, 43, 37,215,169,153,236,116, 61,  2,
+102,148,133,179, 69,212,104,117,195,108,160, 18, 24,213,172,137, 83,130,158,192, 69, 67,121, 74,137, 84,238, 56,174,  7, 41, 67,
+173, 39,204,157,180,148,144,216, 70,164, 20,186, 55, 52,103, 52, 13, 84, 22,154, 25, 49, 64,198,229,128,212,217,122,167,119, 99,
+191, 29, 52,119,218, 62,240,113,196,159, 21,165,230,130,119,137, 11, 77, 73, 48,110,248,161,236, 99,114,255,213, 97, 55, 18,209,
+  7,208,236, 50,209, 90,157,230,  7,226,133, 34, 66,147, 22, 88,227,  4, 89, 19,125, 20, 46, 91,172, 27,214,114,166,232, 96,244,
+ 62,213,190,129,143, 78,167, 80,122,101,140, 27, 41,221,147,125,208,199, 17,208,165,174,200,114,194,250, 96,169, 43, 57, 87,210,
+ 42,113, 33, 28,193, 67, 88,242, 61,140,142,211,233, 22,234, 68,215, 45,232,126,163,115, 88,166,237,  1,231,233, 54, 98, 79, 47,
+112, 52,167,106,152, 26,135,218,132,  7, 13, 82, 73,147, 73,176,204,174,  9,101,121, 88, 88, 79, 25,151,232,108,168,229,  1,181,
+ 74,150, 70,185, 91,112, 18, 37, 67, 27, 91, 12, 58, 61, 46,111,167,197,130,137,225,  7,212, 19,227, 58, 56, 68,216,125, 96,215,
+128, 15,229, 57, 28,136,194,122,206, 36, 93,145,243,202,114,142,157,184, 29, 70, 89, 75,100,128, 37,145,151, 66,150,132,245, 88,
+129,174,121,198,  3,179, 33, 20,114, 41, 60,156, 50, 63,249,238,187, 31, 61, 85,111,221, 57, 46, 27, 98,131, 87,119,153,188,222,
+127,145,195,113, 27,112,123,217,200,182,243,234,171, 19,146,215, 47, 38,143,239, 91,195,142,141,251,234, 44,143, 15, 95,  4,148,
+243, 57,163, 14,188,121,119, 99,123,247,  6,250,  5,213,248,252,185,135, 15,196, 59,236,109, 64, 13,117, 73,119,135,214,216,135,
+177,239,161,138,221,221,175,236,109,208,201, 20, 77,236,126,227,118,187, 48, 42,228,177, 34,239,131,155,208, 44,206,179,163,237,
+164,227, 66, 27, 78,250,238, 23,127,252,155,172, 97,116, 19,141,188,117, 87, 13,200,134,195, 32,226,108,250,153,160, 27,211,171,
+ 38,254, 80, 86,226, 51,163,155,130, 80,198,176, 57,  5,  8, 33, 46, 71, 30,219,108, 96, 35,136, 96,146, 34,215,109,170, 72,142,
+189,152, 89,144,112,212,163,168, 69, 82, 69,179,196, 11,159,178,212,128,192, 97,166,112,144, 74,206,104, 17,100, 26,243,196,161,
+ 58, 12, 29,225,206,111, 62,127,168,134, 90, 24,234, 28,157,228,179, 17,248, 71,162,112, 37,101, 16, 73, 44, 89, 40,165,196,116,
+167,160, 86,130,158, 39,177, 23,197,162,232, 70,240,136,228,232, 64, 72,168,  6,136, 70, 52,152,232, 17,145, 82,188,143,208,185,
+ 71, 60,140,149,248,128, 53, 59,102,236,203, 25,189,135, 44,159, 37, 28,251, 30, 12,252,254,252,158, 31,222,124,228, 67,187, 99,
+ 89, 22,138,  6, 63,191, 36,  7,105,124,120,186,226,158,240,110,147,159, 31,174,236,214,108,210,231, 36, 32, 55, 22,135,178, 58,
+ 33,188, 10, 81,194, 49,226, 66,247,234,171,123, 30, 11, 60,191,125,207,219,231,107,196,144,194, 66,  5,169, 96,110,156, 31, 95,
+241,175,255,171, 95,243,215,191, 56,241, 15,191,253, 71,254,246, 31, 46,104,138,233, 90, 45, 12, 90, 38, 30,234, 73, 63,184,124,
+124,205,239,191,255,158,151, 13, 36, 71,114, 32,105,130,233,189, 20, 55, 68, 11,229,124,226,254,116, 71,241, 17,  4, 64,159,166,
+ 76, 15,243,141, 38,141, 98, 16, 55,210,188,140,184, 12,178, 42,219,209,184,236, 27,255,230,191,248, 51,254,242,175,190,229,119,
+255,241, 13,175, 95, 46,  0,188,249,151,127,226,210,131,116,182, 93, 55, 70,143,134,138,154,227, 33, 45,  3,198,112,172,135, 99,
+191,181,141,170,202,221,253, 35, 57, 21,158,159,119,190,127,251,154,109,127, 38,139,112,119,122, 69, 90,163,244, 39,149, 37,232,
+103, 99,  4,157,109, 57,131,134,161, 79,114, 65, 75,236,191,145,138,233,129,140,240,108,  8, 30,101, 38,147,160,152,212, 40,185,
+208,243, 18, 46,239, 38,156,139,114, 48, 24, 85,177,173, 97, 30,114,111, 94, 78, 52,115,236, 56,230,132, 44,148, 82, 81,194,189,
+175,245, 28,148,186,180,161,169,112,186,143,226, 28,245,240, 79,248, 24, 72,170,127, 88,249, 12,129,222,217,186,114,244, 29,134,
+209,117,193,199, 62,119,193,225,117,144, 92, 81, 21,122,115,186, 24,  9,227,216, 15, 52, 79, 21,204,194,125,143, 10,122, 90,241,
+174, 12,185,198,229, 88, 87, 22, 79,129, 17, 30,202,112, 13,197,100, 31,108,222,  3, 63,124, 28,152,183,224,253,223, 58,253,  8,
+ 41,183, 75,167,219,224,104,157, 84,207,208,199, 76,153, 58,102, 11,186, 36,116, 77,104,201,164,126, 71,169, 30,252,126,107,180,
+230,208, 91, 68, 51,147,210, 83,199,124,224,118,144,180, 82,206,103,186, 23, 60, 13,164, 15,112,229,104, 71,196, 12,151, 68, 26,
+ 74,254,116,  9, 55,133,106,184,100,170, 66,170,  9,215, 19, 73, 50,233,161,178,228, 28,193,250,102, 97,100,237, 18,114,191,221,
+ 40, 89, 96, 81,218, 17,189, 25,227,118,141,105,138,  6, 75,194,196,233, 28,216, 40,148,226,241, 57, 78,137, 45, 53,114, 77,156,
+ 61, 62, 44, 41,223,147,150,  5,151,194,121, 89, 65, 32, 77,224,150,245,206,233,241,204, 87,119,117,238,234, 35, 26,103, 29, 36,
+ 23, 74,137,213, 27,  9,114, 73,212,146,209, 82,184, 63, 23,190,250,201, 79,254, 63, 64,222,255, 95,228,230,230,244,219,  6,214,
+121, 56, 23,210, 23, 66,174,222, 58,244,109, 35, 99,220,223,175, 19, 62,243,227,191,118,135,253,210,232,251,198,195,234,212,187,
+199, 47,234,126,127, 30,240,241,245, 70,187,188, 71,199,206, 49, 66,249, 13,119,103,248,167,180, 57, 69,160, 23,192, 22,170, 54,
+146,102, 92, 42,244, 78,187,193,182, 95, 72,106,208,158,113, 63,200,174,212, 81,169, 52,154,100,246,108, 80,149, 85, 10,126, 90,
+ 16,140,109,111,164, 63,250,229,175,126, 83,167, 28,158,202,167,232,153,131,197,193,226, 56,202, 39, 51,154,207, 29,237, 60, 64,
+244,211, 99, 63,220,213, 89,226,160,235, 76,227,154, 77, 64,205,136,195,206, 52,114,159,154,210,116,207, 70,169,131, 78, 73, 81,
+211,116,183,165,233,138,247,224, 52,151, 20,113,187, 46, 66, 21, 13, 24,136,  8, 42,  1, 39,183,225,164,160,174,130,148,207, 25,
+224, 56,212, 74, 28, 78,243,242,145,178, 32, 75,228,137, 73,144,194,189, 23,235,  7,155,251,250,249,109,228,156,200, 58, 39,238,
+225, 20,145,  9, 68,144, 56,112,150, 40,106,137, 86,180, 68,111, 18,136, 70,130, 79,173,181,196,195,212,199,103, 50, 31,163,  5,
+105, 78,230,129, 59,129, 13,138, 99, 35, 94,143,228,184,184, 28, 31,222,240,253,251,157,139,223,177, 36, 37,219,136,105,211,  7,
+162, 74, 27, 78,235,246, 25,160, 98,163,  7, 27, 94, 50, 74, 96,110,101, 86, 35,137, 50,131,183, 66, 74, 30,175, 95,227, 50,180,
+220,223,243,221,227,153,231, 15,111,121,255,180, 49,200,136,134,244,173,105, 65, 53,184,  0,223, 60, 86,254,244,107,184,188,254,
+ 23,254,151,255,227, 13, 77,239,169, 37,246,152, 34,147, 79,128,209,182, 11,223,191,254,158, 55, 31,158, 57, 92,200,105,101, 89,
+114,196,  2, 61,156,178, 99, 56,185,156,169, 53,202, 95,232,  7,173,221,184,109, 55,182, 30,201,134, 49, 26,163,199,110,124,111,
+ 61, 34, 96, 46,225, 46, 79,159,248,254,202,203,229,198,119,223,126,197,127,249,111,255, 21, 15, 57,243,219,223,126,207,232,198,
+239,191,255,129,189,109,172,229, 12, 26,110,246,118,  8,189, 53,212,133, 82,148,148, 66,212,145, 20, 68,249,222,110, 88, 31,148,
+  2,231,135,  7,100, 57,113,185, 28,188,121,251,134,235,126, 33,171,243,187,127,254, 39,222,189,123, 77,126,184, 99,189,123, 64,
+204,104,199, 17, 49,173, 37,146, 26,227,165,227,222,105,132, 41,212, 49, 52,101,146, 70,140,209, 61,179, 22, 33,151,  5,242,  9,
+ 21, 33, 81, 57, 21,161,105,236,208,185, 29,236, 99, 74,210,122,162,141, 29,183, 35,218,  4, 61, 83, 52, 14, 77,151,131,161, 14,
+ 35,212,129, 90, 21, 70, 35,155,177,155,208,110,  1, 86,146, 44,156,165,206,188,249,137,222,133, 62, 12, 27,141,177, 43,116, 24,
+ 82,209, 26,200,225,156, 43, 58, 34,115,109, 10,205,140,202,220,221,165,232, 15,136,230,174, 20, 23,153,229,132,245,142,217, 21,
+ 92,112, 47,152, 24,187,120,168,114,253, 22, 14,125, 39,168,106,158,  2, 99,235,157, 99,187,209,231, 37,135, 68, 76,184, 37,163,
+235,153,180,174, 60, 44, 25,177, 40,124,145, 10, 69,150,144, 53,113, 82,143,203,134,  9,152,109,120, 19,178, 39,  6, 78,239, 55,
+246, 35,214,103,234, 18,158,143, 34,209, 46,119, 75,140,110,152,100, 10,176,148, 59, 52, 21,180,119,146, 68, 33,213, 82, 22, 74,
+ 81,114, 93,144,226,148,165, 70,204,177,197, 67,116,164,  6,217, 41, 61, 46,113,174,142, 14, 67,178, 51, 90,168, 42, 57, 45, 88,
+  3,219, 27,150, 66,113,  9,207,148, 80,124,197,233,228,164,148,116,226,160,147, 79,128,157, 88, 84,112, 93, 65, 51,119,165,196,
+243,151,131,181, 46,164, 85,216,172,227, 93, 56, 37,184, 63,135, 65,115,213, 26,112,163, 54,216,247, 61,220,248, 22,  3, 80, 94,
+ 99, 40,114, 19,178, 22,190,126,120,224,225,171,111,126,212,158,218,129,151,109, 48,182, 27,202,224,225,126, 65,203,143,159,168,
+ 29,184, 29,206,126,121, 33,211,184,127,188,155,  5, 33, 95,224, 80,183, 80,  0,218,177,241,234,164,148,243,151, 65,207,126,250,
+250,216,224,195,247, 31, 57, 46, 31, 25, 22, 30,160,222,183,207,235,236,222, 15, 14, 55, 40,  3,187,118,  6,138,228, 26,165, 85,
+190,177, 62, 20,236,230, 52,235,129, 79,214, 78, 89,206,184, 20,218,209,105, 99, 58,229,207,  9,  1,246,113, 71,118,193, 24,120,
+ 55,210,207,127,253,171,223,100,  9,  3, 20,  8,210,  7,166,130,203,136,221,110, 14, 83,143, 78,221, 92,146,198,110,203,163, 34,
+212, 92,226,128,246, 22,132,180,185,  7,246, 17, 92,243,195, 12, 73, 57, 14,154,208,211,113,157,211, 60, 97,124, 15, 73, 56,218,
+209, 66,110,148,207, 85,176,242,201, 54,255, 89, 45,152, 13,102, 30,111,113,243,112,119, 39, 36, 80,130,  2,221,123,152,238, 44,
+118,151,163,119,146, 57, 75, 46, 72,142,190,185,236, 97, 96,242, 96,148, 70,117,234,228,102,143,201,173,143,  3,153,144,206, 83,
+180,101,185, 89, 60,240,146, 34, 35,152,240,197,149, 49, 39,208, 92, 34, 69, 32,  4, 49,206,198, 17,181,163,125,150,  1,142,168,
+ 97, 49,137, 70, 40,108,204,127, 71, 33, 73,138,239, 99,127,225,229,221, 91,126,120, 50,142,114, 71,214, 20,134, 64, 21,180,  6,
+125,205,199, 39,183,125,200, 73, 89,125,250,  1, 18,154, 11,238,113,251,142,182,179,120,109,193,150,158, 30,  9,210, 36,224,  9,
+167,101, 69,198,141, 55, 31, 94, 48, 41, 81,127,235, 18, 28,253,164,147, 69, 32,220,158, 95,248,251,127,120,205,255,246, 31,223,
+ 97,245,145,199,243, 18,211,143,  4,233,239,216,158,121,255,246,  7, 94,191,123,226,178,247,104,246,211,132, 36, 69, 69,241, 17,
+ 40, 90, 16,202,178,176,164,224,110,111,251, 78,235,141,214,  7,109, 76, 50, 95,104, 31,216, 24,180, 17,233,136,164,177,246,145,
+ 89,235,203, 84, 34,156, 65,223,  7,255,237,191,254,115,254,147,255,236,103,188,253,251,247,188,127, 26,172,167, 59, 62, 60,189,
+ 13,233,122,185,139,203,164, 10, 93,102,196,110,214,215,230,186, 48,124, 48,182,142,229,232, 34,196,  6,163, 55, 42, 11,231, 90,
+ 89,239, 94,241,124,217,249,253, 63,255, 51,255,242,230,137, 15, 79,207,188,188,127,139,238,141,188, 20,150, 83,161,212,115, 72,
+197,251, 49, 83, 17, 35, 46,159,  6,201, 67,169,193, 21, 41,137,178, 46, 48,  7,188, 92,107, 48,249, 75, 71, 74, 67, 85, 24,150,
+ 25, 45,222,167,154,227,194, 52,128,146, 18, 75, 73,147,116, 56,216,221,195,244,169, 53,240,198,147,140, 37, 41,162, 50,163,119,
+ 12,101,247,  9, 80, 74,  7,151,173, 49,142,198, 62,118, 26, 61, 62, 87, 93, 73,185, 64,  9,102, 66, 73,209,  2,213,109,144,150,
+130,179, 70, 15,132,100,178, 57,229,156,226,242, 59, 12,203, 70,201, 57, 34,167, 12,218,  0,247,112,173,251,126,155,165, 73, 39,
+250,245,  5,115,231, 54, 47,167, 39,  3,100,165, 21, 33,105,225, 84,239, 57,165, 96,173,215,243,202, 82,156, 37,  9, 53,175,208,
+110, 44,105, 33,105, 20, 48,221,218,193, 96, 80,189,145,115, 72,252, 62, 90,168, 47, 20,250, 98,220,246, 78, 59,118,100,173,168,
+ 20,180, 31, 51,154,154,162,242, 56, 65,249,116,209, 79, 74, 87, 37,157,156,251,165,198,192,144, 21,107,123,148,162,152,224,150,
+162, 25,173, 57,102, 29, 43, 13,245, 76,239, 59,189,197, 26, 99,120,163, 51,104,173,161,203,138, 30,206,201,157,203,104,113,233,
+211, 40, 13, 93,203, 35,217, 59,156,141, 85, 43,126,190,103, 77,  5,183,138, 13,227,188,102,146, 13,140,142,155, 82, 93,169,119,
+133,156, 42,101, 12,110, 99, 96,162, 88, 55,214,187,196, 90,114, 76,249, 34,108,219,  1, 14, 85,  3,193,253,105,109,133,164, 32,
+126,162, 44,185,240,245, 55, 15,220, 61,188,250,209,241,173,235,203,134,143,  3,177,193,253, 93,249, 34,135,186,  1,151,203,160,
+237, 23,150,228,156, 31,239, 34, 78,253, 37, 20,128, 22,235,  2,252,224,225, 36,228,211,195, 23, 59,212, 13,120,251, 60,120,121,
+251,129,126,123,194,245,192, 13,154, 55,220,140, 91,100,138, 73,187, 49,186,224, 57, 33,214,233,215, 70, 74, 80,236, 64,110,  7,
+151,124,163,100,160,  4,246, 58, 12,171, 55,118,110,136,  8,235,114,162, 90,134, 22,102,200,177, 95,240, 60, 11, 93,126,241,171,
+ 63,254, 77,206,130,247,  9, 90, 17, 80,153,249,115,143,  9, 85,230, 55,130,199, 58, 86, 73,145,145,251,212,127, 62, 26, 46, 66,
+ 65,104, 12,204,108, 78,227, 18,187,230,249,  7,117, 70,220,  2, 63, 26, 83,146,230,104,120, 83,205, 32, 22, 38, 21, 98,207,158,
+ 36, 98, 24,195, 66,138, 21,241,217,228, 54,235, 54,  5,146, 24,185,204,  7,189, 24,101,102,  4, 99, 47, 62,240,168,152,195, 83,
+ 16,166,134, 43,244, 56,116, 69, 67,150,180,217,102,230, 18,  7, 50, 54,226, 48,243,136,233, 49,156,180,230, 72, 75,245,  6, 35,
+ 20,135,195,156,164,179,192,195, 52,254,172,198, 37, 39, 17,255, 46,153,197,195, 18,237,163,241,115, 67,166,115, 54,104, 96, 42,
+ 35, 30, 54,217,145,253,194,229,253,123, 94, 63, 43,190,124, 77,201,225, 91,144, 42,212,236, 44, 26,185,251,162,144,147,115,180,
+ 30, 56,206,225,116,  9,156,171,  8,179,109,106,129,148, 16, 41,164,153,106,136,  5, 74, 40, 10,104, 20,183,200,216,217,183, 78,
+159,107, 15,119, 65, 74, 33,231, 48,239,185, 15,108,236, 28,189,179, 53, 48,148,187, 87,175, 56,175, 65, 46, 43, 24, 79, 79,239,
+120,251,246, 53,111,159, 55,246, 99,252,161,207, 88,102,251, 15, 62,163, 84,153,156,194,233,123,236, 55,142, 99,208,137,139,134,
+ 77, 42, 68,236,217, 37,204,137, 51, 44, 33, 18, 70, 41,141,107, 35,130,145, 85, 98,253,146,224,195,135,143,252,252,155,111,249,
+171,191,249,107, 22,223,249,219,255,240,  3,235, 87, 95, 49,172,243,238,237, 59, 78,245,140,150,130, 89, 99, 73,133, 92, 23, 26,
+ 25, 27, 29,119, 35, 91, 40, 80,119,223,252,148, 68,229,216,119, 64,113,139,149, 64, 54,103,173, 11,229,238,129, 82,214, 32,141,
+ 53,231,253,135, 15,188,123,251,154,236,177, 75,247,180,124,246, 44,160,  5,179, 68, 73,160,158,217, 37,100, 89,201, 11,248,129,
+ 91,167,214,115,236,178,246,184, 48,230, 44,220, 47, 43,205,156, 46,  7, 42,  5, 87,161, 22,199,114,157,253,242,138,246, 96, 64,
+104,206,129, 80, 62,  6, 57, 11,110, 71, 56,193,139, 81,134, 17,214,177,152,198,155, 89, 32, 94, 75,142,131,175, 57,121,241, 89,
+242, 19,114, 78,145, 80,206, 78,231, 20, 60,136, 96,189, 66,107, 28, 30, 85,183, 73, 15,132,120, 93,133,216,221, 38, 61, 49,218,
+142,154,145,189, 68,221, 41,141,126,  4,134,150, 36,208, 52,126,247,101,137, 53,132,103,214,116,130,121, 73,233, 57, 69, 67, 96,
+118,154, 58,158,102,197,241, 22,151,151, 75,187,197, 10,165, 40,216, 65,201,145,135,247,158, 73, 56, 71,119,108,148,160,198,141,
+ 24, 30,196, 18, 69, 42, 73,  7, 53,215,112,229,159, 86,210, 90, 65,160,158, 50,230,131,181,156,177, 17,125, 22, 34, 11,251,113,
+ 65, 70,152, 24,247,100,193,207, 16,197, 24, 52,219,163,220,167, 29,100,117,100,100,172,244, 96,124,175,161, 92,164,188,146,125,
+150, 93, 49,184,171,149, 36,142,231,133,186,  4, 81, 81,114, 13, 72,149, 20,178,158, 73,205,104, 62,168,167, 66, 46,198,118,117,
+178,220,179,172,  9,201, 25,215,134, 47, 53,222, 83, 18,126,165, 36,194,178,172, 92,175, 27, 46,137,214,  6,251,136,231,120, 73,
+225,141, 74, 37,124, 62, 90,148,148, 43,226,137,245,156,249,230,155, 87,172,231,251, 31, 45,101, 95, 47, 59,214, 27,201,  7,247,
+143,167,185,106,251,241, 89,239,235,181, 99, 19, 96,116,186,191,255, 34, 57,245,  1, 92, 54,167,111, 27,222, 14, 94,221,159, 72,
+203,249,139, 77,233, 59,240,246,217,184,124,124,130,237, 18,173,165,210,241,214, 57,134, 99,195,232, 61, 81,117,198,200, 55, 97,
+180,144,209,181, 24, 55, 41,236,123, 39,149,196,169,221, 33, 45,206, 76,109,141, 37, 59,139, 59, 62,140,135,229,196,199, 22,230,
+228,193, 51, 57, 59, 69,  6,173, 85,210,207,127,249,235,223,100,241,217,170,149,230, 35,127, 26,226,116,230,153, 93, 63,115,210,
+ 61, 71, 32,234, 83, 67,154,166,  0,184,248,164,195,137, 76,119,173,164,233,148,143, 73, 91,197,201, 85,131,  2,103, 97, 14,227,
+ 83, 97, 12, 78,250,108,139, 87, 52,167,217, 16, 22,187,250,148, 35,202, 70,207, 33,183,123, 64,104,164,132,105,169, 16, 46,114,
+ 60,  5,  2, 54,  7,113,202,124,174,  1, 36, 26,198,240,196,154,163,174, 51,226, 94, 18,120,206, 52,226,112,183,216,125,135, 50,
+173, 33, 37,210,195, 84,214,227,181, 40,225, 98, 31, 62, 62,119,244,154, 27,163,183,248, 89, 77,226,158,155,127, 86, 19,178, 66,
+ 55, 67, 36,227, 62, 72,174, 84,141,150, 52, 21,157,253,240, 80,188,115,123,122,207, 15, 79,224,245, 43,238,214, 68,182,131,163,
+ 13, 74, 86,170,166,224,101,167, 18,253,188, 71,103,140,193,214,162, 61, 15, 15, 32, 65, 38,248,250,250,  9,  4,132,144,103,163,
+156,187,135,179, 94,  9,251,191, 38,124,174, 34,100,170, 23,193,  4,136,201,207, 90,163,247,  3,179, 96,247,187, 15,114,202,124,
+243,234,107,150, 53,115,123,249,200,235, 31,126,199,155,247, 79,220,142,160,  0, 78,205,103,174,116,194, 80,232, 61, 10, 87, 96,
+ 70,111, 70,195, 70,195, 52,135,188, 63,  2,151, 26,239, 51,  1,140,148, 38,141, 76, 34, 94, 41, 26,168, 75,239,125,122,  2,210,
+103,179,102,223,  7,125,119,254,221,191,253, 11,190,249,246,158,223,254,221, 91,110,251,224,171,239,190, 98,223,111,188,121,251,
+142,122,119,199,185,174,180, 54,102,212, 50, 24,246, 46,112,220, 26,121,169,252,228,171, 71,220, 32,157,239, 17,148,219,229, 25,
+243,198,101,108,140,118, 99,205,153,243,233,196,178,222,  5,189, 78, 59,173, 27, 31, 62, 62,241,238,205,247,152,118, 78,165,134,
+107,220,163, 64,164,164,130,201,193,222,111,104,248, 74,  3, 60,131, 99, 18, 85,196,203,242, 42, 98,154,222, 98, 66,235, 53, 74,
+121,206,  5,107,209,120, 70, 79,152,237,172, 37,209,123,195,106,133,226, 36, 51, 20,168, 10,187, 27,169, 40,119,  9,172, 21,134,
+100,140,193,184,  5,213,106,200,244,122,144,163,166,216,227,146, 80,207, 41, 14,163, 20,128, 35,241,132,244,184, 26,163,131, 49,
+ 34, 39, 94,172,133,252,108,209,113,208,145,105,168,212,240, 85,176,208,251,141, 92, 10,230,194,178, 60, 34, 39, 65, 44,192, 86,
+154, 50, 89,194, 75, 66, 45,108,227,134,181,141,190, 55,  6,157,158,133,222, 21,219,247,152,186, 15,184,141, 35, 96, 61, 30, 21,
+184, 90, 22,250,209, 88,169,216,128, 81, 98, 37,151, 52,145,179,178,230,168,115,246, 52,168, 90,201, 37,136,119, 94,149,187,111,
+238, 88,206, 95,131, 57,165, 84, 76, 50,230,137,210, 58,121, 73,136, 21,246,125, 99,152, 35, 26,172,237,228,  3,187, 54,124, 12,
+142, 61,158,  5,195,140,156,239, 73, 90,102,220, 87, 24, 54, 34,123,223,149,164, 21,179,152,190, 68,157, 37,159, 25,101, 97, 89,
+239, 73, 73,105, 35, 46, 97, 41,215, 88,  1,202, 64,170,227,116,138,  9,178, 27,141, 28,106, 89, 54,154, 43,150, 19,146,161,220,
+165, 96, 65, 12,153, 42,152,211,250, 76,248, 88,128,182,114,157,105,133, 20, 41, 19,213, 32, 62,230,153,135, 63,157, 78,124,247,
+237, 43,202,143,220,127, 15, 96,187, 70,157,239,162,198,253,171,251, 47, 18,103, 27,192,229,229,192,142, 27,143,119,153,114,250,
+ 50,113,182,144,245,141,125,219, 88,232,188,250,250,203,100,234,255,239,206,250,119, 47,131,151,247,239,144,254,204,176,142,249,
+ 65,107,131,225, 97, 12, 94,134, 65, 82,142,222, 32, 39,198, 28,168,245,206, 40, 71, 97,147,134,228, 19,151,235,  7,204,118,210,
+169,146, 10, 92, 71,133,154, 89, 87, 56, 88, 56,182,157,158, 78, 28,118,163, 54,165,114,166, 31, 27,233,143,126,253,167,191, 17,
+ 27,241,166, 34, 42, 53,133,142,248,236,244, 78,241, 97,205, 42, 72,  9,135,117,128, 68, 20, 77, 37,100,120,201,224,105,190,121,
+ 34, 98,225,248,140,197,197,154, 59, 14,104,141, 27,227, 52,105, 33, 26, 86,127,241,120, 96,127,218, 39,143,152,144,181,196, 20,
+178, 38,197, 38, 39,155, 36, 44, 41,118, 43,158,162, 45,204, 45,104, 91,136, 80, 74,138,102,247,230, 36,139, 73, 82,210, 64,166,
+155, 85, 83,166,141,241,185, 49,202,103, 78,187,225, 32,153, 44,  6, 57,232, 85, 54,140,241,233,118, 51,121,190, 33, 99,199,161,
+159,138,146,137,135, 80,184,145,132, 36,177,146, 24, 35, 34,122,154,102, 73,138,133, 92, 28, 38,189,129, 17,125,235,145,213, 14,
+ 95,194,126,125,207,235,247, 59,123,126, 96, 41,130,183, 43,221,102,116,173, 36,242,186, 70, 92,237,176,  9, 52,216,184,236,159,
+192, 26,193,218,207, 51,238,229,113, 46,198,195, 24, 67,137, 61, 59, 50,163,137, 54,232,163,147, 83,249,124, 25, 49,139, 24, 98,
+ 89, 42,171, 68, 87,116, 31,141,222,123,  0,125, 36, 38, 87, 93, 42,143,143,103,246,143,239,120,251,254,  3, 47,123,159, 53,169,
+194,108, 83,137,184,154,235,140, 74,198,229,108,244, 30, 44,248,209,233, 30,242,225, 12,212,199, 84, 53, 83, 15, 50, 49,181, 50,
+223, 79,238,127,152,208,153,221,235,228,144,244,179, 72,228,159, 83,230,242,124,229,207,127,253,115,254,244, 23, 63,229,223,255,
+237,247,120, 55,202,186,112,247,240, 53, 31, 62,188,227,122,121,102, 21,193,146, 16,  1,131,142,122,  9,247,183,100,214,211,137,
+177,109, 28,125,231,103,223,125,203,126,188,240,244,252, 68,242,224,235,119,139,142,238,225,157, 90, 18,181, 44, 20, 57, 81, 31,
+ 31, 35, 31,189,117, 62,188,127,226,249,205, 91,220,140,243,249, 14,213,  5,147,157,156, 18, 99,  8,165,220, 35,122,224,166, 72,
+ 15, 21,163,228, 26, 80, 32, 29,113, 72,137,  4, 74,119, 24,213,207,120,115,116,169, 88,219,105,132,236, 45, 53, 62, 35, 41,105,
+ 92,  2,204,217, 61,250, 24,232,  6, 86,241,147,176, 95,119,246,190, 35, 53,  7,134, 57,173, 17,215,179, 68, 57, 37, 78,121, 33,
+165, 65, 45,137, 53, 21, 78,181,208,232,228, 28,210,251, 49,169,141, 93,132,228,241,158,237,233, 76,187, 93,145,114,130,217, 29,
+ 97, 12, 52, 71, 79,173,106,172,112,244,148,145,146,162,184,198, 50,  3, 67, 37,145,203, 39, 18, 86,163, 15, 65, 77,241,234,100,
+ 25, 28, 91,143,194, 17,140,194,  9, 23,167,206,244, 13,229,204,242,120,162, 28, 35,212,155,156, 89,214,202, 16,229,148, 11,185,
+206,139, 90,214,248,121, 29,157,243,114, 38,223, 69,203, 99, 53,165,239,142,136,113, 46,130,245,131,253, 22,196,175, 97,129,164,
+109, 54,224,232,108,121, 67,134, 96,187,210,116, 71, 60, 32, 62, 94,  4, 60,147, 21,242, 57,192, 89, 34,131,106,137,187,122,130,
+188,132, 17, 82, 64,181, 83, 82,102, 80, 67,221,233,141,146, 34,203,238,226,208,  5,125, 88, 41,165, 35,195,105, 67,168,118,166,
+123, 99,179,142,100, 65,233, 12, 87,210, 41,158, 71, 92, 59, 39, 34, 22,120,119, 58, 33, 67, 57,223,  9, 11,  5,177, 66, 87,161,
+ 86,161,  2, 78, 92, 46, 85, 61,146,  7,249,140, 76,236,118, 74,202, 79,127,246, 77,168,121, 63, 50, 75,126,220,110,120, 31,156,
+146,179,190,186,255,209,198,187, 79,123,239,237,218,160,109, 60,156, 43,105,253, 50,230,187,  1,236, 55, 99,236, 55, 22,233,156,
+191,186,155, 62,172, 47,231,124,127,255, 97,231,246,241, 25,179, 43,105, 24,251, 17,229, 69,184, 71,111,135, 57, 62, 18,173, 25,
+189, 26,168,114, 90, 19,126,105,112, 51,198, 82,192,141,179, 15,242,131,210,155,193, 67,133,182, 33,253,160,249,100,248,203,153,
+114,223,240,125, 32,102,244, 82,121,185, 61,147,126,249,199,191,252, 77, 78, 25,199, 41,146,167,227, 56,  0, 45, 51,199, 70, 77,
+ 50,203, 90,102,174,108,182,158,185, 59, 99,180,248,115,  4, 81,234,147,179,156,153,199,158,231,  8, 54, 34, 22,149,136, 15,213,
+167, 26,214, 20,218,234,148,187, 67,214,206,162, 65,219, 74,153,146,106,132, 16,220, 98, 79, 44,128,134, 81, 76, 71,236, 44,155,
+199,148,169, 50,144, 20,117,169,237, 48, 44, 65,205,204,250,206,193, 16,159, 77,110,132,145, 77,130,210, 35,204,  3, 57, 11,181,
+  8,160,180, 99,246,181, 47, 33,161,125,202,232,227,225, 42,151,153, 16,208,154, 35, 27, 58,223, 50,161, 14,132, 67,247,147, 67,
+223, 62,253, 76,230, 62, 75, 92,208,249,128, 12,  6,126, 66,182, 39,222,188,123,226,201,206,172,235,138,200,  1,250, 64, 93, 87,
+ 78, 69,226, 16,203,153,146,230, 30, 63, 11,183,163,197, 94,102, 86,201,250,188,212, 12, 62,237,210,136, 30,233,249,223,221, 71,
+ 52,216,165,169, 94,104,250,220, 96, 87, 92, 49,205, 44,229, 76,146,192,208, 90, 50,124, 68,164, 39,215,105,244,243,136, 33,113,
+ 92,121,255,225,194, 97,243,226,166, 78, 22,226,205, 75, 96,135, 83, 42, 56,134,245, 49, 47, 50,161, 96, 32,142, 72, 72,144, 19,
+ 59, 19,112,162, 79,198,190, 32,228, 68, 92,201,163,  3, 62, 37,137, 73,222,237,115, 79,187,166,  0, 22,  5, 19, 64,217,246,141,
+119,111,174,252,236,241, 91,126,120,234,188,185,117,124,100, 78,167,202,215,175, 30,121,121,255,196,219, 15,239, 80,235,148, 20,
+177, 49, 27,241, 26,115, 81, 94,173, 75,252,253, 34, 12,107,124,124,251,251,176,124,214, 18, 43, 41, 66,250,210,148, 81, 58, 62,
+  6,231,245,158,191,252, 87,127, 77, 89, 31, 57, 90,244,  4,140, 49,248,248,252,204,243,135,183,208, 27,231,187, 51,230,131,101,
+ 93, 40, 57,212, 45, 52,212,147,122, 82,210, 90,195,252,216, 59,218, 13,187,171, 68, 82, 84,241,209, 41, 98,228, 53,147,146, 82,
+151, 59,180,109,104,130,118,219, 81,115, 32,199, 69,210, 19, 57, 27,157,198,216,194,221,223,218,160, 38,157, 77,116, 43,119, 37,
+  6, 19, 95, 66, 49,169, 89,209,228, 84, 73,228,147,194,112,108,115, 68, 15,250, 41,222,187,126, 52,218, 40,209,231,224,198, 80,
+ 71,107,139,136, 41,134,247, 78,174, 10, 82,195, 69,159, 27,154,203,188, 56, 94, 97,  3,134, 49,124,199,247, 30,117,200,122, 48,
+134, 49,100,208, 92,201,221,232,107, 70,205, 98, 60, 39,161, 90,209,101,153,139,111,135, 10,107, 78, 49,225, 62, 20, 70, 90, 66,
+245, 51, 33,149, 51, 70,116, 83,156,171, 66, 86,110, 71, 15,114,221,225,116,223,  3,185,236, 30,106,227, 17,201, 15, 75,  7,200,
+ 65,117, 97,183,198,232, 97,248,181, 49,137,113, 37, 62,199, 82,  3,222, 18, 43,192,206, 90, 11,178,199, 64,112, 62,223,115,244,
+206, 16,161,164,131, 98,  9, 77,117,254, 39,214, 77, 34,  3,145,194,214, 14, 22,  9,178, 99, 87,195,142,107,184,249,147, 82,100,
+161,209,161,116, 74, 90, 33, 13, 44,  9,203,140, 16, 10, 70,154,  0,172,135,181,210,247, 57,141,175,209, 18, 56,122,139,109,201,
+140,103,105,214, 32,125, 78,179,165,171,225,196,244,126, 94, 51,223,125,247, 93,164, 87,126,204,225,219,103,178,100, 52,238, 42,
+ 44,119,247, 95,196, 73,190, 15,216, 46, 55,164, 31,220, 63, 44,164,186,126,177, 73,250,122,109, 28,251,198, 89,  7,167, 87, 15,
+ 97,174,248, 66, 95,215,  1,207,111,174, 28,207,207, 28,219,133,214,119, 68,156,162, 18,102,206, 99,160,199, 44, 26, 27, 10,199,
+ 96, 79, 87, 60, 37,122, 83, 90,143, 40, 49, 26,113,228, 37,156,157, 60,191, 24,119,122, 34, 23,103,219, 19,180, 65,117, 99,244,
+ 29, 77,142,101, 37,231, 29, 25, 78,250,229, 47,130, 40,247,169, 82,214, 60,220,210, 62, 31, 98, 34,177,219,140, 46,233,185,207,
+211, 40, 50, 17,145,144,234, 36,118,220, 99,102, 41, 17,155,221,219, 68,172,205,137, 15,201,188, 39, 12,143,189,178,164,132,228,
+ 20,123,198, 56, 11, 80,145,184, 79,249,148,217, 25,211, 44, 21,  7,165, 70,112, 30,245,105, 12, 27, 81, 52,195,136,202, 82,235,
+ 19, 51, 27,139,101,178, 36, 58, 18,132,174, 17, 53,118, 41,167, 48,  2,150, 28,153,239,217, 21,239,201,145,254,105,122, 54,172,
+123, 76, 28, 40,189,219,188, 80,232,188,137,202,244, 19,204,137,115,150,222,216,236, 73,119,226,161,208, 71, 32,101,139,214,200,
+210,231,248, 25,139, 70,146,  0,132,108,131, 15, 31,222,242,182, 47,172,231, 71,178, 93,130,  4,118,119,230,254, 28,123,123, 23,
+ 69,117,230, 84,243,224,182, 53, 30,191,251,150,159, 62, 40,207,215,  3, 47, 57,186,237,213, 62, 99,106, 53,197, 78, 92,100,102,
+232,165,144,209,144,211,221,200, 17,226,143,219,123, 45,228,178,  6,209, 78, 51,163, 93,113, 83,150, 28,149,154,102,145,107, 64,
+ 19, 62,226,247,220,198,248,124,128, 99,246,153,158, 38,170,164,148,195,213, 48, 34, 74, 52,204,131, 38,244,121,205, 19, 44,127,
+199, 35,190, 40, 18, 63,115, 62,173, 74,130,176, 87,210, 92,189, 76,233, 65, 98, 81, 31,239, 21, 52, 50,226, 81,161, 67,206,137,
+119,207, 87,174,214, 40,245,  1, 43,153,222, 12,117, 37,173,153,111,127,242, 71,148,122,226,249,253, 71,246,219,141, 97,141,164,
+ 81, 67,  9,157,164, 70,213,194,253, 82,120,126,126,226,195,243,109,238,139, 97,201, 37,218,148, 60, 86, 38, 46,177,242,209,190,
+211,219,133,135,135,123,190,126,248, 26,175, 57,136,134, 24,219, 24,188,127,247,150,203,211, 91,126,120,255,134,203,211,  7, 94,
+ 61,124, 75, 22,101,213,  4,218, 73, 75,101, 41, 29, 79, 78, 41,  5,205,153,147, 59,137,138,136, 80,178, 98,139,225, 71,166,158,
+ 50,181, 15, 88,148, 29, 71,252,204, 41,101,250,112,134, 54, 16,225,184, 70, 50, 37, 75,162,215,168,128, 37, 25,244,142,148,130,
+150, 66,219, 27,107, 86, 30, 78,143, 49, 85,  6, 11,149,253,118,176,155,161,107,193, 70,141,  9, 97, 56,201,157,182,117,  6, 78,
+118,103,116,103, 77,137, 67,140,163,141,104,169, 59,194, 12,232, 75, 66, 70, 66, 77,176,237,  8,229,203, 58,189, 53,122, 15, 40,
+202, 90, 79,244, 91, 24,208, 82,142,125,250,189,156, 98,106,215,204,178, 70,186,225,112,  1,233,104,141,202,222,220,  2,153,139,
+164, 48, 92, 14, 65,220,103,236,199,241, 50, 88,214,130,155,243,114,233, 65, 18, 20, 24,253, 32,137,114,219, 59,169,128,250,194,
+ 97,141, 54,241,201,203, 88, 73,146, 25,185,144, 69,194,211, 42,144,181, 34,213, 89,150,133, 59,114, 96,161,211,  3,153,196, 54,
+ 58,139,174,211, 56, 12,249, 20,184,103, 63, 42,182,  4,131, 65, 60, 74,139,106, 25,220,246, 29,146,112,242,  2, 37, 98,114,150,
+140, 69, 86,144, 74,223,  6,148,140,165,140,141,134,186, 83, 83,101,185, 95,144,107,163,121, 37,201,194,227,253, 29, 57,175,236,
+ 87, 11, 86, 65,178, 48, 72,137, 98,105, 80, 36,179,212,244,185,238, 25,148, 60,235, 86,133, 17,165, 59, 37,113,127, 90,248,246,
+187,111,127,244,129,118, 61,140,227,186,225,222,185, 95,132,114,254, 50, 40,215, 91,119,110, 79, 55, 10,141,199,135,245,139,236,
+233, 63,161,103,111,215, 70,219,119, 30,171, 83,191, 16, 40,231,211,215,135,  1,207,239,158,185,189,188,167,219,117,174,106, 60,
+146, 18, 67,105,195,104, 24,108, 54, 89,  7, 70,219, 58, 91, 19,134, 42, 99,  7,218,129,152,210,113,210,128, 75,106, 72,191,197,
+ 37,180,117,154,247,168,250,178, 30, 60, 15, 75, 84, 41,228,205,184,108,157,244,211, 95,253,234, 55, 49,129, 79,110,123,138,  3,
+ 91,103,107,155,169,205, 58,210,192,185,106,154,230, 50,137, 76,183, 50, 93,225,201,144,233, 34, 23,209,  9,  9,153,242,111,138,
+155, 51,234,209, 64, 69,  0, 33,146, 70,155,144,216,192, 44,140, 44, 62,101,111, 62, 81,213,231, 78,213, 37,148,  2,225,211,222,
+218, 63,205,120, 84,173,161,144,103, 69,107,130,209,162, 77,110,238,185,162,127, 60, 12,126,154,192,109, 96,157,153,123,158, 59,
+220,  2,185,199,255,247, 19,182, 69,101,102,231, 53,178,242,146, 52,100,102, 79,177,211, 23, 24, 71,240,219, 37, 23,176,128, 87,
+  0,241,218, 82, 10, 68,174,197,170,192,109,204, 28,119, 68,218,178,134,114,113,123,121,205, 15, 31, 21,150,  7,214,124, 99,140,
+ 78,210,194,253, 67,230, 62,199, 19,166,148,200,188,215, 42,200, 56,216, 44,243,167,191,254, 57,127,241,179, 51, 31,158, 95, 72,
+185, 96,162, 81, 85,170,137,154,211,108,199,171,224,198, 34, 39, 28,167,141,  3, 81,231,180,172, 33,197, 79, 31, 68, 42,143, 36,
+ 45,129,185, 84, 99,223,142,160,251,169,211,134,205,140,117, 28,112,189,  7,217, 79, 38, 26,183,207,200,158,207, 75,153, 68, 75,
+ 14, 71,239,211,103, 56,189, 22,159,126, 99, 18,235,  2,183,120,109, 41,110, 68, 97, 84,156, 74,202, 39, 47,169, 32,  1,244,209,
+ 50, 47,155, 51,111, 79,236,216,179,166,144,247,137,247,211,209, 54, 46,205, 57,127,251, 45, 53, 29,108,109, 76, 45, 34,113, 42,
+  5,236,153,223,255,240,154,158,206, 65,240,243, 35,154,208, 12,142,163, 49,128, 54, 58, 79,215, 27,157,130,229,144,205,197,102,
+175,124,157,181,181,226,244,126,176,245,198,251, 15,207, 60, 63,253,128, 31, 55,150,186,112,126,120,164,212, 51,210, 99,197,177,
+217, 96, 63,140,219,214,232, 45,254,254,203,243, 19,248, 96, 52, 99, 59,140,197, 21,205, 80,178, 80, 40,140,179,224, 35,133, 25,
+ 12,153,242,233,137, 61,117, 90,107, 97, 56,235,133,231,237,138, 75, 96, 40,123,219, 35,167,236,137,221,123, 64, 96,114, 71, 83,
+162,  8,156,151,202, 82,132,180, 38,210,150,232,121,196, 82, 99, 24, 67, 50,142, 48,198,160,156,148,100, 97,194,204,186,176,117,
+240,201,117,239, 51,145,178, 31,145,101, 95,180, 83,164, 32,189, 35,139, 96, 86,233, 71, 35,173,  2, 68, 73, 81, 78,144, 78,  5,
+ 19, 97, 41, 18, 81,215, 82, 57, 45,103,196, 14, 50,  9,207, 37, 64, 62,154, 41,231,132,105, 34,175, 37,216, 17, 71,184,207,149,
+ 83,148, 10,181,151,184,231, 81,162, 65, 15,235,208,156,  0,  0, 32,  0, 73, 68, 65, 84,177, 74,112,231,107,124,207,251,177,115,
+140, 62,115,249, 17, 87,236, 35, 16,198,247,247,143,104,183, 32, 36, 86, 67, 45, 69,215, 69,118,106,173,161,170, 17,112,160,240,
+115,156,168, 75,194,118,101,200,142, 18,234, 66, 78,194,186, 22, 18, 97,140,141,  5,154, 97,148,  9,205,137,247,254,222,250,132,
+211,212,  0,118,141,192,132,186, 53, 50,202, 80,167, 75,166, 72,166,181,134,211, 40,227,142, 69,238, 40, 94, 88,213,217, 83,226,
+ 62,215,160, 54,110,157, 94, 66,177, 40,139,145, 74,225, 76, 32,136,179, 42, 82,167,163, 69, 62,213, 70, 15,178, 46,225,223, 24,
+ 78,201,  5, 69,185,187, 91,249,250, 39,223,254,168,  3,205,128,203,173,195, 30, 13,118,231, 69,169, 95,224, 80, 55,224,122, 29,
+244,237,138, 90,231,254,254,244,197, 50,234,183,  6,251,243, 13, 27,141,115, 26, 44, 15, 95,102, 93,240,233,251,254,248,113,240,
+244,254, 45,215,203, 71,220,110,140,225, 12,194, 32,235,238,216, 30, 24,232,156, 43,151,100,108,210, 65,207, 84,203, 12, 57, 16,
+239,113,158,173,112,108, 87,252,188, 34, 35,207,129,106,112, 53, 35,157, 87,250,  6,153, 30, 83, 44,  3,124, 99,219, 14,140, 74,
+142,178,140,140, 43,140, 22,192,  2, 36, 32,  6, 33, 55,199, 84,101,115,207, 53,154, 71, 60,109, 76, 82,172, 31,179, 60,100,238,
+224,125, 10,186, 46,243, 97, 30,221,235, 35, 15,100,132,147, 93,243,  4,192,244,246,217,192,134,135,123, 91, 52,238,  0, 99, 56,
+163, 27,170,138,149, 76, 50, 65,122, 72, 86,185,  6,183,122,180, 30, 49, 27,143, 31,148,154, 96,173,205,143,215,108, 46,114,229,
+255, 98,237, 93,123, 52, 75,175,243,188,107, 61,167,189,247,123,168,170,238,158,158,238, 25,246, 12,135,164,117,  0, 21, 69,176,
+ 12, 57, 78, 16, 56, 65, 28, 36,254, 89,250,158, 31,148,111,  9, 16,  5, 65,108, 41,144,109,201, 36,101, 82, 34,103, 56,167,158,
+ 62, 85,213,123,218,251, 57,173,124, 88,187,155,148, 19,  3,  6,212,  5, 16,232, 30,206, 84, 87, 23,234,125,247,243,172,117,223,
+215,213,229,237,224, 95, 17,111, 62,225,222, 42,210,189, 25,142,156, 85,112, 82,143,212,160,235, 11,221,210,187,189,118,156, 38,
+ 66,247,116,223,241, 42,166,143,244,206,242,  4,206,211,123,167,149, 66,  8,182,211,124,203,161,199,217,139,205,  5, 59,224,  4,
+103,183,133,170,157,168, 30,231, 61, 75, 57,243,205,155, 76, 30,158,112, 21, 27,189, 46,228, 62,112,117,181, 97,183, 77,104,110,
+132,104, 24,203,224,  6,180,158,121, 94, 60, 15,110,174,217,199, 70,240,  3,211, 52, 50,202,200, 33, 47, 28, 15,106,226, 24,105,
+246,144, 14,110,245, 64, 43,229,114, 36,  4, 33, 14,  9,212, 17, 69, 81, 31, 33,237,136,126, 64,122,179, 85, 75, 93,152,  9,168,
+111, 76,155,192,249,214,104, 71, 97,  8,107,226, 94,168,170, 56,111,  1,157,134,  9, 34, 88, 25,  6,181,118,171, 59,245, 53,236,
+182,194, 99, 84,127,195, 54, 48,249,143,190, 11, 64,233,186, 91, 71,204,244,164,118, 37,183,112, 94, 45, 54, 38, 14,  3, 26,196,
+156,228,235, 65,176,181, 85,213, 91, 59, 89, 28, 55, 15,191,199,147,143, 62,195, 17,240,218,205,102, 36,153, 40,112,255,230, 21,
+127,253,215,255,158,219,195,194,199,159,124, 68, 62, 31,185,125,121,  7,162,132, 21,116, 84,202, 66,238, 14,117,129, 16, 26,173,
+130,223,  4, 50,130,228, 74, 60, 45,104,202, 12,209,222,244, 75,237,208, 26,247,247, 11,151,185, 48, 29,239,185,222,236, 25,175,
+118,164, 71, 55,248, 49, 81, 46,103,206,231, 35, 93, 50,175,223,124, 65,153,247,116, 17,210,113, 99,164, 48,113,236,246,123,110,
+198, 13,222,119,198,171,192, 62,222,176,117,  9, 66, 98,236, 66,118, 51,151,195,  5, 29, 71,234,165, 50,  5,199,161,157, 77,135,
+ 28, 70,202,229,100,  7, 27, 25, 40,209,177,241,142, 73, 32,151, 78,138, 29, 25, 35, 73, 96,110,150, 95,113, 67, 64,115, 91, 91,
+ 44,178, 78,223, 34,165, 22,220,108,172,131, 32, 43, 73,141,153, 82,103,156, 58,150,174,108, 92,167,246, 21,106,228,225,146, 11,
+ 42, 74,184, 40, 62,101,163,203,181,128,164,104, 36,186,105,196,183, 74,203, 51, 18, 58, 18, 35,254,210,105, 37,147,210,214,216,
+ 23,222, 19,157,199, 23,240,217,  1, 21,205, 51,125,116,180,230,104,117,102,179, 79,176, 52,154,  8,146, 23,220,176,208, 24, 88,
+150, 78,136, 29,189,171,118, 89,240,222,  4, 39,105,161, 75,178, 31,171,105, 32, 70,143,199, 19, 71,  7, 13,138,118, 24, 61, 42,
+138,234, 72, 47,133,208, 65,252,150, 48,218,  4,169,149, 72, 61,157,112,201,209, 23, 71,218,  0,101,139,196,194,220,192,235,130,
+ 23, 65,245,138,210,160, 75, 65,154,135,  9, 26, 13,157, 21,170,226, 39,129,165,208,195,218,134,105,  3,234,  3,234, 43,  3,  5,
+239, 39, 51, 72,198,100,221, 14, 87,152,181,155, 55, 91,103, 84,132,235,  7,158,118, 41,156,123,197,109, 19,253,226, 81,231,152,
+181,224,147,160,206, 91, 77,211, 55,155,126, 57,143,200,250,176,232,230, 85,120, 75,248,156,166,244, 15,166,168,153,150, 66, 41,
+221,  4, 65,113,156,222, 91,152,173,170, 53,133,220,154,157,120,111,  6, 53,125,155,113,106,248,228,223, 43, 73,110,  1,230,174,
+132,102,104,178,222,213,104,157,189,210,122, 51,252,114,178,203,205, 41, 23,187,176, 54,143,239, 13, 21,165, 95,128,224,209,166,
+ 52,  7,131, 75,118, 49, 40, 11, 65, 71,203,173,232, 45,253,238,192,180,221, 35,243,192,236, 20, 39, 25, 45, 30,134, 66, 57,207,
+  4,175,250,110, 79, 28, 87,159,138,168, 73, 49, 88,109,106,173, 22, 16,103,207, 94, 58,244, 98, 29,206,181,174,166,130, 73, 79,
+180, 34,106,  2, 17,161,128,170,225, 15, 67,180, 14,122,235,132,232,214, 52,185,183,207,169,205,248,234, 85,233,213,106,107, 66,
+131, 30, 86,198,183,213,234,236,135,213,250,226,174,175,220,111,177,209,180,169, 79,109, 23,  6,110,213,200, 86,180, 55,196, 69,
+240, 66, 47, 29,188,217,146, 84, 76, 15,104,  9,253,106,211,  4, 21, 22,239,209,238,109,  4,220,141,231,174,193, 66,122, 56,251,
+111, 92,239,235,215,101,245, 43,137,163,  5,238,180, 17,130,103, 22, 79,207,118,115,117,216,186,192, 98,119,141, 82,173,134,133,
+ 26,121,173,228, 51,175, 95,188, 97,241, 55,220, 92, 69, 56, 29,200,213, 18,227, 67,176,233,200,116, 51, 33,231, 76,139,142,109,
+ 80,222, 28, 50, 67,216,241,225, 46,145, 23,211,243, 13,227,104,189,242,197, 49, 36, 69,122, 48,132,110,179,215,152,119, 29,213,
+ 11,155,113, 36,166, 13, 93, 42, 57, 47,224, 60, 46,140,196,112,133, 11, 66,110, 71,142,167, 51,222,119, 98,114,228,166,112,168,
+134,225, 12,214,221,174,181,173, 35,244,142,214,181, 26,167,106,107,136,174,235,238,118, 29,169,175, 92,255,213,135,135, 58, 75,
+ 94, 59,177,232,158,136, 61,252, 13,112,180, 86, 45, 68,241,226,105,116,188, 58,154,216, 94, 40,215,130, 11, 48, 18,185,190,217,
+178,217, 36,238, 79, 51,247,135,153,162,194,239,254,232, 25,143,159,126,194,254,106, 71, 12, 74,111, 11, 75,  9,  4, 47,120, 31,
+ 56, 30, 15,252,228,167,127,205,183,207,143, 56, 47,188,250,234, 23,212, 90,184, 95, 50,131, 56,156, 84, 92, 80,198,100,201,255,
+ 40,118,112,244, 13, 90, 46,168, 83,162, 79,212, 22,201,217, 42, 77, 33,218, 11,207, 77,145, 82,  5,109,157,211, 60, 51,247,204,
+118,185,231,106,220,113,189,191,226,234,217, 15,185, 28, 78,124,247,237,231,156,151, 19,167,243, 61,165,194, 16,108,151, 22,135,
+ 45, 75,109,148,113,166,247, 78, 58, 94, 49,189,250, 14,105,103,246,215,215,140,251, 61, 83, 24, 80,  2,229,120,162, 19,152,107,
+161,212,108,147,161, 34,184,224,205,166,230,  6,118,195, 68,168, 25,100,102, 28, 61,177,120, 22, 42,151,106, 83, 44,154,141,170,
+123, 24,232, 93,168,117, 97, 76,  1, 41,153,193, 55, 84, 43,151,222,240, 89, 57,182,163,153,234, 42,148, 10,113,152,104, 37, 51,
+ 13, 27, 46,161,112, 57,207,196, 20,  8, 41,209,234,140,  2,195, 48,225,199, 68, 61,157,215, 62,187,178,204, 74,242,129,158,187,
+185,190,135, 68,107, 29,245,217, 36, 37,120,114,185,216,254, 63, 76,198,158,183,183, 16, 54, 94, 24,247,137, 59, 61,209,115,  6,
+ 95,105, 26,145,147,146, 70, 51, 51,150,101,161, 55, 72, 65,144,170,196, 94, 41, 68, 82,132,222,  2,105, 52,133,107,208,140, 79,
+ 55, 44,249,140,248,193, 42,187,  4,156, 70,194, 38,194, 37, 91,160, 85,149, 56,141,244,122,161,104,103,240,227,218, 16,  1,245,
+ 23,106,177,209,118,211,198,232,175,172,142,232,160,196,134,239,145,128,105,147, 93, 84, 36,116,166,228,169,205,177,212,142,236,
+ 35,110, 46, 12, 91, 71,244,123,202,105,198, 57,101, 12, 19,190, 38,138,191,167, 54,207,102,124,136,200,140,195,147, 37,163,135,
+ 13,110, 10,184, 12, 75, 93, 51, 23,100,196, 21,171,  6,146, 40,245, 98, 32, 32,181, 85,133,138,245,117,157, 42, 99,136,104,176,
+160,165,143,254,189,220, 76,123,181,195,181,211, 70,140,239,231,  1,169,216,148,184,105, 35,122,236,150,247,158, 62,122, 55,171,
+166,168, 29,160,222, 39,116, 38, 96, 53,202,170,141,  0,152, 75,180,226,131, 82,171, 88,134,108,116,212, 37, 83,179,226,134, 70,
+111,142,208,  3, 69, 51, 41, 57,212,205,212,115, 39,223,123,154,116, 54, 13,156,102, 52,120,242, 41,147, 52,162, 94,168,151,133,
+ 22, 60,132,  4,151, 45,165,157,104,162, 56, 42,193,112,149,197, 70,139,128, 91,251,177,130, 61,225, 43,153, 16,236,116,195,186,
+ 39,106, 52, 27,109,173, 26, 64, 36,208, 74, 71, 29,132, 16,173,114, 20,236, 13,177, 75,160, 54,219, 13,138,211,149,126,230, 32,
+ 85, 75, 83,183,138,115, 38,164,160, 90,138, 79, 93,164,162, 12,211,202,121,175,138,123,215,  7,175,168,243, 52,181,240,151,136,
+210, 74, 39,122, 99,228,170,179,221,110,148, 64,117,250, 91, 61,121,135,115,149,218, 96,  8,158,236,108, 79, 39, 42,120,137,107,
+168,160,209,168, 68,231,169,174, 35,205, 32, 52, 54,219,111,180, 12,201, 59, 60,141, 86, 59,173,174, 61, 34,215,145, 22,200, 75,
+ 39,186, 96,181,174, 21,174, 19,213,129, 87,154, 42,181,153, 34, 50,138, 65, 85,110,111,239,185,171, 55,108,246, 27,250,229,110,
+245,129, 79,140,201, 19,146,  1, 90,118,227, 68, 74,  3, 46, 53, 94,125,247,154,251,182,225,211, 15,119,214,223,119,194,233, 88,
+104, 75,103,209, 78,232,137, 18,172,119,174, 56,162, 56,242,114,226, 88, 23,123,160,199,209, 86, 37,216, 56,176, 57,199,184,125,
+ 72,116,142,186,156,  9,117, 54,  8, 75,105,214,207, 94, 10,111, 58, 86,171,112,  1,  5,150,197,152,248, 93, 27,170, 30,215,140,
+ 43,208,189, 39,136, 39,250,192, 37,159, 44, 91, 97,155,164, 53,181,110,117,186,190,190, 49,202,186,139,183,204,134,173,125,186,
+128,107, 54, 14, 29,136,  4, 31, 86,213,165,185,203,187, 86, 90,233, 28,142,182, 18,122,124,179,225,102,136, 60,127,147,249,244,
+163, 71,124,255,147,199,220,157, 13, 47,234,156,129, 57, 74,104,148,211,137,191,249,233, 79,248,226,171, 23,116,239,233,234, 56,
+228, 70,171, 22,218, 43,189,153,151, 32, 43,181, 84,134,209,250,244,226, 28,195, 96,237,138, 75,235,171,108,168,225, 67, 50,118,
+ 66, 85,186,171,164, 80,  9, 49, 32, 14,154, 88,230, 98, 62, 23,150,124,199,208, 46,108,183,145, 63,252,189,223,225,248,209, 15,
+249,119,191,250,183, 28, 95, 63,167,204,197, 12,116, 75,134,218, 40, 30,206, 71,147,190,236,107, 39, 15,182, 83, 59,180, 11,254,
+190,144,176,  7,158, 79,145,221,246,134, 48,142, 68,157,232,173,146, 82, 66,106,103,244,138, 31, 43,190,221,147, 91,103, 28, 18,
+170,182,246,202,213,214, 46,222, 21, 74, 24,161,204,180, 84,208,217, 17,186,146,253,145,224,214, 38, 73, 53,192,252, 92, 10, 18,
+ 28,125,182,206,189,132,142,250, 74,119,141,238,149,168,  3,108,  4,231, 61,158,142, 31,134,117, 85,213,233,213, 17,125,160, 55,
+ 80, 87,137,226,233, 67,160,229, 11,189, 71,146, 66,205, 51,179, 84,252,232,  8,249, 98,253,122,141, 72,174,228,160,116,159,144,
+ 57,147,203,137,154, 61, 89, 26,161,218,131, 35,197, 96,175, 81,245,171,234, 21, 92,175,214,227,239,208,124,198, 15,129,228, 70,
+100,241,244,101, 97,196, 51,108, 70,154,120,124, 28,215,189,246,133, 92, 33,184,102,232,102,201, 84,109, 36,133,114, 94,167,129,
+  9, 90, 91,144,230, 57, 29, 10, 93, 10,174, 55,  3, 70, 57,207,162, 51, 78, 58, 18, 61, 65, 18,218, 58,205,219, 84,202,139, 64,
+ 74, 28,238,206,164, 52,154,149, 16, 33,142,  3,229,212,  8,155,137, 16, 45,104, 28,213, 81, 68, 72, 97, 48,192, 77,155,145, 49,
+224, 43,180,161,242, 34, 31,153, 14,138, 31, 38,100,177,247, 65, 31, 60,  9,207, 69, 59, 99, 44,196, 24,105,218,137, 56,196, 69,
+243, 30,104, 32,165, 96,196,130, 38,132,104,245,197,127,240,  3, 82, 49, 76, 50,188, 19,117,189,175, 49,118, 47,213,  2,126, 81,
+215,138,235,123,250,220,213, 50, 90,210,186, 17, 76,223,227,135, 98,218,236,185, 45,228,101,198,105, 99,166,209, 22, 19, 59,233,
+224,184,116, 91,221,  8,192, 18, 80, 95,  8, 77,200,173, 83, 60, 72, 27,216, 70, 71, 47,103,188, 84,106, 19,250, 16, 88, 80,252,
+224,241,167,145,115, 57, 81, 59,164,232,208,185, 82,229,  2, 97,160,229, 76,233,130,255,248,123, 31,255,169,243,193,116,153,205,
+120,212,125, 69,138, 54, 93, 49,140,106, 35,210,190,222,170, 44, 53,237,  8,193,170, 70,109,133,202,184,213,177,142, 55,146,153,
+116, 93,249,236, 22,110, 97,165,197, 53,175,246, 67, 32, 66,175,  6, 59,113,221, 33,174, 65, 20,171,190,121,235,121, 39, 93,193,
+ 35,120,186,184, 21,148, 33,171,126, 13,106,209,149, 96, 84, 86,189,162, 82, 90, 67,156,199,247,183,196, 49, 59,144,  4,231,201,
+205,186,212,136,174,228, 55,121,167,115,117, 43,119, 30, 81, 67,151, 74, 64, 74, 71, 89,113,150,235,238,150,119,123,225, 68,213,
+ 66, 88,  3,134, 94, 28,126,221,201,251,181,166,103,251,102, 59, 41,183, 86,109, 31,175, 74,155, 79,188,188, 43,200,120,197, 20,
+ 10,229,178,160,126, 98, 24, 60,219,113,228,106,123,195,131, 93,196, 41,164,125,192, 45, 51,223,124,119,100,247,240,134,135,215,
+ 86, 80, 75,195, 68,140,202,113, 46,220,221, 53,122, 85, 98,156, 24,134,104,221,213,229,158,115,153,137, 97, 36, 72,162, 73,197,
+105,183, 55,201,165,146,136,136, 20,242,229,118,173,124, 29, 41,117,166,148,202,146, 51,173, 89,106,221, 33,212,108, 62,110,149,
+192,219, 45,245,176, 25,240, 62, 48,164,193, 76,110, 33,226, 98,176, 44, 65,107, 52,167, 70, 41, 19,123,227, 77,105, 32, 14, 35,
+105, 53,156,133, 20,240, 26, 86,245,235,218, 54, 72,182,143,199,117,212, 89,  8,206,123, 35, 27, 10,118,  0, 80,148,203, 92, 56,
+ 29, 27,181, 41, 75, 45,220, 31,143,108,135,145,176,217,160, 62,210,115,166,137,144,203,194,207,126,246, 83,254,246,243,111,209,
+110, 52,182, 20, 35, 72, 71,123, 49,152,145,246,117,226,100,154,222, 90, 42, 53, 23, 90,111,150,139,116,107, 86,192,217, 52,200,
+175,147, 30, 33,128, 10, 37,219, 21, 64, 86,170, 97,112,  9,245, 32,210,241, 21,142,167, 25, 87,207,164, 49,179,221,239,216,236,
+ 62, 68,188, 77, 83, 28, 74,147, 70,203,246, 90,201,173,114, 60,221,115, 57,157,112,174,173,239, 20,202, 82, 60, 48,144,253,192,
+253,225,142,229,124,103,100,169, 52, 18, 35, 20, 26, 74, 39, 18,237,117,179, 17,252,108,220,112,141, 74, 41,182,234, 74, 27, 11,
+ 98,245, 10,163,  4,164,122,150, 82,173, 75,191,116,156, 36,156, 31,232, 90,113,123, 96, 10, 22, 66,107,142,184,217, 98,241, 71,
+161,135,193, 82,232, 68,156,102,100, 12,150,155,136,214,210,232,151,133,228, 71, 42,  5,102,243, 26, 72,116,168, 84,131,229, 68,
+ 33,185, 70, 67,136,206, 16,194, 52,123,207,169,125,193,251,181, 38, 75, 49,252,101, 12,140,110,  3, 67, 67,162,183, 27,189, 11,
+184,224,153, 82, 52,229, 50,141,208,197,192, 55,210, 24,156,195,169,237,242, 25,  2,227,176,179,213, 93,178, 53, 83,111, 66, 15,
+224,134, 72,107,153, 58,155, 70, 53,120, 69,170, 82,165, 65,117,  4, 77, 88,102,223,168,123,154,148,232, 12,158,227,147,178, 29,
+ 61,213,216,182,248,102,225, 84, 47,113,205,181, 20,240, 35,174, 70,226,198,193,118, 36,148,209,  0, 89,107,109, 48,142, 29, 29,
+ 10,179, 15,248, 56,224,107,194, 75,161, 56,243,200,187,170,176, 56,130, 84, 74, 15,196, 41,130,247,180,216,240,189,179, 29,  7,
+210,218, 16, 65, 64,170,172, 18,164,128, 56,143, 19, 69,188,213,224,164, 59,196,123,198, 96,151,155, 90,140,108,169,189,161,221,
+ 58,248,186,106,101,123,239,166,247,125, 11,132,106,214,238, 64,237,193,120, 56,205,148,243,133,222,236, 18, 48,  6,240, 49,218,
+231,105, 54,169,163, 91,  6,138,110,107, 53,222,253,175,255, 71,191, 94,255, 28,237,156, 78, 11,243,233, 72,235,141,128,178,153,
+ 60,178,234,168,109,  2,184,166,170,223, 62,148,126,251,215,191,245,103,216,191,219,222,253, 25,115,173, 28,238,238,169,203,153,
+ 90, 26,187, 36,196,193,173, 47,255, 21, 58,182,254,187,218,215,223,247,110,149,219,110,129, 79,233,246,189, 65,187,129,171,218,
+ 98,123,237,190,240,234,246,200,171,175,190,166, 93,142, 44,101, 54,175,  1,166,189, 46, 43, 46,188,148,198,164,163, 61, 83,170,
+ 48, 80,185, 20, 71, 37,144,253, 66,111,222,104,151, 17,186,116, 66,247,132, 24,  8, 85,144, 90, 89,152, 87,179,101, 99, 94,238,
+109,138,206, 98, 97, 97,239,168, 53, 34,255,248, 79,254,169,138,128, 35, 89, 95, 87, 27, 46,173, 50, 10,170,237,101,154,233,  0,
+123,179, 78,185, 95,245,149, 34,138, 19,227, 88,235,186, 51,238, 98,181, 15,183, 66, 93,140,233,110,183, 38,209,106,123, 36,100,
+ 29,195,218,120, 66, 80, 18,145,172,198, 37,183,222,171,221,182,189,216, 77,163,175,193,243, 48,136,213,  2, 48,237, 99,105, 74,
+242,171,182, 53,154, 76,161,245, 12, 62,224,213, 27, 85,206, 55,180, 90,231,185,172,225, 25,112,150,  5, 96, 13,  8,174, 16, 25,
+ 31,  2,162, 29,231,  2, 42, 74, 45,141,142,105, 84, 85, 21,223, 45,184, 37,222,140,114,185,101,124, 48, 88, 71,173, 11,218, 43,
+154, 38,  6, 44,124,211,232, 80, 28,177, 53,106,232,212, 10,125, 62,113,247,230,192,177, 71, 66,240,164, 16,236,166,231,163,145,
+129,134,137, 71,251, 29, 15,158,236,184,142,  2,243,204, 47,191,124,197, 65,  3,191,251,253, 27,  6,140, 66,212,125, 96,255,112,
+199, 39,207, 62,100, 94, 22,126,254, 55,223,240,205,151,183,116,215,185,191,189,227,254, 92,113, 49,144,196, 12, 92,189, 58,122,
+203,148,118,  1, 25, 72, 18, 80,189,112,169,198, 31,118,171, 13,202,148,173, 74,119, 32, 62,226,124,176,219,116, 20,188,  4, 66,
+156,  8, 49,146,250,133, 16, 77,135,121, 58,156,185,203,103,122,177,159, 19,197,148,160, 67,154,152,246, 15, 25,130, 67,186,133,
+ 45,123,235,228,118, 38,  4,143,230,198,156, 15,134,221,204,133,230, 58,209,123,252,218,146,104,213, 24,228,226, 45,187, 48,164,
+  4,210,233,249,109, 34,223, 86, 54,193, 15, 60,184,218,240,236,179,143,121,250,209, 99,188, 68,242,188,240,197,231,255,129,159,
+255,237,183,204,181, 17,130,189,209,246,154,185,212,106,121,143,117,207,111, 43,124, 35,  2,246,110, 15,105,191,194,115,146, 55,
+163,218, 48, 38,210,176, 65, 92,226,156,179,101, 80,104, 68,226,138,243, 84, 92,232,108,162, 35,140, 17, 45,157,224,  2,121, 61,
+ 68,110,146,227,230,225, 21, 63,248,209, 63,225,227, 15,127,192, 79,127,246, 51,126,250,147, 63,167,181, 51,243,220,200,221,234,
+116, 90,237,251,238, 35, 36, 23,232, 30,130, 11,124,244,224, 41, 31, 62,251,152,195, 82,248,246,215,223,226,164,176,217, 15,124,
+248,228,134,113,119,  5, 52, 82,179,230, 74,140,133,161, 58,170,122,102, 21,130, 52,212, 39,170,131,168, 11,168,163,245,  8,203,
+197, 24,231,254,154, 62, 52,150,218,104,185,208,187, 35, 77,202,229,190, 48,207,  5,231,  6,100, 16,134,193, 49,183,140,214, 72,
+ 28,192,  5,101, 57, 84, 98, 20, 92, 11,184, 96,182,197,218, 45,240, 24,186, 85, 15,115,  5, 13,224,180,226,157,163,150, 21,246,
+219,  4, 55, 54, 52, 37, 60,142, 86, 32,174, 80,168, 69, 34, 67, 40,204,165, 48,140, 14,252, 72,175, 11,236, 34,105,217, 16,106,
+ 51, 44,180, 52,186,206, 70,216,171, 35, 90, 10, 23, 61, 19,212, 81,157, 18, 72,224, 27,251,155,107,  4,200,217,110,175,189, 23,
+ 46,165, 25,162, 90, 23,250,165,211,100, 50, 54,194,249, 76, 73,230, 52, 24,123, 96,110,  5, 25, 13,140, 85,206,103, 84, 19,187,
+ 52, 82,139,241,220,157, 56, 52, 10, 27,153,112, 18,200,114,100,114,129, 62, 14,148, 82, 13,235, 57, 23,226, 48,112,208, 78,208,
+ 78,  8,157,185,155,219, 94,164,225,250,150, 77,176,  6, 72, 79, 14,215,140, 27,210,  5,194,236,240,131, 55,250,216,224,153,118,
+  9, 93, 26,251,171,196,118,187, 53,  6,  1,202,169, 54,122,233, 76, 67, 88,223,232, 45, 64,235, 69,136,206, 14, 63, 49, 13,108,
+118, 87, 12,155, 45,209,  5,134, 33,174, 25, 32,123, 27, 53, 13,182,188, 67,114, 27,144,204, 52,216, 96,105,238, 37, 55,150,203,
+140,167, 24, 88,203,193, 24, 71,226, 56,174,156,  1,227,120,200,170,249, 21,237, 22,160,133, 53, 13,110,236,  1,123, 62,246,245,
+230,175, 44,165,145,151, 25,213,178,242,250, 97, 72,145,148, 70,203,143, 96,239, 55,172, 86, 81,227,  4,172,244, 73,187,117,226,
+188,253,190, 54, 12,195, 45, 22,216,190, 44,153,220,214, 26,104, 91,195,142, 41,154,176,104, 37,128,249, 53, 96,108, 68, 75, 11,
+ 52,235, 26,206,126, 75, 30,117,216,123, 83, 45,157,214,141,196,153, 91,229,112, 56,146,207,103,180, 67, 94,238,232,181,177,244,
+197,190,175, 57,115, 90, 58,165,195,164,198,251,168, 93,105,161,144, 91,197, 55,199, 44,149, 54, 47,104,233,232,220,241, 67, 34,
+171,162,139,229,130,154, 83,212, 37,106,153, 73,237, 72, 13,137,188, 40,193,101,146, 27,112,186,225,112,233,  4, 60,184,  6,226,
+ 12,151,233,125, 64, 12,251,182, 30,160,196, 52,158,186, 62,136,213,198,190,193,121,187, 89, 59,197, 55,187, 57,175,193,111, 28,
+182, 95,213,102,181, 11,156,141, 51,155,116,154, 66, 32,226,164, 83, 90,179,174,177, 88,189, 67,170, 65, 68,130,170,  5,217,196,
+186,230,189,234,138,104,181, 29, 44, 98,101, 40,175,224,162,163,118, 99,140,186,106,149, 39,137,130, 22,  5,223,169,171,161,204,
+137, 82, 89,171,122,218,240,206,217,168, 30, 71,136, 17,105,  6,215,176,191, 60, 54,198,112,109,117,126,219,227,191,228, 70,115,
+246, 55,116,189,210,194,250,179,175, 38,171,233,107,194, 81,180,144,187,183,206,127,183, 19, 99,247,118,102,243,189,112, 58, 31,
+120,125,158,  9,131, 77, 64,156,139,124,248,236, 99,126,248, 36,242,213,243, 55, 28, 46, 70, 24, 90, 46,141,205,205, 21, 85,207,
+220,150,194,135, 79, 31,178,219,  6,122,133,210, 33,183,194,155, 23,119, 68, 21,158, 61,189,230,191,251,231,191,195,223,252,249,
+ 79,248, 63,254,213,175, 56, 20,251,123,215,124,160,187,192,146,141, 14,215, 69,152,246, 15, 40,185,161, 33, 49,164, 71, 56,109,
+108, 18, 68,183,167,123, 33, 14, 66,242,147, 49,238,241,196, 24,184,222,236,241,253,196,210,149,143, 30, 61,100,255,240, 17,191,
+254,226, 87,188,124,254,115,142,135, 25,231, 76,217,107,239, 10,138,184,176,190, 64,148, 39, 87,137,221, 52,210, 27, 84, 81,122,
+117,204,125,224,246,213, 61,113,216,144,245, 68, 95,188,237, 44,223, 78,  8,188,153,242, 66,240, 54,150,247,158,228,  6,162, 87,
+114, 83, 98,180,150,198, 82,212,218, 24,181,240,234,238,200,221, 95,253,  7,190,251,246, 27, 62,251,225, 15, 56,190,121,195, 47,
+127,249,156,162,126, 37,123,193,156, 45,145, 42,111, 15,117,210,141,132,232,141, 53, 47,234,  0, 59, 60,212,214,233,165,211,122,
+166,107, 51,157,110,143,248, 48, 48, 36,161,185,  8,117, 13,203,225,168,222,214, 57,167, 44,248, 92, 72,174,227,118,118, 88,234,
+115,225,178,192,252,197, 75,122,254, 11,182,229,192,213, 16,248,236,247,126,159, 23,175,190,134,151,175, 24,150, 70,205,149, 51,
+198,137,118,217,179,184,  6,201,177,148,198, 47,191,253,146,231,175,191, 51,167,122,156,136, 97,226,124, 82,126,253,197, 61,195,
+230,150,237, 56,176,219, 25, 86,212,181, 29,135,190,224,123,182, 67,247,104,185,142, 20, 18,174,173, 73,236,188, 32, 91,111,150,
+181,102,118,188, 97, 35,228, 38, 40, 19,238,210,236, 48, 31, 27,212,153,126,114,104, 77, 48,128,250, 66,203,  2,203,170, 68,238,
+ 74, 41, 21,183, 84,220,184, 67,130,195,245, 76,149,128,244,190,134,181, 28, 58,122, 82, 15,184,218,104, 24, 84,133, 20,209, 62,
+ 32, 61,179, 25, 39,123, 64, 22, 71, 74,153,206,250, 48, 15, 25,127, 89,  8,  4,244,210,  8,221,122,253, 18, 27,218,  7,156, 12,
+244, 65,232,  4,114, 63,217,216, 63,108,145,126,164,167,134, 27, 28, 77, 43,109,174,120,159,104,139,194, 80,137,201,147,231,  5,
+231, 54, 16, 58,157,153,218,133,144, 60,251,152,152,213,102,115, 73,  3,  5,135,204,129,141,223, 24,115, 35, 41, 68,193, 21, 71,
+236, 66,211,  6,110,198,249,  9,231,  2,185,119,244,188,144,198, 72, 62, 93, 40,181, 49,137,199,185, 74,214, 66,239, 35,123, 73,
+ 44, 68,216, 52, 54,203,194, 57,235, 10,245,218,129, 43,140,181,147,221, 66, 26,  6,130, 58,230,161,208, 91,163, 94,172, 55,162,
+107,181, 23, 32,151, 74,107, 54,205,202,189, 17,147,113, 24,172,138, 30,108,186, 25, 12,154,244,217,167, 79, 25,119, 59,203,205,
+185,191, 63, 66,254, 79, 13,187, 85,127, 59, 32,  7,111, 78,141,203,237, 27,200, 51,163, 87, 62,124,250, 16, 23,211,187,113,252,
+223, 11,214,175,159,248,237, 69, 90,248,205,239,215,172,178,173,247, 20, 14,135, 74, 62,220, 82,150, 51,251, 77,100,255,248, 49,
+235, 95,130,183,133, 98,149,245,146,254,150, 60,250, 31,125,237,111,191, 70,126,251,255,187,116,252,253, 29,173,204,212,211,153,
+205,118, 96,251,193,211, 85, 57,186,174,  4,215,209,120,183, 71,224, 59, 50,237,187,223,175, 24,209,149, 93,198,170, 76, 33,  3,
+241,168, 28,190,121,206,237,203, 23,104, 83, 83, 80,107, 32,151, 76,108, 48, 52, 79, 10, 74,166,178, 28, 51,195, 54,174,153,163,
+192,185, 20, 98,154,240,123,207,252,221, 27,100, 26,205,236, 86, 79,164, 33,112,186,204, 12, 98,  7,253,243, 44, 36, 54,184,208,
+201,203,  5,138,210,162,101,209, 70, 46,  4, 45, 86, 11,235, 88,210,208,189,109, 15,119, 11,201,161,214, 11,118,218, 45, 69, 42,
+209,118,202,125, 33,134, 64,236,145, 69, 43,174,139, 33, 40, 49, 69,166, 56,179, 10, 21,116,149, 44,168,  5,179,122,165, 75,195,
+221,124,159,199, 79,119,132,239,126,193,237,221, 66, 94, 41,111,165,152,235, 56,186,  0, 94,168,173,173, 99,207, 21, 20,175,150,
+126,173,125,237,123,235,219,106,157,141,139, 90, 16, 11,167, 57,123, 49, 86, 21, 59,153,121,  7,161, 49,226,232,117,237, 75,123,
+  7,165,161, 53, 91,149, 47, 56,186, 58,162,218,184, 92,131,167,151,182,214,251,148,228,253,187, 84,119, 15,106, 86,171, 98,253,
+116, 13,109, 29, 83,129, 84, 69, 93,165,213,182,170, 56,101,229,225, 67,206, 71,222,220,207,246,102,229,140,177, 63,183,133,152,
+  2,159,126,176,231,245,171, 11,151, 96,  1,187,229, 60,147,243,158,211,253,  9,117,194, 52,118,164, 36,187,121,135,194,208,133,
+ 75,133, 55, 47, 46,124,247,252, 21,121, 57,112,251,230,200,177,101, 42,145,205,213, 53,195,240, 17,227,110, 71,108, 74,247, 27,
+ 30, 63, 29,105, 57,227,227,  3,166,209,116,156,155,224,216,143,194,233,112,161, 15,141,122, 94,168, 75,177, 20,243, 24,217,166,
+ 72, 88, 10,231,166,228, 10,249,246, 43,190,187,124,199,163, 15, 62,225,112,255, 13,231,195,188,134,251, 96, 57, 85,156,218,109,
+156,222, 41,253,204,175,190,250,156,201, 79, 54,213,241,158,253,144,120,248,228, 41,109,223,121,121,247, 10, 39, 19,226, 22, 66,
+ 55,117,103,237,157,174,133,174,158,205, 52,224,125,229, 50, 55, 98,178,174,190,102, 91,179,168,179, 10,182,213,233,154,101, 36,
+ 66,228,243,111, 94,241,226,187, 87,116, 34,248,129, 81,140,127, 94, 90, 69,155,241,213,181,174, 15,243, 96,167,250,156, 27,162,
+142, 48,  4,162,216,122,201,  5,251,249,107,189, 65,238,156,156,237, 88,125, 60,179,217,111,152,198, 68,239, 35, 75, 83, 74,201,
+ 72,171,  6,254, 33,209, 91,179,126,246,125,198, 71,207,176, 25,232,203,  2, 26,121,254,245, 29,255,215,225,223,178,189,222,243,
+193,  7,223,227,143,126,231,191,230,244,236,196,207,254,230,255,225,112,120,205,206,121, 74, 86,230, 57,147,187, 64,181,250,211,
+118,191,195, 77,137,211,156,233,231, 91,  6,119,100,156,182, 16,182,156, 46,142,195,171,215,  4,255,138,221, 46,240,193,135, 79,
+217,222, 60,164,103, 97, 28,149, 62, 56,164, 15,208, 22, 92, 18,195,185,119,135,250, 72, 88, 42, 61, 42,185, 11,254, 50,163, 26,
+169, 90, 89, 56, 81, 69,136,110, 66,134, 11,101,169, 20, 85, 38, 29,232, 61,147,151, 78,150,142, 95,  9,148, 41, 77,228,222, 13,
+225,234, 38, 46,189,224, 91, 35, 12,137, 65, 44,180,118, 90, 26,179,  8,227, 54, 34,205,147,162, 39,215, 19,174,116,116,101, 94,
+184, 96,171, 36, 51,166, 41, 62, 90, 37,182,204,153,180,210, 14,139,216,109,155,  0, 99, 20,106,134,190,  8,248,245, 34,160,158,
+ 86, 79, 12,147, 55,158,194,178, 18,219,100, 67, 26, 35,181,103,114, 29,232,154,105,106,246,199,152, 26, 73,141,107, 81,215,134,
+135,170,133,159,162,236,233,156, 44, 12,150,  2, 82, 22, 14,171,195,126,  8,129,232, 38,232, 23,102,215, 17, 57, 65,223,224, 89,
+208,222, 40,217,222,159, 92,140, 52,159,112,181,208,150,133,144,  2,115,176, 73, 81,157,149,179, 10, 34, 35,174,100,154,220,163,
+161,147, 59,116, 77,204,189,145,156, 99,127, 61,177,100, 24,106,199, 93, 69, 74, 43,112, 92,136, 42, 20,233, 22, 70, 12,158,193,
+139,129,131, 48, 72,150, 80,109, 20,222, 60,155,109, 98,187, 27,121,247,148,252,207,253,144,191,255,235,221,228,169,167,128, 22,
+199,205, 62,146, 82,250,255,255,119,127,251,247,242,255,253, 60,191,253,145,128,182,241,212,131, 35, 57,199,213,126, 98, 76,239,
+ 39,128, 39,123,199,155, 75,164, 44, 23, 54, 81,120,250,225,213, 74,102,252, 79,125,209,255, 25,201,184,223,250,136, 15,132,243,
+113,  3,183, 54,106,111,173, 17, 92,183,231,150,131,202, 66, 85,211, 15, 15,227,192,133, 70,200,  6, 40,211,236,136,189,225,212,
+ 49,107,160,151,198,226, 35,221,121, 42, 51, 83,186, 70, 91,229,124, 62, 16,101,160,141,145,214, 97,138, 19,205, 29,105, 64,208,
+  6, 82,  9, 72, 64,187, 85,195, 80, 27,135, 27,176, 69,215,  7,207,111, 78,226,226,223,178,160,237,225, 85,115, 55,110,122,244,
+171,113, 76,215, 96,142,  1, 25,196, 54,  7,246,205, 18, 27,109,202,218,135,141,215, 19,255,244, 71,  3, 90, 59,255,231,193,147,
+ 75, 93,247, 32,150,149, 94, 88, 59,180, 88, 45,160,169,165, 61, 11,134,124, 29, 86,132,172,190,181,159,173, 99, 62,215, 61, 52,
+103,193, 21, 17, 11, 19,168,195,171,101,  6, 84,108,183,228,215,248,150,137, 74, 32,144, 80,148, 20,131,237,128,106, 69,151, 70,
+105, 74, 28,162,165,191,155,237,123,213,250, 48,208,131,  1, 92,168,182, 55,246, 66, 41,213, 58,253,235,138,129,184,106,106, 85,
+209,156,185,125,115,207,220,197,198,171,206, 88,216, 46,116,234,114,226,197,107,  3,215, 12, 14, 52, 54, 30, 93, 13, 60,255,245,
+151,252,242,249, 29,223,251,222, 99,174,252,136,216,  2,159,136, 16, 55, 66, 34,161,151,204,151,223,126,203,183,183,158, 97,247,
+ 33,207,158, 13,140,155,200,102,119,195,211,135, 31, 19,250, 75,106,105,108,246,143,120,188, 83,238, 15, 13, 63, 36,235, 55,135,
+  5,233, 59, 62,120,240,132,211,237,183,168, 84,206,167,204, 82,132,135, 15, 34, 75, 13, 56, 45,156,142,  7, 38,119,197,249,118,
+230, 94,224,245,221, 29,165,125,201,245,163, 15, 89,202,133,122,119, 33, 86,232,206,192, 30,178,238,139,123,173,204,173, 83,  5,
+194, 48, 88,199,190,156, 40, 29, 62,124,250,148,165, 47,220,189,186, 35,141, 19,251, 39, 55, 60,222,236,153,219,153, 90, 27,115,
+174, 72, 47,212,114,176,158,109,207,168,139,164, 56, 26,108,200, 25,105, 76,213, 14,109, 90,161, 75, 99, 28,  6, 11,250,105, 39,
+104,125, 71, 71,140,206, 83,196, 24,  5, 78, 45,124, 89,155,173,123,140, 34,215, 40, 75,179,209, 94, 11,132,232,136,201,227,137,
+ 72,231, 55,233,101, 41,248,124,193,249,138, 15, 27,118,155,145,214, 70,242, 92, 56,231,217,252,  1,  3,148,236,173, 94, 89, 50,
+ 50,175, 23,165,201,168,103,151, 86,241,167, 19,103,253,134, 20,132,103,159,126,159, 44, 63,226, 23,191,240, 92,110,111,137,210,
+ 96,240,208,205,  4,214,186, 73, 87, 66,239,108,167,200,253,171, 19,103, 50,234,149,121, 62, 19,211,196, 52, 68,106, 75,188,124,
+213,248,244, 89,224,191,255,111,254, 11,190,254,106,225,215, 95,124,129,159,103, 52, 25,238,151,170, 52, 41,198, 93, 56, 55,170,
+ 87, 82, 82, 74, 45,104,177,145, 37,173,216, 36,172,119, 46,125,161,183,130, 72, 68,244, 66, 62,159,216,142, 35, 36,103,156,246,
+220, 56,246,142,215,133, 97, 19,  8,221,147,123,181, 86,197,246,194,166, 64,149, 13,121,117, 66,187, 41,146, 43, 76,216, 42, 45,
+166, 61,226,222, 18,221, 28,177, 13, 84,159,201,117, 97,231, 70,122,168,148, 37,154,  2, 21,165, 85,199,226, 10,155, 20,169,117,
+ 32, 55,  8,226,240,162,148, 48, 83, 79,141,  9, 79,145, 64,189, 52,  6, 47, 44,234,  9,169, 83,101, 49,110, 69, 72, 68,160,208,
+  9,170, 12,147, 50,215,192, 16,  3,253,156,113,226,136, 18,136,201,209,202,217,234,177,226,233, 58,195,185, 33,233,134,105, 43,
+116,127,162, 31, 27,199, 80,112,234,112,107, 77,142,222,236,230, 30, 60,185,116,118,219,  0,186, 48,207,103, 66, 26, 72,126, 64,
+ 93,101,179,153,168,179, 77,166,252,232,105,167, 25,241,106, 68, 74,231,113,169,211, 90,199,247,200, 56, 25,235,130,148,104,  9,
+  6, 17,171, 95,118, 88,162,216,168, 91,212, 46, 55,213, 19,213,232,147,186,218, 13, 85, 29,209, 57, 82,112,239,165,155,109, 83,
+ 73,193, 59, 37,165,247,135, 90, 53, 16,154,154,215, 35,186,247,155,100, 91, 41,169, 99,114,198, 22,121,143, 31,162,230, 53,  9,
+ 81, 40, 81,232,217, 88,  5,181, 43,205, 85,220,228,209,  2, 41,120,206,135, 76, 27, 59, 18,149,249, 62,211,165,112,159, 43,211,
+ 60,225,135,107,122, 60,145,231, 66,174,129,160, 39, 98, 63, 83,167,100, 83,171, 83,133, 90,169,139, 18, 73,136, 92, 33,189, 51,
+235, 75, 90,247,  4,203,217,187,117,119, 32,171,188,161,129,120,235,  8,162,148,254, 54, 92,102, 22,175,176,142, 41,187, 58,202,
+ 90,229,120,235, 43,119, 33,144,187, 85,219,188, 24, 53, 76,176, 91,182,215,182,186,213, 11,237,203,159,243,151, 47, 26,199,165,
+113,210,  0,120, 27, 43,138,165,157,107, 95,189,211, 40,149,138,119,201,240,170,221,161, 65,233,222, 35, 90,240, 43,143,158, 20,
+ 44,108,215, 21, 13, 22,194, 19, 44,136,215,189,141,229,181, 89,200, 69,180,209,107, 51, 84,105, 10,120,160, 96, 98,  4,233, 54,
+185,144,224,145,170, 80, 11,172,  8, 72,130,  5, 41,130,136,213, 76,188,  5,201,188, 26,109, 77, 13,132, 71, 93,  7, 62, 70,224,
+ 50,111,124, 76,142,211,249,204,113, 54, 97,188, 23, 49, 64,133, 11,140,211, 64,156,103,158,191,236, 70,105, 15, 70, 58,223,248,
+192,203,243,137,221,163, 27,158, 93,143,228,243,145, 30,  6,134,209, 64, 42,139, 40,151, 55,247,124,243,229, 87,124,125, 91,217,
+ 61,250,148, 31,127,250, 41, 59,119,100,190,  8, 15, 30, 61,226,251,223,127,140,151, 45,195,112,205, 16, 13,143,248,193,179,107,
+250,233,200, 57,159, 16, 29,169,217, 19,244,150,229,248,156,187,251, 35,210, 34, 46,116,190,188, 63,115,127,123,226,249,171, 23,
+156, 87,118,254,155,187, 35,211,246, 17,127,240,123,191,207,139,151,207,153,166, 27, 30, 95, 63,102,185,124,201,114,233,212, 90,
+ 80,177,108, 66, 91,150,181,139,217,168, 50,211, 46,179,237,140,123,227,117,110, 44,203,133, 42,157, 82, 23,246,219, 27,126,248,
+193,150,124,127, 75, 43,149,152, 28,187, 97,194,249, 29,139, 62, 96,218, 87, 88, 50,199,124,166,148, 19,221, 53,162, 19,196, 37,
+ 98, 12,212, 94,109,189,211,100, 21, 17, 57,194, 26,232,113, 43, 74,246,173,151,160,213,167,232,226,155,  0,  0, 32,  0, 73, 68,
+ 65, 84,186,202, 69,148,249,178,188,203,  0,172, 99, 41,106,179,176,214, 82, 33,214, 72,244,201,110, 99,193, 91,165,175, 84,222,
+220,118,206,177,178,153, 58, 83,111, 12,195,192,180,  1,252,192,124,185,160,221, 52,188, 78, 70, 68, 60,151,  6,163,118,164,118,
+130, 55,129, 78,111,141,115,168,188,249,234,115, 94,221,191,226,225,230, 33, 63,254,236,199,188,120,245,146,207,191,254, 37,190,
+ 84,198, 26,169,106,120,225, 90, 50,103,239,169,151,204,225,124, 97,179, 73,235, 77, 22,180,102,142,186,224,157,  7, 31,120,117,
+127, 96,106,183,252,238, 15,174,249,238, 54,112,188,205, 68, 63,  0,  3, 77, 51, 45,116,244,220,172,254,184,233,180, 73, 72,135,
+ 78,119,142, 28, 60,174,  8,205, 25,249,177,157, 23,186,183, 62,190, 11, 74, 41,157, 67,111,140,209, 51,121,161,143, 27,106,175,
+136,139, 84, 32,104, 33,106, 36,138,174,248, 82, 33, 36,199, 92,108, 36,153,170, 51, 74, 93,244,208, 21,113,205,118,241,151,138,
+138,226,195,192,198,121,212, 69,230,243, 61,210, 61,161,193, 38, 57,114, 17, 78,253,100,254,136,104, 65, 52, 41, 51, 45, 37,164,
+129, 63,216,161,165, 95, 41,204,138,171,198,205,143, 10, 26, 19, 15,175, 71,218,253,204,105, 57,147,134, 29,163,120,100,155,141,
+ 27,209, 51,209, 39,102, 10, 62,218,250,  7,223,105, 37, 32,173,227,227,  6,212, 24,241, 14,161,212, 74, 44,145,209, 11,111,234,
+194, 62,238, 25, 60, 28,231,194,176,162,109,235, 82,  8, 42,232, 37,210,163,225,179,196, 16,133,148,150,153, 15,  5,141, 66, 98,
+ 64,116, 70,130,163,185, 61,131,203,  6, 16,202,129, 81, 38,218, 94, 57,149,194,213,146,136,163,103, 41,153, 97, 81, 24, 28,121,
+ 85, 41,143,209,209, 75,195,135,213,133,209, 43,226,  6,188, 58,155, 21,123,243,115,140,195,240, 94,170, 92,189,241, 14,171, 44,
+ 62,188,183,228,123, 51,119,239, 90, 29,126,143,135,133,102, 18, 43,237,106,214,192,247, 88,103,123,251,253,168, 75, 65,178,146,
+112, 84,103, 14, 16, 15,171, 62, 90,104,115,129,161, 66,171,200, 57,145,211,  9,137,157,155,184,161, 92, 22, 14, 75, 37,244,194,
+168, 19, 34,  5, 23,142,244,101,196,121,101,108,133, 69,205, 89,192,180,193, 87, 37,169, 50,183, 78,145, 74,240,  3, 53,207,  4,
+241,178,238,190,223,142,216,205,184,212,213,172, 78,234, 87, 47,185, 84,196, 41,210, 76,161,105,138, 84,115, 68,235,197,234, 28,
+160,212,213,126,230,145,119, 61,105,149,117,183, 44, 14,149,130, 83,168, 53,243, 77, 49, 30,185,139,235, 55,184,155,121, 77,187,
+141,208, 21, 11,226,104,111,150,104, 45, 25,113, 29, 47, 30,105,171,118, 82, 65,122, 67, 84,222,189,233,246,158,141,  9,191,250,
+224,163, 54, 58, 98,114,249,226, 25,130,208,214, 23,152,115,  3,195,184, 80,230,138,184,145,224, 44, 11,144,165, 91,197, 39,  8,
+165, 55,122,245,118,243,  6,  8,193,146,209, 88,  8,144,106, 19,138, 46,224,194,154,150,247, 14, 23, 11,173, 53, 68, 61,121,201,
+ 28,239,103, 74,119,248,224,172,175, 47, 74, 91, 42, 51,157, 55,218, 41,110,226,131,199,143,217, 12,129, 93, 28,209,229,196,165,
+ 41,159,125,111,135, 32, 28,150,204,178,187, 37,104,162,168,114,119, 58,145, 79,183,224, 29,209, 37,150,195, 29,122, 62,162,215,
+143,184,122, 52,242,120,215,120,254,139,191,224,246,120,207,245,195,135, 28, 94,191,230,238,116, 15, 56,142, 47,110,121, 57,223,
+ 35, 45, 48,151,194, 93,158, 57, 31, 47,168,223, 16,156,112, 56,188, 65,221,  6,239,  2,231,243, 29,196,200,245,205, 13,231,195,
+ 29,151, 95,191, 36,250,196,227, 15, 54, 44,151, 87, 12,155,107,182,227, 53,111,222,220, 83,242,133,174, 74, 19, 27,251,133,232,
+233,162,  4, 31,161, 27,198,214,133,136,138,112,123,184, 71, 93,224,131,199,143,121,180,247,188,185,123,131, 75,201,152,  7,  8,
+ 72,161,207,103,188,247,236,182,137,253,205,142,204,  3,154,192,221,241,142,118,188,112, 57,158, 41,205,126,166,222, 98,132,173,
+139, 42, 76,226,169,210, 87,231,128,163,161, 56,231,136,235,232,170, 43,140,163,167,230,133, 57,159,215,  0, 79,179,234,102,240,
+104,239,212, 90,169,181, 83,170, 35,166,193,132, 57,186,  6,126,106,231,112, 42,228, 82, 25,242,145, 41,109,205,117, 62, 13,180,
+232, 40,231, 66,233,179,245,194,155,144, 83, 34, 47,103,130,235,140,219, 45,146,  6,242,165,211,107,231,245,252,146,101,184,231,
+230,234,  3,126,248,241, 51, 30, 60,249,144, 95,253,242, 23,124,247,213,175,108,202,211,141,243, 95,207, 51, 89,154,253,247, 77,
+ 56,206, 11,187,158,240,222,116,181, 45,116,130, 43,252,228,167,191,224,127,249,250, 75,254,240,199,191, 67,238,137,187,251,215,
+ 60,251, 56,152,248, 71, 10,161, 56,212,123,242, 88,233,151, 66, 95, 44, 65, 47, 93,160, 21, 74,174,184, 20,232, 14, 42, 21,201,
+102,246,243,120,210, 52,160,116,230,101, 38,165, 13, 49, 89,184,116, 35,194,210, 27, 65, 70, 36,102,196,205,248,106, 19, 53, 23,
+ 22, 66, 11,118,  0,174,157, 28, 70, 74, 47,140, 30,130,118,232,  1, 31,  6,186, 84, 46,254, 68,104, 66, 47,  2,206,209,186,163,
+251,128,111,133, 54,  8,177, 22,130, 38,250,156,193,157,145,228,105, 44, 56, 38,226,160,108,100,162,230,198,152, 18,110,232,168,
+ 23,162, 14, 76, 97,143, 43,138,198,196, 85,216,176,180,108,142,246,162, 56,215,145, 48,146, 23,101, 63,108, 40, 78, 17,201,148,
+158, 16, 55, 16,  6, 11,226, 85, 87,105, 10,213, 45,118,248,172,149, 57, 42, 33,141,212, 94,201, 89, 33,101, 46, 25, 66, 52,152,
+ 72,108,214, 50,137, 33, 18,156,226,139, 24,135, 30,184,132,202,134, 64,239, 23,116, 22,148,  1,124,230,152,103,118,211,142, 24,
+ 70,106, 61,209,151,142,186,100,134,200,121,161,208, 40,  2, 62,155,130,185, 59, 97,174,142, 49,232, 58, 93,180,158,130,247,213,
+204,128,226,241,193, 40,140,105, 24,222,211,197,215,182,216,206, 89,192,236,189,222,122, 81, 98,116, 86,117,126,143, 23,117, 86,
+157,247, 48, 37,112,239,247,166, 94,129,210, 96, 94,102, 84,243, 58,106, 95,109,127,205, 84,220, 41,136, 29,244,214,192,120, 61,
+119,152,177,149, 80, 98, 61, 44, 94,208,243,  9, 21,143,134,209, 50, 38,245, 76,190, 52,115,157,197,145, 50, 95, 24, 17,154, 36,
+186,102,118,178, 48, 47,  9, 74, 33,188,213,152,178,142,187,173,186, 96,105, 93,213,183, 28,116,163,206,185,181, 54,211, 86, 40,
+162,170,141,185,139, 42, 90, 76,255,232,165, 89,149, 77,220, 10,165, 49, 53,171,180,138,226,236,240,224,132,222,140,252,228,188,
+ 37,220, 75,175,224,141,195,237,180,210, 74, 53, 88,107,179,100,169, 91,205, 70,218, 61, 82, 58,221, 23, 92,243,246, 64,139,158,
+226, 77, 46,163,173,155, 62,178,234, 59, 77,108, 83, 35, 99,  5,111,201,205, 75,183,155,178,174, 83,129,232,120, 39,148, 81,111,
+ 78,227, 94,236,156,225, 92, 48,213,108, 92,245,120,226, 77, 76, 82,127, 35, 38,113, 35,180, 57,211,155, 37,233,113,221,220,232,
+107,107,195,139,178, 28,143,220, 93,108,228,233, 48,162, 85,171,  5,194,200,144, 70,110, 79, 71, 26,194,205,190,113,245,120,207,
+142,206,231,207, 95, 18,226,200, 78,193,111, 34, 79,159, 92,113,238,157,210,133,122, 56,177,220,189,100, 84, 71, 72,202,183, 34,
+196,155, 71,132,135, 91,158, 62,126,204,131,169,242,191,253,217,255,202, 95,254,236,107, 74,213, 53, 84,209,233,221,163, 52, 46,
+189,174,181, 21, 37,249, 13,105,152, 56,157, 43,251,107,  8,131,231,114, 11, 41,194,213,102, 99, 63,100,226,216,196, 13,196,133,
+211,124,199, 79,255,238,231,196,233,199, 92,239, 28,175,110, 95, 16,167, 71,108, 54,157,194, 29,165,102, 91,181,104,135,158,241,
+ 45,216,142, 58,138,137,113,176,202,200,120,253,128, 79,158,125,196, 70, 27,132,198,227,239,125, 76,242, 11, 63,251,217,175, 24,
+227, 53,143, 30, 61,100,188,113, 92,164,115, 56, 95,200,243,137, 33, 14, 12, 99,100,218, 79,180,237, 53,249,177,237,195, 47,203,
+204,114,190,163,148,217, 40,128,210,169,242, 22, 44,220,223, 25,222, 88,229, 58, 34,235, 97,221,129,119,137, 97,176,122,212,144,
+  6,190,123,249,138, 90, 77,218,225,131, 85,181,186, 90, 29, 51, 14,137,249,124, 90, 51, 30,222,180,172,199,202, 44,194,121, 48,
+242,221, 48,141,120, 34,131, 27,209,222, 76, 13,235,236,166, 45, 18,169,205, 50,  2,129,198,224, 42, 62,153,106,248, 84, 59,167,
+215,223,226,106,230, 15,254,232, 79,248, 71,223,255,  1,255,247,191,249,115, 62,255,249,207,168, 45,227,106,165,214, 74,143, 66,
+164, 24,205,208, 77,156,114,  1,223, 73,222,113, 51,108, 24, 55, 35,151,176,240,226,245,129, 63,251,215, 63, 99, 63,221,144,235,
+ 17, 74,224,201,147, 39, 48, 42, 41, 59,188,199,176,175,210,169,235,129, 62,215, 74,114,142,150, 28, 93, 61,229,188,216,222,177,
+ 38,136,  1,164, 34, 61,210,106, 70,163,160,174,145,  5,212,123, 46, 21, 82, 15,248,208,209,182,161,185, 70,  8,112,153, 51,181,
+  8,211,102, 96,190, 40, 83,135,222,239,113, 29,168,137,162,157, 56, 40,213, 43,173, 47,232, 18,169,106,171,155, 56,174,204,245,
+229,200, 18, 61,234,130, 85, 44,213,188,241,145, 64, 45, 74,139,142,164, 35, 77, 10,110, 18,246,189,209,139,189,  9,198, 93, 36,
+ 58, 71, 28,109,250, 66, 83,226, 40,248,139, 35, 37,135,243, 59,196,123,242, 50, 35,  1,  6,201,108,156, 90,186,248, 24,232,233,
+158, 92,133,121,153,237,176,129,135,146,173, 19, 78, 67, 92, 66, 90, 97,230, 66,242,215,104,241, 56,181,214, 76,113,138, 50, 83,
+197, 17,103,203,138,180,113, 32,106,132,102,194,153, 26, 29,122, 46,  4,151,136,161, 24, 88,139,137,114,236,212,233,130, 96,168,
+223, 62, 12, 28, 90, 37,180, 74,242,137, 69,132,201, 71,162, 55, 10, 89,241,214,174,209, 85,112,229,189, 85,141, 21,129, 33,162,
+ 18, 72,152,207,225,253,  0, 98,116, 21, 57, 57,156,123,127,224,153,183,163,236,232,176, 16,219,123, 59, 40,240,206,103,146,134,
+248, 94,153,239,239,190,248,214,  9, 42,148,238, 87,145,217,140,246,142, 31,132,114, 86,250,232,208, 18,161, 44,184,220,  9, 17,
+162,223,112,204, 51,135, 89,217,108,141,255, 94,212, 66,143,209, 69,226, 20, 56, 29, 11, 62,120,124,132, 38,  3,147,107,228, 83,
+ 33,231, 35, 56,161,106,100, 18,161, 57,143,127,242,241,179, 63,117,171,251,218,250,111,224,157,185,183,197, 12, 47,120,233,102,
+ 87, 91,173, 94,172,183,112, 89,185,222, 56, 33, 40,248, 24,214, 94,222, 91, 15,246,202,123, 71, 44, 84,214, 21,159, 44, 93,252,
+ 86, 32,227,188,208, 44, 48,189,126,143, 61, 33, 40,173,151,213,190,253,182, 59, 14, 62,  8,189,216,237,207,211,105, 88,253, 66,
+215,213,  0,206,173,100,183, 64,  8, 98,174,234,102, 55,123,  3, 13,216,169,169,117, 93, 37,124, 22, 82,160,175,180, 31,105,136,
+247,182,131,213,190,138, 29, 58,222,  5, 28,209,186,243, 98,172,251, 49,122,188, 56,242,178,224,180,217, 63, 95,215, 11,244,183,
+249, 66, 49,133,109, 47,220,223,222,113,119, 89, 57,250, 30, 68,237, 13, 58,142,215,236,166,145,203,249, 72,169,230, 35,254,228,
+217, 67,250,253,137,159,124,241,138,171,199, 87, 92,109, 34,189,192, 54, 12, 32,149, 87,223,125,195,229,238,192,126,218,177, 77,
+194, 97, 41,188, 60, 71,158,126,250, 49,159,110, 39,166, 48,161,209,241,191,255,235,191,228,245,105, 38,134, 64, 85,235,216, 26,
+251, 89, 12,250, 19,  6,162, 19,124,  8, 76,211, 64,203, 11,187,253,150, 71,187,129,195,221, 17,112,124,248,240,198,120,234,151,
+153,235,155,107,112,112, 58,157,208,222, 56,156, 23,110, 30,127,194, 54, 69,122,155,121,252,232,  9,215, 87, 27,198,205,192,163,
+253, 67,110, 30, 62, 34,110,182,236, 54, 55, 92, 93,223,176,219, 95, 49,110, 30, 18,199, 29,126,152,248,193, 39,223,227,233,206,
+ 76,120,207, 30,124, 72,155,239,120,241,242,142, 95,126,241,156, 95, 63,255,154,239, 94,189, 68,157,227,225,245, 13,131,120,118,
+211,158, 39, 79, 63, 98, 59,110, 57,207, 71,180,204,196,160,236,167,128, 23,101, 26,182, 12,227,142, 56, 77,208,161,174,252,239,
+ 94, 43,104,121,151,152,125,219,117,181,116,125, 96,136,145, 31,254,232, 51,254,229,191,248,103,252, 79,255,252,143,249,248,227,
+ 15,121,115,123,226,116, 60, 89,231, 22,101,179,221,240,227,223,255,  3,126,239, 15,255,128,113, 51, 50,207, 51,151,249, 12,210,
+236,103, 16, 59,149,231,150,201,115,166,213,106,110,117, 17,115, 26,136, 95,101, 71,246, 38,219,178, 99,206,243,106,214,170,164,
+ 56, 81, 74, 38,231,133, 23,199, 59,190,187,253,154,157, 86,246,219,107, 14,249,100,149, 29,181, 26,140, 91, 25,237,193, 55, 74,
+158,209,106, 60,137, 90, 26,231,185,224,189,242,112,220,226,188,103,110,133, 92,102,230, 92,184, 63,192,231, 95,127,195,213,228,
+185,249,248,134,185,128, 86,193,119,200,218, 45, 15,147, 45,223, 50,248, 72, 81, 71,197, 56,253,162,144,100,117,233,168, 67, 92,
+ 96,240, 19,105, 52,151,121,208, 64,239,102,242, 11,110,141, 51,119, 93, 27, 20, 14,154, 35, 87,165, 86,168,174,146, 20,186, 75,
+150,185,168,149, 99,206, 70,255, 83,165,118,243,204, 39, 17, 74,  1,215,237, 53,138,239, 70,207,195,145, 16,203,253,116, 75,239,
+199,125, 98, 96,189, 88,116, 11, 38,117,103,230, 57,245, 48,122, 79,170,194, 38,140,136, 75, 20,109,132,232,113,211,132, 46, 39,
+114,109,196,253, 42,101,162, 34,117, 64,135,132,202, 25, 89, 32,186,145,220, 47,180, 16, 33, 12,132,186, 48,197,128, 99,196,251,
+ 64,151,206,200,128, 72,103, 16,143, 58,161, 86, 97,112, 74,119,153, 90,149,208, 35, 49,  6,182,187, 29,185,219,247,149, 17,211,
+204,118,136,155, 43, 70, 58,243,226,137,226, 89,202,  5,137, 17,145,129,154, 77,208,178, 73, 91,134,193,114, 67,147,172,114,152,
+176, 62, 76,240,164, 24, 24,163, 77,100,212,153,103, 99,240,102,149,244, 26,216, 77,145, 71,143, 31,224,227, 63,252,182,126,158,
+ 43,117, 94, 72, 14, 54,187,233, 55, 81,241,127,224,248,253,116, 46,244,178, 48, 37,207,176,221,188,183, 49,249,210, 96,185,204,
+104,158,185,218, 14,248, 97,124,175,207,244,115,133,219, 23,  7,230,229,141, 81, 60,155, 53, 21,122, 91,155, 99, 13,179,249,133,
+192,165, 46,164,193, 83,103,229, 52, 55, 32,227,167, 70,108, 16,122, 52, 17,145,203, 38, 44,148, 14, 58,163, 75,161, 78,149,224,
+ 28,243, 92,160,246,149,127,224,137, 20, 90, 53, 39,138,255,232,227,239,253,169, 19, 33, 68, 35,134,137,247,246, 48, 23, 49,146,
+ 28,111,187,139,157,250, 54,226,255, 54,103,225, 45, 33, 47, 62, 34,230,252,195, 99,105, 78,123,160,  7,227, 39, 55, 59, 39, 73,
+244,248,232,113, 69,145,110, 41,123,113, 54, 62,215,245,125,192,105, 67,155, 29, 44,188, 66,  8,238,221, 55, 70,130, 95, 63,191,
+ 26,197, 77,214, 96, 92, 95,109,114,189, 33,193,126,152, 91,229,221,196, 32,  4, 79, 43,150, 75,118,221,173,192, 15, 97,240, 14,
+183, 26,208,122,201,228, 98,183,187,183,162,149, 94,117, 53,174, 65, 12,186, 62,168,157, 41, 65, 69,223,245, 33,197,197, 53, 83,
+ 16,214, 14, 99,181,238,122, 95, 43, 94,218,121,245,234,206, 88,209, 94,222,189, 41, 55, 85, 66,218, 16,122, 33,231, 51, 89,132,
+253,213,158,189,131, 47,190,248,150, 50,108,249,209,247, 38, 66,169, 44, 40,109,233,124,253,213, 11,238,142, 71,190,119, 53,176,
+241,157,101,201, 44, 37,162, 97, 75, 34,226,114, 97,251,228, 35, 62,251,209,239,241,239,254,205,159,241,250,222, 30,234,174,129,
+138, 95,239,171,198, 62,214,102,223, 51, 21,216,132,145, 86,102, 52, 37,246,187, 43,142,119,119,228,210,120,112,115, 67,213,204,
+225,124,102,119,181,103,191, 29,184,191,187, 71,197,225,189,178, 31,  2,255,248,143,254,136, 79,158,125,196,167, 79,158,146, 88,
+232,100,174,134,206, 38,  4,162,111,108, 39,207,199, 31, 60,226,163, 39,215, 60,122,248,144,109, 82,166,160, 36,169,140,227,142,
+103, 31,126,194, 55,127,247,239,249,235, 47,190,227,193,245, 13,109,158,185,189, 63,115,206, 11,113,154,168,245,200,175,191,254,
+156, 87, 47,223, 48,121, 72,155, 72, 26, 38,134,105,139,171,141,243,114, 33,247, 70,155,103,104, 23,134,  8,251,235, 29,131,223,
+227,125,100,216, 76,136,139,134,128, 21, 19,183, 12, 99, 34,250,200,143,126,244,125,254,231,255,241,159,241, 47,255,197, 63,225,
+193, 54,226, 92,228, 95,252, 15,127,204, 63,250,236, 99, 94,188, 58, 83,187,  9,137,126,248,131, 31,241,217, 39,207,216,110, 18,
+ 79, 30, 63,225,163,167, 31,115,117,125, 67,201,149,121,190,224,162, 65,113,180,218,100,168,181,198,178, 62,180, 27, 66,  8,202,
+176, 73,136, 11, 43,224,195, 60,  4, 85, 28,165,  9, 57,159, 24,104,204,165,113,201,149,185, 40, 47,222,188,226,245,171,151,164,
+184,101,179,189,  6, 26, 90, 12,146, 68, 16,194, 38, 16,146,113, 25,234, 26, 84,173,125,230,246,205, 29,247,199, 19,251,235,107,
+ 84, 49,249,138,235,208, 60,185,  9,127,242,199,191,203,127,251, 95,253,151,228, 46,220,190, 57,226,196,194,103,180,128,134, 96,
+ 39,210,210,200, 93,233, 53, 51, 14,137, 16, 35, 49, 56, 52,154, 30,117,152,  2, 68,235, 23,251, 30,112,181,216,129,122, 55,146,
+131,131, 36,184,218, 89, 74,167, 75, 95, 15,245,142,  8,160,149,230, 59,158, 64, 16,101,110,118,219,219,184,117,215,174,224,131,
+103,116,137,203, 10, 79,114,210,169, 94,240,185,211, 93, 32, 12,209,104,133,222, 19, 83, 66,124,194, 19,140, 56, 57, 25, 98,153,
+ 49,145,  8,108,118,193, 72, 24,126,  3,105, 64, 60,248, 10,227,102,135,155,214, 53,145, 79,140,221,118,224, 99,156,240,211, 14,
+189, 20,234, 50,211,194,202,193, 80,144, 22,137, 40, 50,218,196, 14,  9, 20,169,150, 87, 40,138,248,106,127,223,238,  9,130, 85,
+132,179, 34,140,196,  4,195,198,179,168,160,181, 18, 39, 35, 38,250,197,122,233,157, 66,116,123, 90,235,212,182, 48,238, 62,192,
+251,110,104,234,141,237,248,107, 19,180,129,  4,207,184,119,112,106,180, 14, 81,212, 66,214,206,240,215,173, 91, 56,219, 49,224,
+197, 17, 92,196, 57,199, 56, 12, 60,250,240,131,127,176,114,181,  1,243,165,160,165, 48, 38,247,222, 30,190, 69, 97,185, 84, 90,
+201,246,121, 55,211,123,123,168,159,115,167, 92,102,168,133,253, 46,189, 55,157,235,219,143,195,185,115,247,230, 53,231,227, 43,
+168,139, 77,148, 74, 96, 41,139, 33,105,171,216,212,170, 22,200, 80,187,103,135,231,212,206,248, 36,176,100, 74, 20,230, 34,224,
+172,173,144,146, 80,138,210,101,195, 57, 95,232, 24,246, 59,246,107,124,220,227,168,120,175, 54,170,199, 51,231, 66, 16,237,230,
+199,110,171, 87,156,102,193, 51,179, 46,194,122,115,173,205,238,224,170, 54,130,103,213, 59,118,111,212,175,214,205,195,222,197,
+ 60,229,125, 77, 98,170,247, 54,102,235,208, 91,165,213,213,163, 29, 86,226, 92, 53, 62,153,141,229, 89, 49,166, 30, 51,188, 91,
+173, 77,107, 53,142, 85,183, 49,185,119, 88,106, 89,196,212,142, 30,164, 23,148,128,211,176, 18,241,148, 24, 88, 67,108,205,244,
+165,120, 35,205,173, 95, 80,239,133, 82,  5,151, 18,234, 86,226,207,220, 12, 92,147, 44,176,230,215,114,230,210,234,154, 66,174,
+200,104,105,120,235,210, 11,206,219, 24,187,168,201,106,156,172,200, 74,  9,248,232, 88, 78,103,230,170,120, 31,236,176,208,108,
+ 87, 75, 72, 12,227,134, 86,239, 40,181,211,203,204,243,175,158,227,230,133,187,219, 59, 30, 62,124,192,229,245,133,155,  7, 59,
+226,165,242,119,191,252, 37,191,122, 62,243,253, 79, 54,244,208,185, 44,134,201,  4, 33, 74, 99,183,185,225,250,201,  3,110, 30,
+ 61,224,245,223,254,  5,183,135, 76,240, 17,173,141,142, 82,123,163, 10,246,231,151,190,154,209,148, 86,171,145,248, 84,113,167,
+ 76,219, 52,124, 26,104,249,204, 92, 59, 27,159,112,226,200,151,198,211,155, 61,227,152, 56, 92, 50,211,176,165, 93,206,252,228,
+175,254,130,207,190,255,140,248,232, 67, 54,155,206,135,109, 67,159, 59, 99,218,113, 97, 32, 94, 61,226,227,199, 79,208, 92,169,
+237,204,207,110, 95, 16,189, 99, 24, 39, 90, 94,248,187, 95,252, 21,255,234, 39, 63, 39,238, 30,114, 89, 22,134,209,104,133,181,
+116,106,174,  8, 59, 36,195,151,183, 47,249,252,197,107,158,222,220,240,224,193,222,210,164,185,177,219,237,184,190,218,147,246,
+194,237,237,107,238, 47, 51, 41, 55,254, 95,214,222,108,217,178,236, 58,207,251,198,236,214, 90,123,239,211,100, 87,153, 89,  5,
+128,  0,  8,144, 32,197,198,146, 72, 72,178,195, 97,135, 20,214,141,111,253, 64,124, 16, 63,129,223, 64,182, 67, 97,218, 84,144,
+ 18,109, 81, 32, 65,128, 34,122, 20,170, 65, 85,102,158,110,239,189,214,154,205,152,190, 24, 43, 11,164, 29, 14, 95, 48, 51,162,
+162,154,168, 58,117,242,156,179,247,154,115,140,255,255, 62,167,157,253, 94,  8,126, 98, 76,143, 89, 90, 35,175,133,199,143, 42,
+251,253,200,139,247, 31,243, 47,254,224, 91,252,250,  7,239,241,139, 79,110, 72,227,192,229,229,192, 60, 31, 57,221,159,249,111,
+255,155,111,227,189,103, 93, 23,222,220,175,172,173,219,126, 92, 11,135,203,107,166,195,158,229,116,207,205,171,207,109,111,239,
+  3,126,219,187,151,220,200,154, 57,233,202,105, 89,185,184, 56, 48,140, 35,195, 48,177,223,143,204,107,197,236,161, 74, 85, 71,
+ 87,227, 67,  8,149,189, 79,164,225, 41, 45,175,204,121,166,105,101, 55,237,216, 31,158, 49, 14,207,121,120,248,148, 92,206,248,
+ 38, 76, 83,226,203, 95,125, 65,107,141,155,207,111, 56,223, 47,156,124,103, 94, 59,187,113, 71,110, 29,223,  5,173,142,230,108,
+237,176,214,  7, 38,206,252,214,151,158, 49,207,153,143, 63,250,165,133,171,170, 99, 68,201, 94, 89,137,150,216,237,134,122,109,
+186,176,168,178, 11,246,240,204,171, 26, 20,170, 55, 92, 87,162,171,132, 48,208,231, 70,143,149,188,  8,174,102,246, 50,176, 84,
+ 69,  7,129, 82, 54, 78,133, 57,233,149, 76,174,157, 93,138, 52,241,156,180, 17,189,105, 68,227,224, 41,165, 18,188, 71,165, 16,
+197, 89, 54,102,242, 68, 50,185,121, 90,131,105, 50,121,147,174,133, 62, 37,131,218, 84, 96,  7,125,169, 91,238,101, 32,246,145,
+230,132, 92,148,171,209,193,193,227, 99,164,230, 74,114,145, 30,161,228, 29,187, 49,210,253, 66,209, 35,147, 31,104,238, 64,114,
+ 80,243,173, 57,219,125,226, 92,110, 89, 91, 97,240, 19,218,173,250, 89,218,130, 75,117,155, 86, 94, 34, 75, 70,164,218,251, 78,
+180, 52,188, 48,177,204, 21,223, 27,209,175,212,  5,123,159,116, 19, 82, 22, 86, 45,244,116,131,115,158,232,  5, 57, 52,118,221,
+130,141,126, 12, 52, 77,200, 34, 20, 50,  7,239,240,165,225,198,248,182,148,131,168,146, 91,195,139,146, 92,218,154, 76,141, 85,
+ 45,  7,226,176,213, 90,120,  7,123,234,183,157,117, 17, 54,230,251, 59, 12,157,105, 71,164,147,146,127,231, 31,183,109,213,226,
+119,157,  1, 80, 32,139,218, 84, 80, 45, 44, 29,176, 21,102,233,142,234, 42,197,201,150, 86, 47,228,186,210,114,101,237,  3,195,
+ 52, 50,  4,147,138,201, 16, 72,206,241,112,159, 24,135,149, 59, 61, 17,114,231, 20, 10,187,203,129,176, 12, 84,205,156,231, 95,
+178, 75, 19, 61,174,200,234,105, 18,168, 52, 84,133,224,147,167,171,145,207,188,  8,180, 70, 85, 27,113, 85,108, 28,208,229,237,
+ 30, 52,219,131, 77,172, 18, 36,221,228, 41,206, 23,164,117, 59, 69,134,109,135,243, 22, 49,234,189, 17,128,  2,120, 21,180, 54,
+123,234,109,244, 31,143, 35,107,179,202,133,120,168, 74, 19,197, 59, 27,176, 75,182, 90,209,178, 54,211,180,227, 32,120,171,131,
+109, 86, 34,193,217,234,165,117, 42,198,108,143,219,104,206,106, 77,216,109,164,109,213, 39, 17,168,  6, 72,  9,162, 44,243, 66,
+ 74,158,228, 44,160, 37,193,161,165,144,223, 54,  0,122,163, 59,143,214, 70,116,206, 14, 45,217,250,216,157,206,154, 11,209,219,
+ 40,183, 54, 75,199,123, 31,168,155,177,110, 61,173,212,109,255,164, 98, 97, 66,232,196,241,146,167,215,143,153,111,238,185,215,
+ 74,107, 91,191, 54, 55,214,170,156,142, 71,254,250,225,158,175,125,208, 89,142,119,252,248,179,149,162,158,190, 84,154,238,184,
+ 72,142,172,194,110, 80,220,154, 24,246, 19, 47, 31, 95,242,213,171, 75,254,244,175, 62,226,252,144,241,193,163,197, 70,253,  5,
+190,144,223,136,139,104, 51,184, 40,  2,235,122, 70,232, 44,235,194,221,241,142,218, 42,136,227,156,143,236, 68, 72, 46,144,215,
+ 66, 16, 56,140,137,251,211,106,213,181, 24,249,238, 15,127,196, 31,255,159,127,201, 87, 63,248, 50, 47,222,187,226,238,230, 13,
+243, 82,185,186,124,196,179,167,143,216,173, 43,245,213,231,230, 15,142,144,215,153,190, 20,206,121,198, 15,137, 55, 55,119,230,
+209, 88, 23,142,115, 65,122,192, 71, 79,207,133,243,121,102,109,  7,100, 12,132, 16,208,214,200,173,160, 82,249,244,103,159,241,
+234,238,158,113,  8, 92, 63,122,194,243,235,167,  4, 81,124,  1,162, 48, 30, 38,214,156,201,235,145,160,141,224, 28,195,197, 14,
+ 90,231, 95,254,171,127,202, 31,254,254,175,243,131,191,249,144, 87, 55, 39,126,231, 31,127,131,127,247,199,127,206,127,250,222,
+ 79,249,198, 87, 94,242,239,254,195,247,249,246, 63,251,125, 46,167,137,175,189,124,198,215,190, 52,240,167,255,241,123,124,242,
+249,107, 94,188,247,140,114,124,195,223,254,224,111,248,249,207, 63, 38,164,137,105,183,103,220, 93, 49, 13,145, 32,202,218, 29,
+181, 45,156, 31,142,148,229,196,105, 89, 41,205,129,120, 86,157,141, 17, 30,194,102,180, 83,  8, 19,107,171,168, 54,174, 46, 39,
+118, 59,225,161, 15,172, 13,150,227, 61,243,241,132, 31, 27, 47, 95,124,157, 52,  8, 55,175, 62,166,233,194,122, 86,202, 67,230,
+226, 50, 80,246, 35,189,  9, 15,199,149,139,105, 98, 74,  3,119,231,163,201,131,212, 94,147,211,  0,195, 20,248,248,254,158,  9,
+225,107, 47,223, 35,223, 31,185, 59, 61,208,  7,199,178,218,237, 51,164,193,192, 59,161,208,106, 37, 38,161, 45, 35,139, 86,156,
+100,155,122,117,155, 58,137, 40,185, 41, 94,237, 70,210,139,224, 54,212,111,141, 74, 44,202,172,149,224, 33,212,192, 18,  2,190,
+117, 11, 11,249, 98, 10, 92, 63,162,177,208, 90, 38,  2, 82, 26, 89, 97, 26, 38,235,241,246, 98,  8, 88,  7, 94, 18,141,145,233,
+162, 81,207, 11, 61, 69,188, 11,132,115, 51, 78, 58,153,245,174,144, 24,104,190,177,222,100,210,216,184,138, 35,181,  7,206, 57,
+179,155, 18,156, 23,130,143, 76, 67,160, 72, 71,117, 33,  5,207,202,200, 50, 87, 24, 26, 41, 68,142, 15, 11, 97, 59,160,171, 20,
+118, 62, 49, 21, 65,131, 34,197, 19,170, 39,139,167, 13,  7,212,175, 36, 93, 57,171, 16,  9,156,122,193,  7,181,166, 70,152, 89,
+154, 25, 11, 99,109, 54,174, 79,246,123, 27, 93,226,166, 42,115,107, 92,140, 91, 27,169,101, 78,234,  9, 65, 41,231,206,152, 20,
+ 25, 26,113,174,104,119,204,107,128,209,152,241, 29,221,124,  5,102, 77,243,190, 19, 93,178, 76, 71, 20,154, 20,162,236,136, 62,
+253,131, 29,234,127, 87,186,210,187,  5,138,223,165,112,133,110, 53, 67,247, 46, 63, 46,111,161, 55, 27,194,251, 29,154,223,222,
+126, 61,242, 98,121,172, 20, 58, 53,123,122, 81,154,111,182, 30,233, 32,190,161,177,160,165,176,219, 37,214,150, 16,129, 80, 11,
+222,  9, 89, 34,249,222,179,248,149, 28, 58,107, 41,172,  8,205,101,130, 68,134, 46, 44,229,200,172, 17,221, 14,197,221,  9,171,
+175,248,139, 68, 57,182,237, 32,135,213, 33,164,169,141,218,197,130, 69,221, 91, 16,174,170, 34,254,173,163,215,188,226,174,217,
+ 24,188,118, 59,153,120,186, 89,194,124,183,126,184, 61, 82,237,196,229, 55, 14, 47,118,162, 43,197,160, 44,222, 57,130,116, 74,
+ 23,240,  9, 23,173,227,215, 99,192,111,123,187,174,213,194, 85, 46,144,124, 53,134,124, 83, 52,203,118, 72, 96,219, 53, 26,216,
+166, 75, 53, 68,237,150,152,245, 56,156, 43,219,168, 63,161,100, 75,185, 98,164,187, 64,167, 57,221, 92,195, 74, 16,251,253,  7,
+239, 81,173,219,225,197, 92,220, 73,132, 54,218,216,188,234,178, 97, 23,133,214,  5,117,233, 11, 60,146,108,120,197,214, 43,146,
+ 60,158,202,188,174,198,196,239, 74,111,  2,205,246, 24,211,176,163,230, 35,243,106,201,107, 31, 76, 15,121,174,199,205,122,103,
+238,247,159,255,228, 19, 94,205, 74,195, 19,130,161, 43,247,209,225,139, 13,211, 47, 66, 34, 14,239, 81,214, 19,127,242,199,255,
+ 43,119,167,127,205,167,231,130, 11,  9,109,171,161,145, 43,116,169, 84,221,136, 19, 98,220, 93,135, 81,240, 74, 89,183, 41, 76,
+103,158,103, 74,110,208, 43,235,188, 90, 56,178, 55,150,114,228,147,207, 19,196, 61, 79,159, 38,188, 15, 60,172,141, 16, 39, 82,
+234, 28,151, 76,241,194,185, 86,126,246,233,107,210,205, 61,154,148,120, 11,127,253,183, 63,198,  7,207,243,151, 47,168, 75,230,
+205,235, 55,184,224,121,249,242, 57,105,  3,  1, 45, 75,230,124, 58, 49, 13,198, 49, 14, 81, 88,214, 19,231,211,  5, 62, 38, 11,
+185,104,101, 85,  3, 34,165,157,199, 63, 88,168,234,116,158,249, 69,121,195,241,116,203,224, 58,151, 87, 87, 92,249, 11,116, 85,
+ 82, 28, 89, 90,195, 83, 33,219, 62,248,167, 63,252,132,151,143,158,242, 91,191,253,235, 60,126,126, 77,227,204,254,106,199,139,
+231,207,248,245,111,124,153,251,115,225,248,112,228, 23,191,248,148,159,127,114,224,119,126,243, 27,212,249,158,239,124,231, 59,
+252,120,119, 64,123,231,225,124,226,241,227,103, 92, 31,174, 44,116,169,138,232, 74,115,194,229,238,146,113,127,201,122,113,193,
+195,253, 13,175, 94,223,241,228,217, 51,190,241, 27,223,228,231, 63,251,  9,191,252,248, 83,195, 95,198,193,  8,122,101,166,163,
+ 12,  7,227,255,223,223,190, 97,186,124,204, 56,237,249,236,147, 27,150, 92,232,231,143,208,114,207,225,250, 25,195,112,205, 57,
+191, 97, 26,225,205,235, 19,111, 62,175,124,245, 91,191, 70,119,119,188,254,196, 92,206,159,125,254, 41, 75, 89, 76,236,146,141,
+136,120,125,185,231, 75,207,175,113,221,115,204, 51, 77, 60, 31,124,237, 43, 60,124,255,199,228, 58,111,104,206, 64,109,167,109,
+ 31,102,173,215, 53, 55, 66,172,150,145, 73, 14,213, 72,207,129, 13, 78,128,184, 78, 46,217, 14,235,181, 34, 81,137,233,130, 82,
+ 58, 67,170, 12, 77,169,193, 66, 59, 23,222,147,123,178,186,171, 86,212,117,156,207, 12,189, 19,242, 14, 55, 24, 55, 60,226,105,
+ 45, 64, 93,104, 30,156,175,236,152,200, 10,149, 51,251,236,141,151,177, 26,223, 33,215, 35, 61, 90, 66, 63,106, 64, 92, 32,183,
+  5,169,142,105, 47,172,205,227, 37, 35,226, 56,159, 61,135, 33,208, 93,101,174, 25,  9, 30,  6, 97,169,194, 20, 70,171,216,137,
+ 17, 39,189,245, 84,201, 93,161,143,236,164,176,186, 51, 61, 57,166,139, 68, 91, 50, 82, 39, 10,153,122,204, 44,205, 60, 21,153,
+ 21,215,  4, 77,131,161,175, 93, 66,114,227, 98, 47,188,247,226,203,220,190, 46,220, 31,111,204,147, 17,  7, 82,239,164, 62, 50,
+168,131,  1,134,238, 56, 21, 71,233,142, 20,  2,251,  0,165,120,184,  8,104, 49, 61,169,171,157,238, 26,132, 78,109,213,110,227,
+201,111,178,164,190, 25, 21, 61,158,128,243, 16, 83,124, 39,183,223, 90,205,204,104,140,136,119,119,155, 54,  4,187,110, 16,162,
+119,251, 80,111,213,  8,254, 65,216, 20,208,239,246,166, 94,114,161,150, 74,171,102, 46, 85,103,235, 56,169,118, 89, 44,  5,138,
+  8, 48, 24,107,101, 16,147,101, 13,137, 93,140,176, 84,150,193,158, 89, 49,102,230, 69,241,106,  6, 75,223,132,163, 10,195, 62,
+ 32,210, 72,231, 68,174, 66,175, 51,201, 57,132,133, 41, 37, 84,  2,161,183,142, 74,133,224,209,102,108, 57,186,216, 77, 92,100,
+ 75,248, 90, 90,217,137,225, 81,  5,235,139,171, 56,136,  1,165, 90,149, 72, 54,252,102,115, 72, 18,146,183,  4,125, 83, 65,196,
+ 89,221,173,111,227,121, 39,168,223,176,156,218,191, 72,215,107, 83, 52, 12,224, 42,209,  5,219, 61, 23, 19,194,216,232,206,246,
+ 73, 78,  4,103,243,126, 74,175, 27,233, 46, 90,124,102,131, 62, 72,179,149,128,153,132,218,246,128, 86, 16,123,232, 46, 77,192,
+219,222, 75,181,211,130, 61, 44,234,146,109,204,207,198, 67, 86, 33, 72,223,192,252, 13, 85,143,139, 80, 17, 90,171, 36,239,105,
+218,240,126,163,204,117,204,155,219, 59,249,188,178,214,205,227, 94,213, 26,  1,206,129, 15,140, 67, 66,219,194,113, 53, 68,167,
+247, 32, 65, 57,159, 87,134, 97,199,197, 46, 16,171,242,203,251,149,182,173, 51, 74,239,220,212,206,235,211,202,251,143,174,121,
+ 34, 16,189,242,253,143, 63, 99,246,158,143, 42,252,179, 47,127, 21,249,197,127, 96,209, 51,189, 59, 74,175,168, 20,219,249, 98,
+149, 37,231,228,139,188,128,223,  2, 46, 29, 19, 76,136, 24, 79,191,212,206, 58,175,196,105,228,112,253,152,203,171, 39, 60,127,
+242, 30,251, 36,244,100,252,167,228, 19,206, 21,142,119, 71,238,151, 27,202,105, 33, 18,152,134, 72, 65, 57,159, 51, 47, 95,236,
+184,186, 60,240,250,214, 14, 47,215, 79, 15,188,185, 59,114, 42, 43,247,199,133,235,139,196, 52, 36,206,231,133,211,124, 79, 26,
+175, 54,141,174,133,203,154, 42,169, 59, 98, 20, 74, 21, 90,206,180,  6,210, 29,222, 25,139, 64,  0,239, 27,201, 59,230,186, 50,
+191,126,205,241,148,113,162,208, 50,251,171, 43,158, 92, 63,166,172, 43, 97, 16, 62,123,243,192,159,253,249,119,248,201, 79, 14,
+252,247,255,195,191,196, 15,158,127,252,237,223,226, 31,125,235,235, 56,224,122, 26,248,241,135,175, 89,158, 63,231,209,245,  5,
+ 15,167, 51,159,221,220,112,117,189,227,227,143, 95, 17, 66,226,234,233,115, 46, 14,  7,164,207,204,243,105,219, 99,186,141,136,
+151,161,142, 68,151, 24,198,145,103,143,161,148,153,178, 28,249,221,127,244,187, 60,121,246, 62, 63,249,209,247, 57, 29,111,120,
+122,245, 24,130,231,248,112, 34,184, 78, 57,175,140, 46,178,235,157,215,183,159, 49, 47,103, 19,232, 72,231,116,188,103, 94,103,
+134,225,146, 48,152, 24,231, 75, 95,186,226,219,255,228,247,248,246,183,127,143,255,252,179,159,241, 63,190,249,159,248,229, 71,
+175, 89,203, 39,120, 23,184,124,116,193,110,186,228,220,225,233,227, 43,  6,127,  9, 61,114,123,115,131,212,200,243, 95,123,193,
+251, 47,175,249,217, 79, 78,212,  6, 75, 91,240,211,  0,115,163,180,140,211,104,  7,250,182,226,122,162,175,  1, 74, 37,186,142,
+244,192,172, 43, 40,196,105, 64, 84,240, 97, 79, 43,103,116,153,233,218, 88,194,100, 88,233,197,166, 85, 85,173,177, 81,125,161,
+ 55, 97,144, 11,154, 52,252,154,  9, 59, 71,110,153,166,194,224,160,149, 51,213,155,217,113, 23,246, 44,  0,174, 33,107, 32,227,
+144,168, 80, 21,  9,246,112,214,214, 32, 39,  6,117,180, 61,132,213,236,122,243,220,201,161,114,209,  2,145, 78,107,103,102, 60,
+ 81,  5,137,202, 24,163,221,254, 67,192,119,165, 71,171,158, 46,107,227,176,243, 20,221,225, 81,166,197,161, 41,242,144,193, 39,
+168, 40,238, 81,164,221, 43,125, 94,153,162,163,118,  8,161, 67,241, 27,228, 72,161,  7,226,106, 45,160,131,223,243,236,242,154,
+245,246, 51,206,234,232,163, 48,183, 70, 24,204,189,225,253,192,218, 28,116,235,207, 15,140, 84, 49, 94,136,143, 35,139, 54,218,
+ 12,195,190, 49, 13, 59, 83, 83,247,206,152, 44,172,233,212, 46, 24,205, 91,134,166,169, 34,174,217,207,208,244,110,106, 92,125,
+227,176,122,  7,254, 93,250,206,213,164, 74, 94,  4, 39,239,238,227,214,190,189,245, 75,223,146,250,239,118,252,158, 59,244, 92,
+113,181, 81,123,167,170, 77,221,188, 90,195,234,220, 21,122, 99, 62, 21,252, 69,196,229,202, 40, 74, 72,142, 12,228, 94,113,151,
+142,112, 22,244, 65, 41,110,101,234, 19,121,153,201, 99, 96,172,133, 92, 18,107, 23, 14,154, 88,235,  2, 34, 52,174, 89,227,189,
+ 73,166,180,218,244,185, 43,155, 62,117, 43,229, 59,143,120,163, 24, 65,199,  7,135,219, 36, 45, 85, 77,208, 34, 62, 80,154,169,
+ 83, 61, 98, 39,117, 31, 45,189, 74, 67,187,226,244, 45, 23, 87, 76,167,218,197,126,224,136,134,139,149, 66,175,130,108, 35, 35,
+ 74, 65,123,167,244,134,111,209,166,  6,222, 72,112, 26,  4,223, 21, 95, 59, 18,204,126,133,195, 92,237,120, 82,116,208, 10,173,
+ 25,  5,207, 59, 76,254,140,117, 65,187,217, 81, 77,135,232,109,175, 34, 34,168, 19,188, 19,162,136, 29, 28,140, 14,111,  9,229,
+102,129,162,241,209,173,  0,  0, 32,  0, 73, 68, 65, 84,158, 30, 19, 78, 13,109,233,122, 67,182,204, 65, 32,209,213,129,119,180,
+181,162,152,150, 85, 38,  7,179,245,230, 61,158,156, 43,181,154,114,150,237, 32, 34,206,170,124,206, 41,235,122,162,150,182,121,
+153,189,189,232, 47,175,120, 62,121,242,124,207,210,160,138,173, 57,236, 60,226, 57,159,  5,199,192,133,119,132,141, 94,181, 30,
+ 63,226,123, 31, 45,212, 97,228,175,255,226,223,242,201,135,159,194, 82,201,170,104,215,237,112,110, 33, 65,245, 14,237,130,182,
+130,243, 14, 47,126,227,  7, 10,174, 59,178,118,122,171, 32,194,254,242,125,158, 63,127,202,184,243, 60, 62, 92,145, 92,179,177,
+189,119,212,249,136, 75, 35,211, 97,226,234,226,  5,251,187,196,235,219, 19,126,245, 92, 62,174, 60,156,206,188,122,117,143,208,
+ 25,124,  4, 26,247,119, 15, 92, 12,129,139,221,200,114,151, 57,205, 39, 46,118,145,195, 48,112, 62,159, 89, 22,165,174,158, 49,
+ 37,206,171,157,124,215,229,196, 16,119,164,105, 34,175,150,251, 88,215, 98,234, 73,103,240,232, 86, 26,126, 31,173, 23,191,110,
+255,108, 11, 98,222,223,157, 32,141, 60,122, 36,228, 53,115,177,223,145,162,227, 71, 63,249,  5,194, 75,150,155,207,137,151, 17,
+ 84,136,131, 39,159, 43, 75, 81, 30, 95, 29, 56,205, 74, 12,145,195,126, 34, 14,145,188, 84,134, 97, 96,127,121,197,163,195,196,
+146, 79, 56, 21,122,247, 20,173,228,178,210,123,165,136, 26,159, 65, 50, 67,  8, 92, 60,121,198,105,153,185,185,189,225,189,231,
+143,248,198, 87,159,243,236,201, 53,255,249,187,223,229,238,205,107,118, 23, 35,193,123,150, 83,166,134,206,163,199, 35,111,110,
+ 94,241,139, 95,254, 18, 39,222,124,229,221, 81,157,114, 57, 29, 88,215,149,245,124,143,147,145,151,207,222,227, 43, 95,185,102,
+ 31, 29,174,116, 46,199, 61, 31,243,218,160, 36,162, 60,220, 63, 48,141,138, 15,215, 60,123,121, 65,215,149, 86, 19, 23,251, 29,
+175, 62,125,224,238,245, 43,122, 55,167,183,111,221,106, 88,165,208, 52,155,207, 65, 12, 36,213,250, 96,252,128,220,233,169, 89,
+ 43,164, 41,174, 21, 28,131, 33,145, 55,159,180, 72, 67, 54,  5,174, 19,147,119,132,232,168,210,137,221, 52, 78, 46,140,248,  8,
+122, 94,112,128,140, 35,173,174,212, 94,136, 62, 48,  5,161,121,111,245,203, 30,223, 38,126,168, 53,227,178, 99,118,214,123, 15,
+150,101, 52,171, 90, 17, 28, 43,139,239,208,  7,106,119, 28,162,193,148,106, 62,113, 26,  3, 67, 78, 12, 65,145,168,180,150,240,
+ 18,185, 59,206, 12,251,  9, 39,155,200,  7,143,148, 78, 84,211,207,122,245,212, 94,145,209,209, 92, 38,201,129, 65, 11,235,176,
+ 34,110, 64,  6, 88,130, 18, 53, 16,239,149, 93, 12,168, 91,184,155, 87,168,149,235,131,183,240, 92,123, 66,246, 51,223,255,225,
+135,204,243,202,197,232,201,213, 52,210,173, 43,164,  1,199, 96, 10,236,224,241,201, 83, 79,  5,215, 19, 71,  7, 65, 10, 72, 99,
+ 76,131,237,133, 93,163,174,141, 24, 60, 90,108,194, 37, 97,147,175,180,198, 16, 71,132, 74,148, 72, 12,129,228,223,205, 67,189,
+110, 23, 64,  7,239,118, 76,110,227, 73,188,219, 32, 61,239,144, 82,215,186,133,159,211,206, 66,220,239,242, 87,219,100, 85, 33,
+ 40, 61,118,180, 24,128,180, 22,161, 74,161, 72,163,169,176,191, 26,240,139,114,179, 42,109,237, 92, 28,172,125, 18,171,224, 70,
+165, 46,133, 83, 59,225,207, 21,191,239,244,253,142,126,215,168, 62,224,220,  2, 24, 96,171,248,134,171,157,180, 11,132, 22,201,
+247,243, 86, 69, 79,132,206,219, 27,180,245,112,251,182, 43,239,189, 26,233,127,219,127,183,238,  8, 98,233,239, 42,178,233,106,
+196, 24,241,226,105, 82,137,221, 88,235,160, 54,  6,240,118, 91,102, 75, 94, 54,103,124,238,222, 27, 65, 28,  4, 67,178,182,110,
+148, 55,188, 85, 87,130, 44, 56,  9, 84, 13,230,105,118, 29, 81, 99, 58, 55,245, 56, 42, 90,192,133,104,  5,187, 98,  9,123,239,
+236,230,230,188,125,243,138,179, 16, 97, 23, 71, 15, 14,167,198,161,151, 16, 45,240,212,213,170, 50, 40,226,186, 17,225, 74, 71,
+131,105,210,107, 85,164,228,109,239, 28,168, 20,180,118, 42, 13,183,102, 91, 91, 56,133,224, 76, 74,131, 71, 66, 39,142,253,173,
+201,143, 82,234, 70,209,179,  4,237,232,163,117,215, 67, 36,186,192,188, 86,123,232,110,189,127,239, 60, 95,122,180,199,231, 59,
+226,193, 49,206,141,155, 89,168, 90,141,129,220, 60,143, 14,194,123,215, 17,100,229,180,118, 92,152,248,214,215,174,248,240,246,
+204,167,119, 39,254,247,255,237,223, 18,134,180,233,106, 45,115,160,106,118,243,183,246,  3,121, 59,150,115, 30, 63,154, 62,212,
+ 41, 68, 47, 84,205,140,211, 99, 62,120,241, 77,222,127,249,152,221,208, 88,202, 66, 47, 15,100, 26,165,  9,100,131,241,204,249,
+196,124,187,226,117,  0, 85,246, 83,130, 14,251,139,129, 90, 43,243, 58,179,206, 43, 69, 29,206, 57,150,156,185,121, 56,217,129,
+177, 99,249,129,210, 72,131,125, 46, 69, 51,213,101, 98, 12,  4, 39,100,173, 44,107,101, 26, 26,189, 26, 19,129, 90,153,207, 39,
+219, 15,226,104,210,113, 40,222,219,152,209,252,130, 91,  6,196, 37, 66,220, 44, 83,181,224,156,129,139, 90, 81,254,187,127,253,
+ 95,241,237,127,254, 91,196,120, 70,139,226,125,162,183,206,249,126,166,171,216,138,198, 67,244,209,232, 97, 26, 72,227,  5,207,
+247, 79,192,117,150,114,102, 55,  6,164, 42, 55, 15, 11,243,241,100, 52,196,222,168, 15,103,150,249,196,227,203, 71, 36, 58,165,
+204, 92, 95, 30, 24, 39,199,239,252,230,151,185, 63, 62, 80, 40,252,243,127,241,207,249,254,223,252,128, 31,254,224,123, 56,239,
+ 24,134,  3,116,199,155,215, 39,142, 15,179, 57,197,187,229, 79, 66,138,198,216,159,246,  4,175,244,229,  1,156,112,188, 89,249,
+159,255,205,159,240,135,255,117,231,245,205, 29,159,126,254,154,222,154,153,  4,155,179,125,250,122, 98, 31, 18,147,  8,218, 23,
+230, 89,137,110,100,117,141, 15, 63,126,195,124, 90,201,171, 67,134,142,215,138,115,145, 30,  7,242,188,210,251,130,196,145, 46,
+129, 32,158,228, 18, 69,149,181, 44,120, 25, 72,195,158, 21,165,215,217,164, 20, 46, 64,220,225, 27, 95, 92, 12,106, 83,220, 65,
+ 72, 50,208,215, 64,140,178,  9, 50, 26,153,197, 82,229,114,132,193, 51,174,123, 92, 84,238,231,133,233,224,241,171,125,159,187,
+ 10,148,149,131, 23, 86,175,180,188,218, 45,113,136,204,222,163, 15, 29,138,210, 70,152,186,167,173, 74,240,145, 93, 26,104, 77,
+209,102, 85,194,117, 74,104,170,164,115, 70, 99,227,232,162,173, 20,171,199,135,142,  4, 79,244,141, 78, 36, 14, 23,160,149,124,
+127,  6,129,180,155,160, 56, 52,205,180,224,241,110,194,149,200, 48,128,207, 43, 82,132, 50, 84,203,246,120,207,120,189,183,247,
+162,226,104, 81, 24,166, 74, 88, 29,119,245, 68,218, 59,214,115, 37,250, 61,113,138,198,124, 47,142, 54, 65, 59, 47,  6,129,123,
+122, 77,203, 10, 46,211, 37,226,113,196, 36, 16, 12,255, 90, 91,193, 37,179, 79,218, 92,185, 18,  9, 12, 81,172,170,212, 59, 62,
+ 89,189,177,123, 49,232,213, 59,216, 31,107, 83, 11,157,241,238, 68,234, 38, 93, 83,122,107,132, 36,239,180,163,222, 55,243,162,
+ 29, 24,222,113,  0,111,251,228, 91, 46,204,107,195,245, 68,107,213, 70,239,163,224, 72,132,181,126,241,140, 57,  3,131, 15,140,
+131,160,203,153, 24,  3,179, 58, 56,122,156, 22, 98, 31, 72, 97,  7,221, 81,214, 70, 74,  9,145, 76,140,123,150,227,204, 76, 99,
+204,130,132,192, 82,142,196, 62,146,139, 35,238, 20,215, 27,193,163,150, 22,215, 77,222, 34,111,251,223,225,139, 55, 94,186,141,
+143, 59,102, 76, 99, 99,105, 59,217, 76, 87, 94, 13,233, 42,221, 48,174,146,192,219, 55,219, 13, 30,205,138,115,149,136,167,122,
+211,170,118,239,232,173,109, 88,120, 69, 17,219,203, 59,111,156,237,216,209,150,113, 93, 89, 87,199, 97,  8,184,222, 89,138, 49,
+197,  7,  9, 86, 93, 21,161, 55,103, 59,216, 77,209,170, 34, 52,177,116,190,115,237,139,125,103,235,182,171,211, 22, 73, 67, 96,
+204,149, 34,206,110, 90, 98,212, 57,117, 98,129, 24,181,155,106, 87,187,205,155,199,219,128, 29, 40, 70, 26,163, 89,101,202, 37,
+122, 95,237,244,186,  8, 62, 89,133,207, 53, 51, 39,173, 93,113, 61,224, 66,220,122,245, 13,145, 45, 64, 40,109,243,179,123,106,
+ 45,180,146,208,114,203,224,149,203, 97,160,113,230,246,  1, 30,112,214,159,215,202,213,245, 72,140, 43,111,212,163,197, 49,180,
+202,245,176,231,247,191,252,140,115,249, 28, 63,  8,247, 15, 11,205,245, 47,244,141,142,110,171,252,183, 76,128,110, 53,198,105,
+ 24,104,181,108,104,126,111,161,197,238,121,241,222,  7,252,151,191,255, 79,  8,195,145,211,178,240,230, 38, 32,222,115,127,124,
+ 67, 19,240, 53,227, 82, 66,181,145,170,163,144,105,174, 17,165,177,195,130, 67,227, 48,176, 27, 15, 60, 76,103,142,119,119, 60,
+145, 71,156,114,102, 93, 29,222, 59, 14,151, 23,164, 16, 54,221,169, 67, 60, 44,231,133,178,172,236,134,209,114,  5, 13,214,156,
+113,178,103,116,222,168,135,173,177, 44, 74, 11, 25, 69,209,222,192, 69,188, 42, 85,183,189, 34, 66, 43,141, 30,  4, 31, 18,189,
+153, 36,168, 57,251,119,206,243,  3,127,248,  7,191,206,179, 15,174,185,251,116,134,213,209,135,142,106, 97,119, 57,114, 62, 23,
+214,166, 16, 18, 63,249,240, 67,254,226, 47,191,199, 71, 31,191,102,127, 56,144, 98,228,246,230, 53, 49, 56,124, 83,110, 79, 71,
+214, 50,155,245,175,218,148,171,119,229,124, 84, 92,126, 77,120,246, 20,233,149,225, 74, 24,210,158,139,120, 32, 94,122,254,151,
+127,243,127,240,149,175,127,139,223,253, 47,126,155, 39,143,174,249,247,127,246,167, 28,251, 61,187, 97,199, 90, 44, 25, 61,133,
+ 72,107,157, 90, 27, 57, 84,158, 94, 92,226, 90,167,106, 97,112,130,134,196,112,113,193,152, 28,223,249,243,255,200,116,185,227,
+209,229,129,251,219,123, 11,239,180, 74,244,176, 54, 69,230, 19,243,121,221, 78,116,137,178,118, 90, 11,156,215,206, 90, 29, 99,
+ 72, 44,110, 69,212,211,215, 76,173, 91, 91, 68,  6,180, 22,162, 91,193, 37,214,  8,129, 61,169,207, 40, 25,134,132,111,224,155,
+ 39,106,199,135, 74, 17,232, 61, 33, 58,163,179, 85,160,122, 23, 38,  7,132,202,114,178,208,105,243,133,216,131,145, 44,189, 16,
+170,103,237,149, 92,  5, 39,145,249,193,118,161, 18,179, 41,105,219,153,186, 63,192, 48,208,214, 19, 85, 23,168,141,243,169,160,
+217, 65,175,102,215,203,141, 20, 29,213, 11,180,196,144, 54,155,227,234,129, 51,174, 70, 22,162,209,228,176, 74,154,182,204, 18,
+ 19, 73,237,101,233,162,125, 47,149,134, 12,142,128, 77, 45,135, 48, 50, 36,193,187,200,178, 40,  4,197,185, 70,144, 72,137,149,
+113,112,  4, 63, 16, 99,229,110,134,250,208, 73,106,210,155, 50, 47,156, 91, 32,186, 72, 26,237,225,178,212, 21,215,236,235,238,
+227, 37, 75,173, 80,149, 24, 58,210,102, 36,121,100,245,164,222,209,131, 35,159, 97,242,141, 48, 41, 90, 29,174, 59,198,193, 52,
+187, 61, 88, 94,167,181, 70,138,208, 61,172,173, 32,193,244,189, 46,164,127,248,173,148,141,  1,177, 77, 83,223,213,195, 87,129,
+ 82,218, 38, 14,251,149,254,245, 93,  5,240, 84,173,214,236,125,226, 93,255,106,106,120, 91,175,121,131, 95, 69,227,247,231,140,
+120,107,106,116, 49,208, 25, 69, 41, 30,206, 55,103, 34,141,197, 67, 61, 40,235,109, 38,132, 68,138, 43,193, 79,148,234,104,231,
+ 59,228, 58, 64,138,140,103, 37,  5,203, 88,172,218,241,165, 17,171,163,214,140,184, 72, 94, 58,174, 58,252,139, 23, 47,254,232,
+ 45,240,207, 30, 92, 98,157,113,111, 61,100, 23,  4,239, 29,210, 58,234, 77,128,235,192,110,167, 94,160,  7,123, 72,200,219, 66,
+156,223, 64, 53,130,244,102,151,125, 15,162,142,130, 65,250,221,118, 46, 64,155, 41, 58,183,235,163,176, 73,  9,156,  5,229,130,
+179,125,175,219,200,220,  0, 94,148,238,135,109,204,100, 97, 56,186,  5,223,212,  9,116, 65,212,180,159, 94, 43,173,169, 81,229,
+106, 69,213, 92,207,136,165,104,181,235,150, 29,104,  6,140, 81, 71, 23, 67,225,210,173,102,151,188, 80,100, 51,216,105,167,108,
+233,204,222, 45, 12, 17,  7, 71, 64,232,190, 35,209, 51,132,  1,173,111, 53,128,141,251,155, 91,230,106,123,167,224,141,157,111,
+184, 82,207,110, 76,172,203,204,186, 97,160, 84, 58,151, 59,229,189, 67,224,114,242,236,163,163,212,206,169, 69,214, 34,224,  6,
+194, 16,105, 85, 56, 61, 40,105, 76, 60,222, 39,251, 58, 13,194,179, 52,242,234,248, 64,238,142,132,114,206,155,167,233,173, 18,
+ 21, 35,186, 53,  4, 31, 34,215,251,137, 33,  9, 37,219,234,194,190,247,141, 24, 19,142,206,252,240, 25,247,183,159,114, 60, 31,
+185,126,244,132,103,143,159,145,166,167, 84,113,228,146,233,189,162,217,252,216,218, 10, 45, 23,186, 23,114, 85,150,210,169, 78,
+145, 96,148,194, 82, 11,135,253,129,231, 87,239,241,228,201, 99,158, 63,123,196,213,254,146,235,203,201,106, 63,206,155, 22,212,
+ 25,137,207,  5,251,188,138, 42,222, 57,174,246, 87,100, 45,172,165, 80,138,226,130,199,123,161,109,107, 23, 17,103, 50,158,214,
+ 89,107, 51, 29, 43,157,113,183, 99,191,155, 40,181,114,121,216,163,170,  4,159,240,193,243,123,191,251,117, 14, 87,201, 60,205,
+ 91,118, 16,117,148,165,113, 58,175,220,159, 50,222,  7,254,226, 47,191,203, 95,124,247,  7, 72, 48, 26, 98, 41, 21,173,157,113,
+136, 44,203,204,113, 89,104,165, 51,140,137,142,176, 84,155,142,212,214, 56,231, 74,  8,145, 56, 70,196, 43, 67,116, 60,121,242,
+148,247,159, 95,242,199,127,242,103,124,247,175,254,150,103,151,215,124,253, 43, 95,226, 92, 26, 63,252,225,143,104, 40,209,121,
+ 98,180,215, 73,201,246,250,186,216, 95, 16, 93,162,212,108, 30,249, 22,232,213,113, 62,159,185,188,114,148, 90,185, 63,101,198,
+ 52,160,  4,206,167, 25,117, 86, 25, 69, 29,185, 22,238,111, 79,188,255,244,146, 39, 47, 30,115,251, 58,243,176,  8,203,154, 81,
+ 50,161,195,154,205, 85, 95,186, 18,189,216,142,218,123,155,138,137, 61,224, 37,217, 33,119, 12,157,181, 40,189,217, 67, 69,106,
+176,192, 39, 66,105, 32, 94,136,218,200, 36, 59, 76,122, 80,178,185,181,187, 71,  6,197,247,128,119,158, 36,202,210, 34,173, 71,
+114,155,113,170,118, 91,243, 21,237, 21,167,  1,245, 51,131,139,150,192,207,153,209, 59, 30,206, 43,165, 58, 36, 40,212, 76,235,
+157,232, 61,  1,135, 31,133,113, 24,169,163,224,187, 80,115, 65,220,  8, 49,224,146,167, 20,168, 45,178, 31,246,248,216,169,221,
+ 81,117, 70, 90, 64, 82, 68,123,133,102,225, 88,159,182,241,106,140,230,180,112, 10, 98, 55,123, 66, 39,133,184, 73,165, 70,134,
+113, 32,141,163, 73,164,122, 37,198,198,126, 63,208,177,181, 76,237,214, 61,142,111,165, 82,162,212, 44,104, 11,134,190,246, 16,
+123, 66, 54,169,201,154, 11, 97,244,184,234,152, 75, 38,148,198,148, 18,115,237,164, 24, 33, 64,105, 86,  9,246,158,141,249,225,
+182, 77,162,241, 52,146,247,236,198,145,103,239, 61, 49,166,200, 63,112, 63, 61,159, 51, 45,175,236,  7,199,176,219,191,155,  7,
+ 99,135,243,185,162,235,194,110, 10,164,105,122,119, 96,152,220, 88,207, 51,154, 11, 23, 23,145, 48, 76,239,244,161,126,123,106,
+188,121,117, 67, 57,223, 18,104,182,190,236,133, 92, 21,201, 66,153, 43,187,109, 79,164,179,  9,149, 86, 15,209, 57, 19, 18, 97,
+205, 49,215, 18,234, 59, 69, 29,218, 60, 81,  2, 99, 16,102,237,148,135,140,  6,143,109,138, 51, 94, 10, 93, 50,243, 90,152,134,
+136,248,200,233,188,224, 95,190,124,127,123,168,111, 15,196, 46,  6,145,  9, 54,202, 54,135,185,199,109, 85, 53,123, 88,219,126,
+118,107,126, 91, 98, 54,188, 85,160,218, 45, 76,187,218,131,119, 27,201,119, 12,161,234,137,116, 39, 91,176,  9,180,  9, 62,184,
+ 45,121, 33, 91,176,169,253,202,221,222,177,234,203,246,  3, 42, 46,216, 20,165, 41,210, 13, 94, 17,188,153,112, 98, 16, 68, 43,
+ 93, 32,249, 78,107,149,230,133, 40, 80,213, 78,240,253,237,231, 95, 55,108,160, 98,178, 22,204,218,165,106,245, 19, 85,163,127,
+ 57,111,159,119, 83, 27,159, 52,237, 91,200, 12,156, 75,150,216, 23,181, 93,149, 51,124,174,219, 14, 46,212,194,237,221,  3, 75,
+209, 77, 14,180,105,105,135,192, 56, 76, 28,246, 59,202,124,102, 41,  5,241,158,199, 87, 19, 95,125,188, 99,231,149,232, 19,169,
+ 43, 75,174, 44,218,121,168,118,216, 17, 60,165, 38, 78,115,229,197,228,185,158, 34, 25, 56, 46, 71, 90, 31,153,124,231,151,111,
+ 30,232, 56,214,106,159,187, 74,199, 99, 78,242,182,117, 59,134,152, 24,  6, 43,184,158,231, 74,235,138,235,  6,248,216, 79,  7,
+198,184, 99, 46, 51,175, 79,183,144, 11,173, 60,208, 67, 99, 63,140, 60,121,249,146, 39,207,158, 32, 68, 78,235,202,170,157,188,
+ 66,110, 43, 85,132, 92, 76,117, 74,110,148,121,165,228,149,105, 26,153,226,192, 16, 60,193, 91,151, 86, 98,176,  4,190, 19,  6,
+ 63, 48,142, 59,174, 30, 29,136, 99,160,174,217,190,238,173, 81,155,245,149,157,183,145,190,182,134, 79,241, 11,126, 50,210, 17,
+117,184, 24,236,230,222, 44, 27,209,123, 39,120, 71,171,133,105,220,241,248,250,218,126,110, 68, 24,134,145,111,255,211,223,224,
+209,211,189, 65,149,188, 51,166,246, 90,201,165,115, 94, 26, 75,238,172, 37,243,215,223,255,  1,183,183, 15,140,195,128,239,198,
+251,239,173, 51,140, 19,243, 58,219,  8,212,218,106,228,121,165, 20,251, 25,244, 94,108,237,225,133,195,245,  8, 61,226, 10,164,
+ 24,121,246, 98,207, 79,127,254, 17,223,249,222,143,184,121,245, 41,151,207, 30,243,236,215, 94,242,139, 31,255,140,155,219, 91,
+203,161,248,142,106,199,169,165,249, 47, 31, 95, 25,184, 66,160, 71,  8,241,128,195,177,172, 15,252,242,243, 27,174, 47,159,242,
+187,191,241, 62,159,221,220,113,253,248, 49,181, 21,150,117,197,  7, 33,184,132, 83,184, 61, 29, 57, 46,149,175,124,233,  5,170,
+  3,243,218,113,172,172,121,101,241,142,214,149, 46,193, 80,194, 13,180, 27, 81, 18,159,136,162,120,111,140,131,  1, 71, 22,135,
+186,142, 15,141, 62,237, 41, 85,241,169, 35, 61,225,220, 64,201, 39,123,127,208,134,  6,135, 27, 12, 65, 45,139,189,102,189, 15,
+244, 46,172,210, 80, 86, 90, 93, 40,181,162, 69,112,161, 33, 77,  9,197,130,110,158, 98,126,114, 21,122, 19, 84,236,235, 93,171,
+ 71,251, 10,205, 17, 91,162,246,188,129, 85, 18,125, 35, 87,  6, 28,193,121,186,138, 77, 60, 48,218, 87,109, 71,195,239,106, 35,
+247, 70,201, 71,219, 95,187, 74, 26,119,232,220,232, 82,104,197,110, 94,201, 37,187,181, 27, 63,218,242, 65, 85, 44,195,131, 67,
+240, 72,138,248,232,240, 21,202, 26,113,190, 50,122,207, 82,156,229,130,122, 49, 14,134, 68, 14,193,209,106,164,116, 72,110,160,
+ 73, 32,197, 78,  8,150,150,151, 97,162,149,142,239,153, 62,  0,227,128,107,130, 19,193,139,195, 15,110,123,136, 11,161, 91,  3,
+193,137,241,221,125, 12, 72,143, 95, 60,232, 29,129,113, 10, 60,125,246,248, 31, 92,105,171, 29,230,211, 76, 43,153,253, 20,137,
+227,244,206,110,234,231,115, 70,203,202,197, 20,  9,227,248, 14, 31,234, 86, 93,150,186,114,125, 53,225,226,248, 46, 39,239,220,
+156,149,219,207,223, 80,230,  7,219,123,107,177, 48,111, 48,210,163,  4,  8, 41, 48,175,246,222,215,122,163,212,153,152, 70,138,
+247,228, 94, 89,142, 51,190,  7,115,137,232, 76,237,149, 33, 42,139, 40, 97,221,113, 21, 29,139,158,241,173, 33, 84,100,239,232,
+222, 42,146,210,183, 28, 20,  3,254,197,  7, 31,252,209,214,183, 50, 80,156,179,135, 79,111,150, 44,199, 57,156, 55, 59,153,235,
+134,143,245,222,189,253, 79, 44,244,246,197,195,204,125,193,214,237,155,230,212, 70,161, 30,165, 19,183,219,188, 72, 55, 39,123,
+238,  6,107,149,130, 71,104,106,206,118,188,253,123, 42,118,115,175, 90, 45,108,227, 61,218, 54,  6,123, 12, 70, 67, 11,106,187,
+236,110, 15,111,156,224,164,153,124,161,118, 68,141,220,214,213, 96, 53,189,119,235,180,  6,235, 89, 42,182,175,151, 77, 51,139,
+ 90,198,192,117, 71,114, 80,170, 34,222, 81,242, 91,192,131,213,223,156, 64,138, 30, 84,112,222,  8, 86,234,173,254,227,162, 77,
+ 22,214,101,225,246,238,129,214,133,174,138,136, 85, 77,  2,158, 33, 78,236,125,228,120,190, 99, 45,202, 56, 68,190,254,116,199,
+151, 46,  7,246, 67, 32, 75,227,184, 58,124, 10, 36, 31, 40, 50, 82,155, 80,218, 74,244,194, 56, 94, 49,247, 74,144,149,169,131,
+184,137,235,167,239,241,104, 16,238,111,239,184, 57,101,242,210,182,160,156, 81,228,140, 98,215, 96, 11,252, 53, 58,203, 82, 88,
+138,121,159, 59,194,110, 58, 48, 12, 17, 60,236,  6,207,205,235,215,188,186, 61,114, 58,175,220,221,190,226,248,112,207, 56,120,
+174, 47,  2, 95,255,181, 47,243,248,217,215, 89,107,100,174,153, 22,160,101, 40,231, 51,181, 84,150,211,137,170,194,112, 24, 24,
+ 98,100,151, 18,234,149,166,178, 33, 91, 27,107, 54,248,207,224, 61,205,155, 85, 45,133,136,147,104,129,180,113, 50, 10, 91,112,
+219, 97, 74,201, 37,155,212, 39, 68,122,107,244,190,117,169,163,245,219,107,206,214,216,216,154, 15,181, 22,198,113,228,114,183,
+167,182, 74,213,194,203,151, 47,121,184,185,167,229,194,203,175,188,180,214, 69,169,244,230,  9, 49,146,215, 78,195,243,201,167,
+159,240, 87,127,245,  3,106, 85,124,136,248, 52,144,196,108,102,181, 21,150,101,161, 46,153, 97,244, 52,237, 28, 31, 22,171, 87,
+ 34,104,237, 68,129, 16, 35, 41,140,150,233,  8,142,230, 22,158, 60, 26,120,243,203, 27,126,246,233,107,238,143, 15,204,199, 19,
+223,248,230,111,178,219,237,248,201,143,126, 66,169,149, 90, 10,173, 20, 98, 12, 60,123,239, 61, 16, 40, 57,163,173,224, 69, 24,
+199, 29,222,245,237,176,166, 68, 17,222,220,188,226,227, 79,238, 56, 76,123,198, 93, 98, 45,153,210,140, 76,133,130,138,227,252,
+176,  0,142,203,203,199,212, 86,201,117,102,205,230,222, 22, 17,198,110, 58,213,166, 48, 68, 33,170, 80,109, 71,103, 99,108, 54,
+ 51,151,  4,162,235, 36,  9,246,240, 31, 58, 84, 15,165, 81,157, 82,115, 70, 70, 97,196,219,158,189, 67,146,141, 53,235, 21,209,
+100, 19, 48, 42,125,235,240, 83, 27, 77, 60, 84, 71,205, 21, 39,193,136,147,154,240,221,216,215, 65, 58,190, 70,170,118,  2, 21,
+186,103,156, 18,180, 74,117,134,  1,174, 62,160,219,  1,104,236,142,222,  2, 69,149,166,141, 16, 21, 87,192, 21,235, 45,183,208,
+  9, 54,170, 99, 61, 87,198, 97, 32,175,149,174,202, 92, 50, 74, 39,137,223, 14,249,254, 11,132,109,140, 38,185,233,218,241,209,
+ 28, 22, 94, 28,174, 27,251,195, 57, 79, 75,144,114, 69, 52, 48,215, 74,214,182, 41,125, 15,224, 58,161, 27,119, 97,191,155, 76,
+105, 93, 21,223,236,253,160, 82,217, 57,136, 62, 80, 39,207, 62, 11, 49, 64,142, 66,152, 18,135,228,172, 29,178, 10,226, 61, 46,
+202,214,229, 87,123,159,117,142, 96, 51, 11, 11, 36,139, 24,  3, 64, 60, 53, 87,104, 54,113,164,111,187,108,172, 34,220,251,134,
+212,238,111, 23,221, 91,210,108, 35,206,204, 75, 97, 57, 47,212, 90, 73,174, 51,238,223, 13,245,109,109,112,188, 63, 67, 93, 56,
+236,226, 59,195,184, 42,112, 94, 26,101,158,241,154,185,186,218, 35, 97,120,119,163,125,224,246,152,185,125,115,131,214,123,186,
+ 26,206,185,209,201,213,  2,210,104,163,183,134, 43,160,121,  3,187,185,104,133,114,231, 88, 78, 71,100,103,245,181,220,206,200,
+126, 59, 64,182, 66,146,145, 92,207,204,235,140,247,158, 41, 88, 51,171,128,113,228,253,140,223,155,140,136, 86,241, 47,222,127,
+241, 71, 97,115,159,235,166, 79,237,106,183,243,190,193,224,157, 23, 68, 77,255,184,101,229, 65, 28,218, 97, 74,230, 58, 23, 18,
+226, 44,236, 38,186,133, 28, 92,223,144,179, 27, 49, 62,216,248,190,171,221,152,157, 56,122,135, 40, 22,198, 19, 44, 52,167,116,
+ 92, 55,253,158,247,125,187, 21,  7,188,247,208,204,147,221,183, 14,124, 24, 18,110, 11,162,233,150, 14,111, 40,104, 65,155, 65,
+216,165,219,109,206, 57,143,115, 66,176, 40, 31, 77,133,224,212,132, 17,221,161,213,210,163,118,125,135,210,219, 86,199, 19, 90,
+109,104,247,155,214,211, 42,120, 18,141, 55, 79,183,135,184, 32,  4,111, 24,203, 33,  4,214,211, 29,175,239, 78, 38,176, 15, 14,
+  9,193,210,196,173, 17,198,137, 16, 28,167,229,140,139,145,167, 87, 19, 95,123,111,226,242, 48,209, 93, 39,116,101, 23, 29,187,
+ 67, 98,169,129,211, 50, 48, 87,101,188,220,145,198, 17, 39,145,211,156,121, 51,  7,110, 86,120,113, 61,242,100, 55,208,152,153,
+166,198,235,207,142,124,248,250,196, 82, 13,  2,212,138, 81,239,236,197,218,127,133,239,221, 40, 75, 69, 45,104,182, 31,119,164,
+ 16,236,160,230, 26,199,243,194, 90, 50,243,178,240,230,254,142,155,155, 91,142,247,247, 60,220,223,112,188,191, 35,180,149, 58,
+223, 82, 40,236,166, 39,120,  9, 44,203,  3,218,149,247,190,252, 77,222,251,224, 37, 99, 26,113,190, 17, 90, 71, 67,183, 85,141,
+ 56, 90,171,  4,231, 25, 70,161, 59,251,129, 14,155,192,167,139,103, 74, 35,187,157,245,182,163, 31, 54, 38,129,146,123, 51, 67,
+ 86,124,251,245,124, 43,102,137,244,110,142,116,121,155,  5, 17,251,137, 13, 33,114,185,223,179,228,149,166,149,195,254,146,143,
+ 63,121, 69,239,141,223,255,131,111,209,230,149,243,205,194,188, 84, 78, 15,213,170,156,218,249,211,127,255, 23,124,244,201,107,
+ 58,106, 97,185, 52,208,  4,164, 43,190, 71,170, 22,138,102,123,224,158, 10,203,230, 26,160,119,188,235, 76, 23, 35,187, 97,199,
+ 52,140, 92, 14,158,185, 86, 84, 51, 65, 51, 63,252,233,231, 60, 28,207,212, 92,185, 63,206, 28,239,110,217,143, 59,110,238,238,
+152,151, 51,218, 10,211,110,207,211,231, 47,169,170,212, 82, 80, 45, 84, 85, 66, 24,137,221,234, 93,221, 15,248, 56,242,236, 98,
+228,195, 79, 63,230,225,126, 70, 36,129, 28,152, 18, 76, 49, 49, 47,213,252,  7,218, 64, 42,111,222,220,113,184,120, 66, 26, 15,
+ 20,102,122, 43,148,181, 16, 91,160,106, 67,  3,168,107, 12,227,128, 96,192,169, 24,247,166,244,148,104, 29,105,153,241,174,210,
+ 37, 50,168,176, 31, 70, 90,178, 16,107,236,158,224, 26, 69,  2,173,141, 52,183, 80,230,153,214,173,141,226,123,163, 84,136, 18,
+161,101,147,152,196, 64, 16,217,236, 17, 30,113,  5, 29,161,171,201,115,124,237,104,134,142,103,  8, 22,172,164,182,141, 18,105,
+ 19,173, 56, 93,210,114, 33,137, 29,188,155,  4, 66, 50,100,107,169, 30,167,209,194,183,195,129, 32, 13,130, 82,235, 30,167,202,
+ 26, 10,173, 27, 93,115, 89, 42, 45, 23, 52,120, 46, 98,164,186,200,130,237,239,229,109,198,168,153,116,  6,103, 19, 76,196,153,
+200,169, 54, 52,218,219,189,107, 66,117,176,139, 35,133, 66, 33,226,170,210,100,161,230,198,213,148, 76, 12,211, 10, 97,  3,185,
+236,210,  5,222, 43,165, 43, 67,220, 65,232,196, 48,114,  8,158, 69, 61,211, 24,152,  6,163,227,117, 31,232, 78,137,  2, 18,220,
+246,231,136,244, 45, 55,231,  5, 31,  6,187,221, 15,123,106,216,177, 86,251,111,179, 66,110,157,117,173,172,165, 81, 74, 35,151,
+ 74,206,149,146, 59,185, 52,214,165, 50,207,149,117,169,156,207,133,187,251, 51,167,251,123,250, 22,148, 43, 85, 41, 75, 37,231,
+102,254,239,181, 24,180,168, 54,106,110,214,236,105,221, 14,215,185,125,145, 57,105, 27, 45,178,213,134,230, 74, 94, 11,199,135,
+ 19,101, 93,208, 13, 23,158,182, 75, 96,111, 38,208,234, 88,171,165,171,253, 89,182,131, 70,239,191,250,235,191,255,135, 29,212,
+150, 92, 57, 29, 79,214, 76,105,133,195, 20,240,111, 77,117,102,191,249,  7, 29, 74,114,131,215,175,111, 57,222,223,145,151,147,
+125, 78,106, 89, 31,231,160,173,221, 64, 90, 85,104,210, 56,191,205, 13,  4, 79,201,149,222, 42, 90, 21,239, 70,170, 38,195,175,
+ 51, 32, 57,176,174,  5,233,157, 33, 56, 36, 24, 23, 37,119, 33,106, 71,188, 35, 55,103,255,143,188, 16,124, 99,157, 27,161, 55,
+187, 17,243, 22, 60,179,  1, 87,154,110, 34, 19,121, 75,141,  2,227,181,109, 56,187, 77,185,215,240,224, 11, 77, 42,174,111,246,
+178, 38,244,216, 45,135,220,141,179, 46,189,227,154,195, 11,  6,180, 81,103, 23,125,103, 31,103,221, 40,107,210,237,225, 40, 68,
+132,134,239, 54,  2,  4, 91, 13,184,  0,154,187,129,102,  8,232,106, 90, 86, 17,143,120,161,170, 41, 17, 29,208,131, 67,234, 54,
+150,112, 91,154, 89, 59, 42,141,214,132,174,157,204, 86,215,209,134,106, 71,122, 33,185, 64,241,160, 42,184, 32,155,151,206,210,
+227, 97,171,102, 57,111, 15,139, 97, 26,137,192,186, 90,213,164,109,216, 92,241, 74, 85, 91, 80,184,183, 58, 48,204, 75,239,156,
+ 33,115,135, 56, 48,165, 61,185,173, 92,239, 35,251,224, 80,231, 40, 93, 76,  3,235,109,201,241,250,182,114,219,140, 27,238,186,
+177,236,101, 45,244,146,185,201,137,221,229,142, 39,143, 61,174, 61,160,235,  3,196, 61, 50, 30, 88,234, 61,  4,103, 35,207,205,
+220, 36,222,214, 38,155,107,199,100, 55, 78, 17,109,132, 96,163, 67,233,194,213,176,163,201, 76, 16,251,123,179,249, 69,214,210,
+248,201, 71,159,240,241,171, 87, 76,233,231, 92, 31,118,136, 79, 76,195,  5,227,240, 64,154, 44, 28, 23,210,200, 55,127,237, 37,
+207, 30, 77,220,206,153,211,205,153,243,124,195,121,205,232,122, 98,237,149,221,152,112, 62, 81,233,196,161,147,207,158,230, 87,
+ 66,104,140,106,252,126,213, 70, 28, 18,184, 70,242, 19,211,180,103,119, 49,114, 62,205,120, 60,174,195,177, 88,120,142,109, 87,
+235,186,133, 34,107,111,184,230,236,229,218,237,144, 86,181, 18, 67,224,213,171, 87, 92, 93, 30,248,237,223,250, 58,134,242, 19,
+210, 52, 81,117, 97, 45, 43, 21,207,135,159,190,226,199, 63,255, 20, 16, 66,  8,180, 86,208,156,185,120,244,152,135,251, 55,184,
+  0,211, 16, 89,150,192,233,184,152,107, 29,217,  2, 57,176, 63, 92,176,191, 58, 16,107, 35, 37,199,179,103, 23,124,242,201, 13,
+ 55, 55,133,255,235,248, 33,247,119,247,140, 46,113,138, 35, 77, 43, 63,253,217,207,249,249,135,191, 48,  5,172,  8, 93,  2, 49,
+238,140,226, 88, 43,209, 98, 62,236,210, 30,130, 35,247,237,  0,209,148,167,135,  3,206,159,185,123, 88,105, 85,121,243,230, 51,
+246, 23,153, 71, 23,215,188,252, 96,162,247,143,216, 93, 93,224, 67,228,147, 79,126,193,253,253,  3,127,243,195,239,243,205,177,
+ 49, 13,  1,173,130,239,145,197,109,189,230,236,  8,187,129, 62, 68, 16, 97, 18,229,246,248, 25, 15,175,238,184,125,243,134, 94,
+ 21, 82,103,  8,  9, 23, 34,222, 11,147,223,161,190, 49,237,247, 92,236,174,236,125,195, 77, 56,201, 84,148, 93,138,148,166,136,
+194,218, 60,227,224, 57,157,239,136,209,179, 31,  6, 74,111,204, 93,160,101,  6,137, 52,115,152,208,213,227,166, 45, 60,231, 28,
+221, 53, 78,189, 18,  7,193, 37,232,231, 66, 95,  5, 65,201,199, 59,196,253,106,170,179,219, 77,104,168,212,102,227,105,165, 24,
+ 88,106, 57,209,147,178,172,157,216, 78,228,212,237,115,147,198,169, 58,210,212,232, 53,146, 79, 39,110, 93,161,158, 23, 38, 31,
+153, 89, 25, 39, 79,149,142, 52, 71,196,147, 70,160, 10,221,217, 84, 17, 39, 56, 26,129,204,210, 58, 67, 24,209,  4,  7,217,145,
+ 38,143,186, 76, 57,206,244, 12,115, 72,248,226,113,204,246,245, 26,119, 48, 36,195,112,207,133, 97, 16,124, 31,205,189, 33,202,
+  0, 84,133,214,  5, 63,  8,154,133, 33, 37, 43,251,117,165, 56,143,228,102,175,235, 96,115,210, 42,  6,251,122,239,217,129,231,
+239,191,247,133,207,227,109, 14,173,243,119,158,107,253,139, 77,232,175,170, 96,250,171, 27, 41, 69, 89,111,  4,214, 51,210,149,
+113,218, 49, 28, 46, 55, 81, 81,183,  6,149,179, 92,150,217, 16,101,251, 56,125,187,136,217, 69,174,183,110, 62,118,187,227,176,
+228, 74, 91, 86, 27,135,122, 56, 54,200,167,106,135,164,238, 54,163,162,223, 24, 95,221,250,255,219, 95, 55, 53,138, 39, 98,149,
+ 56,227,170, 24,243,164, 53,101,201,171,245,198, 59, 52,113,124,242,249,145,233,190,154, 86,252,237, 42,195, 27,251, 68,183,233,
+158,119,150,187, 98,203, 80,249, 45,139,165,218, 41,205,124,232,104, 35,107,227,213,221,204,253,241,132,182, 25, 81,160, 55, 84,
+ 42,189, 41, 33, 58, 84, 26, 11,129, 97, 16,186,119,196,188, 82,202,192, 40,141,238,102,230,146,172, 26, 92, 42,199,110, 16,170,
+158,103,156,159,240,211, 64,161,224, 51, 16,  7,234, 82,104,174,163,218,208,230,241,154,  9,107, 99, 29,  6,198, 62, 32,126, 33,
+116,177,107,142,138,255,194, 42,246, 86,153,170,221,148,149, 90,237,196,231,182, 55,120,188,163, 85,219,115, 54, 54,254,184,218,
+ 93, 21,113,168,239, 72,105,168,183,  7,180,219,192, 41,218,183,  7,231,150, 70,172,116,162,183, 94,184,217,225,196,240,164, 36,
+ 36, 70,122,181,230,120,240, 22,  2,234, 45, 51,196,173, 30,183,249,223,105,197,194,117,108,  0, 18,167,180, 77, 80,241, 86,175,
+138,120, 20,161,213, 76,197,225, 93,196,  7,165,245,186,161,101,197, 96, 53,210,113,173, 81,218,230,121,119,134,250, 43,219, 55,
+ 53,120,135,184, 95,237,242, 25, 38,198, 20, 24,157,141,146,233,113, 59,248, 41, 61,119, 59,228, 96,  0, 30,  4,252,246,  3,136,
+ 19, 92, 83,150,101, 54,104, 77, 80,164, 55, 11,241,181,198, 16, 35, 97, 84,  6,133,207,239, 28,183,179, 71, 98,193, 57,165,157,
+149,153,153,  1,143,119,  3,158,198,215,158,119,174,189,163,172, 43,189,  8,167,227,194, 47,239, 31,108,199,220,170, 29, 42, 54,
+192,140,106,163,139,160, 77, 72, 84,234,246,226, 14,222,210,166, 65, 60, 41,  4, 36,101, 78,111,206,212,214, 13,240,210,130,237,
+163,157,179,175,123, 85, 78,101,230,254, 60, 19, 83, 96,138, 39,118,201,147,246, 59,118, 23,123,244,254,150,255,244,167,159,112,
+253,252,154, 47, 63,127, 15, 15, 92, 94, 93,114, 17,  6,116, 81, 30,238,239,168,229,158,211,249, 68,117,137, 93,117,248,184, 64,
+247, 68,239,169, 88, 23, 94,176,218,228,228, 61,254, 48, 34,193, 19,218,196,253,120,102, 62, 46,204,243,108,136,225,110,  6,164,
+161,155,109,168,245,186,229, 59,108, 21,116,158,143, 28,239,  7, 98, 50,222,247, 93,190,165,139,242,217,231, 15,228,251,  2, 93,
+ 25,167,137,117, 49,249,202,156,149,207, 62,255,156,211,241, 68, 12,  1,196,211,189, 41,130, 99,116, 60,122,252,132, 55,175, 63,
+ 35, 97,  1,191,181, 47,168,138, 29, 66, 55, 23, 66,171,106,116,179, 32,236, 47, 15,132, 16,153,215,198, 92, 87,206,186,  9, 95,
+100,224,242,234,192,249, 60,155,130, 56, 67,239,133, 46,202,126, 55,241,252,241,123,164, 33, 25,130,185, 20,166, 52,209,134,136,
+ 22, 51, 35,218,109,169,163,181,241,144, 23, 11, 45,186, 70,165,178,156,239,248,188, 20,214, 58,240,252,241, 37,143,158, 62,231,
+250,197,151,249,224, 75, 95,230,238,230,150,243,178,192, 26,200, 26,104,117,221, 94,171,129,238, 27,108,161,197,251,155, 87,220,
+188,185,225,238,205,231,220,191, 89,112, 24,178,210,251,128, 22,199, 49,219,155,123,183, 19,162, 29,180,156,145,203,166,221,142,
+221,229, 21, 87,195,142,184,187, 36,140,  9,233,145,182, 86, 42,157,226,102,123,159,145,145, 89, 43,210, 96,  8,142,202,128,214,
+204,220, 22,246,225,138,224,  2, 69, 51,222,153,175, 58,196, 14,197,209, 78,157,234,155,121, 32,124,164,105,193,227, 40,120, 74,
+235,  8,129,164,133,178,120, 26,  1, 13,214,210,105,116,106, 95, 24,206,209,220,  7,237, 12,253,  2,159, 60,161, 22,155,252,172,
+  3,167,114, 66,189, 80,239,148, 93,112,172,209,161, 56, 90, 89, 25,187, 34,253,130,165,173, 60,114, 97,243, 82,168, 17, 52, 37,
+ 24, 14,219,  7, 36, 54,114,109,132,185, 19,211,128, 72,101,125,232,244,146, 24, 31, 79,204,210,104,109,133, 41,210,151, 96, 32,
+ 48,215, 24,123, 35, 76,  9,191,181,122,170,131,186,  8, 14,163,224,229, 10,163,128,239, 25,237,201,144,217,165,161,209,152, 16,
+130, 80,123,181,181,168, 70,210, 46,113,185, 31,121,235,227,250,127, 93, 76,229,239,249, 73,255,222, 63,255,187, 96,183, 49, 56,
+ 90,217,177,246,138, 47,202,227,171,137, 48,254,127,117,223,255,255,234,115,191,234,138,207,125,228,238, 77, 36, 31,239,  8, 20,
+158, 60,186, 38,238,118,166, 98,125,219,154,147,255,199,130,221, 16,199,  0,  0, 32,  0, 73, 68, 65, 84,229,250,173,237,180,255,
+ 10, 37, 99,195, 71,187,213,235,219, 84,250, 67,129,249, 72, 94, 86, 98,207, 76,215, 87,184,241,226, 11, 90,185, 29, 62,183,170,
+222,219, 21,171,179,183, 76,221,166,  2, 69,220, 23,  7,136,210,109,141, 89,187, 50,247,198, 10,136, 47,232,186,128,111,244,  2,
+218, 60,206, 69,218, 92,104,222, 96,100, 77, 45, 88, 58,200,192,122,232, 44,181, 35,179,114, 49,108, 12,135,251,  0,249,100,230,
+190, 30, 81,183, 18,188,167, 28,  3,181, 47,228,101,177,  3,114,  3,173,142,212, 34,218,  4, 21,143, 44, 51,115, 56, 19, 28,  4,
+193,217, 73, 76, 12,105,166,111, 37,224,221,146,233, 93,109, 55,142,218,136,201,119,168,197, 82,213,150, 44,223,  8, 70,  2,221,
+ 25, 49, 42, 57, 71,109,230,131,117,222,250,207,130, 71,163,218,199,236,197,146,232,218,232,205,255,138, 73,142, 65,106,192,210,
+203,  1, 16, 23, 44, 93, 42,130, 71, 54,189,163,245, 72, 69, 54,141,156, 15,244,178,162,106,110,120,173,186, 49,144, 13, 78,209,
+181,210,141, 61, 75,167,109,129,153,142,104,183,241, 58,250,197,106,193,137,167,168,  2, 30,109, 70,128,139,209,111,232, 89,181,
+ 83, 35, 14, 23,188,237,161,181,115,234,219,  9,175, 23, 66,115,102,231, 17, 33,120,219,151,212,237,160,164, 98,134,185,174,142,
+218, 11,119,167,147,177,243,  9, 84, 21,178, 87, 38, 47,236,101, 71,209, 19,183, 15, 11,199,179, 18,211,158,163,170, 61, 28,130,
+ 80,154,176,148,134,248,192, 62, 69,158,239,173,210,151,174, 34,210,  3, 31,253,248,115, 62,191, 93,241,193, 19,182, 19,116,119,
+ 91, 69,164, 89,136, 77, 20,106, 83, 74, 95,137,222, 35,120,106, 41,156,150,153,112,112,220,191, 57,241,234,238,196,218,236, 84,
+108,111,248,155,239,216, 57, 84,108,106,225,182,213,201,121,153, 89, 43,164,101,230,254,254,214,118,208, 93,249,244,238, 53, 63,
+253,217, 71, 92, 92,238,121,254,232, 25,239,191,255,140,105,186,  6,174,208,246,152,184,187,101,110, 25,157, 31,200, 39,195,144,
+246, 20,240, 58,144,130,163,105, 33,118,199,211, 23, 79,200,203, 61,159,125,126,131, 56,199,154, 27, 62,136,185,164, 53,211,180,
+ 90,218,216,217,  3,206, 91,231,193, 62,239,104,196,192,135,227,249,255,102,237,205,154, 44,203,206,243,188,103,125,107,216,251,
+ 76, 57, 84,117, 85,117, 85, 53,186,129, 38,  1, 16, 36, 77,130, 16, 41, 50, 72,219,180, 40,138, 54, 25,158, 34,228, 27, 95,248,
+191,224,215, 56,194,150, 29,161, 27, 57, 36,134, 45, 75,214, 64, 17, 33, 26, 48,  5,146, 24,137,110,116,163,187,170, 43, 43,231,
+115,246,176,134,207, 23,223,206,  2, 45,249, 14,153, 17, 29,209,209, 85,157,145,231,228, 62,107,125,195,251, 62, 47,219,221,218,
+206, 42, 17,174,174,175,249, 39,255,231, 55,120,250,246, 35,126,254,253,167,188,120,241, 25,125,183,179,233,138,115, 92,158, 95,
+ 45,249,192,230,191,104,197,138,180,155,155, 11,222,123,247, 61,166,225,192,126,127, 75,234, 60, 91, 61,194, 77,153,121, 30,104,
+165, 18, 82, 34,108, 58,130, 51, 43,166,171, 35, 63,254,244, 18,117,149,105, 26, 25, 39, 19, 98,110,215, 43,230,154, 23, 12,174,
+163,101,227,140,179, 18, 30, 62,120,128,239,226, 66,106, 44,203,228,199, 14, 48,135,241, 23,204,199, 42,168,159,216,207,141,174,
+ 11,140,211,140,139,214,217, 28,166,145,171, 23,123,166,147,198, 87,126,254,125,222,126,118,204, 39, 82,217, 56,161, 58, 79,214,
+ 70, 38, 83, 35,196, 92, 65, 42, 62, 57,174, 62,122,193,217,213,107, 62,123,245,  2,109,158,221,122,197,106,213, 83, 71,193,249,
+  6, 17,162,247,244, 18, 22,212, 67, 33,227,150,233, 82,160, 85,101,191,223, 51,149, 70, 75, 35,237,250,130,157,143,164,221,134,
+245,230,136, 62,110, 40, 45,163,209, 17,165, 80,230,  9, 69,232, 92, 32,  5,251, 92, 30,185, 53,193,  5,138, 43,232,104,156,120,
+212,242, 32,154,107, 52,  7, 33,219,214, 88,164,153, 31,191, 87,186,220, 56, 52,219,245, 23,223,232,124, 96,202,215, 68,  4,157,
+  3, 53,  5,132,129, 67, 72,203,202,172, 71,187, 70,222, 79,198,155,143,139,155,101,110, 72,241,148,170, 28,250, 70,152,102, 36,
+ 40, 83,113,200, 92, 40, 20, 86, 93,225,118, 86, 36,152,213, 54,184,192, 92,  6, 90,118,248,104, 90,151, 16, 43, 96,249, 24, 57,
+ 52,106,167,156,132, 30,245,129, 54, 21, 92,234,232, 18,204, 93,101,106, 70, 85, 27, 67,193,213,142, 20,237,243,238, 10,  4, 17,
+102,148, 94, 34,218, 76,212,232, 67,196,231, 10, 94,153,180,209,227, 80, 45,168,  4,155, 90,121,161, 15, 61,157,243,196,238,126,
+246,200,178,  0, 98, 66, 20, 66,184, 31,152, 77, 92,214,188, 56,232, 66,160,239,211,127, 88,112,240,255, 95,120,132,255,160, 76,
+248,255,254,  5,119,212,113, 93,102,230, 97,100,219, 39, 30, 61, 60,250,153,196,130,237,223,179,247,125,186, 63,225,236,195,159,
+ 48, 12, 35, 34,129,154, 42,126,176,198,130,232,  8, 69, 25,153, 41, 37, 16,139,114,200, 51,190,121, 91, 65,181,  0, 65, 40,101,
+164,184, 74,231,205,213,176,221,108, 57,180, 91, 19,138,135,145,113,190,198,215, 68,198,194,174,  4,101,110, 55, 56, 31,136, 25,
+115,104,185,200,205,124, 48,125,200, 93,132, 40,173, 44, 76,220,165,125,211,106, 42, 83,  5,223,  4,117,139, 69,189, 89,153,164,
+174,162,106, 96, 19,219,143,219,206,188,224,112, 18,151, 12,107,251, 94,246,237,236,226,118,106, 15,134, 79,193,178,153,151,145,
+123,173, 10, 18,150,160, 24,251,229,212,230, 44, 32, 37, 58,230,185,224,151,177,187, 43, 38,254, 42, 90,160, 21,226, 82,161,149,
+101,150,212,212,126,190,230,226, 79,105,121,206,232, 86,121,206,248, 96, 41,108,138, 46,246, 15,219,173,207,  4,130, 52,243, 28,
+ 87,219, 13,178,128, 72, 68,173,243,194,139, 13,228,115,225,144,  5,223,123, 60,130, 79, 44,126,232, 72,211,138,143,222, 84,239,
+173, 25, 36, 99,161,247,121, 49, 60,174, 11,110,177,227,129, 86, 33,170,103,133, 35,183,137,161, 84, 10,158,247, 78, 59,186,126,
+ 98,188,236,145,228, 41, 25, 84,122, 66,172, 56, 34, 39, 15,223,161, 11,  7,188,155, 72, 15,222,225,102,186,224,135, 63,249, 17,
+ 77, 34, 65,140, 20,232,146,188,129, 35, 84, 97, 89, 73,180, 55, 54,196,101,120,128,182,194, 48,217, 46,119,127, 24, 23,181,253,
+130,217, 21,131,213, 56, 39,139, 13,208, 70, 97, 93, 76, 60,122,120, 76,153, 51,115,179,196,183, 97, 60,216, 55, 12,158, 92,148,
+ 50, 93,115,179,191,225,245,217,  5,103,231,231,156,158,158,178, 91,111,216,118, 59, 54,235,200,195,221, 41,181, 60,167,180,202,
+217,103, 31, 50, 30,174,233, 52,163,120, 78, 30,191,205,131,117,199,103,103,159,113,118,113,110,194,198,154,161,101, 10,106,220,
+228, 90, 41,154, 81,103,161, 60,120, 49, 54,160, 26,210,216,123, 71,159, 58,131, 60,204, 19,219,205,154, 86,149, 24, 61,231,231,
+ 23,252,239,255,252,223,242,201,203, 47,240,189, 31,125,200,111,124,237,171,172,251, 13,235,237,154,253, 97, 52, 38,248, 82,240,
+169,154,125,238,230,122,224,242,213, 25,235,184,225,170,236,161, 41, 49, 68, 30,110,122,114, 61,129,234,136, 65,217,108,  2,211,
+ 84,  8, 81,216, 95, 28,184, 29,103,240,149, 92, 42, 67,153,241, 34, 84, 41,228,105, 38,121,143,119,158,214, 85,242,156, 57, 90,
+109,  8,253,198, 66,129,242,196, 60,143,196,184,177, 46,164,192,202, 69,230,154,153, 75,225,201,131, 21,204, 87, 36, 53,177, 27,
+201,132,163,181,154,163, 35,106,228,236,252,134,127,243,231,223,230,111, 51, 64, 92, 49,133, 64,157, 70,130,139, 68, 85, 34,202,
+205,112,201,235,159, 92,115,126,113,198,205,229, 45, 33, 57,158,191,243,148,231, 15,118,236, 15, 35,127,245,195,143,152,231,194,
+ 58, 70, 19,127,202,140, 75,230, 96, 80,  1, 81,127, 55,175,180,120, 83,146,129,155,221,140,148,192,156,122,118,169,226,252,129,
+ 16,143,104,115,197,141,153,218, 57,219, 29,139,105,214,197, 65,145, 13, 42,141,155,122, 32,138, 67, 87, 29, 76, 51, 85, 33, 22,
+161,118, 21,223,245,228, 67,  1,103,105,139, 73, 76, 85,236,  3,196, 22,240, 46,147,115, 71,107,  7,200, 70,148,172,171,130, 56,
+ 71,209, 64, 20,193,249,217,166, 35,251,138,143, 21, 79,199, 88,103,130, 58,154,139,180,  0,157,171, 28,246,142,173,  7,119, 59,
+ 49, 15, 21,191, 18, 52, 53, 46,175, 26,113,187, 99, 69,197,163, 76,170, 72,245,198, 67,111, 86, 86,170, 86, 90,107, 76,243,140,
+ 87,232,202,154,170,141, 54, 85, 54,235, 64, 11, 30, 38,129, 58,188,113,207,172, 90,160, 74,160,204, 66, 74,158,170,149,208,217,
+ 20,176, 58,179, 72,245,201,113,152,148, 46,  6,130, 40, 41,220, 77, 69,141,165,169,106, 90, 18,231, 13, 84, 34,247, 64, 81,171,
+ 10,181,154,117, 72,184, 95, 47,185,173, 81,177,152, 82,119,127,224, 25,  1,107, 34, 93,163,239,195,207,156,251, 46,255,222,191,
+ 71, 49, 77,150,171, 74,203,230,244,242,193,246,234,174, 52, 14,  8,218,122,164,101,116,231,200,147,112, 68,133,131,185, 74,134,
+131,  3, 53,220,182,246, 14,201,194, 65, 70, 74, 80,194,124, 96,110, 21,113, 29,147,102,194,202, 83, 10, 16, 19,181, 20,186,226,
+152, 37, 81,105,212,121, 38, 52,197, 63,121,250,236,235,134,129,181, 23,141,218,158, 27, 49,111,167, 46, 11,125, 19,191, 89,238,
+177,152,100,213,120,237,234,108,  7,224,204,246,209, 22, 44,172,247, 44, 10,243,  5, 54,211, 22,207,164,218,229,208,114,133,216,
+ 17,187, 68, 39, 38,148, 42,214, 35,225, 93, 64,226,178,211,  8,198,153, 23, 53,129, 90,245, 38,120,187,139,183, 19, 51,156,155,
+152,173, 86, 19, 85, 56,161, 45,169, 84, 90,203,162,180,182,101, 81, 91,254,252, 77,122,156,152,194,255, 78, 88, 69,116, 11,245,
+174, 81, 21,132,133, 90, 23,148, 20,197, 46, 53,111, 23,127,  8,182, 71,139, 78,237,  2, 23,111,147, 11,  3,188, 83,203,204,229,
+249, 45,213,121,188,218, 14,  9, 21, 36,129, 36, 59,196,125,112,104,182, 11,112,157,  2,226, 12, 86, 67,136,244,189,167, 11,102,
+219, 26,230,200, 44,142,160,145,121, 46,196, 20,121,248,248,125,222,254,220, 59,120,148,237, 73,207,241,211,175,242,209,199, 31,
+243,205,239,125, 68,232,210, 27, 31,191,199,118, 48,186, 40,247,171,253, 32,139,130,249,167, 97, 61, 13,168,115, 97,206, 11, 20,
+  8, 71,244,198, 46, 16,  2, 46,  6,179,203, 88,118, 33,136, 99,187, 59,161, 95, 84,170,187,205,154,174, 91,227, 83, 32,136,249,
+143,157, 55, 75,135,182,198,172,202,245,254,134,215,231,103, 28,198,137, 92, 14, 12,251, 11,110, 95,157, 67,203, 60,126,231, 25,
+ 63,255,222, 47, 16,125,207, 80,  6, 90,232,120,251,201,142,235,139,215,156,157, 93, 19,  3,104, 12,118,224, 54,135,119,145, 62,
+ 70, 86,125,207,106,179, 33, 69,123, 30,113, 66,171,213, 14,136, 16, 16,239,151,189,120,194,169,  5, 93,  4,111,185,  2, 49, 69,
+174,175,247,124,250,233, 25,169,235,120,241,241, 39,224,  3,199,167, 59,190,249,239,254,130,215,175,111,232, 99,  7, 40, 57,207,
+ 22,  1, 28, 60,227, 97,111,120,225,102,108,250, 82, 70,198,105, 64,156, 35, 37,161, 79, 66, 44,133, 66,102,204,153, 97, 56, 44,
+137,113,  6, 88,194, 53, 74, 51, 10, 98,205,149,  4,148, 60, 35, 49,210,247,107,182,155, 99,186,152,  8, 52, 90,206,198,149, 15,
+  1, 23, 28,182, 48,114,111,220, 33,184, 74,109,133, 24,123, 94, 95, 94, 34,101, 73, 57, 92, 58, 53,151,  4,231,133,235,235, 27,
+254,234,251, 63,230,236,245,107,222,126,248,152,228, 35, 55, 87,  7, 94,190,248,144,179, 79, 63,229, 71, 31,125,196,171, 87,151,
+148,170, 60,127,246,144, 95,251,197, 47,240,206,233,150, 15, 63,254,136,239,126,248, 25,195, 52,129, 42,115, 45,148,229,179, 53,
+ 87,203,114,112,213, 86, 56,170, 86, 44,182, 69,  9,190,222,118,156,156,246, 28,175,183, 28,109,183,116,210,216,238, 34,105, 19,
+216,108,143,112,197, 44, 94, 77,148,184, 22,166,105,178,238, 69, 10,  7,189, 69, 52, 64,169, 40, 19,155,184, 50, 72, 77, 84,226,
+162,151,  9,205, 82, 21,205,250,104, 69,193, 52,102,168, 74, 31, 86,203,179, 82, 45, 23, 34,172, 41, 89,  9,190,225, 90,132,105,
+ 68,106,135,215,229,220, 35,217, 14, 58, 87, 74, 49, 71,136, 56,208,210,232,212,172,172,153, 37,158, 57,120,156,143,244, 83, 96,
+ 28,  6,252,156,113,234,201,234, 65, 61,135,225,134, 50, 41,115, 30,  9,206, 81,171,195,175, 61,125,244,  4,241,212,162, 72, 84,
+ 66, 23, 40,211,132,168,199,135,  8, 94,233, 87,158,169, 25, 51,190, 79,102, 89,106, 94,168, 83,102,181, 56, 51, 28,149,110,201,
+192, 64,192,123, 75,173,116, 75,225,237,162,121,234, 85, 33,  6,207,233,241,150,211,135, 39, 63,243,133, 86, 20,166, 49, 83,115,
+ 33,  5,207,122,183,190,151,139,189, 52, 24, 15,179,229,168,119,129,126,125,127, 62,242, 49, 55,166,105,198,105,230,120,157,  8,
+253,134,251,252,186, 30, 42, 87,231,151,204,183, 87,248,101, 44,175,203, 93, 83, 81, 36,195,236, 50, 49,121,114,110,232,228, 77,
+ 52, 57, 21,  6,157,200,110,177,104,206, 16,252,204,212,178,173, 10, 74,197,205, 29,211,224,208,144, 80,205,144,157,117,255,206,
+195,152,153,242,  8, 93,196,187, 70,169, 19,154, 33,168, 54, 83,125,227,208,104,173,120,171, 38,234,174,170,168,136,141,169, 69,
+113, 69, 80, 87,237, 96,147, 69,204, 35, 14,135,183,249,137, 54,180,154,101,162,170,169, 68,109,199,104, 29, 33,109, 89,189, 47,
+241,171,  2,120,111, 98,138,208, 28,  5, 79,147,134,212, 74,157,179, 77, 16, 90,176,206, 27,155,253,182,106, 44, 93, 43,231, 27,
+234,236, 33,110,234,208,224,209,  2, 57,103,162, 65,171,241, 22, 19, 67,115,166,121,199,123,124, 83,114, 46,148, 98,197, 75,236,
+ 13,118,227,  8,184, 90, 76,225, 94,173, 43,247,190,161,206,252,206,230,155,175,184, 86,112, 98,216, 69,175,254, 77,206, 59,139,
+ 93,174, 58, 37, 38,143,159,172, 16,170, 57,219,165, 24, 60,193, 57,162, 23, 60, 17,175,222, 62, 37,222,132, 67,159, 92, 54, 98,
+172, 60,  8, 43,188,143,108,146, 99, 63, 85,210,241,154,247,156,227,187,231,133, 38,176,233, 19,109,181,227,241,207,255, 60,239,
+ 28,111, 56,123, 53,113, 49,123, 30, 14,183,124,240,193, 79,168,206,128, 47, 78,141, 40, 37,117,113, 53,136, 85,242,193, 65,209,
+133,  8,197,157, 48,209,217,229,191, 40,121, 21,  3,240, 84, 21, 66, 88,138,178,106,133, 21, 94, 17, 20, 31, 87,236,142, 54,180,
+172, 92,223,222,112,125,221, 88,175,214,144, 34,169,131, 77,232, 40,165,114, 27, 70,234, 60,147,107, 33,231,202, 88, 27, 31,125,
+250, 41,159,189,126,197,170, 79,116,169, 99, 55, 92,240,147,243, 23, 60, 57,121,196,147, 71,143,120,231,243, 95, 96,127,113,197,
+139, 31,159,115,123,115,107,176, 34, 49,123,149, 75, 17, 23, 87, 38, 27,139,182,235,247,115, 97,213, 39,166, 92,232,198,137, 62,
+  6,246,243,108, 30,242, 16,160, 53,154, 52,162,116,148, 90, 12, 36,211, 96,206, 25, 37,224,246,  3,221,122,197,237,205,192,163,
+167, 87, 92, 95,158,113,184, 57, 88, 36, 98,201, 84,205, 76,227, 68, 76,145, 72, 96,110,149,169, 77,156,156,236,184,188,184, 96,
+110,209,198,243, 58, 67,201,204,213,179,207, 38,214,171,213,224, 70, 77, 21,241,166,  6,102,161,158, 93,151,107, 19,154, 73,199,
+237, 60,178,242,240,248,248, 49,105,221, 91,197, 47,149, 58, 89, 49, 88, 42,184, 78,240,106,168, 98,213, 72, 76,142,243,215,103,
+156,110,215,236,203, 76,110, 74,  8,139,238,164, 54,180, 68, 68, 45,153,106, 82,101,152, 43,231, 87,151,124,240,193,247, 56, 28,
+ 42, 23, 87,151, 52,103, 98,210,105,110,236,182, 27,190,244, 11,207,136,204,124,244,193,199, 92, 92,238,121,121, 61, 88, 90, 25,
+222,206,  9,249,105,220,170,230,193, 44, 95, 33,145,114,227,120,123,204,195,  7, 71,188,245,228,132,211,183, 78, 57, 94, 11,167,
+ 39,  1,209, 21,235,221, 67,134,124,131,212, 76, 67, 41, 37,240,137, 63,230,252,118,166,148,153, 58,236, 41, 83, 67, 58, 91,199,
+249, 98, 18,110,151,122, 36, 15, 12,106,194, 68,135,144,169,148,154,105, 58,227, 75,165, 76,133,144, 54, 76,115, 35,215, 72,144,
+198,208, 50,219,245, 22,165,163, 14, 13, 29,110,  9,177, 67,179,113,210,145,104,164,188, 38,100, 50,132, 25, 66,162,148, 66,159,
+ 58, 66,131, 48,  5,246, 76, 22, 82, 84,102, 26,142, 24, 19,243,156,209,166,132, 46, 18,100,226,186, 57,210,205, 64, 90,  9,186,
+ 93, 35,190, 39,185,108,244,191, 60,224,216,208, 85, 15,193,206,163, 16,141, 94, 88,129,176,238,153,167, 70,239, 35,125, 19, 90,
+181,232, 77, 47,  1, 17,207, 60, 55, 92,104,  4,239,152,166, 76,242,158, 92,132,171, 97,102,219, 69,146,243, 38,234,245, 14,241,
+230,240,  1,211,114,121, 81,107,204,156,220, 79,228,170, 46,184,105, 42,209,246, 11,247, 23, 16,163, 86,156,164, 46,222,235,165,
+ 91,155, 93, 23,181,  0,238,126,153,239, 13,168, 99, 93,226,203, 11, 26, 27, 45,155,126, 42,  0,197, 59,202, 10,226,193, 81,166,
+153, 85,239,233,138,114,233,  2, 48, 17, 55,129, 80,149,210,102,138,143, 22,  2, 84, 20, 95,160,120,143,232, 64,113,133,173,236,
+152,  8,220,204, 55,156,198, 19, 82,131, 27,129,184,138,232, 52, 24,217, 83, 97,239, 45, 78,124,225,201, 53, 52,171, 65,102,212,
+ 42, 73,  3,181,216, 62,181, 45,157,246, 93,154,151,138,101, 38,123, 49, 94, 59,197, 17,163,169,186, 85, 45, 55, 61, 69, 19,168,
+149,106,  2, 11,165,209,130, 44,114, 74, 27, 13,163,166,130, 55,229,176,117,221,213,101,171,116,138,  9,103, 22,221, 56, 72,195,
+ 53, 37,168,103,110,186,  0, 95, 26,185, 86,139, 56,172,134,122,117, 78,236,239, 47,112,155,184,140, 79,171,243,248,232, 33, 79,
+116, 97, 65,247, 53,104,163,190,  9,158,168,234,152,151,201,194,178, 78, 69, 48, 29,129,151, 64,232,188,169,199,157, 35, 58, 79,
+113,139,185,127, 49,238, 55,103,150,192,218,204, 23, 26, 68, 64, 43,226,  3,155,126,101,151,105,173,168,216,216,221, 45,146,211,
+224,148,221,166,113,122,186, 98, 45,189, 93,160,181,240, 96, 29, 56,159, 60, 87, 83, 67, 88, 35, 82, 41,174,178, 58,121,139,119,
+ 30,158,178, 81,199,176,125,132,122,207,  7, 63,248, 51,254,242,227, 51,230,106, 43,147,182, 64, 49,170,128,139,  1,159, 33, 59,
+139, 82,245,139,146,212,189, 73,104,131, 24,211,  2, 78,177,149,132,186,187,103,192,186, 67,212, 52,  7,118,233,195,102,181, 97,
+229, 61,251,105, 32, 23,243,197,223, 14, 35,222, 59,210, 42, 66,183,193,187,136,247,158,245,209,206, 20,155,218,112,185,113, 59,
+ 76,248,232, 57,140,  3, 55, 55, 35,251, 97,160, 11, 23, 92,190, 60,103,156,246,124,241, 43,191,196, 23, 62,255,140,163, 77,207,
+119,191,159, 41,211,  5,185, 10,130,176,242,193, 56,216,157,205, 16,198,113,134, 96,126,112, 81, 79,222,  8,235,245,138,157, 51,
+218, 90, 46, 10, 58,211,199, 68,223,111,200,173, 50,206,135, 55,162,205,170,  3,243, 52,112,216,239,105, 14,254,229,191,186,229,
+ 91,223,252, 43, 14,251,129,224, 26,181,218,132,202, 57,115,133,104,  0, 95,  2, 77, 34, 15, 79,159,112,123,189, 71,130, 71,188,
+101, 32,223, 78,213, 88,231, 49,161,101,166,185, 98,244, 55,160,228,201,178,  0,100,185,228,213,241,229,247, 30,243,254,123,207,
+248,167,255,250,219,168, 38,118, 71, 15,  1,227,220,207,195,213,114, 40,  5,164, 15,134, 58,173, 21,175,102,157,140, 93, 69, 52,
+115,123,115,201, 92, 26, 33,120, 27, 43, 47,192,235, 90, 10,138, 50,206, 35,115,171,180,170, 76,147,231,242,242,156, 50,  7, 42,
+ 74,157, 43, 42,202,118,211,241,235,191,252, 14,167,199, 27,254,228, 91,223,227,227,143,207,140,239,189,132, 53,197,208, 83,235,
+158,150, 27, 26,163, 29,192, 49, 25, 93,206,  7,126,241, 75, 79,249,234,175,253, 10, 79,158,157,144,135, 27,110, 46, 71,246, 23,
+  7,126,248,226, 83,252, 74,120,112,114, 69, 72,129, 50,192,163,199,199,188,245,228, 45,158, 61,223,242,237, 15, 95,242,227,191,
+254,132,149,246,248, 53,212, 58,226,196, 19,220,154, 42, 25, 87, 27,206,109, 32,103, 70,  7, 41,  8, 94, 51,145, 64, 21, 71,201,
+ 35,194,138,164, 48, 37,135,111,130, 27,101, 81, 88, 11,190,205,166,160, 15, 17,137, 19,234, 86,228, 58,146, 86, 30, 81,207, 48,
+ 40,201,117,  4, 61,216,180, 68,123,152, 43, 69, 28,202, 68,136,141,105,158,168, 89,145, 46,225, 75, 65,250, 68,149,202,156,111,
+ 72, 81, 72,109,131,214,204, 60, 92, 83, 93, 69, 10, 12,126, 89, 75,248, 21,201, 57,134,201, 52, 72, 93, 20, 52,219,216,125, 46,
+131, 17, 33,125, 64,212, 52, 37,205,  5,162, 64,163, 50,213,138, 23,207, 60,103,186,232, 44, 14,218, 43, 14, 79,  7,228,214,112,
+190,154,143,190, 41,174,101,154,139,230, 54,234, 32, 73, 64,130, 16,188,191,167, 11, 82,151,204,115,131, 48,221,219,229,168, 44,
+171, 80, 91, 79,222,231,151,195,166, 45,226,116,137,158,189,231,200,213,165, 96,143,  2,115,174,120,245, 76,101,134,154,161,120,
+170,218,186, 85, 82,199, 52, 84,164, 22,202, 56,194, 52,211,185, 13, 61,202,109,173, 56,191, 36,151,198,133,138, 57,205,104, 85,
+ 18,158,121,186,164, 21,207, 58, 30, 49, 13,133, 91, 49,225,104, 95, 29, 55,165, 50,148,194,138, 74,106, 16,154,191, 19,186,121,
+104,197,108,172,152,143, 78, 23,122, 81,115, 98,104, 65, 91,126,219,222,170,122, 66,116,214, 13, 44,151,211,156,109,143, 83, 40,
+ 56, 85,230,220,222,120,218,231, 86,150, 48, 13,187,162, 21,103,213,110,109,120, 26,165, 85, 66,232,112,  5,170,175, 84,181,238,
+ 50, 23, 19,118,165, 36,120,  2, 65, 43, 77, 26,190, 42,197, 53,235,208,171, 90, 88,129, 83,180, 44, 97, 20,186,168, 65, 69,153,
+140,117, 97, 92,251,162,128, 89,219,156,170, 81,237, 80, 90,205, 86,116,136, 61,176,158,176,240,233,151,173,187,183,203,183,169,
+141, 76, 17,207,220,204, 21, 47, 81,222, 68,180, 74, 53,111, 98,234, 60,227,236,169,148, 55,170,243,185,100, 82,  8,230,201,149,
+138,239, 60,222, 89,230,249,172,153, 58, 53,116,142,148,126, 73,138,242,209, 86, 18, 78,121,188, 85,114, 29, 24,243,138,121,243,
+140,119,158,253,  2,121,156,184,240, 80,105,124,114,241, 19,190,255,111,191,199,217,229,158,234, 12, 47,233, 37, 66,131,202,108,
+157,182,182,197, 26, 34, 38,110,  2,196,119,136, 83, 74,153, 44,133,202,155, 75,216,105, 91,148,167,141,230,188, 29,138, 98,252,
+226, 86,148,245,118,195, 59,207,223,198,229,202,229,124,133, 54,136,189, 21, 55,115,105,204, 99,230,236,112, 65, 83,136,189,167,
+ 15,145,224, 59,188,143, 56, 17,182,199, 61,155, 46,114,126,  5,195, 52,161, 69,185,157, 39,110,135,129,195,119, 14,196,245,134,
+163, 47,190,143,171,215, 60,124,180,101,184, 84,246,243,100,  5, 35,144,117, 38,185,128,107,141,152, 60, 46,  7,188, 86,220,202,
+ 49,205,166, 10, 95,121,161, 59, 58, 97,106, 51, 45,119, 56,173,168,100,166, 97,128, 98, 66,159, 41, 23,106, 54,132,176,111, 14,
+  9,129,233, 48,113,126,126, 69, 76,  1,137,222,242,230,235, 76,109,217, 58, 61, 93,138,221,185,178,217, 70,  8, 66,158, 71,180,
+ 40,121, 44,100,173,228,146,241, 57,155,254,196,217,172,170,152, 16,  5, 45,224,131,210,188,137,205,126,253, 87,191,196,215,126,
+243,107,244, 39, 15,248,179,111,124,128,225, 88, 42,117,184, 94,  8,132,145, 58, 22,116,154,240, 78,237,185, 40,138,116,149, 54,
+238,241, 49,112,152, 71, 14,183,215,236,142,143,217,244, 29,251,195,108,220,114,173,212, 41, 27, 31, 98,177,133, 70, 21,162,247,
+116,125,224,250,102,196,121, 79,192,115,186, 61,230,242,242,130, 63,249,179,239, 48,102,216, 28,109, 97,110,236,167,137,172, 35,
+ 45, 23,130,128, 11, 29, 74, 37,132,100, 48, 30, 15,191,240,149,231,252,225,223,251, 61,142, 31,110,249,246,183,254, 29, 63,248,
+238,  7,116, 18, 57,126,120,194,230,193, 17,199, 61,188,252,236, 53,125,183,197,249, 45, 77,123, 74, 81,222,126, 24,249,157, 95,
+121, 31,  7,124,244,131, 15,137,  8,177,243,116, 46, 48,123,101,206,130, 22, 65,251, 74,205, 19, 65,163,233, 74,162,179,105, 89,
+174, 52, 13,172,214,209,248, 23,135,140, 75, 29,108, 59,250, 62,210, 24,109, 87, 43,141, 66, 32,141,222,  2,131, 18,248,232,240,
+ 67,164,151,204, 20, 70,180,116,166,176,247,197, 46,130, 59, 92,244,146, 73, 81, 42,172,197, 10,235,208, 43,179,  6,110,134, 61,
+ 15,195,154,162, 25,215,103, 91,241,101,211,160,172,251, 74, 41,  1,218,140,118,137, 41,155,186,190,115,142, 97,114, 20, 17,170,
+122,210, 42, 88,147, 81,102,178, 11,196, 85, 96,213, 42,135,  9, 92, 15, 58,155,120, 89,188,176, 10,194,156, 29,157, 87, 90,138,
+232, 92, 17, 21,178, 86,130,118,214,241,150,106,100, 59,111,207,170, 87, 71,119, 79,116,182, 59,203,152, 83,119, 95, 77,250, 79,
+ 47,223, 37,152,226, 62,139,133,187, 49, 64,171,205,166,173,254,126, 35, 87, 45,220,166, 64,169,  8,145,192,130,182,118, 30, 58,
+104, 67, 97,154, 11,178, 50,148,175,182,204,109,169,102,213, 77, 29,171, 36, 92, 79, 35, 84, 33,201,138,129,137, 86, 51,161,131,
+113, 24,108, 85,163,102,251,117,169, 34,226,216, 15, 19,161,192,202,  7,203, 73,  8,  3,173,122,106,236,144,195, 68,  8,142, 55,
+185,218,130, 51, 97,142,218,120,205,251,100,109,170,187, 27,209, 26,165, 75, 22, 21,124,101,233,110,155, 89,189, 12,202,230,104,
+214,214, 47, 86, 46, 71, 39,158,236,212, 46,  6,215,222,100,171,155, 21, 77,153,171,226, 99, 52, 88,140,  7,231, 34,174, 53, 59,
+ 80, 81, 19,185, 52,  8, 30,114,109,212,187,209, 70, 53, 70,184,143,166, 48, 22,156,137,218,196,225,130,123,  3, 49,152,179,237,
+230,163, 55, 54, 53,106,129, 45,181, 53,138, 19,162, 19,124,240,118,129, 46,251,218,130, 69,219, 33,142,148, 28, 26, 34,178,116,
+217, 52, 71,191,235,172,255,175,131,177,205,155, 89,254, 16,197,171,160,179, 41,247,189, 64,110,  5, 87,108,226, 80,231,140,138,
+ 99, 37, 30,109,133, 66, 36,  6, 79,205,149,171, 49,210, 66,160,139,138,230, 74,  8,107,166, 82,121,212, 57, 98,116, 68,157,121,
+113, 61, 81, 30, 63,231, 97,111,241,180,193, 67,155, 50,175, 63,252,  1,159, 92, 13,168,247, 72, 45,184,234, 12, 66,224,188,177,
+232,155, 82,181, 46,180,168,133,123,239,188,105, 11,188,208,212,222,143, 59, 14,127, 83,197,137, 17,  2,205, 95,122, 55,144, 48,
+ 54,251, 23,159, 62,225, 97,128,151,251,153,212,117, 28, 29,173, 65, 28,251,219,  1,169,109, 17, 59, 46,112,136,162, 76,181, 48,
+104, 54, 49,149, 84,186,174,135,118, 68, 92,128, 60,111,192, 50,185, 49,238,  7,254,244, 79,190,193,249,139,151, 28, 61, 88,177,
+ 94,173, 45,153,236,228,  9, 14,139,208, 28,134,  3,109, 95,241,157, 51,176, 77, 12,104,141,244,161, 26,196,  1,168,181, 17, 68,
+137,178, 66,178, 67,253, 68, 31, 18,239, 63,127,198,229,205,  5, 47, 47, 14,  6, 79, 26,103,178, 43,168,183,221,108, 45, 21,  9,
+145, 60,100, 66,169, 36,239, 25,242,204, 84, 42, 41,121, 24,103, 36,  6,102,157,185,188,189,181, 32, 25,169,166, 74, 21,199,124,
+152, 23,175,111,181,125,179,247,244, 93,160, 14,153,130, 97,123,  5,163, 29,142,213,113,121,117, 77, 31, 60,239, 61,125,202,135,
+143,174,105, 89,152,231,186,  8,146,  2, 65, 13,199, 90,102,165,239, 77,164,150, 85, 57, 74,142,235,171, 66,223,239,120,239,217,
+ 19,190,243,253, 31,112,115, 51,224,212, 51,213,106,164, 69, 76,169,220, 44,209,130,224,  3, 93, 23,152, 10,204,121, 38, 74,196,
+139,231,104,227,241,177,241,221, 31, 93, 50,150, 70,209,204,126, 63, 16, 99, 71,232, 19,137,  8,181, 48,150,138, 83,163,174,133,
+ 20,217,244,194,175,254,210,151,248,189,191,251,155,228,105,228,159,253,147, 63,229,236,166,178,219, 29,241,252,201,150, 93,127,
+ 68,117, 19,105,  3,167, 21,122,231,233, 78,182, 75,138,156,231,226,106,230,120,237,248,149, 47, 63,199,205, 55,188,120,113,101,
+171,163, 90,240,162,134,205,244, 66,145,153, 85,232,160,121,230,114,160,148, 14,124,102,170,  3,136,209, 35, 27,224, 98,162, 18,
+ 16,167,248, 90,193, 71, 42, 30,199,  0, 90,168, 18, 13,152,147, 61,174,122,154, 87,198, 54,225,231, 21,141,140,107, 66, 90, 89,
+134, 64,174,197,214,135, 62,208,239,  2,237, 66, 13,124, 21, 26,101, 72,244,100,124, 88, 49, 86,  7,109, 52,141, 67, 21, 82, 44,
+ 12,192, 48,172,241, 73,208,186,103, 53,247, 12,211, 45,185,121,198,117, 66,251, 25, 52,145,154,210,166,145,155, 17, 98,223,225,
+ 61,184, 92,200, 64,234,237,231, 64,148,117,215,225,176, 78, 94,196, 33,234,169, 82, 73,209, 81,145,  5,246,102,154,156,232,132,
+ 90, 29,174, 54, 20, 27,145,167,251,234, 80, 23, 92, 55, 94, 23, 28,239, 61,117,188,165,209,234,157, 11, 73,238,119, 60, 94,237,
+110,242,122,207,201,108,119, 98,185,  5,255, 93,235, 72,115, 86,196, 75, 19,114,179,103, 50,137,163, 12,141,146,103,124, 52,144,
+218,198,219,154,103, 95,102,220, 38, 18,198,196, 52, 10,169,101, 14,100,  8,129,109,216, 49,165,128,155, 46, 73, 53,209,170, 80,
+ 36, 19, 83,194, 15,153,177, 78, 22, 42,166,129, 70,182,176,152,216,225,223,126,250,236,235, 14,140,233,238,173, 42, 53,106,154,
+ 51,189,190,187,  3,205, 52,164, 45, 73, 95, 75,200,138, 10, 70, 48,105,149, 24,109,183,189,112, 95,  9,222,  8,112, 34,150,190,
+229,131, 51, 47,183, 91,248,235,222, 70,169, 18,173,106,  8, 78,  8,170,111,222,136,224,108,231, 89,139,177,139,157,119,139, 77,
+205, 20,247, 34,166,180, 21, 49, 32, 64,203,133,156, 27,213,  9, 94, 77,232, 38,193,118,128,238, 14,  2,163,152,135,190,217,158,
+169, 57,123, 48,157, 15,102,106, 91,198,237,141,165, 26, 93,196,157, 33,  5,212,219,107,239,130,224,119, 27, 78,223,122,194,211,
+  7, 27,170,206, 28, 38,197, 59, 33, 70,135,  6, 69,189,137,208,146,143,212,105,224,242,250,176,224,116, 77,147, 32, 78,  8, 18,
+105,205,227,220,140, 23,135,215,196, 91, 15,  2,239,237, 34, 62, 59,182, 33,208,197,200,190, 22,196,  9, 71,199, 59,142,182,130,
+223, 62,167, 59,125, 78,191,234,161,206,212, 90,233, 87,149, 31,126,255, 47,184,184, 25,168, 53, 91,161,133,237,208,154,171,139,
+189,208,186, 81, 19,  0,234,146,237, 30,173,114, 21, 27, 45,163,134,164, 12,209, 47, 81,151,250,198, 24, 34,138,161, 40,213,241,
+224,248,  1, 95,254,210, 59,124,239, 71, 47, 25,125,226,193,233, 17,155,221,154,163, 24,185,185,189, 53, 56,132,247,168, 24,110,
+216, 57, 79,173,246,126, 54,173,212,101, 31,122, 24, 14, 54,173, 89,176,194,193,  7, 66, 12,246,126,151,202,171,243,215, 92,239,
+  7,130, 58,118,187, 13, 69, 43,228,137,205,238,152,227,213, 17, 93,191,197,165,134,107,  1,245,  5, 95, 45,215,188, 97,  5, 92,
+ 72, 29, 93,103, 69,203,201, 58,242,251,127,247,215,249,175,255,219,223,229,191,255, 31,254,144, 71,167,199,124,243,155, 31, 89,
+ 38,181,154, 23,223, 86, 43,  6,172, 16,105,204,211,204, 60,102,180, 86,134,113,194,185,196,106,181,165,232,184,116,223,142,  7,
+155, 13,227,205, 64, 46,149, 70,161, 58, 40,106, 62,110,154, 77,146,124,176,137, 75, 93,204,175, 41, 69,180, 42,181,152,231,181,
+235, 60,173, 20,190,245,173, 79,152,114,166,214,129,156, 39, 66,151,222,172,123,116,110, 54, 98, 21,161,228,198,102,179, 97, 46,
+153,139,171, 43,182,169,231, 23,127,238,109,158,189,125,196, 95,127,252,138, 97, 28,137,222,180, 17,181, 84,106, 51, 48,137,115,
+142, 24, 61, 62,  4,230, 81, 23,237,140,225,120,215, 93,228,197,103, 47,152, 38, 11,244,  9, 41, 34, 42,148,214,168,115,161,149,
+138,139,130,248,142,224,133,110,215,241,248,104,197,223,249,237,175,242,187,191,251, 31,243,250,252, 21,255,219, 63,254,167, 92,
+190,158,248,220,243, 83,250,157,163,148,194,166,179,136,201,152, 58,118,199,107, 20,229,228,228, 33,235,237,154, 58,143,156,110,
+183,196, 24, 57,233,  3, 49,246,236, 95, 95,227,170, 50,119,130,243,142, 36,107, 83, 18,171,173,196,166,106,216,205, 80,204,221,
+224, 83,194, 21,229,118, 24, 41,197,178,203, 81,208,156,241, 93, 96,229, 59,218,236, 64,103, 35, 23,118,110,225, 81,116, 84,201,
+212, 84,240, 13, 86,222,104,134,123,157,168,  8,157, 86,124,234,  9,234,208, 16,112, 19,  4,157, 25,199,137, 38,138,235,  2,146,
+ 59,130,183,137, 37, 21,180, 20, 92, 51, 12,168,  0, 38,171,220,227,123,165,141, 80, 52,160, 83,165,249, 64,174,138,180, 10,131,
+149, 28,210, 21,106,179,207, 93,232,197,  4, 79,206,224, 83,222,123,155, 36,197, 37,155, 67,195,162,136,214,101,178,166,  8, 30,
+ 73, 75, 99,161,166, 21,114, 13, 82, 72,116,235,192,163, 71,167,248,248,179,167,147, 77,185,145,199,  9, 90, 97,183, 91,155, 94,
+229, 30,190,166,172,228,105, 70,156,178,217,116, 63,115,232,204,223, 84,235,143, 99, 33, 79, 19, 65,148,205,110,125,111,223,251,
+ 14,109,123,125,117,224,246,250,146, 86, 14,214, 16, 85,168,205,206,219,234,109,173, 48,222, 86, 90, 15,121,112,136,142,180, 38,
+ 72,157,136, 85, 81,215,152,154, 67,167,106, 13, 66,169,120, 21,124,218,130, 42,121, 63, 46, 80,184, 76,168,137, 74,225, 48,238,
+105, 65,105,243, 76, 25, 10, 42,208,199,158,105,170,248,167, 79,222,254,186,115,118,145, 25, 55,221,198, 21,162,206, 84,235,206,
+240,173,106, 64,157,133,195,108,177,144, 44, 98, 42,179,196,201,130,115, 52, 72,203,157,177, 63, 58, 27,133,150,170,198, 74,110,
+150, 32,164, 45,224,157,101,153,235,221, 72,222, 41, 26,  2,209,233,226, 13,118, 22,163,232,108,119, 90,212,153, 29, 75, 76,117,
+ 78,179,177, 71, 89, 86,  0,212,187,116,162,  5,148,211, 20,103,115,103, 84, 34, 62, 46,123,239,106,213,110,215, 45, 44,123,113,
+148, 50,191, 33, 11, 58, 17, 36,  5,146,115,166,154,119, 98,126,251, 78, 76,116,214, 28,169, 19, 98,203,236,231,137,156, 27,157,
+ 88,254, 55, 85,241,193,155,154, 23, 79,183, 74, 92, 94,223, 48, 78,101,201,122,247,164, 16,105, 45, 27,250,214,  9,121,110,244,
+171,200,111,188,127,204,201,  6, 38,231,145, 46,162, 94, 88,237, 86, 28,157, 28, 17, 31, 29,179, 73,167, 20,125,202,217,193,246,
+178,170,145,227, 39,143, 25, 95,252, 53,127,245,189,191,100,127,152, 41,117, 38,197, 72, 12, 22,241,149, 91,166,148,138, 22, 19,
+108,153, 27,209,153,138,221, 47, 65, 23, 75, 28,107, 10,194, 58,245,244,169,  3, 15, 37,155, 24,168,181,138,120, 89,  4, 56,194,
+207,189,255, 57,118,219, 19,110, 90,199,233,131,167,108,163,176,221,236,152,166, 27,174,110, 15,148,188, 56, 38, 22, 46,182, 91,
+118,248, 54, 94,179,223,211,162,226, 48,173,  3,141,214, 10, 57, 23,106,105,196,224,217,172, 58,170,107, 76,135,204,249,229, 13,
+183,183,123,188,175, 36, 31,140,  9,158, 64, 66,192,197, 21,171,221,177,141,149, 17, 52, 21, 26,149,232, 61, 43, 31,136,206,209,
+111, 35,127,240,  7,191,197,127,243,223,253,231,244, 50,243,234,229, 25,175, 94, 94,243,227,159,188,226,242,102, 64,213,138,157,
+128, 95,240,185,166,156,111,  8, 83,182, 75, 49,136,163, 91,155,  0,173,243, 70,233,243, 93, 98,219,111,185, 60,220,144,250,192,
+ 48,218,122, 71, 91,177, 17,172,243,244,235, 64,110, 70, 70,147,104,  2,201, 78, 60,199,235, 21,191,249,159,252, 42,222, 71, 46,
+ 94,237, 41, 28, 51, 76, 38, 84,237,154, 37,254, 65,196, 87,165,102,168,226,144,100,122, 20,113,208,175, 28,175,206, 47, 65,173,
+219,175, 36,190,246,181, 95, 96,187, 89,243,189, 31,125,132,195, 19,197,226,124,181,149, 55,128,141,174,235, 72,253,134,218,148,
+ 85,138, 52,231,121,251,209, 26,213,202,203,179, 27,106,177, 66,177,182,106,207,231,178, 51,103, 41, 12,162,115,116, 93,  7,234,
+248,234, 87, 62,207, 31,252,193,239,242,217,249, 25,255,242,159,125,147,119, 31,158,240,238,243,135,108,142, 59,118,167,107,252,
+228, 88,157, 30,179,217,  5, 98, 60, 37,244, 39,180,114,192,149,202, 47,125,229,125,158,127,254, 57,199,111,173,121,240,100,203,
+230, 36,113,188, 78, 12,115,229,118, 26,172,168,200,145,162,149,185, 90,176, 77, 51, 74,146,233,103,186, 70, 47,102,  3,189, 29,
+243,178, 30,108,184,184, 50,212,106,159, 72, 41, 82,115,161,  6, 11,162,145, 26,193,173,105, 78, 23, 52,244, 68,153, 43,125,234,
+169,193, 33, 98, 78,134,230,140,239, 80,230,140, 23,103,200,236, 58, 83, 99,177, 24, 84, 39,196, 46, 16,134, 17,197,236,  0,  0,
+ 32,  0, 73, 68, 65, 84,177,244, 65,231,215, 56,215,144, 60, 91,122,165,138,137,215,230,145, 20,183,148, 16, 24,111, 43, 21,193,
+ 73, 33,248,100,  4,211,  2,211, 92,109,117,224, 61,125, 72,168,111,248,166, 56,177,  9, 91, 16,155,161,214,102,107,151,138,  5,
+ 47,  5,111, 22, 89, 39, 16,212, 47,157,179,117,165,150, 68,105, 35, 96,137,129,190,235,121,235,173,135, 63,243,232, 89,129, 49,
+ 43,243, 56, 33, 52,182,247,120, 65, 78,165, 81,166,137,232,149,213,186,127,163,245,249,153, 59,117,103,220,247,121,158,232,189,
+178, 57,218,112,159,123,131, 67,133,203,203, 91,134,155,107,164,218, 14,188, 57, 99,102,200, 34, 12,247, 10,222, 87, 19, 33, 35,
+120,231, 41, 35,204,237,  0, 14,118,101, 77,246, 10,186, 55, 61, 86,231, 33,  5,234, 80,200,254, 96,103, 94,114,212,178,103,104,
+ 13, 52,208,173, 18,213, 91,154,163,119, 14, 77, 11,136,103,  4,255,228,237,183,191, 46,226, 12, 37,234, 22, 53,244, 29, 59,215,
+217, 37,239,229,110,236,242,134,154,103,  2, 48,  4,  9, 66,242,222,210,177, 22, 31,184, 46,129, 29,222,185, 69,176,115, 71,108,
+147, 69,156,101, 85,100,211, 98, 89,201,206, 33, 65,105,  8, 77,151, 64,132,165, 11,215, 86,172, 96,168,102,123, 83, 81,100,185,
+160, 74,177, 61,161,199, 81,221,242,132,211,  8,226, 44,113,205,140,225,127,131,205,108, 99,109,241,126,201, 72,  7, 87, 29, 46,
+  6,148,130, 44,194, 50, 42,  4,117, 80,141, 38, 39,152,162,212,167, 96,120,219, 90,152,198,145,121, 46,224,204,226,165,193,147,
+235,132,168,189,230, 50, 55, 98,140,116,171,132,104,225,230,234,118,137,145, 21,219,219,123,155, 80,244, 93, 68, 66,228,189,199,
+ 27,222, 57,134, 57,219,165, 65,244,172,195,134,  7, 15,142, 89,159, 60, 71,  4, 66,191,101,168,141,243,146,144, 41,211, 29, 63,
+229,217, 91,137,111,253,233,191,224, 39,159,125,102,194, 63, 93,228, 38,226,105,165, 90,184, 73,157, 40,205, 46,216,  5, 31, 99,
+ 49,145,226,173,235, 17,219, 37,187, 86,153,243,200, 60, 79,148, 82,150,137,130,137,125, 88, 44,131,221,106,203,207, 61,123,135,
+243,155, 27,170, 36,222,125,250,136,113,190,225,209,110,197,213,120,195,245,254,134, 41,103,179,218, 40,139,229,198,225,  1,117,
+230,253,183,159, 79,240,193, 45, 75, 31,187,112,204, 30, 86, 44, 88,  5,165,239, 59,214,157,217,178, 14,195,129,179,243,115,206,
+247, 55,236,247,  7,186,149,152,224,100, 58, 32,165,176, 94, 31,177,121,248,136,144, 60, 34,129,150, 77,215,241,224,209, 49,255,
+213, 31,253, 14,191,247, 71,191,207,167, 63,248, 49,255,227,255,244,199,252,195,127,244, 13,126,251,183,191,202,205,197,107,126,
+244,241,185,141,180, 75, 53,203, 24,194, 60,141, 76,185,145, 86,137, 86, 45, 88,165,235,215,244,235, 21,218,108, 36, 43, 78, 88,
+245, 61,243, 60, 51,206,  3, 41,  5,202,178,155,159,231,193, 66, 63,186, 13, 41, 36,112,178,160, 37, 51,165, 20,104,194,233,233,
+150,191,255,247,255, 30,143, 30,108,249,209,167, 23, 60, 60, 89,196,113,205,  4,137,120,103,123,218,  8,101,178, 20, 61, 23,160,
+213, 70,223,  5,188, 40,175, 46, 47, 73,105, 67,140,107,106, 17,142,118, 61, 95,124,255,148,156, 27, 31,127,248,234, 13,226,184,
+ 53,179,157,249, 24,233,250,141,233, 40,194,114, 89,212,204,254,246,154,139,171, 61, 94, 34, 49, 26,162,180,214, 66,205, 25,106,
+ 70,156, 32,201, 17, 98,111,227,120,239,249,242,151,223,229, 15,255,232,247,121,241,233,103,252,131,255,229, 31,227,188,240,185,
+119,142,120,246,206, 49,187,  7, 15,216,236, 86,164, 20,104,251,129,227,211, 83,182, 71,143,233,189,231,104,179,102,159,111,168,
+185,240,228,217, 49,113,183,  2,191,  1,191, 35,109, 55,236, 86,158,235,155,  3,215,151,151,  4,223, 81,243, 76,105, 35,226, 28,
+193,  5,170,102,188, 52, 50, 66,157, 29,163, 10,173,141, 52, 89, 52, 59, 62, 81, 66,193, 17,233,186, 21,109,121,182,125, 93,120,
+228,154,241,193, 34,156, 87, 81,112,165, 71, 37, 18,155,163,197, 14,137,213,172, 68,205,209, 98,192, 55,199,100,163, 67,180,139,
+136, 56,146, 68,188, 38,102,157,161, 41,157, 40,189,243,148,154,153, 41,168,118, 38,252, 76, 61,165, 86,234,184, 64,149,164,146,
+220,140,119, 48, 11,184,185, 24,126, 56,  4, 74,137,196, 16,108,106,144,130, 37, 94,  6, 53,184, 12, 66,139, 54, 57,147, 59,  1,
+183, 54,106,116,198,206,103, 17,  6, 55,227, 98,120,117,  4,233,204,249, 18,  3,219,213,138,135,111,157,218,101,255,179,218,195,
+  6,  3,  5,121,133,237,118,  5,247,240, 61, 21,139,252,205,227, 72, 16, 88,109,214,247,230,127,175, 10,211, 88,168,121,100, 21,
+133,126,187,185,151,240,153, 55,197, 72,131,171,243, 61, 55, 87,231,180, 50,162, 78,201,217, 46,246, 38, 22,255,157,  5,102,167,
+140,115,163, 28,102, 60, 66, 90, 48,198,172,214,204,216,154,175,180,142,153,  6,174,144,179,157,217,222,123,250, 44,204, 57, 80,
+166,145, 16,  3, 34, 27,106,222, 19,139,210,107, 48,161,245,110, 69,190, 29, 25,199,137,  0,214,121,222,113,111,165, 90, 78,184,
+211,191,233, 95,182,203,248, 77,210, 88,178,170, 88, 22,114, 73,118, 16,131,141, 20,141,187,187, 48,211,219,226,245, 22, 49, 53,
+103,179, 35, 92,113, 84,183,164,  1,185,128,138,129, 50,156,154,176,167, 52,111, 29,157, 55, 33,151,191,187,135,150,116,168,234,
+194, 66, 52, 82, 84,195, 50,246, 50, 46,188,121,232, 27,115, 81,251,111,  2, 82,161,181,121,201,107, 55,208, 78, 19,179,193, 37,
+ 67,228, 17,156,208,170,253,185,248,134,250,134,122,111,162,162, 96,123, 76, 87,  2, 46,152, 72,196,123, 97,210,134, 31, 27,169,
+ 11,132, 36,148,185, 65,180,  9,135, 23,181,234,189,117,108,187,158,224,133, 57, 43, 49, 45, 28,246,166, 68, 47, 76,109,102,187,
+ 90,243,244,  4,214, 64, 22,207,140,178, 22, 97,181,237,241,235, 35, 92,169,184,238,132,217,221,114,178, 25,120,187,116, 92,209,
+ 83,202, 45,255,230,255,250,231,124,255,163,239,219,225, 81, 43,121,202, 86,197, 71,101,110, 51, 77,231, 69, 20,103,133,154,163,
+ 25,123,223,153,  8, 16, 87,193, 67,151, 86,104,  9, 12,245,198, 70,245,203,184,214, 33,120,145, 37,175,222,243,115,207,158,209,
+202,200,139, 79, 94,178,125,120,202,197, 75,200,178,162,184, 98, 49,186, 46,210, 71,103, 15,247,156,223,132, 43, 84,119, 87,108,
+216,243,117, 23,141,106, 63,195,221,168,223,186,249,138,227, 48, 76,140,185,178, 93,119, 36, 31,217,198, 21,213,193, 56,143,188,
+186,253,140, 87,103,103,188,117,116,204,147,199,143, 89, 29, 41, 83, 25,136,251, 13,167,199,111,241,240,241, 99,240,194,218, 59,
+126,249,111,125,129,223,250,157, 47,242,157,111,124,131, 87,159,237,233,250, 21, 47, 95,238,249,246,119,126,200, 56, 79, 22,100,
+164,249, 14, 87,128, 11, 16, 83, 98, 62, 12,228, 97,198,187,136, 75,129,212, 37,187,248, 77, 78, 73,242, 22,101,122, 51,220,208,
+175, 34, 90,140,234,  5,149,229, 37,161,100,230,217, 81,115,166, 77,217,132,136, 64, 73,240,250,234,146,171,179,115, 62,247,228,
+152,207, 61,123, 66,209, 66,211, 25,116, 32,173, 87,180, 34, 22,224, 34,141, 16, 29,109,130, 50, 87,203,216,142,158,139,171, 91,
+196,  9,169,235, 88,245,134,162,253,139,239,191,  4, 30,243,135,255,233,215, 56,220,140,252,249, 95,254,  8,241,205,176,200, 41,
+145,124, 32,248, 96,218, 17, 49,107,220, 84, 51, 87,215,123,180,100, 66, 52, 94,184,143,137, 24, 87,104,203, 72, 83,242, 82,120,
+175,125, 32,118,129, 95,250,185,103,252, 23,255,229,223,225,230,252, 21,255,224, 31,254, 31, 28,174, 11,218,110,248,203, 31,192,
+238,173, 35,158, 61,138,228, 82, 88,109, 86, 28,202,100, 89,240, 81, 72,209,115,250,224, 17,239,190,247,152,143,127,114,206,247,
+190,253, 99,222,121,254,152,237, 51, 64, 54,192, 99, 30, 60,239,248,210,213, 37,175,207,206, 25,166, 61, 93,128, 82, 19, 99,110,
+ 72, 40,244, 85,105,206,227,179, 69,158,170,179,247,183,239, 60,206, 57,242, 92,  8,210,112,113,196,103,155, 68,184, 90,200, 57,
+131,  4,212,123, 52,244,196, 58,162,217, 17, 59,183,220, 31, 29,212, 66, 85, 97,211,  9,101,134, 68, 68, 98, 37,135,138,230, 70,
+204, 27,100, 26,144,232, 24,219, 76,112,182,174,106,101,102, 80,101,172, 74,138, 14,188,167,206,158, 67,187,197,151, 68, 83, 71,
+232,193,105, 96, 44,134,167, 14,201,112,204, 97,235,153, 14,144,146,226,125,193,121, 15,  1,106,153,241, 98,231,142,208, 72,234,
+ 40,173, 46, 32, 41, 27,199, 83, 27, 89,102,115,155,168, 89,127,171, 87, 74,171,136, 22, 92, 21, 92,179,243,233, 62,246,223,134,
+ 93, 53, 15,182,147,251,  3,207, 52,133, 90, 42, 14,115, 33,221,171,144,173,217,205,238, 22, 91,219,125, 94,232,127,211,138, 39,
+206, 51,223,177,243,157, 67,139, 34, 46, 83,107, 69,130,163,206, 13, 29,171, 89,190,197, 49,207, 19,113,157,  8,101, 98, 28, 43,
+205,  9,161, 13,204, 90, 32,158,224,218, 43,124,187, 37,142,137,131,  6,179, 63, 75,162,186, 66,149,137, 60, 59,188, 11, 12, 58,
+ 51, 55,240,251, 66,210,128,243, 30,255,228,241,211,175,227,218,155,139,220,178,130, 45, 56,193,  7,177,135, 71,151, 78,119, 73,
+ 92,243,238,238, 13,210,101, 63,235,237,255,105, 75,119,189,176,118,156, 68, 83,204, 75,197, 53,101,158,139,  9,241,150,144, 17,
+239, 27, 18,132, 90, 76,156, 39, 98,  9, 91,193,123,156,180, 37,209, 73, 44,170, 85, 64,154,199, 33,180,102,172,110,213, 37,171,
+217,217, 11, 12, 46,188,201, 80, 54,123,155,141,237, 20, 53, 79,186, 51, 32,236, 93,112,129,225,231, 42,206, 47,211,131,187,232,
+ 68,239,192,155,101,195, 59, 79, 31,163,  9,242, 48,109, 64, 12, 30,  9,193, 70,220,203,251,229,235,194,110,119,130,151,133, 69,
+ 28,132,152, 58,246,215,231,156, 93,222, 82,229,167,130, 62, 21,135,143,158,164,142, 40,129,211, 35,207,241,166,103,181,237,137,
+219,192,110,117,  2,125, 52, 21,252, 52, 83, 83, 34, 10, 76, 99,228,234, 80,185,154,102, 84, 15,252,228,123,223,225,213,229, 37,
+ 85,161,229,201, 86, 35,226,193, 21,202, 52,147, 91, 89, 70,194,182,222,104, 75, 81, 21, 66,162,235, 58,250, 85,111,191,179, 82,
+126, 74, 18, 20,115, 67,136, 98,228, 43,103,201,122, 93,151,120,250,224,132,155,219, 91,246,195,192,233,201, 17,135,253,  5,255,
+209,175,252,109,122, 70, 62,249,248,  5, 53, 56,214,155, 45,235,216, 19,163,167,239,146, 21, 25, 18, 13, 98,227, 45,240,199, 45,
+147, 24, 39,186,132, 52, 24,198,183,185, 37, 56, 65,149, 90, 33,231,106, 54,187,101,223, 31,187,158, 85,191,194, 57,199,112, 24,
+121,117,117,193,249,235, 11,  3,163,212,198, 88,110,113,165,242,254, 59, 79,121,254,222,231,217,109, 60, 31,252,224,  3,168,158,
+183, 78, 55,252,241,191,248,127,120,125, 61,115,254,234,134,207, 94, 94,240,250,242,156,146,  7, 74,245, 76,179,237,250,171,192,
+ 48,204,228, 60,211,245, 29,125, 50,110,128,163,226, 93, 66,  2,244, 49, 81,180, 49,150, 25, 39,222, 18,168,178,121,217,167, 33,
+ 27,201,203,253, 52, 95,189, 81,151, 11, 51,216,186, 39, 23,218, 60,179,223,195,112,104,148, 73,113,204,228,209,244, 30,185,153,
+ 43, 36, 23, 53,139,105, 91, 18,199, 36, 32,210,184,188,185,166, 91,173,232,250,245, 27,144, 81,211,194,235,203, 91,222,125,247,
+ 57,127,235, 87,191,194,135, 31,252,152,243,171,129,126,179, 66,146, 39,173, 55, 52,239,108,130,166,134,177, 44,227,132, 23,177,
+ 61,122,112, 84, 85, 91,187,212,130, 71,109,130,227, 35, 41, 38,186, 16,248,220,163, 39,252,103,191,251,107,228,195, 53,255,232,
+143,255,132, 82,133,213,186, 67,155,227, 48, 90,166,228,131,109,100,187, 74,244,113,203,233,131, 39,172,214, 91, 30, 30, 37,142,
+118,158,110, 27, 73,111,109,121,240, 96,203,120, 51, 80,138,178,123,107, 11,238,  4, 43,107, 55,156, 62,216,224, 91,230,211,159,
+188,100, 56,100,211,134,168, 82,100,  2, 13,208, 60,146,140, 92, 87,155, 99,118,208,137,135,234,141,119, 46,130,147, 68,220,173,
+112, 56,203,110,  8,194, 38,122, 10,141,168,160,185, 48,107,162,138,195, 69,197, 75,182,224, 38,133, 76, 67,106, 64, 83,101, 44,
+ 48,183, 17, 90,101, 67,143, 68,207, 52, 89,183,221,168,104, 48, 31,249,144,111, 41, 14, 92,181,243,209, 88,  1,  6,128, 73,219,
+158,234,108,101,193,122,199, 58,  8, 50,  6,166,160,120, 28,193, 21,  8, 29,115,181,148,199,185,182, 37,  0,107, 81,131,163,148,
+165,201, 10, 49, 45,250, 23, 67, 97,215, 10, 49,121, 35, 70, 98,231,165, 56,179, 33, 58,239, 77,175,112,180,101,119,124,116, 47,
+151,239, 52,102,242, 52,209, 39,191,116,189,247,163, 32,159,198, 66,158, 39,250, 20,232, 86,247,151,117, 62, 55, 24,135,153, 60,
+ 79,172,251, 64,183, 94,221,235,197,126, 59, 53, 46,174,174,201,195, 45,117, 30,108,189, 89,178, 37,157,138,160,189, 39,143,138,
+ 43, 13,167,  5, 41,149, 24,149, 67, 24,104,154,224,214,236,209, 78,  6, 74, 43, 56,122,100,116,116,213,  2, 21, 11,133,154, 12,
+130,228,212, 51,211, 40,109, 32,248,204, 62,103,106, 51,248, 80,155, 77, 84,155,180,226,159, 60,123,251,235,134,  8,117,119, 43,
+242, 55,201,108,119, 34, 68, 39,150,100,131,115,111,246,164,150,174,186,192, 83, 22,197,188,113, 98, 28,190,185,197, 30,102,209,
+131,212,198, 92, 33, 18, 65, 28,173, 22,106,109,248,100, 65, 25, 82,155, 89,124, 22,117,162,136, 21,  9,119,234,245,187,130,176,
+220,217,172, 44,130,197, 18,118,196, 89,196,224,226,167,175, 78,151, 41,131,188,161,227,137,119, 56, 53,223,117,  8,102,224,174,
+205,210,210,112, 38,186,107,193, 50,209, 81,183,112,210,205,110,228,157,117,182,125,178,195, 52,165,136,  4,111, 79,139, 90,240,
+141, 83,152,231, 12, 94, 80,188,141,126, 67, 36, 36,251,128,125,246,217, 43, 94, 95, 15,118,208,139,241,195, 67,232,136,222,210,
+121,164,235, 72, 93,228,228, 40,146,196,219,  1, 21, 28,210,103,230,155,  1,223,111,240, 82, 65,183, 92,149, 83, 84, 39,186,208,
+241,201, 39,223,231,227,143, 63, 96, 44, 51,211, 48, 83, 90,181,223, 31,141,156, 51,185,232, 27,129,218, 29, 96,  6,231,232, 82,
+207,170, 95,211,165, 14,241,129, 82, 50,121,154, 25,198, 97, 73, 24,179,125,156,247,  9,241,203, 46,220,193,233,209,142, 92, 27,
+183,227, 76,174,153,211, 99, 91,  7,252,198,175,255, 50, 31,255,240,207,249,248,236,154,253,237,173,117,164, 10,187,205,138,126,
+189,102,211,245,236,118,107,214, 41,144, 98, 34, 70,135,168,229, 10,220,101, 52, 91, 32,110, 89, 48, 69, 54,126, 14, 18, 23,102,
+127,179,220,106,231,105,173,  0,158, 39,143,159,241,214, 91, 39,168, 22,202,156,185,185,222,115,125,187,231, 48,206, 92,239,175,
+185, 62,156,145,122,104,172,232,251, 21,243,112,197,167,175, 94,243,239,190,253, 49,115, 45, 56, 23,120,245,234,140,139,155, 27,
+ 82,223, 17,130,231, 48,236, 41,165,226,170,163, 52, 19, 90,174,183, 27, 83,170,123,150,241,101, 33,136,163,102,101,204, 19,105,
+221, 33, 90, 41,227,204, 48,205, 76,205,240,189, 34,134,166, 28,243,108, 83, 45,  9,203,239, 59, 46,126,220,128,147, 35,170,118,
+116,209,227, 20,166, 60,227,154, 55, 82, 91,110,204,173,224,131, 97,143,107, 43,224,148,245, 42,114,126,181,167,213,198,106,189,
+ 66, 36, 17,196,209,111, 59,122,  9,168,115, 92,158, 79,212, 58, 47,152,216, 53,125,183,131,150, 17,159,208,  5,144,228,112,228,
+ 97,207,225,246, 22, 66,192,199, 64,144, 72,148,244,102, 61, 85,106, 65, 85,  9, 41, 17,125,164,235, 87,252,206,111,125,153,163,
+147,192,255,252,191,254, 43, 42,194, 23,223,125,204,238,100, 67,236,  4, 45,240,234,236,192,217,217, 21,187, 85,224,189,119,223,
+227,237,211, 19, 78, 79, 34, 71, 15,214,248, 62,192, 42,130,108,112, 97,203,209,131, 21,229,122, 36,122, 69, 86, 15,150, 75,221,
+186,246, 85,188,225,131,239,126,151,177,  4,100,211, 81,  5,200, 21, 71, 98,172,197,136,114, 85,152,218, 68,140, 59,180, 64, 72,
+153,137, 70,161,145,186,196,106,189,  6,175,104,155, 45,176, 72, 21, 95, 35, 26, 35,153, 70,119,135, 82, 78,105,161,208, 45,  5,
+112,245,224, 11,213, 77,228, 92, 81, 28, 41,  4,154, 22,114,168,  8,  9, 73,149,230, 21, 37, 49,140, 87,136,139,108, 98, 15, 84,
+188,174,152,124, 97, 19, 86,180,193,130,134, 92,231,112,117,198, 51,211,130, 39,180,198,166, 87,106, 78,220,206, 19,218, 34,169,
+115,132, 86,152,115, 70, 98,180, 21,103,181,174, 60, 68, 19, 44,171, 83,251, 60, 54,219,133,138, 88, 35,162, 94,240, 69, 17,  9,
+ 56, 60,169, 19,156, 15,164, 16,120,112,122,196,122,187,253,217, 71,217,216,  5, 89,203,204,170,139,247,118,249, 54, 96, 88,104,
+114,155, 85,186, 55, 70, 61,139, 67,106,127,152,104,101,226,104,211, 19,250,254, 94, 59,245,235, 65,185, 56,187,228,112,251,154,
+208,218,178, 26,130, 88, 29, 53, 55,246,185,225,171, 16, 66,160, 97, 44, 11,205,142, 60, 21,124, 16,114, 81,156,159,152, 91,161,
+185, 35, 90, 84,202,180, 71, 99,160,170, 82, 37,227,125, 51, 20,108,131, 88, 39, 92,118,136,139, 16, 42,234, 10,100,207,218,247,
+ 12,154,173,224,124,252,248,233,215,113, 22,196,226, 84,222,  8,229,180,217,206, 89,192,136, 87,119,227,119, 21,187,244, 85,236,
+ 31, 47,182,255,185, 83,156, 59,111,130, 22,111,204,115, 93,178,204, 21,192, 27, 14, 79,245,142,170,230, 45, 36,  5,161,181, 59,
+106,155,  9,149,172,122, 88, 18,220,196, 89, 42,140,184, 37, 56,126,129, 31, 44, 48,  4, 39,178, 36,203,181, 37, 95,119,241,210,
+171, 37,124,149, 82, 12,166,180,140,178,238,210,200,250, 69,237,236,177,162,165, 96, 57,201, 62, 44,240,149, 37, 80, 38,198, 64,
+112, 98,252,118, 23,172,104,  8, 22,168,209, 74,129, 14, 68, 76, 29, 95,213,194, 82,124, 52,246,117, 29, 38, 62,249,228, 51,246,
+135,108,187,174, 16, 40,181,226,125, 35,250,192,122,181, 38,246, 59,202, 56,242,232,  4,203, 16,206,141,154, 71,156, 68,188, 58,
+210,163,167,132,  8,181, 20,214,238,192,233, 10, 34,141,111,254,223,127,193,171,235, 27,198, 60, 89,116,108, 93,112,145, 14,166,
+146,223, 32, 59,181, 89,167, 14,142,216, 37, 54,171, 35,124,240,196,232,105,181, 82,242,188,232, 29,108, 18, 83, 85,223,204,150,
+116, 81,134,167,216,179, 74,107, 52, 91, 71, 83,171, 32, 93, 64,112, 28, 31,173,249,240,199, 31,115, 53,204,180,217, 86, 40, 14,
+193, 47, 60,126, 35, 15, 54, 16, 79,223,173,216,173,214,196,216,177, 89,117,172,214,235,101,239,238, 77,205,171,205,118,163,216,
+138,195,105, 35,166,142,205,118,103, 26, 15, 47, 54, 54,247,158,205,241, 41,199,187, 19, 82, 72, 68,111, 83,136,162,141,105, 26,
+232, 87, 61,133,132,200,150,241,242,130, 31,125,252, 33,173,  4, 62,252,248,130, 16,  2,222,  5,242,108, 42,246,180,218, 82,242,
+ 76, 30,  7, 67,171,138, 95, 10,184, 68, 18,111, 99,110,223, 44,210,215,155,250, 70,106,179,162,182, 53,166,217,188,168,135,105,
+ 36,134, 68,232,122,106, 49,197,173, 42,  4,241, 36,151,104,136,105, 56,200, 28,159,158,240,252,217,123,164,152, 32,143, 76,211,
+126,169,186, 51, 51,149, 20,  2,171,190,135,230,105,147,253, 78, 66,244,  8,133,235,195, 45,222, 11, 49,244, 72,112, 68, 85,186,
+232,201,165,177,191, 30,120,117,126,224,187, 63,122,193,231,222,121,192, 87,190,248, 46, 47, 62, 19,166, 58,216,110,217, 43,129,
+132, 35, 47,129, 70,138,182, 76, 45,153, 90,139,209,194,  4,124,234, 16,151, 72,253,138, 85,215,225,212,241,206,179,231,124,254,
+ 11,143,248,215,127,246,151,188,188,184,229,249,179,  7,156,172, 58,158, 60,220,240,222,211,199, 28,239, 54,108,143, 19,143,222,
+218,240,240,225,219,188,247,238, 59,172,123, 33,198,176,184, 87,162,197,103,138,  7, 22,204,234, 73, 64, 74,197,113,128,112,  4,
+216,244, 43,109, 34,109, 58,231,230,246, 64,171,141,220, 38, 82,243, 22,165,155, 44,254,121,210, 74, 29, 70, 96,196, 99,175,165,
+173,122,124, 81,250, 46, 90, 34,155, 54, 52, 67, 45,138, 71,  9, 18, 72,105, 17,219, 22, 71,171,153, 90,  4,205, 51, 33, 54,214,
+126,205, 92,148, 42, 21,209,222,206,131,228,240,186,198,139, 66, 77,248, 44, 20, 22,215,198, 97,198,211, 17,220,242,217,239, 86,
+ 11,115,163,217,152,126,204,244,114,151,147, 17,233,154,241,254,187,  4,173, 69,166, 42,116,171, 72,234,205,137, 19,213, 92, 43,
+206,121,180, 90,104,145, 19,  7,106,225, 70, 74, 51,167,210,146,201, 32, 98,239,151, 15,  1,109, 75, 90,101,176,179, 49,224, 17,
+ 31,121,112,114, 98,123,234,159,241, 43, 23,101, 26, 38,106,201,244,125, 32,221,211,  5,153, 27, 12,135,209,178,206,215, 29, 62,
+165,123,187,116,115, 49,252,172, 43, 19,187,109,143, 79,221,189, 94,234, 55, 83, 99,127,117,197, 52, 94, 67, 53, 23,194, 84, 51,
+197,196, 13, 76, 21,179, 82,250,194,213,126, 38,116, 14,215,102,102,241, 56,233, 88, 53,207,220, 34,115, 39,204,121, 34,164, 66,
+ 84,225,102,184, 33,202,100,159,135, 42,180,177, 80,219, 68, 12, 70,121,173, 83, 69, 92,160, 74,195,233,140,150,105,137,241,246,
+119, 49,180,230,239, 94,132,158, 54, 30,117,119,251, 13, 71,211,188, 28,206,178, 16,208,140,220,230,177,172, 99,239,101,177,171,
+  5, 19, 85,181,138, 54, 33, 56, 71, 86,247, 38,163,215,114, 14,204, 82, 38,222, 46,242, 86, 13, 22, 19,124, 88, 46, 33,104,226,
+  8,106, 42, 98,239,127, 26,249,169,173, 33,173,162,213,177,  8,237,233,196, 27,230,114,121,208,125, 93,148,198,152,151, 23,109,
+230, 77,199, 10,137,102,237,191,141, 70,199, 98, 99,245, 96,146,108,183,132,215,180,170,  4, 60,222,233, 50,178,110,118,245, 59,
+165,104,166, 39,224,131, 51,247, 30,209, 98,102, 69,108,191,223, 38, 90,136, 80,132, 38,133, 60, 90,247,232,112, 52,181,200,211,
+224, 34,173, 26,143,123, 40,153, 13,  7,166,210,120,113,230,136,167, 29, 47, 95, 95,241,224,241, 49,207,146,162, 33,209,169, 67,
+230,107,152,  7,124,234, 73, 15,190,200,103,103,127,205,203,243, 87,228,105,194,225, 13, 54,227,140,216, 54, 47,136, 88, 81, 40,
+170,180,214,104, 56,219,191,174, 55,164,174,167,228,137,113, 26,153,115,166,149,121,153,200, 88, 92, 96, 16,140,122,215,204,175,
+ 30,227,138,211,163,135, 28,111,119,204,109,224,236,226,140, 24, 58,188, 56,118,219, 29,175, 62, 62,227,250,242,192,245,197,245,
+162, 94, 15, 72,202,140,193,225,218, 93,168,142, 21, 91, 18,148,236,173, 11, 78, 62, 33, 93,100,179,219, 48,141, 35,211, 60,211,
+ 74,102,206,149,195, 56,211, 90, 49, 26, 93,127,204,131,211, 99,134,225,134, 33, 55,130, 52, 46, 46, 95,115,241,255,178,246, 38,
+ 63,182,166, 91,122,215,111,189,221,247,237, 46,154,211,103,158,108,171, 50,111,111, 76, 25,170, 92, 50,133,  4, 46,171,140, 96,
+ 98, 23, 66,194,136,110,104,129, 24,152,  9, 67,106,128,248, 11,144, 60,131, 49, 66,162,145, 65, 32, 33,  6, 22, 20, 24,227,194,
+229,219,223,186,183, 50,239,189,153,121, 50,243,116,209,237,189,191,230,109, 22,131,245,197,201, 50, 24,123, 80, 39,164, 80, 28,
+157, 19, 25, 25, 17,123,239,247, 93,205,243,252,158, 23, 47,120,244,240,  1,187,221,137,161,108,111,174,152,154,167,230, 70, 25,
+ 76,185,172,193,241,197,213,196,119,190,241,  1, 63,253,163, 79,153, 26,244, 30, 10,158,148, 34,125, 73, 11,198, 85,113, 97, 69,
+ 10, 17,231,148, 94, 86,175,210, 11,  5, 99,154,223,166,238,105,201,139,245,177, 49, 15, 22,122, 84,180, 34,222,114,159,107,179,
+217,153,162,196, 46, 18,154,208,212, 58,103,191, 76, 74,126,243,159,251,109,118,105,197, 39, 31,255,152,195, 52,225,176,202, 59,
+122, 99,219,123, 12,164,212, 68,169, 73,  8, 53, 80,231,202,203,105,143,111, 74,215,173,161,  5,168, 32,189,112,189,207, 28,135,
+ 76,205,166,230, 62, 59, 95,243,181,247, 30,112,117,121,224,242,120,131, 74,162,228,145, 78, 21, 66,133, 16,113,189, 99,215, 39,
+124, 85,142, 67,102, 30, 14,228,150,105, 56, 82,179,181, 66, 23,140,194, 40,193,242,184, 63,254,233,199,124,252,211, 47,232,215,
+ 91,134,195,140,158, 20, 98,240,156,172,132,251,111,222, 39,244,143,184,115,231, 49,119, 54,119,249,248,211, 79,248,209,247,254,
+ 62, 90, 60,190, 15, 68, 45,118,102,212,138,138,231,238,189, 51,254,169, 95,251, 38,111,124,248,216,250,181,250, 83,240,223,176,
+253, 54,107,222,122,231, 62, 79,159,189,100,122, 82,233, 42,236,213, 33,110, 66,147, 71, 22, 95,179, 46,197,186,184,138,203,129,
+118,147,129,134, 76, 75,163, 66,192,121,135,182, 66,141, 17,223,214,200,156, 17, 29,241, 84,170, 38,156, 20,178, 52,198, 73,240,
+ 97, 66, 90,198, 15, 32, 29, 86,160,229, 61, 18, 70,134,169,177,233,148,210,  5, 18,145,161, 30,241, 93,164, 87, 79,174,224,164,
+163, 78, 66,145,  9,239, 34,205,  9,116,182,230,  8,206, 70,228, 83, 19, 98,237,168,146,201,  5, 68, 71,104,206, 50,211,179, 81,
+253, 11,137, 78, 51,147, 52,142, 90, 89,247,209,180, 28,226,240, 42, 72, 85,156, 23, 66, 23,173, 96,119,  6, 72,162, 51,209,176,
+182, 70, 85, 35,206,  9,144,186,215, 99, 59,171,173, 89,134,132,234,107, 13,114,169, 69,145, 90,111, 77,223,175,245,210, 45,173,
+161, 90, 95, 89,182, 95,247,155, 54,101,170, 86, 56, 54,201, 76,197,248, 19, 85, 43, 20, 97,189, 76, 56,178, 52, 98,108,148,166,
+116,174, 35, 72,134,236,152,214,149,105,127,164,142,  2,101, 36,183,200,161,152, 11,236, 88, 76,255,213, 69, 79,140,153,121,106,
+ 92,207, 25,102, 32, 70,188,206,104,129, 68,162,134,204,205,116,  3,205, 17, 28,139,245,203,181,165, 11,118,175,172,  0,218,140,
+209, 46, 53,224,156, 46, 52, 47,163,146, 89,156,167, 46,193, 20, 75,117, 47, 86,253,154,  8,107,161,179, 81, 22,239,187, 41,222,
+ 85, 45,132,162,212, 66, 83,219,149,107,168,214,113,227,201,203,206, 89,156, 77,  4,212,129, 18, 22,  5,175,141,232, 91, 48,255,
+180, 23,103,152, 68,  4, 81,219,167,219, 11,200,196, 36,174,205,168, 23,186, 16,108, 93,220, 20,241,150,206,214,170, 21,  2,222,
+ 39,212,123,188, 98,150, 40,175,166,190,151,165,240, 80, 11,164,137,209, 80,182,130,208, 18, 48, 54, 27,121, 57, 65, 91,164, 73,
+ 70,180,226,189,  9,144, 82,176,238,255,242, 56, 50,102,203, 48, 39,218, 90,129,214, 72,105,197,122,125, 74,112, 66,206, 35,210,
+  2,159, 93,  8,195,116,201,201, 58,114,218,219, 97, 21,207, 31,226, 99, 67, 71, 79,211,142,110,245,128, 97,130,223,255,195,239,
+114,147,139, 61,121, 68, 45,  6,214,  9,245, 22, 13,170, 95,217,199,186,126,195,106,179, 35, 38, 79,128,175, 46,113,177,239, 81,
+124,178, 78,191, 85,  2,150,218,215,196,194, 88,188,  8,201,123, 78,119, 59, 30,255,202,135, 56,217,243,238,248,152,155,253,  0,
+ 18,184,247,240,148,235,103, 79,184,184, 62, 90,200,139, 40,165, 53, 74,201,200, 77, 37, 38, 79,148,106,169,120, 62,217,243,162,
+ 41, 69,103,138,122, 92,157,109, 26, 18,  2, 49,120, 98, 56,181, 92,244,155, 35, 57, 27,143,111,179,237,184,119,114,202,149,171,
+132,121,230,162, 24, 19,253,120,188,226,242,112,195,246,238, 93,164, 68,198,113,166, 73,  7, 14,174,142, 35,207, 62,255,146,243,
+205, 35,186,213,138,124, 16,126,254,243, 47,200,173, 34,190,163,148,137, 99, 25, 25, 90, 33, 34,116,190, 35,172,150,149,140,115,
+184, 90,105, 41, 80,201, 80, 26,226,195, 87,142,130, 92, 45,103,187, 97,220,132, 82, 25,230, 25,223, 37,106, 19,114, 29,201,173,
+144, 75, 97,154, 43,235, 20,105, 82,241,193,115,247,206,  9,143, 31,253, 42,223,120,235, 67, 62,250,248,  7,104,178,108,112,245,
+ 17,183,140,127,163,139,204,227, 12,209,211,156, 16,  5, 86, 93,199,179,124,201, 92, 10,155,176, 33,185,142, 16, 59, 90,204, 76,
+ 89, 41,135,137,211,147, 83,196, 55,118,125,199,230, 52, 66, 15, 63,253,252,153,169,199,203, 68,171,  3,181, 95,211, 57,193,177,
+102,116,  7,203, 46,112,133,221,137, 39,247,137, 25, 37, 31, 15,212, 50, 17,124, 68, 48, 48, 82, 72, 61,207,159, 94,241,197,197,
+ 19, 66,240,184,  2,227, 85,225, 51,191,199,197,200,221, 71, 91,210,106,205,233,246,132, 77,140,124,255,251, 63,228,111,253,143,
+255, 59, 63,254,232,167, 68, 39, 68, 31,217,122,112, 41,210,170, 57, 27, 30,220,127,155,156, 61,255,244, 84,121,248,238,155, 68,
+169,176,254, 25,196,111,  2,107,206,223,250,117,222,187, 86,158, 62,253, 17,163, 10, 41,192,236, 59,242, 88,137,201, 58, 91,191,
+218,154,110, 70,102, 90, 16,220, 12, 93,232,208,216, 27, 70, 87, 50,185,  4, 98, 88, 65,104,  8, 19,185, 88,145,102, 96,106, 59,
+215, 36,108,  9,109, 96, 47,166,142,207, 52,188, 43,196,193,188,227, 67,169,132,218,200,206, 81,210,128,171, 61, 73, 86,176,242,
+ 54, 94, 31, 26, 49, 40,210,  9,169,174,141, 81, 81, 20,237,108,  2, 88,115,166, 75, 61,107, 81,230, 38,236,135, 69, 39,210, 59,
+228,  0,178, 74,244,179,217, 59, 71, 61, 18,125,196, 73, 68, 85, 57,222, 12,156,244,145,208,121,156,  4,107, 64,154,129,183,106,
+  3, 45,217, 44,199, 62, 34, 33, 32,222,104,153,234,141,241,145,250,248,154, 46,117,181,130, 85,219,107,195,206,222, 22, 11, 54,
+177, 93, 86,175,175,145,246, 86,115, 53, 96, 24,202,235,190,210, 21,200,217,146,216,124, 47,228,217, 65,203,120,113, 76, 71,163,
+ 20,116, 17, 14,131, 64, 21,180, 11,184,195,192, 84,170,  5,123,141,  7, 40,  9,169, 51,226, 34,142, 68,190,201,184, 60, 35, 46,
+ 83,252,154, 80,130,221,105,101, 36, 36,208, 26, 33,101,234, 84, 12,121, 94, 27,199,169,224,156, 77, 47,171, 54,  2,173,208,156,
+162, 34, 72,243,139,104,169, 45,  8, 81,243,162,183,101,140,174,218, 12, 80,179,  8,230,230,106,222, 72,183,176,208, 75,169, 54,
+ 50,174,230, 13, 55, 90, 98, 69,125,164, 41, 72,153,208, 16,151,241,174, 16,157,249,222,125,245,102,185,114, 13,105, 66,240, 54,
+ 41,184,221, 33, 33,166,122,215, 91, 49,117, 21,163,218, 46, 15,147, 46,214, 57,243, 67,155,200, 75,243,180,236,131,  3, 62, 52,
+ 90, 85, 74, 19,250, 40, 75,174,139,237,205, 67,178, 20,167, 82,133,228, 29, 42, 13, 47,142,121, 17,226,165,232,105,139,207, 88,
+213, 17, 98, 96, 33,215, 19,196,190,166,184, 66,242, 66,174,102,177,179, 17,182, 67, 93, 34,246, 43,188,119,230,165,207, 35,177,
+239,208,180, 33,118,  9,231, 96, 27, 19,251, 57, 51,150,137,185,206,188,156, 35,219,  4,125,167,172,238, 61,224,173,183,222,161,
+ 12,151,124,116, 13,215, 67,227, 27,119, 30,241,209,207,190,199,143,127,241,130, 86, 23,200,187,130, 90,223,177,164, 77, 97, 72,
+ 82,239,217,237, 78,217,109,182,  4,148,105,154, 81,148, 92, 27, 57,207,104,107, 52,138, 65,122, 52,162, 24,136,165,214,130, 54,
+ 33,164,158, 77,234, 17,215,152,162,231,252,108,199,112,115,228,238,195,251,156,111,  6,252,106,199,251,239, 60,228,127,250,227,
+ 31,113, 51,206,196,148,172,240,242,  6,146,209,230,168,121,121, 92,231,134,247,149, 73, 64,196,246,148, 49, 24,104,166,150,145,
+222, 37, 98,  8,148, 50, 51, 30, 51, 14, 71, 76,102, 47,220,158,157, 18,250, 72,210, 21, 94,132, 67,172,140,135, 17, 17,232,250,
+ 68, 31,  3,178, 59,193,191,120, 78, 83, 71,116, 29,125,223,211,202, 68, 30, 95,178, 58,127,147, 63,252,225, 31,115,121,177,183,
+149,143,100,164, 12,116, 62, 66, 44,208,204,246,117, 43, 12,149, 90, 13,181, 91,150,188,232,141, 67,180,210,198,153,161,100,188,
+ 23,106, 83,114,205, 72,131,113,158,105, 45, 19,170, 39,163,148, 57,243,232,222, 41, 95,255,240, 33, 79, 95, 30,248,201, 79,158,
+224,137, 56, 81,222,120,120,151, 63,247, 27,255, 60, 55,215,123,158,189,248, 28,164,177,234,253,130,155,140,140,109, 98, 22,103,
+160, 23, 53, 78, 67, 81, 43,140, 53, 11,174, 84, 92,239,201,177,199,123, 79,231, 20, 13, 86,116,196,196,146,154, 88, 89,199, 13,
+207,159, 94,242,228,233,133,177, 23,104,164, 16, 13,132, 35, 25, 47,153,132, 16, 34, 28,103, 27,235,167, 96,235,132,176,238,105,
+ 53,226, 23,218, 95,171,166, 14,255,248,243, 47, 16,157,  9,169, 39, 59,  8,173,241,249,139, 35,215, 55, 19, 62, 57,126,227,215,
+239, 48, 78,133,191,251,251,127,135,255,249,247,127,200,213,213,158, 77,232,169,210,112,190,103,246,141, 40,129, 24,148,190, 63,
+225,108,183, 38,208,248,249,151, 79,248,226,226,200, 38, 69, 30,189,113,135,243,247,214, 32,239,  3,103,156,159,221,161, 75, 27,
+114,184, 38, 22, 69,166,197,190,170,160, 67,163, 76, 35,132,158,234,  3,206, 87, 60, 30,113,142,148,140, 43, 81,  7, 71,110, 25,
+113,  1, 29, 11,234,183,180,118,160, 87, 27,179,207,177, 33, 98, 44,253, 85,191,226, 58,207,184, 90,145, 56, 82,203, 17,117,153,
+ 66,196, 21,193,165,104, 75,165,131,210,214,141,232,123,234, 44, 48, 85,252,102,131, 84,136, 35,196,147, 70, 11,194,248, 98,192,
+133, 74, 58, 49,106, 95, 44, 21,233, 44,144,182,175, 91,230,232,217,184,194,126,156,104,215,151,100,233,200,222, 40,143,115,168,
+172, 85,233,157,167,249, 14, 13, 54, 73,117, 90,205,189, 98, 74, 61, 84,205,198,102,114, 25,181,145,189,115,136,143,228,162,116,
+190,161,179,173,  8,255,180, 23, 88, 41,150,131, 96,112,169,215,123, 65, 54,173,  4,177,245,225,235,164,201,149,218, 40,173,144,
+ 68,145,240,122,195, 92, 50, 80,134,  9,173, 51, 50,102, 35,140,  6,115,139,197,149,225,124, 39, 28,205, 77,204,185,145, 68,200,
+161,103,158, 10, 77,108,205,168, 28, 89,169,103,156,  5,105, 70,  4,108,206,163,178,166,186, 74,209, 75,146, 11,204, 46,208,198,
+ 76,234,172,243,143,125,207, 84, 13, 69, 29,187, 64,137,107, 74,155, 72,162,132, 38,214,141,181, 42,203, 30,219,186, 81,116,  9,
+ 68, 80,181,202,207,121, 88,114,206,181, 45,250, 38,177,142,119,217,138, 47, 35,102,243,  7, 55,113,120,127,139,100,181,127,211,
+224,209,102, 12,222, 40,130, 52, 71, 67, 25,107,193, 75, 90, 80,126,141, 86,170,197, 30,  6,179,171, 53,109,102,135, 18,165, 73,
+ 67,212, 47,162, 58,251,255,214,214,192,155,138, 28,215,200,197, 50,165, 10,198, 80,183, 95,150,  1,  0,180,121, 36, 58,131, 58,
+ 52, 99,185,187, 16,104, 82,200,173,210,102, 37,121, 11, 66,104, 40,170,149,160, 11,112, 34,221, 70, 93, 26,119,186,184,138, 95,
+  8,118,178,168,250,167, 98,138,216, 32,138, 74,101,119,118,135,243,211,103,124,242,249, 75, 52, 68,114,174,164,100, 30, 69, 47,
+129, 22, 61,121, 12,164, 94,144,150,217, 31, 38,254,232,179,145,146,214,252, 11, 31,188, 67,215, 69,180,110, 25,198, 27,134,208,
+ 83, 53,243,131, 31,126,151,163,222, 34, 21,  3,173, 21,180,150, 87, 49,160,218, 42,162, 16, 92, 71,138, 17,234,204, 97, 28, 56,
+ 78, 51, 49, 69,188, 11, 32,144,243,108,211, 25,205,248,208,225, 67,176,  4,183, 42,204,173,144, 82,100,183,237, 40,115,230,108,
+189, 51, 71, 65, 54,174,251,148,161,223,192,147,207, 62,230,226,122,192,247, 30, 74,163,239, 59,106, 83, 74, 25,205, 95,235,212,
+  4,112,226, 13, 48, 81, 10, 65, 27,222, 11, 71,102, 66,140,116, 11,111,219, 45,  2,174, 57, 47,151,152,107,184,  6,235,212,113,
+ 60, 30, 57,223,158, 48,132,192, 29,224,201,176,167,  9,120,117,212, 82,152,199,145, 92, 12,195, 21, 55, 59,206,206,238, 50,207,
+215,204,  2,209,247, 76,115,198,165, 72, 84,200,109,102,170,  3,181, 53, 78, 54, 59, 74,155,153,180, 49, 78, 25, 21, 71, 31, 45,
+ 84,162,148,138,139,102, 39,201,211, 72, 41,141,232,189,141,218, 91,195,169,231, 56, 77,160,158, 85,138, 54,161,168,141,166,142,
+247,222,190,203,191,246, 87,127,155,243,179,251,252,205,255,226,191,229,111,255,175,127,192,182, 63, 97,123,254, 62,219,147,187,
+252,226,151, 63, 48,171,167, 52, 66, 72, 12,147,185, 76, 92,179,188,231, 32,145,220,160, 11,137, 50, 87,142,251,  3,101, 62, 16,
+189, 35,164, 53,205,  7,154,107,168,  4, 58,160, 70,108,207, 31, 10,243, 84,185,188, 24,249,236,201, 21,199,189,199,251,153, 90,
+ 71,162, 11,104,157,152, 75,165,143, 13,231, 28, 57, 43,142,138,147, 68,117, 51, 14, 33,245, 61, 53, 55,106, 86,166, 50, 17, 67,
+143,230,153, 86, 51, 62,173,160,154,134,165,184,200,221,179,200,221,147, 29, 79,159, 29,248,195,191,247,199,188,188,170,252, 31,
+255,247,207,169,181,208,  4,149,164,  3,  0,  0, 32,  0, 73, 68, 65, 84,173, 60,100,107, 18,212,  9,117, 81,109, 23,233, 56,223,
+108,184,251,248, 28,233, 96,222,103,202,250, 37,135,185, 49,125, 10,135,227,129,183,190,  6,196,135,244,171, 14,113,144,102,101,
+ 14,158,131, 22,227, 70,204, 14,239, 70,186,206, 68,141,  1,207, 60, 13,102, 39, 12, 43, 66,116,212,121,102,164,225, 87, 66,148,
+ 66,110, 13, 13, 19, 49, 36,142,243, 17,113,129, 92,109,157,163,147,163, 76, 21, 23,160,198,  2, 45, 49,231, 74, 74,142,168,141,
+224,  2, 45, 87,178,119,168, 19,198,  5, 17, 27, 84,152, 90, 68, 75, 38,246, 29,227,108,  4, 62,209,  3,222, 53,164,  4,202,228,
+104,203,180,177, 30, 97,189,243,104,152,  8, 49, 50, 22,135,246,  9,175, 71,106,232,104,181,226,107, 37,109,183, 56,157,153,166,
+204,122, 19, 33, 64, 46,203,152,221, 41,218, 44, 82, 25,103,186, 33,151,  2,161, 57, 26, 29,170, 86,220,251,232, 41, 14, 62,125,
+242,130,211, 93,198, 69,139,114,246,209, 35,222, 47,142, 31, 19, 70,203,226, 10,250,127, 91,213,100,177,129,181,170,148,105, 66,
+171,113, 20,244,118, 92,254, 58, 46,223, 90,121,229,203,121,141,227,119, 43,148,205,185,147,162,188,118,166,188, 46, 23,123,117,
+ 51,  5,135,115,137, 60, 29, 64, 76,175,210, 43, 28,138, 50,187, 66, 23,  2,199, 67, 38,119, 10,157, 82,110, 26,126,101, 64, 52,
+157, 21,207, 76,141, 51,174,245,144,148, 54, 79,164, 10, 53,110,168,154,153,219, 76, 44,129, 16, 27,140,141, 34, 71,124,132,182,
+238, 73, 94,  9, 67, 97,214, 21,193, 23,219,169, 27,138, 85,113,203, 78, 86,219,146,109,190,136,222,188,  0,213,112,175,150,108,
+101, 57,230,150,112, 85,109,204, 81, 28,209, 25,202, 48, 55, 83, 96, 59,177,184, 72,244, 54, 34, 85,190,138,205,177,137,132,237,
+147, 80,  2,213,252,151,206,163, 98, 23,184, 56,251,164,132,163,170,163, 46,150, 19,195,183,218,  1, 26, 92,128, 86,236,243,189,
+160,206,209,121, 40, 78,241,248,  5, 64, 99, 88,214, 69, 90,103,193, 31,213, 89,244, 98,109, 11,233,203, 83, 91,193,123,165, 69,
+219,247,107, 83,116,170,212, 32, 36,177,  2,161, 57, 83, 71,163,182,215,171,169,146,196,145, 43, 12,121, 98,221,117,180,  2, 57,
+ 41, 65,109,191,249,206,189,115,158, 62,189, 96,174,149,  1,133,105,192,187, 53,135,121, 79,110,145, 82, 26, 93,127,202,201,118,
+  5,231, 70, 86,186,113,247,120,126,241,156, 52,125, 78,215,189,197,251,191,250,171,156, 61,120,196,139,207,190,207,143,127,249,
+  2,230,140, 74, 91,  2, 66, 42,170,213,236,111, 33, 80,139,177,221, 17,101, 30,246,100,103,185,240,125,191, 70,181,144,243,188,
+216,172,  4,173, 38, 96, 44,101,162,182,140, 11, 61,136,176, 94,111, 73,206,113, 56, 30,145, 38,136,244,188,124,249,146,213,166,
+ 39,224, 57, 72,134, 86,249,244,201, 39, 28,167, 17,178, 82,107,229,206,157,  7,220, 63,187,207,143,126,242,125, 14,211, 96,138,
+113,109,244,105, 69,234, 34,181,217,222,183,168, 81,189, 74, 41,204,192,189, 55, 31,114,186,221,114,241,244, 37,170,149,105,174,
+ 52,173,244,253,  6, 23, 26,135,171, 35,247,206,214, 60,191,184, 54,120,136,154, 29,168, 52,225, 56,140, 12,195,193,214, 36,222,
+ 33,154,233,188, 16,253,150,195,213,196,225,236, 64,223,117,164,  4,215, 87,  7,166,225,192, 80, 50,121,174,140,211, 68, 23, 59,
+210, 54,176, 78,189,101,201, 99,142,138, 16,160,214,137, 49,155,136, 12,143, 37,154,209, 44,180,165, 26,200, 40,  4,199, 92, 11,
+173, 22,206,118,107, 78, 55, 27,158,190,188,225,231, 79, 62,227,195,119,127,149,191,246,187,191,195,143,127,244, 83, 30,189,251,
+ 29,126,253,215,255, 60, 47, 95, 60,161, 77,  3, 43,239,200,217,225, 37,224,219,  0,107,135, 47, 43,242,176,103,212,130, 72,164,
+100,101, 28, 50,173, 78, 84, 38, 98, 92,225,215, 61,125, 19,114,139,184,128,141,213,179, 82,188, 66,246,220, 28, 38,158, 94, 28,
+208, 92, 17,191,130, 54, 33, 75, 88, 81,159,  2,201,109, 25,134,  3, 62, 56,180,130,119, 66, 22,165,181, 64, 80,165,204,  5,205,
+ 86,128,181,214, 32,  5,100, 73, 69,107, 45,160,174,225, 35,132,206,209,175,123,238,221,219,177, 31, 60,255,219,223,125,194,245,
+152,105,190, 18,181,217,104,178, 85, 19,197, 57,219, 45,139, 38,118,235, 19, 54,155, 19,246, 71,207, 39,159, 85, 30, 63, 12,244,
+235,132, 56,184, 25,158,113,124,113,198,205, 63,248, 62,231,103, 63, 96,179, 62, 99,214,204,190, 85,162,122, 66,  2, 38, 69, 74,
+198,173, 10,121, 20, 82,179, 51,136,148,112, 25,122,239,144,201, 32, 86, 65, 28,101, 26,153, 66,193,251,136,211,137, 89,  3,  1,
+ 79,  8, 75, 51,115,172,180, 88,200,161,179,137,213,104,163,252,237,218,145,  7,135,172, 18,196, 68, 57, 30, 88,165,206,200,114,
+ 57,224,134, 66,149,229, 66,174,149, 81,214, 80, 11,206, 41,211,161,226,214,107,194, 44,232,228,113,157,224,221, 64,157,  3,121,
+ 62, 34,154,113,165, 49, 28, 10,155,174, 71,195, 25,197,195, 38, 52, 74,139,184,208,200, 26,112,213, 24, 15,101,110,116,183, 43,
+ 60, 49,221, 72,197, 17,146,197,250,214, 25,146,115, 84, 45,196, 96,103,183, 56, 71,140, 29,178,187,195,156, 18, 65, 76,220,235,
+218,210,229, 99,204,140,219,192,161, 91, 66, 29,183,123,249,106,241,217, 77,155,217,145,235,114,230,208,184,184, 26,216,100, 93,
+ 80,224,134,192,118,126,209, 92,233, 82, 28, 44,  5,130,252,137, 52,202,127,212, 72, 63,143, 19,181, 84,154, 91,196,216,175,233,
+238,173,149,101,173,216, 22,178,232,107,246,168, 55,236, 28,157,138,185,189, 90, 99, 30, 50,210, 50,174,  5,166,170,120,205,116,
+ 46, 48, 81,137, 65,  9,185, 49, 42,184,  0, 50, 28,  8,163,208,238,238, 24,175,110,104, 99,196, 79,153, 76,129,184,166,247,149,
+169, 22,218,190,210,173,132,236,  3,165, 90, 28, 49, 20,164, 69,156,116,140,227, 13,174,122,210,230, 30, 91,255,194, 26,214, 34,
+109,  9,  5,104, 11,117, 76,150, 49,136, 24,203,176,122,102,169, 11, 73,203,163,106,194, 56,117,186,112,224, 45,185, 76, 17,242,
+108,229,157,248, 70,201,109,201,240,118,230,223,107,150,103, 94,213, 80,173, 42, 66,244, 98, 23,179,218, 97,105, 64,216, 37, 58,
+178, 84,252,130,147, 47, 57, 35,152,205,201,184,229,203,222,168, 85, 66,180,255,162,106, 33,104, 48,216,138, 90,106, 90, 12,102,
+  9, 17, 89,180,  0,106,106,112,171, 84, 26,130,  5,180,212,102,144, 25,175,144,  9, 84, 49,133,122, 39,193, 72,121, 46,216,174,
+ 90, 10, 65, 28,117, 89, 71,184, 86,152,113, 70,186, 10, 97,121,145,100,168, 66,109,194,196,145,213,217,  9, 39,187,158, 47,158,
+ 31, 64, 34, 72, 36,248,132,151,132, 40,196, 20, 24,166, 27,156,203,188,245,240, 29,130,  4,222,250,206,175,241,173,239,188,203,
+225,226, 41,251,253,158,195,151,159,241,242,179,159,240,  7, 63,252, 30,215,163, 61, 22, 85,213,158, 76,170, 52,181,199,207,161,
+180, 98,226, 45, 87, 27, 85,148,206, 37,186,205,150,224,  3,211,120, 68,219,204,118, 19, 40,173, 49,141, 19,121,217,177,123,196,
+198, 66, 33,176,238,172,251, 24,231,145,216,111,217,244,  9, 92,197,183, 30,164, 18,150,168,200,203,171, 43, 74, 89, 28,  7,192,
+205,245,129,175,127,237,107,188, 59,188,195,143,126,242,179, 69,131, 33, 16, 28,223,252,206, 55, 56,233,123, 46, 94, 94,178,191,
+ 57,112,117,125,201,211,231,207,193, 11, 15,239, 62,224,237,199,247,225,107, 31, 48,238,  7,110,110,174,249,228,211, 79,184,217,
+ 23,230,253, 64,244,112,121, 56, 48,141, 32,154, 57, 78,  3,226, 29,125,236,113, 26,168, 10,125,138,172,187, 68, 12,189, 89,149,
+182,137,241,248,146,139,207, 44,112,103,127,179,231,249,139,231, 76, 83,  6, 28, 62, 69,230,185, 80,231,204,126,244,108, 55, 43,
+ 58,231,153,106, 35, 43,  4,181,140,100,164,190,138, 93,  5,139, 21,110, 13,124,115, 20, 10,165, 10, 83,158,240,226, 88,119,145,
+ 63,243,237,  7,252,253,239, 61,225, 15,254,175, 31,241, 43,239,188,207, 55, 63,248, 58,127,249, 47,253,139, 12,245,132,224,122,
+198,203, 11, 82,105,184,228,152, 60,204,243, 96,222,226, 16,  9,206,115,147,133, 58, 43, 74,177, 44,109, 15, 58,217,244, 41,174,
+206, 41, 37, 25, 42,203, 85,243,101,123,199, 56,100,134, 50, 46,211,175,184,112, 34, 20, 31, 19, 65,  3,195, 92,169, 94,  9, 49,
+113,255,206, 67,166, 86,121,250,249,167,203, 62,218,163, 57, 19,188,183, 44,185,166,116,222,166, 74,125,191, 33,134,158,185, 94,
+ 81,105,104, 57,226,124, 96,149, 78, 56,221, 69, 68,225,187, 31,189,228,250,112,228, 48,212, 87,212,198, 90,231, 37,226, 23,154,
+ 55, 70,130,180,196,157,179,  7, 60,186,247,  6,155,179,192,163,147,158,210,132, 95, 62, 63,242,120,149, 56, 59,223, 49,236, 95,
+160,195,129,233,234,192, 23,159, 21,210,234, 37,135, 60,131, 95, 49, 14, 51,218,135,101, 45, 55,162,197, 47,137,104,202,160, 19,
+204,222,248, 18, 65, 24, 25,104, 37,208,187, 13,158,138,143, 27,170, 38,142,135,193,  4,116,222,184, 26,136,167,239,122,230, 84,
+ 40,213, 47,136,224,158, 68, 67,104,136,132,  5,113, 61,147, 82, 79,105, 19,110, 74,230, 83,151, 68, 99, 32,137, 99, 44, 30,173,
+141,224,237, 82,236,220,218,176,217,109, 68, 81,106,105,168,115,132,174,195,213,129, 57, 57,186, 10, 61, 61,185, 78,116,155,142,
+168, 19,115,234,240, 45, 80, 14, 13, 31,204, 90,220,170,  7,173, 84,239,160, 22,163,138,137,237,253,107, 85,156,170, 21, 99,139,
+238,105,182, 58,140,152,149,187, 15,118,188,245,230,217,255,111,167,121,251, 81,249,135,239,220,162, 44,107, 87,187,120,199,253,
+ 72,189,153, 77,151, 36, 66, 11,145,129,100,  5, 66, 53, 64,166, 43,183,144,171, 91, 84,237,130, 28, 95,244, 59,218,204, 98,251,
+ 42,237,173, 53,230,121,164,212,140,168,146,171,240,236,233, 21, 93,215,153,243, 69, 12,101,125,107,165,230,150, 63,249, 39,238,
+102,113,242,170, 89, 84, 93,236,126, 98, 25, 38,195,113, 38,207, 71, 67, 80, 87,133,121,132,228,151,239,235, 79, 15,207,153, 43,
+148,105,166, 84,165,169,217, 72,195, 86,104, 71,111,171,236, 60,225, 69,200, 10,117,182,213, 92,108,153,144,149, 57, 22, 82,113,
+ 20, 85,142,229,248,138, 73,144,189,218, 84,172,193, 44, 13,154, 48,107, 35, 20, 71,159, 42,163, 40, 20,101,118,183,193, 93, 74,
+112,150,236,153,135,  3,103, 49,227, 31, 60,122,248,123,222,133,197,198,102,135,151,138, 95,130,  3,150, 42,240,182,189, 94,148,
+143,183,151, 47,226,190, 34,209, 97,187,233,133,202,106, 66, 58,181, 11, 95,151, 75, 94, 23,219,148,168,169,202, 87,169,179,224,
+ 11, 53,242, 91,109, 74,116, 14,213,106, 23,214, 98, 73,105,234, 22, 21,178,195,123, 12,107, 42,193,198, 70,218, 44,130,209, 41,
+ 78,130, 65, 75,104, 36,139,102, 55, 85,120,144,101,236, 47,184,102,169, 89, 96,187, 99,239,156, 41,100, 29,  8,  6,198,175, 82,
+137,222, 68,100, 78,176,253, 48, 54, 70, 12,201,219,180,194,155, 71,190, 45,191,120, 28,120,156,  9,226, 22,177,153, 81,245, 60,
+ 49, 38,106, 25,121,126,113,133, 72,100,189,222,208,  5, 71, 43,153,174, 91,113,239,193,  3,250,205,  9,170,149,235,171, 75,234,
+ 48,113,247,108,203,131,251, 15,185,255,246,187,188,241,238,  7,228, 44,124,242,233, 47,249,201, 39, 31,243,252,217,149, 85,190,
+209,219, 67,180,128,128, 74,177,195,239,235,223,254, 22,247, 31, 62, 34,117, 29,211, 56, 24,199, 91, 27,227, 52,146, 23, 26, 84,
+244,176, 90,245,156,238, 54,244,169, 71, 85, 88,237,118,156,156,159,176, 89,239,216,118, 61, 77,149,185, 40,119,223,120,135,135,
+247,206, 77,172,184,106, 12,211,145,208,237,208,241,146, 95,252,242, 51,166,209,162, 38,213, 65,169,149,251,247, 31,242,198,155,
+111,114,189,127,193, 48,205,164,184,162,204, 51, 33,194,227, 55, 30,242,248,237, 55, 57,223,109,249,242,139, 39,220, 28,  6,112,
+142,151, 23, 23, 60,249,236,  9,187,147, 19,222,120,248,208,162, 34,155, 26,243, 29, 97,174,133,227, 48,129, 56,110, 14,123,174,
+174, 15,172,214,107,222,120,243, 62,119,183, 59, 82,180, 24, 92,159, 12,189,219,196,115,125,115,195,229,205,  5,157, 19,174,111,
+  6, 78,238, 60,224,229,203, 23,148,102, 23,161, 29,148, 66,173,102,255,203,165, 80,166, 98, 33, 68, 18,113, 98,  1, 45,173,129,
+ 20,133, 38, 12,243, 76,201,213,220, 21,185, 46,217,210, 86,124, 58,113, 28,198,137,171,235,145,155,235,137,144,148,247, 62,120,
+204,183,190,253, 53,226,234,156,139,203,198,112,113,193,148,143,236,247,123, 92, 16,178,216,228, 39,186,  0, 45, 82,242,196,156,
+ 51,165, 88,219,100, 41, 83, 19,101,158, 72, 33, 17,250, 13,222, 11,222, 55,164, 21,234, 88, 40,181, 49,204,149, 86, 44,244, 36,
+136, 17,186, 42,153,237,106, 69,140,129, 92,  7,218, 56,210,180,177,233, 58,222,125,252, 54,155,211,251,236,135, 61,165, 14,  4,
+231,  8, 18,150,253,230, 66,123,212, 74, 90,237, 16,239, 32, 79,148, 90,205, 97,239,  3,190, 58,166,185,240,226,122,230,234,242,
+200,116, 28,  9, 73,105,165,216,254,181,217, 36, 32, 72, 71, 21, 19, 97,238, 54, 39, 60,126,244, 62,247,222,190,199,174,131,221,
+249,142,187,247,119,196,216,179, 61,181,204,129,146, 11,115, 61, 82,134,145,235, 43,161,210,232, 92,227,221,119, 31, 50,236, 51,
+151,215,  7,180, 89, 32, 84, 30,  6,139, 68, 13, 88, 66, 90,131, 78,  4,233,108,218,103,145, 79, 35,213, 53,242, 40, 16,101,153,
+ 52, 57,230,  6,173,  6,154, 88,211,161,179,185, 85, 66,168,212,217,138,225,220, 34, 41, 89,204,110,157, 10,165, 85, 60,149,144,
+ 28,121,202,136, 55,  1, 75,238, 34,174, 90,100, 98,110,133,218,175,104, 56,116,188, 49, 93,207, 18, 88, 37,193, 88, 30,165,245,
+244,201,145,107,123,  5,190,114, 41, 26,251,125,242, 16, 77, 91,164, 96, 33, 81, 75, 98,162, 79,150,119, 33, 44, 46, 26,167,198,
+204,144,136, 72,193,  7,155,136,136, 95, 48,204, 18,120,240,240, 14,235,205, 63, 26, 18, 35,127,226,221, 45,231,246,237,123, 16,
+ 22,129,163, 88,136, 85, 23,201, 83,163,149,194,170, 75, 60,124,120,151,237, 58,177,234, 35,171, 85,100,213,  7,186,206,147, 58,
+139,244, 77,157, 39, 38, 79, 74,129,152,  2, 33,121, 66, 23,240, 41,154, 35,164,143,184, 62,209,188,241,249,117, 17, 25,167,205,
+ 22, 77,  9,245,129,134,163,122, 79, 21, 71,105,194, 92,117, 17,167,218,159,167,220,152,138, 50,230,202, 48, 21,142, 99,230, 56,
+ 20, 14,199,204,229,229,129,195,225,102,  9,137,177,216,220,225, 48, 49, 28, 38,198, 97,102, 60,142,204, 99, 38, 79,153, 60,216,
+223,149,113, 34, 79, 19,101,154,152,198,153, 60,204,148,188, 64,188,166,153,121, 63, 89,128,202, 52, 50, 30,  7,190,120,250,146,
+227,225, 37,195,184, 71, 71,115, 33,169, 52,230, 99,  5, 95, 76, 48, 78, 32,123,135,132,138,159,  7,142,181, 18,187,142, 24,  3,
+ 55,147,208,234,132,159,149,222,245, 20,153,  8, 90,168, 33,224, 93, 68,115, 37,165, 70, 17, 75,127,108, 82,104, 89,240, 45, 17,
+214,188,178,161, 91,127, 42,212, 92,120,127,151,240,247,238,220,249,189,175,124,204, 86,233,249, 37, 64, 64,151,165,138, 91, 46,
+114, 67,163,187,165,250, 90,112, 38,134,144,166,213,102, 35, 95, 28, 34, 16, 23,155, 69, 91, 58,111,135,113, 98,197,155, 71, 92,
+150,125,141,143,158,162, 38,124,233,130, 91,252,204,242,138,191, 87,155,121,149,253,146,115,126,235,163,111,230, 91,179, 31,  8,
+ 11,185,112,222,189, 10,163, 65, 27,205,217,206,188,137, 91, 20,161,246,189, 53,111,150,175,144, 28,174, 45, 69,155, 26, 98,209,
+214,  4,142,232,108, 52, 85, 53, 24, 49, 46, 57,186,219,157,129, 87, 60,  1,137, 66,155,117, 17,166,  4,188, 26,  4, 55,168,199,
+  5, 79, 86,240,  5,250, 24, 89,245, 61,215,135,107,166,169,145,130,178,233, 87,228, 54,146,235,136,107, 22,247,233,125,135, 91,
+245,  4,223, 49,207,215,252,228,  7,223,229,217,139, 47,233,200,196,205, 57,119, 30,172,248,232,251,127,192, 39, 95, 92,153,149,
+199, 69,250,110,133,119,150,231, 29,119,119,248,215,255,205,191,198,223,248,247,126,151,127,229, 47,254, 38,191,243, 23,255, 89,
+ 90, 59,242,135,223,255,163,165, 42,206,228,178,176,197,113, 84,189,253,157, 56, 98,234,185,123,231,140,147,205,150,180,218,114,
+126,118,194,246,100,199,189,179,123,156,159,158, 88, 50,143,183,181,138, 79, 91,222, 56, 63,227,217,179, 79,121,118,121,109, 47,
+ 74,177,131,135,106,  2,144,  7,143, 31,114,178, 91,115,253,226,146, 90,237,121,115,184, 60,114,117, 24,120,252,246,125,142, 55,
+151,252,224,199,127, 76,189,101,253,151,202, 48, 12,148,150,185,251,232, 17,117,168,140,135, 27,182,155,142,208, 71, 98, 88,209,
+199,142,195,225,136,143,158,225, 56,114,239,238,125,190,246,254,175,112,247,222,150,198, 76,153,103,114,109,120, 15,199,155, 61,
+ 47,159, 63,103,200, 51,207,111,110, 24,143, 71, 78, 78,214, 92,223, 92, 47, 74, 91,165,212,106,153,  7, 77,161,154, 37,173,121,
+111, 48, 15,105, 70,137,107,182,218,192, 59,180, 86,230,146,151, 40,219, 74, 94,138, 94, 89, 10, 92,113, 30, 26, 28,110,102,124,
+ 16,250, 46,240,248,225, 29, 78, 54,247,120,242, 44,114,125,117,164,140, 95, 50, 92, 31,237,113,168, 21,239, 61,211, 52,113, 51,
+141, 20,173,228,169, 48, 59,103, 36, 69,133, 92, 42,195,176, 39, 32,164,213, 22, 33,225,157,210,106,166,228, 76,169,150,220,229,
+131, 46, 45,151, 91,132,156,134,151,245,253,154, 16,133, 90,143,204,211,136, 84,216, 31, 15, 56, 31,184,119,255, 62,226, 26,195,
+112,164,210,200,181,225, 22,226, 92, 45,133, 24,123,240,137,220, 38,188,152,230, 33,  4, 79,115, 48,207,149,253, 48, 51, 77,  5,
+218, 68,171,  6,132,114, 10,165,141, 54,118, 15,130,106, 33, 74,192,209,241,230,131, 71,124,227, 87,223, 97,155, 44,245,113, 60,
+ 58,250,184,229,222,195, 83,186, 46,217,101, 29,149,208, 60,174,235,249,242,249, 37,135,203,145,206,  7,214,169,160,209,115,184,
+ 82, 90, 44, 20,173, 76,163, 21,245, 78, 29,109,114,116, 33,176, 94,226,162, 55,201,155,176, 75,  4,207, 26, 23,102, 86,193, 81,
+103,165, 69, 72,161, 26, 18,155,138,235,148,218, 26, 65,133,168, 86, 64, 74,115,116,189,117,191,130, 71, 52, 64,170, 72,140,168,
+ 88,226,164, 11,144, 86,167,116, 40, 78, 51,205, 67, 46,  5, 45,141, 46,206,118,234,169, 16,250, 21, 37,  5,  2,141, 30,103, 10,
+229, 26, 72,125,194,225,241,197, 81, 66,199, 92,192, 55, 19, 98, 38, 47, 36,139,207, 68, 59, 72,192, 56,101, 43, 18,156,199, 97,
+185, 12,194, 87,129, 47,174,217,231,199, 85, 79,200,129,212,  7,238,222,187, 99,137,142,127,106,134,186, 48, 13, 35, 85, 43, 39,
+155,142,126,189,250,255, 20,  6,242, 79, 40, 20,156, 13,236,240,206, 62, 38,103,231,255, 60, 84,106,201,156,158,108, 56, 63,223,
+177, 74,193,136,117,157,167,143,206,222,147,197, 23,119,157, 21, 15, 93, 23,232,251, 72,223,  7,186, 62,146,250, 68,215,119,116,
+235,142,180,238,241,235, 53, 85, 77,248, 75,169,196, 46,176,190,123, 23, 86, 27, 92,236,112, 41, 65,234, 80, 31,169, 62, 80,212,
+ 81,156, 39,227,153,170,103, 44,194,220, 28, 67, 17,134, 25, 14,147,114, 51, 76, 92,141,149, 23,251,137, 47,159,239,185,188,184,
+102,154,247,104,158,192,121,107, 86,167,138,243, 80, 68,209,172,140,243,136,159, 51,154, 76, 56,222, 52,163,218, 33,185, 89,241,
+138,163,182,153, 90, 50,146, 43, 89, 42, 94, 86,  6,223, 90,157, 48, 14, 35,117,178, 72,239,226,147, 77,151,187,106, 25, 35, 26,
+ 77,243, 86,102,188, 20, 82,220,176, 97,143,127,227,222,195,223,179,137,187,162,  8,226,189,237,153,197, 50,201,157, 91, 16,163,
+106,195,234,224,151,174,188,216,206,182,138, 26,182,113, 25,151, 88, 70,136,179,108,245, 96,104,187,  0,148, 96,157,135, 44,244,
+119,231,109,132, 45,128,107,186, 16, 74,101, 73,100, 83,164, 54,243, 75, 47, 99, 97,179,176, 45, 57,233,183,164, 87,  7,209,252,
+117,214,121, 53,235, 94,108,231,105, 83,  4,191,116,213, 96,223, 71,173, 95,237, 86,196, 89, 84,167, 44,118,  7, 39,134,135,165,
+ 46,150,141,104, 83,136,218,172,144,136,113,169,160, 22,207,169,248, 37, 21,110, 25,205,222, 82,248, 84, 77,184,231,112,172, 16,
+ 52,  9,161,239, 57, 59,217,114,115, 99,213,227,148,139,173, 33, 26, 76,211,200,241,120,205,113,216, 83,230,204,189,187, 15,121,
+248,214,  7,156,116, 61, 63,253,225,247,248,201, 71, 63,  7, 63,242,131, 63,248,125,254,222, 63,248,152, 42,222,172,108,181,154,
+ 37,135,198,155,239,125,131,191,254,215,255, 29,254,202,111,127,139,144,143,180, 92, 72,171,200,183, 63,248, 26, 95,252,252, 83,
+ 62,254,252, 57,125,215,225,150,112, 17, 89,170,191,172,134, 33, 61, 57,221,209,167, 68,242,145,213, 58,178, 57, 93,115,122,114,
+138, 95, 39, 84, 39,202, 84, 89,173, 55,148,220,112, 84,206, 78,  2,159,127,249, 57, 95, 62,187, 96, 86,179,104,120,111,235,142,
+171,235, 27,198,121,224,195, 15, 62,100,188,222,115,152,  7,162,120,136,198,236,127,231,237,119,121,254,236, 25, 79,190,120,106,
+ 19, 18,103,156,249,224, 28,227,116,196,105,228,124,119,135,156,175,217,110,118,164, 16,217,238, 54,156,110, 18, 55,251, 61, 95,
+251,214, 55,113, 14,162, 68, 30, 62,184,143,115,141,225,120, 88, 82,164, 50,109, 86, 91,187, 44,248,201, 86, 32,151,198,139,139,
+ 11,166,121, 88,  2,100,228, 85,180,172, 44,153,187, 90,219,226,107,109,212, 60, 81,170,208, 90,161, 21, 37,  3,185, 54,234,156,
+ 13,201, 41,183, 92,  3, 43,134, 83, 88, 89,119,228, 60,234,205, 94,184, 90,117,164, 92,217,187, 13,115,233, 56,188,120, 66, 29,
+ 38,174,135, 75, 52,170,217,204, 71,165, 58,115, 86,152,232,212,190,158,175, 22, 45, 90,138, 64,203,196, 85,194,117, 61,205, 57,
+106,153,208, 82,240,106,162,189,213, 42,226, 83,135,230, 66,211,178,240, 30, 50,206,175,209,172, 68, 42, 53, 15,140,227,104,244,
+ 68, 96,156, 38,142, 55, 47,233,227,154,199,247,222, 32,109,119, 28,199,137, 50, 15, 70,121,140,129,184,218, 81,107,163, 21,211,
+ 76, 88,225,188, 36, 32, 10,139,205, 84,192, 69, 74, 81,124, 19,240,141, 86,236,146, 79,190, 55,151, 73,244,172, 87,103,124,240,
+222,187, 60,122,123,205,137,131,126,221, 35,210, 49,221, 20, 36, 57,124, 52, 36,109,201,  7,134, 23, 35, 97,157,216,110, 18,222,
+141,252,209,143,126,193,207,158, 28, 56, 54, 97, 40, 19,174, 10,142,128,143,142, 94,160,120, 15, 97,178,137,139, 23, 66,112,144,
+193, 37, 33, 38,135, 74, 38,108,182,172,162, 51,187,225, 40,120, 85, 36,  8,248,104,107,  7, 93,194, 63,234,104,188, 74, 73,134,
+ 39,110,133, 58, 91,102, 54,193,211,240,120, 85, 66,231,  8,120,106, 19,198,113,228,168, 51,177,235,240,165,177, 90, 34,132,189,
+ 23,134, 86,105,213,206, 17,170,199,167,158,232, 50,181, 75, 48, 10,205, 55,226, 73, 79,158, 42,189, 23,168,149,169,206,164,149,
+ 35,182,  4, 78,137,206, 10,169, 92, 33, 32, 68,187,237,141,205,239,150,117,232,114,195, 58, 48, 43,162,179,136,223,251,247,238,
+ 16,187, 63, 61,204,101,174,  6,158,105, 37,115,178, 93,189,150,175,105, 59,117, 24,134,  9,167,149,221,166, 39,252, 99,192, 51,
+255,184,226,193,203, 87,197, 66,116,208,  7,161,168,144,167, 25,218,196,195,187, 39,156,156,110,217,116,158,117,231, 89,117,158,
+ 62, 57,250,228, 88, 37,199,186, 15,175,222, 55,235,192,122, 19,217,109, 34,219, 77,100,187, 77,108,182, 29,155,147, 53,219,179,
+ 53,103,103, 59, 54,247,206,193,175,201,227, 68,153,247,104,173, 72,177,  9, 51,  9, 90,245, 72, 41,100,173,140,197,138,150,178,
+ 76,164,167,155,140,110,236,130,214,227, 68,213, 70,231,122, 74,107,204,205, 33, 19, 84,205,196, 97, 92, 86, 41, 29, 77,  7,252,
+ 58,209, 74,161,150,137,166,182,146,118, 90,169, 42,228, 16, 41,120,158,239, 39,252,131,135,143,126, 79,124,131,  5, 98,128, 10,
+ 34, 13, 13, 54,246,241, 75,104,189, 56,143, 91,168, 73, 44, 59,245,102, 24, 55, 68, 45,198, 77,157, 45,101,162,247,198,152,118,
+ 30, 89, 40,107, 96, 59,110, 83,181, 11, 81,236, 42, 85,183,236,182,151,110,217,246, 45,183,  9,108,206,  8, 87,118,163,211,165,
+100,  0, 19,167,120,231, 89,210,210,  9,161,179,156,246,219,112,  0,189, 77,150,211, 87,208,156, 16,172,139, 44,185,190, 42, 96,
+168,203, 62,122, 25, 12, 56,231,240,205,170,251,234, 45, 59, 86,154,197,192,246, 97,  5, 98, 60,103,156,154, 74, 60, 23, 27,139,
+168,249,187, 69, 45, 18,182,121,251,206, 99,178,180, 53,145, 64, 31, 60,187,110,203,241,230,154,253, 97, 98,125,114,143,147,211,
+ 83,202,156,209,133,254, 20,  4, 92, 43,236, 47,159, 50,220, 92,225,220,204,151, 55, 95, 16,107,224,242,211, 79,249,222,143, 62,
+226, 80,213,210,223, 98,183, 88,158, 70,170,235,249, 15,254,195,127,159,127,233, 55,222,101, 62,140, 38,110,162, 80,242, 64,234,
+ 18,239,191,243,152, 63,252,238,143,185,216,143, 70,156,115,  1,109, 13,159, 18,235,110,197,233,110,205,106,189,166,239,123,182,
+119,206,217,116,137,147,245,134,232, 60, 85,148, 85,218, 18, 67, 36,173, 12, 79,185, 91,159,210,230,107,126,241,249, 23, 12,199,
+197, 42,229, 29,206, 69,212,119,132,224, 56, 94,223,176,219,110, 24,246,  3,199,113,178, 75, 59, 38, 84, 51,243,112,228,229,243,
+231,220, 28,167,197,190, 40, 75,154,158, 51,251, 84,115,220,191,123, 70,169,149,232,  2, 83,206,104, 16,214,235, 53,167,119, 31,
+208,117, 61,165, 78,116, 41,242,232,205,251,160, 19,151, 87,215,148,102,118, 50,113,  1, 23, 87,182,167,155, 71,139,188,117, 11,
+ 61, 80,172, 56,149,224,113,237,118, 39,119, 75, 68, 52, 45,137,162,139,144,208,166, 69, 45,207,214,209,171,233, 21, 68,160, 58,
+240, 75,177, 43, 46,210, 69, 79, 72, 43,206,118,167,196,224,153, 74, 97,157, 34,253,250,132, 59,247,191, 73, 42, 55, 72, 61,240,
+242,230,134,161, 14, 52,223,  8, 18,  8,190,103, 46,163, 37,127,249,158, 90, 26, 18, 10,173, 20, 90,109, 28,231,129, 76, 37,208,
+  3,182,114, 74, 18,160,201,130, 29,134, 85,220,210, 66, 48,194, 84, 21,155, 76,137,199, 57,235,234,109,213, 84,185, 26,110,152,
+234,104,136, 85, 21,246,135,145, 74,227,222,105,207, 91,247, 31,208, 66, 98,191, 63,146,231,  3, 82, 27,158,176, 28, 86, 19, 46,
+ 56, 75,253, 90, 82,193,196, 71,156,  4,212, 11,173,216, 84,171,  5,112,165, 16,125,193,119,  9,151,  2,181,  9,235,245, 25,223,
+124,247,  3,222,120,180,230,116, 19,241, 93,226,238,227, 59,244, 39, 29, 55,121,230,217,231,  3,135,171,129,221, 46,224, 93,165,
+230,  9,215, 43, 41,118, 28, 94,222,240,252,122, 70,214,103,180,  2,105,213,209, 26, 68,159,169, 62, 83,112,180,121,198, 53,165,
+ 54,143,139,202,170, 91, 89,144, 71, 89,130,163, 16,242,208,200,227, 76,  1,124, 85, 92, 92,118,182, 65, 40,206,145, 39,195, 44,
+207, 75,161,226, 92,180,159, 31,136,146,168,206, 25,158,121, 65,111,149,102,175,213,216, 10,213,173, 88, 57,143, 91,214,146,246,
+123, 90, 44,104,206,163,179, 96,112, 96, 65,235,140,111,106, 36, 48, 28, 73,  2,179, 36, 18,230,164,193, 37, 86,106, 83,147, 42,
+ 14, 23, 77, 75,129,218,227,222,197,101,175,120,203,131, 23, 67,252,138, 55, 59,169,147, 96, 93,188, 15,172, 87, 43,238, 63,188,
+135,127, 13,158,242, 97,170, 76,227,  4,173,178,123,141,212,183,220, 96, 56,152,166,100,187,219,252,169,227, 97,255,161, 88,212,
+169, 48, 30, 71,188, 86,238,156,159, 32,225,159,236,215,255,147,133,194,171,105,195, 82, 52, 68,  7,105,249,184,246, 48, 52,225,
+234,226,134,121,191, 71,107,163, 46,113,229,180,106,141,132, 42,157,  4, 82,242,148, 42, 28,243, 72, 63,117, 56, 63, 49,215, 70,
+200,137, 16, 60,210,102, 74,  7, 18, 35,169, 22, 38, 21,208, 25, 47, 21,122, 53,155,236, 48, 17, 75, 97, 21,149,140,129,164,214,
+ 33,152, 59,171, 63,129,210, 51,177,231,205, 93, 36, 32,149,214, 22, 53,187,242, 85,184,198, 34,122,168,206,246,228,210,110, 19,
+208, 60,117, 25,177,138,103,  9,113, 97, 33,204,153,106,188,136,169,233, 75,201, 11,222,193, 66,223, 45,245,205, 81,203, 45,221,
+199, 68, 20,  6,112, 84,195,132, 98,124,111, 19, 68,120, 16, 37, 44,137,106,181,153,154,182, 52,  8, 65, 22,240,141,  9, 55,112,
+186,188,108, 28, 41,154,160,164, 84,161,121, 33, 74, 51, 69,120,185, 37, 80, 41,209,123, 52,207,228,214, 72,105,189,112,239, 61,
+141,108,244,181,165, 24, 72,193,178,142, 91, 40,102,199, 41,118,176, 78,210, 94, 69,134,118,234,104, 62,152,136,132,102,236,104,
+129,190, 24, 60,  4, 87,169,  8,173,206, 28,167,137, 89, 60,247, 79,206,185,127,255, 46,190, 21, 94, 94, 94, 44, 63, 67, 88, 58,
+ 72,120,118,241,140,227,120,195,152,  3,111, 60, 56,227,234,242,151,220, 76,121, 17, 31,217,129, 30,165,210,210, 61,222,122,251,
+ 49,127,247,239,252,159,252,133, 63,243, 87,145, 78,105, 35,168,244, 56, 95,201,121,224,253, 15,222,224, 27,239, 61,230,151, 95,
+ 94,130,119,196, 24,217,222,221,176,233, 35,193,245,156,158,173, 72,146,232,226,142,176, 78,244,193,130,115, 92,170,132, 57,130,
+ 91,211,111,173, 11, 95,167,153,249, 40,252,252,249, 37,115, 73, 60,120,227, 45, 54, 65,105, 20,230,106,228,189, 54, 79,204,165,
+240,211,143,127,201, 42,120, 66,240,212,172,120, 31,152,134,145, 63,254,232,151,134,127,245,203,220, 70,156,  9, 22,197, 30,243,
+237,201,  9,  5,232,186,181,189, 32, 80,186,117,199,234,164,167,140,214,121,237,118, 27,152, 29,201,247, 92, 92, 63,103, 56, 78,
+116,125, 34,246,137,221,106,199,113,158,  8,105,197, 80, 39, 14,  7,131,121, 36,239, 45, 80,168,216,184,221,185, 64, 91,124,254,
+141,106, 47,226,106, 59,157,134,195,181,140,182,180, 68, 10,219,138,196,  2,123, 20, 45,183, 98, 79, 80,173, 52,223,115,178, 90,
+177, 94,119, 60,136, 43,126,249,188,114, 28, 10, 97,119,159,162,153, 33, 31, 57,150, 66,  0,238,164, 29, 51, 51,199,170,108,188,
+176,233, 18, 67, 83,186,170,212, 62, 49, 79, 25,170, 50,101,168,121, 38,  4, 15,  8, 69, 43,169,121,112,145, 20,  3,115, 27,233,
+ 83,178,248, 98,245,108, 54, 59, 92,218,114,115,245,153,241,206,117,109, 28,  6,154, 77,210, 74,101,156, 27, 45,143,236, 54, 74,
+151, 86,236,175, 95,242,211,159,141,244,187,103,172, 54,107, 30, 61,120,200,179,103,149,113, 26,200, 53,219, 52, 14, 72, 98,108,
+247, 44, 13, 23, 32, 16,240,113,133,150,153,230,102,187, 80,117, 54,  6,128,243,  6, 78, 17,193,199,196, 59,111,191,207,183,254,
+236,123,108,182, 51, 93,220, 48,143, 19,211,113,198,247, 59,238,223,201,148,242,156,151, 47, 43,233,163,137,247,191,117,135,185,
+247,228,171,153, 43,119,224,103, 31, 95, 80,226,  9,109,  1,158,232,172, 20, 13,104, 25,168,218, 40, 89,204,189, 35,158,216, 59,
+ 92, 76,150,245, 80,133, 89, 29,157,243,100, 49,237, 12, 45, 82,170, 69, 10, 19, 77,217,149,  7,177, 46, 64, 33,250, 74,  8,107,
+152,171, 97,117,151,213,155,186,108, 78,132,206,108,110,178,164, 81,206, 17,210, 42,194,116,131,234, 26,173, 51,138,163,104,194,
+135, 74, 20,143,150,136, 44,214,216,220,102,146,236, 96,101,132,185, 54, 59,198,156,113,162,100,154,157, 85,173, 65,232, 32, 15,
+204,181,177,  9,145, 89,103,124,138,248,232,201,197,198,237, 18, 76, 23,  3,213, 72,155, 62, 24,143, 64,218,114, 17, 57,186,206,
+156, 25,175,197, 26,134,105, 71, 66, 16,124,138,175,237,226,173,165, 45, 77,221, 45,173,244,245,121,212, 91,177,199,181,139,193,
+180,  7,175,249,173, 85,181,228, 68,191,240, 33, 90, 69,130,233,114, 18,129,227, 52,115, 83,141,179,162, 69, 23,174, 64,161,115,
+171,165,  0,152,  8, 81, 16, 58,110, 40, 36,105, 20,102,116, 22, 90,104, 12,110,198,143,  9,131,163, 87, 74, 78,224, 97,  3,148,
+208,147,157,167, 21,197,181,136,151,204, 73,238,249,173, 15,215,132, 82,111, 35, 49,205, 59, 29, 92,176,113,206, 66,248, 81,113,
+214,141,160, 20,  5, 89, 70,243,186,168,203,189,243,136, 19,156, 26, 76, 85,  4,196,235,146,129, 14,206, 85, 43,  6,212, 64, 50,
+246,103,168,232,146, 41,155,161,120, 91,213,  7,135, 22,139, 54,173, 78,241,193, 84,222,218, 26, 78,162,177,169,189,165,206,228,
+ 86,137,139,160,163,214, 98,149,113,187, 21,248, 88,122,147, 75, 38, 94,114,234, 17,  7,115,172, 72,109,104,109,168,171,132, 20,
+169,185,161,217, 32, 34, 57, 52,156, 43, 84, 21, 74,117,132, 20,200,106,151,121, 34, 82,165,124, 53,122,172,197, 88,240,197,155,
+186,183, 22, 19, 26,181, 70, 11,245,149,141,193, 45, 79,214,166, 80,231,153,195, 52,227, 37,112,125,241, 37,219, 62,176,234, 54,
+220,121,176, 33,250,153,139,103, 47, 40,179,210, 42,164,109, 79,215, 37,198,195,200,243,171, 47,185, 57,238, 77,  3, 80, 61, 77,
+ 27,181, 21,142,227,204, 95,250,151,255, 10,127,227,223,250, 29,254,227,255,232, 63,225,191,254,239,223,228,223,248,221,223,160,
+205, 47,237,178,242, 43,132,202,122,115,202,155,111,158,177, 93,117,108,182, 91,250,205,134, 62,117,  4, 47,172,214,103,220, 59,
+ 59, 33,117,194, 60, 52, 66,100,201,225,246,140, 83,195,213, 21,226,102,110, 14,141,243,  7,111,113,156, 47,248,228,243, 79, 57,
+142,123,186,126, 75, 20, 37,172, 34,226, 58, 98, 93,146,238,216,224, 41, 92, 29, 39,168,158,211,221, 57,234,205,215, 61, 28, 54,
+ 28,143, 55, 12,243,180,224, 44,141,182,213,128,205,106, 69,153, 27,167,247,206,113, 17, 43, 19, 23,123,204,219,239, 60, 32,120,
+225,201,103,  7,162,143,132, 24,160, 54,106,221,115,125, 24,184,222,103,118,222,115,186, 90,179,223,239,153,139,210,175,122, 54,
+221,134,195,245,136, 56,115,110,136,150,197,146,  9, 97,233, 88,231, 86,209,234, 76,  8,154, 26, 14,191, 28, 47, 14,  9, 11, 97,
+176, 42, 42,142, 16,  5,173,246, 60, 22, 39, 84, 10,222, 41,201,153,112,165, 41,212, 24, 73,177,227,252,206, 57, 95,127,252, 14,
+194, 53,211,116, 96, 62,238,  9, 10,153, 76,155, 28,104,102, 63, 93,161, 62,161,185, 49,187,138, 82, 81, 81,124,234,201,135,103,
+ 84,173,116, 97,101, 97, 36,197, 67,202, 54, 61, 19,  1,  2,213, 45, 93,103,243, 76,181,224,196, 19,154, 50,140, 25,226,140,239,
+182,104, 25,137,209,132,157, 78, 61,121,174,220,204,123,242, 58,115,190, 59,101, 32,115,249,242, 11,226,133,227,108,123,138,119,
+ 17,200, 86,176,228,189,237,255,101, 77,194,155,127,127, 54, 81,102,220,217,212,199, 35,196,206, 47,171,141, 64,201,182,199, 68,
+ 29,111,220,127,131, 63,251,225, 59, 60,184,151,104,206, 51, 31, 70,194, 90,105, 67,195,249,  1,239,  2,119, 79, 87,108,210, 76,
+222,143, 92, 92, 29, 73, 93,194, 15, 35, 63,254,222,199, 12,242,136,205,170,163,181,153,169, 78,228, 22,236,119,132, 80,230, 72,
+214,  3, 94,130,141,207, 39,243,249,151,228,128,132,164, 66, 43,166,159, 17,175,196,149,167, 19, 33,207,129,178, 63,226, 66,197,
+151,206, 28,  0, 49,162, 90,168, 46, 27,222, 55, 66,161,210, 37,193, 31,148,161, 22,124,216,154, 18, 94,102,146,223,144, 91,227,
+112,172,  4,233,205,198, 43,129, 22, 65,114,198,109, 78,209, 92,200,243, 72, 73,158,208, 42,107,191,161,246,150,177,221,138,224,
+ 93, 36, 72,101, 82, 79,205,133,160, 17,223, 65,245, 66,118, 43,220,148,169,179,144,250,104,150,219, 90,140,203,224,154, 21,154,
+152, 32, 80, 17,122,111, 86, 67,154, 16,131,195,  5,177, 46,240, 53, 80, 98,116,153,158, 42, 16, 92,120, 45,157,255,171,139,113,
+153,134,134,232,241,225,117,126,221, 37, 32,212,128, 29,175,221,206,102, 96,155,130, 50, 67,173,203,207,209,152,114, 37,196,192,
+161,152,112, 90, 66,134, 49, 51,207, 16,189,154,102, 36,230,197,142,171,180,125,128, 20,112,195,204, 88,  3,174, 57, 98,191,  1,
+181,148,196,185, 40, 89, 70, 82,176,149,202,152,103,230, 32,168,172,144,146, 49, 14,236, 37,244,145,149, 95,113,231, 36, 18,236,
+146, 50, 10,154,107, 88,174,249, 50,242, 86, 23, 64,218, 50,130,183, 49,180, 51, 37,140,137,224,154,163,184, 37,110,208,142, 74,
+188, 51,241,156,  9, 88, 48,239, 57,246,249, 94,196, 84,142, 56,124,109,228, 10, 36,227, 50, 59, 28, 81,149, 64,179,124,118,183,
+168,203,139, 67,164, 25,127,190,217,232,255,150,111,220,100, 17,185, 57, 90,  7,173, 37,  0,  0, 32,  0, 73, 68, 65, 84,181,128,
+ 17, 85, 43, 56,170, 41,207, 99,180,197,126,203, 74,231, 29,109,174, 11,  1,206,212,242,165,154,216,207, 97, 48, 20, 22,171,157,
+ 69,189, 58, 84,138,141,249, 67,162,169,225,116, 53,204, 84,111, 12,102, 95,149, 37,  6,198, 58,241, 86,109, 20,182,  0, 92,154,
+131, 64, 38,164, 14,167,112,117,189,231, 48,102,130, 83,142,195,  5,191,248,197,145,211,237, 29, 30,127,248, 29, 86,238, 72,144,
+ 45, 58, 93,113,117,179,103,183, 10, 92, 13,151,212,234,168,217, 83,202, 18,153, 42, 48,205, 51, 89, 39,136,107,126,235,207,255,
+ 26,143,238,157,240,239,254,219,255, 42,255,233,223,252, 47,249,230,215,223,227,215, 62,188, 99,233, 64, 82,145, 84,248, 31,254,
+187,255,133, 31,254,236, 37,247, 31, 60, 98,189, 53, 59, 93,136,107, 86,155,196,157,237, 25,221, 18, 80, 83,251, 98,114,200, 34,
+ 72,128,121,170, 56,169, 22, 57,171,  6,  5,  9,113,203,201, 54,146,107,101,179,181,  9,135, 91,121,218,156, 23,123,160,141,123,
+178,192,102,221,211,170,163, 95,119,172, 86, 43, 27,251,215,130,211,198, 48,205,212,150, 49,183,124,228,249,151, 95,240,236,249,
+  5,105,189,226,237,199,239,194,152,185, 57, 94, 50,251,138,235, 18, 15,239,156,112,117,145,201,211,115, 66,178, 32, 19,239, 29,
+195,254,200,241,250, 96, 29,137,  4,174, 15, 19,215,215, 19,253,122,205,170,235, 89,199,192,254,230,200, 84, 50,226,155, 41,162,
+ 39,187,148,235,162,139,208,220,150,199,123,217,125,234,226,149,149, 37,157,173,154,164, 92,212,224, 73, 86,213, 89, 65, 27,128,
+154, 71,242, 56,146,250,142, 20,207,241,221, 41,111, 63,234,185,247,224, 46, 77, 60, 92,239, 57,212,153,218,138,209,252, 98,230,
+152,149, 82, 38, 52, 66, 26,109, 87,236,113,244,226, 56,204,133,185, 57,166, 97, 38,172, 35, 85, 11, 45,219,120,182,238, 51,116,
+ 51, 97,115,102,174,138, 58,155,248, 72,108,196, 14, 19,179, 78, 52,241,104, 52,155, 99,151, 18, 55,199,198, 92,192,197, 53,165,
+236, 25,166,202,172, 71,106,131,221,157,173,117,226,173,112,177,191,198,187,136,211, 70,148,196,132,  5, 16,137,131,216,203,  2,
+125,170, 64, 96, 60, 78,102,223, 36, 82,202, 13,186,240,253,155,206,196,212,177,222,221,231,219,223,254,128,135,119,  2, 53, 15,
+ 72,218, 17,182,137, 58,220,144,186,200,144,143,228,185,210,110, 10,171, 62,176,125, 99, 71, 19,229,120,113,205, 71, 63,249,152,
+ 47,158, 28,120,240,174, 48, 99,232,205,117,234, 25, 71,139, 96,106,100,122,167,168, 70, 32,226, 36,227, 26,116,201,227, 74,164,
+137,169,248,171, 11, 86,  4,151,  6,117, 79, 76,145, 90, 12, 77, 85,115,163, 53, 76,172,234,  2,209, 37,114,206,136,175,144, 61,
+ 85,  6, 52,158, 32,201, 17,202,132,182,202,218,217,128, 86,104,196,148,  8,106,209, 79, 69, 10,171,174, 67,139,167,232,  1, 61,
+ 14,148,176,195,215,105,193,180,122,142,211,136,204,214, 73, 55, 95, 64, 51,181,118, 36,105, 16,  3,197,  9,122, 44,172, 59,133,
+212,113,116, 19,147,203, 72,117,  4, 85, 92,178, 29,188,163, 17,156, 32,165, 34, 62,217,185,218,204, 50,167,162,148,232,232,220,
+ 98, 21,126,141, 93,175, 69, 39,155,254,228,245,229,145,155, 32, 59,152,125,228, 53,195, 97,108, 77, 17,156, 55,129,215,107,124,
+155,155,157,143, 65,148, 44,144,197, 40,167,177, 69,219, 41,104,193,175, 61,189, 58,142,162,248, 58, 35,181, 48,212,129, 92,215,
+108, 54, 29,109, 62,208,218,  4, 98,  9,140,204,  7,138,243,224,143,180,220,168,179,163,134, 70,114, 27,114,174,116, 65,152, 21,
+ 43, 16,226,113,185,183,122, 40,153,166, 35, 69,132,126,115,138,127,240,232,141,223, 67,219, 34,114, 91,174,102, 23, 32, 57,164,
+222,238, 24,150,252,239,101,203,232,196,198,129, 62,121,115,248,139,224,  2, 54, 98,  8,182,191, 54, 75,155,121,239,  4,135, 19,
+143,119,138, 95,176,178,186,140,204,157, 46,140,  2,220,  2, 65,176,104, 82,109,166,252,101,193,119,130,217,224,104,106,188,234,
+ 80,173, 94,119,118,144,208,254, 68,  2,156,115,248,206,219,  5, 83, 44,215,214, 56,181,205,  4, 50, 46, 44,158,198,219,157, 73,
+ 88, 18,202, 44, 81,203,133, 64, 90,212,251,117, 33,198, 53, 95, 80, 39,139,133,105, 65,216, 86,204,215,237, 29, 18,189, 41, 93,
+197, 49,151, 74,117, 86,213,182, 37, 21,206,185,202,211,207,159,241,236,197, 53, 62, 58, 78,118,231,156,173, 31,208,218,132,234,
+192, 73, 92, 33,234, 97, 30,169,170,164,212,113, 60, 76, 72, 80,124,232, 56,204, 35,243, 92, 88,175, 79,  8, 41, 45, 54,156,153,
+171,195,145,127,230,215,255, 28,239,255,202, 91,140,151,207,249,175,254,214,223,230, 47,252,214,111,178, 91, 69, 82, 90,241,195,
+239,254,136,255,236, 63,255,111,200, 97,197,118,187, 38,198, 53,235,179, 29, 15, 79,239,112,114,122,143, 62,118,172, 87,119,108,
+135,167, 10, 49,208,197, 21,173, 20, 35,168,137, 51, 87, 64,241,108,214, 15,145,122,224,197,211,207,241,225,132,243,  7,111,154,
+166, 65,  3,226,  2,109,177, 27, 74, 19,144, 14,159,  2, 93,151,  8,189,103,219, 71,166, 92, 64,  3, 49,117,248, 85, 36,117, 61,
+ 15,238,159,243,224,238, 93,190,253,237,175,241,222,219, 15,184,188,154,120,248,198,125,198,121, 79,109,153,214, 60,121,158,120,
+250,244, 37,159,127,250,140,225,184,103,127,125, 99, 94,241, 98,185,226,235, 77,207,163, 55, 31,113,216,143, 52,205,244,171, 21,
+181,121,130,135,245,106,197,156,103,210, 42,146,194,114,104, 59,243, 13,123,181,200, 83, 83,109,203,171, 64, 33,241, 86, 45,186,
+206,227,212,225,177,120, 94, 17,219,154,106, 83,188, 40, 97, 73, 47, 20,103,249,231, 78,133,232,123,250,245,154,179,243, 29,247,
+183, 59, 70, 45, 28,175,175, 25,181,226, 59,200,199,  3,109, 46,204,146,209,197,130, 85,106,198,135,255,135,182, 55,251,217, 44,
+ 93,239,179,174,251,153,214, 90,239,251,141, 53,116,119,245,220,187,123, 15,246,182, 29, 27, 59, 78,136, 29, 12, 73,  8, 81,144,
+ 37, 44,132,132,196, 25,199,  8, 33,132, 34,229,  0, 41,127,  0, 39, 28,240, 15, 16, 14, 16, 39,136,  0, 10,  4, 98, 99, 67,148,
+ 96,236,108,199, 99,188, 71,247, 92,213, 53,125,195, 59,172,245, 76, 55,  7,247,170, 50,226,  0, 33,165,220,210,214,150, 90, 91,
+187,190,170,250,190,247,121,158,251,254,253,174, 43, 17,124,180,  0,164, 79, 28,110,111, 89,142, 59, 78,166, 13,170,129,146, 59,
+221, 53,186,216,197,212,187,132, 23, 71, 84, 71,107,246, 58,243,109, 71,106,207, 56,148,138,170, 99, 51, 94,224,227,  6, 56,114,
+123,253,152,221,254, 96,191,135,124, 52,110,131,247,204,121,230, 56, 55,180, 41, 49, 57, 82, 26,240, 18,209, 94, 44,196, 21, 55,
+136, 90,238,193,201, 11,168, 81, 66,240, 44,189,217,170, 64, 42,186,190, 44,130, 55, 61,234,233,230,130,175,191,243, 33, 63,251,
+ 51, 31, 50,109,  6,150, 93,161,177,152,145,173, 41, 75, 41, 28,218, 66,185,186,229, 56, 87,230,172,180,154,241,146,249,238,159,
+124,193,199, 15,111, 24, 46, 94, 39,197, 17,233,144, 38, 71, 74,  9,233,118,233,  4,144,168, 12, 65,104,210,104,117, 96, 76,145,
+105,154,  0, 79,213, 29,158,192,228,170,213,200, 94,242,191, 59,110,113,204,174,219,115,174, 29,169,106, 93,247, 10,244,185,153,
+149,145, 64,211,142,107,144,139,233,118,189,179,116,123,113, 16,182,142,208, 26, 75, 22, 52, 84,194, 52, 64,235,148,158,209, 96,
+220,  4, 45,107,182,192, 21,131,171,168, 18,233, 36, 23,233,169,211,186,224,153,144,120,100,220, 52, 12,137,224,153,162, 49,227,
+ 75, 83,130, 40, 75,  7,167,142,136,208,162, 39, 34,248, 24,192,187,151, 59, 96, 69,236,243,199,121,130, 15,196, 16,185,115,247,
+130,205,171,176,179,173, 22,181, 86, 11,131,119, 76,219,233,149, 17,217,142, 75,165, 46, 11,211,240,234,172,111, 38,114, 49,157,
+235,178, 44,108,166,240, 74, 44,117,255,111, 13,237,227,231, 51,135,171,167,148,188,179,246,132,  4,202,210, 40,197,234,143,189,
+ 43,245,  8,157,136,120, 33,183,206,210, 26, 18,  6, 92, 25,205,204,232,102,230,  5,154,  8, 65,130,105, 89,203, 45, 58, 57,198,
+109, 34,208, 81,153,104,165, 51,210,240,174, 18,186,153,119, 11,130,139,142,228,148,216, 61, 91,132,127,233,235,247,240,247,238,
+222,251, 59,246,218, 93, 75,254, 98,251,159,222,186,133,194,212,161,110,229,187,175, 73,116,231,156,109,195,157,137, 87,252,106,
+191,145,254, 34, 81,110,243, 15,197,108, 66, 86,181, 88,255,253, 58,216,236, 65, 94,214,  0, 76, 45,104,246,166,214,214,208,222,
+ 26,174,107,235, 10,192,173,155,119,113,240, 34, 59,135,183,  3,190,171,  5, 83,172,150,  7,193,123, 68, 34, 62, 24, 83,219,252,
+224, 74,243,130, 11,198, 74, 86, 20, 17, 83,132,118, 21,188,183, 67,222, 39,103,154, 72,111, 41, 87, 26,184,232,112,218,108, 12,
+235, 60, 78, 59,165,218,110, 91,181,211,106,195,249,128, 11,194, 24,116,221,181, 43, 97,237,209, 35,194,224,148, 47, 62,125,200,
+237, 92,217,158, 93,242,246,189,183,185,119,255,  1,219, 49,240,244,209,151, 60,126,252,144,153,140,138,245,142,147, 75,148,126,
+ 64,196,179,217, 78,180,124, 32, 55, 91,101,108, 54, 19,199, 37,243,111,255, 59,255, 30,251, 47,191,203, 31, 63, 58,240, 23,126,
+230, 91,252,216, 71,239,242,123,223,249,109,254,232,147,231,252,194, 95,248, 25,188, 54,254,238,127,249, 63,112,189,135, 59,119,
+ 78, 73,241,132,237,116,193,249,233,134,211, 77, 36,110, 60,225,244,148,160, 19, 50,216, 56,222, 59, 24, 93, 52, 17,208, 16,209,
+144,200,185,131, 87,206, 78, 47,201,135,107,114, 59,218,215,112,187,231,112,125, 69,111,  7, 51,193,169,129, 50,146,143,108, 46,
+238, 49,158,156,226, 37, 49,196, 19, 68,141,211,174,177,145,134,129,237,184,193, 75,231,206,197,  9,239, 60,184,203,183,191,254,
+ 77,126,241, 95,254,113,156, 11, 60,253,242,  9, 55,215,207,232,222, 49, 68,143,147, 70, 41,205,194, 42, 49,226, 71,139, 72,230,
+214, 16,113,156,156,140,252,245,127,229,103,120,242,213, 21,215,115,225,244,116,195,241,104,187,198, 33,216, 55,230, 71,239,126,
+141, 52, 78,124,245,232,137,141,228,156,231, 37,231, 42,216,223,163, 15,206,212,194,193,173,225, 47, 97,240,142,232,237, 85,223,
+197, 64, 31,126,237, 28,139, 23, 90,171,150, 73,  9, 17,130, 80,143,  7,188,118, 94,123,227, 14, 58,120, 92, 89,184, 89, 14,104,
+ 62,210, 74, 38,171,216, 26, 96,240,196,  6,147,159,236, 34, 65,163,162, 84, 87,241,226,184,190,121, 98,166, 64,159,104,189, 83,
+157,224,188,183,195,219, 71,150, 60, 19, 52, 51,164, 35,155,212,216,186, 91,238,142, 71,168,149,171,217, 16,174, 73, 78,136, 94,
+ 57, 30,111,184,189,126, 66, 94, 14,235,222,215, 20,171,189,219,106, 72,123, 35,183, 66,206, 21,167,209, 90, 31,221, 38, 47,151,
+155, 75, 54,103, 39,244, 82, 86, 32,137,193, 61,124, 24,240,206,190,215,157,116, 68,138,249, 17,154, 50,166,137,119,223,127,151,
+143,126,252, 45,238,158, 15,  4,175, 16,  7, 66, 21, 27,209, 15, 66, 61,236,169,173,208,155,163,123, 97, 68, 56, 30,103,126,248,
+201,103,136, 75,252,216,183, 63, 96, 57,  2, 58,216,207,127,114,244,172,108,226, 64,150,  2, 52,130, 14, 44,125, 65,213, 96, 37,
+154,196,124,  3, 52,130,235,248, 14,139,218,228,176,101,251, 92,147, 22,112,  4,156,247, 56, 47,212, 94, 17, 31,128,133, 54, 91,
+251,193,181, 74,118, 86,207,213, 94,145, 20, 94,110,123,147,155,112,201, 49,186, 83,186, 95, 39, 57, 78,144,210,113,154,172, 13,
+227, 59,193, 25,191,157, 94,241, 93, 24, 24,240,154,112,174,211,210, 64,216, 12,180, 89,241, 33, 83,123,162, 57, 91,177,164,232,
+201, 81,215,252, 80,164, 20,197,111, 70, 38,177,105,154, 75,230, 75,183,139,166,125,166,234, 58,113, 18, 28,193,  5,156,115,140,
+105,226,242,206, 57,195,248, 47,174, 26,205, 77,201,115,161,151,182,122,212, 95,141,190,180, 43, 28,143, 25,109,149,113, 72,175,
+ 44, 81,111, 23, 17,229,120,152,169,101,225,116, 51,188, 50,247,251,255,243,162,115,245,228,192,113,255,156,222,102,131,177, 85,
+165, 99, 65,236,118,108, 12, 61, 82, 60,228, 58, 83,143,217,130,147,113,100, 76,157,228, 26,210, 50,115,142,196,224,216, 14,202,
+172,145,113,172,216,216, 52, 34,185,145,197,254,255,122, 85,106, 43,228,222,216,132, 97, 85,188,118,  6, 39,248,173,141,227, 47,
+ 70,199, 79,254,212, 61,130,115,242,114,196,168,226,208,117, 71, 78, 51,134, 56,172,251,195,149, 13, 92, 59, 72,171, 32,193, 20,
+231, 43,185, 74, 21,186,211, 85,217,106,227, 73,123,164, 58,250, 90,255,121, 73, 65, 19,112,221,153, 49, 76, 89, 59,206,107, 97,
+220, 89,127,154,110, 35, 81,135,199,169, 65,105,114,235,180,213,247,236, 68,112,205,104,120, 14,135,115,246,181, 52,109,212,214,
+ 25, 98,179, 91,189,122, 68, 10,109,189,140, 72,215,151, 66,  4,239,131,  5,184,164,217,107,221,121,235,164,186,246,114,156, 21,
+ 67, 34,183,138,119, 16,165, 34, 26, 17,245, 56,201,168,152, 27,218,187,181,155,161,142,174,158,228,160,  8, 56,121, 89, 80, 98,
+110, 11,199,106,154,217, 59,103,103, 92,223, 92,211,186,231,217,245,231,140, 23,119, 25,123,225,203,167, 79,217, 78,  9,196,115,
+ 51, 31, 89, 74,103, 60,137,148, 54, 91, 31, 24, 33,247, 25, 63, 43, 62,108,248,133, 95,250,  5,126,229,175,254, 24,255,209,223,
+249,207,249,213,111,126,139, 95,249, 55,126,154,255,240, 63,248,247,249,219,255,233,127,198,127,252,183,127,196, 79,127,227, 67,
+126,244,108,225,244,254,  3, 46, 46,  2, 67, 24, 56, 25,206,241,211,192, 52, 69, 54, 23, 27, 66,186,132,101,207,237, 12,101, 78,
+184,184, 97, 26, 34,238,201,158,205,216,185,157,149, 49, 70, 52, 44, 84,119, 68,182, 35,167,121,195,237,241,134,229, 80,169,181,
+176,204,199, 53,188, 56,218,237, 59, 64,216, 95,179,185, 60,199,251, 64, 40, 30,231, 19,103,219,115,222,121,240, 22,163,155, 73,
+186,227,226,252, 62, 63,243,231, 62,226,157,119,222,225,247,190,243,  5,127,248,189,103,108,210, 41,110, 12,156,115,142,248,100,
+220,128, 33,162, 52,131, 58,172,235,128,158, 60,  1,147, 87,188,245,206, 37,191,248, 75, 31,240, 71,127,252,207,249,193,167, 51,
+125, 76,120, 81,170,  8,135,158,105,206, 49,157,111,121,231,107,111,241,232,209,151, 60,123,254,204,148,190, 81,137, 46,161, 77,
+105,171,202, 55,183,  6,165, 91,142,170, 11, 21, 51,183,105,181, 80,103, 91, 87, 64, 29,197,251,142, 31, 34, 78,147,  5,159,176,
+196,252, 91,239,191,201, 27,175,221,227,112,115,195, 33,103,198, 52, 34, 53, 83, 74,225, 44,140,100,215, 41, 57,211, 82, 96,174,
+130,119,  3,189, 30, 81,109,108, 83,224,250,233,115,250,156, 57, 57,191,160, 22,163,219,121,169,140,189,179, 29,133,206, 72,161,
+243,250,230,154,251,119,  6, 54,195,145,216, 29,187,162, 60,187, 53,201, 80,242,129,210,118,244, 44,148, 58,179,212,106, 43, 36,
+215,240,222,228, 48,181, 44,  4, 31,236, 34, 47,130,107,158,219,219, 27,252, 30, 78, 54,118,120,237,118,207,184,127,231, 62, 39,
+247,239,240,240,106,207, 97, 46,235,132,171, 26,248, 34, 96,215, 17,137,168,183, 52,246, 91,175,191,207, 79,127,235,109, 46, 46,
+ 18, 55, 79, 43,103,247, 60, 18, 23,230,221, 74,188, 91, 20,217, 70,100,134, 65, 20,223, 59, 87,249,192, 15,127,240, 25,115,203,
+252,187,255,214, 95,230,217,243,133,239,150,143, 25,182, 30,233,142, 54, 47,224,  2, 59,215,217,229,140, 95,178, 41, 71,101,131,
+140, 21,239, 50, 61, 59,170, 75,140,234,  8,155,137,195,124,164, 46, 66,243,197,250,247, 53,209,123,161,185, 78,170,  3,105,236,
+ 84,167, 52,201,132,110, 76,119,175,158,230, 11,163,116, 22,133, 57, 87, 18, 35, 33, 41, 62,138,137,125,196, 83,186, 89, 27, 55,
+  9, 42,  1,233,149, 34,217,252, 24,106,144,171,216, 23,130, 31, 89,122,161,  6,161,123,207,102,244,248,193, 49,223, 20,122, 40,
+248,237,128,204,138,175,202,110,206,180, 75, 97,100,192, 31, 51, 50,116, 52, 68, 70,173,224,  3, 42, 66, 90,181,181, 37,119,124,
+ 18,251, 59, 24, 18,189,205,182, 54,244,138, 74, 71, 93, 39,134, 87, 55, 38,183,199, 73, 35,198, 87,184,247, 94,169,117,214,197,
+123,181, 92,246, 86,117, 37,134, 26, 28,252, 85,255, 83, 58,228, 90,168,189,161,193, 17, 26, 20, 87, 81,129,228, 61,234, 29,251,
+ 93,103, 89,236,209, 87, 91, 38, 13, 27,188,131,165, 20,150,220,112, 33, 65,115,180,229, 10,  9, 27, 36, 31,240,222,206, 56, 87,
+138,237,220,163, 67,187, 18, 82,163,169, 39,166,192,162,157, 54, 43,219, 49,145,186,160, 75,197,135,  1, 92, 37,110, 54, 38, 35,
+244,205, 27, 34, 86,116,117, 69,123, 83,255,169,173,225, 45,152,236,193,117,196,173, 17,249, 94,233,213, 27,  7, 90,133,246,226,
+181,191,178,130,169, 86, 59,211,210,237,155,172,219, 77, 83,214,241,184,243,160,213, 96, 23,186,166,205,155,179, 52,187, 83, 65,
+124, 48,175,185,183,215, 64,117, 70,244,162,217, 37,194, 57,197, 75,160, 52, 53, 11, 84,183, 31, 38,239, 34,181, 53, 90,233, 36,
+ 63, 50,121, 79,238,246,170, 82, 53,121, 64, 20,155, 64,148,185,173,140,121,183,134,  0, 13,104, 35, 93, 73, 42,180,168,168,131,
+177,123,178, 54,170, 88,237,172, 35, 36, 63, 32, 78, 13,225,231, 28, 13,171,228,149,110,116, 49, 31, 35, 56, 72,221,246,206,183,
+ 87,207,217, 31, 50, 33, 88,199, 83,180,114,249,218, 37, 23,247, 18, 31,255,232,115,206,239,188,206, 38,236,152,151, 76, 10,142,
+ 16, 10,234, 60,155,176, 69,151,106,214, 56, 81, 92, 21, 14,203,145,179,215,239,178, 57,241,124,248,206, 55,248,149,127,253,175,
+243,155,255,215,239,114,245,249, 15,184,255,230, 27,252, 39,127,235,111,241,127,252,218,175,241,171,191,241, 91,220,121,240, 14,
+155,187, 35,103,227, 41,155, 52,112,113,121,134, 11, 91,182, 39,155, 21, 98, 49,209,183,142,205,118,100,206, 27,164, 69, 14,203,
+158,147,139,145,141,116,252,  4, 23,119,224, 56, 63,165,104, 97, 58,142,220,244,247, 25, 46,246,176,189,229,121,110,228,126, 75,
+221,207,180, 92,193, 43,199, 37, 19, 14,123,150,101, 49,255,251,232,105, 45,115,125, 59,114,245,244, 25,175, 63,120,147,191,242,
+ 23, 63,228, 47,253,252,187,184, 56,160,115, 34, 12,137, 63,254,157, 31,240,248,209,115, 92,244,140,155,209, 94,146, 26,232, 90,
+ 89, 68,112, 27,187,224,233,161,216,223,213,  0,211, 48,242,141,247,222, 98,136,129,119,223,188,143,212,239,115,243,252,  6, 23,
+ 71, 27, 17,183, 70, 82,229,201,147, 39,188,246,214,125, 46,207,207,216, 95,221,208,112, 72,176,117, 83, 92, 43, 90,133, 78,154,
+  6,180,205,  4,231,172,154,217,133,170,153, 20,109,  4, 58,203, 64,173, 21,231, 18, 83,114,244, 26, 80,237,212,110, 97,203,119,
+223,124,139,111,127,244, 33, 87, 87, 55,148,217, 17,207,  6, 30,156, 95,242,197,195,207, 86, 88, 83,102,211, 26,170, 71, 82, 87,
+ 28, 74,209,192,224,148, 55,134, 35, 93,  3, 95,238,175, 73,105,131, 75,  3, 61, 31,120, 99,211, 56, 29, 23,166, 65,  8,126,224,
+121, 41,116, 26,111,159,121, 78,167,132, 87, 56, 82,184, 57, 86,110,179,167,118,199, 56,  6,230,249, 64,235,  1, 23, 12,173,234,
+188,133,145, 68,160, 84,195,218,234,139,149, 90, 81,186,175,107,  8,211,115,187,219,179,217, 68,114,  3,158, 59, 78,167,129,243,
+211,  9, 31,133,221,205,129,226,  7, 66,242, 72, 61, 26,252,165,219,229,252,181, 59, 95,227,103,127,238, 39,121,235, 93,161, 85,
+165,207, 66,239,  9,230, 35,135,249, 26,239,  7,250, 65,216, 29,247, 72, 20, 11,223,121,165, 28, 51,207,159,239,248,203,191,248,
+211,252,212, 79,125,196,223,251, 95,255, 41,205, 13,148, 58, 35,213,211,165, 19, 90,102, 95,140, 75, 95,154, 39,247,217, 30,  6,
+ 25,252, 16, 24, 70,101,147, 28, 57, 55,164,122,104,  1,109, 71,226, 16,113, 45, 18,165,163,147,183, 96, 90, 46,204,251, 35,226,
+130,213,148,124, 68, 99, 94, 87,118,137,185, 24,251, 60,110, 38, 98,239,164, 24, 77,179,155, 76,102,210,235, 13,226,182,198,129,
+167, 82,178, 71, 90, 38,156,108,237,227, 81, 59,163, 38,180, 22,136,110,173,116,  6,  6,159,200, 51,120,205,208, 59,135,171, 61,
+206, 27, 89, 48,185,  0,117, 65, 98,131,205, 72,  8, 48, 22, 71, 28, 44, 37,174,179,192, 24,168, 20,  6,159,  8, 10,185, 54,196,
+ 47,171,134,115,165,123,246,181,174,151, 94,209, 78,189, 91, 53,216, 57,121,165, 33, 57, 85, 86, 44,185, 18,195,171,247,168,183,
+214,  9,209, 33, 49,188,242, 67,189,230,142,182,  5,154, 34, 85,104,206,147,123,179,140,136, 15, 24,228,185,210,188,146,134,  4,
+ 65,240,109, 97,206, 74,207, 51, 67, 76, 22,172,237,152, 28, 44, 56, 74,175,228,110, 19,225,230, 65,124, 98, 88,148,154,102,188,
+243,180, 93,165,199,129, 94, 51,201,159, 16, 84, 40,190, 32,125,100, 24, 11,119,183,224,167, 45, 65,212,232, 90,221,189,240,247,
+177,118,187,141,236,246,130, 29,167,107,201,221,105, 39,  4, 71,235, 98,187,111, 58, 65,156,245, 68,213,250,177,226, 28, 26,250,
+203,189,245, 11,102, 47, 42,107,181,196,110,103,138,163,151,102, 59,120, 53,225,132, 23,249,211,148,125,192, 18,201,  2,197,218,
+ 53,230,  0,199,244,171, 77,204, 52,165,206, 38,  8,104, 37, 73,124,121,128,171,131,170, 21, 23,213,148,174, 29,102,113, 84, 26,
+177, 90,  2, 90, 66,176,223, 63,182, 92,245,222, 58,161,186,242,161,123,203,248,224, 25,196,198,252,234,192, 66,166,118, 81,241,
+ 43,141,200,137,101,  2, 52,120,178,118, 36, 87,124,140,  8, 22,140,219,207,  7,150,210, 24,182,194,114,189, 39,119,133,210, 24,
+134,115, 82,252,132,165,205,156,157,108,121,120,125,196,197,200, 52, 58,242,110, 38, 58,195, 94,138,135, 80,131,145,244,186,114,
+251,248, 43,254,251,191,255,191,113,249, 55,255, 85,202,213, 13, 63,248,253,223,228, 31,252,189, 31,178,185,251, 62,255,213,223,
+253, 47,248,169, 31,251,144,223,249,189, 31,217, 14,172, 78, 76,211,192,120,122,202,233,201, 61,194, 52,113,172, 51,161, 70, 90,
+104, 76,113, 68,210,150,131, 30,108,183, 81, 45, 40, 86,147, 82, 52,115,177, 61, 99,234,133, 71, 87,183, 72,235,156,142, 39,180,
+ 46,200,253,129,126,104, 28,107, 66,135, 76,174,149,232,  3,219,227,140,248,130,151,136,180, 68,113, 59,252,193, 81, 74,229,249,
+243,199,228,195,158,143,223,191,228,151, 46,255,  6, 87,159,124,143,127,246,  7,191,203, 31,252,209,151,236,158,221,130,175,120,
+ 29, 88,178, 93,190,186,102,219, 24, 58,101,244,  9,146,146,177, 75,156,107,157,161, 22,174,159,222,242,189,239, 62,225,195,247,
+239,178, 57,155, 56,204, 11,227, 90,107, 60, 22,197,143,158,253,205,115,158, 60,121,202,116,185,197,125,106,223,163,178,162, 80,
+107,171,116,113,220,123,227, 62, 78,149,253,126, 54,232,146, 42,121,174,  4,133,190,234,123,253, 10, 96,161, 66,107,246, 51,208,
+251, 26, 40,140,145,143,126,226, 39, 88,106,103,183,187,166,247,137,119,182, 23,184,250, 37,173, 53, 78, 82,227,193,120,195,249,
+ 48, 83,171, 55,183,193,168, 28, 23,207, 45, 91,134, 62,242,244,121,225, 56, 55,210,232,232,117,225,235,151,202,131,123,141, 52,
+ 36,118, 59,101, 41,194,137,207,188,126, 71, 56, 59, 31, 25, 90,100, 41,138,204,149,177, 55, 14,181, 80,107, 36,116, 71,148,  9,
+124,163,180,108, 21,194, 33,216,215,218,157,173,166,186,174,118, 44,251,126,222, 31,246,248, 20, 25,199, 19, 84,149,171,219,  3,
+211, 96, 41,248,185,206, 92,  4,225,245,179,215, 56, 30, 22, 91,134, 53,181,241,155,170,153,234,166, 55,120,255,131,111,243,209,
+215, 47,233,204,168, 91,240,177, 50,  4, 69,250, 41, 12,123,110,123,166,133,132,243, 88, 61,107,236, 28,247,153, 63,252,193,231,
+ 92,188,118,135,159,255,249, 31,231,176,191, 97,119, 56, 18, 86,182, 64,165, 17,187,146,129,145,200, 81, 10, 77, 60,113,112,  6,
+ 96, 41,102, 95,116,125, 64, 37,163,120,142,199, 35, 16,137, 39, 39,182, 55, 95, 26,226, 26, 44, 14, 25, 18,117,104,180,131,224,
+187, 33,122,155,171,244,210, 73, 62,112,104,149, 74, 96,244,158, 33, 88, 86,166,181, 78,215,132, 59, 86, 92,  0,167,145,226, 58,
+117,238,132, 46, 22, 29,140,163,  1, 65,196, 26, 60,183,192, 20, 60, 94, 61, 49, 64,165,179,223, 85, 11,201,249,194,137,159, 40,
+ 90,113,209,115,226, 78,169, 53,115, 20, 71,235,145,208, 27, 77, 35, 91,111, 43,  5,122, 35,166,200,140, 18, 93,160,176, 30,136,
+ 62, 64, 53,119,122,237, 13,215,  7, 82, 50,  9,151,151, 87,115,  0,183, 98,175, 77,186,190, 50,217,202,139,151,250,218,189,122,
+165, 30,245, 23,133,243, 23, 60,251,248,103,112,168, 31,150, 78,201,  5,205, 11, 77,236, 51,100,116,193, 30, 10,162,112,104,184,
+208, 25,  3,228,226, 16, 34,199,195,129, 92, 64, 79, 38, 92, 61, 50, 22,243, 50,180,182,176, 59,236,172, 74, 30, 55,200, 80,153,
+170,144,143,160, 81, 76,197,188,183, 73, 73,223,173, 88,244, 77,167,132, 68,200,133,148,148,125,114,140, 83, 36,108, 71,130,115,
+ 14,183,250,137,251, 10,142,161, 89,183,181,118,227,  8, 55,237,166,154, 20, 59, 64,181,217,190, 88,125,167,174, 35,201,174,118,
+ 48,186,181, 79,240,210, 77,237, 28, 98,154, 48, 59,144,221, 11,  7,185,125,104,202, 75, 12,161, 82,155,221,  6, 21, 11,  4,  5,
+137,232,218,  9,198,137, 17,172, 60,168,132,213, 27,189,142,154,154,190,236,166,182,214,137, 33, 90,232,165, 40, 51,149,208,220,
+138,140,176,157,186,118,123,221, 75,240,102,222,146,149, 64,181,246,232, 17,240,105,245,181,119,171,242, 69, 49,207,123, 89, 95,
+251,193, 89,135,222,108,  6,216,126,177, 98, 65,160, 20, 81, 76,254,210,112,184, 38, 28,111,231, 21,187, 27,152,123, 65,220,132,
+246, 78,169,  7,182, 39, 19,187,121,230,108,155,224,153,145,213, 68,250,218,139,175,232,216,233, 13,164, 52,170, 20,132,138,116,
+225, 55,126,245,215,121, 48,110,248,225,159,124,143,207, 30,126,133, 31, 70, 98,108,252,214,255,254,235,252,163, 95,255, 39,112,
+186,161,235,194, 56,194,233,233, 57,211,230,  4,130,163,249,206, 70, 38,250,224,105, 78,169,181,145,119, 11,101,169,148,219,130,
+246,130,247,224,157,103,148, 17,106,102,191, 44,244,178,160,227,137,213, 55,154, 99, 72,231,108,229, 22,189, 29,145,180, 33,166,
+  3, 42, 16, 87, 25,144,120, 71, 16, 79,240, 91,218,169,210, 41,182,146,241,129,223,255,221,143,249,205,127,252,135, 60,251,234,
+ 11,190,243,  7,223, 39,207, 71,251,223,134,129,188,100, 19,232,120, 27, 35, 74,139, 68,241,132,210, 41,199,140,118,107, 38,  4,
+132,221, 97,225,246,249,194,197,249, 41, 31, 63,127,198,135,239,221,229,123, 63,120,204, 38,  5,174,118, 71, 84, 32, 87, 33, 41,
+ 60,254,228, 11,246,203,145, 44, 74, 80,193,105, 51, 47, 65,176, 62,175,212,102,166, 43, 55, 16, 38,171, 39,198, 84,200,115,165,
+148,134,139,142,162,  7,106,233,160, 13,231,162,245,219,155,225,149,223,124,240, 22,131, 36,118, 55, 79,240, 41,113,234, 27,223,
+124,251,154,178,187, 97,210,196,137,159,185, 60,111,248, 52,208,178,103, 62, 54,170, 23,252,222,113,230, 50,121,231,249,189,231,
+ 87,156,140,157,247,238, 86,124, 56,242,254,155, 19, 42, 35, 83,235,184,212,201, 67,227,194,  5, 82, 40, 12, 77,232, 61,227, 21,
+134,168,212,230,168,197,176,172, 85, 42, 93, 32,161, 84,157,217,156,159,225, 73,220,220, 92,219,196, 71,108,127,219,123,163, 82,
+144, 22,108,157,160,208,231, 35, 26, 19, 93,224, 80, 20,159, 43,131, 75,228,165,177,121,253, 28, 39, 95,113,200,  7, 70,111,162,
+145, 20,  2,221,193,107, 23, 39,188,255, 78,100,222, 63, 39,157,157, 34,199, 25,202,194,114,244,108, 78,  4, 77, 35,203,141,224,
+  3,132, 41, 81,175,142,184, 33, 81,230,103,248, 56,240, 75,127,229,207,243,248,122,199,255,244, 15,126,131,219,188,181,214, 73,
+237,140,105,132,190,144,231,198,144, 20, 41,208,251, 76,157, 29, 50, 68,220, 88, 40,121,161, 19,104, 75,176,245,153,  8,131,183,
+215,209,146,  5, 55, 52,107,219,104, 65,218,128,215, 74, 26,  3, 75,177,190,113,201, 74,151, 45, 75,153,  9, 65,  9, 13,198,141,
+133,229,180,219, 33,173, 99,163,205,  2,139,181, 67, 92,110,148,178,160,211, 57,190, 88,168,181,117,  8,174,162, 46, 66,236,180,
+ 54, 80,124, 36,248, 35, 33,158,210,242,140,107,198,214, 88,180, 50, 56, 79, 37, 25, 52, 41, 37, 82,235,184, 12, 21, 71,152, 26,
+251, 34,120,132,224, 61,222,117,186,235,212, 38,184,232,169, 94,  9, 90,113,193,170,174,234,101,205, 67,192,144,162,133,233,254,
+ 69, 95,164, 47, 40,156,198, 27,229, 85,158,234,218, 45, 63,229,  2,182,178,125,133, 74, 84,181,217,190,241, 85,228,207, 96,  0,
+239,204, 29,226,130,133,136,117,201, 28, 92, 69, 67,135, 14,199,158,145, 14,203,254,192,162,138,119,129, 52,122,114,222, 19,115,
+196,169,227, 58, 47,104,243,200,102,130,186, 39, 68, 71,201, 71,144, 96,153,140,218,233, 23, 16,151, 17, 61, 46,120, 63,209,157,
+195, 69, 33, 23,199, 64, 67,166,  1,109, 66,216, 15,180,147,  1, 85,103,234,213,186,146,220,220,250,  2,126, 33, 37, 17,173,244,
+  2,120, 80, 39, 54,238,177,175, 25, 89,173, 64, 22, 72, 55,228,168,136,189,121,123, 53,224,140, 56,195,196, 74,208,181,247,238,
+ 95,218,218, 36,  8,174, 91,223,180,136,189,254, 67,233, 70,105,179,108, 61, 90,250, 74, 73,242,166,105, 13,238, 37,228, 70, 87,
+ 31,186, 52, 16, 23,240,218,112,209,246,111, 93, 87,204,173,  7,175,  1,239, 28,157, 78,233,213,124,233,201,170,108,173,219,239,
+169, 24, 83,  7,113,202,146, 51,163,143,244, 23,138,215, 33, 18,213,126, 93,196, 51,244, 78, 17,251, 16,111,205,106,122, 47,152,
+198,234,214,222,101,173,102, 38, 83, 79, 28,132,227,114,224,217,245, 30,113,230,254, 22,231,233,171,215,250,252,100,224,114,115,
+201,211,167,159,112,123,112,  4,113,244,210,185, 89,102, 68, 59, 75, 61,162,183, 66, 43,121,205,233, 11,110, 74,120,159,184,119,
+118,202,179, 63,249,  1,159, 63,217,179, 73,  3,243,162,244, 37,243, 95,255,183,255, 11,239, 63,248,  6, 31,188,118,151,186,204,
+140,147, 39,134, 13, 41,120,194, 16,109,252, 95,214, 28,132, 23,114, 87,  6, 60, 18, 58,199, 33,208, 90,160,110, 42,245, 32,116,
+  9, 60, 59, 60, 98,127,123, 13,195, 57,113, 60, 55,249,197,198,246,148, 83, 58, 67,101,164, 29,247, 68, 23,168, 61,211,125,166,
+ 46,  2, 45,227, 55,195,202, 18,159,145, 16, 25,147, 67,162, 64, 17,254,199,255,249, 31,114, 60,220, 48, 93,158, 17,124, 52,220,
+172,108,232,221,209,  5,162, 15, 12, 82, 41,190, 33,205,147, 38,143,239,157,122, 91,232,213, 67, 18,106,232,108,238,223, 37, 73,
+224,243, 47,158, 17, 92,103,154, 70,110,247, 71, 66, 76,208, 60,145, 66,218, 38,118,199, 35,249, 56, 51,132, 64, 87, 65, 37,145,
+  6,199,118,147,136, 62,209,114, 97, 95, 43,173,117,244,160,108,206,  2, 90, 29,105, 60, 97, 60,219,146,181,241,236,217,151,212,
+146, 81,111, 74,217,160,202,210, 11,105, 28,248,214, 55,126,140,237, 80, 41,  1,194,206,241,237,119,149, 59,103,215, 92,103,207,
+131,115,101,240,133,190,  9,  4, 81, 32,178,153, 34,199, 93,163, 13, 51,147, 14,124,124,221,216,229,133,111,191,127,193,253, 83,
+101,218,130,171, 66, 89, 26,120,225,226, 98,164, 22,225,208, 26,187, 92,240,218,137, 94, 41, 77,121,246,180,241,241,227,202,126,
+134, 97, 10,228,117,250,180,244, 74, 91, 10,119, 79,207,144,181,  9,208,234,145,218,140, 83,239,186,195, 87,187,232, 53, 87,208,
+172, 20, 10,162,157, 97,216,208,221,176, 22, 92,162,129, 92, 92,165,107, 68, 57,172, 24,233, 68,111,153, 97,115,198,  7,239,190,
+198,105,188,226,152,  3,203, 67,251, 32, 59,208,249,226,  7,159,113,113,103,195,229,233,150,179,184,229,234,234,  9, 67,172,164,
+147,129,135, 95, 62,225,147, 47, 31,243,222,123,239,242,254, 27,247,249,245, 95,251, 71,252,211,223,251,148,175,125,244,109, 84,
+ 51,162, 66,153, 11,157,194, 68,162,173, 14,121,149,133, 82, 11, 30,187,156, 79, 50, 24, 80, 74,236, 64, 36,119,156,102, 10, 74,
+105,  5, 87,  7, 66,234,104, 20,194,208,105, 59,203, 17,136,235,212, 50, 27,251, 59,206, 56, 77,164,186, 80,105,148,218,200,165,
+ 16,100, 75, 10, 74,138,138,140,145,242,172,144,155,178,  9,137, 58,140, 84,205,140, 99,160, 83,241,217, 81,245,204,106,134,243,
+ 17,221,120,164,206,180, 99,160, 31, 51, 18, 51,226, 79,113, 45, 19,188,101,110,196, 59,118,173,145,  2,171, 80, 38,210,129,201,
+  9,109,227,144,108, 15, 12,117,138, 20,177,207,235,214,104, 81,  9,147, 95,149,165,  6,212, 10,210,208,206,122,160,203, 43,123,
+ 81,187, 53,244,252, 42,199,239,165,118,122,171, 47,205,118,175,178, 67,222,170, 25, 71,221,139,140,215,171,246,168,151,140,214,
+138,170, 71, 41,230,134, 40,149,232,148,214,117, 13,185,121,188, 68,224,192,210,133,193, 71, 54,113,194, 21,  7,161,160,131, 35,
+202, 25,173, 95, 67,111,  4, 85,162, 27,169,181,114,123,216, 51,134,192,188,235, 20, 60, 97, 82,166,144, 76,109,172,209,248, 25,
+177,225,123,160,119, 97,220,  8,219,177, 35,241, 14,161,244,110,120, 66, 89,255, 52, 92, 67,196,140, 79,182, 71,121, 33,184, 80,
+ 74,183,195,182,175,254, 93,239,  2, 42, 13, 87,215, 68,172, 88, 65,172,203,154, 20,238,188,244,162, 91,218,188, 90,175,212, 57,
+243, 82,235, 74,129,235, 14,137,246,107,224, 28, 78, 59,235, 90,222, 28,230,232,154, 48,246,150,194,151,117,111,191,206, 89,156,
+ 98, 70,159,222,112,125,197,194, 70, 71,167,218, 88,222,121,180,234,159,238,252,187,174, 88,215,110,254,113,214,144, 94,247,150,
+228, 15,142, 90,236,215, 73,193, 91,  8,170, 53,138,235, 86,209, 83,208, 86, 45,108, 23, 60,185, 67,200, 98, 99,124,111,243,249,
+193,  5,170, 70,106, 46, 44,183,123,150,222,  9,105,160,245,204, 50, 55,130,100, 62,249,226, 79,248,112,243,  1,183,187, 43, 11,
+190,120, 11, 17, 82, 11,181, 86,  8,166, 70,173,205, 40, 93,  1,143, 87,161, 86,101,152, 38,238,159, 93,242,197,211, 47, 57,178,
+ 55,180,175, 56,198,105,203,102, 76,148,118, 11,121,203,157,187,119,184,184,119,202,197,249, 37,231,211,150, 99,203,102, 18,146,
+140,215,129, 72,129,193, 49,  8,140, 62, 49,156, 42, 79,158, 29,233,165,210,199, 72, 98,129,185,114,240,145,139,113,160, 19, 88,
+ 78, 60,142, 72,236,133,138,210, 70, 79,105,139,193, 88,106,164, 19,113, 27,161,215,145,222, 35,121, 46,224, 18, 90, 10,183,199,
+138, 12, 14,149,198,243,135,215,108,  6,207,185,156, 83,213,154, 20,234, 29, 36,203,116,156,196, 13,169,207,220,212, 91,114,173,
+ 84,237,132, 96, 12,  2,145,145,174,153, 97,156,216, 29, 23, 30, 95, 29,248, 75, 63,247, 77,254,217,119, 62, 35,165,136,230, 74,
+136,194,193, 43,185,128,111,205, 56,233, 39, 27, 30,188,249, 30, 63,250,225, 15,217,239,143,156,108,206,153, 54, 91,114,107,  6,
+ 75, 66, 16,108, 90, 81, 14,176, 59,206, 40, 71,196,117,206,239,188,206,241,112,205, 50, 31,232,173, 91,250,158, 70,237,133,159,
+251,232,219,252,244, 71, 35, 27,247,125, 24, 19,251,189,240,222,219, 23,132, 82,217, 78, 55,100,183, 71, 11,244, 99,101,  9,142,
+180,221, 96,142,144, 43, 36, 55, 90,159,120,122,243,152,203,169,242,206,253, 17,234, 17,105,129,216,204,135,224, 70, 79,  8,137,
+ 92,102,122,169,196, 14,207,110,149,160,112, 85, 11,255,252, 81,224,217, 97,131,151,108,218,217,245,194,172,181,178,219, 29, 17,
+ 73,140,120,104,197, 20,186, 42, 38,218,193, 28, 69,120,197,169,163, 80, 45, 56, 88, 23,196,121, 78, 47,182, 22,104,242,157,185,
+ 21,244,208, 24, 93, 96, 81, 79, 16, 59,200, 90,247,220, 61,123,143,187,119,238,208,251, 21, 44,240,228,234, 25, 78,132,167,251,
+133,155,157,146,221,130,106, 37, 68,144,  1,106,113,168,102,110,119, 59,142, 71,229,237,  7,  3,183,187,175,168,173,114,121,118,
+159, 24, 38,150,156,193, 21, 52,140,212, 93, 69,221,145,112,220,144,151, 61, 21, 75,254,242,194,  5,223, 22, 98, 22,212, 71,147,
+202, 56,179, 86,117,132, 20, 18,210,187,173,206,106,176,240, 81, 84,100,137,120,215,232, 81,153,188, 99, 89, 12, 14,146, 17,122,
+173,196, 35, 12, 67,162,133,138,147, 72,191, 17,218, 16,240,163,163, 45, 11, 89, 43,195, 48,217, 31,105,232,116, 73, 84, 33,  8,
+ 95,170,  0,  0, 32,  0, 73, 68, 65, 84, 55,211,231, 29,209, 15,182, 26,204,197,186,210,131, 35,149,194,161,  8,154, 58, 49,120,
+ 60,201, 18,211, 85,  8, 27,123,152,232, 18, 73,106,240,167,138,199, 87,155, 96, 70,133, 44,214, 84,152, 54,129,158,149, 42,142,
+158, 61, 93, 42, 49, 36,164,121, 99,134,111,163, 81, 53, 95, 85,232,172, 53, 74,135, 41, 58, 91, 61,189,178,241,251, 58,  5,241,
+193, 76,128,175, 16, 60,211, 91, 55,201, 77,144, 87,121, 95,120, 57,189,152,231, 74,161, 83,209,213,230, 41,244,  8,186, 56, 90,
+ 43, 20,  7, 69, 51, 67, 12,120,127,198,112, 20,202,124, 75,143,157,197, 57,150, 54,147,116, 68, 91,164,239,142,224, 77, 15,235,
+  4,178,175,228,170,  6, 83,139, 30, 63,154,252,230,234, 80,172,253,144,187, 61,118,122, 64,202,192,152, 26,167, 37,241,198,217,
+  4,195,134,160,107, 34, 93, 86,216,173, 39,130,118,148,106,220, 98,177,122,153, 95, 95,171,234,186,113,165, 49, 82, 83, 23, 59,
+196, 17, 75,191,135,117,  4,111, 59, 59,187, 65,106, 87,188, 42, 90, 29,  4, 11,219,105,239,107,221,204, 94,248,189, 53,164,219,
+171,183,170,117,166,131,120,219, 51,  4,135,215, 70, 95,247,255,182,168,239,168,120,156,216,  5, 64, 86,232,141,199,180,172, 68,
+193, 53, 59,132, 91, 55,188,231, 16, 34, 34,197,234,169, 62, 16,  2,235,175, 99,255,205,250,234, 46,117,117, 75,247, 74, 41,138,
+186,134, 15, 30,167,141, 42,127, 58,210,105,216, 95,132,198, 72,201, 74,  8,222, 80,183, 62, 49,231,142,  4,195, 42,238,247,  7,
+ 14,135,  3,138,103, 24, 18,251,253,115, 46,207, 46, 57, 30,111,248,131,223,255, 14,181, 22,238,221,249,  0, 45,183,184,114,100,
+ 81,163,103,133,120,202, 24, 19, 75,201,116,129, 92, 10, 78,133, 97, 72,108,134, 19, 78, 38,199,243, 92,185,185, 57,178,116,199,
+112,114,201, 73, 28,185,126,246,136,231, 79, 31,242,240,209, 23,108,130,231,236,181,251,188,243,238,  7,188,121,247, 53,228,228,
+132, 20, 29,219,105,  2, 31,232, 88,239,181,107,161,170,195,119,101, 59,101, 60, 19, 61, 43,195, 56,177,185,255, 77,222, 67,249,
+209,199,223,165, 30,  3,149,136,143, 19,245,234,128,108, 51, 91,239, 57,248, 83,154,100, 35,  8, 14,137, 56,116,114,235, 28,230,
+ 66, 26, 28,170,  3,251,178, 88,208,181, 57,178, 55,150,246,233,230,  1,177,120,227,231,107, 92,195, 73,145,232, 70, 68, 43,199,
+212,  9,135, 13, 33, 57,186,100,230, 82,145, 48, 49, 36,  5,157, 24, 79, 70,158, 63,125,198,231,159,126, 69,124,251,146,101,173,
+249,196, 40,204,205,164, 23,121, 41,134, 83,244,157,225, 98,224,206,221, 51,174,111,206, 44, 23, 33,194,177, 44,200,210, 17,175,
+ 70, 93,235, 14,159, 18,113,115, 73, 58,105, 92, 95, 95,113,125,115,141,120, 37,109, 34, 91,189,228,217,163, 47,144, 21,118,244,
+254, 27,151,252,181,191,250,179,188,119,127,161,151, 72,109,194,197,201, 29, 59, 92,229,128, 27,131,213,189,156, 18,123, 52, 51,
+211,241,  6,188,199,215, 72,247,202,211, 67,225,102,158,121,239,193, 57,163,107, 84,215, 57, 30, 28,105, 18,134,104, 96,153, 86,
+ 14,180,146, 57,204,157, 93, 22,190,218, 55,118,123, 79,119, 91,142,205,227,250,142,222,205,150,102,253,179,202, 97, 62,114,172,
+ 71, 66,142,196, 62,154, 98,185,  8,226,219, 10,222,177,160,170,107,142,210, 26,221, 11, 90,161,119,171,235,105, 83, 19,245,108,
+ 60, 49,110,104, 77,168,174,224,157,229, 73,180,119, 36, 54, 46,238,143,108, 79, 34,174, 71,242,174,147,162,242,213, 85,230,217,
+245, 45, 85,148,199, 55,157,222, 54,156, 36,199,249,249,192, 56, 38,126,247,123, 63,226,211,199,153,183,223,188,195,152, 60,215,
+ 79,159, 81,197,177, 61, 57,133, 96,212, 53,231, 71,218,188, 71,146, 85,240, 74, 40,248,226,161,111,193, 45, 20,109,248, 69,145,
+ 41,161,163,  3,  6, 27,153,183, 66,155, 34,  3,  9, 84, 89, 56,224, 90,196,233,200,241,118, 79, 26,133,153,  5,209,128,138, 35,
+ 54,143,196,153, 58,232,186,107,183,203,101,206,118,144,150,177, 33, 18, 72, 34,180, 32,140,109, 67,144,138,175,133,158, 58, 82,
+  3, 78, 42,117,105, 12,120, 92,129, 57,218,138, 39,166,196,109,171,140,110, 67,240,149,160,134, 62,206, 89, 25,214,212, 64, 60,
+  0, 91,144, 36,180,157,146, 78, 58,185, 90,144, 42,224,168,189, 16,170, 35, 56,161,228, 10,234, 25,221,202,201, 16,177,209,188,
+ 54,251, 68,205, 66, 12,227, 43, 26,145,219,  1,169,173, 89,240,238, 21,141,178, 21, 91,227, 54, 53,195,230,171, 36,190,189, 72,
+213, 55,237,140,222, 35,175, 26, 60, 83, 49,177, 83,207,104,155,113, 62,114, 40,149, 29, 13,183, 52,150,185, 67,  4,223, 61,146,
+ 27, 42,133, 92,161,187,206,156, 43,219,148,104, 75,199,245, 10,163,163,199, 17,245,133,152,128, 30,173,234,184, 85,202, 98,134,
+200, 45, 39,168,102,124,115, 72,143,180, 97,135,196,192,152, 59,199,114, 75, 28, 78,152, 54,158,241, 34,  0, 35,193,169,  5,226,
+  4,135,118,104,107,191, 58,132,132,128,245, 56,157, 67,213,198,242,218, 42,222,219,168, 25, 85,180, 10,126, 48, 12, 44,152,220,
+196, 14,109,183,250,100,205, 25,172,125, 61, 56,155, 85,146,116,173,199,121, 81,208,106,  0,147,  0,116,179, 96,  5,137, 72,  8,
+ 92, 94,156, 51, 12,142,229,112,195,205, 97,161,181,213, 33,174,  6,178, 49,175,184, 32,205,162,255, 46,120,170,107,107,101,238,
+  5, 33, 12, 82, 84,122,183, 90,152,243, 70,190,243, 88, 45,165,  7,144, 20,113,221,227, 93,197, 87,172,195,190,186,222,107, 47,
+160,  1,105, 13,231,132,236,186,165,242,187, 91, 31, 62,157,234, 58,226, 59,209,156,168,180, 96, 29,117,109, 66,235,182,223,239,
+174, 34,125, 64,189,114,123,216, 17,131,144,155,240,198,107, 31,178,241,141, 79,175,174,104,186,210,239,214, 10, 94, 76,158,188,
+207,212, 98, 58,217,232,  5, 55,  6, 78,182,145,165,205, 92, 31, 50,170, 13,231,  7,238,220,123, 27,157,111, 25, 37,177, 73, 39,
+ 92,149, 35,181, 43,122, 61, 50,125,241, 37,199,229,200,246,244, 62, 67,130, 97,123,202, 52, 25,226,179, 84, 91,161,228,155,163,
+ 93,144, 54, 35, 67, 18, 54, 39, 27,124,234, 72,128,187, 23,151, 32, 31,241,240,209,129,154, 29,109,242,248,225,130,105,232, 92,
+237,111,240, 30,184, 41,244,152,  8,174,226, 73,140,147, 25,188,150,155, 27,114, 94,144, 20, 45, 41, 42, 66, 62,220,226,212, 91,
+184,168, 41, 67,138,150,112,142, 27,180,117,130,  8,131,247,220,118, 51, 38,213,101, 38, 75,224,116, 60,161,236, 50, 89, 10, 39,
+ 46,178,245, 35,179, 15,156,223,123,131,207, 31,126,  6,181, 18, 84, 56,104, 32,183,  2,218, 12,104, 84, 58,103,219, 75, 62,120,
+240, 54,127,242,233,199, 44,203,194,249,233, 22, 45, 22,254,204,222,204,122, 90, 27,185, 86,124,245,120,217, 49,158,156,208, 78,
+ 78,185,109,141,221,237, 30,113,129,209, 37,166,113, 67,173,123,  6,231,249,133,191,248,231,121,235,190, 18,218, 21,112,129,115,
+ 66, 11,247,184,122,246, 59,244,186, 35,164, 17,137,142,190, 84,170,108,225,133, 88,101,216,160,139, 16,198,200,243, 79, 22,134,
+  0,111,190,249, 22, 97,255,  4,188,146, 67,231,201,109, 36, 53,207,205, 82,184,174,157,221, 34, 60,217, 37,118,205,122,226,218,
+109,143,171,189,210,250,130, 95, 93,226,121,213,225, 82, 11,117, 41,180,100, 97, 57,137,206, 32, 71,109,253,249,117, 47,186,247,
+129, 41,121,114,110,104, 40,150,122, 87,207, 60,207, 76,227,192,128, 85,  8,251,232,  9,155, 19,244,248, 28,145,110,202,147,238,
+233, 42, 28,231, 25, 23, 26,187,118,224,241,149, 82, 14,217, 68, 37, 37, 48, 47,133,230, 21,231, 35, 31,127,249,132,249,176,240,
+ 39,159, 62,103,216,108,248,115,223,186,199,148, 60,173,  0,179,210,130,224,124, 96,144,  5,137,157,190,203, 44,174, 51,196,141,
+ 57,236,181, 82,189,  2,  5,223, 32,171,112,238, 29,222,  7, 68,141,243, 32,234,113,100,186, 83,170,  7, 45,  1,113,208,100, 33,
+ 40, 80,204,212,214,218, 66,147,196,210,  0,239,232, 55,153,232,  6,252,  4, 69, 61, 33,  0, 81, 40,185,179,149,142,239, 66,158,
+103, 60,158,133,110,211,157, 49,176, 91, 22,156,131, 81, 28,105, 27,233,189,208, 23,197,199,201, 46,148,181, 64, 90,112,147, 71,
+250, 13,180,173,241,224, 69,233, 12,244, 37, 51,  5, 97, 55, 31, 25, 91,192, 21,165,212,192, 52, 36, 91, 55,174, 14,132,165, 47,
+140, 50,224,157,193,127,124, 52,181,179,116,140,159, 16,133,228, 29,225, 21, 85,207,230,102, 97, 82,131,140,188,218,189,119,111,
+171,111,225, 21,115,217, 85, 49,117,120,111, 68, 31,254, 76, 16,177,173, 43,154, 51,173,175,172,  3, 23,136,116,186,216, 74,132,
+172,244,122,228,166,102,170,111, 70,222,156,149, 40,142,161, 22,138, 15,168,  4, 60, 55,116,151,169, 69,241,  1, 68, 35,222, 55,
+ 92, 80,106,177,250,226,190, 45,  4, 45,184,164,184,214, 80,239, 89,118,133,192, 64,216,  2,181,178,212, 35, 66,178,169,144,240,
+ 34, 37,104,175, 76,100,117, 16, 11,150,238, 94, 69, 47, 43, 73,214,222,225,202, 42,226,120, 33,106,183, 80,194,203,174, 97, 87,
+139,165,169,165,230, 29,198,137, 23,103,251,110,109,110,197,175,154,  9,170,183, 66,119, 21,237,206,186,180, 82, 17,237,164,233,
+156, 59,111,188,206,217,208,153,119,158,246,217, 99,110,123,  3,204,222, 85,105, 43,174, 83,112, 81,104, 69, 13,237,105, 75,  0,
+ 75,216,171, 32, 93, 41,182, 59,192, 27, 22, 11, 80,102, 53,208,135,235,178,226,113, 51,210,  3,221, 57, 83,190,174,106,119,239,
+ 61,173,214, 85, 34, 99,223,219,185,170,165, 75,163,117,236, 67, 15,248, 44,232, 24,204,176,227,  3,174,219,101,227,222,107,175,
+241,240,225, 99,158, 94, 31,214, 17,139, 82, 41,244,218,  8,227,134,214,247,124,241,244, 41, 57,103, 80,225,152,139,189, 30,  4,
+116,110,180,185,173,126,122, 15, 40,135,227,204,220, 27,185, 64,157, 43,209,121,222,254,218,183,233,243, 53,251,122, 32,164, 13,
+155,237,  5,143, 31, 62,198,159, 78,180, 80, 89, 92,224,226,244, 46,127,243,223,252,107, 60,252,236,135,124,250,232, 57, 65,  2,
+185, 20,206, 46,206,185,253,234, 49,187,155,199, 60,122,250, 57,234, 54,220,187,115,194,131,123, 15, 56,185, 51,114,184, 90,248,
+234,211, 79, 25,166,115,110,118, 79, 56, 30,110,201,143, 26,195,118,224, 52,221,225,152, 11,189,237,113,227,132,106, 69,116, 32,
+249, 17,113, 11,149,202,174, 39,246,229, 96, 44,253,174,136, 44,156, 57, 72,231,119,241,201,126, 95,146, 48,232,199, 92,136, 18,
+105,131,146,221,128,235,194,210, 50,219, 96,156,113,209, 70, 58, 17,146,110, 94, 74,154,211,144,120,227,181,187,124,185, 60,162,
+ 73, 39,164,137,190, 44, 80,149,224,  3,125,  4, 87, 59,151,119,207,200,181,114,253,244,136, 75,182,118,242,209,175,232,218,134,
+180,132,136,112,122, 49, 65, 28, 88,110,247, 60,122,248,  5,209,143, 56, 55,161,249,150, 38, 51,195, 24, 57, 63, 57,103, 87, 60,
+ 95,187, 55,241,237, 15, 71,194,242,125,188, 27,108, 28,236, 46,  9,113, 15,245,154,219,167,157,105,112,164, 75, 32,  4,234,254,
+ 64, 62, 42,155,141, 25,208,186, 40,101, 63,241,201, 23,215,188,246,218, 25,  3, 98,200,199,131,114,123, 29,249,254,147,142, 50,
+ 49,183,200,145, 78,171,138,243,  1, 79,162,181,133,105,136, 28,187,218,135,122,242, 86,233, 44,213,210,251,173,145,243,  1,122,
+161, 82,  8, 17,198,148,184, 89,172, 54, 19,253,250, 51,154,  2, 67,220,210,234,158, 90, 22,220, 24,236,231,211,  7,164,218,106,
+170, 40,104,109,120, 17, 98,243,102, 42,116, 98,106, 88, 38, 82,169, 44,243,142, 62, 28,137, 67,224,250,240,156,249,250,192,233,
+ 40, 56, 13,148, 82,249,236,233, 21, 55,135,206, 97, 62,240,213,211, 35, 85, 60, 63,255, 19,111,112,118, 17,168,217, 17, 93,226,
+238,105,228, 90, 35,243, 44,148, 86,241, 71,112, 62, 26,209, 77,132, 99, 86, 74,237,136,235,244, 22,241,100,226,152,144, 26,168,
+  5,116,222,147,210, 72,143,141, 86,161,  4, 27,152,186, 26,144,168,232,146, 45,247, 50, 36,154,107,132, 42,208, 15, 84, 21,180,
+ 69,203, 98,123,165, 46,130,243, 16,135, 68,169, 74,162,210, 71,101,151,175,173,170,187,237,196, 18, 17, 55, 82,231,229,165,181,
+ 82,169,104, 78,184, 65,136,113,203, 54, 36, 22,157, 41,162, 56,201, 56, 61, 99, 62, 86,100, 56,144,206, 78,152,119,141, 33, 31,
+ 73,147,167,214,192, 32,194, 48, 37, 52, 26, 75, 67,157, 48,215,204,169, 31,204, 99, 95,  3,189, 67,138,198,194,104, 93,233,234,
+140,217,225,148,212, 34, 61,192, 48,196, 87,118,128,149,218,232,194, 43,187, 40,152, 12,197, 40,127,171,171,243,213, 30,186,106,
+ 25, 46,165,191,114,244,236,139, 11, 73,174,149, 78, 99,144,198,161, 54, 90,114,132, 18, 41,131,226,103,165,116,101,118,130, 31,
+ 60,174,155,173,109, 78,224, 39,184,189, 61, 34, 64, 58, 59,165,149,192,221,205,192, 56,188,198,167,143, 31,210,229,150,224,134,
+245, 66, 24,144,158,144,182, 24, 91,162, 10,153, 10,123, 91,139, 47, 73, 25,117,160, 83, 57,220, 30,104,199,211, 21,190, 38,158,
+130, 29, 76, 47, 14,111,117, 74, 89, 42, 62, 68, 75,188,175,181, 23,145, 53,245,254,130,  3,223,108,167,208,170,174,135, 59,136,
+154, 62, 83,165, 19,124, 91, 15,214,149,178,182,210,227,156,172,114,151,214, 76, 91, 25, 34,165, 23,179,220,200,154, 64, 87, 12,
+244,176, 88,162,176, 46,139,201, 25,122, 71,130, 97, 95,253, 10,139,168, 43,129,206,121,219,153,171,130,171,182, 22,  8,235,142,
+187,174,147,  2,143, 16, 28,171, 36,113,173, 31, 72, 39,106, 36,120, 40,205, 38,  7, 62,202,203,218, 29,226,137,226, 44,128,179,
+ 20,156,179,148, 49,222, 86,  4, 78,141, 66,167, 93,233, 75, 65,131, 81,246,154,  8,209, 85,210,102,226,131,247,222,103,247, 71,
+127,204,178, 28, 24, 37, 90, 99,  0, 40,251, 91, 30,214, 25,223,197,114,  6,210,193,195,224, 45, 48,177,239,133,224, 18, 26,108,
+143, 79,112,164,232, 73,125, 64,106,103, 94, 22,206,238,127,192,223,248,165,127,141,223,254, 39,255,144, 79,230, 61,219, 97,224,
+201,213, 87,180, 30, 24,211,196,197, 48,113,122,182,229,151,127,249,151,249,137,175,191,205, 55,191,246, 14,251,227,204,126,183,
+231,246, 56,243,181,247,222,227,211,239,253, 62,255,205,127,247,247, 89,230,206,156, 31,113, 56, 92,113,253,204, 46, 26, 15, 63,
+255,156, 90, 58,151,119,238, 48,110,207,216,223, 62, 33,239, 51, 37, 41, 99, 56,225,124,123, 74,220,156,226,134,204,228, 59,135,
+253, 13,199,179, 17,223, 43,173,154, 88, 39, 46,137,188,236,201,185,115,122, 18,217,108,238, 16,211,136,182, 74,247,157,227, 30,
+134,193,136,105,201,  9, 18,  3, 75, 62, 48,169, 35, 71,225,216, 60,137, 72,119, 29,245,141,  9, 15,154,  9,131,231,141,  7,247,
+ 57,153,  2, 15, 94,187,207,197,217,196,243, 91, 24,134,129,155,253,108,148,187,158,185,185, 61,112,187,223,147, 54, 35,219,205,
+150, 33, 38, 83, 91,170, 82,251, 72,234, 21,136, 44, 75,131,158,120,240,218,  5,135,243, 19,234, 39,157, 58, 23,198,205,134,158,
+ 46,184,189,126,204, 97, 57,226,186, 50, 58,207,207,255,244, 91,156,159, 60, 71, 57, 82,218,129,206,192, 77,125,147,171, 79, 62,
+ 97,170,145, 97, 88,236,251,120, 78, 52,109, 28,103,120,248, 36,242,250, 70,152,134, 35,185, 58,190,255, 72, 56,118,229,237,119,
+239,211,111, 31,114,117, 93,248,254,179,137, 71,187,200, 81, 29,212, 10, 33,226, 58,  4,215,136, 30,122, 20,164,  4, 90,237,  4,
+239,112, 65, 89,154,129,152,186,235,107, 75,165, 83, 74, 33,172, 89,146,121,127, 68,123, 93,229, 28,138,182,142, 15, 66, 26,183,
+120,231,216, 29, 26,193, 39,220, 48,216,234, 64,133, 30,155,165,171,215, 85, 88,239,206,172, 84,206,160, 82, 69, 42,222, 87,142,
+249, 57,165,193,245, 83, 35,234,149,249,150,180,137, 70,111, 67,169,187,204,237,225,200,163,103,141, 45,141,186, 56,190,246,141,
+251,124,240,238, 93,202,114,228,171,175,174, 24,211,158,146, 28, 62,109, 41,117,193,185,200, 50, 31, 80, 47,120, 25,200,203, 76,
+119,141, 19,159,232,170,204, 44,100, 17,124, 46,228,105,100, 83, 58, 26, 77,142, 90,102,243, 48,120, 28, 82,149,193, 69,230,118,
+228,216,149, 41, 12,168,247, 68, 21,235,230,103,135,159, 18, 37, 43, 74, 64,179, 66, 84,188, 91, 40,213, 83,107,182, 15,198, 57,
+226, 93, 39,250, 72, 89, 58, 89, 58,155,112, 36,149,128, 15, 27, 10, 71, 98, 28,169, 71, 97, 19, 18,221, 43, 26,138,125, 29,251,
+ 83,114,157,241,165,208,195,132,180, 78,223,121, 54, 93,169,222, 51,183,136,104,101,136, 19, 77,  2,  3,235, 78, 21,  8, 83, 36,
+ 75, 33,100,111,144, 32,  1,237,141,144,176,149,149, 10,  4,163,219,169,116,123,108,201,171, 58,124,187,253,167,174,166,187, 87,
+  8,111,233,181,219,251,138, 87, 13,158,105,212,106, 24,230, 63,139,127,106,195,  2,225, 10,234,141,143,210,231, 35,  4,199, 38,
+193, 46,139,125,182,120,133,217,112,176,221,123,228,194, 81,151,142,139,158, 78,132, 42,220, 81,207,143,255,248,  5,253,252, 13,
+110,255, 96,224,249,103, 63, 50,234,163, 27,193,109,104,109,135,139,138,246, 68,211, 74,243,141, 20,  6, 98,140,116,153, 65,148,
+ 50, 12, 68, 34,103,247, 46,128, 13,161,139,174,230, 29,147, 20,168,174, 60,244,224, 95,248, 86, 13, 31,187,238, 42,100,181,102,
+181,106, 47,112,212, 88,217, 34, 38,136,123, 17, 26, 48, 20,165, 73, 47,140, 34,103,187,233,168,214, 61, 93,111,  9,120, 10,101,
+149,128, 68, 23,168,173,226,197, 18,157,249,120,195, 87, 95, 53,110, 82,167,236,103,230,190,238,243,213,200,113,254,197,129,235,
+236,114,161, 88,199, 61,  5,139,179,235, 11,191,177,218,104,  3,188, 37,190,233,107,  0,208, 46, 16, 85, 27, 93, 23,122,119,134,
+164,244,171,134,214,153, 27,185,228, 74,242,142,150,197,176,183,106, 76,230,136, 82,114, 37, 79,158, 97,136, 72,105,208,189, 57,
+219,125,165, 85,165, 58, 75,226,158,223,191,203,135,249, 45,254,248,123,159, 82,214, 42,132, 87,103,166,178,125, 93,137,120, 70,
+180,243,193,250,252, 37,103,211, 75,246, 14,  5,187,204, 44,160, 34, 92, 94, 94, 32, 42,220, 28,247,124,253, 39,222,160,203,194,
+ 91,239,126,157,234, 29, 79,159, 60,230,201,245, 19,198,225,130,200,132,106,224,205,119,191,198,183, 63,122, 27,128, 24, 19, 23,
+ 49,113,113,118,246,242, 27,245,195,111,253, 24,239,125,231,183,121,252,229, 83,174,142, 71,158,127,245, 57,223,221, 45,204,199,
+ 29,119,206,206,136,226,249,225, 39,207, 57,217,158,178,137, 17,239, 60,219,120,151, 41, 37, 72,142,203,251,247, 17, 31,184,185,
+122,206,211,231,159,192,117,165,139,208,171, 16, 83, 34, 33,212,195, 53,251,249,200,102,124,151,182,157, 56,157,162,165,151,241,
+244, 13,140, 45, 32,163,245,162,123, 85, 98,130,124,124, 81,148, 52,  5,234,152, 26,162,131,145, 13, 81, 28,129,111,125,235,  3,
+198, 77,231,147,239,239,152,111, 14,236,111, 51,219,147, 83, 54,243,129,249,184,227,234,249, 42,210,137,194, 69, 19,158, 31, 42,
+ 97, 18,134,148,136, 58, 65,128,113, 59, 17,211,134,109, 83,246,135, 29,160,188,126,127,195,103,159,  6,138,203,  4,102,194, 56,
+225,110, 21,239,140, 54,248, 19,239,188,193,143,127,253, 14, 33,238,112,213,130, 63,  7,222,225,187,159, 55, 62,253, 65,231, 98,
+184,100,138, 25,161,178,180,  3,203,226, 56,230, 45,187, 99,228,203,180,224, 93, 69,219,196,199, 95,222,242,209, 91,151, 76,126,
+195, 15,190,220,241,195,175, 28,143,143,  1,141, 29, 63, 90,211, 36, 72,231,116,147,200,226,108,133,165,130,250,128,168,112, 46,
+ 59,170, 86,118,  8, 61,152,246, 84,164, 81, 98, 65,198,141,161, 75,187,154, 65, 42,  4, 68, 23,132,129,142,117,176,125,247,224,
+ 76,105,108,216,211,110, 53, 29,223,201,181,146, 98,  2, 23, 24, 16,164,174,136,101, 32, 55,251,208,191, 60, 29,144,161,177,155,
+111,169, 10, 90, 11, 45, 87,180, 11,183,168,173,244,162,231,245,187,167,124,250,229, 87, 60, 58,102,222,184,115,198, 71,175,159,
+144,175, 15,248,109,224,236,236,132,231,143, 14, 60,203, 51, 85, 78,232,245, 72,217,119,156, 79, 40,133, 86, 42, 42,142,193, 53,
+122,183,238,111, 79,129, 97,132, 88, 54, 12, 62, 50, 68, 40, 93,112, 85, 24,156,125, 62,149,118, 68,113, 28,252, 14,221,119,198,
+ 48, 34,234,  8,135,110, 33, 71,233,244,113,130,214, 25,112,228,222,144,113,160,183,  3,218, 60,189, 31,  8, 97, 34, 57,168, 82,
+145,238,225,232,136, 41,152,114,118, 39, 44, 46, 19, 91,176,222,124, 28,160,216,159,175, 40, 44,173,152,222,121,109, 91,148,210,
+ 72, 81, 41,101, 64, 99, 67,181, 82,196, 86, 64,246,  9,160,204,237, 64, 83,240,217, 19,199,129,249,144, 25,146,199,123,199,232,
+215, 26,166,115,212,210,113,216,103,147,  4,111, 96, 48,111,135,240,245,227,231,156, 93, 88, 56, 56,  4,135, 11,209, 72,161, 47,
+ 74,220,238,255, 95,226,188,150, 74,175,217, 46,128,238, 85,190,118,173,149,160,205,194,175,175,114, 52, 62,151, 70,171,118, 34,
+216, 90,248, 21, 31,234,165,145,115,129,214, 40,185,179, 84,155, 10,151, 37,115,212, 76,242,  3,168, 32,189, 83, 57,224, 38,143,
+175,158, 90,103, 11, 86,203,150, 92, 23, 92,237, 92,183, 61, 79,159,102,114, 61,103,190,217,209,203,204, 52,194,210, 59,199,221,
+ 66, 72, 13, 81,103, 21,237,110,109,178,236,151,245, 19,113, 67,102,199,184,158, 37,211, 38,  0,129,224, 83, 48,171,153,186,245,
+118, 39,235,193,214,205, 45,174,  6,250, 80,  5,  9, 66,119,214, 53,151,117, 39, 39,206,104,109,162, 98,206,116,233, 16, 20,154,
+195, 20,  4,245,101,191,209,137, 95,211,231, 29, 93,148, 24, 61, 93,108,132,174,226, 40,235, 24,166,211,204, 45,174,157,195,110,
+207,193,214, 90,118, 83,116, 98,216, 78, 93, 95, 14,246,133,224, 89,237,112,145,181, 63, 94, 13,215, 40,  1,117, 38,156,241,252,
+233,133, 68,197,118,214,116,197,117, 71,193,118,170,209,121,186, 87,122,151,151, 97,163,214, 87,  0, 64,104, 22,186, 80,160, 41,
+181,117,124,176, 32,142, 46,230,108,111, 44,168, 56, 88,108,204,222,139,224, 82, 66, 69,120,227,245, 55,185,185,190,229,179, 71,
+207,137,226,169,218, 80, 58,209, 91, 47,209, 59,191, 82,150, 76, 45,235,147,141,169, 10,141,  0,144,205,245,157,134, 13,120,184,
+126,246,  4, 23, 19,148, 35,223,249,173,127,204,102,154,120,227,226,156,175, 62,251,140,165, 54,210, 52,211,218,  1,137,167,188,
+253,238,  3,254, 63,127,118, 36,242,206,131,215,249, 63,253, 31, 17, 36,226,138,199, 71, 79,204,145,179, 59,247,216,166,137, 59,
+193,155, 19, 64, 32, 52,208, 65, 40, 58, 51, 31, 27,159,125,254,199,148, 67, 70,186,208, 68, 57,191, 56,103, 94,102,174,175,158,
+145, 75,224, 80,109,191, 29, 61, 92, 63,254,130, 82, 14,156,110,223, 97,228,148, 62,118, 98,114,230,222, 81,  8,189, 82,168,132,
+193,104, 95,139,243, 76,163, 99,222, 31, 16, 54,104, 20,134,170,204,205,170, 62,219, 77,100,222, 29,136, 67,194, 79,129, 71, 31,
+ 63,228,114,233,120,167, 60,189,186, 37,151,202,102, 19, 95,126,239,229, 92,217,229, 70,244, 51,163,159,241,201, 83,203,194,217,
+208,184,123,119, 34,157,142, 60,122,120,195,178, 12, 76, 49, 49,151,153,146,139, 53, 43,198, 17,237,202,  4,252,228, 79,190,203,
+201,137,135,230, 88, 42, 28,143,129, 47,110, 28, 95,126,254, 20,245,157,135,255, 55,107,111,250,107,105,118,221,231, 61,123,237,
+189,223,225,156,115,167, 26,122, 98,119,115,104,145,212, 44, 43, 98, 20, 11, 49,236, 36, 78, 12, 59,  1,  2,229, 67,254,199, 32,
+ 64, 62,248, 67, 32, 25,178, 44, 71,137, 13,107,  8,  4,137,146,104,138, 83, 23,123,170,234,170,186,117,239, 61,195,251,190,123,
+ 90,249,176,222,106, 54, 25, 82,148,168, 38, 64,128,133, 70,119, 23,171, 78,157,189,247, 90,191,223,243,204,  1, 57, 12,102,136,
+139,103,148, 57,227, 98,132,190,176,159, 58, 36,121,174, 46,223,128,250, 13,144,142, 63,255,238,158,111,190,215, 81,124,135, 12,
+171,107,122,137,  4,111, 75,178,154, 13,196,164, 50, 50,248,202,208, 11,125,218,243,122, 44,124, 99,170, 54,137,202,213,  2,120,
+162,164, 98,230,176,162,144,231,  9,105,149, 14, 33,210, 83,154, 85, 71,155,139,164, 60, 17,136, 68,111,129,213,150,101, 69, 69,
+103, 46,130, 29, 30,117, 73,184,208, 81,245,196,225,100,  2,139,178,204,244,195,200,217,217, 37,157,  4,234,220, 56, 29, 14,150,
+159,105,142,235,195,  9, 87, 13,183, 59,110, 60, 69, 22,156, 64,191,219,240,198, 27,103,244,190,242,254,179, 91,194, 33,114,209,
+141,188, 56,205,236,231, 74, 55, 22, 90,233, 80, 55, 17,196,170,170, 77,178,193,175,138, 77,217, 36, 52, 66,205,184, 57,128, 24,
+ 95,125,159, 42,155,205,134, 46, 70,102,141, 28,245, 68, 87,  5,209, 64,  1,134,179, 72,192, 81,114,163, 69, 33, 29, 10, 72, 37,
+ 68,251,126,211, 48,211, 14, 74,173, 86,243,245,189, 82,181,162, 58,227,180,163,181, 74,223,247,212,148,208, 10,131, 12, 76, 84,
+ 98, 44,104,173,214, 23, 94, 76, 81,218, 74, 35,132, 30, 29,188,113,255,155, 34,157,224,165, 81,176,124,129,111,222,208,177, 65,
+ 73,139,130, 68, 14,167,  2,161,216, 33, 61, 88,127,216,213,130,138, 49, 37,156, 51, 67,100,193,196, 84, 47,159,228, 90,234,186,
+ 79,142,148, 46,240,241,169,113,147, 79,132,160,244, 49, 16,186, 96,171,199,106,141, 34, 31,173,233, 99,181, 47,183,250,172,132,
+178,  2,102,156,179,169,229,188,159,168,171,236,105, 73,137,193, 82,201,159,201,107,186,214,130,188,116,140,124,118,204, 25,112,
+110,229, 11, 84,250, 62,252,189, 71,235,238,167, 92, 26,142, 75,161, 78, 22, 44, 70,192,123, 40,174, 99,185, 75, 38, 70, 27,171,
+169,177, 81, 58,221,224,114, 34,231, 61,174,101,202, 12,197,109,172,155, 63, 84,242, 97,161, 76,130,191,240,  6,128, 83, 56,150,
+104,159,237, 48,209, 92,207, 72, 64, 83,166, 31,  2,  9, 11,160, 55, 63, 80,189, 16,107,  7,199,142,214,101, 26,211, 90,123,198,
+202,255,165,148, 85, 93, 26,  0, 51,160,137,154,112, 69, 81,  8,  1, 81,235,203,218, 56, 93, 76,215,138,213,197,212, 55,227, 72,
+139,133,141,154,135,162, 25,215,108, 44,132, 19, 59, 40,221,203,154,154,165,148,179,218, 97, 27, 86,146,157,120, 33, 55, 99,189,
+247,226,152, 75, 89, 49,110,250,201,200, 58, 74,143, 80, 81,111,227, 41,193,209,106,195,251, 66,112,242,  9,  5,207,119,208,116,
+213,218,213, 96, 48, 14,177,189,180,139,182,  6, 72,139,133, 64,156, 54, 52,155,234,206, 90,  0, 22, 28,108,226,136,242,242, 15,
+142, 93, 66,154,  8,186,  6,241,164, 24,105,172,245,106,117, 64,196,  0, 42,117, 49, 96,138, 51,219, 91, 90, 42,195, 54,240,230,
+171,175,243,244,249,145,148, 18, 33,120,250, 56, 24, 56,199,137, 77, 41,130,217,223,170,115,120,141,150, 73, 40, 74, 82,165,235,
+ 20,  9,129,216,237,152,114,229,233,254, 68,244, 61,239,191,251,136, 60, 47,140,247,206,121,120,117,193,205, 97,143, 19,103,150,
+ 53,137,132,232, 57,205,135,159,250, 49,182, 95,185,245, 80,232, 61,236,149, 16, 59,182,103,103,108,227,136,244,158,232,148,101,
+113,  4, 96,114, 66,154, 15, 44,199, 35,105, 74,102,223,139,129,174,117,  8,129,203,179,123, 68, 13, 60,187,121,194, 92,142,184,
+185,146, 85,193, 71,150, 23,137,214, 22,198,254,140,139,251, 15,185,186,119,133,122, 71,153, 10,113,115,206, 54,118,108, 54, 29,
+ 76, 16,219,129,126,235,144,206, 17, 48, 19,210,177, 84, 74, 89,120,245,225,  3,252, 50, 51,165,194,171, 15,238,241,240,225, 21,
+237,235,223,227,112,152,120,243,157,119,120,253,149, 87,152,143,123, 30, 61,121, 78, 90,131, 42,209,103, 22, 93,209,160,226,201,
+181,225,139,162, 99, 32,211,115,111,219,113,188,254,152,239,126,247,134,203,179,123,156,247, 91,210, 50,209,114,134,166,180, 82,
+248,185,119, 62,207, 91,111, 62, 32,165, 71,164,105, 98, 58, 21, 94,204,175,241,254,117,162,229,133, 94, 58,164, 95,200,131,167,
+ 59,154,215,187,121, 71,215, 26, 25, 35,208,213,232,169, 33,147, 93,226,251, 55,133,101,154,200,190, 99,136,  1,231, 28,169,  9,
+ 37, 47,168,139,  8,246,153,186,223,195,253, 29,236,198,  5,  2, 92,246,129,116, 74,228,143, 42,184, 96,176,166,144, 41,171,163,
+ 91,104,248,113,160,169, 99,201,  9, 31,236, 11, 92, 43, 84, 20, 45, 19,142, 13,227,197, 25, 69, 28,243,139, 27,202,146, 57,209,
+  8,218,120,251,139, 15,185,217, 23, 82, 42,204,190,195,167, 76, 43,134, 56, 45, 10,231, 33,114,121, 17,152,211,204,233, 52,131,
+ 54,150,100,149,211,222, 11,169, 22, 92,116,220, 28, 14, 28,167,153,224, 55,252,194, 59,175,240,149, 47,236,200,  8,211,156, 88,
+246, 51, 71,102, 78,167,133,214, 54,156,150,  9,175,158, 49, 68,114, 91,208,165,  3,215,211,252, 68,115,172,246, 64,  5, 55, 48,
+151,140,235, 26,213, 87,  2,  1, 74, 71,118,137,101, 46,148, 86, 44,235,210,103,122,155,243, 82, 93,225, 84,138, 25,245,130,144,
+112,148,102,129,173,185,120,124,151,105,101, 34,202, 72,213,130,174,254,112, 95,  3, 16,233,164,103,138,137, 70,226,148, 23,198,
+110,192,197,128,180,200, 33, 45, 12, 67,181, 16, 91, 84,156,206,140, 37,130,219, 82,100, 38,146,145, 54, 16,116,161,101,165, 72,
+166, 70,163,228, 17,  2,133, 68, 32,218, 23,119,137, 68,117,212, 94,233,107,176,  4,190,218, 35,164, 57,111,252,  5,215, 32,122,
+212,179,174, 82, 58, 84,149,243,139,129, 47,124,233, 77,155,246,213,102, 12, 13,231,172,229,148, 77, 48,165, 86,220,164,101, 91,
+197,148,170,164,100, 99,235, 86,218,218,182, 72, 64,182,  6,132,  8,207,111, 39,230,180, 74,149,130, 55, 27,102, 16,115,106, 56,
+214,203,193,203, 10,153, 77,111,249,244, 64,192,253,224,232, 77,203,106,174,115,250, 50,213,245,153,237,187,107, 53,213,174,168,
+ 16,254,158, 33, 60,247,119,248,235,205, 89, 91,168,185,197,244,183,206, 62, 67,170, 16,124,228,133, 83,234, 32,196, 67,132, 21,
+ 95,238,232,112,165,145,154,192,182, 49,250,130, 46, 91, 22, 93,184, 89, 78,148, 15,158,211, 14, 79,209, 14,136,145,110,205, 99,
+ 73,235,152,202,132,118,141,172,214,101,215,234,113,205, 49,203,132, 15,149, 88, 51, 89,204,240,  6,141,160,249,  7,123,110,135,
+163,214,140,190, 12,181, 53,235,106, 59, 39,168, 22, 27,251, 84, 65,154,241,220, 13,184,102,123,115,105,138, 72,165, 21,147,168,
+132, 80,105,213, 94,210,174,173, 55, 59,103, 53, 52, 31, 60,190, 54,170,152,144,  0, 26, 34,118, 67,126, 73, 36,211,214, 12,191,
+ 42,  6,155,113,190,225,154,183, 11, 70, 51,115,141,141, 32, 33, 84, 71, 19, 79,107,141,210,156,117, 64,157, 64,201,134, 83, 84,
+161,182, 98,112,138, 12,137, 66, 44,242,146,127,183,174, 23,  2,205, 27,197,173,111,209,214,  9,161, 33,197,209,188, 67,226,203,
+155,108,181,203,143,  8, 75,173,120,181,196,125,203, 11,161,115, 56, 31,105, 52, 60,142, 83, 74,120,223, 17, 93,192,163,228, 12,
+155, 87,238,241,107,253,175,113,184,126,206,163, 15,223,167,212,194, 40,253,218,209,119, 52,245,224,171,169, 22, 93, 71,227,100,
+126,111,181,238,188,122,165,147,202,241,249, 11,242,116, 34,244, 27,238,142, 19,170,141,229,184,112,183,127,143,219,227,137, 24,
+ 35, 82,149,116,202, 28,143,137,239,189,251,136, 23,251, 19, 87,103,155, 31,255, 49,214,194, 71,143,175,209,162,246,226,115, 66,
+171,149,174,219,217, 75, 44,192,216, 25,225,139,182,225,226,193,134, 97, 55, 48,221, 77, 60,121,239, 61,170, 52, 92,110, 28, 91,
+166,187,218,160,210,168,169,176,189,188,160,118,133,143, 63, 42,228, 37, 83,152, 16, 85,106,245,188,120,241,130, 99,119,228,230,
+197, 11,110, 55, 59,124, 31,105,206,113,182, 29,120,248,234, 91,108,124,199, 82, 10, 42, 59,130,139, 92,157, 57,206,206, 95, 33,
+ 77, 11, 47,142, 47,184, 58,243,188,122,182, 37,244, 29,211,221,137,143,110,158,225,124,199,253,251, 87,148,230,104, 41,243, 95,
+125,237, 87,216,223,126,200,199,215, 55, 92,223,220, 48,198, 13,227,118,228, 60, 12, 12,189,  7, 47, 28,111,110, 13, 73,236, 19,
+215,215, 47, 72,181,231,222,171,247,168, 37, 80, 83, 98, 24,182,148, 50, 83,138,169,130,239, 95,158,243,203,191,240,  6,135,227,
+145, 15,175, 11,207,158,100,124,255, 42,231, 23,175,144,142,143, 81,  2,135,156,236, 53,236,148, 40, 30,239, 27,130, 39, 47,137,
+110, 20, 74,178, 47,225,187,219,107, 36,120,162, 23,110,211, 17,223,116,189,160,  6,124,236, 32, 64,175,133, 49,102, 30,158, 23,
+222, 62,247, 60,188,112,184,206,163,193,163,169,241,190,142,148,190, 18,212, 19,137,150, 31,105,149,146, 22, 66,232, 80,215, 24,
+ 54, 29,233,152,120, 62,221,209,111, 34,157,139, 38,164, 40, 48, 45, 71,250,101,100,236,123, 82,  8,180,229, 68, 75, 11,251, 37,
+241,215,223, 89,216,236,174,184,242,  9, 63, 94, 90,218,119,201, 72,128, 16, 33, 83,120,250,226, 41, 65, 61,169, 25, 12,199, 64,
+115,142,101,158, 41,  4, 14,203,145,227,113,207,217,120,193,213,249, 57, 63,255,246,  5,103,231,158,103, 55, 21, 61, 53,230,169,
+112,151, 50,165,  8,253,121, 68,162,103, 57, 44, 20, 47, 84, 76, 45,169, 90, 41, 75,179,133,154, 23,178,107, 72, 81, 92,128,154,
+ 51,197,  7,226,208, 81, 75, 34,231,133,162,213, 38, 11, 91, 65,138, 80,167,  5, 87, 79,150,157,233,  3,165,206, 20, 13,182,218,
+146, 96,197, 78,127, 66,134, 70,218,  3, 84,124,109,244,187,193, 40,123,161,176,164, 70, 40, 86,109, 27,182,  3,233,118,177,233,
+ 95,177, 76, 82,239,173,214,107, 97, 81,133,225,156,153, 66,215,  6, 80, 83, 25, 35,133,190,135,234, 29,125,245,180,217,113,146,
+138,146,209,174,153,162,122,216, 16,200,248, 86, 41, 83, 68,197,190,211, 74,177, 14,253, 16, 11,193, 59,156,  4,203, 31,181, 64,
+213, 76,168,133, 16, 35,247,207,182,108,215,158,250,240, 67, 51,243,149,146,245,233,255, 12, 63, 56,244,166, 53,239,172, 10, 11,
+202,237,113, 97,122,242,140, 90, 50,174,115,196,205,142,176,219,126, 66,153,171,106,144,  3, 87, 45,148,  9,159,180,141, 45, 51,
+165,214, 48,122,249,106,182,164,181,146,107, 99, 78,121,253, 46,111,236,239,142,104,131, 16,  2,136, 77,137,196,175,120,242,151,
+255, 76,247,119, 59,118,219,218,171,175,173,218,185,194,103, 63,126,175, 57,211,170, 17,227,178, 66,169,133,146, 45,115,150,106,
+ 69,167, 70,236,  7, 90,231,104,105, 94, 21,201, 61, 83, 75,196,126,192,105, 79, 59, 60,102,123,190, 37, 29, 19,223,251,248,128,
+182, 71,148,102, 23,108,156,177, 53,198,216,113, 42, 25,159,138, 93,192,226, 26,226,108, 11, 29, 32,177, 34,109,160,213, 68,236,
+148,167,122,201,181,165, 88,194, 42,105,177, 67, 88,188, 95,193, 46, 43,215,121, 77,178, 91,177,208, 17, 92,161,184, 98,169,245,
+102,191,140,206, 89,122, 62, 23, 83,116,138,115,235, 47,103, 91, 95,254, 47,247,215,  5, 21,219, 87,219,182,123, 53, 68,181, 74,
+109, 66,240,129, 90, 22,112,206,196, 18,206,234, 97,226,237, 28,183, 17,126,253,164,119,238,219, 74,176, 11,246,114,110, 85,145,
+ 10,213, 85,219,155, 59,  7, 77,232,188, 35, 59,112, 81,160, 54, 60, 30, 87,100, 29,125,123, 35,193,169, 37,253,165, 52, 82, 43,
+140,209,170, 10,166,118,181, 27,173,119,117,197,233,253,224,  3,218,188, 67, 37, 24,220, 98,129,216, 41,126, 69,199,138, 40,212,
+130,230,  1,149, 66, 45, 66,161,112,121,177, 97, 28, 59,226,182,227,209,187, 31, 48, 77,139, 73, 39,240,168,  6, 91, 64,104, 99,
+105, 51,115, 78,176,202, 69,166,101, 38,164,128, 68,103, 96,154,148,136,125,180,151, 95,232,208, 52,115,119, 60,128,152, 96,163,
+ 34,100, 50,167,105,226,227,119, 63,226,247,126,255, 15,248, 95,127,251,127,250,177, 31,243,239,124,227,175,248,207,223,123, 15,
+ 21, 11, 52,150,101, 70,  3,196,109,207,176,233,209,229,  4, 97, 96, 51, 68, 14,251, 27,254,224,247,255, 45,190,239,217,132, 17,
+197, 51,108, 55,136,120,186, 24,185,216,236,232,165,103, 57, 77, 28, 79, 39,210,105,193, 23, 49,200,141,246,164,164,164,249, 96,
+ 48,160, 82, 72,122, 34,207, 19,253,174,199,119,194,208, 95,242,236,241, 99, 35,125,213,134, 43,137,155,155, 74, 87,  2,126,124,
+ 70,220,245,208, 42,175,157,191,205,118, 60,231, 91,223,124,159,219, 23, 31,242,  7,127,242,151, 60,126,242, 28, 45,149, 16, 60,
+ 47,246, 47,248,240,233, 13,149,106, 10,219, 69,226,193,  0,  0, 32,  0, 73, 68, 65, 84,211,211,194, 49,100,138, 38,206, 54, 14,
+233, 59, 46, 99,207,248,202, 21, 31,223, 92, 51,157, 78, 76, 83,162,106,207, 91,159,123, 72, 58,135, 15, 63,124, 76,120,249, 37,
+221, 28, 81,225,213, 55,238, 83,232,248,214,119,102,142,233, 62, 89,183,252,242, 91,191,204,245,237, 53,169,218,225,237,154,224,
+ 91,143,180,133, 73, 11,195,176, 65,242,201, 94, 75, 51, 86,249,235,  6, 62,120,250, 49,103,219, 11,150,201,  0, 40,213,217, 69,
+ 87,201, 92,196,204,131,209, 14,244, 93,  8,188,241, 90, 71,191,235,204,  5,144, 28, 50, 10,249,174, 82, 82, 68,165, 16, 98,103,
+ 64, 37, 26, 82, 42,169, 11, 88,230,171,225, 93,160, 68,219,196,217,142, 54, 24, 68, 42,128, 75,153,219,167, 31,154, 39, 93,132,
+ 86, 28, 77,205,133,144,150,198,197, 69,135,239, 58,118, 18,152,150,147,177, 42,212, 81, 11,180, 86,153,247, 19,206,123,170,194,
+236, 32,202,192,110, 48, 31, 66, 58, 90,242,126, 24, 54,132, 97,203,107,175,244, 72,175,124,252,244,192, 41, 21,106,132,229, 80,
+ 56,156,160,180, 68,119, 47, 88, 63, 61,  6, 90, 45, 22,100,109, 61, 85, 29,165,174,106,229, 32,248, 86, 56,145,136,110, 96, 51,
+116,200,224,109,164, 93, 27,197, 59, 58, 81,178, 91,209,166, 34, 86,181, 28, 58,160,226,114,193, 81,105, 21, 34,118,209, 31,186,
+ 74,174, 13,246,158,216,143,180, 58, 81,146, 39,102, 79,149, 74,171,133, 56,120, 90, 24,112,169,209,230,  6, 33,178, 80,169, 83,
+194,197,  1,239,242,234,  5,243,196,  2,117,185,161,250, 64,212,145, 77,244,204, 90, 73, 85, 40,222,177,243, 74,189, 19,102,151,
+161,  9, 18, 70,196, 53, 11,226,105, 97,222, 10,211,148,233,179, 35,110, 58,212, 43,203,169, 33,187,128,116,129, 86,148,156, 51,
+125,244,166,164,118, 14, 98,143, 14, 29,225,103,244,146,143,230,214,  6, 96,135, 35,236,  6,158,238, 55,156,142,123,130,  8,175,
+ 63, 56,251,177, 47, 95, 93, 15,211,151, 63,104,138, 29,248, 47, 51, 87,117,125,249,163,164,162,204,199,153, 82,103,220,186, 50,
+120, 49, 21,246,101,193,203,130, 97,203,193,  7,103, 13,171,182,174, 86,229,165, 46,219,173, 20,207,151, 57,174,151, 60,122,187,
+  2, 28, 83,101, 58, 76,168,179,151,237,233,184, 55, 24,149,179,224,167,172, 43,220,127, 24, 77,174,160, 75, 66,235,234, 78,168,
+ 21,231,173,118, 24, 67, 33, 29, 26, 76,153,224, 50,179,119,148,236,168,186,103,112, 27,170,243,  8, 21,231, 61, 75,157, 81, 87,
+193,245,212,184, 32,110,135,228, 17,105,149, 89, 27, 57,207,134,171, 30, 34, 46, 39,148,142,226, 27, 46, 37, 74, 87,168,169,225,
+156,163, 27,183,236,252,194,219,111, 92,217,159, 15,113, 47,107,103,235,174,218,252, 85,180, 86,205,226,229,215, 93,117,211,181,
+183,110,164,170, 38,213,252, 47,205,125, 66,140, 67, 13,202,162,173, 65,181,215,108, 83, 11,206, 73,244,166, 39,109, 74, 94, 57,
+240, 81,172, 46,235,221,218,131,111,118, 11,110, 43,  2,182,122, 75,212,231,154,140, 60,236,236,239, 83,103, 35,247, 66,251,  4,
+112,227, 93, 65,124,160,153, 41,154,206,201,154,  4,182,223,136,190,247,168,247,120,167, 72, 53,171, 28,234, 13, 55, 43,182,253,
+111,213,120,217, 78, 28, 75,203,136,115, 44, 88,112, 47, 74,160,173,216, 90,251,121, 11, 65, 76, 98,163,173,173,112, 17, 71, 45,
+141,141,119,184,102, 17,212,174, 11,180,182, 16, 92,192, 59, 33, 87,199, 82, 23, 74,106, 92,221,123,192,110,179,227,219,127,243,
+ 93,110, 15, 71, 98,103,201, 93, 85, 89, 43,133,117,237,185,103,227,205, 59,135,122, 79,173,142, 16, 27, 83,154,168,119,153, 24,
+ 58,124,  7, 75, 93, 56,206,137,174, 55, 95,183,186,149, 29,191, 36,210,205, 51,254,236, 63,253,223,188,184,123,198,231,238, 63,
+224,234,222,  3, 94,185,127,143,171,251,151,252,241,159,254,  9, 95,255,139,191,230,246,230,134,211, 50, 51,207, 11,173, 21, 68,
+ 97,123,118,193, 38, 58,138, 92, 48,167, 19,231,225,  1,175,221,223,241,221,179, 11, 78,211,194,221,124, 71, 81,165,221,124,140,
+132, 64,171,149,143, 62,122,151,179,110,128,174,231,237,207,125,133, 77,220,114, 10,  7,131,127, 56, 71,210, 66,144, 17,239, 12,
+ 40, 34,162,104, 52,120,198,160,  3,115,170,252,163,223,250, 37,254,213,191,250, 23,252,233, 31,253, 49,239,125,248, 30,167, 52,
+ 17,179,176,185,127,206,183,255,242,175, 72,203,129,239,125,251, 91,124,249,139,111, 18,203,115,156,116,252,218,175,253, 58,254,
+207,255,154,179,205,192,247, 30,189,207,114, 58,113,251,252,150,205,185,231,213,251,231, 60,123,188, 97, 81,101, 89, 22, 92,189,
+ 37,231, 72,220,109,185,186,186,160,107,142,219,219, 61,187,237,  8, 26,249,222,119, 62,228,176, 79, 36, 45,156, 14, 71,130,  9,
+171,233,250,142,123,151, 15,184, 73,194,184,185,143, 15, 51,231,175,188,197,131,207, 93,241,225,147,239,208,123,101,142,137, 88,
+ 42, 50, 26, 62,173, 29, 19,117, 57,161,193,209,134,136, 84, 65,100,195,199,207, 62, 32,116,141,  7,247,207,248,214,163, 39,244,
+193,115, 62, 78,108, 99,226,225, 78, 56,223,122,122, 47,120,215,177,180,138, 68,199,112,181,161,204, 19,165, 19, 66,111,137,149,
+187,211, 68,173,133, 49,244,182, 19, 69, 56,169,193, 91,108,  2, 20, 72,185, 24,214, 23, 97, 42,142,121, 90,  8,210, 32,  6,227,
+236, 47, 11, 73,247, 43,202,217,242, 47, 49, 42,125, 28,232,186,  1,233, 60,253,102,195,225,217,  1, 87,149,230, 44,  1, 47,205,
+ 62,147,115,129, 82,102,198, 56, 66,240, 76, 57,227, 66, 97,202,  7,198, 46,226,226, 25, 15,238, 13, 60,120,112,198,130,112,172,
+194,254,174,145, 75, 99, 58,101,150,165,174,135,174, 24,131, 62, 11,185,122, 92,236,112,193,144,174,100,103, 97,209, 90,104, 47,
+171,172,197, 19, 34,136,118,159,144, 26,195,176,195,215,128, 43, 51,121, 49,106,185,247,138, 23, 80,239,209,  9,168,227,234,163,
+104, 20, 85, 38, 87,160,244,164, 50, 17,  6,207,224,118,100, 63,147,105, 12, 10,117,169,132,104,141, 19,154,226, 90,160, 31, 50,
+148,130,110, 59,202, 98,147,204,144, 70,170,203,232,  0, 97,  9,  4,151,217,179, 39,106,193,123,165,186, 17,114, 69,114, 70,123,
+ 27,179,250,176,218, 29,181,163,180,106, 50,151,187, 64,140,  1,233, 59, 82, 80, 70,233,217,141,197, 50, 67,197,162,138,131, 88,
+ 24, 43, 55,199, 16,123, 19, 40, 53,165, 11,159,145,157,173, 42,181, 54, 68,161,239,194, 79, 28,101,127,234, 46,176,174, 87,225,
+135, 10,117, 65,126, 40,225,126, 58,235,121,242, 97, 35,165, 76,140,158, 87, 95,127, 64,232, 59,211,153,174,255,190,234, 86,140,
+117,181,148,121, 91,167,  3,154,171,101,169,212, 81,180, 65, 42,102, 73, 44, 74,202,153, 60,159,140, 77, 33,141,214,148,247,158,
+ 29,248,248,118,198, 96,253, 48,120,111,144, 48,252, 74,131,115,230, 36, 15, 86,130, 86, 85,147,248,120, 89,207, 59,181,233,147,
+216,138,116,159, 26,199,219, 23, 20,210, 39,147,213,212, 18,217,123,171,231, 22,  1,183,144,252,158, 78, 34,193,193, 60,205,184,
+208,168,115, 33,181, 19, 72,226,162, 63,163,212, 30, 45,135,117, 77, 36, 20, 87, 40, 28, 16,173, 12, 93, 68,203,200,114,154,  8,
+253,136,107, 74,171, 51, 62, 11,174, 52,170, 91,136, 99, 79, 73, 19, 78, 35,231, 62, 18, 66,111, 98, 33, 37,175,250, 59, 83,192,
+ 57,117, 54, 38,199,161,205,106, 89, 22, 76, 91,157,203,120, 75,201,131, 17,231, 84,215,181,236, 26,220,248,132,250,166, 86,181,
+112,198,144, 71, 87,110,112, 85, 42, 32,157, 71,155,253,  6,138, 56,114, 41, 56, 31,108,244, 94, 10,213, 25,182,213,173,211,130,
+166,246,246,151,216,209,105, 91, 59,142,107,112, 78,109, 20,228,164, 33, 65,112,  8,226, 12, 54,225,165, 81,138,237,249, 35,158,
+220, 10,206,  9, 46,  4, 43,247, 23,  5,201,208,108,231,212,212,170, 36, 77,236,114, 97, 53,162, 70,107,150,158,206, 25, 74,  2,
+ 85, 91, 63, 56,177,142,176,115, 98, 19,  0,239, 88,138,173, 19,130,116,248, 16,  8,177, 82,214, 17,183, 84, 79,150,134,244, 30,
+173,194,102,179,227, 43,191,240, 85, 30,189,251, 46,143,159, 92,219,174,170, 11,118,211, 93,105,118, 52, 27, 97, 53, 39,116, 62,
+112,222, 69, 14, 47,110,169,181, 50,105, 35,167, 74, 88, 50,  9,251,226,110,185, 80,170,195,239, 60, 41,  7,230, 50,115,115,  7,
+137,200,237,254,207,249,155,  7,103,108,124, 79,204, 21,183,233, 56,236, 15,236,143, 51,121,158, 57, 78, 39,230,211,158,121, 89,
+ 75,127,249, 68,206,137,193,143,228, 84,152,188,176, 95, 50,175,127,241, 29,104,130,239,148,227,221, 76, 94,102,114,154, 40,197,
+163, 53,177,204, 55,136,194,217,253, 11,110,110,230, 21, 94,  4, 75,  5,143, 93, 56,  8,  3,174, 54,148,202,182, 31, 17, 31,216,
+108, 54,124,233, 23,191,204,111,255, 47,191,205,118, 28,248, 23,255,242, 95,178,164,196,233,120, 66, 81,238, 93, 93,241,239,127,
+255,223,241,111,254,207,223,165,186,204,147,103,143,249,173, 95,255, 60, 47, 94,204,116, 33,208,117, 59,254,217, 63,255, 26,255,
+120, 89,248,223,255,183,223,225,233,245, 19,222,216, 94,114,249,218,134,123,207, 95, 97, 90, 86,164,166,206,220,221,237,121, 49,
+ 77, 72, 23,217,109,  7,166,220, 80, 13,204,167,137,155,155,  9,209, 12,209,155, 32,161, 22,232,224,226,225,  3,250,113,195, 54,
+246,198, 95, 24, 59,222,126,235, 53,158,127,252, 33,215,207,159, 34,120,164,  5,212, 53, 42,  9, 52,152,209,206,  7,202,188, 48,
+196,158,109,220,112,154, 22, 78,167, 27,222,122,251, 45,150,214,240,226,120,112, 89,248,210,165,114,113,111,131,168,210,185,222,
+178, 42,210,  8, 19,104, 88,237,127,157, 35, 31, 51,117, 49,  9,205,126, 78, 56,233,240,206,217, 23,163,102,150,178,112, 56,220,
+ 48,158, 93,160, 88, 24,169, 54, 99, 84,111, 54, 27,230,227,222, 94, 44,169,174, 33, 46,243,222,131,226, 90,165,180, 10,173, 34,
+163,167,235,  7,134,190,163,186,145,105,190, 54, 83, 93,112, 68,111,234,219,172, 54,109,211,164,102,123, 43, 19, 53,205, 12, 30,
+198, 46,224,194, 25,231,231,  3,239,188, 57, 66,173,124,240,254,129,146, 78, 44,115, 35, 33,104,241,204,121, 34,196, 96,201,142,
+154,172, 82, 26,236,133,149,106,166,148,134, 84,104, 62,211, 90, 36, 68,165,147,194,178,156, 56,180,145,158,108,136,215, 20,137,
+179, 34, 93,196, 69, 59, 56,106,200,248, 26, 57,238, 79,132,222,227,197,161, 36,106,137,184,126,125, 12,104, 35,118,129,164, 66,
+ 44,137,185,100,186, 93, 88,105,154, 59,136, 29,130,160, 82, 81, 31,208,206, 30, 27, 53, 71,134, 26,104,237, 14, 84,168, 62, 18,
+183, 59,123,101,114, 36, 59,147,222,104,201, 28,136,248,112, 64,147, 77, 27,194, 24,233,180,152,164,131,  8,206,156,  6,217,  5,
+124, 95, 73,217,130,177, 99,115,198,236,239,192, 47,142,190,111,104,113,104,240, 72, 47,198,203,112,106,210, 45, 17,186, 24,127,
+230, 87,232,167,223,176, 90,215,174,183,115,  4,255,217, 81,217, 58,183,158, 29,193, 51,244, 29,219,161,  3,160,247,  6,  0,250,
+161, 81,183,117,156,112, 63, 58, 17, 88,113,173,121, 13,215, 54,251,186,228,250,230,196,124,253,130,211,180,167, 11,194,238,222,
+  5,174, 31, 73, 21,180, 86,230, 21, 41,142, 42, 45, 25,144,201, 46, 28,197, 88,244,101,177,243,196,153, 64, 43, 83,104,165,208,
+106, 51,221,248,169,216,180,170,158, 40,181,177,148,108,121,179, 92,145,102,240, 36,205, 13, 37,114, 76,208,186,202, 54,118,204,
+ 68,114,223,136,197,209, 74,228,148, 15,244, 98,159, 17, 21,135,107,153, 86, 29,157,223,208,188, 82, 59, 19, 24, 57, 23,153,211,
+158, 14,161, 91, 65,145,140, 29, 45,219,154, 60,116,194, 50, 45, 38, 24, 91,153, 82, 65,109,134, 78, 83,187, 97, 57, 12, 72,111,
+163,235, 98, 35,118,111,234, 79,219,155,136,241,183,  9,148,102,212, 42, 17,143,183,118,153,197,214, 90, 69,171,172,151,  4,197,
+117, 98,135,165,179, 81,119, 45,  5, 87, 26,234,189,101,216,138,237,144,181, 53, 11,239, 52,104,  4,196, 41,222, 53,  8,130,170,
+ 16,157,144, 83,182,  3,212,  9,205, 25,126,214, 55, 11,237, 41,160, 69,  9,107, 87,183,161,116,226, 64, 43,185, 88,175, 54,186,
+245,128, 44,217,166,  9,209,110, 96,181, 53,114, 89,209,153,234,  8,120, 11,137, 52, 71,108,129, 89, 51,139,154,139, 26,113, 72,
+243, 20, 50, 62, 10,154,131,229, 13, 80,194, 92,241,155, 96,127, 24,170,144,114, 37, 70,165,106,198,121,143, 68, 37,210,129,102,
+ 83,188, 98, 52,181,119,222,249, 18,155,190,231,221,247, 30, 83,150,100, 31, 20,231, 63,  9,  2,170,179,177,120, 16, 35,119,125,
+124,123,195,146, 50, 33,  4, 82,201,230,106, 30,162,153,223,106,163,208,112,201, 42, 99,211, 97, 33,247, 74,105, 79, 25,150, 13,
+211,146,200,189,253, 28,143,143, 23,104,205, 26,  9, 45,179, 44, 11, 89,149, 66, 93,117,180,141,229,228,  9, 87, 61,193,207,156,
+191,250,128,167,127,253, 30,239,126,231,235,132,254,156, 94,192,135,136,247,145,224, 61,195, 24,240,253, 14, 13,247,209,211,129,
+ 52,221, 48,151, 19,126, 24,208,121,161, 74, 69, 80,186,206, 51,158,157, 49,205,197, 62,115,162, 72,140, 56,173,252, 23,191,252,
+107,108,199, 31,140, 16,251,174,163,239,186, 79,126,252, 27,191,249, 95,242,159,254,228,143,120,113,253,132, 37,103, 66,188,199,
+217,121,230,201,251,239,241,241,211,143,248,254,211,107,254,199,127,250,235,252,206,239,254, 33,215,183,  7, 30,172, 97,160,148,
+102,110,175,247,156, 93,108,184,119,255, 62,205, 85,238,110, 14,236,247, 71,206,118, 35,231,155, 13,115,158,113,169, 90, 54, 67,
+196,242, 37,193,177,217, 12, 60,124,237,156,175,254,242,207,179, 45, 35, 14,225, 88,238,120,237,245, 55,152, 78,  7,190,253,141,
+111, 35,178,165,184, 76,203,109,149,247,216, 31, 98,240,156,166,140,150, 70,205, 21, 55,220, 17,198, 66,215,  5,196,123,106,186,
+230,213, 11,229,193,182,241,234,133,224,124, 64, 85, 62,249, 22, 11,  3,236, 98,103,196,197,176,162, 91,233,209, 34, 60,190,113,
+ 28, 82,199,249, 54,114,170,176,  9, 30, 57,205,156,106, 35, 45, 71,115,168,111, 70,251,179,136,160,213,129,120,134,221,  5,183,
+119, 31, 83,115,161,235,251, 85,225,153,237,101, 38, 66,231,189,217,237,188,167, 11,194,232, 58,234,148,168,190,225,162,179,  9,
+ 66,236,137, 94, 57, 29,102,156,243, 52,231,105, 53, 83,188, 85, 49,247,139,162, 50,176, 57, 59,231,141, 87, 35,155,251, 61,251,
+199, 19, 55,119, 39,114,182,170,102,170,246,197, 92,251,192, 86, 60,157, 12, 44, 46,179, 44, 14, 98, 98,104,129, 41,173, 85,219,
+174, 67,124, 66, 17,242, 58,133,208,214, 19,218,128, 84,165, 95, 39, 33,181,154,119,186,206, 29, 93, 39,244, 81, 32, 41,185, 56,
+202, 97,194,109, 55,182,143,214, 74,107, 30,150,202,208, 65,114,133, 62, 10, 37,103,218, 70,200,205,211,171, 35,233,132,250, 70,
+239,172,131,174, 37,225,179, 16,194,198,148,188,121, 33, 12, 17, 90,164, 21,165,206, 11, 85, 27,213, 23,194,176, 69,221,140,  6,
+207,232,183,132, 54,225,154, 61,152,244,120,160,116, 17, 52, 33,174,178,137, 29,139,131,238, 44,154,197, 47,207,204,171,189,109,
+ 24,140,252, 24, 98, 32,217, 93,145,224,212,132, 91,  1,170,135,232, 10,193,143,182,155,254, 25, 14,244, 19,176, 89, 15,208, 35,
+112,156,138, 77, 87,117, 53, 86,126,102,118, 54, 91,219,184,  6,241,167,116,223,253, 79,154,  8,172,255,187,255,145,191,189,158,
+245,148,125, 64,230,192, 48, 70, 62,255,202,149,  9,193,128,  5,155, 32, 56, 32,175,151,  0, 89, 91,111, 47, 93, 35, 75,174,246,
+136,109,138, 86,229,176, 44,246,247, 22, 71, 93, 10,243,179, 61, 78,158,144,247, 51,  1,101, 84,152, 22,  7,235, 67,180, 81, 25,
+123, 88,230,192, 60,207,132,188,224,220, 57,120,193,231,231, 56,109,  8,145, 37, 37,146,191,166, 16,169,203,129, 57,120, 74,128,
+ 94, 78, 56, 63,160, 51,168,156,112,120, 40, 14,183,137,232,210,161,238, 72,117,149,160,133,178, 20,188, 84,104, 91,230, 67, 36,
+189,247, 17, 31, 15,151,118,168, 59,111,187,107, 45,197,246,199,110, 37,169,137,141,148, 69,237,213, 38, 65,112, 77,236,214,236,
+148,205,253,215,184, 55, 46, 60,127,124,205,169, 88,154, 84,170,251, 36, 53, 46,212, 85,101,106,149,145,210,204,175, 46,226,237,
+189, 95, 45,217,222,104,198,120,119, 38, 89,209, 21,251,162, 84,106,182, 15,148, 11, 14, 13,224,242,202,  1,244,110, 77, 58,234,
+ 75, 27,186, 49,235,155,208, 58, 11,209,181,182, 38,192,157,128,175,182, 22, 48,224, 59,218, 10,170, 74,107, 30,  9, 66,110,118,
+  9,240, 30, 51,189,149,180, 42, 42,253, 58,106,244,148,100,  7,152,147, 98, 88,206,218, 96, 81, 58,103, 99,208,170,216,205,168,
+100, 58,245,132, 94,105, 98, 47,140,232,172, 37,144, 37, 91,122,116,101,222,233,250,169, 18,132,183,190,240, 54,195, 56,240,189,
+239,189,203, 33, 37,134,110,164,143, 29,185, 20,243, 25,163,228,101,226,246,214,155, 33, 46,152,167, 57,101, 35,227,213,210,200,
+ 41, 17, 98,199,249,213, 37,181, 86,168, 51,173, 66, 90, 10,141,196, 49, 39,134,227,145, 83,116, 52,239, 63, 33,238,213,  6,165,
+206,228, 50, 83, 75,161,212,130,163,145,151, 74,154, 39,150,231, 31, 19, 54,142,171,123,231, 12,187, 29,191,242, 75,191,193,146,
+ 61,183,211,129,105,127,205,148, 27,249,116,164,164,132, 11, 17,156,242,240,242, 21, 74, 90,136, 69,120,112,113, 73, 14, 71, 94,
+ 28, 28,197,159, 16,  9,204,211,204,213,249, 57,131,143, 60,190,185, 35, 58,  8,155,142,205,249,229,223,250,  7,253,236,236,140,
+ 55,222,124,133,143, 63,124,204,180, 63,240,238,199, 47,248, 39,191,249, 53,110,238, 30, 19,187,198,183,191,241, 61,246,255,232,
+171, 28,231,180, 94,182, 28,243,205,204,105,127,199,254,120, 96, 90, 14,148,101,225,193, 43,151,184, 93,227,238,144, 13, 97, 28,
+ 29,154, 13,113,252,242,146,170, 41,241,218, 91,111,240,181,255,250,159, 82,239, 14,244,165, 82,242, 66, 12, 29, 67,191, 97, 51,
+108,152, 31, 63, 99, 19, 59, 66, 63, 82,202,204,220, 47,182, 39,173,142,139,152,136, 57,115,229, 79, 68, 14,140,125,161,239,206,
+120,244,100,207, 23,223,190,207,231,223,112,204,143,159, 17, 46, 46,141,205, 80, 33, 86,243,120, 59,169, 44,174,193,198,211, 19,
+ 32,  4,194,166,195,221, 38, 56, 19,150,187,196,205, 93,198,133, 13,231,195, 57,161, 84,168, 74,212,194,205,109, 69,169, 76,211,
+ 29, 34,202,184,187,132,102,204,119,233, 28, 37, 85,134,126, 67,209,163,129,155,154,  7,239, 88, 45,204, 54,  6,119,230, 93,151,
+206,227, 99, 79,118,149,232,123,106, 41, 84,117,212, 82,216, 79, 21,161, 90,221, 78,132,162, 48, 32, 76, 84, 22,223, 19, 55, 59,
+206,207,  2,157, 84, 62,250, 96,207,233,102, 97,154,103, 74,237,241, 33, 82,164,176,180, 74,153, 42, 97,240, 52,151,236, 59, 33,
+ 39,118, 46, 16,  9,204,173,210,121, 40, 57,127,114,169, 46,181,224, 17,188, 79, 56, 47,196,110,139, 27, 35,156, 38,124,139,248,
+146,168,222,248,234,209,121, 22, 10,157,143,208, 57,106, 73,136,136, 17, 21,235,130,120, 27, 97,163, 13, 87, 77,197, 27,219,186,
+150,104, 25, 33,227,188,146,178,226,221, 25,137, 59, 10, 29, 73,149, 24, 55,224, 22,219,173, 10,200,224,201, 53,209,137, 71, 36,
+226,146, 25,223,134, 81, 72,117,166, 52,199, 86,108, 53, 55,229,194,216,197,149, 20,185, 48,107, 68, 75,101, 57, 45, 70,169,220,
+ 88,250, 57,120,152,  5,235,115, 23,243,169, 55,177,118,146,184,138,211,130, 22, 40, 62, 48,244,221,207, 68,126,115,134,158,255,
+193, 69, 26,251,238, 47, 43,  0,167,143,241, 51, 59,212, 75, 81, 92, 45,150,123, 10,159,177, 22,181,169, 53,183,  4,235,246,175,
+ 78,249,176,254,247,229,127,226,203,255,211,238, 71,110, 15, 63,178, 98,168,187,136,137,187,237, 61,255,193, 43, 23,124,243,235,
+133,116,247,156,206, 57,114, 20,166,156,168,116, 68,157,  0, 79, 41,133, 67,190,193, 95,108, 24,117,228,116,187,103, 92, 34, 55,
+181,208,188, 80,124,193, 43,140,178,195,199, 35,174,141, 52,  6, 98, 59, 80, 92,162,158, 38, 66, 27,232,  6, 79,105,141,141,246,
+ 84,122,146,155,105,174, 32,  5,156, 27,112,113, 36,178,144,253,194,215, 15,137,119,255,245, 95, 82,142, 95, 39,120, 31,144,151,
+135, 81, 19,123,181,161, 80, 65,157, 88,  8,161,130,203,106,125,116, 26,184, 70,118,145,207,125,249, 87,249, 31,222, 89,248,227,
+223,253, 15,124,253, 90,105, 75,181, 32,130,179,125,151, 45,217, 61,181,218, 66, 95, 80,162, 40, 69, 87, 35, 91, 19, 35,200,173,
+221,116, 95,141, 23,239,229,101,229, 77,105, 98, 35,110,106, 53,162,155, 91,143,240, 44,248,206,210,128,173,217, 17,169,206,174,
+  3, 53,155,223, 92,116, 69, 16,198,  8, 43, 52,163,174, 59,199,128,162,222,236,107, 37,151, 79,104,115,100, 51,204, 41, 74, 43,
+224, 67,179,253, 23,130,115, 38,135,137,222, 58,245,234,  5,223, 11, 78, 35, 81,140, 80,167,213,254,249,174,239, 87,239,174,176,
+ 52, 33, 52, 51, 64, 69,137,120,223, 67,104,232,100,187, 65, 71, 67,164,195,121,229,213, 55, 94,165,235, 59,190,243,157,119,121,
+113,119, 68, 66, 64,130,133,231,188, 19, 66, 23,120,122,243,204, 46, 58, 17,150,197,126,109, 93,133,172,133,171,123,247,248,210,
+231,223,166,223,142,124,248,193,  7,136, 15,220,221,158,  8,205,184,216,173,155, 56,228,  4, 39, 35,226,137,116, 70, 94,106, 88,
+216,  9,152, 15, 51,237,101,118, 65,  3,167,195, 45, 50,156,227,124,199,221,243, 39, 60,250,246, 55,141, 96, 21, 58, 54,195,  5,
+103,231,247, 12,252, 83, 46, 13, 52, 84, 10,167,227,173,217,138, 28,108,182,155,213,172,215,115,207,119, 60,187, 89,168,100,206,
+119,  3,189,247, 84, 93, 12, 36,227, 26,154, 26,211,225,248, 83,172, 81,133, 52, 21,118,231, 87,208, 18,105,233,233,183, 15,209,
+149,172,246,238,163,239,243,236,110,194, 85, 71,154,142, 28,151, 45, 13, 56,205,139,173, 77, 90,224,249,237, 29,139,102, 94, 63,
+191,162,247,149, 82,204, 81,223,196, 35,162,184, 98,140,241,165,101,158, 63,187, 97,186,153,185,186,122,149,235, 39,239, 50,140,
+ 14, 87, 51,159,127,243,171,  8,240,253,231,215,120, 81,122, 61, 90,182,  4,143,180,198, 23,198,231,120,157, 73,163,240, 96, 87,
+  8,109, 65,189,227, 46, 45,148, 71, 11,191,250,155,111,194,233, 49,213,193,195,171,130,139, 61,167,131,131, 14,216,246,224,149,
+174,234, 58,202,245,132, 24,113,110, 68,130, 25, 15,143,183,133,219,195,196,249,189,183,136,221, 22, 14,215,148, 83,101, 18, 11,
+140,122,231,200, 57,155,171, 62,118,132,110,131, 72,160,181, 66,144,  8,227,  6,113,194, 52, 29, 17, 87,168,185, 80,106,166,243,
+ 17,117,150,192, 31,199, 13,  1,207, 16, 60,167,101,161,235,  5,217,158,113,186,155,168,243,132, 35,154,208,169, 40, 34,133, 41,
+ 43,179,107,184,176, 97,220,189,206,217,133, 39,250,  3,251, 67,193,105, 92, 17,211, 17,215, 26, 83,106,164,146,209,220,232,156,
+195,251,142,146,102,170, 23, 36,  6,166,162, 44,221, 66,183,  3, 95,148, 67,171, 72,139, 54,230,198,211,168, 12, 50, 16,  6,103,
+ 99,208,187,196,128,131,205,154,  9, 82, 33,116,141,101, 41, 84, 50,  4, 33,184,106,225,221,213, 51, 49,148, 13,201, 37,186,160,
+212, 58, 48,251,133, 94, 60, 93,141, 20, 81,106,141,168, 70, 98, 41,204,193,161,105, 97,187,  9,204,185, 33,197, 80,196,217,101,
+220,104,154, 94,106, 54,208, 11, 21,167, 91, 74,205,  8,149,105, 82,124,203,208,119, 76,173, 24,132,203,123,212, 45,200, 46,162,
+203, 96,102,189,206,104,149, 81, 43,116, 35,227,176, 78, 22, 23, 97,174, 21,162,167,223, 40,164, 66,245, 66,107,158,224, 26,190,
+247, 56,113,116,209,127, 38,132, 54,183, 10, 87, 68,149,226, 28, 49,126,118,227,247,164,186, 62,160, 28, 42,254,255, 23,184,243,
+159,250,241,223, 87,202, 90, 75, 51,162,156,107,196,240, 15,191,136,124,114,214,191, 12, 19,138, 49,  1,130, 19,170,154,129, 47,
+ 87,172, 53,177, 88,229,181,212, 72,110,142,208, 22,242,236, 81,173,168, 84,194, 24,200,115, 37,248,134,171,129,197,  5,182, 99,
+ 79, 21, 71,157, 26,241,204, 26, 21,  4, 79, 22,143, 78, 51,190, 55,205,106,157, 14,120,109,168, 90,112, 83, 28,204,211,145, 41,
+218,218,219,119, 61,233,242, 21, 38,132,224,176,194,187,174,166, 54, 93,123,228,118, 62,138,117,143, 81,243,141, 27,246,  1, 47,
+ 17,239, 42,207,191,245, 23,252,217,181,240,100,178,157, 96,176, 24,188,129,106, 20,131,169, 84,219, 97,171,151, 31,252, 53,103,
+ 48,  3,195,193, 54,235,151,250,178, 66,230, 86,133,233, 10,157, 11, 86, 12,  4,111,137, 92, 93,145,172,184, 70,203,150,127,192,
+ 85,180,  9,162, 66, 11,246,247, 87, 53, 41, 72, 21,104,174,128, 90,216, 33,231,178,  6,255,108,154,160,  6,180, 39,116,206,120,
+196, 89,137,226, 44,184, 81, 50,234, 28,185, 25,112, 65,196, 81,114, 93,131, 68,138,111, 74, 77,128, 20,186, 16,209,182,226,118,
+189,197,248,144, 72,104, 98,  1, 41,103,225, 31, 20, 92,172,248, 92,105,173, 33,205,252,206,205,182,238, 40,149,203,251, 15,248,
+213,221,134, 71,143,190,207,163,247,159, 90,190,176, 42,103, 87,103,252,252,207,125,129,247,223,251, 62,143, 62,122,198, 40, 27,
+180, 21, 51,214,105,195, 17,249,202,151,222,225,234,254, 22, 84,216,124,249, 43,180,  6,115,158,200, 83,194,187,142,221,110,224,
+241,147,143,120,250,244,104,191,155, 50,211,133,145, 70, 64,235, 66,174, 51, 57,103, 28,214, 71,173,181,218,120,191,156,232,117,
+228,250,250,142,126,247,128,216, 15,204,121,207,237,221, 11,230,156,137,181,145,171,141, 25,251,184,193,139,103,232,133, 41, 85,
+ 52,216,103,  1,233,232, 46, 29,113,138,180,226,240, 49,174,174,110,143,143,141,211,146,137,161,240,245,191,252, 11,190,246,181,
+223,160,239,187, 31,251,  7,237,253,247, 62,228,131, 15,222,231,181, 87, 95, 99,220,237,192,111,120,254,228,  9, 76, 13, 87, 34,
+199,219,103, 60,122,247,125,148, 70,231, 34,117,105,236, 79, 51, 23,187, 45,173, 66,109,141,128, 48, 79, 11,183,113,143, 70, 79,
+175,158,227,146,168, 90, 44, 83, 82,170,125,246,188,141,209,238,158,126,200,253,205,  6, 36,147,102,197,249,158,243,179,158,253,
+211,175,179, 13,143,136,  2,199,121,203,102, 19, 56,203, 21,164,242,202,189,133,233,  4,110,138, 52, 10,210,121, 72,194,243,103,
+ 71,182,247,207,216,141,133,235,239, 63,101, 28, 58,100,211,115,188, 25,169,229,110,229, 27, 84, 66,223,225,218, 14, 23,193,185,
+128, 23, 27,239,226,149,229,232,121,116,179,227,195,147,242,243,159,219,210,220,200,243,169, 17,155,178,204,153, 37, 79,  8, 16,
+199,136,184, 64,154, 22,212, 11,145,113, 85, 16, 87,130, 15,136,239,169, 49,147,107, 33,132, 72,169,101,109,190, 52, 66,236, 57,
+ 59,123,192,249,189,123, 12,227, 21,183,251, 39,196,222, 70,225, 81,140,222,168,181,146,138, 93,150,251,104,125,106,245, 35,219,
+225, 62,187,173,160,203,145,219,101,166,247,208,123, 79,  6, 74, 13,148,188,144,106, 70, 51, 28, 14,123,238, 93,245,252,220, 23,
+239, 49,207,129,103,199, 35,125,180,149, 95,142,133,187,155,  3, 47,174,175,137,126,195,235,175,188,202,177, 36,124,107,  4,215,
+ 16,169,104,139,180,156,240,126,196,  7,103,149,169,147,162, 20,124, 52,208,120, 71, 67,179,163,  9,196,173,208,138, 61, 54,212,
+ 37,106, 81,166, 90,169,109, 54, 36,167, 64,214,134,182, 96,235,188, 65,200,115,  3,215, 35, 52,234,172,196, 65,200, 65,112, 11,
+  4,239,169,197, 19, 26,168,203, 68,215,152, 22, 37,236, 26, 44, 24,209,207, 53,134,190,103,113,133, 82, 33, 23,103,176,159,206,
+130,198, 13, 65,157,237, 69, 99,117, 36, 31,232,166,133,218,108, 53,210,162, 82,151,140,248, 64,206,153,236,133,141, 88, 11, 72,
+125, 79,109,235,247,175,243, 63, 51, 88,229,135, 14, 94,160,164, 98,185, 35, 32,126,134, 47,106, 49,118, 23, 77,173,170,247,233,
+139,132,252, 45, 63,231,186,254, 56,124,106,167,254,233,  3,119, 86, 88,166, 76,107,109,117,130,132, 31,170,186,125, 22, 64,218,
+ 92,204, 43,226, 29, 28, 74,101, 74, 74,144, 30, 55, 77,164,166, 36, 45,160,153,128,195,157,  2,141,  9,215,195,161, 58, 92,217,
+224,234, 45,161, 68, 90,107, 56, 58,246, 37,227,202,137, 74,163, 46,142, 48, 20,160, 67,150,194, 84, 11, 74,228,164, 19,174,101,
+ 70,191,  5,215,113,200,119, 22,104, 45, 11,210,237, 24,171,240,139, 95,220,242, 43,255,243,127,203,247,159, 94, 17,112,206,226,
+248,230,248,179, 95,200,108,227,110, 39, 43,216,197,131,120,143,150,182,150,  6,  5,239,149,252,226, 49,127,241,194,210,165,118,
+248, 11, 72,  4,193,210,211,110, 69,155, 54, 16, 53,196,107,105, 86,163,241, 56,123,193,171, 17,200,218,122,137, 48, 81,131, 29,
+ 82, 34,193,144,161,235,225,167, 78, 86, 73, 12,159, 48,174,113, 66,112,172, 85, 44,108,  7, 36,142, 32, 74,198,254, 61, 20, 19,
+ 97,212,102,216, 82, 93,245,173,130, 82, 74, 35, 68,161, 38,163,141,137,183,159, 79,158, 51,206, 59,130,218,184,  8,111,136, 91,
+ 39,142,214, 26,222, 91,127,190, 85,243,123,215,100,146, 25, 21, 65, 20,124,177,169,133,250, 96,105,222, 48,224, 37, 67, 51, 39,
+188, 23,104,209, 94,157,218, 48,152, 14,142,230,132,208, 18, 97,136,188,253,165,183,216,237,206,169, 53,115, 56, 45,156,157, 95,
+210,143,145,135,175,220,231,163,143,111,208, 82,233,134,184,122,163, 43,125,216,224, 98,100, 78, 86,193, 25, 70, 83, 93,246,253,
+ 14,189,104, 72,242, 60,127,254,156,187,187, 19, 14,165,204, 51,205,121,178, 59,130, 55, 52,173,106,229,101, 35,194,225,112, 93,
+ 88,237,123,133, 89,149, 23,143, 31, 49,205, 47, 24,135,183,184,216, 92,114,113,246,144,219,219,103,244,206, 48,164,115,177,  3,
+101,217, 31,121,243,245,175,130,  6, 90,154, 41, 65,104, 45, 32,203,108,122, 95, 23,168, 75,165,219,120, 42,106,142,240,224,241,
+ 10,143,191,255, 33,255,230,223,253, 91,254,249,127,243,223,209,  5, 79,252,212,232,239,250,249, 53,127,240,  7,191,199,233,238,
+150,235,  6,178,143, 76,169,241,246,195,192,197, 89, 79,107,149, 37, 87,254,245,255,241, 59, 72, 28,105, 34, 44,  9,134, 93,207,
+ 63,249,173,175,240,127,253,135,111,241,244,238, 22, 51, 86, 11,105,177, 26,166, 15,144,150,180, 34,132, 65, 42,104, 23,  9, 94,
+120,184,187, 36, 68,199,205, 71,239, 18, 58,225,112,154,121,253,231,190, 68, 44, 79, 56,119,223,100,120, 53,177,191,117, 12,187,
+ 91, 54, 99,166,157, 58, 62,122,218,113,151,  3, 23,103, 71,182, 15, 28,233,197,108, 19, 37,231,120,126,211,120,248,246,142,116,
+216, 35, 45, 65,236, 56,220,118,224, 50,190, 87, 52, 85,154, 44,116,125,135,122, 65,  7, 65,178,210,150, 68,206, 71,188,122,158,
+ 94, 15, 60,158,206,232,251,142,155,219, 59,196, 39,202,162,168, 43,102, 64,212, 12, 78,232,194, 64,236, 70,235,237, 47,  9, 25,
+ 35,173, 57, 68, 76,119,107,169,183,142,150,109, 28, 26,215, 44, 71,109,141,205,112,193,120,190,227,193,229, 61,230, 35, 76,185,
+225,155,173,128,232,  4,124, 32,169,221,144,  5,199,210, 26,125, 23, 25,119,247,233,134, 30,209, 76,201,137, 60, 85,234,208,177,
+144,232, 53,178, 52, 37, 85,135,150,142,170,153,172,149, 39, 79, 15, 44,105,207,151,223,124,157, 23,127,249,140,143,158,156, 24,
+ 98,228,233,205, 19,110,158,223,225,154,145,229, 92,239, 56, 59,123, 96,181, 75, 38,240, 13, 41,222, 12,138,100,150,230,200,197,
+225,135,128, 43,  5, 85,143,108,140,194, 85, 74,181,239, 29, 21,234,146,104, 40, 41, 20,180,244,116, 77, 13,104,163, 30,151, 43,
+211, 18, 80, 89, 24, 46, 34,170,137, 84, 10,204, 21,113, 29,213,121, 92, 81,164, 21,170, 20,186,230,241, 14, 78, 53,177,137, 30,
+178,183,106, 97, 62,225,182,129,124,108,116, 97, 68, 27,196,224, 40,157,173, 11,187, 97, 64, 93, 37,157,236, 21, 47,234,140, 59,
+191,233, 33, 10, 12, 30, 21, 79, 89,167,135,226, 35,199, 19,196,170,196,141,241,197,131,119,168,203, 54, 80,246,202,184, 27,127,
+ 50,148,229, 83,  7, 96, 94, 15,186,254,101, 71,125,125,149,134,245, 16, 45, 73, 73,203,178,230,171, 62, 91,233, 74, 45,109,101,
+111, 56,179,168,253,  4,248,139,251,145, 31,251,191,101,223,142,109,101,168, 24, 63,  4, 17,124, 63,124, 42,112,103, 23,149,237,
+167,113,178,107,134,224,211,193, 59,247, 83, 38,  5,211, 60,211,218, 66,195,227, 87,  7,130,235,149,124, 91, 80, 58, 58, 47,100,
+ 61, 34, 62,160, 93, 79, 57, 28,105,197, 83, 66, 15, 67,164, 78,141,230,103,124, 56,163,164, 66,235,102, 98,128,232, 27,126,240,
+236,143,130,204, 71,  2,231,200,118,135,182, 35, 29, 14,189,244,212, 69,113,243, 76, 44,166,218, 29,  7,129,141,178,193,241,213,
+215,183,124, 65,206, 89,206, 49,162, 92, 67,241, 47,  3, 96,120,178,227, 19,222,187,119,110,149,184,120,154,232, 15,232, 57,  5,
+130,120,226, 90, 13,123,249,101,216,164,125,178,143,111,168,225,103,197,222,248,205, 53, 11, 70,172,157,115, 47, 74,171,197,110,
+130,171,222,213, 85, 71,109,198,141, 86,209, 53,125,105,123,138,182, 34, 85, 95, 86,219,156, 98,176, 14, 21,219, 49, 97, 47,246,
+134, 35,169, 65, 32, 80, 49,248,189, 84,208, 70,117, 54,150, 67,188,133,201,104,148, 82, 77, 60, 34,107, 23,163,218,175, 71,173,
+ 10,222, 83,197, 33,162,248,232,  9, 56,114,158, 41,217,211,247, 27, 74, 49, 45,107,213,134,167,208, 36, 80,115, 69, 54, 17,130,
+179,169, 68,  3,159, 87, 37,173, 20,124, 11, 20,177, 47, 17,141,118, 33,104,174, 64, 21,131,245,  7, 97, 94, 50,170,194,195,123,
+247,136,131,167, 84, 49,226, 83,106,156,157, 95,240,234,195, 11, 30, 63,189, 37, 47, 70,246,138, 93,224,236,226,156, 32, 80,106,
+163, 73, 99, 33,211,240, 48,191,236,114, 86, 62,122,250, 17,143,159,191,160,243,  1,156,193,115,178, 90,231,190, 54,161,185,117,
+114,211,148,110,231,173, 81,224,172, 25, 17,170,224, 78, 19,154, 10, 79, 63,252, 14,199,124, 66,157,195,227,145, 40, 12,177,163,
+ 15, 27,206,118,247, 56,138,112,182,219,177,159, 38,134,176,163, 54, 33,170, 50, 79, 71,235, 27,123,147,205,120,223,184,221, 79,
+148,234,232,123, 33,137,227,120,218,243, 71,255,207,127,228,155,223,248, 14,247, 46, 47,120,112,239,146, 47,189,243,121, 88, 22,
+126,239,223,255, 33,239, 63,126,204,188, 63,112, 58, 77,196,205,134,219,155, 59,254,223,161,241,171, 95,126,157, 40, 66,109,202,
+120, 54, 82,179, 99,105,133, 24,160,204,153, 15,223, 59, 49,149, 25,175,  6,199,120,137,167,240, 78, 89, 84,215,254,181,224,130,
+ 17,178, 28,142, 94, 60,103,151,247, 72,251,138,187,223, 56,223, 69,222,184, 55,240,149, 47,110,233,239,254, 35, 26, 23, 14, 93,
+ 79,139, 39,134,169, 80,138, 33, 64, 47,174, 64, 36, 89,130, 41,247,168,159, 16,215,113,183, 20,138,115,124,238,141,135,148,235,
+ 15,233, 66, 79,115,158, 90, 19, 93, 95, 56,165, 72,208, 72,136,141,148, 19, 54,106, 50,175,114, 62, 57,110,246,142,167,215, 29,
+251,101, 96,244,202,112, 21,160,235, 56, 30,102,156, 47,180,230, 41,115, 66,124, 71,236, 61, 33,122,243,219,171,176, 28,246,220,
+ 29,239,184,188,188,180,133, 87,174,228,102, 47,205,214, 15,164,154,104,106,248,206, 86,149,243,243, 43,118,155, 11,198,205, 25,
+ 47,158,191, 71, 43, 11,169, 26, 24, 67,168,120,107,151,161,186,126,198,125,160, 31,175,  8,113,196,187, 74,107, 25,145,104,137,
+241,140,237,225,163,163,250, 68,178, 14,  4, 75, 58,226,125,227, 23,127,225,115,164, 60,243,231,255,249,187,148,165,242,252,197,
+ 19,158,127,124,141, 11,194,102, 24,113,193, 32, 27, 79, 30,189,135,255,252,192,118, 59, 90,218,183, 58, 36, 42,174, 23,131, 74,
+105, 71, 80,  8, 90, 89,180, 18, 11,244,  1,102,239,  9,126, 67, 45, 39,234,105,213,175,138,  9,125,134, 80, 41, 85,112,100, 74,
+ 22,212,213,117, 28, 15,237,164,230,147,112, 29,161, 11,204, 62, 19,154,224,155,218, 84,175,223, 80, 45, 73,134,111,149, 84, 71,
+144,108, 50,169,214,163,139, 97,176,203,148,169,222, 49,248,145,214, 42, 50, 40, 77, 19,109, 47,248,234,169, 99, 69,  6,135,207,
+133, 69,103, 34, 91, 91, 48,204, 11,226, 60,101,191, 16,  8,184,161,225,134,141, 77, 55, 91, 35,231,198, 38,142,102, 27, 44,208,
+253,132, 49,185,251,145,157,114,248, 17,142,155,251,212,143, 51,112,147, 77,  6,148, 90,161,113,142, 23,  0,  0, 32,  0, 73, 68,
+ 65, 84,165, 15,145, 69,127,112,  0, 46,216,134,232,103,141,206, 45,185, 82,138, 77,119,253, 63, 96,  2,224,126, 28,237, 77,219,
+ 58,101,244,156,125,202, 84, 23,249,225,154,157,124,234, 66,243,147,254,153, 63,122,168, 79,192,225, 52,211,202, 68,201,153, 30,
+ 72, 90, 44,204, 24,132,150, 23,188,  4, 66,232,  8,203,196, 41, 47, 52,141,148, 58,209, 82, 35, 72, 97, 16,225,168,133,224,102,
+ 52, 24,143,164, 86, 91, 69,248,147,152,183,161,  8, 69,178,181, 73, 74,162, 15,158,244, 60,209,188,208, 74, 37,186,158, 83, 77,
+116, 94, 24,171, 35,151, 68,191, 25,  1, 79,106, 16, 60,158,230, 44, 92,224, 94, 26,115,212,217, 72,219, 16, 13,171,200, 69,215,
+145,181,141,171, 85,130,237,157,155,237,216,197,123, 11,190,181,213,  8,227,141, 72,231,197, 58,133,205,173,213, 47, 49,212,107,
+203,213,168, 72, 47,251,144,162,120,  9,182, 71,199, 17, 58,135, 40,148, 98,123,115, 39,209,122,181,171,130,209,254, 53,214,215,
+108,222, 38, 10,157,  4,170, 87, 74,179,241,187,119,166, 46, 44,206,172, 85,110,221, 79,138,179,215,246, 74, 93, 52,176,136, 96,
+248,197, 82,215,202,213,218,159,198,234,106,150,210, 95,236, 38, 31, 87,173,234,186,178,168,190,224, 75,195,181,128, 43, 54,157,
+104,  8, 46, 91,213,199,135,206, 94,193,226,104, 20,230,214, 80,173,132,106,247, 27,234, 58,133,112,142, 42, 21, 71,135, 68,197,
+103,187,116,100, 53,253,161, 58, 75,113,123, 31,248,202,151,222,225,254,195,  3,185, 38,134,113,100,211,111,233,198, 14,209, 66,
+ 43, 17,223,155,186,146,220,  8,206, 28,218, 55,251,107,110,175,111,108, 76, 39,142,136,167,170,251,132,205,223,124,163,101,251,
+253, 84, 17,188,115,212,154,152, 21, 54, 97,160,245,149, 83,153,184,188,119,159,216,117,228,230,168,243, 76,106,153, 99,157,201,
+165, 66, 61,113,188,121,142,139,157,  9, 71, 92, 37,173,230,168,165, 40,172,181, 67,  4, 74,104,248,248, 50, 51,224,200,115,195,
+105,166,133, 98, 59,112,247,148,180,191,227,253, 15,222,229,207,254,226, 79, 41, 83,102, 90, 18,203,124,203, 60,207, 44,173,176,
+153, 50, 85, 23, 62,248,254, 51,126,233, 11, 15,108,100,223, 10, 55,199, 59,186, 56,178, 25,  7,230,211, 66,163, 50,205, 51, 85,
+215,117,144, 49, 73,  8,162,108,134,158,227,105,162,105, 37, 52,112,179,210, 44,198,192,229,131, 75, 62,247,160, 35,184,202, 69,
+ 55,240,133, 87,110,120,235,171,255, 24,233,133,229,100,149,147, 33, 85,102,231,168,190,209,242, 57,170,202,217,246,136,182, 64,
+229,138,114, 56,208, 82,133, 51,199,147, 23, 11, 23,151, 27,  6, 89, 56,201,  1,221,192, 48,128, 31,  6, 90, 43,148, 59, 51,133,
+157, 52, 48,212, 74,217,207, 76, 75,230, 46,119,188,127, 29,153,231,158,180,114, 21, 36,118, 92,157,141,212,234,185, 93, 14, 36,
+ 38,242,  2,121, 57, 89,109, 47,120, 11,123,182, 96, 59, 56,204,212, 54,197,158,126, 99,175,152,224, 26, 45,118,116, 98,198, 66,
+117,  2,146, 41, 73, 56, 27,122,222,122,237,138,139,139,115,190,245, 87,123,136, 66,155, 11,115, 58,225,102, 24, 55, 29, 62, 10,
+117,113,136,143,244,103, 15,136,103, 59, 68, 11,129,  5,231, 60,115,134,166,214, 88,169,185,225, 90, 50,233,156, 64, 37,115, 74,
+ 51,175, 92,116,252,247,255,236,171,124,253,111,222,227,247,255,240,175,185,119,241, 42, 95,124,243,117,182,177,231,241,243, 23,
+ 28,150, 76, 23,157,141,214,181,241,228,241, 99,222,249,252,231,112, 46, 16,157, 18,139,210, 34,150, 18,198,170,105,181,  6,134,
+  2,205, 43,139,102,243,171, 91,210, 21,137, 74,213, 68,206, 38, 98,129,198, 82,214,183,154, 24,246,147,222, 19, 22,161,229, 74,
+127, 30, 12,126, 19,  5,169, 66, 91, 38,180, 10,221,184, 33,100,161, 48, 35, 18,232,253, 64,106,230, 63,112,209,163, 29,232,146,
+ 16, 55, 34, 90,112, 29,104, 84,220,177,162, 62, 50, 77,149,209,117,200,232, 80,153,209, 56, 26,217,178, 22, 90, 72, 44, 71,203,
+ 18,117,113, 93, 81,141,158,221, 38, 48, 55,101,174,137,179, 94, 16,177,138,177, 52, 79,232, 59,198,177,251, 59, 31,136,159, 62,
+192, 62,141,171,233,214,106,121,106,213, 30,105, 94,217, 14,225, 39,190,144,255, 94, 33, 57, 32,167, 68,211,102,174,144,207, 48,
+ 85, 95,212, 86,177, 65,148,248,119, 64,196,254,232, 95, 13, 63,102, 77,192,143,132,235, 20,152,115,162,104,165, 86, 97, 86,168,
+222,218, 21,210,132,156, 10,245, 48, 81,181,209,141,231, 84, 89, 80,122,144, 70,190, 62, 18,206,  3,231,117, 67, 77, 66,199,  9,
+ 63, 56,138,139,212,101, 97,246,208,230,163, 57,217,135, 13,131, 42,167, 85,169,155,197, 19,171,163,185,140,107,194, 38,108,168,
+117,134,147,226, 98, 88, 45,147,149,114, 82, 66,117, 47,181,169,206,196,239,106,175,113, 93, 83,143, 77, 60,226,204,181,110,190,
+150,182,  6,119,214, 78,183, 83,112,230, 18,246, 56,147,148,180,  8, 78,136,174, 25, 32, 64, 27, 62,172,149,154,214,112,226, 41,
+174,174, 92,121, 91,158,139,179,157,116,109, 25, 39,150,202, 38,216, 24,221,240,178,182,131,111, 52,210,122,208,135,  0,117,174,
+ 16, 28, 21, 71,171,206,190,152,  0,180,179,221,187, 54,242,210,108,117,192,203, 73, 67, 67, 34, 68,132,172,150, 90,237,229,255,
+ 99,237,205, 98, 45, 75,207,243,188,231,251,135,181,214,222,251, 12, 53,116,245, 88, 61,112, 38, 37, 82,180, 76, 39, 82, 36, 74,
+148, 37, 37, 78,100,  9,  9, 32, 88,113,128,  0,214, 69, 46, 18, 32,  1,  2,  4,200,101,224,171, 92,229, 34, 64,  6,192,129, 51,
+  8,200,128,  0, 70,224, 68,177, 69, 71,130, 16,197,178, 72, 81,164, 56, 72, 34,155,108,246, 60,213,112,170,206,180,247, 94,107,
+253,211,151,139,111, 85,117,177,173,144,138, 36, 52, 26,232,234, 83, 56,117,206,169,115,246,250,255,239,123,223,231, 89, 72, 65,
+226,112, 62,216, 78, 28, 65,107,125,168, 28, 52,135, 58, 86,161,107, 74,166, 17,156,167,149,138, 58,207,220, 20, 47, 74, 23, 61,
+174, 21, 27, 51,247,  1, 39, 17,231, 27,162,133,154, 29, 77, 10,195,202, 96, 38, 62, 58,124, 22,170, 52, 83,108, 46,240, 28,169,
+ 66, 63, 68,114,105,184,218,232,125, 68,139,146, 92, 65, 85,136,253,138, 39, 14,  6, 99, 59,135, 30,105, 86,211,171, 56, 99, 18,
+103, 59, 84,120,239,105, 90,112,222,190,118,226,252, 67,169, 67,140,129, 32,222, 38, 35,170,212, 44,  4,255,128,  9,174,248,  4,
+ 29, 22,232,201, 57,211,230,142, 91,119,239, 50,158,126,155,126,216,224, 99, 79, 23, 61,113,221,227,187, 53,155,213, 26, 65,  8,
+171,  3,182,121,203,249,253, 83,130,157,147, 40,121,182,190,123,244,  6,204,168,149,185,244,232, 62, 49,132,158, 81, 38,138,  8,
+190,236,205,  1,150, 12,120,225,189,195, 79,149, 41,237,184,156,246,108,199, 75,171, 29,145,201,187,204, 60,120,138, 54,238,140,
+ 39,188,242,246, 93,226,106, 69, 20,225,236,100,203,209,113,224,217,231,143, 77,147,153,205, 56,232,101, 32,185,  9,143, 18, 37,
+128, 15,104, 17,230,212,208,162, 38,210, 64, 81,129,227,131, 21, 63,249, 67, 55,184,249,116,230,221, 83,143,115, 23, 28, 29, 94,
+ 67, 14,110,146, 79,111,195,240, 12,180, 13,125,184, 96, 85,207,200,229, 10, 78, 58, 58,119,  6,171, 64, 58, 19,104,103, 56,151,
+137,  7,142,253, 88, 56, 61,175,124,252,211, 31,160,230,123,184,150,185,220, 59,134, 85,224, 96,  0, 55,122, 14, 14, 10,111,159,
+ 52, 94,127, 11, 14,214, 14,207, 33,231, 23,141,153,158,222,  5,170,239, 24,  6,171,202,141,185, 33,108,  8,226,152,234, 72,158,
+ 26,243, 52, 51,151, 76, 83,165,186, 74, 77, 25, 41, 91, 27,147,171, 16, 92,100, 26,119,224,  3, 33,246,139, 41, 14,112,129,206,
+175,200,204,164, 42, 92,185,118, 68,119,180,230,240,224,152,182,155, 24,167,  4,189,  1, 72,214, 18,153,200, 86, 67, 69,232,186,
+136,116, 43, 54,171, 35,250,224,112, 37, 49,207, 51,161, 63, 36,198, 64,214,104,135, 81,141,104,112,208,132,150, 39,198,201, 84,
+176,247, 46, 43,191,247,251, 47, 45,246, 43,229,206,221,119, 88,175, 27, 63,242,169, 23,248, 81,255, 33,190,250,226, 43,188,254,
+218, 29,214,174, 67,112, 76,211,196, 91,183,111,243,228,147, 79,179, 90, 69,147,174,204,149,232,134,197, 50,231, 81,241,132,230,
+217,107,182,126,187, 52, 90,171,172, 36,146,138,  9,167,106, 49,228,245, 28, 20, 47, 29,201, 57,186,117, 52, 10,228,174,208,  2,
+104, 31,105, 41,131, 58, 84, 61, 45, 55,188,174,104, 94, 73,173,146,107,194, 43,132,190,225, 58, 33, 54,135, 52,227,170, 51,103,
+162,219,224, 37,216, 42,174,122,116,191, 99,213,  7,116, 63, 83,116,192, 31,116,120,167,132,186, 34, 77,129, 18, 27, 97,180,117,
+ 95,136,221, 18,234, 83, 84, 26,109,182, 70,207, 16, 21, 23,173, 77,180,118,246, 90, 72, 16,196,117,198, 25,249, 75,224,167, 79,
+185, 34,205,  2,211,113,245,189,187,239,240, 23,124,168,151,130,  1,187, 98, 48, 27,202, 35,123,252,248,200, 99, 62, 63,178, 14,
+120, 48, 50,119,239, 67,194,126,207,175,139,210, 82,165,101,197,245,242,151,170,138,125,240,177,207,243,204,202, 41,179,135, 57,
+229, 69,128,212,200,187, 61,110,125, 72,214,153,189, 38,162, 40,171,174,177,203, 30,241, 14,167,197,166,122,251,153, 77,131, 34,
+144,106,135,248, 25, 95, 42,190, 53,166,150,141,219,226, 87, 20, 26,110,170,148,150, 12,173, 78,193,201, 64,107,  3,165,237,209,
+222, 83,242,  4, 73, 56,  8, 27,222, 26,143, 72, 56, 78, 78, 19, 65,181,162,213, 88,233,178, 40, 82,131, 55,219, 79, 83,227,157,
+179,116,199,213, 89, 74, 94,104,  6,154,193,129,154,177, 72,197, 82,216,136,221, 14, 16, 35,190,217, 62,253,193, 72,183,154,175,
+ 61, 40,190, 51,212,163,170, 25,201,106, 43,118,243,118,106, 58,206,102,112, 26, 84, 17,241,152,243,209,118,174, 56,115,142,183,
+172,104,176, 74,150,119,129, 89,  0,191,140, 80,155, 82,117,217,141, 54,197,105,163,169,144,106, 65,125,176,240,202,226,127,175,
+213,222,246,224, 59,168,180, 68, 88,184,242, 78,192,171,128,135, 92, 45,103, 64,107,232,242,173, 93,213, 92,238, 33,120,114, 85,
+171,130, 84, 51,187,249, 46, 16,154,162,146,104,193, 81,212, 66, 78,222, 89, 69,174,137, 16,177, 48,159, 56,232,250,222,130, 74,
+197,166, 25, 53,171,213,118,186, 64,244,158, 52, 11,173, 89, 95, 89,105, 72,232,160, 22,242, 52, 17,189,195,135,193, 32, 47,117,
+ 54,199, 47,198,218, 23,129,177, 38,198,113, 52,155,174,135,224, 59,186, 85, 79,223,247,236,118, 23,160, 22,242,168, 77,208,180,
+180,  2,156, 82,163,195,137,125, 60, 87,142,215,124,250,211,255, 18,183,222,126,147,251,103,119,153,247,151,220,191,191,131, 19,
+197,199, 64, 23, 34, 18, 35,173, 42, 87,175, 29, 83,212, 66, 65, 38,118,240,120,  9, 84,167, 84,201,212,148,153, 46, 42,171,227,
+  3, 90,107,204, 83,193,119,150,234,236, 66,199,156, 19,167, 23, 23,236,199, 29, 36,165, 57, 33,239, 51,117, 46,156,207,149, 86,
+ 44, 85,156,198, 29,  5,165,150,204,119, 94,123,139,171,199, 27, 91, 39,133,  1,109,141,219, 39, 91,214, 49,154,194, 54, 55,156,
+ 15,  4,231,  8, 78,112, 62,224, 67,199, 88, 10,213, 43,145,  1, 93,110,172,162,153, 15,127,240,113, 62,248,194,134,213,234,194,
+210,211, 99, 38, 94,185, 74,222,159,161,231,223,180,131,111,  4,164, 35, 72,135,211, 45,184, 66, 43,160, 91, 65,231,  5,164,189,
+169,172,250,129,123,167,137,110,117,200, 83, 55,174,112,255,245, 55,160,121,166,226,232,178,103,188, 63, 50,109, 29,219, 82, 57,
+ 25,  3, 28, 30,113, 55, 23, 86,178, 38, 15,153,142, 72,240,176, 58, 94, 17,179,  9, 63,242,246,140, 57, 43,251,113,103,233,125,
+169, 20, 77, 76,105,102,183, 61,163,180, 66, 23, 15, 24, 86, 43, 66,173, 52, 49, 42,218, 56,111, 81, 46,216, 28, 30,219,172, 78,
+196,128, 23,106,135, 57, 39,194,213,227,199, 76,179, 59,108,248,218,119,190, 78, 89,146,248,234,150,201,139,115, 86,141,171,142,
+ 33,172, 88, 29, 95, 33, 68,197,101,155,132, 84, 13,203, 65,122, 34,202,154, 68, 99,154,103, 36,  5,196,121, 82, 77,164,150, 64,
+  6,246,251, 11,190,252,245, 87,249,220,191,240, 49,254,173,191,245, 89,100, 74,124,249,235, 47,243, 71, 47,191,194,175,252,194,
+207,240,153,191,242, 97,254,201,111,253,  1, 95,250,195, 23, 81,241,196,174,113,121,113,206,181,195,107,180,254,128,230,109,125,
+225,164, 18,100, 77,118,150,187,217,251,134,120,193, 39, 15, 99,164,180,137,209, 55,251, 30,244,118,104,  5,  3,  3,229, 92,112,
+ 77,201,201,234,132,171,161,177, 45, 21,167,  6,175,170,185,209,165,137, 62,116,184, 67, 71,155, 43, 45, 87,112,198,233, 80,  7,
+105,106,248,104, 89,158,170,208, 73,160,133,108,108,125,215, 51,172,  6,114,139,168, 40,185,121, 84,  2,181, 37, 92, 22,130,239,
+ 17, 55,209, 38,197,187, 21,117,127,137,187, 22,108, 66, 55, 69, 66, 31,113,185,114,162, 35,171,216,115,221,119, 56,113,228, 86,
+172, 62,217, 34, 78,160, 45,225,176,253, 34,171, 92,201,123, 33,178,184,148,156, 30, 70,143,220,123, 15,197,162, 60,180, 56, 42,
+182,174,170,181, 46,176,174,225, 61, 57,203, 95,180,113,214, 32,213,130,115,142, 33,122,250, 71,198,239,241,125,247,118,247,255,
+ 49, 14,127,240, 64,159,129, 71, 19,  4,151,115, 33,231,100, 23, 59, 85,106, 93, 90, 30,203,  3,249, 81,174, 93,251,115,132,230,
+170, 66,200,153,210,178,101, 58,138,253, 63, 31, 42, 26,131, 53, 46, 66,166, 59, 56, 34,236,246,236, 79, 71, 88, 71, 58,157,153,
+ 71,135,244, 27, 66, 41, 76, 98, 95, 91, 57,190, 66,190,156, 81, 77,104,173,116, 94, 41,128,234, 37,101, 87,105,186, 38,116, 17,
+205,179,181,173,116,162, 85, 79,141,142,218, 28,226,122,138,143, 28, 68,229, 67,207, 60,206, 53,132,119,143, 58,130,151, 96, 72,
+ 62, 47,184,186, 48,132,213,152,201, 78,108,247,104, 15,251,102,227,119, 22, 45, 33,203, 45,125,233,181,138, 55,186,156, 87,191,
+ 16,233,140,132,230, 88,202,253,165, 17,188, 35, 99, 34,230,  7, 70, 31, 53, 74,235,242,103,250, 69, 82,176,140,216,155,129, 54,
+170,100, 43,245, 56,111, 52,160, 86,105, 73,136,222, 89,226,212, 91,248,172,168, 18,213,170,107,234, 50,218, 28,117,193,181,214,
+ 38, 86, 51,241,206,254, 50,139,221,254,171, 46,182, 57, 97,209,214, 45, 93, 93, 53,137, 75,171,182,110,144,210,240, 11,210,182,
+169,141,239,130, 55, 58, 85,197, 94,  8,135,222,240,131,222, 41,196, 64,163,224, 37, 82, 68,145,234,  8,206, 45,  1, 64, 83, 32,
+154,113, 73,232,131, 51,153, 77, 82,188,120,235,136, 59,161, 23,135, 39,146,188,144,165, 34,  1, 66, 54,129,128, 58,240, 73,141,
+ 20, 38,158, 82, 51,171,222,166,  6, 41,101,110,159,220,163,150,202,225,193,192,170, 27, 88,173,  6, 46, 79,183, 76,165,178, 90,
+247,108,142, 14,249,247,255,163,255,152, 31,249,216, 71,120,229,165, 63,230,127,248,239,255, 62, 47,189,252,214, 82,200,180,124,
+ 68, 23, 59,230,125,230, 96, 19, 17,102,238,223,186,205,143,255,216,143,195,167,254, 42,111,191,125,139, 34,153,221,253, 11,238,
+156,223, 35,231,  9, 45, 59,198,221,158,147,211,219, 92, 59,126,154,131,110,205,249,254, 46,113,115,  8,179,249,152,  3,142, 40,
+ 98,221,227, 80,209,224,136, 40, 79, 61,214,179, 27, 39,230, 84, 24,167, 70,196, 49,233,204,165,216, 33, 72,240,104,158, 73, 57,
+ 81,180,208,230,196, 79,253,244, 79, 51,167, 61,191,243,187, 95,164, 11,194,253, 91,247,185,118,116,204,193,202,130, 97,206, 69,
+154,122, 70,169, 72,129,121,202,148,105,182, 16,147,139,  6,161,200, 51,185, 85, 92,  5,233,  2,222,119,136,102,142,250,129,143,
+126,224, 10,235,112, 73,157, 51,199,125,133,110,141, 47, 74,125,231, 11,164,253, 27, 68,  9, 72,215, 83,171,210,202, 12, 93,135,
+107, 74, 25, 21,157,  3,185, 40, 26, 34,235,180,163,249,204,155,119, 70,174, 93, 61,228,229,215, 79,248,206, 87,247,124,240, 89,
+219,244,189,245,182,112, 54,130,205,118,174, 67, 23,241,186,226,106,111,128, 39, 47,206,124,219,186, 65, 90,230, 98, 60,229,234,
+241, 39,184,126,176,230,157, 87, 95,225,114, 30,105, 53, 81,202,204, 52,110, 73,105,100,218, 79, 52,105,172,122,240,190,167, 52,
+171,  9,170,  3,223,121,210, 60,225, 68, 88, 29, 94,181,105, 74, 54, 58, 91,201,149,131,131, 21, 67, 31,249,232,115, 55,105,213,
+113,247,242,130,232, 12, 42,229,197, 49, 12,  3,117, 55, 81, 70,160,107,208,123, 67, 39, 79, 91,146,141,122, 44,145,174,102,  8,
+ 47,  1,250, 18, 40, 58, 51,215, 75,188, 95, 25,179, 98, 33,173,137, 11,156,156,142,124,249, 15, 95,229, 23,127,233,  6,186, 25,
+184,117,235, 62,111,221, 61, 35, 95, 78,252,157,191,253, 11,252,123,255,246,223,228,233,231,174,241,249,207,255, 33,243,156,104,
+210,184,123,239, 45, 14,143,123, 14, 55,199, 76,169, 25,107, 95,  2, 44, 53, 62,149, 70, 88, 13,164, 86,112, 50,131,235,151,202,
+212,142,185, 86,130,115,116,210,168, 52,246,213,122,157,126,223,160, 15, 20, 31,104, 15,  2,106,165, 89, 69,213,  5,171,208,238,
+ 19, 81, 54,164,160,168, 76,148,106, 42,232, 46, 40, 85, 10, 77, 58, 98, 83, 28,129,138, 55,182,  5, 80,245, 18, 45, 66,138,145,
+ 20,132,206,  9,185,100,112,158,148,148,153, 75,  6, 31,145, 78,241,171, 67,163,117,  6,193, 83,145,  4,184, 76,140,160,205,113,
+ 57, 11, 71,  3, 54, 21,164, 67,212, 38, 62,135,171,254,225, 56,253,209, 75,123,147,247, 30,138,  5, 56,  3,186,  5,188, 50, 43,
+104,130,  7, 45,220,185,192,180,159, 13, 54, 86, 22,110,135,218,107, 92, 93, 14, 11,127, 94,124,122,173, 80, 91, 33,171, 61, 15,
+190,223,142,252,251,  5,227,220,251, 30,232, 15,108, 50,181, 54,187,228,  5,111, 83,161,229, 48,176, 93, 66,113, 15,150, 19,151,
+203,127,175, 30,  9,210, 77,239,235,234,151,247, 77, 37,182,251,153, 52,238,105,205,112,228, 33, 40, 33,249,165,181,227,208, 52,
+211, 87,197,213,142,117, 28, 56,201, 23,232,124,128,168,167,  6, 79,139,147,  5,184, 75,143,247,  5, 77,163,173,126,166,153,134,
+ 48,116,157, 93,252,182, 66,136, 61,206, 59,107,  5,177,129, 44, 84,127, 73, 65,232, 52, 34, 53, 51, 28, 15, 92,110,149,213, 58,
+112,116,124,104,159,107, 42,  4,231,108,239,137, 51, 64,190, 87, 80, 28,109,145,188,219, 67,203, 42, 53,110,  9,196, 72,176, 91,
+176,106, 35, 58,219,  7, 91,178, 72, 81,178,185,214, 77,197, 98,123,122,103, 60,243,134,165,232,197, 43, 53, 21,166,106,236, 93,
+ 45, 75,205,205,137, 77,  6,106,163,137,  1,105, 92, 23,177,159, 46,191, 36,214,253,  3, 42,173,253, 62,117, 24,116, 71,161,218,
+ 13,186,170,209,225,252,226,126,215, 86,105,193,225,151,221,162, 85, 30, 26,234,162,173, 30, 36,152, 19,221,186, 58,214,169,110,
+208,154,163,106,197,137, 82,197, 86, 20,210,202,194,195, 95, 48,182, 78,232,157, 29,  2,134,222,132, 26,206,  5,188,132, 37,112,
+213,112, 64,  8,182,255,215,232,104, 30,250, 26,104,174, 48,205,201,126, 48, 99,164, 54, 35,232,105, 21,156,239,204,196,149, 43,
+ 90, 28, 18,237,182, 44,189, 39, 86,131,235, 84,105, 75,197, 67, 16,241,108,239, 95,242,198, 59,111, 51,101,216,239,102, 74, 43,
+220,194,  2,141,171,190,179,131, 86, 16, 74, 42,124,246,167,127,150, 95,250,249,159,  1,224,249,103,159, 65,167, 51,254,147,255,
+244, 63,167,137,163,228,132,243,158,161, 95, 49,244, 29,165, 41, 29, 43, 46, 47, 78,249,167,191,247,121,142, 86, 87,216,237, 51,
+155,163, 35, 98, 92,209,197,192,149, 43, 55, 56, 58,124,158, 90,  2,219,221, 61,124,170, 92,142, 91, 98,183,194,183,128,250, 74,
+196, 49,166,153,139,179, 61, 93,223,113,227,234, 21,180, 58,134, 88,121,242,217,199,120,245,181, 19,238,159,238,137, 27, 97,190,
+ 76,203, 10,167, 35,248,192,225,141, 35,230,221, 22,220, 49,183,111,191, 67,191, 90,243, 55,126,241,167,168, 57,241,165, 47,125,
+157,148,118, 92, 92,156,115,114,118, 65,183,238, 97, 95,233, 87, 29, 62,216, 43, 87,115,118,136,148,192,210,115,134,222,121, 35,
+147, 57, 79,236,141,242,229,213,209,212,243,145,231,158,229,153,117,143,184,145,166,130, 78,153,107, 79,222,160,238, 47,184,127,
+239,109, 84, 59,214,131, 66, 46,104, 18,235, 38,207, 80, 71,129, 62, 24, 98, 55,153,156,200, 69, 97,123,158,216,239,  3,159,252,
+225,199,249,221, 47,191,198, 31,191,217,112,157, 99,238, 58, 78,247, 29,195,224, 24,188,167,118, 61,171, 85,207,122, 29, 57,234,
+110, 48,215, 66,174, 91,188, 22,230,109,129,203,145,183,223,189,195,217,105, 79,236, 10, 46, 40,140, 19,190, 22, 52, 14,148,122,
+ 74,169,214,182,112, 84, 74,205, 76,243, 14, 90,193,187,184, 76,218, 34,195,186,163,212,204,246,244,148, 56,244,212, 58, 83,114,
+161,235,  6,174, 95,187,198,245,171, 87,233, 36,242,165, 63,250,  2, 37, 21,155,176, 45,171,148, 26,133, 48, 68,166, 92, 25,100,
+131,147, 72,246,106, 10,226, 49,225, 86,157,221, 94, 49,204,106,107,133, 73,  4,245,142, 58, 37,114,134,121, 30,145,154,160, 86,
+ 36,  4,214,155, 21,111,223,191,228, 31,126,254, 75,124,238,175,254, 16, 31,255,240,115,156,167,202,187,119, 79,249,  7,255,251,
+239,112,248,183,127,142,127,227, 95,249, 49,242,228,248,252,111,126,145,166,202,184,175,156,220,189,199,102,115, 68,136, 27,124,
+115,204, 50,226,102,123,116, 55,167, 84, 45,100, 87,232,171,105, 74, 75,222, 81,246,  5,149, 14,130,103,146,138,164, 66,140, 17,
+245,166, 61, 46,  8, 37, 79,248,  0, 45, 13,104,180,158, 49, 62,176,175, 74, 84, 79,239, 21, 81,191,188,214,101, 52, 87, 90,244,
+132,208, 19,187, 35,202,254, 30, 37, 58, 52, 89,230, 60,246, 61,154, 38,154,107, 20, 34,157,175,228,233,146,  1,161,117,107,240,
+  9,159, 86,100, 21,106, 13,200,202, 94,223,230, 42, 32,129,190, 21,243, 77,196,200,208, 53,  6, 81,230,108,175,153,  3,138,  4,
+165,123, 36, 24,246,254, 91,232,250,125,187,225,199,220, 35,  1, 48,  1,233,223,219,171,223,119,182,118, 45, 98, 90,106,215,121,
+178, 88,254,253, 92, 33, 52, 56,244,239, 77,  0, 86, 96,129,233, 63,195, 13, 56,101,227, 33,104,109, 22,214,253,203,228,206,212,
+ 70,173,141,185, 54,174,244,  6,252,122,112, 88,120, 63,206,234,240, 79,201, 24,116, 63,192,254,118,154, 48,194, 92,206,214,238,
+138,142,178, 47,184, 36,244,  3,108, 91, 65, 91, 71,109,133,203,208,208,117,132,177,176, 19, 79,105,151,144, 60,121, 46,116, 85,
+ 72, 96,248,226,208, 97,210, 93, 97,218, 89,203,192, 71, 71,101, 79,211, 64,218, 22,188, 43, 20, 85,156, 14,116, 50,209,106,164,
+133, 76,157,  3,174, 12, 28, 13, 74,136,246, 49,142,165, 16, 84,173, 59,142,179,157, 34,222,180,171, 52, 83,178,162,203,206,221,
+ 60,110, 56, 39,104,110, 22,132,211, 66, 22, 19,182, 32,246,123,156,  8,169, 85,156,243, 15,107, 99,176,116, 49,155,249,157, 93,
+179, 91,189,170,208,196,108, 60, 77,176, 10, 25,230, 95,175,205, 35,190,217,255,127,112, 32, 16,165, 52,219,229, 57, 91,205, 89,
+210,173,181,135,249,188,162, 15, 84,136,150,231, 20,245,148,102, 26, 64,117, 14, 39,105,129,227,244,150, 33,104,141, 24, 44, 56,
+102, 41,125, 83, 64,122,156, 17,241,194,210, 31,109, 13, 13, 75, 87,178, 53,162, 11,244,  3,164,182,124,238, 98,234,189,220,160,
+ 67,113,177,218,174,210,155,211, 57, 21,187,105,187,162, 56, 23,169,106, 19,143,  0, 20, 28,154,171,  5,105, 48,189,103,112,142,
+148, 50, 33, 64, 31, 34, 65, 29, 91,153,113,173,210,199, 72,206,106, 66, 27,  5, 25,236,139,241,230,203,239,112,122, 97, 80, 36,
+ 23,  2,146,178,201, 14,106,101, 63, 45,135,156, 16,104,206, 51,166,249,123, 67, 34,118, 93, 51, 44,112,181,144,137,146, 40, 57,
+ 18,194,129,237,118, 58,101,123,153,216,239,118, 36,122,110,157,223, 39,231,145,174, 27, 24,164,227,236,232, 42, 50, 52,250, 32,
+232,152,137,195, 33,161,235,137,177,144,181,144,166,138, 75, 91, 98, 16,142,143, 35,173, 84,106,201,108,174,174, 41,217,113,251,
+222,  5, 23,219,153,176, 19,188, 55,161, 69,  0,234, 60,113,126, 43,209,173, 87, 60,125,253,  6,117,156, 25,250, 21,117,110,172,
+ 98,199, 79,255,245,191,198,111,252,227,223,134, 84,121,245,197,111,115,229,198,117,134,131,171, 28,246,  3,199,107,229,246,217,
+222,118,116,213,214, 36, 94,122, 67,250,122,103, 66,153,106,183, 16, 23,236, 64,243,248,213, 53, 79, 63,182,225,183,191,124,194,
+179, 79, 10,159,252, 96, 37,118, 29,155,199,159,229,252,205,111, 49, 37,197,119,149,145, 30,153,161,151,130,167, 65,243,180,185,
+224, 54, 14, 29, 42,161,  8,190, 43,196,131,192, 75,175, 86,214, 87,174,243,204,135,110,242,220,203, 47, 49, 63, 21,185, 87, 86,
+164,230, 56,244, 29,117,174,180, 94,216,108, 60, 87,175, 92,227, 74, 55, 32, 52, 58,223,225,227, 21,206,238, 93,176, 62, 84,246,
+ 23, 74,167, 27,144,145, 34,224, 91,164,170, 16, 98,228, 50,103,230,125,230,227, 47, 60, 73,113,142,111,126,243, 13, 59,140, 86,
+147, 18,185,165,152,228, 96,201, 19,120, 74, 25,217, 94,236,169, 90,233, 67,224,234,213,167, 56,216, 28,177, 14, 43,190,254,226,
+183,184,115,231, 62, 67, 31,105,  5,106, 47,228,154,161,120, 75,125,235,136, 87, 37,150,140,203, 43,250,225,136, 57, 20, 92, 20,
+116, 46,100, 43,143,224,221, 49,181,206,200, 16,105,211, 37,105,218,226,107,161,180,134, 58,111, 42, 94, 81, 98, 12,188,253,206,
+ 61,190, 32,223,230,115, 63,249, 41, 62,242,241,167,152,247, 91,254,233,239,189,200,127,245,107,191,206,191,243, 43,255, 42, 31,
+120,225,121,158,185,249, 46,111,188,245, 26, 83,206,156,220,187,228,169,107,247,185,241,212, 77,238,238, 38, 88, 68, 30,221,225,
+ 10,191, 47,212,125, 53,239,183,120,170, 90,243,165,198, 64, 20, 79, 47,134,169,213,  6, 83,153,241,157, 16,252,138,170,153, 78,
+149, 16,122, 92,176, 14,121,147, 74, 73,246,240,170, 52, 74, 48,143,131,138,169,166,155, 52, 38,245,116,169,160,220,163, 70,193,
+141, 25, 87, 61, 97,213, 40, 36,156,118,136, 79,168, 20, 92, 30,240, 62, 66,200,148,146,240,170,132,  3, 71,218, 90,235,199,237,
+ 42,174,235, 16, 95, 73,206, 94, 51,215,190, 55,184, 86,117,164, 40,132,104,215,111,239,128,232, 24, 66,247,103,222,153,127,143,
+157,237,253,129, 48,133,154, 27, 46, 89, 95,255, 96,136, 15,147,226,209,238, 50, 15,111,176, 77,190,247, 33,254,253,138,111, 25,
+216, 78,153, 92, 51,226, 48,103,192,131,212,250, 95,176, 71,174,139,114,181, 21,203,113,133, 31,  0,203,113,127,202,175,221,247,
+  9,206, 57, 96, 88, 72,134,169, 86,102,  4,149, 74, 88, 21,202, 56,113,177, 23,138, 87,134,169, 81,210,  5, 71,221, 26,201, 29,
+251, 92,104,117,162, 95, 59,146,  0, 57,146, 99,161,120, 37, 68,165,159, 51,179,  8, 94,170, 65,134,188,199, 13,145,142, 53,187,
+147, 29, 12,246,189, 85,115,130, 57,146, 67,161,181, 29,131, 56,210,229,  4,222,211,133, 21,100,165,172, 32,157,109,241,207, 60,
+245,228,223,109, 11,152, 69,237,217,101,184, 86,100,129,205, 44, 38, 52, 85, 28,134, 76,245,222, 63,  8,184, 91, 21,162,153, 83,
+ 92,155, 73, 86, 92,112,134, 98,173,246, 62,188,247, 38,136,192,161,206,110, 73,226, 29,190,139, 72, 91,174,245, 18, 88,228,163,
+168, 24,114, 85,176,132,185,170, 65,122,155, 46,220, 96, 17,196,217,  3, 81,212,204,113,  2,120, 23,172, 83, 14,102, 42,114, 75,
+239,212,252,127,152,255,197,225,154, 61,156,107,179, 16, 92, 23,172, 10,145,115, 93, 70, 75,246, 80,177, 19,154, 34, 77,141,161,
+237,133,224,237, 22,111,117, 55,232,  6,112,  5, 84,132,150, 27,161,143,116,241, 65,174,160,218,237,218,117,104,106,134,225, 21,
+161,105,165,104,195,  5,197,247, 17, 47,193, 32, 50,226,151, 21,135,209,238, 52, 91,106, 92, 69, 73,217,170,127,165, 66,105, 32,
+ 68, 66,203, 54, 34, 83, 72, 37,243,206, 59,119,112,222,186,218,173, 54,114, 30,121,143, 34, 96,243, 56, 47,102, 32,186,115,235,
+ 29,134,245, 17, 55,159,121,154,183, 94,254, 54,255,205,223,251, 53,222,186,115,178, 76, 63, 44,148, 56,172, 14,192, 53,164, 54,
+ 98,151,129, 74, 46,158,132,195,220, 60,133, 46,216,168,200, 71,232, 92, 79,236, 58,148,198,208,119,244, 93, 52,117,172,102,130,
+120,246, 83,166,185,194,170, 83,180,102,230, 73, 89,109, 34, 47,220,188,206,203,175,221,226,237,119,207,137,125,192,171,237,187,
+ 37,152,227,190,150,196, 60, 37,182,151,123,166,221,204,213,235, 71, 28, 93, 57,224, 91,223,124,133,175,125,245,155, 76,101,230,
+153,167,159,225,  3, 31,120,158,143,126,248,  5, 86,113,197,110, 59, 19, 66,207,110,183,165, 91, 13,180,  8,151,251, 61,181,194,
+ 16,  3,190, 11,248,224,208, 82,141,158,183,  8,115,134, 85,207,167, 63,241, 33, 66,140,188,248,206,125,134,174,227,249, 39, 54,
+ 28, 93,185,198,229,249, 37,103,103,247,136,157,163,140,  9,230,130,106, 49,112,200,250,208, 38, 75, 30,252,122,141, 43,  9,223,
+ 28, 49,  6, 90,234,248,253,151, 39,206, 39,199,110,234,121,249,157,115,246,  5,170,239,192, 41,227, 56, 51,151, 74,139,106,129,
+172,105,102,220, 79, 92,140,123,134,154,185,125,114,155,211,251, 59,238, 95, 94,178,159,102,186,131,  3,230, 92,232, 93, 69, 75,
+229,116,123,142, 58,199,246,236,146,203,237, 25,159,250,244,211,252,216, 95,251, 40,127,242,173,119, 25,231,132,243,128,243,  4,
+241,214,228,  0, 83,172, 98, 57,151,214, 42, 89, 43,199, 71, 87,121,242,241,199,121,226,137,171,100,113,188,123,231,222,146, 32,
+246, 56, 41, 32, 80,117, 48, 99, 96, 15,157, 95,217, 42,105,232,240,195, 33,206,135,135,175, 29,218, 96,221, 31, 34,174, 35,251,
+130,111, 66, 75,141,113, 60,183, 20, 58,133, 18,  4,105,158, 90, 51, 90, 44,120, 43, 30,238,221, 63,101,183, 29,121,238,153, 43,
+188,250,250, 45,254,248, 59,111,115,251,100,203,173,123,119,121,250,169,235, 60,249,248, 77,158,124,114,195, 60,237,185,119,186,
+163,181, 29,207, 60,187, 97,181, 94, 49, 93,236,209,102,135, 51,175,150,  1, 48,251, 21,204,169, 64,111, 63,  3, 62, 88,208, 53,
+ 33,228, 44,172, 67, 48, 23, 67, 80,104,153,214, 58,170,111, 76,101,111,249,157, 38,208,121,186,206,  2,168, 89,139,133,255, 92,
+160, 73,197,247,107,164, 21,115,173, 87, 71,105,129,208,  5,  2,141, 85, 12,132, 40, 20,245, 86, 35,237, 28,186,175,244,177, 48,
+ 22, 33, 59,135,103,128,150, 17,188,173, 35,253, 76, 17,115, 99,196, 67, 65, 23, 45,174, 93,198, 27, 53,152,148,170, 61,184,148,
+  0,171,213,  1, 55, 30,187,242,240,117,226, 65, 78, 76, 22,178,246,131,181,248,251,147,239,237,125,227,239,211, 89, 57,191,123,
+ 65,201, 51,206,195,141,235,199,108,150,177,190, 91,198,224,242, 72, 77,206,125,159,135,229, 63,119,219,221,101,166,221, 30,113,
+202,209,193,  1,  7, 75, 90,127,126,164, 42,247, 16,126,243,200,131, 53,189,239,253,191, 31,164, 83, 20,238,157,141, 92,236,118,
+212,218,120,226,234,134,131,245,230, 47,117, 18,112,231, 98,228,242,238, 61,198,105,194, 81,104, 69,209,201, 42,116, 89, 58, 74,
+201,236,118,231,248,205,138,172,141,172,130,186, 66,220, 40,117,231,145, 82,113,131, 39,196, 21, 89,  7,106, 58, 95,204,116,106,
+ 23,201,141,199,247,158,118, 57, 51, 81,104, 85,  8,181, 81, 19,120,137, 38, 28,243,150,241, 10, 56, 66,104, 76, 85, 57,232, 29,
+155,155, 79,243,250,252, 36,183,190,243,109, 66, 93,126,192,141,254, 98, 16,133, 86,154,221, 24,195,146,115, 47, 13, 93,130,111,
+198,123,145,135, 29,116,167,141,228, 60, 62, 24,101,173,149,106,200, 23, 15, 78, 21,117,158,212,148, 32,222, 94,168,157,157, 46,
+131, 83,154,150,197,135,235,  9,190,209,176,138,134, 87, 53, 53, 42,141,146,203,210,153, 55,232,141,136, 25,208, 68, 27,117,169,
+223, 57, 93,  2,122,222, 91, 37,170, 85,163, 93,225, 64, 11,193, 71,178, 61, 93,237, 95, 87, 45, 43,208,132,170,149,172,142,188,
+116,211, 69,253,210,213,110,120,196,184,241,193,126, 64, 68, 44, 45,232,189,177,115,157, 58, 52,217, 70,198, 97, 63, 96,165, 21,
+186, 37, 53, 90,232,140, 19,223,189,247, 45, 47, 33,224,  3,132, 36,120, 13,120,245,139,193, 44, 24,169,174,233, 66, 11, 82, 98,
+240,246,103, 86, 69, 52, 24,168, 68,204, 91,175,204, 75, 93,208, 81, 82, 98,220,110,209, 90,169,229,130,230, 28, 41, 77,104,179,
+159,236,166,182, 94,113, 78, 81,241, 52,148,113,119,193,127,249, 95,252,103,252,175,255,243,255,196,246,252,148,221,126,107, 93,
+245, 82, 41,101,166,235,143,128,  7, 95, 19, 37,180, 72,106, 66,115, 29, 65,236,118,209, 84,208,214,152,211,200,102, 24,216,177,
+103,152, 18,  8,244,135, 27,114, 26,105, 85,168,213, 48,158, 62,122, 14, 36,112, 54, 87, 82, 41,184, 88,152,179,112,247,206,158,
+183,222, 62,193,  5,227,113,135,161,195,199, 72, 23,  3, 94, 11,147, 52,156,107,148, 41,113,245,177, 67,126,245, 87,255, 77,110,
+ 62,243, 56,243,126, 68, 60,120,103,226, 17, 23,132, 85,191,230,183,127,243,159,241,223,253,218, 63, 96,211, 11,147,102,158,190,
+126,131,147, 91,119,168, 89,113,177, 91,104,133,182,207,172,218,232,221,  0,113, 96,158, 19,171, 46, 48,244, 43,124,127,192,143,
+127, 34,243,220,181, 25,119,188, 98, 74, 29,227,118,135, 44,156,240,119,223, 62,102,117,165,113,124,148,169,219,194, 80, 46,172,
+ 98, 53,172,108,125,133, 80,157, 50,110,247,188,113, 55,112, 57, 29,240,177, 79,124,156,219, 39,247,185,119, 41,136,139,172,170,
+ 35,174, 86,  6, 34,233,123,214,  7,  3,219,109, 33, 68, 33, 28, 56,242,229,158,211,147, 29,231,243,158,146, 35,110, 19,201, 84,
+174, 28,117,220,124,226, 38,223,125,233,143, 57,159,118,184,150,105, 34,248, 40, 12,235,200,183, 95,124,151,191,242,195, 31,230,
+147,159,120,158,223,253,202, 55,112,150,238,164,170, 29, 78, 89, 64, 82,210,234,195,124,198,193,176,230,202, 99,143,113,112,124,
+  5, 21,199,201,253,219,198, 55, 92,156,  3,  4,235, 65, 11,150, 34,207, 89,136,171, 64,239, 54,132,205, 10,141,130,228,134, 87,
+111,153,155, 85, 71, 83, 71, 45,208,183,142, 89,102,230,233,130, 58,143,180,186,216,  4, 83, 67,235,140,167, 26, 42,179, 46, 83,
+ 61, 58, 94,124,233, 54,162,133, 79,124,232, 89, 30,187,118,141,183,111,223,231, 91, 47,189, 13,237, 11,124,246,199,254, 69, 62,
+242,161,143,114,180, 62,228, 11, 95,252,  6, 39, 39,151,188,245,250,187,124,244, 99,143,179,141,141,154, 39, 52,  4,168,  5,241,
+142,181, 10, 37,122,230,113, 79,153, 61, 62, 24,184, 69, 39, 35, 70,122,215, 81,130,163,230, 25,102,165,143, 61, 45,194,148,132,
+ 32, 17, 45, 13, 23, 86, 12,209,156,  0,169,179,155,172,199, 70,226, 85, 32, 76,138,120,  7,  4,102, 95,136,190,210,215,142,230,
+214,164,108,175, 89, 45, 84,196,  7,218,110,166, 86,163, 11,210, 69,250, 94,144, 50,225,178,163,  6,155, 24,133,122, 68, 11, 17,
+ 50,248,125, 37,123, 65, 92, 37, 27, 52,130,190,137, 29,174, 10,180, 97, 89,151, 14,253, 67,200,202,101,131, 67,103,225,183,139,
+102, 60,129,195,110,  9,152,229,101, 90, 19, 23,186, 91,130, 85,120, 79,144,150, 39,179,252,229,154,232, 36,210, 61,178,251, 46,
+143, 60,212,255, 60,129,179,154, 42,173,102,188,126,111,143,124,248,  1,245, 50,255,131, 58,228, 13,114,174,232,130, 36, 79,242,
+222,251, 30,177,251, 93, 39,223,131,136, 55,254,198,159,245,227,  6,230, 57, 81,107,  6, 77,164, 84, 40,173,178, 79, 80,198,138,
+110, 34,186,111, 28, 13, 29,181, 57,146,  2,113,166,141, 35, 85, 61,114,220,147,207, 61,165, 64,164,209,105,162,100, 72,110, 38,
+  0,153, 14, 77,145, 50,158,219,101,179, 12,248,133,214,216,130,195,133,  2, 13, 98, 13,212, 80,113,205, 81,  4,250,206,113,116,
+ 44, 92,121,238,  9, 70,239, 24,227,138,176,120, 84,140, 37,110, 91,223,101,148,108,  8, 87, 37,224,163, 49,207,205, 82, 39,203,
+ 11,129, 44, 55, 58, 11,160,213, 82,241,205,238,133, 84,219,201,120, 49, 94,108,192, 25, 86,210, 41,190, 42,  4,104, 52, 90, 82,
+196,119, 56,173, 52,113,214,215,166, 89, 29,100, 97,165,107,  5,139,215,251, 37,173,105,138, 84,125, 48,194,151,197,219, 46,138,
+207,  9,143,163, 74, 32,107, 35, 46,200,214,220, 10,173,218,126,136, 96, 61,117,167, 24,119, 88,161,230, 98, 21, 47, 31,200,181,
+210, 59,  1,  1,134,126,  0,  0, 32,  0, 73, 68, 65, 84,251,179,164, 51, 56, 69, 91,186,244,161,127,112, 50, 14,132,224,108,142,
+209,  4,193,155,192,193, 67,201,141,164, 22, 46, 81,111, 14,116,153,167, 69, 50,176,120,219, 91,160, 44, 12, 30,166, 76,232,109,
+ 10,162, 37, 49,170,137,110, 98,215,227,162,199,181,  7,253,203,102,208, 22, 26,100,165,118,216,250, 64, 58,180,  9,187,253, 72,
+ 74,118,107, 12,150, 60,196, 19,104,106,188,  1,215, 22,158,189, 52,180, 37,219, 51, 55,225,157,183,222,178, 31,145, 90,201, 45,
+ 83, 74,166,161,132,206,227,165, 46,129,178,198,168,202,230,232, 58,183, 95,255, 22,115,154,  8, 97,160,239,  7,212,193,208, 29,
+224,180,227,202,241, 53,198,237,125, 46,166, 29,211, 56,178, 25,122,154, 86,230, 22, 73,165,114,120,117,224,246,233, 57,219,139,
+ 29,157,131,253, 69,229,238,201,158,239,190,122,143,232, 29, 67,215, 17,187, 64, 28, 34, 71,171,235, 56,157,104,217,161,181, 50,
+187,106,178, 29,239,185,119,114,193,115, 79, 63,206,245,107,135, 11,168, 72, 41, 53, 83,107,102,154,148,183,223,124,139,147,147,
+219, 92,185,222,243,137, 79, 61,199,147, 87,175,240,221,111,191,140, 84, 91, 51,  8,198,152,111,206,153, 19,220,  5,154,  4,130,
+ 87,250,126,205,110,204,236,118, 39, 60,241,184,135,120,131,105, 14, 28,220,120,142, 34, 47,226,136, 84,231,152, 58,207, 91,183,
+225,137,169,227,153,131, 83,210,168,104,109,108,219,204, 52,121,238, 95, 42,103, 59,199,221, 93,207,157, 83, 65, 92, 32, 17,184,
+123,114, 74,158,118, 84,241, 36, 42,107,  9, 92, 91,111,136,171,222, 64, 43,190,208, 92,207,217,118, 68,231,140,102,171,103,169,
+ 76, 70, 30,163, 39, 79, 66,127, 24,168,173, 81, 53,211,135,206, 58,207,125, 32,117, 29,183, 78, 46,121,243,181,219,124,246, 39,
+ 62,196,215, 94,252, 14,121,204,  4,223,240,193, 20,194,186,160, 70,170,152,180,103,211, 13, 28, 93,123,140, 43,135,199, 56,239,
+ 57,189,191,133,217,234,154,185, 36,114, 43, 56,233, 64, 34,120,199, 16, 35, 26,  7,164, 11, 56,233, 88, 29, 92, 99,204, 51,170,
+ 59,154, 23,162,116, 84,117,228, 98,175, 15,185, 66,157, 51,211,116, 66, 45, 19, 56, 71, 45, 98, 33, 91,129, 42,206,198,139, 44,
+248, 89,103,106,230,151,222,184,195,241,245, 99, 62,245,201,103,249,248,  7, 31,231, 96,240,124,237,197, 91,252,222, 31,124,131,
+127,237, 23,127,134,159,250,177, 79,241,115,159,251, 81,254,143,127,252, 59,252,179, 47,124, 19,105, 47,242,145,143,125,132, 55,
+ 73,228, 54, 19,163,133, 98,231,169, 17, 40,172, 67,103,158,119,177, 92,181,196, 14,169,141,226,161,105,165, 15, 29, 26, 42, 57,
+ 23,152,132, 97,216,224, 92,177,183,209,104,123, 69,134,128, 56, 71,240,  3, 90, 77,102,211,247,107,230,253,142,160,158, 62, 54,
+198, 58, 67,237,200,204,132, 62,227,194, 33,117, 63,226,195, 12,226,233,157,167,197, 70, 81, 79,215, 55,166,105, 34,174,122, 80,
+ 33,170, 34,177,183, 20,187,155, 40, 69,240,225,  0, 90,178,135,144,218,218,196,247,182, 86, 36,  8, 45,219, 19,235,250,193,128,
+ 95,198,233,171, 71, 72, 43, 71, 14,106,103,183,224, 10,236,253,123, 41,248, 75,224,188,193,161, 13, 30,169, 21, 78, 47, 70,107,
+ 27,161, 20,173,108, 83,121, 56,126, 79,179,193,124,188,183,151,211, 90,149, 85,144, 63, 19,138,182,  0, 83,158, 77, 21,221,197,
+229,114,244,103, 27,143,251, 31,240,246,240,240, 57,166, 12, 14,174,174, 86,223, 91, 69, 91,246,232,229,193,199,161,112,117,209,
+ 44,108,129,109,131,235,242, 94, 54,192, 84,217,186,128,215,224, 50, 55, 46,183,231,148, 60,211,106,161,  8,196,217,211, 13,141,
+ 62,  4,146, 83,212,247,224, 34,173, 77, 48, 38,220,176,166, 27, 18,181,173,144,152,  8,212,  5,159, 94,113,172,241, 94,233,244,
+156,174, 27,160, 37,166,180,165, 70, 71, 72,118, 20, 25,181, 32,226,  9, 46, 82,247,224,188, 18, 84, 73,234,152, 53,209,210, 33,
+ 85, 19,172, 28, 79,116, 43,238,102,144,150,  8,118,235, 93,198,179, 52, 30,220,220,131, 19, 10,222,186,213,213,  6, 52,162,142,
+182, 32, 33,205,229, 26,105,203,200, 73, 48,252,171,228,250, 48, 26, 41,152,176,196,251,104, 39,201, 82,104, 78,104, 85,237,228,
+ 37,142,166,217,110,176,213,254,226,154,229,221,236, 59,166,232,146,158, 55,254,145,107,208,188, 33, 76,171, 46, 15,243,218,168,
+106,200, 62, 17, 93,172, 66,106,245,184,133,184,132, 83, 27,187,  3,181,101,178, 90, 88,202, 73, 93,242,  2,139,198, 81,140,146,
+213,180, 45,182, 43, 65,154,163, 95, 69,230, 57,153,104,193,137,125,231,  7,219,134, 75,174, 84, 47,164,146,233,162, 91,128, 55,
+158,186,236, 89, 75,213,133, 86,103, 70, 53,239, 35,117, 54, 62,177,239, 76, 74, 51,231,204,208, 10,181, 46,208, 28, 31, 17, 45,
+228,162, 68, 49,211,156, 60,232,196, 59,193,119,230,222,205,115,177,177,120, 39,204,187,209,108,109,221, 10, 17,187,253, 55,181,
+106,130,115, 74, 93, 68, 61,174,202, 82,231,115, 52,153,236, 24,167,182, 18,104,173,218, 65, 77,141,251, 60,151,132,228, 30, 41,
+ 19,155,205,134,245,193, 21,198,221, 37,251,253,142,110,216, 48,237, 70,138,102,130,222,226,174,143, 28,222, 59, 96,181, 58,198,
+247, 61, 83,157,153, 83,197,187,  2, 62,226,106,133, 20,152,230,153,253,148,217,230, 68, 55,  4, 82, 18,156, 23,250, 56,208,197,
+ 64, 92,109,248,236,207,126,150,159,253,201,159, 37,141,123,254,159,223,249, 29,190,248,165,223, 67,200,136, 54, 90, 58,227,159,
+252,214,231,249,194,239, 63,205,207,252,248,167,185,241,196, 33,243, 60, 83,146,249,144,239,221, 63,231, 11, 95,254,  6,190,139,
+ 76, 83, 99,186, 40,124,235,221, 55,216,167,194, 16,156, 85,  1, 69,104,222,225, 21,138, 56,170, 83, 14, 99,196,245,145,227,205,
+154,143,125,252,211,236,211,204, 27,111,253,  9,231,231,247,184,122,237,  5, 46,170, 35,157, 29, 83,231, 68,201, 66,119,237,  9,
+142,217,113, 57, 77,188, 90,  6, 86, 82,185,216, 43,183, 47, 50,219,217,147,230, 70,149, 21,174, 19,118,229,148, 92,206,249,163,
+ 63, 25, 57,189,123, 98, 22,172,126, 96, 51,244,212,156,216,237, 18,  7,172,184,188, 84,142,  6,123, 96,108,183,230,  8,232,163,
+ 65,121, 74,174,236,242, 25,169, 20,100, 31,185,152, 47, 24,167, 68,104,176, 47,137,146, 29,251, 41,241,236,227, 87,249,240,205,
+167,248,246,203,247,249,232,167, 62,206,  7,158,123,138,175,127,227, 37,214, 43, 79,109,149,224, 59, 10, 74,171,149, 90,224,232,
+232, 58,  7,135, 27,214,155, 35,214,253,138,150, 10,  5, 65,131, 35,165,198,156, 50,142,229, 48, 16, 20,109, 25,149, 64, 84,112,
+ 85,161,171,132, 16,113,187,137,226, 29,222,175, 80, 49,223,115,149,140,119,145, 57,159,115,122,242, 10,210, 70, 91,211, 45, 24,
+ 79,105,130, 83,143, 86, 75,192,135, 86,169, 69, 13, 32,227, 34, 41,123,190,242,141,239,242, 83,159,249,  4, 31,253,192,147,124,
+229,171, 47,113,114,114,159,119,110,159,240,129,231,175,242,185, 79, 63,205,245, 15, 63,201,191,251,252, 47,163,205,241,213,111,
+190,200,199, 63,254, 24, 79,221, 56,230,213,119,182, 12,172,204,123,176,200, 93, 90,105, 28, 12, 61,147, 22,106,106,168, 55,241,
+147, 47,153, 92, 26, 37, 70,218, 36,104, 16,188,119,104,155,104,  1,162, 31,152, 53, 83,139,195,239, 18,210, 53, 92,235,  9, 97,
+160, 50,161,117, 66, 91, 65,250, 21,147,155,108,135, 41, 21,207,176, 76,218, 10, 18, 29,161,143,196,234,216,205,141,216, 71, 42,
+202,188,205,104,245,139, 13, 46,208,250,  1,178, 67, 24,161,122, 19, 37,249, 66,152, 42,253,224, 45,107,226,141,251, 80, 16, 92,
+ 51,121,140,107, 29,171,254, 79, 23,152, 60, 74, 83,115,192,245, 71,170,108,  7,192,106,176,212,183,  3,118, 30,238, 68,161,166,
+108, 23, 53,113,182,190, 90,210,225,123,243,229,224,151,219,113,153,148,245, 90,240,206, 38,  0,157,194, 81,247,222,237, 57, 46,
+107, 90,  7,140, 99,177,247, 43, 98,120, 95,249,203,  3,207,212, 10,115, 46, 70,242,139, 29,195, 35, 59,245, 67,224, 80,222,179,
+207, 85, 96,237,222,251,154,108,150, 33,174,123,127, 18, 95,228,225,127,239,213, 81,170,233,110,147, 42, 45, 53,154, 23,198,148,
+ 24, 90, 67, 74, 35,104,100, 91, 47,112, 58, 51,196, 13,151,197,170,172,101, 63,147,199, 61,145,142,214,175,112, 61,204,103,231,
+164,253, 14,231,149,236, 28,228,102, 78,117,231,104, 78,192, 71,124,217, 80,229,146, 86, 60, 67, 23, 24,105,180,180, 35, 76,142,
+172,142,110,227,169, 20, 86, 49,114,137,103,103,100, 31, 66,244,193,146,222,186,144,211,156,  1, 87, 74, 51, 93,170,184,133, 19,
+221,202,146,100,181,219,178,125,210,206, 30, 32,213,198,245, 45,200,195, 94,116,196,144,119,185,218,105, 15, 28,189,247, 75,240,
+237,193,208,198,210,244, 42,214, 35,199,217,195,187,177,164, 46, 85, 22,104,131, 80, 91,163,184, 10,205, 25,187, 90, 77,145,105,
+ 55,210,138,111, 66,110,138,247,206,170,120,234,168,173,154,185,197, 59, 84,131, 81,237, 44,189,134,119,214, 33,110, 15, 20,147,
+174, 46,129, 49,103,201,126, 23,141,120, 20,236,244, 23, 69,150, 61,164, 66,179,212,180,177,237, 61, 61,145, 74,161, 22,143, 70,
+235,243,250, 69,148,243,224,155, 67,163,117,254,231, 50,161,222,250,249, 41, 57, 60, 66,168, 74,170, 86,173,241, 42,164, 60,179,
+ 31,149,225,112,141,139, 14,223, 11, 45,219,109, 79,104,230,123,110,138,132,104,183,138,166,108,119, 35,181, 53, 92,171,230,133,
+ 55,186,192,210, 74,112,104,205, 54, 42,111,150,113,160, 62, 32,136, 89,240,207, 45,241, 73,109,217,170, 59,205, 38, 49, 37, 39,
+240, 66, 33, 35,235,198,148,102, 86,  7, 87,120,234,153, 15,154, 11, 28,161,213,145,119, 94,127,133,119,110,191,195,245,235,133,
+167, 54, 31, 36, 51,  2, 25,175,  1,117, 21,193, 83,  4, 66, 23,  9,222,198,248, 93, 55,224,125, 51,181,167, 90,167,248,198,141,
+ 39,248,229,127,253,111,113,245,232,  8,128, 39,111,222,228,245,183, 95,231,237, 87, 94, 65, 75,229,246,189,115, 30,211,192,217,
+189, 87,249, 31,223,122,137,117, 60,224,114,119, 78, 78,133,161, 59,160,232,196,157,251,247, 89,175, 14,104, 21, 94,125,227, 46,
+103,231,103,120, 58,106,176,181, 74,231,132,169, 22, 68, 29,174,102, 82, 42,236, 90,197,133,200,106,238,120,241,229, 63,226,202,
+181, 27, 92,191,126,147,169, 42,175,191,123,135,111,126,251, 53,250, 24,185,156,247,196,120,200,227, 69, 89, 29, 94,103, 95,183,
+ 92,156,120,242, 52,218,195,144,  2,101,207,249,110,164,247,153,141,174, 41,101,164, 37,200, 58,177, 94, 15, 52,  2,158, 70, 60,
+112,172,165,167,150,198, 92,236,176,188,223,194,110,123, 66, 65,113, 62,176,109,153, 52,111, 73,205, 72,139, 85, 43, 33,121,198,
+203,153,177,238, 12,166, 68,161,105, 96, 55,103,238, 95, 20, 62,253, 67, 79,240,251, 95,251, 54,175,191,244, 22, 31,126,254, 25,
+254,240,107, 47,209,176, 80, 43,106, 36,200,212, 42,235,245,  1,215,158,184, 65,232, 58,250, 62, 24,112, 36, 70,196, 91, 55, 91,
+114, 33,134, 64,145,108, 19,186,220,140,154,213,219,193,208,171,167,182, 72, 73,213,166, 63,177, 35,198,158,113, 63,162, 62, 33,
+210,179,187, 60,225,242,246,203,180,113,143,239,196, 14,242, 15,249,178,102, 87,108,216,106,200,182, 86, 54, 85,202, 98,244,183,
+ 41, 21,190,244,181,151,112,210, 24, 54,107, 14,214,  7, 28, 31,109,112,192,237,187,103, 92, 57, 10,108,110,220,228, 63,248, 15,
+127,133,191,247, 95,255, 47,124,241,203,223,225,111,254,220, 79, 80,175, 31,242,230,173, 83, 35,177, 73, 64, 35, 36,109, 84, 81,
+156,174,  8,100, 40,149,172,160, 82, 17,181, 21,154, 12,171,101, 60,108, 19,198,162, 13,153, 27,193,  5,123, 98,161,184,214, 19,
+189,199,117,153, 82,122,234, 60, 34,126, 32,251, 74,116, 74,171,  1, 90,166,120,232, 90, 71, 78, 19, 93, 24,104,123, 97,234, 43,
+177,247,224, 44, 87, 18, 92,160, 56, 99,114, 52,105,204, 85, 25, 92,195, 85,171,202, 54,153,200,115,165,174,215,244,218, 32, 87,
+182, 69,112,210,144,222,163,157,146, 68, 88,187,102,135,165, 63,227, 40,217,189, 79,179,234,190,167, 27,222,136,205,234,124, 33,
+  8,199,189,167, 95, 38,  0, 71,221,123, 15,195,181,135,243,  3,247,240, 64, 80,130,253, 30,255,160, 71,110,195, 24,226,242,235,
+243,220, 76,205, 44,118,113,152,170,213,132,235,195, 94,255, 82,129, 94,254,253,255, 51,214, 47,205,214, 66, 82, 50,113,129, 86,
+125, 63,146,156,255, 62,218,217, 63,109, 50,176,242, 38, 96,223,215, 76,117,130,134, 64,206,149, 58, 54, 38, 23, 41, 53,145,211,
+ 93, 91,175,224,152,194, 76,223,  6,198, 57, 81, 91,  0, 57,160, 56, 71,187, 44,100, 86,184,184,160,194,181, 18,242, 76, 66,173,
+  5,210, 53,210, 22,198,113,166,111, 51, 68,155,132,239,118,123, 90,180,103,170,215, 25,113,145,178,191,192, 59,207, 65,173,148,
+180,167, 92,  6, 72,151,132,222,123,166,214,150, 27,177, 37,182,  5, 65,220, 18, 48,211,138,226, 13,226,176,116,201,155,179, 49,
+130,228,138, 11, 38, 86,105, 77,109,177, 31, 30,  4,220,132,212, 12,214,162,213, 72,102,245,  1,179,189, 57, 11,190,213,102,183,
+124,  7,170,197,126,128,150, 29,121,107,141,214,132, 38,246, 64, 16, 31, 17,169, 22, 40, 83,197,133, 64, 45, 21,167,118,234, 47,
+181,128, 55, 29,163,107, 32, 49,162,217,198,239,158, 96,154, 60, 49,230,187,195,126,136, 58,  9,212,133, 45, 31,196, 48,183, 21,
+243,240,186, 96,102, 45, 21, 33,100, 69, 37, 16,  6, 37,149,229,246,219, 44,165, 46,234,209,206, 84,146,190, 86,180, 58,114, 51,
+ 72,133,132,  0,165,218,225, 40, 53,138, 47,184, 22, 44,192,179, 28,162, 74,178, 27,178,138,195,117, 15, 18,225,149,179, 93,165,
+ 93, 92,114,120,116, 68,191, 50,253,171,151, 70, 28, 12,132, 49, 56,111,187,243,160,228,113, 98,174,137, 90,149, 14,243, 92,219,
+  6,195,120,  2,134,184,109, 54,134, 95,  2,145,162, 25, 33,216, 45, 73,160,166,134, 11,126, 89,195,  8,120, 79,206,141,224,148,
+ 46,120,114, 75, 92,222, 61, 69, 85, 89, 29, 29, 82,242, 72, 74,137,166,158, 43,199, 79,112,253,169,155,220,122,243,187, 12,235,
+ 35, 98, 31, 40,163,113,168,115,105,180, 73, 89,173, 55,204,115, 65, 74,  0, 55,208, 57, 49,205, 39,150,172, 46,216,129,172,247,
+ 16, 30, 41,193,246, 49, 18, 67, 96, 86,111, 68,184, 56,112,243,249,143,112,237,218, 49,125, 84,154, 23,206, 79, 46,249,194, 23,
+190,200, 27,111,190, 78,191, 90,177,238,  6,243,219,215, 74, 74,198,122,183,239,217,128,199, 51,151, 66, 73,213,186, 57,173,225,
+189, 35,213,130,247,145, 89, 29,175,189,246, 26,249,181,215, 56,238,143,121,242,185,167,120,225, 67,159, 96, 62, 57,163,215,198,
+189,233,140,221, 56,242,206,155,223,197,175, 87,244,210,113,184,186, 70, 59, 88, 51,107, 98,222,109,153,178,101, 75,148,142, 49,
+ 59,210,156,233, 92,111,163, 55,  4,169,182, 99,205,115,101,102,162, 69,135,168, 77,109,234,121,162, 57, 59,240, 94, 78,231,104,
+115, 12,193,248, 13,117, 86, 18,201,234, 70,219,115, 11, 85, 90, 28, 27,213,153, 77,231, 56,223,141,172,142,122,158,121,238,105,
+254,228,197, 55,248,133,159,253, 81,190,250,149, 39,121,253,221,123, 48, 84,170,142, 24, 37,216,179, 94, 15, 54,117,171, 66,155,
+205,178, 70,245,140, 57,145, 41, 72, 16, 92,243,184, 92,105,181,226,124, 52,186,164,243, 20,103,213,208, 94,149, 60,205,200,234,
+  0, 39,133, 77,244, 76, 33,145,246, 51,251,203,187,220,187,243, 50,144, 88,135,142, 90, 20,155,  3, 44,202,101,169,212,106,  2,
+165,154, 43,142,182,216, 24,205,255, 32,170, 12,113,197,217,118,207,215,191,243, 22,191,244,185,207,240,153, 79,125,148,163,213,
+134, 23, 62,240, 24, 55,159,140,248, 78,217,191,243, 46,253,213,107,252,234,223,249,101,254,254,127,251, 15,249,131,175,254,  9,
+ 63,250,163,159,228, 98, 92,179, 59,155,201, 82, 76,149,106,223,214,212, 58,209,102,136, 61,180, 16, 40,179,  3, 55,145,104,116,
+  8, 78,109,  5, 24,134, 64,221, 67,146,202,224,  7,211,157,170, 64,204,168,102,180, 68, 92, 19, 90,240,116, 85,208,170, 80,122,
+130, 88,141,205,209, 76,161, 42, 32,109, 68,197,209,106,165, 23, 24, 75, 37,234,  6,245,166,210,236,156, 35,202, 33,174, 51, 21,
+113,237,  4, 70,101,232, 35,162, 43, 98,232, 73, 50,163,217, 38,139, 97,  8,148, 38,228,  6,  7,193, 20,187,127,244,173, 87,184,
+126,229, 24,245, 29,199,253,192,225,225, 10,  9,142, 82,149, 97,  8,116,193,217,199,160, 60, 36,205,188, 63,173,174, 10,105,159,
+ 40,146,105,181, 16,252,202,116,218,127,202,239,109,203, 46,252,193, 62,252, 64,222,227,169, 59,108,156,253, 61, 15, 74,  7,105,
+206,148,148,113,171,129,184, 76, 22,116,129,229, 60,144,198, 38, 96,191,140,199, 31,132,228,178,194,230,145,209,120, 85,232, 31,
+121,255,227,152,208,106,175,123, 65,222, 11,  5,126,191,244,191,252,128, 52,253,163,111,159,114,165, 44, 57,165,152, 29, 90,148,
+ 90,148,232,128,117, 65, 47, 26,193, 31, 44, 33,234, 61, 42,153,182, 27,241, 62,208, 92, 79,232,140,147, 17,157,226,135,  3,202,
+121,195,249, 83, 90, 41,164,206, 49,238, 61,206, 79,172,139, 82, 80,164, 57,178,107, 56,237, 23, 18,168,226,200,104,129,172, 30,
+  9,221,194, 89,232, 57, 29,215,188,248,134,112,114,247,140, 54, 37,252, 51,207, 60,251,119, 31,161,225,219,174, 73, 28, 18, 76,
+242,193,242, 96, 94,152, 52,214,245,117,178,208,253, 22,213,159, 51, 32,253,131,127,156,115, 11,174,181,162, 77,  9,203, 13,163,
+ 53,111,178,145,165,  2,102, 94, 15, 75,138,251,  7,212,185, 37,245,206, 66,138, 83, 89,232, 52, 78, 12,227,185,128,113,170, 86,
+104,  6, 95,209,224, 89,144,117,118,255, 87, 59,245,139, 55,105,140, 20, 27,201, 71,239,168,173, 45, 78,109,123,187,243,138,115,
+216, 13,191,115,244,222, 45,206,103,183,136,105,236,175,214,  5, 79,177,200,188,125,174,178, 36,233,189, 85, 80, 68,173, 90,231,
+154,129, 82,146, 86,114, 73,230,105,239, 28,203,194,  1, 39,206,190, 46,226,  8, 94,  9, 20, 90,183, 32,122, 27,244,222,177,223,
+237,184,127,182,231,226,114,203,246, 98,100,188, 24, 57, 59,219,114,177,207,140,185,146,246,149, 92,132,210, 60,165, 88,229,112,
+ 30,247,156,159,143,196, 16,169,181, 44,232, 87,155, 14,104, 85,107, 31, 88, 88,  2,169, 75,253,208, 25, 14,152,  5,192, 67, 51,
+173,108, 12,142,213,106, 67,240,145,  0,  4, 21,196,119,140,247,239,113,127,187,165, 15, 29, 93, 28,168,165, 26,244,100,233, 27,
+239, 46, 47, 56,186,254, 56, 93,183, 38,231, 25, 45,101,105, 28,116,214,253, 47,137, 86,151,114,100,205, 84,105,120,137, 22,226,
+ 19,115,205,143,101, 66, 53,240,194, 11, 31,160,182,194,111,252,163,127,196,151,191,242, 21,202,172,236,114,226,147, 63,252, 17,
+ 62,246,177, 15, 16,250,142, 62, 12, 56,223, 24,214, 29,211,104,208,157,  0, 52,117,236,246,123,200,198, 31,119, 94,152,243,140,
+247, 61,173,  9,251,221, 37,170,130, 15,145,218, 76, 94,130,115, 28,172,215, 28, 31, 31, 49,239,246, 28, 29, 94, 39,181,194,106,
+125,200,143,255,244,207, 51,206,123,198,105,207, 19,207, 61, 78,168,158, 77,183,226,208,219, 48,239,236,226, 18,210,142,205,209,
+ 53, 94,120,246,195, 60,126,229, 73,226,176,230,232,198,117,222,125,251, 93,166,121,164, 11,  1,213,202,110, 63,211, 20, 98,176,
+219,132, 83,103, 14,104,129,105,159,200, 58,147,198,137,253,180,227,252,114,203,184, 79,156, 93, 92,112,114,255, 62,248,200,102,
+ 24,  8,189, 61, 32,199,253,104, 57, 23,130,117,200, 83, 33,167,202,213,227, 99, 62,124,243, 57,222,124,247, 46,  7,135, 71,188,
+113,247, 30,119,239,157,227,188,131,230,232,253,134, 46,116,172,215, 43, 36, 70, 60, 74, 23, 86, 68, 31,153,210, 72,245, 13,247,
+ 96, 50,144,102,168, 14,113,209, 38, 99,157, 71,188,183,191, 83,183, 97,221,  7,250,110,192, 71, 79, 23,122,106, 21,182,219,123,
+220,187,243, 58,187,211, 55, 41,121,182, 29,190,243,248,216, 45,109, 14,  3, 89, 17,212, 88, 22,205,204,114,205,137,113,211,155,
+ 57, 37, 84, 31, 40,143, 61, 23,231, 59, 90,109,124,230,211, 31,230, 71, 62,120,157,167,158, 57, 96,181,233, 17,233, 72, 37,243,
+198,203,119,184,241,204,211,252,208, 15,127,140,175,124,253, 21,230,180,231,195,207, 63,205,235,239, 90,163,195,139, 67,163,135,
+ 28,240, 57, 81,125,176,212,119,107, 72,103, 93,250,206, 45,175, 63, 33,208, 52,163,165,224,  8,224, 34,222,155,136,199,213,128,
+107,106,164, 47,173, 54,185, 43,145,230, 86,204, 76,196, 14,195,193,  6, 37,101,165,182, 64,  8,  3,197, 87, 88, 57, 92,178,139,
+ 75,215, 27, 45,204, 59, 97,181,234,145,108,181,218, 13,133, 57, 21, 36, 21, 52, 22,218, 98, 46,116, 99,162,101,155, 44,224,236,
+208,208,121, 24,170, 77, 37,213,  9,231,211,196,221,251, 91, 46, 47,118, 92,156, 79,188,115,114,193,219,119, 78,185,117,118,201,
+221,147, 51,110,223, 57,231,157,187, 23,220,189,117,193,126, 59,115,185,155, 57, 57,155, 57, 63,219,209,114,161,228,194,249,229,
+196,201,221, 51,198,113,139,102,232, 87, 29, 79,222, 56,198,251,240,207, 89,204, 30, 80,218,226, 35, 15,249,239, 87, 36,187,119,
+ 81,216,158,159,211,180,176,217,172,120,250,177,227,135,239,111, 37,223,235, 46, 31, 30,  9,177, 45,174,177,135,111,175,134,249,
+127,248,231,206,192,237,179,137,253,217, 37,115,202,116,209,115,237,250,177,249, 54,128,221,  2, 77, 19,121,  0, 79, 91, 38, 18,
+143, 16,244, 30,109,  7, 40, 44, 42,172,247, 30,235,183,183, 51,119,238,222,226,252,108,199, 52, 85, 18, 25,154,133,229,116,103,
+151,223,234,123, 10, 35, 93,233, 40,115,198,123,  8,222,145, 52,145,117,132,177, 32,125,197,245,  3,251, 59,231, 56, 41, 20, 28,
+115, 74, 56,113, 84,102,166,125,166,102, 79, 63, 68,106, 72,148, 57, 17,157,195,117,129, 90, 60,110, 48,219, 41,165,144,164,114,
+180, 17,126,230,231, 62,202, 71,126,232, 51,220, 45,  7,220,123,253, 93, 66, 91,234, 98, 15,190,241,155, 23,139,234,103,115,198,
+214,229,129, 78, 83, 36,152,209, 74,112,148,  7, 99,115,140,224,211,176, 94,186,136,125,209, 60, 66,112,150, 15, 85,177, 19,191,
+202, 66, 83, 19,165, 36, 75, 86,235,194, 59,207,  8, 94,150, 29,186, 42,173, 20,106,131,208,  5, 80,219,195,137,148,165, 23,106,
+ 61,114,130, 77,  8, 36,103,196, 27,  0, 70,205, 38,251,176, 26,167,205, 44,102, 33, 56,219,117, 53, 27,193,106, 16,180,217,126,
+ 71,156,152,181,168,168,221, 98,157, 80,164,176,146,184,168, 72,237,243,181,139, 68,180,155,223, 98,165, 83, 20, 41,133,220, 26,
+ 82,  4,239,132,216, 57, 51,176, 53,104,222, 19,233,141,218, 87,102, 90, 92,198,255,203,144,169,212,197,112,229, 58, 90, 45,204,
+173, 50,230, 14, 71, 99,221, 57,196,119, 52, 10, 18,204, 84,119,255,100,143, 23, 59,244, 12,253,218, 86, 33, 90,232,250,235, 60,
+253,212,  1,185,205,204,105,100,222,207,168, 22,106,173,148,156, 45, 84,232,  5,215,170, 37, 88,197, 18,246, 15,146,209,141, 69,
+ 35, 88,  5, 31, 58,123, 88,231, 70,  8, 27,146, 98, 55,178, 50, 35, 90,216,237, 47,112,161,179,128, 89,109,104,155, 73,251, 75,
+156, 10,117,222, 83,253, 64,154, 13,222,177, 34,224, 36,225,195,192, 62,101,212,193,188,132, 77,162,119, 52,177, 93,101,140,214,
+199,204, 99,226,255,250,245, 95,231, 43, 95,249,  3,240,194,189,147,187,104,109,180, 54,113,243,233, 99,170, 20,222,189,117,135,
+ 16, 86,108,186,142, 55,223,124,131, 59,183, 95,163, 21,207,245,163,171,108,231, 29, 90,102,126,254, 95,254,  9,238,221,185,199,
+239,127,233, 59,172,174,172,113,109,101,180,186,121,107,122,209,230, 72,251,189, 53, 60,130,179,158,121,205,236, 46,182,228, 73,
+241,110,205,147,143,223,224,160, 19,190,240,127,255, 58, 13, 33,250,142,187,247, 46,184,115,126, 10,222,209,227,241,209,113,245,
+184, 71, 69,184,113,112,200,144, 18,111,222,187,195,241,225, 33,170,141,237,124,138, 11, 54,101,152,246,137, 42, 25, 69,153,178,
+169, 74, 83,218,210, 82,102,206,102, 53,211,214,204,144, 23,133, 16, 34,210,  5,122,223,211,111, 54,248, 24,240,206,147,210,100,
+193,207, 96,130, 32,209,142,185,212,133,165,238,120,237,246, 57,143,223,124,154,245,209, 99,252,111,191,249,  7,108,207,183,244,
+ 93,135, 11,129,232,  7,250,245,  1, 74,163, 52, 33,138, 48,108,  6, 90,129,185,101,100,176, 70,135, 43, 30,245,138,139,246,240,
+ 83,183,160,149,137,  4,241, 16, 34,125, 55,152,  8, 40,128, 87,207,156, 28,101,188,203,233,237,183,184,188,119, 11, 13, 88,202,
+189, 41,181,102,124,231,233,196,112,201, 37,202,210, 79, 53,203, 34, 84,162,216,164, 45, 89,111,149,232, 29,133, 66,  8,  3, 93,
+  8,124,243,165,119,248,226, 87,190,201, 71, 62,244, 89,168,137,179, 19, 24, 14, 60, 49,218,223,195,139,127,252, 29, 62,249, 35,
+ 63,204,223,248,249,191,206,255,249, 27,191,197,241,230, 29, 62,245,241,155,124,235,197, 83,180, 22, 84, 51,213, 39,235,135, 55,
+103, 29,121, 18, 45, 55,186,197,142,213,188, 49, 48, 92, 28,112, 69,  9,226, 24,181,226,170,163,182,137,182,138,196,169, 99,191,
+157, 24, 54,158, 50, 21, 52,102,188, 88,168,169, 37, 27,227,171,122,252, 16,168,169, 80, 67, 51, 63,197, 69, 70,250,  3,138,155,
+112,  5,138,140, 72,240, 54,  0, 15,142,224,247,108, 39, 91,243,185,160, 72, 56, 36,  5, 37,249,194, 52, 27, 68, 43,104, 35, 14,
+  7,182,202,156, 11,251,206,113, 32,176, 94,175, 57,252,127, 89,123,147,102,205,178,235, 60,239,217,221, 57,231,235,110,151,153,
+149,213,100,101,181,168, 42, 64, 16,193, 34, 64, 74,180, 40, 43, 20,116, 72, 17, 30,216,161, 31,160,137,127,132,198,254, 35, 30,
+122, 34,135, 71,178, 29, 86,216,164, 45,211, 20,200, 32,  1, 16, 96,161, 41,161,250,236,187,219,124,205,105,118,179,182,  7,235,
+100, 86, 17,166, 24,118,132, 48,170, 74, 20, 10,153,247,187,247,156,189,215,122,223,231,121,253, 77,140,117, 76, 87, 61, 98, 91,
+245, 60,196,136, 76,  3,219,108,245,114, 54, 36, 40, 35,207,118,123, 76, 80, 67,152,254, 57,245, 70, 37, 51, 84, 39,103,161,105,
+ 42,253,126,224,103, 63,255,146,213,170, 35,  2,199, 77,203,217,209,138,166,  9, 28,178, 96, 76,197, 47,  3,198, 58,173,253,121,
+243,119,184,200, 35, 57,205, 72, 84,255,255,221,192,246,155, 29,242,223, 52,174,121,244,121, 47, 57, 99,210,204,199,152,153,242,
+117,238,210,127,243,133,125,152,141,115,221,252,107, 59,129, 49, 67, 59,103,  1,146,192,120,136,172,151,141, 62,163,  4,250,139,
+ 11,124, 18, 98,174,180, 77, 97, 26, 51,251,221,132,149,164, 96, 54,  3,174, 92, 49, 13, 19,201,119,116,139, 37,135,148,137,185,
+ 82,211,132,229,136,232,206,217,108, 22,148, 26, 72,236,  9,214, 34,  4,188, 68,204,148,193,119,212,186,215, 74, 47, 22, 91, 52,
+235,165,246,163, 68, 25,  7, 74, 93,178, 12, 66,242, 45, 98,  4,147, 42, 47,  5,195, 17, 90, 49, 94,185,130,207,136,126, 65,230,
+151,160, 17,139,109,132, 90,102,187,238, 44,251,112,104, 15,189,212,130,115,118, 14,151, 41,  7,182, 86,143,153, 11,238,117, 62,
+ 85, 85, 81,170,131,  1,146,204,164, 28,167, 31,143,169, 85,193, 50,202, 12,196,186,  0,165, 32, 24,170,  5,107, 10,115,167,141,
+146, 53, 64, 80, 49,179, 14, 83, 19,245,213,104,240,197,207,130,136,156, 10,214,205,181,173,130, 90,198,172,211, 14,169,100, 74,
+153,247,253,243,136,207,187,231,183, 83, 94,220,178, 49,144,147, 65,235,182,149,169, 68,108,112,170,133,149,164,174, 92, 17,252,
+ 92,165, 43,169, 32,206, 41, 71,220, 88, 37,188,213,140, 21,  1,111,177, 30,140,173, 20, 25,193,120,106,227,161, 20, 74, 74, 24,
+175, 74, 71,153,213,123,173,215,154,223, 97, 40, 28,118,153, 41, 30, 88,116, 45,198, 85,213,241,121, 15,141,163, 75,253,252,141,
+106, 49,177,103,215, 15,204, 57, 70,188,181,115, 63,188,101,113,163, 99,179, 62, 66, 82,230,217,249, 83,250,254, 64, 46,145,152,
+ 19, 41, 37, 13, 63, 74, 37, 81,213, 11,236,156, 62,140, 76,197, 89,139,115, 94,253,213, 86, 67, 82,166, 66, 28,162,  2,138,124,
+230,234,252, 49, 24,163,170, 71, 49, 76,169,199,251,134, 48, 39,136,237,252,112,139,166,208,152, 74,208,239, 48,156,  8, 38,171,
+140,194, 56,131,137,  5,239,102,  9, 70,137,212,236, 17,147,248,252,139, 95,179, 10,157,190,  0,242,132,107, 42, 71, 75,207,207,
+127,242, 11,126,145,126,134,247,122,131,170, 78,141,119,102,210,207,212,174, 29,191,255,159,253, 14,255,228,  7,223,230,241,163,
+135,220,187,115,143,255,112,247,138,182, 89, 18,135,131, 58,151, 69,244,  5,134, 18, 10, 13,232,139,199, 24, 46, 47,207, 49, 77,
+203,211,203,175,232,251,128, 91,108,184,121,252, 50, 55,110,222,196,213,194,230,104,197,106,189, 98,138,133,139,167,231, 20, 99,
+112,161, 37,201,132,136,227,201,197, 83,206, 31,222,163, 61, 57,230,171, 59,119,152, 14, 61,205,114,205,152, 34, 83,142, 56, 35,
+140,135,158,203,180,213,155,168, 85, 40,204, 98,233, 89, 47, 55, 44,252,146,166, 83,  1, 10,243, 84,171, 68,152, 36,170,173,171,
+ 20, 98, 44,136, 84, 90,223,208,143, 35, 49,239,169,162,129,215,177,100,238,222,125,130, 55,134,221,152,216, 15, 19,190,105,177,
+ 97,193, 34,  4,170,209, 91, 72,157, 34, 87, 67, 79,170, 89, 13,109, 46,225,219, 21,118,178,248,234,169, 68,200, 89,171, 63, 14,
+146, 76,248,118,165,245,211,166,165,216,128,219,180,  4,219, 64,233,152,204,196,246,226, 49,219,199,159, 50, 30, 46,  8, 33,168,
+101,177,106, 32, 13, 17,100,170, 20,175, 63,247,186,118,179, 84, 91,240,198,225,196, 80, 68,  3,164,198, 10,198, 27, 61,236, 86,
+245,150,135,110,137,193,243,231, 63,249,148, 91,183,174,241,143,127,239,239, 97,189,167,157,  6, 22,173,227,236,100,205,211,187,
+231,124,254,249, 23,252,238,239,191,195,186,245,252,155,255,249,223,114,251,205,142,215,110,175,121,116,231, 41,141, 93, 50,213,
+ 94,201,141, 37, 81,242,200,132,193,132,128, 77,153,236, 50,193,118,186,222, 75,149,224, 42,197, 38, 76,177,100, 96, 49,179, 35,
+ 50, 35,185, 26,226,228,176, 86,247,237,147,140,  4,211, 96,168, 72, 45,216,146,113, 98, 17,211, 48,236,123, 66, 23,192, 54,120,
+ 12,185, 84,162, 12,  4, 87,  9,238,152,113, 60,208,148,134,188, 88,144,164,208, 68,167,134,189,210, 19,166, 21,165,241, 74,181,
+155,132, 82, 44,195, 54,225, 54,149,188,240,116,217, 34, 85, 56,190,126,196, 15,222,186, 65,  4, 30,165, 51,174,207, 30,139,203,
+  2,187,190,114, 20, 12,131,192, 97,204, 12,219, 65,217,  5, 37, 51,236,  6,117, 24, 88,139, 76, 17, 59,236,245,121,105, 21,214,
+ 84, 74,229,124,119,224, 98, 55, 34,  8, 79,141,229,179,  4, 77,167,129, 96, 41,176,232,148, 43, 97,141,227,108,189, 36,  4, 79,
+117, 30,145,204,178, 11, 52,222,145,157,225,176, 61,167,164,164, 43,132, 89,176,245,159,194,210, 86,103,154,156,154, 55, 11,203,
+198,254,141,140,192,145,249,155,187,242,179,223, 88,183, 47, 44, 44,154,175,167, 12,163,  5,187,234,104,230,105,193, 96, 96,204,
+ 13, 70,132,208,102, 98,111,176,135,217,180, 25,150,200, 98,164, 92, 85, 14,195, 68,201,142,188, 16,232, 51,118,156, 48,102,143,
+208,208,116,  9,153,  4, 57, 20,114,152, 53,220, 38, 82, 35, 84, 87,208,183,223,252,238,179, 14,114,192,103,139, 11,153, 20, 51,
+ 22,171,208, 49, 25,153,170, 78, 77,154, 92, 89,156, 56,218,229, 53,157, 94, 28, 20,230,229,165, 84, 29,141, 86,131,215, 97, 18,
+214, 88,156,211, 29,145, 11, 78,189,228,229, 57,196, 68,197, 15,234,108, 81, 26, 92,121,158, 54,127, 94,137,123, 62, 34,153,199,
+233,179,247, 74,127,176,231, 79, 33, 24,131,  4,221,239, 72, 45, 47,170,116,165, 42,191,215, 26,131,183, 70,193, 51,206,226,157,
+114,220,141,104,189, 75,252,188,159,182,138,  0,181,115, 98, 94,127,  7,162, 59,228, 26,181,190,100, 29,222, 25,130, 84,178,105,
+ 20,202, 96,  4,103,213, 33,238,190,177, 37, 50, 86,145,171,197,161,225,170,162,202,211,198, 26,  4,136,169,204,117, 15,149, 39,
+212,148,168,206,234, 65, 33, 84,138, 64,202,250,123,118,165,208,120, 29,225,149,154,161,177,164,249,129, 44,217, 34, 46, 19,240,
+ 88,175, 35,242, 82, 13, 37,122, 66, 99, 72,180,184,166,165,177, 22,130,163,163,225, 16,  7,104, 60,142, 66,140, 58,178, 92,172,
+150, 72,150, 23, 35,247, 49,234, 72,118,154,  6,182, 87, 87,132,118,129,115, 45,155,227, 14,239,172,170, 78,141, 97, 24, 15,108,
+ 47,175,216,247, 61,165,102,221,229, 27, 67,227, 21,120, 81,158, 47, 83,156,197, 73, 75,131, 99, 55, 30,240,203, 21, 39,167,103,
+ 42, 17,153, 50,222, 59, 98,201, 16,237,172,225, 69,201, 72, 88,130, 11, 88,215, 33, 76,140, 78,176,222, 80,162, 30,170,150,109,
+ 51,  7, 44, 13, 18,202,220,151,181,100,153,176, 70,171, 80, 67, 44,136,113,216,106, 24, 37,241,201,175, 31, 48,142, 73, 67, 85,
+ 67,193,218,137,205, 38,144, 68, 15, 80,165, 22,214,171,  5,215, 78, 91,254,215, 63,250,247,252,203,255,230,191,230,191,253,240,
+ 45,254,213,191,250,239,120,178,157,  8,203,134, 52, 36,166, 52, 97,157,193,139,195, 26,209,239,163,182,125, 49,130, 11,206,176,
+ 63, 12, 44,142, 58,166, 92,120,248,232, 46, 95,222,251,138,197,122,201, 75, 47,221,228,214,237, 55,185,121,109,195,178, 89,241,
+236,217,125, 18,133,216, 11, 95, 92,125,142, 49,130,219,172, 40, 86, 87, 30,198, 58,166,113,192, 91,143,228, 66,182,218, 77, 63,
+190,190,210,158, 61,186,190, 42, 70,144,236, 72, 50, 40,131,189,  8, 53,171,158,152, 86,201,119,181,177,244,243,205,118, 72, 61,
+ 49,121,210, 48, 81,  4, 98,173,180,190, 35,248, 76, 21,248,242,222, 57, 85, 42,109,183,208,181, 79,169, 51,  2, 56,145, 74,102,
+154, 70,106, 85,184, 17,146,217,108,150,180, 86,195,111,160, 42,211,146, 52, 27, 35,185,224, 66,139, 37,232,195,191,  6,214,139,
+ 13,222,119,218,117,143, 79,185,123,231, 83,246,151,247,168,146,232,218,133,170,153,171,232,  4, 44,105,175, 54,229, 76,  2,150,
+174,193, 24, 79,170,133, 92, 51,182, 38, 13,147,226, 49,161,168, 93,208, 43, 46,218,160,124,136,156, 35,109,187, 38,102,225,207,
+254,244, 99, 36, 10, 31,124,247, 61,222,127,253, 38,130,174,  3, 79, 54, 11, 62,249,244,215, 28, 45, 91,190,253,157, 87, 57, 63,
+252, 30,127,244, 71,127,206, 43,183,110,176,186,190,226,242,178,135, 98, 73, 40,247,125,101, 90,182,146,152, 36, 97,131, 26,214,
+ 74, 77,228,121,117,133, 13,152,236, 85,155,106, 10, 83,227, 97, 80,102, 71, 45,149,104, 10,203, 38, 16, 83,197,219, 35,178, 31,
+177,232,196,101,152, 50, 77,208, 23, 90, 48, 11, 72,134,246, 52, 64,202,144,160,115,158, 98,  2,166, 70, 92, 42, 36,132,144,206,
+112,229,130, 33, 27,214,116,140,  6,138,221, 98, 19,234,203,246,107,252, 96,168,141,114, 60,156,131,100, 43,193,192,217,106,243,
+194,145,126, 22,190,198,160,182, 14, 78, 55,134,245,252,247, 79, 23,158,254,100,195, 53,171,253,237,199,227, 41, 27,  3,161,129,
+ 93,129, 39,247, 14, 76, 95,125, 73,157, 38, 50,142,211,107,167,180, 55,174,147,147, 80,182,  7, 42, 17, 41,144, 81, 77, 50,214,
+208,103,109, 11, 65,228,208, 23, 50,  5,177, 80, 75,161, 51, 14, 68,137,146, 53,139,230, 74, 26,199,195,167, 23,148,148, 88, 46,
+ 87, 24,231,104,156, 99,189,108,241,193,147,  5,172, 17,218, 54,188,128, 36,105,  6,195,252, 71,161, 54, 41, 37,114,137, 10, 61,
+242,255,255,240,179,225,111, 33,236, 45,236,223,172,203, 97, 12,251, 24,137,169, 48, 85,101,171,132, 69,160, 63,244,152,152, 48,
+101,129, 11,215, 40, 54, 97,167,145,108, 51,102,  9, 77, 92, 51,164,145,105,220,107, 32, 58,195,224, 14, 80, 51,249, 42, 99,188,
+ 16,167,132,167,193, 38,  5,250,102,155,136, 84,178,100,188,237, 16, 91, 40,217,224,186, 37, 85,122, 76, 53,172,221,130, 62, 30,
+  8,211,158, 69,235, 25,129,114,216, 83,235,132,111, 27,131,136,142,158,197,104,247, 91, 63, 32, 64,202,220,251,158,237,100, 69,
+129, 45,198, 43,134,181,166, 57,236,102,133, 82,253,215,139,247, 92,177, 78,247,104,207, 67,114,213,168,162,206, 88,125, 33,102,
+ 51,  3,111,170, 32, 51, 57,169, 72,213, 23,185,  5,231,176,137, 30,187,  0,  0, 32,  0, 73, 68, 65, 84,204,139,132, 54, 78,113,
+178,144,102,252,172, 67,234, 60,254,174,186, 23,182,243,218,192, 22,245,164,219, 90, 52,224, 97,130,142,249,170,190,132,131,201,
+ 24, 12, 89, 64,234,156,130,159,169,109, 37, 85,108,251, 92,248, 82,  8, 62, 19, 81,121, 76,114, 94, 67, 85, 34, 36, 99, 21,246,
+ 49,243,127,141,171,212, 73,187,246,110, 86, 63, 58, 83, 16,  3, 57, 59,138,181,216,182, 98,114,154,233,123,117, 54,177,169, 31,
+ 62, 20,221,  3, 27, 42,203,227, 87,113,135,158,152, 70,156, 13, 88,223,224, 92,197,153, 64,157, 14,120, 83,145,172,135,146, 90,
+149,157,111,109,125,145, 26,181,226,177, 51,192,162,136, 64,158,200,162,135,182,222, 42,  7, 61, 52, 29, 88,195,226,232,132,211,
+155, 47,235, 52,101, 72, 96, 34,219,203, 11,253, 28,139,106,  5,167, 67,101, 29, 28, 25, 33, 17,233,252,  9,190,237,232, 28,152,
+ 14,218,118,  5,161,240,244,254, 67,221, 49, 74,101, 26, 70, 85,236, 82,233,108,162,159,138,  2, 56,156,144,115,166, 98,184,245,
+234,  9,143, 30,156,179, 27, 38, 37,128,121,121,209,157,173, 22, 66,117,164, 82,  8, 70,168, 88,198, 60, 42,144,103, 86, 77, 78,
+ 83,164,109, 60,227, 36, 88,163,234, 91,113,134,163,166,229,231, 63,253,  5,239,190,251, 29,154,106, 56,191,186,224,218,145,227,
+211,207,206,241,139,160, 15, 21,163, 35,198, 82, 43, 73,132, 96,132,102, 54, 72,229,106,105, 93,135,196,200,227,251, 23,156,156,
+174, 49,221,  9,157,207,148, 56,241,197,103,159,240,232,222, 87,172, 22, 39, 88,167,  7,213,208, 53,180, 33,208, 54,150,225, 80,
+216,246, 59,134,113,100,218, 31,168,222, 48, 13,137,108,116, 77,229,231,195,242,238,114, 75,206, 25,235,103,  6, 66, 99,177,  4,
+ 38, 23,104,157, 39,216,138,105, 91,172, 53,196,152, 72, 49,210, 87, 88, 52,170,  2, 29,199,129, 82, 10,195,161,103,213,174,184,
+241,210, 53, 14, 99, 36,111, 71,140,211, 92,139,128, 18,243,138,182, 86, 28,149, 49,141, 32,133, 38,120,154,176,  1,  3,195, 56,
+145, 43, 28,155,128,115, 94,  5, 50, 94,237,124,181,104, 65,212, 85,193,136,224,221, 18,227, 23,184,102,195,184,219,113,121,126,
+159,195,197, 67, 14,219, 39,152,214, 99,173, 87, 42, 26,170,215, 21,175,251,187,106,173, 94, 14, 18, 16, 58, 92, 51, 63, 63,130,
+161, 74,  3, 24, 92,209,113,174, 65,127,102,107,181, 24,231,230,198, 73, 68,100, 98,189, 56,225,222,179,129,255,229,223,125, 68,
+173,134,163,197,138,245,106,201,144, 18, 79, 30, 63,227,215, 95,126, 65,101,193,111,125,167,242,247,223,127,131, 39,143,246,252,
+217, 15,255,130,151,222,120, 13, 91,  3,210,  0,105,134,221,200,  2,159, 35,181, 38, 76,237,244,112,104,147, 66,149,166,204, 36,
+ 70,215,104,168,181,210, 20, 13,206,154,164, 42, 87,103, 13,185, 26,164, 36,214,109,161,151,202,161,168, 36,198,153,138, 13,  6,
+ 91,162, 62,203,170, 69,174, 18,214,154, 57,219,224,177, 50,145,140,199,209, 32, 38, 19,250, 45,  7, 28,213, 78,244, 56,237,105,
+205,207,214,241,188,176,238, 52,180, 76, 48,196, 92,241, 83, 33,172,192,210,210,217,191, 93,141,106,126,227,165,229,140,214,216,
+ 86,243,203,171,111,225,229,121, 63,253,178,  7, 57,105,249,242,158, 69, 44,180,213,240,222,155, 47,113,114,186,162,  7, 30,239,
+ 54, 52, 85, 48,193,209,199,204,184, 31,  8,109, 32, 98, 48,147, 32, 49,107,149,180,  8,210,143,138, 71,181,142, 40, 17,219, 15,
+ 24, 91,136,195,128,145, 74, 50,142,251,231, 61, 97, 55,105, 40,219, 24, 13, 99,163,239, 35,107, 43,141,179, 52,222, 81, 43, 44,
+ 27, 71,187,104,113,214, 50,101,161,177,149,197, 34,224,156,227, 50,102,118,151, 23,218,  4, 42,170, 27,254, 79,249,159,  2,212,
+ 49,146,178,190, 92, 73,137, 36,  5, 16,188, 43,228, 33,227,218,129,197,  8,161,104,181, 51,153,162,113, 51,241,212,162, 46,146,
+156, 61, 39,214,146,165,144, 76, 67,105, 50,213,  6,106, 74,216,208, 96,188,197,246, 66,204, 19,126, 81,169, 67,197, 78,130,105,
+243, 60,141, 76,216,149,133,232, 48,165, 34,109,229, 80, 10, 31,127,244, 25,241,233, 45,158, 61,249,  4, 17,193,235, 13,220,104,
+ 96,196,234, 75, 66, 94,220, 88,156,170,247,230,128, 87,170,122, 75,111,140,195,168,140, 82, 71,158, 70,125,230,214, 42, 78,177,
+154, 58,247,158, 13, 37, 11,174,153, 21,172,115, 80, 11, 99,230,219,106, 70,164, 18,188, 74, 89,172,204, 90, 87,163,100,150, 82,
+243, 76,181,155,199,238, 85, 11, 48, 22,247,141,223,155, 87, 38,124,142, 84, 49,208,232,148,  1, 81,227, 90,148,130, 49,  6,111,
+ 52, 15, 80, 69,215,  6,166, 90,114,141,202, 67,199,205,139, 23,171, 15, 26,167,171,132,113,202,248,224,102,151,122,209,191,182,
+250,200, 50, 50,191,188,139, 40,160,198, 86,160, 80,170,165,206, 98,  1, 93,  1, 40, 30, 54, 20, 79,232,244,167,170, 74,157,191,
+145,161,184, 74,142,  9,239,  2,194,146,118,115,157,253,213,151, 96, 58, 76,211, 33, 69,199,251,217, 36, 22,109,160,100, 40,117,
+196, 89, 40,232,206,191,177, 78,165,111,162, 55,236, 90,181,111,174,244, 93,165,216,  7, 44,213,233,105,215, 20, 51,247,148,133,
+108,122,114,169, 56, 31, 56, 94, 29,115,184,186, 36,214,172, 55,173, 12,169, 22,174,234,129,102, 95,168, 69,119,102, 67, 63, 40,
+125,203, 24, 82,172,132,206,207,112, 29, 29,193, 21, 50,206,122,138,133, 93, 26,  8,126,201,178, 89,113,232,207, 57, 90, 45,184,
+218, 79, 60,124,186, 69, 36,107, 11, 34, 21,106, 22,138,171,115,210,214, 18,131, 96, 37, 48,150,132,109,140,  6, 42, 75, 36, 35,
+196,164, 73, 23, 51,187,  0,168,208,  4,237, 60,187,198, 51,140,137,179,163, 83,238,124,122,193,191,249,227,127,207, 54, 85,190,
+245,247,222,224,226, 98,207,246,234, 48,211,  1,245,229,154,199,136,233, 44,110,209, 81,114,162, 90, 67,205,145,198,183, 28,157,
+ 28,115,180,106,232,199,130,245,154,103,166,107,169, 70,136,105, 75,220, 37, 50,130,223, 26,112,150,213,122,193,162, 57,193,153,
+150,233,240,148, 73, 70,210, 88, 20, 68,100,181,134, 25,163,208, 46,  3,199,203, 53,253, 48, 97,201,196,172,140,130,104,244, 65,
+145,197, 81, 98,198,  4, 85,122,230,113, 36, 77, 19, 75,115,132,179,186,200,144,152,232,199,137, 36,208,154,202,181,235, 55,152,
+ 30, 60, 96,187,123,138,169,142,213,122,205,205, 27,215,145, 82,185,186, 58,199,248,145,103, 23,145,110,217,226, 93, 71,104,151,
+224,170,106,104, 75,203, 36, 19,195,238,192,209,250,136,234, 43,105,212,138,161, 32,136,215,125,123, 75,128, 34,196,113,199,179,
+103,119,136,253, 51, 98,191,199, 59,171, 50,145,170, 36,189, 33,141,  4,239, 21,148, 82,117,  5, 85, 49, 52,120,166,156,216, 14,
+ 59, 22,169,193,181, 94,215, 31,214,171, 42,211,168,189,177,216, 12,121,206,173, 84,131,179,129,106, 43, 53, 71,162, 63, 32,193,
+210,231,204, 31,253,217, 47,248,233,175,238,112,251,205, 87,120,235,213,155,252,242,227, 47,232,115,100,179,186,203,191,254,159,
+ 62,227,159,255,227, 63,224,159,253,225,247,216, 14, 87,124,254,213, 83, 94, 57,187,206,231, 79,159,104,202,202, 26, 14,110,192,
+ 57,193, 69,133,107, 17, 42, 77,235, 73,201, 96,151,142, 90, 91,164, 10, 53, 69,196, 20,194, 98,137,243,158,202, 72,152,131,178,
+181, 24, 66,219,113, 96,164, 86,139, 55, 45,206, 10,217, 57,234, 60, 21, 60,148,  1,147,133, 54,180,  4,223,113,152, 18,181, 43,
+ 24,  9,172,130,103,148,145,198,121,170,201, 80,133,182,109,112,169,227,144, 71, 58,148,241,145,210,200,182,100, 22, 97, 65,189,
+180,248,205,  2,223, 24,236,228,136,222,112,255, 42,195, 81, 37, 78,153, 38, 70,236,217,138,224,225, 48, 63,159,218,206,129,  5,
+159, 53,203,132, 51, 47,158, 25,246, 27,142,211,154, 50,117, 78, 96, 47,154,192,201,178, 37,  0,199,128,217, 88,214,115,178, 98,
+183,  8, 12, 71,129,107,115,248,108,171, 86,105,150, 86,131,107,207,226, 10, 39,149,106, 33, 21,184,122,122,201,197,253,  7,100,
+163,181,221,245,233, 41,238,232,136, 44,134, 58, 37, 58, 99, 49,193,147,162, 96,210, 68, 33,209,151, 74, 47,  5, 91, 42, 59, 17,
+100, 27, 85,174, 85,133, 90,  4, 87,133, 49,167, 23,151, 54, 74, 70,128, 95,127,245,152,243,203, 61,139,101, 75,193, 17, 92,224,
+120,213,105,149,215, 25, 98,206, 44, 90,175, 43, 34,163,191,191,174,245,115,190,225,121, 34,252,235,205,126,173,232,212,215, 25,
+ 98,173,132, 81,139,212, 81, 70,188, 24, 38, 91,  9,  2,187,105,  7, 37, 83,140,224,219, 53, 69, 96, 55,237,105, 12,120,191, 34,
+199,137,166,243,140, 25,178,157,112,161, 69, 74,194, 86, 71,154,246,200,160,117,237, 54,104,170, 61, 97,152,196,226, 38,240,197,
+ 83,106,160, 92, 69, 48, 17,227,159, 33,180,132, 35,199,179,107, 27, 70,183,198,199,204, 33, 38,188, 48,215,199,204,108,168,154,
+103,251, 82, 43,209,184,121, 92,110,200, 34,170, 40,181, 78,137,254, 51, 49,184,136,158,122, 29, 50,215,225,148, 23,175,215,  4,
+ 93, 74,212, 57,144,245,252,135,212,200,204, 98, 55, 78, 79,179, 78, 41,106,224,245,133,110, 12, 66,193, 88, 52, 16, 39, 80,201,
+154,204,118,110, 30,213,171,164, 33,103,181,121,129,213, 27,138,209,111,210,130,210,  4, 92,177, 47, 14, 19,  2, 42,104, 40,134,
+138,130, 21,168,162,166, 40,235,212, 98,102,244,100,168,141,116,175, 39, 98,107,112, 86,253,201,206,185,185,250, 45,136,119,212,
+108,200,197,128,171,200, 28,148,107, 90, 67, 78,122,250,180, 86, 15, 30,206, 84,178, 81, 58,154, 21, 53,119, 57,241,228,164, 82,
+ 22,239, 42,147, 52,236,174,158,176, 29,158,178, 88, 46,240,181,165, 11, 51, 52,198, 54,148,  0, 98, 43, 55,150, 11, 46,246, 79,
+216,165,137,205,250,136,245,122, 67,153, 70,236,120, 32,102,153,119,147,105,134, 15,120,124,240, 56, 31,104, 44,148, 89,162, 44,
+ 81, 40, 34,  4,223,128, 15,172, 54, 43,134,237, 57,211, 52,225,219,142,105, 42,115, 61,177, 98,163,238,143,210,152, 89, 44,  1,
+171,  4, 62, 42, 24, 39, 80, 53,205,190, 92,157,178, 58, 57, 33,197,158,241,208, 83,162,193,216,150,176, 80, 27, 94,183, 90, 96,
+ 75, 36,197,196,209,170,163,235,214,236, 15,151,216, 70, 52,153, 42,154,161,176, 14, 36, 22, 77, 71, 91, 75, 73,149, 82, 39,170,
+204,146,156,172, 31,121,176,  1,114, 34,138,161,100, 75,215,120,142,218,150,123,251,200,131, 71, 15,  9,203,202, 85, 31, 56, 59,
+187,197,135,191,253, 62, 95,126,113,159,255,227,255,254, 33, 67, 63,205,244,192,164,225, 71,235,112, 52, 76, 53,170, 12,199, 26,
+144,196, 43,175,189,202, 43,175,223,230, 87, 63,253, 49,103,103,175,114,243,214,235,124,252,243,143,216,110, 31, 67,  8,108, 78,
+174, 19, 69,216, 93, 92,112,254,228, 17,235,147, 99, 94,189,190,193,212, 72,117, 70,189,234, 84,188,115, 76,113,210,252,132,241,
+184, 73,232,107,164, 31, 14, 72,213,188,135,161, 98,141, 35,116, 14, 17,157,108,184, 90, 21,106, 98, 19,203, 69,131, 55, 48,142,
+ 35, 82,149,237,141, 36,114,156,184, 24,119,252,201,159, 60,210, 85,151,247,100, 73,236,250, 43,222,222,188,206,186, 61,225,104,
+  5,223,255,246,134, 63,249,217, 21,143,158, 29, 48,165,224, 27, 59,175, 63,230, 22, 72,134, 33, 78,152,253, 21,174,  9,  4,223,
+ 97,179,  6, 74, 69, 34,140,202,166, 31,166,  3,231,219, 61, 57, 31,232,108,160, 86,171,  4, 72, 99,177, 53, 83,170,197, 89, 63,
+131,193,245, 25, 97, 45,228, 44, 76, 85, 25,  8,182, 84, 98,142,116,193,178, 89,174,153,198,137,195, 52,226,157,218,221,164,102,
+170,  3,111, 23,154, 74,167, 34,174,197,251, 70, 67,156,249,128,136,176,221, 78, 92, 94,142,124,113,247,130,191,104,126,197, 36,
+142,155,175, 28,243,213,103, 15,120,250,108,207,221,119,223,224,214,173, 83,254,224,251,191,197,253, 47,255,152,103,231,119, 56,
+ 91,159,241,236, 98,192, 74, 98, 81, 13,169,120,106,227,176, 49,232, 84, 35, 86,188, 15, 16, 39, 36,136,138,157, 66,197,136, 39,
+149, 72,138,  3,221,162,165, 24,193,196, 22,108,102, 28,244,246,218,181,  6,153,132,128, 78,202,172, 47, 12, 67,130,234,112, 71,
+ 75,109,154,148,138, 95,120,186, 77, 75,154, 42, 83,204, 52,193, 83,147,103,139,197,214,137,236, 60, 99, 61, 16,130,163,164,168,
+249, 23,107,201, 86,152,124, 97,221, 90, 66,152, 33, 93, 41,115,220, 29,243,234,237,151, 56,221, 24,238, 15,158,135, 59,195,179,
+ 90,113,197,144, 46, 19,140,145,205,233,138,206,194,238,114,192, 53, 13, 97,165,153,135, 97,183,103,187, 10,172, 59, 79,113,134,
+195,197, 14, 91, 38, 74,204, 52,139, 64,248,134, 73,237, 55,251,236,207, 33, 52, 14, 56, 49, 95, 99, 87, 27,192, 54,176, 80,231,
+ 38,  5,248,229,188, 38,148,156, 41,222,241,202,171,103,188,116,188, 33,  1, 79,179, 78, 15,156,211,250,218,118, 16, 85,242, 58,
+ 67,202, 66, 25, 35,214, 58,140,181, 20,169,164, 49, 66,133,156, 43,109, 41,212,233,128, 25, 70, 14,211, 78, 51, 76,206,242,116,
+210,128, 90, 77,218,176,192,239,176,181,206, 85,223,140,  7,130,181,196, 82,144, 82, 89, 45,155,153, 36, 42,148, 92,241, 54,177,
+ 88,119,184, 10, 87, 83,225,201,211, 11,166, 62,225, 99, 33,251,192, 48,238, 16, 19, 73,217,210, 24,199,148, 28,185, 89, 66, 25,
+ 49, 37, 99,178,197,230,129,182,201,228, 62,211,218, 74,148, 29, 82,215,164, 73, 43,113,245,144,112,173, 90, 30, 73, 30,215, 84,
+ 38, 91,145,164, 33,110,124,165, 74,196, 20,143, 24, 75, 44, 19,222, 23,106,234, 40,102, 66,226,200,153,179,188,252,214, 53,238,
+197, 21, 61, 19,213, 56, 60, 50,199,133,172, 80,213,187, 58,  7,221,132,156,235, 92, 11,208,189, 59, 70,117,172, 50,195,115,109,
+117, 32,149,130,222, 74,109,169, 51, 95,122, 70,  8, 82,102,154,155,  2, 47,220,204, 22, 87, 75,154,211, 32,153, 49, 96,  4,107,
+ 27,173,145,155,170,117, 44, 83,177, 98,212,202,102,173,210,234,170,210,238,140,177,196, 28,177, 24,149,203,168, 98,125, 54,199,
+169, 96,198,184, 58,215,125,244,252, 33, 70,111,163, 38,100,204,188,171,179,222, 80,196, 35, 58,225, 39,  4, 75,197,106,255,221,
+ 27,220,243,145,108, 17, 26,111, 41, 20, 13, 46,165,  2, 78, 79,156, 98,116,119,228,103,119,175,169,122,216, 48, 54, 41, 48,164,
+ 26,188, 17, 29,215,100,171, 72, 83,  3, 77,  1,124, 80, 81, 78, 22,114, 29, 73, 57,233,205,165, 91, 98, 29,152, 52, 34,214,129,
+  4,166,105,162,154, 68, 17,161,217,156,113,249,213,  5, 15, 31, 61,229,178,235,240,161,211,155,145, 49,  4,223,224,155,150,211,
+211,155,148,152, 24,135,131,  6,223,130, 83,227,155, 13, 20,111, 72,174,210, 86, 67, 76,  9,153,  6,204,122,161,  7,180, 82, 84,
+224, 18,156,  6, 26,173, 78, 94, 92,240,  8,133,126,119, 78,108, 26, 93, 13, 52,142, 38,168,188, 71,114,101,181,217,112,118,186,
+225,242, 65, 15, 65,237, 97,166, 22, 66, 73,236, 14,123,198, 52,210, 20,104,188,163, 84,195,229, 56,205, 97, 72,165,148,121,235,
+ 53,209, 41,224,172, 86,243,158, 19, 12,173,204, 88,220,162,193,160, 96, 45,161,113,140,212,153, 71,144, 57, 58, 59,229,144, 44,
+219,221, 72,173,240,236, 28,250, 67, 98,189,218,240,229, 87,143,248,241,143,126,202, 97,119,  0, 11, 83, 41, 56,  2, 50,155,238,
+ 98,218, 83, 98,196,186,134, 73, 42,139,206, 99,156,229,147,143,127,201,205,151,223,228, 59,223,253, 62,126,225,120,250,248,  9,
+103, 71, 55, 88, 28,117,124,240,221,239,177, 61, 63,240,249,199,127,205,110, 24,160, 86, 46,206,239,  3,142,105,154,136, 83, 84,
+170,159,211,100,112,170,  5, 67, 38, 77, 21, 41,154,189, 16,165, 47, 97,124,214, 17,123,  4, 35,149,156, 51,165,100,130, 51,116,
+ 75, 71,183, 88, 98,171, 48,148, 76,154,132,126,232, 25,198,253, 92, 47,115,132,160,159,191,136,193, 53,134, 24, 35, 15, 31, 94,
+240,206,235, 39,164,210,176, 92,182,252,243, 63,252,125,254,183,127,247, 11, 30, 63,122,160, 65, 84, 59, 35,115, 49,220, 56,125,
+153, 49, 30, 40, 49,145,147, 33,215,  9,147,210, 60,141,211,157,252,249,112, 69,154, 84,  3,233,189,215,160,172,241, 58, 61, 74,
+ 17,231, 53, 37, 43,243,193,218, 25,117,127, 23, 41,243, 65, 94, 19,216, 21,131,169,158,113,200,108, 26,104,187,  5,209, 36,210,
+ 52,225, 77,131, 21,167, 98, 27,139, 98,150,189, 99,121,116, 74,231, 87, 76,211, 78, 95,162,250, 95,210,182, 58,129, 58,136,134,
+143,238,222, 59,231,193,253,103,120, 10,255,253,191,254,183,252,159,127,250, 19,190,117,251, 77, 86, 11,199,163,203,158,183,143,
+ 95,226,144, 87,148,105, 75, 73,149,138, 39,197, 68,181,  9, 71, 71,202, 35,190,142, 26,240,155, 34,141,247, 24,103,168,  4, 76,
+ 30,105,131,131, 40,202,139,159, 49,162,109, 99, 89,  5,203, 32, 19,214,173,144, 80,177, 11, 37,169,120,231,105,124, 67,204, 90,
+157, 28, 67,131, 11, 13, 38,170,127,189,202,156,  3,106, 43,126, 44,224,143, 40,195,158, 98, 60, 49, 39, 76,151,176,102,129,115,
+ 94,229, 86, 35,244,214,178,114, 66, 29, 60,178,180,116, 77,224,149,101, 32, 24,184,222, 25,150,141,231,196, 43,254,244,178, 52,
+176, 14,200,198,178, 43, 80, 83,199,241, 70, 39, 64, 87,  2,231, 91,207,238, 42,209,244, 21,201, 19, 87,151,231, 20,137,140, 41,
+147, 75,225, 98, 55,209,110, 90, 74,130,126,156,216, 44, 60,222, 26,246,177,176,112,118,166,178,252,191,129, 54,205,111,252,125,
+141, 25, 43,  5,231, 29,161, 11,156,180, 13,205,252,207, 57,175,  7,134,231, 27,243,110,105,105,105,105,102,138,221,246,184,227,
+236, 27,166,183, 67, 93,178,156, 47,212, 61,240,232,233,134,243, 59, 95, 34, 86,240, 22,142, 94,186,137,217,156,104,198,106,200,
+122,250,  9, 26,  2, 54,227,115,198, 64,161,148,164, 24,238, 56,114,153, 29, 53,101,144,136,175,149,113,154,152,238, 95,144, 37,
+235,116, 50, 79,108,183,  3, 54, 11,198,  8,146, 50, 18, 26,170,139,228,201, 82,137, 44,  3, 28,166,130, 47, 29, 83, 19,149,254,
+153, 26,172,131,125,156, 48,174,101,127, 56,103, 40,158, 58, 78, 24,  2,185, 47,186,202,113,142, 88, 34, 34,137,130, 99,100, 67,
+ 93, 78,216, 82,144,201, 82, 91,131, 59, 36, 36, 27,240,153,152, 33,229,  3, 86, 54,  4,183, 70, 98, 70, 38, 33,198, 17,143,247,
+122,178,192,145,171,254,240, 41,180,223,226,189, 94,246,124, 53,218, 35,157,249,192,169,228, 23, 99,  9,227, 45,118,126, 25, 40,
+253,209,234,203, 84, 12,214,169,140, 69,106, 81,143,121, 53,216, 16, 48, 98,230,186, 89, 81,213,170, 85, 89,140, 41,243, 45,237,
+185,252,  4,135,216,168, 55,110,  9, 90,133,171, 21, 51,235, 87, 67,103,168,197,169, 15,222,168, 62,179, 86,173,209,132, 10, 41,
+231, 57, 21,222, 48,214,164,123,231,168, 52, 60, 49,  6,147,237, 60,154,215, 67,140,100, 48,182,224,131,199, 59,136, 89,247,194,
+214,235, 14,191, 58, 75, 41,162,226,131, 10, 50, 10, 33, 24,156,171, 68,129,234, 29, 34, 66,137, 19, 93,104,  8,115, 53, 39,249,
+249,235,117, 40,  4,239, 72,214,144,171,176, 40,137,146, 10, 38, 24,114,174, 60,188,247, 41,175,190,115,202,122,125,157,169,223,
+ 99, 91, 77,153, 22,209,244,237, 52,  8, 71,171, 13, 67,220,242,236,106,135,181,158,148, 53,248,101,202,124, 10,157,121,  1,207,
+158, 62,196,121,199,234,232, 38, 55,207,174, 67,217, 19, 92,203,194,105, 44,118,108, 20, 76, 83,140,208, 45, 20,209, 58, 28,118,
+228, 90, 33,103,220,188,203, 52, 34, 52,221,  2,170,182, 22, 98,140,136,101, 14,152, 25,210, 52,106,110,162, 86, 26, 23,200,219,
+ 81,251,226,193, 97,170,161,144,145,  0, 77, 52,196,170,139, 20, 39,149, 60, 36,198,148,113,214,145,139,161,198, 66,105, 10,165,
+ 56, 82,137,152,160,105,124, 11, 20, 87,112, 34,148,164, 16,153, 82, 51, 71,221,  2,103, 29,216,136, 51, 21,111, 61,215,175, 95,
+231,226,124,135,100,161,  9,134, 59,247, 30,112,216,238,153,178,240,179, 95,126,196,211, 39, 79,  9, 78,199,215,214,232,104,217,
+ 59, 71, 27, 90,114,140,184, 82,104,215,158,161,143, 88,239,184,247,249, 39, 12, 83, 36, 95,236,168, 99,130,101,195,131, 71,119,
+240,  4, 94, 59,126,139,199, 15, 30, 48,197,196,122,185,226,232,104, 73,201, 25,113,134,169, 31,200, 89, 27, 24, 38,170, 62,184,
+ 82,200,169, 16,154,150, 97,156, 88,110,  2, 47,191,118,141, 60, 21,190,248,236, 19, 98, 17, 66,235, 40, 73,237,131,213, 24, 82,
+201,212, 98,153,162,176,219,238, 88,175, 50,226, 13, 54,107, 32,211,134,  5, 93,227,145,108,181,246, 34, 26, 42,147,249,214,127,
+117,249,140,225,149,215, 89,118,215,249,226,193, 21, 63,248, 48,209, 54, 58,117, 11,141,199, 54,  6,107, 61,203,229,146, 91, 55,
+ 94,231,209,147,251,108, 47, 47,200,185,208, 31, 70, 98, 63,168,113,111,177,152, 81,197,  5,113,  6, 95, 28, 38, 87,  6,147, 48,
+ 70, 56, 57, 58,229,228,250, 45,238, 62,184, 79,141,232,106,199,206, 45, 10, 84,171,106,172,135, 34,243, 74, 77,215, 93, 21, 97,
+ 59,238,216, 44,215,116,190,163, 12, 35, 80,  9,206, 17, 69, 25,237, 77,187,164, 89, 30,227, 67, 71,191,219, 18,199, 43, 68, 10,
+214, 84,226,172,138,246,115,250,217,184,231, 13, 28,133,178,220,185,127,201,221,199,123,254,226,163,207, 56, 93, 29,241,210,245,
+ 19,124, 87, 57, 59,109,120,112, 95,215, 82,206,103,186, 84,233, 83,162,184, 68, 87, 85,138, 66, 87,169,163, 85,247,247, 60,  5,
+116, 33, 96,173, 97, 74, 74,187,116,193,106,144, 49, 87,114,110,176, 38,224, 27,163,177,225,209,144,197,226,140, 71,170, 96, 74,
+135, 53,133,148,244,230, 53,182,  3,221,216,232,203,165,  1, 41,158,174, 49, 24, 41,140, 69, 48,181,199, 20,  8,245,152,214,130,
+ 35, 48,150, 72,227, 27, 76, 22,170, 19,228,144,240,213,209,189, 26,120,158, 13,139, 73,159,209,155, 89, 19,125,153, 43,171,133,
+ 62, 63, 14,192, 50, 88, 94,153,171, 91,199, 64, 58,235,104, 58,117,203,212,190,129, 39,231, 28,178,126, 29,253,178,129, 77,195,
+193,194, 37, 48,137,225, 73, 54,164, 92,113,187,204,170,115,236,130,230,161,198,109,225,164,181,180,173, 30,192,135,177,176, 90,
+232,215, 39,  2, 83,127, 96,200, 25,201,153, 53,134, 96,237,223,200,  0,152,223, 32,220, 53,243,175,181, 51,202, 54,124, 35,212,
+182,252, 70,129,125, 13,140,193,241, 76, 12,198, 27, 58,215,240,222,235,215,105,218, 64, 69,211,255, 94,148, 87, 95, 42,244, 69,
+101, 60, 56,200,165,146,146, 48,236, 38, 92,215, 80,196,144,106, 38, 93,246,184,105,160,171,149, 60, 38,232,175,104,154,158,243,
+ 93,161, 68, 37,134,182,182, 97, 26, 51,181,115,200, 48, 80,171, 78, 17, 91,239,152,106, 34, 30, 70,164,105,113,165,193,155,137,
+ 90, 45,212,194, 97,159, 48,121,160,109, 59,198, 24,201,181,210, 82,161,140,250,125,231,150,136, 76,152,216,235,202,122,206,165,
+229, 49,106, 79,205,130, 15, 25, 87, 42,213, 46, 56, 57, 57,162,203, 32,105, 55,187, 85, 10,190,166, 57, 94,255,220,186,230,173,
+122,207,171,193,104,174,234,185,128,117,246,170,204,100,117, 83, 49,166,144,147,198,217, 77,208, 20,185,153, 15,  6, 98,  2,198,
+ 54, 32,170, 85,172,243, 92,220, 24,163,251,231, 58,143, 69,130,222,222, 21,253, 10,217,152,231,155, 12,  4,193,185, 70, 81,152,
+186,216,192,136,130,237,149,  2,103, 16,171,129,183,231,128,193, 96,225,  5, 60, 78,147,116, 84, 91,104, 69,147,244, 82,235,140,
+ 66,172,170,145, 21, 53, 57, 37,141,187,206,  7,131,185, 59,110,102,170, 15, 85, 51,  3,206, 18,208, 91, 98,181, 66, 42, 90,205,
+114,193, 97,242,156,166, 55,250,117, 44, 82,177,193, 82, 74,213,177,158,  5,231, 60,177, 36,133, 69, 24, 71,246,218, 20, 48,174,
+193, 27,139,228,129,187,119,191,224,157,183,190,205,194,180,180,139, 64, 88, 54, 28, 46, 46,233, 92, 75,235, 15,184, 50,113,245,
+236, 25,187,253, 78,111, 43,179,228,198, 91, 59, 91,162,244,192,145,166,137,126, 72,172,142,111,210,110,142,136,227,172,128, 93,
+122, 76,174,172,138,144,108, 34,224, 89,173,142,120,251,229,107,220,249,228,231, 84,227,181,198, 49,244,186, 27,178, 65,247,243,
+117,161,255, 95, 62,208, 45, 55,234,  7,240, 30, 95, 97,191,155,193, 38,206,114, 57,142, 36, 17, 29,107,137,142,200, 93,123,204,
+123,223,126, 19, 83, 96, 63,246, 76,135, 61,249,160,183,130,219, 31,188,206,209,209,138, 31,253,249, 79,120,252,240, 41, 47,191,
+124,202,230,116,205,254,114,164,228, 68,140,137,126,223, 51,149,202,148, 11,113,154, 88,117,158,174,105,233,211, 56, 27,  4,161,
+ 91, 44,248,214,219,111,242,127, 61,248, 41, 69,224,201,179,145, 39,207,118,228, 60,241,249, 39, 95, 17,251,145,214,251,185,179,
+170,211,  5,107, 44, 97,177,164,  6, 71,156, 34,  1, 59, 31,236, 12, 38, 23, 82,170,220,126,253, 45,142,215, 39,148, 42, 60,252,
+252, 14,183,223,122, 27,113,137,187,159,254,  7, 62,254,197, 30,231,130,174,113, 74, 38,204,107,153, 49, 38,189,245, 27,207,192,
+220, 47, 77,145,229,170, 99,181, 92, 99, 37,115,235,221,219,188,113,251, 13,188, 52,156, 30, 45,248,203,159,252,148, 52,150,121,
+ 90,161, 15,172, 96,245,179,200,104,179,224,176,239,213,101,237,252,204, 78,247,148, 25, 36, 81,179, 98, 50,155,198,115,124,124,
+157, 87,111,191,193,189,175, 62, 97,215, 63,225,253,219,239,242,248,217,129,253,249, 21,175,189,124,202,103,119,238,226, 60, 52,
+190,161, 90,195, 56,236,248,232,227,159, 65,206, 88, 35, 28,134,194,217,201,138,127,242,207,126,192,143,126,252, 43,238, 62, 73,
+172, 86, 11,188, 85,157,239, 56,238, 53,131,177,120,137, 55,222,120,149, 91,175,191, 69,  4, 46, 46, 47,184,232, 47,180,219,155,
+161,144,180,122,105, 85,249,154,156, 18, 41, 77, 97,158,200, 84,198, 24,113,236, 89, 46,214, 44,150, 29, 37, 38,181, 53,186, 66,
+215,116, 44, 55, 39,148,106,216, 30,158,146,251,  3,214,184,249,198, 38, 24,201,244,  7,  8,205,188, 38, 20,176,  2,222,169,120,
+198, 89, 75,168,138,183,221,110, 15,140, 83,230,141,151,143,121,247,237,119,120,242,224, 74,177,190, 85,136,146,  0,135,199,131,
+215,167,157,137,158, 96, 60,153,  1,146,163,161, 50,153, 66, 44,133, 22,253, 92,240,  6, 95, 51, 83,103, 95,212,241,166,169,195,
+212,130,  4, 37,164, 52,203, 64, 78, 66,176,122,177,169,174, 98, 90,161,164,202,193, 68,157,128,229,145,146, 38,106,211,210,132,
+137,246,108,205,164,215,106, 82,217,171,216, 41,247,212,102, 69,173,  6,147, 38,250,125,197,187,  6, 95,132, 80,103,152,143,213,
+233,143,117,240, 12,195,121, 69,235, 80,235,128,199,208, 72,197,203,215, 53,178, 94,244, 89,233, 23, 26,154,219, 75, 97, 28,122,
+164, 86, 58,223,177,234, 22,156,206,189,115,211,130,109, 26, 78, 28,108,129,167,171,  5, 55, 29,  4,171, 35,243, 97,109, 73,214,
+208, 91,216, 71,168,201,208,181,134, 84, 97,234, 43,233, 50,146,179,  6, 54, 75, 20,206, 47,  7, 78, 79, 52, 92,157, 83, 97,181,
+112,179,182, 23,130,232, 69,239,155, 47,249,191,155,251, 46, 72, 42,148,177,210, 93, 91,176,249, 70,  9,254,229,111, 50, 97, 13,
+ 28,207,238,121,243, 66,233,234,200,199,129,229,115,180, 45,129, 71, 39, 11,130,213,  3,227,174,192,227,175,174,216,125,250, 43,
+ 76, 81,135, 70, 63,141, 88,163,161,199,233,208, 99, 83, 70, 74, 98,155, 12,206,137, 74,180,178,165,173,153,146,174, 52,171,225,
+ 45,165, 55, 72,244,212, 38, 33,206, 81,203,  4,182,165,250,150, 82, 38,156, 24,176, 29,198, 10, 57,143, 32, 29, 86, 77, 13,164,
+ 49, 35, 82,232,130, 35,143, 78, 65, 97,206,240,171, 59,231,236,255,135,255,157, 75,  2,110,  0,169,215,240, 69, 34,118, 38,138,
+  9,  6, 51, 91, 85,202, 60, 84, 41, 69,199,227,102,222,161,214, 44, 90,109,211,121,247,204, 69,127,142,125,  4,193, 98,130,193,
+198, 74,169,250,250,244, 86,193, 51, 25,189,157, 75, 21,172,168,158, 53, 75,153,107,104,110,254,226,103, 61, 73,212,217,102, 46,
+115,186,156,172,234, 86, 99, 84, 31, 89,209, 96,156, 17,144,130,181,102, 78,221,234,173, 63, 43,200, 29, 35,133,130,193,123, 13,
+  0,138,209,125,186,173,122,108, 72,243,175,233,152,244,121,216,175,104,213,205,155,121,223,170, 20, 44,221, 65,122, 98, 17, 26,
+ 23,240, 77, 37, 71, 29,  9, 25,163,182,164,234,212, 46, 23, 83,196, 22, 59,123,213,117,117, 80,157,193,207, 35, 95,243, 60,220,
+234,117,135,234, 76,203,235,175,191,202,231,119,238,113, 56,188,198,233,217, 53, 98,191,195, 75,199,162, 91, 17,115,194,118, 13,
+139,124,197,189,123, 59,114, 18,156,215,138, 95,209, 20,131, 30,168,230,219,176,118,246, 61,155,213,134,  6,139, 52,158,118,213,
+ 96,170,  2, 72,130, 53, 72,234, 89, 57, 79,160, 98,107, 34, 22,157, 82,136,  8,185, 10, 37,103,109, 45,148,204, 20,123,253, 67,
+196,204,212, 15,180, 93, 32,103,149,217, 84,235,112,214,178,234, 54,156,157,157,112,137, 78,110, 48,130, 53, 30, 87, 11, 79,174,
+182,172,221, 17, 77,187,102,181, 88,209,189,220, 98,172,165,219, 24,228, 16,249,193,135,191,139,  9,158,235, 71, 43,214, 55,142,
+217, 93,142, 24, 34,113,140,244,211,200,238, 48,114,249,244, 41,219,195,158,243,135,119,169, 89,173,129,214, 88,240,142,183,190,
+245, 14, 77,215,145,178,165, 31, 70,126,253,217, 35,174,246, 59, 14,253,150, 24, 11,214, 55,179, 55,125, 14,188, 89, 93,  2,182,
+141,195, 91, 24,147, 32,139,142, 41,103, 86,190,225,218,245,235,124,231,251, 31,178,123,114,197,227,  7,119,213, 82, 88, 39,202,
+ 84,248,157, 63,248,125,222,126,251,187,124,244,211, 31,243,224,203,207,192,168, 59,185, 11,150,125,223,147, 69,205,102,146, 19,
+ 18, 19,135,254,192,230,104,201,135,191,243,219,156,157,157,129, 20, 90, 23, 48,162, 45,137, 15,190,247,219,152,245,154,143,254,
+242, 39,244,135, 81,  9,123,162, 21, 52, 99,244,175,141,115,138, 44, 14, 26,162, 19, 10, 62,  4,  4,253,217,189,113,114,202,107,
+175,190,194, 75, 55, 95, 99,185,217,176, 12,  1, 91,180,239,223,191, 54,224,186,  5,159,127,245,132,215,175,223,102,213, 46, 41,
+185,178, 29,175,152,198, 68, 49,133,166,  9,180,182, 99,113,180, 65, 56,240,218,203, 55,248, 23,255,213,127,129,111,225,243,255,
+241,167,172,151, 71,228, 26,233,150, 75,126,235,195,239,227,214, 11, 90,183,100,233,  2, 77,163,134,193, 55,223,124,143,171,243,
+ 31, 34, 57,227,108, 75,178,133,198,  7, 13,223, 58,161, 21, 75, 65, 31,236,198, 88,188, 81, 92,242,144, 10,193,102, 92, 23, 72,
+ 26, 68, 96,181,184,193, 98,121,194, 97,188,162, 76,  7, 82, 63,234,234, 75,228,107, 81,209,252,115,249,124, 77, 40,165,146,141,
+ 33,203,136, 23,139,119, 13, 83,  5, 59, 39,250, 15,195,200, 87,119,182,124,247,219,149,211,117,199,253,167,207, 52, 48, 73,131,
+177,122,  8, 77,136,  6,101,171, 80,219, 57, 15,147, 60,253,116,208, 80,157,109, 40,157,163,179,  6, 51,194,224,  5, 91, 33, 89,
+ 75,231, 61,251,113, 84,126, 67,  9, 44,187,134,148, 34,141,  3, 92,102, 18, 15,165,161,198,  3, 54,235,100, 20, 83,  9, 93,192,
+174, 13,101,128, 92, 61, 38, 22, 93, 59,186,138, 23,205, 42,237, 99,131,235,  2, 14,135,152, 37,101, 42,212, 32, 56,239,120,182,
+189,226,227,207, 31, 19,154, 21,207, 46, 46,113,109,195,242,120, 67,172,133,254,106, 75, 91, 55,132, 46, 48,246, 19,173, 49, 60,
+ 47,188, 73,213,155,111,154,199,231, 41, 38, 74,138,100,209,166,139,107,190,238,129, 95, 22, 56, 65, 43,212, 30,  8,  2, 43,255,
+117,186,126,221, 26,110,204, 87,171,243,165,118,194,158,247,193,159,181,134, 95,220,235,104,140,182, 25,194,178,225, 73,183,224,
+ 66, 12,142,138, 75,112,210, 64,231, 97, 42, 48, 30, 10,155,149, 37, 56,203, 56,  9, 18, 11,155, 77, 96,182,113,107,139,228, 27,
+144,155, 20, 35,212, 76,245,133,229,194,254,157,140, 88,243,183,212,217,252, 55,114,  2, 11,224, 86,203,243, 99,155, 94,100,174,
+173,121,242,105, 75, 26, 35, 78,  2, 83,222, 51,153, 72, 77,144,226,132,175, 75,192,176,236,132,152,123,100,128,214, 44,169,229,
+ 64, 53, 45, 67, 26, 41, 46,225,109, 71,179,246,148,  4, 83, 26, 20, 57, 92, 11,102,172,148, 98, 17, 95, 49,249, 74,243,  3, 85,
+167, 47,209, 25,124, 54,106,237,100, 32,138,182,237, 13, 66, 83, 13, 95, 92, 28,184,243, 87,119,104, 76,207, 27,175,157,233, 84,
+171,214, 58,223,195,231,  0, 97,169, 51, 72, 70,193, 17,182,206,163,112, 91,103,151,178, 82,230, 44,134, 84,100,102,191, 91, 36,
+101,213, 84,204,169,107,230, 36,175, 65, 73,116, 20, 75,205, 19,198,122, 13, 34,205,165, 74, 91, 44,213,107,229,205,160,190,114,
+ 85,186,206, 19,  0,163, 72, 85,102, 76,136,173, 22,201,133, 16,180, 79, 91,107,197, 27, 79,117,149, 34, 21, 17,139, 55,142, 98,
+202, 92,230,215, 91,115, 49,250,178,107,141,165, 24,139, 17,193, 20, 77,219,106,152,195,227,157, 82,219,244, 97, 57, 75,102,188,
+165, 68,  8,157,213,127, 87, 81, 55,124, 45,234,127,182,179,111,222, 27, 75,156,247,207, 82,138,142,231,106,213,180,172,179,148,
+ 25,225,105,157, 42,105,253,156,176,172,200, 44,159,201,216,224,121,235,214, 25,247, 30,254,138,163,213,111,227,221,130,188,159,
+152,134, 75,134, 60,210, 46, 12,173, 77, 92, 92, 94,206,252,226,231, 99,100, 93, 31, 24,163, 10, 90,106,165, 22,131, 15, 13, 16,
+  8,141, 69, 14,208,228,249, 27,194, 10,165,241, 56,177,212, 98,249,173,111,127,151,171,243, 59, 76, 99,194, 89, 75, 44, 66, 46,
+ 69, 43,140,190, 97,181, 58, 34,229,145, 20, 39,140,169,164,212,147,147,197,206, 19,155, 54,104,132,230,206,221,207,121,122,222,
+210,120,199,245,211, 99,182,251,158,102,113,198,247,254,254,239,146, 77,100,187,223,209, 95, 93,240,120,215,107, 47,159, 17, 41,
+130, 21, 33,180, 29,103,215,110, 16, 39,224,201,136, 12,  3,110,181,162,  9, 29,116,134, 27,199, 27,222,187,245, 38,171,227,142,
+191,254,171,159,113,247,206, 93,174,250, 61,211, 52,114,118,237,  6,239,127,251, 45, 62,253,228, 62, 34,153,195, 40,220,121,240,
+144, 88, 70, 36, 39, 22,139, 35, 36,171,139,222, 86, 33, 75, 81,200,137,  1,211,122,165,250,145, 89,122, 85,254, 38,147,184,254,
+202, 43, 60,184,251,128,187,159,126,194, 98,179,226,123,223,253,144,227,179, 51,198,237,196,163,123,119,184,127,255,115,190,253,
+238,251,200,238,138,187,207,158, 32,113,164, 79,115, 90,124,230,140, 99, 42, 82, 34,103, 39, 27, 62,252,189,223,225,230, 75, 55,
+ 48,165,146,104,180,206, 40,218, 79,150,100,120,231,214,155,156, 28,159,240,232,225, 51,126,245,227, 31, 51,164, 17,177, 42, 27,
+122,158, 34, 52,117,102, 74, 80,231,240,165,186,203, 91,187,224,173,183,222,227,253, 15, 62, 32,203, 72, 38,211,199,204,141, 55,
+222,226,179,175, 62,229,114,187,229,229,235,175,176, 27,133,111, 95,155,248,224,253, 55,249,171,191,254,132,195, 94, 39, 13,139,
+197,138,206,  7,154,174,197,225,  9, 77,199,249, 46,243,236,201,192,  7,239,189,199, 34,252, 25,125,127, 78, 51, 59,231, 99,108,
+121,213,111,168, 33, 83,114,196, 73, 67,168,153,215,222,122, 23,131,229, 23, 31,253,152, 24, 39,156, 88,205, 85, 88,125,104,196,
+ 82,192, 20,170, 24,154,224,230,166,129,138,149,118,211,158,224, 58, 68, 60, 77,227,233, 66,199, 48, 30, 24,251, 11,242,164,104,
+221, 44,149, 96, 50,182, 86,245, 68, 56,143,179, 22, 59,135,103, 73,117,246, 76, 23,178,171, 26, 74,117,  6, 68, 15,159,141,107,
+184,255,228, 25,159,223,185,199,217,201, 17,143,118,129, 58, 65,176, 69,167, 51,226, 73, 18,117,133,103, 42, 62, 42,  3, 62, 51,
+225,237, 66,205,107,141,135,160,159, 51,174, 98,109,160,193,145,108,166, 24, 71,231, 90,162, 76, 24,201, 76, 51, 81,178,105, 44,
+185, 36,178,129,154,213, 58, 41, 73,159, 97, 54, 88,166, 52, 96, 75,192,165, 22,150, 13,102, 42,248, 88, 25,131,208,181,150, 69,
+ 13,140, 43,149,185,148, 54,225, 59, 71,119, 48,179,231,194,176,104, 90,226,209,154,193,122,226,206, 19,142,143,216,173, 61,117,
+ 15,206, 44, 25,125,199,101,132, 56, 56,182,219, 75,134, 81, 45,120,151,253, 64,205, 61,167,103, 27,178,129,254,226, 10, 72, 12,
+162,158,137,165,255,  6,  7, 93,163, 33,  0, 92, 61,127,185,126,163, 39,158, 51,152,249,159, 31, 43,172,191, 33, 90,247,117,102,
+ 87,152, 66, 54,137,110,179,224,157,163,192,  2,157, 40,132,206,113,242,141, 94,125,119,228,191, 86,189,206, 67,196,111,  0,  0,
+ 32,  0, 73, 68, 65, 84,  6, 75,177,134,105,126, 33,231,153, 19,182,156, 47,224,187, 65,184,188,184,132, 44,152,226, 24,135,204,
+148, 42, 46,232,115, 93,210, 44,212,124,158,238,151,249,157,111,254,227, 47,250,223,108,185, 27,169,196,148, 84,116, 70, 65,156,
+ 37,143, 66, 91, 58,146,107, 72,131,157, 51, 36, 21, 87, 91,162,201, 76, 68,188,175, 36,  1,159, 28,113, 40, 44,143, 13,190, 57,
+101,251,244,  9,141,201, 52,174,161,207,149,106, 28,248, 60,191, 31,149, 67, 33,  8, 37, 30,244,  0,236, 26, 44, 22,153, 43,167,
+ 18, 15,122, 17, 53,149,215, 95, 95,115,237,157,127,192,176, 23,138,236, 40,163, 50, 24,180, 17, 96, 44,150,175, 57,233, 50,203,
+142, 53, 32, 46,243, 11, 83,230,112,141,222,200,125,208, 31,168, 42,147,254, 51, 70, 89,241,122, 65,183, 84,209, 68,108,148,129,
+ 90,131,134,227,140,204,120, 26,189,237,171, 81, 77,230, 17, 47,207,211,112, 56, 87, 53, 20, 87,133, 58,239,252, 93, 80,137,132,
+195, 81,171,238,210,189,117,234, 98,151, 66, 99, 33, 74,129, 10, 78,192,250, 74, 78,149,214,233,169, 88,114, 65, 92,160,206,227,
+124, 77,249,139,214,223,108,157,129, 41, 30,178, 50,228,109,167,228,184,106, 10,166,232,  3,180,186, 10,190, 34,105,198, 23,250,
+ 74,202,138,200,245,182,146, 77, 69,170, 39,  4, 71,107, 69, 43,117,212,121,207,175,161,195, 62, 37,108, 12, 44,218,160,201, 99,
+128,154,145,169,208, 46,142,121,121,189,229,215, 63,251, 19, 76, 56,194,134,134, 16, 26,186,176,160, 91,172,233,150,158,107,103,
+ 71,132,174,101, 28, 19,125, 63,204,250,219,249, 86,231,244,198, 98,208, 61,230,106,115,196,171,111,188,205,195,123,159, 51,140,
+145,165,135, 85,112,244,117, 66,106,228,157, 91,183,184,253,234,107,252,241, 47,127,196,229,118, 71,219, 46, 84,191, 91,170,126,
+ 54, 70,200,101,164, 36, 61, 52,104, 54, 98, 22, 60,216, 25,182, 35,145,106, 97,123,245,144,221, 54,224,188,229,230,181,150,221,
+213, 21,239,222,126,151, 38, 44, 41, 87, 61,139,234,105,143,174,115,116,221,146,134,145,106, 35,229, 32, 80, 71,206,175,118, 60,
+186,251, 21,190,105,200,189,130, 81,138,113, 84,211, 18,235,200, 38, 44,185,118,124,198,230,248, 24,186, 83,222,252,214,117,188,
+111, 24,251, 29,171,227, 13,203,197, 41,199,103,194,  7,223,218,240,206,237,  3,191,248,245, 47,185,184, 18,108,163,211, 33,140,
+157,201,132,202,222,214,  3,170,101, 26,138,238,220,112,164, 56,177, 94, 46, 56, 94, 93,103,119, 56,240,240,206,167,124,239,187,
+255,136, 55,223,123,155,166,209,207,192, 28, 85,238, 62,254,130,195,213, 72,124,169,114,242,210, 13,238, 95,221, 39, 71,157, 38,
+121, 58, 76,233,137, 57, 33, 89,153,  9,175,190,113,155,147,213, 25,121, 44,212,214,226,115, 85,141,172,245, 88, 35, 76, 73,153,
+207,157,107,121,233,236,136, 79, 22, 75, 44,208,182, 65,167, 63, 89,213,157,243, 23,159, 16,  2,222,  5,140,169,132,160, 80,166,
+237,110, 75,174,  3,217,232, 33, 49, 69,189,149,157, 94,191,206,195,123,143,121,227,198,107, 28,164, 97,219,239,248,189,239,189,
+ 77,145,235, 88, 43, 92,108,159,114,255,254,231, 84,175,173, 14,103, 33,180,129,221,110,224,231,191,252,132,127,240,143,190,199,
+ 91,111,223,228,231, 63,123,132, 44,175,115,180,110,185,118, 20,177,193,130,243,116, 38,208,167,200,141, 83,203,155,111,222,230,
+139,179, 83, 86,235, 51,254,250,103, 63,100,183,189,192,214,140, 45,173,190,  0,141,209,238,185,  8,  5,253,121, 47, 85,176, 77,
+171,187,235, 97,160,109,215,180, 97,193, 48,237,217, 79,189, 30,124,210,132,  9,110,158, 74,105, 45,179,193,145,171, 46,198,152,
+ 10,213,234,158,182, 72,197, 25,247,226,223, 93,171,  1,215, 16, 40, 56, 87, 25, 73,252,240, 39,159,242,237,183,110,177,244,107,
+182,195,158,208,  4, 16, 33,214,136, 95,120,106,178,212,152,193, 38,124,104,201,217,208, 89,129,174, 85,227, 99, 78, 76, 57,225,
+218, 14,151,133, 98, 50, 62, 55,136,205,180, 11, 71, 25,148,189,225,124, 67,200,115,117,116,244,170,118, 54,134, 18, 45,166, 22,
+106,227, 48, 46,195,193,235,215,223, 27,210, 48, 81,131,199, 53,134,206, 27,108, 50,196, 18, 48,238, 64, 49, 81,221, 25,  7,161,
+ 13, 75,202,243, 29,250,210,177, 92,183,140,  9, 22, 93,203,245, 27, 45,226, 96,111, 45,203,182,229,205, 83, 61,248,127,190,241,
+ 60,245,150,184,246, 92,141,117,174,131, 53,236, 14, 14,151, 18,233,252, 64, 28, 35,197, 20, 22,222,243,248,217, 64,117,151,136,
+241,108,135,  9,183, 94, 98,214, 29,206, 85,236, 88,160, 13, 74,225,172,186,246,120, 33, 75,145,175,189,228,  0,251,  4, 37,141,
+ 72,  1, 41,150, 96,194, 11, 43, 90,  6, 22,223,  0,203, 57,244,133,253,252,127,126,108,121,161,242,254, 90,177,102, 94,176,232,
+218,206, 34,206, 33,162,111,251,118,181,164,204, 47,244, 61,186, 67,223,204, 19,  5,  3, 92, 13,149,198,131,107,117,205,155,250,
+ 74, 87,133,118,165, 97,174, 90, 32, 77,137,197,194,235, 10,192,192,216, 15, 80, 53,204,150,146,134,122,107, 83, 57, 92,237, 49,
+ 36,196, 70,188,141, 28,246, 25,187, 57, 33, 48, 80,198,145,140, 33,197,158, 28,139,  6,177, 99, 70,124, 37,212,105,198,172, 43,
+122, 56, 90,139,165,208, 58, 67, 52, 80, 37,227,154,134, 84, 58, 76,142,148,146, 52,192,233,188, 78,141,107,165,150, 21,214, 78,
+124,240,238,187, 28,127,255,191,228,203,143,239,243,244,203, 31, 98,242,132,151,250,252, 37,172,  1, 26, 59,143,188,235,236, 35,
+ 47,250,211, 65,145,138,113,141, 42, 35,141, 90,154, 76,173, 26,146, 50, 22,239, 20,  7,235, 85, 72,174,187,229, 96,217,156, 94,
+199, 15, 91,158, 92, 13, 84,167, 99,120,176,138,127,116, 16,139,158,132,236,204,187,  5,139,179, 96,108, 70,202,115,233,138,  2,
+ 58,100, 14,213,213, 90,245,219,193,  5,172, 55,212,156, 72, 89,107,110,166,234,184, 29, 28,146, 52,161,158,  4,178, 88,173, 43,
+ 80,168,104,  2, 48, 87, 69,212,106, 93,194, 32, 89,171, 35,198, 25,154,249,207,145,178, 96,189,135, 90, 41, 89,244,247, 84, 11,
+181,212,185, 34,103,213,189, 92, 53,124,209,200, 12,199, 49,150,132, 30,  8, 26,103,168, 98, 73, 78,141,108,  4, 13, 63, 76, 53,
+ 19,138, 66,103,138, 87,146,217,144,133,213,233,154,183, 23, 13,219,126, 96, 40, 61,227,225,156,253, 46,243,224,  1,108, 95, 62,
+227,165, 91, 47,177, 62, 63,112,247,201,142, 49, 85, 92, 26,245,179,152,119, 82,207,157, 74,205,106,197,230,228,  8, 25, 71,188,
+ 51,220,190,245, 38,199, 97,131,233, 84,184,179, 92,108, 56, 61, 89,114,181,187,228,203, 59,247, 20,192,243,252,246,111, 52,197,
+236,168,164,148, 94, 16,150,157,209,151,125,174,149, 82,193, 24,253, 90,138,168,  5,173,  9, 30,219, 58, 62,254,236, 17,235,245,
+ 13, 94,191,117,139, 47, 31,124,197,210,117, 20,233, 33, 26,194,114, 65,168, 13, 11,211, 48,173, 71,118,135,204,122,177, 34,183,
+ 45, 93,215, 82,143,133, 56, 70, 44, 69, 31,116,178,160,138,193, 47,  4,161,231,217,179, 61,105, 59,226, 27,203,208, 79,  8,133,
+ 95,255,170,195,135,150,213,241, 41,255,244, 15,255, 33,201, 28,248,241, 95,126,164,243, 66,107,136,227, 56,147, 16,245,176, 88,
+234,188, 18, 17, 33,215,162,120, 78, 12,135,105,228,246, 27, 55,185,118,122,194,131, 59,159,114,116,227, 37,174,159,156,210, 15,
+122,208,160, 86,190,248,245, 39,236,134, 29,155,227, 99,190,188,147, 41,  9, 53,156,121,143,171,129, 96,245,231,197, 89, 75,104,
+ 22,124,241,249, 23,124,242,233,103,188,246,210,171,252,224,195,223,194,217, 66, 31, 29,182, 17,166, 84, 72, 53,233, 33, 35,234,
+ 62, 63, 52,  1, 59, 25, 36, 38,172,109, 41,161,170, 88,200,104,184, 12,171,  2, 18,231,156,234, 12,178, 38,122, 75, 18, 76,227,
+ 24,134,145, 50, 70,186, 16,120,249,250,171,252,245,189, 31,113, 49, 92,112,188, 58,229,206, 87,143,248,238,135,  7, 94,125,229,
+152,161,102, 22, 71, 29, 79, 30,222,215,145,102,176,232, 19,  0,164,142, 60,184, 56,231,149,151,110,240,225,123,239,113,231, 78,
+207,247,126,251, 59,172,164,240,159,255,195,247,121, 50, 86,254,244, 79,126,201, 97,191,195,251,145, 15,222,122,159,247,223, 56,
+227,181,151,175,225, 28, 92,110,159,240,241, 95,253,  8,103, 61, 98,  5,227,220,220, 38, 49,200,156, 57, 41, 49,225,189,161,228,
+168,181,211, 92, 41,174, 48, 12, 17, 91, 71,114,234,145, 25,126, 83,167,252,194, 32,232, 28,140,162,193, 61, 55,163,155,181,178,
+234, 17,169, 90, 75,156,167, 25,136,144, 25, 24, 71, 71,215,181, 52, 62,112,185,235,249,232,147,251, 92, 59,189,137,245,122,203,
+244,238,136,106,  7, 98,158,176,198,227, 91, 67,118, 42,217,176, 38, 80,172,193,228,  9, 75, 59,115, 61, 44,117, 72, 84,239,136,
+ 21, 54,193,208, 15,  5,107, 35,206,174, 64, 70, 24, 43,  9,160,232,228,175,241, 66,  9, 80, 14,  3,193,  4, 74,244,184, 54,210,
+174,244, 79, 54, 38, 33, 88,237, 57,247,131,208, 82,241,141,103,178,  7,150, 29,152,148, 40,209, 16,173,197,120, 21,237,228, 88,
+168,255, 15, 95,111,246, 99, 87,150,157,249,253,214,218,123,159,115,238, 16, 17,140, 32, 51, 73, 38,153, 67,101,149,170, 84,115,
+201, 37, 27, 18, 90,106,117, 11,  6, 26,240,147, 95,140,126,233,127,202,143, 54, 96,192,232, 23,191, 88,134,219, 13,195,237,182,
+ 44, 72,109, 89,182,212,173, 42,149,106, 72,101,229,156, 36,147, 12, 50, 24,211, 29,206,176, 39, 63,172, 19,204,148,  0,247, 27,
+ 25, 36,131,113,239, 61,231,236, 53,124,223,239, 19, 79, 74,149,184,139, 54,149, 72,118,217, 19,133,131,240, 37, 59,189,164, 74,
+235,148,117, 23,104,  3,236,199,  5,254,104,  9,235,  0, 19,188,232,119,164,139, 51,210, 84,209,133,178,186,117,135,253,241, 17,
+155,125, 70, 38,199, 11,  9,124, 17,177,  0,147,151,123,198,126, 65,219, 52,108,198,129,113,191, 35, 31,118,100,148, 93,204,172,
+214, 13,139,131,  6, 28,196,109, 34,237,182,140,113,196, 59,135,247,198,213,152, 99,184,204, 55,207,151,137,108, 58, 11,229,248,
+143,128,100,229,171, 81,177, 53, 91, 19, 42,133, 59,235, 37,203,175,140,214,215,221,151, 42,252,  2, 28,172,228,213,247,206,192,
+212,152, 23,252,102,192,220, 23,184, 76,208,102,155,  8, 76,  3, 92,156,245,236,243, 64, 85,111,236,253, 98, 52, 71,173,133,236,
+161, 40, 70, 10,213,204,216,159,163,123,179,228,225, 64, 39,107, 36, 93,137, 56,239, 72, 98,241,227, 58,245, 12,213, 32, 69,181,
+ 38,139, 33,151,  6, 77, 38, 12, 78,195, 22,157,181, 87, 74,162,117, 29,149,137, 84,123,106,113,160,153,224, 60,239,190,243, 26,
+175,127,103,197,211,243,219,180, 23, 29,154, 34, 94,171,237,147,115, 49,111, 40,115, 74,154, 58,179,158,152, 50,205,112,176, 55,
+239,228,152,204,102,150,170,237,158,188, 51,225,145, 24,134,157, 60,171,218,107, 14,132,118, 65,147,246, 38,164,210, 74, 46,206,
+ 64, 54, 20, 26, 47,184, 57,163,221,  7, 43, 18, 10,118,104,203, 92,145,219,120,220,161,126, 30,101, 87,219,185, 57,175,148, 20,
+137,179,239,253,102,  2,224,157,204,234,122,235,254, 27, 60,144, 72, 84,200, 74,118, 22,187, 26,102,193, 84,117, 66, 35,206, 86,
+  2, 10, 99,177,162, 69,156,163,162,120,141,120, 49,141, 65,240,144,139,237,101, 27,231, 77,241, 62, 36, 92,107,235,  8, 37, 80,
+ 92,124,101,123,115,170, 72, 19, 40, 14,210, 56,153,136, 37, 64,171, 74,163,222, 84,186,185,216,191, 47, 66,174,246,128,238,113,
+ 44,219,142,245,194,177, 42, 14,110,217,  5,185,221, 90, 20,231, 56, 86,190,120,113,197,182, 31,168,117,196,169, 21, 61,175,162,
+239, 68, 56, 60,186,197,235,175,221, 99,181, 92, 51,244,137,126, 63, 18,215, 19, 79, 47, 30,113,231,248,136,215, 31,188,205, 98,
+153,121,255,151,127,197,175,127,245, 75, 62,127,250, 20,117, 86,188,  8,197,184,  2,213,168,117, 82,138, 37, 67,137,152,126, 64,
+  5, 63, 95, 55, 34,  5, 55, 19,161,106,206,164,172,248,228,240,135,  7,252,222,239,252,  1,107,223,178,115,  3,186, 86,114,239,
+ 17,215, 82,138,210, 28, 89, 92,237,254,202,118,164, 37, 77,228,  4,131, 14, 38, 62,164,210,116, 13, 33,  4, 66, 14,180, 30, 14,
+ 78, 60,  7,238,144,117,179, 70, 95,119, 52,173, 99,220, 23,174,166, 61,251,235,115, 54,219,137,183,111, 47,217, 95, 63,225,229,
+211,103,168,122,170,247, 76,211,254,213, 77,155,171,145,  0,107, 45,132,102,129,111,221,172, 19, 49,213,178,122,207,203,235,103,
+ 60,124,240,144, 91,135,183,249,197,207,255,  3,206, 21,  3, 66,184,150,203, 93,207,179, 23, 79, 56, 58,185,195,213,126,195,211,
+103,143,161, 84,170,  4, 90,117,164, 34,236,243, 96,107,153, 10,164,194, 56, 68,166, 56,241,233,240, 41,111, 60,124,157,251,247,
+222, 32,151,194,180, 27, 73, 34,116, 97, 69,210,129,208, 65, 63, 86,106,205,228,152,192, 41,146, 38, 76,215, 87, 77, 52, 90,157,
+125, 30,179,232,202,  8,117,194, 40, 66,174, 19,139,157,103,168,106, 36,186,154, 89, 30, 29,114,116,120,204,233,139, 51,110,127,
+253, 62, 47, 55,129,167,167,207, 41,181,240,236,179,107, 78,238,189,201,250,224,136,139,243, 83, 36, 55,116,115, 12, 40, 77,224,
+131,247, 31,241,254,251, 31,242,163,255,236,183,248,225,143,127,139,111,125,243,  1,255,227,255,252,191,241,191,252,171, 63,165,
+ 31, 71,222,255,236, 11,150,139, 35,222,124,227, 30, 87,151, 35, 67,206, 12,187, 11,116,120,206,119,191,253, 13,158,124,246,107,
+174,174, 54,116,  4,242, 20,  9, 98,154, 24,180,190,242,240,215, 92,190,212,244,136, 90,224,135, 84,242, 52, 18,167,105,214,219,
+204, 76,  9, 28,170,217,182, 17, 21,188,187, 57, 24,172,112, 19,169,136,218,115, 64,146, 82,196,248,226, 82,153,125,244, 80,147,
+224, 29,236,118, 35,185,110,185,119,239,117,146, 86, 50, 91,179,139,166,134, 28, 50,213,183,  4,  2, 46,155, 96, 74, 91,193,213,
+209,214, 70,227,132, 72,160,107, 29,217,108, 50,108,250, 17,231,139, 81, 96,221, 14,151,  6,208,  9, 93,118, 72,156, 44,205,177,
+ 40,211, 62,226,180,226,138, 32,101, 98,234, 43,226, 12,211,234,150,149, 26,231,128,161,156,169,185, 97, 40,  9,183, 44,228,216,
+210, 72, 99, 57,218,165, 82,119,133, 26,148,182,107,112, 37, 51, 93, 92, 48,245,  6,125, 98,154, 31,  5, 99, 69, 87, 95, 30,137,
+165, 86,156, 24,170,116, 55, 20,198,126, 96,117,176,194, 13, 70,190, 78,177,103,170,149, 28, 11,237,210,113,251,100, 73, 88, 11,
+135, 75,207,216,122,190,126,104, 77,243,163,234, 56,243,135, 12,107,184,206,208,239,141,117, 50,101,235,144,199,113, 79, 68,209,
+ 28,168, 21,182,207, 46,137,211, 96, 20,207,  6,246,187, 29, 47,174, 70,212, 53, 12,113,130,206,193,194,191, 26,143,231, 27, 95,
+245,108,105,107,255, 35,217,234,187, 49, 49,236,  7, 10, 19, 94,133,182,253,251,208, 87,253,  7,191,254,234, 20, 32,204,207,116,
+153,253,244,  8, 44, 91,184,213,134, 87, 35,248,125,128,151, 39,135,240,129, 18, 68,184, 30, 54,116, 41, 34,105,207,232, 42,208,
+146,182, 61, 73, 18,197, 21,220,222, 92, 43, 97,117, 11,145,145,202, 14,145, 68,236,133,237,184,131,225,140, 28, 39,  3, 13, 21,
+135,211, 53,232,104,133,116, 30,209,154,  9,218, 18,107, 32,165, 17, 69, 73,  8,169,246,132,162, 68, 73, 64, 34, 87,143, 47,153,
+ 59,171,  3, 90, 32,244, 17,250,202, 88, 21, 95,196,212,227,222,155,122,182,224,237,225, 86,211,172,120,247, 56, 95,240,174,218,
+222, 68,101,206, 53,159, 44, 61, 77, 60,181,220,220, 60,118, 16,168, 81, 99, 16, 34, 47, 30,125, 65,213,106,232, 73,249, 74,149,
+229,205, 30,102,149,183, 29,104, 22,228, 98,192, 20, 81,143, 56,243, 76,103, 49, 21,117,112, 66, 77, 51,162, 53,207, 75,155,153,
+ 84, 87, 36, 19, 75,161,157, 11,128,169, 36,  2, 58, 71,190, 90, 72,139,175,142, 92, 48, 59,136,128,102, 35,219, 85,181,241, 93,
+ 85,193, 37,157,199, 59,201,246,247,115,132, 43,181, 32,173, 39, 36, 19,  0,170, 42,171, 32,228, 34, 20,230,174,214, 65, 28, 65,
+171, 37,222, 81, 10,105,204,102, 67,114, 14,173,113, 94, 73,  8, 77,211, 18,107,154,145, 78,102,127,203,238, 38,220,166,204,187,
+102, 71,156,234, 92,197, 65,183,236, 32, 10,251,161,103, 24,109,199,234,213,145,138, 49,235, 13,220, 97,135,100,183, 88, 48,238,
+206,249,248,195,191,225,254,253,175,147,199,204,243, 47, 78,233, 14,148,187,247,191, 73,186,126,201,159,252,233,255,197,207, 63,
+124,143,113,200,228,106,246, 46,153,163, 97,197,  9,174,204,193, 53,197,210,170, 42, 86,208, 84, 49,242, 20,243,103, 22, 93,153,
+201,126,  6, 40, 72,185,242,214, 91,191, 65, 88, 52,156, 62,191, 32, 44, 26, 98, 63,226,107,135, 54, 48,140,145, 38, 22,174,174,
+ 71,210,104,249,224,197, 53,144, 38,106,246, 20,111,240,139, 69,109, 17, 17, 58,175, 44,188, 99,216, 65, 88, 69, 88,  8,187,109,
+207, 69, 63, 34, 69,105, 91, 71,115,112,135,  7,111,220,226, 31,253,206,111,240,201,175,127,  9,210,144,189,162,190,208,213,134,
+ 44,142,137, 74,238,123,198,113,164,233, 26,139,188, 44,137,156, 11, 65, 90,211, 66, 36,199,246,242,154,103, 95,124,198,119,191,
+255, 99,126,254,183,191,224,207,254,207,255,149,197,122, 73,208,  5, 85,132,  7,111,190,203,189,251,111,240,222,207,127,194,229,
+139, 83, 92, 19,112, 10, 67, 63, 80,141, 48,140,160, 76, 41,177, 79,145,162,214, 85,199, 92,248,228,211, 71, 28, 31, 31, 19, 17,
+164, 22, 59,148,102,173,  9, 89, 89,132,194, 55,126,227, 29,206,175,182, 44,125,192, 21,161, 52,142, 71, 79,158,176,219,238, 16,
+231,205,245, 32, 55, 76,  4,101,210, 66,158,172,240,220,105, 65,163,208, 74, 32, 74, 66,125,224,222,253, 55,249,228,209,175, 89,
+181, 31,177,219,140, 60,126,178,161,143, 31,115,121,177,231,181,211, 83,142,143,143, 57,123, 89, 40, 83, 68,186,  5,177, 38, 68,
+225,241,211, 43,254,213,191,249, 63,248,175,254,203,127,198,249,203, 45,255,245,127,243, 63,240,211, 95,124,196,110,211,227,170,
+231,224,232,144,227,213, 49,187, 77,230,175,127,242,136,197,226, 47,249,226,209, 99,190,247,131,239,240,253,215, 30,114,117,241,
+125,254,237,255,254,127,147, 98, 37,231,  4,193, 25, 43,162, 78, 72,182,144, 10,211,225, 22,212, 89,242, 98, 45,133, 52, 12,228,
+156,240, 85, 13,175, 91,197, 92, 43,154,173, 48,159,175,199,224,220, 92,208,207,189, 71,101, 22,248,154,104,215,116, 58,214, 24,
+148, 42,244, 83,164,  9,  1,147,202, 36,246,187, 11, 46,175, 60,183,110,223,166,138, 77,232, 74,205,180,206, 19, 83, 37, 53,153,
+ 86, 42, 83,206,140,219,194, 66, 27,138,236, 17,239,105,218,  3, 92, 26,233,199, 72, 77,  5, 23, 20,218,128,196,134,117,169,108,
+176,  9,160, 27, 43, 94, 43, 62, 44, 24,174, 35, 53, 39,194,177, 35,237,204,235,172,186,194,171, 41,229,157,  0, 83,198,217,248,
+ 18,105,148, 80, 65,  6, 33, 39,199, 94, 71,104, 35,153,150,181, 46, 24,114,198, 73, 97,191,175,164,167, 27,166, 56,178,110, 22,
+ 60, 31,  2,161, 49,113,223,245,201,146,  5, 75,162, 42,195,249, 30,169, 35,190, 58, 26,169, 76, 53,227,196,152,  9,105,152,144,
+212,227,213,132,121,190, 10, 33,216,136,122, 63,193,162,124, 25,192,214, 22, 35, 56, 30,118,176,  1,210,232, 57, 88,174,240, 71,
+ 75,166,177, 66, 73,116,119, 23, 52,141,253,131,243, 77,103,200,106, 87,104,213, 17,155, 53,159,187, 57,240,231, 42,178,219,140,
+ 28, 30,172,112,  8,187,253, 68, 93,  5, 14,150,142, 22,136,251,204,113,107, 60,  2, 17,131, 24,217, 36,215,238,129,105, 28, 41,
+105,100, 28, 35,  7,141,167,105,220,255,111, 46,122,153,187,243,240, 15, 16,176, 95,253,125,154, 39,  8,242, 21, 14,124, 29, 19,
+227, 16,233,247,  3,149,145, 73, 33, 54,138,139,137,234,123,100,154, 40,125, 75,146,129,214,  5, 19,106,199, 61,212,  1,180, 34,
+177, 80, 73, 76,185,101, 74,209, 52, 79, 69,112,161,162, 50,146,103,138,165,196, 74, 85,103,105,118,217, 65,241, 84, 77,212,226,
+ 13,  1,238, 21, 98, 32,168, 37,222, 45, 58, 97, 29,132,  1, 72,113, 32, 75, 38,  8,120,170,249,203,185,177,250, 84,243,212, 82,
+ 29,206, 87,106,174,166, 40,143,198,236,206, 55,  8,189, 36,179, 72,125,142,239,155,163,213, 67,  8,212, 92,172, 99,244,182, 35,
+ 23,153,243,198,113,160,201, 70,246,217, 89,125, 36, 38, 99,213, 92,113,248, 89,145, 81,173,170, 46,166,104,167,  8, 89,  1,157,
+ 87,  2, 21,163,199, 57,179,171,196,106,140,250, 82, 19, 17,103, 64,135,170,134,244,  3,130, 26,235,125,114,149,160,246,134,166,
+ 98, 99, 61, 45,118,211,122, 28,161,129,224,149, 88, 12,119,169,181,154, 98,218, 57,180,152,241,211,205, 73, 58,137, 68, 42, 51,
+192, 35,151, 89, 83,144, 76,132, 17, 44,140, 34,107,197, 21,251,243, 27,223,189,159, 67, 93,118,195,136,243,106,130,185,105,206,
+146, 22, 83,124,150, 70,137, 99,161,109, 59,104, 10,169,239, 13,250,147,236, 51, 25,134,158,148, 71, 27, 89,206, 35,241, 92,103,
+ 57,171,152,149,175,107, 27,218,133,231,229,243,207,249,252,195,247, 17,231, 56, 56, 60,100,181, 62,228,242,197, 11,190,120,244,
+ 49,103, 23, 87,196,100,193, 48, 94,237, 82, 54,208,198,108, 99, 17,219, 93, 21,245,148, 57, 51,190,  9, 45,119, 95, 59,161, 93,
+  6,203,166,159, 42, 69, 76,237,190,221,141,196,156, 88, 29, 30,112,239,248, 30, 47,175,246,140,174,112, 84, 19, 50, 20,122,245,
+ 52,101, 98,218,103,188,107,184,115,247,  1, 31,255,221,223,176, 62,186, 69, 61, 90,179,189,188,196, 57,207,225,193,  9, 39,247,
+ 79, 72,174,240,242,249, 19,182,195,134,186,110, 89,234, 33, 90,  2, 87,187, 61,203,195, 91,116,154, 24,251, 17,159, 38, 70, 15,
+ 15,223,188, 77,191,189,224,209,227,151,132,238,  0, 39,167,104,130, 50,227, 80,115, 52, 39,134,118, 13,161, 93,128, 84,114, 54,
+155,163,107,221,172,138,207,224,132, 79, 63,127,204, 23,103,167, 48, 37,210, 48,177,190,243, 38,183,110,157, 64,104,153,210,200,
+255,251, 23,255,142, 28, 51, 77,232, 40, 57, 83,181, 24,162,182,223, 19,179,129,114,210,124,168, 84,148,170,  6,107,186,190,220,
+178,185,222,114,120,112,196, 24, 42, 82,148, 41, 70,100, 37,  4,  7,107,127,192, 55,126,227,219, 16, 71, 66,178,117,149,  4,199,
+110,219,179,187,218, 32,110,142, 64,158, 29, 34, 57,219, 97,144,211,192,208, 23,203, 30,200,150,174, 54,104,182,117,135,111,105,
+ 23, 11, 78, 47, 47,241,201, 49,228, 96,157,230, 26,158, 63,125,196,234,240,144,166, 13,148, 26, 25,163, 50,196,209,162, 36,181,
+225,227, 15, 46,249,111,255,187, 63,226,211, 79,207,216,150,202, 65,115,200,173,213,138,234,148,197,162, 33, 28,174,233, 55, 19,
+ 87,189,240,233,135,215,220, 58, 58,226, 15,127,255,135,156,159,245,252,238, 15,190,207,175,254,246, 67, 62,127,246,212, 18,204,
+ 74, 69, 66, 67,238, 51, 34,145, 86,149,  8, 76, 53,226,146,117,158,130, 93,103, 69, 60, 56, 67,154, 72,  6,167,106,107, 10,241,
+166,  1,154, 57, 18,206,219,164,162,148, 74,  8,134,179,166,202,171, 53,146, 83,  3, 95, 49,147, 50,243, 56,160,221,138, 82, 18,
+101,152, 56, 63,115,172,143,110,209,122, 99,103, 72,235,169,162, 52,  2,105, 28,152, 26,187,255,125, 54,173, 17,190,179,232,231,
+146, 40,121,154, 95,211,124, 10,228,142,152,122, 44,223,210,132,168, 26,102,  4,109, 63,145, 67, 65,157, 39,245,149, 82,  6,252,
+ 34, 64, 25,169,222, 19,180,176,159, 18, 53,  7, 80,199,202, 23,162,102,166, 88,233,154,195,249,190,172, 22, 89, 92, 18,181,141,
+ 48,  9,135,221,130,219,183,239, 35,171,187, 92, 95, 94, 34,235,142,225, 78, 71, 63, 86,210,147,137, 39, 23, 27,158,238, 12,102,
+ 52,109,174,241,237,130,221,246,154, 52,244, 12,211, 57,157,142, 56,237,216,239,123,166,161,103,146,121,175,171, 38,  0,102, 86,
+186, 31,126, 69, 61, 22, 13, 73, 63,191, 78,251,130, 48, 18,164, 49, 69,191, 10, 39, 65,  8, 24, 28, 70, 99,164,143, 19,219,148,
+ 89,174, 58,110,221, 94,225,214,106, 33, 36,105, 65,  8,208,175, 28, 53,131,147,150,215, 14,141, 12, 58,  2,251,198, 60,246,141,
+ 13, 10,185,188, 24,105, 93, 98,209,  5,114, 76,188,248,226, 37, 18, 11, 82,173,169, 27,250,129,197,218,226,107,166, 89,200,236,
+189,190, 58,165,165,252,253,246, 93,255,193,120,127,156, 15,242,175, 30,250,113, 63,225, 90, 11, 77,242,172,241, 97,100,220,239,
+153,118,150,172,201, 52, 33,181, 69,189, 50, 14,153, 80,149,212,122,198, 62,210,  0,213,123,188,207,116,139,  5,211,126,133,166,
+ 75,138, 55,171,120, 78,189,137,211,205,179,132,184,132, 74,139,142, 61, 34,129, 41,123, 60,145,166, 86,  6, 50,226,171,141, 59,
+ 72, 20,133,143, 31,159, 18,203, 51,174, 95,190,143,108, 35, 67,  4, 31,173,173,128, 98,225, 41,106,139,108, 19, 95,161,184, 27,
+133,106,  1,211,130, 90,171,166,106, 27,240, 82,110,100,117, 70, 96,171,217, 70, 84,170, 16, 39,195,124,218,133,111, 93, 92, 41,
+198, 62,119, 90, 64,189,  9,125,162, 69,171, 86,111,130,183, 89, 70, 55,231, 56, 43, 97,190,200,114,130,132,220,228,192,160,206,
+104, 60,168,169,226,187,106,130, 56,227, 69,207,156,115, 53,101, 57,197, 65,181,200,205,224,173,194, 23, 39,175,164,144,149, 76,
+140, 74,158,233,117,181, 64,118,230, 93, 53, 38, 61,212,166,224,146, 80,197,207,239,147, 21, 44, 81,237, 80, 20,159,161,192, 52,
+152, 21,172, 83,103,129,246,129, 87, 52,189,154, 43,190, 83, 24,147, 17,210,170, 34, 76, 56,231,172, 91, 44, 21,179,146,218, 78,
+213,226,116, 29,174,  6, 38, 73, 56,173,102, 37, 43,133,206, 55, 22,154,131,220,212, 70,228,148,172,171,111, 58,163, 95, 21,153,
+193, 64,145, 54,  6,142,221, 17,103, 47,191,224,229,213, 37,  5,104,187,134, 92,235,172,202,181,  7,144,159, 85,244, 55, 49,172,
+162, 50, 67, 52, 18, 93, 27,248,222,119,191,203,242, 48,240,226,197,  5,169, 70,222,122,248,144,213, 98,201,199,159,124,198, 79,
+126,242,115,110,223,186,199,195,119,191,195,233, 23, 31,153,250,184,117,196, 41,225,194, 64,223, 79,140,185,242,237,111,252,136,
+147,  3,248, 55,255,250,231,108,119, 61,222, 59,138, 42, 33,116, 28,174,143,121,227,193,155,118, 99, 78,  3, 85,  2, 11,109, 56,
+186,187,230,162,223, 50,140, 61, 77, 92,210, 54, 43,154,133, 67,170,227,181,213,109, 94,191,123,196,211,103, 31,242,233,147, 79,
+ 89,250,150,160,193, 92,  5, 73, 73,197,148,218,200,172,145, 16,163,251, 53,174, 33, 89,196, 31, 93,219, 26,212,100, 24,232, 25,
+209,177, 16, 84, 80,239,121,118,246,132,179, 23, 79, 12,169, 76,182,204,109,153, 87, 69,206,155,  7, 23,229,106,219,191,138, 40,
+174, 89,236,189,195,214, 26,234,133,218, 56,134,169, 18,114, 34,180,129, 82, 10,157,182, 20, 96, 17,132, 90, 70,115,152,228,194,
+ 46, 13,172,154,  5,181,100,186,198, 96, 62,165, 84, 52,207,164,230, 90, 16, 18,162,118,191,185,160,182,  2,144,194,100, 40,  7,
+134,105,195,167, 31,255, 10,113, 13, 18, 28, 77,211, 82, 82, 36,107,166,140,153,169, 76, 60, 59,125,108, 19,163,154,145,170,180,
+161, 97,213, 52,108,211, 72, 14, 13,191,254,248, 12,239,148,147,163,  3,148,198,160, 48, 65,104,154,  5, 71,139, 35, 14,186,192,
+229,117,143,200, 45, 67,140,166, 66,240,158,223,249, 79,190,205,251,159,127,198,127,255, 47,255, 39,218,101, 64,130,112,188,128,
+218,172,120,118, 62,226, 60, 44,157, 67, 39,177,157,100,172,104,176,150, 80,147,209,214, 74, 52,117,176,101, 74,152, 42,184, 74,
+ 69,114,193,121, 37, 71,  8,162, 84, 41,228, 34, 52,206, 28, 56,206,153,176,208,214, 46,142,224,132,152, 50, 12,133, 92,118,168,
+ 42,190,105,137,169,103,220, 95,210, 29, 31,130, 19, 92,177,  7,116, 13, 43,202,126,164, 68,193,181,115,  1,213, 10,190,  4,219,
+157, 78,201, 14,247,166,218, 36,207, 41, 37, 77,212, 16,232,227,104,207, 49,183,132, 49, 50,213, 68,179,114, 44,180, 35,230,129,
+154, 58, 52, 12, 52, 85, 72,  9,180,107,140, 57, 48,237,  8, 11, 37,120,199,229,126,164, 45,106,121, 19,139, 66,147, 29,121, 47,
+164,169, 71, 23,129, 90,150,184,234,  9,157, 71,124, 67,112,208,133,150,147,215, 91,222, 56,132,235, 34,124,122,181,228,160, 93,
+144,151, 11,250,253, 72,215,182,188,246,230,138, 77,133,103,143, 19, 92,192,101, 81,242, 62,209, 15, 59,118, 49,145,182,213,138,
+ 45,205, 60,249,252, 57,242,212, 38, 55, 26, 90, 14,244,150, 49, 57,174, 19,203, 82,112,165,177,  2,170, 31,217,135, 61,185, 47,
+ 76,125, 65,107,195,225,108,112,122, 89, 97,191,143,140, 90, 40,162,180,206,209,181,142,251, 88,151,255,196,  9,185,181,213,174,
+ 83,179,198,221, 88,225, 10, 70,154,185, 51,119,207, 17,136, 39, 11, 86,150,105, 67, 95, 33,189,184,164, 31, 39, 38, 28,190,194,
+181, 40,147, 49,207,216,109, 10,141, 66,123, 96,167,243, 48, 84,220, 16, 57, 57,110,152,135,138, 92, 92, 79, 44, 91,111,147,128,
+ 10,113,200, 44,194, 44,195,191,241,174, 79, 19,187,190, 82,138, 67,100,193,245,254,194,172,207,181,103,200, 35,101, 29,168, 87,
+ 61,178,203, 22,254,162,209, 58,235,153,103,146, 83, 71, 91, 38,130, 52,184, 42, 36,151,200,170,132,125, 38,137, 93, 63, 37, 26,
+138, 88, 98, 33,106,143,  4, 99,168,120,103,244, 77,153, 85,248,140, 22,253,171,192,209, 90,144,  7, 15,184,112, 39,196,190, 16,
+128, 73,  3,182, 81,152,253,228, 41,103,163,190,105,182,176,140, 60,119,236, 78,240, 26,140, 28, 87, 11,226,189,249,205,139,165,
+ 99,169, 24,109, 12, 81, 82,169,120, 53, 76,100, 77,144,179,137, 89,114, 41,184, 57, 41,230, 70,213,110,157, 82, 65, 84,105, 52,
+224,212,120,243,126,190,121,111, 64, 49, 57,155,226, 79,252, 77, 80,139,  9,186,210,100,147,128, 90,132, 18, 42,204, 42,244, 66,
+162,173, 74,214,106,234,118,102,229, 62,198,249,141, 41,145, 68,104, 48, 85,174, 40, 20,  2, 34, 38,190,105, 80,138, 51, 53,121,
+245,246,128,245, 34,102, 27, 83,251, 63,114, 18,188,  7,157,249,181, 94, 11, 99, 44,166,194, 68, 17,241,150, 79,238,178, 65, 77,
+230,180,185,154, 11,184,140,134, 96, 92,123, 50, 78, 28, 22, 92,152,172,234, 20,135,107,109,204, 58, 77, 19, 73, 42,161, 88,129,
+ 52,165,145,126,187,183,164,185,154,172,128, 18,  1,175,166,172,205,137,197,114,137,122,229,244,233, 11,174,174,182,104, 48, 81,
+ 71, 65, 89, 31, 30,114,125, 49,130, 42,222,  7, 84,234,252, 57,206,242,213, 98, 86,  9,197,248,141,130,173, 77,156, 84, 68,220,
+156, 11,173,124,240,203, 15,249,244,209, 35,164, 13, 52,178,226,219,223,186,141,111, 28,169, 36,110,191,246, 22, 97,209, 64, 73,
+200,  8,146,123,104, 50, 99,  4,101,193,209,235,183,120,251,205,187,124,242,179, 63,229,122,179, 65,213, 84,165, 72,101,156, 44,
+ 41,238,233,163, 15,112,218,160, 77,224,157,119,127, 68,247,224, 77, 54,253,134,125,205,172, 15,238, 16,135,132,166,  9, 45,133,
+195,251,119,249,241,143,190, 71,218, 62,229,227,191,253,132,247,222,123,194, 15,191,247, 77,139,202, 77,133, 80,212,162, 35,243,
+140,120, 76,246, 89,105,105,141, 71, 79,139, 58,187, 78, 26,223,144,107,182,221,110,169,228,236,232,211,136,244, 61,237,106,197,
+218,169,133,170,164,200,197,102,139,115, 29,183,110,223, 97,216, 93,177,219,237,136, 83,111, 33, 17, 83,180,194,115,214,162, 20,
+108,189, 53,108,119, 92, 93, 92,112,120,120,136,196,128, 91, 20,106,137,232, 84,137,147, 55, 11, 75,153,152,178,221, 68,117,198,
+170,130,146,197, 32, 40, 70,175,242,198,197,207,133, 68, 97, 28, 39, 54,167,167,180,175, 63,164,201, 45, 81, 18,117,156, 56, 63,
+123,201, 46, 79, 28, 54, 97,198, 32, 23,114,142, 76,253, 68, 77, 25,231, 26, 46, 95,156,178, 92, 46, 57, 56, 56,  6,239, 13,164,
+113, 61,130,115,132, 91,129,110,185,194,137, 41,171, 65,209,208, 18,164,218,251, 52, 13,136,243,196,254,130,135,247,239,178,217,
+  9,239,253,234, 11, 46,174, 94,240,238, 91,239,242,251,255,233,111,243,254,167, 47, 73, 87, 47,121,251,173, 35,218,166,229,206,
+241,  9,255,242,143,254,148, 41, 15,  6,  1, 82,197,181,133, 60,102, 92, 85,210,100,163,243, 90,231, 74,149,138, 84,251, 51, 40,
+120,148, 76,157,237,183,222,214,  5, 65, 81,241,164,132, 89,197,180,144,179,216,181,237, 32,197, 57, 76, 88,  2, 57, 86, 66,107,
+140,128,156,132,151, 47,206, 56, 62,184,101, 41, 88,193,147, 53,146,226,150, 42, 66, 35, 66,138,134,147,246,177, 50,197, 13,206,
+  5, 82, 30,144,198, 64, 64,185, 84, 36,155,181,215, 75,161,122, 79, 78, 35, 69, 38,156, 58,218,218,224,134, 64,  8, 48,186,150,
+218, 42,194,138,156, 19, 77, 59,  7, 39, 57,229,112,217, 48,214, 76,140, 17,201,182, 38,204,147, 67,106,102,146,  1, 77,126, 70,
+ 27,119, 12,123, 37,231,158, 69, 56,  0,181, 53, 97, 43,153,219,173,185,208,163, 81, 62,168,222,168,140, 82, 42, 93, 19,120,171,
+ 53,120,204,245,177, 35,200, 49,254,214,138, 58,129, 62, 45,188,124,122,198,203,205, 72,179, 44,220, 10, 71, 44, 78, 94,103, 75,
+ 96,243,242,140,126, 26, 56,125,108,161, 89,227,230,130,182, 21,218,139,181,161,141,183,231,172,214,194,116,157, 24, 99,196,215,
+134,243,197,146, 69,231,208, 88,200,211, 21,165, 36,134,169,144,178,217,140,183,179,245, 45,204,158,115,153, 69,114, 94,255,254,
+232, 60,127,165,179,150,153,148,119,248,149,196,185, 84,139,173,205, 70,155,  2, 60, 56, 57,192, 91,142, 16,254,216,177,158, 19,
+232,112,112,237,133,109,211,208,219, 35,156,161,192,117, 53, 93,213, 84,205, 35,127,181, 43, 92,151, 17,127,184,198,101,184,120,
+185,103,127,253,  4,134, 61,181,191,102,146, 72, 30, 91, 98,218, 89,195,236,  3,117,155, 72,100, 86,193, 38,102, 83,154,168, 53,
+ 17,242,146, 84, 54,212,120, 65, 12,194, 16,148, 49, 93,195,228,168, 30,106, 91, 41, 67,197,181,129, 82, 11,105,220,163, 69,240,
+ 62,144,167, 61,133,150,152, 34,165, 90,163, 23, 52,160, 82,136,217, 50, 51,171, 56,252,176,180,  6, 54,192,180, 76,172,250,  9,
+239,213, 83,106,157, 21,229, 70, 98,147,202, 92, 45,103, 98,169, 22,216,162,179, 93, 65,205, 34,164,100,178,204, 99,141,146, 45,
+ 62,179,218, 76, 31, 21, 82,174,168,138,217, 75,164,190, 82,150,163,  2,217, 98, 74, 45,220,229,102, 53, 94,113,115,246,122,158,
+253,237,102,123,179, 15,160,  5,166,100,135,139,177,227,132, 52,103, 70,136,218, 24,147,234, 40,213, 10,143,209, 87, 52,169,205,
+137,196, 32,254,  2, 56, 31,230, 61,124,161,144,112,213,  2, 92,114,158, 88,180,158, 44, 80,178,208,120, 37,213, 27,  7,133, 89,
+ 99, 74, 18, 70, 41,  6,  6, 81,243,196, 87, 17,114, 77,164,  8, 57,123,212, 85, 92, 51,171, 77,243, 60,248,147,138,195,190,103,
+ 73,102,225,207,106,107, 13, 93,120,123, 80, 22, 32,154,130, 61,168,241,204,227,156,164, 36,177, 16,125,162, 38, 75,189,155,114,
+165, 86,193, 59,207, 84,147,  9, 75,146, 85,137, 69,141,135,255,252,197, 25,215, 87, 87,118,112,123, 71,144,128,136,210,199,129,
+235,205,198,132, 67, 40,164,132, 96, 55, 86, 74,204, 81,183,206,252,144,197,126, 30,106,181,248,214,156,168, 89,248,232,211,143,
+249,236,227,207,168,185,226, 50,156,159,191,160,250, 55, 72, 83, 79, 77,240,236,241,199, 44,219, 63,224,251, 63,254, 49,159,125,
+254,132,139,151, 79, 72,125,133,152,232,142, 29,239,126,237, 45,150, 26,249,171,159,254,148,152,139, 29,254,226,112,206,108,149,
+ 69, 42, 85, 61,  5, 97,209,118,180, 11,101,136,231, 80,146,105,179,213, 33,  8,251,180, 37, 69,207,189,195,187, 28, 30, 30,241,
+171, 15,127,201, 47,255,238,  3, 46, 55, 23,108,119,251,217,250,145, 24, 74,102,204,217, 14, 79,113,120,103, 35,217,126, 26,152,
+ 98, 34, 52, 45,109, 23,240, 65,  9, 89,144, 27,209,103, 46,196, 52,226,150,  1, 34, 76,215,  3, 27, 95,240,174,101,202,153, 24,
+ 51,168, 50, 14, 61,253,176, 99, 26,173, 16, 24,167, 72, 41, 51, 97, 81,103,241,167, 26, 77, 45,215,194,233,217,115,222,122,248,
+128,198,141,212,164,140, 41,209,202, 28, 83, 92,  5,167, 13,203,160, 51,125, 43,163,203, 22, 31, 58,144, 68,241,205,204,111,152,
+193, 21, 88,194, 89, 63, 70, 62,248,236, 51,170,243, 28, 30, 62,176,136,223,201,177, 90, 30, 17,218, 96, 26,150, 84,153,234,192,
+148, 35,251, 52,226,130,  7,104, 24, 82,  0,  0, 32,  0, 73, 68, 65, 84,199, 21, 33,199,  9,117,158, 41,103,164,100, 98,138, 80,
+ 10,235,245,  9,174,182,212,  2,174,109, 76,132,164, 54,149, 24, 39,179,181, 93,111, 55,172,110, 57,188,203,124,254,197, 19,182,
+ 19,124, 99,123,159,229,186,225, 79,254,236,223,178, 60, 56,230,187,223,253, 14,231, 79, 30,243, 79,255,233, 15,121,126,118,206,
+122,125,194,237,227,191,229,201,227, 71, 36, 55, 39,129,168,167,250,201, 14, 95, 17,139,123,118,222,146,190,100,122,245, 44,176,
+191, 91,161,120, 19,204,137, 32,120,188, 51,209,216, 56, 89,116, 42, 85, 64,131,101, 45,196,136,136,105,119,  4, 11,175, 26, 75,
+ 34, 71,197,139,103, 63, 76, 92, 94,109, 56,188,117,200,152,139,249,221, 67,194, 47, 91,139, 91, 78, 74,145, 68, 77,  3,197, 59,
+202,140,123,106, 93,139,244,142, 84, 19,206,101, 35, 72, 98,164, 60, 81,165,230, 68, 10,194,178, 13,196,156,185, 78,145,154,153,
+225, 34,137,218,169,253,172,193,209,167, 61, 75, 15, 58,  8,251,216,207,244, 76,227,111,176, 16,242,101,158,225, 80,183,144, 52,
+146,229,154, 66, 99, 73,152,155, 45,101, 44,208, 79,140,219, 53,155, 22,174,  7,240, 37,209,  6, 79,118, 51,149, 45,  8,215,179,
+207,220, 77,133, 57, 41, 11,231, 32,199,104,238,167,153,202,215,180, 45,221,162,133,226, 40,139,142, 69, 23,  8,135, 75,250,100,
+219,197,213,235, 45, 91,175,228,231, 17, 55,100,134,112,  0,107, 71, 30, 34,244,137,143,  6,101,186,174,212,205,158, 97,179, 99,
+ 24, 43, 62,  9,174,122, 54,207,247,164, 67,211,  2, 77,155,107, 22, 97,133,107,  3,113,194, 68,147,173,252,189,147,253, 70, 41,
+159,110, 44,115, 55,251,239, 10,113, 44,196, 58,145, 75,100,221, 28,226,103, 94,174,  0,157,124,169,162,103,206, 72,111,154, 47,
+179,210, 59, 15,225,150,127, 53, 25,192, 67, 61,  9,244,  4, 82,176,255,107,220, 59,134,113, 98, 75,162, 70,230,128,157, 13,117,
+ 26,240,174, 35,145, 73,195,128,120,216, 77,213, 26,161, 32,148,152, 16,137,100, 58,164, 38,163,  3,206, 90,145, 80, 60,117, 76,
+ 36,111,150, 64, 70, 59, 20, 60,144,107, 38,167, 72,160, 37, 75,176, 64, 23, 17,180, 22,180, 70, 82, 77,120,245, 80, 23,136,  8,
+163,174, 72, 57, 19,195, 68, 70, 40,177,224,139, 84, 84, 43,181,122,156, 51, 91, 87,169, 17, 73, 54,238,242,150,210, 48,103,101,
+ 39,196, 43,226, 10,105,176, 19, 79,171, 69, 94,214,155,  0,  7,205,182,135,206,  2, 37, 65,219, 89,212,101,153, 19,177,196,153,
+231,214,158,205,102, 19, 42,115,154,155, 20,164,204, 73,113,246,204,  2,205,120,173, 76,213,208,126,234, 28,121,102,192,215,146,
+201,226,112,  5, 74,137, 51,208,195,  4, 95, 53, 23, 34,217,126,254, 56,  3,118,212,132, 48, 78, 21, 87, 44,104,165,170,155, 59,
+244,185,171, 23,  3,243,249,121,198,239,138,169,104, 83, 49,144,164,162, 76, 36,116,126,111,166,152,240, 34, 68, 18,185, 10, 29,
+134,174, 21,145, 87, 97, 13,121, 78,186,171, 65, 17, 47, 52,217, 19, 73,115,161, 80, 77, 57, 25, 45,192, 70,189, 99, 44, 22,150,
+225,114, 52, 14, 64, 53,100,173,165,150, 53, 28, 31, 29, 18,227,165,117,206, 94, 45,109,236,166,187,174, 74,236,123,246,165,208,
+ 52,193,222,139, 98,  8,217, 90, 12,255, 58,140,102, 33, 50, 60,176, 55, 61, 66, 41, 56, 39,243,215,197, 38, 18, 53,218,216, 71,
+ 61, 65,  1,223,177, 27,  6,174, 63,253,212,172, 40,206,186,198,231, 47,158,115,246,236,  5,101, 40,136,120, 46, 46, 30,243,222,
+ 47,126,201,239,252,227,127,204,215,222,129,135,111,222, 99,218,108, 73, 35, 52,135, 29,223,120,231, 29,182,167,191,226,163,143,
+ 30, 81, 82, 54,109, 70, 73, 68,177,131, 48,207,196, 61,173,176, 88,220, 97,233,215, 76,155,200,234,240,136, 32, 19, 49,159, 19,
+163,144,196, 88,231,203,118, 73,206, 91,222,127,239, 23,124,248,228, 41, 42,  5,113,149,160,194,249,190, 71,231,145,108, 21, 11,
+ 32,138, 53,207,233,103,194,225,209, 33,139,245,154,152, 71, 64, 73, 41,162,  1, 26, 28,165, 40,253, 52, 49,109,119,182,207, 76,
+130,235, 51, 89,247,198,137, 78, 19,174, 31,216,237, 95, 82, 81,214,139, 53, 94, 34,187,105,178, 21, 43,  5,201,166,102, 86, 53,
+158,182,212,202,213,229,134,205,245,134,229,221, 59, 54,197,  9,  1,151,173, 64,108,154, 66,173, 29, 83,158,  8, 20,106,  3, 50,
+139, 88,237, 38, 51,244, 49,  8, 69, 21,153,169, 92, 34,149, 49,102,206, 79,159,243,218,237,215, 25,198,204, 80, 11,139,131, 67,
+ 86,221,138,188,223, 19,125,161, 31,123,250,253, 68, 22,165,235,132, 58, 51,  6,250,126,164,120,165, 85, 79, 35,158,234,109,  2,
+185, 10,149,141, 47, 52,141, 71, 93, 71,209,132, 79,217, 52, 36, 81, 25,153, 56, 17, 71, 94, 44,249,233, 47,159, 83,130,160,225,
+231,252, 23,127,240, 53, 62,255,252, 57, 79, 78, 63,224,135,191,253,187,188,253,224, 46,175,221,121,200, 55,223,121,151, 79,158,
+ 60, 65, 93,182, 34,167, 20, 11,140, 74,182,238,169,226,230,233,159,165, 59,230, 82,172, 16, 83, 33,170,233, 96,236,154, 81, 74,
+245,136,171,102,149,203,153, 41,142, 38,214, 44,  6,240,200,181,  7, 21,188,  4,212, 91, 66,100, 42,137, 90,103,183,  8, 13,217,
+ 87,130,120,206, 46, 94,208,172, 15,173,171,243,230, 33, 78,113, 52,178,216, 28,207,236,202,154,156,247, 72,181, 34,167,150,108,
+118,222, 98,215,111,170, 21, 63, 13,150,191,160, 74, 40,129, 84, 51,125,172,212,164,136, 47,180,210,146,202,100,226,215,186, 64,
+181, 32,113, 66, 74,166,210, 18,131,  3, 47, 52,131,146,146,197, 64,167, 77, 36,165, 68, 19,  2, 67,186,100, 93, 21,239, 58,170,
+107,112,221, 93,134,241,136,169, 31,216,143,103,196, 95, 79, 44, 22, 75, 43,100,167, 29,151,233, 16, 31, 58,202,184,229,126,115,
+196, 49,129, 93,129,116,157, 88,104, 70,114, 37,141, 19,211, 52, 32,100,234,148,240,107,133,198,209, 87, 97, 51, 64,217,143,164,
+226,105, 90,  3,201, 84,129,215, 87,202,170,129,179,209, 19,167, 35,218,163,150,102,  5, 99,104,184,117,  2,119, 79,108,159,254,
+249,203, 67, 46,207, 58,106, 86,150,157,226,151,107,206,155, 53,177,  8, 58,128,244,202,213,139, 68, 40,153, 58,141, 20, 87,  9,
+175,159,160, 78,232, 83,102, 59, 36,186,163,214, 92,119,185,152,222,107, 86,184,143,179,222,165, 47,153,234,197, 92, 88,175, 32,
+227,166,185,254,234,194,124,151,161,169, 95,118,254,181,254,125,145, 28, 38,219,226,142, 55,122,222, 22,248,192,  9,215, 35,108,
+206,175,240,217,210, 63,243,156,110,152,118,153, 18,237, 57, 78,198,114,227,139, 71,164, 65,165, 33,231,129,170,153,145, 72, 30,
+ 10, 46, 95,163,213, 49,229, 45, 46, 44,168,141, 82,199, 29, 41, 38, 52, 56, 68,  2,190,142,148, 28,152, 92,162,230,  4, 25, 52,
+120, 34, 35,211,188,150,213,162,148,218,115,220, 30,114,114,114,155,103, 27, 40,209,244, 91,187,184,199,223,224, 93,107,205,228,
+153,218,228,110,204,253,110,174,138, 83, 68,234, 44,248, 73, 21, 55,199,166, 82, 44,117,201,200,104,117, 78, 37,178, 61, 99, 82,
+ 19,198, 85,201,175, 68, 98, 42,118,  8,220,120, 82, 74, 46,175,240,178, 18, 64,138,216, 65, 58,239, 50,110,118,222,137, 98, 93,
+225, 60, 34,173,147,237, 33,196,207, 25,186,197,118,228,185, 22, 43, 80,164,226, 52, 32, 57, 89,193,  0, 22,198, 48,219,231,110,
+236, 77,150,200,150, 44, 11,218, 91,247,171,226, 44, 10, 22,219,153,167,100,  9, 63, 55,251,242, 82, 51,190, 85,100,178,135, 54,
+ 84,166, 98,246,165, 32,182, 23, 86, 21, 82,181, 64,156,  6, 99,196,171, 10,165,  6, 84,140,217,171,210, 80,234, 64,174,144,147,
+216, 67,205,164,208,243,251, 90,102, 81, 98, 33,207,121,232, 57, 71, 50,149,219,119,110,179,223,247, 92,247, 19, 82,173,227, 23,
+ 53,203,142,201,105, 42, 77, 99,121,193, 34,193,120,253, 51, 59,255,242,252,226,213,254, 87,253, 77,148,173,189,150, 20,235,171,
+194, 73,213,108,126, 82, 13,102, 82, 29,  4,167,196,148,200,201, 14, 76, 17,219,183, 95, 94,109,248,127,254,242, 61,155,188, 80,
+240, 62,243,241,175,255,146, 55,223,254, 22, 37,238, 56,186,115,155,161, 79,168, 83,218,245,  1,135,203,142,191,252,217, 79, 25,
+ 99,229,  7, 63,252, 46,247,238,157,240,179, 95,126,192,217,243,151, 44,187, 37,139,174, 99,219,111,152,166,137,176, 58,196, 45,
+  2, 77,211, 34, 58,146, 93,161, 12,230,203, 45,165,114,112,231,136,227,195,142, 47, 62,255,136, 95,252,250,215,236,182,  3,109,
+171, 44,218, 37, 71,235, 29,159, 61,218,217,174, 60, 56,218,102,193,225,178,163, 91, 47, 89,174, 15,185,117,124,204,221,215,142,
+  1, 79, 30,237,189, 78,147,141,114,139,128,155, 25, 14,195,126, 32, 78,209,186,162,146, 44,124, 33, 21,166, 52,112,118,126,193,
+211,167, 47, 88, 45, 91, 92,200,236,175,  6,131, 23,  5, 12, 48,145,203, 92,116,126, 73, 15, 44, 49,114,122,246,148, 55, 30,190,
+198, 36,138, 47, 38, 54, 44, 81, 73, 37, 19,221,136,100,193,185,150, 26, 42,231, 47,207,249,226,217, 83,156,115,228,148,241,106,
+121,  8,133,196, 27,247,238,240,214,219,111,241,232,209, 19,250,221,158,243,235, 13,251,113,207,144,149,177, 22,186,210,114,235,
+240,117, 62,120,246, 83,188, 91, 16,171, 41, 96,186, 38,224, 85, 40, 26,  8,173,224,241, 54,161, 83,203, 81, 48,248, 77,203,241,
+201, 49, 47, 55,215, 72,202, 72, 26,137,177, 16,199,132,  6,152,250,  1, 74,228,162, 93,112,123,113,204,243,122,198,216,195,123,
+239, 61,166,201, 91,222,251,236,140,253,245,196, 63, 82,248, 39,191,255,219,180,139,142,147, 55, 14,120,244,228,115,242,  4,205,
+ 98,193, 56,109,205,  1,227, 21,226, 76,177,100, 22,188,137,206,194, 32,157,185,  9,137, 58, 39, 25,182,234, 73,206,158, 29,100,
+ 75,137, 44, 81,230,248,228, 57, 50,245, 70, 87, 83,237,254, 52, 44,171,162,217, 18, 36, 19,  9,167,  5, 23,132,113, 10, 76,125,
+207,193,241, 17, 83,  1, 39,147, 77,140, 80, 98, 42,136, 26,191,157, 17,194, 90, 41, 53, 19,167, 74, 44,  3,206,117, 51,168,105,
+ 36, 75,107,  5,186, 20,115, 56,136,217, 17,125,174,208,  4,198,209, 38,  5,222, 59, 92, 84, 38,201, 72, 99,248, 95, 42,168, 47,
+180,169,193,117, 17,137,149, 82,128, 98,  5, 94,138, 19, 90, 43,  3, 45,190,192, 97,235,249,206,253,183,  8, 15,151,156,158,173,
+ 25,159, 14, 12,205,158, 40, 19,125,159, 57, 56,120,131,122,188,160,239, 43,151, 87, 91,250,203, 71,156, 95, 30, 49, 20,165,191,
+218,144,155, 37,110,119, 77,205, 59,174,175,183,140,147, 77, 32,243, 96,251,112, 95,108,191,188, 17,104, 23,129,234, 45,184,133,
+ 49,113, 57, 65,227,160,201,149,212, 56,220, 45,108,132, 61, 84,154,165,176,158,  5,103,167, 57,179,155,140, 34, 88,114,228,248,
+ 96,201,119,239,219, 74,224,195, 73, 25,215,199,112,104,226,187,124,209,177,237, 39, 62, 80,200, 35,212,173,  9, 33,163,237, 38,
+ 25,174, 50, 75,205, 12,199,129,156,225,249,211,107,242, 16, 41,181, 35,213, 61, 83, 78,164,161,199,249,150, 88,197, 78,245,238,
+203,121,190,212,155,176,176, 47, 69,112,238, 31,122,228,212, 58,124,  1, 58, 96,223,103,246, 99, 33,212, 74, 74, 91,134, 60,224,
+ 85,  9, 42,244, 53, 83,247, 17, 41, 66,242,150, 54, 39,201,236,152, 40,228, 50,145,231,231,114, 27, 32,180, 29,151,227,142,218,
+100,106, 30,208,  1, 98, 76,136,  4,210,100,231, 46, 41,145, 40,116, 62, 32, 76,134,235,142,166,119,210,154, 16,239, 72, 37, 26,
+ 34, 61, 69,134,151, 31, 49,108, 54,248,241,154,214, 79, 20,237,240, 57,102,212,123,235, 84,115, 70,164,204,105,107,206,184,233,
+ 86,214, 98,  9,227, 50,195, 71, 12,241, 88, 74, 34, 23, 67,200,170, 19,106, 21, 50,182,  3,114, 98, 55,106, 53,137,174, 21, 76,
+ 58,163, 81, 42, 72, 99,221,171, 20,193,169,146, 71,163,111, 73,149, 47, 15, 19, 75,111,177, 32,150, 89,225,253,213,232,215, 80,
+230,156,247, 82, 80,149,153, 60,107, 22, 13,235,252,  5, 98, 52,230,122,245, 38,153, 85,211,  9,136,193,227, 77,157, 92,204,170,
+231, 10,212, 49, 83, 22,214,173,230, 10,206, 21,219, 93,204,118, 56,106, 66,179,146,213,147,106, 66,213, 70,235, 49,154,229,162,
+ 36,179,151, 53,141,199,205, 74,123,201, 54, 41,240,206, 94, 95, 46,153,148,220,108,197,145,121, 79, 89,201, 67, 33, 43, 52,173,
+101,199,231,152,237, 53,120,172,178, 37,152,175,210,101,250,105,132, 92,230,104, 84,  3,247,212,155,209,180,128,115,206, 72,248,
+206,124,147,204, 95,179, 17,166, 55, 76,110,193, 40, 90,126, 38,112, 80,  8, 93,103,162, 73, 53,159,126,137,118,129,218,228,193,
+118,154, 86, 72,153,178, 69,138, 35, 52,142,253,245,196, 24,  7, 99,146, 75,203,230,250,140,159,252,244,207,121,247,205,119,185,
+222,236, 88,180, 13,119, 31,222,229,246,235, 39,156,159,126,196, 95,252,213, 79,216,236,  6,124,104,249,205,111,125,143,211,211,
+ 43,174, 46, 94,242,214,219, 15,248,237, 31,255,136,225,122,207, 31,255,249,159,243,224,225,215,249,205,239,253, 22,169, 76,236,
+119, 23,180,186, 36,229,204,182,159,104,221,146, 34, 27,254,226, 79,254, 53,164,107,126,253,233,199,168, 26,124,232,229,213, 57,
+183,142,142,249,222,247,190,207,225,193,154,131,147, 53,235,238,136,131,197,130,148, 19, 46,172, 24,114,207,148,108, 18,228, 92,
+135, 91, 37, 22,165,179, 81,189,154,226,186, 19,199,113,179,102, 20,240,226,201,110,132, 90,104,154, 53,228,196,102,184,226,234,
+229, 57, 93,211,225,124,195,127,248,247,127,205,227,211, 51,203,110, 78,243, 14,251,  6, 92, 36, 66,  8,128,120, 94,156, 95,177,
+221, 12, 28,174, 22, 76,  2, 34,142,182, 21,198,169,208,185, 76,241, 11, 38, 28,161,102,246,151,123, 54,215, 91,139, 44,118, 95,
+146,229, 52,195, 91,111,156,240,245,175,127,131,214, 47,249,236,241,103,188,120,254,130,253, 56,226,253,  1,161,129, 97,234,185,
+188,190,160, 31, 19,200,158,174,109,  8, 65,  9,174, 49,204, 44,153,160, 30,117,130,171,198,251, 44,106,250,146,235, 97,203,184,
+157,  8,234,216,111,183,168, 11,236,211,104,227,236,164,243,207, 18,216,109, 55,188,118,116,155,182,105,240,113,100,189,128,191,
+248,217, 19, 84,148,127,241,207,255, 25,255,228, 15,255,115, 54,209,113,121,158,184,125,187,130, 54, 44,143,142,184,216, 77, 48,
+153,176, 48, 21,197, 57,235,144,107,182, 67,216,114, 17, 44,153,175, 96,  8, 88,165,  5, 45,134,125,214,121, 20,174,102,239,116,
+ 40, 37,203,236, 10, 41, 84,211,247,218,  4,178,154,149, 13, 47,104,227,208, 84,172, 64,106, 90,170, 10,113, 24,216, 93,188, 96,
+189,238,184,220, 95,115,107,189,160,241, 13,113, 42,  4, 28, 69, 51,148,136,243, 13, 49, 22,187,175, 75, 36,168, 53,  4, 82, 35,
+146,156, 77,227, 38, 40, 62,209, 52, 38, 64,141,217, 26,147, 80, 27,138, 14,182, 40, 46,149, 68, 52, 25, 80,204, 56,233, 40, 49,
+205,  2, 75, 11,195,137, 78,240, 73,209,198,172, 92,217,  9,109,105,136, 85,153,114,207,241,193, 61, 78, 14, 26,220, 45,120,250,
+ 28, 86,141,112,176, 92,217, 51,  4,199, 15,190,182,102,117,  0, 61,240,211,124, 76,222, 79, 92,215,200,126, 24,168,186,226,240,
+193, 93, 74,  7,155,139, 53,233,233, 57,253,238,154,212,  7, 66,215,178,159, 22, 76, 79,182,212, 56, 17,251, 11,214, 10,126, 92,
+146,251,129, 86, 21, 73,  7, 76, 23, 80,246, 19,135,157,178,242, 38, 92, 67, 45, 17,141,185,211,189,232, 19,187,237,134,158, 17,
+175, 45,173,111, 95,169,203,151,  2,165,133, 67,129,209,195, 54, 24,175,191, 30,136,  5,172,180,129,183, 23,112, 48, 39,119,126,
+210,  6,238, 72, 96, 61,135,200,108,142, 14,136,143,159, 18,115,196, 83,184,170,202,123, 87,214, 60,148,169,208,140,123, 94,191,
+119,203, 10, 40,224,252,108, 71,117,153,241, 96, 69, 43,194,102,152, 56, 64,224,168,125, 69,198, 99, 42,132,133,137,167,  5,168,
+227,200,126,191,195,209,130, 36,212,239, 16, 42,177, 86,106,177,107, 55, 84,161, 76,149, 41, 23,132, 72,174, 25,149,130, 47,102,
+229, 83,231,169, 36,  8,158,178, 51,129, 97,174,197, 24, 44,  5,179, 60,183,133,210,239,236, 62,208,192, 56, 88, 46,138,243, 74,
+156,122,112,138,215, 14,167, 74,146, 17, 73,158,235,101,199,211,180,224,250,122, 75,222,143, 36, 41, 68,153,179, 45,140,241,110,
+129, 37,168, 81,171, 12, 32, 99,213,206, 13,181, 73,103, 27, 77, 44, 51,208,161,216, 97,219,168,169,205,115,170,243, 46,220,118,
+222, 69, 44, 67,221, 20,171, 38, 42,171, 26,240, 70, 11,158,225, 16, 74,150,108,110,172,106,126, 95, 74, 65,107,166,168, 80, 75,
+ 50,206,112, 53, 58,189,237,125,205, 55, 30,163,  5, 93,136, 86,202, 76,220,210,249, 97, 35,181, 82,113, 84,175,120,197, 10,148,
+108,118, 56,117,138,243, 30, 41,201,184,209, 50,127,255,217,254,162,165, 48,206,166,198,234,103,104,  5,118,  0,203,156,156,229,
+ 21,139,  2,173,224,165, 34,165,226, 26,219,145, 57,  4, 87,178, 41, 23, 69,  8,193,160, 44, 54, 27,168, 72,201,104,205,136, 83,
+ 75,154,147,108, 55,182,179,159,183, 98,170,248,166, 89,144,242,100,  7,119, 18,188,122, 60,130, 52,129,215, 94,191,205,147, 71,
+167, 20, 23,230,177,134,249,201,133, 74, 19, 26,144, 66,117,134,230,144,108,201, 85,181,232,171, 11,124, 63, 76, 76,217,212,149,
+ 54,218, 53,200, 79, 46,217, 30,144,  2, 82, 12,207, 91,106,166, 76, 25,130, 29, 62, 37, 89,241, 33, 57, 83,124, 33, 84,143,247,
+102, 13, 44,147,165,  9,  5, 31,184, 58,251, 59,254,253,147,247,200,213,113,114,114,143, 91,143,111,115,252,225,  9,236, 30,243,
+249,233, 11,112,202,118,215,179,233,123,226,184, 71, 27,  3,122,248,101,195,254,244,140,102,185,100,181, 56, 96,247, 98, 79,179,
+106, 57, 56,186, 79,231,148,234,225,120, 95,248,236,163,159,243,215, 63,249,119,164,152,120,112,247, 46, 95,123,248, 53, 46,118,
+ 59,250,221,142,203,231, 47,249,246,239,125,155,119,111, 31,205,  5, 85, 96, 26, 71,226,100,116,193,169,238,168, 37,226,252, 18,
+ 23, 28,244, 17,246, 38,222,112, 85,137, 84,198,201,147,202,100,193, 21,181, 18,217, 81, 70, 72, 57,145, 83,161,161,165,115, 11,
+186,119, 30, 82,122, 37,141,133,251,111, 60,228,217,203,231,148,120,131, 63, 54, 12,113,227,213, 64, 73, 85,240,  8,219,205,200,
+227,211, 83,190,251, 27,223,192,149, 72, 86, 71, 85, 79,219,  8, 37, 37, 10,189,141,163,219,  5,205,193,138,224,  3, 99, 76, 86,
+120,214,104, 35, 63, 17,170, 76,108, 46,159,115,112,116, 11,127,250,156,146, 42,227,  4,141,115,140,215,123,222,123,255,175,233,
+119, 59,186,102,133,119, 66, 27, 26, 98,206, 44,194,130, 84, 19,168, 57, 92,212, 89, 17,127, 51,169,147,  2,211, 16,121,114,241,
+130, 69,219,112,169,158, 48, 89, 10, 93, 33, 17,240, 44, 87,135, 44,252,138, 88,119,236,227,196,237,147,135, 60,125,254, 25,103,
+231,151, 92, 95,111,248,195,223,253, 49, 63,254,237,223,229,241,197,192,139,139,196,237,131, 53,207, 47, 35,103,151, 91,179, 68,
+169,162, 77, 99,221,149,155,241,209, 89, 64,146,105,  6,102,196, 50,234, 13,237, 43,  9,215, 40, 41, 87, 74,157, 32, 42,190, 58,
+ 34,160,206,174, 73,102,167, 65, 86,197,205,216,106,193, 50, 25,100,126, 46,213, 50, 39, 47,138,226,178, 13,199,130,180,214, 60,
+148,145,237,217, 57,187,151,158,187,175,221,101,213,117,100, 73,148,212,216, 97,220, 85,202,212, 82,203, 30,113,142, 92,213,104,
+138, 98,254,242,220, 79, 56,241, 72,105,104,156, 35,107, 38, 39, 71,169,137,212, 79,248,197, 44,254,242,134,122, 19, 58,147,114,
+167, 72,246, 66,141,149,126,215, 67,240,132, 54, 19,147, 53, 92,193, 41,211, 24, 25,171, 18, 22, 29,177,122,214,206,115,112,228,
+104, 61, 28,118,149,243,150, 89, 64,156,105,146,190, 58, 92,125,129, 54,103,218, 69, 32,123,129,236,105,218, 53,223,127, 29, 66,
+128,159,138,227,243,218, 49,198,194, 80, 11,199,183, 86,124,235, 91,239,176, 95, 42,143, 79, 43,227,163,150,151,131,121,198,251,
+113,226,200,119,148,199,149,161, 20,246,155, 43,142,218, 74,188, 56, 98, 32,147,210,128, 95, 31, 67,107, 62,115,237, 13,115, 90,
+118,133,208, 65,219, 52,175,188,227,185,192, 90,173, 35, 30,128, 58, 21,110, 32,226,  2, 44,  4, 86, 95,230,170,240,154,179,168,
+213,155,224,149,133, 19,134,168,148, 60,145,170,242,206,253,215,120,251,238,  1, 21,216, 20, 24,167,134,182, 53, 57,242,  0, 12,
+173,227,160,245,100,175,108, 10, 60,155, 10, 23,227,200,129,  4, 58, 39,244,165,176,189,220, 49, 29,175,112,234,232,119,153,221,
+243,151,104,204,140,227, 14,173, 59,234, 14, 70, 25, 81, 18,101, 80,114,134, 36, 61,121,178,226, 83,147, 37,178, 77, 82, 24,117,
+ 66,213, 83,114,162,248, 21,251, 84, 40,113,162, 58,227,177, 36, 87, 64, 91, 36,101,107,148,178,195,137, 80,235, 96,114,  7,177,
+176, 44,117, 70,194,175, 89,136,101, 36,150, 76, 39,137,175,223,123,141,251, 95,255, 14, 79,246,231,208,180,108, 46,182,196, 33,
+226,115, 49,128,193,124,251,204,108,236, 57,155, 91, 76,224, 83,196,225,102, 49,157,204, 33, 30,222,153,162,187,148, 74,158,199,
+230,130,  9, 29, 10,160,115,234,145,136,224,155, 57,189,165, 96,  0, 22,177,145, 90, 85,190,140,122, 85, 49,142,110,149,121,132,
+236,236,208,159, 11, 13, 41,216, 14, 78, 50, 34, 30, 39,197,118,239,197, 70,219, 41,153,184,201, 32, 18,106,202,200, 89,200, 84,
+102,136, 74, 81, 71,171, 51,201,170, 22,219, 87,207, 53,217, 92,202, 80,156,129,101, 40,101, 30,135,151, 89,244,102,135,112, 64,
+168, 89, 81,167, 84, 73,136, 42, 83,129, 34,  9,193, 58,231,226, 20,173,102,193,139,213, 66, 81,156, 73,160,201,117, 78, 66,104,
+117,246,220, 87,242,208, 81,188, 69,241,149, 41,145,130,117,249,157,243, 56, 15, 57,101,178, 84, 83,168, 55, 13,165, 86, 90,223,
+224,212,186, 26,212,148,178, 94,157, 69, 51, 86, 59, 80,166, 60,204,239,149, 35,206,175, 35,204,138,216,251, 15,239, 16,199, 29,
+155,171,173,137,117,164,188, 18,102, 57,167,248,106, 74,255, 44,  6,103,169, 53, 19,199, 72,201,149,140,  9,  7,133,202, 66, 90,
+ 82,129, 49, 78, 38,176,186,  9, 42,201,133,111,191,249,128,232,170,229, 14,239, 71,174,207, 62,225,236,139,247,200,100, 98, 76,
+196, 34,108,246,123,210,144, 25,246,189, 21, 77,190,161, 76, 19, 79, 94, 60,165,115, 11,154,101,195, 85,127,205,129, 91, 19,188,
+121,248,217,246,252,236, 47,255,152,247,223,251,  9,221,250,128,119,191,245,155,220,191,119,155, 85,187, 96, 36,195,188,159,109,
+ 69, 72,251, 13,213,205, 80, 30,  5,100, 66, 27,235,232,106,118,248, 82,241, 37,210, 75,143,182, 74, 78,222,146,163,170,199,231,
+140,180,158, 65, 18,205, 60,109,202, 81, 77,120, 88,  3,169,169,228, 26,113,251, 53, 83,158, 32, 13,156, 28, 31,179, 90, 44,185,
+ 28,174,205,246, 41,157,221,236,222,252,188, 57, 21, 35,196, 21,229,244,217, 11,190,246,238,219, 52,139,142,101, 50, 27, 26,193,
+155,245,209,  9,173, 91,178, 75, 59, 62,249,228, 67, 92, 80,150,190,101,138,211,124, 95,217,114,179,223, 12,156,215,167,232,242,
+ 53,206, 94,156, 18,188, 35,172, 86, 76, 62,209,167, 43, 74, 74, 52,221, 18, 77, 54,125,152,146,165, 36, 86,151,145,234, 80,245,
+115, 78,128, 67,106, 33,180, 13,205,210,163, 53, 16,251,202,230,106,203,209,131,251,220, 90, 20,118,195,149, 77,124, 66,224,246,
+201, 29,214,221, 33,139,176,164,234, 29,174, 54, 27, 98,222,224, 59,229,244,124, 36,180, 75,220,250, 14, 31, 60, 27,232,251,202,
+242,176,165,184,196,126, 19,249,232,195, 79, 56, 63,125, 66,144,  5,109,104,153,246, 91, 60,158, 50, 79,177, 84,133,164, 25, 71,
+ 32,168, 89, 41,197,  7,131,135,212,108,227,243, 50,119,187, 58, 71, 81, 85,197,221, 68, 30,123,161,200, 92, 28,171, 77,175,124,
+177,112, 38, 81, 71,174,213,208,181,185, 48,185,  9, 31, 86,136, 23,250, 24, 41,201,177, 92, 29,240,236,217,231,228,184,229,193,
+155,239, 32,190,101, 44, 61, 94, 50,235, 81,153,234, 22, 45,  5, 87,132,118,225, 76,184,234,140,165,161, 98, 19, 56,117,158,177,
+ 79,176,244,224, 19,154,  2,117,236,169,213, 35,221,  2,156, 39,110,118, 56, 95,112,174, 18,197,209, 21, 40, 93, 69,119, 86,219,
+148, 58,143,221,  9,198,188,200, 66, 70, 88, 23,200, 37, 18,100, 98, 56, 27,105,155, 14,223, 79,232,120,141,107,  3, 83,204,  4,
+ 89,224,111,  2, 88, 34,108,135,  9,105,122,155, 20,142,153,197,218,219,212,  8,  8, 61, 76,195,134,181,131, 73, 35, 75,241, 60,
+ 88, 43,180,112,242,134,240, 41,183, 56,188, 15, 23,123,232,158, 31,179,174,176,126,  8,245,218, 49,196, 59,236, 67, 98,240,142,
+ 52, 64, 26, 29,191,124, 33,248, 45,184, 17,174, 79, 47, 41, 83,194,141,142,112, 80,137,251,129,221,254,128, 18,224,250, 60,114,
+103, 33,184,198,211, 85,216, 76,  5,191, 54,127,187,204,193, 45,175,130, 88,248, 42,  2,123,166,189,109, 51,101,234, 25, 98,162,
+115,129,195,182, 53, 95,248,188, 27, 63,240,238, 85,246,122, 11,212,163,142, 35,247,229,247,240,183,151,120, 89,176, 84,211, 61,
+105,113,220, 90, 29, 16,156,177,242,179,119,196,118, 77,  2,166,  9,100, 40, 72,201, 20, 63,144, 82,166,209,134, 82, 50, 83,201,
+ 52,174,144,138, 67, 67, 67,142, 19, 99, 26,105,154, 96, 48,177, 82,241,174,101, 31, 71,132, 72, 77,137,154, 21,167, 45,217,  7,
+116,200,175,152, 32,177, 68,164,117,184,201, 56,214,105,156,  8, 44,208, 38,146,226, 64,138,166, 91,234,180,114,188, 88, 81,115,
+203,176,217, 49, 93,101, 22, 65,145,168,120,145,106, 62,229, 58,139, 74,139, 29,160,182,153, 53,162, 91,205,182,  7, 55, 34,156,
+  9,118, 68,103,124,163, 51,186, 91, 81,161,117,166,108,207, 89,208, 96,227, 94, 43,187,188, 89,162, 80, 68,102,183,123,181,129,
+ 62,115,  1, 33,179, 81,165,148,155,138,218,200,116,213,155,159,216, 94,178, 67,181, 34,243,190,222,196, 53,134,149,208, 57, 57,
+174, 80,144, 44,224,234,171, 37, 74,214, 74,115,147,192, 53,127,224,200, 77,172,171,179, 78,124,182,207,136, 84,136,133, 70,148,
+172, 54,  5,168, 69,230, 14, 54,162, 26,108,234,224, 61, 90,156,141,251, 75,196, 55, 22,110, 83,138,173, 34, 50,197,178,190,181,
+ 82,147,165,205,153, 96,207,196,108,169, 26, 46,182,250,  3,222,122,231,247,240, 77,226,239,254,230,207,184,120,121,137,184, 64,
+101,228, 96,209,161,173, 18, 92, 71,163,152, 23,150,138,119,149,253,126,160, 93, 29,216,103, 37,133, 58,175, 66, 92, 51,103,200,
+ 39,179,177,184, 57,187,190, 74,161,122,177,253,190, 20, 94,187,123,143,131,182,229,195,143,254,142,167,167,103,102,205,153,119,
+ 73,165, 20, 98,132,174,179, 44,245,146,226,172,157,144, 25, 29,107, 65, 56,109,112,168,247,166, 38,142,150,125,174,222,196, 79,
+ 57,101,198, 10, 93,215,178, 90, 46, 89,189,222,176, 88, 31, 50,142,  3,207, 47,207,249,244,243, 71,228,253,196,238,234,138,253,
+230,138, 49, 71, 40,137, 60,101,198,201, 49,198,196,227, 39,143,217,110,255,152,110,217,113,116,114,196,122,125,  7,114,195,139,
+ 79,254,150,245, 58,241,214, 59,247,216, 85,207,215,223,126,135, 92,138,133,241,212,  9,117,149, 16, 58, 38,122,234, 62,145, 92,
+ 33, 84,123,194,169, 40,226, 61,162, 35,163, 78,228,108,157, 45,206, 96, 33, 49, 43, 73, 28,190, 25,144,186,160,137,217, 82,151,
+ 50,100,117,132,133, 71,162, 35,230,200,212,155,237, 50,141, 47, 72,  2, 45,  5,215, 40,119, 78,110,115,126,117,101,197,239,236,
+234, 72, 41,207,112, 32,131, 53,  5, 47,236,118, 59,174, 95,158,113,255,225, 27, 84, 31,208, 38, 19,175, 77,211,208,248, 64,140,
+ 61, 31,126,248, 11, 94,190,220,242,221, 31,124,155,243,203, 51, 62,126,255,  9,136,117,226,177, 86, 35,214,237,182, 60,254,228,
+  9,231,231,103,124,243,155, 63, 48,239,125,222,225,180,163,113, 29, 99,156, 44,108,137, 66, 42,133,198, 57, 22,190, 35, 57,101,
+ 24,122, 84,188, 21,242,206, 17, 90,103,225, 65,126, 73,234, 18,155,235, 29, 53, 43,111,188,243, 53, 62,252,245,207,152,166,137,
+245,162,227,232,214,235,172,156,103, 26,133, 84, 39,106,220,114,117,117, 74,173, 45, 77,112,220, 57, 62, 33,214, 21, 63,253,249,
+ 99,126,244,221,135, 44, 27, 71,154, 18, 49, 87,154,166, 35,105,162,164,145,133, 91, 48,104, 75,140,  3,162, 13, 94, 32,214,140,
+102, 33,107,180, 93,191, 10, 82, 35,222,130,202,204,230,151,203, 28,163, 59,135, 71, 85, 33, 91, 58, 20,165, 26, 23,226,149,221,
+ 21, 69,170,218,180,174,164, 87,154,161, 34,144,134,145,136,167,109, 23,164,105, 98,179,221,242,236,236, 11,134, 97, 64,106,225,
+122,115,197,201,157,123,248, 82,104,107,107, 32,153, 96, 20, 72, 21, 19,169, 74, 88,144,179,113,188, 53,168,173,173, 72, 70,197,
+235, 33,122,179,227, 45, 23, 45, 49,  9, 68,168,236,113,183,  2,186,201, 76,219, 76,183,240,168,116,248, 49,227,187, 21,125, 30,
+152,114,101,204,  3, 77, 11,117, 12,166,121,105, 97, 72, 59,196, 11, 31, 95,158,242, 71,127,246,167,172,151,  7,244,211,142,234,
+ 11,135, 93,197, 47, 90,252, 65,229,250,209, 33,171, 91, 13,211, 21,232,112,197,164, 61,154, 45,240,201,215, 89,184,164,160, 41,
+227,210,192,245, 46, 50,101,101,237, 23,175, 14,211,221, 57,248, 30,242, 30,150, 51, 71,254,155,247,225, 96, 13,251, 37,252,252,
+210,209,174, 28, 59,129,224, 61,183, 15, 23, 60,120,199,146, 60,207,  7,120,118,218,210, 39,  5, 34,161,233,184,208,142,231,103,
+208, 42,140,207,119,236,229,154,208,182,144,161, 31, 51,233,246,  9,235,201,163,185,224,227,132, 44, 59,152,199,239,229, 43, 75,
+240, 10,244,227, 72, 22,203, 60,200,121,100,135,114, 58,115,227, 47, 98,101, 85,235,255, 71,213,155,244, 90,146,101, 87,122,223,
+233,204,236,222,251, 90,111,194, 61, 60,186,108,152, 73, 38,123, 17, 44, 21, 33, 86, 73, 66, 17,172, 65,141, 36, 64,  3, 13,  4,
+  1,250,  5,130,254,129,126,136,  0, 13, 53,144, 80, 40,112, 34, 65, 20, 68,128,162,216, 21,197,166,178, 97, 50,155,136,140,  8,
+143,240,240,231,175,191,141,153,157,102,111, 13,182, 61, 79,210,103,142,231,254,224,254,238,189,118,206, 94,123,173,111,113,178,
+100,228, 38,133,235, 81, 25, 54,142,149,249,218,216,205,202, 42,194,208, 25, 62,118, 47,112,228,221,219, 61,251,208,195,119,157,
+227,238,234, 64,170,133,226, 60,154, 64, 71, 27,180,234, 42, 80,196,170,121,179,218, 96,218, 90, 70, 36, 89,245,106,153,169,110,
+137, 52,143,119, 86, 48,148, 60, 46, 27,133, 53,151,134,103,199, 76,195,139, 82, 17, 59, 43, 31, 60,  8,210,240,157,167, 49,225,
+125, 36,197, 64,139, 80,179,153, 50, 43, 43,246, 99, 69,198, 61, 81, 15,212, 10,173,138, 93, 96,189,154, 33, 67,151,219,127, 21,
+ 49,132,101, 48,166,183, 91,246, 82,170, 15,183, 98,  3,216,187,197, 32,167,206, 45,211, 46,180, 32,230,208,109, 75,130,205,219,
+196, 44, 14, 35,251, 16, 44, 87, 24,172,  1,238, 65, 26, 43,181,226,147,167, 75,145, 86,204,244,214, 57,135,139,158, 82,108, 29,
+128,179,138, 83,117,230,128,181, 12,181, 77, 28, 86,237,103,153,251, 34,133,232,130, 69,220, 22,255,121, 19, 79,114,145,185, 25,
+222,180,143,246,131,149, 38, 72,224,237,116,238,154,153, 69, 52, 26,104, 95, 69,209, 16,  9, 33, 90, 76, 69, 21,231,132, 60, 29,
+172, 28,  4,243, 18,200, 82,145,169, 77,168, 45, 35,222,209,169,195,137,153,203,  4,107,120, 27,134,206,138,102,  4,130,119,108,
+ 78, 62,224,195,247,222,225, 47,254,223, 63,224,205,197, 43,226, 58, 81,114,161,214,204, 56, 77,200,178,246,240, 78,241, 49, 49,
+ 12, 29,221, 16, 25,139,165,  9,124,114,102,244,202, 66, 45, 19,206, 37,195,  0,133,133,103,143, 93,174,188, 70, 82,124, 40, 46,
+ 80,  2,141,208, 91,107, 94,109,213, 46, 51,205,227,172, 13,131, 24,236,147, 84,107,165,104, 69,170, 41, 32,210,154, 33, 63,189,
+167,235,142,112, 41, 81,231,217,160, 55, 34,116, 62,130, 58,166,170,144, 60,174, 52,170, 54,242, 10,230,187, 27, 20, 56, 89, 31,
+211,187,158,189, 76,148, 42,236,199,131,237, 66,241, 12,177,167,182,153,251,155, 59,182,247,183,108,119,247,120, 41,116,125,111,
+106,141, 83,186,222,243, 95,252,243,223,225,  7, 63,120, 69, 81,165,  4,107, 20,156,165,226,131, 80,130,160,108,169,186,161,118,
+ 17,234, 76,150,201,120, 12,205,192, 70,218, 59,220,193, 17,164, 32,195, 98, 84,241,213, 60,  8,165, 18,139, 48,145,217, 77, 19,
+235,245,198,222,175,169,209,228, 64,171,130, 87, 75,133, 52, 10,165, 54,138,203, 84,159,136, 62,240,254,  7, 31,241,242,171,175,
+216,141, 19,210, 50,170, 86,190,128,115, 56,181, 66, 11, 23,149,185, 53,190,250,242,138,247, 62,120,223,228,244,217,140,152,104,
+225,230,238,150,139,215, 23,188,252,244, 13,171,254,148,155,219, 43,238,238,182,248,104, 43, 34,177,155, 47,247,119, 51, 59, 55,
+243,213, 87,175,121,246,244, 93,158, 61,127,135, 82,238,109, 90,124,104,  8,116, 74, 65,105,173, 25,116,195, 59,102,133,163,126,
+197, 62,108,237,243,232,  6, 82,231,112,178,180, 85,169, 88,164,235,176,227,254,230,138,213,201, 49,201, 89,158, 23, 63,176,189,
+188,230, 46,192,243,179,167,104, 19,238,119,183, 92, 92,188, 65,138,178, 90, 69,158,188,251, 62,234,214,252,229,159,254,  9, 47,
+ 30,255, 27, 54, 71,  3,227, 44,140, 99,225,247,126,247,183,249,226,179, 47,248, 63,255,232,207,121,242,104,195, 48,156,113, 91,
+ 94,227,100,196,165,136,199, 62,187,  1, 65,116,230,193,141, 43,120,154, 20,235,151,247,201,198,142,  5, 86,133,179, 67, 58, 46,
+ 23, 55,117,118,184,139, 19, 40,153, 52, 44,207, 29, 91, 96,145,165, 46,101, 32,214, 29, 97,  6, 93, 71,149,204,201,201, 35,118,
+183, 55,140,234,185,185,190,225,241,201, 99,162,218,224,210,130,210,187, 72,105,149,185,143,132,170,196,108, 37, 44,120,144, 44,
+ 28,173,122,112,145,195,178, 74,136,205,180,199, 26, 71,106,141,184,154,241, 33, 17,103,161, 13,158,144,133, 62,  4, 91,215,100,
+  3,151,212,185,216,186, 65, 61, 58,218,243, 81,189,173, 95,102, 73,248,166, 28,194,196, 79, 94,189,124,107,232,236,210, 17, 83,
+222,114, 52, 28,177,234,182,252,237,247, 62,229,172, 95, 49, 83,153,226,204,170,115,  4,231,233,226, 64,127,186,230,101,121,194,
+112,222,115,121,177,101,110, 19, 41,120,158, 36,199,102,243,115,124,220,174, 45, 54,154, 27,  8, 27,115,143,135,188, 24,207,156,
+153,195, 66,132, 52,152, 93, 73, 70,216,240,243,164,214, 92, 39,154,102,139, 72,198, 53,191,246,222, 49,195,145,129,103, 62,110,
+ 27,106,173, 72,140,228, 67,163,239,214,156, 62, 25, 80,129,251,157,103,186,205,148, 38,172,135,129,210,132, 58, 54,198,231, 61,
+ 93, 15,211,  4,219,171, 29, 99, 22,102,  2,125, 84,200,  5,175,182,171,191,154,234, 98,109,183, 67,253, 78, 96,159,133,233, 40,
+176, 90,246,253,219,172,140,209, 14,241, 14,152,170, 25,182,255, 49, 93,110, 55,102,170, 28,104,249, 30,137, 21,223,  2, 82, 60,
+234, 34, 77, 51, 53,239,237, 98,169, 75, 33,129,243,198,209,243,214,195, 33,243,206, 64, 70,125,131, 18,112,213, 67,115, 84,215,
+240,209,129, 68, 35,148,138, 53,181,165, 37,230,157,165,226,189,189, 39,231, 90,105,197,250, 87,156, 42,190, 57,171, 11, 22,161,
+220,191,166,228,107,130,243,184, 99,101,158, 51, 49, 46,220,114, 31, 28, 30,121,219, 46,165,250,208, 16,111,153, 79, 17, 12,110,
+162,214,134, 67, 52,131,153,119, 15,252,117, 53,233,252,161,103, 55,  6,147,187, 16, 44,138,106,  7, 53,242,208,209,103, 15, 16,
+145,182, 96, 74, 61,218, 44,  1,170, 75,102,217, 34, 22, 98, 56, 87,111,230, 23,105,182,103, 15,186,248,188,117,201,  0, 59,219,
+157,136, 46,123,153,230, 23, 40,142,117,166,107,131, 66, 37, 44,140,233,210,108,119,172,222, 19, 48,222,188,226,241,157,117,227,
+206,181, 17,163,153,244,188, 43,132,152,136,222,227,170,163,136, 26,251,222, 47,  4, 60,175,182, 83,137,138,111,205,218,124,  8,
+140, 37,211, 13, 61,130, 16, 92,162, 11,150, 51,183,142, 92,143, 36,193,197,192, 87,175, 62,225,243,175,126,134,  6,123,193,189,
+ 86,188, 58,236, 17,  4, 69, 43,181, 54, 92,173,204,211,104,198, 68,103, 43,141,182,180,188,185, 16,233,215,107,144,182,  0,112,
+172,181, 14,241,111,  9,106, 34, 74, 45, 19,190,235,241,209, 86, 15,211,158, 41,176, 97,  0,  0, 32,  0, 73, 68, 65, 84,156,173,
+113,110,233,255, 54,208, 76,192,133,184, 60, 48, 45,165,192,146,249,150, 38, 84, 81, 86,209,122,184,107, 41, 22, 45,108,213,252,
+ 19,181, 80, 90, 52, 66,112,104,116, 46,209,212,209,122,187,161, 90, 15,179, 48,244,137,118,173, 28,246, 19,151,247,123,114,201,
+160,142,216, 65,157, 38,166, 60, 47, 17, 59,123, 13,134,110,  0,175,244, 67, 32,143,153, 79, 62,189,230,205,205, 53,231, 47,190,
+129,215,136,186,209, 98, 99,234,209, 41, 34,189, 57,202,141,159, 29,152,  0,231,146,213,243, 78,  5, 41,222,114,157,206, 35,213,
+ 96, 70, 46,130,100, 15,117,102,114,129,226, 10,131, 11,  8,  5,239,  3,117, 55,211, 90, 69, 82, 68,165,210,147,168, 99,197, 31,
+ 41,238,222,145,186,136, 43,158, 46,  6, 30,157, 61,230,238,238, 83, 75, 18,184, 72,197, 89, 76,239,161, 96, 68,  5,209,192,155,
+235, 91,238,111, 15,116,157,242,249,167, 95,240,234,242,150,105,222,145,107, 35, 52,168, 85,185,111, 91,174, 63,190,163,239, 61,
+ 67,244,204,139,132,142,194,235,139, 59,130,119,156, 29,159,242,157, 95,249,117,162,141,117,168,243, 12,195,176, 64, 92,170,125,
+ 46,213,222, 11,173, 52,238,239,175,240, 49,210, 13, 61,135,195, 30,197, 82, 13,157, 55,249,144, 24, 89,187, 30,183, 89,115,125,
+119, 77,119,179, 66,187,129,118,152,216,239,111, 56,108, 95,241,248,201,123,172,143, 79,144,160,156,236,223,240,179,207, 43, 55,
+ 87,151,188,251,236, 29, 78,143,206,233, 54, 43,158, 61, 62,102,142,137,218,224, 48, 22,246,221,129, 15,222, 59,103, 56,219, 48,
+229, 61, 69, 38,214,235,142,253,220, 25,152,196, 27,203,193,208,222,246,217,148,  7,133, 67,100,185, 88,186, 37, 78, 96,209, 82,
+176, 94,117,145, 70, 85, 71, 23,  4,213, 96,208, 42,167,164,206, 47,101, 38,193,214, 85, 14, 58,103,132,201,138,163,180, 76,167,
+  9, 23, 28,211, 97,207,187, 79,158, 83, 30,239,184,217,221,178,219,221,113,117,245,134,199,207,158,113,152, 71, 99, 90, 36,  8,
+126, 96,190,207,132,206,225, 98,161,149,138,224,217,196, 21,227,161,160,110, 34,208, 83,240,116,169,210,212,147,115,160, 39,211,
+130,213, 82,235, 88,112,157,145,246,154, 30,160, 57, 10, 13,169,118,121, 17,  2, 41,118,212, 82, 89,247, 43, 38, 23,168, 89,233,
+ 84,113, 73,  9, 27, 40,219,134,151, 74,212, 21,180, 61,206, 21,164, 20,238,101,207,253,148,184, 57, 28, 83,211,140,214, 76, 29,
+ 23,213, 18,199,143,227, 21,169,115,120, 34,181,131,195,152, 89, 19,152, 82,227, 71,159,127,193,217,191, 63,102,117,182,230,254,
+ 46,211,197,194, 81,119,142,108, 61,227,182,210,142,173,  7, 45,  8,172,131, 69, 31,227, 26,246,163, 29,168,110,209,183,183, 91,
+200,247, 59, 43,177,137,194,209, 38,114,154,126,206, 88,247, 78, 57, 62, 90,211, 13, 43,198,144,121,228, 61, 31, 30,219,215,111,
+142,224, 71,237,132,221,  9,108, 59,112,119,142, 71, 39,129,176,178,153,113, 31,172,210,117, 95,171,109,104,117,197,203,109,162,
+253,180,112, 20, 29,251,219, 59, 78,134,137,246,248,156, 16, 61,119, 83,129,125, 65,211, 99,198, 30, 14,  2,117, 55,114, 52,244,
+156, 46, 46,175, 88,117, 25,146, 22,121, 63, 47,  9,143, 86,168, 78,233, 18,212,221, 68,149, 25,213, 70, 55, 58,  6, 15,217, 59,
+186,185,216, 96,151,108,133, 57, 75,179, 84,213, 92,105,109, 36, 14, 71,184,162,180, 58, 33, 56, 82, 48, 82,105,149,108,175,165,
+122, 90,115, 20,138, 89,164,116,233, 42,105, 66, 71,160,213,106,190, 54, 60,234,  3,163, 10,159,222,122,194,103, 47,217, 93,220,
+216,133,117, 25,160,162,177,150, 23, 89,245,161, 88, 94,151,  6,179, 69, 38,119,218, 12, 67,250, 64, 89,115,186, 72,216, 22,161,
+114, 56,163,192, 45,210,172, 54, 59,217, 91,112, 11, 49,138, 37, 39,109,  6, 21,215, 89,105,137,229,107, 45,  3,158, 22,183,118,
+ 91, 14,102,175,214,111,238, 29, 54,117, 99,217,247, 66,123,203,145,215,133,247, 30, 31,148,118, 53,167,186, 41,  4,134,212, 12,
+222,131,216,119, 54, 70,183, 51,160,195, 98, 68,112,222,178,201,193, 47,166,176,166, 84,105, 68,122,188, 66,244, 29,173, 41,196,
+138,136, 21, 80, 24, 47,220, 50,244,210,132,184,180, 73,228,170, 11,154,214, 89, 68, 48,152,121, 48,161, 84,169,144,173,238,181,
+239,143,204, 88, 19,  7,130, 42, 63,249,193,127, 96,206, 51,189,235,233, 26, 22,115, 74,  9, 41, 25, 23, 28,195,176,225,168, 31,
+216,237,183,228, 82,105,109,166, 74, 38,122,111,209, 51,231, 44,182,181,178,106,220, 86,218,226,174, 52, 83,187, 46, 60,237,218,
+172, 21,203,164,122, 97,222,239, 56,236, 71,251,217, 46,209,194,232, 19,222, 57,234, 92, 44, 26,228,140,254, 39, 11, 26, 88,150,
+178,154, 71, 79,223, 97,232,123,110, 14, 35, 42, 98, 56, 97, 49, 92,112, 21, 37, 20, 65, 70,101, 28, 26,209, 39,250,104,170,137,
+180, 30, 52,211, 13,131, 77, 36,181,178,223,239,201,243, 68, 63,116,100, 17, 90,243, 68,  9,212, 90,173, 25,207, 59,166, 90,  9,
+222,177,146, 14,169,141,159,124,114,193,249,233, 19,158, 31, 63,165,239,132,169, 56,202, 44,214,126,164, 29,174,117,228,186,131,
+108,241,196,161,247,100,233, 57,104,198, 57,139,103,105, 16,196,247,182, 22,105, 25,105,  3,149,201,204, 85,170,196,165,120,161,
+228,106,  0,165,102,176, 23,230,138,122, 79,115, 66, 74,142,105,223,232,135,132,155, 70, 66, 72,164,216,243,181,231, 79,121,253,
+250, 75,230,186, 76,189,206, 76,148,242, 16, 25, 21,131,255, 84,  7,243, 60,241,201, 79, 63,231, 39,159,125, 69, 41,178,224,135,
+141, 54,214,245,198,229,238,187, 72,240,129, 67,153,144, 90,237,226,189,  8,145,255,242,183,191,205,217,217, 41,179, 79, 84,129,
+166,129,170,137,251,237, 21, 74,163, 17, 44, 50, 38,205, 90,209,130,163,214,194, 97,127,203, 48,172,129,100,187,104, 53, 53,236,
+176,219, 19,156,176, 62,234,113,226, 25, 15,  7,174,222,124, 69,215,159, 81, 68, 56,236,239, 73,210,248,232,253,196,201,163,158,
+221,221, 72, 31, 87, 60,126,242,152,155,171, 75, 78,143,143,121,255,197, 47,178,122,124,198,127,246,235,207,249,252, 18, 46,111,
+ 50, 65,225, 54, 42, 47, 47, 50,241,248, 28,137,129,221,118,203,209,163,199, 28,175, 79,185,219, 95, 35,186, 48,160,213,246,156,
+165, 64, 92,224, 87,110,169, 67,118,203, 20,110,198, 83,187,128, 42,134,135, 86,111,131, 71,195,226,173, 94, 44, 97, 35,210, 32,
+ 88,170, 67, 84,169, 44, 81, 80,181, 74, 82,113,137, 76, 33,226, 73,189,231,233,179,119,153,234,129,233,110,100,232, 10,223,254,
+246,  9,223,253,193,  1, 45,130,182,192, 52,142,139,161,184,103, 87,102, 18, 74, 33, 82,139, 91,214, 35,158,135,108,216,202, 15,
+168,116, 52, 49,205, 91,103,104,209, 67,114,212,241, 30,159, 86,184,100, 73,149, 42,129, 86, 21,223, 67,107,158, 12,134,136, 46,
+ 13,183,105,196,108, 23, 87,153,109,240,240,222, 83,155, 71,216,177,138,145,232,132,210,238,112, 18,208, 16,153,195,129,208, 60,
+161, 54, 14,140,104,174,120, 13,204, 76,212,173,129,123,194, 96,133, 35, 45, 29, 83,139,242,253,221,103,188,252,242,154,156,  3,
+ 18,149,225, 88, 25,220,128,243,142, 97, 72,188,186,248,144,244,253, 99, 52, 42,249,176,229,197,211, 19,220,166, 35,103, 37, 28,
+ 31,129,246,111, 91,  4,157, 22,142,142, 35, 49, 58, 78,214,171,133,130, 99, 47,113,112,224,187, 72, 91,106,175,211,240,115,133,
+ 96,202, 16, 85, 56,238, 60,253, 26,246,197,241,110,132,163,229,143,116, 43,248,204,121,116,231,  8,181,241,209,243,115,126,237,
+ 23, 31,115,171,144,  5,102,247,136,204,158,151, 46,208,178, 82,238, 51,208,179, 59, 64,221, 89, 68,174, 93,101,227, 93,108, 22,
+ 37,229,106,199,241,243, 99,226, 58,208,121,184,189, 17,246,183, 55,132,214,131,115,228,125,161,150,  3, 49, 40, 78,109,216,168,
+  4, 36,139,197, 93, 93,165,140,138,214, 70,140,157,149,135, 73, 35, 52,161,230, 25, 41,131, 49, 13,136, 20, 17,212,205,  4,141,
+104,118, 72,155,223,182,146, 58,231, 33, 88,173,171,170,163,204,214, 65, 18, 30,162,231, 14,206,142, 34,167, 31,125,147,250,244,
+ 63, 38,125,250, 71,212,241, 43,180, 57,180,118,196,182,180, 20,171, 10, 20,  3, 45,184,133,118,246, 48,241,217,108,101,212,183,
+228,157,177,104,173,  6,  9,109, 98,134,185,106, 55, 97, 23,197,118,243,152,212,137,179,239,221,150,  7, 37,222,211, 17,169,174,
+ 48,182, 70, 88, 56,237,226,108,  2, 87,113, 11,113,201, 38,249,234, 45,183,170,106, 17, 42,143,194,130,157, 93,144,221, 40,182,
+251,110,213, 38,250,232,162, 69,197,156, 46, 15,212,102, 53,177, 49,216,102, 64, 11,170,113,145, 40,205,244, 21,156,167, 34,136,
+122,164,121, 98, 90,214,  2,202,  2, 51, 49,156,163,171,101, 81, 86,132,114,176, 78, 31,245, 14,151, 28, 46, 45,146,254,188, 24,
+123,106, 69,124,198, 71,219,255, 87,108,175, 45, 98,230,150,150, 35, 55,229, 13, 35,202,239,254,171,255, 18,157,110,184,120,249,
+ 41, 23,187,107,218, 62,147,156, 99,202, 51, 93, 90,243,238,139,175, 81,230, 74,113,194,122,213, 81, 14,247,236, 70,219, 31,111,
+111,111,201,101,102,222,239,  9, 41, 17,213,218,117, 92,236, 24,146, 35, 14,145,104, 68, 13, 90,131, 16, 35,135,237,204,171,235,
+175, 56,140,243, 82,155,106, 44,252,182, 24,228,250, 85, 71,157, 10,201,  5,178,155,200, 98, 81, 70, 71,225,252,236,148, 15, 63,
+248,128,253,110,199,245,229, 27, 84,237,242, 52,137,225,108,115,206, 16,237, 66, 34,181,161, 49,224,170,224,179,210,188, 16, 82,
+207,241,209, 10,180, 33, 90,185,190,186, 68,213,179, 94,173,108,111, 36,176, 58,222,224, 22,122, 88, 80, 37, 58,115,157,167,216,
+ 49,183,198,120,125,197,211,211, 99, 82,106,196, 38, 80,204,165, 31,130, 85,232,162,153,228, 18,210, 57,202,220,104, 35,168,223,
+226,219, 66,201,243, 30,239, 19,181, 22, 52,131, 11, 74,174,153,216,  9,213, 43,177,  0, 93,135,115, 61,170,153,185, 20, 36, 91,
+109,102,223, 41,174,154,122,225, 17,164,130,180, 10, 46, 16, 18,132, 42,156, 61, 62,225,228,236,152,139,139, 27,130,139,104, 51,
+ 63,132,247, 97, 49,165,217,202,232,116,213, 81,100,207,237,126, 71,109,249,109,124, 16,245,184, 10,197, 21,212, 65, 46,  6,218,
+ 96, 89,145,229,170,203, 26,197,243,197, 23,151,108,243,196,253,120,193,106,125,202, 59,239,189,195,246,171, 55,252,195,143,127,
+200, 16, 18, 33, 26,224, 41,134,136,212,  6,209,227,171,167,204,149,174,131,110,112,236,239, 38,220, 16,217,237,183,104,171,244,
+103,199, 86,138, 18,236,130,252,234,213,151, 28, 31,143,172,134,196, 56,205, 12,125,199,212,132,251,221, 87,228, 81,184,122,115,
+ 73, 27, 11, 41,245,164,213, 25,117,158,217,143,153,139, 85,199, 92, 42, 83,201,132,213,  0,179, 99,187,207,248,116,204,147,179,
+ 39,220,222, 94,115, 38, 14, 93, 15,176, 15, 72,153,205, 72,216, 44,146,134, 83,131, 57,105, 88,218, 32,237,240, 83, 21, 66,234,
+108, 21,164, 51,  8,116,157,169,115,181, 69, 28, 13,159, 30, 12,133,134,167,110, 75,110,220, 59,208, 98,153,117,113,150,140,  8,
+165, 48,105,230,205,254, 13, 77, 10,239, 60,127,198,163, 39,239,242,249,205,207,184,191,203, 28,135,200, 59,231,145, 47, 94,103,
+200, 70, 64,212, 37,  6, 40,116,224, 29, 82, 51,208,112, 30,114,173, 22,177,213, 70, 11, 61,115,155, 80, 25, 41, 17,154,  4,162,
+ 76,180,220, 25,239,162,205,108,247,138, 46, 53,104,177, 10,178,244,110,135,169,210,134,138, 52,135,219,139, 65,182,164,167,235,
+ 19,161,102, 36,195,224,  6, 14,109,100,231,215,120, 18,154, 71, 58,223,161, 76, 22, 11,214,181,145, 27,  1, 41,133, 89,151,215,
+ 85, 29, 67, 31, 24,243,196, 84, 70, 54,125,133,245,128,204,133,157, 87, 90,139,180,172,236,199, 76,159,122,171,204, 13,158, 79,
+190,184, 36,181,142,156, 34,110,206,156,157, 38,178,139,184, 80,120,167, 59, 99,245,151, 39,172, 87,137,203,121,228,254,122, 15,
+100,116,240,124,121,113,205,  7,111,222,103,117, 28,185, 60, 64,189,191,167,239,  3, 49, 58, 60,149,245,170,255,185,244, 93, 45,
+ 20, 16, 23,146,169,102,204,108,250,  0,146, 25, 33,207, 35, 99, 30,153,238, 42,143,191,179,226, 60,194,249,  3,227,100,227,121,
+114,116, 76, 26, 76, 70,255, 34,246,188,136,142,167,167,134,208,125, 57,195,237,250,156,211,115, 88, 43, 76,162,220,202, 49,183,
+ 41,216,129,175,240,229,181,112,127, 83,168,243,132,228,108, 43, 70, 13,196,180,240, 81, 90, 69, 74,179, 51,200, 53,106,109,230,
+ 55,138,142,181,171, 20, 21,178, 42,104,196, 77,107,202,116, 32, 56, 37, 57, 97,148,106,  7,127, 80, 92, 49, 26,168, 11, 44,207,
+ 39,131, 77,121,237, 45,230, 24, 65,169,104, 85,124, 23,160, 40,143,186,192,139,103, 79,216,118, 29, 63,165, 49,107,135, 59, 52,
+180,108,137, 34,134,166,244,193, 52, 19,239, 77, 63,113,139,179,188, 25,189,218, 14,115, 75,155,225, 22,200,137, 96,123, 97, 34,
+212, 98,147, 97,203, 14,162,129,102,104,198, 88, 55, 33, 77,233,146,183,134,180, 86,241,170,  4,177,184,155, 15,201, 48,128,205,
+ 14,108,231,171,113,191,197,147,107, 70,194, 18,167, 91, 58,241,122,239,200,205,163, 81,  9,106, 89, 63,197, 24,210,120, 43,239,
+112,132,183,107,132,130, 46,135,133, 46, 57,109,171, 23, 85,117,  6,177,  1,198, 34,164,224, 73,189, 69, 92,194,162, 70, 20, 45,
+ 20, 13, 48, 54,162, 83,219, 41,170, 25,247,162,235,240,209, 28,183,125, 52, 18, 94,206,141,206,121,138,204,118,201,113,134, 13,
+ 84, 81,232, 34,174,122,166,150,233,221,154,169,  8,251,253, 27,158,188,255, 29,190,241,226, 59,188,190,252,156,240,225, 83, 30,
+205,119,236, 14, 59,198,155, 47,217,237,239,216,110,239,249,225, 15,254, 18, 66, 79, 63, 12,188,251,206,135,116,105,224,163,143,
+ 62,226,228,241, 11,180,121,238,175, 94,115, 56,188,228,229,203,159,114,183,207,198,211, 70,233,194,128,142,158,236, 11, 81, 29,
+199,167,231, 60,127,239,107, 92, 95,189,230,245,197,119,105,173,129,143,166,142, 96,236,113,154, 80, 75,161, 73, 49, 20,111,215,
+179,  9, 61,130,181, 61,157,159, 63,198,  1,119,119,215,228, 86, 81,167, 28,173,  6,230, 92,120,232,102, 77,206,147,196,147,186,
+  8, 94,169,251, 74,236, 55,168, 78,204,101, 98,125,188, 90,170, 20, 43, 87,151,183,244,113, 81,107, 98,164,202, 76, 74,157, 21,
+ 34, 52,168, 82,136, 49, 89,126, 25,248,218,  7, 31,113,180,129, 87, 23,215,116,111,222,176,121,244,132,232, 29, 29,142,169,205,
+196,254,200,214, 44,147,162, 67,135,247,129,185, 30,240,173,225, 90,160,174,122,  8,130,211,158,164,149,169, 89, 53,106,244,144,
+178, 73,159, 26, 28, 37,103, 67,229, 54,136, 49, 82,162, 67,154,205,115, 41, 98,105,  0,167,164,100, 81,169, 32,208,166, 66,115,
+129,161, 63,226,189,231, 31,112,115,121,135,122, 83,145,  2,206, 58,222,245,  1,109,220,216,231,  3,251,233,142,103,239,157,176,
+223, 29,184,223,141,111,125, 42,115,110,180, 57, 47, 13,138,102,202, 67,252,146,114,104,139,129, 85,249,238, 39,175,249, 96, 63,
+209,173, 60, 95, 93, 92, 50, 28, 29,243,241, 79,127,204,110,183, 35, 28,157,208, 71,219, 63,139,143,150,227,175,213, 14,250,  6,
+ 49,  6, 54,233,152,156, 51,251,195,129, 60, 78,108,134,193, 98,155,234,144, 46,210,175, 55,200,197,  5,215, 87, 95,114,124,124,
+134,247,  3,185, 86, 62,249,241,223,115,124,218,241,222,243,111, 50,214,239,243,249,151,159,162,  8,199,143, 79, 24,245,192,  7,
+231, 79,185,222, 86,123,248, 23, 97,200,149,131, 58,182,  1,230, 61,124,240,225,135,220,222,188, 97, 46,123, 86,199,143,233,135,
+ 13,247,119, 35,218,132, 24,226, 66,  2, 52,122,151, 58,195,246,166, 24, 45,107,174,130,171, 70,132, 20,105,120, 31,192,  5,124,
+180,173,121, 67, 44,105,224, 12, 41,236, 66,248,121, 12, 55,152, 31,200, 46, 79, 38,239,231, 37,221,160, 34, 92,223, 92, 65, 83,
+198, 60,227,125,229,250,250,154, 39,155, 39,252,254,127,247, 47,248,163, 63,254, 49,127,252, 39,127, 69,174,  6,137, 74,235,206,
+106,146, 43,164, 96,181, 86, 50, 11, 62,205,120,223, 81,106, 96,156,182, 52,  7, 74, 71,215,172,174,186,230, 29, 42,  7,179,255,
+198, 13, 72,161, 28, 38,186,213,154, 26, 20, 87, 27,222,245, 84,159,209,226,136, 33,209,198, 74,117,158, 20,205,192, 92,197, 90,
+ 38,231, 84,169,179,224,100,194,  5, 51,155,214,176,181,232,218, 44,148,148,  9, 58, 16,171,145,243, 93,231,144,168,164, 82, 41,
+ 37, 82,107,181, 65,168,120,220, 88, 16, 28,101,156,  0,165,136, 18,130,210,176, 11,191, 31,123,154,236,233, 86,  3,125,115,212,
+216, 56,236, 61, 89,  7, 36, 23,238,227, 30,247,250, 53,174, 21, 98, 50,118, 71,243,208,167,129,191,126,243, 19,126,248,241, 27,
+ 54,195,  9, 57, 10,174,220,115,114, 22,232,143, 86,180, 41,177,127,255,107,188,247,193, 57, 93,244, 92, 92, 23,154,142,132,251,
+ 19,210, 28,136,147,210,157,252, 28, 21, 51,102,200,101,180,116, 85,239, 57, 57, 30,254,  9, 84, 70,196, 86,138,109, 41, 26, 27,
+ 68, 89, 39,255,182, 71,125,173,112,186,129, 71,203, 69, 97,194,241,228, 60,112,244,243,123,  5,211, 20,  9,146,104,135,157, 41,
+ 63,169, 50,141, 86,214, 20,235,100,134, 78,159, 72,201, 46,142, 50, 46,109,144,210, 44,179, 31,109, 40, 81, 39,132, 96,173,157,
+118, 69,169, 56, 49, 12,123, 93,160,232,193,123, 74, 81,164, 86, 82,112,120,183,178,179,214,  7, 91,245,202,178,214,104,  1,135,
+176, 58, 77,248,254,148,171, 29,204, 45,147, 58,193,233, 49,174,215,135, 29,191,190,157,122,237, 96,183,195, 79, 84,151,155,231,
+  3, 13,110,129,187, 60, 20,127, 44,109,170, 97,249,128,212,182,116,219, 57,103, 21,144,178,236,116, 19,111,177,143,210, 22,203,
+106,176,250, 86,156,185,207,195, 98,138,107,139,228,217,212, 66,252, 49,218,206, 88,150,210,  2, 36, 82,171, 55,170,157,218, 30,
+191,106,193,171,201,238,178,244, 47,123,  7,218,138, 85,138, 46, 50,123,240, 86, 51,235,196, 17,196, 62,208,213, 57, 98,122,168,
+136, 16,106, 14,  6,179,240, 13,173,206, 88,234,209,106,  8, 15, 40,125,151,104,179,185,161,  9,208,185,165,219, 87,156,253,220,
+ 48,213,  1,  9, 72,140, 52,117,196,234,136, 78, 23,120,141,197,111,230,121, 66, 90, 34,172, 54,124,235, 59,191, 68,201, 91, 14,
+119, 35,243,172, 48, 43, 46, 11, 45,121,186,147,133,250,164, 74,203, 35, 57, 31,216,239,110,240,  4,134,190,167,169,231,232,248,
+148,190, 31,  8, 33, 50, 87,143, 91, 64, 30, 34, 54,233,  5,  5, 87, 97,162,146,111, 47, 56,121,250, 46, 71, 71,  3,211, 56,129,
+ 11,246,138,170,162,206, 50,248,121,158,241,213,189, 85,104,188,143,182,115, 70,137, 49, 48,141, 19,151, 23, 87, 28,246,123,154,
+ 52,134, 85,207,209,209,154,155,235, 91,136,182,139, 15,209,140, 97,213, 23,203, 18, 87, 40,190,224, 18,196, 20,233, 87, 27, 66,
+ 74, 32,158,253,126,162, 63,179, 86, 57,113,134,  3, 61,121,126, 70,252,161,103, 26,243,219,110,  0, 23, 60,215,183,183,188,120,
+113,206,227, 71,199,188,186,218,113,250,232,212,146, 14,189, 67,102,150, 85,210, 68,201,201,144,160,187, 61,190,245, 16, 34, 85,
+ 22, 14, 65,181,203, 73,244, 70,113,115,189,229,211, 93,238, 56,180, 70, 11, 51,155,152, 40, 89,104, 73,136,  2,157,128, 70,  3,
+ 49,245,179,167,174, 18,206, 67, 96,166, 91, 37,202, 78,144, 54,226,162, 39, 55,161,185,200,147,231,143,121,252,213, 35,222, 92,
+223,144, 98,180,215, 31,195,148,186,102, 74,193, 56, 86,174, 94,237,120,255,131, 71,188,255,252,140,191,255,233, 68,109,205,234,
+140,253,210, 81, 32, 15, 29,225, 15,134,177, 98,223,107,121,207,  5, 60,219,253,200,179,179, 83, 82,171,124,246,217, 79,184,186,
+190, 53, 78,  2,149,208, 29,211,164,145,130,103,136,199, 72,206,140, 58,146,231, 66,158,103,208, 13,222, 39,164,237,105,205, 92,
+219,126, 22,106, 11, 68,151, 88,167, 53,235,245, 17,151,215,215,140,211, 27, 86,235,213, 98, 82, 85,198,237,  1, 61, 19,  3, 72,
+181, 70,215, 13, 60, 59,125,143,163,147, 19, 83,229,122, 40,247, 14,124,199,172,133, 54, 55, 62,121, 61,113,183,207,172, 78, 31,
+179, 57, 59,227,254,238,150,163,225, 49,155,213,154,221, 46, 44, 21,199,126,233, 30,176,216,166,168, 97,169,173,165,206, 76,149,
+ 66, 35, 69,165, 76,  6,164, 42,190,226,232, 77,213,195,224, 85, 94,163, 65,109,212, 88, 12, 86,169,236,  9, 88, 76, 83,229,161,
+157, 80,145, 96,207,  2,135,227,118,119, 99,178,170,119,236,101,226,242,238, 13,143,223,255, 55,252,230,119,246,252,251,191,138,
+ 80, 61,131, 27, 24,235,150,210,130, 85, 38,171, 91, 36,101, 33,165, 21,173,121, 66,106,204,181,129,135,212, 85,242,210, 51, 17,
+ 21,232,140, 83, 97,240, 41,187,240,145, 50,243,190, 24,232,200, 27,240,167, 57,161,142,  7,162,122, 98,223,227,197, 49,141,149,
+208,153, 34,170, 98, 28,254, 86, 51, 33, 23, 66,108, 32,137,198,204,152,133,164,112,104,247,168,  6,214,199,  3,229,208,136, 68,
+170,120,196,239, 45, 25,161,142, 89, 43, 65, 38,196,  7,107,191, 11,230,  5, 82,215,227,117, 54,186,102, 29, 97,  8,212,170, 84,
+ 49, 19, 92,201, 43,188, 63,216,101,179, 10, 46, 30, 33,174,161, 85,232, 99, 99, 44, 30,225, 64,149,196, 97, 44,220,186, 27, 74,
+ 27,145,228,233, 46, 60,105,117, 76,157, 29, 63,250,248, 75,130,239,136, 36,124, 84, 98, 20,214,125,143,235,  3,157,143,124,249,
+226,125, 78,159,156,178, 94,247,124,250,234,158,203, 47,223,176,241,214, 52,169, 26,255,  9, 19, 94,171, 69, 88,133, 96,205,105,
+ 89,232,207,126,126, 41,168,  2,253, 63,  2,201, 59,177, 60,255, 63,254,117,152,148,253,253,158, 41,239, 17,153,105,  1, 68, 38,
+ 27,150, 22,122, 92, 81, 35, 77,186, 42,168, 86, 74,141, 52, 58,148,140,148,153, 84, 60,174,115,140,171, 23,212,195,151,168,236,
+169, 83, 37,116,142,130, 95, 90,  8,109,109, 27, 68,168, 96,170,138, 47, 84, 45, 68, 99,177, 98, 87,219,104,116, 87,113,156,  4,
+ 71, 23,142,144, 34,244,  2,210, 41,187,237, 37, 43,231, 77,169, 13,139,217,173,169, 29,186,193,189,141,149, 63,112,117,168,106,
+192, 23,151,156,201,235,203,254, 88, 68,209,217,128, 43,205, 41, 49,184,101,234,118,164, 96,125,198, 56,203,111, 59,103,187,121,
+197,150,224,226, 28, 62,218,238,184, 70, 37,  6,147,172, 61, 17,167, 70, 87,162, 45, 44,118, 35,200, 24,223,221, 45,209, 53,177,
+105,218,121,171,141,141,222, 94, 44,239, 44,150,101, 14,216,229,129,160,144,194,207, 27,179,130, 51, 88,189,138, 29,216, 62, 90,
+156,207,163,132,  5, 56, 19,162,163,102, 53,186,216,208, 25, 25,174, 42, 77, 23,153, 63,  6,107,171, 67,145,234,151,222, 92,195,
+185, 58,183, 84, 16, 56, 71,205, 14,159, 34, 82, 77,166,  9, 62, 49,205, 51,251,195, 76,109,247,252,221,159,255, 95,120,127,202,
+227,179, 15,249,230,135,239,211,157,126, 11,230,204, 63,252,236,111,248,226,243,159,218,  5, 37, 24,173, 78,176,250,218,224,148,
+146,149,220, 42,187,221, 13, 78,133, 46, 13, 12,199, 39,196,193, 58,229,131, 58,124, 81, 90,172,196, 96,249,  4, 31, 58, 78,142,
+ 31,115,255,213,143,168,173,225,147,193,104, 84,221,178,159, 15, 20, 45,180,102, 26, 77, 67,241, 45, 25,198, 84, 11, 33, 69,138,
+ 20,242,238,142, 92,205,109,122,178, 94,225,117,233,155,214,229, 77, 25, 28, 49,121,219,105, 70, 15, 41,208,135,142,121, 62, 16,
+ 66,228,244,100,195,106,221,113,127, 51, 18,186,142,205,201,192,106,125,130,106,162, 76,149, 62,246,196,148,104,227,193, 28,192,
+115,229,197,251,207,153, 51,140,219,145,240,232,132, 95,248,250, 55,121,255,197,115, 42,129,150,173,141, 43,132, 21,178,228,212,
+125, 53,153, 90, 66, 49,198, 53,141,190, 79,196,154, 49, 42, 66, 91,222,151,129,105,223, 72,100,170, 52,196, 67, 65,104, 26,240,
+115,165, 14,246, 51,225,144, 45,183,174,214,122,215,173, 19,117, 20,230, 41, 83,114,197, 71, 71,140,  3, 94,246,200,184, 39,132,
+196,175,254,242,175,242,211,143,127,200,151,175, 47,205,108,234, 61,168,221,230,141,188,159,216,141,  7,212, 61,166,219, 12,116,
+125,100,220, 90,150, 85,162,105, 92, 49, 44,229, 37,234, 44, 18,186, 16,201,112,198,115, 32,192,118,170, 76, 63,187, 49, 73,222,
+111,109, 13,161,206, 12, 92,165, 18,131, 65,159, 98, 80,180, 11,116, 50,176, 45, 66,206, 19,210,172, 33, 77,107,163,230,145,146,
+108,114,112, 88,158,221, 71,243,195,168, 40,173,206,236,246,133, 20, 34,155,245,154,146, 65, 98,130,206, 86, 79,143, 78, 79, 89,
+159,111,200, 45,112,249,229,  4, 76,164,238,136,169,  4, 98,177, 34,197,251,253, 72,107,194,166, 31,120,247,233,251,124,255,213,
+ 95,179,219, 94,177, 62,123, 68, 63, 28, 51,239,175, 41, 11,163, 61,  5,255,182, 38,215, 47,228, 69,187, 92,154,163,127,154,171,
+117, 54,121,165, 86,165,204, 35, 93, 26,232,215, 27, 52,207,204,243, 72, 76,105,233, 51,136,132,104, 80, 27,188,173,  7,213,  9,
+177,115,120,215, 64, 13, 20,226,189,209, 47, 93, 12,184,  0,100,229,255,249,211,239,242,141,111,252, 33,223,248,232,  3,126,227,
+215,191,193,231,175,110, 64,  2, 55,123,199,213,253, 22,239, 19,174,  5,130,159,168, 94, 81,  9, 36,223,200,217, 36,115, 92, 66,
+139,165, 76,130,  4,212, 85, 66, 77, 11,145,243,222,156, 73, 30, 92,233,241,174, 81,212,122, 48,172,  3,161,144, 98,  7, 41,146,
+141, 61, 12,222,211,180,218,228,217, 58,154,179,116,131, 56,  7,179,165,108, 96, 68,177, 21, 30,173,208,245,199,  6,202,241,133,
+221,126, 71,148,  8,189, 67,199,138, 58, 71, 93,247,232, 44,148,118, 32, 49, 16, 93, 71,174,138, 31, 42,147,100,214,206, 17, 66,
+199, 30, 97,156,246,  8, 35,177, 83,154,207,248, 18, 33,154, 34,229, 68, 40,226, 16,118,212,220,209,122,161,102,143, 20,207,208,
+ 57,114,236, 13,193,155,119, 20,103,159,  5,241,224,239,154,165,142, 90, 71, 77,208,213,202,205,106, 96,170,149, 21,137,207, 62,
+121, 69,110,158,181,235, 16,221, 51,181,201,152, 36, 67,199, 31,254,201, 95,243,221,159,188,207,240,244,152, 81,  3,135,171, 43,
+158, 61,118, 28,159, 28,155,177,117, 23,120,247,228,  5, 71,105, 73,105, 21,  8,255,168,237, 69,108, 51,252, 79,126,221,238, 51,
+247,187, 59,124, 45,204,211,132,232,  1,241, 51, 77, 60, 99, 50,229,  5, 49, 19,115,240, 17,215, 39, 14,251,137,206,175,240,206,
+145,139, 69,223,158, 61, 61, 34,156,127,157,253,229,  5, 50, 10, 93, 12,180,150,141,159, 17, 61, 84,123,158, 55,247, 64, 66,141,
+111,227,228,213, 59,188,184, 37,154,108,207,184, 92, 10,243, 78,105, 23, 23,108,111, 51,251,121, 71, 24,149, 94,236,182, 18, 81,
+ 79,109,197, 36,170,  5,227,170, 11,140,196,171,237,174, 68, 22,103,131,  3,169,182,215,118,222, 19,156,183, 82,131, 96,127, 55,
+169,145,169, 80,136, 24, 69, 45,250, 98, 84, 58,162, 33, 76,189,229,222,173, 43,221,234, 15,181,139,200,210,122,101,197, 42,246,
+128,116,120, 51,122,  5, 71,109,101,217, 93,216,161,236,124, 64, 60, 36, 13,136,218,215,170, 90,249,  8, 78,150,138, 73, 89, 72,
+107,160, 90, 77,254,240, 17,239,236,239, 58,191, 52,199, 57,107,116, 11, 41,162,190, 82,150, 56, 86, 12,145, 20, 42, 77,236, 80,
+ 14,173, 48,138,218,  5,160,202, 82,133,106, 32, 30,231, 33,183,182, 16,234,  2,  1,235,164, 87,  2, 18,148, 96,153, 65,251,186,
+ 87,238, 47,111,248,248,147, 47, 64, 28, 63,253,201,247,  9, 49,178,234,215,252,229,122, 67,191, 57,229,217,227,247,233,163, 99,
+ 62,220, 27, 34, 50,215,165, 24, 70, 30, 20,110,115, 41,107, 88, 12, 88,142,167,167,199,184, 20,201, 18, 25,210,128,119,142, 70,
+195,135, 53, 82, 71, 90,203, 56,141,244,189,227,243, 87,159,227,151, 53,137, 69,157,150,127,183,131,226, 45,165, 96,210,149,241,
+  8, 68, 45, 97,112,122,116,134,211,198,118,220, 83, 23,201,242,252,244,140, 60,238,104, 98, 13,114, 78,109,218,113, 93,135,206,
+198,237, 71,149,171,114,203, 48, 56,230,169,177, 89,109,120,124,122,194,213,229, 29,189,172, 24,226,192,250,120,195,201,233, 17,
+ 58, 59,180, 38,214,253,138,157,155, 80,132, 34,133,175,127,244,132,243,205, 17,127,244,103,127,205,227,119,206, 57,123,250,158,
+153,158,202,196,186, 37,180,247,180,216,153,225, 43, 23,156, 84,112, 61, 45, 85,218,164,196, 52, 80,154,229,249,155,247,228,113,
+ 38,249, 72, 72,150,162,104,181,226,131, 73,145,101, 20,124, 20,154,247,150,247,167,209,165, 72,169,224,250, 74,  8,145,150,103,
+186,206,145, 91,160, 56,179,164,  4, 32,197,222, 46,146,115, 68,186,202,147,231,231,220,239, 14,220,221,236, 77, 74,246,142,152,
+ 58, 68,132,185, 21,214,213,113,115,127,199, 87,111,182,124,240,238, 35,222,123, 46,124,246,217,107,198,210, 56, 62, 90,241,222,
+251, 79, 72, 78,249,248,227, 87,108,247,197,248,229, 34,248,206,226, 95, 18,172, 13, 81,100,121,207,247, 70, 73, 84,177,124,252,
+118,183,231,228,228,132,105,202,236,247, 91,214,171, 21,155, 97,195,106,189,226,118,127,224,126,123, 67,203, 51, 57,207,172,214,
+ 71, 12, 67, 79, 85,152,166,130,248,204,118,159,  9,195, 96, 40,232,250,128, 49, 21,124,240,212, 92, 80, 85,162,139,132, 46,176,
+ 90,119,228,195,204,237,224,248,193,255,247,191,115,118,124,204,119,126,227,247,168,177,153,211,252,160,220,220,237,136,109, 75,
+ 47,149,231,207,158,243,233,201, 49,119,219,107,134,205, 49,155,126, 69, 25,205,225, 27, 30,184, 19,174, 45, 41,155,133,143,190,
+ 20, 54,181, 34,246,236,146, 96, 49,183, 24, 81,109,156,158,157,243,225, 47,254,  2,173, 84,238, 46, 46,120,245,250, 75,187,228,
+ 47, 41,141,232,  2, 56,107,138, 12,178, 36,104,130,135,154,145,197,236, 41,197,208,216,113, 25, 10,126,242,242, 75,254,221, 31,
+252, 33,255,195,127,255,223,240,175,127,239,183,248,223,254,224,143,249,233, 39, 95,176,234,123,126,247, 55,126,145,191,255,228,
+ 75,238,118,123,212, 69,124, 54,169,181,116,205,202, 96,212, 17, 58,104, 69,240,213,227,123, 91,143,145, 13, 33, 42,  2,212,134,
+174,  3, 97, 50,222, 66,138, 54,245,  6,215,152,179, 48,197, 76,202, 16,162,152,  9, 14,200,135,204,106,216,160, 28,144,108,241,
+204,234,173,207,162, 77,158,160, 13, 92,134, 85, 71, 44,  3,165, 56,202, 52,226,186,137, 46, 37,100,154,201,147, 95,148,198, 74,
+167, 30,241, 11,135,  1, 67,145,102,157, 88,183, 30, 25, 51,163, 43,196,184, 54,111, 81,174, 40,246,222, 71, 51, 49, 28,145, 73,
+168,220,195,242,204,100,104,228,124,143, 76, 64, 58,193,215, 61,186,180,252, 57,146, 93,198,194, 72,110, 19, 82,123, 86,238,148,
+ 42,247,212,114, 64,231,200,236, 34,174,238,113,140, 52,183, 98, 47,141,224, 26,247,218,177,238, 11,226, 61,109, 82,122,223,248,
+209, 87, 35,255,240,197,231, 68, 25, 40,209,227,147,208, 77, 21,215, 25, 83, 36,196,192,159,255,237, 51, 78, 54,103,244,113, 67,
+158, 43,239, 60,143, 60,127,126,202,217,201,138,235, 61,156,169,231,131,143, 78, 89,175,108, 15,127,119, 53,242,248, 28, 86,238,
+ 93,182,183, 29,165,238, 80, 55, 81, 14,102,152,172, 65, 17,103,171,151, 67, 45,184,193, 19, 82,143,182,  9,231, 76,237,142, 73,
+ 57, 62,234, 24,125,135,140,  7,186,216,168,206,  8,161,170, 86,166, 86, 90,229, 80, 76,249,114,222,210,104, 97,233,215,200, 40,
+205, 89,218,203, 98,209,  1,239, 61,183,110,195, 15,238,143,185,184, 58,144,184,183,245, 33,137,156,242,178, 83,199,204,106, 14,
+ 43, 61,104,117, 65,169, 58,193, 58, 81,252,226,124, 23, 51,130,121,139, 90,225, 13,103,106,249,117,143,249, 60,244,173,123,221,
+187,182,160, 75,141,176, 70,176,195,214, 97,123, 74,231,148, 20,149,169,153,124,150,188,160,205,242,166, 42,129,232, 42,  4,147,
+216,189, 26,247, 90, 84,169, 77,232,240, 84, 10,179, 40,209, 57,130,179,189,112, 85,197,249,246,143, 84,  6,115,203,187,176, 92,
+131,154, 44,172,230, 72,169,149,228, 59,130,199,130,255,181, 17,156,253,191,145,165, 68, 38, 38, 84,133,105, 55, 25, 16,192, 27,
+ 24, 71,164, 49, 31, 26, 26,194,242,189,173,207,220,227,104,209, 26,150,156,218,110,194,227,168,206, 81,107, 99,149,220, 50,100,
+153,210,161,222,176,164,222, 57,106,205,108,183, 51,119,219,107, 46, 94,253,212, 34, 72, 97,153, 22, 44,137, 99,182, 69, 93,242,
+231, 30,139,249,137,209,252, 66,151,104, 75, 12,198,227, 40,206,227,187, 68,223, 29,243,173,175,253, 38, 87, 23,255,192,229,182,
+ 50, 29, 26, 55, 87,111,222,198,226,  4,139, 79,  4, 18, 99, 57,216, 52, 17,108,117, 98,105,  7, 97,158,103, 30,157,156,112,126,
+210,113,121,121, 71,205,153,138,114,188, 26, 56, 59, 59,225,179,221,173,169, 48,162,224, 26,189,179,104, 18,193,177, 82,184,217,
+223,113, 59, 70,186, 59,199, 23, 47,191,199,250,244, 20,161,231,236,232,148,224, 29,111,174, 38, 86, 39, 35, 71,231,153, 24, 18,
+125,215,113,126,118,204,213,205, 29, 49,116,116, 93, 96,191,159,184,189,219,241,230,250,128,115,  3, 71, 67, 34,103,161, 75, 66,
+ 92, 41, 99,174,180, 67, 35, 97,128, 23,240,136,107,118,160,251,158,220, 10,110,174,248,206,145,151,162,154, 74,160, 22,135,104,
+165,115,129, 92,148, 42,145,192, 76, 83,103, 85,184,213,211,187,140,247, 27,196, 87,146, 15,214,248, 85, 50,115,  8,212,234,169,
+ 84, 98,  3,105,  5, 15,246, 80,235, 26,119,215,111,208,185, 90, 78,122,121, 87, 90, 97,144,121, 48,168,149,219,109,227,254,135,
+ 95, 49,151,194,217,215,122,126,225,235,207,248,206, 47,127, 72, 19, 97,123,121, 75, 63,172, 56, 76, 35,171, 85,199,221,118,162,
+235, 28,171,213, 64,174, 22,241,  4, 65,131, 85,  1,227,148, 92,140,116, 24,131,149, 63,156, 14,194,111,255,214,115,190,251,195,
+151,124,254,241, 61,231,167, 39,108,206,143,209, 93,131,187, 45, 55,215, 23, 56,224,217,243, 15,120,250,228,  9,126,232,113, 10,
+165,121,166,125, 70, 28, 28, 31, 63,198,135,142,237,213, 53,227, 60,162, 78,104, 98,245,162, 27, 10, 29, 29,193,  7,178, 10, 77,
+ 42,218, 38,174,183, 23, 56,175, 76,203,238, 58,111, 51,187,220,152,198,215, 28,201, 29,179,175,172, 86,  3,239,188,251,  1, 63,
+251,241,223, 51,221,223, 18,195,192,241,241, 19,106,109,204,243,110,225, 95,152, 99, 61,245,150,162,152,218, 76,205,149,232, 61,
+195,250, 17,247, 55,215,132,152,  8,209,153,114,161,  2,185,225, 90,229,249,187, 79, 57,204,  7,110, 46, 46,113, 49, 44,253, 20,
+102,116, 12, 78,241,193,234, 75,141,157,241,144, 16,192,166, 97,167, 56,177, 84, 78,169,194,238, 80,112,195, 49, 79, 94,124,147,
+211,211, 63,225,227,159,252,  3,191,255, 59,191,195,127,251, 95,255, 43,254,237,255,241,103,252,223,127,252,183,236,231, 76, 31,
+ 29,234,102, 82,  1, 23, 55,148,166,212,253, 12, 71, 61, 93, 53,167,247,216,132,193, 71, 84,246, 20, 73,118,200, 29,  4,245,141,
+228, 19,115,174,184,208,104,179,149,217, 36,122,187,208,104,177,127,107,138, 16,132, 57,239,232,186,132,248,128,212, 70, 16,168,
+190,225,235,  1, 73,130,106,194,207,149, 18,193,139,153, 46,141,198, 54,209, 69, 67, 78,183,185, 88,145,200, 65,112,233,200,208,
+166, 34,148, 58, 82,235,196,168,  5, 52,224,155,103,150,108,165, 77, 46, 17,210,162,154,102,101,102,143, 58, 79,168,130, 23, 83,
+ 12,124,105,212, 41, 35,206, 19,219, 29,226, 29, 99,158,168, 18,112,105, 77,146, 25,157,150, 62, 14,151, 57,184, 59, 82,236,241,
+ 97, 99,245,220,146,153,243,150,147, 62, 81,230, 12, 65,168, 49, 18,202,196,174,  9, 65, 18, 62,194,174, 84, 98,237,113,117, 75,
+ 23, 38, 92,245, 52,129, 67,173, 48, 21,240, 27, 84, 50,183, 23, 87,104,141,164,116,  6,173,241, 31, 86,149,212, 26,126, 72, 16,
+ 54,116,181,113,118,116,198,209, 42, 82,188,242,249,171, 87, 28,118,111, 44,101,209, 12,249,186,218,156,144,206, 79,152,167,198,
+237,216,113,127,123, 65,140,183,196, 89,209,113,161,109,182,133, 14,169, 21, 21,232, 66,207, 62, 13,182,238,197,153,122, 92,172,
+ 37,148,100,117,227,169, 91,145,235,193,  6,204,210,104, 78,222, 22,143, 65,160, 58,243,126,149, 92, 24,  2,252,202,215,223,229,
+163, 95,249, 85,182,223,191,225,245,205, 15,168,108, 57, 28,148,239,124,116, 66,180,124,186,205, 99, 34, 75, 87,185,122, 50,178,
+ 62,150,  0,  0, 32,  0, 73, 68, 65, 84,104, 30,  9, 10,161, 17, 30, 36,243,229, 86, 27,253, 82,212,178, 84, 64,  6,171,164, 65,
+189, 91,200, 89, 86,198, 16,150, 51, 84,157,208,180, 46, 82,167,185,202, 69, 20,213,194, 84, 18,162,141,212,117, 68,231,201, 82,
+ 76, 74,119,139,235,221,  5,203, 88, 58,147,195,194,242,176, 86,175,214, 92, 38,230,212,111,106, 21,142,193, 89, 93,163,149,180,
+216,222, 13,239,113, 62,217,135,116,153, 66,113, 74,212, 96, 55,244, 20,232,106,163, 72, 35, 75,160,239,226,219, 98,122, 39,141,
+134,152,105, 40,218,234,161,149,165, 14,114,233, 92, 71, 28, 89,204,193,152,212,246,210, 72,195,165,128,115,205,194, 51, 75,171,
+214, 52,122, 82, 48,232, 77,242,209,140,106,216,247, 84,191,176,146,188, 93,  4, 68, 45, 50,231,130,201,161,194, 67,111,160,224,
+189, 25,255,140, 96,100, 32,136,237,246,192,163, 39,239,144,142,158, 50,116,167,244,157, 50,142, 35, 45, 59, 66, 92, 49, 78,153,
+117,223,243,249, 39,223,227,112, 56,224,221,  2,243, 88,138, 66,156,119, 72, 51,220,109,195,225,213,222, 92,173, 52, 30,157,157,
+242,248,244,132,233, 48, 51,150,106,242,100, 85, 86,171, 13, 49,  5,198,253,193,202,103,180,226,194, 64, 58, 90, 27,115, 62, 42,
+179,131,171,155, 29, 78, 31,113,177,187,226,110,119,203,246,176, 35,  6,199,249,163,119,108,189, 83,132, 79,126,252,  9,175, 95,
+126, 78,236,  2,169,239,185,189,185,103,179,142,116,190, 35,118, 29, 87, 55, 91,126,233, 87,127,141,127,253,228, 67, 54, 39,  3,
+ 49,109,240, 13,138,142,236, 23,251,168,132, 74,158,227,162,  0, 57,163, 80,141, 86,195, 27,122, 40,181, 99, 26,183,136, 15,184,
+190, 51,206,123, 81, 90, 45,236,151,154, 79, 97,178,221,170, 68, 66, 21,122,103,209,149, 97, 21, 65, 26, 53, 43, 41, 84, 52,118,
+148,234,  8,173,218, 45,187, 55,121,124,174,224, 53, 82,202,150, 24,133,185,154, 63,163,137, 95,164, 63, 65,117, 90,208,200,158,
+220, 28, 20, 51,194,125,117,117,207,175,252,230, 55,248,231,255,209,175, 81,220,158,251, 87, 23,252,205, 95,189,228,199, 31, 95,
+114,125,127, 32,132,192,106,213,153,126,146,205,216,229,150,124,169,115,130, 52, 93,100, 91,161,235, 29,155,213, 49, 90, 39, 94,
+ 60, 61,230,183,126,245, 63,225,127,250,159,255, 16, 23, 59, 82,234,136,105,135,147, 74,215,117, 60,123,250, 46,199,143,158,144,
+124, 66,180,195,105,166,150,145,105, 30,141, 47,161, 48,244, 39, 12,239,118,236,111,239,217, 30,238,161,217, 42, 96,142,137, 77,
+127, 68, 23, 60,243, 56,114,123,125,205,251,167,194,123,143,158,160,171,129,150, 71,170, 15,204,115,230,240,230, 11, 86,171,107,
+186, 77,160, 52,207,197,245, 27, 94,126,241, 25,185, 89,129, 76, 63, 56,186,225,132, 50,110,169, 85,173,156,197,131,208,240,101,
+198,117,129,227,180,161, 36,207,254,176,227,249,139,247,121,242,244,140,151, 63,251,194,220,193, 46,160, 52,162, 55, 72, 75, 41,
+194,166, 95,115,161, 21,223,108,213,168,234,240, 33, 18,186,100,123,236, 90,233, 98, 68, 80,178, 84,130,  6,171,157, 86,181,207,
+ 92, 48,186,230,103,175,174,249,155, 63,253, 30,191,255, 95,189,207,  7,239,189, 64,154,227,114,119,197, 52,222, 51,132,153,111,
+125,227,140, 87, 95, 22,182,179, 41,135,179,100,122,217,219,231, 41,122,194,100, 57,241,185, 57,  6,239, 41,174,217,154, 44, 20,
+ 42, 38, 79, 35,  7, 90, 72, 84,231,  8,185, 18, 53,225, 59, 71,106, 25, 21,225,144, 43,  3, 17, 95,  4,219,228,  8,121,116,144,
+ 44,110, 89,180,226, 66, 34,231,137,212, 15,120, 87,104,234,161, 42,161, 21, 66,191,226, 48, 41,190, 84,220,176,194, 45,233,159,
+ 24, 61,206, 37,144, 70,150,145,134,103,192, 17,151,210,169,224,148,234, 49, 85, 84,  4,169,153, 54, 26,134, 52, 68, 65,203, 64,
+240,145, 70, 91,148,216,  2,121, 99,220, 19,183, 36,  3, 52, 26, 11, 95, 14, 12,193, 49,231,106,113,216, 38,184,126,192,171,103,
+ 62, 20,196, 93,209,121,  7, 45,225, 80, 14,226, 44,127, 63, 23, 36,103, 92, 74,104,203,228, 90,208,232, 72,  7,143,180, 66,150,
+  3, 99,112,132,190,199, 77, 66, 46,197, 88, 12,245,158, 92,196,226,168, 62, 80,154,195,133,145,178,159,200,179,162,247,205, 98,
+146, 53,240, 38,  5,100,204, 20,167, 72,189, 71,155,146,101,  6, 38, 66,181,181,136,177,254, 29,234, 18, 41, 52,196,203,114, 62,
+154,162, 73,179,104,181,184, 64, 45, 19,251,105,226,182, 93, 80,117, 38, 54,243, 93,169, 95,222, 91,162, 75,180,119,103,195, 21,
+ 11,221, 52,218,115,201,163,248,174,210,106, 88, 86,164,137, 80, 38, 62, 56, 31,248,232,235,142,191,252, 65, 69,182, 74,241, 10,
+ 97, 98,181,122, 70,120,250,228,236,127,124,216, 33,249,101,191,174,216,116,230, 22, 34,153, 42,  6,112, 89, 14,228,232,140, 64,
+231,150, 47,122,239, 76,218,194,166,114, 22, 41, 95, 22,200,140,143, 14,151,146, 73, 18,206,166,210,214,108, 82,101,233, 74,126,
+ 27,145,115,118,113,112,222, 78,170,135, 41,223,249,128,136,253, 27,  2,222,118, 48,206,155,187,220,179,100, 79, 77,117, 72,206,
+ 72,105, 52,  5, 93,140, 96,210,136,203,254,209, 45,217,247,148,122,124,176,195,255,225,255, 34, 44,187, 22,177,216, 90, 69,112,
+206, 19,176, 15, 58,206,126, 47, 26,208,100,135,225, 16,194,  2,239,193, 34,121, 64,145, 10, 85,150, 88,160, 97,108,131,127,160,
+239,121, 82,234, 56, 57,217,112,114,188,102,189,217,112,116,212, 19, 22, 68,126, 45,229, 45,159, 94, 45,106,176,168, 33, 15, 36,
+ 39,219, 49,226,121,155, 90,112,206, 49,142,  7,246,247, 91,110,111, 47,217,110, 47,223,  2, 60,208, 70,107,133,195,118, 66,117,
+226,245,197, 75,118,251,145, 16,252, 91,192,140,226,137,113,201,  0, 55,161,182, 70,105,149, 90, 50,169, 75,124,253,189, 23,164,
+ 46,240,250,230,150,105,158,109,  9, 21,192, 69, 83, 41,238,111,110,109,186,240,129,174,219,240,232,201, 57,143, 30,111,168,213,
+110,184, 55,151,183, 92, 92,191,225,238,246,146, 38, 66, 80,177, 98, 56,111,142, 79,245, 54, 25,205, 99,102,191,223, 49,238, 15,
+196,228,233,134,200,208,245,  4,129, 34,194,253,221, 45,121, 60, 48,229,202, 97, 63, 50, 79, 35,243, 56,147,115,163, 79,129, 46,
+ 26,  3,124, 86,112,174, 26,228, 72, 33,123,123,216,104,205,246,158, 81,165,200, 76,203, 21,154,185, 81,173, 67, 36, 27,101,208,
+121, 82, 39,203,197, 81,  8, 39, 29,165,  9,210, 10,235,206, 25, 37,111, 22,235,  2, 16, 91,133,116, 17,124, 49,131,232,110,127,
+107, 37, 16,206,113,241,230,150, 55, 87,247,102, 18,117,142,210,228,193,110,186,116,134, 87,112,198,214, 15, 17,190,249,205,231,
+188,122,125,193,159,253,233,247,152,246, 19, 18,  2, 62,121,230, 82,169,217,214, 56,165,180, 37, 45, 18, 12,209,178,172,154,156,
+ 42, 62,120, 98, 76,  4, 31, 57, 62,234,216,239, 38,126,246,229, 37,207, 30,111,120,245,213, 53,215,119, 19, 39, 71, 27,154,204,
+188,185,185, 98,189, 62,225,201,163,119,168,173, 80,201,248,106,109,141,187,105, 94,168, 86,129, 82, 27,170,197, 46,218,193,170,
+ 81, 75,153, 57, 63, 57,227,249,251, 47,152,155,112,245,250,134, 90, 51,231,231, 79,232,215,231,124,251, 91, 95,231,244,236,  9,
+115,109,236, 15,123, 46,191,252, 17,167,113,203,215, 63,124,206,209,209, 17,115,110, 28,110,111,249,248,227, 31,219,206, 30, 83,
+174, 28,176,219,221,210,202, 72, 23, 59,235,105,192,179, 26, 18,167,231,214, 15, 31, 99,164,136,103,123,119,201,215,190,254,109,
+ 78,207,207,184,189,189, 67,242, 76,151, 34,103, 79, 30,  3,106, 69, 45,120, 46,111, 46,205, 83,210,204, 64,231, 88, 76,109, 84,
+ 91,215, 53, 56,228,153,150,179,197, 89,101, 25,248,107,102,206,153,176,  0, 64, 62,123,125,193,123,207, 31,209,201,138,191,248,
+155,239,179,221, 11,231,231,143, 57,236, 70,222,125,178,225,209, 81,207,253,190, 82,114,193,171,241, 32, 92,140,184, 32, 36,215,
+ 44,137,211,236,178, 47,218,204,189, 95,172, 58,182, 53, 59,228,188,139,182,182,107, 38, 49,135, 16,201, 84,164,130, 11,145,210,
+148, 38, 25,245,198, 21,175,205,122,209,209,102,102,212,230,150,134,198,136,151, 70,109,160, 45, 80, 69, 81,205,132,133,169,238,
+131,183, 46,239, 32, 52,137,148, 50,227,162,121, 10,172,119,126,180,125,183,243, 20,105,204,197,186,191,141,222, 55, 45,171,208,
+106,230, 77,  5,105,142, 41,239,161,101, 90,155,161, 75,168,152,219, 95,219,132, 74, 94,138,141,132,178,175, 52,167,136,236,169,
+174,153,239,200, 25, 75,189,201,126,121,254,100,186,  0,101,222, 82,164,216, 65,216,242,162,250,  6,170,100, 74, 62, 32,109, 70,
+171,149, 83, 77,121,164,140, 35,173, 40, 62, 31,112,174,162,117, 54,133, 88, 26,181,140, 86,137,218,238, 40,211,222,160, 97,  8,
+ 77,118, 84,201,150, 74,104, 35,218, 50,170, 51,193, 21, 84,178,189,142,206,218,113, 28,106,117,202,  1,180, 85, 18,166, 80,149,
+ 86,236, 92, 91,210, 43,161,115,104,141,220,108,247, 28,238, 63,  5,217, 25, 33,212,  5, 26, 98,112, 44, 59, 44,236, 57, 44, 86,
+121, 45, 90, 22, 86,129, 41, 92,190,197,229, 76, 21, 40,194, 32,153,255,244,215,126, 25,121,231,159,241,119,223,251,130,122,253,
+247,  4, 13, 68,148, 95,253,198,115,226,219, 61,186, 44, 13, 70,206,118,190, 44,102, 51, 59,214, 23,201, 24,165,115, 75, 60,235,
+193, 96,176,208,111,204,198, 98,121,111,195,199, 26,228,194,135, 37, 87, 90, 27, 69,149, 62, 26,  0,197, 57, 19,147, 85,109,199,
+ 25,151, 82,146,164,202, 92, 29,174,179, 55,164,168,218, 14,205,179, 20,202, 68,188,183,  9,179,105,163, 22, 33, 68, 59,148,157,
+211, 37,183,186,220,238, 69, 44, 67,157,108, 10, 53, 31,151,237, 51, 13, 39,219, 72,193, 32, 39,101,201, 47,199, 96,145,152,172,
+ 75,159,185,154,193,166,  4,183, 84,209,154,129,197, 59, 71,203, 13, 31, 19,205, 27,100, 63,122, 99,107, 87,215,  8, 41, 25,116,
+  0, 51,199,181, 37, 62,244,240,103,196,195,230,232,136, 16,237,208, 73, 41,218, 26,160,  9,227,161,112, 24, 15,236,199,  3,135,
+105, 98,158,170,237,201,154,233, 34,110, 57,236,189,149, 80, 45,157,244,182,163, 41,109, 70,199,153,105,127,203,221,229,203,133,
+ 16, 20,  9, 33,112,122,246, 30,239,190,243, 28,173,198,242,143, 62,226,122,123, 56,  7,239,141, 85,175, 15, 78,225,  5,157, 25,
+ 34, 39, 71, 39,204,211,204,253,152,153,230,250,118,117,208,117,107,130, 31,120,115,241,134,237, 97,178,168,163, 26, 45,201,249,
+128,215, 64,  8,142, 86, 71,166,177,224,156, 29,144,195,106, 69,183,238,153,166, 76, 45,150,221,174, 53,155,236,159, 28, 94, 34,
+157,119,116, 36,230, 89,217,202, 76,138,158,182,107,220,221,155,195,124,211,223,211,109, 58, 60,118,128, 37,239,217,172,143,120,
+246,238, 51,222,121,231, 49, 95,123,241, 53,126,246,241, 75,164, 76,196,174,224,102, 53,154, 26, 13,143, 48, 21,129, 69, 41, 73,
+189, 25, 32,107, 19, 51,246, 45, 20,187,164, 61,141,108,135,113,105,132, 98,135,240, 84,237,193,239,165, 82,164, 48,183,198, 42,
+ 88, 42,130,224,136, 46,112,191, 29,185,157,175, 88,133,142,152, 28,165,152, 99,221,  7,191,168, 69,182,162,177,155,160, 67, 74,
+ 69, 81, 86,177,227,246,245, 61,223,251,201,103,188,252,244,146,211,227, 35,190,249,237,119,120,252,206,  9,207,198, 19,246,119,
+ 35,181, 61, 16, 20, 43, 84,107, 51,116, 97,  1,  5,133, 37, 65, 80, 27,177, 11, 68,191,226,120, 45,220, 92,237,248, 95,254,215,
+191, 96, 63, 79,164, 24, 25,190,253,109, 66, 23,240, 18,  8, 41,112,123,184,167,115,129,225,104,197,102,125,206,201,211, 71,188,
+ 72,158,195,205,200,188,223,115, 56,220,177,155,247,228,189,210,170, 82,106, 49,252,113,104,108,134,142,117,255, 24, 93,159, 82,
+238,183,100,153,185,159,111, 57,147,247, 24,101,203,184,223,242,230,226, 51, 98,190,226,195,239,252, 18, 71, 39,  1,169, 43,134,
+254,192,217,147,167,252,194, 55,127,137,195, 97,207,245,213, 21, 37, 79, 28,109,206, 56, 26,142,185,159, 38,178,206,116,206,145,
+186,142,212, 69, 66, 13,132,181,195, 53,161,239,123, 14,251,145, 79,126,250, 99, 75,157, 16, 88,159,157,112,250,244, 41, 87,151,
+151, 52,245,244, 93,207,106,181,102,221,173,201, 50,154,  7,161, 46,  7,185, 58,164, 90, 49,149, 58,165,213,106, 23, 59,171,247,
+192,135,142, 95,254,214, 51,142, 54, 43,190,247,131,151, 52,173,124,245,250,130,127,251,239,254,144,127,249, 59,191,193,147,119,
+207,248,244, 71, 23,252,240,239,190,207,211, 23,239,240,249,103,175,248,207,255,197, 63,227,228,236,140,191,252,171, 79,184,157,
+ 22,124,109,109, 54,113, 15,107,252,221, 22, 31,102, 90, 14, 22,188,142,230,227,199, 53,195, 42, 87, 71, 45,149,208,139,145, 32,
+ 81, 74, 25,241,222,227,134, 64,173, 75,169, 82,112,248, 50, 66, 21,114, 45,244, 46, 65,112, 20,105, 11, 74, 55,178, 10, 22, 77,
+213,160, 52,  9,132, 32,  4,177,122, 73,117,145,156, 27,193, 25,147, 33, 12, 66,136, 22, 49, 46, 57,144,232, 77,  9,212, 74,144,
+  3, 46, 68, 58,140,113, 78,155,145,  4, 65, 27,161, 84, 83, 69, 92,161, 53, 33,121,227,150,180, 10,174,217, 37, 73,253,194,142,
+104, 80,138,173, 55, 92,205, 20,109,  4,237,173, 23,195,141,212, 52,211,251,101,197, 58, 78,248, 80, 24, 75, 66,212,227,213,131,
+ 31, 16, 85, 10,153,228, 43,174, 21, 40,142, 22,205,120,216,230,131,109, 88,179,165, 49, 66, 20,242, 60, 65, 76, 56,111,209, 91,
+137,  9,218, 14,201, 51, 77, 51, 49, 64,205,130,239,103, 74, 85,180, 22,134,144, 40,128,202, 68,147,100,  6, 81, 21, 90,205,248,
+  2,154,150,102,211,169,226,147,163,170,162,197, 84,193,224, 44, 71,229, 66, 67,138,224,150,150, 54,223, 20, 77,  1, 45, 21,201,
+211,  2,230, 89, 32,104, 75,122,170, 73, 53, 16,141, 91,218, 60,107,120, 91,179,167, 53,226,165,218,128,153, 28, 23,173, 35,126,
+  5,161,218,231,121, 30, 27,171,  1,158, 61, 93, 19,189, 75,182,147,211,  5, 43,202,255,207,212,155, 53,201,122, 93,233,121,207,
+218,195,151,153, 53,156,121,  6,206,193, 76,128,221, 36,123,180,212, 82, 72,161,112,132,110, 28,225,  8, 95,217,190,244, 95,225,
+ 79,241,207,176, 47,172,144, 67,178,218,205, 38,205, 86,179,187,217, 68, 55,  1, 18,103, 62,117,106,174,202,204,111, 15,107,249,
+ 98,237, 42,136, 55, 32,128, 64, 85,158,204, 47,247, 94,195,251, 62,175, 99, 91,233, 87,116, 52,247,211,250,120, 47,211,113,104,
+131,195,105, 20, 98, 26,234,108, 79, 39,178,171,140,242,145,169,147,144, 17, 59, 90,145,166, 84,137,206, 90,142, 17,189,218,217,
+210,233, 38, 68, 75, 52,245, 75, 58,116,167,234,180,238, 80, 27, 70,  7, 34,234,246,171,104,142,180,149, 32, 36,  3,141, 66, 38,
+ 97,177,123,149, 44,137, 28, 35, 18,194, 40,  2,134,138,169, 57, 13, 76, 22,145, 48,251,135,145,196, 19,150, 26,195, 87,169, 67,
+213, 63,252,142, 41, 37,136,142,247, 76, 61,176,213, 74, 78,  3, 75,219,154,199,102,138,139,  7,187, 56,215,254,202,242, 39,209,
+131, 85,188, 35,142,132,228,133,194,148, 19,177,127, 63,185,168,173,195,180, 68, 68,185,121,115, 98,119,111,151,135,146, 40,210,
+ 72,221, 56,191,188,224,247,191,127,201,229,166, 12,112,138,103,206, 51, 24,242, 93,  7, 64, 40,140,  9,126,204,255,141, 53, 81,
+105,181,243,254,224, 27,206,207,223, 13,171,148, 87, 99, 49, 68,207,110,179, 72, 31, 30,124, 36,120,180, 37,129,  7,183,238,176,
+183,191,195,225,197, 57,243, 92,199, 69, 63, 98, 94, 37,146, 82,162,151,141,175, 43, 84,201, 41, 32, 41,179,204,238,159,188,177,
+218,229,236, 96,230,232,252, 18,137,198, 98,218,129, 24, 89,196, 93,190,248,195,175,192, 10,229,244,156,131,245,  9,231, 71, 39,
+ 36,140, 82,157,120,214,106, 71,109,  1, 73,168,173,185, 70, 66,226,  8,240, 48,182,151, 21, 73, 78,203, 18, 85, 46, 54, 91, 76,
+ 22, 60,126,244,165,139,  2,251,150,157,  4,107,155,152,146,142,215,183,160,182,206,210,115,152, 60,146,113, 14,164, 65, 47,180,
+ 88,208, 94, 89,134, 76, 51,255,242, 46,227,228, 54, 42,243,241,118, 65,124,196, 24,  3, 90,133, 24,141,237,236,182, 34,172,122,
+  0,145,  4,158,255,254, 61,251, 55,118,136, 42,180,230, 43, 23, 51,144,228,170, 89, 17, 87,119,250, 63, 15,100, 17,230, 90,248,
+249,223,252,150,227,147,115, 66,  8,108, 74,161,150,206,217,217,134, 55,239, 79, 88,175, 11,139,156,124,247, 54, 69, 90, 83,103,
+ 66, 72,164,135, 64,194, 92,237,190,200,124,249,197,151,172,183,151,180, 96,236, 89, 98,189, 57, 25, 22, 42,223, 25,107,245,223,
+171,226,207,232,116, 99,143,157,105,159,197,180,131,168, 80, 46,103, 54,151,199, 92, 94,158, 19,136,236,173,238,178, 13,  5,206,
+ 55, 92, 52,245,131, 45, 70,214,179,208, 41,220, 92, 45, 57, 63,170,172, 55,151,220,154, 11,167,103,167,108, 90,229,232,248,132,
+114,118,192,  7, 31, 60, 98, 63, 47,136,211,196,250,162, 96,115,129, 32,124,241,213,143,  0,229,239,254,246,111,120,245,242, 57,
+180, 66, 78,153,180,179, 66,173,121, 50, 93,  9, 44, 22, 80,218, 76,210,132,100,144,217,105,133,235,179,203,193,218,  6,173,145,
+139,139, 53,167, 71,  7, 16,150,  8, 74,158, 50,214, 59, 89,178,143,210, 91, 35,154, 51, 41,167,133,208, 76, 40,117, 67,208, 78,
+ 26,118,174,105, 17, 81,  2,159,126,246,132,127,245, 47,126,194,155,227,255,131,231,223,190, 65,122,231, 87,127,255, 59,172,  9,
+237, 50,160, 58,243,245,183,175,248,248,179, 15,120,249,246,128,179,179, 11,126,252,131,199, 28, 29,190,230,239,190,237,208, 58,
+ 77,188, 64,232,165,186, 90, 59,  8,228, 56, 48,208,202, 98,103,129, 89,103,190, 84, 54, 52,178, 70,250,182,208, 36,251, 20, 41,
+251,153, 89, 75,167,205, 29,105, 74, 23,165,182,153, 24, 38,167, 96,166,138, 88,114, 58, 94,110,132,222, 89,111, 27,102,157, 96,
+153,102,149,190,105,244, 60, 97,210,113, 72,114,192, 82, 36, 69, 95,147, 74,191, 90,139,118,214,243,198, 15,146,232,222,234, 16,
+151,152,110,125,149, 80, 35,162,234,235, 89,  2, 27,  3,173, 74,208,153, 38,197,215,136, 67,111,209,181, 15, 10,160,115, 33,154,
+ 10, 81, 27,164,132,182,237,136,177,158,200,178, 71, 91, 95,208,108, 70,163,209,122, 33,104,116,231,140, 25, 42,238,191, 15, 49,
+163, 44,217,110, 47,145, 60, 66,138,234,  6,137,153,212,  3, 26, 42,189,205,212, 80,104,230, 78,157, 80,103, 66,102,232, 20, 24,
+ 43, 54, 87,166, 99, 23,116, 13,180,243, 54,114,208, 97,203,198,153, 28,179, 33, 20, 22,201,227, 98,123, 72, 62,253, 40,133, 89,
+125,186, 18,213,221,  5, 18, 61,251,131,  1, 74,194,212,197,212,209, 27,181,232, 98,  7, 95,109, 15, 79,157, 89, 29, 73,168, 87,
+ 19,217, 64, 48,111, 42, 52, 56,176, 13, 85,122,109, 24, 13, 73,137, 30, 59, 27,141,252,159,191,252, 37,246,187,255,157,243,151,
+175,208,254,  6,233,137,155, 59,137,223,124,125,151,120,255,254,189,159,218,136,  5, 85,115,203, 77,188,186,176,101,140,111,197,
+253,144, 50,104,115, 81,130, 95,  6,209, 71,187,152,143,  9,174,  0, 48,189, 59,191, 93, 70,177, 64,240, 17,247,232,229,241, 48,
+101, 23,128, 73, 12, 76,193, 83,148,252,146,241, 55,166, 99, 68,115, 91, 88,107,230,214, 51,235,244, 48,200,116,  3,145,233,  4,
+159, 43, 20,180,143, 61,166,232,185,180, 33,186,239, 93,192,187,173, 16,174,147,227,172,143,237,180,140,200,214,177,171,207, 64,
+109, 10, 83, 30, 69,138,143, 81,196,163,235,156,131,238,110, 56,180,187, 45, 15, 12, 75,190,162,112,196, 40,168, 54,170,249,238,
+ 69,204,237, 93,190, 58,240, 85,129, 95, 32,  1, 73, 66,202,113, 88,144,124, 20,221,240, 81, 51,166, 68, 19,114,138,172,215,151,
+ 28, 30,158,250,229, 63,168, 99, 18, 32,230, 64,148,116,181,244, 24,174,132,228, 23,175,245,129, 37, 13,136,132, 17,249, 89,221,
+ 71, 78, 66,146, 43,244, 61,226, 80, 71,130, 88,119,107,140, 25, 59,171, 29,238,221,187,141,245,198,197,229,150,210, 27,221,124,
+171, 33, 33, 58,180,103,187,102, 59,207,244, 90,135,152,105,201,106,181,203,227,  7,247, 72, 89, 56, 60,185,100,179, 77,220,186,
+125,199, 87, 35,113, 73, 70, 40,115,225,217,135,159,240, 23,255,242, 47,248,163, 63,255,239,248,234,179,175,248,232,217, 71,252,
+240, 71,127,202,189,167, 31,115,255,238, 99,238, 63,184,203,173,187,194,241,225,154, 41,132,235,103,112,177, 74,168,141,100, 46,
+237,208,  2, 33, 24,115,109,152, 41,247, 31, 62, 97,110,151,148,126, 65,235,129, 98, 62,229,136,113, 65, 67,169,117,  6, 21,102,
+117,  1, 99,136,157, 58, 55,255, 12,167,133, 83,248,134, 39, 60, 14,110,114,136,144, 53, 80,130, 79, 42,230,210,  9, 67, 96,101,
+234,226,176,164,238,173, 46,  6,235,205, 57,175, 95, 28,112,116,188,225,252,242,210, 47,243,232,164, 52, 29,147,144,174, 62, 29,
+ 50, 92,  3, 18, 66,164,214,202,197,102,235, 19,169,236, 28,254, 69, 78, 28,188, 61,163,110, 43, 31,127,120,143,245,166,248,164,
+ 65, 28,195,188,179, 92,146, 66, 70,187, 82,180,179, 90,172,248,131, 63,254, 19,158, 60,249,144,178,109,156,157,157,242,167,127,
+240,144, 47,158,222,229,249,225,  9,166,141, 15, 30, 61,193, 44,243,254,253,123,210,148,216,223,217, 35,167, 68, 78, 43,170,  8,
+103,103,199,156, 30, 31,179,185, 60,103,179,169,108, 75, 97,219,214,227,181,118,230,237,134,219,247,238,241,241, 39, 95, 18, 87,
+ 15, 57, 60,124,207,211, 15,239,243,239,254,248,  3,126,245,143,191, 65,251,146,180,186,201,201,197, 57,219,179,183, 60,184,181,
+203,254,174,119, 76,155,147,153,211,147, 11, 46,107, 39,161,204,115,135, 94,137,203,  5,111,223,188,244, 96,139,188, 96, 90, 44,
+249,252,243, 31, 48,175,103,206,206,207, 73,193, 45,169,181, 54, 54,219,194, 60,175, 41,101, 77, 83,255, 12,156, 92,169,172,215,
+231,196,148, 88,166, 21,132, 76,157, 55,195,  6,231,197,186,168, 59, 62,210, 34,179,147,220, 61,210, 90, 27,147, 47, 35,196,140,
+152, 79, 47,223, 28, 28,243,237, 55,  7, 28,190, 95,211,173,185, 62,168, 55,206,206,103,  2, 11, 74, 47,148,178,101,127,255, 46,
+ 15,110,239,242,229,151, 15,248,252,207,254, 45,247,239,236,115,112,124,194,209,225, 41, 49,116,230, 14,139,232, 89, 19,161,248,
+  8, 90,162,178,200, 59,142,148,213,192,114,153, 61,245, 80,221, 98,139,  5, 44,118, 98, 80, 36,  7,122, 11,104,169, 14, 99, 18,
+117,184,202, 24, 69,219,112,169, 76, 11,232,181, 19,101,194,130,251,240,107,  5,161, 58,116,107, 20,222, 53,  5, 98, 52,212,220,
+118,103,197,169,227,165,118,132, 74,198,174,193, 49,214,189,233, 48, 26, 77,149, 62,244,  6,165,186, 35,167, 55,223,231,135, 88,
+ 40, 87,140,138,104, 48,251,235, 11, 49,121,241,168,101,196,171,  8, 41,186,152,121,138,222, 16, 17, 10, 58, 86, 14,161, 14,107,
+ 92, 76,136,118,199, 53,219, 85, 96, 21, 52, 42,216,140,228, 68,157, 55,126, 71, 20,165,137,120,162,100,221, 98,166,204, 38,136,
+ 20,180, 84,250,236,197,156, 10,104,237,180,109, 37,136,210,231, 45, 74, 99,  0, 26,199,  8,189,160,205,113,218, 81, 60,146, 27,
+ 21, 66,239, 36,201,110,181, 78,126,247, 52,156, 46,215, 69, 61,101,114,232,182, 60, 36, 73,124,141,129, 13,214,130,191, 62,139,
+ 32, 57, 33,209,207,  1,143, 58,183,145, 32, 60,148, 83, 33, 33,234,209,193, 14,132, 19,130, 36, 28,155, 22, 88,159,158,113,254,
+246, 27, 74,121, 75,169, 27,234,124,198,217,197,  9,191,250,231, 87,196,123,183,239,253,212, 21,166,131, 62, 35,126, 49, 94,  9,
+224, 84,140,132, 95, 10, 41,122,103,140,250, 98,218,189,207, 35, 98,117, 36, 37,101, 25, 42,120,211,113, 17,123, 65, 16, 66, 28,
+136,198, 17,141, 24,131,  7,128,152, 16,195,132,  4,241, 61, 56,113, 68, 38,250,184,221,163, 77, 27, 54,138,  9,  6,156, 70,198,
+ 31, 84,112,177, 73, 74,190,143,143, 68, 39,152,141, 55, 85, 77,  6,184, 34,146,226,194, 83,198, 66, 31,168, 78, 79,168,107, 42,
+ 72,242, 75,242, 42, 15,158,232, 94,117, 47,  4,  2,210,227,136, 56,245,169, 69, 23, 63, 96, 34, 16,212,  1, 32, 62, 50,241,  0,
+ 13, 53,115,  0,143,132,209, 57,  7,175,218,154,177, 90, 77, 76,139,229, 80,176,123,133,214,219, 72,140,138,195, 47,169,145,144,
+125, 68, 62,111,103,158,191,122,201,197,229, 60, 72, 88, 97,132,212, 24, 41,100,210, 20,  9, 49,146,114, 34,231, 52, 44, 49,105,
+  0,119,220,154,119,181,139,159,242, 14,102, 30,118,146,196,223,155, 43,227,154,118, 31,237,153, 58, 58,115,119,119,  7,213,198,
+250,114, 75, 41,238,171,118, 81, 93, 26, 22, 35,223,227,117,237,244, 58,196,127,139, 29,118,119,246,185,253,232, 22, 71,239,142,
+ 57,120,117,200, 98,239, 38, 79,159,125,194, 34, 45,185,119,251, 38, 55,110,222,231,248,236,144,127,248,251,191,230, 23,127,245,
+ 95,248,203,159,253, 23,254,241, 87,127,199,235, 23,135, 28, 95, 30,115,124,120,130,149,192,195,135,159,240,175,255,252, 75, 94,
+190,122,205,217,182, 59, 57, 76,156, 26,168,131,147,236, 59, 59,255, 18, 53, 53,110, 44,119,185,121,235, 38, 61, 20,186,102, 31,
+ 21, 70,232,221, 87, 64, 42,  5,147, 60, 24,  6,174,146, 37,  7, 82,110,132,214,124,221, 20,124, 20,239, 60, 42,199, 19,183, 94,
+189,184, 68,177,214,189, 43, 23, 67,104, 72, 52,186, 69, 23, 53,154, 81,186,242,226,245, 75, 54,231,151,110,189, 50, 39,152, 93,
+ 11, 84,204, 39, 84,221,220, 18, 24, 36,185, 93,204,  6,227, 57,199, 17,124,227,151,250,249,197,154,211,243, 53, 63,250,225,135,
+252,207,255,211,191,229,230,205, 93,222,190, 59,246,195, 52, 68,242, 34, 19, 98,160,180,198,106,119,201, 87, 95,254,  1,143, 31,
+127,  4, 91, 79, 71, 92,159, 31,242,249, 15,110,115,116,114,193,183,207,143, 89, 72,224,195,103,207,  0,229,224,240,136, 52, 77,
+144, 18, 49,123, 42,163,169,139, 59,183,237,210,  3,127,212,127, 78,211, 74,223,118, 71,201,106,231,195, 15, 62, 98,181,218,227,
+108,187,230,252,240, 45,127,240,244, 54,255,230,223,253, 11,254,175,255,248,151,188,124,245,  2, 82,198,202,150, 71, 55, 87,236,
+172, 86,108, 16,206,203,218, 47,194,173,209,172, 82, 74,161,182, 78,107,141,105,127,201,217,201, 37,231,231,103, 44, 23, 75,232,
+112, 99,127,143,123,119,239,243,246,221, 91,119, 11,152,176,222,108,104,243,236,147,156,222,125, 77, 40,  2,234, 89, 16,136, 79,
+213, 98, 26, 51,195,145, 56, 88,123,119, 11,110, 47, 78,187,180, 78,169,234,221,173,118, 98, 10,196, 56, 93,229,193, 33, 65,152,
+183,141,211,139,217, 17,201,161,211, 84,  7, 97,112,193,106,103, 34,165,137,245,102, 67,239, 51, 95,124,242,128,222, 55,124,242,
+217,143,184,113,239, 75,110,223, 80,190,249,246, 45,151, 39, 51, 42, 17,201,206,233,216,214, 66, 19,101, 74, 11, 79,205, 51,101,
+ 17,118, 97, 74,244,237,214, 19, 11, 87,137, 28, 12,216,113,166, 55,234, 57,223, 90, 72,203,  9, 84,  9, 41, 51,169,119, 24,162,
+226,185,237, 67,171,210,130,162,181, 35,166,180, 86, 73, 33, 83,197,252,188, 10, 66,235, 29,141,145, 86, 42, 13,111,128,162,217,
+  8,146, 74,168,206,148, 81,224,211,  2, 61, 21,186, 54,239,238,213, 65, 43,221, 73, 94,196,212,137,214,144,144, 17, 38,230,178,
+ 65, 77,232,173, 34, 90,145,222,104,214,144,133, 63,235, 88,163, 23, 27,235, 84, 37,152, 66, 87, 54,219,181, 95,208,218,157, 17,
+ 98,174,241, 49, 51, 38, 64,115,192, 52, 18,251, 37,165,204,204,115,243, 73,169, 26, 98,  5,169, 21,109,  5,205,222,124, 89, 45,
+160,230,182,176, 58,123, 46,  4,126,161,183, 90,145, 36,174, 27, 42,117,136,193, 27, 93,156, 58,169,230,186, 18, 19,168,163, 32,
+ 65,132,210,102, 39, 26,138,  3,110, 90, 27,218,  8,140, 24, 50,201, 60, 53,148, 46,116, 85,180, 67, 30, 26, 14, 83, 37, 68, 67,
+ 90,115, 72,207,208,120, 25, 50,214, 65,157, 16, 28,158,134,186, 87, 29,  3, 77,190,  6,215,230, 69, 64,156,  2,105,145, 60,118,
+123,172,219, 72,234,147,226,185,144,160,249, 30, 96,196,123,106, 87,135,104, 72,164,141, 20,243,239, 59,204, 49,157, 69,125,108,
+172,174,210, 14,195,139, 41,194,224,178, 13,232,254,228,135,103, 43, 58,  0,255,206, 99,135,128, 90, 24,129, 12,130,106,117, 33,
+ 28, 30, 30,146,163,179,170, 85, 70,198,115,246,  3,207,  6,101, 11, 95,143, 15,161,156,103,154,247,230,129, 35,233, 10,103,139,
+195, 58,114,200, 20, 45, 96,110,209, 80, 19, 66,119,138,157,154, 82,131, 92,231, 10,247,209,233,196, 28,199,136,203,200, 34,152,
+ 58,151, 62, 96,136,100, 82,128, 98, 70, 51, 60,164, 33, 68,183,211,140, 34,166, 90, 96,138,145, 96,158, 10,215, 76, 61, 42,118,
+ 17,125,124,212,188,250, 19, 27,215,105, 85, 98, 48, 82, 72, 62,218, 85, 35,102, 31,163,246, 32, 92,156,156,114,114,186, 30, 73,
+ 83, 97, 28, 58,  9, 89, 46, 92,184,164, 87,152,223,241,239, 66, 32,231, 76,178, 37,170,149, 82,102, 76, 61,190, 81,109, 30,113,
+186,209,119,200,130,119, 32, 54,156, 10,102, 76,211,196,205,189,253, 17,230,177,165,119, 63,204, 66,116,126,184,152,209,196, 47,
+190,189,157,  5,171,157,125, 94, 62,127,227,186,  6,139, 44,150,129, 36,137,147,227, 11, 22,105,226,193,221,  7,156,159,157,145,
+ 23,198,124,190,230,248,226, 28, 21, 69, 91,227,108,179,134,139,115, 78,195, 33, 18, 94, 82,126,227,159,149,  5, 97,145, 23,220,
+250, 95,254, 71,190,248,248,  9,239, 14, 79, 33,  6,114, 94, 82, 91,  3, 53, 23,  5,169,119, 84, 87,234,239, 16, 87,164, 41,162,
+219, 51,164, 36, 90,108,148,154,124,138, 19,155, 83,231,100, 66,185,240, 17,180, 66,188, 72,244,197,  2,137,133,148,221,170, 40,
+ 34, 72,222,101, 18, 71,207, 74,  4,146, 49, 85,165,134, 70,170,160,105, 73,236, 66,239, 74,171,243, 96, 43, 76,204,235, 13,231,
+ 39,103,164, 41, 64, 45, 88,197,169, 93,193,195,143,220,  9,209,  9,226, 43, 18, 44, 12, 30,132, 63, 63,232,149,234,219,133, 99,
+181,116, 30, 61,188,193,237,123,187,252,213, 47,190,230,237,187, 35, 54,155,153, 90, 27, 33,  6, 54, 23, 27,114, 14,236,223,220,
+229,135, 63,248, 33,183,110,222, 98,123,185,161,206,133,229, 42,177,127, 99,159,191,252,217, 75,142, 14,143, 48, 51, 39,156,201,
+224, 43,152, 98,205,197, 62,121,242,113,111, 18, 65,167,  9,182, 30, 76, 20, 37,184,179,160, 53,106, 43,180, 86,208, 86,176,234,
+174,133,156, 61,227,225,213,249, 33,103, 23,141, 68,228,253,251,119,132,229,223,243,147, 63,252, 35,150,187,187,172,183,103,180,
+144,  8,179,147,212,220,  7,222,177,238,197,174, 69, 35,214,196,227,  7, 31,114,242,230, 13,219,114,201, 34, 46,121,241,252,  5,
+ 63,248,225, 87,220,191,255,128,131,131,183,172,245,114,172,156,124,173, 38, 49,179,138,217, 19,242,166,140, 85, 72,169,177, 16,
+ 39,254,205,205,237,172, 55,238, 76,236,175,118,184,216,158,179, 59, 53, 74, 49,231,114,119,197, 26,172,215,194,101, 45,228,156,
+  9, 49,209,122,189,222,177, 75, 47,116,  9,244,  0, 34,209,133, 86,173,209,107, 65,166,  9,201,137,215,  7, 71,188, 57, 41,132,
+ 90,120,241,143,191,224,217, 79,254,  7, 62,249,244, 75,190,252,252,159,248,217,209, 17,189,119,234,133, 34, 49, 50,229, 64, 47,
+ 74,233, 67,148,103,145,166,151,180,  6, 27, 26, 38,209,115,216,197,133,109, 54,132,171,150, 27,210, 18,213, 58, 89, 38, 36, 58,
+231, 61, 52,165,217,160,225,213, 72,242,252,193,145, 47, 15, 49,103, 66, 10,228,224,153,242,165, 57, 34,155, 90,156, 43, 18, 60,
+ 17,112, 86, 23,109,134, 40,244, 90,129,197, 88,197,174,177, 57,194,184,144, 91,247,148, 78,137,193,225, 70, 10, 88,242, 78, 53,
+140,192,164,226,214,195, 41, 68, 82, 88, 96, 50, 99,115,199,186, 49, 75, 32,137,210,173,122, 34,159, 69,122, 23,239,210,205, 39,
+188,109,110,144,  3, 90,160,140,105,172,228,137, 82, 47, 89,182,113,115, 88,199,146,199,149,170,249,103,134, 68,104, 16,181,178,
+237,133,168, 11,239,242,155,199, 42,199,166,222,  8,132,198,246,162, 16,146,239,235,107,159,209,226, 40, 86, 27,100,210,222, 26,
+152,145,162,163,136,123,240,239,169,108, 12, 66,115,155, 31, 29, 53,215, 57,245,222,233,102,196,232,113, 65,214, 59, 65,157,227,
+ 79,243,220, 15,154,107,181,130,  4,159,112, 23,199,196,  6,  7,191, 95, 15,190, 25,231, 52,  4,172, 13, 24,220,112,186,212,210,
+201,178,130, 20,174,215, 27,109,128,212,178,116, 18, 18,174,197,110,142,136,117,175,113,163,141, 40, 23, 25, 35,  5, 15,153,  8,
+195,114,133, 57, 15, 56, 93, 81,217,204, 92,112,210,125,  4, 31, 66,244, 75,185,187,  8,165,245,238, 94,242, 36,136, 42,210,197,
+133, 33,234,227,  7,237, 62,162,143,147,123, 69,187, 53, 80, 15,140, 49,241,136, 64,228,202,127,174,142, 55, 21,175,190, 83,114,
+238,179, 53,101, 27,140, 41, 70,207, 14,111,230, 30, 72,198, 27, 98,174,206,239,173,251,248, 67,194,128,200,100,143, 60,197,131,
+ 61, 76, 93,236, 33, 67,244,231, 10,110,161, 91, 32,  7,163,139,184,  8,130, 33,  0,  9, 35,158, 84,125, 82, 48, 13,178, 94, 15,
+137, 86,141,197, 34,140,206, 47, 33,238,160, 33,246, 62,176,138, 62, 13,  9, 33, 82, 90, 67, 82, 36, 76,110, 95,179, 22, 40,101,
+205,203,163,  3,218,224, 94,123,  4,173,184, 16,109, 12,221, 25, 29,180,136,239,214,187,130,213,230,136,220, 33,120,235, 77,189,
+ 56,137, 62, 74,182, 62,144,155, 30, 35,143,210, 49,  9,228,156,184,123,251, 54,139, 41,112,126, 89, 93,149,219,250,136,218,245,
+113,157,153, 87,250, 83, 78,124,252,201, 71,180,186,225,249,139,151, 78,209,147,198,205,219,183,233,109,203,201,225,123, 36, 71,
+210, 55,255,192,179, 15,159,241,228,241, 71,228,251, 43,238,110,214,252,246,183,127,199,251, 55,207, 93,131,160, 94, 84, 50,138,
+139, 22, 28, 79, 89,181,242,127,255,231,191,166, 16,145,188,226,222,157,219,236,221,184,141,196,200,173,229, 46, 55,238,236,178,
+217, 28,240,250,187,231, 60,127,127,194,250,226,130,157,253, 61, 82, 54,239,110,114,229,252, 82,  9,210,136, 50, 81, 76,144,222,
+105,237,210, 71,238,173,176, 76, 75, 36,  5,182, 52,172,248,115,143,184,162, 60,100, 99,174, 27,144,236, 73,133, 89,168,213, 72,
+ 61, 82,181,210, 75,133, 86,137, 65, 73, 41, 48,215,153, 82, 47,121,243,230,152, 90,189,131,152,107,243,207,165,185,242, 61,196,
+ 72, 18, 27, 68,102, 47,236,108,112, 27, 76, 70,  0, 82, 48,122,247,  9,153,137,127,182,119,238,220, 34,132,204, 47,255,246, 27,
+222,190, 61, 33,164,236, 86, 76,  9,200,114,162,181,194,179,143, 63,230,198,157,187,212,121,118, 81, 94,130,185, 43,203,189, 91,
+ 14,165,233, 70, 57,122, 71,213,134,212, 64,177, 45,115,155, 93,123,146,132,208, 38,114,186, 42, 66,183,  4,139, 44,242,  2,  9,
+145,178, 29,151, 59,198,165, 42,181,193,217,220,184,145,178,199, 32, 91,224,232,112,205,250,228,152, 24, 39,246,110, 61,230,131,
+ 15,191,224,206,237, 91,108,206, 55,212,160,132,160, 62,110,157,133,110, 27, 44,  9, 49,174, 60,157,172, 53, 74,173,220,190,127,
+143,189, 59,247,185, 56, 61, 96,186, 49, 81,171,242,245,175,255,129,237,188,117,222, 67,237,132, 32,228,105,135, 27,251,119,185,
+185,179,203,222,141,219,188,223,204, 64, 37, 95,107,126,  2,151,219, 51, 66, 50,230,237,204,237,253, 37,255,219,255,250,239,185,
+247,232, 14,200,154,237, 37,104,204,  8, 51,229,114,205,193,219, 51,254,195,127,250, 25,191,250,251,223,211,227,146, 56,237,211,
+ 54,231, 62, 77,177,230,  8, 50, 13,142,211,  6, 31, 93, 75, 66, 91, 98,177,156,216, 94, 92,240,205,215, 47,121,248,199, 31,243,
+ 55,255,245,111,248,224,  7, 63, 36, 46,239,241,236,209, 77,254, 38, 53,102,  2, 22, 42,166, 43, 15,130,161,211,105,232, 60, 81,
+204,161, 56, 77, 26, 44,196, 63,131,217, 25,227,102, 91,188, 76, 82,202,182, 35, 97,114,181,180,219, 65,220,141,147,128,160,104,
+137, 62,162,215,226,185,242,147,187,115,168,126,158, 68, 26,102, 66, 14,147,103, 95,244,128, 42,174,123, 10, 70, 43,141,101, 84,
+154, 40, 33,175,104,115, 69, 71, 33,170, 77,232,230,207, 85,156,252,251,111, 37,251,212,176,119, 54,125,118,239,252,194,215,162,
+173,207, 30, 47,139, 50,215, 45, 77,148,168,221, 11,107,  4,139,184, 95,189, 55,166, 12,181,184,112,174,107,100,138, 78,130, 12,
+178,112,103, 83,237,116, 77,176,222, 34, 52,160,208,173,  0,  0, 32,  0, 73, 68, 65, 84,189,177, 33, 17,227,  2,237,213,197,195,
+221, 85,255, 65,204, 19, 42,251,104,138, 44,160,109, 30,180, 75, 69,139, 39,196,244, 80,145,238,204,149, 62,207,180, 48,185,195,
+ 43, 42,162, 25,180,162, 84,255,255,166, 62,253, 25,  5,176,168, 59,  3, 28,251,221,  6, 94, 91,157, 17,161,222,105,107,159,176,
+222,253, 46, 25,197,186, 98,100,205, 14, 58, 50,195,164, 14,237,153, 39,188,133,144, 29, 64,148,243,224,120,130, 22,197,174, 20,
+242,226,147, 91, 83, 65,170,175, 32,194, 52,185, 19, 42, 42,169, 39, 90,223,208, 53, 16,239,222,187,253, 83, 29,162,167, 16,198,
+178, 31, 27,187,232, 17,247, 38, 54,176,167,114, 61,250,165,251, 47, 38,122, 71,172, 87, 64, 25,132,184, 24,246,160,198,117, 72,
+140, 13,232,134,232,176,139,117,247,  6,142, 31,235,129,242,230, 23, 77, 20, 87,114,217,192,182, 74,136,144, 71,252,170,121,113,
+193, 80,105,167,113,209,249,242,192,247, 18, 49,  6,191,192, 71, 28,158, 54,195, 66,186, 30, 31,131,141, 32,  8,143, 12,149, 56,
+ 42, 97,145,107,192, 11,221,113,172, 62,141,117,  6,188,147,168,148, 62,118,230,194,128,195,128,187,  2,192,253,207,209,176,224,
+157, 80,199, 71,172,130, 91,140,220,214,  7,139,236, 93,154,  8, 84,147,193,203,240, 11,  5,  2,185,  9, 26,  2,239,223,191,227,
+245,155, 67, 32,186, 90, 61,186,158, 33, 38,167,107, 73,  8,206, 13, 48, 87, 81,234,192,228,250,212,196,215,  5,165,235, 64,186,
+250,239,187, 90,175, 16,100,192,108,134,223, 89,132,155,251, 55,216,221,217,103,189,217, 80,181,211,106,245,244, 51,185, 26,145,
+200,245,  4,227,147,103,143,249,224,195, 39, 92,158,110,120,245,242, 53,221,140,221,253, 61, 62,253,228, 19,118,151,194,155,151,
+ 47,120,243,238, 29,135,239, 94,242,205,111,191,230, 87,127,247, 75,126,245,247,255, 31,223,189,248, 39, 78, 14,222,114,118,126,
+230, 54, 49,145, 49,254, 82,215, 82,104,160, 85, 15, 30, 33,103,144,192,222,206, 62,139,229,142, 91, 86,122, 65,226,196,222,173,
+ 59,236,164,137, 59,251,183,249,183,127,252,231, 76, 35, 22,119, 90, 78, 88,104,148,217,168, 53, 58,251, 32, 78,164,210,  7,156,
+165, 34,152,227, 79, 43,244,176,101,158,103,250,236,168,224,148,193,180,184,103, 95, 50,147, 45, 72, 40, 86,171,175,113, 66, 66,
+181, 99,181,123, 82, 83,234, 92, 94,156,114,116,244,158,227,227, 51, 94,189,121,135, 69, 33,231,192,249,217,236, 59,244, 48, 82,
+  3,199,142,237, 42, 56, 52,140,168, 80,223,245, 58,  6, 88,204,227, 89, 83, 76,238, 20, 73, 30, 93,121,122,118,201,235,183,231,
+ 94,229, 71,127, 54,123,247, 21, 78,181,202, 50,172,184,127,231, 33,155,185, 34,116, 86,139, 68, 75,194, 36,201,149,181,166, 84,
+ 81,234,122,230,201,163, 71,212, 90,120,243,250,141,143,147,167,232,  5, 42,254,153,151, 58,211, 91,103,153, 86,164, 60, 86, 11,
+ 24,219,186,101, 46, 27, 36,  4,166,213,138,221,221, 29,170,117,182,235, 53,185, 85, 62,252, 96,151,231,239, 59, 22,111,243,244,
+201, 61,166,188,131,174, 22,164, 54,179, 92,237,163,193,104,115,241,206, 34,120,228, 39,181,140, 12,  2, 35,239,  8,155,245,154,
+247,111,223,146, 23, 75,118, 22, 43, 74, 41,148, 90,104, 90, 88,228, 21,123,251,251, 60,184,251,152,189,213, 62,133, 17,155, 43,
+209,245, 13,209,216,174, 43,231, 23, 27,218, 64,233,214,121,230,232,232,148,211,203, 19,158,126,112,151, 63,248,226,115, 62,248,
+234, 83, 30, 61,251,148, 71, 79,159,241,193,167,159,242,197, 79,126,200,191,250,243, 63, 32, 90,229, 55,223,190, 28,216,223,128,
+ 13,171,175,153,145, 22, 19, 18,160,214, 66, 10,145,197, 98,135,214,102,159,250,169,114,121,126,201,114,119,193,201,250,130,163,
+183,  7, 60,121,178,199,179, 79, 62,162,172,141,239,126,127, 64, 23,159,  4,230,228,254,100,209,128,118,183, 34, 77, 49, 80, 69,
+ 73,248,180,164, 37, 96, 46,104,236,126, 25,247, 48,  4,152,205,251,136,145, 84,105,230, 17,214, 54,249,190, 93,162,160,161,179,
+ 96,225,221,122, 83, 79,213,108,134,169,139,120,219,160,114, 26, 74, 26,103,162, 57, 88, 31,187,202,175,232, 62, 61,140, 67,103,
+181, 92,142, 68, 76,  9, 76,201, 87,172, 70,165,153,207, 69,123,243,253,123,215,130,206,138,106, 70,172, 33,161, 81,181, 19,186,
+ 50,155, 99,138, 99, 72,180,222,232,226, 66, 62, 68, 92,243,212,221,182, 85,  7, 96, 43,152, 14,193,181,208,138, 43,213,189,  1,
+168, 84,243, 49, 61,218, 92,188, 29,156,252,215, 90,115,107, 31,110, 51,213, 94,175, 89,  3,189, 52,106,109, 68, 21,199,144,107,
+243,137, 51, 74,194, 39,181, 97,160,207, 37, 57,155, 64, 44,208,135, 59, 66,171,123,212, 45,250,243, 16,186, 79,214,122,116,145,
+ 86,112,175,223,208,203,116,183, 65,155, 13,250, 34,190, 62,100,172, 59, 37, 13,199,216,192,164,165, 68,176,142,144, 65,117,172,
+244, 12,235,221,115, 81,240, 34,196,130,185, 88, 47, 69,204,234, 72, 31,132,208,219,149,199,156,248,232,254,221,159, 58,  1,246,
+138,186,230, 67, 92, 25,227,109,134, 63,221,239,123,239,212,  7,153,214,109, 99,102,163, 18, 26, 99,248,224, 63,225,234,130,109,
+234,121,200,105,172, 96, 71, 95,201, 32,133, 95,239,206, 49,241, 66, 98,140,145,147,184,104,197,134,199,219,149,124, 46,212,155,
+146, 67,250,175,103,241,193,127,209, 88,183, 14,229,186, 95, 22,170,206,122,214,241,122,188,138,119,102,187, 71,229,  5, 23,189,
+ 85, 29, 32,  8,223,201, 51,128, 49,222, 24, 15,224,139,118,255,112,123, 31,162, 63,239,174, 68,220,146,151,146,147,239, 66, 84,
+162, 56, 41, 40, 44,157, 72,101,193, 53,  9,158, 20,231, 73, 56, 97,116,220,174, 24,180,145,226, 21,136,248,239, 44,243,150,223,
+127,247,154, 82, 10, 41, 37,183,  9,166, 64,136, 94,200,184, 78,193, 93,  7,140,104, 92,193,209,131, 14,180,105,204,243,204,182,
+120, 69, 41, 33, 92, 39, 83,165, 48, 58,172,239, 99,247, 88,174,150,228, 24,233,165,178,157,231,113,161,123,145,149, 82,102,145,
+ 38,183,207, 76,145,207, 62,121,202,227,199,247, 73,217, 83,253, 14,222,190,101, 91, 11,159,125,254, 41,183,111,239,179,187,152,
+184,123,231, 38,111,223,190,243,160,159,232,162,188,214,103, 54, 23, 23,108,214, 23,215,152, 60, 25,169, 90, 85,125, 52,213, 91,
+195,198,232, 43, 72, 96,185,187,207,147,167, 31,240,244,147,143,121,184,119,143,148,132,105, 90,178, 12, 75, 94,189,251,150,179,
+243,153,143,239,127,206,254,157,192,239, 94,255,158, 32,153,152, 61,179,220,153,239,158,119, 31,174, 51,146, 64,131,  3,133, 90,
+109,244, 33,176, 84, 81,143,232,235,206, 86,136, 98,164,148,189,  3, 48, 99,125,177,113,123,214,225, 59,214,155, 13, 55,119,246,
+ 96,202,156, 95,156,113,122,118,200,171, 87,135,188,120,125, 76,140,194,122,189, 37,133,196,157,155, 43, 79, 91, 27, 54, 66, 51,
+215,167,152,249,235, 33,248, 23, 63,242,125, 96, 82,140, 87, 69,142,235, 85,114, 74,204,115,227,244,108,141,186,234,147, 90, 11,
+134,121,128, 77,239, 64, 98,189, 93,115,251,246, 29,166, 41,162, 89, 72,139, 68,180, 70,136,145,144, 50,151,167,103,132,166, 92,
+108, 46,120,240,232, 49, 90,132, 23,175,158, 99,230, 83, 32, 69,136, 57,185,219,163,185,104, 51, 70,165,149, 78,111, 70,169,202,
+102,187,165,183, 13, 65, 50, 41, 11,243,246,130, 90, 10,101,222, 50,133,196,131,251,247,121,117,112,192,106,113,155, 71, 15,111,
+211,203,214,243, 16,172, 96, 59,  1, 43, 62,205,139, 57,248,228,173,251,168, 40,150, 70,143,174,168,127,245,187,111,153, 55, 27,
+146, 68,106,239,180, 46,190,254,  9,145,157,197, 14, 55,118,118,145,  0,167,151, 23, 92,170,113,124,122, 64,  2,150, 59,183,209,
+222,232,101, 75,211, 70, 22, 65, 53, 96,234,137,131,223,252,238, 45,127,253,139, 95,243,237,111,126, 15,151,103,196,190, 38,166,
+192,180, 51,  1, 51,139,189, 91,252,241,159,255, 33, 59,  4,126,241,203, 95,211,212,136,139, 37,189, 13,  6,128,203,104,208,228,
+ 81,184, 65, 92,108, 86,172, 49, 45,  2,235,245,134,121,219, 89, 78, 59,252,245,207,255,134,182, 57,231,199,127,244, 19, 30, 63,
+125,204,119,191,127,205,235,151,111,  8, 49,147, 72,227,108,243, 32,171, 22,161,184,  0,  7,219, 54, 74,203, 80, 10, 77, 29, 74,
+ 99,189,141,224, 15, 63,188,213,160,121, 42,144,227, 98,123,199,106,245,117, 68, 85, 98,138,  4,241, 51,170, 53, 35,  5,101, 21,
+ 34, 77, 29, 65,234,218, 37,191,120,166,201,  3,152,106, 83, 68,140,214, 61, 62,185,119, 37,141,231,180,138,141, 93,175, 79,143,
+218,176, 55,135,193,199,143, 49, 19, 82, 38,101, 37,212,138,244,140,153, 95,174, 26,125,237, 23,174, 28, 76,128, 73, 27,  9,194,
+ 46, 28,235,109,140,173,  5,186,186, 31, 63,197,236,207,160, 53,239,214,147, 59,120, 90, 23,230, 90,233,181,163,181,186,115,170,
+121, 96,149,104,167,197,238, 49,109,173, 57,193,180, 55, 68,148,214,219, 32,242, 49,220, 83, 70,235, 13,237,144,228, 42, 31,125,
+  8, 33,233, 88,112,135,143,154, 23, 36, 88,247, 24,219,152,221, 37, 48,184, 40,102,140, 85, 98,245,168,103, 92, 63,224, 63,133,
+241,158,113, 29, 25, 92,205, 95, 71, 14, 97,124,190,226, 23,187, 54,191,251,186, 67,208,180,123,238,189,137,135,115,185,160, 54,
+ 95,115, 90,176,238,140, 16,117, 77,136,217,247, 76,153,120,255,225,253,159, 74,136,215,255, 80,112,168,136,255,189, 92, 51,204,
+196,194,181, 50,221,130, 31,122,218,221, 78, 37,226, 93, 69, 74,227, 50, 28,101,129,168,199, 77, 94,253, 50,198,161,229,254,245,
+116,253,  6,219,168, 48,188,243,205,222,226,143,169,129, 12,  9,102, 83,223,214,167,228,172, 98,241,105, 38,166,141,222,188, 48,
+112, 75,150,139,233, 90,241,206, 95,132,209, 17, 95,137,197, 92,157,216,154,139, 70, 76,148,222, 60, 89, 45,166, 64,183, 78,173,
+238,169,190, 10,202, 75,226, 23,122, 55,168, 54, 34, 27,241,206, 38,134,232, 86, 59,140,144,133,136,249,123,149,134, 93, 47, 38,
+ 22,217, 31,232,156,124,162,145,166, 68,169,179, 71,242, 17,  8, 99, 20,147,  9,195,226,230,  8,209,131,247,111,121,251,254,132,
+128,139,152, 44,  8, 49,102, 82, 78,163,232, 24,175, 80,252,247,199,  0, 49,123,150,188,246, 74, 41,149,185, 84,239,194,  9,215,
+ 48,159, 24,220,114,209,186,143, 82, 76, 96,185, 90,177, 90,100,106, 45,108,231, 74, 85,239,162, 66,  8,132,148,145, 16,169,101,
+ 75,142,194,135, 31, 63,227,193,163, 71,152, 68, 98,232,172,210,196,221,123,119,120,248,248,  9, 31, 60,122, 72,206,206,119,206,
+203, 29, 98,242, 66,105,103, 49, 49,133,161, 23, 72,105,120, 63,253,121, 72,163, 34, 87,223,  3,248, 72,113,140, 16,230,178,229,
+244,248,136,111,190,253, 45,223,254,250,107,126,251,187,111,120,251,246, 21,239,223,191,163,108,215,180,121,230,254,221,155,228,
+101,226,197,251,175, 57, 63,219, 16, 87, 59,144,221,183,220,154,147,158,220,161,167,148, 14, 22,189, 91,238,165,210,186, 82,250,
+ 64,  2,119,144,236, 23,155, 52, 65,166, 72, 82, 97,187,157,121,119,124,192,249,246,144,180,232, 28,191, 63,226,229,219,119,156,
+156,156,113,118,118,204,193,201, 17,239, 14, 46,120,127,120,198,114,145,120,252,112,159,103,207, 62,224,135, 95,126,204,167, 31,
+220,226,197,171, 83,182,173,140, 80,161, 68,200,190, 56,177,232, 88,217, 24,174,160, 75, 54,166, 57, 92, 11,235, 66,246,244,193,
+ 50,123,134,130,160, 20, 85,  2, 94, 44,171,250, 69, 40,  4, 74,157,217,187,115,155, 27, 55,118,145,234,123, 81,235,193,139, 28,
+129,105,103,201,246,244,152, 50,207,220,222,191,201,249,188,225,240,240,  0, 53, 72,203, 21, 41,174,200, 49, 16, 70, 76,113,178,
+192, 86,157,  9,223,230, 45,115,171,148,245,134,109,217,144,243,202,215, 87,189,145, 17,154, 53, 22, 41,241,213, 15, 30,240,187,
+151,223,178,119,227, 14, 33, 71, 90,219, 66,143, 52, 19,114, 27, 22, 36, 58, 73, 22,244,217,105,134, 94,108, 71,103,129,107,231,
+240,240,144,179,139, 75,215, 19,212,142,106, 37,  5, 97,185, 88,144,147,219,254,206,183,151,215, 29,138,160,204,165,144, 87,123,
+  8,201,  3,154, 48,106, 43,168,109,209, 54, 99,173, 58,102,179, 42,191,123,254,138,255,247, 23,191,230,215,255,240, 79,124,252,
+240,  1,143, 63,186, 77, 59, 57,133, 54, 35,171,137,211, 55,103,252,199,255,231, 23,108,180, 49,133,132,116,241,  8,216,214,  9,
+105, 66, 66,118, 36, 43,157,253,229, 46,155,217,169,142, 93, 59,102,202,106,247, 54,167,103,151,124,124,127,143, 31,254,228,135,
+236,220,122, 72, 98,230, 31,254,233, 27,247,200,147,232, 85,145,101,242,172,185, 46,104, 53, 82,247,149,141, 31, 90,141,237,188,
+185, 62, 10, 29,162,225,110,158, 58, 38,155,  6,132,230,226, 81, 29, 36,189,214, 27,162,234,122,168,118, 37, 72, 14,108, 91,161,
+245,226,251,250,152,188,  8, 32,211, 77, 41,117,235, 35,226,174, 36,137, 88,136,132,156, 60,167, 35,102,180, 84, 98, 55,183, 89,
+245, 97,217, 10,222, 16, 25, 14, 91, 50,233, 68,243,145,126, 71, 73,187,174,119,200, 18, 29,187, 13,228, 20,145,152,104,189,187,
+168, 81,235,152,168,250, 36, 88,146, 11,167,193,134, 31,219,252,252,194,159,253, 54, 23,255,206,104,119,141,151, 26, 13,232, 58,
+211,187,139,218, 84, 13,109, 74, 41, 67,224,233, 32,143, 81,216, 65,208,136, 49, 95,131,202, 80,247,236,135,  1,  3,194,174,198,
+221, 74,178, 68, 41,141, 16, 59, 77,187,159, 37, 22,105,189,141,179,209,239, 21, 53, 71, 14,155,249,249,106, 97, 36,152,138,141,
+251,205, 87,211, 93,205,159,155, 17,111,206,152,134,235, 16,231,114, 53,237, 29,159,173,119, 60,142, 65, 55,115,104,141,105,247,
+215, 28,188,169,245, 84, 74,134,211,161, 59, 57,240,193,131,187, 63, 13,163, 67, 54,211,161,214,214, 33, 62, 50, 31,243,217,  8,
+ 66,  9, 78, 76, 19,240, 52, 43,243, 12,108,223,203, 15,161,221,136, 50,140, 35,228,197, 70,117,123,245,191, 32,120,  0,140,186,
+ 95, 48,100, 79,115, 51, 13,196, 56,198,237,216,176, 73,248,120,217,180,187, 96,109,144,223,100, 20, 26, 72, 28, 42,236,126,173,
+ 22, 86, 95, 51, 97,214,209, 40, 35,135, 79, 28, 85, 40,110,241,242,  7,211,197,101, 97,136,221, 66,240,135,175, 15,153,159, 43,
+208,187,239,194,109,224, 39, 51, 78,171, 35,186,104, 42, 69, 79,126, 11,230,136,216,152, 71,161, 33,136,172,188,240,  8,174,210,
+214,166,126,217, 34,172,114,114,157,129, 93,113,220,251,216,187,132,225, 62,128,245,229,  5,207, 95,188,161,206, 14,178, 49, 60,
+ 21, 46,135,124,109,203, 11,146, 80,148,185, 86, 36, 70,130,138,143,131,172, 83,183,101, 88,208,140,144,178,119, 21, 87, 59,118,
+134,253,103, 84, 90,171,197,138,156, 38, 23,255,168,127,182,136,187,  7, 66,114,237, 65, 47, 51, 41,  9,159,254,224, 99, 30,221,
+185, 51,118,248, 78,162,107, 77, 88,174, 86,220,218,223, 35,197,129,215,149,137,188, 16,238,223,191,195,211, 71,143,249,228,179,
+167,124,252,241, 51,158, 61,249,144,135, 15, 30,113,255,225, 93,110,238,238,114,107,103,135,144,188, 20, 21, 73,195, 34,230,106,
+104, 83, 87,131,247,238, 99,181,210,102,214,155, 51,206,207, 79, 57, 56,122,199,119,175,126,199,219, 55,111,120,119,112, 72,109,
+133,180, 52,230, 57,179,218,221, 71, 91,245,  3, 52, 14,132, 99,247,196,175,210, 43,117,174, 88,117,  5,189,135,225,116, 66,132,
+184,138, 44,210,146,165, 76, 88,156, 57, 63,191,228,226,244, 20,147, 53, 79,159,222,228, 95,253,235, 47,249,227, 63,249, 17,183,
+247,118, 57, 61, 59,227,226,124,195,166,174,169,181,113,126,186, 97,154,  2,159,124,254,152, 39,143,239,113,251,214, 62,235,121,
+195, 47,127,245, 29,239, 79,206, 60, 60,  7,119, 82,216, 40,151, 91,237, 62, 94, 31,154, 15,128,152,174,254,125,240, 16, 33,241,
+ 80,150,222,174, 44, 50,230,100,177,161,152,237,221, 45,153, 68,207, 91,120,250,228, 25,121,218,115, 77, 72, 82,178, 37,154,118,
+186, 42,139,197, 13,142, 78, 79,152,231, 66,140, 75, 14,142,222,115,126,121,129,154, 49,165, 76, 78,153, 24,242, 72, 21, 27,249,
+  6,  5,230,178,245,253,174,186,190,100,179, 89,179,179,191, 67, 94, 44,192,148,156, 38,164, 11, 33, 27,127,246,195,103, 20,221,
+241,233, 76,104,212, 16, 89,165,228,182, 83,160,149,121,196, 45,  7,180, 27, 83,112, 65,106, 27,171,151, 32,254,188,190,123,243,
+  6, 53, 31,139,202, 32, 39,106,112,234,222, 92, 11, 18,125,  2, 54,207, 30,106,212,123, 33, 38,183, 71,181, 90,  8,193,104,218,
+169,243, 76,169,227,253, 11,145, 40,129, 73, 18,197,224,240,240,130,143, 30,223,226,214,222, 77,222,190,124,203,241,233, 41,155,
+227, 99,254,195,127,254, 57, 63,255,229,183,110,229,237, 46,234,109,204,238,224, 69,145, 56, 17, 13,202,188,117,212, 44,194,118,
+187,198,186, 51, 61,130,  4,214, 23,107,246,246, 18, 79,159,220,231,238,253, 61,110,222,186,205,193,187, 11, 94,189,120,139,100,
+143,131, 13, 26, 40, 42,132,214, 92,104,137,249,104,183, 55, 36, 54,106, 83,130, 76, 76,171, 21, 18,179, 71,226,106, 64, 91,245,
+ 11,163,225, 17,209,210,136,109,184, 64, 26,222,192,  8,222, 49,154, 81,108,156, 97,113, 92, 54, 33,208,181, 32,221,155,129,166,
+184, 67, 32, 12, 55, 17, 30,208, 67, 87, 84,103, 23,227, 38,255, 28, 50,222, 77, 55,115,161, 88, 83,195,250,140,116,163,139, 23,
+151, 26,148,212,101,  8,103, 61, 52, 75,128, 20,  5,181,177,  6, 28,128,179,101,136, 72,158,152, 96, 36,241,141, 75, 61,169,175,
+ 78,171,249,110, 91, 32, 38, 40,173, 19,174, 96,161,226,214, 63,  9, 46,218,179, 90,177,226,246,178, 56,208,184,173, 59,142,156,
+ 46, 67, 43,213, 92,249,111,174, 35,106,234, 26,170, 74, 31, 76,148,192,108,190,170,160,122,199,174,162,158,144,168, 66, 12,213,
+ 11, 70,117,181,185,141,  9, 50,102,244, 16,168, 84,  7, 88,209,  6, 88,198,  6, 74,124, 52, 86, 68,108,196,  6,119,237,164,224,
+ 98,111, 85, 35,152,211,255,166,232, 12,148,110, 67,159, 96,234,119,131, 94,173, 80, 96, 74,131,212,103, 62,170,167, 42,  9, 25,
+197,184, 23, 77,126,128,143, 88,200, 64, 64,194, 80,177,247, 43,180,169, 98, 36,223,211,104, 31,222, 58,239, 92,131, 25,166,133,
+102,193,119, 36,248,110, 55,166, 97,145, 24, 69,131, 96,238,205, 30, 92,117,183,186,123,215, 24,178,139,241,100,164,178, 49, 48,
+141,202,  8, 90, 48, 35,  6, 31, 11,169, 66, 78,217,197,121,230,201,104,158,163,110, 87,141,171,219,134,186,211,219,100, 68,217,
+217,213,104, 94, 96, 74,129, 46, 62, 77, 88,165, 48,172, 12,227,193,138,254, 87,195,173, 93,174,118,175, 68,117,159,116,192,119,
+236, 12,255,187,133,192, 52,  8,118,137, 72,136,138, 82,220, 30,163, 35, 70, 49, 12,127,166,193,102,158, 93,141,218,141, 28,161,
+182, 64, 53, 35, 14,192, 77,180,206,241,209, 17,235,117, 37, 79, 11, 98,188, 54, 87,249, 24,200,146, 71, 99,134,136,182, 25,173,
+142,147, 36, 70,223,161,209,105, 87, 97, 58,226, 95,124,144, 33, 70, 28, 56, 92,103,255,178,183,218, 97,239,134, 19,227, 74, 85,
+191,208,237,170, 91,112,235, 90,157,103,246,119, 22,124,244,209, 51,110,222,185,197,146,177,147, 11,238,191,235, 81,104,193, 71,
+ 93, 89,  2, 57, 70,178, 24,181,204,104,116, 18, 24, 65,152,166,204,254,206, 29,238,106,163,196,193, 15,152, 27, 77, 27,141, 70,
+189,172,204,155,153,109,221,114,121,122,198,182, 84, 78,207,206,217,206, 91,230,222,152,231, 58, 62,115,  7,112, 69,132, 94, 11,
+ 47, 94,125,199,187,163,119,252,248,203,175,184,255,228,  9, 89, 34,101,144, 15,117,246, 63,211, 34,100,182,205, 64, 43, 75,132,
+173,121, 14,168,136,139,  5,187, 94,241,218, 61,236,102,110,199,176,154,248,163,175,158,242,249,167,143,217,191,245,136, 26,215,
+156,189, 59,224,252,114,166, 53,175, 86,247,151, 43,182,173,112,247,214,210,163, 83,167,  5,235, 75,229,249,203,151, 60,127,121,
+192,249,201,154,157,157, 60, 16,157,174, 37,185,174,198,205,177,186,173, 43, 41,184,157,138,222,135,110,194,217,  3,243,166, 58,
+  0, 10,232, 50, 32, 80,214,221, 50,164, 29, 98,194,186,179,235,247,119,247,216,191,177,130,108,216, 28, 49, 38, 26,129, 30,183,
+131, 88,165, 92, 94, 94, 96,166, 28, 95,158,177,217, 94,210, 90,245,236,  7,235,104, 47,148,226,182,202,218,189,227, 17,113,218,
+ 97,217,120,129,232,228, 66,248,147,175,158,177,183,183,207,127,250,249,175,216, 70,103,232, 55, 77,156, 85,229,206,205, 15,185,
+220,188,195,172,186,179,166,206,196,100,204,179, 50, 13, 86, 64,239,149, 36,141,218,149, 90, 11, 49, 37, 52,  8, 77,133, 91, 55,
+110,115,247,222,125, 46, 78, 14, 60, 19,222,160,213, 54, 26,  1,159,210,245,162, 88,114, 30,122, 31, 98,165,237,217, 25,203,157,
+125,154,217, 88, 19,204, 78, 95,171,219,161,  1,138,180,224, 54, 32,130,210, 52,240,159,127,254,119, 92,110, 47, 29,218,179,204,
+244,237,204,207,126,246, 91,154,249, 51,131, 86,234,128,146,168,184,122, 59,216, 26, 20,138, 86,206, 46,207,216,221,185, 73,235,
+221,105,111,150,216,174,215,172,107,225, 55,223,188,231,151, 63,251,175, 44, 22, 11,158,125,242, 17, 79,159,236,241,237,173, 93,
+222,157,215, 65, 95, 44, 35, 74,217, 92, 26,213, 59,166,  9, 74,163,180,230,235, 76, 18,165,108,137, 49, 16,186,239,226,147,224,
+182,195,232,151,170,199,176,118,255,239, 99,118,212,174,245,235,213,131, 12, 14, 70,107,190, 94, 42,163,104,215,190,165,169,103,
+104,164,  0,189, 39,170,205,196,184,160,215,153,185,117,166,  9,186, 85,164, 71, 90,139,232,213, 51,172,160,177,185,  8, 55,234,
+112, 46, 57,209, 83,204,156, 98,215, 42,154,129, 58, 46, 93,243,  6,224,234,252,113, 54,  7,244, 86,  9, 18,201,146,232,166,206,
+ 19,240,217, 39,203,149, 50, 91,167, 87,104,181,147,122,248,190,  1, 85,163, 23,159, 56,134,152,125,197, 53,208,220, 69,  5,233,
+213,155,172, 56,249, 72,187,117, 82,244, 81,120,243,202,216,185, 42, 99,202,137, 25,149, 62,190,167,  3,110,150, 19, 90,253,253,
+157, 12,186,137, 79, 56,175, 86, 25,214,  7,198,103,140,194, 49,106,175,164,161, 27,  8,233, 10,157,142,127, 31,166,  5,210, 60,
+212,154, 81,200, 16,156,230,231, 43,  0, 95, 87, 88, 20,186, 65, 30, 43, 96, 21, 29,105,122,130,201,194,139,102, 43, 88, 20, 82,
+247, 66,  1, 11,  4,105,174,126,247,226,200,133,101, 54,114, 93,163, 93, 49,223,227,245,152,215,217,196, 46,154,210, 48,120, 37,
+166,174,176, 20,103,165, 75, 24, 49,144,214, 93,225,126, 37, 60, 27, 23,174,142,238, 63,228,201,233, 91,221,133, 28,193, 92,192,
+ 17,130,124,127, 17,169,239,196, 98,242, 98, 40,146, 49,173,168,248,129,131, 92, 29, 60,226,169, 54, 67, 41,175,234,138,226,222,
+253, 77, 78,214,125, 44, 79, 36, 68,127,160,186, 42, 77,125, 95, 95, 77,199,174,201,247,219,142,220,236, 52,243,202,191, 99, 78,
+241, 82, 67,171,209, 68,201,113,225,157, 18, 56,230, 48, 36,194,228,106,126, 23, 55,249,100, 32, 52, 99,177, 19,105,150,145,162,
+196, 36,168,102,232,138, 76,157,156, 19, 92,118, 82, 18,234,168,144,183,243,134,195,211, 11,223,163,  4,135, 13,136, 68, 31,245,
+ 39,255, 60, 34,217,  1, 26, 97,197,206,106,242, 14, 63,120, 53,218,155, 11, 87,124,231, 10,214,132, 24,199,164,162, 15,137, 86,
+ 72,220,220,219,227,230,222, 30,115, 45,116,173,174,131,107, 62,250,137,100,162, 36,182,219, 13,183,246,118,248,252,  7,159,178,
+179, 88,161,189, 49,135,136,105,164,181,153, 60, 77,238,229, 15,209,225, 54,109,198, 66, 70, 84,153,166, 29, 66, 18, 47,106, 12,
+250,220,217,234,165, 43,135, 27, 72,107,190,163, 34, 49, 77,145,221,213, 14, 11, 11, 84, 25, 85,117,247,170,122, 46,149,185, 94,
+ 50,111, 59,109, 46, 92,108, 46,216,172, 43, 23,103, 27,230,178,165,246,198,118, 91,120,253,238, 13,207, 62,249,  8,116,102, 25,
+ 97,182,128,133, 68,154, 12,102,239,254,187, 37, 23,206,153,143, 84,139, 22, 22,113,137,  6,227,232,253, 27,206, 15, 79, 80, 43,
+ 60,251,248, 30,127,250,163, 47,249,236,211,143,168,210, 57,219, 28,242,230,249, 17,207, 95,188,226,245,203, 99,222, 29,188,167,
+206,202,249,153,175,107, 52, 68,246,196, 71,140,175, 78,103,222,189, 57, 68, 21,166, 69, 30,123, 34,187, 22,186,244,246,189,231,
+127,208, 51,137, 83, 34,154, 81,139,142,156,  5,103,203,187,176,110, 20,169,234,  9,136, 14, 72,  1,186, 31,110, 72, 64,187, 50,
+237, 46, 71, 23,220,153, 38,223,125, 54, 81,164,  5, 66,111, 88,223, 80,234,150,139,205, 37,251,201,199,221, 86, 59, 58, 69, 74,
+131, 88, 60,129,171, 53,231, 38, 36, 34,183,246,118,185,245,232, 62,243, 60,115,112,124,196,209,187, 45,165, 54, 62,120,120,131,
+251,143, 30,242,151,191,252, 53,171,213, 10,  9, 19,203,  4, 55, 86,187,180,176,164,190, 86, 31,187,214,202,108,129,108, 11, 76,
+214,254,236,171,127,183, 26,213, 35,100,147, 67,116,130, 69,214,235,194,251, 55,175,217, 92,158, 95, 31,134, 18,  3,189, 20,162,
+  5,100,225,  7,143, 26,180, 90,252,  2,145, 54,120,218, 51,155,141, 63,189, 69, 43,148, 74,183, 74,235,243, 72, 98,100, 76,179,
+  6,227, 34, 24,223,190, 58,225,213,193,223, 18,  2,164, 69,162,215,206,155,131,  1,186, 25,147,175, 56,212,211,155,170, 36,203,
+228,133,  7, 45,181,  6,155,205,204,237,125, 99, 38, 51,215,130,138,114,177,217,208,204, 56,186,156,249,199,111,222,115,243,238,
+ 63, 50,207,194,148,133, 56, 53,127,125,243,102, 20,107,145, 24,156,159,222, 76,  9,221,  3, 88,122,129,148,160,197,177, 54, 88,
+ 23, 31, 57,  7,  7, 28,245, 10, 65, 60,194, 53, 72, 34, 37,165,170,123,200, 67, 80,122, 15,  4,117,117,248, 50, 70,146, 84,108,
+130,106,145,208, 11, 50, 67, 17,199,194,250,250, 58, 97,189,250,  5,210, 10, 21, 67, 19,108, 55,141,101, 88, 18,146,175, 58,139,
+ 25,105,146, 33,118,118,251, 44, 42,  3,190,210,253, 78,  8,  6,213,207, 85, 33, 58,148,174, 43,219, 50,123,110, 60,129,104,222,
+ 20, 20, 51,255,158,  7,176,224,118,190, 60,160, 43, 98,226, 72,228,209, 57, 71, 17,114,202, 52,107,152, 54, 23,111, 91,101, 10,
+145,174,141, 41,249,247, 29,237,204,120,243,167,  6, 86,202,160,181, 57,190,150,216,  9, 54,210,198, 66, 35,132,136,149,193,137,
+  8, 35,110,220, 60,223, 32, 52, 47, 30,  6,176, 16,105, 70,235,176,  8,114, 29,128, 22,131,255, 46, 27,211, 16, 27,107,198, 16,
+109,104,  9,124,154,171,226,223,183, 78, 39,152, 11,233,132,129,125,  9, 50,130,185,100, 60,223,131, 30,163, 14,100, 51,115,184,
+ 78,  8,153, 64,165, 42,164, 52, 13,238,130,187,188,170,205,152,101,210,148,211, 53, 65, 76,162,145, 36,186,215,188,186, 21,202,
+ 35, 29,135,244,205,240, 39, 77, 28, 81, 42,193,223,168,124, 37, 38, 11,120,247, 27, 92,  8,208,171, 91,116,166,156, 60,180,195,
+209,101, 88,136, 94, 65,170,251,221, 37,248,151,199,205,244,174, 42, 84,  4,137,145,116, 53,118,144,224,225,  6,201,109,110,125,
+ 28,118, 58,210,204,174,252,244, 78,236, 50,166, 36, 16,197,173, 77, 87,244, 58,241,241, 83, 10,238, 19,141,209, 83,136,252,146,
+ 31,190,120,186,115,134,211, 68,186, 50,  3,180,161,142,183,200, 98,202,222, 77,137,250, 67,150,253,181,182,222,145, 58,118,111,
+163,194, 18,235, 52,137,216,172, 30,  7,155,147,191, 86,153, 60,213,203,130,143, 83, 71,240,202,148,  4, 26,156, 28, 29,177,221,
+110, 73,121, 49,108,118, 78,226, 51,113,213,187,116,229,178,156,123, 76, 97,200,164,232, 22,149,170,149, 82,188, 67, 55, 11,  4,
+190,  7,240,244,238,159, 35, 24, 33,  9,203,157, 37,211, 98,193,118,222,178,221,206,148,174, 94, 33,170, 33, 41, 16, 82,160,213,
+153,189,157, 37, 31,125,250,  9, 55,119,110,248,197,143, 82,187,191,239,116,232,165,145, 87,201,133, 78,132, 17,222, 80,135,229,
+ 78,233, 51,144, 19, 49, 76,244,114,137, 36,136, 53, 80,164,248, 26, 41,249,225, 48,205, 66,223,129,139,214, 28, 18,163, 30, 95,
+184,147, 50,139,165,176,220, 91, 16,250, 68,138,193, 81,148, 93, 41, 27, 69,181, 81, 74,101, 59, 55,106, 45, 14, 29, 34, 19,243,
+  2,237, 51,211,232,112, 52, 85,122, 80,122,117,122, 97, 87,163, 39,255, 98, 93, 92,158,240,230,237,107,202,118,205,221,  7,187,
+252,201,143,191,224,233,  7, 79,184,183,191,224,229,235,215, 28,157, 93,112,124,252,150,151,191, 59,230,253,201,134,139,205,154,
+205,122, 38,196,204,122, 91,169,189, 33,221, 59,140,222, 59,111,223,156,250,184, 49, 45,156, 15, 80,219, 16,133,126,239, 83,151,
+  1,  3, 82, 51, 82,136,104,113, 20,230,213, 84,170,142,188,234, 41, 39,239, 54,209,161, 52, 30, 41,133,221, 15, 12, 53,151,218,
+160,234,191, 15,119,142,244,230,154,136, 94, 28,208, 19, 36,178,202, 11, 38,113,187,141,213, 70,195,147,190, 68, 33,139, 57,  7,
+ 91,113, 53,118, 74,220,190,181,207,141,219,183, 60,239,249,252,146,157,197,130, 47,255,236, 75,126,243,207,240,219, 23,239, 57,
+ 88,119, 22,121,197, 78, 90,113,190, 94,115,161,153, 60,173,120,124,119,159, 95,125,189, 37,247, 72,154, 18, 76, 66, 91, 55,176,
+192, 86, 11,180,128, 36, 63,180,187,  5,178,  4,106, 54,222,191,125,195, 63,125,253, 27,108,158,137,217, 29, 29,115,117,186, 92,
+ 16,161,170,210,202,214, 69,158,113,216,137,112,116,116,143,238,244,176,205,  6,137,110,169,181, 40,244,210,  8, 33,249, 94,146,
+ 48, 38,117,238,116,137, 67,196,187,187,187, 67,179,206,209,217, 57, 71,167,107,223, 75,  6,215, 11,140, 22,206,215, 67,106,174,
+248,174, 67,148,106, 74,221, 20, 46,215,231,164,229,  2, 93, 87,106,245, 17,100,110,129,237,220,248,221,251, 99, 30,127,247,134,
+128,114,247,209,167,252,201, 31,253,152,119,255,233,215,204,165,147,178, 43,206,105,130,180,230, 90,  6, 81,102,221, 16,131, 16,
+101, 98,219,252,210, 10,209, 40,173, 66,117,196,105, 90,152,123,211, 45, 17,233, 20,109,238,151,150,136, 21,131,169,210, 69,188,
+176,178,206,166,155,235, 68, 48, 52,122, 96,151,153,121, 32, 81, 53,135, 53,153, 95, 78,168, 55, 87,193,154, 35,104,163,145,241,
+187,161,217,150, 94, 51,193,250,  0,139, 13, 79,188, 69, 50,193, 65,114,173,248,239,202,209, 27, 54,109,100,240,232, 99, 11,228,
+180,164,  7, 31,137, 47, 82,164, 79, 25,  9,153,214,103,135,182,196, 78,159,135, 86,196, 58, 83,152,124,165, 16,157,222,167,227,
+245,105, 52, 66, 95, 64,223,140, 48,166,171,239, 87, 98, 10, 13, 22, 75, 58,141, 86,  7, 27, 37,249,189, 21, 67,192,130, 83,240,
+250, 80,107,215,226,128,165,148,196,249,  4,  8, 21, 31,189,199,241,157, 37,121,130,105, 28,123,114,233,120,241,163,254, 44,132,
+152,209,226,239,135,133,238,150,186,170,132, 60,194,202,204,245,  0,134,141,187,210, 41,165,140, 12, 17,223,233,123,147,234, 23,
+117,244,212, 75,191,245,253, 46, 18, 87,243,135, 24,208, 90,208, 14, 51,190,122,179,110,180, 94,137, 31, 60,121,248,211, 16,130,
+179,200,  7, 43,125,146, 72,140, 54, 50,214,125, 39,236, 73, 97,174,126,215,107,141,188,143,237, 85,100,192, 94,124,111,226, 34,
+243, 56,140,241,190, 23, 39,142,102,121, 80,219,  2,190,219, 38,197,239,119,226, 35,192, 32, 12,118,176,143,186,  7,138,112, 84,
+ 56,170, 62,238,182,145,  4,110, 64,235,230, 20, 38,174, 30,198,224,135,155, 94, 13,173, 93,196, 54, 68,134,215,136, 85, 69, 71,
+120,135, 31,184,138,177,154,226, 16,116, 76, 64, 96, 18,163, 53, 29,254,204,140,226,  9, 94, 59, 83,118,204,172,185, 13, 37,249,
+164,206, 59,156,156,198, 84, 66,  9, 57,195,232,176, 99,134,168,201,171,213,144, 61,197,103,116,189, 33, 56, 46,247,228,226,148,
+231, 47,222, 80,198,207,137, 33, 32,164,161, 50, 55,162, 36, 68, 34,203,189, 93, 62,251,244, 41,155,203, 11,230, 82, 80,243,204,
+115,237, 46, 40,116, 18, 19,195,101,224,107,138,213, 98,201,238,106,193, 34, 77,228, 52,177,153,103, 15,231,168,109,136, 63,198,
+151, 98,140,135,247,247,246,249,193,151, 95,112,235,214,174,115,171,195, 24,139, 13,109, 66, 72, 48, 77,  1,137, 19, 65,132, 69,
+ 22, 22,209,195, 85,  8, 94, 38,171,186, 13,144, 86, 92,200,178,173,148,160,196,180, 24,228, 47,231,248,231, 28,233, 10,117, 91,
+124, 71,103,145, 90,175,104,108, 35,123,186, 42,235,186,101,189,153,209,218, 73,  4,114,154,200,147,176,179,187,100,218,217,197,
+146,142, 73,142,161, 73, 64, 58,165,109,233, 10,189,141,169, 77,240,247,176,215,153,195,247,239,120,251,246, 53,214, 58, 31,124,
+240,128, 31,125,246,132, 39,247,238, 97, 65, 57, 60, 58,229,155,231,111,248,237, 63, 63,231,235, 95,191,228,221,241, 57,151,151,
+ 27,234,218,197, 53,189, 22, 90,245,  4, 49,134,168,235,252,108, 30,157,160,199, 65,234,176,171, 13, 93, 11, 58, 68,158, 97,120,
+ 39, 83,156,188, 75,163, 12, 90, 30,180,238,225, 54, 62,253,234,126,152, 95, 89, 49,245,191, 85,157,186,156,215,204, 15,180, 15,
+ 63,120,202,195, 15, 31,208,170, 23, 70,214,  6,241, 49, 71, 52,185,  3,225,213,239,126,207, 92, 46,217,219,221, 39, 69, 72, 83,
+230,246,157,219,236,223,184,193,238,206,130,148,  2, 41, 76, 60,120,240,144,189,253, 61,150,203, 37,155,237,153,135,117,244,198,
+159,253,233,231,252,235,127,249, 99,126,253,143, 95,243,250,229,  1,111,222,189,101,110,107,132,202,235,215,175, 57, 61, 63, 33,
+ 10,108,  6,201,177, 26,208,157, 21,222,205,167, 63,102,  5, 13,133,160, 70, 32, 82,154, 79, 39,222,188,250,142,163,247,111,137,
+ 41, 59,224,232,106, 42,193,  8, 95, 25,223,103,  9, 54,132,142,205, 15, 56,145, 49, 97, 26,194, 36,171, 99,119, 89, 17, 83,210,
+208,164,  4, 92,212,100,195,203,174,138,187, 57, 22, 75,126,240,233, 99,254,252, 39, 95,113,112,180,230,232,228,140, 56,214, 89,
+170,221,167,  8, 81,198, 72,246,138, 94,232,150,203, 40,208,212,184,121,251, 22,189, 42,165,108, 89, 78, 25, 11,137,121,179, 33,
+ 50,177,179,152,216, 93,116,226, 98,129,234,146,111,191,123,193,220,221, 13,209, 90,103, 46, 74, 76,110, 57,108, 29, 66,118, 36,
+104, 47, 46,105,106,214,105, 10, 42,126,192,196,225,138, 16, 38,186, 56, 69,207,146,147, 59,181, 86,178,186, 86,199,  5, 91,126,
+ 89, 89, 31,251,216,224, 54,219, 86,189,136,204,196, 49,229, 16, 90,173,174, 59,  0,212, 26,145,  4,137, 49, 78, 22,230,238,162,
+211,148,134,206,195,198, 25, 51,156, 53, 17, 27,252,244,224,205,105, 28,206, 40, 53,202,240, 94,  7,247,  2,121, 48,214,240,105,
+ 95, 77,205,164,123, 62,195, 21,  7, 37,139,143,251,175,144,102, 82,125,245,192,176,174, 90,247,  3, 93, 71,123,103,131,186, 86,
+205,191, 63, 50,146, 58,175,162, 99,137,248,  4, 49,164,161,100, 31,196,205, 16,137,  9, 66, 28,142,151,101,246,207,192,188,166,
+115, 33,162, 91, 79,227,176,  5,171,185,139,160,117,255,243,197, 48,194,181,  2, 87,139,210, 97, 55, 27,106,252,232,211,239,126,
+ 69, 33, 21,103, 80,136,233, 88, 53,140, 29,122,184, 34,124,250,138, 88,213, 32,250,250, 54,  6, 29,172, 16,220, 74,173,230,147,
+ 39, 17, 44,  5,114,200,244,174,196, 71, 15,239,254, 52,132,116,189, 31, 13, 34, 99, 95,235,227,135,156, 93, 12,150,134, 36, 55,
+135,232, 25,187, 38,228, 44,164, 33,252,  9,146, 33,  8, 57, 48, 50,199,251,247, 66,177, 96, 67, 72,231, 85,160, 68, 39,101, 37,
+146,119,239,138, 63,189,209,198,126, 79,135,  7,211,199, 94, 87,231,151, 12,235, 91, 12, 35,215,124,140, 66,162,248,133, 23,174,
+119, 20,134,225,182,183,104, 87, 98, 46,187, 86,235,135, 48,248,207, 10, 41, 37, 31,  7,171, 34, 41,123,215, 52, 86, 10,225, 90,
+185, 31,134,125,220, 19,200,  2, 66,206, 17, 73, 78,251, 82,243,206, 32,192, 16,  7, 14,237, 64,  8, 36,113,192,  8, 18, 73, 41,
+147, 70,151, 72,116,225, 91,104,145,144,  2, 41,123,140,233,203, 23, 47,120,127,188, 33,  7, 87,198, 42, 78, 52,242, 11,222,173,
+108, 57, 46,185,255,225, 83,246, 86,153,131,131,247,180,238,221,106, 99,248, 44,199,123,165,227,240,239,173,177, 88,237,242,233,
+ 71, 79, 73,162,180,106,148,222,188,106, 52, 70,242, 83,191, 38,226,165, 36,220,127,112,159,143,159,125,196,254,254, 98,240,134,
+ 59, 70,119, 81,158,  8,139, 24,145,144,  8, 22, 89,166,204, 32,241,146,162, 34,221, 85,150, 17,195,121,  0,  0, 32,  0, 73, 68,
+ 65, 84, 81, 53, 14,101,107,107,244,106,212,222, 33, 39, 31, 55,141,209,102, 88, 64,102,120, 64,107, 39,238,184,182,195,196,181,
+ 27,105, 74,172,210,130,222, 58, 51, 91,130,  6,106, 51, 98,134,162,176,169,157,106,174,  2,183, 40,244,173, 39,239,165,168,244,
+217, 19,204,226, 78,134,117, 35, 36,119, 66,104, 23, 46,214,151,188,120,241,156,227,195,119,164,148,120,252,248, 30,207, 62,188,
+ 77,154,150, 92, 94,108, 56, 59, 59,230,159,190, 61,226,229,139,119, 28,159, 92,114,185,105,148,109,119, 10, 97,239, 72,  8,212,
+185,146,162,211,214, 74,113,139,228,200, 58, 28,202,213,177,186, 26,244,168, 97,226, 28,194,184, 43,185,156,103,  9,228,148,136,
+ 18,168,213,201, 87,134, 67, 55,180,251,116,203,139,231,241,124,143,113,190,224,251,197, 48, 70,118, 31,126,244,148,221,188,235,
+192,163,156, 40, 24, 49, 47,252,155,160,149,180, 90,160, 58,243,201, 71,159,242,217, 23, 95,240,236,222, 67,238,223,127,194, 71,
+159,125,193,141,253, 91,236,173,110, 34, 18, 88,237,237,176,123,107,207,211,173,  4,118,151, 59,220,188,125,159,203,205, 37, 39,
+103,149,255,254,223,252,  5, 95,125,246, 33,255,252,205,119,252,230,235,127,230,243, 79, 62,227,243, 47,127,204,102, 19,249,235,
+159,255, 21,173,117,110,223,121,132, 76,129,216,133, 82,182, 46,172,138, 99,189, 35,197,103,142,234, 34,185, 56,172,175,111,223,
+188,229,236,236,  4,137,129,218,113,177,173, 65, 27,103,132,136, 79, 36,174, 10, 37, 29,151, 87,111,  3,113,109,206,144,240,226,
+215,190, 63,  0,211,228,  7, 72, 47,174,  6,113,201,182,139,103, 85, 57, 59, 95,243,238,240,148,109,237,188, 59, 60, 99,189,217,
+248,119,118, 16,  7,175,224, 85, 30,131, 49,118,252,189,141,243,201, 51,198,151, 97,201, 34, 79,172, 55, 23, 35, 74, 26, 54,181,
+178,156,150,220,216,223,229,230,221,125, 98, 16,190,254,250, 27,222, 28, 28,210,106,244,104,229,170, 16,157,205, 16,136,  4, 51,
+ 84, 20,107,117,116,123, 74,235,149,208,187, 79, 15,134,208, 77,212,249, 32, 34,157,201,140, 74,  0,139, 46, 84, 85,255,238,244,
+110,200, 20,189,166,174, 51,178,136,116,137, 80,189,251,116,104,138, 39,138,185,141,202, 65, 52,134, 39,198, 49, 10,169,201,160,
+ 89,164,106,247, 53, 94,115,125,129, 12, 17,107,183,113,166,171,167,190,105,215,161,255,240,130, 61,154, 79, 23, 66, 31, 73,154,
+ 58,146,  9,135,173, 59,117, 15, 48, 49,117,253,149, 74,245,115,184, 27, 57, 64,193,133,207,166, 66, 27,201,158,100, 25, 58, 41,
+127,143,212,  6,  0, 12,189,126, 93,173,251,179, 50, 69, 95,121,169,  8, 22, 59, 29,165,107, 24, 12, 18,183,210,198,232,147,199,
+ 48,114, 53,162,184,208, 91,134,106, 61,  5,223,249,143,173,215, 40,166, 71,180,182,186,125, 45, 40,232,120, 46,186,186, 29, 55,
+ 17,220,245,131, 79, 86,204,220, 97,  0,110,125,182,232, 13,160,168, 12,138,157,235,166, 66, 12,184,214,239, 74, 31, 31,104,125,
+252,204,225, 46, 98,196, 45,187, 39,219,241,197, 34, 66,188,113,107,239,167,243,118,166,110,103,230,178,101, 91, 42,219,185,186,
+ 98, 15,175, 52,100, 36,203,132, 32,126, 49, 77,233, 90,204, 48, 45, 18, 41, 77, 44,242,130,197, 40,  0,124,239,235,213, 68,140,
+ 30,  7,153,226,184, 34,  7,173,205,212, 71, 33,150,252, 66,116,101,188, 17, 76,137,230, 16, 16,141, 35,237, 39,184,103, 29, 13,
+ 99, 13,224, 15,146,118, 87,204, 94, 69,143,146,133,160, 94, 81,129,179,205,221,255,238, 73, 86,190,171,247,226, 68,213,223,139,
+ 62, 68,108, 46,  8,154,152,166,137,197,120, 64, 21, 27, 44,120, 23, 50,137,137,167, 37,198,232, 97,246,193,223,224,100,208,131,
+ 16, 82, 32,146,200,203,137,197,238,138,189,157, 29,143, 44, 12,145,180,200,254, 97,198, 65,239, 19, 37,165,232, 36, 49, 20,137,
+194,229,229,154, 87, 47,222, 48,143, 47,157,  4,207,215,205, 57, 17, 83, 30,163,230,198, 20, 19,189, 52,222,191, 63,166,245, 70,
+109,149, 86,170, 31, 96,100, 66,  8,131,252, 54, 56,194, 49,243,217, 39,159,241,201,135, 31,112,122,114,204,241,229,197,  8,167,
+105,244, 62, 32, 12,230,222,208,219,119,110,241,209, 71, 31,240,225,179,167,228,156,177, 86,168,221, 71,167, 98,230,168, 73, 22,
+ 44, 86,113,248,215, 23,132,165, 14, 21,183,143,132, 91,183,107, 78,126, 25,100,187,176,240,  3,112,154, 38,168,141,190, 45,254,
+190,103,163, 84, 88,152, 19,  6, 93,183,225,236,227, 62, 37, 22,198,112, 10,  8,181, 85,122,141,254,108,150,234,218,134, 20,152,
+154,171,230, 67, 16,114, 78, 44,131, 31,120,  1, 87,  0,247, 25,164, 87, 90,168,108,186,242,254,253,  1, 47,190,251,142,245,229,
+ 41,251, 55,119,185,119,255, 22, 55,118, 92,124,178, 89, 55, 14, 15, 79,121,245,250,136,231,175,143, 56, 60, 60,101,189, 25,150,
+159,218,152,107, 37, 70,231,235,107, 11,212,  1,177,104,117,118, 71, 64,112,  1, 91, 24, 30,252,136, 23,119,138,251,139, 51,110,
+207,188, 74,112,186,218,187,153,186,194,223,221, 19, 12,111, 52, 67,244, 52,162,117,213,191, 31,225,218,238,226,211, 59, 51, 47,
+196,159, 60,253,  8,201,137, 44,209, 99, 74,131,176,191,152,136, 57, 51,207, 91, 98,217,186,102,165, 41, 71,199,135,156,109,103,
+ 34, 66, 52, 79, 46,204,217,145,167,  0,139,180, 66,181,147, 45,178, 90,253,255, 84,189, 89,179,101,217,117,157,247,205,213,236,
+125,154,123,111,246,153,149, 89,149,213,163,  0,  1, 32, 77,  5,101,218, 18,237,  8,203,150,195, 86,  4,195,244, 79,194,223, 81,
+132, 95, 28,126,115,132, 27, 89,242,  3,  3,148, 68,152, 36, 72, 11, 64, 53, 89,168,204,170,236,111,115,206,217,123,175,102,250,
+ 97,206,115,147,126, 66,  1, 72, 36,238, 61,205, 94,107,142, 57,198, 55,214,204,125, 97, 60,219, 80, 84, 89,246,149,255,238,159,
+255,103,252,250,203, 39, 60,249,246, 57,143, 31,190,199,221,251,239,241,241,195,219,220, 60, 91,113,227,206, 35,134,237,138, 48,
+  9, 61, 68,163,139,149,163,139,221,253, 24,101, 66, 37,160, 13,115, 12, 15,208,150,153,231, 63,252, 64, 80, 33,134, 68,239,213,
+ 47,244,150,138,209,238,149,195, 88, 42,195,228,204,  2, 33, 26, 23,254,232,182,238,248,170,207, 38,236,186, 52,119, 92,119, 22,
+231,237,219, 36, 27,124,106, 74, 28,166,153, 31, 94,188,226,176,219, 95,151,249,104,247,135,183,119,146,103,177,110,243, 20,227,
+245,129,213, 20, 95,117, 52,198, 60,112,168,197,113,213,217, 92,248, 57, 17, 55,198,164, 80, 26,245,176,227,229,121,101, 58,242,
+191, 59, 70,135,171, 66, 81,107, 39,236,158,139, 87, 53,133, 34,123,175, 69, 80,143, 17,143,206,182, 72, 22,129, 43,170, 72, 52,
+216, 75,148, 78,139, 70, 86, 67, 18, 90,204,196,220,187, 51, 41, 90, 35,186,159, 33,198, 76, 20,175,  0,214,106, 10, 99,183,105,
+182,249,128,148,174, 75,175, 26,181, 26, 82,183,  5,177, 52,129,151,145, 72,196, 58,205, 37,218,119, 87,132, 94,237, 66,170,162,
+144, 44,193,100,222, 39,243, 79, 73,176, 42,100,237,198,140,192,169,163,201,  1, 53,213, 39,124,155,226,109, 45,216, 90, 49, 87,
+122,192,  7,181, 98, 20,182, 32,134,151,237,141,230, 43, 36,106, 55, 40,144, 39,147,  8,199,250,112,219,165, 71,204, 96,232,133,
+161,246, 28,244,169, 28, 95, 55,119,245,110,235, 96,151,203, 36,246,187,171,127, 23,155, 63,115,142,170, 18,106,150,185, 16,130,
+ 49,  0,143,118, 53, 81, 87, 65, 13,104,166, 14,218, 50,244,178,186,  2,101,190,  3,179,114,188,107, 46, 13, 30,107, 19, 87,119,
+ 37,152,220, 79,169,190,195,119,137, 28, 69,212, 86,175,241,206,237, 27,191,  8,189, 27, 55, 91, 58,218, 76, 86,234,117,166,181,
+ 98, 38,134,165, 82,107, 99,105,141, 82, 43,165,116, 74,183, 93,116,109,226,191,136,237,  0, 82,202,246,195,135,196,144, 71, 35,
+  8,165, 68, 14, 22,227,176, 91,108, 36,199, 76,204,  6,166,183, 40,155,185,125, 91,179,  3, 78,213, 37, 84,123, 71,108,175, 30,
+236, 96,104, 88,  9,130, 65,244,195,241,249,102, 83,190,120,218,190, 91,230,176,105,243,226, 20,251, 67, 71,248,138, 98, 42, 68,
+120,215, 68,105,111, 70, 54,158,111, 45,213, 46, 12,110, 82, 16, 73,164,156,  9,254,207,155,205,138,152,173,122,116,149,182,172,
+ 86, 25,141,129,117, 62, 97, 56, 73, 16, 35,245, 48,115,113,113,224,114,223,174, 47, 18, 61,192,184, 90, 25,201,204, 60, 78, 44,
+181,160, 13, 94,255,240,146,239, 95,190, 65,162,151,107,132, 64,204,129, 60,100,155, 42,106,103,119,216,147, 98,180,178,  1,237,
+244, 50,115,152, 23,154,196,107,212,175,122, 59,219, 17, 95,123,247,189,247,248,252,211,143,129,200,184,222,178,223,159,115,121,
+113,105,151, 43, 53,131,210,217,217, 41,239,127,244, 62,159, 60,254,128,245,106, 36, 54,101, 46,147,101,241, 91, 96, 16,187, 40,
+228, 60, 48,108, 87,244, 90,189, 77, 74,144,106, 15,221, 30, 18, 26,173,221, 78,114, 34, 69,199, 10,167, 72,104,238,152,111,205,
+ 11, 42,132,213,152,136, 49, 27, 45, 43,218, 42, 38,164, 12,139, 80,154,237,239,123,181, 44,185,101, 80,124, 23,152, 35, 73, 50,
+ 42,145,208,141, 76,117, 92, 29,109, 82,164, 84,163, 82,  5,  1,230,198,178, 76, 44,190,122,249,225,233, 51,126,255,236,123, 74,
+ 91,216,110, 54,220, 60,221,176, 26,  7,154, 86,230,253,194,197,249,142,243,171, 75, 94, 94,236,216, 95,238,205,252,233,123,241,
+165,218,229, 38,196,104, 70,203, 86,125, 10,234,118,184,240,142,200,136, 95, 98, 69,109, 93,149,130,137,141,197,241,148,105, 72,
+ 86,164,210,173,203,189,107,119,170,223,113,250,179, 67, 61,116, 51,155, 40,238,118, 23,241,138,228, 96,166, 28, 55,207,125,242,
+233,103,220,121,240,128, 49, 14,196, 65,209, 48,216, 23,165,207, 92,190,121,201,139,167,223,115,216, 93, 82, 91, 97, 59,172,201,
+ 39, 43, 86, 97,100,125, 50,144,135, 53, 57, 25,  2, 57,133, 21, 33, 36,139,135,213, 74, 15,157,101,174,182, 75, 68, 89, 13,129,
+239,190,123,201,131, 15,110,243,193,251,247,248,187,223, 62, 67,180,113,239,238, 35,238,110,224,193,123, 15,152,218,202,246,129,
+173,209,162,241,213,135, 16,168, 75, 53, 38,133,211,228,162, 26,240, 74, 68,208,182,176,217,110,121,115,121,193,180,187,178,103,
+136,218,165, 93,123,247, 85,153, 15,  6,106,  4,178,166,238, 70,247,164, 64, 16, 91,  7, 90, 94,216,113,213, 40,181,204,  6, 53,
+233, 22,213, 21, 95, 37,198,144,188, 97,207,118,156, 57, 88,149,173,237, 73,109,205,102, 55,  4, 91,  9, 90, 74, 33,154,113, 81,
+196,163,176, 70,171, 44, 75, 97,154,247, 14, 12,202,228,156, 41,109,177,130,165,144,208,  5,186, 70, 94,190, 61,103,119, 48,104,
+ 75,136,129,222, 26, 34,217,218, 33,219,132,198, 68,142,221, 94,171,166, 72, 22,250,226,113,191,152, 77, 74,246, 53, 76,104,150,
+130,232,  1, 66, 41,  4,146, 81, 24, 99,  2,245,127, 86,123,182, 43,118,241, 35,184,242, 81, 27,205,135,156,227,250, 43,103, 75,
+ 17, 53,235,105,162, 22, 43, 49,169,221,158,201,173,129,132, 78, 19,  8,189, 89, 21,113,239,  4,245,195,  6, 39,141,170, 37,166,
+162, 68,135,127, 90, 41,146,205, 52,102,222, 13, 57, 94,203,247, 41, 37, 42, 70,187, 11, 21,138, 67,167,212,191, 47,141, 78,243,
+166, 69,179,111,217,103,  3,191,248,138,163,200,143,171,216,160,216,251,228,159,177,163, 26,166,106,123,240,224,127, 86, 85,140,
+ 82,167, 92, 27,174, 43,174,  4, 35,148,230, 75,155,  0, 89,176, 53, 81,116, 21, 96, 94,236,239,141,199,203,130,122,198,191, 57,
+165,206,158,195,205,155, 51,113, 67,171,247,210,218,115,161, 70, 83,  3,180,217,170,214, 91, 59,205,220,109,  3,170,136, 85,188,
+210,252,194,234,207,108,146,181,127,198, 28,174,137,148,131, 36,150,218, 72,203,212,140, 82,230,199,106, 78,106,  5, 42,189,123,
+ 14, 92,209,104,163,125, 95,204,249, 45, 78,114, 11,142, 84, 59, 36, 99,173,  7,201,132, 33,146,180, 81,154,144, 87,107, 70, 91,
+198,219,131, 62,153,196,159,106, 32, 15,195,245,164,220,164, 24,166, 82, 27, 37, 68, 74,135,144,149, 49, 25, 92,192, 26,119, 76,
+122,215, 96,114,251,177,196,195,140,114,157, 20, 65,107,179, 91,175, 88, 89,125,245, 72, 87, 20,  3,221, 52,154, 65,246,147,137,
+ 76, 71, 87,126,208, 78,143,230,224,108,161,250,244,108, 46,202, 30, 32,198,193, 32, 14,201, 88,219, 42, 66,105,176, 76,197,118,
+151,253, 64,109, 11,243, 82,233,101,225,234,112,224,106, 42, 44,135,  3,181,204,246, 80,143, 35,195,106,197,106,179,225,228,116,
+203,102,220,112,231,193,125, 54,163,146, 10,148,174,206,249,182,203, 75,112,174,190, 68, 43,159, 65,132,245,118, 77, 63,114,245,
+181,210, 75,227, 48,205,148, 90,236, 65, 38,234,209,195,232,217,111, 32,193,126,127,224,245,249,  5,103,235, 21, 26,133,143, 63,
+254, 20,209,223,240,242,205, 21,119,239, 62,224,236,228,132,155,103, 39,172, 78, 87,180,226,238,253,208,223,197,171,114,164,134,
+192, 16,237,  0, 43,211,204,102, 12,206,142,183, 78,240,106,128,  2, 82, 22, 86, 67,224,224,114, 89,247,200,210, 24, 86,  4, 45,
+214, 11,156,215,196,184,102, 46,123,  6,148,144, 71,148, 66,172, 21, 77,182,198,233,197, 34,134,173, 69, 99,111,163,132, 56, 88,
+195,209,210, 33, 41, 81,186,253,108, 93,233,154, 48,204,245, 66,205,208, 14,205,162,118,173, 16, 99,228, 48, 85,158, 63,253,142,
+ 55, 23, 23, 68, 85,242,176, 98,189,201, 40,202,213,110,103,  6,165,171,153,214, 59, 75,129,105,182,126,229, 94,187,229,148,109,
+183,130, 40,148,121, 54, 92,102,180,104, 76,237,139, 39, 39,108,202,241,238, 93,186,154,185,235,236,108,228,100, 51,242,242,249,
+ 57,218, 59, 99, 74,215,240,155, 35,220, 73,143,152,228,214,253,139,110, 12, 88, 21,147, 36, 77, 46,118, 47,137,243, 36,106,179,
+248,225,143, 62,253,130,207, 62,253, 49,173, 43, 63, 60,123,202,131,199,239, 83,175,246,188,126,251,  3,203,114,129,104,228,228,
+100,203,122, 60,229,244,244,  6,171,213, 17,244, 19, 24,214, 35, 45, 70, 78,243,138,185, 44,196,101, 38,164, 21, 75,155, 72,131,
+ 17,202,163, 10, 81,173,208,100,232,157,179,237, 41,255,250,223,254, 45,127,254, 47,254, 19,254,224, 39, 31,242,235,191,251, 61,
+111,119,133, 54, 77,220,189,125,131,147,141,114,177, 88,189,173,204,142,157, 78,230,161,  9,173, 17,219, 98, 42, 79, 20,150,194,
+117,255,130, 14,129,199,143, 62,224,111, 95,190,180, 75,142,  4,107,240, 82, 55, 96, 10,212,102,201,133, 64,180, 29,166,  4,180,
+ 47, 38, 79,122, 27,150, 25,138,178, 13, 29,101,246,149,156,213,245, 14,121, 96, 61, 38,166, 90,188,253,209, 36,207,168,182,206,
+105,106, 10, 83,144,232, 96,146,119,151,  4,241, 24,169,170, 82,123, 49,195,149, 42, 90, 23,135, 65, 37, 75, 19,228,234, 14,245,
+ 78,157,139,121, 64, 90,103,183, 44,148,182, 99,149,239, 80,166, 78, 74,234,235,160,153,189, 87, 44, 47,165,112,104,141,117,202,
+ 44, 46,243, 75, 72,118,177,243, 34,158, 42, 98, 50,125, 79,206, 32,247,238, 12, 96, 72,194,210,141,155,168,173,162, 43,203, 87,
+167,144,208,214, 72, 57,209,163, 80,131, 48,136, 41, 34,225, 24, 33,235,129, 40, 74,141,197,214,157,161, 91,190, 90,133, 62,153,
+202,106,220,122,227,105,116,233,150,155,215,234,205, 98,205,170,156,197,160, 55,170, 66, 95,140,179, 33, 61,120, 89, 76, 48, 47,
+ 78, 19,230,106,180, 56,154, 88,225, 18,213,  6,179,166,244, 94,168,106,205,101,221,171,137, 99, 12,  4,127, 93,213,135,183,214,
+ 13, 26, 19, 75,132, 49,218,179, 65,148, 34,230,112,239,199,237, 87, 13,164,228, 43,186,210,  8, 67, 50,162,228,210, 72, 99, 32,
+ 13,163, 39,  7,196, 27,218, 32,  5,203,142,183, 46, 44,154,104,209, 58, 28,186, 19, 84, 45, 13,213,188,162, 89, 72,132,235, 66,
+179,138,130, 38,130, 90,130, 39, 37,243,  4, 25,147,249,232,142, 47,102,110, 52, 61,132,118, 60,204,155, 80,163, 93, 78,162, 43,
+185, 29,195,245,138, 68,106,179, 72, 99, 12, 62,188, 98,175,117,177,211,144,248,224,238,141, 95,136, 90,198, 88,125,191, 80,107,
+ 51,135,179, 79,226,173,218, 95,218,163,213,110,102,137,190,224,247,224,191, 21,117, 91,252,166, 22,187,217,181, 70, 91, 22,230,
+102,109, 92,181,207,236,246, 51,211,178,152, 27,216,247, 32,165, 88,221,170,  6,163,  9,165, 28,145,176,178, 94,247,148,200, 67,
+242,  3, 46,146,194,177,137,205, 92,224,209, 39, 21, 28, 90,208,220,240,102, 45,236, 38,133, 70,130,213, 37,138, 16,162,129, 25,
+ 68,109,146, 82, 58, 73,163,187,249, 29,104,163, 70,109,  3,203,214,167, 56, 48,140,153,213, 38,147,135,200,144,  2, 63,124,255,
+  3,191,253,234,247,188,120,249,150,139,243,115,158,191,124,201,171,215,231,236,118,  7,174,118,151,156, 95, 94, 81, 14, 11,173,
+ 89,211,142,121, 20, 76,254,139,173,112,249,230, 53,207, 95,189,228,106,233,172, 54, 39,228,152, 32,219,225,113,117,190, 55,230,
+189, 24,  6, 54,199,129,253, 97,199,220,149, 60,102,155,152, 91,161,148,153,195, 97, 98,174,139, 93,118,186, 37, 24, 66,200, 68,
+204,120, 39,222,244,181,236, 39, 74, 19,238,220,188,101,231,124,202,220, 56,189,201,237,219,183,184,251,240,  1,219,205,198, 12,
+ 65,222,160,135, 99, 75,135,117, 70,116,160,183,  5,180,217,197,102,136,150,177,116,114, 95,202, 66, 30,173, 99, 56,118, 83, 88,
+150,102, 92,230, 62,123,169, 65,181,106, 90, 29, 50, 12,145,158,236,178, 88,157,240,219,180, 81,171, 48,172, 70,131,204,180,  9,
+ 51,194,170,181,238,117,239,142, 22, 51,243,149,106,230,152,156,  7,186, 70,210, 24,145,212, 25,213,204, 83,211,174,210,155,103,
+103, 67,102,154,246,124,251,251,175,121,245,250, 13, 34,194, 48, 68,198,149, 25, 67, 75,179,252,244, 82, 42,115,105, 76, 75,101,
+169,166, 40,128, 53,192,117,237, 94,172,107,173, 72,173, 26, 56,162,183,238,189,247,  6,201,177, 41,178, 95,179,245,171,118, 90,
+169, 24,253, 81, 88, 74,183, 38, 45,239, 73, 56, 62,136,155, 90,252, 82,176,216,139,113,158, 77,166,195, 15,147, 16,205,192, 36,
+209,214, 30,173, 21,136,129,207,191,248, 49,159,125,246, 99, 68,149,231, 47,190,165,206, 51,135,233,138,221,229, 75, 86,121,224,
+244,228,140,147,237,  9,183,239,220,229,244,236,  6,163,  8, 11,194,201,118,205,230,230, 13, 78,238,221, 97,236, 29,141,131, 87,
+209, 22,139, 12,161, 12, 57, 19, 52, 17,194, 64, 12,129,185, 20, 22,  9,140, 41, 83, 74,227,230,221,  7,124,244,222, 77,126,249,
+215, 95,241,250,237, 91, 62,124,239, 46,127,242,199, 63, 33,172,132,111,159,190, 69,147, 53, 47, 90,245,103,112,242, 93, 68,195,
+ 64,144, 64, 21, 69, 66, 38,  4,155,158,106,239,220, 56,185,193,213,229,  5,231,231,111, 13, 91, 45,129, 36, 98,242,104, 53,194,
+161,118,155,222, 76,206,108,199,122, 65, 75,204, 56,210, 90,131, 69,165,212,110,212,164,144, 33, 25, 79, 98,189, 30,184,117,114,
+202,122, 28,174,177,205,174, 96,210,177, 75, 32, 57,209,171,248,100,239, 94,158, 33, 33,201,146, 40, 41,101,143,249,218,238, 56,
+ 39,119,158, 11,228,156, 57, 59, 61,229,234,176, 51,243,237,122, 69,115,137, 95,187,178, 90,159,250,202, 68,169, 49, 81,251, 98,
+235,196,218,161, 47,166,202, 89,216,140,156, 34, 73,188, 90, 53, 64,247, 70, 63,237,193,148,225,230, 81,212, 36,104,104,182,182,
+  9, 56,169,206, 62,139,199,184,169,200,177,215,219,192, 76, 33, 37,139,129, 53,113,188,161, 56,226, 20,122,177,215, 58,250,202,
+163,131,119,119, 88,242,232, 58, 30,150,193, 66,238,130, 54,239, 31,239, 54, 92,136, 26,157,240,200,149,144,227,174,190,119, 74,
+179,157,180, 28,205,159,209, 10, 82,106,175,102,112, 86,165, 53, 65, 28,151,218,245,168, 94,249,247, 66,133, 65, 34,157, 70,164,
+211,186,120,124,179, 90,227,184,239,236, 69,156,175,160,246,140,239, 62,168,136,  8,161,185, 17, 51,225, 23, 55,  3, 65,213,165,
+251, 37,189, 83, 93,129, 39,218,180,222, 61,142,218,143,124,250,112, 92,147,  4,186,151,181,  4,  9,214,200, 22,154,179,219,142,
+ 21,192,118,105, 58, 54, 48,166, 96,234,135,186,225, 60, 74,176, 88,182,226,173,167,141,226, 24,109, 99,167,200,245,164,159, 13,
+ 51, 72,239,199,207, 70, 51, 31,131,  6,226,189, 59,183,127, 33,170, 84, 18,146, 50, 67,176,195, 50,250, 11,212,142,165, 39,110,
+128,232,254,144,171, 62, 99,116, 63,252,205,  8,100,110,238, 16,146, 31,246, 71,244,172, 57, 49,135, 36,164,222,160, 54, 14,243,
+194,180,204, 28, 14,  7,174, 14, 51,203,116, 96,127, 40,236,167,153,101, 54,154, 82, 13, 38,173,208, 20,201,129,152,147,247,253,
+ 90,255,121,148, 64,136,102, 36, 27,162, 51,114,187, 18,163,145,184,108, 33,233, 82, 87,176, 93,142, 73,215,239, 90,219,130, 87,
+180,166, 60,152, 89, 34,216, 58, 65,130, 50,228,129,156, 77, 18, 73,113, 69,107,149, 87, 47, 95,240,244,187,239,173, 69, 43, 70,
+ 90, 45, 44,211, 66, 41,197, 84,135, 14, 33, 39,134, 97, 96,187,222, 48,140,  3,113, 72,156,158,110,249,224,206,  9, 39,235,196,
+229,161, 48, 77,149,195,229, 57,175, 95, 95,146,214, 43,110,108, 54,188,122,250,130, 23,111, 46,  9,217,233,122,113, 96,189, 26,
+ 89,166,189, 91, 37, 76,130, 47,213, 14,244,226, 32, 19, 61, 22,242,136, 92,223,144, 81,163,249,  5,191,141,199,144, 56,187,117,
+195,138,  2,150,206,144,147, 97, 92, 49, 96,144,210,141,117, 45,150,205,215,118, 52,  6, 89,205,162,237,145,229, 26, 97, 24,188,
+110, 19, 79, 19,235, 98,104, 34,141,102,196,171,181, 17,197, 92,198,137, 64,233,141, 36, 16,226, 72,236, 64,175,100,212, 38,224,
+214,200, 41,217, 52,177,152,105,135, 56,144, 93,242,157,139, 27, 73,146, 66, 78,172,176, 66, 25,235,130,111,132,208,160,  8, 75,
+155,153, 14,149,185,152, 76, 22,135,200,238, 98,199, 87, 95,125,205,238,242,146,144,108, 37,176,202,150,157,157,166, 70,105, 11,
+101,169, 44, 75, 99,158, 11,197,110,179, 38,201,250,151,158,107,252,100,117, 40,209, 49, 67,218,253,224,117, 24,198, 63,128,179,
+244, 86,209,230, 12,135, 16, 41,222,213, 46, 94,240,160, 30, 67,107,189,154, 49,211,251,  6,244, 56,  5,136, 94,239,205, 77,189,
+180,194,147, 20,  2,235,117,166,169,242,163, 79,127,196,103, 95,124, 70, 90, 39,158,191,120, 77,189,122,203,122, 28,105,109,225,
+189,251,247, 57, 61, 61, 97,123,178,229,100,181, 37,110,  6,171, 86, 21, 24,242,150,  7,119,110,145,215,137,172,118,216,149,150,
+  9,173,144, 66,181,  7, 89, 52,  3, 83,144,192, 24,130, 21,153, 40,228, 32, 28, 14,133,178, 40,111,119, 19,127,242, 71, 95,240,
+228,233,151,252,245, 95,253, 61,127,254, 47,255,148,255,225,127,252,111,121,117,222,248,238,249, 43,166,203, 61,218,173, 78,211,
+184,182,107,178, 55,229,229, 20, 77, 97,106, 46, 79,246,197,138, 99, 84, 56, 57,185,193,197,229, 57,187,253,206, 40,122,197, 34,
+142,193,190,184,206, 96,183, 97, 34,250,103,188,138,189,182, 71, 95,131, 93,202,204, 36, 23, 37,122,121,145, 82,171,178, 44,133,
+165, 26, 59,123, 53, 12,220, 60,221,208, 74, 97, 55, 77,244,110,135,157, 73,159,134,108,182,117,162, 93, 16, 66, 55,215,114,142,
+131,247, 43, 44,212, 86, 60,215,108, 28,254, 60, 36,182,155, 19,166,195,236,187,100, 37, 15, 17, 93, 26, 33,143,164,156,169, 90,
+168,125, 54,168, 14, 66,238,221, 14,  3,245,137, 54, 36,178,154,  1,178, 98,  7, 81, 67,137,213,214, 87, 68, 43,  3,145, 96,151,
+194,238, 89,106,  9,208,171, 90, 43, 32,150,248, 17,245,122,107,119,135,247,102,138,152,224,145,169,100, 64,174, 46,214, 58, 40,
+ 68,122, 53,179,114,196,134, 38,162,153, 87, 59,102,212,236,165,160, 89,136, 49, 18,186,210,155, 81, 57, 69,149,166,213, 46, 16,
+193, 19,129,189,217, 10, 69, 21,169,126,  7, 11,230,171,234, 98,147,184, 21,100,169, 53,187, 57,213, 82,212, 76,162, 67, 18, 47,
+209, 50,243,116,119,249, 90,213, 42,161,235,162, 52, 49, 21,150,110,236,143,166,225,122, 87, 45,193, 94, 83, 28, 50, 35,193, 36,
+108, 53,249,216, 59, 34,174, 87,211,230, 59,195,188, 25,173,155,242,219,151, 74, 84,115,237,215, 35, 66,219,245,222, 24,109,210,
+238,210,108,144, 12,129, 94,171, 69, 32, 37, 57, 70,199,108,239,221, 29,253,210, 45,106, 28,  7, 87,178,163, 94,247,150, 52, 12,
+ 54, 19,163, 87,109,119,177,203,156,116,211,  2,252, 92,141,120,146, 38,218,122, 69, 92,246,143,167,167,155, 95,180,218,232,205,
+160,254, 75,183,136,154, 89,  5,162,239,119,147, 85, 70,134,204,144,236,225,110,101, 39,209,205, 83, 86, 39, 34, 62, 45,214,222,
+168, 75,165, 19,  9,106, 73, 70,155,159, 59,115,183, 61, 73, 45,133, 82,109, 79,217,123, 35,116,165, 46, 11,165, 53,122, 93,104,
+173, 49, 47, 51,243,188,216, 65, 95, 27,243, 84,153,150,153,165,246,107,226, 79,147,227, 27,174, 72,138, 12, 49, 19, 83,102,200,
+ 86, 56,145,  7,147,168, 98, 20, 86,155,124, 68,236, 50, 12,201,234, 38,135,196,144,162,221,209,130,237,204, 36,192, 56,172, 65,
+224,205,249,  5,175, 95,191,229,245,243, 23,252,240,244,123,158,191,186,160,107,180, 86,181,186, 48, 47,139, 53,  3,  5,187,252,
+196, 49,179,221,110,216,108,206, 56,189,113,131,245,176, 97,115, 54,114,182, 93,145,164,243,230,114,225, 80,149,148, 51, 67,138,
+148,121,226,234,106,207, 50, 53,222,188,125,115,205, 12,136,193,147,  5,218, 25,134,108,194, 74,107, 44,243,204, 92,138,187,114,
+125,162,247,213,128,161, 86, 35, 99, 30,188,181,206,190,116, 49, 90,188,112,117,122,194,144,163, 89,118,196,110,193, 93, 22,170,
+199,143, 98,108, 22, 93,115,132,110, 41,157,160,141, 85,206,182, 59,170,194, 60, 21,123, 88,198,232,230, 15,231,184,247, 72,163,
+154, 19,182,219,205,191,247, 70,143,120,196,208,153,238, 78,189, 11, 40, 61,123,202,162, 65,149,198,220, 22,106, 21,234,210,209,
+184, 80,196,202, 68,114,198,219,204,204,213,222, 17,134,  4,105,  5,181, 26, 14,178,165,102, 57, 85,  1, 36,145, 99,230,237,155,
+215,124,253,229,239,216, 93,236,104, 10, 67, 78,140,233, 24,111, 18,235,132, 47,157, 86,139,237,197,107, 49,220,163,154, 90,213,
+154,183,171, 85, 51,238,136,154,  4,142,231,160,123, 63,186,174,237, 51, 85,187,119,162,123,251, 83,142,153,228,171, 45,219,193,
+ 31,213, 20,155,248,123,213,107,163,102,192,168, 85,215, 37, 63,222,192,103,208, 33,115,196,133,100,255,159,173, 42, 31, 63,254,
+152, 47,190,248, 17, 41,  7,246,251,137, 23,191,127, 98, 23,239,222,249,248,253, 15,121,244,248,125, 98, 94,113, 99,115,139, 49,
+103,242,102, 52,147, 99, 26, 89,159,142,220, 58, 59,181, 98, 35,133,188,186,  5,251, 43, 66, 16,187,212,104, 99, 19, 78, 29,136,
+100,242,102,237, 11,171, 49,209,177, 75,191,212,198,249,235, 75,222,238,103,254,201, 31, 60,228,175,126,245, 21,255,249,159,254,
+ 49,171,237,138,178, 95,248,217,231,159,242,246,242, 21,111,118, 87,164,  4,171,148,236,129,213,141, 79,160,241,136,157,109,168,
+ 86,186, 87, 30, 55, 13, 12,171,145, 59,119,239,179,236, 14,188,124,249,194, 98,143,201,158, 31,150, 26,176,200,172, 56,111, 91,
+157,105, 97,185,119,219,157, 91,143, 68,240,142,138,102, 74,100,115,201, 82, 34,135,105, 98, 63, 45,222, 97,175,230,137,145,206,
+ 52, 23, 47, 92, 50, 99,168,155,162,157,  2, 88,137, 41, 89,175,131, 19,253,138, 75,200,218, 59, 49, 38,255,204,116,198,213,200,
+180, 44, 44,147,193,122, 98, 16,134, 65, 25,226, 72, 72,  3,165, 89,161,144,173,154,108, 10,238, 94, 67,157,131, 16, 36, 27,221,
+ 17,203,175, 75, 11, 80,173,112,  4,  9,134,120, 61, 26,  7,163, 77,194,189, 27,219,160,149, 74,139, 74,202, 35, 34,205,250,  5,
+ 36,210,197,164,109, 51,178,194, 48,200,181,191,160,187, 81, 75, 34, 44,254, 60,166, 91, 39,123,148, 64, 76,131,149,202,168, 33,
+151, 83,180,146,170,210,  5,157, 11, 33, 65, 17,243, 29, 28, 63,179,234,  4,182,235,236,117,  0,205, 70, 13, 77,158, 15, 23, 12,
+156,132, 38, 90, 47,  4,154,169, 57,218,188,138, 56,250, 90,197,163,156,189, 25,111, 64,195,117,132,177, 97,191,187,157,150,166,
+250,106,105,239,136,164, 98,166,209,238, 96, 53,179,191,  4,122,176, 60,184,122,118, 60,104,183,159, 37,121, 61,150,152,164,110,
+131,164,241, 68,172,138,213, 46, 82,122,125, 17,115, 22,187,250,235,233,158,140,224, 61,233,199,195,250,200,118, 15,  4,186, 24,
+ 34, 54,184, 55, 68,130, 41, 11, 70, 78,181, 46, 10, 31,135,237, 50,155,189,132, 76,205,112, 23,197,214,  2, 98, 95, 38,  7,215,
+216,170, 36,222,184,121,243, 23, 61,  6, 67,182,122,144, 30,109,104,175,212,230, 59,141, 86,169,165, 25, 58,210,161, 32, 34,129,
+ 72,183,219, 14, 30,217, 17, 65,226, 64,246,252,177,248,180,161, 57,146,101, 97,222, 79, 28,166, 98,152,217, 32,118,235,165,163,
+ 85, 41,199, 95,250, 24, 95,195,126, 14,113, 96, 71,111,149, 86, 23,179,242, 99, 15,206,105,178,202,204,233,112, 96, 55, 47,148,
+106,248,201,165,153,187,180, 54,111,197, 10, 66,146,108,177,179, 97, 32,229,196, 42, 38,198, 97, 68,178,144,194,192,122,189,102,
+179,202,108, 86, 35,235,237,150,216, 42,191,251,237,127,228,247, 79,159,211,230,198,126,183,103,127, 40, 86, 75,233,133, 39, 98,
+ 72, 61,182, 39, 43,110,158,109,185,123,123,205,157, 59,107, 78,214,107,242,176,229,198,201,134,245,217,  0, 61, 82, 22,229,226,
+178,114,121,176,223, 95,189,182, 53,196,132,244,198,197,197, 37,115,245,233, 66, 60, 45,174, 30,219, 33, 26,108,165, 76,148, 90,
+175, 89,245, 33,216, 94, 39, 88,141, 29,104, 55, 52,109, 76,164,193,235, 65,181,155,100, 24,  3,159, 60, 56,227,238,217,  9,189,
+ 69,222, 94,158,115,152, 15,244, 82,169,189, 91,185, 77,173,214,254, 20, 32,229,200, 42, 69, 66, 14, 84, 21, 67, 84,122,243, 93,
+136,102, 49,237,197, 72,249,189,153, 67, 62,103, 51,127,148,178, 24, 36,166,  9, 25,177,150, 49,173,246,103,134,136,180, 72, 28,
+161,213,104,239,109, 12,132,165,211, 67,162, 39, 65,103,123,143,  7, 13,150,215,143,130,144, 88,202,132, 86,200,106, 41,  2,218,
+145, 26, 88,145, 60,146,186, 80,197,118,249,231,151,151,124,249,213,111,185,188,220,115,114,178,181, 27,122, 11,164,113,160,139,
+178, 56,119,189, 22,219, 79,181, 96,114, 95,111,149, 82,171,125,245,146, 79, 61,221,157,196, 46, 67,226,196, 41, 31,211,129, 70,
+169, 71, 83,166, 18, 99, 96,200,217, 43, 37,171, 61,232,187, 32,209, 46,151,218,222,201,182,193,149, 33,219, 17,246, 99, 15,177,
+ 73,159,106, 19,178,122, 73,227, 49, 90,245,225, 71, 31,242,179,159,255,156,148,132, 10, 60,123,250, 12,180, 81,181,114,227,236,
+ 22, 55,111,221,102,140,137,205,250, 38,103, 55, 78, 25,114, 98, 41,133, 30,225,246,233, 67,182,171, 21,123,148,170,153,243,171,
+115, 94,190,122,193,102, 53,162, 81, 40, 77, 88,180, 18,157,139,176,234,  3, 75,177, 29,241,152, 86,208,133, 97,101, 15,232,213,
+ 58,242,253,243, 87, 60,122,239, 17,159,127,116,151,170,107,126,243,229, 87,252,242,175,254,146, 63,250,233, 79,249,248,211, 15,
+121,246,244, 41, 83, 85,131,254,116,155, 50, 58, 66,104,133, 62, 36,147,104,165, 67,207, 72, 88, 17,134,  0,181,144, 72,220,189,
+247, 62, 33,193,155,215,175, 41,165,216,193, 46,225, 24,  1,230,221, 63, 28,205,175,118, 32, 90,226, 38,121,205,129, 77,119,222,
+ 67,121,109, 88, 53, 75,148,186, 90,208,184,119,255, 30,103, 55,110, 51, 29, 10,117,153,141,213,175,226,244,178, 35,147, 92,144,
+ 40, 36, 73,  6,130,202,201, 48,215, 62,249, 25, 33, 80,145, 36,108, 86, 55, 40, 75, 99,183,187,160, 54,101,153, 23,134, 24, 57,
+ 57,187,109,166, 48,178,201,206,189,153, 23,168, 31, 65, 49,214,207, 80,123,167, 37, 65,212, 24,247, 82, 26, 37, 52, 24,252,130,
+ 92, 45,174,149,196, 38, 56,  1,164,117,219,171, 70,203,102, 27, 99,164,211, 99, 52,213,169,217,255, 62, 72, 64, 91,177,203,143,
+100,130,  9,253, 70,201, 67,105,179, 93,110, 37, 10,164, 35,200,200,226,151,161,187,210,201,145, 67,225,109,152, 98,138,106, 24,
+  3, 57, 24,219, 95,187,213,  6, 75,136,164, 56,152,161,175,154, 60,109,159,113,135,165,182, 74,243,152,113,  8,194, 82, 23,187,
+120, 75, 48, 53,178,123, 71,130,103,226,123, 55,  4,109,243, 66, 42,136, 86, 42, 22,  2, 41,252,131,212,130,133,166,141,252, 25,
+236,114, 29, 48,172,184, 38,156, 63,208,173, 21, 82,155,189,151,206, 29,160,138, 23,177,200,245,217, 70,239,215,121,114, 61,130,
+108,131,184,236,110,177,212, 99,  3,104,116, 24, 69,  8,205,140,110,226,241,213,163,220, 78, 39,137, 73, 98, 33,138, 61,103,150,
+102, 60, 19,191,176,168, 26,  4,204,124, 85, 71, 60, 94, 36, 13,225,186,207,196,115,212, 32,129,140,241, 29,226,118,187,253, 69,
+239,225,186,183, 86,  9, 72, 72, 22,235,136,  1, 73,137,113,200,228,144,204,140, 38,234, 77,103,222, 18,213, 26,197,191,244,173,
+155, 27, 82,189,249,170,248,164, 24,188,235, 60,134,129, 16,131, 73,224,118,169, 50, 85,206,155,168,130,247,214,182,218, 88,106,
+ 53,140,107,244, 47, 83, 56,198,234,188,162,240,104, 36, 59,246, 29, 55,181,219,122, 47,230,136,165,176, 76,  7, 46, 47,246, 92,
+205,133, 82, 11,135,101,177, 56, 84,173, 20,119,207,171,218,151, 52,143,145,184, 30, 24,199, 21,155, 85,226,135,239,158,240,187,
+ 39,223, 19,226,200,144, 35, 75, 89, 40,221, 63,236,  1, 98,202,156,221,124,192,123, 15,238,115,243,108,224,246,141, 83,238,223,
+ 62,229,206,217,218,216,195, 75, 70,210,  8,179, 29,102,251,195,129,182,216,161,105,140,120,147,105, 84,108, 50,139,226,147,173,
+250, 27,235, 49, 63,235,224,110, 76,117,161,151,238,  7,140,231,149,187,151, 37,  4,147,222, 37,218,155, 29, 82,230,244,244,  4,
+ 45, 11, 75, 41,212,218, 89, 13,  3,255,248,199,119,184,123,170,124,245,237, 83,190,125,242, 13,111,223,188,228,106,191,227,222,
+141, 21, 67,220, 80,106, 39, 69,235,140,206, 49,178, 94,153,255,160,137, 77, 61,116,119,106,214,110, 29,201, 98, 81, 45,137, 24,
+101,171,218,195, 69, 99,179,114,144, 33,209,232, 44, 98, 18, 85,136,201,157,174,194, 56, 68,234, 92, 76,226,235,176, 10,129, 18,
+ 20,157,155,237,252,180, 50, 74, 34,100,101,154, 59,211, 98, 78,252, 20, 50, 18, 12,124, 33,254,101,110,245, 88,103,106,153,213,
+ 23,207, 95,242,213, 87, 95, 50,207, 54, 89,173, 54, 43, 62,120,124,151, 56,  6,118,135,133,222, 11,173, 86,159,172,171, 93, 12,
+154, 49,226, 75,171,140,121,100,179, 93, 91,245,108,109,102, 92, 52,195,133,197,170,174,165,118, 67, 39,155, 43, 30,251, 28,197,
+228,145, 66,139,168, 93,175, 43,252, 61,147, 99,119,186,167,210,180,217, 69, 65,143,123, 63,  9, 30,213, 50,217,181,117, 43,140,
+ 56, 94, 24, 62,121,252,152, 63,252,217,207, 73, 67,162,246,192,114,152,249,230,171,223,161,189,112,235,244,  6,119,110,223, 49,
+216,201,201,150,241,228,182, 81,207,106,160,118,225,253,247, 31,113,186, 61, 99,154, 39,174, 46,222,176,219,217,191,182,221, 37,
+183,110,223,182,203,116,180,104, 99, 18,161,210,233, 89, 57, 44, 11,195,106,100,179, 89,161,193,212,187,221,225,138,231,207,127,
+ 96,218, 79,188,126,245,134, 63,255,179,255,154,175,190,126,198,223,252,250,183, 60,121,242,146,205,122,195,207,190,248, 49,207,
+190,126,202, 55,223, 60, 37,159,108,108,162,113, 53, 41, 72,165,213,224, 19, 81,117,202,158, 16,142,181,201,  4,100, 16,238,223,
+187,199,205,155,103,204,243,129,121,182,142,123,117,186,229, 17,250,147,146,239,108, 67,178, 74,215, 24, 60,190,165,174,142,244,
+127,176, 54, 57, 18,168,212, 77,118,230, 82,174, 75, 97,187,217,114,178, 25,216,237, 15,102,252, 76,201, 17,216,226,123, 84,123,
+207,179,151,159, 12,121, 32, 32,204,203,100,102,177, 38, 52, 21,134,152, 57, 57, 93,113,255,246, 77,174, 14, 19, 83, 57,  0,141,
+ 49,175,216,156,222,180,159, 95,  2,170,145, 24,212,232,102,217, 30,240, 29, 83, 71,  2, 46,103,183,192, 82,139,199,118,223,149,
+ 87, 69,181,120, 88,247,246, 72,232, 84,  9,132, 96,242, 49,193,248, 27,109, 17,143, 74, 25,  1,165,251,164, 23,114,176,162,146,
+121,161,185, 57,204,106, 65,149, 88,204,  1,111, 70, 51,107, 99,235,189, 32,201,211, 67,193, 61,  8,230, 42,176,247,180, 85,146,
+ 64,194,228,207,212, 85,  0,  0, 32,  0, 73, 68, 65, 84,200,104,221, 77,134,228, 72, 84,187, 72,217,251, 36, 84,109,  6,136,242,
+194,232, 35,229, 79,124,202,150,238,184,153,230,151, 47,  9, 84,143,232,250,182,158, 32,  6,165,178, 53,170,199, 30,181,217,186,
+194, 39,124, 57,166,165,130,237,188,165,118,126,242, 96,203,103,159,124,192,171,157, 82,247,  7, 52,114,173,148,225,112, 24,187,
+115,116, 90,232,164, 44,148,218,140,251, 95,171, 87,111,219,243, 64,220,199,225,179,249,187,194, 22,169,136,228, 35,198,203,212,
+ 82, 53,238,137,164,224,235,205,134,118,167, 21,138,208,163, 48,136,197,211,186,255, 89,195, 69,123,137,161, 95,106,136,  9,191,
+214,217, 64,133,163,106, 53,160,193, 84,170,148, 98,188,150,180,142,131, 71,239,141,  5,159,154, 75,163,101,107, 64,247,113,  2,
+196,218,166, 44, 98, 16,200,126,123, 52,170,144, 73,185, 43,127,203,180, 23,147,123,  8, 54,217, 30,225, 27,248,171, 23, 18,121,
+ 48, 51,140, 54, 51,146, 73,138,148, 98, 82,  3, 30, 73, 56,198,181,122, 41,204, 77, 73,238,224,180,  8, 73, 32, 37, 65, 75,225,
+160,221, 50,144, 29, 82, 10, 12,221, 17,138,205,220,131, 90,103, 84,132,101,110,236, 93, 54, 78,195, 64,218,217,180, 36,154,  9,
+114,224,187,223, 63, 39,143, 43,195,140,  6, 37,101,219,  9,222, 56, 27,233,181,176, 28, 26,171,213, 13, 30,126,248, 25,151,207,
+255,142,195,220,200, 33,163,193, 92,172, 81,160, 44,133,178,219,113,185, 76,180,214, 88,161,164, 52,128,  8,193, 91,238,196, 75,
+230,187,218,206,176,149, 78,209,133, 97,149,125, 31,  5, 75, 51, 35,200,177,  8,225,216, 85,175, 30,163, 72, 41,144, 99,194,250,
+ 26, 58,189, 28,216, 93, 98,151,162, 60, 18,129,  7,239,109,153,181,241,219,175, 95,242,252,135, 31, 72,162,164, 20,184,117, 58,
+112,186,106,188,126,253,146,188, 57, 35,135,126,237, 65, 16,172, 98, 82,101, 97, 41,110,210, 74,208, 15, 70,202,147, 20,173, 81,
+170,192, 32, 13, 37,219, 36,227,114,243, 50, 87,210,144,136, 77, 88,101,207,150, 78, 21,209,198, 20, 71,208,196, 82, 39, 98,142,
+ 28, 80,202, 98,  4,170,156,148, 82,149,121,217,195,224,151,159,110,107,159,113, 48,170, 88, 95,108,143, 90,117,177,216, 79,105,
+104,237,124,247,226, 25,191,127,242,148,185,118,114, 54, 88,207,213,213,158, 87,111, 51,219,117,162,213,133,165, 52,178, 87,215,
+106,183,242, 18,233,134,119,220,110, 79, 25,115,102,119,121,201, 82,139,197,187,130,101, 84,139,171,237,221, 47,179,134, 14,182,
+ 41, 60, 37, 75,  9,208, 77,130,108, 90,175,227, 87, 40, 84,127, 56,105,199, 47,193,253,186, 87, 93,189,220, 66, 67, 32,180,110,
+ 49,201,113, 96,181, 57, 97, 53, 14,108, 87,107, 86,219, 53,119,110,222,224,198,233, 45,210, 42,153,178,213, 59, 57,  8,203,188,
+231,100,115,131,245,233,134, 33, 12,172, 87,103,172, 78,238,241,254,227,143,233,203,142,167,207,158, 80,231, 29,175,158, 25,109,
+173,  1,211,126, 71,233,157,155,247,238, 65,181,120, 95, 37, 50, 79, 87,180,218, 56,180, 66,185,172,212,101, 97,179, 74, 12,227,
+ 64,239, 43, 78,198,206, 85, 57, 16,242,138, 59,103,119,120,246,253, 83,158, 61,189,226,242,170,241,225,135,247,248,119,255,254,
+ 63,240,195,239,127,224,127,254, 95,254, 55,238,221,191,199,189, 71,119,224,111,102,130, 54,102,245, 73,165, 43, 45,143,116,170,
+113, 40, 52, 18, 82,162,149,137, 52,  4, 90, 53, 78, 67,153,109,157,115,255,222,  7,220,186,125,151, 87,111,223,240,246,135,231,
+188,121,251,154,171,171, 43,230,186, 88, 84,114,  1,213, 68, 26,160, 30, 21, 13,237,  4, 13,174,123,180,227,253,216, 46,255, 33,
+160, 85, 25,178,152, 91,187,  9, 47,223,158,211,165,243,233,135, 15,185,119,247, 22,223, 61,123, 99,135, 97,118,154, 88,235,150,
+255,207,182, 70, 80, 26,211,178,103,157,  7, 86,195,154,171,125,101,174, 51,170,112,178,218,176,205,  3,127,252,179,143,216,108,
+ 50,191,254,205,215,172, 67,229,214,173, 51,131, 63,185, 73,110,169, 19,213,137,156,171, 16, 96,108, 76,123,207, 40,199,232, 15,
+248, 25,137,230, 48,111,173,147,177,180,135, 87,193,184,252, 42,212,217, 18, 33,244, 78, 13,129, 32,141, 58, 53,191,200,128,178,
+166,117,163,209,133, 96,189, 13, 38, 59, 99,205,102,221, 14,  5,210, 17,141,106,  7,101,107,199,136,151,253,255,244,208,105,243,
+108,254,130,232,121,116, 85,195,119, 19,  1, 27, 34,204,219, 16,160,204, 84, 53,  9,123,105,190, 19,111,174, 62,117,107, 43,235,
+ 26,136, 97,160,206,147,169,118, 93,  8, 14, 25,210,108,125,227, 33, 98,174,119, 55,188, 53,197,234, 90, 93,225,106,158,  4, 73,
+ 41, 27, 11,194,115,121, 34, 66,168, 22,132, 22, 81,238,220, 94,243,232,243, 79,249,143,111,159,113,245,246,156, 80,172,106,181,
+ 59,183, 61,104,178,193,101,101,107,130,190,188, 75,167, 48, 36,106, 53,195,179,246,102,238,116,167,198,  5, 73, 14, 74, 91,140,
+155, 16, 33, 30, 29,118, 93,104,126, 49, 55, 96,158,123,102,164,251,138,219,134,234,170, 66, 74, 92,211, 85, 21,107, 97, 84, 53,
+116, 55, 13,132, 66,105, 28, 93, 61, 22,131,211,238, 91,123,165,147, 72,130,231, 37,181,155,140,115, 68, 10,250,228,220, 29,104,
+127,180,241,139,239, 66, 76,194, 18,223, 17,218, 77,199, 24,229, 29,130,201,133,225, 90, 34, 59,118,160,219, 62, 40,138,120, 20,
+195,238, 57,109,174, 72, 74, 30,180,143,150, 13, 28, 34, 57, 56, 80, 64,205,185,217,213,235,250,146,185,  1,231,185,248,238,223,
+195,167,189,219, 45, 42,218, 11,177,244,104, 46,122,181, 47,142, 54,107,216, 89,220,104, 21,189, 54,181, 76,123, 46,206,103,230,
+ 98, 95,202,152, 34,105,216,112,115, 29,157, 78,133, 53, 61,133,136, 72, 96, 89,148,152, 35,243,238, 21, 63,188,216,144,154, 33,
+ 93,175,166,137,133,145, 94, 22,222, 94, 30, 12,  9, 90,173,  9, 73, 17,230,238,178,149,187, 39, 67,176,157,211,245, 30,198,119,
+219, 90, 11,135,229,192, 42, 15,215,125,245, 57,  7,150,163,132,230,102, 32, 83, 46,  2, 49,173, 24, 87, 35,120,231,117, 91, 26,
+157,133,113, 28, 16, 34,155,117,226,253,135,167, 60,125,250,156,223,126,243,138, 20,133, 97,140,172, 55, 35, 49, 37,254,254,155,
+ 11,110,158, 13,220, 59,205, 44, 58,154,108,223,132,165, 86, 74,175, 30, 29,244, 93,104,203,196,236,152,221, 94,201,209,107, 68,
+155, 85,239,206,251,  3,195, 48,218,100,235, 28,126, 65,153,154,115,166,131,157,142,165, 78,180, 22,104, 75,101, 14,157,218, 35,
+ 67,112, 10, 20, 74, 81, 65, 75, 37,201,154, 30,148,245,198,178,158, 13,119,136,246, 14,213, 10, 83, 76, 52,236, 60,249,246, 91,
+190,249,250, 41,138,245,217,219,174,206, 62,155,175, 95, 93,114,158,130, 49,213,251, 59, 78,107,183, 80, 56,173, 11,219,147, 19,
+ 98, 10,236,118,123,150,102, 78,109,187,145, 91,228,112,169,  6,233,209,250,238,247, 18,167, 46,134,144, 29,142,241,142,128,168,
+250,110,183, 75, 15,166, 14,104, 39,167,200,141, 91,103,108,198, 21, 57, 15,108, 86,107,203,  9,175,  7,134,148, 57,221,222, 96,
+ 76,  3,228,129, 30,149,172,153, 60, 36,242,  0,189,  8,109,241,169, 32, 69,222,188,125, 73,211,206,217,233, 77,110, 13, 39,220,
+ 58, 59, 65,214, 27, 98,134,171,229, 37, 47,159, 62,167,206,123,150,203, 43, 90,104,200, 16, 88, 71,152,123, 97,220,222,230,209,
+131,143,168,151, 47, 25, 86, 43, 78, 78,215, 92,188, 86,230,195,142,114,190,183,198,189, 97, 75, 80,171, 91, 21, 13, 28,106, 69,
+165,114,231,244,148,245,253,123, 76,203,158, 90, 34,247,238, 62,228,223,254,197, 47,105,218, 25,182,  3, 47,223, 60,225,219,111,
+127,195,221, 59,143,108, 85,149,172, 38, 50, 39,208, 98,157,231,189, 87,107,218, 11,214,  5, 63, 14,214, 69, 29, 67, 32,137, 82,
+138,192, 42,209,180, 16, 36,112,251,244, 62,247,110, 61,162,177,112,254,234,  5,151, 87,151, 44,135,  3, 87,187, 43,166,121, 97,
+ 41, 11,243, 60, 95,239, 54,131,187,156,197,129, 85,118,136, 53, 82,136,220,190,119,143,135,247, 31,243,252,229,247, 60,127,241,
+ 61, 49,  4, 94,191,185, 96,153, 23,110,223,186,201,184,138,182,154,105,198,216,142, 18, 24, 66, 50, 40, 86,109,  8,133, 74,228,
+144,148, 60,140,108, 55, 91,118,251, 75, 68, 50, 45,116,166,101,199,  7, 31,158,112,247,225, 31,178,187,170,188,190,120,129,196,
+145, 82, 13, 83,220,231, 74, 82,161, 19, 73, 88,244, 81,131,184,  2, 58, 82,169, 68, 42, 41, 56,136,197,229,236, 41,184, 65,203,
+105,144,189, 43, 50, 36,194,102,180,103,101,155,233, 75,123,  7, 59,  9, 66,202,  1, 74, 69,130, 45,179, 53,118, 40,193,148,163,
+108, 53,216, 96, 53,173,210,124,119,220,205,148,233,248,148,235, 18, 45,165,112,108,229,238,238,228, 78,201,128, 41,181, 26,119,
+210, 48,191,209, 20, 23, 47,115, 33, 68, 83, 26,143, 13,144,173, 59, 65, 77,205,249, 78, 51,108,171, 87,197, 74, 55,111,  2, 45,
+155,235,157, 74,175,254,115, 58,191,161,137, 24, 78, 92, 29, 36,147, 26,165, 44,132,144,232,170,100,231,143,136,255,251,210,224,
+ 87, 95, 95,240,235,215,191,226,205,219, 43,130, 22,219,193,183, 64, 20, 83, 15, 66,119, 53, 85,173,218, 54,166,  0,120,137, 88,
+241,102, 53, 28,250,226,207,107, 91, 33,169, 51,  7,130, 55,105, 26,213, 84,130,119,169,104,177, 75, 88, 55,133, 81,147,201,250,
+164, 64,175,134,180, 85, 47, 38, 27,130, 61,123, 53,184,111,173, 86,154,202,181,235, 62,113,164, 38, 70,183,230,171,149,135,121,
+121, 78,234,248,206,192,119, 19,142,193,242,135, 89, 39,164,227,222,208, 76, 72, 33,184, 59, 87,237,  0, 63,238,127,187, 40,210,
+202,117,206,214,114,155,114,236,104,  3, 17, 98,244, 41, 95, 77,126,138, 41,145, 82,179,182, 41, 95,141, 37,177,130,135,170,134,
+191,172,150, 24, 39, 36,203,245,150,224,198,  1,196,214,  2, 41, 16, 99,164,246, 66,113,  9,116, 92, 39,234, 50, 51,207, 51, 85,
+ 44, 22,151,180, 50, 77, 54,253,199, 16, 41,105, 32,171,177,154,167,253,129, 42,194,106, 28,173, 64,195, 10,135, 80, 39, 60, 17,
+186,237, 91, 83, 71,151,133,222, 58,227, 56, 16, 67,161, 94,189,177, 66,152, 80,233, 49,112,245,226,146,125, 89,204,217, 24,178,
+117,221,250,100,189,120, 82, 32,132,102, 70,147,102, 55,200,222,236,  0,171,205, 71, 65,177,  3, 96, 70, 33,102,134,152,144,174,
+108,214, 35,178, 30,108,210, 81, 65, 93, 58,174,243,204,164,199,238, 98,115,251, 11,126,211, 85, 37, 37,248,254,201,115, 94,190,
+186, 66, 21,198, 49,179, 89,143,148, 89,185,184, 60, 48,207, 74,138,157, 87, 87, 59,182,219,100,181,137, 75, 35,169,201,116,165,
+ 45,150, 66,168, 21,177, 22, 12, 59,181,170,210,135,104,166, 69, 73, 68,109, 48, 70,170,152,212,166, 85,220,101,218, 65,  6,106,
+ 12,208,140, 36,183,214,200, 44,202,144,147,205, 18,163, 48, 47,149, 90,187, 85,202,170,213,216,138, 90,182,185,102,195,137,246,
+165,144,176, 28,231, 82,102, 74, 13,164, 28, 40, 75,227,249, 15,175, 57, 44,149,113, 48,  6,114,136,110,112,105, 98,148,170,169,
+ 80,151,106, 30,  3,113, 35, 77,179, 53,204,176, 30,137, 57,177,223,237, 88, 22,143,162,  4,177, 30, 99,109,180,186, 88,187,154,
+127,164,  3,182, 70,138,241,184,167,109,215, 82,189,250, 83, 47,250, 14, 86,233,212,165, 16,134,200,227,123,119,249,252,163,207,
+184,115,239, 30,102, 45,140,164, 77, 36,231,209,164,208, 90, 81, 77,204,165,177,148,153,200,104,211,147, 86,154, 70,200,118,216,
+ 36,127,120, 60,251,230,  9, 39,219, 45, 39, 39,183,121,252,197,143,204,165,127,152, 56, 28, 18,207,255,214,228,113, 13, 74, 14,
+137, 86,103,164,251,133,184, 84, 62,255,226, 67,138, 78,228,245,192,106,157,216,159, 95, 25,107,190,  8, 93, 19,235, 85,167,199,
+ 68, 95, 58,196, 72,110,  5, 77, 48,110,173,220,167,134,133,199, 31,125,204,195, 71,159,114,126,245,130,255,245,255,252,223,  9,
+154,248,199, 63,249,132,213,250, 67,238,222, 61,225,135,151,175,184,117,243, 46,159, 62,188,195,111,190,126, 67, 15,149,158, 38,
+ 43,217,  8, 66,207, 66, 47,209,162,143,165,122, 47, 66, 96, 42,149,180,138,244,217, 26,183, 66,176,146,166,185,205, 68,137,220,
+ 58,187,205,173,219, 15,200,161, 25, 19,162, 44,212,178, 48,237,206,121,251,246, 45,251,221,129,105,191,103, 94, 38,255, 78, 69,
+134, 49,114,118,118,147,  7, 15, 30,178, 61,187, 67,208,145,143, 63, 57, 97,187, 89,243,237,183, 79,160,119, 46,119, 19,251,249,
+149, 69, 63,131, 80,103,  8,110,160,141,195,241,144,240,181,143, 59,189,181,136,113, 15, 70,101,154,246,212,105,226,106, 31, 89,
+ 14,157, 15, 62,190,195, 31,254,209, 99,158,124,147,120,245,182,178,168, 96,133,143,157, 78, 70,106, 67, 67,177,105,176, 70,235,
+ 43, 32, 34, 75,161, 71, 37, 53, 33, 71,235,139, 87,143,223, 85,108, 47, 29,114, 67,154, 77,244,170,179,151,124,152, 43, 62,166,
+ 96,106, 81, 87, 88,212, 28,244, 33,121,201, 79,165,117,123,166, 80,109,122, 44,158,123,166,219, 10,179,213, 64,141,141,152,  2,
+145,129,134,173,226, 74,181,193, 42,199, 72,175, 92,163,151,105,206,253,192, 25,253, 65,236, 96, 22,107, 12, 58,242, 66,164, 44,
+198,177,143,  1,209, 98,185,119,143,193,209,  3, 85, 43,177, 97,  9,145,102, 17, 45, 51,193, 59, 97, 78,212,144,230,209,152,  9,
+ 21,117,143, 86,114,234,229,145,193,208, 41,209,122,229, 67, 82, 35, 26,210, 57,223, 79, 48, 61, 71,123, 33,134, 72,167, 64,200,
+116,141,180,210,173,160, 38,  7,139,209, 73,181,245,226,177, 37, 81,187,173,127,125,181,150, 66,176, 53,  5, 88, 67,137, 31,194,
+ 33, 90, 10, 74,232,244,122,188, 84, 54,  7, 25, 89, 65, 87,244,213, 17, 94, 70,102,  3,132,197,127, 75,180, 85, 79,108,226,107,
+ 85, 75,192,207,126,182,166,104, 96,156,238,195,114,119,131,109,169, 21, 45,141,212,125,214, 13,130, 79,228,174,178, 59,113,169,
+219,167,216, 91,165,172,152,158,238,144,148,227, 98,  5,131,248,  6, 49,105, 71,157, 19,127, 52, 20, 57,201,154, 86,  3,234, 55,
+ 45, 81, 99,101,207,190,111,116, 20,182,199,212, 18, 49, 89,252,172, 91,170,131,168,137,113, 21, 89,121,198,143,230, 48,125,137,
+144,132, 84, 21, 89, 37,147, 73,188,249,138, 85, 34,166,129, 85,118,201, 40,118,130,154,  1, 98,158,118, 92, 58,171,123,149, 71,
+134,100, 69,  3,117,113, 89, 92,173, 32,161, 53,203, 35, 55,231,209,207,197,220,176,211,162,172, 71, 97, 46, 51, 82, 27,200,154,
+ 60,140,148, 82,172, 63,120,240, 55,172,120,111,175,216,135,162,186,241,207,216,246,141, 86,142, 78,126,187,  5, 18,130,197,181,
+ 56, 18,254,237,203, 54,140,137,113, 24, 24,134, 13,105,173,212,195,194, 60, 21, 46,174,246,148,182, 48, 29,150,107,  7,118, 10,
+201, 92,167, 75,129,160,156,156,110,232,243, 68,200,129,187,235, 76, 36,179,223,119,174,166,234, 45,  4,133, 23,207,103, 68,206,
+184,181,185, 97,166,170, 65,153,107, 71,170,221,  6, 67, 72,222,199,100,178,250, 42,175, 45,103, 91, 22,104,153, 24,187,129,122,
+122, 48,117,161, 86,123,227,176, 29,209,170, 24, 39,223,154,193, 76, 25, 90, 90, 37,170,144,  5,234, 98,109,100,105,104,148,201,
+ 81,150, 58, 51,  6, 67, 15,151,174, 44,173,179, 74,226, 80, 26, 75, 93,212, 94, 17, 25, 88,150,153,182,120,111, 60,182,151,147,
+ 35,101,207, 25,  1,213,233, 84,177,191,155, 44,104, 88,212, 11,229,234, 98,111,135, 42,134,201, 12, 94, 10,212,106, 53, 88,137,
+ 90,108, 79, 36, 18,179, 77,224,234, 95,240,107,174,123,195,229,116,187,248,204,197,166,173,  7,247,238,240,209,199, 31,242,225,
+  7, 15,201,195, 13, 74,153, 73,204,172, 17,166, 22,168,186, 64, 85,180,  2, 49, 19, 67,103,181, 78,164,148, 25,131,161, 56, 67,
+  8, 44,138, 69,196,134, 64,185,218, 49, 77, 19, 15, 31,222,231,131, 15, 63,224,198,221,123, 60,251,246,107,174, 46, 95, 33, 87,
+111,152,166,110,252,117, 18,164,200, 92, 39,202,161,114, 85, 43,195,102,100,189,221, 80, 47,207,105, 53,241,230,205,  5,245, 80,
+  8, 55, 70,182,235, 13,165,236,204,232,212, 38,160,114,146,215,172, 79, 78, 89, 40,212,189, 33, 78,167,125,101, 24,183,124,120,
+255,125,254,167,127,245,175,248,205,223,127,205,184, 30,248,232,131,123,252,249,127,245,223,243,224,189, 71,124,253,187,255, 11,
+ 33,240,248,253,123,188,125,189,227,201,203, 11,242, 58, 19,  6, 27, 33,202,220,233,186, 16, 71,143,199,206,129, 88, 21,233,145,
+188,177, 10,213, 48, 87, 36, 70,138, 22,171,185, 44,153,210,170,241,185,155, 85, 81,110,134,145, 18, 19, 55,111,110,184,247,232,
+ 17,245,208, 56,236,246,236,118, 23,236,118, 23,164,113,197,237, 59,247,216,142,131,213,151,150, 74,  9,157, 90,149,187,183, 31,
+ 50,110,215,124,243,187,175,184, 60, 92,209,102, 43, 54, 33, 70, 98, 72,150, 65, 15,145,122, 68, 79, 58,111,123, 76, 43, 68,212,
+165,226, 66, 30,  7, 78,182,107,106,181, 36,198,213,213,196,201,102,197, 31,253,228,  1, 55, 79, 35,127,241, 31,190,229,226,194,
+ 65, 36,170,136, 44, 78,201, 52,250,156,169, 19, 21,105,141, 24,204, 89, 80, 82, 34,116,163,227, 36,132, 69, 60,255,221, 13,141,
+ 74, 14,132, 34, 44,210,188,214,179, 16, 36,211,155, 83, 87, 60, 17, 17, 99,116, 62,186,181,205,133,166,126,216,200,255, 47,158,
+ 44,161, 89,250, 66, 58,131,184,243, 59,  8,173, 23,164,217, 48, 82,139, 82,180,152,123, 95,178, 73,221, 29, 55, 13, 26,197,141,
+107,218,159, 64,240,242,146,110,223,205, 16,142, 53,194,217,170,176,123,187, 46,255,234,173, 17,232, 16, 50,173, 41,244,226, 89,
+149,104,223,145,102,145,200,238, 28, 18, 69,141, 70, 41,221, 14, 74,154,167, 31,236, 76,146,208,142,  7,154, 25, 85, 67,198,111,
+  9, 52, 49, 35,117,210, 70,151,104, 20,196,234, 38,195, 99, 25, 86, 79,142, 55,183,105,186,117,165, 52, 95, 69,168,103,239,195,
+ 49,137,100, 13,166, 77,195,181,209,249,  8, 57,179,225,160,191,147,222,187, 93,180,130, 68,114,202,126,161,176, 60,157, 86,181,
+203, 84, 23,138, 86,  2,137, 66, 55, 73, 95,140,103, 34,136,141,  4,221,206,219,138,169,136, 34, 66, 58, 50,165,193, 28,126, 54,
+  5,187,195,220, 27,105,204,128, 36,214,110,229,203,247,118, 36,152,137, 25, 81,208,100, 14,200,224,149,169, 98,112,130,235,191,
+207,108,188,118, 11, 13, 98,125,237, 88, 30, 88,157,150,211,213,  8, 96,180, 66,168,145,  9,185,222,123, 30,251,196,211,104,216,
+ 62,186, 83,204, 80, 74,177,200, 83, 76,246,192, 21,  4, 73,137,216, 93,150, 17, 33,141,107,206,182,137,101,222,243,246, 98,207,
+126,182,108,244,102,189,242, 66, 49,235,117,239,199,140,178,168, 69, 68,212, 58,130,211,176, 33,165,132,200,200,192,204,178, 28,
+ 56,175,133,113, 89,216,228,  8,161, 81,235,129,174,197,242,221,154, 60, 98,  2, 89,109, 21,161,209, 11,  9, 28,135,219,106,181,
+146, 19,204, 81, 30,131,  1, 37,240, 10,193, 97,200,228, 28, 88,165,  1, 69,216, 29, 42, 18,103,100,206, 44,  7,131,164,196,148,
+144,232,187,170,227, 36,105,129, 84,186, 81, 21,120,249,114,207,217, 58,115,255,206,  9,243,  2,231,151,141,210, 26,109,105,104,
+176,222,242,113,189,225,238,205,141,237, 35,131, 23,182,168, 85, 39,106,180, 60,118,232, 71,198,116,225, 80,103,178,120, 44, 36,
+ 52,164,186,236,150, 34,189,  5, 58,222,239, 62, 55,134,149,101,146, 43,  1, 29,163, 93,146,138,203, 33, 41,218,151, 87, 23,114,
+ 20,234,164, 12,  6,243,  3,141, 52, 93,136, 50,248, 23,173, 81,251,232,  0,  7, 95,231,  4,187,248,212, 86,232,193,111,242,102,
+127,189, 46,228,200,209,246,138,181, 85, 99, 18,184,130,148, 16,134,237,134, 24, 35, 23, 87, 59,207, 20, 31, 93,230, 86, 28,209,
+181,209,138, 77,  3,183,206,182,252,228,195, 15,249,250,251, 23, 92,238, 39,163,143,185,196,223,187, 99,139,137,215, 69, 33,181,
+ 54,214,171,145,159,253,232, 71, 60,124,252,136,245,118, 64, 84,184,218, 95, 48,108, 34,212,196,110, 41,104,143,104,170,244,170,
+ 44,181,131,238,  8, 73, 24,113,215, 50, 22,205,210,154,160, 44,164, 60, 32, 33,243,221,247, 79,233, 40, 15,238,127,204,159,252,
+167,255, 37, 79, 95,255,158, 84, 58,181, 69,118,203,204,152,  2,189, 22,210, 40, 84, 61,144,134,200,235,243, 55,188,125,241,154,
+127,250,207,254, 25, 49,  6,166, 90,152,166,201, 38,146,193, 24,  2,170,  5,137,217,  0, 56,101, 98, 53,140, 12,195, 72, 15,129,
+211, 37, 51,109,149, 90,  2,151,251,204,237, 91, 31,114,126,241,130, 95,254,234,111,208,222,169,211,194,191,254, 55,127,201,197,
+213,194,230,228,148, 62, 85,238, 63,124, 68, 57, 52,206,110,159,209,158, 62, 35,170, 80,105,212,144, 17, 81,  6, 50, 90,237,153,
+ 18, 86,209,119,153,  7,118,135,198,106,  8,196, 54, 82,165,217,100,152,131,145,206, 66,164, 37,181,105,175, 10, 85, 42, 77, 58,
+251,197, 42, 85, 21, 97,117,178,102,187, 61, 37, 12, 15, 89, 20,243, 97,168,165, 79,114, 12,118,225,142, 80,164,113,182,189,199,
+ 79,126,118,147, 47,191,250, 91,206, 95,189,  2,113,244,108, 50,138, 37,213, 20,181,104, 69,146,180,210,200,177,177, 30,214,180,
+102,181,168,173, 20, 90,142,172,183, 27, 14, 23, 19, 87,135,115,210,250,148,205,237,202,248,122,231, 80,168,  2,161, 56,181,210,
+ 20, 41,233, 80,123,164,177, 56, 51, 34,184,172,108,131,145,162,104,182,  3, 56,164, 72,116,153,187, 54,159,134,212,146,  5,189,
+119,162, 26,130,183,250,144,144, 98,162,139, 85,162,  6, 45, 44,213,124, 21, 81,178,245,203,135, 96,184, 85,181,184, 87,212, 96,
+106,152, 95,  2,234,210,  8,169,179,116, 67, 34,219, 14,206,232,145, 61, 69,164, 85, 23,232, 13,  9, 27,113, 15, 66,175, 14,  4,
+130,164, 66,107,118,144, 55, 34, 57,152, 31,165,245,104, 61,247, 75,177,132,130,203,238, 11,221,211, 54,166, 62,246,232,157,234,
+199, 68,149,218, 57, 83, 36, 92,127, 38, 56,230,202,155, 29,222,  6,133,177, 20,139,150,163,104,142,247,  7, 88,  7,189,181,120,
+250,185,229, 25,239, 78,161, 87,177,159,153,110,207,245, 46,116, 10,129,193,207,191,201, 98,106,168,199, 10,227,245,107,115,157,
+220,242,214, 54,149,234,173,141,198,121, 49,211, 95,119,168, 79,164,  5,177,103,231,160, 14,151, 49,117,207,144,216,199,162,151,
+118,125, 70,135,209,218, 43,237,  3, 36, 44, 85,137,249,  8,189,177,216,103, 18, 13, 94,247,230,229,238,218,174,101,248, 36,193,
+100,117,240, 62, 98,147, 72,172,247,221,176,128, 26, 70, 18,221, 36,100,255,179,  6,233, 55, 50,155,127, 46, 45,187,171,106,210,
+149,187,131, 45,123,235, 86,127, 49,211,129,244,108,183, 56,223,  9,  5, 55,195,169,115,155,151,185, 80,124,191,223,155, 77,125,
+193,115,195, 20,191, 32,136,155,246,196, 72, 59, 41,  9,181,117,150,221, 21, 23,187, 61,162,194,118,181,178,206,240,218, 92,121,
+ 48, 50,210, 56, 68,  6,148,165,168, 67, 10,160,232,138, 24,  7, 52, 14,228, 60,178,236, 94, 51,149,  5, 20,182,235, 19, 78, 86,
+153,183,151,151,136, 20,107, 32, 18, 33,235,114, 45,147,191, 43,113,177,123, 77, 43, 11,189,118,170, 42,171,245, 72,107,106,166,
+160, 86,200, 57, 49,174, 51, 41,103, 86,121, 64, 90,103, 41,141,234,113,149,185, 68,202, 60,179,155, 22,242, 96,140,233, 94, 77,
+ 77,  9,217, 42, 33,173, 42,214, 80,139, 41, 25, 58,177, 36,229,234, 10,118,115,163,116,251, 34, 29,243,216,235, 97,228,241,  7,
+239,177, 89,103,166,101, 33,174,140,111,157,  5,170,170,239,175, 58,154, 70,154, 24, 91, 90, 92,158, 14,106,114,124, 79,246, 70,
+  7,236,161,194,108,147,187, 10, 70, 39,236,157, 74, 37,237, 35, 75,111,228, 85, 96, 29, 50,147, 75,213, 42,102, 10, 73, 67, 38,
+132, 68,101,102,204,209, 10, 46, 74, 97,212,200,201, 24, 88, 90,133, 16, 88,229,108,243,116, 13,204,  5,134,113,197,103,159,189,
+207,151, 95, 63,227,234, 98, 34, 38,203,128,119, 85,218,190, 17, 99, 69,213,140, 53,226,185,253,245, 56,144,114, 96,183, 59,160,
+ 90,201, 65,220,156,226, 75, 67,212,229,249,206,227, 71,247,248,249, 79, 62,231,193,237,251,144,  7,126,245,235,255,215,254, 59,
+237,142,241, 52,114, 23, 85, 89,218,130,  2, 15,238,221,225,103, 63,249,  9,247,238,220,167,117,101, 42, 11,210,173, 16,166, 75,
+ 98,223,172, 11, 64,151, 25,157,221,213, 59, 68, 66,111, 12, 98, 89,216,193,107,106,151,165,  1,  7, 66, 24,  9, 81,153,202,158,
+183, 47,158,243,224,238, 93, 62,255,228, 67,238,222,187,109, 78,229, 59, 59, 14,135,198, 84,206, 25,215, 17,105,131, 57,142, 75,
+225,201,179,167,124,248,240, 17,159,191,255, 62, 63,255, 71,127,192, 15, 47, 95,177,236, 38,214,235, 45,123, 85,230,249,156, 80,
+179,145,219, 48,199,252, 92, 59,227, 58, 50,156,110, 56,212,128,234,142, 65,  3, 97,189,102,211, 58,183,239,220,228, 87,255,238,
+255,224,183,223,124, 73, 28,  3,210, 77,241,250,139, 95,254, 18,  9,194,127,241, 79,254, 41,103,219,192,201, 73, 96,184,178, 26,
+ 98,131,138, 64,107,139, 71,252, 60,110,214, 19,161, 55,203,198, 15, 86, 70, 82, 15,118,224, 84,169,214, 57, 93,154,245,123, 55,
+243,207, 20, 26, 61,  4,227,  7, 56, 15,252, 88,237,217, 28,229,169, 52,150,218,  8,126, 34,107,129, 42,202,152,  6, 75,110, 72,
+131, 58,179, 74,153,143, 62,250,130,191, 57,255,247,180,186,160, 33,208, 12,216, 72, 12,214,  9, 97,109, 89, 29, 90,101,158,173,
+190, 53,196, 64,169, 54, 41,150,105, 38,137,181, 46,126,249,187,167,252, 89, 18,110, 62,248,140,151,223, 30,232,253,119,166, 36,
+ 53,163, 13,198,216,  8, 53, 80,233, 72, 42,126, 94,218,165, 88,233,126,  0,181,235, 98,160, 38, 29,102,207,119,231,132,246,106,
+ 81,192, 94,237,162, 34,118, 57, 64,178,253,172,193, 39,215,166, 20,137,  6, 20, 19,168,221,246,243, 10,180,101, 33, 98, 10,103,
+  8,193,168,100,  1, 90,114,198, 72, 83,218, 92,125,143, 28,173, 40, 70,109,157, 99,216,226,110,173,109,170,228,220,233,154, 60,
+178,105,127,191,116, 97,174,166,124,  4, 35,220,216,207,216, 26,218, 23, 74,115,152, 24,130,182,226,201, 42, 43,140,209,238,  5,
+223,122,  4,225, 56,187, 33, 96,223, 81,181,215, 92,221, 75,229,159, 34, 47,100,193, 25,245, 71, 46,188,157, 17,173, 21, 66,138,
+ 84, 21,104, 74, 58, 22,190, 52, 87,  4,212,128, 51,199,  1,183,209,208,144,172,193, 45,218, 69, 36, 17,252,  0,110,132,108, 74,
+166,244,102,141,131,214, 26,198,187, 13,184,209, 86,113, 43,155,248,103, 18, 73, 22,229,244,210,153,168, 22, 17,175, 98,116, 78,
+169, 13, 73,217,134, 17, 47,246, 73, 77,233,234, 84, 69,111, 59, 57, 58,225,193,200,114, 18, 34,169, 97,197,245, 81,196,203, 83,
+124, 58,214,198,130, 27, 37, 60, 11,109, 53,143,126,208,135, 64,136,153, 32,118,195, 74,  1,203, 26,122,150,221,118, 99,174,148,
+123,230, 49,226, 61,184,213,121,190, 71,119,176,203,205, 57,184, 19,208,220, 72, 22, 89,114,146,142, 85,166, 10,253,218,101,232,
+ 47,210,181,212, 99,230,189,230,237,105, 49,  4, 52, 67,236, 74,153, 11,243,126,199,249,229, 76, 90,173,216,172,  6,147,149,156,
+200, 22,147,239,117,188,203,125,125,182,226, 78,206,108,134, 64, 45,133,239, 94, 52, 14,213,106,103,235,116,206,229,229, 91, 74,
+239,172,198,129, 48, 36,230,218,188, 22,143,235,138,188, 46,253,154,199, 14, 94, 35,171,157, 64,164, 54,  3,145,172,214, 43,198,
+ 16,121,179,191,162,245,206,102,181,226,198,233, 41, 39, 39, 35,251,195,204, 97, 50,226, 84,239,206,183, 31,  3, 90, 27,135,105,
+ 50, 24, 12,246,123, 39,223, 91,169,  8, 33,100, 66,176, 78,239,211,237,200,118,187,102,154, 11,135,253,194, 68,112,218, 81,113,
+180, 97,103, 51,142,124,254,217, 39,156,108,215,104,179,  6,184,117, 12, 76, 42, 28,220,217, 45, 42,140,155, 12, 97, 96, 57, 40,
+213,127,159, 94, 58, 99, 78,164, 16, 41,189, 51, 45,141,144,128,100,217, 88, 37,208,164, 82,150,153, 32,158, 25,165,209,251, 66,
+157,133,131,  6,150, 80,137,171,204, 74, 19,186,120, 23,186, 24,166, 86, 23,165, 47,  1, 66,101, 66, 57, 44,198,124,110,181, 83,
+250, 66,169, 22,  3,219,156,110, 88,165,200,157, 91, 15,216,140,183,249,234,171,175,120,249,230, 21,101,246,174,109,209,235,155,
+180,160,148,121, 38, 13,  3, 42,137,203,203, 29,189, 85, 55,225,217, 14, 30,117,103,124, 16, 62,250,232,125,110,222,216,240,224,
+225, 67,198,180, 98,175,133,247,223,127,192,247,207,158,241,228,135, 23,118,244,151,226,248,221, 68,239,157, 28,  3,159,124,252,
+  1, 63,251,233, 79, 25,157, 44,150,186,146,  7,101,100, 64,123, 96, 90,  2, 34,197,112,144, 73,236,146,104,114,142,181,250,169,
+201,172,227,118, 77, 20,152,151,217, 14,164, 24,145, 97,195,213,203, 75,106,239, 60,126,244, 49,143,222,123,204, 50,237,185,184,
+ 56, 80,198,204,171,233,130,203,139,215,204,243,200,102,125, 66,236,194,  2, 28, 46,206, 57,253,252,199, 60,124,240, 35, 46,119,
+149,195,190,113,114,178, 37,116,171, 81, 30,194, 41, 61, 10,122,181,135,105, 34,246,206,233,217, 29,230,114,201,244,226, 53,104,
+224,236,254,  9,107,201,188,124,115,193,237,211,219,172,211, 57,255,230,151,255, 55,173, 85, 54,227,198, 34,171, 33,162,179, 81,
+ 14, 31,222,187,205,144,133,205,217, 29,222,252,221,115,226,106, 64,107, 39,123, 93,103, 40,238,211, 56, 22, 56, 37,241, 54,187,
+145, 22, 43,138,145,  7,123,183,203,112,210, 76,212, 70,149, 70,170,145, 82,221,163, 18, 70, 98,180,140,189,246,206, 16,172,175,
+224, 48, 79,132,138, 69, 42,131, 66,139, 32,150,200,145, 20, 24, 67,166,207, 80,165,160, 93, 72, 49, 17,197,106, 70,219, 49,194,
+137, 32,217,240,179,145,  8, 25, 52, 38, 98,176,168, 85,104,130,186,113, 78,171, 50, 76,151,252,244,139,247,121,125, 62,243,155,
+191,251,146,127,249,103,255,130,243,183, 31,112,247,175,182, 92, 30, 38,148,129,132,201,236, 61, 86, 82, 53,247,126,169,246,196,
+ 77,  9,171,  6,117, 24, 18, 14, 59,  9, 67, 66,171, 32,193,166,123,186, 79,240,  5,187, 24,120,149,169, 61,103, 12,166,210,164,
+ 59,175, 94,188,170, 53, 34,152,175,197,234,172, 35,146,133,170, 16, 66, 35,106, 48,102,185, 15, 86, 41,153,234, 86,181, 81,122,
+ 39,117,115,186,135,  0, 75,169,228, 40,158, 49,239,200, 34, 44,125, 62, 58,128, 25, 83, 50,126, 67,235, 70,196, 19,175, 60,245,
+204,117,107,199,110,114, 83,124, 85,142,254, 35, 59,158,173,227, 98, 49, 62,123,136,215,127,182, 21,147,194,147, 68, 98,118,117,
+221,213, 49, 67,236,198,235,244,139,122,249,139,168,173, 80,113, 28,111, 72,  1,117, 74,163,248,127,174, 14, 26, 10,222,170,166,
+ 98,248, 91,212,155,247,162,216,247, 80,149,238, 36, 78, 99,222, 27,108, 42, 29, 11, 91,194, 81, 17, 16, 95, 33, 24, 83,222,106,
+177,133,168,102,108,115,228,167,197, 78, 11, 88,217,182, 41,189, 68,152,251,236,138,141, 35,126,197,112,217, 26,186,249,181,154,
+ 69,226, 74, 53,207,137, 85,190,  6,146,241, 46,222,  1,242,173,209,220, 14,183,230, 13, 81,  4, 71,137, 86,147,165, 45, 55, 23,
+105,161,123, 27,141, 29,184,193,  1,251, 33,102,151,230, 13, 83,152,146,130,172, 64, 27, 57,121,199, 49,110,254,169,213, 77, 35,
+234, 37, 23,246,179,132,224, 45, 62, 29, 98,142,142,168, 85,231, 26, 59,222, 48,102, 87,246,223, 85,208, 73, 83,235, 72, 79,114,
+109, 86,144, 52, 48,158, 68,238,111,236, 67,179,168,237, 92,114,181, 15,107,175,118,211,237,  4,154,199,141,234,186,243,182, 44,
+ 92,236, 11,115, 53,134,184, 72, 99, 62, 92, 58,120,198,238, 73,243,254,202,189,  3, 71,186, 85, 53,186,145, 27, 28,162, 55,149,
+ 85,133, 94, 29,110,210, 42, 57,101, 86, 67,226,106,183,163,214,206,102,179,230,198,217,150, 33, 71, 88, 26,243,110,102, 95, 27,
+195,224,210,218,210,217,228, 13,183,111,156,112,152, 34,111,246, 19, 73, 35,195,104, 95,186,212, 19,115, 89,108,186,139,  3, 61,
+219,244,178,148,194,180,204,  8,137, 28,224, 48, 79, 20,151,204,134,213,138, 15, 63,250,192, 12,120, 73, 57,205,107, 84,148,180,
+202,124,241,249, 39,232, 60,241,244,201,119, 28,218, 64, 31,132, 16, 51, 41,102,234,126,166,205, 19, 61, 42,125,180,198, 34, 82,
+102, 16,107,185,194, 77, 68,  1,123, 63, 90, 47,212, 50, 83,131,185,210, 99, 12,164,117,162, 30, 22,164, 43,177,218, 36, 84,178,
+ 18, 19,132, 86,153,231,153,175,191,251,129,195, 92, 24, 82, 48,197, 67, 42,171,100,190,139,222, 43, 75,233,104, 19,110,223,187,
+131,222, 60, 35,166, 21,195, 74,248,224,227, 71,220,190,119,131,105,154,248,253,147,103, 76,229,104,164,177,  9, 60,199,196,122,
+ 28, 56, 28,230,107,207, 68,111,222,137, 28,173,142,179,122,158,252,236,246, 77, 62,121,252,216, 46,155,197, 12,111, 34,194, 31,
+252,252, 15, 56, 59,251,138,171,157, 93,176,114,206,215, 45, 97,119,238,220,225,189,135, 15,216,134,196, 65, 42,121,155,145,131,
+ 73,104, 37,  9,173, 66,109,  7, 36,225,192, 27,147,206,196,203,124,178,  3, 66,134, 96, 19, 68, 91, 39,198,147,  1,102,171,120,
+ 44,147,242,250,229,107, 30,220,189,203,103, 31,127,196,141,179, 59, 40,145,215, 47,159,241,245,147, 47,217, 77, 59,238,223,127,
+100, 93,211,205,190, 83, 57,  6, 62,251,241,103,124,251,236, 91,126,244,249, 79,185,184,120,203,106,104,196,205,  9,243,116, 73,
+ 10, 25, 29, 51,181, 47,148,165, 16, 36, 50,174, 86, 44,193, 38,152, 33,  5, 54, 97, 96, 55, 57,174, 84, 19,119, 30,220,231,175,
+255,159,191,228,171,175,190,226,108,187,101, 53, 12,132,  0, 83,177,236,114, 30,236,243,114,235,222, 45, 36,  8, 23,111,175,  8,
+173, 90,109,192, 34,215, 69, 69,181, 84,180,137,169, 97,139,131,128, 88, 72, 52, 90,234, 76, 13, 86,216,144,218,250, 76,212, 68,
+151, 21,113,128, 85,140,148,165,210, 41, 84, 53, 70,124,200,118,209,110,117, 50, 83,101,243, 85,141,118,250, 16,200, 26,169, 98,
+126,150,165, 55,130,248,228,235,  7, 67, 26,146,197, 54,171, 53,100,  5,167,145,105,140, 52,188, 63,194,193, 68,221, 85,206,160,
+193, 14,149, 20,169,181, 50,166,204, 31,255,163,247,248,245,175,255,158,127,254,223,252, 41, 63,254,241, 99,126,250,243,207,248,
+250,217, 43, 66, 47,102,226,244,129, 35,  6,195,221,198,152,189,226,183,209, 42, 52,175, 22,142, 26, 45, 94,233, 84, 54,123, 46,
+ 87, 51,244,206,147,153,167, 66,162,118,219, 99,167,104,197, 37, 69,186, 53,183, 53, 69,117,242,157,175,225,139,155,185,158,205,
+136,222,124, 42, 22, 87, 60, 56, 54, 71,118,198, 49,209, 60, 38, 24,181,218,122, 13, 59, 36,163,239,138, 83, 50, 42,222,210,139,
+ 13, 27,173,218,  0, 84,188,220, 37, 68,122,241, 26,221,110,144,151, 46,118,169,107,189, 59,138,197,118,241,157, 99, 55,120,163,
+105,245,231,125, 66,186, 41,128,205, 39,183, 60,248,122, 32,136,  7,182,173,173,179,105,187, 78, 22,165, 96,141,111, 72,160, 55,
+129,190, 56,  1, 46,162,165, 32, 67,164,119, 55,135,171, 33,155,143,  5, 41,209,211, 49,226,236, 20, 91,243, 10, 93,108,218,215,
+ 96, 48,161,238,201,176,128,145,246, 68, 42,161, 71,107, 99, 20, 53, 34, 93,244,149, 46,225,154,176, 26,142,205,121,106,187,252,
+ 46,234,117,183, 86,195,107,174, 96,131,230, 91,164,209, 46, 83, 66,244,179,170,218,231, 48, 58, 85,180, 91, 22,223, 21,118,203,
+ 84,219,  1, 92,220, 80, 16, 29, 81,103, 59,128,148,131,229, 17, 93,126,231,184,103,175, 70,180,  9,110, 56,104,149,107,178, 18,
+177, 81,171,197,  9, 66,  3,164, 94, 71,136,196,111, 93,200, 64, 24,162,239,190, 13,115,199, 98, 11,255,218,253, 67,171,149,174,
+201,162,114,106,237,113,221,155,147,  2, 71,143, 66,164,247,128, 28,113,123,252,127, 76,189,219,175,109,219,117,167,245,245,214,
+123, 31, 99,204,185,214,222,123,237,203,217,103,159,155,207, 57,246,177, 29,199,177, 83,  9,185, 57,  9, 85, 20, 16, 82,170,155,
+138,146,160, 36, 36,144,  0, 81,  8, 30,224, 15, 64, 66,145,120, 67, 66, 20, 15,136,  7, 30,144, 10, 21, 82, 69,133,  2,  2, 68,
+ 42, 74,225,220,202, 46,151,147,216,142,237,216,177,125,236,115,191,236,251,186,205, 57,198,232,151,198, 67,107,115, 29, 63,248,
+193,183,179,247,154,107,206, 57,122,111,237,247,251,190, 64, 36,146,252,  7, 86,  9,228, 60,218,173,185,249,139,230,246, 57,209,
+134,166, 78,144, 70,234, 86, 45,105, 13,158,158,173,180,223,248, 92,147,  0,  0, 32,  0, 73, 68, 65, 84,117, 53, 87, 49,160,125,
+ 97,223,140, 40,135,155,227,106, 43,134, 52, 69,188, 81, 87, 29,237, 41,222,251,247,224,139,122, 73,246,176,215,237, 48,110,204,
+183,188,174,157, 33,101,142,183, 19, 73,225,114, 89,152, 59, 20,109,140, 57,113,116,180, 65,235,194,165, 54,142,134,108,218,215,
+163,155, 44,237,  1,180,195,159,101,111,154, 16, 35,185, 91,146,180,174,171, 37, 67,103, 59,108,140,131,237,253,148,110,130,135,
+ 16,184,121,231, 54,173, 41,143,159,156, 35, 41,112, 62,100, 34, 74,222, 31,243, 75, 47,127,130,151,158,185,198, 63,123,248,127,
+243,224,225, 37, 71,227,134, 49,  8, 45,118, 90,  6, 73, 91, 54,201,247, 57,185,177, 44,141, 54, 69, 66, 15,180, 82,188, 86,100,
+ 24, 70,103,196,122,194,181, 89,245,112, 85,242,104,230,168,221,110,230,178,239,168,173,176,150,202,186,175,156,157, 61,225,195,
+ 71, 79,200, 18, 25,134,200,241,209,192,179,119,111,240,177,103, 79, 56,222, 12,164, 96,196,173,203,179, 61, 79,206,102, 62,126,
+  7,194, 52,240,221, 31,157,129,  8, 39, 55,239,112,250,248, 17, 75, 91,217, 47, 43,181, 53, 68, 18, 41, 89,230,226,236,233,217,
+ 85, 38,  3,159,238,228, 96, 85,168,165,154, 89,233,214,205,107,220,188,117,211, 84,139,187, 29,105, 76,132, 96, 35,215,241,250,
+200,107, 63,241, 73,198,124,196, 92, 11, 49, 41, 49, 36,114, 20,186, 36,218, 92, 40,189, 90,152, 51,  5,114,135,160,131, 85,119,
+ 68,  9,154,168, 75,161, 22,131,104,140,227,136,100, 99,173,107, 72,244,100,159,107, 24,208, 53, 26,101,175, 53, 36, 11,107,221,
+115,254,244,  1, 63,253,249, 79,115,227,246,117, 74, 92,120,244,100,161,235, 57, 79, 30,189,199,181,107,183,184,113,251, 54,187,
+203,115,202,229,158,180,221,144,211,196,229,217, 19,238,221,123,134, 87, 62,249,113,190,245,141,111, 48,140, 35,115,153,  9, 12,
+196,188,101,185,188,164, 45, 51, 49, 10,151,235,138,236,149,202,204, 81, 22,174,143, 35,103,187, 74,185,124,202, 18, 58,211,176,
+165,158, 63,228,255,250,127,127,155, 77, 78,196,148, 40,218,201,205, 70,167,157,206,115,247,110,210, 66, 97,147, 55,212,102,117,
+163, 54, 23,152,  6,235,138,235, 10,205, 94,183, 30, 43, 53, 88,224,172, 55,147, 92,175,161, 19,230,206,144, 18,139, 64,148, 78,
+144, 17,154, 16, 83,177, 92, 72, 80,122,180, 47,218,220,125, 58,212, 42,213, 97, 99, 41,  5, 82, 43,246,122,107, 36, 53,231,102,
+ 15,  6,248,208, 96, 55,178,222,149, 82, 87,131,184, 52,179, 47, 50,101, 18,209, 86, 44,221,136,132, 97,176,124, 70,107,157, 82,
+ 22,219,195,138,243,193, 91,231, 83,247, 78,248,252,167,158, 35, 72,224,179, 63,245, 19, 60,220, 95,242,198,155,239,242,211,191,
+250,243,124,254, 39, 63,207, 87,191,250, 58,143, 30, 63,245,224,151,203,172, 58,148,110, 40,215, 32,137,185, 55,122, 42,136,250,
+200, 88,171,123, 31,108, 52, 30, 53,162, 84, 74, 89,141,224, 25,157,208, 22, 44,117,236, 74,121,151, 43,205,  6, 38,233,157, 33,
+195, 94,149,156,  6,180, 85, 90, 15,104, 86, 66, 55,  3,163,101, 29,186,113,239,187,173,207,214,197, 46, 95, 99, 12,228,148,217,
+215, 66, 23, 51,133,197, 14, 89, 58,189,  8,213,235, 94,177, 91,200,186,134, 64,211, 21, 82, 96,168, 54,  9, 80,237,228,104,235,
+183,174, 21,233, 38, 67, 65, 33, 54, 75,245, 91, 23, 91, 73, 81, 40,181, 34,205,220,245, 42,157,126,133, 79,117,210,156,  8, 97,
+237, 54,182,246,236, 18,193,234,101, 81,236,125, 96,162, 46, 91,251,150,106,249,136, 32,102, 32,109,213,130,143, 70,133,115, 13,
+108, 16, 84, 44, 72, 43,154,160, 27,  6, 56,133, 64,245, 42,158,115,184,204, 93, 78,240,223, 27, 40,245,170,185,116, 72,194, 91,
+205,218, 66,125,  7,159,187,184,150, 24,137,246,250,151,195,119, 80, 53,218,157,246, 43, 21,184,197,212,148,205, 96,251,252, 46,
+ 29,105,163, 61,107,253,182, 47,  1,195,200,170, 32,107, 37, 37, 49,184, 64,143, 54,162,178,211, 70,184,210,208,169, 90,151,208,
+ 14, 84,110, 64,234,135,164,186,  5,168,154,167, 66,237,228,237,  6, 41,181,240,  4,197,228,243,  7,146,173, 96,163,132,210, 12,
+177, 42,118, 48,179,189,191,  8, 34,  3, 18, 32,183,102,191,228,238,156,112,151,148,116,133, 24,204,201,107, 50,  0,163, 25,217,
+ 15, 96, 29,192,152,212, 82,251, 61,160, 33,217, 11, 91, 26,113,204,126,160,176, 95,106, 76,163,215,173,108,111,108,183,111,117,
+144,191,194,182, 49,100,251, 37,149, 82,168, 42,104, 75,180,181, 80,221, 11,108, 60, 94, 11, 15,170,107, 92,109, 76,116,168,116,
+ 28, 14, 61,234,144,128,142,196, 12,170,204,107, 49,171,211, 24,141, 19,109,  6, 21,242,118,226,198, 96, 39,239,117, 94,160, 43,
+227,144,  8, 83,160,148,217,107, 19,209,236, 82, 13, 98, 26,208, 84,  8,181, 49,215,143,200, 81, 74, 53,253,163,155,232,172, 50,
+209,145, 24,185,125,231, 14, 83,178,  7, 75, 76, 66, 40,157,179,253, 76, 30, 39,226,124,202,239,252,246, 23, 25,179,240,254,187,
+ 31, 16, 66, 99,183, 44, 76,  1,171, 81,116,227, 24,132, 49, 33, 37, 64, 14, 72, 74,104, 19,242, 80,233,209,117,168,181,211,197,
+ 60,191, 53,194,102, 18,180, 26,227,120,202,182,255,123,252,244,140, 55,223,122,151, 16,237,195, 57, 36, 59, 88,244,106, 65, 47,
+ 92, 63,155, 98,166,105, 98,110, 74, 92, 45,216,168, 49, 48,151,200,163,211,133,207,188,146,121,249,185,219,252,240,157,  5,136,
+236,207,247,188,254,163,119,152,231,234, 55,232,200,102, 24,105,170, 92,238, 47,237,195,153,178,237,167,130, 50, 13,147,141,185,
+ 75, 33,244,206,152,  3,159,122,237, 21,174,167,193, 89,229,129,181, 84,134, 33,147,198,224,156,249,  4, 17,198,104,155,173,178,
+159, 13,139, 57,118,136, 66,209, 13,194,130,148, 70,141,118, 98,207, 17,234,140, 57, 15, 74,179,155, 88, 24,145, 97, 36,230, 72,
+216,175, 72,180,101,251, 10,132,170, 72,183, 41,130,166, 68, 47,129,211,243, 83,242, 24, 57,121,230, 54,219,219,119,185,125,251,
+ 14,127,254,173,111,178, 59, 61,227,214,141,187,196,205, 17,143,159, 60, 38,213,202,144, 70,186,116,122, 61, 99,119, 49,243,210,
+189,231,185,255,240, 17,105,216,162, 41, 50,181,153,186, 40,243,254, 28,213, 29,183, 55,199, 44,219,213,224, 54, 85,137,121,195,
+178, 22,206,215,194, 26, 43, 12,  9,221,237,185,118,107,203, 63,255,202,215,248,240,193,251,108,199,145,101, 53,190,185,138, 92,
+237, 92, 63,251,218,167,121,249,149,123,188,240,226, 51,156,157,239, 41,203, 66,158, 70,211, 74, 14, 22,214,154, 47,149, 20, 44,
+208,104,208, 21,101, 84,161,171,213,172,114,136,172,116, 90,237,164, 60, 88,  0, 43, 71,187, 92,116, 19, 94, 68,215,107,244,222,
+104, 45,120,170, 56, 17,195, 96,128,160,102, 33,168, 44,182,183,109,201, 40,103,181, 99,148, 76, 34,189,172,100,177,110,178, 86,
+ 35,209, 73,109,254,157, 98,127, 31, 85,179,156, 33,198,215,200, 49,217, 45,208, 84,112,180,218, 88,214,153, 59,119,174, 65,142,
+148,186,227,229,151, 95,228,209,  7,247,161,118,158,121,225, 54, 47, 60,127,155,135, 15, 30, 59,142, 89,200, 89, 89,215,234, 41,
+243, 78, 43,123,243,198,123,139,162,225,135, 15,223, 27, 15,195,  8,177, 82, 84,136,105,180,118,105,237, 31,133,180,204, 49, 77,
+ 91, 59,201,235,150, 68, 33,183,100, 25,134, 96,212,187,106,192,121,114,177,146, 77, 22,161,209, 89,202, 74, 10, 31, 29, 38,140,
+181,  0, 90, 97,141,246,239,197,241,197, 41, 64,109,  2,217, 19,222,118,201, 37,  6,101, 41, 51, 45, 38, 82, 41, 84,205,148,110,
+  1,197, 36, 74, 45,133, 16, 29,215, 27, 18,134,210,177,181,218, 21, 15, 62,224,151, 72, 91,144, 23, 85,164, 26,133, 45,248,216,
+ 58, 10, 22,246,235,166, 73, 85,109,214, 59, 87,231,171, 68, 99, 30, 72,176,160,107, 28,109, 90,167,158,255, 18,172, 14, 86, 91,
+ 35, 99, 30,147,171, 80,152,211,221,170, 54,119, 55,  4,151,217,248,119,122,116,242, 99, 83,151, 52,217,180, 26, 21,127, 55, 26,
+  7, 64, 15,147,  2,237, 68, 15, 70,166,168,246,119,112, 87,132,184,  5,146, 30,173,240,228, 20, 56,237,118,209, 24,228,240, 12,
+244, 66, 17, 54, 25, 48,132,110, 33, 73,186,162, 13,170,  6,210,225,102,218,235,  1, 31, 31,220,  9,237, 53,182,195,141,220,111,
+163,118, 28,179, 61,235,  1,179, 26,176,138, 79, 60, 32, 48,125,127,222, 91,161, 81,233, 45, 58,121,199,247, 22,213, 59,141,206,
+174, 53, 43,154,255,101,131,207, 78,  8,100, 20,178, 61,184,210,161,244,175,174,174, 12, 29,173,149,166,221,246,250,  4,219,191,
+119,171,156, 72,180,135,119,180,134,166,133,100,186, 82,122,167, 20,151, 36,116, 32, 88,128,198,127,100, 59,224, 96,234,188, 24,
+178,229,  6, 82, 99, 24, 13,118,144,212,198, 56, 85, 97, 93, 13,118, 17,170,241,155,235,225, 97,167,129,218,235, 21,102, 49, 68,
+177,219, 49,  6, 65,208, 96,224,156,165,184,254,112,200,244,  2,105, 28,216, 78, 91, 34,141, 82, 23,235,160, 23, 39, 15,181,202,
+233,105,224,104, 59, 48,104,133, 10,146,  7, 75,173,214, 70,163,177,150,195, 58,195,252,222,221, 45, 70,248, 58, 35, 74, 34, 76,
+112,114,243,  4, 17,168,107,181, 64,202,162,164, 44,158, 86,175, 12, 67,224,254, 59,111,211, 74,163, 15, 98,233, 92, 13,172, 49,
+ 18,233,244, 18, 24,162,178,236,109,236,214,  4,242, 32,132,214,145, 20,152, 91,131, 26, 24,242, 72,204, 29,213,140, 68,241, 55,
+190,123,159,243,200,205,113,226,195,119,222,225,236,226,146,187,119,142,217,142, 19,105,176,247, 74,220, 69, 46,246,197,220,208,
+165,243,248,108,207,227,243, 29,111,189, 43,150,202,119, 57,202,141, 27, 55,216,110,183,252,193,215,127,196,167,159, 54,106, 24,
+169,203,202,155,239,188,205,217,197, 41, 33, 64, 78,131,  1,113, 98,162,172,179, 51,188,147,213, 76,174,212,184,198, 58,168,205,
+250,253,175,125,236,101,158,127,230, 25,235,  5,199,234,211,167,100,187,176,170,244, 34,150,132,238, 43, 90,212,165, 58,153,201,
+193, 41,171, 88,168,102,174,198,162, 15,  3,104,107, 92,236, 22,147,178,  4,119, 58, 70, 35, 34, 70,129, 52,  4, 74, 55, 48,139,
+ 65, 61, 58, 18, 27, 75, 11, 48,129,236,  4, 25, 50, 79, 31,223,231,198,241, 77,142,211,109,234,238,146,251,239, 61,225,209,211,
+ 29,187,146,152,182, 27,230,249, 18, 26,196,235, 25, 82, 36,246,206,254,204,148,148,199,183,159,229,135,223,255,  1, 55,174,111,
+ 88,245,136, 28, 39,234,102,101,140,137,121,159, 56,159, 47, 44,232,153,132,139,186, 48, 52, 75, 11,135,152,236, 51,169,202,209,
+141,231,185,104,231,252,206, 31,254,174,121,156,171,175,206, 90,179, 26, 44,202,107, 47,125,140,103,111,221,229,229, 59,119,121,
+254,238, 11,252,159,255,236, 75,172,113, 70,210, 53,100,153,145,162,172,186,210, 53, 82, 66, 33, 20,163,172,  5,201,104,131,124,
+104, 59, 72, 67,234, 64, 14,  6,  0,210,186, 18,134,145,186, 22,242,224, 55,202,170,196,208, 41,161, 89, 27,163, 39,180, 85, 58,
+201,190,241,115,180,112,164, 67, 89, 80, 40,173,153,128,  5,165,175,179,179,  0,156,191,230,249,157, 40,  7,243,153,239, 79, 67,
+ 37,196,193,113,177,201,191, 99,204,121,221,123, 32,165,204,155, 15,158,242,206,  7,143,248,229, 95,249, 44, 66,224,100, 51,113,
+ 94,224,244,254,  3,114, 12, 44,187, 39, 76, 89,216,151,234, 59,214,236,204,132, 78,169,166,190, 18,175,234,138, 52,180,205,134,
+124,245,192,112,109,197, 87,143,214, 41, 47,173,216,119, 86, 17,154,250,228, 44,234,149, 95, 59, 70,131,179,244,216,104, 54,200,
+246, 11, 91,242,118, 94, 32,134,230, 57,159,122, 32,146, 80,181, 17,154,221,224,123,200,172, 90,160,117,198,104,135,161, 24,160,
+168,173,102,165,117, 11,233, 73,176,224, 97, 53,122, 91,210,142,180, 72, 79, 92,  5,197,122, 55, 87,249,161,195, 94,235,226,200,
+222,224,117, 84,227,153, 84,181,137,222, 21,193,180, 71, 91,239,210,  9,206, 78,  9, 65, 24, 52, 28,134,199, 24,215,170,250,101,
+174, 35,221,242, 87, 11,254, 48,148, 67, 81, 85, 28,226,117,  8,243, 43, 45, 59,127, 66,109,213,167,173, 89, 16, 87, 15,114, 22,
+ 75, 59,247, 98,191, 43,193,214,101,253,192,106,241,105,183,150,  6, 17,247, 13, 88,194, 93,130,146, 83,112,115,158, 25, 48, 85,
+  6,187,137,215,238, 54, 64,107,159, 29,206, 21,221,167,225, 74,114,229,179,101, 28,114, 50,131,158,229,111, 76,  7,156,248,168,
+249,212, 85, 72, 86, 65,176, 15,133,120,145,255, 80, 63, 15,110,167,193, 65, 52,218,237,148,103,189, 76, 83,124,  6,215,158,181,
+ 98, 21, 51, 17,235,209, 86,119, 16, 35,131,191,145,154, 99,251,112,198,185,237,239, 53,120,152, 44, 56,  7,250, 48,102,119, 91,
+ 85, 10,209,110, 46,222, 57, 86,199,  1,118,204, 28, 36,218, 73, 41,154, 14,207, 79,209,253,128,227, 67,209,140,167,147, 45,165,
+ 89,203,  1,215,105, 95,202,226,238, 96,171, 36, 43,186,136, 33, 61,163, 80,129, 42,254, 80,142, 92,221,192,115,204, 68, 53, 34,
+221,184,201,140,181,184, 49,206, 56,188, 90,172,131, 72, 16,227,  5, 59,197,191, 53, 69, 82, 68,123,103, 45, 54,157, 32, 42,203,
+ 92,216, 12, 27,142,143,  6, 36, 40,243, 92, 88,139,105,  4,171,194,152, 35,203,190,176,239, 43,171,141, 87, 72,209, 67,111,206,
+ 43,239,173, 80,234, 33,101,233,171,140, 30, 24, 83,182, 78,230, 90,209,216,185,251,204, 61,110, 94,223,176,174,139,  5, 48,114,
+224,114, 85,118, 75,117,221,234,202, 80,162, 43,120,189,207,170,145, 50,175,204,221, 96, 49, 81, 35,227,209, 64, 40, 21,130,141,
+ 75,119,103,254,187, 31,  6,214,186, 16,106,103,191, 95, 41,125,101,119, 57,211,155, 57,181, 67,140,104, 43, 92, 63,185,206, 43,
+207,222,227,252,252,156,105,176,209,124, 45,166, 47,164,  7,206, 47, 87,219,163, 55,179,254,153,114,209,216,235, 81,  2,146,236,
+ 97,188,223, 45,140,195,196,251, 15,159,178,219, 85,134,105, 98, 89, 42, 79,158, 60,162,180,206,144, 12,237, 57,109, 55, 44,243,
+106,161, 25, 57,124,117, 53,180, 25,213,111,183, 59,183,239,144,222,184,125,231, 38,159,124,245,227,128,176,150,149,216, 18,109,
+ 84, 36, 52,250,206,124,  4,195, 54,146,100, 68,107,161, 73, 52, 33, 82,239,236,171,249,189, 45, 45, 92, 25,232,116, 17,230,106,
+ 97,152, 90, 76,144, 49, 69, 33,110,146,173,  4, 98, 36,199, 74, 93,172,195, 60,201, 64,165, 82, 90,100, 28,187,245,144,207,  3,
+161, 87,130, 90,120,115, 58, 58,161,212,153,151, 94,121,133,243, 71,103,108, 71,227,235,223,127,116, 97, 95, 66, 34, 70,102, 28,
+  3,235,185,237,192, 95,249,216,203,156, 28, 95,227,244,209, 19, 72, 39,196, 80, 73,155,145,105, 58,102,185, 88,200,195,132, 14,
+130,214,206,197,211, 74, 30, 38,210, 16,152,106, 35, 78, 91,230,221,  3,214, 53, 82,134, 61, 95,250,163,223, 99,183, 59,227,218,
+116,100,187,205,214,173,173,160,202,141,227,235,188,246,202, 43, 92,191, 61,241, 51,191,240, 89,222,126,184,242,246, 91, 31, 18,
+100,176, 67, 80, 48,126, 69,171, 29,201, 43,109,113, 14,120,233,  6,101,138,209,250,185,105,195, 32,205,216,  2, 13,122, 89, 65,
+163, 93,150,162,250,103,220,190,160,213, 83,211, 18,212, 32, 43, 90,208,176, 26,111,163, 71,155,200, 37, 33, 13, 25, 74,165, 72,
+ 66, 82,163, 22,155,208,  5,241,247, 31,106, 89, 30,127,135,216, 13,168, 59, 65, 81,157,163,126, 96,122, 91, 85,203, 90, 64, 10,
+162, 44,251,198,119,127,244,  1, 95,248,194, 79,178, 61,185, 78,210,202, 75, 47,190,196,151,191,250, 13,110,159,220,225,231,255,
+149,207,242,224,209, 87, 56,127,208, 73, 40,117,221,219,207, 34,209, 96, 77,126,  8,175, 98,170,226, 20,  5,165,153, 84, 73,149,
+170,133,168,150,223,168,169, 35,205,130, 97, 77, 14, 13, 18, 87, 46,119,251,172,116, 96,208,200,190, 54,178, 40,154,226,213,207,
+ 21, 83,183,137, 21,202,218,108,109, 23, 35, 52, 45,176, 26,238,186,246,110,193,178,161, 19,178, 88,  7,187, 27, 50,185,118, 37,
+209, 41,218, 73,254,200, 13,226, 54,198,110,249,  4, 11,182,205, 36,196,184,143, 78, 36,181, 91,173,255,121,221, 16,176,161,117,
+ 36,155, 94,218, 70,228,201,219, 83,118,131,175,168,173,168,220,194,167,171,101, 80, 66,254,136, 30, 73, 55,177, 74, 79,  6, 98,
+ 49, 61,134,169,172,107, 53,197,177,198,106,207, 10, 55,174,225,147,230,238,232,229, 32,166, 60, 86,  9,132,118,168,251, 85,247,
+ 45,153, 99, 35, 71,203, 95,  5,241,252,121,199,201,118,234,188, 14, 92, 74, 99,239, 37,123, 14,219, 97,203,198,246,122,197, 37,
+129, 78,179, 27,244, 85,101, 60,146, 77, 78,165,133,174, 25, 13, 54,149,106,221,134, 84,205,157,  5, 16, 89, 15, 90,214,110,207,
+217, 68, 12,164, 16,157, 65,174,214,107,108, 62,126,240,158,122,208,230,227, 39,220,153,235,150, 26, 71, 48,210,236, 47,101, 24,
+209, 78,145, 67,149,196,212,145,110,138,135, 96,200,191,238, 65,173, 32,205, 61,196, 22, 86,146, 48,248, 88,197, 30, 76, 77, 43,
+245, 48, 37, 16,155,  2,196, 96, 15,134,216, 43,122,160,240,248,232,195,234,201,217,190,172,171,186, 26,208,  2, 19,210,149,165,
+ 44,180, 46, 76, 41, 80, 90,101,237,182,247, 72, 41, 56, 84,193,170, 52,163,218,190, 78, 98, 50,251,213, 90,104,193, 69, 52, 46,
+139,104,173, 91,253, 95, 93,106, 47,145,237,144,104,106,149,156, 41,102, 79, 79, 30,144,141,254, 24,105,246,165,223,122, 99, 93,
+102,186, 54,114,206, 28, 31,143,164,152, 89,246,123, 74, 49,  5,173,168,112,180, 61, 98, 24,182,108,143, 34,109,189,224,244,236,
+ 41, 41,142, 76,195,192,126, 94,216, 45, 59, 11, 30,250,120, 80,146,241,247,107,235, 12,209,198,244,231,187,217, 30,112, 99, 98,
+ 95, 86,110,132,137,205,148,145, 96, 24,218, 60,175, 44, 40,218,138,219,137, 34,121, 18,250,178, 34, 26,145, 60,144,147,157,202,
+251, 82,216,215,202, 48,108,152,219,202,190, 88,216,173,117, 40,  8,236,247,208, 27,165,194,126,217, 49,239,119, 22, 66,211,230,
+104, 80,123, 51,175,165, 80,215,194,  7, 79, 78, 25,  6, 59,125,158,183,133,122, 81,105,197, 44,106, 65, 59, 83,142,214, 38, 80,
+ 24, 69,252,205,108,159,135, 49, 11, 55,142,224, 51, 47, 14, 60,255,151, 62,205, 48,101,182,227, 72, 41,149, 63,254,118,226,171,
+223,122,135,162,118, 43,159,119,179,  7, 28,133, 24,226,149,124,232,176, 63,106,221,146,244,215,182, 19,159,120,229, 19, 72, 76,
+204,117,161,197,142,200,196, 96, 79,127, 52, 38,100, 80, 66,129,158,253,125,145, 77, 97, 42,173, 18,242,100,212,180,181, 94, 73,
+ 70, 74, 83,179,208,181, 78,111, 43, 61, 36, 66, 30,136, 34, 76, 83, 36,135,228,182,186,206, 13, 25, 88,131,237, 39,135,148,209,
+162,198, 27,143,221, 72,107, 23, 51, 77, 43,155,173,112,237,250, 17,105, 28,168,161,208,119,149,122,217,145, 38, 72, 28,220, 82,
+149,169, 23, 54,186, 95,180,240,236,189, 59,172,203, 76, 30, 97,115, 52,176,153, 34, 83,218, 32, 49,114,150, 26,189,  4, 36, 77,
+188,241,193, 59,124,255, 47,254, 37,239, 61,188,228, 95,253, 55,127,141, 23,110,159,112,255,233, 99, 54, 57,113,255,188,114,255,
+205,111,241,250,159,127,139,164,201,104, 94,193,236, 88, 65,132,220,224, 11, 63,251, 89, 94,126,245,121,126,245, 23, 63,207,245,
+ 27, 39,252,241,239,254, 30,125,169,200,112,  4,177, 18, 82, 96,221,173,212,166,164, 24, 73,161,179,  4, 87,125,214, 74,234,149,
+150, 19,251,176,103,179,102,210,144,216,247, 10, 41, 19,168,158,194, 54, 11, 97,145, 10,210,172,119,221,103,164, 11, 34, 11, 61,
+ 25, 12,164,  6,131,183,196,195, 84,115, 53,218,151,118, 79, 98,247,106,171,145,106, 18,149,214,176,176, 45,209,222, 19,161, 89,
+ 48, 83, 18,181, 86, 98,239,144, 51,193, 27, 59, 26, 26, 42,153,128,201, 63,114,219,240,238,251, 79,121,251,141, 15,249,153, 95,
+121,142,210,148,187,183, 70,222,251, 96,228,242,195, 55,248,149, 47,124,129,111,191,245,128,119,238,255,  9, 25,131,175, 84,231,
+ 74, 36,123, 44,218,119,145,163, 64, 27,208,171,184,145,172,145,  9,180,161, 33, 29, 66,143,172, 93,136, 93,201,217,162, 66,173,
+117, 18,198,200,168,  2,161, 52,246, 84,136,209, 15,201,254, 90,132,108, 45,165,160,164, 46, 36,237,214, 60,104, 54,249, 12, 67,
+242, 80, 86,165, 39, 33,117, 59, 68,175,218, 12,132,164,166,123,238,221, 58,230, 85,108,154, 90, 90,163, 20,131,170, 92,161,108,
+237, 25,233,220, 52,123, 88,151, 67,253,181,118, 11, 76,  7, 75,174,171,119,205,163, 21,220,189,202,102,147,225, 38,226,121,  1,
+211, 71, 87,181, 62,123, 10, 92, 29,194,162, 24,114,182,205,102, 69, 36, 10,201,  9,248, 49, 56,159, 94,149,168,246,190, 45,162,
+142, 97, 63, 72, 82, 20,113,238,132,221,122,195, 21, 61,191,169,173, 47, 67,178,223, 75,  9,120,178,221,228, 91,165,217, 13,218,
+112,252,141,216,131,133,231, 13,254,225, 25, 53,107, 40,129,  5,103,123,112,104, 77, 15,144,220,223,174,234, 77, 13,207,106,116,
+151,221,120,239,191,122,131,236,144,141, 10, 13,107,173, 56, 52, 46, 73, 72, 38, 97,145,238, 15,112,239, 25,251, 13,221, 78, 39,
+214, 61, 69, 12,242, 18,100, 32,118,189, 26,165,212, 90,125, 28,143,141, 27,176,177,182,  5,161, 13, 26,161,190, 75,183,  7,180,
+191, 80,193,126,201,  7, 49, 34, 90,209, 46,238, 47,118,231,119, 48,236, 97, 47, 46,136, 73,209,  3,122,  7,227,146,189,216, 17,
+ 19, 12,180,  3,130, 86,172, 94,166, 21,138,  6,211,233,245,193,156,209,221,189,182,193, 60,242,149, 72, 45,102,114, 34, 22,203,
+  5, 96,163,123,251,240,171,133, 35,186, 33,110, 27,141,144, 44,  4, 33, 93,136,121, 68,164,123,182, 32,144,114,186, 26,247, 27,
+119,224,144,128,180, 27, 92,202,217,210,158, 94, 43, 25,183, 19, 65,  2,203,126, 54,108,237, 58,219,158, 44,140,244,181,179, 72,
+229,198,245, 13,167,231,123,214, 82, 56, 57,217,178,174, 51, 23,151,123,148, 67,208,195,214, 24, 70,111,181,244,253, 56, 68,118,
+203,138,106,119,163,158,141,234,147, 36, 36,139,141,138, 52,178,221,142, 86, 49,146,137, 44,246,128, 13, 65,217, 71, 76,  9, 41,
+216,151,205, 97,198, 85, 27, 15, 31,159,185, 97,201, 12, 66,218,109, 10,178,219,207, 87, 13,130,174,134,125,173,158,174,109,116,
+ 68,237,176, 87, 74,229,242,114, 79,171,141,185, 99,107,131, 86, 89, 75,181,233,141,218,232,115,140,145,107, 83,224,232, 40,115,
+ 60,141,228,  8, 23,115,225,253,135, 23,132, 40,156, 92, 59,230,153,187,183,248,236,231,238,113,237,232,136,208,133,126, 13,250,
+144,248,209,123,143,249,224,137,241,216,151,121, 37, 70, 83, 43,134,195, 41, 55,132, 43, 54,117,  8,129,227,141,240,242,171, 47,
+113,124,235,152,185,237,109,199,218,149, 16,173, 27,223, 53,131,116, 50,202, 58, 40,173, 42, 67, 26, 96, 46, 54,158, 29,133,210,
+ 87,250,162, 36, 79,219,159,158,159, 83,195,200, 52,  5, 82,142,212,139,204, 38,  7,242, 16,144,176, 97,136, 66,169,123, 82, 26,
+144,150, 57, 95, 42,140,208, 16,  6, 12,101,185,246, 25,109,157, 33, 29,243,240,244,  9,219,188,225,222, 11, 47,241,210, 43,175,
+176,191,216,241,254,251,239,115,185, 91, 56,171,123,242,104, 43,170, 90, 43,210, 77,248, 48,164,204, 16,148, 60, 30,241,224,236,
+ 67,110,156, 28,147, 99,102, 36,115,121,121,193,176,189,206,245, 27, 55, 41, 97,143,180,153,227, 33,242,111,253,234,207,242,143,
+127,235,255,227,135,223,252, 51, 94,249,171,127, 13, 41,143,184, 44,149,203,167,231,124,253,235,127,202,249,197,142,113,202,126,
+152, 86,146,  4,150,165,242,217,215, 62,198,223,254,219,127,149,155,215,239,240,211,127,233, 39,249,227,111,191,206,215,190,249,
+ 93,114,204,166,115, 46, 70,236,139,193,214, 71, 75, 41,132, 16, 25,137,212,212,  8,177, 80, 27, 30,160, 11, 84, 10,178, 20, 36,
+ 43,162,  6,242,208,214, 88,113, 59, 89, 59, 48,252, 45, 65,175,162, 70, 52,108,145, 82, 59,227,212, 89,181, 17, 99,182,112,108,
+107,254,127,233,214,  7,239,213, 56,229,106,198,189,142, 53, 43, 74,175,100,207,240, 32,129, 80,234, 85,143, 91,187,  9,168,122,
+240,148, 80,176, 42, 98, 18,203, 94,156, 95,118,190,254,231,111,240,185, 95,250,  5,198,227, 35,230,101,229,103,127,246, 83,188,
+253,198, 19,198,113, 34,135,201, 30,132,254,224,150,226,171, 73,177,160, 86, 12,206,202,168,133, 76,186,170, 87,245,222,233, 61,
+ 32,139,113,226, 27, 21,169, 70,207, 92, 75,247, 84,186,218, 77, 59,  8,210,213, 24, 29, 62, 25,109,158,  1,146,152,109,229, 68,
+ 96,233,133, 93,171,100, 15,136,169,  6, 98, 74,116,141, 22,226, 83, 11,125,117,167, 37,246,213,172,122, 81,146,161, 94,155,135,
+242, 74, 53,107,156, 54, 15, 18, 30,180,168,182,143, 47,116,127,168,217, 51,196, 24, 16,118,144,235,  7, 98,155,155, 56, 83,114,
+ 67, 91,179, 86, 83,239,157,144,178, 61, 87,106,197,190,144, 12, 66,102,207, 28,155, 38,118,  7,207,224,245,226,126,245,  8,179,
+ 74,112, 56, 64,113, 16,130, 10, 33, 53,215,234, 30, 24, 34,166, 13,173,109, 37,165,228,171,102, 27,125, 75,179,207,164,134,  0,
+213,122,248, 68,185,162,165, 70,239,155, 27, 67, 71, 88,187,117,224, 15,109,  2, 61, 24, 53,241, 94,186, 39,204, 74,  3,201,149,
+208,141,211,112, 48,  8,246,110,220,130, 26,  2,117,245, 92, 80,244, 32,164,115, 30,232,129,222,162, 77,124, 61,  0,221, 67, 32,
+ 17, 14,198,151,232, 59,101, 91, 67,137, 58,192, 36,224,255, 52, 39,187, 97,137,107, 27, 81, 20,132,  4,177, 16,163,239, 54, 60,
+ 28, 96,189,250,131, 30,211,217,189,158,  2,183,241,143, 87, 67,104, 87,134,183, 32,  1,180, 82,171,213, 71, 98,192,195, 86,246,
+130, 36,156,235,235,152,189,230, 55,100,  9, 30,224, 11, 88,250,184, 98, 50, 21, 44,181, 26, 49, 90,156,117,237,  3, 18, 50,205,
+229,243, 65,140,246, 22, 90,167,  5, 27,193,116, 49, 76, 96, 45, 13, 17,200,201, 60,181,218, 10, 53, 24, 58, 54,146,157,246,101,
+125,102,105,248,129, 37,153,250,176, 11, 26, 33,135,104,111,202, 44, 76, 10,211,100,191,152,182,174,200,112,228,183, 78,241,160,
+ 29, 68,201,140, 25, 90, 84,144, 72,  9, 43,177,118, 46, 46, 27, 23,151,231,  4,160,172, 51,101, 89,232,205, 70,128,  6,146, 56,
+120,169,109,183, 57,109,182, 86,153, 41,157, 97, 72, 30, 72, 52, 74,154,170,249,130,163,  8,195, 96,183,173, 24,204, 45, 94,189,
+ 66, 88,138,237, 71,131, 40,217, 73, 69, 74, 39, 12,153,107, 17, 46,231,149,214,187,157, 50, 99,100,183,236, 41,243, 74, 41,197,
+122,173,181,153, 94, 16, 12,231,170, 54,121,104,193,198,130,251,181,176, 91, 10, 77,  3,177, 41, 75, 95,108,175, 28,229,106, 63,
+219, 85, 56,187,216,115,243,214, 17, 47,220,189,201,118, 26,  8,  1,166,203, 29, 79, 78,247, 92,206,133,247, 31,158, 49,127,179,
+243,253,247, 30,147, 37,178, 44, 11, 50,100, 46, 47, 42,251, 98,163,211, 86, 26,173, 22, 35,198,137, 31, 60, 85,220,107,175,132,
+152, 56, 30,133, 87, 94,122,142,151, 94,122,158,108,154, 35,180, 71, 82, 50, 92,235,229,126, 53,216, 69,194, 38, 60,  8, 27, 87,
+207,150, 12, 90, 96,109, 98,159,137,158, 88, 91,101, 85,101,233,145,180, 53,200, 81,212,196,148, 64, 54,137,156,196,  2, 48, 61,
+ 81,155,133,107, 98, 80, 36,217, 94, 81,171,210,227, 64,105,139, 33,117,215,142,234,142, 71,167, 15,185,182,221,146,114, 36,111,
+142,104, 33,178,238, 47,104,177,208,150,106,  7,148,100, 56,231,107, 99,164,  4,225,242,242,146,123,183,110,178,157,174,113,122,
+121,206,230,198, 77,226,118, 67, 84,229,230,120,194,121,233, 92,238,247, 44,243,  5, 79, 30,207,164,124,194, 51,175,190,202,223,
+252,187,207, 51, 78, 71,156, 94, 60, 33,167,196,124, 17,121,253,251,223,226,253,119,223, 50, 67,151, 66,202,  3,181, 22,150,181,
+114,231,218,  9,127,231,239,252, 27, 60,243,194, 61, 94,123,238, 99,252,232,221,199,252,230,111,254, 54,215, 82,102, 31, 96, 94,
+ 86, 87,102,  6, 42,145,208, 23, 70, 73, 20, 85,175,232, 84, 40,150,124, 22,237, 70, 12,139,141,208, 64,122,116,166,183, 65, 61,
+162, 70,198, 33,217,195,172,119, 72,  3, 33,172, 76, 49,176, 56,234, 25,  9,148,101,177,  3, 61,137,160,102,107,236, 10,  3,135,
+ 68,182, 16,123,163,214,224, 15, 89,219, 77,214, 90,140,214,136,133,106,161,177,182, 70, 36,145, 67,183,201,137,102, 11,240,178,
+ 56,216,198,190,199,100,200,124,239, 71, 31,112,254,225,135, 60,115,235, 46, 31, 60, 62,231, 99,227,134, 62,192,255,246,155,255,
+132,215,223,120,199,107, 74,141,192, 96,187,211,216,208, 28,232,171, 35,194, 61,248,101, 40,236,195, 77, 83,  8,158,176, 86, 21,
+219,173, 11,204,205,196, 86, 72, 71,101,180,254,123,183,149,101,105, 46,205,  1, 50,166, 81,238, 10, 73,171, 81,231, 14,163,112,
+ 23, 36, 73, 48, 99, 94, 90, 44,159,163,193, 70,201,  7, 76,111, 11,182, 30, 77, 77,161, 46, 38,104, 81, 11, 19,174,118,194, 55,
+175,184, 90,189,236, 80,243,108, 46, 73,  9,106, 83,202, 72,178,176, 94,244,134, 12, 30,112, 68,200,  4, 22,237,118,224, 10,242,
+ 81,128,185,121,170,221,  5,172, 92,221,220, 33, 58, 65,207, 86,104,135, 84, 63, 87,127,110,196,171,105,106, 15, 63,237,130,253,
+241, 62, 13,241, 27,118,215, 78,204,201, 46,134, 14, 27,178, 29,125, 53,138,101, 14,134,  1,143,241,202, 56, 26,156,173,110, 59,
+241,118, 72,166, 89,126,204,106,  8,244,104, 35,254,160,145, 16, 44,249,110, 84,216,  6, 45, 56,152,218,  2,112,246,171, 51,126,
+133, 98,147,165,222,140,185, 18, 98,247, 93,126, 50,130,159,135,  3,175,  2,118,189,144,130, 90,  7,179,119, 51, 78,137, 26,241,
+205, 64, 11,  7, 75,141,221,200,164,  5, 35, 53,181,110, 86,161, 32, 62, 78, 72,158, 92,183,113,150,136,141, 60,241,211, 17,213,
+  8, 79, 33,124,100, 36, 67, 13, 36, 96,141, 52,179,179,105, 87, 36,100,242, 16,252,102, 15, 67, 74, 14,217,143,150, 80, 87, 75,
+166, 30,182,162,170,205, 18,204,189,163, 93,168,181, 26, 28,165,  7,179,244,196,140,180,238,135,134,136,100, 33,  5,136, 61,218,
+ 45, 52,170,211,131,140,240, 35, 18,172,146, 16,236,127,223,123,  5, 18, 67,238,148,165,179, 84,123, 16,104,171, 70,217,171,205,
+119,112,130,106,  1, 49, 37,108, 80, 53, 44,101, 50, 84,107,168, 54,182,243,207,222, 85,199, 48, 96,187, 43,130,178,149,100,142,
+238,218,124, 39,110, 15,192,218,109,218,112,237,228,132, 86,109,135, 29,195,196, 52,116,170,227, 24,113,178, 89,138, 66, 47, 51,
+213,157,200,165,117,146,  7,229,134, 40, 52, 45, 60,189,188, 32,146, 72, 17,166,154, 32,250,161,168,137, 65, 25,180,208,170,157,
+246, 85,188,179,218,237,182, 58, 76, 66,138,  3,219,156, 80,133, 41,192,233,249,  5,235,188, 51,235,158,133,109,201, 18, 41, 69,
+217, 78,137,227,227,145, 33, 26,144, 98,209,149,  7, 79,102,206, 46, 58,107, 93, 25, 36,144,167, 76,148, 64,204,206,184,109,176,
+155, 59,203, 98, 15,225, 90, 10,247, 31,158,145,115, 38, 38,147,125,172,171, 82,151,206,195,229,130,  7,143, 47,208, 31, 28,122,
+157, 86,241, 24,182, 91,162, 88,167,179,121,151,180, 53,131,107,132,232,252,110,135, 58, 36, 81,142,143, 54,220,188,123, 15, 66,
+100, 93,155, 33,126,155,245,131,199,203,202,118, 51, 49, 12,248,225,117, 36,212, 74,149, 78,152,205,123,189, 34, 94, 65, 51,198,
+122,171,149, 46, 66, 74, 27, 98,109, 68, 15,152,230, 40,164, 41, 51,165, 72, 91, 58, 75, 95,201,219, 13,169, 64,237, 43, 61,  7,
+ 66,232, 72,176,132, 60,205,216,219, 83, 78,244,165,176,172, 59,238,220,185,197, 56, 29,115, 52,110,120,251,221,119,157,200,167,
+136,195,111,142, 54, 91, 36, 30,209,150,153,181,236, 41,109,207,115,207,127, 30,137, 35,183,142,174,113,253,248,196,229, 28,157,
+ 16, 35,203,110, 79, 93,206,121,250,248, 41, 31, 60,248, 11,100, 21,138, 44, 28,111,175,243,228,236, 17,  2,156, 94, 92,242,238,
+123,111,241,250,155,223, 51,217, 68, 72, 22, 48,170,230, 96,  8, 10,127,235,215,127,133,159,251,185, 95,226,249,123,183,169, 40,
+191,249,191,255, 54,231,187, 29,219,163,103,200,251, 25,149, 21,141,153,190,218,225, 57,137, 85, 52, 67,239,164, 80, 44,144, 25,
+ 19,189, 45,110,159,138, 72, 76,212,208, 25,186,117,162, 75,183,207,123,  8,145,218,172,254, 26, 99, 48,137, 70,243, 21, 26,157,
+ 36,141,158,162,161, 93, 99,182,239,135,234,208, 36, 85, 10,193,157,230,126, 11, 61,180, 98,192, 45, 95,230,  4,151,152,233,189,
+218,247,131, 65,174,205,180, 21,189,178, 41,  7,126, 67, 50,166,  6,141, 17,225,241,147, 75,190,243,237,239,241,153,207,253, 20,
+ 75,203, 60,121,116,193,171, 47,156,240,197, 40,252,232,135,111,179, 73, 27,187,225,246, 78,151, 74, 78,241,202,  3,177,132,132,
+184, 69, 82,131,101, 15,160, 16,100,164,187, 89, 50,134, 78, 88, 18,107, 48,149,241,  1,105,174,181, 81,180,216,  4, 64,141,207,
+208,187, 53, 75, 52, 88,195, 40, 17, 88,151,197, 30, 56,201, 46, 48, 93,  2, 34,110, 78,155,103,203, 23,137, 73,153,114, 78,244,
+214,232,165,216,224, 59,226,162, 43, 31,249, 54,161,246,118,101, 45,236,181,217,136,185, 91,112,109, 12,216,235,233, 21,105,237,
+ 54,237,236,218,161,122, 88,  9, 37,117, 69,  7,171,200, 17, 44,  7, 97,245, 61,159,104,  4,187, 20,212,106, 42, 86,106, 37,144,
+168,158,121, 32, 66, 47,106,159,239,234,172, 19, 55, 69,166,100,248, 90,227,230, 67, 17,181, 85, 10,130,136, 61, 88,137,253,176,
+ 12,183,223,177,  4,106,107, 68, 53,214,255, 90,237,233, 26,162,253,158, 98,140, 32,134, 67,239, 98,183,229,160,226,211,101,245,
+219,127,191, 34,233, 29,  4,117, 65, 15,127, 23,191, 93,247,112,197, 30,  0, 65,181, 19,181, 91,  5, 15, 91,143,107, 52,158,139,
+144, 12, 14, 20,236,168, 38, 10,107, 48, 38, 31,254,121, 72,138,171, 40,187,177,103,171, 19,184, 98,180,196,104, 88,171,119,161,
+ 29,107,231, 33,163,120,216, 99,168,153,109,122,181,157,136,  4,  3,103,168, 68, 82,138,136, 66, 72,197,194,113,221,110,165,189,
+ 55,  3,239,184,153, 39, 28,198, 49,189, 95,  9,101, 98, 16, 99,165,251, 41, 80, 87,179,210,136,116, 11,155,  5, 83,120, 74,116,
+165,156, 20,219,216,244, 78,110,205, 79,215, 21,218, 74, 11, 25,165,152,148,160,  4,122, 28,140, 31, 31,220,178,213,237,118, 20,
+ 92, 36, 35, 98,111,164, 33,  4,106,179, 15, 86,148, 12,155,200,160,135,137, 67,247,157,136,  5, 70,114,202,148,110,  1, 12,181,
+ 99,153,253, 12, 46, 59, 40,172,126, 88,112, 28,110, 12, 72, 55,172,230, 50, 23,154, 86, 82, 26, 24,178,133, 67,182, 41, 51, 76,
+ 25,  6, 57,128,208,  9, 58, 82, 75,161, 55,168,171,209,228, 74, 45, 52, 58,165,118,127,182,135,171,201, 74,175,202, 52,142,116,
+237,228,113, 36,  7, 11,  3,238,206, 47,109,183, 44,145,121,159,201,201,216,  1,196,200,133,238,201, 49, 16,253, 48, 17,147, 85,
+ 45,186,118,162, 24,124,133,216, 81,215, 80,174,193, 12, 65,183,175,223, 96,165, 19,122,103, 89, 77,131,153,177,196,189,134, 68,
+ 28,237, 65,118,146,182,156, 94, 60,162,212, 75,114,132, 33, 91,170,181,183, 64, 41,237, 96, 18,116,220,174,173, 51, 74, 81, 46,
+215, 64, 88,103,118,187, 98,135, 28, 71, 47,198,136,189,  7, 60,112, 25, 60,100,169,189, 49,215, 66,173,118, 91,136, 34,158,115,
+177,204,  1, 98,163,218,222,141, 76,181,219,207,124,237,235,127,102,117,154,174,164,136,221,166,163,221, 92, 62,253,201, 87,248,
+252,167, 62,205, 78, 45,104,212,235, 66,206,214,123,157,207, 43, 90,171, 77,148,138, 88, 74,190, 43,244, 68,148,110, 35,225,156,
+ 24, 80,138, 38, 98,183,230,129,113,160, 23, 82,177, 20,118,163,160,251,128, 12,137,148,  7, 68, 26,101,223,136, 33, 33, 49,243,
+248,201,  3,234,218, 24,227,200,115,207,220,227,230,241, 17,223,127,250,128,211,139, 66, 41,141,233,200, 42,111,173, 23,110, 78,
+215,120,178,238,169, 42,164, 52,113,237,198,109,222,123,247,148,124,156,168,122, 73, 42,129,186, 68,150,181,128, 10,155,156, 89,
+  7,248,133, 95,248,  9,110,110, 38,222,249, 96,199,233,121, 67,163,178,159, 19, 15,239, 63,230,143,190,252,135, 92,156, 93, 16,
+ 83,178,  3, 94, 10,212,190, 48,164,204,191,251,183,126,157, 79,126,242, 85,238,222, 58,226,230,141, 99,126,247,203,127,198,219,
+111,189,201,209,241,115,236,202,130,246,213,210,185, 75,179, 67,100,116,  0, 85,155, 81, 42, 26, 70, 59,182,213, 56,197,  0,  0,
+ 32,  0, 73, 68, 65, 84,100,180,153, 56, 69, 90,202, 80,204,161,160,189,176,107,157,174,139, 53, 74,106, 32, 36, 71, 35, 99,156,
+243, 84, 76,  0,181, 95,103,243,218,251,195, 91, 43,208,170,175, 90,108,101, 40,161, 83, 61, 77, 30,186,173,244,  8, 43,234, 50,
+143,187,119,239, 49, 95, 60,177,135,164,186,196,138, 78,142,217,255, 25,246,192,164,137,213,128, 17, 91,251, 52, 15,122,210,233,
+ 57,243,135,127,250, 29,126,233,175,188,203,107,175,124,150, 39,167,103,212,165,241, 55,127,253,215,249,214,159,191,199, 15,127,
+240, 22, 67,154, 28,159,237, 43,167,214,136, 41, 18,212,218, 52, 57, 97,117, 62,223,134,198,102,172,122,237,141,238, 46,114,245,
+198,144, 52,236,245,195,106,120,130, 77, 35,138, 54, 55, 93, 38,131,195,168,178, 63,152,193, 36, 64,179,221,172,  6, 23,131,120,
+208, 51,248,120, 88, 69, 89, 90,113, 28,169, 92,137, 87, 52,224, 55,123,243,132,219,105,200, 24,  5,214,169,175, 87,245,186, 53,
+170,177, 23,214,217, 38,117,218, 73, 34, 86,127,236,  7,213, 72, 71, 37,219,218,209, 33, 81,218,173, 89, 35,221, 70,223,221,171,
+204,146, 60,131,141,201,158,232,129,208, 92, 71, 27, 32,144,136,209,190,103, 85,141, 94,216, 14,136, 27,111, 97,101,247, 75, 88,
+163, 43,250,132, 25,211,153, 98, 74,218,238, 78,170, 20,  3,165, 99,202,221,102,  2,153, 16,204, 85, 98,102, 81, 37,138, 29, 20,
+ 57,200,216, 14,187,245,102,174,212,208,213, 66,223,126,176, 82,167,  4, 38,213, 43,200, 77, 23,  8,205, 94,119,107, 41,218,141,
+191,139, 77, 91,  8,163,233, 93,163,241,251,165, 41, 61,139,255, 30,172,161, 17, 67, 32, 94, 59,185,241, 27, 33,  8, 98, 86, 71,
+ 82, 18,115, 55, 39,177,192,154,186,117,167,117,106, 91,253,139, 86,232,158,150, 52,119,116,248, 72,164,113, 64,236, 57, 29,168,
+ 30,144,127, 33, 80,154,237,118, 66, 20, 55,236, 68, 82, 74,164, 56, 64, 23, 39,193, 69, 75, 43,138, 24, 39, 90, 12,200, 97,134,
+ 88,123,226,167,104, 20, 33,107,191, 89,125, 44,244,238,  9,125,187, 57, 73,140,132, 56,144,114,250,232,131,119, 80,227,165, 43,
+101,141, 39, 19, 15,194,146,238,225, 24,175, 35,  8, 36, 25, 72,131, 48, 78, 70,128, 11, 98, 15,186,113,200, 12, 57, 49, 77, 91,
+166,205,214,170, 88,218,201,146, 73, 41, 92,125, 17,224,117,133,224,127,254,225, 32, 96, 99, 68, 27,177,181,106,225,146,186,206,
+ 44,173,210,122,101,119,185,178, 47,157,121,221, 51,239, 86,202,210,153,231,197,160, 26, 34, 72, 78,228,156,217, 76,137,105, 51,
+ 48,108, 50,155, 97,195, 48,216,127,150,243,200,112, 52, 48,102, 11,213,109,142, 54,140,211, 64, 78,  3,180,102,235,  4,137,246,
+197,224,146,  4,  9,205, 94,107,117, 77, 93,176,125, 92,105,205, 87, 35,134,169,109,221,131, 36,173, 49, 47,149,178,118,115,189,
+ 99,181, 47,  9, 66,202,102, 24,147, 20,153,151,194,197,126,101,183, 52,206, 78, 23,158, 60,221, 17,162, 50,229,140, 42,172,189,
+ 83,106,165,148,202,186, 86, 90,179,247,225,176, 73, 22, 42,172, 22,236,217,207,133,203,157,161,115, 77, 11,101,239,149, 36,246,
+128, 48, 20,102,101, 93,138,161, 27,187,237,246,245,112,137,231,224, 78,183, 44, 69,247,176, 92,107,149,101, 93, 41, 75,177, 38,
+ 65, 55,134,126,171,246, 62, 94, 74,161,148, 75, 94,121, 97,226,241,217,  5, 15, 31,159,163,107,161,104,101,183,168, 81,241,146,
+221, 42,204,117,223, 25,210, 72, 19, 11,131, 78, 41,179,221, 36,155,130, 13,145,109, 76, 72, 79, 20,154,215, 94, 13,185,156,124,
+254,148,143, 50, 33, 68,202,170,244,197,  2,131, 45,193,253, 15,239, 83,215, 61,119,239, 61,203,167, 63,254, 83,  4, 85,222,126,
+247, 13, 46,250, 37,195,152,217,132, 45,189, 54,198, 41,115, 52,100,206,231,153,139,178,112,247,198, 61,226,112,196,147,243,251,
+220,126,246, 14,125,182,181,210,152, 70,134, 65,232, 82,104,155, 35,174,221,126,150,178,143,156,238, 50,183, 94,120,141, 40,  3,
+177, 11,173, 52,190,244,165, 47,242,206,219,111, 48, 14,131, 37,253,197,170, 77, 55,142, 39,254,131,191,247,215,249,183,255,157,
+191,203,201,201, 49,159,252,236,171,124,239,141, 71,252,119,255,195,255,200,107, 31,255, 20, 31, 60,188, 36,197,149, 32, 74,155,
+ 27,205,173, 89, 65,213,178, 31,106,123,179, 22,  2,169,155, 99,188,248,154, 47,197,100,252,254, 62, 35,170,200, 24, 16, 18,189,
+ 21,147, 21,133,108, 95,110,209, 76,121,237,144, 64, 46,182, 71,181,181,167,208, 66,161, 55,155, 82, 37,197, 53,161, 94,224,237,
+ 54,210, 21,181, 47,246,170,157,235, 55,182,236,119, 51, 23,231,167, 70, 10, 68,188, 51,238, 15,149,104,125,252,232,227,222,144,
+ 45,204,107,227,101,187, 81,142,211,200,195,199, 59, 78,142, 50,159,251,169,159, 96, 26, 50,203, 90,121,225,249,107,180,  2,127,
+242,141,111,186,160, 37, 16,178,237,229,205, 87,174, 78,227,148,131,103,197,158, 44, 62,198,213, 80,125, 72, 27, 33, 84,162, 90,
+200,179,117,219,241, 54,212,214, 24, 88,133,170, 31,246,218,190, 99,239,221, 42, 89, 65,140, 95, 30,196, 17,166,218,140, 60,215,
+205,136, 22,195,  0,189,185, 16,211,234,163,162,234,146,146, 31,251,123,121, 68,205,170,141,205,166,  3, 52,191,236,116, 91,  9,
+  4,171, 29, 26,146,251, 48,213,140,182,118,208,234, 94,119,223,141,247,238,110, 22,251, 41, 85,187, 77, 19,252,187,178,187, 81,
+ 60,137,181, 80,130,157,173, 12, 85,158,156,174, 30, 35, 93, 44,237, 46, 87, 59,252,224,218,235,195, 65, 77,124, 77,124,168,199,
+ 29,246,243, 54,238, 15,213,130,173, 26,241,245,144, 58, 95,222, 46, 64, 42,118, 11, 63, 28, 72,240,  0, 91,112,137,142, 98,  0,
+ 27,155,152,216, 45, 93,124,100,255,209,179,172,163, 26, 61,144, 46, 87, 74,103,107,206, 56,165, 46, 28, 56,239,205, 95,244, 70,
+ 52,154,155, 61,240,187,143,245,197,107,227,189, 18,159,187,253,204,111, 68, 63,105, 85, 21, 79,104,219,104,221, 92,180,217,133,
+ 41, 54,154, 21,  9,164,104,149, 41,  3,215,116,211,164,138,125,160,130,  4,174,202,105,205,198,182,173,154, 43, 60, 96, 55,109,
+220,182,211, 93, 42,208,213, 45, 52, 46,219,  8, 41,255,216,  3,209, 70,210,146, 50, 49, 37, 11,230, 72, 66,194,225,129,157, 17,
+137,164, 97, 36,229,129, 60, 38,114,140, 36,177, 96, 87, 76,150,237,138,158,144,143, 49, 57,170, 52,147,134,137, 28, 44,108, 19,
+252,228,222,138,221,182, 75,117, 87,121,239,172,235,225,148,218, 13, 59,168, 86,237, 11,209,160, 22, 67,136, 52,109,228, 33,179,
+217,100,162, 36,134, 33,177, 29, 38,114, 74, 70,171,139,193, 58,163,  8,217,223,100,104,180,218, 90,245, 53,197,161,167,216, 29,
+225,232,193, 24,220,235,222,106,167, 84, 88,150,133,253, 90,152,151,197,121,206, 66,142,131,237,206, 83, 32,165, 72,206,118,  8,
+ 25,198,129,205,118,228,218,141, 45,155,109,102, 24, 71,198, 60,144,115, 36, 39,203, 35,152,166,212, 78,190, 81,130, 77, 27, 56,
+140, 23,237, 38, 29,179,  5,  0, 45, 64,168,164, 28,157,174,214,137, 98,163,124, 28, 50, 44, 33, 58,160, 33,145, 98,186,146,238,
+  4,141,236,231,133,148,236,203,182, 52,211,202, 62,115,115,195,189,219, 27,182, 83, 98, 59,154, 79, 64,226, 96,237,133,181, 49,
+142, 38,118, 41,173,218,184, 60, 37, 15,168,224,156,  3,203, 11, 44,139,189, 70,211, 48, 92, 17,181, 98,140,108, 54, 27,174, 95,
+ 63,230,217, 59, 39, 68, 26, 23,151, 23,118, 99,195, 30,224, 34,145,113, 24,201,195, 96, 31, 52,103, 52,183,214, 93, 11, 25, 56,
+189,152,121,227,157, 71,124,247,187,111,144,250,194,175,253,235, 47,179,137, 35,223,250,206,251,236,246, 59,246,187,133,203,203,
+133,203,101,161, 84,181,137, 87,239,164,112,196,144,  2,199,155, 13, 61, 10,219, 65, 24,243,192,144, 51,105, 51, 16, 11,228, 49,
+ 51, 78, 38,106,105,173,217,200,115,112, 63,130,  2, 41,162, 77,121,255,253,119,200,227,196,203, 47,189,202, 52, 28,115,255,254,
+135,204,243, 25,121,237,228,184, 97,217, 45, 72,236,164,148,121,122,177,178, 46, 11, 89, 58,159,122,237,115, 60, 93, 78,185,118,
+ 77,184, 57, 93,163,117,229,104,179, 37,228,129, 46,240,250,119,127,192, 63,250, 71,255, 43,251,243,251, 60,247,236, 11,156,220,
+125,142, 24,149,109,158,120,116, 49,243,149, 47,253, 33,223,248,198,151, 33, 88,  7,116,147,172,134, 39,146,248,236, 79,254, 52,
+159,255,185,159,225, 51,175,189,200,167, 63,255, 25, 30, 62, 85,126,227,191,249,  7,236,158, 60,225,198,245, 59,124,255,  7,223,
+227,214,205, 91,172,197,252,246,146,  6, 11, 72, 81,188,119,189, 18, 83,134,218,209, 30,145, 56,184, 49,180,163,107, 35,132,217,
+170, 69, 98,224,151, 90,149, 97,204, 76, 98, 15,133, 22,130, 25, 17, 75,181, 44,129,217,235,233, 88,211,162,187,108,170,  7,188,
+ 86,107, 15,124, 73, 70,218, 54,  8,138,117,187,155, 54,203, 93,168,141, 90, 79, 79,159, 56,156,200,146,238,129, 96, 92,251,131,
+  1, 59,102, 91, 85,106, 32,165,132,228,100,240,161,  0,210,  3, 75,133,167,143,238,243,153,215,158,229,206,221, 23,120,116, 62,
+243,225,  7, 15,120,245, 99, 47,242,238,251,143,121,243,237,247,201, 67, 54, 56,144,123,195,179,216, 94,183,118,159, 86,225,246,
+ 73,191, 43, 71, 85, 75,220, 87,191, 32,248,173, 58,133,108,227,115, 95, 79,212,102,214, 68,235, 80, 91, 93,181,170, 50,  8,196,
+156, 44, 12,139, 49, 20, 98,200, 14,104,233,190,187,183,236, 77,117, 27, 27, 93, 63, 58,176,184, 88, 70,122, 39,133, 64,  9,234,
+160,169, 70, 10,  7,223,121, 50,  2,105, 53, 96, 78,247,174, 55,218,174,210,229,226, 19, 47,187,236,218, 69, 76,125,133,125,184,
+108, 73,240, 78,121, 56,172, 87, 61,  4,121,160,150, 58, 28,198,214,235,209,141,162,206,120,144, 67,248,206,194,110,250,227, 66,
+ 21, 14,198, 80,  7,  7,137,248,234, 23,151,141,245,171,144,243,193,222,214,186, 56, 99,196, 30,168, 90, 61, 68, 43,225,106,237,
+152, 83, 64,179,175,164,253,191, 11,206,193,176, 56, 63, 62,178, 55,249, 10, 87,223, 98,110,117,107,  7,121,145, 67,149,  2,172,
+173,217, 84, 88,108, 98, 29,197, 14, 35, 34,110,216,235,230,169,144, 32, 54, 25,209, 64,186,115,235, 24,109,149,181, 26,210,178,
+ 87, 11,170,173,181,208,131,208,187,197,250,163,255, 67,237,152,102, 95,132,150, 64, 55, 81,130,246, 78,202, 25,  9,214,107,108,
+206, 87,111,221, 74,122,221,249,190,  7, 72, 16,221,110,220,218,236,131,167,206,137, 55,196, 94,178, 23, 68, 45, 85,172, 98, 41,
+249,  3,145,142,208,108,236,175, 22, 36,232, 18,220,142,147,  9,201,247, 25,234,129, 27,183,162,201, 96,  8, 65,141, 98,163,151,
+ 26, 32, 70,130, 12, 76, 77, 92,112, 96, 15,114,173,141,218, 42,  7, 37,113,107,157,178,204, 70, 53, 74,129, 44,214,141,157,253,
+231,203, 18,209,168,246, 69,157,124,112,149, 51,169,175,180,181, 33,105,240,176,158,218, 88, 53, 84,234,186, 90,111,221,223, 52,
+  6, 37, 80,170,  6, 74, 45,132,208, 12, 75, 24,237,144, 34, 64, 72,201,130,105, 26, 44, 68,120,112,123,123, 87,114,213,106,111,
+ 91,181,196,122, 16, 51, 45,  5,  7,200, 72, 74,132,212,153, 75, 67,162, 65, 17,164, 31, 68, 15,126,235, 64,169,210,137, 85,232,
+150,229, 48, 59, 82,115,168,207,144,144,214,145,100,154, 70,213, 68, 43,149,148,  2,210,162,217,220,176, 21,132, 12,134,129, 13,
+109, 36,134,138, 74, 99,187,221,128,108,237,198,208, 12, 27,121,114,107,224,232,104, 34,107, 36, 75,231,254,227, 83,126,248,246,
+142,243,179, 83,186, 42,147,102,122, 91, 61,191,225,191,115,199, 78,198, 96,127,201,121, 89, 89,215,194,241,181,235,108,143,142,
+120,242,244,145,213,250,242, 96,230,165,214,217, 28,109,217,157,159, 90,235,128, 64,140,145,107,211,214,250,182,142,104, 77, 81,
+104,213,132, 31, 49,167,171, 41, 19,170, 60,125, 50, 51,151,194,241,241,200,231, 63,245,113,190,247,250,135,220,188,153,121,114,
+ 89,  8,181, 19,115,160,247,200, 50, 47,180,139, 11, 19,178,196, 75,246, 99,102,222,239, 45,216,217, 96, 24, 19,113, 18, 84, 50,
+ 89, 18,153, 70, 91, 23, 36,193,120,124, 68, 42,145,194,194,118,136,172,161,162, 18, 41,187,133,182, 22,182,195,214,164, 62, 23,
+143,184, 88,206,208,121,225,250,241,  9,143,247, 59,208,194, 52,108,153,107,161,176, 39, 13, 35, 83,218,160,203,204,254,236,156,
+231,159,127,  1,237,145,113, 27,205, 28, 72,161, 46,149,219, 55,111,144,214,133, 27,195,204, 51,183, 54,188,245,222,  3, 54,199,
+137,249,113,225,139,191,255, 59,252,225, 31,252, 83,114,138, 87, 13,138, 60, 77, 92,236,247, 60,115,231, 38, 39,121,195,242,112,
+225,197,159,248, 56,223,254,206, 27,252,215,255,213,127,203, 15,190,241,103,252,218, 95,255, 27,252,224,141, 31, 17,116,239,235,
+  8,243, 18,164,218, 24,164, 83,187,173,160, 84, 51,171,174, 72, 82,106,141,116,113, 25,203, 82,168,165, 18,153,208, 94, 60,213,
+126, 72, 76, 79,212,193, 28,220,177, 69,251,114,245, 41,157, 51,172,237, 38,216,172, 11, 78, 24, 89,203,130,150,134, 38, 67,111,
+150,186, 90,218, 90,131,145,214,154,237, 91,  9,137, 90,149,205,246,216, 90, 42,221, 70,197,126, 87,116,168,  8, 46, 32,241, 93,
+123,180, 29,188, 54, 59,248,106, 54,202,219, 52, 13,188,245,254, 25,255,226,203,127,202,209,157, 23,249, 39,255,244,247,249,238,
+ 31,127,157,255,228,223,255,123,124,225, 47,255, 44,223,121,243, 45,118,103,123,  3,153,116,187,217,149,106,  2,150,134, 77,104,
+114, 18,234,106,205,145,174, 22,136,235,171,225,179, 37, 98,123,106, 34, 61, 84, 66,109, 46,169, 18,  2,  6, 49, 10,210,201, 98,
+104,214,224,220, 11, 61, 44,119, 85,253,112,189,216,119,138,189, 41,232,180, 43,132,114, 15,205, 31, 60,225,163,116,187, 26,147,
+163,117,215, 43, 87, 39,120,162,166, 84, 22, 23,179,  4,211, 31, 75,197, 32, 63, 46, 86,234, 26,208,190, 16, 98,178,125, 51, 70,
+213,139, 62,153,181,218,184, 81, 62,137,238, 33,209,128,228,128,150,110,  1, 50, 95, 37,106,131, 40,  6, 29,194,109,127,218,244,
+ 42, 16,169,142,118,165,117,107,154, 96,239,147,160,  6,125, 82,196, 14, 19, 33,217,107, 89,173,  1, 17, 66,184,154, 20,  4,  2,
+ 18,197,246, 13, 29, 84, 26, 17, 87,201,214,213,173,105, 38, 60, 11,221,118,232, 42,253,234,246,109, 56, 87, 67,235,232, 97,191,
+168,246,103,116,177,  3,137,118, 11,  9, 30, 14, 61,182, 62,242, 90,121, 59,136,120, 44,117, 31,124, 90,110, 85, 58, 27,205,247,
+110,217,174,160,145,248,194, 43, 31,255,141,148, 38,146,100,226,118, 96,179,177,189,238,118, 19,125,167,168,100,245,108, 94,211,
+195,103,230,199,198,  8,209, 84,131,146,200,142,221,148, 40, 76,155, 13,155, 49, 50, 13, 98,163,193,209,176,178, 73, 32,121,141,
+ 45,137,144,197, 78,100, 33, 68, 11,167, 89, 93,207,186,146, 65, 93, 28, 96,196,174,224,144,252, 31,179,227, 26,129, 46, 88,144,
+175,174, 43,189, 22, 90,239,118,179,109,118,184,104, 65, 61,153,104,181,143,238,163,151,214,171,227,255,  4, 82, 70, 37, 34,105,
+ 96,220,108, 25, 55, 71, 12,227,134,163,209,198,215,227,144,152,134,204, 56, 77,164,152,217, 76, 91,134,144,174,106,  4,218,172,
+226, 84,150, 66,213,198,110,183, 99,222, 91,223,189,119,101, 89, 87,127,147, 57, 61,239,160, 23, 12,126,250, 34,144,163,173, 61,
+198,108,  7,131,148,128,117,161,213,149, 86, 87,202,186, 58, 67,192,161, 24,193,254,236, 40,201,195,131,217, 71,104, 16,135, 12,
+152,109,170, 87,245, 83,240, 97, 26,208, 76,167,234,167,226,232,188,250, 48,136,113,159,233,134,126, 69,124, 92,109,219,187, 94,
+ 61,213,143, 77,  3, 66,176,215, 36, 13,145,237, 48,146,198,200,102, 72, 54,173,136,198, 31, 24, 36, 56, 40,196,209,140,193, 14,
+ 87, 49,218,237,  2, 17,246, 43, 92, 92, 42,167,151, 38,208, 41,205, 79,184,209, 80,151,225, 64,187,116,189, 96,215,143, 56, 10,
+ 10,142,231, 92,153, 54, 19, 41, 10,231,231,231,148, 82, 44, 52,216, 11,165,216, 33,170,107, 99, 89,246,150,204,119,125, 98,206,
+217, 12, 94, 41, 26, 71, 57, 70, 19,206,164,241, 42, 48, 42,193,194, 80,  4,187,217,157,237,102,214,167,167,252,228,107,183,185,
+126, 99,226,253,247, 47, 40,  2,251,101,161,173,110,159,146,102,175,219,193, 97, 64,167,175,133,178,206,180, 94,185,208,198,178,
+ 44,212,165, 49,207, 51,231,187, 29, 23,251, 74,111, 43, 23,187, 75, 86, 79,100,247,181,146, 98, 98,183,158,241,225,123,247,217,
+ 30, 31,115,235,230,117, 68,132,179,203,115,180,  4,246, 33,178,212, 61, 18,221,  5, 17, 35,227,198,118,108,119,239,221,227,246,
+221,123,236, 47, 87,142,175,141, 12,106, 83, 23, 81, 16,217,240,193,163, 83,174, 61,115,155, 95,254,229, 95,166,230,235,140, 39,
+247, 56,127,240,144, 15,222,249,128, 47,254,193,239,243,181, 63,249, 35, 90, 41,196,108, 21,205,105, 72,172,205,110,221, 71,227,
+  6,213,153,218,  2,239, 63,216,241, 15,254,251,255,137, 31,124,243,107,252,103,255,249,127,200, 59,247,103,190,250,245,175,242,
+226,203,175, 48, 12, 27,171,  5,165,136,134,106,114, 13, 43,139, 91,210,124, 87,140, 86, 23, 44,180, 91,181,208, 43,196, 56,209,
+ 84, 41,218,220, 68,104, 77,149,210, 86,107, 98, 52,187,213, 74,176,207,112,169,213, 61,  8,216,216,190, 22, 63,148, 55,171,196,
+138,  9, 88, 68,172,237,163,221,140,133, 30,  5, 54,208,145,167,170,115,180,236,201,188,187,180,203, 74,116,177,103,176, 96,157,
+248,103, 80, 57,228, 99,240,157,172,209,223, 66, 52, 65,204, 82, 10,143,159, 92,114,190, 15,124,249,143,254,132,235,229,130,219,
+ 39,  3, 15,206,207,120,243,157,199,212,181,147,131,143,201, 69,109, 28,110,114, 79,167,198, 41,197,191, 91,212, 67,177, 77,149,
+ 68,240,253,172,179,233,253,150, 73, 15,222,105,110, 87,233,250,165,216,244, 65,162,121, 11,174,252, 28,222,120,178,189,190,151,
+201,163,  5,223,172,168, 20,175,246,212,118,179,  7,135,179, 91,163, 64, 18,173, 25,228, 69,253,182,221, 14, 54, 74,223, 21,119,
+ 15,170, 30,164, 41,158,214, 51, 98, 29,  7, 43,156, 29,212, 53,216, 61,218,  8, 94, 78,183,139,198,205,  8,120,126, 42,134, 43,
+225,104,240, 85, 95,243,139,159, 93,143,108,237,123, 56,134,117,111, 92, 93, 97,206,131,175, 17,187, 29, 18, 99,178, 41,109, 14,
+225,144,169,247,218,118,248,104,122, 44,150, 95,104,197,198,237,162,118,225,233,222,194,138, 73,174,192,100, 66, 68, 91,160, 57,
+204, 44,224, 83,162,  3,247, 61, 90,229, 77,131,175,170, 29,151, 30,154,229,209, 16,117, 56,155, 79,131,174,170,224,126, 70,194,
+ 14, 42, 33,122, 38, 64,140,246,168,158, 87, 75, 40, 73, 91,115, 82,173,133, 45, 90, 72,118, 27, 11,145, 52, 89,228,191, 87,131,
+135,116,239,244,169, 90, 34,185,246, 70,237,149,165,122,192, 64, 43,146,109, 28,222, 83, 38,202, 64,198,246, 70,162,141,177, 29,
+  0, 50,246,197, 44, 18,160,154,121,167, 25,219,195,100, 10,218, 89,107,183,174,100,182, 61, 67,148,136,102, 11, 58, 36, 95,128,
+ 28, 12, 74, 34,202, 64, 36,142,214,137,110, 14,132, 17,177, 36,177,193, 75,250,  1, 76, 76,244,125,  6,221, 32,130, 41, 85,  3,
+175, 52,219,247,205, 33,121,213, 67, 40,190, 67,145, 52,144, 36,209, 83, 96, 84,103,  0,231,196, 32,141,218, 18,173, 86, 66, 18,
+122, 93,141, 34, 55,100,123,104,183,238, 42, 81,161,174,133, 50, 95, 50, 19, 13,200,210,154, 87,184, 64,242, 72, 11, 17,161, 58,
+230, 54, 16, 36,177,221, 70,214,214,141,179, 79,163,214, 25, 84, 40, 85, 72, 26, 89,103,165,230,193,214, 25,205, 79,200, 34,196,
+ 93,164,209, 25,220, 20, 23,115, 96,196,199, 84,146,  8,201, 70, 68, 80, 17, 77, 38,142,108, 70,175, 34,  8, 65, 19, 33, 43,172,
+ 92,125,248,123,235,244, 82,232, 10,235,170,150,187,136,118,176, 40,232, 85, 71,120,200,  3,155,113, 36, 68,200, 89,104,205,216,
+253,117,153, 45, 85,170,129,162,133,117, 54,231,115,161, 99,240,175,236,157,213,149, 60, 38,238, 28,221, 50, 48,140,195,122,138,
+118,122, 81, 55,  6, 86,214, 90,172,  7,239,163,179,218,236,139,172,180,149, 97, 24,156,192,228,208,  8,173,156,159,158, 51,215,
+149, 90, 42, 18, 19,170,202,110, 93,152,198,129,160,233, 42, 44, 10, 78,213,114,237,240,218, 42,219,237,150,222,149,214, 10,247,
+ 31, 46,252,246,191,124,157,147, 23,110,176,174,249,234,134,101,233,229, 25, 29, 34,210,  2,210, 58,227, 48, 49,175,  6, 19,218,
+140, 16, 71, 97, 95,149,113,177, 94,239,254, 96,173,138,193, 48,203,123,159,224,236, 50, 49, 86, 82,140,196, 38, 60,122,248,136,
+ 30, 34,215,175,221, 32, 13, 91,154,154,180, 39, 75,160,148, 83, 11,106, 46,157,216,149,179,253,125,114,156,200,219,137, 79,124,
+226, 51,204,  5,174, 95,223, 26, 12, 99, 92,217,132, 35,100,200,124,231, 47, 94,231,127,254,135,255, 11,165,238,249,143,254,227,
+191,207,221,187,207,240,230,183,191,195,229,126,199,131, 15,223,225,219,127,246, 21,230,101,111,185,149, 82, 24,134, 13, 26, 51,
+109, 93,184,118,124, 68,105,202, 91, 31, 62,226,131,211, 63,229,247,190,244,  7,104,223,241,139, 95,248, 85,230, 53,243,181,175,
+255, 11,110,223, 56,225,218,201, 93,160, 90, 27,100,113,175,117, 86,122, 18,106, 89,161,194,241, 56,178,246,149, 90,171,125,177,
+138,171, 36,123,115, 14, 67,179, 16, 80, 27, 93,163,169,164,230, 25,138,222, 13, 69,141, 29,238, 91,251,232, 38, 26, 67,160,174,
+ 54, 50,149,209,177, 94, 53,163, 67,160,246,110, 46,241, 81,104,205,254, 21,116, 53,250, 92,133,152, 97,123,237,152,199, 79, 30,
+ 48, 56,134,154,222, 81,137, 38,231,104,234, 20,176,206, 50, 23, 86, 86,130,  4,246,101, 33,199,192, 52,108,137, 81,216, 76, 27,
+222,250,240,156,231,191,247, 45,254,139,127,239, 95,227,238,115,183,249,222,251, 79,248, 63,126,235,159,243,230,143,222,230,227,
+ 47,222,229,115, 63,253, 42,127,241,131,167,156,158,239, 44, 68, 27,130,103,  2,212, 14, 64, 34, 72, 93, 80, 73,246,220, 21,203,
+148,212,110,151,162,230, 94,140,160,  9,201,246,157, 99,123,121,168,117,143,134,238, 50,146,240, 81,104, 52, 24, 14, 89,253,159,
+111, 29, 52, 99,138,160,209,250,252, 62, 32,214, 67,227,168, 27,213,206,  2,167,209, 62,111, 24,197, 83, 27, 22, 68,246, 48,155,
+207,211,174, 70,233,  7,240,138, 65, 27, 77,217,170,192,210,171,181, 10,162,129,201, 90, 53,180,140,197,218, 32, 84,123,160, 18,
+108,157, 27,101,240, 74, 53, 31,193,115,196,179, 44,174,169,197,181,201,168,113,223,  9,129, 33,186, 95, 36, 88, 91,162,249, 65,
+176,118, 72,217, 97, 68,213,242,213,150,181,112,138,160,103, 45, 44,204,157, 76,122,150, 45,144,108,153,  4,161, 59,163,160,225,
+211,131,222,175, 96, 59, 68,191,128,169, 87, 37, 91,191, 26,186,247,230,213,239,106,244, 79, 21,203, 46,133,116,144,  8,153,214,
+ 86,187, 18, 15, 98, 33, 17,243, 96,248,  1, 54,  7, 88,123,181,112,187,218,228, 56,197,132,209,147,218, 65, 74,226,106, 69,199,
+248,181,110,238, 96,122,100, 72,135,206,121, 39,231,129,214, 87,214,101,182,125,135, 22,123, 33,131,217,133,116, 87,153, 67, 36,
+166, 68,210,232, 53, 46,161,210, 40, 33,146,163,221,132,242,  8, 73,236,151,217, 91,101, 89,133, 46,157,105, 85,138,218, 91, 66,
+186,193, 96,106,183,219, 90,116,  9,135, 25,173,108,223, 22,213,236, 86, 49,155, 79, 86, 60, 97, 89, 90,101, 72, 70,149,171, 77,
+127,140,110,151,136, 57, 59, 84,167, 19,200,244,104,187,  1, 75, 38,154, 66, 16, 17, 36, 84,122,233,236,214, 83,106, 83, 46,162,
+ 89,109,210, 48,145,228,163, 42,149,250, 78, 36, 68, 71, 30,180, 78, 26,162,117,226,117, 96, 24, 26, 89,142,169, 10,173,154, 56,
+164,251,234, 67,219,130, 58, 74,177,234,161, 98,214,136, 41, 49, 14, 35, 34, 86,173, 11, 30, 52, 17, 63,249,133,222, 25,  6,104,
+165, 80, 68, 77, 10, 80, 10,161,175,104,107,204,  1, 87,242,217, 77,103, 28, 45, 96,151,242,200, 40,  1,146,239,155, 66,190,178,
+205, 73, 80,164,118,250,106,137, 98,165, 17,186,216,116, 33,224,189, 82,123, 61, 91, 43, 70, 69,242, 67, 89,163, 17,206, 22,219,
+107,141,137, 33,103,198,236,191,151,105,195,148,173, 86,148,202,192,118, 18, 72,202, 90, 23,202,188, 90,215,117,109,172, 68, 54,
+ 57,162,209,118,246,169, 87,104,137, 34,193,130, 60,189,160,  7, 27, 82,181, 67, 83, 41, 22,142, 91,107,165,247, 13, 90, 45, 15,
+ 33, 13,134,110,164,166,165, 54, 74,169,118,152,114,233, 77, 95, 87,114, 74,140,163,221,208, 47,119,123,154, 86,203, 56,168, 82,
+ 74,115,164,166, 29,134,134, 28, 57,218,108,217,110,183,124,229,107,143, 25, 54, 71,196, 20, 73, 34, 12,211,132, 12, 70,248, 10,
+  4,246,125,165,119, 27,243, 73,175,180, 54,216,195,131,206,130,  9,101,232,149,165, 20,215,123, 54,138,216,222, 50,132, 66,237,
+  6, 96,138, 77,185,120,188,243,123,136,176, 61,222, 80,231, 29, 37, 88,202,248, 56,111,169,107,167,247,202,233,147,135,180, 90,
+184,125, 50,112,188,217,112,237,218, 45,222,248,214, 55, 88, 47,159,114,116,239, 99, 76,155, 72, 28, 71,246,203,158,156, 42, 47,
+222, 25,121,252,193,  3,158,190,243, 22,247,238, 62, 67,173,157,215, 95,255, 62, 95,249,227, 47, 49,175, 59, 35, 32,250, 45,168,
+248,123,245,230,241, 13,238,220,122,134,135, 15, 62,160,246,194,122, 57,179,206, 11,175,190,116,143,235,119, 95,226,183,254,159,
+223, 97,190, 56,229,167,126,254, 47, 19,105, 84,111,151, 24,133, 59,  2,  3,185,175,104,136,180,  1,230,213,136,146,141,192, 24,
+ 19,181,153,220, 36, 73, 99, 76, 80,212,  2,147,115, 89, 73,105, 32,116,152,203, 74,140, 91,171, 28, 29, 26, 60,  7,113, 70, 56,
+172,248,140, 78, 22, 98,167,214,104, 32,144,  8,172, 21,  9,149,148, 35,133,110, 30,243,110,245, 71, 66, 71,226, 64,107,202,245,
+ 27, 55, 25,134,247,204,216,150,140,113, 97,129,165, 72, 69, 41,101, 79, 40,182, 20, 60,218,100,142,166, 27, 12,219, 27, 92,156,
+ 63,102,183, 59, 37,229,137,152, 50,121, 16, 30,158,159,242,202,167, 62,201,245,123, 47,242,143,191,248, 15,121,235,237,119, 89,
+230, 83,206,206, 50, 39,249,211,220,190,117,147,211,211, 11, 36, 14,254,192,245,208,154, 20,  3,185,  4, 51,246, 73,104,190,127,
+ 55,167,184, 95,208, 12,190,115,136,235,  7, 76, 16, 83,237,161, 39,110,183, 68,108,141,103,172, 15,171, 84,169,138,165,196,219,
+ 33,  7,229, 96,160, 96,120,230, 36,118, 61,140,174,138,181,155,178,162,165,218, 35, 91,205,113,161,216,231,154, 24,205, 25, 17,
+236,150,220,181, 95, 41,118, 91, 56,236,152,253,144,  4, 12,142,137,181,138,176,208,197, 89, 36, 81,  8, 61, 16,180,122,190,200,
+ 87,129,161, 57,142,220, 98,165,173,169, 93, 80,154, 79, 59,162, 99,131,125, 58, 96, 63,170,210,162,137,203, 56,  4,255, 14,114,
+ 49, 76,174,210, 48,  6, 62, 26,253,126,172,168,216, 74,195,134, 14,  9,161,160,193,114, 47,  1, 99, 96,200, 16, 29,234,117,213,
+ 87,179,215,199,  1,107,138,161,102,163,231,165,172,217,234,127, 30,157,226, 97,205, 68, 50,145,173, 31,228,122,112,134,127,117,
+ 97,138,131,133,104, 80,117, 37,  4,171,120, 95, 37,238,125,196,161, 40,169, 20,165,137,221,142,  7,181, 90, 64,199, 30,168, 21,
+144, 48,216,141, 78, 43,165, 21,114, 16,154,116,119,200, 70, 98, 28,237,193, 28,  5,137,142,  1,109,118, 58, 94,218,194,186,174,
+172,107,114, 78,109,240,209,151,176,186, 91, 59, 73,118,101,157,125,145,135, 81,200,  1,242,198, 32, 18,170,150,102, 20,109,110,
+136,243,234, 29, 74, 12,209,130,119,216,201,217,244,142,246,112, 12,217,  2, 55,162,234,230,156, 72,204, 32, 41, 24,212,192,251,
+225,150, 82,172, 68,237,104,140,182,147,160,179, 16,220,127,110, 95,164, 67,234,136,102,151,221,219, 38, 75, 84,105,107, 49,168,
+127,204,214,225, 84, 35, 78, 73,176,180,168,214, 98, 48, 21,233,104, 21, 66,182, 84,104,151,200, 24, 45,252,167,201,126, 97,  1,
+251,121,107, 55, 70,113, 95, 26, 75,171,212,102, 59, 55,241, 81,243,188, 46,128,250, 13,179,113,186, 24, 37, 46, 37,177, 48, 18,
+145, 32, 13,212, 66,134,118,  2, 94, 81, 85,246, 43,236,163,144, 66,178,118, 65,182,157,116,206,137, 32,209,242,  1,162,100, 17,
+198, 41,217, 13, 18,171, 97,137, 40, 77,  3,235,186, 90,239,218,123,190,130, 18,166,104, 19,148, 98,111,114, 51,131, 21, 11,244,
+133, 67,215, 18, 82, 22, 98, 10, 12,155,209, 14,137, 93,153,226, 68,220, 38,162,  6,142,183, 48, 47,213,129, 13,118,234, 93,246,
+  1, 77, 48, 58, 49, 16, 54,244,181, 83,  5,116, 99, 39,242,169, 55,178, 88, 13,178, 21,123,157, 36, 89,157,169, 84, 59, 52,238,
+231,217, 68, 59, 93,168,173, 80, 90,161, 84,245, 96, 95,134,104,129,196, 82, 43,227,176,181,208, 96, 90, 56,222,110, 56, 26, 34,
+215,143,111,113,253,250,  9,121,216, 16,162,189,231,247,203,158,181,217,216, 53, 21,104, 37,208, 82, 38, 71,187, 65,  4,233, 76,
+211,200,148,237,247,160, 29,  7,143,  8,161, 41,125, 76,180, 93,101, 35,134, 46,174, 29, 22, 10,171,192, 20,132,161,102,118,235,
+142,203,121,207,181,163, 13,147, 88,197,242,244,201, 57, 15, 30, 63,228,198,201, 49,131, 14,148, 82, 24, 68,121,239,205,119,184,
+115,247,  5,142,111,220,227, 11,191,248, 11,188,247,222,155, 60,124,250,136, 65,  7,214,245,156,163,126,211,171, 65,145,107,215,
+ 78,248, 79,255,254,127,201,230,248,136, 55,223,125,200,143,254,226,117, 62,252,224,109, 62,241,226,200, 27, 63, 56,246,224,226,
+192,  7, 31, 62,102, 55, 47,108,162,175,202, 34,156, 93,156, 82,235,250,255, 51,245,102, 77,150, 93,231,153,222,179,166, 61,156,
+147,115,214, 60,  0, 69, 76, 44, 12, 28, 10,224,  0, 18, 32,  4, 18, 18, 73, 81,162,220, 33, 65,164,228,110,187,237,112,203, 86,
+132, 35,252, 27,116,103, 95,116, 71,216,173,107,119, 72,106,169, 29,150, 40,117, 91, 82,107,104,113,  4,  8,176, 69,  2, 36,  5,
+ 98, 44, 20,128, 26, 80,168, 41, 51, 43,167,115,206,222,123, 77,190,248,214,201,226,  5,131, 17, 12,146, 85,200, 60,103,239,181,
+190,239,125,159,167, 16, 28,101, 18,240,233, 79,126,130,159,188,245,  6,155, 55,175,112,246,225,143,162, 92, 67,  8, 81,110, 68,
+ 97, 38, 99,101, 99,200,105, 74,239,229, 32, 62,148,228,176, 83, 74, 14, 56, 33,161, 26, 11,193,  8,253,208,213, 84, 42, 51,120,
+217, 33,203,139, 35, 99,147, 34,134, 94,146,237, 41,202,237, 48, 43, 76, 40,224, 18,  6, 57,184,149, 70,168,166, 92,191, 85, 32,
+101,143,197, 10,107,163, 15,104, 91,201,222, 30, 69, 54, 86, 52,159, 49,224, 70, 21,163,197, 37,246,182,110,161,172,145,177,111,
+ 89,127, 69, 50, 49,120,106,231,104, 27,121,121,  7, 31, 96,232, 24, 47,174,147,194,148,189,157,125,252,208,161,173,227,237,203,
+187,252,225,127,248, 91, 78,158, 61,195,115, 47,252,132,173,141, 45,156,213,220,184,221,241,206,165, 27, 44, 44, 31,193, 85,154,
+140, 36,245,115,136,146,239,209,101, 52, 30, 51,232, 65,166, 90,101, 76, 61, 31, 61,171, 82,210,182, 90,158, 29, 57,121, 33,207,
+ 41,209,187,166,210,199,182, 74,198,194, 68,161, 40,102, 43,232,235, 52,103,111,204,215, 89,101,186,104,115,150, 10, 85,249,204,
+ 73,102, 78,152, 27, 58,151, 23, 16,136, 77,179, 28, 38, 84, 20,247,134,190,211,196, 21,188,152,146,172, 79, 32,224, 52,  2,238,
+ 73, 89,  4, 45, 90,160, 93, 30, 73,243,163, 10, 69,143,112,224, 26,145,127, 98, 85, 80,172,134,228, 59,225, 37, 96,100,231,108,
+101, 71,173, 82,198, 72,160, 72,160, 95,197,122,173, 35,229,121,194,129,233, 19,149,101,173,226,229,217, 54, 15,248,102,162,236,
+226, 85,121,167,193,193, 65,  5, 35,214,210, 74,  9,226, 53,251, 44,237,233,121,130, 94, 33, 13, 32, 74,144, 45, 75,150, 74, 27,
+ 93,100,230,154, 33,203,103, 95,147,202,164,  5, 17, 60, 41, 85,188,  8, 89,106,124, 41,149, 49,123,201,179,105, 35,211,129, 36,
+125,250,164,132,152,170, 16,105, 15,200,148,218,206, 98,194,101,139,211,138, 62,  9,141, 74,176,179,178,171,210,185, 39,151,142,
+175,195, 16,203,130,211,216,140, 78,  6,135,193,186,146,148, 87,169,220,228,196, 42,230,178,140, 12, 66,  2,223, 69,124, 14,  4,
+ 15,222,203, 73,198,104,139,169, 42,193,233,105,133, 31, 76,129,206, 40,140,115,212,165,254, 34,198, 52, 73, 91,107, 19,161,178,
+ 16, 75,253, 65, 73,184,194, 88,129,183,  4,239,138,132, 70, 78,165, 85,170,  9, 40, 66,204,212, 70,146,170,209, 10, 49, 40,135,
+ 80,240,122,153,161, 72, 34,170, 74, 70,217,118,214, 19, 74,128, 33,  6,232, 84,249, 16,231,  2,156,176, 53, 86, 41,140, 74, 36,
+ 37,192,253, 20, 66,  1,254, 43, 44, 21,198,229,131,132, 42, 66, 54, 44,192,150,204, 48,247,247, 90, 71,107,231,235, 38, 85,250,
+241,194, 18,183, 77,164, 14,189,236,165,124, 46, 83,  9,133,181, 37, 57,169, 20, 41, 11,111, 62, 38, 17,214,232, 92,128, 54,186,
+162, 42, 99,203,160, 29,163,197, 17,163,113,131, 10,210,193, 54, 57,225, 99, 70, 69,177,187,129,103,214, 79,  8, 81,234, 32,  3,
+ 48,157,150,209,146,173, 48, 42,209, 54, 21,170, 46, 52, 62,196, 42,150,131,112,  2,138, 88, 15, 42, 73,210,166, 20,  5, 57, 75,
+  2, 29,165, 71, 58,239, 14,251, 76, 55,244, 76,165,133, 75,229, 28, 90,105,156,211, 84,149,194,213, 13,174, 18, 83,148, 73,153,
+214,198,  3,146,159, 83,153,104, 44, 97,  8,164, 65, 51,228,249, 77, 56, 17,145, 92, 64, 93, 37,114,  0,109,101,135, 24, 82, 66,
+103,195,200,247,164, 36,189,236,156,115, 89,211,248,162, 23,150,135,101, 99,150,241, 37,112, 20,162,103,177, 26, 83, 85, 53, 85,
+109,137,  9,118,103, 51, 84,223, 51,114, 22, 74,242, 55, 67,  1,251, 40,178, 49,216, 28, 72,161,  0,111,140,198, 79, 39, 56,101,
+168,235, 10,173, 13,227,166,161, 50, 14, 87, 67,212,137,145, 19, 98, 79, 21,149,144,205, 36,217,135, 82, 10,107, 28,187,187, 59,
+ 68, 50,163,209,136,182, 54,108, 93,251,128, 43,239, 95,102,117,109, 65, 36, 42,126,134,211, 21,201, 26, 78,157, 62,131,182,150,
+221,205, 27,188,117,233, 38, 59,183,174, 19,125, 67,178,137, 81,213,178,191, 51, 99,103,127,155,172,106,250, 97, 96,230, 59,210,
+254, 14, 55,175,109,241,234,207,126,198,219, 23, 94,227,127,253,159,127,139, 71, 30,220,226,149,243,151, 88, 95, 61,204,210,226,
+ 42, 23, 46,190, 75,136,208,180, 11,  4,239,241,179, 41, 40,169, 49, 37, 63,240,149, 95,250,101,246,252,136,119,222,190,192,153,
+ 51,247,112,228,240, 73,186, 56,224, 92,  3,253, 64,101,148,132, 79,135,136,170, 13, 89, 71,166,222,147, 83,166,209, 21, 26, 67,
+ 80, 50,126, 87, 67,148,135,173,133,174,235, 75,234,218,144,140, 40,121, 83,180, 16, 34, 73, 15,100, 79,209, 12,203,141, 48,147,
+176,  9,250, 24, 24,140,224, 97,133,193,175,136, 67,143,169, 32,103, 67, 63,  4,156, 86,  5,124,149, 74,133, 78,110,119,177,132,
+188,234,164, 89, 93, 93,101,127,123, 75,110,176, 37,123, 18,178,140,174,157,214, 56,235, 14,166,154,125, 14,204,118,183,105,204,
+ 62,218, 74, 94,100,152, 69, 24,228,182,249,237, 23, 94,101,250,220,203,236,109,109, 21, 14,129,140,111,187,157, 61,150,215,214,
+137, 94,126, 70, 90,207, 15,128, 94, 38,136,229,165,166,178,240,225,125,136,104,171, 17, 46, 27,101,143,156,136, 73, 21,120,149,
+228,149,162,146,195, 14, 37,147,148,146,176,213,117,  5,217,107,  8,145,160, 37,104, 76, 40,  4, 54,100,228,166,140, 97, 40,180,
+ 74, 19,  5, 13, 45, 50, 36, 89,119,198, 40,249,135,156, 15, 18,182,114,153,211,186,220,126,239,132,189, 84,206,104, 11, 33,148,
+138,155, 22,229, 51, 74,161, 92,217, 25,151,218, 94, 42,183, 82,202,247, 74, 21, 94,123, 34, 30,224, 81, 29,243,177,183,100,  3,
+ 82,121, 15,228, 36,217, 38,101, 53,248, 50,129, 45, 47,119,156,157,151,101, 74,157,215,146, 99,209, 99, 23, 33,203,252,165,175,
+203,242, 64, 57, 45,220,127,149,136,165,190, 22, 83, 18,164,110,169,241,233,194,163,157,135, 46,165, 62, 23, 15, 98,221,202, 88,
+212, 28, 24,166, 11,163, 68,131, 15, 94,  2,222, 89,214, 31, 89,139, 55,133, 40,  1, 56,157, 36, 48,158,146, 63,104, 28,  8,157,
+ 85,198,249,115, 96, 18,165,180,168,231, 40, 90,192,206,102,145, 92,205, 37,238,243, 84,160,149,211, 83,214,228,212,147, 18, 68,
+ 93,164, 42,194, 82,148, 38,234, 17, 71,  0,  0, 32,  0, 73, 68, 65, 84,222,105, 10, 56,109,105,138,153, 39, 41,153,247, 99,164,
+144,175, 82,148,148,105, 20,155,140, 43,227,161, 92, 66, 30, 41, 75,161, 63,196,140, 15,133,116,104,196,108, 19, 58,208,206, 82,
+ 85, 50, 30, 18, 68,162,252,239,135,174,103,230, 75, 21,201, 24, 17,  2, 16,233, 82, 36,107, 67, 85, 21,248, 68, 82,210,103,204,
+ 26,173, 51,170,106,104,172, 17,235, 87,234,241,101,204,174, 11, 64, 69,231,136, 33,177, 52, 90,164, 90,144, 19,217,144, 61,201,
+  7, 98,148, 83, 91, 84,153, 28,228,165, 26, 98, 34, 24, 71,229,156, 88,210, 84,102,200,170,104, 53, 69,106, 18,173,124,241, 98,
+206,100,163,168,157,195, 25, 77,157, 61, 54,107,  6,239,165, 90, 84, 96, 43, 42, 41,170,186,150, 21, 67,242, 76,186, 76, 82, 14,
+167, 34,117,213, 98, 17,242, 88,176,134, 48,235,165,215,157,198, 64, 36,204,  2, 73,103, 66, 10,248,217,192, 20,121,177,145,193,
+247,145,201,254, 62,104, 25,169,143, 70, 82,171,170,106,203,130, 86, 56, 99, 56,172,  5, 77, 88, 89, 67, 55, 27,  8, 36,186,105,
+199,108, 38,249,137,236, 51,193,207,196, 52,164, 65,  5,105, 28,204,199,217,198, 89, 32,  8,218, 19, 39,187,167,152,208, 86,163,
+162,194,212,146,110,143,115, 57, 80,202,114,176, 83, 82, 77,201,222, 51,244,242,247,173,113,146, 38,245, 10,219,212, 18,156,244,
+ 14,227, 12,217, 70,124, 81, 61,154, 40,112,144,218, 72,183,123,150, 18,218,100,108,173,209, 57,211,135,132, 77, 50, 61,176, 77,
+ 77, 74,134,169,151,196,106,165, 45, 49, 88,114,233, 62,135,228,113,174, 46, 85,171,128, 70, 38, 22, 51,223,211,167, 64,239,  3,
+170,239,112,198,209, 25,241, 92,155,162,236,236,180,150,181, 70,237, 48, 73, 82,214,  1, 33, 89,169, 32,245,160,212, 75,224,116,
+179,235, 48, 86,254,124, 93,105, 42,107,  4,142,169, 43,178,  9, 50,180,139,146,148, 77,202,211, 79,247,228, 64, 90, 85,232,186,
+226,202,251,151,185,118,253, 58,199, 79, 63, 70,211, 44,176,123,123,143,202,120, 76,237, 48,227,  5, 90,179,128,182,134,183, 94,
+251, 25, 41,  6, 22, 23, 22,120,224,161, 15,179,184,188, 66, 99, 50,123,211, 61,246,124,194,172,142,152,236,237,113,249,157, 15,
+120,229,149, 31,243,214, 27, 63, 99,152, 13, 92,120,239,125, 62,242,216, 71,121,241,229, 55,  8,195, 22,207, 60,245, 17,158,250,
+212,135,249,119,127,250, 45,218,186,102, 58,204, 27, 50,  3, 74,101,238,185,251, 52, 33, 91, 94,124,225,187, 28, 59,116,152,187,
+239,121, 64,124,  9,198,146,213, 64,204, 30, 93, 41, 42, 47, 55,149, 62, 72,112,201,101,217,139,245, 97, 86,106,156,141,172, 30,
+178,151,106,149,105,  8,106,134,141,229, 69, 26,122,  1, 43,  5,  1,217,248, 33,201,243,170,236, 87, 35,153,108, 68,191, 44,173,
+ 16,241,106,231, 36, 64, 30,173,101, 69,150,138,169, 81,114, 24, 65,160, 34, 74,198,174, 41, 10, 93,204, 40, 69,242,145,118,180,
+128,107,218, 50,129,147,113,114,140, 17,171, 13,174,178,165,238, 84,158, 31, 74,234,110,125, 24, 32, 12, 98,214,117,  2, 34,234,
+102,251,236, 13,189,160,102, 11,125, 76,151,253,252,214,100,198,194,100, 31,172,166,113, 53, 67, 47,129, 88,103, 44,129,  3, 52,
+  8, 57,107, 84,249,179, 84,128,172,101, 90,165,138, 60, 43, 35,181, 51,225,141,103, 84,214,178,187, 46,116, 76, 95,198,248,185,
+224,154,201, 25,147,140,172, 18,181,102, 72, 65,212,202, 90,145,163, 48,241,149, 22,151,132, 46,194,174,148, 50,131, 14,  7,149,
+172,148,138,172, 42, 73,200,111, 30,212,149, 91,107,121,105,106,197, 48,  8,179, 93,101, 69,240,146,153, 80,  5,137,106,140, 92,
+235, 83,200,  5,227, 45,183,107, 14, 68, 48, 97, 94,186, 66,155,249, 36, 83,203,193,165,136,200, 72,114,187,206,  7,196, 78,196,
+ 88,151,131, 48, 75, 10,206, 54, 43,141,214,197, 41,167,231,212, 66, 69,246,197, 43, 80,116,217,206,200,164,200,163,165,169,161,
+178,144, 77,209, 37,240,108,202, 42,180,176, 90, 40,218,238,210, 46, 80, 73,194,108,150, 68,151, 18,149,147,164,127,204,241, 14,
+162,156, 44,136,215,232, 81,161,116,225,115, 89, 71, 43, 57, 88,104, 85,  8,168,101,117, 45, 12,123,141,213,  6,147, 35, 62,114,
+135, 92,167,228,240, 99,125,223,163,114, 44, 32,156, 40, 55, 48, 93,201,126,220,  8,194, 81, 41, 57,137, 68, 82, 49,239, 20,170,
+154,118,120,147,233, 20, 34, 49,201, 10, 93, 60,193,209,104,185, 13,163, 36,140,161,148,236,237,109,141,113, 70, 94,250,  5,184,
+175, 24, 24,  6,185, 57, 65, 38,100, 33,225,232, 74,118,193, 10, 35,100,161, 40,117, 20,227, 52,181,129, 48,100,188, 15,162, 61,
+ 12,130,200, 11,  4, 72,150,136,224, 15, 13,  1,149, 29, 89, 69,166,179,142, 61,235,168, 91,141, 65,164, 47, 46,103, 73, 60,107,
+ 57,249,170,172,152, 13,  1,111,107,156,203, 40, 42,218, 70,118,169, 81,201, 38,196, 26,176,214,144,166, 61,183,247,118, 64, 25,
+156,210, 12,169,194, 25, 75,101, 53,169,239,152, 70,193, 33,206,166, 72,119, 57,  6,250,126,134,199, 48,100,  9,145,229, 24,  8,
+123, 19, 66, 86, 24,107, 48, 70,246,124,139,109, 77,213, 84, 56,171, 14,254,126, 58, 57,178,201,164,228,208,206, 98, 22,199,228,
+152,177,206,226, 44,  7,118, 36,171, 52, 67, 55,197,251,129, 62, 36,246, 59, 79, 55,243,101,244,169,240, 67,199,246,230, 30, 49,
+120,105,  7,164,132,182,182, 96, 88,101,239,229,140, 19,189,171, 53,168, 88,224, 63,165,179,174,180,212, 64,106, 37,201,246, 46,
+200,  7, 62, 13,101,167,103,133,251,188,183, 43,  4, 44,107, 29, 10,131, 30, 12,149, 21, 44,112,214, 10,227,180,  4, 36, 83, 66,
+ 59, 67, 78, 96,173,184,176,251,217,128,214,208,251,140, 11,226,187,175,219, 90,254,251,131,132,121,116,101,168,202,216,139, 82,
+151,169,131, 28,212,230,225,185,218, 54, 50, 34, 76,153,156, 60, 58,  5,198,166,150, 17,156, 81, 40,151, 24,188,156,132,137,208,
+117,  3,179,105,143,247, 34,195,152,139,105, 80, 37,148,153, 18, 51,100, 31,107,116,241, 32,151, 22,134,177, 61,182,115, 12, 86,
+ 86, 33,202, 73, 26,185,210, 22,141, 56,166,157, 53, 36, 21,169, 76, 81,201, 70,216,153,193,108, 95, 86,  3, 67, 24,232,166, 83,
+134,224, 25,215, 13,139,109,205,246,116, 66,109, 23,216,219,159,176,188,190,206,120,188,200, 93,199, 45, 97,128,237,110, 87, 60,
+  4,170, 34,231, 26,147, 18,219,211, 45,  6, 15, 33,121,114, 14,140,155,154,241,234, 58,110,121,141, 35,199, 79,112,216, 39,174,
+223,188,142, 73, 29,111, 95,127,133, 31,189,252, 67,222,122,227, 39,132, 24, 56,121,236, 52, 57,181,140, 71,135,168, 43, 67,223,
+237,241,242,171, 23,120,248,236,125, 44, 47, 54, 44,182,153,163,203, 75,224,  3,221, 16,232,178, 97,117,101,157,127,252,193,143,
+168,109,230,222,143,125,148, 33,104, 82,246,100, 15,202,120,129,117,100, 77,202,  3,170, 77,152,153, 28,242,117,209, 84,106,171,
+136,157,199,106, 75,118,146,  8, 78,125,128, 90,223, 49, 66, 26,228, 57, 82, 58,193,115,127,  4,133, 35,145,148,112, 45, 84,202,
+101, 90, 85, 52,151,193,139, 73, 78,219, 66, 16,211,228, 28,228,176, 20, 13, 38, 43,178, 81,133, 17,144, 15, 62, 71, 90, 27,169,
+105,229,204,120,188,200,222,206,150, 28, 60, 99,144, 16,171,149, 21,202, 92,187,153,116, 66,103, 93, 46,125,138, 20,  6, 98,138,
+ 56, 39,207,210, 46,244,248,190, 63, 72,112, 11, 44, 75,118,183, 27,187, 19,150,119, 59,106,140,152,  4,179,244,171,125, 12, 40,
+ 39,163,213, 92, 52,161,181, 50,248,249, 68, 66, 33,150,200,130, 97,197,231,131, 86, 76, 72, 17,165,101, 26, 71,  1,201,200, 20,
+209, 73, 86, 39,201,152, 56, 70,153, 50,200, 74, 38, 74,214,200, 64, 82, 81,194,113, 65,110,209,185,200,199,115,154,251,222,231,
+144, 42,185,165,235,164,203,116, 42,150,186, 45, 63,167, 49, 53,100, 60, 54,149, 26,174,214,197,161, 62, 55,230, 69, 97,102, 88,
+ 57, 52,196,178, 51, 55,133, 18, 25, 75,248, 87, 75, 20, 92, 86,  4, 41,161,181,147,188,143, 49, 66,247, 83,194,135, 32, 75,104,
+151, 60, 39,229,204,155,  9, 90,170,213, 57,201,237,183,212,240, 76,116,133,133, 96, 14,110,217, 49, 69, 97, 24, 32, 18, 22, 98,
+ 62,104, 79,145, 51, 22, 33,109,162, 51, 41,150,122, 97, 73,215, 43, 10,213, 83,101,161,108,234, 50, 37, 17, 50, 70,185,152,201,
+ 74, 36,104,185, 93, 23,235,107, 89, 49, 73,190,193, 18,101, 69,233, 52, 41,202,133, 43,246, 30,147,100, 82,148,202,219, 51,229,
+ 80,234,152,178,144, 80,167,238,249,112, 54, 90, 78, 80,226,184, 77,  7,200,185, 92,250,122, 74,105, 41,214,151, 19, 32,197,206,
+ 38,136,198, 59, 21, 15,173, 12,218, 89,225,198,103,197,250,250, 58, 31,125,244,163, 60,244,192, 89,142, 28, 62, 84, 66, 87, 20,
+ 67, 80,102, 50,157,114,233,226, 21, 94,127,253,103,188,245,206,121,116,148, 93,204, 16, 11,242, 83,137,140, 67,200,197,130,157,
+149,138,148, 35,167,142, 97, 54, 72, 53, 66, 25, 98, 12,101, 20,147,231, 87,126,140, 21, 25,137,213,242, 80, 79,  7,169,120, 97,
+175,203,254, 89, 17,181,193,150,  9,130,176,194,  7,148,169,168,140,128,100, 76, 86, 24,155, 24,114,194,152, 26, 83, 25,170,218,
+146,125,192, 26, 73,161,103,157,  8, 24,156,177,180,149, 33,244, 61,  3, 18,  0,145, 52,106, 58, 56,121,186,148,233,147,244,224,
+173, 49,164,126,160,239,123, 33,178,145, 25,124,162, 15,  9, 99, 52,181,171,203,111, 58, 10,248,  6,133,171, 29, 99,215,148,118,
+128,162, 29,  9, 91, 61, 19,169,170, 22,165, 51, 67, 63,224,208,104, 35, 34,139,105, 63, 16,122,143, 31, 60,218, 58,122, 63,197,
+119,145,206,  7,102,179, 25,147,253,125,209, 42,102, 43,137, 80,171,203,110, 76,203,184, 41, 38,140,213,165,198, 17,240, 65, 81,
+ 85,182, 36, 90, 51,181,181, 56,163,101,231,229, 12,181,214, 36, 95,220,194,218, 20,130, 82, 65,  8,147, 11,204, 72, 10,  7,206,
+218,114, 29, 17,153, 66,109,229,159,119,  8,178,206,177,133, 34,152,172, 34,118,  2,148, 73, 70,246,122, 37, 54, 88,152,236, 50,
+209,169, 52,130, 20,206,114, 83, 10, 49,  8, 86,179,232,114, 99, 49,180,149,245, 23,120, 45,147,162, 66,236,154, 77,103,116, 19,
+143,143,153,193,123, 98,105, 84,196, 32,137,226,172,101,119,167,149, 34, 27,169,103,234, 36,233,219,108, 68,197,106,140,162,209,
+ 26,109, 13,206, 84, 18, 14,210,138,202, 57,154,186, 33,196,158,217,172,103,103,127,198,100, 50,195,144,168,202, 21,195, 20,192,
+201,225,229,241,  1,125, 42,250,196, 80, 84,188, 90, 41,108,211,112,232,240,  9,148,111,233, 98,192, 15,189, 96, 38, 81, 12, 97,
+202,224, 21, 62,244,204,166,123,132,105,143, 87, 50, 73,168,154, 49, 77, 61, 34,171, 76,173, 45,157,223,230,234,213,107,104,173,
+233,246,119,120,248,227,143,177,176,176, 66,220,189, 69, 55,219, 98, 50,237, 24, 66, 64,145,104,156, 84, 94,109, 85,113, 98,109,
+140,211,138,189,125,185,197, 93,186,181,201,209, 67,135,136,213,152, 65,141,104,236,136, 16, 61,202, 89, 65, 27,167, 40,160, 12,
+227,201,185, 38, 40, 80,193,203,109, 62, 75, 24,201, 84, 18,190,212,  5,243,156,229,217, 79,236, 61, 73,151,151,110,  8, 68, 45,
+  1, 40, 91, 18,218, 33,  4,162, 10, 56,167,165,171,156, 33,101, 77,204, 65,218, 28,242, 67, 20, 29,174,149, 81,242,188,194,104,
+100,172,136, 85,154, 16,134, 82,195, 50, 37,116, 20,176, 90,113,123,111,194,181,247,223, 41,191, 23,249,110,160,140, 40,171, 53,
+ 88,227, 14,118,186, 26, 25,161,135,144, 80, 57, 50, 90,104,153,204,122,182, 54,183, 74,160, 86, 62,191,149,115,160, 52, 85, 61,
+194,217,192,177, 99, 71,169,236, 10, 62, 37, 66, 30, 14, 30,252,115,215, 10,115,169, 73,169, 94,205, 79, 19,166, 36,193, 67,148,
+239, 66,138, 82,221, 21,135,  3, 69, 48, 34,104,100,165, 50,217,184, 34, 54,146,207,115,244,169,104,115,101,255,174,178,176,199,
+ 67, 44,224, 35,209, 51, 21, 52,172, 76,104, 85, 78,229,239, 36,135, 94,241,182, 43,230,229,240,172,228,103,175, 74,221,139, 40,
+149, 65,135,172, 61, 83, 97,158,228,226, 56, 80, 37, 50, 96,230,117,179, 44, 50,169, 68, 98,174,146,154,175, 39,141,150, 44, 79,
+ 98,110,191, 44,225,179,108, 11,190, 90, 66,127, 42,  7, 57, 12,228,140, 53,142,156,230,141, 34,133, 41,211, 12, 95,198,251,146,
+155, 18,219,165,209,  5,108,149,181,100,110,178,164,241,253, 32,  8, 96, 37,243,121,169,  5,102, 11, 58,150,138,224, 29,168,135,
+153, 35, 75,165,  1, 92,158,234,101, 13, 81, 66,241, 62,201, 74, 40,  5,233,207,199, 82,169,212, 90,214,120, 42,103, 42,147, 10,
+ 92,205,130, 21,183,135, 31,  4,227,155,202,164, 67,154,136, 34, 88, 55,218, 18, 82, 70,157,188,235,129,172,202, 62, 92, 30,184,
+ 82, 87, 72,209, 31,148,238,181,154, 83,126,228,131, 75,  9, 56, 25, 93, 48,121, 90, 42,113, 41, 68, 76, 45,251,224,143,127,236,
+227,124,249, 75,191,200,161, 67,135,121,253,141,243, 92,186,124,137,141, 91, 55,217,221,157, 82, 85, 21,135,143, 30,226,204,233,
+211, 60,244,208,131,180, 77,205,143,126,252, 18,207, 63,255, 34,123,187,251,114, 19,214,170,240,201, 35, 67, 63,224,189, 40, 19,
+  5,207,104, 48,  6,252,180, 35,168,140,210, 66, 82,211,161, 36, 58,181,220,168,141, 81, 40,211,128,145, 52,178,206, 65,170, 26,
+165,223,167, 11,112,102,  8,101,210, 16,197,126, 35, 82,178, 40,112, 26,101, 80, 73, 30,  6,186, 16,130, 20, 86,198, 67, 38, 83,
+ 25, 49,184,161, 83, 57,169, 90,218,166,130, 20,232,252, 64, 42,190, 93, 97,245, 88, 49, 63, 41, 65,205,186, 81, 77, 21,133,127,
+172,221,220, 42, 23,153, 13,  1,147, 29,117, 45,159,134, 33, 39, 20,  3, 49, 43,186,169, 39, 27,249, 38,132, 32,187,118,171, 10,
+ 39,222, 21, 76, 97,202,  4, 20, 78,215,  7,245, 14,107, 53,214, 36,134,137,208,182, 34,153, 62, 38, 92,150,147,113,232,123,118,
+ 39, 61,211,153,168, 47,109,211,144,162,167,155,204,  8, 49,201,  3, 50,202, 67, 88, 35,253, 78, 31,188,104, 40,173,208,143,180,
+134, 33,  8,155,223, 22, 32,142, 66,128, 34, 86, 43, 76, 18, 10,151,177,229,103,140, 84,213, 84, 86,132,129, 98, 23,211, 84,149,
+147,244,106,169,170,152,242,  1, 54,186,149, 73, 66, 78, 12,190,199, 24, 35, 99,167, 36, 95,240, 65, 71,156, 21, 97,133,182,138,
+186,106,193,102, 44,208, 58, 71, 46,220,130,206,223,  1, 27, 73, 71,182,220,144, 74, 30, 34,165,128,137, 48, 16,136, 62, 18,134,
+129,105,231,241, 83, 47,161, 25,114,169,166, 72,130, 53,204,111,  4,148,250, 98,121, 40, 10,111, 62,203,193, 74,101,153,230,100,
+ 69, 55,155,146,135,158,170,178,184,202,208,214,142,165,165, 17, 75,227,154,145, 19,170,223,168,182,124,232,244, 73, 94,121,239,
+ 22,227,202, 72, 16,174, 18,233,199,254, 48, 33, 37,203, 82, 51,130,148,209,166, 97,175,243, 92,219,218,197, 71, 47, 43,173,126,
+198,180,155, 48, 12,129, 97, 24,132, 37,173, 10,133, 12,161,242,229,172,104,234,138, 67, 71,214, 89, 94, 24, 99,117,162,169,107,
+198,173,102, 58,141,212, 77, 77,223,117,244, 67, 79,229, 12, 93, 31, 88, 28,213, 50, 61,114,150,165,229,  6, 19, 51,157, 79,132,
+ 33,176,223, 71, 90,171, 88,104, 90,250,106,137,168, 23,240, 64, 55,120,178, 87, 24,203,129,144, 72, 35, 21, 69,163,156,224,126,
+149, 70,231, 72,152, 91,  4, 17,132,105, 74, 74,116,155,128, 79,153,232,131,  4, 60,139,211,115,136,  2,109,202, 58, 80,169,242,
+ 50,143, 81,254,140, 18,238,138,177,112,200,131,172,228, 84,249, 46,162,147,216,248, 10, 56,  4, 21,201,126, 78,160, 19,232, 74,
+109, 97,115,107,143, 43,239,191, 71, 91, 85,160,165, 50, 84, 54,199,133,185, 96,133, 52, 39, 87, 58,124, 20,180,118,219,140,232,
+188,231,246,246, 22,209,135,131,  3,176, 49, 90,160, 72, 10,140,169, 73, 49,112,248,240, 42, 75,171, 71, 81,200,120, 63,165,132,
+113,146,  7, 24,202,196, 64, 37,129, 70,101, 93,216,234,166,132,247, 68, 66, 46,122,224, 84,224, 96,  6,114, 18,165,172,182, 98,
+168,204,243,155,181, 96,245,200,161, 28,121,138,241, 50,147, 80,214, 22,217, 87, 16,  5,119, 44, 90,219, 52,223,111,103, 14, 98,
+220,229,223, 66,246,196, 36,107, 78,149, 98,161,172,201, 63,131, 51,134,140,200,119,180, 41,191,183,249,174,188,220,228,173, 17,
+113,146,211,  2,255, 81,102,126,187, 46, 41,115, 69, 49,202, 21,186, 94, 81,129,103, 85,100,237, 86, 36, 45, 34,248, 74,194,225,
+ 64,250,237,218,164,242, 62, 83,  5,196, 35,221,246, 84,246,230,243,231, 50, 81,126,102, 33,153, 66,102, 51,165, 94, 29, 73, 74,
+ 17,186, 68,206,  3, 90,  9, 94,155, 57, 37, 87,240,129,114, 72, 41,173,  2, 61,151,120,205,139,109, 86,201, 51, 53,  9,139, 32,
+102,201, 62, 97, 51,209, 75, 93,206, 40,153, 80,162, 82, 33,212, 41, 26, 43, 23, 88, 77, 81,107,207,233,135,  8, 32,141, 98, 54,
+ 85,165,245,164, 83,194, 39,241,203, 75,  9,223,232,162, 18, 45,225,  8,165, 15, 82,137, 20, 82,153,153,135,161,226,124,230, 89,
+ 70, 67, 81, 18,177,214,201, 56,235,241,207,126,154, 95,249,213, 95, 97,115,115,147, 63,255,139,191, 32,122, 56,121,234, 56,107,
+203,203, 92,185,122,141, 55,222,124,147,119,223, 57,207,139, 25, 14, 29, 94,229,115,159,253, 12, 79,124,230, 73,214, 86,143,240,
+141,191,248,255,216,223,217,198, 88,176,166,132, 73,172,197,202, 16, 94,106, 62, 67, 95,146,220,131,124,136,245, 64,202,154,202,
+ 84, 24,103, 49,202,224,180,212,241, 72, 51, 82,  7, 89, 89,172,158,187,219, 11, 72,167,132,153, 20,138,232,229, 38,236,140,189,
+131,116,213,  8,160,  6, 73,139,146, 10, 34, 81,107,218,170,198,167,129, 62,123,108,146, 73,135, 16,220, 50, 81,121, 65, 31, 26,
+112,214,200,  8, 76, 91,154, 74,161,130,103,210,  5,  9,207,117,157,236,164, 34,  5,156, 34,230, 49, 87, 59, 82,147,233,186,112,
+128,237,117,198,202,237,160,146, 17,188, 49, 14,211,119, 66,112,211,224,149,199, 69, 67,  8,224,115,162,178,114,219, 51, 70,110,
+213, 74,183,120, 99,160, 50, 44, 54,224,103, 51,226, 60,249,237,160,173,199, 44, 46,180,248,126,160, 31, 98, 57, 52, 88,186,198,
+225,131,199,135, 72,223,121,200,138, 33, 12, 36,148,116,193,231, 35,176, 44,107, 26,135,104, 31,149,146,154, 93, 78, 50, 66,236,
+162,220,250,181,202, 40, 91, 38, 28,133,216,104,172,193,186,132,117,181,124,201,172,194, 79,  7,145,202,168,140, 79,  2,126, 80,
+ 54, 98, 93, 57,169,199,132, 45,211,  1,231, 28, 57,103, 90, 93,161,237, 29,239,192,108, 38,193, 28,149, 34, 83,229, 49, 90, 30,
+144, 49,105, 90, 43,216,218,172,101,236, 88,238, 26,232,108, 32,104,162, 17,129, 71,165, 28,102, 92, 51,238, 21,106, 61, 19,189,
+103,240,129, 62,118,194,188,239, 99,  9, 17,229,242,178,146, 53,133, 81, 98, 76,182, 72,120, 72,231, 72,240,112,247,241,150,183,
+ 47,111,163,107,203,225,245, 21,106, 39,  7,190,195,171, 43,220,115,247, 49, 78,174, 45,176,208,182,184,102,129,151,127,250,  6,
+ 23, 46, 94, 99,177,109, 24,141, 26,249,140, 40,208,118,129,233,206, 14,181, 50, 44,141, 26, 86, 23, 42, 78, 31, 25, 97,252, 77,
+222,184,240, 62, 33,128,118,230,192, 43,237,172, 41,196, 69, 65,  2,163, 85,193,106,106,142,172,173,202,195, 44,244,140,151, 87,
+176,214,224,127, 78, 59,186, 48,110,164, 14, 56,  4,201,101,168,192,125,247,172,176,113,123,194,168, 90, 98, 92, 85,188,252,179,
+ 75, 44, 46,215,228,168,240, 68,246,125,132,176, 67, 59, 18,162,159,169, 44, 62,105,166,161,147, 73, 96, 50,101, 18, 54, 20,185,
+ 83, 42, 72,102,249, 94,154,172, 65,107, 98,232, 25, 84, 38,249,132,201, 18, 10,205, 81, 17, 98,135, 83,134,202, 90,124,236, 37,
+223,145, 21,125,169,177,165, 20,202, 78, 85, 40,109, 66, 12,205,104,157, 49,182, 46,253,230,132, 73,154,172,163,220, 80,131,212,
+ 57,197,205,208,151, 73,142, 33, 68,197,164,155,145,130, 39,219,106,222, 90, 58,168, 47,153,194,153,  8,201,227,172,147,236, 77,
+142, 44,180, 99,250,108,217,218,221, 32, 12,125,161,127,113,160, 34, 37, 69, 76,237,228,230,167,146, 76, 49, 75,218, 92,106,182,
+ 78,216,226, 70, 97,147,198, 15, 67, 65, 34, 91, 44,137,161, 68,173,229,210,144,101, 76, 31, 44,170,188, 96,148, 86,248,156,177,
+ 42,151,233, 65, 46, 16, 40, 89, 79,164, 88,186,252,  6,162, 47, 92,123, 20,106,144,169,162,209,  5,196,163,132, 28,153,148, 28,
+ 88,137,165,163, 93,214,167,145, 84, 14, 12,146,178,215,  7, 13,115,193, 78, 11,184, 38,150,116,182,172,  9, 84,177,165,165, 98,
+ 53,155,203,175, 40, 92,145, 88, 82,243,166,164,238, 77,193,243, 38,188,188,111,  8,133, 23, 96, 73, 41, 98, 98, 40, 42,218, 18,
+ 88,211,229,246,122,231,105, 47,142,241,178, 66,240, 73, 86, 97,104,205,224, 51,141,146,208, 94, 78,136, 88, 43,139, 75, 89,229,
+178,167,142,233, 96, 53, 93,208,163,197,162, 46, 41,122, 29, 53,186,214,210, 90, 72,114,179, 79, 74,203,106, 41,102, 84,144,198,
+148, 50,148,204,129,164,220,109,  9,241,166, 36,147,224, 92,246, 22, 57, 27,105,131, 28,216, 83,133,149,146,180,252,204,138, 48,
+179, 76, 11,203, 36, 36, 75, 58, 63, 43, 48, 11, 75, 43,191,151, 83, 20,180, 94,150,147,155,184, 97, 57,248,129,100,197,193,252,
+ 94, 86, 22, 69, 87, 88, 94,252, 90,205,201, 63,154, 71, 31,125,148, 95,255,245,127,198,219,239,188,205,159,254,233, 55,248,240,
+125,247,243,204, 51, 79,115,239,125,247,114,250,228, 41, 30,126,232, 44,143,158,251, 24,227,209,152,235,215,111,178,189,181,197,
+123, 23,222,225,230,198,  6,159,124,244, 28,199,143,202,205,190,235,  3,174, 88,180, 66,233,203,235,100, 14, 24,189,243,148,106,
+ 22, 58,137,132, 26, 98,225,181,199,132,159,159, 68,179,220,188, 82, 12,114,179, 45, 95,156,  3,173,105,206,196, 16,136,126, 14,
+168, 81,104, 99, 49,117, 35, 53,175, 44, 15,166,202, 57,234, 74,106, 14,198, 25,177, 27, 37,168,173, 43, 61, 73,192, 24,176, 22,
+173,107,  9, 59, 25,139,209,149,252, 45,149,198,154, 26,172, 17,126,190, 22,127,185,116,252, 35, 42,101,169,255, 37, 69, 93, 91,
+134, 97, 38,148,161,212, 17, 82, 47, 29,251, 16, 36,148, 99, 12,149, 22,147, 87, 93, 89, 28,  2,126,112, 73,166, 15,209,168,146,
+ 47,240,164,144,152,120, 79, 55, 36,134,190, 39, 36, 67, 72, 26,159,197,193,155,148,197,105, 67,221,180,152,106,204,210,202, 33,
+ 70,227, 49,245,184, 97,101,237, 16,227,145,101,105,117,204,241, 67,171, 28, 95, 93,228,196,145,117,214,215,151, 89,108, 43, 86,
+ 86, 71,172, 46,181,162, 48,212, 10,109, 29, 75,109,131,179, 26,103, 28,174,109,104, 70, 53,181,171,229,239,105, 13, 57,120,148,
+150,186, 95,240, 18, 70, 11,243,105,129,143,178,247,202, 10, 83,183,152,166, 18,205,235, 98,203,184,169,104, 90,199,210, 72,108,
+115,109,101,209, 41, 22, 24, 70, 38,198,129, 48,  4,122, 95,234, 52,115,191, 60,185,124, 49, 51, 93,239,165, 46,151, 50, 41, 27,
+134, 40, 55,128,232, 33, 69, 69,215, 69,  6, 47, 55,173,148, 33, 68,232,123, 17, 72,100,101,208, 86,164, 67, 85, 93, 81,143, 90,
+198,227, 49,139,227,154,133, 81,197, 66, 85, 51, 26, 53, 88,107, 74, 74, 90, 29,176,173, 18, 20, 18, 94,230,238, 83, 71,216,184,
+189, 67, 70,177,178,188,128,173, 29, 22, 69,219,200,255, 95,213, 52, 12,192,222,254,192,203,175, 95,224,198,230,109, 98,206,116,
+ 67,199,108, 50,101,119,119, 66, 63,  4, 78,173,183, 44,181, 21,171,203, 35, 48,137, 58,121,158,253,103, 79,114,108,161,229,253,
+ 43, 87,153,206,194,193,193, 84,169, 59, 42,227,249,120,127,238, 50,104,154, 10,133, 98,119, 50,197,135, 64,101, 32, 13,  1, 83,
+ 60, 12,174,110, 25,213, 22,165, 52,171,227, 26, 93, 89,110, 79, 19,179,153, 98, 99,107,143,143,127,228, 44, 23, 46,127,192,198,
+230,109,148, 85, 12,222,176,187, 59,195,152,204,153, 19,107,220,184,117,155,181,133, 17,173, 22, 56, 80, 95, 50, 48,170,146, 49,
+119,138, 66,134, 83, 81, 73, 31, 59, 38,140,118,132, 48,208,199, 65,210,230, 49, 65, 33,154, 89,  7,163, 74,163,157,194, 85,  6,
+173, 34,161,247,178,166, 11,129, 16,101,151, 29,131,  4,230,196, 57,165, 15,164, 27, 25,249,140,205, 57, 15,177, 76,239,180, 50,
+228, 44,105,221,164,196,252,101,140,  1,101,184,181,181,193,116,111, 87,198,183, 70,166, 47,174,244,144, 83, 33,208,201, 86, 82,
+122,225,198,138,153,112,107,247, 54,195,116,239,128,136,152,231,205, 25, 35, 55,210,156,139,191, 92, 69,150,150,214,202,127,166,
+ 14,188, 11, 82,111, 66,110,145, 63,183,167, 37, 75,117, 88,194,133, 37, 37, 62,175, 86, 41, 65,  0,231, 12, 26,135,113,133,155,
+159,230, 91,136,242,226, 40,161, 63,144, 81,111,201,211, 30, 88, 11, 77, 33, 79,230, 82,227, 19,152,203, 29,191,135, 66,224, 59,
+114, 65,138, 16,231,100,208,132, 47,189, 49,101,138,247,157, 32,170, 80,165,202,129,104,206,132,147,201,162,  0,172,132, 37, 47,
+ 53, 26, 93,222, 60,130,  2, 86,  7,125,177,124,112,153, 60,192,168,166,132,202,194, 95,151,247,182, 57, 32,142,170,172, 80,201,
+148,149,133, 47,124,244,  2,147, 65,163,147, 16, 51,147,146, 12, 67, 60, 16,190, 68, 34,  2,235, 81,101,250,150, 74, 82, 47,151,
+213, 46,133,106,169,138,219, 62,151,199,191, 81,166,116,131, 36,  4, 72,177,158,166, 40, 47,123,165, 75,184,182, 48,  1,114,201,
+ 13,164, 92,248,238, 73,160, 96, 81,  2, 97,  2,109,  2,  1,210,168, 68, 30,130, 60, 87,116,  1,240,100,176, 37,116, 23,230,217,
+129,241,226,194,239,145,162,160,  2, 83,193,251,165, 64,140,254, 64,112, 64, 20, 74, 81, 76, 30,162, 23,106, 91,144,219,166,214,
+153,224, 61, 49,101,142, 30, 61,204,111,125,253, 89,182,182,182,248,163, 63,248, 15,220,218,216, 98,214,247,244,222,163,178,162,
+ 27,  6,246,167, 83, 20,176,182,190,134, 70,177,185,117,155,166,105,217,217,217, 99, 58,157,242,232,185,115,164,228,121,239,226,
+213, 98, 82,155,255, 50,106,217,191, 25, 25,105, 12, 65,164,245,198, 57, 22,199, 11,140, 70, 13,149, 86,248,190, 47,185,  0, 67,
+211, 44,210, 54,181,156, 58,189,103, 54,244,248,168, 14,126, 33,115,174,119, 44, 39, 48,231,172,220, 90,162,236,239,134,206, 51,
+164, 92,194, 21,162,147, 37,139,100, 64, 27, 69,211,180,140, 23, 91,249,128,197,140, 54,242, 33,148,106, 66,100,232,197, 18, 22,
+ 11,  9, 67, 69,129,246,184,186, 18,162,153,151, 81,119, 54,154,186, 54, 84, 70,132, 48,182, 50,152,100, 73,198, 50, 94, 94, 16,
+118,115, 24,202,190,106, 94, 95,137,136, 69, 69, 30, 42,210,217,151, 79,150, 66,146,153,206, 56,108,214,130, 56,240,129, 20,122,
+250,193,227,103, 61, 42,123, 73,204,247,  3,179,161,151, 19,100,136, 76,186, 14,159,  6,124,223,227,125,160,243, 61, 33, 43,250,
+ 62, 51,132, 68, 80,146, 45,  8, 70,225,218,  5, 22, 23,199,180,117, 75,211,150, 17,115, 93, 97,180,193, 71,208,141,147,  1,188,
+ 54, 24, 91,161,181,165,109, 90, 92, 59,166,109, 90,150, 22, 23,169,235,154,202,136, 47,188,178, 78, 30,220, 42, 75,245, 76,152,
+150,178,251,139,242,229,239,135, 72, 54, 14,235, 90,154,166, 97,180, 48,194,141, 44,117,221,210,214,142,218,  8, 82,210,100,138,
+ 81, 78,152,220,253, 32, 94,  1,109, 52, 49, 23,134,  8, 98,188,154,247,101, 93, 86,130, 40, 46,246, 39, 65,142,  6, 98,144,207,
+ 73,142, 17, 31, 12, 67,242,196,160, 36,173,158, 69,181,106,170,154,166, 25, 83, 53,142,229, 81,203,104, 84,211,182, 35,154,170,
+146,234,147,209,184,214,240,246,133,247,217,222,217,165,174, 29, 75,227, 17,163,186, 98,  8,137,219,187, 51,182,119,247,120,251,
+221, 75,124,112,229, 58,141,137,188,121,233, 58, 41,  6,234, 74, 58,200,146,154, 72,184,198,112,246,236,221,172,212, 45, 89,105,
+172,242,124,234,147, 31,230,233,223,254,117, 62,114,255,105, 78,173, 85, 92,189,116,149,173,221, 41,214,136, 34, 55,151,102, 75,
+ 76, 25, 93, 57, 82,130,181,213, 37, 14,175, 47,179,189,179, 79, 12,129,126, 54,165,110, 44,109,221,176,188, 56, 66, 27, 77, 61,
+178,172, 47, 45,178,184,188, 70,213,214, 76,102, 19,124,159,113,214,178,189,189,203, 75,175, 93,161,247,  3,147,201,148, 48,  4,
+102, 67,207,108, 54, 97,117,113,153,207, 60,254, 24,221,208,113,107,107,143,147, 39, 86, 56,125,236,  8,154,196,126,223, 73, 40,
+ 40, 36,116,146,234, 98, 46, 53, 72,180, 34, 32, 15,184,156, 34, 38, 40,113, 49,100, 79, 38,210,182,142,202,214,133, 53, 94,196,
+ 59, 65, 38,  9,170,  4,109,  7,239,201, 49,224,163, 84,145, 66,  8,  7, 82, 17, 93,  0, 40, 42, 11,220, 67,105, 77, 72,153,253,
+174, 99,107,103,151,219, 91,219,108,111,111,179,177,113,139,221,157, 93,246,103,251,236,237,238, 16,135,161,220, 26, 13, 42,137,
+ 75,251, 14, 33, 12, 12, 66, 86,140, 57,209,245,129,221,221, 45,102,221,190,  4, 75, 85,233,215,151,216,149,  4,228, 18,141, 51,
+172,142, 45, 39, 15,173,176,184,180, 34, 47,217, 44,211,200, 48, 79,170, 23, 41,137, 82,114, 24,144,247, 88,148,219,157, 46, 30,
+239, 80, 66, 97,141,  8,163, 68,123, 42,223,199, 92, 60,234,170,  8, 99,180,201,197, 79, 46,231,  3,159,228, 22,153,181,220, 34,
+229,138,172, 10,133,217,200,229,205, 26,161,195,202, 89,167, 28,  6, 82,177, 54,102, 14,232, 39, 37,204,167,203,116, 68, 91,203,
+124,209,172,180, 60,187,230,194, 47, 89,217,106,156,214, 68,163,127,142, 34,103,138,153, 44,138,132,171, 76,186,230, 23, 72,201,
+204,229,178, 11,207,168, 18,182,148, 49,178,158, 15,247, 75, 16, 79,254,188, 57,  2, 87,149,176, 47, 74, 96, 74,178,225,187,195,
+245,215,165,  6,157,147, 60,239, 83, 10,165, 46, 89,242, 50,115,179,103,188,163, 17,151, 63, 77, 38,214,194, 63,146, 73,  1,166,
+232,204,179, 70,151,245,111, 40, 60,123, 85,216, 41, 81,221,233,175, 23,205,144, 76, 44,202, 75,159, 34, 36,138,130,102, 16, 15,
+125, 81,184,170, 34,194, 49, 89, 11,155,160,100, 12, 82, 46,226,217,131,209, 68,241,164,167,178,195,202, 37,172, 38,249,140, 40,
+189, 10,109,112,  7,  2,120, 57,165, 73,  5, 39,240,248, 99,143,178,180, 48,230,143,255,253, 31,177,113,235, 26, 89, 41, 46,156,
+127,131,119,206,159,199, 57,199,250,145,195,220,125,230, 46,214, 87, 86,  9, 49,178,182,186,198,147, 79, 62,193,251, 87, 63,224,
+236,217,  7, 88, 93, 89, 97, 99,107,139, 19,167, 78, 51, 94,248, 41, 27, 27,155, 40, 39,164, 31,225,244,106, 81, 62, 70, 88, 92,
+ 90,230,248,177, 19, 28, 59,126,148, 35,135,143, 48,110, 91,134,190,227,242,229,139,236,239,239,115,242,212, 41,214, 86,143, 96,
+172, 98,119,119,151,119,223,125,151,243,111,190,201,224, 59, 66,180,104,163,  9, 62,224, 42,203,195,247,223,207,241, 19,199, 88,
+ 90, 94, 33,248,192,173, 91, 27,188,251,238,  5,110,108,108,162,181,102, 80,114, 83,214, 70,209,182, 45,167, 78,156,226,232,137,
+ 99, 28, 63,114,148,241,194,136,156, 18, 91,155,183,120,235,252,121, 54,182,110, 51,110,101, 68,230, 76,192,186,138,224, 35,203,
+107,235, 60,112,223,  3, 28, 62,114, 24, 83, 89,246,118,119,121,255,202, 21,222,126,247,  2,209, 75,247, 17, 45,225, 52,149, 18,
+103,206,156,225,248,201,147, 44, 46, 45,225,135,129, 91,215,175,243,238,197,119,216,157, 78,169,181,165,178, 48,219,159, 48, 11,
+ 50,106,143, 25,116,109,177,100,234,218,138,229, 39,107,102, 38,178, 96, 22,208, 33, 49,116,158,140,166,113,142, 88,198,206,174,
+181,204,162, 39, 87, 14, 61, 36,200, 61, 41, 57, 81,108, 38, 79, 91,181, 12, 65, 30,168,169,114,168,228,133,243,222, 67,238, 60,
+ 67,142, 24, 87,209,154,113,201, 31,100, 58, 99,176, 78, 48,146, 62, 14, 96, 44,179,201, 62,221,224, 49, 86, 75,106, 85, 65,213,
+212, 84,202,208,123, 57, 84, 10,215, 67,242, 17,217, 39,170,202, 80, 57, 33,191, 25,157,139, 56, 71,  2, 77, 93,138,194, 99,239,
+164, 86, 73,225,134,215,218,129, 21,  0, 82,107, 28,182, 29,177,210,214, 76,251, 41, 57,212,116, 65,110,139, 41,  8,230, 55,  6,
+ 67, 82,114, 66, 55,149,124,158,147, 81,168,104,201,126,192, 26, 75,  8,137,126,232,229,  6,110,122,156,202,101, 84, 40,201,110,
+165,172, 16, 13, 77,164, 81,150, 74,107,140,106,233,139,180,200,234, 76,223,121,246,187,142,174,235, 25,143, 28,187,147, 25, 49,
+ 37,182,118,167,108,110,237,176,216, 58,198,213, 18, 57,100,158,252,236,189, 92,187,182,135, 77,138,251,143,175, 99, 43, 77,240,
+153,157,253,  9,125,212,196,110,224,141,215, 46,114,246,244,113,140,129,193,123,118,102, 10,170, 49,237,  3,103,249,226, 93,199,
+120,236,211, 31,227,247,254,143,127,199,119, 94,122, 15,165,157, 60,  4,147,140, 98, 27, 91,163, 42, 67, 68,179,179,215,227,195,
+ 64,219,212,164,160,184,181,181, 75, 61,106,105,157,163,110, 27,236,168, 38,165,140,159, 37,154, 81,195,241,181, 53,110,238, 77,
+ 73, 81,177,188,182,140,219,155,145,179,103, 63,  4,250, 44, 29,244, 97, 54, 99,121,105,204,108,111,224,147, 31, 57,199,123, 31,
+108,240,194, 75, 63,229,137,115, 15,241,185,143, 63, 64,110, 70,252,213,223,255,128,237,217,  4, 91, 91,114, 23, 74,138,152,242,
+ 66,145,158,186, 82, 26,159, 35,217, 70, 98,148,149,  1, 81,209,231,128,193, 21,234, 90,198, 57,131, 13,133, 24,233, 37,116, 23,
+ 99, 73, 97, 71,121, 56, 83, 91, 84, 80,116, 33, 96,156, 28, 22,187, 73, 98,123,123,147,161,159,210, 77,246, 73,193,203,132, 86,
+151,181,162,171,137,  3, 84,128,109, 27,185,224,200,208, 85, 12,131, 86,220, 15, 26,205, 16, 51, 62, 13, 36, 63, 16,252, 64,140,
+161,  0,154, 10,185,185, 48, 38,156,209,212, 86,242,  5, 11,141,226,158, 19,135,248,240,189,119, 97, 70, 11, 76,102,137,208,239,
+ 11,  9,114,150,120,247,230, 46,187, 94,  2,179,206,148,135,250, 16, 36,243,225,132, 84,153, 99,193,178, 24, 75,152, 37,172,147,
+181, 95, 10, 94,228, 86, 90, 92,228,130,220,149,221,172, 48, 29, 74, 98, 62, 67,204,  6, 21,179,120, 22, 48,196, 44,223,197, 20,
+229,123, 17, 82, 44, 10, 81,153, 44,196,162, 71, 85,185,164,115,162, 48,198, 19,194, 47, 55, 86, 88, 36,186,184, 45,116,158,239,
+191, 13, 73, 27,140,137, 88,171,201, 67,241, 33,207,211,245,169, 36,185,117, 65, 53,151,234,154,200, 50, 10,184,169,240, 57,152,
+215,230,146,  8, 83,180, 54,119,214, 34, 82, 71, 32, 41, 89,101,164, 20,208,229,162,161, 84, 16,126, 70,206,114,168, 51,  6, 10,
+181,109, 46,235,  9, 73,114,234, 86,187, 82,151,158,235,226, 11,156,135,121,223,188,188,124,203,  1, 71,103,153,202,233,156,133,
+124,106,141,144, 82, 67, 18,163,167, 17,160, 89, 20,128,188,172,184,203,159,155,181,194,198, 34,211,153,239,235, 65,200,115, 70,
+ 17, 10,131,206, 22,192,153, 74,134,164, 32, 34,235,205,236,229,221, 13, 26,171,149,147, 17,101,150,211, 74,204,210,157,211,115,
+147, 21,243, 29,220,252, 60,113, 39, 39,129,130,144, 85,225,248, 38, 62,249,169, 79,240,250,235,175,113,229,242,123, 88,155,133,
+214,133, 66,233,200, 93,119,223,205, 39, 62,241, 41, 62,116,230, 12,171,171,171,194,173,173, 68,250,254,  7,127,252, 39,188,244,
+163, 31,242,181,103,159,101,125,125,157,195,235,235,252,250,127,243, 21,190,253,237,239,114,254,173,243,229, 38, 45,128,142,156,
+ 37,117,253,139,191,246, 21, 62,254,145,143,210,180,117, 65,160,202,  9,240,220,163,143, 18,163, 48,179,153,167,245, 51,156,123,
+244, 49,158,123,254,121,190,243,205,191,103,  8,241,128,158,116,215,233, 51,252,119,255,227,191,164,114,245,  1, 21,  9, 50, 23,
+223,125,151,191,254,235,255,204,123,239, 93, 38,149, 47,186,179,134,207, 60,254,105, 62,253,201, 79,177,190,190, 62,255, 77, 31,
+140,149,238,185,239,126,254,238,155,223,230,246,141,107,120, 35,196,182,201,116,224,200,225,195,124,233,151,191,194, 93,167, 79,
+203,  7, 71,203,127,255, 99,231,206,241,220,247,191,195, 75,255,245,167,120, 35, 63, 99,167,107, 62,242,216, 57, 30,255,228,103,
+ 25,213,141,236, 99,149,140,233,223,123,239,  2,223,121,254,121,246,119,118,137, 64,213,  2,211, 40,200, 74, 66,233,236, 91, 25,
+ 43,169,114,218,207,137, 33, 56, 22,170,138,197, 67, 99,124,242,116, 67,164, 54,  6,167, 27,186, 32,180,173,232,  7,140,177,212,
+180, 96,165,114,150,113,224,101, 39,155,140, 42,192,137,138,136,161, 93, 90,198, 12,248,  0,  0, 32,  0, 73, 68, 65, 84, 26, 99,
+180,116, 56,109,156,159,160, 69,201, 57, 66, 56,248,173,150,212,105,200,158,222,247,164, 73, 36,231,129,157,189, 93,246,186,129,
+228, 59,250, 33, 18,181, 18,  5,229, 48,224,227, 68,  2, 49,218, 49, 13,  3,157,  1,223,251,226, 78, 55, 52,182, 38,155,242,224,
+165, 35,197,136,113, 53,227,118, 76,206,145,125,100, 31,170,251,204, 52,121, 24, 60,126, 24, 17, 21, 84, 78,179, 56,110, 88, 41,
+217, 16, 89,  3, 56,217,139,170, 76,  7,168,148,152, 78,134,114,234, 29, 17,148, 39, 15, 73,168, 91, 74,129,145, 93,172, 15,  3,
+179,217, 64,210, 25,167,107,146,201, 84, 73,  9,119, 89, 87,180, 78, 97, 19,152,202, 98,173,204,  4,186, 91,219,244,253, 64, 93,
+181,196, 52, 97,243,246, 62,221,208,147, 99,100,241,208, 58, 43,171,135,240, 33,114,117,207,243,214,197, 15,200, 41,114,236,248,
+ 58, 11,173,161,159,246,156, 92, 89,230,234,237, 25, 27,219,183,240,211, 29, 86,199, 71, 57,186, 54,226,232,209,163,108, 93,251,
+128,189,235,183, 88, 60,118,  6, 26,203,250,163, 79,113,234,174,239,160,126,116,  1,137, 14,202,119,116,105,105,137,163, 39,238,
+ 99,119,186,195,198,181,139,  4, 87,201,238,114,  8, 84,181, 35,231,200,181, 43,183,104, 85,205,201,122,  5,141,197, 39, 79, 85,
+203, 33,224,246, 36,114,229,250, 13,134,153,192, 91,150, 87,198, 28, 93, 21,196,233,252,137,151,148,162,109, 27, 54, 55, 54, 49,
+205, 50,203,135,143,115,227,214,247,248,243,191,251,175,156, 62,121,156,175,124,241, 41,126,237,151, 31,231,175,254,246,187,220,
+218,153,202,231, 43,134,210, 32, 72, 36, 99,240, 19, 65,144,102, 44, 49,250, 50,166,150,155,176, 38, 99,113,132, 44,  1,205,152,
+ 37,236,166,117,194, 84,142,228,141,176, 18,178, 18,139,149,113,228, 98,240, 82,  6,226, 16,112,206,177,189,189,197,173,171,151,
+ 24,141, 42,172,210,180,227, 70,214, 99,  2,154, 70,107,131, 51,148,125,120, 34,132,200,116, 54,147,204,193,  1, 25, 93,232,133,
+222,123, 98, 26,228,198, 89,110, 85, 90, 41, 42, 43, 87, 68, 65, 90,151,219,169, 51, 44, 47,181,160, 13,135,214, 70,220,117,114,
+149,151,222,217, 68, 43,203,104,180,196,218, 66,195,189,199,199, 60,153, 19, 63,125,237, 42, 63, 57,127,157, 73, 40,185,130, 36,
+ 28,131,148,202,136, 91, 25,156, 43,211,198, 44, 13,146, 56,239, 63,163, 14,130,134,166,248,211,251,161,216,188,144,145,175,116,
+224, 11,137,110, 16,168,141,154,103,136,148, 34,135,178, 79, 86,166,208, 28, 35,169,120, 40, 84,241,143, 39, 37,236,119,103, 85,
+  9,181,221, 89, 31,228, 84, 58,212,214,  9,224,134, 36, 76,123, 31,133,246,167,212,  1, 48, 43,229,132, 50,249,206,125, 91, 94,
+ 62, 28, 63,126,140,135, 31,121,132,111,127,243,191,200,182, 62,235,  3,209,204, 99,159,252,  4, 58,195,203, 47,255,168,116,217,
+197,206, 25, 85,148,119,154, 18,184,141,232, 74,229,192, 40,213,200, 34,108,201, 82, 55,182,149, 16,222,142, 28, 61,198,  3, 31,
+126,144,231,191,243,109,146, 10,  5,127, 43,217, 42,157, 75, 56,173,180, 30,148, 50, 34, 28,251, 57,188, 56, 74,  0,103,201,203,
+173, 62,166, 40, 43,146,162,174,149,232,128, 33,196, 50,117, 85,153,172,197, 90, 26,148,172, 85,178,132, 68, 36,229, 83, 66,144,
+105, 94,209, 46, 93,252,121,181, 78, 21,169,140, 50,114,168,209, 57, 96, 22,151, 86,126, 79, 23, 34,147, 36,  7, 11, 23,216,200,
+109,118,158,246,198, 20,144,126,161, 19,105,123,199, 96,149,139,145,231,215,190,250, 85,190,253,221,239,114,233,242, 21, 25,  1,
+103, 57, 85, 61,248,240, 35,252,139,127,241,207,249,240,  3,247,179,180,184,136,117, 78, 66, 86, 70, 48,133,206, 58,158,127,238,
+ 57, 94,123,237,117, 70,227, 49, 43,203,203,156, 56,113,130,135, 30,124,144,253,201,148,107,215,175,201,106, 64,201, 15,175,174,
+ 43,126,229,151,191,204,234,202, 10, 10,184,117,235, 38, 23, 47, 94,162,174, 43, 65,167,162,216,159,236,115,225,237, 11,204,166,
+ 51, 22, 22,198, 84,206,114,236,232, 81, 46,188,243, 54,183,111,111, 22,152,  3, 28, 63,126,148, 71, 30,126,152,247,175, 94,227,
+198,141, 91,242,226,104, 91, 86, 86,215, 88, 89, 89,225,252, 91,239,136,213, 75,101, 22,198,139,124,254,233,207,115,226,196,  9,
+148,130,141,205, 77,174, 92,185,140, 86,134,182,109, 88, 89, 89,101,161, 29,241,214,249,243,236,207, 38,116,251, 29, 73,193,231,
+159,250,  5,206,158,125,144, 12,108,108,220,226,242,165,247, 89, 91, 91,197, 89,203,250,242, 26,111,190,245,  6,211,217,148, 70,
+193,  3, 15,220,199, 23,158,254, 37,234,170,162,235, 59, 46, 94,122,143,156, 51, 77,221,176,188,182,198,242,226,152, 55, 94,127,
+ 85,234,163, 57,210, 69,185, 69,215,198, 34,219,145,129, 72,164,239,  3,251,131,152,221,134,222, 51,243,162, 38,213,218,208,165,
+194,117,175, 26,201,  8, 36, 37, 47,246, 12,209, 88,106,237, 80,198, 72, 37, 45,165,130,219,148, 10, 74,246, 66, 16,139, 49,210,
+245, 29, 97,240,  2,140,168, 20,237,162,220, 82, 43,227,168,170,154,152,161,173, 27, 84,206, 52,245,  2,163,213, 21,150, 86, 22,
+ 24, 47, 46, 50,110, 42, 70,139, 35,150,154,150,197,197, 69,172,209,180,163,134, 81, 91,163,181,220,244,157, 73, 96, 13,227,182,
+ 41, 99,117, 79, 68,210,232,164,140,201,  2, 99,232,125, 79, 55,219,101, 50,157,209,123,  9, 99,249,156, 48, 86, 73, 42,123, 58,
+101,178,191,199,100,218,177,215,  5, 38,157,103,103,210, 49,243, 50,133,242, 40,204,168, 46,208, 34,193,105,214,181, 97, 97,161,
+ 98, 84, 59,198, 11, 21,171,139, 99,198,139, 45,117,221, 80,143, 90, 22,155,154,118,161,166,182, 21, 85,150, 32,143, 26, 50,221,
+116, 70,215,117,236,118, 83,118,247,166,226, 88,159, 78, 25,186,129, 99, 43, 21,215,111,220, 98, 99,107, 91, 38, 11, 33, 98,148,
+226,232,225,195, 44,175,174,210,117, 29, 91, 59, 91, 92,184,112, 25, 29, 50,235, 43, 11,197, 13,144,233,122,  1,132,108,238,108,
+ 16, 73,156,185,235,  4,247,222,125,148, 15,159, 57,194,147,191,253, 63,113,232,216,  2,147,173,171, 44,159, 60,  5, 56,174,252,
+211,203, 92,121,227,117, 94,121,227, 50, 62, 41, 66,150, 12,201,120,229, 48,213,104,145, 20, 35,161,155,226, 12,212,141, 21,142,
+120, 74, 44,140,199,140,154,138,155,155,219,100,235, 24, 57, 71,227, 26,124,206, 92,190,124,149,237,173, 91,248,190, 39,133, 65,
+180,160,193,211, 44,140,168,109, 77,215,117, 82, 71, 50,134,213,213,117,246,247,167,172,158, 94,103, 54,153,112,243,250, 13, 76,
+ 74,220,218,220,229,251, 63,250,  9,247,127,232, 56, 79, 62,241, 25, 46, 93,120,135,105,223, 11,234, 19,105,174,132, 97, 64,107,
+193,148,134, 36, 43, 44,163,193, 33,191, 83,227,100,175,109,149, 36,172,125,136,  4,239, 15, 82,236, 98,131,147,135,167, 51,146,
+ 25,177, 86,170,146, 74,137,100,  3,101,216,188,121, 29, 63,204,176,214, 73,216, 82, 21,  7,134, 42, 43,153,152,100, 45, 73,129,
+170,100,  9, 45,185,170,  2,101,232,135,142,217,108, 70, 63,244,164,232, 15,226,224,115, 61,166,115, 22,235, 12,149,149,132,188,
+ 86, 70,216, 20,104,134, 32,213,221,253,174,199, 84,142,215, 46,221,228,181,215, 47,112,253,250, 22, 23,175,220,228,221,155, 59,
+ 28, 59,190,194,231, 30,191,159, 15, 63,112,152,237, 91,183,185,122,115, 27,109,164,  6,171,238,224,211,133,183, 62, 23,133,100,
+ 97, 39,160,229,230,168,203,243,124,136,114,200,207, 72,  3, 36, 69,177,173,205,235,170, 50,250, 79,119,228, 35,165,158, 37,234,
+ 81,125, 96, 70,148,234, 26,152, 36, 32, 46, 93,254, 60,109,  4,226, 98,178, 34,132,132,179, 86,244,203,243,219,112, 44, 21, 60,
+173,177, 74, 75, 54,168,146,137,136,160,183,193,206,241,176,133,238,168,181,  2, 13, 71, 15, 31,229,193, 71, 30,225,159, 94,249,
+167,185,166, 12,107, 44, 57,101,238,185,247, 94,172,181, 92,125,255,125,121,111,233, 44,226,149, 34,145,209,229,194,167,116, 62,
+112, 39,168,194,170, 55, 72,149,204,148,137,121,206,138,181,245, 35, 60,244,240, 89, 94,125,245, 85,193, 93,167, 84, 88, 21, 98,
+104,204,  5,214, 83,128,246,101,213,167, 81,149, 48, 64, 52,194, 64, 17, 50,190,188,120,231,184,216,164,228,179, 97,210,157,144,
+176,100,247,228,  0, 24,146,100,171, 14,138,245,200,122, 72, 23,235,220,252, 23,174,180, 24, 51, 83,150,181, 75,154,107, 93, 11,
+127,223, 44, 45, 47,255,158,162,252, 82, 85,249, 77,170,  2, 17,201,243,186,157, 36,226,117,169,153,229, 66,205, 73, 37, 41, 33,
+213, 65,205, 83, 79,125,142,231,190,247,  2, 59,123, 59,  7,167,211,147, 39,143,241,245,223,250, 58, 71,142, 28, 97,158,214, 81,
+ 90,253, 92, 46, 17,142, 29, 61,202,245,235,215,121,243,173,243,188,249,198,155,128, 98,188, 48, 38,196,196,217,179,247,115,123,
+107,139,155,183, 54,228, 47,173,197,232,115,238,227, 31,101,101,117,149, 16, 34,127,251,119,127,203,183,190,249, 61, 50,138,251,
+238,187, 23,173, 20,239, 93,188,196,159,125,227, 27,188,242,234, 27,220,117,215, 41, 86, 87, 87,176,214,113,243,214, 45, 46, 95,
+250, 64,190,160, 40,134,233,140, 55,223,124,131,231,191,255,  2, 63,122,233, 37,250,161,227,254,123,239, 21, 84,173,173,120,231,
+226, 69,182,183,119, 72, 81,234, 63, 15, 60,112, 63,135, 15, 29, 34,165,204,183,191,245,109,254,238,239,255,158, 27,215,111,114,
+223,125,247, 96,173,195, 40,205,107,111,156,103,227,246,109, 82,204, 44, 46,173,242,185,167,158,100, 52, 26, 17, 66,224, 47,255,
+243,223,240,147,159,188,202,217,135, 31,164,174, 27, 82,202,188,245,214, 59,236,110,239,163,141,229,220,163,143,113,252,196, 41,
+ 50,112,254,237, 55,249,246,183,254,129,173,173,109,238,189,239, 62,156,115,172, 44,173,242,218, 79,255,  9, 99, 18, 77, 91,211,
+ 86, 53,117, 85,225,170,154,166,118,212, 78,  9,130,212, 41, 90, 87,209, 44, 54,180, 54, 51,170, 43, 57,221, 38,143, 77,137,170,
+ 54,132, 48,160,116,192,182,142, 58,149, 79,152, 41,222,116,157,208,202,210, 52, 34,205, 25,217,134,197,102, 76,219, 90,217,131,
+187,150,241, 66,205,120,228,104,156, 43,167,249,154,202,180,101,119, 89,145,117, 36,230,128,177,141,132, 18,125,199, 16,133, 54,
+ 87, 45,142,105,171,  5, 22, 23,151, 89, 88,108, 88, 61,188,198,202,226,152,163, 43,107, 44, 47, 45, 80, 87, 53,139,163,  5, 52,
+  2,193,208,202, 98,141, 67, 59,199,168,109,105, 91,233,196,219,170, 98,220, 86,184,218,225,180,145,132,125,  1, 20,197, 32, 39,
+ 95,107, 44,166,146, 13,157,239,  6,186,201, 62,125, 55,195,119,158,219,187,123,236,236,236,179,125,123,151,205,219,219,108,109,
+239, 49,120, 79,232, 51,189, 31,200, 88,178,114,152, 74,118,163, 90,103, 22, 70, 21,163,229,154,229,209,136,229,133, 49,213, 98,
+195,209, 35,139,140,234,150,165,133,138,229,197,134,218, 88, 42, 35, 35, 74, 82,164,109, 42, 30,249,208, 25,222,185,116,149, 62,
+244,  7, 22,193,227, 71,215, 89, 94, 93,161,247, 19,240, 30, 87, 57, 42,167,169, 44, 60,250,208,  9, 72,  3, 59,219, 19,118, 39,
+ 61,179, 24,139,255, 26,198,227,195,236,109,239,241,177, 79, 62,202,201,143,252, 26,227, 67,103,136,187,151, 24, 29, 57,204, 79,
+254,246,191,240,214,171, 63,227,173, 43, 59,236, 77,  3, 67,188, 19,214,153,205,122, 70,166,163,110, 50,195,208, 11, 35, 95,160,
+ 19,140, 22, 86,113,182, 98, 24,122,140,181, 36, 31, 57,121,242, 40,251,222,179,113,243,  6,155, 91,155, 34, 76,177,  6,107, 36,
+248,216,245,129,233,100,198,241, 19,107, 52,104, 54,111,239,179,188,186,192, 16,  2,179, 89,143,109, 91,174,223,220,226,246,230,
+ 53, 14, 45, 57, 30,186,255, 20,107,149, 69, 15, 59,156,251,212,199,168,150,143,241,195,127,252,199,178,159,246, 34,208,136,178,
+110,209, 38, 10, 41, 44,101, 76, 22, 37,235, 48,  4,114, 20, 12,175,247,129,236,  7, 98, 26,200, 57, 98,203,174, 53, 71, 49,127,
+105,163,239,  0,148,180, 60, 69,117,  1, 40,  5,159,216,218,220, 32,250, 65,122,255,198, 16,163,136,129,162, 36, 39,209, 36,154,
+186, 18, 70, 66, 78,162, 25,205, 25,109,106,170,166,149,172, 79,150,131, 69,144, 84, 84,185,189,202, 96,209, 25, 93,218, 43,148,
+ 78,186,147,137, 67,153, 34,134,156,152, 77,  2,211,221, 41,123,123, 19,182,119, 39,120,223,179, 55,153,112,227,230,  6,175,190,
+246, 46,149,201, 60,249,153,143,240,139,191,240, 81,142,172,213,188,249,238, 13,102,179, 32, 14,  5,109,100,135,139,144,202, 12,
+ 37, 60, 85,178,231,214,138,212, 40,  6, 33,239,197,178, 11, 87, 73,106,150,100,177,166, 45, 47,175,240,208, 67, 15,115,252,228,
+113,158,249,252,231, 57,124,232, 48, 31, 92,187,202,151,190,248, 37, 62,245,233,199, 25,  6,207,141,107,215, 48, 70,115,252,232,
+113,158,126,250,105, 62,253,217,207,242,224,217,179,108,108,108,176,183,179,199,189,247,220,203,202,202, 42,103, 31,121,132,103,
+158,121,134,211,119,221,197,149,203,151,201, 41, 49,106,199,124,229,171,191,194, 19, 79, 60,193,194,226, 50, 71,142, 28, 97,218,
+117,244, 93,199,250,234, 97,126,241, 23,127,137, 79, 62,254, 56,227,165, 69,110,221,188, 65,240, 17, 74,216, 23,165, 89, 63,116,
+152,211,167, 78,177,180,176,204,211, 79, 63,205,177,163, 71,184,122,237, 42, 49,123, 78,223,117,  6,148,226,202,229, 43,140,219,
+ 17,143, 63,254,  4, 79, 61,253, 11,220,125,250,110,110,109,220,162,235, 58, 86, 86,151,121,232,225,143,178,178,178,194, 23,191,
+248,101,238,127,224,126,110,239,108,179,189,187,139,210,153,135, 30,126,144,167,158,122,138,  7,207, 62,136, 34,179,178,178,204,
+171,175,190, 66, 86,240,137, 71, 63,193,231,191,240,  5, 30,120,224,  1,186,190,103,235,246, 22, 43,171, 43,220,123,207,125,124,
+250,211,159,226,227,231, 62,198,141, 15,174, 51,157, 13,210,115, 87, 10,175, 19,231,206,157,227,153,103,158,225,254,251,239,167,
+235, 58,110,239,220,102,117,121,133,123, 63,244, 33, 62,245,248,227, 60,252,209, 71,248,224,131, 15, 88, 89, 90,225, 75, 95,254,
+ 50,231, 30,123,148, 24, 61,103,207,158,229,253,203, 87, 11,250,119,206,206,144,  9,162,178,170, 84,252,242, 65, 46, 68,149,204,
+134, 41,117,213, 16, 51, 54, 99, 64,221,137,235,231,185,192, 93,186, 33, 82, 87, 40,220,217, 36,101,215,  3,112, 71, 89,182, 31,
+252,107, 24,  6,186, 97,192,168,138,172, 51,117,227,248,204,103,159,224,196,241,227, 63, 55,218, 62,152,220,223,233, 58, 42, 88,
+ 89, 93, 69,107, 77,223, 11, 89, 11, 50,127,241,231,255,145,133,241,136, 50,179,128,108,229,164, 87,108,185,148,157, 90,215,  5,
+246,246,119,249,224,234,251,  2,161,177,178, 19, 30,252,192,238,214, 22,183,183, 54,201,103,206,160, 20,226,118,142,169,156,244,
+ 21,147,233,148,163,238,  8, 79, 63,253, 57,214, 86,215, 88, 89, 94, 62,128,240, 40,  4,125,216, 13, 83,116,118, 69,225, 90,228,
+  4,  5,152,224,123,207,214,214,  6,221,172, 99, 97,188, 40,181, 25, 34,169,235, 73,104, 26,103, 10, 70, 86,188,217,239,190,253,
+ 30, 49, 36,134,174,199,143, 60,147, 89,199,238,100,198,230,246, 54,237,104, 12,217, 49, 12,  3, 25,120,235,252,123,188,123,241,
+ 26, 91,187,  3,159,250,204, 54,135,214,215,137, 33,114,117, 99, 71, 66, 21,213, 32, 61, 85,165,193,106, 81,171, 26, 71,229, 74,
+138, 86,  9, 17, 74,219, 49,182, 25,177, 98, 21, 53,153, 48, 68, 82,233,221,103,157,113,109, 45,166, 55, 27, 49,100, 98, 82,244,
+ 29,162, 86,213,154,168,123,252, 44, 10,220,  1, 77,109, 42,162,210,  5,120,147,208, 41, 97,131, 43, 56, 94,133,170,  4,192, 97,
+146,161, 50, 25, 83, 89,130,213,204,102, 30, 87,218, 21, 58, 12,116, 94,240,176,212,154, 42, 59, 26, 91, 81,181,142,177, 89, 99,
+221,101,154,228,240,211, 61,246,167,251,236,238,236,177,223, 79, 24,178, 69,107, 67,200, 30,232,208,104, 70,163,150,217,172, 39,
+ 55, 74,234, 39, 42, 75,101,164, 42,186, 68,  4, 78,100,170, 10,167,  2,185,105,165,210,132, 17,104,137,174,136, 81, 56,249,125,
+ 31,217,153,238,179,171, 38,  2, 22,113,181,132,186,170, 76, 83,143,104,149,194,182, 14, 87, 87, 88,103,169,180,165,106, 29,125,
+212,168, 70,201, 33,200, 39,218,145,112,231,125,236,104,155,138,144, 35, 91, 67,150,238, 49,178,103, 60,180,186, 74,211, 86,228,
+ 48, 99,232,122,134, 33,177,186,180,140, 83,129,157,157, 93,110,236,122, 14, 31,185,139, 35,135, 50,215,110,110,243,254,230, 38,
+169,244,221,187,201, 54, 31,108,237,240, 15,207,189,192,199,191,252,219,152,234, 40,235, 15,156,227,226, 15,191,207,183,255,234,
+ 63,241,242,155,215,185,178,217, 99,154,117, 76,165,209, 81,225,108, 18, 93,109,138,172,214,154, 91,131,104,124, 99,204,180,149,
+101,127,214,209,119,129,198,  6,150, 22, 23,216,157,238,113,233,250, 45, 66,223, 99,109,164,109,107,210, 48,208,199, 76, 99, 12,
+174, 86, 52,203,171, 76,247,122, 54, 54, 59,180,174,209, 90, 49,182, 13,202,123,246,211,192,197, 11, 31,176, 55,217, 99,182,179,
+197,116, 71, 51,139,150,223,248,226, 23,104,234,158, 11,175,252,144, 99, 39,239,103,117,113,196,222,116,134,  6,130,182, 56,133,
+212, 74,157, 58, 24,127, 90,237, 80,102, 96,  8,129,193, 71, 28,125,121,249, 27, 98,242,248, 88,204, 93, 73,128, 49, 81,149, 67,
+171,145, 23, 57,201, 16,226, 64, 70, 51,155,205,184,250,254,101,250, 97,114, 32, 41,145,246, 76,162,174, 44, 75,163,  5,124,134,
+161,239,  5,242,161, 53, 42, 40,185,173,147,136,195, 84, 24, 13, 40, 92, 37, 19,204, 52,155,202,131, 56,231,131,110,245,124,149,
+ 23, 98, 62, 96,151, 26, 99, 72, 40, 58, 31, 32, 12,140, 70, 53, 71, 15,143,120,100,109,141,231, 94,126,155,201,172,  3, 37,120,
+225,201,100,198,159,253,245, 75, 92,188,120,131,103,190,240,  9,126,227, 75, 95,226,254,211,247,242,175,255,239,255,200,173,219,
+ 29,141, 51, 12, 49,146,148,198,149,108, 84,200, 82,115, 74, 94, 26, 64, 81,122,189,100, 12, 78, 89, 57,156, 40, 67, 76,210,137,
+214,201,178,118,232, 16,159,127,230,243,188,248,194, 11,188,248,226, 11,124,229, 87,126,149, 51,247,124,136, 31,191,244, 99, 46,
+ 92,120,135,175,126,245,215,248,224,253,247,233,186, 25,255,253,255,240, 47,121,254,185,231,249,217,171, 63,227,212,241,147,252,
+246,127,251,207,249, 55,255,230, 95,115,226,212, 73, 62,249,169, 79,243,195,151,126,200,243,223,251, 30, 95,252,242,151,249,210,
+151,190,200, 95,254,167,191,228,107, 95,255, 58,219, 59,183,121,225,185,239,115,238, 19,143,241,200, 35,143,240,135,127,240,135,
+244, 93,199,239,252,238,239,242,194,247,159,231,103,175,191,206, 39, 30,123,140,103,191,246,117,254,253, 31,253,145, 92, 86, 11,
+154, 54,164,192, 61,247,222, 67,223,205,248,193, 11, 47,240,224, 35,143,240,236,111,254, 38,127,242, 39,127, 84,194,128,242, 26,
+249,210,175,252, 42, 74,193,139,223,255, 62,199,142,159,224, 95,253, 47,191,203,191,253,183,255, 39,203,107,107, 60,243,204, 23,
+248,241,143, 95,230,  7, 47,190,192,131, 15, 62,196,111, 60,251, 44,191,255,251,191,207,253, 31,186,135,175,252,242, 87,249,187,
+191,249, 27,218,113,195, 47, 60,253,  5,174, 95,187, 70,214,150, 39, 30,255, 52,103,207,158,229,123,223,127,  1,149,224, 55,159,
+253, 77,254,244,255,253,127, 80, 74,243,181,175,127,141,111,253,195,183,184,185,113,147,205,157,109, 89,231, 58,139, 15,153,207,
+ 62,241,  4, 15,159,125,144,239,191,248,  2,117, 93,243,236,111, 60,203, 55,190,241,103,164, 12,191,249,181,175,243,205,239,124,
+139,217,  7, 51, 38,211,  9,255,234,119,126,135, 31,188,248,  3, 54, 55,183,120,242,201,207,113,252,196,  9,158,127,225, 69,121,
+ 45,134,242, 89, 18,181,155,196,244, 50, 18,146,116,160,188, 44,128,180, 42,157,247,161, 96,102,133,240, 86, 75,160, 34,249,162,
+244,147,126,122, 44,123,  0, 40,168, 88,163, 15,160, 14,  2,  1, 40,138, 82, 93,106, 50, 89,198, 52, 73,203,184,224,200,225, 35,
+156,123,244,220, 29, 78, 65, 89,202,231,210,215,156,159,108, 81,200,237,  0,136, 74, 49, 26,183, 34, 82,152,236,241,230,249, 55,
+ 75, 64, 73,  9,123, 56,  6,178,181,  7, 96, 96, 85,122,184, 41,  6, 97,214,151, 63, 77,105,141,115, 21,149,173,176,206, 29,168,
+ 52, 85, 10,100,  6,121,233,105,205, 51, 95,122,134,207, 63,245, 11, 84, 85,197,165,139,151,216,218,186,205,233,211,167,208,218,
+149, 94,101, 42,105,119,233, 32,230, 50, 14,148,127,  6,139, 15,  6, 87,143, 75,221, 68, 94,176,182,174,168,219, 86,118, 89,138,
+131, 42,  3, 74,106, 77,115, 20,107,209,178,136,190, 52,201, 13, 68, 68,  1, 98,234, 73, 62,224,251,158,190,159, 72,195, 32,  4,
+250, 97, 96,111,103,155,172,164,183, 98,172, 17,217,142,173,217,179, 34,221,153, 51,128,229, 33, 35, 45,  1, 91,239,163,180,161,
+177, 22,159,  2, 42,205, 57,  0,208, 52, 51,185, 81, 86,  6, 21, 13,117,169,242, 77,251, 40, 56, 69,157,240, 67, 64, 41, 75, 85,
+ 27, 22, 26, 69, 50,137, 24,132,107,157, 76, 64, 59,135, 69,112,181,189,151, 17, 93,180,208,186, 26, 93, 87, 76,189,167,113,178,
+106,209,217,200,195,167, 86, 84, 24,233,221,151,163,158, 82,145, 16,133,247,239,156,130,122,204,120,212,176,122,248, 24,181, 26,
+216,219,159, 48, 75,137,105,223,139, 33,175, 31,216,153, 14,212, 86, 51,  4,161, 61, 25, 35, 39, 90, 93,183, 50, 22, 47, 93, 80,
+ 31,130,220, 86,138, 65, 42,230, 32,184,199, 44, 35,184,136,193, 56, 49,152,169,156,208, 22,148, 46, 13,134, 33,179,191, 63, 48,
+ 53, 14,179, 39,176,162, 62,120,180,179, 52,166, 66, 27, 73, 64,187, 90,126, 38, 86, 27, 70,163, 49, 33,201, 46,119,186, 55,225,
+246,222, 77,102,222, 75,141,203, 56,112,  6, 31, 20,166, 24,129,117,134,253,233,  4, 63, 12,204,186,204,214,214,148,189,157,203,
+172, 44,142,248,248, 67, 39,152,254,108,155,119,223,219,226,232,177, 35,244, 65, 32, 44,231,127,250, 10, 63,252,251, 63,230, 51,
+ 95,253,223,192,173,241,227,239,191,196,115, 63, 56, 79,175, 42,252,224,217,155, 94,167,235, 67,105, 96,136,229,238,214,230, 62,
+231, 30,248, 16,211,219,123,236,238,205, 24,114,148, 61,222,176, 79, 99,165,101, 32,135,102,205,133,183,223,230,240,250, 10, 74,
+107,169,111, 26, 73,163, 55,203,203,220,117,239, 71,120,247,226, 21,250,201, 69, 54,110,190,143,143,153,181,229,  5,188,247,180,
+173,168, 95, 39,211,125,182,183,110, 49,155,116, 56, 11, 27, 23,206,115,254,220,199,121,242,137, 39,184,253,250,139,156, 30,117,
+220,115,230, 56,223,125,241, 21, 92, 37, 14,121,149, 21,202,  7, 49,175,233, 92,238, 17,129, 58,151,230, 66,206,168, 90,190,235,
+ 54,102,114,182,100, 21, 15,112,190, 89,105,  8,162,255, 53,  5,  8,163, 82,194,228,132,198,177, 51,155, 66,234, 75,130,184, 16,
+251, 82,192, 89, 35,141, 12, 91,161,163,103, 24, 96, 54, 29,176,149,129,  4,253,224, 89,104,107,214, 86, 86,216,220,155,208,245,
+ 51,178,113,132,148, 57,180, 60, 38, 87, 99,118,111,111, 82,215, 53,211, 94,120,  6,115, 34,103, 78,137, 20,  2,222, 42,188,239,
+197, 58,151, 51,125, 52, 92,221,152,114,252,216, 81, 78,158, 58,204, 91,239,188, 47, 45,135, 98,105, 91,168, 35, 75, 85,228,198,
+ 91,175,243,205, 56,227,217,175,125,157, 84, 25,254,247,255,235, 27,236,237,246, 24,167,255,127,166,222, 52,216,178,235, 60,207,
+123,190,181,214,222,251,156,123,251, 78,221,104, 52, 26, 35,  1,130, 19, 32,138,  4, 64, 82, 17, 73, 81,164, 56, 72, 10, 45, 74,
+178,108,201, 42,197,150,172,216, 41, 37,229,196,170, 56,131, 83,138,203,145, 83,149,164,146, 42, 87,156, 74, 92, 21,199, 81, 36,
+ 69,214, 96, 81, 49, 53,154,179,197, 73,148,  8,128, 32, 49, 17, 32,129,198,220,243,157,239, 57,103,239,189,134, 47, 63,190,117,
+ 78,235, 23,170, 64,176,251,222,115,246, 94,235, 27,222,247,121, 17, 95, 35,179,213,138,100, 23,172,115, 39,218,196, 67,189,237,
+253, 77,  9,111, 76, 14, 19,155,155,  2,187,148, 76, 63, 95,240,229, 47,127, 25,213,194,195, 15,127,141,181,233, 26, 95,123,248,
+ 17, 68, 51, 15, 62,248, 16,155,219,155,156,188,118,204,239,255,155, 79,240,248,227, 79,160, 10,123,215,246,248,224, 15,126,216,
+ 92, 55,120,158,123,238, 57,190,242,133, 47, 26,123,224,211,159,226,251,223,247,126,206,220,116,154,157,211, 59,252,250,175,255,
+ 26, 94,225,249, 11, 23,184,245,214, 91,  1,229,190,183,126, 23, 79, 60,241, 56, 95,249,234,151,209, 12, 23,158,253, 54,191,248,
+ 95,252,  3, 78,111,159,102,239,112,175,142, 60,236,242,216,219, 63,224, 19, 31,255, 56, 73,149,231, 46, 60,207,127,250,159,253,
+125,182, 79,109, 87, 85,190, 99,103,231, 52,183,221,118, 43,255,219, 63,251, 95, 17,224,194,243,223, 97,123,103,155,251,223,114,
+ 31,135,135,251, 44, 22, 11,190,244,249,207, 83, 92,224,197, 23, 95,228,151,254,209, 63,194,139,231,205,247,223,207, 23,190,240,
+121,190,245,237,167,201,201, 92, 76,247,221,119, 31, 57, 37, 30,120,251,131,252,230,191,250, 13, 91, 69,229,194,100, 58,225,190,
+251,223,202,211, 79, 63,205,165,139, 23,249,202,151,191,132, 11,246,174, 24,197, 48,131, 56, 30,122,224, 65,126,243, 55,254, 95,
+174, 31, 92,131,228,113,234,185,239,254,251,121,234,201, 39,185,120,241, 34, 95,254,210, 87, 64, 51, 15, 61,248, 16, 79, 61,245,
+ 20, 95,250,210, 23, 81,133,139, 23, 95,225,239,255,226, 47, 26,177,213,122,235,250,251,155,118,130, 98,218,  7,105, 28, 37, 89,
+ 74, 40, 75, 30,203,  0, 75, 29,127,208,146,137, 85,172, 96, 10, 64,111,212,164,186, 47,200,117,167, 98,192,132, 82,237,  8,144,
+147, 33,254,168,151, 75,142, 35,109,215, 48,157,182,104,236, 81,231,185,231,245,175,227,212,169,117,170,147,178,238,164,100, 57,
+164,170, 74, 69,152,205, 23, 92,189,114, 29,  9, 83, 26, 41,108,109,110, 25, 54, 85,108, 68,105,250,140,154, 38,180,196,  6, 46,
+113, 70,152, 49,223, 59, 87, 19,114,204,118, 97,200, 68,139, 99, 21,220,106, 77, 81,234, 63, 53,101,206,158,187,153,119,127,207,
+247,208,181, 45,179,197,156,223,253, 55,159,224,228,232,152, 55,223,247,102,227,149,139,224,212,155,104,170, 84, 27,153,234,106,
+119, 86,242,200, 24,231,228,146,150,142,254, 10,132, 48, 80,134,235, 28,139,113,164,143,  3,155, 34,180, 77,224,182,243, 55,241,
+210,203,175,145, 83,172,107, 12,106,218,143, 85,207,243,249,204,252,172, 34,108,110,109,129, 56, 54, 55,182,152,174, 77, 76,140,
+134,169, 39, 87, 54,153, 88, 72,149, 53, 47, 67, 38,  5,111,138, 88,245, 72,163, 52,  8,139,146,152, 42,148, 28,153,155, 80,147,
+105,219, 50,148, 25,130, 99, 54,247, 70,113, 59,194, 58,247, 96,227,200,226,177,253, 79, 35,196,197, 72,112, 29, 99, 76,204,230,
+115,124,177,189,183,184, 64, 74, 61, 90,253,251,173, 52, 72, 73, 56, 23,144, 86, 25,128, 60,159,145,163,128,180,204,226, 96, 23,
+169,120, 82, 73, 38,244,201, 19,  6,159,  8,190, 16,180, 48,142, 61,125,239, 24,214, 39,164,133,229, 97, 75,227, 40,210, 48, 61,
+181,197, 68, 11, 55,109,121,124,235, 88,159,116,204,102, 11,250,225,136,249,241,192,225,124,134, 43, 16,211,192, 60,  1, 57, 18,
+ 51, 76,186,134, 92,  2,174,245,196, 88,200,163,173,147, 20,191,114,120,204, 98,162, 41,158, 70, 45, 40, 34,229,108,142, 65,239,
+153, 52, 19, 74, 19,153,167, 17, 47, 30,146, 80,226, 72,236, 23,196,165,128,211, 53,168,135, 20, 19, 93,215,113,112, 50, 35, 13,
+ 54,150, 91,151,200,238,238, 62,154, 11, 15,222,127,  7,175, 94, 57, 38,247,115,174,238, 31, 27, 11, 62,180,196,148,107,208,136,
+114,122,171,227,149,203,215,185,231,246, 51,188,233,222, 29, 62,246,227, 31,225,179, 95,253, 22,170, 48,164,194, 56,159, 51,117,
+ 74,154,174,241,201,223,255, 12, 15,125,240,163,140,243, 93,254,221, 87,191,201, 81,182,124,237,181,233,212,132,110,249,132,212,
+219,251,148,178,146, 74, 79,241, 19,110, 58,119, 51,131, 94,195, 13,137,152,146,141,213, 91, 33, 70, 75, 71,115,206, 83,134,129,
+126, 88,208,122, 19,164, 22,133, 51,103, 78,179,118,250,118,158,122,242, 41, 78,246, 46, 49, 13,193,  4, 98, 46,115,254, 84,192,
+ 77,  3, 87, 14,102,108,  1,187, 71,  3,187,251,251,180, 14,134,177,112,106, 99,157,135,191,246, 23,236, 31,244,124,239, 59,223,
+206,133,151, 95,225,153, 87,175, 17, 53,227,138,171,197,135,163,196,190,226, 69, 45,221, 74,193,220, 15,134,225, 38,132,186,106,
+ 41, 53,187,161, 13,168, 54, 56,108,226, 50,233,108,244,141, 40,190,  8,185,115,132, 98,103,194,152,122,214,167,235,136, 12,244,
+101, 94,225, 41, 98,250, 15,129,249,176,176, 96,170,106,101,114,  4,155,254, 84,235, 83, 82,165,105, 45,238, 54,142,137,156, 70,
+ 38,235,183,112,253,100,160,228, 68,206,222,132,100,213, 62,183,236,224,231,195, 72, 72,201,220, 87,197, 98,136,219,201,132,253,
+147,145,175,126,243,121,138,192,198,116, 66, 28, 35,139,177, 71, 69, 57, 56, 25, 57, 92, 12,252,196,207,252, 36, 67,241, 92,184,
+248, 24, 15,222,247, 22,238,126,195,157, 60,242,200,179,172, 99, 83,136,172,  6,209, 81,148, 50, 70,115, 84,145,200, 56,124,242,
+ 72,181,247,225,151,140,112, 40, 53, 88, 69, 75, 97,111,127, 31, 77,181,227, 18,199, 98,222,155, 27, 64,165, 90,216,148,217, 98,
+206,230,246, 54,127,251,231,127,150,215,223,251,  6,246,247,247,172,137, 42, 22, 49,188,191,183, 91,201,115,181, 40, 20, 56,189,
+189,195,254,254,158,101, 67, 84,129,219,254,222, 30, 14, 88, 95,155,114,112,184, 79, 74,245, 59,246,142,189,189,125,118,118,118,
+184,190,127,221,166,195,106, 94,246,253,253,253, 21,245, 78, 11, 28, 30, 28,176,115,211,233, 37,124,129,173,157, 29, 78,159,222,
+225,191,251,229,127,178, 98, 50,168,194,231, 62,251,105, 14, 14,224,240,240,208,162,181,151, 89,242, 98,105,115,155,219, 91, 60,
+249,228, 83,245,215, 22, 14,246,247, 87,179,228,173,157,109,254,227,191,247,247,234,221, 97, 75,141, 11, 23, 94,192, 57,232, 23,
+ 11,187, 80,107, 49, 46, 42,104,177,198,109,123,123,139,171,215,119,107,220,108,230, 96,239, 42,247,221,255, 38,  0, 22,139,222,
+138, 45, 17,214, 38,211,250, 25, 26,205,117,255,240,160, 78,175,171, 78,173,162,129, 69, 13, 64,102,214,110,203,102,151, 98,  1,
+106,  2,164,100, 33, 42, 78,140,114, 25,172,147, 44, 43, 31,171,171,108, 97,169,220, 93,241, 21, 69,103,131,222,213,101,146, 43,
+143,215, 55, 75, 59,  2, 76, 39, 29,231,207,223,194,115,207, 93, 96, 18, 26,238,184,227,246, 21, 74, 80,111,  0,112,107, 55, 74,
+181, 58,  8,223,248,230,227,188,248,226, 75,148,146, 89, 95,159,112,231, 29,119,114,237,218, 46,135,123,135,136,179, 81,178, 69,
+102,130,175, 23,116,169, 18,124,131, 12,228, 26,129,169, 21,223,103,128,  6,205,149,100, 84, 31, 74, 86,138, 79, 99,133,119, 93,
+ 71,215, 78, 64,132, 54,180,188,239,189,239,166, 13, 45,147,182, 93,233,  6,134,126,176, 23, 69, 35, 69,219,106, 97, 88,254,205,
+102,115,147, 26,197,104,151,122, 38,143, 35,195,176, 64, 70,184, 30,175,113,225,194, 11,220,124,246,102,124,211,242,253, 31,248,
+  1,190,243,204,179, 76, 38,147,213,207, 21,176,252,230,158,196, 43,175,188,200,  3,111,127, 27,226, 28,111,126,203, 27, 57, 62,
+ 57,226,117,119,221,197,218,100, 13, 69,185,124,245,178, 21, 59,197,142,152, 88,168, 98, 24, 75,145,138,201,128,  5,129, 12, 17,
+162, 51,  5,232,108, 54, 95,229,175,151,152, 25, 92,193, 23,227, 36,107, 84,198,216,161, 69,240, 94, 73, 62,144, 37,210, 56,243,
+206,151, 28, 40,234,232, 99,161,173, 93,116,193, 49,230,140, 11,  5, 70,165, 72,198, 47, 50,210, 22,146,102, 74,233,105,131,103,
+108,243, 82,158, 65, 91,249,210,234, 50,195,112, 66,142, 48,115, 74, 84, 11, 43,112,226,  9, 26,235,200,201,163,243, 57,206,  6,
+246,140,110, 32, 52,150, 52,229, 27,207,164,181,140,224,125,233,193,123, 54,167,167, 57,211,  5, 54,157,137,172, 38,206, 83,162,
+144,211, 17, 39,  7, 11, 22,140,164,146,153,207, 51,139, 18,201, 19,195,230,246, 99, 98, 99, 99,194,108, 62, 50,241,158, 73, 59,
+197,209, 26,224, 65, 50, 50, 22,102,125, 66,241,228, 86,153,166,204,252,164, 71,139, 37,219,133,154,157,172, 21,228,161, 41,209,
+122,155, 28,  9,  9,135,103,236,  7,240,  3, 39,139, 57, 41, 38,246,199,142,211, 59,107,136, 43, 92,187,118,149,211,103,111,101,
+107,218,112,114,120,196,124, 62,103,214, 71, 78, 78, 50,109,  3, 15,221,127, 23,239,126,255, 59,120,248,241, 87,120,229,165, 75,
+184,233, 58,123,187, 39, 56,137, 52,211,134, 44, 29, 79, 63,251, 18,159,250,248, 39,184,245,220,  6,143, 63,241, 60, 81, 27, 38,
+147, 53,206,108,111,242,234,222, 49,195, 56,212,247,207,222,135, 84,224,248,164, 39,208, 49, 38,165,237,188,225,131, 21,242, 34,
+147, 20,114, 92,224,167, 22,116,113,120,176,224,244, 78, 67,210, 58, 13, 11,235,188,250,226,139,204,246, 46,130,115, 36,129,233,
+ 90,199,209, 73,102,109, 13,142,162, 50, 31, 10,221, 52, 67, 25, 89,204, 23, 72,215,226, 61, 52,190, 97, 56, 60,224,243,159,250,
+255,120,230, 91,223,225,254,183,190,158, 23, 47,188, 12,177,208, 87,  2, 94, 46,166,209,241, 24,244,163,  4, 83,254, 22,212,254,
+ 71, 47,148,161, 22,210,106, 69,191,177,206, 21, 95, 49,163,131,179,134, 32, 52, 38, 80,115,206,194, 55,146, 22, 82, 30, 43, 55,
+189, 30,160, 73,153, 76, 26, 16,161,239, 45,  0,102, 32,174, 32, 31,139,190,199,187,128,115, 98,184,220,190, 71, 40,116,109,203,
+ 48, 30, 83, 74,102,247,112,198,108, 62,163, 81, 88,159,182,184,209, 19,135,113, 21,214, 33,197,206, 35,138,  1,170,186,224,217,
+218,220,164,109,215,137,195,156,221,253, 35,110, 94,119,156,187,249, 44,179, 94,185,126,120,192,222,193,  9, 57, 23, 30,125,242,
+ 53,126,255,143, 31,229,223,255,177, 31, 70,153,115,117,247, 34, 49,205,  9,222, 38, 47,146, 18, 46, 88,116,182,171, 23,139,  5,
+ 53, 25,231,222, 68, 79,118, 49,132,154, 94,169,146,241,206,254, 93, 74,169,230,126,231,218, 56,104,197,122, 85,184, 87,221,237,
+190,227,157,239,228,187,222,122, 63,159,255,204,167,248,215,191,245, 27,168,115,252,210,127,251,203,134, 71,174,177,159,133, 92,
+119,189,118,214, 31, 47,230, 76, 39, 19, 91, 13,  8, 56, 28,211,233,212, 68,119,138,189,111, 90,106,246,136, 99,251,244, 14,243,
+197,188,226,111,117,101,111,155, 78, 38,166,183, 47, 86,168,117,147,  9,243,217,192,210,248,213, 47,230, 92,186,120,153,127,249,
+ 47,254, 79, 82,205, 47, 57,125,102,155,253,107,251,220,115,239,189, 43,226,227,106,146, 93,193,236,253,188,103, 50,157, 88,241,
+142,208, 77, 38, 54,133,117,142,190,239,249, 63,254,249,255,206,241,225,140,148, 34, 27, 27,107, 32,194,173,231,206,215, 65,113,
+ 77,253, 19,123,182, 52, 89,  2, 95,191,232,153,118, 83,250,197, 12, 16,182,207,156,102,177, 88,212,233,180, 82, 72,160, 30, 42,
+116,202,176,229,133,105,219,173,156, 19, 22,  9,172,213, 15,159,168, 29,150,233,209, 42,180, 38,167, 82, 17,179, 86,144,160,222,
+242,212,181,233,108,236,141,237,167, 92,229,185,107,181, 14, 52,206, 60,144,212, 47, 92,212, 30, 18,215, 52, 85,198,111,200, 82,
+245,133,163,227, 99,222,254,214,239,230,235,143, 61, 70,142,118,  0,172, 88,  0,220,216,169,203, 13,108, 48, 79, 63,253, 45, 62,
+247,217,207, 49,244, 11,  0,238,184,253, 94,206,159, 63,207, 99,143,125,157,197,124,142,107,172, 10, 85, 17,154,106,147, 16, 47,
+108,158, 58,133,170,208, 52, 45, 93,215, 85,181,169, 65, 93, 16, 88, 91, 91,195,183, 70,247, 89, 91,219, 88, 77,  5,214,166,107,
+ 86,153,  3, 87,175, 92,231,169,167,159,228,161,  7, 31,164,105, 26,190,231, 93,239,188,177, 18, 80,229,217,103,159,229,210,229,
+215, 86, 84, 50,239, 29,211,233,250,114, 80, 76, 55,105, 45, 90, 80,149, 73,215,161, 57,211, 52, 85,193,153,199,138,169, 21,190,
+248,133, 63,229,236,153, 29,238,126,253,189,188,238,206,215,113,247,157,119, 91, 88, 69,125,120, 36,212, 62, 63, 41,223,124,226,
+113,238,186,235, 78, 30,120,224, 65,110,190,233, 44, 31,253,161, 31,102, 89,190,236, 94,191,206,231, 63,247,185, 21, 87, 36, 85,
+ 42,185,  0,  0, 32,  0, 73, 68, 65, 84, 56,103, 83,155,106, 42, 20,103,  7, 92,168,214,165,168,201,226,249, 90, 33,212,128,139,
+ 88,140,  3, 45,163, 67,163,101,121,139,183, 23, 74,147, 85,242,226,  3,195, 88,234, 32,103, 32,201,136, 74,139,138,141, 18,135,
+ 21,176, 71,241, 94,104,106,151,147,139,199,251,150,121, 30,235,132, 67, 72, 73,209,184,168,160, 14,101,196, 81,198,108,  9,109,
+ 94, 44,236, 64,139, 65, 97,178,128, 75,228,138,226,197,103,130,122,188,100,178, 75, 44,134, 64, 19,172,115, 26,143, 35, 39, 50,
+ 82, 68,105, 53,160, 90,216,239,214, 16,175,120, 39,132,110,194, 70, 59,165, 11,  5,165, 69,167, 19, 38,226, 16,159,105,221, 17,
+ 93, 59, 50, 12, 35, 39, 39, 71,228, 49,115,180,159, 25,213,114,214,231,169,224, 92, 98,218, 56,114,104,105,214,  2,161,174,160,
+ 38, 77,131,134,134, 70, 96, 24,212,226, 42,199,194, 24, 19,217, 69, 74, 30,193,121,166, 77,135,150,196, 16, 35, 41, 13, 12,195,
+192, 66,199,154,101, 32,188,242,194, 43,188,238, 14,227,124,199,210,112,215, 29,111,198,135,194,198,153,145,245,105,224,242,197,
+139, 60,255,157,111,115,102,251, 38,110, 62,115,134,173, 83,103,249,157, 47,253, 62,187,179,158,105, 76,140, 53, 40, 99, 62, 52,
+204, 19,180,120,126,243, 87, 63,206,250,198,148, 69,  9, 70,191, 42,  1, 92,199,108,118,141,188,228,160,171, 88, 20,111,202, 92,
+ 59, 60,100,226, 61,179,197, 72,108, 45,155,154, 98,226, 46, 98, 33,  2,218,143, 43,109,202,201,236,152,174,221,198,187,  9, 47,
+ 95,120, 30,193,236, 61,113, 76, 40,176, 62,157,208,239,101,190,125,113,143,243,119,220,201,214, 90,  7,149,142,184,179, 53,178,
+119,176,199,100, 98,239,230,113, 63,208,118, 83, 94,120,254, 49, 46,188,248,109,114, 28, 56,123,102,199,108, 99,165,208,143, 38,
+ 46, 84,204, 27, 61,206, 45,129,141, 38, 17,  8, 53,  2, 20,150, 91, 56,139, 44,182,255, 36, 75,134,177,142,149,115,180, 60,245,
+ 96, 93,187,247, 66, 63, 36,134,249,136,147, 42,110,115,182,110, 92, 91, 55,113, 95,138, 70, 63, 27, 83, 68,181, 88, 98, 89,201,
+ 21,170, 20, 88, 12, 25,215,220, 80,182,123, 31, 32, 23,242,120,130,230,209, 64, 82,237,  4,113,202,113, 76,117,167, 93,105,101,
+ 40, 57, 91,172,231,100, 58, 33, 23, 56, 62, 57, 50,148,111,211, 82,180, 16,211,  2,245, 27,108,108,156,161, 31, 18,251,251,187,
+ 36,214,249,213,223,251, 42, 95,254,250,243,252,212, 15,189,139,205,187,119,120,249,210, 30, 67, 31,201,109, 85,143, 71, 91,131,
+150,162,  4, 41,181, 40,213,154,122,153,172,171,202,133, 88, 59, 88,106,178,161,174, 56,238, 90,227,170,235,116, 83,171, 54,168,
+ 78, 88,181, 40,211,201,132,189,235,187, 92,248,206,183,217,186,233, 12, 31,248,192,135, 77, 60, 90, 69,109,203,115,211,126, 95,
+179,220, 93,185,244, 26,221,100,194,  3, 15,189,131, 71, 31,249, 58, 15,189,243, 33,206,223,118, 43,197,  9, 79, 60,241, 36,191,
+240, 11,191,192,139, 47, 94,224,194,243,207,241,125,223,247, 94,  4,184,120,241,181,202,135,175,154,111, 39,156,191,245, 86, 30,
+120,240,237,124,253,145, 71,120,239,247,189, 15, 69,120,229,213, 87,120,221,221,119,225,189,227,242,165,139,116,147,142,239,125,
+207,187,249,202, 87,190,204,206,233,109,254,131,191,245,115,252,241, 31,252,145, 85, 15,214,146,214,181,228, 82, 68, 47, 60,251,
+236, 51,188,231, 61,239,230,202,213, 43,140,139,  5,223,251,158,247, 48,246, 61, 72,225, 91, 79, 63,205,  7,222,255,  3,124,234,
+147,159,165,107,  3, 31,253,232,143,112,233,242, 21, 46,189,246,234,138,135,103,184,219, 92, 31, 67,155, 34, 60,245,244,183,248,
+240, 71, 62,196,103, 63,247,105, 38,109,199,131, 15, 62,196,163,143, 61, 86,237,226, 54, 89, 86,129, 39,191,245, 52,255,209,223,
+253,187, 60,241,244, 19, 92,190,116,145, 15,125,248, 35,149,250,103, 22, 65,155,244, 84, 18, 31, 25, 79,176,117,158, 22, 52,171,
+133, 18, 81, 44,166, 68,160,120,143, 58, 71,112, 98,203,117,173, 99, 89,205,213,129, 88, 76, 93, 89,106,120,189,136,199,137,137,
+ 48,124,107,248, 68,239, 44,252,192,212,239,153,111,124,227, 27,124,224,251,223,207,125,111,186,159,111, 60,254, 56, 15,127,237,
+ 81,110,185,229, 28,183,156, 59, 87, 31, 36, 89,141,169,143,103, 39,124,227,177,111,242,133, 47,126,145,189,131,  3,156,111,105,
+ 59,207, 15,252,192,251, 57, 56, 56,228,137,167,158, 33,180,193, 44, 85,110, 82,247,101,105,165, 98,125,230,153,111,115,243,222,
+  1,185,100,174, 95,223,197,169,178,183,187,203, 83, 79, 61, 73,211,182, 92,187,118,165, 30, 56,153,239, 60,255, 29, 82, 21, 66,
+ 93,189,118, 13, 23,  2,154, 97, 76,202, 31,253,201, 39,217,219, 61,228,182,219,110, 99,109,173, 35,101,136,105,228,213, 87, 94,
+227,171,127,254, 53,250,209,114,152, 29, 66,142,133, 11, 23, 46,216, 40, 62, 39,174, 92,190, 82, 71, 85, 51,158,122,250, 41,182,
+183,182, 56,153,157,208,207,143,241,212,128,144,  2, 87, 46, 95,226,183,127,231,183,248,238,239,122, 27, 55,157, 61,203,198,230,
+ 38,247,190,225,141,180, 77,107,150,156,168,228,226,209,146, 57, 56,232,249,195, 63,249, 12,151,175,238,113,247, 93,119, 50,153,
+ 76, 40,165,112,125,247, 58,143, 61,242, 40, 47,190,252,146, 81,209, 74, 21,132, 21,115, 44,148,  8,193,219, 88, 27,103, 73, 71,
+185,250, 37,221, 50, 42, 80,149,210, 71,227, 16,120, 43,149,131,111, 72, 49, 35,100,130, 55,240, 80, 78, 74, 23, 26, 74, 13, 30,
+ 42,244,132, 98, 92,230,162, 16, 75,169, 80,  9,207, 80,172, 43, 16, 45,228,208,153,  6, 65,116, 85, 92, 45, 55, 52,190,142,  8,
+157,122,164, 21, 36,218,248,107, 25,115,153,180, 16,196, 17, 38, 30, 25, 12, 23, 58, 82, 17,142,201, 82,210, 92, 12,102, 51,169,
+233, 76,173,179,191, 35,247,137,156,102,102,137, 41, 45,101,152,115,181,233,  9,174, 69,226,136,107, 10,158,214,146,244,138,167,
+235,214,153,156,218,226,230,155,206,226, 53,115,180,152,147,115,100,118, 50,103,136, 35,125,138, 68,109,  9,100, 74,130,182,107,
+ 77,135,160,224, 75, 96,107, 99,147,241,148,209, 23,211, 80, 42, 75,220, 56,239,243, 56,210,199, 76, 28, 70, 75,126, 18,251, 94,
+ 36,183, 76,214,  3, 18, 61, 46, 24,107,122, 57, 93, 58,238,231, 28, 31,238, 18, 83, 97, 58, 93,227,228,224,152,118,218,177,177,
+ 57,225,212, 70, 96,125,210,114,253,210,101,206,157, 59,203,155,239, 62,207,241,188,231,100, 62,227,240,224,152,235,215,119, 89,
+235, 90, 14,143, 14,233, 95,182,113,171, 77,162, 58,134,177, 48,237, 90, 14, 79,230,150, 48, 86,108,127,170,197, 52, 44,210,182,
+148,162, 44, 22,  3,211, 54, 48,196, 76,209, 96,135,186, 56,211, 61,120,181,231, 52,142,104,152,112,125,247,128,137, 47, 36,245,
+104, 74,148, 26,128, 19, 99,164,168,242,226,165, 99,166, 27,137,227,147,  5,107,109, 98,136,133,141,245,117,218, 70, 56,153, 29,
+ 18,112,196,156,137,125,100,218,174, 49, 12, 61,107,235, 27,156,218, 58,101, 48, 14, 50,139,126, 36,231,194,164,245,164,100,150,
+181,156, 11, 82, 18,153, 76,204,142, 76, 54, 11, 39,150,127,157,  8,171,117,157,171,132,178,226, 76,232, 89,212, 16,180,154, 61,
+227,162, 39,167,  8,193,145,114,166, 20,165,105,150,184,102,161,235,166,136,239,208,161, 39,165,145,156,122, 20,216,108,  3,125,
+ 52, 11,154,171, 88,106, 87,247,  2,147,174,  1,223,208, 71,203, 25, 80, 85,124,227,140,171, 81,173,102, 94,164,  6, 98,153,160,
+200,148,205,217,236,151, 69,241, 56, 94, 61,158,115, 60, 36,182,182, 44,  4,234,129, 55,222,198,241,201,  6, 47, 94,222, 39,162,
+ 60,252,228, 75,244, 39,  7,188,237,161, 55, 51, 63,152,161,197,208,207,134, 46,  5,145,130,198, 66, 12, 38, 14,109,156, 53, 64,
+185, 88,200, 80,112,158,236,148,148, 13, 78,163, 75,108,108, 69,145,230,234,199, 86,189,145,145, 94,170,250, 58,229,204,159,127,
+229,207,249,153,191,245, 55,249,229,255,225,127, 98, 24,  6,190,241,200,215, 89, 44, 22,108,109,239,172,210,199, 88,170,178,197,
+172, 86,168,240,187,191,253,219,124,244, 99, 63,202,143,124,236, 99, 60,247,220,115, 92,124,237, 34,154, 11,123,187,123,252,225,
+ 39, 62,193, 71,255,202,143,176,115,122,135, 23,158,191,192,239,253,238,239, 34, 78,120,221, 61,247,240,125,239,125, 31,191,246,
+107,191,142, 20,229,226,107,175,113,223, 91,238,231, 99, 63,242, 49,158,127,225,  2,127,252,135,127, 88, 87, 27,134,136, 45, 42,
+124,252,119,127,135, 15,126,232,195,124,240, 67, 31,166,239,123,190,242,103,127,198,133, 11,207,113,207,189,111,184, 17,207,172,
+206, 82,212,234, 52,250, 91,207, 62,205,246,214, 38, 63,255,243, 63, 15, 10,207, 60,253, 12,219,167,183, 17, 45,124,254,243,159,
+225,  3, 31,252, 16,255,240,191,249, 47, 65,225,177, 71, 31,225,209,135, 31,230,214, 91,207, 87, 53, 84,237, 82, 11,252,227, 95,
+254,199,252,147, 95,254,239, 81, 41,124,246, 51,159,225, 35, 31,250, 32,255,245,127,245, 15, 89, 44,122,190,242,229, 47,241,200,
+195, 95,227,158,215,223,  3, 42,213,227, 14,251,215,175,243,153, 79,127,154,159,250,235, 63,197,233,157, 29,190,244,165, 47,175,
+216, 48, 69,132,162,182, 26,172,128,118,242,114,191,238,107, 84,150, 24, 97, 14, 95,179, 13,234, 32, 75,238,184,235, 77,234,234,
+222,199,215,228, 44,139,223,171,163,248,186, 75, 50,142,185,  3, 47,182, 47,173,121,212,154, 13,220,129,100, 78,159,222,228, 63,
+252,217,159,197,225,248,149, 95,249, 21,174, 92,189,198,109,183,221,198, 91,222,252, 38,206,157,191,149,233,116,194,108,126,194,
+149,203, 87,120,254,197,151,120,229,197, 87, 25,135,222, 88,203, 18,248,193,143,124,128,143,254,240, 15,241,111, 63,249,105, 62,
+251,217, 63,181, 42, 68, 11,162,  1,117, 38,166,210,154,175,179,182,190, 78,  8,230, 43,141, 99,102,140, 54,238,157, 78,215, 16,
+111, 97, 16,179,249, 12,205,194,100,109, 74, 55,233,172,211,236,  7,134,161,167, 20,135,247, 53, 92, 65, 60,167, 78,173,153, 74,
+ 57, 42,195, 56, 48,159,207,205,115,219,184, 21,201,168,196, 68, 55,153,208, 77, 38, 80, 10,139,177,103,236, 35,136,209,182, 90,
+223, 80, 92, 97,113, 60,179,232, 69,111, 95,253,250,250,  6,222, 11,195,252,  4,212,241,206,119,189,131, 31,251,171,127, 13, 39,
+176,191,187,203,255,253, 47,255, 47,174, 92,189, 94, 87, 27,134,155, 36, 11,235,155,155, 52,221,  4,124, 97,152,207, 73,139,158,
+236,148, 46,152, 47,149,224,106,193,149,209,100,  2, 39,156,141,177,141,113,109, 99,114, 85, 59, 36,100,153,113, 28, 26, 19, 15,
+ 57,235,180,137,133,210, 86, 55,100, 78,181,219,240,228,108,194, 72,245, 74, 43, 70,154, 42,165,224, 52, 24,178, 87, 50, 37,103,
+180,  9,184,  2, 37, 26,186,214,  7, 99,169, 91, 30, 57, 52,117,204,153,171,247,212,139,183, 40, 92,  2,173,168,237,253,154,218,
+ 17,213,135, 58,169,249, 91, 67, 48,226,155, 20, 79,240, 38,116, 28,139,210, 76, 27, 90,113,198,110,207,  9,159,132,166,235,200,
+ 53,103, 58,170,101,174,163, 25,113,208,117, 30, 15,196,228,209, 50,210,132,150,102, 18, 40, 98,120,201,141,105, 75, 25,141,253,
+157,198, 19,134,148, 72,227, 64, 63,140, 20, 21,198, 20, 13, 37, 28, 90,139, 23, 22,193,105, 70,125,160,113,130, 11, 45,211,181,
+150,161, 95, 48,159, 69, 82,137, 38,136, 90,140, 36,171, 81, 88,140,115, 58,239, 57, 58,182, 61,250,124,182,160,184,  9,107, 27,
+155,204,246, 15,  8, 77, 99,135,113,200,232,216,115,255, 27,111,229,239,252,141,247,115,239, 91,222,204, 47,252, 39,255, 35,169,
+221,230,174,215,223,197, 56, 87,156, 36, 36, 14,124,235,194,119, 56, 53,233, 76,193, 61, 20,102,139, 61,230, 67, 98, 99,243, 12,
+ 27, 93, 71,123,250, 22,158,124,252, 97,130, 15, 12,195,104,144, 17,133,123,238,186,141,105,215,112,233,234, 62, 57,143, 76,186,
+182, 66,153,172,227,240,206,145,179, 16,  2,132,208,177,232,123, 99,147,231,194,230,169, 73, 21,158, 10,169, 24,110, 56,248,192,
+149,253, 19, 54,218,192,250,214,105,246, 15,118, 57,187,181,206,180,107,112, 93,131,111,214,152,182,129,131,189,  3,174,236,159,
+160, 49,210,181, 13,206, 57, 22,197, 51, 89, 95,195, 59,161,107,221,138, 59,239, 48,125,  1,174, 70,  1,151, 66,227, 44,145,107,
+ 40,209,232,103, 49, 83, 52,130, 19,250,185,197,234,150, 58,186, 45,128,100,103,143, 65,221,167, 31, 45,122,142,247,236, 93, 27,
+115, 34,167,196,122,215,176,182,190,193,144, 18,109,232, 72, 69, 76, 29,142,146,134,  5, 57,103,126,252, 61,247,224,215, 55,249,
+212, 95,188,140, 15,222,130, 59,202, 64,204, 75,110,184,176,127,120,128, 47,202,217,155,118,144,166,225,248,232,152, 20,237,157,
+ 65, 12,195,122,170,107,152, 76, 39, 12,169, 88,126,183,178,234,150, 75, 30,153, 78, 38, 76, 27,135,111,133,155, 78,159,230,129,
+215,223,198, 11, 23,119,121,228,153, 87, 16, 10,211, 46,240,166,219,111,230,122,159,185,126, 48, 86,127,114,189, 64,139, 34,161,
+114,222,235,106,211, 57,243,220,139,247,132, 90, 88, 56,151,113,101,153, 21,190, 12,103, 49,154, 27, 53, 27, 67,116, 41, 32,212,
+ 21,102, 21, 45,198,243, 18, 71, 91,207,236, 84, 65,242,174, 42,254,197,213,120,216,234, 75,119,210,242,174,127,239, 29, 60,252,
+231,127,110,172,120,239,248,207,127,241, 31,240,171,191,246,255,112,184,191,111, 65, 80,206,161,234, 13, 22, 83,189,241,150,228,
+106,  9,107, 86,152, 45,245, 92,182,146,233, 16,198, 82,234,111,111,221,252, 50,101, 52,103,165,243,230,223,215,108,153,190,134,
+150,133,156,148,198, 47, 33,106, 86, 92, 21, 45,214,192,150,170,254,242,  5, 95, 39,228, 41, 91, 34,222,234,119, 87,106,228,105,
+101,188, 47,253,228,141, 24,153,110, 25,223,166, 88,236,100, 41,100, 76,164,232, 87, 73,121, 30, 87, 96,107,123,107, 85,204,168,
+ 42, 91,167,119,248,219, 63,247,115,252,211,127,250,191, 24,160,166, 18, 32,125, 21, 89, 59,103, 73,169,170,142,224,108,133,226,
+138,233,160,196, 55,132,  2, 99, 86, 66, 66,104,138, 85,157,169,216,238,220,188,232,186, 26,211,136,179,  3,119,185, 28, 47,121,
+  4, 50,102,188,178,140,109, 81,184, 52, 36, 62,241,  7,127,204,223,252,153,159,230, 39,127,250,167,249,205,223,250, 56, 47,191,
+122,145,151, 94,185, 76, 55,237,104,186, 41, 57, 46, 88,204, 79,106,160,138, 85, 24,107,107, 19,222,253,189,239,225,135, 63,242,
+ 97,190,254,216, 55,248,194, 23,191, 82, 61,212,246,243,148, 18,107,108,225, 82, 40, 39,204,142, 23,212,200,250,186, 27,115,244,
+ 41, 50,140, 39,246,161,214,188, 96,  7,244, 39, 61,139,249, 96, 52, 32, 99,243,152, 96,196, 91, 39,109, 59,231,129,147,147,  5,
+165, 88, 74, 81,240, 14, 39,211, 21, 46, 23, 10,174,241,140, 41, 17,143,143, 65, 60, 34,134,138, 44,154, 73, 99, 52,134,181,130,
+ 15, 77, 85,214, 22,114,129,115, 55,223,202, 95,253,137, 31,101,119,119,151,113, 28,185,231,238,187,106,200,134,240,196,211,223,
+226,218,225, 49,197, 89, 88,132,166, 37,  3,184,208,159,236,115,124, 98,133, 71,206, 22,243,168, 69,137,161, 16, 90, 79, 80,129,
+ 28,205, 83,238, 61, 42,  9, 39,193,130, 76, 74,186,193,131, 47, 74, 33, 26,192, 64,  0, 34,100, 37,168, 51, 75,153, 55, 80,  5,
+ 37,219,192, 77,133, 69, 63, 16,130,  5,127,148, 84,152,107,196,105, 21, 80, 58,103,225, 56,206, 60,206,193,184,148, 20,  9, 72,
+140,166, 62, 86,136,131, 21,139,206,187, 85, 71,224, 67, 75,168, 47, 98,212,145,178, 76,174, 26, 77,160, 89, 16,178,100, 75, 55,
+171, 65, 13, 89, 33,229,132,244,153,206, 55, 56, 39,164, 65, 45,195, 90, 45,119, 96, 44,118,  0,123,113,140,106,187,168, 38, 24,
+105,171,145,134,146,196,162,112, 25,153,132,150,152, 19,241,100,206,152, 60, 93, 16,202,162,101,140,198,230, 15, 62, 16, 66,195,
+164, 89, 99,107, 91,104, 84,172, 88,235, 19,139,185, 37,227,229,146,140,196,165,153,162,158,182,  8,243,156,112, 10,107,211, 41,
+ 77,183,133,115,137,120, 50, 35, 59, 79, 46,142,210, 47,200,  2,231, 78,111,115,237,240,132,174,157, 67,132,197,226,  8,141, 61,
+ 65, 18,219,219,235,164, 18,184,124,208,211,118, 66,183,189,206, 65,191,224,206,155, 60, 79,188,116,192,119, 46,116,108, 78,166,
+ 76,215,166,192, 26,243, 62,210,  5,136, 49, 51,235,149, 66,195, 48, 14, 76, 99,207, 94, 26,185,244,242, 43,  4,177,221,155, 44,
+ 71,240,117,191, 62,166,154, 88,165, 16, 83,177,  2,174, 20,156, 23,198,108, 36,238,148, 10,109,104, 57,127,246, 12,199,  7,187,
+204, 82,228,213,107,115,251,206,151,218,152, 26, 82,161, 41,178,121,243, 77, 28,143, 22, 38, 51, 27, 35,163, 42, 12, 25, 45, 61,
+ 55,221,124,158, 59,111,127, 29, 87,119, 31, 35,161,164, 98,123,233,116, 60,227, 56,101, 66,235,217, 59,200, 56,124,245,169,123,
+ 67,192,  6, 79, 19,  2,210,128, 23, 71, 83,139, 85, 17,135, 11, 74, 19,214,104,187,142,245,117, 75,214,202,197, 89,  3,160, 70,
+  2,196, 89,124,113, 30, 97, 24,123,118,179,  5,  9,149,122,198, 89,183,111,161, 66,243,126, 48,204,103,195, 42,187, 60,231,196,
+235,239,188,137,201,173,119,242,201, 71, 46,129,247,248, 96,214, 69, 45,145, 28, 35, 81,107,242,163,195,192, 53, 67,178,221,104,
+ 29,243,218, 90,187,176, 62,157,176,190,117,154,221,163, 35, 22,199,115,218,174,179,144,169, 18,107,198, 67, 33,198, 68, 89, 40,
+151,119, 95,230,252,186,231,157,111,189,135,103, 95,187,206,222,238, 33,222,  5, 94,187,182,207,250,230, 22,235,155,107,164,222,
+222,203, 33, 47,207, 72, 35,192, 81,  5,184, 70,149, 84, 74,172, 57, 22,197, 82,225,132, 96,204, 15, 12,214,227,196,190,207, 80,
+ 71,233,198,156,151,234,118,168,129, 47,234,200, 88,134,130,221,110,118,209,185, 96,232, 88, 81,211, 62,136,145,116,235, 88, 56,
+115,223,125,247,115,247,221,247,112,241,181,215,120,253, 27,222,192,238,238, 46,187,215,174,211,184, 80,201,115, 22,150,146, 85,
+ 44,248,200,153,211,201,132,153, 22,211,235,234,209, 85,170,202, 60,137, 53, 63,174, 10, 75,151, 43,  4, 99,  0,212,130, 70, 61,
+120, 69,115,180,194,196, 55,248, 80, 41,111,106,159,149, 56, 71,176,228,148, 85, 60,175,199, 66,177,140, 29, 99, 35,240, 66,182,
+200,223,140,221,119, 82,144,108, 93,114,165,242,212, 20, 60, 75,149,211,213, 42, 34,219,133, 95, 60, 37,165,250, 44,100, 10,158,
+126, 24,248,201,159,252, 41, 30,125,248,107, 44,134,158,135, 30,122, 39,143, 62,252,112,253,217,236,207, 49,203, 26, 20, 21,180,
+152,117,153, 84, 40,234, 32,217,133,174,149, 54,151,197, 33,178,132,207,104, 54, 36, 99,137,228,100,209,153,182,211,178,252,242,
+ 34,190,  2,247, 11,170,  9,209, 84,147,177, 20,145, 84, 35,242,172,139,186,118,233, 10,187,123,123, 60,244,192,  3,188,243,161,
+183, 51, 95,204, 57,222, 63, 96,118,124, 68, 63, 44, 72,113,176,220, 89,160,109, 91,238,186,227, 14,126,244, 71,255, 10,223,255,
+190,247,242,212, 83, 79,241,123,191,247,123, 28, 31, 29,225, 36,215,177,238, 95,194, 17, 82, 42, 89,206, 50,218,114,182, 46,108,
+ 25,228, 96, 79,130,137,218,188,154,242,176, 84,138, 82,169,151, 21, 36, 75,131,210, 12, 57,145,114, 36,141,145, 82, 34, 37,217,
+200,180, 20, 27, 65,167, 20,137,201, 96, 20,185, 36, 82,178,112,132,226, 20, 73, 86,237,149, 85, 96, 65,245, 72,103, 19,227,149,
+229,150, 69,133,205,205, 13, 30,120,224,109,220,121,199,157,156, 63,127,158,182,109, 57, 57, 62,230,241, 39,159,226,211,159,249,
+119,204, 78,102,150,238,163,166, 46, 86,177,253,159,115,134,154,245,206,194, 27,166, 19, 79,167,202,108,232, 25,146, 18,199,116,
+ 67,124, 24,130, 81,195, 44,128,142,148,139, 85,153, 18,200,178, 44,101,108, 71, 21,151, 64,150,  6,114, 49,236,160,237,212,133,
+  6,139,143, 76, 44, 81,135,246, 50,249,234,133,181,147,192,212,170, 75,  3,131,203, 24, 73,138, 66,146,140, 95,238,213, 68,240,
+174,224, 67, 13, 99,240,206, 58,251, 12,177,152, 78,162,104,253,188,138,161,105,113,169,218,152, 28,100,235, 50,236,128, 87, 38,
+193,225,157,210,122,139,186,164, 20,124,  3,105,176, 75, 68,181, 64, 40,184,224, 44,158, 80, 66, 13,225, 80, 98, 78, 12,125, 61,
+ 12, 20,146,102,226, 80, 83,203,196, 49,142,153, 49,103, 98,137, 12, 37, 18,135,204,162,  6, 17,205,213,145,100,  2, 77, 67,211,
+173,209,180,129,166,105,209,100,137, 74,227,220, 50,199,211,220, 58,225, 20, 19,195,208, 51,164,132,211,  6,215,  4,186,181, 41,
+107,237,132,245, 83, 83, 54, 78,109,112,211,198, 41,110, 62,179,205,153,115, 55,113,238,244, 14, 59, 27, 83, 38, 19,143, 15,129,
+221,253,  3,130,203,124,232,157,111,226,141,119,191,129,249,209,  1, 63,254,177,247, 50, 92,187,204,159, 61,246, 28, 71,139,158,
+121, 63,112,178, 56,230,120,255, 10,235,235, 83, 74, 81,174, 94,191, 78, 26,122,212, 57, 58,239,153,141,137,197,162,167, 13,134,
+ 38,237, 99,170, 60,111,199,250,218,148,113, 76,156,204, 23, 43,222, 67,170,125, 79,240,142, 24, 45,213, 48,180, 29,235, 91,167,
+217,218,220,194,251,150,105,211,114,180, 24,  8,161,225,142,243,183, 24,207, 90, 43,224,196, 65,219, 77, 57, 56,216, 55, 98, 22,
+118,169,228,152,105,188, 99,182,152,115,199,237,175,195, 55,142,215, 46, 95,198,187,150,224,132, 88, 18,165, 40,247,222,121, 27,
+155,107,167,104,189, 29,214, 99,202,164,164,228,152, 57,158, 45, 24,230, 35,139, 69,228,120,214, 51,155, 47,152,207,122,102,125,
+166,143,153,249, 98,228,120, 54, 50, 68,203, 35,207, 89,  9,211,  0,222,211,248,134,181,181,142,201,250,148,126,140, 92,185,118,
+221, 46, 78,107, 62, 45,213, 49, 70,198, 56,146, 83,186, 33,  6, 78,133,148, 35,109,104,240,211, 53,154,  2,151, 95,189,204,201,
+ 98, 32,165,140,212, 51, 97,140,177, 90,208,178,113,218,155, 96,246,201, 58,222,103,133, 18, 17,  3, 84, 53,129,156, 51, 41, 39,
+ 54,183,118,  8,237, 58,173, 55,200,209, 56, 46,208,170, 95,138,185,208, 72,225,221,111,187,131,231,175,143,188,244,202,101, 84,
+ 11,135,179,200,124, 88,176,185,185, 65,211, 76,141,203,209,180, 21,176,228,113, 62, 16, 92, 13, 83,169,204,118,170,112, 13, 45,
+148,164,164,146, 13,220,147,108,162,212,247, 61,195, 56, 50,140, 35, 41, 69, 82,142,140,217,194,168,170,180,217, 98,184,193, 58,
+ 78, 49,162,168,175,  9,112,130, 84,240,141, 93,112, 43,157,131,111,248,246,183,191,141, 15,129, 16, 60,151, 46, 95,225,223,254,
+209, 31, 16,156, 35, 99,185,235, 78,188, 37,211, 84,184,153,229,187,151,165, 12,106,185,189, 54,209,152,106, 77, 25,180,142,151,
+ 98,207,157, 53,163, 21, 48, 36, 14, 13,102,127, 20,181,133,115,193,253,165, 41,130, 21,182, 37, 44, 87,135,213,107, 45,238, 70,
+192,151,150, 85,  3, 73, 73,213,230,173,171,212, 82,  8, 32, 25,239, 27,123,107,178,233,167,138,228,106, 95,118,166, 57,195,168,
+123,214,198, 27,220,196,176,181, 66, 26, 71,158,122,234, 73,118,206,152,138,255,209, 71, 31,225, 27,143,125,211,156, 65,106, 26,
+166, 32,212,226, 99, 73,  1, 46,245,162,247, 72,205, 71,  8,178,156,215,152, 34, 57,172, 62, 48,181, 15,198, 90,125,181,110, 79,
+147,237,132,178,146,171,101, 76,213,146,186, 92, 77,164, 81,231,208,108, 73, 52,134,151, 21,190,254,248, 55, 89, 44, 22,124,228,
+  7, 63,204,223,248,201,191,198,213,247, 95,229,185,239, 60,199,107,151, 46, 49, 95, 44, 12,143,122,250, 12,175,123,221, 93,220,
+123,239, 61,244,195,192,167, 63,253,105,190,240,197, 47, 50, 91,204, 42,252,  5, 99,237,122,251,162, 52,143,198,249,118,161,246,
+231,246,226,185, 92,234,120, 45, 65,118,203,160, 75,146, 55,202, 78,112,118,169,121, 49,255,183,136,167,241,150, 62,151,213, 68,
+ 50,118,145, 75,229, 35, 23, 27,213,177, 12,181,177, 75, 65,130, 67,164,173,169,117,133,168, 32,218,224, 72, 68,117,148,232, 80,
+146, 61, 96,201,  0,253,174,190, 84,175, 93,124,145,223,250,205,127,197, 45,231,110,161,233, 58, 74, 74,134,182,125,233,101,226,
+ 48,226, 40, 38,252,241,142, 16,108, 50, 96, 17,128,106, 32,  1, 85, 27, 37, 97,217,231,167,212,252,194, 75,218, 16,  4, 24,172,
+194,239,139,218,136, 56, 56,130,115,184, 92,127,239, 70,144,182, 65, 83, 66,138, 71, 66,203, 48,244,182,147,169,130, 62, 31, 60,
+ 52, 19, 66,202,224,109,247,218,  5, 79, 22, 40, 73,201,222, 87,138,149, 85,175,173,216, 52, 32, 73, 65,178, 99,226, 76,228, 33,
+177,128,175,137,127,217, 20,201,206, 57, 98,  1,201, 22,107, 88,  4, 27,159,103,139,194, 20, 47,150, 88,172,138, 43,217,214, 42,
+ 57,163, 65, 56,165, 13,222,155,112, 10,177, 12,231, 16, 38, 20,236,  2,157,182, 13,125, 46,104,141,140, 28,139,  9, 16, 83,142,
+168, 11,120,241,140, 57,162,161,208,228,209, 30,127,245,136,120,139,232, 45,163,101, 70, 39,235,148,154, 38, 27,178, 17,161, 31,
+  7, 92,219,144,199,253,218,213,  4, 51, 21,138,195,139,210,117,107, 76,252, 26, 74,164, 65, 25,171,  5, 97,200, 35,154, 28,201,
+247,184, 49, 80,230, 61,235,211,  6,137, 45, 40, 76, 39, 83,124,231,105, 82, 33,172,175,177,179,179, 97, 57, 52,197,113,251,173,
+215,144, 28,  9, 27,231,120,244,185,215,120,251, 27,206, 18,110,186,151,123,222,250, 38, 62,120,112,192, 35,223,218,101, 60,137,
+204,139,141,  5,103,243, 97,  5,108,242,141, 69,253,206, 98, 98, 72,182, 83,183,180, 57,243, 62, 47, 83,180,114, 44, 12,217,252,
+235, 27,235, 19, 74,202, 12,201, 10,228,190,207,117, 74, 38, 12, 25,246, 15, 14,145,177,183,119,240, 47,229, 73,159,191,227, 54,
+214,143, 35, 71,179, 30, 87, 50,154, 70,174, 29,236,219,187, 85,156, 69,134,170,208,  4, 43, 26,218,181, 53,174,238,238,178,181,
+125, 43,139,241,105,134,225,144,147,166,173,209,178, 35, 39,125,207,249, 91,110,102, 51, 77,201, 57,115,114,220, 83, 52, 87,140,
+169, 39,165,196, 24, 19, 99, 74, 80, 50, 67,138,228, 69, 98,177,160,146,231,140, 99,222, 56,193, 59,187, 68,138, 23, 58,111,118,
+ 82,215, 52,148,148,184,253,166, 77,250, 49,162, 57,179,232, 19,147,214,115,254,236, 54,195,152,185,184,123,204, 56,142,156,221,
+ 62,197,144, 11,141,131,233,218, 58, 47,188,118,196, 15, 62,120, 43,247,255,220,123,249,231,255,250, 97, 94,189,116, 64,104,  3,
+185,228, 90,148,234, 42,186, 52, 38,115,227,196,104, 65, 40,203, 20, 48,169,211,131,156,237,119, 16,148, 16, 90,134, 33,213, 84,
+ 81, 95, 71,200, 70,255,163,192,238,225,156,188, 24,184,247,174,115, 60,243,237, 87,217,153, 58,102,139,136,142, 17, 71, 65,130,
+ 71,146,226, 92,139,115,137,182,113,164,148,200, 58,226, 75, 13, 46, 41,197, 98,168, 83, 34,250,196, 72,196,101, 67, 48, 47, 29,
+  5,133, 66,142,145,164,150, 17,174, 88,183,187,108,168, 28, 14, 95, 65, 62, 62, 44,215,111, 53,243,161,118,198,224,240,106, 74,
+110,149,202, 94, 37,179, 56,153,241,240,215,190,102,194,117,236, 25,211,124, 99,194,107,105,140,203,252,  8,136,162,248,202, 75,
+137, 53,171, 51, 87,138,154, 83, 87, 83,231,196, 92, 63,222,213,113,184, 84,174,109,205,149,205, 66, 40,150,101, 18,176,207, 53,
+ 21,187,183,156,138,157,239, 25,154,170, 71, 64, 26,156,119, 53,131,192, 33, 53, 69, 77,202,141,221,185, 22,203, 14,240,217,184,
+  6, 34,142,156, 77,108,233, 66, 32, 21,  3,182, 21,117, 55, 26,224,250,179,149, 98,211,  7,239, 92, 77,186,203,168, 10,187,123,
+123,124,249, 75, 95,172,207,  8,171,207,212, 83,117, 81, 22, 45,103,133,143,104,101,222, 11, 69,150, 89,244,165,226,112, 45,114,
+ 55,102, 37,200, 50, 40, 71,151,245, 88,205,130,150,202,207,213, 82,189,159, 38, 36,177,250, 59,160, 75,148,108, 42,164,101,182,
+175,111, 42,159, 29,158,121,230, 89, 94,121,245, 50,111,125,219, 91,249,174,251,222,196, 91,191,251,109,188,235,123,222, 85, 71,
+128,  6, 67,216,221,223,227, 75,127,246, 23,124,243, 27,223,228,229,151, 95, 54, 65,137,111,237,187,201, 70,185, 43,213, 31,111,
+113,194, 30,209,132,214, 17,141,212, 49,141,101,221, 86,112,255, 82,212,166,177, 70, 46, 56,163,102,105, 94,229,223, 22,108,244,
+110,242,116,243,100, 87,108,143,253,142,206, 70, 58,182,139,182,184, 69,213,130, 74, 29,169,137,117,174, 86, 65,153, 77, 76, 28,
+104, 50,182,176,175, 80,  7, 21, 71,168,158,254,239, 92,120,149, 23, 94,120,181,202, 43,172,255,205,174,198,  7,171, 67, 66, 67,
+206,150,192,211, 96,221,139,115,134,119, 20, 41,182,191, 77,118,209, 56,239,144,198,173,114,120,131, 24, 73,171,235, 60, 37,154,
+202, 61,147,136,125, 38,121, 43,190,130,  4,208,249,106,164,  9,182, 11,109,170,167,159,166, 88,213,173, 25,117,198, 39,182,135,
+200, 42,223, 92,148,113,136,  4,169, 34, 73, 41,168,247,120,133, 44,  5, 87,149,213,102,  3,242,118,145,139,133, 22,168,  4, 19,
+ 45,134,  2, 93, 64,  7,179,246,164,154, 55,143,100, 59, 72,100, 41,192,179,226,138,250,242,143,174, 64, 18, 22,121,196, 74,172,
+ 76, 97,249,130, 26, 65, 48,143,121,101,133, 50,  4, 92, 93,179,208,163,193,175,246,140,206,129,208,  0,189, 65,137, 84,241,109,
+107,224, 36,132,160, 14,151,148,210, 58,202, 88, 40,193, 98, 15,115, 54, 86, 66, 76,163,117, 37, 62,161,193, 51,246, 51,116, 20,
+154, 78,232, 19,136,179, 46,169,145,137,177,181,131,117,153,228,129, 97,  1, 37,137,145,237,162, 39, 28, 11,146,205,146,162, 37,
+210, 77, 59,166,147, 83,156,190,229, 13,248, 73,226,165,221,  5,254, 96,228,197,139,135,148, 79, 62, 69,233,  7,154,211,119,243,
+208, 59,238,164,164,196, 98, 49,210, 15, 35,135, 71,115, 78,230, 51, 54,215, 54, 45,137,202,219, 14, 50,199,194,152,178,237, 69,
+ 75,198,239,116, 12,243, 57,139, 49,114, 60,159,145, 74, 97, 28, 19,235,231,207,160,146,153, 95,185,102,137,141,  2,227,152,105,
+ 26, 79, 30, 22,116,174,144,181, 97,210,118,156,140,209, 38, 24,105, 36,116,167,209,217, 62,253,241, 53,  3,214, 56, 49,171,161,
+ 78,140,106,166,217,220, 25,216,225,220,105, 97,152,159,176,190,182,193,153,157,211, 28,238, 95,163,196, 30, 39, 66,163,153,197,
+201,  9, 99, 60,  3, 18,104,155,192,230,150,103,172,156,255,206,  7, 70,181,162, 36, 21, 69,114,102,136, 35, 89,197,172, 99, 49,
+210,167,108,185,  7,177, 48, 14, 61,139,222,214,134,  7,117, 18,225,131,163,233, 60,147,233,  6,211, 46,211, 56,152, 12,137,245,
+245,142,115,183,157,231,120, 62,114,249,248,  5, 38,204,184,243,238,187, 57,158, 39,142, 15,118, 17,231, 56,153,245, 92,158,195,
+ 27,238,191,155,243,183,189,192,229,235,135, 28,204,102,102, 83, 91,145,228,140,  0,182, 44,158, 82,201, 43,109,146, 33,218,  5,
+215,216, 89,146,114, 50,222,119, 50,141,143, 43,134,  0,182, 84, 66, 97, 24, 35,136,114, 56,139, 92,221, 61,226,141,119,220,201,
+230,230,105,214,166,129,228,231,140,243, 99,200,133,182, 13, 36,201, 56,201, 20,169, 73,100, 21,140,229,155, 96,107,136,172, 68,
+ 95, 40,157, 18, 82,102,210, 22,178, 70, 98,170, 32,173,146,145, 49,217,245, 80,187,203, 92, 50,213, 79,101,128, 44, 50, 37,217,
+148,103, 28,204, 18,236,124, 91,133,176,149, 19, 18, 92,181,120, 86, 31,184,247, 86,  0,215,212,187,214, 45, 61,239,141, 89, 96,
+197, 35,132,202, 66,169, 93,104,213,221,148, 98,200,213,160, 30,135,146, 70,179,194,226,155,106,196, 42, 72, 19,240,165, 54, 18,
+181,131, 85,231, 41, 37, 35,185, 50,223, 67, 61,203,171,216, 27,  7, 69,146,137,208, 74,229,249,123, 27,241,151, 82,109,125,197,
+104,163, 86,146, 44,173,146,102,213, 43,163,105, 40,150,145,171,246,179,214,110, 90,106, 71,111,177,117,214,140,138,  1,181,156,
+152, 80, 85,197, 10, 59,167,174, 14, 26, 76,148, 90, 84,170,104,216,192, 99, 53,152,174,126,250, 74,170, 56,103, 39,161, 94,135,
+ 10, 37, 82, 28,100, 95,239,167,108,211, 98,185,245,174,215,107,168,217,173,127,249, 82,151, 21, 60,190,254,211,215,170, 69,106,
+165, 83, 47, 27,117, 38,152,113,185,218,226,124,168,224,251, 90, 73, 52,178,242,  0, 90,138,206, 96,179,  1, 87,167, 65, 42,118,
+144,135,250,  0,170, 84, 58, 91, 50, 37, 41,138,211,108,185,227,174,146,190, 42,218,209,156,247,106, 62, 65, 49,194, 78, 17,173,
+106,193,229,229,233, 33,184,154,154, 84,247,248, 56, 92,227,241, 44, 61,212, 38,206,146,154, 84, 87,220, 18,161,111,227, 51,253,
+ 75, 52, 92, 42,124, 95,234,223, 89, 10, 20,103,151, 55, 90, 11, 15, 92, 21,121,  8,222, 99,227,126, 17,139,231,196, 40,109,  5,
+173, 66,186,106, 37,245,117,100,163,197,252,167,185,218, 36, 92,221,247, 20, 37,166,140,115,  1, 23,150,190,104,  5, 23,144,162,
+  4, 20,223,154,218, 86,139, 89, 55,116, 41,102, 84,136, 99, 49,106,157, 52,248, 54, 88, 92,168, 20,186,214,219, 30,203,190, 61,
+156, 91, 30, 68, 85,239,225, 42, 23, 59, 69,203, 53, 54,211, 45,193,133,154, 77,110, 55,158, 21, 51, 75,129, 94, 64,154, 96, 93,
+195, 56,146, 83, 77, 92,114, 88, 39, 25, 51, 41, 21,168,249,233,190,138,179,198,148,232,124, 75,  8,181,170,174, 62,220,101, 52,
+161,195,198,150,104, 49, 56, 16,169,218,  6, 77, 60, 21, 53,217,136,222,123,198,146,235,115, 42,148,  6, 72,118,201,225,165,250,
+150, 75, 21,236,153,141, 79, 48,  1, 31,106,223,143,  5, 22,213,124,226, 38,224, 39, 13,141, 90,209, 18, 87,207,101, 13,165, 78,
+245,  3, 35,145,179,226, 93,107,171, 10,169, 66,159, 96,218,135, 89, 78, 16,149, 56,206, 73,163, 29,134,237,250,132, 73, 55,197,
+ 51,214, 14, 88,112,110,202,164, 85,114,116,248,137,157, 32,101, 24,232,186,134,136,217,150, 38,109, 11,173, 82,134, 68, 39,142,
+249, 98, 65, 26, 35, 49,101,142, 23, 11,226, 16,201, 89,233,135,  5,243,177,175,217,211,230, 64,136,243, 25,169, 12, 12, 99, 98,
+ 28, 18,210,118,148,146, 24,102, 11,130,179, 80, 20, 85,104, 28,180,141,199,183, 13,235,211, 41,109,104, 56, 58,153,113,105,239,
+  0,135,240,192, 59,223,195,252,104,193,254,222,101, 66,211,130, 86,251,212, 56,167,  9,129,217, 48, 44,183,139,136,192,198,218,
+ 41, 78,173,111,112,230,220, 77,236, 31, 70, 14,247,143,232, 26,161,159,237,177,232, 71,214,182,118, 56,123,122,135,180,236,140,
+ 92,221,141, 22, 97,226, 21,239,  2, 81,133,198,217,228, 33,149, 72,232, 26,200, 70,110, 28,134,136,199,147,114,178, 17,114,178,
+223, 47,198,145, 82, 18,125,157, 94,140, 67, 50, 65,221, 95,210, 13,121,103,200,213,249,201, 49,235,157,103,231,236, 45,196,152,
+112, 57, 86,177, 89,161,233, 90,214,183, 55,144,172,188,118,121,151,253,107,215, 76,132, 25, 44,179,205,190,251, 58,209, 20, 42,
+ 35,227,  6,211,163,113,194,250,198, 58, 93,219,209, 15,102,153, 19,215,144, 82,162,241,216,103, 47, 74,202,  6,186,138, 41,147,
+ 83,225, 39,222,247,122, 62,240,161,239,229,127,254,245,175,113,249,226, 30,157, 79,136,142,220,124,211,205,132,233, 41,156,135,
+ 92, 19,219, 98,206,214,169,213,164,180, 82,207, 14,154,137,129,113, 74, 38,212,240,158, 62,102,188,154,110, 34,141, 67,117,183,
+152,197,212,156,  1,182,123,214, 82,203,232,156, 43, 85, 94,204, 33, 85,125,228, 46,  4,211,  2, 57, 91,179, 73, 13,  4, 19,197,
+206, 89, 23, 16, 85,154,198, 89,180,178,232,242,180,193,230,214,216,221, 82,247,232,120,143,215,186, 50,117,178,194,140,248, 80,
+239,144,122, 38,160,149,108,234,128, 92, 79,253,128, 77, 86,181,173,  5, 66,169,157,178, 61, 75,193,155,204, 63,215, 49, 63,217,
+220, 95,174, 89,130,109, 12,229,139,207,164, 44,140,125,101,157,144,170, 56,116,137, 83,183,251, 98,105,239, 41, 26,  9, 98,100,
+ 63,173, 46, 33, 89,222,167, 44,143,118,107,244, 86, 86,112,183,252,222,170, 27,162,148,202,137,177,255, 87, 46, 85,202,232,100,
+101,135,243, 78, 48,130,131,233, 16, 68,164,230,214, 91, 67,148,163, 18,212,249, 58,150,230,198, 72, 91,106, 10, 80, 77,116, 81,
+167,182,148,175, 91,134, 82,189,202,165, 72,229,196, 91,166, 45,197,188,161,150,139, 91,119, 31,169,142, 28,138,128,199,172, 78,
+171,196,122,243,120,139, 22, 52, 37,226,210, 65, 88, 61,122, 90, 76,148,224,196,225, 29, 53, 73,200,173,188,182, 57, 11, 18,236,
+ 66, 75, 37,147,212,196,  5,190,118,176, 32,241, 14,215,  0,  0, 20,218, 73, 68, 65, 84,170,102, 91, 72,163,210,  4, 95,133, 20,
+118, 72,250, 10,111,201, 85,  8,129, 19,156, 47,164, 49, 87, 44,174,145,228, 68,177,174,175,122,237, 85,157,  9, 52,176,139, 76,
+107,167,173,248,234,215,180,177, 11,181, 42,213,100, 95,156, 15, 30,245,  6,135,113,  8,161, 13,213,254, 34,184,166, 37,136,121,
+ 68,139,220,120,113,212,149,149, 87,183,100, 65,165,161, 46,178,172,115, 47, 66,227, 90,146, 12,140,165,224, 71, 95,185,211,213,
+188,235, 28, 89, 28, 65, 10,237,164,224,104,201, 37, 51,142, 35,226, 19,163, 58,198, 88,240,222, 91,150,178,100, 98, 86, 28,246,
+114,250,198,190,239,152,  0, 13,149, 84,151,104,171,101, 72,139,144, 83,182, 93, 24, 66,138,153,166,149,122, 88, 22,124, 18,146,
+250,154,107,156,109,191,156,204,238,179,156,254,100, 50,190,109,173, 11,160,144, 72,164, 44,171,140,223,166,117,164, 40, 53,250,
+180, 88, 39, 29, 60, 18,132, 60,212,151, 42,216,157,218, 73,139, 15,118,160, 65,187, 66,175,122,231,208, 46, 83,178, 85,255,144,
+ 44,153,216, 11, 78, 58, 59,100,178,229,178,143,234,136, 57,209,144, 81, 95,208,228,209, 52,214,200, 92,143, 27, 29,190, 49, 33,
+ 86,206,133,  0,148, 46, 88,170, 93, 82, 92, 87,133, 66, 41,131,247,166,194, 12,182, 90,240,185, 33, 74,162,  9, 45,154, 34,222,
+123,114, 82,198, 52, 48,105, 91,196,101,130, 19,202, 56, 16, 51,100, 39,140,243, 26, 73, 89, 50,115,205,134,149,205,137,147,124,
+  2,141,189,204, 27,107, 45, 41,  9,139,152,153, 78, 58,110, 93,155,210,199,200, 52, 76,160, 17,250,197, 17,215,119, 71,250, 52,
+152,206,226,212,142,137,141,134, 72,210,196,152, 19,113, 54, 99, 46,158,197, 98,198, 48, 24, 98,181, 93, 91,227,230,115,183,115,
+112,184, 15, 89,137, 26,233,115,166, 20,232,218,134, 50, 63, 97,126,114, 76, 44, 35,121, 76,230,154, 41,133,105, 19,240, 65,232,
+146, 67, 74,166, 79,133, 16, 60,195, 48, 48,157, 78,137,243, 57, 27,107,107,204, 22, 83,252,244, 20,253,193,117, 78,250, 57,131,
+102,206,159,221, 97, 18,106, 52,101, 42,117,173,  2,189, 42, 90,162,113, 20, 80, 82,170, 19,179,122,226, 59,231, 80,231, 73,  5,
+218, 73, 71,147,215, 76,  9,189, 97,205, 65, 83,109, 64, 57,103,163, 48,166,145, 62,141, 44,134, 66, 31, 45,109, 48, 70,152,208,
+ 49,198,204,213, 75, 23,  1,  8,161, 49,231,136,115,104, 63,114,112,112,204,100,210, 17,164,112,122,103,157,146, 51,167,166, 19,
+230,163,114,120,116, 72,206,229, 70,183,236,106, 36,180, 80,207, 75,165,159,155, 99, 38,139,224,125, 75,137, 61, 94,148,132,161,
+182,189,247,248,188, 84, 57,103,156, 40,143, 62,183,199,173,119, 94,226,  3,111,217,230, 79,246,175,176,123,216,179,179, 57,193,
+183,141,133,224, 20,143, 72,131,232,136, 83, 35,179,133,224, 24,115, 66,147,160, 65,113,165,135, 88,181,  2,  1,138,120, 66,168,
+215,131, 40,205,100, 98, 90,169,170,  5, 16, 45,164,202,  3,208,146,108,236,171,182, 99,207, 37,211,148,101,180,104,237,176,221,
+178,145, 74,230, 74, 72,182, 46,213,104,211, 84,231, 60,131,247,136,243,184,198,156, 84,109,229,225, 75, 48, 86,135,137,132, 13,
+122,102,205, 82, 37,212,228,100,147,204, 98,103,212, 18, 97,236, 48, 53,187, 57,126, 12, 91, 46,165, 16,154, 64, 82,243,111, 75,
+ 49,166,138,136,161,174, 71,117,248,  2,197, 27,168, 39, 87, 45,150,195,206,216, 54,216,  5,171,209,190, 47,231,129,100,211,166,
+ 82,177,164,190,170,223,139,164, 21, 70,221,  9, 53, 22,216, 44,125, 86,184, 88,118, 61, 85,120,238,185, 49,189,241, 53,230, 60,
+217, 56,192, 86, 41, 42,104,109,100,140,164,104,154,162,198,172,  8, 21,180,  6, 69,204,129, 36, 62,212, 96,181, 42, 88, 14,166,
+216, 15,140,182, 39,147,154,219,237,151,163,118,150,221,250, 13, 24, 11,222, 33,206,118, 56,185,254,165,169,142, 73,197,137,141,
+ 54,165, 80,138, 91,229,245,106,162,178,189,125,253, 96, 44,204,194, 42,100,227,165, 11,201,210,236,188,171,212,165,140, 86,225,
+147,137, 12,156,237, 89,168,149,236, 56,  2, 38,220, 42,152, 24,194,173,194,101,170,192,219,217,216, 29, 41,120, 53,234, 90, 42,
+224,130, 93,146,146, 87,155,249, 42,104, 83, 52, 91, 16,196,234,119,174,213,149,212,208,190, 37,167, 33, 47, 35, 10, 75,169,161,
+ 18, 86,108,100, 92, 13, 10,169,147, 12, 23,106,177, 96,163, 93,173, 81,155,182, 19,113, 52, 82,137, 89,154, 80,103,157,127,240,
+214,121,151, 80, 39, 29, 90,193,184,173, 77, 72,164, 20,171, 52,179,  7,151,137,154,204,251, 45,166, 54,117, 94,170,162,211, 17,
+213, 44, 25, 62, 56,188, 56,178,  4,124, 72,172,  5, 75, 79, 11, 57, 87,186,159,169,197, 29, 82,137, 92, 85, 69, 89, 28, 42,137,
+ 98, 99, 24, 20,165,  9, 16, 90, 33,101,131, 75,  4,103, 15,113, 66,160,238,210, 74, 81,114, 31,173, 67, 17, 87, 33, 80,222, 86,
+ 17,154,160, 56, 74, 20,156, 87,219,105, 97,207, 85,  8,185,162,126,  5, 52,145, 84,144, 12,193,  9,169,216,224, 93,189,181,246,
+185,140,203,122,182, 82,166,  4,200, 70,167,243,172, 80,157,193,217,222, 51,151, 82,213,179, 74,201,208,250, 14,215, 20, 84, 35,
+154,237,192, 80,  6, 50, 82, 87, 52, 86,108, 74, 80,164, 20,210,201, 64,108,172, 35,241,189,137,235, 18,153, 17, 59,124,130, 19,
+ 91,101,  8, 12,149, 15, 32,174, 62,  7,125,193,235, 82,203,106,227, 54,157,180, 53, 47,217,148,180, 57,101, 74,227, 25,227,  2,
+ 34,182,163,246, 86,164,206,147,121,228,139, 43,117, 82,210,217, 94, 51, 37, 74, 54,100,165, 43, 86,224, 30,159, 44,104,138, 35,
+  4, 97, 22,204,154,227,101,139,230, 84, 15, 57,144,138,167,164,  1,141, 16, 93, 66, 93, 98,130,194,218,  6, 59, 56,250,249, 17,
+243,217, 49, 49,143, 12, 99,228,234,238, 53, 90,103,246,156,101,241, 45,128, 15,129,131,227, 19,139,149, 77, 17,239,132,214, 57,
+214, 26, 79,104,108,239,217,116,158, 56, 42, 62,219,206, 89,196,178, 11, 22,253,192,233,141,211,184,114,204,236,228,184,118,182,
+142,237,181,134, 51, 59, 19,198,193,186,185,226,133,109, 87,  8, 69, 25,164, 49, 43,162, 90,186, 89, 78,150,196, 22,139, 89, 82,
+155,154,105,144, 99, 33, 82, 44,231, 94, 60,206,181,164,104, 35,121, 23, 60,234, 45,197,208,249,204,154,179, 73, 79, 78,150,133,
+222,224, 24,116, 36,245, 61,177, 31, 76,104,216, 47, 88, 44, 70,134, 33,146,115,102, 44, 54,154,110, 66, 75,104,167, 21, 66, 19,
+216,156, 40,211,206,213, 96, 24,179,202,197,148, 41,185,112,211,214, 58, 27, 91,155, 38,198, 28,  7,114, 44,244, 57,211,231,129,
+152, 18,234,171,234, 27,101, 77, 28,190,109,136,189, 21,146,147,182, 97,127, 46,252,217,195, 23,248,165,191,243, 30,222,247,238,
+187,249,103,255,226, 79,121,101,247,152,201, 36,160,174, 37,141, 22, 30, 80,162,173,  2, 27,241, 20,245,102, 37,245, 90, 85,226,
+ 80, 58,129,209,242, 61,172,241,177,243, 71,156, 66, 22, 27, 56,133,134, 16,  2, 13,129, 84,215,152, 90,179, 34,164,158, 21, 41,
+231, 26, 73, 91, 89, 11,197,166,138, 49,219,229,239,150, 81,113,197,138,123, 19, 98,214,118, 80, 19, 37,143,100,129, 40,174,142,
+176,221,202,126,103,147,222,132,215, 96,196, 82,176,148, 61, 49, 81, 93,201,102,111,148, 32,117, 36,109, 83, 22, 19,197, 89,195,
+153,170,205,218, 73, 38,105,192,167, 92,  1,102,101,165,122,103, 57, 53, 13,118,239,217, 57, 14,131, 42,196,100,147,219, 96,  8,
+ 92,231,151, 77,162, 77,210, 74, 37, 29,221, 16,221,107, 69,125,187,122, 83, 20, 84,109,218, 96,218,  4,197,235, 82, 60,103,218,
+143, 92,245,105,230,216,180,201,216, 82,223, 32,170,  6,224, 18, 59,215,199, 74, 95, 21,196,166,210, 90, 12, 23, 87,106,209, 18,
+108, 69,234,235, 42, 58,168,115, 43, 78,175,253,189,193, 46,142, 37,128,160,142,196,109,143, 80,208, 98,227, 57,138,189, 56, 22,
+104, 86,187, 93,150,225, 47, 55, 18,223,108,199,238,173,219,207,185,  6,187,152,210, 89,150, 57,176,206,118, 57, 82, 74,197,227,
+ 53,248,106,109,  2,235,210,195,114,140,231,189,125,105,174,  1,239,104,196,118,169, 13, 14, 41,150, 73,171,181,114,211,165,226,
+187,142,249,197, 87,105,248,242,139,173,  1,243,170,  3,174,216,101,109,202,115, 27, 11,175,226, 20,139,174, 60,251,213,201,129,
+ 52,245,178,119,185,142,130, 50, 74,180, 15,222,155, 38, 65, 42, 99, 89,235,192,189,134, 60, 91,192, 10, 53, 98,216, 43,141,107,
+112, 65,107,183,234, 73,106, 66, 45,219, 75, 47,173,106,246,194,153, 72,211,  4, 60, 90,108,221, 80, 92, 64,146,174, 46, 85,177,
+254, 23,241, 66, 88, 74, 31, 86,168,222,101,161, 96, 21,179,132, 66,147, 29,177,220, 32,193,213,111,145,152, 76,241, 90,212, 94,
+ 98,231,  2, 67, 46,196,190,106,233,157,167,109,140, 63,223,134, 58,102, 19,101,158, 99,205,  9,142, 20, 53, 60,108, 78, 54,250,
+ 45,  1,178, 88, 53, 47,201, 84,233,173, 56,130,179,233,136,  3, 82, 99,197,128,170, 35,101, 64,172,232, 19,231,236, 80, 80,143,
+ 87, 71,104,160, 79,222,112,214,212,195, 73, 51,181,196, 51, 62,187, 75,104, 91,253,202, 57, 35,193,227, 52,153, 37,179,215,250,
+121, 26,206,115, 57, 85,113, 54,207,195,  5, 27,  9,118,117, 39, 95,162,109,202, 18, 66, 95, 82,133,217, 22, 68, 38,181,131,177,
+117,143,185, 36, 44,128, 65,124,180, 92,250,122,128, 52, 98,128, 15,169,163,124,231,  3, 49, 25,108, 37, 21,177,159, 81, 32, 69,
+203,151, 75, 14, 75,249, 43,138, 47, 25, 72,168, 38,242,208, 51, 38, 27, 13,138,179,130,217,103, 37, 21, 27, 45,186,193, 83,242,
+220,118,173, 62,152,  8,177, 20, 28, 35, 37, 37,138,  6,186, 16,112, 14, 22,197,138, 70,145,192,186, 59,195,198,198, 22,125, 74,
+104, 73,204,143, 79,200,121, 96, 49, 38,154,198, 44,113, 33,120,154,166, 97,119,111,159,146, 35,107, 19,207,180, 11, 56, 23,152,
+ 54,134, 15,238, 99,180,206,211, 53,244,140,148,108,130,165,147,217,156,166, 13,156, 46,145, 46,100,118,175,237,161, 57,146, 83,
+100,251,220, 89,242,116,131,227,217, 49, 82, 10,147, 83, 29,167, 78,173,161,163,167, 35, 49,245, 29,147,105,192,183,230, 60, 48,
+113, 78, 65,218, 27, 19,190, 54,192, 34,141,228,226,  9,210,144,211, 64, 44,153,152, 70, 14,143, 70,102, 39, 61, 89,  6, 83, 31,
+139, 88,167,164, 14, 45, 29,237,116, 74,167,137,245, 86,  9, 59, 21,104, 83,122,114,206,184,177, 48,166,129,163,249,156, 49,142,
+164, 81, 25,198,194, 34, 42,195, 48, 34,206,130,101,156,111,152,116,245,204,114, 66, 19,132,157,205,117,214, 54,183,141,213,144,
+147,173,130, 74,230,181,235,251,188,122,241,114,205, 66, 55,209, 85,159, 19,231,207,238,208, 53, 13,254,100,206,250,198, 26,184,
+142, 75,215,103, 92,218, 61,225, 99, 63,246,195, 76,166,103,249,213,223,250, 12,126,109, 27,130, 97,136, 83, 52, 38,125, 63,212,
+192, 44, 95,136,163, 81, 29, 93, 41,118,102,131,141,106,197,200,103,193,153, 31,223,139,173, 11,125,181,136,165,229,184, 91,108,
+ 28,236, 93,107, 93,179,128,102, 71,231,212, 44,199,226,173,123,198,  4,213,169,138,198,180,234, 57,146, 38, 52, 89,215,169,229,
+198,170,211, 50,202, 21,239,205,103,190, 28,235,199, 58,163,196,153,239, 93,106,144, 86,211, 52,248, 58,177,117,174,174,171,181,
+216, 90, 75,151,219,109, 59, 95, 69, 28, 41, 69, 60, 66,235, 61,189, 83, 19, 86,146,113, 14,123, 14,107, 48,153,138,224, 83,  5,
+ 25,137,253,254, 36,147, 90,107,168,171,225,148,140, 91, 47,206,254,101,245,236, 21,234, 36,184,152,232, 78,156, 71,178,153,213,
+ 20,200,110,233, 16,178,105, 67, 34,155,194, 31, 76, 20,156, 11,161,166,129,170,203, 21,119,108,200,113,245,  5,141, 84,151,145,
+ 53, 52,174, 10,216,109, 53, 90,181, 75,181,121, 21, 49,209, 97,201, 74, 44, 66,112,222,219,151,206,242,206, 17, 59,144,196,164,
+136,141,171, 96,  2,164, 86,100, 74,241,213, 61, 86, 71, 48,203, 93,115,169, 99,124, 17,103, 59, 98, 48,181, 56,106,225,240, 62,
+ 84, 68,171, 17,162, 76, 25, 10, 46,203,202,211,237,138, 61, 88,136,172, 38,  6, 78,188,137,176, 82,164, 36,235,222,139,100,139,
+ 66, 21,197,249,182, 94,210,163, 65,245,157,  9,234,156,247,148,100,129, 46,234, 66,197,214, 22, 84,171,253,161,140,171, 15, 74,
+  5,188,214,191,119, 73,238,169,251, 17,113,174, 90,206,212, 10, 25,139, 37,178,162,197,217,129,175,130,137,252,178,214,220, 98,
+181,214, 25,251,115,156, 15, 22, 85, 95, 59,254,152, 11,174, 30,192, 89,160, 75,178, 74, 14,203,154,  8,141,162, 99,162, 56, 83,
+ 56, 23,103,179, 14,201,  2,161,179, 18, 86, 70,252,210,168,214, 77,237,191, 43,  6, 67,132, 10, 71, 17, 99,147, 91, 88,200,136,
+250,174, 38,234,217, 37,228,162,146, 27,236,146,213,106,231,145,108,104,215,108, 99, 39, 45, 22,185, 26, 28, 44,162, 34,  4, 26,
+ 47,149,210,103,133, 93, 87,195, 22,114,174,221, 48,174,114,246,141,100, 21,196,108, 70, 41,103,196, 57,218,224, 45,238,180,113,
+248, 42,114,201, 20, 82,117,121,122, 49,113, 74, 94,238,177,188,160,161,144,146, 64, 95, 40, 19, 79,118,130,247,169,170, 78, 13,
+164,227,196,236,108, 77,129, 62, 23,154, 44,166, 90, 87,207, 88, 76, 84,168,222,226, 70,157,218, 37,232,156,224, 75,160, 31, 19,
+184,140,248, 14,209,  6, 29, 51, 89, 50,243, 26,214, 48,169, 95,244, 64, 66,188, 71,179, 89,233, 82, 28, 43,183,188, 37,248,  2,
+154,241, 98,130, 46, 84,151,225,137, 22, 38, 82,113,204, 82,215, 56,185,134,249, 40,  2,121,180,233, 78,201,132, 73,160,100,208,
+ 92,192,  5,130, 55, 76,177,211, 14,193,124,201,217,165,154,232,149,136, 37, 18,199, 66, 86, 99, 68,219,123, 87,104, 90,155,164,
+180,106,164,200, 28, 99,157, 90,100, 22, 37, 17,124,174, 26, 12,111,154,139,152,106,202,157,233, 53,214,167,155,140,100, 72,166,
+121,216,222, 57,197,154, 70,242,152, 88,156,156,172,222,167,152, 96,218, 65,170, 19,211, 18, 51, 49,143,108,174, 79,201, 76, 57,
+153,205,107, 17,108,237,215, 56,140,248,110,194,209,252, 21, 58,151,241,206,115,120,148, 89, 60,119, 17,209, 76, 27,  2, 71,253,
+130,227,131, 14,130,195, 75,166, 33, 32,141,199,139,195,133, 22, 21, 97,125,179, 65,143, 76, 33, 15,129, 38, 52,  8, 13,126, 18,
+200,162, 16, 90,156, 10, 27,205,148,172, 61,161,157,226,137, 38,190, 74, 74, 31,163, 41,135,221,210, 82, 90, 61,238,146, 76,172,
+ 25, 54,112,161,176, 54, 41,180, 34,132,110,100,109,205,132,167,  7,253,192,222,254, 17, 99, 63,162, 37, 17, 75,102, 28,109,247,
+154, 82,102, 28, 51,197,195, 65,127, 76,184, 62,199, 53,129,105,219,178,189, 97,163,243,145,166,198,185, 42,222, 43, 94,140, 27,
+191,125,243,237, 28,204, 18,177, 92, 67, 37,160, 41,211,199,196,167,191,250, 52,119,190,245, 33,238,125,224,  1,254,122,  9,124,
+226, 83, 79, 33, 26, 57,115,182, 53, 97, 89,201,140,243,194, 32,145,152, 51,101,176,243, 56,151, 76, 42,144, 98,164,100, 71,198,
+ 87,125, 14,140,217,147,179, 48,105,237,188, 78,117,215,219, 56, 76,215,226, 12,  2, 84, 74,229, 24,212, 65,154,111,166,  6, 84,
+201, 74,240, 22, 93,236, 75,107,235, 72, 64,187,140,138, 90, 92,183, 26,178, 54, 39,227,  6,148,100,142,129, 36, 74,201, 54,161,
+ 80,205, 72,177, 28, 15, 91, 85,216,236, 92,213, 49, 46,236,210,247,193, 86,156, 46,217, 10,215, 55,  2,165,193, 73,194,183, 54,
+213,243,171,148, 15,123,215, 68,151, 22, 50,  3,  6, 57, 64, 74, 38,136, 77,  7, 20,197, 21,143,115,230, 14,177,181,137, 61,196,
+  6,228, 89,250,192,235,185, 46,230,148, 50,113,191, 86,139,122,205,195,168,235,100,239, 60, 78, 13, 72, 43,150, 79,100, 66,242,
+154, 75, 82, 42,126, 47,166,186, 79,207, 22,241, 45, 78,  8, 89,136,165, 78, 15,140,194, 98, 66,218, 26,160, 33, 85, 57,239,196,
+217,228,118,185,230,175,211,229,214,  9,114,238,246, 55,104,235,116,165,212,179, 29,144, 86,168,124,133,151, 84, 10,142, 23,219,
+111,228, 85, 74, 89,174,119,191,175, 54, 33, 27,125,218, 31, 83, 42, 76,224, 70,231,110,210,124, 27,203,216, 46,195,155, 32, 75,
+179,153,235,169, 10, 64,155, 35,152,117,209,  9, 90, 71,240,138, 89,209,124, 17,  8,222, 14,122,172,251,137,209,168, 82,246,225,
+218, 65,105, 30,119,169,254, 71, 95,139,143,234,232,211,202,224, 93,238,112,212,118, 88,158,170,160, 22,187, 40,114,205,132, 19,
+105,240, 90,139,154,229,128, 94,108,164, 98,202,247, 37, 88,160,170,251,  5,235, 62, 75,169, 75, 95, 91, 39,248,101,141,229,188,
+ 61, 52,206,255,255, 77,157, 75,139, 37, 69, 16,133, 79, 68,100,214,189,211,190,  6,231,225,204,232,128,  8, 34,184, 18,183,238,
+252,213,254,  1,119,110,213,133,  8,186, 17,193,141,142, 76,223,170,138,204,  8, 23, 39,170,218, 85, 67,211,208,175,170,204,120,
+156,243, 29, 10,166,160, 24,226, 53, 94, 21, 38, 20, 73, 98, 14,175,157, 84, 71,111,  2,175,127,174,246,165,252,138,173,148,249,
+220, 17, 29,213,247,169, 78,146,194, 14,  6,  5,100, 83, 38,105, 88,  9,184, 68, 41, 80, 75, 35,  1,  7,172, 65, 66,216, 37,198,
+118, 78, 23,178,188,145, 49,202,174, 82,104, 88,105,165, 32, 69,199,242,168, 67,179, 35,125, 32, 45, 17, 42, 72, 95, 57,109, 17,
+218,243,182,122,150,186,  4, 55, 36,141, 68, 59, 40,199, 87, 57,248, 51,183, 54,234, 91, 43,181,142, 98, 64, 36, 54,103, 72,202,
+ 16,238,160,150, 43, 93, 26,126,207,203, 98,233,236, 36,229,216,109,178,109, 97, 21, 95, 79, 46,145,152, 15,200, 98, 53, 57,115,
+ 14,124,  4,102, 52, 64,137,  7,102, 65,211,  8,223,176,134,244, 32,121,203, 26, 36, 43, 20, 99, 80,254,216,170, 27,154, 57,177,
+ 40,213,190,  3,  2,100, 67,196, 64,107, 70,142,128,  4,154, 49,101, 44,102, 98, 42, 99, 68,187,  5, 38, 40, 42,186,154,192, 35,
+152,197, 93,194,192, 24, 65,  4,170,112, 38, 52, 51, 96, 40,154,151, 37,196,147,190,233, 57,128, 14, 10,196, 60, 79, 34,149,  4,
+139,117, 15,118, 37,164,193, 49, 50,118,228,113,152,213,187, 32,129, 17, 43, 26, 26,139,128,224,251, 12,229,247,  9,163,240,210,
+ 55,199,182,222, 48, 99,167,214, 98,225,225, 57,198,196, 85,  3,210, 30,225,182, 15,228,220,185,178,177,134, 23, 47,158,226,238,
+238, 49,166,  7,110,111,254,196,239,127,252,133,155,  3, 47,158,127,132, 71,239,189,  3, 76,197,229,218,145,166,144, 80, 44,166,
+208, 46, 88,132,129, 62,189, 84,214,210, 13,125,161,200,113,  1, 69,141,104, 64, 95,174,184,235,244,105,239,201, 78, 85, 67,177,
+ 23,175, 32,125, 69,107,236,250,210,121,102,141, 57,207,206,175, 13,224, 30,  0,116,192, 60,225, 30,240,216,145, 38,167,182, 72,
+ 77,177, 99,208,159,126,227,185, 36, 25,240,233,136, 16, 12, 15,108,251,141, 35,247, 49,176,110, 43, 54,103,104, 78,235,132,170,
+220,223,110,216,239,111, 96,201,108,104,  6, 60,254,224,125, 92,222,125,138,125,191,135, 97,240,153, 58,210,234,  0, 60,121,249,
+  2, 95,126,241, 26,159,125,250, 10, 63,253,252, 27,222,252,253, 15,150, 75,103,170,226,164,173, 43,149, 30,248,136, 64, 95, 26,
+238,218, 35,160, 37,214,109,197, 92,189,  4,135, 59,223, 53,101,179, 54,157, 92,122,215,  6,247,  1, 76,131, 87, 81, 46,214, 49,
+247,114,163,244, 36,179, 36,146,145, 55, 66, 33, 93,231,  6, 25, 30, 44,  8, 99,140, 18, 45,179, 25,202,242,200,107,146,111,130,
+  3,104, 22,156, 94,248, 44, 97,116,  4, 11,131, 18,101, 19,106, 83,196,184, 26,211,103,204, 83,175, 64,191,248, 65,158,235, 21,
+112,194,102,139,206, 37,173,  0, 50,186, 11,154,150,230, 38,153,209, 17,189, 82,252,146,202,243, 17, 15, 65, 42, 25,138,136,  9,
+ 45, 40,137,227, 32,144, 22, 42,191,108,175,162,198,162, 82,178,142,220,226,229, 43,155,165,204,242,150,151,123,152, 22,248, 26,
+233, 11, 67,106,172,160, 69, 25, 65,187,175, 82,220,141,  6,152, 20,  1,180, 36,224,113, 82, 71, 42,122, 91,128,156, 92,127,165,
+  0,242,252,245,103,217, 15,212, 30,180,186,204,146,106, 41, 21,229,140, 48, 52,138,204,216, 62,148, 23,139, 63,136,150,111, 48,
+165,  2, 35,106,212,130,164,245, 65,114,224, 48,124, 20,194,134, 31, 75, 68, 32,101, 91, 35, 30,190, 50,144, 85,207,172,117,126,
+221,177,219,160,226, 93,  0,132,105,197,208, 81,201, 42,162,116, 97, 24, 71,238,166, 28, 65, 31,126, 75, 42, 39,216,165, 74,240,
+ 79,147,149,156,131,170,122,154, 54, 70, 78,202,  1,224,121,200,244,157, 17, 36,157, 85, 42, 78,166,210,210,102,117, 83,228,172,
+ 24, 79,150, 10,140,205, 27,188,116,149, 42,109,148,173, 65,117,129, 40,  9, 68,170,244,182,241,240,101,241, 65,155, 28,125,166,
+ 99, 38,154,118,168, 82, 16,168, 10,160, 53,216, 89,229, 38,250,113,241,218,133,157, 97, 58,125,225,194,106, 53,208,208,154, 34,
+125,175, 64, 70,197,144,  9,193, 66, 15,111,173, 36, 18, 29,211, 55,168, 68,177,180,219,131, 24,228,172, 20,  5, 37,241,168,169,
+  5, 47, 75, 51,131,161,115, 12, 39,  2,109, 87,104,  4, 34,189, 38, 65,220, 97, 91, 85,153,138,168,152, 92,242, 13, 22, 89, 32,
+145,216,146, 43, 25, 65,226,178, 24,124,196,233,141,190, 52,190,176, 35,  2, 22,137,222, 13, 35, 20, 57,248, 91,181, 14,126,110,
+ 70,173,126, 88, 56,101, 38, 53, 24, 57, 41,104,116,190,  8,158,252,123,170, 52,104, 35,169,110, 34, 49,149,207,242,184,119,116,
+105,240,218,133, 55, 17,116,  3,246, 16,180, 34,235, 29,129, 33,237, 16,  9,  5, 57,250,172,191, 72, 78, 51,101, 58,215, 28, 19,
+150, 64,191,112,188, 56,182,193,181, 73,  5, 78,112,  4, 42, 20,125,166, 66, 26, 57,250, 45, 73,181,226,122,108, 47,251, 17,159,
+ 25,170, 99,121, 96, 70, 18, 92,132,166,152,251,198, 78, 41,152,225,189,198, 10,137,138,107,172,125,107,179, 14,157, 66, 30,120,
+ 30, 43, 48,250,172,103,240,125, 60,231, 82,166, 76,  1, 27,  1, 91, 20, 97,128,140,192,186, 13, 24, 38,145,186, 49, 32, 50, 17,
+131,100, 51, 31, 94, 72,105,224,237,253,142,102, 13,159,188,122,205, 93,110,118,124,251,205, 87,248,245,151, 31,241,221,247, 63,
+224,195,103, 31,227,114,119, 69, 14,170,166, 69,  5, 54, 19,166, 29, 48, 66,113, 76, 27,236,194,194,185, 47, 68,159,154, 24, 46,
+ 11, 17,182, 98,156,234,221, 93, 47,212,128,216, 21, 88, 58,252,237,134,136,149, 16,146, 69,208, 50,176, 72, 98, 15, 67, 88,194,
+ 60,177,152,226,182, 79,226,178,141,221,105, 43,245,122,143,  6, 55, 94,202,195, 57, 65,139,160, 16, 48,110,117,248,254,239, 98,
+ 72,153, 24,251,138,  8, 96, 12, 96, 93,223, 98,250,196,190, 77,184,111,248,119,223, 24,219,234,142,183,235, 13,155, 15, 54, 21,
+203, 21, 51,  8, 29,233,151,142,222, 13, 10,171,  9, 90, 98,236,142,125, 50, 64,234,235,207, 95,226,201,211,103, 12, 21,154,206,
+204,251,203,  5,161, 19,195,  3,178, 57, 90, 87, 76, 91, 48, 66, 17,219, 14,228, 32, 67,220, 12,195,  3, 41,137, 46,197,198,  7,
+ 65, 99,185, 57,167, 77,197, 83,245, 32,142, 84, 58, 67,181,124,212,121, 39,134, 61,192, 20, 64, 34,213,224,147,194,186,  0,233,
+117, 82,209,161, 82,241, 48, 86,205,222, 60,  8,165,117,246, 11,120,121, 19, 75, 59,153,107, 49,179,168,160,147,133, 56, 33, 21,
+149,246, 29,213,107,242,121,214,  0,208,137,133,205,164, 83,202, 14,135,185,234,185,186,109,198,119, 88, 68, 79, 49,114, 36, 96,
+ 89,120,107, 86,229,216,133,151,242,220,198,131,147, 73,170,161, 19, 54,  5, 40,235,154,158,  1,101,165,164,175,112, 45,137, 35,
+222,249, 48,106,101, 53,181, 21, 13, 94, 93,182,130,139,243, 84,174,142,219, 65,116, 85, 78,141,180, 26, 66, 20, 13, 50,148,239,
+  2,202,153,149, 73,180,114, 72, 32,162,225, 63,143, 52,168,208, 66, 34,213,237,  0,  0,  0,  0, 73, 69, 78, 68,174, 66, 96,130,
   0};
 
diff --git a/source/blender/editors/datafiles/startup.blend.c b/source/blender/editors/datafiles/startup.blend.c
index dc92d35..681c8cd 100644
--- a/source/blender/editors/datafiles/startup.blend.c
+++ b/source/blender/editors/datafiles/startup.blend.c
@@ -1,711 +1,903 @@
 /* DataToC output of file <startup_blend> */
 
-int datatoc_startup_blend_size= 342096;
-char datatoc_startup_blend[]= {
- 66, 76, 69, 78, 68, 69, 82, 95,118, 50, 53, 56, 82, 69, 78, 68,
- 32,  0,  0,  0, 44,243, 34,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 83, 99,101,110,101,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 71, 76, 79, 66, 24,  1,  0,  0, 20,242, 34,  0,199,  0,  0,  0,
-  1,  0,  0,  0, 32, 32, 32, 49,  1,  0,  0,  0,250,  0,  0,  0,  1,  0,  0,  1,184,250,213,  2,144,  1,228,  2,  0, 16,  0,  0,
-128, 32,  4,  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,
+int datatoc_startup_blend_size = 358256;
+char datatoc_startup_blend[] = {
+ 66, 76, 69, 78, 68, 69, 82, 45,118, 50, 54, 50, 82, 69, 78, 68,
+ 32,  0,  0,  0,240,135,236,191,255,127,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 83, 99,101,110,
+101,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 71, 76, 79, 66, 48,  4,  0,  0,224,131,236,191,
+255,127,  0,  0,216,  0,  0,  0,  1,  0,  0,  0, 32, 32, 32, 52,  4,  0,  0,  0,250,  0,  0,  0,  1,  0,  0,  1,152, 62, 19,  6,
+  0,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0,  0, 16,  0,  0,128, 32,  4,  0,131,179,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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, 87, 77,  0,  0,
-168,  0,  0,  0, 64,192,225,  2,107,  1,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 87, 77, 87,105,110, 77, 97,110,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 96,248,213,  2, 96,248,213,  2, 96,248,213,  2, 96,248,213,  2,  3,  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, 16,  0,  0,  0,  2,  0,  0,  0,  2,  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,
-152,247,213,  2,152,247,213,  2,152,247,213,  2, 64,254,215,  2, 64,254,215,  2, 64,254,215,  2, 68, 65, 84, 65,148,  0,  0,  0,
- 96,248,213,  2,108,  1,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,224,238,214,  2,  1,  0,  0,  0,  0,  0,  0,  0,
-184,250,213,  2,  0,  0,  0,  0,115, 99,114,101,101,110,  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, 66,  0,240,  4,222,  2,  0,  0,  0,  0,  1,  0,238,  3,  0,  0,  0,  0,  1,  0,  0,  0,
-112,103,215,  2,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,208,132,246,  3,120,197,  5,  4,120,197,  5,  4,
-192, 24,216,  2,208, 23,216,  2, 72, 24,216,  2, 72, 24,216,  2,168, 80,  3,  4,248, 85,  3,  4,  0,  0,  0,  0,  0,  0,  0,  0,
- 83, 78,  0,  0,148,  0,  0,  0, 40,249,213,  2,193,  0,  0,  0,  1,  0,  0,  0,240,249,213,  2,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 83, 82, 65,110,105,109, 97,116,105,111,110,  0, 46, 48, 48, 49,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 48,203,205,  2,120,193,225,  2,192,193,225,  2,160,201,225,  2,128, 81,215,  2,112, 85,215,  2,
-  0,  0,  0,  0,  0,  0,  0,  0,144,  1,228,  2,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,148,238, 92,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0, 48,203,205,  2,194,  0,  0,  0,  1,  0,  0,  0,120,203,205,  2,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,120,203,205,  2,194,  0,  0,  0,
-  1,  0,  0,  0,192,203,205,  2, 48,203,205,  2,  0,  0,  0,  0,  0,  0,222,  2,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,
-192,203,205,  2,194,  0,  0,  0,  1,  0,  0,  0,  8,204,205,  2,120,203,205,  2,  0,  0,  0,  0,240,  4,222,  2,  0,  0,  0,  0,
- 68, 65, 84, 65, 20,  0,  0,  0,  8,204,205,  2,194,  0,  0,  0,  1,  0,  0,  0, 80,204,205,  2,192,203,205,  2,  0,  0,  0,  0,
-240,  4,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0, 80,204,205,  2,194,  0,  0,  0,  1,  0,  0,  0,152,204,205,  2,
-  8,204,205,  2,  0,  0,  0,  0,  0,  0,195,  2,  1,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,152,204,205,  2,194,  0,  0,  0,
-  1,  0,  0,  0,224,204,205,  2, 80,204,205,  2,  0,  0,  0,  0,240,  4,195,  2,  1,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,
-224,204,205,  2,194,  0,  0,  0,  1,  0,  0,  0, 40,205,205,  2,152,204,205,  2,  0,  0,  0,  0, 24,  4,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 20,  0,  0,  0, 40,205,205,  2,194,  0,  0,  0,  1,  0,  0,  0,112,205,205,  2,224,204,205,  2,  0,  0,  0,  0,
- 24,  4,195,  2,  1,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,112,205,205,  2,194,  0,  0,  0,  1,  0,  0,  0,184,205,205,  2,
- 40,205,205,  2,  0,  0,  0,  0, 24,  4, 60,  1,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,184,205,205,  2,194,  0,  0,  0,
-  1,  0,  0,  0,  0,206,205,  2,112,205,205,  2,  0,  0,  0,  0,240,  4, 60,  1,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,
-  0,206,205,  2,194,  0,  0,  0,  1,  0,  0,  0, 72,206,205,  2,184,205,205,  2,  0,  0,  0,  0,  0,  0, 88,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 20,  0,  0,  0, 72,206,205,  2,194,  0,  0,  0,  1,  0,  0,  0,144,206,205,  2,  0,206,205,  2,  0,  0,  0,  0,
- 24,  4, 88,  0,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,144,206,205,  2,194,  0,  0,  0,  1,  0,  0,  0,216,206,205,  2,
- 72,206,205,  2,  0,  0,  0,  0,192,  1, 88,  0,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,216,206,205,  2,194,  0,  0,  0,
-  1,  0,  0,  0, 32,207,205,  2,144,206,205,  2,  0,  0,  0,  0,192,  1,195,  2,  1,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,
- 32,207,205,  2,194,  0,  0,  0,  1,  0,  0,  0,104,207,205,  2,216,206,205,  2,  0,  0,  0,  0,  0,  0,  4,  1,  0,  0,  0,  0,
- 68, 65, 84, 65, 20,  0,  0,  0,104,207,205,  2,194,  0,  0,  0,  1,  0,  0,  0, 48,193,225,  2, 32,207,205,  2,  0,  0,  0,  0,
-192,  1,  4,  1,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0, 48,193,225,  2,194,  0,  0,  0,  1,  0,  0,  0,120,193,225,  2,
-104,207,205,  2,  0,  0,  0,  0, 24,  4, 60,  2,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,120,193,225,  2,194,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0, 48,193,225,  2,  0,  0,  0,  0,240,  4, 60,  2,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,
-192,193,225,  2,195,  0,  0,  0,  1,  0,  0,  0,  8,194,225,  2,  0,  0,  0,  0,120,203,205,  2,192,203,205,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,  8,194,225,  2,195,  0,  0,  0,  1,  0,  0,  0, 80,194,225,  2,192,193,225,  2,
-120,203,205,  2, 80,204,205,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 80,194,225,  2,195,  0,  0,  0,
-  1,  0,  0,  0,152,194,225,  2,  8,194,225,  2,192,203,205,  2,152,204,205,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 24,  0,  0,  0,152,194,225,  2,195,  0,  0,  0,  1,  0,  0,  0,224,194,225,  2, 80,194,225,  2, 80,204,205,  2,152,204,205,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,224,194,225,  2,195,  0,  0,  0,  1,  0,  0,  0, 40,195,225,  2,
-152,194,225,  2, 48,203,205,  2,224,204,205,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 40,195,225,  2,
-195,  0,  0,  0,  1,  0,  0,  0,112,195,225,  2,224,194,225,  2,  8,204,205,  2,224,204,205,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 24,  0,  0,  0,112,195,225,  2,195,  0,  0,  0,  1,  0,  0,  0,184,195,225,  2, 40,195,225,  2,152,204,205,  2,
- 40,205,205,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,184,195,225,  2,195,  0,  0,  0,  1,  0,  0,  0,
-  0,196,225,  2,112,195,225,  2,224,204,205,  2,112,205,205,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,
-  0,196,225,  2,195,  0,  0,  0,  1,  0,  0,  0, 72,196,225,  2,184,195,225,  2,  8,204,205,  2,184,205,205,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 72,196,225,  2,195,  0,  0,  0,  1,  0,  0,  0,144,196,225,  2,  0,196,225,  2,
-112,205,205,  2,184,205,205,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,144,196,225,  2,195,  0,  0,  0,
-  1,  0,  0,  0,216,196,225,  2, 72,196,225,  2, 48,203,205,  2,  0,206,205,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 24,  0,  0,  0,216,196,225,  2,195,  0,  0,  0,  1,  0,  0,  0, 32,197,225,  2,144,196,225,  2, 40,205,205,  2, 72,206,205,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 32,197,225,  2,195,  0,  0,  0,  1,  0,  0,  0,104,197,225,  2,
-216,196,225,  2,224,204,205,  2, 72,206,205,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,104,197,225,  2,
-195,  0,  0,  0,  1,  0,  0,  0,176,197,225,  2, 32,197,225,  2,  0,206,205,  2, 72,206,205,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 24,  0,  0,  0,176,197,225,  2,195,  0,  0,  0,  1,  0,  0,  0,248,197,225,  2,104,197,225,  2,  0,206,205,  2,
-144,206,205,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,248,197,225,  2,195,  0,  0,  0,  1,  0,  0,  0,
- 64,198,225,  2,176,197,225,  2, 72,206,205,  2,144,206,205,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,
- 64,198,225,  2,195,  0,  0,  0,  1,  0,  0,  0,136,198,225,  2,248,197,225,  2, 80,204,205,  2,216,206,205,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,136,198,225,  2,195,  0,  0,  0,  1,  0,  0,  0,208,198,225,  2, 64,198,225,  2,
- 40,205,205,  2,216,206,205,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,208,198,225,  2,195,  0,  0,  0,
-  1,  0,  0,  0, 24,199,225,  2,136,198,225,  2,144,206,205,  2,216,206,205,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 24,  0,  0,  0, 24,199,225,  2,195,  0,  0,  0,  1,  0,  0,  0, 96,199,225,  2,208,198,225,  2,  0,206,205,  2, 32,207,205,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 96,199,225,  2,195,  0,  0,  0,  1,  0,  0,  0,168,199,225,  2,
- 24,199,225,  2,144,206,205,  2,104,207,205,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,168,199,225,  2,
-195,  0,  0,  0,  1,  0,  0,  0,240,199,225,  2, 96,199,225,  2, 32,207,205,  2,104,207,205,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 24,  0,  0,  0,240,199,225,  2,195,  0,  0,  0,  1,  0,  0,  0, 56,200,225,  2,168,199,225,  2,112,205,205,  2,
- 48,193,225,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 56,200,225,  2,195,  0,  0,  0,  1,  0,  0,  0,
-128,200,225,  2,240,199,225,  2, 40,205,205,  2, 48,193,225,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,
-128,200,225,  2,195,  0,  0,  0,  1,  0,  0,  0,200,200,225,  2, 56,200,225,  2,152,204,205,  2,120,193,225,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,200,200,225,  2,195,  0,  0,  0,  1,  0,  0,  0, 16,201,225,  2,128,200,225,  2,
-184,205,205,  2,120,193,225,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 16,201,225,  2,195,  0,  0,  0,
-  1,  0,  0,  0, 88,201,225,  2,200,200,225,  2, 48,193,225,  2,120,193,225,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 24,  0,  0,  0, 88,201,225,  2,195,  0,  0,  0,  1,  0,  0,  0,160,201,225,  2, 16,201,225,  2, 80,204,205,  2, 32,207,205,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,160,201,225,  2,195,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
- 88,201,225,  2,216,206,205,  2,104,207,205,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 96,  0,  0,  0,128, 81,215,  2,
-197,  0,  0,  0,  1,  0,  0,  0, 16, 82,215,  2,  0,  0,  0,  0, 80,204,205,  2,120,203,205,  2,192,203,205,  2,152,204,205,  2,
-  0,  0,  0,  0,  0,  0,  0,  0,240,  4,  0,  0,196,  2,  0,  0,222,  2,  0,  0,  7,  7,241,  4, 27,  0,  1,  0,  0,  0,  0,  0,
-  7,  0,  0,  0,136,129,206,  2,216,232,220,  2,216,232,220,  2, 24,213,225,  2, 64,214,225,  2,  0,  0,  0,  0,  0,  0,  0,  0,
-136, 69,  6,  4,232, 69,  6,  4, 68, 65, 84, 65,248,  0,  0,  0, 24,213,225,  2,198,  0,  0,  0,  1,  0,  0,  0, 64,214,225,  2,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,128,148, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0, 32,158, 68,  0,  0,  0,  0,
-  0,  0,208, 65,  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,240,  4,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,158, 68,  0,  0,200, 65,  0,  0,158, 68,
-  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,241,  4, 26,  0,241,  4,
- 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  4,  0,  0,196,  2,  0,  0,221,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,241,  4, 26,  0,  0,  0,  1,  0,  2,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 64,206,  2,  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, 68, 65, 84, 65,248,  0,  0,  0, 64,214,225,  2,
-198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 24,213,225,  2,  0,  0,  0,  0,  0,240,109, 69,  0,  0,128,192,  0,  0,  0,  0,
-  0,  0,  0,  0,255,255,109, 69,  0,  0,  0,192,  0,  0,  0,  0,112,  7,  0,  0,129,  7,  0,  0, 18,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,111,  7,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,111,  7,  0,  0, 18,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  2,  0,  0,  0,  1,  0,  3,  3,
-  2,  0,  0,  4, 10,  0,129,  7,  2,  0,112,  7,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,222,  2,  0,  0,222,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,144, 63,206,  2,
-  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,
- 68, 65, 84, 65, 96,  0,  0,  0, 16, 82,215,  2,197,  0,  0,  0,  1,  0,  0,  0,160, 82,215,  2,128, 81,215,  2,224,204,205,  2,
-112,205,205,  2,184,205,205,  2,  8,204,205,  2,  0,  0,  0,  0, 25,  4,  0,  0,240,  4,  0,  0,  0,  0,  0,  0, 59,  1,  0,  0,
-  4,  4,216,  0, 60,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,168,127,206,  2,248,234,225,  2,248,234,225,  2,104,215,225,  2,
-144,216,225,  2,  0,  0,  0,  0,  0,  0,  0,  0, 72, 70,  6,  4,  8, 71,  6,  4, 68, 65, 84, 65,248,  0,  0,  0,104,215,225,  2,
-198,  0,  0,  0,  1,  0,  0,  0,144,216,225,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,148, 67,  0,  0,  0,  0,  0,  0,208, 65,
- 98, 39, 38, 54,  0,  0, 88, 67,  0,  0,  0,  0,  0,  0,208, 65,  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,215,  0,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,
-  0,  0, 87, 67,  0,  0,200, 65,  0,  0, 87, 67,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,
-  4,  0, 12,  0, 10,  0,216,  0, 26,  0,216,  0, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 25,  4,  0,  0,
-240,  4,  0,  0, 34,  1,  0,  0, 59,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,216,  0, 26,  0,
-  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,206,  2,
   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,
- 68, 65, 84, 65,248,  0,  0,  0,144,216,225,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,104,215,225,  2,  0,  0,  0,  0,
-  0,  0, 88, 67,  0,  0, 61,196,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0, 71, 67,  1,  0,145,195,  0,  0,  0,  0,199,  0,  0,  0,
-216,  0,  0,  0,  0,  0,  0,  0, 33,  1,  0,  0,  0,  0,  0,  0, 62,  1,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,
-198,  0,  0,  0,  0,  0,  0,  0, 33,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,
-  0,  0,  0, 64, 10,  1,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,216,  0, 34,  1,199,  0, 34,  1,  0,  0,112,106,244,  3,
-  1,  0,  0,  0,  0,  0,  0,  0, 25,  4,  0,  0,240,  4,  0,  0,  0,  0,  0,  0, 33,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,216,  0, 34,  1,  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,112, 62,206,  2,  0,  0,  0,  0,  0,  0,  0,  0,184,217,225,  2,136,233,225,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 64,  1,  0,  0,184,217,225,  2,196,  0,  0,  0,  1,  0,  0,  0,
- 40,219,225,  2,  0,  0,  0,  0,104,128,206,  2,  0,  0,  0,  0, 66, 85, 84, 84, 79, 78, 83, 95, 80, 84, 95, 99,111,110,116,101,
-120,116,  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, 66, 85, 84, 84, 79, 78, 83, 95, 80, 84, 95, 99,111,110,116,101,
-120,116,  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, 67,111,110,116,101,120,116,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,220,255,199,  0, 36,  0,  0,  0,  0,  0,  0,  0, 42,  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,  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,
- 68, 65, 84, 65, 64,  1,  0,  0, 40,219,225,  2,196,  0,  0,  0,  1,  0,  0,  0,152,220,225,  2,184,217,225,  2,208,  0,222,  2,
-  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,114,101,110,100,101,114,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,114,101,110,100,101,114,  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, 82,101,110,100,101,114,  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,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,135,255,199,  0, 61,  0,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,152,220,225,  2,
-196,  0,  0,  0,  1,  0,  0,  0,  8,222,225,  2, 40,219,225,  2,248,  1,222,  2,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80,
- 84, 95,108, 97,121,101,114,115,  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, 82, 69, 78, 68, 69, 82, 95, 80,
- 84, 95,108, 97,121,101,114,115,  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, 76, 97,121,101,114,115,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,111,255,199,  0,  0,  0,
-  0,  0,  0,  0,  4,  0, 10,  0,  0,  0,  0,  0,  2,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,  8,222,225,  2,196,  0,  0,  0,  1,  0,  0,  0,120,223,225,  2,
-152,220,225,  2, 32,  3,222,  2,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,100,105,109,101,110,115,105,111,110,115,
   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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,100,105,109,101,110,115,105,111,110,115,
   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, 68,105,109,101,110,115,105,111,110,115,  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,  0,  0,  0,  0,  0,  0,140,254,199,  0,203,  0,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0,  0,  0,
-  3,  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,  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, 87, 77,  0,  0,
+ 88,  1,  0,  0, 56,107, 18,  6,  0,  0,  0,  0,146,  1,  0,  0,  1,  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, 87, 77, 87,105,110, 77, 97,110,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,216,108, 18,  6,  0,  0,  0,  0,216,108, 18,  6,  0,  0,  0,  0,216,108, 18,  6,
+  0,  0,  0,  0,216,108, 18,  6,  0,  0,  0,  0,  3,  0,  0,  0,  1,  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, 72, 26,135,109,161,127,  0,  0, 72, 26,135,109,
+161,127,  0,  0, 16,  0,  0,  0,  2,  0,  0,  0,  2,  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,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,184,  1,  3,108,161,127,  0,  0,152,  3,  3,108,161,127,  0,  0,184,  1,  3,108,
+161,127,  0,  0,168,  2,  3,108,161,127,  0,  0,152,  3,  3,108,161,127,  0,  0,136,  4,  3,108,161,127,  0,  0,136,  4,  3,108,
+161,127,  0,  0,136,  4,  3,108,161,127,  0,  0, 68, 65, 84, 65,  0,  1,  0,  0,216,108, 18,  6,  0,  0,  0,  0,147,  1,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  3,108,161,127,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,152, 62, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,115, 99,114,101,101,110,  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,  0,  0,  0,  0,  0,  0,  0,  0, 65,  6,  1,  0,126,  7,146,  4,  0,  0,  0,  0,
+  1,  0,238,  3,  0,  0,  0,  0,  1,  0,  0,  0, 88,205, 12,108,161,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,232,254, 12,108,161,127,  0,  0,232, 17, 69,109,161,127,  0,  0,232, 17, 69,109,
+161,127,  0,  0,152,207, 12,108,161,127,  0,  0,  8,183, 12,108,161,127,  0,  0, 24,206, 12,108,161,127,  0,  0, 24,206, 12,108,
+161,127,  0,  0,104,208, 12,108,161,127,  0,  0,184, 12, 13,108,161,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 83, 78,  0,  0,  8,  1,  0,  0, 40,110, 18,  6,  0,  0,  0,  0,210,  0,  0,  0,  1,  0,  0,  0, 24,210, 18,  6,
+  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, 83, 82, 65,110,
+105,109, 97,116,105,111,110,  0, 46, 48, 48, 49,  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,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 88, 53, 18,  6,  0,  0,  0,  0,  8,118, 18,  6,
+  0,  0,  0,  0,120,118, 18,  6,  0,  0,  0,  0,184,130, 18,  6,  0,  0,  0,  0, 40,131, 18,  6,  0,  0,  0,  0, 72,200, 18,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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, 68, 65, 84, 65, 32,  0,  0,  0, 88, 53, 18,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,200, 53, 18,  6,
   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, 68, 65, 84, 65,
- 64,  1,  0,  0,120,223,225,  2,196,  0,  0,  0,  1,  0,  0,  0,232,224,225,  2,  8,222,225,  2, 72,  4,222,  2,  0,  0,  0,  0,
- 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 97,110,116,105, 97,108,105, 97,115,105,110,103,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 32,  0,  0,  0,200, 53, 18,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,120,111, 18,  6,  0,  0,  0,  0, 88, 53, 18,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,222,  2,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,120,111, 18,  6,
+  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,232,111, 18,  6,  0,  0,  0,  0,200, 53, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,240,  4,222,  2,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,232,111, 18,  6,  0,  0,  0,  0,211,  0,  0,  0,
+  1,  0,  0,  0, 88,112, 18,  6,  0,  0,  0,  0,120,111, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  4,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 88,112, 18,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,200,112, 18,  6,
+  0,  0,  0,  0,232,111, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,195,  2,  1,  0,  0,  0, 68, 65, 84, 65,
+ 32,  0,  0,  0,200,112, 18,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0, 56,113, 18,  6,  0,  0,  0,  0, 88,112, 18,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  4,195,  2,  1,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 56,113, 18,  6,
+  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,168,113, 18,  6,  0,  0,  0,  0,200,112, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 24,  4,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,168,113, 18,  6,  0,  0,  0,  0,211,  0,  0,  0,
+  1,  0,  0,  0, 24,114, 18,  6,  0,  0,  0,  0, 56,113, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24,  4,195,  2,
+  1,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 24,114, 18,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,136,114, 18,  6,
+  0,  0,  0,  0,168,113, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24,  4, 60,  1,  0,  0,  0,  0, 68, 65, 84, 65,
+ 32,  0,  0,  0,136,114, 18,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,248,114, 18,  6,  0,  0,  0,  0, 24,114, 18,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  4, 60,  1,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,248,114, 18,  6,
+  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,104,115, 18,  6,  0,  0,  0,  0,136,114, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0, 88,  0,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,104,115, 18,  6,  0,  0,  0,  0,211,  0,  0,  0,
+  1,  0,  0,  0,216,115, 18,  6,  0,  0,  0,  0,248,114, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24,  4, 88,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,216,115, 18,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0, 72,116, 18,  6,
+  0,  0,  0,  0,104,115, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,192,  1, 88,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 32,  0,  0,  0, 72,116, 18,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,184,116, 18,  6,  0,  0,  0,  0,216,115, 18,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,192,  1,195,  2,  1,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,184,116, 18,  6,
+  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0, 40,117, 18,  6,  0,  0,  0,  0, 72,116, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  4,  1,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 40,117, 18,  6,  0,  0,  0,  0,211,  0,  0,  0,
+  1,  0,  0,  0,152,117, 18,  6,  0,  0,  0,  0,184,116, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,192,  1,  4,  1,
+  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,152,117, 18,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,  8,118, 18,  6,
+  0,  0,  0,  0, 40,117, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24,  4, 60,  2,  0,  0,  0,  0, 68, 65, 84, 65,
+ 32,  0,  0,  0,  8,118, 18,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,152,117, 18,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  4, 60,  2,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,120,118, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,232,118, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 53, 18,  6,
+  0,  0,  0,  0,120,111, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,232,118, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 88,119, 18,  6,  0,  0,  0,  0,120,118, 18,  6,  0,  0,  0,  0,200, 53, 18,  6,
+  0,  0,  0,  0, 88,112, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 88,119, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,200,119, 18,  6,  0,  0,  0,  0,232,118, 18,  6,  0,  0,  0,  0,120,111, 18,  6,
+  0,  0,  0,  0,200,112, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,200,119, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 56,120, 18,  6,  0,  0,  0,  0, 88,119, 18,  6,  0,  0,  0,  0, 88,112, 18,  6,
+  0,  0,  0,  0,200,112, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 56,120, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,168,120, 18,  6,  0,  0,  0,  0,200,119, 18,  6,  0,  0,  0,  0, 88, 53, 18,  6,
+  0,  0,  0,  0, 56,113, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,168,120, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 24,121, 18,  6,  0,  0,  0,  0, 56,120, 18,  6,  0,  0,  0,  0,232,111, 18,  6,
+  0,  0,  0,  0, 56,113, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 24,121, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,136,121, 18,  6,  0,  0,  0,  0,168,120, 18,  6,  0,  0,  0,  0,200,112, 18,  6,
+  0,  0,  0,  0,168,113, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,136,121, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,248,121, 18,  6,  0,  0,  0,  0, 24,121, 18,  6,  0,  0,  0,  0, 56,113, 18,  6,
+  0,  0,  0,  0, 24,114, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,248,121, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,104,122, 18,  6,  0,  0,  0,  0,136,121, 18,  6,  0,  0,  0,  0,232,111, 18,  6,
+  0,  0,  0,  0,136,114, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,104,122, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,216,122, 18,  6,  0,  0,  0,  0,248,121, 18,  6,  0,  0,  0,  0, 24,114, 18,  6,
+  0,  0,  0,  0,136,114, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,216,122, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 72,123, 18,  6,  0,  0,  0,  0,104,122, 18,  6,  0,  0,  0,  0, 88, 53, 18,  6,
+  0,  0,  0,  0,248,114, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 72,123, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,184,123, 18,  6,  0,  0,  0,  0,216,122, 18,  6,  0,  0,  0,  0,168,113, 18,  6,
+  0,  0,  0,  0,104,115, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,184,123, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 40,124, 18,  6,  0,  0,  0,  0, 72,123, 18,  6,  0,  0,  0,  0, 56,113, 18,  6,
+  0,  0,  0,  0,104,115, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 40,124, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,152,124, 18,  6,  0,  0,  0,  0,184,123, 18,  6,  0,  0,  0,  0,248,114, 18,  6,
+  0,  0,  0,  0,104,115, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,152,124, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,  8,125, 18,  6,  0,  0,  0,  0, 40,124, 18,  6,  0,  0,  0,  0,248,114, 18,  6,
+  0,  0,  0,  0,216,115, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,  8,125, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,120,125, 18,  6,  0,  0,  0,  0,152,124, 18,  6,  0,  0,  0,  0,104,115, 18,  6,
+  0,  0,  0,  0,216,115, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,120,125, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,232,125, 18,  6,  0,  0,  0,  0,  8,125, 18,  6,  0,  0,  0,  0, 88,112, 18,  6,
+  0,  0,  0,  0, 72,116, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,232,125, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 88,126, 18,  6,  0,  0,  0,  0,120,125, 18,  6,  0,  0,  0,  0,168,113, 18,  6,
+  0,  0,  0,  0, 72,116, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 88,126, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,200,126, 18,  6,  0,  0,  0,  0,232,125, 18,  6,  0,  0,  0,  0,216,115, 18,  6,
+  0,  0,  0,  0, 72,116, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,200,126, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 56,127, 18,  6,  0,  0,  0,  0, 88,126, 18,  6,  0,  0,  0,  0,248,114, 18,  6,
+  0,  0,  0,  0,184,116, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 56,127, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,168,127, 18,  6,  0,  0,  0,  0,200,126, 18,  6,  0,  0,  0,  0,216,115, 18,  6,
+  0,  0,  0,  0, 40,117, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,168,127, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 24,128, 18,  6,  0,  0,  0,  0, 56,127, 18,  6,  0,  0,  0,  0,184,116, 18,  6,
+  0,  0,  0,  0, 40,117, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 24,128, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,136,128, 18,  6,  0,  0,  0,  0,168,127, 18,  6,  0,  0,  0,  0, 24,114, 18,  6,
+  0,  0,  0,  0,152,117, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,136,128, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,248,128, 18,  6,  0,  0,  0,  0, 24,128, 18,  6,  0,  0,  0,  0,168,113, 18,  6,
+  0,  0,  0,  0,152,117, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,248,128, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,104,129, 18,  6,  0,  0,  0,  0,136,128, 18,  6,  0,  0,  0,  0,200,112, 18,  6,
+  0,  0,  0,  0,  8,118, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,104,129, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,216,129, 18,  6,  0,  0,  0,  0,248,128, 18,  6,  0,  0,  0,  0,136,114, 18,  6,
+  0,  0,  0,  0,  8,118, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,216,129, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 72,130, 18,  6,  0,  0,  0,  0,104,129, 18,  6,  0,  0,  0,  0,152,117, 18,  6,
+  0,  0,  0,  0,  8,118, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 72,130, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,184,130, 18,  6,  0,  0,  0,  0,216,129, 18,  6,  0,  0,  0,  0, 88,112, 18,  6,
+  0,  0,  0,  0,184,116, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,184,130, 18,  6,
+  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72,130, 18,  6,  0,  0,  0,  0, 72,116, 18,  6,
+  0,  0,  0,  0, 40,117, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0, 40,131, 18,  6,
+  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,248,134, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 88,112, 18,  6,
+  0,  0,  0,  0,200, 53, 18,  6,  0,  0,  0,  0,120,111, 18,  6,  0,  0,  0,  0,200,112, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,240,  4,  0,  0,196,  2,  0,  0,222,  2,  0,  0,  7,  7,241,  4, 27,  0,  1,  0,  0,  0,  0,  0,
+  7,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,136,209, 18,  6,  0,  0,  0,  0,136,209, 18,  6,  0,  0,  0,  0, 24,132, 18,  6,
+  0,  0,  0,  0,136,133, 18,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0, 24,132, 18,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,136,133, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,148, 68,  0,  0,  0,  0,
+  0,  0,208, 65,  0,  0,  0,  0,  0, 32,158, 68,  0,  0,  0,  0,  0,  0,208, 65,  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,240,  4,  0,  0,  0,  0,  0,  0,
+ 25,  0,  0,  0,  0,  0,158, 68,  0,  0,200, 65,  0,  0,158, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,241,  4, 26,  0,241,  4, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,240,  4,  0,  0,196,  2,  0,  0,221,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,241,  4, 26,  0,  0,  0,  1,  0,  2,  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,  0,
- 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 97,110,116,105, 97,108,105, 97,115,105,110,103,  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,
- 65,110,116,105, 45, 65,108,105, 97,115,105,110,103,  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, 68, 65, 84, 65, 40,  1,  0,  0,136,133, 18,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24,132, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,109, 69,  0,  0,128,192,
+  0,  0,  0,  0,  0,  0,  0,  0,255,255,109, 69,  0,  0,  0,192,  0,  0,  0,  0,112,  7,  0,  0,129,  7,  0,  0, 18,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,111,  7,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,111,  7,  0,  0, 18,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  2,  0,  0,  0,
+  1,  0,  3,  3,  2,  0,  0,  4, 10,  0,129,  7,  2,  0,112,  7,  1,  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,222,  2,  0,  0,222,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  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,  0, 58,254,199,  0, 58,  0, 20,  0,  0,  0,  0,  0, 10,  0,  0,  0,  0,  0,  4,  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,  0,  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0,248,134, 18,  6,  0,  0,  0,  0,214,  0,  0,  0,
+  1,  0,  0,  0,136,159, 18,  6,  0,  0,  0,  0, 40,131, 18,  6,  0,  0,  0,  0, 56,113, 18,  6,  0,  0,  0,  0, 24,114, 18,  6,
+  0,  0,  0,  0,136,114, 18,  6,  0,  0,  0,  0,232,111, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 25,  4,  0,  0,
+240,  4,  0,  0,  0,  0,  0,  0, 59,  1,  0,  0,  4,  4,216,  0, 60,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 72,158, 18,  6,  0,  0,  0,  0, 72,158, 18,  6,  0,  0,  0,  0,232,135, 18,  6,  0,  0,  0,  0, 88,137, 18,  6,
   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, 68, 65, 84, 65, 64,  1,  0,  0,232,224,225,  2,196,  0,  0,  0,
-  1,  0,  0,  0, 88,226,225,  2,120,223,225,  2, 80, 78,217,  2,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,109,111,
-116,105,111,110, 95, 98,108,117,114,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,109,111,
-116,105,111,110, 95, 98,108,117,114,  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, 83, 97,109,112,108,101,100, 32, 77,111,116,105,
-111,110, 32, 66,108,117,114,  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, 34,254,199,  0,  0,  0, 20,  0,  0,  0,
-  4,  0, 10,  0,  0,  0,  0,  0,  5,  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, 68, 65, 84, 65, 40,  1,  0,  0,232,135, 18,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0, 88,137, 18,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,148, 67,  0,  0,  0,  0,  0,  0,208, 65, 98, 39, 38, 54,
+  0,  0, 88, 67,  0,  0,  0,  0,  0,  0,208, 65,  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,215,  0,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0, 87, 67,
+  0,  0,200, 65,  0,  0, 87, 67,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0,
+ 10,  0,216,  0, 26,  0,216,  0, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 25,  4,  0,  0,
+240,  4,  0,  0, 34,  1,  0,  0, 59,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,216,  0, 26,  0,
+  0,  0,  1,  0,  1,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0, 88,226,225,  2,196,  0,  0,  0,  1,  0,  0,  0,200,227,225,  2,232,224,225,  2,
-120, 79,217,  2,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,104, 97,100,105,110,103,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0, 88,137, 18,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,232,135, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 88, 67,  0,  0, 61,196,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0, 71, 67,  1,  0,145,195,  0,  0,  0,  0,199,  0,  0,  0,216,  0,  0,  0,  0,  0,  0,  0, 33,  1,  0,  0,  0,  0,  0,  0,
+ 62,  1,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,198,  0,  0,  0,  0,  0,  0,  0, 33,  1,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  1,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,
+  6,  0,216,  0, 34,  1,199,  0, 34,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 25,  4,  0,  0,
+240,  4,  0,  0,  0,  0,  0,  0, 33,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,216,  0, 34,  1,
   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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,104, 97,100,105,110,103,  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,200,138, 18,  6,  0,  0,  0,  0,168,156, 18,  6,
   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, 83,104, 97,100,105,110,103,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,200,138, 18,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,104,140, 18,  6,
+  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, 66, 85, 84, 84,
+ 79, 78, 83, 95, 80, 84, 95, 99,111,110,116,101,120,116,  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, 66, 85, 84, 84,
+ 79, 78, 83, 95, 80, 84, 95, 99,111,110,116,101,120,116,  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, 67,111,110,116,
+101,120,116,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,220,255,
+199,  0, 36,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,254,199,  0,  0,  0,  0,  0,  0,  0,  4,  0, 10,  0,  0,  0,  0,  0,  6,  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,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,104,140, 18,  6,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,  8,142, 18,  6,  0,  0,  0,  0,200,138, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,114,101,110,100,101,114,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 64,  1,  0,  0,
-200,227,225,  2,196,  0,  0,  0,  1,  0,  0,  0, 56,229,225,  2, 88,226,225,  2,160, 80,217,  2,  0,  0,  0,  0, 82, 69, 78, 68,
- 69, 82, 95, 80, 84, 95,112,101,114,102,111,114,109, 97,110, 99,101,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,114,101,110,100,101,114,  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, 82,101,110,100,101,114,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,135,255,199,  0, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,  8,142, 18,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,168,143, 18,  6,
+  0,  0,  0,  0,104,140, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,108, 97,121,101,114,115,  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, 82, 69, 78, 68,
- 69, 82, 95, 80, 84, 95,112,101,114,102,111,114,109, 97,110, 99,101,  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, 80,101,114,102,
-111,114,109, 97,110, 99,101,  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,  0,  0,  0,  0,  0,242,253,
-199,  0,  0,  0,  0,  0,  0,  0,  4,  0, 10,  0,  0,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 69, 82, 95, 80, 84, 95,108, 97,121,101,114,115,  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, 76, 97,121,101,
+114,115,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,111,255,
+199,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  2,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,168,143, 18,  6,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0, 72,145, 18,  6,  0,  0,  0,  0,  8,142, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,100,105,109,101,110,115,105,111,110,115,
+  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,100,105,109,101,110,115,105,111,110,115,
+  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, 68,105,109,101,110,115,105,111,110,115,  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,  0,  0,  0,  0,  0,  0,140,254,199,  0,203,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  3,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0, 72,145, 18,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,232,146, 18,  6,
+  0,  0,  0,  0,168,143, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95, 97,110,116,105, 97,108,105, 97,115,105,110,103,  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, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95, 97,110,116,105, 97,108,105, 97,115,105,110,103,  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, 65,110,116,105,
+ 45, 65,108,105, 97,115,105,110,103,  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,  0,  0,  0, 58,254,
+199,  0, 58,  0, 20,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,232,146, 18,  6,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,136,148, 18,  6,  0,  0,  0,  0, 72,145, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,109,111,116,105,111,110, 95, 98,108,117,
+114,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,109,111,116,105,111,110, 95, 98,108,117,
+114,  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, 83, 97,109,112,108,101,100, 32, 77,111,116,105,111,110, 32, 66,108,117,114,  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, 34,254,199,  0,  0,  0, 20,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+  5,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,136,148, 18,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0, 40,150, 18,  6,
+  0,  0,  0,  0,232,146, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,115,104, 97,100,105,110,103,  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, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,115,104, 97,100,105,110,103,  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, 83,104, 97,100,
+105,110,103,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,254,
+199,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  6,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0, 56,229,225,  2,196,  0,  0,  0,  1,  0,  0,  0,
-168,230,225,  2,200,227,225,  2,200, 81,217,  2,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,111,115,116, 95,112,
-114,111, 99,101,115,115,105,110,103,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,111,115,116, 95,112,
-114,111, 99,101,115,115,105,110,103,  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, 80,111,115,116, 32, 80,114,111, 99,101,115,115,105,110,103,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0, 40,150, 18,  6,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,200,151, 18,  6,  0,  0,  0,  0,136,148, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,101,114,102,111,114,109, 97,110, 99,
+101,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,101,114,102,111,114,109, 97,110, 99,
+101,  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, 80,101,114,102,111,114,109, 97,110, 99,101,  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,  0,  0,  0,  0,  0,242,253,199,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+  7,  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,  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,218,253,199,  0,  0,  0,  0,  0,  0,  0,  4,  0, 10,  0,
-  0,  0,  0,  0,  8,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,200,151, 18,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,104,153, 18,  6,
+  0,  0,  0,  0, 40,150, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,112,111,115,116, 95,112,114,111, 99,101,115,115,105,110,103,  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, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,112,111,115,116, 95,112,114,111, 99,101,115,115,105,110,103,  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, 80,111,115,116,
+ 32, 80,114,111, 99,101,115,115,105,110,103,  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,  0,218,253,
+199,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  8,  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,
- 68, 65, 84, 65, 64,  1,  0,  0,168,230,225,  2,196,  0,  0,  0,  1,  0,  0,  0, 24,232,225,  2, 56,229,225,  2,240, 82,217,  2,
-  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,116, 97,109,112,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,116, 97,109,112,  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, 68, 65, 84, 65, 88,  1,  0,  0,104,153, 18,  6,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,  8,155, 18,  6,  0,  0,  0,  0,200,151, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,116, 97,109,112,  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, 83,116, 97,109,112,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,116, 97,109,112,  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,194,253,199,  0,  0,  0, 20,  0,  0,  0,  4,  0, 10,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 83,116, 97,109,112,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,194,253,199,  0,  0,  0, 20,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+  9,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0, 24,232,225,  2,
-196,  0,  0,  0,  1,  0,  0,  0,136,233,225,  2,168,230,225,  2, 24, 84,217,  2,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80,
- 84, 95,111,117,116,112,117,116,  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, 82, 69, 78, 68, 69, 82, 95, 80,
- 84, 95,111,117,116,112,117,116,  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, 79,117,116,112,117,116,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40,253,199,  0,130,  0,
-  0,  0,  0,  0,  0,  0, 10,  0,  0,  0,  0,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,  8,155, 18,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,168,156, 18,  6,
+  0,  0,  0,  0,104,153, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,111,117,116,112,117,116,  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, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,111,117,116,112,117,116,  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, 79,117,116,112,
+117,116,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40,253,
+199,  0,130,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,136,233,225,  2,196,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
- 24,232,225,  2,104, 86,217,  2,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 98, 97,107,101,  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, 68, 65, 84, 65, 88,  1,  0,  0,168,156, 18,  6,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,155, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 98, 97,107,101,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 98, 97,107,101,  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, 66, 97,107,101,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16,253,199,  0,  0,  0,  0,  0,  0,  0,  4,  0, 11,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16,253,199,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
  11,  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,  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, 68, 65, 84, 65,
-216,  0,  0,  0,248,234,225,  2,162,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  4,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0, 72,158, 18,  6,  0,  0,  0,  0,179,  0,  0,  0,  1,  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,  4,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  1,  0,  0,  0,  0,  0,240,182,243,  3,255, 21,  0,  0,
-160,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 96,  0,  0,  0,160, 82,215,  2,197,  0,  0,  0,  1,  0,  0,  0, 48, 83,215,  2,
- 16, 82,215,  2, 48,203,205,  2,  0,206,205,  2, 72,206,205,  2,224,204,205,  2,  0,  0,  0,  0,  0,  0,  0,  0, 23,  4,  0,  0,
-  0,  0,  0,  0, 87,  0,  0,  0, 15, 15, 24,  4, 88,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0, 88,107,206,  2, 80,238,225,  2,
- 80,238,225,  2,  0,236,225,  2, 40,237,225,  2,  0,  0,  0,  0,  0,  0,  0,  0,104, 71,  6,  4, 40, 72,  6,  4, 68, 65, 84, 65,
-248,  0,  0,  0,  0,236,225,  2,198,  0,  0,  0,  1,  0,  0,  0, 40,237,225,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32,140, 68,
-  0,  0,  0,  0,  0,  0,208, 65, 39,182,158, 55,  0,  0,131, 68,  0,  0,  0,  0,  0,  0,208, 65,  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, 23,  4,  0,  0,
-  0,  0,  0,  0, 25,  0,  0,  0,  0,224,130, 68,  0,  0,200, 65,  0,224,130, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 24,  4, 26,  0, 24,  4, 26,  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,  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,  2,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,255, 21,  0,  0,
+160,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0,136,159, 18,  6,
+  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,120,164, 18,  6,  0,  0,  0,  0,248,134, 18,  6,  0,  0,  0,  0, 88, 53, 18,  6,
+  0,  0,  0,  0,248,114, 18,  6,  0,  0,  0,  0,104,115, 18,  6,  0,  0,  0,  0, 56,113, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 23,  4,  0,  0,  0,  0,  0,  0, 87,  0,  0,  0, 15, 15, 24,  4, 88,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 88,163, 18,  6,  0,  0,  0,  0, 88,163, 18,  6,  0,  0,  0,  0,120,160, 18,  6,
+  0,  0,  0,  0,232,161, 18,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0,120,160, 18,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,232,161, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32,140, 68,  0,  0,  0,  0,
+  0,  0,208, 65, 39,182,158, 55,  0,  0,131, 68,  0,  0,  0,  0,  0,  0,208, 65,  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, 23,  4,  0,  0,  0,  0,  0,  0,
+ 25,  0,  0,  0,  0,224,130, 68,  0,  0,200, 65,  0,224,130, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 24,  4, 26,  0, 24,  4, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
   0,  0,  0,  0,  0,  0,  0,  0, 23,  4,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
   0,  0,  0,  0, 24,  4, 26,  0,  0,  0,  1,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,224, 52,206,  2,  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, 68, 65, 84, 65,248,  0,  0,  0, 40,237,225,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  0,236,225,  2,  0,  0, 64,192,  0,  0,126, 67,  0,  0,  0,  0,  0,  0, 72, 66,112,189, 17,192,246, 70,125, 67,  0,  0,  0,  0,
-  0,  0, 72, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 23,  4,  0,  0,  0,  0,  0,  0,
- 17,  0,  0,  0,  0,  0,  0,  0, 23,  4,  0,  0, 18,  0,  0,  0, 61,  0,  0,  0,  0,  0,128, 63,  0,  0, 72, 66,  0,124,146, 72,
-  0,  0, 72, 66,205,204,204, 61,  0,  0, 32, 65, 72,  0,  0,  0,  0,  0,  0,  2,  4,  0,  0,  4,  8,  0, 24,  4, 62,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 23,  4,  0,  0, 26,  0,  0,  0, 87,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24,  4, 62,  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, 80, 52,206,  2,  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, 68, 65, 84, 65,188,  0,  0,  0, 80,238,225,  2,
-173,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 15,  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,  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,  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,  0,  0,  0,  0,  0, 31,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-  6,  0,  0,  0, 68, 65, 84, 65, 96,  0,  0,  0, 48, 83,215,  2,197,  0,  0,  0,  1,  0,  0,  0,192, 83,215,  2,160, 82,215,  2,
-112,205,205,  2, 48,193,225,  2,120,193,225,  2,184,205,205,  2,  0,  0,  0,  0, 25,  4,  0,  0,240,  4,  0,  0, 61,  1,  0,  0,
- 59,  2,  0,  0,  3,  3,216,  0,255,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,152,106,206,  2,144,241,225,  2,144,241,225,  2,
- 64,239,225,  2,104,240,225,  2,  0,  0,  0,  0,  0,  0,  0,  0,136, 72,  6,  4, 72, 73,  6,  4, 68, 65, 84, 65,248,  0,  0,  0,
- 64,239,225,  2,198,  0,  0,  0,  1,  0,  0,  0,104,240,225,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,244, 67,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,232,161, 18,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,120,160, 18,  6,  0,  0,  0,  0,  0,  0, 64,192,  0,  0,126, 67,  0,  0,  0,  0,
+  0,  0, 72, 66,112,189, 17,192,246, 70,125, 67,  0,  0,  0,  0,  0,  0, 72, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 23,  4,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0, 23,  4,  0,  0, 18,  0,  0,  0,
+ 61,  0,  0,  0,  0,  0,128, 63,  0,  0, 72, 66,  0,124,146, 72,  0,  0, 72, 66,205,204,204, 61,  0,  0, 32, 65, 72,  0,  0,  0,
+  0,  0,  0,  2,  4,  0,  0,  4,  8,  0, 24,  4, 62,  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, 23,  4,  0,  0, 26,  0,  0,  0, 87,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 24,  4, 62,  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,  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,  0, 68, 65, 84, 65,208,  0,  0,  0, 88,163, 18,  6,  0,  0,  0,  0,190,  0,  0,  0,
+  1,  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, 15,  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,  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,  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,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0,120,164, 18,  6,
+  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0, 56,171, 18,  6,  0,  0,  0,  0,136,159, 18,  6,  0,  0,  0,  0, 24,114, 18,  6,
+  0,  0,  0,  0,152,117, 18,  6,  0,  0,  0,  0,  8,118, 18,  6,  0,  0,  0,  0,136,114, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 25,  4,  0,  0,240,  4,  0,  0, 61,  1,  0,  0, 59,  2,  0,  0,  3,  3,216,  0,255,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72,168, 18,  6,  0,  0,  0,  0, 72,168, 18,  6,  0,  0,  0,  0,104,165, 18,  6,
+  0,  0,  0,  0,216,166, 18,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0,104,165, 18,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,216,166, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,244, 67,  0,  0,  0,  0,
   0,  0,208, 65, 98, 39, 38, 54,  0,  0, 88, 67,  0,  0,  0,  0,  0,  0,208, 65,  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,215,  0,  0,  0,  0,  0,  0,  0,
  25,  0,  0,  0,  0,  0, 87, 67,  0,  0,200, 65,  0,  0, 87, 67,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
   2,  0,  3,  3,  4,  0, 12,  0, 10,  0,216,  0, 26,  0,216,  0, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 25,  4,  0,  0,240,  4,  0,  0, 34,  2,  0,  0, 59,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-216,  0, 26,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-192, 51,206,  2,  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, 68, 65, 84, 65,248,  0,  0,  0,104,240,225,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 64,239,225,  2,
-  0,  0,  0,  0,  0,128,141, 67,  0,  0,244,194,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 71, 67,  0,  0, 83,195,  0,  0,  0,  0,
-199,  0,  0,  0,216,  0,  0,  0, 18,  0,  0,  0,228,  0,  0,  0,  0,  0,  0,  0,198,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,
-  0,  0,  0,  0,198,  0,  0,  0, 18,  0,  0,  0,228,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63, 18,  2,  0,  0,  2,  0,  3,  3,  0,  0, 12,  4,  6,  0,216,  0,229,  0,199,  0,211,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 25,  4,  0,  0,240,  4,  0,  0, 61,  1,  0,  0, 33,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,216,  0,229,  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, 48, 51,206,  2,  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, 68, 65, 84, 65,244,  0,  0,  0,144,241,225,  2,166,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72, 81,224,  3, 72, 81,224,  3,
- 48,237,205,  2,  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,  1,  0,  0,  0, 68, 65, 84, 65, 12,  0,  0,  0,
- 48,237,205,  2,221,  0,  0,  0,  1,  0,  0,  0, 14,  0,  0,  0, 14,  0,  0,  0,184,242,225,  2, 68, 65, 84, 65,168,  0,  0,  0,
-184,242,225,  2,220,  0,  0,  0, 14,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,144,  1,228,  2, 19,  0,  0,  0,  1,  0,  1,  0,
-144,  1,228,  2, 20,  0,  0,  0,  1,  0,  1,  0,144,  1,228,  2, 21,  0,  1,  0,  1,  0,  0,  0,144,  1,228,  2,  0,  0,  0,  0,
-  1,  0,  1,  0,240, 10,228,  2,  0,  0,  0,  0,  1,  0,  1,  0,240, 16,228,  2,  0,  0,  0,  0,  1,  0,  1,  0,144, 30,221,  2,
-  0,  0,  0,  0,  1,  0,  1,  0, 32, 26,228,  2,  0,  0,  0,  0,  1,  0,  1,  0,  8, 97,223,  2,  0,  0,  0,  0,  1,  0,  1,  0,
-192, 21,228,  2,  0,  0,  0,  0,  1,  0,  1,  0, 80,  9,228,  2,  0,  0,  0,  0,  1,  0,  1,  0,144, 12,228,  2,  0,  0,  0,  0,
-  1,  0,  1,  0,184,  8,228,  2, 21,  0,  0,  0,  1,  0,  1,  0,144,  1,228,  2, 68, 65, 84, 65, 96,  0,  0,  0,192, 83,215,  2,
-197,  0,  0,  0,  1,  0,  0,  0, 80, 84,215,  2, 48, 83,215,  2,144,206,205,  2,216,206,205,  2, 40,205,205,  2, 72,206,205,  2,
-  0,  0,  0,  0,193,  1,  0,  0, 23,  4,  0,  0, 89,  0,  0,  0,194,  2,  0,  0,  1,  1, 87,  2,106,  2,  1,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 24,108,206,  2, 96,150,206,  2, 96,150,206,  2,144,243,225,  2, 56,149,206,  2,  0,  0,  0,  0,  0,  0,  0,  0,
-168, 73,  6,  4,136, 75,  6,  4, 68, 65, 84, 65,248,  0,  0,  0,144,243,225,  2,198,  0,  0,  0,  1,  0,  0,  0,192,145,206,  2,
-  0,  0,  0,  0,  0,  0,  0,  0,  0, 64,113, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,192, 21, 68,  0,  0,  0,  0,
-  0,  0,208, 65,  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, 86,  2,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,128, 21, 68,  0,  0,200, 65,  0,128, 21, 68,
-  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 87,  2, 26,  0, 87,  2,
- 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,193,  1,  0,  0, 23,  4,  0,  0, 89,  0,  0,  0,114,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 87,  2, 26,  0,  0,  0,  1,  0,  2,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,176, 55,206,  2,  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, 68, 65, 84, 65,248,  0,  0,  0,192,145,206,  2,
-198,  0,  0,  0,  1,  0,  0,  0,232,146,206,  2,144,243,225,  2,  0,  0,  0,  0,  0,  0, 15, 67,  0, 64, 70,196,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0, 15, 67,255,127, 70,196,  0,  0,  0,  0,143,  0,  0,  0,160,  0,  0,  0, 18,  0,  0,  0, 43,  3,  0,  0,
-  0,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0, 18,  0,  0,  0, 43,  3,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  0,  0,  0,  1,  0,  7,  0,
- 18,  0,  0,  0,  6,  0,160,  0, 44,  3,143,  0, 26,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,193,  1,  0,  0,
-193,  1,  0,  0,115,  0,  0,  0,194,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0, 80,  2,
-  0,  0,  5,  0,  3,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,144, 54,206,  2,
-  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,
- 68, 65, 84, 65,248,  0,  0,  0,232,146,206,  2,198,  0,  0,  0,  1,  0,  0,  0, 16,148,206,  2,192,145,206,  2,  0,  0,  0,  0,
+  0,  0,  0,  0, 25,  4,  0,  0,240,  4,  0,  0, 34,  2,  0,  0, 59,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,216,  0, 26,  0,  0,  0,  1,  0,  1,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,216,166, 18,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,104,165, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,141, 67,  0,  0,244,194,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 71, 67,  0,  0, 83,195,  0,  0,  0,  0,199,  0,  0,  0,216,  0,  0,  0, 18,  0,  0,  0,
+228,  0,  0,  0,  0,  0,  0,  0,198,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,198,  0,  0,  0, 18,  0,  0,  0,
+228,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63, 18,  2,  0,  0,
+  2,  0,  3,  3,  0,  0, 12,  4,  6,  0,216,  0,229,  0,199,  0,211,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 25,  4,  0,  0,240,  4,  0,  0, 61,  1,  0,  0, 33,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,216,  0,229,  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,  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,  0, 68, 65, 84, 65, 24,  1,  0,  0, 72,168, 18,  6,  0,  0,  0,  0,183,  0,  0,  0,
+  1,  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,  3,  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,  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,  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,  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,168,169, 18,  6,
+  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,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 68, 65, 84, 65,
+ 16,  0,  0,  0,168,169, 18,  6,  0,  0,  0,  0,237,  0,  0,  0,  1,  0,  0,  0, 14,  0,  0,  0, 14,  0,  0,  0,  8,170, 18,  6,
+  0,  0,  0,  0, 68, 65, 84, 65,224,  0,  0,  0,  8,170, 18,  6,  0,  0,  0,  0,236,  0,  0,  0, 14,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  1,  0,  8,110, 21,  6,  0,  0,  0,  0, 19,  0,  0,  0,  1,  0,  1,  0,  8,110, 21,  6,  0,  0,  0,  0, 20,  0,  0,  0,
+  1,  0,  1,  0,  8,110, 21,  6,  0,  0,  0,  0, 21,  0,  1,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  1,  0,152,136, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  8,146, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  1,  0,168,200, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,232,159, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  1,  0,248,181, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0, 72,153, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  1,  0,216,131, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,104,139, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  1,  0,200,130, 21,  6,  0,  0,  0,  0, 21,  0,  0,  0,  1,  0,  1,  0,  8,110, 21,  6,  0,  0,  0,  0, 68, 65, 84, 65,
+160,  0,  0,  0, 56,171, 18,  6,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,200,184, 18,  6,  0,  0,  0,  0,120,164, 18,  6,
+  0,  0,  0,  0,216,115, 18,  6,  0,  0,  0,  0, 72,116, 18,  6,  0,  0,  0,  0,168,113, 18,  6,  0,  0,  0,  0,104,115, 18,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,193,  1,  0,  0, 23,  4,  0,  0, 89,  0,  0,  0,194,  2,  0,  0,  1,  1, 87,  2,
+106,  2,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24,183, 18,  6,  0,  0,  0,  0, 24,183, 18,  6,
+  0,  0,  0,  0, 40,172, 18,  6,  0,  0,  0,  0,232,177, 18,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0, 40,172, 18,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,152,173, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0, 64,113, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,192, 21, 68,  0,  0,  0,  0,  0,  0,208, 65,  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,
+ 86,  2,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,128, 21, 68,  0,  0,200, 65,  0,128, 21, 68,  0,  0,200, 65,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 87,  2, 26,  0, 87,  2, 26,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,193,  1,  0,  0, 23,  4,  0,  0, 89,  0,  0,  0,114,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 87,  2, 26,  0,  0,  0,  1,  0,  2,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,152,173, 18,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,  8,175, 18,  6,  0,  0,  0,  0, 40,172, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0, 15, 67,  0, 64, 70,196,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 15, 67,255,127, 70,196,  0,  0,  0,  0,143,  0,  0,  0,
+160,  0,  0,  0, 18,  0,  0,  0, 43,  3,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,
+142,  0,  0,  0, 18,  0,  0,  0, 43,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,
+  0,  0,  0, 64, 10,  0,  0,  0,  1,  0,  7,  0, 18,  0,  0,  0,  6,  0,160,  0, 44,  3,143,  0, 26,  3,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,193,  1,  0,  0,193,  1,  0,  0,115,  0,  0,  0,194,  2,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0, 80,  2,  0,  0,  5,  0,  3,  0,  1,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,  8,175, 18,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,120,176, 18,  6,  0,  0,  0,  0,152,173, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
   0,  0, 16, 67,  0,  0,206,194,  0,  0,  0,  0,  0,  0,  0,  0,231,102, 16, 67,  0,  0,206,194,  0,  0,  0,  0,143,  0,  0,  0,
 160,  0,  0,  0, 18,  0,  0,  0,119,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,
 142,  0,  0,  0, 18,  0,  0,  0,119,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,
   0,  0,  0, 64, 10,  0,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,160,  0,120,  0,143,  0,102,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,193,  1,  0,  0,193,  1,  0,  0,115,  0,  0,  0,115,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  6,  0, 34,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 32, 55,206,  2,  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, 68, 65, 84, 65,248,  0,  0,  0, 16,148,206,  2,198,  0,  0,  0,  1,  0,  0,  0,
- 56,149,206,  2,232,146,206,  2,  0,  0,  0,  0,  0,  0, 35, 67,  0,128, 96,196,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 35, 67,
-  0,128, 96,196,  0,  0,  0,  0,163,  0,  0,  0,180,  0,  0,  0, 18,  0,  0,  0,147,  3,  0,  0,  0,  0,  0,  0,162,  0,  0,  0,
-  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,162,  0,  0,  0, 18,  0,  0,  0,147,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  0,  0,  0,  1,  0,  7,  0, 18,  0,  0,  0,  6,  0,180,  0,
-148,  3,163,  0,130,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 23,  4,  0,  0, 23,  4,  0,  0,115,  0,  0,  0,
-194,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  4,  0,  4,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 54,206,  2,  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, 68, 65, 84, 65,248,  0,  0,  0,
- 56,149,206,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 16,148,206,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,193,  1,  0,  0,193,  1,  0,  0,115,  0,  0,  0,115,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  6,  0, 34,  0,  2,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,120,176, 18,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,232,177, 18,  6,  0,  0,  0,  0,  8,175, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0, 35, 67,  0,128, 96,196,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 35, 67,  0,128, 96,196,  0,  0,  0,  0,163,  0,  0,  0,
+180,  0,  0,  0, 18,  0,  0,  0,147,  3,  0,  0,  0,  0,  0,  0,162,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,
+162,  0,  0,  0, 18,  0,  0,  0,147,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,
+  0,  0,  0, 64, 10,  0,  0,  0,  1,  0,  7,  0, 18,  0,  0,  0,  6,  0,180,  0,148,  3,163,  0,130,  3,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 23,  4,  0,  0, 23,  4,  0,  0,115,  0,  0,  0,194,  2,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  4,  0,  4,  0,  1,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,232,177, 18,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,120,176, 18,  6,  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,  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,  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,193,  1,  0,  0, 23,  4,  0,  0,115,  0,  0,  0,194,  2,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 87,  2, 80,  2,  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,  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, 88,179, 18,  6,  0,  0,  0,  0, 68, 65, 84, 65,112,  3,  0,  0, 88,179, 18,  6,
+  0,  0,  0,  0,173,  0,  0,  0,  1,  0,  0,  0,  0,  0,140, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+200,167,141, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 28, 13,128,191,  0,  0,128,191,  0,  0,  0,  0,
+  0,  0,  0,  0, 74,215, 76,190,  0,  0,  0,  0, 68,239,209, 62, 51,177,205,190,184,158, 81, 63,  0,  0,  0,  0, 70,119,105, 63,
+143, 74, 70, 62, 35, 44,185,190,  0,  0,  0,  0,162, 84, 89,188,166, 33,101, 63, 42, 61,228, 62,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,214,211,111,193,  0,  0,128, 63, 69,239,209, 62, 70,119,105, 63,176, 84, 89,188,  0,  0,  0,  0, 53,177,205,190,
+142, 74, 70, 62,166, 33,101, 63,  0,  0,  0,  0,185,158, 81, 63, 35, 44,185,190, 43, 61,228, 62,  0,  0,  0,  0,164, 96, 68, 65,
+111,121,173,192,248,209,213, 64,  0,  0,128, 63,178,157,229, 62,209,162,227,190, 48,180, 81,191,184,158, 81,191,117, 90,127, 63,
+ 13,114, 91, 62, 26, 63,185, 62, 35, 44,185, 62,145,180,109,188,105,147,125, 63,138, 84,228,190, 42, 61,228,190,  0,  0,  0,  0,
+  0,  0,  0,  0,  9,185,108, 65,214,211,111, 65, 99,240,191, 62,110,116, 85, 63, 64,185, 70,188,  0,  0, 82,180, 48,221,185,190,
+ 44, 45, 51, 62, 28, 11, 79, 63,  0,  0, 56,179, 67,108,117,194,183,204,216, 65,105,156,  5,194,212,247,159,192,235, 62,114, 66,
+ 59,254,213,193,158,225,  3, 66, 55,  8,160, 64, 68,239,209, 62, 51,177,205,190,184,158, 81, 63,  0,  0,  0,  0, 70,119,105, 63,
+143, 74, 70, 62, 35, 44,185,190,  0,  0,  0,  0,162, 84, 89,188,166, 33,101, 63, 42, 61,228, 62,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,214,211,111,193,  0,  0,128, 63,178,157,229, 62,209,162,227,190, 48,180, 81,191,184,158, 81,191,117, 90,127, 63,
+ 13,114, 91, 62, 26, 63,185, 62, 35, 44,185, 62,145,180,109,188,105,147,125, 63,138, 84,228,190, 42, 61,228,190,  0,  0,  0,  0,
+  0,  0,  0,  0,  9,185,108, 65,214,211,111, 65,  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,  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,  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,  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,  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,
-193,  1,  0,  0, 23,  4,  0,  0,115,  0,  0,  0,194,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 87,  2, 80,  2,  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,
-112, 53,206,  2,  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,
-184,244,225,  2, 68, 65, 84, 65, 68,  3,  0,  0,184,244,225,  2,156,  0,  0,  0,  1,  0,  0,  0,  0,  0,140, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200,167,141, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 28, 13,128,191,  0,  0,128,191,  0,  0,  0,  0,  0,  0,  0,  0, 74,215, 76,190,  0,  0,  0,  0, 68,239,209, 62, 51,177,205,190,
-184,158, 81, 63,  0,  0,  0,  0, 70,119,105, 63,143, 74, 70, 62, 35, 44,185,190,  0,  0,  0,  0,162, 84, 89,188,166, 33,101, 63,
- 42, 61,228, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,214,211,111,193,  0,  0,128, 63, 69,239,209, 62, 70,119,105, 63,
-176, 84, 89,188,  0,  0,  0,  0, 53,177,205,190,142, 74, 70, 62,166, 33,101, 63,  0,  0,  0,  0,185,158, 81, 63, 35, 44,185,190,
- 43, 61,228, 62,  0,  0,  0,  0,164, 96, 68, 65,111,121,173,192,248,209,213, 64,  0,  0,128, 63,178,157,229, 62,209,162,227,190,
- 48,180, 81,191,184,158, 81,191,117, 90,127, 63, 13,114, 91, 62, 26, 63,185, 62, 35, 44,185, 62,145,180,109,188,105,147,125, 63,
-138, 84,228,190, 42, 61,228,190,  0,  0,  0,  0,  0,  0,  0,  0,  9,185,108, 65,214,211,111, 65, 99,240,191, 62,110,116, 85, 63,
- 64,185, 70,188,  0,  0, 82,180, 48,221,185,190, 44, 45, 51, 62, 28, 11, 79, 63,  0,  0, 56,179, 67,108,117,194,183,204,216, 65,
-105,156,  5,194,212,247,159,192,235, 62,114, 66, 59,254,213,193,158,225,  3, 66, 55,  8,160, 64, 68,239,209, 62, 51,177,205,190,
-184,158, 81, 63,  0,  0,  0,  0, 70,119,105, 63,143, 74, 70, 62, 35, 44,185,190,  0,  0,  0,  0,162, 84, 89,188,166, 33,101, 63,
- 42, 61,228, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,214,211,111,193,  0,  0,128, 63,178,157,229, 62,209,162,227,190,
- 48,180, 81,191,184,158, 81,191,117, 90,127, 63, 13,114, 91, 62, 26, 63,185, 62, 35, 44,185, 62,145,180,109,188,105,147,125, 63,
-138, 84,228,190, 42, 61,228,190,  0,  0,  0,  0,  0,  0,  0,  0,  9,185,108, 65,214,211,111, 65, 12,163, 91, 64,  0,  0,  0,  0,
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 12,163, 91, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 12,163, 91, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63, 92, 62, 55, 63, 56,186,224,190,
-237,203,148,190,  3,236,234,190,214,211,111, 65,214,211,111, 65,  0,  0,  0,  0,  0,  0,  0,  0,236, 15, 72, 59,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,255,255,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 12,163, 91, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 12,163, 91, 64,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63, 92, 62, 55, 63, 56,186,224,190,237,203,148,190,  3,236,234,190,214,211,111, 65,
+214,211,111, 65,  0,  0,  0,  0,  0,  0,  0,  0,236, 15, 72, 59,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  1,  0,  0,255,255,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+ 32, 33, 12, 66, 86,152,137, 66,113, 27,126, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 96,  1,  0,  0, 24,183, 18,  6,  0,  0,  0,  0,174,  0,  0,  0,  1,  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,  1,  0,  0,  0, 51, 51, 51, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 65,
+205,204, 76, 62,  2,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  7,  0,104,139, 21,  6,  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,  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,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  3,  0,  0,  0,  1,  0,  3,  0,  8,  8,128,  0,  0,  0, 12, 66,  0,  0,128, 63,
+205,204,204, 61,  0,  0,250, 67,  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, 16,  0, 10,  0,  7,  1,  0,  3,  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,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0,200,184, 18,  6,
+  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,120,193, 18,  6,  0,  0,  0,  0, 56,171, 18,  6,  0,  0,  0,  0,248,114, 18,  6,
+  0,  0,  0,  0,184,116, 18,  6,  0,  0,  0,  0, 40,117, 18,  6,  0,  0,  0,  0,216,115, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,191,  1,  0,  0, 89,  0,  0,  0,  3,  1,  0,  0,  2,  2,192,  1,171,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,120,191, 18,  6,  0,  0,  0,  0,120,191, 18,  6,  0,  0,  0,  0,184,185, 18,  6,
+  0,  0,  0,  0,  8,190, 18,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0,184,185, 18,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0, 40,187, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64, 89, 68,  0,  0,  0,  0,
+  0,  0,208, 65,  0,  0,  0,  0,  0,  0,224, 67,  0,  0,  0,  0,  0,  0,208, 65,  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,191,  1,  0,  0,  0,  0,  0,  0,
+ 25,  0,  0,  0,  0,128,223, 67,  0,  0,200, 65,  0,128,223, 67,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,192,  1, 26,  0,192,  1, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,191,  1,  0,  0, 89,  0,  0,  0,114,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,192,  1, 26,  0,  0,  0,  1,  0,  2,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0, 40,187, 18,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,152,188, 18,  6,  0,  0,  0,  0,184,185, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72, 67,  0,  0,112,193,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72, 67,  0,  0,254,194,  0,  0,  0,  0,200,  0,  0,  0,217,  0,  0,  0, 18,  0,  0,  0,
+144,  0,  0,  0,  0,  0,  0,  0,199,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,199,  0,  0,  0, 18,  0,  0,  0,
+144,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63, 10,  6,  0,  0,
+  2,  0,  3,  3,  0,  0,  0,  4,  6,  0,217,  0,145,  0,200,  0,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,216,  0,  0,  0,115,  0,  0,  0,  3,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,217,  0,145,  0,  0,  0,  2,  0,  3,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,152,188, 18,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,  8,190, 18,  6,  0,  0,  0,  0, 40,187, 18,  6,  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,  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,128, 63, 32, 33, 12, 66, 86,152,137, 66,113, 27,126, 66,  0,  0,  0,  0, 68, 65, 84, 65,
-240,  0,  0,  0, 96,150,206,  2,157,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0, 51, 51, 51, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 65,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  7,  0,144, 12,228,  2,  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,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  3,  0,  0,  0,  1,  0,  3,  0,
-  8,  8,  0,  0,  0,  0, 12, 66,  0,  0,128, 63,205,204,204, 61,  0,  0,250, 67,  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, 16,  0, 10,  0,  7,  1,  0,  3,  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,
- 68, 65, 84, 65, 96,  0,  0,  0, 80, 84,215,  2,197,  0,  0,  0,  1,  0,  0,  0,224, 84,215,  2,192, 83,215,  2,  0,206,205,  2,
- 32,207,205,  2,104,207,205,  2,144,206,205,  2,  0,  0,  0,  0,  0,  0,  0,  0,191,  1,  0,  0, 89,  0,  0,  0,  3,  1,  0,  0,
-  2,  2,192,  1,171,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0, 88,113,206,  2, 48,248,225,  2, 48,248,225,  2,136,151,206,  2,
-  0,155,206,  2,  0,  0,  0,  0,  0,  0,  0,  0,232, 75,  6,  4,104, 77,  6,  4, 68, 65, 84, 65,248,  0,  0,  0,136,151,206,  2,
-198,  0,  0,  0,  1,  0,  0,  0,176,152,206,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64, 89, 68,  0,  0,  0,  0,  0,  0,208, 65,
-  0,  0,  0,  0,  0,  0,224, 67,  0,  0,  0,  0,  0,  0,208, 65,  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,191,  1,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,
-  0,128,223, 67,  0,  0,200, 65,  0,128,223, 67,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,
-  4,  0, 12,  0, 10,  0,192,  1, 26,  0,192,  1, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-191,  1,  0,  0, 89,  0,  0,  0,114,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,192,  1, 26,  0,
-  0,  0,  1,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,208, 56,206,  2,
-  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,
- 68, 65, 84, 65,248,  0,  0,  0,176,152,206,  2,198,  0,  0,  0,  1,  0,  0,  0,216,153,206,  2,136,151,206,  2,  0,  0,  0,  0,
-  0,  0, 72, 67,  0,  0,112,193,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72, 67,  0,  0,254,194,  0,  0,  0,  0,200,  0,  0,  0,
-217,  0,  0,  0, 18,  0,  0,  0,144,  0,  0,  0,  0,  0,  0,  0,199,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,
-199,  0,  0,  0, 18,  0,  0,  0,144,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63, 10,  6,  0,  0,  2,  0,  3,  3,  0,  0,  0,  4,  6,  0,217,  0,145,  0,200,  0,127,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,216,  0,  0,  0,115,  0,  0,  0,  3,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,217,  0,145,  0,  0,  0,  2,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 96, 57,206,  2,  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, 68, 65, 84, 65,248,  0,  0,  0,216,153,206,  2,198,  0,  0,  0,  1,  0,  0,  0,
-  0,155,206,  2,176,152,206,  2,  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,  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,  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,191,  1,  0,  0,191,  1,  0,  0,115,  0,  0,  0,
-  3,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  4,  0,  4,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240, 57,206,  2,  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, 68, 65, 84, 65,248,  0,  0,  0,
-  0,155,206,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,216,153,206,  2,  0,  0, 16,193,  0,  0,130, 67,  0,  0,160,192,
+  0,  0,  0,  0,191,  1,  0,  0,191,  1,  0,  0,115,  0,  0,  0,  3,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  4,  0,  4,  0,  1,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,  8,190, 18,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,152,188, 18,  6,  0,  0,  0,  0,  0,  0, 16,193,  0,  0,130, 67,  0,  0,160,192,
   0,  0,160, 64,  0,  0,  0,  0,  0,  0,122, 67,  0,  0, 16,193,  0,  0, 32, 65,  0,  0,  0,  0, 17,  0,  0,  0, 18,  0,  0,  0,
 144,  0,  0,  0, 18,  0,  0,  0,230,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0, 18,  0,  0,  0,230,  0,  0,  0, 18,  0,  0,  0,
 144,  0,  0,  0,111, 18,131, 58,111, 18,131, 58,  0,124,146, 72,  0, 80, 67, 71,  0,  0,  0,  0,  0,  0,  0,  0,105,  0,  0,  0,
   0,  0,  0,  0,  0,  0,  0,  4,  0,  0,231,  0,145,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-217,  0,  0,  0,191,  1,  0,  0,115,  0,  0,  0,  3,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-231,  0,145,  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,
- 64, 56,206,  2,  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, 68, 65, 84, 65,208,  0,  0,  0, 48,248,225,  2,161,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  2,  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,217,  0,  0,  0,191,  1,  0,  0,115,  0,  0,  0,  3,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,231,  0,145,  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,  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,  0, 68, 65, 84, 65,240,  0,  0,  0,120,191, 18,  6,  0,  0,  0,  0,178,  0,  0,  0,
+  1,  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,  2,  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,  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,  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, 48,114, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  0,  0,  0, 48,114, 40,  0, 20,  1,  0,  0,  1,  0,  0,  0,144,  1,228,  2,
   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,184,192, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  2,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,112,  0,  0,  0,184,192, 18,  6,
+  0,  0,  0,  0, 37,  1,  0,  0,  1,  0,  0,  0,  8,110, 21,  6,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 96,  0,  0,  0,224, 84,215,  2,
-197,  0,  0,  0,  1,  0,  0,  0,112, 85,215,  2, 80, 84,215,  2, 32,207,205,  2, 80,204,205,  2,216,206,205,  2,104,207,205,  2,
-  0,  0,  0,  0,  0,  0,  0,  0,191,  1,  0,  0,  5,  1,  0,  0,194,  2,  0,  0, 12, 12,192,  1,190,  1,  1,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,240,166,206,  2,184, 26,221,  2,184, 26,221,  2, 40,156,206,  2,120,158,206,  2,  0,  0,  0,  0,  0,  0,  0,  0,
-200, 77,  6,  4,232, 78,  6,  4, 68, 65, 84, 65,248,  0,  0,  0, 40,156,206,  2,198,  0,  0,  0,  1,  0,  0,  0, 80,157,206,  2,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,192, 94, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,  0,224, 67,  0,  0,  0,  0,
-  0,  0,208, 65,  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,191,  1,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,128,223, 67,  0,  0,200, 65,  0,128,223, 67,
-  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,192,  1, 26,  0,192,  1,
- 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,191,  1,  0,  0,  5,  1,  0,  0, 30,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,192,  1, 26,  0,  0,  0,  1,  0,  2,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 48, 69,206,  2,  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, 68, 65, 84, 65,248,  0,  0,  0, 80,157,206,  2,
-198,  0,  0,  0,  1,  0,  0,  0,120,158,206,  2, 40,156,206,  2,  0,  0,  0,  0,  0,  0, 55, 67,  0,  0,  0,194,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0, 72, 67,  0,  0,201,195,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,199,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,199,  0,  0,  0, 18,  0,  0,  0,163,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  8,  4,  0,  0,  2,  0,  3,  3,
-  0,  0,  2,  4,  6,  0,200,  0,164,  1,200,  0,146,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-199,  0,  0,  0, 31,  1,  0,  0,194,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200,  0,164,  1,
-  0,  0,  2,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,198,206,  2,
-  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,
- 68, 65, 84, 65,248,  0,  0,  0,120,158,206,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 80,157,206,  2,  0,  0, 32,193,
+  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,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+160,  0,  0,  0,120,193, 18,  6,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0, 72,200, 18,  6,  0,  0,  0,  0,200,184, 18,  6,
+  0,  0,  0,  0,184,116, 18,  6,  0,  0,  0,  0, 88,112, 18,  6,  0,  0,  0,  0, 72,116, 18,  6,  0,  0,  0,  0, 40,117, 18,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,191,  1,  0,  0,  5,  1,  0,  0,194,  2,  0,  0, 12, 12,192,  1,
+190,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,184,198, 18,  6,  0,  0,  0,  0,184,198, 18,  6,
+  0,  0,  0,  0,104,194, 18,  6,  0,  0,  0,  0, 72,197, 18,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0,104,194, 18,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,216,195, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,192, 94, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,  0,224, 67,  0,  0,  0,  0,  0,  0,208, 65,  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,
+191,  1,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,128,223, 67,  0,  0,200, 65,  0,128,223, 67,  0,  0,200, 65,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,192,  1, 26,  0,192,  1, 26,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,191,  1,  0,  0,  5,  1,  0,  0, 30,  1,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,192,  1, 26,  0,  0,  0,  1,  0,  2,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,216,195, 18,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0, 72,197, 18,  6,  0,  0,  0,  0,104,194, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0, 55, 67,  0,  0,  0,194,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72, 67,  0,  0,201,195,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,199,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,
+199,  0,  0,  0, 18,  0,  0,  0,163,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  8,  4,  0,  0,  2,  0,  3,  3,  0,  0,  2,  4,  6,  0,200,  0,164,  1,200,  0,146,  1,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,199,  0,  0,  0, 31,  1,  0,  0,194,  2,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200,  0,164,  1,  0,  0,  2,  0,  3,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0, 72,197, 18,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,216,195, 18,  6,  0,  0,  0,  0,  0,  0, 32,193,
   0,  0,104, 68,  0,  0, 72,194,  0,  0,  0,  0,  0,  0, 32,193,  0,  0,104, 68,  0,  0,201,195,  0,  0,  0,  0,231,  0,  0,  0,
 248,  0,  0,  0, 18,  0,  0,  0,163,  1,  0,  0,  0,  0,  0,  0,230,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,
 230,  0,  0,  0, 18,  0,  0,  0,163,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,124,146, 72,  0, 64, 28, 70, 10,215, 35, 60,
   0,  0, 72, 66, 74,  0,  0,  0,  0,  0,  0,  2,  0,  0,  2,  4,  4,  0,248,  0,164,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,200,  0,  0,  0,191,  1,  0,  0, 31,  1,  0,  0,194,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,248,  0,164,  1,  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,160, 68,206,  2,  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, 68, 65, 84, 65, 24,  1,  0,  0,184, 26,221,  2, 21,  1,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 12,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,144,  1,228,  2,  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,  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, 16,  0,  0,  0,  0,  0,  0,  0,  3,  2,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 96,  0,  0,  0,
-112, 85,215,  2,197,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,224, 84,215,  2, 48,193,225,  2, 40,205,205,  2,152,204,205,  2,
-120,193,225,  2,  0,  0,  0,  0, 25,  4,  0,  0,240,  4,  0,  0, 61,  2,  0,  0,194,  2,  0,  0,  1,  1,216,  0,134,  0,  1,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 24,108,206,  2,240,161,206,  2,240,161,206,  2,160,159,206,  2,200,160,206,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 72, 79,  6,  4,  8, 80,  6,  4, 68, 65, 84, 65,248,  0,  0,  0,160,159,206,  2,198,  0,  0,  0,  1,  0,  0,  0,
-200,160,206,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,102, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,  0,165, 67,
-  0,  0,  0, 64,  0,  0,208, 65,  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, 73,  1,  0,  0,  0,  0,  0,  0, 23,  0,  0,  0,  0,128,164, 67,  0,  0,200, 65,
-  0,128,164, 67,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 74,  1,
- 24,  0, 74,  1, 24,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 25,  4,  0,  0,240,  4,  0,  0, 61,  2,  0,  0,
- 61,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  1,  0,  2,  0,  1,  0,
-  0,  0,  0,  0,  0,  0, 26,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,176, 55,206,  2,  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, 68, 65, 84, 65,248,  0,  0,  0,
-200,160,206,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,160,159,206,  2,  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,  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,  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,
- 25,  4,  0,  0,240,  4,  0,  0, 61,  2,  0,  0,194,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-216,  0,134,  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,
-112, 53,206,  2,  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,
- 48,249,225,  2, 68, 65, 84, 65, 68,  3,  0,  0, 48,249,225,  2,156,  0,  0,  0,  1,  0,  0,  0, 56,255, 13, 64,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,228,100, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-154, 65,128,191,  0,  0,128,191,  0,  0,  0,  0,  0,  0,  0,  0, 72,  1, 77,190,  0,  0,  0,  0,221,149, 47, 63, 86,126,162,190,
-  8,165, 39, 63,  0,  0,  0,  0, 51, 70, 58, 63,225,251,159, 62,149, 84, 28,191,  0,  0,  0,  0,192, 56, 49,188, 55, 53,101, 63,
- 52,247,227, 62,  0,  0,  0,  0, 90, 38,173,190,  0,222,192,190,152,  9, 52,193,  0,  0,128, 63,223,149, 47, 63, 55, 70, 58, 63,
-160, 56, 49,188,  0,  0,  0,  0, 88,126,162,190,229,251,159, 62, 55, 53,101, 63,  0,  0,  0,  0,  7,165, 39, 63,150, 84, 28,191,
- 51,247,227, 62,  0,  0,  0,  0,110,101,239, 64,151, 62,208,192, 78,255,170, 64,  0,  0,128, 63, 47,201,194, 63, 61, 73,145,191,
-244,250, 39,191,  8,165, 39,191,190,164,206, 63,209, 10,143, 63,180,164, 28, 63,149, 84, 28, 63,224,153,196,188,136,239, 76, 64,
- 10,108,228,190, 52,247,227,190,125, 21, 64,191,126,113,172,191,216, 49, 49, 65,152,  9, 52, 65,149, 70,158, 62, 24,234,167, 62,
-192,214,159,187,  0,  0,  6,181,196,188,181,189, 71,238,178, 61,127, 45,128, 62,  0,  0,226, 51,168,120, 21,194,107,  5,  2, 66,
-203,135,213,193,147,214,159,192,177, 38, 19, 66,124,173,255,193, 96,101,210, 65,128, 40,160, 64,221,149, 47, 63, 86,126,162,190,
-  8,165, 39, 63,  0,  0,  0,  0, 51, 70, 58, 63,225,251,159, 62,149, 84, 28,191,  0,  0,  0,  0,192, 56, 49,188, 55, 53,101, 63,
- 52,247,227, 62,  0,  0,  0,  0, 90, 38,173,190,  0,222,192,190,152,  9, 52,193,  0,  0,128, 63, 47,201,194, 63, 61, 73,145,191,
-244,250, 39,191,  8,165, 39,191,190,164,206, 63,209, 10,143, 63,180,164, 28, 63,149, 84, 28, 63,224,153,196,188,136,239, 76, 64,
- 10,108,228,190, 52,247,227,190,125, 21, 64,191,126,113,172,191,216, 49, 49, 65,152,  9, 52, 65,102,103, 97, 64,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,102,103, 97, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-102,103, 97, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,241, 22, 72, 63, 78,162,246,190,
- 43,  8, 90,190,  2, 35,171,190,  0,  0, 32, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,253,191,136, 59,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200,  0,  0,  0,191,  1,  0,  0, 31,  1,  0,  0,194,  2,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,248,  0,164,  1,  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,  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, 68, 65, 84, 65, 72,  1,  0,  0,184,198, 18,  6,
+  0,  0,  0,  0, 38,  1,  0,  0,  1,  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, 12,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  7,  0,  0,  0,128, 63,190,133, 65, 66, 99,212, 90, 66, 27,183,118, 66,  0,  0,  0,  0, 68, 65, 84, 65,
-240,  0,  0,  0,240,161,206,  2,157,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0, 51, 51, 51, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 65,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  7,  0,144, 12,228,  2,  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,  8,110, 21,  6,
   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,  1,  0,  0,  0,  1,  0,  0,  0,  2,  0,  0,  0,  1,  0,  3,  0,
-  8,  0,  0,  0,  0,  0, 12, 66,  0,  0,128, 63, 10,215, 35, 60,  0,  0,250, 67,  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, 16,  0, 10,  0,  7,  1,  0,  3,  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,
- 83, 78,  0,  0,148,  0,  0,  0,240,249,213,  2,193,  0,  0,  0,  1,  0,  0,  0,184,250,213,  2, 40,249,213,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 83, 82, 67,111,109,112,111,115,105,116,105,110,103,  0,103, 46, 48, 48, 49,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,232,201,225,  2,144,205,225,  2,216,205,225,  2,144,255,225,  2,  0, 86,215,  2,208, 88,215,  2,
-  0,  0,  0,  0,  0,  0,  0,  0,144,  1,228,  2,  0,  0,  0,  0,  6,  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,  0,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,232,201,225,  2,194,  0,  0,  0,  1,  0,  0,  0, 48,202,225,  2,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0, 48,202,225,  2,194,  0,  0,  0,
-  1,  0,  0,  0,120,202,225,  2,232,201,225,  2,  0,  0,  0,  0,  0,  0,  5,  4,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,
-120,202,225,  2,194,  0,  0,  0,  1,  0,  0,  0,192,202,225,  2, 48,202,225,  2,  0,  0,  0,  0,126,  7,  5,  4,  0,  0,  0,  0,
- 68, 65, 84, 65, 20,  0,  0,  0,192,202,225,  2,194,  0,  0,  0,  1,  0,  0,  0,  8,203,225,  2,120,202,225,  2,  0,  0,  0,  0,
-126,  7,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,  8,203,225,  2,194,  0,  0,  0,  1,  0,  0,  0, 80,203,225,  2,
-192,202,225,  2,  0,  0,  0,  0,  0,  0,234,  3,  1,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0, 80,203,225,  2,194,  0,  0,  0,
-  1,  0,  0,  0,152,203,225,  2,  8,203,225,  2,  0,  0,  0,  0,126,  7,234,  3,  1,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,
-152,203,225,  2,194,  0,  0,  0,  1,  0,  0,  0,224,203,225,  2, 80,203,225,  2,  0,  0,  0,  0, 32,  6, 92,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 20,  0,  0,  0,224,203,225,  2,194,  0,  0,  0,  1,  0,  0,  0, 40,204,225,  2,152,203,225,  2,  0,  0,  0,  0,
-126,  7, 92,  0,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0, 40,204,225,  2,194,  0,  0,  0,  1,  0,  0,  0,112,204,225,  2,
-224,203,225,  2,  0,  0,  0,  0, 32,  6,234,  3,  1,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,112,204,225,  2,194,  0,  0,  0,
-  1,  0,  0,  0,184,204,225,  2, 40,204,225,  2,  0,  0,  0,  0,  0,  0,140,  1,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,
-184,204,225,  2,194,  0,  0,  0,  1,  0,  0,  0,  0,205,225,  2,112,204,225,  2,  0,  0,  0,  0, 32,  6,140,  1,  0,  0,  0,  0,
- 68, 65, 84, 65, 20,  0,  0,  0,  0,205,225,  2,194,  0,  0,  0,  1,  0,  0,  0, 72,205,225,  2,184,204,225,  2,  0,  0,  0,  0,
-  4,  3,140,  1,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0, 72,205,225,  2,194,  0,  0,  0,  1,  0,  0,  0,144,205,225,  2,
-  0,205,225,  2,  0,  0,  0,  0,  4,  3,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,144,205,225,  2,194,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0, 72,205,225,  2,  0,  0,  0,  0, 32,  6,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,
-216,205,225,  2,195,  0,  0,  0,  1,  0,  0,  0, 32,206,225,  2,  0,  0,  0,  0, 48,202,225,  2,120,202,225,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 32,206,225,  2,195,  0,  0,  0,  1,  0,  0,  0,104,206,225,  2,216,205,225,  2,
- 48,202,225,  2,  8,203,225,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,104,206,225,  2,195,  0,  0,  0,
-  1,  0,  0,  0,176,206,225,  2, 32,206,225,  2,120,202,225,  2, 80,203,225,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 24,  0,  0,  0,176,206,225,  2,195,  0,  0,  0,  1,  0,  0,  0,248,206,225,  2,104,206,225,  2,  8,203,225,  2, 80,203,225,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,248,206,225,  2,195,  0,  0,  0,  1,  0,  0,  0, 64,207,225,  2,
-176,206,225,  2,192,202,225,  2,224,203,225,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 64,207,225,  2,
-195,  0,  0,  0,  1,  0,  0,  0,136,207,225,  2,248,206,225,  2,152,203,225,  2,224,203,225,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 24,  0,  0,  0,136,207,225,  2,195,  0,  0,  0,  1,  0,  0,  0,208,207,225,  2, 64,207,225,  2, 80,203,225,  2,
- 40,204,225,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,208,207,225,  2,195,  0,  0,  0,  1,  0,  0,  0,
- 24,208,225,  2,136,207,225,  2,  8,203,225,  2, 40,204,225,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,
- 24,208,225,  2,195,  0,  0,  0,  1,  0,  0,  0, 96,208,225,  2,208,207,225,  2,152,203,225,  2, 40,204,225,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 96,208,225,  2,195,  0,  0,  0,  1,  0,  0,  0,168,208,225,  2, 24,208,225,  2,
- 80,203,225,  2,224,203,225,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,168,208,225,  2,195,  0,  0,  0,
-  1,  0,  0,  0,192,252,225,  2, 96,208,225,  2,  8,203,225,  2,112,204,225,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 24,  0,  0,  0,192,252,225,  2,195,  0,  0,  0,  1,  0,  0,  0,  8,253,225,  2,168,208,225,  2, 40,204,225,  2,184,204,225,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,  8,253,225,  2,195,  0,  0,  0,  1,  0,  0,  0, 80,253,225,  2,
-192,252,225,  2,112,204,225,  2,184,204,225,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 80,253,225,  2,
-195,  0,  0,  0,  1,  0,  0,  0,152,253,225,  2,  8,253,225,  2,112,204,225,  2,  0,205,225,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 24,  0,  0,  0,152,253,225,  2,195,  0,  0,  0,  1,  0,  0,  0,224,253,225,  2, 80,253,225,  2,184,204,225,  2,
-  0,205,225,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,224,253,225,  2,195,  0,  0,  0,  1,  0,  0,  0,
- 40,254,225,  2,152,253,225,  2,232,201,225,  2, 72,205,225,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,
- 40,254,225,  2,195,  0,  0,  0,  1,  0,  0,  0,112,254,225,  2,224,253,225,  2, 72,205,225,  2,144,205,225,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,112,254,225,  2,195,  0,  0,  0,  1,  0,  0,  0,184,254,225,  2, 40,254,225,  2,
-192,202,225,  2,144,205,225,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,184,254,225,  2,195,  0,  0,  0,
-  1,  0,  0,  0,  0,255,225,  2,112,254,225,  2,152,203,225,  2,144,205,225,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 24,  0,  0,  0,  0,255,225,  2,195,  0,  0,  0,  1,  0,  0,  0, 72,255,225,  2,184,254,225,  2,  0,205,225,  2, 72,205,225,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 72,255,225,  2,195,  0,  0,  0,  1,  0,  0,  0,144,255,225,  2,
-  0,255,225,  2,184,204,225,  2,144,205,225,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,144,255,225,  2,
-195,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 72,255,225,  2,232,201,225,  2,112,204,225,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 96,  0,  0,  0,  0, 86,215,  2,197,  0,  0,  0,  1,  0,  0,  0,144, 86,215,  2,  0,  0,  0,  0,  8,203,225,  2,
- 48,202,225,  2,120,202,225,  2, 80,203,225,  2,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,  0,  0,235,  3,  0,  0,  5,  4,  0,  0,
-  7,  7,127,  7, 27,  0,  1,  0,  0,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0, 56,233,220,  2, 56,233,220,  2, 24,163,206,  2,
- 64,164,206,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0, 24,163,206,  2,
-198,  0,  0,  0,  1,  0,  0,  0, 64,164,206,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32,148, 68,  0,  0,  0,  0,  0,  0,208, 65,
-  0,  0,  0,  0,  0,224,239, 68,  0,  0,  0,  0,  0,  0,208, 65,  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,126,  7,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,
-  0,192,239, 68,  0,  0,200, 65,  0,192,239, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,
-  4,  0, 12,  0, 10,  0,127,  7, 26,  0,127,  7, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-126,  7,  0,  0,235,  3,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,127,  7, 26,  0,
-  0,  0,  1,  0,  2,  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,  0,  0,  0,  0,  0, 16,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  2,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0, 72,200, 18,  6,
+  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,120,193, 18,  6,  0,  0,  0,  0,152,117, 18,  6,
+  0,  0,  0,  0,168,113, 18,  6,  0,  0,  0,  0,200,112, 18,  6,  0,  0,  0,  0,  8,118, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 25,  4,  0,  0,240,  4,  0,  0, 61,  2,  0,  0,194,  2,  0,  0,  1,  1,216,  0,134,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,216,207, 18,  6,  0,  0,  0,  0,216,207, 18,  6,  0,  0,  0,  0, 56,201, 18,  6,
+  0,  0,  0,  0,168,202, 18,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0, 56,201, 18,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,168,202, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,102, 68,  0,  0,  0,  0,
+  0,  0,208, 65,  0,  0,  0,  0,  0,  0,165, 67,  0,  0,  0, 64,  0,  0,208, 65,  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, 73,  1,  0,  0,  0,  0,  0,  0,
+ 23,  0,  0,  0,  0,128,164, 67,  0,  0,200, 65,  0,128,164, 67,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 74,  1, 24,  0, 74,  1, 24,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 25,  4,  0,  0,240,  4,  0,  0, 61,  2,  0,  0, 61,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  1,  0,  2,  0,  1,  0,  0,  0,  0,  0,  0,  0, 26,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,168,202, 18,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 56,201, 18,  6,  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,  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,  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, 25,  4,  0,  0,240,  4,  0,  0, 61,  2,  0,  0,194,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,216,  0,134,  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,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65,248,  0,  0,  0, 64,164,206,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 24,163,206,  2,  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, 24,204, 18,  6,  0,  0,  0,  0, 68, 65, 84, 65,112,  3,  0,  0, 24,204, 18,  6,  0,  0,  0,  0,173,  0,  0,  0,
+  1,  0,  0,  0, 56,255, 13, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,228,100, 64,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,154, 65,128,191,  0,  0,128,191,  0,  0,  0,  0,  0,  0,  0,  0, 72,  1, 77,190,
+  0,  0,  0,  0,221,149, 47, 63, 86,126,162,190,  8,165, 39, 63,  0,  0,  0,  0, 51, 70, 58, 63,225,251,159, 62,149, 84, 28,191,
+  0,  0,  0,  0,192, 56, 49,188, 55, 53,101, 63, 52,247,227, 62,  0,  0,  0,  0, 90, 38,173,190,  0,222,192,190,152,  9, 52,193,
+  0,  0,128, 63,223,149, 47, 63, 55, 70, 58, 63,160, 56, 49,188,  0,  0,  0,  0, 88,126,162,190,229,251,159, 62, 55, 53,101, 63,
+  0,  0,  0,  0,  7,165, 39, 63,150, 84, 28,191, 51,247,227, 62,  0,  0,  0,  0,110,101,239, 64,151, 62,208,192, 78,255,170, 64,
+  0,  0,128, 63, 47,201,194, 63, 61, 73,145,191,244,250, 39,191,  8,165, 39,191,190,164,206, 63,209, 10,143, 63,180,164, 28, 63,
+149, 84, 28, 63,224,153,196,188,136,239, 76, 64, 10,108,228,190, 52,247,227,190,125, 21, 64,191,126,113,172,191,216, 49, 49, 65,
+152,  9, 52, 65,149, 70,158, 62, 24,234,167, 62,192,214,159,187,  0,  0,  6,181,196,188,181,189, 71,238,178, 61,127, 45,128, 62,
+  0,  0,226, 51,168,120, 21,194,107,  5,  2, 66,203,135,213,193,147,214,159,192,177, 38, 19, 66,124,173,255,193, 96,101,210, 65,
+128, 40,160, 64,221,149, 47, 63, 86,126,162,190,  8,165, 39, 63,  0,  0,  0,  0, 51, 70, 58, 63,225,251,159, 62,149, 84, 28,191,
+  0,  0,  0,  0,192, 56, 49,188, 55, 53,101, 63, 52,247,227, 62,  0,  0,  0,  0, 90, 38,173,190,  0,222,192,190,152,  9, 52,193,
+  0,  0,128, 63, 47,201,194, 63, 61, 73,145,191,244,250, 39,191,  8,165, 39,191,190,164,206, 63,209, 10,143, 63,180,164, 28, 63,
+149, 84, 28, 63,224,153,196,188,136,239, 76, 64, 10,108,228,190, 52,247,227,190,125, 21, 64,191,126,113,172,191,216, 49, 49, 65,
+152,  9, 52, 65,  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,  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,  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,  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,  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,  0,  0,
+  0,  0,  0,  0,102,103, 97, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,102,103, 97, 64,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,102,103, 97, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,241, 22, 72, 63, 78,162,246,190, 43,  8, 90,190,  2, 35,171,190,  0,  0, 32, 65,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,253,191,136, 59,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240, 65,  1,  2,  0,  0,255,255,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  7,  0,  0,  0,128, 63,190,133, 65, 66, 99,212, 90, 66,
+ 27,183,118, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 96,  1,  0,  0,216,207, 18,  6,
+  0,  0,  0,  0,174,  0,  0,  0,  1,  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,  1,  0,  0,  0, 51, 51, 51, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 65,205,204, 76, 62,  2,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  7,  0,104,139, 21,  6,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+  1,  0,  0,  0,  2,  0,  0,  0,  1,  0,  3,  0,  8,  0,128,  0,  0,  0, 12, 66,  0,  0,128, 63, 10,215, 35, 60,  0,  0,250, 67,
+  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, 16,  0, 10,  0,  7,  1,
+  0,  3,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 83, 78,  0,  0,  8,  1,  0,  0, 24,210, 18,  6,  0,  0,  0,  0,210,  0,  0,  0,
+  1,  0,  0,  0,152, 62, 19,  6,  0,  0,  0,  0, 40,110, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 83, 82, 67,111,109,112,111,115,105,116,105,110,103,  0,103, 46, 48, 48, 49,  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,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,104,211, 18,  6,
+  0,  0,  0,  0, 24,217, 18,  6,  0,  0,  0,  0,136,217, 18,  6,  0,  0,  0,  0,184,226, 18,  6,  0,  0,  0,  0, 40,227, 18,  6,
+  0,  0,  0,  0, 88, 23, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  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,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,104,211, 18,  6,  0,  0,  0,  0,211,  0,  0,  0,
+  1,  0,  0,  0,216,211, 18,  6,  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, 68, 65, 84, 65, 32,  0,  0,  0,216,211, 18,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0, 72,212, 18,  6,
+  0,  0,  0,  0,104,211, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 32,  0,  0,  0, 72,212, 18,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,184,212, 18,  6,  0,  0,  0,  0,216,211, 18,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,  5,  4,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,184,212, 18,  6,
+  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0, 40,213, 18,  6,  0,  0,  0,  0, 72,212, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,126,  7,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 40,213, 18,  6,  0,  0,  0,  0,211,  0,  0,  0,
+  1,  0,  0,  0,152,213, 18,  6,  0,  0,  0,  0,184,212, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,234,  3,
+  1,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,152,213, 18,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,  8,214, 18,  6,
+  0,  0,  0,  0, 40,213, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,234,  3,  1,  0,  0,  0, 68, 65, 84, 65,
+ 32,  0,  0,  0,  8,214, 18,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,120,214, 18,  6,  0,  0,  0,  0,152,213, 18,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32,  6, 92,  0,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,120,214, 18,  6,
+  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,232,214, 18,  6,  0,  0,  0,  0,  8,214, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,126,  7, 92,  0,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,232,214, 18,  6,  0,  0,  0,  0,211,  0,  0,  0,
+  1,  0,  0,  0, 88,215, 18,  6,  0,  0,  0,  0,120,214, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32,  6,234,  3,
+  1,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 88,215, 18,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,200,215, 18,  6,
+  0,  0,  0,  0,232,214, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,140,  1,  0,  0,  0,  0, 68, 65, 84, 65,
+ 32,  0,  0,  0,200,215, 18,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0, 56,216, 18,  6,  0,  0,  0,  0, 88,215, 18,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32,  6,140,  1,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 56,216, 18,  6,
+  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,168,216, 18,  6,  0,  0,  0,  0,200,215, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  4,  3,140,  1,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,168,216, 18,  6,  0,  0,  0,  0,211,  0,  0,  0,
+  1,  0,  0,  0, 24,217, 18,  6,  0,  0,  0,  0, 56,216, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  3,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 24,217, 18,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,168,216, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32,  6,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,136,217, 18,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,248,217, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,216,211, 18,  6,  0,  0,  0,  0, 72,212, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,248,217, 18,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,104,218, 18,  6,  0,  0,  0,  0,136,217, 18,  6,
+  0,  0,  0,  0,216,211, 18,  6,  0,  0,  0,  0, 40,213, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,104,218, 18,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,216,218, 18,  6,  0,  0,  0,  0,248,217, 18,  6,
+  0,  0,  0,  0, 72,212, 18,  6,  0,  0,  0,  0,152,213, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,216,218, 18,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 72,219, 18,  6,  0,  0,  0,  0,104,218, 18,  6,
+  0,  0,  0,  0, 40,213, 18,  6,  0,  0,  0,  0,152,213, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 72,219, 18,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,184,219, 18,  6,  0,  0,  0,  0,216,218, 18,  6,
+  0,  0,  0,  0,184,212, 18,  6,  0,  0,  0,  0,120,214, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,184,219, 18,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 40,220, 18,  6,  0,  0,  0,  0, 72,219, 18,  6,
+  0,  0,  0,  0,  8,214, 18,  6,  0,  0,  0,  0,120,214, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 40,220, 18,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,152,220, 18,  6,  0,  0,  0,  0,184,219, 18,  6,
+  0,  0,  0,  0,152,213, 18,  6,  0,  0,  0,  0,232,214, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,152,220, 18,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,  8,221, 18,  6,  0,  0,  0,  0, 40,220, 18,  6,
+  0,  0,  0,  0, 40,213, 18,  6,  0,  0,  0,  0,232,214, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,  8,221, 18,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,120,221, 18,  6,  0,  0,  0,  0,152,220, 18,  6,
+  0,  0,  0,  0,  8,214, 18,  6,  0,  0,  0,  0,232,214, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,120,221, 18,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,232,221, 18,  6,  0,  0,  0,  0,  8,221, 18,  6,
+  0,  0,  0,  0,152,213, 18,  6,  0,  0,  0,  0,120,214, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,232,221, 18,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 88,222, 18,  6,  0,  0,  0,  0,120,221, 18,  6,
+  0,  0,  0,  0, 40,213, 18,  6,  0,  0,  0,  0, 88,215, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 88,222, 18,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,200,222, 18,  6,  0,  0,  0,  0,232,221, 18,  6,
+  0,  0,  0,  0,232,214, 18,  6,  0,  0,  0,  0,200,215, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,200,222, 18,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 56,223, 18,  6,  0,  0,  0,  0, 88,222, 18,  6,
+  0,  0,  0,  0, 88,215, 18,  6,  0,  0,  0,  0,200,215, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 56,223, 18,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,168,223, 18,  6,  0,  0,  0,  0,200,222, 18,  6,
+  0,  0,  0,  0, 88,215, 18,  6,  0,  0,  0,  0, 56,216, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,168,223, 18,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 24,224, 18,  6,  0,  0,  0,  0, 56,223, 18,  6,
+  0,  0,  0,  0,200,215, 18,  6,  0,  0,  0,  0, 56,216, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 24,224, 18,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,136,224, 18,  6,  0,  0,  0,  0,168,223, 18,  6,
+  0,  0,  0,  0,104,211, 18,  6,  0,  0,  0,  0,168,216, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,136,224, 18,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,248,224, 18,  6,  0,  0,  0,  0, 24,224, 18,  6,
+  0,  0,  0,  0,168,216, 18,  6,  0,  0,  0,  0, 24,217, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,248,224, 18,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,104,225, 18,  6,  0,  0,  0,  0,136,224, 18,  6,
+  0,  0,  0,  0,184,212, 18,  6,  0,  0,  0,  0, 24,217, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,104,225, 18,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,216,225, 18,  6,  0,  0,  0,  0,248,224, 18,  6,
+  0,  0,  0,  0,  8,214, 18,  6,  0,  0,  0,  0, 24,217, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,216,225, 18,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 72,226, 18,  6,  0,  0,  0,  0,104,225, 18,  6,
+  0,  0,  0,  0, 56,216, 18,  6,  0,  0,  0,  0,168,216, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 72,226, 18,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,184,226, 18,  6,  0,  0,  0,  0,216,225, 18,  6,
+  0,  0,  0,  0,200,215, 18,  6,  0,  0,  0,  0, 24,217, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,184,226, 18,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72,226, 18,  6,
+  0,  0,  0,  0,104,211, 18,  6,  0,  0,  0,  0, 88,215, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+160,  0,  0,  0, 40,227, 18,  6,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,248,230, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 40,213, 18,  6,  0,  0,  0,  0,216,211, 18,  6,  0,  0,  0,  0, 72,212, 18,  6,  0,  0,  0,  0,152,213, 18,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,  0,  0,235,  3,  0,  0,  5,  4,  0,  0,  7,  7,127,  7,
+ 27,  0,  1,  0,  0,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8, 62, 19,  6,  0,  0,  0,  0,  8, 62, 19,  6,
+  0,  0,  0,  0, 24,228, 18,  6,  0,  0,  0,  0,136,229, 18,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0, 24,228, 18,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,136,229, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0, 32,148, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,224,239, 68,  0,  0,  0,  0,  0,  0,208, 65,  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,
+126,  7,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,192,239, 68,  0,  0,200, 65,  0,192,239, 68,  0,  0,200, 65,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,127,  7, 26,  0,127,  7, 26,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,  0,  0,235,  3,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,127,  7, 26,  0,  0,  0,  1,  0,  2,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,136,229, 18,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24,228, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
   0,240,109, 69,  0,  0,128,192,  0,  0,  0,  0,  0,  0,  0,  0,255,255,109, 69,  0,  0,  0,192,  0,  0,  0,  0,112,  7,  0,  0,
 129,  7,  0,  0, 18,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,111,  7,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,
 111,  7,  0,  0, 18,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
   0,  0,128, 63,  2,  0,  0,  0,  1,  0,  3,  3,  2,  0,  0,  4, 10,  0,129,  7,  2,  0,112,  7,  1,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  4,  0,  0,  5,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  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,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 96,  0,  0,  0,144, 86,215,  2,197,  0,  0,  0,  1,  0,  0,  0,
- 32, 87,215,  2,  0, 86,215,  2,144,205,225,  2,152,203,225,  2,224,203,225,  2,192,202,225,  2,  0,  0,  0,  0, 33,  6,  0,  0,
-126,  7,  0,  0,  0,  0,  0,  0, 91,  0,  0,  0, 15, 15, 94,  1, 92,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,
-168, 44,226,  2,168, 44,226,  2,192, 12,226,  2,232, 13,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65,248,  0,  0,  0,192, 12,226,  2,198,  0,  0,  0,  1,  0,  0,  0,232, 13,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,128,115, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,  0,175, 67,  0,  0,  0,  0,  0,  0,208, 65,  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,
- 93,  1,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,128,174, 67,  0,  0,200, 65,  0,128,174, 67,  0,  0,200, 65,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 94,  1, 26,  0, 94,  1, 26,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 33,  6,  0,  0,126,  7,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 94,  1, 26,  0,  0,  0,  1,  0,  2,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,232, 13,226,  2,198,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,192, 12,226,  2,  0,  0, 64,192,  0,  0,126, 67,  0,  0,  0,  0,  0,  0, 72, 66, 50, 51, 74,193,154,209,131, 67,
-  0,  0,  0,  0,  0,  0, 72, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 93,  1,  0,  0,
-  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0, 93,  1,  0,  0, 18,  0,  0,  0, 65,  0,  0,  0,  0,  0,128, 63,  0,  0, 72, 66,
-  0,124,146, 72,  0,  0, 72, 66,205,204,204, 61,  0,  0, 32, 65, 72,  0,  0,  0,  0,  0,  0,  2,  4,  0,  0,  4,  8,  0, 94,  1,
- 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 33,  6,  0,  0,126,  7,  0,  0, 26,  0,  0,  0,
- 91,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 94,  1, 66,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,188,  0,  0,  0,
-168, 44,226,  2,173,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 15,  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,  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,  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,  0,  0,  0,  0,  0, 31,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,  6,  0,  0,  0, 68, 65, 84, 65, 96,  0,  0,  0, 32, 87,215,  2,197,  0,  0,  0,  1,  0,  0,  0,176, 87,215,  2,
-144, 86,215,  2,152,203,225,  2, 40,204,225,  2, 80,203,225,  2,224,203,225,  2,  0,  0,  0,  0, 33,  6,  0,  0,126,  7,  0,  0,
- 93,  0,  0,  0,233,  3,  0,  0,  4,  4, 94,  1,141,  3,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 84,226,  2,
-200, 84,226,  2, 16, 15,226,  2, 56, 16,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
-248,  0,  0,  0, 16, 15,226,  2,198,  0,  0,  0,  1,  0,  0,  0, 56, 16,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,148, 67,
-  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,  0,175, 67,  0,  0,  0,  0,  0,  0,208, 65,  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, 93,  1,  0,  0,
-  0,  0,  0,  0, 25,  0,  0,  0,  0,128,174, 67,  0,  0,200, 65,  0,128,174, 67,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 94,  1, 26,  0, 94,  1, 26,  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,  5,  4,  0,  0,  5,  4,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  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,  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, 68, 65, 84, 65,160,  0,  0,  0,248,230, 18,  6,
+  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,232,235, 18,  6,  0,  0,  0,  0, 40,227, 18,  6,  0,  0,  0,  0, 24,217, 18,  6,
+  0,  0,  0,  0,  8,214, 18,  6,  0,  0,  0,  0,120,214, 18,  6,  0,  0,  0,  0,184,212, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 33,  6,  0,  0,126,  7,  0,  0,  0,  0,  0,  0, 91,  0,  0,  0, 15, 15, 94,  1, 92,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,200,234, 18,  6,  0,  0,  0,  0,200,234, 18,  6,  0,  0,  0,  0,232,231, 18,  6,
+  0,  0,  0,  0, 88,233, 18,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0,232,231, 18,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0, 88,233, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,115, 68,  0,  0,  0,  0,
+  0,  0,208, 65,  0,  0,  0,  0,  0,  0,175, 67,  0,  0,  0,  0,  0,  0,208, 65,  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, 93,  1,  0,  0,  0,  0,  0,  0,
+ 25,  0,  0,  0,  0,128,174, 67,  0,  0,200, 65,  0,128,174, 67,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 94,  1, 26,  0, 94,  1, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 33,  6,  0,  0,126,  7,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 94,  1, 26,  0,  0,  0,  1,  0,  2,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0, 88,233, 18,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232,231, 18,  6,  0,  0,  0,  0,  0,  0, 64,192,  0,  0,126, 67,  0,  0,  0,  0,
+  0,  0, 72, 66, 50, 51, 74,193,154,209,131, 67,  0,  0,  0,  0,  0,  0, 72, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 93,  1,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0, 93,  1,  0,  0, 18,  0,  0,  0,
+ 65,  0,  0,  0,  0,  0,128, 63,  0,  0, 72, 66,  0,124,146, 72,  0,  0, 72, 66,205,204,204, 61,  0,  0, 32, 65, 72,  0,  0,  0,
+  0,  0,  0,  2,  4,  0,  0,  4,  8,  0, 94,  1, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 33,  6,  0,  0,126,  7,  0,  0, 26,  0,  0,  0, 91,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 94,  1, 66,  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,  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,  0, 68, 65, 84, 65,208,  0,  0,  0,200,234, 18,  6,  0,  0,  0,  0,190,  0,  0,  0,
+  1,  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, 15,  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,  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,  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,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0,232,235, 18,  6,
+  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,120,  4, 19,  6,  0,  0,  0,  0,248,230, 18,  6,  0,  0,  0,  0,  8,214, 18,  6,
+  0,  0,  0,  0,232,214, 18,  6,  0,  0,  0,  0,152,213, 18,  6,  0,  0,  0,  0,120,214, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 33,  6,  0,  0,126,  7,  0,  0, 93,  0,  0,  0,233,  3,  0,  0,  4,  4, 94,  1,141,  3,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 56,  3, 19,  6,  0,  0,  0,  0, 56,  3, 19,  6,  0,  0,  0,  0,216,236, 18,  6,
+  0,  0,  0,  0, 72,238, 18,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0,216,236, 18,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0, 72,238, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,148, 67,  0,  0,  0,  0,
+  0,  0,208, 65,  0,  0,  0,  0,  0,  0,175, 67,  0,  0,  0,  0,  0,  0,208, 65,  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, 93,  1,  0,  0,  0,  0,  0,  0,
+ 25,  0,  0,  0,  0,128,174, 67,  0,  0,200, 65,  0,128,174, 67,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 94,  1, 26,  0, 94,  1, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
   0,  0,  0,  0, 33,  6,  0,  0,126,  7,  0,  0,208,  3,  0,  0,233,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
   0,  0,  0,  0, 94,  1, 26,  0,  0,  0,  1,  0,  1,  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,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0, 56, 16,226,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
- 16, 15,226,  2,  0,  0,  0,  0,  0,128,174, 67,  0,128, 92,196,  0,  0,  0,  0,  0,  0,  0,  0,255,127,166, 67,255,191, 92,196,
-  0,  0,  0,  0, 77,  1,  0,  0, 94,  1,  0,  0,  0,  0,  0,  0,114,  3,  0,  0,  0,  0,  0,  0, 82,  1,  0,  0,  0,  0,  0,  0,
- 17,  0,  0,  0,  0,  0,  0,  0, 76,  1,  0,  0,  0,  0,  0,  0,114,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  3,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,  6,  0, 94,  1,115,  3, 77,  1,
-115,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 33,  6,  0,  0,126,  7,  0,  0, 93,  0,  0,  0,207,  3,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 94,  1,115,  3,  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,152, 45,226,  2,
-176, 61,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 64,  1,  0,  0,152, 45,226,  2,
-196,  0,  0,  0,  1,  0,  0,  0,  8, 47,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 85, 84, 84, 79, 78, 83, 95,
- 80, 84, 95, 99,111,110,116,101,120,116,  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, 66, 85, 84, 84, 79, 78, 83, 95,
- 80, 84, 95, 99,111,110,116,101,120,116,  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, 67,111,110,116,101,120,116,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,220,255, 76,  1, 36,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0, 72,238, 18,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,216,236, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,174, 67,  0,128, 92,196,
+  0,  0,  0,  0,  0,  0,  0,  0,255,127,166, 67,255,191, 92,196,  0,  0,  0,  0, 77,  1,  0,  0, 94,  1,  0,  0,  0,  0,  0,  0,
+114,  3,  0,  0,  0,  0,  0,  0, 82,  1,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0, 76,  1,  0,  0,  0,  0,  0,  0,
+114,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  3,  0,  0,
+  1,  0,  7,  0, 18,  0,  0,  4,  6,  0, 94,  1,115,  3, 77,  1,115,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 33,  6,  0,  0,126,  7,  0,  0, 93,  0,  0,  0,207,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 94,  1,115,  3,  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,  0,  0,184,239, 18,  6,
+  0,  0,  0,  0,152,  1, 19,  6,  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, 68, 65, 84, 65, 88,  1,  0,  0,184,239, 18,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0, 88,241, 18,  6,  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, 66, 85, 84, 84, 79, 78, 83, 95, 80, 84, 95, 99,111,110,116,101,120,116,  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, 66, 85, 84, 84, 79, 78, 83, 95, 80, 84, 95, 99,111,110,116,101,120,116,  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, 67,111,110,116,101,120,116,  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,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 64,  1,  0,  0,  8, 47,226,  2,196,  0,  0,  0,  1,  0,  0,  0,120, 48,226,  2,
-152, 45,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,114,101,110,100,101,114,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,220,255, 76,  1, 36,  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,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,114,101,110,100,101,114,  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, 82,101,110,100,101,114,  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, 68, 65, 84, 65,
+ 88,  1,  0,  0, 88,241, 18,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,248,242, 18,  6,  0,  0,  0,  0,184,239, 18,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,114,101,
+110,100,101,114,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,114,101,
+110,100,101,114,  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, 82,101,110,100,101,114,  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,  0,  0,135,255, 76,  1, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  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,  0,  0,  0,135,255, 76,  1, 61,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  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, 68, 65, 84, 65,
- 64,  1,  0,  0,120, 48,226,  2,196,  0,  0,  0,  1,  0,  0,  0,232, 49,226,  2,  8, 47,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,108, 97,121,101,114,115,  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,
- 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,108, 97,121,101,114,115,  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, 68, 65, 84, 65, 88,  1,  0,  0,248,242, 18,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0,152,244, 18,  6,  0,  0,  0,  0, 88,241, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,108, 97,121,101,114,115,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,108, 97,121,101,114,115,  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,
- 76, 97,121,101,114,115,  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, 76, 97,121,101,114,115,  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,  0,  0,  0,  0,
-  0,  0,111,255, 76,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,111,255, 76,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  2,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,232, 49,226,  2,196,  0,  0,  0,
-  1,  0,  0,  0, 88, 51,226,  2,120, 48,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,100,105,
+  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, 68, 65, 84, 65,
+ 88,  1,  0,  0,152,244, 18,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0, 56,246, 18,  6,  0,  0,  0,  0,248,242, 18,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,100,105,
 109,101,110,115,105,111,110,115,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,100,105,
 109,101,110,115,105,111,110,115,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -715,82 +907,89 @@ char datatoc_startup_blend[]= {
   0,  0,  0,  0,  0,  0,  0,  0,  3,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0, 88, 51,226,  2,196,  0,  0,  0,  1,  0,  0,  0,224, 52,226,  2,232, 49,226,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 97,110,116,105, 97,108,105, 97,115,105,110,103,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 97,110,116,105, 97,108,105, 97,115,105,110,103,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0, 56,246, 18,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0,216,247, 18,  6,  0,  0,  0,  0,152,244, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 97,110,116,105, 97,108,105, 97,115,105,110,103,  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, 65,110,116,105, 45, 65,108,105, 97,115,105,110,103,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 97,110,116,105, 97,108,105, 97,115,105,110,103,  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, 58,254, 76,  1, 58,  0, 20,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,
+  0,  0,  0,  0, 65,110,116,105, 45, 65,108,105, 97,115,105,110,103,  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,  0,  0,  0, 58,254, 76,  1, 58,  0, 20,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 64,  1,  0,  0,
-224, 52,226,  2,196,  0,  0,  0,  1,  0,  0,  0, 88, 54,226,  2, 88, 51,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68,
- 69, 82, 95, 80, 84, 95,109,111,116,105,111,110, 95, 98,108,117,114,  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, 82, 69, 78, 68,
- 69, 82, 95, 80, 84, 95,109,111,116,105,111,110, 95, 98,108,117,114,  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, 83, 97,109,112,
-108,101,100, 32, 77,111,116,105,111,110, 32, 66,108,117,114,  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, 34,254,
- 76,  1,  0,  0, 20,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  5,  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,  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, 68, 65, 84, 65,
+ 88,  1,  0,  0,216,247, 18,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,120,249, 18,  6,  0,  0,  0,  0, 56,246, 18,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,109,111,
+116,105,111,110, 95, 98,108,117,114,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,109,111,
+116,105,111,110, 95, 98,108,117,114,  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, 83, 97,109,112,108,101,100, 32, 77,111,116,105,
+111,110, 32, 66,108,117,114,  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, 34,254, 76,  1,  0,  0, 20,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  0,  0,  5,  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,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 64,  1,  0,  0, 88, 54,226,  2,196,  0,  0,  0,  1,  0,  0,  0,
-208, 55,226,  2,224, 52,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,104, 97,100,105,110,
-103,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,104, 97,100,105,110,
-103,  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, 83,104, 97,100,105,110,103,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,254, 76,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,
-  0,  0,  0,  0,  6,  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, 68, 65, 84, 65, 88,  1,  0,  0,120,249, 18,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0, 24,251, 18,  6,  0,  0,  0,  0,216,247, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,104, 97,100,105,110,103,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,104, 97,100,105,110,103,  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,
- 68, 65, 84, 65, 64,  1,  0,  0,208, 55,226,  2,196,  0,  0,  0,  1,  0,  0,  0, 72, 57,226,  2, 88, 54,226,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,101,114,102,111,114,109, 97,110, 99,101,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 83,104, 97,100,105,110,103,  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,  0,  0,  0,
-  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,101,114,102,111,114,109, 97,110, 99,101,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0, 10,254, 76,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  6,  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, 80,101,114,102,111,114,109, 97,110, 99,101,  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,  0,  0,  0,  0,  0,242,253, 76,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  7,  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, 68, 65, 84, 65,
+ 88,  1,  0,  0, 24,251, 18,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,184,252, 18,  6,  0,  0,  0,  0,120,249, 18,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,101,
+114,102,111,114,109, 97,110, 99,101,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,101,
+114,102,111,114,109, 97,110, 99,101,  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, 80,101,114,102,111,114,109, 97,110, 99,101,  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,  0,  0,  0,  0,  0,242,253, 76,  1,  0,  0,  0,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  0,  0,  7,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0, 72, 57,226,  2,
-196,  0,  0,  0,  1,  0,  0,  0,192, 58,226,  2,208, 55,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80,
- 84, 95,112,111,115,116, 95,112,114,111, 99,101,115,115,105,110,103,  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, 82, 69, 78, 68, 69, 82, 95, 80,
- 84, 95,112,111,115,116, 95,112,114,111, 99,101,115,115,105,110,103,  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, 80,111,115,116, 32, 80,114,111,
- 99,101,115,115,105,110,103,  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,  0,218,253, 76,  1,  0,  0,
-  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  8,  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,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,184,252, 18,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0, 88,254, 18,  6,  0,  0,  0,  0, 24,251, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,111,115,116, 95,112,114,111, 99,101,115,115,105,110,103,  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, 68, 65, 84, 65, 64,  1,  0,  0,192, 58,226,  2,196,  0,  0,  0,  1,  0,  0,  0, 56, 60,226,  2,
- 72, 57,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,116, 97,109,112,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,111,115,116, 95,112,114,111, 99,101,115,115,105,110,103,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,116, 97,109,112,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 80,111,115,116, 32, 80,114,111, 99,101,115,115,105,110,103,  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,  0,  0,  0,  0,  0,  0,  0, 83,116, 97,109,112,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,218,253, 76,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  8,  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,  0,  0,  0,194,253, 76,  1,  0,  0, 20,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
-  9,  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,  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, 68, 65, 84, 65,
- 64,  1,  0,  0, 56, 60,226,  2,196,  0,  0,  0,  1,  0,  0,  0,176, 61,226,  2,192, 58,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,111,117,116,112,117,116,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 88,  1,  0,  0, 88,254, 18,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,248,255, 18,  6,  0,  0,  0,  0,184,252, 18,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,116,
+ 97,109,112,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,116,
+ 97,109,112,  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, 83,116, 97,109,112,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,194,253, 76,  1,  0,  0, 20,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  0,  0,  9,  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,  0,  0,  0,  0,  0,
- 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,111,117,116,112,117,116,  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,
- 79,117,116,112,117,116,  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, 68, 65, 84, 65, 88,  1,  0,  0,248,255, 18,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0,152,  1, 19,  6,  0,  0,  0,  0, 88,254, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,111,117,116,112,117,116,  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, 40,253, 76,  1,130,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,111,117,116,112,117,116,  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, 79,117,116,112,117,116,  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,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 64,  1,  0,  0,176, 61,226,  2,196,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0, 56, 60,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 98, 97,
+  0,  0,  0,  0,  0,  0, 40,253, 76,  1,130,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,  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,  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, 68, 65, 84, 65,
+ 88,  1,  0,  0,152,  1, 19,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,248,255, 18,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 98, 97,
 107,101,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 98, 97,
 107,101,  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,
@@ -800,171 +999,188 @@ char datatoc_startup_blend[]= {
   4,  0,  0,  0,  0,  0,  0,  0, 11,  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,  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, 68, 65, 84, 65,216,  0,  0,  0,200, 84,226,  2,162,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  4,  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,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0, 56,  3, 19,  6,  0,  0,  0,  0,179,  0,  0,  0,
+  1,  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,  4,  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,  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,  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,  2,  0,  1,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,255, 21,  0,  0,160,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 96,  0,  0,  0,176, 87,215,  2,197,  0,  0,  0,
-  1,  0,  0,  0, 64, 88,215,  2, 32, 87,215,  2, 72,205,225,  2,  0,205,225,  2,184,204,225,  2,144,205,225,  2,  0,  0,  0,  0,
-  5,  3,  0,  0, 31,  6,  0,  0,  0,  0,  0,  0,139,  1,  0,  0,  1,  1, 27,  3,140,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 40, 23,226,  2, 40, 23,226,  2, 96, 17,226,  2,  0, 22,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0, 96, 17,226,  2,198,  0,  0,  0,  1,  0,  0,  0,136, 18,226,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,  0, 64,113, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,192, 70, 68,  0,  0,  0,  0,  0,  0,208, 65,
   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, 26,  3,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,128, 70, 68,  0,  0,200, 65,  0,128, 70, 68,  0,  0,200, 65,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 27,  3, 26,  0, 27,  3, 26,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,255, 21,  0,  0,160,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+160,  0,  0,  0,120,  4, 19,  6,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,  8, 18, 19,  6,  0,  0,  0,  0,232,235, 18,  6,
+  0,  0,  0,  0,168,216, 18,  6,  0,  0,  0,  0, 56,216, 18,  6,  0,  0,  0,  0,200,215, 18,  6,  0,  0,  0,  0, 24,217, 18,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  3,  0,  0, 31,  6,  0,  0,  0,  0,  0,  0,139,  1,  0,  0,  1,  1, 27,  3,
+140,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 88, 16, 19,  6,  0,  0,  0,  0, 88, 16, 19,  6,
+  0,  0,  0,  0,104,  5, 19,  6,  0,  0,  0,  0, 40, 11, 19,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0,104,  5, 19,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,216,  6, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0, 64,113, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,192, 70, 68,  0,  0,  0,  0,  0,  0,208, 65,  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,
+ 26,  3,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,128, 70, 68,  0,  0,200, 65,  0,128, 70, 68,  0,  0,200, 65,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 27,  3, 26,  0, 27,  3, 26,  0,  0,  0,  0,  0,  0,  0,
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  3,  0,  0, 31,  6,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 27,  3, 26,  0,  0,  0,  1,  0,  2,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,136, 18,226,  2,198,  0,  0,  0,
-  1,  0,  0,  0,176, 19,226,  2, 96, 17,226,  2,  0,  0,  0,  0,  0,  0, 15, 67,  0, 64, 70,196,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0, 15, 67,255,127, 70,196,  0,  0,  0,  0,143,  0,  0,  0,160,  0,  0,  0, 18,  0,  0,  0, 43,  3,  0,  0,  0,  0,  0,  0,
-142,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0, 18,  0,  0,  0, 43,  3,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  0,  0,  0,  1,  0,  7,  0, 18,  0,  0,  0,
-  6,  0,160,  0, 44,  3,143,  0, 26,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  3,  0,  0,  5,  3,  0,  0,
- 26,  0,  0,  0,139,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,114,  1,  0,  0,  5,  0,
-  3,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
-248,  0,  0,  0,176, 19,226,  2,198,  0,  0,  0,  1,  0,  0,  0,216, 20,226,  2,136, 18,226,  2,  0,  0,  0,  0,  0,  0, 16, 67,
-  0,  0,206,194,  0,  0,  0,  0,  0,  0,  0,  0,231,102, 16, 67,  0,  0,206,194,  0,  0,  0,  0,143,  0,  0,  0,160,  0,  0,  0,
- 18,  0,  0,  0,119,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,
- 18,  0,  0,  0,119,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64,
- 10,  0,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,160,  0,120,  0,143,  0,102,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  5,  3,  0,  0, 31,  6,  0,  0, 26,  0,  0,  0, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  6,  0, 34,  0,  2,  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,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,216, 20,226,  2,198,  0,  0,  0,  1,  0,  0,  0,  0, 22,226,  2,
-176, 19,226,  2,  0,  0,  0,  0,  0,  0, 35, 67,  0,192,108,196,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 35, 67,  0,  0,184,195,
-  0,  0,  0,  0,163,  0,  0,  0,180,  0,  0,  0, 18,  0,  0,  0,129,  1,  0,  0,  0,  0,  0,  0,162,  0,  0,  0,  0,  0,  0,  0,
- 17,  0,  0,  0,  0,  0,  0,  0,162,  0,  0,  0, 18,  0,  0,  0,129,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  0,  0,  0,  1,  0,  7,  0, 18,  0,  0,  0,  6,  0,180,  0,130,  1,163,  0,
-112,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 31,  6,  0,  0, 31,  6,  0,  0, 26,  0,  0,  0,139,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  4,  0,  4,  0,  1,  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, 68, 65, 84, 65, 40,  1,  0,  0,216,  6, 19,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0, 72,  8, 19,  6,  0,  0,  0,  0,104,  5, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0, 15, 67,  0, 64, 70,196,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 15, 67,255,127, 70,196,  0,  0,  0,  0,143,  0,  0,  0,
+160,  0,  0,  0, 18,  0,  0,  0, 43,  3,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,
+142,  0,  0,  0, 18,  0,  0,  0, 43,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,
+  0,  0,  0, 64, 10,  0,  0,  0,  1,  0,  7,  0, 18,  0,  0,  0,  6,  0,160,  0, 44,  3,143,  0, 26,  3,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  3,  0,  0,  5,  3,  0,  0, 26,  0,  0,  0,139,  1,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,114,  1,  0,  0,  5,  0,  3,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,  0, 22,226,  2,
-198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,216, 20,226,  2,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0, 72,  8, 19,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,184,  9, 19,  6,  0,  0,  0,  0,216,  6, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0, 16, 67,  0,  0,206,194,  0,  0,  0,  0,  0,  0,  0,  0,231,102, 16, 67,  0,  0,206,194,  0,  0,  0,  0,143,  0,  0,  0,
+160,  0,  0,  0, 18,  0,  0,  0,119,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,
+142,  0,  0,  0, 18,  0,  0,  0,119,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,
+  0,  0,  0, 64, 10,  0,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,160,  0,120,  0,143,  0,102,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  3,  0,  0, 31,  6,  0,  0, 26,  0,  0,  0, 26,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  6,  0, 34,  0,  2,  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,  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,  0,  5,  3,  0,  0,
- 31,  6,  0,  0, 26,  0,  0,  0,139,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 27,  3,114,  1,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0,184,  9, 19,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0, 40, 11, 19,  6,  0,  0,  0,  0, 72,  8, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0, 35, 67,  0,192,108,196,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 35, 67,  0,  0,184,195,  0,  0,  0,  0,163,  0,  0,  0,
+180,  0,  0,  0, 18,  0,  0,  0,129,  1,  0,  0,  0,  0,  0,  0,162,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,
+162,  0,  0,  0, 18,  0,  0,  0,129,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,
+  0,  0,  0, 64, 10,  0,  0,  0,  1,  0,  7,  0, 18,  0,  0,  0,  6,  0,180,  0,130,  1,163,  0,112,  1,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 31,  6,  0,  0, 31,  6,  0,  0, 26,  0,  0,  0,139,  1,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  4,  0,  4,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,208, 85,226,  2,
- 68, 65, 84, 65, 68,  3,  0,  0,208, 85,226,  2,156,  0,  0,  0,  1,  0,  0,  0, 93,101,230, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 30,133,119, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,154, 65,128,191,
-  0,  0,128,191,  0,  0,  0,  0,  0,  0,  0,  0, 72,  1, 77,190,  0,  0,  0,  0,221,149, 47, 63, 85,126,162,190,  8,165, 39, 63,
-  0,  0,  0,  0, 51, 70, 58, 63,225,251,159, 62,149, 84, 28,191,  0,  0,  0,  0,191, 56, 49,188, 54, 53,101, 63, 50,247,227, 62,
-  0,  0,  0,  0, 90, 38,173,190,254,221,192,190,152,  9, 52,193,  0,  0,128, 63,223,149, 47, 63, 55, 70, 58, 63,192, 56, 49,188,
-  0,  0,  0,  0, 87,126,162,190,228,251,159, 62, 56, 53,101, 63,  0,  0,  0,  0,  7,165, 39, 63,150, 84, 28,191, 50,247,227, 62,
-  0,  0,  0,  0,110,101,239, 64,151, 62,208,192, 77,255,170, 64,  0,  0,128, 63, 42,  6,158, 63, 99, 28,157,191,244,250, 39,191,
-  8,165, 39,191,211,164,167, 63, 55,175,154, 63,180,164, 28, 63,149, 84, 28, 63, 39,127,159,188,135,157, 93, 64,  8,108,228,190,
- 50,247,227,190,  4,213, 27,191,122,122,186,191,216, 49, 49, 65,152,  9, 52, 65, 25, 25,195, 62,176,249,206, 62,128,238,196,187,
-  0,  0,192,179, 55, 15,168,189,201,118,165, 61,152, 15,109, 62,  0,  0,152, 51,211,120, 21,194,144,  5,  2, 66,  6,136,213,193,
-193,214,159,192,219, 38, 19, 66,196,173,255,193,154,101,210, 65,173, 40,160, 64,221,149, 47, 63, 85,126,162,190,  8,165, 39, 63,
-  0,  0,  0,  0, 51, 70, 58, 63,225,251,159, 62,149, 84, 28,191,  0,  0,  0,  0,191, 56, 49,188, 54, 53,101, 63, 50,247,227, 62,
-  0,  0,  0,  0, 90, 38,173,190,254,221,192,190,152,  9, 52,193,  0,  0,128, 63, 42,  6,158, 63, 99, 28,157,191,244,250, 39,191,
-  8,165, 39,191,211,164,167, 63, 55,175,154, 63,180,164, 28, 63,149, 84, 28, 63, 39,127,159,188,135,157, 93, 64,  8,108,228,190,
- 50,247,227,190,  4,213, 27,191,122,122,186,191,216, 49, 49, 65,152,  9, 52, 65, 62,250,150, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 62,250,150, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 62,250,150, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,241, 22, 72, 63, 78,162,246,190, 44,  8, 90,190,
-  3, 35,171,190,214,211,111, 65,214,211,111, 65,  0,  0,  0,  0,  0,  0,  0,  0, 80, 49,183, 58,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 20,  0,255,255,  1,  0,  0,  0,  0,  0,  0,  0,  2,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0, 40, 11, 19,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,184,  9, 19,  6,  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,  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,  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,  5,  3,  0,  0, 31,  6,  0,  0, 26,  0,  0,  0,139,  1,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 27,  3,114,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 92, 62, 55, 63, 56,186,224,190,237,203,148,190,  3,236,234,190,
-  1,  0,  0,  0,  0,  0,128, 63,190,133, 65, 66,100,212, 90, 66, 31,183,118, 66,  0,  0,  0,  0, 68, 65, 84, 65,240,  0,  0,  0,
- 40, 23,226,  2,157,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
- 51, 51, 51, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0, 32, 65,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  7,  0,144, 12,228,  2,  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,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  3,  0,  0,  0,  1,  0,  3,  0,  8,  8,  0,  0,
-  0,  0, 12, 66,  0,  0,128, 63,205,204,204, 61,  0,  0,250, 67,  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, 16,  0, 10,  0,  7,  1,  0,  3,  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, 68, 65, 84, 65,
- 96,  0,  0,  0, 64, 88,215,  2,197,  0,  0,  0,  1,  0,  0,  0,208, 88,215,  2,176, 87,215,  2,112,204,225,  2,  8,203,225,  2,
- 40,204,225,  2,184,204,225,  2,  0,  0,  0,  0,  0,  0,  0,  0, 31,  6,  0,  0,141,  1,  0,  0,233,  3,  0,  0, 16, 16, 32,  6,
- 93,  2,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72, 89,226,  2, 72, 89,226,  2, 80, 24,226,  2,120, 25,226,  2,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0, 80, 24,226,  2,198,  0,  0,  0,
-  1,  0,  0,  0,120, 25,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 66, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,
-  0,  0,196, 68,  0,  0,  0,  0,  0,  0,208, 65,  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, 31,  6,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,224,195, 68,
-  0,  0,200, 65,  0,224,195, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0,
- 10,  0, 32,  6, 26,  0, 32,  6, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 31,  6,  0,  0,
-141,  1,  0,  0,166,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32,  6, 26,  0,  0,  0,  1,  0,
-  2,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
-248,  0,  0,  0,120, 25,226,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 80, 24,226,  2,  0,  0, 32,193,  0,  0,  0, 68,
-  0,  0, 32,193,  0,  0,  0, 68,128,195,217,195,192,225,108, 68, 96,240,187, 64, 62, 16,253, 67, 15,  6,  0,  0, 32,  6,  0,  0,
- 18,  0,  0,  0, 66,  2,  0,  0,  0,  0,  0,  0, 14,  6,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0, 14,  6,  0,  0,
- 18,  0,  0,  0, 66,  2,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,250, 70,  0,  0,250, 70,236, 81,184, 61, 10,215, 19, 64,
- 10,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  4,  0,  0, 32,  6, 67,  2, 15,  6, 49,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 31,  6,  0,  0,167,  1,  0,  0,233,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 32,  6, 67,  2,  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,152, 12, 19,  6,  0,  0,  0,  0, 68, 65, 84, 65,112,  3,  0,  0,152, 12, 19,  6,
+  0,  0,  0,  0,173,  0,  0,  0,  1,  0,  0,  0, 93,101,230, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 30,133,119, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,154, 65,128,191,  0,  0,128,191,  0,  0,  0,  0,
+  0,  0,  0,  0, 72,  1, 77,190,  0,  0,  0,  0,221,149, 47, 63, 85,126,162,190,  8,165, 39, 63,  0,  0,  0,  0, 51, 70, 58, 63,
+225,251,159, 62,149, 84, 28,191,  0,  0,  0,  0,191, 56, 49,188, 54, 53,101, 63, 50,247,227, 62,  0,  0,  0,  0, 90, 38,173,190,
+254,221,192,190,152,  9, 52,193,  0,  0,128, 63,223,149, 47, 63, 55, 70, 58, 63,192, 56, 49,188,  0,  0,  0,  0, 87,126,162,190,
+228,251,159, 62, 56, 53,101, 63,  0,  0,  0,  0,  7,165, 39, 63,150, 84, 28,191, 50,247,227, 62,  0,  0,  0,  0,110,101,239, 64,
+151, 62,208,192, 77,255,170, 64,  0,  0,128, 63, 42,  6,158, 63, 99, 28,157,191,244,250, 39,191,  8,165, 39,191,211,164,167, 63,
+ 55,175,154, 63,180,164, 28, 63,149, 84, 28, 63, 39,127,159,188,135,157, 93, 64,  8,108,228,190, 50,247,227,190,  4,213, 27,191,
+122,122,186,191,216, 49, 49, 65,152,  9, 52, 65, 25, 25,195, 62,176,249,206, 62,128,238,196,187,  0,  0,192,179, 55, 15,168,189,
+201,118,165, 61,152, 15,109, 62,  0,  0,152, 51,211,120, 21,194,144,  5,  2, 66,  6,136,213,193,193,214,159,192,219, 38, 19, 66,
+196,173,255,193,154,101,210, 65,173, 40,160, 64,221,149, 47, 63, 85,126,162,190,  8,165, 39, 63,  0,  0,  0,  0, 51, 70, 58, 63,
+225,251,159, 62,149, 84, 28,191,  0,  0,  0,  0,191, 56, 49,188, 54, 53,101, 63, 50,247,227, 62,  0,  0,  0,  0, 90, 38,173,190,
+254,221,192,190,152,  9, 52,193,  0,  0,128, 63, 42,  6,158, 63, 99, 28,157,191,244,250, 39,191,  8,165, 39,191,211,164,167, 63,
+ 55,175,154, 63,180,164, 28, 63,149, 84, 28, 63, 39,127,159,188,135,157, 93, 64,  8,108,228,190, 50,247,227,190,  4,213, 27,191,
+122,122,186,191,216, 49, 49, 65,152,  9, 52, 65,  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,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,252,  0,  0,  0, 72, 89,226,  2,174,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 10,215, 19, 64,  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,144,  1,228,  2,  0,  0,  0,  0,  0,  0,  0,  0, 10,206, 97, 63,
   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,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 96,  0,  0,  0,
-208, 88,215,  2,197,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 64, 88,215,  2,232,201,225,  2,112,204,225,  2,  0,205,225,  2,
- 72,205,225,  2,  0,  0,  0,  0,  0,  0,  0,  0,  3,  3,  0,  0,  0,  0,  0,  0,139,  1,  0,  0,  6,  6,  4,  3,140,  1,  1,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,120, 90,226,  2,120, 90,226,  2,160, 26,226,  2,240, 28,226,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,160, 26,226,  2,198,  0,  0,  0,  1,  0,  0,  0,
-200, 27,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,215, 67,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,  0, 65, 68,
-  0,  0,  0,  0,  0,  0,208, 65,  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,  3,  3,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,192, 64, 68,  0,  0,200, 65,
-  0,192, 64, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,  4,  3,
- 26,  0,  4,  3, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  3,  0,  0,  0,  0,  0,  0,
- 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  3, 26,  0,  0,  0,  1,  0,  2,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,
-200, 27,226,  2,198,  0,  0,  0,  1,  0,  0,  0,240, 28,226,  2,160, 26,226,  2,  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,  0,  0,  0,  0,  0,  0, 62,250,150, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 62,250,150, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 62,250,150, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,241, 22, 72, 63, 78,162,246,190, 44,  8, 90,190,  3, 35,171,190,214,211,111, 65,
+214,211,111, 65,  0,  0,  0,  0,  0,  0,  0,  0, 80, 49,183, 58,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,160, 65,
+  1,  2,  0,  0,255,255,  0,  0, 92, 62, 55, 63, 56,186,224,190,237,203,148,190,  3,236,234,190,  1,  0,  0,  0,  0,  0,128, 63,
+190,133, 65, 66,100,212, 90, 66, 31,183,118, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 96,  1,  0,  0, 88, 16, 19,  6,  0,  0,  0,  0,174,  0,  0,  0,  1,  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,  1,  0,  0,  0, 51, 51, 51, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 65,
+205,204, 76, 62,  2,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  7,  0,104,139, 21,  6,  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,  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,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 26,  0,  0,  0,139,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  1,  0,  0,  0,  4,  0,  3,  0,  1,  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,  1,  0,  0,  0,  1,  0,  0,  0,  3,  0,  0,  0,  1,  0,  3,  0,  8,  8,128,  0,  0,  0, 12, 66,  0,  0,128, 63,
+205,204,204, 61,  0,  0,250, 67,  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, 16,  0, 10,  0,  7,  1,  0,  3,  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,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,240, 28,226,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,200, 27,226,  2,
-  0,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 67,  0,  0,129,191,  0,128,  0, 64,  0,  0,100,190,  0,128,156, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0,  8, 18, 19,  6,
+  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0, 88, 23, 19,  6,  0,  0,  0,  0,120,  4, 19,  6,  0,  0,  0,  0, 88,215, 18,  6,
+  0,  0,  0,  0, 40,213, 18,  6,  0,  0,  0,  0,232,214, 18,  6,  0,  0,  0,  0,200,215, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 31,  6,  0,  0,141,  1,  0,  0,233,  3,  0,  0, 16, 16, 32,  6, 93,  2,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,216, 21, 19,  6,  0,  0,  0,  0,216, 21, 19,  6,  0,  0,  0,  0,248, 18, 19,  6,
+  0,  0,  0,  0,104, 20, 19,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0,248, 18, 19,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,104, 20, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 66, 68,  0,  0,  0,  0,
+  0,  0,208, 65,  0,  0,  0,  0,  0,  0,196, 68,  0,  0,  0,  0,  0,  0,208, 65,  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, 31,  6,  0,  0,  0,  0,  0,  0,
+ 25,  0,  0,  0,  0,224,195, 68,  0,  0,200, 65,  0,224,195, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 32,  6, 26,  0, 32,  6, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 31,  6,  0,  0,141,  1,  0,  0,166,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 32,  6, 26,  0,  0,  0,  1,  0,  2,  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,  0,
-  0,  0,  0,  0,  4,  3,  0,  0,  0,  0,  0,  0,114,  1,  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,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  3,  0,  0, 26,  0,  0,  0,139,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  3,114,  1,  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, 68, 65, 84, 65, 40,  1,  0,  0,104, 20, 19,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,248, 18, 19,  6,  0,  0,  0,  0,  0,  0, 32,193,  0,  0,  0, 68,  0,  0, 32,193,
+  0,  0,  0, 68,128,195,217,195,192,225,108, 68, 96,240,187, 64, 62, 16,253, 67, 15,  6,  0,  0, 32,  6,  0,  0, 18,  0,  0,  0,
+ 66,  2,  0,  0,  0,  0,  0,  0, 14,  6,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0, 14,  6,  0,  0, 18,  0,  0,  0,
+ 66,  2,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,250, 70,  0,  0,250, 70,236, 81,184, 61, 10,215, 19, 64, 10,  0,  0,  0,
+  0,  0,  3,  0,  0,  0,  0,  4,  0,  0, 32,  6, 67,  2, 15,  6, 49,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 31,  6,  0,  0,167,  1,  0,  0,233,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 32,  6, 67,  2,  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,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248, 32,  0,  0,120, 90,226,  2,167,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  1,  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,240, 65,  0,  0,  0,  0,154,153,153, 62,
-  0,  0,  0,  0,100,  0,  0,  0,154,153,153, 62,100,  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,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 48,  1,  0,  0,216, 21, 19,  6,  0,  0,  0,  0,191,  0,  0,  0,
+  1,  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, 16,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 10,215, 19, 64,  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,  8,110, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 10,206, 97, 63,  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,  1,  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, 68, 65, 84, 65,160,  0,  0,  0, 88, 23, 19,  6,
+  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8, 18, 19,  6,  0,  0,  0,  0,104,211, 18,  6,
+  0,  0,  0,  0, 88,215, 18,  6,  0,  0,  0,  0, 56,216, 18,  6,  0,  0,  0,  0,168,216, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  3,  3,  0,  0,  0,  0,  0,  0,139,  1,  0,  0,  6,  6,  4,  3,140,  1,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,152, 28, 19,  6,  0,  0,  0,  0,152, 28, 19,  6,  0,  0,  0,  0, 72, 24, 19,  6,
+  0,  0,  0,  0, 40, 27, 19,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0, 72, 24, 19,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,184, 25, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,215, 67,  0,  0,  0,  0,
+  0,  0,208, 65,  0,  0,  0,  0,  0,  0, 65, 68,  0,  0,  0,  0,  0,  0,208, 65,  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,  3,  3,  0,  0,  0,  0,  0,  0,
+ 25,  0,  0,  0,  0,192, 64, 68,  0,  0,200, 65,  0,192, 64, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,  4,  3, 26,  0,  4,  3, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  3,  3,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  4,  3, 26,  0,  0,  0,  1,  0,  2,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,184, 25, 19,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0, 40, 27, 19,  6,  0,  0,  0,  0, 72, 24, 19,  6,  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,  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,  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,  0,  0,  0,  0,  0,  0, 26,  0,  0,  0,139,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  4,  0,  3,  0,  1,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0, 40, 27, 19,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,184, 25, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,
+  0,  0,128, 67,  0,  0,129,191,  0,128,  0, 64,  0,  0,100,190,  0,128,156, 63,  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,  4,  3,  0,  0,  0,  0,  0,  0,
+114,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  3,  3,  0,  0, 26,  0,  0,  0,139,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  4,  3,114,  1,  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,  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, 68, 65, 84, 65, 40, 33,  0,  0,152, 28, 19,  6,  0,  0,  0,  0,184,  0,  0,  0,
+  1,  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,  6,  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,
+100,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  1,  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,240, 65,  0,  0,  0,  0,154,153,153, 62,  0,  0,  0,  0,
+100,  0,  0,  0,154,153,153, 62,100,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -1078,7 +1294,6 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  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,  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,
@@ -1094,6 +1309,7 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  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,  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,  0,  0,  0,
@@ -1208,3816 +1424,2103 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,100,  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,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 83, 78,  0,  0,
-148,  0,  0,  0,184,250,213,  2,193,  0,  0,  0,  1,  0,  0,  0,128,251,213,  2,240,249,213,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 83, 82, 68,101,102, 97,117,108,116,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,216,255,225,  2,240,  2,226,  2, 56,  3,226,  2,  0,  8,226,  2, 96, 89,215,  2,160, 91,215,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,144,  1,228,  2,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  1,  0, 12,  0,  0,  0,  0,  0,  0,  0,148,238, 92,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,216,255,225,  2,194,  0,  0,  0,  1,  0,  0,  0, 32,  0,226,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0, 32,  0,226,  2,194,  0,  0,  0,  1,  0,  0,  0,
-104,  0,226,  2,216,255,225,  2,  0,  0,  0,  0,  0,  0,222,  2,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,104,  0,226,  2,
-194,  0,  0,  0,  1,  0,  0,  0,176,  0,226,  2, 32,  0,226,  2,  0,  0,  0,  0,240,  4,222,  2,  0,  0,  0,  0, 68, 65, 84, 65,
- 20,  0,  0,  0,176,  0,226,  2,194,  0,  0,  0,  1,  0,  0,  0,248,  0,226,  2,104,  0,226,  2,  0,  0,  0,  0,240,  4,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,248,  0,226,  2,194,  0,  0,  0,  1,  0,  0,  0, 64,  1,226,  2,176,  0,226,  2,
-  0,  0,  0,  0,  0,  0,195,  2,  1,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0, 64,  1,226,  2,194,  0,  0,  0,  1,  0,  0,  0,
-136,  1,226,  2,248,  0,226,  2,  0,  0,  0,  0,240,  4,195,  2,  1,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,136,  1,226,  2,
-194,  0,  0,  0,  1,  0,  0,  0,208,  1,226,  2, 64,  1,226,  2,  0,  0,  0,  0, 36,  4,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 20,  0,  0,  0,208,  1,226,  2,194,  0,  0,  0,  1,  0,  0,  0, 24,  2,226,  2,136,  1,226,  2,  0,  0,  0,  0, 36,  4,195,  2,
-  1,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0, 24,  2,226,  2,194,  0,  0,  0,  1,  0,  0,  0, 96,  2,226,  2,208,  1,226,  2,
-  0,  0,  0,  0, 36,  4, 84,  2,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0, 96,  2,226,  2,194,  0,  0,  0,  1,  0,  0,  0,
-168,  2,226,  2, 24,  2,226,  2,  0,  0,  0,  0,240,  4, 84,  2,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,168,  2,226,  2,
-194,  0,  0,  0,  1,  0,  0,  0,240,  2,226,  2, 96,  2,226,  2,  0,  0,  0,  0,  0,  0, 84,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 20,  0,  0,  0,240,  2,226,  2,194,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,168,  2,226,  2,  0,  0,  0,  0, 36,  4, 84,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 56,  3,226,  2,195,  0,  0,  0,  1,  0,  0,  0,128,  3,226,  2,  0,  0,  0,  0,
- 32,  0,226,  2,104,  0,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,128,  3,226,  2,195,  0,  0,  0,
-  1,  0,  0,  0,200,  3,226,  2, 56,  3,226,  2, 32,  0,226,  2,248,  0,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 24,  0,  0,  0,200,  3,226,  2,195,  0,  0,  0,  1,  0,  0,  0, 16,  4,226,  2,128,  3,226,  2,104,  0,226,  2, 64,  1,226,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 16,  4,226,  2,195,  0,  0,  0,  1,  0,  0,  0, 88,  4,226,  2,
-200,  3,226,  2,248,  0,226,  2, 64,  1,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 88,  4,226,  2,
-195,  0,  0,  0,  1,  0,  0,  0,160,  4,226,  2, 16,  4,226,  2,216,255,225,  2,136,  1,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 24,  0,  0,  0,160,  4,226,  2,195,  0,  0,  0,  1,  0,  0,  0,232,  4,226,  2, 88,  4,226,  2,176,  0,226,  2,
-136,  1,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,232,  4,226,  2,195,  0,  0,  0,  1,  0,  0,  0,
- 48,  5,226,  2,160,  4,226,  2,248,  0,226,  2,208,  1,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,
- 48,  5,226,  2,195,  0,  0,  0,  1,  0,  0,  0,120,  5,226,  2,232,  4,226,  2, 64,  1,226,  2,208,  1,226,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,120,  5,226,  2,195,  0,  0,  0,  1,  0,  0,  0,192,  5,226,  2, 48,  5,226,  2,
-136,  1,226,  2, 24,  2,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,192,  5,226,  2,195,  0,  0,  0,
-  1,  0,  0,  0,  8,  6,226,  2,120,  5,226,  2,208,  1,226,  2, 24,  2,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 24,  0,  0,  0,  8,  6,226,  2,195,  0,  0,  0,  1,  0,  0,  0, 80,  6,226,  2,192,  5,226,  2, 64,  1,226,  2, 96,  2,226,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 80,  6,226,  2,195,  0,  0,  0,  1,  0,  0,  0,152,  6,226,  2,
-  8,  6,226,  2,176,  0,226,  2, 96,  2,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,152,  6,226,  2,
-195,  0,  0,  0,  1,  0,  0,  0,224,  6,226,  2, 80,  6,226,  2, 24,  2,226,  2, 96,  2,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 24,  0,  0,  0,224,  6,226,  2,195,  0,  0,  0,  1,  0,  0,  0, 40,  7,226,  2,152,  6,226,  2,216,255,225,  2,
-168,  2,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 40,  7,226,  2,195,  0,  0,  0,  1,  0,  0,  0,
-112,  7,226,  2,224,  6,226,  2,248,  0,226,  2,168,  2,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,
-112,  7,226,  2,195,  0,  0,  0,  1,  0,  0,  0,184,  7,226,  2, 40,  7,226,  2,208,  1,226,  2,240,  2,226,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,184,  7,226,  2,195,  0,  0,  0,  1,  0,  0,  0,  0,  8,226,  2,112,  7,226,  2,
-136,  1,226,  2,240,  2,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,  0,  8,226,  2,195,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,184,  7,226,  2,168,  2,226,  2,240,  2,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 96,  0,  0,  0, 96, 89,215,  2,197,  0,  0,  0,  1,  0,  0,  0,240, 89,215,  2,  0,  0,  0,  0,248,  0,226,  2, 32,  0,226,  2,
-104,  0,226,  2, 64,  1,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,240,  4,  0,  0,196,  2,  0,  0,222,  2,  0,  0,  7,  7,241,  4,
- 27,  0,  1,  0,  0,  0,  0,  0,  7,  0,  8,  0,136,129,206,  2,152,233,220,  2,152,233,220,  2, 24, 30,226,  2, 64, 31,226,  2,
-  0,  0,  0,  0,  0,  0,  0,  0,184,231,220,  2, 24,232,220,  2, 68, 65, 84, 65,248,  0,  0,  0, 24, 30,226,  2,198,  0,  0,  0,
-  1,  0,  0,  0, 64, 31,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,148, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,
-  0, 32,158, 68,  0,  0,  0,  0,  0,  0,208, 65,  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,240,  4,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,158, 68,
-  0,  0,200, 65,  0,  0,158, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0,
- 10,  0,241,  4, 26,  0,241,  4, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  4,  0,  0,
-196,  2,  0,  0,221,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,241,  4, 26,  0,  2,  0,  1,  0,
-  2,  0,  0,  0,  0,  0,  0,  0,  0,  0, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 64,206,  2, 40,133,  4,  4,
- 40,133,  4,  4,  0,  0,  0,  0,  0,  0,  0,  0,184, 59,  6,  4, 80, 58,  6,  4,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
-248,  0,  0,  0, 64, 31,226,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 24, 30,226,  2,  0,  0,  0,  0,  0,240,109, 69,
-  0,  0,128,192,  0,  0,  0,  0,  0,  0,  0,  0,255,255,237, 68,  0,  0,  0,  0,  0,  0,  0, 64,112,  7,  0,  0,129,  7,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,111,  7,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,111,  7,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  2,  0,  0,  0,  1,  0,  3,  3,  2,  0,  0,  4, 10,  0,129,  7,  2,  0,112,  7,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,222,  2,  0,  0,222,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,144, 63,206,  2,  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, 68, 65, 84, 65, 96,  0,  0,  0,240, 89,215,  2,197,  0,  0,  0,  1,  0,  0,  0,128, 90,215,  2,
- 96, 89,215,  2,136,  1,226,  2, 24,  2,226,  2, 96,  2,226,  2,176,  0,226,  2,  0,  0,  0,  0, 37,  4,  0,  0,240,  4,  0,  0,
-  0,  0,  0,  0, 83,  2,  0,  0,  4,  4,204,  0, 84,  2,  1,  0,  0,  0,  0,  0,  0,  0,  8,  0,168,127,206,  2,160,155,226,  2,
-160,155,226,  2,104, 32,226,  2,144, 33,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,152,230,220,  2, 88,231,220,  2, 68, 65, 84, 65,
-248,  0,  0,  0,104, 32,226,  2,198,  0,  0,  0,  1,  0,  0,  0,144, 33,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,148, 67,
-  0,  0,  0,  0,  0,  0,208, 65, 64, 33, 68, 55,  0,  0, 76, 67,  0,  0,  0,  0,  0,  0,208, 65,  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,203,  0,  0,  0,
-  0,  0,  0,  0, 25,  0,  0,  0,  0,  0, 75, 67,  0,  0,200, 65,  0,  0, 75, 67,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,204,  0, 26,  0,204,  0, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 37,  4,  0,  0,240,  4,  0,  0, 58,  2,  0,  0, 83,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,204,  0, 26,  0,  3,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0, 63,206,  2,208, 80,  8,  4,208, 80,  8,  4,  0,  0,  0,  0,  0,  0,  0,  0,216, 57,  6,  4,112, 56,  6,  4,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,144, 33,226,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-104, 32,226,  2,  0,  0,  0,  0,  0,  0, 75, 67,  0,  0, 61,196,  0,  0,  0,  0,  0,  0,  0,  0,255,255, 58, 67,255,127, 14,196,
-  0,  0,  0,  0,187,  0,  0,  0,204,  0,  0,  0,  0,  0,  0,  0, 57,  2,  0,  0,  0,  0,  0,  0, 74,  1,  0,  0,  0,  0,  0,  0,
- 17,  0,  0,  0,  0,  0,  0,  0,186,  0,  0,  0,  0,  0,  0,  0, 57,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  1,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,204,  0, 58,  2,187,  0,
- 58,  2,  0,  0,  8,104,244,  3,  1,  0,  0,  0,  0,  0,  0,  0, 37,  4,  0,  0,240,  4,  0,  0,  0,  0,  0,  0, 57,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,204,  0, 58,  2,  4,  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,112, 62,206,  2,152, 71,  8,  4, 16, 66,  8,  4, 40, 63,226,  2,
- 32,128,226,  2,248, 55,  6,  4,144, 54,  6,  4,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 64,  1,  0,  0, 40, 63,226,  2,
-196,  0,  0,  0,  1,  0,  0,  0,160, 64,226,  2,  0,  0,  0,  0,104,128,206,  2,  0,  0,  0,  0, 66, 85, 84, 84, 79, 78, 83, 95,
- 80, 84, 95, 99,111,110,116,101,120,116,  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, 66, 85, 84, 84, 79, 78, 83, 95,
- 80, 84, 95, 99,111,110,116,101,120,116,  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, 67,111,110,116,101,120,116,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,220,255,186,  0, 36,  0,
-  0,  0,  0,  0,  0,  0, 38,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,160, 64,226,  2,196,  0,  0,  0,  1,  0,  0,  0, 24, 66,226,  2,
- 40, 63,226,  2,208,  0,222,  2,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,114,101,110,100,101,114,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,114,101,110,100,101,114,  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, 82,101,110,100,101,114,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,135,255,186,  0, 61,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,
-  7,  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,  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, 68, 65, 84, 65,
- 64,  1,  0,  0, 24, 66,226,  2,196,  0,  0,  0,  1,  0,  0,  0,144, 67,226,  2,160, 64,226,  2,248,  1,222,  2,  0,  0,  0,  0,
- 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,108, 97,121,101,114,115,  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,
- 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,108, 97,121,101,114,115,  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,
- 76, 97,121,101,114,115,  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,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,111,255,186,  0,  0,  0,  0,  0,  0,  0,  4,  0,  6,  0,  0,  0,  0,  0,  8,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,144, 67,226,  2,196,  0,  0,  0,
-  1,  0,  0,  0,  8, 69,226,  2, 24, 66,226,  2, 32,  3,222,  2,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,100,105,
-109,101,110,115,105,111,110,115,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,100,105,
-109,101,110,115,105,111,110,115,  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, 68,105,109,101,110,115,105,111,110,115,  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,  0,  0,  0,  0,  0,  0,140,254,186,  0,203,  0,  0,  0,  0,  0,
-  0,  0,  6,  0,  0,  0,  0,  0,  9,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,  8, 69,226,  2,196,  0,  0,  0,  1,  0,  0,  0,128, 70,226,  2,144, 67,226,  2,
- 72,  4,222,  2,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 97,110,116,105, 97,108,105, 97,115,105,110,103,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 97,110,116,105, 97,108,105, 97,115,105,110,103,  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, 65,110,116,105, 45, 65,108,105, 97,115,105,110,103,  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,  0,  0,  0, 58,254,186,  0, 58,  0, 20,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0, 10,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,
-128, 70,226,  2,196,  0,  0,  0,  1,  0,  0,  0,248, 71,226,  2,  8, 69,226,  2, 80, 78,217,  2,  0,  0,  0,  0, 82, 69, 78, 68,
- 69, 82, 95, 80, 84, 95,109,111,116,105,111,110, 95, 98,108,117,114,  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, 82, 69, 78, 68,
- 69, 82, 95, 80, 84, 95,109,111,116,105,111,110, 95, 98,108,117,114,  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, 83, 97,109,112,
-108,101,100, 32, 77,111,116,105,111,110, 32, 66,108,117,114,  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, 34,254,
-186,  0,  0,  0, 20,  0,  0,  0,  4,  0,  6,  0,  0,  0,  0,  0, 11,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,248, 71,226,  2,196,  0,  0,  0,  1,  0,  0,  0,
-112, 73,226,  2,128, 70,226,  2,120, 79,217,  2,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,104, 97,100,105,110,
-103,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,104, 97,100,105,110,
-103,  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, 83,104, 97,100,105,110,103,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,254,186,  0,  0,  0,  0,  0,  0,  0,  4,  0,  6,  0,
-  0,  0,  0,  0, 12,  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,  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,
- 68, 65, 84, 65, 64,  1,  0,  0,112, 73,226,  2,196,  0,  0,  0,  1,  0,  0,  0,232, 74,226,  2,248, 71,226,  2,160, 80,217,  2,
-  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,101,114,102,111,114,109, 97,110, 99,101,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,101,114,102,111,114,109, 97,110, 99,101,  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, 80,101,114,102,111,114,109, 97,110, 99,101,  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,  0,  0,  0,  0,  0,242,253,186,  0,  0,  0,  0,  0,  0,  0,  4,  0,  6,  0,  0,  0,  0,  0, 13,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,232, 74,226,  2,
-196,  0,  0,  0,  1,  0,  0,  0, 96, 76,226,  2,112, 73,226,  2,200, 81,217,  2,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80,
- 84, 95,112,111,115,116, 95,112,114,111, 99,101,115,115,105,110,103,  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, 82, 69, 78, 68, 69, 82, 95, 80,
- 84, 95,112,111,115,116, 95,112,114,111, 99,101,115,115,105,110,103,  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, 80,111,115,116, 32, 80,114,111,
- 99,101,115,115,105,110,103,  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,  0,218,253,186,  0,  0,  0,
-  0,  0,  0,  0,  4,  0,  6,  0,  0,  0,  0,  0, 14,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0, 96, 76,226,  2,196,  0,  0,  0,  1,  0,  0,  0,216, 77,226,  2,
-232, 74,226,  2,240, 82,217,  2,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,116, 97,109,112,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,116, 97,109,112,  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, 83,116, 97,109,112,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,194,253,186,  0,  0,  0, 20,  0,  0,  0,  4,  0,  6,  0,  0,  0,  0,  0,
- 15,  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,  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, 68, 65, 84, 65,
- 64,  1,  0,  0,216, 77,226,  2,196,  0,  0,  0,  1,  0,  0,  0, 80, 79,226,  2, 96, 76,226,  2, 24, 84,217,  2,  0,  0,  0,  0,
- 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,111,117,116,112,117,116,  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,
- 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,111,117,116,112,117,116,  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,
- 79,117,116,112,117,116,  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,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0, 40,253,186,  0,130,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0, 16,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0, 80, 79,226,  2,196,  0,  0,  0,
-  1,  0,  0,  0,200, 80,226,  2,216, 77,226,  2,104, 86,217,  2,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 98, 97,
-107,101,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 98, 97,
-107,101,  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, 66, 97,107,101,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16,253,186,  0,  0,  0,  0,  0,  0,  0,
-  4,  0,  7,  0,  0,  0,  0,  0, 17,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,200, 80,226,  2,196,  0,  0,  0,  1,  0,  0,  0, 64, 82,226,  2, 80, 79,226,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 83, 67, 69, 78, 69, 95, 80, 84, 95,115, 99,101,110,101,  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, 83, 67, 69, 78, 69, 95, 80, 84, 95,115, 99,101,110,101,  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, 83, 99,101,110,101,  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,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,135,255, 41,  1, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,
- 64, 82,226,  2,196,  0,  0,  0,  1,  0,  0,  0,184,123,226,  2,200, 80,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 83, 67, 69, 78,
- 69, 95, 80, 84, 95,117,110,105,116,  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,  0, 83, 67, 69, 78,
- 69, 95, 80, 84, 95,117,110,105,116,  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,  0, 85,110,105,116,
-115,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 28,255,
- 41,  1, 83,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,184,123,226,  2,196,  0,  0,  0,  1,  0,  0,  0,
- 48,125,226,  2, 64, 82,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 83, 67, 69, 78, 69, 95, 80, 84, 95,107,101,121,105,110,103, 95,
-115,101,116,115,  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, 83, 67, 69, 78, 69, 95, 80, 84, 95,107,101,121,105,110,103, 95,
-115,101,116,115,  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, 75,101,121,105,110,103, 32, 83,101,116,115,  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,  0,  0,  0,  0,  0,191,254, 41,  1, 69,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  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,  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,
- 68, 65, 84, 65, 64,  1,  0,  0, 48,125,226,  2,196,  0,  0,  0,  1,  0,  0,  0,168,126,226,  2,184,123,226,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 83, 67, 69, 78, 69, 95, 80, 84, 95,112,104,121,115,105, 99,115,  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, 83, 67, 69, 78, 69, 95, 80, 84, 95,112,104,121,115,105, 99,115,  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, 71,114, 97,118,105,116,121,  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,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,131,254, 41,  1, 36,  0, 20,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,168,126,226,  2,
-196,  0,  0,  0,  1,  0,  0,  0, 32,128,226,  2, 48,125,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 83, 67, 69, 78, 69, 95, 80, 84,
- 95,115,105,109,112,108,105,102,121,  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, 83, 67, 69, 78, 69, 95, 80, 84,
- 95,115,105,109,112,108,105,102,121,  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, 83,105,109,112,108,105,102,121,
   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,  0,  0,  0,  0,  0,  0,  0,  0, 27,254, 41,  1, 80,  0,
- 20,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0, 32,128,226,  2,196,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-168,126,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 83, 67, 69, 78, 69, 95, 80, 84, 95, 99,117,115,116,111,109, 95,112,114,111,112,
-115,  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, 83, 67, 69, 78, 69, 95, 80, 84, 95, 99,117,115,116,111,109, 95,112,114,111,112,
-115,  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, 67,117,115,116,111,109, 32, 80,114,111,112,101,114,116,105,101,115,  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,223,253, 41,  1, 36,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
-  6,  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,  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, 68, 65, 84, 65,
-216,  0,  0,  0,160,155,226,  2,162,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  4,  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,  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,  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,  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,  2,  0,  1,  0,  0,  0,  0,  0, 80,154,252,  3,255, 21,  0,  0,
-160,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 96,  0,  0,  0,128, 90,215,  2,197,  0,  0,  0,  1,  0,  0,  0, 16, 91,215,  2,
-240, 89,215,  2,216,255,225,  2,168,  2,226,  2,240,  2,226,  2,136,  1,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 35,  4,  0,  0,
-  0,  0,  0,  0, 83,  0,  0,  0, 15, 15, 36,  4, 84,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0, 88,107,206,  2,168,156,226,  2,
-168,156,226,  2,184, 34,226,  2,224, 35,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,200, 80,  6,  4, 32,122, 10,  4, 68, 65, 84, 65,
-248,  0,  0,  0,184, 34,226,  2,198,  0,  0,  0,  1,  0,  0,  0,224, 35,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32,140, 68,
-  0,  0,  0,  0,  0,  0,208, 65,220,123,132, 55,  0,128,132, 68,  0,  0,  0,  0,  0,  0,208, 65,  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, 35,  4,  0,  0,
-  0,  0,  0,  0, 25,  0,  0,  0,  0, 96,132, 68,  0,  0,200, 65,  0, 96,132, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 36,  4, 26,  0, 36,  4, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 35,  4,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 36,  4, 26,  0,  5,  0,  1,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,224, 52,206,  2, 32, 77,  8,  4, 32, 77,  8,  4,  0,  0,  0,  0,  0,  0,  0,  0, 24, 54,  6,  4,168, 60,  6,  4,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,224, 35,226,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-184, 34,226,  2,  0,  0, 64,192,  0,  0,126, 67,  0,  0,  0,  0,  0,  0, 72, 66, 88,218,103,194, 40,147,141, 67,  0,  0,  0,  0,
-  0,  0, 72, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 35,  4,  0,  0,  0,  0,  0,  0,
- 17,  0,  0,  0,  0,  0,  0,  0, 35,  4,  0,  0, 18,  0,  0,  0, 57,  0,  0,  0,  0,  0,128, 63,  0,  0, 72, 66,  0,124,146, 72,
-  0,  0, 72, 66,205,204,204, 61,  0,  0, 32, 65, 72,  0,  0,  0,  0,  0,  0,  2,  4,  0,  0,  4,  8,  0, 36,  4, 58,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 35,  4,  0,  0, 26,  0,  0,  0, 83,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 36,  4, 58,  0,  6,  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, 80, 52,206,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,152, 61,  6,  4,120, 63,  6,  4,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,188,  0,  0,  0,168,156,226,  2,
-173,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 15,  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,  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,  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,  0,  0,  0,  0,  0, 31,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-  6,  0,  0,  0, 68, 65, 84, 65, 96,  0,  0,  0, 16, 91,215,  2,197,  0,  0,  0,  1,  0,  0,  0,160, 91,215,  2,128, 90,215,  2,
- 24,  2,226,  2,208,  1,226,  2, 64,  1,226,  2, 96,  2,226,  2,  0,  0,  0,  0, 37,  4,  0,  0,240,  4,  0,  0, 85,  2,  0,  0,
-194,  2,  0,  0,  3,  3,204,  0,110,  0,  1,  0,  0,  0,  0,  0,  0,  0,  8,  0,152,106,206,  2, 88, 39,226,  2, 88, 39,226,  2,
-  8, 37,226,  2, 48, 38,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,192, 34,220,  3,  0, 34,220,  3, 68, 65, 84, 65,248,  0,  0,  0,
-  8, 37,226,  2,198,  0,  0,  0,  1,  0,  0,  0, 48, 38,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,244, 67,  0,  0,  0,  0,
-  0,  0,208, 65, 48, 39, 68, 55,  0,  0, 76, 67,  0,  0,  0,  0,  0,  0,208, 65,  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,203,  0,  0,  0,  0,  0,  0,  0,
- 25,  0,  0,  0,  0,  0, 75, 67,  0,  0,200, 65,  0,  0, 75, 67,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,204,  0, 26,  0,204,  0, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 37,  4,  0,  0,240,  4,  0,  0,169,  2,  0,  0,194,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-204,  0, 26,  0,  7,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-192, 51,206,  2,216, 56,  8,  4,216, 56,  8,  4,  0,  0,  0,  0,  0,  0,  0,  0,240, 63,  6,  4, 88, 65,  6,  4,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0, 48, 38,226,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  8, 37,226,  2,
-  0,  0,  0,  0,  0,128,141, 67,  0,  0,244,194,  0,  0,  0,  0, 19,  0,  0, 64,  0,  0, 61, 67,  0,  0,185,194,  0,  0,212,193,
-187,  0,  0,  0,204,  0,  0,  0, 18,  0,  0,  0, 83,  0,  0,  0,  0,  0,  0,  0,186,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,
-  0,  0,  0,  0,186,  0,  0,  0, 18,  0,  0,  0, 83,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63, 18,  0,  0,  0,  2,  0,  3,  3,  0,  0, 12,  4,  6,  0,204,  0, 84,  0,187,  0, 66,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 37,  4,  0,  0,240,  4,  0,  0, 85,  2,  0,  0,168,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,204,  0, 84,  0,  8,  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, 48, 51,206,  2,112, 73,  8,  4,112, 73,  8,  4,  0,  0,  0,  0,  0,  0,  0,  0,
-208, 65,  6,  4,192, 66,  6,  4,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,244,  0,  0,  0, 88, 39,226,  2,166,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72,171,  5,  4, 72,171,  5,  4,
-112,237,205,  2,  0,115,101, 32, 83, 99,117,108,112,116,  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,  1,  0,  0,  0, 68, 65, 84, 65, 12,  0,  0,  0,
-112,237,205,  2,221,  0,  0,  0,  1,  0,  0,  0, 42, 11,  0,  0, 42, 11,  0,  0,152,157,226,  2, 68, 65, 84, 65,248,133,  0,  0,
-152,157,226,  2,220,  0,  0,  0, 42, 11,  0,  0,  0,  0,  0,  0,  2,  0,  1,  0,144,  1,228,  2, 19,  0,  0,  0,  1,  0,  1,  0,
-144,  1,228,  2, 20,  0,  0,  0,  1,  0,  1,  0,144,  1,228,  2, 21,  0,  1,  0,  1,  0,  0,  0,144,  1,228,  2,  0,  0,  0,  0,
-  1,  0,  1,  0,240, 10,228,  2,  0,  0,  0,  0,  1,  0,  1,  0,240, 16,228,  2,  0,  0,  0,  0,  1,  0,  1,  0,144, 30,221,  2,
-  0,  0,  0,  0,  1,  0,  1,  0, 32, 26,228,  2,  0,  0,  0,  0,  1,  0,  1,  0,  8, 97,223,  2,  0,  0,  0,  0,  1,  0,  1,  0,
-192, 21,228,  2,  0,  0,  0,  0,  1,  0,  1,  0, 80,  9,228,  2,  0,  0,  0,  0,  1,  0,  1,  0,144, 12,228,  2,  0,  0,  0,  0,
-  1,  0,  1,  0,184,  8,228,  2, 21,  0,  0,  0,  1,  0,  1,  0,144,  1,228,  2, 30,  0,255,255,  1,  0,  0,  0,144,  1,228,  2,
- 31,  0,  0,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0,  1,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0,  2,  0,  1,  0,  0,  0,
-144,  1,228,  2, 31,  0,  3,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0,  4,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0,  5,  0,
-  1,  0,  0,  0,144,  1,228,  2, 31,  0,  6,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0,  7,  0,  1,  0,  0,  0,144,  1,228,  2,
- 31,  0,  8,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0,  9,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 10,  0,  1,  0,  0,  0,
-144,  1,228,  2, 31,  0, 11,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 12,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 13,  0,
-  1,  0,  0,  0,144,  1,228,  2, 31,  0, 14,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 15,  0,  1,  0,  0,  0,144,  1,228,  2,
- 31,  0, 16,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 17,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 18,  0,  1,  0,  0,  0,
-144,  1,228,  2, 31,  0, 19,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 20,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 21,  0,
-  1,  0,  0,  0,144,  1,228,  2, 31,  0, 22,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 23,  0,  1,  0,  0,  0,144,  1,228,  2,
- 31,  0, 24,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 25,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 26,  0,  1,  0,  0,  0,
-144,  1,228,  2, 31,  0, 27,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 28,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 29,  0,
-  1,  0,  0,  0,144,  1,228,  2, 31,  0, 30,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 31,  0,  1,  0,  0,  0,144,  1,228,  2,
- 31,  0, 32,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 33,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 34,  0,  1,  0,  0,  0,
-144,  1,228,  2, 31,  0, 35,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 36,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 37,  0,
-  1,  0,  0,  0,144,  1,228,  2, 31,  0, 38,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 39,  0,  1,  0,  0,  0,144,  1,228,  2,
- 31,  0, 40,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 41,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 42,  0,  1,  0,  0,  0,
-144,  1,228,  2, 31,  0, 43,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 44,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 45,  0,
-  1,  0,  0,  0,144,  1,228,  2, 31,  0, 46,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 47,  0,  1,  0,  0,  0,144,  1,228,  2,
- 31,  0, 48,  0,  1,  0,  0,  0,144,  1,228,  2, 30,  0,255,255,  1,  0,  0,  0,144,  1,228,  2, 31,  0,  0,  0,  1,  0,  0,  0,
-144,  1,228,  2, 31,  0,  1,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0,  2,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0,  3,  0,
-  1,  0,  0,  0,144,  1,228,  2, 31,  0,  4,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0,  5,  0,  1,  0,  0,  0,144,  1,228,  2,
- 31,  0,  6,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0,  7,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0,  8,  0,  1,  0,  0,  0,
-144,  1,228,  2, 31,  0,  9,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 10,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 11,  0,
-  1,  0,  0,  0,144,  1,228,  2, 31,  0, 12,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 13,  0,  1,  0,  0,  0,144,  1,228,  2,
- 31,  0, 14,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 15,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 16,  0,  1,  0,  0,  0,
-144,  1,228,  2, 31,  0, 17,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 18,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 19,  0,
-  1,  0,  0,  0,144,  1,228,  2, 31,  0, 20,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 21,  0,  1,  0,  0,  0,144,  1,228,  2,
- 31,  0, 22,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 23,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 24,  0,  1,  0,  0,  0,
-144,  1,228,  2, 31,  0, 25,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 26,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 27,  0,
-  1,  0,  0,  0,144,  1,228,  2, 31,  0, 28,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 29,  0,  1,  0,  0,  0,144,  1,228,  2,
- 31,  0, 30,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 31,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 32,  0,  1,  0,  0,  0,
-144,  1,228,  2, 31,  0, 33,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 34,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 35,  0,
-  1,  0,  0,  0,144,  1,228,  2, 31,  0, 36,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 37,  0,  1,  0,  0,  0,144,  1,228,  2,
- 31,  0, 38,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 39,  0,  1,  0,  0,  0,144,  1,228,  2, 31,  0, 40,  0,  1,  0,  0,  0,
-144,  1,228,  2, 30,  0,255,255,  1,  0,  0,  0, 80, 99,229,  2, 30,  0,255,255,  1,  0,  0,  0, 80,102,229,  2, 30,  0,255,255,
-  1,  0,  0,  0, 80,105,229,  2, 30,  0,255,255,  1,  0,  0,  0, 80,108,229,  2, 30,  0,255,255,  1,  0,  0,  0, 80,143,229,  2,
- 30,  0,255,255,  1,  0,  0,  0, 80,146,229,  2, 30,  0,255,255,  1,  0,  0,  0, 80,149,229,  2, 30,  0,255,255,  1,  0,  0,  0,
- 80,152,229,  2, 30,  0,255,255,  1,  0,  0,  0, 80,155,229,  2, 30,  0,255,255,  1,  0,  0,  0, 80,158,229,  2, 30,  0,255,255,
-  1,  0,  0,  0, 80,161,229,  2, 30,  0,255,255,  1,  0,  0,  0, 80,164,229,  2, 30,  0,255,255,  1,  0,  0,  0, 80,167,229,  2,
- 30,  0,255,255,  1,  0,  0,  0, 80,170,229,  2, 30,  0,255,255,  1,  0,  0,  0, 80,173,229,  2, 30,  0,255,255,  1,  0,  0,  0,
- 80,176,229,  2, 30,  0,255,255,  1,  0,  0,  0, 80,179,229,  2, 30,  0,255,255,  1,  0,  0,  0,104,182,229,  2, 30,  0,255,255,
-  1,  0,  0,  0,112,185,229,  2, 30,  0,255,255,  1,  0,  0,  0,120,188,229,  2, 30,  0,255,255,  1,  0,  0,  0,128,191,229,  2,
- 30,  0,255,255,  1,  0,  0,  0,136,194,229,  2, 30,  0,255,255,  1,  0,  0,  0,144,197,229,  2, 30,  0,255,255,  1,  0,  0,  0,
-152,200,229,  2, 30,  0,255,255,  1,  0,  0,  0,160,203,229,  2, 30,  0,255,255,  1,  0,  0,  0,168,206,229,  2, 30,  0,255,255,
-  1,  0,  0,  0,176,209,229,  2, 30,  0,255,255,  1,  0,  0,  0,184,212,229,  2, 30,  0,255,255,  1,  0,  0,  0,192,215,229,  2,
- 30,  0,255,255,  1,  0,  0,  0,200,218,229,  2, 31,  0,  0,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0,  1,  0,  1,  0,  0,  0,
- 80, 99,229,  2, 31,  0,  2,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0,  3,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0,  4,  0,
-  1,  0,  0,  0, 80, 99,229,  2, 31,  0,  5,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0,  6,  0,  1,  0,  0,  0, 80, 99,229,  2,
- 31,  0,  7,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0,  8,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0,  9,  0,  1,  0,  0,  0,
- 80, 99,229,  2, 31,  0, 10,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 11,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 12,  0,
-  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 13,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 14,  0,  1,  0,  0,  0, 80, 99,229,  2,
- 31,  0, 15,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 16,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 17,  0,  1,  0,  0,  0,
- 80, 99,229,  2, 31,  0, 18,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 19,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 20,  0,
-  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 21,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 22,  0,  1,  0,  0,  0, 80, 99,229,  2,
- 31,  0, 23,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 24,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 25,  0,  1,  0,  0,  0,
- 80, 99,229,  2, 31,  0, 26,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 27,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 28,  0,
-  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 29,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 30,  0,  1,  0,  0,  0, 80, 99,229,  2,
- 31,  0, 31,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 32,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 33,  0,  1,  0,  0,  0,
- 80, 99,229,  2, 31,  0, 34,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 35,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 36,  0,
-  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 37,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 38,  0,  1,  0,  0,  0, 80, 99,229,  2,
- 31,  0, 39,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 40,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 41,  0,  1,  0,  0,  0,
- 80, 99,229,  2, 31,  0, 42,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 43,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 44,  0,
-  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 45,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 46,  0,  1,  0,  0,  0, 80, 99,229,  2,
- 31,  0, 47,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 48,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 49,  0,  1,  0,  0,  0,
- 80, 99,229,  2, 31,  0, 50,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 51,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 52,  0,
-  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 53,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 54,  0,  1,  0,  0,  0, 80, 99,229,  2,
- 31,  0, 55,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 56,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 57,  0,  1,  0,  0,  0,
- 80, 99,229,  2, 31,  0, 58,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 59,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 60,  0,
-  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 61,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 62,  0,  1,  0,  0,  0, 80, 99,229,  2,
- 31,  0, 63,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 64,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 65,  0,  1,  0,  0,  0,
- 80, 99,229,  2, 31,  0, 66,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 67,  0,  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 68,  0,
-  1,  0,  0,  0, 80, 99,229,  2, 31,  0, 69,  0,  1,  0,  0,  0, 80, 99,229,  2, 30,  0,255,255,  1,  0,  0,  0,184,  8,228,  2,
- 30,  0,255,255,  1,  0,  0,  0, 80,  9,228,  2, 30,  0,255,255,  1,  0,  0,  0, 32, 26,228,  2, 30,  0,255,255,  1,  0,  0,  0,
-144, 30,221,  2, 30,  0,255,255,  3,  0,  0,  0,144, 12,228,  2, 30,  0,255,255,  1,  0,  0,  0,240, 16,228,  2, 30,  0,255,255,
-  1,  0,  0,  0,192, 21,228,  2, 30,  0,255,255,  1,  0,  0,  0, 40,249,213,  2, 30,  0,255,255,  1,  0,  0,  0,240,249,213,  2,
- 30,  0,255,255,  1,  0,  0,  0,184,250,213,  2, 30,  0,255,255,  1,  0,  0,  0,128,251,213,  2, 30,  0,255,255,  1,  0,  0,  0,
- 72,252,213,  2, 30,  0,255,255,  1,  0,  0,  0, 16,253,213,  2, 30,  0,255,255,  1,  0,  0,  0,216,253,213,  2, 30,  0,255,255,
-  1,  0,  0,  0,  8, 97,223,  2, 30,  0,255,255,  1,  0,  0,  0, 64,192,225,  2, 30,  0,255,255,  1,  0,  0,  0,240, 10,228,  2,
- 31,  0,  0,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0,  1,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0,  2,  0,  1,  0,  0,  0,
- 80,102,229,  2, 31,  0,  3,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0,  4,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0,  5,  0,
-  1,  0,  0,  0, 80,102,229,  2, 31,  0,  6,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0,  7,  0,  1,  0,  0,  0, 80,102,229,  2,
- 31,  0,  8,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0,  9,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 10,  0,  1,  0,  0,  0,
- 80,102,229,  2, 31,  0, 11,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 12,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 13,  0,
-  1,  0,  0,  0, 80,102,229,  2, 31,  0, 14,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 15,  0,  1,  0,  0,  0, 80,102,229,  2,
- 31,  0, 16,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 17,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 18,  0,  1,  0,  0,  0,
- 80,102,229,  2, 31,  0, 19,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 20,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 21,  0,
-  1,  0,  0,  0, 80,102,229,  2, 31,  0, 22,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 23,  0,  1,  0,  0,  0, 80,102,229,  2,
- 31,  0, 24,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 25,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 26,  0,  1,  0,  0,  0,
- 80,102,229,  2, 31,  0, 27,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 28,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 29,  0,
-  1,  0,  0,  0, 80,102,229,  2, 31,  0, 30,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 31,  0,  1,  0,  0,  0, 80,102,229,  2,
- 31,  0, 32,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 33,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 34,  0,  1,  0,  0,  0,
- 80,102,229,  2, 31,  0, 35,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 36,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 37,  0,
-  1,  0,  0,  0, 80,102,229,  2, 31,  0, 38,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 39,  0,  1,  0,  0,  0, 80,102,229,  2,
- 31,  0, 40,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 41,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 42,  0,  1,  0,  0,  0,
- 80,102,229,  2, 31,  0, 43,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 44,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 45,  0,
-  1,  0,  0,  0, 80,102,229,  2, 31,  0, 46,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 47,  0,  1,  0,  0,  0, 80,102,229,  2,
- 31,  0, 48,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 49,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 50,  0,  1,  0,  0,  0,
- 80,102,229,  2, 31,  0, 51,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 52,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 53,  0,
-  1,  0,  0,  0, 80,102,229,  2, 31,  0, 54,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 55,  0,  1,  0,  0,  0, 80,102,229,  2,
- 31,  0, 56,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 57,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 58,  0,  1,  0,  0,  0,
- 80,102,229,  2, 31,  0, 59,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 60,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 61,  0,
-  1,  0,  0,  0, 80,102,229,  2, 31,  0, 62,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 63,  0,  1,  0,  0,  0, 80,102,229,  2,
- 31,  0, 64,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 65,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 66,  0,  1,  0,  0,  0,
- 80,102,229,  2, 31,  0, 67,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 68,  0,  1,  0,  0,  0, 80,102,229,  2, 31,  0, 69,  0,
-  1,  0,  0,  0, 80,102,229,  2, 31,  0,  0,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0,  1,  0,  1,  0,  0,  0, 80,105,229,  2,
- 31,  0,  2,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0,  3,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0,  4,  0,  1,  0,  0,  0,
- 80,105,229,  2, 31,  0,  5,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0,  6,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0,  7,  0,
-  1,  0,  0,  0, 80,105,229,  2, 31,  0,  8,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0,  9,  0,  1,  0,  0,  0, 80,105,229,  2,
- 31,  0, 10,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 11,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 12,  0,  1,  0,  0,  0,
- 80,105,229,  2, 31,  0, 13,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 14,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 15,  0,
-  1,  0,  0,  0, 80,105,229,  2, 31,  0, 16,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 17,  0,  1,  0,  0,  0, 80,105,229,  2,
- 31,  0, 18,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 19,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 20,  0,  1,  0,  0,  0,
- 80,105,229,  2, 31,  0, 21,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 22,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 23,  0,
-  1,  0,  0,  0, 80,105,229,  2, 31,  0, 24,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 25,  0,  1,  0,  0,  0, 80,105,229,  2,
- 31,  0, 26,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 27,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 28,  0,  1,  0,  0,  0,
- 80,105,229,  2, 31,  0, 29,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 30,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 31,  0,
-  1,  0,  0,  0, 80,105,229,  2, 31,  0, 32,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 33,  0,  1,  0,  0,  0, 80,105,229,  2,
- 31,  0, 34,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 35,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 36,  0,  1,  0,  0,  0,
- 80,105,229,  2, 31,  0, 37,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 38,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 39,  0,
-  1,  0,  0,  0, 80,105,229,  2, 31,  0, 40,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 41,  0,  1,  0,  0,  0, 80,105,229,  2,
- 31,  0, 42,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 43,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 44,  0,  1,  0,  0,  0,
- 80,105,229,  2, 31,  0, 45,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 46,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 47,  0,
-  1,  0,  0,  0, 80,105,229,  2, 31,  0, 48,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 49,  0,  1,  0,  0,  0, 80,105,229,  2,
- 31,  0, 50,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 51,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 52,  0,  1,  0,  0,  0,
- 80,105,229,  2, 31,  0, 53,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 54,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 55,  0,
-  1,  0,  0,  0, 80,105,229,  2, 31,  0, 56,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 57,  0,  1,  0,  0,  0, 80,105,229,  2,
- 31,  0, 58,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 59,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 60,  0,  1,  0,  0,  0,
- 80,105,229,  2, 31,  0, 61,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 62,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 63,  0,
-  1,  0,  0,  0, 80,105,229,  2, 31,  0, 64,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 65,  0,  1,  0,  0,  0, 80,105,229,  2,
- 31,  0, 66,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 67,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0, 68,  0,  1,  0,  0,  0,
- 80,105,229,  2, 31,  0, 69,  0,  1,  0,  0,  0, 80,105,229,  2, 31,  0,  0,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0,  1,  0,
-  1,  0,  0,  0, 80,108,229,  2, 31,  0,  2,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0,  3,  0,  1,  0,  0,  0, 80,108,229,  2,
- 31,  0,  4,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0,  5,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0,  6,  0,  1,  0,  0,  0,
- 80,108,229,  2, 31,  0,  7,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0,  8,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0,  9,  0,
-  1,  0,  0,  0, 80,108,229,  2, 31,  0, 10,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 11,  0,  1,  0,  0,  0, 80,108,229,  2,
- 31,  0, 12,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 13,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 14,  0,  1,  0,  0,  0,
- 80,108,229,  2, 31,  0, 15,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 16,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 17,  0,
-  1,  0,  0,  0, 80,108,229,  2, 31,  0, 18,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 19,  0,  1,  0,  0,  0, 80,108,229,  2,
- 31,  0, 20,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 21,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 22,  0,  1,  0,  0,  0,
- 80,108,229,  2, 31,  0, 23,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 24,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 25,  0,
-  1,  0,  0,  0, 80,108,229,  2, 31,  0, 26,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 27,  0,  1,  0,  0,  0, 80,108,229,  2,
- 31,  0, 28,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 29,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 30,  0,  1,  0,  0,  0,
- 80,108,229,  2, 31,  0, 31,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 32,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 33,  0,
-  1,  0,  0,  0, 80,108,229,  2, 31,  0, 34,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 35,  0,  1,  0,  0,  0, 80,108,229,  2,
- 31,  0, 36,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 37,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 38,  0,  1,  0,  0,  0,
- 80,108,229,  2, 31,  0, 39,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 40,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 41,  0,
-  1,  0,  0,  0, 80,108,229,  2, 31,  0, 42,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 43,  0,  1,  0,  0,  0, 80,108,229,  2,
- 31,  0, 44,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 45,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 46,  0,  1,  0,  0,  0,
- 80,108,229,  2, 31,  0, 47,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 48,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 49,  0,
-  1,  0,  0,  0, 80,108,229,  2, 31,  0, 50,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 51,  0,  1,  0,  0,  0, 80,108,229,  2,
- 31,  0, 52,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 53,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 54,  0,  1,  0,  0,  0,
- 80,108,229,  2, 31,  0, 55,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 56,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 57,  0,
-  1,  0,  0,  0, 80,108,229,  2, 31,  0, 58,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 59,  0,  1,  0,  0,  0, 80,108,229,  2,
- 31,  0, 60,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 61,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 62,  0,  1,  0,  0,  0,
- 80,108,229,  2, 31,  0, 63,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 64,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 65,  0,
-  1,  0,  0,  0, 80,108,229,  2, 31,  0, 66,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 67,  0,  1,  0,  0,  0, 80,108,229,  2,
- 31,  0, 68,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0, 69,  0,  1,  0,  0,  0, 80,108,229,  2, 31,  0,  0,  0,  1,  0,  0,  0,
- 80,143,229,  2, 31,  0,  1,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0,  2,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0,  3,  0,
-  1,  0,  0,  0, 80,143,229,  2, 31,  0,  4,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0,  5,  0,  1,  0,  0,  0, 80,143,229,  2,
- 31,  0,  6,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0,  7,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0,  8,  0,  1,  0,  0,  0,
- 80,143,229,  2, 31,  0,  9,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 10,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 11,  0,
-  1,  0,  0,  0, 80,143,229,  2, 31,  0, 12,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 13,  0,  1,  0,  0,  0, 80,143,229,  2,
- 31,  0, 14,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 15,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 16,  0,  1,  0,  0,  0,
- 80,143,229,  2, 31,  0, 17,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 18,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 19,  0,
-  1,  0,  0,  0, 80,143,229,  2, 31,  0, 20,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 21,  0,  1,  0,  0,  0, 80,143,229,  2,
- 31,  0, 22,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 23,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 24,  0,  1,  0,  0,  0,
- 80,143,229,  2, 31,  0, 25,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 26,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 27,  0,
-  1,  0,  0,  0, 80,143,229,  2, 31,  0, 28,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 29,  0,  1,  0,  0,  0, 80,143,229,  2,
- 31,  0, 30,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 31,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 32,  0,  1,  0,  0,  0,
- 80,143,229,  2, 31,  0, 33,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 34,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 35,  0,
-  1,  0,  0,  0, 80,143,229,  2, 31,  0, 36,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 37,  0,  1,  0,  0,  0, 80,143,229,  2,
- 31,  0, 38,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 39,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 40,  0,  1,  0,  0,  0,
- 80,143,229,  2, 31,  0, 41,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 42,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 43,  0,
-  1,  0,  0,  0, 80,143,229,  2, 31,  0, 44,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 45,  0,  1,  0,  0,  0, 80,143,229,  2,
- 31,  0, 46,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 47,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 48,  0,  1,  0,  0,  0,
- 80,143,229,  2, 31,  0, 49,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 50,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 51,  0,
-  1,  0,  0,  0, 80,143,229,  2, 31,  0, 52,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 53,  0,  1,  0,  0,  0, 80,143,229,  2,
- 31,  0, 54,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 55,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 56,  0,  1,  0,  0,  0,
- 80,143,229,  2, 31,  0, 57,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 58,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 59,  0,
-  1,  0,  0,  0, 80,143,229,  2, 31,  0, 60,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 61,  0,  1,  0,  0,  0, 80,143,229,  2,
- 31,  0, 62,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 63,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 64,  0,  1,  0,  0,  0,
- 80,143,229,  2, 31,  0, 65,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 66,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 67,  0,
-  1,  0,  0,  0, 80,143,229,  2, 31,  0, 68,  0,  1,  0,  0,  0, 80,143,229,  2, 31,  0, 69,  0,  1,  0,  0,  0, 80,143,229,  2,
- 31,  0,  0,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0,  1,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0,  2,  0,  1,  0,  0,  0,
- 80,146,229,  2, 31,  0,  3,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0,  4,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0,  5,  0,
-  1,  0,  0,  0, 80,146,229,  2, 31,  0,  6,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0,  7,  0,  1,  0,  0,  0, 80,146,229,  2,
- 31,  0,  8,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0,  9,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 10,  0,  1,  0,  0,  0,
- 80,146,229,  2, 31,  0, 11,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 12,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 13,  0,
-  1,  0,  0,  0, 80,146,229,  2, 31,  0, 14,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 15,  0,  1,  0,  0,  0, 80,146,229,  2,
- 31,  0, 16,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 17,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 18,  0,  1,  0,  0,  0,
- 80,146,229,  2, 31,  0, 19,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 20,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 21,  0,
-  1,  0,  0,  0, 80,146,229,  2, 31,  0, 22,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 23,  0,  1,  0,  0,  0, 80,146,229,  2,
- 31,  0, 24,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 25,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 26,  0,  1,  0,  0,  0,
- 80,146,229,  2, 31,  0, 27,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 28,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 29,  0,
-  1,  0,  0,  0, 80,146,229,  2, 31,  0, 30,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 31,  0,  1,  0,  0,  0, 80,146,229,  2,
- 31,  0, 32,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 33,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 34,  0,  1,  0,  0,  0,
- 80,146,229,  2, 31,  0, 35,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 36,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 37,  0,
-  1,  0,  0,  0, 80,146,229,  2, 31,  0, 38,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 39,  0,  1,  0,  0,  0, 80,146,229,  2,
- 31,  0, 40,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 41,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 42,  0,  1,  0,  0,  0,
- 80,146,229,  2, 31,  0, 43,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 44,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 45,  0,
-  1,  0,  0,  0, 80,146,229,  2, 31,  0, 46,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 47,  0,  1,  0,  0,  0, 80,146,229,  2,
- 31,  0, 48,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 49,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 50,  0,  1,  0,  0,  0,
- 80,146,229,  2, 31,  0, 51,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 52,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 53,  0,
-  1,  0,  0,  0, 80,146,229,  2, 31,  0, 54,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 55,  0,  1,  0,  0,  0, 80,146,229,  2,
- 31,  0, 56,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 57,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 58,  0,  1,  0,  0,  0,
- 80,146,229,  2, 31,  0, 59,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 60,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 61,  0,
-  1,  0,  0,  0, 80,146,229,  2, 31,  0, 62,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 63,  0,  1,  0,  0,  0, 80,146,229,  2,
- 31,  0, 64,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 65,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 66,  0,  1,  0,  0,  0,
- 80,146,229,  2, 31,  0, 67,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 68,  0,  1,  0,  0,  0, 80,146,229,  2, 31,  0, 69,  0,
-  1,  0,  0,  0, 80,146,229,  2, 31,  0,  0,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0,  1,  0,  1,  0,  0,  0, 80,149,229,  2,
- 31,  0,  2,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0,  3,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0,  4,  0,  1,  0,  0,  0,
- 80,149,229,  2, 31,  0,  5,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0,  6,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0,  7,  0,
-  1,  0,  0,  0, 80,149,229,  2, 31,  0,  8,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0,  9,  0,  1,  0,  0,  0, 80,149,229,  2,
- 31,  0, 10,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 11,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 12,  0,  1,  0,  0,  0,
- 80,149,229,  2, 31,  0, 13,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 14,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 15,  0,
-  1,  0,  0,  0, 80,149,229,  2, 31,  0, 16,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 17,  0,  1,  0,  0,  0, 80,149,229,  2,
- 31,  0, 18,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 19,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 20,  0,  1,  0,  0,  0,
- 80,149,229,  2, 31,  0, 21,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 22,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 23,  0,
-  1,  0,  0,  0, 80,149,229,  2, 31,  0, 24,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 25,  0,  1,  0,  0,  0, 80,149,229,  2,
- 31,  0, 26,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 27,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 28,  0,  1,  0,  0,  0,
- 80,149,229,  2, 31,  0, 29,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 30,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 31,  0,
-  1,  0,  0,  0, 80,149,229,  2, 31,  0, 32,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 33,  0,  1,  0,  0,  0, 80,149,229,  2,
- 31,  0, 34,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 35,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 36,  0,  1,  0,  0,  0,
- 80,149,229,  2, 31,  0, 37,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 38,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 39,  0,
-  1,  0,  0,  0, 80,149,229,  2, 31,  0, 40,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 41,  0,  1,  0,  0,  0, 80,149,229,  2,
- 31,  0, 42,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 43,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 44,  0,  1,  0,  0,  0,
- 80,149,229,  2, 31,  0, 45,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 46,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 47,  0,
-  1,  0,  0,  0, 80,149,229,  2, 31,  0, 48,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 49,  0,  1,  0,  0,  0, 80,149,229,  2,
- 31,  0, 50,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 51,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 52,  0,  1,  0,  0,  0,
- 80,149,229,  2, 31,  0, 53,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 54,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 55,  0,
-  1,  0,  0,  0, 80,149,229,  2, 31,  0, 56,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 57,  0,  1,  0,  0,  0, 80,149,229,  2,
- 31,  0, 58,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 59,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 60,  0,  1,  0,  0,  0,
- 80,149,229,  2, 31,  0, 61,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 62,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 63,  0,
-  1,  0,  0,  0, 80,149,229,  2, 31,  0, 64,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 65,  0,  1,  0,  0,  0, 80,149,229,  2,
- 31,  0, 66,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 67,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0, 68,  0,  1,  0,  0,  0,
- 80,149,229,  2, 31,  0, 69,  0,  1,  0,  0,  0, 80,149,229,  2, 31,  0,  0,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0,  1,  0,
-  1,  0,  0,  0, 80,152,229,  2, 31,  0,  2,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0,  3,  0,  1,  0,  0,  0, 80,152,229,  2,
- 31,  0,  4,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0,  5,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0,  6,  0,  1,  0,  0,  0,
- 80,152,229,  2, 31,  0,  7,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0,  8,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0,  9,  0,
-  1,  0,  0,  0, 80,152,229,  2, 31,  0, 10,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 11,  0,  1,  0,  0,  0, 80,152,229,  2,
- 31,  0, 12,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 13,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 14,  0,  1,  0,  0,  0,
- 80,152,229,  2, 31,  0, 15,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 16,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 17,  0,
-  1,  0,  0,  0, 80,152,229,  2, 31,  0, 18,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 19,  0,  1,  0,  0,  0, 80,152,229,  2,
- 31,  0, 20,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 21,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 22,  0,  1,  0,  0,  0,
- 80,152,229,  2, 31,  0, 23,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 24,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 25,  0,
-  1,  0,  0,  0, 80,152,229,  2, 31,  0, 26,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 27,  0,  1,  0,  0,  0, 80,152,229,  2,
- 31,  0, 28,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 29,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 30,  0,  1,  0,  0,  0,
- 80,152,229,  2, 31,  0, 31,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 32,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 33,  0,
-  1,  0,  0,  0, 80,152,229,  2, 31,  0, 34,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 35,  0,  1,  0,  0,  0, 80,152,229,  2,
- 31,  0, 36,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 37,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 38,  0,  1,  0,  0,  0,
- 80,152,229,  2, 31,  0, 39,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 40,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 41,  0,
-  1,  0,  0,  0, 80,152,229,  2, 31,  0, 42,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 43,  0,  1,  0,  0,  0, 80,152,229,  2,
- 31,  0, 44,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 45,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 46,  0,  1,  0,  0,  0,
- 80,152,229,  2, 31,  0, 47,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 48,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 49,  0,
-  1,  0,  0,  0, 80,152,229,  2, 31,  0, 50,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 51,  0,  1,  0,  0,  0, 80,152,229,  2,
- 31,  0, 52,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 53,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 54,  0,  1,  0,  0,  0,
- 80,152,229,  2, 31,  0, 55,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 56,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 57,  0,
-  1,  0,  0,  0, 80,152,229,  2, 31,  0, 58,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 59,  0,  1,  0,  0,  0, 80,152,229,  2,
- 31,  0, 60,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 61,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 62,  0,  1,  0,  0,  0,
- 80,152,229,  2, 31,  0, 63,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 64,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 65,  0,
-  1,  0,  0,  0, 80,152,229,  2, 31,  0, 66,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 67,  0,  1,  0,  0,  0, 80,152,229,  2,
- 31,  0, 68,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0, 69,  0,  1,  0,  0,  0, 80,152,229,  2, 31,  0,  0,  0,  1,  0,  0,  0,
- 80,155,229,  2, 31,  0,  1,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0,  2,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0,  3,  0,
-  1,  0,  0,  0, 80,155,229,  2, 31,  0,  4,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0,  5,  0,  1,  0,  0,  0, 80,155,229,  2,
- 31,  0,  6,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0,  7,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0,  8,  0,  1,  0,  0,  0,
- 80,155,229,  2, 31,  0,  9,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 10,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 11,  0,
-  1,  0,  0,  0, 80,155,229,  2, 31,  0, 12,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 13,  0,  1,  0,  0,  0, 80,155,229,  2,
- 31,  0, 14,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 15,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 16,  0,  1,  0,  0,  0,
- 80,155,229,  2, 31,  0, 17,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 18,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 19,  0,
-  1,  0,  0,  0, 80,155,229,  2, 31,  0, 20,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 21,  0,  1,  0,  0,  0, 80,155,229,  2,
- 31,  0, 22,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 23,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 24,  0,  1,  0,  0,  0,
- 80,155,229,  2, 31,  0, 25,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 26,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 27,  0,
-  1,  0,  0,  0, 80,155,229,  2, 31,  0, 28,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 29,  0,  1,  0,  0,  0, 80,155,229,  2,
- 31,  0, 30,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 31,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 32,  0,  1,  0,  0,  0,
- 80,155,229,  2, 31,  0, 33,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 34,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 35,  0,
-  1,  0,  0,  0, 80,155,229,  2, 31,  0, 36,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 37,  0,  1,  0,  0,  0, 80,155,229,  2,
- 31,  0, 38,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 39,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 40,  0,  1,  0,  0,  0,
- 80,155,229,  2, 31,  0, 41,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 42,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 43,  0,
-  1,  0,  0,  0, 80,155,229,  2, 31,  0, 44,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 45,  0,  1,  0,  0,  0, 80,155,229,  2,
- 31,  0, 46,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 47,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 48,  0,  1,  0,  0,  0,
- 80,155,229,  2, 31,  0, 49,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 50,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 51,  0,
-  1,  0,  0,  0, 80,155,229,  2, 31,  0, 52,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 53,  0,  1,  0,  0,  0, 80,155,229,  2,
- 31,  0, 54,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 55,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 56,  0,  1,  0,  0,  0,
- 80,155,229,  2, 31,  0, 57,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 58,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 59,  0,
-  1,  0,  0,  0, 80,155,229,  2, 31,  0, 60,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 61,  0,  1,  0,  0,  0, 80,155,229,  2,
- 31,  0, 62,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 63,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 64,  0,  1,  0,  0,  0,
- 80,155,229,  2, 31,  0, 65,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 66,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 67,  0,
-  1,  0,  0,  0, 80,155,229,  2, 31,  0, 68,  0,  1,  0,  0,  0, 80,155,229,  2, 31,  0, 69,  0,  1,  0,  0,  0, 80,155,229,  2,
- 31,  0,  0,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0,  1,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0,  2,  0,  1,  0,  0,  0,
- 80,158,229,  2, 31,  0,  3,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0,  4,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0,  5,  0,
-  1,  0,  0,  0, 80,158,229,  2, 31,  0,  6,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0,  7,  0,  1,  0,  0,  0, 80,158,229,  2,
- 31,  0,  8,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0,  9,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 10,  0,  1,  0,  0,  0,
- 80,158,229,  2, 31,  0, 11,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 12,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 13,  0,
-  1,  0,  0,  0, 80,158,229,  2, 31,  0, 14,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 15,  0,  1,  0,  0,  0, 80,158,229,  2,
- 31,  0, 16,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 17,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 18,  0,  1,  0,  0,  0,
- 80,158,229,  2, 31,  0, 19,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 20,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 21,  0,
-  1,  0,  0,  0, 80,158,229,  2, 31,  0, 22,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 23,  0,  1,  0,  0,  0, 80,158,229,  2,
- 31,  0, 24,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 25,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 26,  0,  1,  0,  0,  0,
- 80,158,229,  2, 31,  0, 27,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 28,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 29,  0,
-  1,  0,  0,  0, 80,158,229,  2, 31,  0, 30,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 31,  0,  1,  0,  0,  0, 80,158,229,  2,
- 31,  0, 32,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 33,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 34,  0,  1,  0,  0,  0,
- 80,158,229,  2, 31,  0, 35,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 36,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 37,  0,
-  1,  0,  0,  0, 80,158,229,  2, 31,  0, 38,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 39,  0,  1,  0,  0,  0, 80,158,229,  2,
- 31,  0, 40,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 41,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 42,  0,  1,  0,  0,  0,
- 80,158,229,  2, 31,  0, 43,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 44,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 45,  0,
-  1,  0,  0,  0, 80,158,229,  2, 31,  0, 46,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 47,  0,  1,  0,  0,  0, 80,158,229,  2,
- 31,  0, 48,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 49,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 50,  0,  1,  0,  0,  0,
- 80,158,229,  2, 31,  0, 51,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 52,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 53,  0,
-  1,  0,  0,  0, 80,158,229,  2, 31,  0, 54,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 55,  0,  1,  0,  0,  0, 80,158,229,  2,
- 31,  0, 56,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 57,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 58,  0,  1,  0,  0,  0,
- 80,158,229,  2, 31,  0, 59,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 60,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 61,  0,
-  1,  0,  0,  0, 80,158,229,  2, 31,  0, 62,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 63,  0,  1,  0,  0,  0, 80,158,229,  2,
- 31,  0, 64,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 65,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 66,  0,  1,  0,  0,  0,
- 80,158,229,  2, 31,  0, 67,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 68,  0,  1,  0,  0,  0, 80,158,229,  2, 31,  0, 69,  0,
-  1,  0,  0,  0, 80,158,229,  2, 31,  0,  0,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0,  1,  0,  1,  0,  0,  0, 80,161,229,  2,
- 31,  0,  2,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0,  3,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0,  4,  0,  1,  0,  0,  0,
- 80,161,229,  2, 31,  0,  5,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0,  6,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0,  7,  0,
-  1,  0,  0,  0, 80,161,229,  2, 31,  0,  8,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0,  9,  0,  1,  0,  0,  0, 80,161,229,  2,
- 31,  0, 10,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 11,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 12,  0,  1,  0,  0,  0,
- 80,161,229,  2, 31,  0, 13,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 14,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 15,  0,
-  1,  0,  0,  0, 80,161,229,  2, 31,  0, 16,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 17,  0,  1,  0,  0,  0, 80,161,229,  2,
- 31,  0, 18,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 19,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 20,  0,  1,  0,  0,  0,
- 80,161,229,  2, 31,  0, 21,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 22,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 23,  0,
-  1,  0,  0,  0, 80,161,229,  2, 31,  0, 24,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 25,  0,  1,  0,  0,  0, 80,161,229,  2,
- 31,  0, 26,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 27,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 28,  0,  1,  0,  0,  0,
- 80,161,229,  2, 31,  0, 29,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 30,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 31,  0,
-  1,  0,  0,  0, 80,161,229,  2, 31,  0, 32,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 33,  0,  1,  0,  0,  0, 80,161,229,  2,
- 31,  0, 34,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 35,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 36,  0,  1,  0,  0,  0,
- 80,161,229,  2, 31,  0, 37,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 38,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 39,  0,
-  1,  0,  0,  0, 80,161,229,  2, 31,  0, 40,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 41,  0,  1,  0,  0,  0, 80,161,229,  2,
- 31,  0, 42,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 43,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 44,  0,  1,  0,  0,  0,
- 80,161,229,  2, 31,  0, 45,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 46,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 47,  0,
-  1,  0,  0,  0, 80,161,229,  2, 31,  0, 48,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 49,  0,  1,  0,  0,  0, 80,161,229,  2,
- 31,  0, 50,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 51,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 52,  0,  1,  0,  0,  0,
- 80,161,229,  2, 31,  0, 53,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 54,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 55,  0,
-  1,  0,  0,  0, 80,161,229,  2, 31,  0, 56,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 57,  0,  1,  0,  0,  0, 80,161,229,  2,
- 31,  0, 58,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 59,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 60,  0,  1,  0,  0,  0,
- 80,161,229,  2, 31,  0, 61,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 62,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 63,  0,
-  1,  0,  0,  0, 80,161,229,  2, 31,  0, 64,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 65,  0,  1,  0,  0,  0, 80,161,229,  2,
- 31,  0, 66,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 67,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0, 68,  0,  1,  0,  0,  0,
- 80,161,229,  2, 31,  0, 69,  0,  1,  0,  0,  0, 80,161,229,  2, 31,  0,  0,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0,  1,  0,
-  1,  0,  0,  0, 80,164,229,  2, 31,  0,  2,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0,  3,  0,  1,  0,  0,  0, 80,164,229,  2,
- 31,  0,  4,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0,  5,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0,  6,  0,  1,  0,  0,  0,
- 80,164,229,  2, 31,  0,  7,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0,  8,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0,  9,  0,
-  1,  0,  0,  0, 80,164,229,  2, 31,  0, 10,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 11,  0,  1,  0,  0,  0, 80,164,229,  2,
- 31,  0, 12,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 13,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 14,  0,  1,  0,  0,  0,
- 80,164,229,  2, 31,  0, 15,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 16,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 17,  0,
-  1,  0,  0,  0, 80,164,229,  2, 31,  0, 18,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 19,  0,  1,  0,  0,  0, 80,164,229,  2,
- 31,  0, 20,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 21,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 22,  0,  1,  0,  0,  0,
- 80,164,229,  2, 31,  0, 23,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 24,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 25,  0,
-  1,  0,  0,  0, 80,164,229,  2, 31,  0, 26,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 27,  0,  1,  0,  0,  0, 80,164,229,  2,
- 31,  0, 28,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 29,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 30,  0,  1,  0,  0,  0,
- 80,164,229,  2, 31,  0, 31,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 32,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 33,  0,
-  1,  0,  0,  0, 80,164,229,  2, 31,  0, 34,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 35,  0,  1,  0,  0,  0, 80,164,229,  2,
- 31,  0, 36,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 37,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 38,  0,  1,  0,  0,  0,
- 80,164,229,  2, 31,  0, 39,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 40,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 41,  0,
-  1,  0,  0,  0, 80,164,229,  2, 31,  0, 42,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 43,  0,  1,  0,  0,  0, 80,164,229,  2,
- 31,  0, 44,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 45,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 46,  0,  1,  0,  0,  0,
- 80,164,229,  2, 31,  0, 47,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 48,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 49,  0,
-  1,  0,  0,  0, 80,164,229,  2, 31,  0, 50,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 51,  0,  1,  0,  0,  0, 80,164,229,  2,
- 31,  0, 52,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 53,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 54,  0,  1,  0,  0,  0,
- 80,164,229,  2, 31,  0, 55,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 56,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 57,  0,
-  1,  0,  0,  0, 80,164,229,  2, 31,  0, 58,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 59,  0,  1,  0,  0,  0, 80,164,229,  2,
- 31,  0, 60,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 61,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 62,  0,  1,  0,  0,  0,
- 80,164,229,  2, 31,  0, 63,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 64,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 65,  0,
-  1,  0,  0,  0, 80,164,229,  2, 31,  0, 66,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 67,  0,  1,  0,  0,  0, 80,164,229,  2,
- 31,  0, 68,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0, 69,  0,  1,  0,  0,  0, 80,164,229,  2, 31,  0,  0,  0,  1,  0,  0,  0,
- 80,167,229,  2, 31,  0,  1,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0,  2,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0,  3,  0,
-  1,  0,  0,  0, 80,167,229,  2, 31,  0,  4,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0,  5,  0,  1,  0,  0,  0, 80,167,229,  2,
- 31,  0,  6,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0,  7,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0,  8,  0,  1,  0,  0,  0,
- 80,167,229,  2, 31,  0,  9,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 10,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 11,  0,
-  1,  0,  0,  0, 80,167,229,  2, 31,  0, 12,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 13,  0,  1,  0,  0,  0, 80,167,229,  2,
- 31,  0, 14,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 15,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 16,  0,  1,  0,  0,  0,
- 80,167,229,  2, 31,  0, 17,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 18,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 19,  0,
-  1,  0,  0,  0, 80,167,229,  2, 31,  0, 20,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 21,  0,  1,  0,  0,  0, 80,167,229,  2,
- 31,  0, 22,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 23,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 24,  0,  1,  0,  0,  0,
- 80,167,229,  2, 31,  0, 25,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 26,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 27,  0,
-  1,  0,  0,  0, 80,167,229,  2, 31,  0, 28,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 29,  0,  1,  0,  0,  0, 80,167,229,  2,
- 31,  0, 30,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 31,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 32,  0,  1,  0,  0,  0,
- 80,167,229,  2, 31,  0, 33,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 34,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 35,  0,
-  1,  0,  0,  0, 80,167,229,  2, 31,  0, 36,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 37,  0,  1,  0,  0,  0, 80,167,229,  2,
- 31,  0, 38,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 39,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 40,  0,  1,  0,  0,  0,
- 80,167,229,  2, 31,  0, 41,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 42,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 43,  0,
-  1,  0,  0,  0, 80,167,229,  2, 31,  0, 44,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 45,  0,  1,  0,  0,  0, 80,167,229,  2,
- 31,  0, 46,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 47,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 48,  0,  1,  0,  0,  0,
- 80,167,229,  2, 31,  0, 49,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 50,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 51,  0,
-  1,  0,  0,  0, 80,167,229,  2, 31,  0, 52,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 53,  0,  1,  0,  0,  0, 80,167,229,  2,
- 31,  0, 54,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 55,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 56,  0,  1,  0,  0,  0,
- 80,167,229,  2, 31,  0, 57,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 58,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 59,  0,
-  1,  0,  0,  0, 80,167,229,  2, 31,  0, 60,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 61,  0,  1,  0,  0,  0, 80,167,229,  2,
- 31,  0, 62,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 63,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 64,  0,  1,  0,  0,  0,
- 80,167,229,  2, 31,  0, 65,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 66,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 67,  0,
-  1,  0,  0,  0, 80,167,229,  2, 31,  0, 68,  0,  1,  0,  0,  0, 80,167,229,  2, 31,  0, 69,  0,  1,  0,  0,  0, 80,167,229,  2,
- 31,  0,  0,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0,  1,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0,  2,  0,  1,  0,  0,  0,
- 80,170,229,  2, 31,  0,  3,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0,  4,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0,  5,  0,
-  1,  0,  0,  0, 80,170,229,  2, 31,  0,  6,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0,  7,  0,  1,  0,  0,  0, 80,170,229,  2,
- 31,  0,  8,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0,  9,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 10,  0,  1,  0,  0,  0,
- 80,170,229,  2, 31,  0, 11,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 12,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 13,  0,
-  1,  0,  0,  0, 80,170,229,  2, 31,  0, 14,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 15,  0,  1,  0,  0,  0, 80,170,229,  2,
- 31,  0, 16,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 17,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 18,  0,  1,  0,  0,  0,
- 80,170,229,  2, 31,  0, 19,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 20,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 21,  0,
-  1,  0,  0,  0, 80,170,229,  2, 31,  0, 22,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 23,  0,  1,  0,  0,  0, 80,170,229,  2,
- 31,  0, 24,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 25,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 26,  0,  1,  0,  0,  0,
- 80,170,229,  2, 31,  0, 27,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 28,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 29,  0,
-  1,  0,  0,  0, 80,170,229,  2, 31,  0, 30,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 31,  0,  1,  0,  0,  0, 80,170,229,  2,
- 31,  0, 32,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 33,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 34,  0,  1,  0,  0,  0,
- 80,170,229,  2, 31,  0, 35,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 36,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 37,  0,
-  1,  0,  0,  0, 80,170,229,  2, 31,  0, 38,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 39,  0,  1,  0,  0,  0, 80,170,229,  2,
- 31,  0, 40,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 41,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 42,  0,  1,  0,  0,  0,
- 80,170,229,  2, 31,  0, 43,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 44,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 45,  0,
-  1,  0,  0,  0, 80,170,229,  2, 31,  0, 46,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 47,  0,  1,  0,  0,  0, 80,170,229,  2,
- 31,  0, 48,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 49,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 50,  0,  1,  0,  0,  0,
- 80,170,229,  2, 31,  0, 51,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 52,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 53,  0,
-  1,  0,  0,  0, 80,170,229,  2, 31,  0, 54,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 55,  0,  1,  0,  0,  0, 80,170,229,  2,
- 31,  0, 56,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 57,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 58,  0,  1,  0,  0,  0,
- 80,170,229,  2, 31,  0, 59,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 60,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 61,  0,
-  1,  0,  0,  0, 80,170,229,  2, 31,  0, 62,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 63,  0,  1,  0,  0,  0, 80,170,229,  2,
- 31,  0, 64,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 65,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 66,  0,  1,  0,  0,  0,
- 80,170,229,  2, 31,  0, 67,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 68,  0,  1,  0,  0,  0, 80,170,229,  2, 31,  0, 69,  0,
-  1,  0,  0,  0, 80,170,229,  2, 31,  0,  0,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0,  1,  0,  1,  0,  0,  0, 80,173,229,  2,
- 31,  0,  2,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0,  3,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0,  4,  0,  1,  0,  0,  0,
- 80,173,229,  2, 31,  0,  5,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0,  6,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0,  7,  0,
-  1,  0,  0,  0, 80,173,229,  2, 31,  0,  8,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0,  9,  0,  1,  0,  0,  0, 80,173,229,  2,
- 31,  0, 10,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 11,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 12,  0,  1,  0,  0,  0,
- 80,173,229,  2, 31,  0, 13,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 14,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 15,  0,
-  1,  0,  0,  0, 80,173,229,  2, 31,  0, 16,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 17,  0,  1,  0,  0,  0, 80,173,229,  2,
- 31,  0, 18,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 19,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 20,  0,  1,  0,  0,  0,
- 80,173,229,  2, 31,  0, 21,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 22,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 23,  0,
-  1,  0,  0,  0, 80,173,229,  2, 31,  0, 24,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 25,  0,  1,  0,  0,  0, 80,173,229,  2,
- 31,  0, 26,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 27,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 28,  0,  1,  0,  0,  0,
- 80,173,229,  2, 31,  0, 29,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 30,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 31,  0,
-  1,  0,  0,  0, 80,173,229,  2, 31,  0, 32,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 33,  0,  1,  0,  0,  0, 80,173,229,  2,
- 31,  0, 34,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 35,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 36,  0,  1,  0,  0,  0,
- 80,173,229,  2, 31,  0, 37,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 38,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 39,  0,
-  1,  0,  0,  0, 80,173,229,  2, 31,  0, 40,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 41,  0,  1,  0,  0,  0, 80,173,229,  2,
- 31,  0, 42,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 43,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 44,  0,  1,  0,  0,  0,
- 80,173,229,  2, 31,  0, 45,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 46,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 47,  0,
-  1,  0,  0,  0, 80,173,229,  2, 31,  0, 48,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 49,  0,  1,  0,  0,  0, 80,173,229,  2,
- 31,  0, 50,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 51,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 52,  0,  1,  0,  0,  0,
- 80,173,229,  2, 31,  0, 53,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 54,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 55,  0,
-  1,  0,  0,  0, 80,173,229,  2, 31,  0, 56,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 57,  0,  1,  0,  0,  0, 80,173,229,  2,
- 31,  0, 58,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 59,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 60,  0,  1,  0,  0,  0,
- 80,173,229,  2, 31,  0, 61,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 62,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 63,  0,
-  1,  0,  0,  0, 80,173,229,  2, 31,  0, 64,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 65,  0,  1,  0,  0,  0, 80,173,229,  2,
- 31,  0, 66,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 67,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0, 68,  0,  1,  0,  0,  0,
- 80,173,229,  2, 31,  0, 69,  0,  1,  0,  0,  0, 80,173,229,  2, 31,  0,  0,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0,  1,  0,
-  1,  0,  0,  0, 80,176,229,  2, 31,  0,  2,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0,  3,  0,  1,  0,  0,  0, 80,176,229,  2,
- 31,  0,  4,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0,  5,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0,  6,  0,  1,  0,  0,  0,
- 80,176,229,  2, 31,  0,  7,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0,  8,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0,  9,  0,
-  1,  0,  0,  0, 80,176,229,  2, 31,  0, 10,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 11,  0,  1,  0,  0,  0, 80,176,229,  2,
- 31,  0, 12,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 13,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 14,  0,  1,  0,  0,  0,
- 80,176,229,  2, 31,  0, 15,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 16,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 17,  0,
-  1,  0,  0,  0, 80,176,229,  2, 31,  0, 18,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 19,  0,  1,  0,  0,  0, 80,176,229,  2,
- 31,  0, 20,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 21,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 22,  0,  1,  0,  0,  0,
- 80,176,229,  2, 31,  0, 23,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 24,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 25,  0,
-  1,  0,  0,  0, 80,176,229,  2, 31,  0, 26,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 27,  0,  1,  0,  0,  0, 80,176,229,  2,
- 31,  0, 28,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 29,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 30,  0,  1,  0,  0,  0,
- 80,176,229,  2, 31,  0, 31,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 32,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 33,  0,
-  1,  0,  0,  0, 80,176,229,  2, 31,  0, 34,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 35,  0,  1,  0,  0,  0, 80,176,229,  2,
- 31,  0, 36,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 37,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 38,  0,  1,  0,  0,  0,
- 80,176,229,  2, 31,  0, 39,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 40,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 41,  0,
-  1,  0,  0,  0, 80,176,229,  2, 31,  0, 42,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 43,  0,  1,  0,  0,  0, 80,176,229,  2,
- 31,  0, 44,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 45,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 46,  0,  1,  0,  0,  0,
- 80,176,229,  2, 31,  0, 47,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 48,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 49,  0,
-  1,  0,  0,  0, 80,176,229,  2, 31,  0, 50,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 51,  0,  1,  0,  0,  0, 80,176,229,  2,
- 31,  0, 52,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 53,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 54,  0,  1,  0,  0,  0,
- 80,176,229,  2, 31,  0, 55,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 56,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 57,  0,
-  1,  0,  0,  0, 80,176,229,  2, 31,  0, 58,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 59,  0,  1,  0,  0,  0, 80,176,229,  2,
- 31,  0, 60,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 61,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 62,  0,  1,  0,  0,  0,
- 80,176,229,  2, 31,  0, 63,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 64,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 65,  0,
-  1,  0,  0,  0, 80,176,229,  2, 31,  0, 66,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 67,  0,  1,  0,  0,  0, 80,176,229,  2,
- 31,  0, 68,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0, 69,  0,  1,  0,  0,  0, 80,176,229,  2, 31,  0,  0,  0,  1,  0,  0,  0,
- 80,179,229,  2, 31,  0,  1,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0,  2,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0,  3,  0,
-  1,  0,  0,  0, 80,179,229,  2, 31,  0,  4,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0,  5,  0,  1,  0,  0,  0, 80,179,229,  2,
- 31,  0,  6,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0,  7,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0,  8,  0,  1,  0,  0,  0,
- 80,179,229,  2, 31,  0,  9,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 10,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 11,  0,
-  1,  0,  0,  0, 80,179,229,  2, 31,  0, 12,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 13,  0,  1,  0,  0,  0, 80,179,229,  2,
- 31,  0, 14,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 15,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 16,  0,  1,  0,  0,  0,
- 80,179,229,  2, 31,  0, 17,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 18,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 19,  0,
-  1,  0,  0,  0, 80,179,229,  2, 31,  0, 20,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 21,  0,  1,  0,  0,  0, 80,179,229,  2,
- 31,  0, 22,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 23,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 24,  0,  1,  0,  0,  0,
- 80,179,229,  2, 31,  0, 25,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 26,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 27,  0,
-  1,  0,  0,  0, 80,179,229,  2, 31,  0, 28,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 29,  0,  1,  0,  0,  0, 80,179,229,  2,
- 31,  0, 30,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 31,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 32,  0,  1,  0,  0,  0,
- 80,179,229,  2, 31,  0, 33,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 34,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 35,  0,
-  1,  0,  0,  0, 80,179,229,  2, 31,  0, 36,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 37,  0,  1,  0,  0,  0, 80,179,229,  2,
- 31,  0, 38,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 39,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 40,  0,  1,  0,  0,  0,
- 80,179,229,  2, 31,  0, 41,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 42,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 43,  0,
-  1,  0,  0,  0, 80,179,229,  2, 31,  0, 44,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 45,  0,  1,  0,  0,  0, 80,179,229,  2,
- 31,  0, 46,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 47,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 48,  0,  1,  0,  0,  0,
- 80,179,229,  2, 31,  0, 49,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 50,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 51,  0,
-  1,  0,  0,  0, 80,179,229,  2, 31,  0, 52,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 53,  0,  1,  0,  0,  0, 80,179,229,  2,
- 31,  0, 54,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 55,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 56,  0,  1,  0,  0,  0,
- 80,179,229,  2, 31,  0, 57,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 58,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 59,  0,
-  1,  0,  0,  0, 80,179,229,  2, 31,  0, 60,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 61,  0,  1,  0,  0,  0, 80,179,229,  2,
- 31,  0, 62,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 63,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 64,  0,  1,  0,  0,  0,
- 80,179,229,  2, 31,  0, 65,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 66,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 67,  0,
-  1,  0,  0,  0, 80,179,229,  2, 31,  0, 68,  0,  1,  0,  0,  0, 80,179,229,  2, 31,  0, 69,  0,  1,  0,  0,  0, 80,179,229,  2,
- 31,  0,  0,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0,  1,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0,  2,  0,  1,  0,  0,  0,
-104,182,229,  2, 31,  0,  3,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0,  4,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0,  5,  0,
-  1,  0,  0,  0,104,182,229,  2, 31,  0,  6,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0,  7,  0,  1,  0,  0,  0,104,182,229,  2,
- 31,  0,  8,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0,  9,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 10,  0,  1,  0,  0,  0,
-104,182,229,  2, 31,  0, 11,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 12,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 13,  0,
-  1,  0,  0,  0,104,182,229,  2, 31,  0, 14,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 15,  0,  1,  0,  0,  0,104,182,229,  2,
- 31,  0, 16,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 17,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 18,  0,  1,  0,  0,  0,
-104,182,229,  2, 31,  0, 19,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 20,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 21,  0,
-  1,  0,  0,  0,104,182,229,  2, 31,  0, 22,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 23,  0,  1,  0,  0,  0,104,182,229,  2,
- 31,  0, 24,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 25,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 26,  0,  1,  0,  0,  0,
-104,182,229,  2, 31,  0, 27,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 28,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 29,  0,
-  1,  0,  0,  0,104,182,229,  2, 31,  0, 30,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 31,  0,  1,  0,  0,  0,104,182,229,  2,
- 31,  0, 32,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 33,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 34,  0,  1,  0,  0,  0,
-104,182,229,  2, 31,  0, 35,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 36,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 37,  0,
-  1,  0,  0,  0,104,182,229,  2, 31,  0, 38,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 39,  0,  1,  0,  0,  0,104,182,229,  2,
- 31,  0, 40,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 41,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 42,  0,  1,  0,  0,  0,
-104,182,229,  2, 31,  0, 43,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 44,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 45,  0,
-  1,  0,  0,  0,104,182,229,  2, 31,  0, 46,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 47,  0,  1,  0,  0,  0,104,182,229,  2,
- 31,  0, 48,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 49,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 50,  0,  1,  0,  0,  0,
-104,182,229,  2, 31,  0, 51,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 52,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 53,  0,
-  1,  0,  0,  0,104,182,229,  2, 31,  0, 54,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 55,  0,  1,  0,  0,  0,104,182,229,  2,
- 31,  0, 56,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 57,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 58,  0,  1,  0,  0,  0,
-104,182,229,  2, 31,  0, 59,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 60,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 61,  0,
-  1,  0,  0,  0,104,182,229,  2, 31,  0, 62,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 63,  0,  1,  0,  0,  0,104,182,229,  2,
- 31,  0, 64,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 65,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 66,  0,  1,  0,  0,  0,
-104,182,229,  2, 31,  0, 67,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 68,  0,  1,  0,  0,  0,104,182,229,  2, 31,  0, 69,  0,
-  1,  0,  0,  0,104,182,229,  2, 31,  0,  0,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0,  1,  0,  1,  0,  0,  0,112,185,229,  2,
- 31,  0,  2,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0,  3,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0,  4,  0,  1,  0,  0,  0,
-112,185,229,  2, 31,  0,  5,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0,  6,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0,  7,  0,
-  1,  0,  0,  0,112,185,229,  2, 31,  0,  8,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0,  9,  0,  1,  0,  0,  0,112,185,229,  2,
- 31,  0, 10,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 11,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 12,  0,  1,  0,  0,  0,
-112,185,229,  2, 31,  0, 13,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 14,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 15,  0,
-  1,  0,  0,  0,112,185,229,  2, 31,  0, 16,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 17,  0,  1,  0,  0,  0,112,185,229,  2,
- 31,  0, 18,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 19,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 20,  0,  1,  0,  0,  0,
-112,185,229,  2, 31,  0, 21,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 22,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 23,  0,
-  1,  0,  0,  0,112,185,229,  2, 31,  0, 24,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 25,  0,  1,  0,  0,  0,112,185,229,  2,
- 31,  0, 26,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 27,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 28,  0,  1,  0,  0,  0,
-112,185,229,  2, 31,  0, 29,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 30,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 31,  0,
-  1,  0,  0,  0,112,185,229,  2, 31,  0, 32,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 33,  0,  1,  0,  0,  0,112,185,229,  2,
- 31,  0, 34,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 35,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 36,  0,  1,  0,  0,  0,
-112,185,229,  2, 31,  0, 37,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 38,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 39,  0,
-  1,  0,  0,  0,112,185,229,  2, 31,  0, 40,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 41,  0,  1,  0,  0,  0,112,185,229,  2,
- 31,  0, 42,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 43,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 44,  0,  1,  0,  0,  0,
-112,185,229,  2, 31,  0, 45,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 46,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 47,  0,
-  1,  0,  0,  0,112,185,229,  2, 31,  0, 48,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 49,  0,  1,  0,  0,  0,112,185,229,  2,
- 31,  0, 50,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 51,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 52,  0,  1,  0,  0,  0,
-112,185,229,  2, 31,  0, 53,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 54,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 55,  0,
-  1,  0,  0,  0,112,185,229,  2, 31,  0, 56,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 57,  0,  1,  0,  0,  0,112,185,229,  2,
- 31,  0, 58,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 59,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 60,  0,  1,  0,  0,  0,
-112,185,229,  2, 31,  0, 61,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 62,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 63,  0,
-  1,  0,  0,  0,112,185,229,  2, 31,  0, 64,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 65,  0,  1,  0,  0,  0,112,185,229,  2,
- 31,  0, 66,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 67,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0, 68,  0,  1,  0,  0,  0,
-112,185,229,  2, 31,  0, 69,  0,  1,  0,  0,  0,112,185,229,  2, 31,  0,  0,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0,  1,  0,
-  1,  0,  0,  0,120,188,229,  2, 31,  0,  2,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0,  3,  0,  1,  0,  0,  0,120,188,229,  2,
- 31,  0,  4,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0,  5,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0,  6,  0,  1,  0,  0,  0,
-120,188,229,  2, 31,  0,  7,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0,  8,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0,  9,  0,
-  1,  0,  0,  0,120,188,229,  2, 31,  0, 10,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 11,  0,  1,  0,  0,  0,120,188,229,  2,
- 31,  0, 12,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 13,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 14,  0,  1,  0,  0,  0,
-120,188,229,  2, 31,  0, 15,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 16,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 17,  0,
-  1,  0,  0,  0,120,188,229,  2, 31,  0, 18,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 19,  0,  1,  0,  0,  0,120,188,229,  2,
- 31,  0, 20,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 21,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 22,  0,  1,  0,  0,  0,
-120,188,229,  2, 31,  0, 23,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 24,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 25,  0,
-  1,  0,  0,  0,120,188,229,  2, 31,  0, 26,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 27,  0,  1,  0,  0,  0,120,188,229,  2,
- 31,  0, 28,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 29,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 30,  0,  1,  0,  0,  0,
-120,188,229,  2, 31,  0, 31,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 32,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 33,  0,
-  1,  0,  0,  0,120,188,229,  2, 31,  0, 34,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 35,  0,  1,  0,  0,  0,120,188,229,  2,
- 31,  0, 36,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 37,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 38,  0,  1,  0,  0,  0,
-120,188,229,  2, 31,  0, 39,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 40,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 41,  0,
-  1,  0,  0,  0,120,188,229,  2, 31,  0, 42,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 43,  0,  1,  0,  0,  0,120,188,229,  2,
- 31,  0, 44,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 45,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 46,  0,  1,  0,  0,  0,
-120,188,229,  2, 31,  0, 47,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 48,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 49,  0,
-  1,  0,  0,  0,120,188,229,  2, 31,  0, 50,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 51,  0,  1,  0,  0,  0,120,188,229,  2,
- 31,  0, 52,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 53,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 54,  0,  1,  0,  0,  0,
-120,188,229,  2, 31,  0, 55,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 56,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 57,  0,
-  1,  0,  0,  0,120,188,229,  2, 31,  0, 58,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 59,  0,  1,  0,  0,  0,120,188,229,  2,
- 31,  0, 60,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 61,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 62,  0,  1,  0,  0,  0,
-120,188,229,  2, 31,  0, 63,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 64,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 65,  0,
-  1,  0,  0,  0,120,188,229,  2, 31,  0, 66,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 67,  0,  1,  0,  0,  0,120,188,229,  2,
- 31,  0, 68,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0, 69,  0,  1,  0,  0,  0,120,188,229,  2, 31,  0,  0,  0,  1,  0,  0,  0,
-128,191,229,  2, 31,  0,  1,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0,  2,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0,  3,  0,
-  1,  0,  0,  0,128,191,229,  2, 31,  0,  4,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0,  5,  0,  1,  0,  0,  0,128,191,229,  2,
- 31,  0,  6,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0,  7,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0,  8,  0,  1,  0,  0,  0,
-128,191,229,  2, 31,  0,  9,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 10,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 11,  0,
-  1,  0,  0,  0,128,191,229,  2, 31,  0, 12,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 13,  0,  1,  0,  0,  0,128,191,229,  2,
- 31,  0, 14,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 15,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 16,  0,  1,  0,  0,  0,
-128,191,229,  2, 31,  0, 17,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 18,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 19,  0,
-  1,  0,  0,  0,128,191,229,  2, 31,  0, 20,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 21,  0,  1,  0,  0,  0,128,191,229,  2,
- 31,  0, 22,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 23,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 24,  0,  1,  0,  0,  0,
-128,191,229,  2, 31,  0, 25,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 26,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 27,  0,
-  1,  0,  0,  0,128,191,229,  2, 31,  0, 28,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 29,  0,  1,  0,  0,  0,128,191,229,  2,
- 31,  0, 30,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 31,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 32,  0,  1,  0,  0,  0,
-128,191,229,  2, 31,  0, 33,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 34,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 35,  0,
-  1,  0,  0,  0,128,191,229,  2, 31,  0, 36,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 37,  0,  1,  0,  0,  0,128,191,229,  2,
- 31,  0, 38,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 39,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 40,  0,  1,  0,  0,  0,
-128,191,229,  2, 31,  0, 41,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 42,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 43,  0,
-  1,  0,  0,  0,128,191,229,  2, 31,  0, 44,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 45,  0,  1,  0,  0,  0,128,191,229,  2,
- 31,  0, 46,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 47,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 48,  0,  1,  0,  0,  0,
-128,191,229,  2, 31,  0, 49,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 50,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 51,  0,
-  1,  0,  0,  0,128,191,229,  2, 31,  0, 52,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 53,  0,  1,  0,  0,  0,128,191,229,  2,
- 31,  0, 54,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 55,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 56,  0,  1,  0,  0,  0,
-128,191,229,  2, 31,  0, 57,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 58,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 59,  0,
-  1,  0,  0,  0,128,191,229,  2, 31,  0, 60,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 61,  0,  1,  0,  0,  0,128,191,229,  2,
- 31,  0, 62,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 63,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 64,  0,  1,  0,  0,  0,
-128,191,229,  2, 31,  0, 65,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 66,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 67,  0,
-  1,  0,  0,  0,128,191,229,  2, 31,  0, 68,  0,  1,  0,  0,  0,128,191,229,  2, 31,  0, 69,  0,  1,  0,  0,  0,128,191,229,  2,
- 31,  0,  0,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0,  1,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0,  2,  0,  1,  0,  0,  0,
-136,194,229,  2, 31,  0,  3,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0,  4,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0,  5,  0,
-  1,  0,  0,  0,136,194,229,  2, 31,  0,  6,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0,  7,  0,  1,  0,  0,  0,136,194,229,  2,
- 31,  0,  8,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0,  9,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 10,  0,  1,  0,  0,  0,
-136,194,229,  2, 31,  0, 11,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 12,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 13,  0,
-  1,  0,  0,  0,136,194,229,  2, 31,  0, 14,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 15,  0,  1,  0,  0,  0,136,194,229,  2,
- 31,  0, 16,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 17,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 18,  0,  1,  0,  0,  0,
-136,194,229,  2, 31,  0, 19,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 20,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 21,  0,
-  1,  0,  0,  0,136,194,229,  2, 31,  0, 22,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 23,  0,  1,  0,  0,  0,136,194,229,  2,
- 31,  0, 24,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 25,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 26,  0,  1,  0,  0,  0,
-136,194,229,  2, 31,  0, 27,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 28,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 29,  0,
-  1,  0,  0,  0,136,194,229,  2, 31,  0, 30,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 31,  0,  1,  0,  0,  0,136,194,229,  2,
- 31,  0, 32,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 33,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 34,  0,  1,  0,  0,  0,
-136,194,229,  2, 31,  0, 35,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 36,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 37,  0,
-  1,  0,  0,  0,136,194,229,  2, 31,  0, 38,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 39,  0,  1,  0,  0,  0,136,194,229,  2,
- 31,  0, 40,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 41,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 42,  0,  1,  0,  0,  0,
-136,194,229,  2, 31,  0, 43,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 44,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 45,  0,
-  1,  0,  0,  0,136,194,229,  2, 31,  0, 46,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 47,  0,  1,  0,  0,  0,136,194,229,  2,
- 31,  0, 48,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 49,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 50,  0,  1,  0,  0,  0,
-136,194,229,  2, 31,  0, 51,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 52,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 53,  0,
-  1,  0,  0,  0,136,194,229,  2, 31,  0, 54,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 55,  0,  1,  0,  0,  0,136,194,229,  2,
- 31,  0, 56,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 57,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 58,  0,  1,  0,  0,  0,
-136,194,229,  2, 31,  0, 59,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 60,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 61,  0,
-  1,  0,  0,  0,136,194,229,  2, 31,  0, 62,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 63,  0,  1,  0,  0,  0,136,194,229,  2,
- 31,  0, 64,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 65,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 66,  0,  1,  0,  0,  0,
-136,194,229,  2, 31,  0, 67,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 68,  0,  1,  0,  0,  0,136,194,229,  2, 31,  0, 69,  0,
-  1,  0,  0,  0,136,194,229,  2, 31,  0,  0,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0,  1,  0,  1,  0,  0,  0,144,197,229,  2,
- 31,  0,  2,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0,  3,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0,  4,  0,  1,  0,  0,  0,
-144,197,229,  2, 31,  0,  5,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0,  6,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0,  7,  0,
-  1,  0,  0,  0,144,197,229,  2, 31,  0,  8,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0,  9,  0,  1,  0,  0,  0,144,197,229,  2,
- 31,  0, 10,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 11,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 12,  0,  1,  0,  0,  0,
-144,197,229,  2, 31,  0, 13,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 14,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 15,  0,
-  1,  0,  0,  0,144,197,229,  2, 31,  0, 16,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 17,  0,  1,  0,  0,  0,144,197,229,  2,
- 31,  0, 18,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 19,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 20,  0,  1,  0,  0,  0,
-144,197,229,  2, 31,  0, 21,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 22,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 23,  0,
-  1,  0,  0,  0,144,197,229,  2, 31,  0, 24,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 25,  0,  1,  0,  0,  0,144,197,229,  2,
- 31,  0, 26,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 27,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 28,  0,  1,  0,  0,  0,
-144,197,229,  2, 31,  0, 29,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 30,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 31,  0,
-  1,  0,  0,  0,144,197,229,  2, 31,  0, 32,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 33,  0,  1,  0,  0,  0,144,197,229,  2,
- 31,  0, 34,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 35,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 36,  0,  1,  0,  0,  0,
-144,197,229,  2, 31,  0, 37,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 38,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 39,  0,
-  1,  0,  0,  0,144,197,229,  2, 31,  0, 40,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 41,  0,  1,  0,  0,  0,144,197,229,  2,
- 31,  0, 42,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 43,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 44,  0,  1,  0,  0,  0,
-144,197,229,  2, 31,  0, 45,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 46,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 47,  0,
-  1,  0,  0,  0,144,197,229,  2, 31,  0, 48,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 49,  0,  1,  0,  0,  0,144,197,229,  2,
- 31,  0, 50,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 51,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 52,  0,  1,  0,  0,  0,
-144,197,229,  2, 31,  0, 53,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 54,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 55,  0,
-  1,  0,  0,  0,144,197,229,  2, 31,  0, 56,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 57,  0,  1,  0,  0,  0,144,197,229,  2,
- 31,  0, 58,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 59,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 60,  0,  1,  0,  0,  0,
-144,197,229,  2, 31,  0, 61,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 62,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 63,  0,
-  1,  0,  0,  0,144,197,229,  2, 31,  0, 64,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 65,  0,  1,  0,  0,  0,144,197,229,  2,
- 31,  0, 66,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 67,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0, 68,  0,  1,  0,  0,  0,
-144,197,229,  2, 31,  0, 69,  0,  1,  0,  0,  0,144,197,229,  2, 31,  0,  0,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0,  1,  0,
-  1,  0,  0,  0,152,200,229,  2, 31,  0,  2,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0,  3,  0,  1,  0,  0,  0,152,200,229,  2,
- 31,  0,  4,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0,  5,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0,  6,  0,  1,  0,  0,  0,
-152,200,229,  2, 31,  0,  7,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0,  8,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0,  9,  0,
-  1,  0,  0,  0,152,200,229,  2, 31,  0, 10,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 11,  0,  1,  0,  0,  0,152,200,229,  2,
- 31,  0, 12,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 13,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 14,  0,  1,  0,  0,  0,
-152,200,229,  2, 31,  0, 15,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 16,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 17,  0,
-  1,  0,  0,  0,152,200,229,  2, 31,  0, 18,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 19,  0,  1,  0,  0,  0,152,200,229,  2,
- 31,  0, 20,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 21,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 22,  0,  1,  0,  0,  0,
-152,200,229,  2, 31,  0, 23,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 24,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 25,  0,
-  1,  0,  0,  0,152,200,229,  2, 31,  0, 26,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 27,  0,  1,  0,  0,  0,152,200,229,  2,
- 31,  0, 28,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 29,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 30,  0,  1,  0,  0,  0,
-152,200,229,  2, 31,  0, 31,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 32,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 33,  0,
-  1,  0,  0,  0,152,200,229,  2, 31,  0, 34,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 35,  0,  1,  0,  0,  0,152,200,229,  2,
- 31,  0, 36,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 37,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 38,  0,  1,  0,  0,  0,
-152,200,229,  2, 31,  0, 39,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 40,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 41,  0,
-  1,  0,  0,  0,152,200,229,  2, 31,  0, 42,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 43,  0,  1,  0,  0,  0,152,200,229,  2,
- 31,  0, 44,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 45,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 46,  0,  1,  0,  0,  0,
-152,200,229,  2, 31,  0, 47,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 48,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 49,  0,
-  1,  0,  0,  0,152,200,229,  2, 31,  0, 50,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 51,  0,  1,  0,  0,  0,152,200,229,  2,
- 31,  0, 52,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 53,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 54,  0,  1,  0,  0,  0,
-152,200,229,  2, 31,  0, 55,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 56,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 57,  0,
-  1,  0,  0,  0,152,200,229,  2, 31,  0, 58,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 59,  0,  1,  0,  0,  0,152,200,229,  2,
- 31,  0, 60,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 61,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 62,  0,  1,  0,  0,  0,
-152,200,229,  2, 31,  0, 63,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 64,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 65,  0,
-  1,  0,  0,  0,152,200,229,  2, 31,  0, 66,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 67,  0,  1,  0,  0,  0,152,200,229,  2,
- 31,  0, 68,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0, 69,  0,  1,  0,  0,  0,152,200,229,  2, 31,  0,  0,  0,  1,  0,  0,  0,
-160,203,229,  2, 31,  0,  1,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0,  2,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0,  3,  0,
-  1,  0,  0,  0,160,203,229,  2, 31,  0,  4,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0,  5,  0,  1,  0,  0,  0,160,203,229,  2,
- 31,  0,  6,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0,  7,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0,  8,  0,  1,  0,  0,  0,
-160,203,229,  2, 31,  0,  9,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 10,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 11,  0,
-  1,  0,  0,  0,160,203,229,  2, 31,  0, 12,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 13,  0,  1,  0,  0,  0,160,203,229,  2,
- 31,  0, 14,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 15,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 16,  0,  1,  0,  0,  0,
-160,203,229,  2, 31,  0, 17,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 18,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 19,  0,
-  1,  0,  0,  0,160,203,229,  2, 31,  0, 20,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 21,  0,  1,  0,  0,  0,160,203,229,  2,
- 31,  0, 22,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 23,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 24,  0,  1,  0,  0,  0,
-160,203,229,  2, 31,  0, 25,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 26,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 27,  0,
-  1,  0,  0,  0,160,203,229,  2, 31,  0, 28,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 29,  0,  1,  0,  0,  0,160,203,229,  2,
- 31,  0, 30,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 31,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 32,  0,  1,  0,  0,  0,
-160,203,229,  2, 31,  0, 33,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 34,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 35,  0,
-  1,  0,  0,  0,160,203,229,  2, 31,  0, 36,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 37,  0,  1,  0,  0,  0,160,203,229,  2,
- 31,  0, 38,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 39,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 40,  0,  1,  0,  0,  0,
-160,203,229,  2, 31,  0, 41,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 42,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 43,  0,
-  1,  0,  0,  0,160,203,229,  2, 31,  0, 44,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 45,  0,  1,  0,  0,  0,160,203,229,  2,
- 31,  0, 46,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 47,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 48,  0,  1,  0,  0,  0,
-160,203,229,  2, 31,  0, 49,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 50,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 51,  0,
-  1,  0,  0,  0,160,203,229,  2, 31,  0, 52,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 53,  0,  1,  0,  0,  0,160,203,229,  2,
- 31,  0, 54,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 55,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 56,  0,  1,  0,  0,  0,
-160,203,229,  2, 31,  0, 57,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 58,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 59,  0,
-  1,  0,  0,  0,160,203,229,  2, 31,  0, 60,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 61,  0,  1,  0,  0,  0,160,203,229,  2,
- 31,  0, 62,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 63,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 64,  0,  1,  0,  0,  0,
-160,203,229,  2, 31,  0, 65,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 66,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 67,  0,
-  1,  0,  0,  0,160,203,229,  2, 31,  0, 68,  0,  1,  0,  0,  0,160,203,229,  2, 31,  0, 69,  0,  1,  0,  0,  0,160,203,229,  2,
- 31,  0,  0,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0,  1,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0,  2,  0,  1,  0,  0,  0,
-168,206,229,  2, 31,  0,  3,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0,  4,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0,  5,  0,
-  1,  0,  0,  0,168,206,229,  2, 31,  0,  6,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0,  7,  0,  1,  0,  0,  0,168,206,229,  2,
- 31,  0,  8,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0,  9,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 10,  0,  1,  0,  0,  0,
-168,206,229,  2, 31,  0, 11,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 12,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 13,  0,
-  1,  0,  0,  0,168,206,229,  2, 31,  0, 14,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 15,  0,  1,  0,  0,  0,168,206,229,  2,
- 31,  0, 16,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 17,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 18,  0,  1,  0,  0,  0,
-168,206,229,  2, 31,  0, 19,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 20,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 21,  0,
-  1,  0,  0,  0,168,206,229,  2, 31,  0, 22,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 23,  0,  1,  0,  0,  0,168,206,229,  2,
- 31,  0, 24,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 25,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 26,  0,  1,  0,  0,  0,
-168,206,229,  2, 31,  0, 27,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 28,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 29,  0,
-  1,  0,  0,  0,168,206,229,  2, 31,  0, 30,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 31,  0,  1,  0,  0,  0,168,206,229,  2,
- 31,  0, 32,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 33,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 34,  0,  1,  0,  0,  0,
-168,206,229,  2, 31,  0, 35,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 36,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 37,  0,
-  1,  0,  0,  0,168,206,229,  2, 31,  0, 38,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 39,  0,  1,  0,  0,  0,168,206,229,  2,
- 31,  0, 40,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 41,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 42,  0,  1,  0,  0,  0,
-168,206,229,  2, 31,  0, 43,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 44,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 45,  0,
-  1,  0,  0,  0,168,206,229,  2, 31,  0, 46,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 47,  0,  1,  0,  0,  0,168,206,229,  2,
- 31,  0, 48,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 49,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 50,  0,  1,  0,  0,  0,
-168,206,229,  2, 31,  0, 51,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 52,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 53,  0,
-  1,  0,  0,  0,168,206,229,  2, 31,  0, 54,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 55,  0,  1,  0,  0,  0,168,206,229,  2,
- 31,  0, 56,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 57,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 58,  0,  1,  0,  0,  0,
-168,206,229,  2, 31,  0, 59,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 60,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 61,  0,
-  1,  0,  0,  0,168,206,229,  2, 31,  0, 62,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 63,  0,  1,  0,  0,  0,168,206,229,  2,
- 31,  0, 64,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 65,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 66,  0,  1,  0,  0,  0,
-168,206,229,  2, 31,  0, 67,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 68,  0,  1,  0,  0,  0,168,206,229,  2, 31,  0, 69,  0,
-  1,  0,  0,  0,168,206,229,  2, 31,  0,  0,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0,  1,  0,  1,  0,  0,  0,176,209,229,  2,
- 31,  0,  2,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0,  3,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0,  4,  0,  1,  0,  0,  0,
-176,209,229,  2, 31,  0,  5,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0,  6,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0,  7,  0,
-  1,  0,  0,  0,176,209,229,  2, 31,  0,  8,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0,  9,  0,  1,  0,  0,  0,176,209,229,  2,
- 31,  0, 10,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 11,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 12,  0,  1,  0,  0,  0,
-176,209,229,  2, 31,  0, 13,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 14,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 15,  0,
-  1,  0,  0,  0,176,209,229,  2, 31,  0, 16,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 17,  0,  1,  0,  0,  0,176,209,229,  2,
- 31,  0, 18,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 19,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 20,  0,  1,  0,  0,  0,
-176,209,229,  2, 31,  0, 21,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 22,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 23,  0,
-  1,  0,  0,  0,176,209,229,  2, 31,  0, 24,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 25,  0,  1,  0,  0,  0,176,209,229,  2,
- 31,  0, 26,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 27,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 28,  0,  1,  0,  0,  0,
-176,209,229,  2, 31,  0, 29,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 30,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 31,  0,
-  1,  0,  0,  0,176,209,229,  2, 31,  0, 32,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 33,  0,  1,  0,  0,  0,176,209,229,  2,
- 31,  0, 34,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 35,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 36,  0,  1,  0,  0,  0,
-176,209,229,  2, 31,  0, 37,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 38,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 39,  0,
-  1,  0,  0,  0,176,209,229,  2, 31,  0, 40,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 41,  0,  1,  0,  0,  0,176,209,229,  2,
- 31,  0, 42,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 43,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 44,  0,  1,  0,  0,  0,
-176,209,229,  2, 31,  0, 45,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 46,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 47,  0,
-  1,  0,  0,  0,176,209,229,  2, 31,  0, 48,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 49,  0,  1,  0,  0,  0,176,209,229,  2,
- 31,  0, 50,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 51,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 52,  0,  1,  0,  0,  0,
-176,209,229,  2, 31,  0, 53,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 54,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 55,  0,
-  1,  0,  0,  0,176,209,229,  2, 31,  0, 56,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 57,  0,  1,  0,  0,  0,176,209,229,  2,
- 31,  0, 58,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 59,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 60,  0,  1,  0,  0,  0,
-176,209,229,  2, 31,  0, 61,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 62,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 63,  0,
-  1,  0,  0,  0,176,209,229,  2, 31,  0, 64,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 65,  0,  1,  0,  0,  0,176,209,229,  2,
- 31,  0, 66,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 67,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0, 68,  0,  1,  0,  0,  0,
-176,209,229,  2, 31,  0, 69,  0,  1,  0,  0,  0,176,209,229,  2, 31,  0,  0,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0,  1,  0,
-  1,  0,  0,  0,184,212,229,  2, 31,  0,  2,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0,  3,  0,  1,  0,  0,  0,184,212,229,  2,
- 31,  0,  4,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0,  5,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0,  6,  0,  1,  0,  0,  0,
-184,212,229,  2, 31,  0,  7,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0,  8,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0,  9,  0,
-  1,  0,  0,  0,184,212,229,  2, 31,  0, 10,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 11,  0,  1,  0,  0,  0,184,212,229,  2,
- 31,  0, 12,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 13,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 14,  0,  1,  0,  0,  0,
-184,212,229,  2, 31,  0, 15,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 16,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 17,  0,
-  1,  0,  0,  0,184,212,229,  2, 31,  0, 18,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 19,  0,  1,  0,  0,  0,184,212,229,  2,
- 31,  0, 20,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 21,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 22,  0,  1,  0,  0,  0,
-184,212,229,  2, 31,  0, 23,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 24,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 25,  0,
-  1,  0,  0,  0,184,212,229,  2, 31,  0, 26,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 27,  0,  1,  0,  0,  0,184,212,229,  2,
- 31,  0, 28,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 29,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 30,  0,  1,  0,  0,  0,
-184,212,229,  2, 31,  0, 31,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 32,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 33,  0,
-  1,  0,  0,  0,184,212,229,  2, 31,  0, 34,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 35,  0,  1,  0,  0,  0,184,212,229,  2,
- 31,  0, 36,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 37,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 38,  0,  1,  0,  0,  0,
-184,212,229,  2, 31,  0, 39,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 40,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 41,  0,
-  1,  0,  0,  0,184,212,229,  2, 31,  0, 42,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 43,  0,  1,  0,  0,  0,184,212,229,  2,
- 31,  0, 44,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 45,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 46,  0,  1,  0,  0,  0,
-184,212,229,  2, 31,  0, 47,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 48,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 49,  0,
-  1,  0,  0,  0,184,212,229,  2, 31,  0, 50,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 51,  0,  1,  0,  0,  0,184,212,229,  2,
- 31,  0, 52,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 53,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 54,  0,  1,  0,  0,  0,
-184,212,229,  2, 31,  0, 55,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 56,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 57,  0,
-  1,  0,  0,  0,184,212,229,  2, 31,  0, 58,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 59,  0,  1,  0,  0,  0,184,212,229,  2,
- 31,  0, 60,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 61,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 62,  0,  1,  0,  0,  0,
-184,212,229,  2, 31,  0, 63,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 64,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 65,  0,
-  1,  0,  0,  0,184,212,229,  2, 31,  0, 66,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 67,  0,  1,  0,  0,  0,184,212,229,  2,
- 31,  0, 68,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0, 69,  0,  1,  0,  0,  0,184,212,229,  2, 31,  0,  0,  0,  1,  0,  0,  0,
-192,215,229,  2, 31,  0,  1,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0,  2,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0,  3,  0,
-  1,  0,  0,  0,192,215,229,  2, 31,  0,  4,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0,  5,  0,  1,  0,  0,  0,192,215,229,  2,
- 31,  0,  6,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0,  7,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0,  8,  0,  1,  0,  0,  0,
-192,215,229,  2, 31,  0,  9,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 10,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 11,  0,
-  1,  0,  0,  0,192,215,229,  2, 31,  0, 12,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 13,  0,  1,  0,  0,  0,192,215,229,  2,
- 31,  0, 14,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 15,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 16,  0,  1,  0,  0,  0,
-192,215,229,  2, 31,  0, 17,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 18,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 19,  0,
-  1,  0,  0,  0,192,215,229,  2, 31,  0, 20,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 21,  0,  1,  0,  0,  0,192,215,229,  2,
- 31,  0, 22,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 23,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 24,  0,  1,  0,  0,  0,
-192,215,229,  2, 31,  0, 25,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 26,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 27,  0,
-  1,  0,  0,  0,192,215,229,  2, 31,  0, 28,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 29,  0,  1,  0,  0,  0,192,215,229,  2,
- 31,  0, 30,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 31,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 32,  0,  1,  0,  0,  0,
-192,215,229,  2, 31,  0, 33,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 34,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 35,  0,
-  1,  0,  0,  0,192,215,229,  2, 31,  0, 36,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 37,  0,  1,  0,  0,  0,192,215,229,  2,
- 31,  0, 38,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 39,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 40,  0,  1,  0,  0,  0,
-192,215,229,  2, 31,  0, 41,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 42,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 43,  0,
-  1,  0,  0,  0,192,215,229,  2, 31,  0, 44,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 45,  0,  1,  0,  0,  0,192,215,229,  2,
- 31,  0, 46,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 47,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 48,  0,  1,  0,  0,  0,
-192,215,229,  2, 31,  0, 49,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 50,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 51,  0,
-  1,  0,  0,  0,192,215,229,  2, 31,  0, 52,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 53,  0,  1,  0,  0,  0,192,215,229,  2,
- 31,  0, 54,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 55,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 56,  0,  1,  0,  0,  0,
-192,215,229,  2, 31,  0, 57,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 58,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 59,  0,
-  1,  0,  0,  0,192,215,229,  2, 31,  0, 60,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 61,  0,  1,  0,  0,  0,192,215,229,  2,
- 31,  0, 62,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 63,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 64,  0,  1,  0,  0,  0,
-192,215,229,  2, 31,  0, 65,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 66,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 67,  0,
-  1,  0,  0,  0,192,215,229,  2, 31,  0, 68,  0,  1,  0,  0,  0,192,215,229,  2, 31,  0, 69,  0,  1,  0,  0,  0,192,215,229,  2,
- 31,  0,  0,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0,  1,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0,  2,  0,  1,  0,  0,  0,
-200,218,229,  2, 31,  0,  3,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0,  4,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0,  5,  0,
-  1,  0,  0,  0,200,218,229,  2, 31,  0,  6,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0,  7,  0,  1,  0,  0,  0,200,218,229,  2,
- 31,  0,  8,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0,  9,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 10,  0,  1,  0,  0,  0,
-200,218,229,  2, 31,  0, 11,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 12,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 13,  0,
-  1,  0,  0,  0,200,218,229,  2, 31,  0, 14,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 15,  0,  1,  0,  0,  0,200,218,229,  2,
- 31,  0, 16,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 17,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 18,  0,  1,  0,  0,  0,
-200,218,229,  2, 31,  0, 19,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 20,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 21,  0,
-  1,  0,  0,  0,200,218,229,  2, 31,  0, 22,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 23,  0,  1,  0,  0,  0,200,218,229,  2,
- 31,  0, 24,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 25,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 26,  0,  1,  0,  0,  0,
-200,218,229,  2, 31,  0, 27,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 28,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 29,  0,
-  1,  0,  0,  0,200,218,229,  2, 31,  0, 30,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 31,  0,  1,  0,  0,  0,200,218,229,  2,
- 31,  0, 32,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 33,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 34,  0,  1,  0,  0,  0,
-200,218,229,  2, 31,  0, 35,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 36,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 37,  0,
-  1,  0,  0,  0,200,218,229,  2, 31,  0, 38,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 39,  0,  1,  0,  0,  0,200,218,229,  2,
- 31,  0, 40,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 41,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 42,  0,  1,  0,  0,  0,
-200,218,229,  2, 31,  0, 43,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 44,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 45,  0,
-  1,  0,  0,  0,200,218,229,  2, 31,  0, 46,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 47,  0,  1,  0,  0,  0,200,218,229,  2,
- 31,  0, 48,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 49,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 50,  0,  1,  0,  0,  0,
-200,218,229,  2, 31,  0, 51,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 52,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 53,  0,
-  1,  0,  0,  0,200,218,229,  2, 31,  0, 54,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 55,  0,  1,  0,  0,  0,200,218,229,  2,
- 31,  0, 56,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 57,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 58,  0,  1,  0,  0,  0,
-200,218,229,  2, 31,  0, 59,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 60,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 61,  0,
-  1,  0,  0,  0,200,218,229,  2, 31,  0, 62,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 63,  0,  1,  0,  0,  0,200,218,229,  2,
- 31,  0, 64,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 65,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 66,  0,  1,  0,  0,  0,
-200,218,229,  2, 31,  0, 67,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 68,  0,  1,  0,  0,  0,200,218,229,  2, 31,  0, 69,  0,
-  1,  0,  0,  0,200,218,229,  2, 31,  0,  0,  0,  1,  0,  0,  0,184,  8,228,  2, 31,  0,  1,  0,  1,  0,  0,  0,184,  8,228,  2,
- 31,  0,  2,  0,  1,  0,  0,  0,184,  8,228,  2, 31,  0,  3,  0,  1,  0,  0,  0,184,  8,228,  2, 31,  0,  4,  0,  1,  0,  0,  0,
-184,  8,228,  2, 31,  0,  5,  0,  1,  0,  0,  0,184,  8,228,  2, 31,  0,  6,  0,  1,  0,  0,  0,184,  8,228,  2, 31,  0,  7,  0,
-  1,  0,  0,  0,184,  8,228,  2, 31,  0,  8,  0,  1,  0,  0,  0,184,  8,228,  2, 31,  0,  9,  0,  1,  0,  0,  0,184,  8,228,  2,
- 31,  0, 10,  0,  1,  0,  0,  0,184,  8,228,  2, 31,  0, 11,  0,  1,  0,  0,  0,184,  8,228,  2, 31,  0, 12,  0,  1,  0,  0,  0,
-184,  8,228,  2, 31,  0, 13,  0,  1,  0,  0,  0,184,  8,228,  2, 31,  0, 14,  0,  1,  0,  0,  0,184,  8,228,  2, 31,  0, 15,  0,
-  1,  0,  0,  0,184,  8,228,  2, 31,  0, 16,  0,  1,  0,  0,  0,184,  8,228,  2, 31,  0, 17,  0,  1,  0,  0,  0,184,  8,228,  2,
- 31,  0, 18,  0,  1,  0,  0,  0,184,  8,228,  2, 31,  0, 19,  0,  1,  0,  0,  0,184,  8,228,  2, 31,  0, 20,  0,  1,  0,  0,  0,
-184,  8,228,  2, 31,  0, 21,  0,  1,  0,  0,  0,184,  8,228,  2, 31,  0, 22,  0,  1,  0,  0,  0,184,  8,228,  2, 31,  0, 23,  0,
-  1,  0,  0,  0,184,  8,228,  2, 31,  0, 24,  0,  1,  0,  0,  0,184,  8,228,  2, 31,  0, 25,  0,  1,  0,  0,  0,184,  8,228,  2,
- 31,  0,  0,  0,  1,  0,  0,  0, 80,  9,228,  2, 31,  0,  1,  0,  1,  0,  0,  0, 80,  9,228,  2, 31,  0,  2,  0,  1,  0,  0,  0,
- 80,  9,228,  2, 31,  0,  3,  0,  1,  0,  0,  0, 80,  9,228,  2, 31,  0,  4,  0,  1,  0,  0,  0, 80,  9,228,  2, 31,  0,  5,  0,
-  1,  0,  0,  0, 80,  9,228,  2, 31,  0,  6,  0,  1,  0,  0,  0, 80,  9,228,  2, 31,  0,  7,  0,  1,  0,  0,  0, 80,  9,228,  2,
- 31,  0,  8,  0,  1,  0,  0,  0, 80,  9,228,  2, 31,  0,  9,  0,  1,  0,  0,  0, 80,  9,228,  2, 31,  0, 10,  0,  1,  0,  0,  0,
- 80,  9,228,  2, 31,  0, 11,  0,  1,  0,  0,  0, 80,  9,228,  2, 31,  0, 12,  0,  1,  0,  0,  0, 80,  9,228,  2, 31,  0, 13,  0,
-  1,  0,  0,  0, 80,  9,228,  2, 31,  0, 14,  0,  1,  0,  0,  0, 80,  9,228,  2, 31,  0, 15,  0,  1,  0,  0,  0, 80,  9,228,  2,
- 31,  0, 16,  0,  1,  0,  0,  0, 80,  9,228,  2, 31,  0, 17,  0,  1,  0,  0,  0, 80,  9,228,  2, 31,  0, 18,  0,  1,  0,  0,  0,
- 80,  9,228,  2, 31,  0, 19,  0,  1,  0,  0,  0, 80,  9,228,  2, 31,  0, 20,  0,  1,  0,  0,  0, 80,  9,228,  2, 31,  0, 21,  0,
-  1,  0,  0,  0, 80,  9,228,  2, 31,  0, 22,  0,  1,  0,  0,  0, 80,  9,228,  2, 31,  0, 23,  0,  1,  0,  0,  0, 80,  9,228,  2,
- 31,  0, 24,  0,  1,  0,  0,  0, 80,  9,228,  2, 31,  0, 25,  0,  1,  0,  0,  0, 80,  9,228,  2, 31,  0, 26,  0,  1,  0,  0,  0,
- 80,  9,228,  2, 31,  0, 27,  0,  1,  0,  0,  0, 80,  9,228,  2, 31,  0, 28,  0,  1,  0,  0,  0, 80,  9,228,  2, 31,  0, 29,  0,
-  1,  0,  0,  0, 80,  9,228,  2, 31,  0, 30,  0,  1,  0,  0,  0, 80,  9,228,  2, 31,  0,  0,  0,  1,  0,  0,  0, 32, 26,228,  2,
- 31,  0,  1,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0,  2,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0,  3,  0,  1,  0,  0,  0,
- 32, 26,228,  2, 31,  0,  4,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0,  5,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0,  6,  0,
-  1,  0,  0,  0, 32, 26,228,  2, 31,  0,  7,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0,  8,  0,  1,  0,  0,  0, 32, 26,228,  2,
- 31,  0,  9,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 10,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 11,  0,  1,  0,  0,  0,
- 32, 26,228,  2, 31,  0, 12,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 13,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 14,  0,
-  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 15,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 16,  0,  1,  0,  0,  0, 32, 26,228,  2,
- 31,  0, 17,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 18,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 19,  0,  1,  0,  0,  0,
- 32, 26,228,  2, 31,  0, 20,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 21,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 22,  0,
-  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 23,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 24,  0,  1,  0,  0,  0, 32, 26,228,  2,
- 31,  0, 25,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 26,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 27,  0,  1,  0,  0,  0,
- 32, 26,228,  2, 31,  0, 28,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 29,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 30,  0,
-  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 31,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 32,  0,  1,  0,  0,  0, 32, 26,228,  2,
- 31,  0, 33,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 34,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 35,  0,  1,  0,  0,  0,
- 32, 26,228,  2, 31,  0, 36,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 37,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 38,  0,
-  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 39,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 40,  0,  1,  0,  0,  0, 32, 26,228,  2,
- 31,  0, 41,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 42,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 43,  0,  1,  0,  0,  0,
- 32, 26,228,  2, 31,  0, 44,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 45,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 46,  0,
-  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 47,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 48,  0,  1,  0,  0,  0, 32, 26,228,  2,
- 31,  0, 49,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 50,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 51,  0,  1,  0,  0,  0,
- 32, 26,228,  2, 31,  0, 52,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 53,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 54,  0,
-  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 55,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 56,  0,  1,  0,  0,  0, 32, 26,228,  2,
- 31,  0, 57,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 58,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 59,  0,  1,  0,  0,  0,
- 32, 26,228,  2, 31,  0, 60,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 61,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 62,  0,
-  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 63,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 64,  0,  1,  0,  0,  0, 32, 26,228,  2,
- 31,  0, 65,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 66,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 67,  0,  1,  0,  0,  0,
- 32, 26,228,  2, 31,  0, 68,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 69,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 70,  0,
-  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 71,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 72,  0,  1,  0,  0,  0, 32, 26,228,  2,
- 31,  0, 73,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 74,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 75,  0,  1,  0,  0,  0,
- 32, 26,228,  2, 31,  0, 76,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 77,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 78,  0,
-  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 79,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 80,  0,  1,  0,  0,  0, 32, 26,228,  2,
- 31,  0, 81,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 82,  0,  1,  0,  0,  0, 32, 26,228,  2, 31,  0, 83,  0,  1,  0,  0,  0,
- 32, 26,228,  2, 31,  0,  0,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0,  1,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0,  2,  0,
-  1,  0,  0,  0,144, 30,221,  2, 31,  0,  3,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0,  4,  0,  1,  0,  0,  0,144, 30,221,  2,
- 31,  0,  5,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0,  6,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0,  7,  0,  1,  0,  0,  0,
-144, 30,221,  2, 31,  0,  8,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0,  9,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 10,  0,
-  1,  0,  0,  0,144, 30,221,  2, 31,  0, 11,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 12,  0,  1,  0,  0,  0,144, 30,221,  2,
- 31,  0, 13,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 14,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 15,  0,  1,  0,  0,  0,
-144, 30,221,  2, 31,  0, 16,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 17,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 18,  0,
-  1,  0,  0,  0,144, 30,221,  2, 31,  0, 19,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 20,  0,  1,  0,  0,  0,144, 30,221,  2,
- 31,  0, 21,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 22,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 23,  0,  1,  0,  0,  0,
-144, 30,221,  2, 31,  0, 24,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 25,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 26,  0,
-  1,  0,  0,  0,144, 30,221,  2, 31,  0, 27,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 28,  0,  1,  0,  0,  0,144, 30,221,  2,
- 31,  0, 29,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 30,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 31,  0,  1,  0,  0,  0,
-144, 30,221,  2, 31,  0, 32,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 33,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 34,  0,
-  1,  0,  0,  0,144, 30,221,  2, 31,  0, 35,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 36,  0,  1,  0,  0,  0,144, 30,221,  2,
- 31,  0, 37,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 38,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 39,  0,  1,  0,  0,  0,
-144, 30,221,  2, 31,  0, 40,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 41,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 42,  0,
-  1,  0,  0,  0,144, 30,221,  2, 31,  0, 43,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 44,  0,  1,  0,  0,  0,144, 30,221,  2,
- 31,  0, 45,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 46,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 47,  0,  1,  0,  0,  0,
-144, 30,221,  2, 31,  0, 48,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 49,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0, 50,  0,
-  1,  0,  0,  0,144, 30,221,  2, 31,  0, 51,  0,  1,  0,  0,  0,144, 30,221,  2, 31,  0,  0,  0,  1,  0,  0,  0,144, 12,228,  2,
- 31,  0,  1,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0,  2,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0,  3,  0,  1,  0,  0,  0,
-144, 12,228,  2, 31,  0,  4,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0,  5,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0,  6,  0,
-  1,  0,  0,  0,144, 12,228,  2, 31,  0,  7,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0,  8,  0,  1,  0,  0,  0,144, 12,228,  2,
- 31,  0,  9,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 10,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 11,  0,  1,  0,  0,  0,
-144, 12,228,  2, 31,  0, 12,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 13,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 14,  0,
-  1,  0,  0,  0,144, 12,228,  2, 31,  0, 15,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 16,  0,  1,  0,  0,  0,144, 12,228,  2,
- 31,  0, 17,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 18,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 19,  0,  1,  0,  0,  0,
-144, 12,228,  2, 31,  0, 20,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 21,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 22,  0,
-  1,  0,  0,  0,144, 12,228,  2, 31,  0, 23,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 24,  0,  1,  0,  0,  0,144, 12,228,  2,
- 31,  0, 25,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 26,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 27,  0,  1,  0,  0,  0,
-144, 12,228,  2, 31,  0, 28,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 29,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 30,  0,
-  1,  0,  0,  0,144, 12,228,  2, 31,  0, 31,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 32,  0,  1,  0,  0,  0,144, 12,228,  2,
- 31,  0, 33,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 34,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 35,  0,  1,  0,  0,  0,
-144, 12,228,  2, 31,  0, 36,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 37,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 38,  0,
-  1,  0,  0,  0,144, 12,228,  2, 31,  0, 39,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 40,  0,  1,  0,  0,  0,144, 12,228,  2,
- 31,  0, 41,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 42,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 43,  0,  1,  0,  0,  0,
-144, 12,228,  2, 31,  0, 44,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 45,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 46,  0,
-  1,  0,  0,  0,144, 12,228,  2, 31,  0, 47,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 48,  0,  1,  0,  0,  0,144, 12,228,  2,
- 31,  0, 49,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 50,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 51,  0,  1,  0,  0,  0,
-144, 12,228,  2, 31,  0, 52,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 53,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 54,  0,
-  1,  0,  0,  0,144, 12,228,  2, 31,  0, 55,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 56,  0,  1,  0,  0,  0,144, 12,228,  2,
- 31,  0, 57,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 58,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 59,  0,  1,  0,  0,  0,
-144, 12,228,  2, 31,  0, 60,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 61,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 62,  0,
-  1,  0,  0,  0,144, 12,228,  2, 31,  0, 63,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 64,  0,  1,  0,  0,  0,144, 12,228,  2,
- 31,  0, 65,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 66,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 67,  0,  1,  0,  0,  0,
-144, 12,228,  2, 31,  0, 68,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 69,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 70,  0,
-  1,  0,  0,  0,144, 12,228,  2, 31,  0, 71,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 72,  0,  1,  0,  0,  0,144, 12,228,  2,
- 31,  0, 73,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 74,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 75,  0,  1,  0,  0,  0,
-144, 12,228,  2, 31,  0, 76,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 77,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 78,  0,
-  1,  0,  0,  0,144, 12,228,  2, 31,  0, 79,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 80,  0,  1,  0,  0,  0,144, 12,228,  2,
- 31,  0, 81,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 82,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 83,  0,  1,  0,  0,  0,
-144, 12,228,  2, 31,  0, 84,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 85,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 86,  0,
-  1,  0,  0,  0,144, 12,228,  2, 31,  0, 87,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 88,  0,  1,  0,  0,  0,144, 12,228,  2,
- 31,  0, 89,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 90,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 91,  0,  1,  0,  0,  0,
-144, 12,228,  2, 31,  0, 92,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 93,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 94,  0,
-  1,  0,  0,  0,144, 12,228,  2, 31,  0, 95,  0,  1,  0,  0,  0,144, 12,228,  2, 31,  0, 96,  0,  1,  0,  0,  0,144, 12,228,  2,
- 31,  0,  0,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0,  1,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0,  2,  0,  1,  0,  0,  0,
-240, 16,228,  2, 31,  0,  3,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0,  4,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0,  5,  0,
-  1,  0,  0,  0,240, 16,228,  2, 31,  0,  6,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0,  7,  0,  1,  0,  0,  0,240, 16,228,  2,
- 31,  0,  8,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0,  9,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 10,  0,  1,  0,  0,  0,
-240, 16,228,  2, 31,  0, 11,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 12,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 13,  0,
-  1,  0,  0,  0,240, 16,228,  2, 31,  0, 14,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 15,  0,  1,  0,  0,  0,240, 16,228,  2,
- 31,  0, 16,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 17,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 18,  0,  1,  0,  0,  0,
-240, 16,228,  2, 31,  0, 19,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 20,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 21,  0,
-  1,  0,  0,  0,240, 16,228,  2, 31,  0, 22,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 23,  0,  1,  0,  0,  0,240, 16,228,  2,
- 31,  0, 24,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 25,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 26,  0,  1,  0,  0,  0,
-240, 16,228,  2, 31,  0, 27,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 28,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 29,  0,
-  1,  0,  0,  0,240, 16,228,  2, 31,  0, 30,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 31,  0,  1,  0,  0,  0,240, 16,228,  2,
- 31,  0, 32,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 33,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 34,  0,  1,  0,  0,  0,
-240, 16,228,  2, 31,  0, 35,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 36,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 37,  0,
-  1,  0,  0,  0,240, 16,228,  2, 31,  0, 38,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 39,  0,  1,  0,  0,  0,240, 16,228,  2,
- 31,  0, 40,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 41,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 42,  0,  1,  0,  0,  0,
-240, 16,228,  2, 31,  0, 43,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 44,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 45,  0,
-  1,  0,  0,  0,240, 16,228,  2, 31,  0, 46,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 47,  0,  1,  0,  0,  0,240, 16,228,  2,
- 31,  0, 48,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 49,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 50,  0,  1,  0,  0,  0,
-240, 16,228,  2, 31,  0, 51,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 52,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 53,  0,
-  1,  0,  0,  0,240, 16,228,  2, 31,  0, 54,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 55,  0,  1,  0,  0,  0,240, 16,228,  2,
- 31,  0, 56,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 57,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 58,  0,  1,  0,  0,  0,
-240, 16,228,  2, 31,  0, 59,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 60,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 61,  0,
-  1,  0,  0,  0,240, 16,228,  2, 31,  0, 62,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 63,  0,  1,  0,  0,  0,240, 16,228,  2,
- 31,  0, 64,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 65,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 66,  0,  1,  0,  0,  0,
-240, 16,228,  2, 31,  0, 67,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 68,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 69,  0,
-  1,  0,  0,  0,240, 16,228,  2, 31,  0, 70,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 71,  0,  1,  0,  0,  0,240, 16,228,  2,
- 31,  0, 72,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 73,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 74,  0,  1,  0,  0,  0,
-240, 16,228,  2, 31,  0, 75,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 76,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 77,  0,
-  1,  0,  0,  0,240, 16,228,  2, 31,  0, 78,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 79,  0,  1,  0,  0,  0,240, 16,228,  2,
- 31,  0, 80,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 81,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 82,  0,  1,  0,  0,  0,
-240, 16,228,  2, 31,  0, 83,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 84,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 85,  0,
-  1,  0,  0,  0,240, 16,228,  2, 31,  0, 86,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 87,  0,  1,  0,  0,  0,240, 16,228,  2,
- 31,  0, 88,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 89,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 90,  0,  1,  0,  0,  0,
-240, 16,228,  2, 31,  0, 91,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 92,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 93,  0,
-  1,  0,  0,  0,240, 16,228,  2, 31,  0, 94,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0, 95,  0,  1,  0,  0,  0,240, 16,228,  2,
- 31,  0, 96,  0,  1,  0,  0,  0,240, 16,228,  2, 31,  0,  0,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0,  1,  0,  1,  0,  0,  0,
-192, 21,228,  2, 31,  0,  2,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0,  3,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0,  4,  0,
-  1,  0,  0,  0,192, 21,228,  2, 31,  0,  5,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0,  6,  0,  1,  0,  0,  0,192, 21,228,  2,
- 31,  0,  7,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0,  8,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0,  9,  0,  1,  0,  0,  0,
-192, 21,228,  2, 31,  0, 10,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 11,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 12,  0,
-  1,  0,  0,  0,192, 21,228,  2, 31,  0, 13,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 14,  0,  1,  0,  0,  0,192, 21,228,  2,
- 31,  0, 15,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 16,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 17,  0,  1,  0,  0,  0,
-192, 21,228,  2, 31,  0, 18,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 19,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 20,  0,
-  1,  0,  0,  0,192, 21,228,  2, 31,  0, 21,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 22,  0,  1,  0,  0,  0,192, 21,228,  2,
- 31,  0, 23,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 24,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 25,  0,  1,  0,  0,  0,
-192, 21,228,  2, 31,  0, 26,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 27,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 28,  0,
-  1,  0,  0,  0,192, 21,228,  2, 31,  0, 29,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 30,  0,  1,  0,  0,  0,192, 21,228,  2,
- 31,  0, 31,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 32,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 33,  0,  1,  0,  0,  0,
-192, 21,228,  2, 31,  0, 34,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 35,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 36,  0,
-  1,  0,  0,  0,192, 21,228,  2, 31,  0, 37,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 38,  0,  1,  0,  0,  0,192, 21,228,  2,
- 31,  0, 39,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 40,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 41,  0,  1,  0,  0,  0,
-192, 21,228,  2, 31,  0, 42,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 43,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 44,  0,
-  1,  0,  0,  0,192, 21,228,  2, 31,  0, 45,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 46,  0,  1,  0,  0,  0,192, 21,228,  2,
- 31,  0, 47,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 48,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 49,  0,  1,  0,  0,  0,
-192, 21,228,  2, 31,  0, 50,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 51,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 52,  0,
-  1,  0,  0,  0,192, 21,228,  2, 31,  0, 53,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 54,  0,  1,  0,  0,  0,192, 21,228,  2,
- 31,  0, 55,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 56,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 57,  0,  1,  0,  0,  0,
-192, 21,228,  2, 31,  0, 58,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 59,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 60,  0,
-  1,  0,  0,  0,192, 21,228,  2, 31,  0, 61,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 62,  0,  1,  0,  0,  0,192, 21,228,  2,
- 31,  0, 63,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 64,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 65,  0,  1,  0,  0,  0,
-192, 21,228,  2, 31,  0, 66,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 67,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 68,  0,
-  1,  0,  0,  0,192, 21,228,  2, 31,  0, 69,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 70,  0,  1,  0,  0,  0,192, 21,228,  2,
- 31,  0, 71,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 72,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 73,  0,  1,  0,  0,  0,
-192, 21,228,  2, 31,  0, 74,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 75,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 76,  0,
-  1,  0,  0,  0,192, 21,228,  2, 31,  0, 77,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 78,  0,  1,  0,  0,  0,192, 21,228,  2,
- 31,  0, 79,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 80,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 81,  0,  1,  0,  0,  0,
-192, 21,228,  2, 31,  0, 82,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 83,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 84,  0,
-  1,  0,  0,  0,192, 21,228,  2, 31,  0, 85,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 86,  0,  1,  0,  0,  0,192, 21,228,  2,
- 31,  0, 87,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 88,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 89,  0,  1,  0,  0,  0,
-192, 21,228,  2, 31,  0, 90,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 91,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 92,  0,
-  1,  0,  0,  0,192, 21,228,  2, 31,  0, 93,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 94,  0,  1,  0,  0,  0,192, 21,228,  2,
- 31,  0, 95,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0, 96,  0,  1,  0,  0,  0,192, 21,228,  2, 31,  0,  0,  0,  1,  0,  0,  0,
- 40,249,213,  2, 31,  0,  1,  0,  1,  0,  0,  0, 40,249,213,  2, 31,  0,  2,  0,  1,  0,  0,  0, 40,249,213,  2, 31,  0,  3,  0,
-  1,  0,  0,  0, 40,249,213,  2, 31,  0,  4,  0,  1,  0,  0,  0, 40,249,213,  2, 31,  0,  5,  0,  1,  0,  0,  0, 40,249,213,  2,
- 31,  0,  6,  0,  1,  0,  0,  0, 40,249,213,  2, 31,  0,  7,  0,  1,  0,  0,  0, 40,249,213,  2, 31,  0,  8,  0,  1,  0,  0,  0,
- 40,249,213,  2, 31,  0,  9,  0,  1,  0,  0,  0, 40,249,213,  2, 31,  0,  0,  0,  1,  0,  0,  0,240,249,213,  2, 31,  0,  1,  0,
-  1,  0,  0,  0,240,249,213,  2, 31,  0,  2,  0,  1,  0,  0,  0,240,249,213,  2, 31,  0,  3,  0,  1,  0,  0,  0,240,249,213,  2,
- 31,  0,  4,  0,  1,  0,  0,  0,240,249,213,  2, 31,  0,  5,  0,  1,  0,  0,  0,240,249,213,  2, 31,  0,  6,  0,  1,  0,  0,  0,
-240,249,213,  2, 31,  0,  7,  0,  1,  0,  0,  0,240,249,213,  2, 31,  0,  8,  0,  1,  0,  0,  0,240,249,213,  2, 31,  0,  9,  0,
-  1,  0,  0,  0,240,249,213,  2, 31,  0,  0,  0,  1,  0,  0,  0,184,250,213,  2, 31,  0,  1,  0,  1,  0,  0,  0,184,250,213,  2,
- 31,  0,  2,  0,  1,  0,  0,  0,184,250,213,  2, 31,  0,  3,  0,  1,  0,  0,  0,184,250,213,  2, 31,  0,  4,  0,  1,  0,  0,  0,
-184,250,213,  2, 31,  0,  5,  0,  1,  0,  0,  0,184,250,213,  2, 31,  0,  6,  0,  1,  0,  0,  0,184,250,213,  2, 31,  0,  7,  0,
-  1,  0,  0,  0,184,250,213,  2, 31,  0,  8,  0,  1,  0,  0,  0,184,250,213,  2, 31,  0,  9,  0,  1,  0,  0,  0,184,250,213,  2,
- 31,  0,  0,  0,  1,  0,  0,  0,128,251,213,  2, 31,  0,  1,  0,  1,  0,  0,  0,128,251,213,  2, 31,  0,  2,  0,  1,  0,  0,  0,
-128,251,213,  2, 31,  0,  3,  0,  1,  0,  0,  0,128,251,213,  2, 31,  0,  4,  0,  1,  0,  0,  0,128,251,213,  2, 31,  0,  5,  0,
-  1,  0,  0,  0,128,251,213,  2, 31,  0,  6,  0,  1,  0,  0,  0,128,251,213,  2, 31,  0,  7,  0,  1,  0,  0,  0,128,251,213,  2,
- 31,  0,  8,  0,  1,  0,  0,  0,128,251,213,  2, 31,  0,  9,  0,  1,  0,  0,  0,128,251,213,  2, 31,  0,  0,  0,  1,  0,  0,  0,
- 72,252,213,  2, 31,  0,  1,  0,  1,  0,  0,  0, 72,252,213,  2, 31,  0,  2,  0,  1,  0,  0,  0, 72,252,213,  2, 31,  0,  3,  0,
-  1,  0,  0,  0, 72,252,213,  2, 31,  0,  4,  0,  1,  0,  0,  0, 72,252,213,  2, 31,  0,  5,  0,  1,  0,  0,  0, 72,252,213,  2,
- 31,  0,  6,  0,  1,  0,  0,  0, 72,252,213,  2, 31,  0,  7,  0,  1,  0,  0,  0, 72,252,213,  2, 31,  0,  8,  0,  1,  0,  0,  0,
- 72,252,213,  2, 31,  0,  9,  0,  1,  0,  0,  0, 72,252,213,  2, 31,  0,  0,  0,  1,  0,  0,  0, 16,253,213,  2, 31,  0,  1,  0,
-  1,  0,  0,  0, 16,253,213,  2, 31,  0,  2,  0,  1,  0,  0,  0, 16,253,213,  2, 31,  0,  3,  0,  1,  0,  0,  0, 16,253,213,  2,
- 31,  0,  4,  0,  1,  0,  0,  0, 16,253,213,  2, 31,  0,  5,  0,  1,  0,  0,  0, 16,253,213,  2, 31,  0,  6,  0,  1,  0,  0,  0,
- 16,253,213,  2, 31,  0,  7,  0,  1,  0,  0,  0, 16,253,213,  2, 31,  0,  8,  0,  1,  0,  0,  0, 16,253,213,  2, 31,  0,  9,  0,
-  1,  0,  0,  0, 16,253,213,  2, 31,  0,  0,  0,  1,  0,  0,  0,216,253,213,  2, 31,  0,  1,  0,  1,  0,  0,  0,216,253,213,  2,
- 31,  0,  2,  0,  1,  0,  0,  0,216,253,213,  2, 31,  0,  3,  0,  1,  0,  0,  0,216,253,213,  2, 31,  0,  4,  0,  1,  0,  0,  0,
-216,253,213,  2, 31,  0,  5,  0,  1,  0,  0,  0,216,253,213,  2, 31,  0,  6,  0,  1,  0,  0,  0,216,253,213,  2, 31,  0,  7,  0,
-  1,  0,  0,  0,216,253,213,  2, 31,  0,  8,  0,  1,  0,  0,  0,216,253,213,  2, 31,  0,  9,  0,  1,  0,  0,  0,216,253,213,  2,
- 31,  0,  0,  0,  1,  0,  0,  0,  8, 97,223,  2, 31,  0,  1,  0,  1,  0,  0,  0,  8, 97,223,  2, 31,  0,  2,  0,  1,  0,  0,  0,
-  8, 97,223,  2, 31,  0,  3,  0,  1,  0,  0,  0,  8, 97,223,  2, 31,  0,  4,  0,  1,  0,  0,  0,  8, 97,223,  2, 31,  0,  5,  0,
-  1,  0,  0,  0,  8, 97,223,  2, 31,  0,  6,  0,  1,  0,  0,  0,  8, 97,223,  2, 31,  0,  7,  0,  1,  0,  0,  0,  8, 97,223,  2,
- 31,  0,  8,  0,  1,  0,  0,  0,  8, 97,223,  2, 31,  0,  9,  0,  1,  0,  0,  0,  8, 97,223,  2, 31,  0, 10,  0,  1,  0,  0,  0,
-  8, 97,223,  2, 31,  0, 11,  0,  1,  0,  0,  0,  8, 97,223,  2, 31,  0, 12,  0,  1,  0,  0,  0,  8, 97,223,  2, 31,  0, 13,  0,
-  1,  0,  0,  0,  8, 97,223,  2, 31,  0, 14,  0,  1,  0,  0,  0,  8, 97,223,  2, 31,  0, 15,  0,  1,  0,  0,  0,  8, 97,223,  2,
- 31,  0, 16,  0,  1,  0,  0,  0,  8, 97,223,  2, 31,  0, 17,  0,  1,  0,  0,  0,  8, 97,223,  2, 31,  0, 18,  0,  1,  0,  0,  0,
-  8, 97,223,  2, 31,  0,  0,  0,  1,  0,  0,  0, 64,192,225,  2, 31,  0,  1,  0,  1,  0,  0,  0, 64,192,225,  2, 31,  0,  2,  0,
-  1,  0,  0,  0, 64,192,225,  2, 31,  0,  3,  0,  1,  0,  0,  0, 64,192,225,  2, 31,  0,  4,  0,  1,  0,  0,  0, 64,192,225,  2,
- 31,  0,  5,  0,  1,  0,  0,  0, 64,192,225,  2, 31,  0,  6,  0,  1,  0,  0,  0, 64,192,225,  2, 31,  0,  7,  0,  1,  0,  0,  0,
- 64,192,225,  2, 31,  0,  8,  0,  1,  0,  0,  0, 64,192,225,  2, 31,  0,  9,  0,  1,  0,  0,  0, 64,192,225,  2, 31,  0, 10,  0,
-  1,  0,  0,  0, 64,192,225,  2, 31,  0,  0,  0,  1,  0,  0,  0,240, 10,228,  2, 31,  0,  1,  0,  1,  0,  0,  0,240, 10,228,  2,
- 31,  0,  2,  0,  1,  0,  0,  0,240, 10,228,  2, 31,  0,  3,  0,  1,  0,  0,  0,240, 10,228,  2, 31,  0,  4,  0,  1,  0,  0,  0,
-240, 10,228,  2, 31,  0,  5,  0,  1,  0,  0,  0,240, 10,228,  2, 31,  0,  6,  0,  1,  0,  0,  0,240, 10,228,  2, 31,  0,  7,  0,
-  1,  0,  0,  0,240, 10,228,  2, 31,  0,  8,  0,  1,  0,  0,  0,240, 10,228,  2, 31,  0,  9,  0,  1,  0,  0,  0,240, 10,228,  2,
- 31,  0, 10,  0,  1,  0,  0,  0,240, 10,228,  2, 31,  0, 11,  0,  1,  0,  0,  0,240, 10,228,  2, 31,  0, 12,  0,  1,  0,  0,  0,
-240, 10,228,  2, 31,  0, 13,  0,  1,  0,  0,  0,240, 10,228,  2, 31,  0, 14,  0,  1,  0,  0,  0,240, 10,228,  2, 31,  0, 15,  0,
-  1,  0,  0,  0,240, 10,228,  2, 31,  0, 16,  0,  1,  0,  0,  0,240, 10,228,  2, 31,  0, 17,  0,  1,  0,  0,  0,240, 10,228,  2,
- 31,  0, 18,  0,  1,  0,  0,  0,240, 10,228,  2, 31,  0, 19,  0,  1,  0,  0,  0,240, 10,228,  2, 31,  0, 20,  0,  1,  0,  0,  0,
-240, 10,228,  2, 68, 65, 84, 65, 96,  0,  0,  0,160, 91,215,  2,197,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 16, 91,215,  2,
-168,  2,226,  2,248,  0,226,  2,208,  1,226,  2,240,  2,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 35,  4,  0,  0, 85,  0,  0,  0,
-194,  2,  0,  0,  1,  1, 36,  4,110,  2,  1,  0,  0,  0,  0,  0,  0,  0,  8,  0, 24,108,206,  2, 40, 38,227,  2, 40, 38,227,  2,
-128, 40,226,  2,  0, 37,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0, 37,220,  3, 32, 35,220,  3, 68, 65, 84, 65,248,  0,  0,  0,
-128, 40,226,  2,198,  0,  0,  0,  1,  0,  0,  0,168, 41,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64,113, 68,  0,  0,  0,  0,
-  0,  0,208, 65,  0,  0,  0,  0,  0,128,132, 68,  0,  0,  0,  0,  0,  0,208, 65,  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, 35,  4,  0,  0,  0,  0,  0,  0,
- 25,  0,  0,  0,  0, 96,132, 68,  0,  0,200, 65,  0, 96,132, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 36,  4, 26,  0, 36,  4, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 35,  4,  0,  0, 85,  0,  0,  0,110,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 36,  4, 26,  0,  9,  0,  1,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-176, 55,206,  2,136, 60,  8,  4,136, 60,  8,  4,  0,  0,  0,  0,  0,  0,  0,  0, 56, 67,  6,  4,176,227,  6,  4,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,168, 41,226,  2,198,  0,  0,  0,  1,  0,  0,  0,208, 42,226,  2,128, 40,226,  2,
-  0,  0,  0,  0,  0,  0, 32, 67,  0,192,  6,196,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 15, 67,  0,  0,190,195,  0,  0,  0,  0,
-143,  0,  0,  0,160,  0,  0,  0,  0,  0,  0,  0,123,  1,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,
-  0,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  0,123,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0, 63,  0,  0,  0, 64, 10,  1,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,160,  0,124,  1,143,  0,124,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,159,  0,  0,  0, 71,  1,  0,  0,194,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,160,  0,124,  1, 10,  0,  5,  0,  3,  0,  0,  0,  0,  0,  0,  0,160,  0, 50,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,144, 54,206,  2,120,129,  4,  4,120,129,  4,  4,152,129,226,  2,152,129,226,  2,
- 56,227,  6,  4,208,225,  6,  4,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 64,  1,  0,  0,152,129,226,  2,196,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,176, 43,221,  3,  0,  0,  0,  0, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,116,111,
-111,108,115, 95,111, 98,106,101, 99,116,109,111,100,101,  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, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,116,111,
-111,108,115, 95,111, 98,106,101, 99,116,109,111,100,101,  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, 79, 98,106,101, 99,116, 32, 84,111,111,108,115,
-  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,  0,  0,  0,  0,233,253,143,  0,255,  1,  0,  0,  0,  0,
-  0,  0, 39,  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,  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, 68, 65, 84, 65,248,  0,  0,  0,208, 42,226,  2,198,  0,  0,  0,  1,  0,  0,  0,216, 35,227,  2,168, 41,226,  2,
-  0,  0,  0,  0,  0,  0, 33, 67,  0,  0, 90,195,  0,  0,  0,  0,  0,  0,  0,  0,227,102, 16, 67, 24, 30, 90,195,  0,  0,  0,  0,
-143,  0,  0,  0,160,  0,  0,  0,  0,  0,  0,  0,215,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,
-  0,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  0,215,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0, 63,  0,  0,  0, 64, 10,  3,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,160,  0,216,  0,143,  0,216,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,159,  0,  0,  0,111,  0,  0,  0, 70,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,160,  0,216,  0, 11,  0,  6,  0, 34,  0,  0,  0,  0,  0,  0,  0,  0,  0,216,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 55,206,  2, 80,131,  4,  4, 80,131,  4,  4, 16,131,226,  2, 16,131,226,  2,
- 88,225,  6,  4,240,223,  6,  4,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 64,  1,  0,  0, 16,131,226,  2,196,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 56,112,206,  2,  0,  0,  0,  0, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,108, 97,
-115,116, 95,111,112,101,114, 97,116,111,114,  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, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,108, 97,
-115,116, 95,111,112,101,114, 97,116,111,114,  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, 79,112,101,114, 97,116,111,114,  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,  0,  0,  0,  0,  0,  0,  0,  0,216,255,144,  0, 16,  0,  0,  0,  0,  0,
-  0,  0, 39,  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,  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, 68, 65, 84, 65,248,  0,  0,  0,216, 35,227,  2,198,  0,  0,  0,  1,  0,  0,  0,  0, 37,227,  2,208, 42,226,  2,
-  0,  0,  0,  0,  0,  0, 52, 67,  0, 96,158,196,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 35, 67,  0, 96,158,196,  0,128,142,195,
-163,  0,  0,  0,180,  0,  0,  0,  0,  0,  0,  0,213,  3,  0,  0,  0,  0,  0,  0,162,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,
-  0,  0,  0,  0,162,  0,  0,  0,  0,  0,  0,  0,213,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0, 63,  0,  0,  0, 64, 10,  1,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,180,  0,214,  3,163,  0,214,  3,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 35,  4,  0,  0, 35,  4,  0,  0,111,  0,  0,  0,194,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  4,  0,  4,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 54,206,  2,  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, 68, 65, 84, 65,248,  0,  0,  0,  0, 37,227,  2,198,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,216, 35,227,  2,  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,  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,  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,160,  0,  0,  0, 35,  4,  0,  0,
-111,  0,  0,  0,194,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,132,  3, 84,  2, 12,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,112, 53,206,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 96,217,  6,  4,232,216,  6,  4,  0,  0,  0,  0,192, 67,227,  2, 68, 65, 84, 65,
- 68,  3,  0,  0,192, 67,227,  2,156,  0,  0,  0,  1,  0,  0,  0,  0,  0,140, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,206,104,211, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,142,  6,128,191,  0,  0,128,191,
-  0,  0,  0,  0,  0,  0,  0,  0, 11,210, 76,190,  0,  0,  0,  0, 68,239,209, 62, 51,177,205,190,184,158, 81, 63,  0,  0,  0,  0,
- 70,119,105, 63,143, 74, 70, 62, 35, 44,185,190,  0,  0,  0,  0,162, 84, 89,188,166, 33,101, 63, 42, 61,228, 62,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 33,210,111,193,  0,  0,128, 63, 68,239,209, 62, 70,119,105, 63,176, 84, 89,188,  0,  0,  0,  0,
- 52,177,205,190,142, 74, 70, 62,166, 33,101, 63,  0,  0,  0,  0,185,158, 81, 63, 35, 44,185,190, 43, 61,228, 62,  0,  0,  0,  0,
- 62, 95, 68, 65, 51,120,173,192,115,208,213, 64,  0,  0,128, 63,178,157,229, 62, 67,221, 41,191,116,169, 81,191,184,158, 81,191,
-117, 90,127, 63,162,192,163, 62,158, 53,185, 62, 35, 44,185, 62,145,180,109,188,138, 56,189, 63,218, 72,228,190, 42, 61,228,190,
-  0,  0,  0,  0,  0,  0,  0,  0, 33,171,108, 65, 33,210,111, 65, 39,240,191, 62,124,116, 85, 63, 80,189, 70,188,  0,  0,185,180,
-100, 19,121,190, 40, 29,240, 61,236,186, 10, 63,  0,  0,208, 51,197,112,117,194,178,208,216, 65,221,158,  5,194,231,251,159,192,
-221, 54,114, 66, 29,247,213,193, 59,221,  3, 66, 25,  4,160, 64, 68,239,209, 62, 51,177,205,190,184,158, 81, 63,  0,  0,  0,  0,
- 70,119,105, 63,143, 74, 70, 62, 35, 44,185,190,  0,  0,  0,  0,162, 84, 89,188,166, 33,101, 63, 42, 61,228, 62,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 33,210,111,193,  0,  0,128, 63,178,157,229, 62, 67,221, 41,191,116,169, 81,191,184,158, 81,191,
-117, 90,127, 63,162,192,163, 62,158, 53,185, 62, 35, 44,185, 62,145,180,109,188,138, 56,189, 63,218, 72,228,190, 42, 61,228,190,
-  0,  0,  0,  0,  0,  0,  0,  0, 33,171,108, 65, 33,210,111, 65, 47, 45, 18, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 47, 45, 18, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 47, 45, 18, 64,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63, 92, 62, 55, 63, 56,186,224,190,237,203,148,190,  3,236,234,190,
- 33,210,111, 65, 33,210,111, 65,  0,  0,  0,  0,  0,  0,  0,  0, 11, 39,  5, 59,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,255,255,  1,  0,  0,  0,  0,  0,  0,  0,  1,  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,  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,  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,  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,  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,128, 63, 30, 33, 12, 66, 86,152,137, 66,113, 27,126, 66,  0,  0,  0,  0, 68, 65, 84, 65,240,  0,  0,  0, 40, 38,227,  2,
-157,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 51, 51, 51, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0, 32, 65,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  7,  0,144, 12,228,  2,  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,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  3,  0,  0,  0,  1,  0,  3,  0,  8, 24,  0,  0,  0,  0, 12, 66,
-  0,  0,128, 63,205,204,204, 61,  0,  0,122, 68,  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, 16,  0, 10,  0,  7,  1,  0,  3,  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, 83, 78,  0,  0,148,  0,  0,  0,
-128,251,213,  2,193,  0,  0,  0,  1,  0,  0,  0, 72,252,213,  2,184,250,213,  2,  0,  0,  0,  0,  0,  0,  0,  0, 83, 82, 71, 97,
-109,101, 32, 76,111,103,105, 99,  0, 46, 48, 48, 49,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 72,  8,226,  2,240, 11,226,  2, 56, 12,226,  2,168, 76,227,  2, 48, 92,215,  2,  0, 95,215,  2,  0,  0,  0,  0,  0,  0,  0,  0,
-144,  1,228,  2,  0,  0,  0,  0,  6,  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,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 20,  0,  0,  0, 72,  8,226,  2,194,  0,  0,  0,  1,  0,  0,  0,144,  8,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,144,  8,226,  2,194,  0,  0,  0,  1,  0,  0,  0,216,  8,226,  2,
- 72,  8,226,  2,  0,  0,  0,  0,  0,  0,  5,  4,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,216,  8,226,  2,194,  0,  0,  0,
-  1,  0,  0,  0, 32,  9,226,  2,144,  8,226,  2,  0,  0,  0,  0,126,  7,  5,  4,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,
- 32,  9,226,  2,194,  0,  0,  0,  1,  0,  0,  0,104,  9,226,  2,216,  8,226,  2,  0,  0,  0,  0,126,  7,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 20,  0,  0,  0,104,  9,226,  2,194,  0,  0,  0,  1,  0,  0,  0,176,  9,226,  2, 32,  9,226,  2,  0,  0,  0,  0,
-  0,  0,234,  3,  1,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,176,  9,226,  2,194,  0,  0,  0,  1,  0,  0,  0,248,  9,226,  2,
-104,  9,226,  2,  0,  0,  0,  0,126,  7,234,  3,  1,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,248,  9,226,  2,194,  0,  0,  0,
-  1,  0,  0,  0, 64, 10,226,  2,176,  9,226,  2,  0,  0,  0,  0,  0,  0,140,  1,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,
- 64, 10,226,  2,194,  0,  0,  0,  1,  0,  0,  0,136, 10,226,  2,248,  9,226,  2,  0,  0,  0,  0, 32,  6,140,  1,  0,  0,  0,  0,
- 68, 65, 84, 65, 20,  0,  0,  0,136, 10,226,  2,194,  0,  0,  0,  1,  0,  0,  0,208, 10,226,  2, 64, 10,226,  2,  0,  0,  0,  0,
- 32,  6,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,208, 10,226,  2,194,  0,  0,  0,  1,  0,  0,  0, 24, 11,226,  2,
-136, 10,226,  2,  0,  0,  0,  0,126,  7,140,  1,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0, 24, 11,226,  2,194,  0,  0,  0,
-  1,  0,  0,  0, 96, 11,226,  2,208, 10,226,  2,  0,  0,  0,  0, 64,  5,140,  1,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,
- 96, 11,226,  2,194,  0,  0,  0,  1,  0,  0,  0,168, 11,226,  2, 24, 11,226,  2,  0,  0,  0,  0, 64,  5,234,  3,  1,  0,  0,  0,
- 68, 65, 84, 65, 20,  0,  0,  0,168, 11,226,  2,194,  0,  0,  0,  1,  0,  0,  0,240, 11,226,  2, 96, 11,226,  2,  0,  0,  0,  0,
- 68,  1,140,  1,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,240, 11,226,  2,194,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-168, 11,226,  2,  0,  0,  0,  0, 68,  1,234,  3,  1,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 56, 12,226,  2,195,  0,  0,  0,
-  1,  0,  0,  0, 80, 71,227,  2,  0,  0,  0,  0,144,  8,226,  2,216,  8,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 24,  0,  0,  0, 80, 71,227,  2,195,  0,  0,  0,  1,  0,  0,  0,152, 71,227,  2, 56, 12,226,  2,144,  8,226,  2,104,  9,226,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,152, 71,227,  2,195,  0,  0,  0,  1,  0,  0,  0,224, 71,227,  2,
- 80, 71,227,  2,216,  8,226,  2,176,  9,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,224, 71,227,  2,
-195,  0,  0,  0,  1,  0,  0,  0, 40, 72,227,  2,152, 71,227,  2,104,  9,226,  2,176,  9,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 24,  0,  0,  0, 40, 72,227,  2,195,  0,  0,  0,  1,  0,  0,  0,112, 72,227,  2,224, 71,227,  2,104,  9,226,  2,
-248,  9,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,112, 72,227,  2,195,  0,  0,  0,  1,  0,  0,  0,
-184, 72,227,  2, 40, 72,227,  2,248,  9,226,  2, 64, 10,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,
-184, 72,227,  2,195,  0,  0,  0,  1,  0,  0,  0,  0, 73,227,  2,112, 72,227,  2, 32,  9,226,  2,136, 10,226,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,  0, 73,227,  2,195,  0,  0,  0,  1,  0,  0,  0, 72, 73,227,  2,184, 72,227,  2,
- 64, 10,226,  2,136, 10,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 72, 73,227,  2,195,  0,  0,  0,
-  1,  0,  0,  0,144, 73,227,  2,  0, 73,227,  2, 72,  8,226,  2,248,  9,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 24,  0,  0,  0,144, 73,227,  2,195,  0,  0,  0,  1,  0,  0,  0,216, 73,227,  2, 72, 73,227,  2, 72,  8,226,  2,136, 10,226,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,216, 73,227,  2,195,  0,  0,  0,  1,  0,  0,  0, 32, 74,227,  2,
-144, 73,227,  2,176,  9,226,  2,208, 10,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 32, 74,227,  2,
-195,  0,  0,  0,  1,  0,  0,  0,104, 74,227,  2,216, 73,227,  2, 32,  9,226,  2,208, 10,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 24,  0,  0,  0,104, 74,227,  2,195,  0,  0,  0,  1,  0,  0,  0,176, 74,227,  2, 32, 74,227,  2, 64, 10,226,  2,
-208, 10,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,176, 74,227,  2,195,  0,  0,  0,  1,  0,  0,  0,
-248, 74,227,  2,104, 74,227,  2, 24, 11,226,  2, 96, 11,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,
-248, 74,227,  2,195,  0,  0,  0,  1,  0,  0,  0, 64, 75,227,  2,176, 74,227,  2,176,  9,226,  2, 96, 11,226,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 64, 75,227,  2,195,  0,  0,  0,  1,  0,  0,  0,136, 75,227,  2,248, 74,227,  2,
-208, 10,226,  2, 24, 11,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,136, 75,227,  2,195,  0,  0,  0,
-  1,  0,  0,  0,208, 75,227,  2, 64, 75,227,  2,248,  9,226,  2,168, 11,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 24,  0,  0,  0,208, 75,227,  2,195,  0,  0,  0,  1,  0,  0,  0, 24, 76,227,  2,136, 75,227,  2, 24, 11,226,  2,168, 11,226,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 24, 76,227,  2,195,  0,  0,  0,  1,  0,  0,  0, 96, 76,227,  2,
-208, 75,227,  2,104,  9,226,  2,240, 11,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 96, 76,227,  2,
-195,  0,  0,  0,  1,  0,  0,  0,168, 76,227,  2, 24, 76,227,  2, 96, 11,226,  2,240, 11,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 24,  0,  0,  0,168, 76,227,  2,195,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 96, 76,227,  2,168, 11,226,  2,
-240, 11,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 96,  0,  0,  0, 48, 92,215,  2,197,  0,  0,  0,  1,  0,  0,  0,
-192, 92,215,  2,  0,  0,  0,  0,104,  9,226,  2,144,  8,226,  2,216,  8,226,  2,176,  9,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,
-126,  7,  0,  0,235,  3,  0,  0,  5,  4,  0,  0,  7,  7,127,  7, 27,  0,  1,  0,  0,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,
-248,233,220,  2,248,233,220,  2, 80, 39,227,  2,120, 40,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65,248,  0,  0,  0, 80, 39,227,  2,198,  0,  0,  0,  1,  0,  0,  0,120, 40,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,
-  0, 32,148, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,224,239, 68,  0,  0,  0,  0,  0,  0,208, 65,  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,100,  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,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 83, 78,  0,  0,  8,  1,  0,  0,152, 62, 19,  6,  0,  0,  0,  0,210,  0,  0,  0,
+  1,  0,  0,  0, 24, 87, 20,  6,  0,  0,  0,  0, 24,210, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 83, 82, 68,101,102, 97,117,108,116,  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,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232, 63, 19,  6,
+  0,  0,  0,  0,  8,244, 12,108,161,127,  0,  0, 40, 69, 19,  6,  0,  0,  0,  0, 40, 37, 34,109,161,127,  0,  0,  8, 77, 19,  6,
+  0,  0,  0,  0, 24, 55, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  1,  0, 13,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64,162,117,  1,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,232, 63, 19,  6,  0,  0,  0,  0,211,  0,  0,  0,
+  1,  0,  0,  0, 88, 64, 19,  6,  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, 68, 65, 84, 65, 32,  0,  0,  0, 88, 64, 19,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,200, 64, 19,  6,
+  0,  0,  0,  0,232, 63, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,146,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 32,  0,  0,  0,200, 64, 19,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0, 56, 65, 19,  6,  0,  0,  0,  0, 88, 64, 19,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,146,  4,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 56, 65, 19,  6,
+  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,168, 65, 19,  6,  0,  0,  0,  0,200, 64, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,126,  7,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,168, 65, 19,  6,  0,  0,  0,  0,211,  0,  0,  0,
+  1,  0,  0,  0, 24, 66, 19,  6,  0,  0,  0,  0, 56, 65, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,104,  4,
+  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 24, 66, 19,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,136, 66, 19,  6,
+  0,  0,  0,  0,168, 65, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,104,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 32,  0,  0,  0,136, 66, 19,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,248, 66, 19,  6,  0,  0,  0,  0, 24, 66, 19,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 80,  6,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,248, 66, 19,  6,
+  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,104, 67, 19,  6,  0,  0,  0,  0,136, 66, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 80,  6,104,  4,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,104, 67, 19,  6,  0,  0,  0,  0,211,  0,  0,  0,
+  1,  0,  0,  0,216, 67, 19,  6,  0,  0,  0,  0,248, 66, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 80,  6,196,  3,
+  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,216, 67, 19,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0, 72, 68, 19,  6,
+  0,  0,  0,  0,104, 67, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,196,  3,  0,  0,  0,  0, 68, 65, 84, 65,
+ 32,  0,  0,  0, 72, 68, 19,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,184, 68, 19,  6,  0,  0,  0,  0,216, 67, 19,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,144,  0,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,184, 68, 19,  6,
+  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,184,  8, 38,109,161,127,  0,  0, 72, 68, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 80,  6,144,  0,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,184,  8, 38,109,161,127,  0,  0,211,  0,  0,  0,
+  1,  0,  0,  0,  8,244, 12,108,161,127,  0,  0,184, 68, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,224,  3,
+  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,  8,244, 12,108,161,127,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,184,  8, 38,109,161,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 80,  6,224,  3,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 40, 69, 19,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,152, 69, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 88, 64, 19,  6,  0,  0,  0,  0,200, 64, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,152, 69, 19,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,  8, 70, 19,  6,  0,  0,  0,  0, 40, 69, 19,  6,
+  0,  0,  0,  0, 88, 64, 19,  6,  0,  0,  0,  0,168, 65, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,  8, 70, 19,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,120, 70, 19,  6,  0,  0,  0,  0,152, 69, 19,  6,
+  0,  0,  0,  0,200, 64, 19,  6,  0,  0,  0,  0, 24, 66, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,120, 70, 19,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,232, 70, 19,  6,  0,  0,  0,  0,  8, 70, 19,  6,
+  0,  0,  0,  0,168, 65, 19,  6,  0,  0,  0,  0, 24, 66, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,232, 70, 19,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 88, 71, 19,  6,  0,  0,  0,  0,120, 70, 19,  6,
+  0,  0,  0,  0,232, 63, 19,  6,  0,  0,  0,  0,136, 66, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 88, 71, 19,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,200, 71, 19,  6,  0,  0,  0,  0,232, 70, 19,  6,
+  0,  0,  0,  0, 56, 65, 19,  6,  0,  0,  0,  0,136, 66, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,200, 71, 19,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 56, 72, 19,  6,  0,  0,  0,  0, 88, 71, 19,  6,
+  0,  0,  0,  0,168, 65, 19,  6,  0,  0,  0,  0,248, 66, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 56, 72, 19,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,168, 72, 19,  6,  0,  0,  0,  0,200, 71, 19,  6,
+  0,  0,  0,  0, 24, 66, 19,  6,  0,  0,  0,  0,248, 66, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,168, 72, 19,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 24, 73, 19,  6,  0,  0,  0,  0, 56, 72, 19,  6,
+  0,  0,  0,  0,136, 66, 19,  6,  0,  0,  0,  0,104, 67, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 24, 73, 19,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,136, 73, 19,  6,  0,  0,  0,  0,168, 72, 19,  6,
+  0,  0,  0,  0,248, 66, 19,  6,  0,  0,  0,  0,104, 67, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,136, 73, 19,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,248, 73, 19,  6,  0,  0,  0,  0, 24, 73, 19,  6,
+  0,  0,  0,  0, 24, 66, 19,  6,  0,  0,  0,  0,216, 67, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,248, 73, 19,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,104, 74, 19,  6,  0,  0,  0,  0,136, 73, 19,  6,
+  0,  0,  0,  0, 56, 65, 19,  6,  0,  0,  0,  0,216, 67, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,104, 74, 19,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,216, 74, 19,  6,  0,  0,  0,  0,248, 73, 19,  6,
+  0,  0,  0,  0,104, 67, 19,  6,  0,  0,  0,  0,216, 67, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,216, 74, 19,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 40, 76, 19,  6,  0,  0,  0,  0,104, 74, 19,  6,
+  0,  0,  0,  0,232, 63, 19,  6,  0,  0,  0,  0, 72, 68, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 40, 76, 19,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,152, 76, 19,  6,  0,  0,  0,  0,216, 74, 19,  6,
+  0,  0,  0,  0,136, 66, 19,  6,  0,  0,  0,  0,184, 68, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,152, 76, 19,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 72,111,135,109,161,127,  0,  0, 40, 76, 19,  6,
+  0,  0,  0,  0, 72, 68, 19,  6,  0,  0,  0,  0,184, 68, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 72,111,135,109,161,127,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 40, 37, 34,109,161,127,  0,  0,152, 76, 19,  6,
+  0,  0,  0,  0,168, 65, 19,  6,  0,  0,  0,  0, 72, 68, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 40, 37, 34,109,161,127,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72,111,135,109,
+161,127,  0,  0,248, 66, 19,  6,  0,  0,  0,  0,184, 68, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+160,  0,  0,  0,  8, 77, 19,  6,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,216, 80, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,168, 65, 19,  6,  0,  0,  0,  0, 88, 64, 19,  6,  0,  0,  0,  0,200, 64, 19,  6,  0,  0,  0,  0, 24, 66, 19,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,  0,  0,105,  4,  0,  0,146,  4,  0,  0,  7,  7,127,  7,
+ 42,  0,  1,  0,  0,  0,  0,  0,  7,  0,  8,  0, 24,172,243,  5,  0,  0,  0,  0,136, 86, 20,  6,  0,  0,  0,  0,136, 86, 20,  6,
+  0,  0,  0,  0,248, 77, 19,  6,  0,  0,  0,  0,104, 79, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 56, 54, 48,109,161,127,  0,  0,104,215, 34,109,161,127,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0,248, 77, 19,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,104, 79, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,224,239, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,224,239, 68,  0,  0,  0,  0,  0,  0,208, 65,  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,
 126,  7,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,192,239, 68,  0,  0,200, 65,  0,192,239, 68,  0,  0,200, 65,  0,  0,128, 63,
   0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,127,  7, 26,  0,127,  7, 26,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,  0,  0,235,  3,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,127,  7, 26,  0,  0,  0,  1,  0,  2,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,120, 40,227,  2,198,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0, 80, 39,227,  2,  0,  0,  0,  0,  0,240,109, 69,  0,  0,128,192,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,238, 68,
-  0,  0,  0,  0,  0,  0,  0, 64,112,  7,  0,  0,129,  7,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,111,  7,  0,  0,
-  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,111,  7,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  2,  0,  0,  0,  1,  0,  3,  3,  2,  0,  0,  4, 10,  0,129,  7,
-  2,  0,112,  7,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  4,  0,  0,
-  5,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  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,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 96,  0,  0,  0,
-192, 92,215,  2,197,  0,  0,  0,  1,  0,  0,  0, 80, 93,215,  2, 48, 92,215,  2,136, 10,226,  2, 64, 10,226,  2,208, 10,226,  2,
- 32,  9,226,  2,  0,  0,  0,  0, 33,  6,  0,  0,126,  7,  0,  0,  0,  0,  0,  0,139,  1,  0,  0,  4,  4, 94,  1,140,  1,  1,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 56, 87,227,  2, 56, 87,227,  2,160, 41,227,  2,200, 42,227,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,160, 41,227,  2,198,  0,  0,  0,  1,  0,  0,  0,
-200, 42,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,148, 67,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,  0,175, 67,
-  0,  0,  0,  0,  0,  0,208, 65,  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, 93,  1,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,128,174, 67,  0,  0,200, 65,
-  0,128,174, 67,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 94,  1,
- 26,  0, 94,  1, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 33,  6,  0,  0,126,  7,  0,  0,114,  1,  0,  0,
-139,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 94,  1, 26,  0,  0,  0,  1,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,
-200, 42,227,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,160, 41,227,  2,  0,  0,  0,  0,  0,128,174, 67,  0,  0, 61,196,
-  0,  0,  0,  0,  0,  0,  0,  0,255,127,166, 67,255,255,184,195,  0,  0,  0,  0, 77,  1,  0,  0, 94,  1,  0,  0,  0,  0,  0,  0,
-113,  1,  0,  0,  0,  0,  0,  0, 78,  1,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0, 76,  1,  0,  0,  0,  0,  0,  0,
-113,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  1,  0,  0,
-  1,  0,  7,  0, 18,  0,  0,  4,  6,  0, 94,  1,114,  1, 77,  1,114,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 33,  6,  0,  0,126,  7,  0,  0,  0,  0,  0,  0,113,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 94,  1,114,  1,  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,136,132,226,  2,176,148,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 64,  1,  0,  0,136,132,226,  2,196,  0,  0,  0,  1,  0,  0,  0,  0,134,226,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 66, 85, 84, 84, 79, 78, 83, 95, 80, 84, 95, 99,111,110,116,101,120,116,  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, 66, 85, 84, 84, 79, 78, 83, 95, 80, 84, 95, 99,111,110,116,101,120,116,  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, 67,111,110,116,101,120,116,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,220,255, 76,  1, 36,  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,  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,  0,  0,  0,  0,  0, 68, 65, 84, 65, 64,  1,  0,  0,
-  0,134,226,  2,196,  0,  0,  0,  1,  0,  0,  0,120,135,226,  2,136,132,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68,
- 69, 82, 95, 80, 84, 95,114,101,110,100,101,114,  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, 82, 69, 78, 68,
- 69, 82, 95, 80, 84, 95,114,101,110,100,101,114,  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, 82,101,110,100,
-101,114,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,135,255,
- 76,  1, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,120,135,226,  2,196,  0,  0,  0,  1,  0,  0,  0,
-240,136,226,  2,  0,134,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,108, 97,121,101,114,115,
-  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,108, 97,121,101,114,115,
-  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, 76, 97,121,101,114,115,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,111,255, 76,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,
-  0,  0,  0,  0,  2,  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,126,  7,  0,  0,105,  4,  0,  0,130,  4,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,127,  7, 26,  0,  2,  0,  1,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0, 26,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40,174,243,  5,  0,  0,  0,  0,104,247, 48,109,161,127,  0,  0,104,247, 48,109,
+161,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,168,208, 40,109,161,127,  0,  0, 72,215, 12,108,
+161,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0,104, 79, 19,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,248, 77, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,192,239, 68,  0,  0,  0,  0,  0,  0,200, 65,  0,  0,  0,  0,  1,192,237, 68,  0,  0,  0,  0,  0,  0,128, 65,110,  7,  0,  0,
+127,  7,  0,  0,  0,  0,  0,  0, 15,  0,  0,  0,  0,  0,  0,  0,111,  7,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,
+109,  7,  0,  0,  0,  0,  0,  0, 15,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  2,  0,  0,  0,  1,  0,  3,  3,  2,  0,  0,  4, 10,  0,127,  7, 16,  0,110,  7, 16,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,  0,  0,131,  4,  0,  0,146,  4,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,127,  7, 16,  0,  3,  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, 56,173,243,  5,  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,104, 52,135,109,161,127,  0,  0,248,218, 12,108,
+161,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0,216, 80, 19,  6,
+  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,168,121, 19,  6,  0,  0,  0,  0,  8, 77, 19,  6,  0,  0,  0,  0,136, 66, 19,  6,
+  0,  0,  0,  0,104, 67, 19,  6,  0,  0,  0,  0,216, 67, 19,  6,  0,  0,  0,  0, 56, 65, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 81,  6,  0,  0,126,  7,  0,  0,  0,  0,  0,  0,195,  3,  0,  0,  4,  4, 46,  1,196,  3,  1,  0,  0,  0,  0,  0,
+  0,  0,  8,  0,184,167,243,  5,  0,  0,  0,  0,104,120, 19,  6,  0,  0,  0,  0,104,120, 19,  6,  0,  0,  0,  0,200, 81, 19,  6,
+  0,  0,  0,  0, 56, 83, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,184,116, 13,108,
+161,127,  0,  0,216,163, 48,109,161,127,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0,200, 81, 19,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0, 56, 83, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,151, 67,  0,  0,  0,  0,
+  0,  0,208, 65,  0,  0,  0,  0,  0,  0,151, 67,  0,  0,  0,  0,  0,  0,208, 65,  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, 45,  1,  0,  0,  0,  0,  0,  0,
+ 25,  0,  0,  0,  0,128,150, 67,  0,  0,200, 65,  0,128,150, 67,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 46,  1, 26,  0, 46,  1, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 81,  6,  0,  0,126,  7,  0,  0,170,  3,  0,  0,195,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 46,  1, 26,  0,  4,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 40,171,243,  5,  0,  0,  0,  0,232, 10, 36,109,161,127,  0,  0,232, 10, 36,109,161,127,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,193, 32,109,161,127,  0,  0, 88,224, 12,108,161,127,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0, 56, 83, 19,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 81, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,178, 67,  0,128,106,196,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,128,142, 67,  2,128,106,196,  0,  0,  0,  0, 29,  1,  0,  0, 46,  1,  0,  0,  0,  0,  0,  0,
+169,  3,  0,  0,  0,  0,  0,  0, 74,  1,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0, 28,  1,  0,  0,  0,  0,  0,  0,
+169,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  3,  0,  0,
+  1,  0,  7,  0, 18,  0,  0,  4,  6,  0, 46,  1,170,  3, 29,  1,170,  3,  0,  0,200,105, 35,109,161,127,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0, 81,  6,  0,  0,126,  7,  0,  0,  0,  0,  0,  0,169,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 46,  1,170,  3,  5,  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,216,168,243,  5,  0,  0,  0,  0,136,239, 48,109,161,127,  0,  0,216,232, 48,109,161,127,  0,  0,168, 84, 19,  6,
+  0,  0,  0,  0,200,118, 19,  6,  0,  0,  0,  0,200,  5, 13,108,161,127,  0,  0,168,229, 12,108,161,127,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,168, 84, 19,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0, 72, 86, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200,169,243,  5,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 85, 84, 84, 79, 78, 83, 95, 80, 84, 95, 99,111,110,116,101,120,116,  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, 66, 85, 84, 84, 79, 78, 83, 95, 80, 84, 95, 99,111,110,116,101,120,116,  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, 67,111,110,116,101,120,116,  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,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,220,255, 29,  1, 36,  0,  0,  0,  0,  0,  0,  0, 38,  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,  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,
- 68, 65, 84, 65, 64,  1,  0,  0,240,136,226,  2,196,  0,  0,  0,  1,  0,  0,  0,104,138,226,  2,120,135,226,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,100,105,109,101,110,115,105,111,110,115,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,100,105,109,101,110,115,105,111,110,115,  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, 68,105,109,101,110,115,105,111,110,115,  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,
-  0,  0,  0,  0,  0,  0,140,254, 76,  1,203,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,104,138,226,  2,
-196,  0,  0,  0,  1,  0,  0,  0,224,139,226,  2,240,136,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80,
- 84, 95, 97,110,116,105, 97,108,105, 97,115,105,110,103,  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, 82, 69, 78, 68, 69, 82, 95, 80,
- 84, 95, 97,110,116,105, 97,108,105, 97,115,105,110,103,  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, 65,110,116,105, 45, 65,108,105,
- 97,115,105,110,103,  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,  0,  0,  0, 58,254, 76,  1, 58,  0,
- 20,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,224,139,226,  2,196,  0,  0,  0,  1,  0,  0,  0, 88,141,226,  2,
-104,138,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,109,111,116,105,111,110, 95, 98,108,117,
-114,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,109,111,116,105,111,110, 95, 98,108,117,
-114,  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, 83, 97,109,112,108,101,100, 32, 77,111,116,105,111,110, 32, 66,108,117,114,  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, 34,254, 76,  1,  0,  0, 20,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
-  5,  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,  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, 68, 65, 84, 65,
- 64,  1,  0,  0, 88,141,226,  2,196,  0,  0,  0,  1,  0,  0,  0,208,142,226,  2,224,139,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,104, 97,100,105,110,103,  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,
- 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,104, 97,100,105,110,103,  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,
- 83,104, 97,100,105,110,103,  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,  0,  0,  0,  0,  0,  0,  0,
-  0,  0, 10,254, 76,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  6,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,208,142,226,  2,196,  0,  0,  0,
-  1,  0,  0,  0, 72,144,226,  2, 88,141,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,101,
-114,102,111,114,109, 97,110, 99,101,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,101,
-114,102,111,114,109, 97,110, 99,101,  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, 80,101,114,102,111,114,109, 97,110, 99,101,  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,  0,  0,  0,  0,  0,242,253, 76,  1,  0,  0,  0,  0,  0,  0,
-  4,  0,  0,  0,  0,  0,  0,  0,  7,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0, 72,144,226,  2,196,  0,  0,  0,  1,  0,  0,  0,192,145,226,  2,208,142,226,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,111,115,116, 95,112,114,111, 99,101,115,115,105,110,
-103,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,111,115,116, 95,112,114,111, 99,101,115,115,105,110,
-103,  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, 80,111,115,116, 32, 80,114,111, 99,101,115,115,105,110,103,  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,  0,218,253, 76,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  8,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,
-192,145,226,  2,196,  0,  0,  0,  1,  0,  0,  0, 56,147,226,  2, 72,144,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68,
- 69, 82, 95, 80, 84, 95,115,116, 97,109,112,  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, 82, 69, 78, 68,
- 69, 82, 95, 80, 84, 95,115,116, 97,109,112,  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, 83,116, 97,109,
-112,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,194,253,
- 76,  1,  0,  0, 20,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  9,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0, 56,147,226,  2,196,  0,  0,  0,  1,  0,  0,  0,
-176,148,226,  2,192,145,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,111,117,116,112,117,116,
-  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,111,117,116,112,117,116,
-  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, 79,117,116,112,117,116,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40,253, 76,  1,130,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 10,  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,  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,
- 68, 65, 84, 65, 64,  1,  0,  0,176,148,226,  2,196,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 56,147,226,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 98, 97,107,101,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 98, 97,107,101,  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, 66, 97,107,101,  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,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0, 16,253, 76,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 11,  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,  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, 68, 65, 84, 65,216,  0,  0,  0, 56, 87,227,  2,
-162,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  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,  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,  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,  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,  2,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,255, 21,  0,  0,160,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 96,  0,  0,  0, 80, 93,215,  2,197,  0,  0,  0,  1,  0,  0,  0,224, 93,215,  2,192, 92,215,  2, 72,  8,226,  2,
-248,  9,226,  2, 64, 10,226,  2,136, 10,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 31,  6,  0,  0,  0,  0,  0,  0,139,  1,  0,  0,
- 17, 17, 32,  6,140,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40,255,220,  2, 40,255,220,  2,240, 43,227,  2,
- 64, 46,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,240, 43,227,  2,
-198,  0,  0,  0,  1,  0,  0,  0, 24, 45,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 74, 67,  0,  0,  0,  0,  0,  0,208, 65,
-  0,  0,  0,  0,  0,  0,196, 68,  0,  0,  0,  0,  0,  0,208, 65,  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, 31,  6,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,
-  0,224,195, 68,  0,  0,200, 65,  0,224,195, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,
-  4,  0, 12,  0, 10,  0, 32,  6, 26,  0, 32,  6, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 31,  6,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32,  6, 26,  0,
-  0,  0,  1,  0,  2,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65,248,  0,  0,  0, 24, 45,227,  2,198,  0,  0,  0,  1,  0,  0,  0, 64, 46,227,  2,240, 43,227,  2,  0,  0,  0,  0,
-  0,  0, 92, 67,  0,  0,185,195,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 75, 67,  0,  0,185,195,  0,  0,  0,  0,203,  0,  0,  0,
-220,  0,  0,  0,  0,  0,  0,  0,113,  1,  0,  0,  0,  0,  0,  0,202,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,
-202,  0,  0,  0,  0,  0,  0,  0,113,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,
-  0,  0,  0, 64, 10,  3,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,220,  0,114,  1,203,  0,114,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,219,  0,  0,  0, 26,  0,  0,  0,139,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,220,  0,114,  1,  0,  0,  4,  0,  3,  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, 40,150,226,  2, 40,150,226,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 64,  1,  0,  0, 40,150,226,  2,196,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 76, 79, 71, 73, 67, 95, 80, 84, 95,112,114,111,112,101,114,116,
-105,101,115,  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, 76, 79, 71, 73, 67, 95, 80, 84, 95,112,114,111,112,101,114,116,
-105,101,115,  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, 80,114,111,112,101,114,116,105,101,115,  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,  0,  0,  0,  0,  0,  0,196,255,203,  0, 36,  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,  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,  0,  0,  0,  0,  0,
- 68, 65, 84, 65,248,  0,  0,  0, 64, 46,227,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 24, 45,227,  2,  0,  0,  0,  0,
-  0,  0,160, 68,  0,  0,  0,  0,  0,  0,112, 67,  0, 80, 31,195,  0,234,179, 68,224,198,182,194,184,177,165, 67, 51,  5,  0,  0,
- 68,  5,  0,  0, 18,  0,  0,  0,113,  1,  0,  0,  0,  0,  0,  0, 50,  5,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,
- 50,  5,  0,  0, 18,  0,  0,  0,113,  1,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,250, 70,  0,  0,250, 70,  0,  0,  0, 63,
- 72,225,154, 63, 10,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  4,  0,  0, 68,  5,114,  1, 51,  5, 96,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,220,  0,  0,  0, 31,  6,  0,  0, 26,  0,  0,  0,139,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68,  5,114,  1,  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,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 52,  0,  0,  0, 40,255,220,  2,175,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 17,  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,255,  7,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 96,  0,  0,  0,224, 93,215,  2,
-197,  0,  0,  0,  1,  0,  0,  0,112, 94,215,  2, 80, 93,215,  2, 24, 11,226,  2, 96, 11,226,  2,176,  9,226,  2,208, 10,226,  2,
-  0,  0,  0,  0, 65,  5,  0,  0,126,  7,  0,  0,141,  1,  0,  0,233,  3,  0,  0,  9,  9, 62,  2, 93,  2,  1,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 64, 88,227,  2, 64, 88,227,  2,104, 47,227,  2,144, 48,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,104, 47,227,  2,198,  0,  0,  0,  1,  0,  0,  0,144, 48,227,  2,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,230, 67,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,128, 15, 68,  0,  0,  0,  0,
-  0,  0,208, 65,  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, 61,  2,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0, 64, 15, 68,  0,  0,200, 65,  0, 64, 15, 68,
-  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 62,  2, 26,  0, 62,  2,
- 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 65,  5,  0,  0,126,  7,  0,  0,141,  1,  0,  0,166,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 62,  2, 26,  0,  0,  0,  1,  0,  2,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,144, 48,227,  2,
-198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,104, 47,227,  2,  0,  0,  0,  0,  0,128,181, 67,  0,  0,  0,  0,  0,128,218, 67,
-  0,  0,  0,  0,131,248,  1, 68,  0,  0,  0,  0, 86, 26,  3, 68,  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, 61,  2,  0,  0,  0,  0,  0,  0, 66,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,215, 35, 60,  0,  0,122, 68,  0,  0,  0,  0,  1,  0,  3,  0,
-  0,  0,  0,  4, 10,  0, 62,  2, 67,  2, 62,  2, 67,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 65,  5,  0,  0,
-126,  7,  0,  0,167,  1,  0,  0,233,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 62,  2, 67,  2,
-  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65,136,  2,  0,  0, 64, 88,227,  2,169,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  9,  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, 12,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  4,  0,  0,  0,  1,  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,  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,  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,  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,  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,  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,
+ 88,  1,  0,  0, 72, 86, 19,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,232, 87, 19,  6,  0,  0,  0,  0,168, 84, 19,  6,
+  0,  0,  0,  0,216,150,122,108,161,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,114,101,
+110,100,101,114,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,114,101,
+110,100,101,114,  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, 82,101,110,100,101,114,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,135,255, 29,  1, 61,  0,  0,  0,  0,  0,
+  0,  0,  6,  0,  0,  0,  0,  0, 11,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,232, 87, 19,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0,136, 89, 19,  6,  0,  0,  0,  0, 72, 86, 19,  6,  0,  0,  0,  0, 72,153,122,108,161,127,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,108, 97,121,101,114,115,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,108, 97,121,101,114,115,  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, 76, 97,121,101,114,115,  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,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,111,255, 29,  1,  0,  0,  0,  0,  0,  0,  4,  0,  6,  0,  0,  0,  0,  0, 12,  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,  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, 68, 65, 84, 65,
- 96,  0,  0,  0,112, 94,215,  2,197,  0,  0,  0,  1,  0,  0,  0,  0, 95,215,  2,224, 93,215,  2,168, 11,226,  2,240, 11,226,  2,
- 96, 11,226,  2, 24, 11,226,  2,  0,  0,  0,  0, 69,  1,  0,  0, 63,  5,  0,  0,141,  1,  0,  0,233,  3,  0,  0,  1,  1,251,  3,
- 93,  2,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 55,227,  2,128, 55,227,  2,184, 49,227,  2, 88, 54,227,  2,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,184, 49,227,  2,198,  0,  0,  0,
-  1,  0,  0,  0,224, 50,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64,113, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,
-  0,192,126, 68,  0,  0,  0,  0,  0,  0,208, 65,  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,250,  3,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,128,126, 68,
-  0,  0,200, 65,  0,128,126, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0,
- 10,  0,251,  3, 26,  0,251,  3, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 69,  1,  0,  0, 63,  5,  0,  0,
-141,  1,  0,  0,166,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,251,  3, 26,  0,  0,  0,  1,  0,
-  2,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
-248,  0,  0,  0,224, 50,227,  2,198,  0,  0,  0,  1,  0,  0,  0,  8, 52,227,  2,184, 49,227,  2,  0,  0,  0,  0,  0,  0, 15, 67,
-  0, 64, 70,196,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 15, 67,255,127, 70,196,  0,  0,  0,  0,143,  0,  0,  0,160,  0,  0,  0,
- 18,  0,  0,  0, 43,  3,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,
- 18,  0,  0,  0, 43,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64,
- 10,  0,  0,  0,  1,  0,  7,  0, 18,  0,  0,  0,  6,  0,160,  0, 44,  3,143,  0, 26,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 69,  1,  0,  0, 69,  1,  0,  0,167,  1,  0,  0,233,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0, 67,  2,  0,  0,  5,  0,  3,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,  8, 52,227,  2,198,  0,  0,  0,  1,  0,  0,  0, 48, 53,227,  2,
-224, 50,227,  2,  0,  0,  0,  0,  0,  0, 16, 67,  0,  0,206,194,  0,  0,  0,  0,  0,  0,  0,  0,231,102, 16, 67,  0,  0,206,194,
-  0,  0,  0,  0,143,  0,  0,  0,160,  0,  0,  0, 18,  0,  0,  0,119,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  0,
- 17,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0, 18,  0,  0,  0,119,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  0,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,160,  0,120,  0,143,  0,
-102,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 69,  1,  0,  0, 63,  5,  0,  0,167,  1,  0,  0,167,  1,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  6,  0, 34,  0,  2,  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,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0, 48, 53,227,  2,
-198,  0,  0,  0,  1,  0,  0,  0, 88, 54,227,  2,  8, 52,227,  2,  0,  0,  0,  0,  0,  0, 52, 67,  0,  0,109,196,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0, 35, 67,  0,  0,109,196,  0,128,145,195,163,  0,  0,  0,180,  0,  0,  0,  0,  0,  0,  0,144,  2,  0,  0,
-  0,  0,  0,  0,162,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,162,  0,  0,  0,  0,  0,  0,  0,144,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  1,  0,  0,  1,  0,  7,  0,
- 18,  0,  0,  4,  6,  0,180,  0,145,  2,163,  0,145,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  5,  0,  0,
- 63,  5,  0,  0,167,  1,  0,  0,233,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
-  0,  0,  4,  0,  4,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65,248,  0,  0,  0, 88, 54,227,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 48, 53,227,  2,  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,  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,
-  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, 69,  1,  0,  0, 63,  5,  0,  0,167,  1,  0,  0,233,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,251,  3, 67,  2,  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,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,248, 90,227,  2, 68, 65, 84, 65, 68,  3,  0,  0,248, 90,227,  2,156,  0,  0,  0,  1,  0,  0,  0,
-190, 35, 30, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 75, 40,139, 61,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,111, 18,  3,187,  0,  0,  0,  0,  0,  0,  0,128,  0,  0,  0,128,  0,  0,  0,128,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-190, 35, 30, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 75, 40,139, 61,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,111, 18,  3,187,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-149, 53,207, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,112,121,107, 65,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,255,255,249,195,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-190, 35, 30, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 75, 40,139, 61,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,111, 18,  3,187,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-207,  3,116, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,207,  3,116, 64,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,207,  3,116, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,149, 53,207, 65,214,211,111, 65,  0,  0,  0,  0,  0,  0,  0,  0,
-221, 57, 80, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 20,  0,251,251,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  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,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 92, 62, 55, 63,
- 56,186,224,190,237,203,148,190,  3,236,234,190,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,180, 66,  0,  0,180, 66,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,240,  0,  0,  0,128, 55,227,  2,157,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 51, 51, 51, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 65,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  7,  0,
-144, 12,228,  2,  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,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
-  3,  0,  0,  0,  1,  0,  3,  0,  8,  8,  0,  0,  0,  0, 12, 66,  0,  0,128, 63,205,204,204, 61,  0,  0,122, 68,  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, 16,  0, 10,  0,  7,  1,  0,  3,  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, 68, 65, 84, 65, 96,  0,  0,  0,  0, 95,215,  2,197,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-112, 94,215,  2,248,  9,226,  2,104,  9,226,  2,240, 11,226,  2,168, 11,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 67,  1,  0,  0,
-141,  1,  0,  0,233,  3,  0,  0,  3,  3, 68,  1, 93,  2,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,248, 58,227,  2,
-248, 58,227,  2,168, 56,227,  2,208, 57,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
-248,  0,  0,  0,168, 56,227,  2,198,  0,  0,  0,  1,  0,  0,  0,208, 57,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,244, 67,
-  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,  0,162, 67,  0,  0,  0,  0,  0,  0,208, 65,  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, 67,  1,  0,  0,
-  0,  0,  0,  0, 25,  0,  0,  0,  0,128,161, 67,  0,  0,200, 65,  0,128,161, 67,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 68,  1, 26,  0, 68,  1, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 67,  1,  0,  0,141,  1,  0,  0,166,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68,  1, 26,  0,  0,  0,  1,  0,  2,  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,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,208, 57,227,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-168, 56,227,  2,  0,  0,  0,  0,  0,128,141, 67,  0,  0,244,194,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,153, 67,  0, 64, 12,196,
-  0,  0,  0,  0, 51,  1,  0,  0, 68,  1,  0,  0, 18,  0,  0,  0, 66,  2,  0,  0,  0,  0,  0,  0, 50,  1,  0,  0,  0,  0,  0,  0,
- 17,  0,  0,  0,  0,  0,  0,  0, 50,  1,  0,  0, 18,  0,  0,  0, 66,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63, 18,  6,  0,  0,  2,  0,  3,  3,  0,  0, 12,  4,  6,  0, 68,  1, 67,  2, 51,  1,
- 49,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 67,  1,  0,  0,167,  1,  0,  0,233,  3,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68,  1, 67,  2,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,244,  0,  0,  0,248, 58,227,  2,
-166,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,
+ 88,  1,  0,  0,136, 89, 19,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0, 40, 91, 19,  6,  0,  0,  0,  0,232, 87, 19,  6,
+  0,  0,  0,  0,184,155,122,108,161,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,100,105,
+109,101,110,115,105,111,110,115,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,100,105,
+109,101,110,115,105,111,110,115,  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, 68,105,109,101,110,115,105,111,110,115,  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,  0,  0,  0,  0,  0,  0,140,254, 29,  1,203,  0,  0,  0,  0,  0,
+  0,  0,  6,  0,  0,  0,  0,  0, 13,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0, 40, 91, 19,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0,200, 92, 19,  6,  0,  0,  0,  0,136, 89, 19,  6,  0,  0,  0,  0, 40,158,122,108,161,127,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 97,110,116,105, 97,108,105, 97,115,105,110,103,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 97,110,116,105, 97,108,105, 97,115,105,110,103,  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,176,237,205,  2,  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,  1,  0,  0,  0, 68, 65, 84, 65,
- 12,  0,  0,  0,176,237,205,  2,221,  0,  0,  0,  1,  0,  0,  0, 14,  0,  0,  0, 14,  0,  0,  0,112, 94,227,  2, 68, 65, 84, 65,
-168,  0,  0,  0,112, 94,227,  2,220,  0,  0,  0, 14,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,144,  1,228,  2, 19,  0,  0,  0,
-  1,  0,  1,  0,144,  1,228,  2, 20,  0,  0,  0,  1,  0,  1,  0,144,  1,228,  2, 21,  0,  1,  0,  1,  0,  0,  0,144,  1,228,  2,
-  0,  0,  0,  0,  1,  0,  1,  0,240, 10,228,  2,  0,  0,  0,  0,  1,  0,  1,  0,240, 16,228,  2,  0,  0,  0,  0,  1,  0,  1,  0,
-144, 30,221,  2,  0,  0,  0,  0,  1,  0,  1,  0, 32, 26,228,  2,  0,  0,  0,  0,  1,  0,  1,  0,  8, 97,223,  2,  0,  0,  0,  0,
-  1,  0,  1,  0,192, 21,228,  2,  0,  0,  0,  0,  1,  0,  1,  0, 80,  9,228,  2,  0,  0,  0,  0,  1,  0,  1,  0,144, 12,228,  2,
-  0,  0,  0,  0,  1,  0,  1,  0,184,  8,228,  2, 21,  0,  0,  0,  1,  0,  1,  0,144,  1,228,  2, 83, 78,  0,  0,148,  0,  0,  0,
- 72,252,213,  2,193,  0,  0,  0,  1,  0,  0,  0, 16,253,213,  2,128,251,213,  2,  0,  0,  0,  0,  0,  0,  0,  0, 83, 82, 83, 99,
-114,105,112,116,105,110,103,  0,103, 46, 48, 48, 49,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-240, 76,227,  2,152, 80,227,  2,224, 80,227,  2,200, 86,227,  2,144, 95,215,  2, 96, 98,215,  2,  0,  0,  0,  0,  0,  0,  0,  0,
-144,  1,228,  2,  0,  0,  0,  0,  6,  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,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 20,  0,  0,  0,240, 76,227,  2,194,  0,  0,  0,  1,  0,  0,  0, 56, 77,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0, 56, 77,227,  2,194,  0,  0,  0,  1,  0,  0,  0,128, 77,227,  2,
-240, 76,227,  2,  0,  0,  0,  0,  0,  0,  5,  4,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,128, 77,227,  2,194,  0,  0,  0,
-  1,  0,  0,  0,200, 77,227,  2, 56, 77,227,  2,  0,  0,  0,  0,126,  7,  5,  4,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,
-200, 77,227,  2,194,  0,  0,  0,  1,  0,  0,  0, 16, 78,227,  2,128, 77,227,  2,  0,  0,  0,  0,126,  7,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 20,  0,  0,  0, 16, 78,227,  2,194,  0,  0,  0,  1,  0,  0,  0, 88, 78,227,  2,200, 77,227,  2,  0,  0,  0,  0,
-  0,  0,168,  3,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0, 88, 78,227,  2,194,  0,  0,  0,  1,  0,  0,  0,160, 78,227,  2,
- 16, 78,227,  2,  0,  0,  0,  0,126,  7,168,  3,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,160, 78,227,  2,194,  0,  0,  0,
-  1,  0,  0,  0,232, 78,227,  2, 88, 78,227,  2,  0,  0,  0,  0,240,  5,168,  3,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,
-232, 78,227,  2,194,  0,  0,  0,  1,  0,  0,  0, 48, 79,227,  2,160, 78,227,  2,  0,  0,  0,  0,240,  5,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 20,  0,  0,  0, 48, 79,227,  2,194,  0,  0,  0,  1,  0,  0,  0,120, 79,227,  2,232, 78,227,  2,  0,  0,  0,  0,
-  0,  0,104,  1,  1,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,120, 79,227,  2,194,  0,  0,  0,  1,  0,  0,  0,192, 79,227,  2,
- 48, 79,227,  2,  0,  0,  0,  0,240,  5,104,  1,  1,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,192, 79,227,  2,194,  0,  0,  0,
-  1,  0,  0,  0,  8, 80,227,  2,120, 79,227,  2,  0,  0,  0,  0,248,  2,104,  1,  1,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,
-  8, 80,227,  2,194,  0,  0,  0,  1,  0,  0,  0, 80, 80,227,  2,192, 79,227,  2,  0,  0,  0,  0,240,  5,236,  2,  0,  0,  0,  0,
- 68, 65, 84, 65, 20,  0,  0,  0, 80, 80,227,  2,194,  0,  0,  0,  1,  0,  0,  0,152, 80,227,  2,  8, 80,227,  2,  0,  0,  0,  0,
-126,  7,236,  2,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,152, 80,227,  2,194,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
- 80, 80,227,  2,  0,  0,  0,  0,248,  2,168,  3,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,224, 80,227,  2,195,  0,  0,  0,
-  1,  0,  0,  0, 40, 81,227,  2,  0,  0,  0,  0, 56, 77,227,  2,128, 77,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 24,  0,  0,  0, 40, 81,227,  2,195,  0,  0,  0,  1,  0,  0,  0,112, 81,227,  2,224, 80,227,  2, 56, 77,227,  2, 16, 78,227,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,112, 81,227,  2,195,  0,  0,  0,  1,  0,  0,  0,184, 81,227,  2,
- 40, 81,227,  2,128, 77,227,  2, 88, 78,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,184, 81,227,  2,
-195,  0,  0,  0,  1,  0,  0,  0,  0, 82,227,  2,112, 81,227,  2, 16, 78,227,  2, 88, 78,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 24,  0,  0,  0,  0, 82,227,  2,195,  0,  0,  0,  1,  0,  0,  0, 72, 82,227,  2,184, 81,227,  2, 88, 78,227,  2,
-160, 78,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 72, 82,227,  2,195,  0,  0,  0,  1,  0,  0,  0,
-144, 82,227,  2,  0, 82,227,  2,200, 77,227,  2,232, 78,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,
-144, 82,227,  2,195,  0,  0,  0,  1,  0,  0,  0,216, 82,227,  2, 72, 82,227,  2,240, 76,227,  2, 48, 79,227,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,216, 82,227,  2,195,  0,  0,  0,  1,  0,  0,  0, 32, 83,227,  2,144, 82,227,  2,
- 16, 78,227,  2, 48, 79,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 32, 83,227,  2,195,  0,  0,  0,
-  1,  0,  0,  0,104, 83,227,  2,216, 82,227,  2,160, 78,227,  2,120, 79,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 24,  0,  0,  0,104, 83,227,  2,195,  0,  0,  0,  1,  0,  0,  0,176, 83,227,  2, 32, 83,227,  2,232, 78,227,  2,120, 79,227,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,176, 83,227,  2,195,  0,  0,  0,  1,  0,  0,  0,248, 83,227,  2,
-104, 83,227,  2, 48, 79,227,  2,192, 79,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,248, 83,227,  2,
-195,  0,  0,  0,  1,  0,  0,  0, 64, 84,227,  2,176, 83,227,  2,120, 79,227,  2,192, 79,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 24,  0,  0,  0, 64, 84,227,  2,195,  0,  0,  0,  1,  0,  0,  0,136, 84,227,  2,248, 83,227,  2,232, 78,227,  2,
-  8, 80,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,136, 84,227,  2,195,  0,  0,  0,  1,  0,  0,  0,
-208, 84,227,  2, 64, 84,227,  2,160, 78,227,  2,  8, 80,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,
-208, 84,227,  2,195,  0,  0,  0,  1,  0,  0,  0, 24, 85,227,  2,136, 84,227,  2, 88, 78,227,  2, 80, 80,227,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 24, 85,227,  2,195,  0,  0,  0,  1,  0,  0,  0, 96, 85,227,  2,208, 84,227,  2,
-200, 77,227,  2, 80, 80,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 96, 85,227,  2,195,  0,  0,  0,
-  1,  0,  0,  0,168, 85,227,  2, 24, 85,227,  2,  8, 80,227,  2, 80, 80,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 24,  0,  0,  0,168, 85,227,  2,195,  0,  0,  0,  1,  0,  0,  0,240, 85,227,  2, 96, 85,227,  2, 16, 78,227,  2,152, 80,227,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,240, 85,227,  2,195,  0,  0,  0,  1,  0,  0,  0, 56, 86,227,  2,
-168, 85,227,  2,160, 78,227,  2,152, 80,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 56, 86,227,  2,
-195,  0,  0,  0,  1,  0,  0,  0,128, 86,227,  2,240, 85,227,  2,192, 79,227,  2,152, 80,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 24,  0,  0,  0,128, 86,227,  2,195,  0,  0,  0,  1,  0,  0,  0,200, 86,227,  2, 56, 86,227,  2, 48, 79,227,  2,
-120, 79,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,200, 86,227,  2,195,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,128, 86,227,  2,240, 76,227,  2,232, 78,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 96,  0,  0,  0,
-144, 95,215,  2,197,  0,  0,  0,  1,  0,  0,  0, 32, 96,215,  2,  0,  0,  0,  0, 16, 78,227,  2, 56, 77,227,  2,128, 77,227,  2,
- 88, 78,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,  0,  0,169,  3,  0,  0,  5,  4,  0,  0,  7,  7,127,  7, 93,  0,  1,  0,
-  0,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0, 88,234,220,  2, 88,234,220,  2, 32, 60,227,  2, 72, 61,227,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0, 32, 60,227,  2,198,  0,  0,  0,  1,  0,  0,  0,
- 72, 61,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32,148, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,224,239, 68,
-  0,  0,  0,  0,  0,  0,208, 65,  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,126,  7,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,192,239, 68,  0,  0,200, 65,
-  0,192,239, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,127,  7,
- 26,  0,127,  7, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,  0,  0,236,  3,  0,  0,
-  5,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,127,  7, 26,  0,  0,  0,  1,  0,  1,  0,  0,  0,
+  0,  0,  0,  0, 65,110,116,105, 45, 65,108,105, 97,115,105,110,103,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,
- 72, 61,227,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 32, 60,227,  2,  0,  0,  0,  0,  0,192,239, 68,  0,  0,  0,  0,
-  0,  0, 28, 66,  0,  0,  0,  0,  0,192,237, 68,  0,  0,  0,  0,  0,  0,134, 66,110,  7,  0,  0,127,  7,  0,  0,  0,  0,  0,  0,
- 66,  0,  0,  0,  0,  0,  0,  0,111,  7,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,109,  7,  0,  0,  0,  0,  0,  0,
- 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  2,  2,  0,  0,
-  1,  0,  3,  3,  2,  0,  0,  4, 10,  0,127,  7, 67,  0,110,  7, 67,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,126,  7,  0,  0,169,  3,  0,  0,235,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-127,  7, 67,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 96,  0,  0,  0, 32, 96,215,  2,197,  0,  0,  0,  1,  0,  0,  0,176, 96,215,  2,144, 95,215,  2,
-232, 78,227,  2,  8, 80,227,  2, 80, 80,227,  2,200, 77,227,  2,  0,  0,  0,  0,241,  5,  0,  0,126,  7,  0,  0,  0,  0,  0,  0,
-235,  2,  0,  0,  4,  4,142,  1,236,  2,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72,127,227,  2, 72,127,227,  2,
-112, 62,227,  2,152, 63,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,
-112, 62,227,  2,198,  0,  0,  0,  1,  0,  0,  0,152, 63,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,148, 67,  0,  0,  0,  0,
-  0,  0,208, 65,  0,  0,  0,  0,  0,  0,199, 67,  0,  0,  0,  0,  0,  0,208, 65,  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,141,  1,  0,  0,  0,  0,  0,  0,
- 25,  0,  0,  0,  0,128,198, 67,  0,  0,200, 65,  0,128,198, 67,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,142,  1, 26,  0,142,  1, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-241,  5,  0,  0,126,  7,  0,  0,210,  2,  0,  0,235,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-142,  1, 26,  0,  0,  0,  1,  0,  1,  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,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,152, 63,227,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,112, 62,227,  2,
-  0,  0,  0,  0,  0,128,198, 67,  0,  0, 61,196,  0,  0,  0,  0,  0,  0,  0,  0,254,127,190, 67,254,127, 52,196,  0,  0,  0,  0,
-125,  1,  0,  0,142,  1,  0,  0,  0,  0,  0,  0,209,  2,  0,  0,  0,  0,  0,  0,126,  1,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,
-  0,  0,  0,  0,124,  1,  0,  0,  0,  0,  0,  0,209,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0, 63,  0,  0,  0, 64, 10,  1,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,142,  1,210,  2,125,  1,210,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,241,  5,  0,  0,126,  7,  0,  0,  0,  0,  0,  0,209,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,142,  1,210,  2,  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,160,151,226,  2,152,108,227,  2,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 64,  1,  0,  0,160,151,226,  2,196,  0,  0,  0,
-  1,  0,  0,  0, 24,153,226,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 85, 84, 84, 79, 78, 83, 95, 80, 84, 95, 99,
-111,110,116,101,120,116,  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, 66, 85, 84, 84, 79, 78, 83, 95, 80, 84, 95, 99,
-111,110,116,101,120,116,  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, 67,111,110,116,101,120,116,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0, 58,254, 29,  1, 58,  0, 20,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0, 14,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,220,255,124,  1, 36,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 88,  1,  0,  0,200, 92, 19,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,104, 94, 19,  6,  0,  0,  0,  0, 40, 91, 19,  6,
+  0,  0,  0,  0,152,160,122,108,161,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,109,111,
+116,105,111,110, 95, 98,108,117,114,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,109,111,
+116,105,111,110, 95, 98,108,117,114,  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, 83, 97,109,112,108,101,100, 32, 77,111,116,105,
+111,110, 32, 66,108,117,114,  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, 34,254, 29,  1,  0,  0, 20,  0,  0,  0,
+  4,  0,  6,  0,  0,  0,  0,  0, 15,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0, 24,153,226,  2,196,  0,  0,  0,  1,  0,  0,  0, 96, 95,227,  2,160,151,226,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,114,101,110,100,101,114,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,104, 94, 19,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0,  8, 96, 19,  6,  0,  0,  0,  0,200, 92, 19,  6,  0,  0,  0,  0, 24,184, 80,108,161,127,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,104, 97,100,105,110,103,  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,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,114,101,110,100,101,114,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,104, 97,100,105,110,103,  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,  0, 82,101,110,100,101,114,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 83,104, 97,100,105,110,103,  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,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,135,255,124,  1, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  0,  0, 10,254, 29,  1,  0,  0,  0,  0,  0,  0,  4,  0,  6,  0,  0,  0,  0,  0, 16,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,
- 96, 95,227,  2,196,  0,  0,  0,  1,  0,  0,  0,216, 96,227,  2, 24,153,226,  2,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68,
- 69, 82, 95, 80, 84, 95,108, 97,121,101,114,115,  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, 82, 69, 78, 68,
- 69, 82, 95, 80, 84, 95,108, 97,121,101,114,115,  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, 76, 97,121,101,
-114,115,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,111,255,
-124,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  2,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,216, 96,227,  2,196,  0,  0,  0,  1,  0,  0,  0,
- 80, 98,227,  2, 96, 95,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,100,105,109,101,110,115,
-105,111,110,115,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,100,105,109,101,110,115,
-105,111,110,115,  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, 68,105,109,101,110,115,105,111,110,115,  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,  0,  0,  0,  0,  0,  0,140,254,124,  1,203,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  3,  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,  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,
- 68, 65, 84, 65, 64,  1,  0,  0, 80, 98,227,  2,196,  0,  0,  0,  1,  0,  0,  0,200, 99,227,  2,216, 96,227,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 97,110,116,105, 97,108,105, 97,115,105,110,103,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 97,110,116,105, 97,108,105, 97,115,105,110,103,  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, 65,110,116,105, 45, 65,108,105, 97,115,105,110,103,  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,  0,  0,  0, 58,254,124,  1, 58,  0, 20,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,200, 99,227,  2,
-196,  0,  0,  0,  1,  0,  0,  0, 64,101,227,  2, 80, 98,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80,
- 84, 95,109,111,116,105,111,110, 95, 98,108,117,114,  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, 82, 69, 78, 68, 69, 82, 95, 80,
- 84, 95,109,111,116,105,111,110, 95, 98,108,117,114,  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, 83, 97,109,112,108,101,100, 32,
- 77,111,116,105,111,110, 32, 66,108,117,114,  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, 34,254,124,  1,  0,  0,
- 20,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  5,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0, 64,101,227,  2,196,  0,  0,  0,  1,  0,  0,  0,184,102,227,  2,
-200, 99,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,104, 97,100,105,110,103,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,104, 97,100,105,110,103,  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, 83,104, 97,100,105,110,103,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,254,124,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
-  6,  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,  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, 68, 65, 84, 65,
- 64,  1,  0,  0,184,102,227,  2,196,  0,  0,  0,  1,  0,  0,  0, 48,104,227,  2, 64,101,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,101,114,102,111,114,109, 97,110, 99,101,  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,
- 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,101,114,102,111,114,109, 97,110, 99,101,  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,
- 80,101,114,102,111,114,109, 97,110, 99,101,  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,  0,  0,  0,
-  0,  0,242,253,124,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  7,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0, 48,104,227,  2,196,  0,  0,  0,
-  1,  0,  0,  0,168,105,227,  2,184,102,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,111,
-115,116, 95,112,114,111, 99,101,115,115,105,110,103,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,111,
-115,116, 95,112,114,111, 99,101,115,115,105,110,103,  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, 80,111,115,116, 32, 80,114,111, 99,101,115,115,
-105,110,103,  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,  0,218,253,124,  1,  0,  0,  0,  0,  0,  0,
-  4,  0,  0,  0,  0,  0,  0,  0,  8,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,168,105,227,  2,196,  0,  0,  0,  1,  0,  0,  0, 32,107,227,  2, 48,104,227,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,116, 97,109,112,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,116, 97,109,112,  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, 83,116, 97,109,112,  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,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,194,253,124,  1,  0,  0, 20,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  9,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,
- 32,107,227,  2,196,  0,  0,  0,  1,  0,  0,  0,152,108,227,  2,168,105,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68,
- 69, 82, 95, 80, 84, 95,111,117,116,112,117,116,  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, 82, 69, 78, 68,
- 69, 82, 95, 80, 84, 95,111,117,116,112,117,116,  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, 79,117,116,112,
-117,116,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40,253,
-124,  1,130,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,  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,  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, 68, 65, 84, 65, 64,  1,  0,  0,152,108,227,  2,196,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0, 32,107,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 98, 97,107,101,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 98, 97,107,101,  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, 66, 97,107,101,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16,253,124,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,
-  0,  0,  0,  0, 11,  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,  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,
- 68, 65, 84, 65,216,  0,  0,  0, 72,127,227,  2,162,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  4,  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,  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,  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,  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,  2,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-255, 21,  0,  0,160,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 96,  0,  0,  0,176, 96,215,  2,197,  0,  0,  0,  1,  0,  0,  0,
- 64, 97,215,  2, 32, 96,215,  2,192, 79,227,  2,152, 80,227,  2,160, 78,227,  2,120, 79,227,  2,  0,  0,  0,  0,249,  2,  0,  0,
-239,  5,  0,  0,105,  1,  0,  0,167,  3,  0,  0,  1,  1,247,  2, 63,  2,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-224,131,227,  2,224,131,227,  2,192, 64,227,  2,184,130,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65,248,  0,  0,  0,192, 64,227,  2,198,  0,  0,  0,  1,  0,  0,  0,232, 65,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,
-  0, 64,113, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,192, 61, 68,  0,  0,  0,  0,  0,  0,208, 65,  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,
-246,  2,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,128, 61, 68,  0,  0,200, 65,  0,128, 61, 68,  0,  0,200, 65,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,247,  2, 26,  0,247,  2, 26,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,249,  2,  0,  0,239,  5,  0,  0,105,  1,  0,  0,130,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,247,  2, 26,  0,  0,  0,  1,  0,  2,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,232, 65,227,  2,198,  0,  0,  0,  1,  0,  0,  0,
-104,128,227,  2,192, 64,227,  2,  0,  0,  0,  0,  0,  0, 15, 67,  0, 64, 70,196,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 15, 67,
-255,127, 70,196,  0,  0,  0,  0,143,  0,  0,  0,160,  0,  0,  0, 18,  0,  0,  0, 43,  3,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,
-  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0, 18,  0,  0,  0, 43,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  0,  0,  0,  1,  0,  7,  0, 18,  0,  0,  0,  6,  0,160,  0,
- 44,  3,143,  0, 26,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,249,  2,  0,  0,249,  2,  0,  0,131,  1,  0,  0,
-167,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0, 37,  2,  0,  0,  5,  0,  3,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,
-104,128,227,  2,198,  0,  0,  0,  1,  0,  0,  0,144,129,227,  2,232, 65,227,  2,  0,  0,  0,  0,  0,  0, 16, 67,  0,  0,206,194,
-  0,  0,  0,  0,  0,  0,  0,  0,231,102, 16, 67,  0,  0,206,194,  0,  0,  0,  0,143,  0,  0,  0,160,  0,  0,  0, 18,  0,  0,  0,
-119,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0, 18,  0,  0,  0,
-119,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  0,  0,  0,
-  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,160,  0,120,  0,143,  0,102,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-249,  2,  0,  0,239,  5,  0,  0,131,  1,  0,  0,131,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  1,  0,  0,  0,  6,  0, 34,  0,  2,  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,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,144,129,227,  2,198,  0,  0,  0,  1,  0,  0,  0,184,130,227,  2,104,128,227,  2,
-  0,  0,  0,  0,  0,  0, 35, 67,  0,128,142,196,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 35, 67,  0,  0, 26,196,  0,  0,  0,  0,
-163,  0,  0,  0,180,  0,  0,  0, 18,  0,  0,  0,121,  2,  0,  0,  0,  0,  0,  0,162,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,
-  0,  0,  0,  0,162,  0,  0,  0, 18,  0,  0,  0,121,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0, 63,  0,  0,  0, 64, 10,  0,  0,  0,  1,  0,  7,  0, 18,  0,  0,  0,  6,  0,180,  0,122,  2,163,  0,104,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,239,  5,  0,  0,239,  5,  0,  0,131,  1,  0,  0,167,  3,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  4,  0,  4,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,184,130,227,  2,198,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,144,129,227,  2,  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,  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,  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,249,  2,  0,  0,239,  5,  0,  0,
-131,  1,  0,  0,167,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,247,  2, 37,  2,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 80,160,227,  2, 68, 65, 84, 65,
- 68,  3,  0,  0, 80,160,227,  2,156,  0,  0,  0,  1,  0,  0,  0,  0,  0,140, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 74,141,193, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 80,  1,128,191,  0,  0,128,191,
-  0,  0,  0,  0,  0,  0,  0,  0,225,215,163,188,  0,  0,  0,  0, 68,239,209, 62, 51,177,205,190,184,158, 81, 63,  0,  0,  0,  0,
- 70,119,105, 63,143, 74, 70, 62, 35, 44,185,190,  0,  0,  0,  0,162, 84, 89,188,166, 33,101, 63, 42, 61,228, 62,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,214,211,111,193,  0,  0,128, 63, 69,239,209, 62, 70,119,105, 63,176, 84, 89,188,  0,  0,  0,  0,
- 53,177,205,190,142, 74, 70, 62,166, 33,101, 63,  0,  0,  0,  0,185,158, 81, 63, 35, 44,185,190, 43, 61,228, 62,  0,  0,  0,  0,
-164, 96, 68, 65,111,121,173,192,248,209,213, 64,  0,  0,128, 63,178,157,229, 62, 30,132, 27,191,222,160, 81,191,184,158, 81,191,
-117, 90,127, 63,166,235,149, 62,  9, 46,185, 62, 35, 44,185, 62,145,180,109,188,212, 60,173, 63,129, 63,228,190, 42, 61,228,190,
-  0,  0,  0,  0,  0,  0,  0,  0, 96,132,111, 65,214,211,111, 65,217,236,191, 62, 54,117, 85, 63,224,246, 70,188,  0,160, 32,182,
-252,  5,136,190, 43, 33,  3, 62,235,135, 23, 63,  0,  0, 96, 53,215,104, 25,196,133,132,135, 67, 37,  9,167,195,136,252, 71,194,
-  3, 54, 25, 68,158, 87,135,195,205,209,166, 67,151,254, 71, 66, 68,239,209, 62, 51,177,205,190,184,158, 81, 63,  0,  0,  0,  0,
- 70,119,105, 63,143, 74, 70, 62, 35, 44,185,190,  0,  0,  0,  0,162, 84, 89,188,166, 33,101, 63, 42, 61,228, 62,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,214,211,111,193,  0,  0,128, 63,178,157,229, 62, 30,132, 27,191,222,160, 81,191,184,158, 81,191,
-117, 90,127, 63,166,235,149, 62,  9, 46,185, 62, 35, 44,185, 62,145,180,109,188,212, 60,173, 63,129, 63,228,190, 42, 61,228,190,
-  0,  0,  0,  0,  0,  0,  0,  0, 96,132,111, 65,214,211,111, 65, 46, 86, 45, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 46, 86, 45, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 46, 86, 45, 64,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63, 92, 62, 55, 63, 56,186,224,190,237,203,148,190,  3,236,234,190,
-214,211,111, 65,214,211,111, 65,  0,  0,  0,  0,  0,  0,  0,  0,107,227, 29, 59,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,255,255,  1,  0,  0,  0,  0,  0,  0,  0,  1,  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,  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,  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,  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,  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,128, 63, 30, 33, 12, 66, 86,152,137, 66,116, 27,126, 66,  0,  0,  0,  0, 68, 65, 84, 65,240,  0,  0,  0,224,131,227,  2,
-157,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 51, 51, 51, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0, 32, 65,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  7,  0,144, 12,228,  2,  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,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  3,  0,  0,  0,  1,  0,  3,  0,  8,  8,  0,  0,  0,  0, 12, 66,
-  0,  0,128, 63, 10,215, 35, 60,  0,  0,250, 67,  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, 16,  0, 10,  0,  7,  1,  0,  3,  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, 68, 65, 84, 65, 96,  0,  0,  0,
- 64, 97,215,  2,197,  0,  0,  0,  1,  0,  0,  0,208, 97,215,  2,176, 96,215,  2,240, 76,227,  2, 48, 79,227,  2,120, 79,227,  2,
-232, 78,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,239,  5,  0,  0,  0,  0,  0,  0,103,  1,  0,  0, 18, 18,240,  5,104,  1,  1,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200,163,227,  2,200,163,227,  2,  8,133,227,  2, 48,134,227,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,  8,133,227,  2,198,  0,  0,  0,  1,  0,  0,  0,
- 48,134,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,160, 67,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,  0,190, 68,
-  0,  0,  0,  0,  0,  0,208, 65,  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,239,  5,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,224,189, 68,  0,  0,200, 65,
-  0,224,189, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,240,  5,
- 26,  0,240,  5, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,239,  5,  0,  0,  0,  0,  0,  0,
- 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  5, 26,  0,  0,  0,  1,  0,  2,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,
- 48,134,227,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  8,133,227,  2,  0,  0,  0,  0,  0,224,189, 68,  0,  0,  0,  0,
-  0,  0, 51, 67,  0,  0,  0,  0,  0,224,187, 68,  0,  0,  0,  0,  0,  0,167, 67,223,  5,  0,  0,240,  5,  0,  0,  0,  0,  0,  0,
- 77,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,222,  5,  0,  0,  0,  0,  0,  0,
- 77,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  2,  2,  0,  0,
-  1,  0,  3,  3,  2,  0,  0,  4, 10,  0,240,  5, 78,  1,223,  5, 78,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,239,  5,  0,  0, 26,  0,  0,  0,103,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-240,  5, 78,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 28,  0,  0,  0, 64, 28,204,  2,177,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0, 88, 17,216,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0, 88, 17,216,  2,
-  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,104,  1,  0,  0,200,163,227,  2,178,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 18,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 14,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64, 28,204,  2, 64, 28,204,  2,
- 62, 62, 62, 32,  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,  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,  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,  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,  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,  0,  0,
-112,121,116,104,111,110,  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,
-  8,  4,  0,  0,  8,  4,  0,  0, 68, 65, 84, 65, 96,  0,  0,  0,208, 97,215,  2,197,  0,  0,  0,  1,  0,  0,  0, 96, 98,215,  2,
- 64, 97,215,  2,  8, 80,227,  2,160, 78,227,  2, 88, 78,227,  2, 80, 80,227,  2,  0,  0,  0,  0,241,  5,  0,  0,126,  7,  0,  0,
-237,  2,  0,  0,167,  3,  0,  0,  3,  3,142,  1,187,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,168,137,227,  2,
-168,137,227,  2, 88,135,227,  2,128,136,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
-248,  0,  0,  0, 88,135,227,  2,198,  0,  0,  0,  1,  0,  0,  0,128,136,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,244, 67,
-  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,  0,199, 67,  0,  0,  0,  0,  0,  0,208, 65,  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,141,  1,  0,  0,
-  0,  0,  0,  0, 25,  0,  0,  0,  0,128,198, 67,  0,  0,200, 65,  0,128,198, 67,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,142,  1, 26,  0,142,  1, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,241,  5,  0,  0,126,  7,  0,  0,237,  2,  0,  0,  6,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,142,  1, 26,  0,  0,  0,  1,  0,  2,  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,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,128,136,227,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
- 88,135,227,  2,  0,  0,  0,  0,  0,128,141, 67,  0,  0,244,194,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,190, 67,  0,  0, 15,195,
-  0,  0,  0,  0,125,  1,  0,  0,142,  1,  0,  0, 18,  0,  0,  0,160,  0,  0,  0,  0,  0,  0,  0,124,  1,  0,  0,  0,  0,  0,  0,
- 17,  0,  0,  0,  0,  0,  0,  0,124,  1,  0,  0, 18,  0,  0,  0,160,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63, 18,  6,  0,  0,  2,  0,  3,  3,  0,  0, 12,  4,  6,  0,142,  1,161,  0,125,  1,
-143,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,241,  5,  0,  0,126,  7,  0,  0,  7,  3,  0,  0,167,  3,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,142,  1,161,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,244,  0,  0,  0,168,137,227,  2,
-166,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,240,237,205,  2,  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,  1,  0,  0,  0, 68, 65, 84, 65,
- 12,  0,  0,  0,240,237,205,  2,221,  0,  0,  0,  1,  0,  0,  0, 14,  0,  0,  0, 14,  0,  0,  0, 96,165,227,  2, 68, 65, 84, 65,
-168,  0,  0,  0, 96,165,227,  2,220,  0,  0,  0, 14,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,144,  1,228,  2, 19,  0,  0,  0,
-  1,  0,  1,  0,144,  1,228,  2, 20,  0,  0,  0,  1,  0,  1,  0,144,  1,228,  2, 21,  0,  1,  0,  1,  0,  0,  0,144,  1,228,  2,
-  0,  0,  0,  0,  1,  0,  1,  0,240, 10,228,  2,  0,  0,  0,  0,  1,  0,  1,  0,240, 16,228,  2,  0,  0,  0,  0,  1,  0,  1,  0,
-144, 30,221,  2,  0,  0,  0,  0,  1,  0,  1,  0, 32, 26,228,  2,  0,  0,  0,  0,  1,  0,  1,  0,  8, 97,223,  2,  0,  0,  0,  0,
-  1,  0,  1,  0,192, 21,228,  2,  0,  0,  0,  0,  1,  0,  1,  0, 80,  9,228,  2,  0,  0,  0,  0,  1,  0,  1,  0,144, 12,228,  2,
-  0,  0,  0,  0,  1,  0,  1,  0,184,  8,228,  2, 21,  0,  0,  0,  1,  0,  1,  0,144,  1,228,  2, 68, 65, 84, 65, 96,  0,  0,  0,
- 96, 98,215,  2,197,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,208, 97,215,  2, 48, 79,227,  2, 16, 78,227,  2,152, 80,227,  2,
-192, 79,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,247,  2,  0,  0,105,  1,  0,  0,167,  3,  0,  0,  9,  9,248,  2, 63,  2,  1,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 56,166,227,  2, 56,166,227,  2,208,138,227,  2,248,139,227,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,208,138,227,  2,198,  0,  0,  0,  1,  0,  0,  0,
-248,139,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,230, 67,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,  0, 62, 68,
-  0,  0,  0,  0,  0,  0,208, 65,  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,247,  2,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,192, 61, 68,  0,  0,200, 65,
-  0,192, 61, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,248,  2,
- 26,  0,248,  2, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,247,  2,  0,  0,105,  1,  0,  0,
-130,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,248,  2, 26,  0,  0,  0,  1,  0,  2,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,
-248,139,227,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,208,138,227,  2,  0,  0,  0,  0,  0,224,189, 68,  0,  0,  0,  0,
-  0,192, 22, 68,248,150, 23, 68,  8, 41,100, 68, 46,224, 62, 67,233, 15,206, 67,  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,247,  2,  0,  0,  0,  0,  0,  0,
- 36,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,215, 35, 60,  0,  0,122, 68,  0,  0,  0,  0,
-  1,  0,  3,  0,  0,  0,  0,  4, 10,  0,248,  2, 37,  2,248,  2, 37,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,247,  2,  0,  0,131,  1,  0,  0,167,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-248,  2, 37,  2,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,136,  2,  0,  0, 56,166,227,  2,169,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  9,  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, 32,  0,  0,  0,  0,  0,  0,  0, 12,  0,  7,  0,  0,  0,  0,  0,  1,  0,  0,  0,  4,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,205,204,204, 61,231,  1,  0,  0,243,  1,  0,  0,122,  1,  0,  0,124,  1,  0,  0,231,  1,  0,  0,
-243,  1,  0,  0,  4,  0,  0,  0,124,  1,  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,  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,  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,
-  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,  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,  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,  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,  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,  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,  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,  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,
- 83, 78,  0,  0,148,  0,  0,  0, 16,253,213,  2,193,  0,  0,  0,  1,  0,  0,  0,216,253,213,  2, 72,252,213,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 83, 82, 85, 86, 32, 69,100,105,116,105,110,103,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  8,169,227,  2,  0,171,227,  2, 72,171,227,  2, 24,174,227,  2,240, 98,215,  2, 16,100,215,  2,
-  0,  0,  0,  0,  0,  0,  0,  0,144,  1,228,  2,  0,  0,  0,  0,  6,  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,  0,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,  8,169,227,  2,194,  0,  0,  0,  1,  0,  0,  0, 80,169,227,  2,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0, 80,169,227,  2,194,  0,  0,  0,
-  1,  0,  0,  0,152,169,227,  2,  8,169,227,  2,  0,  0,  0,  0,  0,  0,  5,  4,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,
-152,169,227,  2,194,  0,  0,  0,  1,  0,  0,  0,224,169,227,  2, 80,169,227,  2,  0,  0,  0,  0,126,  7,  5,  4,  0,  0,  0,  0,
- 68, 65, 84, 65, 20,  0,  0,  0,224,169,227,  2,194,  0,  0,  0,  1,  0,  0,  0, 40,170,227,  2,152,169,227,  2,  0,  0,  0,  0,
-126,  7,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0, 40,170,227,  2,194,  0,  0,  0,  1,  0,  0,  0,112,170,227,  2,
-224,169,227,  2,  0,  0,  0,  0,  0,  0,234,  3,  1,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,112,170,227,  2,194,  0,  0,  0,
-  1,  0,  0,  0,184,170,227,  2, 40,170,227,  2,  0,  0,  0,  0,126,  7,234,  3,  1,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,
-184,170,227,  2,194,  0,  0,  0,  1,  0,  0,  0,  0,171,227,  2,112,170,227,  2,  0,  0,  0,  0,200,  3,234,  3,  1,  0,  0,  0,
- 68, 65, 84, 65, 20,  0,  0,  0,  0,171,227,  2,194,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,184,170,227,  2,  0,  0,  0,  0,
-200,  3,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 72,171,227,  2,195,  0,  0,  0,  1,  0,  0,  0,144,171,227,  2,
-  0,  0,  0,  0, 80,169,227,  2,152,169,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,144,171,227,  2,
-195,  0,  0,  0,  1,  0,  0,  0,216,171,227,  2, 72,171,227,  2, 80,169,227,  2, 40,170,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 24,  0,  0,  0,216,171,227,  2,195,  0,  0,  0,  1,  0,  0,  0, 32,172,227,  2,144,171,227,  2,152,169,227,  2,
-112,170,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 32,172,227,  2,195,  0,  0,  0,  1,  0,  0,  0,
-104,172,227,  2,216,171,227,  2, 40,170,227,  2,112,170,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,
-104,172,227,  2,195,  0,  0,  0,  1,  0,  0,  0,176,172,227,  2, 32,172,227,  2, 40,170,227,  2,184,170,227,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,176,172,227,  2,195,  0,  0,  0,  1,  0,  0,  0,248,172,227,  2,104,172,227,  2,
-  8,169,227,  2,  0,171,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,248,172,227,  2,195,  0,  0,  0,
-  1,  0,  0,  0, 64,173,227,  2,176,172,227,  2,  8,169,227,  2, 40,170,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 24,  0,  0,  0, 64,173,227,  2,195,  0,  0,  0,  1,  0,  0,  0,136,173,227,  2,248,172,227,  2,184,170,227,  2,  0,171,227,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,136,173,227,  2,195,  0,  0,  0,  1,  0,  0,  0,208,173,227,  2,
- 64,173,227,  2,112,170,227,  2,184,170,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,208,173,227,  2,
-195,  0,  0,  0,  1,  0,  0,  0, 24,174,227,  2,136,173,227,  2,224,169,227,  2,  0,171,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 24,  0,  0,  0, 24,174,227,  2,195,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,208,173,227,  2,224,169,227,  2,
-112,170,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 96,  0,  0,  0,240, 98,215,  2,197,  0,  0,  0,  1,  0,  0,  0,
-128, 99,215,  2,  0,  0,  0,  0, 40,170,227,  2, 80,169,227,  2,152,169,227,  2,112,170,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,
-126,  7,  0,  0,235,  3,  0,  0,  5,  4,  0,  0,  7,  7,127,  7, 27,  0,  1,  0,  0,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,
-184,234,220,  2,184,234,220,  2, 32,141,227,  2, 72,142,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65,248,  0,  0,  0, 32,141,227,  2,198,  0,  0,  0,  1,  0,  0,  0, 72,142,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,
-  0, 32,148, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,224,239, 68,  0,  0,  0,  0,  0,  0,208, 65,  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,
-126,  7,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,192,239, 68,  0,  0,200, 65,  0,192,239, 68,  0,  0,200, 65,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,127,  7, 26,  0,127,  7, 26,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,  0,  0,235,  3,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,127,  7, 26,  0,  0,  0,  1,  0,  2,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0, 72,142,227,  2,198,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0, 32,141,227,  2,  0,  0,  0,  0,  0,240,109, 69,  0,  0,128,192,  0,  0,  0,  0,  0,  0,  0,  0,255,255,109, 69,
-  0,  0,  0,192,  0,  0,  0,  0,112,  7,  0,  0,129,  7,  0,  0, 18,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,111,  7,  0,  0,
-  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,111,  7,  0,  0, 18,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  2,  0,  0,  0,  1,  0,  3,  3,  2,  0,  0,  4, 10,  0,129,  7,
-  2,  0,112,  7,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  4,  0,  0,
-  5,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  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,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 96,  0,  0,  0,
-128, 99,215,  2,197,  0,  0,  0,  1,  0,  0,  0, 16,100,215,  2,240, 98,215,  2,  8,169,227,  2, 40,170,227,  2,184,170,227,  2,
-  0,171,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,199,  3,  0,  0,  0,  0,  0,  0,233,  3,  0,  0,  6,  6,200,  3,234,  3,  1,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,184,227,  2,240,184,227,  2,112,143,227,  2,192,145,227,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,112,143,227,  2,198,  0,  0,  0,  1,  0,  0,  0,
-152,144,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,215, 67,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,  0,114, 68,
-  0,  0,  0,  0,  0,  0,208, 65,  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,199,  3,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,192,113, 68,  0,  0,200, 65,
-  0,192,113, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,200,  3,
- 26,  0,200,  3, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,199,  3,  0,  0,  0,  0,  0,  0,
- 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200,  3, 26,  0,  0,  0,  1,  0,  2,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,
-152,144,227,  2,198,  0,  0,  0,  1,  0,  0,  0,192,145,227,  2,112,143,227,  2,  0,  0,  0,  0,  0,  0, 91, 67,  0,192,115,196,
-  0,  0,  0,  0,  0,  0,  0,  0,254,255, 74, 67,254,255,115,196,  0,  0,  0,  0,203,  0,  0,  0,220,  0,  0,  0,  0,  0,  0,  0,
-207,  3,  0,  0,  0,  0,  0,  0,202,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,202,  0,  0,  0,  0,  0,  0,  0,
-207,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  3,  0,  0,
-  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,220,  0,208,  3,203,  0,208,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,219,  0,  0,  0, 26,  0,  0,  0,233,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-220,  0,208,  3,  0,  0,  4,  0,  3,  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, 16,110,227,  2, 16,110,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 64,  1,  0,  0, 16,110,227,  2,196,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 73, 77, 65, 71, 69, 95, 80, 84, 95,103,112,101,110, 99,105,108,  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, 73, 77, 65, 71, 69, 95, 80, 84, 95,103,112,101,110, 99,105,108,  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, 71,114,101, 97,115,101, 32, 80,101,110, 99,105,108,  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,  0,  0,  0,152,255,202,  0, 80,  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,  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,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,
-192,145,227,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,152,144,227,  2,  0,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,
-  0,  0,128, 67, 51, 51, 43,191,154,153,213, 63, 51, 51,131,191,154,153,  1, 64,  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,236,  2,  0,  0,  0,  0,  0,  0,
-208,  3,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-220,  0,  0,  0,199,  3,  0,  0, 26,  0,  0,  0,233,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-236,  2,208,  3,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,248, 32,  0,  0,240,184,227,  2,167,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,100,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  1,  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,240, 65,  0,  0,  0,  0,154,153,153, 62,  0,  0,  0,  0,100,  0,  0,  0,154,153,153, 62,
-100,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  1,  0,  0,  0,100,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,
-100,  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,160, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 96,  0,  0,  0, 16,100,215,  2,197,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,128, 99,215,  2,  0,171,227,  2,184,170,227,  2,112,170,227,  2,224,169,227,  2,  0,  0,  0,  0,
-201,  3,  0,  0,126,  7,  0,  0,  0,  0,  0,  0,233,  3,  0,  0,  1,  1,182,  3,234,  3,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,176,152,227,  2,176,152,227,  2,232,146,227,  2,136,151,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0,232,146,227,  2,198,  0,  0,  0,  1,  0,  0,  0, 16,148,227,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,  0, 64,113, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,128,109, 68,  0,  0,  0,  0,  0,  0,208, 65,
-  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,181,  3,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0, 64,109, 68,  0,  0,200, 65,  0, 64,109, 68,  0,  0,200, 65,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,182,  3, 26,  0,182,  3, 26,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,201,  3,  0,  0,126,  7,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,182,  3, 26,  0,  0,  0,  1,  0,  2,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0, 16,148,227,  2,198,  0,  0,  0,
-  1,  0,  0,  0, 56,149,227,  2,232,146,227,  2,  0,  0,  0,  0,  0,  0, 32, 67,  0,  0, 86,196,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0, 15, 67,  0,  0, 86,196,  0,  0,  0,  0,143,  0,  0,  0,160,  0,  0,  0,  0,  0,  0,  0, 87,  3,  0,  0,  0,  0,  0,  0,
-142,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  0, 87,  3,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  3,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,
-  6,  0,160,  0, 88,  3,143,  0, 88,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,201,  3,  0,  0,104,  4,  0,  0,
-146,  0,  0,  0,233,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,160,  0, 88,  3,  0,  0,  5,  0,
-  3,  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,136,111,227,  2,136,111,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 64,  1,  0,  0,136,111,227,  2,196,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,116,111,111,108,115, 95,111, 98,106,101, 99,116,109,111,100,101,  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,
- 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,116,111,111,108,115, 95,111, 98,106,101, 99,116,109,111,100,101,  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,
- 79, 98,106,101, 99,116, 32, 84,111,111,108,115,  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,  0,  0,
-  0,  0,233,253,143,  0,255,  1,  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,  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,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0, 56,149,227,  2,198,  0,  0,  0,
-  1,  0,  0,  0, 96,150,227,  2, 16,148,227,  2,  0,  0,  0,  0,  0,  0, 33, 67,  0,  0,242,194,  0,  0,  0,  0,  0,  0,  0,  0,
-231,102, 16, 67, 91, 90,242,194,  0,  0,  0,  0,143,  0,  0,  0,160,  0,  0,  0,  0,  0,  0,  0,119,  0,  0,  0,  0,  0,  0,  0,
-142,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  0,119,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  3,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,
-  6,  0,160,  0,120,  0,143,  0,120,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,201,  3,  0,  0,104,  4,  0,  0,
- 26,  0,  0,  0,145,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,160,  0,120,  0,  0,  0,  6,  0,
- 34,  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,113,227,  2,  0,113,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 64,  1,  0,  0,  0,113,227,  2,196,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,108, 97,115,116, 95,111,112,101,114, 97,116,111,114,  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,
- 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,108, 97,115,116, 95,111,112,101,114, 97,116,111,114,  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,
- 79,112,101,114, 97,116,111,114,  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,  0,  0,  0,  0,  0,  0,
-  0,  0,216,255,144,  0, 16,  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,  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,  0,  0,  0,  0,  0, 68, 65, 84, 65,248,  0,  0,  0, 96,150,227,  2,198,  0,  0,  0,
-  1,  0,  0,  0,136,151,227,  2, 56,149,227,  2,  0,  0,  0,  0,  0,  0, 35, 67,  0,128,126,196,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0, 35, 67,255,191,126,196,  0,  0,  0,  0,163,  0,  0,  0,180,  0,  0,  0, 18,  0,  0,  0, 12,  4,  0,  0,  0,  0,  0,  0,
-162,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,162,  0,  0,  0, 18,  0,  0,  0, 12,  4,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  0,  0,  0,  1,  0,  7,  0, 18,  0,  0,  0,
-  6,  0,180,  0, 13,  4,163,  0,251,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,  0,  0,126,  7,  0,  0,
- 26,  0,  0,  0,233,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  4,  0,
-  4,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
-248,  0,  0,  0,136,151,227,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 96,150,227,  2,  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,  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,  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,105,  4,  0,  0,126,  7,  0,  0, 26,  0,  0,  0,233,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 22,  3,208,  3,  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,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 24,218,227,  2, 68, 65, 84, 65, 68,  3,  0,  0, 24,218,227,  2,156,  0,  0,  0,  1,  0,  0,  0, 72,246,172, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,140, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 28, 13,128,191,  0,  0,128,191,  0,  0,  0,  0,  0,  0,  0,  0, 74,215, 76,190,  0,  0,  0,  0, 68,239,209, 62,
- 51,177,205,190,184,158, 81, 63,  0,  0,  0,  0, 70,119,105, 63,143, 74, 70, 62, 35, 44,185,190,  0,  0,  0,  0,162, 84, 89,188,
-166, 33,101, 63, 42, 61,228, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 25, 95,192,  0,  0,128, 63, 69,239,209, 62,
- 70,119,105, 63,160, 84, 89,188,  0,  0,  0,  0, 52,177,205,190,142, 74, 70, 62,166, 33,101, 63,  0,  0,  0,  0,185,158, 81, 63,
- 35, 44,185,190, 43, 61,228, 62,  0,  0,  0,  0,188,173, 54, 64,136, 95,161,191,147,231,198, 63,  0,  0,128, 63,185,214, 13, 63,
-208,249,224,190, 48,180, 81,191,184,158, 81,191,189,188,157, 63,140,225, 88, 62, 26, 63,185, 62, 35, 44,185, 62,241,213,146,188,
-206,156,122, 63,138, 84,228,190, 42, 61,228,190,  0,  0,  0,  0,  0,  0,  0,  0,100, 98, 82, 64,  0, 25, 95, 64,121, 92,155, 62,
-151,198, 44, 63,192,214, 32,188,  0,  0, 40,180,195, 15,188,190,132, 75, 53, 62,216,125, 81, 63,  0,  0,192,179,115, 77,100,193,
- 17,173,201, 64,181,148,248,192,203,247,159,192,233, 74, 87, 65,247, 46,190,192, 88,106,234, 64, 45,  8,160, 64, 68,239,209, 62,
- 51,177,205,190,184,158, 81, 63,  0,  0,  0,  0, 70,119,105, 63,143, 74, 70, 62, 35, 44,185,190,  0,  0,  0,  0,162, 84, 89,188,
-166, 33,101, 63, 42, 61,228, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 25, 95,192,  0,  0,128, 63,185,214, 13, 63,
-208,249,224,190, 48,180, 81,191,184,158, 81,191,189,188,157, 63,140,225, 88, 62, 26, 63,185, 62, 35, 44,185, 62,241,213,146,188,
-206,156,122, 63,138, 84,228,190, 42, 61,228,190,  0,  0,  0,  0,  0,  0,  0,  0,100, 98, 82, 64,  0, 25, 95, 64,248,201,250, 62,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,248,201,250, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,248,201,250, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63, 92, 62, 55, 63,
- 56,186,224,190,237,203,148,190,  3,236,234,190,  0, 25, 95, 64,  0, 25, 95, 64,  0,  0,  0,  0,  0,  0,  0,  0,114,145,245, 58,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,255,255,  1,  0,  0,  0,  0,  0,  0,  0,  1,  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,  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,  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,  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,  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,128, 63, 30, 33, 12, 66, 85,152,137, 66,116, 27,126, 66,  0,  0,  0,  0,
- 68, 65, 84, 65,240,  0,  0,  0,176,152,227,  2,157,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0, 51, 51, 51, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 65,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  7,  0,144, 12,228,  2,
-  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,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  3,  0,  0,  0,
-  1,  0,  3,  0,  8,  8,  0,  0,  0,  0, 12, 66,  0,  0,128, 63,205,204,204, 61,  0,  0,250, 67,  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, 16,  0, 10,  0,  7,  1,  0,  3,  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, 83, 78,  0,  0,148,  0,  0,  0,216,253,213,  2,193,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 16,253,213,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 83, 82, 86,105,100,101,111, 32, 69,100,105,116,105,110,103,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 96,174,227,  2,120,177,227,  2,192,177,227,  2,136,182,227,  2,160,100,215,  2,
-224,102,215,  2,  0,  0,  0,  0,  0,  0,  0,  0,144,  1,228,  2,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,148,238, 92,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0, 96,174,227,  2,194,  0,  0,  0,  1,  0,  0,  0,
-168,174,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,168,174,227,  2,
-194,  0,  0,  0,  1,  0,  0,  0,240,174,227,  2, 96,174,227,  2,  0,  0,  0,  0,  0,  0,222,  2,  0,  0,  0,  0, 68, 65, 84, 65,
- 20,  0,  0,  0,240,174,227,  2,194,  0,  0,  0,  1,  0,  0,  0, 56,175,227,  2,168,174,227,  2,  0,  0,  0,  0,240,  4,222,  2,
-  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0, 56,175,227,  2,194,  0,  0,  0,  1,  0,  0,  0,128,175,227,  2,240,174,227,  2,
-  0,  0,  0,  0,240,  4,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,128,175,227,  2,194,  0,  0,  0,  1,  0,  0,  0,
-200,175,227,  2, 56,175,227,  2,  0,  0,  0,  0,  0,  0,195,  2,  1,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,200,175,227,  2,
-194,  0,  0,  0,  1,  0,  0,  0, 16,176,227,  2,128,175,227,  2,  0,  0,  0,  0,240,  4,195,  2,  1,  0,  0,  0, 68, 65, 84, 65,
- 20,  0,  0,  0, 16,176,227,  2,194,  0,  0,  0,  1,  0,  0,  0, 88,176,227,  2,200,175,227,  2,  0,  0,  0,  0,240,  4, 92,  1,
-  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0, 88,176,227,  2,194,  0,  0,  0,  1,  0,  0,  0,160,176,227,  2, 16,176,227,  2,
-  0,  0,  0,  0,  0,  0, 68,  0,  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,160,176,227,  2,194,  0,  0,  0,  1,  0,  0,  0,
-232,176,227,  2, 88,176,227,  2,  0,  0,  0,  0, 48,  2,195,  2,  1,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,232,176,227,  2,
-194,  0,  0,  0,  1,  0,  0,  0, 48,177,227,  2,160,176,227,  2,  0,  0,  0,  0,  0,  0, 92,  1,  0,  0,  0,  0, 68, 65, 84, 65,
- 20,  0,  0,  0, 48,177,227,  2,194,  0,  0,  0,  1,  0,  0,  0,120,177,227,  2,232,176,227,  2,  0,  0,  0,  0, 48,  2, 92,  1,
-  0,  0,  0,  0, 68, 65, 84, 65, 20,  0,  0,  0,120,177,227,  2,194,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 48,177,227,  2,
-  0,  0,  0,  0,240,  4, 68,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,192,177,227,  2,195,  0,  0,  0,  1,  0,  0,  0,
-  8,178,227,  2,  0,  0,  0,  0,168,174,227,  2,240,174,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,
-  8,178,227,  2,195,  0,  0,  0,  1,  0,  0,  0, 80,178,227,  2,192,177,227,  2,168,174,227,  2,128,175,227,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 80,178,227,  2,195,  0,  0,  0,  1,  0,  0,  0,152,178,227,  2,  8,178,227,  2,
-240,174,227,  2,200,175,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,152,178,227,  2,195,  0,  0,  0,
-  1,  0,  0,  0,224,178,227,  2, 80,178,227,  2,128,175,227,  2,200,175,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 24,  0,  0,  0,224,178,227,  2,195,  0,  0,  0,  1,  0,  0,  0, 40,179,227,  2,152,178,227,  2,200,175,227,  2, 16,176,227,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 40,179,227,  2,195,  0,  0,  0,  1,  0,  0,  0,112,179,227,  2,
-224,178,227,  2, 96,174,227,  2, 88,176,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,112,179,227,  2,
-195,  0,  0,  0,  1,  0,  0,  0,184,179,227,  2, 40,179,227,  2,128,175,227,  2,160,176,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 24,  0,  0,  0,184,179,227,  2,195,  0,  0,  0,  1,  0,  0,  0,  0,180,227,  2,112,179,227,  2, 88,176,227,  2,
-232,176,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,  0,180,227,  2,195,  0,  0,  0,  1,  0,  0,  0,
- 72,180,227,  2,184,179,227,  2,232,176,227,  2, 48,177,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,
- 72,180,227,  2,195,  0,  0,  0,  1,  0,  0,  0,144,180,227,  2,  0,180,227,  2,160,176,227,  2, 48,177,227,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,144,180,227,  2,195,  0,  0,  0,  1,  0,  0,  0,216,180,227,  2, 72,180,227,  2,
- 16,176,227,  2,120,177,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,216,180,227,  2,195,  0,  0,  0,
-  1,  0,  0,  0, 32,181,227,  2,144,180,227,  2, 56,175,227,  2,120,177,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 24,  0,  0,  0, 32,181,227,  2,195,  0,  0,  0,  1,  0,  0,  0,104,181,227,  2,216,180,227,  2, 88,176,227,  2,120,177,227,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,104,181,227,  2,195,  0,  0,  0,  1,  0,  0,  0,176,181,227,  2,
- 32,181,227,  2, 96,174,227,  2, 56,175,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,176,181,227,  2,
-195,  0,  0,  0,  1,  0,  0,  0,248,181,227,  2,104,181,227,  2,200,175,227,  2,160,176,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 24,  0,  0,  0,248,181,227,  2,195,  0,  0,  0,  1,  0,  0,  0, 64,182,227,  2,176,181,227,  2, 16,176,227,  2,
- 48,177,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0, 64,182,227,  2,195,  0,  0,  0,  1,  0,  0,  0,
-136,182,227,  2,248,181,227,  2,128,175,227,  2,232,176,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,
-136,182,227,  2,195,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 64,182,227,  2, 16,176,227,  2,232,176,227,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 96,  0,  0,  0,160,100,215,  2,197,  0,  0,  0,  1,  0,  0,  0, 48,101,215,  2,  0,  0,  0,  0,
-128,175,227,  2,168,174,227,  2,240,174,227,  2,200,175,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,240,  4,  0,  0,196,  2,  0,  0,
-222,  2,  0,  0,  7,  7,241,  4, 27,  0,  1,  0,  0,  0,  0,  0,  7,  0,  0,  0,136,129,206,  2, 24,235,220,  2, 24,235,220,  2,
-216,153,227,  2,  0,155,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,232, 81,  6,  4,136, 81,  6,  4, 68, 65, 84, 65,248,  0,  0,  0,
-216,153,227,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,155,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,148, 68,  0,  0,  0,  0,
-  0,  0,208, 65,  0,  0,  0,  0,  0, 32,158, 68,  0,  0,  0,  0,  0,  0,208, 65,  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,240,  4,  0,  0,  0,  0,  0,  0,
- 25,  0,  0,  0,  0,  0,158, 68,  0,  0,200, 65,  0,  0,158, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,241,  4, 26,  0,241,  4, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,240,  4,  0,  0,196,  2,  0,  0,221,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-241,  4, 26,  0,  0,  0,  1,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 32, 64,206,  2,  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, 68, 65, 84, 65,248,  0,  0,  0,  0,155,227,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,216,153,227,  2,
-  0,  0,  0,  0,  0,240,109, 69,  0,  0,128,192,  0,  0,  0,  0,  0,  0,  0,  0,255,255,109, 69,  0,  0,  0,192,  0,  0,  0,  0,
-112,  7,  0,  0,129,  7,  0,  0, 18,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,111,  7,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,
-  0,  0,  0,  0,111,  7,  0,  0, 18,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  2,  0,  0,  0,  1,  0,  3,  3,  2,  0,  0,  4, 10,  0,129,  7,  2,  0,112,  7,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,222,  2,  0,  0,222,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,144, 63,206,  2,  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, 68, 65, 84, 65, 96,  0,  0,  0, 48,101,215,  2,197,  0,  0,  0,
-  1,  0,  0,  0,192,101,215,  2,160,100,215,  2, 96,174,227,  2, 88,176,227,  2,120,177,227,  2, 56,175,227,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,240,  4,  0,  0,  0,  0,  0,  0, 67,  0,  0,  0, 15, 15,241,  4, 68,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 88,107,206,  2,144,221,227,  2,144,221,227,  2, 40,156,227,  2, 80,157,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 40, 81,  6,  4,
-168, 82,  6,  4, 68, 65, 84, 65,248,  0,  0,  0, 40,156,227,  2,198,  0,  0,  0,  1,  0,  0,  0, 80,157,227,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,  0, 32,140, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0, 32,158, 68,  0,  0,  0,  0,  0,  0,208, 65,
-  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,240,  4,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,158, 68,  0,  0,200, 65,  0,  0,158, 68,  0,  0,200, 65,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,241,  4, 26,  0,241,  4, 26,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  4,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,241,  4, 26,  0,  0,  0,  1,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,224, 52,206,  2,  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, 68, 65, 84, 65,248,  0,  0,  0, 80,157,227,  2,198,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0, 40,156,227,  2,  0,  0, 64,192,  0,  0,126, 67,  0,  0,  0,  0,  0,  0, 72, 66,112,189, 17,192,
-246, 70,125, 67,  0,  0,  0,  0,  0,  0, 72, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-240,  4,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,240,  4,  0,  0, 18,  0,  0,  0, 41,  0,  0,  0,  0,  0,128, 63,
-  0,  0, 72, 66,  0,124,146, 72,  0,  0, 72, 66,205,204,204, 61,  0,  0, 32, 65, 72,  0,  0,  0,  0,  0,  0,  2,  4,  0,  0,  4,
-  8,  0,241,  4, 42,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  4,  0,  0,
- 26,  0,  0,  0, 67,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,241,  4, 42,  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, 80, 52,206,  2,  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, 68, 65, 84, 65,
-188,  0,  0,  0,144,221,227,  2,173,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 15,  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,  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,  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,  0,  0,  0,  0,  0, 31,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,  6,  0,  0,  0, 68, 65, 84, 65, 96,  0,  0,  0,192,101,215,  2,197,  0,  0,  0,  1,  0,  0,  0,
- 80,102,215,  2, 48,101,215,  2, 88,176,227,  2,232,176,227,  2, 16,176,227,  2,120,177,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,
-240,  4,  0,  0, 69,  0,  0,  0, 91,  1,  0,  0,  8,  8,241,  4, 23,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,169,206,  2,
-128,254,227,  2,128,254,227,  2,120,158,227,  2,232,224,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  8, 83,  6,  4,136, 84,  6,  4,
- 68, 65, 84, 65,248,  0,  0,  0,120,158,227,  2,198,  0,  0,  0,  1,  0,  0,  0,152,222,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,128, 26, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0, 32,158, 68,  0,  0,  0,  0,  0,  0,208, 65,  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,
-240,  4,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,158, 68,  0,  0,200, 65,  0,  0,158, 68,  0,  0,200, 65,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,241,  4, 26,  0,241,  4, 26,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  4,  0,  0, 69,  0,  0,  0, 94,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,241,  4, 26,  0,  0,  0,  1,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 64,206,206,  2,  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, 68, 65, 84, 65,248,  0,  0,  0,152,222,227,  2,198,  0,  0,  0,  1,  0,  0,  0,
-192,223,227,  2,120,158,227,  2,  0,  0,  0,  0,  0,  0, 92, 67,  0,  0,125,195,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 75, 67,
-  1,  0,125,195,  0,  0,  0,  0,203,  0,  0,  0,220,  0,  0,  0,  0,  0,  0,  0,252,  0,  0,  0,  0,  0,  0,  0,202,  0,  0,  0,
-  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,202,  0,  0,  0,  0,  0,  0,  0,252,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  3,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,220,  0,
-253,  0,203,  0,253,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 21,  4,  0,  0,240,  4,  0,  0, 95,  0,  0,  0,
- 91,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,220,  0,253,  0,  0,  0,  4,  0,  4,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,176,205,206,  2,  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, 68, 65, 84, 65,248,  0,  0,  0,
-192,223,227,  2,198,  0,  0,  0,  1,  0,  0,  0,232,224,227,  2,152,222,227,  2,  0,  0,112,196,  0,  0,112, 68,  0,  0,  7,196,
-  0,  0,  7, 68,  0,  0,112,196,  0,  0,112, 68,  0,  0,  7,196,  0,  0,  7, 68,  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,  0,  0,  0,  0,  0,  0,  0,128, 59, 70,  0,128, 59, 70,172,197, 39, 55,  0, 80,195, 71,  0,  0,  0,  0,
-  0,  0,  6,  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, 20,  4,  0,  0, 91,  1,  0,  0, 91,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  1,  0,  0,  0,  7,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 32,205,206,  2,  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, 68, 65, 84, 65,248,  0,  0,  0,232,224,227,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,192,223,227,  2,
-  0,  0,  0,  0,  0,  0,122, 67,  0,  0,  0,  0,  0,  0,  0, 65,  0,  0,  0,  0,  0,  0,122, 67,  0,  0,  0,  0,  0,  0,  0, 65,
-  0,  0,  0,  0, 17,  0,  0,  0, 18,  0,  0,  0,252,  0,  0,  0, 18,  0,  0,  0, 20,  4,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,
- 18,  0,  0,  0, 20,  4,  0,  0, 18,  0,  0,  0,252,  0,  0,  0,  0,  0, 32, 65,  0,  0,128, 64,  0,124,146, 72,  0,  0,  0, 66,
- 10,215, 35, 60,  0,  0,200, 66,105,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  8,  0, 21,  4,253,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 20,  4,  0,  0, 95,  0,  0,  0, 91,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 21,  4,253,  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,144,204,206,  2,  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, 68, 65, 84, 65,216,  0,  0,  0,128,254,227,  2,163,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 96,  0,  0,  0, 80,102,215,  2,197,  0,  0,  0,  1,  0,  0,  0,224,102,215,  2,192,101,215,  2,232,176,227,  2,128,175,227,  2,
-160,176,227,  2, 48,177,227,  2,  0,  0,  0,  0,  0,  0,  0,  0, 47,  2,  0,  0, 93,  1,  0,  0,194,  2,  0,  0,  2,  2, 48,  2,
-102,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0, 88,113,206,  2,136,255,227,  2,136,255,227,  2, 16,226,227,  2,136,229,227,  2,
-  0,  0,  0,  0,  0,  0,  0,  0,160, 33,220,  3, 64,120, 10,  4, 68, 65, 84, 65,248,  0,  0,  0, 16,226,227,  2,198,  0,  0,  0,
-  1,  0,  0,  0, 56,227,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64, 89, 68,  0,  0,  0,  0,  0,  0,208, 65,154,216, 65, 55,
-  0,  0, 12, 68,  0,  0,  0,  0,  0,  0,208, 65,  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, 47,  2,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,192, 11, 68,
-  0,  0,200, 65,  0,192, 11, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0,
- 10,  0, 48,  2, 26,  0, 48,  2, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 47,  2,  0,  0,
- 93,  1,  0,  0,118,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 48,  2, 26,  0,  0,  0,  1,  0,
-  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,208, 56,206,  2,  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, 68, 65, 84, 65,
-248,  0,  0,  0, 56,227,227,  2,198,  0,  0,  0,  1,  0,  0,  0, 96,228,227,  2, 16,226,227,  2,  0,  0,  0,  0,  0,  0, 72, 67,
-  0,  0,112,193,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72, 67,  0,  0,157,195,  0,  0,  0,  0,200,  0,  0,  0,217,  0,  0,  0,
- 18,  0,  0,  0, 75,  1,  0,  0,  0,  0,  0,  0,199,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,199,  0,  0,  0,
- 18,  0,  0,  0, 75,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
- 10,  6,  0,  0,  2,  0,  3,  3,  0,  0,  0,  4,  6,  0,217,  0, 76,  1,200,  0, 58,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,216,  0,  0,  0,119,  1,  0,  0,194,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,217,  0, 76,  1,  0,  0,  2,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 96, 57,206,  2,  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, 68, 65, 84, 65,248,  0,  0,  0, 96,228,227,  2,198,  0,  0,  0,  1,  0,  0,  0,136,229,227,  2,
- 56,227,227,  2,  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,  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,  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, 47,  2,  0,  0, 47,  2,  0,  0,119,  1,  0,  0,194,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  4,  0,  4,  0,  1,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240, 57,206,  2,  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, 68, 65, 84, 65,248,  0,  0,  0,136,229,227,  2,
-198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 96,228,227,  2,  0,  0, 16,193,  0,  0,130, 67,  0,  0,160,192,  0,  0,160, 64,
-  0,  0,  0,  0,  0,  0,122, 67,  0,  0, 16,193,  0,  0, 32, 65,  0,  0,  0,  0, 17,  0,  0,  0, 18,  0,  0,  0, 75,  1,  0,  0,
- 18,  0,  0,  0, 86,  1,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0, 18,  0,  0,  0, 86,  1,  0,  0, 18,  0,  0,  0, 75,  1,  0,  0,
-111, 18,131, 58,111, 18,131, 58,  0,124,146, 72,  0, 80, 67, 71,  0,  0,  0,  0,  0,  0,  0,  0,105,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  4,  0,  0, 87,  1, 76,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,217,  0,  0,  0,
- 47,  2,  0,  0,119,  1,  0,  0,194,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 87,  1, 76,  1,
-  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, 64, 56,206,  2,
-  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,
- 68, 65, 84, 65,208,  0,  0,  0,136,255,227,  2,161,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  2,  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,  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,  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,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,184,114, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  2,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 88,  0,  0,  0,184,114, 40,  0, 20,  1,  0,  0,  1,  0,  0,  0,144,  1,228,  2,  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,  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,  1,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 96,  0,  0,  0,224,102,215,  2,197,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0, 80,102,215,  2, 48,177,227,  2,160,176,227,  2,200,175,227,  2, 16,176,227,  2,  0,  0,  0,  0,
- 49,  2,  0,  0,240,  4,  0,  0, 93,  1,  0,  0,194,  2,  0,  0,  8,  8,192,  2,102,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-240,169,206,  2,136,  0,228,  2,136,  0,228,  2,176,230,227,  2, 40,234,227,  2,  0,  0,  0,  0,  0,  0,  0,  0,160,120, 10,  4,
-192,121, 10,  4, 68, 65, 84, 65,248,  0,  0,  0,176,230,227,  2,198,  0,  0,  0,  1,  0,  0,  0,216,231,227,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,245, 67,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,  0, 48, 68,  0,  0,  0,  0,  0,  0,208, 65,
-  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,191,  2,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,192, 47, 68,  0,  0,200, 65,  0,192, 47, 68,  0,  0,200, 65,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,192,  2, 26,  0,192,  2, 26,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 49,  2,  0,  0,240,  4,  0,  0, 93,  1,  0,  0,118,  1,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,192,  2, 26,  0,  0,  0,  1,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0, 26,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64,206,206,  2,  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, 68, 65, 84, 65,248,  0,  0,  0,216,231,227,  2,198,  0,  0,  0,
-  1,  0,  0,  0,  0,233,227,  2,176,230,227,  2,  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,  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,  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,240,  4,  0,  0,240,  4,  0,  0,
-119,  1,  0,  0,194,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  4,  0,
-  4,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,176,205,206,  2,  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, 68, 65, 84, 65,
-248,  0,  0,  0,  0,233,227,  2,198,  0,  0,  0,  1,  0,  0,  0, 40,234,227,  2,216,231,227,  2,  0,  0,240,195,  0,  0,240, 67,
-  0,  0,135,195,  0,  0,135, 67,238, 33,143,196,238, 33,143, 68,  0,  0,  7,196,  0,  0,  7, 68,  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,191,  2,  0,  0,
-  0,  0,  0,  0, 75,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 59, 70,  0,128, 59, 70,172,197, 39, 55,  0, 80,195, 71,
-  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  4,  0,  0,192,  2, 76,  1,192,  2, 76,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 49,  2,  0,  0,240,  4,  0,  0,119,  1,  0,  0,194,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,192,  2, 76,  1,  0,  0,  7,  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, 32,205,206,  2,  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, 68, 65, 84, 65,248,  0,  0,  0, 40,234,227,  2,198,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  0,233,227,  2,  0,  0,  0,  0,  0,  0,122, 67,  0,  0,  0,  0,  0,  0,  0, 65,  0,  0,  0,  0,  0,  0,122, 67,  0,  0,  0,  0,
-  0,  0,  0, 65,  0,  0,  0,  0, 17,  0,  0,  0, 18,  0,  0,  0, 75,  1,  0,  0, 18,  0,  0,  0,201,  2,  0,  0,  0,  0,  0,  0,
- 17,  0,  0,  0, 18,  0,  0,  0,201,  2,  0,  0, 18,  0,  0,  0, 75,  1,  0,  0,  0,  0, 32, 65,  0,  0,128, 64,  0,124,146, 72,
-  0,  0,  0, 66, 10,215, 35, 60,  0,  0,200, 66,105,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,  0,202,  2, 76,  1,  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,  1,  0,  1,  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,  0,  0,144,204,206,  2,  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, 68, 65, 84, 65,216,  0,  0,  0,136,  0,228,  2,
-163,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 64,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 83, 67,  0,  0, 48,  5,  0,  0,144,  1,228,  2,154,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 83, 67, 83, 99,101,110,101,  0,116, 97,103,101,  0, 97,105,110,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,192,  0,216,  2,  0,  0,  0,  0,144, 12,228,  2,240, 10,228,  2,  0,  0,  0,  0,144, 28,204,  2, 48, 29,204,  2,
-144, 28,204,  2,  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,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
-  1,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  6,228,  2, 32,189,  3,  4,
-  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,  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,192,  0,  0,  0, 68,172,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  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,  1,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,100,  0,  0,  0,100,  0,  0,  0,  0,  0,  1,  0,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128,  2,224,  1, 60,  0, 32,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  6,  0, 50,  0,141,  0,128,  7,
- 56,  4,  8,  0,  8,  0, 24,  0, 17,  0,  0,  0, 90,  0,  1,  0, 81,  0,  0,  0, 23,  0, 33,  0,  2,  0,  0,  0,  0,  0,  0,  0,
-128,  0,  0,  0,  0,  0,  8,  0, 24,  0, 10,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,168, 18,216,  2,
-168, 18,216,  2,  0,  0,  1,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  1,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  5,  0,  2,  0,  1,  0,  1,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 47,116,109,112, 92,  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,  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,  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,  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,  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, 31,  5,  0,  0, 12,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,205,204, 76, 63,
-205,204, 76, 63,205,204, 76, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 62,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  6,  0, 16,  0,  0,  0,128, 63,  0,  0,128, 63,173,  2, 95,  0,154,153,217, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  4,  0,  1,  0,180,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 66, 76, 69, 78, 68, 69, 82, 95,
- 82, 69, 78, 68, 69, 82,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68,172,  0,  0,  0,  0,128, 63,
-102,166,171, 67,  0,  0,128, 63,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 96,100,174,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232,202,205,  2,  1,  0,  0,  0,  1,  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,205,204, 28, 65,
-  0,  0,  0,  0, 32,  0, 32,  0,  1,  0,  0,  0,  0,  0,  0,  0,128,  0,  5,  0, 60,  0,  5,  0,  1,  0,  5,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,  2,224,  1, 60,  0, 32,  0,  0,  0,  0,  0,  0,  0,  4,  0,  1,  0,
-180,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  5,  0,  0,  0,  0,  0,205,204,204, 61,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,195,245, 28,193,  1,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 76,  0,  0,  0,192,  0,216,  2,  8,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  6,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 28,  0,  0,  0,144, 28,204,  2,130,  0,  0,  0,  1,  0,  0,  0,224, 28,204,  2,  0,  0,  0,  0,
-  1,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,194,  1, 42,  1,240, 16,228,  2, 68, 65, 84, 65, 28,  0,  0,  0,224, 28,204,  2,
-130,  0,  0,  0,  1,  0,  0,  0, 48, 29,204,  2,144, 28,204,  2,  1,  0,  0,  0,  2,  0,  0,  0,  0,  4,  0,  0, 69,  2,243,  1,
-192, 21,228,  2, 68, 65, 84, 65, 28,  0,  0,  0, 48, 29,204,  2,130,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,224, 28,204,  2,
-  1,  0,  0,  0,  3,  0,  0,  0,  0,  4,  0,  0, 99,  0,103,  1,144, 12,228,  2, 68, 65, 84, 65,152,  1,  0,  0,240,  6,228,  2,
-150,  0,  0,  0,  1,  0,  0,  0,  0,  4,204,  2, 88,  4,204,  2, 64,115, 40,  0,  0,  0,128, 63,  1,  0,  1,  0,205,204, 76, 63,
-  0,  0,180, 66,  9,  0,  1,  0,  0,  0,128, 63,111, 18,131, 58,205,204,204, 61,  0,  0,  1,  0, 32,  0, 32,  0, 32,  0,  1,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  1,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,184,212,229,  2,
-  0,  0,  0,  0,255,255,255,128,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0, 80,  0,  0,  2,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,
-  7,  0,  5,  0,  5,  0,255,255, 50,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72, 66, 50,  0, 10,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,200, 66, 50,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72, 66, 50,  0, 10,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0, 72, 66, 50,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72, 66, 50,  0, 10,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0, 72, 66, 50,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72, 66,  0,  0,  0,  0,  0,  0,128, 62,
-  0,  0,  0,  0,  1,  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,128, 63,
- 10,215, 35, 60,205,204,204, 61,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,250,  0,205,204,204, 61,205,204,204, 61,102,102,166, 63,
-  0,  0,192, 63,  0,  0,240, 65, 72,225,122, 63,205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 67,  2,  0,  3,
-  2,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  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, 17,  0,  0,  0, 35,  0,  0,  0,204,197,121, 63,  0,  0,  0, 63,
- 68, 65, 84, 65, 36,  0,  0,  0,  0,  4,204,  2,149,  0,  0,  0,  1,  0,  0,  0, 80,155,229,  2,  0,  0,  0,  0,255,255,255,128,
-  1,  0,  0,  0, 18,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 36,  0,  0,  0,
- 88,  4,204,  2,149,  0,  0,  0,  1,  0,  0,  0, 80,155,229,  2,  0,  0,  0,  0,200,200,255,128,  1,  0,  0,  0,  2,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 88,  0,  0,  0, 64,115, 40,  0,148,  0,  0,  0,
-  1,  0,  0,  0,136,194,229,  2,  0,  0,  0,  0,255,100,100,128,  1,  0,  0,  0,128,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
-  1,  0,  0,  0,124,  7,231, 65,255, 74, 20, 65, 54, 86,123, 63,  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, 68, 65, 84, 65,
- 72,  0,  0,  0,168, 18,216,  2,136,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82,101,110,100,101,114, 76, 97,
-121,101,114,  0,114,  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,
-255,255, 15,  0,  0,  0,  0,  0,255,127,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0, 67, 65,  0,  0,104,  0,  0,  0,
-184,  8,228,  2, 21,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 67, 65, 67, 97,
-109,101,114, 97,  0, 97,109,101,114, 97, 46, 48, 48, 49,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0, 63,205,204,204, 61,  0,  0,200, 66,  0,  0, 12, 66,161, 14,234, 64,  0,  0,  0, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 76, 65,  0,  0,108,  1,  0,  0, 80,  9,228,  2,
- 33,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 76, 65, 76, 97,109,112,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,247,255,239, 65,  0,  0,150, 66,154,153, 25, 62,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0, 28,221,  2,  2,  0,  0,  0, 46, 26,128, 63, 25,  4,240, 65,  0,  0, 52, 66,  0,  0,128, 63,
-  0,  0, 64, 64,205,204, 76, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64, 11,  3,  0,  1,  0,  0,  0,  0,  2,  1,  0,
-  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,111, 18,131, 58,  1,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  1,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 64,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,128, 29,204,  2, 68, 65, 84, 65, 16,  1,  0,  0,  0, 28,221,  2,
- 80,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  2,  0,  1,  0,  0,  0,128, 67,
-  0,  0,  0,  0,  0,  0,128, 63,243,  4, 53,191,242,  4, 53, 63,242,  4, 53,191,243,  4, 53, 63,208,182,227,  2,  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,  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,
-  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,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,
-208,182,227,  2, 78,  1,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,128, 29,204,  2, 11,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 87, 79,  0,  0,112,  1,  0,  0,
-240, 10,228,  2,129,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 87, 79, 87,111,
-114,108,100,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,114, 99, 80, 61,114, 99, 80, 61,114, 99, 80, 61,199, 54, 36, 60,199, 54, 36, 60,
-199, 54, 36, 60,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,205,204, 28, 65,  0,  0,  0,  0,  0,  0, 32,  0,128,  0,  5,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,160, 64,  0,  0,200, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0, 64,  0,  0,  0,  0,  0,  0,112, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 65,
-  0,  0,  0,  0,  0,  0,128, 63,205,204, 76, 61,  0,  0,  5,  0,  0,  0,  0,  0, 10,215,163, 59,  0,  0,  0,  0,  0,  0,128, 62,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0,  0,  2,  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,  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,208, 29,204,  2, 68, 65, 84, 65,
- 32,  0,  0,  0,208, 29,204,  2, 11,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,  0,  0, 44,  4,  0,  0,144, 12,228,  2,116,  0,  0,  0,
-  1,  0,  0,  0,240, 16,228,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 67, 97,109,101,114, 97,  0, 97,109,101,
-114, 97, 46, 48, 48, 49,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 11,  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,  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,184,  8,228,  2,
-  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,
-  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,110,101,239, 64,150, 62,208,192,
- 78,255,170, 64,  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,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 42,254,141, 63,192, 57, 49, 60, 34,159, 80, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,222,149, 47, 63, 53, 70, 58, 63,222, 56, 49,188,  0,  0,  0,  0, 86,126,162,190,
-227,251,159, 62, 55, 53,101, 63,  0,  0,  0,  0,  7,165, 39, 63,149, 84, 28,191, 51,247,227, 62,  0,  0,  0,  0,110,101,239, 64,
-150, 62,208,192, 78,255,170, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  1,  0,128, 63,  1,  0,128, 51,  1,  0,  0,179,  0,  0,  0,  0,  0,  0,  0, 51,
-  0,  0,128, 63,  1,  0,128, 51,  0,  0,  0,  0,  2,  0,  0,179,  2,  0,  0,167,  1,  0,128, 63,  0,  0,  0,  0,  1,  0,  0, 53,
-  1,  0,  0, 41,  1,  0,128,168,  0,  0,128, 63,221,149, 47, 63, 86,126,162,190,  8,165, 39, 63,  0,  0,  0,  0, 51, 70, 58, 63,
-225,251,159, 62,149, 84, 28,191,  0,  0,  0,  0,192, 56, 49,188, 55, 53,101, 63, 52,247,227, 62,  0,  0,  0,  0, 90, 38,173,190,
-  0,222,192,190,152,  9, 52,193,  0,  0,128, 63,  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,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  5,  0,  1,  0,  0,  0,  0,  0,
- 79, 66,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,
-  0,  0,128, 63,187,225, 16, 63,  0,  0,128, 63,205,204,204, 62,237, 54, 32, 63,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  2,  0,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,236,214,  2,  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,  1,  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, 68, 65, 84, 65,144,  0,  0,  0,  0,236,214,  2,119,  0,  0,  0,
-  1,  0,  0,  0,  0,192,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,205,204,204, 61,
-205,204, 76, 62, 10,215,163, 60,  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,  2,  0,  0,  0, 79, 66,  0,  0, 44,  4,  0,  0,240, 16,228,  2,
-116,  0,  0,  0,  1,  0,  0,  0,192, 21,228,  2,144, 12,228,  2,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 67,117, 98,101,  0,112,
-104,101,114,101,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  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,  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,184,195,249,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-144, 30,221,  2,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,
-  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  0,  0,  0,  0,  0, 80, 21,228,  2,136, 21,228,  2,  1,  0,  0,  0,  1,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  2,  0,
-  0,  0, 68,  0, 79, 66,  0,  0,  7,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0,
- 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,229,208, 34, 62,  0,  0,  0,  0,143,194,117, 61,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  5,  0,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0, 64,  1,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,192,236,214,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0, 32, 47,  1,  4, 64, 53,  1,  4,
- 25,  0,  0,  0,  0,  0,  0,  0,  1,  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, 68, 65, 84, 65,  4,  0,  0,  0, 80, 21,228,  2,
-  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0,136, 21,228,  2,  0,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65,144,  0,  0,  0,192,236,214,  2,119,  0,  0,  0,  1,  0,  0,  0,  0,192,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,205,204,204, 61,205,204, 76, 62, 10,215,163, 60,  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, 72,  0,  0,  0, 79, 66,  0,  0, 44,  4,  0,  0,192, 21,228,  2,116,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-240, 16,228,  2,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 76, 97,109,112,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,  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,  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, 80,  9,228,  2,  0,  0,  0,  0,  1,  0,  0,  0,
-250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,
-250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,154,112,130, 64,183,178,128, 63,112,236,188, 64,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,229,123, 38, 63, 87, 43, 98, 61,229,229,238, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 54,236,148,190, 25,134,116, 63,236, 13, 98,189,  0,  0,  0,  0,221,102, 69,191, 57,174, 76,190, 34,194, 26, 63,
-  0,  0,  0,  0, 37,255, 16, 63,241,161, 95, 62,164,111, 75, 63,  0,  0,  0,  0,154,112,130, 64,183,178,128, 63,112,236,188, 64,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  1,  0,128, 50,  0,  0,  0,179,  0,  0,  0,  0,  1,  0,128, 50,  1,  0,128, 63,  1,  0,  0, 51,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0, 39,  1,  0,  0, 52,  1,  0,128, 39,
-  0,  0,128, 63, 54,236,148,190,221,102, 69,191, 38,255, 16, 63,  0,  0,  0,  0, 24,134,116, 63, 57,174, 76,190,239,161, 95, 62,
-  0,  0,  0,  0,237, 13, 98,189, 35,194, 26, 63,166,111, 75, 63,  0,  0,  0,  0,209, 19, 13, 63,241, 65,102,190, 10, 10,231,192,
-  0,  0,128, 63,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  5,  0,  1,  0,  0,  0, 68,  0, 79, 66,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,
-  0,  0,128, 63,205,204,204, 62,229,208, 34, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  5,  0,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,128,237,214,  2,  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,  1,  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, 68, 65, 84, 65,144,  0,  0,  0,128,237,214,  2,119,  0,  0,  0,  1,  0,  0,  0,  0,192,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,205,204,204, 61,205,204, 76, 62, 10,215,163, 60,
-  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,  2,  0,  0,  0, 77, 65,  0,  0,160,  2,  0,  0, 32, 26,228,  2, 35,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  4,  8, 90,  0,  0,  0,  0,  0, 77, 65, 77, 97,116,101,114,105, 97,108,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,205,204, 76, 63,
-205,204, 76, 63,205,204, 76, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,205,204, 76, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 10,215, 35, 60,  0,  0,  0,  0,  0,  0,  8,  0,  1,  0, 50,  0,
-205,204, 76, 62,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,160, 63,  0,  0,  0,  0,  0,  0,160, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  2,  0,  2,  0, 50,  0,  0,  6,  0,  0,128, 63,  0,  0,128, 63, 18,  0, 18,  0,
- 10,215,163, 59, 10,215,163, 59,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  4,  0, 67,  0, 64,  3, 67,  0, 64,  3,  1,  0,  4,  0,
- 12,  0,  4,  0,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  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,128, 63,  0,  0,  0,  0,  0,  0,  1,  0,
-  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,128, 64,  0,  0,  0, 63,205,204,204, 61,  0,  0,  0, 63,
-205,204,204, 61,205,204,204, 61,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63, 72, 29,221,  2,  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,  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, 32, 30,204,  2,
-  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,111,148, 26, 63,111,148, 26, 63,111,148, 26, 63,205,204, 76, 61,205,204,204, 61,102,102,166, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 16,  1,  0,  0, 72, 29,221,  2, 24,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  8, 97,223,  2,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63, 68, 65, 84, 65, 32,  0,  0,  0, 32, 30,204,  2, 11,  0,  0,  0,  1,  0,  0,  0, 32,  0,  0,  0, 96,  0,  0,  0,
- 32,  0,  0,  0, 96,  0,  0,  0,  0,  0,  1,  0, 52,  0, 52,  0,240, 28,228,  2, 32, 45,228,  2, 68, 65, 84, 65,  0, 16,  0,  0,
-240, 28,228,  2,  0,  0,  0,  0,  1,  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,  0,  2,  2,  2, 51,
-  2,  2,  2, 51,  6,  6,  6,153,  6,  6,  6,153,  6,  6,  6,153,  4,  4,  4,102,  3,  3,  3,102,  2,  2,  2, 51,  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,  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,  3,  3,  3, 51,  8,  8,  8,153, 11, 11, 11,204, 13, 13, 13,255,
- 12, 12, 12,255, 12, 12, 12,255, 11, 11, 11,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,
-  4,  4,  4,102,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  3,  3,  3, 51, 10, 10, 10,153, 18, 18, 18,255, 20, 20, 20,255, 22, 22, 22,255, 23, 23, 23,255,
- 22, 22, 22,255, 20, 20, 20,255, 19, 19, 19,255, 16, 16, 16,255, 14, 14, 14,255, 11, 11, 11,255, 10, 10, 10,255,  9,  9,  9,255,
-  9,  9,  9,255,  9,  9,  9,255,  8,  8,  8,204,  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,  0,  0,
-  0,  0,  0,  0,  7,  7,  7,102, 19, 19, 19,204, 27, 27, 27,255, 31, 31, 31,255, 32, 32, 32,255, 33, 33, 33,255, 33, 33, 33,255,
- 31, 31, 31,255, 30, 30, 30,255, 27, 27, 27,255, 25, 25, 25,255, 22, 22, 22,255, 19, 19, 19,255, 16, 16, 16,255, 12, 12, 12,255,
- 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  4,  4,  4,102,  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,
- 13, 13, 13,153, 29, 29, 29,255, 37, 37, 37,255, 40, 40, 40,255, 42, 42, 42,255, 42, 42, 42,255, 43, 43, 43,255, 41, 41, 41,255,
- 40, 40, 40,255, 38, 38, 38,255, 36, 36, 36,255, 33, 33, 33,255, 30, 30, 30,255, 27, 27, 27,255, 24, 24, 24,255, 20, 20, 20,255,
- 16, 16, 16,255, 12, 12, 12,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  7,  7,  7,153,  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, 13, 13, 13,102,
- 37, 37, 37,255, 44, 44, 44,255, 48, 48, 48,255, 50, 50, 50,255, 51, 51, 51,255, 51, 51, 51,255, 50, 50, 50,255, 49, 49, 49,255,
- 48, 48, 48,255, 45, 45, 45,255, 43, 43, 43,255, 41, 41, 41,255, 37, 37, 37,255, 34, 34, 34,255, 31, 31, 31,255, 28, 28, 28,255,
- 24, 24, 24,255, 20, 20, 20,255, 15, 15, 15,255, 11, 11, 11,255, 10, 10, 10,255, 11, 11, 11,255,  7,  7,  7,153,  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, 13, 13, 13,102, 41, 41, 41,255,
- 50, 50, 50,255, 54, 54, 54,255, 57, 57, 57,255, 58, 58, 58,255, 59, 59, 59,255, 59, 59, 59,255, 58, 58, 58,255, 57, 57, 57,255,
- 55, 55, 55,255, 53, 53, 53,255, 51, 51, 51,255, 48, 48, 48,255, 45, 45, 45,255, 41, 41, 41,255, 38, 38, 38,255, 35, 35, 35,255,
- 31, 31, 31,255, 27, 27, 27,255, 23, 23, 23,255, 17, 17, 17,255, 12, 12, 12,255, 11, 11, 11,255, 11, 11, 11,255,  5,  5,  5,102,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 36, 36, 36,204, 53, 53, 53,255,
- 59, 59, 59,255, 63, 63, 63,255, 65, 65, 65,255, 66, 66, 66,255, 66, 66, 66,255, 66, 66, 66,255, 65, 65, 65,255, 64, 64, 64,255,
- 62, 62, 62,255, 60, 60, 60,255, 57, 57, 57,255, 54, 54, 54,255, 51, 51, 51,255, 48, 48, 48,255, 44, 44, 44,255, 41, 41, 41,255,
- 37, 37, 37,255, 33, 33, 33,255, 29, 29, 29,255, 24, 24, 24,255, 19, 19, 19,255, 13, 13, 13,255, 11, 11, 11,255, 12, 12, 12,255,
-  3,  3,  3, 51,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 19, 19, 19,102, 56, 56, 56,255, 64, 64, 64,255,
- 68, 68, 68,255, 71, 71, 71,255, 73, 73, 73,255, 74, 74, 74,255, 74, 74, 74,255, 73, 73, 73,255, 72, 72, 72,255, 71, 71, 71,255,
- 69, 69, 69,255, 67, 67, 67,255, 64, 64, 64,255, 61, 61, 61,255, 58, 58, 58,255, 54, 54, 54,255, 50, 50, 50,255, 47, 47, 47,255,
- 43, 43, 43,255, 39, 39, 39,255, 34, 34, 34,255, 30, 30, 30,255, 25, 25, 25,255, 19, 19, 19,255, 13, 13, 13,255, 12, 12, 12,255,
- 10, 10, 10,204,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 54, 54, 54,255, 66, 66, 66,255, 72, 72, 72,255,
- 77, 77, 77,255, 79, 79, 79,255, 81, 81, 81,255, 81, 81, 81,255, 81, 81, 81,255, 80, 80, 80,255, 79, 79, 79,255, 77, 77, 77,255,
- 75, 75, 75,255, 73, 73, 73,255, 70, 70, 70,255, 67, 67, 67,255, 63, 63, 63,255, 60, 60, 60,255, 56, 56, 56,255, 52, 52, 52,255,
- 49, 49, 49,255, 44, 44, 44,255, 40, 40, 40,255, 35, 35, 35,255, 30, 30, 30,255, 24, 24, 24,255, 18, 18, 18,255, 12, 12, 12,255,
- 12, 12, 12,255,  6,  6,  6,102,  0,  0,  0,  0,  0,  0,  0,  0, 22, 22, 22,102, 67, 67, 67,255, 76, 76, 76,255, 81, 81, 81,255,
- 84, 84, 84,255, 87, 87, 87,255, 88, 88, 88,255, 88, 88, 88,255, 88, 88, 88,255, 87, 87, 87,255, 86, 86, 86,255, 84, 84, 84,255,
- 82, 82, 82,255, 79, 79, 79,255, 76, 76, 76,255, 73, 73, 73,255, 69, 69, 69,255, 65, 65, 65,255, 62, 62, 62,255, 58, 58, 58,255,
- 54, 54, 54,255, 49, 49, 49,255, 45, 45, 45,255, 40, 40, 40,255, 35, 35, 35,255, 29, 29, 29,255, 23, 23, 23,255, 16, 16, 16,255,
- 12, 12, 12,255, 12, 12, 12,204,  0,  0,  0,  0,  0,  0,  0,  0, 49, 49, 49,204, 76, 76, 76,255, 84, 84, 84,255, 89, 89, 89,255,
- 92, 92, 92,255, 94, 94, 94,255, 95, 95, 95,255, 95, 95, 95,255, 95, 95, 95,255, 94, 94, 94,255, 93, 93, 93,255, 91, 91, 91,255,
- 88, 88, 88,255, 85, 85, 85,255, 82, 82, 82,255, 79, 79, 79,255, 75, 75, 75,255, 71, 71, 71,255, 67, 67, 67,255, 63, 63, 63,255,
- 59, 59, 59,255, 55, 55, 55,255, 50, 50, 50,255, 45, 45, 45,255, 40, 40, 40,255, 34, 34, 34,255, 28, 28, 28,255, 21, 21, 21,255,
- 13, 13, 13,255, 14, 14, 14,255,  0,  0,  0,  0, 14, 14, 14,102, 70, 70, 70,255, 85, 85, 85,255, 92, 92, 92,255, 97, 97, 97,255,
-100,100,100,255,102,102,102,255,102,102,102,255,103,103,103,255,102,102,102,255,101,101,101,255, 99, 99, 99,255, 97, 97, 97,255,
- 94, 94, 94,255, 91, 91, 91,255, 88, 88, 88,255, 84, 84, 84,255, 81, 81, 81,255, 77, 77, 77,255, 72, 72, 72,255, 68, 68, 68,255,
- 64, 64, 64,255, 59, 59, 59,255, 55, 55, 55,255, 50, 50, 50,255, 44, 44, 44,255, 39, 39, 39,255, 32, 32, 32,255, 25, 25, 25,255,
- 17, 17, 17,255, 13, 13, 13,255,  7,  7,  7,102, 24, 24, 24,102, 80, 80, 80,255, 93, 93, 93,255,100,100,100,255,104,104,104,255,
-107,107,107,255,109,109,109,255,109,109,109,255,109,109,109,255,109,109,109,255,107,107,107,255,106,106,106,255,103,103,103,255,
-100,100,100,255, 97, 97, 97,255, 94, 94, 94,255, 90, 90, 90,255, 86, 86, 86,255, 82, 82, 82,255, 77, 77, 77,255, 73, 73, 73,255,
- 69, 69, 69,255, 64, 64, 64,255, 59, 59, 59,255, 54, 54, 54,255, 49, 49, 49,255, 43, 43, 43,255, 36, 36, 36,255, 29, 29, 29,255,
- 21, 21, 21,255, 14, 14, 14,255, 10, 10, 10,153, 29, 29, 29,102, 89, 89, 89,255,100,100,100,255,107,107,107,255,112,112,112,255,
-114,114,114,255,116,116,116,255,116,116,116,255,116,116,116,255,115,115,115,255,114,114,114,255,112,112,112,255,110,110,110,255,
-107,107,107,255,104,104,104,255,100,100,100,255, 96, 96, 96,255, 92, 92, 92,255, 87, 87, 87,255, 83, 83, 83,255, 78, 78, 78,255,
- 73, 73, 73,255, 68, 68, 68,255, 63, 63, 63,255, 58, 58, 58,255, 52, 52, 52,255, 46, 46, 46,255, 40, 40, 40,255, 33, 33, 33,255,
- 24, 24, 24,255, 17, 17, 17,255, 13, 13, 13,204, 46, 46, 46,153, 95, 95, 95,255,107,107,107,255,114,114,114,255,118,118,118,255,
-121,121,121,255,122,122,122,255,123,123,123,255,123,123,123,255,122,122,122,255,122,122,122,255,120,120,120,255,118,118,118,255,
-114,114,114,255,110,110,110,255,106,106,106,255,101,101,101,255, 97, 97, 97,255, 92, 92, 92,255, 87, 87, 87,255, 83, 83, 83,255,
- 78, 78, 78,255, 73, 73, 73,255, 68, 68, 68,255, 62, 62, 62,255, 56, 56, 56,255, 50, 50, 50,255, 44, 44, 44,255, 36, 36, 36,255,
- 28, 28, 28,255, 19, 19, 19,255, 12, 12, 12,204, 47, 47, 47,153,101,101,101,255,113,113,113,255,120,120,120,255,125,125,125,255,
-127,127,127,255,129,129,129,255,130,130,130,255,130,130,130,255,131,131,131,255,131,131,131,255,131,131,131,255,129,129,129,255,
-125,125,125,255,120,120,120,255,113,113,113,255,108,108,108,255,103,103,103,255, 97, 97, 97,255, 92, 92, 92,255, 87, 87, 87,255,
- 82, 82, 82,255, 77, 77, 77,255, 72, 72, 72,255, 66, 66, 66,255, 60, 60, 60,255, 54, 54, 54,255, 47, 47, 47,255, 39, 39, 39,255,
- 31, 31, 31,255, 22, 22, 22,255, 12, 12, 12,204, 48, 48, 48,153,106,106,106,255,118,118,118,255,126,126,126,255,131,131,131,255,
-134,134,134,255,135,135,135,255,137,137,137,255,138,138,138,255,142,142,142,255,147,147,147,255,149,149,149,255,148,148,148,255,
-142,142,142,255,133,133,133,255,124,124,124,255,115,115,115,255,108,108,108,255,102,102,102,255, 97, 97, 97,255, 92, 92, 92,255,
- 87, 87, 87,255, 81, 81, 81,255, 75, 75, 75,255, 69, 69, 69,255, 63, 63, 63,255, 57, 57, 57,255, 49, 49, 49,255, 42, 42, 42,255,
- 33, 33, 33,255, 24, 24, 24,255,  9,  9,  9,153, 32, 32, 32,102,109,109,109,255,123,123,123,255,131,131,131,255,136,136,136,255,
-140,140,140,255,142,142,142,255,144,144,144,255,148,148,148,255,156,156,156,255,168,168,168,255,176,176,176,255,177,177,177,255,
-168,168,168,255,153,153,153,255,137,137,137,255,124,124,124,255,114,114,114,255,107,107,107,255,101,101,101,255, 96, 96, 96,255,
- 90, 90, 90,255, 85, 85, 85,255, 79, 79, 79,255, 72, 72, 72,255, 66, 66, 66,255, 59, 59, 59,255, 52, 52, 52,255, 44, 44, 44,255,
- 35, 35, 35,255, 26, 26, 26,255, 10, 10, 10,153, 17, 17, 17, 51,110,110,110,255,127,127,127,255,136,136,136,255,142,142,142,255,
-145,145,145,255,148,148,148,255,151,151,151,255,159,159,159,255,174,174,174,255,195,195,195,255,212,212,212,255,216,216,216,255,
-204,204,204,255,179,179,179,255,154,154,154,255,135,135,135,255,121,121,121,255,112,112,112,255,106,106,106,255, 99, 99, 99,255,
- 94, 94, 94,255, 88, 88, 88,255, 82, 82, 82,255, 76, 76, 76,255, 69, 69, 69,255, 62, 62, 62,255, 54, 54, 54,255, 46, 46, 46,255,
- 37, 37, 37,255, 26, 26, 26,255,  6,  6,  6,102,  0,  0,  0,  0,107,107,107,255,130,130,130,255,140,140,140,255,146,146,146,255,
-150,150,150,255,153,153,153,255,158,158,158,255,169,169,169,255,191,191,191,255,219,219,219,255,246,246,246,255,254,254,254,255,
-237,237,237,255,204,204,204,255,170,170,170,255,145,145,145,255,127,127,127,255,117,117,117,255,110,110,110,255,103,103,103,255,
- 97, 97, 97,255, 91, 91, 91,255, 85, 85, 85,255, 78, 78, 78,255, 71, 71, 71,255, 64, 64, 64,255, 55, 55, 55,255, 47, 47, 47,255,
- 37, 37, 37,255, 25, 25, 25,255,  3,  3,  3, 51,  0,  0,  0,  0, 65, 65, 65,153,129,129,129,255,142,142,142,255,149,149,149,255,
-154,154,154,255,158,158,158,255,163,163,163,255,176,176,176,255,199,199,199,255,232,232,232,255,255,255,255,255,255,255,255,255,
-255,255,255,255,220,220,220,255,181,181,181,255,151,151,151,255,132,132,132,255,121,121,121,255,113,113,113,255,106,106,106,255,
-100,100,100,255, 94, 94, 94,255, 87, 87, 87,255, 80, 80, 80,255, 73, 73, 73,255, 65, 65, 65,255, 57, 57, 57,255, 48, 48, 48,255,
- 38, 38, 38,255, 16, 16, 16,153,  0,  0,  0,  0,  0,  0,  0,  0, 21, 21, 21, 51,127,127,127,255,143,143,143,255,152,152,152,255,
-157,157,157,255,161,161,161,255,165,165,165,255,177,177,177,255,198,198,198,255,227,227,227,255,253,253,253,255,255,255,255,255,
-250,250,250,255,217,217,217,255,181,181,181,255,153,153,153,255,135,135,135,255,124,124,124,255,117,117,117,255,110,110,110,255,
-103,103,103,255, 96, 96, 96,255, 89, 89, 89,255, 82, 82, 82,255, 74, 74, 74,255, 66, 66, 66,255, 57, 57, 57,255, 48, 48, 48,255,
- 35, 35, 35,255, 10, 10, 10,153,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 93, 93, 93,204,141,141,141,255,153,153,153,255,
-159,159,159,255,163,163,163,255,167,167,167,255,174,174,174,255,188,188,188,255,209,209,209,255,228,228,228,255,234,234,234,255,
-224,224,224,255,200,200,200,255,173,173,173,255,151,151,151,255,136,136,136,255,127,127,127,255,119,119,119,255,112,112,112,255,
-105,105,105,255, 98, 98, 98,255, 90, 90, 90,255, 83, 83, 83,255, 75, 75, 75,255, 66, 66, 66,255, 57, 57, 57,255, 46, 46, 46,255,
- 24, 24, 24,204,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 20, 20, 20, 51,134,134,134,255,151,151,151,255,
-160,160,160,255,164,164,164,255,167,167,167,255,171,171,171,255,178,178,178,255,189,189,189,255,200,200,200,255,202,202,202,255,
-195,195,195,255,180,180,180,255,163,163,163,255,148,148,148,255,137,137,137,255,129,129,129,255,121,121,121,255,114,114,114,255,
-107,107,107,255, 99, 99, 99,255, 91, 91, 91,255, 83, 83, 83,255, 74, 74, 74,255, 65, 65, 65,255, 55, 55, 55,255, 41, 41, 41,255,
-  7,  7,  7, 51,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 49, 49, 49,102,145,145,145,255,
-157,157,157,255,164,164,164,255,167,167,167,255,170,170,170,255,172,172,172,255,176,176,176,255,180,180,180,255,179,179,179,255,
-174,174,174,255,165,165,165,255,155,155,155,255,145,145,145,255,137,137,137,255,130,130,130,255,122,122,122,255,115,115,115,255,
-107,107,107,255, 99, 99, 99,255, 91, 91, 91,255, 82, 82, 82,255, 73, 73, 73,255, 63, 63, 63,255, 50, 50, 50,255, 22, 22, 22,153,
-  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, 78, 78, 78,153,
-149,149,149,255,160,160,160,255,166,166,166,255,168,168,168,255,169,169,169,255,170,170,170,255,169,169,169,255,167,167,167,255,
-164,164,164,255,158,158,158,255,151,151,151,255,144,144,144,255,137,137,137,255,130,130,130,255,123,123,123,255,115,115,115,255,
-106,106,106,255, 98, 98, 98,255, 89, 89, 89,255, 80, 80, 80,255, 70, 70, 70,255, 58, 58, 58,255, 27, 27, 27,153,  3,  3,  3, 51,
-  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,
- 80, 80, 80,153,150,150,150,255,160,160,160,255,165,165,165,255,167,167,167,255,167,167,167,255,166,166,166,255,163,163,163,255,
-160,160,160,255,155,155,155,255,149,149,149,255,143,143,143,255,137,137,137,255,129,129,129,255,121,121,121,255,113,113,113,255,
-105,105,105,255, 96, 96, 96,255, 86, 86, 86,255, 76, 76, 76,255, 63, 63, 63,255, 38, 38, 38,204,  7,  7,  7, 51,  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, 78, 78, 78,153,147,147,147,255,157,157,157,255,161,161,161,255,163,163,163,255,162,162,162,255,160,160,160,255,
-157,157,157,255,152,152,152,255,147,147,147,255,141,141,141,255,135,135,135,255,127,127,127,255,119,119,119,255,110,110,110,255,
-101,101,101,255, 91, 91, 91,255, 80, 80, 80,255, 66, 66, 66,255, 32, 32, 32,153,  7,  7,  7, 51,  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,  0,  0,134,134,134,255,148,148,148,255,154,154,154,255,155,155,155,255,154,154,154,255,
-152,152,152,255,147,147,147,255,142,142,142,255,136,136,136,255,130,130,130,255,122,122,122,255,114,114,114,255,104,104,104,255,
- 93, 93, 93,255, 81, 81, 81,255, 54, 54, 54,204, 22, 22, 22,102,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 73, 73, 73,153,103,103,103,204,137,137,137,255,140,140,140,255,
-140,140,140,255,137,137,137,255,133,133,133,255,127,127,127,255,120,120,120,255,113,113,113,255,102,102,102,255, 91, 91, 91,255,
- 64, 64, 64,204, 28, 28, 28,102,  6,  6,  6, 51,  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,  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, 46, 46, 46,102,
- 72, 72, 72,153, 72, 72, 72,153, 92, 92, 92,204, 88, 88, 88,204, 81, 81, 81,204, 54, 54, 54,153, 35, 35, 35,102, 16, 16, 16, 51,
-  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, 68, 65, 84, 65,  0,144,  0,  0, 32, 45,228,  2,  0,  0,  0,  0,  1,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,  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,
+ 88,  1,  0,  0,  8, 96, 19,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,168, 97, 19,  6,  0,  0,  0,  0,104, 94, 19,  6,
+  0,  0,  0,  0, 40,170,122,108,161,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,101,
+114,102,111,114,109, 97,110, 99,101,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,101,
+114,102,111,114,109, 97,110, 99,101,  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, 80,101,114,102,111,114,109, 97,110, 99,101,  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,  0,  0,  0,  0,  0,242,253, 29,  1,  0,  0,  0,  0,  0,  0,
+  4,  0,  6,  0,  0,  0,  0,  0, 17,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,168, 97, 19,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0, 72, 99, 19,  6,  0,  0,  0,  0,  8, 96, 19,  6,  0,  0,  0,  0,152,172,122,108,161,127,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,111,115,116, 95,112,114,111, 99,101,115,115,105,110,103,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,111,115,116, 95,112,114,111, 99,101,115,115,105,110,103,  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, 80,111,115,116, 32, 80,114,111, 99,101,115,115,105,110,103,  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,  0,218,253, 29,  1,  0,  0,  0,  0,  0,  0,  4,  0,  6,  0,  0,  0,  0,  0, 18,  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,  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, 68, 65, 84, 65,
+ 88,  1,  0,  0, 72, 99, 19,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,232,100, 19,  6,  0,  0,  0,  0,168, 97, 19,  6,
+  0,  0,  0,  0,  8,175,122,108,161,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,116,
+ 97,109,112,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,116,
+ 97,109,112,  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, 83,116, 97,109,112,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,194,253, 29,  1,  0,  0, 20,  0,  0,  0,
+  4,  0,  6,  0,  0,  0,  0,  0, 19,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,232,100, 19,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0,136,102, 19,  6,  0,  0,  0,  0, 72, 99, 19,  6,  0,  0,  0,  0,120,177,122,108,161,127,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,111,117,116,112,117,116,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,111,117,116,112,117,116,  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, 79,117,116,112,117,116,  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,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0, 36,253, 29,  1,134,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0, 20,  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,  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, 68, 65, 84, 65,
+ 88,  1,  0,  0,136,102, 19,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0, 40,104, 19,  6,  0,  0,  0,  0,232,100, 19,  6,
+  0,  0,  0,  0, 88,182,122,108,161,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 98, 97,
+107,101,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 98, 97,
+107,101,  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, 66, 97,107,101,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 12,253, 29,  1,  0,  0,  0,  0,  0,  0,
+  4,  0,  7,  0,  0,  0,  0,  0, 21,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0, 40,104, 19,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0,200,105, 19,  6,  0,  0,  0,  0,136,102, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 83, 67, 69, 78, 69, 95, 80, 84, 95,115, 99,101,110,101,  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, 83, 67, 69, 78, 69, 95, 80, 84, 95,115, 99,101,110,101,  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, 83, 99,101,110,101,  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,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,135,255, 41,  1, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  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,  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, 68, 65, 84, 65,
+ 88,  1,  0,  0,200,105, 19,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,104,107, 19,  6,  0,  0,  0,  0, 40,104, 19,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 83, 67, 69, 78, 69, 95, 80, 84, 95,117,110,105,
+116,  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,  0, 83, 67, 69, 78, 69, 95, 80, 84, 95,117,110,105,
+116,  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,  0, 85,110,105,116,115,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 28,255, 41,  1, 83,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  6,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,104,107, 19,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0,  8,109, 19,  6,  0,  0,  0,  0,200,105, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 83, 67, 69, 78, 69, 95, 80, 84, 95,107,101,121,105,110,103, 95,115,101,116,115,  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, 83, 67, 69, 78, 69, 95, 80, 84, 95,107,101,121,105,110,103, 95,115,101,116,115,  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, 75,101,121,105,110,103, 32, 83,101,116,115,  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,  0,  0,  0,  0,  0,191,254, 41,  1, 69,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  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,  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, 68, 65, 84, 65,
+ 88,  1,  0,  0,  8,109, 19,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,168,110, 19,  6,  0,  0,  0,  0,104,107, 19,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 83, 67, 69, 78, 69, 95, 80, 84, 95,112,104,121,
+115,105, 99,115,  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, 83, 67, 69, 78, 69, 95, 80, 84, 95,112,104,121,
+115,105, 99,115,  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, 71,114, 97,118,105,116,121,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,131,254, 41,  1, 36,  0, 20,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  8,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,168,110, 19,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0, 72,112, 19,  6,  0,  0,  0,  0,  8,109, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 83, 67, 69, 78, 69, 95, 80, 84, 95,115,105,109,112,108,105,102,121,  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, 83, 67, 69, 78, 69, 95, 80, 84, 95,115,105,109,112,108,105,102,121,  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, 83,105,109,112,108,105,102,121,  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,  0,  0,
+  0,  0,  0,  0,  0,  0, 27,254, 41,  1, 80,  0, 20,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  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,  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, 68, 65, 84, 65,
+ 88,  1,  0,  0, 72,112, 19,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,232,113, 19,  6,  0,  0,  0,  0,168,110, 19,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 83, 67, 69, 78, 69, 95, 80, 84, 95, 99,117,115,
+116,111,109, 95,112,114,111,112,115,  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, 83, 67, 69, 78, 69, 95, 80, 84, 95, 99,117,115,
+116,111,109, 95,112,114,111,112,115,  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, 67,117,115,116,111,109, 32, 80,114,111,112,101,
+114,116,105,101,115,  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,223,253, 41,  1, 36,  0,  0,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  0,  0, 10,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,232,113, 19,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0,136,115, 19,  6,  0,  0,  0,  0, 72,112, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 84, 69, 88, 84, 85, 82, 69, 95, 80, 84, 95, 99,111,110,116,101,120,116, 95,116,101,120,116,117,114,101,  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, 84, 69, 88, 84, 85, 82, 69, 95, 80, 84, 95, 99,111,110,116,101,120,116, 95,116,101,120,116,117,114,101,  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,  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,  0,  0,  0,  0, 16,255,187,  0,204,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,  0, 18,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 88,  1,  0,  0,136,115, 19,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0, 40,117, 19,  6,  0,  0,  0,  0,232,113, 19,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 84, 69, 88, 84, 85, 82, 69, 95, 80, 84, 95,109,
+ 97,112,112,105,110,103,  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, 84, 69, 88, 84, 85, 82, 69, 95, 80, 84, 95,109,
+ 97,112,112,105,110,103,  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, 77, 97,112,112,105,110,103,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77,254,187,  0,171,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  3,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0, 40,117, 19,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0,200,118, 19,  6,  0,  0,  0,  0,136,115, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 84, 69, 88, 84, 85, 82, 69, 95, 80, 84, 95,105,110,102,108,117,101,110, 99,101,  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, 84, 69, 88, 84, 85, 82, 69, 95, 80, 84, 95,105,110,102,108,117,101,110, 99,101,  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, 73,110,102,108,117,101,110, 99,101,  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,  0,
+  0,  0,  0,  0,  0,  0,223,252,187,  0, 86,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  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,  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, 68, 65, 84, 65,
+ 88,  1,  0,  0,200,118, 19,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40,117, 19,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 74, 69, 67, 84, 95, 80, 84, 95, 99,111,
+110,115,116,114, 97,105,110,116,115,  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, 79, 66, 74, 69, 67, 84, 95, 80, 84, 95, 99,111,
+110,115,116,114, 97,105,110,116,115,  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, 79, 98,106,101, 99,116, 32, 67,111,110,115,116,
+114, 97,105,110,116,115,  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,160,255,187,  0, 36,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  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, 68, 65, 84, 65,248,  0,  0,  0,104,120, 19,  6,  0,  0,  0,  0,179,  0,  0,  0,
+  1,  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,  4,  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,  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,  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,  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,  2,  0,  1,  0,  0,  0,  0,  0,184,229, 34,109,
+161,127,  0,  0,255, 21,  0,  0,160,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+160,  0,  0,  0,168,121, 19,  6,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,152,126, 19,  6,  0,  0,  0,  0,216, 80, 19,  6,
+  0,  0,  0,  0,232, 63, 19,  6,  0,  0,  0,  0, 72, 68, 19,  6,  0,  0,  0,  0,184, 68, 19,  6,  0,  0,  0,  0,136, 66, 19,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79,  6,  0,  0,  0,  0,  0,  0,143,  0,  0,  0, 15, 15, 80,  6,
+144,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,136,123,243,  5,  0,  0,  0,  0,120,125, 19,  6,  0,  0,  0,  0,120,125, 19,  6,
+  0,  0,  0,  0,152,122, 19,  6,  0,  0,  0,  0,  8,124, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 56, 87, 41,109,161,127,  0,  0,152,144, 47,109,161,127,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0,152,122, 19,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,  8,124, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,202, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,128, 56,  0,  0,202, 68,  0,  0,  0,  0,  0,  0,208, 65,  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,
+ 79,  6,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,224,201, 68,  0,  0,200, 65,  0,224,201, 68,  0,  0,200, 65,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 80,  6, 26,  0, 80,  6, 26,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79,  6,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 80,  6, 26,  0,  6,  0,  1,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,152,125,243,  5,  0,  0,  0,  0,136,234,135,109,161,127,  0,  0,136,234,135,109,
+161,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 56,147, 36,109,161,127,  0,  0,  8,235, 12,108,
+161,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0,  8,124, 19,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,152,122, 19,  6,  0,  0,  0,  0,  0,  0, 64,192,
+  0,  0,126, 67,  0,  0,  0,  0,  0,  0, 72, 66, 88,218,103,194, 40,147,141, 67,  0,  0,  0,  0,  0,  0, 72, 66,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79,  6,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,
+ 79,  6,  0,  0, 18,  0,  0,  0,117,  0,  0,  0,  0,  0,128, 63,  0,  0, 72, 66,  0,124,146, 72,  0,  0, 72, 66,205,204,204, 61,
+  0,  0, 32, 65, 72,  0,  0,  0,  0,  0,  0,  2,  4,  0,  0,  4,  8,  0, 80,  6,118,  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, 79,  6,  0,  0, 26,  0,  0,  0,143,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 80,  6,118,  0,  7,  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,168,124,243,  5,  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, 72,236, 12,108,161,127,  0,  0,248,241, 12,108,
+161,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,208,  0,  0,  0,120,125, 19,  6,
+  0,  0,  0,  0,190,  0,  0,  0,  1,  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, 15,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  1,  0,  0,  0, 68, 65, 84, 65,
+160,  0,  0,  0,152,126, 19,  6,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0, 24, 55, 20,  6,  0,  0,  0,  0,168,121, 19,  6,
+  0,  0,  0,  0,104, 67, 19,  6,  0,  0,  0,  0,248, 66, 19,  6,  0,  0,  0,  0, 24, 66, 19,  6,  0,  0,  0,  0,216, 67, 19,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 81,  6,  0,  0,126,  7,  0,  0,197,  3,  0,  0,103,  4,  0,  0,  3,  3, 46,  1,
+163,  0,  1,  0,  0,  0,  0,  0,  0,  0,  8,  0,136,120,243,  5,  0,  0,  0,  0,104,130, 19,  6,  0,  0,  0,  0,104,130, 19,  6,
+  0,  0,  0,  0,136,127, 19,  6,  0,  0,  0,  0,248,128, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  8, 29, 82,109,161,127,  0,  0,120, 31, 49,109,161,127,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0,136,127, 19,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,248,128, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,151, 67,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,  0,151, 67,  0,  0,  0,  0,  0,  0,208, 65,  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,
+ 45,  1,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,128,150, 67,  0,  0,200, 65,  0,128,150, 67,  0,  0,200, 65,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 46,  1, 26,  0, 46,  1, 26,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 81,  6,  0,  0,126,  7,  0,  0, 78,  4,  0,  0,103,  4,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 46,  1, 26,  0,  8,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,152,122,243,  5,  0,  0,  0,  0, 88, 78, 38,109,161,127,  0,  0, 88, 78, 38,109,
+161,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 88,186, 32,109,161,127,  0,  0, 88,247, 12,108,
+161,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0,248,128, 19,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,136,127, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,128,141, 67,  0,  0,244,194,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,142, 67,  0,  0,242,194,  0,  0,  0,192, 29,  1,  0,  0,
+ 46,  1,  0,  0, 18,  0,  0,  0,136,  0,  0,  0,  0,  0,  0,  0, 28,  1,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,
+ 28,  1,  0,  0, 18,  0,  0,  0,136,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63, 18,  4,  0,  0,  2,  0,  3,  3,  0,  0, 12,  4,  6,  0, 46,  1,137,  0, 29,  1,119,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 81,  6,  0,  0,126,  7,  0,  0,197,  3,  0,  0, 77,  4,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 46,  1,137,  0,  9,  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,168,121,243,  5,  0,  0,  0,  0, 88, 90, 36,109,161,127,  0,  0, 88, 90, 36,109,
+161,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40, 42, 41,109,161,127,  0,  0,  8,251, 12,108,
+161,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  1,  0,  0,104,130, 19,  6,
+  0,  0,  0,  0,183,  0,  0,  0,  1,  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,  3,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,248, 17, 49,109,161,127,  0,  0,248, 17, 49,109,
+161,127,  0,  0,200,131, 19,  6,  0,  0,  0,  0,  0,115,101, 32, 83, 99,117,108,112,116,  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,
+  1,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0,200,131, 19,  6,  0,  0,  0,  0,237,  0,  0,  0,  1,  0,  0,  0, 42, 11,  0,  0,
+ 42, 11,  0,  0, 40,132, 19,  6,  0,  0,  0,  0, 68, 65, 84, 65,160,178,  0,  0, 40,132, 19,  6,  0,  0,  0,  0,236,  0,  0,  0,
+ 42, 11,  0,  0,  0,  0,  0,  0,  2,  0,  1,  0,  8,110, 21,  6,  0,  0,  0,  0, 19,  0,  0,  0,  1,  0,  1,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 20,  0,  0,  0,  1,  0,  1,  0,  8,110, 21,  6,  0,  0,  0,  0, 21,  0,  1,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,152,136, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  8,146, 21,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,168,200, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,232,159, 21,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,248,181, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0, 72,153, 21,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,216,131, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,104,139, 21,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,200,130, 21,  6,  0,  0,  0,  0, 21,  0,  0,  0,  1,  0,  1,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0,216,221, 21,  6,
+  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,200,130, 21,  6,  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,216,131, 21,  6,
+  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 30,  0,255,255,  3,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0, 40,110, 18,  6,
+  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0, 24,210, 18,  6,  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,152, 62, 19,  6,
+  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0, 24, 87, 20,  6,  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0, 40,167, 20,  6,
+  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,152,246, 20,  6,  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,184, 61, 21,  6,
+  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,248,181, 21,  6,  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0, 56,107, 18,  6,
+  0,  0,  0,  0, 30,  0,255,255,  1,  0,  0,  0,152,136, 21,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0,248,227, 22,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,200,130, 21,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,200,130, 21,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,200,130, 21,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,200,130, 21,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,200,130, 21,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,200,130, 21,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,200,130, 21,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,200,130, 21,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,200,130, 21,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,200,130, 21,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,200,130, 21,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,200,130, 21,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,200,130, 21,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,200,130, 21,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,200,130, 21,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,200,130, 21,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,200,130, 21,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,200,130, 21,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,200,130, 21,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,200,130, 21,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,200,130, 21,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,200,130, 21,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,200,130, 21,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,200,130, 21,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,200,130, 21,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,200,130, 21,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,216,131, 21,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,216,131, 21,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,216,131, 21,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,216,131, 21,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,216,131, 21,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,216,131, 21,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,216,131, 21,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,216,131, 21,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,216,131, 21,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,216,131, 21,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,216,131, 21,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,216,131, 21,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,216,131, 21,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,216,131, 21,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,216,131, 21,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,216,131, 21,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,216,131, 21,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,216,131, 21,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,216,131, 21,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,216,131, 21,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,216,131, 21,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,216,131, 21,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,216,131, 21,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,216,131, 21,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,216,131, 21,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,216,131, 21,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,216,131, 21,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,216,131, 21,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,216,131, 21,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,216,131, 21,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,216,131, 21,  6,
+  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 70,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 71,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 72,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 73,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 74,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 75,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 76,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 77,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 78,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 79,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 80,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 81,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0, 82,  0,  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 31,  0, 83,  0,  1,  0,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0,168,200, 21,  6,
+  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 70,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 71,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 72,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 73,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 74,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 75,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 76,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 77,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 78,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 79,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 80,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 81,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 82,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 83,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 84,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 85,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 86,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 87,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 88,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 89,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 90,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 91,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 92,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 93,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 94,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0, 95,  0,  1,  0,  0,  0,104,139, 21,  6,
+  0,  0,  0,  0, 31,  0, 96,  0,  1,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 70,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 71,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 72,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 73,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 74,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 75,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 76,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 77,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 78,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 79,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 80,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 81,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 82,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 83,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 84,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 85,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 86,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 87,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 88,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 89,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 90,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 91,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 92,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 93,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 94,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0, 95,  0,  1,  0,  0,  0,  8,146, 21,  6,  0,  0,  0,  0, 31,  0, 96,  0,  1,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 21,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 22,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 23,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 24,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 25,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 26,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 27,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 28,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 29,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 30,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 31,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 32,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 33,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 34,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 35,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 36,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 37,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 38,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 39,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 40,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 41,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 42,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 43,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 44,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 45,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 46,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 47,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 48,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 49,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 50,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 51,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 52,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 53,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 54,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 55,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 56,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 57,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 58,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 59,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 60,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 61,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 62,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 63,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 64,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 65,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 66,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 67,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 68,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 69,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 70,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 71,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 72,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 73,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 74,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 75,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 76,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 77,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 78,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 79,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 80,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 81,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 82,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 83,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 84,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 85,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 86,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 87,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 88,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 89,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 90,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 91,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 92,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 93,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 94,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0, 95,  0,  1,  0,  0,  0, 72,153, 21,  6,
+  0,  0,  0,  0, 31,  0, 96,  0,  1,  0,  0,  0, 72,153, 21,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0, 40,110, 18,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0, 40,110, 18,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0, 40,110, 18,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0, 40,110, 18,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0, 40,110, 18,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0, 40,110, 18,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0, 40,110, 18,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0, 40,110, 18,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0, 40,110, 18,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0, 40,110, 18,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0, 24,210, 18,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0, 24,210, 18,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0, 24,210, 18,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0, 24,210, 18,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0, 24,210, 18,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0, 24,210, 18,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0, 24,210, 18,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0, 24,210, 18,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0, 24,210, 18,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0, 24,210, 18,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,152, 62, 19,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,152, 62, 19,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,152, 62, 19,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,152, 62, 19,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,152, 62, 19,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,152, 62, 19,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,152, 62, 19,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,152, 62, 19,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,152, 62, 19,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,152, 62, 19,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0, 24, 87, 20,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0, 24, 87, 20,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0, 24, 87, 20,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0, 24, 87, 20,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0, 24, 87, 20,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0, 24, 87, 20,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0, 24, 87, 20,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0, 24, 87, 20,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0, 24, 87, 20,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0, 24, 87, 20,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0, 40,167, 20,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0, 40,167, 20,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0, 40,167, 20,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0, 40,167, 20,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0, 40,167, 20,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0, 40,167, 20,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0, 40,167, 20,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0, 40,167, 20,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0, 40,167, 20,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0, 40,167, 20,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,152,246, 20,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,152,246, 20,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,152,246, 20,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,152,246, 20,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,152,246, 20,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,152,246, 20,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,152,246, 20,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,152,246, 20,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,152,246, 20,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,152,246, 20,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,184, 61, 21,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,184, 61, 21,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,184, 61, 21,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,184, 61, 21,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,184, 61, 21,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,184, 61, 21,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,184, 61, 21,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,184, 61, 21,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,184, 61, 21,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,184, 61, 21,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,248,181, 21,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,248,181, 21,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,248,181, 21,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,248,181, 21,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,248,181, 21,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,248,181, 21,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,248,181, 21,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,248,181, 21,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,248,181, 21,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,248,181, 21,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,248,181, 21,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,248,181, 21,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,248,181, 21,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,248,181, 21,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,248,181, 21,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,248,181, 21,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,248,181, 21,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,248,181, 21,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,248,181, 21,  6,
+  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0, 56,107, 18,  6,  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0, 56,107, 18,  6,
+  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0, 56,107, 18,  6,  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0, 56,107, 18,  6,
+  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0, 56,107, 18,  6,  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0, 56,107, 18,  6,
+  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0, 56,107, 18,  6,  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0, 56,107, 18,  6,
+  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0, 56,107, 18,  6,  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0, 56,107, 18,  6,
+  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0, 56,107, 18,  6,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0,152,136, 21,  6,
+  0,  0,  0,  0, 31,  0,  1,  0,  1,  0,  0,  0,152,136, 21,  6,  0,  0,  0,  0, 31,  0,  2,  0,  1,  0,  0,  0,152,136, 21,  6,
+  0,  0,  0,  0, 31,  0,  3,  0,  1,  0,  0,  0,152,136, 21,  6,  0,  0,  0,  0, 31,  0,  4,  0,  1,  0,  0,  0,152,136, 21,  6,
+  0,  0,  0,  0, 31,  0,  5,  0,  1,  0,  0,  0,152,136, 21,  6,  0,  0,  0,  0, 31,  0,  6,  0,  1,  0,  0,  0,152,136, 21,  6,
+  0,  0,  0,  0, 31,  0,  7,  0,  1,  0,  0,  0,152,136, 21,  6,  0,  0,  0,  0, 31,  0,  8,  0,  1,  0,  0,  0,152,136, 21,  6,
+  0,  0,  0,  0, 31,  0,  9,  0,  1,  0,  0,  0,152,136, 21,  6,  0,  0,  0,  0, 31,  0, 10,  0,  1,  0,  0,  0,152,136, 21,  6,
+  0,  0,  0,  0, 31,  0, 11,  0,  1,  0,  0,  0,152,136, 21,  6,  0,  0,  0,  0, 31,  0, 12,  0,  1,  0,  0,  0,152,136, 21,  6,
+  0,  0,  0,  0, 31,  0, 13,  0,  1,  0,  0,  0,152,136, 21,  6,  0,  0,  0,  0, 31,  0, 14,  0,  1,  0,  0,  0,152,136, 21,  6,
+  0,  0,  0,  0, 31,  0, 15,  0,  1,  0,  0,  0,152,136, 21,  6,  0,  0,  0,  0, 31,  0, 16,  0,  1,  0,  0,  0,152,136, 21,  6,
+  0,  0,  0,  0, 31,  0, 17,  0,  1,  0,  0,  0,152,136, 21,  6,  0,  0,  0,  0, 31,  0, 18,  0,  1,  0,  0,  0,152,136, 21,  6,
+  0,  0,  0,  0, 31,  0, 19,  0,  1,  0,  0,  0,152,136, 21,  6,  0,  0,  0,  0, 31,  0, 20,  0,  1,  0,  0,  0,152,136, 21,  6,
+  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0, 24, 55, 20,  6,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,152,126, 19,  6,  0,  0,  0,  0, 72, 68, 19,  6,  0,  0,  0,  0,168, 65, 19,  6,  0,  0,  0,  0,248, 66, 19,  6,
+  0,  0,  0,  0,184, 68, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79,  6,  0,  0,145,  0,  0,  0,
+103,  4,  0,  0,  1,  1, 80,  6,215,  3,  1,  0,  0,  0,  0,  0,  0,  0,  8,  0,136,126,243,  5,  0,  0,  0,  0,216, 84, 20,  6,
+  0,  0,  0,  0,216, 84, 20,  6,  0,  0,  0,  0,  8, 56, 20,  6,  0,  0,  0,  0,168, 79, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8, 32, 82,109,161,127,  0,  0,216,185, 34,109,161,127,  0,  0, 68, 65, 84, 65,
+ 40,  1,  0,  0,  8, 56, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,120, 57, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,192,108, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,  0,202, 68,  0,  0,  0,  0,
+  0,  0,208, 65,  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, 79,  6,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,224,201, 68,  0,  0,200, 65,  0,224,201, 68,
+  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 80,  6, 26,  0, 80,  6,
+ 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79,  6,  0,  0,145,  0,  0,  0,
+170,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 80,  6, 26,  0, 10,  0,  1,  0,  2,  0,  0,  0,
+  0,  0,  0,  0,  0,  0, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232,136,243,  5,  0,  0,  0,  0,248,212, 33,109,
+161,127,  0,  0,248,212, 33,109,161,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,136, 50, 48,109,
+161,127,  0,  0,136,  4, 13,108,161,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  1,  0,  0,120, 57, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0, 40, 75, 20,  6,  0,  0,  0,  0,  8, 56, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,128,178, 67,  0, 64, 57,196,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 15, 67,  0, 64, 57,196,
+  0,  0,  0,  0,143,  0,  0,  0,160,  0,  0,  0,  0,  0,  0,  0,228,  2,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  0,
+ 17,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  0,228,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  3,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,160,  0,229,  2,143,  0,
+229,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,159,  0,  0,  0,131,  1,  0,  0,
+103,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,160,  0,229,  2, 11,  0,  5,  0,  3,  0,  0,  0,
+  0,  0,  0,  0,160,  0, 50,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,168,133,243,  5,  0,  0,  0,  0,216,230, 34,109,
+161,127,  0,  0,216,230, 34,109,161,127,  0,  0,232, 58, 20,  6,  0,  0,  0,  0,136, 73, 20,  6,  0,  0,  0,  0,152,232, 12,108,
+161,127,  0,  0, 56,  8, 13,108,161,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 88,  1,  0,  0,232, 58, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,136, 60, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  8,218,125,108,161,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,116,111,
+111,108,115, 95,111, 98,106,101, 99,116,109,111,100,101,  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, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,116,111,
+111,108,115, 95,111, 98,106,101, 99,116,109,111,100,101,  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, 79, 98,106,101, 99,116, 32, 84,111,111,108,115,
   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,  0,  0,  0,  0,233,253,143,  0,255,  1,  0,  0,  0,  0,
+  0,  0, 39,  0,  0,  0,  0,  0,  9,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,136, 60, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0, 40, 62, 20,  6,  0,  0,  0,  0,232, 58, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,116,111,111,108,115, 95, 98,114,117,115,104,  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, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,116,111,111,108,115, 95, 98,114,117,115,104,  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, 66,114,117,115,104,  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,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,117,254,143,  0,115,  1,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 88,  1,  0,  0, 40, 62, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,200, 63, 20,  6,  0,  0,  0,  0,136, 60, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,116,111,
+111,108,115, 95, 98,114,117,115,104, 95,116,111,111,108,  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, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,116,111,
+111,108,115, 95, 98,114,117,115,104, 95,116,111,111,108,  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, 84,111,111,108,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 74,254,143,  0, 61,  0,  0,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  0,  0,  2,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,200, 63, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0,104, 65, 20,  6,  0,  0,  0,  0, 40, 62, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,116,111,111,108,115, 95, 98,114,117,115,104, 95,115,116,114,111,107,101,
   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, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,116,111,111,108,115, 95, 98,114,117,115,104, 95,115,116,114,111,107,101,
   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, 83,116,114,111,107,101,  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,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0, 69,254,143,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  3,  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,  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, 68, 65, 84, 65,
+ 88,  1,  0,  0,104, 65, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,  8, 67, 20,  6,  0,  0,  0,  0,200, 63, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,116,111,
+111,108,115, 95, 98,114,117,115,104, 95, 99,117,114,118,101,  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, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,116,111,
+111,108,115, 95, 98,114,117,115,104, 95, 99,117,114,118,101,  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, 67,117,114,118,101,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 45,254,143,  0,  0,  0,  0,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  0,  0,  4,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,  8, 67, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0,168, 68, 20,  6,  0,  0,  0,  0,104, 65, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,116,111,111,108,115, 95, 98,114,117,115,104, 95, 97,112,112,101, 97,114,
+ 97,110, 99,101,  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, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,116,111,111,108,115, 95, 98,114,117,115,104, 95, 97,112,112,101, 97,114,
+ 97,110, 99,101,  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, 65,112,112,101, 97,114, 97,110, 99,101,  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,
+  0,  0,  0,  0,  0,  0,229,253,143,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  7,  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,  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, 68, 65, 84, 65,
+ 88,  1,  0,  0,168, 68, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0, 72, 70, 20,  6,  0,  0,  0,  0,  8, 67, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,116,111,
+111,108,115, 95,118,101,114,116,101,120,112, 97,105,110,116,  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, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,116,111,
+111,108,115, 95,118,101,114,116,101,120,112, 97,105,110,116,  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, 79,112,116,105,111,110,115,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,149,253,143,  0,146,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  8,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0, 72, 70, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0,232, 71, 20,  6,  0,  0,  0,  0,168, 68, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,116,111,111,108,115, 95, 98,114,117,115,104, 95,116,101,120,116,117,114,
+101,  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, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,116,111,111,108,115, 95, 98,114,117,115,104, 95,116,101,120,116,117,114,
+101,  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, 84,101,120,116,117,114,101,  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,  0,  0,  0,
+  0,  0,  0,  0,  0,  0, 93,254,143,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  1,  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,  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, 68, 65, 84, 65,
+ 88,  1,  0,  0,232, 71, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,136, 73, 20,  6,  0,  0,  0,  0, 72, 70, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,115, 99,
+117,108,112,116, 95,111,112,116,105,111,110,115,  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, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,115, 99,
+117,108,112,116, 95,111,112,116,105,111,110,115,  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, 79,112,116,105,111,110,115,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 21,254,143,  0,  0,  0,  0,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  0,  0,  5,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,136, 73, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232, 71, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,115, 99,117,108,112,116, 95,115,121,109,109,101,116,114,121,  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, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,115, 99,117,108,112,116, 95,115,121,109,109,101,116,114,121,  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, 83,121,109,109,101,116,114,121,  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,  0,  0,
+  0,  0,  0,  0,  0,  0,253,253,143,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  6,  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,  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, 68, 65, 84, 65,
+ 40,  1,  0,  0, 40, 75, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0, 56, 78, 20,  6,  0,  0,  0,  0,120, 57, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,128,178, 67,  0,  0, 90,195,  0,  0,  0,  0,  0,  0,  0,  0,227,102, 16, 67, 24, 30, 90,195,
+  0,  0,  0,  0,143,  0,  0,  0,160,  0,  0,  0,  0,  0,  0,  0,215,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  0,
+ 17,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  0,215,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  3,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,160,  0,216,  0,143,  0,
+216,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,159,  0,  0,  0,171,  0,  0,  0,
+130,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,160,  0,216,  0, 12,  0,  6,  0, 34,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,216,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,152,134,243,  5,  0,  0,  0,  0,136,136, 41,109,
+161,127,  0,  0,136,136, 41,109,161,127,  0,  0,152, 76, 20,  6,  0,  0,  0,  0,152, 76, 20,  6,  0,  0,  0,  0,248,179, 41,109,
+161,127,  0,  0,232, 11, 13,108,161,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 88,  1,  0,  0,152, 76, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,136,135,243,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,108, 97,
+115,116, 95,111,112,101,114, 97,116,111,114,  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, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,108, 97,
+115,116, 95,111,112,101,114, 97,116,111,114,  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, 79,112,101,114, 97,116,111,114,  0,100,101,  0,
+ 32, 77,111,100,101,  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,216,255,144,  0, 16,  0,  0,  0,  0,  0,
+  0,  0, 39,  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,  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,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0, 56, 78, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,168, 79, 20,  6,  0,  0,  0,  0, 40, 75, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 52, 67,  0, 96,158,196,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 35, 67,  0, 96,158,196,  0,128,142,195,163,  0,  0,  0,180,  0,  0,  0,  0,  0,  0,  0,
+213,  3,  0,  0,  0,  0,  0,  0,162,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,162,  0,  0,  0,  0,  0,  0,  0,
+213,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  1,  0,  0,
+  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,180,  0,214,  3,163,  0,214,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 79,  6,  0,  0, 79,  6,  0,  0,171,  0,  0,  0,103,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  4,  0,  4,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,152,128,243,  5,  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,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0,168, 79, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 56, 78, 20,  6,  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,  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,  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,160,  0,  0,  0, 79,  6,  0,  0,171,  0,  0,  0,103,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,176,  5,189,  3, 13,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,168,127,243,  5,  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,168, 45, 13,108,161,127,  0,  0,216, 44, 13,108,161,127,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 24, 81, 20,  6,  0,  0,  0,  0, 68, 65, 84, 65,112,  3,  0,  0, 24, 81, 20,  6,  0,  0,  0,  0,173,  0,  0,  0,
+  1,  0,  0,  0,  1,  0,140, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,188,255,212, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,142,  6,128,191,  0,  0,128,191,  0,  0,  0,  0,  0,  0,  0,  0, 11,210, 76,190,
+  0,  0,  0,  0, 68,239,209, 62, 51,177,205,190,184,158, 81, 63,  0,  0,  0,  0, 70,119,105, 63,143, 74, 70, 62, 35, 44,185,190,
+  0,  0,  0,  0,162, 84, 89,188,166, 33,101, 63, 42, 61,228, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 33,210,111,193,
+  0,  0,128, 63, 68,239,209, 62, 70,119,105, 63,176, 84, 89,188,  0,  0,  0,  0, 52,177,205,190,142, 74, 70, 62,166, 33,101, 63,
+  0,  0,  0,  0,185,158, 81, 63, 35, 44,185,190, 43, 61,228, 62,  0,  0,  0,  0, 62, 95, 68, 65, 51,120,173,192,115,208,213, 64,
+  0,  0,128, 63,180,157,229, 62, 57, 36, 43,191,116,169, 81,191,184,158, 81,191,118, 90,127, 63,212,251,164, 62,158, 53,185, 62,
+ 35, 44,185, 62,147,180,109,188,194,164,190, 63,218, 72,228,190, 42, 61,228,190,  0,  0,  0,  0,  0,  0,  0,  0, 33,171,108, 65,
+ 33,210,111, 65,100,240,191, 62,110,116, 85, 63, 32,185, 70,188,  0,  0, 80,180,122, 55,119,190, 96, 82,238, 61,227,177,  9, 63,
+  0,  0,248, 51,197,112,117,194,179,208,216, 65,220,158,  5,194,231,251,159,192,221, 54,114, 66, 30,247,213,193, 58,221,  3, 66,
+ 25,  4,160, 64, 68,239,209, 62, 51,177,205,190,184,158, 81, 63,  0,  0,  0,  0, 70,119,105, 63,143, 74, 70, 62, 35, 44,185,190,
+  0,  0,  0,  0,162, 84, 89,188,166, 33,101, 63, 42, 61,228, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 33,210,111,193,
+  0,  0,128, 63,180,157,229, 62, 57, 36, 43,191,116,169, 81,191,184,158, 81,191,118, 90,127, 63,212,251,164, 62,158, 53,185, 62,
+ 35, 44,185, 62,147,180,109,188,194,164,190, 63,218, 72,228,190, 42, 61,228,190,  0,  0,  0,  0,  0,  0,  0,  0, 33,171,108, 65,
+ 33,210,111, 65,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -5025,81 +3528,377 @@ char datatoc_startup_blend[]= {
   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,  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,114,182,180, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,114,182,180, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,114,182,180, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63, 92, 62, 55, 63, 56,186,224,190,237,203,148,190,  3,236,234,190, 33,210,111, 65, 33,210,111, 65,  0,  0,  0,  0,
+  0,  0,  0,  0,146,156,164, 58,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  1,  0,  0,255,255,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63, 32, 33, 12, 66, 85,152,137, 66,
+113, 27,126, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 96,  1,  0,  0,216, 84, 20,  6,
+  0,  0,  0,  0,174,  0,  0,  0,  1,  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,  1,  0,  0,  0, 51, 51, 51, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 65,205,204, 76, 62,  2,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  7,  0,104,139, 21,  6,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+  1,  0,  0,  0,  3,  0,  0,  0,  1,  0,  3,  0,  8, 24,128,  0,  0,  0, 12, 66,  0,  0,128, 63,205,204,204, 61,  0,  0,122, 68,
+  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, 16,  0, 10,  0,  7,  1,
+  0,  3,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 83, 78,  0,  0,  8,  1,  0,  0, 24, 87, 20,  6,  0,  0,  0,  0,210,  0,  0,  0,
+  1,  0,  0,  0, 40,167, 20,  6,  0,  0,  0,  0,152, 62, 19,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 83, 82, 71, 97,109,101, 32, 76,111,103,105, 99,  0, 46, 48, 48, 49,  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,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,104, 88, 20,  6,
+  0,  0,  0,  0, 24, 94, 20,  6,  0,  0,  0,  0,136, 94, 20,  6,  0,  0,  0,  0, 72,103, 20,  6,  0,  0,  0,  0,184,103, 20,  6,
+  0,  0,  0,  0,216,159, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,110, 21,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  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,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,104, 88, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,
+  1,  0,  0,  0,216, 88, 20,  6,  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, 68, 65, 84, 65, 32,  0,  0,  0,216, 88, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0, 72, 89, 20,  6,
+  0,  0,  0,  0,104, 88, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 32,  0,  0,  0, 72, 89, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,184, 89, 20,  6,  0,  0,  0,  0,216, 88, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,  5,  4,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,184, 89, 20,  6,
+  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0, 40, 90, 20,  6,  0,  0,  0,  0, 72, 89, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,126,  7,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 40, 90, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,
+  1,  0,  0,  0,152, 90, 20,  6,  0,  0,  0,  0,184, 89, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,234,  3,
+  1,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,152, 90, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,  8, 91, 20,  6,
+  0,  0,  0,  0, 40, 90, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,234,  3,  1,  0,  0,  0, 68, 65, 84, 65,
+ 32,  0,  0,  0,  8, 91, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,120, 91, 20,  6,  0,  0,  0,  0,152, 90, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,140,  1,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,120, 91, 20,  6,
+  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,232, 91, 20,  6,  0,  0,  0,  0,  8, 91, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 32,  6,140,  1,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,232, 91, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,
+  1,  0,  0,  0, 88, 92, 20,  6,  0,  0,  0,  0,120, 91, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32,  6,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 88, 92, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,200, 92, 20,  6,
+  0,  0,  0,  0,232, 91, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,140,  1,  0,  0,  0,  0, 68, 65, 84, 65,
+ 32,  0,  0,  0,200, 92, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0, 56, 93, 20,  6,  0,  0,  0,  0, 88, 92, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64,  5,140,  1,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 56, 93, 20,  6,
+  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,168, 93, 20,  6,  0,  0,  0,  0,200, 92, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 64,  5,234,  3,  1,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,168, 93, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,
+  1,  0,  0,  0, 24, 94, 20,  6,  0,  0,  0,  0, 56, 93, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68,  1,140,  1,
+  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 24, 94, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,168, 93, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68,  1,234,  3,  1,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,136, 94, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,248, 94, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,216, 88, 20,  6,  0,  0,  0,  0, 72, 89, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,248, 94, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,104, 95, 20,  6,  0,  0,  0,  0,136, 94, 20,  6,
+  0,  0,  0,  0,216, 88, 20,  6,  0,  0,  0,  0, 40, 90, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,104, 95, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,216, 95, 20,  6,  0,  0,  0,  0,248, 94, 20,  6,
+  0,  0,  0,  0, 72, 89, 20,  6,  0,  0,  0,  0,152, 90, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,216, 95, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 72, 96, 20,  6,  0,  0,  0,  0,104, 95, 20,  6,
+  0,  0,  0,  0, 40, 90, 20,  6,  0,  0,  0,  0,152, 90, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 72, 96, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,184, 96, 20,  6,  0,  0,  0,  0,216, 95, 20,  6,
+  0,  0,  0,  0, 40, 90, 20,  6,  0,  0,  0,  0,  8, 91, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,184, 96, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 40, 97, 20,  6,  0,  0,  0,  0, 72, 96, 20,  6,
+  0,  0,  0,  0,  8, 91, 20,  6,  0,  0,  0,  0,120, 91, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 40, 97, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,152, 97, 20,  6,  0,  0,  0,  0,184, 96, 20,  6,
+  0,  0,  0,  0,184, 89, 20,  6,  0,  0,  0,  0,232, 91, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,152, 97, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,  8, 98, 20,  6,  0,  0,  0,  0, 40, 97, 20,  6,
+  0,  0,  0,  0,120, 91, 20,  6,  0,  0,  0,  0,232, 91, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,  8, 98, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,120, 98, 20,  6,  0,  0,  0,  0,152, 97, 20,  6,
+  0,  0,  0,  0,104, 88, 20,  6,  0,  0,  0,  0,  8, 91, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,120, 98, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,232, 98, 20,  6,  0,  0,  0,  0,  8, 98, 20,  6,
+  0,  0,  0,  0,104, 88, 20,  6,  0,  0,  0,  0,232, 91, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,232, 98, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 88, 99, 20,  6,  0,  0,  0,  0,120, 98, 20,  6,
+  0,  0,  0,  0,152, 90, 20,  6,  0,  0,  0,  0, 88, 92, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 88, 99, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,200, 99, 20,  6,  0,  0,  0,  0,232, 98, 20,  6,
+  0,  0,  0,  0,184, 89, 20,  6,  0,  0,  0,  0, 88, 92, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,200, 99, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 56,100, 20,  6,  0,  0,  0,  0, 88, 99, 20,  6,
+  0,  0,  0,  0,120, 91, 20,  6,  0,  0,  0,  0, 88, 92, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 56,100, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,168,100, 20,  6,  0,  0,  0,  0,200, 99, 20,  6,
+  0,  0,  0,  0,200, 92, 20,  6,  0,  0,  0,  0, 56, 93, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,168,100, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 24,101, 20,  6,  0,  0,  0,  0, 56,100, 20,  6,
+  0,  0,  0,  0,152, 90, 20,  6,  0,  0,  0,  0, 56, 93, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 24,101, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,136,101, 20,  6,  0,  0,  0,  0,168,100, 20,  6,
+  0,  0,  0,  0, 88, 92, 20,  6,  0,  0,  0,  0,200, 92, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,136,101, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,248,101, 20,  6,  0,  0,  0,  0, 24,101, 20,  6,
+  0,  0,  0,  0,  8, 91, 20,  6,  0,  0,  0,  0,168, 93, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,248,101, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,104,102, 20,  6,  0,  0,  0,  0,136,101, 20,  6,
+  0,  0,  0,  0,200, 92, 20,  6,  0,  0,  0,  0,168, 93, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,104,102, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,216,102, 20,  6,  0,  0,  0,  0,248,101, 20,  6,
+  0,  0,  0,  0, 40, 90, 20,  6,  0,  0,  0,  0, 24, 94, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0,216,102, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 72,103, 20,  6,  0,  0,  0,  0,104,102, 20,  6,
+  0,  0,  0,  0, 56, 93, 20,  6,  0,  0,  0,  0, 24, 94, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 40,  0,  0,  0, 72,103, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,216,102, 20,  6,
+  0,  0,  0,  0,168, 93, 20,  6,  0,  0,  0,  0, 24, 94, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+160,  0,  0,  0,184,103, 20,  6,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,136,107, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 40, 90, 20,  6,  0,  0,  0,  0,216, 88, 20,  6,  0,  0,  0,  0, 72, 89, 20,  6,  0,  0,  0,  0,152, 90, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,  0,  0,235,  3,  0,  0,  5,  4,  0,  0,  7,  7,127,  7,
+ 27,  0,  1,  0,  0,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,152,166, 20,  6,  0,  0,  0,  0,152,166, 20,  6,
+  0,  0,  0,  0,168,104, 20,  6,  0,  0,  0,  0, 24,106, 20,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0,168,104, 20,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0, 24,106, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0, 32,148, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,224,239, 68,  0,  0,  0,  0,  0,  0,208, 65,  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,
+126,  7,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,192,239, 68,  0,  0,200, 65,  0,192,239, 68,  0,  0,200, 65,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,127,  7, 26,  0,127,  7, 26,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,  0,  0,235,  3,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,127,  7, 26,  0,  0,  0,  1,  0,  2,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0, 24,106, 20,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,168,104, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,240,109, 69,  0,  0,128,192,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,238, 68,  0,  0,  0,  0,  0,  0,  0, 64,112,  7,  0,  0,
+129,  7,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,111,  7,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,
+111,  7,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  2,  0,  0,  0,  1,  0,  3,  3,  2,  0,  0,  4, 10,  0,129,  7,  2,  0,112,  7,  2,  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,  5,  4,  0,  0,  5,  4,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  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,  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, 68, 65, 84, 65,160,  0,  0,  0,136,107, 20,  6,
+  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0, 24,132, 20,  6,  0,  0,  0,  0,184,103, 20,  6,  0,  0,  0,  0,232, 91, 20,  6,
+  0,  0,  0,  0,120, 91, 20,  6,  0,  0,  0,  0, 88, 92, 20,  6,  0,  0,  0,  0,184, 89, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 33,  6,  0,  0,126,  7,  0,  0,  0,  0,  0,  0,139,  1,  0,  0,  4,  4, 94,  1,140,  1,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,216,130, 20,  6,  0,  0,  0,  0,216,130, 20,  6,  0,  0,  0,  0,120,108, 20,  6,
+  0,  0,  0,  0,232,109, 20,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0,120,108, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,232,109, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,148, 67,  0,  0,  0,  0,
+  0,  0,208, 65,  0,  0,  0,  0,  0,  0,175, 67,  0,  0,  0,  0,  0,  0,208, 65,  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, 93,  1,  0,  0,  0,  0,  0,  0,
+ 25,  0,  0,  0,  0,128,174, 67,  0,  0,200, 65,  0,128,174, 67,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 94,  1, 26,  0, 94,  1, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 33,  6,  0,  0,126,  7,  0,  0,114,  1,  0,  0,139,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 94,  1, 26,  0,  0,  0,  1,  0,  1,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,232,109, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,120,108, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,174, 67,  0,  0, 61,196,
+  0,  0,  0,  0,  0,  0,  0,  0,255,127,166, 67,255,255,184,195,  0,  0,  0,  0, 77,  1,  0,  0, 94,  1,  0,  0,  0,  0,  0,  0,
+113,  1,  0,  0,  0,  0,  0,  0, 78,  1,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0, 76,  1,  0,  0,  0,  0,  0,  0,
+113,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  1,  0,  0,
+  1,  0,  7,  0, 18,  0,  0,  4,  6,  0, 94,  1,114,  1, 77,  1,114,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 33,  6,  0,  0,126,  7,  0,  0,  0,  0,  0,  0,113,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 94,  1,114,  1,  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,  0,  0, 88,111, 20,  6,
+  0,  0,  0,  0, 56,129, 20,  6,  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, 68, 65, 84, 65, 88,  1,  0,  0, 88,111, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0,248,112, 20,  6,  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, 66, 85, 84, 84, 79, 78, 83, 95, 80, 84, 95, 99,111,110,116,101,120,116,  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, 66, 85, 84, 84, 79, 78, 83, 95, 80, 84, 95, 99,111,110,116,101,120,116,  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, 67,111,110,116,101,120,116,  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,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,220,255, 76,  1, 36,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 88,  1,  0,  0,248,112, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,152,114, 20,  6,  0,  0,  0,  0, 88,111, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,114,101,
+110,100,101,114,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,114,101,
+110,100,101,114,  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, 82,101,110,100,101,114,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,135,255, 76,  1, 61,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,152,114, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0, 56,116, 20,  6,  0,  0,  0,  0,248,112, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,108, 97,121,101,114,115,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,108, 97,121,101,114,115,  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, 76, 97,121,101,114,115,  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,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,111,255, 76,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  2,  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,  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, 68, 65, 84, 65,
+ 88,  1,  0,  0, 56,116, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,216,117, 20,  6,  0,  0,  0,  0,152,114, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,100,105,
+109,101,110,115,105,111,110,115,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,100,105,
+109,101,110,115,105,111,110,115,  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, 68,105,109,101,110,115,105,111,110,115,  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,  0,  0,  0,  0,  0,  0,140,254, 76,  1,203,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  3,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,216,117, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0,120,119, 20,  6,  0,  0,  0,  0, 56,116, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 97,110,116,105, 97,108,105, 97,115,105,110,103,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 97,110,116,105, 97,108,105, 97,115,105,110,103,  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, 65,110,116,105, 45, 65,108,105, 97,115,105,110,103,  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,  0,  0,  0, 58,254, 76,  1, 58,  0, 20,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  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,  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, 68, 65, 84, 65,
+ 88,  1,  0,  0,120,119, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0, 24,121, 20,  6,  0,  0,  0,  0,216,117, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,109,111,
+116,105,111,110, 95, 98,108,117,114,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,109,111,
+116,105,111,110, 95, 98,108,117,114,  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, 83, 97,109,112,108,101,100, 32, 77,111,116,105,
+111,110, 32, 66,108,117,114,  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, 34,254, 76,  1,  0,  0, 20,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  0,  0,  5,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0, 24,121, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0,184,122, 20,  6,  0,  0,  0,  0,120,119, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,104, 97,100,105,110,103,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,104, 97,100,105,110,103,  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, 83,104, 97,100,105,110,103,  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,  0,  0,  0,
+  0,  0,  0,  0,  0,  0, 10,254, 76,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  6,  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,  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, 68, 65, 84, 65,
+ 88,  1,  0,  0,184,122, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0, 88,124, 20,  6,  0,  0,  0,  0, 24,121, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,101,
+114,102,111,114,109, 97,110, 99,101,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,101,
+114,102,111,114,109, 97,110, 99,101,  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, 80,101,114,102,111,114,109, 97,110, 99,101,  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,  0,  0,  0,  0,  0,242,253, 76,  1,  0,  0,  0,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  0,  0,  7,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0, 88,124, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0,248,125, 20,  6,  0,  0,  0,  0,184,122, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,111,115,116, 95,112,114,111, 99,101,115,115,105,110,103,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,111,115,116, 95,112,114,111, 99,101,115,115,105,110,103,  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, 80,111,115,116, 32, 80,114,111, 99,101,115,115,105,110,103,  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,  0,218,253, 76,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  8,  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,  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, 68, 65, 84, 65,
+ 88,  1,  0,  0,248,125, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,152,127, 20,  6,  0,  0,  0,  0, 88,124, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,116,
+ 97,109,112,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,116,
+ 97,109,112,  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, 83,116, 97,109,112,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,194,253, 76,  1,  0,  0, 20,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  0,  0,  9,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,152,127, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,
+  1,  0,  0,  0, 56,129, 20,  6,  0,  0,  0,  0,248,125, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,111,117,116,112,117,116,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,111,117,116,112,117,116,  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, 79,117,116,112,117,116,  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,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0, 40,253, 76,  1,130,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,  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,  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, 68, 65, 84, 65,
+ 88,  1,  0,  0, 56,129, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,152,127, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 98, 97,
+107,101,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 98, 97,
+107,101,  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, 66, 97,107,101,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16,253, 76,  1,  0,  0,  0,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  0,  0, 11,  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,  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, 68, 65, 84, 65,248,  0,  0,  0,216,130, 20,  6,  0,  0,  0,  0,179,  0,  0,  0,
+  1,  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,  4,  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,  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,  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,  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,  2,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,255, 21,  0,  0,160,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+160,  0,  0,  0, 24,132, 20,  6,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,136,139, 20,  6,  0,  0,  0,  0,136,107, 20,  6,
+  0,  0,  0,  0,104, 88, 20,  6,  0,  0,  0,  0,  8, 91, 20,  6,  0,  0,  0,  0,120, 91, 20,  6,  0,  0,  0,  0,232, 91, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 31,  6,  0,  0,  0,  0,  0,  0,139,  1,  0,  0, 17, 17, 32,  6,
+140,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,248,138, 20,  6,  0,  0,  0,  0,248,138, 20,  6,
+  0,  0,  0,  0,  8,133, 20,  6,  0,  0,  0,  0,136,137, 20,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0,  8,133, 20,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,120,134, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0, 74, 67,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,  0,196, 68,  0,  0,  0,  0,  0,  0,208, 65,  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,
+ 31,  6,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,224,195, 68,  0,  0,200, 65,  0,224,195, 68,  0,  0,200, 65,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 32,  6, 26,  0, 32,  6, 26,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 31,  6,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32,  6, 26,  0,  0,  0,  1,  0,  2,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,120,134, 20,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,136,137, 20,  6,  0,  0,  0,  0,  8,133, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0, 92, 67,  0,  0,185,195,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 75, 67,  0,  0,185,195,  0,  0,  0,  0,203,  0,  0,  0,
+220,  0,  0,  0,  0,  0,  0,  0,113,  1,  0,  0,  0,  0,  0,  0,202,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,
+202,  0,  0,  0,  0,  0,  0,  0,113,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,
+  0,  0,  0, 64, 10,  3,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,220,  0,114,  1,203,  0,114,  1,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,219,  0,  0,  0, 26,  0,  0,  0,139,  1,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,220,  0,114,  1,  0,  0,  4,  0,  3,  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,232,135, 20,  6,  0,  0,  0,  0,232,135, 20,  6,  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, 68, 65, 84, 65, 88,  1,  0,  0,232,135, 20,  6,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  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, 76, 79, 71, 73, 67, 95, 80, 84, 95,112,114,111,112,101,114,116,105,101,115,  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, 76, 79, 71, 73, 67, 95, 80, 84, 95,112,114,111,112,101,114,116,105,101,115,  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, 80,114,111,112,101,114,116,105,101,115,  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,  0,  0,  0,  0,  0,  0,196,255,203,  0, 36,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0,136,137, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,120,134, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,160, 68,  0,  0,  0,  0,  0,  0,112, 67,  0, 80, 31,195,
+  0,234,179, 68,224,198,182,194,184,177,165, 67, 51,  5,  0,  0, 68,  5,  0,  0, 18,  0,  0,  0,113,  1,  0,  0,  0,  0,  0,  0,
+ 50,  5,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0, 50,  5,  0,  0, 18,  0,  0,  0,113,  1,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,250, 70,  0,  0,250, 70,  0,  0,  0, 63, 72,225,154, 63, 10,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  4,
+  0,  0, 68,  5,114,  1, 51,  5, 96,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,220,  0,  0,  0,
+ 31,  6,  0,  0, 26,  0,  0,  0,139,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68,  5,114,  1,
   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,  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, 68, 65, 84, 65, 72,  0,  0,  0,248,138, 20,  6,  0,  0,  0,  0,192,  0,  0,  0,  1,  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, 17,  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,255,  7,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0,136,139, 20,  6,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0, 72,146, 20,  6,
+  0,  0,  0,  0, 24,132, 20,  6,  0,  0,  0,  0,200, 92, 20,  6,  0,  0,  0,  0, 56, 93, 20,  6,  0,  0,  0,  0,152, 90, 20,  6,
+  0,  0,  0,  0, 88, 92, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 65,  5,  0,  0,126,  7,  0,  0,141,  1,  0,  0,
+233,  3,  0,  0,  9,  9, 62,  2, 93,  2,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 88,143, 20,  6,
+  0,  0,  0,  0, 88,143, 20,  6,  0,  0,  0,  0,120,140, 20,  6,  0,  0,  0,  0,232,141, 20,  6,  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, 68, 65, 84, 65,
+ 40,  1,  0,  0,120,140, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,232,141, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,230, 67,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,128, 15, 68,  0,  0,  0,  0,
+  0,  0,208, 65,  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, 61,  2,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0, 64, 15, 68,  0,  0,200, 65,  0, 64, 15, 68,
+  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 62,  2, 26,  0, 62,  2,
+ 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 65,  5,  0,  0,126,  7,  0,  0,141,  1,  0,  0,
+166,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 62,  2, 26,  0,  0,  0,  1,  0,  2,  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,  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, 68, 65, 84, 65,
+ 40,  1,  0,  0,232,141, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,120,140, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,128,181, 67,  0,  0,  0,  0,  0,128,218, 67,  0,  0,  0,  0,131,248,  1, 68,  0,  0,  0,  0,
+ 86, 26,  3, 68,  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, 61,  2,  0,  0,  0,  0,  0,  0, 66,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 10,215, 35, 60,  0,  0,122, 68,  0,  0,  0,  0,  1,  0,  3,  0,  0,  0,  0,  4, 10,  0, 62,  2, 67,  2, 62,  2,
+ 67,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 65,  5,  0,  0,126,  7,  0,  0,167,  1,  0,  0,
+233,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 62,  2, 67,  2,  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,  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, 68, 65, 84, 65,
+160,  2,  0,  0, 88,143, 20,  6,  0,  0,  0,  0,186,  0,  0,  0,  1,  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,  9,  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,
+ 12,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  4,  0,  0,  0,  1,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -5117,20 +3916,78 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0, 72,146, 20,  6,
+  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,216,159, 20,  6,  0,  0,  0,  0,136,139, 20,  6,  0,  0,  0,  0,168, 93, 20,  6,
+  0,  0,  0,  0, 24, 94, 20,  6,  0,  0,  0,  0, 56, 93, 20,  6,  0,  0,  0,  0,200, 92, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 69,  1,  0,  0, 63,  5,  0,  0,141,  1,  0,  0,233,  3,  0,  0,  1,  1,251,  3, 93,  2,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40,158, 20,  6,  0,  0,  0,  0, 40,158, 20,  6,  0,  0,  0,  0, 56,147, 20,  6,
+  0,  0,  0,  0,248,152, 20,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0, 56,147, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,168,148, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64,113, 68,  0,  0,  0,  0,
+  0,  0,208, 65,  0,  0,  0,  0,  0,192,126, 68,  0,  0,  0,  0,  0,  0,208, 65,  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,250,  3,  0,  0,  0,  0,  0,  0,
+ 25,  0,  0,  0,  0,128,126, 68,  0,  0,200, 65,  0,128,126, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
+  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,251,  3, 26,  0,251,  3, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 69,  1,  0,  0, 63,  5,  0,  0,141,  1,  0,  0,166,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,251,  3, 26,  0,  0,  0,  1,  0,  2,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,168,148, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0, 24,150, 20,  6,  0,  0,  0,  0, 56,147, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 15, 67,  0, 64, 70,196,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 15, 67,255,127, 70,196,  0,  0,  0,  0,143,  0,  0,  0,160,  0,  0,  0, 18,  0,  0,  0,
+ 43,  3,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0, 18,  0,  0,  0,
+ 43,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  0,  0,  0,
+  1,  0,  7,  0, 18,  0,  0,  0,  6,  0,160,  0, 44,  3,143,  0, 26,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 69,  1,  0,  0, 69,  1,  0,  0,167,  1,  0,  0,233,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0, 67,  2,  0,  0,  5,  0,  3,  0,  1,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0, 24,150, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,136,151, 20,  6,  0,  0,  0,  0,168,148, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16, 67,  0,  0,206,194,
+  0,  0,  0,  0,  0,  0,  0,  0,231,102, 16, 67,  0,  0,206,194,  0,  0,  0,  0,143,  0,  0,  0,160,  0,  0,  0, 18,  0,  0,  0,
+119,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0, 18,  0,  0,  0,
+119,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  0,  0,  0,
+  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,160,  0,120,  0,143,  0,102,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 69,  1,  0,  0, 63,  5,  0,  0,167,  1,  0,  0,167,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  6,  0, 34,  0,  2,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,136,151, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,248,152, 20,  6,  0,  0,  0,  0, 24,150, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 52, 67,  0,  0,109,196,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 35, 67,  0,  0,109,196,  0,128,145,195,163,  0,  0,  0,180,  0,  0,  0,  0,  0,  0,  0,
+144,  2,  0,  0,  0,  0,  0,  0,162,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,162,  0,  0,  0,  0,  0,  0,  0,
+144,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  1,  0,  0,
+  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,180,  0,145,  2,163,  0,145,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 63,  5,  0,  0, 63,  5,  0,  0,167,  1,  0,  0,233,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  4,  0,  4,  0,  1,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,248,152, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,136,151, 20,  6,  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,  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,  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, 69,  1,  0,  0, 63,  5,  0,  0,167,  1,  0,  0,233,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,251,  3, 67,  2,  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,  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,104,154, 20,  6,  0,  0,  0,  0, 68, 65, 84, 65,112,  3,  0,  0,104,154, 20,  6,  0,  0,  0,  0,173,  0,  0,  0,
+  1,  0,  0,  0,190, 35, 30, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 75, 40,139, 61,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,111, 18,  3,187,  0,  0,  0,  0,  0,  0,  0,128,  0,  0,  0,128,  0,  0,  0,128,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,190, 35, 30, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 75, 40,139, 61,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,111, 18,  3,187,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,149, 53,207, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,112,121,107, 65,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,255,255,249,195,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,190, 35, 30, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 75, 40,139, 61,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,111, 18,  3,187,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -5138,80 +3995,414 @@ char datatoc_startup_blend[]= {
   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,  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,207,  3,116, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,207,  3,116, 64,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,207,  3,116, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,149, 53,207, 65,214,211,111, 65,  0,  0,  0,  0,
+  0,  0,  0,  0,221, 57, 80, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,160, 65,  0,  0,  5,  0,251,251,  0,  0,
+ 92, 62, 55, 63, 56,186,224,190,237,203,148,190,  3,236,234,190,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,180, 66,  0,  0,180, 66,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 96,  1,  0,  0, 40,158, 20,  6,
+  0,  0,  0,  0,174,  0,  0,  0,  1,  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,  1,  0,  0,  0, 51, 51, 51, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 65,205,204, 76, 62,  2,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  7,  0,104,139, 21,  6,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+  1,  0,  0,  0,  3,  0,  0,  0,  1,  0,  3,  0,  8,  8,128,  0,  0,  0, 12, 66,  0,  0,128, 63,205,204,204, 61,  0,  0,122, 68,
+  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, 16,  0, 10,  0,  7,  1,
+  0,  3,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0,216,159, 20,  6,  0,  0,  0,  0,214,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72,146, 20,  6,  0,  0,  0,  0,  8, 91, 20,  6,  0,  0,  0,  0, 40, 90, 20,  6,
+  0,  0,  0,  0, 24, 94, 20,  6,  0,  0,  0,  0,168, 93, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 67,  1,  0,  0,141,  1,  0,  0,233,  3,  0,  0,  3,  3, 68,  1, 93,  2,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,168,163, 20,  6,  0,  0,  0,  0,168,163, 20,  6,  0,  0,  0,  0,200,160, 20,  6,  0,  0,  0,  0, 56,162, 20,  6,
+  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, 68, 65, 84, 65, 40,  1,  0,  0,200,160, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0, 56,162, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,244, 67,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,
+  0,  0,162, 67,  0,  0,  0,  0,  0,  0,208, 65,  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, 67,  1,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,128,161, 67,
+  0,  0,200, 65,  0,128,161, 67,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0,
+ 10,  0, 68,  1, 26,  0, 68,  1, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 67,  1,  0,  0,141,  1,  0,  0,166,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68,  1, 26,  0,
+  0,  0,  1,  0,  2,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0, 56,162, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,200,160, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,141, 67,  0,  0,244,194,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,128,153, 67,  0, 64, 12,196,  0,  0,  0,  0, 51,  1,  0,  0, 68,  1,  0,  0, 18,  0,  0,  0, 66,  2,  0,  0,  0,  0,  0,  0,
+ 50,  1,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0, 50,  1,  0,  0, 18,  0,  0,  0, 66,  2,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63, 18,  6,  0,  0,  2,  0,  3,  3,  0,  0, 12,  4,
+  6,  0, 68,  1, 67,  2, 51,  1, 49,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 67,  1,  0,  0,167,  1,  0,  0,233,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68,  1, 67,  2,
   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,  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, 68, 65, 84, 65, 24,  1,  0,  0,168,163, 20,  6,  0,  0,  0,  0,183,  0,  0,  0,  1,  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,  3,  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,  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,  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,  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,  8,165, 20,  6,  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,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0,  8,165, 20,  6,
+  0,  0,  0,  0,237,  0,  0,  0,  1,  0,  0,  0, 14,  0,  0,  0, 14,  0,  0,  0,104,165, 20,  6,  0,  0,  0,  0, 68, 65, 84, 65,
+224,  0,  0,  0,104,165, 20,  6,  0,  0,  0,  0,236,  0,  0,  0, 14,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 19,  0,  0,  0,  1,  0,  1,  0,  8,110, 21,  6,  0,  0,  0,  0, 20,  0,  0,  0,  1,  0,  1,  0,  8,110, 21,  6,
+  0,  0,  0,  0, 21,  0,  1,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,152,136, 21,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  8,146, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,168,200, 21,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,232,159, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,248,181, 21,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0, 72,153, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,216,131, 21,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,104,139, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,200,130, 21,  6,
+  0,  0,  0,  0, 21,  0,  0,  0,  1,  0,  1,  0,  8,110, 21,  6,  0,  0,  0,  0, 83, 78,  0,  0,  8,  1,  0,  0, 40,167, 20,  6,
+  0,  0,  0,  0,210,  0,  0,  0,  1,  0,  0,  0,152,246, 20,  6,  0,  0,  0,  0, 24, 87, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 83, 82, 83, 99,114,105,112,116,105,110,103,  0,103, 46, 48, 48, 49,  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,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,120,168, 20,  6,  0,  0,  0,  0, 40,174, 20,  6,  0,  0,  0,  0,152,174, 20,  6,  0,  0,  0,  0,200,183, 20,  6,
+  0,  0,  0,  0, 56,184, 20,  6,  0,  0,  0,  0, 72,239, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,120,168, 20,  6,
+  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,232,168, 20,  6,  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, 68, 65, 84, 65, 32,  0,  0,  0,232,168, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,
+  1,  0,  0,  0, 88,169, 20,  6,  0,  0,  0,  0,120,168, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  4,
+  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 88,169, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,200,169, 20,  6,
+  0,  0,  0,  0,232,168, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,  5,  4,  0,  0,  0,  0, 68, 65, 84, 65,
+ 32,  0,  0,  0,200,169, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0, 56,170, 20,  6,  0,  0,  0,  0, 88,169, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 56,170, 20,  6,
+  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,168,170, 20,  6,  0,  0,  0,  0,200,169, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,168,  3,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,168,170, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,
+  1,  0,  0,  0, 24,171, 20,  6,  0,  0,  0,  0, 56,170, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,168,  3,
+  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 24,171, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,136,171, 20,  6,
+  0,  0,  0,  0,168,170, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  5,168,  3,  0,  0,  0,  0, 68, 65, 84, 65,
+ 32,  0,  0,  0,136,171, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,248,171, 20,  6,  0,  0,  0,  0, 24,171, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  5,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,248,171, 20,  6,
+  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,104,172, 20,  6,  0,  0,  0,  0,136,171, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,104,  1,  1,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,104,172, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,
+  1,  0,  0,  0,216,172, 20,  6,  0,  0,  0,  0,248,171, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  5,104,  1,
+  1,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,216,172, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0, 72,173, 20,  6,
+  0,  0,  0,  0,104,172, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,248,  2,104,  1,  1,  0,  0,  0, 68, 65, 84, 65,
+ 32,  0,  0,  0, 72,173, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,184,173, 20,  6,  0,  0,  0,  0,216,172, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  5,236,  2,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,184,173, 20,  6,
+  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0, 40,174, 20,  6,  0,  0,  0,  0, 72,173, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,126,  7,236,  2,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 40,174, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,184,173, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,248,  2,168,  3,
+  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,152,174, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,  8,175, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232,168, 20,  6,  0,  0,  0,  0, 88,169, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,  8,175, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,120,175, 20,  6,
+  0,  0,  0,  0,152,174, 20,  6,  0,  0,  0,  0,232,168, 20,  6,  0,  0,  0,  0, 56,170, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,120,175, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,232,175, 20,  6,
+  0,  0,  0,  0,  8,175, 20,  6,  0,  0,  0,  0, 88,169, 20,  6,  0,  0,  0,  0,168,170, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,232,175, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 88,176, 20,  6,
+  0,  0,  0,  0,120,175, 20,  6,  0,  0,  0,  0, 56,170, 20,  6,  0,  0,  0,  0,168,170, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 88,176, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,200,176, 20,  6,
+  0,  0,  0,  0,232,175, 20,  6,  0,  0,  0,  0,168,170, 20,  6,  0,  0,  0,  0, 24,171, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,200,176, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 56,177, 20,  6,
+  0,  0,  0,  0, 88,176, 20,  6,  0,  0,  0,  0,200,169, 20,  6,  0,  0,  0,  0,136,171, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 56,177, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,168,177, 20,  6,
+  0,  0,  0,  0,200,176, 20,  6,  0,  0,  0,  0,120,168, 20,  6,  0,  0,  0,  0,248,171, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,168,177, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 24,178, 20,  6,
+  0,  0,  0,  0, 56,177, 20,  6,  0,  0,  0,  0, 56,170, 20,  6,  0,  0,  0,  0,248,171, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 24,178, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,136,178, 20,  6,
+  0,  0,  0,  0,168,177, 20,  6,  0,  0,  0,  0, 24,171, 20,  6,  0,  0,  0,  0,104,172, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,136,178, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,248,178, 20,  6,
+  0,  0,  0,  0, 24,178, 20,  6,  0,  0,  0,  0,136,171, 20,  6,  0,  0,  0,  0,104,172, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,248,178, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,104,179, 20,  6,
+  0,  0,  0,  0,136,178, 20,  6,  0,  0,  0,  0,248,171, 20,  6,  0,  0,  0,  0,216,172, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,104,179, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,216,179, 20,  6,
+  0,  0,  0,  0,248,178, 20,  6,  0,  0,  0,  0,104,172, 20,  6,  0,  0,  0,  0,216,172, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,216,179, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 72,180, 20,  6,
+  0,  0,  0,  0,104,179, 20,  6,  0,  0,  0,  0,136,171, 20,  6,  0,  0,  0,  0, 72,173, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 72,180, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,184,180, 20,  6,
+  0,  0,  0,  0,216,179, 20,  6,  0,  0,  0,  0, 24,171, 20,  6,  0,  0,  0,  0, 72,173, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,184,180, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 40,181, 20,  6,
+  0,  0,  0,  0, 72,180, 20,  6,  0,  0,  0,  0,168,170, 20,  6,  0,  0,  0,  0,184,173, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 40,181, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,152,181, 20,  6,
+  0,  0,  0,  0,184,180, 20,  6,  0,  0,  0,  0,200,169, 20,  6,  0,  0,  0,  0,184,173, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,152,181, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,  8,182, 20,  6,
+  0,  0,  0,  0, 40,181, 20,  6,  0,  0,  0,  0, 72,173, 20,  6,  0,  0,  0,  0,184,173, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,  8,182, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,120,182, 20,  6,
+  0,  0,  0,  0,152,181, 20,  6,  0,  0,  0,  0, 56,170, 20,  6,  0,  0,  0,  0, 40,174, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,120,182, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,232,182, 20,  6,
+  0,  0,  0,  0,  8,182, 20,  6,  0,  0,  0,  0, 24,171, 20,  6,  0,  0,  0,  0, 40,174, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,232,182, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 88,183, 20,  6,
+  0,  0,  0,  0,120,182, 20,  6,  0,  0,  0,  0,216,172, 20,  6,  0,  0,  0,  0, 40,174, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 88,183, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,200,183, 20,  6,
+  0,  0,  0,  0,232,182, 20,  6,  0,  0,  0,  0,248,171, 20,  6,  0,  0,  0,  0,104,172, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,200,183, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 88,183, 20,  6,  0,  0,  0,  0,120,168, 20,  6,  0,  0,  0,  0,136,171, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0, 56,184, 20,  6,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,  8,188, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 56,170, 20,  6,  0,  0,  0,  0,232,168, 20,  6,  0,  0,  0,  0, 88,169, 20,  6,
+  0,  0,  0,  0,168,170, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,  0,  0,169,  3,  0,  0,
+  5,  4,  0,  0,  7,  7,127,  7, 93,  0,  1,  0,  0,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,246, 20,  6,
+  0,  0,  0,  0,  8,246, 20,  6,  0,  0,  0,  0, 40,185, 20,  6,  0,  0,  0,  0,152,186, 20,  6,  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, 68, 65, 84, 65,
+ 40,  1,  0,  0, 40,185, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,152,186, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0, 32,148, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,224,239, 68,  0,  0,  0,  0,
+  0,  0,208, 65,  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,126,  7,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,192,239, 68,  0,  0,200, 65,  0,192,239, 68,
+  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,127,  7, 26,  0,127,  7,
+ 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,  0,  0,236,  3,  0,  0,
+  5,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,127,  7, 26,  0,  0,  0,  1,  0,  1,  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,  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, 68, 65, 84, 65,
+ 40,  1,  0,  0,152,186, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40,185, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,192,239, 68,  0,  0,  0,  0,  0,  0, 28, 66,  0,  0,  0,  0,  0,192,237, 68,  0,  0,  0,  0,
+  0,  0,134, 66,110,  7,  0,  0,127,  7,  0,  0,  0,  0,  0,  0, 66,  0,  0,  0,  0,  0,  0,  0,111,  7,  0,  0,  0,  0,  0,  0,
+ 17,  0,  0,  0,  0,  0,  0,  0,109,  7,  0,  0,  0,  0,  0,  0, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  2,  2,  0,  0,  1,  0,  3,  3,  2,  0,  0,  4, 10,  0,127,  7, 67,  0,110,  7,
+ 67,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,  0,  0,169,  3,  0,  0,
+235,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,127,  7, 67,  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,  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,  0, 68, 65, 84, 65,
+160,  0,  0,  0,  8,188, 20,  6,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,152,212, 20,  6,  0,  0,  0,  0, 56,184, 20,  6,
+  0,  0,  0,  0,136,171, 20,  6,  0,  0,  0,  0, 72,173, 20,  6,  0,  0,  0,  0,184,173, 20,  6,  0,  0,  0,  0,200,169, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,241,  5,  0,  0,126,  7,  0,  0,  0,  0,  0,  0,235,  2,  0,  0,  4,  4,142,  1,
+236,  2,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 88,211, 20,  6,  0,  0,  0,  0, 88,211, 20,  6,
+  0,  0,  0,  0,248,188, 20,  6,  0,  0,  0,  0,104,190, 20,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0,248,188, 20,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,104,190, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,148, 67,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,  0,199, 67,  0,  0,  0,  0,  0,  0,208, 65,  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,
+141,  1,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,128,198, 67,  0,  0,200, 65,  0,128,198, 67,  0,  0,200, 65,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,142,  1, 26,  0,142,  1, 26,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,241,  5,  0,  0,126,  7,  0,  0,210,  2,  0,  0,235,  2,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,142,  1, 26,  0,  0,  0,  1,  0,  1,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,104,190, 20,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,248,188, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,128,198, 67,  0,  0, 61,196,  0,  0,  0,  0,  0,  0,  0,  0,254,127,190, 67,254,127, 52,196,  0,  0,  0,  0,125,  1,  0,  0,
+142,  1,  0,  0,  0,  0,  0,  0,209,  2,  0,  0,  0,  0,  0,  0,126,  1,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,
+124,  1,  0,  0,  0,  0,  0,  0,209,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,
+  0,  0,  0, 64, 10,  1,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,142,  1,210,  2,125,  1,210,  2,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,241,  5,  0,  0,126,  7,  0,  0,  0,  0,  0,  0,209,  2,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,142,  1,210,  2,  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,  0,  0,216,191, 20,  6,  0,  0,  0,  0,184,209, 20,  6,  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, 68, 65, 84, 65, 88,  1,  0,  0,216,191, 20,  6,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,120,193, 20,  6,  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, 66, 85, 84, 84, 79, 78, 83, 95, 80, 84, 95, 99,111,110,116,101,120,116,  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, 66, 85, 84, 84, 79, 78, 83, 95, 80, 84, 95, 99,111,110,116,101,120,116,  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, 67,111,110,116,101,120,116,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,220,255,124,  1, 36,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 88,  1,  0,  0,120,193, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0, 24,195, 20,  6,
+  0,  0,  0,  0,216,191, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,114,101,110,100,101,114,  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, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,114,101,110,100,101,114,  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, 82,101,110,100,
+101,114,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,135,255,
+124,  1, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0, 24,195, 20,  6,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,184,196, 20,  6,  0,  0,  0,  0,120,193, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,108, 97,121,101,114,115,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,108, 97,121,101,114,115,  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, 76, 97,121,101,114,115,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,111,255,124,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+  2,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,184,196, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0, 88,198, 20,  6,
+  0,  0,  0,  0, 24,195, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,100,105,109,101,110,115,105,111,110,115,  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, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,100,105,109,101,110,115,105,111,110,115,  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, 68,105,109,101,
+110,115,105,111,110,115,  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,  0,  0,  0,  0,  0,  0,140,254,
+124,  1,203,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0, 88,198, 20,  6,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,248,199, 20,  6,  0,  0,  0,  0,184,196, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 97,110,116,105, 97,108,105, 97,115,105,
+110,103,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95, 97,110,116,105, 97,108,105, 97,115,105,
+110,103,  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, 65,110,116,105, 45, 65,108,105, 97,115,105,110,103,  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,  0,  0,  0, 58,254,124,  1, 58,  0, 20,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  4,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,248,199, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,152,201, 20,  6,
+  0,  0,  0,  0, 88,198, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,109,111,116,105,111,110, 95, 98,108,117,114,  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, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,109,111,116,105,111,110, 95, 98,108,117,114,  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, 83, 97,109,112,
+108,101,100, 32, 77,111,116,105,111,110, 32, 66,108,117,114,  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, 34,254,
+124,  1,  0,  0, 20,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  5,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,152,201, 20,  6,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0, 56,203, 20,  6,  0,  0,  0,  0,248,199, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,104, 97,100,105,110,103,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,115,104, 97,100,105,110,103,  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, 83,104, 97,100,105,110,103,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,254,124,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+  6,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0, 56,203, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,216,204, 20,  6,
+  0,  0,  0,  0,152,201, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,112,101,114,102,111,114,109, 97,110, 99,101,  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, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,112,101,114,102,111,114,109, 97,110, 99,101,  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, 80,101,114,102,
+111,114,109, 97,110, 99,101,  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,  0,  0,  0,  0,  0,242,253,
+124,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  7,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,216,204, 20,  6,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,120,206, 20,  6,  0,  0,  0,  0, 56,203, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,111,115,116, 95,112,114,111, 99,101,
+115,115,105,110,103,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,112,111,115,116, 95,112,114,111, 99,101,
+115,115,105,110,103,  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, 80,111,115,116, 32, 80,114,111, 99,101,115,115,105,110,103,  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,  0,218,253,124,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+  8,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,120,206, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0, 24,208, 20,  6,
+  0,  0,  0,  0,216,204, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,115,116, 97,109,112,  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, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95,115,116, 97,109,112,  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, 83,116, 97,109,
+112,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,194,253,
+124,  1,  0,  0, 20,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  9,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0, 24,208, 20,  6,
+  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,184,209, 20,  6,  0,  0,  0,  0,120,206, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,111,117,116,112,117,116,  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, 82, 69, 78, 68, 69, 82, 95, 80, 84, 95,111,117,116,112,117,116,  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, 79,117,116,112,117,116,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40,253,124,  1,130,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 10,  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,  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, 68, 65, 84, 65, 88,  1,  0,  0,184,209, 20,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 24,208, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95, 98, 97,107,101,  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, 82, 69, 78, 68,
+ 69, 82, 95, 80, 84, 95, 98, 97,107,101,  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, 66, 97,107,101,
   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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16,253,
+124,  1,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 11,  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,  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, 68, 65, 84, 65,248,  0,  0,  0, 88,211, 20,  6,
+  0,  0,  0,  0,179,  0,  0,  0,  1,  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,  4,  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,  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,  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,  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,  2,  0,  1,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,255, 21,  0,  0,160,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0,152,212, 20,  6,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0, 40,226, 20,  6,
+  0,  0,  0,  0,  8,188, 20,  6,  0,  0,  0,  0,216,172, 20,  6,  0,  0,  0,  0, 40,174, 20,  6,  0,  0,  0,  0, 24,171, 20,  6,
+  0,  0,  0,  0,104,172, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,249,  2,  0,  0,239,  5,  0,  0,105,  1,  0,  0,
+167,  3,  0,  0,  1,  1,247,  2, 63,  2,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,120,224, 20,  6,
+  0,  0,  0,  0,120,224, 20,  6,  0,  0,  0,  0,136,213, 20,  6,  0,  0,  0,  0, 72,219, 20,  6,  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, 68, 65, 84, 65,
+ 40,  1,  0,  0,136,213, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,248,214, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0, 64,113, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,192, 61, 68,  0,  0,  0,  0,
+  0,  0,208, 65,  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,246,  2,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,128, 61, 68,  0,  0,200, 65,  0,128, 61, 68,
+  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,247,  2, 26,  0,247,  2,
+ 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,249,  2,  0,  0,239,  5,  0,  0,105,  1,  0,  0,
+130,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,247,  2, 26,  0,  0,  0,  1,  0,  2,  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,  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, 68, 65, 84, 65,
+ 40,  1,  0,  0,248,214, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,104,216, 20,  6,  0,  0,  0,  0,136,213, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 15, 67,  0, 64, 70,196,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 15, 67,255,127, 70,196,
+  0,  0,  0,  0,143,  0,  0,  0,160,  0,  0,  0, 18,  0,  0,  0, 43,  3,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  0,
+ 17,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0, 18,  0,  0,  0, 43,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  0,  0,  0,  1,  0,  7,  0, 18,  0,  0,  0,  6,  0,160,  0, 44,  3,143,  0,
+ 26,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,249,  2,  0,  0,249,  2,  0,  0,131,  1,  0,  0,
+167,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0, 37,  2,  0,  0,  5,  0,  3,  0,  1,  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,  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, 68, 65, 84, 65,
+ 40,  1,  0,  0,104,216, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,216,217, 20,  6,  0,  0,  0,  0,248,214, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16, 67,  0,  0,206,194,  0,  0,  0,  0,  0,  0,  0,  0,231,102, 16, 67,  0,  0,206,194,
+  0,  0,  0,  0,143,  0,  0,  0,160,  0,  0,  0, 18,  0,  0,  0,119,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  0,
+ 17,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0, 18,  0,  0,  0,119,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  0,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,160,  0,120,  0,143,  0,
+102,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,249,  2,  0,  0,239,  5,  0,  0,131,  1,  0,  0,
+131,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  6,  0, 34,  0,  2,  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,  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, 68, 65, 84, 65,
+ 40,  1,  0,  0,216,217, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0, 72,219, 20,  6,  0,  0,  0,  0,104,216, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 35, 67,  0,128,142,196,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 35, 67,  0,  0, 26,196,
+  0,  0,  0,  0,163,  0,  0,  0,180,  0,  0,  0, 18,  0,  0,  0,121,  2,  0,  0,  0,  0,  0,  0,162,  0,  0,  0,  0,  0,  0,  0,
+ 17,  0,  0,  0,  0,  0,  0,  0,162,  0,  0,  0, 18,  0,  0,  0,121,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  0,  0,  0,  1,  0,  7,  0, 18,  0,  0,  0,  6,  0,180,  0,122,  2,163,  0,
+104,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,239,  5,  0,  0,239,  5,  0,  0,131,  1,  0,  0,
+167,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  4,  0,  4,  0,  1,  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,  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, 68, 65, 84, 65,
+ 40,  1,  0,  0, 72,219, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,216,217, 20,  6,
   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,  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,  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,249,  2,  0,  0,239,  5,  0,  0,131,  1,  0,  0,
+167,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,247,  2, 37,  2,  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,  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,184,220, 20,  6,  0,  0,  0,  0, 68, 65, 84, 65,
+112,  3,  0,  0,184,220, 20,  6,  0,  0,  0,  0,173,  0,  0,  0,  1,  0,  0,  0,  0,  0,140, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 74,141,193, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 80,  1,128,191,
+  0,  0,128,191,  0,  0,  0,  0,  0,  0,  0,  0,225,215,163,188,  0,  0,  0,  0, 68,239,209, 62, 51,177,205,190,184,158, 81, 63,
+  0,  0,  0,  0, 70,119,105, 63,143, 74, 70, 62, 35, 44,185,190,  0,  0,  0,  0,162, 84, 89,188,166, 33,101, 63, 42, 61,228, 62,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,214,211,111,193,  0,  0,128, 63, 69,239,209, 62, 70,119,105, 63,176, 84, 89,188,
+  0,  0,  0,  0, 53,177,205,190,142, 74, 70, 62,166, 33,101, 63,  0,  0,  0,  0,185,158, 81, 63, 35, 44,185,190, 43, 61,228, 62,
+  0,  0,  0,  0,164, 96, 68, 65,111,121,173,192,248,209,213, 64,  0,  0,128, 63,178,157,229, 62, 30,132, 27,191,222,160, 81,191,
+184,158, 81,191,117, 90,127, 63,166,235,149, 62,  9, 46,185, 62, 35, 44,185, 62,145,180,109,188,212, 60,173, 63,129, 63,228,190,
+ 42, 61,228,190,  0,  0,  0,  0,  0,  0,  0,  0, 96,132,111, 65,214,211,111, 65,217,236,191, 62, 54,117, 85, 63,224,246, 70,188,
+  0,160, 32,182,252,  5,136,190, 43, 33,  3, 62,235,135, 23, 63,  0,  0, 96, 53,215,104, 25,196,133,132,135, 67, 37,  9,167,195,
+136,252, 71,194,  3, 54, 25, 68,158, 87,135,195,205,209,166, 67,151,254, 71, 66, 68,239,209, 62, 51,177,205,190,184,158, 81, 63,
+  0,  0,  0,  0, 70,119,105, 63,143, 74, 70, 62, 35, 44,185,190,  0,  0,  0,  0,162, 84, 89,188,166, 33,101, 63, 42, 61,228, 62,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,214,211,111,193,  0,  0,128, 63,178,157,229, 62, 30,132, 27,191,222,160, 81,191,
+184,158, 81,191,117, 90,127, 63,166,235,149, 62,  9, 46,185, 62, 35, 44,185, 62,145,180,109,188,212, 60,173, 63,129, 63,228,190,
+ 42, 61,228,190,  0,  0,  0,  0,  0,  0,  0,  0, 96,132,111, 65,214,211,111, 65,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -5219,15 +4410,57 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 46, 86, 45, 64,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 46, 86, 45, 64,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 46, 86, 45, 64,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63, 92, 62, 55, 63, 56,186,224,190,237,203,148,190,
+  3,236,234,190,214,211,111, 65,214,211,111, 65,  0,  0,  0,  0,  0,  0,  0,  0,107,227, 29, 59,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  1,  0,  0,255,255,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63, 30, 33, 12, 66, 86,152,137, 66,116, 27,126, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 96,  1,  0,  0,120,224, 20,  6,  0,  0,  0,  0,174,  0,  0,  0,  1,  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,  1,  0,  0,  0,
+ 51, 51, 51, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0, 32, 65,205,204, 76, 62,  2,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  7,  0,104,139, 21,  6,
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  3,  0,  0,  0,  1,  0,  3,  0,  8,  8,128,  0,
+  0,  0, 12, 66,  0,  0,128, 63, 10,215, 35, 60,  0,  0,250, 67,  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, 16,  0, 10,  0,  7,  1,  0,  3,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+160,  0,  0,  0, 40,226, 20,  6,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,136,232, 20,  6,  0,  0,  0,  0,152,212, 20,  6,
+  0,  0,  0,  0,120,168, 20,  6,  0,  0,  0,  0,248,171, 20,  6,  0,  0,  0,  0,104,172, 20,  6,  0,  0,  0,  0,136,171, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,239,  5,  0,  0,  0,  0,  0,  0,103,  1,  0,  0, 18, 18,240,  5,
+104,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,184,230, 20,  6,  0,  0,  0,  0,184,230, 20,  6,
+  0,  0,  0,  0, 24,227, 20,  6,  0,  0,  0,  0,136,228, 20,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0, 24,227, 20,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,136,228, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,128,160, 67,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,  0,190, 68,  0,  0,  0,  0,  0,  0,208, 65,  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,
+239,  5,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,224,189, 68,  0,  0,200, 65,  0,224,189, 68,  0,  0,200, 65,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,240,  5, 26,  0,240,  5, 26,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,239,  5,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  5, 26,  0,  0,  0,  1,  0,  2,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,136,228, 20,  6,
+  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24,227, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,224,189, 68,  0,  0,  0,  0,  0,  0, 51, 67,  0,  0,  0,  0,  0,224,187, 68,  0,  0,  0,  0,  0,  0,167, 67,223,  5,  0,  0,
+240,  5,  0,  0,  0,  0,  0,  0, 77,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+222,  5,  0,  0,  0,  0,  0,  0, 77,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  2,  2,  0,  0,  1,  0,  3,  3,  2,  0,  0,  4, 10,  0,240,  5, 78,  1,223,  5, 78,  1,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,239,  5,  0,  0, 26,  0,  0,  0,103,  1,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  5, 78,  1,  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,  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, 68, 65, 84, 65, 40,  0,  0,  0,248,229, 20,  6,
+  0,  0,  0,  0,193,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,104,230, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0,104,230, 20,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,136,  1,  0,  0,184,230, 20,  6,  0,  0,  0,  0,
+194,  0,  0,  0,  1,  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, 18,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 14,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,248,229, 20,  6,  0,  0,  0,  0,
+248,229, 20,  6,  0,  0,  0,  0, 62, 62, 62, 32,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -5235,15 +4468,83 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,112,121,116,104,111,110,  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,  8,  4,  0,  0,  8,  4,  0,  0, 68, 65, 84, 65,160,  0,  0,  0,136,232, 20,  6,  0,  0,  0,  0,
+214,  0,  0,  0,  1,  0,  0,  0, 72,239, 20,  6,  0,  0,  0,  0, 40,226, 20,  6,  0,  0,  0,  0, 72,173, 20,  6,  0,  0,  0,  0,
+ 24,171, 20,  6,  0,  0,  0,  0,168,170, 20,  6,  0,  0,  0,  0,184,173, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+241,  5,  0,  0,126,  7,  0,  0,237,  2,  0,  0,167,  3,  0,  0,  3,  3,142,  1,187,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 88,236, 20,  6,  0,  0,  0,  0, 88,236, 20,  6,  0,  0,  0,  0,120,233, 20,  6,  0,  0,  0,  0,
+232,234, 20,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0,120,233, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,
+232,234, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,244, 67,  0,  0,  0,  0,  0,  0,208, 65,
+  0,  0,  0,  0,  0,  0,199, 67,  0,  0,  0,  0,  0,  0,208, 65,  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,141,  1,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,
+  0,128,198, 67,  0,  0,200, 65,  0,128,198, 67,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,
+  4,  0, 12,  0, 10,  0,142,  1, 26,  0,142,  1, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+241,  5,  0,  0,126,  7,  0,  0,237,  2,  0,  0,  6,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+142,  1, 26,  0,  0,  0,  1,  0,  2,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,232,234, 20,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,120,233, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,141, 67,  0,  0,244,194,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,128,190, 67,  0,  0, 15,195,  0,  0,  0,  0,125,  1,  0,  0,142,  1,  0,  0, 18,  0,  0,  0,160,  0,  0,  0,
+  0,  0,  0,  0,124,  1,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,124,  1,  0,  0, 18,  0,  0,  0,160,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63, 18,  6,  0,  0,  2,  0,  3,  3,
+  0,  0, 12,  4,  6,  0,142,  1,161,  0,125,  1,143,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+241,  5,  0,  0,126,  7,  0,  0,  7,  3,  0,  0,167,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+142,  1,161,  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,  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,  0, 68, 65, 84, 65, 24,  1,  0,  0, 88,236, 20,  6,  0,  0,  0,  0,183,  0,  0,  0,  1,  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,
+  3,  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,  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,  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,  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,184,237, 20,  6,  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,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 68, 65, 84, 65, 16,  0,  0,  0,
+184,237, 20,  6,  0,  0,  0,  0,237,  0,  0,  0,  1,  0,  0,  0, 14,  0,  0,  0, 14,  0,  0,  0, 24,238, 20,  6,  0,  0,  0,  0,
+ 68, 65, 84, 65,224,  0,  0,  0, 24,238, 20,  6,  0,  0,  0,  0,236,  0,  0,  0, 14,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,
+  8,110, 21,  6,  0,  0,  0,  0, 19,  0,  0,  0,  1,  0,  1,  0,  8,110, 21,  6,  0,  0,  0,  0, 20,  0,  0,  0,  1,  0,  1,  0,
+  8,110, 21,  6,  0,  0,  0,  0, 21,  0,  1,  0,  1,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
+152,136, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  8,146, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
+168,200, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,232,159, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
+248,181, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0, 72,153, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
+216,131, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,104,139, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,
+200,130, 21,  6,  0,  0,  0,  0, 21,  0,  0,  0,  1,  0,  1,  0,  8,110, 21,  6,  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0,
+ 72,239, 20,  6,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,136,232, 20,  6,  0,  0,  0,  0,
+248,171, 20,  6,  0,  0,  0,  0, 56,170, 20,  6,  0,  0,  0,  0, 40,174, 20,  6,  0,  0,  0,  0,216,172, 20,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,247,  2,  0,  0,105,  1,  0,  0,167,  3,  0,  0,  9,  9,248,  2, 63,  2,  1,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24,243, 20,  6,  0,  0,  0,  0, 24,243, 20,  6,  0,  0,  0,  0,
+ 56,240, 20,  6,  0,  0,  0,  0,168,241, 20,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0, 56,240, 20,  6,  0,  0,  0,  0,
+215,  0,  0,  0,  1,  0,  0,  0,168,241, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,230, 67,
+  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,  0, 62, 68,  0,  0,  0,  0,  0,  0,208, 65,  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,247,  2,  0,  0,
+  0,  0,  0,  0, 25,  0,  0,  0,  0,192, 61, 68,  0,  0,200, 65,  0,192, 61, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,248,  2, 26,  0,248,  2, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,247,  2,  0,  0,105,  1,  0,  0,130,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,248,  2, 26,  0,  0,  0,  1,  0,  2,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,168,241, 20,  6,  0,  0,  0,  0,
+215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 56,240, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,224,189, 68,
+  0,  0,  0,  0,  0,192, 22, 68,248,150, 23, 68,  8, 41,100, 68, 46,224, 62, 67,233, 15,206, 67,  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,247,  2,  0,  0,
+  0,  0,  0,  0, 36,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,215, 35, 60,  0,  0,122, 68,
+  0,  0,  0,  0,  1,  0,  3,  0,  0,  0,  0,  4, 10,  0,248,  2, 37,  2,248,  2, 37,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,247,  2,  0,  0,131,  1,  0,  0,167,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,248,  2, 37,  2,  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,  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, 68, 65, 84, 65,160,  2,  0,  0, 24,243, 20,  6,  0,  0,  0,  0,
+186,  0,  0,  0,  1,  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,  9,  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, 32,  0,  0,  0,  0,  0,  0,  0, 12,  0,  7,  0,  0,  0,  0,  0,  1,  0,  0,  0,
+  4,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,205,204,204, 61,231,  1,  0,  0,243,  1,  0,  0,122,  1,  0,  0,124,  1,  0,  0,
+231,  1,  0,  0,243,  1,  0,  0,  4,  0,  0,  0,124,  1,  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,
   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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -5260,28 +4561,130 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0, 83, 78,  0,  0,  8,  1,  0,  0,152,246, 20,  6,  0,  0,  0,  0,210,  0,  0,  0,  1,  0,  0,  0,
+184, 61, 21,  6,  0,  0,  0,  0, 40,167, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 83, 82, 85, 86, 32, 69,100,105,116,105,110,103,  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,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232,247, 20,  6,  0,  0,  0,  0,
+248,250, 20,  6,  0,  0,  0,  0,104,251, 20,  6,  0,  0,  0,  0,200,255, 20,  6,  0,  0,  0,  0, 56,  0, 21,  6,  0,  0,  0,  0,
+ 88, 44, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  6,  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,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,232,247, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,
+ 88,248, 20,  6,  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,
+ 68, 65, 84, 65, 32,  0,  0,  0, 88,248, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,200,248, 20,  6,  0,  0,  0,  0,
+232,247, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  4,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,
+200,248, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0, 56,249, 20,  6,  0,  0,  0,  0, 88,248, 20,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,126,  7,  5,  4,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 56,249, 20,  6,  0,  0,  0,  0,
+211,  0,  0,  0,  1,  0,  0,  0,168,249, 20,  6,  0,  0,  0,  0,200,248, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+126,  7,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,168,249, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,
+ 24,250, 20,  6,  0,  0,  0,  0, 56,249, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,234,  3,  1,  0,  0,  0,
+ 68, 65, 84, 65, 32,  0,  0,  0, 24,250, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,136,250, 20,  6,  0,  0,  0,  0,
+168,249, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,234,  3,  1,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,
+136,250, 20,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,248,250, 20,  6,  0,  0,  0,  0, 24,250, 20,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,200,  3,234,  3,  1,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,248,250, 20,  6,  0,  0,  0,  0,
+211,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,136,250, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+200,  3,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,104,251, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,
+216,251, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 88,248, 20,  6,  0,  0,  0,  0,200,248, 20,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,216,251, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,
+ 72,252, 20,  6,  0,  0,  0,  0,104,251, 20,  6,  0,  0,  0,  0, 88,248, 20,  6,  0,  0,  0,  0,168,249, 20,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 72,252, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,
+184,252, 20,  6,  0,  0,  0,  0,216,251, 20,  6,  0,  0,  0,  0,200,248, 20,  6,  0,  0,  0,  0, 24,250, 20,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,184,252, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,
+ 40,253, 20,  6,  0,  0,  0,  0, 72,252, 20,  6,  0,  0,  0,  0,168,249, 20,  6,  0,  0,  0,  0, 24,250, 20,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 40,253, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,
+152,253, 20,  6,  0,  0,  0,  0,184,252, 20,  6,  0,  0,  0,  0,168,249, 20,  6,  0,  0,  0,  0,136,250, 20,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,152,253, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,
+  8,254, 20,  6,  0,  0,  0,  0, 40,253, 20,  6,  0,  0,  0,  0,232,247, 20,  6,  0,  0,  0,  0,248,250, 20,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,  8,254, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,
+120,254, 20,  6,  0,  0,  0,  0,152,253, 20,  6,  0,  0,  0,  0,232,247, 20,  6,  0,  0,  0,  0,168,249, 20,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,120,254, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,
+232,254, 20,  6,  0,  0,  0,  0,  8,254, 20,  6,  0,  0,  0,  0,136,250, 20,  6,  0,  0,  0,  0,248,250, 20,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,232,254, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,
+ 88,255, 20,  6,  0,  0,  0,  0,120,254, 20,  6,  0,  0,  0,  0, 24,250, 20,  6,  0,  0,  0,  0,136,250, 20,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0, 88,255, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,
+200,255, 20,  6,  0,  0,  0,  0,232,254, 20,  6,  0,  0,  0,  0, 56,249, 20,  6,  0,  0,  0,  0,248,250, 20,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,200,255, 20,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 88,255, 20,  6,  0,  0,  0,  0, 56,249, 20,  6,  0,  0,  0,  0, 24,250, 20,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0, 56,  0, 21,  6,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,
+  8,  4, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,168,249, 20,  6,  0,  0,  0,  0, 88,248, 20,  6,  0,  0,  0,  0,
+200,248, 20,  6,  0,  0,  0,  0, 24,250, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,  0,  0,
+235,  3,  0,  0,  5,  4,  0,  0,  7,  7,127,  7, 27,  0,  1,  0,  0,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 40, 61, 21,  6,  0,  0,  0,  0, 40, 61, 21,  6,  0,  0,  0,  0, 40,  1, 21,  6,  0,  0,  0,  0,152,  2, 21,  6,  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,
+ 68, 65, 84, 65, 40,  1,  0,  0, 40,  1, 21,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,152,  2, 21,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32,148, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,224,239, 68,
+  0,  0,  0,  0,  0,  0,208, 65,  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,126,  7,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,192,239, 68,  0,  0,200, 65,
+  0,192,239, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,127,  7,
+ 26,  0,127,  7, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,  0,  0,
+235,  3,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,127,  7, 26,  0,  0,  0,  1,  0,
+  2,  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,  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,
+ 68, 65, 84, 65, 40,  1,  0,  0,152,  2, 21,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 40,  1, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,109, 69,  0,  0,128,192,  0,  0,  0,  0,  0,  0,  0,  0,255,255,109, 69,
+  0,  0,  0,192,  0,  0,  0,  0,112,  7,  0,  0,129,  7,  0,  0, 18,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,111,  7,  0,  0,
+  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,111,  7,  0,  0, 18,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  2,  0,  0,  0,  1,  0,  3,  3,  2,  0,  0,  4, 10,  0,129,  7,
+  2,  0,112,  7,  1,  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,
+  5,  4,  0,  0,  5,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  2,  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,  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,
+ 68, 65, 84, 65,160,  0,  0,  0,  8,  4, 21,  6,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0, 88, 44, 21,  6,  0,  0,  0,  0,
+ 56,  0, 21,  6,  0,  0,  0,  0,232,247, 20,  6,  0,  0,  0,  0,168,249, 20,  6,  0,  0,  0,  0,136,250, 20,  6,  0,  0,  0,  0,
+248,250, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,199,  3,  0,  0,  0,  0,  0,  0,233,  3,  0,  0,
+  6,  6,200,  3,234,  3,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232, 10, 21,  6,  0,  0,  0,  0,
+232, 10, 21,  6,  0,  0,  0,  0,248,  4, 21,  6,  0,  0,  0,  0,120,  9, 21,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0,
+248,  4, 21,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,104,  6, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,215, 67,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,  0,114, 68,  0,  0,  0,  0,  0,  0,208, 65,
   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,199,  3,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,192,113, 68,  0,  0,200, 65,  0,192,113, 68,  0,  0,200, 65,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,200,  3, 26,  0,200,  3, 26,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,199,  3,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200,  3, 26,  0,  0,  0,  1,  0,  2,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,
+104,  6, 21,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,120,  9, 21,  6,  0,  0,  0,  0,248,  4, 21,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0, 91, 67,  0,192,115,196,  0,  0,  0,  0,  0,  0,  0,  0,254,255, 74, 67,254,255,115,196,  0,  0,  0,  0,
+203,  0,  0,  0,220,  0,  0,  0,  0,  0,  0,  0,207,  3,  0,  0,  0,  0,  0,  0,202,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,
+  0,  0,  0,  0,202,  0,  0,  0,  0,  0,  0,  0,207,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0, 63,  0,  0,  0, 64, 10,  3,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,220,  0,208,  3,203,  0,208,  3,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,219,  0,  0,  0, 26,  0,  0,  0,233,  3,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,220,  0,208,  3,  0,  0,  4,  0,  3,  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,216,  7, 21,  6,  0,  0,  0,  0,216,  7, 21,  6,  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, 68, 65, 84, 65, 88,  1,  0,  0,
+216,  7, 21,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  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, 73, 77, 65, 71, 69, 95, 80, 84, 95,103,112,101,110, 99,105,108,
   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, 73, 77, 65, 71, 69, 95, 80, 84, 95,103,112,101,110, 99,105,108,
   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, 71,114,101, 97,115,101, 32, 80,101,110, 99,105,108,  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,  0,  0,  0,152,255,202,  0, 80,  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,  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,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0,120,  9, 21,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,104,  6, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 67,
+ 51, 51, 43,191,154,153,213, 63, 51, 51,131,191,154,153,  1, 64,  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,236,  2,  0,  0,  0,  0,  0,  0,208,  3,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+220,  0,  0,  0,199,  3,  0,  0, 26,  0,  0,  0,233,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+236,  2,208,  3,  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,  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, 68, 65, 84, 65, 40, 33,  0,  0,232, 10, 21,  6,  0,  0,  0,  0,184,  0,  0,  0,  1,  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,
+  6,  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,100,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  1,  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,240, 65,  0,  0,  0,  0,154,153,153, 62,  0,  0,  0,  0,100,  0,  0,  0,
+154,153,153, 62,100,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -5410,6 +4813,7 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  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,  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,  0,  0,  0,  0,  0,  0,  0,
@@ -5539,27 +4943,102 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,100,  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,160, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0, 88, 44, 21,  6,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  8,  4, 21,  6,  0,  0,  0,  0,248,250, 20,  6,  0,  0,  0,  0,136,250, 20,  6,  0,  0,  0,  0,
+ 24,250, 20,  6,  0,  0,  0,  0, 56,249, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,201,  3,  0,  0,126,  7,  0,  0,
+  0,  0,  0,  0,233,  3,  0,  0,  1,  1,182,  3,234,  3,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+120, 59, 21,  6,  0,  0,  0,  0,120, 59, 21,  6,  0,  0,  0,  0, 72, 45, 21,  6,  0,  0,  0,  0, 72, 54, 21,  6,  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,
+ 68, 65, 84, 65, 40,  1,  0,  0, 72, 45, 21,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,184, 46, 21,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64,113, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,128,109, 68,
+  0,  0,  0,  0,  0,  0,208, 65,  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,181,  3,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0, 64,109, 68,  0,  0,200, 65,
+  0, 64,109, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,182,  3,
+ 26,  0,182,  3, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,201,  3,  0,  0,126,  7,  0,  0,
+  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,182,  3, 26,  0,  0,  0,  1,  0,
+  2,  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,  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,
+ 68, 65, 84, 65, 40,  1,  0,  0,184, 46, 21,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,200, 49, 21,  6,  0,  0,  0,  0,
+ 72, 45, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 67,  0,  0, 86,196,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 15, 67,
+  0,  0, 86,196,  0,  0,  0,  0,143,  0,  0,  0,160,  0,  0,  0,  0,  0,  0,  0, 87,  3,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,
+  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  0, 87,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  3,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,160,  0,
+ 88,  3,143,  0, 88,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,201,  3,  0,  0,104,  4,  0,  0,
+146,  0,  0,  0,233,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,160,  0, 88,  3,  0,  0,  5,  0,
+  3,  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, 40, 48, 21,  6,  0,  0,  0,  0, 40, 48, 21,  6,  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,
+ 68, 65, 84, 65, 88,  1,  0,  0, 40, 48, 21,  6,  0,  0,  0,  0,213,  0,  0,  0,  1,  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, 86, 73, 69, 87, 51, 68, 95, 80,
+ 84, 95,116,111,111,108,115, 95,111, 98,106,101, 99,116,109,111,100,101,  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, 86, 73, 69, 87, 51, 68, 95, 80,
+ 84, 95,116,111,111,108,115, 95,111, 98,106,101, 99,116,109,111,100,101,  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, 79, 98,106,101, 99,116, 32, 84,
+111,111,108,115,  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,  0,  0,  0,  0,233,253,143,  0,255,  1,
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  1,  0,  0,200, 49, 21,  6,  0,  0,  0,  0,
+215,  0,  0,  0,  1,  0,  0,  0,216, 52, 21,  6,  0,  0,  0,  0,184, 46, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 33, 67,
+  0,  0,242,194,  0,  0,  0,  0,  0,  0,  0,  0,231,102, 16, 67, 91, 90,242,194,  0,  0,  0,  0,143,  0,  0,  0,160,  0,  0,  0,
+  0,  0,  0,  0,119,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,142,  0,  0,  0,
+  0,  0,  0,  0,119,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64,
+ 10,  3,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,160,  0,120,  0,143,  0,120,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,201,  3,  0,  0,104,  4,  0,  0, 26,  0,  0,  0,145,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,160,  0,120,  0,  0,  0,  6,  0, 34,  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,
+ 56, 51, 21,  6,  0,  0,  0,  0, 56, 51, 21,  6,  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, 68, 65, 84, 65, 88,  1,  0,  0, 56, 51, 21,  6,  0,  0,  0,  0,
+213,  0,  0,  0,  1,  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, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,108, 97,115,116, 95,111,112,101,114, 97,116,111,114,  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, 86, 73, 69, 87, 51, 68, 95, 80, 84, 95,108, 97,115,116, 95,111,112,101,114, 97,116,111,114,  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, 79,112,101,114, 97,116,111,114,  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,  0,  0,  0,  0,  0,  0,  0,  0,216,255,144,  0, 16,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  1,  0,  0,216, 52, 21,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0, 72, 54, 21,  6,  0,  0,  0,  0,
+200, 49, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 35, 67,  0,128,126,196,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 35, 67,
+255,191,126,196,  0,  0,  0,  0,163,  0,  0,  0,180,  0,  0,  0, 18,  0,  0,  0, 12,  4,  0,  0,  0,  0,  0,  0,162,  0,  0,  0,
+  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,162,  0,  0,  0, 18,  0,  0,  0, 12,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64, 10,  0,  0,  0,  1,  0,  7,  0, 18,  0,  0,  0,  6,  0,180,  0,
+ 13,  4,163,  0,251,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,126,  7,  0,  0,126,  7,  0,  0,
+ 26,  0,  0,  0,233,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  4,  0,
+  4,  0,  1,  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,  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,
+ 68, 65, 84, 65, 40,  1,  0,  0, 72, 54, 21,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+216, 52, 21,  6,  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,  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,  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,105,  4,  0,  0,126,  7,  0,  0,
+ 26,  0,  0,  0,233,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 22,  3,208,  3,  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,  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,184, 55, 21,  6,  0,  0,  0,  0,
+ 68, 65, 84, 65,112,  3,  0,  0,184, 55, 21,  6,  0,  0,  0,  0,173,  0,  0,  0,  1,  0,  0,  0, 72,246,172, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,140, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 28, 13,128,191,  0,  0,128,191,  0,  0,  0,  0,  0,  0,  0,  0, 74,215, 76,190,  0,  0,  0,  0, 68,239,209, 62, 51,177,205,190,
+184,158, 81, 63,  0,  0,  0,  0, 70,119,105, 63,143, 74, 70, 62, 35, 44,185,190,  0,  0,  0,  0,162, 84, 89,188,166, 33,101, 63,
+ 42, 61,228, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 25, 95,192,  0,  0,128, 63, 69,239,209, 62, 70,119,105, 63,
+160, 84, 89,188,  0,  0,  0,  0, 52,177,205,190,142, 74, 70, 62,166, 33,101, 63,  0,  0,  0,  0,185,158, 81, 63, 35, 44,185,190,
+ 43, 61,228, 62,  0,  0,  0,  0,188,173, 54, 64,136, 95,161,191,147,231,198, 63,  0,  0,128, 63,185,214, 13, 63,208,249,224,190,
+ 48,180, 81,191,184,158, 81,191,189,188,157, 63,140,225, 88, 62, 26, 63,185, 62, 35, 44,185, 62,241,213,146,188,206,156,122, 63,
+138, 84,228,190, 42, 61,228,190,  0,  0,  0,  0,  0,  0,  0,  0,100, 98, 82, 64,  0, 25, 95, 64,121, 92,155, 62,151,198, 44, 63,
+192,214, 32,188,  0,  0, 40,180,195, 15,188,190,132, 75, 53, 62,216,125, 81, 63,  0,  0,192,179,115, 77,100,193, 17,173,201, 64,
+181,148,248,192,203,247,159,192,233, 74, 87, 65,247, 46,190,192, 88,106,234, 64, 45,  8,160, 64, 68,239,209, 62, 51,177,205,190,
+184,158, 81, 63,  0,  0,  0,  0, 70,119,105, 63,143, 74, 70, 62, 35, 44,185,190,  0,  0,  0,  0,162, 84, 89,188,166, 33,101, 63,
+ 42, 61,228, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 25, 95,192,  0,  0,128, 63,185,214, 13, 63,208,249,224,190,
+ 48,180, 81,191,184,158, 81,191,189,188,157, 63,140,225, 88, 62, 26, 63,185, 62, 35, 44,185, 62,241,213,146,188,206,156,122, 63,
+138, 84,228,190, 42, 61,228,190,  0,  0,  0,  0,  0,  0,  0,  0,100, 98, 82, 64,  0, 25, 95, 64,  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,  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,  0,  0,  0,  0,
@@ -5567,77 +5046,339 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,248,201,250, 62,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,248,201,250, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+248,201,250, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63, 92, 62, 55, 63, 56,186,224,190,
+237,203,148,190,  3,236,234,190,  0, 25, 95, 64,  0, 25, 95, 64,  0,  0,  0,  0,  0,  0,  0,  0,114,145,245, 58,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  1,  0,  0,255,255,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63, 30, 33, 12, 66, 85,152,137, 66,116, 27,126, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 96,  1,  0,  0,120, 59, 21,  6,  0,  0,  0,  0,174,  0,  0,  0,  1,  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,
+  1,  0,  0,  0, 51, 51, 51, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 65,205,204, 76, 62,  2,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  7,  0,
+104,139, 21,  6,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  3,  0,  0,  0,  1,  0,  3,  0,
+  8,  8,128,  0,  0,  0, 12, 66,  0,  0,128, 63,205,204,204, 61,  0,  0,250, 67,  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, 16,  0, 10,  0,  7,  1,  0,  3,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 83, 78,  0,  0,  8,  1,  0,  0,184, 61, 21,  6,  0,  0,  0,  0,210,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+152,246, 20,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 83, 82, 86,105,100,101,111, 32,
+ 69,100,105,116,105,110,103,  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,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8, 63, 21,  6,  0,  0,  0,  0,216, 67, 21,  6,  0,  0,  0,  0,
+ 72, 68, 21,  6,  0,  0,  0,  0,184, 75, 21,  6,  0,  0,  0,  0, 40, 76, 21,  6,  0,  0,  0,  0,136,101, 21,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,110, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,
+ 68, 65, 84, 65, 32,  0,  0,  0,  8, 63, 21,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,120, 63, 21,  6,  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, 68, 65, 84, 65, 32,  0,  0,  0,
+120, 63, 21,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,232, 63, 21,  6,  0,  0,  0,  0,  8, 63, 21,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,222,  2,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,232, 63, 21,  6,  0,  0,  0,  0,
+211,  0,  0,  0,  1,  0,  0,  0, 88, 64, 21,  6,  0,  0,  0,  0,120, 63, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+240,  4,222,  2,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 88, 64, 21,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,
+200, 64, 21,  6,  0,  0,  0,  0,232, 63, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  4,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 32,  0,  0,  0,200, 64, 21,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0, 56, 65, 21,  6,  0,  0,  0,  0,
+ 88, 64, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,195,  2,  1,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,
+ 56, 65, 21,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,168, 65, 21,  6,  0,  0,  0,  0,200, 64, 21,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,240,  4,195,  2,  1,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,168, 65, 21,  6,  0,  0,  0,  0,
+211,  0,  0,  0,  1,  0,  0,  0, 24, 66, 21,  6,  0,  0,  0,  0, 56, 65, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+240,  4, 92,  1,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0, 24, 66, 21,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,
+136, 66, 21,  6,  0,  0,  0,  0,168, 65, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 32,  0,  0,  0,136, 66, 21,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,248, 66, 21,  6,  0,  0,  0,  0,
+ 24, 66, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 48,  2,195,  2,  1,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,
+248, 66, 21,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,104, 67, 21,  6,  0,  0,  0,  0,136, 66, 21,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 92,  1,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,104, 67, 21,  6,  0,  0,  0,  0,
+211,  0,  0,  0,  1,  0,  0,  0,216, 67, 21,  6,  0,  0,  0,  0,248, 66, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 48,  2, 92,  1,  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,216, 67, 21,  6,  0,  0,  0,  0,211,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,104, 67, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  4, 68,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0, 72, 68, 21,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,184, 68, 21,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,120, 63, 21,  6,  0,  0,  0,  0,232, 63, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0,184, 68, 21,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 40, 69, 21,  6,  0,  0,  0,  0,
+ 72, 68, 21,  6,  0,  0,  0,  0,120, 63, 21,  6,  0,  0,  0,  0,200, 64, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0, 40, 69, 21,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,152, 69, 21,  6,  0,  0,  0,  0,
+184, 68, 21,  6,  0,  0,  0,  0,232, 63, 21,  6,  0,  0,  0,  0, 56, 65, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0,152, 69, 21,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,  8, 70, 21,  6,  0,  0,  0,  0,
+ 40, 69, 21,  6,  0,  0,  0,  0,200, 64, 21,  6,  0,  0,  0,  0, 56, 65, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0,  8, 70, 21,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,120, 70, 21,  6,  0,  0,  0,  0,
+152, 69, 21,  6,  0,  0,  0,  0, 56, 65, 21,  6,  0,  0,  0,  0,168, 65, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0,120, 70, 21,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,232, 70, 21,  6,  0,  0,  0,  0,
+  8, 70, 21,  6,  0,  0,  0,  0,  8, 63, 21,  6,  0,  0,  0,  0, 24, 66, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0,232, 70, 21,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 88, 71, 21,  6,  0,  0,  0,  0,
+120, 70, 21,  6,  0,  0,  0,  0,200, 64, 21,  6,  0,  0,  0,  0,136, 66, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0, 88, 71, 21,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,200, 71, 21,  6,  0,  0,  0,  0,
+232, 70, 21,  6,  0,  0,  0,  0, 24, 66, 21,  6,  0,  0,  0,  0,248, 66, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0,200, 71, 21,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 56, 72, 21,  6,  0,  0,  0,  0,
+ 88, 71, 21,  6,  0,  0,  0,  0,248, 66, 21,  6,  0,  0,  0,  0,104, 67, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0, 56, 72, 21,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,168, 72, 21,  6,  0,  0,  0,  0,
+200, 71, 21,  6,  0,  0,  0,  0,136, 66, 21,  6,  0,  0,  0,  0,104, 67, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0,168, 72, 21,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 24, 73, 21,  6,  0,  0,  0,  0,
+ 56, 72, 21,  6,  0,  0,  0,  0,168, 65, 21,  6,  0,  0,  0,  0,216, 67, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0, 24, 73, 21,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,136, 73, 21,  6,  0,  0,  0,  0,
+168, 72, 21,  6,  0,  0,  0,  0, 88, 64, 21,  6,  0,  0,  0,  0,216, 67, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0,136, 73, 21,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,248, 73, 21,  6,  0,  0,  0,  0,
+ 24, 73, 21,  6,  0,  0,  0,  0, 24, 66, 21,  6,  0,  0,  0,  0,216, 67, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0,248, 73, 21,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,104, 74, 21,  6,  0,  0,  0,  0,
+136, 73, 21,  6,  0,  0,  0,  0,  8, 63, 21,  6,  0,  0,  0,  0, 88, 64, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0,104, 74, 21,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,216, 74, 21,  6,  0,  0,  0,  0,
+248, 73, 21,  6,  0,  0,  0,  0, 56, 65, 21,  6,  0,  0,  0,  0,136, 66, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0,216, 74, 21,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0, 72, 75, 21,  6,  0,  0,  0,  0,
+104, 74, 21,  6,  0,  0,  0,  0,168, 65, 21,  6,  0,  0,  0,  0,104, 67, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0, 72, 75, 21,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,184, 75, 21,  6,  0,  0,  0,  0,
+216, 74, 21,  6,  0,  0,  0,  0,200, 64, 21,  6,  0,  0,  0,  0,248, 66, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0,184, 75, 21,  6,  0,  0,  0,  0,212,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 72, 75, 21,  6,  0,  0,  0,  0,168, 65, 21,  6,  0,  0,  0,  0,248, 66, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,160,  0,  0,  0, 40, 76, 21,  6,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,248, 79, 21,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,200, 64, 21,  6,  0,  0,  0,  0,120, 63, 21,  6,  0,  0,  0,  0,232, 63, 21,  6,  0,  0,  0,  0,
+ 56, 65, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  4,  0,  0,196,  2,  0,  0,222,  2,  0,  0,
+  7,  7,241,  4, 27,  0,  1,  0,  0,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,120,109, 21,  6,  0,  0,  0,  0,
+120,109, 21,  6,  0,  0,  0,  0, 24, 77, 21,  6,  0,  0,  0,  0,136, 78, 21,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0,
+ 24, 77, 21,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,136, 78, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,128,148, 68,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0, 32,158, 68,  0,  0,  0,  0,  0,  0,208, 65,
   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,240,  4,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,158, 68,  0,  0,200, 65,  0,  0,158, 68,  0,  0,200, 65,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,241,  4, 26,  0,241,  4, 26,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  4,  0,  0,196,  2,  0,  0,221,  2,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,241,  4, 26,  0,  0,  0,  1,  0,  2,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,
+136, 78, 21,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24, 77, 21,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,240,109, 69,  0,  0,128,192,  0,  0,  0,  0,  0,  0,  0,  0,255,255,109, 69,  0,  0,  0,192,  0,  0,  0,  0,
+112,  7,  0,  0,129,  7,  0,  0, 18,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,111,  7,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,
+  0,  0,  0,  0,111,  7,  0,  0, 18,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  2,  0,  0,  0,  1,  0,  3,  3,  2,  0,  0,  4, 10,  0,129,  7,  2,  0,112,  7,  1,  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,222,  2,  0,  0,222,  2,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  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,  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, 68, 65, 84, 65,160,  0,  0,  0,
+248, 79, 21,  6,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,232, 84, 21,  6,  0,  0,  0,  0, 40, 76, 21,  6,  0,  0,  0,  0,
+  8, 63, 21,  6,  0,  0,  0,  0, 24, 66, 21,  6,  0,  0,  0,  0,216, 67, 21,  6,  0,  0,  0,  0, 88, 64, 21,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  4,  0,  0,  0,  0,  0,  0, 67,  0,  0,  0, 15, 15,241,  4, 68,  0,  1,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 83, 21,  6,  0,  0,  0,  0,200, 83, 21,  6,  0,  0,  0,  0,
+232, 80, 21,  6,  0,  0,  0,  0, 88, 82, 21,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0,232, 80, 21,  6,  0,  0,  0,  0,
+215,  0,  0,  0,  1,  0,  0,  0, 88, 82, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32,140, 68,
+  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0, 32,158, 68,  0,  0,  0,  0,  0,  0,208, 65,  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,240,  4,  0,  0,
+  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,158, 68,  0,  0,200, 65,  0,  0,158, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,241,  4, 26,  0,241,  4, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  4,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,241,  4, 26,  0,  0,  0,  1,  0,  2,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0, 88, 82, 21,  6,  0,  0,  0,  0,
+215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232, 80, 21,  6,  0,  0,  0,  0,  0,  0, 64,192,  0,  0,126, 67,
+  0,  0,  0,  0,  0,  0, 72, 66,112,189, 17,192,246, 70,125, 67,  0,  0,  0,  0,  0,  0, 72, 66,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  4,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,240,  4,  0,  0,
+ 18,  0,  0,  0, 41,  0,  0,  0,  0,  0,128, 63,  0,  0, 72, 66,  0,124,146, 72,  0,  0, 72, 66,205,204,204, 61,  0,  0, 32, 65,
+ 72,  0,  0,  0,  0,  0,  0,  2,  4,  0,  0,  4,  8,  0,241,  4, 42,  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,240,  4,  0,  0, 26,  0,  0,  0, 67,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,241,  4, 42,  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,  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,  0, 68, 65, 84, 65,208,  0,  0,  0,200, 83, 21,  6,  0,  0,  0,  0,
+190,  0,  0,  0,  1,  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, 15,  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,  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,  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,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 31,  0,  0,  0,  1,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0,
+232, 84, 21,  6,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,216, 92, 21,  6,  0,  0,  0,  0,248, 79, 21,  6,  0,  0,  0,  0,
+ 24, 66, 21,  6,  0,  0,  0,  0,248, 66, 21,  6,  0,  0,  0,  0,168, 65, 21,  6,  0,  0,  0,  0,216, 67, 21,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  4,  0,  0, 69,  0,  0,  0, 91,  1,  0,  0,  8,  8,241,  4, 23,  1,  1,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,152, 91, 21,  6,  0,  0,  0,  0,152, 91, 21,  6,  0,  0,  0,  0,
+216, 85, 21,  6,  0,  0,  0,  0, 40, 90, 21,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0,216, 85, 21,  6,  0,  0,  0,  0,
+215,  0,  0,  0,  1,  0,  0,  0, 72, 87, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 26, 68,
+  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0, 32,158, 68,  0,  0,  0,  0,  0,  0,208, 65,  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,240,  4,  0,  0,
+  0,  0,  0,  0, 25,  0,  0,  0,  0,  0,158, 68,  0,  0,200, 65,  0,  0,158, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,241,  4, 26,  0,241,  4, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,240,  4,  0,  0, 69,  0,  0,  0, 94,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,241,  4, 26,  0,  0,  0,  1,  0,  2,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0, 72, 87, 21,  6,  0,  0,  0,  0,
+215,  0,  0,  0,  1,  0,  0,  0,184, 88, 21,  6,  0,  0,  0,  0,216, 85, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 92, 67,
+  0,  0,125,195,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 75, 67,  1,  0,125,195,  0,  0,  0,  0,203,  0,  0,  0,220,  0,  0,  0,
+  0,  0,  0,  0,252,  0,  0,  0,  0,  0,  0,  0,202,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,202,  0,  0,  0,
+  0,  0,  0,  0,252,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 64,
+ 10,  3,  0,  0,  1,  0,  7,  0, 18,  0,  0,  4,  6,  0,220,  0,253,  0,203,  0,253,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 21,  4,  0,  0,240,  4,  0,  0, 95,  0,  0,  0, 91,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,220,  0,253,  0,  0,  0,  4,  0,  4,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,184, 88, 21,  6,  0,  0,  0,  0,
+215,  0,  0,  0,  1,  0,  0,  0, 40, 90, 21,  6,  0,  0,  0,  0, 72, 87, 21,  6,  0,  0,  0,  0,  0,  0,112,196,  0,  0,112, 68,
+  0,  0,  7,196,  0,  0,  7, 68,  0,  0,112,196,  0,  0,112, 68,  0,  0,  7,196,  0,  0,  7, 68,  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,  0,  0,  0,  0,  0,  0,  0,128, 59, 70,  0,128, 59, 70,172,197, 39, 55,  0, 80,195, 71,
+  0,  0,  0,  0,  0,  0,  6,  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, 20,  4,  0,  0, 91,  1,  0,  0, 91,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  7,  0,  1,  0,  1,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0, 40, 90, 21,  6,  0,  0,  0,  0,
+215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,184, 88, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,122, 67,
+  0,  0,  0,  0,  0,  0,  0, 65,  0,  0,  0,  0,  0,  0,122, 67,  0,  0,  0,  0,  0,  0,  0, 65,  0,  0,  0,  0, 17,  0,  0,  0,
+ 18,  0,  0,  0,252,  0,  0,  0, 18,  0,  0,  0, 20,  4,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0, 18,  0,  0,  0, 20,  4,  0,  0,
+ 18,  0,  0,  0,252,  0,  0,  0,  0,  0, 32, 65,  0,  0,  0, 63,  0,124,146, 72,  0,  0,  0, 66, 10,215, 35, 60,  0,  0,200, 66,
+105,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  8,  0, 21,  4,253,  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, 20,  4,  0,  0, 95,  0,  0,  0, 91,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 21,  4,253,  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,  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,  0, 68, 65, 84, 65,240,  0,  0,  0,152, 91, 21,  6,  0,  0,  0,  0,
+180,  0,  0,  0,  1,  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,  8,  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,  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,  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,  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,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0,
+216, 92, 21,  6,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,136,101, 21,  6,  0,  0,  0,  0,232, 84, 21,  6,  0,  0,  0,  0,
+248, 66, 21,  6,  0,  0,  0,  0,200, 64, 21,  6,  0,  0,  0,  0,136, 66, 21,  6,  0,  0,  0,  0,104, 67, 21,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 47,  2,  0,  0, 93,  1,  0,  0,194,  2,  0,  0,  2,  2, 48,  2,102,  1,  1,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,136, 99, 21,  6,  0,  0,  0,  0,136, 99, 21,  6,  0,  0,  0,  0,
+200, 93, 21,  6,  0,  0,  0,  0, 24, 98, 21,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0,200, 93, 21,  6,  0,  0,  0,  0,
+215,  0,  0,  0,  1,  0,  0,  0, 56, 95, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64, 89, 68,
+  0,  0,  0,  0,  0,  0,208, 65,154,216, 65, 55,  0,  0, 12, 68,  0,  0,  0,  0,  0,  0,208, 65,  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, 47,  2,  0,  0,
+  0,  0,  0,  0, 25,  0,  0,  0,  0,192, 11, 68,  0,  0,200, 65,  0,192, 11, 68,  0,  0,200, 65,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0, 48,  2, 26,  0, 48,  2, 26,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 47,  2,  0,  0, 93,  1,  0,  0,118,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 48,  2, 26,  0,  0,  0,  1,  0,  2,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0, 56, 95, 21,  6,  0,  0,  0,  0,
+215,  0,  0,  0,  1,  0,  0,  0,168, 96, 21,  6,  0,  0,  0,  0,200, 93, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72, 67,
+  0,  0,112,193,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72, 67,  0,  0,157,195,  0,  0,  0,  0,200,  0,  0,  0,217,  0,  0,  0,
+ 18,  0,  0,  0, 75,  1,  0,  0,  0,  0,  0,  0,199,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,199,  0,  0,  0,
+ 18,  0,  0,  0, 75,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+ 10,  6,  0,  0,  2,  0,  3,  3,  0,  0,  0,  4,  6,  0,217,  0, 76,  1,200,  0, 58,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,216,  0,  0,  0,119,  1,  0,  0,194,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,217,  0, 76,  1,  0,  0,  2,  0,  3,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,168, 96, 21,  6,  0,  0,  0,  0,
+215,  0,  0,  0,  1,  0,  0,  0, 24, 98, 21,  6,  0,  0,  0,  0, 56, 95, 21,  6,  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,  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,  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, 47,  2,  0,  0, 47,  2,  0,  0,119,  1,  0,  0,194,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  4,  0,  4,  0,  1,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0, 24, 98, 21,  6,  0,  0,  0,  0,
+215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,168, 96, 21,  6,  0,  0,  0,  0,  0,  0, 16,193,  0,  0,130, 67,
+  0,  0,160,192,  0,  0,160, 64,  0,  0,  0,  0,  0,  0,122, 67,  0,  0, 16,193,  0,  0, 32, 65,  0,  0,  0,  0, 17,  0,  0,  0,
+ 18,  0,  0,  0, 75,  1,  0,  0, 18,  0,  0,  0, 86,  1,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0, 18,  0,  0,  0, 86,  1,  0,  0,
+ 18,  0,  0,  0, 75,  1,  0,  0,111, 18,131, 58,111, 18,131, 58,  0,124,146, 72,  0, 80, 67, 71,  0,  0,  0,  0,  0,  0,  0,  0,
+105,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0, 87,  1, 76,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,217,  0,  0,  0, 47,  2,  0,  0,119,  1,  0,  0,194,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 87,  1, 76,  1,  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,  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, 68, 65, 84, 65,240,  0,  0,  0,136, 99, 21,  6,  0,  0,  0,  0,
+178,  0,  0,  0,  1,  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,  2,  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,  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,  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,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200,100, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,112,  0,  0,  0,
+200,100, 21,  6,  0,  0,  0,  0, 37,  1,  0,  0,  1,  0,  0,  0,  8,110, 21,  6,  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,  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,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65,160,  0,  0,  0,136,101, 21,  6,  0,  0,  0,  0,214,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+216, 92, 21,  6,  0,  0,  0,  0,104, 67, 21,  6,  0,  0,  0,  0,136, 66, 21,  6,  0,  0,  0,  0, 56, 65, 21,  6,  0,  0,  0,  0,
+168, 65, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 49,  2,  0,  0,240,  4,  0,  0, 93,  1,  0,  0,194,  2,  0,  0,
+  8,  8,192,  2,102,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 56,108, 21,  6,  0,  0,  0,  0,
+ 56,108, 21,  6,  0,  0,  0,  0,120,102, 21,  6,  0,  0,  0,  0,200,106, 21,  6,  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, 68, 65, 84, 65, 40,  1,  0,  0,
+120,102, 21,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,232,103, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,245, 67,  0,  0,  0,  0,  0,  0,208, 65,  0,  0,  0,  0,  0,  0, 48, 68,  0,  0,  0,  0,  0,  0,208, 65,
   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,191,  2,  0,  0,  0,  0,  0,  0, 25,  0,  0,  0,  0,192, 47, 68,  0,  0,200, 65,  0,192, 47, 68,  0,  0,200, 65,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  2,  0,  3,  3,  4,  0, 12,  0, 10,  0,192,  2, 26,  0,192,  2, 26,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 49,  2,  0,  0,240,  4,  0,  0, 93,  1,  0,  0,118,  1,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,192,  2, 26,  0,  0,  0,  1,  0,  2,  0,  0,  0,  0,  0,  0,  0,
+  0,  0, 26,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,
+232,103, 21,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0, 88,105, 21,  6,  0,  0,  0,  0,120,102, 21,  6,  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,  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,
   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,240,  4,  0,  0,240,  4,  0,  0,119,  1,  0,  0,194,  2,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  4,  0,  4,  0,  1,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,
+ 88,105, 21,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,200,106, 21,  6,  0,  0,  0,  0,232,103, 21,  6,  0,  0,  0,  0,
+  0,  0,240,195,  0,  0,240, 67,  0,  0,135,195,  0,  0,135, 67,238, 33,143,196,238, 33,143, 68,  0,  0,  7,196,  0,  0,  7, 68,
   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,191,  2,  0,  0,  0,  0,  0,  0, 75,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 59, 70,  0,128, 59, 70,
+172,197, 39, 55,  0, 80,195, 71,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  4,  0,  0,192,  2, 76,  1,192,  2, 76,  1,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 49,  2,  0,  0,240,  4,  0,  0,119,  1,  0,  0,194,  2,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,192,  2, 76,  1,  0,  0,  7,  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,  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, 68, 65, 84, 65, 40,  1,  0,  0,
+200,106, 21,  6,  0,  0,  0,  0,215,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 88,105, 21,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,122, 67,  0,  0,  0,  0,  0,  0,  0, 65,  0,  0,  0,  0,  0,  0,122, 67,  0,  0,  0,  0,  0,  0,  0, 65,
+  0,  0,  0,  0, 17,  0,  0,  0, 18,  0,  0,  0, 75,  1,  0,  0, 18,  0,  0,  0,201,  2,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,
+ 18,  0,  0,  0,201,  2,  0,  0, 18,  0,  0,  0, 75,  1,  0,  0,  0,  0, 32, 65,  0,  0,  0, 63,  0,124,146, 72,  0,  0,  0, 66,
+ 10,215, 35, 60,  0,  0,200, 66,105,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,  0,202,  2, 76,  1,  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,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  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,  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, 68, 65, 84, 65,240,  0,  0,  0,
+ 56,108, 21,  6,  0,  0,  0,  0,180,  0,  0,  0,  1,  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,  8,  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,  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,  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,  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,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 64,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 83, 67,  0,  0,216, 11,  0,  0,  8,110, 21,  6,  0,  0,  0,  0,171,  0,  0,  0,  1,  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, 83, 67, 83, 99,101,110,101,  0,
+116, 97,103,101,  0, 97,105,110,  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,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 40,122, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0,
+152,136, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,248,122, 21,  6,  0,  0,  0,  0,216,123, 21,  6,  0,  0,  0,  0,
+248,122, 21,  6,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 72,124, 21,  6,  0,  0,  0,  0,120,105, 34,109,161,127,  0,  0, 17,  2, 24,  0, 90, 90,  2,  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,  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,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,192,  0,  0,  0, 68,172,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  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,
+  1,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,100,  0,  0,  0,100,  0,  0,  0,
+  0,  0,  1,  0,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,  2,224,  1, 60,  0,
+ 32,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  6,  0, 50,  0,141,  0,128,  7, 56,  4,  8,  0,  8,  0, 24,  0, 17,  0,  0,  0,
+ 90,  0,  1,  0, 81,  0,  0,  0, 23,  0, 33,  0,  2,  0,  0,  0,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  8,  0, 24,  0, 10,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40,128, 21,  6,  0,  0,  0,  0, 40,128, 21,  6,  0,  0,  0,  0,
+  0,  0,  1,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  1,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  5,  0,  2,  0,  1,  0,  1,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 47,116,109,112, 47,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -5669,6 +5410,7 @@ char datatoc_startup_blend[]= {
   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,  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,
+ 31,  5,  0,  0, 12,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -5692,72 +5434,459 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,205,204, 76, 63,205,204, 76, 63,205,204, 76, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  0, 16,  0,  0,  0,128, 63,  0,  0,128, 63,
+173,  2, 95,  0,154,153,217, 63,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  1,  0,180,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 66, 76, 69, 78, 68, 69, 82, 95, 82, 69, 78, 68, 69, 82,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68,172,  0,  0,  0,  0,128, 63,102,166,171, 67,  0,  0,128, 63,  2,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  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, 32, 54, 18,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+208,205, 89,108,161,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,152,212, 21,  6,  0,  0,  0,  0,  1,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,  2,224,  1, 60,  0,
+ 32,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  1,  0,180,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  5,  0,205,204,204, 61,154,153,153, 62,205,204, 76, 62,219, 15, 73, 63,102,102,102, 63,
+  0,  0,  0, 64,154,153, 25, 63,  0,  0, 64, 65,102,102,166, 63,  0,  0,  0, 65,  0,  0,160, 65,  6,  0,  0,  0,  0,  0,192, 64,
+  0,  0,128, 63,  0,  0,  0,  0,205,204, 28, 65,  0,  0,  0,  0, 32,  0,  0,  0, 32,  0,  1,  0,128,  0,  5,  0,218,  0,  0,  0,
+ 60,  0,  5,  0,  1,  0,  5,  0,  0,  0,  0,  0,  0,  0,  0, 64,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,195,245, 28,193,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 25,  0,  0, 38,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,128,  0,  0,  0, 40,122, 21,  6,  0,  0,  0,  0,
+  9,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  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,  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,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,248,122, 21,  6,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0,
+104,123, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,216,  2,222,  1,
+  8,146, 21,  6,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,104,123, 21,  6,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0,
+216,123, 21,  6,  0,  0,  0,  0,248,122, 21,  6,  0,  0,  0,  0,  1,  0,  0,  0,  2,  0,  0,  0,  0,  4,  0,  0,173,  3, 35,  3,
+ 72,153, 21,  6,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,216,123, 21,  6,  0,  0,  0,  0,143,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,104,123, 21,  6,  0,  0,  0,  0,  1,  0,  0,  0,  3,  0,  0,  0,  0,  4,  0,  0,161,  0, 65,  2,
+104,139, 21,  6,  0,  0,  0,  0, 68, 65, 84, 65,232,  1,  0,  0, 72,124, 21,  6,  0,  0,  0,  0,167,  0,  0,  0,  1,  0,  0,  0,
+120,126, 21,  6,  0,  0,  0,  0,248,126, 21,  6,  0,  0,  0,  0,120,127, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  1,  0,  0,  0,205,204, 76, 63,  0,  0,180, 66,  9,  0,  1,  0,  0,  0,128, 63,111, 18,131, 58,205,204,204, 61,
+  0,  0,  1,  0, 32,  0, 32,  0, 32,  0,  1,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  1,  0,  1,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,255,255,255,128,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0, 80,  0,  0,  2,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  7,  0,  5,  0,  5,  0,255,255,
+ 50,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72, 66, 50,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,200, 66,
+ 50,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72, 66, 50,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72, 66,
+ 50,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72, 66, 50,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72, 66,
+ 50,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 62,  0,  0,  0,  0,
+  1,  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,128, 63, 10,215, 35, 60,205,204,204, 61,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,250,  0,205,204,204, 61,205,204,204, 61,
+102,102,166, 63,  0,  0,192, 63,  0,  0,240, 65, 72,225,122, 63,205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+ 67,  2,  0,  3,  2,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  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,  0, 17,  0,  0,  0, 35,  0,  0,  0,204,197,121, 63,  0,  0,  0, 63, 35,  0,  0,  0,204,197,121, 63,
+  0,  0,  0, 63, 17,  0,  0,  0, 68, 65, 84, 65, 56,  0,  0,  0,120,126, 21,  6,  0,  0,  0,  0,164,  0,  0,  0,  1,  0,  0,  0,
+136, 45, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,255,255,255,128,  1,  0,  0,  0, 18,  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, 68, 65, 84, 65, 56,  0,  0,  0,
+248,126, 21,  6,  0,  0,  0,  0,164,  0,  0,  0,  1,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+200,200,255,128,  1,  0,  0,  0,  2,  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, 68, 65, 84, 65, 96,  0,  0,  0,120,127, 21,  6,  0,  0,  0,  0,162,  0,  0,  0,  1,  0,  0,  0,
+120,158, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,255,100,100,128,  1,  0,  0,  0,128,  0,  0,  0,  1,  0,  0,  0,
+  1,  0,  0,  0,  1,  0,  0,  0,155,  9, 25, 67,190, 23,237, 64, 75,  1,147, 63,  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,
+ 68, 65, 84, 65,120,  0,  0,  0, 40,128, 21,  6,  0,  0,  0,  0,149,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 82,101,110,100,101,114, 76, 97,121,101,114,  0,114,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,255,255, 15,  0,  0,  0,  0,  0,
+255,127,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0, 67, 65,  0,  0,200,  0,  0,  0,200,130, 21,  6,  0,  0,  0,  0,
+ 22,  0,  0,  0,  1,  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, 67, 65, 67, 97,109,101,114, 97,  0, 97,109,101,114, 97, 46, 48, 48, 49,  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,  1,  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,  4,  0,  0,  0,  0, 63,205,204,204, 61,  0,  0,200, 66,  0,  0, 12, 66,161, 14,234, 64,
+  0,  0,  0, 63,  0,  0,  0, 66,  0,  0,144, 65,  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, 76, 65,  0,  0, 16,  2,  0,  0,216,131, 21,  6,  0,  0,  0,  0,
+ 36,  0,  0,  0,  1,  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, 76, 65, 76, 97,109,112,  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,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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, 32,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,247,255,239, 65,  0,  0,150, 66,
+154,153, 25, 62,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63, 56,134, 21,  6,  0,  0,  0,  0,  2,  0,  0,  0, 46, 26,128, 63,
+ 25,  4,240, 65,  0,  0, 52, 66,  0,  0,128, 63,  0,  0, 64, 64,205,204, 76, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 64, 11,  3,  0,  1,  0,  0,  0,  0,  2,  1,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+111, 18,131, 58,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 40,136, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 64,  1,  0,  0,
+ 56,134, 21,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  2,  0,  1,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,243,  4, 53,191,242,  4, 53, 63,242,  4, 53,191,243,  4, 53, 63,
+200,135, 21,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 24,  0,  0,  0,200,135, 21,  6,  0,  0,  0,  0,
+117,  1,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+ 68, 65, 84, 65, 40,  0,  0,  0, 40,136, 21,  6,  0,  0,  0,  0, 12,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 87, 79,  0,  0, 24,  2,  0,  0,152,136, 21,  6,  0,  0,  0,  0,142,  0,  0,  0,  1,  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, 87, 79, 87,111,114,108,100,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,
+114, 99, 80, 61,114, 99, 80, 61,114, 99, 80, 61,199, 54, 36, 60,199, 54, 36, 60,199, 54, 36, 60,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+205,204, 28, 65,  0,  0,  0,  0,  0,  0, 32,  0,128,  0,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,160, 64,
+  0,  0,200, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64,  0,  0,  0,  0,
+  0,  0,112, 65,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32, 65,  0,  0,  0,  0,  0,  0,128, 63,205,204, 76, 61,
+  0,  0,  5,  0,  0,  0,  0,  0, 10,215,163, 59,  0,  0,  0,  0,  0,  0,128, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  1,  0,  0,  0,  2,  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,  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,  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,  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,
+248,138, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 40,  0,  0,  0,248,138, 21,  6,  0,  0,  0,  0,
+ 12,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66,  0,  0,112,  5,  0,  0,104,139, 21,  6,  0,  0,  0,  0,
+129,  0,  0,  0,  1,  0,  0,  0,  8,146, 21,  6,  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, 79, 66, 67, 97,109,101,114, 97,  0, 97,109,101,114, 97, 46, 48, 48, 49,  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,  1,  0,  0,  4,  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, 11,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,200,130, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,
+  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,110,101,239, 64,150, 62,208,192, 78,255,170, 64,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 42,254,141, 63,192, 57, 49, 60, 34,159, 80, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,222,149, 47, 63, 53, 70, 58, 63,222, 56, 49,188,  0,  0,  0,  0, 86,126,162,190,227,251,159, 62,
+ 55, 53,101, 63,  0,  0,  0,  0,  7,165, 39, 63,149, 84, 28,191, 51,247,227, 62,  0,  0,  0,  0,110,101,239, 64,150, 62,208,192,
+ 78,255,170, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  1,  0,128, 63,  1,  0,128, 51,  1,  0,  0,179,  0,  0,  0,  0,  0,  0,  0, 51,  0,  0,128, 63,
+  1,  0,128, 51,  0,  0,  0,  0,  2,  0,  0,179,  2,  0,  0,167,  1,  0,128, 63,  0,  0,  0,  0,  1,  0,  0, 53,  1,  0,  0, 41,
+  1,  0,128,168,  0,  0,128, 63,221,149, 47, 63, 86,126,162,190,  8,165, 39, 63,  0,  0,  0,  0, 51, 70, 58, 63,225,251,159, 62,
+149, 84, 28,191,  0,  0,  0,  0,192, 56, 49,188, 55, 53,101, 63, 52,247,227, 62,  0,  0,  0,  0, 90, 38,173,190,  0,222,192,190,
+152,  9, 52,193,  0,  0,128, 63,  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,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  5,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,
+187,225, 16, 63,  0,  0,128, 63,205,204,204, 62,237, 54, 32, 63,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  2,  0,  1,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40,145, 21,  6,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  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,  0,  0,  0,  0,  0, 68, 65, 84, 65,152,  0,  0,  0,
+ 40,145, 21,  6,  0,  0,  0,  0,132,  0,  0,  0,  1,  0,  0,  0,  0,192,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  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,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,205,204,204, 61,205,204, 76, 62, 10,215,163, 60,  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,  2,  0,  0,  0, 79, 66,  0,  0,112,  5,  0,  0,  8,146, 21,  6,  0,  0,  0,  0,129,  0,  0,  0,  1,  0,  0,  0,
+ 72,153, 21,  6,  0,  0,  0,  0,104,139, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 79, 66, 67,117, 98,101,  0,112,104,101,114,101,  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,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  4,  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,  1,  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,  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,  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,168,122,142,109,161,127,  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,168,200, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0,
+ 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0,
+ 10,  0,  0,  0, 10,  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,  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,200,151, 21,  6,  0,  0,  0,  0, 24,152, 21,  6,  0,  0,  0,  0,  1,  0,  0,  0,  1,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  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,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
   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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0, 68,  0,  0,  0,  7,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,
+205,204,204, 62,229,208, 34, 62,  0,  0,  0,  0,143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,  0,  5,  0,  1,  0,  0,128, 63,  0,  0,128, 63,  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,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,104,152, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,120, 74, 34,109,161,127,  0,  0,
+ 56, 83, 34,109,161,127,  0,  0, 25,  0,  0, 38,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  0,  0,  0,  0, 68, 65, 84, 65,  8,  0,  0,  0,200,151, 21,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0, 24,152, 21,  6,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,152,  0,  0,  0,104,152, 21,  6,  0,  0,  0,  0,132,  0,  0,  0,
+  1,  0,  0,  0,  0,192,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
   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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,205,204,204, 61,
+205,204, 76, 62, 10,215,163, 60,  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, 72,  0,  0,  0, 79, 66,  0,  0,
+112,  5,  0,  0, 72,153, 21,  6,  0,  0,  0,  0,129,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,146, 21,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 79, 66, 76, 97,109,112,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  4,  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, 10,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,216,131, 21,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  1,  0,
+  0,  0,  0,  0,  0,  0,  1,  0,  6,  0,  0,  0,  1,  0,  0,  0,250,  0,  0,  0, 10,  0,  0,  0, 10,  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,  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,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,154,112,130, 64,183,178,128, 63,112,236,188, 64,
+  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,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,229,123, 38, 63,
+ 87, 43, 98, 61,229,229,238, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 54,236,148,190, 25,134,116, 63,236, 13, 98,189,
+  0,  0,  0,  0,221,102, 69,191, 57,174, 76,190, 34,194, 26, 63,  0,  0,  0,  0, 37,255, 16, 63,241,161, 95, 62,164,111, 75, 63,
+  0,  0,  0,  0,154,112,130, 64,183,178,128, 63,112,236,188, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  1,  0,128, 50,  0,  0,  0,179,
+  0,  0,  0,  0,  1,  0,128, 50,  1,  0,128, 63,  1,  0,  0, 51,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,  1,  0,  0, 39,  1,  0,  0, 52,  1,  0,128, 39,  0,  0,128, 63, 54,236,148,190,221,102, 69,191, 38,255, 16, 63,
+  0,  0,  0,  0, 24,134,116, 63, 57,174, 76,190,239,161, 95, 62,  0,  0,  0,  0,237, 13, 98,189, 35,194, 26, 63,166,111, 75, 63,
+  0,  0,  0,  0,209, 19, 13, 63,241, 65,102,190, 10, 10,231,192,  0,  0,128, 63,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,
+  0,  0,  0,  0,  5,  0,  1,  0,  0,  0, 68,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,100,  0,  0,  0,
+  0,  0,  0,  0, 56,180,150,201,  0,  0,128, 63,169, 19,208, 60,  0,  0,128, 63,205,204,204, 62,229,208, 34, 62,  0,  0,  0,  0,
+143,194,117, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  5,  0,  1,  0,  0,128, 63,
+  0,  0,128, 63,  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,  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, 64,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  8,159, 21,  6,  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,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,
+  0,  0,  0,  0, 68, 65, 84, 65,152,  0,  0,  0,  8,159, 21,  6,  0,  0,  0,  0,132,  0,  0,  0,  1,  0,  0,  0,  0,192,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,205,204,204, 61,205,204, 76, 62, 10,215,163, 60,
   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,  2,  0,  0,  0, 77, 65,  0,  0,128,  3,  0,  0,232,159, 21,  6,
+  0,  0,  0,  0, 39,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  8, 90,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 77, 65, 77, 97,116,101,114,105, 97,108,  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,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  1,  0,205,204, 76, 63,205,204, 76, 63,205,204, 76, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,205,204, 76, 63,  0,  0,  0, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 10,215, 35, 60,  0,  0,  0,  0,  0,  0,  8,  0,  1,  0, 50,  0,205,204, 76, 62,  0,  0,128, 63,  0,  0,128, 63,
+205,204, 76, 62, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,160, 63,  0,  0,  0,  0,
+  0,  0,160, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  2,  0,  2,  0, 50,  0,  0,  6,  0,  0,128, 63,  0,  0,128, 63,
+ 18,  0, 18,  0, 10,215,163, 59, 10,215,163, 59,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  4,  0, 67,  0, 64,  3, 67,  0, 64,  3,
+  1,  0,  4,  0, 12,  0,  4,  0,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  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,  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,128, 63,  0,  0,  0,  0,
+  0,  0,  1,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,128, 64,  0,  0,  0, 63,205,204,204, 61,
+  0,  0,  0, 63,205,204,204, 61,205,204,204, 61,  0,  0,128, 63,  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,128, 63,  0,  0,128, 63,184,163, 21,  6,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 56,165, 21,  6,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,111,148, 26, 63,111,148, 26, 63,111,148, 26, 63,205,204, 76, 61,205,204,204, 61,102,102,166, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 56,  1,  0,  0,184,163, 21,  6,  0,  0,  0,  0, 25,  0,  0,  0,
+  1,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,248,181, 21,  6,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  2,  3,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  1,  0,  0,
+  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65,
+ 40,  0,  0,  0, 56,165, 21,  6,  0,  0,  0,  0, 12,  0,  0,  0,  1,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0, 32,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  1,  0, 53,  0, 53,  0,168,165, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+  0, 16,  0,  0,168,165, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  0,  2,  2,  2, 51,  2,  2,  2, 51,  6,  6,  6,153,  6,  6,  6,153,  6,  6,  6,153,  4,  4,  4,102,  3,  3,  3,102,
+  2,  2,  2, 51,  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,  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,  3,  3,  3, 51,  8,  8,  8,153,
+ 11, 11, 11,204, 13, 13, 13,255, 12, 12, 12,255, 12, 12, 12,255, 11, 11, 11,255, 10, 10, 10,255, 10, 10, 10,255,  9,  9,  9,255,
+  9,  9,  9,255,  9,  9,  9,255,  4,  4,  4,102,  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,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  3,  3, 51, 10, 10, 10,153, 18, 18, 18,255, 20, 20, 20,255,
+ 22, 22, 22,255, 23, 23, 23,255, 22, 22, 22,255, 20, 20, 20,255, 19, 19, 19,255, 16, 16, 16,255, 14, 14, 14,255, 11, 11, 11,255,
+ 10, 10, 10,255,  9,  9,  9,255,  9,  9,  9,255,  9,  9,  9,255,  8,  8,  8,204,  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,  0,  0,  0,  0,  0,  0,  7,  7,  7,102, 19, 19, 19,204, 27, 27, 27,255, 31, 31, 31,255, 32, 32, 32,255,
+ 33, 33, 33,255, 33, 33, 33,255, 31, 31, 31,255, 30, 30, 30,255, 27, 27, 27,255, 25, 25, 25,255, 22, 22, 22,255, 19, 19, 19,255,
+ 16, 16, 16,255, 12, 12, 12,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  4,  4,  4,102,  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, 13, 13, 13,153, 29, 29, 29,255, 37, 37, 37,255, 40, 40, 40,255, 42, 42, 42,255, 42, 42, 42,255,
+ 43, 43, 43,255, 41, 41, 41,255, 40, 40, 40,255, 38, 38, 38,255, 36, 36, 36,255, 33, 33, 33,255, 30, 30, 30,255, 27, 27, 27,255,
+ 24, 24, 24,255, 20, 20, 20,255, 16, 16, 16,255, 12, 12, 12,255, 10, 10, 10,255, 10, 10, 10,255, 10, 10, 10,255,  7,  7,  7,153,
+  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, 13, 13, 13,102, 37, 37, 37,255, 44, 44, 44,255, 48, 48, 48,255, 50, 50, 50,255, 51, 51, 51,255, 51, 51, 51,255,
+ 50, 50, 50,255, 49, 49, 49,255, 48, 48, 48,255, 45, 45, 45,255, 43, 43, 43,255, 41, 41, 41,255, 37, 37, 37,255, 34, 34, 34,255,
+ 31, 31, 31,255, 28, 28, 28,255, 24, 24, 24,255, 20, 20, 20,255, 15, 15, 15,255, 11, 11, 11,255, 10, 10, 10,255, 11, 11, 11,255,
+  7,  7,  7,153,  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,
+ 13, 13, 13,102, 41, 41, 41,255, 50, 50, 50,255, 54, 54, 54,255, 57, 57, 57,255, 58, 58, 58,255, 59, 59, 59,255, 59, 59, 59,255,
+ 58, 58, 58,255, 57, 57, 57,255, 55, 55, 55,255, 53, 53, 53,255, 51, 51, 51,255, 48, 48, 48,255, 45, 45, 45,255, 41, 41, 41,255,
+ 38, 38, 38,255, 35, 35, 35,255, 31, 31, 31,255, 27, 27, 27,255, 23, 23, 23,255, 17, 17, 17,255, 12, 12, 12,255, 11, 11, 11,255,
+ 11, 11, 11,255,  5,  5,  5,102,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 36, 36, 36,204, 53, 53, 53,255, 59, 59, 59,255, 63, 63, 63,255, 65, 65, 65,255, 66, 66, 66,255, 66, 66, 66,255, 66, 66, 66,255,
+ 65, 65, 65,255, 64, 64, 64,255, 62, 62, 62,255, 60, 60, 60,255, 57, 57, 57,255, 54, 54, 54,255, 51, 51, 51,255, 48, 48, 48,255,
+ 44, 44, 44,255, 41, 41, 41,255, 37, 37, 37,255, 33, 33, 33,255, 29, 29, 29,255, 24, 24, 24,255, 19, 19, 19,255, 13, 13, 13,255,
+ 11, 11, 11,255, 12, 12, 12,255,  3,  3,  3, 51,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 19, 19, 19,102,
+ 56, 56, 56,255, 64, 64, 64,255, 68, 68, 68,255, 71, 71, 71,255, 73, 73, 73,255, 74, 74, 74,255, 74, 74, 74,255, 73, 73, 73,255,
+ 72, 72, 72,255, 71, 71, 71,255, 69, 69, 69,255, 67, 67, 67,255, 64, 64, 64,255, 61, 61, 61,255, 58, 58, 58,255, 54, 54, 54,255,
+ 50, 50, 50,255, 47, 47, 47,255, 43, 43, 43,255, 39, 39, 39,255, 34, 34, 34,255, 30, 30, 30,255, 25, 25, 25,255, 19, 19, 19,255,
+ 13, 13, 13,255, 12, 12, 12,255, 10, 10, 10,204,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 54, 54, 54,255,
+ 66, 66, 66,255, 72, 72, 72,255, 77, 77, 77,255, 79, 79, 79,255, 81, 81, 81,255, 81, 81, 81,255, 81, 81, 81,255, 80, 80, 80,255,
+ 79, 79, 79,255, 77, 77, 77,255, 75, 75, 75,255, 73, 73, 73,255, 70, 70, 70,255, 67, 67, 67,255, 63, 63, 63,255, 60, 60, 60,255,
+ 56, 56, 56,255, 52, 52, 52,255, 49, 49, 49,255, 44, 44, 44,255, 40, 40, 40,255, 35, 35, 35,255, 30, 30, 30,255, 24, 24, 24,255,
+ 18, 18, 18,255, 12, 12, 12,255, 12, 12, 12,255,  6,  6,  6,102,  0,  0,  0,  0,  0,  0,  0,  0, 22, 22, 22,102, 67, 67, 67,255,
+ 76, 76, 76,255, 81, 81, 81,255, 84, 84, 84,255, 87, 87, 87,255, 88, 88, 88,255, 88, 88, 88,255, 88, 88, 88,255, 87, 87, 87,255,
+ 86, 86, 86,255, 84, 84, 84,255, 82, 82, 82,255, 79, 79, 79,255, 76, 76, 76,255, 73, 73, 73,255, 69, 69, 69,255, 65, 65, 65,255,
+ 62, 62, 62,255, 58, 58, 58,255, 54, 54, 54,255, 49, 49, 49,255, 45, 45, 45,255, 40, 40, 40,255, 35, 35, 35,255, 29, 29, 29,255,
+ 23, 23, 23,255, 16, 16, 16,255, 12, 12, 12,255, 12, 12, 12,204,  0,  0,  0,  0,  0,  0,  0,  0, 49, 49, 49,204, 76, 76, 76,255,
+ 84, 84, 84,255, 89, 89, 89,255, 92, 92, 92,255, 94, 94, 94,255, 95, 95, 95,255, 95, 95, 95,255, 95, 95, 95,255, 94, 94, 94,255,
+ 93, 93, 93,255, 91, 91, 91,255, 88, 88, 88,255, 85, 85, 85,255, 82, 82, 82,255, 79, 79, 79,255, 75, 75, 75,255, 71, 71, 71,255,
+ 67, 67, 67,255, 63, 63, 63,255, 59, 59, 59,255, 55, 55, 55,255, 50, 50, 50,255, 45, 45, 45,255, 40, 40, 40,255, 34, 34, 34,255,
+ 28, 28, 28,255, 21, 21, 21,255, 13, 13, 13,255, 14, 14, 14,255,  0,  0,  0,  0, 14, 14, 14,102, 70, 70, 70,255, 85, 85, 85,255,
+ 92, 92, 92,255, 97, 97, 97,255,100,100,100,255,102,102,102,255,102,102,102,255,103,103,103,255,102,102,102,255,101,101,101,255,
+ 99, 99, 99,255, 97, 97, 97,255, 94, 94, 94,255, 91, 91, 91,255, 88, 88, 88,255, 84, 84, 84,255, 81, 81, 81,255, 77, 77, 77,255,
+ 72, 72, 72,255, 68, 68, 68,255, 64, 64, 64,255, 59, 59, 59,255, 55, 55, 55,255, 50, 50, 50,255, 44, 44, 44,255, 39, 39, 39,255,
+ 32, 32, 32,255, 25, 25, 25,255, 17, 17, 17,255, 13, 13, 13,255,  7,  7,  7,102, 24, 24, 24,102, 80, 80, 80,255, 93, 93, 93,255,
+100,100,100,255,104,104,104,255,107,107,107,255,109,109,109,255,109,109,109,255,109,109,109,255,109,109,109,255,107,107,107,255,
+106,106,106,255,103,103,103,255,100,100,100,255, 97, 97, 97,255, 94, 94, 94,255, 90, 90, 90,255, 86, 86, 86,255, 82, 82, 82,255,
+ 77, 77, 77,255, 73, 73, 73,255, 69, 69, 69,255, 64, 64, 64,255, 59, 59, 59,255, 54, 54, 54,255, 49, 49, 49,255, 43, 43, 43,255,
+ 36, 36, 36,255, 29, 29, 29,255, 21, 21, 21,255, 14, 14, 14,255, 10, 10, 10,153, 29, 29, 29,102, 89, 89, 89,255,100,100,100,255,
+107,107,107,255,112,112,112,255,114,114,114,255,116,116,116,255,116,116,116,255,116,116,116,255,115,115,115,255,114,114,114,255,
+112,112,112,255,110,110,110,255,107,107,107,255,104,104,104,255,100,100,100,255, 96, 96, 96,255, 92, 92, 92,255, 87, 87, 87,255,
+ 83, 83, 83,255, 78, 78, 78,255, 73, 73, 73,255, 68, 68, 68,255, 63, 63, 63,255, 58, 58, 58,255, 52, 52, 52,255, 46, 46, 46,255,
+ 40, 40, 40,255, 33, 33, 33,255, 24, 24, 24,255, 17, 17, 17,255, 13, 13, 13,204, 46, 46, 46,153, 95, 95, 95,255,107,107,107,255,
+114,114,114,255,118,118,118,255,121,121,121,255,122,122,122,255,123,123,123,255,123,123,123,255,122,122,122,255,122,122,122,255,
+120,120,120,255,118,118,118,255,114,114,114,255,110,110,110,255,106,106,106,255,101,101,101,255, 97, 97, 97,255, 92, 92, 92,255,
+ 87, 87, 87,255, 83, 83, 83,255, 78, 78, 78,255, 73, 73, 73,255, 68, 68, 68,255, 62, 62, 62,255, 56, 56, 56,255, 50, 50, 50,255,
+ 44, 44, 44,255, 36, 36, 36,255, 28, 28, 28,255, 19, 19, 19,255, 12, 12, 12,204, 47, 47, 47,153,101,101,101,255,113,113,113,255,
+120,120,120,255,125,125,125,255,127,127,127,255,129,129,129,255,130,130,130,255,130,130,130,255,131,131,131,255,131,131,131,255,
+131,131,131,255,129,129,129,255,125,125,125,255,120,120,120,255,113,113,113,255,108,108,108,255,103,103,103,255, 97, 97, 97,255,
+ 92, 92, 92,255, 87, 87, 87,255, 82, 82, 82,255, 77, 77, 77,255, 72, 72, 72,255, 66, 66, 66,255, 60, 60, 60,255, 54, 54, 54,255,
+ 47, 47, 47,255, 39, 39, 39,255, 31, 31, 31,255, 22, 22, 22,255, 12, 12, 12,204, 48, 48, 48,153,106,106,106,255,118,118,118,255,
+126,126,126,255,131,131,131,255,134,134,134,255,135,135,135,255,137,137,137,255,138,138,138,255,142,142,142,255,147,147,147,255,
+149,149,149,255,148,148,148,255,142,142,142,255,133,133,133,255,124,124,124,255,115,115,115,255,108,108,108,255,102,102,102,255,
+ 97, 97, 97,255, 92, 92, 92,255, 87, 87, 87,255, 81, 81, 81,255, 75, 75, 75,255, 69, 69, 69,255, 63, 63, 63,255, 57, 57, 57,255,
+ 49, 49, 49,255, 42, 42, 42,255, 33, 33, 33,255, 24, 24, 24,255,  9,  9,  9,153, 32, 32, 32,102,109,109,109,255,123,123,123,255,
+131,131,131,255,136,136,136,255,140,140,140,255,142,142,142,255,144,144,144,255,148,148,148,255,156,156,156,255,168,168,168,255,
+176,176,176,255,177,177,177,255,168,168,168,255,153,153,153,255,137,137,137,255,124,124,124,255,114,114,114,255,107,107,107,255,
+101,101,101,255, 96, 96, 96,255, 90, 90, 90,255, 85, 85, 85,255, 79, 79, 79,255, 72, 72, 72,255, 66, 66, 66,255, 59, 59, 59,255,
+ 52, 52, 52,255, 44, 44, 44,255, 35, 35, 35,255, 26, 26, 26,255, 10, 10, 10,153, 17, 17, 17, 51,110,110,110,255,127,127,127,255,
+136,136,136,255,142,142,142,255,145,145,145,255,148,148,148,255,151,151,151,255,159,159,159,255,174,174,174,255,195,195,195,255,
+212,212,212,255,216,216,216,255,204,204,204,255,179,179,179,255,154,154,154,255,135,135,135,255,121,121,121,255,112,112,112,255,
+106,106,106,255, 99, 99, 99,255, 94, 94, 94,255, 88, 88, 88,255, 82, 82, 82,255, 76, 76, 76,255, 69, 69, 69,255, 62, 62, 62,255,
+ 54, 54, 54,255, 46, 46, 46,255, 37, 37, 37,255, 26, 26, 26,255,  6,  6,  6,102,  0,  0,  0,  0,107,107,107,255,130,130,130,255,
+140,140,140,255,146,146,146,255,150,150,150,255,153,153,153,255,158,158,158,255,169,169,169,255,191,191,191,255,219,219,219,255,
+246,246,246,255,254,254,254,255,237,237,237,255,204,204,204,255,170,170,170,255,145,145,145,255,127,127,127,255,117,117,117,255,
+110,110,110,255,103,103,103,255, 97, 97, 97,255, 91, 91, 91,255, 85, 85, 85,255, 78, 78, 78,255, 71, 71, 71,255, 64, 64, 64,255,
+ 55, 55, 55,255, 47, 47, 47,255, 37, 37, 37,255, 25, 25, 25,255,  3,  3,  3, 51,  0,  0,  0,  0, 65, 65, 65,153,129,129,129,255,
+142,142,142,255,149,149,149,255,154,154,154,255,158,158,158,255,163,163,163,255,176,176,176,255,199,199,199,255,232,232,232,255,
+255,255,255,255,255,255,255,255,255,255,255,255,220,220,220,255,181,181,181,255,151,151,151,255,132,132,132,255,121,121,121,255,
+113,113,113,255,106,106,106,255,100,100,100,255, 94, 94, 94,255, 87, 87, 87,255, 80, 80, 80,255, 73, 73, 73,255, 65, 65, 65,255,
+ 57, 57, 57,255, 48, 48, 48,255, 38, 38, 38,255, 16, 16, 16,153,  0,  0,  0,  0,  0,  0,  0,  0, 21, 21, 21, 51,127,127,127,255,
+143,143,143,255,152,152,152,255,157,157,157,255,161,161,161,255,165,165,165,255,177,177,177,255,198,198,198,255,227,227,227,255,
+253,253,253,255,255,255,255,255,250,250,250,255,217,217,217,255,181,181,181,255,153,153,153,255,135,135,135,255,124,124,124,255,
+117,117,117,255,110,110,110,255,103,103,103,255, 96, 96, 96,255, 89, 89, 89,255, 82, 82, 82,255, 74, 74, 74,255, 66, 66, 66,255,
+ 57, 57, 57,255, 48, 48, 48,255, 35, 35, 35,255, 10, 10, 10,153,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 93, 93, 93,204,
+141,141,141,255,153,153,153,255,159,159,159,255,163,163,163,255,167,167,167,255,174,174,174,255,188,188,188,255,209,209,209,255,
+228,228,228,255,234,234,234,255,224,224,224,255,200,200,200,255,173,173,173,255,151,151,151,255,136,136,136,255,127,127,127,255,
+119,119,119,255,112,112,112,255,105,105,105,255, 98, 98, 98,255, 90, 90, 90,255, 83, 83, 83,255, 75, 75, 75,255, 66, 66, 66,255,
+ 57, 57, 57,255, 46, 46, 46,255, 24, 24, 24,204,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 20, 20, 20, 51,
+134,134,134,255,151,151,151,255,160,160,160,255,164,164,164,255,167,167,167,255,171,171,171,255,178,178,178,255,189,189,189,255,
+200,200,200,255,202,202,202,255,195,195,195,255,180,180,180,255,163,163,163,255,148,148,148,255,137,137,137,255,129,129,129,255,
+121,121,121,255,114,114,114,255,107,107,107,255, 99, 99, 99,255, 91, 91, 91,255, 83, 83, 83,255, 74, 74, 74,255, 65, 65, 65,255,
+ 55, 55, 55,255, 41, 41, 41,255,  7,  7,  7, 51,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 49, 49, 49,102,145,145,145,255,157,157,157,255,164,164,164,255,167,167,167,255,170,170,170,255,172,172,172,255,176,176,176,255,
+180,180,180,255,179,179,179,255,174,174,174,255,165,165,165,255,155,155,155,255,145,145,145,255,137,137,137,255,130,130,130,255,
+122,122,122,255,115,115,115,255,107,107,107,255, 99, 99, 99,255, 91, 91, 91,255, 82, 82, 82,255, 73, 73, 73,255, 63, 63, 63,255,
+ 50, 50, 50,255, 22, 22, 22,153,  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, 78, 78, 78,153,149,149,149,255,160,160,160,255,166,166,166,255,168,168,168,255,169,169,169,255,170,170,170,255,
+169,169,169,255,167,167,167,255,164,164,164,255,158,158,158,255,151,151,151,255,144,144,144,255,137,137,137,255,130,130,130,255,
+123,123,123,255,115,115,115,255,106,106,106,255, 98, 98, 98,255, 89, 89, 89,255, 80, 80, 80,255, 70, 70, 70,255, 58, 58, 58,255,
+ 27, 27, 27,153,  3,  3,  3, 51,  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, 80, 80, 80,153,150,150,150,255,160,160,160,255,165,165,165,255,167,167,167,255,167,167,167,255,
+166,166,166,255,163,163,163,255,160,160,160,255,155,155,155,255,149,149,149,255,143,143,143,255,137,137,137,255,129,129,129,255,
+121,121,121,255,113,113,113,255,105,105,105,255, 96, 96, 96,255, 86, 86, 86,255, 76, 76, 76,255, 63, 63, 63,255, 38, 38, 38,204,
+  7,  7,  7, 51,  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, 78, 78, 78,153,147,147,147,255,157,157,157,255,161,161,161,255,163,163,163,255,
+162,162,162,255,160,160,160,255,157,157,157,255,152,152,152,255,147,147,147,255,141,141,141,255,135,135,135,255,127,127,127,255,
+119,119,119,255,110,110,110,255,101,101,101,255, 91, 91, 91,255, 80, 80, 80,255, 66, 66, 66,255, 32, 32, 32,153,  7,  7,  7, 51,
+  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,  0,  0,134,134,134,255,148,148,148,255,154,154,154,255,
+155,155,155,255,154,154,154,255,152,152,152,255,147,147,147,255,142,142,142,255,136,136,136,255,130,130,130,255,122,122,122,255,
+114,114,114,255,104,104,104,255, 93, 93, 93,255, 81, 81, 81,255, 54, 54, 54,204, 22, 22, 22,102,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 73, 73, 73,153,103,103,103,204,
+137,137,137,255,140,140,140,255,140,140,140,255,137,137,137,255,133,133,133,255,127,127,127,255,120,120,120,255,113,113,113,255,
+102,102,102,255, 91, 91, 91,255, 64, 64, 64,204, 28, 28, 28,102,  6,  6,  6, 51,  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,  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, 46, 46, 46,102, 72, 72, 72,153, 72, 72, 72,153, 92, 92, 92,204, 88, 88, 88,204, 81, 81, 81,204, 54, 54, 54,153,
+ 35, 35, 35,102, 16, 16, 16, 51,  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, 84, 69,  0,  0,168,  1,  0,  0,248,181, 21,  6,
+  0,  0,  0,  0, 33,  0,  0,  0,  1,  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, 84, 69, 84,101,120,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,128, 62,  0,  0,160, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0, 64,  0,  0,  0, 64,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0, 32, 64,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  7,  0,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  8,  0,  0,  0,  1,  0,  1,  0,  3,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,205,204,204, 60,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  2,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232,183, 21,  6,  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, 68, 65, 84, 65, 40,  0,  0,  0,232,183, 21,  6,
+  0,  0,  0,  0, 12,  0,  0,  0,  1,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0, 32,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,
+ 16,  0, 15,  0, 88,184, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  0, 16,  0,  0, 88,184, 21,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -5803,19 +5932,6 @@ char datatoc_startup_blend[]= {
   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,  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,
- 84, 69,  0,  0, 48,  1,  0,  0,  8, 97,223,  2, 31,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 84, 69, 84,101,120,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 62,  0,  0,160, 64,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0, 64,  0,  0,  0, 64,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0, 32, 64,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  7,  0,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  8,  0,  0,  0,  1,  0,  1,  0,  3,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,205,204,204, 60,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,  2,  0,  1,  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,112, 30,204,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 32,  0,  0,  0,112, 30,204,  2, 11,  0,  0,  0,  1,  0,  0,  0, 32,  0,  0,  0, 96,  0,  0,  0,
- 32,  0,  0,  0, 96,  0,  0,  0,  0,  0,  1,  0, 16,  0, 15,  0, 80,189,228,  2,128,205,228,  2, 68, 65, 84, 65,  0, 16,  0,  0,
- 80,189,228,  2,  0,  0,  0,  0,  1,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -5898,8 +6014,52 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0, 77, 69,  0,  0,232,  4,  0,  0,168,200, 21,  6,  0,  0,  0,  0, 50,  0,  0,  0,
+  1,  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, 77, 69, 67,117, 98,101,  0,112,104,101,114,101,  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,  0,  0,  0,  0,  0,  0,  1,  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,  0,216,205, 21,  6,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 72,221, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,232,217, 21,  6,
+  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,120,208, 21,  6,  0,  0,  0,  0,184,211, 21,  6,  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, 40,206, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  1,  0,  0,  0,  5,  0,  0,  0, 24,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,104,209, 21,  6,  0,  0,  0,  0,255,255,255,255,
+255,255,255,255,255,255,255,255,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,  1,  0,  0,  0,  5,  0,  0,  0, 12,  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,  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,  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,  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,248,218, 21,  6,  0,  0,  0,  0,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,  1,  0,  0,  0,  5,  0,  0,  0, 12,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,232,214, 21,  6,  0,  0,  0,  0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  0,  0,  0,  0,255,255,255,255,255,255,255,255,
+255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,  1,  0,  0,  0,  5,  0,  0,  0,  8,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,  0,  0,  0, 12,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  6,  0,  0,  0, 24,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 51,  0,  0,  0,180,  0,  0,  0,  0,  4,  0,128, 63,
+  4,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0, 67,  0, 30,  0,  6,  0,  1,  0,  1,  0,
+  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  8,  0,  0,  0,216,205, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,232,159, 21,  6,  0,  0,  0,  0, 68, 65, 84, 65,  8,  2,  0,  0, 40,206, 21,  6,  0,  0,  0,  0,124,  1,  0,  0,
+  5,  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,  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,120,208, 21,  6,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -5912,8 +6072,16 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0,120,208, 21,  6,  0,  0,  0,  0, 56,  0,  0,  0,
+  8,  0,  0,  0,  0,  0,128, 63,255,255,127, 63,  0,  0,128,191,230, 73,230, 73, 26,182,  1,  0,  0,  0,128, 63,  0,  0,128,191,
+  0,  0,128,191,230, 73, 26,182, 26,182,  1,  0,  1,  0,128,191,253,255,127,191,  0,  0,128,191, 26,182, 26,182, 26,182,  1,  0,
+250,255,127,191,  3,  0,128, 63,  0,  0,128,191, 26,182,230, 73, 26,182,  1,  0,  4,  0,128, 63,247,255,127, 63,  0,  0,128, 63,
+230, 73,230, 73,230, 73,  1,  0,245,255,127, 63,  5,  0,128,191,  0,  0,128, 63,230, 73, 26,182,230, 73,  1,  0,  3,  0,128,191,
+250,255,127,191,  0,  0,128, 63, 26,182, 26,182,230, 73,  1,  0,255,255,127,191,  0,  0,128, 63,  0,  0,128, 63, 26,182,230, 73,
+230, 73,  1,  0, 68, 65, 84, 65,  8,  2,  0,  0,104,209, 21,  6,  0,  0,  0,  0,124,  1,  0,  0,  5,  0,  0,  0,  3,  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,  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,184,211, 21,  6,
   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,  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,
@@ -5927,8 +6095,19 @@ char datatoc_startup_blend[]= {
   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,  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, 68, 65, 84, 65,144,  0,  0,  0,184,211, 21,  6,  0,  0,  0,  0, 53,  0,  0,  0, 12,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0, 35,  0,
+  1,  0,  0,  0,  2,  0,  0,  0,  0,  0, 35,  0,  1,  0,  0,  0,  5,  0,  0,  0,  0,  0, 35,  0,  2,  0,  0,  0,  3,  0,  0,  0,
+  0,  0, 35,  0,  2,  0,  0,  0,  6,  0,  0,  0,  0,  0, 35,  0,  3,  0,  0,  0,  7,  0,  0,  0,  0,  0, 35,  0,  4,  0,  0,  0,
+  5,  0,  0,  0,  0,  0, 35,  0,  4,  0,  0,  0,  7,  0,  0,  0,  0,  0, 35,  0,  5,  0,  0,  0,  6,  0,  0,  0,  0,  0, 35,  0,
+  6,  0,  0,  0,  7,  0,  0,  0,  0,  0, 35,  0, 68, 65, 84, 65,  8,  2,  0,  0,232,214, 21,  6,  0,  0,  0,  0,124,  1,  0,  0,
+  5,  0,  0,  0, 26,  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, 78, 71,111,110, 32, 70, 97, 99,101, 45, 86,101,114,116,101,120,  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,232,217, 21,  6,  0,  0,  0,  0, 26,  0,  0,  0,  4,  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, 78, 71,111,110, 32, 70, 97, 99,101, 45, 86,101,114,116,101,120,  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,232,217, 21,  6,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -5938,12 +6117,22 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,192,  0,  0,  0,232,217, 21,  6,  0,  0,  0,  0, 59,  0,  0,  0,
+ 24,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  3,  0,  0,  0,  2,  0,  0,  0,  5,  0,  0,  0,  3,  0,  0,  0,
+  1,  0,  0,  0,  4,  0,  0,  0,  9,  0,  0,  0,  7,  0,  0,  0, 11,  0,  0,  0,  6,  0,  0,  0, 10,  0,  0,  0,  5,  0,  0,  0,
+  8,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  4,  0,  0,  0,  8,  0,  0,  0,  5,  0,  0,  0,  4,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,  4,  0,  0,  0,  5,  0,  0,  0, 10,  0,  0,  0,  6,  0,  0,  0,  6,  0,  0,  0,  2,  0,  0,  0,
+  3,  0,  0,  0,  2,  0,  0,  0,  6,  0,  0,  0,  6,  0,  0,  0, 11,  0,  0,  0,  7,  0,  0,  0,  7,  0,  0,  0,  3,  0,  0,  0,
+  5,  0,  0,  0,  4,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  3,  0,  0,  0,  7,  0,  0,  0,  7,  0,  0,  0,
+  9,  0,  0,  0, 68, 65, 84, 65,  8,  2,  0,  0,248,218, 21,  6,  0,  0,  0,  0,124,  1,  0,  0,  5,  0,  0,  0, 25,  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, 78, 71,111,110,
+ 32, 70, 97, 99,101,  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,  0,  0,  0,  0,  0, 72,221, 21,  6,
   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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  0,144,  0,  0,128,205,228,  2,  0,  0,  0,  0,  1,  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,  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,
@@ -5952,9 +6141,25 @@ char datatoc_startup_blend[]= {
   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,  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, 68, 65, 84, 65, 72,  0,  0,  0, 72,221, 21,  6,  0,  0,  0,  0, 58,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,
+  4,  0,  0,  0,  0,  0,  2,  0,  4,  0,  0,  0,  4,  0,  0,  0,  0,  0,  2,  0,  8,  0,  0,  0,  4,  0,  0,  0,  0,  0,  2,  0,
+ 12,  0,  0,  0,  4,  0,  0,  0,  0,  0,  2,  0, 16,  0,  0,  0,  4,  0,  0,  0,  0,  0,  2,  0, 20,  0,  0,  0,  4,  0,  0,  0,
+  0,  0,  2,  0, 66, 82,  0,  0, 88,  6,  0,  0,216,221, 21,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0,  8,232, 21,  6,
+  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, 66, 82, 65,100,
+100,  0,104, 46, 48, 48, 49,  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,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  2,  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, 63,  0,  0,  0,  0,248,229, 21,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -5987,16 +6192,49 @@ char datatoc_startup_blend[]= {
   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,  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, 12,  0, 35,  0,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,  0,  0,  1,  1,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 56,  1,  0,  0,112,222, 21,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0,248,229, 21,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63, 14,215,126,191,
+ 54,189,194, 61, 14,215,126,191, 46,189,194, 61,136,231, 21,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0,136,231, 21,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62, 31,133,107, 63,  0,  0,  0,  0,  0,  0, 64, 63, 10,215,163, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0,  8,232, 21,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0,184,240, 21,  6,
+  0,  0,  0,  0,216,221, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 66,108,
+111, 98,  0, 48, 48, 49,  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,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  3,  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, 63,  0,  0,  0,  0,168,238, 21,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -6029,16 +6267,49 @@ char datatoc_startup_blend[]= {
   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,  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,  2,  0, 35,  0,  0,  0,  4,  4,  4,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,
+ 20,174,199, 62, 20,174,199, 62, 20,174,199, 62, 20,174,199, 62,  0,  0,128, 63, 68, 65, 84, 65, 56,  1,  0,  0,160,232, 21,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0,168,238, 21,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191,
+ 46, 95,255,186,224,255,127,191,114, 97,255,186, 56,240, 21,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0, 56,240, 21,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0,184,240, 21,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0,104,249, 21,  6,
+  0,  0,  0,  0,  8,232, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 66,108,
+117,114,  0, 46, 48, 48, 52,  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,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  2,  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, 63,  0,  0,  0,  0, 88,247, 21,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -6071,16 +6342,49 @@ char datatoc_startup_blend[]= {
   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,  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, 12,  0, 35,  0,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,  0,  0,  1,  4,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 56,  1,  0,  0, 80,241, 21,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0, 88,247, 21,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63, 14,215,126,191,
+ 54,189,194, 61, 14,215,126,191, 46,189,194, 61,232,248, 21,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0,232,248, 21,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62, 31,133,107, 63,  0,  0,  0,  0,  0,  0, 64, 63, 10,215,163, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0,104,249, 21,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0, 24,  2, 22,  6,
+  0,  0,  0,  0,184,240, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 66,114,
+117,115,104,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  2,  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, 63,  0,  0,  0,  0,  8,  0, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -6113,16 +6417,49 @@ char datatoc_startup_blend[]= {
   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,  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, 30,  0, 35,  0,  0,  0,  4,  4,  4,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+ 20,174,199, 62, 20,174,199, 62, 20,174,199, 62, 20,174,199, 62,  0,  0,128, 63, 68, 65, 84, 65, 56,  1,  0,  0,  0,250, 21,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0,  8,  0, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191,
+ 46, 95,255,186,224,255,127,191,114, 97,255,186,152,  1, 22,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0,152,  1, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0,200, 10, 22,  6,
+  0,  0,  0,  0,104,249, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 67,108,
+ 97,121,  0, 48, 48, 49,  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,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  3,  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, 63,  0,  0,  0,  0,184,  8, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -6155,16 +6492,49 @@ char datatoc_startup_blend[]= {
   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,  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,  2,  0, 35,  0,  0,  0,  4,  4,  4,  8,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  8,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,
+ 20,174,199, 62, 20,174,199, 62, 20,174,199, 62, 20,174,199, 62,  0,  0,128, 63, 68, 65, 84, 65, 56,  1,  0,  0,176,  2, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0,184,  8, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191,
+ 46, 95,255,186,224,255,127,191,114, 97,255,186, 72, 10, 22,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0, 72, 10, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0,200, 10, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0,120, 19, 22,  6,
+  0,  0,  0,  0, 24,  2, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 67,108,
+ 97,121, 32, 83,116,114,105,112,115,  0, 48, 49,  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,  0,  0,
+  1,  0,  0,  3,  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, 63,  0,  0,  0,  0,104, 17, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -6197,16 +6567,49 @@ char datatoc_startup_blend[]= {
   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,  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,  2,  0, 35,  0,  0,  0,  4,  4,  4,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0, 18,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,160,119, 78, 63,  0,  0,128, 63,
+ 20,174,199, 62, 20,174,199, 62, 20,174,199, 62, 20,174,199, 62,  0,  0,128, 63, 68, 65, 84, 65, 56,  1,  0,  0, 96, 11, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0,104, 17, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191,
+ 46, 95,255,186,224,255,127,191,114, 97,255,186,248, 18, 22,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0,248, 18, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0,120, 19, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0, 40, 28, 22,  6,
+  0,  0,  0,  0,200, 10, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 67,108,
+111,110,101,  0, 48, 48, 49,  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,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  2,  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, 63,  0,  0,  0,  0, 24, 26, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -6239,16 +6642,49 @@ char datatoc_startup_blend[]= {
   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,  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, 16,  0, 35,  0,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 51, 51, 51, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  3,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 56,  1,  0,  0, 16, 20, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0, 24, 26, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63, 14,215,126,191,
+ 54,189,194, 61, 14,215,126,191, 46,189,194, 61,168, 27, 22,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0,168, 27, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62, 31,133,107, 63,  0,  0,  0,  0,  0,  0, 64, 63, 10,215,163, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0,216, 36, 22,  6,
+  0,  0,  0,  0,120, 19, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 67,114,
+101, 97,115,101,  0, 48, 48, 49,  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,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  3,  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, 63,  0,  0,  0,  0,200, 34, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -6281,16 +6717,49 @@ char datatoc_startup_blend[]= {
   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,  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,  2,  0, 35,  0,  0,  0,  4,  6,  4,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 62,  0,  0,  0,  0,  0,  0,  0,  0, 16,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,
+ 20,174,199, 62, 20,174,199, 62, 20,174,199, 62, 20,174,199, 62,  0,  0,128, 63, 68, 65, 84, 65, 56,  1,  0,  0,192, 28, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0,200, 34, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  1,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,228, 97,175,190,
+ 50,131,112, 63,218,243,127,191, 10,183,157,188, 88, 36, 22,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0, 88, 36, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0, 64, 63, 10,215, 35, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0,216, 36, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0,136, 45, 22,  6,
+  0,  0,  0,  0, 40, 28, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 68, 97,
+114,107,101,110,  0, 48, 54,  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,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  2,  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, 63,  0,  0,  0,  0,120, 43, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -6323,16 +6792,49 @@ char datatoc_startup_blend[]= {
   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,  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, 12,  0, 35,  0,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,  0,  0,  1,  6,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 56,  1,  0,  0,112, 37, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0,120, 43, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63, 14,215,126,191,
+ 54,189,194, 61, 14,215,126,191, 46,189,194, 61,  8, 45, 22,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0,  8, 45, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62, 31,133,107, 63,  0,  0,  0,  0,  0,  0, 64, 63, 10,215,163, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0,136, 45, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0, 56, 54, 22,  6,
+  0,  0,  0,  0,216, 36, 22,  6,  0,  0,  0,  0,  0, 20,  1,160,255,255,255,255,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 68,114,
+ 97,119,  0, 46, 48, 48, 49,  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,  0,  0,  0,  0,  0,  0,  0,
+  3,  0,  0,  2,  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, 63,  0,  0,  0,  0, 40, 52, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -6365,16 +6867,49 @@ char datatoc_startup_blend[]= {
   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,  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, 30,  0, 35,  0,  0,  0,  0,  4,  0,  8,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,
+ 20,174,199, 62, 20,174,199, 62, 20,174,199, 62, 20,174,199, 62,  0,  0,128, 63, 68, 65, 84, 65, 56,  1,  0,  0, 32, 46, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0, 40, 52, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191,
+ 46, 95,255,186,224,255,127,191,114, 97,255,186,184, 53, 22,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0,184, 53, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0,232, 62, 22,  6,
+  0,  0,  0,  0,136, 45, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 70,105,
+108,108, 47, 68,101,101,112,101,110,  0, 48, 48, 49,  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,  0,
+  1,  0,  0,  3,  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, 63,  0,  0,  0,  0,216, 60, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -6407,16 +6942,49 @@ char datatoc_startup_blend[]= {
   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,  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,  2,  0, 35,  0,  0,  0,  4,  4,  4,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,
+  0,  0,128, 63, 20,174,199, 62,  0,  0,128, 62,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 56,  1,  0,  0,208, 54, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0,216, 60, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191,
+ 46, 95,255,186,224,255,127,191,114, 97,255,186,104, 62, 22,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0,104, 62, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0,232, 62, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0,152, 71, 22,  6,
+  0,  0,  0,  0, 56, 54, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 70,108,
+ 97,116,116,101,110, 47, 67,111,110,116,114, 97,115,116,  0, 48, 48, 49,  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,
+  1,  0,  0,  3,  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, 63,  0,  0,  0,  0,136, 69, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -6449,16 +7017,49 @@ char datatoc_startup_blend[]= {
   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,  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,  2,  0, 35,  0,  0,  0,  4,  4,  4,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,
+  0,  0,128, 63, 20,174,199, 62,  0,  0,128, 62,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 56,  1,  0,  0,128, 63, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0,136, 69, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191,
+ 46, 95,255,186,224,255,127,191,114, 97,255,186, 24, 71, 22,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0, 24, 71, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0,152, 71, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0, 72, 80, 22,  6,
+  0,  0,  0,  0,232, 62, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 71,114,
+ 97, 98,  0, 48, 48, 49,  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,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  3,  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, 63,  0,  0,  0,  0, 56, 78, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -6491,16 +7092,49 @@ char datatoc_startup_blend[]= {
   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,  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,  2,  0, 75,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 62,
+  0,  0,128, 63,  0,  0,128, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 56,  1,  0,  0, 48, 72, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0, 56, 78, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191,
+ 46, 95,255,186,224,255,127,191,114, 97,255,186,200, 79, 22,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0,200, 79, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0,248, 88, 22,  6,
+  0,  0,  0,  0,152, 71, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 73,110,
+102,108, 97,116,101, 47, 68,101,102,108, 97,116,101,  0, 48, 48, 49,  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,
+  1,  0,  0,  3,  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, 63,  0,  0,  0,  0,232, 86, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -6533,16 +7167,49 @@ char datatoc_startup_blend[]= {
   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,  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,  2,  0, 35,  0,  0,  0,  4,  4,  4,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0, 64, 63,
+  0,  0, 64, 63,  0,  0, 64, 63,  0,  0,128, 62,  0,  0,128, 62,  0,  0,128, 62, 68, 65, 84, 65, 56,  1,  0,  0,224, 80, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0,232, 86, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191,
+ 46, 95,255,186,224,255,127,191,114, 97,255,186,120, 88, 22,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0,120, 88, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0,248, 88, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0,168, 97, 22,  6,
+  0,  0,  0,  0, 72, 80, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 76, 97,
+121,101,114,  0, 48, 48, 49,  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,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  3,  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, 63,  0,  0,  0,  0,152, 95, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -6575,16 +7242,49 @@ char datatoc_startup_blend[]= {
   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,  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,  2,  0, 35,  0,  0,  0,  4,  4,  4,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,
+ 20,174,199, 62, 20,174,199, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 56,  1,  0,  0,144, 89, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0,152, 95, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191,
+ 46, 95,255,186,224,255,127,191,114, 97,255,186, 40, 97, 22,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0, 40, 97, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0,168, 97, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0, 88,106, 22,  6,
+  0,  0,  0,  0,248, 88, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 76,105,
+103,104,116,101,110,  0, 53,  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,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  2,  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, 63,  0,  0,  0,  0, 72,104, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -6617,16 +7317,49 @@ char datatoc_startup_blend[]= {
   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,  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, 12,  0, 35,  0,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,  0,  0,  1,  5,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 56,  1,  0,  0, 64, 98, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0, 72,104, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63, 14,215,126,191,
+ 54,189,194, 61, 14,215,126,191, 46,189,194, 61,216,105, 22,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0,216,105, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62, 31,133,107, 63,  0,  0,  0,  0,  0,  0, 64, 63, 10,215,163, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0, 88,106, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0,  8,115, 22,  6,
+  0,  0,  0,  0,168, 97, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 77,105,
+120,  0,104,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  2,  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, 63,  0,  0,  0,  0,248,112, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -6659,16 +7392,49 @@ char datatoc_startup_blend[]= {
   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,  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, 12,  0, 35,  0,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 51, 51, 51, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 56,  1,  0,  0,240,106, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0,248,112, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63, 14,215,126,191,
+ 54,189,194, 61, 14,215,126,191, 46,189,194, 61,136,114, 22,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0,136,114, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62, 31,133,107, 63,  0,  0,  0,  0,  0,  0, 64, 63, 10,215,163, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0,  8,115, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0,184,123, 22,  6,
+  0,  0,  0,  0, 88,106, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 77,117,
+108,116,105,112,108,121,  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,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  2,  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, 63,  0,  0,  0,  0,168,121, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -6701,16 +7467,49 @@ char datatoc_startup_blend[]= {
   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,  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, 12,  0, 35,  0,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,  0,  0,  1,  3,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 56,  1,  0,  0,160,115, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0,168,121, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63, 14,215,126,191,
+ 54,189,194, 61, 14,215,126,191, 46,189,194, 61, 56,123, 22,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0, 56,123, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62, 31,133,107, 63,  0,  0,  0,  0,  0,  0, 64, 63, 10,215,163, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0,184,123, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0,104,132, 22,  6,
+  0,  0,  0,  0,  8,115, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 78,117,
+100,103,101,  0, 48, 48, 49,  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,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  3,  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, 63,  0,  0,  0,  0, 88,130, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -6743,16 +7542,49 @@ char datatoc_startup_blend[]= {
   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,  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,  2,  0, 35,  0,  0,  0,  4,  4,  4,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0, 11,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 62,
+  0,  0,128, 63,  0,  0,128, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 56,  1,  0,  0, 80,124, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0, 88,130, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191,
+ 46, 95,255,186,224,255,127,191,114, 97,255,186,232,131, 22,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0,232,131, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0,104,132, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0, 24,141, 22,  6,
+  0,  0,  0,  0,184,123, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 80,105,
+110, 99,104, 47, 77, 97,103,110,105,102,121,  0, 48, 48, 49,  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,
+  1,  0,  0,  3,  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, 63,  0,  0,  0,  0,  8,139, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -6785,16 +7617,49 @@ char datatoc_startup_blend[]= {
   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,  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,  2,  0, 35,  0,  0,  0,  4,  4,  4,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0, 64, 63,
+  0,  0, 64, 63,  0,  0, 64, 63,  0,  0,128, 62,  0,  0,128, 62,  0,  0,128, 62, 68, 65, 84, 65, 56,  1,  0,  0,  0,133, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0,  8,139, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191,
+ 46, 95,255,186,224,255,127,191,114, 97,255,186,152,140, 22,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0,152,140, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0, 24,141, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0,200,149, 22,  6,
+  0,  0,  0,  0,104,132, 22,  6,  0,  0,  0,  0,253, 21,192, 32,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 80,111,
+108,105,115,104,  0, 48, 48, 49,  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,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  3,  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, 63,  0,  0,  0,  0,184,147, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -6827,16 +7692,49 @@ char datatoc_startup_blend[]= {
   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,  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,  2,  0, 35,  0,  0,  0,  4,  4,  4,  1,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,
+  0,  0,128, 63, 20,174,199, 62,  0,  0,128, 62,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 56,  1,  0,  0,176,141, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0,184,147, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191,
+ 46, 95,255,186,224,255,127,191,114, 97,255,186, 72,149, 22,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0, 72,149, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0,200,149, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0,120,158, 22,  6,
+  0,  0,  0,  0, 24,141, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 83, 99,
+114, 97,112,101, 47, 80,101, 97,107,115,  0, 48, 48, 49,  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,
+  1,  0,  0,  3,  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, 63,  0,  0,  0,  0,104,156, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -6869,16 +7767,49 @@ char datatoc_startup_blend[]= {
   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,  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,  2,  0, 35,  0,  0,  0,  4,  4,  4,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,
+  0,  0,128, 63, 20,174,199, 62,  0,  0,128, 62,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 56,  1,  0,  0, 96,150, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0,104,156, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191,
+ 46, 95,255,186,224,255,127,191,114, 97,255,186,248,157, 22,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0,248,157, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0,120,158, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0, 40,167, 22,  6,
+  0,  0,  0,  0,200,149, 22,  6,  0,  0,  0,  0,168,205,210,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 83, 99,
+117,108,112,116, 68,114, 97,119,  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,  0,  0,  0,  0,  0,  0,
+  2,  0,  0,  3,  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, 63,  0,  0,  0,  0, 24,165, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -6911,16 +7842,49 @@ char datatoc_startup_blend[]= {
   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,  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,  2,  0, 35,  0,  0,  0,  4,  4,  4,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,160,119, 78, 63,  0,  0,128, 63,
+ 20,174,199, 62, 20,174,199, 62, 20,174,199, 62, 20,174,199, 62,  0,  0,128, 63, 68, 65, 84, 65, 56,  1,  0,  0, 16,159, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0, 24,165, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191,
+ 46, 95,255,186,224,255,127,191,114, 97,255,186,168,166, 22,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0,168,166, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0, 40,167, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0,216,175, 22,  6,
+  0,  0,  0,  0,120,158, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 83,109,
+101, 97,114,  0, 48, 48, 49,  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,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  2,  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, 63,  0,  0,  0,  0,200,173, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -6953,16 +7917,49 @@ char datatoc_startup_blend[]= {
   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,  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, 16,  0, 35,  0,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 56,  1,  0,  0,192,167, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0,200,173, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63, 14,215,126,191,
+ 54,189,194, 61, 14,215,126,191, 46,189,194, 61, 88,175, 22,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0, 88,175, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62, 31,133,107, 63,  0,  0,  0,  0,  0,  0, 64, 63, 10,215,163, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0,216,175, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0,136,184, 22,  6,
+  0,  0,  0,  0, 40,167, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 83,109,
+111,111,116,104,  0, 48, 48, 49,  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,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  3,  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, 63,  0,  0,  0,  0,120,182, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -6995,16 +7992,49 @@ char datatoc_startup_blend[]= {
   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,  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,  2,  0, 35,  0,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0,  5,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0, 64, 63,
+  0,  0, 64, 63,  0,  0, 64, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 56,  1,  0,  0,112,176, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0,120,182, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191,
+ 46, 95,255,186,224,255,127,191,114, 97,255,186,  8,184, 22,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0,  8,184, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0,136,184, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0, 56,193, 22,  6,
+  0,  0,  0,  0,216,175, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 83,110,
+ 97,107,101, 32, 72,111,111,107,  0, 48, 48, 49,  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,  0,  0,
+  1,  0,  0,  3,  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, 63,  0,  0,  0,  0, 40,191, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -7037,16 +8067,49 @@ char datatoc_startup_blend[]= {
   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,  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,  2,  0, 75,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0, 13,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 62,
+  0,  0,128, 63,  0,  0,128, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 56,  1,  0,  0, 32,185, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0, 40,191, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191,
+ 46, 95,255,186,224,255,127,191,114, 97,255,186,184,192, 22,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0,184,192, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0, 56,193, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0,232,201, 22,  6,
+  0,  0,  0,  0,136,184, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 83,111,
+102,116,101,110,  0, 48, 49,  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,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  2,  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, 63,  0,  0,  0,  0,216,199, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -7079,16 +8142,49 @@ char datatoc_startup_blend[]= {
   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,  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, 16,  0, 35,  0,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 56,  1,  0,  0,208,193, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0,216,199, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63, 14,215,126,191,
+ 54,189,194, 61, 14,215,126,191, 46,189,194, 61,104,201, 22,  6,  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,  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,  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,  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,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0,104,201, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62, 31,133,107, 63,  0,  0,  0,  0,  0,  0, 64, 63, 10,215,163, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0,232,201, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0,152,210, 22,  6,
+  0,  0,  0,  0, 56,193, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 83,117,
+ 98,116,114, 97, 99,116,  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,  0,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  2,  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, 63,  0,  0,  0,  0,136,208, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -7096,19 +8192,7 @@ char datatoc_startup_blend[]= {
   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,  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,
- 77, 69,  0,  0, 24,  1,  0,  0,144, 30,221,  2, 46,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 77, 69, 67,117, 98,101,  0,112,104,101,114,101,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  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,176, 93,229,  2, 40,210,215,  2,
-  0,  0,  0,  0,  0,  0,  0,  0,112, 95,229,  2, 64,238,214,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,232, 93,229,  2,  1,  0,  0,  0,  5,  0,  0,  0, 24,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 64, 96,229,  2,  1,  0,  0,  0,  5,  0,  0,  0, 12,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-200, 97,229,  2,  1,  0,  0,  0,  5,  0,  0,  0, 20,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,  0,  0,  0,
- 12,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 51,  0,  0,  0,180,  0,  0,  0,  0,  4,  0,128, 63,
-  4,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0, 67,  0, 30,  0,  6,  0,  1,  0,  1,  0,
-  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,  4,  0,  0,  0,176, 93,229,  2,  0,  0,  0,  0,  1,  0,  0,  0,
- 32, 26,228,  2, 68, 65, 84, 65, 84,  1,  0,  0,232, 93,229,  2, 85,  1,  0,  0,  5,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,112, 95,229,  2,  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,  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,
@@ -7117,15 +8201,7 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,160,  0,  0,  0,112, 95,229,  2, 52,  0,  0,  0,  8,  0,  0,  0,
-  0,  0,128, 63,255,255,127, 63,  0,  0,128,191,230, 73,230, 73, 26,182,  1,  0,  0,  0,128, 63,  0,  0,128,191,  0,  0,128,191,
-230, 73, 26,182, 26,182,  1,  0,  1,  0,128,191,253,255,127,191,  0,  0,128,191, 26,182, 26,182, 26,182,  1,  0,250,255,127,191,
-  3,  0,128, 63,  0,  0,128,191, 26,182,230, 73, 26,182,  1,  0,  4,  0,128, 63,247,255,127, 63,  0,  0,128, 63,230, 73,230, 73,
-230, 73,  1,  0,245,255,127, 63,  5,  0,128,191,  0,  0,128, 63,230, 73, 26,182,230, 73,  1,  0,  3,  0,128,191,250,255,127,191,
-  0,  0,128, 63, 26,182, 26,182,230, 73,  1,  0,255,255,127,191,  0,  0,128, 63,  0,  0,128, 63, 26,182,230, 73,230, 73,  1,  0,
- 68, 65, 84, 65, 84,  1,  0,  0, 64, 96,229,  2, 85,  1,  0,  0,  5,  0,  0,  0,  3,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 64,238,214,  2,  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,  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,  0,  0,  0,  0,
@@ -7134,51 +8210,19 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0, 68, 65, 84, 65,144,  0,  0,  0, 64,238,214,  2, 49,  0,  0,  0, 12,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0, 35,  0,
-  1,  0,  0,  0,  2,  0,  0,  0,  0,  0, 35,  0,  1,  0,  0,  0,  5,  0,  0,  0,  0,  0, 35,  0,  2,  0,  0,  0,  3,  0,  0,  0,
-  0,  0, 35,  0,  2,  0,  0,  0,  6,  0,  0,  0,  0,  0, 35,  0,  3,  0,  0,  0,  7,  0,  0,  0,  0,  0, 35,  0,  4,  0,  0,  0,
-  5,  0,  0,  0,  0,  0, 35,  0,  4,  0,  0,  0,  7,  0,  0,  0,  0,  0, 35,  0,  5,  0,  0,  0,  6,  0,  0,  0,  0,  0, 35,  0,
-  6,  0,  0,  0,  7,  0,  0,  0,  0,  0, 35,  0, 68, 65, 84, 65, 84,  1,  0,  0,200, 97,229,  2, 85,  1,  0,  0,  5,  0,  0,  0,
-  4,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 40,210,215,  2,  6,  0,  0,  0, 20,  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, 67,111,108,  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,241,113, 73, 96,  6,  0,  0,  0, 64,  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, 67,111,108,  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,241,113, 73, 96,  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,  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,  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, 68, 65, 84, 65,120,  0,  0,  0, 40,210,215,  2,
- 48,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  2,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  2,  4,  0,  0,  0,
-  7,  0,  0,  0,  6,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  4,  0,  0,  0,  5,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  2,  1,  0,  0,  0,  5,  0,  0,  0,  6,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  2,  2,  0,  0,  0,  6,  0,  0,  0,
-  7,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  2,  4,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  2,
- 66, 82,  0,  0,204,  2,  0,  0, 80, 99,229,  2, 84,  1,  0,  0,  1,  0,  0,  0, 80,102,229,  2,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 66, 82, 65,100,100,  0,104, 46, 48, 48, 49,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  2,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0, 32, 33,221,  2,
-  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0, 12,  0, 35,  0,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,  0,  0,  1,  2,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 56,  1,  0,  0,128,202, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 12,  0, 35,  0,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0,
- 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0,
- 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 16,  1,  0,  0,156, 99,229,  2, 24,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
   0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
@@ -7187,73 +8231,39 @@ char datatoc_startup_blend[]= {
   0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
   0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
   0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0, 32, 33,221,  2, 80,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63, 14,215,126,191, 54,189,194, 61,
- 14,215,126,191, 46,189,194, 61,120,235,220,  2,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0,136,208, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63, 14,215,126,191,
+ 54,189,194, 61, 14,215,126,191, 46,189,194, 61, 24,210, 22,  6,  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,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0,120,235,220,  2, 78,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 62, 31,133,107, 63,  0,  0,  0,  0,  0,  0, 64, 63, 10,215,163, 61,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82,  0,  0,204,  2,  0,  0, 80,102,229,  2, 84,  1,  0,  0,  1,  0,  0,  0,
- 80,105,229,  2, 80, 99,229,  2,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 66,108,111, 98,  0, 48, 48, 49,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0, 63,  0,  0,  0,  0,104, 34,221,  2,  1,  0,  1,  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,  1,  2,  3,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,
-  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,
   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,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0, 24,210, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62, 31,133,107, 63,  0,  0,  0,  0,  0,  0, 64, 63, 10,215,163, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0,152,210, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0, 72,219, 22,  6,
+  0,  0,  0,  0,232,201, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 84,101,
+120, 68,114, 97,119,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  2,  0,  0,  3,  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, 63,  0,  0,  0,  0, 56,217, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  2,  0, 35,  0,  0,  0,
-  4,  4,  4,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,
-  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63, 20,174,199, 62, 20,174,199, 62,
- 20,174,199, 62, 20,174,199, 62,  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0,156,102,229,  2, 24,  0,  0,  0,  1,  0,  0,  0,
-  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
   0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0,104, 34,221,  2, 80,  1,  0,  0,
-  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,
-  0,  0,128, 63,224,255,127,191, 46, 95,255,186,224,255,127,191,114, 97,255,186,216,235,220,  2,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0,216,235,220,  2,
- 78,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,
-  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82,  0,  0,204,  2,  0,  0,
- 80,105,229,  2, 84,  1,  0,  0,  1,  0,  0,  0, 80,108,229,  2, 80,102,229,  2,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 66,108,
-117,114,  0, 46, 48, 48, 52,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,176, 35,221,  2,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -7261,42 +8271,9 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0, 12,  0, 35,  0,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,
-205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,  0,  0,  1,  4,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 16,  1,  0,  0,
-156,105,229,  2, 24,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  1,  2,  3,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,
-  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65,
- 16,  1,  0,  0,176, 35,221,  2, 80,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63, 14,215,126,191, 54,189,194, 61, 14,215,126,191, 46,189,194, 61,
- 56,236,220,  2,  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,  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,  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,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 48,  0,  0,  0, 56,236,220,  2, 78,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 62, 31,133,107, 63,  0,  0,  0,  0,  0,  0, 64, 63, 10,215,163, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0, 66, 82,  0,  0,204,  2,  0,  0, 80,108,229,  2, 84,  1,  0,  0,  1,  0,  0,  0, 80,143,229,  2, 80,105,229,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 66,114,117,115,104,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,
-104,111,229,  2,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -7304,77 +8281,51 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 30,  0, 35,  0,  0,  0,  4,  4,  4,  0,  0,  0,  0,  0,
- 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,
-  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63, 20,174,199, 62, 20,174,199, 62, 20,174,199, 62, 20,174,199, 62,
-  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0,156,108,229,  2, 24,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0,104,111,229,  2, 80,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  2,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191,
- 46, 95,255,186,224,255,127,191,114, 97,255,186,152,236,220,  2,  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,  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,  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,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0,152,236,220,  2, 78,  1,  0,  0,  4,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82,  0,  0,204,  2,  0,  0, 80,143,229,  2, 84,  1,  0,  0,
-  1,  0,  0,  0, 80,146,229,  2, 80,108,229,  2,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 67,108, 97,121,  0, 48, 48, 49,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,176,112,229,  2,  1,  0,  1,  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,
-  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
   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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0, 16,  0, 35,  0,  0,  0,  4,  4,  0,  8,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 51, 51, 51, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63, 20,174,199, 62, 20,174,199, 62,  0,  0,128, 63, 68, 65, 84, 65, 56,  1,  0,  0, 48,211, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,
- 35,  0,  0,  0,  4,  4,  4,  8,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63, 20,174,199, 62,
- 20,174,199, 62, 20,174,199, 62, 20,174,199, 62,  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0,156,143,229,  2, 24,  0,  0,  0,
-  1,  0,  0,  0,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
   0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
   0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0,176,112,229,  2,
- 80,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,
-  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191, 46, 95,255,186,224,255,127,191,114, 97,255,186,248,236,220,  2,  0,  0,  0,  0,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0, 56,217, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191,
+ 46, 95,255,186,224,255,127,191,114, 97,255,186,200,218, 22,  6,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0,
-248,236,220,  2, 78,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 62,215,163,112, 63,
-  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82,  0,  0,
-204,  2,  0,  0, 80,146,229,  2, 84,  1,  0,  0,  1,  0,  0,  0, 80,149,229,  2, 80,143,229,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 66, 82, 67,108,111,110,101,  0, 48, 48, 49,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  2,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,248,113,229,  2,  1,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0,200,218, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0, 72,219, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0,248,227, 22,  6,
+  0,  0,  0,  0,152,210, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 84,104,
+117,109, 98,  0, 48, 48, 49,  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,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  3,  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, 63,  0,  0,  0,  0,232,225, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
   0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -7391,86 +8342,14 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0, 16,  0, 35,  0,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,
-102,102,102, 63,205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 51, 51, 51, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,
-  0,  0,  0, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 16,  1,  0,  0,156,146,229,  2, 24,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,
-  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
- 68, 65, 84, 65, 16,  1,  0,  0,248,113,229,  2, 80,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63, 14,215,126,191, 54,189,194, 61, 14,215,126,191,
- 46,189,194, 61, 88,237,220,  2,  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,  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,  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,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0, 88,237,220,  2, 78,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 62, 31,133,107, 63,  0,  0,  0,  0,  0,  0, 64, 63, 10,215,163, 61,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0, 66, 82,  0,  0,204,  2,  0,  0, 80,149,229,  2, 84,  1,  0,  0,  1,  0,  0,  0, 80,152,229,  2,
- 80,146,229,  2,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 67,114,101, 97,115,101,  0, 48, 48, 49,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,
-  0,  0,  0,  0, 64,115,229,  2,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,
-  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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,  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,
   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,  0,  0,  0,  0,  2,  0, 35,  0,  0,  0,  4,  6,  4,  0,
-  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 62,  0,  0,  0,  0,  0,  0,  0,  0, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,
-205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63, 20,174,199, 62, 20,174,199, 62, 20,174,199, 62,
- 20,174,199, 62,  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0,156,149,229,  2, 24,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0, 64,115,229,  2, 80,  1,  0,  0,  1,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,
-228, 97,175,190, 50,131,112, 63,218,243,127,191, 10,183,157,188,184,237,220,  2,  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,  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,  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,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0,184,237,220,  2, 78,  1,  0,  0,
-  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 62,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0, 64, 63,
- 10,215, 35, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82,  0,  0,204,  2,  0,  0, 80,152,229,  2,
- 84,  1,  0,  0,  1,  0,  0,  0, 80,155,229,  2, 80,149,229,  2,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 68, 97,114,107,101,110,
-  0, 48, 54,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,136,116,229,  2,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -7478,54 +8357,22 @@ char datatoc_startup_blend[]= {
   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,  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, 12,  0, 35,  0,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,  0,  0,  1,  6,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 16,  1,  0,  0,156,152,229,  2,
- 24,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,
-  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0,
-136,116,229,  2, 80,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,
-  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63, 14,215,126,191, 54,189,194, 61, 14,215,126,191, 46,189,194, 61, 24,238,220,  2,
   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,  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,  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,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 48,  0,  0,  0, 24,238,220,  2, 78,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 62,
- 31,133,107, 63,  0,  0,  0,  0,  0,  0, 64, 63, 10,215,163, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
- 66, 82,  0,  0,204,  2,  0,  0, 80,155,229,  2, 84,  1,  0,  0,  1,  0,  0,  0, 80,158,229,  2, 80,152,229,  2,  0, 20,  1,160,
-  0,  0,  0,  0, 66, 82, 68,114, 97,119,  0, 46, 48, 48, 49,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  2,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,208,117,229,  2,
-  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  2,  0, 75,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0, 12,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 62,
+  0,  0,128, 63,  0,  0,128, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 56,  1,  0,  0,224,219, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 30,  0, 35,  0,  0,  0,  0,  4,  0,  8,  0,  0,  0,  0, 10,  0,  0,  0,
- 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0,
- 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63, 20,174,199, 62, 20,174,199, 62, 20,174,199, 62, 20,174,199, 62,  0,  0,128, 63,
- 68, 65, 84, 65, 16,  1,  0,  0,156,155,229,  2, 24,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
   0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
@@ -7534,73 +8381,39 @@ char datatoc_startup_blend[]= {
   0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
   0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
   0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0,208,117,229,  2, 80,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  2,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191, 46, 95,255,186,
-224,255,127,191,114, 97,255,186,120,238,220,  2,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0,232,225, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191,
+ 46, 95,255,186,224,255,127,191,114, 97,255,186,120,227, 22,  6,  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,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0,120,238,220,  2, 78,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82,  0,  0,204,  2,  0,  0, 80,158,229,  2, 84,  1,  0,  0,  1,  0,  0,  0,
- 80,161,229,  2, 80,155,229,  2,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 70,105,108,108, 47, 68,101,101,112,101,110,  0, 48, 48,
- 49,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0, 63,  0,  0,  0,  0, 24,119,229,  2,  1,  0,  1,  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,  1,  2,  3,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,
-  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,
   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,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0,120,227, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 66, 82,  0,  0, 88,  6,  0,  0,248,227, 22,  6,  0,  0,  0,  0,123,  1,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 72,219, 22,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 84,119,
+105,115,116,  0, 48, 48, 49,  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,  0,  0,  0,  0,  0,  0,  0,
+  1,  0,  0,  3,  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, 63,  0,  0,  0,  0,152,234, 22,  6,  0,  0,  0,  0,  1,  0,  1,  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,  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,  2,  0, 35,  0,  0,  0,
-  4,  4,  4,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,
-  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,  0,  0,128, 63, 20,174,199, 62,
-  0,  0,128, 62,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0,156,158,229,  2, 24,  0,  0,  0,  1,  0,  0,  0,
-  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
   0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0, 24,119,229,  2, 80,  1,  0,  0,
-  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,
-  0,  0,128, 63,224,255,127,191, 46, 95,255,186,224,255,127,191,114, 97,255,186,216,238,220,  2,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  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,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0,216,238,220,  2,
- 78,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,
-  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82,  0,  0,204,  2,  0,  0,
- 80,161,229,  2, 84,  1,  0,  0,  1,  0,  0,  0, 80,164,229,  2, 80,158,229,  2,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 70,108,
- 97,116,116,101,110, 47, 67,111,110,116,114, 97,115,116,  0, 48, 48, 49,  0,  0,  1,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0, 96,120,229,  2,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -7608,42 +8421,9 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  2,  0, 35,  0,  0,  0,  4,  4,  4,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,
-205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  7,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,
-  0,  0,128, 63,  0,  0,128, 63, 20,174,199, 62,  0,  0,128, 62,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0,
-156,161,229,  2, 24,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  1,  2,  3,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,
-  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65,
- 16,  1,  0,  0, 96,120,229,  2, 80,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191, 46, 95,255,186,224,255,127,191,114, 97,255,186,
- 56,239,220,  2,  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,  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,  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,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 48,  0,  0,  0, 56,239,220,  2, 78,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0, 66, 82,  0,  0,204,  2,  0,  0, 80,164,229,  2, 84,  1,  0,  0,  1,  0,  0,  0, 80,167,229,  2, 80,161,229,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 71,114, 97, 98,  0, 48, 48, 49,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,
-168,121,229,  2,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -7651,86 +8431,47 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0, 75,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
-  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,
-  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 62,  0,  0,128, 63,  0,  0,128, 62,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 16,  1,  0,  0,156,164,229,  2, 24,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0,168,121,229,  2, 80,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191,
- 46, 95,255,186,224,255,127,191,114, 97,255,186,152,239,220,  2,  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,  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,  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,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0,152,239,220,  2, 78,  1,  0,  0,  4,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82,  0,  0,204,  2,  0,  0, 80,167,229,  2, 84,  1,  0,  0,
-  1,  0,  0,  0, 80,170,229,  2, 80,164,229,  2,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 73,110,102,108, 97,116,101, 47, 68,101,
-102,108, 97,116,101,  0, 48, 48, 49,  0,  0,  0,  1,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,240,122,229,  2,  1,  0,  1,  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,
-  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
   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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  2,  0, 75,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 14,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 62,
+  0,  0,128, 63,  0,  0,128, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 56,  1,  0,  0,144,228, 22,  6,
+  0,  0,  0,  0, 25,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,
- 35,  0,  0,  0,  4,  4,  4,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0, 64, 63,  0,  0, 64, 63,
-  0,  0, 64, 63,  0,  0,128, 62,  0,  0,128, 62,  0,  0,128, 62, 68, 65, 84, 65, 16,  1,  0,  0,156,167,229,  2, 24,  0,  0,  0,
-  1,  0,  0,  0,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
   0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
   0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0,240,122,229,  2,
- 80,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,
-  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191, 46, 95,255,186,224,255,127,191,114, 97,255,186,248,239,220,  2,  0,  0,  0,  0,
+  0,  0,128, 63, 68, 65, 84, 65, 64,  1,  0,  0,152,234, 22,  6,  0,  0,  0,  0,119,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191,
+ 46, 95,255,186,224,255,127,191,114, 97,255,186, 40,236, 22,  6,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0,
-248,239,220,  2, 78,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 62,215,163,112, 63,
-  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82,  0,  0,
-204,  2,  0,  0, 80,170,229,  2, 84,  1,  0,  0,  1,  0,  0,  0, 80,173,229,  2, 80,167,229,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 66, 82, 76, 97,121,101,114,  0, 48, 48, 49,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0, 56,124,229,  2,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,128, 63,  0,  0,128, 63,
+  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+ 48,  0,  0,  0, 40,236, 22,  6,  0,  0,  0,  0,117,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
+  0,  0,  0,  0, 85, 83, 69, 82,112, 38,  0,  0, 32,125, 29,  5,  0,  0,  0,  0,209,  0,  0,  0,  1,  0,  0,  0,  1,  8, 17,  1,
+ 63,  6,  0,  0,  5,  0,  0,  0, 47,116,109,112,  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, 12,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -7738,42 +8479,7 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  2,  0, 35,  0,  0,  0,  4,  4,  4,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,
-102,102,102, 63,205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,
-  0,  0,  0, 62,  0,  0,128, 63, 20,174,199, 62, 20,174,199, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 16,  1,  0,  0,156,170,229,  2, 24,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,
-  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
- 68, 65, 84, 65, 16,  1,  0,  0, 56,124,229,  2, 80,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,
-  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191, 46, 95,255,186,224,255,127,191,
-114, 97,255,186, 88,240,220,  2,  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,  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,  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,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0, 88,240,220,  2, 78,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0, 66, 82,  0,  0,204,  2,  0,  0, 80,173,229,  2, 84,  1,  0,  0,  1,  0,  0,  0, 80,176,229,  2,
- 80,170,229,  2,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 76,105,103,104,116,101,110,  0, 53,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,
-  0,  0,  0,  0,128,125,229,  2,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,
-  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,
@@ -7781,86 +8487,26 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 12,  0, 35,  0,  0,  0,  4,  4,  0,  0,
-  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-205,204, 76, 62,  0,  0,  0,  0,  0,  0,  0,  0,  1,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,
-205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 16,  1,  0,  0,156,173,229,  2, 24,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0,128,125,229,  2, 80,  1,  0,  0,  1,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,
- 14,215,126,191, 54,189,194, 61, 14,215,126,191, 46,189,194, 61,184,240,220,  2,  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,  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,  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,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0,184,240,220,  2, 78,  1,  0,  0,
-  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 62, 31,133,107, 63,  0,  0,  0,  0,  0,  0, 64, 63,
- 10,215,163, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82,  0,  0,204,  2,  0,  0, 80,176,229,  2,
- 84,  1,  0,  0,  1,  0,  0,  0, 80,179,229,  2, 80,173,229,  2,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 77,105,120,  0,104,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,200,126,229,  2,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 47, 47,  0, 85,115,101,114,115, 47,116,111,110, 47, 68,101,115,107,116,111,112, 47,  0, 45,112,
+111,119,101,114,112, 99, 47, 98,105,110, 47, 98,108,101,110,100,101,114, 46, 97,112,112, 47, 67,111,110,116,101,110,116,115, 47,
+ 82,101,115,111,117,114, 99,101,  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,  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,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0, 12,  0, 35,  0,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 51, 51, 51, 63,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 16,  1,  0,  0,156,176,229,  2,
- 24,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,
-  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0,
-200,126,229,  2, 80,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,
-  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63, 14,215,126,191, 54,189,194, 61, 14,215,126,191, 46,189,194, 61, 24,241,220,  2,
   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,  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,  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,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 48,  0,  0,  0, 24,241,220,  2, 78,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 62,
- 31,133,107, 63,  0,  0,  0,  0,  0,  0, 64, 63, 10,215,163, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
- 66, 82,  0,  0,204,  2,  0,  0, 80,179,229,  2, 84,  1,  0,  0,  1,  0,  0,  0,104,182,229,  2, 80,176,229,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 66, 82, 77,117,108,116,105,112,108,121,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  2,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0, 16,128,229,  2,
-  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -7868,42 +8514,12 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 12,  0, 35,  0,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0,
- 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0,
- 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 16,  1,  0,  0,156,179,229,  2, 24,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0, 16,128,229,  2, 80,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63, 14,215,126,191, 54,189,194, 61,
- 14,215,126,191, 46,189,194, 61,120,241,220,  2,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 47, 47,  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,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0,120,241,220,  2, 78,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 62, 31,133,107, 63,  0,  0,  0,  0,  0,  0, 64, 63, 10,215,163, 61,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82,  0,  0,204,  2,  0,  0,104,182,229,  2, 84,  1,  0,  0,  1,  0,  0,  0,
-112,185,229,  2, 80,179,229,  2,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 78,117,100,103,101,  0, 48, 48, 49,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0, 63,  0,  0,  0,  0, 88,129,229,  2,  1,  0,  1,  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,  1,  2,  3,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,
-  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,
@@ -7911,43 +8527,11 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0, 35,  0,  0,  0,
-  4,  4,  4,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0, 11,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,
-  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 62,  0,  0,128, 63,  0,  0,128, 62,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 16,  1,  0,  0,180,182,229,  2, 24,  0,  0,  0,  1,  0,  0,  0,
-  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0, 88,129,229,  2, 80,  1,  0,  0,
-  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,
-  0,  0,128, 63,224,255,127,191, 46, 95,255,186,224,255,127,191,114, 97,255,186,216,241,220,  2,  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,  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,  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,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0,216,241,220,  2,
- 78,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,
-  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82,  0,  0,204,  2,  0,  0,
-112,185,229,  2, 84,  1,  0,  0,  1,  0,  0,  0,120,188,229,  2,104,182,229,  2,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 80,105,
-110, 99,104, 47, 77, 97,103,110,105,102,121,  0, 48, 48, 49,  0,  0,  0,  0,  0,  1,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,160,130,229,  2,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -7955,42 +8539,9 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  6,  0, 35,  0,  0,  0,  4,  4,  4,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,
-205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,
-  0,  0, 64, 63,  0,  0, 64, 63,  0,  0, 64, 63,  0,  0,128, 62,  0,  0,128, 62,  0,  0,128, 62, 68, 65, 84, 65, 16,  1,  0,  0,
-188,185,229,  2, 24,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  1,  2,  3,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,
-  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65,
- 16,  1,  0,  0,160,130,229,  2, 80,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191, 46, 95,255,186,224,255,127,191,114, 97,255,186,
- 56,242,220,  2,  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,  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,  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,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 48,  0,  0,  0, 56,242,220,  2, 78,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0, 66, 82,  0,  0,204,  2,  0,  0,120,188,229,  2, 84,  1,  0,  0,  1,  0,  0,  0,128,191,229,  2,112,185,229,  2,
-253, 21,192, 32,  0,  0,  0,  0, 66, 82, 80,111,108,105,115,104,  0, 48, 48, 49,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,
-232,131,229,  2,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -7998,42 +8549,13 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0, 35,  0,  0,  0,  4,  4,  4,  1,  0,  0,  0,  0,
- 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,
-  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,  0,  0,128, 63, 20,174,199, 62,  0,  0,128, 62,  0,  0,128, 63,
-  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0,196,188,229,  2, 24,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0,232,131,229,  2, 80,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191,
- 46, 95,255,186,224,255,127,191,114, 97,255,186,152,242,220,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 47, 47,  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,  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,  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,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0,152,242,220,  2, 78,  1,  0,  0,  4,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82,  0,  0,204,  2,  0,  0,128,191,229,  2, 84,  1,  0,  0,
-  1,  0,  0,  0,136,194,229,  2,120,188,229,  2,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 83, 99,114, 97,112,101, 47, 80,101, 97,
-107,115,  0, 48, 48, 49,  0,  0,  0,  0,  0,  0,  1,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0, 48,133,229,  2,  1,  0,  1,  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,
-  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
   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,  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,
@@ -8041,43 +8563,11 @@ char datatoc_startup_blend[]= {
   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,  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,  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,  2,  0,
- 35,  0,  0,  0,  4,  4,  4,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,  0,  0,128, 63,
- 20,174,199, 62,  0,  0,128, 62,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0,204,191,229,  2, 24,  0,  0,  0,
-  1,  0,  0,  0,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0, 48,133,229,  2,
- 80,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,
-  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191, 46, 95,255,186,224,255,127,191,114, 97,255,186,248,242,220,  2,  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,  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,
   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,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0,
-248,242,220,  2, 78,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 62,215,163,112, 63,
-  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82,  0,  0,
-204,  2,  0,  0,136,194,229,  2, 84,  1,  0,  0,  1,  0,  0,  0,144,197,229,  2,128,191,229,  2, 12,215,  0, 32,  0,  0,  0,  0,
- 66, 82, 83, 99,117,108,112,116, 68,114, 97,119,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,120,134,229,  2,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -8085,42 +8575,7 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  2,  0, 35,  0,  0,  0,  4,  4,  4,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,
-102,102,102, 63,205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,
-160,119, 78, 63,  0,  0,128, 63, 20,174,199, 62, 20,174,199, 62, 20,174,199, 62, 20,174,199, 62,  0,  0,128, 63, 68, 65, 84, 65,
- 16,  1,  0,  0,212,194,229,  2, 24,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,
-  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
- 68, 65, 84, 65, 16,  1,  0,  0,120,134,229,  2, 80,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,
-  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191, 46, 95,255,186,224,255,127,191,
-114, 97,255,186, 88,243,220,  2,  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,  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,  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,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0, 88,243,220,  2, 78,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0, 66, 82,  0,  0,204,  2,  0,  0,144,197,229,  2, 84,  1,  0,  0,  1,  0,  0,  0,152,200,229,  2,
-136,194,229,  2,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 83,109,101, 97,114,  0, 48, 48, 49,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  1,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,
-  0,  0,  0,  0,192,135,229,  2,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,
-  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,
@@ -8128,43 +8583,12 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16,  0, 35,  0,  0,  0,  4,  4,  0,  0,
-  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-205,204, 76, 62,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,
-205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 16,  1,  0,  0,220,197,229,  2, 24,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0,192,135,229,  2, 80,  1,  0,  0,  1,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,
- 14,215,126,191, 54,189,194, 61, 14,215,126,191, 46,189,194, 61,184,243,220,  2,  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,  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,  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,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0,184,243,220,  2, 78,  1,  0,  0,
-  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 62, 31,133,107, 63,  0,  0,  0,  0,  0,  0, 64, 63,
- 10,215,163, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82,  0,  0,204,  2,  0,  0,152,200,229,  2,
- 84,  1,  0,  0,  1,  0,  0,  0,160,203,229,  2,144,197,229,  2,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 83,109,111,111,116,104,
-  0, 48, 48, 49,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,  8,137,229,  2,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -8172,42 +8596,10 @@ char datatoc_startup_blend[]= {
   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,  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,  2,  0, 35,  0,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0,  5,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0, 64, 63,
-  0,  0, 64, 63,  0,  0, 64, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 16,  1,  0,  0,228,200,229,  2,
- 24,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,
-  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0,
-  8,137,229,  2, 80,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,
-  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191, 46, 95,255,186,224,255,127,191,114, 97,255,186, 24,244,220,  2,
   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,  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,  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,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 48,  0,  0,  0, 24,244,220,  2, 78,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 62,
-215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
- 66, 82,  0,  0,204,  2,  0,  0,160,203,229,  2, 84,  1,  0,  0,  1,  0,  0,  0,168,206,229,  2,152,200,229,  2,  0,  0,  0,  0,
-  0,  0,  0,  0, 66, 82, 83,110, 97,107,101, 32, 72,111,111,107,  0, 48, 48, 49,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  3,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0, 80,138,229,  2,
-  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -8215,42 +8607,11 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0, 75,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0,
- 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,
-  0,  0,  0,  0, 13,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0,
- 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 62,  0,  0,128, 63,  0,  0,128, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 16,  1,  0,  0,236,203,229,  2, 24,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0, 80,138,229,  2, 80,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,
-  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191, 46, 95,255,186,
-224,255,127,191,114, 97,255,186,120,244,220,  2,  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,  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,  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,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0,120,244,220,  2, 78,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82,  0,  0,204,  2,  0,  0,168,206,229,  2, 84,  1,  0,  0,  1,  0,  0,  0,
-176,209,229,  2,160,203,229,  2,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 83,111,102,116,101,110,  0, 48, 49,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0, 63,  0,  0,  0,  0,152,139,229,  2,  1,  0,  1,  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,  1,  2,  3,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,
-  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,
@@ -8258,43 +8619,11 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16,  0, 35,  0,  0,  0,
-  4,  4,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,
-  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 16,  1,  0,  0,244,206,229,  2, 24,  0,  0,  0,  1,  0,  0,  0,
-  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0,152,139,229,  2, 80,  1,  0,  0,
-  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,
-  0,  0,128, 63, 14,215,126,191, 54,189,194, 61, 14,215,126,191, 46,189,194, 61,216,244,220,  2,  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,  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,  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,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0,216,244,220,  2,
- 78,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 62, 31,133,107, 63,  0,  0,  0,  0,
-  0,  0, 64, 63, 10,215,163, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82,  0,  0,204,  2,  0,  0,
-176,209,229,  2, 84,  1,  0,  0,  1,  0,  0,  0,184,212,229,  2,168,206,229,  2,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 83,117,
- 98,116,114, 97, 99,116,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,224,140,229,  2,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -8302,42 +8631,9 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0, 12,  0, 35,  0,  0,  0,  4,  4,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,
-205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,  0,  0,  1,  2,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 16,  1,  0,  0,
-252,209,229,  2, 24,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  1,  2,  3,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,
-  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65,
- 16,  1,  0,  0,224,140,229,  2, 80,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63, 14,215,126,191, 54,189,194, 61, 14,215,126,191, 46,189,194, 61,
- 56,245,220,  2,  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,  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,  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,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 68, 65, 84, 65, 48,  0,  0,  0, 56,245,220,  2, 78,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 62, 31,133,107, 63,  0,  0,  0,  0,  0,  0, 64, 63, 10,215,163, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,  0,  0, 66, 82,  0,  0,204,  2,  0,  0,184,212,229,  2, 84,  1,  0,  0,  1,  0,  0,  0,192,215,229,  2,176,209,229,  2,
-  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 84,101,120, 68,114, 97,119,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  2,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,
-128,  0,220,  3,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -8345,42 +8641,13 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16,  0, 35,  0,  0,  0,  4,  4,  0,  8,  0,  0,  0,  0,
- 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 51, 51, 51, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,
-  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 20,174,199, 62, 20,174,199, 62,
-  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0,  4,213,229,  2, 24,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0,128,  0,220,  3, 80,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  2,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191,
- 46, 95,255,186,224,255,127,191,114, 97,255,186,152,245,220,  2,  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,  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,  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,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0,152,245,220,  2, 78,  1,  0,  0,  4,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82,  0,  0,204,  2,  0,  0,192,215,229,  2, 84,  1,  0,  0,
-  1,  0,  0,  0,200,218,229,  2,184,212,229,  2,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82, 84,104,117,109, 98,  0, 48, 48, 49,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0,200,  1,220,  3,  1,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 47, 47,  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,  0,  0,  0,  0,
-  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
   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,  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,
@@ -8388,43 +8655,11 @@ char datatoc_startup_blend[]= {
   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,  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,  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,  2,  0,
- 75,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,102,102,102, 63,205,204,204, 61,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0, 12,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 62,  0,  0,128, 62,  0,  0,128, 63,
-  0,  0,128, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 16,  1,  0,  0, 12,216,229,  2, 24,  0,  0,  0,
-  1,  0,  0,  0,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63, 68, 65, 84, 65, 16,  1,  0,  0,200,  1,220,  3,
- 80,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,
-  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191, 46, 95,255,186,224,255,127,191,114, 97,255,186,128, 32,220,  3,  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,  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,
   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,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0,
-128, 32,220,  3, 78,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 62,215,163,112, 63,
-  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0, 66, 82,  0,  0,
-204,  2,  0,  0,200,218,229,  2, 84,  1,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,192,215,229,  2,  0,  0,  0,  0,  0,  0,  0,  0,
- 66, 82, 84,119,105,115,116,  0, 48, 48, 49,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  3,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0,  0, 16,  3,220,  3,  1,  0,  1,  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,  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -8432,49 +8667,23 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  2,  0, 75,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0, 10,  0,  0,  0, 75,  0,  0,  0,
-102,102,102, 63,205,204,204, 61,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,
- 14,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,205,204,204, 62,  0,  0,  0,  0, 33,  0,  0,  0,
-  0,  0,  0, 62,  0,  0,128, 62,  0,  0,128, 63,  0,  0,128, 62,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
- 16,  1,  0,  0, 20,219,229,  2, 24,  0,  0,  0,  1,  0,  0,  0,  1,  0,  1,  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,
-  1,  2,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-128,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,205,204, 76, 62,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
- 68, 65, 84, 65, 16,  1,  0,  0, 16,  3,220,  3, 80,  1,  0,  0,  1,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,
-  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,
-  0,  0,128, 63,  4,  0,  0,  0,  0,  0,128, 67,  0,  0,  0,  0,  0,  0,128, 63,224,255,127,191, 46, 95,255,186,224,255,127,191,
-114, 97,255,186,224, 32,220,  3,  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,  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,  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,  0,  0,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 68, 65, 84, 65, 48,  0,  0,  0,224, 32,220,  3, 78,  1,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,128, 62,215,163,112, 63,  0,  0,  0,  0,  0,  0, 64, 63,143,194,117, 61,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,  0,  0,  0,  0,  0,  0, 85, 83, 69, 82,144, 13,  0,  0,224,124, 22,  1,192,  0,  0,  0,  1,  0,  0,  0,  1,  8, 17,  1,
- 63,  6,  0,  0,  5,  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,  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,  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,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 47, 47,  0, 85,115,101,114,115, 47,116,111,110, 47, 68,101,115,107,116,111,112, 47,  0, 45,112,
-111,119,101,114,112, 99, 47, 98,105,110, 47, 98,108,101,110,100,101,114, 46, 97,112,112, 47, 67,111,110,116,101,110,116,115, 47,
- 82,101,115,111,117,114, 99,101,  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,  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, 47, 47,  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,  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,  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,
   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,  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, 47, 47,  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,  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,  0,  0,
@@ -8494,7 +8703,6 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 47, 47,  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,  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,  0,  0,
@@ -8514,20 +8722,7 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 35,  0,  0,  0,
-  2,  0, 94,  1,  8,  0,  0,  0,  3,  0,  0,  0, 56, 52, 39,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  8,  0,  0,  2,  0,  0,  0,
- 68,172,  0,  0, 36,  0,  0,  0,  2,  0,  0,  0,  0,  1,  0,  0, 72,  0,  0,  0,  0,  0, 64,  0,  5,  0,  2,  0, 40, 62,220,  3,
- 40, 62,220,  3,112, 25,221,  2,112, 25,221,  2,168, 92,220,  3,168, 92,220,  3,  0,  0,  0,  0,  0,  0,  0,  0, 32, 19,216,  2,
-224, 22,216,  2,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0, 32,  0,  0,  0,  1,  0,  2,  0, 25,  0,  0,  0, 20,  0, 20,  0,  1,  0,  0,  0,  0,  0,  0,  0,205,204, 76, 63,
-205,204, 76, 63,205,204, 76, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63, 30, 90,100,191,
-154,153,153, 62,102,102,102, 63,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 31,250,254, 62,  9,  0,  0, 63,156,153, 25, 63,
-  0,  0,  0,  0,205,204, 76, 62,205,204, 76, 62,205,204, 76, 62,  0,  0,128, 63, 44,135, 22, 63, 32,133,235, 62,184,243,125, 62,
-  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,195, 73, 76, 63, 42,135, 86, 63,  0,  0,128, 63,  0,  0,  0,  0,  1, 43,135, 61,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63, 16, 47, 93, 62, 58,180,200,190, 24, 47, 93,190,  0,  0,  0,  0, 14,  0,  1,  0,
- 25,  0, 15,  0,120,  0, 60,  0,  3,  0,  5,  0,128,  0,  0,  0,  0,  0,  0,  0,144, 31, 15,  0,  6,  0, 25,  0,  8,  0, 10,  0,
-200,  0,  0,  0,100,  0,100,  0,  0,  0,  0,  0,  2,  0,  1,  0, 10,  0, 50,  0, 20,  0,  1,  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,  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,  0,  0,  0,  0,  0,
@@ -8537,10 +8732,25 @@ char datatoc_startup_blend[]= {
   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,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  2,  0,  2,  0,  8,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
-  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,
-  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,
+  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 35,  0,  0,  0,  2,  0, 94,  1,  8,  0,  0,  0,  3,  0,  0,  0, 56, 52, 39,  0,
+  0,  0,  0,  0,  1,  0,  2,  0,  0,  8,  0,  0,  2,  0,  0,  0, 68,172,  0,  0, 36,  0,  0,  0,  2,  0,  0,  0,  0,  1,  0,  0,
+ 72,  0,  0,  0,  0,  0, 64,  0,  5,  0,  2,  0,104, 19, 23,  6,  0,  0,  0,  0,104, 19, 23,  6,  0,  0,  0,  0,120,248, 22,  6,
+  0,  0,  0,  0,120,248, 22,  6,  0,  0,  0,  0, 88, 61, 23,  6,  0,  0,  0,  0, 88, 61, 23,  6,  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,120,228, 21,  6,
+  0,  0,  0,  0,184, 60, 23,  6,  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,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 32,  0,  0,  0,  1,  0,  2,  0, 25,  0,  0,  0, 20,  0, 20,  0,  1,  0,  0,  0,
+  0,  0,  0,  0,205,204, 76, 63,205,204, 76, 63,205,204, 76, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,
+  0,  0,128, 63, 30, 90,100,191,154,153,153, 62,102,102,102, 63,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0, 31,250,254, 62,
+  9,  0,  0, 63,156,153, 25, 63,  0,  0,  0,  0,205,204, 76, 62,205,204, 76, 62,205,204, 76, 62,  0,  0,128, 63, 44,135, 22, 63,
+ 32,133,235, 62,184,243,125, 62,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,195, 73, 76, 63, 42,135, 86, 63,  0,  0,128, 63,
+  0,  0,  0,  0,  1, 43,135, 61,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63, 16, 47, 93, 62, 58,180,200,190, 24, 47, 93,190,
+  0,  0,  0,  0, 14,  0,  1,  0, 25,  0, 15,  0,120,  0, 60,  0,  3,  0,  5,  0,128,  0,  0,  0,  0,  0,  0,  0,144, 31, 15,  0,
+  6,  0, 25,  0,  8,  0, 10,  0,200,  0,  0,  0,  0,  0,  0,  0,  2,  0,  4,  0, 10,  0, 50,  0, 20,  0,  2,  0,  1,  0,  0,  0,
+  0,  0,128, 63, 60,  0,  0,  0,  0,  0,  2,  0,  2,  0,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,128, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,  0,  0,128, 63,
   0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,
   0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,
   0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,
@@ -8562,2136 +8772,2431 @@ char datatoc_startup_blend[]= {
   0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,
   0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,
   0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,
+  0,  0,  0,  0,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 63,
+  0,  0,  0, 63,  0,  0,  0, 63,  0,  0,128, 63,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0, 10,  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,  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,128, 62,  0,  0,  0,  0, 68, 65, 84, 65,168, 36,  0,  0,104, 19, 23,  6,  0,  0,  0,  0,206,  0,  0,  0,
+  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68,101,102, 97,117,108,116,  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, 25, 25, 25,255,153,153,153,255,100,100,100,255,
+ 25, 25, 25,255,  0,  0,  0,255,255,255,255,255,  0,  0,  0,  0,  0,  0,  0,  0, 25, 25, 25,255,153,153,153,255,100,100,100,255,
+ 25, 25, 25,255,  0,  0,  0,255,255,255,255,255,  1,  0, 15,  0,241,255,  0,  0, 25, 25, 25,255,153,153,153,255,153,153,153,255,
+ 90, 90, 90,255,  0,  0,  0,255,255,255,255,255,  1,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,255, 70, 70, 70,255, 86,128,194,255,
+255,255,255,255,255,255,255,255,  0,  0,  0,255,  1,  0, 15,  0,241,255,  0,  0,  0,  0,  0,255, 70, 70, 70,255, 70, 70, 70,255,
+255,255,255,255,  0,  0,  0,255,255,255,255,255,  1,  0, 15,  0,241,255,  0,  0, 25, 25, 25,255,153,153,153,255,100,100,100,255,
+ 25, 25, 25,255,  0,  0,  0,255,255,255,255,255,  0,  0,  0,  0,  0,  0,  0,  0, 25, 25, 25,255,180,180,180,255,153,153,153,255,
+ 90, 90, 90,255,  0,  0,  0,255,255,255,255,255,  1,  0,236,255,  0,  0,  0,  0, 25, 25, 25,255,180,180,180,255,153,153,153,255,
+128,128,128,255,  0,  0,  0,255,255,255,255,255,  1,  0,236,255,  0,  0,  0,  0,  0,  0,  0,255, 70, 70, 70,255, 70, 70, 70,255,
+255,255,255,255,255,255,255,255,204,204,204,255,  1,  0, 15,  0,241,255,  0,  0,  0,  0,  0,255, 63, 63, 63,255, 86,128,194,255,
+255,255,255,255,  0,  0,  0,255,  0,  0,  0,255,  0,  0, 25,  0,236,255,  0,  0,  0,  0,  0,255, 25, 25, 25,230, 45, 45, 45,230,
+100,100,100,255,160,160,160,255,255,255,255,255,  0,  0, 25,  0,236,255,  0,  0,  0,  0,  0,255,  0,  0,  0,  0, 86,128,194,255,
+172,172,172,128,255,255,255,255,  0,  0,  0,255,  1,  0, 38,  0,  0,  0,  0,  0,  0,  0,  0,255, 25, 25, 25,230, 45, 45, 45,230,
+100,100,100,255,255,255,255,255,255,255,255,255,  0,  0, 25,  0,236,255,  0,  0, 25, 25, 25,255,128,128,128,255,100,100,100,255,
+ 25, 25, 25,255,  0,  0,  0,255,255,255,255,255,  0,  0,  0,  0,  0,  0,  0,  0, 50, 50, 50,180, 80, 80, 80,180,100,100,100,180,
+128,128,128,255,  0,  0,  0,255,255,255,255,255,  1,  0,  5,  0,251,255,  0,  0,  0,  0,  0,255,190,190,190,255,100,100,100,180,
+ 68, 68, 68,255,  0,  0,  0,255,255,255,255,255,  0,  0,  5,  0,251,255,  0,  0,  0,  0,  0,255,  0,  0,  0,  0, 86,128,194,255,
+  0,  0,  0,255,  0,  0,  0,255,  0,  0,  0,255,  0,  0,  0,  0,  0,  0,  0,  0,115,190, 76,255, 90,166, 51,255,240,235,100,255,
+215,211, 75,255,180,  0,255,255,153,  0,230,255,  0,  0,  0, 63,  0,  0,  0,  0,  0,  0,  0, 25,  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,  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,  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,  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,
+  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 63,
+  0,  0,  0,  0,114,114,114,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,130,130,130,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,160,160,160,100,127,112,112,100,  0,  0,  0,  0,
+ 64, 64, 64,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,255,140, 25,255,  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,
+255,160,  0,255,219, 37, 18,255,255, 32, 32,255, 75, 75, 75,255,  0,  0,  0,  0,  0,  0,  0, 18,255,133,  0, 60,255,133,  0,255,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80,
+  0,  0,  0,  0,  0,  0,  0,  0, 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,
+  0,  0,  0,  0,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,  0,  0,  0,  0,255,240,255, 64,255,
+ 64,192, 48,255,240,144,160,255,  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,  3,  0,  4,  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,  0,  0,  0,
+  0,  0,  0,  0,255,255,255,128,  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,  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, 57, 57, 57,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,165,165,165,127,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,160,160,160,100,127,112,112,100,  0,  0,  0,  0,
+ 64, 64, 64,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,  0,  0,  0,255,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,255,170, 64,255,  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,
+255,160,  0,255,219, 37, 18,255, 32,255,255,255, 75, 75, 75,255,204,  0,153,255,  0,  0,  0, 18,255,133,  0, 60,255,133,  0,255,
+ 32,  0,  0,255,  0, 32,  0,255,  0,  0,128,255,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80,
+  0,  0,  0,  0,  0,  0,  0,  0, 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,
+255,255,255,255,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,  0,  0,  0,  0,255,240,255, 64,255,
+ 64,192, 48,255,240,144,160,255,  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,  3,  1,  4,  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,  0,  0,  0,
+  0,  0,  0,  0,255,255,255,128,  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,200,200,200,255,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,255,  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, 76, 76, 76,255,  0,  0,  0,  0,250,250,250,255, 15, 15, 15,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,102,102,102,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,145,145,145,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,160,160,160,100,127,112,112,100,255,140, 25,255,
+250,250,250,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,130,130,130,255,  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,
+255,160,  0,255,219, 37, 18,255,255, 32, 32,255, 75, 75, 75,255,  0,  0,  0,  0,  0,  0,  0, 18,255,133,  0, 60,255,133,  0,255,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80,
+  0,  0,  0,  0,  0,  0,  0,  0, 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,
+  0,  0,  0,  0,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,  0,  0,  0,  0,255,240,255, 64,255,
+ 64,192, 48,255,240,144,160,255,  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,  3,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+250,250,250,255,  0,  0,  0,  0,250,250,250,255,250,250,250,255,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,255,255,255,128,  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,  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,107,107,107,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,102,102,102,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,255,255,255,150,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,150,150,150,100,112,112,112,100, 96,192, 64,255,
+ 94, 94, 94,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,255,140, 25,255, 79,101, 73,255,135,177,125,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,
+255,160,  0,255,219, 37, 18,255,255, 32, 32,255, 75, 75, 75,255,  0,  0,  0,  0,  0,  0,  0, 18,255,133,  0, 60,255,133,  0,255,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80,
+  0,  0,  0,  0,  0,  0,  0,  0, 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,
+  0,  0,  0,  0,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,153, 64, 48,255,  0,  0,  0,255,240,255, 64,255,
+ 64,192, 48,255,240,144,160,255,240,175,144,255, 82, 96,110,255,124,137,150,255,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  4,  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,  0,  0,  0,
+  0,  0,  0,  0,255,255,255,128,  0,  0,  0,255,255,133,  0,255,  4,  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,  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, 68, 65, 84, 65, 80, 30,  0,  0, 40, 62,220,  3,189,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68,101,102, 97,117,108,116,  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, 25, 25, 25,255,153,153,153,255,100,100,100,255, 25, 25, 25,255,  0,  0,  0,255,255,255,255,255,
-  0,  0,  0,  0,  0,  0,  0,  0, 25, 25, 25,255,153,153,153,255,100,100,100,255, 25, 25, 25,255,  0,  0,  0,255,255,255,255,255,
-  1,  0, 15,  0,241,255,  0,  0, 25, 25, 25,255,153,153,153,255,153,153,153,255, 90, 90, 90,255,  0,  0,  0,255,255,255,255,255,
-  1,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,255, 70, 70, 70,255, 86,128,194,255,255,255,255,255,255,255,255,255,  0,  0,  0,255,
-  1,  0, 15,  0,241,255,  0,  0,  0,  0,  0,255, 70, 70, 70,255, 70, 70, 70,255,255,255,255,255,  0,  0,  0,255,255,255,255,255,
-  1,  0, 15,  0,241,255,  0,  0, 25, 25, 25,255,153,153,153,255,100,100,100,255, 25, 25, 25,255,  0,  0,  0,255,255,255,255,255,
-  0,  0,  0,  0,  0,  0,  0,  0, 25, 25, 25,255,180,180,180,255,153,153,153,255, 90, 90, 90,255,  0,  0,  0,255,255,255,255,255,
-  1,  0,236,255,  0,  0,  0,  0, 25, 25, 25,255,180,180,180,255,153,153,153,255,128,128,128,255,  0,  0,  0,255,255,255,255,255,
-  1,  0,236,255,  0,  0,  0,  0,  0,  0,  0,255, 70, 70, 70,255, 70, 70, 70,255,255,255,255,255,255,255,255,255,204,204,204,255,
-  1,  0, 15,  0,241,255,  0,  0,  0,  0,  0,255, 63, 63, 63,255, 86,128,194,255,255,255,255,255,  0,  0,  0,255,  0,  0,  0,255,
-  0,  0, 25,  0,236,255,  0,  0,  0,  0,  0,255, 25, 25, 25,230, 45, 45, 45,230,100,100,100,255,160,160,160,255,255,255,255,255,
-  0,  0, 25,  0,236,255,  0,  0,  0,  0,  0,255,  0,  0,  0,  0, 86,128,194,255,255,255,255,255,255,255,255,255,  0,  0,  0,255,
-  1,  0, 38,  0,  0,  0,  0,  0, 25, 25, 25,255,128,128,128,255,100,100,100,255, 25, 25, 25,255,  0,  0,  0,255,255,255,255,255,
-  0,  0,  0,  0,  0,  0,  0,  0, 50, 50, 50,180, 80, 80, 80,180,100,100,100,180,128,128,128,255,  0,  0,  0,255,255,255,255,255,
-  1,  0,  5,  0,251,255,  0,  0,  0,  0,  0,255,190,190,190,255,100,100,100,180, 68, 68, 68,255,  0,  0,  0,255,255,255,255,255,
-  0,  0,  5,  0,251,255,  0,  0,  0,  0,  0,255,  0,  0,  0,  0, 86,128,194,255,  0,  0,  0,255,  0,  0,  0,255,  0,  0,  0,255,
-  0,  0,  0,  0,  0,  0,  0,  0,115,190, 76,255, 90,166, 51,255,240,235,100,255,215,211, 75,255,180,  0,255,255,153,  0,230,255,
-  0,  0,  0, 63,  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,  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,114,114,114,255,  0,  0,  0,  0,
-  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,
-  0,  0,  0,255,255,255,255,255,165,165,165,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,130,130,130,255,  0,  0,  0,255,
-  0,  0,  0,255,255,255,255,255,160,160,160,100,127,112,112,100,  0,  0,  0,  0, 64, 64, 64,255,  0,  0,  0,255,241, 88,  0,255,
-  0,  0,  0, 40,255,140, 25,255,  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,
+  0,  0,  0,  0,114,114,114,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,165,165,165,127,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,160,160,160,100,127,112,112,100,  0,  0,  0,  0,
+ 64, 64, 64,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,255,140, 25,255,  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,
 255,160,  0,255,219, 37, 18,255,255, 32, 32,255, 75, 75, 75,255,  0,  0,  0,  0,  0,  0,  0, 18,255,133,  0, 60,255,133,  0,255,
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80,
   0,  0,  0,  0,  0,  0,  0,  0, 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,
-  0,  0,  0,  0,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,255,240,255, 64,255, 64,192, 48,255,
-240,144,160,255,  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,
-  3,  0,  4,  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,  0,  0,  0,255,255,255,128,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 57, 57, 57,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,
-114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,
-165,165,165,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,127,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,
-160,160,160,100,127,112,112,100,  0,  0,  0,  0, 64, 64, 64,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,255,170, 64,255,
-  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,255,160,  0,255,219, 37, 18,255,
- 32,255,255,255, 75, 75, 75,255,204,  0,153,255,  0,  0,  0, 18,255,133,  0, 60,255,133,  0,255, 32,  0,  0,255,  0, 32,  0,255,
-  0,  0,128,255,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80,  0,  0,  0,  0,  0,  0,  0,  0,
- 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,255,255,255,255,  0,  0,  0,255,
-144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,255,240,255, 64,255, 64,192, 48,255,240,144,160,255,  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,  3,  1,  4,  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,  0,  0,  0,255,255,255,128,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 76, 76, 76,255,  0,  0,  0,  0,250,250,250,255, 15, 15, 15,255,114,114,114,255,  0,  0,  0,255,
-  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,102,102,102,255,  0,  0,  0,255,
-  0,  0,  0,255,255,255,255,255,145,145,145,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,160,160,160,100,127,112,112,100,
-255,140, 25,255,250,250,250,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,130,130,130,255,  8, 48,  8,255, 85,187, 85,255,
-255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,255,160,  0,255,219, 37, 18,255,255, 32, 32,255, 75, 75, 75,255,
-  0,  0,  0,  0,  0,  0,  0, 18,255,133,  0, 60,255,133,  0,255,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80,  0,  0,  0,  0,  0,  0,  0,  0, 96,192, 64,255,144,144,  0,255,
-128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,  0,  0,  0,  0,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,
-128, 48, 96,255,  0,  0,  0,255,240,255, 64,255, 64,192, 48,255,240,144,160,255,  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,  3,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,250,250,250,255,250,250,250,255,250,250,250,255,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,255,255,255,128,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-107,107,107,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,
-114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,102,102,102,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,
-255,255,255,150,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,150,150,150,100,112,112,112,100, 96,192, 64,255, 94, 94, 94,255,
-  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,255,140, 25,255, 79,101, 73,255,135,177,125,255,255,255,255,255,  0,  0,  0,255,
-255,133,  0,255,  0,  0,  0,255,255,160,  0,255,219, 37, 18,255,255, 32, 32,255, 75, 75, 75,255,  0,  0,  0,  0,  0,  0,  0, 18,
-255,133,  0, 60,255,133,  0,255,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,
-200,200,200,255, 80,200,255, 80,  0,  0,  0,  0,  0,  0,  0,  0, 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,
-240,255, 64,255,240,144,160,255,  0,  0,  0,  0,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,255,
-240,255, 64,255, 64,192, 48,255,240,144,160,255, 82, 96,110,255,124,137,150,255,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,  0,  0,  0,  0,255,240,255, 64,255,
+ 64,192, 48,255,240,144,160,255,  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,  3,  0,  4,  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,  0,  0,  0,
+  0,  0,  0,  0,255,255,255,128,  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,  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,107,107,107,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,102,102,102,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,255,255,255,150,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,150,150,150,100,112,112,112,100, 96,192, 64,255,
+ 94, 94, 94,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,255,140, 25,255, 79,101, 73,255,135,177,125,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,
+255,160,  0,255,219, 37, 18,255,255, 32, 32,255, 75, 75, 75,255,  0,  0,  0,  0,  0,  0,  0, 18,255,133,  0, 60,255,133,  0,255,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80,
+ 12, 10, 10,128,255,140,  0,255, 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,
+  0,  0,  0,  0,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,  0,  0,  0,  0,255,240,255, 64,255,
+ 64,192, 48,255,240,144,160,255,  0,  0,  0,  0, 82, 96,110,255,124,137,150,255,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  4,  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,  0,  0,  0,
+  0,  0,  0,  0,255,255,255,128,  0,  0,  0,255,255,133,  0,255,  3,  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,  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,107,107,107,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,102,102,102,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,255,255,255,150,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,150,150,150,100,112,112,112,100, 96,192, 64,255,
+ 94, 94, 94,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,255,140, 25,255, 79,101, 73,255,135,177,125,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,
+255,160,  0,255,219, 37, 18,255,255, 32, 32,255, 75, 75, 75,255,  0,  0,  0,  0,  0,  0,  0, 18,255,133,  0, 60,255,133,  0,255,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80,
+ 12, 10, 10,128,255,140,  0,255, 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,
+  0,  0,  0,  0,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,  0,  0,  0,  0,255,240,255, 64,255,
+ 64,192, 48,255,240,144,160,255,  0,  0,  0,  0, 82, 96,110,255,124,137,150,255,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
   0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  4,  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,  0,  0,  0,
-255,255,255,128,  0,  0,  0,255,255,133,  0,255,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,114,114,114,255,  0,  0,  0,  0,
-  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,
-  0,  0,  0,255,255,255,255,255,165,165,165,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,127,  0,  0,  0,255,
-  0,  0,  0,255,255,255,255,255,160,160,160,100,127,112,112,100,  0,  0,  0,  0, 64, 64, 64,255,  0,  0,  0,255,241, 88,  0,255,
-  0,  0,  0, 40,255,140, 25,255,  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,
+  0,  0,  0,  0,255,255,255,128,  0,  0,  0,255,255,133,  0,255,  3,  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,  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,116,116,116,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,165,165,165,127,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,160,160,160,100,127,112,112,100,  0,  0,  0,  0,
+ 64, 64, 64,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,255,140, 25,255,  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,
 255,160,  0,255,219, 37, 18,255,255, 32, 32,255, 75, 75, 75,255,  0,  0,  0,  0,  0,  0,  0, 18,255,133,  0, 60,255,133,  0,255,
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80,
   0,  0,  0,  0,  0,  0,  0,  0, 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,
-  0,  0,  0,  0,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,255,240,255, 64,255, 64,192, 48,255,
-240,144,160,255,  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,
-  3,  0,  4,  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,  0,  0,  0,255,255,255,128,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,114,114,114,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,
-114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,
-165,165,165,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,127,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,
-173,173,173,255,127,112,112,100,  0,  0,  0,  0, 91, 91, 91,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,255,140, 25,255,
-  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,255,160,  0,255,219, 37, 18,255,
-255, 32, 32,255, 75, 75, 75,255,  0,  0,  0,  0,  0,  0,  0, 18,255,133,  0, 60,255,133,  0,255,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80,  0,  0,  0,  0,  0,  0,  0,  0,
- 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,  0,  0,  0,  0,  0,  0,  0,255,
-144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,255,240,255, 64,255, 64,192, 48,255,240,144,160,255,  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,  3,  0,  4,  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,  0,  0,  0,255,255,255,128,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,107,107,107,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,
-  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,102,102,102,255,  0,  0,  0,255,
-  0,  0,  0,255,255,255,255,255,255,255,255,150,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,150,150,150,100,112,112,112,100,
- 96,192, 64,255, 94, 94, 94,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,255,140, 25,255, 79,101, 73,255,135,177,125,255,
-255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,255,160,  0,255,219, 37, 18,255,255, 32, 32,255, 75, 75, 75,255,
-  0,  0,  0,  0,  0,  0,  0, 18,255,133,  0, 60,255,133,  0,255,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80, 12, 10, 10,128,255,140,  0,255, 96,192, 64,255,144,144,  0,255,
-128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,  0,  0,  0,  0,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,
-128, 48, 96,255,  0,  0,  0,255,240,255, 64,255, 64,192, 48,255,240,144,160,255, 82, 96,110,255,124,137,150,255,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  4,  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,  0,  0,  0,255,255,255,128,  0,  0,  0,255,255,133,  0,255,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-107,107,107,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,
-114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,102,102,102,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,
-255,255,255,150,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,150,150,150,100,112,112,112,100, 96,192, 64,255, 94, 94, 94,255,
-  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,255,140, 25,255, 79,101, 73,255,135,177,125,255,255,255,255,255,  0,  0,  0,255,
-255,133,  0,255,  0,  0,  0,255,255,160,  0,255,219, 37, 18,255,255, 32, 32,255, 75, 75, 75,255,  0,  0,  0,  0,  0,  0,  0, 18,
-255,133,  0, 60,255,133,  0,255,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,
-200,200,200,255, 80,200,255, 80, 12, 10, 10,128,255,140,  0,255, 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,
-240,255, 64,255,240,144,160,255,  0,  0,  0,  0,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,255,
-240,255, 64,255, 64,192, 48,255,240,144,160,255, 82, 96,110,255,124,137,150,255,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,  0,  0,  0,  0,255,240,255, 64,255,
+ 64,192, 48,255,240,144,160,255,  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,  3,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 81,105,135,255, 32, 32,143,255,109, 88,129,255, 78,152, 62,255, 46,143,143,255,169, 84,124,255,126,126, 80,255,162, 95,111,255,
+109,145,131,255,255,255,255,128,  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,  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,
-255,255,255,128,  0,  0,  0,255,255,133,  0,255,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,116,116,116,255,  0,  0,  0,  0,
-  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,
-  0,  0,  0,255,255,255,255,255,165,165,165,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,127,  0,  0,  0,255,
-  0,  0,  0,255,255,255,255,255,160,160,160,100,127,112,112,100,  0,  0,  0,  0, 64, 64, 64,255,  0,  0,  0,255,241, 88,  0,255,
-  0,  0,  0, 40,255,140, 25,255,  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,
+  0,  0,  0,  0, 53, 53, 53,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,165,165,165,127,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,160,160,160,100,127,112,112,100,  0,  0,  0,  0,
+ 64, 64, 64,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,255,140, 25,255,  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,
+255,160,  0,255,219, 37, 18,255,255, 32, 32,255, 75, 75, 75,255,  0,  0,  0,  0,255,255,255, 10,255,133,  0, 60,255,133,  0,255,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80,
+  0,  0,  0,  0,  0,  0,  0,  0, 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,
+  0,  0,  0,  0,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,  0,  0,  0,  0,255,240,255, 64,255,
+ 64,192, 48,255,240,144,160,255,  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,  3,  0,  3,  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,  0,  0,  0,
+  0,  0,  0,  0,255,255,255,128,  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,  0,  0,  0,  0,  0,  0,
+114,114,114,255, 18, 66,176, 38,255,133,  0,178,255,133,  0,127,  0,255,  0,255,255,  0,  0,255,225,210,195, 35,  0,  0,  0,  0,
+  0,  0,  0,  0,153,153,153,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,165,165,165,127,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,143,143,143,255,198,119,119,255,255,  0,  0,255,
+ 64, 64, 64,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,255,140, 25,255,  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,
 255,160,  0,255,219, 37, 18,255,255, 32, 32,255, 75, 75, 75,255,  0,  0,  0,  0,  0,  0,  0, 18,255,133,  0, 60,255,133,  0,255,
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80,
   0,  0,  0,  0,  0,  0,  0,  0, 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,
-  0,  0,  0,  0,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,255,240,255, 64,255, 64,192, 48,255,
-240,144,160,255,  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,
-  3,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 81,105,135,255,109, 88,129,255,
- 78,152, 62,255, 46,143,143,255,169, 84,124,255,126,126, 80,255,162, 95,111,255,109,145,131,255,255,255,255,128,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 53, 53, 53,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,
-114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,
-165,165,165,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,127,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,
-160,160,160,100,127,112,112,100,  0,  0,  0,  0, 64, 64, 64,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,255,140, 25,255,
-  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,255,160,  0,255,219, 37, 18,255,
-255, 32, 32,255, 75, 75, 75,255,  0,  0,  0,  0,255,255,255, 10,255,133,  0, 60,255,133,  0,255,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80,  0,  0,  0,  0,  0,  0,  0,  0,
- 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,  0,  0,  0,  0,  0,  0,  0,255,
-144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,255,240,255, 64,255, 64,192, 48,255,240,144,160,255,  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,  3,  0,  3,  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,  0,  0,  0,255,255,255,128,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,114,114,114,255,110,110,110,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,
-  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,255,  0,  0,  0,255,
-  0,  0,  0,255,255,255,255,255,132,132,132,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255, 94, 94, 94,255,172,172,172,255,
- 17, 27, 60,100, 94, 94, 94,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,195,195,195,255,  8, 48,  8,255, 85,187, 85,255,
-255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,255,160,  0,255,219, 37, 18,255,255, 32, 32,255, 75, 75, 75,255,
-  0,  0,  0,  0,  0,  0,  0, 18,255,133,  0, 60,255,133,  0,255,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80,  0,  0,  0,  0,  0,  0,  0,  0, 96,192, 64,255,144,144,  0,255,
-128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,  0,  0,  0,  0,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,
-128, 48, 96,255,  0,  0,  0,255,240,255, 64,255, 64,192, 48,255,240,144,160,255,  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,  3,  0,  4,  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,  0,  0,  0,255,255,255,128,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-153,153,153,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,
-114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,
-165,165,165,127,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,143,143,143,255,198,119,119,255,255,  0,  0,255, 64, 64, 64,255,
-  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,255,140, 25,255,  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,
-255,133,  0,255,  0,  0,  0,255,255,160,  0,255,219, 37, 18,255,255, 32, 32,255, 75, 75, 75,255,  0,  0,  0,  0,  0,  0,  0, 18,
-255,133,  0, 60,255,133,  0,255,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,
-200,200,200,255, 80,200,255, 80,  0,  0,  0,  0,  0,  0,  0,  0, 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,
-240,255, 64,255,240,144,160,255,  0,  0,  0,  0,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,255,
-240,255, 64,255, 64,192, 48,255,240,144,160,255,  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,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,  0,  0,  0,  0,255,240,255, 64,255,
+ 64,192, 48,255,240,144,160,255,  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,  3,  0,  4,  0,100,  0,  0,255,  0,  0,200,255,128,  0, 80,255, 95, 95,  0,255,  0,100, 50,255,
   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,
-255,255,255,128,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,114,114,114,255,  0,  0,  0,  0,
-  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,
-  0,  0,  0,255,255,255,255,255,165,165,165,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,127,  0,  0,  0,255,
-  0,  0,  0,255,255,255,255,255,160,160,160,100,127,112,112,100,  0,  0,  0,  0, 64, 64, 64,255,  0,  0,  0,255,241, 88,  0,255,
-  0,  0,  0, 40,255,140, 25,255,  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,
+  0,  0,  0,  0,255,255,255,128,  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,  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,114,114,114,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,165,165,165,127,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,160,160,160,100,127,112,112,100,  0,  0,  0,  0,
+ 64, 64, 64,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,255,140, 25,255,  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,
+255,160,  0,255,219, 37, 18,255,255, 32, 32,255, 75, 75, 75,255,  0,  0,  0,  0,  0,  0,  0, 18,255,133,  0, 60,255,133,  0,255,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80,
+  0,  0,  0,  0,  0,  0,  0,  0, 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,
+  0,  0,  0,  0,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,  0,  0,  0,  0,255,240,255, 64,255,
+ 64,192, 48,255,240,144,160,255,  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,  3,  0,  4,  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,  0,  0,  0,
+  0,  0,  0,  0,255,255,255,128,  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,  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, 51,127, 51, 76,
+130,135,140, 76,114,114,114,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,165,165,165,127,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,173,173,173,255,127,112,112,100,  0,  0,  0,  0,
+ 91, 91, 91,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,255,140, 25,255,  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,
+255,160,  0,255,219, 37, 18,255,255, 32, 32,255, 75, 75, 75,255,  0,  0,  0,  0,  0,  0,  0, 18,255,133,  0, 60,255,133,  0,255,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80,
+  0,  0,  0,  0,  0,  0,  0,  0, 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,
+  0,  0,  0,  0,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,  0,  0,  0,  0,255,240,255, 64,255,
+ 64,192, 48,255,240,144,160,255,  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,  3,  0,  4,  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,  0,  0,  0,
+  0,  0,  0,  0,255,255,255,128,  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,  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, 57, 57, 57,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,165,165,165,127,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,160,160,160,100,127,112,112,100,  0,  0,  0,  0,
+ 64, 64, 64,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,255,140, 25,255,  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,
+255,255,255,255,219, 37, 18,255,255, 32, 32,255, 75, 75, 75,255,  0,  0,  0,  0,  0,  0,  0, 18,255,133,  0, 60,255,133,  0,255,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80,
+  0,  0,  0,  0,  0,  0,  0,  0, 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,
+  0,  0,  0,  0,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,  0,  0,  0,  0,255,240,255, 64,255,
+ 64,192, 48,255,240,144,160,255,  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,  3,  0,  4,  5,155,155,155,160,100,104,111,255,111,106,100,255,104,106,117,255,105,117,110,255,
+  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,255,255,255,128,  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,  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,100,100,100,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,165,165,165,127,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,160,160,160,100,127,112,112,100,  0,  0,  0,  0,
+ 64, 64, 64,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,255,140, 25,255,  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,
+255,160,  0,255,219, 37, 18,255,255, 32, 32,255, 75, 75, 75,255,  0,  0,  0,  0,  0,  0,  0, 18,255,133,  0, 60,255,133,  0,255,
+  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80,
+  0,  0,  0,  0,  0,  0,  0,  0, 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,
+  0,  0,  0,  0,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,  0,  0,  0,  0,255,240,255, 64,255,
+ 64,192, 48,255,240,144,160,255,  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,  3,  0,  4,  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,  0,  0,  0,
+  0,  0,  0,  0,255,255,255,128,  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,  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,114,114,114,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,165,165,165,127,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,160,160,160,100,127,112,112,100,  0,  0,  0,  0,
+ 64, 64, 64,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,255,140, 25,255,  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,
 255,160,  0,255,219, 37, 18,255,255, 32, 32,255, 75, 75, 75,255,  0,  0,  0,  0,  0,  0,  0, 18,255,133,  0, 60,255,133,  0,255,
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80,
   0,  0,  0,  0,  0,  0,  0,  0, 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,
-  0,  0,  0,  0,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,255,240,255, 64,255, 64,192, 48,255,
-240,144,160,255,  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,
-  3,  0,  4,  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,  0,  0,  0,255,255,255,128,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,114,114,114,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,
-114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,
-165,165,165,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,127,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,
-173,173,173,255,127,112,112,100,  0,  0,  0,  0, 91, 91, 91,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,255,140, 25,255,
-  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,255,160,  0,255,219, 37, 18,255,
-255, 32, 32,255, 75, 75, 75,255,  0,  0,  0,  0,  0,  0,  0, 18,255,133,  0, 60,255,133,  0,255,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80,  0,  0,  0,  0,  0,  0,  0,  0,
- 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,  0,  0,  0,  0,  0,  0,  0,255,
-144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,255,240,255, 64,255, 64,192, 48,255,240,144,160,255,  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,  3,  0,  4,  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,  0,  0,  0,255,255,255,128,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 57, 57, 57,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,
-  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,255,  0,  0,  0,255,
-  0,  0,  0,255,255,255,255,255,165,165,165,127,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,160,160,160,100,127,112,112,100,
-  0,  0,  0,  0, 64, 64, 64,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,255,140, 25,255,  8, 48,  8,255, 85,187, 85,255,
-255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,255,255,255,255,219, 37, 18,255,255, 32, 32,255, 75, 75, 75,255,
-  0,  0,  0,  0,  0,  0,  0, 18,255,133,  0, 60,255,133,  0,255,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
- 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80,  0,  0,  0,  0,  0,  0,  0,  0, 96,192, 64,255,144,144,  0,255,
-128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,  0,  0,  0,  0,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,
-128, 48, 96,255,  0,  0,  0,255,240,255, 64,255, 64,192, 48,255,240,144,160,255,  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,  3,  0,  4,  0,155,155,155,160,100,104,111,255,111,106,100,255,
-104,106,117,255,105,117,110,255,  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,255,255,255,128,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-100,100,100,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,
-114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,
-165,165,165,127,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,160,160,160,100,127,112,112,100,  0,  0,  0,  0, 64, 64, 64,255,
-  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,255,140, 25,255,  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,
-255,133,  0,255,  0,  0,  0,255,255,160,  0,255,219, 37, 18,255,255, 32, 32,255, 75, 75, 75,255,  0,  0,  0,  0,  0,  0,  0, 18,
-255,133,  0, 60,255,133,  0,255,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,
-200,200,200,255, 80,200,255, 80,  0,  0,  0,  0,  0,  0,  0,  0, 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,
-240,255, 64,255,240,144,160,255,  0,  0,  0,  0,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,255,
-240,255, 64,255, 64,192, 48,255,240,144,160,255,  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,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,  0,  0,  0,  0,255,240,255, 64,255,
+ 64,192, 48,255,240,144,160,255,  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,  3,  0,  4,  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,  0,  0,  0,
-255,255,255,128,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,114,114,114,255,  0,  0,  0,  0,
-  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,
-  0,  0,  0,255,255,255,255,255,165,165,165,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,127,  0,  0,  0,255,
-  0,  0,  0,255,255,255,255,255,160,160,160,100,127,112,112,100,  0,  0,  0,  0, 64, 64, 64,255,  0,  0,  0,255,241, 88,  0,255,
-  0,  0,  0, 40,255,140, 25,255,  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,
+  0,  0,  0,  0,255,255,255,128,  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,  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,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,165,165,165,127,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,160,160,160,100,127,112,112,100,  0,  0,  0,  0,
+ 64, 64, 64,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,255,140, 25,255,  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,
 255,160,  0,255,219, 37, 18,255,255, 32, 32,255, 75, 75, 75,255,  0,  0,  0,  0,  0,  0,  0, 18,255,133,  0, 60,255,133,  0,255,
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80,
   0,  0,  0,  0,  0,  0,  0,  0, 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,
-  0,  0,  0,  0,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,255,240,255, 64,255, 64,192, 48,255,
-240,144,160,255,  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,
-  3,  0,  4,  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,  0,  0,  0,255,255,255,128,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,
-114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,
-165,165,165,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,127,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,
-160,160,160,100,127,112,112,100,  0,  0,  0,  0, 64, 64, 64,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,255,140, 25,255,
-  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,255,160,  0,255,219, 37, 18,255,
-255, 32, 32,255, 75, 75, 75,255,  0,  0,  0,  0,  0,  0,  0, 18,255,133,  0, 60,255,133,  0,255,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80,  0,  0,  0,  0,  0,  0,  0,  0,
- 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,  0,  0,  0,  0,  0,  0,  0,255,
-144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,255,240,255, 64,255, 64,192, 48,255,240,144,160,255,  0,  0,  0,  0,
-  0,  0,  0,  0, 96,128,255,255,255,255,255,255,  0,170,  0,255,220, 96, 96,255,220, 96, 96,255,  3,  0,  4,  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,  0,  0,  0,255,255,255,128,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0,154,  0,  0,255,189, 17, 17,255,247, 10, 10,255,  0,  0,  0,  0,247, 64, 24,255,246,105, 19,255,
-250,153,  0,255,  0,  0,  0,  0, 30,145,  9,255, 89,183, 11,255,131,239, 29,255,  0,  0,  0,  0, 10, 54,148,255, 54,103,223,255,
- 94,193,239,255,  0,  0,  0,  0,169, 41, 78,255,193, 65,106,255,240, 93,145,255,  0,  0,  0,  0, 67, 12,120,255, 84, 58,163,255,
-135,100,213,255,  0,  0,  0,  0, 36,120, 90,255, 60,149,121,255,111,182,171,255,  0,  0,  0,  0, 75,112,124,255,106,134,145,255,
-155,194,205,255,  0,  0,  0,  0,244,201, 12,255,238,194, 54,255,243,255,  0,255,  0,  0,  0,  0, 30, 32, 36,255, 72, 76, 86,255,
-255,255,255,255,  0,  0,  0,  0,111, 47,106,255,152, 69,190,255,211, 48,214,255,  0,  0,  0,  0,108,142, 34,255,127,176, 34,255,
-187,239, 91,255,  0,  0,  0,  0,141,141,141,255,176,176,176,255,222,222,222,255,  0,  0,  0,  0,131, 67, 38,255,139, 88, 17,255,
-189,106, 17,255,  0,  0,  0,  0,  8, 49, 14,255, 28, 67, 11,255, 52, 98, 43,255,  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,  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,  3,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 72,  0,  0,  0, 32, 19,216,  2,190,  0,  0,  0,
-  1,  0,  0,  0,152, 19,216,  2,  0,  0,  0,  0,105,111, 95,115, 99,101,110,101, 95, 51,100,115,  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,  0,  0, 68, 65, 84, 65, 72,  0,  0,  0,152, 19,216,  2,190,  0,  0,  0,  1,  0,  0,  0,
- 16, 20,216,  2, 32, 19,216,  2,105,111, 95,115, 99,101,110,101, 95,102, 98,120,  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,  0,  0, 68, 65, 84, 65, 72,  0,  0,  0, 16, 20,216,  2,190,  0,  0,  0,  1,  0,  0,  0,136, 20,216,  2,
-152, 19,216,  2,105,111, 95, 97,110,105,109, 95, 98,118,104,  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,  0,  0,  0, 68, 65, 84, 65, 72,  0,  0,  0,136, 20,216,  2,190,  0,  0,  0,  1,  0,  0,  0,  0, 21,216,  2, 16, 20,216,  2,
-105,111, 95,109,101,115,104, 95,112,108,121,  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,  0,  0,  0,
- 68, 65, 84, 65, 72,  0,  0,  0,  0, 21,216,  2,190,  0,  0,  0,  1,  0,  0,  0,120, 21,216,  2,136, 20,216,  2,105,111, 95,115,
- 99,101,110,101, 95,111, 98,106,  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,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,  0,  0,  0,  0,255,240,255, 64,255,
+ 64,192, 48,255,240,144,160,255,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 96,128,255,255,255,255,255,255,  0,170,  0,255,
+220, 96, 96,255,220, 96, 96,255,  3,  0,  4,  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,  0,  0,  0,
+  0,  0,  0,  0,255,255,255,128,  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,  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, 57, 57, 57,255,  0,  0,  0,  0,  0,  0,  0,255,255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,114,114,114,255,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,165,165,165,255,  0,  0,  0,255,  0,  0,  0,255,
+255,255,255,255,165,165,165,127,  0,  0,  0,255,  0,  0,  0,255,255,255,255,255,160,160,160,100,127,112,112,100,  0,  0,  0,  0,
+ 94, 94, 94,255,  0,  0,  0,255,241, 88,  0,255,  0,  0,  0, 40,  0,  0,  0,255,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0,255,170, 64,255,  8, 48,  8,255, 85,187, 85,255,255,255,255,255,  0,  0,  0,255,255,133,  0,255,  0,  0,  0,255,
+255,160,  0,255,219, 37, 18,255, 32,255,255,255, 75, 75, 75,255,204,  0,153,255,  0,  0,  0, 18,255,133,  0, 60,255,133,  0,255,
+ 32,  0,  0,255,  0, 32,  0,255,  0,  0,128,255,  0,  0,  0,  0, 34,221,221,255, 35, 97,221,255,200,200,200,255, 80,200,255, 80,
+  0,  0,  0,  0,  0,  0,  0,  0, 96,192, 64,255,144,144,  0,255,128, 48, 96,255,219, 37, 18,255,240,255, 64,255,240,144,160,255,
+255,255,255,255,  0,  0,  0,255,144,144,  0,255, 64,144, 48,255,128, 48, 96,255,  0,  0,  0,  0,  0,  0,  0,255,240,255, 64,255,
+ 64,192, 48,255,240,144,160,255,  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,  3,  1,  4,  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,  0,  0,  0,
+  0,  0,  0,  0,255,255,255,128,  0,  0,  0,255,255,255,  0,255,  4,  0,  0,  0,255,127,127,  0,255,255,255,255,255,255,255,  0,
+255,127,  0,  0,255,127,127,127,255,200,200,200,255,255,  0,  0,255,  0,  0,255,255,  0,  0,  0,255,  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,154,  0,  0,255,189, 17, 17,255,247, 10, 10,255,  0,  0,  0,  0,247, 64, 24,255,246,105, 19,255,250,153,  0,255,
+  0,  0,  0,  0, 30,145,  9,255, 89,183, 11,255,131,239, 29,255,  0,  0,  0,  0, 10, 54,148,255, 54,103,223,255, 94,193,239,255,
+  0,  0,  0,  0,169, 41, 78,255,193, 65,106,255,240, 93,145,255,  0,  0,  0,  0, 67, 12,120,255, 84, 58,163,255,135,100,213,255,
+  0,  0,  0,  0, 36,120, 90,255, 60,149,121,255,111,182,171,255,  0,  0,  0,  0, 75,112,124,255,106,134,145,255,155,194,205,255,
+  0,  0,  0,  0,244,201, 12,255,238,194, 54,255,243,255,  0,255,  0,  0,  0,  0, 30, 32, 36,255, 72, 76, 86,255,255,255,255,255,
+  0,  0,  0,  0,111, 47,106,255,152, 69,190,255,211, 48,214,255,  0,  0,  0,  0,108,142, 34,255,127,176, 34,255,187,239, 91,255,
+  0,  0,  0,  0,141,141,141,255,176,176,176,255,222,222,222,255,  0,  0,  0,  0,131, 67, 38,255,139, 88, 17,255,189,106, 17,255,
+  0,  0,  0,  0,  8, 49, 14,255, 28, 67, 11,255, 52, 98, 43,255,  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,  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,  3,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 80,  0,  0,  0,120,228, 21,  6,  0,  0,  0,  0,207,  0,  0,  0,
+  1,  0,  0,  0, 24,229, 21,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,105,111, 95,115, 99,101,110,101, 95, 51,100,115,
+  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,  0,  0, 68, 65, 84, 65, 80,  0,  0,  0, 24,229, 21,  6,
+  0,  0,  0,  0,207,  0,  0,  0,  1,  0,  0,  0, 88, 56, 23,  6,  0,  0,  0,  0,120,228, 21,  6,  0,  0,  0,  0,105,111, 95,115,
+ 99,101,110,101, 95,102, 98,120,  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,  0,  0, 68, 65, 84, 65,
- 72,  0,  0,  0,120, 21,216,  2,190,  0,  0,  0,  1,  0,  0,  0,240, 21,216,  2,  0, 21,216,  2,105,111, 95,115, 99,101,110,101,
- 95,120, 51,100,  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,  0,  0, 68, 65, 84, 65, 72,  0,  0,  0,
-240, 21,216,  2,190,  0,  0,  0,  1,  0,  0,  0,104, 22,216,  2,120, 21,216,  2,105,111, 95,109,101,115,104, 95,115,116,108,  0,
+ 80,  0,  0,  0, 88, 56, 23,  6,  0,  0,  0,  0,207,  0,  0,  0,  1,  0,  0,  0,248, 56, 23,  6,  0,  0,  0,  0, 24,229, 21,  6,
+  0,  0,  0,  0,105,111, 95, 97,110,105,109, 95, 98,118,104,  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,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65, 72,  0,  0,  0,104, 22,216,  2,
-190,  0,  0,  0,  1,  0,  0,  0,224, 22,216,  2,240, 21,216,  2,105,111, 95,109,101,115,104, 95,117,118, 95,108, 97,121,111,117,
-116,  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, 68, 65, 84, 65, 72,  0,  0,  0,224, 22,216,  2,190,  0,  0,  0,
-  1,  0,  0,  0,  0,  0,  0,  0,104, 22,216,  2,105,111, 95, 99,117,114,118,101, 95,115,118,103,  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,  0,  0, 68, 65, 84, 65,224,  0,  0,  0,168, 92,220,  3,183,  0,  0,  0,  1,  0,  0,  0,
-  0,  0,  0,  0,  0,  0,  0,  0, 68,101,102, 97,117,108,116, 32, 83,116,121,108,101,  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,  0,  0,  0, 12,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,255,255,  0,  0,
-154,153, 25, 62,  0,  0,128, 63,  0,  0, 12,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,255,255,  0,  0,
-  0,  0,128, 62,  0,  0,  0,  0,  0,  0, 11,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,255,255,  0,  0,
-154,153, 25, 62,  0,  0,128, 63,  0,  0, 11,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  0,  0,128, 62,  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  8,  0,  5,  0,  5,  0,  8,  0,  2,  0,  8,  0,  4,  0,  0,  0,
- 68, 78, 65, 49, 56,231,  0,  0, 32,143, 19,  4,  0,  0,  0,  0,  1,  0,  0,  0, 83, 68, 78, 65, 78, 65, 77, 69, 17, 12,  0,  0,
+  0,  0,  0,  0, 68, 65, 84, 65, 80,  0,  0,  0,248, 56, 23,  6,  0,  0,  0,  0,207,  0,  0,  0,  1,  0,  0,  0,152, 57, 23,  6,
+  0,  0,  0,  0, 88, 56, 23,  6,  0,  0,  0,  0,105,111, 95,109,101,115,104, 95,112,108,121,  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,  0,  0,  0, 68, 65, 84, 65, 80,  0,  0,  0,152, 57, 23,  6,  0,  0,  0,  0,207,  0,  0,  0,
+  1,  0,  0,  0, 56, 58, 23,  6,  0,  0,  0,  0,248, 56, 23,  6,  0,  0,  0,  0,105,111, 95,115, 99,101,110,101, 95,111, 98,106,
+  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,  0,  0, 68, 65, 84, 65, 80,  0,  0,  0, 56, 58, 23,  6,
+  0,  0,  0,  0,207,  0,  0,  0,  1,  0,  0,  0,216, 58, 23,  6,  0,  0,  0,  0,152, 57, 23,  6,  0,  0,  0,  0,105,111, 95,115,
+ 99,101,110,101, 95,120, 51,100,  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,  0,  0, 68, 65, 84, 65,
+ 80,  0,  0,  0,216, 58, 23,  6,  0,  0,  0,  0,207,  0,  0,  0,  1,  0,  0,  0,120, 59, 23,  6,  0,  0,  0,  0, 56, 58, 23,  6,
+  0,  0,  0,  0,105,111, 95,109,101,115,104, 95,115,116,108,  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,  0,  0,  0, 68, 65, 84, 65, 80,  0,  0,  0,120, 59, 23,  6,  0,  0,  0,  0,207,  0,  0,  0,  1,  0,  0,  0, 24, 60, 23,  6,
+  0,  0,  0,  0,216, 58, 23,  6,  0,  0,  0,  0,105,111, 95,109,101,115,104, 95,117,118, 95,108, 97,121,111,117,116,  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, 68, 65, 84, 65, 80,  0,  0,  0, 24, 60, 23,  6,  0,  0,  0,  0,207,  0,  0,  0,
+  1,  0,  0,  0,184, 60, 23,  6,  0,  0,  0,  0,120, 59, 23,  6,  0,  0,  0,  0,105,111, 95, 99,117,114,118,101, 95,115,118,103,
+  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,  0,  0, 68, 65, 84, 65, 80,  0,  0,  0,184, 60, 23,  6,
+  0,  0,  0,  0,207,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 24, 60, 23,  6,  0,  0,  0,  0, 99,121, 99,108,
+101,115,  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,  0,  0,  0,  0,  0,  0,  0,  0, 68, 65, 84, 65,
+232,  0,  0,  0, 88, 61, 23,  6,  0,  0,  0,  0,199,  0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  0,  0,  0,  0, 68,101,102, 97,117,108,116, 32, 83,116,121,108,101,  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,  0,  0,  0, 12,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,255,255,  0,  0,154,153, 25, 62,
+  0,  0,128, 63,  0,  0, 12,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,255,255,  0,  0,  0,  0,128, 62,
+  0,  0,  0,  0,  0,  0, 11,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,255,255,  0,  0,154,153, 25, 62,
+  0,  0,128, 63,  0,  0, 11,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128, 62,
+  0,  0,  0,  0,  0,  0,128, 63,  0,  0,  0,  0,  8,  0,  5,  0,  5,  0,  8,  0,  2,  0,  8,  0,  4,  0,  0,  0, 68, 78, 65, 49,
+148,  4,  1,  0,  8,111,147,109,161,127,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0, 83, 68, 78, 65, 78, 65, 77, 69, 58, 13,  0,  0,
  42,110,101,120,116,  0, 42,112,114,101,118,  0, 42,100, 97,116, 97,  0, 42,102,105,114,115,116,  0, 42,108, 97,115,116,  0,120,
-  0,121,  0,120,109,105,110,  0,120,109, 97,120,  0,121,109,105,110,  0,121,109, 97,120,  0, 42,112,111,105,110,116,101,114,  0,
-103,114,111,117,112,  0,118, 97,108,  0,118, 97,108, 50,  0,116,121,112,101,  0,115,117, 98,116,121,112,101,  0,102,108, 97,103,
-  0,110, 97,109,101, 91, 51, 50, 93,  0,115, 97,118,101,100,  0,100, 97,116, 97,  0,108,101,110,  0,116,111,116, 97,108,108,101,
-110,  0, 42,110,101,119,105,100,  0, 42,108,105, 98,  0,110, 97,109,101, 91, 50, 52, 93,  0,117,115,  0,105, 99,111,110, 95,105,
-100,  0, 42,112,114,111,112,101,114,116,105,101,115,  0,105,100,  0, 42,105,100, 98,108,111, 99,107,  0, 42,102,105,108,101,100,
- 97,116, 97,  0,110, 97,109,101, 91, 50, 52, 48, 93,  0,102,105,108,101,112, 97,116,104, 91, 50, 52, 48, 93,  0,116,111,116,  0,
-112, 97,100,  0, 42,112, 97,114,101,110,116,  0,119, 91, 50, 93,  0,104, 91, 50, 93,  0, 99,104, 97,110,103,101,100, 91, 50, 93,
-  0, 99,104, 97,110,103,101,100, 95,116,105,109,101,115,116, 97,109,112, 91, 50, 93,  0, 42,114,101, 99,116, 91, 50, 93,  0, 42,
-111, 98,  0, 98,108,111, 99,107,116,121,112,101,  0, 97,100,114, 99,111,100,101,  0,110, 97,109,101, 91, 49, 50, 56, 93,  0, 42,
- 98,112,  0, 42, 98,101,122,116,  0,109, 97,120,114, 99,116,  0,116,111,116,114, 99,116,  0,118, 97,114,116,121,112,101,  0,116,
-111,116,118,101,114,116,  0,105,112,111,  0,101,120,116,114, 97,112,  0,114,116,  0, 98,105,116,109, 97,115,107,  0,115,108,105,
-100,101, 95,109,105,110,  0,115,108,105,100,101, 95,109, 97,120,  0, 99,117,114,118, 97,108,  0, 42,100,114,105,118,101,114,  0,
- 99,117,114,118,101,  0, 99,117,114,  0,115,104,111,119,107,101,121,  0,109,117,116,101,105,112,111,  0,112,111,115,  0,114,101,
-108, 97,116,105,118,101,  0,116,111,116,101,108,101,109,  0,112, 97,100, 50,  0, 42,119,101,105,103,104,116,115,  0,118,103,114,
-111,117,112, 91, 51, 50, 93,  0,115,108,105,100,101,114,109,105,110,  0,115,108,105,100,101,114,109, 97,120,  0, 42, 97,100,116,
-  0, 42,114,101,102,107,101,121,  0,101,108,101,109,115,116,114, 91, 51, 50, 93,  0,101,108,101,109,115,105,122,101,  0, 98,108,
-111, 99,107,  0, 42,105,112,111,  0, 42,102,114,111,109,  0,116,111,116,107,101,121,  0,115,108,117,114,112,104,  0, 42,108,105,
-110,101,  0, 42,102,111,114,109, 97,116,  0, 98,108,101,110,  0,108,105,110,101,110,111,  0,115,116, 97,114,116,  0,101,110,100,
-  0,112, 97,100, 49,  0,102,108, 97,103,115,  0, 99,111,108,111,114, 91, 52, 93,  0,112, 97,100, 91, 52, 93,  0, 42,110, 97,109,
-101,  0,110,108,105,110,101,115,  0,108,105,110,101,115,  0, 42, 99,117,114,108,  0, 42,115,101,108,108,  0, 99,117,114, 99,  0,
-115,101,108, 99,  0,109, 97,114,107,101,114,115,  0, 42,117,110,100,111, 95, 98,117,102,  0,117,110,100,111, 95,112,111,115,  0,
-117,110,100,111, 95,108,101,110,  0, 42, 99,111,109,112,105,108,101,100,  0,109,116,105,109,101,  0,115,105,122,101,  0,115,101,
-101,107,  0,100,116,120,  0,112, 97,115,115,101,112, 97,114,116, 97,108,112,104, 97,  0, 99,108,105,112,115,116, 97,  0, 99,108,
-105,112,101,110,100,  0,108,101,110,115,  0,111,114,116,104,111, 95,115, 99, 97,108,101,  0,100,114, 97,119,115,105,122,101,  0,
-115,104,105,102,116,120,  0,115,104,105,102,116,121,  0, 89, 70, 95,100,111,102,100,105,115,116,  0, 42,100,111,102, 95,111, 98,
-  0, 42,115, 99,101,110,101,  0,102,114, 97,109,101,110,114,  0,102,114, 97,109,101,115,  0,111,102,102,115,101,116,  0,115,102,
-114, 97,  0,102,105,101, 95,105,109, 97,  0, 99,121, 99,108,  0,111,107,  0,109,117,108,116,105, 95,105,110,100,101,120,  0,108,
- 97,121,101,114,  0,112, 97,115,115,  0,105, 98,117,102,115,  0, 42,103,112,117,116,101,120,116,117,114,101,  0, 42, 97,110,105,
-109,  0, 42,114,114,  0, 42,114,101,110,100,101,114,115, 91, 56, 93,  0,114,101,110,100,101,114, 95,115,108,111,116,  0,108, 97,
-115,116, 95,114,101,110,100,101,114, 95,115,108,111,116,  0,115,111,117,114, 99,101,  0,108, 97,115,116,102,114, 97,109,101,  0,
-116,112, 97,103,101,102,108, 97,103,  0,116,111,116, 98,105,110,100,  0,120,114,101,112,  0,121,114,101,112,  0,116,119,115,116,
- 97,  0,116,119,101,110,100,  0, 98,105,110,100, 99,111,100,101,  0, 42,114,101,112, 98,105,110,100,  0, 42,112, 97, 99,107,101,
-100,102,105,108,101,  0, 42,112,114,101,118,105,101,119,  0,108, 97,115,116,117,112,100, 97,116,101,  0,108, 97,115,116,117,115,
-101,100,  0, 97,110,105,109,115,112,101,101,100,  0,103,101,110, 95,120,  0,103,101,110, 95,121,  0,103,101,110, 95,116,121,112,
-101,  0,103,101,110, 95,102,108, 97,103,  0, 97,115,112,120,  0, 97,115,112,121,  0,116,101,120, 99,111,  0,109, 97,112,116,111,
-  0,109, 97,112,116,111,110,101,103,  0, 98,108,101,110,100,116,121,112,101,  0, 42,111, 98,106,101, 99,116,  0, 42,116,101,120,
-  0,117,118,110, 97,109,101, 91, 51, 50, 93,  0,112,114,111,106,120,  0,112,114,111,106,121,  0,112,114,111,106,122,  0,109, 97,
-112,112,105,110,103,  0,111,102,115, 91, 51, 93,  0,115,105,122,101, 91, 51, 93,  0,114,111,116,  0,116,101,120,102,108, 97,103,
-  0, 99,111,108,111,114,109,111,100,101,108,  0,112,109, 97,112,116,111,  0,112,109, 97,112,116,111,110,101,103,  0,110,111,114,
-109, 97,112,115,112, 97, 99,101,  0,119,104,105, 99,104, 95,111,117,116,112,117,116,  0, 98,114,117,115,104, 95,109, 97,112, 95,
-109,111,100,101,  0,112, 97,100, 91, 55, 93,  0,114,  0,103,  0, 98,  0,107,  0,100,101,102, 95,118, 97,114,  0, 99,111,108,102,
- 97, 99,  0,118, 97,114,102, 97, 99,  0,110,111,114,102, 97, 99,  0,100,105,115,112,102, 97, 99,  0,119, 97,114,112,102, 97, 99,
-  0, 99,111,108,115,112,101, 99,102, 97, 99,  0,109,105,114,114,102, 97, 99,  0, 97,108,112,104, 97,102, 97, 99,  0,100,105,102,
-102,102, 97, 99,  0,115,112,101, 99,102, 97, 99,  0,101,109,105,116,102, 97, 99,  0,104, 97,114,100,102, 97, 99,  0,114, 97,121,
-109,105,114,114,102, 97, 99,  0,116,114, 97,110,115,108,102, 97, 99,  0, 97,109, 98,102, 97, 99,  0, 99,111,108,101,109,105,116,
-102, 97, 99,  0, 99,111,108,114,101,102,108,102, 97, 99,  0, 99,111,108,116,114, 97,110,115,102, 97, 99,  0,100,101,110,115,102,
- 97, 99,  0,115, 99, 97,116,116,101,114,102, 97, 99,  0,114,101,102,108,102, 97, 99,  0,116,105,109,101,102, 97, 99,  0,108,101,
-110,103,116,104,102, 97, 99,  0, 99,108,117,109,112,102, 97, 99,  0,100, 97,109,112,102, 97, 99,  0,107,105,110,107,102, 97, 99,
-  0,114,111,117,103,104,102, 97, 99,  0,112, 97,100,101,110,115,102, 97, 99,  0,103,114, 97,118,105,116,121,102, 97, 99,  0,108,
-105,102,101,102, 97, 99,  0,115,105,122,101,102, 97, 99,  0,105,118,101,108,102, 97, 99,  0,102,105,101,108,100,102, 97, 99,  0,
-115,104, 97,100,111,119,102, 97, 99,  0,122,101,110,117,112,102, 97, 99,  0,122,101,110,100,111,119,110,102, 97, 99,  0, 98,108,
-101,110,100,102, 97, 99,  0,110, 97,109,101, 91, 49, 54, 48, 93,  0, 42,104, 97,110,100,108,101,  0, 42,112,110, 97,109,101,  0,
- 42,115,116,110, 97,109,101,115,  0,115,116,121,112,101,115,  0,118, 97,114,115,  0, 42,118, 97,114,115,116,114,  0, 42,114,101,
-115,117,108,116,  0, 42, 99,102,114, 97,  0,100, 97,116, 97, 91, 51, 50, 93,  0, 40, 42,100,111,105,116, 41, 40, 41,  0, 40, 42,
-105,110,115,116, 97,110, 99,101, 95,105,110,105,116, 41, 40, 41,  0, 40, 42, 99, 97,108,108, 98, 97, 99,107, 41, 40, 41,  0,118,
-101,114,115,105,111,110,  0, 97,  0,105,112,111,116,121,112,101,  0, 42,105,109, 97,  0, 42, 99,117, 98,101, 91, 54, 93,  0,105,
-109, 97,116, 91, 52, 93, 91, 52, 93,  0,111, 98,105,109, 97,116, 91, 51, 93, 91, 51, 93,  0,115,116,121,112,101,  0,118,105,101,
-119,115, 99, 97,108,101,  0,110,111,116,108, 97,121,  0, 99,117, 98,101,114,101,115,  0,100,101,112,116,104,  0,114,101, 99, 97,
-108, 99,  0,108, 97,115,116,115,105,122,101,  0,102, 97,108,108,111,102,102, 95,116,121,112,101,  0,102, 97,108,108,111,102,102,
- 95,115,111,102,116,110,101,115,115,  0,114, 97,100,105,117,115,  0, 99,111,108,111,114, 95,115,111,117,114, 99,101,  0,116,111,
-116,112,111,105,110,116,115,  0,112,100,112, 97,100,  0,112,115,121,115,  0,112,115,121,115, 95, 99, 97, 99,104,101, 95,115,112,
- 97, 99,101,  0,111, 98, 95, 99, 97, 99,104,101, 95,115,112, 97, 99,101,  0, 42,112,111,105,110,116, 95,116,114,101,101,  0, 42,
-112,111,105,110,116, 95,100, 97,116, 97,  0,110,111,105,115,101, 95,115,105,122,101,  0,110,111,105,115,101, 95,100,101,112,116,
-104,  0,110,111,105,115,101, 95,105,110,102,108,117,101,110, 99,101,  0,110,111,105,115,101, 95, 98, 97,115,105,115,  0,112,100,
-112, 97,100, 51, 91, 51, 93,  0,110,111,105,115,101, 95,102, 97, 99,  0,115,112,101,101,100, 95,115, 99, 97,108,101,  0,102, 97,
-108,108,111,102,102, 95,115,112,101,101,100, 95,115, 99, 97,108,101,  0,112,100,112, 97,100, 50,  0, 42, 99,111, 98, 97,  0, 42,
-102, 97,108,108,111,102,102, 95, 99,117,114,118,101,  0,114,101,115,111,108, 91, 51, 93,  0,105,110,116,101,114,112, 95,116,121,
-112,101,  0,102,105,108,101, 95,102,111,114,109, 97,116,  0,101,120,116,101,110,100,  0,115,109,111,107,101,100, 95,116,121,112,
-101,  0,105,110,116, 95,109,117,108,116,105,112,108,105,101,114,  0,115,116,105,108,108, 95,102,114, 97,109,101,  0,115,111,117,
-114, 99,101, 95,112, 97,116,104, 91, 50, 52, 48, 93,  0, 42,100, 97,116, 97,115,101,116,  0, 99, 97, 99,104,101,100,102,114, 97,
-109,101,  0,110,111,105,115,101,115,105,122,101,  0,116,117,114, 98,117,108,  0, 98,114,105,103,104,116,  0, 99,111,110,116,114,
- 97,115,116,  0,115, 97,116,117,114, 97,116,105,111,110,  0,114,102, 97, 99,  0,103,102, 97, 99,  0, 98,102, 97, 99,  0,102,105,
-108,116,101,114,115,105,122,101,  0,109,103, 95, 72,  0,109,103, 95,108, 97, 99,117,110, 97,114,105,116,121,  0,109,103, 95,111,
- 99,116, 97,118,101,115,  0,109,103, 95,111,102,102,115,101,116,  0,109,103, 95,103, 97,105,110,  0,100,105,115,116, 95, 97,109,
-111,117,110,116,  0,110,115, 95,111,117,116,115, 99, 97,108,101,  0,118,110, 95,119, 49,  0,118,110, 95,119, 50,  0,118,110, 95,
-119, 51,  0,118,110, 95,119, 52,  0,118,110, 95,109,101,120,112,  0,118,110, 95,100,105,115,116,109,  0,118,110, 95, 99,111,108,
-116,121,112,101,  0,110,111,105,115,101,100,101,112,116,104,  0,110,111,105,115,101,116,121,112,101,  0,110,111,105,115,101, 98,
- 97,115,105,115,  0,110,111,105,115,101, 98, 97,115,105,115, 50,  0,105,109, 97,102,108, 97,103,  0, 99,114,111,112,120,109,105,
-110,  0, 99,114,111,112,121,109,105,110,  0, 99,114,111,112,120,109, 97,120,  0, 99,114,111,112,121,109, 97,120,  0,116,101,120,
-102,105,108,116,101,114,  0, 97,102,109, 97,120,  0,120,114,101,112,101, 97,116,  0,121,114,101,112,101, 97,116,  0, 99,104,101,
- 99,107,101,114,100,105,115,116,  0,110, 97, 98,108, 97,  0,105,117,115,101,114,  0, 42,110,111,100,101,116,114,101,101,  0, 42,
-112,108,117,103,105,110,  0, 42,101,110,118,  0, 42,112,100,  0, 42,118,100,  0,117,115,101, 95,110,111,100,101,115,  0,108,111,
- 99, 91, 51, 93,  0,114,111,116, 91, 51, 93,  0,109, 97,116, 91, 52, 93, 91, 52, 93,  0,109,105,110, 91, 51, 93,  0,109, 97,120,
- 91, 51, 93,  0,109,111,100,101,  0,116,111,116,101,120,  0,115,104,100,119,114,  0,115,104,100,119,103,  0,115,104,100,119, 98,
-  0,115,104,100,119,112, 97,100,  0,101,110,101,114,103,121,  0,100,105,115,116,  0,115,112,111,116,115,105,122,101,  0,115,112,
-111,116, 98,108,101,110,100,  0,104, 97,105,110,116,  0, 97,116,116, 49,  0, 97,116,116, 50,  0, 42, 99,117,114,102, 97,108,108,
-111,102,102,  0,115,104, 97,100,115,112,111,116,115,105,122,101,  0, 98,105, 97,115,  0,115,111,102,116,  0, 99,111,109,112,114,
-101,115,115,116,104,114,101,115,104,  0,112, 97,100, 53, 91, 51, 93,  0, 98,117,102,115,105,122,101,  0,115, 97,109,112,  0, 98,
-117,102,102,101,114,115,  0,102,105,108,116,101,114,116,121,112,101,  0, 98,117,102,102,108, 97,103,  0, 98,117,102,116,121,112,
-101,  0,114, 97,121, 95,115, 97,109,112,  0,114, 97,121, 95,115, 97,109,112,121,  0,114, 97,121, 95,115, 97,109,112,122,  0,114,
- 97,121, 95,115, 97,109,112, 95,116,121,112,101,  0, 97,114,101, 97, 95,115,104, 97,112,101,  0, 97,114,101, 97, 95,115,105,122,
-101,  0, 97,114,101, 97, 95,115,105,122,101,121,  0, 97,114,101, 97, 95,115,105,122,101,122,  0, 97,100, 97,112,116, 95,116,104,
-114,101,115,104,  0,114, 97,121, 95,115, 97,109,112, 95,109,101,116,104,111,100,  0,116,101,120, 97, 99,116,  0,115,104, 97,100,
-104, 97,108,111,115,116,101,112,  0,115,117,110, 95,101,102,102,101, 99,116, 95,116,121,112,101,  0,115,107,121, 98,108,101,110,
-100,116,121,112,101,  0,104,111,114,105,122,111,110, 95, 98,114,105,103,104,116,110,101,115,115,  0,115,112,114,101, 97,100,  0,
-115,117,110, 95, 98,114,105,103,104,116,110,101,115,115,  0,115,117,110, 95,115,105,122,101,  0, 98, 97, 99,107,115, 99, 97,116,
-116,101,114,101,100, 95,108,105,103,104,116,  0,115,117,110, 95,105,110,116,101,110,115,105,116,121,  0, 97,116,109, 95,116,117,
-114, 98,105,100,105,116,121,  0, 97,116,109, 95,105,110,115, 99, 97,116,116,101,114,105,110,103, 95,102, 97, 99,116,111,114,  0,
- 97,116,109, 95,101,120,116,105,110, 99,116,105,111,110, 95,102, 97, 99,116,111,114,  0, 97,116,109, 95,100,105,115,116, 97,110,
- 99,101, 95,102, 97, 99,116,111,114,  0,115,107,121, 98,108,101,110,100,102, 97, 99,  0,115,107,121, 95,101,120,112,111,115,117,
-114,101,  0,115,107,121, 95, 99,111,108,111,114,115,112, 97, 99,101,  0,112, 97,100, 52, 91, 54, 93,  0, 42,109,116,101,120, 91,
- 49, 56, 93,  0,112,114, 95,116,101,120,116,117,114,101,  0,112, 97,100, 54, 91, 54, 93,  0,100,101,110,115,105,116,121,  0,101,
-109,105,115,115,105,111,110,  0,115, 99, 97,116,116,101,114,105,110,103,  0,114,101,102,108,101, 99,116,105,111,110,  0,101,109,
-105,115,115,105,111,110, 95, 99,111,108, 91, 51, 93,  0,116,114, 97,110,115,109,105,115,115,105,111,110, 95, 99,111,108, 91, 51,
- 93,  0,114,101,102,108,101, 99,116,105,111,110, 95, 99,111,108, 91, 51, 93,  0,100,101,110,115,105,116,121, 95,115, 99, 97,108,
-101,  0,100,101,112,116,104, 95, 99,117,116,111,102,102,  0, 97,115,121,109,109,101,116,114,121,  0,115,116,101,112,115,105,122,
-101, 95,116,121,112,101,  0,115,104, 97,100,101,102,108, 97,103,  0,115,104, 97,100,101, 95,116,121,112,101,  0,112,114,101, 99,
- 97, 99,104,101, 95,114,101,115,111,108,117,116,105,111,110,  0,115,116,101,112,115,105,122,101,  0,109,115, 95,100,105,102,102,
-  0,109,115, 95,105,110,116,101,110,115,105,116,121,  0,109,115, 95,115,112,114,101, 97,100,  0,109, 97,116,101,114,105, 97,108,
- 95,116,121,112,101,  0,115,112,101, 99,114,  0,115,112,101, 99,103,  0,115,112,101, 99, 98,  0,109,105,114,114,  0,109,105,114,
-103,  0,109,105,114, 98,  0, 97,109, 98,114,  0, 97,109, 98, 98,  0, 97,109, 98,103,  0, 97,109, 98,  0,101,109,105,116,  0, 97,
-110,103,  0,115,112,101, 99,116,114, 97,  0,114, 97,121, 95,109,105,114,114,111,114,  0, 97,108,112,104, 97,  0,114,101,102,  0,
-115,112,101, 99,  0,122,111,102,102,115,  0, 97,100,100,  0,116,114, 97,110,115,108,117, 99,101,110, 99,121,  0,118,111,108,  0,
-102,114,101,115,110,101,108, 95,109,105,114,  0,102,114,101,115,110,101,108, 95,109,105,114, 95,105,  0,102,114,101,115,110,101,
-108, 95,116,114, 97,  0,102,114,101,115,110,101,108, 95,116,114, 97, 95,105,  0,102,105,108,116,101,114,  0,116,120, 95,108,105,
-109,105,116,  0,116,120, 95,102, 97,108,108,111,102,102,  0,114, 97,121, 95,100,101,112,116,104,  0,114, 97,121, 95,100,101,112,
-116,104, 95,116,114, 97,  0,104, 97,114,  0,115,101,101,100, 49,  0,115,101,101,100, 50,  0,103,108,111,115,115, 95,109,105,114,
-  0,103,108,111,115,115, 95,116,114, 97,  0,115, 97,109,112, 95,103,108,111,115,115, 95,109,105,114,  0,115, 97,109,112, 95,103,
-108,111,115,115, 95,116,114, 97,  0, 97,100, 97,112,116, 95,116,104,114,101,115,104, 95,109,105,114,  0, 97,100, 97,112,116, 95,
-116,104,114,101,115,104, 95,116,114, 97,  0, 97,110,105,115,111, 95,103,108,111,115,115, 95,109,105,114,  0,100,105,115,116, 95,
-109,105,114,  0,102, 97,100,101,116,111, 95,109,105,114,  0,115,104, 97,100,101, 95,102,108, 97,103,  0,109,111,100,101, 95,108,
-  0,102,108, 97,114,101, 99,  0,115,116, 97,114, 99,  0,108,105,110,101, 99,  0,114,105,110,103, 99,  0,104, 97,115,105,122,101,
-  0,102,108, 97,114,101,115,105,122,101,  0,115,117, 98,115,105,122,101,  0,102,108, 97,114,101, 98,111,111,115,116,  0,115,116,
-114, 97,110,100, 95,115,116, 97,  0,115,116,114, 97,110,100, 95,101,110,100,  0,115,116,114, 97,110,100, 95,101, 97,115,101,  0,
-115,116,114, 97,110,100, 95,115,117,114,102,110,111,114,  0,115,116,114, 97,110,100, 95,109,105,110,  0,115,116,114, 97,110,100,
- 95,119,105,100,116,104,102, 97,100,101,  0,115,116,114, 97,110,100, 95,117,118,110, 97,109,101, 91, 51, 50, 93,  0,115, 98,105,
- 97,115,  0,108, 98,105, 97,115,  0,115,104, 97,100, 95, 97,108,112,104, 97,  0,115,101,112,116,101,120,  0,114,103, 98,115,101,
-108,  0,112,114, 95,116,121,112,101,  0,112,114, 95, 98, 97, 99,107,  0,112,114, 95,108, 97,109,112,  0,109,108, 95,102,108, 97,
-103,  0,100,105,102,102, 95,115,104, 97,100,101,114,  0,115,112,101, 99, 95,115,104, 97,100,101,114,  0,114,111,117,103,104,110,
-101,115,115,  0,114,101,102,114, 97, 99,  0,112, 97,114, 97,109, 91, 52, 93,  0,114,109,115,  0,100, 97,114,107,110,101,115,115,
-  0, 42,114, 97,109,112, 95, 99,111,108,  0, 42,114, 97,109,112, 95,115,112,101, 99,  0,114, 97,109,112,105,110, 95, 99,111,108,
-  0,114, 97,109,112,105,110, 95,115,112,101, 99,  0,114, 97,109,112, 98,108,101,110,100, 95, 99,111,108,  0,114, 97,109,112, 98,
-108,101,110,100, 95,115,112,101, 99,  0,114, 97,109,112, 95,115,104,111,119,  0,112, 97,100, 51,  0,114, 97,109,112,102, 97, 99,
- 95, 99,111,108,  0,114, 97,109,112,102, 97, 99, 95,115,112,101, 99,  0, 42,103,114,111,117,112,  0,102,114,105, 99,116,105,111,
-110,  0,102,104,  0,114,101,102,108,101, 99,116,  0,102,104,100,105,115,116,  0,120,121,102,114,105, 99,116,  0,100,121,110, 97,
-109,111,100,101,  0,115,115,115, 95,114, 97,100,105,117,115, 91, 51, 93,  0,115,115,115, 95, 99,111,108, 91, 51, 93,  0,115,115,
-115, 95,101,114,114,111,114,  0,115,115,115, 95,115, 99, 97,108,101,  0,115,115,115, 95,105,111,114,  0,115,115,115, 95, 99,111,
-108,102, 97, 99,  0,115,115,115, 95,116,101,120,102, 97, 99,  0,115,115,115, 95,102,114,111,110,116,  0,115,115,115, 95, 98, 97,
- 99,107,  0,115,115,115, 95,102,108, 97,103,  0,115,115,115, 95,112,114,101,115,101,116,  0,109, 97,112,116,111, 95,116,101,120,
-116,117,114,101,100,  0,115,104, 97,100,111,119,111,110,108,121, 95,102,108, 97,103,  0,105,110,100,101,120,  0,103,112,117,109,
- 97,116,101,114,105, 97,108,  0,110, 97,109,101, 91, 50, 53, 54, 93,  0, 42, 98, 98,  0,105, 49,  0,106, 49,  0,107, 49,  0,105,
- 50,  0,106, 50,  0,107, 50,  0,115,101,108, 99,111,108, 49,  0,115,101,108, 99,111,108, 50,  0,122,  0,113,117, 97,116, 91, 52,
- 93,  0,101,120,112,120,  0,101,120,112,121,  0,101,120,112,122,  0,114, 97,100,  0,114, 97,100, 50,  0,115,  0, 42,109, 97,116,
-  0, 42,105,109, 97,116,  0,101,108,101,109,115,  0,100,105,115,112,  0, 42,101,100,105,116,101,108,101,109,115,  0, 42, 42,109,
- 97,116,  0,102,108, 97,103, 50,  0,116,111,116, 99,111,108,  0,119,105,114,101,115,105,122,101,  0,114,101,110,100,101,114,115,
-105,122,101,  0,116,104,114,101,115,104,  0, 42,108, 97,115,116,101,108,101,109,  0,118,101, 99, 91, 51, 93, 91, 51, 93,  0, 97,
-108,102, 97,  0,119,101,105,103,104,116,  0,104, 49,  0,104, 50,  0,102, 49,  0,102, 50,  0,102, 51,  0,104,105,100,101,  0,118,
-101, 99, 91, 52, 93,  0,109, 97,116, 95,110,114,  0,112,110,116,115,117,  0,112,110,116,115,118,  0,114,101,115,111,108,117,  0,
-114,101,115,111,108,118,  0,111,114,100,101,114,117,  0,111,114,100,101,114,118,  0,102,108, 97,103,117,  0,102,108, 97,103,118,
-  0, 42,107,110,111,116,115,117,  0, 42,107,110,111,116,115,118,  0,116,105,108,116, 95,105,110,116,101,114,112,  0,114, 97,100,
-105,117,115, 95,105,110,116,101,114,112,  0, 99,104, 97,114,105,100,120,  0,107,101,114,110,  0,119,  0,104,  0,110,117,114, 98,
-115,  0, 42,107,101,121,105,110,100,101,120,  0,115,104, 97,112,101,110,114,  0,110,117,114, 98,  0, 42,101,100,105,116,110,117,
-114, 98,  0, 42, 98,101,118,111, 98,106,  0, 42,116, 97,112,101,114,111, 98,106,  0, 42,116,101,120,116,111,110, 99,117,114,118,
-101,  0, 42,112, 97,116,104,  0, 42,107,101,121,  0, 98,101,118,  0,100,114, 97,119,102,108, 97,103,  0,116,119,105,115,116, 95,
-109,111,100,101,  0,116,119,105,115,116, 95,115,109,111,111,116,104,  0,115,109, 97,108,108, 99, 97,112,115, 95,115, 99, 97,108,
-101,  0,112, 97,116,104,108,101,110,  0, 98,101,118,114,101,115,111,108,  0,119,105,100,116,104,  0,101,120,116, 49,  0,101,120,
-116, 50,  0,114,101,115,111,108,117, 95,114,101,110,  0,114,101,115,111,108,118, 95,114,101,110,  0, 97, 99,116,110,117,  0, 42,
-108, 97,115,116,115,101,108,  0,115,112, 97, 99,101,109,111,100,101,  0,115,112, 97, 99,105,110,103,  0,108,105,110,101,100,105,
-115,116,  0,115,104,101, 97,114,  0,102,115,105,122,101,  0,119,111,114,100,115,112, 97, 99,101,  0,117,108,112,111,115,  0,117,
-108,104,101,105,103,104,116,  0,120,111,102,  0,121,111,102,  0,108,105,110,101,119,105,100,116,104,  0, 42,115,116,114,  0, 42,
-115,101,108, 98,111,120,101,115,  0, 42,101,100,105,116,102,111,110,116,  0,102, 97,109,105,108,121, 91, 50, 52, 93,  0, 42,118,
-102,111,110,116,  0, 42,118,102,111,110,116, 98,  0, 42,118,102,111,110,116,105,  0, 42,118,102,111,110,116, 98,105,  0,115,101,
-112, 99,104, 97,114,  0, 99,116,105,109,101,  0,116,111,116, 98,111,120,  0, 97, 99,116, 98,111,120,  0, 42,116, 98,  0,115,101,
-108,115,116, 97,114,116,  0,115,101,108,101,110,100,  0, 42,115,116,114,105,110,102,111,  0, 99,117,114,105,110,102,111,  0, 42,
-109,102, 97, 99,101,  0, 42,109,116,102, 97, 99,101,  0, 42,116,102, 97, 99,101,  0, 42,109,118,101,114,116,  0, 42,109,101,100,
-103,101,  0, 42,100,118,101,114,116,  0, 42,109, 99,111,108,  0, 42,109,115,116,105, 99,107,121,  0, 42,116,101,120, 99,111,109,
-101,115,104,  0, 42,109,115,101,108,101, 99,116,  0, 42,101,100,105,116, 95,109,101,115,104,  0,118,100, 97,116, 97,  0,101,100,
- 97,116, 97,  0,102,100, 97,116, 97,  0,116,111,116,101,100,103,101,  0,116,111,116,102, 97, 99,101,  0,116,111,116,115,101,108,
-101, 99,116,  0, 97, 99,116, 95,102, 97, 99,101,  0,115,109,111,111,116,104,114,101,115,104,  0,115,117, 98,100,105,118,  0,115,
-117, 98,100,105,118,114,  0,115,117, 98,115,117,114,102,116,121,112,101,  0,101,100,105,116,102,108, 97,103,  0, 42,109,114,  0,
- 42,112,118,  0, 42,116,112, 97,103,101,  0,117,118, 91, 52, 93, 91, 50, 93,  0, 99,111,108, 91, 52, 93,  0,116,114, 97,110,115,
-112,  0,116,105,108,101,  0,117,110,119,114, 97,112,  0,118, 49,  0,118, 50,  0,118, 51,  0,118, 52,  0,101,100, 99,111,100,101,
-  0, 99,114,101, 97,115,101,  0, 98,119,101,105,103,104,116,  0,100,101,102, 95,110,114,  0, 42,100,119,  0,116,111,116,119,101,
-105,103,104,116,  0, 99,111, 91, 51, 93,  0,110,111, 91, 51, 93,  0,117,118, 91, 50, 93,  0, 99,111, 91, 50, 93,  0,102,  0,105,
-  0,115, 91, 50, 53, 54, 93,  0,116,111,116,100,105,115,112,  0, 40, 42,100,105,115,112,115, 41, 40, 41,  0,118, 91, 52, 93,  0,
-109,105,100,  0,112, 97,100, 91, 50, 93,  0,118, 91, 50, 93,  0, 42,102, 97, 99,101,115,  0, 42, 99,111,108,102, 97, 99,101,115,
-  0, 42,101,100,103,101,115,  0, 42,118,101,114,116,115,  0,108,101,118,101,108,115,  0,108,101,118,101,108, 95, 99,111,117,110,
-116,  0, 99,117,114,114,101,110,116,  0,110,101,119,108,118,108,  0,101,100,103,101,108,118,108,  0,112,105,110,108,118,108,  0,
-114,101,110,100,101,114,108,118,108,  0,117,115,101, 95, 99,111,108,  0, 42,101,100,103,101, 95,102,108, 97,103,115,  0, 42,101,
-100,103,101, 95, 99,114,101, 97,115,101,115,  0, 42,118,101,114,116, 95,109, 97,112,  0, 42,101,100,103,101, 95,109, 97,112,  0,
- 42,111,108,100, 95,102, 97, 99,101,115,  0, 42,111,108,100, 95,101,100,103,101,115,  0,115,116, 97, 99,107,105,110,100,101,120,
-  0, 42,101,114,114,111,114,  0,109,111,100,105,102,105,101,114,  0, 42,116,101,120,116,117,114,101,  0, 42,109, 97,112, 95,111,
- 98,106,101, 99,116,  0,117,118,108, 97,121,101,114, 95,110, 97,109,101, 91, 51, 50, 93,  0,117,118,108, 97,121,101,114, 95,116,
-109,112,  0,116,101,120,109, 97,112,112,105,110,103,  0,115,117, 98,100,105,118, 84,121,112,101,  0,114,101,110,100,101,114, 76,
-101,118,101,108,115,  0, 42,101,109, 67, 97, 99,104,101,  0, 42,109, 67, 97, 99,104,101,  0,100,101,102, 97,120,105,115,  0,112,
- 97,100, 91, 54, 93,  0,108,101,110,103,116,104,  0,114, 97,110,100,111,109,105,122,101,  0,115,101,101,100,  0, 42,111, 98, 95,
- 97,114,109,  0, 42,115,116, 97,114,116, 95, 99, 97,112,  0, 42,101,110,100, 95, 99, 97,112,  0, 42, 99,117,114,118,101, 95,111,
- 98,  0, 42,111,102,102,115,101,116, 95,111, 98,  0,111,102,102,115,101,116, 91, 51, 93,  0,115, 99, 97,108,101, 91, 51, 93,  0,
-109,101,114,103,101, 95,100,105,115,116,  0,102,105,116, 95,116,121,112,101,  0,111,102,102,115,101,116, 95,116,121,112,101,  0,
- 99,111,117,110,116,  0, 97,120,105,115,  0,116,111,108,101,114, 97,110, 99,101,  0, 42,109,105,114,114,111,114, 95,111, 98,  0,
-115,112,108,105,116, 95, 97,110,103,108,101,  0,118, 97,108,117,101,  0,114,101,115,  0,118, 97,108, 95,102,108, 97,103,115,  0,
-108,105,109, 95,102,108, 97,103,115,  0,101, 95,102,108, 97,103,115,  0, 98,101,118,101,108, 95, 97,110,103,108,101,  0,100,101,
-102,103,114,112, 95,110, 97,109,101, 91, 51, 50, 93,  0, 42,100,111,109, 97,105,110,  0, 42,102,108,111,119,  0, 42, 99,111,108,
-108,  0,116,105,109,101,  0,112, 97,100, 49, 48,  0,115,116,114,101,110,103,116,104,  0,100,105,114,101, 99,116,105,111,110,  0,
-109,105,100,108,101,118,101,108,  0, 42,112,114,111,106,101, 99,116,111,114,115, 91, 49, 48, 93,  0, 42,105,109, 97,103,101,  0,
-110,117,109, 95,112,114,111,106,101, 99,116,111,114,115,  0, 97,115,112,101, 99,116,120,  0, 97,115,112,101, 99,116,121,  0,115,
- 99, 97,108,101,120,  0,115, 99, 97,108,101,121,  0,112,101,114, 99,101,110,116,  0,102, 97, 99,101, 67,111,117,110,116,  0,102,
- 97, 99,  0,114,101,112,101, 97,116,  0, 42,111, 98,106,101, 99,116, 99,101,110,116,101,114,  0,115,116, 97,114,116,120,  0,115,
-116, 97,114,116,121,  0,104,101,105,103,104,116,  0,110, 97,114,114,111,119,  0,115,112,101,101,100,  0,100, 97,109,112,  0,102,
- 97,108,108,111,102,102,  0,116,105,109,101,111,102,102,115,  0,108,105,102,101,116,105,109,101,  0,100,101,102,111,114,109,102,
-108, 97,103,  0,109,117,108,116,105,  0, 42,112,114,101,118, 67,111,115,  0,115,117, 98,116, 97,114,103,101,116, 91, 51, 50, 93,
-  0,112, 97,114,101,110,116,105,110,118, 91, 52, 93, 91, 52, 93,  0, 99,101,110,116, 91, 51, 93,  0, 42,105,110,100,101,120, 97,
-114,  0,116,111,116,105,110,100,101,120,  0,102,111,114, 99,101,  0, 42, 99,108,111,116,104, 79, 98,106,101, 99,116,  0, 42,115,
-105,109, 95,112, 97,114,109,115,  0, 42, 99,111,108,108, 95,112, 97,114,109,115,  0, 42,112,111,105,110,116, 95, 99, 97, 99,104,
-101,  0,112,116, 99, 97, 99,104,101,115,  0, 42,120,  0, 42,120,110,101,119,  0, 42,120,111,108,100,  0, 42, 99,117,114,114,101,
-110,116, 95,120,110,101,119,  0, 42, 99,117,114,114,101,110,116, 95,120,  0, 42, 99,117,114,114,101,110,116, 95,118,  0, 42,109,
-102, 97, 99,101,115,  0,110,117,109,118,101,114,116,115,  0,110,117,109,102, 97, 99,101,115,  0,116,105,109,101, 95,120,  0,116,
-105,109,101, 95,120,110,101,119,  0, 42, 98,118,104,116,114,101,101,  0, 42,118,  0, 42,100,109,  0, 99,102,114, 97,  0,111,112,
-101,114, 97,116,105,111,110,  0,118,101,114,116,101,120,  0,116,111,116,105,110,102,108,117,101,110, 99,101,  0,103,114,105,100,
-115,105,122,101,  0, 42, 98,105,110,100,105,110,102,108,117,101,110, 99,101,115,  0, 42, 98,105,110,100,111,102,102,115,101,116,
-115,  0, 42, 98,105,110,100, 99, 97,103,101, 99,111,115,  0,116,111,116, 99, 97,103,101,118,101,114,116,  0, 42,100,121,110,103,
-114,105,100,  0, 42,100,121,110,105,110,102,108,117,101,110, 99,101,115,  0, 42,100,121,110,118,101,114,116,115,  0, 42,112, 97,
-100, 50,  0,100,121,110,103,114,105,100,115,105,122,101,  0,100,121,110, 99,101,108,108,109,105,110, 91, 51, 93,  0,100,121,110,
- 99,101,108,108,119,105,100,116,104,  0, 98,105,110,100,109, 97,116, 91, 52, 93, 91, 52, 93,  0, 42, 98,105,110,100,119,101,105,
-103,104,116,115,  0, 42, 98,105,110,100, 99,111,115,  0, 40, 42, 98,105,110,100,102,117,110, 99, 41, 40, 41,  0, 42,112,115,121,
-115,  0,116,111,116,100,109,118,101,114,116,  0,116,111,116,100,109,101,100,103,101,  0,116,111,116,100,109,102, 97, 99,101,  0,
-112,111,115,105,116,105,111,110,  0,114, 97,110,100,111,109, 95,112,111,115,105,116,105,111,110,  0, 42,102, 97, 99,101,112, 97,
-  0,118,103,114,111,117,112,  0,112,114,111,116,101, 99,116,  0,108,118,108,  0,115, 99,117,108,112,116,108,118,108,  0,116,111,
-116,108,118,108,  0,115,105,109,112,108,101,  0, 42,102,115,115,  0, 42,116, 97,114,103,101,116,  0, 42, 97,117,120, 84, 97,114,
-103,101,116,  0,118,103,114,111,117,112, 95,110, 97,109,101, 91, 51, 50, 93,  0,107,101,101,112, 68,105,115,116,  0,115,104,114,
-105,110,107, 84,121,112,101,  0,115,104,114,105,110,107, 79,112,116,115,  0,112,114,111,106, 65,120,105,115,  0,115,117, 98,115,
-117,114,102, 76,101,118,101,108,115,  0, 42,111,114,105,103,105,110,  0,102, 97, 99,116,111,114,  0,108,105,109,105,116, 91, 50,
- 93,  0,111,114,105,103,105,110, 79,112,116,115,  0,111,102,102,115,101,116, 95,102, 97, 99,  0, 99,114,101, 97,115,101, 95,105,
-110,110,101,114,  0, 99,114,101, 97,115,101, 95,111,117,116,101,114,  0, 99,114,101, 97,115,101, 95,114,105,109,  0,109, 97,116,
- 95,111,102,115,  0,109, 97,116, 95,111,102,115, 95,114,105,109,  0, 42,111, 98, 95, 97,120,105,115,  0,115,116,101,112,115,  0,
-114,101,110,100,101,114, 95,115,116,101,112,115,  0,105,116,101,114,  0,115, 99,114,101,119, 95,111,102,115,  0, 97,110,103,108,
-101,  0, 42,111, 98,106,101, 99,116, 95,102,114,111,109,  0, 42,111, 98,106,101, 99,116, 95,116,111,  0,102, 97,108,108,111,102,
-102, 95,114, 97,100,105,117,115,  0, 42,108, 97,116,116,  0,112,110,116,115,119,  0,111,112,110,116,115,117,  0,111,112,110,116,
-115,118,  0,111,112,110,116,115,119,  0,116,121,112,101,117,  0,116,121,112,101,118,  0,116,121,112,101,119,  0,102,117,  0,102,
-118,  0,102,119,  0,100,117,  0,100,118,  0,100,119,  0, 42,100,101,102,  0, 42,108, 97,116,116,105, 99,101,100, 97,116, 97,  0,
-108, 97,116,109, 97,116, 91, 52, 93, 91, 52, 93,  0, 42,101,100,105,116,108, 97,116,116,  0,118,101, 99, 91, 56, 93, 91, 51, 93,
-  0, 42,115, 99,117,108,112,116,  0,112, 97,114,116,121,112,101,  0,112, 97,114, 49,  0,112, 97,114, 50,  0,112, 97,114, 51,  0,
-112, 97,114,115,117, 98,115,116,114, 91, 51, 50, 93,  0, 42,116,114, 97, 99,107,  0, 42,112,114,111,120,121,  0, 42,112,114,111,
-120,121, 95,103,114,111,117,112,  0, 42,112,114,111,120,121, 95,102,114,111,109,  0, 42, 97, 99,116,105,111,110,  0, 42,112,111,
-115,101,108,105, 98,  0, 42,112,111,115,101,  0, 42,103,112,100,  0, 97,118,115,  0, 42,109,112, 97,116,104,  0, 99,111,110,115,
-116,114, 97,105,110,116, 67,104, 97,110,110,101,108,115,  0,101,102,102,101, 99,116,  0,100,101,102, 98, 97,115,101,  0,109,111,
-100,105,102,105,101,114,115,  0,114,101,115,116,111,114,101, 95,109,111,100,101,  0, 42,109, 97,116, 98,105,116,115,  0, 97, 99,
-116, 99,111,108,  0,100,108,111, 99, 91, 51, 93,  0,111,114,105,103, 91, 51, 93,  0,100,115,105,122,101, 91, 51, 93,  0,100,114,
-111,116, 91, 51, 93,  0,100,113,117, 97,116, 91, 52, 93,  0,114,111,116, 65,120,105,115, 91, 51, 93,  0,100,114,111,116, 65,120,
-105,115, 91, 51, 93,  0,114,111,116, 65,110,103,108,101,  0,100,114,111,116, 65,110,103,108,101,  0,111, 98,109, 97,116, 91, 52,
- 93, 91, 52, 93,  0, 99,111,110,115,116,105,110,118, 91, 52, 93, 91, 52, 93,  0,105,109, 97,116, 95,114,101,110, 91, 52, 93, 91,
- 52, 93,  0,108, 97,121,  0, 99,111,108, 98,105,116,115,  0,116,114, 97,110,115,102,108, 97,103,  0,112,114,111,116,101, 99,116,
-102,108, 97,103,  0,116,114, 97, 99,107,102,108, 97,103,  0,117,112,102,108, 97,103,  0,110,108, 97,102,108, 97,103,  0,105,112,
-111,102,108, 97,103,  0,105,112,111,119,105,110,  0,115, 99, 97,102,108, 97,103,  0,115, 99, 97,118,105,115,102,108, 97,103,  0,
- 98,111,117,110,100,116,121,112,101,  0,100,117,112,111,110,  0,100,117,112,111,102,102,  0,100,117,112,115,116, 97,  0,100,117,
-112,101,110,100,  0,115,102,  0,109, 97,115,115,  0,100, 97,109,112,105,110,103,  0,105,110,101,114,116,105, 97,  0,102,111,114,
-109,102, 97, 99,116,111,114,  0,114,100, 97,109,112,105,110,103,  0,109, 97,114,103,105,110,  0,109, 97,120, 95,118,101,108,  0,
-109,105,110, 95,118,101,108,  0,109, 95, 99,111,110,116, 97, 99,116, 80,114,111, 99,101,115,115,105,110,103, 84,104,114,101,115,
-104,111,108,100,  0,114,111,116,109,111,100,101,  0,100,116,  0,101,109,112,116,121, 95,100,114, 97,119,116,121,112,101,  0,112,
- 97,100, 49, 91, 51, 93,  0,101,109,112,116,121, 95,100,114, 97,119,115,105,122,101,  0,100,117,112,102, 97, 99,101,115, 99, 97,
-  0,112,114,111,112,  0,115,101,110,115,111,114,115,  0, 99,111,110,116,114,111,108,108,101,114,115,  0, 97, 99,116,117, 97,116,
-111,114,115,  0, 98, 98,115,105,122,101, 91, 51, 93,  0, 97, 99,116,100,101,102,  0,103, 97,109,101,102,108, 97,103,  0,103, 97,
-109,101,102,108, 97,103, 50,  0, 42, 98,115,111,102,116,  0,115,111,102,116,102,108, 97,103,  0, 97,110,105,115,111,116,114,111,
-112,105, 99, 70,114,105, 99,116,105,111,110, 91, 51, 93,  0, 99,111,110,115,116,114, 97,105,110,116,115,  0,110,108, 97,115,116,
-114,105,112,115,  0,104,111,111,107,115,  0,112, 97,114,116,105, 99,108,101,115,121,115,116,101,109,  0, 42,115,111,102,116,  0,
- 42,100,117,112, 95,103,114,111,117,112,  0,102,108,117,105,100,115,105,109, 70,108, 97,103,  0,114,101,115,116,114,105, 99,116,
-102,108, 97,103,  0,115,104, 97,112,101,102,108, 97,103,  0,114,101, 99, 97,108, 99,111,  0, 98,111,100,121, 95,116,121,112,101,
-  0, 42,102,108,117,105,100,115,105,109, 83,101,116,116,105,110,103,115,  0, 42,100,101,114,105,118,101,100, 68,101,102,111,114,
-109,  0, 42,100,101,114,105,118,101,100, 70,105,110, 97,108,  0,108, 97,115,116, 68, 97,116, 97, 77, 97,115,107,  0, 99,117,115,
-116,111,109,100, 97,116, 97, 95,109, 97,115,107,  0,115,116, 97,116,101,  0,105,110,105,116, 95,115,116, 97,116,101,  0,103,112,
-117,108, 97,109,112,  0,112, 99, 95,105,100,115,  0, 42,100,117,112,108,105,108,105,115,116,  0,105,109, 97, 95,111,102,115, 91,
- 50, 93,  0,112, 97,100, 51, 91, 56, 93,  0, 99,117,114,105,110,100,101,120,  0, 97, 99,116,105,118,101,  0,111,114,105,103,108,
- 97,121,  0,110,111, 95,100,114, 97,119,  0, 97,110,105,109, 97,116,101,100,  0,111,109, 97,116, 91, 52, 93, 91, 52, 93,  0,111,
-114, 99,111, 91, 51, 93,  0,100,101,102,108,101, 99,116,  0,102,111,114, 99,101,102,105,101,108,100,  0,115,104, 97,112,101,  0,
-116,101,120, 95,109,111,100,101,  0,107,105,110,107,  0,107,105,110,107, 95, 97,120,105,115,  0,122,100,105,114,  0,102, 95,115,
-116,114,101,110,103,116,104,  0,102, 95,100, 97,109,112,  0,102, 95,102,108,111,119,  0,102, 95,115,105,122,101,  0,102, 95,112,
-111,119,101,114,  0,109, 97,120,100,105,115,116,  0,109,105,110,100,105,115,116,  0,102, 95,112,111,119,101,114, 95,114,  0,109,
- 97,120,114, 97,100,  0,109,105,110,114, 97,100,  0,112,100,101,102, 95,100, 97,109,112,  0,112,100,101,102, 95,114,100, 97,109,
-112,  0,112,100,101,102, 95,112,101,114,109,  0,112,100,101,102, 95,102,114,105, 99,116,  0,112,100,101,102, 95,114,102,114,105,
- 99,116,  0,112,100,101,102, 95,115,116,105, 99,107,110,101,115,115,  0, 97, 98,115,111,114,112,116,105,111,110,  0,112,100,101,
-102, 95,115, 98,100, 97,109,112,  0,112,100,101,102, 95,115, 98,105,102,116,  0,112,100,101,102, 95,115, 98,111,102,116,  0, 99,
-108,117,109,112, 95,102, 97, 99,  0, 99,108,117,109,112, 95,112,111,119,  0,107,105,110,107, 95,102,114,101,113,  0,107,105,110,
-107, 95,115,104, 97,112,101,  0,107,105,110,107, 95, 97,109,112,  0,102,114,101,101, 95,101,110,100,  0,116,101,120, 95,110, 97,
- 98,108, 97,  0, 42,114,110,103,  0,102, 95,110,111,105,115,101,  0,119,101,105,103,104,116, 91, 49, 51, 93,  0,103,108,111, 98,
- 97,108, 95,103,114, 97,118,105,116,121,  0,114,116, 91, 51, 93,  0,116,111,116,100, 97,116, 97,  0,102,114, 97,109,101,  0,116,
-111,116,112,111,105,110,116,  0,100, 97,116, 97, 95,116,121,112,101,115,  0, 42,100, 97,116, 97, 91, 56, 93,  0, 42, 99,117,114,
- 91, 56, 93,  0,101,120,116,114, 97,100, 97,116, 97,  0,115,116,101,112,  0,115,105,109,102,114, 97,109,101,  0,115,116, 97,114,
-116,102,114, 97,109,101,  0,101,110,100,102,114, 97,109,101,  0,101,100,105,116,102,114, 97,109,101,  0,108, 97,115,116, 95,101,
-120, 97, 99,116,  0, 99,111,109,112,114,101,115,115,105,111,110,  0,110, 97,109,101, 91, 54, 52, 93,  0,112,114,101,118, 95,110,
- 97,109,101, 91, 54, 52, 93,  0,105,110,102,111, 91, 54, 52, 93,  0,112, 97,116,104, 91, 50, 52, 48, 93,  0, 42, 99, 97, 99,104,
-101,100, 95,102,114, 97,109,101,115,  0,109,101,109, 95, 99, 97, 99,104,101,  0, 42,101,100,105,116,  0, 40, 42,102,114,101,101,
- 95,101,100,105,116, 41, 40, 41,  0,108,105,110, 83,116,105,102,102,  0, 97,110,103, 83,116,105,102,102,  0,118,111,108,117,109,
-101,  0,118,105,116,101,114, 97,116,105,111,110,115,  0,112,105,116,101,114, 97,116,105,111,110,115,  0,100,105,116,101,114, 97,
-116,105,111,110,115,  0, 99,105,116,101,114, 97,116,105,111,110,115,  0,107, 83, 82, 72, 82, 95, 67, 76,  0,107, 83, 75, 72, 82,
- 95, 67, 76,  0,107, 83, 83, 72, 82, 95, 67, 76,  0,107, 83, 82, 95, 83, 80, 76, 84, 95, 67, 76,  0,107, 83, 75, 95, 83, 80, 76,
- 84, 95, 67, 76,  0,107, 83, 83, 95, 83, 80, 76, 84, 95, 67, 76,  0,107, 86, 67, 70,  0,107, 68, 80,  0,107, 68, 71,  0,107, 76,
- 70,  0,107, 80, 82,  0,107, 86, 67,  0,107, 68, 70,  0,107, 77, 84,  0,107, 67, 72, 82,  0,107, 75, 72, 82,  0,107, 83, 72, 82,
-  0,107, 65, 72, 82,  0, 99,111,108,108,105,115,105,111,110,102,108, 97,103,115,  0,110,117,109, 99,108,117,115,116,101,114,105,
-116,101,114, 97,116,105,111,110,115,  0,119,101,108,100,105,110,103,  0,116,111,116,115,112,114,105,110,103,  0, 42, 98,112,111,
-105,110,116,  0, 42, 98,115,112,114,105,110,103,  0,109,115,103, 95,108,111, 99,107,  0,109,115,103, 95,118, 97,108,117,101,  0,
-110,111,100,101,109, 97,115,115,  0,110, 97,109,101,100, 86, 71, 95, 77, 97,115,115, 91, 51, 50, 93,  0,103,114, 97,118,  0,109,
-101,100,105, 97,102,114,105, 99,116,  0,114,107,108,105,109,105,116,  0,112,104,121,115,105, 99,115, 95,115,112,101,101,100,  0,
-103,111, 97,108,115,112,114,105,110,103,  0,103,111, 97,108,102,114,105, 99,116,  0,109,105,110,103,111, 97,108,  0,109, 97,120,
-103,111, 97,108,  0,100,101,102,103,111, 97,108,  0,118,101,114,116,103,114,111,117,112,  0,110, 97,109,101,100, 86, 71, 95, 83,
-111,102,116,103,111, 97,108, 91, 51, 50, 93,  0,102,117,122,122,121,110,101,115,115,  0,105,110,115,112,114,105,110,103,  0,105,
-110,102,114,105, 99,116,  0,110, 97,109,101,100, 86, 71, 95, 83,112,114,105,110,103, 95, 75, 91, 51, 50, 93,  0,101,102,114, 97,
-  0,105,110,116,101,114,118, 97,108,  0,108,111, 99, 97,108,  0,115,111,108,118,101,114,102,108, 97,103,115,  0, 42, 42,107,101,
-121,115,  0,116,111,116,112,111,105,110,116,107,101,121,  0,115,101, 99,111,110,100,115,112,114,105,110,103,  0, 99,111,108, 98,
- 97,108,108,  0, 98, 97,108,108,100, 97,109,112,  0, 98, 97,108,108,115,116,105,102,102,  0,115, 98, 99, 95,109,111,100,101,  0,
- 97,101,114,111,101,100,103,101,  0,109,105,110,108,111,111,112,115,  0,109, 97,120,108,111,111,112,115,  0, 99,104,111,107,101,
-  0,115,111,108,118,101,114, 95, 73, 68,  0,112,108, 97,115,116,105, 99,  0,115,112,114,105,110,103,112,114,101,108,111, 97,100,
-  0, 42,115, 99,114, 97,116, 99,104,  0,115,104,101, 97,114,115,116,105,102,102,  0,105,110,112,117,115,104,  0, 42,112,111,105,
-110,116, 99, 97, 99,104,101,  0, 42,101,102,102,101, 99,116,111,114, 95,119,101,105,103,104,116,115,  0,108, 99,111,109, 91, 51,
- 93,  0,108,114,111,116, 91, 51, 93, 91, 51, 93,  0,108,115, 99, 97,108,101, 91, 51, 93, 91, 51, 93,  0,112, 97,100, 52, 91, 52,
- 93,  0,118,101,108, 91, 51, 93,  0, 42,102,109,100,  0,115,104,111,119, 95, 97,100,118, 97,110, 99,101,100,111,112,116,105,111,
-110,115,  0,114,101,115,111,108,117,116,105,111,110,120,121,122,  0,112,114,101,118,105,101,119,114,101,115,120,121,122,  0,114,
-101, 97,108,115,105,122,101,  0,103,117,105, 68,105,115,112,108, 97,121, 77,111,100,101,  0,114,101,110,100,101,114, 68,105,115,
-112,108, 97,121, 77,111,100,101,  0,118,105,115, 99,111,115,105,116,121, 86, 97,108,117,101,  0,118,105,115, 99,111,115,105,116,
-121, 77,111,100,101,  0,118,105,115, 99,111,115,105,116,121, 69,120,112,111,110,101,110,116,  0,103,114, 97,118, 91, 51, 93,  0,
- 97,110,105,109, 83,116, 97,114,116,  0, 97,110,105,109, 69,110,100,  0, 98, 97,107,101, 83,116, 97,114,116,  0, 98, 97,107,101,
- 69,110,100,  0,103,115,116, 97,114,  0,109, 97,120, 82,101,102,105,110,101,  0,105,110,105, 86,101,108,120,  0,105,110,105, 86,
-101,108,121,  0,105,110,105, 86,101,108,122,  0, 42,111,114,103, 77,101,115,104,  0, 42,109,101,115,104, 66, 66,  0,115,117,114,
-102,100, 97,116, 97, 80, 97,116,104, 91, 50, 52, 48, 93,  0, 98, 98, 83,116, 97,114,116, 91, 51, 93,  0, 98, 98, 83,105,122,101,
- 91, 51, 93,  0,116,121,112,101, 70,108, 97,103,115,  0,100,111,109, 97,105,110, 78,111,118,101, 99,103,101,110,  0,118,111,108,
-117,109,101, 73,110,105,116, 84,121,112,101,  0,112, 97,114,116, 83,108,105,112, 86, 97,108,117,101,  0,103,101,110,101,114, 97,
-116,101, 84,114, 97, 99,101,114,115,  0,103,101,110,101,114, 97,116,101, 80, 97,114,116,105, 99,108,101,115,  0,115,117,114,102,
- 97, 99,101, 83,109,111,111,116,104,105,110,103,  0,115,117,114,102, 97, 99,101, 83,117, 98,100,105,118,115,  0,112, 97,114,116,
-105, 99,108,101, 73,110,102, 83,105,122,101,  0,112, 97,114,116,105, 99,108,101, 73,110,102, 65,108,112,104, 97,  0,102, 97,114,
- 70,105,101,108,100, 83,105,122,101,  0, 42,109,101,115,104, 86,101,108,111, 99,105,116,105,101,115,  0, 99,112,115, 84,105,109,
-101, 83,116, 97,114,116,  0, 99,112,115, 84,105,109,101, 69,110,100,  0, 99,112,115, 81,117, 97,108,105,116,121,  0, 97,116,116,
-114, 97, 99,116,102,111,114, 99,101, 83,116,114,101,110,103,116,104,  0, 97,116,116,114, 97, 99,116,102,111,114, 99,101, 82, 97,
-100,105,117,115,  0,118,101,108,111, 99,105,116,121,102,111,114, 99,101, 83,116,114,101,110,103,116,104,  0,118,101,108,111, 99,
-105,116,121,102,111,114, 99,101, 82, 97,100,105,117,115,  0,108, 97,115,116,103,111,111,100,102,114, 97,109,101,  0,109,105,115,
-116,121,112,101,  0,104,111,114,114,  0,104,111,114,103,  0,104,111,114, 98,  0,122,101,110,114,  0,122,101,110,103,  0,122,101,
-110, 98,  0,102, 97,115,116, 99,111,108,  0,101,120,112,111,115,117,114,101,  0,101,120,112,  0,114, 97,110,103,101,  0,108,105,
-110,102, 97, 99,  0,108,111,103,102, 97, 99,  0,103,114, 97,118,105,116,121,  0, 97, 99,116,105,118,105,116,121, 66,111,120, 82,
- 97,100,105,117,115,  0,115,107,121,116,121,112,101,  0,111, 99, 99,108,117,115,105,111,110, 82,101,115,  0,112,104,121,115,105,
- 99,115, 69,110,103,105,110,101,  0,116,105, 99,114, 97,116,101,  0,109, 97,120,108,111,103,105, 99,115,116,101,112,  0,112,104,
-121,115,117, 98,115,116,101,112,  0,109, 97,120,112,104,121,115,116,101,112,  0,109,105,115,105,  0,109,105,115,116,115,116, 97,
-  0,109,105,115,116,100,105,115,116,  0,109,105,115,116,104,105,  0,115,116, 97,114,114,  0,115,116, 97,114,103,  0,115,116, 97,
-114, 98,  0,115,116, 97,114,107,  0,115,116, 97,114,115,105,122,101,  0,115,116, 97,114,109,105,110,100,105,115,116,  0,115,116,
- 97,114,100,105,115,116,  0,115,116, 97,114, 99,111,108,110,111,105,115,101,  0,100,111,102,115,116, 97,  0,100,111,102,101,110,
-100,  0,100,111,102,109,105,110,  0,100,111,102,109, 97,120,  0, 97,111,100,105,115,116,  0, 97,111,100,105,115,116,102, 97, 99,
-  0, 97,111,101,110,101,114,103,121,  0, 97,111, 98,105, 97,115,  0, 97,111,109,111,100,101,  0, 97,111,115, 97,109,112,  0, 97,
-111,109,105,120,  0, 97,111, 99,111,108,111,114,  0, 97,111, 95, 97,100, 97,112,116, 95,116,104,114,101,115,104,  0, 97,111, 95,
- 97,100, 97,112,116, 95,115,112,101,101,100, 95,102, 97, 99,  0, 97,111, 95, 97,112,112,114,111,120, 95,101,114,114,111,114,  0,
- 97,111, 95, 97,112,112,114,111,120, 95, 99,111,114,114,101, 99,116,105,111,110,  0, 97,111, 95,105,110,100,105,114,101, 99,116,
- 95,101,110,101,114,103,121,  0, 97,111, 95,101,110,118, 95,101,110,101,114,103,121,  0, 97,111, 95,112, 97,100, 50,  0, 97,111,
- 95,105,110,100,105,114,101, 99,116, 95, 98,111,117,110, 99,101,115,  0, 97,111, 95,112, 97,100,  0, 97,111, 95,115, 97,109,112,
- 95,109,101,116,104,111,100,  0, 97,111, 95,103, 97,116,104,101,114, 95,109,101,116,104,111,100,  0, 97,111, 95, 97,112,112,114,
-111,120, 95,112, 97,115,115,101,115,  0, 42, 97,111,115,112,104,101,114,101,  0, 42, 97,111,116, 97, 98,108,101,115,  0,112, 97,
-100, 91, 51, 93,  0,115,101,108, 99,111,108,  0,115,120,  0,115,121,  0, 42,108,112, 70,111,114,109, 97,116,  0, 42,108,112, 80,
- 97,114,109,115,  0, 99, 98, 70,111,114,109, 97,116,  0, 99, 98, 80, 97,114,109,115,  0,102, 99, 99, 84,121,112,101,  0,102, 99,
- 99, 72, 97,110,100,108,101,114,  0,100,119, 75,101,121, 70,114, 97,109,101, 69,118,101,114,121,  0,100,119, 81,117, 97,108,105,
-116,121,  0,100,119, 66,121,116,101,115, 80,101,114, 83,101, 99,111,110,100,  0,100,119, 70,108, 97,103,115,  0,100,119, 73,110,
-116,101,114,108,101, 97,118,101, 69,118,101,114,121,  0, 97,118,105, 99,111,100,101, 99,110, 97,109,101, 91, 49, 50, 56, 93,  0,
- 42, 99,100, 80, 97,114,109,115,  0, 42,112, 97,100,  0, 99,100, 83,105,122,101,  0,113,116, 99,111,100,101, 99,110, 97,109,101,
- 91, 49, 50, 56, 93,  0, 99,111,100,101, 99, 84,121,112,101,  0, 99,111,100,101, 99, 83,112, 97,116,105, 97,108, 81,117, 97,108,
-105,116,121,  0, 99,111,100,101, 99,  0, 99,111,100,101, 99, 70,108, 97,103,115,  0, 99,111,108,111,114, 68,101,112,116,104,  0,
- 99,111,100,101, 99, 84,101,109,112,111,114, 97,108, 81,117, 97,108,105,116,121,  0,109,105,110, 83,112, 97,116,105, 97,108, 81,
-117, 97,108,105,116,121,  0,109,105,110, 84,101,109,112,111,114, 97,108, 81,117, 97,108,105,116,121,  0,107,101,121, 70,114, 97,
-109,101, 82, 97,116,101,  0, 98,105,116, 82, 97,116,101,  0, 97,117,100,105,111, 99,111,100,101, 99, 84,121,112,101,  0, 97,117,
-100,105,111, 83, 97,109,112,108,101, 82, 97,116,101,  0, 97,117,100,105,111, 66,105,116, 68,101,112,116,104,  0, 97,117,100,105,
-111, 67,104, 97,110,110,101,108,115,  0, 97,117,100,105,111, 67,111,100,101, 99, 70,108, 97,103,115,  0, 97,117,100,105,111, 66,
-105,116, 82, 97,116,101,  0, 97,117,100,105,111, 95, 99,111,100,101, 99,  0,118,105,100,101,111, 95, 98,105,116,114, 97,116,101,
-  0, 97,117,100,105,111, 95, 98,105,116,114, 97,116,101,  0, 97,117,100,105,111, 95,109,105,120,114, 97,116,101,  0, 97,117,100,
-105,111, 95, 99,104, 97,110,110,101,108,115,  0, 97,117,100,105,111, 95,112, 97,100,  0, 97,117,100,105,111, 95,118,111,108,117,
-109,101,  0,103,111,112, 95,115,105,122,101,  0,114, 99, 95,109,105,110, 95,114, 97,116,101,  0,114, 99, 95,109, 97,120, 95,114,
- 97,116,101,  0,114, 99, 95, 98,117,102,102,101,114, 95,115,105,122,101,  0,109,117,120, 95,112, 97, 99,107,101,116, 95,115,105,
-122,101,  0,109,117,120, 95,114, 97,116,101,  0,109,105,120,114, 97,116,101,  0,109, 97,105,110,  0,115,112,101,101,100, 95,111,
-102, 95,115,111,117,110,100,  0,100,111,112,112,108,101,114, 95,102, 97, 99,116,111,114,  0,100,105,115,116, 97,110, 99,101, 95,
-109,111,100,101,108,  0, 42,109, 97,116, 95,111,118,101,114,114,105,100,101,  0, 42,108,105,103,104,116, 95,111,118,101,114,114,
-105,100,101,  0,108, 97,121, 95,122,109, 97,115,107,  0,108, 97,121,102,108, 97,103,  0,112, 97,115,115,102,108, 97,103,  0,112,
- 97,115,115, 95,120,111,114,  0, 42, 97,118,105, 99,111,100,101, 99,100, 97,116, 97,  0, 42,113,116, 99,111,100,101, 99,100, 97,
-116, 97,  0,113,116, 99,111,100,101, 99,115,101,116,116,105,110,103,115,  0,102,102, 99,111,100,101, 99,100, 97,116, 97,  0,115,
-117, 98,102,114, 97,109,101,  0,112,115,102,114, 97,  0,112,101,102,114, 97,  0,105,109, 97,103,101,115,  0,102,114, 97,109, 97,
-112,116,111,  0,116,104,114,101, 97,100,115,  0,102,114, 97,109,101,108,101,110,  0, 98,108,117,114,102, 97, 99,  0,101,100,103,
-101, 82,  0,101,100,103,101, 71,  0,101,100,103,101, 66,  0,102,117,108,108,115, 99,114,101,101,110,  0,120,112,108, 97,121,  0,
-121,112,108, 97,121,  0,102,114,101,113,112,108, 97,121,  0, 97,116,116,114,105, 98,  0,102,114, 97,109,101, 95,115,116,101,112,
-  0,115,116,101,114,101,111,109,111,100,101,  0,100,105,109,101,110,115,105,111,110,115,112,114,101,115,101,116,  0,109, 97,120,
-105,109,115,105,122,101,  0,120,115, 99,104,  0,121,115, 99,104,  0,120,112, 97,114,116,115,  0,121,112, 97,114,116,115,  0,112,
-108, 97,110,101,115,  0,105,109,116,121,112,101,  0,115,117, 98,105,109,116,121,112,101,  0,113,117, 97,108,105,116,121,  0,100,
-105,115,112,108, 97,121,109,111,100,101,  0,115, 99,101,109,111,100,101,  0,114, 97,121,116,114, 97, 99,101, 95,111,112,116,105,
-111,110,115,  0,114, 97,121,116,114, 97, 99,101, 95,115,116,114,117, 99,116,117,114,101,  0,114,101,110,100,101,114,101,114,  0,
-111, 99,114,101,115,  0,112, 97,100, 52,  0, 97,108,112,104, 97,109,111,100,101,  0,111,115, 97,  0,102,114,115, 95,115,101, 99,
-  0,101,100,103,101,105,110,116,  0,115, 97,102,101,116,121,  0, 98,111,114,100,101,114,  0,100,105,115,112,114,101, 99,116,  0,
-108, 97,121,101,114,115,  0, 97, 99,116,108, 97,121,  0,109, 98,108,117,114, 95,115, 97,109,112,108,101,115,  0,120, 97,115,112,
-  0,121, 97,115,112,  0,102,114,115, 95,115,101, 99, 95, 98, 97,115,101,  0,103, 97,117,115,115,  0, 99,111,108,111,114, 95,109,
-103,116, 95,102,108, 97,103,  0,112,111,115,116,103, 97,109,109, 97,  0,112,111,115,116,104,117,101,  0,112,111,115,116,115, 97,
-116,  0,100,105,116,104,101,114, 95,105,110,116,101,110,115,105,116,121,  0, 98, 97,107,101, 95,111,115, 97,  0, 98, 97,107,101,
- 95,102,105,108,116,101,114,  0, 98, 97,107,101, 95,109,111,100,101,  0, 98, 97,107,101, 95,102,108, 97,103,  0, 98, 97,107,101,
- 95,110,111,114,109, 97,108, 95,115,112, 97, 99,101,  0, 98, 97,107,101, 95,113,117, 97,100, 95,115,112,108,105,116,  0, 98, 97,
-107,101, 95,109, 97,120,100,105,115,116,  0, 98, 97,107,101, 95, 98,105, 97,115,100,105,115,116,  0, 98, 97,107,101, 95,112, 97,
-100,  0,112,105, 99, 91, 50, 52, 48, 93,  0,115,116, 97,109,112,  0,115,116, 97,109,112, 95,102,111,110,116, 95,105,100,  0,115,
-116, 97,109,112, 95,117,100, 97,116, 97, 91, 49, 54, 48, 93,  0,102,103, 95,115,116, 97,109,112, 91, 52, 93,  0, 98,103, 95,115,
-116, 97,109,112, 91, 52, 93,  0,115,101,113, 95,112,114,101,118, 95,116,121,112,101,  0,115,101,113, 95,114,101,110,100, 95,116,
-121,112,101,  0,115,101,113, 95,102,108, 97,103,  0,112, 97,100, 53, 91, 53, 93,  0,115,105,109,112,108,105,102,121, 95,102,108,
- 97,103,  0,115,105,109,112,108,105,102,121, 95,115,117, 98,115,117,114,102,  0,115,105,109,112,108,105,102,121, 95,115,104, 97,
-100,111,119,115, 97,109,112,108,101,115,  0,115,105,109,112,108,105,102,121, 95,112, 97,114,116,105, 99,108,101,115,  0,115,105,
-109,112,108,105,102,121, 95, 97,111,115,115,115,  0, 99,105,110,101,111,110,119,104,105,116,101,  0, 99,105,110,101,111,110, 98,
-108, 97, 99,107,  0, 99,105,110,101,111,110,103, 97,109,109, 97,  0,106,112, 50, 95,112,114,101,115,101,116,  0,106,112, 50, 95,
-100,101,112,116,104,  0,114,112, 97,100, 51,  0,100,111,109,101,114,101,115,  0,100,111,109,101,109,111,100,101,  0,100,111,109,
-101, 97,110,103,108,101,  0,100,111,109,101,116,105,108,116,  0,100,111,109,101,114,101,115, 98,117,102,  0, 42,100,111,109,101,
-116,101,120,116,  0,101,110,103,105,110,101, 91, 51, 50, 93,  0,112, 97,114,116,105, 99,108,101, 95,112,101,114, 99,  0,115,117,
- 98,115,117,114,102, 95,109, 97,120,  0,115,104, 97,100, 98,117,102,115, 97,109,112,108,101, 95,109, 97,120,  0, 97,111, 95,101,
-114,114,111,114,  0,116,105,108,116,  0,114,101,115, 98,117,102,  0, 42,119, 97,114,112,116,101,120,116,  0, 99,111,108, 91, 51,
- 93,  0,109, 97,116,109,111,100,101,  0,102,114, 97,109,105,110,103,  0,114,116, 49,  0,114,116, 50,  0,100,111,109,101,  0,115,
-116,101,114,101,111,102,108, 97,103,  0,101,121,101,115,101,112, 97,114, 97,116,105,111,110,  0, 42, 99, 97,109,101,114, 97,  0,
- 42, 98,114,117,115,104,  0, 42,112, 97,105,110,116, 95, 99,117,114,115,111,114,  0,112, 97,105,110,116, 95, 99,117,114,115,111,
-114, 95, 99,111,108, 91, 52, 93,  0,112, 97,105,110,116,  0,115,101, 97,109, 95, 98,108,101,101,100,  0,110,111,114,109, 97,108,
- 95, 97,110,103,108,101,  0,115, 99,114,101,101,110, 95,103,114, 97, 98, 95,115,105,122,101, 91, 50, 93,  0, 42,112, 97,105,110,
-116, 99,117,114,115,111,114,  0,105,110,118,101,114,116,  0,116,111,116,114,101,107,101,121,  0,116,111,116, 97,100,100,107,101,
-121,  0, 98,114,117,115,104,116,121,112,101,  0, 98,114,117,115,104, 91, 55, 93,  0,101,109,105,116,116,101,114,100,105,115,116,
-  0,115,101,108,101, 99,116,109,111,100,101,  0,101,100,105,116,116,121,112,101,  0,100,114, 97,119, 95,115,116,101,112,  0,102,
- 97,100,101, 95,102,114, 97,109,101,115,  0,110, 97,109,101, 91, 51, 54, 93,  0,109, 97,116, 91, 51, 93, 91, 51, 93,  0,114, 97,
-100,105, 97,108, 95,115,121,109,109, 91, 51, 93,  0,108, 97,115,116, 95,120,  0,108, 97,115,116, 95,121,  0,108, 97,115,116, 95,
- 97,110,103,108,101,  0,100,114, 97,119, 95, 97,110, 99,104,111,114,101,100,  0, 97,110, 99,104,111,114,101,100, 95,115,105,122,
-101,  0, 97,110, 99,104,111,114,101,100, 95,108,111, 99, 97,116,105,111,110, 91, 51, 93,  0, 97,110, 99,104,111,114,101,100, 95,
-105,110,105,116,105, 97,108, 95,109,111,117,115,101, 91, 50, 93,  0,100,114, 97,119, 95,112,114,101,115,115,117,114,101,  0,112,
-114,101,115,115,117,114,101, 95,118, 97,108,117,101,  0,115,112,101, 99,105, 97,108, 95,114,111,116, 97,116,105,111,110,  0, 42,
-118,112, 97,105,110,116, 95,112,114,101,118,  0, 42,119,112, 97,105,110,116, 95,112,114,101,118,  0, 42,118,112, 97,105,110,116,
-  0, 42,119,112, 97,105,110,116,  0,118,103,114,111,117,112, 95,119,101,105,103,104,116,  0, 99,111,114,110,101,114,116,121,112,
-101,  0,101,100,105,116, 98,117,116,102,108, 97,103,  0,106,111,105,110,116,114,105,108,105,109,105,116,  0,100,101,103,114,  0,
-116,117,114,110,  0,101,120,116,114, 95,111,102,102,115,  0,100,111,117, 98,108,105,109,105,116,  0,110,111,114,109, 97,108,115,
-105,122,101,  0, 97,117,116,111,109,101,114,103,101,  0,115,101,103,109,101,110,116,115,  0,114,105,110,103,115,  0,118,101,114,
-116,105, 99,101,115,  0,117,110,119,114, 97,112,112,101,114,  0,117,118, 99, 97,108, 99, 95,114, 97,100,105,117,115,  0,117,118,
- 99, 97,108, 99, 95, 99,117, 98,101,115,105,122,101,  0,117,118, 99, 97,108, 99, 95,109, 97,114,103,105,110,  0,117,118, 99, 97,
-108, 99, 95,109, 97,112,100,105,114,  0,117,118, 99, 97,108, 99, 95,109, 97,112, 97,108,105,103,110,  0,117,118, 99, 97,108, 99,
- 95,102,108, 97,103,  0,117,118, 95,102,108, 97,103,  0,117,118, 95,115,101,108,101, 99,116,109,111,100,101,  0,117,118, 95,112,
- 97,100,  0,103,112,101,110, 99,105,108, 95,102,108, 97,103,115,  0, 97,117,116,111,105,107, 95, 99,104, 97,105,110,108,101,110,
-  0,105,109, 97,112, 97,105,110,116,  0,112, 97,114,116,105, 99,108,101,  0,112,114,111,112,111,114,116,105,111,110, 97,108, 95,
-115,105,122,101,  0,115,101,108,101, 99,116, 95,116,104,114,101,115,104,  0, 99,108,101, 97,110, 95,116,104,114,101,115,104,  0,
- 97,117,116,111,107,101,121, 95,109,111,100,101,  0, 97,117,116,111,107,101,121, 95,102,108, 97,103,  0,114,101,116,111,112,111,
- 95,109,111,100,101,  0,114,101,116,111,112,111, 95,112, 97,105,110,116, 95,116,111,111,108,  0,108,105,110,101, 95,100,105,118,
-  0,101,108,108,105,112,115,101, 95,100,105,118,  0,114,101,116,111,112,111, 95,104,111,116,115,112,111,116,  0,109,117,108,116,
-105,114,101,115, 95,115,117, 98,100,105,118, 95,116,121,112,101,  0,115,107,103,101,110, 95,114,101,115,111,108,117,116,105,111,
-110,  0,115,107,103,101,110, 95,116,104,114,101,115,104,111,108,100, 95,105,110,116,101,114,110, 97,108,  0,115,107,103,101,110,
- 95,116,104,114,101,115,104,111,108,100, 95,101,120,116,101,114,110, 97,108,  0,115,107,103,101,110, 95,108,101,110,103,116,104,
- 95,114, 97,116,105,111,  0,115,107,103,101,110, 95,108,101,110,103,116,104, 95,108,105,109,105,116,  0,115,107,103,101,110, 95,
- 97,110,103,108,101, 95,108,105,109,105,116,  0,115,107,103,101,110, 95, 99,111,114,114,101,108, 97,116,105,111,110, 95,108,105,
-109,105,116,  0,115,107,103,101,110, 95,115,121,109,109,101,116,114,121, 95,108,105,109,105,116,  0,115,107,103,101,110, 95,114,
-101,116, 97,114,103,101,116, 95, 97,110,103,108,101, 95,119,101,105,103,104,116,  0,115,107,103,101,110, 95,114,101,116, 97,114,
-103,101,116, 95,108,101,110,103,116,104, 95,119,101,105,103,104,116,  0,115,107,103,101,110, 95,114,101,116, 97,114,103,101,116,
- 95,100,105,115,116, 97,110, 99,101, 95,119,101,105,103,104,116,  0,115,107,103,101,110, 95,111,112,116,105,111,110,115,  0,115,
-107,103,101,110, 95,112,111,115,116,112,114,111,  0,115,107,103,101,110, 95,112,111,115,116,112,114,111, 95,112, 97,115,115,101,
-115,  0,115,107,103,101,110, 95,115,117, 98,100,105,118,105,115,105,111,110,115, 91, 51, 93,  0,115,107,103,101,110, 95,109,117,
-108,116,105, 95,108,101,118,101,108,  0, 42,115,107,103,101,110, 95,116,101,109,112,108, 97,116,101,  0, 98,111,110,101, 95,115,
-107,101,116, 99,104,105,110,103,  0, 98,111,110,101, 95,115,107,101,116, 99,104,105,110,103, 95, 99,111,110,118,101,114,116,  0,
-115,107,103,101,110, 95,115,117, 98,100,105,118,105,115,105,111,110, 95,110,117,109, 98,101,114,  0,115,107,103,101,110, 95,114,
-101,116, 97,114,103,101,116, 95,111,112,116,105,111,110,115,  0,115,107,103,101,110, 95,114,101,116, 97,114,103,101,116, 95,114,
-111,108,108,  0,115,107,103,101,110, 95,115,105,100,101, 95,115,116,114,105,110,103, 91, 56, 93,  0,115,107,103,101,110, 95,110,
-117,109, 95,115,116,114,105,110,103, 91, 56, 93,  0,101,100,103,101, 95,109,111,100,101,  0,101,100,103,101, 95,109,111,100,101,
- 95,108,105,118,101, 95,117,110,119,114, 97,112,  0,115,110, 97,112, 95,109,111,100,101,  0,115,110, 97,112, 95,102,108, 97,103,
-  0,115,110, 97,112, 95,116, 97,114,103,101,116,  0,112,114,111,112,111,114,116,105,111,110, 97,108,  0,112,114,111,112, 95,109,
-111,100,101,  0,112,114,111,112,111,114,116,105,111,110, 97,108, 95,111, 98,106,101, 99,116,115,  0, 97,117,116,111, 95,110,111,
-114,109, 97,108,105,122,101,  0,115, 99,117,108,112,116, 95,112, 97,105,110,116, 95,115,101,116,116,105,110,103,115,  0,115, 99,
-117,108,112,116, 95,112, 97,105,110,116, 95,117,110,105,102,105,101,100, 95,115,105,122,101,  0,115, 99,117,108,112,116, 95,112,
- 97,105,110,116, 95,117,110,105,102,105,101,100, 95,117,110,112,114,111,106,101, 99,116,101,100, 95,114, 97,100,105,117,115,  0,
-115, 99,117,108,112,116, 95,112, 97,105,110,116, 95,117,110,105,102,105,101,100, 95, 97,108,112,104, 97,  0,116,111,116,111, 98,
-106,  0,116,111,116,108, 97,109,112,  0,116,111,116,111, 98,106,115,101,108,  0,116,111,116, 99,117,114,118,101,  0,116,111,116,
-109,101,115,104,  0,116,111,116, 97,114,109, 97,116,117,114,101,  0,115, 99, 97,108,101, 95,108,101,110,103,116,104,  0,115,121,
-115,116,101,109,  0,115,121,115,116,101,109, 95,114,111,116, 97,116,105,111,110,  0,103,114, 97,118,105,116,121, 91, 51, 93,  0,
-113,117,105, 99,107, 95, 99, 97, 99,104,101, 95,115,116,101,112,  0, 42,119,111,114,108,100,  0, 42,115,101,116,  0, 98, 97,115,
-101,  0, 42, 98, 97,115, 97, 99,116,  0, 42,111, 98,101,100,105,116,  0, 99,117,114,115,111,114, 91, 51, 93,  0,116,119, 99,101,
-110,116, 91, 51, 93,  0,116,119,109,105,110, 91, 51, 93,  0,116,119,109, 97,120, 91, 51, 93,  0,108, 97,121, 97, 99,116,  0,108,
- 97,121, 95,117,112,100, 97,116,101,100,  0, 99,117,115,116,111,109,100, 97,116, 97, 95,109, 97,115,107, 95,109,111,100, 97,108,
-  0, 42,101,100,  0, 42,116,111,111,108,115,101,116,116,105,110,103,115,  0, 42,115,116, 97,116,115,  0, 97,117,100,105,111,  0,
-116,114, 97,110,115,102,111,114,109, 95,115,112, 97, 99,101,115,  0, 42,115,111,117,110,100, 95,115, 99,101,110,101,  0, 42,115,
-111,117,110,100, 95,115, 99,101,110,101, 95,104, 97,110,100,108,101,  0, 42,115,111,117,110,100, 95,115, 99,114,117, 98, 95,104,
- 97,110,100,108,101,  0, 42,102,112,115, 95,105,110,102,111,  0, 42,116,104,101, 68, 97,103,  0,100, 97,103,105,115,118, 97,108,
-105,100,  0,100, 97,103,102,108, 97,103,115,  0,112, 97,100, 54,  0,112, 97,100, 53,  0, 97, 99,116,105,118,101, 95,107,101,121,
-105,110,103,115,101,116,  0,107,101,121,105,110,103,115,101,116,115,  0,103,109,  0,117,110,105,116,  0,112,104,121,115,105, 99,
-115, 95,115,101,116,116,105,110,103,115,  0, 98,108,101,110,100,  0,118,105,101,119,  0,119,105,110,109, 97,116, 91, 52, 93, 91,
- 52, 93,  0,118,105,101,119,109, 97,116, 91, 52, 93, 91, 52, 93,  0,118,105,101,119,105,110,118, 91, 52, 93, 91, 52, 93,  0,112,
-101,114,115,109, 97,116, 91, 52, 93, 91, 52, 93,  0,112,101,114,115,105,110,118, 91, 52, 93, 91, 52, 93,  0,118,105,101,119,109,
- 97,116,111, 98, 91, 52, 93, 91, 52, 93,  0,112,101,114,115,109, 97,116,111, 98, 91, 52, 93, 91, 52, 93,  0,116,119,109, 97,116,
- 91, 52, 93, 91, 52, 93,  0,118,105,101,119,113,117, 97,116, 91, 52, 93,  0,122,102, 97, 99,  0, 99, 97,109,100,120,  0, 99, 97,
-109,100,121,  0,112,105,120,115,105,122,101,  0, 99, 97,109,122,111,111,109,  0,116,119,100,114, 97,119,102,108, 97,103,  0,105,
-115, 95,112,101,114,115,112,  0,114,102,108, 97,103,  0,118,105,101,119,108,111, 99,107,  0,112,101,114,115,112,  0, 99,108,105,
-112, 91, 54, 93, 91, 52, 93,  0, 99,108,105,112, 95,108,111, 99, 97,108, 91, 54, 93, 91, 52, 93,  0, 42, 99,108,105,112, 98, 98,
-  0, 42,108,111, 99, 97,108,118,100,  0, 42,114,105,  0, 42,100,101,112,116,104,115,  0, 42,115,109,115,  0, 42,115,109,111,111,
-116,104, 95,116,105,109,101,114,  0,108,118,105,101,119,113,117, 97,116, 91, 52, 93,  0,108,112,101,114,115,112,  0,108,118,105,
-101,119,  0,103,114,105,100,118,105,101,119,  0,116,119, 97,110,103,108,101, 91, 51, 93,  0,112, 97,100,102,  0,114,101,103,105,
-111,110, 98, 97,115,101,  0,115,112, 97, 99,101,116,121,112,101,  0, 98,108,111, 99,107,115, 99, 97,108,101,  0, 98,108,111, 99,
-107,104, 97,110,100,108,101,114, 91, 56, 93,  0,108, 97,121, 95,117,115,101,100,  0, 42,111, 98, 95, 99,101,110,116,114,101,  0,
- 98,103,112,105, 99, 98, 97,115,101,  0, 42, 98,103,112,105, 99,  0,111, 98, 95, 99,101,110,116,114,101, 95, 98,111,110,101, 91,
- 51, 50, 93,  0,100,114, 97,119,116,121,112,101,  0,111, 98, 95, 99,101,110,116,114,101, 95, 99,117,114,115,111,114,  0,115, 99,
-101,110,101,108,111, 99,107,  0, 97,114,111,117,110,100,  0,103,114,105,100,  0,110,101, 97,114,  0,102, 97,114,  0,109,111,100,
-101,115,101,108,101, 99,116,  0,103,114,105,100,108,105,110,101,115,  0,103,114,105,100,115,117, 98,100,105,118,  0,103,114,105,
-100,102,108, 97,103,  0,116,119,116,121,112,101,  0,116,119,109,111,100,101,  0,116,119,102,108, 97,103,  0,112, 97,100, 50, 91,
- 50, 93,  0, 97,102,116,101,114,100,114, 97,119, 95,116,114, 97,110,115,112,  0, 97,102,116,101,114,100,114, 97,119, 95,120,114,
- 97,121,  0, 97,102,116,101,114,100,114, 97,119, 95,120,114, 97,121,116,114, 97,110,115,112,  0,122, 98,117,102,  0,120,114, 97,
-121,  0,110,100,111,102,109,111,100,101,  0,110,100,111,102,102,105,108,116,101,114,  0, 42,112,114,111,112,101,114,116,105,101,
-115, 95,115,116,111,114, 97,103,101,  0,118,101,114,116,  0,104,111,114,  0,109, 97,115,107,  0,109,105,110, 91, 50, 93,  0,109,
- 97,120, 91, 50, 93,  0,109,105,110,122,111,111,109,  0,109, 97,120,122,111,111,109,  0,115, 99,114,111,108,108,  0,115, 99,114,
-111,108,108, 95,117,105,  0,107,101,101,112,116,111,116,  0,107,101,101,112,122,111,111,109,  0,107,101,101,112,111,102,115,  0,
- 97,108,105,103,110,  0,119,105,110,120,  0,119,105,110,121,  0,111,108,100,119,105,110,120,  0,111,108,100,119,105,110,121,  0,
- 42,116, 97, 98, 95,111,102,102,115,101,116,  0,116, 97, 98, 95,110,117,109,  0,116, 97, 98, 95, 99,117,114,  0,114,112,116, 95,
-109, 97,115,107,  0,118, 50,100,  0, 42, 97,100,115,  0,103,104,111,115,116, 67,117,114,118,101,115,  0, 97,117,116,111,115,110,
- 97,112,  0, 99,117,114,115,111,114, 86, 97,108,  0,109, 97,105,110, 98,  0,109, 97,105,110, 98,111,  0,109, 97,105,110, 98,117,
-115,101,114,  0,114,101, 95, 97,108,105,103,110,  0,112,114,101,118,105,101,119,  0,116,101,120,116,117,114,101, 95, 99,111,110,
-116,101,120,116,  0,112, 97,116,104,102,108, 97,103,  0,100, 97,116, 97,105, 99,111,110,  0, 42,112,105,110,105,100,  0,114,101,
-110,100,101,114, 95,115,105,122,101,  0, 99,104, 97,110,115,104,111,119,110,  0,122,101, 98,114, 97,  0,122,111,111,109,  0,116,
-105,116,108,101, 91, 51, 50, 93,  0,100,105,114, 91, 50, 52, 48, 93,  0,102,105,108,101, 91, 56, 48, 93,  0,114,101,110, 97,109,
-101,102,105,108,101, 91, 56, 48, 93,  0,114,101,110, 97,109,101,101,100,105,116, 91, 56, 48, 93,  0,102,105,108,116,101,114, 95,
-103,108,111, 98, 91, 54, 52, 93,  0, 97, 99,116,105,118,101, 95,102,105,108,101,  0,115,101,108, 95,102,105,114,115,116,  0,115,
-101,108, 95,108, 97,115,116,  0,115,111,114,116,  0,100,105,115,112,108, 97,121,  0,102, 95,102,112,  0,102,112, 95,115,116,114,
- 91, 56, 93,  0,115, 99,114,111,108,108, 95,111,102,102,115,101,116,  0, 42,112, 97,114, 97,109,115,  0, 42,102,105,108,101,115,
-  0, 42,102,111,108,100,101,114,115, 95,112,114,101,118,  0, 42,102,111,108,100,101,114,115, 95,110,101,120,116,  0, 42,111,112,
-  0, 42,115,109,111,111,116,104,115, 99,114,111,108,108, 95,116,105,109,101,114,  0, 42,108, 97,121,111,117,116,  0,114,101, 99,
-101,110,116,110,114,  0, 98,111,111,107,109, 97,114,107,110,114,  0,115,121,115,116,101,109,110,114,  0,116,114,101,101,  0, 42,
-116,114,101,101,115,116,111,114,101,  0,115,101, 97,114, 99,104, 95,115,116,114,105,110,103, 91, 51, 50, 93,  0,115,101, 97,114,
- 99,104, 95,116,115,101,  0,111,117,116,108,105,110,101,118,105,115,  0,115,116,111,114,101,102,108, 97,103,  0,115,101, 97,114,
- 99,104, 95,102,108, 97,103,115,  0, 42, 99,117,109, 97,112,  0,115, 99,111,112,101,115,  0,115, 97,109,112,108,101, 95,108,105,
-110,101, 95,104,105,115,116,  0, 99,117,114,115,111,114, 91, 50, 93,  0, 99,101,110,116,120,  0, 99,101,110,116,121,  0, 99,117,
-114,116,105,108,101,  0,105,109,116,121,112,101,110,114,  0,108,111, 99,107,  0,112,105,110,  0,100,116, 95,117,118,  0,115,116,
-105, 99,107,121,  0,100,116, 95,117,118,115,116,114,101,116, 99,104,  0, 42,116,101,120,116,  0,116,111,112,  0,118,105,101,119,
-108,105,110,101,115,  0,109,101,110,117,110,114,  0,108,104,101,105,103,104,116,  0, 99,119,105,100,116,104,  0,108,105,110,101,
-110,114,115, 95,116,111,116,  0,108,101,102,116,  0,115,104,111,119,108,105,110,101,110,114,115,  0,116, 97, 98,110,117,109, 98,
-101,114,  0,115,104,111,119,115,121,110,116, 97,120,  0,108,105,110,101, 95,104,108,105,103,104,116,  0,111,118,101,114,119,114,
-105,116,101,  0,108,105,118,101, 95,101,100,105,116,  0,112,105,120, 95,112,101,114, 95,108,105,110,101,  0,116,120,116,115, 99,
-114,111,108,108,  0,116,120,116, 98, 97,114,  0,119,111,114,100,119,114, 97,112,  0,100,111,112,108,117,103,105,110,115,  0,102,
-105,110,100,115,116,114, 91, 50, 53, 54, 93,  0,114,101,112,108, 97, 99,101,115,116,114, 91, 50, 53, 54, 93,  0,109, 97,114,103,
-105,110, 95, 99,111,108,117,109,110,  0, 42,100,114, 97,119, 99, 97, 99,104,101,  0, 42,112,121, 95,100,114, 97,119,  0, 42,112,
-121, 95,101,118,101,110,116,  0, 42,112,121, 95, 98,117,116,116,111,110,  0, 42,112,121, 95, 98,114,111,119,115,101,114, 99, 97,
-108,108, 98, 97, 99,107,  0, 42,112,121, 95,103,108,111, 98, 97,108,100,105, 99,116,  0,108, 97,115,116,115,112, 97, 99,101,  0,
-115, 99,114,105,112,116,110, 97,109,101, 91, 50, 53, 54, 93,  0,115, 99,114,105,112,116, 97,114,103, 91, 50, 53, 54, 93,  0, 42,
-115, 99,114,105,112,116,  0, 42, 98,117,116, 95,114,101,102,115,  0, 42, 97,114,114, 97,121,  0, 99, 97, 99,104,101,115,  0, 99,
- 97, 99,104,101, 95,100,105,115,112,108, 97,121,  0,114,101,100,114, 97,119,115,  0, 42,105,100,  0, 97,115,112,101, 99,116,  0,
- 42, 99,117,114,102,111,110,116,  0,109,120,  0,109,121,  0, 42,101,100,105,116,116,114,101,101,  0,116,114,101,101,116,121,112,
-101,  0,116,101,120,102,114,111,109,  0,108,105,110,107,100,114, 97,103,  0,116,105,116,108,101, 91, 50, 52, 93,  0,109,101,110,
-117,  0,110,117,109,116,105,108,101,115,120,  0,110,117,109,116,105,108,101,115,121,  0,115,101,108,115,116, 97,116,101,  0,118,
-105,101,119,114,101, 99,116,  0, 98,111,111,107,109, 97,114,107,114,101, 99,116,  0,115, 99,114,111,108,108,112,111,115,  0,115,
- 99,114,111,108,108,104,101,105,103,104,116,  0,115, 99,114,111,108,108, 97,114,101, 97,  0,114,101,116,118, 97,108,  0, 97, 99,
-116,105,118,101, 95, 98,111,111,107,109, 97,114,107,  0,112,114,118, 95,119,  0,112,114,118, 95,104,  0, 40, 42,114,101,116,117,
-114,110,102,117,110, 99, 41, 40, 41,  0, 40, 42,114,101,116,117,114,110,102,117,110, 99, 95,101,118,101,110,116, 41, 40, 41,  0,
- 40, 42,114,101,116,117,114,110,102,117,110, 99, 95, 97,114,103,115, 41, 40, 41,  0, 42, 97,114,103, 49,  0, 42, 97,114,103, 50,
-  0, 42,109,101,110,117,112,  0, 42,112,117,112,109,101,110,117,  0, 42,105,109,103,  0,108,101,110, 95, 97,108,108,111, 99,  0,
+  0,121,  0,122,  0,120,109,105,110,  0,120,109, 97,120,  0,121,109,105,110,  0,121,109, 97,120,  0, 42,112,111,105,110,116,101,
+114,  0,103,114,111,117,112,  0,118, 97,108,  0,118, 97,108, 50,  0,116,121,112,101,  0,115,117, 98,116,121,112,101,  0,102,108,
+ 97,103,  0,110, 97,109,101, 91, 54, 52, 93,  0,115, 97,118,101,100,  0,100, 97,116, 97,  0,108,101,110,  0,116,111,116, 97,108,
+108,101,110,  0, 42,110,101,119,105,100,  0, 42,108,105, 98,  0,110, 97,109,101, 91, 54, 54, 93,  0,112, 97,100,  0,117,115,  0,
+105, 99,111,110, 95,105,100,  0,112, 97,100, 50,  0, 42,112,114,111,112,101,114,116,105,101,115,  0,105,100,  0, 42,105,100, 98,
+108,111, 99,107,  0, 42,102,105,108,101,100, 97,116, 97,  0,110, 97,109,101, 91, 49, 48, 50, 52, 93,  0,102,105,108,101,112, 97,
+116,104, 91, 49, 48, 50, 52, 93,  0,116,111,116,  0, 42,112, 97,114,101,110,116,  0,119, 91, 50, 93,  0,104, 91, 50, 93,  0, 99,
+104, 97,110,103,101,100, 91, 50, 93,  0, 99,104, 97,110,103,101,100, 95,116,105,109,101,115,116, 97,109,112, 91, 50, 93,  0, 42,
+114,101, 99,116, 91, 50, 93,  0, 42,111, 98,  0, 98,108,111, 99,107,116,121,112,101,  0, 97,100,114, 99,111,100,101,  0,110, 97,
+109,101, 91, 49, 50, 56, 93,  0, 42, 98,112,  0, 42, 98,101,122,116,  0,109, 97,120,114, 99,116,  0,116,111,116,114, 99,116,  0,
+118, 97,114,116,121,112,101,  0,116,111,116,118,101,114,116,  0,105,112,111,  0,101,120,116,114, 97,112,  0,114,116,  0, 98,105,
+116,109, 97,115,107,  0,115,108,105,100,101, 95,109,105,110,  0,115,108,105,100,101, 95,109, 97,120,  0, 99,117,114,118, 97,108,
+  0, 42,100,114,105,118,101,114,  0, 99,117,114,118,101,  0, 99,117,114,  0,115,104,111,119,107,101,121,  0,109,117,116,101,105,
+112,111,  0,112,111,115,  0,112, 97,100, 49,  0,114,101,108, 97,116,105,118,101,  0,116,111,116,101,108,101,109,  0,117,105,100,
+  0, 42,119,101,105,103,104,116,115,  0,118,103,114,111,117,112, 91, 54, 52, 93,  0,115,108,105,100,101,114,109,105,110,  0,115,
+108,105,100,101,114,109, 97,120,  0, 42, 97,100,116,  0, 42,114,101,102,107,101,121,  0,101,108,101,109,115,116,114, 91, 51, 50,
+ 93,  0,101,108,101,109,115,105,122,101,  0, 98,108,111, 99,107,  0, 42,105,112,111,  0, 42,102,114,111,109,  0,116,111,116,107,
+101,121,  0,115,108,117,114,112,104,  0, 99,116,105,109,101,  0,117,105,100,103,101,110,  0, 42,108,105,110,101,  0, 42,102,111,
+114,109, 97,116,  0, 98,108,101,110,  0,108,105,110,101,110,111,  0,115,116, 97,114,116,  0,101,110,100,  0,102,108, 97,103,115,
+  0, 99,111,108,111,114, 91, 52, 93,  0,112, 97,100, 91, 52, 93,  0, 42,110, 97,109,101,  0,110,108,105,110,101,115,  0,108,105,
+110,101,115,  0, 42, 99,117,114,108,  0, 42,115,101,108,108,  0, 99,117,114, 99,  0,115,101,108, 99,  0,109, 97,114,107,101,114,
+115,  0, 42,117,110,100,111, 95, 98,117,102,  0,117,110,100,111, 95,112,111,115,  0,117,110,100,111, 95,108,101,110,  0, 42, 99,
+111,109,112,105,108,101,100,  0,109,116,105,109,101,  0,115,105,122,101,  0,115,101,101,107,  0,100,116,120,  0,112, 97,115,115,
+101,112, 97,114,116, 97,108,112,104, 97,  0, 99,108,105,112,115,116, 97,  0, 99,108,105,112,101,110,100,  0,108,101,110,115,  0,
+111,114,116,104,111, 95,115, 99, 97,108,101,  0,100,114, 97,119,115,105,122,101,  0,115,101,110,115,111,114, 95,120,  0,115,101,
+110,115,111,114, 95,121,  0,115,104,105,102,116,120,  0,115,104,105,102,116,121,  0, 89, 70, 95,100,111,102,100,105,115,116,  0,
+ 42,100,111,102, 95,111, 98,  0,115,101,110,115,111,114, 95,102,105,116,  0,112, 97,100, 91, 55, 93,  0, 42,115, 99,101,110,101,
+  0,102,114, 97,109,101,110,114,  0,102,114, 97,109,101,115,  0,111,102,102,115,101,116,  0,115,102,114, 97,  0,102,105,101, 95,
+105,109, 97,  0, 99,121, 99,108,  0,111,107,  0,109,117,108,116,105, 95,105,110,100,101,120,  0,108, 97,121,101,114,  0,112, 97,
+115,115,  0,105, 98,117,102,115,  0, 42,103,112,117,116,101,120,116,117,114,101,  0, 42, 97,110,105,109,  0, 42,114,114,  0, 42,
+114,101,110,100,101,114,115, 91, 56, 93,  0,114,101,110,100,101,114, 95,115,108,111,116,  0,108, 97,115,116, 95,114,101,110,100,
+101,114, 95,115,108,111,116,  0,115,111,117,114, 99,101,  0,108, 97,115,116,102,114, 97,109,101,  0,116,112, 97,103,101,102,108,
+ 97,103,  0,116,111,116, 98,105,110,100,  0,120,114,101,112,  0,121,114,101,112,  0,116,119,115,116, 97,  0,116,119,101,110,100,
+  0, 98,105,110,100, 99,111,100,101,  0, 42,114,101,112, 98,105,110,100,  0, 42,112, 97, 99,107,101,100,102,105,108,101,  0, 42,
+112,114,101,118,105,101,119,  0,108, 97,115,116,117,112,100, 97,116,101,  0,108, 97,115,116,117,115,101,100,  0, 97,110,105,109,
+115,112,101,101,100,  0,103,101,110, 95,120,  0,103,101,110, 95,121,  0,103,101,110, 95,116,121,112,101,  0,103,101,110, 95,102,
+108, 97,103,  0, 97,115,112,120,  0, 97,115,112,121,  0,116,101,120, 99,111,  0,109, 97,112,116,111,  0,109, 97,112,116,111,110,
+101,103,  0, 98,108,101,110,100,116,121,112,101,  0, 42,111, 98,106,101, 99,116,  0, 42,116,101,120,  0,117,118,110, 97,109,101,
+ 91, 54, 52, 93,  0,112,114,111,106,120,  0,112,114,111,106,121,  0,112,114,111,106,122,  0,109, 97,112,112,105,110,103,  0,111,
+102,115, 91, 51, 93,  0,115,105,122,101, 91, 51, 93,  0,114,111,116,  0,116,101,120,102,108, 97,103,  0, 99,111,108,111,114,109,
+111,100,101,108,  0,112,109, 97,112,116,111,  0,112,109, 97,112,116,111,110,101,103,  0,110,111,114,109, 97,112,115,112, 97, 99,
+101,  0,119,104,105, 99,104, 95,111,117,116,112,117,116,  0, 98,114,117,115,104, 95,109, 97,112, 95,109,111,100,101,  0,114,  0,
+103,  0, 98,  0,107,  0,100,101,102, 95,118, 97,114,  0, 99,111,108,102, 97, 99,  0,118, 97,114,102, 97, 99,  0,110,111,114,102,
+ 97, 99,  0,100,105,115,112,102, 97, 99,  0,119, 97,114,112,102, 97, 99,  0, 99,111,108,115,112,101, 99,102, 97, 99,  0,109,105,
+114,114,102, 97, 99,  0, 97,108,112,104, 97,102, 97, 99,  0,100,105,102,102,102, 97, 99,  0,115,112,101, 99,102, 97, 99,  0,101,
+109,105,116,102, 97, 99,  0,104, 97,114,100,102, 97, 99,  0,114, 97,121,109,105,114,114,102, 97, 99,  0,116,114, 97,110,115,108,
+102, 97, 99,  0, 97,109, 98,102, 97, 99,  0, 99,111,108,101,109,105,116,102, 97, 99,  0, 99,111,108,114,101,102,108,102, 97, 99,
+  0, 99,111,108,116,114, 97,110,115,102, 97, 99,  0,100,101,110,115,102, 97, 99,  0,115, 99, 97,116,116,101,114,102, 97, 99,  0,
+114,101,102,108,102, 97, 99,  0,116,105,109,101,102, 97, 99,  0,108,101,110,103,116,104,102, 97, 99,  0, 99,108,117,109,112,102,
+ 97, 99,  0,100, 97,109,112,102, 97, 99,  0,107,105,110,107,102, 97, 99,  0,114,111,117,103,104,102, 97, 99,  0,112, 97,100,101,
+110,115,102, 97, 99,  0,103,114, 97,118,105,116,121,102, 97, 99,  0,108,105,102,101,102, 97, 99,  0,115,105,122,101,102, 97, 99,
+  0,105,118,101,108,102, 97, 99,  0,102,105,101,108,100,102, 97, 99,  0,115,104, 97,100,111,119,102, 97, 99,  0,122,101,110,117,
+112,102, 97, 99,  0,122,101,110,100,111,119,110,102, 97, 99,  0, 98,108,101,110,100,102, 97, 99,  0, 42,104, 97,110,100,108,101,
+  0, 42,112,110, 97,109,101,  0, 42,115,116,110, 97,109,101,115,  0,115,116,121,112,101,115,  0,118, 97,114,115,  0, 42,118, 97,
+114,115,116,114,  0, 42,114,101,115,117,108,116,  0, 42, 99,102,114, 97,  0,100, 97,116, 97, 91, 51, 50, 93,  0, 40, 42,100,111,
+105,116, 41, 40, 41,  0, 40, 42,105,110,115,116, 97,110, 99,101, 95,105,110,105,116, 41, 40, 41,  0, 40, 42, 99, 97,108,108, 98,
+ 97, 99,107, 41, 40, 41,  0,118,101,114,115,105,111,110,  0, 97,  0,105,112,111,116,121,112,101,  0, 42,105,109, 97,  0, 42, 99,
+117, 98,101, 91, 54, 93,  0,105,109, 97,116, 91, 52, 93, 91, 52, 93,  0,111, 98,105,109, 97,116, 91, 51, 93, 91, 51, 93,  0,115,
+116,121,112,101,  0,118,105,101,119,115, 99, 97,108,101,  0,110,111,116,108, 97,121,  0, 99,117, 98,101,114,101,115,  0,100,101,
+112,116,104,  0,114,101, 99, 97,108, 99,  0,108, 97,115,116,115,105,122,101,  0,102, 97,108,108,111,102,102, 95,116,121,112,101,
+  0,102, 97,108,108,111,102,102, 95,115,111,102,116,110,101,115,115,  0,114, 97,100,105,117,115,  0, 99,111,108,111,114, 95,115,
+111,117,114, 99,101,  0,116,111,116,112,111,105,110,116,115,  0,112,100,112, 97,100,  0,112,115,121,115,  0,112,115,121,115, 95,
+ 99, 97, 99,104,101, 95,115,112, 97, 99,101,  0,111, 98, 95, 99, 97, 99,104,101, 95,115,112, 97, 99,101,  0, 42,112,111,105,110,
+116, 95,116,114,101,101,  0, 42,112,111,105,110,116, 95,100, 97,116, 97,  0,110,111,105,115,101, 95,115,105,122,101,  0,110,111,
+105,115,101, 95,100,101,112,116,104,  0,110,111,105,115,101, 95,105,110,102,108,117,101,110, 99,101,  0,110,111,105,115,101, 95,
+ 98, 97,115,105,115,  0,112,100,112, 97,100, 51, 91, 51, 93,  0,110,111,105,115,101, 95,102, 97, 99,  0,115,112,101,101,100, 95,
+115, 99, 97,108,101,  0,102, 97,108,108,111,102,102, 95,115,112,101,101,100, 95,115, 99, 97,108,101,  0,112,100,112, 97,100, 50,
+  0, 42, 99,111, 98, 97,  0, 42,102, 97,108,108,111,102,102, 95, 99,117,114,118,101,  0,114,101,115,111,108, 91, 51, 93,  0,105,
+110,116,101,114,112, 95,116,121,112,101,  0,102,105,108,101, 95,102,111,114,109, 97,116,  0,101,120,116,101,110,100,  0,115,109,
+111,107,101,100, 95,116,121,112,101,  0,105,110,116, 95,109,117,108,116,105,112,108,105,101,114,  0,115,116,105,108,108, 95,102,
+114, 97,109,101,  0,115,111,117,114, 99,101, 95,112, 97,116,104, 91, 49, 48, 50, 52, 93,  0, 42,100, 97,116, 97,115,101,116,  0,
+ 99, 97, 99,104,101,100,102,114, 97,109,101,  0,111, 99,101, 97,110,109,111,100, 91, 54, 52, 93,  0,111,117,116,112,117,116,  0,
+110,111,105,115,101,115,105,122,101,  0,116,117,114, 98,117,108,  0, 98,114,105,103,104,116,  0, 99,111,110,116,114, 97,115,116,
+  0,115, 97,116,117,114, 97,116,105,111,110,  0,114,102, 97, 99,  0,103,102, 97, 99,  0, 98,102, 97, 99,  0,102,105,108,116,101,
+114,115,105,122,101,  0,109,103, 95, 72,  0,109,103, 95,108, 97, 99,117,110, 97,114,105,116,121,  0,109,103, 95,111, 99,116, 97,
+118,101,115,  0,109,103, 95,111,102,102,115,101,116,  0,109,103, 95,103, 97,105,110,  0,100,105,115,116, 95, 97,109,111,117,110,
+116,  0,110,115, 95,111,117,116,115, 99, 97,108,101,  0,118,110, 95,119, 49,  0,118,110, 95,119, 50,  0,118,110, 95,119, 51,  0,
+118,110, 95,119, 52,  0,118,110, 95,109,101,120,112,  0,118,110, 95,100,105,115,116,109,  0,118,110, 95, 99,111,108,116,121,112,
+101,  0,110,111,105,115,101,100,101,112,116,104,  0,110,111,105,115,101,116,121,112,101,  0,110,111,105,115,101, 98, 97,115,105,
+115,  0,110,111,105,115,101, 98, 97,115,105,115, 50,  0,105,109, 97,102,108, 97,103,  0, 99,114,111,112,120,109,105,110,  0, 99,
+114,111,112,121,109,105,110,  0, 99,114,111,112,120,109, 97,120,  0, 99,114,111,112,121,109, 97,120,  0,116,101,120,102,105,108,
+116,101,114,  0, 97,102,109, 97,120,  0,120,114,101,112,101, 97,116,  0,121,114,101,112,101, 97,116,  0, 99,104,101, 99,107,101,
+114,100,105,115,116,  0,110, 97, 98,108, 97,  0,105,117,115,101,114,  0, 42,110,111,100,101,116,114,101,101,  0, 42,112,108,117,
+103,105,110,  0, 42,101,110,118,  0, 42,112,100,  0, 42,118,100,  0, 42,111,116,  0,117,115,101, 95,110,111,100,101,115,  0,108,
+111, 99, 91, 51, 93,  0,114,111,116, 91, 51, 93,  0,109, 97,116, 91, 52, 93, 91, 52, 93,  0,109,105,110, 91, 51, 93,  0,109, 97,
+120, 91, 51, 93,  0, 99,111, 98, 97,  0, 98,108,101,110,100, 95, 99,111,108,111,114, 91, 51, 93,  0, 98,108,101,110,100, 95,102,
+ 97, 99,116,111,114,  0, 98,108,101,110,100, 95,116,121,112,101,  0,112, 97,100, 91, 51, 93,  0,109,111,100,101,  0,116,111,116,
+101,120,  0,115,104,100,119,114,  0,115,104,100,119,103,  0,115,104,100,119, 98,  0,115,104,100,119,112, 97,100,  0,101,110,101,
+114,103,121,  0,100,105,115,116,  0,115,112,111,116,115,105,122,101,  0,115,112,111,116, 98,108,101,110,100,  0,104, 97,105,110,
+116,  0, 97,116,116, 49,  0, 97,116,116, 50,  0, 42, 99,117,114,102, 97,108,108,111,102,102,  0,115,104, 97,100,115,112,111,116,
+115,105,122,101,  0, 98,105, 97,115,  0,115,111,102,116,  0, 99,111,109,112,114,101,115,115,116,104,114,101,115,104,  0,112, 97,
+100, 53, 91, 51, 93,  0, 98,117,102,115,105,122,101,  0,115, 97,109,112,  0, 98,117,102,102,101,114,115,  0,102,105,108,116,101,
+114,116,121,112,101,  0, 98,117,102,102,108, 97,103,  0, 98,117,102,116,121,112,101,  0,114, 97,121, 95,115, 97,109,112,  0,114,
+ 97,121, 95,115, 97,109,112,121,  0,114, 97,121, 95,115, 97,109,112,122,  0,114, 97,121, 95,115, 97,109,112, 95,116,121,112,101,
+  0, 97,114,101, 97, 95,115,104, 97,112,101,  0, 97,114,101, 97, 95,115,105,122,101,  0, 97,114,101, 97, 95,115,105,122,101,121,
+  0, 97,114,101, 97, 95,115,105,122,101,122,  0, 97,100, 97,112,116, 95,116,104,114,101,115,104,  0,114, 97,121, 95,115, 97,109,
+112, 95,109,101,116,104,111,100,  0,116,101,120, 97, 99,116,  0,115,104, 97,100,104, 97,108,111,115,116,101,112,  0,115,117,110,
+ 95,101,102,102,101, 99,116, 95,116,121,112,101,  0,115,107,121, 98,108,101,110,100,116,121,112,101,  0,104,111,114,105,122,111,
+110, 95, 98,114,105,103,104,116,110,101,115,115,  0,115,112,114,101, 97,100,  0,115,117,110, 95, 98,114,105,103,104,116,110,101,
+115,115,  0,115,117,110, 95,115,105,122,101,  0, 98, 97, 99,107,115, 99, 97,116,116,101,114,101,100, 95,108,105,103,104,116,  0,
+115,117,110, 95,105,110,116,101,110,115,105,116,121,  0, 97,116,109, 95,116,117,114, 98,105,100,105,116,121,  0, 97,116,109, 95,
+105,110,115, 99, 97,116,116,101,114,105,110,103, 95,102, 97, 99,116,111,114,  0, 97,116,109, 95,101,120,116,105,110, 99,116,105,
+111,110, 95,102, 97, 99,116,111,114,  0, 97,116,109, 95,100,105,115,116, 97,110, 99,101, 95,102, 97, 99,116,111,114,  0,115,107,
+121, 98,108,101,110,100,102, 97, 99,  0,115,107,121, 95,101,120,112,111,115,117,114,101,  0,115,107,121, 95, 99,111,108,111,114,
+115,112, 97, 99,101,  0,112, 97,100, 52, 91, 54, 93,  0, 42,109,116,101,120, 91, 49, 56, 93,  0,112,114, 95,116,101,120,116,117,
+114,101,  0,112, 97,100, 54, 91, 52, 93,  0,100,101,110,115,105,116,121,  0,101,109,105,115,115,105,111,110,  0,115, 99, 97,116,
+116,101,114,105,110,103,  0,114,101,102,108,101, 99,116,105,111,110,  0,101,109,105,115,115,105,111,110, 95, 99,111,108, 91, 51,
+ 93,  0,116,114, 97,110,115,109,105,115,115,105,111,110, 95, 99,111,108, 91, 51, 93,  0,114,101,102,108,101, 99,116,105,111,110,
+ 95, 99,111,108, 91, 51, 93,  0,100,101,110,115,105,116,121, 95,115, 99, 97,108,101,  0,100,101,112,116,104, 95, 99,117,116,111,
+102,102,  0, 97,115,121,109,109,101,116,114,121,  0,115,116,101,112,115,105,122,101, 95,116,121,112,101,  0,115,104, 97,100,101,
+102,108, 97,103,  0,115,104, 97,100,101, 95,116,121,112,101,  0,112,114,101, 99, 97, 99,104,101, 95,114,101,115,111,108,117,116,
+105,111,110,  0,115,116,101,112,115,105,122,101,  0,109,115, 95,100,105,102,102,  0,109,115, 95,105,110,116,101,110,115,105,116,
+121,  0,109,115, 95,115,112,114,101, 97,100,  0, 97,108,112,104, 97, 95, 98,108,101,110,100,  0,102, 97, 99,101, 95,111,114,105,
+101,110,116, 97,116,105,111,110,  0,109, 97,116,101,114,105, 97,108, 95,116,121,112,101,  0,115,112,101, 99,114,  0,115,112,101,
+ 99,103,  0,115,112,101, 99, 98,  0,109,105,114,114,  0,109,105,114,103,  0,109,105,114, 98,  0, 97,109, 98,114,  0, 97,109, 98,
+ 98,  0, 97,109, 98,103,  0, 97,109, 98,  0,101,109,105,116,  0, 97,110,103,  0,115,112,101, 99,116,114, 97,  0,114, 97,121, 95,
+109,105,114,114,111,114,  0, 97,108,112,104, 97,  0,114,101,102,  0,115,112,101, 99,  0,122,111,102,102,115,  0, 97,100,100,  0,
+116,114, 97,110,115,108,117, 99,101,110, 99,121,  0,118,111,108,  0,103, 97,109,101,  0,102,114,101,115,110,101,108, 95,109,105,
+114,  0,102,114,101,115,110,101,108, 95,109,105,114, 95,105,  0,102,114,101,115,110,101,108, 95,116,114, 97,  0,102,114,101,115,
+110,101,108, 95,116,114, 97, 95,105,  0,102,105,108,116,101,114,  0,116,120, 95,108,105,109,105,116,  0,116,120, 95,102, 97,108,
+108,111,102,102,  0,114, 97,121, 95,100,101,112,116,104,  0,114, 97,121, 95,100,101,112,116,104, 95,116,114, 97,  0,104, 97,114,
+  0,115,101,101,100, 49,  0,115,101,101,100, 50,  0,103,108,111,115,115, 95,109,105,114,  0,103,108,111,115,115, 95,116,114, 97,
+  0,115, 97,109,112, 95,103,108,111,115,115, 95,109,105,114,  0,115, 97,109,112, 95,103,108,111,115,115, 95,116,114, 97,  0, 97,
+100, 97,112,116, 95,116,104,114,101,115,104, 95,109,105,114,  0, 97,100, 97,112,116, 95,116,104,114,101,115,104, 95,116,114, 97,
+  0, 97,110,105,115,111, 95,103,108,111,115,115, 95,109,105,114,  0,100,105,115,116, 95,109,105,114,  0,102, 97,100,101,116,111,
+ 95,109,105,114,  0,115,104, 97,100,101, 95,102,108, 97,103,  0,109,111,100,101, 95,108,  0,102,108, 97,114,101, 99,  0,115,116,
+ 97,114, 99,  0,108,105,110,101, 99,  0,114,105,110,103, 99,  0,104, 97,115,105,122,101,  0,102,108, 97,114,101,115,105,122,101,
+  0,115,117, 98,115,105,122,101,  0,102,108, 97,114,101, 98,111,111,115,116,  0,115,116,114, 97,110,100, 95,115,116, 97,  0,115,
+116,114, 97,110,100, 95,101,110,100,  0,115,116,114, 97,110,100, 95,101, 97,115,101,  0,115,116,114, 97,110,100, 95,115,117,114,
+102,110,111,114,  0,115,116,114, 97,110,100, 95,109,105,110,  0,115,116,114, 97,110,100, 95,119,105,100,116,104,102, 97,100,101,
+  0,115,116,114, 97,110,100, 95,117,118,110, 97,109,101, 91, 54, 52, 93,  0,115, 98,105, 97,115,  0,108, 98,105, 97,115,  0,115,
+104, 97,100, 95, 97,108,112,104, 97,  0,115,101,112,116,101,120,  0,114,103, 98,115,101,108,  0,112,114, 95,116,121,112,101,  0,
+112,114, 95, 98, 97, 99,107,  0,112,114, 95,108, 97,109,112,  0,109,108, 95,102,108, 97,103,  0,100,105,102,102, 95,115,104, 97,
+100,101,114,  0,115,112,101, 99, 95,115,104, 97,100,101,114,  0,114,111,117,103,104,110,101,115,115,  0,114,101,102,114, 97, 99,
+  0,112, 97,114, 97,109, 91, 52, 93,  0,114,109,115,  0,100, 97,114,107,110,101,115,115,  0, 42,114, 97,109,112, 95, 99,111,108,
+  0, 42,114, 97,109,112, 95,115,112,101, 99,  0,114, 97,109,112,105,110, 95, 99,111,108,  0,114, 97,109,112,105,110, 95,115,112,
+101, 99,  0,114, 97,109,112, 98,108,101,110,100, 95, 99,111,108,  0,114, 97,109,112, 98,108,101,110,100, 95,115,112,101, 99,  0,
+114, 97,109,112, 95,115,104,111,119,  0,112, 97,100, 51,  0,114, 97,109,112,102, 97, 99, 95, 99,111,108,  0,114, 97,109,112,102,
+ 97, 99, 95,115,112,101, 99,  0, 42,103,114,111,117,112,  0,102,114,105, 99,116,105,111,110,  0,102,104,  0,114,101,102,108,101,
+ 99,116,  0,102,104,100,105,115,116,  0,120,121,102,114,105, 99,116,  0,100,121,110, 97,109,111,100,101,  0,115,115,115, 95,114,
+ 97,100,105,117,115, 91, 51, 93,  0,115,115,115, 95, 99,111,108, 91, 51, 93,  0,115,115,115, 95,101,114,114,111,114,  0,115,115,
+115, 95,115, 99, 97,108,101,  0,115,115,115, 95,105,111,114,  0,115,115,115, 95, 99,111,108,102, 97, 99,  0,115,115,115, 95,116,
+101,120,102, 97, 99,  0,115,115,115, 95,102,114,111,110,116,  0,115,115,115, 95, 98, 97, 99,107,  0,115,115,115, 95,102,108, 97,
+103,  0,115,115,115, 95,112,114,101,115,101,116,  0,109, 97,112,116,111, 95,116,101,120,116,117,114,101,100,  0,115,104, 97,100,
+111,119,111,110,108,121, 95,102,108, 97,103,  0,105,110,100,101,120,  0,103,112,117,109, 97,116,101,114,105, 97,108,  0, 42, 98,
+ 98,  0,115,101,108, 99,111,108, 49,  0,115,101,108, 99,111,108, 50,  0,113,117, 97,116, 91, 52, 93,  0,101,120,112,120,  0,101,
+120,112,121,  0,101,120,112,122,  0,114, 97,100,  0,114, 97,100, 50,  0,115,  0, 42,109, 97,116,  0, 42,105,109, 97,116,  0,101,
+108,101,109,115,  0,100,105,115,112,  0, 42,101,100,105,116,101,108,101,109,115,  0, 42, 42,109, 97,116,  0,102,108, 97,103, 50,
+  0,116,111,116, 99,111,108,  0,119,105,114,101,115,105,122,101,  0,114,101,110,100,101,114,115,105,122,101,  0,116,104,114,101,
+115,104,  0, 42,108, 97,115,116,101,108,101,109,  0,118,101, 99, 91, 51, 93, 91, 51, 93,  0, 97,108,102, 97,  0,119,101,105,103,
+104,116,  0,104, 49,  0,104, 50,  0,102, 49,  0,102, 50,  0,102, 51,  0,104,105,100,101,  0,118,101, 99, 91, 52, 93,  0,109, 97,
+116, 95,110,114,  0,112,110,116,115,117,  0,112,110,116,115,118,  0,114,101,115,111,108,117,  0,114,101,115,111,108,118,  0,111,
+114,100,101,114,117,  0,111,114,100,101,114,118,  0,102,108, 97,103,117,  0,102,108, 97,103,118,  0, 42,107,110,111,116,115,117,
+  0, 42,107,110,111,116,115,118,  0,116,105,108,116, 95,105,110,116,101,114,112,  0,114, 97,100,105,117,115, 95,105,110,116,101,
+114,112,  0, 99,104, 97,114,105,100,120,  0,107,101,114,110,  0,119,  0,104,  0,110,117,114, 98,115,  0, 42,107,101,121,105,110,
+100,101,120,  0,115,104, 97,112,101,110,114,  0,110,117,114, 98,  0, 42,101,100,105,116,110,117,114, 98,  0, 42, 98,101,118,111,
+ 98,106,  0, 42,116, 97,112,101,114,111, 98,106,  0, 42,116,101,120,116,111,110, 99,117,114,118,101,  0, 42,112, 97,116,104,  0,
+ 42,107,101,121,  0, 98,101,118,  0,100,114, 97,119,102,108, 97,103,  0,116,119,105,115,116, 95,109,111,100,101,  0,116,119,105,
+115,116, 95,115,109,111,111,116,104,  0,115,109, 97,108,108, 99, 97,112,115, 95,115, 99, 97,108,101,  0,112, 97,116,104,108,101,
+110,  0, 98,101,118,114,101,115,111,108,  0,119,105,100,116,104,  0,101,120,116, 49,  0,101,120,116, 50,  0,114,101,115,111,108,
+117, 95,114,101,110,  0,114,101,115,111,108,118, 95,114,101,110,  0, 97, 99,116,110,117,  0, 42,108, 97,115,116,115,101,108,  0,
+115,112, 97, 99,101,109,111,100,101,  0,115,112, 97, 99,105,110,103,  0,108,105,110,101,100,105,115,116,  0,115,104,101, 97,114,
+  0,102,115,105,122,101,  0,119,111,114,100,115,112, 97, 99,101,  0,117,108,112,111,115,  0,117,108,104,101,105,103,104,116,  0,
+120,111,102,  0,121,111,102,  0,108,105,110,101,119,105,100,116,104,  0, 42,115,116,114,  0, 42,115,101,108, 98,111,120,101,115,
+  0, 42,101,100,105,116,102,111,110,116,  0,102, 97,109,105,108,121, 91, 50, 52, 93,  0, 42,118,102,111,110,116,  0, 42,118,102,
+111,110,116, 98,  0, 42,118,102,111,110,116,105,  0, 42,118,102,111,110,116, 98,105,  0,115,101,112, 99,104, 97,114,  0,116,111,
+116, 98,111,120,  0, 97, 99,116, 98,111,120,  0, 42,116, 98,  0,115,101,108,115,116, 97,114,116,  0,115,101,108,101,110,100,  0,
+ 42,115,116,114,105,110,102,111,  0, 99,117,114,105,110,102,111,  0, 42,109,115,101,108,101, 99,116,  0, 42,109,112,111,108,121,
+  0, 42,109,116,112,111,108,121,  0, 42,109,108,111,111,112,  0, 42,109,108,111,111,112,117,118,  0, 42,109,108,111,111,112, 99,
+111,108,  0, 42,109,102, 97, 99,101,  0, 42,109,116,102, 97, 99,101,  0, 42,116,102, 97, 99,101,  0, 42,109,118,101,114,116,  0,
+ 42,109,101,100,103,101,  0, 42,100,118,101,114,116,  0, 42,109, 99,111,108,  0, 42,109,115,116,105, 99,107,121,  0, 42,116,101,
+120, 99,111,109,101,115,104,  0, 42,101,100,105,116, 95, 98,116,109,101,115,104,  0,118,100, 97,116, 97,  0,101,100, 97,116, 97,
+  0,102,100, 97,116, 97,  0,112,100, 97,116, 97,  0,108,100, 97,116, 97,  0,116,111,116,101,100,103,101,  0,116,111,116,102, 97,
+ 99,101,  0,116,111,116,115,101,108,101, 99,116,  0,116,111,116,112,111,108,121,  0,116,111,116,108,111,111,112,  0, 97, 99,116,
+ 95,102, 97, 99,101,  0,115,109,111,111,116,104,114,101,115,104,  0,115,117, 98,100,105,118,  0,115,117, 98,100,105,118,114,  0,
+115,117, 98,115,117,114,102,116,121,112,101,  0,101,100,105,116,102,108, 97,103,  0, 42,109,114,  0, 42,116,112, 97,103,101,  0,
+117,118, 91, 52, 93, 91, 50, 93,  0, 99,111,108, 91, 52, 93,  0,116,114, 97,110,115,112,  0,116,105,108,101,  0,117,110,119,114,
+ 97,112,  0,118, 49,  0,118, 50,  0,118, 51,  0,118, 52,  0,101,100, 99,111,100,101,  0, 99,114,101, 97,115,101,  0, 98,119,101,
+105,103,104,116,  0,100,101,102, 95,110,114,  0, 42,100,119,  0,116,111,116,119,101,105,103,104,116,  0, 99,111, 91, 51, 93,  0,
+110,111, 91, 51, 93,  0,108,111,111,112,115,116, 97,114,116,  0,118,  0,101,  0,117,118, 91, 50, 93,  0, 99,111, 91, 50, 93,  0,
+102,  0,105,  0,115, 91, 50, 53, 54, 93,  0,116,111,116,100,105,115,112,  0,108,101,118,101,108,  0, 40, 42,100,105,115,112,115,
+ 41, 40, 41,  0, 42,104,105,100,100,101,110,  0,118, 91, 52, 93,  0,109,105,100,  0,112, 97,100, 91, 50, 93,  0,118, 91, 50, 93,
+  0, 42,102, 97, 99,101,115,  0, 42, 99,111,108,102, 97, 99,101,115,  0, 42,101,100,103,101,115,  0, 42,118,101,114,116,115,  0,
+108,101,118,101,108,115,  0,108,101,118,101,108, 95, 99,111,117,110,116,  0, 99,117,114,114,101,110,116,  0,110,101,119,108,118,
+108,  0,101,100,103,101,108,118,108,  0,112,105,110,108,118,108,  0,114,101,110,100,101,114,108,118,108,  0,117,115,101, 95, 99,
+111,108,  0, 42,101,100,103,101, 95,102,108, 97,103,115,  0, 42,101,100,103,101, 95, 99,114,101, 97,115,101,115,  0,115,116, 97,
+ 99,107,105,110,100,101,120,  0, 42,101,114,114,111,114,  0,109,111,100,105,102,105,101,114,  0, 42,116,101,120,116,117,114,101,
+  0, 42,109, 97,112, 95,111, 98,106,101, 99,116,  0,117,118,108, 97,121,101,114, 95,110, 97,109,101, 91, 54, 52, 93,  0,117,118,
+108, 97,121,101,114, 95,116,109,112,  0,116,101,120,109, 97,112,112,105,110,103,  0,115,117, 98,100,105,118, 84,121,112,101,  0,
+114,101,110,100,101,114, 76,101,118,101,108,115,  0, 42,101,109, 67, 97, 99,104,101,  0, 42,109, 67, 97, 99,104,101,  0,115,116,
+114,101,110,103,116,104,  0,100,101,102, 97,120,105,115,  0,112, 97,100, 91, 54, 93,  0,108,101,110,103,116,104,  0,114, 97,110,
+100,111,109,105,122,101,  0,115,101,101,100,  0, 42,111, 98, 95, 97,114,109,  0, 42,115,116, 97,114,116, 95, 99, 97,112,  0, 42,
+101,110,100, 95, 99, 97,112,  0, 42, 99,117,114,118,101, 95,111, 98,  0, 42,111,102,102,115,101,116, 95,111, 98,  0,111,102,102,
+115,101,116, 91, 51, 93,  0,115, 99, 97,108,101, 91, 51, 93,  0,109,101,114,103,101, 95,100,105,115,116,  0,102,105,116, 95,116,
+121,112,101,  0,111,102,102,115,101,116, 95,116,121,112,101,  0, 99,111,117,110,116,  0, 97,120,105,115,  0,116,111,108,101,114,
+ 97,110, 99,101,  0, 42,109,105,114,114,111,114, 95,111, 98,  0,115,112,108,105,116, 95, 97,110,103,108,101,  0,118, 97,108,117,
+101,  0,114,101,115,  0,118, 97,108, 95,102,108, 97,103,115,  0,108,105,109, 95,102,108, 97,103,115,  0,101, 95,102,108, 97,103,
+115,  0, 98,101,118,101,108, 95, 97,110,103,108,101,  0,100,101,102,103,114,112, 95,110, 97,109,101, 91, 54, 52, 93,  0, 42,100,
+111,109, 97,105,110,  0, 42,102,108,111,119,  0, 42, 99,111,108,108,  0,116,105,109,101,  0,100,105,114,101, 99,116,105,111,110,
+  0,109,105,100,108,101,118,101,108,  0, 42,112,114,111,106,101, 99,116,111,114,115, 91, 49, 48, 93,  0, 42,105,109, 97,103,101,
+  0,110,117,109, 95,112,114,111,106,101, 99,116,111,114,115,  0, 97,115,112,101, 99,116,120,  0, 97,115,112,101, 99,116,121,  0,
+115, 99, 97,108,101,120,  0,115, 99, 97,108,101,121,  0,112,101,114, 99,101,110,116,  0,102, 97, 99,101, 67,111,117,110,116,  0,
+102, 97, 99,  0,114,101,112,101, 97,116,  0, 42,111, 98,106,101, 99,116, 99,101,110,116,101,114,  0,115,116, 97,114,116,120,  0,
+115,116, 97,114,116,121,  0,104,101,105,103,104,116,  0,110, 97,114,114,111,119,  0,115,112,101,101,100,  0,100, 97,109,112,  0,
+102, 97,108,108,111,102,102,  0,116,105,109,101,111,102,102,115,  0,108,105,102,101,116,105,109,101,  0,100,101,102,111,114,109,
+102,108, 97,103,  0,109,117,108,116,105,  0, 42,112,114,101,118, 67,111,115,  0,115,117, 98,116, 97,114,103,101,116, 91, 54, 52,
+ 93,  0,112, 97,114,101,110,116,105,110,118, 91, 52, 93, 91, 52, 93,  0, 99,101,110,116, 91, 51, 93,  0, 42,105,110,100,101,120,
+ 97,114,  0,116,111,116,105,110,100,101,120,  0,102,111,114, 99,101,  0, 42, 99,108,111,116,104, 79, 98,106,101, 99,116,  0, 42,
+115,105,109, 95,112, 97,114,109,115,  0, 42, 99,111,108,108, 95,112, 97,114,109,115,  0, 42,112,111,105,110,116, 95, 99, 97, 99,
+104,101,  0,112,116, 99, 97, 99,104,101,115,  0, 42,120,  0, 42,120,110,101,119,  0, 42,120,111,108,100,  0, 42, 99,117,114,114,
+101,110,116, 95,120,110,101,119,  0, 42, 99,117,114,114,101,110,116, 95,120,  0, 42, 99,117,114,114,101,110,116, 95,118,  0, 42,
+109,102, 97, 99,101,115,  0,110,117,109,118,101,114,116,115,  0,110,117,109,102, 97, 99,101,115,  0,116,105,109,101, 95,120,  0,
+116,105,109,101, 95,120,110,101,119,  0, 42, 98,118,104,116,114,101,101,  0, 42,118,  0, 42,100,109,  0, 99,102,114, 97,  0,111,
+112,101,114, 97,116,105,111,110,  0,118,101,114,116,101,120,  0,116,111,116,105,110,102,108,117,101,110, 99,101,  0,103,114,105,
+100,115,105,122,101,  0, 42, 98,105,110,100,105,110,102,108,117,101,110, 99,101,115,  0, 42, 98,105,110,100,111,102,102,115,101,
+116,115,  0, 42, 98,105,110,100, 99, 97,103,101, 99,111,115,  0,116,111,116, 99, 97,103,101,118,101,114,116,  0, 42,100,121,110,
+103,114,105,100,  0, 42,100,121,110,105,110,102,108,117,101,110, 99,101,115,  0, 42,100,121,110,118,101,114,116,115,  0, 42,112,
+ 97,100, 50,  0,100,121,110,103,114,105,100,115,105,122,101,  0,100,121,110, 99,101,108,108,109,105,110, 91, 51, 93,  0,100,121,
+110, 99,101,108,108,119,105,100,116,104,  0, 98,105,110,100,109, 97,116, 91, 52, 93, 91, 52, 93,  0, 42, 98,105,110,100,119,101,
+105,103,104,116,115,  0, 42, 98,105,110,100, 99,111,115,  0, 40, 42, 98,105,110,100,102,117,110, 99, 41, 40, 41,  0, 42,112,115,
+121,115,  0,116,111,116,100,109,118,101,114,116,  0,116,111,116,100,109,101,100,103,101,  0,116,111,116,100,109,102, 97, 99,101,
+  0,112,111,115,105,116,105,111,110,  0,114, 97,110,100,111,109, 95,112,111,115,105,116,105,111,110,  0, 42,102, 97, 99,101,112,
+ 97,  0,118,103,114,111,117,112,  0,112,114,111,116,101, 99,116,  0,108,118,108,  0,115, 99,117,108,112,116,108,118,108,  0,116,
+111,116,108,118,108,  0,115,105,109,112,108,101,  0, 42,102,115,115,  0, 42,116, 97,114,103,101,116,  0, 42, 97,117,120, 84, 97,
+114,103,101,116,  0,118,103,114,111,117,112, 95,110, 97,109,101, 91, 54, 52, 93,  0,107,101,101,112, 68,105,115,116,  0,115,104,
+114,105,110,107, 84,121,112,101,  0,115,104,114,105,110,107, 79,112,116,115,  0,112,114,111,106, 65,120,105,115,  0,115,117, 98,
+115,117,114,102, 76,101,118,101,108,115,  0, 42,111,114,105,103,105,110,  0,102, 97, 99,116,111,114,  0,108,105,109,105,116, 91,
+ 50, 93,  0,111,114,105,103,105,110, 79,112,116,115,  0,111,102,102,115,101,116, 95,102, 97, 99,  0,111,102,102,115,101,116, 95,
+102, 97, 99, 95,118,103,  0, 99,114,101, 97,115,101, 95,105,110,110,101,114,  0, 99,114,101, 97,115,101, 95,111,117,116,101,114,
+  0, 99,114,101, 97,115,101, 95,114,105,109,  0,109, 97,116, 95,111,102,115,  0,109, 97,116, 95,111,102,115, 95,114,105,109,  0,
+ 42,111, 98, 95, 97,120,105,115,  0,115,116,101,112,115,  0,114,101,110,100,101,114, 95,115,116,101,112,115,  0,105,116,101,114,
+  0,115, 99,114,101,119, 95,111,102,115,  0, 97,110,103,108,101,  0, 42,111, 99,101, 97,110,  0, 42,111, 99,101, 97,110, 99, 97,
+ 99,104,101,  0,114,101,115,111,108,117,116,105,111,110,  0,115,112, 97,116,105, 97,108, 95,115,105,122,101,  0,119,105,110,100,
+ 95,118,101,108,111, 99,105,116,121,  0,115,109, 97,108,108,101,115,116, 95,119, 97,118,101,  0,119, 97,118,101, 95, 97,108,105,
+103,110,109,101,110,116,  0,119, 97,118,101, 95,100,105,114,101, 99,116,105,111,110,  0,119, 97,118,101, 95,115, 99, 97,108,101,
+  0, 99,104,111,112, 95, 97,109,111,117,110,116,  0,102,111, 97,109, 95, 99,111,118,101,114, 97,103,101,  0, 98, 97,107,101,115,
+116, 97,114,116,  0, 98, 97,107,101,101,110,100,  0, 99, 97, 99,104,101,112, 97,116,104, 91, 49, 48, 50, 52, 93,  0,102,111, 97,
+109,108, 97,121,101,114,110, 97,109,101, 91, 54, 52, 93,  0, 99, 97, 99,104,101,100,  0,103,101,111,109,101,116,114,121, 95,109,
+111,100,101,  0,114,101,102,114,101,115,104,  0,114,101,112,101, 97,116, 95,120,  0,114,101,112,101, 97,116, 95,121,  0,102,111,
+ 97,109, 95,102, 97,100,101,  0, 42,111, 98,106,101, 99,116, 95,102,114,111,109,  0, 42,111, 98,106,101, 99,116, 95,116,111,  0,
+102, 97,108,108,111,102,102, 95,114, 97,100,105,117,115,  0,101,100,105,116, 95,102,108, 97,103,115,  0,100,101,102, 97,117,108,
+116, 95,119,101,105,103,104,116,  0, 42, 99,109, 97,112, 95, 99,117,114,118,101,  0, 97,100,100, 95,116,104,114,101,115,104,111,
+108,100,  0,114,101,109, 95,116,104,114,101,115,104,111,108,100,  0,109, 97,115,107, 95, 99,111,110,115,116, 97,110,116,  0,109,
+ 97,115,107, 95,100,101,102,103,114,112, 95,110, 97,109,101, 91, 54, 52, 93,  0,109, 97,115,107, 95,116,101,120, 95,117,115,101,
+ 95, 99,104, 97,110,110,101,108,  0, 42,109, 97,115,107, 95,116,101,120,116,117,114,101,  0, 42,109, 97,115,107, 95,116,101,120,
+ 95,109, 97,112, 95,111, 98,106,  0,109, 97,115,107, 95,116,101,120, 95,109, 97,112,112,105,110,103,  0,109, 97,115,107, 95,116,
+101,120, 95,117,118,108, 97,121,101,114, 95,110, 97,109,101, 91, 54, 52, 93,  0,112, 97,100, 95,105, 49,  0,100,101,102,103,114,
+112, 95,110, 97,109,101, 95, 97, 91, 54, 52, 93,  0,100,101,102,103,114,112, 95,110, 97,109,101, 95, 98, 91, 54, 52, 93,  0,100,
+101,102, 97,117,108,116, 95,119,101,105,103,104,116, 95, 97,  0,100,101,102, 97,117,108,116, 95,119,101,105,103,104,116, 95, 98,
+  0,109,105,120, 95,109,111,100,101,  0,109,105,120, 95,115,101,116,  0,112, 97,100, 95, 99, 49, 91, 54, 93,  0,112,114,111,120,
+105,109,105,116,121, 95,109,111,100,101,  0,112,114,111,120,105,109,105,116,121, 95,102,108, 97,103,115,  0, 42,112,114,111,120,
+105,109,105,116,121, 95,111, 98, 95,116, 97,114,103,101,116,  0,109,105,110, 95,100,105,115,116,  0,109, 97,120, 95,100,105,115,
+116,  0,112, 97,100, 95,115, 49,  0, 42, 99, 97,110,118, 97,115,  0, 42, 98,114,117,115,104,  0,116,104,114,101,115,104,111,108,
+100,  0,115, 99, 97,108,101,  0,104,101,114,109,105,116,101, 95,110,117,109,  0, 42,108, 97,116,116,  0,112,110,116,115,119,  0,
+111,112,110,116,115,117,  0,111,112,110,116,115,118,  0,111,112,110,116,115,119,  0,116,121,112,101,117,  0,116,121,112,101,118,
+  0,116,121,112,101,119,  0,102,117,  0,102,118,  0,102,119,  0,100,117,  0,100,118,  0,100,119,  0, 42,100,101,102,  0, 42,108,
+ 97,116,116,105, 99,101,100, 97,116, 97,  0,108, 97,116,109, 97,116, 91, 52, 93, 91, 52, 93,  0, 42,101,100,105,116,108, 97,116,
+116,  0,118,101, 99, 91, 56, 93, 91, 51, 93,  0, 42,115, 99,117,108,112,116,  0,112, 97,114,116,121,112,101,  0,112, 97,114, 49,
+  0,112, 97,114, 50,  0,112, 97,114, 51,  0,112, 97,114,115,117, 98,115,116,114, 91, 54, 52, 93,  0, 42,116,114, 97, 99,107,  0,
+ 42,112,114,111,120,121,  0, 42,112,114,111,120,121, 95,103,114,111,117,112,  0, 42,112,114,111,120,121, 95,102,114,111,109,  0,
+ 42, 97, 99,116,105,111,110,  0, 42,112,111,115,101,108,105, 98,  0, 42,112,111,115,101,  0, 42,103,112,100,  0, 97,118,115,  0,
+ 42,109,112, 97,116,104,  0, 99,111,110,115,116,114, 97,105,110,116, 67,104, 97,110,110,101,108,115,  0,101,102,102,101, 99,116,
+  0,100,101,102, 98, 97,115,101,  0,109,111,100,105,102,105,101,114,115,  0,114,101,115,116,111,114,101, 95,109,111,100,101,  0,
+ 42,109, 97,116, 98,105,116,115,  0, 97, 99,116, 99,111,108,  0,100,108,111, 99, 91, 51, 93,  0,111,114,105,103, 91, 51, 93,  0,
+100,115,105,122,101, 91, 51, 93,  0,100,115, 99, 97,108,101, 91, 51, 93,  0,100,114,111,116, 91, 51, 93,  0,100,113,117, 97,116,
+ 91, 52, 93,  0,114,111,116, 65,120,105,115, 91, 51, 93,  0,100,114,111,116, 65,120,105,115, 91, 51, 93,  0,114,111,116, 65,110,
+103,108,101,  0,100,114,111,116, 65,110,103,108,101,  0,111, 98,109, 97,116, 91, 52, 93, 91, 52, 93,  0, 99,111,110,115,116,105,
+110,118, 91, 52, 93, 91, 52, 93,  0,105,109, 97,116, 95,114,101,110, 91, 52, 93, 91, 52, 93,  0,108, 97,121,  0,112, 97,100, 54,
+  0, 99,111,108, 98,105,116,115,  0,116,114, 97,110,115,102,108, 97,103,  0,112,114,111,116,101, 99,116,102,108, 97,103,  0,116,
+114, 97, 99,107,102,108, 97,103,  0,117,112,102,108, 97,103,  0,110,108, 97,102,108, 97,103,  0,105,112,111,102,108, 97,103,  0,
+115, 99, 97,102,108, 97,103,  0,115, 99, 97,118,105,115,102,108, 97,103,  0,112, 97,100, 53,  0,100,117,112,111,110,  0,100,117,
+112,111,102,102,  0,100,117,112,115,116, 97,  0,100,117,112,101,110,100,  0,115,102,  0,109, 97,115,115,  0,100, 97,109,112,105,
+110,103,  0,105,110,101,114,116,105, 97,  0,102,111,114,109,102, 97, 99,116,111,114,  0,114,100, 97,109,112,105,110,103,  0,109,
+ 97,114,103,105,110,  0,109, 97,120, 95,118,101,108,  0,109,105,110, 95,118,101,108,  0,109, 95, 99,111,110,116, 97, 99,116, 80,
+114,111, 99,101,115,115,105,110,103, 84,104,114,101,115,104,111,108,100,  0,111, 98,115,116, 97, 99,108,101, 82, 97,100,  0,114,
+111,116,109,111,100,101,  0, 98,111,117,110,100,116,121,112,101,  0, 99,111,108,108,105,115,105,111,110, 95, 98,111,117,110,100,
+116,121,112,101,  0,114,101,115,116,114,105, 99,116,102,108, 97,103,  0,100,116,  0,101,109,112,116,121, 95,100,114, 97,119,116,
+121,112,101,  0,101,109,112,116,121, 95,100,114, 97,119,115,105,122,101,  0,100,117,112,102, 97, 99,101,115, 99, 97,  0,112,114,
+111,112,  0,115,101,110,115,111,114,115,  0, 99,111,110,116,114,111,108,108,101,114,115,  0, 97, 99,116,117, 97,116,111,114,115,
+  0, 98, 98,115,105,122,101, 91, 51, 93,  0, 97, 99,116,100,101,102,  0,103, 97,109,101,102,108, 97,103,  0,103, 97,109,101,102,
+108, 97,103, 50,  0, 42, 98,115,111,102,116,  0,115,111,102,116,102,108, 97,103,  0, 97,110,105,115,111,116,114,111,112,105, 99,
+ 70,114,105, 99,116,105,111,110, 91, 51, 93,  0, 99,111,110,115,116,114, 97,105,110,116,115,  0,110,108, 97,115,116,114,105,112,
+115,  0,104,111,111,107,115,  0,112, 97,114,116,105, 99,108,101,115,121,115,116,101,109,  0, 42,115,111,102,116,  0, 42,100,117,
+112, 95,103,114,111,117,112,  0, 98,111,100,121, 95,116,121,112,101,  0,115,104, 97,112,101,102,108, 97,103,  0, 42,102,108,117,
+105,100,115,105,109, 83,101,116,116,105,110,103,115,  0, 42,100,101,114,105,118,101,100, 68,101,102,111,114,109,  0, 42,100,101,
+114,105,118,101,100, 70,105,110, 97,108,  0,108, 97,115,116, 68, 97,116, 97, 77, 97,115,107,  0, 99,117,115,116,111,109,100, 97,
+116, 97, 95,109, 97,115,107,  0,115,116, 97,116,101,  0,105,110,105,116, 95,115,116, 97,116,101,  0,103,112,117,108, 97,109,112,
+  0,112, 99, 95,105,100,115,  0, 42,100,117,112,108,105,108,105,115,116,  0,105,109, 97, 95,111,102,115, 91, 50, 93,  0, 99,117,
+114,105,110,100,101,120,  0, 97, 99,116,105,118,101,  0,111,114,105,103,108, 97,121,  0,111,109, 97,116, 91, 52, 93, 91, 52, 93,
+  0,111,114, 99,111, 91, 51, 93,  0,110,111, 95,100,114, 97,119,  0, 97,110,105,109, 97,116,101,100,  0,100,101,102,108,101, 99,
+116,  0,102,111,114, 99,101,102,105,101,108,100,  0,115,104, 97,112,101,  0,116,101,120, 95,109,111,100,101,  0,107,105,110,107,
+  0,107,105,110,107, 95, 97,120,105,115,  0,122,100,105,114,  0,102, 95,115,116,114,101,110,103,116,104,  0,102, 95,100, 97,109,
+112,  0,102, 95,102,108,111,119,  0,102, 95,115,105,122,101,  0,102, 95,112,111,119,101,114,  0,109, 97,120,100,105,115,116,  0,
+109,105,110,100,105,115,116,  0,102, 95,112,111,119,101,114, 95,114,  0,109, 97,120,114, 97,100,  0,109,105,110,114, 97,100,  0,
+112,100,101,102, 95,100, 97,109,112,  0,112,100,101,102, 95,114,100, 97,109,112,  0,112,100,101,102, 95,112,101,114,109,  0,112,
+100,101,102, 95,102,114,105, 99,116,  0,112,100,101,102, 95,114,102,114,105, 99,116,  0,112,100,101,102, 95,115,116,105, 99,107,
+110,101,115,115,  0, 97, 98,115,111,114,112,116,105,111,110,  0,112,100,101,102, 95,115, 98,100, 97,109,112,  0,112,100,101,102,
+ 95,115, 98,105,102,116,  0,112,100,101,102, 95,115, 98,111,102,116,  0, 99,108,117,109,112, 95,102, 97, 99,  0, 99,108,117,109,
+112, 95,112,111,119,  0,107,105,110,107, 95,102,114,101,113,  0,107,105,110,107, 95,115,104, 97,112,101,  0,107,105,110,107, 95,
+ 97,109,112,  0,102,114,101,101, 95,101,110,100,  0,116,101,120, 95,110, 97, 98,108, 97,  0, 42,114,110,103,  0,102, 95,110,111,
+105,115,101,  0,119,101,105,103,104,116, 91, 49, 51, 93,  0,103,108,111, 98, 97,108, 95,103,114, 97,118,105,116,121,  0,114,116,
+ 91, 51, 93,  0,116,111,116,100, 97,116, 97,  0,102,114, 97,109,101,  0,116,111,116,112,111,105,110,116,  0,100, 97,116, 97, 95,
+116,121,112,101,115,  0, 42,100, 97,116, 97, 91, 56, 93,  0, 42, 99,117,114, 91, 56, 93,  0,101,120,116,114, 97,100, 97,116, 97,
+  0,115,116,101,112,  0,115,105,109,102,114, 97,109,101,  0,115,116, 97,114,116,102,114, 97,109,101,  0,101,110,100,102,114, 97,
+109,101,  0,101,100,105,116,102,114, 97,109,101,  0,108, 97,115,116, 95,101,120, 97, 99,116,  0,108, 97,115,116, 95,118, 97,108,
+105,100,  0, 99,111,109,112,114,101,115,115,105,111,110,  0,112,114,101,118, 95,110, 97,109,101, 91, 54, 52, 93,  0,105,110,102,
+111, 91, 54, 52, 93,  0,112, 97,116,104, 91, 49, 48, 50, 52, 93,  0, 42, 99, 97, 99,104,101,100, 95,102,114, 97,109,101,115,  0,
+109,101,109, 95, 99, 97, 99,104,101,  0, 42,101,100,105,116,  0, 40, 42,102,114,101,101, 95,101,100,105,116, 41, 40, 41,  0,108,
+105,110, 83,116,105,102,102,  0, 97,110,103, 83,116,105,102,102,  0,118,111,108,117,109,101,  0,118,105,116,101,114, 97,116,105,
+111,110,115,  0,112,105,116,101,114, 97,116,105,111,110,115,  0,100,105,116,101,114, 97,116,105,111,110,115,  0, 99,105,116,101,
+114, 97,116,105,111,110,115,  0,107, 83, 82, 72, 82, 95, 67, 76,  0,107, 83, 75, 72, 82, 95, 67, 76,  0,107, 83, 83, 72, 82, 95,
+ 67, 76,  0,107, 83, 82, 95, 83, 80, 76, 84, 95, 67, 76,  0,107, 83, 75, 95, 83, 80, 76, 84, 95, 67, 76,  0,107, 83, 83, 95, 83,
+ 80, 76, 84, 95, 67, 76,  0,107, 86, 67, 70,  0,107, 68, 80,  0,107, 68, 71,  0,107, 76, 70,  0,107, 80, 82,  0,107, 86, 67,  0,
+107, 68, 70,  0,107, 77, 84,  0,107, 67, 72, 82,  0,107, 75, 72, 82,  0,107, 83, 72, 82,  0,107, 65, 72, 82,  0, 99,111,108,108,
+105,115,105,111,110,102,108, 97,103,115,  0,110,117,109, 99,108,117,115,116,101,114,105,116,101,114, 97,116,105,111,110,115,  0,
+119,101,108,100,105,110,103,  0,116,111,116,115,112,114,105,110,103,  0, 42, 98,112,111,105,110,116,  0, 42, 98,115,112,114,105,
+110,103,  0,109,115,103, 95,108,111, 99,107,  0,109,115,103, 95,118, 97,108,117,101,  0,110,111,100,101,109, 97,115,115,  0,110,
+ 97,109,101,100, 86, 71, 95, 77, 97,115,115, 91, 54, 52, 93,  0,103,114, 97,118,  0,109,101,100,105, 97,102,114,105, 99,116,  0,
+114,107,108,105,109,105,116,  0,112,104,121,115,105, 99,115, 95,115,112,101,101,100,  0,103,111, 97,108,115,112,114,105,110,103,
+  0,103,111, 97,108,102,114,105, 99,116,  0,109,105,110,103,111, 97,108,  0,109, 97,120,103,111, 97,108,  0,100,101,102,103,111,
+ 97,108,  0,118,101,114,116,103,114,111,117,112,  0,110, 97,109,101,100, 86, 71, 95, 83,111,102,116,103,111, 97,108, 91, 54, 52,
+ 93,  0,102,117,122,122,121,110,101,115,115,  0,105,110,115,112,114,105,110,103,  0,105,110,102,114,105, 99,116,  0,110, 97,109,
+101,100, 86, 71, 95, 83,112,114,105,110,103, 95, 75, 91, 54, 52, 93,  0,101,102,114, 97,  0,105,110,116,101,114,118, 97,108,  0,
+108,111, 99, 97,108,  0,115,111,108,118,101,114,102,108, 97,103,115,  0, 42, 42,107,101,121,115,  0,116,111,116,112,111,105,110,
+116,107,101,121,  0,115,101, 99,111,110,100,115,112,114,105,110,103,  0, 99,111,108, 98, 97,108,108,  0, 98, 97,108,108,100, 97,
+109,112,  0, 98, 97,108,108,115,116,105,102,102,  0,115, 98, 99, 95,109,111,100,101,  0, 97,101,114,111,101,100,103,101,  0,109,
+105,110,108,111,111,112,115,  0,109, 97,120,108,111,111,112,115,  0, 99,104,111,107,101,  0,115,111,108,118,101,114, 95, 73, 68,
+  0,112,108, 97,115,116,105, 99,  0,115,112,114,105,110,103,112,114,101,108,111, 97,100,  0, 42,115, 99,114, 97,116, 99,104,  0,
+115,104,101, 97,114,115,116,105,102,102,  0,105,110,112,117,115,104,  0, 42,112,111,105,110,116, 99, 97, 99,104,101,  0, 42,101,
+102,102,101, 99,116,111,114, 95,119,101,105,103,104,116,115,  0,108, 99,111,109, 91, 51, 93,  0,108,114,111,116, 91, 51, 93, 91,
+ 51, 93,  0,108,115, 99, 97,108,101, 91, 51, 93, 91, 51, 93,  0,108, 97,115,116, 95,102,114, 97,109,101,  0,118,101,108, 91, 51,
+ 93,  0, 42,102,109,100,  0,115,104,111,119, 95, 97,100,118, 97,110, 99,101,100,111,112,116,105,111,110,115,  0,114,101,115,111,
+108,117,116,105,111,110,120,121,122,  0,112,114,101,118,105,101,119,114,101,115,120,121,122,  0,114,101, 97,108,115,105,122,101,
+  0,103,117,105, 68,105,115,112,108, 97,121, 77,111,100,101,  0,114,101,110,100,101,114, 68,105,115,112,108, 97,121, 77,111,100,
+101,  0,118,105,115, 99,111,115,105,116,121, 86, 97,108,117,101,  0,118,105,115, 99,111,115,105,116,121, 77,111,100,101,  0,118,
+105,115, 99,111,115,105,116,121, 69,120,112,111,110,101,110,116,  0,103,114, 97,118, 91, 51, 93,  0, 97,110,105,109, 83,116, 97,
+114,116,  0, 97,110,105,109, 69,110,100,  0, 98, 97,107,101, 83,116, 97,114,116,  0, 98, 97,107,101, 69,110,100,  0,102,114, 97,
+109,101, 79,102,102,115,101,116,  0,103,115,116, 97,114,  0,109, 97,120, 82,101,102,105,110,101,  0,105,110,105, 86,101,108,120,
+  0,105,110,105, 86,101,108,121,  0,105,110,105, 86,101,108,122,  0, 42,111,114,103, 77,101,115,104,  0, 42,109,101,115,104, 66,
+ 66,  0,115,117,114,102,100, 97,116, 97, 80, 97,116,104, 91, 49, 48, 50, 52, 93,  0, 98, 98, 83,116, 97,114,116, 91, 51, 93,  0,
+ 98, 98, 83,105,122,101, 91, 51, 93,  0,116,121,112,101, 70,108, 97,103,115,  0,100,111,109, 97,105,110, 78,111,118,101, 99,103,
+101,110,  0,118,111,108,117,109,101, 73,110,105,116, 84,121,112,101,  0,112, 97,114,116, 83,108,105,112, 86, 97,108,117,101,  0,
+103,101,110,101,114, 97,116,101, 84,114, 97, 99,101,114,115,  0,103,101,110,101,114, 97,116,101, 80, 97,114,116,105, 99,108,101,
+115,  0,115,117,114,102, 97, 99,101, 83,109,111,111,116,104,105,110,103,  0,115,117,114,102, 97, 99,101, 83,117, 98,100,105,118,
+115,  0,112, 97,114,116,105, 99,108,101, 73,110,102, 83,105,122,101,  0,112, 97,114,116,105, 99,108,101, 73,110,102, 65,108,112,
+104, 97,  0,102, 97,114, 70,105,101,108,100, 83,105,122,101,  0, 42,109,101,115,104, 86,101,108,111, 99,105,116,105,101,115,  0,
+ 99,112,115, 84,105,109,101, 83,116, 97,114,116,  0, 99,112,115, 84,105,109,101, 69,110,100,  0, 99,112,115, 81,117, 97,108,105,
+116,121,  0, 97,116,116,114, 97, 99,116,102,111,114, 99,101, 83,116,114,101,110,103,116,104,  0, 97,116,116,114, 97, 99,116,102,
+111,114, 99,101, 82, 97,100,105,117,115,  0,118,101,108,111, 99,105,116,121,102,111,114, 99,101, 83,116,114,101,110,103,116,104,
+  0,118,101,108,111, 99,105,116,121,102,111,114, 99,101, 82, 97,100,105,117,115,  0,108, 97,115,116,103,111,111,100,102,114, 97,
+109,101,  0, 97,110,105,109, 82, 97,116,101,  0,109,105,115,116,121,112,101,  0,104,111,114,114,  0,104,111,114,103,  0,104,111,
+114, 98,  0,122,101,110,114,  0,122,101,110,103,  0,122,101,110, 98,  0,102, 97,115,116, 99,111,108,  0,101,120,112,111,115,117,
+114,101,  0,101,120,112,  0,114, 97,110,103,101,  0,108,105,110,102, 97, 99,  0,108,111,103,102, 97, 99,  0,103,114, 97,118,105,
+116,121,  0, 97, 99,116,105,118,105,116,121, 66,111,120, 82, 97,100,105,117,115,  0,115,107,121,116,121,112,101,  0,111, 99, 99,
+108,117,115,105,111,110, 82,101,115,  0,112,104,121,115,105, 99,115, 69,110,103,105,110,101,  0,116,105, 99,114, 97,116,101,  0,
+109, 97,120,108,111,103,105, 99,115,116,101,112,  0,112,104,121,115,117, 98,115,116,101,112,  0,109, 97,120,112,104,121,115,116,
+101,112,  0,109,105,115,105,  0,109,105,115,116,115,116, 97,  0,109,105,115,116,100,105,115,116,  0,109,105,115,116,104,105,  0,
+115,116, 97,114,114,  0,115,116, 97,114,103,  0,115,116, 97,114, 98,  0,115,116, 97,114,107,  0,115,116, 97,114,115,105,122,101,
+  0,115,116, 97,114,109,105,110,100,105,115,116,  0,115,116, 97,114,100,105,115,116,  0,115,116, 97,114, 99,111,108,110,111,105,
+115,101,  0,100,111,102,115,116, 97,  0,100,111,102,101,110,100,  0,100,111,102,109,105,110,  0,100,111,102,109, 97,120,  0, 97,
+111,100,105,115,116,  0, 97,111,100,105,115,116,102, 97, 99,  0, 97,111,101,110,101,114,103,121,  0, 97,111, 98,105, 97,115,  0,
+ 97,111,109,111,100,101,  0, 97,111,115, 97,109,112,  0, 97,111,109,105,120,  0, 97,111, 99,111,108,111,114,  0, 97,111, 95, 97,
+100, 97,112,116, 95,116,104,114,101,115,104,  0, 97,111, 95, 97,100, 97,112,116, 95,115,112,101,101,100, 95,102, 97, 99,  0, 97,
+111, 95, 97,112,112,114,111,120, 95,101,114,114,111,114,  0, 97,111, 95, 97,112,112,114,111,120, 95, 99,111,114,114,101, 99,116,
+105,111,110,  0, 97,111, 95,105,110,100,105,114,101, 99,116, 95,101,110,101,114,103,121,  0, 97,111, 95,101,110,118, 95,101,110,
+101,114,103,121,  0, 97,111, 95,112, 97,100, 50,  0, 97,111, 95,105,110,100,105,114,101, 99,116, 95, 98,111,117,110, 99,101,115,
+  0, 97,111, 95,112, 97,100,  0, 97,111, 95,115, 97,109,112, 95,109,101,116,104,111,100,  0, 97,111, 95,103, 97,116,104,101,114,
+ 95,109,101,116,104,111,100,  0, 97,111, 95, 97,112,112,114,111,120, 95,112, 97,115,115,101,115,  0, 42, 97,111,115,112,104,101,
+114,101,  0, 42, 97,111,116, 97, 98,108,101,115,  0,115,101,108, 99,111,108,  0,115,120,  0,115,121,  0, 42,108,112, 70,111,114,
+109, 97,116,  0, 42,108,112, 80, 97,114,109,115,  0, 99, 98, 70,111,114,109, 97,116,  0, 99, 98, 80, 97,114,109,115,  0,102, 99,
+ 99, 84,121,112,101,  0,102, 99, 99, 72, 97,110,100,108,101,114,  0,100,119, 75,101,121, 70,114, 97,109,101, 69,118,101,114,121,
+  0,100,119, 81,117, 97,108,105,116,121,  0,100,119, 66,121,116,101,115, 80,101,114, 83,101, 99,111,110,100,  0,100,119, 70,108,
+ 97,103,115,  0,100,119, 73,110,116,101,114,108,101, 97,118,101, 69,118,101,114,121,  0, 97,118,105, 99,111,100,101, 99,110, 97,
+109,101, 91, 49, 50, 56, 93,  0, 42, 99,100, 80, 97,114,109,115,  0, 42,112, 97,100,  0, 99,100, 83,105,122,101,  0,113,116, 99,
+111,100,101, 99,110, 97,109,101, 91, 49, 50, 56, 93,  0, 99,111,100,101, 99, 84,121,112,101,  0, 99,111,100,101, 99, 83,112, 97,
+116,105, 97,108, 81,117, 97,108,105,116,121,  0, 99,111,100,101, 99,  0, 99,111,100,101, 99, 70,108, 97,103,115,  0, 99,111,108,
+111,114, 68,101,112,116,104,  0, 99,111,100,101, 99, 84,101,109,112,111,114, 97,108, 81,117, 97,108,105,116,121,  0,109,105,110,
+ 83,112, 97,116,105, 97,108, 81,117, 97,108,105,116,121,  0,109,105,110, 84,101,109,112,111,114, 97,108, 81,117, 97,108,105,116,
+121,  0,107,101,121, 70,114, 97,109,101, 82, 97,116,101,  0, 98,105,116, 82, 97,116,101,  0, 97,117,100,105,111, 99,111,100,101,
+ 99, 84,121,112,101,  0, 97,117,100,105,111, 83, 97,109,112,108,101, 82, 97,116,101,  0, 97,117,100,105,111, 66,105,116, 68,101,
+112,116,104,  0, 97,117,100,105,111, 67,104, 97,110,110,101,108,115,  0, 97,117,100,105,111, 67,111,100,101, 99, 70,108, 97,103,
+115,  0, 97,117,100,105,111, 66,105,116, 82, 97,116,101,  0, 97,117,100,105,111, 95, 99,111,100,101, 99,  0,118,105,100,101,111,
+ 95, 98,105,116,114, 97,116,101,  0, 97,117,100,105,111, 95, 98,105,116,114, 97,116,101,  0, 97,117,100,105,111, 95,109,105,120,
+114, 97,116,101,  0, 97,117,100,105,111, 95, 99,104, 97,110,110,101,108,115,  0, 97,117,100,105,111, 95,112, 97,100,  0, 97,117,
+100,105,111, 95,118,111,108,117,109,101,  0,103,111,112, 95,115,105,122,101,  0,114, 99, 95,109,105,110, 95,114, 97,116,101,  0,
+114, 99, 95,109, 97,120, 95,114, 97,116,101,  0,114, 99, 95, 98,117,102,102,101,114, 95,115,105,122,101,  0,109,117,120, 95,112,
+ 97, 99,107,101,116, 95,115,105,122,101,  0,109,117,120, 95,114, 97,116,101,  0,109,105,120,114, 97,116,101,  0,109, 97,105,110,
+  0,115,112,101,101,100, 95,111,102, 95,115,111,117,110,100,  0,100,111,112,112,108,101,114, 95,102, 97, 99,116,111,114,  0,100,
+105,115,116, 97,110, 99,101, 95,109,111,100,101,108,  0, 42,109, 97,116, 95,111,118,101,114,114,105,100,101,  0, 42,108,105,103,
+104,116, 95,111,118,101,114,114,105,100,101,  0,108, 97,121, 95,122,109, 97,115,107,  0,108, 97,121,102,108, 97,103,  0,112, 97,
+115,115,102,108, 97,103,  0,112, 97,115,115, 95,120,111,114,  0,105,109,116,121,112,101,  0,112,108, 97,110,101,115,  0,113,117,
+ 97,108,105,116,121,  0, 99,111,109,112,114,101,115,115,  0,101,120,114, 95, 99,111,100,101, 99,  0, 99,105,110,101,111,110, 95,
+102,108, 97,103,  0, 99,105,110,101,111,110, 95,119,104,105,116,101,  0, 99,105,110,101,111,110, 95, 98,108, 97, 99,107,  0, 99,
+105,110,101,111,110, 95,103, 97,109,109, 97,  0,106,112, 50, 95,102,108, 97,103,  0,105,109, 95,102,111,114,109, 97,116,  0, 42,
+ 97,118,105, 99,111,100,101, 99,100, 97,116, 97,  0, 42,113,116, 99,111,100,101, 99,100, 97,116, 97,  0,113,116, 99,111,100,101,
+ 99,115,101,116,116,105,110,103,115,  0,102,102, 99,111,100,101, 99,100, 97,116, 97,  0,115,117, 98,102,114, 97,109,101,  0,112,
+115,102,114, 97,  0,112,101,102,114, 97,  0,105,109, 97,103,101,115,  0,102,114, 97,109, 97,112,116,111,  0,116,104,114,101, 97,
+100,115,  0,102,114, 97,109,101,108,101,110,  0, 98,108,117,114,102, 97, 99,  0,101,100,103,101, 82,  0,101,100,103,101, 71,  0,
+101,100,103,101, 66,  0,102,117,108,108,115, 99,114,101,101,110,  0,120,112,108, 97,121,  0,121,112,108, 97,121,  0,102,114,101,
+113,112,108, 97,121,  0, 97,116,116,114,105, 98,  0,102,114, 97,109,101, 95,115,116,101,112,  0,115,116,101,114,101,111,109,111,
+100,101,  0,100,105,109,101,110,115,105,111,110,115,112,114,101,115,101,116,  0,109, 97,120,105,109,115,105,122,101,  0,120,115,
+ 99,104,  0,121,115, 99,104,  0,120,112, 97,114,116,115,  0,121,112, 97,114,116,115,  0,115,117, 98,105,109,116,121,112,101,  0,
+100,105,115,112,108, 97,121,109,111,100,101,  0,115, 99,101,109,111,100,101,  0,114, 97,121,116,114, 97, 99,101, 95,111,112,116,
+105,111,110,115,  0,114, 97,121,116,114, 97, 99,101, 95,115,116,114,117, 99,116,117,114,101,  0,111, 99,114,101,115,  0,112, 97,
+100, 52,  0, 97,108,112,104, 97,109,111,100,101,  0,111,115, 97,  0,102,114,115, 95,115,101, 99,  0,101,100,103,101,105,110,116,
+  0,115, 97,102,101,116,121,  0, 98,111,114,100,101,114,  0,100,105,115,112,114,101, 99,116,  0,108, 97,121,101,114,115,  0, 97,
+ 99,116,108, 97,121,  0,109, 98,108,117,114, 95,115, 97,109,112,108,101,115,  0,120, 97,115,112,  0,121, 97,115,112,  0,102,114,
+115, 95,115,101, 99, 95, 98, 97,115,101,  0,103, 97,117,115,115,  0, 99,111,108,111,114, 95,109,103,116, 95,102,108, 97,103,  0,
+112,111,115,116,103, 97,109,109, 97,  0,112,111,115,116,104,117,101,  0,112,111,115,116,115, 97,116,  0,100,105,116,104,101,114,
+ 95,105,110,116,101,110,115,105,116,121,  0, 98, 97,107,101, 95,111,115, 97,  0, 98, 97,107,101, 95,102,105,108,116,101,114,  0,
+ 98, 97,107,101, 95,109,111,100,101,  0, 98, 97,107,101, 95,102,108, 97,103,  0, 98, 97,107,101, 95,110,111,114,109, 97,108, 95,
+115,112, 97, 99,101,  0, 98, 97,107,101, 95,113,117, 97,100, 95,115,112,108,105,116,  0, 98, 97,107,101, 95,109, 97,120,100,105,
+115,116,  0, 98, 97,107,101, 95, 98,105, 97,115,100,105,115,116,  0, 98, 97,107,101, 95,112, 97,100,  0,112,105, 99, 91, 49, 48,
+ 50, 52, 93,  0,115,116, 97,109,112,  0,115,116, 97,109,112, 95,102,111,110,116, 95,105,100,  0,115,116, 97,109,112, 95,117,100,
+ 97,116, 97, 91, 55, 54, 56, 93,  0,102,103, 95,115,116, 97,109,112, 91, 52, 93,  0, 98,103, 95,115,116, 97,109,112, 91, 52, 93,
+  0,115,101,113, 95,112,114,101,118, 95,116,121,112,101,  0,115,101,113, 95,114,101,110,100, 95,116,121,112,101,  0,115,101,113,
+ 95,102,108, 97,103,  0,112, 97,100, 53, 91, 53, 93,  0,115,105,109,112,108,105,102,121, 95,102,108, 97,103,  0,115,105,109,112,
+108,105,102,121, 95,115,117, 98,115,117,114,102,  0,115,105,109,112,108,105,102,121, 95,115,104, 97,100,111,119,115, 97,109,112,
+108,101,115,  0,115,105,109,112,108,105,102,121, 95,112, 97,114,116,105, 99,108,101,115,  0,115,105,109,112,108,105,102,121, 95,
+ 97,111,115,115,115,  0, 99,105,110,101,111,110,119,104,105,116,101,  0, 99,105,110,101,111,110, 98,108, 97, 99,107,  0, 99,105,
+110,101,111,110,103, 97,109,109, 97,  0,106,112, 50, 95,112,114,101,115,101,116,  0,106,112, 50, 95,100,101,112,116,104,  0,114,
+112, 97,100, 51,  0,100,111,109,101,114,101,115,  0,100,111,109,101,109,111,100,101,  0,100,111,109,101, 97,110,103,108,101,  0,
+100,111,109,101,116,105,108,116,  0,100,111,109,101,114,101,115, 98,117,102,  0, 42,100,111,109,101,116,101,120,116,  0,101,110,
+103,105,110,101, 91, 51, 50, 93,  0,110, 97,109,101, 91, 51, 50, 93,  0,112, 97,114,116,105, 99,108,101, 95,112,101,114, 99,  0,
+115,117, 98,115,117,114,102, 95,109, 97,120,  0,115,104, 97,100, 98,117,102,115, 97,109,112,108,101, 95,109, 97,120,  0, 97,111,
+ 95,101,114,114,111,114,  0,116,105,108,116,  0,114,101,115, 98,117,102,  0, 42,119, 97,114,112,116,101,120,116,  0, 99,111,108,
+ 91, 51, 93,  0, 99,101,108,108,115,105,122,101,  0, 99,101,108,108,104,101,105,103,104,116,  0, 97,103,101,110,116,109, 97,120,
+115,108,111,112,101,  0, 97,103,101,110,116,109, 97,120, 99,108,105,109, 98,  0, 97,103,101,110,116,104,101,105,103,104,116,  0,
+ 97,103,101,110,116,114, 97,100,105,117,115,  0,101,100,103,101,109, 97,120,108,101,110,  0,101,100,103,101,109, 97,120,101,114,
+114,111,114,  0,114,101,103,105,111,110,109,105,110,115,105,122,101,  0,114,101,103,105,111,110,109,101,114,103,101,115,105,122,
+101,  0,118,101,114,116,115,112,101,114,112,111,108,121,  0,100,101,116, 97,105,108,115, 97,109,112,108,101,100,105,115,116,  0,
+100,101,116, 97,105,108,115, 97,109,112,108,101,109, 97,120,101,114,114,111,114,  0,102,114, 97,109,105,110,103,  0,112,108, 97,
+121,101,114,102,108, 97,103,  0,114,116, 49,  0,114,116, 50,  0, 97, 97,115, 97,109,112,108,101,115,  0,112, 97,100, 52, 91, 51,
+ 93,  0,100,111,109,101,  0,115,116,101,114,101,111,102,108, 97,103,  0,101,121,101,115,101,112, 97,114, 97,116,105,111,110,  0,
+114,101, 99, 97,115,116, 68, 97,116, 97,  0,109, 97,116,109,111,100,101,  0,101,120,105,116,107,101,121,  0,111, 98,115,116, 97,
+ 99,108,101, 83,105,109,117,108, 97,116,105,111,110,  0,108,101,118,101,108, 72,101,105,103,104,116,  0, 42, 99, 97,109,101,114,
+ 97,  0, 42,112, 97,105,110,116, 95, 99,117,114,115,111,114,  0,112, 97,105,110,116, 95, 99,117,114,115,111,114, 95, 99,111,108,
+ 91, 52, 93,  0,112, 97,105,110,116,  0,115,101, 97,109, 95, 98,108,101,101,100,  0,110,111,114,109, 97,108, 95, 97,110,103,108,
+101,  0,115, 99,114,101,101,110, 95,103,114, 97, 98, 95,115,105,122,101, 91, 50, 93,  0, 42,112, 97,105,110,116, 99,117,114,115,
+111,114,  0,105,110,118,101,114,116,  0,116,111,116,114,101,107,101,121,  0,116,111,116, 97,100,100,107,101,121,  0, 98,114,117,
+115,104,116,121,112,101,  0, 98,114,117,115,104, 91, 55, 93,  0,101,109,105,116,116,101,114,100,105,115,116,  0,115,101,108,101,
+ 99,116,109,111,100,101,  0,101,100,105,116,116,121,112,101,  0,100,114, 97,119, 95,115,116,101,112,  0,102, 97,100,101, 95,102,
+114, 97,109,101,115,  0,114, 97,100,105, 97,108, 95,115,121,109,109, 91, 51, 93,  0,108, 97,115,116, 95,120,  0,108, 97,115,116,
+ 95,121,  0,108, 97,115,116, 95, 97,110,103,108,101,  0,100,114, 97,119, 95, 97,110, 99,104,111,114,101,100,  0, 97,110, 99,104,
+111,114,101,100, 95,115,105,122,101,  0, 97,110, 99,104,111,114,101,100, 95,108,111, 99, 97,116,105,111,110, 91, 51, 93,  0, 97,
+110, 99,104,111,114,101,100, 95,105,110,105,116,105, 97,108, 95,109,111,117,115,101, 91, 50, 93,  0,100,114, 97,119, 95,112,114,
+101,115,115,117,114,101,  0,112,114,101,115,115,117,114,101, 95,118, 97,108,117,101,  0,115,112,101, 99,105, 97,108, 95,114,111,
+116, 97,116,105,111,110,  0, 42,118,112, 97,105,110,116, 95,112,114,101,118,  0, 42,119,112, 97,105,110,116, 95,112,114,101,118,
+  0,109, 97,116, 91, 51, 93, 91, 51, 93,  0,117,110,112,114,111,106,101, 99,116,101,100, 95,114, 97,100,105,117,115,  0, 42,118,
+112, 97,105,110,116,  0, 42,119,112, 97,105,110,116,  0, 42,117,118,115, 99,117,108,112,116,  0,118,103,114,111,117,112, 95,119,
+101,105,103,104,116,  0, 99,111,114,110,101,114,116,121,112,101,  0,106,111,105,110,116,114,105,108,105,109,105,116,  0,100,101,
+103,114,  0,116,117,114,110,  0,101,120,116,114, 95,111,102,102,115,  0,100,111,117, 98,108,105,109,105,116,  0,110,111,114,109,
+ 97,108,115,105,122,101,  0, 97,117,116,111,109,101,114,103,101,  0,115,101,103,109,101,110,116,115,  0,114,105,110,103,115,  0,
+118,101,114,116,105, 99,101,115,  0,117,110,119,114, 97,112,112,101,114,  0,117,118, 99, 97,108, 99, 95,114, 97,100,105,117,115,
+  0,117,118, 99, 97,108, 99, 95, 99,117, 98,101,115,105,122,101,  0,117,118, 99, 97,108, 99, 95,109, 97,114,103,105,110,  0,117,
+118, 99, 97,108, 99, 95,109, 97,112,100,105,114,  0,117,118, 99, 97,108, 99, 95,109, 97,112, 97,108,105,103,110,  0,117,118, 99,
+ 97,108, 99, 95,102,108, 97,103,  0,117,118, 95,102,108, 97,103,  0,117,118, 95,115,101,108,101, 99,116,109,111,100,101,  0,117,
+118, 95,115,117, 98,115,117,114,102, 95,108,101,118,101,108,  0,103,112,101,110, 99,105,108, 95,102,108, 97,103,115,  0, 97,117,
+116,111,105,107, 95, 99,104, 97,105,110,108,101,110,  0,105,109, 97,112, 97,105,110,116,  0,112, 97,114,116,105, 99,108,101,  0,
+112,114,111,112,111,114,116,105,111,110, 97,108, 95,115,105,122,101,  0,115,101,108,101, 99,116, 95,116,104,114,101,115,104,  0,
+ 99,108,101, 97,110, 95,116,104,114,101,115,104,  0, 97,117,116,111,107,101,121, 95,109,111,100,101,  0, 97,117,116,111,107,101,
+121, 95,102,108, 97,103,  0,109,117,108,116,105,114,101,115, 95,115,117, 98,100,105,118, 95,116,121,112,101,  0,112, 97,100, 50,
+ 91, 53, 93,  0,115,107,103,101,110, 95,114,101,115,111,108,117,116,105,111,110,  0,115,107,103,101,110, 95,116,104,114,101,115,
+104,111,108,100, 95,105,110,116,101,114,110, 97,108,  0,115,107,103,101,110, 95,116,104,114,101,115,104,111,108,100, 95,101,120,
+116,101,114,110, 97,108,  0,115,107,103,101,110, 95,108,101,110,103,116,104, 95,114, 97,116,105,111,  0,115,107,103,101,110, 95,
+108,101,110,103,116,104, 95,108,105,109,105,116,  0,115,107,103,101,110, 95, 97,110,103,108,101, 95,108,105,109,105,116,  0,115,
+107,103,101,110, 95, 99,111,114,114,101,108, 97,116,105,111,110, 95,108,105,109,105,116,  0,115,107,103,101,110, 95,115,121,109,
+109,101,116,114,121, 95,108,105,109,105,116,  0,115,107,103,101,110, 95,114,101,116, 97,114,103,101,116, 95, 97,110,103,108,101,
+ 95,119,101,105,103,104,116,  0,115,107,103,101,110, 95,114,101,116, 97,114,103,101,116, 95,108,101,110,103,116,104, 95,119,101,
+105,103,104,116,  0,115,107,103,101,110, 95,114,101,116, 97,114,103,101,116, 95,100,105,115,116, 97,110, 99,101, 95,119,101,105,
+103,104,116,  0,115,107,103,101,110, 95,111,112,116,105,111,110,115,  0,115,107,103,101,110, 95,112,111,115,116,112,114,111,  0,
+115,107,103,101,110, 95,112,111,115,116,112,114,111, 95,112, 97,115,115,101,115,  0,115,107,103,101,110, 95,115,117, 98,100,105,
+118,105,115,105,111,110,115, 91, 51, 93,  0,115,107,103,101,110, 95,109,117,108,116,105, 95,108,101,118,101,108,  0, 42,115,107,
+103,101,110, 95,116,101,109,112,108, 97,116,101,  0, 98,111,110,101, 95,115,107,101,116, 99,104,105,110,103,  0, 98,111,110,101,
+ 95,115,107,101,116, 99,104,105,110,103, 95, 99,111,110,118,101,114,116,  0,115,107,103,101,110, 95,115,117, 98,100,105,118,105,
+115,105,111,110, 95,110,117,109, 98,101,114,  0,115,107,103,101,110, 95,114,101,116, 97,114,103,101,116, 95,111,112,116,105,111,
+110,115,  0,115,107,103,101,110, 95,114,101,116, 97,114,103,101,116, 95,114,111,108,108,  0,115,107,103,101,110, 95,115,105,100,
+101, 95,115,116,114,105,110,103, 91, 56, 93,  0,115,107,103,101,110, 95,110,117,109, 95,115,116,114,105,110,103, 91, 56, 93,  0,
+101,100,103,101, 95,109,111,100,101,  0,101,100,103,101, 95,109,111,100,101, 95,108,105,118,101, 95,117,110,119,114, 97,112,  0,
+115,110, 97,112, 95,109,111,100,101,  0,115,110, 97,112, 95,102,108, 97,103,  0,115,110, 97,112, 95,116, 97,114,103,101,116,  0,
+112,114,111,112,111,114,116,105,111,110, 97,108,  0,112,114,111,112, 95,109,111,100,101,  0,112,114,111,112,111,114,116,105,111,
+110, 97,108, 95,111, 98,106,101, 99,116,115,  0,112, 97,100, 91, 53, 93,  0, 97,117,116,111, 95,110,111,114,109, 97,108,105,122,
+101,  0,109,117,108,116,105,112, 97,105,110,116,  0,117,115,101, 95,117,118, 95,115, 99,117,108,112,116,  0,117,118, 95,115, 99,
+117,108,112,116, 95,115,101,116,116,105,110,103,115,  0,117,118, 95,115, 99,117,108,112,116, 95,116,111,111,108,  0,117,118, 95,
+114,101,108, 97,120, 95,109,101,116,104,111,100,  0,115, 99,117,108,112,116, 95,112, 97,105,110,116, 95,115,101,116,116,105,110,
+103,115,  0,115, 99,117,108,112,116, 95,112, 97,105,110,116, 95,117,110,105,102,105,101,100, 95,115,105,122,101,  0,115, 99,117,
+108,112,116, 95,112, 97,105,110,116, 95,117,110,105,102,105,101,100, 95,117,110,112,114,111,106,101, 99,116,101,100, 95,114, 97,
+100,105,117,115,  0,115, 99,117,108,112,116, 95,112, 97,105,110,116, 95,117,110,105,102,105,101,100, 95, 97,108,112,104, 97,  0,
+117,110,105,102,105,101,100, 95,112, 97,105,110,116, 95,115,101,116,116,105,110,103,115,  0,116,111,116,111, 98,106,  0,116,111,
+116,108, 97,109,112,  0,116,111,116,111, 98,106,115,101,108,  0,116,111,116, 99,117,114,118,101,  0,116,111,116,109,101,115,104,
+  0,116,111,116, 97,114,109, 97,116,117,114,101,  0,115, 99, 97,108,101, 95,108,101,110,103,116,104,  0,115,121,115,116,101,109,
+  0,115,121,115,116,101,109, 95,114,111,116, 97,116,105,111,110,  0,103,114, 97,118,105,116,121, 91, 51, 93,  0,113,117,105, 99,
+107, 95, 99, 97, 99,104,101, 95,115,116,101,112,  0, 42,119,111,114,108,100,  0, 42,115,101,116,  0, 98, 97,115,101,  0, 42, 98,
+ 97,115, 97, 99,116,  0, 42,111, 98,101,100,105,116,  0, 99,117,114,115,111,114, 91, 51, 93,  0,116,119, 99,101,110,116, 91, 51,
+ 93,  0,116,119,109,105,110, 91, 51, 93,  0,116,119,109, 97,120, 91, 51, 93,  0,108, 97,121, 97, 99,116,  0,108, 97,121, 95,117,
+112,100, 97,116,101,100,  0, 42,101,100,  0, 42,116,111,111,108,115,101,116,116,105,110,103,115,  0, 42,115,116, 97,116,115,  0,
+ 97,117,100,105,111,  0,116,114, 97,110,115,102,111,114,109, 95,115,112, 97, 99,101,115,  0, 42,115,111,117,110,100, 95,115, 99,
+101,110,101,  0, 42,115,111,117,110,100, 95,115, 99,101,110,101, 95,104, 97,110,100,108,101,  0, 42,115,111,117,110,100, 95,115,
+ 99,114,117, 98, 95,104, 97,110,100,108,101,  0, 42,115,112,101, 97,107,101,114, 95,104, 97,110,100,108,101,115,  0, 42,102,112,
+115, 95,105,110,102,111,  0, 42,116,104,101, 68, 97,103,  0,100, 97,103,105,115,118, 97,108,105,100,  0,100, 97,103,102,108, 97,
+103,115,  0, 97, 99,116,105,118,101, 95,107,101,121,105,110,103,115,101,116,  0,107,101,121,105,110,103,115,101,116,115,  0,103,
+109,  0,117,110,105,116,  0,112,104,121,115,105, 99,115, 95,115,101,116,116,105,110,103,115,  0, 42, 99,108,105,112,  0, 99,117,
+115,116,111,109,100, 97,116, 97, 95,109, 97,115,107, 95,109,111,100, 97,108,  0, 99,117,115,101,114,  0, 98,108,101,110,100,  0,
+118,105,101,119,  0,119,105,110,109, 97,116, 91, 52, 93, 91, 52, 93,  0,118,105,101,119,109, 97,116, 91, 52, 93, 91, 52, 93,  0,
+118,105,101,119,105,110,118, 91, 52, 93, 91, 52, 93,  0,112,101,114,115,109, 97,116, 91, 52, 93, 91, 52, 93,  0,112,101,114,115,
+105,110,118, 91, 52, 93, 91, 52, 93,  0,118,105,101,119,109, 97,116,111, 98, 91, 52, 93, 91, 52, 93,  0,112,101,114,115,109, 97,
+116,111, 98, 91, 52, 93, 91, 52, 93,  0, 99,108,105,112, 91, 54, 93, 91, 52, 93,  0, 99,108,105,112, 95,108,111, 99, 97,108, 91,
+ 54, 93, 91, 52, 93,  0, 42, 99,108,105,112, 98, 98,  0, 42,108,111, 99, 97,108,118,100,  0, 42,114,105,  0, 42,114,101,110,100,
+101,114, 95,101,110,103,105,110,101,  0, 42,100,101,112,116,104,115,  0, 42,115,109,115,  0, 42,115,109,111,111,116,104, 95,116,
+105,109,101,114,  0,116,119,109, 97,116, 91, 52, 93, 91, 52, 93,  0,118,105,101,119,113,117, 97,116, 91, 52, 93,  0,122,102, 97,
+ 99,  0, 99, 97,109,100,120,  0, 99, 97,109,100,121,  0,112,105,120,115,105,122,101,  0, 99, 97,109,122,111,111,109,  0,105,115,
+ 95,112,101,114,115,112,  0,112,101,114,115,112,  0,118,105,101,119,108,111, 99,107,  0,116,119,100,114, 97,119,102,108, 97,103,
+  0,114,102,108, 97,103,  0,108,118,105,101,119,113,117, 97,116, 91, 52, 93,  0,108,112,101,114,115,112,  0,108,118,105,101,119,
+  0,103,114,105,100,118,105,101,119,  0,116,119, 97,110,103,108,101, 91, 51, 93,  0,114,111,116, 95, 97,110,103,108,101,  0,114,
+111,116, 95, 97,120,105,115, 91, 51, 93,  0,114,101,103,105,111,110, 98, 97,115,101,  0,115,112, 97, 99,101,116,121,112,101,  0,
+ 98,108,111, 99,107,115, 99, 97,108,101,  0, 98,108,111, 99,107,104, 97,110,100,108,101,114, 91, 56, 93,  0, 98,117,110,100,108,
+101, 95,115,105,122,101,  0, 98,117,110,100,108,101, 95,100,114, 97,119,116,121,112,101,  0,108, 97,121, 95,117,115,101,100,  0,
+ 42,111, 98, 95, 99,101,110,116,114,101,  0, 98,103,112,105, 99, 98, 97,115,101,  0, 42, 98,103,112,105, 99,  0,111, 98, 95, 99,
+101,110,116,114,101, 95, 98,111,110,101, 91, 54, 52, 93,  0,100,114, 97,119,116,121,112,101,  0,111, 98, 95, 99,101,110,116,114,
+101, 95, 99,117,114,115,111,114,  0,115, 99,101,110,101,108,111, 99,107,  0, 97,114,111,117,110,100,  0,103,114,105,100,  0,110,
+101, 97,114,  0,102, 97,114,  0,109,111,100,101,115,101,108,101, 99,116,  0,103,114,105,100,108,105,110,101,115,  0,103,114,105,
+100,115,117, 98,100,105,118,  0,103,114,105,100,102,108, 97,103,  0,116,119,116,121,112,101,  0,116,119,109,111,100,101,  0,116,
+119,102,108, 97,103,  0,112, 97,100, 50, 91, 50, 93,  0, 97,102,116,101,114,100,114, 97,119, 95,116,114, 97,110,115,112,  0, 97,
+102,116,101,114,100,114, 97,119, 95,120,114, 97,121,  0, 97,102,116,101,114,100,114, 97,119, 95,120,114, 97,121,116,114, 97,110,
+115,112,  0,122, 98,117,102,  0,120,114, 97,121,  0,112, 97,100, 51, 91, 50, 93,  0, 42,112,114,111,112,101,114,116,105,101,115,
+ 95,115,116,111,114, 97,103,101,  0,118,101,114,116,  0,104,111,114,  0,109, 97,115,107,  0,109,105,110, 91, 50, 93,  0,109, 97,
+120, 91, 50, 93,  0,109,105,110,122,111,111,109,  0,109, 97,120,122,111,111,109,  0,115, 99,114,111,108,108,  0,115, 99,114,111,
+108,108, 95,117,105,  0,107,101,101,112,116,111,116,  0,107,101,101,112,122,111,111,109,  0,107,101,101,112,111,102,115,  0, 97,
+108,105,103,110,  0,119,105,110,120,  0,119,105,110,121,  0,111,108,100,119,105,110,120,  0,111,108,100,119,105,110,121,  0, 42,
+116, 97, 98, 95,111,102,102,115,101,116,  0,116, 97, 98, 95,110,117,109,  0,116, 97, 98, 95, 99,117,114,  0,114,112,116, 95,109,
+ 97,115,107,  0,118, 50,100,  0, 42, 97,100,115,  0,103,104,111,115,116, 67,117,114,118,101,115,  0, 97,117,116,111,115,110, 97,
+112,  0, 99,117,114,115,111,114, 86, 97,108,  0,109, 97,105,110, 98,  0,109, 97,105,110, 98,111,  0,109, 97,105,110, 98,117,115,
+101,114,  0,114,101, 95, 97,108,105,103,110,  0,112,114,101,118,105,101,119,  0,116,101,120,116,117,114,101, 95, 99,111,110,116,
+101,120,116,  0,112, 97,116,104,102,108, 97,103,  0,100, 97,116, 97,105, 99,111,110,  0, 42,112,105,110,105,100,  0, 42,116,101,
+120,117,115,101,114,  0,114,101,110,100,101,114, 95,115,105,122,101,  0, 99,104, 97,110,115,104,111,119,110,  0,122,101, 98,114,
+ 97,  0,122,111,111,109,  0,116,105,116,108,101, 91, 51, 50, 93,  0,100,105,114, 91, 49, 48, 53, 54, 93,  0,102,105,108,101, 91,
+ 50, 53, 54, 93,  0,114,101,110, 97,109,101,102,105,108,101, 91, 50, 53, 54, 93,  0,114,101,110, 97,109,101,101,100,105,116, 91,
+ 50, 53, 54, 93,  0,102,105,108,116,101,114, 95,103,108,111, 98, 91, 54, 52, 93,  0, 97, 99,116,105,118,101, 95,102,105,108,101,
+  0,115,101,108, 95,102,105,114,115,116,  0,115,101,108, 95,108, 97,115,116,  0,115,111,114,116,  0,100,105,115,112,108, 97,121,
+  0,102, 95,102,112,  0,102,112, 95,115,116,114, 91, 56, 93,  0,115, 99,114,111,108,108, 95,111,102,102,115,101,116,  0, 42,112,
+ 97,114, 97,109,115,  0, 42,102,105,108,101,115,  0, 42,102,111,108,100,101,114,115, 95,112,114,101,118,  0, 42,102,111,108,100,
+101,114,115, 95,110,101,120,116,  0, 42,111,112,  0, 42,115,109,111,111,116,104,115, 99,114,111,108,108, 95,116,105,109,101,114,
+  0, 42,108, 97,121,111,117,116,  0,114,101, 99,101,110,116,110,114,  0, 98,111,111,107,109, 97,114,107,110,114,  0,115,121,115,
+116,101,109,110,114,  0,116,114,101,101,  0, 42,116,114,101,101,115,116,111,114,101,  0,115,101, 97,114, 99,104, 95,115,116,114,
+105,110,103, 91, 51, 50, 93,  0,115,101, 97,114, 99,104, 95,116,115,101,  0,111,117,116,108,105,110,101,118,105,115,  0,115,116,
+111,114,101,102,108, 97,103,  0,115,101, 97,114, 99,104, 95,102,108, 97,103,115,  0, 42, 99,117,109, 97,112,  0,115, 99,111,112,
+101,115,  0,115, 97,109,112,108,101, 95,108,105,110,101, 95,104,105,115,116,  0, 99,117,114,115,111,114, 91, 50, 93,  0, 99,101,
+110,116,120,  0, 99,101,110,116,121,  0, 99,117,114,116,105,108,101,  0,108,111, 99,107,  0,112,105,110,  0,100,116, 95,117,118,
+  0,115,116,105, 99,107,121,  0,100,116, 95,117,118,115,116,114,101,116, 99,104,  0, 42,116,101,120,116,  0,116,111,112,  0,118,
+105,101,119,108,105,110,101,115,  0,109,101,110,117,110,114,  0,108,104,101,105,103,104,116,  0, 99,119,105,100,116,104,  0,108,
+105,110,101,110,114,115, 95,116,111,116,  0,108,101,102,116,  0,115,104,111,119,108,105,110,101,110,114,115,  0,116, 97, 98,110,
+117,109, 98,101,114,  0,115,104,111,119,115,121,110,116, 97,120,  0,108,105,110,101, 95,104,108,105,103,104,116,  0,111,118,101,
+114,119,114,105,116,101,  0,108,105,118,101, 95,101,100,105,116,  0,112,105,120, 95,112,101,114, 95,108,105,110,101,  0,116,120,
+116,115, 99,114,111,108,108,  0,116,120,116, 98, 97,114,  0,119,111,114,100,119,114, 97,112,  0,100,111,112,108,117,103,105,110,
+115,  0,102,105,110,100,115,116,114, 91, 50, 53, 54, 93,  0,114,101,112,108, 97, 99,101,115,116,114, 91, 50, 53, 54, 93,  0,109,
+ 97,114,103,105,110, 95, 99,111,108,117,109,110,  0, 42,100,114, 97,119, 99, 97, 99,104,101,  0, 42,112,121, 95,100,114, 97,119,
+  0, 42,112,121, 95,101,118,101,110,116,  0, 42,112,121, 95, 98,117,116,116,111,110,  0, 42,112,121, 95, 98,114,111,119,115,101,
+114, 99, 97,108,108, 98, 97, 99,107,  0, 42,112,121, 95,103,108,111, 98, 97,108,100,105, 99,116,  0,108, 97,115,116,115,112, 97,
+ 99,101,  0,115, 99,114,105,112,116,110, 97,109,101, 91, 49, 48, 50, 52, 93,  0,115, 99,114,105,112,116, 97,114,103, 91, 50, 53,
+ 54, 93,  0, 42,115, 99,114,105,112,116,  0, 42, 98,117,116, 95,114,101,102,115,  0, 42, 97,114,114, 97,121,  0, 99, 97, 99,104,
+101,115,  0, 99, 97, 99,104,101, 95,100,105,115,112,108, 97,121,  0, 42,105,100,  0, 97,115,112,101, 99,116,  0,112, 97,100,102,
+  0,109,120,  0,109,121,  0, 42,101,100,105,116,116,114,101,101,  0,116,114,101,101,116,121,112,101,  0,116,101,120,102,114,111,
+109,  0,115,104, 97,100,101,114,102,114,111,109,  0,108,105,110,107,100,114, 97,103,  0,108,101,110, 95, 97,108,108,111, 99,  0,
  99,117,114,115,111,114,  0,115, 99,114,111,108,108, 98, 97, 99,107,  0,104,105,115,116,111,114,121,  0,112,114,111,109,112,116,
  91, 50, 53, 54, 93,  0,108, 97,110,103,117, 97,103,101, 91, 51, 50, 93,  0,115,101,108, 95,115,116, 97,114,116,  0,115,101,108,
- 95,101,110,100,  0,102,105,108,116,101,114, 91, 54, 52, 93,  0, 42, 97,114,101, 97,  0, 42,115,111,117,110,100,  0,115,110,100,
-110,114,  0,102,105,108,101,110, 97,109,101, 91, 50, 53, 54, 93,  0, 98,108,102, 95,105,100,  0,117,105,102,111,110,116, 95,105,
-100,  0,114, 95,116,111, 95,108,  0,112,111,105,110,116,115,  0,107,101,114,110,105,110,103,  0,105,116, 97,108,105, 99,  0, 98,
-111,108,100,  0,115,104, 97,100,111,119,  0,115,104, 97,100,120,  0,115,104, 97,100,121,  0,115,104, 97,100,111,119, 97,108,112,
-104, 97,  0,115,104, 97,100,111,119, 99,111,108,111,114,  0,112, 97,110,101,108,116,105,116,108,101,  0,103,114,111,117,112,108,
- 97, 98,101,108,  0,119,105,100,103,101,116,108, 97, 98,101,108,  0,119,105,100,103,101,116,  0,112, 97,110,101,108,122,111,111,
-109,  0,109,105,110,108, 97, 98,101,108, 99,104, 97,114,115,  0,109,105,110,119,105,100,103,101,116, 99,104, 97,114,115,  0, 99,
-111,108,117,109,110,115,112, 97, 99,101,  0,116,101,109,112,108, 97,116,101,115,112, 97, 99,101,  0, 98,111,120,115,112, 97, 99,
-101,  0, 98,117,116,116,111,110,115,112, 97, 99,101,120,  0, 98,117,116,116,111,110,115,112, 97, 99,101,121,  0,112, 97,110,101,
-108,115,112, 97, 99,101,  0,112, 97,110,101,108,111,117,116,101,114,  0,112, 97,100, 91, 49, 93,  0,111,117,116,108,105,110,101,
- 91, 52, 93,  0,105,110,110,101,114, 91, 52, 93,  0,105,110,110,101,114, 95,115,101,108, 91, 52, 93,  0,105,116,101,109, 91, 52,
- 93,  0,116,101,120,116, 91, 52, 93,  0,116,101,120,116, 95,115,101,108, 91, 52, 93,  0,115,104, 97,100,101,100,  0,115,104, 97,
-100,101,116,111,112,  0,115,104, 97,100,101,100,111,119,110,  0, 97,108,112,104, 97, 95, 99,104,101, 99,107,  0,105,110,110,101,
-114, 95, 97,110,105,109, 91, 52, 93,  0,105,110,110,101,114, 95, 97,110,105,109, 95,115,101,108, 91, 52, 93,  0,105,110,110,101,
-114, 95,107,101,121, 91, 52, 93,  0,105,110,110,101,114, 95,107,101,121, 95,115,101,108, 91, 52, 93,  0,105,110,110,101,114, 95,
-100,114,105,118,101,110, 91, 52, 93,  0,105,110,110,101,114, 95,100,114,105,118,101,110, 95,115,101,108, 91, 52, 93,  0,119, 99,
-111,108, 95,114,101,103,117,108, 97,114,  0,119, 99,111,108, 95,116,111,111,108,  0,119, 99,111,108, 95,116,101,120,116,  0,119,
- 99,111,108, 95,114, 97,100,105,111,  0,119, 99,111,108, 95,111,112,116,105,111,110,  0,119, 99,111,108, 95,116,111,103,103,108,
-101,  0,119, 99,111,108, 95,110,117,109,  0,119, 99,111,108, 95,110,117,109,115,108,105,100,101,114,  0,119, 99,111,108, 95,109,
-101,110,117,  0,119, 99,111,108, 95,112,117,108,108,100,111,119,110,  0,119, 99,111,108, 95,109,101,110,117, 95, 98, 97, 99,107,
-  0,119, 99,111,108, 95,109,101,110,117, 95,105,116,101,109,  0,119, 99,111,108, 95, 98,111,120,  0,119, 99,111,108, 95,115, 99,
-114,111,108,108,  0,119, 99,111,108, 95,112,114,111,103,114,101,115,115,  0,119, 99,111,108, 95,108,105,115,116, 95,105,116,101,
-109,  0,119, 99,111,108, 95,115,116, 97,116,101,  0,105, 99,111,110,102,105,108,101, 91, 56, 48, 93,  0, 98, 97, 99,107, 91, 52,
- 93,  0,116,105,116,108,101, 91, 52, 93,  0,116,101,120,116, 95,104,105, 91, 52, 93,  0,104,101, 97,100,101,114, 91, 52, 93,  0,
-104,101, 97,100,101,114, 95,116,105,116,108,101, 91, 52, 93,  0,104,101, 97,100,101,114, 95,116,101,120,116, 91, 52, 93,  0,104,
-101, 97,100,101,114, 95,116,101,120,116, 95,104,105, 91, 52, 93,  0, 98,117,116,116,111,110, 91, 52, 93,  0, 98,117,116,116,111,
-110, 95,116,105,116,108,101, 91, 52, 93,  0, 98,117,116,116,111,110, 95,116,101,120,116, 91, 52, 93,  0, 98,117,116,116,111,110,
- 95,116,101,120,116, 95,104,105, 91, 52, 93,  0,108,105,115,116, 91, 52, 93,  0,108,105,115,116, 95,116,105,116,108,101, 91, 52,
- 93,  0,108,105,115,116, 95,116,101,120,116, 91, 52, 93,  0,108,105,115,116, 95,116,101,120,116, 95,104,105, 91, 52, 93,  0,112,
- 97,110,101,108, 91, 52, 93,  0,112, 97,110,101,108, 95,116,105,116,108,101, 91, 52, 93,  0,112, 97,110,101,108, 95,116,101,120,
-116, 91, 52, 93,  0,112, 97,110,101,108, 95,116,101,120,116, 95,104,105, 91, 52, 93,  0,115,104, 97,100,101, 49, 91, 52, 93,  0,
-115,104, 97,100,101, 50, 91, 52, 93,  0,104,105,108,105,116,101, 91, 52, 93,  0,103,114,105,100, 91, 52, 93,  0,119,105,114,101,
- 91, 52, 93,  0,115,101,108,101, 99,116, 91, 52, 93,  0,108, 97,109,112, 91, 52, 93,  0, 97, 99,116,105,118,101, 91, 52, 93,  0,
-103,114,111,117,112, 91, 52, 93,  0,103,114,111,117,112, 95, 97, 99,116,105,118,101, 91, 52, 93,  0,116,114, 97,110,115,102,111,
-114,109, 91, 52, 93,  0,118,101,114,116,101,120, 91, 52, 93,  0,118,101,114,116,101,120, 95,115,101,108,101, 99,116, 91, 52, 93,
-  0,101,100,103,101, 91, 52, 93,  0,101,100,103,101, 95,115,101,108,101, 99,116, 91, 52, 93,  0,101,100,103,101, 95,115,101, 97,
-109, 91, 52, 93,  0,101,100,103,101, 95,115,104, 97,114,112, 91, 52, 93,  0,101,100,103,101, 95,102, 97, 99,101,115,101,108, 91,
- 52, 93,  0,101,100,103,101, 95, 99,114,101, 97,115,101, 91, 52, 93,  0,102, 97, 99,101, 91, 52, 93,  0,102, 97, 99,101, 95,115,
-101,108,101, 99,116, 91, 52, 93,  0,102, 97, 99,101, 95,100,111,116, 91, 52, 93,  0,101,120,116,114, 97, 95,101,100,103,101, 95,
-108,101,110, 91, 52, 93,  0,101,120,116,114, 97, 95,102, 97, 99,101, 95, 97,110,103,108,101, 91, 52, 93,  0,101,120,116,114, 97,
- 95,102, 97, 99,101, 95, 97,114,101, 97, 91, 52, 93,  0,112, 97,100, 51, 91, 52, 93,  0,110,111,114,109, 97,108, 91, 52, 93,  0,
-118,101,114,116,101,120, 95,110,111,114,109, 97,108, 91, 52, 93,  0, 98,111,110,101, 95,115,111,108,105,100, 91, 52, 93,  0, 98,
-111,110,101, 95,112,111,115,101, 91, 52, 93,  0,115,116,114,105,112, 91, 52, 93,  0,115,116,114,105,112, 95,115,101,108,101, 99,
-116, 91, 52, 93,  0, 99,102,114, 97,109,101, 91, 52, 93,  0,110,117,114, 98, 95,117,108,105,110,101, 91, 52, 93,  0,110,117,114,
- 98, 95,118,108,105,110,101, 91, 52, 93,  0, 97, 99,116, 95,115,112,108,105,110,101, 91, 52, 93,  0,110,117,114, 98, 95,115,101,
-108, 95,117,108,105,110,101, 91, 52, 93,  0,110,117,114, 98, 95,115,101,108, 95,118,108,105,110,101, 91, 52, 93,  0,108, 97,115,
-116,115,101,108, 95,112,111,105,110,116, 91, 52, 93,  0,104, 97,110,100,108,101, 95,102,114,101,101, 91, 52, 93,  0,104, 97,110,
-100,108,101, 95, 97,117,116,111, 91, 52, 93,  0,104, 97,110,100,108,101, 95,118,101, 99,116, 91, 52, 93,  0,104, 97,110,100,108,
-101, 95, 97,108,105,103,110, 91, 52, 93,  0,104, 97,110,100,108,101, 95,115,101,108, 95,102,114,101,101, 91, 52, 93,  0,104, 97,
-110,100,108,101, 95,115,101,108, 95, 97,117,116,111, 91, 52, 93,  0,104, 97,110,100,108,101, 95,115,101,108, 95,118,101, 99,116,
- 91, 52, 93,  0,104, 97,110,100,108,101, 95,115,101,108, 95, 97,108,105,103,110, 91, 52, 93,  0,100,115, 95, 99,104, 97,110,110,
-101,108, 91, 52, 93,  0,100,115, 95,115,117, 98, 99,104, 97,110,110,101,108, 91, 52, 93,  0, 99,111,110,115,111,108,101, 95,111,
-117,116,112,117,116, 91, 52, 93,  0, 99,111,110,115,111,108,101, 95,105,110,112,117,116, 91, 52, 93,  0, 99,111,110,115,111,108,
-101, 95,105,110,102,111, 91, 52, 93,  0, 99,111,110,115,111,108,101, 95,101,114,114,111,114, 91, 52, 93,  0, 99,111,110,115,111,
-108,101, 95, 99,117,114,115,111,114, 91, 52, 93,  0,118,101,114,116,101,120, 95,115,105,122,101,  0,111,117,116,108,105,110,101,
- 95,119,105,100,116,104,  0,102, 97, 99,101,100,111,116, 95,115,105,122,101,  0, 98,112, 97,100,  0,115,121,110,116, 97,120,108,
- 91, 52, 93,  0,115,121,110,116, 97,120,110, 91, 52, 93,  0,115,121,110,116, 97,120, 98, 91, 52, 93,  0,115,121,110,116, 97,120,
-118, 91, 52, 93,  0,115,121,110,116, 97,120, 99, 91, 52, 93,  0,109,111,118,105,101, 91, 52, 93,  0,105,109, 97,103,101, 91, 52,
- 93,  0,115, 99,101,110,101, 91, 52, 93,  0, 97,117,100,105,111, 91, 52, 93,  0,101,102,102,101, 99,116, 91, 52, 93,  0,112,108,
-117,103,105,110, 91, 52, 93,  0,116,114, 97,110,115,105,116,105,111,110, 91, 52, 93,  0,109,101,116, 97, 91, 52, 93,  0,101,100,
-105,116,109,101,115,104, 95, 97, 99,116,105,118,101, 91, 52, 93,  0,104, 97,110,100,108,101, 95,118,101,114,116,101,120, 91, 52,
- 93,  0,104, 97,110,100,108,101, 95,118,101,114,116,101,120, 95,115,101,108,101, 99,116, 91, 52, 93,  0,104, 97,110,100,108,101,
- 95,118,101,114,116,101,120, 95,115,105,122,101,  0,104,112, 97,100, 91, 55, 93,  0,112,114,101,118,105,101,119, 95, 98, 97, 99,
-107, 91, 52, 93,  0,115,111,108,105,100, 91, 52, 93,  0,116,117,105,  0,116, 98,117,116,115,  0,116,118, 51,100,  0,116,102,105,
-108,101,  0,116,105,112,111,  0,116,105,110,102,111,  0,116,115,110,100,  0,116, 97, 99,116,  0,116,110,108, 97,  0,116,115,101,
-113,  0,116,105,109, 97,  0,116,105,109, 97,115,101,108,  0,116,101,120,116,  0,116,111,111,112,115,  0,116,116,105,109,101,  0,
-116,110,111,100,101,  0,116,108,111,103,105, 99,  0,116,117,115,101,114,112,114,101,102,  0,116, 99,111,110,115,111,108,101,  0,
-116, 97,114,109, 91, 50, 48, 93,  0, 97, 99,116,105,118,101, 95,116,104,101,109,101, 95, 97,114,101, 97,  0,109,111,100,117,108,
-101, 91, 54, 52, 93,  0,115,112,101, 99, 91, 52, 93,  0,100,117,112,102,108, 97,103,  0,115, 97,118,101,116,105,109,101,  0,116,
-101,109,112,100,105,114, 91, 49, 54, 48, 93,  0,102,111,110,116,100,105,114, 91, 49, 54, 48, 93,  0,114,101,110,100,101,114,100,
-105,114, 91, 50, 52, 48, 93,  0,116,101,120,116,117,100,105,114, 91, 49, 54, 48, 93,  0,112,108,117,103,116,101,120,100,105,114,
- 91, 49, 54, 48, 93,  0,112,108,117,103,115,101,113,100,105,114, 91, 49, 54, 48, 93,  0,112,121,116,104,111,110,100,105,114, 91,
- 49, 54, 48, 93,  0,115,111,117,110,100,100,105,114, 91, 49, 54, 48, 93,  0,105,109, 97,103,101, 95,101,100,105,116,111,114, 91,
- 50, 52, 48, 93,  0, 97,110,105,109, 95,112,108, 97,121,101,114, 91, 50, 52, 48, 93,  0, 97,110,105,109, 95,112,108, 97,121,101,
-114, 95,112,114,101,115,101,116,  0,118, 50,100, 95,109,105,110, 95,103,114,105,100,115,105,122,101,  0,116,105,109,101, 99,111,
-100,101, 95,115,116,121,108,101,  0,118,101,114,115,105,111,110,115,  0,100, 98,108, 95, 99,108,105, 99,107, 95,116,105,109,101,
-  0,103, 97,109,101,102,108, 97,103,115,  0,119,104,101,101,108,108,105,110,101,115, 99,114,111,108,108,  0,117,105,102,108, 97,
-103,  0,108, 97,110,103,117, 97,103,101,  0,117,115,101,114,112,114,101,102,  0,118,105,101,119,122,111,111,109,  0,109,105,120,
- 98,117,102,115,105,122,101,  0, 97,117,100,105,111,100,101,118,105, 99,101,  0, 97,117,100,105,111,114, 97,116,101,  0, 97,117,
-100,105,111,102,111,114,109, 97,116,  0, 97,117,100,105,111, 99,104, 97,110,110,101,108,115,  0,100,112,105,  0,101,110, 99,111,
-100,105,110,103,  0,116,114, 97,110,115,111,112,116,115,  0,109,101,110,117,116,104,114,101,115,104,111,108,100, 49,  0,109,101,
-110,117,116,104,114,101,115,104,111,108,100, 50,  0,116,104,101,109,101,115,  0,117,105,102,111,110,116,115,  0,117,105,115,116,
-121,108,101,115,  0,107,101,121,109, 97,112,115,  0, 97,100,100,111,110,115,  0,107,101,121, 99,111,110,102,105,103,115,116,114,
- 91, 54, 52, 93,  0,117,110,100,111,115,116,101,112,115,  0,117,110,100,111,109,101,109,111,114,121,  0,103,112, 95,109, 97,110,
-104, 97,116,116,101,110,100,105,115,116,  0,103,112, 95,101,117, 99,108,105,100,101, 97,110,100,105,115,116,  0,103,112, 95,101,
-114, 97,115,101,114,  0,103,112, 95,115,101,116,116,105,110,103,115,  0,116, 98, 95,108,101,102,116,109,111,117,115,101,  0,116,
- 98, 95,114,105,103,104,116,109,111,117,115,101,  0,108,105,103,104,116, 91, 51, 93,  0,116,119, 95,104,111,116,115,112,111,116,
-  0,116,119, 95,102,108, 97,103,  0,116,119, 95,104, 97,110,100,108,101,115,105,122,101,  0,116,119, 95,115,105,122,101,  0,116,
-101,120,116,105,109,101,111,117,116,  0,116,101,120, 99,111,108,108,101, 99,116,114, 97,116,101,  0,119,109,100,114, 97,119,109,
-101,116,104,111,100,  0,100,114, 97,103,116,104,114,101,115,104,111,108,100,  0,109,101,109, 99, 97, 99,104,101,108,105,109,105,
-116,  0,112,114,101,102,101,116, 99,104,102,114, 97,109,101,115,  0,102,114, 97,109,101,115,101,114,118,101,114,112,111,114,116,
-  0,112, 97,100, 95,114,111,116, 95, 97,110,103,108,101,  0,111, 98, 99,101,110,116,101,114, 95,100,105, 97,  0,114,118,105,115,
-105,122,101,  0,114,118,105, 98,114,105,103,104,116,  0,114,101, 99,101,110,116, 95,102,105,108,101,115,  0,115,109,111,111,116,
-104, 95,118,105,101,119,116,120,  0,103,108,114,101,115,108,105,109,105,116,  0,110,100,111,102, 95,112, 97,110,  0,110,100,111,
-102, 95,114,111,116, 97,116,101,  0, 99,117,114,115,115,105,122,101,  0, 99,111,108,111,114, 95,112,105, 99,107,101,114, 95,116,
+ 95,101,110,100,  0,102,105,108,116,101,114, 91, 54, 52, 93,  0,120,108,111, 99,107,111,102,  0,121,108,111, 99,107,111,102,  0,
+117,115,101,114,  0,112, 97,116,104, 95,108,101,110,103,116,104,  0,108,111, 99, 91, 50, 93,  0,115,116, 97, 98,109, 97,116, 91,
+ 52, 93, 91, 52, 93,  0,117,110,105,115,116, 97, 98,109, 97,116, 91, 52, 93, 91, 52, 93,  0,112,111,115,116,112,114,111, 99, 95,
+102,108, 97,103,  0,114,117,110,116,105,109,101, 95,102,108, 97,103,  0,102,105,108,101,110, 97,109,101, 91, 49, 48, 50, 52, 93,
+  0, 98,108,102, 95,105,100,  0,117,105,102,111,110,116, 95,105,100,  0,114, 95,116,111, 95,108,  0,112,111,105,110,116,115,  0,
+107,101,114,110,105,110,103,  0,105,116, 97,108,105, 99,  0, 98,111,108,100,  0,115,104, 97,100,111,119,  0,115,104, 97,100,120,
+  0,115,104, 97,100,121,  0,115,104, 97,100,111,119, 97,108,112,104, 97,  0,115,104, 97,100,111,119, 99,111,108,111,114,  0,112,
+ 97,110,101,108,116,105,116,108,101,  0,103,114,111,117,112,108, 97, 98,101,108,  0,119,105,100,103,101,116,108, 97, 98,101,108,
+  0,119,105,100,103,101,116,  0,112, 97,110,101,108,122,111,111,109,  0,109,105,110,108, 97, 98,101,108, 99,104, 97,114,115,  0,
+109,105,110,119,105,100,103,101,116, 99,104, 97,114,115,  0, 99,111,108,117,109,110,115,112, 97, 99,101,  0,116,101,109,112,108,
+ 97,116,101,115,112, 97, 99,101,  0, 98,111,120,115,112, 97, 99,101,  0, 98,117,116,116,111,110,115,112, 97, 99,101,120,  0, 98,
+117,116,116,111,110,115,112, 97, 99,101,121,  0,112, 97,110,101,108,115,112, 97, 99,101,  0,112, 97,110,101,108,111,117,116,101,
+114,  0,111,117,116,108,105,110,101, 91, 52, 93,  0,105,110,110,101,114, 91, 52, 93,  0,105,110,110,101,114, 95,115,101,108, 91,
+ 52, 93,  0,105,116,101,109, 91, 52, 93,  0,116,101,120,116, 91, 52, 93,  0,116,101,120,116, 95,115,101,108, 91, 52, 93,  0,115,
+104, 97,100,101,100,  0,115,104, 97,100,101,116,111,112,  0,115,104, 97,100,101,100,111,119,110,  0, 97,108,112,104, 97, 95, 99,
+104,101, 99,107,  0,105,110,110,101,114, 95, 97,110,105,109, 91, 52, 93,  0,105,110,110,101,114, 95, 97,110,105,109, 95,115,101,
+108, 91, 52, 93,  0,105,110,110,101,114, 95,107,101,121, 91, 52, 93,  0,105,110,110,101,114, 95,107,101,121, 95,115,101,108, 91,
+ 52, 93,  0,105,110,110,101,114, 95,100,114,105,118,101,110, 91, 52, 93,  0,105,110,110,101,114, 95,100,114,105,118,101,110, 95,
+115,101,108, 91, 52, 93,  0,104,101, 97,100,101,114, 91, 52, 93,  0,115,104,111,119, 95,104,101, 97,100,101,114,  0,119, 99,111,
+108, 95,114,101,103,117,108, 97,114,  0,119, 99,111,108, 95,116,111,111,108,  0,119, 99,111,108, 95,116,101,120,116,  0,119, 99,
+111,108, 95,114, 97,100,105,111,  0,119, 99,111,108, 95,111,112,116,105,111,110,  0,119, 99,111,108, 95,116,111,103,103,108,101,
+  0,119, 99,111,108, 95,110,117,109,  0,119, 99,111,108, 95,110,117,109,115,108,105,100,101,114,  0,119, 99,111,108, 95,109,101,
+110,117,  0,119, 99,111,108, 95,112,117,108,108,100,111,119,110,  0,119, 99,111,108, 95,109,101,110,117, 95, 98, 97, 99,107,  0,
+119, 99,111,108, 95,109,101,110,117, 95,105,116,101,109,  0,119, 99,111,108, 95,116,111,111,108,116,105,112,  0,119, 99,111,108,
+ 95, 98,111,120,  0,119, 99,111,108, 95,115, 99,114,111,108,108,  0,119, 99,111,108, 95,112,114,111,103,114,101,115,115,  0,119,
+ 99,111,108, 95,108,105,115,116, 95,105,116,101,109,  0,119, 99,111,108, 95,115,116, 97,116,101,  0,112, 97,110,101,108,  0,105,
+ 99,111,110,102,105,108,101, 91, 50, 53, 54, 93,  0,105, 99,111,110, 95, 97,108,112,104, 97,  0, 98, 97, 99,107, 91, 52, 93,  0,
+116,105,116,108,101, 91, 52, 93,  0,116,101,120,116, 95,104,105, 91, 52, 93,  0,104,101, 97,100,101,114, 95,116,105,116,108,101,
+ 91, 52, 93,  0,104,101, 97,100,101,114, 95,116,101,120,116, 91, 52, 93,  0,104,101, 97,100,101,114, 95,116,101,120,116, 95,104,
+105, 91, 52, 93,  0, 98,117,116,116,111,110, 91, 52, 93,  0, 98,117,116,116,111,110, 95,116,105,116,108,101, 91, 52, 93,  0, 98,
+117,116,116,111,110, 95,116,101,120,116, 91, 52, 93,  0, 98,117,116,116,111,110, 95,116,101,120,116, 95,104,105, 91, 52, 93,  0,
+108,105,115,116, 91, 52, 93,  0,108,105,115,116, 95,116,105,116,108,101, 91, 52, 93,  0,108,105,115,116, 95,116,101,120,116, 91,
+ 52, 93,  0,108,105,115,116, 95,116,101,120,116, 95,104,105, 91, 52, 93,  0,112, 97,110,101,108, 91, 52, 93,  0,112, 97,110,101,
+108, 95,116,105,116,108,101, 91, 52, 93,  0,112, 97,110,101,108, 95,116,101,120,116, 91, 52, 93,  0,112, 97,110,101,108, 95,116,
+101,120,116, 95,104,105, 91, 52, 93,  0,115,104, 97,100,101, 49, 91, 52, 93,  0,115,104, 97,100,101, 50, 91, 52, 93,  0,104,105,
+108,105,116,101, 91, 52, 93,  0,103,114,105,100, 91, 52, 93,  0,119,105,114,101, 91, 52, 93,  0,115,101,108,101, 99,116, 91, 52,
+ 93,  0,108, 97,109,112, 91, 52, 93,  0,115,112,101, 97,107,101,114, 91, 52, 93,  0,101,109,112,116,121, 91, 52, 93,  0, 99, 97,
+109,101,114, 97, 91, 52, 93,  0,112, 97,100, 91, 56, 93,  0, 97, 99,116,105,118,101, 91, 52, 93,  0,103,114,111,117,112, 91, 52,
+ 93,  0,103,114,111,117,112, 95, 97, 99,116,105,118,101, 91, 52, 93,  0,116,114, 97,110,115,102,111,114,109, 91, 52, 93,  0,118,
+101,114,116,101,120, 91, 52, 93,  0,118,101,114,116,101,120, 95,115,101,108,101, 99,116, 91, 52, 93,  0,101,100,103,101, 91, 52,
+ 93,  0,101,100,103,101, 95,115,101,108,101, 99,116, 91, 52, 93,  0,101,100,103,101, 95,115,101, 97,109, 91, 52, 93,  0,101,100,
+103,101, 95,115,104, 97,114,112, 91, 52, 93,  0,101,100,103,101, 95,102, 97, 99,101,115,101,108, 91, 52, 93,  0,101,100,103,101,
+ 95, 99,114,101, 97,115,101, 91, 52, 93,  0,102, 97, 99,101, 91, 52, 93,  0,102, 97, 99,101, 95,115,101,108,101, 99,116, 91, 52,
+ 93,  0,102, 97, 99,101, 95,100,111,116, 91, 52, 93,  0,101,120,116,114, 97, 95,101,100,103,101, 95,108,101,110, 91, 52, 93,  0,
+101,120,116,114, 97, 95,102, 97, 99,101, 95, 97,110,103,108,101, 91, 52, 93,  0,101,120,116,114, 97, 95,102, 97, 99,101, 95, 97,
+114,101, 97, 91, 52, 93,  0,112, 97,100, 51, 91, 52, 93,  0,110,111,114,109, 97,108, 91, 52, 93,  0,118,101,114,116,101,120, 95,
+110,111,114,109, 97,108, 91, 52, 93,  0, 98,111,110,101, 95,115,111,108,105,100, 91, 52, 93,  0, 98,111,110,101, 95,112,111,115,
+101, 91, 52, 93,  0,115,116,114,105,112, 91, 52, 93,  0,115,116,114,105,112, 95,115,101,108,101, 99,116, 91, 52, 93,  0, 99,102,
+114, 97,109,101, 91, 52, 93,  0,110,117,114, 98, 95,117,108,105,110,101, 91, 52, 93,  0,110,117,114, 98, 95,118,108,105,110,101,
+ 91, 52, 93,  0, 97, 99,116, 95,115,112,108,105,110,101, 91, 52, 93,  0,110,117,114, 98, 95,115,101,108, 95,117,108,105,110,101,
+ 91, 52, 93,  0,110,117,114, 98, 95,115,101,108, 95,118,108,105,110,101, 91, 52, 93,  0,108, 97,115,116,115,101,108, 95,112,111,
+105,110,116, 91, 52, 93,  0,104, 97,110,100,108,101, 95,102,114,101,101, 91, 52, 93,  0,104, 97,110,100,108,101, 95, 97,117,116,
+111, 91, 52, 93,  0,104, 97,110,100,108,101, 95,118,101, 99,116, 91, 52, 93,  0,104, 97,110,100,108,101, 95, 97,108,105,103,110,
+ 91, 52, 93,  0,104, 97,110,100,108,101, 95, 97,117,116,111, 95, 99,108, 97,109,112,101,100, 91, 52, 93,  0,104, 97,110,100,108,
+101, 95,115,101,108, 95,102,114,101,101, 91, 52, 93,  0,104, 97,110,100,108,101, 95,115,101,108, 95, 97,117,116,111, 91, 52, 93,
+  0,104, 97,110,100,108,101, 95,115,101,108, 95,118,101, 99,116, 91, 52, 93,  0,104, 97,110,100,108,101, 95,115,101,108, 95, 97,
+108,105,103,110, 91, 52, 93,  0,104, 97,110,100,108,101, 95,115,101,108, 95, 97,117,116,111, 95, 99,108, 97,109,112,101,100, 91,
+ 52, 93,  0,100,115, 95, 99,104, 97,110,110,101,108, 91, 52, 93,  0,100,115, 95,115,117, 98, 99,104, 97,110,110,101,108, 91, 52,
+ 93,  0, 99,111,110,115,111,108,101, 95,111,117,116,112,117,116, 91, 52, 93,  0, 99,111,110,115,111,108,101, 95,105,110,112,117,
+116, 91, 52, 93,  0, 99,111,110,115,111,108,101, 95,105,110,102,111, 91, 52, 93,  0, 99,111,110,115,111,108,101, 95,101,114,114,
+111,114, 91, 52, 93,  0, 99,111,110,115,111,108,101, 95, 99,117,114,115,111,114, 91, 52, 93,  0,118,101,114,116,101,120, 95,115,
+105,122,101,  0,111,117,116,108,105,110,101, 95,119,105,100,116,104,  0,102, 97, 99,101,100,111,116, 95,115,105,122,101,  0,110,
+111,111,100,108,101, 95, 99,117,114,118,105,110,103,  0,115,121,110,116, 97,120,108, 91, 52, 93,  0,115,121,110,116, 97,120,110,
+ 91, 52, 93,  0,115,121,110,116, 97,120, 98, 91, 52, 93,  0,115,121,110,116, 97,120,118, 91, 52, 93,  0,115,121,110,116, 97,120,
+ 99, 91, 52, 93,  0,109,111,118,105,101, 91, 52, 93,  0,109,111,118,105,101, 99,108,105,112, 91, 52, 93,  0,105,109, 97,103,101,
+ 91, 52, 93,  0,115, 99,101,110,101, 91, 52, 93,  0, 97,117,100,105,111, 91, 52, 93,  0,101,102,102,101, 99,116, 91, 52, 93,  0,
+112,108,117,103,105,110, 91, 52, 93,  0,116,114, 97,110,115,105,116,105,111,110, 91, 52, 93,  0,109,101,116, 97, 91, 52, 93,  0,
+101,100,105,116,109,101,115,104, 95, 97, 99,116,105,118,101, 91, 52, 93,  0,104, 97,110,100,108,101, 95,118,101,114,116,101,120,
+ 91, 52, 93,  0,104, 97,110,100,108,101, 95,118,101,114,116,101,120, 95,115,101,108,101, 99,116, 91, 52, 93,  0,104, 97,110,100,
+108,101, 95,118,101,114,116,101,120, 95,115,105,122,101,  0,109, 97,114,107,101,114, 95,111,117,116,108,105,110,101, 91, 52, 93,
+  0,109, 97,114,107,101,114, 91, 52, 93,  0, 97, 99,116, 95,109, 97,114,107,101,114, 91, 52, 93,  0,115,101,108, 95,109, 97,114,
+107,101,114, 91, 52, 93,  0,100,105,115, 95,109, 97,114,107,101,114, 91, 52, 93,  0,108,111, 99,107, 95,109, 97,114,107,101,114,
+ 91, 52, 93,  0, 98,117,110,100,108,101, 95,115,111,108,105,100, 91, 52, 93,  0,112, 97,116,104, 95, 98,101,102,111,114,101, 91,
+ 52, 93,  0,112, 97,116,104, 95, 97,102,116,101,114, 91, 52, 93,  0, 99, 97,109,101,114, 97, 95,112, 97,116,104, 91, 52, 93,  0,
+104,112, 97,100, 91, 55, 93,  0,112,114,101,118,105,101,119, 95, 98, 97, 99,107, 91, 52, 93,  0,112,114,101,118,105,101,119, 95,
+115,116,105,116, 99,104, 95,102, 97, 99,101, 91, 52, 93,  0,112,114,101,118,105,101,119, 95,115,116,105,116, 99,104, 95,101,100,
+103,101, 91, 52, 93,  0,112,114,101,118,105,101,119, 95,115,116,105,116, 99,104, 95,118,101,114,116, 91, 52, 93,  0,112,114,101,
+118,105,101,119, 95,115,116,105,116, 99,104, 95,115,116,105,116, 99,104, 97, 98,108,101, 91, 52, 93,  0,112,114,101,118,105,101,
+119, 95,115,116,105,116, 99,104, 95,117,110,115,116,105,116, 99,104, 97, 98,108,101, 91, 52, 93,  0,112,114,101,118,105,101,119,
+ 95,115,116,105,116, 99,104, 95, 97, 99,116,105,118,101, 91, 52, 93,  0,109, 97,116, 99,104, 91, 52, 93,  0,115,101,108,101, 99,
+116,101,100, 95,104,105,103,104,108,105,103,104,116, 91, 52, 93,  0,115,111,108,105,100, 91, 52, 93,  0,116,117,105,  0,116, 98,
+117,116,115,  0,116,118, 51,100,  0,116,102,105,108,101,  0,116,105,112,111,  0,116,105,110,102,111,  0,116, 97, 99,116,  0,116,
+110,108, 97,  0,116,115,101,113,  0,116,105,109, 97,  0,116,101,120,116,  0,116,111,111,112,115,  0,116,116,105,109,101,  0,116,
+110,111,100,101,  0,116,108,111,103,105, 99,  0,116,117,115,101,114,112,114,101,102,  0,116, 99,111,110,115,111,108,101,  0,116,
+ 99,108,105,112,  0,116, 97,114,109, 91, 50, 48, 93,  0, 97, 99,116,105,118,101, 95,116,104,101,109,101, 95, 97,114,101, 97,  0,
+109,111,100,117,108,101, 91, 54, 52, 93,  0,115,112,101, 99, 91, 52, 93,  0,100,117,112,102,108, 97,103,  0,115, 97,118,101,116,
+105,109,101,  0,116,101,109,112,100,105,114, 91, 55, 54, 56, 93,  0,102,111,110,116,100,105,114, 91, 55, 54, 56, 93,  0,114,101,
+110,100,101,114,100,105,114, 91, 49, 48, 50, 52, 93,  0,116,101,120,116,117,100,105,114, 91, 55, 54, 56, 93,  0,112,108,117,103,
+116,101,120,100,105,114, 91, 55, 54, 56, 93,  0,112,108,117,103,115,101,113,100,105,114, 91, 55, 54, 56, 93,  0,112,121,116,104,
+111,110,100,105,114, 91, 55, 54, 56, 93,  0,115,111,117,110,100,100,105,114, 91, 55, 54, 56, 93,  0,105,109, 97,103,101, 95,101,
+100,105,116,111,114, 91, 49, 48, 50, 52, 93,  0, 97,110,105,109, 95,112,108, 97,121,101,114, 91, 49, 48, 50, 52, 93,  0, 97,110,
+105,109, 95,112,108, 97,121,101,114, 95,112,114,101,115,101,116,  0,118, 50,100, 95,109,105,110, 95,103,114,105,100,115,105,122,
+101,  0,116,105,109,101, 99,111,100,101, 95,115,116,121,108,101,  0,118,101,114,115,105,111,110,115,  0,100, 98,108, 95, 99,108,
+105, 99,107, 95,116,105,109,101,  0,103, 97,109,101,102,108, 97,103,115,  0,119,104,101,101,108,108,105,110,101,115, 99,114,111,
+108,108,  0,117,105,102,108, 97,103,  0,108, 97,110,103,117, 97,103,101,  0,117,115,101,114,112,114,101,102,  0,118,105,101,119,
+122,111,111,109,  0,109,105,120, 98,117,102,115,105,122,101,  0, 97,117,100,105,111,100,101,118,105, 99,101,  0, 97,117,100,105,
+111,114, 97,116,101,  0, 97,117,100,105,111,102,111,114,109, 97,116,  0, 97,117,100,105,111, 99,104, 97,110,110,101,108,115,  0,
+100,112,105,  0,101,110, 99,111,100,105,110,103,  0,116,114, 97,110,115,111,112,116,115,  0,109,101,110,117,116,104,114,101,115,
+104,111,108,100, 49,  0,109,101,110,117,116,104,114,101,115,104,111,108,100, 50,  0,116,104,101,109,101,115,  0,117,105,102,111,
+110,116,115,  0,117,105,115,116,121,108,101,115,  0,107,101,121,109, 97,112,115,  0,117,115,101,114, 95,107,101,121,109, 97,112,
+115,  0, 97,100,100,111,110,115,  0,107,101,121, 99,111,110,102,105,103,115,116,114, 91, 54, 52, 93,  0,117,110,100,111,115,116,
+101,112,115,  0,117,110,100,111,109,101,109,111,114,121,  0,103,112, 95,109, 97,110,104, 97,116,116,101,110,100,105,115,116,  0,
+103,112, 95,101,117, 99,108,105,100,101, 97,110,100,105,115,116,  0,103,112, 95,101,114, 97,115,101,114,  0,103,112, 95,115,101,
+116,116,105,110,103,115,  0,116, 98, 95,108,101,102,116,109,111,117,115,101,  0,116, 98, 95,114,105,103,104,116,109,111,117,115,
+101,  0,108,105,103,104,116, 91, 51, 93,  0,116,119, 95,104,111,116,115,112,111,116,  0,116,119, 95,102,108, 97,103,  0,116,119,
+ 95,104, 97,110,100,108,101,115,105,122,101,  0,116,119, 95,115,105,122,101,  0,116,101,120,116,105,109,101,111,117,116,  0,116,
+101,120, 99,111,108,108,101, 99,116,114, 97,116,101,  0,119,109,100,114, 97,119,109,101,116,104,111,100,  0,100,114, 97,103,116,
+104,114,101,115,104,111,108,100,  0,109,101,109, 99, 97, 99,104,101,108,105,109,105,116,  0,112,114,101,102,101,116, 99,104,102,
+114, 97,109,101,115,  0,102,114, 97,109,101,115,101,114,118,101,114,112,111,114,116,  0,112, 97,100, 95,114,111,116, 95, 97,110,
+103,108,101,  0,111, 98, 99,101,110,116,101,114, 95,100,105, 97,  0,114,118,105,115,105,122,101,  0,114,118,105, 98,114,105,103,
+104,116,  0,114,101, 99,101,110,116, 95,102,105,108,101,115,  0,115,109,111,111,116,104, 95,118,105,101,119,116,120,  0,103,108,
+114,101,115,108,105,109,105,116,  0, 99,117,114,115,115,105,122,101,  0, 99,111,108,111,114, 95,112,105, 99,107,101,114, 95,116,
 121,112,101,  0,105,112,111, 95,110,101,119,  0,107,101,121,104, 97,110,100,108,101,115, 95,110,101,119,  0,115, 99,114, 99, 97,
 115,116,102,112,115,  0,115, 99,114, 99, 97,115,116,119, 97,105,116,  0,119,105,100,103,101,116, 95,117,110,105,116,  0, 97,110,
-105,115,111,116,114,111,112,105, 99, 95,102,105,108,116,101,114,  0,118,101,114,115,101,109, 97,115,116,101,114, 91, 49, 54, 48,
- 93,  0,118,101,114,115,101,117,115,101,114, 91, 49, 54, 48, 93,  0,103,108, 97,108,112,104, 97, 99,108,105,112,  0,116,101,120,
-116, 95,114,101,110,100,101,114,  0,112, 97,100, 57,  0, 99,111, 98, 97, 95,119,101,105,103,104,116,  0,115, 99,117,108,112,116,
- 95,112, 97,105,110,116, 95,111,118,101,114,108, 97,121, 95, 99,111,108, 91, 51, 93,  0, 97,117,116,104,111,114, 91, 56, 48, 93,
-  0,118,101,114,116, 98, 97,115,101,  0,101,100,103,101, 98, 97,115,101,  0, 97,114,101, 97, 98, 97,115,101,  0, 42,110,101,119,
-115, 99,101,110,101,  0,114,101,100,114, 97,119,115, 95,102,108, 97,103,  0,102,117,108,108,  0,116,101,109,112,  0,119,105,110,
-105,100,  0,100,111, 95,100,114, 97,119,  0,100,111, 95,114,101,102,114,101,115,104,  0,100,111, 95,100,114, 97,119, 95,103,101,
-115,116,117,114,101,  0,100,111, 95,100,114, 97,119, 95,112, 97,105,110,116, 99,117,114,115,111,114,  0,100,111, 95,100,114, 97,
-119, 95,100,114, 97,103,  0,115,119, 97,112,  0,109, 97,105,110,119,105,110,  0,115,117, 98,119,105,110, 97, 99,116,105,118,101,
-  0, 42, 97,110,105,109,116,105,109,101,114,  0, 42, 99,111,110,116,101,120,116,  0,104, 97,110,100,108,101,114, 91, 56, 93,  0,
- 42,110,101,119,118,  0,118,101, 99,  0, 42,118, 49,  0, 42,118, 50,  0, 42,116,121,112,101,  0,112, 97,110,101,108,110, 97,109,
-101, 91, 54, 52, 93,  0,116, 97, 98,110, 97,109,101, 91, 54, 52, 93,  0,100,114, 97,119,110, 97,109,101, 91, 54, 52, 93,  0,111,
-102,115,120,  0,111,102,115,121,  0,115,105,122,101,120,  0,115,105,122,101,121,  0,108, 97, 98,101,108,111,102,115,  0,114,117,
-110,116,105,109,101, 95,102,108, 97,103,  0, 99,111,110,116,114,111,108,  0,115,110, 97,112,  0,115,111,114,116,111,114,100,101,
-114,  0, 42,112, 97,110,101,108,116, 97, 98,  0, 42, 97, 99,116,105,118,101,100, 97,116, 97,  0,108,105,115,116, 95,115, 99,114,
-111,108,108,  0,108,105,115,116, 95,115,105,122,101,  0,108,105,115,116, 95,108, 97,115,116, 95,108,101,110,  0,108,105,115,116,
- 95,103,114,105,112, 95,115,105,122,101,  0,108,105,115,116, 95,115,101, 97,114, 99,104, 91, 54, 52, 93,  0, 42,118, 51,  0, 42,
-118, 52,  0, 42,102,117,108,108,  0, 98,117,116,115,112, 97, 99,101,116,121,112,101,  0,104,101, 97,100,101,114,116,121,112,101,
-  0,115,112, 97, 99,101,100, 97,116, 97,  0,104, 97,110,100,108,101,114,115,  0, 97, 99,116,105,111,110,122,111,110,101,115,  0,
-119,105,110,114, 99,116,  0,100,114, 97,119,114, 99,116,  0,115,119,105,110,105,100,  0,114,101,103,105,111,110,116,121,112,101,
-  0, 97,108,105,103,110,109,101,110,116,  0,100,111, 95,100,114, 97,119, 95,111,118,101,114,108, 97,121,  0,117,105, 98,108,111,
- 99,107,115,  0,112, 97,110,101,108,115,  0, 42,104,101, 97,100,101,114,115,116,114,  0, 42,114,101,103,105,111,110,100, 97,116,
- 97,  0,115,117, 98,118,115,116,114, 91, 52, 93,  0,115,117, 98,118,101,114,115,105,111,110,  0,112, 97,100,115,  0,109,105,110,
-118,101,114,115,105,111,110,  0,109,105,110,115,117, 98,118,101,114,115,105,111,110,  0,119,105,110,112,111,115,  0, 42, 99,117,
-114,115, 99,114,101,101,110,  0, 42, 99,117,114,115, 99,101,110,101,  0,102,105,108,101,102,108, 97,103,115,  0,103,108,111, 98,
- 97,108,102,  0,114,101,118,105,115,105,111,110,  0,102,105,108,101,110, 97,109,101, 91, 50, 52, 48, 93,  0,110, 97,109,101, 91,
- 56, 48, 93,  0,111,114,105,103, 95,119,105,100,116,104,  0,111,114,105,103, 95,104,101,105,103,104,116,  0, 98,111,116,116,111,
-109,  0,114,105,103,104,116,  0,120,111,102,115,  0,121,111,102,115,  0,108,105,102,116, 91, 51, 93,  0,103, 97,109,109, 97, 91,
- 51, 93,  0,103, 97,105,110, 91, 51, 93,  0,100,105,114, 91, 49, 54, 48, 93,  0,100,111,110,101,  0,115,116, 97,114,116,115,116,
-105,108,108,  0,101,110,100,115,116,105,108,108,  0, 42,115,116,114,105,112,100, 97,116, 97,  0, 42, 99,114,111,112,  0, 42,116,
-114, 97,110,115,102,111,114,109,  0, 42, 99,111,108,111,114, 95, 98, 97,108, 97,110, 99,101,  0, 42,105,110,115,116, 97,110, 99,
-101, 95,112,114,105,118, 97,116,101, 95,100, 97,116, 97,  0, 42, 42, 99,117,114,114,101,110,116, 95,112,114,105,118, 97,116,101,
- 95,100, 97,116, 97,  0, 42,116,109,112,  0,115,116, 97,114,116,111,102,115,  0,101,110,100,111,102,115,  0,109, 97, 99,104,105,
-110,101,  0,115,116, 97,114,116,100,105,115,112,  0,101,110,100,100,105,115,112,  0,115, 97,116,  0,109,117,108,  0,104, 97,110,
-100,115,105,122,101,  0, 97,110,105,109, 95,112,114,101,115,101,101,107,  0, 42,115,116,114,105,112,  0, 42,115, 99,101,110,101,
- 95, 99, 97,109,101,114, 97,  0,101,102,102,101, 99,116, 95,102, 97,100,101,114,  0,115,112,101,101,100, 95,102, 97,100,101,114,
-  0, 42,115,101,113, 49,  0, 42,115,101,113, 50,  0, 42,115,101,113, 51,  0,115,101,113, 98, 97,115,101,  0, 42,115, 99,101,110,
-101, 95,115,111,117,110,100,  0,108,101,118,101,108,  0,112, 97,110,  0,115, 99,101,110,101,110,114,  0,109,117,108,116,105, 99,
- 97,109, 95,115,111,117,114, 99,101,  0,115,116,114,111, 98,101,  0, 42,101,102,102,101, 99,116,100, 97,116, 97,  0, 97,110,105,
-109, 95,115,116, 97,114,116,111,102,115,  0, 97,110,105,109, 95,101,110,100,111,102,115,  0, 98,108,101,110,100, 95,109,111,100,
-101,  0, 98,108,101,110,100, 95,111,112, 97, 99,105,116,121,  0, 42,111,108,100, 98, 97,115,101,112,  0, 42,112, 97,114,115,101,
-113,  0, 42,115,101,113, 98, 97,115,101,112,  0,109,101,116, 97,115,116, 97, 99,107,  0, 42, 97, 99,116, 95,115,101,113,  0, 97,
- 99,116, 95,105,109, 97,103,101,100,105,114, 91, 50, 53, 54, 93,  0, 97, 99,116, 95,115,111,117,110,100,100,105,114, 91, 50, 53,
- 54, 93,  0,111,118,101,114, 95,111,102,115,  0,111,118,101,114, 95, 99,102,114, 97,  0,111,118,101,114, 95,102,108, 97,103,  0,
-111,118,101,114, 95, 98,111,114,100,101,114,  0,101,100,103,101, 87,105,100,116,104,  0,102,111,114,119, 97,114,100,  0,119,105,
-112,101,116,121,112,101,  0,102, 77,105,110,105,  0,102, 67,108, 97,109,112,  0,102, 66,111,111,115,116,  0,100, 68,105,115,116,
-  0,100, 81,117, 97,108,105,116,121,  0, 98, 78,111, 67,111,109,112,  0, 83, 99, 97,108,101,120, 73,110,105,  0, 83, 99, 97,108,
-101,121, 73,110,105,  0, 83, 99, 97,108,101,120, 70,105,110,  0, 83, 99, 97,108,101,121, 70,105,110,  0,120, 73,110,105,  0,120,
- 70,105,110,  0,121, 73,110,105,  0,121, 70,105,110,  0,114,111,116, 73,110,105,  0,114,111,116, 70,105,110,  0,105,110,116,101,
-114,112,111,108, 97,116,105,111,110,  0,117,110,105,102,111,114,109, 95,115, 99, 97,108,101,  0,116,105,116,108,101,115,116,114,
- 91, 54, 52, 93,  0,115,117, 98,116,105,116,108,101, 91, 49, 50, 56, 93,  0,102,103, 99,111,108, 91, 51, 93,  0, 98,103, 99,111,
-108, 91, 51, 93,  0, 42,102,114, 97,109,101, 77, 97,112,  0,103,108,111, 98, 97,108, 83,112,101,101,100,  0,108, 97,115,116, 86,
- 97,108,105,100, 70,114, 97,109,101,  0, 98,117,116,116,121,112,101,  0,117,115,101,114,106,105,116,  0,115,116, 97,  0,116,111,
-116,112, 97,114,116,  0,110,111,114,109,102, 97, 99,  0,111, 98,102, 97, 99,  0,114, 97,110,100,102, 97, 99,  0,116,101,120,102,
- 97, 99,  0,114, 97,110,100,108,105,102,101,  0,102,111,114, 99,101, 91, 51, 93,  0,118,101, 99,116,115,105,122,101,  0,109, 97,
-120,108,101,110,  0,100,101,102,118,101, 99, 91, 51, 93,  0,109,117,108,116, 91, 52, 93,  0,108,105,102,101, 91, 52, 93,  0, 99,
-104,105,108,100, 91, 52, 93,  0,109, 97,116, 91, 52, 93,  0,116,101,120,109, 97,112,  0, 99,117,114,109,117,108,116,  0,115,116,
- 97,116,105, 99,115,116,101,112,  0,111,109, 97,116,  0,116,105,109,101,116,101,120,  0,115,112,101,101,100,116,101,120,  0,102,
-108, 97,103, 50,110,101,103,  0,118,101,114,116,103,114,111,117,112, 95,118,  0,118,103,114,111,117,112,110, 97,109,101, 91, 51,
- 50, 93,  0,118,103,114,111,117,112,110, 97,109,101, 95,118, 91, 51, 50, 93,  0, 42,107,101,121,115,  0,109,105,110,102, 97, 99,
-  0,110,114,  0,117,115,101,100,  0,117,115,101,100,101,108,101,109,  0, 42,112,111,105,110,  0,114,101,115,101,116,100,105,115,
-116,  0,108, 97,115,116,118, 97,108,  0, 42,109, 97,  0,107,101,121,  0,113,117, 97,108,  0,113,117, 97,108, 50,  0,116, 97,114,
-103,101,116, 78, 97,109,101, 91, 51, 50, 93,  0,116,111,103,103,108,101, 78, 97,109,101, 91, 51, 50, 93,  0,118, 97,108,117,101,
- 91, 51, 50, 93,  0,109, 97,120,118, 97,108,117,101, 91, 51, 50, 93,  0,100,101,108, 97,121,  0,100,117,114, 97,116,105,111,110,
-  0,109, 97,116,101,114,105, 97,108, 78, 97,109,101, 91, 51, 50, 93,  0,100, 97,109,112,116,105,109,101,114,  0,112,114,111,112,
-110, 97,109,101, 91, 51, 50, 93,  0,109, 97,116,110, 97,109,101, 91, 51, 50, 93,  0, 97,120,105,115,102,108, 97,103,  0,112,111,
-115,101, 99,104, 97,110,110,101,108, 91, 51, 50, 93,  0, 99,111,110,115,116,114, 97,105,110,116, 91, 51, 50, 93,  0, 42,102,114,
-111,109, 79, 98,106,101, 99,116,  0,115,117, 98,106,101, 99,116, 91, 51, 50, 93,  0, 98,111,100,121, 91, 51, 50, 93,  0,111,116,
-121,112,101,  0,112,117,108,115,101,  0,102,114,101,113,  0,116,111,116,108,105,110,107,115,  0, 42, 42,108,105,110,107,115,  0,
-116, 97,112,  0,106,111,121,105,110,100,101,120,  0, 97,120,105,115, 95,115,105,110,103,108,101,  0, 97,120,105,115,102,  0, 98,
-117,116,116,111,110,  0,104, 97,116,  0,104, 97,116,102,  0,112,114,101, 99,105,115,105,111,110,  0,115,116,114, 91, 49, 50, 56,
- 93,  0, 42,109,121,110,101,119,  0,105,110,112,117,116,115,  0,116,111,116,115,108,105,110,107,115,  0, 42, 42,115,108,105,110,
-107,115,  0,118, 97,108,111,  0,115,116, 97,116,101, 95,109, 97,115,107,  0, 42, 97, 99,116,  0,102,114, 97,109,101, 80,114,111,
-112, 91, 51, 50, 93,  0, 98,108,101,110,100,105,110,  0,112,114,105,111,114,105,116,121,  0,101,110,100, 95,114,101,115,101,116,
-  0,115,116,114,105,100,101, 97,120,105,115,  0,115,116,114,105,100,101,108,101,110,103,116,104,  0,108, 97,121,101,114, 95,119,
-101,105,103,104,116,  0,109,105,110, 95,103, 97,105,110,  0,109, 97,120, 95,103, 97,105,110,  0,114,101,102,101,114,101,110, 99,
-101, 95,100,105,115,116, 97,110, 99,101,  0,109, 97,120, 95,100,105,115,116, 97,110, 99,101,  0,114,111,108,108,111,102,102, 95,
-102, 97, 99,116,111,114,  0, 99,111,110,101, 95,105,110,110,101,114, 95, 97,110,103,108,101,  0, 99,111,110,101, 95,111,117,116,
-101,114, 95, 97,110,103,108,101,  0, 99,111,110,101, 95,111,117,116,101,114, 95,103, 97,105,110,  0,112, 97,100, 51, 91, 50, 93,
-  0,112,105,116, 99,104,  0,115,111,117,110,100, 51, 68,  0,112, 97,100, 54, 91, 49, 93,  0, 42,109,101,  0,108,105,110, 86,101,
-108,111, 99,105,116,121, 91, 51, 93,  0, 97,110,103, 86,101,108,111, 99,105,116,121, 91, 51, 93,  0,108,111, 99, 97,108,102,108,
- 97,103,  0,100,121,110, 95,111,112,101,114, 97,116,105,111,110,  0,102,111,114, 99,101,108,111, 99, 91, 51, 93,  0,102,111,114,
- 99,101,114,111,116, 91, 51, 93,  0,108,105,110,101, 97,114,118,101,108,111, 99,105,116,121, 91, 51, 93,  0, 97,110,103,117,108,
- 97,114,118,101,108,111, 99,105,116,121, 91, 51, 93,  0, 42,114,101,102,101,114,101,110, 99,101,  0,109,105,110,  0,109, 97,120,
-  0,114,111,116,100, 97,109,112,  0,109,105,110,108,111, 99, 91, 51, 93,  0,109, 97,120,108,111, 99, 91, 51, 93,  0,109,105,110,
-114,111,116, 91, 51, 93,  0,109, 97,120,114,111,116, 91, 51, 93,  0,109, 97,116,112,114,111,112, 91, 51, 50, 93,  0, 98,117,116,
-115,116, 97,  0, 98,117,116,101,110,100,  0,100,105,115,116,114,105, 98,117,116,105,111,110,  0,105,110,116, 95, 97,114,103, 95,
- 49,  0,105,110,116, 95, 97,114,103, 95, 50,  0,102,108,111, 97,116, 95, 97,114,103, 95, 49,  0,102,108,111, 97,116, 95, 97,114,
-103, 95, 50,  0,116,111, 80,114,111,112, 78, 97,109,101, 91, 51, 50, 93,  0, 42,116,111, 79, 98,106,101, 99,116,  0, 98,111,100,
-121, 84,121,112,101,  0,102,105,108,101,110, 97,109,101, 91, 54, 52, 93,  0,108,111, 97,100, 97,110,105,110, 97,109,101, 91, 54,
- 52, 93,  0,105,110,116, 95, 97,114,103,  0,102,108,111, 97,116, 95, 97,114,103,  0, 42,115,117, 98,116, 97,114,103,101,116,  0,
-103,111,  0, 42,110,101,119,112, 97, 99,107,101,100,102,105,108,101,  0, 97,116,116,101,110,117, 97,116,105,111,110,  0,100,105,
-115,116, 97,110, 99,101,  0, 42, 99, 97, 99,104,101,  0, 42,112,108, 97,121, 98, 97, 99,107, 95,104, 97,110,100,108,101,  0, 42,
-108, 97,109,112,114,101,110,  0,103,111, 98,106,101, 99,116,  0,100,117,112,108,105, 95,111,102,115, 91, 51, 93,  0, 42,112,114,
-111,112,  0, 99,104,105,108,100, 98, 97,115,101,  0,114,111,108,108,  0,104,101, 97,100, 91, 51, 93,  0,116, 97,105,108, 91, 51,
- 93,  0, 98,111,110,101, 95,109, 97,116, 91, 51, 93, 91, 51, 93,  0, 97,114,109, 95,104,101, 97,100, 91, 51, 93,  0, 97,114,109,
- 95,116, 97,105,108, 91, 51, 93,  0, 97,114,109, 95,109, 97,116, 91, 52, 93, 91, 52, 93,  0, 97,114,109, 95,114,111,108,108,  0,
-120,119,105,100,116,104,  0,122,119,105,100,116,104,  0,101, 97,115,101, 49,  0,101, 97,115,101, 50,  0,114, 97,100, 95,104,101,
- 97,100,  0,114, 97,100, 95,116, 97,105,108,  0, 98,111,110,101, 98, 97,115,101,  0, 99,104, 97,105,110, 98, 97,115,101,  0, 42,
-101,100, 98,111,  0, 42, 97, 99,116, 95, 98,111,110,101,  0, 42, 97, 99,116, 95,101,100, 98,111,110,101,  0, 42,115,107,101,116,
- 99,104,  0,108, 97,121,101,114, 95,117,115,101,100,  0,108, 97,121,101,114, 95,112,114,111,116,101, 99,116,101,100,  0,103,104,
-111,115,116,101,112,  0,103,104,111,115,116,115,105,122,101,  0,103,104,111,115,116,116,121,112,101,  0,112, 97,116,104,115,105,
-122,101,  0,103,104,111,115,116,115,102,  0,103,104,111,115,116,101,102,  0,112, 97,116,104,115,102,  0,112, 97,116,104,101,102,
-  0,112, 97,116,104, 98, 99,  0,112, 97,116,104, 97, 99,  0, 42,112,111,105,110,116,115,  0,115,116, 97,114,116, 95,102,114, 97,
-109,101,  0,101,110,100, 95,102,114, 97,109,101,  0,103,104,111,115,116, 95,115,102,  0,103,104,111,115,116, 95,101,102,  0,103,
-104,111,115,116, 95, 98, 99,  0,103,104,111,115,116, 95, 97, 99,  0,103,104,111,115,116, 95,116,121,112,101,  0,103,104,111,115,
-116, 95,115,116,101,112,  0,103,104,111,115,116, 95,102,108, 97,103,  0,112, 97,116,104, 95,116,121,112,101,  0,112, 97,116,104,
- 95,115,116,101,112,  0,112, 97,116,104, 95,118,105,101,119,102,108, 97,103,  0,112, 97,116,104, 95, 98, 97,107,101,102,108, 97,
-103,  0,112, 97,116,104, 95,115,102,  0,112, 97,116,104, 95,101,102,  0,112, 97,116,104, 95, 98, 99,  0,112, 97,116,104, 95, 97,
- 99,  0, 99,111,110,115,116,102,108, 97,103,  0,105,107,102,108, 97,103,  0,115,101,108,101, 99,116,102,108, 97,103,  0, 97,103,
-114,112, 95,105,110,100,101,120,  0, 42, 98,111,110,101,  0, 42, 99,104,105,108,100,  0,105,107,116,114,101,101,  0, 42, 99,117,
-115,116,111,109,  0, 42, 99,117,115,116,111,109, 95,116,120,  0,101,117,108, 91, 51, 93,  0, 99,104, 97,110, 95,109, 97,116, 91,
- 52, 93, 91, 52, 93,  0,112,111,115,101, 95,109, 97,116, 91, 52, 93, 91, 52, 93,  0,112,111,115,101, 95,104,101, 97,100, 91, 51,
- 93,  0,112,111,115,101, 95,116, 97,105,108, 91, 51, 93,  0,108,105,109,105,116,109,105,110, 91, 51, 93,  0,108,105,109,105,116,
-109, 97,120, 91, 51, 93,  0,115,116,105,102,102,110,101,115,115, 91, 51, 93,  0,105,107,115,116,114,101,116, 99,104,  0,105,107,
-114,111,116,119,101,105,103,104,116,  0,105,107,108,105,110,119,101,105,103,104,116,  0, 99,104, 97,110, 98, 97,115,101,  0, 42,
- 99,104, 97,110,104, 97,115,104,  0,112,114,111,120,121, 95,108, 97,121,101,114,  0,115,116,114,105,100,101, 95,111,102,102,115,
-101,116, 91, 51, 93,  0, 99,121, 99,108,105, 99, 95,111,102,102,115,101,116, 91, 51, 93,  0, 97,103,114,111,117,112,115,  0, 97,
- 99,116,105,118,101, 95,103,114,111,117,112,  0,105,107,115,111,108,118,101,114,  0, 42,105,107,100, 97,116, 97,  0, 42,105,107,
-112, 97,114, 97,109,  0,112,114,111,120,121, 95, 97, 99,116, 95, 98,111,110,101, 91, 51, 50, 93,  0,110,117,109,105,116,101,114,
-  0,110,117,109,115,116,101,112,  0,109,105,110,115,116,101,112,  0,109, 97,120,115,116,101,112,  0,115,111,108,118,101,114,  0,
-102,101,101,100, 98, 97, 99,107,  0,109, 97,120,118,101,108,  0,100, 97,109,112,109, 97,120,  0,100, 97,109,112,101,112,115,  0,
- 99,104, 97,110,110,101,108,115,  0, 99,117,115,116,111,109, 67,111,108,  0, 99,115,  0, 99,117,114,118,101,115,  0,103,114,111,
-117,112,115,  0, 97, 99,116,105,118,101, 95,109, 97,114,107,101,114,  0,105,100,114,111,111,116,  0, 42,115,111,117,114, 99,101,
-  0, 42,102,105,108,116,101,114, 95,103,114,112,  0,115,101, 97,114, 99,104,115,116,114, 91, 54, 52, 93,  0,102,105,108,116,101,
-114,102,108, 97,103,  0, 97,100,115,  0,116,105,109,101,115,108,105,100,101,  0, 42,103,114,112,  0,110, 97,109,101, 91, 51, 48,
- 93,  0,111,119,110,115,112, 97, 99,101,  0,116, 97,114,115,112, 97, 99,101,  0,101,110,102,111,114, 99,101,  0,104,101, 97,100,
-116, 97,105,108,  0,108,105,110, 95,101,114,114,111,114,  0,114,111,116, 95,101,114,114,111,114,  0, 42,116, 97,114,  0,109, 97,
-116,114,105,120, 91, 52, 93, 91, 52, 93,  0,115,112, 97, 99,101,  0,114,111,116, 79,114,100,101,114,  0,116, 97,114,110,117,109,
-  0,116, 97,114,103,101,116,115,  0,105,116,101,114, 97,116,105,111,110,115,  0,114,111,111,116, 98,111,110,101,  0,109, 97,120,
- 95,114,111,111,116, 98,111,110,101,  0, 42,112,111,108,101,116, 97,114,  0,112,111,108,101,115,117, 98,116, 97,114,103,101,116,
- 91, 51, 50, 93,  0,112,111,108,101, 97,110,103,108,101,  0,111,114,105,101,110,116,119,101,105,103,104,116,  0,103,114, 97, 98,
-116, 97,114,103,101,116, 91, 51, 93,  0,110,117,109,112,111,105,110,116,115,  0, 99,104, 97,105,110,108,101,110,  0,120,122, 83,
- 99, 97,108,101, 77,111,100,101,  0,114,101,115,101,114,118,101,100, 49,  0,114,101,115,101,114,118,101,100, 50,  0,109,105,110,
-109, 97,120,102,108, 97,103,  0,115,116,117, 99,107,  0, 99, 97, 99,104,101, 91, 51, 93,  0,108,111, 99,107,102,108, 97,103,  0,
-102,111,108,108,111,119,102,108, 97,103,  0,118,111,108,109,111,100,101,  0,112,108, 97,110,101,  0,111,114,103,108,101,110,103,
-116,104,  0, 98,117,108,103,101,  0,112,105,118, 88,  0,112,105,118, 89,  0,112,105,118, 90,  0, 97,120, 88,  0, 97,120, 89,  0,
- 97,120, 90,  0,109,105,110, 76,105,109,105,116, 91, 54, 93,  0,109, 97,120, 76,105,109,105,116, 91, 54, 93,  0,101,120,116,114,
- 97, 70,122,  0,105,110,118,109, 97,116, 91, 52, 93, 91, 52, 93,  0,102,114,111,109,  0,116,111,  0,109, 97,112, 91, 51, 93,  0,
-101,120,112,111,  0,102,114,111,109, 95,109,105,110, 91, 51, 93,  0,102,114,111,109, 95,109, 97,120, 91, 51, 93,  0,116,111, 95,
-109,105,110, 91, 51, 93,  0,116,111, 95,109, 97,120, 91, 51, 93,  0,114,111,116, 65,120,105,115,  0,122,109,105,110,  0,122,109,
- 97,120,  0,112, 97,100, 91, 57, 93,  0, 99,104, 97,110,110,101,108, 91, 51, 50, 93,  0,110,111, 95,114,111,116, 95, 97,120,105,
-115,  0,115,116,114,105,100,101, 95, 97,120,105,115,  0, 99,117,114,109,111,100,  0, 97, 99,116,115,116, 97,114,116,  0, 97, 99,
-116,101,110,100,  0, 97, 99,116,111,102,102,115,  0,115,116,114,105,100,101,108,101,110,  0,115, 99, 97,108,101,  0, 98,108,101,
-110,100,111,117,116,  0,115,116,114,105,100,101, 99,104, 97,110,110,101,108, 91, 51, 50, 93,  0,111,102,102,115, 95, 98,111,110,
-101, 91, 51, 50, 93,  0,104, 97,115,105,110,112,117,116,  0,104, 97,115,111,117,116,112,117,116,  0,100, 97,116, 97,116,121,112,
-101,  0,115,111, 99,107,101,116,116,121,112,101,  0, 42,110,101,119, 95,115,111, 99,107,  0,110,115,  0,108,105,109,105,116,  0,
-115,116, 97, 99,107, 95,116,121,112,101,  0, 42,115,116, 97, 99,107, 95,112,116,114,  0,115,116, 97, 99,107, 95,105,110,100,101,
-120,  0,108,111, 99,120,  0,108,111, 99,121,  0,111,119,110, 95,105,110,100,101,120,  0, 42,103,114,111,117,112,115,111, 99,107,
-  0,116,111, 95,105,110,100,101,120,  0, 42,108,105,110,107,  0, 42,114,101, 99,116,  0,120,115,105,122,101,  0,121,115,105,122,
-101,  0, 42,110,101,119, 95,110,111,100,101,  0,108, 97,115,116,121,  0,111,117,116,112,117,116,115,  0, 42,115,116,111,114, 97,
-103,101,  0,109,105,110,105,119,105,100,116,104,  0,108, 97, 98,101,108, 91, 51, 50, 93,  0, 99,117,115,116,111,109, 49,  0, 99,
-117,115,116,111,109, 50,  0, 99,117,115,116,111,109, 51,  0, 99,117,115,116,111,109, 52,  0,110,101,101,100, 95,101,120,101, 99,
-  0,101,120,101, 99,  0, 42,116,104,114,101, 97,100,100, 97,116, 97,  0,116,111,116,114,  0, 98,117,116,114,  0,112,114,118,114,
-  0, 42, 98,108,111, 99,107,  0, 42,116,121,112,101,105,110,102,111,  0, 42,102,114,111,109,110,111,100,101,  0, 42,116,111,110,
-111,100,101,  0, 42,102,114,111,109,115,111, 99,107,  0, 42,116,111,115,111, 99,107,  0,110,111,100,101,115,  0,108,105,110,107,
-115,  0, 42,115,116, 97, 99,107,  0, 42,116,104,114,101, 97,100,115,116, 97, 99,107,  0,105,110,105,116,  0,115,116, 97, 99,107,
-115,105,122,101,  0, 99,117,114, 95,105,110,100,101,120,  0, 97,108,108,116,121,112,101,115,  0, 40, 42,112,114,111,103,114,101,
-115,115, 41, 40, 41,  0, 40, 42,115,116, 97,116,115, 95,100,114, 97,119, 41, 40, 41,  0, 40, 42,116,101,115,116, 95, 98,114,101,
- 97,107, 41, 40, 41,  0, 42,116, 98,104,  0, 42,112,114,104,  0, 42,115,100,104,  0, 99,121, 99,108,105, 99,  0,109,111,118,105,
-101,  0,115, 97,109,112,108,101,115,  0,109, 97,120,115,112,101,101,100,  0,109,105,110,115,112,101,101,100,  0, 99,117,114,118,
-101,100,  0,112,101,114, 99,101,110,116,120,  0,112,101,114, 99,101,110,116,121,  0, 98,111,107,101,104,  0,103, 97,109,109, 97,
-  0,105,109, 97,103,101, 95,105,110, 95,119,105,100,116,104,  0,105,109, 97,103,101, 95,105,110, 95,104,101,105,103,104,116,  0,
- 99,101,110,116,101,114, 95,120,  0, 99,101,110,116,101,114, 95,121,  0,115,112,105,110,  0,119,114, 97,112,  0,115,105,103,109,
- 97, 95, 99,111,108,111,114,  0,115,105,103,109, 97, 95,115,112, 97, 99,101,  0,104,117,101,  0,116, 49,  0,116, 50,  0,116, 51,
-  0,102,115,116,114,101,110,103,116,104,  0,102, 97,108,112,104, 97,  0,107,101,121, 91, 52, 93,  0, 97,108,103,111,114,105,116,
-104,109,  0, 99,104, 97,110,110,101,108,  0,120, 49,  0,120, 50,  0,121, 49,  0,121, 50,  0,102, 97, 99, 95,120, 49,  0,102, 97,
- 99, 95,120, 50,  0,102, 97, 99, 95,121, 49,  0,102, 97, 99, 95,121, 50,  0, 99,111,108,110, 97,109,101, 91, 51, 50, 93,  0, 98,
-107,116,121,112,101,  0,114,111,116, 97,116,105,111,110,  0,103, 97,109, 99,111,  0,110,111, 95,122, 98,117,102,  0,102,115,116,
-111,112,  0,109, 97,120, 98,108,117,114,  0, 98,116,104,114,101,115,104,  0, 42,100,105, 99,116,  0, 42,110,111,100,101,  0, 97,
-110,103,108,101, 95,111,102,115,  0, 99,111,108,109,111,100,  0,109,105,120,  0,116,104,114,101,115,104,111,108,100,  0,102, 97,
-100,101,  0,109,  0, 99,  0,106,105,116,  0,112,114,111,106,  0,102,105,116,  0,115,108,111,112,101, 91, 51, 93,  0,112,111,119,
-101,114, 91, 51, 93,  0,108,105,102,116, 95,108,103,103, 91, 51, 93,  0,103, 97,109,109, 97, 95,105,110,118, 91, 51, 93,  0,108,
-105,109, 99,104, 97,110,  0,117,110,115,112,105,108,108,  0,108,105,109,115, 99, 97,108,101,  0,117,115,112,105,108,108,114,  0,
-117,115,112,105,108,108,103,  0,117,115,112,105,108,108, 98,  0,115,104,111,114,116,121,  0,109,105,110,116, 97, 98,108,101,  0,
-109, 97,120,116, 97, 98,108,101,  0,101,120,116, 95,105,110, 91, 50, 93,  0,101,120,116, 95,111,117,116, 91, 50, 93,  0, 42, 99,
-117,114,118,101,  0, 42,116, 97, 98,108,101,  0, 42,112,114,101,109,117,108,116, 97, 98,108,101,  0,112,114,101,115,101,116,  0,
- 99,104, 97,110,103,101,100, 95,116,105,109,101,115,116, 97,109,112,  0, 99,117,114,114,  0, 99,108,105,112,114,  0, 99,109, 91,
- 52, 93,  0, 98,108, 97, 99,107, 91, 51, 93,  0,119,104,105,116,101, 91, 51, 93,  0, 98,119,109,117,108, 91, 51, 93,  0,115, 97,
-109,112,108,101, 91, 51, 93,  0,120, 95,114,101,115,111,108,117,116,105,111,110,  0,100, 97,116, 97, 95,114, 91, 50, 53, 54, 93,
-  0,100, 97,116, 97, 95,103, 91, 50, 53, 54, 93,  0,100, 97,116, 97, 95, 98, 91, 50, 53, 54, 93,  0,100, 97,116, 97, 95,108,117,
-109, 97, 91, 50, 53, 54, 93,  0,115, 97,109,112,108,101, 95,102,117,108,108,  0,115, 97,109,112,108,101, 95,108,105,110,101,115,
-  0, 97, 99, 99,117,114, 97, 99,121,  0,119, 97,118,101,102,114,109, 95,109,111,100,101,  0,119, 97,118,101,102,114,109, 95, 97,
-108,112,104, 97,  0,119, 97,118,101,102,114,109, 95,121,102, 97, 99,  0,119, 97,118,101,102,114,109, 95,104,101,105,103,104,116,
-  0,118,101, 99,115, 99,111,112,101, 95, 97,108,112,104, 97,  0,118,101, 99,115, 99,111,112,101, 95,104,101,105,103,104,116,  0,
-109,105,110,109, 97,120, 91, 51, 93, 91, 50, 93,  0,104,105,115,116,  0, 42,119, 97,118,101,102,111,114,109, 95, 49,  0, 42,119,
- 97,118,101,102,111,114,109, 95, 50,  0, 42,119, 97,118,101,102,111,114,109, 95, 51,  0, 42,118,101, 99,115, 99,111,112,101,  0,
-119, 97,118,101,102,111,114,109, 95,116,111,116,  0,111,102,102,115,101,116, 91, 50, 93,  0, 99,108,111,110,101,  0,109,116,101,
-120,  0, 42,105, 99,111,110, 95,105,109, 98,117,102,  0,105, 99,111,110, 95,102,105,108,101,112, 97,116,104, 91, 50, 52, 48, 93,
-  0,110,111,114,109, 97,108, 95,119,101,105,103,104,116,  0,111, 98, 95,109,111,100,101,  0,106,105,116,116,101,114,  0,115,109,
-111,111,116,104, 95,115,116,114,111,107,101, 95,114, 97,100,105,117,115,  0,115,109,111,111,116,104, 95,115,116,114,111,107,101,
- 95,102, 97, 99,116,111,114,  0,114, 97,116,101,  0,114,103, 98, 91, 51, 93,  0,115, 99,117,108,112,116, 95,112,108, 97,110,101,
-  0,112,108, 97,110,101, 95,111,102,102,115,101,116,  0,115, 99,117,108,112,116, 95,116,111,111,108,  0,118,101,114,116,101,120,
-112, 97,105,110,116, 95,116,111,111,108,  0,105,109, 97,103,101,112, 97,105,110,116, 95,116,111,111,108,  0,112, 97,100, 51, 91,
- 53, 93,  0, 97,117,116,111,115,109,111,111,116,104, 95,102, 97, 99,116,111,114,  0, 99,114,101, 97,115,101, 95,112,105,110, 99,
-104, 95,102, 97, 99,116,111,114,  0,112,108, 97,110,101, 95,116,114,105,109,  0,116,101,120,116,117,114,101, 95,115, 97,109,112,
-108,101, 95, 98,105, 97,115,  0,116,101,120,116,117,114,101, 95,111,118,101,114,108, 97,121, 95, 97,108,112,104, 97,  0,117,110,
-112,114,111,106,101, 99,116,101,100, 95,114, 97,100,105,117,115,  0, 97,100,100, 95, 99,111,108, 91, 51, 93,  0,115,117, 98, 95,
- 99,111,108, 91, 51, 93,  0, 97, 99,116,105,118,101, 95,114,110,100,  0, 97, 99,116,105,118,101, 95, 99,108,111,110,101,  0, 97,
- 99,116,105,118,101, 95,109, 97,115,107,  0, 42,108, 97,121,101,114,115,  0,116,111,116,108, 97,121,101,114,  0,109, 97,120,108,
- 97,121,101,114,  0,116,111,116,115,105,122,101,  0, 42,112,111,111,108,  0, 42,101,120,116,101,114,110, 97,108,  0,114,111,116,
- 91, 52, 93,  0, 97,118,101, 91, 51, 93,  0, 42,103,114,111,117,110,100,  0,119, 97,110,100,101,114, 91, 51, 93,  0,114,101,115,
-116, 95,108,101,110,103,116,104,  0,112, 97,114,116,105, 99,108,101, 95,105,110,100,101,120, 91, 50, 93,  0,100,101,108,101,116,
-101, 95,102,108, 97,103,  0,110,117,109,  0,112, 97,114,101,110,116,  0,112, 97, 91, 52, 93,  0,119, 91, 52, 93,  0,102,117,118,
- 91, 52, 93,  0,102,111,102,102,115,101,116,  0,112,114,101,118, 95,115,116, 97,116,101,  0, 42,104, 97,105,114,  0, 42, 98,111,
-105,100,  0,100,105,101,116,105,109,101,  0,110,117,109, 95,100,109, 99, 97, 99,104,101,  0,104, 97,105,114, 95,105,110,100,101,
-120,  0, 97,108,105,118,101,  0,115,112,114,105,110,103, 95,107,  0,112,108, 97,115,116,105, 99,105,116,121, 95, 99,111,110,115,
-116, 97,110,116,  0,121,105,101,108,100, 95,114, 97,116,105,111,  0,112,108, 97,115,116,105, 99,105,116,121, 95, 98, 97,108, 97,
-110, 99,101,  0,121,105,101,108,100, 95, 98, 97,108, 97,110, 99,101,  0,118,105,115, 99,111,115,105,116,121, 95,111,109,101,103,
- 97,  0,118,105,115, 99,111,115,105,116,121, 95, 98,101,116, 97,  0,115,116,105,102,102,110,101,115,115, 95,107,  0,115,116,105,
-102,102,110,101,115,115, 95,107,110,101, 97,114,  0,114,101,115,116, 95,100,101,110,115,105,116,121,  0, 98,117,111,121, 97,110,
- 99,121,  0,115,112,114,105,110,103, 95,102,114, 97,109,101,115,  0, 42, 98,111,105,100,115,  0, 42,102,108,117,105,100,  0,100,
-105,115,116,114,  0,112,104,121,115,116,121,112,101,  0, 97,118,101,109,111,100,101,  0,114,101, 97, 99,116,101,118,101,110,116,
-  0,100,114, 97,119,  0,100,114, 97,119, 95, 97,115,  0,100,114, 97,119, 95,115,105,122,101,  0, 99,104,105,108,100,116,121,112,
-101,  0,114,101,110, 95, 97,115,  0,115,117, 98,102,114, 97,109,101,115,  0,100,114, 97,119, 95, 99,111,108,  0,114,101,110, 95,
-115,116,101,112,  0,104, 97,105,114, 95,115,116,101,112,  0,107,101,121,115, 95,115,116,101,112,  0, 97,100, 97,112,116, 95, 97,
-110,103,108,101,  0, 97,100, 97,112,116, 95,112,105,120,  0,114,111,116,102,114,111,109,  0,105,110,116,101,103,114, 97,116,111,
-114,  0, 98, 98, 95, 97,108,105,103,110,  0, 98, 98, 95,117,118, 95,115,112,108,105,116,  0, 98, 98, 95, 97,110,105,109,  0, 98,
- 98, 95,115,112,108,105,116, 95,111,102,102,115,101,116,  0, 98, 98, 95,116,105,108,116,  0, 98, 98, 95,114, 97,110,100, 95,116,
-105,108,116,  0, 98, 98, 95,111,102,102,115,101,116, 91, 50, 93,  0, 98, 98, 95,115,105,122,101, 91, 50, 93,  0, 98, 98, 95,118,
-101,108, 95,104,101, 97,100,  0, 98, 98, 95,118,101,108, 95,116, 97,105,108,  0, 99,111,108,111,114, 95,118,101, 99, 95,109, 97,
-120,  0,115,105,109,112,108,105,102,121, 95,114,101,102,115,105,122,101,  0,115,105,109,112,108,105,102,121, 95,114, 97,116,101,
-  0,115,105,109,112,108,105,102,121, 95,116,114, 97,110,115,105,116,105,111,110,  0,115,105,109,112,108,105,102,121, 95,118,105,
-101,119,112,111,114,116,  0,116,105,109,101,116,119,101, 97,107,  0,106,105,116,102, 97, 99,  0,101,102,102, 95,104, 97,105,114,
-  0,103,114,105,100, 95,114, 97,110,100,  0,103,114,105,100, 95,114,101,115,  0,101,102,102,101, 99,116,111,114, 95, 97,109,111,
-117,110,116,  0,112, 97,114,116,102, 97, 99,  0,116, 97,110,102, 97, 99,  0,116, 97,110,112,104, 97,115,101,  0,114,101, 97, 99,
-116,102, 97, 99,  0,111, 98, 95,118,101,108, 91, 51, 93,  0, 97,118,101,102, 97, 99,  0,112,104, 97,115,101,102, 97, 99,  0,114,
- 97,110,100,114,111,116,102, 97, 99,  0,114, 97,110,100,112,104, 97,115,101,102, 97, 99,  0,114, 97,110,100,115,105,122,101,  0,
- 97, 99, 99, 91, 51, 93,  0,100,114, 97,103,102, 97, 99,  0, 98,114,111,119,110,102, 97, 99,  0,114, 97,110,100,108,101,110,103,
-116,104,  0, 99,104,105,108,100, 95,110, 98,114,  0,114,101,110, 95, 99,104,105,108,100, 95,110, 98,114,  0,112, 97,114,101,110,
-116,115,  0, 99,104,105,108,100,115,105,122,101,  0, 99,104,105,108,100,114, 97,110,100,115,105,122,101,  0, 99,104,105,108,100,
-114, 97,100,  0, 99,104,105,108,100,102,108, 97,116,  0, 99,108,117,109,112,112,111,119,  0,107,105,110,107, 95,102,108, 97,116,
-  0,107,105,110,107, 95, 97,109,112, 95, 99,108,117,109,112,  0,114,111,117,103,104, 49,  0,114,111,117,103,104, 49, 95,115,105,
-122,101,  0,114,111,117,103,104, 50,  0,114,111,117,103,104, 50, 95,115,105,122,101,  0,114,111,117,103,104, 50, 95,116,104,114,
-101,115,  0,114,111,117,103,104, 95,101,110,100,  0,114,111,117,103,104, 95,101,110,100, 95,115,104, 97,112,101,  0, 99,108,101,
-110,103,116,104,  0, 99,108,101,110,103,116,104, 95,116,104,114,101,115,  0,112, 97,114,116,105,110,103, 95,102, 97, 99,  0,112,
- 97,114,116,105,110,103, 95,109,105,110,  0,112, 97,114,116,105,110,103, 95,109, 97,120,  0, 98,114, 97,110, 99,104, 95,116,104,
-114,101,115,  0,100,114, 97,119, 95,108,105,110,101, 91, 50, 93,  0,112, 97,116,104, 95,115,116, 97,114,116,  0,112, 97,116,104,
- 95,101,110,100,  0,116,114, 97,105,108, 95, 99,111,117,110,116,  0,107,101,121,101,100, 95,108,111,111,112,115,  0,100,117,112,
-108,105,119,101,105,103,104,116,115,  0, 42,101,102,102, 95,103,114,111,117,112,  0, 42,100,117,112, 95,111, 98,  0, 42, 98, 98,
- 95,111, 98,  0, 42,112,100, 50,  0, 42,112, 97,114,116,  0, 42,112, 97,114,116,105, 99,108,101,115,  0, 42, 42,112, 97,116,104,
- 99, 97, 99,104,101,  0, 42, 42, 99,104,105,108,100, 99, 97, 99,104,101,  0,112, 97,116,104, 99, 97, 99,104,101, 98,117,102,115,
-  0, 99,104,105,108,100, 99, 97, 99,104,101, 98,117,102,115,  0, 42, 99,108,109,100,  0, 42,104, 97,105,114, 95,105,110, 95,100,
-109,  0, 42,104, 97,105,114, 95,111,117,116, 95,100,109,  0, 42,116, 97,114,103,101,116, 95,111, 98,  0, 42,108, 97,116,116,105,
- 99,101,  0,116,114,101,101, 95,102,114, 97,109,101,  0, 98,118,104,116,114,101,101, 95,102,114, 97,109,101,  0, 99,104,105,108,
-100, 95,115,101,101,100,  0,116,111,116,117,110,101,120,105,115,116,  0,116,111,116, 99,104,105,108,100,  0,116,111,116, 99, 97,
- 99,104,101,100,  0,116,111,116, 99,104,105,108,100, 99, 97, 99,104,101,  0,116, 97,114,103,101,116, 95,112,115,121,115,  0,116,
-111,116,107,101,121,101,100,  0, 98, 97,107,101,115,112, 97, 99,101,  0, 98, 98, 95,117,118,110, 97,109,101, 91, 51, 93, 91, 51,
- 50, 93,  0,118,103,114,111,117,112, 91, 49, 50, 93,  0,118,103, 95,110,101,103,  0,114,116, 51,  0, 42,114,101,110,100,101,114,
-100, 97,116, 97,  0, 42,101,102,102,101, 99,116,111,114,115,  0, 42,102,108,117,105,100, 95,115,112,114,105,110,103,115,  0,116,
-111,116, 95,102,108,117,105,100,115,112,114,105,110,103,115,  0, 97,108,108,111, 99, 95,102,108,117,105,100,115,112,114,105,110,
-103,115,  0, 42,116,114,101,101,  0, 42,112,100,100,  0, 42,102,114, 97,110,100,  0, 67,100,105,115,  0, 67,118,105,  0,115,116,
-114,117, 99,116,117,114, 97,108,  0, 98,101,110,100,105,110,103,  0,109, 97,120, 95, 98,101,110,100,  0,109, 97,120, 95,115,116,
-114,117, 99,116,  0,109, 97,120, 95,115,104,101, 97,114,  0, 97,118,103, 95,115,112,114,105,110,103, 95,108,101,110,  0,116,105,
-109,101,115, 99, 97,108,101,  0,101,102,102, 95,102,111,114, 99,101, 95,115, 99, 97,108,101,  0,101,102,102, 95,119,105,110,100,
- 95,115, 99, 97,108,101,  0,115,105,109, 95,116,105,109,101, 95,111,108,100,  0,118,101,108,111, 99,105,116,121, 95,115,109,111,
-111,116,104,  0, 99,111,108,108,105,100,101,114, 95,102,114,105, 99,116,105,111,110,  0,115,116,101,112,115, 80,101,114, 70,114,
- 97,109,101,  0,112,114,101,114,111,108,108,  0,109, 97,120,115,112,114,105,110,103,108,101,110,  0,115,111,108,118,101,114, 95,
-116,121,112,101,  0,118,103,114,111,117,112, 95, 98,101,110,100,  0,118,103,114,111,117,112, 95,109, 97,115,115,  0,118,103,114,
-111,117,112, 95,115,116,114,117, 99,116,  0,115,104, 97,112,101,107,101,121, 95,114,101,115,116,  0,112,114,101,115,101,116,115,
-  0,114,101,115,101,116,  0, 42, 99,111,108,108,105,115,105,111,110, 95,108,105,115,116,  0,101,112,115,105,108,111,110,  0,115,
-101,108,102, 95,102,114,105, 99,116,105,111,110,  0,115,101,108,102,101,112,115,105,108,111,110,  0,114,101,112,101,108, 95,102,
-111,114, 99,101,  0,100,105,115,116, 97,110, 99,101, 95,114,101,112,101,108,  0,115,101,108,102, 95,108,111,111,112, 95, 99,111,
-117,110,116,  0,108,111,111,112, 95, 99,111,117,110,116,  0,112,114,101,115,115,117,114,101,  0,116,104,105, 99,107,110,101,115,
-115,  0,115,116,114,111,107,101,115,  0,102,114, 97,109,101,110,117,109,  0, 42, 97, 99,116,102,114, 97,109,101,  0,103,115,116,
-101,112,  0,105,110,102,111, 91, 49, 50, 56, 93,  0,115, 98,117,102,102,101,114, 95,115,105,122,101,  0,115, 98,117,102,102,101,
-114, 95,115,102,108, 97,103,  0, 42,115, 98,117,102,102,101,114,  0,108,105,115,116,  0,112,114,105,110,116,108,101,118,101,108,
-  0,115,116,111,114,101,108,101,118,101,108,  0, 42,114,101,112,111,114,116,116,105,109,101,114,  0, 42,119,105,110,100,114, 97,
-119, 97, 98,108,101,  0, 42,119,105,110, 97, 99,116,105,118,101,  0,119,105,110,100,111,119,115,  0,105,110,105,116,105, 97,108,
-105,122,101,100,  0,102,105,108,101, 95,115, 97,118,101,100,  0,111,112, 95,117,110,100,111, 95,100,101,112,116,104,  0,111,112,
-101,114, 97,116,111,114,115,  0,113,117,101,117,101,  0,114,101,112,111,114,116,115,  0,106,111, 98,115,  0,112, 97,105,110,116,
- 99,117,114,115,111,114,115,  0,100,114, 97,103,115,  0,107,101,121, 99,111,110,102,105,103,115,  0, 42,100,101,102, 97,117,108,
-116, 99,111,110,102,  0,116,105,109,101,114,115,  0, 42, 97,117,116,111,115, 97,118,101,116,105,109,101,114,  0, 42,103,104,111,
-115,116,119,105,110,  0,103,114, 97, 98, 99,117,114,115,111,114,  0, 42,115, 99,114,101,101,110,  0, 42,110,101,119,115, 99,114,
-101,101,110,  0,115, 99,114,101,101,110,110, 97,109,101, 91, 51, 50, 93,  0,112,111,115,120,  0,112,111,115,121,  0,119,105,110,
-100,111,119,115,116, 97,116,101,  0,109,111,110,105,116,111,114,  0,108, 97,115,116, 99,117,114,115,111,114,  0,109,111,100, 97,
-108, 99,117,114,115,111,114,  0, 97,100,100,109,111,117,115,101,109,111,118,101,  0, 42,101,118,101,110,116,115,116, 97,116,101,
-  0, 42, 99,117,114,115,119,105,110,  0, 42,116,119,101, 97,107,  0,100,114, 97,119,109,101,116,104,111,100,  0,100,114, 97,119,
-102, 97,105,108,  0, 42,100,114, 97,119,100, 97,116, 97,  0,109,111,100, 97,108,104, 97,110,100,108,101,114,115,  0,115,117, 98,
-119,105,110,100,111,119,115,  0,103,101,115,116,117,114,101,  0,105,100,110, 97,109,101, 91, 54, 52, 93,  0,112,114,111,112,118,
- 97,108,117,101,  0,115,104,105,102,116,  0, 99,116,114,108,  0, 97,108,116,  0,111,115,107,101,121,  0,107,101,121,109,111,100,
-105,102,105,101,114,  0,109, 97,112,116,121,112,101,  0, 42,112,116,114,  0,105,116,101,109,115,  0,115,112, 97, 99,101,105,100,
-  0,114,101,103,105,111,110,105,100,  0,107,109,105, 95,105,100,  0, 40, 42,112,111,108,108, 41, 40, 41,  0, 42,109,111,100, 97,
-108, 95,105,116,101,109,115,  0, 98, 97,115,101,110, 97,109,101, 91, 54, 52, 93,  0, 97, 99,116,107,101,121,109, 97,112,  0, 42,
- 99,117,115,116,111,109,100, 97,116, 97,  0, 42,112,121, 95,105,110,115,116, 97,110, 99,101,  0, 42,114,101,112,111,114,116,115,
-  0,109, 97, 99,114,111,  0, 42,111,112,109,  0, 42,101,100, 97,116, 97,  0,105,110,102,108,117,101,110, 99,101,  0, 42, 99,111,
-101,102,102,105, 99,105,101,110,116,115,  0, 97,114,114, 97,121,115,105,122,101,  0,112,111,108,121, 95,111,114,100,101,114,  0,
- 97,109,112,108,105,116,117,100,101,  0,112,104, 97,115,101, 95,109,117,108,116,105,112,108,105,101,114,  0,112,104, 97,115,101,
- 95,111,102,102,115,101,116,  0,118, 97,108,117,101, 95,111,102,102,115,101,116,  0,109,105,100,118, 97,108,  0, 98,101,102,111,
-114,101, 95,109,111,100,101,  0, 97,102,116,101,114, 95,109,111,100,101,  0, 98,101,102,111,114,101, 95, 99,121, 99,108,101,115,
-  0, 97,102,116,101,114, 95, 99,121, 99,108,101,115,  0,114,101, 99,116,  0,112,104, 97,115,101,  0,109,111,100,105,102,105, 99,
- 97,116,105,111,110,  0,115,116,101,112, 95,115,105,122,101,  0, 42,114,110, 97, 95,112, 97,116,104,  0,112, 99,104, 97,110, 95,
-110, 97,109,101, 91, 51, 50, 93,  0,116,114, 97,110,115, 67,104, 97,110,  0,105,100,116,121,112,101,  0,116, 97,114,103,101,116,
-115, 91, 56, 93,  0,110,117,109, 95,116, 97,114,103,101,116,115,  0,118, 97,114,105, 97, 98,108,101,115,  0,101,120,112,114,101,
-115,115,105,111,110, 91, 50, 53, 54, 93,  0, 42,101,120,112,114, 95, 99,111,109,112,  0,118,101, 99, 91, 50, 93,  0, 42,102,112,
-116,  0, 97,114,114, 97,121, 95,105,110,100,101,120,  0, 99,111,108,111,114, 95,109,111,100,101,  0, 99,111,108,111,114, 91, 51,
- 93,  0,102,114,111,109, 91, 49, 50, 56, 93,  0,116,111, 91, 49, 50, 56, 93,  0,109, 97,112,112,105,110,103,115,  0,115,116,114,
-105,112,115,  0, 42,114,101,109, 97,112,  0,102, 99,117,114,118,101,115,  0,115,116,114,105,112, 95,116,105,109,101,  0, 98,108,
-101,110,100,109,111,100,101,  0,101,120,116,101,110,100,109,111,100,101,  0,103,114,111,117,112, 91, 54, 52, 93,  0,103,114,111,
-117,112,109,111,100,101,  0,107,101,121,105,110,103,102,108, 97,103,  0,112, 97,116,104,115,  0,116,121,112,101,105,110,102,111,
- 91, 54, 52, 93,  0, 97, 99,116,105,118,101, 95,112, 97,116,104,  0, 42,116,109,112, 97, 99,116,  0,110,108, 97, 95,116,114, 97,
- 99,107,115,  0, 42, 97, 99,116,115,116,114,105,112,  0,100,114,105,118,101,114,115,  0,111,118,101,114,114,105,100,101,115,  0,
- 97, 99,116, 95, 98,108,101,110,100,109,111,100,101,  0, 97, 99,116, 95,101,120,116,101,110,100,109,111,100,101,  0, 97, 99,116,
- 95,105,110,102,108,117,101,110, 99,101,  0,114,117,108,101,  0,111,112,116,105,111,110,115,  0,102,101, 97,114, 95,102, 97, 99,
-116,111,114,  0,115,105,103,110, 97,108, 95,105,100,  0,108,111,111,107, 95, 97,104,101, 97,100,  0,111,108,111, 99, 91, 51, 93,
-  0,113,117,101,117,101, 95,115,105,122,101,  0,119, 97,110,100,101,114,  0,102,108,101,101, 95,100,105,115,116, 97,110, 99,101,
-  0,104,101, 97,108,116,104,  0,115,116, 97,116,101, 95,105,100,  0,114,117,108,101,115,  0, 99,111,110,100,105,116,105,111,110,
-115,  0, 97, 99,116,105,111,110,115,  0,114,117,108,101,115,101,116, 95,116,121,112,101,  0,114,117,108,101, 95,102,117,122,122,
-105,110,101,115,115,  0,108, 97,115,116, 95,115,116, 97,116,101, 95,105,100,  0,108, 97,110,100,105,110,103, 95,115,109,111,111,
-116,104,110,101,115,115,  0, 98, 97,110,107,105,110,103,  0, 97,103,103,114,101,115,115,105,111,110,  0, 97,105,114, 95,109,105,
-110, 95,115,112,101,101,100,  0, 97,105,114, 95,109, 97,120, 95,115,112,101,101,100,  0, 97,105,114, 95,109, 97,120, 95, 97, 99,
- 99,  0, 97,105,114, 95,109, 97,120, 95, 97,118,101,  0, 97,105,114, 95,112,101,114,115,111,110, 97,108, 95,115,112, 97, 99,101,
-  0,108, 97,110,100, 95,106,117,109,112, 95,115,112,101,101,100,  0,108, 97,110,100, 95,109, 97,120, 95,115,112,101,101,100,  0,
-108, 97,110,100, 95,109, 97,120, 95, 97, 99, 99,  0,108, 97,110,100, 95,109, 97,120, 95, 97,118,101,  0,108, 97,110,100, 95,112,
-101,114,115,111,110, 97,108, 95,115,112, 97, 99,101,  0,108, 97,110,100, 95,115,116,105, 99,107, 95,102,111,114, 99,101,  0,115,
-116, 97,116,101,115,  0, 42,115,109,100,  0, 42,102,108,117,105,100, 95,103,114,111,117,112,  0, 42, 99,111,108,108, 95,103,114,
-111,117,112,  0, 42,119,116,  0, 42,116,101,120, 95,119,116,  0, 42,116,101,120, 95,115,104, 97,100,111,119,  0, 42,115,104, 97,
-100,111,119,  0,112, 48, 91, 51, 93,  0,112, 49, 91, 51, 93,  0,100,120,  0,111,109,101,103, 97,  0,116,101,109,112, 65,109, 98,
-  0, 98,101,116, 97,  0,114,101,115, 91, 51, 93,  0, 97,109,112,108,105,102,121,  0,109, 97,120,114,101,115,  0,118,105,101,119,
-115,101,116,116,105,110,103,115,  0,110,111,105,115,101,  0,100,105,115,115, 95,112,101,114, 99,101,110,116,  0,100,105,115,115,
- 95,115,112,101,101,100,  0,114,101,115, 95,119,116, 91, 51, 93,  0,100,120, 95,119,116,  0,118, 51,100,110,117,109,  0, 99, 97,
- 99,104,101, 95, 99,111,109,112,  0, 99, 97, 99,104,101, 95,104,105,103,104, 95, 99,111,109,112,  0, 42,112,111,105,110,116, 95,
- 99, 97, 99,104,101, 91, 50, 93,  0,112,116, 99, 97, 99,104,101,115, 91, 50, 93,  0, 98,111,114,100,101,114, 95, 99,111,108,108,
-105,115,105,111,110,115,  0,116,105,109,101, 95,115, 99, 97,108,101,  0,118,111,114,116,105, 99,105,116,121,  0,118,101,108,111,
- 99,105,116,121, 91, 50, 93,  0,118,101,108, 95,109,117,108,116,105,  0,118,103,114,112, 95,104,101, 97,116, 95,115, 99, 97,108,
-101, 91, 50, 93,  0,118,103,114,111,117,112, 95,102,108,111,119,  0,118,103,114,111,117,112, 95,100,101,110,115,105,116,121,  0,
-118,103,114,111,117,112, 95,104,101, 97,116,  0, 42,112,111,105,110,116,115, 95,111,108,100,  0, 42,118,101,108,  0,109, 97,116,
- 95,111,108,100, 91, 52, 93, 91, 52, 93,  0,  0, 84, 89, 80, 69,206,  1,  0,  0, 99,104, 97,114,  0,117, 99,104, 97,114,  0,115,
-104,111,114,116,  0,117,115,104,111,114,116,  0,105,110,116,  0,108,111,110,103,  0,117,108,111,110,103,  0,102,108,111, 97,116,
-  0,100,111,117, 98,108,101,  0,118,111,105,100,  0, 76,105,110,107,  0, 76,105,110,107, 68, 97,116, 97,  0, 76,105,115,116, 66,
- 97,115,101,  0,118,101, 99, 50,115,  0,118,101, 99, 50,102,  0,114, 99,116,105,  0,114, 99,116,102,  0, 73, 68, 80,114,111,112,
-101,114,116,121, 68, 97,116, 97,  0, 73, 68, 80,114,111,112,101,114,116,121,  0, 73, 68,  0, 76,105, 98,114, 97,114,121,  0, 70,
-105,108,101, 68, 97,116, 97,  0, 80,114,101,118,105,101,119, 73,109, 97,103,101,  0, 73,112,111, 68,114,105,118,101,114,  0, 79,
- 98,106,101, 99,116,  0, 73,112,111, 67,117,114,118,101,  0, 66, 80,111,105,110,116,  0, 66,101,122, 84,114,105,112,108,101,  0,
- 73,112,111,  0, 75,101,121, 66,108,111, 99,107,  0, 75,101,121,  0, 65,110,105,109, 68, 97,116, 97,  0, 84,101,120,116, 76,105,
-110,101,  0, 84,101,120,116, 77, 97,114,107,101,114,  0, 84,101,120,116,  0, 80, 97, 99,107,101,100, 70,105,108,101,  0, 67, 97,
-109,101,114, 97,  0, 73,109, 97,103,101, 85,115,101,114,  0, 83, 99,101,110,101,  0, 73,109, 97,103,101,  0, 71, 80, 85, 84,101,
-120,116,117,114,101,  0, 97,110,105,109,  0, 82,101,110,100,101,114, 82,101,115,117,108,116,  0, 77, 84,101,120,  0, 84,101,120,
-  0, 80,108,117,103,105,110, 84,101,120,  0, 67, 66, 68, 97,116, 97,  0, 67,111,108,111,114, 66, 97,110,100,  0, 69,110,118, 77,
- 97,112,  0, 73,109, 66,117,102,  0, 80,111,105,110,116, 68,101,110,115,105,116,121,  0, 67,117,114,118,101, 77, 97,112,112,105,
-110,103,  0, 86,111,120,101,108, 68, 97,116, 97,  0, 98, 78,111,100,101, 84,114,101,101,  0, 84,101,120, 77, 97,112,112,105,110,
-103,  0, 76, 97,109,112,  0, 86,111,108,117,109,101, 83,101,116,116,105,110,103,115,  0, 77, 97,116,101,114,105, 97,108,  0, 71,
-114,111,117,112,  0, 86, 70,111,110,116,  0, 86, 70,111,110,116, 68, 97,116, 97,  0, 77,101,116, 97, 69,108,101,109,  0, 66,111,
-117,110,100, 66,111,120,  0, 77,101,116, 97, 66, 97,108,108,  0, 78,117,114, 98,  0, 67,104, 97,114, 73,110,102,111,  0, 84,101,
-120,116, 66,111,120,  0, 69,100,105,116, 78,117,114, 98,  0, 71, 72, 97,115,104,  0, 67,117,114,118,101,  0, 80, 97,116,104,  0,
- 83,101,108, 66,111,120,  0, 69,100,105,116, 70,111,110,116,  0, 77,101,115,104,  0, 77, 70, 97, 99,101,  0, 77, 84, 70, 97, 99,
-101,  0, 84, 70, 97, 99,101,  0, 77, 86,101,114,116,  0, 77, 69,100,103,101,  0, 77, 68,101,102,111,114,109, 86,101,114,116,  0,
- 77, 67,111,108,  0, 77, 83,116,105, 99,107,121,  0, 77, 83,101,108,101, 99,116,  0, 69,100,105,116, 77,101,115,104,  0, 67,117,
-115,116,111,109, 68, 97,116, 97,  0, 77,117,108,116,105,114,101,115,  0, 80, 97,114,116,105, 97,108, 86,105,115,105, 98,105,108,
-105,116,121,  0, 77, 68,101,102,111,114,109, 87,101,105,103,104,116,  0, 77, 84,101,120, 80,111,108,121,  0, 77, 76,111,111,112,
- 85, 86,  0, 77, 76,111,111,112, 67,111,108,  0, 77, 70,108,111, 97,116, 80,114,111,112,101,114,116,121,  0, 77, 73,110,116, 80,
-114,111,112,101,114,116,121,  0, 77, 83,116,114,105,110,103, 80,114,111,112,101,114,116,121,  0, 79,114,105,103, 83,112, 97, 99,
-101, 70, 97, 99,101,  0, 77, 68,105,115,112,115,  0, 77,117,108,116,105,114,101,115, 67,111,108,  0, 77,117,108,116,105,114,101,
-115, 67,111,108, 70, 97, 99,101,  0, 77,117,108,116,105,114,101,115, 70, 97, 99,101,  0, 77,117,108,116,105,114,101,115, 69,100,
-103,101,  0, 77,117,108,116,105,114,101,115, 76,101,118,101,108,  0, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 77, 97,
-112,112,105,110,103, 73,110,102,111, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 83,117, 98,115,117,114,102, 77,111,100,
-105,102,105,101,114, 68, 97,116, 97,  0, 76, 97,116,116,105, 99,101, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 67,117,
-114,118,101, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 66,117,105,108,100, 77,111,100,105,102,105,101,114, 68, 97,116,
- 97,  0, 77, 97,115,107, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 65,114,114, 97,121, 77,111,100,105,102,105,101,114,
- 68, 97,116, 97,  0, 77,105,114,114,111,114, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 69,100,103,101, 83,112,108,105,
-116, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 66,101,118,101,108, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0,
- 66, 77,101,115,104, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 83,109,111,107,101, 77,111,100,105,102,105,101,114, 68,
- 97,116, 97,  0, 83,109,111,107,101, 68,111,109, 97,105,110, 83,101,116,116,105,110,103,115,  0, 83,109,111,107,101, 70,108,111,
-119, 83,101,116,116,105,110,103,115,  0, 83,109,111,107,101, 67,111,108,108, 83,101,116,116,105,110,103,115,  0, 68,105,115,112,
-108, 97, 99,101, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 85, 86, 80,114,111,106,101, 99,116, 77,111,100,105,102,105,
-101,114, 68, 97,116, 97,  0, 68,101, 99,105,109, 97,116,101, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 83,109,111,111,
-116,104, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 67, 97,115,116, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0,
- 87, 97,118,101, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 65,114,109, 97,116,117,114,101, 77,111,100,105,102,105,101,
-114, 68, 97,116, 97,  0, 72,111,111,107, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 83,111,102,116, 98,111,100,121, 77,
-111,100,105,102,105,101,114, 68, 97,116, 97,  0, 67,108,111,116,104, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 67,108,
-111,116,104,  0, 67,108,111,116,104, 83,105,109, 83,101,116,116,105,110,103,115,  0, 67,108,111,116,104, 67,111,108,108, 83,101,
-116,116,105,110,103,115,  0, 80,111,105,110,116, 67, 97, 99,104,101,  0, 67,111,108,108,105,115,105,111,110, 77,111,100,105,102,
-105,101,114, 68, 97,116, 97,  0, 66, 86, 72, 84,114,101,101,  0, 83,117,114,102, 97, 99,101, 77,111,100,105,102,105,101,114, 68,
- 97,116, 97,  0, 68,101,114,105,118,101,100, 77,101,115,104,  0, 66, 86, 72, 84,114,101,101, 70,114,111,109, 77,101,115,104,  0,
- 66,111,111,108,101, 97,110, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 77, 68,101,102, 73,110,102,108,117,101,110, 99,
-101,  0, 77, 68,101,102, 67,101,108,108,  0, 77,101,115,104, 68,101,102,111,114,109, 77,111,100,105,102,105,101,114, 68, 97,116,
- 97,  0, 80, 97,114,116,105, 99,108,101, 83,121,115,116,101,109, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 80, 97,114,
-116,105, 99,108,101, 83,121,115,116,101,109,  0, 80, 97,114,116,105, 99,108,101, 73,110,115,116, 97,110, 99,101, 77,111,100,105,
-102,105,101,114, 68, 97,116, 97,  0, 69,120,112,108,111,100,101, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 77,117,108,
-116,105,114,101,115, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 70,108,117,105,100,115,105,109, 77,111,100,105,102,105,
-101,114, 68, 97,116, 97,  0, 70,108,117,105,100,115,105,109, 83,101,116,116,105,110,103,115,  0, 83,104,114,105,110,107,119,114,
- 97,112, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 83,105,109,112,108,101, 68,101,102,111,114,109, 77,111,100,105,102,
-105,101,114, 68, 97,116, 97,  0, 83,104, 97,112,101, 75,101,121, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 83,111,108,
-105,100,105,102,121, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 83, 99,114,101,119, 77,111,100,105,102,105,101,114, 68,
- 97,116, 97,  0, 87, 97,114,112, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 69,100,105,116, 76, 97,116,116,  0, 76, 97,
-116,116,105, 99,101,  0, 98, 68,101,102,111,114,109, 71,114,111,117,112,  0, 83, 99,117,108,112,116, 83,101,115,115,105,111,110,
-  0, 98, 65, 99,116,105,111,110,  0, 98, 80,111,115,101,  0, 98, 71, 80,100, 97,116, 97,  0, 98, 65,110,105,109, 86,105,122, 83,
-101,116,116,105,110,103,115,  0, 98, 77,111,116,105,111,110, 80, 97,116,104,  0, 66,117,108,108,101,116, 83,111,102,116, 66,111,
-100,121,  0, 80, 97,114,116, 68,101,102,108,101, 99,116,  0, 83,111,102,116, 66,111,100,121,  0, 79, 98, 72,111,111,107,  0, 68,
-117,112,108,105, 79, 98,106,101, 99,116,  0, 82, 78, 71,  0, 69,102,102,101, 99,116,111,114, 87,101,105,103,104,116,115,  0, 80,
- 84, 67, 97, 99,104,101, 69,120,116,114, 97,  0, 80, 84, 67, 97, 99,104,101, 77,101,109,  0, 80, 84, 67, 97, 99,104,101, 69,100,
-105,116,  0, 83, 66, 86,101,114,116,101,120,  0, 66,111,100,121, 80,111,105,110,116,  0, 66,111,100,121, 83,112,114,105,110,103,
-  0, 83, 66, 83, 99,114, 97,116, 99,104,  0, 70,108,117,105,100, 86,101,114,116,101,120, 86,101,108,111, 99,105,116,121,  0, 87,
-111,114,108,100,  0, 66, 97,115,101,  0, 65,118,105, 67,111,100,101, 99, 68, 97,116, 97,  0, 81,117,105, 99,107,116,105,109,101,
- 67,111,100,101, 99, 68, 97,116, 97,  0, 81,117,105, 99,107,116,105,109,101, 67,111,100,101, 99, 83,101,116,116,105,110,103,115,
-  0, 70, 70, 77,112,101,103, 67,111,100,101, 99, 68, 97,116, 97,  0, 65,117,100,105,111, 68, 97,116, 97,  0, 83, 99,101,110,101,
- 82,101,110,100,101,114, 76, 97,121,101,114,  0, 82,101,110,100,101,114, 68, 97,116, 97,  0, 82,101,110,100,101,114, 80,114,111,
-102,105,108,101,  0, 71, 97,109,101, 68,111,109,101,  0, 71, 97,109,101, 70,114, 97,109,105,110,103,  0, 71, 97,109,101, 68, 97,
-116, 97,  0, 84,105,109,101, 77, 97,114,107,101,114,  0, 80, 97,105,110,116,  0, 66,114,117,115,104,  0, 73,109, 97,103,101, 80,
- 97,105,110,116, 83,101,116,116,105,110,103,115,  0, 80, 97,114,116,105, 99,108,101, 66,114,117,115,104, 68, 97,116, 97,  0, 80,
- 97,114,116,105, 99,108,101, 69,100,105,116, 83,101,116,116,105,110,103,115,  0, 84,114, 97,110,115,102,111,114,109, 79,114,105,
-101,110,116, 97,116,105,111,110,  0, 83, 99,117,108,112,116,  0, 86, 80, 97,105,110,116,  0, 84,111,111,108, 83,101,116,116,105,
-110,103,115,  0, 98, 83,116, 97,116,115,  0, 85,110,105,116, 83,101,116,116,105,110,103,115,  0, 80,104,121,115,105, 99,115, 83,
-101,116,116,105,110,103,115,  0, 69,100,105,116,105,110,103,  0, 83, 99,101,110,101, 83,116, 97,116,115,  0, 68, 97,103, 70,111,
-114,101,115,116,  0, 66, 71,112,105, 99,  0, 82,101,103,105,111,110, 86,105,101,119, 51, 68,  0, 82,101,110,100,101,114, 73,110,
-102,111,  0, 86,105,101,119, 68,101,112,116,104,115,  0, 83,109,111,111,116,104, 86,105,101,119, 83,116,111,114,101,  0,119,109,
- 84,105,109,101,114,  0, 86,105,101,119, 51, 68,  0, 83,112, 97, 99,101, 76,105,110,107,  0, 86,105,101,119, 50, 68,  0, 83,112,
- 97, 99,101, 73,110,102,111,  0, 83,112, 97, 99,101, 73,112,111,  0, 98, 68,111,112,101, 83,104,101,101,116,  0, 83,112, 97, 99,
-101, 66,117,116,115,  0, 83,112, 97, 99,101, 83,101,113,  0, 70,105,108,101, 83,101,108,101, 99,116, 80, 97,114, 97,109,115,  0,
- 83,112, 97, 99,101, 70,105,108,101,  0, 70,105,108,101, 76,105,115,116,  0,119,109, 79,112,101,114, 97,116,111,114,  0, 70,105,
-108,101, 76, 97,121,111,117,116,  0, 83,112, 97, 99,101, 79,111,112,115,  0, 84,114,101,101, 83,116,111,114,101,  0, 84,114,101,
-101, 83,116,111,114,101, 69,108,101,109,  0, 83,112, 97, 99,101, 73,109, 97,103,101,  0, 83, 99,111,112,101,115,  0, 72,105,115,
-116,111,103,114, 97,109,  0, 83,112, 97, 99,101, 78,108, 97,  0, 83,112, 97, 99,101, 84,101,120,116,  0, 83, 99,114,105,112,116,
-  0, 83,112, 97, 99,101, 83, 99,114,105,112,116,  0, 83,112, 97, 99,101, 84,105,109,101, 67, 97, 99,104,101,  0, 83,112, 97, 99,
-101, 84,105,109,101,  0, 83,112, 97, 99,101, 78,111,100,101,  0, 83,112, 97, 99,101, 76,111,103,105, 99,  0, 83,112, 97, 99,101,
- 73,109, 97, 83,101,108,  0, 67,111,110,115,111,108,101, 76,105,110,101,  0, 83,112, 97, 99,101, 67,111,110,115,111,108,101,  0,
- 83,112, 97, 99,101, 85,115,101,114, 80,114,101,102,  0, 83,112, 97, 99,101, 83,111,117,110,100,  0, 83, 99,114, 65,114,101, 97,
-  0, 98, 83,111,117,110,100,  0,117,105, 70,111,110,116,  0,117,105, 70,111,110,116, 83,116,121,108,101,  0,117,105, 83,116,121,
-108,101,  0,117,105, 87,105,100,103,101,116, 67,111,108,111,114,115,  0,117,105, 87,105,100,103,101,116, 83,116, 97,116,101, 67,
-111,108,111,114,115,  0, 84,104,101,109,101, 85, 73,  0, 84,104,101,109,101, 83,112, 97, 99,101,  0, 84,104,101,109,101, 87,105,
-114,101, 67,111,108,111,114,  0, 98, 84,104,101,109,101,  0, 98, 65,100,100,111,110,  0, 83,111,108,105,100, 76,105,103,104,116,
-  0, 85,115,101,114, 68,101,102,  0, 98, 83, 99,114,101,101,110,  0, 83, 99,114, 86,101,114,116,  0, 83, 99,114, 69,100,103,101,
-  0, 80, 97,110,101,108,  0, 80, 97,110,101,108, 84,121,112,101,  0,117,105, 76, 97,121,111,117,116,  0, 83,112, 97, 99,101, 84,
-121,112,101,  0, 65, 82,101,103,105,111,110,  0, 65, 82,101,103,105,111,110, 84,121,112,101,  0, 70,105,108,101, 71,108,111, 98,
- 97,108,  0, 83,116,114,105,112, 69,108,101,109,  0, 83,116,114,105,112, 67,114,111,112,  0, 83,116,114,105,112, 84,114, 97,110,
-115,102,111,114,109,  0, 83,116,114,105,112, 67,111,108,111,114, 66, 97,108, 97,110, 99,101,  0, 83,116,114,105,112, 80,114,111,
-120,121,  0, 83,116,114,105,112,  0, 80,108,117,103,105,110, 83,101,113,  0, 83,101,113,117,101,110, 99,101,  0, 77,101,116, 97,
- 83,116, 97, 99,107,  0, 87,105,112,101, 86, 97,114,115,  0, 71,108,111,119, 86, 97,114,115,  0, 84,114, 97,110,115,102,111,114,
-109, 86, 97,114,115,  0, 83,111,108,105,100, 67,111,108,111,114, 86, 97,114,115,  0, 84,105,116,108,101, 67, 97,114,100, 86, 97,
-114,115,  0, 83,112,101,101,100, 67,111,110,116,114,111,108, 86, 97,114,115,  0, 69,102,102,101, 99,116,  0, 66,117,105,108,100,
- 69,102,102,  0, 80, 97,114,116, 69,102,102,  0, 80, 97,114,116,105, 99,108,101,  0, 87, 97,118,101, 69,102,102,  0, 98, 80,114,
-111,112,101,114,116,121,  0, 98, 78,101, 97,114, 83,101,110,115,111,114,  0, 98, 77,111,117,115,101, 83,101,110,115,111,114,  0,
- 98, 84,111,117, 99,104, 83,101,110,115,111,114,  0, 98, 75,101,121, 98,111, 97,114,100, 83,101,110,115,111,114,  0, 98, 80,114,
-111,112,101,114,116,121, 83,101,110,115,111,114,  0, 98, 65, 99,116,117, 97,116,111,114, 83,101,110,115,111,114,  0, 98, 68,101,
-108, 97,121, 83,101,110,115,111,114,  0, 98, 67,111,108,108,105,115,105,111,110, 83,101,110,115,111,114,  0, 98, 82, 97,100, 97,
-114, 83,101,110,115,111,114,  0, 98, 82, 97,110,100,111,109, 83,101,110,115,111,114,  0, 98, 82, 97,121, 83,101,110,115,111,114,
-  0, 98, 65,114,109, 97,116,117,114,101, 83,101,110,115,111,114,  0, 98, 77,101,115,115, 97,103,101, 83,101,110,115,111,114,  0,
- 98, 83,101,110,115,111,114,  0, 98, 67,111,110,116,114,111,108,108,101,114,  0, 98, 74,111,121,115,116,105, 99,107, 83,101,110,
-115,111,114,  0, 98, 69,120,112,114,101,115,115,105,111,110, 67,111,110,116,  0, 98, 80,121,116,104,111,110, 67,111,110,116,  0,
- 98, 65, 99,116,117, 97,116,111,114,  0, 98, 65,100,100, 79, 98,106,101, 99,116, 65, 99,116,117, 97,116,111,114,  0, 98, 65, 99,
-116,105,111,110, 65, 99,116,117, 97,116,111,114,  0, 83,111,117,110,100, 51, 68,  0, 98, 83,111,117,110,100, 65, 99,116,117, 97,
-116,111,114,  0, 98, 69,100,105,116, 79, 98,106,101, 99,116, 65, 99,116,117, 97,116,111,114,  0, 98, 83, 99,101,110,101, 65, 99,
-116,117, 97,116,111,114,  0, 98, 80,114,111,112,101,114,116,121, 65, 99,116,117, 97,116,111,114,  0, 98, 79, 98,106,101, 99,116,
- 65, 99,116,117, 97,116,111,114,  0, 98, 73,112,111, 65, 99,116,117, 97,116,111,114,  0, 98, 67, 97,109,101,114, 97, 65, 99,116,
-117, 97,116,111,114,  0, 98, 67,111,110,115,116,114, 97,105,110,116, 65, 99,116,117, 97,116,111,114,  0, 98, 71,114,111,117,112,
- 65, 99,116,117, 97,116,111,114,  0, 98, 82, 97,110,100,111,109, 65, 99,116,117, 97,116,111,114,  0, 98, 77,101,115,115, 97,103,
-101, 65, 99,116,117, 97,116,111,114,  0, 98, 71, 97,109,101, 65, 99,116,117, 97,116,111,114,  0, 98, 86,105,115,105, 98,105,108,
-105,116,121, 65, 99,116,117, 97,116,111,114,  0, 98, 84,119,111, 68, 70,105,108,116,101,114, 65, 99,116,117, 97,116,111,114,  0,
- 98, 80, 97,114,101,110,116, 65, 99,116,117, 97,116,111,114,  0, 98, 83,116, 97,116,101, 65, 99,116,117, 97,116,111,114,  0, 98,
- 65,114,109, 97,116,117,114,101, 65, 99,116,117, 97,116,111,114,  0, 71,114,111,117,112, 79, 98,106,101, 99,116,  0, 66,111,110,
-101,  0, 98, 65,114,109, 97,116,117,114,101,  0, 98, 77,111,116,105,111,110, 80, 97,116,104, 86,101,114,116,  0, 98, 80,111,115,
-101, 67,104, 97,110,110,101,108,  0, 98, 73, 75, 80, 97,114, 97,109,  0, 98, 73,116, 97,115, 99,  0, 98, 65, 99,116,105,111,110,
- 71,114,111,117,112,  0, 83,112, 97, 99,101, 65, 99,116,105,111,110,  0, 98, 65, 99,116,105,111,110, 67,104, 97,110,110,101,108,
-  0, 98, 67,111,110,115,116,114, 97,105,110,116, 67,104, 97,110,110,101,108,  0, 98, 67,111,110,115,116,114, 97,105,110,116,  0,
- 98, 67,111,110,115,116,114, 97,105,110,116, 84, 97,114,103,101,116,  0, 98, 80,121,116,104,111,110, 67,111,110,115,116,114, 97,
-105,110,116,  0, 98, 75,105,110,101,109, 97,116,105, 99, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 83,112,108,105,110,101,
- 73, 75, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 84,114, 97, 99,107, 84,111, 67,111,110,115,116,114, 97,105,110,116,  0,
- 98, 82,111,116, 97,116,101, 76,105,107,101, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 76,111, 99, 97,116,101, 76,105,107,
-101, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 83,105,122,101, 76,105,107,101, 67,111,110,115,116,114, 97,105,110,116,  0,
- 98, 83, 97,109,101, 86,111,108,117,109,101, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 84,114, 97,110,115, 76,105,107,101,
- 67,111,110,115,116,114, 97,105,110,116,  0, 98, 77,105,110, 77, 97,120, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 65, 99,
-116,105,111,110, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 76,111, 99,107, 84,114, 97, 99,107, 67,111,110,115,116,114, 97,
-105,110,116,  0, 98, 68, 97,109,112, 84,114, 97, 99,107, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 70,111,108,108,111,119,
- 80, 97,116,104, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 83,116,114,101,116, 99,104, 84,111, 67,111,110,115,116,114, 97,
-105,110,116,  0, 98, 82,105,103,105,100, 66,111,100,121, 74,111,105,110,116, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 67,
-108, 97,109,112, 84,111, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 67,104,105,108,100, 79,102, 67,111,110,115,116,114, 97,
-105,110,116,  0, 98, 84,114, 97,110,115,102,111,114,109, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 80,105,118,111,116, 67,
-111,110,115,116,114, 97,105,110,116,  0, 98, 76,111, 99, 76,105,109,105,116, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 82,
-111,116, 76,105,109,105,116, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 83,105,122,101, 76,105,109,105,116, 67,111,110,115,
-116,114, 97,105,110,116,  0, 98, 68,105,115,116, 76,105,109,105,116, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 83,104,114,
-105,110,107,119,114, 97,112, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 65, 99,116,105,111,110, 77,111,100,105,102,105,101,
-114,  0, 98, 65, 99,116,105,111,110, 83,116,114,105,112,  0, 98, 78,111,100,101, 83,116, 97, 99,107,  0, 98, 78,111,100,101, 83,
-111, 99,107,101,116,  0, 98, 78,111,100,101, 76,105,110,107,  0, 98, 78,111,100,101, 80,114,101,118,105,101,119,  0, 98, 78,111,
-100,101,  0,117,105, 66,108,111, 99,107,  0, 98, 78,111,100,101, 84,121,112,101,  0, 78,111,100,101, 73,109, 97,103,101, 65,110,
-105,109,  0, 78,111,100,101, 66,108,117,114, 68, 97,116, 97,  0, 78,111,100,101, 68, 66,108,117,114, 68, 97,116, 97,  0, 78,111,
-100,101, 66,105,108, 97,116,101,114, 97,108, 66,108,117,114, 68, 97,116, 97,  0, 78,111,100,101, 72,117,101, 83, 97,116,  0, 78,
-111,100,101, 73,109, 97,103,101, 70,105,108,101,  0, 78,111,100,101, 67,104,114,111,109, 97,  0, 78,111,100,101, 84,119,111, 88,
- 89,115,  0, 78,111,100,101, 84,119,111, 70,108,111, 97,116,115,  0, 78,111,100,101, 71,101,111,109,101,116,114,121,  0, 78,111,
-100,101, 86,101,114,116,101,120, 67,111,108,  0, 78,111,100,101, 68,101,102,111, 99,117,115,  0, 78,111,100,101, 83, 99,114,105,
-112,116, 68,105, 99,116,  0, 78,111,100,101, 71,108, 97,114,101,  0, 78,111,100,101, 84,111,110,101,109, 97,112,  0, 78,111,100,
-101, 76,101,110,115, 68,105,115,116,  0, 78,111,100,101, 67,111,108,111,114, 66, 97,108, 97,110, 99,101,  0, 78,111,100,101, 67,
-111,108,111,114,115,112,105,108,108,  0, 84,101,120, 78,111,100,101, 79,117,116,112,117,116,  0, 67,117,114,118,101, 77, 97,112,
- 80,111,105,110,116,  0, 67,117,114,118,101, 77, 97,112,  0, 66,114,117,115,104, 67,108,111,110,101,  0, 67,117,115,116,111,109,
- 68, 97,116, 97, 76, 97,121,101,114,  0, 67,117,115,116,111,109, 68, 97,116, 97, 69,120,116,101,114,110, 97,108,  0, 72, 97,105,
-114, 75,101,121,  0, 80, 97,114,116,105, 99,108,101, 75,101,121,  0, 66,111,105,100, 80, 97,114,116,105, 99,108,101,  0, 66,111,
-105,100, 68, 97,116, 97,  0, 80, 97,114,116,105, 99,108,101, 83,112,114,105,110,103,  0, 67,104,105,108,100, 80, 97,114,116,105,
- 99,108,101,  0, 80, 97,114,116,105, 99,108,101, 84, 97,114,103,101,116,  0, 80, 97,114,116,105, 99,108,101, 68,117,112,108,105,
- 87,101,105,103,104,116,  0, 80, 97,114,116,105, 99,108,101, 68, 97,116, 97,  0, 83, 80, 72, 70,108,117,105,100, 83,101,116,116,
-105,110,103,115,  0, 80, 97,114,116,105, 99,108,101, 83,101,116,116,105,110,103,115,  0, 66,111,105,100, 83,101,116,116,105,110,
-103,115,  0, 80, 97,114,116,105, 99,108,101, 67, 97, 99,104,101, 75,101,121,  0, 75, 68, 84,114,101,101,  0, 80, 97,114,116,105,
- 99,108,101, 68,114, 97,119, 68, 97,116, 97,  0, 76,105,110,107, 78,111,100,101,  0, 98, 71, 80, 68,115,112,111,105,110,116,  0,
- 98, 71, 80, 68,115,116,114,111,107,101,  0, 98, 71, 80, 68,102,114, 97,109,101,  0, 98, 71, 80, 68,108, 97,121,101,114,  0, 82,
-101,112,111,114,116, 76,105,115,116,  0,119,109, 87,105,110,100,111,119, 77, 97,110, 97,103,101,114,  0,119,109, 87,105,110,100,
-111,119,  0,119,109, 75,101,121, 67,111,110,102,105,103,  0,119,109, 69,118,101,110,116,  0,119,109, 83,117, 98, 87,105,110,100,
-111,119,  0,119,109, 71,101,115,116,117,114,101,  0,119,109, 75,101,121, 77, 97,112, 73,116,101,109,  0, 80,111,105,110,116,101,
-114, 82, 78, 65,  0,119,109, 75,101,121, 77, 97,112,  0,119,109, 79,112,101,114, 97,116,111,114, 84,121,112,101,  0, 70, 77,111,
-100,105,102,105,101,114,  0, 70, 77,111,100, 95, 71,101,110,101,114, 97,116,111,114,  0, 70, 77,111,100, 95, 70,117,110, 99,116,
-105,111,110, 71,101,110,101,114, 97,116,111,114,  0, 70, 67, 77, 95, 69,110,118,101,108,111,112,101, 68, 97,116, 97,  0, 70, 77,
-111,100, 95, 69,110,118,101,108,111,112,101,  0, 70, 77,111,100, 95, 67,121, 99,108,101,115,  0, 70, 77,111,100, 95, 80,121,116,
-104,111,110,  0, 70, 77,111,100, 95, 76,105,109,105,116,115,  0, 70, 77,111,100, 95, 78,111,105,115,101,  0, 70, 77,111,100, 95,
- 83,116,101,112,112,101,100,  0, 68,114,105,118,101,114, 84, 97,114,103,101,116,  0, 68,114,105,118,101,114, 86, 97,114,  0, 67,
-104, 97,110,110,101,108, 68,114,105,118,101,114,  0, 70, 80,111,105,110,116,  0, 70, 67,117,114,118,101,  0, 65,110,105,109, 77,
- 97,112, 80, 97,105,114,  0, 65,110,105,109, 77, 97,112,112,101,114,  0, 78,108, 97, 83,116,114,105,112,  0, 78,108, 97, 84,114,
- 97, 99,107,  0, 75, 83, 95, 80, 97,116,104,  0, 75,101,121,105,110,103, 83,101,116,  0, 65,110,105,109, 79,118,101,114,114,105,
-100,101,  0, 73,100, 65,100,116, 84,101,109,112,108, 97,116,101,  0, 66,111,105,100, 82,117,108,101,  0, 66,111,105,100, 82,117,
-108,101, 71,111, 97,108, 65,118,111,105,100,  0, 66,111,105,100, 82,117,108,101, 65,118,111,105,100, 67,111,108,108,105,115,105,
-111,110,  0, 66,111,105,100, 82,117,108,101, 70,111,108,108,111,119, 76,101, 97,100,101,114,  0, 66,111,105,100, 82,117,108,101,
- 65,118,101,114, 97,103,101, 83,112,101,101,100,  0, 66,111,105,100, 82,117,108,101, 70,105,103,104,116,  0, 66,111,105,100, 83,
-116, 97,116,101,  0, 70, 76, 85, 73, 68, 95, 51, 68,  0, 87, 84, 85, 82, 66, 85, 76, 69, 78, 67, 69,  0,  0,  0, 84, 76, 69, 78,
-  1,  0,  1,  0,  2,  0,  2,  0,  4,  0,  4,  0,  4,  0,  4,  0,  8,  0,  0,  0,  8,  0, 12,  0,  8,  0,  4,  0,  8,  0, 16,  0,
- 16,  0, 20,  0, 76,  0, 52,  0, 40,  2,  0,  0, 32,  0,140,  0, 44,  4, 92,  0, 36,  0, 56,  0, 84,  0,112,  0,124,  0, 56,  0,
- 24,  0, 40,  0,120,  0, 12,  0,104,  0, 36,  0, 48,  5,156,  1,  0,  0,  0,  0,  0,  0, 16,  1, 48,  1, 84,  1, 24,  0,  8,  3,
-168,  0,  0,  0, 84,  0, 16,  1, 32,  1,164,  0,132,  0,108,  1, 88,  0,160,  2, 76,  0, 60,  1,  0,  0,108,  0,104,  0,148,  0,
- 56,  0,  8,  0, 16,  0, 20,  0,  0,  0, 92,  1,  0,  0,  0,  0,  0,  0, 24,  1, 20,  0, 44,  0, 60,  0, 20,  0, 12,  0, 12,  0,
-  4,  0,  8,  0,  8,  0,  0,  0, 28,  0, 84,  0, 32,  0,  8,  0, 12,  0,  8,  0,  8,  0,  4,  0,  4,  0,  0,  1, 32,  0, 12,  0,
- 16,  0, 64,  0, 24,  0, 12,  0, 40,  0, 64,  0,112,  0, 80,  0,100,  0,108,  0, 80,  0,108,  0,128,  0, 76,  0, 72,  0,120,  0,
- 72,  0, 84,  0,204,  0, 48,  0,168,  0,160,  0,172,  0, 72,  0,104,  0,116,  0,196,  0,112,  0,224,  0, 64,  0, 92,  0,  0,  0,
-144,  0, 40,  0,244,  1,112,  0,  0,  0, 88,  0,  0,  0,  0,  0, 76,  0,  8,  0,  8,  0,244,  0, 88,  0,148,  1, 84,  0,108,  0,
- 72,  0, 72,  0,180,  1,120,  0,116,  0, 64,  0,128,  0, 92,  0,172,  0, 12,  0,224,  0, 40,  0,  0,  0,100,  0,156,  0, 72,  0,
- 48,  0, 20,  0,120,  0,144,  0, 88,  1,208,  0,180,  0,  0,  0, 68,  0, 20,  0, 96,  0,  0,  0, 16,  0,  0,  0,  0,  0,  0,  0,
- 12,  0,112,  1, 28,  0,176,  0,144,  0, 64,  0, 68,  0, 24,  0, 72,  0,152,  3, 56,  0, 20,  0, 16,  0,100,  0, 84,  0, 16,  0,
-204,  2, 36,  0, 16,  0,156,  0, 80,  0, 88,  0, 36,  0,152,  1, 32,  0,  8,  0, 24,  0, 56,  2,  0,  0,  0,  0, 72,  0, 68,  3,
-  0,  0,  0,  0,  0,  0,  0,  0,240,  0, 40,  0,140,  0, 48,  0,208,  0, 88,  0,216,  0,216,  0, 96,  2, 60,  0,  0,  0,120,  0,
-  0,  0,244,  0, 12,  0, 12,  0,248, 32,112, 16, 24, 16,192,  0,136,  2, 80,  2, 40,  0, 12,  0,188,  0,252,  0, 52,  0,140,  2,
- 28,  0,104,  1, 88,  0,188,  0, 96,  0, 92,  1, 16,  1, 32,  0,224,  0, 32,  0, 32,  0,112,  2,120,  1, 16,  0, 80, 30, 72,  0,
- 56,  0,144, 13,148,  0, 20,  0, 24,  0, 64,  1,  0,  0,  0,  0,  0,  0,248,  0,  0,  0, 24,  1, 88,  0, 16,  0,  8,  0, 44,  0,
-252,  0,212,  0,168,  1,216,  0, 16,  0, 12,  0, 24,  0, 52,  0, 16,  0,216,  0, 20,  0, 16,  0, 24,  0, 56,  1,  0,  0, 56,  0,
- 52,  0, 48,  0,  8,  0, 44,  0, 72,  0,104,  0, 40,  0,  8,  0, 72,  0, 44,  0, 40,  0,108,  0, 72,  0, 68,  0, 76,  0, 80,  0,
- 60,  0,128,  0, 76,  0, 60,  0, 12,  0,100,  0, 32,  0, 68,  0, 80,  0, 16,  0, 76,  0,108,  0, 84,  0, 28,  0, 96,  0, 56,  0,
- 56,  0,108,  0,140,  0,  4,  0, 20,  0, 12,  0,  8,  0, 80,  0, 24,  0, 16,  1,144,  0, 16,  0,192,  1,  4,  0, 40,  0,104,  0,
- 24,  1, 64,  0, 44,  0, 72,  0,116,  0, 60,  0,112,  0, 16,  0, 52,  0, 44,  0, 44,  0, 44,  0,  8,  0, 36,  0, 68,  0, 64,  0,
- 44,  0, 44,  0, 20,  0, 52,  0, 96,  0, 12,  0,108,  0, 92,  0, 52,  0, 28,  0, 28,  0, 28,  0, 52,  0, 20,  0, 60,  0,140,  0,
- 36,  0,124,  0, 32,  0, 12,  0,212,  0,  0,  0,  0,  0, 16,  0, 40,  0, 28,  0, 12,  0, 12,  0, 16,  1, 44,  0, 24,  0,  8,  0,
- 64,  0, 32,  0, 24,  0,  8,  0, 24,  0, 32,  0,  8,  0, 96,  0, 20,  0, 32,  0, 12,  0, 44,  0, 20,  0, 68,  0,240,  0, 24,  0,
- 56,  0, 52,  0, 20,  0, 16,  0, 64,  0, 28,  0, 20,  0,180,  0, 60,  0, 64,  2, 96,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16,  0,
- 20,  0, 24,  0,172,  0, 28,  0,168,  0,148,  0,152,  0,  0,  0,  0,  0,  0,  0,104,  0,  0,  0, 96,  0,  0,  0,104,  0, 20,  0,
- 24,  0, 16,  0, 20,  0,  8,  0,  8,  0, 24,  0, 20,  0, 20,  0, 48,  0,208,  1, 28,  1, 16,  0, 68,  0,  0,  1, 20,  0,160,  0,
- 88,  0, 96,  0,152,  0, 20,  0, 56,  0, 48,  0, 68,  0, 56,  0, 92,  0, 64,  0, 56,  0, 96,  0,  0,  0,  0,  0, 83, 84, 82, 67,
-149,  1,  0,  0, 10,  0,  2,  0, 10,  0,  0,  0, 10,  0,  1,  0, 11,  0,  3,  0, 11,  0,  0,  0, 11,  0,  1,  0,  9,  0,  2,  0,
- 12,  0,  2,  0,  9,  0,  3,  0,  9,  0,  4,  0, 13,  0,  2,  0,  2,  0,  5,  0,  2,  0,  6,  0, 14,  0,  2,  0,  7,  0,  5,  0,
-  7,  0,  6,  0, 15,  0,  4,  0,  4,  0,  7,  0,  4,  0,  8,  0,  4,  0,  9,  0,  4,  0, 10,  0, 16,  0,  4,  0,  7,  0,  7,  0,
-  7,  0,  8,  0,  7,  0,  9,  0,  7,  0, 10,  0, 17,  0,  4,  0,  9,  0, 11,  0, 12,  0, 12,  0,  4,  0, 13,  0,  4,  0, 14,  0,
- 18,  0, 10,  0, 18,  0,  0,  0, 18,  0,  1,  0,  0,  0, 15,  0,  0,  0, 16,  0,  2,  0, 17,  0,  0,  0, 18,  0,  4,  0, 19,  0,
- 17,  0, 20,  0,  4,  0, 21,  0,  4,  0, 22,  0, 19,  0,  9,  0,  9,  0,  0,  0,  9,  0,  1,  0, 19,  0, 23,  0, 20,  0, 24,  0,
-  0,  0, 25,  0,  2,  0, 26,  0,  2,  0, 17,  0,  4,  0, 27,  0, 18,  0, 28,  0, 20,  0,  8,  0, 19,  0, 29,  0, 19,  0, 30,  0,
- 21,  0, 31,  0,  0,  0, 32,  0,  0,  0, 33,  0,  4,  0, 34,  0,  4,  0, 35,  0, 20,  0, 36,  0, 22,  0,  5,  0,  4,  0, 37,  0,
-  4,  0, 38,  0,  2,  0, 39,  0,  2,  0, 40,  0,  4,  0, 41,  0, 23,  0,  6,  0, 24,  0, 42,  0,  2,  0, 43,  0,  2,  0, 44,  0,
-  2,  0, 15,  0,  2,  0, 17,  0,  0,  0, 45,  0, 25,  0, 21,  0, 25,  0,  0,  0, 25,  0,  1,  0, 26,  0, 46,  0, 27,  0, 47,  0,
- 16,  0, 48,  0, 16,  0, 49,  0,  2,  0, 43,  0,  2,  0, 44,  0,  2,  0, 50,  0,  2,  0, 51,  0,  2,  0, 52,  0,  2,  0, 53,  0,
-  2,  0, 17,  0,  2,  0, 54,  0,  7,  0,  9,  0,  7,  0, 10,  0,  4,  0, 55,  0,  7,  0, 56,  0,  7,  0, 57,  0,  7,  0, 58,  0,
- 23,  0, 59,  0, 28,  0,  7,  0, 19,  0, 29,  0, 12,  0, 60,  0, 16,  0, 61,  0,  2,  0, 43,  0,  2,  0, 62,  0,  2,  0, 63,  0,
-  2,  0, 35,  0, 29,  0, 16,  0, 29,  0,  0,  0, 29,  0,  1,  0,  7,  0, 64,  0,  7,  0, 58,  0,  2,  0, 15,  0,  2,  0, 44,  0,
-  2,  0, 65,  0,  2,  0, 17,  0,  4,  0, 66,  0,  4,  0, 67,  0,  9,  0,  2,  0,  7,  0, 68,  0,  0,  0, 18,  0,  0,  0, 69,  0,
-  7,  0, 70,  0,  7,  0, 71,  0, 30,  0, 13,  0, 19,  0, 29,  0, 31,  0, 72,  0, 29,  0, 73,  0,  0,  0, 74,  0,  4,  0, 75,  0,
-  7,  0, 58,  0, 12,  0, 76,  0, 28,  0, 77,  0, 19,  0, 78,  0,  2,  0, 15,  0,  2,  0, 79,  0,  2,  0, 80,  0,  2,  0, 17,  0,
- 32,  0,  6,  0, 32,  0,  0,  0, 32,  0,  1,  0,  0,  0, 81,  0,  0,  0, 82,  0,  4,  0, 21,  0,  4,  0, 83,  0, 33,  0, 10,  0,
- 33,  0,  0,  0, 33,  0,  1,  0,  4,  0, 84,  0,  4,  0, 85,  0,  4,  0, 86,  0,  4,  0, 87,  0,  4,  0, 12,  0,  4,  0, 88,  0,
-  0,  0, 89,  0,  0,  0, 90,  0, 34,  0, 15,  0, 19,  0, 29,  0,  0,  0, 91,  0,  4,  0, 88,  0,  4,  0, 92,  0, 12,  0, 93,  0,
- 32,  0, 94,  0, 32,  0, 95,  0,  4,  0, 96,  0,  4,  0, 97,  0, 12,  0, 98,  0,  0,  0, 99,  0,  4,  0,100,  0,  4,  0,101,  0,
-  9,  0,102,  0,  8,  0,103,  0, 35,  0,  3,  0,  4,  0,104,  0,  4,  0,105,  0,  9,  0,  2,  0, 36,  0, 16,  0, 19,  0, 29,  0,
- 31,  0, 72,  0,  0,  0, 15,  0,  0,  0,106,  0,  2,  0, 17,  0,  7,  0,107,  0,  7,  0,108,  0,  7,  0,109,  0,  7,  0,110,  0,
-  7,  0,111,  0,  7,  0,112,  0,  7,  0,113,  0,  7,  0,114,  0,  7,  0,115,  0, 28,  0, 77,  0, 24,  0,116,  0, 37,  0, 14,  0,
- 38,  0,117,  0,  4,  0,118,  0,  4,  0,119,  0,  4,  0,120,  0,  4,  0,121,  0,  0,  0,122,  0,  0,  0,123,  0,  0,  0,124,  0,
-  0,  0, 35,  0,  2,  0,125,  0,  2,  0,126,  0,  2,  0,127,  0,  2,  0, 17,  0,  4,  0, 67,  0, 39,  0, 33,  0, 19,  0, 29,  0,
-  0,  0, 32,  0, 12,  0,128,  0, 40,  0,129,  0, 41,  0,130,  0, 42,  0,131,  0, 42,  0,132,  0,  2,  0,133,  0,  2,  0,134,  0,
-  2,  0,124,  0,  2,  0, 17,  0,  2,  0,135,  0,  2,  0, 15,  0,  4,  0,136,  0,  2,  0,137,  0,  2,  0,138,  0,  2,  0,139,  0,
-  2,  0,140,  0,  2,  0,141,  0,  2,  0,142,  0,  4,  0,143,  0,  4,  0,144,  0, 35,  0,145,  0, 22,  0,146,  0,  7,  0,147,  0,
-  4,  0,148,  0,  2,  0,149,  0,  2,  0,150,  0,  2,  0,151,  0,  0,  0,152,  0,  0,  0,153,  0,  7,  0,154,  0,  7,  0,155,  0,
- 43,  0, 65,  0,  2,  0,156,  0,  2,  0,157,  0,  2,  0,158,  0,  2,  0,159,  0, 24,  0,160,  0, 44,  0,161,  0,  0,  0,162,  0,
-  0,  0,163,  0,  0,  0,164,  0,  0,  0,165,  0,  0,  0,166,  0,  7,  0,167,  0,  7,  0,168,  0,  7,  0,169,  0,  2,  0,170,  0,
-  2,  0,171,  0,  2,  0,172,  0,  2,  0,173,  0,  2,  0,174,  0,  2,  0,175,  0,  0,  0,176,  0,  0,  0,177,  0,  7,  0,178,  0,
-  7,  0,179,  0,  7,  0,180,  0,  7,  0,181,  0,  7,  0,182,  0,  7,  0, 54,  0,  7,  0,183,  0,  7,  0,184,  0,  7,  0,185,  0,
-  7,  0,186,  0,  7,  0,187,  0,  7,  0,188,  0,  7,  0,189,  0,  7,  0,190,  0,  7,  0,191,  0,  7,  0,192,  0,  7,  0,193,  0,
-  7,  0,194,  0,  7,  0,195,  0,  7,  0,196,  0,  7,  0,197,  0,  7,  0,198,  0,  7,  0,199,  0,  7,  0,200,  0,  7,  0,201,  0,
-  7,  0,202,  0,  7,  0,203,  0,  7,  0,204,  0,  7,  0,205,  0,  7,  0,206,  0,  7,  0,207,  0,  7,  0,208,  0,  7,  0,209,  0,
-  7,  0,210,  0,  7,  0,211,  0,  7,  0,212,  0,  7,  0,213,  0,  7,  0,214,  0,  7,  0,215,  0,  7,  0,216,  0,  7,  0,217,  0,
-  7,  0,218,  0,  7,  0,219,  0, 45,  0, 15,  0,  0,  0,220,  0,  9,  0,221,  0,  0,  0,222,  0,  0,  0,223,  0,  4,  0,224,  0,
-  4,  0,225,  0,  9,  0,226,  0,  7,  0,227,  0,  7,  0,228,  0,  7,  0,229,  0,  4,  0,230,  0,  9,  0,231,  0,  9,  0,232,  0,
-  4,  0,233,  0,  4,  0, 35,  0, 46,  0,  6,  0,  7,  0,178,  0,  7,  0,179,  0,  7,  0,180,  0,  7,  0,234,  0,  7,  0, 64,  0,
-  4,  0, 61,  0, 47,  0,  5,  0,  2,  0, 17,  0,  2,  0, 34,  0,  2,  0, 61,  0,  2,  0,235,  0, 46,  0,229,  0, 48,  0, 17,  0,
- 24,  0,160,  0, 39,  0,236,  0, 49,  0,237,  0,  7,  0,238,  0,  7,  0,239,  0,  2,  0, 15,  0,  2,  0,240,  0,  7,  0,108,  0,
-  7,  0,109,  0,  7,  0,241,  0,  4,  0,242,  0,  2,  0,243,  0,  2,  0,244,  0,  4,  0,124,  0,  4,  0,136,  0,  2,  0,245,  0,
-  2,  0,246,  0, 50,  0, 25,  0,  2,  0, 17,  0,  2,  0,247,  0,  7,  0,248,  0,  7,  0,249,  0,  2,  0,135,  0,  2,  0,250,  0,
-  4,  0,251,  0,  4,  0,252,  0, 24,  0,160,  0,  4,  0,253,  0,  2,  0,254,  0,  2,  0,255,  0,  9,  0,  0,  1,  7,  0,  1,  1,
-  7,  0,  2,  1,  2,  0,  3,  1,  2,  0,  4,  1,  2,  0,  5,  1,  2,  0,  6,  1,  7,  0,  7,  1,  7,  0,  8,  1,  7,  0,  9,  1,
-  7,  0, 10,  1, 47,  0, 11,  1, 51,  0, 12,  1, 52,  0, 13,  0,  4,  0, 13,  1,  4,  0, 14,  1,  2,  0, 15,  1,  2,  0, 17,  0,
-  2,  0, 16,  1,  2,  0, 17,  1, 24,  0,160,  0,  7,  0, 18,  1,  4,  0, 19,  1,  0,  0, 20,  1,  7,  0, 21,  1,  4,  0, 22,  1,
-  4,  0,124,  0, 44,  0, 63,  0, 19,  0, 29,  0, 31,  0, 72,  0,  7,  0, 23,  1,  7,  0, 24,  1,  7,  0, 25,  1,  7,  0, 26,  1,
-  7,  0, 27,  1,  7,  0, 28,  1,  7,  0, 29,  1,  7,  0, 30,  1,  7,  0, 31,  1,  7,  0, 67,  0,  7,  0, 32,  1,  7,  0, 33,  1,
-  7,  0, 34,  1,  7,  0, 35,  1,  7,  0, 36,  1,  7,  0, 37,  1,  7,  0, 38,  1,  7,  0, 39,  1,  7,  0, 40,  1,  7,  0, 41,  1,
-  7,  0, 42,  1,  7,  0, 43,  1,  2,  0, 44,  1,  2,  0, 45,  1,  2,  0, 46,  1,  2,  0, 47,  1,  2,  0, 48,  1,  2,  0, 49,  1,
-  2,  0, 50,  1,  2,  0, 17,  0,  2,  0, 15,  0,  2,  0,240,  0,  7,  0, 51,  1,  7,  0, 52,  1,  7,  0, 53,  1,  7,  0, 54,  1,
-  4,  0, 55,  1,  4,  0, 56,  1,  2,  0, 57,  1,  2,  0, 58,  1,  2,  0, 16,  1,  2,  0,122,  0,  4,  0, 21,  0,  4,  0,119,  0,
-  4,  0,120,  0,  4,  0,121,  0,  7,  0, 59,  1,  7,  0, 60,  1,  7,  0, 87,  0, 37,  0, 61,  1, 53,  0, 62,  1, 28,  0, 77,  0,
- 39,  0,236,  0, 45,  0, 63,  1, 47,  0, 11,  1, 48,  0, 64,  1, 22,  0,146,  0, 50,  0, 65,  1, 52,  0, 66,  1,  0,  0, 67,  1,
-  0,  0,177,  0, 54,  0,  8,  0,  7,  0, 68,  1,  7,  0, 69,  1,  7,  0,168,  0,  4,  0, 17,  0,  7,  0, 70,  1,  7,  0, 71,  1,
-  7,  0, 72,  1, 24,  0, 42,  0, 55,  0, 72,  0, 19,  0, 29,  0, 31,  0, 72,  0,  2,  0, 15,  0,  2,  0, 17,  0,  4,  0, 73,  1,
-  2,  0,171,  0,  2,  0, 74,  1,  7,  0,178,  0,  7,  0,179,  0,  7,  0,180,  0,  7,  0,181,  0,  7,  0, 75,  1,  7,  0, 76,  1,
-  7,  0, 77,  1,  7,  0, 78,  1,  7,  0, 79,  1,  7,  0, 80,  1,  7,  0, 81,  1,  7,  0, 82,  1,  7,  0, 83,  1,  7,  0, 84,  1,
-  7,  0, 85,  1, 51,  0, 86,  1,  2,  0,247,  0,  2,  0, 67,  0,  7,  0,108,  0,  7,  0,109,  0,  7,  0, 87,  1,  7,  0, 88,  1,
-  7,  0, 89,  1,  7,  0, 90,  1,  7,  0, 91,  1,  2,  0, 92,  1,  2,  0, 93,  1,  2,  0, 94,  1,  2,  0, 95,  1,  0,  0, 96,  1,
-  0,  0, 97,  1,  2,  0, 98,  1,  2,  0, 99,  1,  2,  0,100,  1,  2,  0,101,  1,  2,  0,102,  1,  7,  0,103,  1,  7,  0,104,  1,
-  7,  0,105,  1,  7,  0,106,  1,  2,  0,107,  1,  2,  0, 87,  0,  2,  0,108,  1,  2,  0,109,  1,  2,  0,110,  1,  2,  0,111,  1,
-  7,  0,112,  1,  7,  0,113,  1,  7,  0,114,  1,  7,  0,115,  1,  7,  0,116,  1,  7,  0,117,  1,  7,  0,118,  1,  7,  0,119,  1,
-  7,  0,120,  1,  7,  0,121,  1,  7,  0,122,  1,  7,  0,123,  1,  2,  0,124,  1,  0,  0,125,  1, 28,  0, 77,  0, 43,  0,126,  1,
-  2,  0,127,  1,  0,  0,128,  1, 22,  0,146,  0, 56,  0, 18,  0,  7,  0,129,  1,  7,  0,130,  1,  7,  0,131,  1,  7,  0,132,  1,
-  7,  0,133,  1,  7,  0,134,  1,  7,  0,135,  1,  7,  0,136,  1,  7,  0,137,  1,  7,  0,138,  1,  2,  0,139,  1,  2,  0,140,  1,
-  2,  0,141,  1,  2,  0,142,  1,  7,  0,143,  1,  7,  0,144,  1,  7,  0,145,  1,  7,  0,146,  1, 57,  0,125,  0, 19,  0, 29,  0,
- 31,  0, 72,  0,  2,  0,147,  1,  2,  0, 17,  0,  7,  0,178,  0,  7,  0,179,  0,  7,  0,180,  0,  7,  0,148,  1,  7,  0,149,  1,
-  7,  0,150,  1,  7,  0,151,  1,  7,  0,152,  1,  7,  0,153,  1,  7,  0,154,  1,  7,  0,155,  1,  7,  0,156,  1,  7,  0,157,  1,
-  7,  0,158,  1,  7,  0,159,  1,  7,  0,160,  1,  7,  0,161,  1,  7,  0,162,  1,  7,  0,163,  1,  7,  0,164,  1,  7,  0,165,  1,
-  7,  0,166,  1,  7,  0,167,  1, 56,  0,168,  1,  7,  0,169,  1,  7,  0,170,  1,  7,  0,171,  1,  7,  0,172,  1,  7,  0,173,  1,
-  7,  0,174,  1,  7,  0,175,  1,  2,  0,176,  1,  2,  0,177,  1,  2,  0,178,  1,  0,  0,179,  1,  0,  0,180,  1,  7,  0,181,  1,
-  7,  0,182,  1,  2,  0,183,  1,  2,  0,184,  1,  7,  0,185,  1,  7,  0,186,  1,  7,  0,187,  1,  7,  0,188,  1,  2,  0,189,  1,
-  2,  0,190,  1,  4,  0, 73,  1,  4,  0,191,  1,  2,  0,192,  1,  2,  0,193,  1,  2,  0,194,  1,  2,  0,195,  1,  7,  0,196,  1,
-  7,  0,197,  1,  7,  0,198,  1,  7,  0,199,  1,  7,  0,200,  1,  7,  0,201,  1,  7,  0,202,  1,  7,  0,203,  1,  7,  0,204,  1,
-  7,  0,205,  1,  0,  0,206,  1,  7,  0,207,  1,  7,  0,208,  1,  7,  0,209,  1,  4,  0,210,  1,  0,  0,211,  1,  0,  0,108,  1,
-  0,  0,212,  1,  0,  0, 67,  1,  2,  0,213,  1,  2,  0,214,  1,  2,  0,127,  1,  2,  0,215,  1,  2,  0,216,  1,  2,  0,217,  1,
-  7,  0,218,  1,  7,  0,219,  1,  7,  0,220,  1,  7,  0,221,  1,  7,  0,222,  1,  2,  0,156,  0,  2,  0,157,  0, 47,  0,223,  1,
- 47,  0,224,  1,  0,  0,225,  1,  0,  0,226,  1,  0,  0,227,  1,  0,  0,228,  1,  2,  0,229,  1,  2,  0,230,  1,  7,  0,231,  1,
-  7,  0,232,  1, 43,  0,126,  1, 53,  0, 62,  1, 28,  0, 77,  0, 58,  0,233,  1, 22,  0,146,  0,  7,  0,234,  1,  7,  0,235,  1,
-  7,  0,236,  1,  7,  0,237,  1,  7,  0,238,  1,  2,  0,239,  1,  2,  0, 67,  0,  7,  0,240,  1,  7,  0,241,  1,  7,  0,242,  1,
-  7,  0,243,  1,  7,  0,244,  1,  7,  0,245,  1,  7,  0,246,  1,  7,  0,247,  1,  7,  0,248,  1,  2,  0,249,  1,  2,  0,250,  1,
-  4,  0,251,  1,  2,  0,252,  1,  2,  0,253,  1, 12,  0,254,  1, 59,  0,  4,  0, 19,  0, 29,  0,  0,  0,255,  1, 60,  0,  2,  0,
- 35,  0,145,  0, 61,  0, 26,  0, 61,  0,  0,  0, 61,  0,  1,  0, 62,  0,  0,  2,  4,  0,  1,  2,  4,  0,  2,  2,  4,  0,  3,  2,
-  4,  0,  4,  2,  4,  0,  5,  2,  4,  0,  6,  2,  2,  0, 15,  0,  2,  0, 17,  0,  2,  0,  7,  2,  2,  0,  8,  2,  7,  0,  5,  0,
-  7,  0,  6,  0,  7,  0,  9,  2,  7,  0, 10,  2,  7,  0, 11,  2,  7,  0, 12,  2,  7,  0, 13,  2,  7,  0, 14,  2,  7,  0, 15,  2,
-  7,  0, 16,  2,  7,  0, 21,  0,  7,  0, 17,  2,  7,  0, 18,  2, 63,  0, 20,  0, 19,  0, 29,  0, 31,  0, 72,  0, 62,  0,  0,  2,
- 12,  0, 19,  2, 12,  0, 20,  2, 12,  0, 21,  2, 28,  0, 77,  0, 57,  0, 22,  2,  0,  0, 17,  0,  0,  0, 23,  2,  2,  0, 24,  2,
-  2,  0,170,  0,  2,  0, 35,  0,  7,  0, 68,  1,  7,  0,168,  0,  7,  0, 69,  1,  7,  0, 25,  2,  7,  0, 26,  2,  7,  0, 27,  2,
- 61,  0, 28,  2, 27,  0, 11,  0,  7,  0, 29,  2,  7,  0, 30,  2,  7,  0, 31,  2,  7,  0,249,  0,  2,  0, 52,  0,  0,  0, 32,  2,
-  0,  0, 33,  2,  0,  0, 34,  2,  0,  0, 35,  2,  0,  0, 36,  2,  0,  0, 37,  2, 26,  0,  7,  0,  7,  0, 38,  2,  7,  0, 30,  2,
-  7,  0, 31,  2,  2,  0, 34,  2,  2,  0, 37,  2,  7,  0,249,  0,  7,  0, 35,  0, 64,  0, 21,  0, 64,  0,  0,  0, 64,  0,  1,  0,
-  2,  0, 15,  0,  2,  0, 39,  2,  2,  0, 37,  2,  2,  0, 17,  0,  2,  0, 40,  2,  2,  0, 41,  2,  2,  0, 42,  2,  2,  0, 43,  2,
-  2,  0, 44,  2,  2,  0, 45,  2,  2,  0, 46,  2,  2,  0, 47,  2,  7,  0, 48,  2,  7,  0, 49,  2, 26,  0, 46,  0, 27,  0, 47,  0,
-  2,  0, 50,  2,  2,  0, 51,  2,  4,  0, 52,  2, 65,  0,  5,  0,  2,  0, 53,  2,  2,  0, 39,  2,  0,  0, 17,  0,  0,  0, 35,  0,
-  2,  0, 67,  0, 66,  0,  4,  0,  7,  0,  5,  0,  7,  0,  6,  0,  7,  0, 54,  2,  7,  0, 55,  2, 67,  0,  4,  0, 12,  0, 56,  2,
- 68,  0, 57,  2,  4,  0, 58,  2,  0,  0, 90,  0, 69,  0, 68,  0, 19,  0, 29,  0, 31,  0, 72,  0, 62,  0,  0,  2, 12,  0, 59,  2,
- 12,  0, 20,  2, 67,  0, 60,  2, 24,  0, 61,  2, 24,  0, 62,  2, 24,  0, 63,  2, 28,  0, 77,  0, 70,  0, 64,  2, 30,  0, 65,  2,
- 57,  0, 22,  2, 12,  0, 66,  2,  7,  0, 68,  1,  7,  0,168,  0,  7,  0, 69,  1,  2,  0,170,  0,  2,  0, 87,  0,  2,  0, 67,  2,
-  2,  0, 68,  2,  7,  0, 69,  2,  7,  0, 70,  2,  4,  0, 71,  2,  2,  0, 35,  0,  2,  0, 24,  2,  2,  0, 17,  0,  2,  0, 72,  2,
-  7,  0, 73,  2,  7,  0, 74,  2,  7,  0, 75,  2,  2,  0, 42,  2,  2,  0, 43,  2,  2,  0, 76,  2,  2,  0, 77,  2,  4,  0, 78,  2,
-  9,  0, 79,  2,  2,  0, 21,  0,  2,  0, 93,  0,  2,  0, 64,  0,  2,  0, 80,  2,  7,  0, 81,  2,  7,  0, 82,  2,  7,  0, 83,  2,
-  7,  0, 84,  2,  7,  0, 85,  2,  7,  0, 86,  2,  7,  0, 87,  2,  7,  0, 88,  2,  7,  0, 89,  2,  7,  0, 90,  2,  0,  0, 91,  2,
- 71,  0, 92,  2, 72,  0, 93,  2,  0,  0, 94,  2, 59,  0, 95,  2, 59,  0, 96,  2, 59,  0, 97,  2, 59,  0, 98,  2,  4,  0, 99,  2,
-  7,  0,100,  2,  4,  0,101,  2,  4,  0,102,  2, 66,  0,103,  2,  4,  0,104,  2,  4,  0,105,  2, 65,  0,106,  2, 65,  0,107,  2,
- 73,  0, 39,  0, 19,  0, 29,  0, 31,  0, 72,  0, 62,  0,  0,  2, 28,  0, 77,  0, 30,  0, 65,  2, 57,  0, 22,  2, 74,  0,108,  2,
- 75,  0,109,  2, 76,  0,110,  2, 77,  0,111,  2, 78,  0,112,  2, 79,  0,113,  2, 80,  0,114,  2, 81,  0,115,  2, 73,  0,116,  2,
- 82,  0,117,  2, 83,  0,118,  2, 84,  0,119,  2, 84,  0,120,  2, 84,  0,121,  2,  4,  0, 51,  0,  4,  0,122,  2,  4,  0,123,  2,
-  4,  0,124,  2,  4,  0,125,  2,  7,  0, 68,  1,  7,  0,168,  0,  7,  0, 69,  1,  2,  0,170,  0,  2,  0, 67,  2,  2,  0,126,  2,
-  2,  0, 17,  0,  2,  0,127,  2,  2,  0,128,  2,  0,  0,129,  2,  0,  0,130,  2,  2,  0, 24,  2, 85,  0,131,  2, 86,  0,132,  2,
- 76,  0,  8,  0,  9,  0,133,  2,  7,  0,134,  2,  4,  0,135,  2,  0,  0, 17,  0,  0,  0,136,  2,  2,  0, 73,  1,  2,  0,137,  2,
-  2,  0,138,  2, 74,  0,  7,  0,  4,  0,139,  2,  4,  0,140,  2,  4,  0,141,  2,  4,  0,142,  2,  2,  0, 39,  2,  0,  0,143,  2,
-  0,  0, 17,  0, 78,  0,  5,  0,  4,  0,139,  2,  4,  0,140,  2,  0,  0,144,  2,  0,  0,145,  2,  2,  0, 17,  0, 87,  0,  2,  0,
-  4,  0,146,  2,  7,  0, 31,  2, 79,  0,  3,  0, 87,  0,147,  2,  4,  0,148,  2,  4,  0, 17,  0, 77,  0,  4,  0,  7,  0,149,  2,
-  2,  0,150,  2,  0,  0, 17,  0,  0,  0,145,  2, 80,  0,  4,  0,  0,  0,234,  0,  0,  0,178,  0,  0,  0,179,  0,  0,  0,180,  0,
- 88,  0,  6,  0, 39,  0,133,  2,  0,  0, 17,  0,  0,  0,136,  2,  2,  0, 73,  1,  2,  0,137,  2,  2,  0,138,  2, 89,  0,  1,  0,
-  7,  0,151,  2, 90,  0,  5,  0,  0,  0,234,  0,  0,  0,178,  0,  0,  0,179,  0,  0,  0,180,  0,  4,  0, 35,  0, 81,  0,  1,  0,
-  7,  0,152,  2, 82,  0,  2,  0,  4,  0,253,  1,  4,  0, 15,  0, 75,  0,  7,  0,  7,  0,134,  2, 39,  0,133,  2,  0,  0, 17,  0,
-  0,  0,136,  2,  2,  0, 73,  1,  2,  0,137,  2,  2,  0,138,  2, 91,  0,  1,  0,  7,  0,153,  2, 92,  0,  1,  0,  4,  0,154,  2,
- 93,  0,  1,  0,  0,  0,155,  2, 94,  0,  1,  0,  7,  0,134,  2, 95,  0,  3,  0,  4,  0,156,  2,  0,  0, 90,  0,  7,  0,157,  2,
- 96,  0,  4,  0,  7,  0,234,  0,  7,  0,178,  0,  7,  0,179,  0,  7,  0,180,  0, 97,  0,  1,  0, 96,  0,135,  2, 98,  0,  5,  0,
-  4,  0,158,  2,  4,  0,159,  2,  0,  0, 17,  0,  0,  0, 39,  2,  0,  0,160,  2, 99,  0,  2,  0,  4,  0,161,  2,  4,  0,159,  2,
-100,  0, 10,  0,100,  0,  0,  0,100,  0,  1,  0, 98,  0,162,  2, 97,  0,163,  2, 99,  0,164,  2,  4,  0, 51,  0,  4,  0,123,  2,
-  4,  0,122,  2,  4,  0, 35,  0, 77,  0,165,  2, 85,  0, 14,  0, 12,  0,166,  2, 77,  0,165,  2,  0,  0,167,  2,  0,  0,168,  2,
-  0,  0,169,  2,  0,  0,170,  2,  0,  0,171,  2,  0,  0,172,  2,  0,  0,173,  2,  0,  0, 17,  0, 84,  0,119,  2, 84,  0,121,  2,
-  2,  0,174,  2,  0,  0,175,  2, 86,  0,  8,  0,  4,  0,176,  2,  4,  0,177,  2, 74,  0,178,  2, 78,  0,179,  2,  4,  0,123,  2,
-  4,  0,122,  2,  4,  0, 51,  0,  4,  0, 35,  0,101,  0,  9,  0,101,  0,  0,  0,101,  0,  1,  0,  4,  0, 15,  0,  4,  0, 73,  1,
-  4,  0,180,  2,  4,  0, 35,  0,  0,  0, 18,  0, 38,  0,117,  0,  0,  0,181,  2,102,  0,  6,  0,101,  0,182,  2, 44,  0,183,  2,
- 24,  0,184,  2,  0,  0,185,  2,  4,  0,186,  2,  4,  0,187,  2,103,  0,  7,  0,101,  0,182,  2,  2,  0,188,  2,  2,  0,166,  2,
-  2,  0,189,  2,  2,  0, 88,  0,  9,  0,190,  2,  9,  0,191,  2,104,  0,  3,  0,101,  0,182,  2, 24,  0,160,  0,  0,  0, 18,  0,
-105,  0,  5,  0,101,  0,182,  2, 24,  0,160,  0,  0,  0, 18,  0,  2,  0,192,  2,  0,  0,193,  2,106,  0,  5,  0,101,  0,182,  2,
-  7,  0, 85,  0,  7,  0,194,  2,  4,  0,195,  2,  4,  0,196,  2,107,  0,  5,  0,101,  0,182,  2, 24,  0,197,  2,  0,  0, 69,  0,
-  4,  0, 73,  1,  4,  0, 17,  0,108,  0, 13,  0,101,  0,182,  2, 24,  0,198,  2, 24,  0,199,  2, 24,  0,200,  2, 24,  0,201,  2,
-  7,  0,202,  2,  7,  0,203,  2,  7,  0,194,  2,  7,  0,204,  2,  4,  0,205,  2,  4,  0,206,  2,  4,  0, 88,  0,  4,  0,207,  2,
-109,  0,  5,  0,101,  0,182,  2,  2,  0,208,  2,  2,  0, 17,  0,  7,  0,209,  2, 24,  0,210,  2,110,  0,  3,  0,101,  0,182,  2,
-  7,  0,211,  2,  4,  0, 88,  0,111,  0, 10,  0,101,  0,182,  2,  7,  0,212,  2,  4,  0,213,  2,  4,  0, 35,  0,  2,  0, 88,  0,
-  2,  0,214,  2,  2,  0,215,  2,  2,  0,216,  2,  7,  0,217,  2,  0,  0,218,  2,112,  0,  3,  0,101,  0,182,  2,  7,  0, 35,  0,
-  4,  0, 15,  0,113,  0,  6,  0,101,  0,182,  2,114,  0,219,  2,115,  0,220,  2,116,  0,221,  2,  7,  0,222,  2,  4,  0, 15,  0,
-117,  0, 11,  0,101,  0,182,  2, 44,  0,183,  2, 24,  0,184,  2,  0,  0,185,  2,  4,  0,186,  2,  4,  0,187,  2,  4,  0,223,  2,
-  7,  0,224,  2,  4,  0,225,  2,  0,  0,218,  2,  7,  0,226,  2,118,  0, 12,  0,101,  0,182,  2, 24,  0,227,  2, 39,  0,228,  2,
-  4,  0, 88,  0,  4,  0,229,  2,  7,  0,230,  2,  7,  0,231,  2,  7,  0,232,  2,  7,  0,233,  2,  0,  0,185,  2,  4,  0,186,  2,
-  4,  0, 35,  0,119,  0,  3,  0,101,  0,182,  2,  7,  0,234,  2,  4,  0,235,  2,120,  0,  5,  0,101,  0,182,  2,  7,  0,236,  2,
-  0,  0,218,  2,  2,  0, 17,  0,  2,  0,237,  2,121,  0,  8,  0,101,  0,182,  2, 24,  0,160,  0,  7,  0,236,  2,  7,  0,249,  0,
-  7,  0,104,  0,  0,  0,218,  2,  2,  0, 17,  0,  2,  0, 15,  0,122,  0, 21,  0,101,  0,182,  2, 24,  0,238,  2,  0,  0,218,  2,
- 44,  0,183,  2, 24,  0,184,  2,  2,  0, 17,  0,  2,  0, 35,  0,  7,  0,239,  2,  7,  0,240,  2,  7,  0,241,  2,  7,  0, 73,  2,
-  7,  0,242,  2,  7,  0,243,  2,  7,  0,244,  2,  7,  0,245,  2,  4,  0,187,  2,  4,  0,186,  2,  0,  0,185,  2,  7,  0,246,  2,
-  7,  0,247,  2,  7,  0, 87,  0,123,  0,  7,  0,101,  0,182,  2,  2,  0,248,  2,  2,  0,249,  2,  4,  0, 67,  0, 24,  0,160,  0,
-  7,  0,250,  2,  0,  0,218,  2,124,  0, 10,  0,101,  0,182,  2, 24,  0,160,  0,  0,  0,251,  2,  7,  0,252,  2,  7,  0,253,  2,
-  7,  0,245,  2,  4,  0,254,  2,  4,  0,255,  2,  7,  0,  0,  3,  0,  0, 18,  0,125,  0,  1,  0,101,  0,182,  2,126,  0,  7,  0,
-101,  0,182,  2, 38,  0,117,  0,127,  0,  1,  3,128,  0,  2,  3,129,  0,  3,  3,130,  0,  4,  3, 12,  0,  5,  3,131,  0, 13,  0,
-101,  0,182,  2, 77,  0,  6,  3, 77,  0,  7,  3, 77,  0,  8,  3, 77,  0,  9,  3, 77,  0, 10,  3, 77,  0, 11,  3, 74,  0, 12,  3,
-  4,  0, 13,  3,  4,  0, 14,  3,  7,  0, 15,  3,  7,  0, 16,  3,132,  0, 17,  3,133,  0,  7,  0,101,  0,182,  2, 77,  0,  6,  3,
- 77,  0, 18,  3,134,  0, 19,  3,135,  0, 17,  3,  4,  0, 20,  3,  4,  0, 13,  3,136,  0,  4,  0,101,  0,182,  2, 24,  0,160,  0,
-  4,  0, 21,  3,  4,  0, 35,  0,137,  0,  2,  0,  4,  0, 22,  3,  7,  0, 31,  2,138,  0,  2,  0,  4,  0,120,  0,  4,  0, 23,  3,
-139,  0, 24,  0,101,  0,182,  2, 24,  0,160,  0,  0,  0,218,  2,  2,  0, 24,  3,  2,  0, 17,  0,  2,  0, 73,  1,  2,  0, 35,  0,
-137,  0, 25,  3,  4,  0, 26,  3,  7,  0, 27,  3,  4,  0, 51,  0,  4,  0, 28,  3,138,  0, 29,  3,137,  0, 30,  3,  4,  0, 31,  3,
-  4,  0, 32,  3,  4,  0, 33,  3,  4,  0, 23,  3,  7,  0, 34,  3,  7,  0, 35,  3,  7,  0, 36,  3,  7,  0, 37,  3,  7,  0, 38,  3,
-  9,  0, 39,  3,140,  0,  8,  0,101,  0,182,  2,141,  0, 40,  3,134,  0, 19,  3,  4,  0, 41,  3,  4,  0, 42,  3,  4,  0, 43,  3,
-  2,  0, 17,  0,  2,  0, 54,  0,142,  0,  8,  0,101,  0,182,  2, 24,  0, 42,  0,  2,  0,253,  0,  2,  0, 17,  0,  2,  0,208,  2,
-  2,  0, 54,  0,  7,  0, 44,  3,  7,  0, 45,  3,143,  0,  6,  0,101,  0,182,  2,  4,  0, 46,  3,  2,  0, 17,  0,  2,  0, 47,  3,
-  7,  0, 48,  3,  0,  0,162,  0,144,  0,  8,  0,101,  0,182,  2,  0,  0, 49,  3,  0,  0, 50,  3,  0,  0,172,  2,  0,  0, 51,  3,
-  0,  0, 52,  3,  0,  0, 88,  0,  0,  0,160,  2,145,  0,  3,  0,101,  0,182,  2,146,  0, 53,  3,130,  0,  4,  3,147,  0, 10,  0,
-101,  0,182,  2, 24,  0, 54,  3, 24,  0, 55,  3,  0,  0, 56,  3,  7,  0, 57,  3,  2,  0, 58,  3,  2,  0, 59,  3,  0,  0, 60,  3,
-  0,  0, 61,  3,  0,  0,193,  2,148,  0,  9,  0,101,  0,182,  2, 24,  0, 62,  3,  0,  0, 56,  3,  7,  0, 63,  3,  7,  0, 64,  3,
-  0,  0, 73,  1,  0,  0,208,  2,  0,  0, 65,  3,  0,  0, 35,  0,149,  0,  1,  0,101,  0,182,  2,150,  0, 11,  0,101,  0,182,  2,
-  0,  0,218,  2,  7,  0,120,  0,  7,  0, 66,  3,  7,  0, 67,  3,  7,  0, 68,  3,  7,  0, 69,  3,  4,  0, 17,  0,  2,  0, 70,  3,
-  2,  0, 71,  3,  4,  0, 35,  0,151,  0,  9,  0,101,  0,182,  2, 24,  0, 72,  3,  4,  0, 73,  3,  4,  0, 74,  3,  4,  0, 75,  3,
-  7,  0, 76,  3,  7,  0, 77,  3,  2,  0,208,  2,  2,  0, 17,  0,152,  0, 16,  0,101,  0,182,  2, 44,  0,183,  2, 24,  0,184,  2,
-  0,  0,185,  2,  4,  0,186,  2,  4,  0,187,  2,  4,  0,223,  2,  7,  0,224,  2, 24,  0, 78,  3, 24,  0, 79,  3, 51,  0, 86,  1,
-  0,  0,218,  2,  7,  0, 80,  3,  0,  0, 17,  0,  0,  0,247,  0,  0,  0,160,  2,153,  0,  3,  0,154,  0, 81,  3,  4,  0, 58,  2,
-  0,  0, 90,  0,154,  0, 29,  0, 19,  0, 29,  0, 31,  0, 72,  0,  2,  0, 40,  2,  2,  0, 41,  2,  2,  0, 82,  3,  2,  0, 17,  0,
-  2,  0, 83,  3,  2,  0, 84,  3,  2,  0, 85,  3,  2,  0, 67,  0,  0,  0, 86,  3,  0,  0, 87,  3,  0,  0, 88,  3,  0,  0,230,  1,
-  4,  0, 35,  0,  7,  0, 89,  3,  7,  0, 90,  3,  7,  0, 91,  3,  7,  0, 92,  3,  7,  0, 93,  3,  7,  0, 94,  3, 26,  0, 95,  3,
- 28,  0, 77,  0, 30,  0, 65,  2, 79,  0,113,  2,  0,  0, 69,  0,  7,  0, 96,  3,  7,  0, 97,  3,153,  0, 98,  3,155,  0,  3,  0,
-155,  0,  0,  0,155,  0,  1,  0,  0,  0, 18,  0, 62,  0,  3,  0,  7,  0, 99,  3,  4,  0, 17,  0,  4,  0, 35,  0, 24,  0,129,  0,
- 19,  0, 29,  0, 31,  0, 72,  0,156,  0,100,  3,  2,  0, 15,  0,  2,  0,101,  3,  4,  0,102,  3,  4,  0,103,  3,  4,  0,104,  3,
-  0,  0,105,  3, 24,  0, 36,  0, 24,  0,106,  3, 24,  0,107,  3, 24,  0,108,  3, 24,  0,109,  3, 28,  0, 77,  0, 70,  0, 64,  2,
- 62,  0,  0,  2,157,  0,110,  3,157,  0,111,  3,158,  0,112,  3,  9,  0,  2,  0,159,  0,113,  3,160,  0,114,  3,161,  0,115,  3,
- 12,  0,116,  3, 12,  0,117,  3, 12,  0, 20,  2, 12,  0,118,  3, 12,  0,119,  3,  4,  0, 73,  1,  4,  0,120,  3, 57,  0, 22,  2,
-  0,  0,121,  3,  4,  0, 24,  2,  4,  0,122,  3,  7,  0, 68,  1,  7,  0,123,  3,  7,  0,124,  3,  7,  0,168,  0,  7,  0,125,  3,
-  7,  0, 69,  1,  7,  0,126,  3,  7,  0, 10,  2,  7,  0,127,  3,  7,  0,128,  3,  7,  0,129,  3,  7,  0,130,  3,  7,  0,131,  3,
-  7,  0,132,  3,  7,  0,252,  2,  7,  0,133,  3,  7,  0,238,  0,  7,  0,134,  3,  4,  0,135,  3,  2,  0, 17,  0,  2,  0,136,  3,
-  2,  0,137,  3,  2,  0,138,  3,  2,  0,139,  3,  2,  0,140,  3,  2,  0,141,  3,  2,  0,142,  3,  2,  0,143,  3,  2,  0,144,  3,
-  2,  0,145,  3,  2,  0,146,  3,  4,  0,147,  3,  4,  0,148,  3,  4,  0,149,  3,  4,  0,150,  3,  7,  0,151,  3,  7,  0,100,  2,
-  7,  0,152,  3,  7,  0,153,  3,  7,  0,154,  3,  7,  0,155,  3,  7,  0,156,  3,  7,  0,213,  0,  7,  0,157,  3,  7,  0,158,  3,
-  7,  0,159,  3,  7,  0,160,  3,  2,  0,161,  3,  0,  0,162,  3,  0,  0,106,  0,  0,  0,163,  3,  0,  0,164,  3,  7,  0,165,  3,
-  7,  0,166,  3, 12,  0,167,  3, 12,  0,168,  3, 12,  0,169,  3, 12,  0,170,  3,  7,  0,171,  3,  2,  0,253,  1,  2,  0,172,  3,
-  7,  0,135,  2,  4,  0,173,  3,  4,  0,174,  3,162,  0,175,  3,  2,  0,176,  3,  2,  0,245,  0,  7,  0,177,  3, 12,  0,178,  3,
- 12,  0,179,  3, 12,  0,180,  3, 12,  0,181,  3,163,  0, 65,  1,164,  0,182,  3, 58,  0,183,  3,  2,  0,184,  3,  2,  0,185,  3,
-  2,  0, 58,  2,  2,  0,186,  3,  7,  0,126,  2,  2,  0,187,  3,  2,  0,188,  3,146,  0,189,  3,134,  0,190,  3,134,  0,191,  3,
-  4,  0,192,  3,  4,  0,193,  3,  4,  0,194,  3,  4,  0,195,  3, 12,  0,196,  3, 12,  0,197,  3, 12,  0,198,  3,  7,  0,199,  3,
-  0,  0,200,  3,165,  0, 14,  0,165,  0,  0,  0,165,  0,  1,  0, 24,  0, 36,  0,  7,  0,252,  2,  7,  0, 70,  1,  7,  0,253,  2,
-  7,  0,245,  2,  0,  0, 18,  0,  4,  0,254,  2,  4,  0,255,  2,  4,  0,201,  3,  2,  0, 15,  0,  2,  0,202,  3,  7,  0,  0,  3,
-166,  0, 12,  0,166,  0,  0,  0,166,  0,  1,  0, 24,  0, 42,  0,  4,  0,203,  3,  4,  0,253,  1,  4,  0,204,  3,  4,  0, 15,  0,
-  4,  0,205,  3,  7,  0, 70,  1,  7,  0,206,  3,  7,  0,207,  3,  7,  0,151,  2,163,  0, 40,  0,  4,  0, 17,  0,  2,  0,208,  3,
-  2,  0,209,  3,  2,  0,245,  2,  2,  0,210,  3,  2,  0,211,  3,  2,  0,212,  3,  2,  0,213,  3,  2,  0,214,  3,  7,  0,215,  3,
-  7,  0,216,  3,  7,  0,217,  3,  7,  0,218,  3,  7,  0,219,  3,  7,  0,220,  3,  7,  0,221,  3,  7,  0,222,  3,  7,  0,223,  3,
-  7,  0,224,  3,  7,  0,225,  3,  7,  0,226,  3,  7,  0,227,  3,  7,  0,228,  3,  7,  0,229,  3,  7,  0,230,  3,  7,  0,231,  3,
-  7,  0,232,  3,  7,  0,233,  3,  7,  0,234,  3,  7,  0,235,  3,  7,  0,236,  3,  7,  0,237,  3,  7,  0,238,  3,  7,  0,239,  3,
-  7,  0,240,  3,  7,  0,241,  3, 44,  0,161,  0,167,  0,242,  3,  7,  0,243,  3,  4,  0,196,  2,168,  0,  5,  0, 58,  0,233,  1,
-  7,  0,244,  3,  7,  0,245,  3,  2,  0, 17,  0,  2,  0,246,  3,169,  0,  5,  0,169,  0,  0,  0,169,  0,  1,  0,  4,  0, 15,  0,
-  4,  0,247,  3,  9,  0,  2,  0,170,  0,  9,  0,170,  0,  0,  0,170,  0,  1,  0,  4,  0,248,  3,  4,  0,249,  3,  4,  0,250,  3,
-  4,  0, 17,  0,  9,  0,251,  3,  9,  0,252,  3, 12,  0,253,  3,130,  0, 21,  0,130,  0,  0,  0,130,  0,  1,  0,  4,  0, 17,  0,
-  4,  0,254,  3,  4,  0,255,  3,  4,  0,  0,  4,  4,  0,  1,  4,  4,  0,  2,  4,  4,  0,  3,  4,  4,  0,249,  3,  4,  0,253,  1,
-  2,  0,  4,  4,  2,  0, 54,  0,  0,  0,  5,  4,  0,  0,  6,  4,  0,  0,  7,  4,  0,  0,  8,  4,  0,  0,  9,  4, 12,  0, 10,  4,
-171,  0, 11,  4,  9,  0, 12,  4,172,  0,  1,  0,  7,  0, 38,  2,162,  0, 30,  0,  4,  0, 17,  0,  7,  0, 13,  4,  7,  0, 14,  4,
-  7,  0, 15,  4,  4,  0, 16,  4,  4,  0, 17,  4,  4,  0, 18,  4,  4,  0, 19,  4,  7,  0, 20,  4,  7,  0, 21,  4,  7,  0, 22,  4,
-  7,  0, 23,  4,  7,  0, 24,  4,  7,  0, 25,  4,  7,  0, 26,  4,  7,  0, 27,  4,  7,  0, 28,  4,  7,  0, 29,  4,  7,  0, 30,  4,
-  7,  0, 31,  4,  7,  0, 32,  4,  7,  0, 33,  4,  7,  0, 34,  4,  7,  0, 35,  4,  7,  0, 36,  4,  7,  0, 37,  4,  4,  0, 38,  4,
-  4,  0, 39,  4,  7,  0, 40,  4,  7,  0,157,  3,164,  0, 54,  0,  4,  0,249,  3,  4,  0, 41,  4,173,  0, 42,  4,174,  0, 43,  4,
-  0,  0, 35,  0,  0,  0, 44,  4,  2,  0, 45,  4,  7,  0, 46,  4,  0,  0, 47,  4,  7,  0, 48,  4,  7,  0, 49,  4,  7,  0, 50,  4,
-  7,  0, 51,  4,  7,  0, 52,  4,  7,  0, 53,  4,  7,  0, 54,  4,  7,  0, 55,  4,  7,  0, 56,  4,  2,  0, 57,  4,  0,  0, 58,  4,
-  2,  0, 59,  4,  7,  0, 60,  4,  7,  0, 61,  4,  0,  0, 62,  4,  4,  0,121,  0,  4,  0, 63,  4,  4,  0, 64,  4,  2,  0, 65,  4,
-  2,  0, 66,  4,172,  0, 67,  4,  4,  0, 68,  4,  4,  0, 79,  0,  7,  0, 69,  4,  7,  0, 70,  4,  7,  0, 71,  4,  7,  0, 72,  4,
-  2,  0, 73,  4,  2,  0, 74,  4,  2,  0, 75,  4,  2,  0, 76,  4,  2,  0, 77,  4,  2,  0, 78,  4,  2,  0, 79,  4,  2,  0, 80,  4,
-175,  0, 81,  4,  7,  0, 82,  4,  7,  0, 83,  4,130,  0, 84,  4, 12,  0,  5,  3,168,  0, 85,  4,  7,  0, 86,  4,  7,  0, 87,  4,
-  7,  0, 88,  4,  0,  0, 89,  4,176,  0,  1,  0,  7,  0, 90,  4,146,  0, 50,  0,145,  0, 91,  4,  2,  0, 15,  0,  2,  0, 92,  4,
-  2,  0, 93,  4,  2,  0, 94,  4,  7,  0, 95,  4,  2,  0, 96,  4,  2,  0, 97,  4,  7,  0, 98,  4,  2,  0, 99,  4,  2,  0,100,  4,
-  7,  0,101,  4,  7,  0,102,  4,  7,  0,103,  4,  4,  0,104,  4,  4,  0,105,  4,  7,  0,106,  4,  4,  0,107,  4,  7,  0,108,  4,
-  7,  0,109,  4,  7,  0,110,  4, 73,  0,111,  4, 73,  0,112,  4,  0,  0,113,  4,  7,  0,114,  4,  7,  0,115,  4, 28,  0, 77,  0,
-  2,  0,116,  4,  0,  0,117,  4,  0,  0,118,  4,  7,  0,119,  4,  4,  0,120,  4,  7,  0,121,  4,  7,  0,122,  4,  4,  0,123,  4,
-  4,  0, 17,  0,  7,  0,124,  4,  7,  0,125,  4,  7,  0,126,  4,176,  0,127,  4,  4,  0, 51,  0,  7,  0,128,  4,  7,  0,129,  4,
-  7,  0,130,  4,  7,  0,131,  4,  7,  0,132,  4,  7,  0,133,  4,  7,  0,134,  4,  4,  0,135,  4,  4,  0, 35,  0,177,  0, 76,  0,
- 19,  0, 29,  0, 31,  0, 72,  0,  2,  0,171,  0,  2,  0, 74,  1,  2,  0,108,  1,  2,  0,136,  4,  7,  0,137,  4,  7,  0,138,  4,
-  7,  0,139,  4,  7,  0,140,  4,  7,  0,141,  4,  7,  0,142,  4,  7,  0,154,  1,  7,  0,156,  1,  7,  0,155,  1,  7,  0, 67,  0,
-  4,  0,143,  4,  7,  0,144,  4,  7,  0,145,  4,  7,  0,146,  4,  7,  0,147,  4,  7,  0,148,  4,  7,  0,149,  4,  7,  0,150,  4,
-  2,  0,151,  4,  2,  0, 73,  1,  2,  0,152,  4,  2,  0,153,  4,  2,  0,154,  4,  2,  0,155,  4,  2,  0,156,  4,  2,  0,157,  4,
-  7,  0,158,  4,  7,  0,159,  4,  7,  0,160,  4,  7,  0,161,  4,  7,  0,162,  4,  7,  0,163,  4,  7,  0,164,  4,  7,  0,165,  4,
-  7,  0,166,  4,  7,  0,167,  4,  7,  0,168,  4,  7,  0,169,  4,  2,  0,170,  4,  2,  0,171,  4,  2,  0,172,  4,  2,  0,173,  4,
-  7,  0,174,  4,  7,  0,175,  4,  7,  0,176,  4,  7,  0,177,  4,  2,  0,178,  4,  2,  0,179,  4,  2,  0,180,  4,  2,  0,181,  4,
-  7,  0,182,  4,  7,  0,183,  4,  7,  0,184,  4,  7,  0,185,  4,  7,  0,186,  4,  7,  0,187,  4,  7,  0,188,  4,  2,  0,189,  4,
-  2,  0,190,  4,  2,  0,191,  4,  2,  0,192,  4,  2,  0,193,  4,  2,  0, 17,  0,  7,  0,194,  4,  7,  0,195,  4, 28,  0, 77,  0,
- 43,  0,126,  1,  2,  0,127,  1,  2,  0,196,  4, 22,  0,146,  0,178,  0,  8,  0,178,  0,  0,  0,178,  0,  1,  0,  4,  0,135,  3,
-  4,  0,197,  4,  4,  0, 17,  0,  2,  0,198,  4,  2,  0,199,  4, 24,  0,160,  0,179,  0, 13,  0,  9,  0,200,  4,  9,  0,201,  4,
-  4,  0,202,  4,  4,  0,203,  4,  4,  0,204,  4,  4,  0,205,  4,  4,  0,206,  4,  4,  0,207,  4,  4,  0,208,  4,  4,  0,209,  4,
-  4,  0,210,  4,  4,  0, 35,  0,  0,  0,211,  4,180,  0,  5,  0,  9,  0,212,  4,  9,  0,213,  4,  4,  0,214,  4,  4,  0, 67,  0,
-  0,  0,215,  4,181,  0, 17,  0,  4,  0,216,  4,  4,  0,217,  4,  4,  0,218,  4,  4,  0,219,  4,  4,  0,220,  4,  4,  0,221,  4,
-  4,  0,222,  4,  4,  0,223,  4,  4,  0,224,  4,  4,  0,225,  4,  4,  0,226,  4,  4,  0,227,  4,  2,  0,228,  4,  2,  0,229,  4,
-  4,  0,230,  4,  4,  0,231,  4,  4,  0, 87,  0,182,  0, 17,  0,  4,  0, 15,  0,  4,  0,218,  4,  4,  0,232,  4,  4,  0,233,  4,
-  4,  0,234,  4,  4,  0,235,  4,  4,  0,236,  4,  4,  0,237,  4,  7,  0,238,  4,  4,  0,239,  4,  4,  0, 88,  0,  4,  0,240,  4,
-  4,  0,241,  4,  4,  0,242,  4,  4,  0,243,  4,  4,  0,244,  4, 18,  0, 28,  0,183,  0,  7,  0,  4,  0,245,  4,  7,  0,246,  4,
-  7,  0,247,  4,  7,  0,248,  4,  4,  0,249,  4,  2,  0, 17,  0,  2,  0, 35,  0,184,  0, 11,  0,184,  0,  0,  0,184,  0,  1,  0,
-  0,  0, 18,  0, 57,  0,250,  4, 58,  0,251,  4,  4,  0,135,  3,  4,  0,252,  4,  4,  0,253,  4,  4,  0, 35,  0,  4,  0,254,  4,
-  4,  0,255,  4,185,  0,105,  0,179,  0,  0,  5,180,  0,  1,  5,181,  0,  2,  5,182,  0,  3,  5,  4,  0, 20,  3,  4,  0,121,  0,
-  4,  0, 63,  4,  7,  0,  4,  5,  4,  0,  5,  5,  4,  0,  6,  5,  4,  0,  7,  5,  4,  0,  8,  5,  2,  0, 17,  0,  2,  0,  9,  5,
-  7,  0, 10,  5,  7,  0, 11,  5,  7,  0, 12,  5,  7,  0, 13,  5,  7,  0, 14,  5,  2,  0, 15,  5,  2,  0, 16,  5,  2,  0, 17,  5,
-  2,  0, 18,  5,  2,  0,244,  0,  2,  0, 19,  5,  4,  0, 20,  5,  2,  0, 21,  5,  2,  0, 22,  5,  2,  0, 95,  1,  2,  0,104,  0,
-  2,  0, 23,  5,  2,  0, 24,  5,  2,  0, 25,  5,  2,  0, 26,  5,  2,  0, 27,  5,  2,  0, 28,  5,  2,  0, 29,  5,  2,  0, 30,  5,
-  2,  0, 31,  5,  2,  0, 32,  5,  4,  0, 33,  5,  4,  0, 73,  1,  4,  0, 34,  5,  2,  0, 35,  5,  2,  0, 36,  5,  2,  0, 37,  5,
-  2,  0, 38,  5,  2,  0, 39,  5,  2,  0, 40,  5,  2,  0, 41,  5,  2,  0, 42,  5, 16,  0, 43,  5, 16,  0, 44,  5, 15,  0, 45,  5,
- 12,  0, 46,  5,  2,  0, 47,  5,  2,  0, 48,  5,  7,  0, 49,  5,  7,  0, 50,  5,  7,  0, 51,  5,  7,  0, 52,  5,  4,  0, 53,  5,
-  7,  0, 54,  5,  7,  0, 55,  5,  7,  0, 56,  5,  7,  0, 57,  5,  2,  0, 58,  5,  2,  0, 59,  5,  2,  0, 60,  5,  2,  0, 61,  5,
-  2,  0, 62,  5,  2,  0, 63,  5,  7,  0, 64,  5,  7,  0, 65,  5,  7,  0, 66,  5,  0,  0, 67,  5,  4,  0, 68,  5,  2,  0, 69,  5,
-  2,  0,230,  1,  0,  0, 70,  5,  7,  0, 71,  5,  7,  0, 72,  5,  0,  0, 73,  5,  0,  0, 74,  5,  0,  0, 75,  5,  0,  0, 76,  5,
-  4,  0, 77,  5,  2,  0, 78,  5,  2,  0, 79,  5,  7,  0, 80,  5,  7,  0, 81,  5,  2,  0, 82,  5,  2,  0, 83,  5,  7,  0, 84,  5,
-  2,  0, 85,  5,  2,  0, 86,  5,  4,  0, 87,  5,  2,  0, 88,  5,  2,  0, 89,  5,  2,  0, 90,  5,  2,  0, 91,  5,  7,  0, 92,  5,
-  7,  0, 67,  0, 34,  0, 93,  5,  0,  0, 94,  5,186,  0,  9,  0,186,  0,  0,  0,186,  0,  1,  0,  0,  0, 18,  0,  2,  0, 95,  5,
-  2,  0, 96,  5,  2,  0, 97,  5,  2,  0, 87,  0,  7,  0, 98,  5,  7,  0, 67,  0,187,  0,  7,  0,  2,  0,213,  2,  2,  0, 73,  1,
-  2,  0, 77,  3,  2,  0, 99,  5,  7,  0,100,  5,  7,  0, 67,  0, 34,  0,101,  5,188,  0,  5,  0,  7,  0,102,  5,  0,  0, 15,  0,
-  0,  0, 87,  0,  0,  0, 67,  0,  0,  0,230,  1,189,  0, 28,  0,  7,  0,149,  4,  7,  0,150,  4,  2,  0, 73,  1,  2,  0, 17,  0,
-  2,  0,103,  5,  2,  0,196,  4,  2,  0,152,  4,  2,  0,153,  4,  2,  0,154,  4,  2,  0,155,  4,  2,  0,156,  4,  2,  0,157,  4,
-188,  0,104,  5,  2,  0, 15,  5,  2,  0, 16,  5,  2,  0, 17,  5,  2,  0, 18,  5,  2,  0,244,  0,  2,  0, 19,  5,  2,  0,105,  5,
-  2,  0,106,  5,187,  0,107,  5,  2,  0,108,  5,  2,  0, 21,  5,  2,  0, 67,  0,  2,  0,230,  1,  7,  0,109,  5,  7,  0, 87,  0,
-190,  0,  6,  0,190,  0,  0,  0,190,  0,  1,  0,  4,  0,248,  3,  0,  0,  5,  4,  4,  0, 17,  0, 24,  0,110,  5,191,  0,  4,  0,
-192,  0,111,  5,  9,  0,112,  5,  0,  0,113,  5,  4,  0, 88,  0,193,  0,  8,  0,191,  0,114,  5,  2,  0, 17,  0,  2,  0, 35,  0,
-  2,  0,115,  5,  2,  0,116,  5,  2,  0,117,  5,  4,  0, 87,  0,  9,  0,118,  5,194,  0,  6,  0,  2,  0,104,  0,  2,  0,254,  3,
-  2,  0,119,  5,  2,  0,207,  2,  4,  0, 17,  0,  7,  0,224,  2,195,  0, 14,  0,  2,  0, 17,  0,  2,  0,120,  5,  2,  0,121,  5,
-  2,  0,122,  5,194,  0,123,  5,  9,  0,118,  5,  7,  0,124,  5,  7,  0, 54,  0,  4,  0,125,  5,  4,  0,126,  5,  4,  0,127,  5,
-  4,  0,128,  5, 38,  0,117,  0, 24,  0,160,  0,196,  0,  4,  0,196,  0,  0,  0,196,  0,  1,  0,  0,  0,129,  5,  7,  0,130,  5,
-197,  0, 14,  0,191,  0,114,  5,  4,  0, 88,  0,  4,  0,131,  5,  7,  0,132,  5,  7,  0,133,  5,  7,  0,134,  5,  4,  0,135,  5,
-  4,  0,136,  5,  7,  0,137,  5,  7,  0,138,  5,  4,  0,139,  5,  7,  0,140,  5,  7,  0,141,  5,  4,  0, 35,  0,198,  0,  7,  0,
-191,  0,114,  5,  2,  0, 17,  0,  2,  0, 35,  0,  4,  0, 34,  0,  4,  0,142,  5, 79,  0,143,  5,  9,  0,118,  5,199,  0, 82,  0,
-198,  0,144,  5,198,  0,145,  5,197,  0,100,  3,  7,  0,146,  5,  2,  0,147,  5,  2,  0,148,  5,  7,  0,149,  5,  7,  0,150,  5,
-  2,  0,254,  3,  2,  0,151,  5,  7,  0,152,  5,  7,  0,153,  5,  7,  0,154,  5,  2,  0,155,  5,  2,  0,125,  5,  2,  0,156,  5,
-  2,  0,157,  5,  2,  0,158,  5,  2,  0,159,  5,  7,  0,160,  5,  7,  0,161,  5,  7,  0,162,  5,  2,  0,163,  5,  2,  0,164,  5,
-  2,  0,165,  5,  2,  0,166,  5,  2,  0,167,  5,  2,  0,168,  5,  2,  0,169,  5,  2,  0,170,  5,193,  0,171,  5,195,  0,172,  5,
-  7,  0,173,  5,  7,  0,174,  5,  7,  0,175,  5,  2,  0,176,  5,  2,  0,177,  5,  0,  0,178,  5,  0,  0,179,  5,  0,  0,180,  5,
-  0,  0,181,  5,  0,  0,182,  5,  0,  0,183,  5,  2,  0,184,  5,  7,  0,185,  5,  7,  0,186,  5,  7,  0,187,  5,  7,  0,188,  5,
-  7,  0,189,  5,  7,  0,190,  5,  7,  0,191,  5,  7,  0,192,  5,  7,  0,193,  5,  7,  0,194,  5,  2,  0,195,  5,  0,  0,196,  5,
-  0,  0,197,  5,  0,  0,198,  5,  0,  0,199,  5, 24,  0,200,  5,  0,  0,201,  5,  0,  0,202,  5,  0,  0,203,  5,  0,  0,204,  5,
-  0,  0,205,  5,  0,  0,206,  5,  0,  0,207,  5,  0,  0,208,  5,  0,  0,209,  5,  0,  0,210,  5,  2,  0,211,  5,  2,  0,212,  5,
-  2,  0,213,  5,  2,  0,214,  5,  0,  0,215,  5,  0,  0,196,  4,  4,  0,216,  5,  2,  0,217,  5,  2,  0, 87,  0,  4,  0,218,  5,
-  7,  0,219,  5,  7,  0,220,  5,200,  0,  8,  0,  4,  0,221,  5,  4,  0,222,  5,  4,  0,223,  5,  4,  0,224,  5,  4,  0,225,  5,
-  4,  0,226,  5,  4,  0, 51,  0,  4,  0,123,  2,201,  0,  4,  0,  7,  0,227,  5,  0,  0,228,  5,  0,  0,229,  5,  2,  0, 17,  0,
-202,  0,  4,  0,  7,  0,230,  5,  4,  0, 17,  0,  4,  0,231,  5,  4,  0, 54,  0, 38,  0, 44,  0, 19,  0, 29,  0, 31,  0, 72,  0,
- 24,  0,110,  5,177,  0,232,  5, 38,  0,233,  5, 12,  0,234,  5,178,  0,235,  5, 24,  0,236,  5,  7,  0,237,  5,  7,  0,238,  5,
-  7,  0,239,  5,  7,  0,240,  5,  4,  0,135,  3,  4,  0,241,  5,  4,  0,242,  5,  4,  0,193,  3,  4,  0,243,  5,  2,  0, 17,  0,
-  2,  0, 67,  1, 53,  0, 62,  1,203,  0,244,  5,199,  0,245,  5,204,  0,246,  5,185,  0,178,  0,183,  0,247,  5, 12,  0, 98,  0,
- 12,  0,248,  5,  9,  0,249,  5,  9,  0,250,  5,  9,  0,251,  5,  9,  0,252,  5,205,  0,253,  5,  2,  0,254,  5,  2,  0,255,  5,
-  2,  0,245,  0,  2,  0,  0,  6,  4,  0,  1,  6,  4,  0,  2,  6, 12,  0,  3,  6,188,  0,104,  5,189,  0,  4,  6,201,  0,  5,  6,
-159,  0,113,  3,202,  0,  6,  6,206,  0, 11,  0,206,  0,  0,  0,206,  0,  1,  0, 39,  0,236,  0, 37,  0, 61,  1,  7,  0, 88,  2,
-  7,  0, 89,  2,  7,  0,104,  0,  7,  0,  7,  6,  2,  0,  8,  6,  2,  0, 17,  0,  7,  0, 67,  0,207,  0, 38,  0,  7,  0,  9,  6,
-  7,  0, 10,  6,  7,  0, 11,  6,  7,  0, 12,  6,  7,  0, 13,  6,  7,  0, 14,  6,  7,  0, 15,  6,  7,  0, 16,  6,  7,  0, 17,  6,
-  7,  0, 80,  1,  7,  0, 18,  6,  7,  0, 19,  6,  7,  0, 20,  6,  7,  0, 21,  6,  7,  0,167,  0,  2,  0, 22,  6,  2,  0, 23,  6,
-  0,  0, 24,  6,  0,  0,196,  4,  2,  0, 25,  6,  2,  0, 26,  6,  2,  0, 27,  6,  2,  0,  8,  6,  7,  0, 28,  6,  7,  0, 29,  6,
- 62,  0, 30,  6,159,  0,113,  3,207,  0, 31,  6,208,  0, 32,  6,209,  0, 33,  6,210,  0, 34,  6,211,  0, 35,  6,  7,  0, 36,  6,
-  2,  0, 37,  6,  2,  0, 38,  6,  7,  0, 39,  6,  7,  0, 40,  6,  7,  0, 41,  6,212,  0, 50,  0,213,  0,  0,  0,213,  0,  1,  0,
- 12,  0, 42,  6,  4,  0, 43,  6,  7,  0, 44,  6,  2,  0, 45,  6,  7,  0, 17,  6,  7,  0, 80,  1,  7,  0, 87,  0,  4,  0, 46,  6,
-  2,  0, 27,  6,  2,  0,  8,  6, 24,  0,110,  5, 24,  0, 47,  6, 12,  0, 48,  6,206,  0, 49,  6,212,  0, 31,  6,  0,  0, 50,  6,
-  4,  0,135,  3,  4,  0,241,  5,  2,  0, 51,  6,  2,  0, 52,  6,  2,  0, 53,  6,  2,  0, 54,  6,  2,  0, 17,  0,  2,  0, 23,  2,
-  7,  0,110,  0,  7,  0, 55,  6,  7,  0, 56,  6,  7,  0, 57,  6,  7,  0,167,  0,  7,  0,237,  5,  2,  0, 58,  6,  2,  0, 59,  6,
-  2,  0, 60,  6,  0,  0, 61,  6,  0,  0, 62,  6,  0,  0, 63,  6,  0,  0, 64,  6,  0,  0, 65,  6, 12,  0, 66,  6, 12,  0, 67,  6,
- 12,  0, 68,  6,  2,  0, 69,  6,  2,  0,136,  2,  2,  0, 70,  6,  0,  0, 71,  6,  0,  0, 72,  6,  9,  0, 73,  6,159,  0,113,  3,
-214,  0, 24,  0, 16,  0, 34,  0, 16,  0, 61,  0, 15,  0, 74,  6, 15,  0, 75,  6, 15,  0, 76,  6,  7,  0, 77,  6,  7,  0, 78,  6,
-  7,  0, 79,  6,  7,  0, 80,  6,  2,  0, 81,  6,  2,  0, 82,  6,  2,  0, 83,  6,  2,  0, 84,  6,  2,  0, 85,  6,  2,  0, 17,  0,
-  2,  0, 86,  6,  2,  0, 87,  6,  2,  0, 88,  6,  2,  0, 89,  6,  2,  0, 90,  6,  2,  0, 54,  6,  7,  0, 91,  6,  4,  0, 92,  6,
-  4,  0, 93,  6,213,  0,  6,  0,213,  0,  0,  0,213,  0,  1,  0, 12,  0, 42,  6,  4,  0, 43,  6,  7,  0, 44,  6,  2,  0, 45,  6,
-215,  0,  8,  0,213,  0,  0,  0,213,  0,  1,  0, 12,  0, 42,  6,  4,  0, 43,  6,  7,  0, 44,  6,  2,  0, 45,  6,  0,  0, 94,  6,
-  0,  0,177,  0,216,  0, 14,  0,213,  0,  0,  0,213,  0,  1,  0, 12,  0, 42,  6,  4,  0, 43,  6,  7,  0, 44,  6,  2,  0, 45,  6,
-214,  0, 95,  6,217,  0, 96,  6, 12,  0, 97,  6,  2,  0, 73,  1,  2,  0, 98,  6,  4,  0, 17,  0,  7,  0, 99,  6,  4,  0, 54,  6,
-218,  0, 21,  0,213,  0,  0,  0,213,  0,  1,  0, 12,  0, 42,  6,  4,  0, 43,  6,  7,  0, 44,  6,  2,  0, 45,  6,208,  0, 32,  6,
-214,  0, 95,  6,  2,  0,100,  6,  2,  0,101,  6,  2,  0,102,  6,  2,  0,103,  6,  2,  0, 86,  6,  2,  0,104,  6,  2,  0,105,  6,
-  0,  0, 17,  0,  0,  0, 35,  0,  9,  0, 64,  2,  4,  0,106,  6,  4,  0,107,  6, 19,  0,108,  6,219,  0, 18,  0,213,  0,  0,  0,
-213,  0,  1,  0, 12,  0, 42,  6,  4,  0, 43,  6,  7,  0, 44,  6,  2,  0, 45,  6,214,  0, 95,  6,  7,  0, 88,  2,  7,  0, 89,  2,
-  2,  0,100,  6,  2,  0,109,  6,  2,  0,110,  6,  2,  0,111,  6,  4,  0, 17,  0,  7,  0,112,  6,  4,  0,  8,  6,  4,  0, 35,  0,
-159,  0,113,  3,220,  0, 16,  0,  0,  0,113,  6,  0,  0,114,  6,  0,  0,115,  6,  0,  0,116,  6,  0,  0,117,  6,  0,  0,118,  6,
-  4,  0,119,  6,  4,  0,120,  6,  4,  0,121,  6,  2,  0, 15,  0,  2,  0, 17,  0,  2,  0,122,  6,  2,  0,123,  6,  2,  0,173,  1,
-  2,  0,124,  6,  0,  0,125,  6,221,  0, 16,  0,213,  0,  0,  0,213,  0,  1,  0, 12,  0, 42,  6,  4,  0, 43,  6,  4,  0,126,  6,
-220,  0,127,  6,222,  0,128,  6, 12,  0,129,  6, 12,  0,130,  6,223,  0,131,  6,211,  0,132,  6,224,  0,133,  6,  2,  0,134,  6,
-  2,  0,135,  6,  2,  0,136,  6,  2,  0, 67,  0,225,  0, 15,  0,213,  0,  0,  0,213,  0,  1,  0, 12,  0, 42,  6,  4,  0, 43,  6,
-  7,  0, 44,  6,  2,  0, 45,  6,214,  0, 95,  6, 12,  0,137,  6,226,  0,138,  6,  0,  0,139,  6,227,  0,140,  6,  2,  0, 17,  0,
-  2,  0,141,  6,  2,  0,142,  6,  2,  0,143,  6,228,  0, 25,  0,213,  0,  0,  0,213,  0,  1,  0, 12,  0, 42,  6,  4,  0, 43,  6,
-  4,  0, 17,  0, 39,  0,228,  2, 37,  0, 61,  1, 51,  0,144,  6,229,  0,145,  6,230,  0,146,  6,159,  0,113,  3,  7,  0,147,  6,
-  7,  0, 88,  2,  7,  0, 89,  2,  7,  0,112,  6,  7,  0,148,  6,  7,  0,149,  6,  2,  0,150,  6,  2,  0,151,  6,  2,  0,152,  6,
-  2,  0,153,  6,  0,  0,154,  6,  0,  0,155,  6,  0,  0,156,  6,  0,  0, 54,  6,231,  0, 11,  0,213,  0,  0,  0,213,  0,  1,  0,
- 12,  0, 42,  6,  4,  0, 43,  6,  7,  0, 44,  6,  2,  0, 45,  6,  2,  0, 98,  6,  2,  0, 17,  0,  4,  0, 35,  0,217,  0, 96,  6,
-214,  0, 95,  6,232,  0, 31,  0,213,  0,  0,  0,213,  0,  1,  0, 12,  0, 42,  6,  4,  0, 43,  6,  7,  0, 44,  6,  2,  0, 45,  6,
- 34,  0,157,  6,  4,  0,158,  6,  4,  0,159,  6,  2,  0, 88,  0,  2,  0,160,  6,  2,  0,161,  6,  0,  0,162,  6,  0,  0,163,  6,
-  4,  0,164,  6,  4,  0,165,  6,  4,  0,166,  6,  2,  0,167,  6,  2,  0,168,  6,  2,  0,169,  6,  2,  0,170,  6,  7,  0,171,  6,
- 15,  0,172,  6, 15,  0,173,  6,  4,  0,174,  6,  4,  0,175,  6,  0,  0,176,  6,  0,  0,177,  6,  2,  0,178,  6,  0,  0,193,  2,
-  9,  0,179,  6,233,  0, 10,  0, 19,  0, 29,  0,  9,  0,180,  6,  9,  0,181,  6,  9,  0,182,  6,  9,  0,183,  6,  9,  0,184,  6,
-  4,  0, 88,  0,  4,  0,185,  6,  0,  0,186,  6,  0,  0,187,  6,234,  0, 10,  0,213,  0,  0,  0,213,  0,  1,  0, 12,  0, 42,  6,
-  4,  0, 43,  6,  7,  0, 44,  6,233,  0,188,  6,  2,  0, 88,  0,  2,  0,160,  6,  4,  0, 87,  0,  9,  0,189,  6,235,  0,  3,  0,
-235,  0,  0,  0,235,  0,  1,  0,  7,  0,190,  6,236,  0, 11,  0,213,  0,  0,  0,213,  0,  1,  0, 12,  0, 42,  6,  4,  0, 43,  6,
-  7,  0, 44,  6,214,  0, 95,  6, 12,  0,191,  6,  4,  0,192,  6,  4,  0, 35,  0,  4,  0, 17,  0,  4,  0,193,  6,237,  0, 26,  0,
-213,  0,  0,  0,213,  0,  1,  0, 12,  0, 42,  6,  4,  0, 43,  6,  7,  0, 44,  6,  2,  0, 45,  6,214,  0, 95,  6, 19,  0,194,  6,
- 19,  0, 78,  0,  2,  0, 17,  0,  2,  0,160,  6,  7,  0,195,  6,  9,  0,196,  6,  7,  0, 88,  2,  7,  0, 89,  2,  7,  0,112,  6,
-  7,  0, 41,  6,  7,  0,197,  6,  7,  0,198,  6, 53,  0, 62,  1, 53,  0,199,  6,  4,  0,200,  6,  2,  0,201,  6,  2,  0,245,  0,
- 12,  0,202,  6,159,  0,113,  3,238,  0, 10,  0,213,  0,  0,  0,213,  0,  1,  0, 12,  0, 42,  6,  4,  0, 43,  6,  7,  0, 44,  6,
-  2,  0, 45,  6,  2,  0, 17,  0,  2,  0,144,  3,  4,  0, 35,  0,159,  0,113,  3,239,  0, 42,  0,213,  0,  0,  0,213,  0,  1,  0,
- 12,  0, 42,  6,  4,  0, 43,  6,  7,  0, 44,  6,  2,  0, 45,  6,214,  0, 95,  6,222,  0,128,  6,  0,  0,203,  6,  0,  0,114,  6,
-  0,  0,115,  6,  2,  0, 15,  0,  2,  0,204,  6,  2,  0, 17,  0,  2,  0,122,  6,  9,  0,196,  6,  4,  0,119,  6,  4,  0,205,  6,
-  4,  0,206,  6,  4,  0,207,  6, 15,  0,208,  6, 15,  0,209,  6,  7,  0,210,  6,  7,  0,211,  6,  7,  0,212,  6,  7,  0,195,  6,
-  2,  0,213,  6,  2,  0,235,  0,  2,  0,173,  1,  2,  0,214,  6,  2,  0, 35,  0,  2,  0, 87,  0,  2,  0,215,  6,  2,  0,216,  6,
-  9,  0,217,  6,  9,  0,218,  6,  9,  0,219,  6,  9,  0,220,  6,  9,  0,221,  6,  2,  0,222,  6,  0,  0,223,  6, 49,  0,224,  6,
-240,  0,  7,  0,240,  0,  0,  0,240,  0,  1,  0,  4,  0,225,  6,  4,  0, 21,  0,  0,  0, 81,  0,  4,  0,226,  6,  4,  0, 15,  0,
-241,  0, 14,  0,213,  0,  0,  0,213,  0,  1,  0, 12,  0, 42,  6,  4,  0, 43,  6,  7,  0, 44,  6,  2,  0, 45,  6,  4,  0,161,  6,
-  4,  0, 35,  0, 12,  0,227,  6, 12,  0,228,  6,  0,  0,229,  6,  0,  0,230,  6,  4,  0,231,  6,  4,  0,232,  6,242,  0,  6,  0,
-213,  0,  0,  0,213,  0,  1,  0, 12,  0, 42,  6,  4,  0, 43,  6,  4,  0, 35,  0,  0,  0,233,  6,243,  0, 15,  0,213,  0,  0,  0,
-213,  0,  1,  0, 12,  0, 42,  6,  4,  0, 43,  6,  7,  0, 44,  6,244,  0,234,  6,214,  0, 95,  6,245,  0,235,  6,  2,  0, 73,  1,
-  2,  0,236,  6,  2,  0, 88,  2,  2,  0, 89,  2,  2,  0, 17,  0,  2,  0,152,  6,  4,  0, 67,  0,246,  0,  7,  0,246,  0,  0,  0,
-246,  0,  1,  0,  0,  0,237,  6,  2,  0,238,  6,  2,  0,239,  6,  2,  0,240,  6,  2,  0, 35,  0,247,  0, 12,  0,  2,  0,239,  6,
-  2,  0,241,  6,  2,  0,242,  6,  0,  0,193,  2,  2,  0,243,  6,  2,  0,244,  6,  2,  0,245,  6,  2,  0,246,  6,  2,  0,247,  6,
-  2,  0, 86,  6,  7,  0,248,  6,  7,  0,249,  6,248,  0, 18,  0,248,  0,  0,  0,248,  0,  1,  0,  0,  0,  5,  4,247,  0,250,  6,
-247,  0,251,  6,247,  0,252,  6,247,  0,253,  6,  7,  0,254,  6,  2,  0,255,  6,  2,  0,  0,  7,  2,  0,  1,  7,  2,  0,  2,  7,
-  2,  0,  3,  7,  2,  0,  4,  7,  2,  0,  5,  7,  2,  0,  6,  7,  2,  0,  7,  7,  2,  0,  8,  7,249,  0, 10,  0,  0,  0,  9,  7,
-  0,  0, 10,  7,  0,  0, 11,  7,  0,  0, 12,  7,  0,  0, 13,  7,  0,  0, 14,  7,  2,  0, 15,  7,  2,  0, 16,  7,  2,  0, 17,  7,
-  2,  0, 18,  7,250,  0,  8,  0,  0,  0, 19,  7,  0,  0, 20,  7,  0,  0, 21,  7,  0,  0, 22,  7,  0,  0, 23,  7,  0,  0, 24,  7,
-  7,  0,  7,  6,  7,  0, 35,  0,251,  0, 18,  0,249,  0, 25,  7,249,  0, 26,  7,249,  0, 27,  7,249,  0, 28,  7,249,  0, 29,  7,
-249,  0, 30,  7,249,  0, 31,  7,249,  0, 32,  7,249,  0, 33,  7,249,  0, 34,  7,249,  0, 35,  7,249,  0, 36,  7,249,  0, 37,  7,
-249,  0, 38,  7,249,  0, 39,  7,249,  0, 40,  7,250,  0, 41,  7,  0,  0, 42,  7,252,  0, 97,  0,  0,  0, 43,  7,  0,  0, 44,  7,
-  0,  0, 13,  7,  0,  0, 45,  7,  0,  0, 46,  7,  0,  0, 47,  7,  0,  0, 48,  7,  0,  0, 49,  7,  0,  0, 50,  7,  0,  0, 51,  7,
-  0,  0, 52,  7,  0,  0, 53,  7,  0,  0, 54,  7,  0,  0, 55,  7,  0,  0, 56,  7,  0,  0, 57,  7,  0,  0, 58,  7,  0,  0, 59,  7,
-  0,  0, 60,  7,  0,  0, 61,  7,  0,  0, 62,  7,  0,  0, 63,  7,  0,  0, 64,  7,  0,  0, 65,  7,  0,  0, 66,  7,  0,  0, 67,  7,
-  0,  0, 68,  7,  0,  0, 69,  7,  0,  0, 70,  7,  0,  0, 71,  7,  0,  0, 72,  7,  0,  0, 73,  7,  0,  0, 74,  7,  0,  0, 75,  7,
-  0,  0, 76,  7,  0,  0, 77,  7,  0,  0, 78,  7,  0,  0, 79,  7,  0,  0, 80,  7,  0,  0, 81,  7,  0,  0, 82,  7,  0,  0, 83,  7,
-  0,  0, 84,  7,  0,  0, 85,  7,  0,  0, 86,  7,  0,  0, 87,  7,  0,  0, 88,  7,  0,  0, 89,  7,  0,  0, 90,  7,  0,  0, 91,  7,
-  0,  0, 92,  7,  0,  0, 93,  7,  0,  0, 94,  7,  0,  0, 95,  7,  0,  0, 96,  7,  0,  0, 97,  7,  0,  0, 98,  7,  0,  0, 99,  7,
-  0,  0,100,  7,  0,  0,101,  7,  0,  0,102,  7,  0,  0,103,  7,  0,  0,104,  7,  0,  0,105,  7,  0,  0,106,  7,  0,  0,107,  7,
-  0,  0,108,  7,  0,  0,109,  7,  0,  0,110,  7,  0,  0,111,  7,  0,  0,112,  7,  0,  0,113,  7,  0,  0,114,  7,  0,  0,115,  7,
-  0,  0,116,  7,  0,  0,117,  7,  0,  0,118,  7,  0,  0,119,  7,  0,  0,120,  7,  0,  0,121,  7,  0,  0,122,  7,  0,  0,123,  7,
-  0,  0,124,  7,  0,  0,125,  7,  0,  0,126,  7,  0,  0,127,  7,  0,  0,128,  7,  0,  0,129,  7,  0,  0,130,  7,  0,  0,131,  7,
-  0,  0,132,  7,  0,  0,133,  7,  0,  0,134,  7,  0,  0,135,  7,  0,  0,136,  7,  0,  0,137,  7,  0,  0,138,  7,253,  0,  5,  0,
-  0,  0,139,  7,  0,  0, 67,  7,  0,  0, 69,  7,  2,  0, 17,  0,  2,  0, 35,  0,254,  0, 25,  0,254,  0,  0,  0,254,  0,  1,  0,
-  0,  0, 18,  0,251,  0,140,  7,252,  0,141,  7,252,  0,142,  7,252,  0,143,  7,252,  0,144,  7,252,  0,145,  7,252,  0,146,  7,
-252,  0,147,  7,252,  0,148,  7,252,  0,149,  7,252,  0,150,  7,252,  0,151,  7,252,  0,152,  7,252,  0,153,  7,252,  0,154,  7,
-252,  0,155,  7,252,  0,156,  7,252,  0,157,  7,252,  0,158,  7,253,  0,159,  7,  4,  0,160,  7,  4,  0, 35,  0,255,  0,  3,  0,
-255,  0,  0,  0,255,  0,  1,  0,  0,  0,161,  7,  0,  1,  5,  0,  4,  0, 17,  0,  4,  0, 35,  0,  7,  0,135,  2,  7,  0,162,  7,
-  7,  0, 38,  2,  1,  1, 89,  0,  4,  0, 17,  0,  4,  0,163,  7,  4,  0,164,  7,  0,  0,165,  7,  0,  0,166,  7,  0,  0,167,  7,
-  0,  0,168,  7,  0,  0,169,  7,  0,  0,170,  7,  0,  0,171,  7,  0,  0,172,  7,  0,  0,173,  7,  0,  0,174,  7,  4,  0,175,  7,
-  2,  0,176,  7,  2,  0,177,  7,  2,  0,178,  7,  2,  0,179,  7,  4,  0,180,  7,  4,  0,181,  7,  4,  0,182,  7,  4,  0,183,  7,
-  2,  0,184,  7,  2,  0,185,  7,  4,  0,186,  7,  4,  0,187,  7,  4,  0,188,  7,  4,  0,189,  7,  4,  0,190,  7,  4,  0,227,  6,
-  4,  0,191,  7,  2,  0,192,  7,  2,  0,193,  7,  2,  0,194,  7,  2,  0,195,  7, 12,  0,196,  7, 12,  0,197,  7, 12,  0,198,  7,
- 12,  0,199,  7, 12,  0,200,  7,  0,  0,201,  7,  2,  0,202,  7,  2,  0,203,  7,  2,  0,204,  7,  2,  0,205,  7,  2,  0,206,  7,
-  2,  0,207,  7,  2,  0,208,  7,  2,  0,209,  7,  0,  1,210,  7,  2,  0,211,  7,  2,  0,212,  7,  2,  0,213,  7,  2,  0,214,  7,
-  2,  0,215,  7,  2,  0,216,  7,  2,  0,217,  7,  2,  0,218,  7,  4,  0,219,  7,  4,  0,220,  7,  2,  0,221,  7,  2,  0,222,  7,
-  2,  0,223,  7,  2,  0,224,  7,  2,  0,225,  7,  2,  0,226,  7,  2,  0,227,  7,  2,  0,228,  7,  2,  0,229,  7,  2,  0,230,  7,
-  2,  0,231,  7,  2,  0,232,  7,  2,  0,233,  7,  2,  0,234,  7,  2,  0,235,  7,  2,  0,236,  7,  2,  0,237,  7,  2,  0,238,  7,
-  0,  0,239,  7,  0,  0,240,  7,  7,  0,241,  7,  2,  0,176,  5,  2,  0,177,  5,  2,  0,242,  7,  2,  0,243,  7, 47,  0,244,  7,
-  7,  0,245,  7,  4,  0,230,  1,  0,  0,246,  7,  2,  1, 24,  0, 19,  0, 29,  0, 12,  0,247,  7, 12,  0,248,  7, 12,  0,249,  7,
- 12,  0, 42,  6, 38,  0,117,  0, 38,  0,250,  7,  4,  0,251,  7,  4,  0, 87,  0,  2,  0,252,  7,  2,  0,253,  7,  2,  0,254,  7,
-  2,  0,255,  7,  2,  0,  0,  8,  2,  0,  1,  8,  2,  0,  2,  8,  2,  0,  3,  8,  2,  0,  4,  8,  2,  0,  5,  8,  2,  0,  6,  8,
-  2,  0, 35,  0,211,  0,  7,  8,  9,  0,  8,  8,  2,  0,  9,  8,  3,  1,  5,  0,  3,  1,  0,  0,  3,  1,  1,  0,  3,  1, 10,  8,
- 13,  0, 11,  8,  4,  0, 17,  0,  4,  1,  7,  0,  4,  1,  0,  0,  4,  1,  1,  0,  3,  1, 12,  8,  3,  1, 13,  8,  2,  0, 44,  5,
-  2,  0, 17,  0,  4,  0, 35,  0,  5,  1, 25,  0,  5,  1,  0,  0,  5,  1,  1,  0,  6,  1, 14,  8,  7,  1,133,  6,  0,  0, 15,  8,
-  0,  0, 16,  8,  0,  0, 17,  8,  2,  0, 18,  8,  2,  0, 19,  8,  2,  0, 20,  8,  2,  0, 21,  8,  2,  0, 22,  8,  2,  0, 35,  0,
-  2,  0, 17,  0,  2,  0, 23,  8,  2,  0, 24,  8,  2,  0, 25,  8,  4,  0, 26,  8,  5,  1, 27,  8,  9,  0, 28,  8,  4,  0, 29,  8,
-  4,  0, 30,  8,  4,  0, 31,  8,  4,  0, 32,  8,  0,  0, 33,  8,244,  0, 22,  0,244,  0,  0,  0,244,  0,  1,  0,  3,  1, 12,  8,
-  3,  1, 13,  8,  3,  1, 34,  8,  3,  1, 35,  8,  2,  1, 36,  8, 15,  0, 49,  0,  0,  0, 43,  6,  0,  0, 37,  8,  2,  0, 87,  6,
-  2,  0, 88,  6,  2,  0, 38,  8,  2,  0, 35,  0,  2,  0,  0,  8,  2,  0,226,  6,  2,  0, 17,  0,  8,  1, 14,  8, 12,  0, 39,  8,
- 12,  0, 42,  6, 12,  0, 40,  8, 12,  0, 41,  8,  9,  1, 24,  0,  9,  1,  0,  0,  9,  1,  1,  0,214,  0, 95,  6, 15,  0, 42,  8,
- 15,  0, 43,  8,  2,  0, 87,  6,  2,  0, 88,  6,  2,  0, 44,  8,  2,  0, 45,  8,  2,  0, 46,  8,  2,  0, 17,  0,  7,  0, 84,  2,
-  2,  0, 20,  8,  2,  0, 21,  8,  2,  0,255,  7,  2,  0, 47,  8,  2,  0,  4,  8,  2,  0,196,  4, 10,  1, 14,  8, 12,  0, 48,  8,
- 12,  0, 49,  8, 12,  0, 40,  8,  0,  0, 50,  8,  9,  0, 51,  8, 11,  1, 14,  0,  0,  0, 52,  8,  2,  0, 53,  8,  2,  0, 54,  8,
-  2,  0, 55,  8,  2,  0, 56,  8,  2,  0, 32,  5,  2,  0, 57,  8,  2,  1, 58,  8, 38,  0, 59,  8,  4,  0, 60,  8,  4,  0, 61,  8,
-  4,  0, 62,  8,  4,  0, 35,  0,  0,  0, 63,  8, 12,  1,  3,  0,  0,  0, 64,  8,  4,  0, 65,  8,  4,  0, 66,  8, 13,  1,  4,  0,
-  4,  0,158,  6,  4,  0, 67,  8,  4,  0,164,  6,  4,  0, 68,  8, 14,  1,  2,  0,  4,  0, 69,  8,  4,  0, 70,  8, 15,  1,  5,  0,
-  7,  0, 71,  8,  7,  0, 72,  8,  7,  0, 73,  8,  4,  0, 17,  0,  4,  0, 35,  0, 16,  1,  6,  0,  0,  0, 74,  8,  0,  0,115,  6,
- 41,  0,130,  0,  2,  0,104,  0,  2,  0, 31,  5,  4,  0, 35,  0, 17,  1, 14,  0, 17,  1,  0,  0, 17,  1,  1,  0,  4,  0, 54,  0,
-  4,  0, 21,  0,  4,  0, 26,  0,  4,  0, 75,  8,  4,  0, 76,  8,  4,  0, 77,  8, 12,  1, 78,  8,  0,  0, 74,  8, 16,  1,107,  3,
- 13,  1, 79,  8, 14,  1, 80,  8, 15,  1, 81,  8, 18,  1, 12,  0,  0,  0,255,  1,  9,  0,221,  0,  0,  0,222,  0,  4,  0,225,  0,
-  4,  0,233,  0,  9,  0,226,  0,  7,  0,228,  0,  7,  0,229,  0,  9,  0, 82,  8,  9,  0, 83,  8,  9,  0,230,  0,  9,  0,232,  0,
- 19,  1, 48,  0, 19,  1,  0,  0, 19,  1,  1,  0,  9,  0, 84,  8,  9,  0, 24,  0,  0,  0, 25,  0,  4,  0, 17,  0,  4,  0, 15,  0,
-  4,  0, 21,  0,  4,  0, 85,  0,  4,  0, 85,  8,  4,  0, 86,  8,  4,  0, 76,  8,  4,  0, 77,  8,  4,  0, 87,  8,  4,  0,244,  0,
-  4,  0, 88,  8,  4,  0, 89,  8,  7,  0, 90,  8,  7,  0, 35,  0,  7,  0, 91,  8,  7,  0, 92,  8,  4,  0,121,  0,  4,  0, 93,  8,
- 17,  1, 94,  8, 28,  0, 77,  0, 38,  0,117,  0, 24,  0, 95,  8, 41,  0,130,  0,  7,  0, 96,  8,  7,  0, 97,  8, 18,  1, 63,  1,
- 19,  1, 98,  8, 19,  1, 99,  8, 19,  1,100,  8, 12,  0,101,  8,245,  0,235,  6,  9,  0,102,  8,  7,  0, 15,  4,  7,  0,103,  8,
-  7,  0,104,  8,  4,  0,105,  8,  4,  0,106,  8,  7,  0,107,  8,  9,  0,108,  8,  4,  0,109,  8,  4,  0,110,  8,  4,  0,111,  8,
-  7,  0,112,  8, 20,  1,  4,  0, 20,  1,  0,  0, 20,  1,  1,  0, 12,  0,113,  8, 19,  1,114,  8,203,  0, 11,  0, 12,  0,115,  8,
- 12,  0,101,  8, 12,  0,116,  8, 19,  1,117,  8,  0,  0,118,  8,  0,  0,119,  8,  4,  0,120,  8,  4,  0,121,  8,  4,  0,122,  8,
-  4,  0, 35,  0, 16,  0,123,  8, 21,  1,  4,  0,  7,  0,124,  8,  7,  0, 77,  3,  2,  0,125,  8,  2,  0,126,  8, 22,  1,  6,  0,
-  7,  0,127,  8,  7,  0,128,  8,  7,  0,129,  8,  7,  0,130,  8,  4,  0,131,  8,  4,  0,132,  8, 23,  1, 13,  0,  7,  0,133,  8,
-  7,  0,134,  8,  7,  0,135,  8,  7,  0,136,  8,  7,  0,137,  8,  7,  0,138,  8,  7,  0,139,  8,  7,  0,140,  8,  7,  0,141,  8,
-  7,  0,142,  8,  4,  0,234,  2,  4,  0,143,  8,  4,  0,144,  8, 24,  1,  2,  0,  7,  0,102,  5,  7,  0, 35,  0, 25,  1,  4,  0,
-  0,  0,145,  8,  0,  0,146,  8,  7,  0,147,  8,  7,  0,148,  8, 26,  1,  5,  0,  7,  0,149,  8,  7,  0,150,  8,  4,  0, 88,  0,
-  4,  0,194,  2,  4,  0,151,  8, 27,  1,  6,  0, 27,  1,  0,  0, 27,  1,  1,  0,  2,  0, 15,  0,  2,  0, 17,  0,  2,  0,152,  8,
-  2,  0, 54,  0, 28,  1,  8,  0, 28,  1,  0,  0, 28,  1,  1,  0,  2,  0, 15,  0,  2,  0, 17,  0,  2,  0,152,  8,  2,  0, 54,  0,
-  7,  0, 21,  0,  7,  0,121,  0, 29,  1, 45,  0, 29,  1,  0,  0, 29,  1,  1,  0,  2,  0, 15,  0,  2,  0, 17,  0,  2,  0,152,  8,
-  2,  0,240,  0,  2,  0, 57,  4,  2,  0,153,  8,  7,  0,154,  8,  7,  0, 86,  0,  7,  0,247,  2,  4,  0,155,  8,  4,  0, 79,  0,
-  4,  0,196,  2,  7,  0,156,  8,  7,  0,157,  8,  7,  0,158,  8,  7,  0,159,  8,  7,  0,160,  8,  7,  0,161,  8,  7,  0,244,  2,
-  7,  0, 60,  1,  7,  0,162,  8,  7,  0,163,  8,  7,  0, 35,  0,  7,  0,164,  8,  7,  0,165,  8,  7,  0,166,  8,  2,  0,167,  8,
-  2,  0,168,  8,  2,  0,169,  8,  2,  0,170,  8,  2,  0,171,  8,  2,  0,172,  8,  2,  0,173,  8,  2,  0,174,  8,  2,  0, 23,  2,
-  2,  0,175,  8,  2,  0, 20,  2,  2,  0,176,  8,  0,  0,177,  8,  0,  0,178,  8,  7,  0,238,  0, 30,  1,179,  8, 58,  0,233,  1,
- 31,  1, 16,  0, 31,  1,  0,  0, 31,  1,  1,  0,  2,  0, 15,  0,  2,  0, 17,  0,  2,  0,152,  8,  2,  0,240,  0,  7,  0,239,  2,
-  7,  0,240,  2,  7,  0,241,  2,  7,  0, 73,  2,  7,  0,242,  2,  7,  0,243,  2,  7,  0,180,  8,  7,  0,244,  2,  7,  0,246,  2,
-  7,  0,247,  2,227,  0,  5,  0,  2,  0, 15,  0,  2,  0,181,  8,  2,  0, 17,  0,  2,  0,182,  8, 19,  0,194,  6,226,  0,  3,  0,
-  4,  0, 66,  0,  4,  0,183,  8,227,  0,  2,  0, 32,  1,  7,  0, 32,  1,  0,  0, 32,  1,  1,  0,  0,  0, 18,  0,  2,  0, 15,  0,
-  2,  0, 17,  0,  4,  0, 20,  0,  9,  0,184,  8, 33,  1,  5,  0,  0,  0, 18,  0,  7,  0, 80,  1,  7,  0,185,  8,  4,  0,186,  8,
-  4,  0, 35,  0, 34,  1,  4,  0,  2,  0, 15,  0,  2,  0, 17,  0,  2,  0, 87,  0,  2,  0, 67,  0, 35,  1,  4,  0,  0,  0, 18,  0,
- 57,  0,187,  8,  7,  0, 80,  1,  7,  0, 35,  0, 36,  1,  6,  0,  2,  0,188,  8,  2,  0,189,  8,  2,  0, 15,  0,  2,  0,190,  8,
-  0,  0,191,  8,  0,  0,192,  8, 37,  1,  5,  0,  4,  0, 15,  0,  4,  0, 35,  0,  0,  0, 18,  0,  0,  0,193,  8,  0,  0,194,  8,
- 38,  1,  3,  0,  4,  0, 15,  0,  4,  0, 35,  0,  0,  0, 18,  0, 39,  1,  4,  0,  2,  0,195,  8,  2,  0,196,  8,  2,  0, 17,  0,
-  2,  0, 35,  0, 40,  1,  6,  0,  0,  0, 18,  0,  0,  0,197,  8,  2,  0,198,  8,  2,  0,244,  2,  2,  0, 73,  1,  2,  0, 67,  0,
- 41,  1,  5,  0,  0,  0, 18,  0,  7,  0, 77,  3,  7,  0,146,  4,  2,  0, 17,  0,  2,  0,208,  2, 42,  1,  3,  0,  0,  0, 18,  0,
-  4,  0,196,  2,  4,  0,195,  8, 43,  1,  7,  0,  0,  0, 18,  0,  7,  0,146,  4,  0,  0,199,  8,  0,  0,200,  8,  2,  0, 73,  1,
-  2,  0, 87,  0,  4,  0,201,  8, 44,  1,  4,  0,  0,  0,202,  8,  0,  0,203,  8,  4,  0, 15,  0,  7,  0,212,  2, 45,  1,  3,  0,
- 24,  0,204,  8,  0,  0,205,  8,  0,  0,206,  8, 46,  1, 18,  0, 46,  1,  0,  0, 46,  1,  1,  0,  2,  0, 15,  0,  2,  0,207,  8,
-  2,  0, 17,  0,  2,  0,208,  8,  2,  0,209,  8,  2,  0,210,  8,  2,  0, 87,  0,  2,  0, 67,  0,  0,  0, 18,  0,  9,  0,  2,  0,
- 47,  1,211,  8, 24,  0, 42,  0,  2,  0,119,  5,  2,  0,103,  8,  2,  0,212,  8,  2,  0, 35,  0, 48,  1, 11,  0,  0,  0, 18,  0,
-  0,  0, 15,  0,  0,  0,213,  8,  2,  0, 17,  0,  2,  0,208,  2,  2,  0,214,  8,  4,  0,215,  8,  4,  0,216,  8,  4,  0,217,  8,
-  4,  0,218,  8,  4,  0,219,  8, 49,  1,  1,  0,  0,  0,220,  8, 50,  1,  4,  0, 34,  0,157,  6,  0,  0,161,  7,  4,  0, 73,  1,
-  4,  0, 17,  0, 47,  1, 18,  0, 47,  1,  0,  0, 47,  1,  1,  0, 47,  1,221,  8,  2,  0, 15,  0,  2,  0, 17,  0,  2,  0,222,  8,
-  2,  0,210,  8,  2,  0,207,  8,  2,  0,223,  8,  2,  0, 67,  0,  2,  0,230,  1,  0,  0, 18,  0,  9,  0,  2,  0, 51,  1,211,  8,
- 46,  1,224,  8,  2,  0, 13,  0,  2,  0,225,  8,  4,  0,226,  8, 52,  1,  3,  0,  4,  0,222,  2,  4,  0, 35,  0, 24,  0, 42,  0,
- 53,  1, 15,  0,157,  0,227,  8,  2,  0, 15,  0,  2,  0, 17,  0,  7,  0,154,  8,  7,  0, 86,  0,  0,  0, 18,  0,  0,  0,228,  8,
-  2,  0,229,  8,  2,  0,230,  8,  2,  0,126,  0,  2,  0,231,  8,  2,  0,232,  8,  2,  0, 35,  0,  7,  0,233,  8,  7,  0,234,  8,
- 54,  1,  8,  0,  7,  0,235,  8,  7,  0,236,  8,  7,  0,237,  8,  7,  0,238,  8,  7,  0,239,  8,  7,  0,240,  8,  7,  0,241,  8,
-  7,  0,242,  8, 55,  1, 13,  0,  2,  0, 17,  0,  2,  0,236,  6,  4,  0, 87,  0,  4,  0, 67,  0,  2,  0,243,  8,  7,  0, 15,  4,
-  7,  0,244,  8,245,  0,235,  6, 54,  1,245,  8,  2,  0, 15,  0,  2,  0, 38,  5,  2,  0,  1,  6,  2,  0,246,  8, 56,  1, 11,  0,
-  4,  0,222,  2,  2,  0, 15,  0,  2,  0, 17,  0, 24,  0, 42,  0, 73,  0,247,  8,  0,  0, 18,  0,  7,  0,248,  8,  7,  0,249,  8,
-  7,  0,152,  3,  2,  0,250,  8,  2,  0,251,  8, 57,  1,  5,  0,  2,  0, 15,  0,  2,  0, 87,  0,  4,  0, 35,  0, 38,  0,117,  0,
- 24,  0,110,  5, 58,  1,  5,  0,  4,  0, 35,  0,  4,  0, 15,  0,  0,  0, 18,  0,  0,  0,193,  8, 24,  0, 42,  0, 59,  1, 13,  0,
-  2,  0, 17,  0,  2,  0, 15,  0,  2,  0,207,  8,  2,  0,153,  3,  7,  0,252,  8,  7,  0,253,  8,  7,  0,196,  4,  7,  0,164,  3,
-  7,  0,123,  3,  7,  0,126,  3,  7,  0,254,  8,  7,  0,255,  8, 24,  0,  0,  9, 60,  1, 10,  0,  2,  0, 17,  0,  2,  0, 15,  0,
-  7,  0,154,  8,  7,  0, 86,  0,  0,  0, 18,  0,  0,  0,228,  8,  2,  0, 87,  0,  2,  0, 67,  0,  2,  0,230,  1,  2,  0, 38,  5,
- 61,  1,  8,  0, 24,  0, 42,  0,  7,  0,241,  2,  7,  0,  1,  9,  7,  0,  2,  9,  7,  0,153,  3,  2,  0, 87,  0,  2,  0,208,  2,
-  7,  0, 67,  0, 62,  1, 12,  0,  2,  0, 15,  0,  2,  0, 73,  1,  2,  0, 17,  0,  2,  0,244,  2,  2,  0,222,  2,  2,  0,  3,  9,
-  4,  0, 35,  0,  7,  0,  4,  9,  7,  0,  5,  9,  7,  0,  6,  9,  7,  0,  7,  9,  0,  0,  8,  9, 63,  1,  9,  0,  2,  0, 17,  0,
-  2,  0, 15,  0,  4,  0,154,  8,  4,  0, 86,  0,  0,  0, 18,  0,  2,  0,196,  4,  2,  0, 61,  0,  2,  0,  9,  9,  2,  0, 10,  9,
- 64,  1,  7,  0,  4,  0,196,  2,  4,  0, 11,  9,  4,  0, 12,  9,  4,  0, 13,  9,  7,  0, 14,  9,  7,  0, 15,  9,  0,  0,199,  8,
- 65,  1,  7,  0,  0,  0, 16,  9, 24,  0, 17,  9,  0,  0,205,  8,  2,  0, 18,  9,  2,  0, 87,  0,  4,  0, 67,  0,  0,  0,206,  8,
- 66,  1,  6,  0,  2,  0, 17,  0,  2,  0, 15,  0,  4,  0,154,  8,  4,  0, 86,  0,  0,  0, 19,  9,  0,  0, 20,  9, 67,  1,  1,  0,
-  4,  0, 17,  0, 68,  1,  6,  0,  0,  0, 90,  0,  2,  0, 15,  0,  2,  0, 17,  0,  4,  0, 21,  9,  7,  0, 22,  9, 34,  0,157,  6,
- 69,  1,  4,  0,  0,  0,160,  2,  2,  0, 17,  0,  4,  0, 15,  0, 24,  0, 42,  0, 70,  1,  2,  0,  4,  0, 15,  0,  4,  0, 76,  6,
- 71,  1,  6,  0,  0,  0,202,  8,  0,  0,203,  8,  4,  0, 15,  0,  7,  0, 31,  2, 24,  0, 54,  3, 24,  0, 23,  9, 51,  1, 10,  0,
- 51,  1,  0,  0, 51,  1,  1,  0, 51,  1,221,  8,  2,  0, 15,  0,  2,  0, 17,  0,  2,  0,207,  8,  2,  0, 24,  9,  0,  0, 18,  0,
-  9,  0,  2,  0, 24,  0, 42,  0,245,  0, 16,  0, 19,  0, 29,  0,  0,  0, 32,  0, 35,  0,145,  0,  9,  0,221,  0, 35,  0, 25,  9,
- 28,  0, 77,  0,  7,  0, 15,  4,  7,  0, 26,  9,  7,  0,244,  8,  7,  0,235,  8,  7,  0,236,  8,  7,  0, 27,  9,  4,  0, 88,  0,
-  4,  0, 35,  0,  9,  0, 28,  9,  9,  0, 29,  9, 72,  1,  6,  0, 72,  1,  0,  0, 72,  1,  1,  0, 24,  0, 42,  0,  9,  0, 30,  9,
-  2,  0,245,  0,  0,  0,193,  2, 58,  0,  4,  0, 19,  0, 29,  0, 12,  0, 31,  9,  4,  0,126,  0,  7,  0, 32,  9, 73,  1, 28,  0,
- 73,  1,  0,  0, 73,  1,  1,  0, 18,  0, 33,  9, 73,  1, 36,  0, 12,  0, 34,  9,  0,  0, 18,  0,  7,  0, 35,  9,  7,  0, 36,  9,
-  7,  0, 37,  9,  7,  0, 38,  9,  4,  0, 17,  0,  7,  0, 39,  9,  7,  0, 40,  9,  7,  0, 41,  9,  7,  0, 42,  9,  7,  0, 80,  1,
-  7,  0, 31,  2,  7,  0, 43,  9,  7,  0,194,  2,  7,  0, 44,  9,  7,  0, 45,  9,  7,  0, 46,  9,  7,  0, 47,  9,  7,  0, 48,  9,
-  7,  0,168,  0,  4,  0,126,  0,  2,  0,156,  5,  2,  0,  8,  7, 74,  1, 25,  0, 19,  0, 29,  0, 31,  0, 72,  0, 12,  0, 49,  9,
- 12,  0, 50,  9, 12,  0, 51,  9, 73,  1, 52,  9,  9,  0, 53,  9,  9,  0, 54,  9,  4,  0, 17,  0,  4,  0, 51,  6,  2,  0,248,  2,
-  2,  0,106,  6,  4,  0, 55,  9,  4,  0,126,  0,  4,  0, 56,  9,  2,  0, 57,  9,  2,  0, 58,  9,  2,  0, 59,  9,  2,  0, 60,  9,
-  4,  0, 61,  9,  4,  0, 62,  9,  4,  0, 63,  9,  4,  0, 64,  9,  4,  0, 65,  9,  4,  0, 66,  9, 75,  1,  2,  0,  7,  0,149,  2,
-  4,  0, 17,  0,161,  0,  5,  0, 75,  1, 67,  9,  4,  0,194,  2,  4,  0, 68,  9,  4,  0, 69,  9,  4,  0, 17,  0,160,  0, 16,  0,
-  4,  0, 70,  9,  4,  0, 71,  9,  4,  0, 72,  9,  4,  0, 73,  9,  2,  0, 74,  9,  2,  0, 75,  9,  2,  0, 76,  9,  2,  0,245,  0,
-  2,  0, 77,  9,  2,  0, 78,  9,  2,  0, 79,  9,  2,  0, 80,  9,  4,  0, 81,  9,  4,  0, 82,  9,  4,  0, 83,  9,  4,  0, 84,  9,
- 76,  1, 41,  0, 76,  1,  0,  0, 76,  1,  1,  0, 18,  0, 33,  9, 12,  0,178,  3,  0,  0, 18,  0,  2,  0, 17,  0,  2,  0, 85,  9,
-  2,  0, 86,  9,  2,  0, 87,  9,  2,  0,138,  3,  2,  0, 88,  9,  4,  0, 71,  2,  4,  0, 63,  9,  4,  0, 64,  9, 73,  1, 89,  9,
- 76,  1, 36,  0, 76,  1, 90,  9, 12,  0, 91,  9,161,  0,115,  3, 24,  0, 92,  9, 76,  1, 93,  9,  7,  0, 68,  1,  7,  0,168,  0,
-  7,  0, 94,  9,  7,  0, 10,  2,  7,  0,128,  3,  7,  0,130,  3,  2,  0,161,  3,  2,  0, 35,  0,  7,  0, 95,  9,  7,  0, 96,  9,
-  7,  0,133,  3,  7,  0, 97,  9,  7,  0, 98,  9,  7,  0, 99,  9,  7,  0,100,  9,  7,  0,101,  9,  7,  0,102,  9,  7,  0,103,  9,
-  7,  0,104,  9,  7,  0, 64,  2,158,  0, 16,  0, 12,  0,105,  9, 68,  0,106,  9,  2,  0, 17,  0,  2,  0, 35,  0,  4,  0,107,  9,
-  4,  0, 87,  0,  7,  0,100,  2,  7,  0,108,  9,  7,  0,109,  9, 12,  0,110,  9,  4,  0,111,  9,  4,  0,112,  9,  9,  0,113,  9,
-  9,  0,114,  9,160,  0,114,  3,  0,  0,115,  9, 77,  1,  1,  0,  4,  0,112,  9, 78,  1, 12,  0,  4,  0,112,  9,  7,  0,219,  8,
-  2,  0,116,  9,  2,  0,117,  9,  7,  0,118,  9,  7,  0,119,  9,  2,  0,120,  9,  2,  0, 17,  0,  7,  0,121,  9,  7,  0,122,  9,
-  7,  0,123,  9,  7,  0,124,  9, 79,  1,  7,  0, 79,  1,  0,  0, 79,  1,  1,  0, 12,  0,125,  9,  4,  0, 17,  0,  4,  0,126,  9,
-  0,  0,  5,  4,253,  0,127,  9,157,  0,  9,  0, 19,  0, 29,  0, 12,  0,128,  9, 12,  0,105,  9, 12,  0,129,  9, 12,  0, 98,  0,
-  4,  0, 17,  0,  4,  0,130,  9,  4,  0,131,  9,  4,  0, 35,  0,217,  0,  6,  0, 19,  0,132,  9, 12,  0,105,  9, 58,  0,133,  9,
-  0,  0,134,  9,  4,  0,135,  9,  4,  0, 17,  0, 80,  1, 13,  0,213,  0,  0,  0,213,  0,  1,  0, 12,  0, 42,  6,  4,  0, 43,  6,
-  7,  0, 44,  6,  2,  0, 45,  6,214,  0, 95,  6,157,  0,110,  3,217,  0,136,  9,  0,  0, 73,  1,  0,  0, 98,  6,  2,  0, 17,  0,
-  7,  0,137,  9, 81,  1,  8,  0, 81,  1,  0,  0, 81,  1,  1,  0, 79,  1,138,  9, 28,  0, 77,  0, 12,  0,116,  3,  4,  0, 17,  0,
-  0,  0, 18,  0,  4,  0,253,  7, 82,  1,  5,  0, 82,  1,  0,  0, 82,  1,  1,  0, 28,  0, 77,  0,  2,  0, 17,  0,  0,  0,139,  9,
- 83,  1, 14,  0, 83,  1,  0,  0, 83,  1,  1,  0,  9,  0,  2,  0,  2,  0, 15,  0,  2,  0, 17,  0,  0,  0,140,  9,  0,  0,141,  9,
-  0,  0,139,  9,  7,  0,142,  9,  7,  0,143,  9,  4,  0, 35,  0, 28,  0, 77,  0,  7,  0,144,  9,  7,  0,145,  9, 84,  1,  9,  0,
- 84,  1,  0,  0, 84,  1,  1,  0, 24,  0,146,  9,  0,  0,251,  2,  7,  0,147,  9,  2,  0,148,  9,  2,  0, 17,  0,  2,  0, 15,  0,
-  2,  0,149,  9, 85,  1,  7,  0, 34,  0,157,  6, 18,  0, 33,  9,  4,  0, 17,  0,  4,  0,150,  9, 12,  0,151,  9, 24,  0,146,  9,
-  0,  0,251,  2, 86,  1, 15,  0, 24,  0,146,  9,  2,  0,152,  9,  2,  0, 17,  0,  2,  0,153,  9,  2,  0,154,  9,  0,  0,251,  2,
- 24,  0,155,  9,  0,  0,156,  9,  7,  0,157,  9,  7,  0, 31,  2,  7,  0,158,  9,  7,  0,159,  9,  2,  0, 15,  0,  2,  0, 73,  1,
-  7,  0, 80,  1, 87,  1,  6,  0, 24,  0,146,  9,  7,  0, 67,  9,  2,  0,160,  9,  2,  0,161,  9,  2,  0, 17,  0,  2,  0,162,  9,
- 88,  1,  6,  0, 24,  0,146,  9,  4,  0,163,  9,  4,  0,164,  9,  4,  0, 88,  0,  4,  0, 35,  0,  0,  0,251,  2, 89,  1,  4,  0,
- 24,  0,146,  9,  4,  0, 17,  0,  4,  0,163,  9,  0,  0,251,  2, 90,  1,  4,  0, 24,  0,146,  9,  4,  0, 17,  0,  4,  0,163,  9,
-  0,  0,251,  2, 91,  1,  4,  0, 24,  0,146,  9,  4,  0, 17,  0,  4,  0,163,  9,  0,  0,251,  2, 92,  1,  2,  0,  4,  0, 17,  0,
-  7,  0, 15,  4, 93,  1,  2,  0, 24,  0,146,  9,  0,  0,251,  2, 94,  1, 10,  0, 24,  0,146,  9,  4,  0,165,  9,  7,  0,120,  0,
-  4,  0, 17,  0,  2,  0,155,  6,  2,  0,166,  9,  2,  0, 87,  0,  2,  0, 67,  0,  7,  0,167,  9,  0,  0,251,  2, 95,  1, 10,  0,
- 24,  0,146,  9,  2,  0, 15,  0,  2,  0, 65,  4,  4,  0, 85,  0,  4,  0, 86,  0,  7,  0,  1,  9,  7,  0,  2,  9,  4,  0, 35,  0,
-157,  0,227,  8,  0,  0,251,  2, 96,  1,  4,  0, 24,  0,146,  9,  4,  0,139,  3,  4,  0,168,  9,  0,  0,251,  2, 97,  1,  4,  0,
- 24,  0,146,  9,  4,  0,139,  3,  4,  0, 35,  0,  0,  0,251,  2, 98,  1,  6,  0, 24,  0,146,  9,  7,  0,120,  0,  7,  0, 66,  3,
-  4,  0,169,  9,  2,  0,139,  3,  2,  0,140,  3, 99,  1,  6,  0, 24,  0,146,  9,  4,  0,170,  9,  4,  0,171,  9,  7,  0,172,  9,
-  7,  0,173,  9,  0,  0,251,  2,100,  1, 16,  0, 24,  0,146,  9, 24,  0, 90,  9,  4,  0, 15,  0,  7,  0,174,  9,  7,  0,175,  9,
-  7,  0,176,  9,  7,  0,177,  9,  7,  0,178,  9,  7,  0,179,  9,  7,  0,180,  9,  7,  0,181,  9,  7,  0,182,  9,  2,  0, 17,  0,
-  2,  0, 35,  0,  2,  0, 87,  0,  2,  0, 67,  0,101,  1,  3,  0, 24,  0,146,  9,  4,  0, 17,  0,  4,  0, 23,  2,102,  1,  5,  0,
- 24,  0,146,  9,  4,  0, 17,  0,  4,  0, 35,  0,  7,  0,183,  9,  0,  0,251,  2,103,  1, 10,  0, 24,  0,146,  9,  0,  0,251,  2,
-  2,  0,184,  9,  2,  0,185,  9,  0,  0,186,  9,  0,  0,187,  9,  7,  0,188,  9,  7,  0,189,  9,  7,  0,190,  9,  7,  0,191,  9,
-104,  1,  5,  0, 24,  0,146,  9,  0,  0,251,  2,  7,  0,202,  2,  2,  0,192,  9,  2,  0, 17,  0,105,  1,  8,  0,  7,  0,  7,  0,
-  7,  0,  8,  0,  7,  0,  9,  0,  7,  0, 10,  0,  7,  0,193,  9,  7,  0,194,  9,  2,  0, 17,  0,  2,  0, 23,  2,106,  1,  8,  0,
-  7,  0,  7,  0,  7,  0,  8,  0,  7,  0,  9,  0,  7,  0, 10,  0,  7,  0,193,  9,  7,  0,194,  9,  2,  0, 17,  0,  2,  0, 23,  2,
-107,  1,  8,  0,  7,  0,  7,  0,  7,  0,  8,  0,  7,  0,  9,  0,  7,  0, 10,  0,  7,  0,193,  9,  7,  0,194,  9,  2,  0, 17,  0,
-  2,  0, 23,  2,108,  1,  7,  0, 24,  0,146,  9,  0,  0,251,  2,  7,  0, 80,  1,  7,  0, 89,  1,  2,  0, 17,  0,  2,  0, 73,  1,
-  4,  0, 35,  0,109,  1,  5,  0, 24,  0, 54,  3,  7,  0, 80,  1,  2,  0, 58,  3,  0,  0, 60,  3,  0,  0,195,  9,110,  1, 10,  0,
-110,  1,  0,  0,110,  1,  1,  0,  2,  0, 15,  0,  2,  0, 17,  0,  0,  0,196,  9,  7,  0, 23,  1,  7,  0, 24,  1,  2,  0,125,  9,
-  2,  0,197,  9, 24,  0, 42,  0,111,  1, 22,  0,111,  1,  0,  0,111,  1,  1,  0,  2,  0, 17,  0,  2,  0, 73,  1,  2,  0,198,  9,
-  2,  0,199,  9, 28,  0, 77,  0,157,  0,227,  8, 24,  0,160,  0,  7,  0, 85,  0,  7,  0, 86,  0,  7,  0,200,  9,  7,  0,201,  9,
-  7,  0,202,  9,  7,  0,203,  9,  7,  0,237,  2,  7,  0,204,  9,  7,  0,229,  8,  7,  0,205,  9,  0,  0,206,  9,  0,  0,207,  9,
- 12,  0,119,  3,112,  1,  8,  0,  7,  0, 38,  2,  7,  0,  1,  9,  7,  0,  2,  9,  9,  0,  2,  0,  2,  0,208,  9,  2,  0,209,  9,
-  2,  0,210,  9,  2,  0,211,  9,113,  1, 19,  0,113,  1,  0,  0,113,  1,  1,  0,113,  1,212,  9,  0,  0, 18,  0,112,  1,213,  9,
-  2,  0, 15,  0,  2,  0, 17,  0,  2,  0,214,  9,  2,  0,215,  9,112,  1,216,  9,  2,  0,217,  9,  2,  0, 87,  0,  7,  0,218,  9,
-  7,  0,219,  9,  4,  0,220,  9,113,  1,221,  9,  4,  0,222,  9,  4,  0, 67,  0,114,  1,223,  9,115,  1,  4,  0,  0,  0,224,  9,
-  2,  0,225,  9,  2,  0,226,  9,  4,  0, 35,  0,116,  1, 34,  0,116,  1,  0,  0,116,  1,  1,  0,116,  1,227,  9,  0,  0, 18,  0,
-  2,  0, 15,  0,  2,  0, 17,  0,  2,  0, 75,  8,  2,  0,103,  8,  2,  0,228,  9,  2,  0,160,  6,  2,  0,217,  9,  2,  0,181,  8,
- 12,  0,222,  8, 12,  0,229,  9, 19,  0,194,  6,  9,  0,230,  9,  7,  0,218,  9,  7,  0,219,  9,  7,  0, 73,  2,  7,  0,231,  9,
-  0,  0,232,  9,  2,  0,233,  9,  2,  0,234,  9,  7,  0,235,  9,  7,  0,236,  9,  2,  0,237,  9,  2,  0,238,  9,  9,  0,239,  9,
- 16,  0,240,  9, 16,  0,241,  9, 16,  0,242,  9,115,  1,146,  0,117,  1,243,  9,118,  1,244,  9,114,  1,  8,  0,114,  1,  0,  0,
-114,  1,  1,  0,116,  1,245,  9,116,  1,246,  9,113,  1,247,  9,113,  1,248,  9,  4,  0, 17,  0,  4,  0, 35,  0, 53,  0, 23,  0,
- 19,  0, 29,  0, 31,  0, 72,  0,159,  0,113,  3, 12,  0,249,  9, 12,  0,250,  9,112,  1,251,  9, 12,  0,252,  9,  4,  0, 15,  0,
-  4,  0,253,  9,  4,  0,254,  9,  4,  0,255,  9,  4,  0, 17,  0,  4,  0, 35,  0, 12,  0,  0, 10, 12,  0,222,  8, 12,  0,229,  9,
-  4,  0, 65,  6,  9,  0,  1, 10,  9,  0,  2, 10,  4,  0,  3, 10,  9,  0,  4, 10,  9,  0,  5, 10,  9,  0,  6, 10,119,  1,  6,  0,
-  4,  0,119,  0,  4,  0,121,  0,  4,  0,181,  8,  0,  0,  7, 10,  0,  0,  8, 10,  2,  0, 35,  0,120,  1, 16,  0,  2,  0, 20,  8,
-  2,  0, 21,  8,  2,  0,  9, 10,  2,  0, 10, 10,  2,  0, 11, 10,  2,  0, 65,  0,  2,  0,195,  6,  2,  0, 12, 10,  7,  0,236,  2,
-  7,  0, 13, 10,  7,  0, 14, 10,  2,  0, 95,  1,  0,  0, 15, 10,  0,  0, 16, 10,  4,  0, 17, 10,  4,  0, 18, 10,121,  1,  9,  0,
-  7,  0, 19, 10,  7,  0, 20, 10,  7,  0, 27,  9,  7,  0, 77,  3,  7,  0, 21, 10,  7,  0,112,  6,  2,  0, 75,  3,  0,  0, 22, 10,
-  0,  0, 35,  0,122,  1,  4,  0,  7,  0, 23, 10,  7,  0, 24, 10,  2,  0, 75,  3,  2,  0, 35,  0,123,  1,  3,  0,  7,  0, 25, 10,
-  7,  0, 90,  8,  7,  0, 13,  0,124,  1,  7,  0,  0,  0,255,  1,  2,  0, 29,  5,  2,  0, 30,  5,  2,  0, 31,  5,  2,  0,218,  4,
-  4,  0,121,  0,  4,  0, 63,  4,125,  1,  9,  0,  7,  0, 26, 10,  7,  0, 27, 10,  7,  0, 28, 10,  7,  0, 84,  2,  7,  0, 29, 10,
-  7,  0, 30, 10,  7,  0, 31, 10,  2,  0, 32, 10,  2,  0, 33, 10,126,  1,  8,  0,  2,  0, 34, 10,  2,  0, 35, 10,  2,  0, 36, 10,
-  2,  0, 37, 10,  7,  0, 38, 10,  7,  0, 39, 10,  7,  0, 40, 10,  7,  0, 41, 10,127,  1,  2,  0,  7,  0,  5,  0,  7,  0,  6,  0,
-128,  1,  2,  0,  0,  0,162,  0,  0,  0, 42, 10,129,  1,  1,  0,  0,  0, 18,  0,130,  1, 10,  0,  0,  0, 43, 10,  0,  0, 44, 10,
-  0,  0,104,  6,  0,  0, 45, 10,  2,  0,  9, 10,  2,  0, 46, 10,  7,  0, 47, 10,  7,  0, 48, 10,  7,  0, 49, 10,  7,  0,204,  9,
-131,  1,  2,  0,  9,  0, 50, 10,  9,  0, 51, 10,132,  1, 11,  0,  0,  0, 31,  5,  0,  0, 15,  0,  0,  0, 75,  3,  0,  0, 77,  3,
-  0,  0, 52, 10,  0,  0,104,  0,  0,  0,160,  2,  7,  0, 53, 10,  7,  0, 54, 10,  7,  0, 55, 10,  7,  0, 56, 10,133,  1,  8,  0,
-  7,  0,188,  8,  7,  0,120,  0,  7,  0, 16, 10,  7,  0,153,  2,  7,  0, 57, 10,  7,  0,234,  0,  7,  0, 58, 10,  4,  0, 15,  0,
-134,  1,  4,  0,  2,  0, 59, 10,  2,  0, 60, 10,  2,  0, 61, 10,  2,  0, 35,  0,135,  1,  8,  0,  7,  0, 62, 10,  7,  0,202,  2,
-  7,  0, 63, 10,  7,  0, 71,  8,  7,  0, 72,  8,  7,  0, 73,  8,  7,  0, 64, 10,  7,  0, 65, 10,136,  1,  6,  0,  2,  0, 66, 10,
-  2,  0, 67, 10,  7,  0, 68, 10,  7,  0, 69, 10,  7,  0, 70, 10,  7,  0, 71, 10,137,  1,  1,  0,  0,  0, 18,  0,138,  1,  4,  0,
-  7,  0,  5,  0,  7,  0,  6,  0,  2,  0, 17,  0,  2,  0, 72, 10,139,  1, 10,  0,  2,  0,249,  3,  2,  0, 17,  0,  7,  0,146,  4,
-  7,  0, 73, 10,  7,  0, 74, 10,  7,  0, 75, 10,  7,  0, 76, 10,138,  1, 77, 10,138,  1, 78, 10,138,  1, 79, 10, 51,  0, 11,  0,
-  4,  0, 17,  0,  4,  0, 61,  0,  4,  0, 80, 10,  4,  0, 81, 10, 16,  0, 82, 10, 16,  0, 83, 10,139,  1, 84, 10,  7,  0, 85, 10,
-  7,  0, 86, 10,  7,  0, 87, 10,  7,  0, 88, 10,230,  0, 10,  0,  4,  0,125,  9,  4,  0, 89, 10,  7,  0, 90, 10,  7,  0, 91, 10,
-  7,  0, 92, 10,  7,  0, 93, 10,  7,  0,  8,  0,  7,  0, 10,  0,  4,  0, 73,  1,  4,  0,241,  2,229,  0, 18,  0,  4,  0,124,  0,
-  4,  0, 94, 10,  4,  0, 95, 10,  7,  0, 96, 10,  4,  0, 97, 10,  7,  0, 98, 10,  7,  0, 99, 10,  4,  0,100, 10,  7,  0,101, 10,
-  4,  0,102, 10,  7,  0,103, 10,230,  0,104, 10,  7,  0,105, 10,  7,  0,106, 10,  7,  0,107, 10,  7,  0,108, 10,  4,  0,109, 10,
-  4,  0, 35,  0,140,  1,  4,  0, 39,  0,228,  2,  7,  0,110, 10,  7,  0,162,  1,  7,  0, 35,  0,192,  0, 34,  0, 19,  0, 29,  0,
-140,  1,111, 10, 51,  0, 77, 10, 43,  0,112, 10, 49,  0,113, 10, 22,  0,146,  0,  0,  0,114, 10,  7,  0,115, 10,  2,  0,  7,  6,
-  2,  0,116, 10,  4,  0,104,  0,  4,  0, 17,  0,  7,  0,117, 10,  4,  0, 81,  2,  4,  0,118, 10,  7,  0,119, 10,  7,  0,120, 10,
-  7,  0,121, 10,  7,  0,162,  1,  4,  0,122, 10,  7,  0,123, 10,  0,  0,124, 10,  0,  0,125, 10,  0,  0,126, 10,  0,  0,127, 10,
-  7,  0,128, 10,  7,  0,129, 10,  7,  0,130, 10,  7,  0,241,  2,  7,  0,131, 10,  4,  0,132, 10,  7,  0,133, 10,  7,  0,134, 10,
-  7,  0,135, 10,141,  1, 10,  0,  4,  0, 15,  0,  4,  0,120,  0,  4,  0, 17,  0,  4,  0,202,  3,  4,  0,136, 10,  4,  0,137, 10,
-  4,  0,138, 10,  0,  0, 90,  0,  0,  0, 18,  0,  9,  0,  2,  0,142,  1,  1,  0,  0,  0, 63,  8, 84,  0,  7,  0,141,  1,139, 10,
-  4,  0,140, 10,  4,  0,141, 10,  4,  0,142, 10,  4,  0, 35,  0,  9,  0,143, 10,142,  1,144, 10,143,  1,  5,  0,  7,  0,149,  2,
-  7,  0,222,  2,  7,  0, 31,  2,  2,  0,130,  2,  2,  0, 35,  0,144,  1,  5,  0,  7,  0,149,  2,  7,  0, 90,  4,  7,  0,145, 10,
-  7,  0,146, 10,  7,  0,222,  2,145,  1,  5,  0, 24,  0,147, 10,146,  1, 20,  0,  7,  0,230,  5,  7,  0,148, 10,  7,  0, 54,  0,
-147,  1,  3,  0,  7,  0,149, 10,  4,  0,150, 10,  4,  0,151, 10,148,  1,  7,  0,  4,  0,152, 10,  4,  0,153, 10,  4,  0,154, 10,
-  7,  0,155, 10,  7,  0,156, 10,  7,  0,157, 10,  7,  0, 54,  0,149,  1,  8,  0,149,  1,  0,  0,149,  1,  1,  0, 24,  0, 42,  0,
-  4,  0,253,  0,  2,  0, 17,  0,  2,  0, 73,  1,  7,  0,222,  2,  7,  0,196,  8,150,  1,  7,  0,150,  1,  0,  0,150,  1,  1,  0,
- 24,  0, 42,  0,  2,  0,207,  2,  2,  0, 17,  0,  2,  0,253,  1,  2,  0, 54,  0,151,  1, 17,  0,144,  1,194,  3,144,  1,158, 10,
-143,  1,159, 10,144,  1,179,  8,145,  1,160, 10,  4,  0, 79,  0,  7,  0,222,  2,  7,  0,247,  2,  7,  0,161, 10,  4,  0,152, 10,
-  4,  0,162, 10,  7,  0,156, 10,  7,  0,157, 10,  7,  0,104,  0,  4,  0,163, 10,  2,  0, 17,  0,  2,  0,164, 10,152,  1, 15,  0,
-  7,  0,249,  0,  7,  0,165, 10,  7,  0,149, 10,  7,  0,166, 10,  7,  0,167, 10,  7,  0,168, 10,  7,  0,169, 10,  7,  0,170, 10,
-  7,  0,171, 10,  7,  0,172, 10,  7,  0,173, 10,  7,  0,174, 10,  7,  0,175, 10,  4,  0, 17,  0,  4,  0,176, 10,153,  1,124,  0,
- 19,  0, 29,  0, 31,  0, 72,  0,154,  1,177, 10,152,  1,178, 10,168,  0, 85,  4,  4,  0, 17,  0,  4,  0, 54,  0,  2,  0, 15,  0,
-  2,  0,184,  9,  2,  0,179, 10,  2,  0,108,  1,  2,  0,180, 10,  2,  0,161,  3,  2,  0,181, 10,  2,  0,182, 10,  2,  0,183, 10,
-  2,  0,184, 10,  2,  0,185, 10,  2,  0,186, 10,  2,  0,187, 10,  2,  0,188, 10,  2,  0,189, 10,  2,  0,127,  5,  2,  0,190, 10,
-  2,  0,191, 10,  2,  0,192, 10,  2,  0,193, 10,  2,  0,194, 10,  2,  0, 20,  2,  2,  0,172,  8,  2,  0,143,  8,  2,  0,195, 10,
-  2,  0,196, 10,  2,  0,212,  3,  2,  0,213,  3,  2,  0,197, 10,  2,  0,198, 10,  2,  0,199, 10,  2,  0,200, 10,  7,  0,201, 10,
-  7,  0,202, 10,  7,  0,203, 10,  7,  0,204, 10,  7,  0,205, 10,  7,  0,206, 10,  7,  0,207, 10,  2,  0, 77,  5,  2,  0,208, 10,
-  7,  0,209, 10,  7,  0,210, 10,  7,  0,211, 10,  7,  0,154,  8,  7,  0, 86,  0,  7,  0,247,  2,  7,  0,160,  8,  7,  0,212, 10,
-  7,  0,213, 10,  7,  0,214, 10,  7,  0,215, 10,  4,  0,155,  8,  4,  0,153,  8,  4,  0,216, 10,  4,  0,217, 10,  7,  0,156,  8,
-  7,  0,157,  8,  7,  0,158,  8,  7,  0,218, 10,  7,  0,219, 10,  7,  0,220, 10,  7,  0,221, 10,  7,  0,222, 10,  7,  0,223, 10,
-  7,  0,224, 10,  7,  0,225, 10,  7,  0,226, 10,  7,  0,152,  3,  7,  0,104,  0,  7,  0,227, 10,  7,  0,228, 10,  7,  0,229, 10,
-  7,  0,230, 10,  7,  0,207,  0,  7,  0,231, 10,  4,  0,232, 10,  4,  0,233, 10,  7,  0,234, 10,  7,  0,235, 10,  7,  0,236, 10,
-  7,  0,237, 10,  7,  0,238, 10,  7,  0,206,  0,  7,  0,239, 10,  7,  0,239,  3,  7,  0,237,  3,  7,  0,238,  3,  7,  0,240, 10,
-  7,  0,241, 10,  7,  0,242, 10,  7,  0,243, 10,  7,  0,244, 10,  7,  0,245, 10,  7,  0,246, 10,  7,  0,247, 10,  7,  0,248, 10,
-  7,  0,249, 10,  7,  0,250, 10,  7,  0,251, 10,  7,  0,252, 10,  7,  0,253, 10,  7,  0,254, 10,  7,  0,255, 10,  7,  0,  0, 11,
-  7,  0,  1, 11,  4,  0,  2, 11,  4,  0,  3, 11, 43,  0,126,  1, 58,  0,183,  3, 12,  0,  4, 11, 58,  0,  5, 11, 24,  0,  6, 11,
- 24,  0,  7, 11, 28,  0, 77,  0,163,  0, 65,  1,163,  0,  8, 11,141,  0, 50,  0,141,  0,  0,  0,141,  0,  1,  0,153,  1,  9, 11,
-151,  1, 10, 11,148,  1, 90,  9,171,  0, 11,  4,  9,  0, 12,  4,155,  1, 11, 11,155,  1, 12, 11, 12,  0, 13, 11, 12,  0, 14, 11,
-126,  0, 15, 11,134,  0, 16, 11,134,  0, 17, 11, 24,  0, 18, 11, 24,  0, 19, 11, 24,  0, 36,  0, 12,  0,151,  9,  0,  0, 18,  0,
-  7,  0,238,  0,  7,  0, 20,  3,  7,  0, 20, 11,  7,  0, 21, 11,  4,  0,196,  2,  4,  0, 22, 11,  4,  0, 17,  0,  4,  0,155,  8,
-  4,  0, 23, 11,  4,  0, 24, 11,  4,  0, 25, 11,  4,  0, 26, 11,  2,  0,245,  0,  2,  0, 27, 11,  2,  0, 28, 11,  2,  0, 29, 11,
-  0,  0, 30, 11,  2,  0, 31, 11,  2,  0, 32, 11,  2,  0, 33, 11,  9,  0, 34, 11,130,  0, 84,  4, 12,  0,  5,  3, 12,  0, 35, 11,
-147,  1, 36, 11,  4,  0, 37, 11,  4,  0, 38, 11,156,  1, 39, 11,132,  0, 17,  3,157,  1, 40, 11,  7,  0, 41, 11,128,  0, 37,  0,
-158,  1, 28,  9,  7,  0, 54,  4,  7,  0, 42, 11,  7,  0, 43, 11,  7,  0,230,  5,  7,  0,162,  3,  7,  0,152,  3,  7,  0, 44, 11,
-  7,  0, 83,  2,  7,  0, 45, 11,  7,  0, 46, 11,  7,  0, 47, 11,  7,  0, 48, 11,  7,  0, 49, 11,  7,  0, 50, 11,  7,  0, 55,  4,
-  7,  0, 51, 11,  7,  0, 52, 11,  7,  0, 53, 11,  7,  0, 56,  4,  7,  0, 52,  4,  7,  0, 53,  4,  7,  0, 54, 11,  7,  0, 55, 11,
-  4,  0, 56, 11,  4,  0, 88,  0,  4,  0, 57, 11,  4,  0, 58, 11,  2,  0, 59, 11,  2,  0, 60, 11,  2,  0, 61, 11,  2,  0, 62, 11,
-  2,  0, 63, 11,  2,  0, 64, 11,  2,  0, 65, 11,  2,  0,196,  4,168,  0, 85,  4,129,  0, 11,  0,158,  1, 66, 11,  7,  0, 67, 11,
-  7,  0, 68, 11,  7,  0,234,  1,  7,  0, 69, 11,  7,  0, 70, 11,  7,  0, 71, 11,  4,  0, 88,  0,  2,  0, 72, 11,  2,  0, 73, 11,
- 58,  0,233,  1,159,  1,  4,  0,  7,  0,  5,  0,  7,  0,  6,  0,  7,  0,  9,  2,  7,  0, 74, 11,160,  1,  6,  0,160,  1,  0,  0,
-160,  1,  1,  0,159,  1, 67,  9,  4,  0,251,  0,  2,  0, 75, 11,  2,  0, 17,  0,161,  1,  5,  0,161,  1,  0,  0,161,  1,  1,  0,
- 12,  0, 76, 11,  4,  0, 77, 11,  4,  0, 17,  0,162,  1,  9,  0,162,  1,  0,  0,162,  1,  1,  0, 12,  0,119,  0,161,  1, 78, 11,
-  4,  0, 17,  0,  2,  0, 75, 11,  2,  0, 79, 11,  7,  0, 89,  0,  0,  0, 80, 11,159,  0,  6,  0, 19,  0, 29,  0, 12,  0, 46,  5,
-  4,  0, 17,  0,  2,  0, 81, 11,  2,  0, 82, 11,  9,  0, 83, 11,163,  1,  6,  0, 12,  0, 84, 11,  4,  0, 85, 11,  4,  0, 86, 11,
-  4,  0, 17,  0,  4,  0, 35,  0,211,  0, 87, 11,164,  1, 17,  0, 19,  0, 29,  0,165,  1, 88, 11,165,  1, 89, 11, 12,  0, 90, 11,
-  4,  0, 91, 11,  2,  0, 92, 11,  2,  0, 93, 11, 12,  0, 94, 11, 12,  0, 95, 11,163,  1, 96, 11, 12,  0, 97, 11, 12,  0, 98, 11,
- 12,  0, 99, 11, 12,  0,100, 11,166,  1,101, 11, 12,  0,102, 11,211,  0,103, 11,165,  1, 32,  0,165,  1,  0,  0,165,  1,  1,  0,
-  9,  0,104, 11,  4,  0,254,  7,  2,  0,105, 11,  2,  0, 35,  0,  2,  1,106, 11,  2,  1,107, 11,  0,  0,108, 11,  2,  0,109, 11,
-  2,  0,110, 11,  2,  0, 20,  8,  2,  0, 21,  8,  2,  0,111, 11,  2,  0,112, 11,  2,  0,202,  3,  2,  0,226,  6,  2,  0,113, 11,
-  2,  0,114, 11,  2,  0,115, 11,  2,  0, 67,  0,167,  1,116, 11,168,  1,117, 11,169,  1,118, 11,  4,  0,119, 11,  4,  0,120, 11,
-  9,  0,121, 11, 12,  0, 95, 11, 12,  0, 40,  8, 12,  0,122, 11, 12,  0,123, 11, 12,  0,124, 11,170,  1, 17,  0,170,  1,  0,  0,
-170,  1,  1,  0,  0,  0,125, 11, 18,  0, 28,  0,  2,  0,126, 11,  2,  0, 15,  0,  2,  0, 13,  0,  2,  0,127, 11,  2,  0,128, 11,
-  2,  0,129, 11,  2,  0,130, 11,  2,  0,131, 11,  2,  0, 17,  0,  2,  0,132, 11,  2,  0, 29,  0,  2,  0, 35,  0,171,  1,133, 11,
-172,  1, 10,  0,172,  1,  0,  0,172,  1,  1,  0, 12,  0,134, 11,  0,  0,125, 11,  2,  0,135, 11,  2,  0,136, 11,  2,  0, 17,  0,
-  2,  0,137, 11,  4,  0,138, 11,  9,  0,139, 11,166,  1,  7,  0,166,  1,  0,  0,166,  1,  1,  0,  0,  0,125, 11,  0,  0,140, 11,
- 12,  0,199,  7,  4,  0,141, 11,  4,  0, 17,  0,223,  0, 14,  0,223,  0,  0,  0,223,  0,  1,  0,  0,  0,125, 11, 18,  0, 28,  0,
-173,  1, 14,  8,  9,  0,142, 11,  9,  0,143, 11,171,  1,133, 11,163,  1,144, 11, 12,  0,145, 11,223,  0,146, 11,  7,  1,133,  6,
-  2,  0, 17,  0,  2,  0,196,  4,174,  1, 12,  0,174,  1,  0,  0,174,  1,  1,  0,  9,  0,  2,  0,  9,  0,147, 11,  0,  0,  5,  4,
-  2,  0, 15,  0,  2,  0, 17,  0,  7,  0,148, 11,  7,  0,121,  0,  7,  0, 63,  4,  7,  0,229,  8,  7,  0,205,  9,175,  1,  5,  0,
-  7,  0,149, 11,  4,  0,150, 11,  4,  0,151, 11,  4,  0, 73,  1,  4,  0, 17,  0,176,  1,  6,  0,  7,  0,152, 11,  7,  0,153, 11,
-  7,  0,154, 11,  7,  0,155, 11,  4,  0, 15,  0,  4,  0, 17,  0,177,  1,  5,  0,  7,  0,  1,  9,  7,  0,  2,  9,  7,  0,222,  2,
-  2,  0, 34,  2,  2,  0, 35,  2,178,  1,  5,  0,177,  1,  2,  0,  4,  0, 51,  0,  7,  0,156, 11,  7,  0,  1,  9,  7,  0,  2,  9,
-179,  1,  4,  0,  2,  0,157, 11,  2,  0,158, 11,  2,  0,159, 11,  2,  0,160, 11,180,  1,  2,  0, 34,  0,188,  6, 18,  0, 33,  9,
-181,  1,  3,  0, 16,  0,161, 11,  4,  0, 17,  0,  4,  0, 35,  0,182,  1,  6,  0,  7,  0,104,  0,  7,  0,224,  2,  7,  0,162, 11,
-  7,  0, 35,  0,  2,  0,244,  0,  2,  0,163, 11,183,  1,  5,  0,  7,  0,164, 11,  7,  0,120,  0,  7,  0, 68,  9,  7,  0, 69,  9,
-  4,  0, 17,  0,184,  1,  6,  0, 19,  0,194,  6,  0,  0,165, 11,  0,  0,166, 11,  2,  0,167, 11,  2,  0, 17,  0,  4,  0,168, 11,
-185,  1,  7,  0,185,  1,  0,  0,185,  1,  1,  0,  0,  0,  5,  4,184,  1,169, 11,  2,  0,170, 11,  2,  0, 15,  0,  7,  0, 58,  0,
-186,  1,  7,  0, 12,  0,171, 11,  0,  0,172, 11,  9,  0,173, 11,  7,  0, 58,  0,  7,  0,148, 11,  4,  0, 15,  0,  4,  0, 17,  0,
-187,  1,  3,  0,  7,  0,174, 11,  4,  0, 17,  0,  4,  0, 35,  0,188,  1, 15,  0,188,  1,  0,  0,188,  1,  1,  0, 79,  1,138,  9,
-186,  1, 59,  0, 12,  0,119,  3, 27,  0, 47,  0,187,  1,175, 11,  4,  0, 51,  0,  7,  0, 58,  0,  2,  0, 17,  0,  2,  0, 16,  1,
-  4,  0,176, 11,  0,  0,165, 11,  4,  0,177, 11,  7,  0,178, 11,189,  1,  2,  0,  0,  0,179, 11,  0,  0,180, 11,190,  1,  4,  0,
-190,  1,  0,  0,190,  1,  1,  0,157,  0, 54,  3, 12,  0,181, 11,191,  1, 24,  0,191,  1,  0,  0,191,  1,  1,  0, 12,  0,182, 11,
-157,  0,227,  8,190,  1,183, 11, 12,  0,184, 11, 12,  0,119,  3,  0,  0,  5,  4,  7,  0,148, 11,  7,  0,185, 11,  7,  0, 85,  0,
-  7,  0, 86,  0,  7,  0,200,  9,  7,  0,201,  9,  7,  0,237,  2,  7,  0,204,  9,  7,  0,229,  8,  7,  0,205,  9,  2,  0,186, 11,
-  2,  0,187, 11,  2,  0, 87,  0,  2,  0, 15,  0,  4,  0, 17,  0,  4,  0, 67,  0,192,  1,  6,  0,192,  1,  0,  0,192,  1,  1,  0,
- 12,  0,182, 11,  4,  0, 17,  0,  4,  0,253,  1,  0,  0,  5,  4,193,  1, 11,  0,193,  1,  0,  0,193,  1,  1,  0, 19,  0,194,  6,
-  0,  0,188, 11,  4,  0,168, 11,  2,  0,189, 11,  2,  0, 35,  0,  0,  0,165, 11,  4,  0,176, 11,  2,  0, 17,  0,  2,  0,190, 11,
-194,  1,  8,  0,194,  1,  0,  0,194,  1,  1,  0, 12,  0,191, 11,  0,  0,  5,  4,  0,  0,192, 11,  2,  0, 17,  0,  2,  0,190, 11,
-  4,  0,193, 11,195,  1,  5,  0,195,  1,  0,  0,195,  1,  1,  0,  0,  0,165, 11,  4,  0,176, 11,  7,  0,212,  2, 31,  0, 12,  0,
-157,  0,110,  3,157,  0,194, 11,190,  1,183, 11, 12,  0,195, 11,191,  1,196, 11, 12,  0,197, 11, 12,  0,198, 11,  4,  0, 17,  0,
-  4,  0,245,  0,  2,  0,199, 11,  2,  0,200, 11,  7,  0,201, 11,196,  1,  2,  0, 19,  0, 29,  0, 31,  0, 72,  0,197,  1,  5,  0,
-197,  1,  0,  0,197,  1,  1,  0,  4,  0, 15,  0,  4,  0, 17,  0,  0,  0, 18,  0,198,  1,  6,  0,197,  1,202, 11, 24,  0, 42,  0,
-  4,  0,203, 11,  7,  0,204, 11,  4,  0,205, 11,  4,  0,125,  9,199,  1,  3,  0,197,  1,202, 11,  4,  0,203, 11,  7,  0,206, 11,
-200,  1,  8,  0,197,  1,202, 11, 24,  0, 42,  0,  7,  0, 68,  1,  7,  0,207, 11,  7,  0, 20,  3,  7,  0, 27,  9,  4,  0,203, 11,
-  4,  0,208, 11,201,  1,  5,  0,197,  1,202, 11,  7,  0,209, 11,  7,  0,103,  8,  7,  0,243,  2,  7,  0, 54,  0,202,  1,  3,  0,
-197,  1,202, 11,  7,  0, 27,  9,  7,  0,210, 11,146,  1,  4,  0,  7,  0,211, 11,  7,  0,228, 10,  2,  0,212, 11,  2,  0, 73,  1,
-203,  1, 14,  0,203,  1,  0,  0,203,  1,  1,  0, 12,  0,213, 11, 12,  0,214, 11, 12,  0,215, 11,  0,  0, 18,  0,  4,  0, 29,  0,
-  4,  0, 17,  0,  4,  0,216, 11,  7,  0,217, 11,  4,  0,205, 11,  4,  0,125,  9,  7,  0, 15,  4,  7,  0,245,  2,154,  1, 23,  0,
-  4,  0,203, 11,  4,  0,218, 11,  7,  0,219, 11,  7,  0,241,  2,  7,  0,220, 11,  7,  0,244,  8,  7,  0,211, 11,  7,  0,221, 11,
-  7,  0,224,  2,  7,  0, 96, 10,  7,  0,146,  4,  7,  0,222, 11,  7,  0,223, 11,  7,  0,224, 11,  7,  0,225, 11,  7,  0,226, 11,
-  7,  0,227, 11,  7,  0,228, 11,  7,  0,229, 11,  7,  0,230, 11,  7,  0,231, 11,  7,  0,232, 11, 12,  0,233, 11,114,  0, 40,  0,
-113,  0,234, 11,204,  1,178, 10, 58,  0,235, 11, 58,  0,  5, 11, 58,  0,236, 11,205,  1,237, 11, 40,  0,161,  0, 40,  0,238, 11,
- 40,  0,239, 11,  7,  0,240, 11,  7,  0,241, 11,  7,  0,242, 11,  7,  0,243, 11,  7,  0,244, 11,  7,  0,253,  7,  7,  0,245, 11,
-  7,  0,162,  1,  7,  0,246, 11,  4,  0,247, 11,  4,  0,248, 11,  4,  0,249, 11,  4,  0, 88,  0,  4,  0, 35,  0,  4,  0,250, 11,
-  2,  0,251, 11,  2,  0,252, 11,  4,  0,253, 11,  7,  0,224,  2,  4,  0,254, 11,  7,  0,255, 11,  4,  0,  0, 12,  4,  0,  1, 12,
-  4,  0,  2, 12,130,  0,  3, 12, 12,  0,  4, 12,168,  0, 85,  4,  4,  0,  5, 12,  7,  0,  6, 12,  7,  0,  7, 12,  4,  0, 67,  0,
-115,  0, 12,  0,113,  0,234, 11,141,  0, 40,  3,  7,  0,129,  1,  7,  0,253,  7,  7,  0,  8, 12,  7,  0,  9, 12,  7,  0, 10, 12,
-  2,  0, 11, 12,  2,  0, 12, 12,  2,  0, 13, 12,  2,  0, 15,  0,  4,  0, 88,  0,116,  0, 13,  0,113,  0,234, 11,132,  0, 17,  3,
-134,  0, 19,  3,  7,  0, 67,  9,  7,  0, 14, 12,  7,  0, 15, 12,  7,  0, 70,  1,  7,  0, 16, 12,  4,  0,160,  9,  4,  0, 13,  3,
-  2,  0, 15,  0,  2,  0, 35,  0,  4,  0, 67,  0, 69, 78, 68, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+105,115,111,116,114,111,112,105, 99, 95,102,105,108,116,101,114,  0,117,115,101, 95, 49, 54, 98,105,116, 95,116,101,120,116,117,
+114,101,115,  0,112, 97,100, 56,  0,110,100,111,102, 95,115,101,110,115,105,116,105,118,105,116,121,  0,110,100,111,102, 95,102,
+108, 97,103,  0,103,108, 97,108,112,104, 97, 99,108,105,112,  0,116,101,120,116, 95,114,101,110,100,101,114,  0,112, 97,100, 57,
+  0, 99,111, 98, 97, 95,119,101,105,103,104,116,  0,115, 99,117,108,112,116, 95,112, 97,105,110,116, 95,111,118,101,114,108, 97,
+121, 95, 99,111,108, 91, 51, 93,  0,116,119,101, 97,107, 95,116,104,114,101,115,104,111,108,100,  0, 97,117,116,104,111,114, 91,
+ 56, 48, 93,  0, 99,111,109,112,117,116,101, 95,100,101,118,105, 99,101, 95,116,121,112,101,  0, 99,111,109,112,117,116,101, 95,
+100,101,118,105, 99,101, 95,105,100,  0,102, 99,117, 95,105,110, 97, 99,116,105,118,101, 95, 97,108,112,104, 97,  0,118,101,114,
+116, 98, 97,115,101,  0,101,100,103,101, 98, 97,115,101,  0, 97,114,101, 97, 98, 97,115,101,  0, 42,110,101,119,115, 99,101,110,
+101,  0,114,101,100,114, 97,119,115, 95,102,108, 97,103,  0,102,117,108,108,  0,116,101,109,112,  0,119,105,110,105,100,  0,100,
+111, 95,100,114, 97,119,  0,100,111, 95,114,101,102,114,101,115,104,  0,100,111, 95,100,114, 97,119, 95,103,101,115,116,117,114,
+101,  0,100,111, 95,100,114, 97,119, 95,112, 97,105,110,116, 99,117,114,115,111,114,  0,100,111, 95,100,114, 97,119, 95,100,114,
+ 97,103,  0,115,119, 97,112,  0,109, 97,105,110,119,105,110,  0,115,117, 98,119,105,110, 97, 99,116,105,118,101,  0, 42, 97,110,
+105,109,116,105,109,101,114,  0, 42, 99,111,110,116,101,120,116,  0,104, 97,110,100,108,101,114, 91, 56, 93,  0, 42,110,101,119,
+118,  0,118,101, 99,  0, 42,118, 49,  0, 42,118, 50,  0, 42,116,121,112,101,  0,112, 97,110,101,108,110, 97,109,101, 91, 54, 52,
+ 93,  0,116, 97, 98,110, 97,109,101, 91, 54, 52, 93,  0,100,114, 97,119,110, 97,109,101, 91, 54, 52, 93,  0,111,102,115,120,  0,
+111,102,115,121,  0,115,105,122,101,120,  0,115,105,122,101,121,  0,108, 97, 98,101,108,111,102,115,  0, 99,111,110,116,114,111,
+108,  0,115,110, 97,112,  0,115,111,114,116,111,114,100,101,114,  0, 42,112, 97,110,101,108,116, 97, 98,  0, 42, 97, 99,116,105,
+118,101,100, 97,116, 97,  0,108,105,115,116, 95,115, 99,114,111,108,108,  0,108,105,115,116, 95,115,105,122,101,  0,108,105,115,
+116, 95,108, 97,115,116, 95,108,101,110,  0,108,105,115,116, 95,103,114,105,112, 95,115,105,122,101,  0,108,105,115,116, 95,115,
+101, 97,114, 99,104, 91, 54, 52, 93,  0, 42,118, 51,  0, 42,118, 52,  0, 42,102,117,108,108,  0, 98,117,116,115,112, 97, 99,101,
+116,121,112,101,  0,104,101, 97,100,101,114,116,121,112,101,  0,115,112, 97, 99,101,100, 97,116, 97,  0,104, 97,110,100,108,101,
+114,115,  0, 97, 99,116,105,111,110,122,111,110,101,115,  0,119,105,110,114, 99,116,  0,100,114, 97,119,114, 99,116,  0,115,119,
+105,110,105,100,  0,114,101,103,105,111,110,116,121,112,101,  0, 97,108,105,103,110,109,101,110,116,  0,100,111, 95,100,114, 97,
+119, 95,111,118,101,114,108, 97,121,  0,117,105, 98,108,111, 99,107,115,  0,112, 97,110,101,108,115,  0, 42,104,101, 97,100,101,
+114,115,116,114,  0, 42,114,101,103,105,111,110,100, 97,116, 97,  0,115,117, 98,118,115,116,114, 91, 52, 93,  0,115,117, 98,118,
+101,114,115,105,111,110,  0,112, 97,100,115,  0,109,105,110,118,101,114,115,105,111,110,  0,109,105,110,115,117, 98,118,101,114,
+115,105,111,110,  0,119,105,110,112,111,115,  0, 42, 99,117,114,115, 99,114,101,101,110,  0, 42, 99,117,114,115, 99,101,110,101,
+  0,102,105,108,101,102,108, 97,103,115,  0,103,108,111, 98, 97,108,102,  0,114,101,118,105,115,105,111,110,  0,110, 97,109,101,
+ 91, 50, 53, 54, 93,  0,111,114,105,103, 95,119,105,100,116,104,  0,111,114,105,103, 95,104,101,105,103,104,116,  0, 98,111,116,
+116,111,109,  0,114,105,103,104,116,  0,120,111,102,115,  0,121,111,102,115,  0,108,105,102,116, 91, 51, 93,  0,103, 97,109,109,
+ 97, 91, 51, 93,  0,103, 97,105,110, 91, 51, 93,  0,100,105,114, 91, 55, 54, 56, 93,  0,116, 99,  0, 98,117,105,108,100, 95,115,
+105,122,101, 95,102,108, 97,103,115,  0, 98,117,105,108,100, 95,116, 99, 95,102,108, 97,103,115,  0,100,111,110,101,  0,115,116,
+ 97,114,116,115,116,105,108,108,  0,101,110,100,115,116,105,108,108,  0, 42,115,116,114,105,112,100, 97,116, 97,  0, 42, 99,114,
+111,112,  0, 42,116,114, 97,110,115,102,111,114,109,  0, 42, 99,111,108,111,114, 95, 98, 97,108, 97,110, 99,101,  0, 42,105,110,
+115,116, 97,110, 99,101, 95,112,114,105,118, 97,116,101, 95,100, 97,116, 97,  0, 42, 42, 99,117,114,114,101,110,116, 95,112,114,
+105,118, 97,116,101, 95,100, 97,116, 97,  0, 42,116,109,112,  0,115,116, 97,114,116,111,102,115,  0,101,110,100,111,102,115,  0,
+109, 97, 99,104,105,110,101,  0,115,116, 97,114,116,100,105,115,112,  0,101,110,100,100,105,115,112,  0,115, 97,116,  0,109,117,
+108,  0,104, 97,110,100,115,105,122,101,  0, 97,110,105,109, 95,112,114,101,115,101,101,107,  0,115,116,114,101, 97,109,105,110,
+100,101,120,  0,109,117,108,116,105, 99, 97,109, 95,115,111,117,114, 99,101,  0, 99,108,105,112, 95,102,108, 97,103,  0, 42,115,
+116,114,105,112,  0, 42,115, 99,101,110,101, 95, 99, 97,109,101,114, 97,  0,101,102,102,101, 99,116, 95,102, 97,100,101,114,  0,
+115,112,101,101,100, 95,102, 97,100,101,114,  0, 42,115,101,113, 49,  0, 42,115,101,113, 50,  0, 42,115,101,113, 51,  0,115,101,
+113, 98, 97,115,101,  0, 42,115,111,117,110,100,  0, 42,115, 99,101,110,101, 95,115,111,117,110,100,  0,112,105,116, 99,104,  0,
+112, 97,110,  0,115,116,114,111, 98,101,  0, 42,101,102,102,101, 99,116,100, 97,116, 97,  0, 97,110,105,109, 95,115,116, 97,114,
+116,111,102,115,  0, 97,110,105,109, 95,101,110,100,111,102,115,  0, 98,108,101,110,100, 95,109,111,100,101,  0, 98,108,101,110,
+100, 95,111,112, 97, 99,105,116,121,  0, 42,111,108,100, 98, 97,115,101,112,  0, 42,112, 97,114,115,101,113,  0, 42,115,101,113,
+ 98, 97,115,101,112,  0,109,101,116, 97,115,116, 97, 99,107,  0, 42, 97, 99,116, 95,115,101,113,  0, 97, 99,116, 95,105,109, 97,
+103,101,100,105,114, 91, 49, 48, 50, 52, 93,  0, 97, 99,116, 95,115,111,117,110,100,100,105,114, 91, 49, 48, 50, 52, 93,  0,111,
+118,101,114, 95,111,102,115,  0,111,118,101,114, 95, 99,102,114, 97,  0,111,118,101,114, 95,102,108, 97,103,  0,111,118,101,114,
+ 95, 98,111,114,100,101,114,  0,101,100,103,101, 87,105,100,116,104,  0,102,111,114,119, 97,114,100,  0,119,105,112,101,116,121,
+112,101,  0,102, 77,105,110,105,  0,102, 67,108, 97,109,112,  0,102, 66,111,111,115,116,  0,100, 68,105,115,116,  0,100, 81,117,
+ 97,108,105,116,121,  0, 98, 78,111, 67,111,109,112,  0, 83, 99, 97,108,101,120, 73,110,105,  0, 83, 99, 97,108,101,121, 73,110,
+105,  0,120, 73,110,105,  0,121, 73,110,105,  0,114,111,116, 73,110,105,  0,105,110,116,101,114,112,111,108, 97,116,105,111,110,
+  0,117,110,105,102,111,114,109, 95,115, 99, 97,108,101,  0, 42,102,114, 97,109,101, 77, 97,112,  0,103,108,111, 98, 97,108, 83,
+112,101,101,100,  0,108, 97,115,116, 86, 97,108,105,100, 70,114, 97,109,101,  0, 98,117,116,116,121,112,101,  0,117,115,101,114,
+106,105,116,  0,115,116, 97,  0,116,111,116,112, 97,114,116,  0,110,111,114,109,102, 97, 99,  0,111, 98,102, 97, 99,  0,114, 97,
+110,100,102, 97, 99,  0,116,101,120,102, 97, 99,  0,114, 97,110,100,108,105,102,101,  0,102,111,114, 99,101, 91, 51, 93,  0,118,
+101, 99,116,115,105,122,101,  0,109, 97,120,108,101,110,  0,100,101,102,118,101, 99, 91, 51, 93,  0,109,117,108,116, 91, 52, 93,
+  0,108,105,102,101, 91, 52, 93,  0, 99,104,105,108,100, 91, 52, 93,  0,109, 97,116, 91, 52, 93,  0,116,101,120,109, 97,112,  0,
+ 99,117,114,109,117,108,116,  0,115,116, 97,116,105, 99,115,116,101,112,  0,111,109, 97,116,  0,116,105,109,101,116,101,120,  0,
+115,112,101,101,100,116,101,120,  0,102,108, 97,103, 50,110,101,103,  0,118,101,114,116,103,114,111,117,112, 95,118,  0,118,103,
+114,111,117,112,110, 97,109,101, 91, 54, 52, 93,  0,118,103,114,111,117,112,110, 97,109,101, 95,118, 91, 54, 52, 93,  0, 42,107,
+101,121,115,  0,109,105,110,102, 97, 99,  0,110,114,  0,117,115,101,100,  0,117,115,101,100,101,108,101,109,  0, 42,112,111,105,
+110,  0,114,101,115,101,116,100,105,115,116,  0,108, 97,115,116,118, 97,108,  0, 42,109, 97,  0,107,101,121,  0,113,117, 97,108,
+  0,113,117, 97,108, 50,  0,116, 97,114,103,101,116, 78, 97,109,101, 91, 54, 52, 93,  0,116,111,103,103,108,101, 78, 97,109,101,
+ 91, 54, 52, 93,  0,118, 97,108,117,101, 91, 54, 52, 93,  0,109, 97,120,118, 97,108,117,101, 91, 54, 52, 93,  0,100,101,108, 97,
+121,  0,100,117,114, 97,116,105,111,110,  0,109, 97,116,101,114,105, 97,108, 78, 97,109,101, 91, 54, 52, 93,  0,100, 97,109,112,
+116,105,109,101,114,  0,112,114,111,112,110, 97,109,101, 91, 54, 52, 93,  0,109, 97,116,110, 97,109,101, 91, 54, 52, 93,  0, 97,
+120,105,115,102,108, 97,103,  0,112,111,115,101, 99,104, 97,110,110,101,108, 91, 54, 52, 93,  0, 99,111,110,115,116,114, 97,105,
+110,116, 91, 54, 52, 93,  0, 42,102,114,111,109, 79, 98,106,101, 99,116,  0,115,117, 98,106,101, 99,116, 91, 54, 52, 93,  0, 98,
+111,100,121, 91, 54, 52, 93,  0,111,116,121,112,101,  0,112,117,108,115,101,  0,102,114,101,113,  0,116,111,116,108,105,110,107,
+115,  0, 42, 42,108,105,110,107,115,  0,116, 97,112,  0,106,111,121,105,110,100,101,120,  0, 97,120,105,115, 95,115,105,110,103,
+108,101,  0, 97,120,105,115,102,  0, 98,117,116,116,111,110,  0,104, 97,116,  0,104, 97,116,102,  0,112,114,101, 99,105,115,105,
+111,110,  0,115,116,114, 91, 49, 50, 56, 93,  0, 42,109,121,110,101,119,  0,105,110,112,117,116,115,  0,116,111,116,115,108,105,
+110,107,115,  0, 42, 42,115,108,105,110,107,115,  0,118, 97,108,111,  0,115,116, 97,116,101, 95,109, 97,115,107,  0, 42, 97, 99,
+116,  0,102,114, 97,109,101, 80,114,111,112, 91, 54, 52, 93,  0, 98,108,101,110,100,105,110,  0,112,114,105,111,114,105,116,121,
+  0,101,110,100, 95,114,101,115,101,116,  0,115,116,114,105,100,101, 97,120,105,115,  0,115,116,114,105,100,101,108,101,110,103,
+116,104,  0,108, 97,121,101,114, 95,119,101,105,103,104,116,  0,109,105,110, 95,103, 97,105,110,  0,109, 97,120, 95,103, 97,105,
+110,  0,114,101,102,101,114,101,110, 99,101, 95,100,105,115,116, 97,110, 99,101,  0,109, 97,120, 95,100,105,115,116, 97,110, 99,
+101,  0,114,111,108,108,111,102,102, 95,102, 97, 99,116,111,114,  0, 99,111,110,101, 95,105,110,110,101,114, 95, 97,110,103,108,
+101,  0, 99,111,110,101, 95,111,117,116,101,114, 95, 97,110,103,108,101,  0, 99,111,110,101, 95,111,117,116,101,114, 95,103, 97,
+105,110,  0,115,110,100,110,114,  0,115,111,117,110,100, 51, 68,  0,112, 97,100, 54, 91, 49, 93,  0, 42,109,101,  0,108,105,110,
+ 86,101,108,111, 99,105,116,121, 91, 51, 93,  0, 97,110,103, 86,101,108,111, 99,105,116,121, 91, 51, 93,  0,108,111, 99, 97,108,
+102,108, 97,103,  0,100,121,110, 95,111,112,101,114, 97,116,105,111,110,  0,102,111,114, 99,101,108,111, 99, 91, 51, 93,  0,102,
+111,114, 99,101,114,111,116, 91, 51, 93,  0,112, 97,100, 49, 91, 51, 93,  0,108,105,110,101, 97,114,118,101,108,111, 99,105,116,
+121, 91, 51, 93,  0, 97,110,103,117,108, 97,114,118,101,108,111, 99,105,116,121, 91, 51, 93,  0, 42,114,101,102,101,114,101,110,
+ 99,101,  0,109,105,110,  0,109, 97,120,  0,114,111,116,100, 97,109,112,  0,109,105,110,108,111, 99, 91, 51, 93,  0,109, 97,120,
+108,111, 99, 91, 51, 93,  0,109,105,110,114,111,116, 91, 51, 93,  0,109, 97,120,114,111,116, 91, 51, 93,  0,109, 97,116,112,114,
+111,112, 91, 54, 52, 93,  0, 98,117,116,115,116, 97,  0, 98,117,116,101,110,100,  0,100,105,115,116,114,105, 98,117,116,105,111,
+110,  0,105,110,116, 95, 97,114,103, 95, 49,  0,105,110,116, 95, 97,114,103, 95, 50,  0,102,108,111, 97,116, 95, 97,114,103, 95,
+ 49,  0,102,108,111, 97,116, 95, 97,114,103, 95, 50,  0,116,111, 80,114,111,112, 78, 97,109,101, 91, 54, 52, 93,  0, 42,116,111,
+ 79, 98,106,101, 99,116,  0, 98,111,100,121, 84,121,112,101,  0,102,105,108,101,110, 97,109,101, 91, 54, 52, 93,  0,108,111, 97,
+100, 97,110,105,110, 97,109,101, 91, 54, 52, 93,  0,105,110,116, 95, 97,114,103,  0,102,108,111, 97,116, 95, 97,114,103,  0,105,
+110,102,108,117,101,110, 99,101,  0, 42,115,117, 98,116, 97,114,103,101,116,  0,102, 97, 99,105,110,103, 97,120,105,115,  0,118,
+101,108,111, 99,105,116,121,  0, 97, 99, 99,101,108,101,114, 97,116,105,111,110,  0,116,117,114,110,115,112,101,101,100,  0,117,
+112,100, 97,116,101, 84,105,109,101,  0, 42,110, 97,118,109,101,115,104,  0,103,111,  0, 42,110,101,119,112, 97, 99,107,101,100,
+102,105,108,101,  0, 97,116,116,101,110,117, 97,116,105,111,110,  0,100,105,115,116, 97,110, 99,101,  0, 42, 99, 97, 99,104,101,
+  0, 42,119, 97,118,101,102,111,114,109,  0, 42,112,108, 97,121, 98, 97, 99,107, 95,104, 97,110,100,108,101,  0, 42,108, 97,109,
+112,114,101,110,  0,103,111, 98,106,101, 99,116,  0,100,117,112,108,105, 95,111,102,115, 91, 51, 93,  0, 42,112,114,111,112,  0,
+ 99,104,105,108,100, 98, 97,115,101,  0,114,111,108,108,  0,104,101, 97,100, 91, 51, 93,  0,116, 97,105,108, 91, 51, 93,  0, 98,
+111,110,101, 95,109, 97,116, 91, 51, 93, 91, 51, 93,  0, 97,114,109, 95,104,101, 97,100, 91, 51, 93,  0, 97,114,109, 95,116, 97,
+105,108, 91, 51, 93,  0, 97,114,109, 95,109, 97,116, 91, 52, 93, 91, 52, 93,  0, 97,114,109, 95,114,111,108,108,  0,120,119,105,
+100,116,104,  0,122,119,105,100,116,104,  0,101, 97,115,101, 49,  0,101, 97,115,101, 50,  0,114, 97,100, 95,104,101, 97,100,  0,
+114, 97,100, 95,116, 97,105,108,  0,112, 97,100, 91, 49, 93,  0, 98,111,110,101, 98, 97,115,101,  0, 99,104, 97,105,110, 98, 97,
+115,101,  0, 42,101,100, 98,111,  0, 42, 97, 99,116, 95, 98,111,110,101,  0, 42, 97, 99,116, 95,101,100, 98,111,110,101,  0, 42,
+115,107,101,116, 99,104,  0,103,101,118,101,114,116,100,101,102,111,114,109,101,114,  0,108, 97,121,101,114, 95,117,115,101,100,
+  0,108, 97,121,101,114, 95,112,114,111,116,101, 99,116,101,100,  0,103,104,111,115,116,101,112,  0,103,104,111,115,116,115,105,
+122,101,  0,103,104,111,115,116,116,121,112,101,  0,112, 97,116,104,115,105,122,101,  0,103,104,111,115,116,115,102,  0,103,104,
+111,115,116,101,102,  0,112, 97,116,104,115,102,  0,112, 97,116,104,101,102,  0,112, 97,116,104, 98, 99,  0,112, 97,116,104, 97,
+ 99,  0, 42,112,111,105,110,116,115,  0,115,116, 97,114,116, 95,102,114, 97,109,101,  0,101,110,100, 95,102,114, 97,109,101,  0,
+103,104,111,115,116, 95,115,102,  0,103,104,111,115,116, 95,101,102,  0,103,104,111,115,116, 95, 98, 99,  0,103,104,111,115,116,
+ 95, 97, 99,  0,103,104,111,115,116, 95,116,121,112,101,  0,103,104,111,115,116, 95,115,116,101,112,  0,103,104,111,115,116, 95,
+102,108, 97,103,  0,112, 97,116,104, 95,116,121,112,101,  0,112, 97,116,104, 95,115,116,101,112,  0,112, 97,116,104, 95,118,105,
+101,119,102,108, 97,103,  0,112, 97,116,104, 95, 98, 97,107,101,102,108, 97,103,  0,112, 97,116,104, 95,115,102,  0,112, 97,116,
+104, 95,101,102,  0,112, 97,116,104, 95, 98, 99,  0,112, 97,116,104, 95, 97, 99,  0,105,107,102,108, 97,103,  0, 97,103,114,112,
+ 95,105,110,100,101,120,  0, 99,111,110,115,116,102,108, 97,103,  0,115,101,108,101, 99,116,102,108, 97,103,  0,112, 97,100, 48,
+ 91, 54, 93,  0, 42, 98,111,110,101,  0, 42, 99,104,105,108,100,  0,105,107,116,114,101,101,  0,115,105,107,116,114,101,101,  0,
+ 42, 99,117,115,116,111,109,  0, 42, 99,117,115,116,111,109, 95,116,120,  0,101,117,108, 91, 51, 93,  0, 99,104, 97,110, 95,109,
+ 97,116, 91, 52, 93, 91, 52, 93,  0,112,111,115,101, 95,109, 97,116, 91, 52, 93, 91, 52, 93,  0,112,111,115,101, 95,104,101, 97,
+100, 91, 51, 93,  0,112,111,115,101, 95,116, 97,105,108, 91, 51, 93,  0,108,105,109,105,116,109,105,110, 91, 51, 93,  0,108,105,
+109,105,116,109, 97,120, 91, 51, 93,  0,115,116,105,102,102,110,101,115,115, 91, 51, 93,  0,105,107,115,116,114,101,116, 99,104,
+  0,105,107,114,111,116,119,101,105,103,104,116,  0,105,107,108,105,110,119,101,105,103,104,116,  0, 42,116,101,109,112,  0, 99,
+104, 97,110, 98, 97,115,101,  0, 42, 99,104, 97,110,104, 97,115,104,  0,112,114,111,120,121, 95,108, 97,121,101,114,  0,115,116,
+114,105,100,101, 95,111,102,102,115,101,116, 91, 51, 93,  0, 99,121, 99,108,105, 99, 95,111,102,102,115,101,116, 91, 51, 93,  0,
+ 97,103,114,111,117,112,115,  0, 97, 99,116,105,118,101, 95,103,114,111,117,112,  0,105,107,115,111,108,118,101,114,  0, 42,105,
+107,100, 97,116, 97,  0, 42,105,107,112, 97,114, 97,109,  0,112,114,111,120,121, 95, 97, 99,116, 95, 98,111,110,101, 91, 54, 52,
+ 93,  0,110,117,109,105,116,101,114,  0,110,117,109,115,116,101,112,  0,109,105,110,115,116,101,112,  0,109, 97,120,115,116,101,
+112,  0,115,111,108,118,101,114,  0,102,101,101,100, 98, 97, 99,107,  0,109, 97,120,118,101,108,  0,100, 97,109,112,109, 97,120,
+  0,100, 97,109,112,101,112,115,  0, 99,104, 97,110,110,101,108,115,  0, 99,117,115,116,111,109, 67,111,108,  0, 99,115,  0, 99,
+117,114,118,101,115,  0,103,114,111,117,112,115,  0, 97, 99,116,105,118,101, 95,109, 97,114,107,101,114,  0,105,100,114,111,111,
+116,  0, 42,115,111,117,114, 99,101,  0, 42,102,105,108,116,101,114, 95,103,114,112,  0,115,101, 97,114, 99,104,115,116,114, 91,
+ 54, 52, 93,  0,102,105,108,116,101,114,102,108, 97,103,  0,114,101,110, 97,109,101, 73,110,100,101,120,  0, 97,100,115,  0,116,
+105,109,101,115,108,105,100,101,  0, 42,103,114,112,  0,110, 97,109,101, 91, 51, 48, 93,  0,111,119,110,115,112, 97, 99,101,  0,
+116, 97,114,115,112, 97, 99,101,  0,101,110,102,111,114, 99,101,  0,104,101, 97,100,116, 97,105,108,  0,108,105,110, 95,101,114,
+114,111,114,  0,114,111,116, 95,101,114,114,111,114,  0, 42,116, 97,114,  0,109, 97,116,114,105,120, 91, 52, 93, 91, 52, 93,  0,
+115,112, 97, 99,101,  0,114,111,116, 79,114,100,101,114,  0,116, 97,114,110,117,109,  0,116, 97,114,103,101,116,115,  0,105,116,
+101,114, 97,116,105,111,110,115,  0,114,111,111,116, 98,111,110,101,  0,109, 97,120, 95,114,111,111,116, 98,111,110,101,  0, 42,
+112,111,108,101,116, 97,114,  0,112,111,108,101,115,117, 98,116, 97,114,103,101,116, 91, 54, 52, 93,  0,112,111,108,101, 97,110,
+103,108,101,  0,111,114,105,101,110,116,119,101,105,103,104,116,  0,103,114, 97, 98,116, 97,114,103,101,116, 91, 51, 93,  0,110,
+117,109,112,111,105,110,116,115,  0, 99,104, 97,105,110,108,101,110,  0,120,122, 83, 99, 97,108,101, 77,111,100,101,  0,114,101,
+115,101,114,118,101,100, 49,  0,114,101,115,101,114,118,101,100, 50,  0,109,105,110,109, 97,120,102,108, 97,103,  0,115,116,117,
+ 99,107,  0, 99, 97, 99,104,101, 91, 51, 93,  0,108,111, 99,107,102,108, 97,103,  0,102,111,108,108,111,119,102,108, 97,103,  0,
+118,111,108,109,111,100,101,  0,112,108, 97,110,101,  0,111,114,103,108,101,110,103,116,104,  0, 98,117,108,103,101,  0,112,105,
+118, 88,  0,112,105,118, 89,  0,112,105,118, 90,  0, 97,120, 88,  0, 97,120, 89,  0, 97,120, 90,  0,109,105,110, 76,105,109,105,
+116, 91, 54, 93,  0,109, 97,120, 76,105,109,105,116, 91, 54, 93,  0,101,120,116,114, 97, 70,122,  0,105,110,118,109, 97,116, 91,
+ 52, 93, 91, 52, 93,  0,102,114,111,109,  0,116,111,  0,109, 97,112, 91, 51, 93,  0,101,120,112,111,  0,102,114,111,109, 95,109,
+105,110, 91, 51, 93,  0,102,114,111,109, 95,109, 97,120, 91, 51, 93,  0,116,111, 95,109,105,110, 91, 51, 93,  0,116,111, 95,109,
+ 97,120, 91, 51, 93,  0,114,111,116, 65,120,105,115,  0,122,109,105,110,  0,122,109, 97,120,  0,112, 97,100, 91, 57, 93,  0,116,
+114, 97, 99,107, 91, 54, 52, 93,  0,111, 98,106,101, 99,116, 91, 54, 52, 93,  0, 42,100,101,112,116,104, 95,111, 98,  0, 99,104,
+ 97,110,110,101,108, 91, 51, 50, 93,  0,110,111, 95,114,111,116, 95, 97,120,105,115,  0,115,116,114,105,100,101, 95, 97,120,105,
+115,  0, 99,117,114,109,111,100,  0, 97, 99,116,115,116, 97,114,116,  0, 97, 99,116,101,110,100,  0, 97, 99,116,111,102,102,115,
+  0,115,116,114,105,100,101,108,101,110,  0, 98,108,101,110,100,111,117,116,  0,115,116,114,105,100,101, 99,104, 97,110,110,101,
+108, 91, 51, 50, 93,  0,111,102,102,115, 95, 98,111,110,101, 91, 51, 50, 93,  0,104, 97,115,105,110,112,117,116,  0,104, 97,115,
+111,117,116,112,117,116,  0,100, 97,116, 97,116,121,112,101,  0,115,111, 99,107,101,116,116,121,112,101,  0,105,115, 95, 99,111,
+112,121,  0,101,120,116,101,114,110, 97,108,  0, 42,110,101,119, 95,115,111, 99,107,  0, 42,115,116,111,114, 97,103,101,  0,108,
+105,109,105,116,  0,115,116,114,117, 99,116, 95,116,121,112,101,  0,108,111, 99,120,  0,108,111, 99,121,  0, 42,100,101,102, 97,
+117,108,116, 95,118, 97,108,117,101,  0,115,116, 97, 99,107, 95,105,110,100,101,120,  0,115,116, 97, 99,107, 95,116,121,112,101,
+  0,111,119,110, 95,105,110,100,101,120,  0,116,111, 95,105,110,100,101,120,  0, 42,103,114,111,117,112,115,111, 99,107,  0, 42,
+108,105,110,107,  0,110,115,  0, 42,114,101, 99,116,  0,120,115,105,122,101,  0,121,115,105,122,101,  0, 42,110,101,119, 95,110,
+111,100,101,  0,108, 97,115,116,121,  0,111,117,116,112,117,116,115,  0,109,105,110,105,119,105,100,116,104,  0,117,112,100, 97,
+116,101,  0,108, 97, 98,101,108, 91, 54, 52, 93,  0, 99,117,115,116,111,109, 49,  0, 99,117,115,116,111,109, 50,  0, 99,117,115,
+116,111,109, 51,  0, 99,117,115,116,111,109, 52,  0,110,101,101,100, 95,101,120,101, 99,  0,101,120,101, 99,  0, 42,116,104,114,
+101, 97,100,100, 97,116, 97,  0,116,111,116,114,  0, 98,117,116,114,  0,112,114,118,114,  0, 42, 98,108,111, 99,107,  0, 42,116,
+121,112,101,105,110,102,111,  0, 42,102,114,111,109,110,111,100,101,  0, 42,116,111,110,111,100,101,  0, 42,102,114,111,109,115,
+111, 99,107,  0, 42,116,111,115,111, 99,107,  0,110,111,100,101,115,  0,108,105,110,107,115,  0,105,110,105,116,  0, 99,117,114,
+ 95,105,110,100,101,120,  0,110,111,100,101,116,121,112,101,  0, 42,101,120,101, 99,100, 97,116, 97,  0, 40, 42,112,114,111,103,
+114,101,115,115, 41, 40, 41,  0, 40, 42,115,116, 97,116,115, 95,100,114, 97,119, 41, 40, 41,  0, 40, 42,116,101,115,116, 95, 98,
+114,101, 97,107, 41, 40, 41,  0, 42,116, 98,104,  0, 42,112,114,104,  0, 42,115,100,104,  0,118, 97,108,117,101, 91, 51, 93,  0,
+118, 97,108,117,101, 91, 52, 93,  0, 99,121, 99,108,105, 99,  0,109,111,118,105,101,  0,115, 97,109,112,108,101,115,  0,109, 97,
+120,115,112,101,101,100,  0,109,105,110,115,112,101,101,100,  0, 99,117,114,118,101,100,  0,112,101,114, 99,101,110,116,120,  0,
+112,101,114, 99,101,110,116,121,  0, 98,111,107,101,104,  0,103, 97,109,109, 97,  0,105,109, 97,103,101, 95,105,110, 95,119,105,
+100,116,104,  0,105,109, 97,103,101, 95,105,110, 95,104,101,105,103,104,116,  0, 99,101,110,116,101,114, 95,120,  0, 99,101,110,
+116,101,114, 95,121,  0,115,112,105,110,  0,119,114, 97,112,  0,115,105,103,109, 97, 95, 99,111,108,111,114,  0,115,105,103,109,
+ 97, 95,115,112, 97, 99,101,  0,104,117,101,  0, 98, 97,115,101, 95,112, 97,116,104, 91, 49, 48, 50, 52, 93,  0,102,111,114,109,
+ 97,116,  0, 97, 99,116,105,118,101, 95,105,110,112,117,116,  0,117,115,101, 95,114,101,110,100,101,114, 95,102,111,114,109, 97,
+116,  0,117,115,101, 95,110,111,100,101, 95,102,111,114,109, 97,116,  0,116, 49,  0,116, 50,  0,116, 51,  0,102,115,116,114,101,
+110,103,116,104,  0,102, 97,108,112,104, 97,  0,107,101,121, 91, 52, 93,  0, 97,108,103,111,114,105,116,104,109,  0, 99,104, 97,
+110,110,101,108,  0,120, 49,  0,120, 50,  0,121, 49,  0,121, 50,  0,102, 97, 99, 95,120, 49,  0,102, 97, 99, 95,120, 50,  0,102,
+ 97, 99, 95,121, 49,  0,102, 97, 99, 95,121, 50,  0, 99,111,108,110, 97,109,101, 91, 54, 52, 93,  0, 98,107,116,121,112,101,  0,
+112, 97,100, 95, 99, 49,  0,103, 97,109, 99,111,  0,110,111, 95,122, 98,117,102,  0,102,115,116,111,112,  0,109, 97,120, 98,108,
+117,114,  0, 98,116,104,114,101,115,104,  0,114,111,116, 97,116,105,111,110,  0,112, 97,100, 95,102, 49,  0, 42,100,105, 99,116,
+  0, 42,110,111,100,101,  0, 99,111,108,109,111,100,  0,109,105,120,  0,102, 97,100,101,  0, 97,110,103,108,101, 95,111,102,115,
+  0,109,  0, 99,  0,106,105,116,  0,112,114,111,106,  0,102,105,116,  0,115,108,111,112,101, 91, 51, 93,  0,112,111,119,101,114,
+ 91, 51, 93,  0,108,105,102,116, 95,108,103,103, 91, 51, 93,  0,103, 97,109,109, 97, 95,105,110,118, 91, 51, 93,  0,108,105,109,
+ 99,104, 97,110,  0,117,110,115,112,105,108,108,  0,108,105,109,115, 99, 97,108,101,  0,117,115,112,105,108,108,114,  0,117,115,
+112,105,108,108,103,  0,117,115,112,105,108,108, 98,  0,116,101,120, 95,109, 97,112,112,105,110,103,  0, 99,111,108,111,114, 95,
+109, 97,112,112,105,110,103,  0,115,117,110, 95,100,105,114,101, 99,116,105,111,110, 91, 51, 93,  0,116,117,114, 98,105,100,105,
+116,121,  0, 99,111,108,111,114, 95,115,112, 97, 99,101,  0,112,114,111,106,101, 99,116,105,111,110,  0,103,114, 97,100,105,101,
+110,116, 95,116,121,112,101,  0, 99,111,108,111,114,105,110,103,  0,109,117,115,103,114, 97,118,101, 95,116,121,112,101,  0,119,
+ 97,118,101, 95,116,121,112,101,  0,115,104,111,114,116,121,  0,109,105,110,116, 97, 98,108,101,  0,109, 97,120,116, 97, 98,108,
+101,  0,101,120,116, 95,105,110, 91, 50, 93,  0,101,120,116, 95,111,117,116, 91, 50, 93,  0, 42, 99,117,114,118,101,  0, 42,116,
+ 97, 98,108,101,  0, 42,112,114,101,109,117,108,116, 97, 98,108,101,  0,112,114,101,115,101,116,  0, 99,104, 97,110,103,101,100,
+ 95,116,105,109,101,115,116, 97,109,112,  0, 99,117,114,114,  0, 99,108,105,112,114,  0, 99,109, 91, 52, 93,  0, 98,108, 97, 99,
+107, 91, 51, 93,  0,119,104,105,116,101, 91, 51, 93,  0, 98,119,109,117,108, 91, 51, 93,  0,115, 97,109,112,108,101, 91, 51, 93,
+  0,120, 95,114,101,115,111,108,117,116,105,111,110,  0,100, 97,116, 97, 95,114, 91, 50, 53, 54, 93,  0,100, 97,116, 97, 95,103,
+ 91, 50, 53, 54, 93,  0,100, 97,116, 97, 95, 98, 91, 50, 53, 54, 93,  0,100, 97,116, 97, 95,108,117,109, 97, 91, 50, 53, 54, 93,
+  0,115, 97,109,112,108,101, 95,102,117,108,108,  0,115, 97,109,112,108,101, 95,108,105,110,101,115,  0, 97, 99, 99,117,114, 97,
+ 99,121,  0,119, 97,118,101,102,114,109, 95,109,111,100,101,  0,119, 97,118,101,102,114,109, 95, 97,108,112,104, 97,  0,119, 97,
+118,101,102,114,109, 95,121,102, 97, 99,  0,119, 97,118,101,102,114,109, 95,104,101,105,103,104,116,  0,118,101, 99,115, 99,111,
+112,101, 95, 97,108,112,104, 97,  0,118,101, 99,115, 99,111,112,101, 95,104,101,105,103,104,116,  0,109,105,110,109, 97,120, 91,
+ 51, 93, 91, 50, 93,  0,104,105,115,116,  0, 42,119, 97,118,101,102,111,114,109, 95, 49,  0, 42,119, 97,118,101,102,111,114,109,
+ 95, 50,  0, 42,119, 97,118,101,102,111,114,109, 95, 51,  0, 42,118,101, 99,115, 99,111,112,101,  0,119, 97,118,101,102,111,114,
+109, 95,116,111,116,  0,111,102,102,115,101,116, 91, 50, 93,  0, 99,108,111,110,101,  0,109,116,101,120,  0, 42,105, 99,111,110,
+ 95,105,109, 98,117,102,  0,105, 99,111,110, 95,102,105,108,101,112, 97,116,104, 91, 49, 48, 50, 52, 93,  0,110,111,114,109, 97,
+108, 95,119,101,105,103,104,116,  0,111, 98, 95,109,111,100,101,  0,106,105,116,116,101,114,  0,115,109,111,111,116,104, 95,115,
+116,114,111,107,101, 95,114, 97,100,105,117,115,  0,115,109,111,111,116,104, 95,115,116,114,111,107,101, 95,102, 97, 99,116,111,
+114,  0,114, 97,116,101,  0,114,103, 98, 91, 51, 93,  0,115, 99,117,108,112,116, 95,112,108, 97,110,101,  0,112,108, 97,110,101,
+ 95,111,102,102,115,101,116,  0,115, 99,117,108,112,116, 95,116,111,111,108,  0,118,101,114,116,101,120,112, 97,105,110,116, 95,
+116,111,111,108,  0,105,109, 97,103,101,112, 97,105,110,116, 95,116,111,111,108,  0,112, 97,100, 51, 91, 53, 93,  0, 97,117,116,
+111,115,109,111,111,116,104, 95,102, 97, 99,116,111,114,  0, 99,114,101, 97,115,101, 95,112,105,110, 99,104, 95,102, 97, 99,116,
+111,114,  0,112,108, 97,110,101, 95,116,114,105,109,  0,116,101,120,116,117,114,101, 95,115, 97,109,112,108,101, 95, 98,105, 97,
+115,  0,116,101,120,116,117,114,101, 95,111,118,101,114,108, 97,121, 95, 97,108,112,104, 97,  0, 97,100,100, 95, 99,111,108, 91,
+ 51, 93,  0,115,117, 98, 95, 99,111,108, 91, 51, 93,  0, 97, 99,116,105,118,101, 95,114,110,100,  0, 97, 99,116,105,118,101, 95,
+ 99,108,111,110,101,  0, 97, 99,116,105,118,101, 95,109, 97,115,107,  0, 42,108, 97,121,101,114,115,  0,116,121,112,101,109, 97,
+112, 91, 51, 52, 93,  0,116,111,116,108, 97,121,101,114,  0,109, 97,120,108, 97,121,101,114,  0,116,111,116,115,105,122,101,  0,
+ 42,112,111,111,108,  0, 42,101,120,116,101,114,110, 97,108,  0,114,111,116, 91, 52, 93,  0, 97,118,101, 91, 51, 93,  0, 42,103,
+114,111,117,110,100,  0,119, 97,110,100,101,114, 91, 51, 93,  0,114,101,115,116, 95,108,101,110,103,116,104,  0,112, 97,114,116,
+105, 99,108,101, 95,105,110,100,101,120, 91, 50, 93,  0,100,101,108,101,116,101, 95,102,108, 97,103,  0,110,117,109,  0,112, 97,
+114,101,110,116,  0,112, 97, 91, 52, 93,  0,119, 91, 52, 93,  0,102,117,118, 91, 52, 93,  0,102,111,102,102,115,101,116,  0,112,
+114,101,118, 95,115,116, 97,116,101,  0, 42,104, 97,105,114,  0, 42, 98,111,105,100,  0,100,105,101,116,105,109,101,  0,110,117,
+109, 95,100,109, 99, 97, 99,104,101,  0,104, 97,105,114, 95,105,110,100,101,120,  0, 97,108,105,118,101,  0,115,112,114,105,110,
+103, 95,107,  0,112,108, 97,115,116,105, 99,105,116,121, 95, 99,111,110,115,116, 97,110,116,  0,121,105,101,108,100, 95,114, 97,
+116,105,111,  0,112,108, 97,115,116,105, 99,105,116,121, 95, 98, 97,108, 97,110, 99,101,  0,121,105,101,108,100, 95, 98, 97,108,
+ 97,110, 99,101,  0,118,105,115, 99,111,115,105,116,121, 95,111,109,101,103, 97,  0,118,105,115, 99,111,115,105,116,121, 95, 98,
+101,116, 97,  0,115,116,105,102,102,110,101,115,115, 95,107,  0,115,116,105,102,102,110,101,115,115, 95,107,110,101, 97,114,  0,
+114,101,115,116, 95,100,101,110,115,105,116,121,  0, 98,117,111,121, 97,110, 99,121,  0,115,112,114,105,110,103, 95,102,114, 97,
+109,101,115,  0, 42, 98,111,105,100,115,  0, 42,102,108,117,105,100,  0,100,105,115,116,114,  0,112,104,121,115,116,121,112,101,
+  0, 97,118,101,109,111,100,101,  0,114,101, 97, 99,116,101,118,101,110,116,  0,100,114, 97,119,  0,100,114, 97,119, 95, 97,115,
+  0,100,114, 97,119, 95,115,105,122,101,  0, 99,104,105,108,100,116,121,112,101,  0,114,101,110, 95, 97,115,  0,115,117, 98,102,
+114, 97,109,101,115,  0,100,114, 97,119, 95, 99,111,108,  0,114,101,110, 95,115,116,101,112,  0,104, 97,105,114, 95,115,116,101,
+112,  0,107,101,121,115, 95,115,116,101,112,  0, 97,100, 97,112,116, 95, 97,110,103,108,101,  0, 97,100, 97,112,116, 95,112,105,
+120,  0,114,111,116,102,114,111,109,  0,105,110,116,101,103,114, 97,116,111,114,  0, 98, 98, 95, 97,108,105,103,110,  0, 98, 98,
+ 95,117,118, 95,115,112,108,105,116,  0, 98, 98, 95, 97,110,105,109,  0, 98, 98, 95,115,112,108,105,116, 95,111,102,102,115,101,
+116,  0, 98, 98, 95,116,105,108,116,  0, 98, 98, 95,114, 97,110,100, 95,116,105,108,116,  0, 98, 98, 95,111,102,102,115,101,116,
+ 91, 50, 93,  0, 98, 98, 95,115,105,122,101, 91, 50, 93,  0, 98, 98, 95,118,101,108, 95,104,101, 97,100,  0, 98, 98, 95,118,101,
+108, 95,116, 97,105,108,  0, 99,111,108,111,114, 95,118,101, 99, 95,109, 97,120,  0,115,105,109,112,108,105,102,121, 95,114,101,
+102,115,105,122,101,  0,115,105,109,112,108,105,102,121, 95,114, 97,116,101,  0,115,105,109,112,108,105,102,121, 95,116,114, 97,
+110,115,105,116,105,111,110,  0,115,105,109,112,108,105,102,121, 95,118,105,101,119,112,111,114,116,  0,116,105,109,101,116,119,
+101, 97,107,  0, 99,111,117,114, 97,110,116, 95,116, 97,114,103,101,116,  0,106,105,116,102, 97, 99,  0,101,102,102, 95,104, 97,
+105,114,  0,103,114,105,100, 95,114, 97,110,100,  0,112,115, 95,111,102,102,115,101,116, 91, 49, 93,  0,103,114,105,100, 95,114,
+101,115,  0,101,102,102,101, 99,116,111,114, 95, 97,109,111,117,110,116,  0,116,105,109,101, 95,102,108, 97,103,  0,116,105,109,
+101, 95,112, 97,100, 91, 51, 93,  0,112, 97,114,116,102, 97, 99,  0,116, 97,110,102, 97, 99,  0,116, 97,110,112,104, 97,115,101,
+  0,114,101, 97, 99,116,102, 97, 99,  0,111, 98, 95,118,101,108, 91, 51, 93,  0, 97,118,101,102, 97, 99,  0,112,104, 97,115,101,
+102, 97, 99,  0,114, 97,110,100,114,111,116,102, 97, 99,  0,114, 97,110,100,112,104, 97,115,101,102, 97, 99,  0,114, 97,110,100,
+115,105,122,101,  0, 97, 99, 99, 91, 51, 93,  0,100,114, 97,103,102, 97, 99,  0, 98,114,111,119,110,102, 97, 99,  0,114, 97,110,
+100,108,101,110,103,116,104,  0, 99,104,105,108,100, 95,110, 98,114,  0,114,101,110, 95, 99,104,105,108,100, 95,110, 98,114,  0,
+112, 97,114,101,110,116,115,  0, 99,104,105,108,100,115,105,122,101,  0, 99,104,105,108,100,114, 97,110,100,115,105,122,101,  0,
+ 99,104,105,108,100,114, 97,100,  0, 99,104,105,108,100,102,108, 97,116,  0, 99,108,117,109,112,112,111,119,  0,107,105,110,107,
+ 95,102,108, 97,116,  0,107,105,110,107, 95, 97,109,112, 95, 99,108,117,109,112,  0,114,111,117,103,104, 49,  0,114,111,117,103,
+104, 49, 95,115,105,122,101,  0,114,111,117,103,104, 50,  0,114,111,117,103,104, 50, 95,115,105,122,101,  0,114,111,117,103,104,
+ 50, 95,116,104,114,101,115,  0,114,111,117,103,104, 95,101,110,100,  0,114,111,117,103,104, 95,101,110,100, 95,115,104, 97,112,
+101,  0, 99,108,101,110,103,116,104,  0, 99,108,101,110,103,116,104, 95,116,104,114,101,115,  0,112, 97,114,116,105,110,103, 95,
+102, 97, 99,  0,112, 97,114,116,105,110,103, 95,109,105,110,  0,112, 97,114,116,105,110,103, 95,109, 97,120,  0, 98,114, 97,110,
+ 99,104, 95,116,104,114,101,115,  0,100,114, 97,119, 95,108,105,110,101, 91, 50, 93,  0,112, 97,116,104, 95,115,116, 97,114,116,
+  0,112, 97,116,104, 95,101,110,100,  0,116,114, 97,105,108, 95, 99,111,117,110,116,  0,107,101,121,101,100, 95,108,111,111,112,
+115,  0,100,117,112,108,105,119,101,105,103,104,116,115,  0, 42,101,102,102, 95,103,114,111,117,112,  0, 42,100,117,112, 95,111,
+ 98,  0, 42, 98, 98, 95,111, 98,  0, 42,112,100, 50,  0, 42,112, 97,114,116,  0, 42,112, 97,114,116,105, 99,108,101,115,  0, 42,
+ 42,112, 97,116,104, 99, 97, 99,104,101,  0, 42, 42, 99,104,105,108,100, 99, 97, 99,104,101,  0,112, 97,116,104, 99, 97, 99,104,
+101, 98,117,102,115,  0, 99,104,105,108,100, 99, 97, 99,104,101, 98,117,102,115,  0, 42, 99,108,109,100,  0, 42,104, 97,105,114,
+ 95,105,110, 95,100,109,  0, 42,104, 97,105,114, 95,111,117,116, 95,100,109,  0, 42,116, 97,114,103,101,116, 95,111, 98,  0, 42,
+108, 97,116,116,105, 99,101,  0,116,114,101,101, 95,102,114, 97,109,101,  0, 98,118,104,116,114,101,101, 95,102,114, 97,109,101,
+  0, 99,104,105,108,100, 95,115,101,101,100,  0,116,111,116,117,110,101,120,105,115,116,  0,116,111,116, 99,104,105,108,100,  0,
+116,111,116, 99, 97, 99,104,101,100,  0,116,111,116, 99,104,105,108,100, 99, 97, 99,104,101,  0,116, 97,114,103,101,116, 95,112,
+115,121,115,  0,116,111,116,107,101,121,101,100,  0, 98, 97,107,101,115,112, 97, 99,101,  0, 98, 98, 95,117,118,110, 97,109,101,
+ 91, 51, 93, 91, 54, 52, 93,  0,118,103,114,111,117,112, 91, 49, 50, 93,  0,118,103, 95,110,101,103,  0,114,116, 51,  0, 42,114,
+101,110,100,101,114,100, 97,116, 97,  0, 42,101,102,102,101, 99,116,111,114,115,  0, 42,102,108,117,105,100, 95,115,112,114,105,
+110,103,115,  0,116,111,116, 95,102,108,117,105,100,115,112,114,105,110,103,115,  0, 97,108,108,111, 99, 95,102,108,117,105,100,
+115,112,114,105,110,103,115,  0, 42,116,114,101,101,  0, 42,112,100,100,  0, 42,102,114, 97,110,100,  0,100,116, 95,102,114, 97,
+ 99,  0, 95,112, 97,100,  0, 67,100,105,115,  0, 67,118,105,  0,115,116,114,117, 99,116,117,114, 97,108,  0, 98,101,110,100,105,
+110,103,  0,109, 97,120, 95, 98,101,110,100,  0,109, 97,120, 95,115,116,114,117, 99,116,  0,109, 97,120, 95,115,104,101, 97,114,
+  0, 97,118,103, 95,115,112,114,105,110,103, 95,108,101,110,  0,116,105,109,101,115, 99, 97,108,101,  0,101,102,102, 95,102,111,
+114, 99,101, 95,115, 99, 97,108,101,  0,101,102,102, 95,119,105,110,100, 95,115, 99, 97,108,101,  0,115,105,109, 95,116,105,109,
+101, 95,111,108,100,  0,118,101,108,111, 99,105,116,121, 95,115,109,111,111,116,104,  0, 99,111,108,108,105,100,101,114, 95,102,
+114,105, 99,116,105,111,110,  0,118,101,108, 95,100, 97,109,112,105,110,103,  0,115,116,101,112,115, 80,101,114, 70,114, 97,109,
+101,  0,112,114,101,114,111,108,108,  0,109, 97,120,115,112,114,105,110,103,108,101,110,  0,115,111,108,118,101,114, 95,116,121,
+112,101,  0,118,103,114,111,117,112, 95, 98,101,110,100,  0,118,103,114,111,117,112, 95,109, 97,115,115,  0,118,103,114,111,117,
+112, 95,115,116,114,117, 99,116,  0,115,104, 97,112,101,107,101,121, 95,114,101,115,116,  0,112,114,101,115,101,116,115,  0,114,
+101,115,101,116,  0, 42, 99,111,108,108,105,115,105,111,110, 95,108,105,115,116,  0,101,112,115,105,108,111,110,  0,115,101,108,
+102, 95,102,114,105, 99,116,105,111,110,  0,115,101,108,102,101,112,115,105,108,111,110,  0,114,101,112,101,108, 95,102,111,114,
+ 99,101,  0,100,105,115,116, 97,110, 99,101, 95,114,101,112,101,108,  0,115,101,108,102, 95,108,111,111,112, 95, 99,111,117,110,
+116,  0,108,111,111,112, 95, 99,111,117,110,116,  0,112,114,101,115,115,117,114,101,  0,116,104,105, 99,107,110,101,115,115,  0,
+115,116,114,111,107,101,115,  0,102,114, 97,109,101,110,117,109,  0, 42, 97, 99,116,102,114, 97,109,101,  0,103,115,116,101,112,
+  0,105,110,102,111, 91, 49, 50, 56, 93,  0,115, 98,117,102,102,101,114, 95,115,105,122,101,  0,115, 98,117,102,102,101,114, 95,
+115,102,108, 97,103,  0, 42,115, 98,117,102,102,101,114,  0,108,105,115,116,  0,112,114,105,110,116,108,101,118,101,108,  0,115,
+116,111,114,101,108,101,118,101,108,  0, 42,114,101,112,111,114,116,116,105,109,101,114,  0, 42,119,105,110,100,114, 97,119, 97,
+ 98,108,101,  0, 42,119,105,110, 97, 99,116,105,118,101,  0,119,105,110,100,111,119,115,  0,105,110,105,116,105, 97,108,105,122,
+101,100,  0,102,105,108,101, 95,115, 97,118,101,100,  0,111,112, 95,117,110,100,111, 95,100,101,112,116,104,  0,111,112,101,114,
+ 97,116,111,114,115,  0,113,117,101,117,101,  0,114,101,112,111,114,116,115,  0,106,111, 98,115,  0,112, 97,105,110,116, 99,117,
+114,115,111,114,115,  0,100,114, 97,103,115,  0,107,101,121, 99,111,110,102,105,103,115,  0, 42,100,101,102, 97,117,108,116, 99,
+111,110,102,  0, 42, 97,100,100,111,110, 99,111,110,102,  0, 42,117,115,101,114, 99,111,110,102,  0,116,105,109,101,114,115,  0,
+ 42, 97,117,116,111,115, 97,118,101,116,105,109,101,114,  0, 42,103,104,111,115,116,119,105,110,  0,103,114, 97, 98, 99,117,114,
+115,111,114,  0, 42,115, 99,114,101,101,110,  0, 42,110,101,119,115, 99,114,101,101,110,  0,115, 99,114,101,101,110,110, 97,109,
+101, 91, 54, 52, 93,  0,112,111,115,120,  0,112,111,115,121,  0,119,105,110,100,111,119,115,116, 97,116,101,  0,109,111,110,105,
+116,111,114,  0,108, 97,115,116, 99,117,114,115,111,114,  0,109,111,100, 97,108, 99,117,114,115,111,114,  0, 97,100,100,109,111,
+117,115,101,109,111,118,101,  0, 42,101,118,101,110,116,115,116, 97,116,101,  0, 42, 99,117,114,115,119,105,110,  0, 42,116,119,
+101, 97,107,  0,100,114, 97,119,109,101,116,104,111,100,  0,100,114, 97,119,102, 97,105,108,  0, 42,100,114, 97,119,100, 97,116,
+ 97,  0,109,111,100, 97,108,104, 97,110,100,108,101,114,115,  0,115,117, 98,119,105,110,100,111,119,115,  0,103,101,115,116,117,
+114,101,  0,105,100,110, 97,109,101, 91, 54, 52, 93,  0,112,114,111,112,118, 97,108,117,101, 95,115,116,114, 91, 54, 52, 93,  0,
+112,114,111,112,118, 97,108,117,101,  0,115,104,105,102,116,  0, 99,116,114,108,  0, 97,108,116,  0,111,115,107,101,121,  0,107,
+101,121,109,111,100,105,102,105,101,114,  0,109, 97,112,116,121,112,101,  0, 42,112,116,114,  0, 42,114,101,109,111,118,101, 95,
+105,116,101,109,  0, 42, 97,100,100, 95,105,116,101,109,  0,105,116,101,109,115,  0,100,105,102,102, 95,105,116,101,109,115,  0,
+115,112, 97, 99,101,105,100,  0,114,101,103,105,111,110,105,100,  0,107,109,105, 95,105,100,  0, 40, 42,112,111,108,108, 41, 40,
+ 41,  0, 42,109,111,100, 97,108, 95,105,116,101,109,115,  0, 98, 97,115,101,110, 97,109,101, 91, 54, 52, 93,  0, 97, 99,116,107,
+101,121,109, 97,112,  0, 42, 99,117,115,116,111,109,100, 97,116, 97,  0, 42,112,121, 95,105,110,115,116, 97,110, 99,101,  0, 42,
+114,101,112,111,114,116,115,  0,109, 97, 99,114,111,  0, 42,111,112,109,  0, 42,101,100, 97,116, 97,  0, 42, 99,111,101,102,102,
+105, 99,105,101,110,116,115,  0, 97,114,114, 97,121,115,105,122,101,  0,112,111,108,121, 95,111,114,100,101,114,  0, 97,109,112,
+108,105,116,117,100,101,  0,112,104, 97,115,101, 95,109,117,108,116,105,112,108,105,101,114,  0,112,104, 97,115,101, 95,111,102,
+102,115,101,116,  0,118, 97,108,117,101, 95,111,102,102,115,101,116,  0,109,105,100,118, 97,108,  0, 98,101,102,111,114,101, 95,
+109,111,100,101,  0, 97,102,116,101,114, 95,109,111,100,101,  0, 98,101,102,111,114,101, 95, 99,121, 99,108,101,115,  0, 97,102,
+116,101,114, 95, 99,121, 99,108,101,115,  0,114,101, 99,116,  0,112,104, 97,115,101,  0,109,111,100,105,102,105, 99, 97,116,105,
+111,110,  0,115,116,101,112, 95,115,105,122,101,  0, 42,114,110, 97, 95,112, 97,116,104,  0,112, 99,104, 97,110, 95,110, 97,109,
+101, 91, 51, 50, 93,  0,116,114, 97,110,115, 67,104, 97,110,  0,105,100,116,121,112,101,  0,116, 97,114,103,101,116,115, 91, 56,
+ 93,  0,110,117,109, 95,116, 97,114,103,101,116,115,  0,118, 97,114,105, 97, 98,108,101,115,  0,101,120,112,114,101,115,115,105,
+111,110, 91, 50, 53, 54, 93,  0, 42,101,120,112,114, 95, 99,111,109,112,  0,118,101, 99, 91, 50, 93,  0, 42,102,112,116,  0, 97,
+114,114, 97,121, 95,105,110,100,101,120,  0, 99,111,108,111,114, 95,109,111,100,101,  0, 99,111,108,111,114, 91, 51, 93,  0,102,
+114,111,109, 91, 49, 50, 56, 93,  0,116,111, 91, 49, 50, 56, 93,  0,109, 97,112,112,105,110,103,115,  0,115,116,114,105,112,115,
+  0, 42,114,101,109, 97,112,  0,102, 99,117,114,118,101,115,  0,115,116,114,105,112, 95,116,105,109,101,  0, 98,108,101,110,100,
+109,111,100,101,  0,101,120,116,101,110,100,109,111,100,101,  0, 42,115,112,101, 97,107,101,114, 95,104, 97,110,100,108,101,  0,
+103,114,111,117,112, 91, 54, 52, 93,  0,103,114,111,117,112,109,111,100,101,  0,107,101,121,105,110,103,102,108, 97,103,  0,112,
+ 97,116,104,115,  0,100,101,115, 99,114,105,112,116,105,111,110, 91, 50, 52, 48, 93,  0,116,121,112,101,105,110,102,111, 91, 54,
+ 52, 93,  0, 97, 99,116,105,118,101, 95,112, 97,116,104,  0, 42,116,109,112, 97, 99,116,  0,110,108, 97, 95,116,114, 97, 99,107,
+115,  0, 42, 97, 99,116,115,116,114,105,112,  0,100,114,105,118,101,114,115,  0,111,118,101,114,114,105,100,101,115,  0, 97, 99,
+116, 95, 98,108,101,110,100,109,111,100,101,  0, 97, 99,116, 95,101,120,116,101,110,100,109,111,100,101,  0, 97, 99,116, 95,105,
+110,102,108,117,101,110, 99,101,  0,114,117,108,101,  0,111,112,116,105,111,110,115,  0,102,101, 97,114, 95,102, 97, 99,116,111,
+114,  0,115,105,103,110, 97,108, 95,105,100,  0,108,111,111,107, 95, 97,104,101, 97,100,  0,111,108,111, 99, 91, 51, 93,  0,113,
+117,101,117,101, 95,115,105,122,101,  0,119, 97,110,100,101,114,  0,102,108,101,101, 95,100,105,115,116, 97,110, 99,101,  0,104,
+101, 97,108,116,104,  0,115,116, 97,116,101, 95,105,100,  0,114,117,108,101,115,  0, 99,111,110,100,105,116,105,111,110,115,  0,
+ 97, 99,116,105,111,110,115,  0,114,117,108,101,115,101,116, 95,116,121,112,101,  0,114,117,108,101, 95,102,117,122,122,105,110,
+101,115,115,  0,108, 97,115,116, 95,115,116, 97,116,101, 95,105,100,  0,108, 97,110,100,105,110,103, 95,115,109,111,111,116,104,
+110,101,115,115,  0, 98, 97,110,107,105,110,103,  0, 97,103,103,114,101,115,115,105,111,110,  0, 97,105,114, 95,109,105,110, 95,
+115,112,101,101,100,  0, 97,105,114, 95,109, 97,120, 95,115,112,101,101,100,  0, 97,105,114, 95,109, 97,120, 95, 97, 99, 99,  0,
+ 97,105,114, 95,109, 97,120, 95, 97,118,101,  0, 97,105,114, 95,112,101,114,115,111,110, 97,108, 95,115,112, 97, 99,101,  0,108,
+ 97,110,100, 95,106,117,109,112, 95,115,112,101,101,100,  0,108, 97,110,100, 95,109, 97,120, 95,115,112,101,101,100,  0,108, 97,
+110,100, 95,109, 97,120, 95, 97, 99, 99,  0,108, 97,110,100, 95,109, 97,120, 95, 97,118,101,  0,108, 97,110,100, 95,112,101,114,
+115,111,110, 97,108, 95,115,112, 97, 99,101,  0,108, 97,110,100, 95,115,116,105, 99,107, 95,102,111,114, 99,101,  0,115,116, 97,
+116,101,115,  0, 42,115,109,100,  0, 42,102,108,117,105,100, 95,103,114,111,117,112,  0, 42, 99,111,108,108, 95,103,114,111,117,
+112,  0, 42,119,116,  0, 42,116,101,120, 95,119,116,  0, 42,116,101,120, 95,115,104, 97,100,111,119,  0, 42,115,104, 97,100,111,
+119,  0,112, 48, 91, 51, 93,  0,112, 49, 91, 51, 93,  0,100,120,  0,111,109,101,103, 97,  0,116,101,109,112, 65,109, 98,  0, 98,
+101,116, 97,  0,114,101,115, 91, 51, 93,  0, 97,109,112,108,105,102,121,  0,109, 97,120,114,101,115,  0,118,105,101,119,115,101,
+116,116,105,110,103,115,  0,110,111,105,115,101,  0,100,105,115,115, 95,112,101,114, 99,101,110,116,  0,100,105,115,115, 95,115,
+112,101,101,100,  0,114,101,115, 95,119,116, 91, 51, 93,  0,100,120, 95,119,116,  0,118, 51,100,110,117,109,  0, 99, 97, 99,104,
+101, 95, 99,111,109,112,  0, 99, 97, 99,104,101, 95,104,105,103,104, 95, 99,111,109,112,  0, 42,112,111,105,110,116, 95, 99, 97,
+ 99,104,101, 91, 50, 93,  0,112,116, 99, 97, 99,104,101,115, 91, 50, 93,  0, 98,111,114,100,101,114, 95, 99,111,108,108,105,115,
+105,111,110,115,  0,116,105,109,101, 95,115, 99, 97,108,101,  0,118,111,114,116,105, 99,105,116,121,  0,118,101,108,111, 99,105,
+116,121, 91, 50, 93,  0,118,101,108, 95,109,117,108,116,105,  0,118,103,114,112, 95,104,101, 97,116, 95,115, 99, 97,108,101, 91,
+ 50, 93,  0,118,103,114,111,117,112, 95,102,108,111,119,  0,118,103,114,111,117,112, 95,100,101,110,115,105,116,121,  0,118,103,
+114,111,117,112, 95,104,101, 97,116,  0, 42,112,111,105,110,116,115, 95,111,108,100,  0, 42,118,101,108,  0,109, 97,116, 95,111,
+108,100, 91, 52, 93, 91, 52, 93,  0,118,111,108,117,109,101, 95,109, 97,120,  0,118,111,108,117,109,101, 95,109,105,110,  0,100,
+105,115,116, 97,110, 99,101, 95,109, 97,120,  0,100,105,115,116, 97,110, 99,101, 95,114,101,102,101,114,101,110, 99,101,  0, 99,
+111,110,101, 95, 97,110,103,108,101, 95,111,117,116,101,114,  0, 99,111,110,101, 95, 97,110,103,108,101, 95,105,110,110,101,114,
+  0, 99,111,110,101, 95,118,111,108,117,109,101, 95,111,117,116,101,114,  0,114,101,110,100,101,114, 95,102,108, 97,103,  0, 98,
+117,105,108,100, 95,115,105,122,101, 95,102,108, 97,103,  0, 98,117,105,108,100, 95,116, 99, 95,102,108, 97,103,  0,108, 97,115,
+116,115,105,122,101, 91, 50, 93,  0,116,114, 97, 99,107,105,110,103,  0, 42,116,114, 97, 99,107,105,110,103, 95, 99,111,110,116,
+101,120,116,  0,112,114,111,120,121,  0,116,114, 97, 99,107, 95,112,114,101,118,105,101,119, 95,104,101,105,103,104,116,  0, 42,
+116,114, 97, 99,107, 95,112,114,101,118,105,101,119,  0,116,114, 97, 99,107, 95,112,111,115, 91, 50, 93,  0,116,114, 97, 99,107,
+ 95,100,105,115, 97, 98,108,101,100,  0, 42,109, 97,114,107,101,114,  0,115,108,105,100,101, 95,115, 99, 97,108,101, 91, 50, 93,
+  0,101,114,114,111,114,  0, 42,105,110,116,114,105,110,115,105, 99,115,  0,115,101,110,115,111,114, 95,119,105,100,116,104,  0,
+112,105,120,101,108, 95, 97,115,112,101, 99,116,  0,102,111, 99, 97,108,  0,117,110,105,116,115,  0,112,114,105,110, 99,105,112,
+ 97,108, 91, 50, 93,  0,107, 49,  0,107, 50,  0,107, 51,  0,112,111,115, 91, 50, 93,  0,112, 97,116, 95,109,105,110, 91, 50, 93,
+  0,112, 97,116, 95,109, 97,120, 91, 50, 93,  0,115,101, 97,114, 99,104, 95,109,105,110, 91, 50, 93,  0,115,101, 97,114, 99,104,
+ 95,109, 97,120, 91, 50, 93,  0,109, 97,114,107,101,114,115,110,114,  0,108, 97,115,116, 95,109, 97,114,107,101,114,  0, 42,109,
+ 97,114,107,101,114,115,  0, 98,117,110,100,108,101, 95,112,111,115, 91, 51, 93,  0,112, 97,116, 95,102,108, 97,103,  0,115,101,
+ 97,114, 99,104, 95,102,108, 97,103,  0,102,114, 97,109,101,115, 95,108,105,109,105,116,  0,112, 97,116,116,101,114,110, 95,109,
+ 97,116, 99,104,  0,116,114, 97, 99,107,101,114,  0,112,121,114, 97,109,105,100, 95,108,101,118,101,108,115,  0,109,105,110,105,
+109,117,109, 95, 99,111,114,114,101,108, 97,116,105,111,110,  0,100,101,102, 97,117,108,116, 95,116,114, 97, 99,107,101,114,  0,
+100,101,102, 97,117,108,116, 95,112,121,114, 97,109,105,100, 95,108,101,118,101,108,115,  0,100,101,102, 97,117,108,116, 95,109,
+105,110,105,109,117,109, 95, 99,111,114,114,101,108, 97,116,105,111,110,  0,100,101,102, 97,117,108,116, 95,112, 97,116,116,101,
+114,110, 95,115,105,122,101,  0,100,101,102, 97,117,108,116, 95,115,101, 97,114, 99,104, 95,115,105,122,101,  0,100,101,102, 97,
+117,108,116, 95,102,114, 97,109,101,115, 95,108,105,109,105,116,  0,100,101,102, 97,117,108,116, 95,109, 97,114,103,105,110,  0,
+100,101,102, 97,117,108,116, 95,112, 97,116,116,101,114,110, 95,109, 97,116, 99,104,  0,100,101,102, 97,117,108,116, 95,102,108,
+ 97,103,  0,112,111,100,  0,107,101,121,102,114, 97,109,101, 49,  0,107,101,121,102,114, 97,109,101, 50,  0,114,101,102,105,110,
+101, 95, 99, 97,109,101,114, 97, 95,105,110,116,114,105,110,115,105, 99,115,  0,112, 97,100, 50, 51,  0, 99,108,101, 97,110, 95,
+102,114, 97,109,101,115,  0, 99,108,101, 97,110, 95, 97, 99,116,105,111,110,  0, 99,108,101, 97,110, 95,101,114,114,111,114,  0,
+111, 98,106,101, 99,116, 95,100,105,115,116, 97,110, 99,101,  0,116,111,116, 95,116,114, 97, 99,107,  0, 97, 99,116, 95,116,114,
+ 97, 99,107,  0,109, 97,120,115, 99, 97,108,101,  0, 42,114,111,116, 95,116,114, 97, 99,107,  0,108,111, 99,105,110,102,  0,115,
+ 99, 97,108,101,105,110,102,  0,114,111,116,105,110,102,  0, 42,115, 99, 97,108,101,105, 98,117,102,  0,108, 97,115,116, 95, 99,
+ 97,109,101,114, 97,  0, 99, 97,109,110,114,  0, 42, 99, 97,109,101,114, 97,115,  0,116,114, 97, 99,107,115,  0,114,101, 99,111,
+110,115,116,114,117, 99,116,105,111,110,  0,109,101,115,115, 97,103,101, 91, 50, 53, 54, 93,  0,115,101,116,116,105,110,103,115,
+  0, 99, 97,109,101,114, 97,  0,115,116, 97, 98,105,108,105,122, 97,116,105,111,110,  0, 42, 97, 99,116, 95,116,114, 97, 99,107,
+  0,111, 98,106,101, 99,116,115,  0,111, 98,106,101, 99,116,110,114,  0,116,111,116, 95,111, 98,106,101, 99,116,  0, 42, 98,114,
+117,115,104, 95,103,114,111,117,112,  0, 99,117,114,114,101,110,116, 95,102,114, 97,109,101,  0,100,105,115,112, 95,116,121,112,
+101,  0,105,109, 97,103,101, 95,102,105,108,101,102,111,114,109, 97,116,  0,101,102,102,101, 99,116, 95,117,105,  0,112,114,101,
+118,105,101,119, 95,105,100,  0,105,110,105,116, 95, 99,111,108,111,114, 95,116,121,112,101,  0,112, 97,100, 95,115,  0,105,109,
+ 97,103,101, 95,114,101,115,111,108,117,116,105,111,110,  0,115,117, 98,115,116,101,112,115,  0,105,110,105,116, 95, 99,111,108,
+111,114, 91, 52, 93,  0, 42,105,110,105,116, 95,116,101,120,116,117,114,101,  0,105,110,105,116, 95,108, 97,121,101,114,110, 97,
+109,101, 91, 54, 52, 93,  0,100,114,121, 95,115,112,101,101,100,  0, 99,111,108,111,114, 95,100,114,121, 95,116,104,114,101,115,
+104,111,108,100,  0,100,101,112,116,104, 95, 99,108, 97,109,112,  0,100,105,115,112, 95,102, 97, 99,116,111,114,  0,115,112,114,
+101, 97,100, 95,115,112,101,101,100,  0, 99,111,108,111,114, 95,115,112,114,101, 97,100, 95,115,112,101,101,100,  0,115,104,114,
+105,110,107, 95,115,112,101,101,100,  0,100,114,105,112, 95,118,101,108,  0,100,114,105,112, 95, 97, 99, 99,  0,105,110,102,108,
+117,101,110, 99,101, 95,115, 99, 97,108,101,  0,114, 97,100,105,117,115, 95,115, 99, 97,108,101,  0,119, 97,118,101, 95,100, 97,
+109,112,105,110,103,  0,119, 97,118,101, 95,115,112,101,101,100,  0,119, 97,118,101, 95,116,105,109,101,115, 99, 97,108,101,  0,
+119, 97,118,101, 95,115,112,114,105,110,103,  0,105,109, 97,103,101, 95,111,117,116,112,117,116, 95,112, 97,116,104, 91, 49, 48,
+ 50, 52, 93,  0,111,117,116,112,117,116, 95,110, 97,109,101, 91, 54, 52, 93,  0,111,117,116,112,117,116, 95,110, 97,109,101, 50,
+ 91, 54, 52, 93,  0, 42,112,109,100,  0,115,117,114,102, 97, 99,101,115,  0, 97, 99,116,105,118,101, 95,115,117,114,  0,101,114,
+114,111,114, 91, 54, 52, 93,  0, 99,111,108,108,105,115,105,111,110,  0,119,101,116,110,101,115,115,  0,112, 97,114,116,105, 99,
+108,101, 95,114, 97,100,105,117,115,  0,112, 97,114,116,105, 99,108,101, 95,115,109,111,111,116,104,  0,112, 97,105,110,116, 95,
+100,105,115,116, 97,110, 99,101,  0, 42,112, 97,105,110,116, 95,114, 97,109,112,  0, 42,118,101,108, 95,114, 97,109,112,  0,112,
+114,111,120,105,109,105,116,121, 95,102, 97,108,108,111,102,102,  0,114, 97,121, 95,100,105,114,  0,119, 97,118,101, 95,102, 97,
+ 99,116,111,114,  0,119, 97,118,101, 95, 99,108, 97,109,112,  0,109, 97,120, 95,118,101,108,111, 99,105,116,121,  0,115,109,117,
+100,103,101, 95,115,116,114,101,110,103,116,104,  0,  0,  0,  0, 84, 89, 80, 69, 16,  2,  0,  0, 99,104, 97,114,  0,117, 99,104,
+ 97,114,  0,115,104,111,114,116,  0,117,115,104,111,114,116,  0,105,110,116,  0,108,111,110,103,  0,117,108,111,110,103,  0,102,
+108,111, 97,116,  0,100,111,117, 98,108,101,  0,105,110,116, 54, 52, 95,116,  0,117,105,110,116, 54, 52, 95,116,  0,118,111,105,
+100,  0, 76,105,110,107,  0, 76,105,110,107, 68, 97,116, 97,  0, 76,105,115,116, 66, 97,115,101,  0,118,101, 99, 50,115,  0,118,
+101, 99, 50,102,  0,118,101, 99, 51,102,  0,114, 99,116,105,  0,114, 99,116,102,  0, 73, 68, 80,114,111,112,101,114,116,121, 68,
+ 97,116, 97,  0, 73, 68, 80,114,111,112,101,114,116,121,  0, 73, 68,  0, 76,105, 98,114, 97,114,121,  0, 70,105,108,101, 68, 97,
+116, 97,  0, 80,114,101,118,105,101,119, 73,109, 97,103,101,  0, 73,112,111, 68,114,105,118,101,114,  0, 79, 98,106,101, 99,116,
+  0, 73,112,111, 67,117,114,118,101,  0, 66, 80,111,105,110,116,  0, 66,101,122, 84,114,105,112,108,101,  0, 73,112,111,  0, 75,
+101,121, 66,108,111, 99,107,  0, 75,101,121,  0, 65,110,105,109, 68, 97,116, 97,  0, 84,101,120,116, 76,105,110,101,  0, 84,101,
+120,116, 77, 97,114,107,101,114,  0, 84,101,120,116,  0, 80, 97, 99,107,101,100, 70,105,108,101,  0, 67, 97,109,101,114, 97,  0,
+ 73,109, 97,103,101, 85,115,101,114,  0, 83, 99,101,110,101,  0, 73,109, 97,103,101,  0, 71, 80, 85, 84,101,120,116,117,114,101,
+  0, 97,110,105,109,  0, 82,101,110,100,101,114, 82,101,115,117,108,116,  0, 77, 84,101,120,  0, 84,101,120,  0, 80,108,117,103,
+105,110, 84,101,120,  0, 67, 66, 68, 97,116, 97,  0, 67,111,108,111,114, 66, 97,110,100,  0, 69,110,118, 77, 97,112,  0, 73,109,
+ 66,117,102,  0, 80,111,105,110,116, 68,101,110,115,105,116,121,  0, 67,117,114,118,101, 77, 97,112,112,105,110,103,  0, 86,111,
+120,101,108, 68, 97,116, 97,  0, 79, 99,101, 97,110, 84,101,120,  0, 98, 78,111,100,101, 84,114,101,101,  0, 84,101,120, 77, 97,
+112,112,105,110,103,  0, 67,111,108,111,114, 77, 97,112,112,105,110,103,  0, 76, 97,109,112,  0, 86,111,108,117,109,101, 83,101,
+116,116,105,110,103,115,  0, 71, 97,109,101, 83,101,116,116,105,110,103,115,  0, 77, 97,116,101,114,105, 97,108,  0, 71,114,111,
+117,112,  0, 86, 70,111,110,116,  0, 86, 70,111,110,116, 68, 97,116, 97,  0, 77,101,116, 97, 69,108,101,109,  0, 66,111,117,110,
+100, 66,111,120,  0, 77,101,116, 97, 66, 97,108,108,  0, 78,117,114, 98,  0, 67,104, 97,114, 73,110,102,111,  0, 84,101,120,116,
+ 66,111,120,  0, 69,100,105,116, 78,117,114, 98,  0, 71, 72, 97,115,104,  0, 67,117,114,118,101,  0, 80, 97,116,104,  0, 83,101,
+108, 66,111,120,  0, 69,100,105,116, 70,111,110,116,  0, 77,101,115,104,  0, 77, 83,101,108,101, 99,116,  0, 77, 80,111,108,121,
+  0, 77, 84,101,120, 80,111,108,121,  0, 77, 76,111,111,112,  0, 77, 76,111,111,112, 85, 86,  0, 77, 76,111,111,112, 67,111,108,
+  0, 77, 70, 97, 99,101,  0, 77, 84, 70, 97, 99,101,  0, 84, 70, 97, 99,101,  0, 77, 86,101,114,116,  0, 77, 69,100,103,101,  0,
+ 77, 68,101,102,111,114,109, 86,101,114,116,  0, 77, 67,111,108,  0, 77, 83,116,105, 99,107,121,  0, 66, 77, 69,100,105,116, 77,
+101,115,104,  0, 67,117,115,116,111,109, 68, 97,116, 97,  0, 77,117,108,116,105,114,101,115,  0, 77, 68,101,102,111,114,109, 87,
+101,105,103,104,116,  0, 77, 70,108,111, 97,116, 80,114,111,112,101,114,116,121,  0, 77, 73,110,116, 80,114,111,112,101,114,116,
+121,  0, 77, 83,116,114,105,110,103, 80,114,111,112,101,114,116,121,  0, 79,114,105,103, 83,112, 97, 99,101, 70, 97, 99,101,  0,
+ 79,114,105,103, 83,112, 97, 99,101, 76,111,111,112,  0, 77, 68,105,115,112,115,  0, 77,117,108,116,105,114,101,115, 67,111,108,
+  0, 77,117,108,116,105,114,101,115, 67,111,108, 70, 97, 99,101,  0, 77,117,108,116,105,114,101,115, 70, 97, 99,101,  0, 77,117,
+108,116,105,114,101,115, 69,100,103,101,  0, 77,117,108,116,105,114,101,115, 76,101,118,101,108,  0, 77, 82,101, 99, 97,115,116,
+  0, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 77, 97,112,112,105,110,103, 73,110,102,111, 77,111,100,105,102,105,101,
+114, 68, 97,116, 97,  0, 83,117, 98,115,117,114,102, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 76, 97,116,116,105, 99,
+101, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 67,117,114,118,101, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0,
+ 66,117,105,108,100, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 77, 97,115,107, 77,111,100,105,102,105,101,114, 68, 97,
+116, 97,  0, 65,114,114, 97,121, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 77,105,114,114,111,114, 77,111,100,105,102,
+105,101,114, 68, 97,116, 97,  0, 69,100,103,101, 83,112,108,105,116, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 66,101,
+118,101,108, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 66, 77,101,115,104, 77,111,100,105,102,105,101,114, 68, 97,116,
+ 97,  0, 83,109,111,107,101, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 83,109,111,107,101, 68,111,109, 97,105,110, 83,
+101,116,116,105,110,103,115,  0, 83,109,111,107,101, 70,108,111,119, 83,101,116,116,105,110,103,115,  0, 83,109,111,107,101, 67,
+111,108,108, 83,101,116,116,105,110,103,115,  0, 68,105,115,112,108, 97, 99,101, 77,111,100,105,102,105,101,114, 68, 97,116, 97,
+  0, 85, 86, 80,114,111,106,101, 99,116, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 68,101, 99,105,109, 97,116,101, 77,
+111,100,105,102,105,101,114, 68, 97,116, 97,  0, 83,109,111,111,116,104, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 67,
+ 97,115,116, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 87, 97,118,101, 77,111,100,105,102,105,101,114, 68, 97,116, 97,
+  0, 65,114,109, 97,116,117,114,101, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 72,111,111,107, 77,111,100,105,102,105,
+101,114, 68, 97,116, 97,  0, 83,111,102,116, 98,111,100,121, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 67,108,111,116,
+104, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 67,108,111,116,104,  0, 67,108,111,116,104, 83,105,109, 83,101,116,116,
+105,110,103,115,  0, 67,108,111,116,104, 67,111,108,108, 83,101,116,116,105,110,103,115,  0, 80,111,105,110,116, 67, 97, 99,104,
+101,  0, 67,111,108,108,105,115,105,111,110, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 66, 86, 72, 84,114,101,101,  0,
+ 83,117,114,102, 97, 99,101, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 68,101,114,105,118,101,100, 77,101,115,104,  0,
+ 66, 86, 72, 84,114,101,101, 70,114,111,109, 77,101,115,104,  0, 66,111,111,108,101, 97,110, 77,111,100,105,102,105,101,114, 68,
+ 97,116, 97,  0, 77, 68,101,102, 73,110,102,108,117,101,110, 99,101,  0, 77, 68,101,102, 67,101,108,108,  0, 77,101,115,104, 68,
+101,102,111,114,109, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 80, 97,114,116,105, 99,108,101, 83,121,115,116,101,109,
+ 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 80, 97,114,116,105, 99,108,101, 83,121,115,116,101,109,  0, 80, 97,114,116,
+105, 99,108,101, 73,110,115,116, 97,110, 99,101, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 69,120,112,108,111,100,101,
+ 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 77,117,108,116,105,114,101,115, 77,111,100,105,102,105,101,114, 68, 97,116,
+ 97,  0, 70,108,117,105,100,115,105,109, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 70,108,117,105,100,115,105,109, 83,
+101,116,116,105,110,103,115,  0, 83,104,114,105,110,107,119,114, 97,112, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 83,
+105,109,112,108,101, 68,101,102,111,114,109, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 83,104, 97,112,101, 75,101,121,
+ 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 83,111,108,105,100,105,102,121, 77,111,100,105,102,105,101,114, 68, 97,116,
+ 97,  0, 83, 99,114,101,119, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 79, 99,101, 97,110, 77,111,100,105,102,105,101,
+114, 68, 97,116, 97,  0, 79, 99,101, 97,110,  0, 79, 99,101, 97,110, 67, 97, 99,104,101,  0, 87, 97,114,112, 77,111,100,105,102,
+105,101,114, 68, 97,116, 97,  0, 87,101,105,103,104,116, 86, 71, 69,100,105,116, 77,111,100,105,102,105,101,114, 68, 97,116, 97,
+  0, 87,101,105,103,104,116, 86, 71, 77,105,120, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 87,101,105,103,104,116, 86,
+ 71, 80,114,111,120,105,109,105,116,121, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 68,121,110, 97,109,105, 99, 80, 97,
+105,110,116, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 68,121,110, 97,109,105, 99, 80, 97,105,110,116, 67, 97,110,118,
+ 97,115, 83,101,116,116,105,110,103,115,  0, 68,121,110, 97,109,105, 99, 80, 97,105,110,116, 66,114,117,115,104, 83,101,116,116,
+105,110,103,115,  0, 82,101,109,101,115,104, 77,111,100,105,102,105,101,114, 68, 97,116, 97,  0, 69,100,105,116, 76, 97,116,116,
+  0, 76, 97,116,116,105, 99,101,  0, 98, 68,101,102,111,114,109, 71,114,111,117,112,  0, 83, 99,117,108,112,116, 83,101,115,115,
+105,111,110,  0, 98, 65, 99,116,105,111,110,  0, 98, 80,111,115,101,  0, 98, 71, 80,100, 97,116, 97,  0, 98, 65,110,105,109, 86,
+105,122, 83,101,116,116,105,110,103,115,  0, 98, 77,111,116,105,111,110, 80, 97,116,104,  0, 66,117,108,108,101,116, 83,111,102,
+116, 66,111,100,121,  0, 80, 97,114,116, 68,101,102,108,101, 99,116,  0, 83,111,102,116, 66,111,100,121,  0, 79, 98, 72,111,111,
+107,  0, 68,117,112,108,105, 79, 98,106,101, 99,116,  0, 82, 78, 71,  0, 69,102,102,101, 99,116,111,114, 87,101,105,103,104,116,
+115,  0, 80, 84, 67, 97, 99,104,101, 69,120,116,114, 97,  0, 80, 84, 67, 97, 99,104,101, 77,101,109,  0, 80, 84, 67, 97, 99,104,
+101, 69,100,105,116,  0, 83, 66, 86,101,114,116,101,120,  0, 66,111,100,121, 80,111,105,110,116,  0, 66,111,100,121, 83,112,114,
+105,110,103,  0, 83, 66, 83, 99,114, 97,116, 99,104,  0, 70,108,117,105,100, 86,101,114,116,101,120, 86,101,108,111, 99,105,116,
+121,  0, 87,111,114,108,100,  0, 66, 97,115,101,  0, 65,118,105, 67,111,100,101, 99, 68, 97,116, 97,  0, 81,117,105, 99,107,116,
+105,109,101, 67,111,100,101, 99, 68, 97,116, 97,  0, 81,117,105, 99,107,116,105,109,101, 67,111,100,101, 99, 83,101,116,116,105,
+110,103,115,  0, 70, 70, 77,112,101,103, 67,111,100,101, 99, 68, 97,116, 97,  0, 65,117,100,105,111, 68, 97,116, 97,  0, 83, 99,
+101,110,101, 82,101,110,100,101,114, 76, 97,121,101,114,  0, 73,109, 97,103,101, 70,111,114,109, 97,116, 68, 97,116, 97,  0, 82,
+101,110,100,101,114, 68, 97,116, 97,  0, 82,101,110,100,101,114, 80,114,111,102,105,108,101,  0, 71, 97,109,101, 68,111,109,101,
+  0, 71, 97,109,101, 70,114, 97,109,105,110,103,  0, 82,101, 99, 97,115,116, 68, 97,116, 97,  0, 71, 97,109,101, 68, 97,116, 97,
+  0, 84,105,109,101, 77, 97,114,107,101,114,  0, 80, 97,105,110,116,  0, 66,114,117,115,104,  0, 73,109, 97,103,101, 80, 97,105,
+110,116, 83,101,116,116,105,110,103,115,  0, 80, 97,114,116,105, 99,108,101, 66,114,117,115,104, 68, 97,116, 97,  0, 80, 97,114,
+116,105, 99,108,101, 69,100,105,116, 83,101,116,116,105,110,103,115,  0, 83, 99,117,108,112,116,  0, 85,118, 83, 99,117,108,112,
+116,  0, 86, 80, 97,105,110,116,  0, 84,114, 97,110,115,102,111,114,109, 79,114,105,101,110,116, 97,116,105,111,110,  0, 85,110,
+105,102,105,101,100, 80, 97,105,110,116, 83,101,116,116,105,110,103,115,  0, 84,111,111,108, 83,101,116,116,105,110,103,115,  0,
+ 98, 83,116, 97,116,115,  0, 85,110,105,116, 83,101,116,116,105,110,103,115,  0, 80,104,121,115,105, 99,115, 83,101,116,116,105,
+110,103,115,  0, 69,100,105,116,105,110,103,  0, 83, 99,101,110,101, 83,116, 97,116,115,  0, 68, 97,103, 70,111,114,101,115,116,
+  0, 77,111,118,105,101, 67,108,105,112,  0, 66, 71,112,105, 99,  0, 77,111,118,105,101, 67,108,105,112, 85,115,101,114,  0, 82,
+101,103,105,111,110, 86,105,101,119, 51, 68,  0, 82,101,110,100,101,114, 73,110,102,111,  0, 82,101,110,100,101,114, 69,110,103,
+105,110,101,  0, 86,105,101,119, 68,101,112,116,104,115,  0, 83,109,111,111,116,104, 86,105,101,119, 83,116,111,114,101,  0,119,
+109, 84,105,109,101,114,  0, 86,105,101,119, 51, 68,  0, 83,112, 97, 99,101, 76,105,110,107,  0, 86,105,101,119, 50, 68,  0, 83,
+112, 97, 99,101, 73,110,102,111,  0, 83,112, 97, 99,101, 73,112,111,  0, 98, 68,111,112,101, 83,104,101,101,116,  0, 83,112, 97,
+ 99,101, 66,117,116,115,  0, 83,112, 97, 99,101, 83,101,113,  0, 70,105,108,101, 83,101,108,101, 99,116, 80, 97,114, 97,109,115,
+  0, 83,112, 97, 99,101, 70,105,108,101,  0, 70,105,108,101, 76,105,115,116,  0,119,109, 79,112,101,114, 97,116,111,114,  0, 70,
+105,108,101, 76, 97,121,111,117,116,  0, 83,112, 97, 99,101, 79,111,112,115,  0, 84,114,101,101, 83,116,111,114,101,  0, 84,114,
+101,101, 83,116,111,114,101, 69,108,101,109,  0, 83,112, 97, 99,101, 73,109, 97,103,101,  0, 83, 99,111,112,101,115,  0, 72,105,
+115,116,111,103,114, 97,109,  0, 83,112, 97, 99,101, 78,108, 97,  0, 83,112, 97, 99,101, 84,101,120,116,  0, 83, 99,114,105,112,
+116,  0, 83,112, 97, 99,101, 83, 99,114,105,112,116,  0, 83,112, 97, 99,101, 84,105,109,101, 67, 97, 99,104,101,  0, 83,112, 97,
+ 99,101, 84,105,109,101,  0, 83,112, 97, 99,101, 78,111,100,101,  0, 83,112, 97, 99,101, 76,111,103,105, 99,  0, 67,111,110,115,
+111,108,101, 76,105,110,101,  0, 83,112, 97, 99,101, 67,111,110,115,111,108,101,  0, 83,112, 97, 99,101, 85,115,101,114, 80,114,
+101,102,  0, 83,112, 97, 99,101, 67,108,105,112,  0, 77,111,118,105,101, 67,108,105,112, 83, 99,111,112,101,115,  0,117,105, 70,
+111,110,116,  0,117,105, 70,111,110,116, 83,116,121,108,101,  0,117,105, 83,116,121,108,101,  0,117,105, 87,105,100,103,101,116,
+ 67,111,108,111,114,115,  0,117,105, 87,105,100,103,101,116, 83,116, 97,116,101, 67,111,108,111,114,115,  0,117,105, 80, 97,110,
+101,108, 67,111,108,111,114,115,  0, 84,104,101,109,101, 85, 73,  0, 84,104,101,109,101, 83,112, 97, 99,101,  0, 84,104,101,109,
+101, 87,105,114,101, 67,111,108,111,114,  0, 98, 84,104,101,109,101,  0, 98, 65,100,100,111,110,  0, 83,111,108,105,100, 76,105,
+103,104,116,  0, 85,115,101,114, 68,101,102,  0, 98, 83, 99,114,101,101,110,  0, 83, 99,114, 86,101,114,116,  0, 83, 99,114, 69,
+100,103,101,  0, 80, 97,110,101,108,  0, 80, 97,110,101,108, 84,121,112,101,  0,117,105, 76, 97,121,111,117,116,  0, 83, 99,114,
+ 65,114,101, 97,  0, 83,112, 97, 99,101, 84,121,112,101,  0, 65, 82,101,103,105,111,110,  0, 65, 82,101,103,105,111,110, 84,121,
+112,101,  0, 70,105,108,101, 71,108,111, 98, 97,108,  0, 83,116,114,105,112, 69,108,101,109,  0, 83,116,114,105,112, 67,114,111,
+112,  0, 83,116,114,105,112, 84,114, 97,110,115,102,111,114,109,  0, 83,116,114,105,112, 67,111,108,111,114, 66, 97,108, 97,110,
+ 99,101,  0, 83,116,114,105,112, 80,114,111,120,121,  0, 83,116,114,105,112,  0, 80,108,117,103,105,110, 83,101,113,  0, 83,101,
+113,117,101,110, 99,101,  0, 98, 83,111,117,110,100,  0, 77,101,116, 97, 83,116, 97, 99,107,  0, 87,105,112,101, 86, 97,114,115,
+  0, 71,108,111,119, 86, 97,114,115,  0, 84,114, 97,110,115,102,111,114,109, 86, 97,114,115,  0, 83,111,108,105,100, 67,111,108,
+111,114, 86, 97,114,115,  0, 83,112,101,101,100, 67,111,110,116,114,111,108, 86, 97,114,115,  0, 69,102,102,101, 99,116,  0, 66,
+117,105,108,100, 69,102,102,  0, 80, 97,114,116, 69,102,102,  0, 80, 97,114,116,105, 99,108,101,  0, 87, 97,118,101, 69,102,102,
+  0, 98, 80,114,111,112,101,114,116,121,  0, 98, 78,101, 97,114, 83,101,110,115,111,114,  0, 98, 77,111,117,115,101, 83,101,110,
+115,111,114,  0, 98, 84,111,117, 99,104, 83,101,110,115,111,114,  0, 98, 75,101,121, 98,111, 97,114,100, 83,101,110,115,111,114,
+  0, 98, 80,114,111,112,101,114,116,121, 83,101,110,115,111,114,  0, 98, 65, 99,116,117, 97,116,111,114, 83,101,110,115,111,114,
+  0, 98, 68,101,108, 97,121, 83,101,110,115,111,114,  0, 98, 67,111,108,108,105,115,105,111,110, 83,101,110,115,111,114,  0, 98,
+ 82, 97,100, 97,114, 83,101,110,115,111,114,  0, 98, 82, 97,110,100,111,109, 83,101,110,115,111,114,  0, 98, 82, 97,121, 83,101,
+110,115,111,114,  0, 98, 65,114,109, 97,116,117,114,101, 83,101,110,115,111,114,  0, 98, 77,101,115,115, 97,103,101, 83,101,110,
+115,111,114,  0, 98, 83,101,110,115,111,114,  0, 98, 67,111,110,116,114,111,108,108,101,114,  0, 98, 74,111,121,115,116,105, 99,
+107, 83,101,110,115,111,114,  0, 98, 69,120,112,114,101,115,115,105,111,110, 67,111,110,116,  0, 98, 80,121,116,104,111,110, 67,
+111,110,116,  0, 98, 65, 99,116,117, 97,116,111,114,  0, 98, 65,100,100, 79, 98,106,101, 99,116, 65, 99,116,117, 97,116,111,114,
+  0, 98, 65, 99,116,105,111,110, 65, 99,116,117, 97,116,111,114,  0, 83,111,117,110,100, 51, 68,  0, 98, 83,111,117,110,100, 65,
+ 99,116,117, 97,116,111,114,  0, 98, 69,100,105,116, 79, 98,106,101, 99,116, 65, 99,116,117, 97,116,111,114,  0, 98, 83, 99,101,
+110,101, 65, 99,116,117, 97,116,111,114,  0, 98, 80,114,111,112,101,114,116,121, 65, 99,116,117, 97,116,111,114,  0, 98, 79, 98,
+106,101, 99,116, 65, 99,116,117, 97,116,111,114,  0, 98, 73,112,111, 65, 99,116,117, 97,116,111,114,  0, 98, 67, 97,109,101,114,
+ 97, 65, 99,116,117, 97,116,111,114,  0, 98, 67,111,110,115,116,114, 97,105,110,116, 65, 99,116,117, 97,116,111,114,  0, 98, 71,
+114,111,117,112, 65, 99,116,117, 97,116,111,114,  0, 98, 82, 97,110,100,111,109, 65, 99,116,117, 97,116,111,114,  0, 98, 77,101,
+115,115, 97,103,101, 65, 99,116,117, 97,116,111,114,  0, 98, 71, 97,109,101, 65, 99,116,117, 97,116,111,114,  0, 98, 86,105,115,
+105, 98,105,108,105,116,121, 65, 99,116,117, 97,116,111,114,  0, 98, 84,119,111, 68, 70,105,108,116,101,114, 65, 99,116,117, 97,
+116,111,114,  0, 98, 80, 97,114,101,110,116, 65, 99,116,117, 97,116,111,114,  0, 98, 83,116, 97,116,101, 65, 99,116,117, 97,116,
+111,114,  0, 98, 65,114,109, 97,116,117,114,101, 65, 99,116,117, 97,116,111,114,  0, 98, 83,116,101,101,114,105,110,103, 65, 99,
+116,117, 97,116,111,114,  0, 71,114,111,117,112, 79, 98,106,101, 99,116,  0, 66,111,110,101,  0, 98, 65,114,109, 97,116,117,114,
+101,  0, 98, 77,111,116,105,111,110, 80, 97,116,104, 86,101,114,116,  0, 98, 80,111,115,101, 67,104, 97,110,110,101,108,  0, 98,
+ 73, 75, 80, 97,114, 97,109,  0, 98, 73,116, 97,115, 99,  0, 98, 65, 99,116,105,111,110, 71,114,111,117,112,  0, 83,112, 97, 99,
+101, 65, 99,116,105,111,110,  0, 98, 65, 99,116,105,111,110, 67,104, 97,110,110,101,108,  0, 98, 67,111,110,115,116,114, 97,105,
+110,116, 67,104, 97,110,110,101,108,  0, 98, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 67,111,110,115,116,114, 97,105,110,
+116, 84, 97,114,103,101,116,  0, 98, 80,121,116,104,111,110, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 75,105,110,101,109,
+ 97,116,105, 99, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 83,112,108,105,110,101, 73, 75, 67,111,110,115,116,114, 97,105,
+110,116,  0, 98, 84,114, 97, 99,107, 84,111, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 82,111,116, 97,116,101, 76,105,107,
+101, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 76,111, 99, 97,116,101, 76,105,107,101, 67,111,110,115,116,114, 97,105,110,
+116,  0, 98, 83,105,122,101, 76,105,107,101, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 83, 97,109,101, 86,111,108,117,109,
+101, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 84,114, 97,110,115, 76,105,107,101, 67,111,110,115,116,114, 97,105,110,116,
+  0, 98, 77,105,110, 77, 97,120, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 65, 99,116,105,111,110, 67,111,110,115,116,114,
+ 97,105,110,116,  0, 98, 76,111, 99,107, 84,114, 97, 99,107, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 68, 97,109,112, 84,
+114, 97, 99,107, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 70,111,108,108,111,119, 80, 97,116,104, 67,111,110,115,116,114,
+ 97,105,110,116,  0, 98, 83,116,114,101,116, 99,104, 84,111, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 82,105,103,105,100,
+ 66,111,100,121, 74,111,105,110,116, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 67,108, 97,109,112, 84,111, 67,111,110,115,
+116,114, 97,105,110,116,  0, 98, 67,104,105,108,100, 79,102, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 84,114, 97,110,115,
+102,111,114,109, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 80,105,118,111,116, 67,111,110,115,116,114, 97,105,110,116,  0,
+ 98, 76,111, 99, 76,105,109,105,116, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 82,111,116, 76,105,109,105,116, 67,111,110,
+115,116,114, 97,105,110,116,  0, 98, 83,105,122,101, 76,105,109,105,116, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 68,105,
+115,116, 76,105,109,105,116, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 83,104,114,105,110,107,119,114, 97,112, 67,111,110,
+115,116,114, 97,105,110,116,  0, 98, 70,111,108,108,111,119, 84,114, 97, 99,107, 67,111,110,115,116,114, 97,105,110,116,  0, 98,
+ 67, 97,109,101,114, 97, 83,111,108,118,101,114, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 79, 98,106,101, 99,116, 83,111,
+108,118,101,114, 67,111,110,115,116,114, 97,105,110,116,  0, 98, 65, 99,116,105,111,110, 77,111,100,105,102,105,101,114,  0, 98,
+ 65, 99,116,105,111,110, 83,116,114,105,112,  0, 98, 78,111,100,101, 83,116, 97, 99,107,  0, 98, 78,111,100,101, 83,111, 99,107,
+101,116,  0, 98, 78,111,100,101, 76,105,110,107,  0, 98, 78,111,100,101, 80,114,101,118,105,101,119,  0, 98, 78,111,100,101,  0,
+117,105, 66,108,111, 99,107,  0, 98, 78,111,100,101, 84,121,112,101,  0, 98, 78,111,100,101, 84,114,101,101, 69,120,101, 99,  0,
+ 98, 78,111,100,101, 83,111, 99,107,101,116, 86, 97,108,117,101, 73,110,116,  0, 98, 78,111,100,101, 83,111, 99,107,101,116, 86,
+ 97,108,117,101, 70,108,111, 97,116,  0, 98, 78,111,100,101, 83,111, 99,107,101,116, 86, 97,108,117,101, 66,111,111,108,101, 97,
+110,  0, 98, 78,111,100,101, 83,111, 99,107,101,116, 86, 97,108,117,101, 86,101, 99,116,111,114,  0, 98, 78,111,100,101, 83,111,
+ 99,107,101,116, 86, 97,108,117,101, 82, 71, 66, 65,  0, 78,111,100,101, 73,109, 97,103,101, 65,110,105,109,  0, 78,111,100,101,
+ 66,108,117,114, 68, 97,116, 97,  0, 78,111,100,101, 68, 66,108,117,114, 68, 97,116, 97,  0, 78,111,100,101, 66,105,108, 97,116,
+101,114, 97,108, 66,108,117,114, 68, 97,116, 97,  0, 78,111,100,101, 72,117,101, 83, 97,116,  0, 78,111,100,101, 73,109, 97,103,
+101, 70,105,108,101,  0, 78,111,100,101, 73,109, 97,103,101, 77,117,108,116,105, 70,105,108,101,  0, 78,111,100,101, 73,109, 97,
+103,101, 77,117,108,116,105, 70,105,108,101, 83,111, 99,107,101,116,  0, 78,111,100,101, 67,104,114,111,109, 97,  0, 78,111,100,
+101, 84,119,111, 88, 89,115,  0, 78,111,100,101, 84,119,111, 70,108,111, 97,116,115,  0, 78,111,100,101, 71,101,111,109,101,116,
+114,121,  0, 78,111,100,101, 86,101,114,116,101,120, 67,111,108,  0, 78,111,100,101, 68,101,102,111, 99,117,115,  0, 78,111,100,
+101, 83, 99,114,105,112,116, 68,105, 99,116,  0, 78,111,100,101, 71,108, 97,114,101,  0, 78,111,100,101, 84,111,110,101,109, 97,
+112,  0, 78,111,100,101, 76,101,110,115, 68,105,115,116,  0, 78,111,100,101, 67,111,108,111,114, 66, 97,108, 97,110, 99,101,  0,
+ 78,111,100,101, 67,111,108,111,114,115,112,105,108,108,  0, 78,111,100,101, 84,101,120, 66, 97,115,101,  0, 78,111,100,101, 84,
+101,120, 83,107,121,  0, 78,111,100,101, 84,101,120, 73,109, 97,103,101,  0, 78,111,100,101, 84,101,120, 67,104,101, 99,107,101,
+114,  0, 78,111,100,101, 84,101,120, 69,110,118,105,114,111,110,109,101,110,116,  0, 78,111,100,101, 84,101,120, 71,114, 97,100,
+105,101,110,116,  0, 78,111,100,101, 84,101,120, 78,111,105,115,101,  0, 78,111,100,101, 84,101,120, 86,111,114,111,110,111,105,
+  0, 78,111,100,101, 84,101,120, 77,117,115,103,114, 97,118,101,  0, 78,111,100,101, 84,101,120, 87, 97,118,101,  0, 78,111,100,
+101, 84,101,120, 77, 97,103,105, 99,  0, 78,111,100,101, 83,104, 97,100,101,114, 65,116,116,114,105, 98,117,116,101,  0, 84,101,
+120, 78,111,100,101, 79,117,116,112,117,116,  0, 67,117,114,118,101, 77, 97,112, 80,111,105,110,116,  0, 67,117,114,118,101, 77,
+ 97,112,  0, 66,114,117,115,104, 67,108,111,110,101,  0, 67,117,115,116,111,109, 68, 97,116, 97, 76, 97,121,101,114,  0, 67,117,
+115,116,111,109, 68, 97,116, 97, 69,120,116,101,114,110, 97,108,  0, 72, 97,105,114, 75,101,121,  0, 80, 97,114,116,105, 99,108,
+101, 75,101,121,  0, 66,111,105,100, 80, 97,114,116,105, 99,108,101,  0, 66,111,105,100, 68, 97,116, 97,  0, 80, 97,114,116,105,
+ 99,108,101, 83,112,114,105,110,103,  0, 67,104,105,108,100, 80, 97,114,116,105, 99,108,101,  0, 80, 97,114,116,105, 99,108,101,
+ 84, 97,114,103,101,116,  0, 80, 97,114,116,105, 99,108,101, 68,117,112,108,105, 87,101,105,103,104,116,  0, 80, 97,114,116,105,
+ 99,108,101, 68, 97,116, 97,  0, 83, 80, 72, 70,108,117,105,100, 83,101,116,116,105,110,103,115,  0, 80, 97,114,116,105, 99,108,
+101, 83,101,116,116,105,110,103,115,  0, 66,111,105,100, 83,101,116,116,105,110,103,115,  0, 80, 97,114,116,105, 99,108,101, 67,
+ 97, 99,104,101, 75,101,121,  0, 75, 68, 84,114,101,101,  0, 80, 97,114,116,105, 99,108,101, 68,114, 97,119, 68, 97,116, 97,  0,
+ 76,105,110,107, 78,111,100,101,  0, 98, 71, 80, 68,115,112,111,105,110,116,  0, 98, 71, 80, 68,115,116,114,111,107,101,  0, 98,
+ 71, 80, 68,102,114, 97,109,101,  0, 98, 71, 80, 68,108, 97,121,101,114,  0, 82,101,112,111,114,116, 76,105,115,116,  0,119,109,
+ 87,105,110,100,111,119, 77, 97,110, 97,103,101,114,  0,119,109, 87,105,110,100,111,119,  0,119,109, 75,101,121, 67,111,110,102,
+105,103,  0,119,109, 69,118,101,110,116,  0,119,109, 83,117, 98, 87,105,110,100,111,119,  0,119,109, 71,101,115,116,117,114,101,
+  0,119,109, 75,101,121, 77, 97,112, 73,116,101,109,  0, 80,111,105,110,116,101,114, 82, 78, 65,  0,119,109, 75,101,121, 77, 97,
+112, 68,105,102,102, 73,116,101,109,  0,119,109, 75,101,121, 77, 97,112,  0,119,109, 79,112,101,114, 97,116,111,114, 84,121,112,
+101,  0, 70, 77,111,100,105,102,105,101,114,  0, 70, 77,111,100, 95, 71,101,110,101,114, 97,116,111,114,  0, 70, 77,111,100, 95,
+ 70,117,110, 99,116,105,111,110, 71,101,110,101,114, 97,116,111,114,  0, 70, 67, 77, 95, 69,110,118,101,108,111,112,101, 68, 97,
+116, 97,  0, 70, 77,111,100, 95, 69,110,118,101,108,111,112,101,  0, 70, 77,111,100, 95, 67,121, 99,108,101,115,  0, 70, 77,111,
+100, 95, 80,121,116,104,111,110,  0, 70, 77,111,100, 95, 76,105,109,105,116,115,  0, 70, 77,111,100, 95, 78,111,105,115,101,  0,
+ 70, 77,111,100, 95, 83,116,101,112,112,101,100,  0, 68,114,105,118,101,114, 84, 97,114,103,101,116,  0, 68,114,105,118,101,114,
+ 86, 97,114,  0, 67,104, 97,110,110,101,108, 68,114,105,118,101,114,  0, 70, 80,111,105,110,116,  0, 70, 67,117,114,118,101,  0,
+ 65,110,105,109, 77, 97,112, 80, 97,105,114,  0, 65,110,105,109, 77, 97,112,112,101,114,  0, 78,108, 97, 83,116,114,105,112,  0,
+ 78,108, 97, 84,114, 97, 99,107,  0, 75, 83, 95, 80, 97,116,104,  0, 75,101,121,105,110,103, 83,101,116,  0, 65,110,105,109, 79,
+118,101,114,114,105,100,101,  0, 73,100, 65,100,116, 84,101,109,112,108, 97,116,101,  0, 66,111,105,100, 82,117,108,101,  0, 66,
+111,105,100, 82,117,108,101, 71,111, 97,108, 65,118,111,105,100,  0, 66,111,105,100, 82,117,108,101, 65,118,111,105,100, 67,111,
+108,108,105,115,105,111,110,  0, 66,111,105,100, 82,117,108,101, 70,111,108,108,111,119, 76,101, 97,100,101,114,  0, 66,111,105,
+100, 82,117,108,101, 65,118,101,114, 97,103,101, 83,112,101,101,100,  0, 66,111,105,100, 82,117,108,101, 70,105,103,104,116,  0,
+ 66,111,105,100, 83,116, 97,116,101,  0, 70, 76, 85, 73, 68, 95, 51, 68,  0, 87, 84, 85, 82, 66, 85, 76, 69, 78, 67, 69,  0, 83,
+112,101, 97,107,101,114,  0, 77,111,118,105,101, 67,108,105,112, 80,114,111,120,121,  0, 77,111,118,105,101, 67,108,105,112, 67,
+ 97, 99,104,101,  0, 77,111,118,105,101, 84,114, 97, 99,107,105,110,103,  0, 77,111,118,105,101, 84,114, 97, 99,107,105,110,103,
+ 84,114, 97, 99,107,  0, 77,111,118,105,101, 84,114, 97, 99,107,105,110,103, 77, 97,114,107,101,114,  0, 77,111,118,105,101, 82,
+101, 99,111,110,115,116,114,117, 99,116,101,100, 67, 97,109,101,114, 97,  0, 77,111,118,105,101, 84,114, 97, 99,107,105,110,103,
+ 67, 97,109,101,114, 97,  0, 77,111,118,105,101, 84,114, 97, 99,107,105,110,103, 83,101,116,116,105,110,103,115,  0, 77,111,118,
+105,101, 84,114, 97, 99,107,105,110,103, 83,116, 97, 98,105,108,105,122, 97,116,105,111,110,  0, 77,111,118,105,101, 84,114, 97,
+ 99,107,105,110,103, 82,101, 99,111,110,115,116,114,117, 99,116,105,111,110,  0, 77,111,118,105,101, 84,114, 97, 99,107,105,110,
+103, 79, 98,106,101, 99,116,  0, 77,111,118,105,101, 84,114, 97, 99,107,105,110,103, 83,116, 97,116,115,  0, 68,121,110, 97,109,
+105, 99, 80, 97,105,110,116, 83,117,114,102, 97, 99,101,  0, 80, 97,105,110,116, 83,117,114,102, 97, 99,101, 68, 97,116, 97,  0,
+ 84, 76, 69, 78,  1,  0,  1,  0,  2,  0,  2,  0,  4,  0,  4,  0,  4,  0,  4,  0,  8,  0,  8,  0,  8,  0,  0,  0, 16,  0, 24,  0,
+ 16,  0,  4,  0,  8,  0, 12,  0, 16,  0, 16,  0, 32,  0,128,  0,120,  0,152,  8,  0,  0, 40,  0,144,  0,112,  5,112,  0, 36,  0,
+ 56,  0,160,  0,192,  0,224,  0, 96,  0, 40,  0, 48,  0,224,  0, 16,  0,200,  0, 40,  0,216, 11, 48,  5,  0,  0,  0,  0,  0,  0,
+ 56,  1,168,  1,216,  4, 24,  0,  8,  3,200,  0,  0,  0,104,  0, 64,  1, 56,  4, 80,  0, 24,  1,144,  0, 56,  3, 16,  2, 88,  0,
+ 16,  0,128,  3,152,  0,136,  4,  0,  0,104,  0,104,  0,  0,  1, 80,  0,  8,  0, 16,  0, 32,  0,  0,  0,  8,  2,  0,  0,  0,  0,
+  0,  0,232,  4,  8,  0, 12,  0, 16,  0,  8,  0, 12,  0,  4,  0, 20,  0, 48,  0, 64,  0, 20,  0, 12,  0, 16,  0,  4,  0,  8,  0,
+  0,  0,176,  0,144,  1,  8,  0,  4,  0,  4,  0,  0,  1, 32,  0,  8,  0, 24,  0, 16,  0, 64,  0, 24,  0, 12,  0, 64,  0,  4,  0,
+112,  0,200,  0,136,  0,192,  0,192,  0,128,  0,192,  0,192,  0,128,  0,120,  0,200,  0,120,  0,144,  0, 16,  1, 56,  0,192,  0,
+ 24,  1, 40,  1,120,  0,184,  0,200,  0, 64,  1,200,  0, 88,  1,112,  0,168,  0,  0,  0,152,  0, 48,  0, 40,  5,192,  0,  0,  0,
+152,  0,  0,  0,  0,  0,128,  0,  8,  0,  8,  0,112,  1,144,  0,152,  2,136,  0,192,  0,120,  0,128,  0,224,  4,208,  0,200,  0,
+112,  0,208,  0,144,  0, 16,  5,  0,  0,  0,  0, 48,  1,104,  1,160,  1,104,  1,136,  0,104,  0,112,  0,128,  0, 16,  0, 96,  1,
+ 88,  0,  0,  0,200,  0,216,  0,152,  0, 48,  0, 24,  0,120,  0,152,  0,216,  1,  0,  1,184,  0,  0,  0, 72,  0, 32,  0,176,  0,
+  0,  0, 16,  0,  0,  0,  0,  0,  0,  0, 12,  0, 24,  2, 40,  0,184,  0,152,  0, 64,  0, 72,  0, 32,  0,120,  0, 24,  0, 56,  9,
+ 64,  0, 24,  0, 16,  0, 56,  0,168,  0, 96,  0, 24,  0, 88,  6, 48,  0, 16,  0,168,  0, 96,  0, 24,  0, 56,  0,120,  0, 16,  0,
+232,  1, 32,  0,  8,  0, 24,  0, 80,  8,  0,  0,  0,  0,192,  8,104,  0,  8,  0,112,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+ 96,  1, 56,  0,144,  0, 64,  0,240,  0,112,  0,248,  0,240,  0,160,  7,104,  0,  0,  0,168,  0,  0,  0, 24,  1, 16,  0, 16,  0,
+ 40, 33,128, 16, 24, 16,216,  0,160,  2,168,  5, 64,  0, 24,  0,208,  0, 48,  1, 72,  0, 40,  0,136,  1,104,  0, 40,  1, 56,  0,
+ 24,  4, 32,  0,232,  0, 32,  0, 32,  0,  8,  0, 80,  3,224,  1, 16,  0,168, 36, 80,  0, 56,  0,112, 38,  8,  1, 32,  0, 40,  0,
+ 88,  1,  0,  0,  0,  0,160,  0,  0,  0, 40,  1,  0,  0, 48,  4,  8,  1, 16,  0,  8,  0, 44,  0, 16,  4, 72,  3,200,  4, 80,  1,
+208,  4, 32,  0, 12,  0, 24,  0, 32,  0, 16,  0, 24,  0, 24,  0, 32,  0,136,  1,  0,  0, 64,  0, 96,  0, 80,  0,  8,  0, 80,  0,
+136,  0,200,  0, 72,  0,  8,  0,136,  0, 76,  0, 72,  0,204,  0,136,  0,136,  0,128,  0,136,  0, 92,  0,128,  0, 80,  0,112,  0,
+ 16,  0,168,  0, 32,  0, 72,  0,120,  0, 24,  0,144,  0,112,  0,148,  0, 32,  0,128,  0, 88,  0, 88,  0,208,  0,140,  0,  4,  0,
+ 24,  0, 16,  0,  8,  0,160,  0, 48,  0, 40,  0, 72,  1,  0,  1, 16,  0, 32,  2,  4,  0, 40,  0,120,  0, 72,  1,120,  0, 56,  0,
+120,  0,160,  0,112,  0,184,  0, 24,  0, 88,  0, 80,  0, 80,  0, 80,  0,  8,  0, 72,  0,104,  0,104,  0, 80,  0, 80,  0, 24,  0,
+ 88,  0,104,  0, 16,  0,144,  0,128,  0, 88,  0, 28,  0, 28,  0, 28,  0, 88,  0, 24,  0,160,  0, 16,  0,152,  0, 72,  0,168,  0,
+ 48,  0,208,  0, 56,  0, 16,  0, 88,  1,  0,  0,  0,  0,  0,  0, 16,  0, 16,  0,  4,  0, 24,  0, 16,  0, 16,  0, 40,  0, 28,  0,
+ 12,  0, 12,  0, 32,  4, 40,  4, 32,  0, 44,  0, 24,  0,  8,  0,128,  0, 64,  0, 32,  0, 16,  0, 32,  0, 32,  0,  8,  0, 96,  0,
+ 20,  0,200,  3,216,  3,208,  3,200,  3,208,  3,208,  3,200,  3,208,  3,208,  3,208,  3,208,  3, 64,  0, 64,  0, 12,  0, 56,  0,
+ 24,  0,104,  0,  0,  4, 24,  0, 56,  0, 56,  0, 20,  0, 16,  0, 64,  0, 40,  0, 32,  0,192,  0, 60,  0, 16,  3,104,  0,  0,  0,
+  0,  0,  0,  0,  0,  0, 16,  0, 32,  0, 40,  0,192,  0, 40,  0, 88,  1,  0,  1,168,  0,  0,  0,  0,  0,  0,  0,184,  0,  0,  0,
+ 32,  0,136,  0,  0,  0,120,  0, 24,  0, 24,  0, 16,  0, 24,  0,  8,  0, 16,  0, 24,  0, 20,  0, 20,  0, 56,  0, 24,  2, 40,  1,
+ 16,  0,104,  0,  0,  1, 40,  0,208,  0,104,  0,112,  0,216,  1, 32,  0,128,  0, 56,  0, 80,  0, 64,  0,104,  0, 72,  0, 64,  0,
+128,  0,  0,  0,  0,  0,184,  0,  8,  3,  0,  0,248,  0,192,  0, 16,  0, 72,  0, 48,  0, 64,  0, 56,  0, 24,  0,128,  0,  0,  1,
+ 16,  6,  0,  0, 83, 84, 82, 67,207,  1,  0,  0, 12,  0,  2,  0, 12,  0,  0,  0, 12,  0,  1,  0, 13,  0,  3,  0, 13,  0,  0,  0,
+ 13,  0,  1,  0, 11,  0,  2,  0, 14,  0,  2,  0, 11,  0,  3,  0, 11,  0,  4,  0, 15,  0,  2,  0,  2,  0,  5,  0,  2,  0,  6,  0,
+ 16,  0,  2,  0,  7,  0,  5,  0,  7,  0,  6,  0, 17,  0,  3,  0,  7,  0,  5,  0,  7,  0,  6,  0,  7,  0,  7,  0, 18,  0,  4,  0,
+  4,  0,  8,  0,  4,  0,  9,  0,  4,  0, 10,  0,  4,  0, 11,  0, 19,  0,  4,  0,  7,  0,  8,  0,  7,  0,  9,  0,  7,  0, 10,  0,
+  7,  0, 11,  0, 20,  0,  4,  0, 11,  0, 12,  0, 14,  0, 13,  0,  4,  0, 14,  0,  4,  0, 15,  0, 21,  0, 10,  0, 21,  0,  0,  0,
+ 21,  0,  1,  0,  0,  0, 16,  0,  0,  0, 17,  0,  2,  0, 18,  0,  0,  0, 19,  0,  4,  0, 20,  0, 20,  0, 21,  0,  4,  0, 22,  0,
+  4,  0, 23,  0, 22,  0, 11,  0, 11,  0,  0,  0, 11,  0,  1,  0, 22,  0, 24,  0, 23,  0, 25,  0,  0,  0, 26,  0,  2,  0, 27,  0,
+  2,  0, 28,  0,  2,  0, 18,  0,  4,  0, 29,  0,  4,  0, 30,  0, 21,  0, 31,  0, 23,  0,  8,  0, 22,  0, 32,  0, 22,  0, 33,  0,
+ 24,  0, 34,  0,  0,  0, 35,  0,  0,  0, 36,  0,  4,  0, 37,  0,  4,  0, 27,  0, 23,  0, 38,  0, 25,  0,  5,  0,  4,  0, 39,  0,
+  4,  0, 40,  0,  2,  0, 41,  0,  2,  0, 42,  0,  4,  0, 43,  0, 26,  0,  6,  0, 27,  0, 44,  0,  2,  0, 45,  0,  2,  0, 46,  0,
+  2,  0, 16,  0,  2,  0, 18,  0,  0,  0, 47,  0, 28,  0, 21,  0, 28,  0,  0,  0, 28,  0,  1,  0, 29,  0, 48,  0, 30,  0, 49,  0,
+ 19,  0, 50,  0, 19,  0, 51,  0,  2,  0, 45,  0,  2,  0, 46,  0,  2,  0, 52,  0,  2,  0, 53,  0,  2,  0, 54,  0,  2,  0, 55,  0,
+  2,  0, 18,  0,  2,  0, 56,  0,  7,  0, 10,  0,  7,  0, 11,  0,  4,  0, 57,  0,  7,  0, 58,  0,  7,  0, 59,  0,  7,  0, 60,  0,
+ 26,  0, 61,  0, 31,  0,  7,  0, 22,  0, 32,  0, 14,  0, 62,  0, 19,  0, 63,  0,  2,  0, 45,  0,  2,  0, 64,  0,  2,  0, 65,  0,
+  2,  0, 27,  0, 32,  0, 16,  0, 32,  0,  0,  0, 32,  0,  1,  0,  7,  0, 66,  0,  7,  0, 60,  0,  2,  0, 16,  0,  2,  0, 67,  0,
+  2,  0, 68,  0,  2,  0, 18,  0,  4,  0, 69,  0,  4,  0, 70,  0, 11,  0,  2,  0,  7,  0, 71,  0,  0,  0, 19,  0,  0,  0, 72,  0,
+  7,  0, 73,  0,  7,  0, 74,  0, 33,  0, 15,  0, 22,  0, 32,  0, 34,  0, 75,  0, 32,  0, 76,  0,  0,  0, 77,  0,  4,  0, 78,  0,
+  4,  0, 27,  0, 14,  0, 79,  0, 31,  0, 80,  0, 22,  0, 81,  0,  2,  0, 16,  0,  2,  0, 82,  0,  2,  0, 83,  0,  2,  0, 18,  0,
+  7,  0, 84,  0,  4,  0, 85,  0, 35,  0,  6,  0, 35,  0,  0,  0, 35,  0,  1,  0,  0,  0, 86,  0,  0,  0, 87,  0,  4,  0, 22,  0,
+  4,  0, 88,  0, 36,  0, 10,  0, 36,  0,  0,  0, 36,  0,  1,  0,  4,  0, 89,  0,  4,  0, 90,  0,  4,  0, 91,  0,  4,  0, 67,  0,
+  4,  0, 13,  0,  4,  0, 92,  0,  0,  0, 93,  0,  0,  0, 94,  0, 37,  0, 15,  0, 22,  0, 32,  0,  0,  0, 95,  0,  4,  0, 92,  0,
+  4,  0, 96,  0, 14,  0, 97,  0, 35,  0, 98,  0, 35,  0, 99,  0,  4,  0,100,  0,  4,  0,101,  0, 14,  0,102,  0,  0,  0,103,  0,
+  4,  0,104,  0,  4,  0,105,  0, 11,  0,106,  0,  8,  0,107,  0, 38,  0,  3,  0,  4,  0,108,  0,  4,  0,109,  0, 11,  0,  2,  0,
+ 39,  0, 20,  0, 22,  0, 32,  0, 34,  0, 75,  0,  0,  0, 16,  0,  0,  0,110,  0,  2,  0, 18,  0,  7,  0,111,  0,  7,  0,112,  0,
+  7,  0,113,  0,  7,  0,114,  0,  7,  0,115,  0,  7,  0,116,  0,  7,  0,117,  0,  7,  0,118,  0,  7,  0,119,  0,  7,  0,120,  0,
+  7,  0,121,  0, 31,  0, 80,  0, 27,  0,122,  0,  0,  0,123,  0,  0,  0,124,  0, 40,  0, 14,  0, 41,  0,125,  0,  4,  0,126,  0,
+  4,  0,127,  0,  4,  0,128,  0,  4,  0,129,  0,  0,  0,130,  0,  0,  0,131,  0,  0,  0,132,  0,  0,  0, 27,  0,  2,  0,133,  0,
+  2,  0,134,  0,  2,  0,135,  0,  2,  0, 18,  0,  4,  0, 30,  0, 42,  0, 33,  0, 22,  0, 32,  0,  0,  0, 35,  0, 14,  0,136,  0,
+ 43,  0,137,  0, 44,  0,138,  0, 45,  0,139,  0, 45,  0,140,  0,  2,  0,141,  0,  2,  0,142,  0,  2,  0,132,  0,  2,  0, 18,  0,
+  2,  0,143,  0,  2,  0, 16,  0,  4,  0,144,  0,  2,  0,145,  0,  2,  0,146,  0,  2,  0,147,  0,  2,  0,148,  0,  2,  0,149,  0,
+  2,  0,150,  0,  4,  0,151,  0,  4,  0,152,  0, 38,  0,153,  0, 25,  0,154,  0,  7,  0,155,  0,  4,  0,156,  0,  2,  0,157,  0,
+  2,  0,158,  0,  2,  0,159,  0,  0,  0,160,  0,  0,  0,161,  0,  7,  0,162,  0,  7,  0,163,  0, 46,  0, 65,  0,  2,  0,164,  0,
+  2,  0,165,  0,  2,  0,166,  0,  2,  0,167,  0, 27,  0,168,  0, 47,  0,169,  0,  0,  0,170,  0,  0,  0,171,  0,  0,  0,172,  0,
+  0,  0,173,  0,  0,  0,174,  0,  7,  0,175,  0,  7,  0,176,  0,  7,  0,177,  0,  2,  0,178,  0,  2,  0,179,  0,  2,  0,180,  0,
+  2,  0,181,  0,  2,  0,182,  0,  2,  0,183,  0,  0,  0,184,  0,  0,  0,124,  0,  7,  0,185,  0,  7,  0,186,  0,  7,  0,187,  0,
+  7,  0,188,  0,  7,  0,189,  0,  7,  0, 56,  0,  7,  0,190,  0,  7,  0,191,  0,  7,  0,192,  0,  7,  0,193,  0,  7,  0,194,  0,
+  7,  0,195,  0,  7,  0,196,  0,  7,  0,197,  0,  7,  0,198,  0,  7,  0,199,  0,  7,  0,200,  0,  7,  0,201,  0,  7,  0,202,  0,
+  7,  0,203,  0,  7,  0,204,  0,  7,  0,205,  0,  7,  0,206,  0,  7,  0,207,  0,  7,  0,208,  0,  7,  0,209,  0,  7,  0,210,  0,
+  7,  0,211,  0,  7,  0,212,  0,  7,  0,213,  0,  7,  0,214,  0,  7,  0,215,  0,  7,  0,216,  0,  7,  0,217,  0,  7,  0,218,  0,
+  7,  0,219,  0,  7,  0,220,  0,  7,  0,221,  0,  7,  0,222,  0,  7,  0,223,  0,  7,  0,224,  0,  7,  0,225,  0,  7,  0,226,  0,
+ 48,  0, 15,  0,  0,  0, 35,  0, 11,  0,227,  0,  0,  0,228,  0,  0,  0,229,  0,  4,  0,230,  0,  4,  0,231,  0, 11,  0,232,  0,
+  7,  0,233,  0,  7,  0,234,  0,  7,  0,235,  0,  4,  0,236,  0, 11,  0,237,  0, 11,  0,238,  0,  4,  0,239,  0,  4,  0, 27,  0,
+ 49,  0,  6,  0,  7,  0,185,  0,  7,  0,186,  0,  7,  0,187,  0,  7,  0,240,  0,  7,  0, 66,  0,  4,  0, 63,  0, 50,  0,  5,  0,
+  2,  0, 18,  0,  2,  0, 37,  0,  2,  0, 63,  0,  2,  0,241,  0, 49,  0,235,  0, 51,  0, 17,  0, 27,  0,168,  0, 42,  0,242,  0,
+ 52,  0,243,  0,  7,  0,244,  0,  7,  0,245,  0,  2,  0, 16,  0,  2,  0,246,  0,  7,  0,112,  0,  7,  0,113,  0,  7,  0,247,  0,
+  4,  0,248,  0,  2,  0,249,  0,  2,  0,250,  0,  4,  0,132,  0,  4,  0,144,  0,  2,  0,251,  0,  2,  0,252,  0, 53,  0, 25,  0,
+  2,  0, 18,  0,  2,  0,253,  0,  7,  0,254,  0,  7,  0,255,  0,  2,  0,143,  0,  2,  0,  0,  1,  4,  0,  1,  1,  4,  0,  2,  1,
+ 27,  0,168,  0,  4,  0,  3,  1,  2,  0,  4,  1,  2,  0,  5,  1, 11,  0,  6,  1,  7,  0,  7,  1,  7,  0,  8,  1,  2,  0,  9,  1,
+  2,  0, 10,  1,  2,  0, 11,  1,  2,  0, 12,  1,  7,  0, 13,  1,  7,  0, 14,  1,  7,  0, 15,  1,  7,  0, 16,  1, 50,  0, 17,  1,
+ 54,  0, 18,  1, 55,  0, 13,  0,  4,  0, 19,  1,  4,  0, 20,  1,  2,  0, 21,  1,  2,  0, 18,  0,  2,  0, 22,  1,  2,  0, 23,  1,
+ 27,  0,168,  0,  7,  0, 24,  1,  4,  0, 25,  1,  0,  0, 26,  1,  7,  0, 27,  1,  4,  0, 28,  1,  4,  0,132,  0, 56,  0,  4,  0,
+ 27,  0,168,  0,  0,  0, 29,  1,  4,  0, 30,  1,  4,  0, 27,  0, 47,  0, 64,  0, 22,  0, 32,  0, 34,  0, 75,  0,  7,  0, 31,  1,
+  7,  0, 32,  1,  7,  0, 33,  1,  7,  0, 34,  1,  7,  0, 35,  1,  7,  0, 36,  1,  7,  0, 37,  1,  7,  0, 38,  1,  7,  0, 39,  1,
+  7,  0, 30,  0,  7,  0, 40,  1,  7,  0, 41,  1,  7,  0, 42,  1,  7,  0, 43,  1,  7,  0, 44,  1,  7,  0, 45,  1,  7,  0, 46,  1,
+  7,  0, 47,  1,  7,  0, 48,  1,  7,  0, 49,  1,  7,  0, 50,  1,  7,  0, 51,  1,  2,  0, 52,  1,  2,  0, 53,  1,  2,  0, 54,  1,
+  2,  0, 55,  1,  2,  0, 56,  1,  2,  0, 57,  1,  2,  0, 58,  1,  2,  0, 18,  0,  2,  0, 16,  0,  2,  0,246,  0,  7,  0, 59,  1,
+  7,  0, 60,  1,  7,  0, 61,  1,  7,  0, 62,  1,  4,  0, 63,  1,  4,  0, 64,  1,  2,  0, 65,  1,  2,  0, 66,  1,  2,  0, 22,  1,
+  2,  0,130,  0,  4,  0, 22,  0,  4,  0,127,  0,  4,  0,128,  0,  4,  0,129,  0,  7,  0, 67,  1,  7,  0, 68,  1,  7,  0, 67,  0,
+ 40,  0, 69,  1, 57,  0, 70,  1, 31,  0, 80,  0, 42,  0,242,  0, 48,  0, 71,  1, 50,  0, 17,  1, 51,  0, 72,  1, 25,  0,154,  0,
+ 53,  0, 73,  1, 55,  0, 74,  1, 56,  0, 75,  1,  0,  0, 76,  1,  0,  0,124,  0, 58,  0, 13,  0,  7,  0, 77,  1,  7,  0, 78,  1,
+  7,  0,176,  0,  4,  0, 18,  0,  0,  0,171,  0,  0,  0,172,  0,  0,  0,173,  0,  0,  0,174,  0,  4,  0, 27,  0,  7,  0, 79,  1,
+  7,  0, 80,  1,  7,  0, 81,  1, 27,  0, 44,  0, 59,  0,  9,  0, 50,  0, 82,  1,  7,  0, 33,  1,  7,  0, 34,  1,  7,  0, 35,  1,
+  4,  0, 18,  0,  7,  0, 83,  1,  7,  0, 84,  1,  4,  0, 85,  1,  4,  0, 86,  1, 60,  0, 74,  0, 22,  0, 32,  0, 34,  0, 75,  0,
+  2,  0, 16,  0,  2,  0, 18,  0,  4,  0, 87,  1,  2,  0,179,  0,  2,  0, 88,  1,  7,  0,185,  0,  7,  0,186,  0,  7,  0,187,  0,
+  7,  0,188,  0,  7,  0, 89,  1,  7,  0, 90,  1,  7,  0, 91,  1,  7,  0, 92,  1,  7,  0, 93,  1,  7,  0, 94,  1,  7,  0, 95,  1,
+  7,  0, 96,  1,  7,  0, 97,  1,  7,  0, 98,  1,  7,  0, 99,  1, 54,  0,100,  1,  2,  0,253,  0,  2,  0, 30,  0,  7,  0,112,  0,
+  7,  0,113,  0,  7,  0,101,  1,  7,  0,102,  1,  7,  0,103,  1,  7,  0,104,  1,  7,  0,105,  1,  2,  0,106,  1,  2,  0,107,  1,
+  2,  0,108,  1,  2,  0,109,  1,  0,  0,110,  1,  0,  0,111,  1,  2,  0,112,  1,  2,  0,113,  1,  2,  0,114,  1,  2,  0,115,  1,
+  2,  0,116,  1,  7,  0,117,  1,  7,  0,118,  1,  7,  0,119,  1,  7,  0,120,  1,  2,  0,121,  1,  2,  0, 67,  0,  2,  0,122,  1,
+  2,  0,123,  1,  2,  0,124,  1,  2,  0,125,  1,  7,  0,126,  1,  7,  0,127,  1,  7,  0,128,  1,  7,  0,129,  1,  7,  0,130,  1,
+  7,  0,131,  1,  7,  0,132,  1,  7,  0,133,  1,  7,  0,134,  1,  7,  0,135,  1,  7,  0,136,  1,  7,  0,137,  1,  2,  0,138,  1,
+  0,  0,139,  1, 31,  0, 80,  0, 46,  0,140,  1,  2,  0,141,  1,  2,  0, 76,  1,  0,  0,142,  1, 25,  0,154,  0, 57,  0, 70,  1,
+ 61,  0, 18,  0,  7,  0,143,  1,  7,  0,144,  1,  7,  0,145,  1,  7,  0,146,  1,  7,  0,147,  1,  7,  0,148,  1,  7,  0,149,  1,
+  7,  0,150,  1,  7,  0,151,  1,  7,  0,152,  1,  2,  0,153,  1,  2,  0,154,  1,  2,  0,155,  1,  2,  0,156,  1,  7,  0,157,  1,
+  7,  0,158,  1,  7,  0,159,  1,  7,  0,160,  1, 62,  0,  4,  0,  4,  0, 18,  0,  4,  0,161,  1,  4,  0,162,  1,  4,  0, 67,  0,
+ 63,  0,126,  0, 22,  0, 32,  0, 34,  0, 75,  0,  2,  0,163,  1,  2,  0, 18,  0,  7,  0,185,  0,  7,  0,186,  0,  7,  0,187,  0,
+  7,  0,164,  1,  7,  0,165,  1,  7,  0,166,  1,  7,  0,167,  1,  7,  0,168,  1,  7,  0,169,  1,  7,  0,170,  1,  7,  0,171,  1,
+  7,  0,172,  1,  7,  0,173,  1,  7,  0,174,  1,  7,  0,175,  1,  7,  0,176,  1,  7,  0,177,  1,  7,  0,178,  1,  7,  0,179,  1,
+  7,  0,180,  1,  7,  0,181,  1,  7,  0,182,  1,  7,  0,183,  1, 61,  0,184,  1, 62,  0,185,  1,  7,  0,186,  1,  7,  0,187,  1,
+  7,  0,188,  1,  7,  0,189,  1,  7,  0,190,  1,  7,  0,191,  1,  7,  0,192,  1,  2,  0,193,  1,  2,  0,194,  1,  2,  0,195,  1,
+  0,  0,196,  1,  0,  0,197,  1,  7,  0,198,  1,  7,  0,199,  1,  2,  0,200,  1,  2,  0,201,  1,  7,  0,202,  1,  7,  0,203,  1,
+  7,  0,204,  1,  7,  0,205,  1,  2,  0,206,  1,  2,  0,207,  1,  4,  0, 87,  1,  4,  0,208,  1,  2,  0,209,  1,  2,  0,210,  1,
+  2,  0,211,  1,  2,  0,212,  1,  7,  0,213,  1,  7,  0,214,  1,  7,  0,215,  1,  7,  0,216,  1,  7,  0,217,  1,  7,  0,218,  1,
+  7,  0,219,  1,  7,  0,220,  1,  7,  0,221,  1,  7,  0,222,  1,  0,  0,223,  1,  7,  0,224,  1,  7,  0,225,  1,  7,  0,226,  1,
+  4,  0,227,  1,  0,  0,228,  1,  0,  0,122,  1,  0,  0,229,  1,  0,  0, 76,  1,  2,  0,230,  1,  2,  0,231,  1,  2,  0,141,  1,
+  2,  0,232,  1,  2,  0,233,  1,  2,  0,234,  1,  7,  0,235,  1,  7,  0,236,  1,  7,  0,237,  1,  7,  0,238,  1,  7,  0,239,  1,
+  2,  0,164,  0,  2,  0,165,  0, 50,  0,240,  1, 50,  0,241,  1,  0,  0,242,  1,  0,  0,243,  1,  0,  0,244,  1,  0,  0,245,  1,
+  2,  0,246,  1,  2,  0,247,  1,  7,  0,248,  1,  7,  0,249,  1, 46,  0,140,  1, 57,  0, 70,  1, 31,  0, 80,  0, 64,  0,250,  1,
+ 25,  0,154,  0,  7,  0,251,  1,  7,  0,252,  1,  7,  0,253,  1,  7,  0,254,  1,  7,  0,255,  1,  2,  0,  0,  2,  2,  0, 30,  0,
+  7,  0,  1,  2,  7,  0,  2,  2,  7,  0,  3,  2,  7,  0,  4,  2,  7,  0,  5,  2,  7,  0,  6,  2,  7,  0,  7,  2,  7,  0,  8,  2,
+  7,  0,  9,  2,  2,  0, 10,  2,  2,  0, 11,  2,  4,  0, 12,  2,  2,  0, 13,  2,  2,  0, 14,  2, 14,  0, 15,  2, 65,  0,  4,  0,
+ 22,  0, 32,  0,  0,  0, 35,  0, 66,  0,  2,  0, 38,  0,153,  0, 67,  0, 20,  0, 67,  0,  0,  0, 67,  0,  1,  0, 68,  0, 16,  2,
+  2,  0, 16,  0,  2,  0, 18,  0,  2,  0, 17,  2,  2,  0, 18,  2,  7,  0,  5,  0,  7,  0,  6,  0,  7,  0,  7,  0,  7,  0, 19,  2,
+  7,  0, 20,  2,  7,  0, 21,  2,  7,  0, 22,  2,  7,  0, 23,  2,  7,  0, 24,  2,  7,  0, 25,  2,  7,  0, 22,  0,  7,  0, 26,  2,
+  7,  0, 27,  2, 69,  0, 20,  0, 22,  0, 32,  0, 34,  0, 75,  0, 68,  0, 16,  2, 14,  0, 28,  2, 14,  0, 29,  2, 14,  0, 30,  2,
+ 31,  0, 80,  0, 63,  0, 31,  2,  0,  0, 18,  0,  0,  0, 32,  2,  2,  0, 33,  2,  2,  0,178,  0,  2,  0, 27,  0,  7,  0, 77,  1,
+  7,  0,176,  0,  7,  0, 78,  1,  7,  0, 34,  2,  7,  0, 35,  2,  7,  0, 36,  2, 67,  0, 37,  2, 30,  0, 11,  0,  7,  0, 38,  2,
+  7,  0, 39,  2,  7,  0, 40,  2,  7,  0,255,  0,  2,  0, 54,  0,  0,  0, 41,  2,  0,  0, 42,  2,  0,  0, 43,  2,  0,  0, 44,  2,
+  0,  0, 45,  2,  0,  0, 46,  2, 29,  0,  7,  0,  7,  0, 47,  2,  7,  0, 39,  2,  7,  0, 40,  2,  2,  0, 43,  2,  2,  0, 46,  2,
+  7,  0,255,  0,  7,  0, 27,  0, 70,  0, 21,  0, 70,  0,  0,  0, 70,  0,  1,  0,  2,  0, 16,  0,  2,  0, 48,  2,  2,  0, 46,  2,
+  2,  0, 18,  0,  2,  0, 49,  2,  2,  0, 50,  2,  2,  0, 51,  2,  2,  0, 52,  2,  2,  0, 53,  2,  2,  0, 54,  2,  2,  0, 55,  2,
+  2,  0, 56,  2,  7,  0, 57,  2,  7,  0, 58,  2, 29,  0, 48,  0, 30,  0, 49,  0,  2,  0, 59,  2,  2,  0, 60,  2,  4,  0, 61,  2,
+ 71,  0,  5,  0,  2,  0, 62,  2,  2,  0, 48,  2,  0,  0, 18,  0,  0,  0, 27,  0,  2,  0, 30,  0, 72,  0,  4,  0,  7,  0,  5,  0,
+  7,  0,  6,  0,  7,  0, 63,  2,  7,  0, 64,  2, 73,  0,  4,  0, 14,  0, 65,  2, 74,  0, 66,  2,  4,  0, 67,  2,  0,  0, 94,  0,
+ 75,  0, 68,  0, 22,  0, 32,  0, 34,  0, 75,  0, 68,  0, 16,  2, 14,  0, 68,  2, 14,  0, 29,  2, 73,  0, 69,  2, 27,  0, 70,  2,
+ 27,  0, 71,  2, 27,  0, 72,  2, 31,  0, 80,  0, 76,  0, 73,  2, 33,  0, 74,  2, 63,  0, 31,  2, 14,  0, 75,  2,  7,  0, 77,  1,
+  7,  0,176,  0,  7,  0, 78,  1,  2,  0, 16,  0,  2,  0,178,  0,  2,  0, 76,  2,  2,  0, 77,  2,  7,  0, 78,  2,  7,  0, 79,  2,
+  4,  0, 80,  2,  2,  0, 27,  0,  2,  0, 33,  2,  2,  0, 18,  0,  2,  0, 81,  2,  7,  0, 82,  2,  7,  0, 83,  2,  7,  0, 84,  2,
+  2,  0, 51,  2,  2,  0, 52,  2,  2,  0, 85,  2,  2,  0, 86,  2,  4,  0, 87,  2, 11,  0, 88,  2,  2,  0, 22,  0,  2,  0, 97,  0,
+  2,  0, 66,  0,  2,  0, 89,  2,  7,  0, 90,  2,  7,  0, 91,  2,  7,  0, 92,  2,  7,  0, 93,  2,  7,  0, 94,  2,  7,  0, 95,  2,
+  7,  0, 96,  2,  7,  0, 97,  2,  7,  0, 98,  2,  7,  0, 99,  2,  0,  0,100,  2, 77,  0,101,  2, 78,  0,102,  2,  0,  0,103,  2,
+ 65,  0,104,  2, 65,  0,105,  2, 65,  0,106,  2, 65,  0,107,  2,  4,  0,108,  2,  7,  0, 84,  0,  4,  0,109,  2,  4,  0,110,  2,
+ 72,  0,111,  2,  4,  0,112,  2,  4,  0,113,  2, 71,  0,114,  2, 71,  0,115,  2, 79,  0, 47,  0, 22,  0, 32,  0, 34,  0, 75,  0,
+ 68,  0, 16,  2, 31,  0, 80,  0, 33,  0, 74,  2, 63,  0, 31,  2, 80,  0,116,  2, 81,  0,117,  2, 82,  0,118,  2, 83,  0,119,  2,
+ 84,  0,120,  2, 85,  0,121,  2, 86,  0,122,  2, 87,  0,123,  2, 88,  0,124,  2, 89,  0,125,  2, 90,  0,126,  2, 91,  0,127,  2,
+ 92,  0,128,  2, 93,  0,129,  2, 79,  0,130,  2, 94,  0,131,  2, 95,  0,132,  2, 95,  0,133,  2, 95,  0,134,  2, 95,  0,135,  2,
+ 95,  0,136,  2,  4,  0, 53,  0,  4,  0,137,  2,  4,  0,138,  2,  4,  0,139,  2,  4,  0,140,  2,  4,  0,141,  2,  4,  0,142,  2,
+  7,  0, 77,  1,  7,  0,176,  0,  7,  0, 78,  1,  2,  0,178,  0,  2,  0, 76,  2,  2,  0,143,  2,  2,  0, 18,  0,  2,  0,144,  2,
+  2,  0,145,  2,  0,  0,146,  2,  0,  0,147,  2,  2,  0, 33,  2, 96,  0,148,  2, 88,  0,  8,  0, 11,  0,149,  2,  7,  0,150,  2,
+  4,  0,151,  2,  0,  0, 18,  0,  0,  0,152,  2,  2,  0, 87,  1,  2,  0,153,  2,  2,  0,154,  2, 86,  0,  7,  0,  4,  0,155,  2,
+  4,  0,156,  2,  4,  0,157,  2,  4,  0,158,  2,  2,  0, 48,  2,  0,  0,159,  2,  0,  0, 18,  0, 90,  0,  5,  0,  4,  0,155,  2,
+  4,  0,156,  2,  0,  0,160,  2,  0,  0,161,  2,  2,  0, 18,  0, 97,  0,  2,  0,  4,  0,162,  2,  7,  0, 40,  2, 91,  0,  3,  0,
+ 97,  0,163,  2,  4,  0,164,  2,  4,  0, 18,  0, 89,  0,  4,  0,  7,  0,165,  2,  2,  0,166,  2,  0,  0, 18,  0,  0,  0,161,  2,
+ 92,  0,  4,  0,  0,  0,240,  0,  0,  0,185,  0,  0,  0,186,  0,  0,  0,187,  0, 81,  0,  5,  0,  4,  0,167,  2,  4,  0,141,  2,
+  2,  0, 48,  2,  0,  0, 18,  0,  0,  0, 27,  0, 83,  0,  2,  0,  4,  0,168,  2,  4,  0,169,  2, 82,  0,  6,  0, 42,  0,149,  2,
+  0,  0, 18,  0,  0,  0,152,  2,  2,  0, 87,  1,  2,  0,153,  2,  2,  0,154,  2, 84,  0,  2,  0,  7,  0,170,  2,  4,  0, 18,  0,
+ 85,  0,  4,  0,  0,  0,185,  0,  0,  0,186,  0,  0,  0,187,  0,  0,  0,240,  0, 93,  0,  1,  0,  7,  0,171,  2, 80,  0,  2,  0,
+  4,  0, 14,  2,  4,  0, 16,  0, 87,  0,  7,  0,  7,  0,150,  2, 42,  0,149,  2,  0,  0, 18,  0,  0,  0,152,  2,  2,  0, 87,  1,
+  2,  0,153,  2,  2,  0,154,  2, 98,  0,  1,  0,  7,  0,172,  2, 99,  0,  1,  0,  4,  0,173,  2,100,  0,  1,  0,  0,  0,174,  2,
+101,  0,  1,  0,  7,  0,150,  2,102,  0,  1,  0,  7,  0,170,  2,103,  0,  4,  0,  4,  0,175,  2,  4,  0,176,  2,  7,  0,177,  2,
+  4,  0,178,  2,104,  0,  4,  0,  7,  0,240,  0,  7,  0,185,  0,  7,  0,186,  0,  7,  0,187,  0,105,  0,  1,  0,104,  0,151,  2,
+106,  0,  5,  0,  4,  0,179,  2,  4,  0,180,  2,  0,  0, 18,  0,  0,  0, 48,  2,  0,  0,181,  2,107,  0,  2,  0,  4,  0,182,  2,
+  4,  0,180,  2,108,  0, 10,  0,108,  0,  0,  0,108,  0,  1,  0,106,  0,183,  2,105,  0,184,  2,107,  0,185,  2,  4,  0, 53,  0,
+  4,  0,138,  2,  4,  0,137,  2,  4,  0, 27,  0, 89,  0,186,  2, 96,  0, 14,  0, 14,  0,187,  2, 89,  0,186,  2,  0,  0,188,  2,
+  0,  0,189,  2,  0,  0,190,  2,  0,  0,191,  2,  0,  0,192,  2,  0,  0,193,  2,  0,  0,194,  2,  0,  0, 18,  0, 95,  0,132,  2,
+ 95,  0,134,  2,  2,  0,195,  2,  0,  0,196,  2,109,  0,  1,  0,  4,  0,173,  2,110,  0,  9,  0,110,  0,  0,  0,110,  0,  1,  0,
+  4,  0, 16,  0,  4,  0, 87,  1,  4,  0,197,  2,  4,  0, 27,  0,  0,  0, 19,  0, 41,  0,125,  0,  0,  0,198,  2,111,  0,  6,  0,
+110,  0,199,  2, 47,  0,200,  2, 27,  0,201,  2,  0,  0,202,  2,  4,  0,203,  2,  4,  0,204,  2,112,  0,  7,  0,110,  0,199,  2,
+  2,  0,205,  2,  2,  0,187,  2,  2,  0,206,  2,  2,  0, 92,  0, 11,  0,207,  2, 11,  0,208,  2,113,  0,  5,  0,110,  0,199,  2,
+ 27,  0,168,  0,  0,  0, 19,  0,  7,  0,209,  2,  0,  0, 94,  0,114,  0,  5,  0,110,  0,199,  2, 27,  0,168,  0,  0,  0, 19,  0,
+  2,  0,210,  2,  0,  0,211,  2,115,  0,  5,  0,110,  0,199,  2,  7,  0, 90,  0,  7,  0,212,  2,  4,  0,213,  2,  4,  0,214,  2,
+116,  0,  5,  0,110,  0,199,  2, 27,  0,215,  2,  0,  0, 72,  0,  4,  0, 87,  1,  4,  0, 18,  0,117,  0, 13,  0,110,  0,199,  2,
+ 27,  0,216,  2, 27,  0,217,  2, 27,  0,218,  2, 27,  0,219,  2,  7,  0,220,  2,  7,  0,221,  2,  7,  0,212,  2,  7,  0,222,  2,
+  4,  0,223,  2,  4,  0,224,  2,  4,  0, 92,  0,  4,  0,225,  2,118,  0,  5,  0,110,  0,199,  2,  2,  0,226,  2,  2,  0, 18,  0,
+  7,  0,227,  2, 27,  0,228,  2,119,  0,  3,  0,110,  0,199,  2,  7,  0,229,  2,  4,  0, 92,  0,120,  0, 10,  0,110,  0,199,  2,
+  7,  0,230,  2,  4,  0,231,  2,  4,  0, 27,  0,  2,  0, 92,  0,  2,  0,232,  2,  2,  0,233,  2,  2,  0,234,  2,  7,  0,235,  2,
+  0,  0,236,  2,121,  0,  3,  0,110,  0,199,  2,  7,  0, 27,  0,  4,  0, 16,  0,122,  0,  6,  0,110,  0,199,  2,123,  0,237,  2,
+124,  0,238,  2,125,  0,239,  2,  7,  0,240,  2,  4,  0, 16,  0,126,  0, 11,  0,110,  0,199,  2, 47,  0,200,  2, 27,  0,201,  2,
+  0,  0,202,  2,  4,  0,203,  2,  4,  0,204,  2,  7,  0,209,  2,  4,  0,241,  2,  0,  0,236,  2,  7,  0,242,  2,  4,  0, 27,  0,
+127,  0, 12,  0,110,  0,199,  2, 27,  0,243,  2, 42,  0,244,  2,  4,  0, 92,  0,  4,  0,245,  2,  7,  0,246,  2,  7,  0,247,  2,
+  7,  0,248,  2,  7,  0,249,  2,  0,  0,202,  2,  4,  0,203,  2,  4,  0, 27,  0,128,  0,  3,  0,110,  0,199,  2,  7,  0,250,  2,
+  4,  0,251,  2,129,  0,  5,  0,110,  0,199,  2,  7,  0,252,  2,  0,  0,236,  2,  2,  0, 18,  0,  2,  0,253,  2,130,  0,  8,  0,
+110,  0,199,  2, 27,  0,168,  0,  7,  0,252,  2,  7,  0,255,  0,  7,  0,108,  0,  0,  0,236,  2,  2,  0, 18,  0,  2,  0, 16,  0,
+131,  0, 21,  0,110,  0,199,  2, 47,  0,200,  2, 27,  0,201,  2,  0,  0,202,  2,  4,  0,203,  2,  4,  0,204,  2, 27,  0,254,  2,
+  0,  0,236,  2,  2,  0, 18,  0,  2,  0, 27,  0,  7,  0,255,  2,  7,  0,  0,  3,  7,  0,  1,  3,  7,  0, 82,  2,  7,  0,  2,  3,
+  7,  0,  3,  3,  7,  0,  4,  3,  7,  0,  5,  3,  7,  0,  6,  3,  7,  0,  7,  3,  7,  0, 67,  0,132,  0,  7,  0,110,  0,199,  2,
+  2,  0,  8,  3,  2,  0,  9,  3,  4,  0, 30,  0, 27,  0,168,  0,  7,  0, 10,  3,  0,  0,236,  2,133,  0, 10,  0,110,  0,199,  2,
+ 27,  0,168,  0,  0,  0, 11,  3,  7,  0, 12,  3,  7,  0, 13,  3,  7,  0,  5,  3,  4,  0, 14,  3,  4,  0, 15,  3,  7,  0, 16,  3,
+  0,  0, 19,  0,134,  0,  1,  0,110,  0,199,  2,135,  0,  7,  0,110,  0,199,  2, 41,  0,125,  0,136,  0, 17,  3,137,  0, 18,  3,
+138,  0, 19,  3,139,  0, 20,  3, 14,  0, 21,  3,140,  0, 13,  0,110,  0,199,  2, 89,  0, 22,  3, 89,  0, 23,  3, 89,  0, 24,  3,
+ 89,  0, 25,  3, 89,  0, 26,  3, 89,  0, 27,  3, 86,  0, 28,  3,  4,  0, 29,  3,  4,  0, 30,  3,  7,  0, 31,  3,  7,  0, 32,  3,
+141,  0, 33,  3,142,  0,  7,  0,110,  0,199,  2, 89,  0, 22,  3, 89,  0, 34,  3,143,  0, 35,  3,144,  0, 33,  3,  4,  0, 36,  3,
+  4,  0, 29,  3,145,  0,  4,  0,110,  0,199,  2, 27,  0,168,  0,  4,  0, 37,  3,  4,  0, 27,  0,146,  0,  2,  0,  4,  0, 38,  3,
+  7,  0, 40,  2,147,  0,  2,  0,  4,  0,128,  0,  4,  0, 39,  3,148,  0, 24,  0,110,  0,199,  2, 27,  0,168,  0,  0,  0,236,  2,
+  2,  0, 40,  3,  2,  0, 18,  0,  2,  0, 87,  1,  2,  0, 27,  0,146,  0, 41,  3,  4,  0, 42,  3,  7,  0, 43,  3,  4,  0, 53,  0,
+  4,  0, 44,  3,147,  0, 45,  3,146,  0, 46,  3,  4,  0, 47,  3,  4,  0, 48,  3,  4,  0, 49,  3,  4,  0, 39,  3,  7,  0, 50,  3,
+  7,  0, 51,  3,  7,  0, 52,  3,  7,  0, 53,  3,  7,  0, 54,  3, 11,  0, 55,  3,149,  0,  8,  0,110,  0,199,  2,150,  0, 56,  3,
+143,  0, 35,  3,  4,  0, 57,  3,  4,  0, 58,  3,  4,  0, 59,  3,  2,  0, 18,  0,  2,  0, 56,  0,151,  0,  8,  0,110,  0,199,  2,
+ 27,  0, 44,  0,  2,  0,  3,  1,  2,  0, 18,  0,  2,  0,226,  2,  2,  0, 56,  0,  7,  0, 60,  3,  7,  0, 61,  3,152,  0,  6,  0,
+110,  0,199,  2,  4,  0, 62,  3,  2,  0, 18,  0,  2,  0, 63,  3,  7,  0, 64,  3,  0,  0,170,  0,153,  0,  8,  0,110,  0,199,  2,
+  0,  0, 65,  3,  0,  0, 66,  3,  0,  0,193,  2,  0,  0, 67,  3,  0,  0, 68,  3,  0,  0, 92,  0,  0,  0,181,  2,154,  0,  3,  0,
+110,  0,199,  2,155,  0, 69,  3,139,  0, 20,  3,156,  0, 10,  0,110,  0,199,  2, 27,  0, 70,  3, 27,  0, 71,  3,  0,  0, 72,  3,
+  7,  0, 73,  3,  2,  0, 74,  3,  2,  0, 75,  3,  0,  0, 76,  3,  0,  0, 77,  3,  0,  0,211,  2,157,  0,  9,  0,110,  0,199,  2,
+ 27,  0, 78,  3,  0,  0, 72,  3,  7,  0, 79,  3,  7,  0, 80,  3,  0,  0, 87,  1,  0,  0,226,  2,  0,  0, 81,  3,  0,  0, 27,  0,
+158,  0,  1,  0,110,  0,199,  2,159,  0, 11,  0,110,  0,199,  2,  0,  0,236,  2,  7,  0,128,  0,  7,  0, 82,  3,  7,  0, 83,  3,
+  7,  0, 84,  3,  7,  0, 85,  3,  7,  0, 86,  3,  4,  0, 18,  0,  2,  0, 87,  3,  2,  0, 88,  3,160,  0,  9,  0,110,  0,199,  2,
+ 27,  0, 89,  3,  4,  0, 90,  3,  4,  0, 91,  3,  4,  0, 92,  3,  7,  0, 93,  3,  7,  0, 94,  3,  2,  0,226,  2,  2,  0, 18,  0,
+161,  0, 29,  0,110,  0,199,  2,162,  0, 95,  3,163,  0, 96,  3,  4,  0, 97,  3,  4,  0, 98,  3,  7,  0, 99,  3,  7,  0,  4,  3,
+  7,  0,100,  3,  7,  0,250,  0,  7,  0,101,  3,  7,  0,102,  3,  7,  0,103,  3,  7,  0,104,  3,  7,  0,105,  3,  7,  0,240,  2,
+  4,  0,106,  3,  4,  0,107,  3,  0,  0,108,  3,  0,  0,109,  3,  0,  0,110,  3,  0,  0,111,  3,  0,  0, 18,  0,  0,  0,112,  3,
+  2,  0,113,  3,  2,  0,114,  3,  4,  0,214,  2,  7,  0,108,  0,  7,  0,115,  3,  4,  0, 27,  0,164,  0, 15,  0,110,  0,199,  2,
+ 47,  0,200,  2, 27,  0,201,  2,  0,  0,202,  2,  4,  0,203,  2,  4,  0,204,  2, 27,  0,116,  3, 27,  0,117,  3, 54,  0,100,  1,
+  0,  0,236,  2,  7,  0,209,  2,  7,  0,118,  3,  0,  0, 18,  0,  0,  0,253,  0,  0,  0,211,  2,165,  0, 16,  0,110,  0,199,  2,
+  0,  0,236,  2,  2,  0,119,  3,  2,  0,253,  0,  7,  0,120,  3, 54,  0,121,  3,  7,  0,122,  3,  7,  0,123,  3,  7,  0,124,  3,
+  0,  0,125,  3,  4,  0,126,  3, 47,  0,127,  3, 27,  0,128,  3,  4,  0,129,  3,  0,  0,130,  3,  4,  0,131,  3,166,  0, 16,  0,
+110,  0,199,  2,  0,  0,132,  3,  0,  0,133,  3,  7,  0,134,  3,  7,  0,135,  3,  0,  0,136,  3,  0,  0,137,  3,  0,  0,138,  3,
+  7,  0,124,  3,  0,  0,125,  3,  4,  0,126,  3, 47,  0,127,  3, 27,  0,128,  3,  4,  0,129,  3,  0,  0,130,  3,  4,  0,131,  3,
+167,  0, 16,  0,110,  0,199,  2,  0,  0,236,  2,  4,  0,139,  3,  4,  0,140,  3, 27,  0,141,  3,  7,  0,124,  3,  0,  0,125,  3,
+  4,  0,126,  3, 47,  0,127,  3, 27,  0,128,  3,  4,  0,129,  3,  0,  0,130,  3,  7,  0,142,  3,  7,  0,143,  3,  2,  0,253,  0,
+  2,  0,144,  3,168,  0,  5,  0,110,  0,199,  2,169,  0,145,  3,170,  0,146,  3,  4,  0, 16,  0,  4,  0, 27,  0,171,  0,  8,  0,
+110,  0,199,  2,  7,  0,147,  3,  7,  0,148,  3,  7,  0,149,  3,  0,  0,250,  0,  0,  0, 18,  0,  0,  0, 87,  1,  0,  0, 27,  0,
+172,  0,  3,  0,173,  0,150,  3,  4,  0, 67,  2,  0,  0, 94,  0,173,  0, 29,  0, 22,  0, 32,  0, 34,  0, 75,  0,  2,  0, 49,  2,
+  2,  0, 50,  2,  2,  0,151,  3,  2,  0, 18,  0,  2,  0,152,  3,  2,  0,153,  3,  2,  0,154,  3,  2,  0, 30,  0,  0,  0,155,  3,
+  0,  0,156,  3,  0,  0,157,  3,  0,  0,247,  1,  4,  0, 27,  0,  7,  0,158,  3,  7,  0,159,  3,  7,  0,160,  3,  7,  0,161,  3,
+  7,  0,162,  3,  7,  0,163,  3, 29,  0,164,  3, 31,  0, 80,  0, 33,  0, 74,  2, 91,  0,127,  2,  0,  0, 72,  0,  7,  0,165,  3,
+  7,  0,166,  3,172,  0,167,  3,174,  0,  5,  0,174,  0,  0,  0,174,  0,  1,  0,  0,  0, 19,  0,  0,  0, 18,  0,  0,  0,124,  0,
+ 68,  0,  3,  0,  7,  0,168,  3,  4,  0, 18,  0,  4,  0, 27,  0, 27,  0,128,  0, 22,  0, 32,  0, 34,  0, 75,  0,175,  0,169,  3,
+  2,  0, 16,  0,  2,  0,170,  3,  4,  0,171,  3,  4,  0,172,  3,  4,  0,173,  3,  0,  0,174,  3, 27,  0, 38,  0, 27,  0,175,  3,
+ 27,  0,176,  3, 27,  0,177,  3, 27,  0,178,  3, 31,  0, 80,  0, 68,  0, 16,  2,176,  0,179,  3,176,  0,180,  3,177,  0,181,  3,
+ 11,  0,  2,  0,178,  0,182,  3,179,  0,183,  3,180,  0,184,  3, 14,  0,185,  3, 14,  0,186,  3, 14,  0, 29,  2, 14,  0,187,  3,
+ 14,  0,188,  3,  4,  0, 87,  1,  4,  0,189,  3, 63,  0, 31,  2,  0,  0,190,  3,  4,  0, 33,  2,  4,  0,191,  3,  7,  0, 77,  1,
+  7,  0,192,  3,  7,  0,193,  3,  7,  0,176,  0,  7,  0,194,  3,  7,  0,195,  3,  7,  0, 78,  1,  7,  0,196,  3,  7,  0, 19,  2,
+  7,  0,197,  3,  7,  0,198,  3,  7,  0,199,  3,  7,  0,200,  3,  7,  0,201,  3,  7,  0,202,  3,  7,  0, 12,  3,  7,  0,203,  3,
+  7,  0,244,  0,  7,  0,204,  3,  4,  0,205,  3,  4,  0,206,  3,  2,  0, 18,  0,  2,  0,207,  3,  2,  0,208,  3,  2,  0,209,  3,
+  2,  0,210,  3,  2,  0,211,  3,  2,  0,212,  3,  2,  0,213,  3,  2,  0,214,  3,  0,  0,215,  3,  0,  0,216,  3,  4,  0,217,  3,
+  4,  0,218,  3,  4,  0,219,  3,  4,  0,220,  3,  7,  0,221,  3,  7,  0, 84,  0,  7,  0,222,  3,  7,  0,223,  3,  7,  0,224,  3,
+  7,  0,225,  3,  7,  0,226,  3,  7,  0,220,  0,  7,  0,227,  3,  7,  0,228,  3,  7,  0,229,  3,  7,  0,230,  3,  7,  0,231,  3,
+  2,  0,232,  3,  0,  0,233,  3,  0,  0,234,  3,  0,  0,235,  3,  0,  0,236,  3,  0,  0,110,  0,  0,  0,237,  3,  7,  0,238,  3,
+  7,  0,239,  3, 14,  0,240,  3, 14,  0,241,  3, 14,  0,242,  3, 14,  0,243,  3,  7,  0,244,  3,  2,  0, 14,  2,  2,  0,245,  3,
+  7,  0,151,  2,  4,  0,246,  3,  4,  0,247,  3,181,  0,248,  3,  2,  0,249,  3,  2,  0,251,  0,  7,  0,250,  3, 14,  0,251,  3,
+ 14,  0,252,  3, 14,  0,253,  3, 14,  0,254,  3,182,  0, 73,  1,183,  0,255,  3, 64,  0,  0,  4,  0,  0,  1,  4,  0,  0,  2,  4,
+  2,  0, 67,  2,  7,  0,143,  2,155,  0,  3,  4,143,  0,  4,  4,143,  0,  5,  4, 10,  0,  6,  4, 10,  0,  7,  4,  4,  0,  8,  4,
+  4,  0,  9,  4, 14,  0, 10,  4, 14,  0, 11,  4, 14,  0, 12,  4,  7,  0, 13,  4,184,  0, 14,  0,184,  0,  0,  0,184,  0,  1,  0,
+ 27,  0, 38,  0,  7,  0, 12,  3,  7,  0, 79,  1,  7,  0, 13,  3,  7,  0,  5,  3,  0,  0, 19,  0,  4,  0, 14,  3,  4,  0, 15,  3,
+  4,  0, 14,  4,  2,  0, 16,  0,  2,  0, 15,  4,  7,  0, 16,  3,185,  0, 12,  0,185,  0,  0,  0,185,  0,  1,  0, 27,  0, 44,  0,
+  4,  0, 16,  4,  4,  0, 14,  2,  7,  0, 79,  1,  7,  0, 17,  4,  7,  0, 18,  4,  7,  0,170,  2,  2,  0, 16,  0,  0,  0, 19,  4,
+  0,  0, 20,  4,182,  0, 40,  0,  4,  0, 18,  0,  2,  0, 21,  4,  2,  0, 22,  4,  2,  0,  5,  3,  2,  0, 23,  4,  2,  0, 24,  4,
+  2,  0, 25,  4,  2,  0, 26,  4,  2,  0, 27,  4,  7,  0, 28,  4,  7,  0, 29,  4,  7,  0, 30,  4,  7,  0, 31,  4,  7,  0, 32,  4,
+  7,  0, 33,  4,  7,  0, 34,  4,  7,  0, 35,  4,  7,  0, 36,  4,  7,  0, 37,  4,  7,  0, 38,  4,  7,  0, 39,  4,  7,  0, 40,  4,
+  7,  0, 41,  4,  7,  0, 42,  4,  7,  0, 43,  4,  7,  0, 44,  4,  7,  0, 45,  4,  7,  0, 46,  4,  7,  0, 47,  4,  7,  0, 48,  4,
+  7,  0, 49,  4,  7,  0, 50,  4,  7,  0, 51,  4,  7,  0, 52,  4,  7,  0, 53,  4,  7,  0, 54,  4, 47,  0,169,  0,186,  0, 55,  4,
+  7,  0, 56,  4,  4,  0,214,  2,187,  0,  5,  0, 64,  0,250,  1,  7,  0, 57,  4,  7,  0, 58,  4,  2,  0, 18,  0,  2,  0, 59,  4,
+188,  0,  5,  0,188,  0,  0,  0,188,  0,  1,  0,  4,  0, 16,  0,  4,  0, 60,  4, 11,  0,  2,  0,189,  0,  9,  0,189,  0,  0,  0,
+189,  0,  1,  0,  4,  0, 61,  4,  4,  0, 62,  4,  4,  0, 63,  4,  4,  0, 18,  0, 11,  0, 64,  4, 11,  0, 65,  4, 14,  0, 66,  4,
+139,  0, 23,  0,139,  0,  0,  0,139,  0,  1,  0,  4,  0, 18,  0,  4,  0, 67,  4,  4,  0, 68,  4,  4,  0, 69,  4,  4,  0, 70,  4,
+  4,  0, 71,  4,  4,  0, 72,  4,  4,  0, 73,  4,  4,  0, 27,  0,  4,  0, 62,  4,  4,  0, 14,  2,  2,  0, 74,  4,  2,  0, 56,  0,
+  0,  0, 19,  0,  0,  0, 75,  4,  0,  0, 76,  4,  0,  0, 77,  4,  0,  0, 78,  4, 14,  0, 79,  4,190,  0, 80,  4, 11,  0, 81,  4,
+191,  0,  1,  0,  7,  0, 47,  2,181,  0, 30,  0,  4,  0, 18,  0,  7,  0, 82,  4,  7,  0, 83,  4,  7,  0, 84,  4,  4,  0, 85,  4,
+  4,  0, 86,  4,  4,  0, 87,  4,  4,  0, 88,  4,  7,  0, 89,  4,  7,  0, 90,  4,  7,  0, 91,  4,  7,  0, 92,  4,  7,  0, 93,  4,
+  7,  0, 94,  4,  7,  0, 95,  4,  7,  0, 96,  4,  7,  0, 97,  4,  7,  0, 98,  4,  7,  0, 99,  4,  7,  0,100,  4,  7,  0,101,  4,
+  7,  0,102,  4,  7,  0,103,  4,  7,  0,104,  4,  7,  0,105,  4,  7,  0,106,  4,  4,  0,107,  4,  4,  0,108,  4,  7,  0,109,  4,
+  7,  0,227,  3,183,  0, 54,  0,  4,  0, 62,  4,  4,  0,110,  4,192,  0,111,  4,193,  0,112,  4,  0,  0, 27,  0,  0,  0,113,  4,
+  2,  0,114,  4,  7,  0,115,  4,  0,  0,116,  4,  7,  0,117,  4,  7,  0,118,  4,  7,  0,119,  4,  7,  0,120,  4,  7,  0,121,  4,
+  7,  0,122,  4,  7,  0,123,  4,  7,  0,124,  4,  7,  0,125,  4,  2,  0,126,  4,  0,  0,127,  4,  2,  0,128,  4,  7,  0,129,  4,
+  7,  0,130,  4,  0,  0,131,  4,  4,  0,129,  0,  4,  0,132,  4,  4,  0,133,  4,  2,  0,134,  4,  2,  0,135,  4,191,  0,136,  4,
+  4,  0,137,  4,  4,  0, 82,  0,  7,  0,138,  4,  7,  0,139,  4,  7,  0,140,  4,  7,  0,141,  4,  2,  0,142,  4,  2,  0,143,  4,
+  2,  0,144,  4,  2,  0,145,  4,  2,  0,146,  4,  2,  0,147,  4,  2,  0,148,  4,  2,  0,149,  4,194,  0,150,  4,  7,  0,151,  4,
+  7,  0,152,  4,139,  0,153,  4, 14,  0, 21,  3,187,  0,154,  4,  7,  0,155,  4,  7,  0,156,  4,  7,  0,157,  4,  4,  0,158,  4,
+195,  0,  1,  0,  7,  0,159,  4,155,  0, 52,  0,154,  0,160,  4,  2,  0, 16,  0,  2,  0,161,  4,  2,  0,162,  4,  2,  0,163,  4,
+  7,  0,164,  4,  2,  0,165,  4,  2,  0,166,  4,  7,  0,167,  4,  2,  0,168,  4,  2,  0,169,  4,  7,  0,170,  4,  7,  0,171,  4,
+  7,  0,172,  4,  4,  0,173,  4,  4,  0,174,  4,  4,  0,175,  4,  4,  0, 27,  0,  7,  0,176,  4,  4,  0,177,  4,  7,  0,178,  4,
+  7,  0,179,  4,  7,  0,180,  4, 79,  0,181,  4, 79,  0,182,  4,  0,  0,183,  4,  7,  0,184,  4,  7,  0,185,  4, 31,  0, 80,  0,
+  2,  0,186,  4,  0,  0,187,  4,  0,  0,188,  4,  7,  0,189,  4,  4,  0,190,  4,  7,  0,191,  4,  7,  0,192,  4,  4,  0,193,  4,
+  4,  0, 18,  0,  7,  0,194,  4,  7,  0,195,  4,  7,  0,196,  4,195,  0,197,  4,  4,  0, 53,  0,  7,  0,198,  4,  7,  0,199,  4,
+  7,  0,200,  4,  7,  0,201,  4,  7,  0,202,  4,  7,  0,203,  4,  7,  0,204,  4,  4,  0,205,  4,  7,  0,206,  4,196,  0, 78,  0,
+ 22,  0, 32,  0, 34,  0, 75,  0,  2,  0,179,  0,  2,  0, 88,  1,  2,  0,122,  1,  2,  0,207,  4,  7,  0,208,  4,  7,  0,209,  4,
+  7,  0,210,  4,  7,  0,211,  4,  7,  0,212,  4,  7,  0,213,  4,  7,  0,170,  1,  7,  0,172,  1,  7,  0,171,  1,  7,  0, 30,  0,
+  4,  0,214,  4,  7,  0,215,  4,  7,  0,216,  4,  7,  0,217,  4,  7,  0,218,  4,  7,  0,219,  4,  7,  0,220,  4,  7,  0,221,  4,
+  2,  0,222,  4,  2,  0, 87,  1,  2,  0,223,  4,  2,  0,224,  4,  2,  0,225,  4,  2,  0,226,  4,  2,  0,227,  4,  2,  0,228,  4,
+  7,  0,229,  4,  7,  0,230,  4,  7,  0,231,  4,  7,  0,232,  4,  7,  0,233,  4,  7,  0,234,  4,  7,  0,235,  4,  7,  0,236,  4,
+  7,  0,237,  4,  7,  0,238,  4,  7,  0,239,  4,  7,  0,240,  4,  2,  0,241,  4,  2,  0,242,  4,  2,  0,243,  4,  2,  0,244,  4,
+  7,  0,245,  4,  7,  0,246,  4,  7,  0,247,  4,  7,  0,248,  4,  2,  0,249,  4,  2,  0,250,  4,  2,  0,251,  4,  2,  0,252,  4,
+  7,  0,253,  4,  7,  0,254,  4,  7,  0,255,  4,  7,  0,  0,  5,  7,  0,  1,  5,  7,  0,  2,  5,  7,  0,  3,  5,  2,  0,  4,  5,
+  2,  0,  5,  5,  2,  0,  6,  5,  2,  0,  7,  5,  2,  0,  8,  5,  2,  0, 18,  0,  7,  0,  9,  5,  7,  0, 10,  5, 31,  0, 80,  0,
+ 46,  0,140,  1,  2,  0,141,  1,  2,  0, 76,  1,  2,  0,181,  2, 25,  0,154,  0, 57,  0, 70,  1,197,  0,  8,  0,197,  0,  0,  0,
+197,  0,  1,  0,  4,  0,205,  3,  4,  0, 11,  5,  4,  0, 18,  0,  2,  0, 12,  5,  2,  0, 13,  5, 27,  0,168,  0,198,  0, 13,  0,
+ 11,  0, 14,  5, 11,  0, 15,  5,  4,  0, 16,  5,  4,  0, 17,  5,  4,  0, 18,  5,  4,  0, 19,  5,  4,  0, 20,  5,  4,  0, 21,  5,
+  4,  0, 22,  5,  4,  0, 23,  5,  4,  0, 24,  5,  4,  0, 27,  0,  0,  0, 25,  5,199,  0,  5,  0, 11,  0, 26,  5, 11,  0, 27,  5,
+  4,  0, 28,  5,  4,  0, 30,  0,  0,  0, 29,  5,200,  0, 17,  0,  4,  0, 30,  5,  4,  0, 31,  5,  4,  0, 32,  5,  4,  0, 33,  5,
+  4,  0, 34,  5,  4,  0, 35,  5,  4,  0, 36,  5,  4,  0, 37,  5,  4,  0, 38,  5,  4,  0, 39,  5,  4,  0, 40,  5,  4,  0, 41,  5,
+  2,  0, 42,  5,  2,  0, 43,  5,  4,  0, 44,  5,  4,  0, 45,  5,  4,  0, 67,  0,201,  0, 17,  0,  4,  0, 16,  0,  4,  0, 32,  5,
+  4,  0, 46,  5,  4,  0, 47,  5,  4,  0, 48,  5,  4,  0, 49,  5,  4,  0, 50,  5,  4,  0, 51,  5,  7,  0, 52,  5,  4,  0, 53,  5,
+  4,  0, 92,  0,  4,  0, 54,  5,  4,  0, 55,  5,  4,  0, 56,  5,  4,  0, 57,  5,  4,  0, 58,  5, 21,  0, 31,  0,202,  0,  9,  0,
+  4,  0, 59,  5,  7,  0, 60,  5,  7,  0, 61,  5,  7,  0, 62,  5,  4,  0, 63,  5,  2,  0, 18,  0,  2,  0, 27,  0,  7,  0, 84,  4,
+  7,  0, 30,  0,203,  0, 11,  0,203,  0,  0,  0,203,  0,  1,  0,  0,  0, 19,  0, 63,  0, 64,  5, 64,  0, 65,  5,  4,  0,205,  3,
+  4,  0, 66,  5,  4,  0, 67,  5,  4,  0, 27,  0,  4,  0, 68,  5,  4,  0, 69,  5,204,  0, 13,  0,  0,  0, 70,  5,  0,  0,250,  0,
+  0,  0, 71,  5,  0,  0, 18,  0,  0,  0, 72,  5,  0,  0, 73,  5,  0,  0, 74,  5,  0,  0, 75,  5,  2,  0, 76,  5,  2,  0, 77,  5,
+  7,  0, 78,  5,  0,  0, 79,  5,  0,  0,124,  0,205,  0,106,  0,204,  0, 80,  5,198,  0, 81,  5,199,  0, 82,  5,200,  0, 83,  5,
+201,  0, 84,  5,  4,  0, 36,  3,  4,  0,129,  0,  4,  0,132,  4,  7,  0, 85,  5,  4,  0, 86,  5,  4,  0, 87,  5,  4,  0, 88,  5,
+  4,  0, 89,  5,  2,  0, 18,  0,  2,  0, 90,  5,  7,  0, 91,  5,  7,  0, 92,  5,  7,  0, 93,  5,  7,  0, 94,  5,  7,  0, 95,  5,
+  2,  0, 96,  5,  2,  0, 97,  5,  2,  0, 98,  5,  2,  0, 99,  5,  2,  0,250,  0,  2,  0,100,  5,  4,  0,101,  5,  2,  0,102,  5,
+  2,  0,103,  5,  2,  0,109,  1,  2,  0,108,  0,  2,  0,104,  5,  2,  0,105,  5,  2,  0,106,  5,  2,  0,107,  5,  2,  0,108,  5,
+  2,  0, 71,  5,  2,  0, 70,  5,  2,  0,109,  5,  2,  0, 72,  5,  2,  0,110,  5,  4,  0,111,  5,  4,  0, 87,  1,  4,  0,112,  5,
+  2,  0,113,  5,  2,  0, 67,  0,  2,  0,114,  5,  2,  0,115,  5,  2,  0,116,  5,  2,  0,117,  5,  2,  0,118,  5,  2,  0,119,  5,
+ 19,  0,120,  5, 19,  0,121,  5, 18,  0,122,  5, 14,  0,123,  5,  2,  0,124,  5,  2,  0,125,  5,  7,  0,126,  5,  7,  0,127,  5,
+  7,  0,128,  5,  7,  0,129,  5,  4,  0,130,  5,  7,  0,131,  5,  7,  0,132,  5,  7,  0,133,  5,  7,  0,134,  5,  2,  0,135,  5,
+  2,  0,136,  5,  2,  0,137,  5,  2,  0,138,  5,  2,  0,139,  5,  2,  0,140,  5,  7,  0,141,  5,  7,  0,142,  5,  7,  0,143,  5,
+  0,  0,144,  5,  4,  0,145,  5,  2,  0,146,  5,  2,  0,247,  1,  0,  0,147,  5,  7,  0,148,  5,  7,  0,149,  5,  0,  0,150,  5,
+  0,  0,151,  5,  0,  0,152,  5,  0,  0,153,  5,  4,  0,154,  5,  2,  0,155,  5,  2,  0,156,  5,  7,  0,157,  5,  7,  0,158,  5,
+  2,  0,159,  5,  2,  0,160,  5,  7,  0,161,  5,  2,  0,162,  5,  2,  0,163,  5,  4,  0,164,  5,  2,  0,165,  5,  2,  0,166,  5,
+  2,  0,167,  5,  2,  0,168,  5,  7,  0,169,  5,  7,  0, 30,  0, 37,  0,170,  5,  0,  0,171,  5,206,  0,  9,  0,206,  0,  0,  0,
+206,  0,  1,  0,  0,  0,172,  5,  2,  0,173,  5,  2,  0,174,  5,  2,  0,175,  5,  2,  0, 67,  0,  7,  0,176,  5,  7,  0, 30,  0,
+207,  0,  7,  0,  2,  0,231,  2,  2,  0, 87,  1,  2,  0, 94,  3,  2,  0,177,  5,  7,  0,178,  5,  7,  0, 30,  0, 37,  0,179,  5,
+208,  0,  5,  0,  7,  0,180,  5,  0,  0, 16,  0,  0,  0, 67,  0,  0,  0, 30,  0,  0,  0,247,  1,209,  0, 15,  0,  7,  0,181,  5,
+  7,  0,182,  5,  7,  0,183,  5,  7,  0,184,  5,  7,  0,185,  5,  7,  0,186,  5,  7,  0,187,  5,  7,  0,188,  5,  7,  0,189,  5,
+  7,  0,190,  5,  4,  0,191,  5,  7,  0,192,  5,  7,  0,193,  5,  2,  0, 67,  0,  2,  0, 30,  0,210,  0, 32,  0,208,  0,194,  5,
+  2,  0,195,  5,  2,  0, 97,  5,  2,  0, 98,  5,  2,  0, 99,  5,  2,  0,250,  0,  2,  0,100,  5,  2,  0,196,  5,  2,  0,197,  5,
+  2,  0,198,  5,  2,  0,199,  5,207,  0,200,  5,  2,  0,201,  5,  2,  0,102,  5,  7,  0,202,  5,209,  0,203,  5,  7,  0,220,  4,
+  7,  0,221,  4,  4,  0, 18,  0,  2,  0, 87,  1,  2,  0,204,  5,  2,  0,223,  4,  2,  0,224,  4,  2,  0,205,  5,  2,  0, 27,  0,
+  2,  0,225,  4,  2,  0,226,  4,  2,  0,227,  4,  2,  0,228,  4,  2,  0,206,  5,  2,  0, 67,  0,  7,  0,207,  5,211,  0,  6,  0,
+211,  0,  0,  0,211,  0,  1,  0,  4,  0, 61,  4,  0,  0, 19,  0,  4,  0, 18,  0, 27,  0,208,  5,212,  0,  4,  0,213,  0,146,  3,
+ 11,  0,209,  5,  0,  0,210,  5,  4,  0, 92,  0,214,  0,  8,  0,212,  0,211,  5,  2,  0, 18,  0,  2,  0, 27,  0,  2,  0,212,  5,
+  2,  0,213,  5,  2,  0,214,  5,  4,  0, 67,  0, 11,  0,215,  5,215,  0,  6,  0,  2,  0,108,  0,  2,  0, 67,  4,  2,  0,216,  5,
+  2,  0,225,  2,  4,  0, 18,  0,  7,  0,209,  2,216,  0, 14,  0,  2,  0, 18,  0,  2,  0,217,  5,  2,  0,218,  5,  2,  0,219,  5,
+215,  0,220,  5, 11,  0,215,  5,  7,  0,221,  5,  7,  0, 56,  0,  4,  0,222,  5,  4,  0,223,  5,  4,  0,224,  5,  4,  0,225,  5,
+ 41,  0,125,  0, 27,  0,168,  0,217,  0, 14,  0,212,  0,211,  5,  4,  0, 92,  0,  4,  0,226,  5,  7,  0,227,  5,  7,  0,228,  5,
+  7,  0,229,  5,  4,  0,230,  5,  4,  0,231,  5,  7,  0,232,  5,  7,  0,233,  5,  4,  0,234,  5,  7,  0,235,  5,  7,  0,236,  5,
+  4,  0, 27,  0,218,  0,  1,  0,212,  0,211,  5,219,  0,  7,  0,212,  0,211,  5,  2,  0, 18,  0,  2,  0, 27,  0,  4,  0, 37,  0,
+  4,  0,237,  5, 91,  0,238,  5, 11,  0,215,  5,220,  0,  5,  0,220,  0,  0,  0,220,  0,  1,  0,  0,  0, 19,  0,  7,  0,239,  5,
+  4,  0, 27,  0,221,  0,  4,  0,  4,  0,108,  0,  7,  0,240,  5,  7,  0,178,  1,  4,  0, 18,  0,222,  0, 85,  0,219,  0,241,  5,
+219,  0,242,  5,217,  0,169,  3,218,  0,243,  5,  7,  0,244,  5,  2,  0,245,  5,  2,  0,247,  1,  7,  0,246,  5,  7,  0,247,  5,
+  2,  0, 67,  4,  2,  0,248,  5,  7,  0,249,  5,  7,  0,250,  5,  7,  0,251,  5,  2,  0,252,  5,  2,  0,222,  5,  2,  0,253,  5,
+  2,  0,254,  5,  2,  0,255,  5,  2,  0,  0,  6,  7,  0,  1,  6,  7,  0,  2,  6,  7,  0,  3,  6,  2,  0,  4,  6,  2,  0,  5,  6,
+  2,  0,  6,  6,  2,  0,  7,  6,  2,  0,  8,  6,  2,  0,  9,  6,  2,  0, 10,  6,  2,  0, 11,  6,214,  0, 12,  6,216,  0, 13,  6,
+  7,  0, 14,  6,  7,  0, 15,  6,  7,  0, 16,  6,  2,  0, 17,  6,  2,  0, 18,  6,  0,  0, 19,  6,  0,  0, 20,  6,  2,  0, 21,  6,
+  7,  0, 22,  6,  7,  0, 23,  6,  7,  0, 24,  6,  7,  0, 25,  6,  7,  0, 26,  6,  7,  0, 27,  6,  7,  0, 28,  6,  7,  0, 29,  6,
+  7,  0, 30,  6,  7,  0, 31,  6,  2,  0, 32,  6,  0,  0, 33,  6,  0,  0, 34,  6,  0,  0, 35,  6,  0,  0, 36,  6, 27,  0, 37,  6,
+  0,  0, 38,  6,  0,  0, 39,  6,  0,  0, 40,  6,  0,  0, 41,  6,  0,  0, 42,  6,  0,  0, 43,  6,  0,  0, 44,  6,  0,  0, 45,  6,
+  0,  0, 46,  6,  0,  0, 47,  6,  2,  0, 48,  6,  2,  0, 49,  6,  2,  0, 50,  6,  2,  0, 51,  6,  0,  0, 52,  6,  0,  0, 53,  6,
+  0,  0, 54,  6,  0,  0, 55,  6,  4,  0, 56,  6,  4,  0, 57,  6,  4,  0, 58,  6,  4,  0, 59,  6,  2,  0, 60,  6,  2,  0, 67,  0,
+  4,  0, 61,  6,  7,  0, 62,  6,  7,  0, 63,  6,221,  0, 64,  6,223,  0,  8,  0,  4,  0, 65,  6,  4,  0, 66,  6,  4,  0, 67,  6,
+  4,  0, 68,  6,  4,  0, 69,  6,  4,  0, 70,  6,  4,  0, 53,  0,  4,  0,138,  2,224,  0,  4,  0,  7,  0, 71,  6,  0,  0, 72,  6,
+  0,  0, 73,  6,  2,  0, 18,  0,225,  0,  4,  0,  7,  0, 74,  6,  4,  0, 18,  0,  4,  0, 75,  6,  4,  0, 56,  0, 41,  0, 46,  0,
+ 22,  0, 32,  0, 34,  0, 75,  0, 27,  0,208,  5,196,  0, 76,  6, 41,  0, 77,  6, 14,  0, 78,  6,197,  0, 79,  6, 27,  0, 80,  6,
+  7,  0, 81,  6,  7,  0, 82,  6,  7,  0, 83,  6,  7,  0, 84,  6,  4,  0,205,  3,  4,  0, 85,  6,  4,  0, 86,  6,  2,  0, 18,  0,
+  2,  0, 76,  1, 57,  0, 70,  1,226,  0, 87,  6,222,  0, 88,  6,227,  0, 89,  6,205,  0,185,  0,202,  0, 90,  6, 14,  0,102,  0,
+ 14,  0, 91,  6, 11,  0, 92,  6, 11,  0, 93,  6, 11,  0, 94,  6, 11,  0, 95,  6, 11,  0, 96,  6,228,  0, 97,  6,  2,  0, 98,  6,
+  2,  0, 99,  6,  2,  0,251,  0,  2,  0,206,  3,  4,  0,216,  3,  4,  0,100,  6, 14,  0,101,  6,208,  0,194,  5,210,  0,102,  6,
+224,  0,103,  6,178,  0,182,  3,225,  0,104,  6,229,  0,105,  6, 10,  0,  7,  4, 10,  0,106,  6,230,  0, 14,  0,230,  0,  0,  0,
+230,  0,  1,  0, 42,  0,242,  0, 40,  0, 69,  1,229,  0,105,  6,231,  0,107,  6,  7,  0, 97,  2,  7,  0, 98,  2,  7,  0,108,  0,
+  7,  0,108,  6,  2,  0,109,  6,  2,  0, 18,  0,  2,  0,143,  0,  2,  0, 27,  0,232,  0, 39,  0,  7,  0,110,  6,  7,  0,111,  6,
+  7,  0,112,  6,  7,  0,113,  6,  7,  0,114,  6,  7,  0,115,  6,  7,  0,116,  6,  7,  0,117,  6,  7,  0,118,  6, 68,  0,119,  6,
+178,  0,182,  3,232,  0,120,  6,233,  0,121,  6,234,  0,122,  6,235,  0,123,  6,236,  0,124,  6,237,  0,125,  6,  7,  0,126,  6,
+  7,  0,127,  6,  7,  0, 94,  1,  7,  0,128,  6,  7,  0,129,  6,  7,  0,130,  6,  7,  0,131,  6,  7,  0,175,  0,  7,  0,132,  6,
+  0,  0,133,  6,  0,  0,134,  6,  0,  0,109,  6,  0,  0,135,  6,  2,  0,136,  6,  2,  0,137,  6,  7,  0,138,  6,  2,  0,139,  6,
+  2,  0,140,  6,  7,  0,141,  6,  7,  0,142,  6,  7,  0,143,  6,  7,  0,144,  6,238,  0, 51,  0,239,  0,  0,  0,239,  0,  1,  0,
+ 14,  0,145,  6,  4,  0,146,  6,  7,  0,147,  6,  2,  0,148,  6,  7,  0,127,  6,  7,  0, 94,  1,  7,  0,149,  6,  2,  0,150,  6,
+  0,  0,211,  2,  4,  0,151,  6,  2,  0,134,  6,  2,  0,109,  6, 27,  0,208,  5, 27,  0,152,  6, 14,  0,153,  6,230,  0,154,  6,
+238,  0,120,  6,  0,  0,155,  6,  4,  0,205,  3,  4,  0, 85,  6,  2,  0,156,  6,  2,  0,157,  6,  2,  0,158,  6,  2,  0,159,  6,
+  2,  0, 18,  0,  2,  0, 32,  2,  7,  0,114,  0,  7,  0,160,  6,  7,  0,161,  6,  7,  0,162,  6,  7,  0,175,  0,  7,  0, 81,  6,
+  2,  0,163,  6,  2,  0,164,  6,  2,  0,165,  6,  0,  0,166,  6,  0,  0,167,  6,  0,  0,168,  6,  0,  0,169,  6,  0,  0,170,  6,
+ 14,  0,171,  6, 14,  0,172,  6, 14,  0,173,  6,  2,  0,174,  6,  2,  0,152,  2,  2,  0,175,  6,  0,  0,176,  6, 11,  0,177,  6,
+178,  0,182,  3,240,  0, 24,  0, 19,  0, 37,  0, 19,  0, 63,  0, 18,  0,178,  6, 18,  0,179,  6, 18,  0,180,  6,  7,  0,181,  6,
+  7,  0,182,  6,  7,  0,183,  6,  7,  0,184,  6,  2,  0,185,  6,  2,  0,186,  6,  2,  0,187,  6,  2,  0,188,  6,  2,  0,189,  6,
+  2,  0, 18,  0,  2,  0,190,  6,  2,  0,191,  6,  2,  0,192,  6,  2,  0,193,  6,  2,  0,194,  6,  2,  0,159,  6,  7,  0,195,  6,
+  4,  0,196,  6,  4,  0,197,  6,239,  0,  6,  0,239,  0,  0,  0,239,  0,  1,  0, 14,  0,145,  6,  4,  0,146,  6,  7,  0,147,  6,
+  2,  0,148,  6,241,  0,  8,  0,239,  0,  0,  0,239,  0,  1,  0, 14,  0,145,  6,  4,  0,146,  6,  7,  0,147,  6,  2,  0,148,  6,
+  0,  0,198,  6,  0,  0,124,  0,242,  0, 14,  0,239,  0,  0,  0,239,  0,  1,  0, 14,  0,145,  6,  4,  0,146,  6,  7,  0,147,  6,
+  2,  0,148,  6,240,  0,199,  6,243,  0,200,  6, 14,  0,201,  6,  2,  0, 87,  1,  2,  0,202,  6,  4,  0, 18,  0,  7,  0,203,  6,
+  4,  0,159,  6,244,  0, 21,  0,239,  0,  0,  0,239,  0,  1,  0, 14,  0,145,  6,  4,  0,146,  6,  7,  0,147,  6,  2,  0,148,  6,
+240,  0,199,  6,  2,  0,204,  6,  2,  0,205,  6,  2,  0,206,  6,  2,  0,207,  6,  2,  0,190,  6,  2,  0,208,  6,  2,  0,209,  6,
+  0,  0, 18,  0,  0,  0, 27,  0, 11,  0, 73,  2,  4,  0,210,  6,  4,  0,211,  6, 22,  0,212,  6, 11,  0,213,  6,245,  0, 18,  0,
+239,  0,  0,  0,239,  0,  1,  0, 14,  0,145,  6,  4,  0,146,  6,  7,  0,147,  6,  2,  0,148,  6,240,  0,199,  6,  7,  0, 97,  2,
+  7,  0, 98,  2,  2,  0,204,  6,  2,  0,214,  6,  2,  0,215,  6,  2,  0,216,  6,  4,  0, 18,  0,  7,  0,217,  6,  4,  0,109,  6,
+  4,  0, 27,  0,178,  0,182,  3,246,  0, 16,  0,  0,  0,218,  6,  0,  0,219,  6,  0,  0,220,  6,  0,  0,221,  6,  0,  0,222,  6,
+  0,  0,223,  6,  4,  0,224,  6,  4,  0,225,  6,  4,  0,226,  6,  2,  0, 16,  0,  2,  0, 18,  0,  2,  0,227,  6,  2,  0,228,  6,
+  2,  0,190,  1,  2,  0,229,  6,  0,  0,230,  6,247,  0, 16,  0,239,  0,  0,  0,239,  0,  1,  0, 14,  0,145,  6,  4,  0,146,  6,
+  4,  0,231,  6,246,  0,232,  6,248,  0,233,  6, 14,  0,234,  6, 14,  0,235,  6,249,  0,236,  6,237,  0,237,  6,250,  0,238,  6,
+  2,  0,239,  6,  2,  0,240,  6,  2,  0,241,  6,  2,  0, 30,  0,251,  0, 15,  0,239,  0,  0,  0,239,  0,  1,  0, 14,  0,145,  6,
+  4,  0,146,  6,  7,  0,147,  6,  2,  0,148,  6,240,  0,199,  6, 14,  0,242,  6,252,  0,243,  6,  0,  0,244,  6,253,  0,245,  6,
+  2,  0, 18,  0,  2,  0,246,  6,  2,  0,247,  6,  2,  0,248,  6,254,  0, 25,  0,239,  0,  0,  0,239,  0,  1,  0, 14,  0,145,  6,
+  4,  0,146,  6,  4,  0, 18,  0, 42,  0,244,  2, 40,  0, 69,  1, 54,  0,249,  6,255,  0,250,  6,  0,  1,251,  6,178,  0,182,  3,
+  7,  0,252,  6,  7,  0, 97,  2,  7,  0, 98,  2,  7,  0,217,  6,  7,  0,253,  6,  7,  0,254,  6,  2,  0,255,  6,  2,  0, 27,  0,
+  2,  0,  0,  7,  2,  0,  1,  7,  0,  0,  2,  7,  0,  0,  3,  7,  0,  0,  4,  7,  0,  0,159,  6,  1,  1, 11,  0,239,  0,  0,  0,
+239,  0,  1,  0, 14,  0,145,  6,  4,  0,146,  6,  7,  0,147,  6,  2,  0,148,  6,  2,  0,202,  6,  2,  0, 18,  0,  4,  0, 27,  0,
+243,  0,200,  6,240,  0,199,  6,  2,  1, 31,  0,239,  0,  0,  0,239,  0,  1,  0, 14,  0,145,  6,  4,  0,146,  6,  7,  0,147,  6,
+  2,  0,148,  6, 37,  0,  5,  7,  4,  0,  6,  7,  4,  0,  7,  7,  2,  0, 92,  0,  2,  0,  8,  7,  2,  0,  9,  7,  0,  0, 10,  7,
+  0,  0, 11,  7,  4,  0, 12,  7,  4,  0, 13,  7,  4,  0, 14,  7,  2,  0, 15,  7,  2,  0, 16,  7,  2,  0, 17,  7,  2,  0, 18,  7,
+  7,  0, 19,  7, 18,  0, 20,  7, 18,  0, 21,  7,  4,  0, 22,  7,  4,  0, 23,  7,  0,  0, 24,  7,  0,  0, 25,  7,  2,  0, 26,  7,
+  0,  0,211,  2, 11,  0, 27,  7,  3,  1, 10,  0, 22,  0, 32,  0, 11,  0, 28,  7, 11,  0, 29,  7, 11,  0, 30,  7, 11,  0, 31,  7,
+ 11,  0, 32,  7,  4,  0, 92,  0,  4,  0, 33,  7,  0,  0, 34,  7,  0,  0, 35,  7,  4,  1, 10,  0,239,  0,  0,  0,239,  0,  1,  0,
+ 14,  0,145,  6,  4,  0,146,  6,  7,  0,147,  6,  3,  1, 36,  7,  2,  0, 92,  0,  2,  0,  8,  7,  4,  0, 67,  0, 11,  0, 37,  7,
+  5,  1,  3,  0,  5,  1,  0,  0,  5,  1,  1,  0,  7,  0, 38,  7,  6,  1,  9,  0,239,  0,  0,  0,239,  0,  1,  0, 14,  0,145,  6,
+  4,  0,146,  6,  7,  0,147,  6,240,  0,199,  6, 14,  0, 39,  7,  4,  0, 40,  7,  4,  0, 18,  0,  7,  1, 27,  0,239,  0,  0,  0,
+239,  0,  1,  0, 14,  0,145,  6,  4,  0,146,  6,  7,  0,147,  6,  2,  0,148,  6,240,  0,199,  6, 22,  0, 41,  7, 22,  0, 81,  0,
+  2,  0, 18,  0,  2,  0, 67,  0,  7,  0, 42,  7,  7,  0, 97,  2,  7,  0, 98,  2,  7,  0,217,  6,  7,  0, 43,  7,  7,  0, 44,  7,
+  7,  0, 45,  7, 57,  0, 70,  1, 57,  0, 46,  7,  4,  0, 47,  7,  2,  0, 48,  7,  2,  0, 49,  7,  2,  0,251,  0,  2,  0, 86,  1,
+ 14,  0, 50,  7,178,  0,182,  3,  8,  1, 10,  0,239,  0,  0,  0,239,  0,  1,  0, 14,  0,145,  6,  4,  0,146,  6,  7,  0,147,  6,
+  2,  0,148,  6,  2,  0, 18,  0,  2,  0,214,  3,  4,  0, 27,  0,178,  0,182,  3,  9,  1,  7,  0,  9,  1,  0,  0,  9,  1,  1,  0,
+  4,  0, 51,  7,  4,  0, 22,  0,  0,  0, 86,  0,  4,  0, 52,  7,  4,  0, 16,  0, 10,  1, 14,  0,239,  0,  0,  0,239,  0,  1,  0,
+ 14,  0,145,  6,  4,  0,146,  6,  7,  0,147,  6,  2,  0,148,  6,  4,  0,  9,  7,  4,  0, 27,  0, 14,  0, 53,  7, 14,  0, 54,  7,
+  0,  0, 55,  7,  0,  0, 56,  7,  4,  0, 57,  7,  4,  0, 58,  7, 11,  1,  6,  0,239,  0,  0,  0,239,  0,  1,  0, 14,  0,145,  6,
+  4,  0,146,  6,  4,  0, 27,  0,  0,  0, 59,  7, 12,  1, 24,  0,239,  0,  0,  0,239,  0,  1,  0, 14,  0,145,  6,  4,  0,146,  6,
+  7,  0, 97,  2,  7,  0, 98,  2,  7,  0, 60,  7,  7,  0, 61,  7,  7,  0,217,  6,231,  0, 62,  7,229,  0,105,  6, 13,  1,250,  6,
+  4,  0, 18,  0,  2,  0, 87,  1,  2,  0,109,  6,  4,  0, 63,  7,  7,  0, 64,  7,  7,  0,148,  3,  7,  0, 94,  3,  4,  0, 27,  0,
+  7,  0, 65,  7,  7,  0, 66,  7,  4,  0, 67,  7,  4,  0, 68,  7, 14,  1,  7,  0, 14,  1,  0,  0, 14,  1,  1,  0,  0,  0, 69,  7,
+  2,  0, 70,  7,  2,  0, 71,  7,  2,  0, 72,  7,  2,  0, 27,  0, 15,  1, 12,  0,  2,  0, 71,  7,  2,  0, 73,  7,  2,  0, 74,  7,
+  0,  0,211,  2,  2,  0, 75,  7,  2,  0, 76,  7,  2,  0, 77,  7,  2,  0, 78,  7,  2,  0, 79,  7,  2,  0,190,  6,  7,  0, 80,  7,
+  7,  0, 81,  7, 16,  1, 18,  0, 16,  1,  0,  0, 16,  1,  1,  0,  0,  0, 19,  0, 15,  1, 82,  7, 15,  1, 83,  7, 15,  1, 84,  7,
+ 15,  1, 85,  7,  7,  0, 86,  7,  2,  0, 87,  7,  2,  0, 88,  7,  2,  0, 89,  7,  2,  0, 90,  7,  2,  0, 91,  7,  2,  0, 92,  7,
+  2,  0, 93,  7,  2,  0, 94,  7,  2,  0, 95,  7,  2,  0, 27,  0, 17,  1, 10,  0,  0,  0, 96,  7,  0,  0, 97,  7,  0,  0, 98,  7,
+  0,  0, 99,  7,  0,  0,100,  7,  0,  0,101,  7,  2,  0,102,  7,  2,  0,103,  7,  2,  0,104,  7,  2,  0,105,  7, 18,  1,  8,  0,
+  0,  0,106,  7,  0,  0,107,  7,  0,  0,108,  7,  0,  0,109,  7,  0,  0,110,  7,  0,  0,111,  7,  7,  0,108,  6,  7,  0, 27,  0,
+ 19,  1,  3,  0,  0,  0,112,  7,  2,  0,113,  7,  2,  0, 27,  0, 20,  1, 22,  0, 17,  1,114,  7, 17,  1,115,  7, 17,  1,116,  7,
+ 17,  1,117,  7, 17,  1,118,  7, 17,  1,119,  7, 17,  1,120,  7, 17,  1,121,  7, 17,  1,122,  7, 17,  1,123,  7, 17,  1,124,  7,
+ 17,  1,125,  7, 17,  1,126,  7, 17,  1,127,  7, 17,  1,128,  7, 17,  1,129,  7, 17,  1,130,  7, 18,  1,131,  7, 19,  1,132,  7,
+  0,  0,133,  7,  7,  0,134,  7,  7,  0, 27,  0, 21,  1,122,  0,  0,  0,135,  7,  0,  0,136,  7,  0,  0,100,  7,  0,  0,137,  7,
+  0,  0,112,  7,  0,  0,138,  7,  0,  0,139,  7,  0,  0,140,  7,  0,  0,141,  7,  0,  0,142,  7,  0,  0,143,  7,  0,  0,144,  7,
+  0,  0,145,  7,  0,  0,146,  7,  0,  0,147,  7,  0,  0,148,  7,  0,  0,149,  7,  0,  0,150,  7,  0,  0,151,  7,  0,  0,152,  7,
+  0,  0,153,  7,  0,  0,154,  7,  0,  0,155,  7,  0,  0,156,  7,  0,  0,157,  7,  0,  0,158,  7,  0,  0,159,  7,  0,  0,160,  7,
+  0,  0,161,  7,  0,  0,162,  7,  0,  0,163,  7,  0,  0,164,  7,  0,  0,165,  7,  0,  0,166,  7,  0,  0,167,  7,  0,  0,168,  7,
+  0,  0,169,  7,  0,  0,170,  7,  0,  0,171,  7,  0,  0,172,  7,  0,  0,173,  7,  0,  0,174,  7,  0,  0,175,  7,  0,  0,176,  7,
+  0,  0,177,  7,  0,  0,178,  7,  0,  0,179,  7,  0,  0,180,  7,  0,  0,181,  7,  0,  0,182,  7,  0,  0,183,  7,  0,  0,184,  7,
+  0,  0,185,  7,  0,  0,186,  7,  0,  0,187,  7,  0,  0,188,  7,  0,  0,189,  7,  0,  0,190,  7,  0,  0,191,  7,  0,  0,192,  7,
+  0,  0,193,  7,  0,  0,194,  7,  0,  0,195,  7,  0,  0,196,  7,  0,  0,197,  7,  0,  0,198,  7,  0,  0,199,  7,  0,  0,200,  7,
+  0,  0,201,  7,  0,  0,202,  7,  0,  0,203,  7,  0,  0,204,  7,  0,  0,205,  7,  0,  0,206,  7,  0,  0,207,  7,  0,  0,208,  7,
+  0,  0,209,  7,  0,  0,210,  7,  0,  0,211,  7,  0,  0,212,  7,  0,  0,213,  7,  0,  0,214,  7,  0,  0,215,  7,  0,  0,216,  7,
+  0,  0,217,  7,  0,  0,218,  7,  0,  0,219,  7,  0,  0,220,  7,  0,  0,221,  7,  0,  0,222,  7,  0,  0,223,  7,  0,  0,224,  7,
+  0,  0,225,  7,  0,  0,226,  7,  0,  0,227,  7,  0,  0,228,  7,  0,  0,229,  7,  0,  0,230,  7,  0,  0,231,  7,  0,  0,232,  7,
+  0,  0,233,  7,  0,  0,234,  7,  0,  0,235,  7,  0,  0,236,  7,  0,  0,237,  7,  0,  0,238,  7,  0,  0,239,  7,  0,  0,240,  7,
+  0,  0,241,  7,  0,  0,242,  7,  0,  0,243,  7,  0,  0,244,  7,  0,  0,245,  7,  0,  0,246,  7,  0,  0,247,  7,  0,  0,248,  7,
+  0,  0,249,  7,  0,  0,250,  7,  0,  0,251,  7,  0,  0,252,  7,  0,  0,253,  7,  0,  0,254,  7, 22,  1,  5,  0,  0,  0,255,  7,
+  0,  0,158,  7,  0,  0,164,  7,  2,  0, 18,  0,  2,  0, 27,  0, 23,  1, 24,  0, 23,  1,  0,  0, 23,  1,  1,  0,  0,  0,172,  5,
+ 20,  1,  0,  8, 21,  1,  1,  8, 21,  1,  2,  8, 21,  1,  3,  8, 21,  1,  4,  8, 21,  1,  5,  8, 21,  1,  6,  8, 21,  1,  7,  8,
+ 21,  1,  8,  8, 21,  1,  9,  8, 21,  1, 10,  8, 21,  1, 11,  8, 21,  1, 12,  8, 21,  1, 13,  8, 21,  1, 14,  8, 21,  1, 15,  8,
+ 21,  1, 16,  8, 21,  1, 17,  8, 22,  1, 18,  8,  4,  0, 19,  8,  4,  0, 27,  0, 24,  1,  3,  0, 24,  1,  0,  0, 24,  1,  1,  0,
+  0,  0, 20,  8, 25,  1,  5,  0,  4,  0, 18,  0,  4,  0, 27,  0,  7,  0,151,  2,  7,  0, 21,  8,  7,  0, 47,  2, 26,  1, 95,  0,
+  4,  0, 18,  0,  4,  0, 22,  8,  4,  0, 23,  8,  0,  0, 24,  8,  0,  0, 25,  8,  0,  0, 26,  8,  0,  0, 27,  8,  0,  0, 28,  8,
+  0,  0, 29,  8,  0,  0, 30,  8,  0,  0, 31,  8,  0,  0, 32,  8,  0,  0, 33,  8,  4,  0, 34,  8,  2,  0, 35,  8,  2,  0, 36,  8,
+  2,  0, 37,  8,  2,  0, 38,  8,  4,  0, 39,  8,  4,  0, 40,  8,  4,  0, 41,  8,  4,  0, 42,  8,  2,  0, 43,  8,  2,  0, 44,  8,
+  4,  0, 45,  8,  4,  0, 46,  8,  4,  0, 47,  8,  4,  0, 48,  8,  4,  0, 49,  8,  4,  0, 53,  7,  4,  0, 50,  8,  2,  0, 51,  8,
+  2,  0, 52,  8,  2,  0, 53,  8,  2,  0, 54,  8, 14,  0, 55,  8, 14,  0, 56,  8, 14,  0, 57,  8, 14,  0, 58,  8, 14,  0, 59,  8,
+ 14,  0, 60,  8,  0,  0, 61,  8,  2,  0, 62,  8,  2,  0, 63,  8,  2,  0, 64,  8,  2,  0, 65,  8,  2,  0, 66,  8,  2,  0, 67,  8,
+  2,  0, 68,  8,  2,  0, 69,  8, 25,  1, 70,  8,  2,  0, 71,  8,  2,  0, 72,  8,  2,  0, 73,  8,  2,  0, 74,  8,  2,  0, 75,  8,
+  2,  0, 76,  8,  2,  0, 77,  8,  2,  0, 78,  8,  4,  0, 79,  8,  4,  0, 80,  8,  2,  0, 81,  8,  2,  0, 82,  8,  2,  0, 83,  8,
+  2,  0, 84,  8,  2,  0, 85,  8,  2,  0, 86,  8,  2,  0, 87,  8,  2,  0, 88,  8,  2,  0, 89,  8,  2,  0, 90,  8,  2,  0, 91,  8,
+  2,  0, 92,  8,  2,  0, 93,  8,  2,  0, 94,  8,  2,  0, 95,  8,  2,  0, 96,  8,  2,  0, 97,  8,  2,  0, 98,  8,  7,  0, 99,  8,
+  4,  0,100,  8,  7,  0,101,  8,  2,  0, 17,  6,  2,  0, 18,  6,  2,  0,102,  8,  2,  0,103,  8, 50,  0,104,  8,  7,  0,105,  8,
+  2,  0,106,  8,  2,  0,247,  1,  0,  0,107,  8,  4,  0,108,  8,  4,  0,109,  8,  7,  0,110,  8,  7,  0, 27,  0, 27,  1, 24,  0,
+ 22,  0, 32,  0, 14,  0,111,  8, 14,  0,112,  8, 14,  0,113,  8, 14,  0,145,  6, 41,  0,125,  0, 41,  0,114,  8,  4,  0,115,  8,
+  4,  0, 67,  0,  2,  0,116,  8,  2,  0,117,  8,  2,  0,118,  8,  2,  0,119,  8,  2,  0,120,  8,  2,  0,121,  8,  2,  0,122,  8,
+  2,  0,123,  8,  2,  0,124,  8,  2,  0,125,  8,  2,  0,126,  8,  2,  0, 27,  0,237,  0,127,  8, 11,  0,128,  8,  2,  0,129,  8,
+ 28,  1,  5,  0, 28,  1,  0,  0, 28,  1,  1,  0, 28,  1,130,  8, 15,  0,131,  8,  4,  0, 18,  0, 29,  1,  7,  0, 29,  1,  0,  0,
+ 29,  1,  1,  0, 28,  1,132,  8, 28,  1,133,  8,  2,  0,121,  5,  2,  0, 18,  0,  4,  0, 27,  0, 30,  1, 25,  0, 30,  1,  0,  0,
+ 30,  1,  1,  0, 31,  1,134,  8, 32,  1,238,  6,  0,  0,135,  8,  0,  0,136,  8,  0,  0,137,  8,  2,  0,138,  8,  2,  0,139,  8,
+  2,  0,140,  8,  2,  0,141,  8,  2,  0,142,  8,  2,  0, 27,  0,  2,  0, 18,  0,  2,  0, 68,  7,  2,  0,143,  8,  2,  0,144,  8,
+  4,  0,145,  8, 30,  1,146,  8, 11,  0,147,  8,  4,  0,148,  8,  4,  0,149,  8,  4,  0,150,  8,  4,  0,151,  8,  0,  0,152,  8,
+ 33,  1, 22,  0, 33,  1,  0,  0, 33,  1,  1,  0, 28,  1,132,  8, 28,  1,133,  8, 28,  1,153,  8, 28,  1,154,  8, 27,  1,155,  8,
+ 18,  0, 51,  0,  0,  0,146,  6,  0,  0,156,  8,  2,  0,191,  6,  2,  0,192,  6,  2,  0,157,  8,  2,  0, 27,  0,  2,  0,120,  8,
+  2,  0, 52,  7,  2,  0, 18,  0, 34,  1,134,  8, 14,  0,158,  8, 14,  0,145,  6, 14,  0,159,  8, 14,  0,160,  8, 35,  1, 24,  0,
+ 35,  1,  0,  0, 35,  1,  1,  0,240,  0,199,  6, 18,  0,161,  8, 18,  0,162,  8,  2,  0,191,  6,  2,  0,192,  6,  2,  0,163,  8,
+  2,  0,164,  8,  2,  0,165,  8,  2,  0, 18,  0,  7,  0, 93,  2,  2,  0,140,  8,  2,  0,141,  8,  2,  0,119,  8,  2,  0,166,  8,
+  2,  0,124,  8,  2,  0, 86,  1, 36,  1,134,  8, 14,  0,167,  8, 14,  0,168,  8, 14,  0,159,  8,  0,  0,169,  8, 11,  0,170,  8,
+ 37,  1, 14,  0,  0,  0,171,  8,  2,  0,172,  8,  2,  0,173,  8,  2,  0,174,  8,  2,  0,175,  8,  2,  0,110,  5,  2,  0,176,  8,
+ 27,  1,177,  8, 41,  0,178,  8,  4,  0,179,  8,  4,  0,180,  8,  4,  0,181,  8,  4,  0, 27,  0,  0,  0, 69,  7, 38,  1,  3,  0,
+  0,  0,182,  8,  4,  0,183,  8,  4,  0,184,  8, 39,  1,  4,  0,  4,  0,  6,  7,  4,  0,185,  8,  4,  0, 12,  7,  4,  0,186,  8,
+ 40,  1,  2,  0,  4,  0,187,  8,  4,  0,188,  8, 41,  1,  5,  0,  7,  0,189,  8,  7,  0,190,  8,  7,  0,191,  8,  4,  0, 18,  0,
+  4,  0, 27,  0, 42,  1,  7,  0,  0,  0,192,  8,  0,  0,220,  6, 44,  0,138,  0,  2,  0,193,  8,  2,  0, 72,  5,  2,  0,194,  8,
+  2,  0,195,  8, 43,  1, 12,  0, 43,  1,  0,  0, 43,  1,  1,  0,  4,  0, 28,  0,  4,  0,196,  8,  4,  0,197,  8,  4,  0,198,  8,
+ 38,  1,199,  8,  0,  0,192,  8, 42,  1,176,  3, 39,  1,200,  8, 40,  1,201,  8, 41,  1,202,  8, 44,  1, 12,  0,  0,  0, 35,  0,
+ 11,  0,227,  0,  0,  0,228,  0,  4,  0,231,  0,  4,  0,239,  0, 11,  0,232,  0,  7,  0,234,  0,  7,  0,235,  0, 11,  0,203,  8,
+ 11,  0,204,  8, 11,  0,236,  0, 11,  0,238,  0, 45,  1, 50,  0, 45,  1,  0,  0, 45,  1,  1,  0, 11,  0,205,  8, 11,  0, 25,  0,
+  0,  0, 19,  0,  4,  0, 18,  0,  4,  0, 16,  0,  4,  0, 22,  0,  4,  0, 90,  0,  4,  0,206,  8,  4,  0,207,  8,  4,  0,197,  8,
+  4,  0,198,  8,  4,  0,208,  8,  4,  0,250,  0,  4,  0,209,  8,  4,  0,210,  8,  7,  0,211,  8,  7,  0,212,  8,  7,  0,213,  8,
+  2,  0,214,  8,  2,  0,215,  8,  4,  0,216,  8,  4,  0,217,  8, 43,  1,218,  8, 31,  0, 80,  0, 41,  0,125,  0, 27,  0,219,  8,
+ 44,  0,138,  0,229,  0,105,  6,  7,  0,220,  8,  7,  0,221,  8, 44,  1, 71,  1, 45,  1,222,  8, 45,  1,223,  8, 45,  1,224,  8,
+ 14,  0,225,  8, 46,  1,226,  8, 11,  0,227,  8,  7,  0, 84,  4,  7,  0,228,  8,  7,  0,229,  8,  7,  0,230,  8, 11,  0,231,  8,
+  4,  0,232,  8,  4,  0,233,  8,  4,  0,234,  8,  7,  0,235,  8,  4,  0,129,  0,  4,  0, 27,  0, 47,  1,  4,  0, 47,  1,  0,  0,
+ 47,  1,  1,  0, 14,  0,236,  8, 45,  1,237,  8,226,  0, 11,  0, 14,  0,238,  8, 14,  0,225,  8, 14,  0,239,  8, 45,  1,240,  8,
+  0,  0,241,  8,  0,  0,242,  8,  4,  0,243,  8,  4,  0,244,  8,  4,  0,245,  8,  4,  0, 27,  0, 19,  0,246,  8, 48,  1,  4,  0,
+  7,  0,247,  8,  7,  0, 94,  3,  2,  0,248,  8,  2,  0,249,  8, 49,  1,  6,  0,  7,  0,250,  8,  7,  0,251,  8,  7,  0,252,  8,
+  7,  0,253,  8,  4,  0,254,  8,  4,  0,255,  8, 50,  1,  8,  0,  7,  0,  0,  9,  7,  0,  1,  9,  7,  0,  2,  9,  7,  0,  3,  9,
+  7,  0,  4,  9,  4,  0,250,  2,  4,  0,  5,  9,  4,  0,  6,  9, 51,  1,  2,  0,  7,  0,180,  5,  7,  0, 27,  0, 52,  1,  5,  0,
+  7,  0,  7,  9,  7,  0,  8,  9,  4,  0, 92,  0,  4,  0,212,  2,  4,  0,  9,  9, 53,  1,  6,  0, 53,  1,  0,  0, 53,  1,  1,  0,
+  2,  0, 16,  0,  2,  0, 18,  0,  2,  0, 10,  9,  2,  0, 56,  0, 54,  1,  8,  0, 54,  1,  0,  0, 54,  1,  1,  0,  2,  0, 16,  0,
+  2,  0, 18,  0,  2,  0, 10,  9,  2,  0, 56,  0,  7,  0, 22,  0,  7,  0,129,  0, 55,  1, 45,  0, 55,  1,  0,  0, 55,  1,  1,  0,
+  2,  0, 16,  0,  2,  0, 18,  0,  2,  0, 10,  9,  2,  0,246,  0,  2,  0,126,  4,  2,  0, 11,  9,  7,  0, 12,  9,  7,  0, 91,  0,
+  7,  0,  7,  3,  4,  0, 13,  9,  4,  0, 82,  0,  4,  0,214,  2,  7,  0, 14,  9,  7,  0, 15,  9,  7,  0, 16,  9,  7,  0, 17,  9,
+  7,  0, 18,  9,  7,  0, 19,  9,  7,  0,  4,  3,  7,  0, 68,  1,  7,  0, 20,  9,  7,  0, 21,  9,  7,  0, 27,  0,  7,  0, 22,  9,
+  7,  0, 23,  9,  7,  0, 24,  9,  2,  0, 25,  9,  2,  0, 26,  9,  2,  0, 27,  9,  2,  0, 28,  9,  2,  0, 29,  9,  2,  0, 30,  9,
+  2,  0, 31,  9,  2,  0, 32,  9,  2,  0, 32,  2,  2,  0, 33,  9,  2,  0, 29,  2,  2,  0, 34,  9,  0,  0, 35,  9,  0,  0, 36,  9,
+  7,  0,244,  0, 56,  1, 37,  9, 64,  0,250,  1, 57,  1, 16,  0, 57,  1,  0,  0, 57,  1,  1,  0,  2,  0, 16,  0,  2,  0, 18,  0,
+  2,  0, 10,  9,  2,  0,246,  0,  7,  0,255,  2,  7,  0,  0,  3,  7,  0,  1,  3,  7,  0, 82,  2,  7,  0,  2,  3,  7,  0,  3,  3,
+  7,  0, 38,  9,  7,  0,  4,  3,  7,  0,  6,  3,  7,  0,  7,  3,253,  0,  5,  0,  2,  0, 16,  0,  2,  0, 39,  9,  2,  0, 18,  0,
+  2,  0, 40,  9, 22,  0, 41,  7,252,  0,  3,  0,  4,  0, 69,  0,  4,  0, 41,  9,253,  0,  2,  0, 58,  1,  7,  0, 58,  1,  0,  0,
+ 58,  1,  1,  0,  0,  0, 19,  0,  2,  0, 16,  0,  2,  0, 18,  0,  4,  0, 21,  0, 11,  0, 42,  9, 59,  1,  5,  0,  0,  0, 19,  0,
+  7,  0, 94,  1,  7,  0, 43,  9,  4,  0, 44,  9,  4,  0, 27,  0, 60,  1,  4,  0,  2,  0, 16,  0,  2,  0, 18,  0,  2,  0, 67,  0,
+  2,  0, 30,  0, 61,  1,  4,  0,  0,  0, 19,  0, 63,  0, 45,  9,  7,  0, 94,  1,  7,  0, 27,  0, 62,  1,  6,  0,  2,  0, 46,  9,
+  2,  0, 47,  9,  2,  0, 16,  0,  2,  0, 48,  9,  0,  0, 49,  9,  0,  0, 50,  9, 63,  1,  5,  0,  4,  0, 16,  0,  4,  0, 27,  0,
+  0,  0, 19,  0,  0,  0, 51,  9,  0,  0, 52,  9, 64,  1,  3,  0,  4,  0, 16,  0,  4,  0, 27,  0,  0,  0, 19,  0, 65,  1,  4,  0,
+  2,  0, 53,  9,  2,  0, 54,  9,  2,  0, 18,  0,  2,  0, 27,  0, 66,  1,  6,  0,  0,  0, 19,  0,  0,  0, 55,  9,  2,  0, 56,  9,
+  2,  0,  4,  3,  2,  0, 87,  1,  2,  0, 30,  0, 67,  1,  5,  0,  0,  0, 19,  0,  7,  0, 94,  3,  7,  0,217,  4,  2,  0, 18,  0,
+  2,  0,226,  2, 68,  1,  3,  0,  0,  0, 19,  0,  4,  0,214,  2,  4,  0, 53,  9, 69,  1,  7,  0,  0,  0, 19,  0,  7,  0,217,  4,
+  0,  0, 57,  9,  0,  0, 58,  9,  2,  0, 87,  1,  2,  0, 67,  0,  4,  0, 59,  9, 70,  1,  4,  0,  0,  0, 60,  9,  0,  0, 61,  9,
+  4,  0, 16,  0,  7,  0,230,  2, 71,  1,  3,  0, 27,  0, 62,  9,  0,  0, 63,  9,  0,  0, 64,  9, 72,  1, 18,  0, 72,  1,  0,  0,
+ 72,  1,  1,  0,  2,  0, 16,  0,  2,  0, 65,  9,  2,  0, 18,  0,  2,  0, 66,  9,  2,  0, 67,  9,  2,  0, 68,  9,  2,  0, 67,  0,
+  2,  0, 30,  0,  0,  0, 19,  0, 11,  0,  2,  0, 73,  1, 69,  9, 27,  0, 44,  0,  2,  0,216,  5,  2,  0,176,  2,  2,  0, 70,  9,
+  2,  0, 27,  0, 74,  1, 11,  0,  0,  0, 19,  0,  0,  0, 16,  0,  0,  0, 71,  9,  2,  0, 18,  0,  2,  0,226,  2,  2,  0, 72,  9,
+  4,  0, 73,  9,  4,  0, 74,  9,  4,  0, 75,  9,  4,  0, 76,  9,  4,  0, 77,  9, 75,  1,  1,  0,  0,  0, 78,  9, 76,  1,  4,  0,
+ 37,  0,  5,  7,  0,  0, 20,  8,  4,  0, 87,  1,  4,  0, 18,  0, 73,  1, 18,  0, 73,  1,  0,  0, 73,  1,  1,  0, 73,  1, 79,  9,
+  2,  0, 16,  0,  2,  0, 18,  0,  2,  0, 80,  9,  2,  0, 68,  9,  2,  0, 65,  9,  2,  0, 81,  9,  2,  0, 30,  0,  2,  0,247,  1,
+  0,  0, 19,  0, 11,  0,  2,  0, 77,  1, 69,  9, 72,  1, 82,  9,  2,  0, 14,  0,  2,  0, 83,  9,  4,  0, 84,  9, 78,  1,  3,  0,
+  4,  0,240,  2,  4,  0, 27,  0, 27,  0, 44,  0, 79,  1, 15,  0,176,  0, 85,  9,  2,  0, 16,  0,  2,  0, 18,  0,  7,  0, 12,  9,
+  7,  0, 91,  0,  0,  0, 19,  0,  0,  0, 86,  9,  2,  0, 87,  9,  2,  0, 88,  9,  2,  0,134,  0,  2,  0, 89,  9,  2,  0, 90,  9,
+  2,  0, 27,  0,  7,  0, 91,  9,  7,  0, 92,  9, 80,  1,  8,  0,  7,  0, 93,  9,  7,  0, 94,  9,  7,  0, 95,  9,  7,  0, 96,  9,
+  7,  0, 97,  9,  7,  0, 98,  9,  7,  0, 99,  9,  7,  0,100,  9, 81,  1, 13,  0,  2,  0, 18,  0,  2,  0,101,  9,  4,  0, 67,  0,
+  4,  0, 30,  0,  2,  0,176,  6,  7,  0, 84,  4,  7,  0,228,  8, 46,  1,226,  8, 80,  1,102,  9,  2,  0, 16,  0,  2,  0,115,  5,
+  2,  0,216,  3,  2,  0,103,  9, 82,  1, 11,  0,  4,  0,240,  2,  2,  0, 16,  0,  2,  0, 18,  0, 27,  0, 44,  0, 79,  0,104,  9,
+  0,  0, 19,  0,  7,  0,105,  9,  7,  0,106,  9,  7,  0,222,  3,  2,  0,107,  9,  2,  0,108,  9, 83,  1,  5,  0,  2,  0, 16,  0,
+  2,  0, 67,  0,  4,  0, 27,  0, 41,  0,125,  0, 27,  0,208,  5, 84,  1,  5,  0,  4,  0, 27,  0,  4,  0, 16,  0,  0,  0, 19,  0,
+  0,  0, 51,  9, 27,  0, 44,  0, 85,  1, 13,  0,  2,  0, 18,  0,  2,  0, 16,  0,  2,  0, 65,  9,  2,  0,223,  3,  7,  0,109,  9,
+  7,  0,110,  9,  7,  0, 86,  1,  7,  0,111,  9,  7,  0,192,  3,  7,  0,196,  3,  7,  0,112,  9,  7,  0,113,  9, 27,  0,114,  9,
+ 86,  1, 10,  0,  2,  0, 18,  0,  2,  0, 16,  0,  7,  0, 12,  9,  7,  0, 91,  0,  0,  0, 19,  0,  0,  0, 86,  9,  2,  0, 67,  0,
+  2,  0, 30,  0,  2,  0,247,  1,  2,  0,115,  5, 87,  1,  8,  0, 27,  0, 44,  0,  7,  0,  1,  3,  7,  0,115,  9,  7,  0,116,  9,
+  7,  0,223,  3,  2,  0, 67,  0,  2,  0,226,  2,  7,  0, 30,  0, 88,  1, 12,  0,  2,  0, 16,  0,  2,  0, 87,  1,  2,  0, 18,  0,
+  2,  0,  4,  3,  2,  0,240,  2,  2,  0,117,  9,  4,  0, 27,  0,  7,  0,118,  9,  7,  0,119,  9,  7,  0,120,  9,  7,  0,121,  9,
+  0,  0,122,  9, 89,  1,  9,  0,  2,  0, 18,  0,  2,  0, 16,  0,  4,  0, 12,  9,  4,  0, 91,  0,  0,  0, 19,  0,  2,  0, 86,  1,
+  2,  0, 63,  0,  2,  0,123,  9,  2,  0,124,  9, 90,  1,  7,  0,  4,  0,214,  2,  4,  0,125,  9,  4,  0,126,  9,  4,  0,127,  9,
+  7,  0,128,  9,  7,  0,129,  9,  0,  0, 57,  9, 91,  1,  7,  0,  0,  0,130,  9, 27,  0,131,  9,  0,  0, 63,  9,  2,  0,132,  9,
+  2,  0, 67,  0,  4,  0, 30,  0,  0,  0, 64,  9, 92,  1,  6,  0,  2,  0, 18,  0,  2,  0, 16,  0,  4,  0, 12,  9,  4,  0, 91,  0,
+  0,  0,133,  9,  0,  0,134,  9, 93,  1,  1,  0,  4,  0, 18,  0, 94,  1,  6,  0,  0,  0, 94,  0,  2,  0, 16,  0,  2,  0, 18,  0,
+  4,  0,135,  9,  7,  0,136,  9, 37,  0,  5,  7, 95,  1,  4,  0,  0,  0,181,  2,  2,  0, 18,  0,  4,  0, 16,  0, 27,  0, 44,  0,
+ 96,  1,  2,  0,  4,  0, 16,  0,  4,  0,180,  6, 97,  1,  8,  0,  0,  0, 60,  9,  0,  0, 61,  9,  4,  0, 16,  0,  7,  0, 40,  2,
+  7,  0,137,  9,  7,  0, 27,  0, 27,  0, 70,  3, 27,  0,138,  9, 98,  1, 11,  0,  0,  0, 53,  6,  0,  0, 18,  0,  2,  0,139,  9,
+  4,  0, 16,  0,  7,  0, 94,  1,  7,  0,140,  9,  7,  0,141,  9,  7,  0,142,  9,  4,  0,143,  9, 27,  0, 70,  3, 27,  0,144,  9,
+ 77,  1, 10,  0, 77,  1,  0,  0, 77,  1,  1,  0, 77,  1, 79,  9,  2,  0, 16,  0,  2,  0, 18,  0,  2,  0, 65,  9,  2,  0,145,  9,
+  0,  0, 19,  0, 11,  0,  2,  0, 27,  0, 44,  0, 46,  1, 17,  0, 22,  0, 32,  0,  0,  0, 35,  0, 38,  0,153,  0, 11,  0,227,  0,
+ 38,  0,146,  9, 31,  0, 80,  0,  7,  0, 84,  4,  7,  0,147,  9,  7,  0,228,  8,  7,  0, 93,  9,  7,  0, 94,  9,  7,  0,148,  9,
+  4,  0, 92,  0,  4,  0, 27,  0, 11,  0,149,  9, 11,  0,150,  9, 11,  0,151,  9, 99,  1,  6,  0, 99,  1,  0,  0, 99,  1,  1,  0,
+ 27,  0, 44,  0, 11,  0,152,  9,  2,  0,251,  0,  0,  0,211,  2, 64,  0,  4,  0, 22,  0, 32,  0, 14,  0,153,  9,  4,  0,134,  0,
+  7,  0,154,  9,100,  1, 28,  0,100,  1,  0,  0,100,  1,  1,  0, 21,  0,155,  9,100,  1, 38,  0, 14,  0,156,  9,  0,  0, 19,  0,
+  7,  0,157,  9,  7,  0,158,  9,  7,  0,159,  9,  7,  0,160,  9,  4,  0, 18,  0,  7,  0,161,  9,  7,  0,162,  9,  7,  0,163,  9,
+  7,  0,164,  9,  7,  0, 94,  1,  7,  0, 40,  2,  7,  0,165,  9,  7,  0,212,  2,  7,  0,166,  9,  7,  0,167,  9,  7,  0,168,  9,
+  7,  0,169,  9,  7,  0,170,  9,  7,  0,176,  0,  4,  0,134,  0,  2,  0,253,  5,  2,  0,171,  9,101,  1, 27,  0, 22,  0, 32,  0,
+ 34,  0, 75,  0, 14,  0,172,  9, 14,  0,173,  9, 14,  0,174,  9,100,  1,175,  9, 11,  0,176,  9, 11,  0,177,  9,  4,  0, 18,  0,
+  4,  0,156,  6,  4,  0,178,  9,  4,  0, 27,  0,  2,  0,  8,  3,  2,  0,210,  6,  4,  0,179,  9,  4,  0,134,  0,  4,  0,180,  9,
+  2,  0,181,  9,  2,  0,182,  9,  2,  0,183,  9,  2,  0,184,  9,  4,  0,185,  9,  4,  0,186,  9,  4,  0,187,  9,  4,  0,188,  9,
+  4,  0,189,  9,  4,  0,190,  9,102,  1,  2,  0,  7,  0,165,  2,  4,  0, 18,  0,180,  0,  5,  0,102,  1,191,  9,  4,  0,212,  2,
+  4,  0,192,  9,  4,  0,193,  9,  4,  0, 18,  0,179,  0, 16,  0,  4,  0,194,  9,  4,  0,195,  9,  4,  0,196,  9,  4,  0,197,  9,
+  2,  0,198,  9,  2,  0,199,  9,  2,  0,200,  9,  2,  0,251,  0,  2,  0,201,  9,  2,  0,202,  9,  2,  0,203,  9,  2,  0,204,  9,
+  4,  0,205,  9,  4,  0,206,  9,  4,  0,207,  9,  4,  0,208,  9,103,  1, 40,  0,103,  1,  0,  0,103,  1,  1,  0, 21,  0,155,  9,
+ 14,  0,251,  3,  0,  0, 19,  0,  2,  0, 18,  0,  2,  0,209,  9,  2,  0,209,  3,  2,  0,210,  9,  0,  0,211,  9,  0,  0,212,  9,
+  0,  0,213,  9,100,  1,214,  9,103,  1, 38,  0,103,  1,215,  9, 14,  0,216,  9, 14,  0,217,  9,180,  0,184,  3, 27,  0,218,  9,
+103,  1,219,  9,  7,  0, 77,  1,  7,  0,176,  0,  7,  0,220,  9,  7,  0, 19,  2,  7,  0,198,  3,  7,  0,200,  3,  2,  0,232,  3,
+  2,  0, 27,  0,  7,  0,221,  9,  7,  0,222,  9,  7,  0,203,  3,  7,  0,223,  9,  7,  0,224,  9,  7,  0,225,  9,  7,  0,226,  9,
+  7,  0,227,  9,  7,  0,228,  9,  7,  0,229,  9,  7,  0,230,  9, 11,  0,231,  9,177,  0, 16,  0, 14,  0,232,  9, 74,  0,233,  9,
+  2,  0, 18,  0,  2,  0, 27,  0,  4,  0,234,  9,  4,  0, 67,  0,  7,  0, 84,  0,  7,  0,235,  9,  7,  0,236,  9, 14,  0,237,  9,
+  4,  0,238,  9,  4,  0,239,  9, 11,  0,240,  9, 11,  0,241,  9,179,  0,183,  3,  0,  0,242,  9,104,  1,  1,  0,  4,  0,239,  9,
+105,  1, 12,  0,  4,  0,239,  9,  7,  0, 77,  9,  2,  0,243,  9,  2,  0,244,  9,  7,  0,245,  9,  7,  0,246,  9,  2,  0,247,  9,
+  2,  0, 18,  0,  7,  0,248,  9,  7,  0,249,  9,  7,  0,250,  9,  7,  0,251,  9,106,  1,  7,  0,106,  1,  0,  0,106,  1,  1,  0,
+ 14,  0,252,  9,  4,  0, 18,  0,  4,  0,253,  9,  0,  0, 19,  0, 22,  1,254,  9,176,  0,  9,  0, 22,  0, 32,  0, 14,  0,255,  9,
+ 14,  0,232,  9, 14,  0,  0, 10, 14,  0,102,  0,  4,  0, 18,  0,  4,  0,  1, 10,  4,  0,  2, 10,  4,  0, 27,  0,243,  0,  8,  0,
+ 22,  0,  3, 10, 14,  0,232,  9, 64,  0,  4, 10,  0,  0,  5, 10,  4,  0,  6, 10,  4,  0, 18,  0,  4,  0,  7, 10,  4,  0, 27,  0,
+107,  1, 13,  0,239,  0,  0,  0,239,  0,  1,  0, 14,  0,145,  6,  4,  0,146,  6,  7,  0,147,  6,  2,  0,148,  6,240,  0,199,  6,
+176,  0,179,  3,243,  0,  8, 10,  0,  0, 87,  1,  0,  0,202,  6,  2,  0, 18,  0,  7,  0,  9, 10,108,  1,  8,  0,108,  1,  0,  0,
+108,  1,  1,  0,106,  1, 10, 10, 31,  0, 80,  0, 14,  0,185,  3,  4,  0, 18,  0,  0,  0, 19,  0,  4,  0,117,  8,109,  1,  5,  0,
+109,  1,  0,  0,109,  1,  1,  0, 31,  0, 80,  0,  2,  0, 18,  0,  0,  0, 11, 10,110,  1, 14,  0,110,  1,  0,  0,110,  1,  1,  0,
+ 11,  0,  2,  0,  2,  0, 16,  0,  2,  0, 18,  0,  0,  0, 12, 10,  0,  0, 13, 10,  0,  0, 19,  0,  2,  0, 27,  0,  7,  0, 14, 10,
+  7,  0, 15, 10, 31,  0, 80,  0,  7,  0, 16, 10,  7,  0, 17, 10,111,  1,  9,  0,111,  1,  0,  0,111,  1,  1,  0, 27,  0, 18, 10,
+  0,  0, 11,  3,  7,  0, 19, 10,  2,  0, 20, 10,  2,  0, 18,  0,  2,  0, 16,  0,  2,  0, 21, 10,112,  1,  7,  0, 37,  0,  5,  7,
+ 21,  0,155,  9,  4,  0, 18,  0,  4,  0, 22, 10, 14,  0, 23, 10, 27,  0, 18, 10,  0,  0, 11,  3,113,  1, 15,  0, 27,  0, 18, 10,
+  2,  0, 24, 10,  2,  0, 18,  0,  2,  0, 25, 10,  2,  0, 26, 10,  0,  0, 11,  3, 27,  0, 27, 10,  0,  0, 28, 10,  7,  0, 29, 10,
+  7,  0, 40,  2,  7,  0, 30, 10,  7,  0, 31, 10,  2,  0, 16,  0,  2,  0, 87,  1,  7,  0, 94,  1,114,  1,  6,  0, 27,  0, 18, 10,
+  7,  0,191,  9,  2,  0, 32, 10,  2,  0, 33, 10,  2,  0, 18,  0,  2,  0, 34, 10,115,  1,  6,  0, 27,  0, 18, 10,  4,  0, 35, 10,
+  4,  0, 36, 10,  4,  0, 92,  0,  4,  0, 27,  0,  0,  0, 11,  3,116,  1,  4,  0, 27,  0, 18, 10,  4,  0, 18,  0,  4,  0, 35, 10,
+  0,  0, 11,  3,117,  1,  4,  0, 27,  0, 18, 10,  4,  0, 18,  0,  4,  0, 35, 10,  0,  0, 11,  3,118,  1,  4,  0, 27,  0, 18, 10,
+  4,  0, 18,  0,  4,  0, 35, 10,  0,  0, 11,  3,119,  1,  2,  0,  4,  0, 18,  0,  7,  0, 84,  4,120,  1,  2,  0, 27,  0, 18, 10,
+  0,  0, 11,  3,121,  1, 10,  0, 27,  0, 18, 10,  4,  0, 37, 10,  7,  0,128,  0,  4,  0, 18,  0,  2,  0,  3,  7,  2,  0, 38, 10,
+  2,  0, 67,  0,  2,  0, 30,  0,  7,  0, 39, 10,  0,  0, 11,  3,122,  1, 10,  0, 27,  0, 18, 10,  2,  0, 16,  0,  2,  0,134,  4,
+  4,  0, 90,  0,  4,  0, 91,  0,  7,  0,115,  9,  7,  0,116,  9,  4,  0, 27,  0,176,  0, 85,  9,  0,  0, 11,  3,123,  1,  4,  0,
+ 27,  0, 18, 10,  4,  0,210,  3,  4,  0, 40, 10,  0,  0, 11,  3,124,  1,  4,  0, 27,  0, 18, 10,  4,  0,210,  3,  4,  0, 27,  0,
+  0,  0, 11,  3,125,  1,  6,  0, 27,  0, 18, 10,  7,  0,128,  0,  7,  0, 82,  3,  4,  0, 41, 10,  2,  0,210,  3,  2,  0,211,  3,
+126,  1,  6,  0, 27,  0, 18, 10,  4,  0, 42, 10,  4,  0, 43, 10,  7,  0, 44, 10,  7,  0, 45, 10,  0,  0, 11,  3,127,  1, 16,  0,
+ 27,  0, 18, 10, 27,  0,215,  9,  4,  0, 16,  0,  7,  0, 46, 10,  7,  0, 47, 10,  7,  0, 48, 10,  7,  0, 49, 10,  7,  0, 50, 10,
+  7,  0, 51, 10,  7,  0, 52, 10,  7,  0, 53, 10,  7,  0, 54, 10,  2,  0, 18,  0,  2,  0, 27,  0,  2,  0, 67,  0,  2,  0, 30,  0,
+128,  1,  3,  0, 27,  0, 18, 10,  4,  0, 18,  0,  4,  0, 32,  2,129,  1,  5,  0, 27,  0, 18, 10,  4,  0, 18,  0,  4,  0, 27,  0,
+  7,  0, 55, 10,  0,  0, 11,  3,130,  1, 10,  0, 27,  0, 18, 10,  0,  0, 11,  3,  2,  0, 56, 10,  2,  0, 57, 10,  0,  0, 58, 10,
+  0,  0, 59, 10,  7,  0, 60, 10,  7,  0, 61, 10,  7,  0, 62, 10,  7,  0, 63, 10,131,  1,  5,  0, 27,  0, 18, 10,  0,  0, 11,  3,
+  7,  0,220,  2,  2,  0, 64, 10,  2,  0, 18,  0,132,  1,  8,  0,  7,  0,  8,  0,  7,  0,  9,  0,  7,  0, 10,  0,  7,  0, 11,  0,
+  7,  0, 65, 10,  7,  0, 66, 10,  2,  0, 18,  0,  2,  0, 32,  2,133,  1,  8,  0,  7,  0,  8,  0,  7,  0,  9,  0,  7,  0, 10,  0,
+  7,  0, 11,  0,  7,  0, 65, 10,  7,  0, 66, 10,  2,  0, 18,  0,  2,  0, 32,  2,134,  1,  8,  0,  7,  0,  8,  0,  7,  0,  9,  0,
+  7,  0, 10,  0,  7,  0, 11,  0,  7,  0, 65, 10,  7,  0, 66, 10,  2,  0, 18,  0,  2,  0, 32,  2,135,  1,  7,  0, 27,  0, 18, 10,
+  0,  0, 11,  3,  7,  0, 94,  1,  7,  0,103,  1,  2,  0, 18,  0,  2,  0, 87,  1,  4,  0, 27,  0,136,  1,  5,  0, 27,  0, 70,  3,
+  7,  0, 94,  1,  2,  0, 74,  3,  0,  0, 76,  3,  0,  0, 67, 10,137,  1,  7,  0,229,  0,105,  6,  0,  0, 68, 10,  4,  0, 18,  0,
+  4,  0, 27,  0,  0,  0, 69, 10, 27,  0,208,  5, 27,  0, 70, 10,138,  1,  3,  0,229,  0,105,  6,  4,  0, 18,  0,  4,  0, 27,  0,
+139,  1,  6,  0,229,  0,105,  6,  4,  0, 18,  0,  4,  0, 27,  0,  0,  0, 69, 10,  7,  0, 55, 10, 27,  0,208,  5,140,  1, 10,  0,
+140,  1,  0,  0,140,  1,  1,  0,  2,  0, 16,  0,  2,  0, 18,  0,  0,  0, 71, 10,  7,  0, 31,  1,  7,  0, 32,  1,  2,  0,252,  9,
+  2,  0, 72, 10, 27,  0, 44,  0,141,  1, 22,  0,141,  1,  0,  0,141,  1,  1,  0,  2,  0, 18,  0,  2,  0, 87,  1,  2,  0, 73, 10,
+  2,  0, 74, 10, 31,  0, 80,  0,176,  0, 85,  9, 27,  0,168,  0,  7,  0, 90,  0,  7,  0, 91,  0,  7,  0, 75, 10,  7,  0, 76, 10,
+  7,  0, 77, 10,  7,  0, 78, 10,  7,  0,253,  2,  7,  0,148,  3,  7,  0, 87,  9,  7,  0, 79, 10,  0,  0, 80, 10,  0,  0, 81, 10,
+ 14,  0,188,  3,142,  1, 11,  0,  7,  0, 47,  2,  7,  0,115,  9,  7,  0,116,  9, 11,  0,  2,  0,  2,  0, 82, 10,  2,  0, 83, 10,
+  2,  0, 84, 10,  2,  0, 85, 10,  2,  0, 86, 10,  2,  0, 87, 10,  2,  0,181,  2,143,  1, 21,  0,143,  1,  0,  0,143,  1,  1,  0,
+143,  1, 88, 10,  0,  0, 19,  0, 11,  0, 89, 10,  2,  0, 16,  0,  2,  0, 18,  0,  2,  0, 90, 10,  2,  0, 91, 10,  7,  0, 92, 10,
+  7,  0, 93, 10, 11,  0, 94, 10,  2,  0, 95, 10,  2,  0, 96, 10,  4,  0,247,  1, 11,  0,149,  9,  4,  0, 97, 10,  4,  0, 98, 10,
+143,  1, 99, 10,144,  1,100, 10,142,  1,101, 10,145,  1,  4,  0,  0,  0,102, 10,  2,  0,103, 10,  2,  0,104, 10,  4,  0, 27,  0,
+146,  1, 37,  0,146,  1,  0,  0,146,  1,  1,  0,146,  1,105, 10,  0,  0, 19,  0,  2,  0, 16,  0,  2,  0, 18,  0,  2,  0,196,  8,
+  2,  0,176,  2,  2,  0,106, 10,  2,  0,  8,  7,  2,  0, 95, 10,  2,  0, 39,  9, 14,  0, 80,  9, 14,  0,107, 10,146,  1, 38,  0,
+ 22,  0, 41,  7, 11,  0, 89, 10,  7,  0, 92, 10,  7,  0, 93, 10,  7,  0, 82,  2,  7,  0,  1,  3,  7,  0,108, 10,  4,  0,109, 10,
+  0,  0,110, 10,  2,  0,111, 10,  2,  0,112, 10,  7,  0,113, 10,  7,  0,114, 10,  2,  0,115, 10,  2,  0,116, 10, 11,  0,117, 10,
+ 19,  0,118, 10, 19,  0,119, 10, 19,  0,120, 10,145,  1,154,  0,147,  1,121, 10,148,  1,122, 10,144,  1,  8,  0,144,  1,  0,  0,
+144,  1,  1,  0,146,  1,123, 10,146,  1,124, 10,143,  1,125, 10,143,  1,126, 10,  4,  0, 18,  0,  4,  0, 27,  0, 57,  0, 20,  0,
+ 22,  0, 32,  0, 34,  0, 75,  0,178,  0,182,  3, 14,  0,127, 10, 14,  0,128, 10,  4,  0, 16,  0,  4,  0,129, 10,  4,  0,130, 10,
+  4,  0, 18,  0,  4,  0,109, 10,  4,  0,131, 10, 14,  0, 80,  9, 14,  0,107, 10,149,  1,132, 10, 11,  0,133, 10, 11,  0,134, 10,
+  4,  0,135, 10, 11,  0,136, 10, 11,  0,137, 10, 11,  0,138, 10,150,  1,  4,  0,  4,  0, 17,  0,  4,  0,230,  2,  4,  0,115,  9,
+  4,  0,116,  9,151,  1,  4,  0,  4,  0, 17,  0,  7,  0,230,  2,  7,  0,115,  9,  7,  0,116,  9,152,  1,  2,  0,  0,  0,230,  2,
+  0,  0, 86,  1,153,  1,  4,  0,  4,  0, 17,  0,  7,  0,139, 10,  7,  0,115,  9,  7,  0,116,  9,154,  1,  1,  0,  7,  0,140, 10,
+155,  1,  6,  0,  4,  0,127,  0,  4,  0,129,  0,  4,  0, 39,  9,  0,  0,141, 10,  0,  0,142, 10,  2,  0, 27,  0,156,  1, 16,  0,
+  2,  0,140,  8,  2,  0,141,  8,  2,  0,143, 10,  2,  0,144, 10,  2,  0,145, 10,  2,  0, 68,  0,  2,  0, 42,  7,  2,  0,146, 10,
+  7,  0,252,  2,  7,  0,147, 10,  7,  0,148, 10,  2,  0,109,  1,  0,  0,149, 10,  0,  0,150, 10,  4,  0,151, 10,  4,  0,152, 10,
+157,  1,  9,  0,  7,  0,153, 10,  7,  0,154, 10,  7,  0,148,  9,  7,  0, 94,  3,  7,  0,155, 10,  7,  0,217,  6,  2,  0, 92,  3,
+  0,  0,156, 10,  0,  0, 27,  0,158,  1,  4,  0,  7,  0,157, 10,  7,  0,158, 10,  2,  0, 92,  3,  2,  0, 27,  0,159,  1,  3,  0,
+  7,  0,159, 10,  7,  0,211,  8,  7,  0, 14,  0,160,  1,  4,  0,  0,  0, 35,  0,204,  0, 80,  5,  4,  0,129,  0,  4,  0,132,  4,
+161,  1,  6,  0,  0,  0,160, 10,204,  0,161, 10,  4,  0,129,  0,  4,  0,132,  4,  4,  0,162, 10,  4,  0, 27,  0,162,  1,  4,  0,
+  2,  0,163, 10,  2,  0,164, 10,  4,  0, 30,  0,204,  0,161, 10,163,  1,  9,  0,  7,  0,165, 10,  7,  0,166, 10,  7,  0,167, 10,
+  7,  0, 93,  2,  7,  0,168, 10,  7,  0,169, 10,  7,  0,170, 10,  2,  0,171, 10,  2,  0,172, 10,164,  1,  8,  0,  2,  0,173, 10,
+  2,  0,174, 10,  2,  0,175, 10,  2,  0,176, 10,  7,  0,177, 10,  7,  0,178, 10,  7,  0,179, 10,  7,  0,180, 10,165,  1,  2,  0,
+  7,  0,  5,  0,  7,  0,  6,  0,166,  1,  2,  0,  0,  0,170,  0,  0,  0,181, 10,167,  1,  1,  0,  0,  0, 19,  0,168,  1, 12,  0,
+  0,  0,182, 10,  0,  0,183, 10,  0,  0,208,  6,  0,  0,184, 10,  2,  0,143, 10,  2,  0,185, 10,  7,  0,186, 10,  7,  0,187, 10,
+  7,  0,188, 10,  7,  0,148,  3,  7,  0,189, 10,  7,  0,190, 10,169,  1,  2,  0, 11,  0,191, 10, 11,  0,192, 10,170,  1, 13,  0,
+  0,  0, 72,  5,  0,  0, 16,  0,  0,  0, 92,  3,  0,  0, 94,  3,  0,  0,183, 10,  0,  0,108,  0,  0,  0,181,  2,  7,  0,193, 10,
+  7,  0,194, 10,  7,  0,147,  3,  7,  0,195, 10,  7,  0,196, 10,  7,  0,190, 10,171,  1,  8,  0,  7,  0, 46,  9,  7,  0,128,  0,
+  7,  0,150, 10,  7,  0,172,  2,  7,  0,197, 10,  7,  0,240,  0,  7,  0,198, 10,  4,  0, 16,  0,172,  1,  4,  0,  2,  0,199, 10,
+  2,  0,200, 10,  2,  0,201, 10,  2,  0, 27,  0,173,  1,  8,  0,  7,  0,202, 10,  7,  0,220,  2,  7,  0,203, 10,  7,  0,189,  8,
+  7,  0,190,  8,  7,  0,191,  8,  7,  0,204, 10,  7,  0,205, 10,174,  1,  6,  0,  2,  0,206, 10,  2,  0,207, 10,  7,  0,208, 10,
+  7,  0,209, 10,  7,  0,210, 10,  7,  0,211, 10,175,  1,  2,  0, 58,  0,212, 10, 59,  0,213, 10,176,  1,  3,  0,175,  1, 78,  6,
+  7,  0,214, 10,  7,  0,215, 10,177,  1,  3,  0,175,  1, 78,  6,  4,  0,216, 10,  4,  0, 27,  0,178,  1,  1,  0,175,  1, 78,  6,
+179,  1,  3,  0,175,  1, 78,  6,  4,  0,216, 10,  4,  0,217, 10,180,  1,  3,  0,175,  1, 78,  6,  4,  0,218, 10,  4,  0, 27,  0,
+181,  1,  1,  0,175,  1, 78,  6,182,  1,  3,  0,175,  1, 78,  6,  4,  0,219, 10,  4,  0, 27,  0,183,  1,  3,  0,175,  1, 78,  6,
+  4,  0,220, 10,  4,  0, 27,  0,184,  1,  3,  0,175,  1, 78,  6,  4,  0,221, 10,  4,  0, 27,  0,185,  1,  3,  0,175,  1, 78,  6,
+  4,  0,250,  0,  4,  0, 27,  0,186,  1,  1,  0,  0,  0, 19,  0,187,  1,  1,  0,  0,  0, 19,  0,188,  1,  4,  0,  7,  0,  5,  0,
+  7,  0,  6,  0,  2,  0, 18,  0,  2,  0,222, 10,189,  1, 10,  0,  2,  0, 62,  4,  2,  0, 18,  0,  7,  0,217,  4,  7,  0,223, 10,
+  7,  0,224, 10,  7,  0,225, 10,  7,  0,226, 10,188,  1,227, 10,188,  1,228, 10,188,  1,229, 10, 54,  0, 11,  0,  4,  0, 18,  0,
+  4,  0, 63,  0,  4,  0,230, 10,  4,  0,231, 10, 19,  0,232, 10, 19,  0,233, 10,189,  1,234, 10,  7,  0,235, 10,  7,  0,236, 10,
+  7,  0,237, 10,  7,  0,238, 10,  0,  1, 10,  0,  4,  0,252,  9,  4,  0,239, 10,  7,  0,240, 10,  7,  0,241, 10,  7,  0,242, 10,
+  7,  0,243, 10,  7,  0,  9,  0,  7,  0, 11,  0,  4,  0, 87,  1,  4,  0,  1,  3,255,  0, 18,  0,  4,  0,132,  0,  4,  0,244, 10,
+  4,  0,245, 10,  7,  0,246, 10,  4,  0,247, 10,  7,  0,248, 10,  7,  0,249, 10,  4,  0,250, 10,  7,  0,251, 10,  4,  0,252, 10,
+  7,  0,253, 10,  0,  1,254, 10,  7,  0,255, 10,  7,  0,  0, 11,  7,  0,  1, 11,  7,  0,  2, 11,  4,  0,  3, 11,  4,  0, 27,  0,
+190,  1,  4,  0, 42,  0,244,  2,  7,  0,  4, 11,  7,  0,178,  1,  7,  0, 27,  0,213,  0, 34,  0, 22,  0, 32,  0,190,  1,  5, 11,
+ 54,  0,227, 10, 46,  0,  6, 11, 52,  0,  7, 11, 25,  0,154,  0,  0,  0,  8, 11,  7,  0,  9, 11,  2,  0,108,  6,  2,  0, 10, 11,
+  4,  0,108,  0,  4,  0, 18,  0,  7,  0, 11, 11,  4,  0, 90,  2,  4,  0, 12, 11,  7,  0, 13, 11,  7,  0, 14, 11,  7,  0, 15, 11,
+  7,  0,178,  1,  4,  0, 16, 11,  7,  0, 17, 11,  0,  0, 18, 11,  0,  0, 19, 11,  0,  0, 20, 11,  0,  0, 21, 11,  7,  0, 22, 11,
+  7,  0, 23, 11,  7,  0, 24, 11,  7,  0,  1,  3,  7,  0, 25, 11,  4,  0, 26, 11,  7,  0,240,  5,  7,  0, 27, 11,  7,  0, 28, 11,
+191,  1, 10,  0,  4,  0, 16,  0,  4,  0,128,  0,  4,  0, 18,  0,  4,  0, 15,  4,  4,  0, 29, 11,  4,  0, 30, 11,  4,  0, 31, 11,
+  4,  0, 70,  0,  0,  0, 19,  0, 11,  0,  2,  0,192,  1,  1,  0,  0,  0, 69,  7, 95,  0,  8,  0,191,  1, 32, 11,  4,  0, 33, 11,
+  4,  0, 34, 11,  4,  0, 35, 11,  4,  0, 36, 11,  4,  0, 30,  0, 11,  0, 37, 11,192,  1, 38, 11,193,  1,  5,  0,  7,  0,165,  2,
+  7,  0,240,  2,  7,  0, 40,  2,  2,  0,147,  2,  2,  0, 27,  0,194,  1,  5,  0,  7,  0,165,  2,  7,  0,159,  4,  7,  0, 39, 11,
+  7,  0, 40, 11,  7,  0,240,  2,195,  1,  5,  0, 27,  0, 41, 11,196,  1, 21,  0,  7,  0, 74,  6,  7,  0, 42, 11,  7,  0, 56,  0,
+197,  1,  3,  0,  7,  0, 43, 11,  4,  0, 44, 11,  4,  0, 45, 11,198,  1,  7,  0,  4,  0, 46, 11,  4,  0, 47, 11,  4,  0, 48, 11,
+  7,  0, 49, 11,  7,  0, 50, 11,  7,  0, 51, 11,  7,  0, 56,  0,199,  1,  8,  0,199,  1,  0,  0,199,  1,  1,  0, 27,  0, 44,  0,
+  4,  0,  3,  1,  2,  0, 18,  0,  2,  0, 87,  1,  7,  0,240,  2,  7,  0, 54,  9,200,  1,  7,  0,200,  1,  0,  0,200,  1,  1,  0,
+ 27,  0, 44,  0,  2,  0,225,  2,  2,  0, 18,  0,  2,  0, 14,  2,  2,  0, 56,  0,201,  1, 17,  0,194,  1,  8,  4,194,  1, 52, 11,
+193,  1, 53, 11,194,  1, 37,  9,195,  1, 54, 11,  4,  0, 82,  0,  7,  0,240,  2,  7,  0,  7,  3,  7,  0, 55, 11,  4,  0, 46, 11,
+  4,  0, 56, 11,  7,  0, 50, 11,  7,  0, 51, 11,  7,  0,108,  0,  4,  0, 57, 11,  2,  0, 18,  0,  2,  0, 58, 11,202,  1, 15,  0,
+  7,  0,255,  0,  7,  0, 59, 11,  7,  0, 43, 11,  7,  0, 60, 11,  7,  0, 61, 11,  7,  0, 62, 11,  7,  0, 63, 11,  7,  0, 64, 11,
+  7,  0, 65, 11,  7,  0, 66, 11,  7,  0, 67, 11,  7,  0, 68, 11,  7,  0, 69, 11,  4,  0, 18,  0,  4,  0, 70, 11,203,  1,128,  0,
+ 22,  0, 32,  0, 34,  0, 75,  0,204,  1, 71, 11,202,  1, 72, 11,187,  0,154,  4,  4,  0, 18,  0,  4,  0, 56,  0,  2,  0, 16,  0,
+  2,  0, 56, 10,  2,  0, 73, 11,  2,  0,122,  1,  2,  0, 74, 11,  2,  0,232,  3,  2,  0, 75, 11,  2,  0, 76, 11,  2,  0, 77, 11,
+  2,  0, 78, 11,  2,  0, 79, 11,  2,  0, 80, 11,  2,  0, 81, 11,  2,  0, 82, 11,  2,  0, 83, 11,  2,  0,224,  5,  2,  0, 84, 11,
+  2,  0, 85, 11,  2,  0, 86, 11,  2,  0, 87, 11,  2,  0, 88, 11,  2,  0, 29,  2,  2,  0, 30,  9,  2,  0,  5,  9,  2,  0, 89, 11,
+  2,  0, 90, 11,  2,  0, 25,  4,  2,  0, 26,  4,  2,  0, 91, 11,  2,  0, 92, 11,  2,  0, 93, 11,  2,  0, 94, 11,  7,  0, 95, 11,
+  7,  0, 96, 11,  7,  0, 97, 11,  7,  0, 98, 11,  7,  0, 99, 11,  7,  0,100, 11,  7,  0,101, 11,  2,  0,154,  5,  2,  0,102, 11,
+  7,  0,103, 11,  7,  0,104, 11,  7,  0,105, 11,  7,  0, 12,  9,  7,  0, 91,  0,  7,  0,  7,  3,  7,  0, 18,  9,  7,  0,106, 11,
+  7,  0,107, 11,  7,  0,108, 11,  7,  0,109, 11,  7,  0,110, 11,  7,  0,111, 11,  4,  0, 13,  9,  4,  0, 11,  9,  4,  0,112, 11,
+  4,  0,113, 11,  2,  0,114, 11,  2,  0,115, 11,  7,  0, 14,  9,  7,  0, 15,  9,  7,  0, 16,  9,  7,  0,116, 11,  7,  0,117, 11,
+  7,  0,118, 11,  7,  0,119, 11,  7,  0,120, 11,  7,  0,121, 11,  7,  0,122, 11,  7,  0,123, 11,  7,  0,124, 11,  7,  0,222,  3,
+  7,  0,108,  0,  7,  0,125, 11,  7,  0,126, 11,  7,  0,127, 11,  7,  0,128, 11,  7,  0,214,  0,  7,  0,129, 11,  4,  0,130, 11,
+  4,  0,131, 11,  7,  0,132, 11,  7,  0,133, 11,  7,  0,134, 11,  7,  0,135, 11,  7,  0,136, 11,  7,  0,213,  0,  7,  0,137, 11,
+  7,  0, 52,  4,  7,  0, 50,  4,  7,  0, 51,  4,  7,  0,138, 11,  7,  0,139, 11,  7,  0,140, 11,  7,  0,141, 11,  7,  0,142, 11,
+  7,  0,143, 11,  7,  0,144, 11,  7,  0,145, 11,  7,  0,146, 11,  7,  0,147, 11,  7,  0,148, 11,  7,  0,149, 11,  7,  0,150, 11,
+  7,  0,151, 11,  7,  0,152, 11,  7,  0,153, 11,  7,  0,154, 11,  7,  0,155, 11,  4,  0,156, 11,  4,  0,157, 11, 46,  0,140,  1,
+ 64,  0,  0,  4, 14,  0,158, 11, 64,  0,159, 11, 27,  0,160, 11, 27,  0,161, 11, 31,  0, 80,  0,182,  0, 73,  1,182,  0,162, 11,
+150,  0, 52,  0,150,  0,  0,  0,150,  0,  1,  0,203,  1,163, 11,201,  1,164, 11,198,  1,215,  9,190,  0, 80,  4, 11,  0, 81,  4,
+205,  1,165, 11,205,  1,166, 11, 14,  0,167, 11, 14,  0,168, 11,135,  0,169, 11,143,  0,170, 11,143,  0,171, 11, 27,  0,172, 11,
+ 27,  0,173, 11, 27,  0, 38,  0, 14,  0, 23, 10,  0,  0, 19,  0,  7,  0,244,  0,  7,  0, 36,  3,  7,  0,174, 11,  7,  0,175, 11,
+  4,  0,214,  2,  4,  0,176, 11,  4,  0, 18,  0,  4,  0, 13,  9,  4,  0,177, 11,  4,  0,178, 11,  4,  0,179, 11,  4,  0,180, 11,
+  2,  0,251,  0,  2,  0,181, 11,  2,  0,182, 11,  2,  0,183, 11,  0,  0,184, 11,  2,  0,185, 11,  2,  0,186, 11,  2,  0,187, 11,
+ 11,  0,188, 11,139,  0,153,  4, 14,  0, 21,  3, 14,  0,189, 11,197,  1,190, 11,  4,  0,191, 11,  4,  0,192, 11,206,  1,193, 11,
+141,  0, 33,  3,207,  1,194, 11,  7,  0,195, 11,  7,  0,196, 11,  7,  0,197, 11,137,  0, 38,  0,208,  1,149,  9,  7,  0,123,  4,
+  7,  0,198, 11,  7,  0,199, 11,  7,  0, 74,  6,  7,  0,236,  3,  7,  0,222,  3,  7,  0,200, 11,  7,  0, 92,  2,  7,  0,201, 11,
+  7,  0,202, 11,  7,  0,203, 11,  7,  0,204, 11,  7,  0,205, 11,  7,  0,206, 11,  7,  0,124,  4,  7,  0,207, 11,  7,  0,208, 11,
+  7,  0,209, 11,  7,  0,125,  4,  7,  0,121,  4,  7,  0,122,  4,  7,  0,210, 11,  7,  0,211, 11,  7,  0,212, 11,  4,  0,213, 11,
+  4,  0, 92,  0,  4,  0,214, 11,  4,  0,215, 11,  2,  0,216, 11,  2,  0,217, 11,  2,  0,218, 11,  2,  0,219, 11,  2,  0,220, 11,
+  2,  0,221, 11,  2,  0,222, 11,  2,  0, 27,  0,187,  0,154,  4,138,  0, 11,  0,208,  1,223, 11,  7,  0,224, 11,  7,  0,225, 11,
+  7,  0,251,  1,  7,  0,226, 11,  7,  0,227, 11,  7,  0,228, 11,  4,  0, 92,  0,  2,  0,229, 11,  2,  0,230, 11, 64,  0,250,  1,
+209,  1,  4,  0,  7,  0,  5,  0,  7,  0,  6,  0,  7,  0,  7,  0,  7,  0,231, 11,210,  1,  6,  0,210,  1,  0,  0,210,  1,  1,  0,
+209,  1,191,  9,  4,  0,  1,  1,  2,  0,232, 11,  2,  0, 18,  0,211,  1,  5,  0,211,  1,  0,  0,211,  1,  1,  0, 14,  0,233, 11,
+  4,  0,234, 11,  4,  0, 18,  0,212,  1,  9,  0,212,  1,  0,  0,212,  1,  1,  0, 14,  0,127,  0,211,  1,235, 11,  4,  0, 18,  0,
+  2,  0,232, 11,  2,  0,236, 11,  7,  0, 93,  0,  0,  0,237, 11,178,  0,  6,  0, 22,  0, 32,  0, 14,  0,123,  5,  4,  0, 18,  0,
+  2,  0,238, 11,  2,  0,239, 11, 11,  0,240, 11,213,  1,  6,  0, 14,  0,241, 11,  4,  0,242, 11,  4,  0,243, 11,  4,  0, 18,  0,
+  4,  0, 27,  0,237,  0,244, 11,214,  1, 19,  0, 22,  0, 32,  0,215,  1,245, 11,215,  1,246, 11, 14,  0,247, 11,  4,  0,248, 11,
+  2,  0,249, 11,  2,  0,250, 11, 14,  0,251, 11, 14,  0,252, 11,213,  1,253, 11, 14,  0,254, 11, 14,  0,255, 11, 14,  0,  0, 12,
+ 14,  0,  1, 12,216,  1,  2, 12,216,  1,  3, 12,216,  1,  4, 12, 14,  0,  5, 12,237,  0,  6, 12,215,  1, 32,  0,215,  1,  0,  0,
+215,  1,  1,  0, 11,  0,  7, 12,  4,  0,118,  8,  2,  0,  8, 12,  2,  0, 27,  0, 27,  1,  9, 12, 27,  1, 10, 12,  0,  0, 11, 12,
+  2,  0, 12, 12,  2,  0, 13, 12,  2,  0,140,  8,  2,  0,141,  8,  2,  0, 14, 12,  2,  0, 15, 12,  2,  0, 15,  4,  2,  0, 52,  7,
+  2,  0, 16, 12,  2,  0, 17, 12,  2,  0, 18, 12,  2,  0, 30,  0,217,  1, 19, 12,218,  1, 20, 12,219,  1, 21, 12,  4,  0, 22, 12,
+  4,  0, 23, 12, 11,  0, 24, 12, 14,  0,252, 11, 14,  0,159,  8, 14,  0, 25, 12, 14,  0, 26, 12, 14,  0, 27, 12,220,  1, 18,  0,
+220,  1,  0,  0,220,  1,  1,  0,  0,  0, 28, 12, 21,  0, 31,  0,  0,  0, 29, 12,  2,  0, 30, 12,  2,  0, 16,  0,  2,  0, 14,  0,
+  2,  0, 31, 12,  2,  0, 32, 12,  2,  0, 33, 12,  2,  0, 34, 12,  2,  0, 35, 12,  2,  0, 18,  0,  2,  0, 36, 12,  2,  0, 32,  0,
+  2,  0, 27,  0,221,  1, 37, 12,222,  1,  4,  0,222,  1,  0,  0,222,  1,  1,  0,220,  1, 38, 12,220,  1, 39, 12,223,  1, 11,  0,
+223,  1,  0,  0,223,  1,  1,  0, 14,  0, 40, 12, 14,  0, 41, 12,  0,  0, 28, 12,  2,  0, 42, 12,  2,  0, 43, 12,  2,  0, 18,  0,
+  2,  0, 44, 12,  4,  0, 45, 12, 11,  0, 46, 12,216,  1,  7,  0,216,  1,  0,  0,216,  1,  1,  0,  0,  0, 28, 12,  0,  0, 47, 12,
+ 14,  0, 58,  8,  4,  0, 48, 12,  4,  0, 18,  0,249,  0, 14,  0,249,  0,  0,  0,249,  0,  1,  0,  0,  0, 28, 12, 21,  0, 31,  0,
+224,  1,134,  8, 11,  0, 49, 12, 11,  0, 50, 12,221,  1, 37, 12,213,  1, 51, 12, 14,  0, 52, 12,249,  0, 53, 12, 32,  1,238,  6,
+  2,  0, 18,  0,  2,  0, 86,  1,225,  1, 12,  0,225,  1,  0,  0,225,  1,  1,  0, 11,  0,  2,  0, 11,  0, 54, 12,  0,  0, 19,  0,
+  2,  0, 16,  0,  2,  0, 18,  0,  7,  0,137,  9,  7,  0,129,  0,  7,  0,132,  4,  7,  0, 87,  9,  7,  0, 79, 10,226,  1,  5,  0,
+  7,  0, 55, 12,  4,  0, 56, 12,  4,  0, 57, 12,  4,  0, 87,  1,  4,  0, 18,  0,227,  1,  6,  0,  7,  0, 58, 12,  7,  0, 59, 12,
+  7,  0, 60, 12,  7,  0, 61, 12,  4,  0, 16,  0,  4,  0, 18,  0,228,  1,  5,  0,  7,  0,115,  9,  7,  0,116,  9,  7,  0,240,  2,
+  2,  0, 43,  2,  2,  0, 44,  2,229,  1,  5,  0,228,  1,  2,  0,  4,  0, 53,  0,  7,  0, 62, 12,  7,  0,115,  9,  7,  0,116,  9,
+230,  1,  4,  0,  2,  0, 63, 12,  2,  0, 64, 12,  2,  0, 65, 12,  2,  0, 66, 12,231,  1,  2,  0, 37,  0, 36,  7, 21,  0,155,  9,
+232,  1,  3,  0, 19,  0, 67, 12,  4,  0, 18,  0,  4,  0, 27,  0,233,  1,  6,  0,  7,  0,108,  0,  7,  0,209,  2,  7,  0, 68, 12,
+  7,  0, 27,  0,  2,  0,250,  0,  2,  0, 69, 12,234,  1,  5,  0,  7,  0, 70, 12,  7,  0,128,  0,  7,  0,192,  9,  7,  0,193,  9,
+  4,  0, 18,  0,235,  1,  6,  0, 22,  0, 41,  7,  0,  0, 71, 12,  0,  0, 72, 12,  2,  0, 73, 12,  2,  0, 18,  0,  4,  0, 74, 12,
+236,  1,  7,  0,236,  1,  0,  0,236,  1,  1,  0,  0,  0, 19,  0,235,  1, 75, 12,  2,  0, 76, 12,  2,  0, 16,  0,  7,  0, 60,  0,
+237,  1,  7,  0, 14,  0, 77, 12,  0,  0, 78, 12, 11,  0, 79, 12,  7,  0, 60,  0,  7,  0,137,  9,  4,  0, 16,  0,  4,  0, 18,  0,
+238,  1,  3,  0,  7,  0, 80, 12,  4,  0, 18,  0,  4,  0, 27,  0,239,  1, 15,  0,239,  1,  0,  0,239,  1,  1,  0,106,  1, 10, 10,
+237,  1, 61,  0, 14,  0,188,  3, 30,  0, 49,  0,238,  1, 81, 12,  4,  0, 53,  0,  7,  0, 60,  0,  2,  0, 18,  0,  2,  0, 22,  1,
+  4,  0, 82, 12,  0,  0, 71, 12,  4,  0, 83, 12,  7,  0, 84, 12,240,  1,  2,  0,  0,  0, 85, 12,  0,  0, 86, 12,241,  1,  4,  0,
+241,  1,  0,  0,241,  1,  1,  0,176,  0, 70,  3, 14,  0, 87, 12,242,  1, 25,  0,242,  1,  0,  0,242,  1,  1,  0, 14,  0, 88, 12,
+176,  0, 85,  9,241,  1, 89, 12, 14,  0, 90, 12, 14,  0,188,  3,  0,  0, 19,  0,  7,  0,137,  9,  7,  0, 91, 12,  7,  0, 90,  0,
+  7,  0, 91,  0,  7,  0, 75, 10,  7,  0, 76, 10,  7,  0,253,  2,  7,  0,148,  3,  7,  0, 87,  9,  7,  0, 79, 10,  2,  0, 92, 12,
+  2,  0, 93, 12,  2,  0, 67,  0,  2,  0, 16,  0, 11,  0, 94, 12,  4,  0, 18,  0,  4,  0, 30,  0,243,  1,  6,  0,243,  1,  0,  0,
+243,  1,  1,  0, 14,  0, 88, 12,  4,  0, 18,  0,  4,  0, 14,  2,  0,  0, 19,  0,244,  1, 11,  0,244,  1,  0,  0,244,  1,  1,  0,
+ 22,  0, 41,  7,  0,  0, 95, 12,  4,  0, 74, 12,  2,  0, 96, 12,  2,  0, 27,  0,  0,  0, 71, 12,  4,  0, 82, 12,  2,  0, 18,  0,
+  2,  0, 97, 12,245,  1, 10,  0,245,  1,  0,  0,245,  1,  1,  0, 14,  0, 98, 12,  0,  0, 28, 12,  0,  0, 19,  0,  0,  0, 99, 12,
+  0,  0,100, 12,  2,  0, 18,  0,  2,  0, 97, 12,  4,  0,101, 12,246,  1,  5,  0,246,  1,  0,  0,246,  1,  1,  0,  0,  0, 71, 12,
+  4,  0, 82, 12,  7,  0,230,  2, 34,  0, 12,  0,176,  0,179,  3,176,  0,102, 12,241,  1, 89, 12, 14,  0,103, 12,242,  1,104, 12,
+ 14,  0,105, 12, 14,  0,106, 12,  4,  0, 18,  0,  4,  0,251,  0,  2,  0,107, 12,  2,  0,108, 12,  7,  0,109, 12,247,  1,  2,  0,
+ 22,  0, 32,  0, 34,  0, 75,  0,248,  1,  5,  0,248,  1,  0,  0,248,  1,  1,  0,  4,  0, 16,  0,  4,  0, 18,  0,  0,  0,172,  5,
+249,  1,  6,  0,248,  1,110, 12, 27,  0, 44,  0,  4,  0,111, 12,  7,  0,112, 12,  4,  0,113, 12,  4,  0,252,  9,250,  1,  3,  0,
+248,  1,110, 12,  4,  0,111, 12,  7,  0,114, 12,251,  1,  8,  0,248,  1,110, 12, 27,  0, 44,  0,  7,  0, 77,  1,  7,  0,115, 12,
+  7,  0, 36,  3,  7,  0,148,  9,  4,  0,111, 12,  4,  0,116, 12,252,  1,  5,  0,248,  1,110, 12,  7,  0,117, 12,  7,  0,176,  2,
+  7,  0,  3,  3,  7,  0, 56,  0,253,  1,  3,  0,248,  1,110, 12,  7,  0,148,  9,  7,  0,118, 12,196,  1,  4,  0,  7,  0,119, 12,
+  7,  0,126, 11,  2,  0,120, 12,  2,  0, 87,  1,254,  1, 14,  0,254,  1,  0,  0,254,  1,  1,  0, 14,  0,121, 12, 14,  0,122, 12,
+ 14,  0,123, 12,  0,  0,172,  5,  4,  0, 32,  0,  4,  0, 18,  0,  4,  0,124, 12,  7,  0,125, 12,  4,  0,113, 12,  4,  0,252,  9,
+  7,  0, 84,  4,  7,  0,  5,  3,204,  1, 23,  0,  4,  0,111, 12,  4,  0,126, 12,  7,  0,127, 12,  7,  0,  1,  3,  7,  0,128, 12,
+  7,  0,228,  8,  7,  0,119, 12,  7,  0,129, 12,  7,  0,209,  2,  7,  0,246, 10,  7,  0,217,  4,  7,  0,130, 12,  7,  0,131, 12,
+  7,  0,132, 12,  7,  0,133, 12,  7,  0,134, 12,  7,  0,135, 12,  7,  0,136, 12,  7,  0,137, 12,  7,  0,138, 12,  7,  0,139, 12,
+  7,  0,140, 12, 14,  0,141, 12,123,  0, 40,  0,122,  0,142, 12,255,  1, 72, 11, 64,  0,143, 12, 64,  0,159, 11, 64,  0,144, 12,
+  0,  2,145, 12, 43,  0,169,  0, 43,  0,146, 12, 43,  0,147, 12,  7,  0,148, 12,  7,  0,149, 12,  7,  0,150, 12,  7,  0,151, 12,
+  7,  0,152, 12,  7,  0,117,  8,  7,  0,153, 12,  7,  0,178,  1,  7,  0,154, 12,  4,  0,155, 12,  4,  0,156, 12,  4,  0,157, 12,
+  4,  0, 92,  0,  4,  0, 27,  0,  4,  0,158, 12,  2,  0,159, 12,  2,  0,160, 12,  4,  0,161, 12,  7,  0,209,  2,  4,  0,162, 12,
+  7,  0,163, 12,  4,  0,164, 12,  4,  0,165, 12,  4,  0,166, 12,139,  0,167, 12, 14,  0,168, 12,187,  0,154,  4,  4,  0,169, 12,
+  7,  0,170, 12,  7,  0,171, 12,  4,  0, 30,  0,124,  0, 12,  0,122,  0,142, 12,150,  0, 56,  3,  7,  0,143,  1,  7,  0,117,  8,
+  7,  0,172, 12,  7,  0,173, 12,  7,  0,174, 12,  2,  0,175, 12,  2,  0,176, 12,  2,  0,177, 12,  2,  0, 16,  0,  4,  0, 92,  0,
+125,  0, 13,  0,122,  0,142, 12,141,  0, 33,  3,143,  0, 35,  3,  7,  0,191,  9,  7,  0,178, 12,  7,  0,179, 12,  7,  0, 79,  1,
+  7,  0,180, 12,  4,  0, 32, 10,  4,  0, 29,  3,  2,  0, 16,  0,  2,  0, 27,  0,  4,  0, 30,  0,  1,  2, 15,  0, 22,  0, 32,  0,
+ 34,  0, 75,  0, 46,  1,226,  8,  7,  0,181, 12,  7,  0,182, 12,  7,  0,183, 12,  7,  0,184, 12,  7,  0,147,  9,  7,  0,185, 12,
+  7,  0,186, 12,  7,  0,187, 12,  7,  0, 84,  4,  7,  0,228,  8,  2,  0, 18,  0,  2,  0,111,  9,231,  0,  3,  0,  4,  0,126,  0,
+  2,  0,214,  6,  2,  0,188, 12,  2,  2,  5,  0,  0,  0,192,  8,  2,  0,193,  8,  2,  0, 72,  5,  2,  0,189, 12,  2,  0,190, 12,
+229,  0, 16,  0, 22,  0, 32,  0, 34,  0, 75,  0,  0,  0, 35,  0,  4,  0,143,  0,  4,  0,144,  0,  4,  0,191, 12,  7,  0,162,  0,
+  7,  0,163,  0, 44,  0,138,  0,  3,  2,149,  9,178,  0,182,  3,  4,  2,192, 12, 11,  0,193, 12,  2,  2,194, 12,  4,  0, 18,  0,
+  4,  0, 22,  0, 13,  1, 10,  0,  4,  0,132,  0,  4,  0,195, 12, 52,  0,196, 12,  7,  0,197, 12,  2,  0,198, 12,  0,  0,181,  2,
+  4,  0,126,  0,  5,  2,175,  3,  6,  2,199, 12,  7,  0,200, 12,  7,  2,  3,  0,  4,  0,126,  0,  7,  0,201, 12,  7,  0, 79,  1,
+  8,  2, 11,  0, 11,  0,202, 12,  7,  0,203, 12,  7,  0,204, 12,  7,  0, 27,  0,  7,  0,205, 12,  2,  0,206, 12,  2,  0, 67,  0,
+  7,  0,207, 12,  7,  0,208, 12,  7,  0,209, 12,  7,  0,210, 12,  6,  2,  3,  0,  7,  0,211, 12,  4,  0,126,  0,  4,  0, 18,  0,
+  5,  2, 24,  0,  5,  2,  0,  0,  5,  2,  1,  0,  0,  0, 19,  0,  7,  0,212, 12,  7,  0,213, 12,  7,  0,214, 12,  7,  0,215, 12,
+  7,  0,  4, 11,  4,  0,216, 12,  4,  0,217, 12,  6,  2,218, 12,  7,  0,219, 12,  7,  0,201, 12,  4,  0, 18,  0,  4,  0,220, 12,
+  4,  0,221, 12,  7,  0, 84, 12,  2,  0,222, 12,  2,  0,227,  3,  2,  0,223, 12,  2,  0,224, 12,  2,  0,225, 12,  2,  0, 30,  0,
+  7,  0,226, 12,  9,  2, 22,  0,  4,  0, 18,  0,  2,  0,227, 12,  2,  0,228, 12,  7,  0,229, 12,  2,  0,230, 12,  2,  0,231, 12,
+  2,  0,232, 12,  2,  0,233, 12,  2,  0,234, 12,  2,  0,235, 12,  2,  0,236, 12,  2,  0,  3,  3,  4,  0,237, 12,  4,  0,238, 12,
+  2,  0,239, 12,  2,  0,240, 12,  7,  0, 94,  1,  4,  0,241, 12,  4,  0,242, 12,  7,  0,243, 12,  7,  0,244, 12,  4,  0,247,  1,
+ 10,  2, 12,  0,  4,  0, 18,  0,  4,  0,245, 12,  4,  0,246, 12,  7,  0,247, 12,  5,  2,248, 12,  7,  0,249, 12,  7,  0,250, 12,
+  7,  0,251, 12,  4,  0,190,  1,  4,  0,132,  0,  7,  0,148,  3, 52,  0,252, 12, 11,  2,  5,  0,  4,  0, 18,  0,  7,  0,201, 12,
+  4,  0,253, 12,  4,  0,254, 12,  7,  2,255, 12, 12,  2,  7,  0, 12,  2,  0,  0, 12,  2,  1,  0,  0,  0, 19,  0,  4,  0, 18,  0,
+  7,  0,148,  3, 14,  0,  0, 13, 11,  2,  1, 13, 13,  2,  1,  0,  0,  0,  2, 13,  4,  2, 10,  0,  9,  2,  3, 13,  8,  2,  4, 13,
+ 14,  0,  0, 13, 11,  2,  1, 13, 10,  2,  5, 13,  5,  2,  6, 13, 14,  0,  7, 13,  4,  0,  8, 13,  4,  0,  9, 13, 13,  2, 89,  6,
+ 14,  2, 48,  0, 14,  2,  0,  0, 14,  2,  1,  0,169,  0,145,  3, 15,  2,  2,  0, 64,  0, 10, 13,187,  0,154,  4,139,  0,153,  4,
+ 14,  0, 21,  3,  4,  0, 11, 13,  0,  0, 19,  0,  2,  0,161, 10,  2,  0, 16,  0,  2,  0, 12, 13,  2,  0, 13, 13,  2,  0, 14, 13,
+  2,  0, 15, 13,  2,  0, 16, 13,  2,  0, 17, 13,  4,  0, 92,  0,  4,  0,186,  3,  4,  0, 18, 13,  4,  0, 19, 13,  4,  0,192,  9,
+  4,  0,193,  9,  4,  0, 27,  0,  7,  0, 20, 13, 47,  0, 21, 13,  0,  0, 22, 13,  4,  0, 23, 13,  4,  0,161, 12,  7,  0, 24, 13,
+  7,  0, 25, 13,  7,  0, 26, 13,  7,  0, 27, 13,  7,  0, 28, 13,  7,  0, 29, 13,  7,  0, 30, 13,  7,  0, 31, 13,  7,  0, 32, 13,
+  7,  0, 33, 13,  7,  0, 34, 13,  7,  0, 35, 13,  7,  0, 36, 13,  7,  0, 37, 13,  0,  0,202,  2,  0,  0, 38, 13,  0,  0, 39, 13,
+  0,  0, 40, 13,169,  0,  7,  0,168,  0, 41, 13,143,  0, 35,  3, 14,  0, 42, 13,  2,  0, 43, 13,  2,  0, 92,  0,  4,  0, 27,  0,
+  0,  0, 44, 13,170,  0, 24,  0,168,  0, 41, 13,143,  0, 35,  3,150,  0, 56,  3, 63,  0, 26,  2,  4,  0, 92,  0,  4,  0, 45, 13,
+  7,  0,185,  0,  7,  0,186,  0,  7,  0,187,  0,  7,  0,178,  1,  7,  0, 46, 13,  7,  0, 47, 13,  7,  0, 48, 13,  7,  0, 49, 13,
+ 50,  0, 50, 13, 50,  0, 51, 13,  2,  0, 52, 13,  2,  0,221, 10,  2,  0, 53, 13,  2,  0, 27,  0,  7,  0, 54, 13,  7,  0, 55, 13,
+  7,  0, 56, 13,  7,  0, 57, 13, 69, 78, 68, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
   0};
 
diff --git a/source/blender/editors/gpencil/CMakeLists.txt b/source/blender/editors/gpencil/CMakeLists.txt
index 15707bf..762db26 100644
--- a/source/blender/editors/gpencil/CMakeLists.txt
+++ b/source/blender/editors/gpencil/CMakeLists.txt
@@ -20,6 +20,7 @@
 
 set(INC
 	../include
+	../../blenfont
 	../../blenkernel
 	../../blenlib
 	../../blenloader
@@ -46,4 +47,8 @@ set(SRC
 	gpencil_intern.h
 )
 
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
 blender_add_lib(bf_editor_gpencil "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/gpencil/SConscript b/source/blender/editors/gpencil/SConscript
index d2fd9e5..9d92a23 100644
--- a/source/blender/editors/gpencil/SConscript
+++ b/source/blender/editors/gpencil/SConscript
@@ -5,7 +5,12 @@ sources = env.Glob('*.c')
 
 incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
 incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
-incs += ' ../../gpu ../../blenloader'
+incs += ' ../../gpu ../../blenloader ../../bmesh ../../blenfont'
 incs += ' ../../makesrna ../../render/extern/include  #/intern/elbeem/extern'
 
-env.BlenderLib ( 'bf_editors_gpencil', sources, Split(incs), [], libtype=['core'], priority=[45] )
+defs = []
+
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
+
+env.BlenderLib ( 'bf_editors_gpencil', sources, Split(incs), defs, libtype=['core'], priority=[45] )
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index cf3961e..7726e70 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -79,7 +79,7 @@ typedef enum eDrawStrokeFlags {
 	GP_DRAWDATA_ONLYV2D		= (1<<2),	/* only draw 'canvas' strokes */
 	GP_DRAWDATA_ONLYI2D		= (1<<3),	/* only draw 'image' strokes */
 	GP_DRAWDATA_IEDITHACK	= (1<<4),	/* special hack for drawing strokes in Image Editor (weird coordinates) */
-	GP_DRAWDATA_NO_XRAY		= (1<<5),	/* dont draw xray in 3D view (which is default) */
+	GP_DRAWDATA_NO_XRAY		= (1<<5),	/* don't draw xray in 3D view (which is default) */
 } eDrawStrokeFlags;
 
 
@@ -117,7 +117,7 @@ static void gp_draw_stroke_buffer (tGPspoint *points, int totpoints, short thick
 		float oldpressure = points[0].pressure;
 		
 		/* draw stroke curve */
-		if (G.f & G_DEBUG) setlinestyle(2);
+		if (G.debug & G_DEBUG) setlinestyle(2);
 
 		glLineWidth(oldpressure * thickness);
 		glBegin(GL_LINE_STRIP);
@@ -147,7 +147,7 @@ static void gp_draw_stroke_buffer (tGPspoint *points, int totpoints, short thick
 		/* reset for predictable OpenGL context */
 		glLineWidth(1.0f);
 		
-		if (G.f & G_DEBUG) setlinestyle(0);
+		if (G.debug & G_DEBUG) setlinestyle(0);
 	}
 }
 
@@ -189,17 +189,16 @@ static void gp_draw_stroke_point (bGPDspoint *points, short thickness, short dfl
 				glVertex2fv(co);
 			glEnd();
 		}
-		else 
-		{
+		else {
 			/* draw filled circle as is done in circf (but without the matrix push/pops which screwed things up) */
 			GLUquadricObj *qobj = gluNewQuadric(); 
 			
 			gluQuadricDrawStyle(qobj, GLU_FILL); 
 			
 			/* need to translate drawing position, but must reset after too! */
-			glTranslatef(co[0],  co[1], 0.); 
+			glTranslatef(co[0], co[1], 0.0);
 			gluDisk(qobj, 0.0,  thickness, 32, 1); 
-			glTranslatef(-co[0],  -co[1], 0.);
+			glTranslatef(-co[0], -co[1], 0.0);
 			
 			gluDeleteQuadric(qobj);
 		}
@@ -286,11 +285,10 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness_s
 		glEnd();
 	}
 	
-	/* tesselation code - draw stroke as series of connected quads with connection
+	/* tessellation code - draw stroke as series of connected quads with connection
 	 * edges rotated to minimise shrinking artifacts, and rounded endcaps
 	 */
-	else 
-	{ 
+	else {
 		bGPDspoint *pt1, *pt2;
 		float pm[2];
 		int i;
@@ -300,7 +298,7 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness_s
 		
 		for (i=0, pt1=points, pt2=points+1; i < (totpoints-1); i++, pt1++, pt2++) {
 			float s0[2], s1[2];		/* segment 'center' points */
-			float t0[2], t1[2];		/* tesselated coordinates */
+			float t0[2], t1[2];		/* tessellated coordinates */
 			float m1[2], m2[2];		/* gradient and normal */
 			float mt[2], sc[2];		/* gradient for thickness, point for end-cap */
 			float pthick;			/* thickness at segment point */
@@ -384,8 +382,8 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness_s
 				mt[1]= mb[1] * pthick;
 				athick= len_v2(mt);
 				dfac= pthick - (athick * 2);
-				if ( ((athick * 2.0f) < pthick) && (IS_EQF(athick, pthick)==0) )
-				{
+
+				if (((athick * 2.0f) < pthick) && (IS_EQF(athick, pthick)==0)) {
 					mt[0] += (mb[0] * dfac);
 					mt[1] += (mb[1] * dfac);
 				}	
@@ -515,12 +513,12 @@ static void gp_draw_strokes (bGPDframe *gpf, int offsx, int offsy, int winx, int
 				glDepthMask(0);
 				glEnable(GL_DEPTH_TEST);
 				
-				/* first arg is normally rv3d->dist, but this isnt available here and seems to work quite well without */
+				/* first arg is normally rv3d->dist, but this isn't available here and seems to work quite well without */
 				bglPolygonOffset(1.0f, 1.0f);
-				/*
+#if 0
 				glEnable(GL_POLYGON_OFFSET_LINE);
 				glPolygonOffset(-1.0f, -1.0f);
-				*/
+#endif
 			}
 			
 			gp_draw_stroke_3d(gps->points, gps->totpoints, lthick, debug);
@@ -530,10 +528,10 @@ static void gp_draw_strokes (bGPDframe *gpf, int offsx, int offsy, int winx, int
 				glDisable(GL_DEPTH_TEST);
 				
 				bglPolygonOffset(0.0, 0.0);
-				/*
+#if 0
 				glDisable(GL_POLYGON_OFFSET_LINE);
 				glPolygonOffset(0, 0);
-				*/
+#endif
 			}
 		}
 		else if (gps->totpoints > 1)	
@@ -785,7 +783,7 @@ void draw_gpencil_view3d (Scene *scene, View3D *v3d, ARegion *ar, short only3d)
 	gpd= gpencil_data_get_active_v3d(scene); // XXX
 	if (gpd == NULL) return;
 
-	/* when rendering to the offscreen buffer we dont want to
+	/* when rendering to the offscreen buffer we don't want to
 	 * deal with the camera border, otherwise map the coords to the camera border. */
 	if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_RENDER_OGL)) {
 		rctf rectf;
@@ -793,10 +791,10 @@ void draw_gpencil_view3d (Scene *scene, View3D *v3d, ARegion *ar, short only3d)
 		BLI_copy_rcti_rctf(&rect, &rectf);
 	}
 	else {
-		rect.xmin= 0;
-		rect.ymin= 0;
-		rect.xmax= ar->winx;
-		rect.ymax= ar->winy;
+		rect.xmin = 0;
+		rect.ymin = 0;
+		rect.xmax = ar->winx;
+		rect.ymax = ar->winy;
 	}
 	
 	/* draw it! */
diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c
index 81a5f67..3b0847c 100644
--- a/source/blender/editors/gpencil/editaction_gpencil.c
+++ b/source/blender/editors/gpencil/editaction_gpencil.c
@@ -561,7 +561,7 @@ static short mirror_gpf_xaxis (bGPDframe *gpf, Scene *scene)
 static short mirror_gpf_marker (bGPDframe *gpf, Scene *scene)
 {
 	static TimeMarker *marker;
-	static short initialised = 0;
+	static short initialized = 0;
 	int diff;
 	
 	/* In order for this mirror function to work without
@@ -580,17 +580,17 @@ static short mirror_gpf_marker (bGPDframe *gpf, Scene *scene)
 		}
 	}
 	else {
-		/* initialisation time */
-		if (initialised) {
+		/* initialization time */
+		if (initialized) {
 			/* reset everything for safety */
 			marker = NULL;
-			initialised = 0;
+			initialized = 0;
 		}
 		else {
 			/* try to find a marker */
 			marker= ED_markers_get_first_selected(&scene->markers);
-			if(marker) {
-				initialised= 1;
+			if (marker) {
+				initialized= 1;
 			}
 		}
 	}
diff --git a/source/blender/editors/gpencil/gpencil_buttons.c b/source/blender/editors/gpencil/gpencil_buttons.c
index 53ef16a..263c842 100644
--- a/source/blender/editors/gpencil/gpencil_buttons.c
+++ b/source/blender/editors/gpencil/gpencil_buttons.c
@@ -27,16 +27,17 @@
  *  \ingroup edgpencil
  */
 
- 
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stddef.h>
 
-
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
 
+#include "BLF_translation.h"
+
 #include "DNA_gpencil_types.h"
 #include "DNA_screen_types.h"
 
@@ -49,7 +50,6 @@
 
 #include "RNA_access.h"
 
-
 #include "ED_gpencil.h"
 
 #include "UI_interface.h"
@@ -69,34 +69,33 @@
 /* These are just 'dummy wrappers' around gpencil api calls */
 
 /* make layer active one after being clicked on */
-static void gp_ui_activelayer_cb (bContext *C, void *gpd, void *gpl)
+static void gp_ui_activelayer_cb(bContext *C, void *gpd, void *gpl)
 {
 	/* make sure the layer we want to remove is the active one */
 	gpencil_layer_setactive(gpd, gpl);
-
-	WM_event_add_notifier(C, NC_SCREEN|ND_GPENCIL|NA_EDITED, NULL); // XXX please work!
+	
+	WM_event_add_notifier(C, NC_SCREEN|ND_GPENCIL|NA_EDITED, NULL); /* XXX please work! */
 }
 
 /* delete 'active' layer */
-static void gp_ui_dellayer_cb (bContext *C, void *gpd, void *gpl)
+static void gp_ui_dellayer_cb(bContext *C, void *gpd, void *gpl)
 {
 	/* make sure the layer we want to remove is the active one */
-	gpencil_layer_setactive(gpd, gpl); 
+	gpencil_layer_setactive(gpd, gpl);
 	gpencil_layer_delactive(gpd);
 	
-	WM_event_add_notifier(C, NC_SCREEN|ND_GPENCIL|NA_EDITED, NULL); // XXX please work!
+	WM_event_add_notifier(C, NC_SCREEN|ND_GPENCIL|NA_EDITED, NULL); /* XXX please work! */
 }
 
 
-
 /* ------- Drawing Code ------- */
 
 /* draw the controls for a given layer */
-static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, const short is_v3d)
+static void gp_drawui_layer(uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, const short is_v3d)
 {
-	uiLayout *box=NULL, *split=NULL;
-	uiLayout *col=NULL;
-	uiLayout *row=NULL, *sub=NULL;
+	uiLayout *box = NULL, *split = NULL;
+	uiLayout *col = NULL;
+	uiLayout *row = NULL, *sub = NULL;
 	uiBlock *block;
 	uiBut *but;
 	PointerRNA ptr;
@@ -106,30 +105,31 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, con
 	RNA_pointer_create((ID *)gpd, &RNA_GPencilLayer, gpl, &ptr);
 	
 	/* unless button has own callback, it adds this callback to button */
-	block= uiLayoutGetBlock(layout);
+	block = uiLayoutGetBlock(layout);
 	uiBlockSetFunc(block, gp_ui_activelayer_cb, gpd, gpl);
 	
 	/* draw header ---------------------------------- */
 	/* get layout-row + UI-block for header */
-	box= uiLayoutBox(layout);
+	box = uiLayoutBox(layout);
 	
-	row= uiLayoutRow(box, 0);
+	row = uiLayoutRow(box, 0);
 	uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_EXPAND);
-	block= uiLayoutGetBlock(row); // err...
+	block = uiLayoutGetBlock(row); /* err... */
 	
 	uiBlockSetEmboss(block, UI_EMBOSSN);
 	
 	/* left-align ............................... */
-	sub= uiLayoutRow(row, 0);
+	sub = uiLayoutRow(row, 0);
 	
 	/* active */
-	block= uiLayoutGetBlock(sub);
-	icon= (gpl->flag & GP_LAYER_ACTIVE) ? ICON_RADIOBUT_ON : ICON_RADIOBUT_OFF;
-	but= uiDefIconButBitI(block, TOG, GP_LAYER_ACTIVE, 0, icon, 0, 0, UI_UNIT_X, UI_UNIT_Y, &gpd->flag, 0.0, 0.0, 0.0, 0.0, "Set active layer");
+	block = uiLayoutGetBlock(sub);
+	icon = (gpl->flag & GP_LAYER_ACTIVE) ? ICON_RADIOBUT_ON : ICON_RADIOBUT_OFF;
+	but = uiDefIconButBitI(block, TOG, GP_LAYER_ACTIVE, 0, icon, 0, 0, UI_UNIT_X, UI_UNIT_Y,
+	                       &gpd->flag, 0.0, 0.0, 0.0, 0.0, TIP_("Set active layer"));
 	uiButSetFunc(but, gp_ui_activelayer_cb, gpd, gpl);
-
+	
 	/* locked */
-	icon= (gpl->flag & GP_LAYER_LOCKED) ? ICON_LOCKED : ICON_UNLOCKED;
+	icon = (gpl->flag & GP_LAYER_LOCKED) ? ICON_LOCKED : ICON_UNLOCKED;
 	uiItemR(sub, &ptr, "lock", 0, "", icon);
 	
 	/* when layer is locked or hidden, only draw header */
@@ -138,37 +138,37 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, con
 		
 		/* visibility button (only if hidden but not locked!) */
 		if ((gpl->flag & GP_LAYER_HIDE) && !(gpl->flag & GP_LAYER_LOCKED))
-			uiItemR(sub, &ptr, "hide", 0, "", ICON_RESTRICT_VIEW_ON); 
-			
+			uiItemR(sub, &ptr, "hide", 0, "", ICON_RESTRICT_VIEW_ON);
 		
 		/* name */
 		if (gpl->flag & GP_LAYER_HIDE)
-			BLI_snprintf(name, sizeof(name), "%s (Hidden)", gpl->info);
+			BLI_snprintf(name, sizeof(name), IFACE_("%s (Hidden)"), gpl->info);
 		else
-			BLI_snprintf(name, sizeof(name), "%s (Locked)", gpl->info);
+			BLI_snprintf(name, sizeof(name), IFACE_("%s (Locked)"), gpl->info);
 		uiItemL(sub, name, ICON_NONE);
-			
+		
 		/* delete button (only if hidden but not locked!) */
 		if ((gpl->flag & GP_LAYER_HIDE) && !(gpl->flag & GP_LAYER_LOCKED)) {
 			/* right-align ............................... */
-			sub= uiLayoutRow(row, 1);
+			sub = uiLayoutRow(row, 1);
 			uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT);
-			block= uiLayoutGetBlock(sub); // XXX... err...
+			block = uiLayoutGetBlock(sub); /* XXX... err... */
 			
-			but= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Delete layer");
+			but = uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y,
+			                   NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete layer"));
 			uiButSetFunc(but, gp_ui_dellayer_cb, gpd, gpl);
-		}	
+		}
 		uiBlockSetEmboss(block, UI_EMBOSS);
 	}
 	else {
 		/* draw rest of header -------------------------------- */
 		/* visibility button */
-		uiItemR(sub, &ptr, "hide", 0, "", ICON_RESTRICT_VIEW_OFF); 
+		uiItemR(sub, &ptr, "hide", 0, "", ICON_RESTRICT_VIEW_OFF);
 		
 		/* frame locking */
-		// TODO: this needs its own icons...
-		icon= (gpl->flag & GP_LAYER_FRAMELOCK) ? ICON_RENDER_STILL : ICON_RENDER_ANIMATION;
-		uiItemR(sub, &ptr, "lock_frame", 0, "", icon); 
+		/* TODO: this needs its own icons... */
+		icon = (gpl->flag & GP_LAYER_FRAMELOCK) ? ICON_RENDER_STILL : ICON_RENDER_ANIMATION;
+		uiItemR(sub, &ptr, "lock_frame", 0, "", icon);
 		
 		uiBlockSetEmboss(block, UI_EMBOSS);
 		
@@ -177,98 +177,97 @@ static void gp_drawui_layer (uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, con
 		
 		/* delete 'button' */
 		uiBlockSetEmboss(block, UI_EMBOSSN);
-			/* right-align ............................... */
-			sub= uiLayoutRow(row, 1);
-			uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT);
-			block= uiLayoutGetBlock(sub); // XXX... err...
-			
-			but= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Delete layer");
-			uiButSetFunc(but, gp_ui_dellayer_cb, gpd, gpl);
-		uiBlockSetEmboss(block, UI_EMBOSS);
+		/* right-align ............................... */
+		sub = uiLayoutRow(row, 1);
+		uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT);
+		block = uiLayoutGetBlock(sub); /* XXX... err... */
 		
+		but = uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y,
+		                   NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete layer"));
+		uiButSetFunc(but, gp_ui_dellayer_cb, gpd, gpl);
+		uiBlockSetEmboss(block, UI_EMBOSS);
 		
 		/* new backdrop ----------------------------------- */
-		box= uiLayoutBox(layout);
-		split= uiLayoutSplit(box, 0.5f, 0);
+		box = uiLayoutBox(layout);
+		split = uiLayoutSplit(box, 0.5f, 0);
 		
 		/* draw settings ---------------------------------- */
 		/* left column ..................... */
-		col= uiLayoutColumn(split, 0);
+		col = uiLayoutColumn(split, 0);
 		
 		/* color */
-		sub= uiLayoutColumn(col, 1);
+		sub = uiLayoutColumn(col, 1);
 			uiItemR(sub, &ptr, "color", 0, "", ICON_NONE);
 			uiItemR(sub, &ptr, "alpha", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
-			
+		
 		/* stroke thickness */
 		uiItemR(col, &ptr, "line_width", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
 		
 		/* debugging options */
-		if (G.f & G_DEBUG) {
+		if (G.debug & G_DEBUG) {
 			uiItemR(col, &ptr, "show_points", 0, NULL, ICON_NONE);
 		}
 		
 		/* right column ................... */
-		col= uiLayoutColumn(split, 0);
+		col = uiLayoutColumn(split, 0);
 		
 		/* onion-skinning */
-		sub= uiLayoutColumn(col, 1);
-			uiItemR(sub, &ptr, "use_onion_skinning", 0, "Onion Skinning", ICON_NONE);
-			uiItemR(sub, &ptr, "ghost_range_max", 0, "Frames", ICON_NONE); // XXX shorter name here? i.e. GStep
+		sub = uiLayoutColumn(col, 1);
+		uiItemR(sub, &ptr, "use_onion_skinning", 0, NULL, ICON_NONE);
+		uiItemR(sub, &ptr, "ghost_range_max", 0, IFACE_("Frames"), ICON_NONE);
 		
 		/* 3d-view specific drawing options */
 		if (is_v3d) {
-			uiItemR(col, &ptr, "show_x_ray", 0, "X-Ray", ICON_NONE);
+			uiItemR(col, &ptr, "show_x_ray", 0, NULL, ICON_NONE);
 		}
-		
 	}
-} 
+}
 
 /* stroke drawing options available */
 typedef enum eGP_Stroke_Ops {
-	STROKE_OPTS_NORMAL = 0, 
-	STROKE_OPTS_V3D_OFF, 
+	STROKE_OPTS_NORMAL  = 0,
+	STROKE_OPTS_V3D_OFF,
 	STROKE_OPTS_V3D_ON,
 } eGP_Stroke_Ops;
 
 /* Draw the contents for a grease-pencil panel*/
-static void draw_gpencil_panel (bContext *C, uiLayout *layout, bGPdata *gpd, PointerRNA *ctx_ptr)
+static void draw_gpencil_panel(bContext *C, uiLayout *layout, bGPdata *gpd, PointerRNA *ctx_ptr)
 {
 	PointerRNA gpd_ptr;
 	bGPDlayer *gpl;
 	uiLayout *col, *row;
 	short v3d_stroke_opts = STROKE_OPTS_NORMAL;
-	const short is_v3d= CTX_wm_view3d(C) != NULL;
+	const short is_v3d = CTX_wm_view3d(C) != NULL;
 	
 	/* make new PointerRNA for Grease Pencil block */
 	RNA_id_pointer_create((ID *)gpd, &gpd_ptr);
 	
 	/* draw gpd settings first ------------------------------------- */
-	col= uiLayoutColumn(layout, 0);
-		/* current Grease Pencil block */
-		// TODO: show some info about who owns this?
-		uiTemplateID(col, C, ctx_ptr, "grease_pencil", "GPENCIL_OT_data_add", NULL, "GPENCIL_OT_data_unlink"); 
-		
-		/* add new layer button - can be used even when no data, since it can add a new block too */
-		uiItemO(col, "New Layer", ICON_NONE, "GPENCIL_OT_layer_add");
-		row= uiLayoutRow(col, 1);
-		uiItemO(row, "Delete Frame", ICON_NONE, "GPENCIL_OT_active_frame_delete");
-		uiItemO(row, "Convert", ICON_NONE, "GPENCIL_OT_convert");
-		
+	col = uiLayoutColumn(layout, 0);
+	/* current Grease Pencil block */
+	/* TODO: show some info about who owns this? */
+	uiTemplateID(col, C, ctx_ptr, "grease_pencil", "GPENCIL_OT_data_add", NULL, "GPENCIL_OT_data_unlink");
+	
+	/* add new layer button - can be used even when no data, since it can add a new block too */
+	uiItemO(col, IFACE_("New Layer"), ICON_NONE, "GPENCIL_OT_layer_add");
+	row = uiLayoutRow(col, 1);
+		uiItemO(row, IFACE_("Delete Frame"), ICON_NONE, "GPENCIL_OT_active_frame_delete");
+		uiItemO(row, IFACE_("Convert"), ICON_NONE, "GPENCIL_OT_convert");
+	
 	/* sanity checks... */
 	if (gpd == NULL)
 		return;
 	
 	/* draw each layer --------------------------------------------- */
-	for (gpl= gpd->layers.first; gpl; gpl= gpl->next) {
-		col= uiLayoutColumn(layout, 1);
-			gp_drawui_layer(col, gpd, gpl, is_v3d);
+	for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+		col = uiLayoutColumn(layout, 1);
+		gp_drawui_layer(col, gpd, gpl, is_v3d);
 	}
 	
 	/* draw gpd drawing settings first ------------------------------------- */
-	col= uiLayoutColumn(layout, 1);
+	col = uiLayoutColumn(layout, 1);
 		/* label */
-		uiItemL(col, "Drawing Settings:", ICON_NONE);
+		uiItemL(col, IFACE_("Drawing Settings:"), ICON_NONE);
 		
 		/* check whether advanced 3D-View drawing space options can be used */
 		if (is_v3d) {
@@ -290,19 +289,19 @@ static void draw_gpencil_panel (bContext *C, uiLayout *layout, bGPdata *gpd, Poi
 		row= uiLayoutRow(col, 0);
 			uiLayoutSetActive(row, v3d_stroke_opts==STROKE_OPTS_V3D_ON);
 			uiItemR(row, &gpd_ptr, "use_stroke_endpoints", 0, NULL, ICON_NONE);
-}	
+}
 
 
-/* Standard panel to be included whereever Grease Pencil is used... */
+/* Standard panel to be included wherever Grease Pencil is used... */
 void gpencil_panel_standard(const bContext *C, Panel *pa)
 {
 	bGPdata **gpd_ptr = NULL;
 	PointerRNA ptr;
 	
-	//if (v3d->flag2 & V3D_DISPGP)... etc.
+	/* if (v3d->flag2 & V3D_DISPGP)... etc. */
 	
 	/* get pointer to Grease Pencil Data */
-	gpd_ptr= gpencil_data_get_pointers((bContext *)C, &ptr);
+	gpd_ptr = gpencil_data_get_pointers((bContext *)C, &ptr);
 	
 	if (gpd_ptr)
 		draw_gpencil_panel((bContext *)C, pa->layout, *gpd_ptr, &ptr);
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 9a49215..d48cfaa 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -143,7 +143,7 @@ bGPdata **gpencil_data_get_pointers (bContext *C, PointerRNA *ptr)
 				SpaceClip *sc= (SpaceClip *)CTX_wm_space_data(C);
 				MovieClip *clip= ED_space_clip(sc);
 
-				if(clip) {
+				if (clip) {
 					/* for now, as long as there's a clip, default to using that in Clip Editor */
 					if (ptr) RNA_id_pointer_create(&clip->id, ptr);
 					return &clip->gpd;
@@ -213,14 +213,14 @@ static int gp_data_add_exec (bContext *C, wmOperator *op)
 void GPENCIL_OT_data_add (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Grease Pencil Add New";
-	ot->idname= "GPENCIL_OT_data_add";
-	ot->description= "Add new Grease Pencil datablock";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "Grease Pencil Add New";
+	ot->idname = "GPENCIL_OT_data_add";
+	ot->description = "Add new Grease Pencil datablock";
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* callbacks */
-	ot->exec= gp_data_add_exec;
-	ot->poll= gp_add_poll;
+	ot->exec = gp_data_add_exec;
+	ot->poll = gp_add_poll;
 }
 
 /* ******************* Unlink Data ************************ */
@@ -261,14 +261,14 @@ static int gp_data_unlink_exec (bContext *C, wmOperator *op)
 void GPENCIL_OT_data_unlink (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Grease Pencil Unlink";
-	ot->idname= "GPENCIL_OT_data_unlink";
-	ot->description= "Unlink active Grease Pencil datablock";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "Grease Pencil Unlink";
+	ot->idname = "GPENCIL_OT_data_unlink";
+	ot->description = "Unlink active Grease Pencil datablock";
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* callbacks */
-	ot->exec= gp_data_unlink_exec;
-	ot->poll= gp_data_unlink_poll;
+	ot->exec = gp_data_unlink_exec;
+	ot->poll = gp_data_unlink_poll;
 }
 
 /* ******************* Add New Layer ************************ */
@@ -298,14 +298,14 @@ static int gp_layer_add_exec (bContext *C, wmOperator *op)
 void GPENCIL_OT_layer_add (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add New Layer";
-	ot->idname= "GPENCIL_OT_layer_add";
-	ot->description= "Add new Grease Pencil layer for the active Grease Pencil datablock";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "Add New Layer";
+	ot->idname = "GPENCIL_OT_layer_add";
+	ot->description = "Add new Grease Pencil layer for the active Grease Pencil datablock";
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* callbacks */
-	ot->exec= gp_layer_add_exec;
-	ot->poll= gp_add_poll;
+	ot->exec = gp_layer_add_exec;
+	ot->poll = gp_add_poll;
 }
 
 /* ******************* Delete Active Frame ************************ */
@@ -332,7 +332,7 @@ static int gp_actframe_delete_exec (bContext *C, wmOperator *op)
 		BKE_report(op->reports, RPT_ERROR, "No Grease Pencil data");
 		return OPERATOR_CANCELLED;
 	}
-	if ELEM(NULL, gpl, gpf) {
+	if (ELEM(NULL, gpl, gpf)) {
 		BKE_report(op->reports, RPT_ERROR, "No active frame to delete");
 		return OPERATOR_CANCELLED;
 	}
@@ -349,14 +349,14 @@ static int gp_actframe_delete_exec (bContext *C, wmOperator *op)
 void GPENCIL_OT_active_frame_delete (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete Active Frame";
-	ot->idname= "GPENCIL_OT_active_frame_delete";
-	ot->description= "Delete the active frame for the active Grease Pencil datablock";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "Delete Active Frame";
+	ot->idname = "GPENCIL_OT_active_frame_delete";
+	ot->description = "Delete the active frame for the active Grease Pencil datablock";
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* callbacks */
-	ot->exec= gp_actframe_delete_exec;
-	ot->poll= gp_actframe_delete_poll;
+	ot->exec = gp_actframe_delete_exec;
+	ot->poll = gp_actframe_delete_poll;
 }
 
 /* ************************************************ */
@@ -402,7 +402,7 @@ static void gp_strokepoint_convertcoords (bContext *C, bGPDstroke *gps, bGPDspoi
 			VECCOPY2D(mvalf, mvali);
 		}
 		else {
-			if(subrect) {
+			if (subrect) {
 				mvalf[0]= (((float)pt->x/100.0f) * (subrect->xmax - subrect->xmin)) + subrect->xmin;
 				mvalf[1]= (((float)pt->y/100.0f) * (subrect->ymax - subrect->ymin)) + subrect->ymin;
 			}
@@ -561,7 +561,7 @@ static void gp_layer_to_curve (bContext *C, bGPdata *gpd, bGPDlayer *gpl, short
 		return;
 
 	/* initialize camera framing */
-	if(gp_camera_view_subrect(C, &subrect)) {
+	if (gp_camera_view_subrect(C, &subrect)) {
 		subrect_ptr= &subrect;
 	}
 
@@ -632,21 +632,21 @@ static int gp_convert_layer_exec (bContext *C, wmOperator *op)
 void GPENCIL_OT_convert (wmOperatorType *ot)
 {
 	/* 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->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;
 	
 	/* callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= gp_convert_layer_exec;
-	ot->poll= gp_convert_poll;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = gp_convert_layer_exec;
+	ot->poll = gp_convert_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	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", "");
 }
 
 /* ************************************************ */
diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h
index 8000af5..b88723d 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -28,8 +28,8 @@
  *  \ingroup edgpencil
  */
 
-#ifndef ED_GPENCIL_INTERN_H
-#define ED_GPENCIL_INTERN_H
+#ifndef __GPENCIL_INTERN_H__
+#define __GPENCIL_INTERN_H__
 
 /* internal exports only */
 
@@ -117,5 +117,5 @@ typedef enum ACTCONT_TYPES {
 
 
 
-#endif /* ED_GPENCIL_INTERN_H */
+#endif /* __GPENCIL_INTERN_H__ */
 
diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c
index 954c79b..0afe791 100644
--- a/source/blender/editors/gpencil/gpencil_ops.c
+++ b/source/blender/editors/gpencil/gpencil_ops.c
@@ -50,7 +50,7 @@
 
 void ED_keymap_gpencil(wmKeyConfig *keyconf)
 {
-	wmKeyMap *keymap= WM_keymap_find(keyconf, "Grease Pencil", 0, 0);
+	wmKeyMap *keymap = WM_keymap_find(keyconf, "Grease Pencil", 0, 0);
 	wmKeyMapItem *kmi;
 	
 	/* Draw */
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 9957234..c366de6 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -104,8 +104,8 @@ typedef struct tGPsdata {
 	short radius;		/* radius of influence for eraser */
 	short flags;		/* flags that can get set during runtime */
 
-	float imat[4][4];	/* inverted transformation matrix applying when converting coords from screen-space
-						 * to region space */
+	float imat[4][4];   /* inverted transformation matrix applying when converting coords from screen-space
+	                     * to region space */
 
 	float custom_color[4]; /* custom color for (?) */
 } tGPsdata;
@@ -187,15 +187,14 @@ static int gpencil_project_check (tGPsdata *p)
 /* Utilities --------------------------------- */
 
 /* get the reference point for stroke-point conversions */
-static void gp_get_3d_reference (tGPsdata *p, float *vec)
+static void gp_get_3d_reference (tGPsdata *p, float vec[3])
 {
 	View3D *v3d= p->sa->spacedata.first;
 	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 (p->ownerPtr.type == &RNA_Object) 
-	{
+	if (p->ownerPtr.type == &RNA_Object) {
 		Object *ob= (Object *)p->ownerPtr.data;
 		
 		/* active Object 
@@ -517,14 +516,12 @@ static void gp_stroke_simplify (tGPsdata *p)
 		pressure += old_points[offs].pressure * sfac; \
 	}
 	
-	for (i = 0, j = 0; i < num_points; i++)
-	{
-		if (i - j == 3)
-		{
+	for (i = 0, j = 0; i < num_points; i++) {
+		if (i - j == 3) {
 			float co[2], pressure;
 			int mco[2];
 			
-			/* initialise values */
+			/* initialize values */
 			co[0]= 0;
 			co[1]= 0;
 			pressure = 0;
@@ -572,14 +569,14 @@ static void gp_stroke_newfrombuffer (tGPsdata *p)
 	
 	/* exit with error if no valid points from this stroke */
 	if (totelem == 0) {
-		if (G.f & G_DEBUG) 
-			printf("Error: No valid points in stroke buffer to convert (tot=%d) \n", gpd->sbuffer_size);
+		if (G.debug & G_DEBUG)
+			printf("Error: No valid points in stroke buffer to convert (tot=%d)\n", gpd->sbuffer_size);
 		return;
 	}
 	
 	/* special case for poly line -- for already added stroke during session
-	   coordinates are getting added to stroke immediatelly to allow more
-	   interactive behavior */
+	 * coordinates are getting added to stroke immediately to allow more
+	 * interactive behavior */
 	if (p->paintmode == GP_PAINTMODE_DRAW_POLY) {
 		if (p->flags & GP_PAINTFLAG_STROKEADDED)
 			return;
@@ -701,7 +698,7 @@ static void gp_stroke_newfrombuffer (tGPsdata *p)
 		
 		pt= gps->points;
 		
-		/* convert all points (normal behaviour) */
+		/* convert all points (normal behavior) */
 		for (i=0, ptc=gpd->sbuffer; i < gpd->sbuffer_size && ptc; i++, ptc++, pt++) {
 			/* convert screen-coordinates to appropriate coordinates (and store them) */
 			gp_stroke_convertcoords(p, &ptc->x, &pt->x, depth_arr ? depth_arr+i:NULL);
@@ -802,7 +799,7 @@ static short gp_stroke_eraser_strokeinside (int mval[], int UNUSED(mvalo[]), sho
 } 
 
 /* eraser tool - evaluation per stroke */
-// TODO: this could really do with some optimisation (KD-Tree/BVH?)
+// TODO: this could really do with some optimization (KD-Tree/BVH?)
 static void gp_stroke_eraser_dostroke (tGPsdata *p, int mval[], int mvalo[], short rad, rcti *rect, bGPDframe *gpf, bGPDstroke *gps)
 {
 	bGPDspoint *pt1, *pt2;
@@ -905,7 +902,7 @@ static void gp_stroke_eraser_dostroke (tGPsdata *p, int mval[], int mvalo[], sho
 			}
 #endif
 			else {
-				if(p->subrect == NULL) { /* normal 3D view */
+				if (p->subrect == NULL) { /* normal 3D view */
 					x0= (int)(pt1->x / 100 * p->ar->winx);
 					y0= (int)(pt1->y / 100 * p->ar->winy);
 					x1= (int)(pt2->x / 100 * p->ar->winx);
@@ -943,10 +940,10 @@ static void gp_stroke_doeraser (tGPsdata *p)
 	rcti rect;
 	
 	/* rect is rectangle of eraser */
-	rect.xmin= p->mval[0] - p->radius;
-	rect.ymin= p->mval[1] - p->radius;
-	rect.xmax= p->mval[0] + p->radius;
-	rect.ymax= p->mval[1] + p->radius;
+	rect.xmin = p->mval[0] - p->radius;
+	rect.ymin = p->mval[1] - p->radius;
+	rect.xmax = p->mval[0] + p->radius;
+	rect.ymax = p->mval[1] + p->radius;
 	
 	/* loop over strokes, checking segments for intersections */
 	for (gps= gpf->strokes.first; gps; gps= gpn) {
@@ -990,8 +987,8 @@ static int gp_session_initdata (bContext *C, tGPsdata *p)
 	/* make sure the active view (at the starting time) is a 3d-view */
 	if (curarea == NULL) {
 		p->status= GP_STATUS_ERROR;
-		if (G.f & G_DEBUG) 
-			printf("Error: No active view for painting \n");
+		if (G.debug & G_DEBUG)
+			printf("Error: No active view for painting\n");
 		return 0;
 	}
 	
@@ -1016,8 +1013,8 @@ static int gp_session_initdata (bContext *C, tGPsdata *p)
 			
 			if (ar->regiondata == NULL) {
 				p->status= GP_STATUS_ERROR;
-				if (G.f & G_DEBUG)
-					printf("Error: 3D-View active region doesn't have any region data, so cannot be drawable \n");
+				if (G.debug & G_DEBUG)
+					printf("Error: 3D-View active region doesn't have any region data, so cannot be drawable\n");
 				return 0;
 			}
 
@@ -1025,8 +1022,8 @@ static int gp_session_initdata (bContext *C, tGPsdata *p)
 			/* check that gpencil data is allowed to be drawn */
 			if ((v3d->flag2 & V3D_DISPGP)==0) {
 				p->status= GP_STATUS_ERROR;
-				if (G.f & G_DEBUG) 
-					printf("Error: In active view, Grease Pencil not shown \n");
+				if (G.debug & G_DEBUG)
+					printf("Error: In active view, Grease Pencil not shown\n");
 				return 0;
 			}
 #endif
@@ -1046,8 +1043,8 @@ static int gp_session_initdata (bContext *C, tGPsdata *p)
 			/* check that gpencil data is allowed to be drawn */
 			if ((snode->flag & SNODE_DISPGP)==0) {
 				p->status= GP_STATUS_ERROR;
-				if (G.f & G_DEBUG) 
-					printf("Error: In active view, Grease Pencil not shown \n");
+				if (G.debug & G_DEBUG)
+					printf("Error: In active view, Grease Pencil not shown\n");
 				return 0;
 			}
 #endif
@@ -1066,14 +1063,14 @@ static int gp_session_initdata (bContext *C, tGPsdata *p)
 			/* check that gpencil data is allowed to be drawn */
 			if (sseq->mainb == SEQ_DRAW_SEQUENCE) {
 				p->status= GP_STATUS_ERROR;
-				if (G.f & G_DEBUG) 
-					printf("Error: In active view (sequencer), active mode doesn't support Grease Pencil \n");
+				if (G.debug & G_DEBUG)
+					printf("Error: In active view (sequencer), active mode doesn't support Grease Pencil\n");
 				return 0;
 			}
 			if ((sseq->flag & SEQ_DRAW_GPENCIL)==0) {
 				p->status= GP_STATUS_ERROR;
-				if (G.f & G_DEBUG) 
-					printf("Error: In active view, Grease Pencil not shown \n");
+				if (G.debug & G_DEBUG)
+					printf("Error: In active view, Grease Pencil not shown\n");
 				return 0;
 			}
 		}
@@ -1093,8 +1090,8 @@ static int gp_session_initdata (bContext *C, tGPsdata *p)
 			/* check that gpencil data is allowed to be drawn */
 			if ((sima->flag & SI_DISPGP)==0) {
 				p->status= GP_STATUS_ERROR;
-				if (G.f & G_DEBUG)
-					printf("Error: In active view, Grease Pencil not shown \n");
+				if (G.debug & G_DEBUG)
+					printf("Error: In active view, Grease Pencil not shown\n");
 				return 0;
 			}
 #endif
@@ -1124,8 +1121,8 @@ static int gp_session_initdata (bContext *C, tGPsdata *p)
 		default:
 		{
 			p->status= GP_STATUS_ERROR;
-			if (G.f & G_DEBUG) 
-				printf("Error: Active view not appropriate for Grease Pencil drawing \n");
+			if (G.debug & G_DEBUG)
+				printf("Error: Active view not appropriate for Grease Pencil drawing\n");
 			return 0;
 		}
 			break;
@@ -1135,8 +1132,8 @@ static int gp_session_initdata (bContext *C, tGPsdata *p)
 	gpd_ptr= gpencil_data_get_pointers(C, &p->ownerPtr);
 	if (gpd_ptr == NULL) {
 		p->status= GP_STATUS_ERROR;
-		if (G.f & G_DEBUG)
-			printf("Error: Current context doesn't allow for any Grease Pencil data \n");
+		if (G.debug & G_DEBUG)
+			printf("Error: Current context doesn't allow for any Grease Pencil data\n");
 		return 0;
 	}
 	else {
@@ -1148,7 +1145,7 @@ 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);
 	}
 	
@@ -1207,13 +1204,13 @@ static void gp_paint_initstroke (tGPsdata *p, short paintmode)
 	if (p->gpl == NULL) {
 		p->gpl= gpencil_layer_addnew(p->gpd);
 
-		if(p->custom_color[3])
+		if (p->custom_color[3])
 			copy_v3_v3(p->gpl->color, p->custom_color);
 	}
 	if (p->gpl->flag & GP_LAYER_LOCKED) {
 		p->status= GP_STATUS_ERROR;
-		if (G.f & G_DEBUG)
-			printf("Error: Cannot paint on locked layer \n");
+		if (G.debug & G_DEBUG)
+			printf("Error: Cannot paint on locked layer\n");
 		return;
 	}
 		
@@ -1221,8 +1218,8 @@ static void gp_paint_initstroke (tGPsdata *p, short paintmode)
 	p->gpf= gpencil_layer_getframe(p->gpl, p->scene->r.cfra, 1);
 	if (p->gpf == NULL) {
 		p->status= GP_STATUS_ERROR;
-		if (G.f & G_DEBUG) 
-			printf("Error: No frame created (gpencil_paint_init) \n");
+		if (G.debug & G_DEBUG)
+			printf("Error: No frame created (gpencil_paint_init)\n");
 		return;
 	}
 	else
@@ -1316,7 +1313,7 @@ static void gp_paint_initstroke (tGPsdata *p, short paintmode)
 				 *
 				 * Admittedly, this is a bit hacky, but it works much nicer from an ergonomic standpoint!
 				 */
-				if ELEM(NULL, sima, sima->image) {
+				if (ELEM(NULL, sima, sima->image)) {
 					/* make strokes be drawn in screen space */
 					p->gpd->sbuffer_sflag &= ~GP_STROKE_2DSPACE;
 					p->gpd->flag &= ~GP_DATA_VIEWALIGN;
@@ -1369,7 +1366,7 @@ 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);
@@ -1522,8 +1519,8 @@ static void gpencil_draw_apply (wmOperator *op, tGPsdata *p)
 			BKE_report(op->reports, RPT_ERROR, "Cannot paint stroke");
 			p->status = GP_STATUS_ERROR;
 			
-			if (G.f & G_DEBUG) 
-				printf("Error: Grease-Pencil Paint - Add Point Invalid \n");
+			if (G.debug & G_DEBUG)
+				printf("Error: Grease-Pencil Paint - Add Point Invalid\n");
 			return;
 		}
 		
@@ -1598,27 +1595,26 @@ 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 initialise context data needed while drawing */
+	/* 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
 	 */
-	RNA_BEGIN(op->ptr, itemptr, "stroke") 
-	{
+	RNA_BEGIN(op->ptr, itemptr, "stroke") {
 		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);
@@ -1651,7 +1647,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);
@@ -1671,15 +1667,15 @@ static int gpencil_draw_invoke (bContext *C, wmOperator *op, wmEvent *event)
 	tGPsdata *p = NULL;
 	wmWindow *win= CTX_wm_window(C);
 	
-	if (G.f & G_DEBUG)
-		printf("GPencil - Starting Drawing \n");
+	if (G.debug & G_DEBUG)
+		printf("GPencil - Starting Drawing\n");
 	
-	/* try to initialise context data needed while drawing */
+	/* try to initialize context data needed while drawing */
 	if (!gpencil_draw_init(C, op)) {
 		if (op->customdata) 
 			MEM_freeN(op->customdata);
-		if (G.f & G_DEBUG)
-			printf("\tGP - no valid data \n");
+		if (G.debug & G_DEBUG)
+			printf("\tGP - no valid data\n");
 		return OPERATOR_CANCELLED;
 	}
 	else
@@ -1746,11 +1742,11 @@ static tGPsdata *gpencil_stroke_begin(bContext *C, wmOperator *op)
 	 * otherwise we could crash (see bug #20586)
 	 */
 	if (CTX_wm_area(C) != p->sa) {
-		printf("\t\t\tGP - wrong area execution abort! \n");
+		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
@@ -1759,7 +1755,7 @@ static tGPsdata *gpencil_stroke_begin(bContext *C, wmOperator *op)
 	if (gp_session_initdata(C, p))
 		gp_paint_initstroke(p, p->paintmode);
 
-	if(p->status != GP_STATUS_ERROR)
+	if (p->status != GP_STATUS_ERROR)
 		p->status= GP_STATUS_PAINTING;
 
 	return op->customdata;
@@ -1855,15 +1851,14 @@ static int gpencil_draw_modal (bContext *C, wmOperator *op, wmEvent *event)
 	/* handle mode-specific events */
 	if (p->status == GP_STATUS_PAINTING) {
 		/* handle painting mouse-movements? */
-		if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE) || (p->flags & GP_PAINTFLAG_FIRSTRUN)) 
-		{
+		if (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE) || (p->flags & GP_PAINTFLAG_FIRSTRUN)) {
 			/* handle drawing event */
 			//printf("\t\tGP - add point\n");
 			gpencil_draw_apply_event(op, event);
 			
 			/* finish painting operation if anything went wrong just now */
 			if (p->status == GP_STATUS_ERROR) {
-				printf("\t\t\t\tGP - add error done! \n");
+				printf("\t\t\t\tGP - add error done!\n");
 				estate = OPERATOR_CANCELLED;
 			}
 			else {
@@ -1923,22 +1918,22 @@ static EnumPropertyItem prop_gpencil_drawmodes[] = {
 void GPENCIL_OT_draw (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Grease Pencil Draw";
-	ot->idname= "GPENCIL_OT_draw";
-	ot->description= "Make annotations on the active data";
+	ot->name = "Grease Pencil Draw";
+	ot->idname = "GPENCIL_OT_draw";
+	ot->description = "Make annotations on the active data";
 	
 	/* api callbacks */
-	ot->exec= gpencil_draw_exec;
-	ot->invoke= gpencil_draw_invoke;
-	ot->modal= gpencil_draw_modal;
-	ot->cancel= gpencil_draw_cancel;
-	ot->poll= gpencil_draw_poll;
+	ot->exec = gpencil_draw_exec;
+	ot->invoke = gpencil_draw_invoke;
+	ot->modal = gpencil_draw_modal;
+	ot->cancel = gpencil_draw_cancel;
+	ot->poll = gpencil_draw_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
 	
 	/* settings for drawing */
-	RNA_def_enum(ot->srna, "mode", prop_gpencil_drawmodes, 0, "Mode", "Way to intepret mouse movements");
+	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/gpencil/gpencil_undo.c b/source/blender/editors/gpencil/gpencil_undo.c
index 1ab0008..36624b8 100644
--- a/source/blender/editors/gpencil/gpencil_undo.c
+++ b/source/blender/editors/gpencil/gpencil_undo.c
@@ -69,10 +69,10 @@ int ED_undo_gpencil_step(bContext *C, int step, const char *name)
 
 	gpd_ptr= gpencil_data_get_pointers(C, NULL);
 
-	if(step==1) {	/* undo */
+	if (step==1) {	/* undo */
 		//printf("\t\tGP - undo step\n");
-		if(cur_node->prev) {
-			if(!name || strcmp(cur_node->name, name) == 0) {
+		if (cur_node->prev) {
+			if (!name || strcmp(cur_node->name, name) == 0) {
 				cur_node= cur_node->prev;
 				new_gpd= cur_node->gpd;
 			}
@@ -80,17 +80,17 @@ int ED_undo_gpencil_step(bContext *C, int step, const char *name)
 	}
 	else if (step==-1) {
 		//printf("\t\tGP - redo step\n");
-		if(cur_node->next) {
-			if(!name || strcmp(cur_node->name, name) == 0) {
+		if (cur_node->next) {
+			if (!name || strcmp(cur_node->name, name) == 0) {
 				cur_node= cur_node->next;
 				new_gpd= cur_node->gpd;
 			}
 		}
 	}
 
-	if(new_gpd) {
-		if(gpd_ptr) {
-			if(*gpd_ptr) {
+	if (new_gpd) {
+		if (gpd_ptr) {
+			if (*gpd_ptr) {
 				bGPdata *gpd= *gpd_ptr;
 				bGPDlayer *gpl, *gpld;
 
@@ -124,11 +124,11 @@ void gpencil_undo_push(bGPdata *gpd)
 
 	//printf("\t\tGP - undo push\n");
 
-	if(cur_node) {
+	if (cur_node) {
 		/* remove all un-done nodes from stack */
 		undo_node= cur_node->next;
 
-		while(undo_node) {
+		while (undo_node) {
 			bGPundonode *next_node= undo_node->next;
 
 			free_gpencil_data(undo_node->gpd);
@@ -153,7 +153,7 @@ void gpencil_undo_finish(void)
 {
 	bGPundonode *undo_node= undo_nodes.first;
 
-	while(undo_node) {
+	while (undo_node) {
 		free_gpencil_data(undo_node->gpd);
 		MEM_freeN(undo_node->gpd);
 
diff --git a/source/blender/editors/include/BIF_gl.h b/source/blender/editors/include/BIF_gl.h
index 940a586..e29e0af 100644
--- a/source/blender/editors/include/BIF_gl.h
+++ b/source/blender/editors/include/BIF_gl.h
@@ -30,8 +30,8 @@
  *  \ingroup editorui
  */
 
-#ifndef BIF_GL_H
-#define BIF_GL_H
+#ifndef __BIF_GL_H__
+#define __BIF_GL_H__
 
 #include "GL/glew.h"
 
@@ -43,12 +43,12 @@
  *
  * This define converts a numerical value to the equivalent 24-bit
  * color, while not being endian-sensitive. On little-endians, this
- * is the same as doing a 'naive'indexing, on big-endian, it is not!
+ * is the same as doing a 'naive' indexing, on big-endian, it is not!
  * */
 #define cpack(x)	glColor3ub( ((x)&0xFF), (((x)>>8)&0xFF), (((x)>>16)&0xFF) )
 
 #define glMultMatrixf(x)		glMultMatrixf( (float *)(x))
 #define glLoadMatrixf(x)		glLoadMatrixf( (float *)(x))
 
-#endif /* #ifdef BIF_GL_H */
+#endif /* #ifdef __BIF_GL_H__ */
 
diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h
index 33e9192..4419598 100644
--- a/source/blender/editors/include/BIF_glutil.h
+++ b/source/blender/editors/include/BIF_glutil.h
@@ -27,8 +27,8 @@
  *  \ingroup editorui
  */
 
-#ifndef BIF_GLUTIL_H
-#define BIF_GLUTIL_H
+#ifndef __BIF_GLUTIL_H__
+#define __BIF_GLUTIL_H__
 
 struct rcti;
 struct rctf;
@@ -47,6 +47,8 @@ void sdrawXORline4(int nr, int x0, int y0, int x1, int y1);
 void fdrawXORellipse(float xofs, float yofs, float hw, float hh);
 void fdrawXORcirc(float xofs, float yofs, float rad);
 
+void fdrawcheckerboard(float x1, float y1, float x2, float y2);
+
 /* glStipple defines */
 extern unsigned char stipple_halftone[128];
 extern unsigned char stipple_quarttone[128];
@@ -55,27 +57,27 @@ extern unsigned char stipple_diag_stripes_neg[128];
 
 	/**
 	 * Draw a lined (non-looping) arc with the given
-	 * @a radius, starting at angle @a start and arcing 
-	 * through @a angle. The arc is centered at the origin 
+	 * \a radius, starting at angle \a start and arcing
+	 * through \a angle. The arc is centered at the origin
 	 * and drawn in the XY plane.
 	 * 
-	 * @param start The initial angle (in radians).
-	 * @param angle The length of the arc (in radians).
-	 * @param radius The arc radius.
-	 * @param nsegments The number of segments to use in drawing the arc.
+	 * \param start The initial angle (in radians).
+	 * \param angle The length of the arc (in radians).
+	 * \param radius The arc radius.
+	 * \param nsegments The number of segments to use in drawing the arc.
 	 */
 void glutil_draw_lined_arc	(float start, float angle, float radius, int nsegments);
 
 	/**
-	 * Draw a filled arc with the given @a radius, 
-	 * starting at angle @a start and arcing through 
-	 * @a angle. The arc is centered at the origin 
+	 * Draw a filled arc with the given \a radius,
+	 * starting at angle \a start and arcing through
+	 * \a angle. The arc is centered at the origin
 	 * and drawn in the XY plane.
 	 * 
-	 * @param start The initial angle (in radians).
-	 * @param angle The length of the arc (in radians).
-	 * @param radius The arc radius.
-	 * @param nsegments The number of segments to use in drawing the arc.
+	 * \param start The initial angle (in radians).
+	 * \param angle The length of the arc (in radians).
+	 * \param radius The arc radius.
+	 * \param nsegments The number of segments to use in drawing the arc.
 	 */
 void glutil_draw_filled_arc	(float start, float angle, float radius, int nsegments);
 
@@ -93,11 +95,11 @@ float glaGetOneFloat		(int param);
 
 	/**
 	 * Functions like glRasterPos2i, except ensures that the resulting
-	 * raster position is valid. @a known_good_x and @a known_good_y
+	 * raster position is valid. \a known_good_x and \a known_good_y
 	 * should be coordinates of a point known to be within the current
 	 * view frustum.
-	 * @attention This routine should be used when the distance of @a x 
-	 * and @y away from the known good point is small (ie. for small icons
+	 * \attention This routine should be used when the distance of \a x
+	 * and \a y away from the known good point is small (ie. for small icons
 	 * and for bitmap characters), when drawing large+zoomed images it is
 	 * possible for overflow to occur, the glaDrawPixelsSafe routine should
 	 * be used instead.
@@ -106,20 +108,20 @@ void glaRasterPosSafe2f		(float x, float y, float known_good_x, float known_good
 
 	/**
 	 * Functions like a limited glDrawPixels, except ensures that 
-	 * the image is displayed onscreen even if the @a x and @a y 
+	 * the image is displayed onscreen even if the \a x and \a y
 	 * coordinates for would be clipped. The routine respects the
 	 * glPixelZoom values, pixel unpacking parameters are _not_ 
 	 * respected.
-
-	 * @attention This routine makes many assumptions: the rect data
+	 *
+	 * \attention This routine makes many assumptions: the rect data
 	 * is expected to be in RGBA unsigned byte format, the coordinate
 	 * (0.375, 0.375) is assumed to be within the view frustum, and the 
 	 * modelview and projection matrices are assumed to define a 
 	 * 1-to-1 mapping to screen space.
-	 * @attention Furthmore, in the case of zoomed or unpixel aligned
+	 * \attention Furthermore, in the case of zoomed or unpixel aligned
 	 * images extending outside the view frustum, but still within the 
 	 * window, some portion of the image may be visible left and/or
-	 * below of the given @a x and @a y coordinates. It is recommended
+	 * below of the given \a x and \a y coordinates. It is recommended
 	 * to use the glScissor functionality if images are to be drawn
 	 * with an inset view matrix.
 	 */
@@ -131,8 +133,8 @@ void glaDrawPixelsSafe		(float x, float y, int img_w, int img_h, int row_w, int
 	 * cards, and also avoids problems with the raster position being
 	 * clipped when offscreen. The routine respects the glPixelZoom values, 
 	 * pixel unpacking parameters are _not_ respected.
-
-	 * @attention This routine makes many assumptions: the rect data
+	 *
+	 * \attention This routine makes many assumptions: the rect data
 	 * is expected to be in RGBA byte or float format, and the 
 	 * modelview and projection matrices are assumed to define a 
 	 * 1-to-1 mapping to screen space.
@@ -152,7 +154,7 @@ void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format,
 	 * thus no reason to +-0.5 the coordinates or perform other silly
 	 * tricks.
 	 *
-	 * @param screen_rect The screen rectangle to be defined for 2D drawing.
+	 * \param screen_rect The screen rectangle to be defined for 2D drawing.
 	 */
 void glaDefine2DArea		(struct rcti *screen_rect);
 
@@ -170,17 +172,17 @@ typedef struct gla2DDrawInfo gla2DDrawInfo;
 	 * thus no reason to +-0.5 the coordinates or perform other silly
 	 * tricks.
 	 *
-	 * @param screen_rect The screen rectangle to be used for 2D drawing.
-	 * @param world_rect The world rectangle that the 2D area represented
-	 * by @a screen_rect is supposed to represent. If NULL it is assumed the
+	 * \param screen_rect The screen rectangle to be used for 2D drawing.
+	 * \param world_rect The world rectangle that the 2D area represented
+	 * by \a screen_rect is supposed to represent. If NULL it is assumed the
 	 * world has a 1 to 1 mapping to the screen.
 	 */
 gla2DDrawInfo*	glaBegin2DDraw			(struct rcti *screen_rect, struct rctf *world_rect);
 
-	/** Translate the (@a wo_x, @a wo_y) point from world coordinates into screen space. */
+	/** Translate the (\a wo_x, \a wo_y) point from world coordinates into screen space. */
 void			gla2DDrawTranslatePt	(gla2DDrawInfo *di, float wo_x, float wo_y, int *sc_x_r, int *sc_y_r);
 
-	/** Translate the @a world point from world coordiantes into screen space. */
+	/** Translate the \a world point from world coordiantes into screen space. */
 void			gla2DDrawTranslatePtv	(gla2DDrawInfo *di, float world[2], int screen_r[2]);
 
 	/* Restores the previous OpenGL state and free's the auxilary
@@ -196,12 +198,12 @@ void gla2DSetMap(gla2DDrawInfo *di, struct rctf *rect);
 /* use this for platform hacks. glPointSize is solved here */
 void bglBegin(int mode);
 void bglEnd(void);
-int bglPointHack(void);
-void bglVertex3fv(float *vec);
+// int bglPointHack(void); /* UNUSED */
+void bglVertex3fv(const float vec[3]);
 void bglVertex3f(float x, float y, float z);
-void bglVertex2fv(float *vec);
+void bglVertex2fv(const float vec[2]);
 /* intel gfx cards frontbuffer problem */
-void bglFlush(void);
+// void bglFlush(void); /* UNUSED */
 void set_inverted_drawing(int enable);
 void setlinestyle(int nr);
 
@@ -216,5 +218,5 @@ typedef struct bglMats {
 } bglMats;
 void bgl_get_mats(bglMats *mats);
 
-#endif /* BIF_GLUTIL_H */
+#endif /* __BIF_GLUTIL_H__ */
 
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index 6b449f6..a9affbc 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -28,8 +28,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_ANIM_API_H
-#define ED_ANIM_API_H
+#ifndef __ED_ANIM_API_H__
+#define __ED_ANIM_API_H__
 
 struct ID;
 struct ListBase;
@@ -339,7 +339,7 @@ short ANIM_animdata_context_getdata(bAnimContext *ac);
 
 /* ------------------------ Drawing TypeInfo -------------------------- */
 
-/* flag-setting behaviour */
+/* flag-setting behavior */
 typedef enum eAnimChannels_SetFlag {
 	ACHANNEL_SETFLAG_CLEAR = 0,		/* turn off */
 	ACHANNEL_SETFLAG_ADD,			/* turn on */
@@ -358,7 +358,7 @@ typedef enum eAnimChannel_Settings {
 } eAnimChannel_Settings;
 
 
-/* Drawing, mouse handling, and flag setting behaviour... */
+/* Drawing, mouse handling, and flag setting behavior... */
 typedef struct bAnimChannelType {
 	/* type data */
 		/* name of the channel type, for debugging */
@@ -427,7 +427,7 @@ void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, int setting,
  *	- anim_data: list of the all the anim channels that can be chosen
  *		-> filtered using ANIMFILTER_CHANNELS only, since if we took VISIBLE too,
  *		  then the channels under closed expanders get ignored...
- *	- ale_setting: the anim channel (not in the anim_data list directly, though occuring there)
+ *	- ale_setting: the anim channel (not in the anim_data list directly, though occurring there)
  *		with the new state of the setting that we want flushed up/down the hierarchy 
  *	- setting: type of setting to set
  *	- on: whether the visibility setting has been enabled or disabled 
@@ -605,5 +605,5 @@ void ED_operatormacros_action(void);
 
 /* ************************************************ */
 
-#endif /* ED_ANIM_API_H */
+#endif /* __ED_ANIM_API_H__ */
 
diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h
index d345f16..851bd09 100644
--- a/source/blender/editors/include/ED_armature.h
+++ b/source/blender/editors/include/ED_armature.h
@@ -27,8 +27,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_ARMATURE_H
-#define ED_ARMATURE_H
+#ifndef __ED_ARMATURE_H__
+#define __ED_ARMATURE_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -56,32 +56,32 @@ struct wmOperator;
 typedef struct EditBone
 {
 	struct EditBone *next, *prev;
-	struct IDProperty 		*prop;			/* User-Defined Properties on this Bone */
-	struct EditBone *parent;/*	Editbones have a one-way link  (i.e. children refer
-									to parents.  This is converted to a two-way link for
-									normal bones when leaving editmode.	*/
-	void	*temp;			/*	Used to store temporary data */
-
-	char	name[64];		/* MAX_NAME */
-	float	roll;			/*	Roll along axis.  We'll ultimately use the axis/angle method
-								for determining the transformation matrix of the bone.  The axis
-								is tail-head while roll provides the angle. Refer to Graphics
-								Gems 1 p. 466 (section IX.6) if it's not already in here somewhere*/
-
-	float	head[3];			/*	Orientation and length is implicit during editing */
-	float	tail[3];	
-							/*	All joints are considered to have zero rotation with respect to
-							their parents.	Therefore any rotations specified during the
-							animation are automatically relative to the bones' rest positions*/
+	struct IDProperty *prop;/* User-Defined Properties on this Bone */
+	struct EditBone *parent;/* Editbones have a one-way link  (i.e. children refer
+	                         * to parents.  This is converted to a two-way link for
+	                         * normal bones when leaving editmode. */
+	void    *temp;          /* Used to store temporary data */
+
+	char    name[64];       /* MAX_NAME */
+	float   roll;           /* Roll along axis.  We'll ultimately use the axis/angle method
+	                         * for determining the transformation matrix of the bone.  The axis
+	                         * is tail-head while roll provides the angle. Refer to Graphics
+	                         * Gems 1 p. 466 (section IX.6) if it's not already in here somewhere*/
+
+	float	head[3];        /* Orientation and length is implicit during editing */
+	float	tail[3];
+	                        /* All joints are considered to have zero rotation with respect to
+	                         * their parents.	Therefore any rotations specified during the
+	                         * animation are automatically relative to the bones' rest positions*/
 	int		flag;
 	int		layer;
 	
 	float dist, weight;
-	float xwidth, length, zwidth;	/* put them in order! transform uses this as scale */
+	float xwidth, length, zwidth;  /* put them in order! transform uses this as scale */
 	float ease1, ease2;
 	float rad_head, rad_tail;
 	
-	float oldlength;				/* for envelope scaling */
+	float oldlength;        /* for envelope scaling */
 	
 	short segments;
 } EditBone;
@@ -128,7 +128,6 @@ struct EditBone *ED_armature_edit_bone_add(struct bArmature *arm, const char *na
 void ED_armature_edit_bone_remove(struct bArmature *arm, EditBone *exBone);
 
 void transform_armature_mirror_update(struct Object *obedit);
-void clear_armature(struct Scene *scene, struct Object *ob, char mode);
 void docenter_armature (struct Scene *scene, struct Object *ob, float cursor[3], int centermode, int around);
 
 void ED_armature_apply_transform(struct Object *ob, float mat[4][4]);
@@ -139,7 +138,6 @@ void ED_armature_apply_transform(struct Object *ob, float mat[4][4]);
 
 void create_vgroups_from_armature(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct Object *par, int mode, int mirror);
 
-void auto_align_armature(struct Scene *scene, struct View3D *v3d, short mode);
 void unique_editbone_name(struct ListBase *ebones, char *name, EditBone *bone); /* if bone is already in list, pass it as param to ignore it */
 void ED_armature_bone_rename(struct bArmature *arm, const char *oldnamep, const char *newnamep);
 
@@ -182,7 +180,7 @@ void mesh_deform_bind(struct Scene *scene,
 }
 #endif
 
-#endif /* ED_ARMATURE_H */
+#endif /* __ED_ARMATURE_H__ */
 
 
 
diff --git a/source/blender/editors/include/ED_clip.h b/source/blender/editors/include/ED_clip.h
index 7d36159..5e8ef61 100644
--- a/source/blender/editors/include/ED_clip.h
+++ b/source/blender/editors/include/ED_clip.h
@@ -28,8 +28,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_MOVIECLIP_H
-#define ED_MOVIECLIP_H
+#ifndef __ED_CLIP_H__
+#define __ED_CLIP_H__
 
 struct ARegion;
 struct bContext;
diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h
index 7e7d60f..50e43c4 100644
--- a/source/blender/editors/include/ED_curve.h
+++ b/source/blender/editors/include/ED_curve.h
@@ -28,8 +28,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_CURVE_H
-#define ED_CURVE_H
+#ifndef __ED_CURVE_H__
+#define __ED_CURVE_H__
 
 struct Base;
 struct bContext;
@@ -83,17 +83,16 @@ void	free_editText	(struct Object *obedit);
 void	ED_text_to_object(struct bContext *C, struct Text *text, int split_lines);
 
 int CU_select_nth(struct Object *obedit, int nth);
-ListBase *ED_curve_editnurbs(struct Curve *cu);
 
 void ED_curve_beztcpy(struct EditNurb *editnurb, struct BezTriple *dst, struct BezTriple *src, int count);
 void ED_curve_bpcpy(struct EditNurb *editnurb, struct BPoint *dst, struct BPoint *src, int count);
 
-int ED_curve_updateAnimPaths(struct Object *obedit);
+int ED_curve_updateAnimPaths(struct Curve *cu);
 
 int ED_curve_actSelection(struct Curve *cu, float center[3]);
 
 /* debug only */
 void printknots(struct Object *obedit);
 
-#endif /* ED_CURVE_H */
+#endif /* __ED_CURVE_H__ */
 
diff --git a/source/blender/editors/include/ED_datafiles.h b/source/blender/editors/include/ED_datafiles.h
index 2c4472c..9b20553 100644
--- a/source/blender/editors/include/ED_datafiles.h
+++ b/source/blender/editors/include/ED_datafiles.h
@@ -28,8 +28,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_DATAFILES_H
-#define ED_DATAFILES_H
+#ifndef __ED_DATAFILES_H__
+#define __ED_DATAFILES_H__
 
 /* Datafiles embedded in Blender */
 
@@ -56,7 +56,7 @@ extern char datatoc_bmonofont_ttf[];
 
 /* Brush icon datafiles */
 /* TODO: this could be simplified by putting all
-   the brush icons in one file */
+ * the brush icons in one file */
 extern int datatoc_add_png_size;
 extern char datatoc_add_png[];
 
@@ -69,6 +69,9 @@ extern char datatoc_blur_png[];
 extern int datatoc_clay_png_size;
 extern char datatoc_clay_png[];
 
+extern int datatoc_claystrips_png_size;
+extern char datatoc_claystrips_png[];
+
 extern int datatoc_clone_png_size;
 extern char datatoc_clone_png[];
 
@@ -142,5 +145,5 @@ extern int datatoc_vertexdraw_png_size;
 extern char datatoc_vertexdraw_png[];
 
 
-#endif /* ED_DATAFILES_H */
+#endif /* __ED_DATAFILES_H__ */
 
diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h
index dc362f9..7cf750f 100644
--- a/source/blender/editors/include/ED_fileselect.h
+++ b/source/blender/editors/include/ED_fileselect.h
@@ -28,8 +28,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_FILES_H
-#define ED_FILES_H
+#ifndef __ED_FILESELECT_H__
+#define __ED_FILESELECT_H__
 
 struct SpaceFile;
 struct ARegion;
@@ -106,5 +106,5 @@ void ED_fileselect_exit(struct bContext *C, struct SpaceFile *sfile);
 
 int ED_file_extension_icon(const char *relname);
 
-#endif /* ED_FILES_H */
+#endif /* __ED_FILESELECT_H__ */
 
diff --git a/source/blender/editors/include/ED_fluidsim.h b/source/blender/editors/include/ED_fluidsim.h
index d47ba2b..54acf73 100644
--- a/source/blender/editors/include/ED_fluidsim.h
+++ b/source/blender/editors/include/ED_fluidsim.h
@@ -32,8 +32,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_FLUIDSIM_H
-#define ED_FLUIDSIM_H
+#ifndef __ED_FLUIDSIM_H__
+#define __ED_FLUIDSIM_H__
 
 struct Object;
 struct FluidsimSettings;
@@ -48,4 +48,4 @@ void fluidsimSettingsFree(struct FluidsimSettings* sb);
 /* duplicate internal data */
 struct FluidsimSettings* fluidsimSettingsCopy(struct FluidsimSettings* sb);
 
-#endif /* ED_FLUIDSIM_H */
+#endif /* __ED_FLUIDSIM_H__ */
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index a640b5c..213fbda 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -27,8 +27,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_GPENCIL_H
-#define ED_GPENCIL_H
+#ifndef __ED_GPENCIL_H__
+#define __ED_GPENCIL_H__
 
 struct ListBase;
 struct bContext;
@@ -86,15 +86,12 @@ void gpencil_panel_standard(const struct bContext *C, struct Panel *pa);
 short gplayer_frames_looper(struct bGPDlayer *gpl, struct Scene *scene, short (*gpf_cb)(struct bGPDframe *, struct Scene *));
 void gplayer_make_cfra_list(struct bGPDlayer *gpl, ListBase *elems, short onlysel);
 
-void deselect_gpencil_layers(void *data, short select_mode);
-
 short is_gplayer_frame_selected(struct bGPDlayer *gpl);
 void set_gplayer_frame_selection(struct bGPDlayer *gpl, short mode);
 void select_gpencil_frames(struct bGPDlayer *gpl, short select_mode);
 void select_gpencil_frame(struct bGPDlayer *gpl, int selx, short select_mode);
 void borderselect_gplayer_frames(struct bGPDlayer *gpl, float min, float max, short select_mode);
 
-void delete_gpencil_layers(void);
 void delete_gplayer_frames(struct bGPDlayer *gpl);
 void duplicate_gplayer_frames(struct bGPDlayer *gpd);
 
@@ -109,4 +106,4 @@ void mirror_gplayer_frames(struct bGPDlayer *gpl, short mode);
 int ED_gpencil_session_active(void);
 int ED_undo_gpencil_step(struct bContext *C, int step, const char *name);
 
-#endif /*  ED_GPENCIL_H */
+#endif /*  __ED_GPENCIL_H__ */
diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h
index 05cde05..b95615c 100644
--- a/source/blender/editors/include/ED_image.h
+++ b/source/blender/editors/include/ED_image.h
@@ -27,8 +27,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_IMAGE_H
-#define ED_IMAGE_H
+#ifndef __ED_IMAGE_H__
+#define __ED_IMAGE_H__
 
 struct SpaceImage;
 struct Main;
@@ -70,5 +70,5 @@ void ED_image_update_frame(const struct Main *mainp, int cfra);
 void ED_image_draw_info(struct ARegion *ar, int color_manage, int channels, int x, int y,
                         const unsigned char cp[4], const float fp[4], int *zp, float *zpf);
 
-#endif /* ED_IMAGE_H */
+#endif /* __ED_IMAGE_H__ */
 
diff --git a/source/blender/editors/include/ED_info.h b/source/blender/editors/include/ED_info.h
index 7044ab6..6970aba 100644
--- a/source/blender/editors/include/ED_info.h
+++ b/source/blender/editors/include/ED_info.h
@@ -24,11 +24,11 @@
  *  \ingroup editors
  */
 
-#ifndef ED_INFO_H
-#define ED_INFO_H
+#ifndef __ED_INFO_H__
+#define __ED_INFO_H__
 
 /* info_stats.c */
 void ED_info_stats_clear(struct Scene *scene);
 const char *ED_info_stats_string(struct Scene *scene);
 
-#endif /*  ED_INFO_H */
+#endif /*  __ED_INFO_H__ */
diff --git a/source/blender/editors/include/ED_keyframes_draw.h b/source/blender/editors/include/ED_keyframes_draw.h
index 91723a1..7f68325 100644
--- a/source/blender/editors/include/ED_keyframes_draw.h
+++ b/source/blender/editors/include/ED_keyframes_draw.h
@@ -29,8 +29,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_KEYFRAMES_DRAW_H
-#define ED_KEYFRAMES_DRAW_H
+#ifndef __ED_KEYFRAMES_DRAW_H__
+#define __ED_KEYFRAMES_DRAW_H__
 
 struct bAnimContext;
 struct AnimData;
@@ -150,5 +150,5 @@ short compare_ab_cfraPtr(void *node, void *data);
 /* Checks if ActKeyBlock can be used (i.e. drawn/used to detect "holds") */
 short actkeyblock_is_valid(ActKeyBlock *ab, struct DLRBT_Tree *keys);
 
-#endif  /*  ED_KEYFRAMES_DRAW_H */
+#endif  /*  __ED_KEYFRAMES_DRAW_H__ */
 
diff --git a/source/blender/editors/include/ED_keyframes_edit.h b/source/blender/editors/include/ED_keyframes_edit.h
index 5881e8c..7ba37b4 100644
--- a/source/blender/editors/include/ED_keyframes_edit.h
+++ b/source/blender/editors/include/ED_keyframes_edit.h
@@ -28,8 +28,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_KEYFRAMES_EDIT_H
-#define ED_KEYFRAMES_EDIT_H
+#ifndef __ED_KEYFRAMES_EDIT_H__
+#define __ED_KEYFRAMES_EDIT_H__
 
 struct bAnimContext;
 struct bAnimListElem;
@@ -254,4 +254,4 @@ short paste_animedit_keys(struct bAnimContext *ac, ListBase *anim_data,
 
 /* ************************************************ */
 
-#endif /* ED_KEYFRAMES_EDIT_H */
+#endif /* __ED_KEYFRAMES_EDIT_H__ */
diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h
index eda84d0..afb1419 100644
--- a/source/blender/editors/include/ED_keyframing.h
+++ b/source/blender/editors/include/ED_keyframing.h
@@ -27,8 +27,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_KEYFRAMING_H
-#define ED_KEYFRAMING_H
+#ifndef __ED_KEYFRAMING_H__
+#define __ED_KEYFRAMING_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -132,10 +132,12 @@ typedef struct KeyingSetInfo {
 	struct KeyingSetInfo *next, *prev;
 	
 	/* info */
-		/* identifier so that user can hook this up to a KeyingSet */
-	char name[64];
 		/* identifier used for class name, which KeyingSet instances reference as "Typeinfo Name" */
 	char idname[64];
+		/* identifier so that user can hook this up to a KeyingSet (used as label). */
+	char name[64];
+		/* short help/description. */
+	char description[240]; /* RNA_DYN_DESCR_MAX */
 		/* keying settings */
 	short keyingflag;
 	
@@ -208,9 +210,6 @@ int ANIM_scene_get_keyingset_index(struct Scene *scene, struct KeyingSet *ks);
 /* Get Keying Set to use for Auto-Keyframing some transforms */
 struct KeyingSet *ANIM_get_keyingset_for_autokeying(struct Scene *scene, const char *tranformKSName);
 
-/* Create (and show) a menu containing all the Keying Sets which can be used in the current context */
-void ANIM_keying_sets_menu_setup(struct bContext *C, const char title[], const char op_name[]);
-
 /* Dynamically populate an enum of Keying Sets */
 struct EnumPropertyItem *ANIM_keying_sets_enum_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
 
@@ -324,10 +323,10 @@ int ED_autokeyframe_pchan(struct bContext *C, struct Scene *scene, struct Object
 #define ANIM_KS_SCALING_ID          "Scaling"
 #define ANIM_KS_LOC_ROT_SCALE_ID    "LocRotScale"
 #define ANIM_KS_AVAILABLE_ID        "Available"
-#define ANIM_KS_WHOLE_CHARACTER_ID  "Whole Character"
+#define ANIM_KS_WHOLE_CHARACTER_ID  "WholeCharacter"
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif /*  ED_KEYFRAMING_H */
+#endif /*  __ED_KEYFRAMING_H__ */
diff --git a/source/blender/editors/include/ED_logic.h b/source/blender/editors/include/ED_logic.h
index ce1f2b8..71a5552 100644
--- a/source/blender/editors/include/ED_logic.h
+++ b/source/blender/editors/include/ED_logic.h
@@ -27,10 +27,10 @@
  *  \ingroup editors
  */
 
-#ifndef ED_LOGIC_H
-#define ED_LOGIC_H
+#ifndef __ED_LOGIC_H__
+#define __ED_LOGIC_H__
 
 /* logic_ops.c */
 void ED_operatortypes_logic(void);
 
-#endif /* ED_LOGIC_H */
+#endif /* __ED_LOGIC_H__ */
diff --git a/source/blender/editors/include/ED_markers.h b/source/blender/editors/include/ED_markers.h
index 30a0d47..c0b5ba6 100644
--- a/source/blender/editors/include/ED_markers.h
+++ b/source/blender/editors/include/ED_markers.h
@@ -28,8 +28,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_MARKERS_H
-#define ED_MARKERS_H
+#ifndef __ED_MARKERS_H__
+#define __ED_MARKERS_H__
 
 struct wmKeyConfig;
 struct wmKeyMap;
@@ -77,5 +77,5 @@ void ED_marker_keymap_animedit_conflictfree(struct wmKeyMap *keymap);
 /* debugging only */
 void debug_markers_print_list(struct ListBase *markers);
 
-#endif /* ED_MARKERS_H */
+#endif /* __ED_MARKERS_H__ */
 
diff --git a/source/blender/editors/include/ED_mball.h b/source/blender/editors/include/ED_mball.h
index 2590048..89917f0 100644
--- a/source/blender/editors/include/ED_mball.h
+++ b/source/blender/editors/include/ED_mball.h
@@ -28,8 +28,8 @@
  *  \ingroup editors
  */
 
-#ifndef _ED_MBALL_H_
-#define _ED_MBALL_H_
+#ifndef __ED_MBALL_H__
+#define __ED_MBALL_H__
 
 struct bContext;
 struct Object;
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index 160e3ee..4c503a2 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -28,8 +28,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_MESH_H
-#define ED_MESH_H
+#ifndef __ED_MESH_H__
+#define __ED_MESH_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -38,10 +38,6 @@ extern "C" {
 struct ID;
 struct View3D;
 struct ARegion;
-struct EditMesh;
-struct EditVert;
-struct EditEdge;
-struct EditFace;
 struct bContext;
 struct wmOperator;
 struct wmWindowManager;
@@ -61,135 +57,133 @@ struct MCol;
 struct UvVertMap;
 struct UvMapVert;
 struct CustomData;
+struct BMEditMesh;
+struct BMEditSelection;
+struct BMesh;
+struct BMVert;
+struct MLoopCol;
+struct BMEdge;
+struct BMFace;
+struct UvVertMap;
+struct UvMapVert;
+struct ToolSettings;
 struct Material;
 struct Object;
 struct rcti;
 
-#define EM_FGON_DRAW	1 // face flag
-#define EM_FGON			2 // edge and face flag both
-
-/* editbutflag */
-#define B_CLOCKWISE			1
-#define B_KEEPORIG			2
-#define B_BEAUTY			4
-#define B_SMOOTH			8
-#define B_BEAUTY_SHORT  	0x10
-#define B_AUTOFGON			0x20
-#define B_KNIFE				0x80
-#define B_PERCENTSUBD		0x40
-//#define B_MESH_X_MIRROR		0x100 // deprecated, use mesh
-#define B_JOINTRIA_UV		0x200
-#define B_JOINTRIA_VCOL		0X400
-#define B_JOINTRIA_SHARP	0X800
-#define B_JOINTRIA_MAT		0X1000
-#define B_FRACTAL			0x2000
-#define B_SPHERE			0x4000
-
-/* meshtools.c */
-
-intptr_t   mesh_octree_table(struct Object *ob, struct EditMesh *em, float *co, char mode);
-int        mesh_mirrtopo_table(struct Object *ob, char mode);
-
-struct EditVert   *editmesh_get_x_mirror_vert(struct Object *ob, struct EditMesh *em, struct EditVert *eve, float *co, int index);
-int			mesh_get_x_mirror_vert(struct Object *ob, int index);
-int			*mesh_get_x_mirror_faces(struct Object *ob, struct EditMesh *em);
-
-int			join_mesh_exec(struct bContext *C, struct wmOperator *op);
-int			join_mesh_shapes_exec(struct bContext *C, struct wmOperator *op);
+intptr_t    mesh_octree_table(struct Object *ob, struct BMEditMesh *em, float *co, char mode);
+int         mesh_mirrtopo_table(struct Object *ob, char mode);
 
-/* mesh_ops.c */
-void		ED_operatortypes_mesh(void);
-void		ED_operatormacros_mesh(void);
-void		ED_keymap_mesh(struct wmKeyConfig *keyconf);
+/* editmesh_utils.c */
 
+/* retrieves mirrored cache vert, or NULL if there isn't one.
+ * note: calling this without ensuring the mirror cache state
+ * is bad.*/
+void           EDBM_verts_mirror_cache_begin(struct BMEditMesh *em, const short use_select); /* note, replaces EM_cache_x_mirror_vert in trunk */
+void           EDBM_verts_mirror_apply(struct BMEditMesh *em, const int sel_from, const int sel_to);
+struct BMVert *EDBM_verts_mirror_get(struct BMEditMesh *em, struct BMVert *v);
+void           EDBM_verts_mirror_cache_clear(struct BMEditMesh *em, struct BMVert *v);
+void           EDBM_verts_mirror_cache_end(struct BMEditMesh *em);
 
-/* editmesh.c */
-void		make_editMesh(struct Scene *scene, struct Object *ob);
-void		load_editMesh(struct Scene *scene, struct Object *ob);
-void		remake_editMesh(struct Scene *scene, struct Object *ob);
-void		free_editMesh(struct EditMesh *em);
-
-void		recalc_editnormals(struct EditMesh *em);
-
-void		EM_init_index_arrays(struct EditMesh *em, int forVert, int forEdge, int forFace);
-void		EM_free_index_arrays(void);
-struct EditVert	*EM_get_vert_for_index(int index);
-struct EditEdge	*EM_get_edge_for_index(int index);
-struct EditFace	*EM_get_face_for_index(int index);
-int			EM_texFaceCheck(struct EditMesh *em);
-int			EM_vertColorCheck(struct EditMesh *em);
-
-void		undo_push_mesh(struct bContext *C, const char *name);
-
-void		paintvert_flush_flags(struct Object *ob);
-void		paintvert_deselect_all_visible(struct Object *ob, int action, short flush_flags);
-
-/* editmesh_lib.c */
-
-struct EditFace	*EM_get_actFace(struct EditMesh *em, int sloppy);
-void             EM_set_actFace(struct EditMesh *em, struct EditFace *efa);
-float            EM_face_area(struct EditFace *efa);
-
-void		EM_select_edge(struct EditEdge *eed, int sel);
-void		EM_select_face(struct EditFace *efa, int sel);
-void		EM_select_face_fgon(struct EditMesh *em, struct EditFace *efa, int val);
-void		EM_select_swap(struct EditMesh *em);
-void		EM_toggle_select_all(struct EditMesh *em);
-void		EM_select_all(struct EditMesh *em);
-void		EM_deselect_all(struct EditMesh *em);
-void		EM_selectmode_flush(struct EditMesh *em);
-void		EM_deselect_flush(struct EditMesh *em);
-void		EM_selectmode_set(struct EditMesh *em);
-void		EM_select_flush(struct EditMesh *em);
-void		EM_convertsel(struct EditMesh *em, short oldmode, short selectmode);
-void		EM_validate_selections(struct EditMesh *em);
-void		EM_selectmode_to_scene(struct Scene *scene, struct Object *obedit);
-
-			/* exported to transform */
-int			EM_get_actSelection(struct EditMesh *em, struct EditSelection *ese);
-void		EM_editselection_normal(float *normal, struct EditSelection *ese);
-void		EM_editselection_plane(float *plane, struct EditSelection *ese);
-void		EM_editselection_center(float *center, struct EditSelection *ese);			
-
-struct UvVertMap *EM_make_uv_vert_map(struct EditMesh *em, int selected, int do_face_idx_array, float *limit);
-struct UvMapVert *EM_get_uv_map_vert(struct UvVertMap *vmap, unsigned int v);
-void              EM_free_uv_vert_map(struct UvVertMap *vmap);
-
-struct UvElementMap *EM_make_uv_element_map(struct EditMesh *em, int selected, int doIslands);
-void		EM_free_uv_element_map(struct UvElementMap *vmap);
-
-void		EM_add_data_layer(struct EditMesh *em, struct CustomData *data, int type, const char *name);
-void		EM_free_data_layer(struct EditMesh *em, struct CustomData *data, int type);
-
-void		EM_make_hq_normals(struct EditMesh *em);
-void		EM_solidify(struct EditMesh *em, float dist);
-
-int			EM_deselect_nth(struct EditMesh *em, int nth);
-
-void EM_project_snap_verts(struct bContext *C, struct ARegion *ar, struct Object *obedit, struct EditMesh *em);
+void EDBM_mesh_normals_update(struct BMEditMesh *em);
+
+void EDBM_mesh_make(struct ToolSettings *ts, struct Scene *scene, struct Object *ob);
+void EDBM_mesh_free(struct BMEditMesh *tm);
+void EDBM_mesh_load(struct Object *ob);
+
+void           EDBM_index_arrays_init(struct BMEditMesh *em, int forvert, int foredge, int forface);
+void           EDBM_index_arrays_free(struct BMEditMesh *em);
+struct BMVert *EDBM_vert_at_index(struct BMEditMesh *em, int index);
+struct BMEdge *EDBM_edge_at_index(struct BMEditMesh *em, int index);
+struct BMFace *EDBM_face_at_index(struct BMEditMesh *em, int index);
+
+/* flushes based on the current select mode.  if in vertex select mode,
+ * verts select/deselect edges and faces, if in edge select mode,
+ * edges select/deselect faces and vertices, and in face select mode faces select/deselect
+ * edges and vertices.*/
+void EDBM_select_more(struct BMEditMesh *em);
+void EDBM_select_less(struct BMEditMesh *em);
+
+void EDBM_selectmode_flush_ex(struct BMEditMesh *em, int selectmode);
+void EDBM_selectmode_flush(struct BMEditMesh *em);
+
+void EDBM_deselect_flush(struct BMEditMesh *em);
+void EDBM_select_flush(struct BMEditMesh *em);
+
+void EDBM_selectmode_set(struct BMEditMesh *em);
+void EDBM_selectmode_convert(struct BMEditMesh *em, short oldmode, short selectmode);
+void undo_push_mesh(struct bContext *C, const char *name);
+
+int  EDBM_vert_color_check(struct BMEditMesh *em);
+
+
+void EDBM_mesh_hide(struct BMEditMesh *em, int swap);
+void EDBM_mesh_reveal(struct BMEditMesh *em);
+
+void EDBM_update_generic(struct bContext *C, struct BMEditMesh *em, const short do_tessface);
+
+int  EDBM_backbuf_check(unsigned int index);
+int EDBM_backbuf_border_mask_init(struct ViewContext *vc, int mcords[][2], short tot,
+                                  short xmin, short ymin, short xmax, short ymax);
+void EDBM_backbuf_free(void);
+int  EDBM_backbuf_border_init(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax);
+int  EDBM_backbuf_circle_init(struct ViewContext *vc, short xs, short ys, short rads);
+
+void EDBM_deselect_by_material(struct BMEditMesh *em, const short index, const short select);
+
+struct UvElementMap *EDBM_uv_element_map_create(struct BMEditMesh *em, int selected, int doIslands);
+void                 EDBM_uv_element_map_free(struct UvElementMap *vmap);
+
+int              EDBM_mtexpoly_check(struct BMEditMesh *em);
+struct MTexPoly *EDBM_mtexpoly_active_get(struct BMEditMesh *em, struct BMFace **r_act_efa, int sloppy);
+
+void              EDBM_uv_vert_map_free(struct UvVertMap *vmap);
+struct UvMapVert *EDBM_uv_vert_map_at_index(struct UvVertMap *vmap, unsigned int v);
+struct UvVertMap *EDBM_uv_vert_map_create(struct BMEditMesh *em, int selected, int do_face_idx_array, float *limit);
+
+void EDBM_data_layer_add(struct BMEditMesh *em, struct CustomData *data, int type, const char *name);
+void EDBM_data_layer_free(struct BMEditMesh *em, struct CustomData *data, int type);
+
+void EDBM_select_toggle_all(struct BMEditMesh *em);
+void EDBM_select_swap(struct BMEditMesh *em); /* exported for UV */
+int  EDBM_select_interior_faces(struct BMEditMesh *em);
+
+void EDBM_flag_enable_all(struct BMEditMesh *em, const char hflag);
+void EDBM_flag_disable_all(struct BMEditMesh *em, const char hflag);
+void EDBM_select_mirrored(struct Object *obedit, struct BMEditMesh *em, int extend);
+void EDBM_automerge(struct Scene *scene, struct Object *ob, int update);
 
 /* editmesh_mods.c */
-extern unsigned int em_vertoffs, em_solidoffs, em_wireoffs;
+extern unsigned int bm_vertoffs, bm_solidoffs, bm_wireoffs;
+
+int         mouse_mesh(struct bContext *C, const int mval[2], short extend);
+
+struct BMVert *editbmesh_get_x_mirror_vert(struct Object *ob, struct BMEditMesh *em, struct BMVert *eve, float *co, int index);
+int            mesh_get_x_mirror_vert(struct Object *ob, int index);
+int           *mesh_get_x_mirror_faces(struct Object *ob, struct BMEditMesh *em);
+
+int         join_mesh_exec(struct bContext *C, struct wmOperator *op);
+int         join_mesh_shapes_exec(struct bContext *C, struct wmOperator *op);
+
+/* mesh_ops.c */
+void        ED_operatortypes_mesh(void);
+void        ED_operatormacros_mesh(void);
+void        ED_keymap_mesh(struct wmKeyConfig *keyconf);
 
-void		EM_cache_x_mirror_vert(struct Object *ob, struct EditMesh *em);
-int			mouse_mesh(struct bContext *C, const int mval[2], short extend);
-int			EM_check_backbuf(unsigned int index);
-int			EM_mask_init_backbuf_border(struct ViewContext *vc, int mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax);
-void		EM_free_backbuf(void);
-int			EM_init_backbuf_border(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax);
-int			EM_init_backbuf_circle(struct ViewContext *vc, short xs, short ys, short rads);
 
-void		EM_hide_mesh(struct EditMesh *em, int swap);
-void		EM_reveal_mesh(struct EditMesh *em);
+/* editmesh.c */
+
+void        ED_spacetypes_init(void);
+void        ED_keymap_mesh(struct wmKeyConfig *keyconf);
 
-void		EM_select_by_material(struct EditMesh *em, int index);
-void		EM_deselect_by_material(struct EditMesh *em, int index); 
+/* bmesh_mods.c */
+extern unsigned int bm_vertoffs, bm_solidoffs, bm_wireoffs;
 
-void		EM_automerge(struct Scene *scene, struct Object *obedit, int update);
+/* bmesh_tools.c (could be moved) */
+void EMBM_project_snap_verts(struct bContext *C, struct ARegion *ar, struct Object *obedit, struct BMEditMesh *em);
 
 /* editface.c */
 void paintface_flush_flags(struct Object *ob);
-struct MTFace	*EM_get_active_mtface(struct EditMesh *em, struct EditFace **act_efa, struct MCol **mcol, int sloppy);
 int paintface_mouse_select(struct bContext *C, struct Object *ob, const int mval[2], int extend);
 int do_paintface_box_select(struct ViewContext *vc, struct rcti *rect, int select, int extend);
 void paintface_deselect_all_visible(struct Object *ob, int action, short flush_flags);
@@ -199,40 +193,41 @@ int paintface_minmax(struct Object *ob, float *min, float *max);
 void paintface_hide(struct Object *ob, const int unselected);
 void paintface_reveal(struct Object *ob);
 
+void paintvert_deselect_all_visible(struct Object *ob, int action, short flush_flags);
+void        paintvert_flush_flags(struct Object *ob);
+
 /* object_vgroup.c */
 
 #define WEIGHT_REPLACE 1
 #define WEIGHT_ADD 2
 #define WEIGHT_SUBTRACT 3
 
-struct bDeformGroup		*ED_vgroup_add(struct Object *ob);
-struct bDeformGroup		*ED_vgroup_add_name(struct Object *ob, const char *name);
-void 					ED_vgroup_delete(struct Object *ob, struct bDeformGroup *defgroup);
-void					ED_vgroup_clear(struct Object *ob);
-void					ED_vgroup_select_by_name(struct Object *ob, const char *name);
-int						ED_vgroup_data_create(struct ID *id);
-int						ED_vgroup_give_array(struct ID *id, struct MDeformVert **dvert_arr, int *dvert_tot);
-int						ED_vgroup_copy_array(struct Object *ob, struct Object *ob_from);
-void					ED_vgroup_mirror(struct Object *ob, const short mirror_weights, const short flip_vgroups, const short all_vgroups);
-
-int						ED_vgroup_object_is_edit_mode(struct Object *ob);
-
-void		ED_vgroup_vert_add(struct Object *ob, struct bDeformGroup *dg, int vertnum,  float weight, int assignmode);
-void		ED_vgroup_vert_remove(struct Object *ob, struct bDeformGroup *dg, int vertnum);
-float		ED_vgroup_vert_weight(struct Object *ob, struct bDeformGroup *dg, int vertnum);
-
-/*needed by edge slide*/
-struct EditVert *editedge_getOtherVert(struct EditEdge *eed, struct EditVert *eve);
-struct EditVert *editedge_getSharedVert(struct EditEdge *eed, struct EditEdge *eed2);
-int editedge_containsVert(struct EditEdge *eed, struct EditVert *eve);
-int editface_containsVert(struct EditFace *efa, struct EditVert *eve);
-int editface_containsEdge(struct EditFace *efa, struct EditEdge *eed);
-short sharesFace(struct EditMesh *em, struct EditEdge *e1, struct EditEdge *e2);
+struct bDeformGroup *ED_vgroup_add(struct Object *ob);
+struct bDeformGroup *ED_vgroup_add_name(struct Object *ob, const char *name);
+void                 ED_vgroup_delete(struct Object *ob, struct bDeformGroup *defgroup);
+void                 ED_vgroup_clear(struct Object *ob);
+void                 ED_vgroup_select_by_name(struct Object *ob, const char *name);
+int                  ED_vgroup_data_create(struct ID *id);
+int                  ED_vgroup_give_array(struct ID *id, struct MDeformVert **dvert_arr, int *dvert_tot);
+int                  ED_vgroup_copy_array(struct Object *ob, struct Object *ob_from);
+void                 ED_vgroup_mirror(struct Object *ob, const short mirror_weights, const short flip_vgroups, const short all_vgroups);
+
+int                  ED_vgroup_object_is_edit_mode(struct Object *ob);
+
+void                 ED_vgroup_vert_add(struct Object *ob, struct bDeformGroup *dg, int vertnum,  float weight, int assignmode);
+void                 ED_vgroup_vert_remove(struct Object *ob, struct bDeformGroup *dg, int vertnum);
+float                ED_vgroup_vert_weight(struct Object *ob, struct bDeformGroup *dg, int vertnum);
+
+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);
 
 /* mesh_data.c */
 // void ED_mesh_geometry_add(struct Mesh *mesh, struct ReportList *reports, int verts, int edges, int faces);
-void ED_mesh_faces_add(struct Mesh *mesh, struct ReportList *reports, int count);
+void ED_mesh_polys_add(struct Mesh *mesh, struct ReportList *reports, int count);
+void ED_mesh_tessfaces_add(struct Mesh *mesh, struct ReportList *reports, int count);
 void ED_mesh_edges_add(struct Mesh *mesh, struct ReportList *reports, int count);
+void ED_mesh_loops_add(struct Mesh *mesh, struct ReportList *reports, int count);
 void ED_mesh_vertices_add(struct Mesh *mesh, struct ReportList *reports, int count);
 
 void ED_mesh_faces_remove(struct Mesh *mesh, struct ReportList *reports, int count);
@@ -241,22 +236,30 @@ void ED_mesh_vertices_remove(struct Mesh *mesh, struct ReportList *reports, int
 
 void ED_mesh_transform(struct Mesh *me, float *mat);
 void ED_mesh_calc_normals(struct Mesh *me);
+void ED_mesh_calc_tessface(struct Mesh *mesh);
 void ED_mesh_material_link(struct Mesh *me, struct Material *ma);
-void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges);
+void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges, int calc_tessface);
 
 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_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);
 
+void EDBM_selectmode_to_scene(struct bContext *C);
+void EDBM_mesh_clear(struct BMEditMesh *em);
+
+#include "../mesh/editmesh_bvh.h"
+
 
 /* mirrtopo */
 typedef struct MirrTopoStore_t {
 	intptr_t *index_lookup;
-	int       prev_vert_tot;
-	int       prev_edge_tot;
-	int       prev_ob_mode;
+	int prev_vert_tot;
+	int prev_edge_tot;
+	int prev_ob_mode;
 } MirrTopoStore_t;
 
 int  ED_mesh_mirrtopo_recalc_check(struct Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_topo_store);
@@ -268,5 +271,4 @@ void ED_mesh_mirrtopo_free(MirrTopoStore_t *mesh_topo_store);
 }
 #endif
 
-#endif /* ED_MESH_H */
-
+#endif /* __ED_MESH_H__ */
diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h
index 18bb497..192236b 100644
--- a/source/blender/editors/include/ED_node.h
+++ b/source/blender/editors/include/ED_node.h
@@ -28,8 +28,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_NODE_H
-#define ED_NODE_H
+#ifndef __ED_NODE_H__
+#define __ED_NODE_H__
 
 struct ID;
 struct Main;
@@ -63,5 +63,5 @@ void ED_node_set_active(struct Main *bmain, struct bNodeTree *ntree, struct bNod
 /* node ops.c */
 void ED_operatormacros_node(void);
 
-#endif /* ED_NODE_H */
+#endif /* __ED_NODE_H__ */
 
diff --git a/source/blender/editors/include/ED_numinput.h b/source/blender/editors/include/ED_numinput.h
index e2387c3..d51ece5 100644
--- a/source/blender/editors/include/ED_numinput.h
+++ b/source/blender/editors/include/ED_numinput.h
@@ -24,10 +24,19 @@
  *  \ingroup editors
  */
 
-#ifndef ED_NUMINPUT_H
-#define ED_NUMINPUT_H
+#ifndef __ED_NUMINPUT_H__
+#define __ED_NUMINPUT_H__
 
 
+/*
+ *  The ctrl value has different meaning:
+ *      0           : No value has been typed
+ *
+ *      otherwise, |value| - 1 is where the cursor is located after the period
+ *      Positive    : number is positive
+ *      Negative    : number is negative
+ */
+
 typedef struct NumInput {
 	short  idx;
 	short  idx_max;
@@ -36,7 +45,7 @@ typedef struct NumInput {
 	float  val[3];      /* Direct value of the input                                                      */
 	int    ctrl[3];     /* Control to indicate what to do with the numbers that are typed                 */
 	float  increment;
-} NumInput ;
+} NumInput;
 
 /* NUMINPUT FLAGS */
 #define NUM_NULL_ONE		2
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index f3e780d..85e68ba 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -28,8 +28,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_OBJECT_H
-#define ED_OBJECT_H
+#ifndef __ED_OBJECT_H__
+#define __ED_OBJECT_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -84,7 +84,7 @@ typedef enum eParentType {
 extern struct EnumPropertyItem prop_clear_parent_types[];
 extern struct EnumPropertyItem prop_make_parent_types[];
 
-int ED_object_parent_set(struct bContext *C, struct wmOperator *op, struct Object *par, int partype);
+int ED_object_parent_set(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob, struct Object *par, int partype);
 void ED_object_parent_clear(struct bContext *C, int type);
 
 
@@ -127,8 +127,8 @@ float ED_object_new_primitive_matrix(struct bContext *C, struct Object *editob,
 
 void ED_object_add_generic_props(struct wmOperatorType *ot, int do_editmode);
 int ED_object_add_generic_invoke(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
-int ED_object_add_generic_get_opts(struct bContext *C, struct wmOperator *op,
-	float *loc, float *rot, int *enter_editmode, unsigned int *layer);
+int ED_object_add_generic_get_opts(struct bContext *C, struct wmOperator *op, 
+	float *loc, float *rot, int *enter_editmode, unsigned int *layer, int *is_view_aligned);
 
 struct Object *ED_object_add_type(struct bContext *C, int type, float *loc,
 	float *rot, int enter_editmode, unsigned int layer);
@@ -178,5 +178,5 @@ int ED_object_modifier_copy(struct ReportList *reports, struct Object *ob, struc
 }
 #endif
 
-#endif /* ED_OBJECT_H */
+#endif /* __ED_OBJECT_H__ */
 
diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h
index 3035aa4..1c7f5cf 100644
--- a/source/blender/editors/include/ED_particle.h
+++ b/source/blender/editors/include/ED_particle.h
@@ -30,8 +30,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_PARTICLE_H
-#define ED_PARTICLE_H
+#ifndef __ED_PARTICLE_H__
+#define __ED_PARTICLE_H__
 
 struct bContext;
 struct Object;
@@ -74,5 +74,5 @@ int PE_undo_valid(struct Scene *scene);
 void PE_undo_number(struct Scene *scene, int nr);
 const char *PE_undo_get_name(struct Scene *scene, int nr, int *active);
 
-#endif /* ED_PARTICLE_H */
+#endif /* __ED_PARTICLE_H__ */
 
diff --git a/source/blender/editors/include/ED_physics.h b/source/blender/editors/include/ED_physics.h
index eadd156..6c885b9 100644
--- a/source/blender/editors/include/ED_physics.h
+++ b/source/blender/editors/include/ED_physics.h
@@ -30,8 +30,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_PHYSICS_H
-#define ED_PHYSICS_H
+#ifndef __ED_PHYSICS_H__
+#define __ED_PHYSICS_H__
 
 struct wmKeyConfig;
 
@@ -44,5 +44,5 @@ int PE_poll_view3d(struct bContext *C);
 void ED_operatortypes_physics(void);
 void ED_keymap_physics(struct wmKeyConfig *keyconf);
 
-#endif /* ED_PHYSICS_H */
+#endif /* __ED_PHYSICS_H__ */
 
diff --git a/source/blender/editors/include/ED_render.h b/source/blender/editors/include/ED_render.h
index 73776f7..5392ef8 100644
--- a/source/blender/editors/include/ED_render.h
+++ b/source/blender/editors/include/ED_render.h
@@ -25,8 +25,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_RENDER_H
-#define ED_RENDER_H
+#ifndef __ED_RENDER_H__
+#define __ED_RENDER_H__
 
 #include "DNA_vec_types.h"
 
@@ -37,6 +37,7 @@ struct MTex;
 struct Render;
 struct RenderInfo;
 struct Scene;
+struct ScrArea;
 
 /* render_ops.c */
 
@@ -46,6 +47,7 @@ void ED_operatortypes_render(void);
 
 void ED_render_id_flush_update(struct Main *bmain, struct ID *id);
 void ED_render_engine_changed(struct Main *bmain);
+void ED_render_engine_area_exit(struct ScrArea *sa);
 void ED_render_scene_update(struct Main *bmain, struct Scene *scene, int updated);
 
 /* render_preview.c */
@@ -67,12 +69,12 @@ typedef struct RenderInfo {
 #define PR_ROTATED			8
 
 /* Render the preview
-
-pr_method:
-- PR_BUTS_RENDER: preview is rendered for buttons window
-- PR_ICON_RENDER: preview is rendered for icons. hopefully fast enough for at least 32x32 
-- PR_NODE_RENDER: preview is rendered for node editor.
-*/
+ *
+ * pr_method:
+ * - PR_BUTS_RENDER: preview is rendered for buttons window
+ * - PR_ICON_RENDER: preview is rendered for icons. hopefully fast enough for at least 32x32
+ * - PR_NODE_RENDER: preview is rendered for node editor
+ */
 
 #define PR_BUTS_RENDER	0
 #define PR_ICON_RENDER	1
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index e0ff5cd..f0fffb3 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -28,8 +28,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_SCREEN_H
-#define ED_SCREEN_H
+#ifndef __ED_SCREEN_H__
+#define __ED_SCREEN_H__
 
 #include "DNA_screen_types.h"
 #include "DNA_space_types.h"
@@ -100,7 +100,7 @@ bScreen *ED_screen_duplicate(struct wmWindow *win, struct bScreen *sc);
 bScreen *ED_screen_add(struct wmWindow *win, struct Scene *scene, const char *name);
 void	ED_screen_set(struct bContext *C, struct bScreen *sc);
 void	ED_screen_delete(struct bContext *C, struct bScreen *sc);
-void	ED_screen_set_scene(struct bContext *C, struct Scene *scene);
+void	ED_screen_set_scene(struct bContext *C, struct bScreen *screen, struct Scene *scene);
 void	ED_screen_delete_scene(struct bContext *C, struct Scene *scene);
 void	ED_screen_set_subwinactive(struct bContext *C, struct wmEvent *event);
 void	ED_screen_exit(struct bContext *C, struct wmWindow *window, struct bScreen *screen);
@@ -111,8 +111,6 @@ void	ED_screen_full_prevspace(struct bContext *C, ScrArea *sa);
 void	ED_screen_full_restore(struct bContext *C, ScrArea *sa);
 struct ScrArea *ED_screen_full_toggle(struct bContext *C, struct wmWindow *win, struct ScrArea *sa);
 
-void	ED_screen_new_window(struct bContext *C, struct rcti *position, int type);
-
 /* anim */
 void	ED_update_for_newframe(struct Main *bmain, struct Scene *scene, struct bScreen *screen, int mute);
 
@@ -181,5 +179,5 @@ int		ED_operator_posemode(struct bContext *C);
 #define ED_KEYMAP_GPENCIL	32
 #define ED_KEYMAP_HEADER	64
 
-#endif /* ED_SCREEN_H */
+#endif /* __ED_SCREEN_H__ */
 
diff --git a/source/blender/editors/include/ED_screen_types.h b/source/blender/editors/include/ED_screen_types.h
index 544d366..6f7d0c5 100644
--- a/source/blender/editors/include/ED_screen_types.h
+++ b/source/blender/editors/include/ED_screen_types.h
@@ -28,8 +28,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_SCREEN_TYPES_H__
-#define ED_SCREEN_TYPES_H__
+#ifndef __ED_SCREEN_TYPES_H__
+#define __ED_SCREEN_TYPES_H__
 
 /* ----------------------------------------------------- */
 
@@ -41,6 +41,7 @@ typedef struct ScreenAnimData {
 	short flag;			/* flags for playback */
 	int sfra;			/* frame that playback was started from */
 	int nextfra;		/* next frame to go to (when ANIMPLAY_FLAG_USE_NEXT_FRAME is set) */
+	double last_duration;	/* used for frame dropping */
 } ScreenAnimData;
 
 /* for animplayer */
@@ -100,4 +101,4 @@ typedef struct AZone {
 #define	AZONE_AREA			1
 #define AZONE_REGION		2
 
-#endif /* ED_SCREEN_TYPES_H__ */
+#endif /* __ED_SCREEN_TYPES_H__ */
diff --git a/source/blender/editors/include/ED_sculpt.h b/source/blender/editors/include/ED_sculpt.h
index bd746e3..9cb32c3 100644
--- a/source/blender/editors/include/ED_sculpt.h
+++ b/source/blender/editors/include/ED_sculpt.h
@@ -27,8 +27,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_SCULPT_H
-#define ED_SCULPT_H
+#ifndef __ED_SCULPT_H__
+#define __ED_SCULPT_H__
 
 struct ARegion;
 struct bContext;
diff --git a/source/blender/editors/include/ED_sequencer.h b/source/blender/editors/include/ED_sequencer.h
index da2fce2..abeb00c 100644
--- a/source/blender/editors/include/ED_sequencer.h
+++ b/source/blender/editors/include/ED_sequencer.h
@@ -24,9 +24,9 @@
  *  \ingroup editors
  */
 
-#ifndef ED_SEQUENCER_H
-#define ED_SEQUENCER_H
+#ifndef __ED_SEQUENCER_H__
+#define __ED_SEQUENCER_H__
 
 #define SEQ_ZOOM_FAC(szoom) ((szoom) > 0.0f)? (szoom) : ((szoom) == 0.0f)? (1.0f) : (-1.0f/(szoom))
 
-#endif /*  ED_SEQUENCER_H */
+#endif /*  __ED_SEQUENCER_H__ */
diff --git a/source/blender/editors/include/ED_sound.h b/source/blender/editors/include/ED_sound.h
index a4e9009..d3e7502 100644
--- a/source/blender/editors/include/ED_sound.h
+++ b/source/blender/editors/include/ED_sound.h
@@ -28,10 +28,10 @@
  *  \ingroup editors
  */
 
-#ifndef ED_SOUND_H
-#define ED_SOUND_H
+#ifndef __ED_SOUND_H__
+#define __ED_SOUND_H__
 
 void ED_operatortypes_sound(void);
 
-#endif /* ED_SOUND_H */
+#endif /* __ED_SOUND_H__ */
 
diff --git a/source/blender/editors/include/ED_space_api.h b/source/blender/editors/include/ED_space_api.h
index b5a1ca1..8023eef 100644
--- a/source/blender/editors/include/ED_space_api.h
+++ b/source/blender/editors/include/ED_space_api.h
@@ -28,8 +28,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_SPACE_API_H
-#define ED_SPACE_API_H
+#ifndef __ED_SPACE_API_H__
+#define __ED_SPACE_API_H__
 
 struct ARegionType;
 struct bContext;
@@ -57,7 +57,7 @@ void ED_spacetype_userpref(void);
 void ED_spacetype_clip(void);
 
 /* calls for instancing and freeing spacetype static data 
-   called in WM_init_exit */
+ * called in WM_init_exit */
 /* in space_file.c */
 void ED_file_init(void);
 void ED_file_exit(void);
@@ -73,5 +73,5 @@ void ED_region_draw_cb_draw(const struct bContext *, struct ARegion *, int);
 void ED_region_draw_cb_exit(struct ARegionType *, void *);
 void *ED_region_draw_cb_customdata(void *handle);
 
-#endif /* ED_SPACE_API_H */
+#endif /* __ED_SPACE_API_H__ */
 
diff --git a/source/blender/editors/include/ED_text.h b/source/blender/editors/include/ED_text.h
index da01e25..9a36cb3 100644
--- a/source/blender/editors/include/ED_text.h
+++ b/source/blender/editors/include/ED_text.h
@@ -27,12 +27,12 @@
  *  \ingroup editors
  */
 
-#ifndef ED_TEXT_H
-#define ED_TEXT_H
+#ifndef __ED_TEXT_H__
+#define __ED_TEXT_H__
 
 struct bContext;
 
 void ED_text_undo_step(struct bContext *C, int step);
 
-#endif /* ED_TEXT_H */
+#endif /* __ED_TEXT_H__ */
 
diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h
index 2ca3e2b..f6dee35 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -29,8 +29,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_TRANSFORM_H
-#define ED_TRANSFORM_H
+#ifndef __ED_TRANSFORM_H__
+#define __ED_TRANSFORM_H__
 
 /* ******************* Registration Function ********************** */
 
@@ -108,13 +108,6 @@ struct Base;
 struct Scene;
 struct Object;
 
-#if 0 /* UNUSED, deprecate? */
-void BIF_setSingleAxisConstraint(float vec[3], char *text);
-void BIF_setDualAxisConstraint(float vec1[3], float vec2[3], char *text);
-void BIF_setLocalAxisConstraint(char axis, char *text);
-void BIF_setLocalLockConstraint(char axis, char *text);
-#endif
-
 int BIF_snappingSupported(struct Object *obedit);
 
 struct TransformOrientation;
@@ -125,7 +118,6 @@ void BIF_clearTransformOrientation(struct bContext *C);
 void BIF_removeTransformOrientation(struct bContext *C, struct TransformOrientation *ts);
 void BIF_removeTransformOrientationIndex(struct bContext *C, int index);
 void BIF_createTransformOrientation(struct bContext *C, struct ReportList *reports, char *name, int use, int overwrite);
-int BIF_menuselectTransformOrientation(void);
 void BIF_selectTransformOrientation(struct bContext *C, struct TransformOrientation *ts);
 void BIF_selectTransformOrientationValue(struct bContext *C, int orientation);
 
@@ -183,8 +175,8 @@ typedef enum SnapMode
 
 #define SNAP_MIN_DISTANCE 30
 
-int peelObjectsTransForm(struct TransInfo *t, struct ListBase *depth_peels, const float mval[2]);
-int peelObjectsContext(struct bContext *C, struct ListBase *depth_peels, const float mval[2]);
+int peelObjectsTransForm(struct TransInfo *t, struct ListBase *depth_peels, const float mval[2], SnapMode mode);
+int peelObjectsContext(struct bContext *C, struct ListBase *depth_peels, const float mval[2], SnapMode mode);
 int snapObjectsTransform(struct TransInfo *t, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode);
 int snapObjectsContext(struct bContext *C, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode);
 
diff --git a/source/blender/editors/include/ED_types.h b/source/blender/editors/include/ED_types.h
index 6ea45c9..c410447 100644
--- a/source/blender/editors/include/ED_types.h
+++ b/source/blender/editors/include/ED_types.h
@@ -28,8 +28,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_TYPES_H
-#define ED_TYPES_H
+#ifndef __ED_TYPES_H__
+#define __ED_TYPES_H__
 
 /* **************** GENERAL EDITOR-WIDE TYPES AND DEFINES ************************** */
 
@@ -44,5 +44,5 @@
 
 
 
-#endif /* ED_TYPES_H */
+#endif /* __ED_TYPES_H__ */
 
diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h
index c08e5ea..9bde252 100644
--- a/source/blender/editors/include/ED_util.h
+++ b/source/blender/editors/include/ED_util.h
@@ -28,8 +28,8 @@
  *  \ingroup editors
  */
 
-#ifndef ED_UTIL_H
-#define ED_UTIL_H
+#ifndef __ED_UTIL_H__
+#define __ED_UTIL_H__
 
 struct Scene;
 struct Object;
@@ -38,7 +38,7 @@ struct ARegion;
 struct uiBlock;
 struct wmOperator;
 struct wmOperatorType;
-struct EditMesh;
+struct BMEditMesh;
 struct Mesh;
 
 /* ed_util.c */
@@ -70,8 +70,8 @@ int		ED_undo_valid			(const struct bContext *C, const char *undoname);
 void undo_editmode_push(struct bContext *C, const char *name, 
 						void * (*getdata)(struct bContext *C),
 						void (*freedata)(void *), 
-						void (*to_editmode)(void *, void *),  
-						void *(*from_editmode)(void *),
+						void (*to_editmode)(void *, void *, void *),  
+						void *(*from_editmode)(void *, void *),
 						int (*validate_undo)(void *, void *));
 
 						
@@ -79,7 +79,7 @@ void	undo_editmode_clear			(void);
 
 /* crazyspace.c */
 float *crazyspace_get_mapped_editverts(struct Scene *scene, struct Object *obedit);
-void crazyspace_set_quats_editmesh(struct EditMesh *em, float *origcos, float *mappedcos, float *quats);
+void crazyspace_set_quats_editmesh(struct BMEditMesh *em, float *origcos, float *mappedcos, float *quats);
 void crazyspace_set_quats_mesh(struct Mesh *me, float *origcos, float *mappedcos, float *quats);
 int sculpt_get_first_deform_matrices(struct Scene *scene, struct Object *ob, float (**deformmats)[3][3], float (**deformcos)[3]);
 void crazyspace_build_sculpt(struct Scene *scene, struct Object *ob, float (**deformmats)[3][3], float (**deformcos)[3]);
@@ -93,5 +93,5 @@ int GetButStringLength(const char *str);
 /* where else to go ? */
 void unpack_menu(struct bContext *C, const char *opname, const char *id_name, const char *abs_name, const char *folder, struct PackedFile *pf);
 
-#endif /* ED_UTIL_H */
+#endif /* __ED_UTIL_H__ */
 
diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h
index bc8a12c..3569c0e 100644
--- a/source/blender/editors/include/ED_uvedit.h
+++ b/source/blender/editors/include/ED_uvedit.h
@@ -27,15 +27,18 @@
  *  \ingroup editors
  */
 
-#ifndef ED_UVEDIT_H
-#define ED_UVEDIT_H
+#ifndef __ED_UVEDIT_H__
+#define __ED_UVEDIT_H__
 
 struct ARegionType;
-struct EditFace;
+struct BMEditMesh;
+struct BMFace;
+struct BMLoop;
 struct Image;
-struct Main;
 struct ImageUser;
 struct MTFace;
+struct MTexPoly;
+struct Main;
 struct Object;
 struct Scene;
 struct SpaceImage;
@@ -48,27 +51,25 @@ void ED_operatortypes_uvedit(void);
 void ED_keymap_uvedit(struct wmKeyConfig *keyconf);
 
 void ED_uvedit_assign_image(struct Main *bmain, struct Scene *scene, struct Object *obedit, struct Image *ima, struct Image *previma);
-int ED_uvedit_minmax(struct Scene *scene, struct Image *ima, struct Object *obedit, float *min, float *max);
+int  ED_uvedit_minmax(struct Scene *scene, struct Image *ima, struct Object *obedit, float *min, float *max);
 
-int ED_object_get_active_image(struct Object *ob, int mat_nr, struct Image **ima, struct ImageUser **iuser, struct bNode **node);
+int  ED_object_get_active_image(struct Object *ob, int mat_nr, struct Image **ima, struct ImageUser **iuser, struct bNode **node);
 void ED_object_assign_active_image(struct Main *bmain, struct Object *ob, int mat_nr, struct Image *ima);
 
-int ED_uvedit_test_silent(struct Object *obedit);
 int ED_uvedit_test(struct Object *obedit);
 
 /* visibility and selection */
-int uvedit_edge_selected(struct Scene *scene, struct EditFace *efa, struct MTFace *tf, int i);
-int uvedit_face_selected(struct Scene *scene, struct EditFace *efa, struct MTFace *tf);
-int uvedit_face_visible_nolocal(struct Scene *scene, struct EditFace *efa);
-int uvedit_face_visible(struct Scene *scene, struct Image *ima, struct EditFace *efa, struct MTFace *tf);
-int uvedit_uv_selected(struct Scene *scene, struct EditFace *efa, struct MTFace *tf, int i);
-void uvedit_edge_deselect(struct Scene *scene, struct EditFace *efa, struct MTFace *tf, int i);
-void uvedit_edge_select(struct Scene *scene, struct EditFace *efa, struct MTFace *tf, int i);
-void uvedit_face_deselect(struct Scene *scene, struct EditFace *efa, struct MTFace *tf);
-void uvedit_face_select(struct Scene *scene, struct EditFace *efa, struct MTFace *tf);
-void uvedit_uv_deselect(struct Scene *scene, struct EditFace *efa, struct MTFace *tf, int i);
-void uvedit_uv_select(struct Scene *scene, struct EditFace *efa, struct MTFace *tf, int i);
-
+int  uvedit_face_visible_test(struct Scene *scene, struct Image *ima, struct BMFace *efa, struct MTexPoly *tf);
+int  uvedit_face_select_test(struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa);
+int  uvedit_edge_select_test(struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l);
+int  uvedit_uv_select_test(struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l);
+
+int  uvedit_face_select_enable(struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa, const short do_history);
+int  uvedit_face_select_disable(struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa);
+void uvedit_edge_select_enable(struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l, const short do_history);
+void uvedit_edge_select_disable(struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l);
+void uvedit_uv_select_enable(struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l, const short do_history);
+void uvedit_uv_select_disable(struct BMEditMesh *em, struct Scene *scene, struct BMLoop *l);
 
 int ED_uvedit_nearest_uv(struct Scene *scene, struct Object *obedit, struct Image *ima, float co[2], float uv[2]);
 
@@ -77,6 +78,8 @@ void ED_uvedit_live_unwrap_begin(struct Scene *scene, struct Object *obedit);
 void ED_uvedit_live_unwrap_re_solve(void);
 void ED_uvedit_live_unwrap_end(short cancel);
 
+void ED_uvedit_live_unwrap(struct Scene *scene, struct Object *obedit);
+
 /* single call up unwrap using scene settings, used for edge tag unwrapping */
 void ED_unwrap_lscm(struct Scene *scene, struct Object *obedit, const short sel);
 
@@ -86,5 +89,5 @@ void draw_uvedit_main(struct SpaceImage *sima, struct ARegion *ar, struct Scene
 /* uvedit_buttons.c */
 void ED_uvedit_buttons_register(struct ARegionType *art);
 
-#endif /* ED_UVEDIT_H */
+#endif /* __ED_UVEDIT_H__ */
 
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 7616e25..f886c01 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -28,32 +28,34 @@
  *  \ingroup editors
  */
 
-#ifndef ED_VIEW3D_H
-#define ED_VIEW3D_H
+#ifndef __ED_VIEW3D_H__
+#define __ED_VIEW3D_H__
 
 /* ********* exports for space_view3d/ module ********** */
 struct ARegion;
-struct bContext;
+struct BMEdge;
+struct BMFace;
+struct BMVert;
+struct BPoint;
+struct BezTriple;
 struct BezTriple;
-struct bglMats;
 struct BoundBox;
-struct BPoint;
-struct EditEdge;
-struct EditFace;
-struct EditVert;
 struct ImBuf;
+struct MVert;
 struct Main;
 struct Nurb;
+struct Nurb;
 struct Object;
-struct rcti;
 struct RegionView3D;
 struct Scene;
 struct View3D;
 struct ViewContext;
-struct wmWindow;
-struct MVert;
-struct wmOperatorType;
+struct bContext;
+struct bglMats;
+struct rcti;
 struct wmOperator;
+struct wmOperatorType;
+struct wmWindow;
 
 /* for derivedmesh drawing callbacks, for view3d_select, .... */
 typedef struct ViewContext {
@@ -63,7 +65,7 @@ typedef struct ViewContext {
 	struct ARegion *ar;
 	struct View3D *v3d;
 	struct RegionView3D *rv3d;
-	struct EditMesh *em;
+	struct BMEditMesh *em;
 	int mval[2];
 } ViewContext;
 
@@ -89,10 +91,10 @@ int initgrabz(struct RegionView3D *rv3d, float x, float y, float z);
 
 /**
  * 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.
+ * \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(struct ARegion *ar, const float depth_pt[3], const float mval[2], float out[3]);
 
@@ -100,9 +102,9 @@ void ED_view3d_win_to_3d(struct ARegion *ar, const float depth_pt[3], const floa
  * 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.
+ * \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(struct ARegion *ar, const float mval[2], float out[3]);
 
@@ -110,9 +112,9 @@ void ED_view3d_win_to_delta(struct ARegion *ar, const float mval[2], float out[3
  * 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.
- * @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.
+ * \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(struct ARegion *ar, const float mval[2], float out[3]);
 
@@ -122,11 +124,11 @@ void ED_view3d_win_to_vector(struct ARegion *ar, const float mval[2], float out[
  * 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.
+ * \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(struct ARegion *ar, struct View3D *v3d, const float mval[2], float ray_start[3], float ray_end[3]);
 
@@ -135,64 +137,64 @@ void ED_view3d_win_to_segment_clip(struct ARegion *ar, struct View3D *v3d, const
  * 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.
+ * \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(struct ARegion *ar, struct View3D *v3d, const float mval[2], float ray_start[3], float ray_normal[3]);
 
 /**
  * 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.
+ * \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(struct RegionView3D *rv3d, const float coord[3], float vec[3]);
 
 /**
  * Calculate the view transformation matrix from RegionView3D input.
- * The resulting matrix is equivilent to RegionView3D.viewinv
- * @param mat The view 4x4 transformation matrix to calculate.
- * @param ofs The view offset, normally from RegionView3D.ofs.
- * @param quat The view rotation, quaternion normally from RegionView3D.viewquat.
- * @param dist The view distance from ofs, normally from RegionView3D.dist.
+ * The resulting matrix is equivalent to RegionView3D.viewinv
+ * \param mat The view 4x4 transformation matrix to calculate.
+ * \param ofs The view offset, normally from RegionView3D.ofs.
+ * \param quat The view rotation, quaternion normally from RegionView3D.viewquat.
+ * \param dist The view distance from ofs, normally from RegionView3D.dist.
  */
 void ED_view3d_to_m4(float mat[][4], const float ofs[3], const float quat[4], const float dist);
 
 /**
  * Set the view transformation from a 4x4 matrix.
- * @param mat The view 4x4 transformation matrix to assign.
- * @param ofs The view offset, normally from RegionView3D.ofs.
- * @param quat The view rotation, quaternion normally from RegionView3D.viewquat.
- * @param dist The view distance from ofs, normally from RegionView3D.dist.
+ * \param mat The view 4x4 transformation matrix to assign.
+ * \param ofs The view offset, normally from RegionView3D.ofs.
+ * \param quat The view rotation, quaternion normally from RegionView3D.viewquat.
+ * \param dist The view distance from ofs, normally from RegionView3D.dist.
  */
 void ED_view3d_from_m4(float mat[][4], float ofs[3], float quat[4], float *dist);
 
 /**
  * Set the RegionView3D members from an objects transformation and optionally lens.
- * @param ob The object to set the view to.
- * @param ofs The view offset to be set, normally from RegionView3D.ofs.
- * @param quat The view rotation to be set, quaternion normally from RegionView3D.viewquat.
- * @param dist The view distance from ofs to be set, normally from RegionView3D.dist.
- * @param lens The view lens angle set for cameras and lamps, normally from View3D.lens.
+ * \param ob The object to set the view to.
+ * \param ofs The view offset to be set, normally from RegionView3D.ofs.
+ * \param quat The view rotation to be set, quaternion normally from RegionView3D.viewquat.
+ * \param dist The view distance from ofs to be set, normally from RegionView3D.dist.
+ * \param lens The view lens angle set for cameras and lamps, normally from View3D.lens.
  */
 void ED_view3d_from_object(struct Object *ob, float ofs[3], float quat[4], float *dist, float *lens);
 
 /**
  * Set the object transformation from RegionView3D members.
- * @param ob The object which has the transformation assigned.
- * @param ofs The view offset, normally from RegionView3D.ofs.
- * @param quat The view rotation, quaternion normally from RegionView3D.viewquat.
- * @param dist The view distance from ofs, normally from RegionView3D.dist.
+ * \param ob The object which has the transformation assigned.
+ * \param ofs The view offset, normally from RegionView3D.ofs.
+ * \param quat The view rotation, quaternion normally from RegionView3D.viewquat.
+ * \param dist The view distance from ofs, normally from RegionView3D.dist.
  */
 void ED_view3d_to_object(struct Object *ob, const float ofs[3], const float quat[4], const float dist);
 
-#if 0 /* UNUSED */
+//#if 0 /* UNUSED */
 void view3d_unproject(struct bglMats *mats, float out[3], const short x, const short y, const float z);
-#endif
+//#endif
 
 /* Depth buffer */
 void ED_view3d_depth_update(struct ARegion *ar);
@@ -217,20 +219,24 @@ void project_float_noclip(struct ARegion *ar, const float vec[3], float adr[2]);
 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_project_float(const struct ARegion *a, const float vec[3], float adr[2], float mat[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_project_float_v2(const struct ARegion *a, const float vec[3], float adr[2], float mat[4][4]);
+void ED_view3d_project_float_v3(struct ARegion *a, const float vec[3], float adr[3], float mat[4][4]);
 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 EditVert *eve, int x, int y, int index), void *userData, eV3DClipTest clipVerts);
-void mesh_foreachScreenEdge(struct ViewContext *vc, void (*func)(void *userData, struct EditEdge *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 EditFace *efa, int x, int y, int index), void *userData);
+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 lattice_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct BPoint *bp, int x, int y), void *userData);
 
-void ED_view3d_local_clipping(struct RegionView3D *rv3d, float mat[][4]);
-int ED_view3d_test_clipping(struct RegionView3D *rv3d, const float vec[3], const int local);
-void ED_view3d_align_axis_to_vector(struct View3D *v3d, struct RegionView3D *rv3d, int axisidx, float vec[3]);
+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);
+void ED_view3d_clipping_set(struct RegionView3D *rv3d);
+void ED_view3d_clipping_enable(void);
+void ED_view3d_clipping_disable(void);
+
 float ED_view3d_pixel_size(struct RegionView3D *rv3d, const float co[3]);
 
 void drawcircball(int mode, const float cent[3], float rad, float tmat[][4]);
@@ -278,14 +284,15 @@ 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(struct Scene *scene, struct View3D *v3d, struct ARegion *ar,
-	int winx, int winy, float viewmat[][4], float winmat[][4]);
+	int winx, int winy, float viewmat[][4], float winmat[][4], int draw_background);
 
-struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int sizex, int sizey, unsigned int flag, char err_out[256]);
-struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(struct Scene *scene, struct Object *camera, int width, int height, unsigned int flag, int drawtype, char err_out[256]);
+struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int sizex, int sizey, unsigned int flag, int draw_background, char err_out[256]);
+struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(struct Scene *scene, struct Object *camera, int width, int height, unsigned int flag, int drawtype, int draw_background, char err_out[256]);
 
 
 struct Base *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]);
 void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, short do_clip);
+void ED_view3d_update_viewmat(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, float viewmat[][4], float winmat[][4]);
 int ED_view3d_lock(struct RegionView3D *rv3d);
 
 uint64_t ED_view3d_datamask(struct Scene *scene, struct View3D *v3d);
@@ -304,8 +311,11 @@ void ED_view3D_background_image_remove(struct View3D *v3d, struct BGpic *bgpic);
 void ED_view3D_background_image_clear(struct View3D *v3d);
 
 /* view matrix properties utilities */
+/* unused */
+#if 0
 void ED_view3d_operator_properties_viewmat(struct wmOperatorType *ot);
 void ED_view3d_operator_properties_viewmat_set(struct bContext *C, struct wmOperator *op);
 void ED_view3d_operator_properties_viewmat_get(struct wmOperator *op, int *winx, int *winy, float persmat[4][4]);
+#endif
 
-#endif /* ED_VIEW3D_H */
+#endif /* __ED_VIEW3D_H__ */
diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h
index f102ecb..c1fa45a 100644
--- a/source/blender/editors/include/UI_icons.h
+++ b/source/blender/editors/include/UI_icons.h
@@ -29,8 +29,8 @@
  */
 
 /* Note: this is included twice with different #defines for DEF_ICON
-   once from UI_resources.h for the internal icon enum and
-   once for interface_api.c for the definition of the RNA enum for the icons */
+ * once from UI_resources.h for the internal icon enum and
+ * once for interface_api.c for the definition of the RNA enum for the icons */
 
 /* ICON_ prefix added */
 DEF_ICON(NONE)
@@ -843,17 +843,13 @@ DEF_ICON(LONGDISPLAY)
 DEF_ICON(SHORTDISPLAY)
 DEF_ICON(GHOST)
 DEF_ICON(IMGDISPLAY)
-#ifndef DEF_ICON_BLANK_SKIP
-	DEF_ICON(BLANK284)
-	DEF_ICON(BLANK285)
-#endif
+DEF_ICON(SAVE_AS)
+DEF_ICON(SAVE_COPY)
 DEF_ICON(BOOKMARKS)
 DEF_ICON(FONTPREVIEW)
 DEF_ICON(FILTER)
 DEF_ICON(NEWFOLDER)
-#ifndef DEF_ICON_BLANK_SKIP
-	DEF_ICON(BLANK285F)
-#endif
+DEF_ICON(OPEN_RECENT)
 DEF_ICON(FILE_PARENT)
 DEF_ICON(FILE_REFRESH)
 DEF_ICON(FILE_FOLDER)
@@ -864,26 +860,26 @@ DEF_ICON(FILE_MOVIE)
 DEF_ICON(FILE_SCRIPT)
 DEF_ICON(FILE_SOUND)
 DEF_ICON(FILE_FONT)
-#ifndef DEF_ICON_BLANK_SKIP
-	DEF_ICON(BLANK291b)
+DEF_ICON(FILE_TEXT)
 
-	/* available */
-	DEF_ICON(BLANK292)
-	DEF_ICON(BLANK293)
-	DEF_ICON(BLANK294)
-	DEF_ICON(BLANK295)
-	DEF_ICON(BLANK296)
-	DEF_ICON(BLANK297)
-	DEF_ICON(BLANK298)
-	DEF_ICON(BLANK299)
+	/* FILE SELECT */
+DEF_ICON(RECOVER_AUTO)
+DEF_ICON(SAVE_PREFS)
+DEF_ICON(LINK_BLEND)
+DEF_ICON(APPEND_BLEND)
+DEF_ICON(IMPORT)
+DEF_ICON(EXPORT)
+DEF_ICON(EXTERNAL_DATA)
+DEF_ICON(LOAD_FACTORY)
+#ifndef DEF_ICON_BLANK_SKIP
 	DEF_ICON(BLANK300)
 	DEF_ICON(BLANK301)
 	DEF_ICON(BLANK302)
 	DEF_ICON(BLANK303)
 	DEF_ICON(BLANK304)
-	DEF_ICON(BLANK305)
-	DEF_ICON(BLANK306)
 #endif
+DEF_ICON(LOOP_BACK)
+DEF_ICON(LOOP_FORWARDS)
 DEF_ICON(BACK)
 DEF_ICON(FORWARD)
 #ifndef DEF_ICON_BLANK_SKIP
@@ -968,6 +964,7 @@ DEF_ICON(BRUSH_ADD)
 DEF_ICON(BRUSH_BLOB)
 DEF_ICON(BRUSH_BLUR)
 DEF_ICON(BRUSH_CLAY)
+DEF_ICON(BRUSH_CLAY_STRIPS)
 DEF_ICON(BRUSH_CLONE)
 DEF_ICON(BRUSH_CREASE)
 DEF_ICON(BRUSH_DARKEN)
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 3f90700..d262c65 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -29,8 +29,8 @@
  *  \ingroup editorui
  */
 
-#ifndef UI_INTERFACE_H
-#define UI_INTERFACE_H
+#ifndef __UI_INTERFACE_H__
+#define __UI_INTERFACE_H__
 
 #include "BLO_sys_types.h" /* size_t */
 #include "RNA_types.h"
@@ -48,6 +48,7 @@ struct wmWindowManager;
 struct wmOperator;
 struct AutoComplete;
 struct bContext;
+struct bContextStore;
 struct Panel;
 struct PanelType;
 struct PointerRNA;
@@ -178,11 +179,11 @@ typedef struct uiLayout uiLayout;
 #define UI_DPI_ICON_SIZE ((float)16 * UI_DPI_ICON_FAC)
 
 /* Button types, bits stored in 1 value... and a short even!
-- bits 0-4:  bitnr (0-31)
-- bits 5-7:  pointer type
-- bit  8:    for 'bit'
-- bit  9-15: button type (now 6 bits, 64 types)
-*/
+ * - bits 0-4:  bitnr (0-31)
+ * - bits 5-7:  pointer type
+ * - bit  8:    for 'bit'
+ * - bit  9-15: button type (now 6 bits, 64 types)
+ * */
 
 #define CHA	32
 #define SHO	64
@@ -268,7 +269,6 @@ void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad);
 void uiSetRoundBox(int type);
 int uiGetRoundBox(void);
 void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad);
-void uiDrawMenuBox(float minx, float miny, float maxx, float maxy, short flag, short direction);
 void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, float maxy);
 void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float rad);
 void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown);
@@ -322,10 +322,22 @@ uiPopupMenu *uiPupMenuBegin(struct bContext *C, const char *title, int icon);
 void uiPupMenuEnd(struct bContext *C, struct uiPopupMenu *head);
 struct uiLayout *uiPupMenuLayout(uiPopupMenu *head);
 
-void uiPupMenuOkee(struct bContext *C, const char *opname, const char *str, ...);
+void uiPupMenuOkee(struct bContext *C, const char *opname, const char *str, ...)
+#ifdef __GNUC__
+__attribute__ ((format (printf, 3, 4)))
+#endif
+;
 void uiPupMenuSaveOver(struct bContext *C, struct wmOperator *op, const char *filename);
-void uiPupMenuNotice(struct bContext *C, const char *str, ...);
-void uiPupMenuError(struct bContext *C, const char *str, ...);
+void uiPupMenuNotice(struct bContext *C, const char *str, ...)
+#ifdef __GNUC__
+__attribute__ ((format (printf, 2, 3)))
+#endif
+;
+void uiPupMenuError(struct bContext *C, const char *str, ...)
+#ifdef __GNUC__
+__attribute__ ((format (printf, 2, 3)))
+#endif
+;
 void uiPupMenuReports(struct bContext *C, struct ReportList *reports);
 void uiPupMenuInvoke(struct bContext *C, const char *idname); /* popup registered menu */
 
@@ -498,7 +510,7 @@ int uiButGetUnitType(uiBut *but);
 
 /* Special Buttons
  *
- * Butons with a more specific purpose:
+ * Buttons with a more specific purpose:
  * - IDPoinBut: for creating buttons that work on a pointer to an ID block.
  * - MenuBut: buttons that popup a menu (in headers usually).
  * - PulldownBut: like MenuBut, but creating a uiBlock (for compatibility).
@@ -612,7 +624,6 @@ void uiEndPanel(uiBlock *block, int width, int height);
  * as screen/ if ED_KEYMAP_UI is set, or internally in popup functions. */
 
 void UI_add_region_handlers(struct ListBase *handlers);
-void UI_add_area_handlers(struct ListBase *handlers);
 void UI_add_popup_handlers(struct bContext *C, struct ListBase *handlers, uiPopupBlockHandle *popup);
 void UI_remove_popup_handlers(struct ListBase *handlers, uiPopupBlockHandle *popup);
 
@@ -694,6 +705,7 @@ uiBlock *uiLayoutGetBlock(uiLayout *layout);
 
 void uiLayoutSetFunc(uiLayout *layout, uiMenuHandleFunc handlefunc, void *argv);
 void uiLayoutSetContextPointer(uiLayout *layout, const char *name, struct PointerRNA *ptr);
+void uiLayoutContextCopy(uiLayout *layout, struct bContextStore *context);
 const char *uiLayoutIntrospect(uiLayout *layout); // XXX - testing
 void uiLayoutOperatorButs(const struct bContext *C, struct uiLayout *layout, struct wmOperator *op, int (*check_prop)(struct PointerRNA *, struct PropertyRNA *), const char label_align, const short flag);
 struct MenuType *uiButGetMenuType(uiBut *but);
@@ -838,5 +850,5 @@ void UI_template_fix_linking(void);
 int  UI_editsource_enable_check(void);
 void UI_editsource_active_but_test(uiBut *but);
 
-#endif /*  UI_INTERFACE_H */
+#endif /*  __UI_INTERFACE_H__ */
 
diff --git a/source/blender/editors/include/UI_interface_icons.h b/source/blender/editors/include/UI_interface_icons.h
index e5ad511..2f4c254 100644
--- a/source/blender/editors/include/UI_interface_icons.h
+++ b/source/blender/editors/include/UI_interface_icons.h
@@ -29,8 +29,8 @@
  *  \ingroup editorui
  */
 
-#ifndef UI_INTERFACE_ICONS_H
-#define UI_INTERFACE_ICONS_H
+#ifndef __UI_INTERFACE_ICONS_H__
+#define __UI_INTERFACE_ICONS_H__
 
 struct Image;
 struct ImBuf;
@@ -54,8 +54,8 @@ typedef struct IconFile {
 #define PREVIEW_DEFAULT_HEIGHT 96
 
 /*
- Resizable Icons for Blender
-*/
+ * Resizable Icons for Blender
+ */
 void UI_icons_init(int first_dyn_id);
 int UI_icon_get_width(int icon_id);
 int UI_icon_get_height(int icon_id);
@@ -66,7 +66,7 @@ void UI_icon_draw_preview_aspect(float x, float y, int icon_id, float aspect);
 void UI_icon_draw_preview_aspect_size(float x, float y, int icon_id, float aspect, int size);
 
 void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alpha);
-void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, float *rgb);
+void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, const float rgb[3]);
 void UI_icon_draw_size(float x, float y, int size, int icon_id, float alpha);
 void UI_icons_free(void);
 void UI_icons_free_drawinfo(void *drawinfo);
@@ -75,4 +75,4 @@ struct ListBase *UI_iconfile_list(void);
 int UI_iconfile_get_index(const char *filename);
 
 
-#endif /*  UI_INTERFACE_ICONS_H */
+#endif /*  __UI_INTERFACE_ICONS_H__ */
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index d755b17..1531ade 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -30,8 +30,8 @@
  *  \ingroup editorui
  */
 
-#ifndef UI_RESOURCES_H
-#define UI_RESOURCES_H
+#ifndef __UI_RESOURCES_H__
+#define __UI_RESOURCES_H__
 
 /* elubie: TODO: move the typedef for icons to UI_interface_icons.h */
 /* and add/replace include of UI_resources.h by UI_interface_icons.h */
@@ -133,8 +133,9 @@ enum {
 	TH_STRIP_SELECT,
 	
 	TH_LAMP,
-
 	TH_SPEAKER,
+	TH_CAMERA,
+	TH_EMPTY,
 	
 	TH_NODE,
 	TH_NODE_IN_OUT,
@@ -149,6 +150,7 @@ enum {
 	TH_CONSOLE_CURSOR,
 	
 	TH_SEQ_MOVIE,
+	TH_SEQ_MOVIECLIP,
 	TH_SEQ_IMAGE,
 	TH_SEQ_SCENE,
 	TH_SEQ_AUDIO,
@@ -156,6 +158,7 @@ enum {
 	TH_SEQ_PLUGIN,
 	TH_SEQ_TRANSITION,
 	TH_SEQ_META,
+	TH_SEQ_PREVIEW,
 	
 	TH_EDGE_SHARP,
 	TH_EDITMESH_ACTIVE,
diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h
index 7ff27a5..436f268 100644
--- a/source/blender/editors/include/UI_view2d.h
+++ b/source/blender/editors/include/UI_view2d.h
@@ -31,8 +31,8 @@
  *  \ingroup editorui
  */
 
-#ifndef UI_VIEW2D_H
-#define UI_VIEW2D_H
+#ifndef __UI_VIEW2D_H__
+#define __UI_VIEW2D_H__
 
 /* ------------------------------------------ */
 /* Settings and Defines: 					*/
@@ -201,5 +201,5 @@ void UI_view2d_text_cache_draw(struct ARegion *ar);
 void UI_view2d_operatortypes(void);
 void UI_view2d_keymap(struct wmKeyConfig *keyconf);
 
-#endif /* UI_VIEW2D_H */
+#endif /* __UI_VIEW2D_H__ */
 
diff --git a/source/blender/editors/interface/SConscript b/source/blender/editors/interface/SConscript
index ec5ae99..2d6d5cd 100644
--- a/source/blender/editors/interface/SConscript
+++ b/source/blender/editors/interface/SConscript
@@ -8,7 +8,7 @@ for source in env.Glob('*_api.c'):
 
 incs = '../include ../../blenlib ../../blenfont ../../blenkernel ../../makesdna ../../imbuf'
 incs += ' ../../makesrna ../../windowmanager #/intern/guardedalloc ../../gpu'
-incs += ' #/extern/glew/include ../../blenloader'
+incs += ' #/extern/glew/include ../../blenloader ../../bmesh'
 incs += ' ../../python/' # python button eval
 
 defs = []
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 8bb9ceb..226d9a3 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -72,16 +72,16 @@
 
 #include "interface_intern.h"
 
-#define MENU_WIDTH 			120
-#define MENU_ITEM_HEIGHT	20
-#define MENU_SEP_HEIGHT		6
+#define MENU_WIDTH          120
+#define MENU_ITEM_HEIGHT    20
+#define MENU_SEP_HEIGHT     6
 
 #define PRECISION_FLOAT_MAX 6
 #define PRECISION_FLOAT_MAX_POW 1000000 /* pow(10, PRECISION_FLOAT_MAX)  */
 
 /* avoid unneeded calls to ui_get_but_val */
 #define UI_BUT_VALUE_UNSET DBL_MAX
-#define UI_GET_BUT_VALUE_INIT(_but, _value) if(_value == DBL_MAX) {  (_value)= ui_get_but_val(_but); }
+#define UI_GET_BUT_VALUE_INIT(_but, _value) if (_value == DBL_MAX) {  (_value) = ui_get_but_val(_but); }
 
 /* 
  * a full doc with API notes can be found in bf-blender/trunk/blender/doc/guides/interface_API.txt
@@ -99,75 +99,75 @@ void ui_block_to_window_fl(const ARegion *ar, uiBlock *block, float *x, float *y
 	float gx, gy;
 	int sx, sy, getsizex, getsizey;
 
-	getsizex= ar->winrct.xmax-ar->winrct.xmin+1;
-	getsizey= ar->winrct.ymax-ar->winrct.ymin+1;
-	sx= ar->winrct.xmin;
-	sy= ar->winrct.ymin;
+	getsizex = ar->winrct.xmax - ar->winrct.xmin + 1;
+	getsizey = ar->winrct.ymax - ar->winrct.ymin + 1;
+	sx = ar->winrct.xmin;
+	sy = ar->winrct.ymin;
 
-	gx= *x;
-	gy= *y;
+	gx = *x;
+	gy = *y;
 
-	if(block->panel) {
+	if (block->panel) {
 		gx += block->panel->ofsx;
 		gy += block->panel->ofsy;
 	}
 
-	*x= ((float)sx) + ((float)getsizex)*(0.5f+ 0.5f*(gx*block->winmat[0][0]+ gy*block->winmat[1][0]+ block->winmat[3][0]));
-	*y= ((float)sy) + ((float)getsizey)*(0.5f+ 0.5f*(gx*block->winmat[0][1]+ gy*block->winmat[1][1]+ block->winmat[3][1]));
+	*x = ((float)sx) + ((float)getsizex) * (0.5f + 0.5f * (gx * block->winmat[0][0] + gy * block->winmat[1][0] + block->winmat[3][0]));
+	*y = ((float)sy) + ((float)getsizey) * (0.5f + 0.5f * (gx * block->winmat[0][1] + gy * block->winmat[1][1] + block->winmat[3][1]));
 }
 
 void ui_block_to_window(const ARegion *ar, uiBlock *block, int *x, int *y)
 {
 	float fx, fy;
 
-	fx= *x;
-	fy= *y;
+	fx = *x;
+	fy = *y;
 
 	ui_block_to_window_fl(ar, block, &fx, &fy);
 
-	*x= (int)(fx+0.5f);
-	*y= (int)(fy+0.5f);
+	*x = (int)(fx + 0.5f);
+	*y = (int)(fy + 0.5f);
 }
 
 void ui_block_to_window_rct(const ARegion *ar, uiBlock *block, rctf *graph, rcti *winr)
 {
 	rctf tmpr;
 
-	tmpr= *graph;
+	tmpr = *graph;
 	ui_block_to_window_fl(ar, block, &tmpr.xmin, &tmpr.ymin);
 	ui_block_to_window_fl(ar, block, &tmpr.xmax, &tmpr.ymax);
 
-	winr->xmin= tmpr.xmin;
-	winr->ymin= tmpr.ymin;
-	winr->xmax= tmpr.xmax;
-	winr->ymax= tmpr.ymax;
+	winr->xmin = tmpr.xmin;
+	winr->ymin = tmpr.ymin;
+	winr->xmax = tmpr.xmax;
+	winr->ymax = tmpr.ymax;
 }
 
-void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y)	/* for mouse cursor */
+void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y)   /* for mouse cursor */
 {
 	float a, b, c, d, e, f, px, py;
 	int sx, sy, getsizex, getsizey;
 
-	getsizex= ar->winrct.xmax-ar->winrct.xmin+1;
-	getsizey= ar->winrct.ymax-ar->winrct.ymin+1;
-	sx= ar->winrct.xmin;
-	sy= ar->winrct.ymin;
+	getsizex = ar->winrct.xmax - ar->winrct.xmin + 1;
+	getsizey = ar->winrct.ymax - ar->winrct.ymin + 1;
+	sx = ar->winrct.xmin;
+	sy = ar->winrct.ymin;
 
-	a= 0.5f*((float)getsizex)*block->winmat[0][0];
-	b= 0.5f*((float)getsizex)*block->winmat[1][0];
-	c= 0.5f*((float)getsizex)*(1.0f+block->winmat[3][0]);
+	a = 0.5f * ((float)getsizex) * block->winmat[0][0];
+	b = 0.5f * ((float)getsizex) * block->winmat[1][0];
+	c = 0.5f * ((float)getsizex) * (1.0f + block->winmat[3][0]);
 
-	d= 0.5f*((float)getsizey)*block->winmat[0][1];
-	e= 0.5f*((float)getsizey)*block->winmat[1][1];
-	f= 0.5f*((float)getsizey)*(1.0f+block->winmat[3][1]);
+	d = 0.5f * ((float)getsizey) * block->winmat[0][1];
+	e = 0.5f * ((float)getsizey) * block->winmat[1][1];
+	f = 0.5f * ((float)getsizey) * (1.0f + block->winmat[3][1]);
 
-	px= *x - sx;
-	py= *y - sy;
+	px = *x - sx;
+	py = *y - sy;
 
-	*y=  (a*(py-f) + d*(c-px))/(a*e-d*b);
-	*x= (px- b*(*y)- c)/a;
+	*y =  (a * (py - f) + d * (c - px)) / (a * e - d * b);
+	*x = (px - b * (*y) - c) / a;
 
-	if(block->panel) {
+	if (block->panel) {
 		*x -= block->panel->ofsx;
 		*y -= block->panel->ofsy;
 	}
@@ -177,19 +177,19 @@ void ui_window_to_block(const ARegion *ar, uiBlock *block, int *x, int *y)
 {
 	float fx, fy;
 
-	fx= *x;
-	fy= *y;
+	fx = *x;
+	fy = *y;
 
 	ui_window_to_block_fl(ar, block, &fx, &fy);
 
-	*x= (int)(fx+0.5f);
-	*y= (int)(fy+0.5f);
+	*x = (int)(fx + 0.5f);
+	*y = (int)(fy + 0.5f);
 }
 
 void ui_window_to_region(const ARegion *ar, int *x, int *y)
 {
-	*x-= ar->winrct.xmin;
-	*y-= ar->winrct.ymin;
+	*x -= ar->winrct.xmin;
+	*y -= ar->winrct.ymin;
 }
 
 /* ******************* block calc ************************* */
@@ -198,7 +198,7 @@ void ui_block_translate(uiBlock *block, int x, int y)
 {
 	uiBut *bt;
 
-	for(bt= block->buttons.first; bt; bt=bt->next) {
+	for (bt = block->buttons.first; bt; bt = bt->next) {
 		bt->x1 += x;
 		bt->y1 += y;
 		bt->x2 += x;
@@ -213,45 +213,45 @@ void ui_block_translate(uiBlock *block, int x, int y)
 
 static void ui_text_bounds_block(uiBlock *block, float offset)
 {
-	uiStyle *style=UI_GetStyle();
+	uiStyle *style = UI_GetStyle();
 	uiBut *bt;
-	int i = 0, j, x1addval= offset, nextcol;
-	int lastcol= 0, col= 0;
+	int i = 0, j, x1addval = offset, nextcol;
+	int lastcol = 0, col = 0;
 	
 	uiStyleFontSet(&style->widget);
 	
-	for(bt= block->buttons.first; bt; bt= bt->next) {
-		if(bt->type!=SEPR) {
-			j= BLF_width(style->widget.uifont_id, bt->drawstr);
+	for (bt = block->buttons.first; bt; bt = bt->next) {
+		if (bt->type != SEPR) {
+			j = BLF_width(style->widget.uifont_id, bt->drawstr);
 
-			if(j > i) i = j;
+			if (j > i) i = j;
 		}
 
-		if(bt->next && bt->x1 < bt->next->x1)
+		if (bt->next && bt->x1 < bt->next->x1)
 			lastcol++;
 	}
 
 	/* cope with multi collumns */
-	bt= block->buttons.first;
-	while(bt) {
-		if(bt->next && bt->x1 < bt->next->x1) {
-			nextcol= 1;
+	bt = block->buttons.first;
+	while (bt) {
+		if (bt->next && bt->x1 < bt->next->x1) {
+			nextcol = 1;
 			col++;
 		}
-		else nextcol= 0;
+		else nextcol = 0;
 		
 		bt->x1 = x1addval;
 		bt->x2 = bt->x1 + i + block->bounds;
 		
-		if(col == lastcol)
-			bt->x2= MAX2(bt->x2, offset + block->minbounds);
+		if (col == lastcol)
+			bt->x2 = MAX2(bt->x2, offset + block->minbounds);
 
-		ui_check_but(bt);	// clips text again
+		ui_check_but(bt);   // clips text again
 		
-		if(nextcol)
-			x1addval+= i + block->bounds;
+		if (nextcol)
+			x1addval += i + block->bounds;
 		
-		bt= bt->next;
+		bt = bt->next;
 	}
 }
 
@@ -260,26 +260,26 @@ void ui_bounds_block(uiBlock *block)
 	uiBut *bt;
 	int xof;
 	
-	if(block->buttons.first==NULL) {
-		if(block->panel) {
-			block->minx= 0.0; block->maxx= block->panel->sizex;
-			block->miny= 0.0; block->maxy= block->panel->sizey;
+	if (block->buttons.first == NULL) {
+		if (block->panel) {
+			block->minx = 0.0; block->maxx = block->panel->sizex;
+			block->miny = 0.0; block->maxy = block->panel->sizey;
 		}
 	}
 	else {
 	
-		block->minx= block->miny= 10000;
-		block->maxx= block->maxy= -10000;
+		block->minx = block->miny = 10000;
+		block->maxx = block->maxy = -10000;
 		
-		bt= block->buttons.first;
-		while(bt) {
-			if(bt->x1 < block->minx) block->minx= bt->x1;
-			if(bt->y1 < block->miny) block->miny= bt->y1;
+		bt = block->buttons.first;
+		while (bt) {
+			if (bt->x1 < block->minx) block->minx = bt->x1;
+			if (bt->y1 < block->miny) block->miny = bt->y1;
 	
-			if(bt->x2 > block->maxx) block->maxx= bt->x2;
-			if(bt->y2 > block->maxy) block->maxy= bt->y2;
+			if (bt->x2 > block->maxx) block->maxx = bt->x2;
+			if (bt->y2 > block->maxy) block->maxy = bt->y2;
 
-			bt= bt->next;
+			bt = bt->next;
 		}
 		
 		block->minx -= block->bounds;
@@ -288,22 +288,22 @@ void ui_bounds_block(uiBlock *block)
 		block->maxy += block->bounds;
 	}
 
-	block->maxx= block->minx + MAX2(block->maxx - block->minx, block->minbounds);
+	block->maxx = block->minx + MAX2(block->maxx - block->minx, block->minbounds);
 
 	/* hardcoded exception... but that one is annoying with larger safety */ 
-	bt= block->buttons.first;
-	if(bt && strncmp(bt->str, "ERROR", 5)==0) xof= 10;
-	else xof= 40;
-	
-	block->safety.xmin= block->minx-xof;
-	block->safety.ymin= block->miny-xof;
-	block->safety.xmax= block->maxx+xof;
-	block->safety.ymax= block->maxy+xof;
+	bt = block->buttons.first;
+	if (bt && strncmp(bt->str, "ERROR", 5) == 0) xof = 10;
+	else xof = 40;
+
+	block->safety.xmin = block->minx - xof;
+	block->safety.ymin = block->miny - xof;
+	block->safety.xmax = block->maxx + xof;
+	block->safety.ymax = block->maxy + xof;
 }
 
 static void ui_centered_bounds_block(const bContext *C, uiBlock *block)
 {
-	wmWindow *window= CTX_wm_window(C);
+	wmWindow *window = CTX_wm_window(C);
 	int xmax, ymax;
 	int startx, starty;
 	int width, height;
@@ -316,8 +316,8 @@ static void ui_centered_bounds_block(const bContext *C, uiBlock *block)
 	
 	ui_bounds_block(block);
 	
-	width= block->maxx - block->minx;
-	height= block->maxy - block->miny;
+	width = block->maxx - block->minx;
+	height = block->maxy - block->miny;
 	
 	startx = (xmax * 0.5f) - (width * 0.5f);
 	starty = (ymax * 0.5f) - (height * 0.5f);
@@ -330,60 +330,60 @@ static void ui_centered_bounds_block(const bContext *C, uiBlock *block)
 }
 static void ui_popup_bounds_block(const bContext *C, uiBlock *block, int bounds_calc)
 {
-	wmWindow *window= CTX_wm_window(C);
+	wmWindow *window = CTX_wm_window(C);
 	int startx, starty, endx, endy, width, height, oldwidth, oldheight;
 	int oldbounds, xmax, ymax;
 
-	oldbounds= block->bounds;
+	oldbounds = block->bounds;
 
 	/* compute mouse position with user defined offset */
 	ui_bounds_block(block);
 	
 	wm_window_get_size(window, &xmax, &ymax);
 
-	oldwidth= block->maxx - block->minx;
-	oldheight= block->maxy - block->miny;
+	oldwidth = block->maxx - block->minx;
+	oldheight = block->maxy - block->miny;
 
 	/* first we ensure wide enough text bounds */
-	if(bounds_calc==UI_BLOCK_BOUNDS_POPUP_MENU) {
-		if(block->flag & UI_BLOCK_LOOP) {
-			block->bounds= 50;
+	if (bounds_calc == UI_BLOCK_BOUNDS_POPUP_MENU) {
+		if (block->flag & UI_BLOCK_LOOP) {
+			block->bounds = 50;
 			ui_text_bounds_block(block, block->minx);
 		}
 	}
 
 	/* next we recompute bounds */
-	block->bounds= oldbounds;
+	block->bounds = oldbounds;
 	ui_bounds_block(block);
 
 	/* and we adjust the position to fit within window */
-	width= block->maxx - block->minx;
-	height= block->maxy - block->miny;
+	width = block->maxx - block->minx;
+	height = block->maxy - block->miny;
 
 	/* avoid divide by zero below, caused by calling with no UI, but better not crash */
-	oldwidth= oldwidth > 0 ? oldwidth : MAX2(1, width);
-	oldheight= oldheight > 0 ? oldheight : MAX2(1, height);
+	oldwidth = oldwidth > 0 ? oldwidth : MAX2(1, width);
+	oldheight = oldheight > 0 ? oldheight : MAX2(1, height);
 
 	/* offset block based on mouse position, user offset is scaled
 	 * along in case we resized the block in ui_text_bounds_block */
-	startx= window->eventstate->x + block->minx + (block->mx*width)/oldwidth;
-	starty= window->eventstate->y + block->miny + (block->my*height)/oldheight;
+	startx = window->eventstate->x + block->minx + (block->mx * width) / oldwidth;
+	starty = window->eventstate->y + block->miny + (block->my * height) / oldheight;
 
-	if(startx<10)
-		startx= 10;
-	if(starty<10)
-		starty= 10;
-	
-	endx= startx+width;
-	endy= starty+height;
-	
-	if(endx>xmax) {
-		endx= xmax-10;
-		startx= endx-width;
+	if (startx < 10)
+		startx = 10;
+	if (starty < 10)
+		starty = 10;
+
+	endx = startx + width;
+	endy = starty + height;
+
+	if (endx > xmax) {
+		endx = xmax - 10;
+		startx = endx - width;
 	}
-	if(endy>ymax-20) {
-		endy= ymax-20;
-		starty= endy-height;
+	if (endy > ymax - 20) {
+		endy = ymax - 20;
+		starty = endy - height;
 	}
 
 	ui_block_translate(block, startx - block->minx, starty - block->miny);
@@ -395,43 +395,43 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, int bounds_
 /* used for various cases */
 void uiBoundsBlock(uiBlock *block, int addval)
 {
-	if(block==NULL)
+	if (block == NULL)
 		return;
 	
-	block->bounds= addval;
-	block->dobounds= UI_BLOCK_BOUNDS;
+	block->bounds = addval;
+	block->dobounds = UI_BLOCK_BOUNDS;
 }
 
 /* used for pulldowns */
 void uiTextBoundsBlock(uiBlock *block, int addval)
 {
-	block->bounds= addval;
-	block->dobounds= UI_BLOCK_BOUNDS_TEXT;
+	block->bounds = addval;
+	block->dobounds = UI_BLOCK_BOUNDS_TEXT;
 }
 
 /* used for block popups */
 void uiPopupBoundsBlock(uiBlock *block, int addval, int mx, int my)
 {
-	block->bounds= addval;
-	block->dobounds= UI_BLOCK_BOUNDS_POPUP_MOUSE;
-	block->mx= mx;
-	block->my= my;
+	block->bounds = addval;
+	block->dobounds = UI_BLOCK_BOUNDS_POPUP_MOUSE;
+	block->mx = mx;
+	block->my = my;
 }
 
 /* used for menu popups */
 void uiMenuPopupBoundsBlock(uiBlock *block, int addval, int mx, int my)
 {
-	block->bounds= addval;
-	block->dobounds= UI_BLOCK_BOUNDS_POPUP_MENU;
-	block->mx= mx;
-	block->my= my;
+	block->bounds = addval;
+	block->dobounds = UI_BLOCK_BOUNDS_POPUP_MENU;
+	block->mx = mx;
+	block->my = my;
 }
 
 /* used for centered popups, i.e. splash */
 void uiCenteredBoundsBlock(uiBlock *block, int addval)
 {
-	block->bounds= addval;
-	block->dobounds= UI_BLOCK_BOUNDS_POPUP_CENTER;
+	block->bounds = addval;
+	block->dobounds = UI_BLOCK_BOUNDS_POPUP_CENTER;
 }
 
 void uiExplicitBoundsBlock(uiBlock *block, int minx, int miny, int maxx, int maxy)
@@ -452,26 +452,26 @@ static int ui_but_float_precision(uiBut *but, double value)
 	int prec;
 
 	/* first check if prec is 0 and fallback to a simple default */
-	if((prec= (int)but->a2) == 0) {
-		prec= (but->hardmax < 10.001f) ? 3 : 2;
+	if ((prec = (int)but->a2) == 0) {
+		prec = (but->hardmax < 10.001f) ? 3 : 2;
 	}
 
-	/* check on the number of decimal places neede to display
+	/* check on the number of decimal places need to display
 	 * the number, this is so 0.00001 is not displayed as 0.00,
 	 * _but_, this is only for small values si 10.0001 will not get
 	 * the same treatment */
-	if(value != 0.0 && (value= ABS(value)) < 0.1) {
-		int value_i= (int)((value * PRECISION_FLOAT_MAX_POW) + 0.5);
-		if(value_i != 0) {
-			const int prec_span= 3; /* show: 0.01001, 5 would allow 0.0100001 for eg. */
+	if (value != 0.0 && (value = ABS(value)) < 0.1) {
+		int value_i = (int)((value * PRECISION_FLOAT_MAX_POW) + 0.5);
+		if (value_i != 0) {
+			const int prec_span = 3; /* show: 0.01001, 5 would allow 0.0100001 for eg. */
 			int test_prec;
-			int prec_min= -1;
-			int dec_flag= 0;
-			int i= PRECISION_FLOAT_MAX;
-			while(i && value_i) {
-				if(value_i % 10) {
-					dec_flag |= 1<<i;
-					prec_min= i;
+			int prec_min = -1;
+			int dec_flag = 0;
+			int i = PRECISION_FLOAT_MAX;
+			while (i && value_i) {
+				if (value_i % 10) {
+					dec_flag |= 1 << i;
+					prec_min = i;
 				}
 				value_i /= 10;
 				i--;
@@ -480,15 +480,15 @@ static int ui_but_float_precision(uiBut *but, double value)
 			/* even though its a small value, if the second last digit is not 0, use it */
 			test_prec = prec_min;
 
-			dec_flag= (dec_flag >> (prec_min + 1)) & ((1 << prec_span) - 1);
+			dec_flag = (dec_flag >> (prec_min + 1)) & ((1 << prec_span) - 1);
 
-			while(dec_flag) {
+			while (dec_flag) {
 				test_prec++;
 				dec_flag = dec_flag >> 1;
 			}
 
-			if(test_prec > prec) {
-				prec= test_prec;
+			if (test_prec > prec) {
+				prec = test_prec;
 			}
 		}
 	}
@@ -502,17 +502,17 @@ static void ui_draw_linkline(uiLinkLine *line)
 {
 	rcti rect;
 
-	if(line->from==NULL || line->to==NULL) return;
+	if (line->from == NULL || line->to == NULL) return;
 	
-	rect.xmin= (line->from->x1+line->from->x2)/2.0f;
-	rect.ymin= (line->from->y1+line->from->y2)/2.0f;
-	rect.xmax= (line->to->x1+line->to->x2)/2.0f;
-	rect.ymax= (line->to->y1+line->to->y2)/2.0f;
+	rect.xmin = (line->from->x1 + line->from->x2) / 2.0f;
+	rect.ymin = (line->from->y1 + line->from->y2) / 2.0f;
+	rect.xmax = (line->to->x1 + line->to->x2) / 2.0f;
+	rect.ymax = (line->to->y1 + line->to->y2) / 2.0f;
 	
-	if(line->flag & UI_SELECT) 
-		glColor3ub(100,100,100);
+	if (line->flag & UI_SELECT) 
+		glColor3ub(100, 100, 100);
 	else 
-		glColor3ub(0,0,0);
+		glColor3ub(0, 0, 0);
 
 	ui_draw_link_bezier(&rect);
 }
@@ -522,16 +522,16 @@ static void ui_draw_links(uiBlock *block)
 	uiBut *but;
 	uiLinkLine *line;
 	
-	but= block->buttons.first;
-	while(but) {
-		if(but->type==LINK && but->link) {
-			line= but->link->lines.first;
-			while(line) {
+	but = block->buttons.first;
+	while (but) {
+		if (but->type == LINK && but->link) {
+			line = but->link->lines.first;
+			while (line) {
 				ui_draw_linkline(line);
-				line= line->next;
+				line = line->next;
 			}
 		}
-		but= but->next;
+		but = but->next;
 	}	
 }
 
@@ -542,16 +542,16 @@ static int ui_but_equals_old(uiBut *but, uiBut *oldbut)
 {
 	/* various properties are being compared here, hopefully sufficient
 	 * to catch all cases, but it is simple to add more checks later */
-	if(but->retval != oldbut->retval) return 0;
-	if(but->rnapoin.data != oldbut->rnapoin.data) return 0;
-	if(but->rnaprop != oldbut->rnaprop)
-		if(but->rnaindex != oldbut->rnaindex) return 0;
-	if(but->func != oldbut->func) return 0;
-	if(but->funcN != oldbut->funcN) return 0;
-	if(oldbut->func_arg1 != oldbut && but->func_arg1 != oldbut->func_arg1) return 0;
-	if(oldbut->func_arg2 != oldbut && but->func_arg2 != oldbut->func_arg2) return 0;
-	if(!but->funcN && ((but->poin != oldbut->poin && (uiBut*)oldbut->poin != oldbut) || but->pointype != oldbut->pointype)) return 0;
-	if(but->optype != oldbut->optype) return 0;
+	if (but->retval != oldbut->retval) return 0;
+	if (but->rnapoin.data != oldbut->rnapoin.data) return 0;
+	if (but->rnaprop != oldbut->rnaprop)
+		if (but->rnaindex != oldbut->rnaindex) return 0;
+	if (but->func != oldbut->func) return 0;
+	if (but->funcN != oldbut->funcN) return 0;
+	if (oldbut->func_arg1 != oldbut && but->func_arg1 != oldbut->func_arg1) return 0;
+	if (oldbut->func_arg2 != oldbut && but->func_arg2 != oldbut->func_arg2) return 0;
+	if (!but->funcN && ((but->poin != oldbut->poin && (uiBut *)oldbut->poin != oldbut) || but->pointype != oldbut->pointype)) return 0;
+	if (but->optype != oldbut->optype) return 0;
 
 	return 1;
 }
@@ -563,26 +563,26 @@ static void ui_but_update_linklines(uiBlock *block, uiBut *oldbut, uiBut *newbut
 	uiBut *but;
 	
 	/* if active button is LINK */
-	if(newbut->type==LINK && newbut->link) {
+	if (newbut->type == LINK && newbut->link) {
 		
 		SWAP(uiLink *, oldbut->link, newbut->link);
 		
-		for(line= oldbut->link->lines.first; line; line= line->next) {
-			if(line->to==newbut)
-				line->to= oldbut;
-			if(line->from==newbut)
-				line->from= oldbut;
+		for (line = oldbut->link->lines.first; line; line = line->next) {
+			if (line->to == newbut)
+				line->to = oldbut;
+			if (line->from == newbut)
+				line->from = oldbut;
 		}
 	}		
 	
 	/* check all other button links */
-	for(but= block->buttons.first; but; but= but->next) {
-		if(but!=newbut && but->type==LINK && but->link) {
-			for(line= but->link->lines.first; line; line= line->next) {
-				if(line->to==newbut)
-					line->to= oldbut;
-				if(line->from==newbut)
-					line->from= oldbut;
+	for (but = block->buttons.first; but; but = but->next) {
+		if (but != newbut && but->type == LINK && but->link) {
+			for (line = but->link->lines.first; line; line = line->next) {
+				if (line->to == newbut)
+					line->to = oldbut;
+				if (line->from == newbut)
+					line->from = oldbut;
 			}
 		}
 	}
@@ -591,16 +591,16 @@ static void ui_but_update_linklines(uiBlock *block, uiBut *oldbut, uiBut *newbut
 static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut **butpp)
 {
 	uiBlock *oldblock;
-	uiBut *oldbut, *but= *butpp;
-	int found= 0;
+	uiBut *oldbut, *but = *butpp;
+	int found = 0;
 
-	oldblock= block->oldblock;
-	if(!oldblock)
+	oldblock = block->oldblock;
+	if (!oldblock)
 		return found;
 
-	for(oldbut=oldblock->buttons.first; oldbut; oldbut=oldbut->next) {
-		if(ui_but_equals_old(oldbut, but)) {
-			if(oldbut->active) {
+	for (oldbut = oldblock->buttons.first; oldbut; oldbut = oldbut->next) {
+		if (ui_but_equals_old(oldbut, but)) {
+			if (oldbut->active) {
 #if 0
 //				but->flag= oldbut->flag;
 #else
@@ -622,31 +622,31 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut
 //				but->softmax= oldbut->softmax;
 //				but->linkto[0]= oldbut->linkto[0];
 //				but->linkto[1]= oldbut->linkto[1];
-				found= 1;
+				found = 1;
 //				oldbut->active= NULL;
 			
 				/* move button over from oldblock to new block */
 				BLI_remlink(&oldblock->buttons, oldbut);
 				BLI_insertlink(&block->buttons, but, oldbut);
-				oldbut->block= block;
-				*butpp= oldbut;
+				oldbut->block = block;
+				*butpp = oldbut;
 				
 				/* still stuff needs to be copied */
-				oldbut->x1= but->x1; oldbut->y1= but->y1;
-				oldbut->x2= but->x2; oldbut->y2= but->y2;
-				oldbut->context= but->context; /* set by Layout */
+				oldbut->x1 = but->x1; oldbut->y1 = but->y1;
+				oldbut->x2 = but->x2; oldbut->y2 = but->y2;
+				oldbut->context = but->context; /* set by Layout */
 				
 				/* typically the same pointers, but not on undo/redo */
 				/* XXX some menu buttons store button itself in but->poin. Ugly */
-				if(oldbut->poin != (char *)oldbut) {
+				if (oldbut->poin != (char *)oldbut) {
 					SWAP(char *, oldbut->poin, but->poin)
 					SWAP(void *, oldbut->func_argN, but->func_argN)
 				}
 				
 				/* copy hardmin for list rows to prevent 'sticking' highlight to mouse position
 				 * when scrolling without moving mouse (see [#28432]) */
-				if(ELEM(oldbut->type, ROW, LISTROW))
-					oldbut->hardmax= but->hardmax;
+				if (ELEM(oldbut->type, ROW, LISTROW))
+					oldbut->hardmax = but->hardmax;
 				
 				ui_but_update_linklines(block, oldbut, but);
 				
@@ -669,34 +669,34 @@ static int ui_but_update_from_old_block(const bContext *C, uiBlock *block, uiBut
 	return found;
 }
 
-/* needed for temporarily rename buttons, such as in outliner or fileselect,
+/* needed for temporarily rename buttons, such as in outliner or file-select,
  * they should keep calling uiDefButs to keep them alive */
 /* returns 0 when button removed */
 int uiButActiveOnly(const bContext *C, uiBlock *block, uiBut *but)
 {
 	uiBlock *oldblock;
 	uiBut *oldbut;
-	int activate= 0, found= 0, isactive= 0;
+	int activate = 0, found = 0, isactive = 0;
 	
-	oldblock= block->oldblock;
-	if(!oldblock)
-		activate= 1;
+	oldblock = block->oldblock;
+	if (!oldblock)
+		activate = 1;
 	else {
-		for(oldbut=oldblock->buttons.first; oldbut; oldbut=oldbut->next) {
-			if(ui_but_equals_old(oldbut, but)) {
-				found= 1;
+		for (oldbut = oldblock->buttons.first; oldbut; oldbut = oldbut->next) {
+			if (ui_but_equals_old(oldbut, but)) {
+				found = 1;
 				
-				if(oldbut->active)
-					isactive= 1;
+				if (oldbut->active)
+					isactive = 1;
 				
 				break;
 			}
 		}
 	}
-	if(activate || found==0) {
+	if (activate || found == 0) {
 		ui_button_activate_do( (bContext *)C, CTX_wm_region(C), but);
 	}
-	else if(found && isactive==0) {
+	else if (found && isactive == 0) {
 		
 		BLI_remlink(&block->buttons, but);
 		ui_free_but(C, but);
@@ -706,17 +706,17 @@ int uiButActiveOnly(const bContext *C, uiBlock *block, uiBut *but)
 	return 1;
 }
 
-/* use to check if we need to disable undo, but dont make any changes
+/* use to check if we need to disable undo, but don't make any changes
  * returns FALSE if undo needs to be disabled. */
 static int ui_but_is_rna_undo(uiBut *but)
 {
-	if(but->rnapoin.id.data) {
+	if (but->rnapoin.id.data) {
 		/* avoid undo push for buttons who's ID are screen or wm level
 		 * we could disable undo for buttons with no ID too but may have
 		 * unforeseen consequences, so best check for ID's we _know_ are not
 		 * handled by undo - campbell */
-		ID *id= but->rnapoin.id.data;
-		if(ID_CHECK_UNDO(id) == FALSE) {
+		ID *id = but->rnapoin.id.data;
+		if (ID_CHECK_UNDO(id) == FALSE) {
 			return FALSE;
 		}
 		else {
@@ -736,39 +736,39 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
 {
 	uiBut *but;
 
-	unsigned int menu_key_mask= 0;
+	unsigned int menu_key_mask = 0;
 	unsigned char menu_key;
 	const char *str_pt;
 	int pass;
-	int tot_missing= 0;
+	int tot_missing = 0;
 
 	/* only do it before bounding */
-	if(block->minx != block->maxx)
+	if (block->minx != block->maxx)
 		return;
 
-	for(pass=0; pass<2; pass++) {
+	for (pass = 0; pass < 2; pass++) {
 		/* 2 Passes, on for first letter only, second for any letter if first fails
 		 * fun first pass on all buttons so first word chars always get first priority */
 
-		for(but=block->buttons.first; but; but=but->next) {
-			if(!ELEM4(but->type, BUT, MENU, BLOCK, PULLDOWN) || (but->flag & UI_HIDDEN)) {
+		for (but = block->buttons.first; but; but = but->next) {
+			if (!ELEM4(but->type, BUT, MENU, BLOCK, PULLDOWN) || (but->flag & UI_HIDDEN)) {
 				/* pass */
 			}
-			else if(but->menu_key=='\0') {
-				if(but->str) {
-					for(str_pt= but->str; *str_pt; ) {
-						menu_key= tolower(*str_pt);
-						if((menu_key >= 'a' && menu_key <= 'z') && !(menu_key_mask & 1<<(menu_key-'a'))) {
-							menu_key_mask |= 1<<(menu_key-'a');
+			else if (but->menu_key == '\0') {
+				if (but->str) {
+					for (str_pt = but->str; *str_pt; ) {
+						menu_key = tolower(*str_pt);
+						if ((menu_key >= 'a' && menu_key <= 'z') && !(menu_key_mask & 1 << (menu_key - 'a'))) {
+							menu_key_mask |= 1 << (menu_key - 'a');
 							break;
 						}
 
-						if(pass==0) {
-							/* Skip to next delimeter on first pass (be picky) */
-							while(isalpha(*str_pt))
+						if (pass == 0) {
+							/* Skip to next delimiter on first pass (be picky) */
+							while (isalpha(*str_pt))
 								str_pt++;
 
-							if(*str_pt)
+							if (*str_pt)
 								str_pt++;
 						}
 						else {
@@ -777,8 +777,8 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
 						}
 					}
 
-					if(*str_pt) {
-						but->menu_key= menu_key;
+					if (*str_pt) {
+						but->menu_key = menu_key;
 					}
 					else {
 						/* run second pass */
@@ -786,7 +786,7 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
 					}
 
 					/* if all keys have been used just exit, unlikely */
-					if(menu_key_mask == (1<<26)-1) {
+					if (menu_key_mask == (1 << 26) - 1) {
 						return;
 					}
 				}
@@ -794,7 +794,7 @@ static void ui_menu_block_set_keyaccels(uiBlock *block)
 		}
 
 		/* check if second pass is needed */
-		if(!tot_missing) {
+		if (!tot_missing) {
 			break;
 		}
 	}
@@ -807,9 +807,9 @@ void ui_but_add_shortcut(uiBut *but, const char *shortcut_str, const short do_st
 {
 
 	if (do_strip) {
-		char *cpoin= strchr(but->str, '|');
-		if(cpoin) {
-			*cpoin= '\0';
+		char *cpoin = strchr(but->str, '|');
+		if (cpoin) {
+			*cpoin = '\0';
 		}
 	}
 
@@ -840,36 +840,36 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
 
 	/* for menu's */
 	MenuType *mt;
-	IDProperty *prop_menu= NULL;
-	IDProperty *prop_menu_name= NULL;
+	IDProperty *prop_menu = NULL;
+	IDProperty *prop_menu_name = NULL;
 
 	/* only do it before bounding */
-	if(block->minx != block->maxx)
+	if (block->minx != block->maxx)
 		return;
 
-	for(but=block->buttons.first; but; but=but->next) {
-		if(but->optype) {
-			IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
+	for (but = block->buttons.first; but; but = but->next) {
+		if (but->optype) {
+			IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
 
-			if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE,
-			                                buf, sizeof(buf)))
+			if (WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE,
+			                                 buf, sizeof(buf)))
 			{
 				ui_but_add_shortcut(but, buf, FALSE);
 			}
 		}
-		else if ((mt= uiButGetMenuType(but))) {
+		else if ((mt = uiButGetMenuType(but))) {
 			/* only allocate menu property once */
 			if (prop_menu == NULL) {
 				/* annoying, create a property */
 				IDPropertyTemplate val = {0};
-				prop_menu= IDP_New(IDP_GROUP, &val, __func__); /* dummy, name is unimportant  */
-				IDP_AddToGroup(prop_menu, (prop_menu_name= IDP_NewString("", "name", sizeof(mt->idname))));
+				prop_menu = IDP_New(IDP_GROUP, &val, __func__); /* dummy, name is unimportant  */
+				IDP_AddToGroup(prop_menu, (prop_menu_name = IDP_NewString("", "name", sizeof(mt->idname))));
 			}
 
 			IDP_AssignString(prop_menu_name, mt->idname, sizeof(mt->idname));
 
-			if(WM_key_event_operator_string(C, "WM_OT_call_menu", WM_OP_INVOKE_REGION_WIN, prop_menu, FALSE,
-			                                buf, sizeof(buf)))
+			if (WM_key_event_operator_string(C, "WM_OT_call_menu", WM_OP_INVOKE_REGION_WIN, prop_menu, FALSE,
+			                                 buf, sizeof(buf)))
 			{
 				ui_but_add_shortcut(but, buf, FALSE);
 			}
@@ -888,78 +888,78 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
 void uiEndBlock(const bContext *C, uiBlock *block)
 {
 	uiBut *but;
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 
 	/* inherit flags from 'old' buttons that was drawn here previous, based
 	 * on matching buttons, we need this to make button event handling non
 	 * blocking, while still allowing buttons to be remade each redraw as it
 	 * is expected by blender code */
-	for(but=block->buttons.first; but; but=but->next) {
-		if(ui_but_update_from_old_block(C, block, &but))
+	for (but = block->buttons.first; but; but = but->next) {
+		if (ui_but_update_from_old_block(C, block, &but))
 			ui_check_but(but);
 		
 		/* temp? Proper check for greying out */
-		if(but->optype) {
-			wmOperatorType *ot= but->optype;
+		if (but->optype) {
+			wmOperatorType *ot = but->optype;
 
-			if(but->context)
-				CTX_store_set((bContext*)C, but->context);
+			if (but->context)
+				CTX_store_set((bContext *)C, but->context);
 
-			if(ot == NULL || WM_operator_poll_context((bContext*)C, ot, but->opcontext)==0) {
+			if (ot == NULL || WM_operator_poll_context((bContext *)C, ot, but->opcontext) == 0) {
 				but->flag |= UI_BUT_DISABLED;
 				but->lock = 1;
 			}
 
-			if(but->context)
-				CTX_store_set((bContext*)C, NULL);
+			if (but->context)
+				CTX_store_set((bContext *)C, NULL);
 		}
 
-		ui_but_anim_flag(but, (scene)? scene->r.cfra: 0.0f);
+		ui_but_anim_flag(but, (scene) ? scene->r.cfra : 0.0f);
 	}
 
-	if(block->oldblock) {
-		block->auto_open= block->oldblock->auto_open;
-		block->auto_open_last= block->oldblock->auto_open_last;
-		block->tooltipdisabled= block->oldblock->tooltipdisabled;
+	if (block->oldblock) {
+		block->auto_open = block->oldblock->auto_open;
+		block->auto_open_last = block->oldblock->auto_open_last;
+		block->tooltipdisabled = block->oldblock->tooltipdisabled;
 
-		block->oldblock= NULL;
+		block->oldblock = NULL;
 	}
 
 	/* handle pending stuff */
-	if(block->layouts.first) uiBlockLayoutResolve(block, NULL, NULL);
+	if (block->layouts.first) uiBlockLayoutResolve(block, NULL, NULL);
 	ui_block_do_align(block);
-	if((block->flag & UI_BLOCK_LOOP) && (block->flag & UI_BLOCK_NUMSELECT)) {
+	if ((block->flag & UI_BLOCK_LOOP) && (block->flag & UI_BLOCK_NUMSELECT)) {
 		ui_menu_block_set_keyaccels(block); /* could use a different flag to check */
 	}
-	if(block->flag & UI_BLOCK_LOOP) ui_menu_block_set_keymaps(C, block);
+	if (block->flag & UI_BLOCK_LOOP) ui_menu_block_set_keymaps(C, block);
 	
 	/* after keymaps! */
-	if(block->dobounds == UI_BLOCK_BOUNDS) ui_bounds_block(block);
-	else if(block->dobounds == UI_BLOCK_BOUNDS_TEXT) ui_text_bounds_block(block, 0.0f);
-	else if(block->dobounds == UI_BLOCK_BOUNDS_POPUP_CENTER) ui_centered_bounds_block(C, block);
-	else if(block->dobounds) ui_popup_bounds_block(C, block, block->dobounds);
+	if (block->dobounds == UI_BLOCK_BOUNDS) ui_bounds_block(block);
+	else if (block->dobounds == UI_BLOCK_BOUNDS_TEXT) ui_text_bounds_block(block, 0.0f);
+	else if (block->dobounds == UI_BLOCK_BOUNDS_POPUP_CENTER) ui_centered_bounds_block(C, block);
+	else if (block->dobounds) ui_popup_bounds_block(C, block, block->dobounds);
 
-	if(block->minx==0.0f && block->maxx==0.0f) uiBoundsBlock(block, 0);
-	if(block->flag & UI_BUT_ALIGN) uiBlockEndAlign(block);
+	if (block->minx == 0.0f && block->maxx == 0.0f) uiBoundsBlock(block, 0);
+	if (block->flag & UI_BUT_ALIGN) uiBlockEndAlign(block);
 
-	block->endblock= 1;
+	block->endblock = 1;
 }
 
 /* ************** BLOCK DRAWING FUNCTION ************* */
 
 void ui_fontscale(short *points, float aspect)
 {
-	if(aspect < 0.9f || aspect > 1.1f) {
-		float pointsf= *points;
+	if (aspect < 0.9f || aspect > 1.1f) {
+		float pointsf = *points;
 		
 		/* for some reason scaling fonts goes too fast compared to widget size */
-		aspect= sqrt(aspect);
+		aspect = sqrt(aspect);
 		pointsf /= aspect;
 		
-		if(aspect > 1.0f)
-			*points= ceilf(pointsf);
+		if (aspect > 1.0f)
+			*points = ceilf(pointsf);
 		else
-			*points= floorf(pointsf);
+			*points = floorf(pointsf);
 	}
 }
 
@@ -969,43 +969,43 @@ static void ui_but_to_pixelrect(rcti *rect, const ARegion *ar, uiBlock *block, u
 	float gx, gy;
 	float getsizex, getsizey;
 	
-	getsizex= ar->winx;
-	getsizey= ar->winy;
+	getsizex = ar->winx;
+	getsizey = ar->winy;
 
-	gx= (but?but->x1:block->minx) + (block->panel?block->panel->ofsx:0.0f);
-	gy= (but?but->y1:block->miny) + (block->panel?block->panel->ofsy:0.0f);
+	gx = (but ? but->x1 : block->minx) + (block->panel ? block->panel->ofsx : 0.0f);
+	gy = (but ? but->y1 : block->miny) + (block->panel ? block->panel->ofsy : 0.0f);
 	
-	rect->xmin= floorf(getsizex*(0.5f+ 0.5f*(gx*block->winmat[0][0]+ gy*block->winmat[1][0]+ block->winmat[3][0])));
-	rect->ymin= floorf(getsizey*(0.5f+ 0.5f*(gx*block->winmat[0][1]+ gy*block->winmat[1][1]+ block->winmat[3][1])));
+	rect->xmin = floorf(getsizex * (0.5f + 0.5f * (gx * block->winmat[0][0] + gy * block->winmat[1][0] + block->winmat[3][0])));
+	rect->ymin = floorf(getsizey * (0.5f + 0.5f * (gx * block->winmat[0][1] + gy * block->winmat[1][1] + block->winmat[3][1])));
 	
-	gx= (but?but->x2:block->maxx) + (block->panel?block->panel->ofsx:0.0f);
-	gy= (but?but->y2:block->maxy) + (block->panel?block->panel->ofsy:0.0f);
+	gx = (but ? but->x2 : block->maxx) + (block->panel ? block->panel->ofsx : 0.0f);
+	gy = (but ? but->y2 : block->maxy) + (block->panel ? block->panel->ofsy : 0.0f);
 	
-	rect->xmax= floorf(getsizex*(0.5f+ 0.5f*(gx*block->winmat[0][0]+ gy*block->winmat[1][0]+ block->winmat[3][0])));
-	rect->ymax= floorf(getsizey*(0.5f+ 0.5f*(gx*block->winmat[0][1]+ gy*block->winmat[1][1]+ block->winmat[3][1])));
+	rect->xmax = floorf(getsizex * (0.5f + 0.5f * (gx * block->winmat[0][0] + gy * block->winmat[1][0] + block->winmat[3][0])));
+	rect->ymax = floorf(getsizey * (0.5f + 0.5f * (gx * block->winmat[0][1] + gy * block->winmat[1][1] + block->winmat[3][1])));
 
 }
 
 /* uses local copy of style, to scale things down, and allow widgets to change stuff */
 void uiDrawBlock(const bContext *C, uiBlock *block)
 {
-	uiStyle style= *UI_GetStyle();	// XXX pass on as arg
+	uiStyle style = *UI_GetStyle();  // XXX pass on as arg
 	ARegion *ar;
 	uiBut *but;
 	rcti rect;
 	int multisample_enabled;
 	
 	/* get menu region or area region */
-	ar= CTX_wm_menu(C);
-	if(!ar)
-		ar= CTX_wm_region(C);
+	ar = CTX_wm_menu(C);
+	if (!ar)
+		ar = CTX_wm_region(C);
 
-	if(!block->endblock)
+	if (!block->endblock)
 		uiEndBlock(C, block);
 
 	/* disable AA, makes widgets too blurry */
-	multisample_enabled= glIsEnabled(GL_MULTISAMPLE_ARB);
-	if(multisample_enabled)
+	multisample_enabled = glIsEnabled(GL_MULTISAMPLE_ARB);
+	if (multisample_enabled)
 		glDisable(GL_MULTISAMPLE_ARB);
 
 	/* we set this only once */
@@ -1027,22 +1027,22 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
 	glPushMatrix();
 	glLoadIdentity();
 	
-	wmOrtho2(-0.01f, ar->winx-0.01f, -0.01f, ar->winy-0.01f);
+	wmOrtho2(-0.01f, ar->winx - 0.01f, -0.01f, ar->winy - 0.01f);
 	
 	/* back */
-	if(block->flag & UI_BLOCK_LOOP)
+	if (block->flag & UI_BLOCK_LOOP)
 		ui_draw_menu_back(&style, block, &rect);
-	else if(block->panel)
+	else if (block->panel)
 		ui_draw_aligned_panel(&style, block, &rect);
 
 	/* widgets */
-	for(but= block->buttons.first; but; but= but->next) {
-		if(!(but->flag & (UI_HIDDEN|UI_SCROLLED))) {
+	for (but = block->buttons.first; but; but = but->next) {
+		if (!(but->flag & (UI_HIDDEN | UI_SCROLLED))) {
 			ui_but_to_pixelrect(&rect, ar, block, but);
 		
 			/* XXX: figure out why invalid coordinates happen when closing render window */
 			/* and material preview is redrawn in main window (temp fix for bug #23848) */
-			if(rect.xmin < rect.xmax && rect.ymin < rect.ymax)
+			if (rect.xmin < rect.xmax && rect.ymin < rect.ymax)
 				ui_draw_but(C, ar, &style, but, &rect);
 		}
 	}
@@ -1053,7 +1053,7 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
 	glMatrixMode(GL_MODELVIEW);
 	glPopMatrix();
 
-	if(multisample_enabled)
+	if (multisample_enabled)
 		glEnable(GL_MULTISAMPLE_ARB);
 	
 	ui_draw_links(block);
@@ -1063,64 +1063,64 @@ void uiDrawBlock(const bContext *C, uiBlock *block)
 
 static void ui_is_but_sel(uiBut *but, double *value)
 {
-	short is_push=0, is_true=1;
+	short is_push = 0, is_true = 1;
 
-	if(ELEM3(but->type, TOGN, ICONTOGN, OPTIONN)) is_true= 0;
+	if (ELEM3(but->type, TOGN, ICONTOGN, OPTIONN)) is_true = 0;
 
-	if( but->bit ) {
+	if (but->bit) {
 		int lvalue;
 		UI_GET_BUT_VALUE_INIT(but, *value)
-		lvalue= (int)*value;
-		if( BTST(lvalue, (but->bitnr)) ) is_push= is_true;
-		else is_push= !is_true;
+		lvalue = (int)*value;
+		if (BTST(lvalue, (but->bitnr)) ) is_push = is_true;
+		else is_push = !is_true;
 	}
 	else {
-		switch(but->type) {
-		case BUT:
-			is_push= 2;
-			break;
-		case HOTKEYEVT:
-		case KEYEVT:
-			is_push= 2;
-			break;
-		case TOGBUT:
-		case TOG:
-		case TOGR:
-		case TOG3:
-		case BUT_TOGDUAL:
-		case ICONTOG:
-		case OPTION:
-			UI_GET_BUT_VALUE_INIT(but, *value)
-			if(*value != (double)but->hardmin) is_push= 1;
-			break;
-		case ICONTOGN:
-		case TOGN:
-		case OPTIONN:
-			UI_GET_BUT_VALUE_INIT(but, *value)
-			if(*value==0.0) is_push= 1;
-			break;
-		case ROW:
-		case LISTROW:
-			UI_GET_BUT_VALUE_INIT(but, *value)
-			/* support for rna enum buts */
-			if(but->rnaprop && (RNA_property_flag(but->rnaprop) & PROP_ENUM_FLAG)) {
-				if((int)*value & (int)but->hardmax) is_push= 1;
-			}
-			else {
-				if(*value == (double)but->hardmax) is_push= 1;
-			}
-			break;
-		case COL:
-			is_push= 2;
-			break;
-		default:
-			is_push= 2;
-			break;
+		switch (but->type) {
+			case BUT:
+				is_push = 2;
+				break;
+			case HOTKEYEVT:
+			case KEYEVT:
+				is_push = 2;
+				break;
+			case TOGBUT:
+			case TOG:
+			case TOGR:
+			case TOG3:
+			case BUT_TOGDUAL:
+			case ICONTOG:
+			case OPTION:
+				UI_GET_BUT_VALUE_INIT(but, *value)
+				if (*value != (double)but->hardmin) is_push = 1;
+				break;
+			case ICONTOGN:
+			case TOGN:
+			case OPTIONN:
+				UI_GET_BUT_VALUE_INIT(but, *value)
+				if (*value == 0.0) is_push = 1;
+				break;
+			case ROW:
+			case LISTROW:
+				UI_GET_BUT_VALUE_INIT(but, *value)
+				/* support for rna enum buts */
+				if (but->rnaprop && (RNA_property_flag(but->rnaprop) & PROP_ENUM_FLAG)) {
+					if ((int)*value & (int)but->hardmax) is_push = 1;
+				}
+				else {
+					if (*value == (double)but->hardmax) is_push = 1;
+				}
+				break;
+			case COL:
+				is_push = 2;
+				break;
+			default:
+				is_push = 2;
+				break;
 		}
 	}
 	
-	if(is_push==2);
-	else if(is_push==1) but->flag |= UI_SELECT;
+	if (is_push == 2) ;
+	else if (is_push == 1) but->flag |= UI_SELECT;
 	else but->flag &= ~UI_SELECT;
 }
 
@@ -1128,12 +1128,12 @@ static uiBut *ui_find_inlink(uiBlock *block, void *poin)
 {
 	uiBut *but;
 	
-	but= block->buttons.first;
-	while(but) {
-		if(but->type==INLINK) {
-			if(but->poin == poin) return but;
+	but = block->buttons.first;
+	while (but) {
+		if (but->type == INLINK) {
+			if (but->poin == poin) return but;
 		}
-		but= but->next;
+		but = but->next;
 	}
 	return NULL;
 }
@@ -1142,10 +1142,10 @@ static void ui_add_link_line(ListBase *listb, uiBut *but, uiBut *bt)
 {
 	uiLinkLine *line;
 	
-	line= MEM_callocN(sizeof(uiLinkLine), "linkline");
+	line = MEM_callocN(sizeof(uiLinkLine), "linkline");
 	BLI_addtail(listb, line);
-	line->from= but;
-	line->to= bt;
+	line->from = but;
+	line->to = bt;
 }
 
 uiBut *uiFindInlink(uiBlock *block, void *poin)
@@ -1160,31 +1160,31 @@ void uiComposeLinks(uiBlock *block)
 	void ***ppoin;
 	int a;
 	
-	but= block->buttons.first;
-	while(but) {
-		if(but->type==LINK) {
-			link= but->link;
+	but = block->buttons.first;
+	while (but) {
+		if (but->type == LINK) {
+			link = but->link;
 			
 			/* for all pointers in the array */
-			if(link) {
-				if(link->ppoin) {
-					ppoin= link->ppoin;
-					for(a=0; a < *(link->totlink); a++) {
-						bt= ui_find_inlink(block, (*ppoin)[a] );
-						if(bt) {
+			if (link) {
+				if (link->ppoin) {
+					ppoin = link->ppoin;
+					for (a = 0; a < *(link->totlink); a++) {
+						bt = ui_find_inlink(block, (*ppoin)[a]);
+						if (bt) {
 							ui_add_link_line(&link->lines, but, bt);
 						}
 					}
 				}
-				else if(link->poin) {
-					bt= ui_find_inlink(block, *(link->poin) );
-					if(bt) {
+				else if (link->poin) {
+					bt = ui_find_inlink(block, *(link->poin) );
+					if (bt) {
 						ui_add_link_line(&link->lines, but, bt);
 					}
 				}
 			}
 		}
-		but= but->next;
+		but = but->next;
 	}
 }
 
@@ -1193,16 +1193,16 @@ void uiComposeLinks(uiBlock *block)
 
 void uiBlockSetButLock(uiBlock *block, int val, const char *lockstr)
 {
-	if(val) {
-		block->lock= val ? 1:0;
-		block->lockstr= lockstr;
+	if (val) {
+		block->lock = val ? 1 : 0;
+		block->lockstr = lockstr;
 	}
 }
 
 void uiBlockClearButLock(uiBlock *block)
 {
-	block->lock= 0;
-	block->lockstr= NULL;
+	block->lock = 0;
+	block->lockstr = NULL;
 }
 
 /* *************************************************************** */
@@ -1214,22 +1214,22 @@ void ui_delete_linkline(uiLinkLine *line, uiBut *but)
 	
 	BLI_remlink(&but->link->lines, line);
 
-	link= line->from->link;
+	link = line->from->link;
 
 	/* are there more pointers allowed? */
-	if(link->ppoin) {
+	if (link->ppoin) {
 		
-		if(*(link->totlink)==1) {
-			*(link->totlink)= 0;
+		if (*(link->totlink) == 1) {
+			*(link->totlink) = 0;
 			MEM_freeN(*(link->ppoin));
-			*(link->ppoin)= NULL;
+			*(link->ppoin) = NULL;
 		}
 		else {
-			b= 0;
-			for(a=0; a< (*(link->totlink)); a++) {
+			b = 0;
+			for (a = 0; a < (*(link->totlink)); a++) {
 				
-				if( (*(link->ppoin))[a] != line->to->poin ) {
-					(*(link->ppoin))[b]= (*(link->ppoin))[a];
+				if ( (*(link->ppoin))[a] != line->to->poin) {
+					(*(link->ppoin))[b] = (*(link->ppoin))[a];
 					b++;
 				}
 			}	
@@ -1237,7 +1237,7 @@ void ui_delete_linkline(uiLinkLine *line, uiBut *but)
 		}
 	}
 	else {
-		*(link->poin)= NULL;
+		*(link->poin) = NULL;
 	}
 
 	MEM_freeN(line);
@@ -1254,37 +1254,37 @@ void ui_get_but_vectorf(uiBut *but, float vec[3])
 	PropertyRNA *prop;
 	int a, tot;
 
-	if(but->editvec) {
+	if (but->editvec) {
 		copy_v3_v3(vec, but->editvec);
 	}
 
-	if(but->rnaprop) {
-		prop= but->rnaprop;
+	if (but->rnaprop) {
+		prop = but->rnaprop;
 
-		vec[0]= vec[1]= vec[2]= 0.0f;
+		vec[0] = vec[1] = vec[2] = 0.0f;
 
-		if(RNA_property_type(prop) == PROP_FLOAT) {
-			tot= RNA_property_array_length(&but->rnapoin, prop);
-			tot= MIN2(tot, 3);
+		if (RNA_property_type(prop) == PROP_FLOAT) {
+			tot = RNA_property_array_length(&but->rnapoin, prop);
+			tot = MIN2(tot, 3);
 
-			for(a=0; a<tot; a++)
-				vec[a]= RNA_property_float_get_index(&but->rnapoin, prop, a);
+			for (a = 0; a < tot; a++)
+				vec[a] = RNA_property_float_get_index(&but->rnapoin, prop, a);
 		}
 	}
-	else if(but->pointype == CHA) {
-		char *cp= (char *)but->poin;
-		vec[0]= ((float)cp[0])/255.0f;
-		vec[1]= ((float)cp[1])/255.0f;
-		vec[2]= ((float)cp[2])/255.0f;
+	else if (but->pointype == CHA) {
+		char *cp = (char *)but->poin;
+		vec[0] = ((float)cp[0]) / 255.0f;
+		vec[1] = ((float)cp[1]) / 255.0f;
+		vec[2] = ((float)cp[2]) / 255.0f;
 	}
-	else if(but->pointype == FLO) {
-		float *fp= (float *)but->poin;
+	else if (but->pointype == FLO) {
+		float *fp = (float *)but->poin;
 		copy_v3_v3(vec, fp);
 	}
 	else {
-		if (but->editvec==NULL) {
+		if (but->editvec == NULL) {
 			fprintf(stderr, "ui_get_but_vectorf: can't get color, should never happen\n");
-			vec[0]= vec[1]= vec[2]= 0.0f;
+			vec[0] = vec[1] = vec[2] = 0.0f;
 		}
 	}
 
@@ -1298,43 +1298,43 @@ void ui_set_but_vectorf(uiBut *but, const float vec[3])
 {
 	PropertyRNA *prop;
 
-	if(but->editvec) {
+	if (but->editvec) {
 		copy_v3_v3(but->editvec, vec);
 	}
 
-	if(but->rnaprop) {
-		prop= but->rnaprop;
+	if (but->rnaprop) {
+		prop = but->rnaprop;
 
-		if(RNA_property_type(prop) == PROP_FLOAT) {
+		if (RNA_property_type(prop) == PROP_FLOAT) {
 			int tot;
 			int a;
 
-			tot= RNA_property_array_length(&but->rnapoin, prop);
-			tot= MIN2(tot, 3);
+			tot = RNA_property_array_length(&but->rnapoin, prop);
+			tot = MIN2(tot, 3);
 
-			for (a=0; a<tot; a++) {
+			for (a = 0; a < tot; a++) {
 				RNA_property_float_set_index(&but->rnapoin, prop, a, vec[a]);
 			}
 		}
 	}
-	else if(but->pointype == CHA) {
-		char *cp= (char *)but->poin;
-		cp[0]= (char)(0.5f + vec[0]*255.0f);
-		cp[1]= (char)(0.5f + vec[1]*255.0f);
-		cp[2]= (char)(0.5f + vec[2]*255.0f);
+	else if (but->pointype == CHA) {
+		char *cp = (char *)but->poin;
+		cp[0] = (char)(0.5f + vec[0] * 255.0f);
+		cp[1] = (char)(0.5f + vec[1] * 255.0f);
+		cp[2] = (char)(0.5f + vec[2] * 255.0f);
 	}
-	else if(but->pointype == FLO) {
-		float *fp= (float *)but->poin;
+	else if (but->pointype == FLO) {
+		float *fp = (float *)but->poin;
 		copy_v3_v3(fp, vec);
 	}
 }
 
 int ui_is_but_float(uiBut *but)
 {
-	if(but->pointype==FLO && but->poin)
+	if (but->pointype == FLO && but->poin)
 		return 1;
 	
-	if(but->rnaprop && RNA_property_type(but->rnaprop) == PROP_FLOAT)
+	if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_FLOAT)
 		return 1;
 	
 	return 0;
@@ -1342,10 +1342,10 @@ int ui_is_but_float(uiBut *but)
 
 int ui_is_but_unit(uiBut *but)
 {
-	UnitSettings *unit= but->block->unit;
-	const int unit_type= uiButGetUnitType(but);
+	UnitSettings *unit = but->block->unit;
+	const int unit_type = uiButGetUnitType(but);
 
-	if(unit_type == PROP_UNIT_NONE)
+	if (unit_type == PROP_UNIT_NONE)
 		return 0;
 
 #if 1 // removed so angle buttons get correct snapping
@@ -1368,7 +1368,7 @@ int ui_is_but_unit(uiBut *but)
 
 int ui_is_but_rna_valid(uiBut *but)
 {
-	if (but->rnaprop==NULL || RNA_struct_contains_property(&but->rnapoin, but->rnaprop)) {
+	if (but->rnaprop == NULL || RNA_struct_contains_property(&but->rnapoin, but->rnaprop)) {
 		return TRUE;
 	}
 	else {
@@ -1382,62 +1382,62 @@ double ui_get_but_val(uiBut *but)
 	PropertyRNA *prop;
 	double value = 0.0;
 
-	if(but->editval) { return *(but->editval); }
-	if(but->poin==NULL && but->rnapoin.data==NULL) return 0.0;
+	if (but->editval) { return *(but->editval); }
+	if (but->poin == NULL && but->rnapoin.data == NULL) return 0.0;
 
-	if(but->rnaprop) {
-		prop= but->rnaprop;
+	if (but->rnaprop) {
+		prop = but->rnaprop;
 
-		switch(RNA_property_type(prop)) {
+		switch (RNA_property_type(prop)) {
 			case PROP_BOOLEAN:
-				if(RNA_property_array_check(prop))
-					value= RNA_property_boolean_get_index(&but->rnapoin, prop, but->rnaindex);
+				if (RNA_property_array_check(prop))
+					value = RNA_property_boolean_get_index(&but->rnapoin, prop, but->rnaindex);
 				else
-					value= RNA_property_boolean_get(&but->rnapoin, prop);
+					value = RNA_property_boolean_get(&but->rnapoin, prop);
 				break;
 			case PROP_INT:
-				if(RNA_property_array_check(prop))
-					value= RNA_property_int_get_index(&but->rnapoin, prop, but->rnaindex);
+				if (RNA_property_array_check(prop))
+					value = RNA_property_int_get_index(&but->rnapoin, prop, but->rnaindex);
 				else
-					value= RNA_property_int_get(&but->rnapoin, prop);
+					value = RNA_property_int_get(&but->rnapoin, prop);
 				break;
 			case PROP_FLOAT:
-				if(RNA_property_array_check(prop))
-					value= RNA_property_float_get_index(&but->rnapoin, prop, but->rnaindex);
+				if (RNA_property_array_check(prop))
+					value = RNA_property_float_get_index(&but->rnapoin, prop, but->rnaindex);
 				else
-					value= RNA_property_float_get(&but->rnapoin, prop);
+					value = RNA_property_float_get(&but->rnapoin, prop);
 				break;
 			case PROP_ENUM:
-				value= RNA_property_enum_get(&but->rnapoin, prop);
+				value = RNA_property_enum_get(&but->rnapoin, prop);
 				break;
 			default:
-				value= 0.0;
+				value = 0.0;
 				break;
 		}
 	}
-	else if(but->type== HSVSLI) {
+	else if (but->type == HSVSLI) {
 		float h, s, v, *fp;
 		
-		fp= (but->editvec)? but->editvec: (float *)but->poin;
+		fp = (but->editvec) ? but->editvec : (float *)but->poin;
 		rgb_to_hsv(fp[0], fp[1], fp[2], &h, &s, &v);
 
-		switch(but->str[0]) {
-			case 'H': value= h; break;
-			case 'S': value= s; break;
-			case 'V': value= v; break;
+		switch (but->str[0]) {
+			case 'H': value = h; break;
+			case 'S': value = s; break;
+			case 'V': value = v; break;
 		}
 	} 
-	else if( but->pointype == CHA ) {
-		value= *(char *)but->poin;
+	else if (but->pointype == CHA) {
+		value = *(char *)but->poin;
 	}
-	else if( but->pointype == SHO ) {
-		value= *(short *)but->poin;
+	else if (but->pointype == SHO) {
+		value = *(short *)but->poin;
 	} 
-	else if( but->pointype == INT ) {
-		value= *(int *)but->poin;
+	else if (but->pointype == INT) {
+		value = *(int *)but->poin;
 	} 
-	else if( but->pointype == FLO ) {
-		value= *(float *)but->poin;
+	else if (but->pointype == FLO) {
+		value = *(float *)but->poin;
 	}
 
 	return value;
@@ -1448,32 +1448,32 @@ void ui_set_but_val(uiBut *but, double value)
 	PropertyRNA *prop;
 
 	/* value is a hsv value: convert to rgb */
-	if(but->rnaprop) {
-		prop= but->rnaprop;
+	if (but->rnaprop) {
+		prop = but->rnaprop;
 
-		if(RNA_property_editable(&but->rnapoin, prop)) {
-			switch(RNA_property_type(prop)) {
+		if (RNA_property_editable(&but->rnapoin, prop)) {
+			switch (RNA_property_type(prop)) {
 				case PROP_BOOLEAN:
-					if(RNA_property_array_length(&but->rnapoin, prop))
+					if (RNA_property_array_length(&but->rnapoin, prop))
 						RNA_property_boolean_set_index(&but->rnapoin, prop, but->rnaindex, value);
 					else
 						RNA_property_boolean_set(&but->rnapoin, prop, value);
 					break;
 				case PROP_INT:
-					if(RNA_property_array_length(&but->rnapoin, prop))
+					if (RNA_property_array_length(&but->rnapoin, prop))
 						RNA_property_int_set_index(&but->rnapoin, prop, but->rnaindex, (int)value);
 					else
 						RNA_property_int_set(&but->rnapoin, prop, (int)value);
 					break;
 				case PROP_FLOAT:
-					if(RNA_property_array_length(&but->rnapoin, prop))
+					if (RNA_property_array_length(&but->rnapoin, prop))
 						RNA_property_float_set_index(&but->rnapoin, prop, but->rnaindex, value);
 					else
 						RNA_property_float_set(&but->rnapoin, prop, value);
 					break;
 				case PROP_ENUM:
-					if(RNA_property_flag(prop) & PROP_ENUM_FLAG) {
-						int ivalue= (int)value;
+					if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
+						int ivalue = (int)value;
 						ivalue ^= RNA_property_enum_get(&but->rnapoin, prop); /* toggle for enum/flag buttons */
 						RNA_property_enum_set(&but->rnapoin, prop, ivalue);
 					}
@@ -1488,56 +1488,56 @@ void ui_set_but_val(uiBut *but, double value)
 
 		/* we can't be sure what RNA set functions actually do,
 		 * so leave this unset */
-		value= UI_BUT_VALUE_UNSET;
+		value = UI_BUT_VALUE_UNSET;
 	}
-	else if(but->pointype==0);
-	else if(but->type==HSVSLI ) {
+	else if (but->pointype == 0) ;
+	else if (but->type == HSVSLI) {
 		float h, s, v, *fp;
 		
-		fp= (but->editvec)? but->editvec: (float *)but->poin;
+		fp = (but->editvec) ? but->editvec : (float *)but->poin;
 		rgb_to_hsv(fp[0], fp[1], fp[2], &h, &s, &v);
 		
-		switch(but->str[0]) {
-		case 'H': h= value; break;
-		case 'S': s= value; break;
-		case 'V': v= value; break;
+		switch (but->str[0]) {
+			case 'H': h = value; break;
+			case 'S': s = value; break;
+			case 'V': v = value; break;
 		}
 		
-		hsv_to_rgb(h, s, v, fp, fp+1, fp+2);
+		hsv_to_rgb(h, s, v, fp, fp + 1, fp + 2);
 		
 	}
 	else {
 		/* first do rounding */
-		if(but->pointype==CHA)
-			value= (char)floor(value+0.5);
-		else if(but->pointype==SHO ) {
+		if (but->pointype == CHA)
+			value = (char)floor(value + 0.5);
+		else if (but->pointype == SHO) {
 			/* gcc 3.2.1 seems to have problems 
 			 * casting a double like 32772.0 to
 			 * a short so we cast to an int, then 
-			 to a short */
+			 * to a short */
 			int gcckludge;
-			gcckludge = (int) floor(value+0.5);
-			value= (short)gcckludge;
+			gcckludge = (int) floor(value + 0.5);
+			value = (short)gcckludge;
 		}
-		else if(but->pointype==INT )
-			value= (int)floor(value+0.5);
-		else if(but->pointype==FLO ) {
-			float fval= (float)value;
-			if(fval>= -0.00001f && fval<= 0.00001f) fval= 0.0f;	/* prevent negative zero */
-			value= fval;
+		else if (but->pointype == INT)
+			value = (int)floor(value + 0.5);
+		else if (but->pointype == FLO) {
+			float fval = (float)value;
+			if (fval >= -0.00001f && fval <= 0.00001f) fval = 0.0f;  /* prevent negative zero */
+			value = fval;
 		}
 		
 		/* then set value with possible edit override */
-		if(but->editval)
-			value= *but->editval= value;
-		else if(but->pointype==CHA)
-			value= *((char *)but->poin)= (char)value;
-		else if(but->pointype==SHO)
-			value= *((short *)but->poin)= (short)value;
-		else if(but->pointype==INT)
-			value= *((int *)but->poin)= (int)value;
-		else if(but->pointype==FLO)
-			value= *((float *)but->poin)= (float)value;
+		if (but->editval)
+			value = *but->editval = value;
+		else if (but->pointype == CHA)
+			value = *((char *)but->poin) = (char)value;
+		else if (but->pointype == SHO)
+			value = *((short *)but->poin) = (short)value;
+		else if (but->pointype == INT)
+			value = *((int *)but->poin) = (int)value;
+		else if (but->pointype == FLO)
+			value = *((float *)but->poin) = (float)value;
 	}
 
 	/* update select flag */
@@ -1546,30 +1546,30 @@ void ui_set_but_val(uiBut *but, double value)
 
 int ui_get_but_string_max_length(uiBut *but)
 {
-	if(ELEM(but->type, TEX, SEARCH_MENU))
+	if (ELEM(but->type, TEX, SEARCH_MENU))
 		return but->hardmax;
-	else if(but->type == IDPOIN)
-		return MAX_ID_NAME-2;
+	else if (but->type == IDPOIN)
+		return MAX_ID_NAME - 2;
 	else
 		return UI_MAX_DRAW_STR;
 }
 
 static double ui_get_but_scale_unit(uiBut *but, double value)
 {
-	UnitSettings *unit= but->block->unit;
-	int unit_type= uiButGetUnitType(but);
+	UnitSettings *unit = but->block->unit;
+	int unit_type = uiButGetUnitType(but);
 
-	if(unit_type == PROP_UNIT_LENGTH) {
+	if (unit_type == PROP_UNIT_LENGTH) {
 		return value * (double)unit->scale_length;
 	}
-	else if(unit_type == PROP_UNIT_AREA) {
+	else if (unit_type == PROP_UNIT_AREA) {
 		return value * pow(unit->scale_length, 2);
 	}
-	else if(unit_type == PROP_UNIT_VOLUME) {
+	else if (unit_type == PROP_UNIT_VOLUME) {
 		return value * pow(unit->scale_length, 3);
 	}
-	else if(unit_type == PROP_UNIT_TIME) { /* WARNING - using evil_C :| */
-		Scene *scene= CTX_data_scene(but->block->evil_C);
+	else if (unit_type == PROP_UNIT_TIME) { /* WARNING - using evil_C :| */
+		Scene *scene = CTX_data_scene(but->block->evil_C);
 		return FRA2TIME(value);
 	}
 	else {
@@ -1580,15 +1580,15 @@ static double ui_get_but_scale_unit(uiBut *but, double value)
 /* str will be overwritten */
 void ui_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen)
 {
-	if(ui_is_but_unit(but)) {
-		UnitSettings *unit= but->block->unit;
-		int unit_type= uiButGetUnitType(but);
+	if (ui_is_but_unit(but)) {
+		UnitSettings *unit = but->block->unit;
+		int unit_type = uiButGetUnitType(but);
 		char *orig_str;
 		
-		orig_str= MEM_callocN(sizeof(char)*maxlen + 1, "textedit sub str");
+		orig_str = MEM_callocN(sizeof(char) * maxlen + 1, "textedit sub str");
 		memcpy(orig_str, str, maxlen);
 		
-		bUnit_ToUnitAltName(str, maxlen, orig_str, unit->system, unit_type>>16);
+		bUnit_ToUnitAltName(str, maxlen, orig_str, unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type));
 		
 		MEM_freeN(orig_str);
 	}
@@ -1596,29 +1596,30 @@ void ui_convert_to_unit_alt_name(uiBut *but, char *str, size_t maxlen)
 
 static void ui_get_but_string_unit(uiBut *but, char *str, int len_max, double value, int pad)
 {
-	UnitSettings *unit= but->block->unit;
-	int do_split= unit->flag & USER_UNIT_OPT_SPLIT;
-	int unit_type= uiButGetUnitType(but);
-	int precision= but->a2;
+	UnitSettings *unit = but->block->unit;
+	int do_split = unit->flag & USER_UNIT_OPT_SPLIT;
+	int unit_type = uiButGetUnitType(but);
+	int precision = but->a2;
 
-	if(unit->scale_length<0.0001f) unit->scale_length= 1.0f; // XXX do_versions
+	if (unit->scale_length < 0.0001f) unit->scale_length = 1.0f;  // XXX do_versions
 
 	/* Sanity checks */
-	if(precision > PRECISION_FLOAT_MAX)	precision= PRECISION_FLOAT_MAX;
-	else if(precision==0)				precision= 2;
+	if (precision > PRECISION_FLOAT_MAX) precision = PRECISION_FLOAT_MAX;
+	else if (precision == 0) precision = 2;
 
-	bUnit_AsString(str, len_max, ui_get_but_scale_unit(but, value), precision, unit->system, unit_type>>16, do_split, pad);
+	bUnit_AsString(str, len_max, ui_get_but_scale_unit(but, value), precision,
+	               unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type), do_split, pad);
 }
 
 static float ui_get_but_step_unit(uiBut *but, float step_default)
 {
-	int unit_type= uiButGetUnitType(but)>>16;
+	int unit_type = RNA_SUBTYPE_UNIT_VALUE(uiButGetUnitType(but));
 	float step;
 
 	step = bUnit_ClosestScalar(ui_get_but_scale_unit(but, step_default), but->block->unit->system, unit_type);
 
-	if(step > 0.0f) { /* -1 is an error value */
-		return (float)((double)step/ui_get_but_scale_unit(but, 1.0))*100.0f;
+	if (step > 0.0f) { /* -1 is an error value */
+		return (float)((double)step / ui_get_but_scale_unit(but, 1.0)) * 100.0f;
 	}
 	else {
 		return step_default;
@@ -1628,68 +1629,68 @@ static float ui_get_but_step_unit(uiBut *but, float step_default)
 
 void ui_get_but_string(uiBut *but, char *str, size_t maxlen)
 {
-	if(but->rnaprop && ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
+	if (but->rnaprop && ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
 		PropertyType type;
-		char *buf= NULL;
+		char *buf = NULL;
 		int buf_len;
 
-		type= RNA_property_type(but->rnaprop);
+		type = RNA_property_type(but->rnaprop);
 
-		if(type == PROP_STRING) {
+		if (type == PROP_STRING) {
 			/* RNA string */
-			buf= RNA_property_string_get_alloc(&but->rnapoin, but->rnaprop, str, maxlen, &buf_len);
+			buf = RNA_property_string_get_alloc(&but->rnapoin, but->rnaprop, str, maxlen, &buf_len);
 		}
-		else if(type == PROP_POINTER) {
+		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);
+			PointerRNA ptr = RNA_property_pointer_get(&but->rnapoin, but->rnaprop);
+			buf = RNA_struct_name_get_alloc(&ptr, str, maxlen, &buf_len);
 		}
 
-		if(!buf) {
+		if (!buf) {
 			str[0] = '\0';
 		}
-		else if(buf && buf != str) {
+		else if (buf && buf != str) {
 			/* string was too long, we have to truncate */
-			memcpy(str, buf, MIN2(maxlen, buf_len+1));
+			memcpy(str, buf, MIN2(maxlen, buf_len + 1));
 			MEM_freeN(buf);
 		}
 	}
-	else if(but->type == IDPOIN) {
+	else if (but->type == IDPOIN) {
 		/* ID pointer */
-		if(but->idpoin_idpp) { /* Can be NULL for ID properties by python */
-			ID *id= *(but->idpoin_idpp);
-			if(id) {
-				BLI_strncpy(str, id->name+2, maxlen);
+		if (but->idpoin_idpp) { /* Can be NULL for ID properties by python */
+			ID *id = *(but->idpoin_idpp);
+			if (id) {
+				BLI_strncpy(str, id->name + 2, maxlen);
 				return;
 			}
 		}
 		str[0] = '\0';
 		return;
 	}
-	else if(but->type == TEX) {
+	else if (but->type == TEX) {
 		/* string */
 		BLI_strncpy(str, but->poin, maxlen);
 		return;
 	}
-	else if(but->type == SEARCH_MENU) {
+	else if (but->type == SEARCH_MENU) {
 		/* string */
 		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;
 
-		value= ui_get_but_val(but);
+		value = ui_get_but_val(but);
 
-		if(ui_is_but_float(but)) {
-			if(ui_is_but_unit(but)) {
+		if (ui_is_but_float(but)) {
+			if (ui_is_but_unit(but)) {
 				ui_get_but_string_unit(but, str, maxlen, value, 0);
 			}
 			else {
-				const int prec= ui_but_float_precision(but, value);
+				const int prec = ui_but_float_precision(but, value);
 				BLI_snprintf(str, maxlen, "%.*f", prec, value);
 			}
 		}
@@ -1703,12 +1704,14 @@ void ui_get_but_string(uiBut *but, char *str, size_t maxlen)
 static int ui_set_but_string_eval_num_unit(bContext *C, uiBut *but, const char *str, double *value)
 {
 	char str_unit_convert[256];
-	const int unit_type= uiButGetUnitType(but);
+	const int unit_type = uiButGetUnitType(but);
 
 	BLI_strncpy(str_unit_convert, str, sizeof(str_unit_convert));
 
-	/* ugly, use the draw string to get the value, this could cause problems if it includes some text which resolves to a unit */
-	bUnit_ReplaceString(str_unit_convert, sizeof(str_unit_convert), but->drawstr, ui_get_but_scale_unit(but, 1.0), but->block->unit->system, unit_type>>16);
+	/* ugly, use the draw string to get the value,
+	 * this could cause problems if it includes some text which resolves to a unit */
+	bUnit_ReplaceString(str_unit_convert, sizeof(str_unit_convert), but->drawstr,
+	                    ui_get_but_scale_unit(but, 1.0), but->block->unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type));
 
 	return (BPY_button_exec(C, str_unit_convert, value, TRUE) != -1);
 }
@@ -1718,36 +1721,39 @@ static int ui_set_but_string_eval_num_unit(bContext *C, uiBut *but, const char *
 
 int ui_set_but_string_eval_num(bContext *C, uiBut *but, const char *str, double *value)
 {
-	int ok= FALSE;
+	int ok = FALSE;
 
 #ifdef WITH_PYTHON
 
-	if(str[0] != '\0') {
-		int is_unit_but= ui_is_but_unit(but);
+	if (str[0] != '\0') {
+		int is_unit_but = ui_is_but_unit(but);
 		/* only enable verbose if we won't run again with units */
-		if(BPY_button_exec(C, str, value, is_unit_but==FALSE) != -1) {
+		if (BPY_button_exec(C, str, value, is_unit_but == FALSE) != -1) {
 			/* if the value parsed ok without unit conversion this button may still need a unit multiplier */
-			if(is_unit_but) {
+			if (is_unit_but) {
 				char str_new[128];
 
 				BLI_snprintf(str_new, sizeof(str_new), "%f", *value);
-				ok= ui_set_but_string_eval_num_unit(C, but, str_new, value);
+				ok = ui_set_but_string_eval_num_unit(C, but, str_new, value);
 			}
 			else {
-				ok= TRUE; /* parse normal string via py (no unit conversion needed) */
+				ok = TRUE; /* parse normal string via py (no unit conversion needed) */
 			}
 		}
-		else if(is_unit_but) {
+		else if (is_unit_but) {
 			/* parse failed, this is a unit but so run replacements and parse again */
-			ok= ui_set_but_string_eval_num_unit(C, but, str, value);
+			ok = ui_set_but_string_eval_num_unit(C, but, str, value);
 		}
 	}
 
 #else /* WITH_PYTHON */
 
-	value= atof(str);
+	*value = atof(str);
 	ok = TRUE;
 
+	(void)C;
+	(void)but;
+
 #endif /* WITH_PYTHON */
 
 	return ok;
@@ -1756,31 +1762,31 @@ int ui_set_but_string_eval_num(bContext *C, uiBut *but, const char *str, double
 
 int ui_set_but_string(bContext *C, uiBut *but, const char *str)
 {
-	if(but->rnaprop && ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
-		if(RNA_property_editable(&but->rnapoin, but->rnaprop)) {
+	if (but->rnaprop && ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
+		if (RNA_property_editable(&but->rnapoin, but->rnaprop)) {
 			PropertyType type;
 
-			type= RNA_property_type(but->rnaprop);
+			type = RNA_property_type(but->rnaprop);
 
-			if(type == PROP_STRING) {
+			if (type == PROP_STRING) {
 				/* RNA string */
 				RNA_property_string_set(&but->rnapoin, but->rnaprop, str);
 				return 1;
 			}
-			else if(type == PROP_POINTER) {
+			else if (type == PROP_POINTER) {
 				/* RNA pointer */
 				PointerRNA ptr, rptr;
 				PropertyRNA *prop;
 
-				if(str == NULL || str[0] == '\0') {
+				if (str == NULL || str[0] == '\0') {
 					RNA_property_pointer_set(&but->rnapoin, but->rnaprop, PointerRNA_NULL);
 					return 1;
 				}
 				else {
-					ptr= but->rnasearchpoin;
-					prop= but->rnasearchprop;
+					ptr = but->rnasearchpoin;
+					prop = but->rnasearchprop;
 					
-					if(prop && RNA_property_collection_lookup_string(&ptr, prop, str, &rptr))
+					if (prop && RNA_property_collection_lookup_string(&ptr, prop, str, &rptr))
 						RNA_property_pointer_set(&but->rnapoin, but->rnaprop, rptr);
 
 					return 1;
@@ -1790,45 +1796,45 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str)
 			}
 		}
 	}
-	else if(but->type == IDPOIN) {
+	else if (but->type == IDPOIN) {
 		/* ID pointer */
 		but->idpoin_func(C, str, but->idpoin_idpp);
 		return 1;
 	}
-	else if(but->type == TEX) {
+	else if (but->type == TEX) {
 		/* string */
-		if(ui_is_but_utf8(but)) BLI_strncpy_utf8(but->poin, str, but->hardmax);
-		else                    BLI_strncpy(but->poin, str, but->hardmax);
+		if (ui_is_but_utf8(but)) BLI_strncpy_utf8(but->poin, str, but->hardmax);
+		else BLI_strncpy(but->poin, str, but->hardmax);
 
 		return 1;
 	}
-	else if(but->type == SEARCH_MENU) {
+	else if (but->type == SEARCH_MENU) {
 		/* string */
 		BLI_strncpy(but->poin, str, but->hardmax);
 		return 1;
 	}
-	else if(ui_but_anim_expression_set(but, str)) {
+	else if (ui_but_anim_expression_set(but, str)) {
 		/* driver expression */
 		return 1;
 	}
-	else if(str[0]=='#') {
+	else if (str[0] == '#') {
 		/* shortcut to create new driver expression (versus immediate Py-execution) */
-		return ui_but_anim_expression_create(but, str+1);
+		return ui_but_anim_expression_create(but, str + 1);
 	}
 	else {
 		/* number editing */
 		double value;
 
-		if(ui_set_but_string_eval_num(C, but, str, &value) == FALSE) {
+		if (ui_set_but_string_eval_num(C, but, str, &value) == FALSE) {
 			return 0;
 		}
 
-		if(!ui_is_but_float(but)) value= (int)floor(value + 0.5);
-		if(but->type==NUMABS) value= fabs(value);
+		if (!ui_is_but_float(but)) value = (int)floor(value + 0.5);
+		if (but->type == NUMABS) value = fabs(value);
 
 		/* not that we use hard limits here */
-		if(value < (double)but->hardmin) value= but->hardmin;
-		if(value > (double)but->hardmax) value= but->hardmax;
+		if (value < (double)but->hardmin) value = but->hardmin;
+		if (value > (double)but->hardmax) value = but->hardmax;
 
 		ui_set_but_val(but, value);
 		return 1;
@@ -1850,12 +1856,12 @@ 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));
+	double newmax = pow(10.0, ceil(log(value) / M_LN10));
 
-	if(newmax*0.2 >= max && newmax*0.2 >= value)
-		return newmax*0.2;
-	else if(newmax*0.5 >= max && newmax*0.5 >= value)
-		return newmax*0.5;
+	if (newmax * 0.2 >= max && newmax * 0.2 >= value)
+		return newmax * 0.2;
+	else if (newmax * 0.5 >= max && newmax * 0.5 >= value)
+		return newmax * 0.5;
 	else
 		return newmax;
 }
@@ -1863,89 +1869,89 @@ 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));
+	double newmax = pow(10.0, floor(log(value) / M_LN10));
 
-	if(newmax*5.0 <= max && newmax*5.0 <= value)
-		return newmax*5.0;
-	else if(newmax*2.0 <= max && newmax*2.0 <= value)
-		return newmax*2.0;
+	if (newmax * 5.0 <= max && newmax * 5.0 <= value)
+		return newmax * 5.0;
+	else if (newmax * 2.0 <= max && newmax * 2.0 <= value)
+		return newmax * 2.0;
 	else
 		return newmax;
 }
 
 void ui_set_but_soft_range(uiBut *but, double value)
 {
-	/* ideally we would not limit this but practially, its more then
+	/* ideally we would not limit this but practically, its more then
 	 * enough worst case is very long vectors wont use a smart soft-range
-	 * which isnt so bad. */
+	 * which isn't so bad. */
 
-	if(but->rnaprop) {
-		const PropertyType type= RNA_property_type(but->rnaprop);
+	if (but->rnaprop) {
+		const PropertyType type = RNA_property_type(but->rnaprop);
 		double softmin, softmax /*, step, precision*/;
-		double value_min= value;
-		double value_max= value;
+		double value_min = value;
+		double value_max = value;
 
 		/* clamp button range to something reasonable in case
 		 * we get -inf/inf from RNA properties */
-		if(type == PROP_INT) {
+		if (type == PROP_INT) {
 			int imin, imax, istep;
-			const int array_len= RNA_property_array_length(&but->rnapoin, but->rnaprop);
+			const int array_len = RNA_property_array_length(&but->rnapoin, but->rnaprop);
 
 			RNA_property_int_ui_range(&but->rnapoin, but->rnaprop, &imin, &imax, &istep);
-			softmin= (imin == INT_MIN)? -1e4: imin;
-			softmax= (imin == INT_MAX)? 1e4: imax;
+			softmin = (imin == INT_MIN) ? -1e4 : imin;
+			softmax = (imin == INT_MAX) ? 1e4 : imax;
 			/*step= istep;*/ /*UNUSED*/
 			/*precision= 1;*/ /*UNUSED*/
 
-			if(array_len >= 2) {
+			if (array_len >= 2) {
 				int value_range[2];
 				RNA_property_int_get_array_range(&but->rnapoin, but->rnaprop, value_range);
-				value_min= (double)value_range[0];
-				value_max= (double)value_range[1];
+				value_min = (double)value_range[0];
+				value_max = (double)value_range[1];
 			}
 		}
-		else if(type == PROP_FLOAT) {
+		else if (type == PROP_FLOAT) {
 			float fmin, fmax, fstep, fprecision;
-			const int array_len= RNA_property_array_length(&but->rnapoin, but->rnaprop);
+			const int array_len = RNA_property_array_length(&but->rnapoin, but->rnaprop);
 
 			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;
+			softmin = (fmin == -FLT_MAX) ? (float)-1e4 : fmin;
+			softmax = (fmax == FLT_MAX) ? (float)1e4 : fmax;
 			/*step= fstep;*/ /*UNUSED*/
 			/*precision= fprecision;*/ /*UNUSED*/
 
-			if(array_len >= 2) {
+			if (array_len >= 2) {
 				float value_range[2];
 				RNA_property_float_get_array_range(&but->rnapoin, but->rnaprop, value_range);
-				value_min= (double)value_range[0];
-				value_max= (double)value_range[1];
+				value_min = (double)value_range[0];
+				value_max = (double)value_range[1];
 			}
 		}
 		else
 			return;
 
 		/* if the value goes out of the soft/max range, adapt the range */
-		if(value_min+1e-10 < softmin) {
-			if(value_min < 0.0)
-				softmin= -soft_range_round_up(-value_min, -softmin);
+		if (value_min + 1e-10 < softmin) {
+			if (value_min < 0.0)
+				softmin = -soft_range_round_up(-value_min, -softmin);
 			else
-				softmin= soft_range_round_down(value_min, softmin);
+				softmin = soft_range_round_down(value_min, softmin);
 
-			if(softmin < (double)but->hardmin)
-				softmin= (double)but->hardmin;
+			if (softmin < (double)but->hardmin)
+				softmin = (double)but->hardmin;
 		}
-		if(value_max-1e-10 > softmax) {
-			if(value_max < 0.0)
-				softmax= -soft_range_round_down(-value_max, -softmax);
+		if (value_max - 1e-10 > softmax) {
+			if (value_max < 0.0)
+				softmax = -soft_range_round_down(-value_max, -softmax);
 			else
-				softmax= soft_range_round_up(value_max, softmax);
+				softmax = soft_range_round_up(value_max, softmax);
 
-			if(softmax > (double)but->hardmax)
-				softmax= but->hardmax;
+			if (softmax > (double)but->hardmax)
+				softmax = but->hardmax;
 		}
 
-		but->softmin= softmin;
-		but->softmax= softmax;
+		but->softmin = softmin;
+		but->softmax = softmax;
 	}
 }
 
@@ -1953,7 +1959,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);
 	}
@@ -1962,16 +1968,16 @@ static void ui_free_link(uiLink *link)
 /* can be called with C==NULL */
 static void ui_free_but(const bContext *C, uiBut *but)
 {
-	if(but->opptr) {
+	if (but->opptr) {
 		WM_operator_properties_free(but->opptr);
 		MEM_freeN(but->opptr);
 	}
 
-	if(but->func_argN) {
+	if (but->func_argN) {
 		MEM_freeN(but->func_argN);
 	}
 
-	if(but->active) {
+	if (but->active) {
 		/* XXX solve later, buttons should be free-able without context ideally,
 		 * however they may have open tooltips or popup windows, which need to
 		 * be closed using a context pointer */
@@ -1979,7 +1985,7 @@ static void ui_free_but(const bContext *C, uiBut *but)
 			ui_button_active_free(C, but);
 		}
 		else {
-			if(but->active) {
+			if (but->active) {
 				MEM_freeN(but->active);
 			}
 		}
@@ -2001,7 +2007,7 @@ void uiFreeBlock(const bContext *C, uiBlock *block)
 {
 	uiBut *but;
 
-	while( (but= block->buttons.first) ) {
+	while ( (but = block->buttons.first) ) {
 		BLI_remlink(&block->buttons, but);	
 		ui_free_but(C, but);
 	}
@@ -2026,7 +2032,7 @@ void uiFreeBlocks(const bContext *C, ListBase *lb)
 {
 	uiBlock *block;
 	
-	while( (block= lb->first) ) {
+	while ( (block = lb->first) ) {
 		BLI_remlink(lb, block);
 		uiFreeBlock(C, block);
 	}
@@ -2036,40 +2042,40 @@ void uiFreeInactiveBlocks(const bContext *C, ListBase *lb)
 {
 	uiBlock *block, *nextblock;
 
-	for(block=lb->first; block; block=nextblock) {
-		nextblock= block->next;
+	for (block = lb->first; block; block = nextblock) {
+		nextblock = block->next;
 	
-		if(!block->handle) {
-			if(!block->active) {
+		if (!block->handle) {
+			if (!block->active) {
 				BLI_remlink(lb, block);
 				uiFreeBlock(C, block);
 			}
 			else
-				block->active= 0;
+				block->active = 0;
 		}
 	}
 }
 
 void uiBlockSetRegion(uiBlock *block, ARegion *region)
 {
-	ListBase *lb= &region->uiblocks;
-	uiBlock *oldblock= NULL;
+	ListBase *lb = &region->uiblocks;
+	uiBlock *oldblock = NULL;
 
 	/* each listbase only has one block with this name, free block
 	 * if is already there so it can be rebuilt from scratch */
-	if(lb) {
-		oldblock= BLI_findstring(lb, block->name, offsetof(uiBlock, name));
+	if (lb) {
+		oldblock = BLI_findstring(lb, block->name, offsetof(uiBlock, name));
 
 		if (oldblock) {
-			oldblock->active= 0;
-			oldblock->panel= NULL;
+			oldblock->active = 0;
+			oldblock->panel = NULL;
 		}
 
 		/* at the beginning of the list! for dynamical menus/blocks */
 		BLI_addhead(lb, block);
 	}
 
-	block->oldblock= oldblock;
+	block->oldblock = oldblock;
 }
 
 uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, short dt)
@@ -2079,35 +2085,35 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor
 	Scene *scn;
 	int getsizex, getsizey;
 
-	window= CTX_wm_window(C);
+	window = CTX_wm_window(C);
 	scn = CTX_data_scene(C);
 
-	block= MEM_callocN(sizeof(uiBlock), "uiBlock");
-	block->active= 1;
-	block->dt= dt;
-	block->evil_C= (void*)C; // XXX
+	block = MEM_callocN(sizeof(uiBlock), "uiBlock");
+	block->active = 1;
+	block->dt = dt;
+	block->evil_C = (void *)C; // XXX
 
 	if (scn) {
-		block->color_profile= (scn->r.color_mgt_flag & R_COLOR_MANAGEMENT);
+		block->color_profile = (scn->r.color_mgt_flag & R_COLOR_MANAGEMENT);
 
 		/* copy to avoid crash when scene gets deleted with ui still open */
-		block->unit= MEM_mallocN(sizeof(scn->unit), "UI UnitSettings");
+		block->unit = MEM_mallocN(sizeof(scn->unit), "UI UnitSettings");
 		memcpy(block->unit, &scn->unit, sizeof(scn->unit));
 	}
 
 	BLI_strncpy(block->name, name, sizeof(block->name));
 
-	if(region)
+	if (region)
 		uiBlockSetRegion(block, region);
 
 	/* window matrix and aspect */
-	if(region && region->swinid) {
+	if (region && region->swinid) {
 		wm_subwindow_getmatrix(window, region->swinid, block->winmat);
 		wm_subwindow_getsize(window, region->swinid, &getsizex, &getsizey);
 
 		/* TODO - investigate why block->winmat[0][0] is negative
 		 * in the image view when viewRedrawForce is called */
-		block->aspect= 2.0/fabs( (getsizex)*block->winmat[0][0]);
+		block->aspect = 2.0 / fabs( (getsizex) * block->winmat[0][0]);
 	}
 	else {
 		/* no subwindow created yet, for menus for example, so we
@@ -2116,8 +2122,8 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor
 		wm_subwindow_getmatrix(window, window->screen->mainwin, block->winmat);
 		wm_subwindow_getsize(window, window->screen->mainwin, &getsizex, &getsizey);
 
-		block->aspect= 2.0/fabs(getsizex*block->winmat[0][0]);
-		block->auto_open= TRUE;
+		block->aspect = 2.0 / fabs(getsizex * block->winmat[0][0]);
+		block->auto_open = TRUE;
 		block->flag |= UI_BLOCK_LOOP; /* tag as menu */
 	}
 
@@ -2131,63 +2137,63 @@ uiBlock *uiGetBlock(const char *name, ARegion *ar)
 
 void uiBlockSetEmboss(uiBlock *block, char dt)
 {
-	block->dt= dt;
+	block->dt = dt;
 }
 
 void ui_check_but(uiBut *but)
 {
 	/* if something changed in the button */
-	double value= UI_BUT_VALUE_UNSET;
+	double value = UI_BUT_VALUE_UNSET;
 //	float okwidth; // UNUSED
 	
 	ui_is_but_sel(but, &value);
 	
 	/* only update soft range while not editing */
-	if(but->rnaprop && !(but->editval || but->editstr || but->editvec)) {
+	if (but->rnaprop && !(but->editval || but->editstr || but->editvec)) {
 		UI_GET_BUT_VALUE_INIT(but, value)
 		ui_set_but_soft_range(but, value);
 	}
 
 	/* test for min and max, icon sliders, etc */
-	switch( but->type ) {
+	switch (but->type) {
 		case NUM:
 		case SLI:
 		case SCROLL:
 		case NUMSLI:
 		case HSVSLI:
 			UI_GET_BUT_VALUE_INIT(but, value)
-			if(value < (double)but->hardmin) ui_set_but_val(but, but->hardmin);
-			else if(value > (double)but->hardmax) ui_set_but_val(but, but->hardmax);
+			if (value < (double)but->hardmin) ui_set_but_val(but, but->hardmin);
+			else if (value > (double)but->hardmax) ui_set_but_val(but, but->hardmax);
 			break;
 			
 		case NUMABS:
 		{
 			double value_abs;
 			UI_GET_BUT_VALUE_INIT(but, value)
-			value_abs= fabs(value);
-			if(value_abs < (double)but->hardmin) ui_set_but_val(but, but->hardmin);
-			else if(value_abs > (double)but->hardmax) ui_set_but_val(but, but->hardmax);
+			value_abs = fabs(value);
+			if (value_abs < (double)but->hardmin) ui_set_but_val(but, but->hardmin);
+			else if (value_abs > (double)but->hardmax) ui_set_but_val(but, but->hardmax);
 			break;
 		}
 		case ICONTOG: 
 		case ICONTOGN:
-			if(!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
-				if(but->flag & UI_SELECT) but->iconadd= 1;
-				else but->iconadd= 0;
+			if (!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
+				if (but->flag & UI_SELECT) but->iconadd = 1;
+				else but->iconadd = 0;
 			}
 			break;
 			
 		case ICONROW:
-			if(!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
+			if (!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
 				UI_GET_BUT_VALUE_INIT(but, value)
-				but->iconadd= (int)value- (int)(but->hardmin);
+				but->iconadd = (int)value - (int)(but->hardmin);
 			}
 			break;
 			
 		case ICONTEXTROW:
-			if(!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
+			if (!but->rnaprop || (RNA_property_flag(but->rnaprop) & PROP_ICONS_CONSECUTIVE)) {
 				UI_GET_BUT_VALUE_INIT(but, value)
-				but->iconadd= (int)value- (int)(but->hardmin);
+				but->iconadd = (int)value - (int)(but->hardmin);
 			}
 			break;
 	}
@@ -2197,130 +2203,130 @@ void ui_check_but(uiBut *but)
 	// okwidth= -4 + (but->x2 - but->x1); // UNUSED
 	
 	/* name: */
-	switch( but->type ) {
+	switch (but->type) {
 	
-	case MENU:
-	case ICONTEXTROW:
+		case MENU:
+		case ICONTEXTROW:
 		
-		if(but->x2 - but->x1 > 24) {
-			UI_GET_BUT_VALUE_INIT(but, value)
-			ui_set_name_menu(but, (int)value);
-		}
-		break;
+			if (but->x2 - but->x1 > 24) {
+				UI_GET_BUT_VALUE_INIT(but, value)
+				ui_set_name_menu(but, (int)value);
+			}
+			break;
 	
-	case NUM:
-	case NUMSLI:
-	case HSVSLI:
-	case NUMABS:
+		case NUM:
+		case NUMSLI:
+		case HSVSLI:
+		case NUMABS:
 
-		UI_GET_BUT_VALUE_INIT(but, value)
+			UI_GET_BUT_VALUE_INIT(but, value)
 
-		if(ui_is_but_float(but)) {
-			if(value == (double) FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%sinf", but->str);
-			else if(value == (double) -FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s-inf", but->str);
-			/* support length type buttons */
-			else if(ui_is_but_unit(but)) {
-				char new_str[sizeof(but->drawstr)];
-				ui_get_but_string_unit(but, new_str, sizeof(new_str), value, TRUE);
-				BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%s", but->str, new_str);
+			if (ui_is_but_float(but)) {
+				if (value == (double) FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%sinf", but->str);
+				else if (value == (double) -FLT_MAX) BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s-inf", but->str);
+				/* support length type buttons */
+				else if (ui_is_but_unit(but)) {
+					char new_str[sizeof(but->drawstr)];
+					ui_get_but_string_unit(but, new_str, sizeof(new_str), value, TRUE);
+					BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%s", but->str, new_str);
+				}
+				else {
+					const int prec = ui_but_float_precision(but, value);
+					BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%.*f", but->str, prec, value);
+				}
 			}
 			else {
-				const int prec= ui_but_float_precision(but, value);
-				BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%.*f", but->str, prec, value);
+				BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%d", but->str, (int)value);
 			}
-		}
-		else {
-			BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%d", but->str, (int)value);
-		}
 			
-		if(but->rnaprop) {
-			PropertySubType pstype = RNA_property_subtype(but->rnaprop);
+			if (but->rnaprop) {
+				PropertySubType pstype = RNA_property_subtype(but->rnaprop);
 			
-			if (pstype == PROP_PERCENTAGE)
-				strcat(but->drawstr, "%");
-		}
-		break;
+				if (pstype == PROP_PERCENTAGE)
+					strcat(but->drawstr, "%");
+			}
+			break;
 
-	case LABEL:
-		if(ui_is_but_float(but)) {
-			int prec;
-			UI_GET_BUT_VALUE_INIT(but, value)
-			prec= ui_but_float_precision(but, value);
-			BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%.*f", but->str, prec, value);
-		}
-		else {
-			BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
-		}
+		case LABEL:
+			if (ui_is_but_float(but)) {
+				int prec;
+				UI_GET_BUT_VALUE_INIT(but, value)
+				prec = ui_but_float_precision(but, value);
+				BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%.*f", but->str, prec, value);
+			}
+			else {
+				BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
+			}
 		
-		break;
+			break;
 
-	case IDPOIN:
-	case TEX:
-	case SEARCH_MENU:
-		if(!but->editstr) {
-			char str[UI_MAX_DRAW_STR];
+		case IDPOIN:
+		case TEX:
+		case SEARCH_MENU:
+			if (!but->editstr) {
+				char str[UI_MAX_DRAW_STR];
 
-			ui_get_but_string(but, str, UI_MAX_DRAW_STR-strlen(but->str));
+				ui_get_but_string(but, str, UI_MAX_DRAW_STR - strlen(but->str));
 
-			BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%s", but->str, str);
-		}
-		break;
+				BLI_snprintf(but->drawstr, sizeof(but->drawstr), "%s%s", but->str, str);
+			}
+			break;
 	
-	case KEYEVT:
-		BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
-		if (but->flag & UI_SELECT) {
-			strcat(but->drawstr, "Press a key");
-		}
-		else {
-			UI_GET_BUT_VALUE_INIT(but, value)
-			strcat(but->drawstr, WM_key_event_string((short)value));
-		}
-		break;
+		case KEYEVT:
+			BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
+			if (but->flag & UI_SELECT) {
+				strcat(but->drawstr, "Press a key");
+			}
+			else {
+				UI_GET_BUT_VALUE_INIT(but, value)
+				strcat(but->drawstr, WM_key_event_string((short)value));
+			}
+			break;
 		
-	case HOTKEYEVT:
-		if (but->flag & UI_SELECT) {
-			but->drawstr[0]= '\0';
-			
-			if(but->modifier_key) {
-				char *str= but->drawstr;
-				
-				if(but->modifier_key & KM_SHIFT)
-					str= strcat(str, "Shift ");
-				if(but->modifier_key & KM_CTRL)
-					str= strcat(str, "Ctrl ");
-				if(but->modifier_key & KM_ALT)
-					str= strcat(str, "Alt ");
-				if(but->modifier_key & KM_OSKEY)
-					str= strcat(str, "Cmd ");
-
-				(void)str; /* UNUSED */
+		case HOTKEYEVT:
+			if (but->flag & UI_SELECT) {
+				but->drawstr[0] = '\0';
+
+				if (but->modifier_key) {
+					char *str = but->drawstr;
+
+					if (but->modifier_key & KM_SHIFT)
+						str = strcat(str, "Shift ");
+					if (but->modifier_key & KM_CTRL)
+						str = strcat(str, "Ctrl ");
+					if (but->modifier_key & KM_ALT)
+						str = strcat(str, "Alt ");
+					if (but->modifier_key & KM_OSKEY)
+						str = strcat(str, "Cmd ");
+
+					(void)str; /* UNUSED */
+				}
+				else
+					strcat(but->drawstr, "Press a key  ");
 			}
 			else
-				strcat(but->drawstr, "Press a key  ");
-		}
-		else
-			BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
+				BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
+
+			break;
 
-		break;
+		case BUT_TOGDUAL:
+			/* trying to get the dual-icon to left of text... not very nice */
+			if (but->str[0]) {
+				BLI_strncpy(but->drawstr, "  ", UI_MAX_DRAW_STR);
+				BLI_strncpy(but->drawstr + 2, but->str, UI_MAX_DRAW_STR - 2);
+			}
+			break;
 		
-	case BUT_TOGDUAL:
-		/* trying to get the dual-icon to left of text... not very nice */
-		if(but->str[0]) {
-			BLI_strncpy(but->drawstr, "  ", UI_MAX_DRAW_STR);
-			BLI_strncpy(but->drawstr+2, but->str, UI_MAX_DRAW_STR-2);
-		}
-		break;
-
-	case HSVCUBE:
-	case HSVCIRCLE:
-		break;
-	default:
-		BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
+		case HSVCUBE:
+		case HSVCIRCLE:
+			break;
+		default:
+			BLI_strncpy(but->drawstr, but->str, UI_MAX_DRAW_STR);
 		
 	}
 
 	/* if we are doing text editing, this will override the drawstr */
-	if(but->editstr)
+	if (but->editstr)
 		BLI_strncpy(but->drawstr, but->editstr, UI_MAX_DRAW_STR);
 	
 	/* text clipping moved to widget drawing code itself */
@@ -2330,7 +2336,7 @@ void ui_check_but(uiBut *but)
 void uiBlockBeginAlign(uiBlock *block)
 {
 	/* if other align was active, end it */
-	if(block->flag & UI_BUT_ALIGN) uiBlockEndAlign(block);
+	if (block->flag & UI_BUT_ALIGN) uiBlockEndAlign(block);
 
 	block->flag |= UI_BUT_ALIGN_DOWN;	
 	block->alignnr++;
@@ -2342,16 +2348,16 @@ static int buts_are_horiz(uiBut *but1, uiBut *but2)
 {
 	float dx, dy;
 	
-	dx= fabs( but1->x2 - but2->x1);
-	dy= fabs( but1->y1 - but2->y2);
+	dx = fabs(but1->x2 - but2->x1);
+	dy = fabs(but1->y1 - but2->y2);
 	
-	if(dx > dy) return 0;
+	if (dx > dy) return 0;
 	return 1;
 }
 
 void uiBlockEndAlign(uiBlock *block)
 {
-	block->flag &= ~UI_BUT_ALIGN;	// all 4 flags
+	block->flag &= ~UI_BUT_ALIGN;   // all 4 flags
 }
 
 int ui_but_can_align(uiBut *but)
@@ -2361,90 +2367,90 @@ int ui_but_can_align(uiBut *but)
 
 static void ui_block_do_align_but(uiBut *first, short nr)
 {
-	uiBut *prev, *but=NULL, *next;
-	int flag= 0, cols=0, rows=0;
+	uiBut *prev, *but = NULL, *next;
+	int flag = 0, cols = 0, rows = 0;
 	
 	/* auto align */
 
-	for(but=first; but && but->alignnr == nr; but=but->next) {
-		if(but->next && but->next->alignnr == nr) {
-			if(buts_are_horiz(but, but->next)) cols++;
+	for (but = first; but && but->alignnr == nr; but = but->next) {
+		if (but->next && but->next->alignnr == nr) {
+			if (buts_are_horiz(but, but->next)) cols++;
 			else rows++;
 		}
 	}
 
-	/* rows==0: 1 row, cols==0: 1 collumn */
+	/* 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) {
-		next= but->next;
-		if(next && next->alignnr != nr)
-			next= NULL;
+	for (but = first, prev = NULL; but && but->alignnr == nr; prev = but, but = but->next) {
+		next = but->next;
+		if (next && next->alignnr != nr)
+			next = NULL;
 
 		/* clear old flag */
 		but->flag &= ~UI_BUT_ALIGN;
 			
-		if(flag==0) {	/* first case */
-			if(next) {
-				if(buts_are_horiz(but, next)) {
-					if(rows==0)
-						flag= UI_BUT_ALIGN_RIGHT;
+		if (flag == 0) {  /* first case */
+			if (next) {
+				if (buts_are_horiz(but, next)) {
+					if (rows == 0)
+						flag = UI_BUT_ALIGN_RIGHT;
 					else 
-						flag= UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_RIGHT;
+						flag = UI_BUT_ALIGN_DOWN | UI_BUT_ALIGN_RIGHT;
 				}
 				else {
-					flag= UI_BUT_ALIGN_DOWN;
+					flag = UI_BUT_ALIGN_DOWN;
 				}
 			}
 		}
-		else if(next==NULL) {	/* last case */
-			if(prev) {
-				if(buts_are_horiz(prev, but)) {
-					if(rows==0) 
-						flag= UI_BUT_ALIGN_LEFT;
+		else if (next == NULL) {  /* last case */
+			if (prev) {
+				if (buts_are_horiz(prev, but)) {
+					if (rows == 0)
+						flag = UI_BUT_ALIGN_LEFT;
 					else
-						flag= UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_LEFT;
+						flag = UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_LEFT;
 				}
-				else flag= UI_BUT_ALIGN_TOP;
+				else flag = UI_BUT_ALIGN_TOP;
 			}
 		}
-		else if(buts_are_horiz(but, next)) {
+		else if (buts_are_horiz(but, next)) {
 			/* check if this is already second row */
-			if( prev && buts_are_horiz(prev, but)==0) {
+			if (prev && buts_are_horiz(prev, but) == 0) {
 				flag &= ~UI_BUT_ALIGN_LEFT;
 				flag |= UI_BUT_ALIGN_TOP;
 				/* exception case: bottom row */
-				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; 
-						bt= bt->next;
+				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;
+						bt = bt->next;
 					}
-					if(bt==NULL || bt->alignnr != nr) flag= UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_RIGHT;
+					if (bt == NULL || bt->alignnr != nr) flag = UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_RIGHT;
 				}
 			}
 			else flag |= UI_BUT_ALIGN_LEFT;
 		}
 		else {
-			if(cols==0) {
+			if (cols == 0) {
 				flag |= UI_BUT_ALIGN_TOP;
 			}
-			else {	/* next button switches to new row */
+			else {  /* next button switches to new row */
 				
-				if(prev && buts_are_horiz(prev, but))
+				if (prev && buts_are_horiz(prev, but))
 					flag |= UI_BUT_ALIGN_LEFT;
 				else {
 					flag &= ~UI_BUT_ALIGN_LEFT;
 					flag |= UI_BUT_ALIGN_TOP;
 				}
 				
-				if( (flag & UI_BUT_ALIGN_TOP)==0) {	/* stil top row */
-					if(prev) {
-						if(next && buts_are_horiz(but, next))
-							flag = UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT|UI_BUT_ALIGN_RIGHT;
+				if ( (flag & UI_BUT_ALIGN_TOP) == 0) {    /* stil top row */
+					if (prev) {
+						if (next && buts_are_horiz(but, next))
+							flag = UI_BUT_ALIGN_DOWN | UI_BUT_ALIGN_LEFT | UI_BUT_ALIGN_RIGHT;
 						else {
 							/* last button in top row */
-							flag = UI_BUT_ALIGN_DOWN|UI_BUT_ALIGN_LEFT;
+							flag = UI_BUT_ALIGN_DOWN | UI_BUT_ALIGN_LEFT;
 						}
 					}
 					else 
@@ -2458,35 +2464,35 @@ static void ui_block_do_align_but(uiBut *first, short nr)
 		but->flag |= flag;
 		
 		/* merge coordinates */
-		if(prev) {
+		if (prev) {
 			// simple cases 
-			if(rows==0) {
-				but->x1= (prev->x2+but->x1)/2.0f;
-				prev->x2= but->x1;
+			if (rows == 0) {
+				but->x1 = (prev->x2 + but->x1) / 2.0f;
+				prev->x2 = but->x1;
 			}
-			else if(cols==0) {
-				but->y2= (prev->y1+but->y2)/2.0f;
-				prev->y1= but->y2;
+			else if (cols == 0) {
+				but->y2 = (prev->y1 + but->y2) / 2.0f;
+				prev->y1 = but->y2;
 			}
 			else {
-				if(buts_are_horiz(prev, but)) {
-					but->x1= (prev->x2+but->x1)/2.0f;
-					prev->x2= but->x1;
+				if (buts_are_horiz(prev, but)) {
+					but->x1 = (prev->x2 + but->x1) / 2.0f;
+					prev->x2 = but->x1;
 					/* copy height too */
-					but->y2= prev->y2;
+					but->y2 = prev->y2;
 				}
-				else if(prev->prev && buts_are_horiz(prev->prev, prev)==0) {
+				else if (prev->prev && buts_are_horiz(prev->prev, prev) == 0) {
 					/* the previous button is a single one in its row */
-					but->y2= (prev->y1+but->y2)/2.0f;
-					prev->y1= but->y2;
+					but->y2 = (prev->y1 + but->y2) / 2.0f;
+					prev->y1 = but->y2;
 					
-					but->x1= prev->x1;
-					if(next && buts_are_horiz(but, next)==0)
-						but->x2= prev->x2;
+					but->x1 = prev->x1;
+					if (next && buts_are_horiz(but, next) == 0)
+						but->x2 = prev->x2;
 				}
 				else {
 					/* the previous button is not a single one in its row */
-					but->y2= prev->y1;
+					but->y2 = prev->y1;
 				}
 			}
 		}
@@ -2499,105 +2505,105 @@ void ui_block_do_align(uiBlock *block)
 	short nr;
 
 	/* align buttons with same align nr */
-	for(but=block->buttons.first; but;) {
-		if(but->alignnr) {
-			nr= but->alignnr;
+	for (but = block->buttons.first; but; ) {
+		if (but->alignnr) {
+			nr = but->alignnr;
 			ui_block_do_align_but(but, nr);
 
 			/* skip with same number */
-			for(; but && but->alignnr == nr; but=but->next);
+			for (; but && but->alignnr == nr; but = but->next) ;
 
-			if(!but)
+			if (!but)
 				break;
 		}
 		else
-			but= but->next;
+			but = but->next;
 	}
 }
 
-/*
- * ui_def_but is the function that draws many button types
-
+/**
+ * \brief ui_def_but is the function that draws many button types
+ *
  * for float buttons:
- *   "a1" Click Step (how much to change the value each click)
- *   "a2" Number of decimal point values to display. 0 defaults to 3 (0.000)
- *        1,2,3, and a maximum of 4, all greater values will be clamped to 4.
+ * - \a a1 Click Step (how much to change the value each click)
+ * - \a a2 Number of decimal point values to display. 0 defaults to 3 (0.000)
+ *      1,2,3, and a maximum of 4, all greater values will be clamped to 4.
  */
 static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, const char *tip)
 {
 	uiBut *but;
 	int slen;
 	
-	if(type & BUTPOIN) {		/* a pointer is required */
-		if(poin==NULL)
+	if (type & BUTPOIN) {       /* a pointer is required */
+		if (poin == NULL)
 			return NULL;
 	}
 
-	but= MEM_callocN(sizeof(uiBut), "uiBut");
+	but = MEM_callocN(sizeof(uiBut), "uiBut");
 
-	but->type= type & BUTTYPE;
-	but->pointype= type & BUTPOIN;
-	but->bit= type & BIT;
-	but->bitnr= type & 31;
+	but->type = type & BUTTYPE;
+	but->pointype = type & BUTPOIN;
+	but->bit = type & BIT;
+	but->bitnr = type & 31;
 	but->icon = ICON_NONE;
-	but->iconadd=0;
+	but->iconadd = 0;
 
-	but->retval= retval;
+	but->retval = retval;
 
-	slen= strlen(str);
-	if(slen >= UI_MAX_NAME_STR-1) {
-		but->str= MEM_mallocN(slen+2, "ui_def_but str"); /* why +2 ? */
+	slen = strlen(str);
+	if (slen >= UI_MAX_NAME_STR - 1) {
+		but->str = MEM_mallocN(slen + 2, "ui_def_but str"); /* why +2 ? */
 	}
 	else {
-		but->str= but->strdata;
+		but->str = but->strdata;
 	}
-	memcpy(but->str, str, slen+1);
+	memcpy(but->str, str, slen + 1);
 
-	but->x1= x1; 
-	but->y1= y1;
-	but->x2= (x1+x2); 
-	but->y2= (y1+y2);
-	
-	but->poin= poin;
-	but->hardmin= but->softmin= min; 
-	but->hardmax= but->softmax= max;
-	but->a1= a1; 
-	but->a2= a2;
-	but->tip= tip;
-	
-	but->lock= block->lock;
-	but->lockstr= block->lockstr;
-	but->dt= block->dt;
+	but->x1 = x1;
+	but->y1 = y1;
+	but->x2 = (x1 + x2);
+	but->y2 = (y1 + y2);
 
-	but->aspect= 1.0f; //XXX block->aspect;
-	but->block= block;		// pointer back, used for frontbuffer status, and picker
+	but->poin = poin;
+	but->hardmin = but->softmin = min;
+	but->hardmax = but->softmax = max;
+	but->a1 = a1;
+	but->a2 = a2;
+	but->tip = tip;
 
-	if((block->flag & UI_BUT_ALIGN) && ui_but_can_align(but))
-		but->alignnr= block->alignnr;
+	but->lock = block->lock;
+	but->lockstr = block->lockstr;
+	but->dt = block->dt;
 
-	but->func= block->func;
-	but->func_arg1= block->func_arg1;
-	but->func_arg2= block->func_arg2;
+	but->aspect = 1.0f; //XXX block->aspect;
+	but->block = block;      // pointer back, used for frontbuffer status, and picker
 
-	but->funcN= block->funcN;
-	if(block->func_argN)
-		but->func_argN= MEM_dupallocN(block->func_argN);
+	if ((block->flag & UI_BUT_ALIGN) && ui_but_can_align(but))
+		but->alignnr = block->alignnr;
+
+	but->func = block->func;
+	but->func_arg1 = block->func_arg1;
+	but->func_arg2 = block->func_arg2;
+
+	but->funcN = block->funcN;
+	if (block->func_argN)
+		but->func_argN = MEM_dupallocN(block->func_argN);
 	
-	but->pos= -1;	/* cursor invisible */
+	but->pos = -1;   /* cursor invisible */
 
-	if(ELEM4(but->type, NUM, NUMABS, NUMSLI, HSVSLI)) {	/* add a space to name */
+	if (ELEM4(but->type, NUM, NUMABS, NUMSLI, HSVSLI)) {    /* add a space to name */
 		/* slen remains unchanged from previous assignment, ensure this stays true */
-		if(slen>0 && slen<UI_MAX_NAME_STR-2) {
-			if(but->str[slen-1]!=' ') {
-				but->str[slen]= ' ';
-				but->str[slen+1]= 0;
+		if (slen > 0 && slen < UI_MAX_NAME_STR - 2) {
+			if (but->str[slen - 1] != ' ') {
+				but->str[slen] = ' ';
+				but->str[slen + 1] = 0;
 			}
 		}
 	}
 
-	if((block->flag & UI_BLOCK_LOOP) || ELEM8(but->type, MENU, TEX, LABEL, IDPOIN, BLOCK, BUTM, SEARCH_MENU, PROGRESSBAR))
-		but->flag |= (UI_TEXT_LEFT|UI_ICON_LEFT);
-	else if(but->type==BUT_TOGDUAL)
+	if ((block->flag & UI_BLOCK_LOOP) || ELEM8(but->type, MENU, TEX, LABEL, IDPOIN, BLOCK, BUTM, SEARCH_MENU, PROGRESSBAR))
+		but->flag |= (UI_TEXT_LEFT | UI_ICON_LEFT);
+	else if (but->type == BUT_TOGDUAL)
 		but->flag |= UI_ICON_LEFT;
 
 	but->flag |= (block->flag & UI_BUT_ALIGN);
@@ -2609,14 +2615,14 @@ 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(ELEM3(but->type, SCROLL, SEPR, FTPREVIEW));
-	else if(but->type >= SEARCH_MENU);
+	if (ELEM7(but->type, BLOCK, BUT, LABEL, PULLDOWN, ROUNDBOX, LISTBOX, BUTM)) ;
+	else if (ELEM3(but->type, SCROLL, SEPR, FTPREVIEW)) ;
+	else if (but->type >= SEARCH_MENU) ;
 	else but->flag |= UI_BUT_UNDO;
 
 	BLI_addtail(&block->buttons, but);
 	
-	if(block->curlayout)
+	if (block->curlayout)
 		ui_layout_add_but(block->curlayout, but);
 
 #ifdef WITH_PYTHON
@@ -2638,62 +2644,62 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
  */
 
 #define UI_DEF_BUT_RNA_DISABLE(but) \
-	but->flag |= UI_BUT_DISABLED; \
-	but->lock = 1; \
-	but->lockstr = ""
+    but->flag |= UI_BUT_DISABLED; \
+    but->lock = 1; \
+    but->lockstr = ""
 
 
 static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, float a1, float a2,  const char *tip)
 {
-	const PropertyType proptype= RNA_property_type(prop);
+	const PropertyType proptype = RNA_property_type(prop);
 	uiBut *but;
-	int freestr= 0, icon= 0;
+	int freestr = 0, icon = 0;
 
 	/* use rna values if parameters are not specified */
-	if(!str) {
-		if(type == MENU && proptype == PROP_ENUM) {
+	if (!str) {
+		if (type == MENU && proptype == PROP_ENUM) {
 			EnumPropertyItem *item;
 			DynStr *dynstr;
 			int i, totitem, value, free;
 
 			RNA_property_enum_items_gettexted(block->evil_C, ptr, prop, &item, &totitem, &free);
-			value= RNA_property_enum_get(ptr, prop);
+			value = RNA_property_enum_get(ptr, prop);
 
-			dynstr= BLI_dynstr_new();
+			dynstr = BLI_dynstr_new();
 			BLI_dynstr_appendf(dynstr, "%s%%t", RNA_property_ui_name(prop));
-			for(i=0; i<totitem; i++) {
-				if(!item[i].identifier[0]) {
-					if(item[i].name)
+			for (i = 0; i < totitem; i++) {
+				if (!item[i].identifier[0]) {
+					if (item[i].name)
 						BLI_dynstr_appendf(dynstr, "|%s%%l", item[i].name);
 					else
 						BLI_dynstr_append(dynstr, "|%l");
 				}
-				else if(item[i].icon)
+				else if (item[i].icon)
 					BLI_dynstr_appendf(dynstr, "|%s %%i%d %%x%d", item[i].name, item[i].icon, item[i].value);
 				else
 					BLI_dynstr_appendf(dynstr, "|%s %%x%d", item[i].name, item[i].value);
 
-				if(value == item[i].value)
-					icon= item[i].icon;
+				if (value == item[i].value)
+					icon = item[i].icon;
 			}
-			str= BLI_dynstr_get_cstring(dynstr);
+			str = BLI_dynstr_get_cstring(dynstr);
 			BLI_dynstr_free(dynstr);
 
 			if (free) {
 				MEM_freeN(item);
 			}
 
-			freestr= 1;
+			freestr = 1;
 		}
-		else if(ELEM(type, ROW, LISTROW) && proptype == PROP_ENUM) {
+		else if (ELEM(type, ROW, LISTROW) && proptype == PROP_ENUM) {
 			EnumPropertyItem *item;
 			int i, totitem, free;
 
 			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) {
-					str= item[i].name;
-					icon= item[i].icon;
+			for (i = 0; i < totitem; i++) {
+				if (item[i].identifier[0] && item[i].value == (int)max) {
+					str = item[i].name;
+					icon = item[i].icon;
 				}
 			}
 
@@ -2705,68 +2711,68 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
 			}
 		}
 		else {
-			str= RNA_property_ui_name(prop);
-			icon= RNA_property_ui_icon(prop);
+			str = RNA_property_ui_name(prop);
+			icon = RNA_property_ui_icon(prop);
 		}
 	}
 
-	if(!tip && proptype != PROP_ENUM)
-		tip= RNA_property_ui_description(prop);
+	if (!tip && proptype != PROP_ENUM)
+		tip = RNA_property_ui_description(prop);
 
-	if(min == max || a1 == -1 || a2 == -1) {
-		if(proptype == PROP_INT) {
+	if (min == max || a1 == -1 || a2 == -1) {
+		if (proptype == PROP_INT) {
 			int hardmin, hardmax, softmin, softmax, step;
 
 			RNA_property_int_range(ptr, prop, &hardmin, &hardmax);
 			RNA_property_int_ui_range(ptr, prop, &softmin, &softmax, &step);
 
-			if(!ELEM(type, ROW, LISTROW) && min == max) {
-				min= hardmin;
-				max= hardmax;
+			if (!ELEM(type, ROW, LISTROW) && min == max) {
+				min = hardmin;
+				max = hardmax;
 			}
-			if(a1 == -1)
-				a1= step;
-			if(a2 == -1)
-				a2= 0;
+			if (a1 == -1)
+				a1 = step;
+			if (a2 == -1)
+				a2 = 0;
 		}
-		else if(proptype == PROP_FLOAT) {
+		else if (proptype == PROP_FLOAT) {
 			float hardmin, hardmax, softmin, softmax, step, precision;
 
 			RNA_property_float_range(ptr, prop, &hardmin, &hardmax);
 			RNA_property_float_ui_range(ptr, prop, &softmin, &softmax, &step, &precision);
 
-			if(!ELEM(type, ROW, LISTROW) && min == max) {
-				min= hardmin;
-				max= hardmax;
+			if (!ELEM(type, ROW, LISTROW) && min == max) {
+				min = hardmin;
+				max = hardmax;
 			}
-			if(a1 == -1)
-				a1= step;
-			if(a2 == -1)
-				a2= precision;
+			if (a1 == -1)
+				a1 = step;
+			if (a2 == -1)
+				a2 = precision;
 		}
-		else if(proptype == PROP_STRING) {
-			min= 0;
-			max= RNA_property_string_maxlength(prop);
-			if(max == 0) /* interface code should ideally support unlimited length */
-				max= UI_MAX_DRAW_STR;
+		else if (proptype == PROP_STRING) {
+			min = 0;
+			max = RNA_property_string_maxlength(prop);
+			if (max == 0) /* interface code should ideally support unlimited length */
+				max = UI_MAX_DRAW_STR;
 		}
 	}
 
 	/* now create button */
-	but= ui_def_but(block, type, retval, str, x1, y1, x2, y2, NULL, min, max, a1, a2, tip);
+	but = ui_def_but(block, type, retval, str, x1, y1, x2, y2, NULL, min, max, a1, a2, tip);
 
-	but->rnapoin= *ptr;
-	but->rnaprop= prop;
+	but->rnapoin = *ptr;
+	but->rnaprop = prop;
 
-	if(RNA_property_array_length(&but->rnapoin, but->rnaprop))
-		but->rnaindex= index;
+	if (RNA_property_array_length(&but->rnapoin, but->rnaprop))
+		but->rnaindex = index;
 	else
-		but->rnaindex= 0;
+		but->rnaindex = 0;
 
-	if(icon) {
-		but->icon= (BIFIconID)icon;
+	if (icon) {
+		but->icon = (BIFIconID)icon;
 		but->flag |= UI_HAS_ICON;
-		but->flag|= UI_ICON_LEFT;
+		but->flag |= UI_ICON_LEFT;
 	}
 	
 	if (!RNA_property_editable(&but->rnapoin, prop)) {
@@ -2778,8 +2784,8 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
 	}
 
 	/* If this button uses units, calculate the step from this */
-	if((proptype == PROP_FLOAT) && ui_is_but_unit(but)) {
-		but->a1= ui_get_but_step_unit(but, but->a1);
+	if ((proptype == PROP_FLOAT) && ui_is_but_unit(but)) {
+		but->a1 = ui_get_but_step_unit(but, but->a1);
 	}
 
 	if (freestr) {
@@ -2791,14 +2797,14 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
 
 static uiBut *ui_def_but_rna_propname(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2,  const char *tip)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
 	uiBut *but;
 
-	if(prop) {
-		but= ui_def_but_rna(block, type, retval, str, x1, y1, x2, y2, ptr, prop, index, min, max, a1, a2,  tip);
+	if (prop) {
+		but = ui_def_but_rna(block, type, retval, str, x1, y1, x2, y2, ptr, prop, index, min, max, a1, a2,  tip);
 	}
 	else {
-		but= ui_def_but(block, type, retval, propname, x1, y1, x2, y2, NULL, min, max, a1, a2, tip);
+		but = ui_def_but(block, type, retval, propname, x1, y1, x2, y2, NULL, min, max, a1, a2, tip);
 
 		UI_DEF_BUT_RNA_DISABLE(but);
 	}
@@ -2810,22 +2816,23 @@ static uiBut *ui_def_but_operator_ptr(uiBlock *block, int type, wmOperatorType *
 {
 	uiBut *but;
 
-	if(!str) {
-		if(ot) str = ot->name;
+	if (!str) {
+		if (ot && ot->srna)
+			str = RNA_struct_ui_name(ot->srna);
+		else
+			str = "";
 	}
-	
-	if ((!tip || tip[0]=='\0') && ot && ot->description) {
-		tip= ot->description;
 
-		tip = TIP_(tip);
+	if ((!tip || tip[0] == '\0') && ot && ot->srna) {
+		tip = RNA_struct_ui_description(ot->srna);
 	}
 
-	but= ui_def_but(block, type, -1, str, x1, y1, x2, y2, NULL, 0, 0, 0, 0, tip);
-	but->optype= ot;
-	but->opcontext= opcontext;
+	but = ui_def_but(block, type, -1, str, x1, y1, x2, y2, NULL, 0, 0, 0, 0, tip);
+	but->optype = ot;
+	but->opcontext = opcontext;
 	but->flag &= ~UI_BUT_UNDO; /* no need for ui_but_is_undo(), we never need undo here */
 
-	if(!ot) {
+	if (!ot) {
 		but->flag |= UI_BUT_DISABLED;
 		but->lock = 1;
 		but->lockstr = "";
@@ -2833,35 +2840,38 @@ static uiBut *ui_def_but_operator_ptr(uiBlock *block, int type, wmOperatorType *
 
 	return but;
 }
-static uiBut *UNUSED_FUNCTION(ui_def_but_operator)(uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x1, int y1, short x2, short y2, const char *tip)
+
+#if 0 /* UNUSED */
+static uiBut *UNUSED_FUNCTION(ui_def_but_operator) (uiBlock * block, int type, const char *opname, int opcontext, const char *str, int x1, int y1, short x2, short y2, const char *tip)
 {
 	wmOperatorType *ot = WM_operatortype_find(opname, 0);
 	if (str == NULL && ot == NULL) str = opname;
 	return ui_def_but_operator_ptr(block, type, ot, opcontext, str, x1, y1, x2, y2, tip);
 }
+#endif
 
 static uiBut *ui_def_but_operator_text(uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x1, int y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, const char *tip)
 {
 	uiBut *but;
 	wmOperatorType *ot;
 	
-	ot= WM_operatortype_find(opname, 0);
+	ot = WM_operatortype_find(opname, 0);
 
-	if(!str) {
-		if(ot) str= ot->name;
-		else str= opname;
+	if (!str) {
+		if (ot) str = ot->name;
+		else str = opname;
 	}
 	
-	if ((!tip || tip[0]=='\0') && ot && ot->description) {
-		tip= ot->description;
+	if ((!tip || tip[0] == '\0') && ot && ot->description) {
+		tip = ot->description;
 	}
 
-	but= ui_def_but(block, type, -1, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
-	but->optype= ot;
-	but->opcontext= opcontext;
+	but = ui_def_but(block, type, -1, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
+	but->optype = ot;
+	but->opcontext = opcontext;
 	but->flag &= ~UI_BUT_UNDO; /* no need for ui_but_is_undo(), we never need undo here */
 
-	if(!ot) {
+	if (!ot) {
 		but->flag |= UI_BUT_DISABLED;
 		but->lock = 1;
 		but->lockstr = "";
@@ -2872,29 +2882,30 @@ static uiBut *ui_def_but_operator_text(uiBlock *block, int type, const char *opn
 
 uiBut *uiDefBut(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, const char *tip)
 {
-	uiBut *but= ui_def_but(block, type, retval, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
+	uiBut *but = ui_def_but(block, type, retval, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
 
 	ui_check_but(but);
 	
 	return but;
 }
 
-	/* if _x_ is a power of two (only one bit) return the power,
-	 * otherwise return -1. 
-	 * (1<<findBitIndex(x))==x for powers of two.
-	 */
+/* if _x_ is a power of two (only one bit) return the power,
+ * otherwise return -1.
+ * (1<<findBitIndex(x))==x for powers of two.
+ */
 static int findBitIndex(unsigned int x)
 {
 	if (!x || !is_power_of_2_i(x)) { /* is_power_of_2_i(x) strips lowest bit */
 		return -1;
-	} else {
-		int idx= 0;
+	}
+	else {
+		int idx = 0;
 
-		if (x&0xFFFF0000)	idx+=16, x>>=16;
-		if (x&0xFF00)		idx+=8, x>>=8;
-		if (x&0xF0)			idx+=4, x>>=4;
-		if (x&0xC)			idx+=2, x>>=2;
-		if (x&0x2)			idx+=1;
+		if (x & 0xFFFF0000) idx += 16, x >>= 16;
+		if (x & 0xFF00) idx += 8, x >>= 8;
+		if (x & 0xF0) idx += 4, x >>= 4;
+		if (x & 0xC) idx += 2, x >>= 2;
+		if (x & 0x2) idx += 1;
 
 		return idx;
 	}
@@ -2911,38 +2922,38 @@ AutoComplete *autocomplete_begin(const char *startname, size_t maxlen)
 {
 	AutoComplete *autocpl;
 	
-	autocpl= MEM_callocN(sizeof(AutoComplete), "AutoComplete");
-	autocpl->maxlen= maxlen;
-	autocpl->truncate= MEM_callocN(sizeof(char)*maxlen, "AutoCompleteTruncate");
-	autocpl->startname= startname;
+	autocpl = MEM_callocN(sizeof(AutoComplete), "AutoComplete");
+	autocpl->maxlen = maxlen;
+	autocpl->truncate = MEM_callocN(sizeof(char) * maxlen, "AutoCompleteTruncate");
+	autocpl->startname = startname;
 
 	return autocpl;
 }
 
 void autocomplete_do_name(AutoComplete *autocpl, const char *name)
 {
-	char *truncate= autocpl->truncate;
-	const char *startname= autocpl->startname;
+	char *truncate = autocpl->truncate;
+	const char *startname = autocpl->startname;
 	int a;
 
-	for(a=0; a<autocpl->maxlen-1; a++) {
-		if(startname[a]==0 || startname[a]!=name[a])
+	for (a = 0; a < autocpl->maxlen - 1; a++) {
+		if (startname[a] == 0 || startname[a] != name[a])
 			break;
 	}
 	/* found a match */
-	if(startname[a]==0) {
+	if (startname[a] == 0) {
 		/* first match */
-		if(truncate[0]==0)
+		if (truncate[0] == 0)
 			BLI_strncpy(truncate, name, autocpl->maxlen);
 		else {
 			/* remove from truncate what is not in bone->name */
-			for(a=0; a<autocpl->maxlen-1; a++) {
-				if(name[a] == 0) {
-					truncate[a]= 0;
+			for (a = 0; a < autocpl->maxlen - 1; a++) {
+				if (name[a] == 0) {
+					truncate[a] = 0;
 					break;
 				}
-				else if(truncate[a]!=name[a])
-					truncate[a]= 0;
+				else if (truncate[a] != name[a])
+					truncate[a] = 0;
 			}
 		}
 	}
@@ -2950,10 +2961,10 @@ void autocomplete_do_name(AutoComplete *autocpl, const char *name)
 
 void autocomplete_end(AutoComplete *autocpl, char *autoname)
 {	
-	if(autocpl->truncate[0])
+	if (autocpl->truncate[0])
 		BLI_strncpy(autoname, autocpl->truncate, autocpl->maxlen);
 	else {
-		if (autoname != autocpl->startname) /* dont copy a string over its self */
+		if (autoname != autocpl->startname) /* don't copy a string over its self */
 			BLI_strncpy(autoname, autocpl->startname, autocpl->maxlen);
 	}
 	MEM_freeN(autocpl->truncate);
@@ -2963,18 +2974,18 @@ void autocomplete_end(AutoComplete *autocpl, char *autoname)
 /* autocomplete callback for ID buttons */
 static void autocomplete_id(bContext *C, char *str, void *arg_v)
 {
-	int blocktype= (intptr_t)arg_v;
-	ListBase *listb= which_libbase(CTX_data_main(C), blocktype);
+	int blocktype = (intptr_t)arg_v;
+	ListBase *listb = which_libbase(CTX_data_main(C), blocktype);
 	
-	if(listb==NULL) return;
+	if (listb == NULL) return;
 	
 	/* search if str matches the beginning of an ID struct */
-	if(str[0]) {
-		AutoComplete *autocpl= autocomplete_begin(str, MAX_ID_NAME-2);
+	if (str[0]) {
+		AutoComplete *autocpl = autocomplete_begin(str, MAX_ID_NAME - 2);
 		ID *id;
 		
-		for(id= listb->first; id; id= id->next)
-			autocomplete_do_name(autocpl, id->name+2);
+		for (id = listb->first; id; id = id->next)
+			autocomplete_do_name(autocpl, id->name + 2);
 
 		autocomplete_end(autocpl, str);
 	}
@@ -2982,9 +2993,9 @@ static void autocomplete_id(bContext *C, char *str, void *arg_v)
 
 static void ui_check_but_and_iconize(uiBut *but, int icon)
 {
-	if(icon) {
-		but->icon= (BIFIconID) icon;
-		but->flag|= UI_HAS_ICON;
+	if (icon) {
+		but->icon = (BIFIconID) icon;
+		but->flag |= UI_HAS_ICON;
 	}
 
 	ui_check_but(but);
@@ -2992,56 +3003,57 @@ static void ui_check_but_and_iconize(uiBut *but, int icon)
 
 static uiBut *uiDefButBit(uiBlock *block, int type, int bit, int retval, const char *str, int x1, int y1, short x2, short y2, void *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	int bitIdx= findBitIndex(bit);
-	if (bitIdx==-1) {
+	int bitIdx = findBitIndex(bit);
+	if (bitIdx == -1) {
 		return NULL;
-	} else {
-		return uiDefBut(block, type|BIT|bitIdx, retval, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
+	}
+	else {
+		return uiDefBut(block, type | BIT | bitIdx, retval, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
 	}
 }
 uiBut *uiDefButF(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, float *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	return uiDefBut(block, type|FLO, retval, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
+	return uiDefBut(block, type | FLO, retval, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
 }
 uiBut *uiDefButBitF(uiBlock *block, int type, int bit, int retval, const char *str, int x1, int y1, short x2, short y2, float *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	return uiDefButBit(block, type|FLO, bit, retval, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
+	return uiDefButBit(block, type | FLO, bit, retval, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
 }
 uiBut *uiDefButI(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, int *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	return uiDefBut(block, type|INT, retval, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
+	return uiDefBut(block, type | INT, retval, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
 }
 uiBut *uiDefButBitI(uiBlock *block, int type, int bit, int retval, const char *str, int x1, int y1, short x2, short y2, int *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	return uiDefButBit(block, type|INT, bit, retval, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
+	return uiDefButBit(block, type | INT, bit, retval, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
 }
 uiBut *uiDefButS(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, short *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	return uiDefBut(block, type|SHO, retval, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
+	return uiDefBut(block, type | SHO, retval, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
 }
 uiBut *uiDefButBitS(uiBlock *block, int type, int bit, int retval, const char *str, int x1, int y1, short x2, short y2, short *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	return uiDefButBit(block, type|SHO, bit, retval, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
+	return uiDefButBit(block, type | SHO, bit, retval, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
 }
 uiBut *uiDefButC(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, char *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	return uiDefBut(block, type|CHA, retval, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
+	return uiDefBut(block, type | CHA, retval, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
 }
 uiBut *uiDefButBitC(uiBlock *block, int type, int bit, int retval, const char *str, int x1, int y1, short x2, short y2, char *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	return uiDefButBit(block, type|CHA, bit, retval, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
+	return uiDefButBit(block, type | CHA, bit, retval, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
 }
 uiBut *uiDefButR(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2,  const char *tip)
 {
 	uiBut *but;
-	but= ui_def_but_rna_propname(block, type, retval, str, x1, y1, x2, y2, ptr, propname, index, min, max, a1, a2, tip);
+	but = ui_def_but_rna_propname(block, type, retval, str, x1, y1, x2, y2, ptr, propname, index, min, max, a1, a2, tip);
 	ui_check_but(but);
 	return but;
 }
 uiBut *uiDefButR_prop(uiBlock *block, int type, int retval, const char *str, int x1, int y1, short x2, short y2, PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, float a1, float a2,  const char *tip)
 {
 	uiBut *but;
-	but= ui_def_but_rna(block, type, retval, str, x1, y1, x2, y2, ptr, prop, index, min, max, a1, a2, tip);
+	but = ui_def_but_rna(block, type, retval, str, x1, y1, x2, y2, ptr, prop, index, min, max, a1, a2, tip);
 	ui_check_but(but);
 	return but;
 }
@@ -3049,7 +3061,7 @@ uiBut *uiDefButR_prop(uiBlock *block, int type, int retval, const char *str, int
 uiBut *uiDefButO_ptr(uiBlock *block, int type, wmOperatorType *ot, int opcontext, const char *str, int x1, int y1, short x2, short y2, const char *tip)
 {
 	uiBut *but;
-	but= ui_def_but_operator_ptr(block, type, ot, opcontext, str, x1, y1, x2, y2, tip);
+	but = ui_def_but_operator_ptr(block, type, ot, opcontext, str, x1, y1, x2, y2, tip);
 	ui_check_but(but);
 	return but;
 }
@@ -3062,7 +3074,7 @@ uiBut *uiDefButO(uiBlock *block, int type, const char *opname, int opcontext, co
 
 uiBut *uiDefButTextO(uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x1, int y1, short x2, short y2, void *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	uiBut *but= ui_def_but_operator_text(block, type, opname, opcontext, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
+	uiBut *but = ui_def_but_operator_text(block, type, opname, opcontext, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
 	ui_check_but(but);
 	return but;
 }
@@ -3070,63 +3082,64 @@ uiBut *uiDefButTextO(uiBlock *block, int type, const char *opname, int opcontext
 /* if a1==1.0 then a2 is an extra icon blending factor (alpha 0.0 - 1.0) */
 uiBut *uiDefIconBut(uiBlock *block, int type, int retval, int icon, int x1, int y1, short x2, short y2, void *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	uiBut *but= ui_def_but(block, type, retval, "", x1, y1, x2, y2, poin, min, max, a1, a2, tip);
+	uiBut *but = ui_def_but(block, type, retval, "", x1, y1, x2, y2, poin, min, max, a1, a2, tip);
 	ui_check_but_and_iconize(but, icon);
 	return but;
 }
 static uiBut *uiDefIconButBit(uiBlock *block, int type, int bit, int retval, int icon, int x1, int y1, short x2, short y2, void *poin, float min, float max, float a1, float a2, const char *tip)
 {
-	int bitIdx= findBitIndex(bit);
-	if (bitIdx==-1) {
+	int bitIdx = findBitIndex(bit);
+	if (bitIdx == -1) {
 		return NULL;
-	} else {
-		return uiDefIconBut(block, type|BIT|bitIdx, retval, icon, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
+	}
+	else {
+		return uiDefIconBut(block, type | BIT | bitIdx, retval, icon, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
 	}
 }
 
 uiBut *uiDefIconButF(uiBlock *block, int type, int retval, int icon, int x1, int y1, short x2, short y2, float *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	return uiDefIconBut(block, type|FLO, retval, icon, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
+	return uiDefIconBut(block, type | FLO, retval, icon, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
 }
 uiBut *uiDefIconButBitF(uiBlock *block, int type, int bit, int retval, int icon, int x1, int y1, short x2, short y2, float *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	return uiDefIconButBit(block, type|FLO, bit, retval, icon, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
+	return uiDefIconButBit(block, type | FLO, bit, retval, icon, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
 }
 uiBut *uiDefIconButI(uiBlock *block, int type, int retval, int icon, int x1, int y1, short x2, short y2, int *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	return uiDefIconBut(block, type|INT, retval, icon, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
+	return uiDefIconBut(block, type | INT, retval, icon, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
 }
 uiBut *uiDefIconButBitI(uiBlock *block, int type, int bit, int retval, int icon, int x1, int y1, short x2, short y2, int *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	return uiDefIconButBit(block, type|INT, bit, retval, icon, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
+	return uiDefIconButBit(block, type | INT, bit, retval, icon, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
 }
 uiBut *uiDefIconButS(uiBlock *block, int type, int retval, int icon, int x1, int y1, short x2, short y2, short *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	return uiDefIconBut(block, type|SHO, retval, icon, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
+	return uiDefIconBut(block, type | SHO, retval, icon, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
 }
 uiBut *uiDefIconButBitS(uiBlock *block, int type, int bit, int retval, int icon, int x1, int y1, short x2, short y2, short *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	return uiDefIconButBit(block, type|SHO, bit, retval, icon, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
+	return uiDefIconButBit(block, type | SHO, bit, retval, icon, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
 }
 uiBut *uiDefIconButC(uiBlock *block, int type, int retval, int icon, int x1, int y1, short x2, short y2, char *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	return uiDefIconBut(block, type|CHA, retval, icon, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
+	return uiDefIconBut(block, type | CHA, retval, icon, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
 }
 uiBut *uiDefIconButBitC(uiBlock *block, int type, int bit, int retval, int icon, int x1, int y1, short x2, short y2, char *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	return uiDefIconButBit(block, type|CHA, bit, retval, icon, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
+	return uiDefIconButBit(block, type | CHA, bit, retval, icon, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
 }
 uiBut *uiDefIconButR(uiBlock *block, int type, int retval, int icon, int x1, int y1, short x2, short y2, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2,  const char *tip)
 {
 	uiBut *but;
-	but= ui_def_but_rna_propname(block, type, retval, "", x1, y1, x2, y2, ptr, propname, index, min, max, a1, a2, tip);
+	but = ui_def_but_rna_propname(block, type, retval, "", x1, y1, x2, y2, ptr, propname, index, min, max, a1, a2, tip);
 	ui_check_but_and_iconize(but, icon);
 	return but;
 }
 uiBut *uiDefIconButR_prop(uiBlock *block, int type, int retval, int icon, int x1, int y1, short x2, short y2, PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, float a1, float a2,  const char *tip)
 {
 	uiBut *but;
-	but= ui_def_but_rna(block, type, retval, "", x1, y1, x2, y2, ptr, prop, index, min, max, a1, a2, tip);
+	but = ui_def_but_rna(block, type, retval, "", x1, y1, x2, y2, ptr, prop, index, min, max, a1, a2, tip);
 	ui_check_but_and_iconize(but, icon);
 	return but;
 }
@@ -3134,7 +3147,7 @@ uiBut *uiDefIconButR_prop(uiBlock *block, int type, int retval, int icon, int x1
 uiBut *uiDefIconButO_ptr(uiBlock *block, int type, wmOperatorType *ot, int opcontext, int icon, int x1, int y1, short x2, short y2, const char *tip)
 {
 	uiBut *but;
-	but= ui_def_but_operator_ptr(block, type, ot, opcontext, "", x1, y1, x2, y2, tip);
+	but = ui_def_but_operator_ptr(block, type, ot, opcontext, "", x1, y1, x2, y2, tip);
 	ui_check_but_and_iconize(but, icon);
 	return but;
 }
@@ -3147,75 +3160,76 @@ uiBut *uiDefIconButO(uiBlock *block, int type, const char *opname, int opcontext
 /* Button containing both string label and icon */
 uiBut *uiDefIconTextBut(uiBlock *block, int type, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, void *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	uiBut *but= ui_def_but(block, type, retval, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
+	uiBut *but = ui_def_but(block, type, retval, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
 	ui_check_but_and_iconize(but, icon);
-	but->flag|= UI_ICON_LEFT;
+	but->flag |= UI_ICON_LEFT;
 	return but;
 }
 static uiBut *uiDefIconTextButBit(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, void *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	int bitIdx= findBitIndex(bit);
-	if (bitIdx==-1) {
+	int bitIdx = findBitIndex(bit);
+	if (bitIdx == -1) {
 		return NULL;
-	} else {
-		return uiDefIconTextBut(block, type|BIT|bitIdx, retval, icon, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
+	}
+	else {
+		return uiDefIconTextBut(block, type | BIT | bitIdx, retval, icon, str, x1, y1, x2, y2, poin, min, max, a1, a2, tip);
 	}
 }
 
 uiBut *uiDefIconTextButF(uiBlock *block, int type, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, float *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	return uiDefIconTextBut(block, type|FLO, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
+	return uiDefIconTextBut(block, type | FLO, retval, icon, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
 }
 uiBut *uiDefIconTextButBitF(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, float *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	return uiDefIconTextButBit(block, type|FLO, bit, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
+	return uiDefIconTextButBit(block, type | FLO, bit, retval, icon, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
 }
 uiBut *uiDefIconTextButI(uiBlock *block, int type, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, int *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	return uiDefIconTextBut(block, type|INT, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
+	return uiDefIconTextBut(block, type | INT, retval, icon, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
 }
 uiBut *uiDefIconTextButBitI(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, int *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	return uiDefIconTextButBit(block, type|INT, bit, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
+	return uiDefIconTextButBit(block, type | INT, bit, retval, icon, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
 }
 uiBut *uiDefIconTextButS(uiBlock *block, int type, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, short *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	return uiDefIconTextBut(block, type|SHO, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
+	return uiDefIconTextBut(block, type | SHO, retval, icon, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
 }
 uiBut *uiDefIconTextButBitS(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, short *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	return uiDefIconTextButBit(block, type|SHO, bit, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
+	return uiDefIconTextButBit(block, type | SHO, bit, retval, icon, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
 }
 uiBut *uiDefIconTextButC(uiBlock *block, int type, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, char *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	return uiDefIconTextBut(block, type|CHA, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
+	return uiDefIconTextBut(block, type | CHA, retval, icon, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
 }
 uiBut *uiDefIconTextButBitC(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, char *poin, float min, float max, float a1, float a2,  const char *tip)
 {
-	return uiDefIconTextButBit(block, type|CHA, bit, retval, icon, str, x1, y1, x2, y2, (void*) poin, min, max, a1, a2, tip);
+	return uiDefIconTextButBit(block, type | CHA, bit, retval, icon, str, x1, y1, x2, y2, (void *) poin, min, max, a1, a2, tip);
 }
 uiBut *uiDefIconTextButR(uiBlock *block, int type, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2,  const char *tip)
 {
 	uiBut *but;
-	but= ui_def_but_rna_propname(block, type, retval, str, x1, y1, x2, y2, ptr, propname, index, min, max, a1, a2, tip);
+	but = ui_def_but_rna_propname(block, type, retval, str, x1, y1, x2, y2, ptr, propname, index, min, max, a1, a2, tip);
 	ui_check_but_and_iconize(but, icon);
-	but->flag|= UI_ICON_LEFT;
+	but->flag |= UI_ICON_LEFT;
 	return but;
 }
 uiBut *uiDefIconTextButR_prop(uiBlock *block, int type, int retval, int icon, const char *str, int x1, int y1, short x2, short y2, PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, float a1, float a2,  const char *tip)
 {
 	uiBut *but;
-	but= ui_def_but_rna(block, type, retval, str, x1, y1, x2, y2, ptr, prop, index, min, max, a1, a2, tip);
+	but = ui_def_but_rna(block, type, retval, str, x1, y1, x2, y2, ptr, prop, index, min, max, a1, a2, tip);
 	ui_check_but_and_iconize(but, icon);
-	but->flag|= UI_ICON_LEFT;
+	but->flag |= UI_ICON_LEFT;
 	return but;
 }
 uiBut *uiDefIconTextButO_ptr(uiBlock *block, int type, wmOperatorType *ot, int opcontext, int icon, const char *str, int x1, int y1, short x2, short y2, const char *tip)
 {
 	uiBut *but;
-	but= ui_def_but_operator_ptr(block, type, ot, opcontext, str, x1, y1, x2, y2, tip);
+	but = ui_def_but_operator_ptr(block, type, ot, opcontext, str, x1, y1, x2, y2, tip);
 	ui_check_but_and_iconize(but, icon);
-	but->flag|= UI_ICON_LEFT;
+	but->flag |= UI_ICON_LEFT;
 	return but;
 }
 uiBut *uiDefIconTextButO(uiBlock *block, int type, const char *opname, int opcontext, int icon, const char *str, int x1, int y1, short x2, short y2, const char *tip)
@@ -3230,13 +3244,13 @@ void uiSetButLink(uiBut *but, void **poin, void ***ppoin, short *tot, int from,
 {
 	uiLink *link;
 	
-	link= but->link= MEM_callocN(sizeof(uiLink), "new uilink");
+	link = but->link = MEM_callocN(sizeof(uiLink), "new uilink");
 	
-	link->poin= poin;
-	link->ppoin= ppoin;
-	link->totlink= tot;
-	link->fromcode= from;
-	link->tocode= to;
+	link->poin = poin;
+	link->ppoin = ppoin;
+	link->totlink = tot;
+	link->fromcode = from;
+	link->tocode = to;
 }
 
 /* cruft to make uiBlock and uiBut private */
@@ -3244,18 +3258,18 @@ void uiSetButLink(uiBut *but, void **poin, void ***ppoin, short *tot, int from,
 int uiBlocksGetYMin(ListBase *lb)
 {
 	uiBlock *block;
-	int min= 0;
+	int min = 0;
 	
-	for (block= lb->first; block; block= block->next)
-		if (block==lb->first || block->miny<min)
-			min= block->miny;
+	for (block = lb->first; block; block = block->next)
+		if (block == lb->first || block->miny < min)
+			min = block->miny;
 			
 	return min;
 }
 
 void uiBlockSetDirection(uiBlock *block, int direction)
 {
-	block->direction= direction;
+	block->direction = direction;
 }
 
 /* this call escapes if there's alignment flags */
@@ -3263,62 +3277,62 @@ void uiBlockFlipOrder(uiBlock *block)
 {
 	ListBase lb;
 	uiBut *but, *next;
-	float centy, miny=10000, maxy= -10000;
+	float centy, miny = 10000, maxy = -10000;
 
-	if(U.uiflag & USER_MENUFIXEDORDER)
+	if (U.uiflag & USER_MENUFIXEDORDER)
 		return;
-	else if(block->flag & UI_BLOCK_NO_FLIP)
+	else if (block->flag & UI_BLOCK_NO_FLIP)
 		return;
 	
-	for(but= block->buttons.first; but; but= but->next) {
-		if(but->flag & UI_BUT_ALIGN) return;
-		if(but->y1 < miny) miny= but->y1;
-		if(but->y2 > maxy) maxy= but->y2;
+	for (but = block->buttons.first; but; but = but->next) {
+		if (but->flag & UI_BUT_ALIGN) return;
+		if (but->y1 < miny) miny = but->y1;
+		if (but->y2 > maxy) maxy = but->y2;
 	}
 	/* mirror trick */
-	centy= (miny+maxy)/2.0f;
-	for(but= block->buttons.first; but; but= but->next) {
-		but->y1 = centy-(but->y1-centy);
-		but->y2 = centy-(but->y2-centy);
+	centy = (miny + maxy) / 2.0f;
+	for (but = block->buttons.first; but; but = but->next) {
+		but->y1 = centy - (but->y1 - centy);
+		but->y2 = centy - (but->y2 - centy);
 		SWAP(float, but->y1, but->y2);
 	}
 	
 	/* also flip order in block itself, for example for arrowkey */
-	lb.first= lb.last= NULL;
-	but= block->buttons.first;
-	while(but) {
-		next= but->next;
+	lb.first = lb.last = NULL;
+	but = block->buttons.first;
+	while (but) {
+		next = but->next;
 		BLI_remlink(&block->buttons, but);
 		BLI_addtail(&lb, but);
-		but= next;
+		but = next;
 	}
-	block->buttons= lb;
+	block->buttons = lb;
 }
 
 
 void uiBlockSetFlag(uiBlock *block, int flag)
 {
-	block->flag|= flag;
+	block->flag |= flag;
 }
 
 void uiBlockClearFlag(uiBlock *block, int flag)
 {
-	block->flag&= ~flag;
+	block->flag &= ~flag;
 }
 
 void uiBlockSetXOfs(uiBlock *block, int xofs)
 {
-	block->xofs= xofs;
+	block->xofs = xofs;
 }
 
 void uiButSetFlag(uiBut *but, int flag)
 {
-	but->flag|= flag;
+	but->flag |= flag;
 }
 
 void uiButClearFlag(uiBut *but, int flag)
 {
-	but->flag&= ~flag;
+	but->flag &= ~flag;
 }
 
 int uiButGetRetVal(uiBut *but)
@@ -3328,47 +3342,47 @@ int uiButGetRetVal(uiBut *but)
 
 void uiButSetDragID(uiBut *but, ID *id)
 {
-	but->dragtype= WM_DRAG_ID;
-	but->dragpoin= (void *)id;
+	but->dragtype = WM_DRAG_ID;
+	but->dragpoin = (void *)id;
 }
 
 void uiButSetDragRNA(uiBut *but, PointerRNA *ptr)
 {
-	but->dragtype= WM_DRAG_RNA;
-	but->dragpoin= (void *)ptr;
+	but->dragtype = WM_DRAG_RNA;
+	but->dragpoin = (void *)ptr;
 }
 
 void uiButSetDragPath(uiBut *but, const char *path)
 {
-	but->dragtype= WM_DRAG_PATH;
-	but->dragpoin= (void *)path;
+	but->dragtype = WM_DRAG_PATH;
+	but->dragpoin = (void *)path;
 }
 
 void uiButSetDragName(uiBut *but, const char *name)
 {
-	but->dragtype= WM_DRAG_NAME;
-	but->dragpoin= (void *)name;
+	but->dragtype = WM_DRAG_NAME;
+	but->dragpoin = (void *)name;
 }
 
 /* value from button itself */
 void uiButSetDragValue(uiBut *but)
 {
-	but->dragtype= WM_DRAG_VALUE;
+	but->dragtype = WM_DRAG_VALUE;
 }
 
 void uiButSetDragImage(uiBut *but, const char *path, int icon, struct ImBuf *imb, float scale)
 {
-	but->dragtype= WM_DRAG_PATH;
-	but->icon= icon; /* no flag UI_HAS_ICON, so icon doesnt draw in button */
-	but->dragpoin= (void *)path;
-	but->imb= imb;
-	but->imb_scale= scale;
+	but->dragtype = WM_DRAG_PATH;
+	but->icon = icon; /* no flag UI_HAS_ICON, so icon doesnt draw in button */
+	but->dragpoin = (void *)path;
+	but->imb = imb;
+	but->imb_scale = scale;
 }
 
 PointerRNA *uiButGetOperatorPtrRNA(uiBut *but)
 {
-	if(but->optype && !but->opptr) {
-		but->opptr= MEM_callocN(sizeof(PointerRNA), "uiButOpPtr");
+	if (but->optype && !but->opptr) {
+		but->opptr = MEM_callocN(sizeof(PointerRNA), "uiButOpPtr");
 		WM_operator_properties_create_ptr(but->opptr, but->optype);
 	}
 
@@ -3377,14 +3391,14 @@ PointerRNA *uiButGetOperatorPtrRNA(uiBut *but)
 
 void uiButSetUnitType(uiBut *but, const int unit_type)
 {
-	but->unit_type= (unsigned char)(unit_type>>16);
+	but->unit_type = (unsigned char)(RNA_SUBTYPE_UNIT_VALUE(unit_type));
 }
 
 int uiButGetUnitType(uiBut *but)
 {
 	int ownUnit = (int)but->unit_type;
 	
-	/* own unit define always takes precidence over RNA provided, allowing for overriding 
+	/* own unit define always takes precedence over RNA provided, allowing for overriding 
 	 * default value provided in RNA in a few special cases (i.e. Active Keyframe in Graph Edit)
 	 */
 	// XXX: this doesn't allow clearing unit completely, though the same could be said for icons
@@ -3398,21 +3412,21 @@ int uiButGetUnitType(uiBut *but)
 
 void uiBlockSetHandleFunc(uiBlock *block, uiBlockHandleFunc func, void *arg)
 {
-	block->handle_func= func;
-	block->handle_func_arg= arg;
+	block->handle_func = func;
+	block->handle_func_arg = arg;
 }
 
 void uiBlockSetButmFunc(uiBlock *block, uiMenuHandleFunc func, void *arg)
 {
-	block->butm_func= func;
-	block->butm_func_arg= arg;
+	block->butm_func = func;
+	block->butm_func_arg = arg;
 }
 
 void uiBlockSetFunc(uiBlock *block, uiButHandleFunc func, void *arg1, void *arg2)
 {
-	block->func= func;
-	block->func_arg1= arg1;
-	block->func_arg2= arg2;
+	block->func = func;
+	block->func_arg1 = arg1;
+	block->func_arg2 = arg2;
 }
 
 void uiBlockSetNFunc(uiBlock *block, uiButHandleFunc func, void *argN, void *arg2)
@@ -3421,29 +3435,29 @@ void uiBlockSetNFunc(uiBlock *block, uiButHandleFunc func, void *argN, void *arg
 		MEM_freeN(block->func_argN);
 	}
 
-	block->funcN= func;
-	block->func_argN= argN;
-	block->func_arg2= arg2;
+	block->funcN = func;
+	block->func_argN = argN;
+	block->func_arg2 = arg2;
 }
 
 void uiButSetRenameFunc(uiBut *but, uiButHandleRenameFunc func, void *arg1)
 {
-	but->rename_func= func;
-	but->rename_arg1= arg1;
+	but->rename_func = func;
+	but->rename_arg1 = arg1;
 }
 
 void uiBlockSetDrawExtraFunc(uiBlock *block, void (*func)(const bContext *C, void *idv, void *arg1, void *arg2, rcti *rect), void *arg1, void *arg2)
 {
-	block->drawextra= func;
-	block->drawextra_arg1= arg1;
-	block->drawextra_arg2= arg2;
+	block->drawextra = func;
+	block->drawextra_arg1 = arg1;
+	block->drawextra_arg2 = arg2;
 }
 
 void uiButSetFunc(uiBut *but, uiButHandleFunc func, void *arg1, void *arg2)
 {
-	but->func= func;
-	but->func_arg1= arg1;
-	but->func_arg2= arg2;
+	but->func = func;
+	but->func_arg1 = arg1;
+	but->func_arg2 = arg2;
 }
 
 void uiButSetNFunc(uiBut *but, uiButHandleNFunc funcN, void *argN, void *arg2)
@@ -3452,25 +3466,25 @@ void uiButSetNFunc(uiBut *but, uiButHandleNFunc funcN, void *argN, void *arg2)
 		MEM_freeN(but->func_argN);
 	}
 
-	but->funcN= funcN;
-	but->func_argN= argN;
-	but->func_arg2= arg2;
+	but->funcN = funcN;
+	but->func_argN = argN;
+	but->func_arg2 = arg2;
 }
 
 void uiButSetCompleteFunc(uiBut *but, uiButCompleteFunc func, void *arg)
 {
-	but->autocomplete_func= func;
-	but->autofunc_arg= arg;
+	but->autocomplete_func = func;
+	but->autofunc_arg = arg;
 }
 
 uiBut *uiDefIDPoinBut(uiBlock *block, uiIDPoinFuncFP func, short blocktype, int retval, const char *str, int x1, int y1, short x2, short y2, void *idpp, const char *tip)
 {
-	uiBut *but= ui_def_but(block, IDPOIN, retval, str, x1, y1, x2, y2, NULL, 0.0, 0.0, 0.0, 0.0, tip);
-	but->idpoin_func= func;
-	but->idpoin_idpp= (ID**) idpp;
+	uiBut *but = ui_def_but(block, IDPOIN, retval, str, x1, y1, x2, y2, NULL, 0.0, 0.0, 0.0, 0.0, tip);
+	but->idpoin_func = func;
+	but->idpoin_idpp = (ID **) idpp;
 	ui_check_but(but);
 	
-	if(blocktype)
+	if (blocktype)
 		uiButSetCompleteFunc(but, autocomplete_id, (void *)(intptr_t)blocktype);
 
 	return but;
@@ -3478,20 +3492,20 @@ uiBut *uiDefIDPoinBut(uiBlock *block, uiIDPoinFuncFP func, short blocktype, int
 
 uiBut *uiDefBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, const char *str, int x1, int y1, short x2, short y2, const char *tip)
 {
-	uiBut *but= ui_def_but(block, BLOCK, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
-	but->block_create_func= func;
+	uiBut *but = ui_def_but(block, BLOCK, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
+	but->block_create_func = func;
 	ui_check_but(but);
 	return but;
 }
 
 uiBut *uiDefBlockButN(uiBlock *block, uiBlockCreateFunc func, void *argN, const char *str, int x1, int y1, short x2, short y2, const char *tip)
 {
-	uiBut *but= ui_def_but(block, BLOCK, 0, str, x1, y1, x2, y2, NULL, 0.0, 0.0, 0.0, 0.0, tip);
-	but->block_create_func= func;
+	uiBut *but = ui_def_but(block, BLOCK, 0, str, x1, y1, x2, y2, NULL, 0.0, 0.0, 0.0, 0.0, tip);
+	but->block_create_func = func;
 	if (but->func_argN) {
 		MEM_freeN(but->func_argN);
 	}
-	but->func_argN= argN;
+	but->func_argN = argN;
 	ui_check_but(but);
 	return but;
 }
@@ -3499,31 +3513,31 @@ uiBut *uiDefBlockButN(uiBlock *block, uiBlockCreateFunc func, void *argN, const
 
 uiBut *uiDefPulldownBut(uiBlock *block, uiBlockCreateFunc func, void *arg, const char *str, int x1, int y1, short x2, short y2, const char *tip)
 {
-	uiBut *but= ui_def_but(block, PULLDOWN, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
-	but->block_create_func= func;
+	uiBut *but = ui_def_but(block, PULLDOWN, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
+	but->block_create_func = func;
 	ui_check_but(but);
 	return but;
 }
 
 uiBut *uiDefMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, const char *str, int x1, int y1, short x2, short y2, const char *tip)
 {
-	uiBut *but= ui_def_but(block, PULLDOWN, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
-	but->menu_create_func= func;
+	uiBut *but = ui_def_but(block, PULLDOWN, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
+	but->menu_create_func = func;
 	ui_check_but(but);
 	return but;
 }
 
 uiBut *uiDefIconTextMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, const char *str, int x1, int y1, short x2, short y2, const char *tip)
 {
-	uiBut *but= ui_def_but(block, PULLDOWN, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
+	uiBut *but = ui_def_but(block, PULLDOWN, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
 
-	but->icon= (BIFIconID) icon;
-	but->flag|= UI_HAS_ICON;
+	but->icon = (BIFIconID) icon;
+	but->flag |= UI_HAS_ICON;
 
-	but->flag|= UI_ICON_LEFT;
-	but->flag|= UI_ICON_SUBMENU;
+	but->flag |= UI_ICON_LEFT;
+	but->flag |= UI_ICON_SUBMENU;
 
-	but->menu_create_func= func;
+	but->menu_create_func = func;
 	ui_check_but(but);
 
 	return but;
@@ -3531,13 +3545,13 @@ uiBut *uiDefIconTextMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, in
 
 uiBut *uiDefIconMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, int x1, int y1, short x2, short y2, const char *tip)
 {
-	uiBut *but= ui_def_but(block, PULLDOWN, 0, "", x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
+	uiBut *but = ui_def_but(block, PULLDOWN, 0, "", x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
 
-	but->icon= (BIFIconID) icon;
+	but->icon = (BIFIconID) icon;
 	but->flag |= UI_HAS_ICON;
-	but->flag &=~ UI_ICON_LEFT;
+	but->flag &= ~UI_ICON_LEFT;
 
-	but->menu_create_func= func;
+	but->menu_create_func = func;
 	ui_check_but(but);
 
 	return but;
@@ -3546,17 +3560,17 @@ uiBut *uiDefIconMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int ic
 /* Block button containing both string label and icon */
 uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int icon, const char *str, int x1, int y1, short x2, short y2, const char *tip)
 {
-	uiBut *but= ui_def_but(block, BLOCK, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
+	uiBut *but = ui_def_but(block, BLOCK, 0, str, x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
 	
 	/* XXX temp, old menu calls pass on icon arrow, which is now UI_ICON_SUBMENU flag */
-	if(icon!=ICON_RIGHTARROW_THIN) {
-		but->icon= (BIFIconID) icon;
-		but->flag|= UI_ICON_LEFT;
+	if (icon != ICON_RIGHTARROW_THIN) {
+		but->icon = (BIFIconID) icon;
+		but->flag |= UI_ICON_LEFT;
 	}
-	but->flag|= UI_HAS_ICON;
-	but->flag|= UI_ICON_SUBMENU;
+	but->flag |= UI_HAS_ICON;
+	but->flag |= UI_ICON_SUBMENU;
 
-	but->block_create_func= func;
+	but->block_create_func = func;
 	ui_check_but(but);
 	
 	return but;
@@ -3565,14 +3579,14 @@ uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg,
 /* Block button containing icon */
 uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int retval, int icon, int x1, int y1, short x2, short y2, const char *tip)
 {
-	uiBut *but= ui_def_but(block, BLOCK, retval, "", x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
+	uiBut *but = ui_def_but(block, BLOCK, retval, "", x1, y1, x2, y2, arg, 0.0, 0.0, 0.0, 0.0, tip);
 	
-	but->icon= (BIFIconID) icon;
-	but->flag|= UI_HAS_ICON;
+	but->icon = (BIFIconID) icon;
+	but->flag |= UI_HAS_ICON;
 	
-	but->flag|= UI_ICON_LEFT;
+	but->flag |= UI_ICON_LEFT;
 	
-	but->block_create_func= func;
+	but->block_create_func = func;
 	ui_check_but(but);
 	
 	return but;
@@ -3580,7 +3594,7 @@ uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int
 
 uiBut *uiDefKeyevtButS(uiBlock *block, int retval, const char *str, int x1, int y1, short x2, short y2, short *spoin, const char *tip)
 {
-	uiBut *but= ui_def_but(block, KEYEVT|SHO, retval, str, x1, y1, x2, y2, spoin, 0.0, 0.0, 0.0, 0.0, tip);
+	uiBut *but = ui_def_but(block, KEYEVT | SHO, retval, str, x1, y1, x2, y2, spoin, 0.0, 0.0, 0.0, 0.0, tip);
 	ui_check_but(but);
 	return but;
 }
@@ -3589,8 +3603,8 @@ uiBut *uiDefKeyevtButS(uiBlock *block, int retval, const char *str, int x1, int
 /* modkeypoin will be set to KM_SHIFT, KM_ALT, KM_CTRL, KM_OSKEY bits */
 uiBut *uiDefHotKeyevtButS(uiBlock *block, int retval, const char *str, int x1, int y1, short x2, short y2, short *keypoin, short *modkeypoin, const char *tip)
 {
-	uiBut *but= ui_def_but(block, HOTKEYEVT|SHO, retval, str, x1, y1, x2, y2, keypoin, 0.0, 0.0, 0.0, 0.0, tip);
-	but->modifier_key= *modkeypoin;
+	uiBut *but = ui_def_but(block, HOTKEYEVT | SHO, retval, str, x1, y1, x2, y2, keypoin, 0.0, 0.0, 0.0, 0.0, tip);
+	but->modifier_key = *modkeypoin;
 	ui_check_but(but);
 	return but;
 }
@@ -3600,12 +3614,12 @@ uiBut *uiDefHotKeyevtButS(uiBlock *block, int retval, const char *str, int x1, i
 /* here a1 and a2, if set, control thumbnail preview rows/cols */
 uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxlen, int x1, int y1, short x2, short y2, float a1, float a2, const char *tip)
 {
-	uiBut *but= ui_def_but(block, SEARCH_MENU, retval, "", x1, y1, x2, y2, arg, 0.0, maxlen, a1, a2, tip);
+	uiBut *but = ui_def_but(block, SEARCH_MENU, retval, "", x1, y1, x2, y2, arg, 0.0, maxlen, a1, a2, tip);
 	
-	but->icon= (BIFIconID) icon;
-	but->flag|= UI_HAS_ICON;
+	but->icon = (BIFIconID) icon;
+	but->flag |= UI_HAS_ICON;
 	
-	but->flag|= UI_ICON_LEFT|UI_TEXT_LEFT;
+	but->flag |= UI_ICON_LEFT | UI_TEXT_LEFT;
 	
 	ui_check_but(but);
 	
@@ -3617,15 +3631,15 @@ uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxle
 /* if active set, button opens with this item visible and selected */
 void uiButSetSearchFunc(uiBut *but, uiButSearchFunc sfunc, void *arg, uiButHandleFunc bfunc, void *active)
 {
-	but->search_func= sfunc;
-	but->search_arg= arg;
+	but->search_func = sfunc;
+	but->search_arg = arg;
 	
 	uiButSetFunc(but, bfunc, arg, active);
 	
 	/* search buttons show red-alert if item doesn't exist, not for menus */
-	if(0==(but->block->flag & UI_BLOCK_LOOP)) {
+	if (0 == (but->block->flag & UI_BLOCK_LOOP)) {
 		/* skip empty buttons, not all buttons need input, we only show invalid */
-		if(but->drawstr[0])
+		if (but->drawstr[0])
 			ui_but_search_test(but);
 	}
 }
@@ -3637,11 +3651,11 @@ void uiButSetFocusOnEnter(wmWindow *win, uiBut *but)
 {
 	wmEvent event;
 	
-	event= *(win->eventstate);
-	event.type= EVT_BUT_OPEN;
-	event.val= KM_PRESS;
-	event.customdata= but;
-	event.customdatafree= FALSE;
+	event = *(win->eventstate);
+	event.type = EVT_BUT_OPEN;
+	event.val = KM_PRESS;
+	event.customdata = but;
+	event.customdatafree = FALSE;
 	
 	wm_event_add(win, &event);
 }
diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c
index 5e095ba..c7f8ad5 100644
--- a/source/blender/editors/interface/interface_anim.c
+++ b/source/blender/editors/interface/interface_anim.c
@@ -65,15 +65,15 @@ void ui_but_anim_flag(uiBut *but, float cfra)
 	FCurve *fcu;
 	int driven;
 
-	but->flag &= ~(UI_BUT_ANIMATED|UI_BUT_ANIMATED_KEY|UI_BUT_DRIVEN);
+	but->flag &= ~(UI_BUT_ANIMATED | UI_BUT_ANIMATED_KEY | UI_BUT_DRIVEN);
 
-	fcu= ui_but_get_fcurve(but, NULL, &driven);
+	fcu = ui_but_get_fcurve(but, NULL, &driven);
 
-	if(fcu) {
-		if(!driven) {
+	if (fcu) {
+		if (!driven) {
 			but->flag |= UI_BUT_ANIMATED;
 			
-			if(fcurve_frame_has_keyframe(fcu, cfra, 0))
+			if (fcurve_frame_has_keyframe(fcu, cfra, 0))
 				but->flag |= UI_BUT_ANIMATED_KEY;
 		}
 		else {
@@ -88,12 +88,12 @@ int ui_but_anim_expression_get(uiBut *but, char *str, size_t maxlen)
 	ChannelDriver *driver;
 	int driven;
 
-	fcu= ui_but_get_fcurve(but, NULL, &driven);
+	fcu = ui_but_get_fcurve(but, NULL, &driven);
 
-	if(fcu && driven) {
-		driver= fcu->driver;
+	if (fcu && driven) {
+		driver = fcu->driver;
 
-		if(driver && driver->type == DRIVER_TYPE_PYTHON) {
+		if (driver && driver->type == DRIVER_TYPE_PYTHON) {
 			BLI_strncpy(str, driver->expression, maxlen);
 			return 1;
 		}
@@ -108,15 +108,15 @@ int ui_but_anim_expression_set(uiBut *but, const char *str)
 	ChannelDriver *driver;
 	int driven;
 
-	fcu= ui_but_get_fcurve(but, NULL, &driven);
+	fcu = ui_but_get_fcurve(but, NULL, &driven);
 
-	if(fcu && driven) {
-		driver= fcu->driver;
+	if (fcu && driven) {
+		driver = fcu->driver;
 		
-		if(driver && driver->type == DRIVER_TYPE_PYTHON) {
+		if (driver && driver->type == DRIVER_TYPE_PYTHON) {
 			BLI_strncpy_utf8(driver->expression, str, sizeof(driver->expression));
 			driver->flag |= DRIVER_FLAG_RECOMPILE;
-			WM_event_add_notifier(but->block->evil_C, NC_ANIMATION|ND_KEYFRAME, NULL);
+			WM_event_add_notifier(but->block->evil_C, NC_ANIMATION | ND_KEYFRAME, NULL);
 			return 1;
 		}
 	}
@@ -131,11 +131,11 @@ int ui_but_anim_expression_create(uiBut *but, const char *str)
 	ID *id;
 	FCurve *fcu;
 	char *path;
-	short ok=0;
+	short ok = 0;
 	
 	/* button must have RNA-pointer to a numeric-capable property */
 	if (ELEM(NULL, but->rnapoin.data, but->rnaprop)) {
-		if (G.f & G_DEBUG) 
+		if (G.debug & G_DEBUG)
 			printf("ERROR: create expression failed - button has no RNA info attached\n");
 		return 0;
 	}
@@ -143,8 +143,8 @@ int ui_but_anim_expression_create(uiBut *but, const char *str)
 	/* make sure we have animdata for this */
 	// FIXME: until materials can be handled by depsgraph, don't allow drivers to be created for them
 	id = (ID *)but->rnapoin.id.data;
-	if ((id == NULL) || (GS(id->name)==ID_MA) || (GS(id->name)==ID_TE)) {
-		if (G.f & G_DEBUG)
+	if ((id == NULL) || (GS(id->name) == ID_MA) || (GS(id->name) == ID_TE)) {
+		if (G.debug & G_DEBUG)
 			printf("ERROR: create expression failed - invalid id-datablock for adding drivers (%p)\n", id);
 		return 0;
 	}
@@ -155,7 +155,7 @@ int ui_but_anim_expression_create(uiBut *but, const char *str)
 	/* create driver */
 	fcu = verify_driver_fcurve(id, path, but->rnaindex, 1);
 	if (fcu) {
-		ChannelDriver *driver= fcu->driver;
+		ChannelDriver *driver = fcu->driver;
 		
 		if (driver) {
 			/* set type of driver */
@@ -167,7 +167,7 @@ int ui_but_anim_expression_create(uiBut *but, const char *str)
 
 			/* updates */
 			driver->flag |= DRIVER_FLAG_RECOMPILE;
-			WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME, NULL);
+			WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME, NULL);
 		}
 	}
 	
@@ -183,19 +183,19 @@ void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra)
 	FCurve *fcu;
 	int driven;
 
-	fcu= ui_but_get_fcurve(but, &action, &driven);
+	fcu = ui_but_get_fcurve(but, &action, &driven);
 
-	if(fcu && !driven) {
-		id= but->rnapoin.id.data;
+	if (fcu && !driven) {
+		id = but->rnapoin.id.data;
 		
 		// TODO: this should probably respect the keyingset only option for anim
-		if(autokeyframe_cfra_can_key(scene, id)) {
+		if (autokeyframe_cfra_can_key(scene, id)) {
 			ReportList *reports = CTX_wm_reports(C);
 			short flag = ANIM_get_keyframing_flags(scene, 1);
 			
 			fcu->flag &= ~FCURVE_SELECTED;
-			insert_keyframe(reports, id, action, ((fcu->grp)?(fcu->grp->name):(NULL)), fcu->rna_path, fcu->array_index, cfra, flag);
-			WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
+			insert_keyframe(reports, id, action, ((fcu->grp) ? (fcu->grp->name) : (NULL)), fcu->rna_path, fcu->array_index, cfra, flag);
+			WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
 		}
 	}
 }
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 93cb0f8..91d3c89 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -58,16 +58,16 @@
 /* own include */
 #include "interface_intern.h"
 
-#define UI_DISABLED_ALPHA_OFFS	-160
+#define UI_DISABLED_ALPHA_OFFS  -160
 
-static int roundboxtype= UI_CNR_ALL;
+static int roundboxtype = UI_CNR_ALL;
 
 void uiSetRoundBox(int type)
 {
 	/* Not sure the roundbox function is the best place to change this
 	 * if this is undone, its not that big a deal, only makes curves edges
 	 * square for the  */
-	roundboxtype= type;
+	roundboxtype = type;
 	
 }
 
@@ -78,54 +78,54 @@ int uiGetRoundBox(void)
 
 void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float rad)
 {
-	float vec[7][2]= {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
-					  {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
+	float vec[7][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
+					   {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
 	int a;
 	
 	/* mult */
-	for(a=0; a<7; a++) {
-		vec[a][0]*= rad; vec[a][1]*= rad;
+	for (a = 0; a < 7; a++) {
+		vec[a][0] *= rad; vec[a][1] *= rad;
 	}
 
 	glBegin(mode);
 
 	/* start with corner right-bottom */
-	if(roundboxtype & UI_CNR_BOTTOM_RIGHT) {
-		glVertex2f(maxx-rad, miny);
-		for(a=0; a<7; a++) {
-			glVertex2f(maxx-rad+vec[a][0], miny+vec[a][1]);
+	if (roundboxtype & UI_CNR_BOTTOM_RIGHT) {
+		glVertex2f(maxx - rad, miny);
+		for (a = 0; a < 7; a++) {
+			glVertex2f(maxx - rad + vec[a][0], miny + vec[a][1]);
 		}
-		glVertex2f(maxx, miny+rad);
+		glVertex2f(maxx, miny + rad);
 	}
 	else glVertex2f(maxx, miny);
 	
 	/* corner right-top */
-	if(roundboxtype & UI_CNR_TOP_RIGHT) {
-		glVertex2f(maxx, maxy-rad);
-		for(a=0; a<7; a++) {
-			glVertex2f(maxx-vec[a][1], maxy-rad+vec[a][0]);
+	if (roundboxtype & UI_CNR_TOP_RIGHT) {
+		glVertex2f(maxx, maxy - rad);
+		for (a = 0; a < 7; a++) {
+			glVertex2f(maxx - vec[a][1], maxy - rad + vec[a][0]);
 		}
-		glVertex2f(maxx-rad, maxy);
+		glVertex2f(maxx - rad, maxy);
 	}
 	else glVertex2f(maxx, maxy);
 	
 	/* corner left-top */
-	if(roundboxtype & UI_CNR_TOP_LEFT) {
-		glVertex2f(minx+rad, maxy);
-		for(a=0; a<7; a++) {
-			glVertex2f(minx+rad-vec[a][0], maxy-vec[a][1]);
+	if (roundboxtype & UI_CNR_TOP_LEFT) {
+		glVertex2f(minx + rad, maxy);
+		for (a = 0; a < 7; a++) {
+			glVertex2f(minx + rad - vec[a][0], maxy - vec[a][1]);
 		}
-		glVertex2f(minx, maxy-rad);
+		glVertex2f(minx, maxy - rad);
 	}
 	else glVertex2f(minx, maxy);
 	
 	/* corner left-bottom */
-	if(roundboxtype & UI_CNR_BOTTOM_LEFT) {
-		glVertex2f(minx, miny+rad);
-		for(a=0; a<7; a++) {
-			glVertex2f(minx+vec[a][1], miny+rad-vec[a][0]);
+	if (roundboxtype & UI_CNR_BOTTOM_LEFT) {
+		glVertex2f(minx, miny + rad);
+		for (a = 0; a < 7; a++) {
+			glVertex2f(minx + vec[a][1], miny + rad - vec[a][0]);
 		}
-		glVertex2f(minx+rad, miny);
+		glVertex2f(minx + rad, miny);
 	}
 	else glVertex2f(minx, miny);
 	
@@ -136,9 +136,9 @@ static void round_box_shade_col(const float col1[3], float const col2[3], const
 {
 	float col[3];
 
-	col[0]= (fac*col1[0] + (1.0f-fac)*col2[0]);
-	col[1]= (fac*col1[1] + (1.0f-fac)*col2[1]);
-	col[2]= (fac*col1[2] + (1.0f-fac)*col2[2]);
+	col[0] = (fac * col1[0] + (1.0f - fac) * col2[0]);
+	col[1] = (fac * col1[1] + (1.0f - fac) * col2[1]);
+	col[2] = (fac * col1[2] + (1.0f - fac) * col2[2]);
 	glColor3fv(col);
 }
 
@@ -146,44 +146,44 @@ static void round_box_shade_col(const float col1[3], float const col2[3], const
 /* view2d scrollers use it */
 void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown)
 {
-	float vec[7][2]= {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
-					  {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
-	const float div= maxy - miny;
-	const float idiv= 1.0f / div;
+	float vec[7][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
+					   {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
+	const float div = maxy - miny;
+	const float idiv = 1.0f / div;
 	float coltop[3], coldown[3], color[4];
 	int a;
 	
 	/* mult */
-	for(a=0; a<7; a++) {
-		vec[a][0]*= rad; vec[a][1]*= rad;
+	for (a = 0; a < 7; a++) {
+		vec[a][0] *= rad; vec[a][1] *= rad;
 	}
 	/* get current color, needs to be outside of glBegin/End */
 	glGetFloatv(GL_CURRENT_COLOR, color);
 
 	/* 'shade' defines strength of shading */	
-	coltop[0]= color[0]+shadetop; if(coltop[0]>1.0f) coltop[0]= 1.0f;
-	coltop[1]= color[1]+shadetop; if(coltop[1]>1.0f) coltop[1]= 1.0f;
-	coltop[2]= color[2]+shadetop; if(coltop[2]>1.0f) coltop[2]= 1.0f;
-	coldown[0]= color[0]+shadedown; if(coldown[0]<0.0f) coldown[0]= 0.0f;
-	coldown[1]= color[1]+shadedown; if(coldown[1]<0.0f) coldown[1]= 0.0f;
-	coldown[2]= color[2]+shadedown; if(coldown[2]<0.0f) coldown[2]= 0.0f;
+	coltop[0] = color[0] + shadetop; if (coltop[0] > 1.0f) coltop[0] = 1.0f;
+	coltop[1] = color[1] + shadetop; if (coltop[1] > 1.0f) coltop[1] = 1.0f;
+	coltop[2] = color[2] + shadetop; if (coltop[2] > 1.0f) coltop[2] = 1.0f;
+	coldown[0] = color[0] + shadedown; if (coldown[0] < 0.0f) coldown[0] = 0.0f;
+	coldown[1] = color[1] + shadedown; if (coldown[1] < 0.0f) coldown[1] = 0.0f;
+	coldown[2] = color[2] + shadedown; if (coldown[2] < 0.0f) coldown[2] = 0.0f;
 
 	glShadeModel(GL_SMOOTH);
 	glBegin(mode);
 
 	/* start with corner right-bottom */
-	if(roundboxtype & UI_CNR_BOTTOM_RIGHT) {
+	if (roundboxtype & UI_CNR_BOTTOM_RIGHT) {
 		
 		round_box_shade_col(coltop, coldown, 0.0);
-		glVertex2f(maxx-rad, miny);
+		glVertex2f(maxx - rad, miny);
 		
-		for(a=0; a<7; a++) {
-			round_box_shade_col(coltop, coldown, vec[a][1]*idiv);
-			glVertex2f(maxx-rad+vec[a][0], miny+vec[a][1]);
+		for (a = 0; a < 7; a++) {
+			round_box_shade_col(coltop, coldown, vec[a][1] * idiv);
+			glVertex2f(maxx - rad + vec[a][0], miny + vec[a][1]);
 		}
 		
-		round_box_shade_col(coltop, coldown, rad*idiv);
-		glVertex2f(maxx, miny+rad);
+		round_box_shade_col(coltop, coldown, rad * idiv);
+		glVertex2f(maxx, miny + rad);
 	}
 	else {
 		round_box_shade_col(coltop, coldown, 0.0);
@@ -191,17 +191,17 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl
 	}
 	
 	/* corner right-top */
-	if(roundboxtype & UI_CNR_TOP_RIGHT) {
+	if (roundboxtype & UI_CNR_TOP_RIGHT) {
 		
-		round_box_shade_col(coltop, coldown, (div-rad)*idiv);
-		glVertex2f(maxx, maxy-rad);
+		round_box_shade_col(coltop, coldown, (div - rad) * idiv);
+		glVertex2f(maxx, maxy - rad);
 		
-		for(a=0; a<7; a++) {
-			round_box_shade_col(coltop, coldown, (div-rad+vec[a][1])*idiv);
-			glVertex2f(maxx-vec[a][1], maxy-rad+vec[a][0]);
+		for (a = 0; a < 7; a++) {
+			round_box_shade_col(coltop, coldown, (div - rad + vec[a][1]) * idiv);
+			glVertex2f(maxx - vec[a][1], maxy - rad + vec[a][0]);
 		}
 		round_box_shade_col(coltop, coldown, 1.0);
-		glVertex2f(maxx-rad, maxy);
+		glVertex2f(maxx - rad, maxy);
 	}
 	else {
 		round_box_shade_col(coltop, coldown, 1.0);
@@ -209,18 +209,18 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl
 	}
 	
 	/* corner left-top */
-	if(roundboxtype & UI_CNR_TOP_LEFT) {
+	if (roundboxtype & UI_CNR_TOP_LEFT) {
 		
 		round_box_shade_col(coltop, coldown, 1.0);
-		glVertex2f(minx+rad, maxy);
+		glVertex2f(minx + rad, maxy);
 		
-		for(a=0; a<7; a++) {
-			round_box_shade_col(coltop, coldown, (div-vec[a][1])*idiv);
-			glVertex2f(minx+rad-vec[a][0], maxy-vec[a][1]);
+		for (a = 0; a < 7; a++) {
+			round_box_shade_col(coltop, coldown, (div - vec[a][1]) * idiv);
+			glVertex2f(minx + rad - vec[a][0], maxy - vec[a][1]);
 		}
 		
-		round_box_shade_col(coltop, coldown, (div-rad)*idiv);
-		glVertex2f(minx, maxy-rad);
+		round_box_shade_col(coltop, coldown, (div - rad) * idiv);
+		glVertex2f(minx, maxy - rad);
 	}
 	else {
 		round_box_shade_col(coltop, coldown, 1.0);
@@ -228,18 +228,18 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl
 	}
 	
 	/* corner left-bottom */
-	if(roundboxtype & UI_CNR_BOTTOM_LEFT) {
+	if (roundboxtype & UI_CNR_BOTTOM_LEFT) {
 		
-		round_box_shade_col(coltop, coldown, rad*idiv);
-		glVertex2f(minx, miny+rad);
+		round_box_shade_col(coltop, coldown, rad * idiv);
+		glVertex2f(minx, miny + rad);
 		
-		for(a=0; a<7; a++) {
-			round_box_shade_col(coltop, coldown, (rad-vec[a][1])*idiv);
-			glVertex2f(minx+vec[a][1], miny+rad-vec[a][0]);
+		for (a = 0; a < 7; a++) {
+			round_box_shade_col(coltop, coldown, (rad - vec[a][1]) * idiv);
+			glVertex2f(minx + vec[a][1], miny + rad - vec[a][0]);
 		}
 		
 		round_box_shade_col(coltop, coldown, 0.0);
-		glVertex2f(minx+rad, miny);
+		glVertex2f(minx + rad, miny);
 	}
 	else {
 		round_box_shade_col(coltop, coldown, 0.0);
@@ -254,43 +254,43 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl
 /* view2d scrollers use it */
 void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadeLeft, float shadeRight)
 {
-	float vec[7][2]= {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
-					  {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
-	const float div= maxx - minx;
-	const float idiv= 1.0f / div;
+	float vec[7][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
+					   {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
+	const float div = maxx - minx;
+	const float idiv = 1.0f / div;
 	float colLeft[3], colRight[3], color[4];
 	int a;
 	
 	/* mult */
-	for(a=0; a<7; a++) {
-		vec[a][0]*= rad; vec[a][1]*= rad;
+	for (a = 0; a < 7; a++) {
+		vec[a][0] *= rad; vec[a][1] *= rad;
 	}
 	/* get current color, needs to be outside of glBegin/End */
 	glGetFloatv(GL_CURRENT_COLOR, color);
 
 	/* 'shade' defines strength of shading */	
-	colLeft[0]= color[0]+shadeLeft; if(colLeft[0]>1.0f) colLeft[0]= 1.0f;
-	colLeft[1]= color[1]+shadeLeft; if(colLeft[1]>1.0f) colLeft[1]= 1.0f;
-	colLeft[2]= color[2]+shadeLeft; if(colLeft[2]>1.0f) colLeft[2]= 1.0f;
-	colRight[0]= color[0]+shadeRight; if(colRight[0]<0.0f) colRight[0]= 0.0f;
-	colRight[1]= color[1]+shadeRight; if(colRight[1]<0.0f) colRight[1]= 0.0f;
-	colRight[2]= color[2]+shadeRight; if(colRight[2]<0.0f) colRight[2]= 0.0f;
+	colLeft[0] = color[0] + shadeLeft; if (colLeft[0] > 1.0f) colLeft[0] = 1.0f;
+	colLeft[1] = color[1] + shadeLeft; if (colLeft[1] > 1.0f) colLeft[1] = 1.0f;
+	colLeft[2] = color[2] + shadeLeft; if (colLeft[2] > 1.0f) colLeft[2] = 1.0f;
+	colRight[0] = color[0] + shadeRight; if (colRight[0] < 0.0f) colRight[0] = 0.0f;
+	colRight[1] = color[1] + shadeRight; if (colRight[1] < 0.0f) colRight[1] = 0.0f;
+	colRight[2] = color[2] + shadeRight; if (colRight[2] < 0.0f) colRight[2] = 0.0f;
 
 	glShadeModel(GL_SMOOTH);
 	glBegin(mode);
 
 	/* start with corner right-bottom */
-	if(roundboxtype & UI_CNR_BOTTOM_RIGHT) {
+	if (roundboxtype & UI_CNR_BOTTOM_RIGHT) {
 		round_box_shade_col(colLeft, colRight, 0.0);
-		glVertex2f(maxx-rad, miny);
+		glVertex2f(maxx - rad, miny);
 		
-		for(a=0; a<7; a++) {
-			round_box_shade_col(colLeft, colRight, vec[a][0]*idiv);
-			glVertex2f(maxx-rad+vec[a][0], miny+vec[a][1]);
+		for (a = 0; a < 7; a++) {
+			round_box_shade_col(colLeft, colRight, vec[a][0] * idiv);
+			glVertex2f(maxx - rad + vec[a][0], miny + vec[a][1]);
 		}
 		
-		round_box_shade_col(colLeft, colRight, rad*idiv);
-		glVertex2f(maxx, miny+rad);
+		round_box_shade_col(colLeft, colRight, rad * idiv);
+		glVertex2f(maxx, miny + rad);
 	}
 	else {
 		round_box_shade_col(colLeft, colRight, 0.0);
@@ -298,17 +298,17 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float
 	}
 	
 	/* corner right-top */
-	if(roundboxtype & UI_CNR_TOP_RIGHT) {
+	if (roundboxtype & UI_CNR_TOP_RIGHT) {
 		round_box_shade_col(colLeft, colRight, 0.0);
-		glVertex2f(maxx, maxy-rad);
+		glVertex2f(maxx, maxy - rad);
 		
-		for(a=0; a<7; a++) {
+		for (a = 0; a < 7; a++) {
 			
-			round_box_shade_col(colLeft, colRight, (div-rad-vec[a][0])*idiv);
-			glVertex2f(maxx-vec[a][1], maxy-rad+vec[a][0]);
+			round_box_shade_col(colLeft, colRight, (div - rad - vec[a][0]) * idiv);
+			glVertex2f(maxx - vec[a][1], maxy - rad + vec[a][0]);
 		}
-		round_box_shade_col(colLeft, colRight, (div-rad)*idiv);
-		glVertex2f(maxx-rad, maxy);
+		round_box_shade_col(colLeft, colRight, (div - rad) * idiv);
+		glVertex2f(maxx - rad, maxy);
 	}
 	else {
 		round_box_shade_col(colLeft, colRight, 0.0);
@@ -316,17 +316,17 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float
 	}
 	
 	/* corner left-top */
-	if(roundboxtype & UI_CNR_TOP_LEFT) {
-		round_box_shade_col(colLeft, colRight, (div-rad)*idiv);
-		glVertex2f(minx+rad, maxy);
+	if (roundboxtype & UI_CNR_TOP_LEFT) {
+		round_box_shade_col(colLeft, colRight, (div - rad) * idiv);
+		glVertex2f(minx + rad, maxy);
 		
-		for(a=0; a<7; a++) {
-			round_box_shade_col(colLeft, colRight, (div-rad+vec[a][0])*idiv);
-			glVertex2f(minx+rad-vec[a][0], maxy-vec[a][1]);
+		for (a = 0; a < 7; a++) {
+			round_box_shade_col(colLeft, colRight, (div - rad + vec[a][0]) * idiv);
+			glVertex2f(minx + rad - vec[a][0], maxy - vec[a][1]);
 		}
 		
 		round_box_shade_col(colLeft, colRight, 1.0);
-		glVertex2f(minx, maxy-rad);
+		glVertex2f(minx, maxy - rad);
 	}
 	else {
 		round_box_shade_col(colLeft, colRight, 1.0);
@@ -334,17 +334,17 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float
 	}
 	
 	/* corner left-bottom */
-	if(roundboxtype & UI_CNR_BOTTOM_LEFT) {
+	if (roundboxtype & UI_CNR_BOTTOM_LEFT) {
 		round_box_shade_col(colLeft, colRight, 1.0);
-		glVertex2f(minx, miny+rad);
+		glVertex2f(minx, miny + rad);
 		
-		for(a=0; a<7; a++) {
-			round_box_shade_col(colLeft, colRight, (vec[a][0])*idiv);
-			glVertex2f(minx+vec[a][1], miny+rad-vec[a][0]);
+		for (a = 0; a < 7; a++) {
+			round_box_shade_col(colLeft, colRight, (vec[a][0]) * idiv);
+			glVertex2f(minx + vec[a][1], miny + rad - vec[a][0]);
 		}
 		
 		round_box_shade_col(colLeft, colRight, 1.0);
-		glVertex2f(minx+rad, miny);
+		glVertex2f(minx + rad, miny);
 	}
 	else {
 		round_box_shade_col(colLeft, colRight, 1.0);
@@ -360,21 +360,21 @@ void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad)
 {
 	float color[4];
 	
-	if(roundboxtype & UI_RB_ALPHA) {
+	if (roundboxtype & UI_RB_ALPHA) {
 		glGetFloatv(GL_CURRENT_COLOR, color);
-		color[3]= 0.5;
+		color[3] = 0.5;
 		glColor4fv(color);
-		glEnable( GL_BLEND );
+		glEnable(GL_BLEND);
 	}
 	
 	/* set antialias line */
-	glEnable( GL_LINE_SMOOTH );
-	glEnable( GL_BLEND );
+	glEnable(GL_LINE_SMOOTH);
+	glEnable(GL_BLEND);
 
 	uiDrawBox(GL_LINE_LOOP, minx, miny, maxx, maxy, rad);
    
-	glDisable( GL_BLEND );
-	glDisable( GL_LINE_SMOOTH );
+	glDisable(GL_BLEND);
+	glDisable(GL_LINE_SMOOTH);
 }
 
 /* (old, used in outliner) plain antialiased filled box */
@@ -382,11 +382,11 @@ void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad)
 {
 	float color[4];
 	
-	if(roundboxtype & UI_RB_ALPHA) {
+	if (roundboxtype & UI_RB_ALPHA) {
 		glGetFloatv(GL_CURRENT_COLOR, color);
-		color[3]= 0.5;
+		color[3] = 0.5;
 		glColor4fv(color);
-		glEnable( GL_BLEND );
+		glEnable(GL_BLEND);
 	}
 	
 	ui_draw_anti_roundbox(GL_POLYGON, minx, miny, maxx, maxy, rad);
@@ -401,16 +401,16 @@ void uiEmboss(float x1, float y1, float x2, float y2, int sel)
 {
 	
 	/* below */
-	if(sel) glColor3ub(200,200,200);
-	else glColor3ub(50,50,50);
+	if (sel) glColor3ub(200, 200, 200);
+	else glColor3ub(50, 50, 50);
 	fdrawline(x1, y1, x2, y1);
 
 	/* right */
 	fdrawline(x2, y1, x2, y2);
 	
 	/* top */
-	if(sel) glColor3ub(50,50,50);
-	else glColor3ub(200,200,200);
+	if (sel) glColor3ub(50, 50, 50);
+	else glColor3ub(200, 200, 200);
 	fdrawline(x1, y2, x2, y2);
 
 	/* left */
@@ -426,13 +426,14 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w
 	(void)rect;
 	(void)but;
 #else
-	ImBuf *ibuf= (ImBuf *)but->poin;
+	ImBuf *ibuf = (ImBuf *)but->poin;
 	//GLint scissor[4];
 	//int w, h;
 
 	if (!ibuf) return;
 	
-	/* scissor doesn't seem to be doing the right thing...?
+	/* scissor doesn't seem to be doing the right thing...? */
+#if 0
 	//glColor4f(1.0, 0.f, 0.f, 1.f);
 	//fdrawbox(rect->xmin, rect->ymin, rect->xmax, rect->ymax)
 
@@ -441,7 +442,7 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w
 	// prevent drawing outside widget area
 	glGetIntegerv(GL_SCISSOR_BOX, scissor);
 	glScissor(ar->winrct.xmin + rect->xmin, ar->winrct.ymin + rect->ymin, w, h);
-	*/
+#endif
 	
 	glEnable(GL_BLEND);
 	glColor4f(0.0, 0.0, 0.0, 0.0);
@@ -451,10 +452,10 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w
 	
 	glDisable(GL_BLEND);
 	
-	/* 
+#if 0
 	// restore scissortest
 	glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
-	*/
+#endif
 	
 #endif
 }
@@ -476,8 +477,8 @@ static void ui_draw_but_CHARTAB(uiBut *but)
 	int charmax = G.charmax;
 	
 	/* FO_BUILTIN_NAME font in use. There are TTF FO_BUILTIN_NAME and non-TTF FO_BUILTIN_NAME fonts */
-	if(!strcmp(G.selfont->name, FO_BUILTIN_NAME)) {
-		if(G.ui_international == TRUE) {
+	if (!strcmp(G.selfont->name, FO_BUILTIN_NAME)) {
+		if (G.ui_international == TRUE) {
 			charmax = 0xff;
 		}
 		else {
@@ -486,7 +487,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
 	}
 
 	/* Category list exited without selecting the area */
-	if(G.charmax == 0)
+	if (G.charmax == 0)
 		charmax = G.charmax = 0xffff;
 
 	/* Calculate the size of the button */
@@ -505,9 +506,9 @@ static void ui_draw_but_CHARTAB(uiBut *but)
 	cs = G.charstart;
 
 	/* Set the font, in case it is not FO_BUILTIN_NAME font */
-	if(G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME)) {
+	if (G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME)) {
 		// Is the font file packed, if so then use the packed file
-		if(G.selfont->packedfile) {
+		if (G.selfont->packedfile) {
 			pf = G.selfont->packedfile;		
 			FTF_SetFont(pf->data, pf->size, 14.0);
 		}
@@ -521,7 +522,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
 		}
 	}
 	else {
-		if(G.ui_international == TRUE) {
+		if (G.ui_international == TRUE) {
 			FTF_SetFont((unsigned char *) datatoc_bfont_ttf, datatoc_bfont_ttf_size, 14.0);
 		}
 	}
@@ -533,47 +534,44 @@ static void ui_draw_but_CHARTAB(uiBut *but)
 	glRectf((rect->xmin), (rect->ymin), (rect->xmax), (rect->ymax));
 
 	glColor3ub(0,  0,  0);
-	for(y = 0; y < 6; y++) {
+	for (y = 0; y < 6; y++) {
 		// Do not draw more than the category allows
-		if(cs > charmax) break;
+		if (cs > charmax) break;
 
-		for(x = 0; x < 12; x++)
+		for (x = 0; x < 12; x++)
 		{
 			// Do not draw more than the category allows
-			if(cs > charmax) break;
+			if (cs > charmax) break;
 
 			// Draw one grid cell
 			glBegin(GL_LINE_LOOP);
-				glVertex2f(sx, sy);
-				glVertex2f(ex, sy);
-				glVertex2f(ex, ey);
-				glVertex2f(sx, ey);				
+			glVertex2f(sx, sy);
+			glVertex2f(ex, sy);
+			glVertex2f(ex, ey);
+			glVertex2f(sx, ey);
 			glEnd();	
 
 			// Draw character inside the cell
-			memset(wstr, 0, sizeof(wchar_t)*2);
+			memset(wstr, 0, sizeof(wchar_t) * 2);
 			memset(ustr, 0, 16);
 
 			// Set the font to be either unicode or FO_BUILTIN_NAME	
 			wstr[0] = cs;
-			if(strcmp(G.selfont->name, FO_BUILTIN_NAME))
-			{
+			if (strcmp(G.selfont->name, FO_BUILTIN_NAME)) {
 				BLI_strncpy_wchar_as_utf8((char *)ustr, (wchar_t *)wstr, sizeof(ustr));
 			}
-			else
-			{
-				if(G.ui_international == TRUE)
-				{
+			else {
+				if (G.ui_international == TRUE) {
 					BLI_strncpy_wchar_as_utf8((char *)ustr, (wchar_t *)wstr, sizeof(ustr));
 				}
-				else
-				{
+				else {
 					ustr[0] = cs;
 					ustr[1] = 0;
 				}
 			}
 
-			if((G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME)) || (G.selfont && !strcmp(G.selfont->name, FO_BUILTIN_NAME) && G.ui_international == TRUE))
+			if ((G.selfont && strcmp(G.selfont->name, FO_BUILTIN_NAME)) ||
+			    (G.selfont && !strcmp(G.selfont->name, FO_BUILTIN_NAME) && G.ui_international == TRUE))
 			{
 				float wid;
 				float llx, lly, llz, urx, ury, urz;
@@ -582,26 +580,25 @@ static void ui_draw_but_CHARTAB(uiBut *but)
 	
 				// Calculate the position
 				wid = FTF_GetStringWidth((char *) ustr, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
-				FTF_GetBoundingBox((char *) ustr, &llx,&lly,&llz,&urx,&ury,&urz, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
-				dx = urx-llx;
-				dy = ury-lly;
+				FTF_GetBoundingBox((char *) ustr, &llx, &lly, &llz, &urx, &ury, &urz, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
+				dx = urx - llx;
+				dy = ury - lly;
 
 				// This isn't fully functional since the but->aspect isn't working like I suspected
-				px = sx + ((butw/but->aspect)-dx)/2;
-				py = sy + ((buth/but->aspect)-dy)/2;
+				px = sx + ((butw / but->aspect) - dx) / 2;
+				py = sy + ((buth / but->aspect) - dy) / 2;
 
 				// Set the position and draw the character
 				ui_rasterpos_safe(px, py, but->aspect);
 				FTF_DrawString((char *) ustr, FTF_USE_GETTEXT | FTF_INPUT_UTF8);
 			}
-			else
-			{
-				ui_rasterpos_safe(sx + butw/2, sy + buth/2, but->aspect);
+			else {
+				ui_rasterpos_safe(sx + butw / 2, sy + buth / 2, but->aspect);
 				UI_DrawString(but->font, (char *) ustr, 0);
 			}
 	
 			// Calculate the next position and character
-			sx += butw; ex +=butw;
+			sx += butw; ex += butw;
 			cs++;
 		}
 		/* Add the y position and reset x position */
@@ -613,7 +610,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
 	glShadeModel(GL_FLAT);
 
 	/* Return Font Settings to original */
-	if(U.fontsize && U.fontname[0]) {
+	if (U.fontsize && U.fontname[0]) {
 		result = FTF_SetFont((unsigned char *)U.fontname, 0, U.fontsize);
 	}
 	else if (U.fontsize) {
@@ -625,7 +622,7 @@ static void ui_draw_but_CHARTAB(uiBut *but)
 	}
 	
 	/* resets the font size */
-	if(G.ui_international == TRUE) {
+	if (G.ui_international == TRUE) {
 		// uiSetCurFont(but->block, UI_HELV);
 	}
 }
@@ -640,23 +637,23 @@ static void draw_scope_end(rctf *rect, GLint *scissor)
 	/* restore scissortest */
 	glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
 	
-	glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 	
 	/* scale widget */
-	scaler_x1 = rect->xmin + (rect->xmax - rect->xmin)/2 - SCOPE_RESIZE_PAD;
-	scaler_x2 = rect->xmin + (rect->xmax - rect->xmin)/2 + SCOPE_RESIZE_PAD;
+	scaler_x1 = rect->xmin + (rect->xmax - rect->xmin) / 2 - SCOPE_RESIZE_PAD;
+	scaler_x2 = rect->xmin + (rect->xmax - rect->xmin) / 2 + SCOPE_RESIZE_PAD;
 	
 	glColor4f(0.f, 0.f, 0.f, 0.25f);
-	fdrawline(scaler_x1, rect->ymin-4, scaler_x2, rect->ymin-4);
-	fdrawline(scaler_x1, rect->ymin-7, scaler_x2, rect->ymin-7);
+	fdrawline(scaler_x1, rect->ymin - 4, scaler_x2, rect->ymin - 4);
+	fdrawline(scaler_x1, rect->ymin - 7, scaler_x2, rect->ymin - 7);
 	glColor4f(1.f, 1.f, 1.f, 0.25f);
-	fdrawline(scaler_x1, rect->ymin-5, scaler_x2, rect->ymin-5);
-	fdrawline(scaler_x1, rect->ymin-8, scaler_x2, rect->ymin-8);
+	fdrawline(scaler_x1, rect->ymin - 5, scaler_x2, rect->ymin - 5);
+	fdrawline(scaler_x1, rect->ymin - 8, scaler_x2, rect->ymin - 8);
 	
 	/* outline */
 	glColor4f(0.f, 0.f, 0.f, 0.5f);
 	uiSetRoundBox(UI_CNR_ALL);
-	uiDrawBox(GL_LINE_LOOP, rect->xmin-1, rect->ymin, rect->xmax+1, rect->ymax+1, 3.0f);
+	uiDrawBox(GL_LINE_LOOP, rect->xmin - 1, rect->ymin, rect->xmax + 1, rect->ymax + 1, 3.0f);
 }
 
 static void histogram_draw_one(float r, float g, float b, float alpha, float x, float y, float w, float h, float *data, int res)
@@ -670,10 +667,10 @@ static void histogram_draw_one(float r, float g, float b, float alpha, float x,
 	glShadeModel(GL_FLAT);
 	glBegin(GL_QUAD_STRIP);
 	glVertex2f(x, y);
-	glVertex2f(x, y + (data[0]*h));
-	for (i=1; i < res; i++) {
-		float x2 = x + i * (w/(float)res);
-		glVertex2f(x2, y + (data[i]*h));
+	glVertex2f(x, y + (data[0] * h));
+	for (i = 1; i < res; i++) {
+		float x2 = x + i * (w / (float)res);
+		glVertex2f(x2, y + (data[i] * h));
 		glVertex2f(x2, y);
 	}
 	glEnd();
@@ -684,9 +681,9 @@ static void histogram_draw_one(float r, float g, float b, float alpha, float x,
 	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 	glEnable(GL_LINE_SMOOTH);
 	glBegin(GL_LINE_STRIP);
-	for (i=0; i < res; i++) {
-		float x2 = x + i * (w/(float)res);
-		glVertex2f(x2, y + (data[i]*h));
+	for (i = 0; i < res; i++) {
+		float x2 = x + i * (w / (float)res);
+		glVertex2f(x2, y + (data[i] * h));
 	}
 	glEnd();
 	glDisable(GL_LINE_SMOOTH);
@@ -702,30 +699,30 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol)
 	//float alpha;
 	GLint scissor[4];
 	
-	rect.xmin = (float)recti->xmin+1;
-	rect.xmax = (float)recti->xmax-1;
-	rect.ymin = (float)recti->ymin+SCOPE_RESIZE_PAD+2;
-	rect.ymax = (float)recti->ymax-1;
+	rect.xmin = (float)recti->xmin + 1;
+	rect.xmax = (float)recti->xmax - 1;
+	rect.ymin = (float)recti->ymin + SCOPE_RESIZE_PAD + 2;
+	rect.ymax = (float)recti->ymax - 1;
 	
 	w = rect.xmax - rect.xmin;
 	h = (rect.ymax - rect.ymin) * hist->ymax;
 	
 	glEnable(GL_BLEND);
-	glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 	
 	glColor4f(0.f, 0.f, 0.f, 0.3f);
 	uiSetRoundBox(UI_CNR_ALL);
-	uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin-1, rect.xmax+1, rect.ymax+1, 3.0f);
+	uiDrawBox(GL_POLYGON, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f);
 
 	/* need scissor test, histogram can draw outside of boundary */
 	glGetIntegerv(GL_VIEWPORT, scissor);
-	glScissor(ar->winrct.xmin + (rect.xmin-1), ar->winrct.ymin+(rect.ymin-1), (rect.xmax+1)-(rect.xmin-1), (rect.ymax+1)-(rect.ymin-1));
+	glScissor(ar->winrct.xmin + (rect.xmin - 1), ar->winrct.ymin + (rect.ymin - 1), (rect.xmax + 1) - (rect.xmin - 1), (rect.ymax + 1) - (rect.ymin - 1));
 
 	glColor4f(1.f, 1.f, 1.f, 0.08f);
 	/* draw grid lines here */
-	for (i=1; i<4; i++) {
-		fdrawline(rect.xmin, rect.ymin+(i/4.f)*h, rect.xmax, rect.ymin+(i/4.f)*h);
-		fdrawline(rect.xmin+(i/4.f)*w, rect.ymin, rect.xmin+(i/4.f)*w, rect.ymax);
+	for (i = 1; i < 4; i++) {
+		fdrawline(rect.xmin, rect.ymin + (i / 4.f) * h, rect.xmax, rect.ymin + (i / 4.f) * h);
+		fdrawline(rect.xmin + (i / 4.f) * w, rect.ymin, rect.xmin + (i / 4.f) * w, rect.ymax);
 	}
 	
 	if (hist->mode == HISTO_MODE_LUMA)
@@ -750,88 +747,88 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
 	int i, c;
 	float w, w3, h, alpha, yofs;
 	GLint scissor[4];
-	float colors[3][3]= MAT3_UNITY;
-	float colorsycc[3][3] = {{1,0,1},{1,1,0},{0,1,1}};
+	float colors[3][3] = MAT3_UNITY;
+	float colorsycc[3][3] = {{1, 0, 1}, {1, 1, 0}, {0, 1, 1}};
 	float colors_alpha[3][3], colorsycc_alpha[3][3]; /* colors  pre multiplied by alpha for speed up */
 	float min, max;
 	
-	if (scopes==NULL) return;
-	
-	rect.xmin = (float)recti->xmin+1;
-	rect.xmax = (float)recti->xmax-1;
-	rect.ymin = (float)recti->ymin+SCOPE_RESIZE_PAD+2;
-	rect.ymax = (float)recti->ymax-1;
+	if (scopes == NULL) return;
 	
-	if (scopes->wavefrm_yfac < 0.5f )
-		scopes->wavefrm_yfac =0.98f;
-	w = rect.xmax - rect.xmin-7;
-	h = (rect.ymax - rect.ymin)*scopes->wavefrm_yfac;
-	yofs= rect.ymin + (rect.ymax - rect.ymin -h)/2.0f;
-	w3=w/3.0f;
+	rect.xmin = (float)recti->xmin + 1;
+	rect.xmax = (float)recti->xmax - 1;
+	rect.ymin = (float)recti->ymin + SCOPE_RESIZE_PAD + 2;
+	rect.ymax = (float)recti->ymax - 1;
+
+	if (scopes->wavefrm_yfac < 0.5f)
+		scopes->wavefrm_yfac = 0.98f;
+	w = rect.xmax - rect.xmin - 7;
+	h = (rect.ymax - rect.ymin) * scopes->wavefrm_yfac;
+	yofs = rect.ymin + (rect.ymax - rect.ymin - h) / 2.0f;
+	w3 = w / 3.0f;
 	
 	/* log scale for alpha */
-	alpha = scopes->wavefrm_alpha*scopes->wavefrm_alpha;
+	alpha = scopes->wavefrm_alpha * scopes->wavefrm_alpha;
 	
-	for(c=0; c<3; c++) {
-		for(i=0; i<3; i++) {
+	for (c = 0; c < 3; c++) {
+		for (i = 0; i < 3; i++) {
 			colors_alpha[c][i] = colors[c][i] * alpha;
 			colorsycc_alpha[c][i] = colorsycc[c][i] * alpha;
 		}
 	}
 			
 	glEnable(GL_BLEND);
-	glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 	
 	glColor4f(0.f, 0.f, 0.f, 0.3f);
 	uiSetRoundBox(UI_CNR_ALL);
-	uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin-1, rect.xmax+1, rect.ymax+1, 3.0f);
+	uiDrawBox(GL_POLYGON, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f);
 	
 
 	/* need scissor test, waveform can draw outside of boundary */
 	glGetIntegerv(GL_VIEWPORT, scissor);
-	glScissor(ar->winrct.xmin + (rect.xmin-1), ar->winrct.ymin+(rect.ymin-1), (rect.xmax+1)-(rect.xmin-1), (rect.ymax+1)-(rect.ymin-1));
+	glScissor(ar->winrct.xmin + (rect.xmin - 1), ar->winrct.ymin + (rect.ymin - 1), (rect.xmax + 1) - (rect.xmin - 1), (rect.ymax + 1) - (rect.ymin - 1));
 
 	glColor4f(1.f, 1.f, 1.f, 0.08f);
 	/* draw grid lines here */
-	for (i=0; i<6; i++) {
+	for (i = 0; i < 6; i++) {
 		char str[4];
-		BLI_snprintf(str, sizeof(str), "%-3d",i*20);
-		str[3]='\0';
-		fdrawline(rect.xmin+22, yofs+(i/5.f)*h, rect.xmax+1, yofs+(i/5.f)*h);
-		BLF_draw_default(rect.xmin+1, yofs-5+(i/5.f)*h, 0, str, sizeof(str)-1);
+		BLI_snprintf(str, sizeof(str), "%-3d", i * 20);
+		str[3] = '\0';
+		fdrawline(rect.xmin + 22, yofs + (i / 5.f) * h, rect.xmax + 1, yofs + (i / 5.f) * h);
+		BLF_draw_default(rect.xmin + 1, yofs - 5 + (i / 5.f) * h, 0, str, sizeof(str) - 1);
 		/* in the loop because blf_draw reset it */
 		glEnable(GL_BLEND);
-		glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 	}
 	/* 3 vertical separation */
-	if (scopes->wavefrm_mode!= SCOPES_WAVEFRM_LUMA) {
-		for (i=1; i<3; i++) {
-			fdrawline(rect.xmin+i*w3, rect.ymin, rect.xmin+i*w3, rect.ymax);
+	if (scopes->wavefrm_mode != SCOPES_WAVEFRM_LUMA) {
+		for (i = 1; i < 3; i++) {
+			fdrawline(rect.xmin + i * w3, rect.ymin, rect.xmin + i * w3, rect.ymax);
 		}
 	}
 	
 	/* separate min max zone on the right */
-	fdrawline(rect.xmin+w, rect.ymin, rect.xmin+w, rect.ymax);
+	fdrawline(rect.xmin + w, rect.ymin, rect.xmin + w, rect.ymax);
 	/* 16-235-240 level in case of ITU-R BT601/709 */
 	glColor4f(1.f, 0.4f, 0.f, 0.2f);
-	if (ELEM(scopes->wavefrm_mode, SCOPES_WAVEFRM_YCC_601, SCOPES_WAVEFRM_YCC_709)){
-		fdrawline(rect.xmin+22, yofs+h*16.0f/255.0f, rect.xmax+1, yofs+h*16.0f/255.0f);
-		fdrawline(rect.xmin+22, yofs+h*235.0f/255.0f, rect.xmin+w3, yofs+h*235.0f/255.0f);
-		fdrawline(rect.xmin+3*w3, yofs+h*235.0f/255.0f, rect.xmax+1, yofs+h*235.0f/255.0f);
-		fdrawline(rect.xmin+w3, yofs+h*240.0f/255.0f, rect.xmax+1, yofs+h*240.0f/255.0f);
+	if (ELEM(scopes->wavefrm_mode, SCOPES_WAVEFRM_YCC_601, SCOPES_WAVEFRM_YCC_709)) {
+		fdrawline(rect.xmin + 22, yofs + h * 16.0f / 255.0f, rect.xmax + 1, yofs + h * 16.0f / 255.0f);
+		fdrawline(rect.xmin + 22, yofs + h * 235.0f / 255.0f, rect.xmin + w3, yofs + h * 235.0f / 255.0f);
+		fdrawline(rect.xmin + 3 * w3, yofs + h * 235.0f / 255.0f, rect.xmax + 1, yofs + h * 235.0f / 255.0f);
+		fdrawline(rect.xmin + w3, yofs + h * 240.0f / 255.0f, rect.xmax + 1, yofs + h * 240.0f / 255.0f);
 	}
 	/* 7.5 IRE black point level for NTSC */
-	if (scopes->wavefrm_mode== SCOPES_WAVEFRM_LUMA)
-		fdrawline(rect.xmin, yofs+h*0.075f, rect.xmax+1, yofs+h*0.075f);
+	if (scopes->wavefrm_mode == SCOPES_WAVEFRM_LUMA)
+		fdrawline(rect.xmin, yofs + h * 0.075f, rect.xmax + 1, yofs + h * 0.075f);
 
 	if (scopes->ok && scopes->waveform_1 != NULL) {
 		
 		/* LUMA (1 channel) */
-		glBlendFunc(GL_ONE,GL_ONE);
+		glBlendFunc(GL_ONE, GL_ONE);
 		glColor3f(alpha, alpha, alpha);
-		if (scopes->wavefrm_mode == SCOPES_WAVEFRM_LUMA){
+		if (scopes->wavefrm_mode == SCOPES_WAVEFRM_LUMA) {
 
-			glBlendFunc(GL_ONE,GL_ONE);
+			glBlendFunc(GL_ONE, GL_ONE);
 			
 			glPushMatrix();
 			glEnableClientState(GL_VERTEX_ARRAY);
@@ -846,18 +843,18 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
 
 			/* min max */
 			glColor3f(.5f, .5f, .5f);
-			min= yofs+scopes->minmax[0][0]*h;
-			max= yofs+scopes->minmax[0][1]*h;
+			min = yofs + scopes->minmax[0][0] * h;
+			max = yofs + scopes->minmax[0][1] * h;
 			CLAMP(min, rect.ymin, rect.ymax);
 			CLAMP(max, rect.ymin, rect.ymax);
-			fdrawline(rect.xmax-3,min,rect.xmax-3,max);
+			fdrawline(rect.xmax - 3, min, rect.xmax - 3, max);
 		}
 
 		/* RGB / YCC (3 channels) */
 		else if (ELEM4(scopes->wavefrm_mode, SCOPES_WAVEFRM_RGB, SCOPES_WAVEFRM_YCC_601, SCOPES_WAVEFRM_YCC_709, SCOPES_WAVEFRM_YCC_JPEG)) {
 			int rgb = (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB);
 			
-			glBlendFunc(GL_ONE,GL_ONE);
+			glBlendFunc(GL_ONE, GL_ONE);
 			
 			glPushMatrix();
 			glEnableClientState(GL_VERTEX_ARRAY);
@@ -865,17 +862,17 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
 			glTranslatef(rect.xmin, yofs, 0.f);
 			glScalef(w3, h, 0.f);
 			
-			glColor3fv((rgb)?colors_alpha[0]:colorsycc_alpha[0]);
+			glColor3fv((rgb) ? colors_alpha[0] : colorsycc_alpha[0]);
 			glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_1);
 			glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
 
 			glTranslatef(1.f, 0.f, 0.f);
-			glColor3fv((rgb)?colors_alpha[1]:colorsycc_alpha[1]);
+			glColor3fv((rgb) ? colors_alpha[1] : colorsycc_alpha[1]);
 			glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_2);
 			glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
 			
 			glTranslatef(1.f, 0.f, 0.f);
-			glColor3fv((rgb)?colors_alpha[2]:colorsycc_alpha[2]);
+			glColor3fv((rgb) ? colors_alpha[2] : colorsycc_alpha[2]);
 			glVertexPointer(2, GL_FLOAT, 0, scopes->waveform_3);
 			glDrawArrays(GL_POINTS, 0, scopes->waveform_tot);
 			
@@ -884,16 +881,16 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
 
 			
 			/* min max */
-			for (c=0; c<3; c++) {
+			for (c = 0; c < 3; c++) {
 				if (scopes->wavefrm_mode == SCOPES_WAVEFRM_RGB)
-					glColor3f(colors[c][0]*0.75f, colors[c][1]*0.75f, colors[c][2]*0.75f);
+					glColor3f(colors[c][0] * 0.75f, colors[c][1] * 0.75f, colors[c][2] * 0.75f);
 				else
-					glColor3f(colorsycc[c][0]*0.75f, colorsycc[c][1]*0.75f, colorsycc[c][2]*0.75f);
-				min= yofs+scopes->minmax[c][0]*h;
-				max= yofs+scopes->minmax[c][1]*h;
+					glColor3f(colorsycc[c][0] * 0.75f, colorsycc[c][1] * 0.75f, colorsycc[c][2] * 0.75f);
+				min = yofs + scopes->minmax[c][0] * h;
+				max = yofs + scopes->minmax[c][1] * h;
 				CLAMP(min, rect.ymin, rect.ymax);
 				CLAMP(max, rect.ymin, rect.ymax);
-				fdrawline(rect.xmin+w+2+c*2,min,rect.xmin+w+2+c*2,max);
+				fdrawline(rect.xmin + w + 2 + c * 2, min, rect.xmin + w + 2 + c * 2, max);
 			}
 		}
 		
@@ -905,128 +902,128 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
 
 static float polar_to_x(float center, float diam, float ampli, float angle)
 {
-	return center + diam * ampli * cosf(angle);
+	return center + diam *ampli *cosf(angle);
 }
 
 static float polar_to_y(float center, float diam, float ampli, float angle)
 {
-	return center + diam * ampli * sinf(angle);
+	return center + diam *ampli *sinf(angle);
 }
 
 static void vectorscope_draw_target(float centerx, float centery, float diam, const float colf[3])
 {
-	float y,u,v;
-	float tangle=0.f, tampli;
+	float y, u, v;
+	float tangle = 0.f, tampli;
 	float dangle, dampli, dangle2, dampli2;
 
 	rgb_to_yuv(colf[0], colf[1], colf[2], &y, &u, &v);
-	if (u>0 && v>=0) tangle=atanf(v/u);
-	else if (u>0 && v<0) tangle= atanf(v/u) + 2.0f * (float)M_PI;
-	else if (u<0) tangle=atanf(v/u) + (float)M_PI;
-	else if (u==0 && v > 0.0f) tangle= (float)M_PI/2.0f;
-	else if (u==0 && v < 0.0f) tangle=-(float)M_PI/2.0f;
-	tampli= sqrtf(u*u+v*v);
+	if (u > 0 && v >= 0) tangle = atanf(v / u);
+	else if (u > 0 && v < 0) tangle = atanf(v / u) + 2.0f * (float)M_PI;
+	else if (u < 0) tangle = atanf(v / u) + (float)M_PI;
+	else if (u == 0 && v > 0.0f) tangle = (float)M_PI / 2.0f;
+	else if (u == 0 && v < 0.0f) tangle = -(float)M_PI / 2.0f;
+	tampli = sqrtf(u * u + v * v);
 
 	/* small target vary by 2.5 degree and 2.5 IRE unit */
 	glColor4f(1.0f, 1.0f, 1.0, 0.12f);
-	dangle= DEG2RADF(2.5f);
-	dampli= 2.5f/200.0f;
+	dangle = DEG2RADF(2.5f);
+	dampli = 2.5f / 200.0f;
 	glBegin(GL_LINE_STRIP);
-	glVertex2f(polar_to_x(centerx,diam,tampli+dampli,tangle+dangle), polar_to_y(centery,diam,tampli+dampli,tangle+dangle));
-	glVertex2f(polar_to_x(centerx,diam,tampli-dampli,tangle+dangle), polar_to_y(centery,diam,tampli-dampli,tangle+dangle));
-	glVertex2f(polar_to_x(centerx,diam,tampli-dampli,tangle-dangle), polar_to_y(centery,diam,tampli-dampli,tangle-dangle));
-	glVertex2f(polar_to_x(centerx,diam,tampli+dampli,tangle-dangle), polar_to_y(centery,diam,tampli+dampli,tangle-dangle));
-	glVertex2f(polar_to_x(centerx,diam,tampli+dampli,tangle+dangle), polar_to_y(centery,diam,tampli+dampli,tangle+dangle));
+	glVertex2f(polar_to_x(centerx, diam, tampli + dampli, tangle + dangle), polar_to_y(centery, diam, tampli + dampli, tangle + dangle));
+	glVertex2f(polar_to_x(centerx, diam, tampli - dampli, tangle + dangle), polar_to_y(centery, diam, tampli - dampli, tangle + dangle));
+	glVertex2f(polar_to_x(centerx, diam, tampli - dampli, tangle - dangle), polar_to_y(centery, diam, tampli - dampli, tangle - dangle));
+	glVertex2f(polar_to_x(centerx, diam, tampli + dampli, tangle - dangle), polar_to_y(centery, diam, tampli + dampli, tangle - dangle));
+	glVertex2f(polar_to_x(centerx, diam, tampli + dampli, tangle + dangle), polar_to_y(centery, diam, tampli + dampli, tangle + dangle));
 	glEnd();
 	/* big target vary by 10 degree and 20% amplitude */
 	glColor4f(1.0f, 1.0f, 1.0, 0.12f);
-	dangle= DEG2RADF(10.0f);
-	dampli= 0.2f*tampli;
-	dangle2= DEG2RADF(5.0f);
-	dampli2= 0.5f*dampli;
+	dangle = DEG2RADF(10.0f);
+	dampli = 0.2f * tampli;
+	dangle2 = DEG2RADF(5.0f);
+	dampli2 = 0.5f * dampli;
 	glBegin(GL_LINE_STRIP);
-	glVertex2f(polar_to_x(centerx,diam,tampli+dampli-dampli2,tangle+dangle), polar_to_y(centery,diam,tampli+dampli-dampli2,tangle+dangle));
-	glVertex2f(polar_to_x(centerx,diam,tampli+dampli,tangle+dangle), polar_to_y(centery,diam,tampli+dampli,tangle+dangle));
-	glVertex2f(polar_to_x(centerx,diam,tampli+dampli,tangle+dangle-dangle2), polar_to_y(centery,diam,tampli+dampli,tangle+dangle-dangle2));
+	glVertex2f(polar_to_x(centerx, diam, tampli + dampli - dampli2, tangle + dangle), polar_to_y(centery, diam, tampli + dampli - dampli2, tangle + dangle));
+	glVertex2f(polar_to_x(centerx, diam, tampli + dampli, tangle + dangle), polar_to_y(centery, diam, tampli + dampli, tangle + dangle));
+	glVertex2f(polar_to_x(centerx, diam, tampli + dampli, tangle + dangle - dangle2), polar_to_y(centery, diam, tampli + dampli, tangle + dangle - dangle2));
 	glEnd();
 	glBegin(GL_LINE_STRIP);
-	glVertex2f(polar_to_x(centerx,diam,tampli-dampli+dampli2,tangle+dangle), polar_to_y(centery ,diam,tampli-dampli+dampli2,tangle+dangle));
-	glVertex2f(polar_to_x(centerx,diam,tampli-dampli,tangle+dangle), polar_to_y(centery,diam,tampli-dampli,tangle+dangle));
-	glVertex2f(polar_to_x(centerx,diam,tampli-dampli,tangle+dangle-dangle2), polar_to_y(centery,diam,tampli-dampli,tangle+dangle-dangle2));
+	glVertex2f(polar_to_x(centerx, diam, tampli - dampli + dampli2, tangle + dangle), polar_to_y(centery, diam, tampli - dampli + dampli2, tangle + dangle));
+	glVertex2f(polar_to_x(centerx, diam, tampli - dampli, tangle + dangle), polar_to_y(centery, diam, tampli - dampli, tangle + dangle));
+	glVertex2f(polar_to_x(centerx, diam, tampli - dampli, tangle + dangle - dangle2), polar_to_y(centery, diam, tampli - dampli, tangle + dangle - dangle2));
 	glEnd();
 	glBegin(GL_LINE_STRIP);
-	glVertex2f(polar_to_x(centerx,diam,tampli-dampli+dampli2,tangle-dangle), polar_to_y(centery,diam,tampli-dampli+dampli2,tangle-dangle));
-	glVertex2f(polar_to_x(centerx,diam,tampli-dampli,tangle-dangle), polar_to_y(centery,diam,tampli-dampli,tangle-dangle));
-	glVertex2f(polar_to_x(centerx,diam,tampli-dampli,tangle-dangle+dangle2), polar_to_y(centery,diam,tampli-dampli,tangle-dangle+dangle2));
+	glVertex2f(polar_to_x(centerx, diam, tampli - dampli + dampli2, tangle - dangle), polar_to_y(centery, diam, tampli - dampli + dampli2, tangle - dangle));
+	glVertex2f(polar_to_x(centerx, diam, tampli - dampli, tangle - dangle), polar_to_y(centery, diam, tampli - dampli, tangle - dangle));
+	glVertex2f(polar_to_x(centerx, diam, tampli - dampli, tangle - dangle + dangle2), polar_to_y(centery, diam, tampli - dampli, tangle - dangle + dangle2));
 	glEnd();
 	glBegin(GL_LINE_STRIP);
-	glVertex2f(polar_to_x(centerx,diam,tampli+dampli-dampli2,tangle-dangle), polar_to_y(centery,diam,tampli+dampli-dampli2,tangle-dangle));
-	glVertex2f(polar_to_x(centerx,diam,tampli+dampli,tangle-dangle), polar_to_y(centery,diam,tampli+dampli,tangle-dangle));
-	glVertex2f(polar_to_x(centerx,diam,tampli+dampli,tangle-dangle+dangle2), polar_to_y(centery,diam,tampli+dampli,tangle-dangle+dangle2));
+	glVertex2f(polar_to_x(centerx, diam, tampli + dampli - dampli2, tangle - dangle), polar_to_y(centery, diam, tampli + dampli - dampli2, tangle - dangle));
+	glVertex2f(polar_to_x(centerx, diam, tampli + dampli, tangle - dangle), polar_to_y(centery, diam, tampli + dampli, tangle - dangle));
+	glVertex2f(polar_to_x(centerx, diam, tampli + dampli, tangle - dangle + dangle2), polar_to_y(centery, diam, tampli + dampli, tangle - dangle + dangle2));
 	glEnd();
 }
 
 void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti)
 {
-	const float skin_rad= DEG2RADF(123.0f); /* angle in radians of the skin tone line */
+	const float skin_rad = DEG2RADF(123.0f); /* angle in radians of the skin tone line */
 	Scopes *scopes = (Scopes *)but->poin;
 	rctf rect;
 	int i, j;
 	float w, h, centerx, centery, diam;
 	float alpha;
-	const float colors[6][3]={{.75,0,0},{.75,.75,0},{0,.75,0},{0,.75,.75},{0,0,.75},{.75,0,.75}};
+	const float colors[6][3] = {{.75, 0, 0}, {.75, .75, 0}, {0, .75, 0}, {0, .75, .75}, {0, 0, .75}, {.75, 0, .75}};
 	GLint scissor[4];
 	
-	rect.xmin = (float)recti->xmin+1;
-	rect.xmax = (float)recti->xmax-1;
-	rect.ymin = (float)recti->ymin+SCOPE_RESIZE_PAD+2;
-	rect.ymax = (float)recti->ymax-1;
+	rect.xmin = (float)recti->xmin + 1;
+	rect.xmax = (float)recti->xmax - 1;
+	rect.ymin = (float)recti->ymin + SCOPE_RESIZE_PAD + 2;
+	rect.ymax = (float)recti->ymax - 1;
 	
 	w = rect.xmax - rect.xmin;
 	h = rect.ymax - rect.ymin;
-	centerx = rect.xmin + w/2;
-	centery = rect.ymin + h/2;
-	diam= (w<h)?w:h;
+	centerx = rect.xmin + w / 2;
+	centery = rect.ymin + h / 2;
+	diam = (w < h) ? w : h;
 	
-	alpha = scopes->vecscope_alpha*scopes->vecscope_alpha*scopes->vecscope_alpha;
+	alpha = scopes->vecscope_alpha * scopes->vecscope_alpha * scopes->vecscope_alpha;
 			
 	glEnable(GL_BLEND);
-	glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 	
 	glColor4f(0.f, 0.f, 0.f, 0.3f);
 	uiSetRoundBox(UI_CNR_ALL);
-	uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin-1, rect.xmax+1, rect.ymax+1, 3.0f);
+	uiDrawBox(GL_POLYGON, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f);
 
 	/* need scissor test, hvectorscope can draw outside of boundary */
 	glGetIntegerv(GL_VIEWPORT, scissor);
-	glScissor(ar->winrct.xmin + (rect.xmin-1), ar->winrct.ymin+(rect.ymin-1), (rect.xmax+1)-(rect.xmin-1), (rect.ymax+1)-(rect.ymin-1));
+	glScissor(ar->winrct.xmin + (rect.xmin - 1), ar->winrct.ymin + (rect.ymin - 1), (rect.xmax + 1) - (rect.xmin - 1), (rect.ymax + 1) - (rect.ymin - 1));
 	
 	glColor4f(1.f, 1.f, 1.f, 0.08f);
 	/* draw grid elements */
 	/* cross */
-	fdrawline(centerx - (diam/2)-5, centery, centerx + (diam/2)+5, centery);
-	fdrawline(centerx, centery - (diam/2)-5, centerx, centery + (diam/2)+5);
+	fdrawline(centerx - (diam / 2) - 5, centery, centerx + (diam / 2) + 5, centery);
+	fdrawline(centerx, centery - (diam / 2) - 5, centerx, centery + (diam / 2) + 5);
 	/* circles */
-	for(j=0; j<5; j++) {
+	for (j = 0; j < 5; j++) {
 		glBegin(GL_LINE_STRIP);
-		for(i=0; i<=360; i=i+15) {
-			const float a= DEG2RADF((float)i);
-			const float r= (j+1)/10.0f;
-			glVertex2f(polar_to_x(centerx,diam,r,a), polar_to_y(centery,diam,r,a));
+		for (i = 0; i <= 360; i = i + 15) {
+			const float a = DEG2RADF((float)i);
+			const float r = (j + 1) / 10.0f;
+			glVertex2f(polar_to_x(centerx, diam, r, a), polar_to_y(centery, diam, r, a));
 		}
 		glEnd();
 	}
 	/* skin tone line */
 	glColor4f(1.f, 0.4f, 0.f, 0.2f);
-	fdrawline(polar_to_x(centerx, diam, 0.5f, skin_rad), polar_to_y(centery,diam,0.5,skin_rad),
-	          polar_to_x(centerx, diam, 0.1f, skin_rad), polar_to_y(centery,diam,0.1,skin_rad));
+	fdrawline(polar_to_x(centerx, diam, 0.5f, skin_rad), polar_to_y(centery, diam, 0.5, skin_rad),
+	          polar_to_x(centerx, diam, 0.1f, skin_rad), polar_to_y(centery, diam, 0.1, skin_rad));
 	/* saturation points */
-	for(i=0; i<6; i++)
+	for (i = 0; i < 6; i++)
 		vectorscope_draw_target(centerx, centery, diam, colors[i]);
 	
 	if (scopes->ok && scopes->vecscope != NULL) {
 		/* pixel point cloud */
-		glBlendFunc(GL_ONE,GL_ONE);
+		glBlendFunc(GL_ONE, GL_ONE);
 		glColor3f(alpha, alpha, alpha);
 
 		glPushMatrix();
@@ -1055,49 +1052,49 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect)
 	float x1, y1, sizex, sizey;
 	float v3[2], v1[2], v2[2], v1a[2], v2a[2];
 	int a;
-	float pos, colf[4]= {0,0,0,0}; /* initialize incase the colorband isnt valid */
+	float pos, colf[4] = {0, 0, 0, 0}; /* initialize in case the colorband isn't valid */
 		
-	coba= (ColorBand *)(but->editcoba? but->editcoba: but->poin);
-	if(coba==NULL) return;
+	coba = (ColorBand *)(but->editcoba ? but->editcoba : but->poin);
+	if (coba == NULL) return;
 	
-	x1= rect->xmin;
-	y1= rect->ymin;
-	sizex= rect->xmax-x1;
-	sizey= rect->ymax-y1;
+	x1 = rect->xmin;
+	y1 = rect->ymin;
+	sizex = rect->xmax - x1;
+	sizey = rect->ymax - y1;
 
 	/* first background, to show tranparency */
 
 	glColor4ub(UI_TRANSP_DARK, UI_TRANSP_DARK, UI_TRANSP_DARK, 255);
-	glRectf(x1, y1, x1+sizex, y1+sizey);
+	glRectf(x1, y1, x1 + sizex, y1 + sizey);
 	glEnable(GL_POLYGON_STIPPLE);
 	glColor4ub(UI_TRANSP_LIGHT, UI_TRANSP_LIGHT, UI_TRANSP_LIGHT, 255);
 	glPolygonStipple(checker_stipple_sml);
-	glRectf(x1, y1, x1+sizex, y1+sizey);
+	glRectf(x1, y1, x1 + sizex, y1 + sizey);
 	glDisable(GL_POLYGON_STIPPLE);
 
 	glShadeModel(GL_FLAT);
 	glEnable(GL_BLEND);
 	
-	cbd= coba->data;
+	cbd = coba->data;
 	
-	v1[0]= v2[0]= x1;
-	v1[1]= y1;
-	v2[1]= y1+sizey;
+	v1[0] = v2[0] = x1;
+	v1[1] = y1;
+	v2[1] = y1 + sizey;
 	
 	glBegin(GL_QUAD_STRIP);
 	
-	glColor4fv( &cbd->r );
+	glColor4fv(&cbd->r);
 	glVertex2fv(v1); glVertex2fv(v2);
 	
-	for( a = 1; a <= sizex; a++ ) {
-		pos = ((float)a) / (sizex-1);
-		do_colorband( coba, pos, colf );
+	for (a = 1; a <= sizex; a++) {
+		pos = ((float)a) / (sizex - 1);
+		do_colorband(coba, pos, colf);
 		if (but->block->color_profile != BLI_PR_NONE)
 			linearrgb_to_srgb_v3_v3(colf, colf);
 		
-		v1[0]=v2[0]= x1 + a;
+		v1[0] = v2[0] = x1 + a;
 		
-		glColor4fv( colf );
+		glColor4fv(colf);
 		glVertex2fv(v1); glVertex2fv(v2);
 	}
 	
@@ -1107,23 +1104,23 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect)
 	
 	/* outline */
 	glColor4f(0.0, 0.0, 0.0, 1.0);
-	fdrawbox(x1, y1, x1+sizex, y1+sizey);
+	fdrawbox(x1, y1, x1 + sizex, y1 + sizey);
 	
 	/* help lines */
-	v1[0]= v2[0]=v3[0]= x1;
-	v1[1]= y1;
-	v1a[1]= y1+0.25f*sizey;
-	v2[1]= y1+0.5f*sizey;
-	v2a[1]= y1+0.75f*sizey;
-	v3[1]= y1+sizey;
+	v1[0] = v2[0] = v3[0] = x1;
+	v1[1] = y1;
+	v1a[1] = y1 + 0.25f * sizey;
+	v2[1] = y1 + 0.5f * sizey;
+	v2a[1] = y1 + 0.75f * sizey;
+	v3[1] = y1 + sizey;
 	
 	
-	cbd= coba->data;
+	cbd = coba->data;
 	glBegin(GL_LINES);
-	for(a=0; a<coba->tot; a++, cbd++) {
-		v1[0]=v2[0]=v3[0]=v1a[0]=v2a[0]= x1+ cbd->pos*sizex;
+	for (a = 0; a < coba->tot; a++, cbd++) {
+		v1[0] = v2[0] = v3[0] = v1a[0] = v2a[0] = x1 + cbd->pos * sizex;
 		
-		if(a==coba->cur) {
+		if (a == coba->cur) {
 			glColor3ub(0, 0, 0);
 			glVertex2fv(v1);
 			glVertex2fv(v3);
@@ -1138,7 +1135,8 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect)
 			setlinestyle(0);
 			glBegin(GL_LINES);
 			
-			/* glColor3ub(0, 0, 0);
+#if 0
+			glColor3ub(0, 0, 0);
 			glVertex2fv(v1);
 			glVertex2fv(v1a);
 			glColor3ub(255, 255, 255);
@@ -1150,7 +1148,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect)
 			glColor3ub(255, 255, 255);
 			glVertex2fv(v2a);
 			glVertex2fv(v3);
-			*/
+#endif
 		}
 		else {
 			glColor3ub(0, 0, 0);
@@ -1168,17 +1166,17 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect)
 
 void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)
 {
-	static GLuint displist=0;
+	static GLuint displist = 0;
 	int a, old[8];
-	GLfloat diff[4], diffn[4]={1.0f, 1.0f, 1.0f, 1.0f};
-	float vec0[4]={0.0f, 0.0f, 0.0f, 0.0f};
+	GLfloat diff[4], diffn[4] = {1.0f, 1.0f, 1.0f, 1.0f};
+	float vec0[4] = {0.0f, 0.0f, 0.0f, 0.0f};
 	float dir[4], size;
 	
 	/* store stuff */
 	glGetMaterialfv(GL_FRONT, GL_DIFFUSE, diff);
 		
 	/* backdrop */
-	glColor3ubv((unsigned char*)wcol->inner);
+	glColor3ubv((unsigned char *)wcol->inner);
 	uiSetRoundBox(UI_CNR_ALL);
 	uiDrawBox(GL_POLYGON, rect->xmin, rect->ymin, rect->xmax, rect->ymax, 5.0f);
 	
@@ -1187,9 +1185,9 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)
 	glCullFace(GL_BACK); glEnable(GL_CULL_FACE);
 	
 	/* disable blender light */
-	for(a=0; a<8; a++) {
-		old[a]= glIsEnabled(GL_LIGHT0+a);
-		glDisable(GL_LIGHT0+a);
+	for (a = 0; a < 8; a++) {
+		old[a] = glIsEnabled(GL_LIGHT0 + a);
+		glDisable(GL_LIGHT0 + a);
 	}
 	
 	/* own light */
@@ -1198,7 +1196,7 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)
 	
 	ui_get_but_vectorf(but, dir);
 
-	dir[3]= 0.0f;	/* glLight needs 4 args, 0.0 is sun */
+	dir[3] = 0.0f;   /* glLight needs 4 args, 0.0 is sun */
 	glLightfv(GL_LIGHT7, GL_POSITION, dir); 
 	glLightfv(GL_LIGHT7, GL_DIFFUSE, diffn); 
 	glLightfv(GL_LIGHT7, GL_SPECULAR, vec0); 
@@ -1207,25 +1205,25 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)
 	
 	/* transform to button */
 	glPushMatrix();
-	glTranslatef(rect->xmin + 0.5f*(rect->xmax-rect->xmin), rect->ymin+ 0.5f*(rect->ymax-rect->ymin), 0.0f);
+	glTranslatef(rect->xmin + 0.5f * (rect->xmax - rect->xmin), rect->ymin + 0.5f * (rect->ymax - rect->ymin), 0.0f);
 	
-	if( rect->xmax-rect->xmin < rect->ymax-rect->ymin)
-		size= (rect->xmax-rect->xmin)/200.f;
+	if (rect->xmax - rect->xmin < rect->ymax - rect->ymin)
+		size = (rect->xmax - rect->xmin) / 200.f;
 	else
-		size= (rect->ymax-rect->ymin)/200.f;
+		size = (rect->ymax - rect->ymin) / 200.f;
 	
 	glScalef(size, size, size);
 	
-	if(displist==0) {
-		GLUquadricObj	*qobj;
+	if (displist == 0) {
+		GLUquadricObj   *qobj;
 		
-		displist= glGenLists(1);
+		displist = glGenLists(1);
 		glNewList(displist, GL_COMPILE_AND_EXECUTE);
 		
-		qobj= gluNewQuadric();
+		qobj = gluNewQuadric();
 		gluQuadricDrawStyle(qobj, GLU_FILL); 
 		glShadeModel(GL_SMOOTH);
-		gluSphere( qobj, 100.0, 32, 24);
+		gluSphere(qobj, 100.0, 32, 24);
 		glShadeModel(GL_FLAT);
 		gluDeleteQuadric(qobj);  
 		
@@ -1241,19 +1239,19 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)
 	
 	/* AA circle */
 	glEnable(GL_BLEND);
-	glEnable(GL_LINE_SMOOTH );
-	glColor3ubv((unsigned char*)wcol->inner);
-	glutil_draw_lined_arc(0.0f, M_PI*2.0, 100.0f, 32);
+	glEnable(GL_LINE_SMOOTH);
+	glColor3ubv((unsigned char *)wcol->inner);
+	glutil_draw_lined_arc(0.0f, M_PI * 2.0, 100.0f, 32);
 	glDisable(GL_BLEND);
-	glDisable(GL_LINE_SMOOTH );
+	glDisable(GL_LINE_SMOOTH);
 
 	/* matrix after circle */
 	glPopMatrix();
 
 	/* enable blender light */
-	for(a=0; a<8; a++) {
-		if(old[a])
-			glEnable(GL_LIGHT0+a);
+	for (a = 0; a < 8; a++) {
+		if (old[a])
+			glEnable(GL_LIGHT0 + a);
 	}
 }
 
@@ -1262,22 +1260,22 @@ static void ui_draw_but_curve_grid(rcti *rect, float zoomx, float zoomy, float o
 	float dx, dy, fx, fy;
 	
 	glBegin(GL_LINES);
-	dx= step*zoomx;
-	fx= rect->xmin + zoomx*(-offsx);
-	if(fx > rect->xmin) fx -= dx*(floorf(fx-rect->xmin));
-	while(fx < rect->xmax) {
+	dx = step * zoomx;
+	fx = rect->xmin + zoomx * (-offsx);
+	if (fx > rect->xmin) fx -= dx * (floorf(fx - rect->xmin));
+	while (fx < rect->xmax) {
 		glVertex2f(fx, rect->ymin); 
 		glVertex2f(fx, rect->ymax);
-		fx+= dx;
+		fx += dx;
 	}
 	
-	dy= step*zoomy;
-	fy= rect->ymin + zoomy*(-offsy);
-	if(fy > rect->ymin) fy -= dy*(floorf(fy-rect->ymin));
-	while(fy < rect->ymax) {
+	dy = step * zoomy;
+	fy = rect->ymin + zoomy * (-offsy);
+	if (fy > rect->ymin) fy -= dy * (floorf(fy - rect->ymin));
+	while (fy < rect->ymax) {
 		glVertex2f(rect->xmin, fy); 
 		glVertex2f(rect->xmax, fy);
-		fy+= dy;
+		fy += dy;
 	}
 	glEnd();
 	
@@ -1285,9 +1283,9 @@ static void ui_draw_but_curve_grid(rcti *rect, float zoomx, float zoomy, float o
 
 static void glColor3ubvShade(unsigned char *col, int shade)
 {
-	glColor3ub(col[0]-shade>0?col[0]-shade:0,
-	           col[1]-shade>0?col[1]-shade:0,
-	           col[2]-shade>0?col[2]-shade:0);
+	glColor3ub(col[0] - shade > 0 ? col[0] - shade : 0,
+	           col[1] - shade > 0 ? col[1] - shade : 0,
+	           col[2] - shade > 0 ? col[2] - shade : 0);
 }
 
 void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect)
@@ -1300,36 +1298,36 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
 	rcti scissor_new;
 	int a;
 
-	cumap= (CurveMapping *)(but->editcumap? but->editcumap: but->poin);
-	cuma= cumap->cm+cumap->cur;
+	cumap = (CurveMapping *)(but->editcumap ? but->editcumap : but->poin);
+	cuma = cumap->cm + cumap->cur;
 	
 	/* need scissor test, curve can draw outside of boundary */
 	glGetIntegerv(GL_VIEWPORT, scissor);
-	scissor_new.xmin= ar->winrct.xmin + rect->xmin;
-	scissor_new.ymin= ar->winrct.ymin + rect->ymin;
-	scissor_new.xmax= ar->winrct.xmin + rect->xmax;
-	scissor_new.ymax= ar->winrct.ymin + rect->ymax;
+	scissor_new.xmin = ar->winrct.xmin + rect->xmin;
+	scissor_new.ymin = ar->winrct.ymin + rect->ymin;
+	scissor_new.xmax = ar->winrct.xmin + rect->xmax;
+	scissor_new.ymax = ar->winrct.ymin + rect->ymax;
 	BLI_isect_rcti(&scissor_new, &ar->winrct, &scissor_new);
-	glScissor(scissor_new.xmin, scissor_new.ymin, scissor_new.xmax-scissor_new.xmin, scissor_new.ymax-scissor_new.ymin);
+	glScissor(scissor_new.xmin, scissor_new.ymin, scissor_new.xmax - scissor_new.xmin, scissor_new.ymax - scissor_new.ymin);
 	
 	/* calculate offset and zoom */
-	zoomx= (rect->xmax-rect->xmin-2.0f*but->aspect)/(cumap->curr.xmax - cumap->curr.xmin);
-	zoomy= (rect->ymax-rect->ymin-2.0f*but->aspect)/(cumap->curr.ymax - cumap->curr.ymin);
-	offsx= cumap->curr.xmin-but->aspect/zoomx;
-	offsy= cumap->curr.ymin-but->aspect/zoomy;
+	zoomx = (rect->xmax - rect->xmin - 2.0f * but->aspect) / (cumap->curr.xmax - cumap->curr.xmin);
+	zoomy = (rect->ymax - rect->ymin - 2.0f * but->aspect) / (cumap->curr.ymax - cumap->curr.ymin);
+	offsx = cumap->curr.xmin - but->aspect / zoomx;
+	offsy = cumap->curr.ymin - but->aspect / zoomy;
 	
 	/* backdrop */
-	if(cumap->flag & CUMA_DO_CLIP) {
+	if (cumap->flag & CUMA_DO_CLIP) {
 		glColor3ubvShade((unsigned char *)wcol->inner, -20);
 		glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
-		glColor3ubv((unsigned char*)wcol->inner);
-		glRectf(rect->xmin + zoomx*(cumap->clipr.xmin-offsx),
-				rect->ymin + zoomy*(cumap->clipr.ymin-offsy),
-				rect->xmin + zoomx*(cumap->clipr.xmax-offsx),
-				rect->ymin + zoomy*(cumap->clipr.ymax-offsy));
+		glColor3ubv((unsigned char *)wcol->inner);
+		glRectf(rect->xmin + zoomx * (cumap->clipr.xmin - offsx),
+		        rect->ymin + zoomy * (cumap->clipr.ymin - offsy),
+		        rect->xmin + zoomx * (cumap->clipr.xmax - offsx),
+		        rect->ymin + zoomy * (cumap->clipr.ymax - offsy));
 	}
 	else {
-		glColor3ubv((unsigned char*)wcol->inner);
+		glColor3ubv((unsigned char *)wcol->inner);
 		glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
 	}
 		
@@ -1342,22 +1340,22 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
 	/* axes */
 	glColor3ubvShade((unsigned char *)wcol->inner, -50);
 	glBegin(GL_LINES);
-	glVertex2f(rect->xmin, rect->ymin + zoomy*(-offsy));
-	glVertex2f(rect->xmax, rect->ymin + zoomy*(-offsy));
-	glVertex2f(rect->xmin + zoomx*(-offsx), rect->ymin);
-	glVertex2f(rect->xmin + zoomx*(-offsx), rect->ymax);
+	glVertex2f(rect->xmin, rect->ymin + zoomy * (-offsy));
+	glVertex2f(rect->xmax, rect->ymin + zoomy * (-offsy));
+	glVertex2f(rect->xmin + zoomx * (-offsx), rect->ymin);
+	glVertex2f(rect->xmin + zoomx * (-offsx), rect->ymax);
 	glEnd();
 	
 	/* magic trigger for curve backgrounds */
 	if (but->a1 != -1) {
 		if (but->a1 == UI_GRAD_H) {
 			rcti grid;
-			float col[3]= {0.0f, 0.0f, 0.0f}; /* dummy arg */
+			float col[3] = {0.0f, 0.0f, 0.0f}; /* dummy arg */
 			
-			grid.xmin = rect->xmin + zoomx*(-offsx);
-			grid.xmax = rect->xmax + zoomx*(-offsx);
-			grid.ymin = rect->ymin + zoomy*(-offsy);
-			grid.ymax = rect->ymax + zoomy*(-offsy);
+			grid.xmin = rect->xmin + zoomx * (-offsx);
+			grid.xmax = rect->xmax + zoomx * (-offsx);
+			grid.ymin = rect->ymin + zoomy * (-offsy);
+			grid.ymax = rect->ymax + zoomy * (-offsy);
 			
 			glEnable(GL_BLEND);
 			ui_draw_gradient(&grid, col, UI_GRAD_H, 0.5f);
@@ -1367,70 +1365,75 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
 	
 	
 	/* cfra option */
-	/* XXX 2.48
-	if(cumap->flag & CUMA_DRAW_CFRA) {
+	/* XXX 2.48 */
+#if 0
+	if (cumap->flag & CUMA_DRAW_CFRA) {
 		glColor3ub(0x60, 0xc0, 0x40);
 		glBegin(GL_LINES);
-		glVertex2f(rect->xmin + zoomx*(cumap->sample[0]-offsx), rect->ymin);
-		glVertex2f(rect->xmin + zoomx*(cumap->sample[0]-offsx), rect->ymax);
+		glVertex2f(rect->xmin + zoomx * (cumap->sample[0] - offsx), rect->ymin);
+		glVertex2f(rect->xmin + zoomx * (cumap->sample[0] - offsx), rect->ymax);
 		glEnd();
-	}*/
+	}
+#endif
 	/* sample option */
-	/* XXX 2.48
-	 * if(cumap->flag & CUMA_DRAW_SAMPLE) {
-		if(cumap->cur==3) {
-			float lum= cumap->sample[0]*0.35f + cumap->sample[1]*0.45f + cumap->sample[2]*0.2f;
+
+	/* XXX 2.48 */
+#if 0
+	if (cumap->flag & CUMA_DRAW_SAMPLE) {
+		if (cumap->cur == 3) {
+			float lum = cumap->sample[0] * 0.35f + cumap->sample[1] * 0.45f + cumap->sample[2] * 0.2f;
 			glColor3ub(240, 240, 240);
 			
 			glBegin(GL_LINES);
-			glVertex2f(rect->xmin + zoomx*(lum-offsx), rect->ymin);
-			glVertex2f(rect->xmin + zoomx*(lum-offsx), rect->ymax);
+			glVertex2f(rect->xmin + zoomx * (lum - offsx), rect->ymin);
+			glVertex2f(rect->xmin + zoomx * (lum - offsx), rect->ymax);
 			glEnd();
 		}
 		else {
-			if(cumap->cur==0)
+			if (cumap->cur == 0)
 				glColor3ub(240, 100, 100);
-			else if(cumap->cur==1)
+			else if (cumap->cur == 1)
 				glColor3ub(100, 240, 100);
 			else
 				glColor3ub(100, 100, 240);
 			
 			glBegin(GL_LINES);
-			glVertex2f(rect->xmin + zoomx*(cumap->sample[cumap->cur]-offsx), rect->ymin);
-			glVertex2f(rect->xmin + zoomx*(cumap->sample[cumap->cur]-offsx), rect->ymax);
+			glVertex2f(rect->xmin + zoomx * (cumap->sample[cumap->cur] - offsx), rect->ymin);
+			glVertex2f(rect->xmin + zoomx * (cumap->sample[cumap->cur] - offsx), rect->ymax);
 			glEnd();
 		}
-	}*/
-	
+	}
+#endif
+
 	/* the curve */
-	glColor3ubv((unsigned char*)wcol->item);
+	glColor3ubv((unsigned char *)wcol->item);
 	glEnable(GL_LINE_SMOOTH);
 	glEnable(GL_BLEND);
 	glBegin(GL_LINE_STRIP);
 	
-	if(cuma->table==NULL)
-		curvemapping_changed(cumap, 0);	/* 0 = no remove doubles */
-	cmp= cuma->table;
+	if (cuma->table == NULL)
+		curvemapping_changed(cumap, 0);  /* 0 = no remove doubles */
+	cmp = cuma->table;
 	
 	/* first point */
-	if((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0)
-		glVertex2f(rect->xmin, rect->ymin + zoomy*(cmp[0].y-offsy));
+	if ((cuma->flag & CUMA_EXTEND_EXTRAPOLATE) == 0)
+		glVertex2f(rect->xmin, rect->ymin + zoomy * (cmp[0].y - offsy));
 	else {
-		fx= rect->xmin + zoomx*(cmp[0].x-offsx + cuma->ext_in[0]);
-		fy= rect->ymin + zoomy*(cmp[0].y-offsy + cuma->ext_in[1]);
+		fx = rect->xmin + zoomx * (cmp[0].x - offsx + cuma->ext_in[0]);
+		fy = rect->ymin + zoomy * (cmp[0].y - offsy + cuma->ext_in[1]);
 		glVertex2f(fx, fy);
 	}
-	for(a=0; a<=CM_TABLE; a++) {
-		fx= rect->xmin + zoomx*(cmp[a].x-offsx);
-		fy= rect->ymin + zoomy*(cmp[a].y-offsy);
+	for (a = 0; a <= CM_TABLE; a++) {
+		fx = rect->xmin + zoomx * (cmp[a].x - offsx);
+		fy = rect->ymin + zoomy * (cmp[a].y - offsy);
 		glVertex2f(fx, fy);
 	}
 	/* last point */
-	if((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0)
-		glVertex2f(rect->xmax, rect->ymin + zoomy*(cmp[CM_TABLE].y-offsy));	
+	if ((cuma->flag & CUMA_EXTEND_EXTRAPOLATE) == 0)
+		glVertex2f(rect->xmax, rect->ymin + zoomy * (cmp[CM_TABLE].y - offsy));
 	else {
-		fx= rect->xmin + zoomx*(cmp[CM_TABLE].x-offsx - cuma->ext_out[0]);
-		fy= rect->ymin + zoomy*(cmp[CM_TABLE].y-offsy - cuma->ext_out[1]);
+		fx = rect->xmin + zoomx * (cmp[CM_TABLE].x - offsx - cuma->ext_out[0]);
+		fy = rect->ymin + zoomy * (cmp[CM_TABLE].y - offsy - cuma->ext_out[1]);
 		glVertex2f(fx, fy);
 	}
 	glEnd();
@@ -1438,16 +1441,16 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
 	glDisable(GL_BLEND);
 
 	/* the points, use aspect to make them visible on edges */
-	cmp= cuma->curve;
+	cmp = cuma->curve;
 	glPointSize(3.0f);
 	bglBegin(GL_POINTS);
-	for(a=0; a<cuma->totpoint; a++) {
-		if(cmp[a].flag & SELECT)
+	for (a = 0; a < cuma->totpoint; a++) {
+		if (cmp[a].flag & SELECT)
 			UI_ThemeColor(TH_TEXT_HI);
 		else
 			UI_ThemeColor(TH_TEXT);
-		fac[0]= rect->xmin + zoomx*(cmp[a].x-offsx);
-		fac[1]= rect->ymin + zoomy*(cmp[a].y-offsy);
+		fac[0] = rect->xmin + zoomx * (cmp[a].x - offsx);
+		fac[1] = rect->ymin + zoomy * (cmp[a].y - offsy);
 		bglVertex2fv(fac);
 	}
 	bglEnd();
@@ -1457,25 +1460,25 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
 	glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
 
 	/* outline */
-	glColor3ubv((unsigned char*)wcol->outline);
+	glColor3ubv((unsigned char *)wcol->outline);
 	fdrawbox(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
 }
 
 static ImBuf *scale_trackpreview_ibuf(ImBuf *ibuf, float track_pos[2], int width, float height, int margin)
 {
 	ImBuf *scaleibuf;
-	const float scalex= ((float)ibuf->x-2*margin) / width;
-	const float scaley= ((float)ibuf->y-2*margin) / height;
-	float off_x= (int)track_pos[0]-track_pos[0]+0.5f;
-	float off_y= (int)track_pos[1]-track_pos[1]+0.5f;
+	const float scalex = ((float)ibuf->x - 2 * margin) / width;
+	const float scaley = ((float)ibuf->y - 2 * margin) / height;
+	float off_x = (int)track_pos[0] - track_pos[0] + 0.5f;
+	float off_y = (int)track_pos[1] - track_pos[1] + 0.5f;
 	int x, y;
 
-	scaleibuf= IMB_allocImBuf(width, height, 32, IB_rect);
+	scaleibuf = IMB_allocImBuf(width, height, 32, IB_rect);
 
-	for(y= 0; y<height; y++) {
-		for (x= 0; x<width; x++) {
-			float src_x= scalex*(x)+margin-off_x;
-			float src_y= scaley*(y)+margin-off_y;
+	for (y = 0; y < height; y++) {
+		for (x = 0; x < width; x++) {
+			float src_x = scalex * (x) + margin - off_x;
+			float src_y = scaley * (y) + margin - off_y;
 
 			bicubic_interpolation(ibuf, scaleibuf, src_x, src_y, x, y);
 		}
@@ -1487,67 +1490,67 @@ static ImBuf *scale_trackpreview_ibuf(ImBuf *ibuf, float track_pos[2], int width
 void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti)
 {
 	rctf rect;
-	int ok= 0;
+	int ok = 0;
 	GLint scissor[4];
 	MovieClipScopes *scopes = (MovieClipScopes *)but->poin;
 
-	rect.xmin = (float)recti->xmin+1;
-	rect.xmax = (float)recti->xmax-1;
-	rect.ymin = (float)recti->ymin+SCOPE_RESIZE_PAD+2;
-	rect.ymax = (float)recti->ymax-1;
+	rect.xmin = (float)recti->xmin + 1;
+	rect.xmax = (float)recti->xmax - 1;
+	rect.ymin = (float)recti->ymin + SCOPE_RESIZE_PAD + 2;
+	rect.ymax = (float)recti->ymax - 1;
 
 	glEnable(GL_BLEND);
-	glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 
 	/* need scissor test, preview image can draw outside of boundary */
 	glGetIntegerv(GL_VIEWPORT, scissor);
-	glScissor(ar->winrct.xmin + (rect.xmin-1), ar->winrct.ymin+(rect.ymin-1), (rect.xmax+1)-(rect.xmin-1), (rect.ymax+1)-(rect.ymin-1));
+	glScissor(ar->winrct.xmin + (rect.xmin - 1), ar->winrct.ymin + (rect.ymin - 1), (rect.xmax + 1) - (rect.xmin - 1), (rect.ymax + 1) - (rect.ymin - 1));
 
-	if(scopes->track_disabled) {
+	if (scopes->track_disabled) {
 		glColor4f(0.7f, 0.3f, 0.3f, 0.3f);
 		uiSetRoundBox(15);
-		uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin, rect.xmax+1, rect.ymax+1, 3.0f);
+		uiDrawBox(GL_POLYGON, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f);
 
-		ok= 1;
+		ok = 1;
 	}
-	else if(scopes->track_preview) {
+	else if (scopes->track_preview) {
 		/* additional margin around image */
 		/* NOTE: should be kept in sync with value from BKE_movieclip_update_scopes */
-		const int margin= 3;
+		const int margin = 3;
 		float zoomx, zoomy, track_pos[2], off_x, off_y;
 		int a, width, height;
 		ImBuf *drawibuf;
 
 		glPushMatrix();
 
-		track_pos[0]= scopes->track_pos[0]-margin;
-		track_pos[1]= scopes->track_pos[1]-margin;
+		track_pos[0] = scopes->track_pos[0] - margin;
+		track_pos[1] = scopes->track_pos[1] - margin;
 
 		/* draw content of pattern area */
-		glScissor(ar->winrct.xmin+rect.xmin, ar->winrct.ymin+rect.ymin, scissor[2], scissor[3]);
+		glScissor(ar->winrct.xmin + rect.xmin, ar->winrct.ymin + rect.ymin, scissor[2], scissor[3]);
 
-		width= rect.xmax-rect.xmin+1;
-		height = rect.ymax-rect.ymin;
+		width = rect.xmax - rect.xmin + 1;
+		height = rect.ymax - rect.ymin;
 
-		if(width > 0 && height > 0) {
-			zoomx= (float)width / (scopes->track_preview->x-2*margin);
-			zoomy= (float)height / (scopes->track_preview->y-2*margin);
+		if (width > 0 && height > 0) {
+			zoomx = (float)width / (scopes->track_preview->x - 2 * margin);
+			zoomy = (float)height / (scopes->track_preview->y - 2 * margin);
 
-			off_x= ((int)track_pos[0]-track_pos[0]+0.5f)*zoomx;
-			off_y= ((int)track_pos[1]-track_pos[1]+0.5f)*zoomy;
+			off_x = ((int)track_pos[0] - track_pos[0] + 0.5f) * zoomx;
+			off_y = ((int)track_pos[1] - track_pos[1] + 0.5f) * zoomy;
 
-			drawibuf= scale_trackpreview_ibuf(scopes->track_preview, track_pos, width, height, margin);
+			drawibuf = scale_trackpreview_ibuf(scopes->track_preview, track_pos, width, height, margin);
 
-			glaDrawPixelsSafe(rect.xmin, rect.ymin+1, drawibuf->x, drawibuf->y,
+			glaDrawPixelsSafe(rect.xmin, rect.ymin + 1, drawibuf->x, drawibuf->y,
 			                  drawibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, drawibuf->rect);
 			IMB_freeImBuf(drawibuf);
 
 			/* draw cross for pizel position */
-			glTranslatef(off_x+rect.xmin+track_pos[0]*zoomx, off_y+rect.ymin+track_pos[1]*zoomy, 0.f);
-			glScissor(ar->winrct.xmin + rect.xmin, ar->winrct.ymin+rect.ymin, rect.xmax-rect.xmin, rect.ymax-rect.ymin);
+			glTranslatef(off_x + rect.xmin + track_pos[0] * zoomx, off_y + rect.ymin + track_pos[1] * zoomy, 0.f);
+			glScissor(ar->winrct.xmin + rect.xmin, ar->winrct.ymin + rect.ymin, rect.xmax - rect.xmin, rect.ymax - rect.ymin);
 
-			for(a= 0; a< 2; a++) {
-				if(a==1) {
+			for (a = 0; a < 2; a++) {
+				if (a == 1) {
 					glLineStipple(3, 0xaaaa);
 					glEnable(GL_LINE_STIPPLE);
 					UI_ThemeColor(TH_SEL_MARKER);
@@ -1557,24 +1560,24 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc
 				}
 
 				glBegin(GL_LINES);
-					glVertex2f(-10.0f, 0.0f);
-					glVertex2f(10.0f, 0.0f);
-					glVertex2f(0.0f, -10.0f);
-					glVertex2f(0.0f, 10.0f);
-					glEnd();
+				glVertex2f(-10.0f, 0.0f);
+				glVertex2f(10.0f, 0.0f);
+				glVertex2f(0.0f, -10.0f);
+				glVertex2f(0.0f, 10.0f);
+				glEnd();
 			}
 		}
 
 		glDisable(GL_LINE_STIPPLE);
 		glPopMatrix();
 
-		ok= 1;
+		ok = 1;
 	}
 
-	if(!ok) {
+	if (!ok) {
 		glColor4f(0.f, 0.f, 0.f, 0.3f);
 		uiSetRoundBox(15);
-		uiDrawBox(GL_POLYGON, rect.xmin-1, rect.ymin, rect.xmax+1, rect.ymax+1, 3.0f);
+		uiDrawBox(GL_POLYGON, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f);
 	}
 
 	/* outline, scale gripper */
@@ -1595,10 +1598,10 @@ static void ui_shadowbox(float minx, float miny, float maxx, float maxy, float s
 	glBegin(GL_POLYGON);
 	glColor4ub(0, 0, 0, alpha);
 	glVertex2f(maxx, miny);
-	glVertex2f(maxx, maxy-0.3f*shadsize);
+	glVertex2f(maxx, maxy - 0.3f * shadsize);
 	glColor4ub(0, 0, 0, 0);
-	glVertex2f(maxx+shadsize, maxy-0.75f*shadsize);
-	glVertex2f(maxx+shadsize, miny);
+	glVertex2f(maxx + shadsize, maxy - 0.75f * shadsize);
+	glVertex2f(maxx + shadsize, miny);
 	glEnd();
 	
 	/* corner shape */
@@ -1606,19 +1609,19 @@ static void ui_shadowbox(float minx, float miny, float maxx, float maxy, float s
 	glColor4ub(0, 0, 0, alpha);
 	glVertex2f(maxx, miny);
 	glColor4ub(0, 0, 0, 0);
-	glVertex2f(maxx+shadsize, miny);
-	glVertex2f(maxx+0.7f*shadsize, miny-0.7f*shadsize);
-	glVertex2f(maxx, miny-shadsize);
+	glVertex2f(maxx + shadsize, miny);
+	glVertex2f(maxx + 0.7f * shadsize, miny - 0.7f * shadsize);
+	glVertex2f(maxx, miny - shadsize);
 	glEnd();
 	
 	/* bottom quad */		
 	glBegin(GL_POLYGON);
 	glColor4ub(0, 0, 0, alpha);
-	glVertex2f(minx+0.3f*shadsize, miny);
+	glVertex2f(minx + 0.3f * shadsize, miny);
 	glVertex2f(maxx, miny);
 	glColor4ub(0, 0, 0, 0);
-	glVertex2f(maxx, miny-shadsize);
-	glVertex2f(minx+0.5f*shadsize, miny-shadsize);
+	glVertex2f(maxx, miny - shadsize);
+	glVertex2f(minx + 0.5f * shadsize, miny - shadsize);
 	glEnd();
 	
 	glDisable(GL_BLEND);
@@ -1628,9 +1631,9 @@ static void ui_shadowbox(float minx, float miny, float maxx, float maxy, float s
 void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, float maxy)
 {
 	/* accumulated outline boxes to make shade not linear, is more pleasant */
-	ui_shadowbox(minx, miny, maxx, maxy, 11.0, (20*alpha)>>8);
-	ui_shadowbox(minx, miny, maxx, maxy, 7.0, (40*alpha)>>8);
-	ui_shadowbox(minx, miny, maxx, maxy, 5.0, (80*alpha)>>8);
+	ui_shadowbox(minx, miny, maxx, maxy, 11.0, (20 * alpha) >> 8);
+	ui_shadowbox(minx, miny, maxx, maxy, 7.0, (40 * alpha) >> 8);
+	ui_shadowbox(minx, miny, maxx, maxy, 5.0, (80 * alpha) >> 8);
 	
 }
 
@@ -1640,39 +1643,39 @@ void ui_dropshadow(rctf *rct, float radius, float aspect, int UNUSED(select))
 	int i;
 	float rad;
 	float a;
-	char alpha= 2;
+	char alpha = 2;
 	
 	glEnable(GL_BLEND);
 	
-	if(radius > (rct->ymax-rct->ymin-10.0f)/2.0f)
-		rad= (rct->ymax-rct->ymin-10.0f)/2.0f;
+	if (radius > (rct->ymax - rct->ymin - 10.0f) / 2.0f)
+		rad = (rct->ymax - rct->ymin - 10.0f) / 2.0f;
 	else
-		rad= radius;
+		rad = radius;
 
-	i= 12;
+	i = 12;
 #if 0
-	if(select) {
-		a= i*aspect; /* same as below */
+	if (select) {
+		a = i * aspect; /* same as below */
 	}
 	else
 #endif
 	{
-		a= i*aspect;
+		a = i * aspect;
 	}
 
-	for(; i--; a-=aspect) {
+	for (; i--; a -= aspect) {
 		/* alpha ranges from 2 to 20 or so */
 		glColor4ub(0, 0, 0, alpha);
-		alpha+= 2;
+		alpha += 2;
 		
-		uiDrawBox(GL_POLYGON, rct->xmin - a, rct->ymin - a, rct->xmax + a, rct->ymax-10.0f + a, rad+a);
+		uiDrawBox(GL_POLYGON, rct->xmin - a, rct->ymin - a, rct->xmax + a, rct->ymax - 10.0f + a, rad + a);
 	}
 	
 	/* outline emphasis */
-	glEnable( GL_LINE_SMOOTH );
+	glEnable(GL_LINE_SMOOTH);
 	glColor4ub(0, 0, 0, 100);
-	uiDrawBox(GL_LINE_LOOP, rct->xmin-0.5f, rct->ymin-0.5f, rct->xmax+0.5f, rct->ymax+0.5f, radius+0.5f);
-	glDisable( GL_LINE_SMOOTH );
+	uiDrawBox(GL_LINE_LOOP, rct->xmin - 0.5f, rct->ymin - 0.5f, rct->xmax + 0.5f, rct->ymax + 0.5f, radius + 0.5f);
+	glDisable(GL_LINE_SMOOTH);
 	
 	glDisable(GL_BLEND);
 }
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 7e413cf..a7ff156 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -48,6 +48,7 @@
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
+#include "BLI_string_cursor_utf8.h"
 
 #include "PIL_time.h"
 
@@ -80,11 +81,11 @@ static void ui_add_link(bContext *C, uiBut *from, uiBut *to);
 
 /***************** structs and defines ****************/
 
-#define BUTTON_TOOLTIP_DELAY		0.500
-#define BUTTON_FLASH_DELAY			0.020
-#define MENU_SCROLL_INTERVAL		0.1
-#define BUTTON_AUTO_OPEN_THRESH		0.3
-#define BUTTON_MOUSE_TOWARDS_THRESH	1.0
+#define BUTTON_TOOLTIP_DELAY        0.500
+#define BUTTON_FLASH_DELAY          0.020
+#define MENU_SCROLL_INTERVAL        0.1
+#define BUTTON_AUTO_OPEN_THRESH     0.3
+#define BUTTON_MOUSE_TOWARDS_THRESH 1.0
 
 typedef enum uiButtonActivateType {
 	BUTTON_ACTIVATE_OVER,
@@ -108,23 +109,6 @@ typedef enum uiHandleButtonState {
 	BUTTON_STATE_EXIT
 } uiHandleButtonState;
 
-typedef enum uiButtonJumpType {
-	BUTTON_EDIT_JUMP_NONE,
-	BUTTON_EDIT_JUMP_DELIM,
-	BUTTON_EDIT_JUMP_ALL
-} uiButtonJumpType;
-
-typedef enum uiButtonDelimType {
-	BUTTON_DELIM_NONE,
-	BUTTON_DELIM_ALPHA,
-	BUTTON_DELIM_PUNCT,
-	BUTTON_DELIM_BRACE,
-	BUTTON_DELIM_OPERATOR,
-	BUTTON_DELIM_QUOTE,
-	BUTTON_DELIM_WHITESPACE,
-	BUTTON_DELIM_OTHER
-} uiButtonDelimType;
-
 typedef struct uiHandleButtonData {
 	wmWindowManager *wm;
 	wmWindow *window;
@@ -228,18 +212,18 @@ static int ui_but_editable(uiBut *but)
 
 static uiBut *ui_but_prev(uiBut *but)
 {
-	while(but->prev) {
-		but= but->prev;
-		if(!ui_but_editable(but)) return but;
+	while (but->prev) {
+		but = but->prev;
+		if (!ui_but_editable(but)) return but;
 	}
 	return NULL;
 }
 
 static uiBut *ui_but_next(uiBut *but)
 {
-	while(but->next) {
-		but= but->next;
-		if(!ui_but_editable(but)) return but;
+	while (but->next) {
+		but = but->next;
+		if (!ui_but_editable(but)) return but;
 	}
 	return NULL;
 }
@@ -248,10 +232,10 @@ static uiBut *ui_but_first(uiBlock *block)
 {
 	uiBut *but;
 	
-	but= block->buttons.first;
-	while(but) {
-		if(!ui_but_editable(but)) return but;
-		but= but->next;
+	but = block->buttons.first;
+	while (but) {
+		if (!ui_but_editable(but)) return but;
+		but = but->next;
 	}
 	return NULL;
 }
@@ -260,18 +244,18 @@ static uiBut *ui_but_last(uiBlock *block)
 {
 	uiBut *but;
 	
-	but= block->buttons.last;
-	while(but) {
-		if(!ui_but_editable(but)) return but;
-		but= but->prev;
+	but = block->buttons.last;
+	while (but) {
+		if (!ui_but_editable(but)) return but;
+		but = but->prev;
 	}
 	return NULL;
 }
 
 static int ui_is_a_warp_but(uiBut *but)
 {
-	if(U.uiflag & USER_CONTINUOUS_MOUSE)
-		if(ELEM4(but->type, NUM, NUMABS, HSVCIRCLE, TRACKPREVIEW))
+	if (U.uiflag & USER_CONTINUOUS_MOUSE)
+		if (ELEM4(but->type, NUM, NUMABS, HSVCIRCLE, TRACKPREVIEW))
 			return TRUE;
 
 	return FALSE;
@@ -281,7 +265,7 @@ static int ui_is_a_warp_but(uiBut *but)
 int ui_is_but_utf8(uiBut *but)
 {
 	if (but->rnaprop) {
-		const int subtype= RNA_property_subtype(but->rnaprop);
+		const int subtype = RNA_property_subtype(but->rnaprop);
 		return !(ELEM4(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME, PROP_BYTESTRING));
 	}
 	else {
@@ -296,56 +280,56 @@ static ListBase UIAfterFuncs = {NULL, NULL};
 static void ui_apply_but_func(bContext *C, uiBut *but)
 {
 	uiAfterFunc *after;
-	uiBlock *block= but->block;
+	uiBlock *block = but->block;
 
 	/* these functions are postponed and only executed after all other
 	 * handling is done, i.e. menus are closed, in order to avoid conflicts
 	 * with these functions removing the buttons we are working with */
 
-	if(but->func || but->funcN || block->handle_func || but->rename_func || (but->type == BUTM && block->butm_func) || but->optype || but->rnaprop) {
-		after= MEM_callocN(sizeof(uiAfterFunc), "uiAfterFunc");
+	if (but->func || but->funcN || block->handle_func || but->rename_func || (but->type == BUTM && block->butm_func) || but->optype || but->rnaprop) {
+		after = MEM_callocN(sizeof(uiAfterFunc), "uiAfterFunc");
 
-		if(but->func && ELEM(but, but->func_arg1, but->func_arg2)) {
+		if (but->func && ELEM(but, but->func_arg1, but->func_arg2)) {
 			/* exception, this will crash due to removed button otherwise */
 			but->func(C, but->func_arg1, but->func_arg2);
 		}
 		else
-			after->func= but->func;
+			after->func = but->func;
 
-		after->func_arg1= but->func_arg1;
-		after->func_arg2= but->func_arg2;
-		after->func_arg3= but->func_arg3;
+		after->func_arg1 = but->func_arg1;
+		after->func_arg2 = but->func_arg2;
+		after->func_arg3 = but->func_arg3;
 
-		after->funcN= but->funcN;
-		after->func_argN= MEM_dupallocN(but->func_argN);
+		after->funcN = but->funcN;
+		after->func_argN = MEM_dupallocN(but->func_argN);
 
-		after->rename_func= but->rename_func;
-		after->rename_arg1= but->rename_arg1;
-		after->rename_orig= but->rename_orig; /* needs free! */
-		
-		after->handle_func= block->handle_func;
-		after->handle_func_arg= block->handle_func_arg;
-		after->retval= but->retval;
+		after->rename_func = but->rename_func;
+		after->rename_arg1 = but->rename_arg1;
+		after->rename_orig = but->rename_orig; /* needs free! */
 
-		if(but->type == BUTM) {
-			after->butm_func= block->butm_func;
-			after->butm_func_arg= block->butm_func_arg;
-			after->a2= but->a2;
+		after->handle_func = block->handle_func;
+		after->handle_func_arg = block->handle_func_arg;
+		after->retval = but->retval;
+
+		if (but->type == BUTM) {
+			after->butm_func = block->butm_func;
+			after->butm_func_arg = block->butm_func_arg;
+			after->a2 = but->a2;
 		}
 
-		after->optype= but->optype;
-		after->opcontext= but->opcontext;
-		after->opptr= but->opptr;
+		after->optype = but->optype;
+		after->opcontext = but->opcontext;
+		after->opptr = but->opptr;
 
-		after->rnapoin= but->rnapoin;
-		after->rnaprop= but->rnaprop;
+		after->rnapoin = but->rnapoin;
+		after->rnaprop = but->rnaprop;
 
-		if(but->context)
-			after->context= CTX_store_copy(but->context);
+		if (but->context)
+			after->context = CTX_store_copy(but->context);
 
-		but->optype= NULL;
-		but->opcontext= 0;
-		but->opptr= NULL;
+		but->optype = NULL;
+		but->opcontext = 0;
+		but->opptr = NULL;
 
 		BLI_addtail(&UIAfterFuncs, after);
 	}
@@ -353,25 +337,25 @@ static void ui_apply_but_func(bContext *C, uiBut *but)
 
 static void ui_apply_autokey_undo(bContext *C, uiBut *but)
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	uiAfterFunc *after;
 
-	if(but->flag & UI_BUT_UNDO) {
-		const char *str= NULL;
+	if (but->flag & UI_BUT_UNDO) {
+		const char *str = NULL;
 
 		/* define which string to use for undo */
-		if ELEM(but->type, LINK, INLINK) str= "Add button link";
-		else if ELEM(but->type, MENU, ICONTEXTROW) str= but->drawstr;
-		else if(but->drawstr[0]) str= but->drawstr;
-		else str= but->tip;
+		if (ELEM(but->type, LINK, INLINK)) str = "Add button link";
+		else if (ELEM(but->type, MENU, ICONTEXTROW)) str = but->drawstr;
+		else if (but->drawstr[0]) str = but->drawstr;
+		else str = but->tip;
 
-		/* fallback, else we dont get an undo! */
-		if(str == NULL || str[0] == '\0') {
-			str= "Unknown Action";
+		/* fallback, else we don't get an undo! */
+		if (str == NULL || str[0] == '\0') {
+			str = "Unknown Action";
 		}
 
 		/* delayed, after all other funcs run, popups are closed, etc */
-		after= MEM_callocN(sizeof(uiAfterFunc), "uiAfterFunc");
+		after = MEM_callocN(sizeof(uiAfterFunc), "uiAfterFunc");
 		BLI_strncpy(after->undostr, str, sizeof(after->undostr));
 		BLI_addtail(&UIAfterFuncs, after);
 	}
@@ -387,54 +371,54 @@ static void ui_apply_but_funcs_after(bContext *C)
 	ListBase funcs;
 
 	/* copy to avoid recursive calls */
-	funcs= UIAfterFuncs;
-	UIAfterFuncs.first= UIAfterFuncs.last= NULL;
+	funcs = UIAfterFuncs;
+	UIAfterFuncs.first = UIAfterFuncs.last = NULL;
 
-	for(afterf=funcs.first; afterf; afterf=after.next) {
-		after= *afterf; /* copy to avoid memleak on exit() */
+	for (afterf = funcs.first; afterf; afterf = after.next) {
+		after = *afterf; /* copy to avoid memleak on exit() */
 		BLI_freelinkN(&funcs, afterf);
 
-		if(after.context)
+		if (after.context)
 			CTX_store_set(C, after.context);
 
-		if(after.opptr) {
+		if (after.opptr) {
 			/* free in advance to avoid leak on exit */
-			opptr= *after.opptr,
+			opptr = *after.opptr,
 			MEM_freeN(after.opptr);
 		}
 
-		if(after.optype)
-			WM_operator_name_call(C, after.optype->idname, after.opcontext, (after.opptr)? &opptr: NULL);
+		if (after.optype)
+			WM_operator_name_call(C, after.optype->idname, after.opcontext, (after.opptr) ? &opptr : NULL);
 
-		if(after.opptr)
+		if (after.opptr)
 			WM_operator_properties_free(&opptr);
 
-		if(after.rnapoin.data)
+		if (after.rnapoin.data)
 			RNA_property_update(C, &after.rnapoin, after.rnaprop);
 
-		if(after.context) {
+		if (after.context) {
 			CTX_store_set(C, NULL);
 			CTX_store_free(after.context);
 		}
 
-		if(after.func)
+		if (after.func)
 			after.func(C, after.func_arg1, after.func_arg2);
-		if(after.funcN)
+		if (after.funcN)
 			after.funcN(C, after.func_argN, after.func_arg2);
-		if(after.func_argN)
+		if (after.func_argN)
 			MEM_freeN(after.func_argN);
 		
-		if(after.handle_func)
+		if (after.handle_func)
 			after.handle_func(C, after.handle_func_arg, after.retval);
-		if(after.butm_func)
+		if (after.butm_func)
 			after.butm_func(C, after.butm_func_arg, after.a2);
 		
-		if(after.rename_func)
+		if (after.rename_func)
 			after.rename_func(C, after.rename_arg1, after.rename_orig);
-		if(after.rename_orig)
+		if (after.rename_orig)
 			MEM_freeN(after.rename_orig);
 		
-		if(after.undostr[0])
+		if (after.undostr[0])
 			ED_undo_push(C, after.undostr);
 	}
 }
@@ -443,8 +427,8 @@ static void ui_apply_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data)
 {
 	ui_apply_but_func(C, but);
 
-	data->retval= but->retval;
-	data->applied= 1;
+	data->retval = but->retval;
+	data->applied = 1;
 }
 
 static void ui_apply_but_BUTM(bContext *C, uiBut *but, uiHandleButtonData *data)
@@ -452,19 +436,19 @@ static void ui_apply_but_BUTM(bContext *C, uiBut *but, uiHandleButtonData *data)
 	ui_set_but_val(but, but->hardmin);
 	ui_apply_but_func(C, but);
 
-	data->retval= but->retval;
-	data->applied= 1;
+	data->retval = but->retval;
+	data->applied = 1;
 }
 
 static void ui_apply_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data)
 {
-	if(ELEM3(but->type, MENU, ICONROW, ICONTEXTROW))
+	if (ELEM3(but->type, MENU, ICONROW, ICONTEXTROW))
 		ui_set_but_val(but, data->value);
 
 	ui_check_but(but);
 	ui_apply_but_func(C, but);
-	data->retval= but->retval;
-	data->applied= 1;
+	data->retval = but->retval;
+	data->applied = 1;
 }
 
 static void ui_apply_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data)
@@ -473,57 +457,57 @@ static void ui_apply_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data)
 	int w, lvalue, push;
 	
 	/* local hack... */
-	if(but->type==BUT_TOGDUAL && data->togdual) {
-		if(but->pointype==SHO)
+	if (but->type == BUT_TOGDUAL && data->togdual) {
+		if (but->pointype == SHO)
 			but->poin += 2;
-		else if(but->pointype==INT)
+		else if (but->pointype == INT)
 			but->poin += 4;
 	}
 	
-	value= ui_get_but_val(but);
-	lvalue= (int)value;
+	value = ui_get_but_val(but);
+	lvalue = (int)value;
 	
-	if(but->bit) {
-		w= BTST(lvalue, but->bitnr);
-		if(w) lvalue = BCLR(lvalue, but->bitnr);
+	if (but->bit) {
+		w = BTST(lvalue, but->bitnr);
+		if (w) lvalue = BCLR(lvalue, but->bitnr);
 		else lvalue = BSET(lvalue, but->bitnr);
 		
-		if(but->type==TOGR) {
-			if(!data->togonly) {
-				lvalue= 1<<(but->bitnr);
+		if (but->type == TOGR) {
+			if (!data->togonly) {
+				lvalue = 1 << (but->bitnr);
 	
 				ui_set_but_val(but, (double)lvalue);
 			}
 			else {
-				if(lvalue==0) lvalue= 1<<(but->bitnr);
+				if (lvalue == 0) lvalue = 1 << (but->bitnr);
 			}
 		}
 		
 		ui_set_but_val(but, (double)lvalue);
-		if(but->type==ICONTOG || but->type==ICONTOGN) ui_check_but(but);
+		if (but->type == ICONTOG || but->type == ICONTOGN) ui_check_but(but);
 	}
 	else {
 		
-		if(value==0.0) push= 1; 
-		else push= 0;
+		if (value == 0.0) push = 1;
+		else push = 0;
 		
-		if(ELEM3(but->type, TOGN, ICONTOGN, OPTIONN)) push= !push;
+		if (ELEM3(but->type, TOGN, ICONTOGN, OPTIONN)) push = !push;
 		ui_set_but_val(but, (double)push);
-		if(but->type==ICONTOG || but->type==ICONTOGN) ui_check_but(but);		
+		if (but->type == ICONTOG || but->type == ICONTOGN) ui_check_but(but);
 	}
 	
 	/* end local hack... */
-	if(but->type==BUT_TOGDUAL && data->togdual) {
-		if(but->pointype==SHO)
+	if (but->type == BUT_TOGDUAL && data->togdual) {
+		if (but->pointype == SHO)
 			but->poin -= 2;
-		else if(but->pointype==INT)
+		else if (but->pointype == INT)
 			but->poin -= 4;
 	}
 	
 	ui_apply_but_func(C, but);
 
-	data->retval= but->retval;
-	data->applied= 1;
+	data->retval = but->retval;
+	data->applied = 1;
 }
 
 static void ui_apply_but_ROW(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data)
@@ -533,19 +517,19 @@ static void ui_apply_but_ROW(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
 	ui_set_but_val(but, but->hardmax);
 	
 	/* states of other row buttons */
-	for(bt= block->buttons.first; bt; bt= bt->next)
-		if(bt!=but && bt->poin==but->poin && ELEM(bt->type, ROW, LISTROW))
+	for (bt = block->buttons.first; bt; bt = bt->next)
+		if (bt != but && bt->poin == but->poin && ELEM(bt->type, ROW, LISTROW))
 			ui_check_but(bt);
 	
 	ui_apply_but_func(C, but);
 
-	data->retval= but->retval;
-	data->applied= 1;
+	data->retval = but->retval;
+	data->applied = 1;
 }
 
 static void ui_apply_but_TEX(bContext *C, uiBut *but, uiHandleButtonData *data)
 {
-	if(!data->str)
+	if (!data->str)
 		return;
 
 	ui_set_but_string(C, but, data->str);
@@ -554,22 +538,22 @@ static void ui_apply_but_TEX(bContext *C, uiBut *but, uiHandleButtonData *data)
 	/* give butfunc the original text too */
 	/* feature used for bone renaming, channels, etc */
 	/* afterfunc frees origstr */
-	but->rename_orig= data->origstr;
-	data->origstr= NULL;
+	but->rename_orig = data->origstr;
+	data->origstr = NULL;
 	ui_apply_but_func(C, but);
 
-	data->retval= but->retval;
-	data->applied= 1;
+	data->retval = but->retval;
+	data->applied = 1;
 }
 
 static void ui_apply_but_NUM(bContext *C, uiBut *but, uiHandleButtonData *data)
 {
-	if(data->str) {
-		if(ui_set_but_string(C, but, data->str)) {
-			data->value= ui_get_but_val(but);
+	if (data->str) {
+		if (ui_set_but_string(C, but, data->str)) {
+			data->value = ui_get_but_val(but);
 		}
 		else {
-			data->cancel= 1;
+			data->cancel = 1;
 			return;
 		}
 	}
@@ -579,41 +563,43 @@ static void ui_apply_but_NUM(bContext *C, uiBut *but, uiHandleButtonData *data)
 	ui_check_but(but);
 	ui_apply_but_func(C, but);
 
-	data->retval= but->retval;
-	data->applied= 1;
+	data->retval = but->retval;
+	data->applied = 1;
 }
 
 static void ui_apply_but_TOG3(bContext *C, uiBut *but, uiHandleButtonData *data)
 { 
-	if(but->pointype==SHO ) {
-		short *sp= (short *)but->poin;
+	if (but->pointype == SHO) {
+		short *sp = (short *)but->poin;
 		
-		if( BTST(sp[1], but->bitnr)) {
-			sp[1]= BCLR(sp[1], but->bitnr);
-			sp[0]= BCLR(sp[0], but->bitnr);
+		if (BTST(sp[1], but->bitnr)) {
+			sp[1] = BCLR(sp[1], but->bitnr);
+			sp[0] = BCLR(sp[0], but->bitnr);
 		}
-		else if( BTST(sp[0], but->bitnr)) {
-			sp[1]= BSET(sp[1], but->bitnr);
-		} else {
-			sp[0]= BSET(sp[0], but->bitnr);
+		else if (BTST(sp[0], but->bitnr)) {
+			sp[1] = BSET(sp[1], but->bitnr);
+		}
+		else {
+			sp[0] = BSET(sp[0], but->bitnr);
 		}
 	}
 	else {
-		if( BTST(*(but->poin+2), but->bitnr)) {
-			*(but->poin+2)= BCLR(*(but->poin+2), but->bitnr);
-			*(but->poin)= BCLR(*(but->poin), but->bitnr);
+		if (BTST(*(but->poin + 2), but->bitnr)) {
+			*(but->poin + 2) = BCLR(*(but->poin + 2), but->bitnr);
+			*(but->poin) = BCLR(*(but->poin), but->bitnr);
+		}
+		else if (BTST(*(but->poin), but->bitnr)) {
+			*(but->poin + 2) = BSET(*(but->poin + 2), but->bitnr);
 		}
-		else if( BTST(*(but->poin), but->bitnr)) {
-			*(but->poin+2)= BSET(*(but->poin+2), but->bitnr);
-		} else {
-			*(but->poin)= BSET(*(but->poin), but->bitnr);
+		else {
+			*(but->poin) = BSET(*(but->poin), but->bitnr);
 		}
 	}
 	
 	ui_check_but(but);
 	ui_apply_but_func(C, but);
-	data->retval= but->retval;
-	data->applied= 1;
+	data->retval = but->retval;
+	data->applied = 1;
 }
 
 static void ui_apply_but_VEC(bContext *C, uiBut *but, uiHandleButtonData *data)
@@ -622,22 +608,22 @@ static void ui_apply_but_VEC(bContext *C, uiBut *but, uiHandleButtonData *data)
 	ui_check_but(but);
 	ui_apply_but_func(C, but);
 
-	data->retval= but->retval;
-	data->applied= 1;
+	data->retval = but->retval;
+	data->applied = 1;
 }
 
 static void ui_apply_but_COLORBAND(bContext *C, uiBut *but, uiHandleButtonData *data)
 {
 	ui_apply_but_func(C, but);
-	data->retval= but->retval;
-	data->applied= 1;
+	data->retval = but->retval;
+	data->applied = 1;
 }
 
 static void ui_apply_but_CURVE(bContext *C, uiBut *but, uiHandleButtonData *data)
 {
 	ui_apply_but_func(C, but);
-	data->retval= but->retval;
-	data->applied= 1;
+	data->retval = but->retval;
+	data->applied = 1;
 }
 
 static void ui_apply_but_IDPOIN(bContext *C, uiBut *but, uiHandleButtonData *data)
@@ -645,16 +631,16 @@ static void ui_apply_but_IDPOIN(bContext *C, uiBut *but, uiHandleButtonData *dat
 	ui_set_but_string(C, but, data->str);
 	ui_check_but(but);
 	ui_apply_but_func(C, but);
-	data->retval= but->retval;
-	data->applied= 1;
+	data->retval = but->retval;
+	data->applied = 1;
 }
 
 #ifdef WITH_INTERNATIONAL
 static void ui_apply_but_CHARTAB(bContext *C, uiBut *but, uiHandleButtonData *data)
 {
 	ui_apply_but_func(C, but);
-	data->retval= but->retval;
-	data->applied= 1;
+	data->retval = but->retval;
+	data->applied = 1;
 }
 #endif
 
@@ -663,21 +649,21 @@ static void ui_apply_but_CHARTAB(bContext *C, uiBut *but, uiHandleButtonData *da
 static int ui_but_mouse_inside_icon(uiBut *but, ARegion *ar, wmEvent *event)
 {
 	rcti rect;
-	int x= event->x, y= event->y; 
+	int x = event->x, y = event->y;
 	
 	ui_window_to_block(ar, but->block, &x, &y);
 	
-	rect.xmin= but->x1; rect.xmax= but->x2;
-	rect.ymin= but->y1; rect.ymax= but->y2;
+	rect.xmin = but->x1; rect.xmax = but->x2;
+	rect.ymin = but->y1; rect.ymax = but->y2;
 	
-	if(but->imb); /* use button size itself */
-	else if(but->flag & UI_ICON_LEFT) {
-		rect.xmax= rect.xmin + (rect.ymax-rect.ymin);
+	if (but->imb) ;  /* use button size itself */
+	else if (but->flag & UI_ICON_LEFT) {
+		rect.xmax = rect.xmin + (rect.ymax - rect.ymin);
 	}
 	else {
-		int delta= (rect.xmax-rect.xmin) - (rect.ymax-rect.ymin);
-		rect.xmin += delta/2;
-		rect.xmax -= delta/2;
+		int delta = (rect.xmax - rect.xmin) - (rect.ymax - rect.ymin);
+		rect.xmin += delta / 2;
+		rect.xmax -= delta / 2;
 	}
 	
 	return BLI_in_rcti(&rect, x, y);
@@ -688,15 +674,15 @@ static int ui_but_start_drag(bContext *C, uiBut *but, uiHandleButtonData *data,
 	/* prevent other WM gestures to start while we try to drag */
 	WM_gestures_remove(C);
 
-	if( ABS(data->dragstartx - event->x) + ABS(data->dragstarty - event->y) > U.dragthreshold ) {
+	if (ABS(data->dragstartx - event->x) + ABS(data->dragstarty - event->y) > U.dragthreshold) {
 		wmDrag *drag;
 		
 		button_activate_state(C, but, BUTTON_STATE_EXIT);
-		data->cancel= 1;
+		data->cancel = 1;
 		
-		drag= WM_event_start_drag(C, but->icon, but->dragtype, but->dragpoin, ui_get_but_val(but));
-		if(but->imb)
-			WM_event_drag_image(drag, but->imb, but->imb_scale, but->x2-but->x1, but->y2-but->y1);
+		drag = WM_event_start_drag(C, but->icon, but->dragtype, but->dragpoin, ui_get_but_val(but));
+		if (but->imb)
+			WM_event_drag_image(drag, but->imb, but->imb_scale, but->x2 - but->x1, but->y2 - but->y1);
 		return 1;
 	}
 	
@@ -712,33 +698,33 @@ static void ui_delete_active_linkline(uiBlock *block)
 	uiLinkLine *line, *nline;
 	int a, b;
 	
-	but= block->buttons.first;
-	while(but) {
-		if(but->type==LINK && but->link) {
-			line= but->link->lines.first;
-			while(line) {
+	but = block->buttons.first;
+	while (but) {
+		if (but->type == LINK && but->link) {
+			line = but->link->lines.first;
+			while (line) {
 				
-				nline= line->next;
+				nline = line->next;
 				
-				if(line->flag & UI_SELECT) {
+				if (line->flag & UI_SELECT) {
 					BLI_remlink(&but->link->lines, line);
 					
-					link= line->from->link;
+					link = line->from->link;
 					
 					/* are there more pointers allowed? */
-					if(link->ppoin) {
+					if (link->ppoin) {
 						
-						if(*(link->totlink)==1) {
-							*(link->totlink)= 0;
+						if (*(link->totlink) == 1) {
+							*(link->totlink) = 0;
 							MEM_freeN(*(link->ppoin));
-							*(link->ppoin)= NULL;
+							*(link->ppoin) = NULL;
 						}
 						else {
-							b= 0;
-							for(a=0; a< (*(link->totlink)); a++) {
+							b = 0;
+							for (a = 0; a < (*(link->totlink)); a++) {
 								
-								if( (*(link->ppoin))[a] != line->to->poin ) {
-									(*(link->ppoin))[b]= (*(link->ppoin))[a];
+								if ( (*(link->ppoin))[a] != line->to->poin) {
+									(*(link->ppoin))[b] = (*(link->ppoin))[a];
 									b++;
 								}
 							}	
@@ -746,15 +732,15 @@ static void ui_delete_active_linkline(uiBlock *block)
 						}
 					}
 					else {
-						*(link->poin)= NULL;
+						*(link->poin) = NULL;
 					}
 					
 					MEM_freeN(line);
 				}
-				line= nline;
+				line = nline;
 			}
 		}
-		but= but->next;
+		but = but->next;
 	}
 }
 
@@ -764,12 +750,12 @@ static uiLinkLine *ui_is_a_link(uiBut *from, uiBut *to)
 	uiLinkLine *line;
 	uiLink *link;
 	
-	link= from->link;
-	if(link) {
-		line= link->lines.first;
-		while(line) {
-			if(line->from==from && line->to==to) return line;
-			line= line->next;
+	link = from->link;
+	if (link) {
+		line = link->lines.first;
+		while (line) {
+			if (line->from == from && line->to == to) return line;
+			line = line->next;
 		}
 	}
 	return NULL;
@@ -779,43 +765,43 @@ static uiLinkLine *ui_is_a_link(uiBut *from, uiBut *to)
 /* Try to add an AND Controller between the sensor and the actuator logic bricks and to connect them all */
 static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to)
 {
-	Object *ob= NULL;
+	Object *ob = NULL;
 	bSensor *sens_iter;
 	bActuator *act_to, *act_iter;
 	bController *cont;
 	bController ***sens_from_links;
 	uiBut *tmp_but;
 
-	uiLink *link= from->link;
+	uiLink *link = from->link;
 
-	if(link->ppoin)
-		sens_from_links= (bController ***)(link->ppoin);
+	if (link->ppoin)
+		sens_from_links = (bController ***)(link->ppoin);
 	else return;
 
 	act_to = (bActuator *)(to->poin);
 
 	/* (1) get the object */
-	CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
-		for (sens_iter= ob_iter->sensors.first; sens_iter; sens_iter= sens_iter->next)
+	CTX_DATA_BEGIN(C, Object *, ob_iter, selected_editable_objects) {
+		for (sens_iter = ob_iter->sensors.first; sens_iter; sens_iter = sens_iter->next)
 		{
 			if (&(sens_iter->links) == sens_from_links) {
-				ob= ob_iter;
+				ob = ob_iter;
 				break;
 			}
 		}
 		if (ob) break;
 	} CTX_DATA_END;
 
-	if(!ob) return;
+	if (!ob) return;
 
 	/* (2) check if the sensor and the actuator are from the same object */
-	for (act_iter= ob->actuators.first; act_iter; act_iter= (bActuator *)act_iter->next) {
+	for (act_iter = ob->actuators.first; act_iter; act_iter = (bActuator *)act_iter->next) {
 		if (act_iter == act_to)
 			break;
 	}
 
 	// only works if the sensor and the actuator are from the same object
-	if(!act_iter) return;
+	if (!act_iter) return;
 
 	/* (3) add a new controller */
 	if (WM_operator_name_call(C, "LOGIC_OT_controller_add", WM_OP_EXEC_DEFAULT, NULL) & OPERATOR_FINISHED) {
@@ -824,13 +810,13 @@ static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to)
 		/* (4) link the sensor->controller->actuator */
 		tmp_but = MEM_callocN(sizeof(uiBut), "uiBut");
 		uiSetButLink(tmp_but, (void **)&cont, (void ***)&(cont->links), &(cont->totlinks), from->link->tocode, (int)to->hardmin);
-		tmp_but->hardmin= from->link->tocode;
-		tmp_but->poin= (char *)cont;
+		tmp_but->hardmin = from->link->tocode;
+		tmp_but->poin = (char *)cont;
 
-		tmp_but->type= INLINK;
+		tmp_but->type = INLINK;
 		ui_add_link(C, from, tmp_but);
 
-		tmp_but->type= LINK;
+		tmp_but->type = LINK;
 		ui_add_link(C, tmp_but, to);
 
 		/* (5) garbage collection */
@@ -847,45 +833,45 @@ static void ui_add_link(bContext *C, uiBut *from, uiBut *to)
 	void **oldppoin;
 	int a;
 	
-	if( (line= ui_is_a_link(from, to)) ) {
+	if ( (line = ui_is_a_link(from, to)) ) {
 		line->flag |= UI_SELECT;
 		ui_delete_active_linkline(from->block);
 		return;
 	}
 
-	if (from->type==INLINK && to->type==INLINK) {
+	if (from->type == INLINK && to->type == INLINK) {
 		return;
 	}
-	else if (from->type==LINK && to->type==INLINK) {
-		if( from->link->tocode != (int)to->hardmin ) {
+	else if (from->type == LINK && to->type == INLINK) {
+		if (from->link->tocode != (int)to->hardmin) {
 			ui_add_smart_controller(C, from, to);
 			return;
 		}
 	}
-	else if(from->type==INLINK && to->type==LINK) {
-		if( to->link->tocode == (int)from->hardmin ) {
+	else if (from->type == INLINK && to->type == LINK) {
+		if (to->link->tocode == (int)from->hardmin) {
 			return;
 		}
 	}
 	
-	link= from->link;
+	link = from->link;
 	
 	/* are there more pointers allowed? */
-	if(link->ppoin) {
-		oldppoin= *(link->ppoin);
+	if (link->ppoin) {
+		oldppoin = *(link->ppoin);
 		
 		(*(link->totlink))++;
-		*(link->ppoin)= MEM_callocN( *(link->totlink)*sizeof(void *), "new link");
+		*(link->ppoin) = MEM_callocN(*(link->totlink) * sizeof(void *), "new link");
 		
-		for(a=0; a< (*(link->totlink))-1; a++) {
-			(*(link->ppoin))[a]= oldppoin[a];
+		for (a = 0; a < (*(link->totlink)) - 1; a++) {
+			(*(link->ppoin))[a] = oldppoin[a];
 		}
-		(*(link->ppoin))[a]= to->poin;
+		(*(link->ppoin))[a] = to->poin;
 		
-		if(oldppoin) MEM_freeN(oldppoin);
+		if (oldppoin) MEM_freeN(oldppoin);
 	}
 	else {
-		*(link->poin)= to->poin;
+		*(link->poin) = to->poin;
 	}
 	
 }
@@ -893,52 +879,52 @@ static void ui_add_link(bContext *C, uiBut *from, uiBut *to)
 
 static void ui_apply_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data)
 {
-	ARegion *ar= CTX_wm_region(C);
+	ARegion *ar = CTX_wm_region(C);
 	uiBut *bt;
 	
-	for(bt= but->block->buttons.first; bt; bt= bt->next) {
-		if( ui_mouse_inside_button(ar, bt, but->linkto[0]+ar->winrct.xmin, but->linkto[1]+ar->winrct.ymin) )
+	for (bt = but->block->buttons.first; bt; bt = bt->next) {
+		if (ui_mouse_inside_button(ar, bt, but->linkto[0] + ar->winrct.xmin, but->linkto[1] + ar->winrct.ymin) )
 			break;
 	}
-	if(bt && bt!=but) {
+	if (bt && bt != but) {
 		if (!ELEM(bt->type, LINK, INLINK) || !ELEM(but->type, LINK, INLINK))
 			return;
 		
-		if(but->type==LINK) ui_add_link(C, but, bt);
+		if (but->type == LINK) ui_add_link(C, but, bt);
 		else ui_add_link(C, bt, but);
 
 		ui_apply_but_func(C, but);
-		data->retval= but->retval;
+		data->retval = but->retval;
 	}
-	data->applied= 1;
+	data->applied = 1;
 }
 
 static void ui_apply_but_IMAGE(bContext *C, uiBut *but, uiHandleButtonData *data)
 {
 	ui_apply_but_func(C, but);
-	data->retval= but->retval;
-	data->applied= 1;
+	data->retval = but->retval;
+	data->applied = 1;
 }
 
 static void ui_apply_but_HISTOGRAM(bContext *C, uiBut *but, uiHandleButtonData *data)
 {
 	ui_apply_but_func(C, but);
-	data->retval= but->retval;
-	data->applied= 1;
+	data->retval = but->retval;
+	data->applied = 1;
 }
 
 static void ui_apply_but_WAVEFORM(bContext *C, uiBut *but, uiHandleButtonData *data)
 {
 	ui_apply_but_func(C, but);
-	data->retval= but->retval;
-	data->applied= 1;
+	data->retval = but->retval;
+	data->applied = 1;
 }
 
 static void ui_apply_but_TRACKPREVIEW(bContext *C, uiBut *but, uiHandleButtonData *data)
 {
 	ui_apply_but_func(C, but);
-	data->retval= but->retval;
-	data->applied= 1;
+	data->retval = but->retval;
+	data->applied = 1;
 }
 
 
@@ -950,45 +936,45 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
 	ColorBand *editcoba;
 	CurveMapping *editcumap;
 
-	data->retval= 0;
+	data->retval = 0;
 
 	/* if we cancel and have not applied yet, there is nothing to do,
 	 * otherwise we have to restore the original value again */
-	if(data->cancel) {
-		if(!data->applied)
+	if (data->cancel) {
+		if (!data->applied)
 			return;
 
-		if(data->str) MEM_freeN(data->str);
-		data->str= data->origstr;
-		data->origstr= NULL;
-		data->value= data->origvalue;
-		data->origvalue= 0.0;
+		if (data->str) MEM_freeN(data->str);
+		data->str = data->origstr;
+		data->origstr = NULL;
+		data->value = data->origvalue;
+		data->origvalue = 0.0;
 		copy_v3_v3(data->vec, data->origvec);
-		data->origvec[0]= data->origvec[1]= data->origvec[2]= 0.0f;
+		data->origvec[0] = data->origvec[1] = data->origvec[2] = 0.0f;
 	}
 	else {
 		/* we avoid applying interactive edits a second time
 		 * at the end with the appliedinteractive flag */
-		if(interactive)
-			data->appliedinteractive= 1;
-		else if(data->appliedinteractive)
+		if (interactive)
+			data->appliedinteractive = 1;
+		else if (data->appliedinteractive)
 			return;
 	}
 
 	/* ensures we are writing actual values */
-	editstr= but->editstr;
-	editval= but->editval;
-	editvec= but->editvec;
-	editcoba= but->editcoba;
-	editcumap= but->editcumap;
-	but->editstr= NULL;
-	but->editval= NULL;
-	but->editvec= NULL;
-	but->editcoba= NULL;
-	but->editcumap= NULL;
+	editstr = but->editstr;
+	editval = but->editval;
+	editvec = but->editvec;
+	editcoba = but->editcoba;
+	editcumap = but->editcumap;
+	but->editstr = NULL;
+	but->editval = NULL;
+	but->editvec = NULL;
+	but->editcoba = NULL;
+	but->editcumap = NULL;
 
 	/* handle different types */
-	switch(but->type) {
+	switch (but->type) {
 		case BUT:
 			ui_apply_but_BUT(C, but, data);
 			break;
@@ -1028,9 +1014,14 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
 		case ICONTEXTROW:
 		case BLOCK:
 		case PULLDOWN:
-		case COL:
 			ui_apply_but_BLOCK(C, but, data);
 			break;
+		case COL:
+			if (data->cancel)
+				ui_apply_but_VEC(C, but, data);
+			else
+				ui_apply_but_BLOCK(C, but, data);
+			break;
 		case BUTM:
 			ui_apply_but_BUTM(C, but, data);
 			break;
@@ -1077,11 +1068,11 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
 			break;
 	}
 
-	but->editstr= editstr;
-	but->editval= editval;
-	but->editvec= editvec;
-	but->editcoba= editcoba;
-	but->editcumap= editcumap;
+	but->editstr = editstr;
+	but->editval = editval;
+	but->editvec = editvec;
+	but->editcoba = editcoba;
+	but->editcumap = editcumap;
 }
 
 /* ******************* drop event ********************  */
@@ -1090,17 +1081,17 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
 static void ui_but_drop(bContext *C, wmEvent *event, uiBut *but, uiHandleButtonData *data)
 {
 	wmDrag *wmd;
-	ListBase *drags= event->customdata; /* drop event type has listbase customdata by default */
+	ListBase *drags = event->customdata; /* drop event type has listbase customdata by default */
 	
-	for(wmd= drags->first; wmd; wmd= wmd->next) {
-		if(wmd->type==WM_DRAG_ID) {
+	for (wmd = drags->first; wmd; wmd = wmd->next) {
+		if (wmd->type == WM_DRAG_ID) {
 			/* align these types with UI_but_active_drop_name */
-			if(ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
-				ID *id= (ID *)wmd->poin;
+			if (ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
+				ID *id = (ID *)wmd->poin;
 				
-				if(but->poin==NULL && but->rnapoin.data==NULL) {}
+				if (but->poin == NULL && but->rnapoin.data == NULL) {}
 				button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
-				BLI_strncpy(data->str, id->name+2, data->maxlen);
+				BLI_strncpy(data->str, id->name + 2, data->maxlen);
 				button_activate_state(C, but, BUTTON_STATE_EXIT);
 			}
 		}
@@ -1114,31 +1105,31 @@ static void ui_but_drop(bContext *C, wmEvent *event, uiBut *but, uiHandleButtonD
 static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data, char mode)
 {
 	static ColorBand but_copypaste_coba = {0};
-	char buf[UI_MAX_DRAW_STR+1]= {0};
+	char buf[UI_MAX_DRAW_STR + 1] = {0};
 
-	if(mode=='v' && but->lock)
+	if (mode == 'v' && but->lock)
 		return;
 
-	if(mode=='v') {
+	if (mode == 'v') {
 		/* extract first line from clipboard in case of multi-line copies */
-		char *p, *pbuf= WM_clipboard_text_get(0);
-		p= pbuf;
-		if(p) {
+		char *p, *pbuf = WM_clipboard_text_get(0);
+		p = pbuf;
+		if (p) {
 			int i = 0;
-			while (*p && *p!='\r' && *p!='\n' && i<UI_MAX_DRAW_STR) {
-				buf[i++]=*p;
+			while (*p && *p != '\r' && *p != '\n' && i < UI_MAX_DRAW_STR) {
+				buf[i++] = *p;
 				p++;
 			}
-			buf[i]= 0;
+			buf[i] = 0;
 			MEM_freeN(pbuf);
 		}
 	}
 	
 	/* numeric value */
-	if ELEM4(but->type, NUM, NUMABS, NUMSLI, HSVSLI) {
+	if (ELEM4(but->type, NUM, NUMABS, NUMSLI, HSVSLI)) {
 		
-		if(but->poin==NULL && but->rnapoin.data==NULL);
-		else if(mode=='c') {
+		if (but->poin == NULL && but->rnapoin.data == NULL) ;
+		else if (mode == 'c') {
 			ui_get_but_string(but, buf, sizeof(buf));
 			WM_clipboard_text_set(buf, 0);
 		}
@@ -1147,7 +1138,7 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
 
 			if (ui_set_but_string_eval_num(C, but, buf, &val)) {
 				button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
-				data->value= val;
+				data->value = val;
 				ui_set_but_string(C, but, buf);
 				button_activate_state(C, but, BUTTON_STATE_EXIT);
 			}
@@ -1155,11 +1146,11 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
 	}
 
 	/* RGB triple */
-	else if(but->type==COL) {
+	else if (but->type == COL) {
 		float rgb[3];
 		
-		if(but->poin==NULL && but->rnapoin.data==NULL);
-		else if(mode=='c') {
+		if (but->poin == NULL && but->rnapoin.data == NULL) ;
+		else if (mode == 'c') {
 
 			ui_get_but_vectorf(but, rgb);
 			BLI_snprintf(buf, sizeof(buf), "[%f, %f, %f]", rgb[0], rgb[1], rgb[2]);
@@ -1176,24 +1167,24 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
 	}
 
 	/* text/string and ID data */
-	else if(ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
-		uiHandleButtonData *active_data= but->active;
+	else if (ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
+		uiHandleButtonData *active_data = but->active;
 
-		if(but->poin==NULL && but->rnapoin.data==NULL);
-		else if(mode=='c') {
+		if (but->poin == NULL && but->rnapoin.data == NULL) ;
+		else if (mode == 'c') {
 			button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
 			BLI_strncpy(buf, active_data->str, UI_MAX_DRAW_STR);
 			WM_clipboard_text_set(active_data->str, 0);
-			active_data->cancel= 1;
+			active_data->cancel = 1;
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 		}
 		else {
 			button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
 
-			if(ui_is_but_utf8(but)) BLI_strncpy_utf8(active_data->str, buf, active_data->maxlen);
-			else                    BLI_strncpy(active_data->str, buf, active_data->maxlen);
+			if (ui_is_but_utf8(but)) BLI_strncpy_utf8(active_data->str, buf, active_data->maxlen);
+			else BLI_strncpy(active_data->str, buf, active_data->maxlen);
 
-			if(but->type == SEARCH_MENU) {
+			if (but->type == SEARCH_MENU) {
 				/* else uiSearchboxData.active member is not updated [#26856] */
 				ui_searchbox_update(C, data->searchbox, but, 1);
 			}
@@ -1201,19 +1192,19 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
 		}
 	}
 	/* colorband (not supported by system clipboard) */
-	else if(but->type==BUT_COLORBAND) {
-		if(mode=='c') {
-			if(but->poin==NULL)
+	else if (but->type == BUT_COLORBAND) {
+		if (mode == 'c') {
+			if (but->poin == NULL)
 				return;
 
 			memcpy(&but_copypaste_coba, but->poin, sizeof(ColorBand));
 		}
 		else {
-			if(but_copypaste_coba.tot==0)
+			if (but_copypaste_coba.tot == 0)
 				return;
 
-			if(!but->poin)
-				but->poin= MEM_callocN(sizeof(ColorBand), "colorband");
+			if (!but->poin)
+				but->poin = MEM_callocN(sizeof(ColorBand), "colorband");
 
 			button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 			memcpy(data->coba, &but_copypaste_coba, sizeof(ColorBand) );
@@ -1222,12 +1213,12 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
 	}
 	/* operator button (any type) */
 	else if (but->optype) {
-		if(mode=='c') {
+		if (mode == 'c') {
 			PointerRNA *opptr;
 			char *str;
-			opptr= uiButGetOperatorPtrRNA(but); /* allocated when needed, the button owns it */
+			opptr = uiButGetOperatorPtrRNA(but); /* allocated when needed, the button owns it */
 
-			str= WM_operator_pystring(C, but->optype, opptr, 0);
+			str = WM_operator_pystring(C, but->optype, opptr, 0);
 
 			WM_clipboard_text_set(str, 0);
 
@@ -1238,153 +1229,15 @@ static void ui_but_copy_paste(bContext *C, uiBut *but, uiHandleButtonData *data,
 
 /* ************* in-button text selection/editing ************* */
 
-/* return 1 if char ch is special character, otherwise return 0 */
-static uiButtonDelimType test_special_char(const char ch)
-{
-	if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) {
-		return BUTTON_DELIM_ALPHA;
-	}
-
-	switch(ch) {
-		case ',':
-		case '.':
-			return BUTTON_DELIM_PUNCT;
-
-		case '{':
-		case '}':
-		case '[':
-		case ']':
-		case '(':
-		case ')':
-			return BUTTON_DELIM_BRACE;
-
-		case '+':
-		case '-':
-		case '=':
-		case '~':
-		case '%':
-		case '/':
-		case '<':
-		case '>':
-		case '^':
-		case '*':
-		case '&':
-			return BUTTON_DELIM_OPERATOR;
-
-		case '\'':
-		case '\"': // " - an extra closing one for Aligorith's text editor
-			return BUTTON_DELIM_QUOTE;
-
-		case ' ':
-			return BUTTON_DELIM_WHITESPACE;
-
-		case '\\':
-		case '!':
-		case '@':
-		case '#':
-		case '$':
-		case ':':
-		case ';':
-		case '?':
-		case '_':
-			return BUTTON_DELIM_OTHER;
-
-		default:
-			break;
-	}
-	return BUTTON_DELIM_NONE;
-}
-
-static int ui_textedit_step_next_utf8(const char *str, size_t maxlen, short *pos)
-{
-	const char *str_end= str + (maxlen + 1);
-	const char *str_pos= str + (*pos);
-	const char *str_next= BLI_str_find_next_char_utf8(str_pos, str_end);
-	if (str_next) {
-		(*pos) += (str_next - str_pos);
-		if((*pos) > maxlen) (*pos)= maxlen;
-		return TRUE;
-	}
-
-	return FALSE;
-}
-
-static int ui_textedit_step_prev_utf8(const char *str, size_t UNUSED(maxlen), short *pos)
-{
-	if((*pos) > 0) {
-		const char *str_pos= str + (*pos);
-		const char *str_prev= BLI_str_find_prev_char_utf8(str, str_pos);
-		if (str_prev) {
-			(*pos) -= (str_pos - str_prev);
-			return TRUE;
-		}
-	}
-
-	return FALSE;
-}
-
-static void ui_textedit_step_utf8(const char *str, size_t maxlen,
-                                  short *pos, const char direction,
-                                  uiButtonJumpType jump)
-{
-	const short pos_prev= *pos;
-
-	if(direction) { /* right*/
-		if(jump != BUTTON_EDIT_JUMP_NONE) {
-			const uiButtonDelimType is_special= (*pos) < maxlen ? test_special_char(str[(*pos)]) : BUTTON_DELIM_NONE;
-			/* jump between special characters (/,\,_,-, etc.),
-			 * look at function test_special_char() for complete
-			 * list of special character, ctr -> */
-			while((*pos) < maxlen) {
-				if (ui_textedit_step_next_utf8(str, maxlen, pos)) {
-					if((jump != BUTTON_EDIT_JUMP_ALL) && (is_special != test_special_char(str[(*pos)]))) break;
-				}
-				else {
-					break; /* unlikely but just incase */
-				}
-			}
-		}
-		else {
-			ui_textedit_step_next_utf8(str, maxlen, pos);
-		}
-	}
-	else { /* left */
-		if(jump != BUTTON_EDIT_JUMP_NONE) {
-			const uiButtonDelimType is_special= (*pos) > 1 ? test_special_char(str[(*pos) - 1]) : BUTTON_DELIM_NONE;
-			/* left only: compensate for index/change in direction */
-			ui_textedit_step_prev_utf8(str, maxlen, pos);
-
-			/* jump between special characters (/,\,_,-, etc.),
-			 * look at function test_special_char() for complete
-			 * list of special character, ctr -> */
-			while ((*pos) > 0) {
-				if (ui_textedit_step_prev_utf8(str, maxlen, pos)) {
-					if((jump != BUTTON_EDIT_JUMP_ALL) && (is_special != test_special_char(str[(*pos)]))) break;
-				}
-				else {
-					break;
-				}
-			}
-
-			/* left only: compensate for index/change in direction */
-			if(((*pos) != 0) && ABS(pos_prev - (*pos)) > 1) {
-				ui_textedit_step_next_utf8(str, maxlen, pos);
-			}
-		}
-		else {
-			ui_textedit_step_prev_utf8(str, maxlen, pos);
-		}
-	}
-}
 
 static int ui_textedit_delete_selection(uiBut *but, uiHandleButtonData *data)
 {
-	char *str= data->str;
-	int len= strlen(str);
-	int change= 0;
-	if(but->selsta != but->selend && len) {
-		memmove( str+but->selsta, str+but->selend, (len - but->selend) + 1 );
-		change= 1;
+	char *str = data->str;
+	int len = strlen(str);
+	int change = 0;
+	if (but->selsta != but->selend && len) {
+		memmove(str + but->selsta, str + but->selend, (len - but->selend) + 1);
+		change = 1;
 	}
 	
 	but->pos = but->selend = but->selsta;
@@ -1394,24 +1247,24 @@ static int ui_textedit_delete_selection(uiBut *but, uiHandleButtonData *data)
 /* note, but->block->aspect is used here, when drawing button style is getting scaled too */
 static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, short x)
 {
-	uiStyle *style= UI_GetStyle();	// XXX pass on as arg
+	uiStyle *style = UI_GetStyle();  // XXX pass on as arg
 	uiFontStyle *fstyle = &style->widget;
-	int startx= but->x1;
+	int startx = but->x1;
 	char *origstr;
 
 	uiStyleFontSet(fstyle);
 
-	if (fstyle->kerning==1)	/* for BLF_width */
+	if (fstyle->kerning == 1) /* for BLF_width */
 		BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
 	
-	origstr= MEM_callocN(sizeof(char)*data->maxlen, "ui_textedit origstr");
+	origstr = MEM_callocN(sizeof(char) * data->maxlen, "ui_textedit origstr");
 	
 	BLI_strncpy(origstr, but->drawstr, data->maxlen);
 	
 	/* XXX solve generic */
-	if(but->type==NUM || but->type==NUMSLI)
-		startx += (int)(0.5f*(but->y2 - but->y1));
-	else if(ELEM(but->type, TEX, SEARCH_MENU)) {
+	if (but->type == NUM || but->type == NUMSLI)
+		startx += (int)(0.5f * (but->y2 - but->y1));
+	else if (ELEM(but->type, TEX, SEARCH_MENU)) {
 		startx += 5;
 		if (but->flag & UI_HAS_ICON)
 			startx += UI_DPI_ICON_SIZE;
@@ -1419,13 +1272,13 @@ 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) {	
-		short i= but->ofs;
+		int i = but->ofs;
 
 		origstr[but->ofs] = 0;
 		
 		while (i > 0) {
-			if (ui_textedit_step_prev_utf8(origstr, but->ofs, &i)) {
-				if (BLF_width(fstyle->uifont_id, origstr+i) > (startx - x)*0.25f) break;	// 0.25 == scale factor for less sensitivity
+			if (BLI_str_cursor_step_prev_utf8(origstr, but->ofs, &i)) {
+				if (BLF_width(fstyle->uifont_id, origstr + i) > (startx - x) * 0.25f) break;  // 0.25 == scale factor for less sensitivity
 			}
 			else {
 				break; /* unlikely but possible */
@@ -1436,22 +1289,44 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho
 	}
 	/* mouse inside the widget */
 	else if (x >= startx) {
-		const float aspect_sqrt= sqrtf(but->block->aspect);
-		
-		but->pos= strlen(origstr)-but->ofs;
+		int pos_i;
+
+		/* keep track of previous distance from the cursor to the char */
+		float cdist, cdist_prev = 0.0f;
+		short pos_prev;
+
+		const float aspect_sqrt = sqrtf(but->block->aspect);
 		
-		/* XXX does not take zoom level into account */
-		while (startx + aspect_sqrt * BLF_width(fstyle->uifont_id, origstr+but->ofs) > x) {
+		but->pos = pos_prev = strlen(origstr) - but->ofs;
+
+		while (TRUE) {
+			/* XXX does not take zoom level into account */
+			cdist = startx + aspect_sqrt *BLF_width(fstyle->uifont_id, origstr + but->ofs);
+
+			/* check if position is found */
+			if (cdist < x) {
+				/* check is previous location was infact closer */
+				if (((float)x - cdist) > (cdist_prev - (float)x)) {
+					but->pos = pos_prev;
+				}
+				break;
+			}
+			cdist_prev = cdist;
+			pos_prev   = but->pos;
+			/* done with tricky distance checks */
+
+			pos_i = but->pos;
 			if (but->pos <= 0) break;
-			if (ui_textedit_step_prev_utf8(origstr, but->ofs, &but->pos)) {
-				origstr[but->pos+but->ofs] = 0;
+			if (BLI_str_cursor_step_prev_utf8(origstr, but->ofs, &pos_i)) {
+				but->pos = pos_i;
+				origstr[but->pos + but->ofs] = 0;
 			}
 			else {
 				break; /* unlikely but possible */
 			}
 		}
 		but->pos += but->ofs;
-		if(but->pos<0) but->pos= 0;
+		if (but->pos < 0) but->pos = 0;
 	}
 	
 	if (fstyle->kerning == 1)
@@ -1474,31 +1349,31 @@ static void ui_textedit_set_cursor_select(uiBut *but, uiHandleButtonData *data,
 }
 
 /* this is used for both utf8 and ascii, its meant to be used for single keys,
- * notie the buffer is either copied or not, so its not suitable for pasting in
+ * notice the buffer is either copied or not, so its not suitable for pasting in
  * - campbell */
 static int ui_textedit_type_buf(uiBut *but, uiHandleButtonData *data,
                                 const char *utf8_buf, int utf8_buf_len)
 {
 	char *str;
-	int len, changed= 0;
+	int len, changed = 0;
 
-	str= data->str;
-	len= strlen(str);
+	str = data->str;
+	len = strlen(str);
 
-	if(len-(but->selend - but->selsta)+1 <= data->maxlen) {
-		int step= utf8_buf_len;
+	if (len - (but->selend - but->selsta) + 1 <= data->maxlen) {
+		int step = utf8_buf_len;
 
 		/* type over the current selection */
 		if ((but->selend - but->selsta) > 0) {
-			changed= ui_textedit_delete_selection(but, data);
-			len= strlen(str);
+			changed = ui_textedit_delete_selection(but, data);
+			len = strlen(str);
 		}
 
-		if(len + step < data->maxlen) {
+		if (len + step < data->maxlen) {
 			memmove(&str[but->pos + step], &str[but->pos], (len + 1) - but->pos);
 			memcpy(&str[but->pos], utf8_buf, step * sizeof(char));
 			but->pos += step;
-			changed= 1;
+			changed = 1;
 		}
 	}
 
@@ -1507,7 +1382,7 @@ static int ui_textedit_type_buf(uiBut *but, uiHandleButtonData *data,
 
 static int ui_textedit_type_ascii(uiBut *but, uiHandleButtonData *data, char ascii)
 {
-	char buf[2]= {ascii, '\0'};
+	char buf[2] = {ascii, '\0'};
 
 	if (ui_is_but_utf8(but) && (BLI_str_utf8_size(buf) == -1)) {
 		printf("%s: entering invalid ascii char into an ascii key (%d)\n",
@@ -1520,19 +1395,19 @@ static int ui_textedit_type_ascii(uiBut *but, uiHandleButtonData *data, char asc
 	return ui_textedit_type_buf(but, data, buf, 1);
 }
 
-static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction, int select, uiButtonJumpType jump)
+static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, strCursorJumpDirection direction, int select, strCursorJumpType jump)
 {
-	const char *str= data->str;
-	const int len= strlen(str);
-	const int pos_prev= but->pos;
-	const int has_sel= (but->selend - but->selsta) > 0;
+	const char *str = data->str;
+	const int len = strlen(str);
+	const int pos_prev = but->pos;
+	const int has_sel = (but->selend - but->selsta) > 0;
 
 	ui_check_but(but);
 
 	/* special case, quit selection and set cursor */
 	if (has_sel && !select) {
-		if (jump == BUTTON_EDIT_JUMP_ALL) {
-			but->selsta = but->selend= but->pos = direction ? len : 0;
+		if (jump == STRCUR_JUMP_ALL) {
+			but->selsta = but->selend = but->pos = direction ? len : 0;
 		}
 		else {
 			if (direction) {
@@ -1545,94 +1420,96 @@ static void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction
 		data->selextend = 0;
 	}
 	else {
-		ui_textedit_step_utf8(str, len, &but->pos, direction, jump);
+		int pos_i = but->pos;
+		BLI_str_cursor_step_utf8(str, len, &pos_i, direction, jump);
+		but->pos = pos_i;
 
-		if(select) {
+		if (select) {
 			/* existing selection */
 			if (has_sel) {
 
-				if(data->selextend == 0) {
-					data->selextend= EXTEND_RIGHT;
+				if (data->selextend == 0) {
+					data->selextend = EXTEND_RIGHT;
 				}
 
 				if (direction) {
 					if (data->selextend == EXTEND_RIGHT) {
-						but->selend= but->pos;
+						but->selend = but->pos;
 					}
 					else {
-						but->selsta= but->pos;
+						but->selsta = but->pos;
 					}
 				}
 				else {
 					if (data->selextend == EXTEND_LEFT) {
-						but->selsta= but->pos;
+						but->selsta = but->pos;
 					}
 					else {
-						but->selend= but->pos;
+						but->selend = but->pos;
 					}
 				}
 
 				if (but->selend < but->selsta) {
 					SWAP(short, but->selsta, but->selend);
-					data->selextend= (data->selextend == EXTEND_RIGHT) ? EXTEND_LEFT : EXTEND_RIGHT;
+					data->selextend = (data->selextend == EXTEND_RIGHT) ? EXTEND_LEFT : EXTEND_RIGHT;
 				}
 
 			} /* new selection */
 			else {
 				if (direction) {
-					data->selextend= EXTEND_RIGHT;
-					but->selend= but->pos;
-					but->selsta= pos_prev;
+					data->selextend = EXTEND_RIGHT;
+					but->selend = but->pos;
+					but->selsta = pos_prev;
 				}
 				else {
-					data->selextend= EXTEND_LEFT;
-					but->selend= pos_prev;
-					but->selsta= but->pos;
+					data->selextend = EXTEND_LEFT;
+					but->selend = pos_prev;
+					but->selsta = but->pos;
 				}
 			}
 		}
 	}
 }
 
-static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int direction, uiButtonJumpType jump)
+static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int direction, strCursorJumpType jump)
 {
-	char *str= data->str;
-	const int len= strlen(str);
+	char *str = data->str;
+	const int len = strlen(str);
 
-	int changed= 0;
+	int changed = 0;
 
-	if(jump == BUTTON_EDIT_JUMP_ALL) {
-		if(len) changed=1;
-		str[0]= '\0';
-		but->pos= 0;
+	if (jump == STRCUR_JUMP_ALL) {
+		if (len) changed = 1;
+		str[0] = '\0';
+		but->pos = 0;
 	}
-	else if(direction) { /* delete */
+	else if (direction) { /* delete */
 		if ((but->selend - but->selsta) > 0) {
-			changed= ui_textedit_delete_selection(but, data);
+			changed = ui_textedit_delete_selection(but, data);
 		}
-		else if (but->pos>=0 && but->pos<len) {
-			short pos= but->pos;
+		else if (but->pos >= 0 && but->pos < len) {
+			int pos = but->pos;
 			int step;
-			ui_textedit_step_utf8(str, len, &pos, direction, jump);
-			step= pos - but->pos;
+			BLI_str_cursor_step_utf8(str, len, &pos, direction, jump);
+			step = pos - but->pos;
 			memmove(&str[but->pos], &str[but->pos + step], (len + 1) - but->pos);
-			changed= 1;
+			changed = 1;
 		}
 	}
 	else { /* backspace */
 		if (len != 0) {
 			if ((but->selend - but->selsta) > 0) {
-				changed= ui_textedit_delete_selection(but, data);
+				changed = ui_textedit_delete_selection(but, data);
 			}
-			else if(but->pos>0) {
-				short pos= but->pos;
+			else if (but->pos > 0) {
+				int pos = but->pos;
 				int step;
 
-				ui_textedit_step_utf8(str, len, &pos, direction, jump);
-				step= but->pos - pos;
+				BLI_str_cursor_step_utf8(str, len, &pos, direction, jump);
+				step = but->pos - pos;
 				memmove(&str[but->pos - step], &str[but->pos], (len + 1) - but->pos);
 				but->pos -= step;
-				changed= 1;
+				changed = 1;
 			}
 		} 
 	}
@@ -1643,64 +1520,64 @@ static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int directio
 static int ui_textedit_autocomplete(bContext *C, uiBut *but, uiHandleButtonData *data)
 {
 	char *str;
-	int changed= 1;
+	int changed = 1;
 
-	str= data->str;
+	str = data->str;
 
-	if(data->searchbox)
+	if (data->searchbox)
 		ui_searchbox_autocomplete(C, data->searchbox, but, data->str);
 	else
 		but->autocomplete_func(C, str, but->autofunc_arg);
 
-	but->pos= strlen(str);
-	but->selsta= but->selend= but->pos;
+	but->pos = strlen(str);
+	but->selsta = but->selend = but->pos;
 
 	return changed;
 }
 
 static int ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, int paste, int copy, int cut)
 {
-	char buf[UI_MAX_DRAW_STR]={0};
+	char buf[UI_MAX_DRAW_STR] = {0};
 	char *str, *p, *pbuf;
-	int len, x, i, changed= 0;
+	int len, x, i, changed = 0;
 
-	str= data->str;
-	len= strlen(str);
+	str = data->str;
+	len = strlen(str);
 	
 	/* paste */
 	if (paste) {
 		/* extract the first line from the clipboard */
-		p = pbuf= WM_clipboard_text_get(0);
+		p = pbuf = WM_clipboard_text_get(0);
 
-		if(p && p[0]) {
+		if (p && p[0]) {
 			unsigned int y;
-			i= 0;
-			while (*p && *p!='\r' && *p!='\n' && i<UI_MAX_DRAW_STR-1) {
-				buf[i++]=*p;
+			i = 0;
+			while (*p && *p != '\r' && *p != '\n' && i < UI_MAX_DRAW_STR - 1) {
+				buf[i++] = *p;
 				p++;
 			}
-			buf[i]= 0;
+			buf[i] = 0;
 
 			/* paste over the current selection */
 			if ((but->selend - but->selsta) > 0) {
 				ui_textedit_delete_selection(but, data);
-				len= strlen(str);
+				len = strlen(str);
 			}
 			
-			for (y=0; y<strlen(buf); y++)
+			for (y = 0; y < strlen(buf); y++)
 			{
 				/* add contents of buffer */
-				if(len+1 < data->maxlen) {
-					for(x= data->maxlen; x>but->pos; x--)
-						str[x]= str[x-1];
-					str[but->pos]= buf[y];
+				if (len + 1 < data->maxlen) {
+					for (x = data->maxlen; x > but->pos; x--)
+						str[x] = str[x - 1];
+					str[but->pos] = buf[y];
 					but->pos++; 
 					len++;
-					str[len]= '\0';
+					str[len] = '\0';
 				}
 			}
 
-			changed= 1;
+			changed = 1;
 		}
 
 		if (pbuf) {
@@ -1710,8 +1587,8 @@ static int ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, int paste
 	/* cut & copy */
 	else if (copy || cut) {
 		/* copy the contents to the copypaste buffer */
-		for(x= but->selsta; x <= but->selend; x++) {
-			if (x==but->selend)
+		for (x = but->selsta; x <= but->selend; x++) {
+			if (x == but->selend)
 				buf[x] = '\0';
 			else
 				buf[(x - but->selsta)] = str[x];
@@ -1720,9 +1597,9 @@ static int ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, int paste
 		WM_clipboard_text_set(buf, 0);
 		
 		/* for cut only, delete the selection afterwards */
-		if(cut)
-			if((but->selend - but->selsta) > 0)
-				changed= ui_textedit_delete_selection(but, data);
+		if (cut)
+			if ((but->selend - but->selsta) > 0)
+				changed = ui_textedit_delete_selection(but, data);
 	} 
 
 	return changed;
@@ -1730,33 +1607,38 @@ static int ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, int paste
 
 static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
 {
-	if(data->str) {
+	int len;
+
+	if (data->str) {
 		MEM_freeN(data->str);
-		data->str= NULL;
+		data->str = NULL;
 	}
 
 	/* retrieve string */
-	data->maxlen= ui_get_but_string_max_length(but);
-	data->str= MEM_callocN(sizeof(char)*data->maxlen + 1, "textedit str");
+	data->maxlen = ui_get_but_string_max_length(but);
+	data->str = MEM_callocN(sizeof(char) * data->maxlen + 1, "textedit str");
 	ui_get_but_string(but, data->str, data->maxlen);
 
-	if(ELEM3(but->type, NUM, NUMABS, NUMSLI)) {
+	if (ELEM3(but->type, NUM, NUMABS, NUMSLI)) {
 		ui_convert_to_unit_alt_name(but, data->str, data->maxlen);
 	}
 
-	data->origstr= BLI_strdup(data->str);
-	data->selextend= 0;
-	data->selstartx= 0;
+	/* won't change from now on */
+	len = strlen(data->str);
+
+	data->origstr = BLI_strdupn(data->str, len);
+	data->selextend = 0;
+	data->selstartx = 0;
 
 	/* set cursor pos to the end of the text */
-	but->editstr= data->str;
-	but->pos= strlen(data->str);
-	but->selsta= 0;
-	but->selend= strlen(data->str);
+	but->editstr = data->str;
+	but->pos = len;
+	but->selsta = 0;
+	but->selend = len;
 
 	/* optional searchbox */
-	if(but->type==SEARCH_MENU) {
-		data->searchbox= ui_searchbox_create(C, data->region, but);
+	if (but->type == SEARCH_MENU) {
+		data->searchbox = ui_searchbox_create(C, data->region, but);
 		ui_searchbox_update(C, data->searchbox, but, 1); /* 1= reset */
 	}
 	
@@ -1767,26 +1649,26 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
 
 static void ui_textedit_end(bContext *C, uiBut *but, uiHandleButtonData *data)
 {
-	if(but) {
-		if(ui_is_but_utf8(but)) {
-			int strip= BLI_utf8_invalid_strip(but->editstr, strlen(but->editstr));
+	if (but) {
+		if (ui_is_but_utf8(but)) {
+			int strip = BLI_utf8_invalid_strip(but->editstr, strlen(but->editstr));
 			/* not a file?, strip non utf-8 chars */
-			if(strip) {
-				/* wont happen often so isnt that annoying to keep it here for a while */
+			if (strip) {
+				/* wont happen often so isn't that annoying to keep it here for a while */
 				printf("%s: invalid utf8 - stripped chars %d\n", __func__, strip);
 			}
 		}
 		
-		if(data->searchbox) {
-			if(data->cancel==0)
+		if (data->searchbox) {
+			if (data->cancel == 0)
 				ui_searchbox_apply(but, data->searchbox);
 
 			ui_searchbox_free(C, data->searchbox);
-			data->searchbox= NULL;
+			data->searchbox = NULL;
 		}
 		
-		but->editstr= NULL;
-		but->pos= -1;
+		but->editstr = NULL;
+		but->pos = -1;
 	}
 	
 	WM_cursor_restore(CTX_wm_window(C));
@@ -1797,23 +1679,23 @@ static void ui_textedit_next_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa
 	uiBut *but;
 
 	/* label and roundbox can overlap real buttons (backdrops...) */
-	if(ELEM4(actbut->type, LABEL, SEPR, ROUNDBOX, LISTBOX))
+	if (ELEM4(actbut->type, LABEL, SEPR, ROUNDBOX, LISTBOX))
 		return;
 
-	for(but= actbut->next; but; but= but->next) {
-		if(ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU)) {
-			if(!(but->flag & UI_BUT_DISABLED)) {
-				data->postbut= but;
-				data->posttype= BUTTON_ACTIVATE_TEXT_EDITING;
+	for (but = actbut->next; but; but = but->next) {
+		if (ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU)) {
+			if (!(but->flag & UI_BUT_DISABLED)) {
+				data->postbut = but;
+				data->posttype = BUTTON_ACTIVATE_TEXT_EDITING;
 				return;
 			}
 		}
 	}
-	for(but= block->buttons.first; but!=actbut; but= but->next) {
-		if(ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU)) {
-			if(!(but->flag & UI_BUT_DISABLED)) {
-				data->postbut= but;
-				data->posttype= BUTTON_ACTIVATE_TEXT_EDITING;
+	for (but = block->buttons.first; but != actbut; but = but->next) {
+		if (ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU)) {
+			if (!(but->flag & UI_BUT_DISABLED)) {
+				data->postbut = but;
+				data->posttype = BUTTON_ACTIVATE_TEXT_EDITING;
 				return;
 			}
 		}
@@ -1825,23 +1707,23 @@ static void ui_textedit_prev_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa
 	uiBut *but;
 
 	/* label and roundbox can overlap real buttons (backdrops...) */
-	if(ELEM4(actbut->type, LABEL, SEPR, ROUNDBOX, LISTBOX))
+	if (ELEM4(actbut->type, LABEL, SEPR, ROUNDBOX, LISTBOX))
 		return;
 
-	for(but= actbut->prev; but; but= but->prev) {
-		if(ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU)) {
-			if(!(but->flag & UI_BUT_DISABLED)) {
-				data->postbut= but;
-				data->posttype= BUTTON_ACTIVATE_TEXT_EDITING;
+	for (but = actbut->prev; but; but = but->prev) {
+		if (ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU)) {
+			if (!(but->flag & UI_BUT_DISABLED)) {
+				data->postbut = but;
+				data->posttype = BUTTON_ACTIVATE_TEXT_EDITING;
 				return;
 			}
 		}
 	}
-	for(but= block->buttons.last; but!=actbut; but= but->prev) {
-		if(ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU)) {
-			if(!(but->flag & UI_BUT_DISABLED)) {
-				data->postbut= but;
-				data->posttype= BUTTON_ACTIVATE_TEXT_EDITING;
+	for (but = block->buttons.last; but != actbut; but = but->prev) {
+		if (ELEM7(but->type, TEX, NUM, NUMABS, NUMSLI, HSVSLI, IDPOIN, SEARCH_MENU)) {
+			if (!(but->flag & UI_BUT_DISABLED)) {
+				data->postbut = but;
+				data->posttype = BUTTON_ACTIVATE_TEXT_EDITING;
 				return;
 			}
 		}
@@ -1851,125 +1733,125 @@ static void ui_textedit_prev_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa
 
 static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
-	int mx, my, changed= 0, inbox=0, update= 0, retval= WM_UI_HANDLER_CONTINUE;
+	int mx, my, changed = 0, inbox = 0, update = 0, retval = WM_UI_HANDLER_CONTINUE;
 
-	switch(event->type) {
+	switch (event->type) {
 		case WHEELUPMOUSE:
 		case WHEELDOWNMOUSE:
 		case MOUSEMOVE:
-			if(data->searchbox)
+			if (data->searchbox)
 				ui_searchbox_event(C, data->searchbox, but, event);
 			
 			break;
 		case RIGHTMOUSE:
 		case ESCKEY:
-			data->cancel= 1;
-			data->escapecancel= 1;
+			data->cancel = 1;
+			data->escapecancel = 1;
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
-			retval= WM_UI_HANDLER_BREAK;
+			retval = WM_UI_HANDLER_BREAK;
 			break;
 		case LEFTMOUSE: {
 			
 			/* exit on LMB only on RELEASE for searchbox, to mimic other popups, and allow multiple menu levels */
-			if(data->searchbox)
-				inbox= ui_searchbox_inside(data->searchbox, event->x, event->y);
+			if (data->searchbox)
+				inbox = ui_searchbox_inside(data->searchbox, event->x, event->y);
 
-			if(event->val==KM_PRESS) {
-				mx= event->x;
-				my= event->y;
+			if (event->val == KM_PRESS) {
+				mx = event->x;
+				my = event->y;
 				ui_window_to_block(data->region, block, &mx, &my);
 
 				if (ui_but_contains_pt(but, mx, my)) {
 					ui_textedit_set_cursor_pos(but, data, mx);
 					but->selsta = but->selend = but->pos;
-					data->selstartx= mx;
+					data->selstartx = mx;
 
 					button_activate_state(C, but, BUTTON_STATE_TEXT_SELECTING);
-					retval= WM_UI_HANDLER_BREAK;
+					retval = WM_UI_HANDLER_BREAK;
 				}
-				else if(inbox==0) {
+				else if (inbox == 0) {
 					/* if searchbox, click outside will cancel */
-					if(data->searchbox)
-						data->cancel= data->escapecancel= 1;
+					if (data->searchbox)
+						data->cancel = data->escapecancel = 1;
 					button_activate_state(C, but, BUTTON_STATE_EXIT);
-					retval= WM_UI_HANDLER_BREAK;
+					retval = WM_UI_HANDLER_BREAK;
 				}
 			}
-			else if(inbox) {
+			else if (inbox) {
 				button_activate_state(C, but, BUTTON_STATE_EXIT);
-				retval= WM_UI_HANDLER_BREAK;
+				retval = WM_UI_HANDLER_BREAK;
 			}
 			break;
 		}
 	}
 
-	if(event->val==KM_PRESS) {
+	if (event->val == KM_PRESS) {
 		switch (event->type) {
 			case VKEY:
 			case XKEY:
 			case CKEY:
-				if(event->ctrl || event->oskey) {
-					if(event->type == VKEY)
-						changed= ui_textedit_copypaste(but, data, 1, 0, 0);
-					else if(event->type == CKEY)
-						changed= ui_textedit_copypaste(but, data, 0, 1, 0);
-					else if(event->type == XKEY)
-						changed= ui_textedit_copypaste(but, data, 0, 0, 1);
-
-					retval= WM_UI_HANDLER_BREAK;
+				if (event->ctrl || event->oskey) {
+					if (event->type == VKEY)
+						changed = ui_textedit_copypaste(but, data, 1, 0, 0);
+					else if (event->type == CKEY)
+						changed = ui_textedit_copypaste(but, data, 0, 1, 0);
+					else if (event->type == XKEY)
+						changed = ui_textedit_copypaste(but, data, 0, 0, 1);
+
+					retval = WM_UI_HANDLER_BREAK;
 				}
 				break;
 			case RIGHTARROWKEY:
-				ui_textedit_move(but, data, 1, event->shift, event->ctrl ? BUTTON_EDIT_JUMP_DELIM : BUTTON_EDIT_JUMP_NONE);
-				retval= WM_UI_HANDLER_BREAK;
+				ui_textedit_move(but, data, STRCUR_DIR_NEXT, event->shift, event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE);
+				retval = WM_UI_HANDLER_BREAK;
 				break;
 			case LEFTARROWKEY:
-				ui_textedit_move(but, data, 0, event->shift, event->ctrl ? BUTTON_EDIT_JUMP_DELIM : BUTTON_EDIT_JUMP_NONE);
-				retval= WM_UI_HANDLER_BREAK;
+				ui_textedit_move(but, data, STRCUR_DIR_PREV, event->shift, event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE);
+				retval = WM_UI_HANDLER_BREAK;
 				break;
 			case DOWNARROWKEY:
-				if(data->searchbox) {
+				if (data->searchbox) {
 					ui_searchbox_event(C, data->searchbox, but, event);
 					break;
 				}
-				/* pass on purposedly */
+			/* pass on purposedly */
 			case ENDKEY:
-				ui_textedit_move(but, data, 1, event->shift, BUTTON_EDIT_JUMP_ALL);
-				retval= WM_UI_HANDLER_BREAK;
+				ui_textedit_move(but, data, STRCUR_DIR_NEXT, event->shift, STRCUR_JUMP_ALL);
+				retval = WM_UI_HANDLER_BREAK;
 				break;
 			case UPARROWKEY:
-				if(data->searchbox) {
+				if (data->searchbox) {
 					ui_searchbox_event(C, data->searchbox, but, event);
 					break;
 				}
-				/* pass on purposedly */
+			/* pass on purposedly */
 			case HOMEKEY:
-				ui_textedit_move(but, data, 0, event->shift, BUTTON_EDIT_JUMP_ALL);
-				retval= WM_UI_HANDLER_BREAK;
+				ui_textedit_move(but, data, STRCUR_DIR_PREV, event->shift, STRCUR_JUMP_ALL);
+				retval = WM_UI_HANDLER_BREAK;
 				break;
 			case PADENTER:
 			case RETKEY:
 				button_activate_state(C, but, BUTTON_STATE_EXIT);
-				retval= WM_UI_HANDLER_BREAK;
+				retval = WM_UI_HANDLER_BREAK;
 				break;
 			case DELKEY:
-				changed= ui_textedit_delete(but, data, 1, event->ctrl ? BUTTON_EDIT_JUMP_DELIM : BUTTON_EDIT_JUMP_NONE);
-				retval= WM_UI_HANDLER_BREAK;
+				changed = ui_textedit_delete(but, data, 1, event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE);
+				retval = WM_UI_HANDLER_BREAK;
 				break;
 
 			case BACKSPACEKEY:
-				changed= ui_textedit_delete(but, data, 0, event->shift ? BUTTON_EDIT_JUMP_ALL :  (event->ctrl ? BUTTON_EDIT_JUMP_DELIM : BUTTON_EDIT_JUMP_NONE));
-				retval= WM_UI_HANDLER_BREAK;
+				changed = ui_textedit_delete(but, data, 0, event->shift ? STRCUR_JUMP_ALL :  (event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE));
+				retval = WM_UI_HANDLER_BREAK;
 				break;
 				
 			case TABKEY:
 				/* there is a key conflict here, we can't tab with autocomplete */
-				if(but->autocomplete_func || data->searchbox) {
-					changed= ui_textedit_autocomplete(C, but, data);
-					update= 1; /* do live update for tab key */
+				if (but->autocomplete_func || data->searchbox) {
+					changed = ui_textedit_autocomplete(C, but, data);
+					update = 1; /* do live update for tab key */
 				}
 				/* the hotkey here is not well defined, was G.qual so we check all */
-				else if(event->shift || event->ctrl || event->alt || event->oskey) {
+				else if (event->shift || event->ctrl || event->alt || event->oskey) {
 					ui_textedit_prev_but(block, but, data);
 					button_activate_state(C, but, BUTTON_STATE_EXIT);
 				}
@@ -1977,81 +1859,81 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
 					ui_textedit_next_but(block, but, data);
 					button_activate_state(C, but, BUTTON_STATE_EXIT);
 				}
-				retval= WM_UI_HANDLER_BREAK;
+				retval = WM_UI_HANDLER_BREAK;
 				break;
 		}
 
-		if((event->ascii || event->utf8_buf[0]) && (retval == WM_UI_HANDLER_CONTINUE)) {
+		if ((event->ascii || event->utf8_buf[0]) && (retval == WM_UI_HANDLER_CONTINUE)) {
 			char ascii = event->ascii;
-			const char *utf8_buf= event->utf8_buf;
+			const char *utf8_buf = event->utf8_buf;
 
 			/* exception that's useful for number buttons, some keyboard
-			   numpads have a comma instead of a period */
-			if(ELEM3(but->type, NUM, NUMABS, NUMSLI)) { /* could use data->min*/
-				if(event->type == PADPERIOD && ascii == ',') {
+			 * numpads have a comma instead of a period */
+			if (ELEM3(but->type, NUM, NUMABS, NUMSLI)) { /* could use data->min*/
+				if (event->type == PADPERIOD && ascii == ',') {
 					ascii = '.';
-					utf8_buf= NULL; /* force ascii fallback */
+					utf8_buf = NULL; /* force ascii fallback */
 				}
 			}
 
-			if(utf8_buf && utf8_buf[0]) {
-				int utf8_buf_len= BLI_str_utf8_size(utf8_buf);
+			if (utf8_buf && utf8_buf[0]) {
+				int utf8_buf_len = BLI_str_utf8_size(utf8_buf);
 				/* keep this printf until utf8 is well tested */
 				if (utf8_buf_len != 1) {
 					printf("%s: utf8 char '%.*s'\n", __func__, utf8_buf_len, utf8_buf);
 				}
 
 				// strcpy(utf8_buf, "12345");
-				changed= ui_textedit_type_buf(but, data, event->utf8_buf, utf8_buf_len);
+				changed = ui_textedit_type_buf(but, data, event->utf8_buf, utf8_buf_len);
 			}
 			else {
-				changed= ui_textedit_type_ascii(but, data, ascii);
+				changed = ui_textedit_type_ascii(but, data, ascii);
 			}
 
-			retval= WM_UI_HANDLER_BREAK;
+			retval = WM_UI_HANDLER_BREAK;
 			
 		}
 		/* textbutton with magnifier icon: do live update for search button */
-		if(but->icon==ICON_VIEWZOOM)
-			update= 1;
+		if (but->icon == ICON_VIEWZOOM)
+			update = 1;
 	}
 
-	if(changed) {
+	if (changed) {
 		/* only update when typing for TAB key */
-		if(update && data->interactive) ui_apply_button(C, block, but, data, 1);
+		if (update && data->interactive) ui_apply_button(C, block, but, data, 1);
 		else ui_check_but(but);
-		but->changed= TRUE;
+		but->changed = TRUE;
 		
-		if(data->searchbox)
-			ui_searchbox_update(C, data->searchbox, but, 1); /* 1 = reset */
+		if (data->searchbox)
+			ui_searchbox_update(C, data->searchbox, but, 1);  /* 1 = reset */
 	}
 
-	if(changed || (retval == WM_UI_HANDLER_BREAK))
+	if (changed || (retval == WM_UI_HANDLER_BREAK))
 		ED_region_tag_redraw(data->region);
 }
 
 static void ui_do_but_textedit_select(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
-	int mx, my, retval= WM_UI_HANDLER_CONTINUE;
+	int mx, my, retval = WM_UI_HANDLER_CONTINUE;
 
-	switch(event->type) {
+	switch (event->type) {
 		case MOUSEMOVE: {
-			mx= event->x;
-			my= event->y;
+			mx = event->x;
+			my = event->y;
 			ui_window_to_block(data->region, block, &mx, &my);
 
 			ui_textedit_set_cursor_select(but, data, mx);
-			retval= WM_UI_HANDLER_BREAK;
+			retval = WM_UI_HANDLER_BREAK;
 			break;
 		}
 		case LEFTMOUSE:
-			if(event->val == KM_RELEASE)
+			if (event->val == KM_RELEASE)
 				button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
-			retval= WM_UI_HANDLER_BREAK;
+			retval = WM_UI_HANDLER_BREAK;
 			break;
 	}
 
-	if(retval == WM_UI_HANDLER_BREAK) {
+	if (retval == WM_UI_HANDLER_BREAK) {
 		ui_check_but(but);
 		ED_region_tag_redraw(data->region);
 	}
@@ -2061,55 +1943,55 @@ static void ui_do_but_textedit_select(bContext *C, uiBlock *block, uiBut *but, u
 
 static void ui_numedit_begin(uiBut *but, uiHandleButtonData *data)
 {
-	if(but->type == BUT_CURVE) {
-		but->editcumap= (CurveMapping*)but->poin;
+	if (but->type == BUT_CURVE) {
+		but->editcumap = (CurveMapping *)but->poin;
 	}
-	else if(but->type == BUT_COLORBAND) {
-		data->coba= (ColorBand*)but->poin;
-		but->editcoba= data->coba;
+	else if (but->type == BUT_COLORBAND) {
+		data->coba = (ColorBand *)but->poin;
+		but->editcoba = data->coba;
 	}
-	else if(ELEM3(but->type, BUT_NORMAL, HSVCUBE, HSVCIRCLE)) {
+	else if (ELEM3(but->type, BUT_NORMAL, HSVCUBE, HSVCIRCLE)) {
 		ui_get_but_vectorf(but, data->origvec);
 		copy_v3_v3(data->vec, data->origvec);
-		but->editvec= data->vec;
+		but->editvec = data->vec;
 	}
 	else {
 		float softrange, softmin, softmax;
 
-		data->startvalue= ui_get_but_val(but);
-		data->origvalue= data->startvalue;
-		data->value= data->origvalue;
-		but->editval= &data->value;
+		data->startvalue = ui_get_but_val(but);
+		data->origvalue = data->startvalue;
+		data->value = data->origvalue;
+		but->editval = &data->value;
 
-		softmin= but->softmin;
-		softmax= but->softmax;
-		softrange= softmax - softmin;
+		softmin = but->softmin;
+		softmax = but->softmax;
+		softrange = softmax - softmin;
 
-		data->dragfstart= (softrange == 0.0f)? 0.0f: ((float)data->value - softmin)/softrange;
-		data->dragf= data->dragfstart;
+		data->dragfstart = (softrange == 0.0f) ? 0.0f : ((float)data->value - softmin) / softrange;
+		data->dragf = data->dragfstart;
 	}
 
-	data->dragchange= 0;
-	data->draglock= 1;
+	data->dragchange = 0;
+	data->draglock = 1;
 }
 
 static void ui_numedit_end(uiBut *but, uiHandleButtonData *data)
 {
-	but->editval= NULL;
-	but->editvec= NULL;
-	but->editcoba= NULL;
-	but->editcumap= NULL;
+	but->editval = NULL;
+	but->editvec = NULL;
+	but->editcoba = NULL;
+	but->editcumap = NULL;
 
-	data->dragstartx= 0;
-	data->draglastx= 0;
-	data->dragchange= 0;
-	data->dragcbd= NULL;
-	data->dragsel= 0;
+	data->dragstartx = 0;
+	data->draglastx = 0;
+	data->dragchange = 0;
+	data->dragcbd = NULL;
+	data->dragsel = 0;
 }
 
 static void ui_numedit_apply(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data)
 {
-	if(data->interactive) ui_apply_button(C, block, but, data, 1);
+	if (data->interactive) ui_apply_button(C, block, but, data, 1);
 	else ui_check_but(but);
 
 	ED_region_tag_redraw(data->region);
@@ -2119,82 +2001,82 @@ static void ui_numedit_apply(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
 
 static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
 {
-	uiBlockCreateFunc func= NULL;
-	uiBlockHandleCreateFunc handlefunc= NULL;
-	uiMenuCreateFunc menufunc= NULL;
-	char *menustr= NULL;
-	void *arg= NULL;
+	uiBlockCreateFunc func = NULL;
+	uiBlockHandleCreateFunc handlefunc = NULL;
+	uiMenuCreateFunc menufunc = NULL;
+	char *menustr = NULL;
+	void *arg = NULL;
 
-	switch(but->type) {
+	switch (but->type) {
 		case BLOCK:
 		case PULLDOWN:
-			if(but->menu_create_func) {
-				menufunc= but->menu_create_func;
-				arg= but->poin;
+			if (but->menu_create_func) {
+				menufunc = but->menu_create_func;
+				arg = but->poin;
 			}
 			else {
-				func= but->block_create_func;
-				arg= but->poin?but->poin:but->func_argN;
+				func = but->block_create_func;
+				arg = but->poin ? but->poin : but->func_argN;
 			}
 			break;
 		case MENU:
-			if(but->menu_create_func) {
-				menufunc= but->menu_create_func;
-				arg= but->poin;
+			if (but->menu_create_func) {
+				menufunc = but->menu_create_func;
+				arg = but->poin;
 			}
 			else {
-				data->origvalue= ui_get_but_val(but);
-				data->value= data->origvalue;
-				but->editval= &data->value;
+				data->origvalue = ui_get_but_val(but);
+				data->value = data->origvalue;
+				but->editval = &data->value;
 
-				menustr= but->str;
+				menustr = but->str;
 			}
 			break;
 		case ICONROW:
-			menufunc= ui_block_func_ICONROW;
-			arg= but;
+			menufunc = ui_block_func_ICONROW;
+			arg = but;
 			break;
 		case ICONTEXTROW:
-			menufunc= ui_block_func_ICONTEXTROW;
-			arg= but;
+			menufunc = ui_block_func_ICONTEXTROW;
+			arg = but;
 			break;
 		case COL:
 			ui_get_but_vectorf(but, data->origvec);
 			copy_v3_v3(data->vec, data->origvec);
-			but->editvec= data->vec;
+			but->editvec = data->vec;
 
-			handlefunc= ui_block_func_COL;
-			arg= but;
+			handlefunc = ui_block_func_COL;
+			arg = but;
 			break;
 	}
 
-	if(func || handlefunc) {
-		data->menu= ui_popup_block_create(C, data->region, but, func, handlefunc, arg);
-		if(but->block->handle)
-			data->menu->popup= but->block->handle->popup;
+	if (func || handlefunc) {
+		data->menu = ui_popup_block_create(C, data->region, but, func, handlefunc, arg);
+		if (but->block->handle)
+			data->menu->popup = but->block->handle->popup;
 	}
-	else if(menufunc || menustr) {
-		data->menu= ui_popup_menu_create(C, data->region, but, menufunc, arg, menustr);
-		if(but->block->handle)
-			data->menu->popup= but->block->handle->popup;
+	else if (menufunc || menustr) {
+		data->menu = ui_popup_menu_create(C, data->region, but, menufunc, arg, menustr);
+		if (but->block->handle)
+			data->menu->popup = but->block->handle->popup;
 	}
 
 	/* 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)
 {
-	if(but) {
-		but->editval= NULL;
-		but->editvec= NULL;
+	if (but) {
+		but->editval = NULL;
+		but->editvec = NULL;
 
-		but->block->auto_open_last= PIL_check_seconds_timer();
+		but->block->auto_open_last = PIL_check_seconds_timer();
 	}
 
-	if(data->menu) {
+	if (data->menu) {
 		ui_popup_block_free(C, data->menu);
-		data->menu= NULL;
+		data->menu = NULL;
 	}
 }
 
@@ -2202,24 +2084,24 @@ static void ui_blockopen_end(bContext *C, uiBut *but, uiHandleButtonData *data)
 
 static int ui_do_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
-	if(data->state == BUTTON_STATE_HIGHLIGHT) {
-		if(event->type == LEFTMOUSE && event->val==KM_PRESS) {
+	if (data->state == BUTTON_STATE_HIGHLIGHT) {
+		if (event->type == LEFTMOUSE && event->val == KM_PRESS) {
 			button_activate_state(C, but, BUTTON_STATE_WAIT_RELEASE);
 			return WM_UI_HANDLER_BREAK;
 		}
-		else if(event->type == LEFTMOUSE && but->block->handle) {
+		else if (event->type == LEFTMOUSE && but->block->handle) {
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 			return WM_UI_HANDLER_BREAK;
 		}
-		else if(ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS) {
+		else if (ELEM(event->type, PADENTER, RETKEY) && event->val == KM_PRESS) {
 			button_activate_state(C, but, BUTTON_STATE_WAIT_FLASH);
 			return WM_UI_HANDLER_BREAK;
 		}
 	}
-	else if(data->state == BUTTON_STATE_WAIT_RELEASE) {
-		if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
-			if(!(but->flag & UI_SELECT))
-				data->cancel= 1;
+	else if (data->state == BUTTON_STATE_WAIT_RELEASE) {
+		if (event->type == LEFTMOUSE && event->val != KM_PRESS) {
+			if (!(but->flag & UI_SELECT))
+				data->cancel = 1;
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 			return WM_UI_HANDLER_BREAK;
 		}
@@ -2230,27 +2112,27 @@ static int ui_do_but_BUT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEv
 
 static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
-	if(data->state == BUTTON_STATE_HIGHLIGHT) {
-		if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
-			but->drawstr[0]= 0;
-			but->modifier_key= 0;
+	if (data->state == BUTTON_STATE_HIGHLIGHT) {
+		if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) {
+			but->drawstr[0] = 0;
+			but->modifier_key = 0;
 			button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT);
 			return WM_UI_HANDLER_BREAK;
 		}
 	}
-	else if(data->state == BUTTON_STATE_WAIT_KEY_EVENT) {
+	else if (data->state == BUTTON_STATE_WAIT_KEY_EVENT) {
 		
-		if(event->type == MOUSEMOVE)
+		if (event->type == MOUSEMOVE)
 			return WM_UI_HANDLER_CONTINUE;
 		
-		if(event->type == LEFTMOUSE && event->val==KM_PRESS) {
+		if (event->type == LEFTMOUSE && event->val == KM_PRESS) {
 			/* only cancel if click outside the button */
-			if(ui_mouse_inside_button(but->active->region, but, event->x, event->y) == 0) {
+			if (ui_mouse_inside_button(but->active->region, but, event->x, event->y) == 0) {
 				/* data->cancel doesnt work, this button opens immediate */
-				if(but->flag & UI_BUT_IMMEDIATE)
+				if (but->flag & UI_BUT_IMMEDIATE)
 					ui_set_but_val(but, 0);
 				else
-					data->cancel= 1;
+					data->cancel = 1;
 				button_activate_state(C, but, BUTTON_STATE_EXIT);
 				return WM_UI_HANDLER_BREAK;
 			}
@@ -2258,28 +2140,28 @@ static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data
 		
 		/* always set */
 		but->modifier_key = 0;
-		if(event->shift) but->modifier_key |= KM_SHIFT;
-		if(event->alt)   but->modifier_key |= KM_ALT;
-		if(event->ctrl)  but->modifier_key |= KM_CTRL;
-		if(event->oskey) but->modifier_key |= KM_OSKEY;
+		if (event->shift) but->modifier_key |= KM_SHIFT;
+		if (event->alt) but->modifier_key |= KM_ALT;
+		if (event->ctrl) but->modifier_key |= KM_CTRL;
+		if (event->oskey) but->modifier_key |= KM_OSKEY;
 
 		ui_check_but(but);
 		ED_region_tag_redraw(data->region);
 			
-		if(event->val==KM_PRESS) {
-			if(ISHOTKEY(event->type)) { 
+		if (event->val == KM_PRESS) {
+			if (ISHOTKEY(event->type)) { 
 				
-				if(WM_key_event_string(event->type)[0])
+				if (WM_key_event_string(event->type)[0])
 					ui_set_but_val(but, event->type);
 				else
-					data->cancel= 1;
+					data->cancel = 1;
 				
 				button_activate_state(C, but, BUTTON_STATE_EXIT);
 				return WM_UI_HANDLER_BREAK;
 			}
-			else if(event->type == ESCKEY) {
-				data->cancel= 1;
-				data->escapecancel= 1;
+			else if (event->type == ESCKEY) {
+				data->cancel = 1;
+				data->escapecancel = 1;
 				button_activate_state(C, but, BUTTON_STATE_EXIT);
 			}
 			
@@ -2291,21 +2173,21 @@ static int ui_do_but_HOTKEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data
 
 static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
-	if(data->state == BUTTON_STATE_HIGHLIGHT) {
-		if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
+	if (data->state == BUTTON_STATE_HIGHLIGHT) {
+		if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) {
 			button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT);
 			return WM_UI_HANDLER_BREAK;
 		}
 	}
-	else if(data->state == BUTTON_STATE_WAIT_KEY_EVENT) {
-		if(event->type == MOUSEMOVE)
+	else if (data->state == BUTTON_STATE_WAIT_KEY_EVENT) {
+		if (event->type == MOUSEMOVE)
 			return WM_UI_HANDLER_CONTINUE;
 
-		if(event->val==KM_PRESS) {
-			if(WM_key_event_string(event->type)[0])
+		if (event->val == KM_PRESS) {
+			if (WM_key_event_string(event->type)[0])
 				ui_set_but_val(but, event->type);
 			else
-				data->cancel= 1;
+				data->cancel = 1;
 
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 		}
@@ -2316,20 +2198,20 @@ static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, w
 
 static int ui_do_but_TEX(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
-	if(data->state == BUTTON_STATE_HIGHLIGHT) {
-		if(ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN) && event->val==KM_PRESS) {
-			if(but->dt == UI_EMBOSSN && !event->ctrl);
+	if (data->state == BUTTON_STATE_HIGHLIGHT) {
+		if (ELEM(event->type, LEFTMOUSE, EVT_BUT_OPEN) && event->val == KM_PRESS) {
+			if (but->dt == UI_EMBOSSN && !event->ctrl) ;
 			else {
 				button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
 				return WM_UI_HANDLER_BREAK;
 			}
 		}
 	}
-	else if(data->state == BUTTON_STATE_TEXT_EDITING) {
+	else if (data->state == BUTTON_STATE_TEXT_EDITING) {
 		ui_do_but_textedit(C, block, but, data, event);
 		return WM_UI_HANDLER_BREAK;
 	}
-	else if(data->state == BUTTON_STATE_TEXT_SELECTING) {
+	else if (data->state == BUTTON_STATE_TEXT_SELECTING) {
 		ui_do_but_textedit_select(C, block, but, data, event);
 		return WM_UI_HANDLER_BREAK;
 	}
@@ -2339,10 +2221,10 @@ static int ui_do_but_TEX(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
 
 static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
-	if(data->state == BUTTON_STATE_HIGHLIGHT) {
-		if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
-			data->togdual= event->ctrl;
-			data->togonly= !event->shift;
+	if (data->state == BUTTON_STATE_HIGHLIGHT) {
+		if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) {
+			data->togdual = event->ctrl;
+			data->togonly = !event->shift;
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 			return WM_UI_HANDLER_BREAK;
 		}
@@ -2353,42 +2235,42 @@ static int ui_do_but_TOG(bContext *C, uiBut *but, uiHandleButtonData *data, wmEv
 static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
 	
-	if(data->state == BUTTON_STATE_HIGHLIGHT) {
+	if (data->state == BUTTON_STATE_HIGHLIGHT) {
 
 		/* first handle click on icondrag type button */
-		if(event->type==LEFTMOUSE && but->dragpoin) {
-			if(ui_but_mouse_inside_icon(but, data->region, event)) {
+		if (event->type == LEFTMOUSE && but->dragpoin) {
+			if (ui_but_mouse_inside_icon(but, data->region, event)) {
 				
 				/* tell the button to wait and keep checking further events to
 				 * see if it should start dragging */
 				button_activate_state(C, but, BUTTON_STATE_WAIT_DRAG);
-				data->dragstartx= event->x;
-				data->dragstarty= event->y;
+				data->dragstartx = event->x;
+				data->dragstarty = event->y;
 				return WM_UI_HANDLER_CONTINUE;
 			}
 		}
 		
-		if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
+		if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) {
 			int ret = WM_UI_HANDLER_BREAK;
 			/* XXX (a bit ugly) Special case handling for filebrowser drag button */
-			if(but->dragpoin && but->imb && ui_but_mouse_inside_icon(but, data->region, event)) {
+			if (but->dragpoin && but->imb && ui_but_mouse_inside_icon(but, data->region, event)) {
 				ret = WM_UI_HANDLER_CONTINUE;
 			}
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 			return ret;
 		}
 	}
-	else if(data->state == BUTTON_STATE_WAIT_DRAG) {
+	else if (data->state == BUTTON_STATE_WAIT_DRAG) {
 		
 		/* this function also ends state */
-		if(ui_but_start_drag(C, but, data, event)) {
+		if (ui_but_start_drag(C, but, data, event)) {
 			return WM_UI_HANDLER_BREAK;
 		}
 		
 		/* If the mouse has been pressed and released, getting to 
 		 * this point without triggering a drag, then clear the 
 		 * drag state for this button and continue to pass on the event */
-		if(event->type==LEFTMOUSE && event->val==KM_RELEASE) {
+		if (event->type == LEFTMOUSE && event->val == KM_RELEASE) {
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 			return WM_UI_HANDLER_CONTINUE;
 		}
@@ -2404,25 +2286,25 @@ static int ui_do_but_EXIT(bContext *C, uiBut *but, uiHandleButtonData *data, wmE
 /* var names match ui_numedit_but_NUM */
 static float ui_numedit_apply_snapf(uiBut *but, float tempf, float softmin, float softmax, float softrange, int snap)
 {
-	if(tempf==softmin || tempf==softmax || snap==0) {
+	if (tempf == softmin || tempf == softmax || snap == 0) {
 		/* pass */
 	}
 	else {
-		float fac= 1.0f;
+		float fac = 1.0f;
 		
-		if(ui_is_but_unit(but)) {
-			UnitSettings *unit= but->block->unit;
-			int unit_type= uiButGetUnitType(but)>>16;
+		if (ui_is_but_unit(but)) {
+			UnitSettings *unit = but->block->unit;
+			int unit_type = RNA_SUBTYPE_UNIT_VALUE(uiButGetUnitType(but));
 
-			if(bUnit_IsValid(unit->system, unit_type)) {
-				fac= (float)bUnit_BaseScalar(unit->system, unit_type);
-				if(ELEM3(unit_type, B_UNIT_LENGTH, B_UNIT_AREA, B_UNIT_VOLUME)) {
+			if (bUnit_IsValid(unit->system, unit_type)) {
+				fac = (float)bUnit_BaseScalar(unit->system, unit_type);
+				if (ELEM3(unit_type, B_UNIT_LENGTH, B_UNIT_AREA, B_UNIT_VOLUME)) {
 					fac /= unit->scale_length;
 				}
 			}
 		}
 
-		if(fac != 1.0f) {
+		if (fac != 1.0f) {
 			/* snap in unit-space */
 			tempf /= fac;
 			/* softmin /= fac; */ /* UNUSED */
@@ -2430,18 +2312,18 @@ static float ui_numedit_apply_snapf(uiBut *but, float tempf, float softmin, floa
 			softrange /= fac;
 		}
 
-		if(snap==1) {
-			if(softrange < 2.10f) tempf= 0.1f*floorf(10.0f*tempf);
-			else if(softrange < 21.0f) tempf= floorf(tempf);
-			else tempf= 10.0f*floorf(tempf/10.0f);
+		if (snap == 1) {
+			if (softrange < 2.10f) tempf = 0.1f * floorf(10.0f * tempf);
+			else if (softrange < 21.0f) tempf = floorf(tempf);
+			else tempf = 10.0f * floorf(tempf / 10.0f);
 		}
-		else if(snap==2) {
-			if(softrange < 2.10f) tempf= 0.01f*floorf(100.0f*tempf);
-			else if(softrange < 21.0f) tempf= 0.1f*floorf(10.0f*tempf);
-			else tempf= floor(tempf);
+		else if (snap == 2) {
+			if (softrange < 2.10f) tempf = 0.01f * floorf(100.0f * tempf);
+			else if (softrange < 21.0f) tempf = 0.1f * floorf(10.0f * tempf);
+			else tempf = floor(tempf);
 		}
 		
-		if(fac != 1.0f)
+		if (fac != 1.0f)
 			tempf *= fac;
 	}
 
@@ -2450,18 +2332,18 @@ static float ui_numedit_apply_snapf(uiBut *but, float tempf, float softmin, floa
 
 static float ui_numedit_apply_snap(int temp, float softmin, float softmax, int snap)
 {
-	if(temp==softmin || temp==softmax)
+	if (temp == softmin || temp == softmax)
 		return temp;
 
-	switch(snap) {
-	case 0:
-		break;
-	case 1:
-		temp= 10*(temp/10);
-		break;
-	case 2:
-		temp= 100*(temp/100);
-		break;
+	switch (snap) {
+		case 0:
+			break;
+		case 1:
+			temp = 10 * (temp / 10);
+			break;
+		case 2:
+			temp = 100 * (temp / 100);
+			break;
 	}
 
 	return temp;
@@ -2470,132 +2352,136 @@ static float ui_numedit_apply_snap(int temp, float softmin, float softmax, int s
 static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, int snap, int mx)
 {
 	float deler, tempf, softmin, softmax, softrange;
-	int lvalue, temp, changed= 0;
+	int lvalue, temp, changed = 0;
 	
-	if(mx == data->draglastx)
+	if (mx == data->draglastx)
 		return changed;
 	
 	/* drag-lock - prevent unwanted scroll adjustments */
 	/* change value (now 3) to adjust threshold in pixels */
-	if(data->draglock) {
-		if(abs(mx-data->dragstartx) <= 3)
+	if (data->draglock) {
+		if (abs(mx - data->dragstartx) <= 3)
 			return changed;
 
-		data->draglock= 0;
-		data->dragstartx= mx;  /* ignore mouse movement within drag-lock */
+		data->draglock = 0;
+		data->dragstartx = mx;  /* ignore mouse movement within drag-lock */
 	}
 
-	softmin= but->softmin;
-	softmax= but->softmax;
-	softrange= softmax - softmin;
+	softmin = but->softmin;
+	softmax = but->softmax;
+	softrange = softmax - softmin;
 
-	if(ui_is_a_warp_but(but)) {
+	if (ui_is_a_warp_but(but)) {
 		/* Mouse location isn't screen clamped to the screen so use a linear mapping
 		 * 2px == 1-int, or 1px == 1-ClickStep */
-		if(ui_is_but_float(but)) {
-			fac *= 0.01f*but->a1;
+		if (ui_is_but_float(but)) {
+			fac *= 0.01f * but->a1;
 			tempf = (float)data->startvalue + ((float)(mx - data->dragstartx) * fac);
-			tempf= ui_numedit_apply_snapf(but, tempf, softmin, softmax, softrange, snap);
-
-#if 1		/* fake moving the click start, nicer for dragging back after passing the limit */
-			if(tempf < softmin) {
-				data->dragstartx -= (softmin-tempf) / fac;
-				tempf= softmin;
-			} else if (tempf > softmax) {
-				data->dragstartx += (tempf-softmax) / fac;
-				tempf= softmax;
+			tempf = ui_numedit_apply_snapf(but, tempf, softmin, softmax, softrange, snap);
+
+#if 1       /* fake moving the click start, nicer for dragging back after passing the limit */
+			if (tempf < softmin) {
+				data->dragstartx -= (softmin - tempf) / fac;
+				tempf = softmin;
+			}
+			else if (tempf > softmax) {
+				data->dragstartx += (tempf - softmax) / fac;
+				tempf = softmax;
 			}
 #else
 			CLAMP(tempf, softmin, softmax);
 #endif
 
-			if(tempf != (float)data->value) {
-				data->dragchange= 1;
-				data->value= tempf;
-				changed= 1;
+			if (tempf != (float)data->value) {
+				data->dragchange = 1;
+				data->value = tempf;
+				changed = 1;
 			}
 		}
 		else {
-			if(softrange > 256)		fac= 1.0;		/* 1px == 1 */
-			else if(softrange > 32)	fac= 1.0/2.0;	/* 2px == 1 */
-			else					fac= 1.0/16.0;	/* 16px == 1? */
-
-			temp= data->startvalue + (((double)mx - data->dragstartx) * (double)fac);
-			temp= ui_numedit_apply_snap(temp, softmin, softmax, snap);
-
-#if 1		/* fake moving the click start, nicer for dragging back after passing the limit */
-			if(temp < softmin) {
-				data->dragstartx -= (softmin-temp) / fac;
-				temp= softmin;
-			} else if (temp > softmax) {
-				data->dragstartx += (temp-softmax) / fac;
-				temp= softmax;
+			if (softrange > 256) fac = 1.0;             /* 1px == 1 */
+			else if (softrange > 32) fac = 1.0 / 2.0;   /* 2px == 1 */
+			else fac = 1.0 / 16.0;                  /* 16px == 1? */
+
+			temp = data->startvalue + (((double)mx - data->dragstartx) * (double)fac);
+			temp = ui_numedit_apply_snap(temp, softmin, softmax, snap);
+
+#if 1       /* fake moving the click start, nicer for dragging back after passing the limit */
+			if (temp < softmin) {
+				data->dragstartx -= (softmin - temp) / fac;
+				temp = softmin;
+			}
+			else if (temp > softmax) {
+				data->dragstartx += (temp - softmax) / fac;
+				temp = softmax;
 			}
 #else
 			CLAMP(temp, softmin, softmax);
 #endif
 
-			if(temp != data->value) {
-				data->dragchange= 1;
-				data->value= temp;
-				changed= 1;
+			if (temp != data->value) {
+				data->dragchange = 1;
+				data->value = temp;
+				changed = 1;
 			}
 		}
 
-		data->draglastx= mx;
+		data->draglastx = mx;
 	}
 	else {
 		/* Use a non-linear mapping of the mouse drag especially for large floats (normal behavior) */
-		deler= 500;
-		if(!ui_is_but_float(but)) {
+		deler = 500;
+		if (!ui_is_but_float(but)) {
 			/* prevent large ranges from getting too out of control */
 			if (softrange > 600) deler = powf(softrange, 0.75);
 			
-			if (softrange < 100) deler= 200.0;
-			if (softrange < 25) deler= 50.0;
+			if (softrange < 100) deler = 200.0;
+			if (softrange < 25) deler = 50.0;
 		}
 		deler /= fac;
 
-		if(softrange > 11) {
+		if (softrange > 11) {
 			/* non linear change in mouse input- good for high precicsion */
-			data->dragf+= (((float)(mx-data->draglastx))/deler) * (fabsf(data->dragstartx-mx)*0.002f);
-		} else if (softrange > 129) { /* only scale large int buttons */
+			data->dragf += (((float)(mx - data->draglastx)) / deler) * (fabsf(data->dragstartx - mx) * 0.002f);
+		}
+		else if (softrange > 129) { /* only scale large int buttons */
 			/* non linear change in mouse input- good for high precicsionm ints need less fine tuning */
-			data->dragf+= (((float)(mx-data->draglastx))/deler) * (fabsf(data->dragstartx-mx)*0.004f);
-		} else {
+			data->dragf += (((float)(mx - data->draglastx)) / deler) * (fabsf(data->dragstartx - mx) * 0.004f);
+		}
+		else {
 			/*no scaling */
-			data->dragf+= ((float)(mx-data->draglastx))/deler ;
+			data->dragf += ((float)(mx - data->draglastx)) / deler;
 		}
 	
 		CLAMP(data->dragf, 0.0f, 1.0f);
-		data->draglastx= mx;
-		tempf= (softmin + data->dragf*softrange);
+		data->draglastx = mx;
+		tempf = (softmin + data->dragf * softrange);
 
 
-		if(!ui_is_but_float(but)) {
-			temp= floorf(tempf + 0.5f);
+		if (!ui_is_but_float(but)) {
+			temp = floorf(tempf + 0.5f);
 
-			temp= ui_numedit_apply_snap(temp, softmin, softmax, snap);
+			temp = ui_numedit_apply_snap(temp, softmin, softmax, snap);
 
 			CLAMP(temp, softmin, softmax);
-			lvalue= (int)data->value;
+			lvalue = (int)data->value;
 			
-			if(temp != lvalue) {
-				data->dragchange= 1;
-				data->value= (double)temp;
-				changed= 1;
+			if (temp != lvalue) {
+				data->dragchange = 1;
+				data->value = (double)temp;
+				changed = 1;
 			}
 		}
 		else {
-			temp= 0;
-			tempf= ui_numedit_apply_snapf(but, tempf, softmin, softmax, softrange, snap);
+			temp = 0;
+			tempf = ui_numedit_apply_snapf(but, tempf, softmin, softmax, softrange, snap);
 
 			CLAMP(tempf, softmin, softmax);
 
-			if(tempf != (float)data->value) {
-				data->dragchange= 1;
-				data->value= tempf;
-				changed= 1;
+			if (tempf != (float)data->value) {
+				data->dragchange = 1;
+				data->value = tempf;
+				changed = 1;
 			}
 		}
 	}
@@ -2606,112 +2492,112 @@ static int ui_numedit_but_NUM(uiBut *but, uiHandleButtonData *data, float fac, i
 
 static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
-	int mx, my;	/* mouse location scaled to fit the UI */
+	int mx, my; /* mouse location scaled to fit the UI */
 	int screen_mx, screen_my; /* mouse location kept at screen pixel coords */
-	int click= 0;
-	int retval= WM_UI_HANDLER_CONTINUE;
+	int click = 0;
+	int retval = WM_UI_HANDLER_CONTINUE;
 	
-	mx= screen_mx= event->x;
-	my= screen_my= event->y;
+	mx = screen_mx = event->x;
+	my = screen_my = event->y;
 
 	ui_window_to_block(data->region, block, &mx, &my);
 
-	if(data->state == BUTTON_STATE_HIGHLIGHT) {
+	if (data->state == BUTTON_STATE_HIGHLIGHT) {
 		/* XXX hardcoded keymap check.... */
-		if(event->type == WHEELDOWNMOUSE && event->alt) {
-			mx= but->x1;
-			click= 1;
+		if (event->type == WHEELDOWNMOUSE && event->alt) {
+			mx = but->x1;
+			click = 1;
 		}
-		else if(event->type == WHEELUPMOUSE && event->alt) {
-			mx= but->x2;
-			click= 1;
+		else if (event->type == WHEELUPMOUSE && event->alt) {
+			mx = but->x2;
+			click = 1;
 		}
-		else if(event->val==KM_PRESS) {
-			if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->ctrl) {
+		else if (event->val == KM_PRESS) {
+			if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->ctrl) {
 				button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
-				retval= WM_UI_HANDLER_BREAK;
+				retval = WM_UI_HANDLER_BREAK;
 			}
-			else if(event->type == LEFTMOUSE) {
-				data->dragstartx= data->draglastx= ui_is_a_warp_but(but) ? screen_mx:mx;
+			else if (event->type == LEFTMOUSE) {
+				data->dragstartx = data->draglastx = ui_is_a_warp_but(but) ? screen_mx : mx;
 				button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
-				retval= WM_UI_HANDLER_BREAK;
+				retval = WM_UI_HANDLER_BREAK;
 			}
-			else if(ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS)
-				click= 1;
-			else if (event->type == MINUSKEY && event->val==KM_PRESS) {
+			else if (ELEM(event->type, PADENTER, RETKEY) && event->val == KM_PRESS)
+				click = 1;
+			else if (event->type == MINUSKEY && event->val == KM_PRESS) {
 				button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 				data->value = -data->value;
 				button_activate_state(C, but, BUTTON_STATE_EXIT);
-				retval= WM_UI_HANDLER_BREAK;
+				retval = WM_UI_HANDLER_BREAK;
 			}
 		}
 		
 	}
-	else if(data->state == BUTTON_STATE_NUM_EDITING) {
-		if(event->type == ESCKEY) {
-			data->cancel= 1;
-			data->escapecancel= 1;
+	else if (data->state == BUTTON_STATE_NUM_EDITING) {
+		if (event->type == ESCKEY) {
+			data->cancel = 1;
+			data->escapecancel = 1;
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 		}
-		else if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
-			if(data->dragchange)
+		else if (event->type == LEFTMOUSE && event->val != KM_PRESS) {
+			if (data->dragchange)
 				button_activate_state(C, but, BUTTON_STATE_EXIT);
 			else
-				click= 1;
+				click = 1;
 		}
-		else if(event->type == MOUSEMOVE) {
+		else if (event->type == MOUSEMOVE) {
 			float fac;
 			int snap;
 
-			fac= 1.0f;
-			if(event->shift) fac /= 10.0f;
-			if(event->alt) fac /= 20.0f;
+			fac = 1.0f;
+			if (event->shift) fac /= 10.0f;
+			if (event->alt) fac /= 20.0f;
 			
-			snap= (event->ctrl)? (event->shift)? 2: 1: 0;
+			snap = (event->ctrl) ? (event->shift) ? 2 : 1 : 0;
 
-			if(ui_numedit_but_NUM(but, data, fac, snap, (ui_is_a_warp_but(but) ? screen_mx:mx)))
+			if (ui_numedit_but_NUM(but, data, fac, snap, (ui_is_a_warp_but(but) ? screen_mx : mx)))
 				ui_numedit_apply(C, block, but, data);
 		}
-		retval= WM_UI_HANDLER_BREAK;
+		retval = WM_UI_HANDLER_BREAK;
 	}
-	else if(data->state == BUTTON_STATE_TEXT_EDITING) {
+	else if (data->state == BUTTON_STATE_TEXT_EDITING) {
 		ui_do_but_textedit(C, block, but, data, event);
-		retval= WM_UI_HANDLER_BREAK;
+		retval = WM_UI_HANDLER_BREAK;
 	}
-	else if(data->state == BUTTON_STATE_TEXT_SELECTING) {
+	else if (data->state == BUTTON_STATE_TEXT_SELECTING) {
 		ui_do_but_textedit_select(C, block, but, data, event);
-		retval= WM_UI_HANDLER_BREAK;
+		retval = WM_UI_HANDLER_BREAK;
 	}
 	
-	if(click) {
+	if (click) {
 		/* we can click on the side arrows to increment/decrement,
 		 * or click inside to edit the value directly */
 		float tempf, softmin, softmax;
 		int temp;
 
-		softmin= but->softmin;
-		softmax= but->softmax;
+		softmin = but->softmin;
+		softmax = but->softmax;
 
-		if(!ui_is_but_float(but)) {
-			if(mx < (but->x1 + (but->x2 - but->x1)/3 - 3)) {
+		if (!ui_is_but_float(but)) {
+			if (mx < (but->x1 + (but->x2 - but->x1) / 3 - 3)) {
 				button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 
-				temp= (int)data->value - 1;
-				if(temp>=softmin && temp<=softmax)
-					data->value= (double)temp;
+				temp = (int)data->value - 1;
+				if (temp >= softmin && temp <= softmax)
+					data->value = (double)temp;
 				else
-					data->cancel= 1;
+					data->cancel = 1;
 
 				button_activate_state(C, but, BUTTON_STATE_EXIT);
 			}
-			else if(mx > (but->x1 + (2*(but->x2 - but->x1)/3) + 3)) {
+			else if (mx > (but->x1 + (2 * (but->x2 - but->x1) / 3) + 3)) {
 				button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 
-				temp= (int)data->value + 1;
-				if(temp>=softmin && temp<=softmax)
-					data->value= (double)temp;
+				temp = (int)data->value + 1;
+				if (temp >= softmin && temp <= softmax)
+					data->value = (double)temp;
 				else
-					data->cancel= 1;
+					data->cancel = 1;
 
 				button_activate_state(C, but, BUTTON_STATE_EXIT);
 			}
@@ -2719,21 +2605,21 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
 				button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
 		}
 		else {
-			if(mx < (but->x1 + (but->x2 - but->x1)/3 - 3)) {
+			if (mx < (but->x1 + (but->x2 - but->x1) / 3 - 3)) {
 				button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 
-				tempf= (float)data->value - 0.01f * but->a1;
+				tempf = (float)data->value - 0.01f * but->a1;
 				if (tempf < softmin) tempf = softmin;
-				data->value= tempf;
+				data->value = tempf;
 
 				button_activate_state(C, but, BUTTON_STATE_EXIT);
 			}
-			else if(mx > but->x1 + (2*((but->x2 - but->x1)/3) + 3)) {
+			else if (mx > but->x1 + (2 * ((but->x2 - but->x1) / 3) + 3)) {
 				button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 
-				tempf= (float)data->value + 0.01f * but->a1;
+				tempf = (float)data->value + 0.01f * but->a1;
 				if (tempf > softmax) tempf = softmax;
-				data->value= tempf;
+				data->value = tempf;
 
 				button_activate_state(C, but, BUTTON_STATE_EXIT);
 			}
@@ -2741,7 +2627,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
 				button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
 		}
 
-		retval= WM_UI_HANDLER_BREAK;
+		retval = WM_UI_HANDLER_BREAK;
 	}
 	
 	return retval;
@@ -2750,70 +2636,70 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
 static int ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, int shift, int ctrl, int mx)
 {
 	float deler, f, tempf, softmin, softmax, softrange;
-	int temp, lvalue, changed= 0;
+	int temp, lvalue, changed = 0;
 
-	softmin= but->softmin;
-	softmax= but->softmax;
-	softrange= softmax - softmin;
+	softmin = but->softmin;
+	softmax = but->softmax;
+	softrange = softmax - softmin;
 
-	if(but->type==NUMSLI) deler= ((but->x2-but->x1) - 5.0f*but->aspect);
-	else if(but->type==HSVSLI) deler= ((but->x2-but->x1)/2.0f - 5.0f*but->aspect);
-	else if(but->type==SCROLL) {
-		int horizontal= (but->x2 - but->x1 > but->y2 - but->y1);
-		float size= (horizontal)? (but->x2-but->x1): -(but->y2-but->y1);
-		deler= size*(but->softmax - but->softmin)/(but->softmax - but->softmin + but->a1);
+	if (but->type == NUMSLI) deler = ((but->x2 - but->x1) - 5.0f * but->aspect);
+	else if (but->type == HSVSLI) deler = ((but->x2 - but->x1) / 2.0f - 5.0f * but->aspect);
+	else if (but->type == SCROLL) {
+		int horizontal = (but->x2 - but->x1 > but->y2 - but->y1);
+		float size = (horizontal) ? (but->x2 - but->x1) : -(but->y2 - but->y1);
+		deler = size * (but->softmax - but->softmin) / (but->softmax - but->softmin + but->a1);
 	}
-	else deler= (but->x2-but->x1- 5.0f*but->aspect);
+	else deler = (but->x2 - but->x1 - 5.0f * but->aspect);
 
-	f= (float)(mx-data->dragstartx)/deler + data->dragfstart;
+	f = (float)(mx - data->dragstartx) / deler + data->dragfstart;
 	
-	if(shift)
-		f= (f-data->dragfstart)/10.0f + data->dragfstart;
+	if (shift)
+		f = (f - data->dragfstart) / 10.0f + data->dragfstart;
 
 	CLAMP(f, 0.0f, 1.0f);
-	tempf= softmin + f*softrange;
-	temp= floorf(tempf+0.5f);
-
-	if(ctrl) {
-		if(tempf==softmin || tempf==softmax);
-		else if(ui_is_but_float(but)) {
-
-			if(shift) {
-				if(tempf==softmin || tempf==softmax);
-				else if(softmax-softmin < 2.10f) tempf= 0.01f * floorf(100.0f*tempf);
-				else if(softmax-softmin < 21.0f) tempf= 0.1f * floorf(10.0f*tempf);
-				else tempf= floorf(tempf);
+	tempf = softmin + f * softrange;
+	temp = floorf(tempf + 0.5f);
+
+	if (ctrl) {
+		if (tempf == softmin || tempf == softmax) ;
+		else if (ui_is_but_float(but)) {
+
+			if (shift) {
+				if (tempf == softmin || tempf == softmax) ;
+				else if (softmax - softmin < 2.10f) tempf = 0.01f * floorf(100.0f * tempf);
+				else if (softmax - softmin < 21.0f) tempf = 0.1f * floorf(10.0f * tempf);
+				else tempf = floorf(tempf);
 			}
 			else {
-				if(softmax-softmin < 2.10f) tempf= 0.1f * floorf(10.0f*tempf);
-				else if(softmax-softmin < 21.0f) tempf= floorf(tempf);
-				else tempf= 10.0f*floorf(tempf/10.0f);
+				if (softmax - softmin < 2.10f) tempf = 0.1f * floorf(10.0f * tempf);
+				else if (softmax - softmin < 21.0f) tempf = floorf(tempf);
+				else tempf = 10.0f * floorf(tempf / 10.0f);
 			}
 		}
 		else {
-			temp= 10*(temp/10);
-			tempf= temp;
+			temp = 10 * (temp / 10);
+			tempf = temp;
 		}
 	}
 
-	if(!ui_is_but_float(but)) {
-		lvalue= floor(data->value+0.5);
+	if (!ui_is_but_float(but)) {
+		lvalue = floor(data->value + 0.5);
 
 		CLAMP(temp, softmin, softmax);
 
-		if(temp != lvalue) {
-			data->value= temp;
-			data->dragchange= 1;
-			changed= 1;
+		if (temp != lvalue) {
+			data->value = temp;
+			data->dragchange = 1;
+			changed = 1;
 		}
 	}
 	else {
 		CLAMP(tempf, softmin, softmax);
 
-		if(tempf != (float)data->value) {
-			data->value= tempf;
-			data->dragchange= 1;
-			changed= 1;
+		if (tempf != (float)data->value) {
+			data->value = tempf;
+			data->dragchange = 1;
+			changed = 1;
 		}
 	}
 
@@ -2822,30 +2708,30 @@ static int ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, int shift, i
 
 static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
-	int mx, my, click= 0;
-	int retval= WM_UI_HANDLER_CONTINUE;
+	int mx, my, click = 0;
+	int retval = WM_UI_HANDLER_CONTINUE;
 
-	mx= event->x;
-	my= event->y;
+	mx = event->x;
+	my = event->y;
 	ui_window_to_block(data->region, block, &mx, &my);
 
-	if(data->state == BUTTON_STATE_HIGHLIGHT) {
+	if (data->state == BUTTON_STATE_HIGHLIGHT) {
 		/* XXX hardcoded keymap check.... */
-		if(event->type == WHEELDOWNMOUSE && event->alt) {
-			mx= but->x1;
-			click= 2;
+		if (event->type == WHEELDOWNMOUSE && event->alt) {
+			mx = but->x1;
+			click = 2;
 		}
-		else if(event->type == WHEELUPMOUSE && event->alt) {
-			mx= but->x2;
-			click= 2;
+		else if (event->type == WHEELUPMOUSE && event->alt) {
+			mx = but->x2;
+			click = 2;
 		}
-		else if(event->val==KM_PRESS) {
-			if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->ctrl) {
+		else if (event->val == KM_PRESS) {
+			if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->ctrl) {
 				button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
-				retval= WM_UI_HANDLER_BREAK;
+				retval = WM_UI_HANDLER_BREAK;
 			}
 			/* alt-click on sides to get "arrows" like in NUM buttons, and match wheel usage above */
-			else if(event->type == LEFTMOUSE && event->alt) {
+			else if (event->type == LEFTMOUSE && event->alt) {
 				int halfpos = (but->x1 + but->x2) / 2;
 				click = 2;
 				if (mx < halfpos)
@@ -2853,102 +2739,102 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
 				else
 					mx = but->x2;
 			}
-			else if(event->type == LEFTMOUSE) {
-				data->dragstartx= mx;
-				data->draglastx= mx;
+			else if (event->type == LEFTMOUSE) {
+				data->dragstartx = mx;
+				data->draglastx = mx;
 				button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
-				retval= WM_UI_HANDLER_BREAK;
+				retval = WM_UI_HANDLER_BREAK;
 			}
-			else if(ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS)
-				click= 1;
-			else if (event->type == MINUSKEY && event->val==KM_PRESS) {
+			else if (ELEM(event->type, PADENTER, RETKEY) && event->val == KM_PRESS)
+				click = 1;
+			else if (event->type == MINUSKEY && event->val == KM_PRESS) {
 				button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 				data->value = -data->value;
 				button_activate_state(C, but, BUTTON_STATE_EXIT);
-				retval= WM_UI_HANDLER_BREAK;
+				retval = WM_UI_HANDLER_BREAK;
 			}
 		}
 	}
-	else if(data->state == BUTTON_STATE_NUM_EDITING) {
-		if(event->type == ESCKEY) {
-			data->cancel= 1;
-			data->escapecancel= 1;
+	else if (data->state == BUTTON_STATE_NUM_EDITING) {
+		if (event->type == ESCKEY) {
+			data->cancel = 1;
+			data->escapecancel = 1;
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 		}
-		else if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
-			if(data->dragchange)
+		else if (event->type == LEFTMOUSE && event->val != KM_PRESS) {
+			if (data->dragchange)
 				button_activate_state(C, but, BUTTON_STATE_EXIT);
 			else
-				click= 1;
+				click = 1;
 		}
-		else if(event->type == MOUSEMOVE) {
-			if(ui_numedit_but_SLI(but, data, event->shift, event->ctrl, mx))
+		else if (event->type == MOUSEMOVE) {
+			if (ui_numedit_but_SLI(but, data, event->shift, event->ctrl, mx))
 				ui_numedit_apply(C, block, but, data);
 		}
-		retval= WM_UI_HANDLER_BREAK;
+		retval = WM_UI_HANDLER_BREAK;
 	}
-	else if(data->state == BUTTON_STATE_TEXT_EDITING) {
+	else if (data->state == BUTTON_STATE_TEXT_EDITING) {
 		ui_do_but_textedit(C, block, but, data, event);
-		retval= WM_UI_HANDLER_BREAK;
+		retval = WM_UI_HANDLER_BREAK;
 	}
-	else if(data->state == BUTTON_STATE_TEXT_SELECTING) {
+	else if (data->state == BUTTON_STATE_TEXT_SELECTING) {
 		ui_do_but_textedit_select(C, block, but, data, event);
-		retval= WM_UI_HANDLER_BREAK;
+		retval = WM_UI_HANDLER_BREAK;
 	}
 
-	if(click) {
-		if (click==2) {
+	if (click) {
+		if (click == 2) {
 			/* nudge slider to the left or right */
 			float f, tempf, softmin, softmax, softrange;
 			int temp;
 			
 			button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 			
-			softmin= but->softmin;
-			softmax= but->softmax;
-			softrange= softmax - softmin;
+			softmin = but->softmin;
+			softmax = but->softmax;
+			softrange = softmax - softmin;
 			
-			tempf= data->value;
-			temp= (int)data->value;
+			tempf = data->value;
+			temp = (int)data->value;
 
 #if 0
-			if(but->type==SLI) {
-				f= (float)(mx-but->x1)/(but->x2-but->x1); /* same as below */
+			if (but->type == SLI) {
+				f = (float)(mx - but->x1) / (but->x2 - but->x1); /* same as below */
 			}
 			else
 #endif
 			{
-				f= (float)(mx- but->x1)/(but->x2-but->x1);
+				f = (float)(mx - but->x1) / (but->x2 - but->x1);
 			}
 			
-			f= softmin + f*softrange;
+			f = softmin + f * softrange;
 			
-			if(!ui_is_but_float(but)) {
-				if(f<temp) temp--;
+			if (!ui_is_but_float(but)) {
+				if (f < temp) temp--;
 				else temp++;
 				
-				if(temp>=softmin && temp<=softmax)
-					data->value= temp;
+				if (temp >= softmin && temp <= softmax)
+					data->value = temp;
 				else
-					data->cancel= 1;
+					data->cancel = 1;
 			} 
 			else {
-				if(f<tempf) tempf -= 0.01f;
+				if (f < tempf) tempf -= 0.01f;
 				else tempf += 0.01f;
 				
-				if(tempf>=softmin && tempf<=softmax)
-					data->value= tempf;
+				if (tempf >= softmin && tempf <= softmax)
+					data->value = tempf;
 				else
-					data->cancel= 1;
+					data->cancel = 1;
 			}
 			
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
-			retval= WM_UI_HANDLER_BREAK;
+			retval = WM_UI_HANDLER_BREAK;
 		}
 		else {
 			/* edit the value directly */
 			button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
-			retval= WM_UI_HANDLER_BREAK;
+			retval = WM_UI_HANDLER_BREAK;
 		}
 	}
 	
@@ -2958,48 +2844,49 @@ 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 retval= WM_UI_HANDLER_CONTINUE;
-	int horizontal= (but->x2 - but->x1 > but->y2 - but->y1);
+	int retval = WM_UI_HANDLER_CONTINUE;
+	int horizontal = (but->x2 - but->x1 > but->y2 - but->y1);
 	
-	mx= event->x;
-	my= event->y;
+	mx = event->x;
+	my = event->y;
 	ui_window_to_block(data->region, block, &mx, &my);
 
-	if(data->state == BUTTON_STATE_HIGHLIGHT) {
-		if(event->val==KM_PRESS) {
-			if(event->type == LEFTMOUSE) {
-				if(horizontal) {
-					data->dragstartx= mx;
-					data->draglastx= mx;
+	if (data->state == BUTTON_STATE_HIGHLIGHT) {
+		if (event->val == KM_PRESS) {
+			if (event->type == LEFTMOUSE) {
+				if (horizontal) {
+					data->dragstartx = mx;
+					data->draglastx = mx;
 				}
 				else {
-					data->dragstartx= my;
-					data->draglastx= my;
+					data->dragstartx = my;
+					data->draglastx = my;
 				}
 				button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
-				retval= WM_UI_HANDLER_BREAK;
+				retval = WM_UI_HANDLER_BREAK;
 			}
 			/* UNUSED - otherwise code is ok, add back if needed */
-			/* else if(ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS)
-				click= 1;
-			*/
+#if 0
+			else if (ELEM(event->type, PADENTER, RETKEY) && event->val == KM_PRESS)
+				click = 1;
+#endif
 		}
 	}
-	else if(data->state == BUTTON_STATE_NUM_EDITING) {
-		if(event->type == ESCKEY) {
-			data->cancel= 1;
-			data->escapecancel= 1;
+	else if (data->state == BUTTON_STATE_NUM_EDITING) {
+		if (event->type == ESCKEY) {
+			data->cancel = 1;
+			data->escapecancel = 1;
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 		}
-		else if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
+		else if (event->type == LEFTMOUSE && event->val != KM_PRESS) {
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 		}
-		else if(event->type == MOUSEMOVE) {
-			if(ui_numedit_but_SLI(but, data, 0, 0, (horizontal)? mx: my))
+		else if (event->type == MOUSEMOVE) {
+			if (ui_numedit_but_SLI(but, data, 0, 0, (horizontal) ? mx : my))
 				ui_numedit_apply(C, block, but, data);
 		}
 
-		retval= WM_UI_HANDLER_BREAK;
+		retval = WM_UI_HANDLER_BREAK;
 	}
 	
 	return retval;
@@ -3009,68 +2896,68 @@ static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
 static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
 	
-	if(data->state == BUTTON_STATE_HIGHLIGHT) {
+	if (data->state == BUTTON_STATE_HIGHLIGHT) {
 		
 		/* first handle click on icondrag type button */
-		if(event->type==LEFTMOUSE && but->dragpoin && event->val==KM_PRESS) {
-			if(ui_but_mouse_inside_icon(but, data->region, event)) {
+		if (event->type == LEFTMOUSE && but->dragpoin && event->val == KM_PRESS) {
+			if (ui_but_mouse_inside_icon(but, data->region, event)) {
 				button_activate_state(C, but, BUTTON_STATE_WAIT_DRAG);
-				data->dragstartx= event->x;
-				data->dragstarty= event->y;
+				data->dragstartx = event->x;
+				data->dragstarty = event->y;
 				return WM_UI_HANDLER_BREAK;
 			}
 		}
 		
 		/* regular open menu */
-		if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
+		if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) {
 			button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);
 			return WM_UI_HANDLER_BREAK;
 		}
-		else if(ELEM3(but->type, MENU, ICONROW, ICONTEXTROW)) {
+		else if (ELEM3(but->type, MENU, ICONROW, ICONTEXTROW)) {
 			
-			if(event->type == WHEELDOWNMOUSE && event->alt) {
-				data->value= ui_step_name_menu(but, -1);
+			if (event->type == WHEELDOWNMOUSE && event->alt) {
+				data->value = ui_step_name_menu(but, -1);
 				button_activate_state(C, but, BUTTON_STATE_EXIT);
 				ui_apply_button(C, but->block, but, data, 1);
 
 				/* button's state need to be changed to EXIT so moving mouse away from this mouse wouldn't lead
-				 * to cancel changes made to this button, but shanging state to EXIT also makes no button active for
+				 * to cancel changes made to this button, but changing state to EXIT also makes no button active for
 				 * a while which leads to triggering operator when doing fast scrolling mouse wheel.
 				 * using post activate stuff from button allows to make button be active again after checking for all
-				 * all that mouse leave and cancel stuff, so wuick scrool wouldnt't be an issue anumore.
+				 * all that mouse leave and cancel stuff, so quick scroll wouldn't be an issue anymore.
 				 * same goes for scrolling wheel in another direction below (sergey)
 				 */
-				data->postbut= but;
-				data->posttype= BUTTON_ACTIVATE_OVER;
+				data->postbut = but;
+				data->posttype = BUTTON_ACTIVATE_OVER;
 
 				return WM_UI_HANDLER_BREAK;
 			}
-			else if(event->type == WHEELUPMOUSE && event->alt) {
-				data->value= ui_step_name_menu(but, 1);
+			else if (event->type == WHEELUPMOUSE && event->alt) {
+				data->value = ui_step_name_menu(but, 1);
 				button_activate_state(C, but, BUTTON_STATE_EXIT);
 				ui_apply_button(C, but->block, but, data, 1);
 
 				/* why this is needed described above */
-				data->postbut= but;
-				data->posttype= BUTTON_ACTIVATE_OVER;
+				data->postbut = but;
+				data->posttype = BUTTON_ACTIVATE_OVER;
 
 				return WM_UI_HANDLER_BREAK;
 			}
 		}
-		else if(but->type==COL) {
-			if( ELEM(event->type, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->alt) {
-				float *hsv= ui_block_hsv_get(but->block);
+		else if (but->type == COL) {
+			if (ELEM(event->type, WHEELDOWNMOUSE, WHEELUPMOUSE) && event->alt) {
+				float *hsv = ui_block_hsv_get(but->block);
 				float col[3];
 				
 				ui_get_but_vectorf(but, col);
-				rgb_to_hsv_compat(col[0], col[1], col[2], hsv, hsv+1, hsv+2);
+				rgb_to_hsv_compat(col[0], col[1], col[2], hsv, hsv + 1, hsv + 2);
 
-				if(event->type==WHEELDOWNMOUSE)
-					hsv[2]= CLAMPIS(hsv[2]-0.05f, 0.0f, 1.0f);
+				if (event->type == WHEELDOWNMOUSE)
+					hsv[2] = CLAMPIS(hsv[2] - 0.05f, 0.0f, 1.0f);
 				else
-					hsv[2]= CLAMPIS(hsv[2]+0.05f, 0.0f, 1.0f);
+					hsv[2] = CLAMPIS(hsv[2] + 0.05f, 0.0f, 1.0f);
 				
-				hsv_to_rgb(hsv[0], hsv[1], hsv[2], data->vec, data->vec+1, data->vec+2);
+				hsv_to_rgb(hsv[0], hsv[1], hsv[2], data->vec, data->vec + 1, data->vec + 2);
 				ui_set_but_vectorf(but, data->vec);
 				
 				button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -3079,21 +2966,21 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm
 			}
 		}
 	}
-	else if(data->state == BUTTON_STATE_WAIT_DRAG) {
+	else if (data->state == BUTTON_STATE_WAIT_DRAG) {
 		
 		/* this function also ends state */
-		if(ui_but_start_drag(C, but, data, event)) {
+		if (ui_but_start_drag(C, but, data, event)) {
 			return WM_UI_HANDLER_BREAK;
 		}
 		
 		/* outside icon quit, not needed if drag activated */
-		if(0==ui_but_mouse_inside_icon(but, data->region, event)) {
+		if (0 == ui_but_mouse_inside_icon(but, data->region, event)) {
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
-			data->cancel= 1;
+			data->cancel = 1;
 			return WM_UI_HANDLER_BREAK;
 		}
 		
-		if(event->type==LEFTMOUSE && event->val==KM_RELEASE) {
+		if (event->type == LEFTMOUSE && event->val == KM_RELEASE) {
 			button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);
 			return WM_UI_HANDLER_BREAK;
 		}
@@ -3106,58 +2993,58 @@ static int ui_do_but_BLOCK(bContext *C, uiBut *but, uiHandleButtonData *data, wm
 static int ui_numedit_but_NORMAL(uiBut *but, uiHandleButtonData *data, int mx, int my)
 {
 	float dx, dy, rad, radsq, mrad, *fp;
-	int mdx, mdy, changed= 1;
+	int mdx, mdy, changed = 1;
 	
 	/* button is presumed square */
 	/* if mouse moves outside of sphere, it does negative normal */
 
 	/* note that both data->vec and data->origvec should be normalized
-	 * else we'll get a hamrless but annoying jump when first clicking */
+	 * else we'll get a harmless but annoying jump when first clicking */
 
-	fp= data->origvec;
-	rad= (but->x2 - but->x1);
-	radsq= rad*rad;
+	fp = data->origvec;
+	rad = (but->x2 - but->x1);
+	radsq = rad * rad;
 	
-	if(fp[2]>0.0f) {
-		mdx= (rad*fp[0]);
-		mdy= (rad*fp[1]);
+	if (fp[2] > 0.0f) {
+		mdx = (rad * fp[0]);
+		mdy = (rad * fp[1]);
 	}
-	else if(fp[2]> -1.0f) {
-		mrad= rad/sqrtf(fp[0]*fp[0] + fp[1]*fp[1]);
+	else if (fp[2] > -1.0f) {
+		mrad = rad / sqrtf(fp[0] * fp[0] + fp[1] * fp[1]);
 		
-		mdx= 2.0f*mrad*fp[0] - (rad*fp[0]);
-		mdy= 2.0f*mrad*fp[1] - (rad*fp[1]);
+		mdx = 2.0f * mrad * fp[0] - (rad * fp[0]);
+		mdy = 2.0f * mrad * fp[1] - (rad * fp[1]);
 	}
-	else mdx= mdy= 0;
+	else mdx = mdy = 0;
 	
-	dx= (float)(mx+mdx-data->dragstartx);
-	dy= (float)(my+mdy-data->dragstarty);
+	dx = (float)(mx + mdx - data->dragstartx);
+	dy = (float)(my + mdy - data->dragstarty);
 
-	fp= data->vec;
-	mrad= dx*dx+dy*dy;
-	if(mrad < radsq) {	/* inner circle */
-		fp[0]= dx;
-		fp[1]= dy;
-		fp[2]= sqrt( radsq-dx*dx-dy*dy );
+	fp = data->vec;
+	mrad = dx * dx + dy * dy;
+	if (mrad < radsq) { /* inner circle */
+		fp[0] = dx;
+		fp[1] = dy;
+		fp[2] = sqrt(radsq - dx * dx - dy * dy);
 	}
-	else {	/* outer circle */
+	else {  /* outer circle */
 		
-		mrad= rad/sqrtf(mrad);	// veclen
+		mrad = rad / sqrtf(mrad);  // veclen
 		
-		dx*= (2.0f*mrad - 1.0f);
-		dy*= (2.0f*mrad - 1.0f);
+		dx *= (2.0f * mrad - 1.0f);
+		dy *= (2.0f * mrad - 1.0f);
 		
-		mrad= dx*dx+dy*dy;
-		if(mrad < radsq) {
-			fp[0]= dx;
-			fp[1]= dy;
-			fp[2]= -sqrt( radsq-dx*dx-dy*dy );
+		mrad = dx * dx + dy * dy;
+		if (mrad < radsq) {
+			fp[0] = dx;
+			fp[1] = dy;
+			fp[2] = -sqrt(radsq - dx * dx - dy * dy);
 		}
 	}
 	normalize_v3(fp);
 
-	data->draglastx= mx;
-	data->draglasty= my;
+	data->draglastx = mx;
+	data->draglasty = my;
 
 	return changed;
 }
@@ -3166,33 +3053,33 @@ static int ui_do_but_NORMAL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
 {
 	int mx, my;
 
-	mx= event->x;
-	my= event->y;
+	mx = event->x;
+	my = event->y;
 	ui_window_to_block(data->region, block, &mx, &my);
 
-	if(data->state == BUTTON_STATE_HIGHLIGHT) {
-		if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
-			data->dragstartx= mx;
-			data->dragstarty= my;
-			data->draglastx= mx;
-			data->draglasty= my;
+	if (data->state == BUTTON_STATE_HIGHLIGHT) {
+		if (event->type == LEFTMOUSE && event->val == KM_PRESS) {
+			data->dragstartx = mx;
+			data->dragstarty = my;
+			data->draglastx = mx;
+			data->draglasty = my;
 			button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 
 			/* also do drag the first time */
-			if(ui_numedit_but_NORMAL(but, data, mx, my))
+			if (ui_numedit_but_NORMAL(but, data, mx, my))
 				ui_numedit_apply(C, block, but, data);
 			
 			return WM_UI_HANDLER_BREAK;
 		}
 	}
-	else if(data->state == BUTTON_STATE_NUM_EDITING) {
-		if(event->type == MOUSEMOVE) {
-			if(mx!=data->draglastx || my!=data->draglasty) {
-				if(ui_numedit_but_NORMAL(but, data, mx, my))
+	else if (data->state == BUTTON_STATE_NUM_EDITING) {
+		if (event->type == MOUSEMOVE) {
+			if (mx != data->draglastx || my != data->draglasty) {
+				if (ui_numedit_but_NORMAL(but, data, mx, my))
 					ui_numedit_apply(C, block, but, data);
 			}
 		}
-		else if(event->type==LEFTMOUSE && event->val!=KM_PRESS)
+		else if (event->type == LEFTMOUSE && event->val != KM_PRESS)
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 
 		return WM_UI_HANDLER_BREAK;
@@ -3204,9 +3091,9 @@ static int ui_do_but_NORMAL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
 static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx, int my)
 {
 	float rgb[3];
-	float *hsv= ui_block_hsv_get(but->block);
+	float *hsv = ui_block_hsv_get(but->block);
 	float x, y;
-	int changed= 1;
+	int changed = 1;
 	int color_profile = but->block->color_profile;
 	
 	if (but->rnaprop) {
@@ -3216,64 +3103,64 @@ static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx,
 
 	ui_get_but_vectorf(but, rgb);
 
-	rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+	rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv + 1, hsv + 2);
 
 	/* relative position within box */
-	x= ((float)mx-but->x1)/(but->x2-but->x1);
-	y= ((float)my-but->y1)/(but->y2-but->y1);
+	x = ((float)mx - but->x1) / (but->x2 - but->x1);
+	y = ((float)my - but->y1) / (but->y2 - but->y1);
 	CLAMP(x, 0.0f, 1.0f);
 	CLAMP(y, 0.0f, 1.0f);
 
-	switch((int)but->a1) {
-	case UI_GRAD_SV:
-		hsv[2]= x;
-		hsv[1]= y;
-		break;
-	case UI_GRAD_HV:
-		hsv[0]= x;
-		hsv[2]= y;
-		break;
-	case UI_GRAD_HS:
-		hsv[0]= x;
-		hsv[1]= y;
-		break;
-	case UI_GRAD_H:
-		hsv[0]= x;
-		break;
-	case UI_GRAD_S:
-		hsv[1]= x;
-		break;
-	case UI_GRAD_V:
-		hsv[2]= x;
-		break;
-	case UI_GRAD_V_ALT:	
-		/* vertical 'value' strip */
-	
-		/* exception only for value strip - use the range set in but->min/max */
-		hsv[2] = y * (but->softmax - but->softmin) + but->softmin;
-		
-		if (color_profile)
-			hsv[2] = srgb_to_linearrgb(hsv[2]);
-		
-		if (hsv[2] > but->softmax)
-			hsv[2] = but->softmax;
-		break;
-	default:
-		assert(!"invalid hsv type");
+	switch ((int)but->a1) {
+		case UI_GRAD_SV:
+			hsv[2] = x;
+			hsv[1] = y;
+			break;
+		case UI_GRAD_HV:
+			hsv[0] = x;
+			hsv[2] = y;
+			break;
+		case UI_GRAD_HS:
+			hsv[0] = x;
+			hsv[1] = y;
+			break;
+		case UI_GRAD_H:
+			hsv[0] = x;
+			break;
+		case UI_GRAD_S:
+			hsv[1] = x;
+			break;
+		case UI_GRAD_V:
+			hsv[2] = x;
+			break;
+		case UI_GRAD_V_ALT:
+			/* vertical 'value' strip */
+
+			/* exception only for value strip - use the range set in but->min/max */
+			hsv[2] = y * (but->softmax - but->softmin) + but->softmin;
+
+			if (color_profile)
+				hsv[2] = srgb_to_linearrgb(hsv[2]);
+
+			if (hsv[2] > but->softmax)
+				hsv[2] = but->softmax;
+			break;
+		default:
+			assert(!"invalid hsv type");
 	}
 
-	hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb+1, rgb+2);
+	hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb + 1, rgb + 2);
 	copy_v3_v3(data->vec, rgb);
 
-	data->draglastx= mx;
-	data->draglasty= my;
+	data->draglastx = mx;
+	data->draglasty = my;
 
 	return changed;
 }
 
 static void ui_ndofedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, wmNDOFMotionData *ndof, int shift)
 {
-	float *hsv= ui_block_hsv_get(but->block);
+	float *hsv = ui_block_hsv_get(but->block);
 	float rgb[3];
 	float sensitivity = (shift ? 0.15f : 0.3f) * ndof->dt;
 	
@@ -3285,9 +3172,9 @@ static void ui_ndofedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, wmNDOF
 	}
 
 	ui_get_but_vectorf(but, rgb);
-	rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+	rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv + 1, hsv + 2);
 	
-	switch((int)but->a1) {
+	switch ((int)but->a1) {
 		case UI_GRAD_SV:
 			hsv[2] += ndof->ry * sensitivity;
 			hsv[1] += ndof->rx * sensitivity;
@@ -3323,7 +3210,7 @@ static void ui_ndofedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, wmNDOF
 			assert(!"invalid hsv type");
 	}
 	
-	hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb+1, rgb+2);
+	hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb + 1, rgb + 2);
 	copy_v3_v3(data->vec, rgb);
 	ui_set_but_vectorf(but, data->vec);
 }
@@ -3332,26 +3219,26 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
 {
 	int mx, my;
 
-	mx= event->x;
-	my= event->y;
+	mx = event->x;
+	my = event->y;
 	ui_window_to_block(data->region, block, &mx, &my);
 
-	if(data->state == BUTTON_STATE_HIGHLIGHT) {
-		if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
-			data->dragstartx= mx;
-			data->dragstarty= my;
-			data->draglastx= mx;
-			data->draglasty= my;
+	if (data->state == BUTTON_STATE_HIGHLIGHT) {
+		if (event->type == LEFTMOUSE && event->val == KM_PRESS) {
+			data->dragstartx = mx;
+			data->dragstarty = my;
+			data->draglastx = mx;
+			data->draglasty = my;
 			button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 
 			/* also do drag the first time */
-			if(ui_numedit_but_HSVCUBE(but, data, mx, my))
+			if (ui_numedit_but_HSVCUBE(but, data, mx, my))
 				ui_numedit_apply(C, block, but, data);
 			
 			return WM_UI_HANDLER_BREAK;
 		}
 		else if (event->type == NDOF_MOTION) {
-			wmNDOFMotionData *ndof = (wmNDOFMotionData*) event->customdata;
+			wmNDOFMotionData *ndof = (wmNDOFMotionData *) event->customdata;
 			
 			ui_ndofedit_but_HSVCUBE(but, data, ndof, event->shift);
 			
@@ -3361,26 +3248,26 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
 			return WM_UI_HANDLER_BREAK;
 		}
 		/* XXX hardcoded keymap check.... */
-		else if (event->type == DELKEY && event->val == KM_PRESS) {
-			if (but->a1==UI_GRAD_V_ALT){
+		else if (event->type == BACKSPACEKEY && event->val == KM_PRESS) {
+			if (but->a1 == UI_GRAD_V_ALT) {
 				int len;
 				
 				/* reset only value */
 				
-				len= RNA_property_array_length(&but->rnapoin, but->rnaprop);
+				len = RNA_property_array_length(&but->rnapoin, but->rnaprop);
 				if (len >= 3) {
 					float rgb[3], def_hsv[3];
 					float *def;
-					float *hsv= ui_block_hsv_get(but->block);
-					def= MEM_callocN(sizeof(float)*len, "reset_defaults - float");
+					float *hsv = ui_block_hsv_get(but->block);
+					def = MEM_callocN(sizeof(float) * len, "reset_defaults - float");
 					
 					RNA_property_float_get_default_array(&but->rnapoin, but->rnaprop, def);
-					rgb_to_hsv(def[0], def[1], def[2], def_hsv, def_hsv+1, def_hsv+2);
+					rgb_to_hsv(def[0], def[1], def[2], def_hsv, def_hsv + 1, def_hsv + 2);
 					
 					ui_get_but_vectorf(but, rgb);
-					rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+					rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv + 1, hsv + 2);
 					
-					hsv_to_rgb(hsv[0], hsv[1], def_hsv[2], rgb, rgb+1, rgb+2);
+					hsv_to_rgb(hsv[0], hsv[1], def_hsv[2], rgb, rgb + 1, rgb + 2);
 					ui_set_but_vectorf(but, rgb);
 					
 					RNA_property_update(C, &but->rnapoin, but->rnaprop);
@@ -3391,19 +3278,19 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
 			}
 		}
 	}
-	else if(data->state == BUTTON_STATE_NUM_EDITING) {
-		if(event->type == ESCKEY) {
-			data->cancel= 1;
-			data->escapecancel= 1;
+	else if (data->state == BUTTON_STATE_NUM_EDITING) {
+		if (event->type == ESCKEY) {
+			data->cancel = 1;
+			data->escapecancel = 1;
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 		}
-		else if(event->type == MOUSEMOVE) {
-			if(mx!=data->draglastx || my!=data->draglasty) {
-				if(ui_numedit_but_HSVCUBE(but, data, mx, my))
+		else if (event->type == MOUSEMOVE) {
+			if (mx != data->draglastx || my != data->draglasty) {
+				if (ui_numedit_but_HSVCUBE(but, data, mx, my))
 					ui_numedit_apply(C, block, but, data);
 			}
 		}
-		else if(event->type==LEFTMOUSE && event->val!=KM_PRESS)
+		else if (event->type == LEFTMOUSE && event->val != KM_PRESS)
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 		
 		return WM_UI_HANDLER_BREAK;
@@ -3415,16 +3302,16 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu
 static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, int mx, int my, int shift)
 {
 	rcti rect;
-	int changed= 1;
+	int changed = 1;
 	float rgb[3];
 	float hsv[3];
 	
-	rect.xmin= but->x1; rect.xmax= but->x2;
-	rect.ymin= but->y1; rect.ymax= but->y2;
+	rect.xmin = but->x1; rect.xmax = but->x2;
+	rect.ymin = but->y1; rect.ymax = but->y2;
 	
 	ui_get_but_vectorf(but, rgb);
 	copy_v3_v3(hsv, ui_block_hsv_get(but->block));
-	rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+	rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv + 1, hsv + 2);
 	
 	/* exception, when using color wheel in 'locked' value state:
 	 * allow choosing a hue for black values, by giving a tiny increment */
@@ -3432,42 +3319,42 @@ static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, int mx
 		if (hsv[2] == 0.f) hsv[2] = 0.0001f;
 	}
 
-	if(U.uiflag & USER_CONTINUOUS_MOUSE) {
-		float fac= shift ? 0.05f : 1.0f;
+	if (U.uiflag & USER_CONTINUOUS_MOUSE) {
+		float fac = shift ? 0.05f : 1.0f;
 		/* slow down the mouse, this is fairly picky */
-		mx = (data->dragstartx*(1.0f-fac) + mx*fac);
-		my = (data->dragstarty*(1.0f-fac) + my*fac);
+		mx = (data->dragstartx * (1.0f - fac) + mx * fac);
+		my = (data->dragstarty * (1.0f - fac) + my * fac);
 	}
 
-	ui_hsvcircle_vals_from_pos(hsv, hsv+1, &rect, (float)mx, (float)my);
+	ui_hsvcircle_vals_from_pos(hsv, hsv + 1, &rect, (float)mx, (float)my);
 
-	if(but->flag & UI_BUT_COLOR_CUBIC)
-		hsv[1]= 1.0f - sqrt3f(1.0f - hsv[1]);
+	if (but->flag & UI_BUT_COLOR_CUBIC)
+		hsv[1] = 1.0f - sqrt3f(1.0f - hsv[1]);
 
-	hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb+1, rgb+2);
+	hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb + 1, rgb + 2);
 
-	if((but->flag & UI_BUT_VEC_SIZE_LOCK) && (rgb[0] || rgb[1] || rgb[2])) {
+	if ((but->flag & UI_BUT_VEC_SIZE_LOCK) && (rgb[0] || rgb[1] || rgb[2])) {
 		normalize_v3(rgb);
 		mul_v3_fl(rgb, but->a2);
 	}
 
 	ui_set_but_vectorf(but, rgb);
 	
-	data->draglastx= mx;
-	data->draglasty= my;
+	data->draglastx = mx;
+	data->draglasty = my;
 	
 	return changed;
 }
 
 static void ui_ndofedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, wmNDOFMotionData *ndof, int shift)
 {
-	float *hsv= ui_block_hsv_get(but->block);
+	float *hsv = ui_block_hsv_get(but->block);
 	float rgb[3];
 	float phi, r /*, sqr */ /* UNUSED */, v[2];
 	float sensitivity = (shift ? 0.15f : 0.3f) * ndof->dt;
 	
 	ui_get_but_vectorf(but, rgb);
-	rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+	rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv + 1, hsv + 2);
 	
 	/* Convert current colour on hue/sat disc to circular coordinates phi, r */
 	phi = fmodf(hsv[0] + 0.25f, 1.0f) * -2.0f * (float)M_PI;
@@ -3483,7 +3370,7 @@ static void ui_ndofedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, wmND
 	v[1] += ndof->rx * sensitivity;
 
 	/* convert back to polar coords on circle */
-	phi = atan2f(v[0], v[1])/(2.0f*(float)M_PI) + 0.5f;
+	phi = atan2f(v[0], v[1]) / (2.0f * (float)M_PI) + 0.5f;
 	
 	/* use ndof z rotation to additionally rotate hue */
 	phi -= ndof->rz * sensitivity * 0.5f;
@@ -3501,9 +3388,9 @@ static void ui_ndofedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, wmND
 		if (hsv[2] == 0.0f) hsv[2] = 0.0001f;
 	}
 	
-	hsv_to_rgb(hsv[0], hsv[1], hsv[2], data->vec, data->vec+1, data->vec+2);
+	hsv_to_rgb(hsv[0], hsv[1], hsv[2], data->vec, data->vec + 1, data->vec + 2);
 	
-	if((but->flag & UI_BUT_VEC_SIZE_LOCK) && (data->vec[0] || data->vec[1] || data->vec[2])) {
+	if ((but->flag & UI_BUT_VEC_SIZE_LOCK) && (data->vec[0] || data->vec[1] || data->vec[2])) {
 		normalize_v3(data->vec);
 		mul_v3_fl(data->vec, but->a2);
 	}
@@ -3515,26 +3402,26 @@ static void ui_ndofedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, wmND
 static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
 	int mx, my;
-	mx= event->x;
-	my= event->y;
+	mx = event->x;
+	my = event->y;
 	ui_window_to_block(data->region, block, &mx, &my);
 	
-	if(data->state == BUTTON_STATE_HIGHLIGHT) {
-		if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
-			data->dragstartx= mx;
-			data->dragstarty= my;
-			data->draglastx= mx;
-			data->draglasty= my;
+	if (data->state == BUTTON_STATE_HIGHLIGHT) {
+		if (event->type == LEFTMOUSE && event->val == KM_PRESS) {
+			data->dragstartx = mx;
+			data->dragstarty = my;
+			data->draglastx = mx;
+			data->draglasty = my;
 			button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 			
 			/* also do drag the first time */
-			if(ui_numedit_but_HSVCIRCLE(but, data, mx, my, event->shift))
+			if (ui_numedit_but_HSVCIRCLE(but, data, mx, my, event->shift))
 				ui_numedit_apply(C, block, but, data);
 			
 			return WM_UI_HANDLER_BREAK;
 		}
 		else if (event->type == NDOF_MOTION) {
-			wmNDOFMotionData *ndof = (wmNDOFMotionData*) event->customdata;
+			wmNDOFMotionData *ndof = (wmNDOFMotionData *) event->customdata;
 			
 			ui_ndofedit_but_HSVCIRCLE(but, data, ndof, event->shift);
 
@@ -3544,25 +3431,25 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle
 			return WM_UI_HANDLER_BREAK;
 		}
 		/* XXX hardcoded keymap check.... */
-		else if (event->type == DELKEY && event->val == KM_PRESS) {
+		else if (event->type == BACKSPACEKEY && event->val == KM_PRESS) {
 			int len;
 			
 			/* reset only saturation */
 			
-			len= RNA_property_array_length(&but->rnapoin, but->rnaprop);
+			len = RNA_property_array_length(&but->rnapoin, but->rnaprop);
 			if (len >= 3) {
 				float rgb[3], def_hsv[3];
 				float *def;
-				float *hsv= ui_block_hsv_get(but->block);
-				def= MEM_callocN(sizeof(float)*len, "reset_defaults - float");
+				float *hsv = ui_block_hsv_get(but->block);
+				def = MEM_callocN(sizeof(float) * len, "reset_defaults - float");
 				
 				RNA_property_float_get_default_array(&but->rnapoin, but->rnaprop, def);
-				rgb_to_hsv(def[0], def[1], def[2], def_hsv, def_hsv+1, def_hsv+2);
+				rgb_to_hsv(def[0], def[1], def[2], def_hsv, def_hsv + 1, def_hsv + 2);
 				
 				ui_get_but_vectorf(but, rgb);
-				rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+				rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv + 1, hsv + 2);
 				
-				hsv_to_rgb(hsv[0], def_hsv[1], hsv[2], rgb, rgb+1, rgb+2);
+				hsv_to_rgb(hsv[0], def_hsv[1], hsv[2], rgb, rgb + 1, rgb + 2);
 				ui_set_but_vectorf(but, rgb);
 				
 				RNA_property_update(C, &but->rnapoin, but->rnaprop);
@@ -3572,32 +3459,32 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle
 			return WM_UI_HANDLER_BREAK;
 		}
 	}
-	else if(data->state == BUTTON_STATE_NUM_EDITING) {
-		if(event->type == ESCKEY) {
-			data->cancel= 1;
-			data->escapecancel= 1;
+	else if (data->state == BUTTON_STATE_NUM_EDITING) {
+		if (event->type == ESCKEY) {
+			data->cancel = 1;
+			data->escapecancel = 1;
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 		}
 		/* XXX hardcoded keymap check.... */
-		else if(event->type == WHEELDOWNMOUSE) {
-			float *hsv= ui_block_hsv_get(but->block);
-			hsv[2]= CLAMPIS(hsv[2]-0.05f, 0.0f, 1.0f);
-			ui_set_but_hsv(but);	// converts to rgb
+		else if (event->type == WHEELDOWNMOUSE) {
+			float *hsv = ui_block_hsv_get(but->block);
+			hsv[2] = CLAMPIS(hsv[2] - 0.05f, 0.0f, 1.0f);
+			ui_set_but_hsv(but);    // converts to rgb
 			ui_numedit_apply(C, block, but, data);
 		}
-		else if(event->type == WHEELUPMOUSE) {
-			float *hsv= ui_block_hsv_get(but->block);
-			hsv[2]= CLAMPIS(hsv[2]+0.05f, 0.0f, 1.0f);
-			ui_set_but_hsv(but);	// converts to rgb
+		else if (event->type == WHEELUPMOUSE) {
+			float *hsv = ui_block_hsv_get(but->block);
+			hsv[2] = CLAMPIS(hsv[2] + 0.05f, 0.0f, 1.0f);
+			ui_set_but_hsv(but);    // converts to rgb
 			ui_numedit_apply(C, block, but, data);
 		}
-		else if(event->type == MOUSEMOVE) {
-			if(mx!=data->draglastx || my!=data->draglasty) {
-				if(ui_numedit_but_HSVCIRCLE(but, data, mx, my, event->shift))
+		else if (event->type == MOUSEMOVE) {
+			if (mx != data->draglastx || my != data->draglasty) {
+				if (ui_numedit_but_HSVCIRCLE(but, data, mx, my, event->shift))
 					ui_numedit_apply(C, block, but, data);
 			}
 		}
-		else if(event->type==LEFTMOUSE && event->val!=KM_PRESS) {
+		else if (event->type == LEFTMOUSE && event->val != KM_PRESS) {
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 		}
 		return WM_UI_HANDLER_BREAK;
@@ -3610,20 +3497,20 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle
 static int ui_numedit_but_COLORBAND(uiBut *but, uiHandleButtonData *data, int mx)
 {
 	float dx;
-	int changed= 0;
+	int changed = 0;
 
-	if(data->draglastx == mx)
+	if (data->draglastx == mx)
 		return changed;
 
-	dx= ((float)(mx - data->draglastx))/(but->x2-but->x1);
+	dx = ((float)(mx - data->draglastx)) / (but->x2 - but->x1);
 	data->dragcbd->pos += dx;
 	CLAMP(data->dragcbd->pos, 0.0f, 1.0f);
 	
 	colorband_update_sort(data->coba);
-	data->dragcbd= data->coba->data + data->coba->cur;	/* because qsort */
+	data->dragcbd = data->coba->data + data->coba->cur;  /* because qsort */
 	
-	data->draglastx= mx;
-	changed= 1;
+	data->draglastx = mx;
+	changed = 1;
 
 	return changed;
 }
@@ -3632,54 +3519,54 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle
 {
 	ColorBand *coba;
 	CBData *cbd;
-	int mx, my, a, xco, mindist= 12;
+	int mx, my, a, xco, mindist = 12;
 
-	mx= event->x;
-	my= event->y;
+	mx = event->x;
+	my = event->y;
 	ui_window_to_block(data->region, block, &mx, &my);
 
-	if(data->state == BUTTON_STATE_HIGHLIGHT) {
-		if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
-			coba= (ColorBand*)but->poin;
+	if (data->state == BUTTON_STATE_HIGHLIGHT) {
+		if (event->type == LEFTMOUSE && event->val == KM_PRESS) {
+			coba = (ColorBand *)but->poin;
 
-			if(event->ctrl) {
+			if (event->ctrl) {
 				/* insert new key on mouse location */
-				float pos= ((float)(mx - but->x1))/(but->x2-but->x1);
+				float pos = ((float)(mx - but->x1)) / (but->x2 - but->x1);
 				colorband_element_add(coba, pos);
 				button_activate_state(C, but, BUTTON_STATE_EXIT);
 			}
 			else {
-				data->dragstartx= mx;
-				data->dragstarty= my;
-				data->draglastx= mx;
-				data->draglasty= my;
+				data->dragstartx = mx;
+				data->dragstarty = my;
+				data->draglastx = mx;
+				data->draglasty = my;
 
 				/* activate new key when mouse is close */
-				for(a=0, cbd= coba->data; a<coba->tot; a++, cbd++) {
-					xco= but->x1 + (cbd->pos*(but->x2-but->x1));
-					xco= ABS(xco-mx);
-					if(a==coba->cur) xco+= 5; // selected one disadvantage
-					if(xco<mindist) {
-						coba->cur= a;
-						mindist= xco;
+				for (a = 0, cbd = coba->data; a < coba->tot; a++, cbd++) {
+					xco = but->x1 + (cbd->pos * (but->x2 - but->x1));
+					xco = ABS(xco - mx);
+					if (a == coba->cur) xco += 5;  // selected one disadvantage
+					if (xco < mindist) {
+						coba->cur = a;
+						mindist = xco;
 					}
 				}
 		
-				data->dragcbd= coba->data + coba->cur;
+				data->dragcbd = coba->data + coba->cur;
 				button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 			}
 
 			return WM_UI_HANDLER_BREAK;
 		}
 	}
-	else if(data->state == BUTTON_STATE_NUM_EDITING) {
-		if(event->type == MOUSEMOVE) {
-			if(mx!=data->draglastx || my!=data->draglasty) {
-				if(ui_numedit_but_COLORBAND(but, data, mx))
+	else if (data->state == BUTTON_STATE_NUM_EDITING) {
+		if (event->type == MOUSEMOVE) {
+			if (mx != data->draglastx || my != data->draglasty) {
+				if (ui_numedit_but_COLORBAND(but, data, mx))
 					ui_numedit_apply(C, block, but, data);
 			}
 		}
-		else if(event->type==LEFTMOUSE && event->val!=KM_PRESS)
+		else if (event->type == LEFTMOUSE && event->val != KM_PRESS)
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 		
 		return WM_UI_HANDLER_BREAK;
@@ -3690,81 +3577,81 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle
 
 static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap, int mx, int my)
 {
-	CurveMapping *cumap= (CurveMapping*)but->poin;
-	CurveMap *cuma= cumap->cm+cumap->cur;
-	CurveMapPoint *cmp= cuma->curve;
+	CurveMapping *cumap = (CurveMapping *)but->poin;
+	CurveMap *cuma = cumap->cm + cumap->cur;
+	CurveMapPoint *cmp = cuma->curve;
 	float fx, fy, zoomx, zoomy /*, offsx, offsy */ /* UNUSED */;
-	int a, changed= 0;
+	int a, changed = 0;
 
-	zoomx= (but->x2-but->x1)/(cumap->curr.xmax-cumap->curr.xmin);
-	zoomy= (but->y2-but->y1)/(cumap->curr.ymax-cumap->curr.ymin);
+	zoomx = (but->x2 - but->x1) / (cumap->curr.xmax - cumap->curr.xmin);
+	zoomy = (but->y2 - but->y1) / (cumap->curr.ymax - cumap->curr.ymin);
 	/* offsx= cumap->curr.xmin; */
 	/* offsy= cumap->curr.ymin; */
 
-	if(snap) {
+	if (snap) {
 		float d[2];
 
-		d[0]= mx - data->dragstartx;
-		d[1]= my - data->dragstarty;
+		d[0] = mx - data->dragstartx;
+		d[1] = my - data->dragstarty;
 
-		if(len_v2(d) < 3.0f)
-			snap= 0;
+		if (len_v2(d) < 3.0f)
+			snap = 0;
 	}
 
-	if(data->dragsel != -1) {
-		int moved_point= 0;		/* for ctrl grid, can't use orig coords because of sorting */
+	if (data->dragsel != -1) {
+		int moved_point = 0;     /* for ctrl grid, can't use orig coords because of sorting */
 		
-		fx= (mx-data->draglastx)/zoomx;
-		fy= (my-data->draglasty)/zoomy;
-		for(a=0; a<cuma->totpoint; a++) {
-			if(cmp[a].flag & SELECT) {
-				float origx= cmp[a].x, origy= cmp[a].y;
-				cmp[a].x+= fx;
-				cmp[a].y+= fy;
-				if(snap) {
-					cmp[a].x= 0.125f*floorf(0.5f + 8.0f*cmp[a].x);
-					cmp[a].y= 0.125f*floorf(0.5f + 8.0f*cmp[a].y);
+		fx = (mx - data->draglastx) / zoomx;
+		fy = (my - data->draglasty) / zoomy;
+		for (a = 0; a < cuma->totpoint; a++) {
+			if (cmp[a].flag & SELECT) {
+				float origx = cmp[a].x, origy = cmp[a].y;
+				cmp[a].x += fx;
+				cmp[a].y += fy;
+				if (snap) {
+					cmp[a].x = 0.125f * floorf(0.5f + 8.0f * cmp[a].x);
+					cmp[a].y = 0.125f * floorf(0.5f + 8.0f * cmp[a].y);
 				}
-				if(cmp[a].x!=origx || cmp[a].y!=origy)
-					moved_point= 1;
+				if (cmp[a].x != origx || cmp[a].y != origy)
+					moved_point = 1;
 			}
 		}
 
-		curvemapping_changed(cumap, 0);	/* no remove doubles */
+		curvemapping_changed(cumap, 0); /* no remove doubles */
 		
-		if(moved_point) {
-			data->draglastx= mx;
-			data->draglasty= my;
-			changed= 1;
+		if (moved_point) {
+			data->draglastx = mx;
+			data->draglasty = my;
+			changed = 1;
 		}
 
-		data->dragchange= 1; /* mark for selection */
+		data->dragchange = 1; /* mark for selection */
 	}
 	else {
-		fx= (mx-data->draglastx)/zoomx;
-		fy= (my-data->draglasty)/zoomy;
+		fx = (mx - data->draglastx) / zoomx;
+		fy = (my - data->draglasty) / zoomy;
 		
 		/* clamp for clip */
-		if(cumap->flag & CUMA_DO_CLIP) {
-			if(cumap->curr.xmin-fx < cumap->clipr.xmin)
-				fx= cumap->curr.xmin - cumap->clipr.xmin;
-			else if(cumap->curr.xmax-fx > cumap->clipr.xmax)
-				fx= cumap->curr.xmax - cumap->clipr.xmax;
-			if(cumap->curr.ymin-fy < cumap->clipr.ymin)
-				fy= cumap->curr.ymin - cumap->clipr.ymin;
-			else if(cumap->curr.ymax-fy > cumap->clipr.ymax)
-				fy= cumap->curr.ymax - cumap->clipr.ymax;
-		}				
-
-		cumap->curr.xmin-=fx;
-		cumap->curr.ymin-=fy;
-		cumap->curr.xmax-=fx;
-		cumap->curr.ymax-=fy;
+		if (cumap->flag & CUMA_DO_CLIP) {
+			if (cumap->curr.xmin - fx < cumap->clipr.xmin)
+				fx = cumap->curr.xmin - cumap->clipr.xmin;
+			else if (cumap->curr.xmax - fx > cumap->clipr.xmax)
+				fx = cumap->curr.xmax - cumap->clipr.xmax;
+			if (cumap->curr.ymin - fy < cumap->clipr.ymin)
+				fy = cumap->curr.ymin - cumap->clipr.ymin;
+			else if (cumap->curr.ymax - fy > cumap->clipr.ymax)
+				fy = cumap->curr.ymax - cumap->clipr.ymax;
+		}
+
+		cumap->curr.xmin -= fx;
+		cumap->curr.ymin -= fy;
+		cumap->curr.xmax -= fx;
+		cumap->curr.ymax -= fy;
 		
-		data->draglastx= mx;
-		data->draglasty= my;
+		data->draglastx = mx;
+		data->draglasty = my;
 
-		changed= 1;
+		changed = 1;
 	}
 
 	return changed;
@@ -3772,44 +3659,44 @@ static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap,
 
 static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
 {
-	int mx, my, a, changed= 0;
+	int mx, my, a, changed = 0;
 
-	mx= event->x;
-	my= event->y;
+	mx = event->x;
+	my = event->y;
 	ui_window_to_block(data->region, block, &mx, &my);
 
-	if(data->state == BUTTON_STATE_HIGHLIGHT) {
-		if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
-			CurveMapping *cumap= (CurveMapping*)but->poin;
-			CurveMap *cuma= cumap->cm+cumap->cur;
+	if (data->state == BUTTON_STATE_HIGHLIGHT) {
+		if (event->type == LEFTMOUSE && event->val == KM_PRESS) {
+			CurveMapping *cumap = (CurveMapping *)but->poin;
+			CurveMap *cuma = cumap->cm + cumap->cur;
 			CurveMapPoint *cmp;
 			float fx, fy, zoomx, zoomy, offsx, offsy;
-			float dist, mindist= 200.0f; // 14 pixels radius
-			int sel= -1;
+			float dist, mindist = 200.0f; // 14 pixels radius
+			int sel = -1;
 
-			zoomx= (but->x2-but->x1)/(cumap->curr.xmax-cumap->curr.xmin);
-			zoomy= (but->y2-but->y1)/(cumap->curr.ymax-cumap->curr.ymin);
-			offsx= cumap->curr.xmin;
-			offsy= cumap->curr.ymin;
+			zoomx = (but->x2 - but->x1) / (cumap->curr.xmax - cumap->curr.xmin);
+			zoomy = (but->y2 - but->y1) / (cumap->curr.ymax - cumap->curr.ymin);
+			offsx = cumap->curr.xmin;
+			offsy = cumap->curr.ymin;
 
-			if(event->ctrl) {
-				fx= ((float)my - but->x1)/zoomx + offsx;
-				fy= ((float)my - but->y1)/zoomy + offsy;
+			if (event->ctrl) {
+				fx = ((float)my - but->x1) / zoomx + offsx;
+				fy = ((float)my - but->y1) / zoomy + offsy;
 				
 				curvemap_insert(cuma, fx, fy);
 				curvemapping_changed(cumap, 0);
-				changed= 1;
+				changed = 1;
 			}
 
 			/* check for selecting of a point */
-			cmp= cuma->curve;	/* ctrl adds point, new malloc */
-			for(a=0; a<cuma->totpoint; a++) {
-				fx= but->x1 + zoomx*(cmp[a].x-offsx);
-				fy= but->y1 + zoomy*(cmp[a].y-offsy);
-				dist= (fx-mx)*(fx-mx) + (fy-my)*(fy-my);
-				if(dist < mindist) {
-					sel= a;
-					mindist= dist;
+			cmp = cuma->curve;   /* ctrl adds point, new malloc */
+			for (a = 0; a < cuma->totpoint; a++) {
+				fx = but->x1 + zoomx * (cmp[a].x - offsx);
+				fy = but->y1 + zoomy * (cmp[a].y - offsy);
+				dist = (fx - mx) * (fx - mx) + (fy - my) * (fy - my);
+				if (dist < mindist) {
+					sel = a;
+					mindist = dist;
 				}
 			}
 
@@ -3818,14 +3705,14 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
 
 				/* if the click didn't select anything, check if it's clicked on the 
 				 * curve itself, and if so, add a point */
-				fx= ((float)mx - but->x1)/zoomx + offsx;
-				fy= ((float)my - but->y1)/zoomy + offsy;
+				fx = ((float)mx - but->x1) / zoomx + offsx;
+				fy = ((float)my - but->y1) / zoomy + offsy;
 				
-				cmp= cuma->table;
+				cmp = cuma->table;
 
 				/* loop through the curve segment table and find what's near the mouse.
 				 * 0.05 is kinda arbitrary, but seems to be what works nicely. */
-				for(i=0; i<=CM_TABLE; i++) {
+				for (i = 0; i <= CM_TABLE; i++) {
 					if ( (fabsf(fx - cmp[i].x) < 0.05f) &&
 					     (fabsf(fy - cmp[i].y) < 0.05f))
 					{
@@ -3833,14 +3720,14 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
 						curvemap_insert(cuma, fx, fy);
 						curvemapping_changed(cumap, 0);
 
-						changed= 1;
+						changed = 1;
 						
 						/* reset cmp back to the curve points again, rather than drawing segments */		
-						cmp= cuma->curve;
+						cmp = cuma->curve;
 						
 						/* find newly added point and make it 'sel' */
-						for(a=0; a<cuma->totpoint; a++)
-							if(cmp[a].x == fx)
+						for (a = 0; a < cuma->totpoint; a++)
+							if (cmp[a].x == fx)
 								sel = a;
 							
 						break;
@@ -3848,11 +3735,11 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
 				}
 			}
 
-			if(sel!= -1) {
+			if (sel != -1) {
 				/* ok, we move a point */
 				/* deselect all if this one is deselect. except if we hold shift */
-				if(event->shift == FALSE) {
-					for(a=0; a<cuma->totpoint; a++)
+				if (event->shift == FALSE) {
+					for (a = 0; a < cuma->totpoint; a++)
 						cmp[a].flag &= ~SELECT;
 					cmp[sel].flag |= SELECT;
 				}
@@ -3861,43 +3748,43 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt
 			}
 			else {
 				/* move the view */
-				data->cancel= 1;
+				data->cancel = 1;
 			}
 
-			data->dragsel= sel;
+			data->dragsel = sel;
 
-			data->dragstartx= mx;
-			data->dragstarty= my;
-			data->draglastx= mx;
-			data->draglasty= my;
+			data->dragstartx = mx;
+			data->dragstarty = my;
+			data->draglastx = mx;
+			data->draglasty = my;
 
 			button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 			return WM_UI_HANDLER_BREAK;
 		}
 	}
-	else if(data->state == BUTTON_STATE_NUM_EDITING) {
-		if(event->type == MOUSEMOVE) {
-			if(mx!=data->draglastx || my!=data->draglasty) {
-				if(ui_numedit_but_CURVE(but, data, event->ctrl, mx, my))
+	else if (data->state == BUTTON_STATE_NUM_EDITING) {
+		if (event->type == MOUSEMOVE) {
+			if (mx != data->draglastx || my != data->draglasty) {
+				if (ui_numedit_but_CURVE(but, data, event->ctrl, mx, my))
 					ui_numedit_apply(C, block, but, data);
 			}
 		}
-		else if(event->type==LEFTMOUSE && event->val!=KM_PRESS) {
-			if(data->dragsel != -1) {
-				CurveMapping *cumap= (CurveMapping*)but->poin;
-				CurveMap *cuma= cumap->cm+cumap->cur;
-				CurveMapPoint *cmp= cuma->curve;
+		else if (event->type == LEFTMOUSE && event->val != KM_PRESS) {
+			if (data->dragsel != -1) {
+				CurveMapping *cumap = (CurveMapping *)but->poin;
+				CurveMap *cuma = cumap->cm + cumap->cur;
+				CurveMapPoint *cmp = cuma->curve;
 
-				if(!data->dragchange) {
+				if (!data->dragchange) {
 					/* deselect all, select one */
-					if(event->shift == FALSE) {
-						for(a=0; a<cuma->totpoint; a++)
+					if (event->shift == FALSE) {
+						for (a = 0; a < cuma->totpoint; a++)
 							cmp[a].flag &= ~SELECT;
 						cmp[data->dragsel].flag |= SELECT;
 					}
 				}
 				else
-					curvemapping_changed(cumap, 1);	/* remove doubles */
+					curvemapping_changed(cumap, 1);  /* remove doubles */
 			}
 
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -3922,20 +3809,21 @@ static int ui_numedit_but_HISTOGRAM(uiBut *but, uiHandleButtonData *data, int mx
 {
 	Histogram *hist = (Histogram *)but->poin;
 	/* rcti rect; */
-	int changed= 1;
-	float /* dx, */ dy, yfac=1.f; /* UNUSED */
+	int changed = 1;
+	float /* dx, */ dy, yfac = 1.f; /* UNUSED */
 	
-	/* rect.xmin= but->x1; rect.xmax= but->x2; */
-	/* rect.ymin= but->y1; rect.ymax= but->y2; */
+	/* rect.xmin = but->x1; rect.xmax = but->x2; */
+	/* rect.ymin = but->y1; rect.ymax = but->y2; */
 	
 	/* dx = mx - data->draglastx; */ /* UNUSED */
 	dy = my - data->draglasty;
 	
 	
 	if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
-		 /* resize histogram widget itself */
+		/* resize histogram widget itself */
 		hist->height = (but->y2 - but->y1) + (data->dragstarty - my);
-	} else {
+	}
+	else {
 		/* scale histogram values */
 		yfac = MIN2(powf(hist->ymax, 2.f), 1.f) * 0.5f;
 		hist->ymax += dy * yfac;
@@ -3943,8 +3831,8 @@ static int ui_numedit_but_HISTOGRAM(uiBut *but, uiHandleButtonData *data, int mx
 		CLAMP(hist->ymax, 1.f, 100.f);
 	}
 	
-	data->draglastx= mx;
-	data->draglasty= my;
+	data->draglastx = mx;
+	data->draglasty = my;
 	
 	return changed;
 }
@@ -3953,26 +3841,26 @@ static int ui_do_but_HISTOGRAM(bContext *C, uiBlock *block, uiBut *but, uiHandle
 {
 	int mx, my;
 	
-	mx= event->x;
-	my= event->y;
+	mx = event->x;
+	my = event->y;
 	ui_window_to_block(data->region, block, &mx, &my);
 	
-	if(data->state == BUTTON_STATE_HIGHLIGHT) {
-		if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
-			data->dragstartx= mx;
-			data->dragstarty= my;
-			data->draglastx= mx;
-			data->draglasty= my;
+	if (data->state == BUTTON_STATE_HIGHLIGHT) {
+		if (event->type == LEFTMOUSE && event->val == KM_PRESS) {
+			data->dragstartx = mx;
+			data->dragstarty = my;
+			data->draglastx = mx;
+			data->draglasty = my;
 			button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 			
 			/* also do drag the first time */
-			if(ui_numedit_but_HISTOGRAM(but, data, mx, my))
+			if (ui_numedit_but_HISTOGRAM(but, data, mx, my))
 				ui_numedit_apply(C, block, but, data);
 			
 			return WM_UI_HANDLER_BREAK;
 		}
 		/* XXX hardcoded keymap check.... */
-		else if (event->type == DELKEY && event->val == KM_PRESS) {
+		else if (event->type == BACKSPACEKEY && event->val == KM_PRESS) {
 			Histogram *hist = (Histogram *)but->poin;
 			hist->ymax = 1.f;
 			
@@ -3980,19 +3868,19 @@ static int ui_do_but_HISTOGRAM(bContext *C, uiBlock *block, uiBut *but, uiHandle
 			return WM_UI_HANDLER_BREAK;
 		}
 	}
-	else if(data->state == BUTTON_STATE_NUM_EDITING) {
-		if(event->type == ESCKEY) {
-			data->cancel= 1;
-			data->escapecancel= 1;
+	else if (data->state == BUTTON_STATE_NUM_EDITING) {
+		if (event->type == ESCKEY) {
+			data->cancel = 1;
+			data->escapecancel = 1;
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 		}
-		else if(event->type == MOUSEMOVE) {
-			if(mx!=data->draglastx || my!=data->draglasty) {
-				if(ui_numedit_but_HISTOGRAM(but, data, mx, my))
+		else if (event->type == MOUSEMOVE) {
+			if (mx != data->draglastx || my != data->draglasty) {
+				if (ui_numedit_but_HISTOGRAM(but, data, mx, my))
 					ui_numedit_apply(C, block, but, data);
 			}
 		}
-		else if(event->type==LEFTMOUSE && event->val!=KM_PRESS) {
+		else if (event->type == LEFTMOUSE && event->val != KM_PRESS) {
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 		}
 		return WM_UI_HANDLER_BREAK;
@@ -4005,29 +3893,30 @@ static int ui_numedit_but_WAVEFORM(uiBut *but, uiHandleButtonData *data, int mx,
 {
 	Scopes *scopes = (Scopes *)but->poin;
 	/* rcti rect; */
-	int changed= 1;
+	int changed = 1;
 	float /* dx, */ dy /* , yfac=1.f */; /* UNUSED */
 
-	/* rect.xmin= but->x1; rect.xmax= but->x2; */
-	/* rect.ymin= but->y1; rect.ymax= but->y2; */
+	/* rect.xmin = but->x1; rect.xmax = but->x2; */
+	/* rect.ymin = but->y1; rect.ymax = but->y2; */
 
 	/* dx = mx - data->draglastx; */ /* UNUSED */
 	dy = my - data->draglasty;
 
 
 	if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
-		 /* resize waveform widget itself */
+		/* resize waveform widget itself */
 		scopes->wavefrm_height = (but->y2 - but->y1) + (data->dragstarty - my);
-	} else {
+	}
+	else {
 		/* scale waveform values */
 		/* yfac = scopes->wavefrm_yfac; */ /* UNUSED */
-		scopes->wavefrm_yfac += dy/200.0f;
+		scopes->wavefrm_yfac += dy / 200.0f;
 
 		CLAMP(scopes->wavefrm_yfac, 0.5f, 2.f);
 	}
 
-	data->draglastx= mx;
-	data->draglasty= my;
+	data->draglastx = mx;
+	data->draglasty = my;
 
 	return changed;
 }
@@ -4036,26 +3925,26 @@ static int ui_do_but_WAVEFORM(bContext *C, uiBlock *block, uiBut *but, uiHandleB
 {
 	int mx, my;
 
-	mx= event->x;
-	my= event->y;
+	mx = event->x;
+	my = event->y;
 	ui_window_to_block(data->region, block, &mx, &my);
 
-	if(data->state == BUTTON_STATE_HIGHLIGHT) {
-		if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
-			data->dragstartx= mx;
-			data->dragstarty= my;
-			data->draglastx= mx;
-			data->draglasty= my;
+	if (data->state == BUTTON_STATE_HIGHLIGHT) {
+		if (event->type == LEFTMOUSE && event->val == KM_PRESS) {
+			data->dragstartx = mx;
+			data->dragstarty = my;
+			data->draglastx = mx;
+			data->draglasty = my;
 			button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 
 			/* also do drag the first time */
-			if(ui_numedit_but_WAVEFORM(but, data, mx, my))
+			if (ui_numedit_but_WAVEFORM(but, data, mx, my))
 				ui_numedit_apply(C, block, but, data);
 
 			return WM_UI_HANDLER_BREAK;
 		}
 		/* XXX hardcoded keymap check.... */
-		else if (event->type == DELKEY && event->val == KM_PRESS) {
+		else if (event->type == BACKSPACEKEY && event->val == KM_PRESS) {
 			Scopes *scopes = (Scopes *)but->poin;
 			scopes->wavefrm_yfac = 1.f;
 
@@ -4063,19 +3952,19 @@ static int ui_do_but_WAVEFORM(bContext *C, uiBlock *block, uiBut *but, uiHandleB
 			return WM_UI_HANDLER_BREAK;
 		}
 	}
-	else if(data->state == BUTTON_STATE_NUM_EDITING) {
-		if(event->type == ESCKEY) {
-			data->cancel= 1;
-			data->escapecancel= 1;
+	else if (data->state == BUTTON_STATE_NUM_EDITING) {
+		if (event->type == ESCKEY) {
+			data->cancel = 1;
+			data->escapecancel = 1;
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 		}
-		else if(event->type == MOUSEMOVE) {
-			if(mx!=data->draglastx || my!=data->draglasty) {
-				if(ui_numedit_but_WAVEFORM(but, data, mx, my))
+		else if (event->type == MOUSEMOVE) {
+			if (mx != data->draglastx || my != data->draglasty) {
+				if (ui_numedit_but_WAVEFORM(but, data, mx, my))
 					ui_numedit_apply(C, block, but, data);
 			}
 		}
-		else if(event->type==LEFTMOUSE && event->val!=KM_PRESS) {
+		else if (event->type == LEFTMOUSE && event->val != KM_PRESS) {
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 		}
 		return WM_UI_HANDLER_BREAK;
@@ -4088,22 +3977,22 @@ static int ui_numedit_but_VECTORSCOPE(uiBut *but, uiHandleButtonData *data, int
 {
 	Scopes *scopes = (Scopes *)but->poin;
 	/* rcti rect; */
-	int changed= 1;
+	int changed = 1;
 	/* float dx, dy; */
 
-	/* rect.xmin= but->x1; rect.xmax= but->x2; */
-	/* rect.ymin= but->y1; rect.ymax= but->y2; */
+	/* rect.xmin = but->x1; rect.xmax = but->x2; */
+	/* rect.ymin = but->y1; rect.ymax = but->y2; */
 
 	/* dx = mx - data->draglastx; */
 	/* dy = my - data->draglasty; */
 
 	if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
-		 /* resize vectorscope widget itself */
+		/* resize vectorscope widget itself */
 		scopes->vecscope_height = (but->y2 - but->y1) + (data->dragstarty - my);
 	}
 
-	data->draglastx= mx;
-	data->draglasty= my;
+	data->draglastx = mx;
+	data->draglasty = my;
 
 	return changed;
 }
@@ -4112,38 +4001,38 @@ static int ui_do_but_VECTORSCOPE(bContext *C, uiBlock *block, uiBut *but, uiHand
 {
 	int mx, my;
 
-	mx= event->x;
-	my= event->y;
+	mx = event->x;
+	my = event->y;
 	ui_window_to_block(data->region, block, &mx, &my);
 
-	if(data->state == BUTTON_STATE_HIGHLIGHT) {
-		if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
-			data->dragstartx= mx;
-			data->dragstarty= my;
-			data->draglastx= mx;
-			data->draglasty= my;
+	if (data->state == BUTTON_STATE_HIGHLIGHT) {
+		if (event->type == LEFTMOUSE && event->val == KM_PRESS) {
+			data->dragstartx = mx;
+			data->dragstarty = my;
+			data->draglastx = mx;
+			data->draglasty = my;
 			button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 
 			/* also do drag the first time */
-			if(ui_numedit_but_VECTORSCOPE(but, data, mx, my))
+			if (ui_numedit_but_VECTORSCOPE(but, data, mx, my))
 				ui_numedit_apply(C, block, but, data);
 
 			return WM_UI_HANDLER_BREAK;
 		}
 	}
-	else if(data->state == BUTTON_STATE_NUM_EDITING) {
-		if(event->type == ESCKEY) {
-			data->cancel= 1;
-			data->escapecancel= 1;
+	else if (data->state == BUTTON_STATE_NUM_EDITING) {
+		if (event->type == ESCKEY) {
+			data->cancel = 1;
+			data->escapecancel = 1;
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 		}
-		else if(event->type == MOUSEMOVE) {
-			if(mx!=data->draglastx || my!=data->draglasty) {
-				if(ui_numedit_but_VECTORSCOPE(but, data, mx, my))
+		else if (event->type == MOUSEMOVE) {
+			if (mx != data->draglastx || my != data->draglasty) {
+				if (ui_numedit_but_VECTORSCOPE(but, data, mx, my))
 					ui_numedit_apply(C, block, but, data);
 			}
 		}
-		else if(event->type==LEFTMOUSE && event->val!=KM_PRESS) {
+		else if (event->type == LEFTMOUSE && event->val != KM_PRESS) {
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 		}
 		return WM_UI_HANDLER_BREAK;
@@ -4162,12 +4051,12 @@ static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut
 	float butw, buth;
 	int mx, my, x, y, cs, che;
 
-	mx= event->x;
-	my= event->y;
+	mx = event->x;
+	my = event->y;
 	ui_window_to_block(data->region, block, &mx, &my);
 
-	if(data->state == BUTTON_STATE_HIGHLIGHT) {
-		if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
+	if (data->state == BUTTON_STATE_HIGHLIGHT) {
+		if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) {
 			/* Calculate the size of the button */
 			width = abs(but->x2 - but->x1);
 			height = abs(but->y2 - but->y1);
@@ -4187,66 +4076,63 @@ static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut
 			x = (int) ((mx / butw) - 0.5);
 			y = (int) (6 - ((my / buth) - 0.5));
 
-			che = cs + (y*12) + x;
+			che = cs + (y * 12) + x;
 
-			if(che > G.charmax)
+			if (che > G.charmax)
 				che = 0;
 
-			if(G.obedit)
-			{
-				do_textedit(0,0,che);
+			if (G.obedit) {
+				do_textedit(0, 0, che);
 			}
 
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 			return WM_UI_HANDLER_BREAK;
 		}
-		else if(ELEM(event->type, WHEELUPMOUSE, PAGEUPKEY)) {
-			for(but= block->buttons.first; but; but= but->next) {
-				if(but->type == CHARTAB) {
-					G.charstart = G.charstart - (12*6);
-					if(G.charstart < 0)
+		else if (ELEM(event->type, WHEELUPMOUSE, PAGEUPKEY)) {
+			for (but = block->buttons.first; but; but = but->next) {
+				if (but->type == CHARTAB) {
+					G.charstart = G.charstart - (12 * 6);
+					if (G.charstart < 0)
 						G.charstart = 0;
-					if(G.charstart < G.charmin)
+					if (G.charstart < G.charmin)
 						G.charstart = G.charmin;
 					ui_draw_but(but);
 
 					//Really nasty... to update the num button from the same butblock
-					for(bt= block->buttons.first; bt; bt= bt->next)
+					for (bt = block->buttons.first; bt; bt = bt->next)
 					{
-						if(ELEM(bt->type, NUM, NUMABS)) {
+						if (ELEM(bt->type, NUM, NUMABS)) {
 							ui_check_but(bt);
 							ui_draw_but(bt);
 						}
 					}
-					retval=UI_CONT;
+					retval = UI_CONT;
 					break;
 				}
 			}
 
 			return WM_UI_HANDLER_BREAK;
 		}
-		else if(ELEM(event->type, WHEELDOWNMOUSE, PAGEDOWNKEY)) {
-			for(but= block->buttons.first; but; but= but->next)
-			{
-				if(but->type == CHARTAB)
-				{
-					G.charstart = G.charstart + (12*6);
-					if(G.charstart > (0xffff - 12*6))
-						G.charstart = 0xffff - (12*6);
-					if(G.charstart > G.charmax - 12*6)
-						G.charstart = G.charmax - 12*6;
+		else if (ELEM(event->type, WHEELDOWNMOUSE, PAGEDOWNKEY)) {
+			for (but = block->buttons.first; but; but = but->next) {
+				if (but->type == CHARTAB) {
+					G.charstart = G.charstart + (12 * 6);
+					if (G.charstart > (0xffff - 12 * 6))
+						G.charstart = 0xffff - (12 * 6);
+					if (G.charstart > G.charmax - 12 * 6)
+						G.charstart = G.charmax - 12 * 6;
 					ui_draw_but(but);
 
-					for(bt= block->buttons.first; bt; bt= bt->next)
+					for (bt = block->buttons.first; bt; bt = bt->next)
 					{
-						if(ELEM(bt->type, NUM, NUMABS)) {
+						if (ELEM(bt->type, NUM, NUMABS)) {
 							ui_check_but(bt);
 							ui_draw_but(bt);
 						}
 					}
 					
 					but->flag |= UI_ACTIVE;
-					retval=UI_RETURN_OK;
+					retval = UI_RETURN_OK;
 					break;
 				}
 			}
@@ -4265,21 +4151,21 @@ static int ui_do_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data, wmE
 {	
 	VECCOPY2D(but->linkto, event->mval);
 
-	if(data->state == BUTTON_STATE_HIGHLIGHT) {
-		if(event->type == LEFTMOUSE && event->val==KM_PRESS) {
+	if (data->state == BUTTON_STATE_HIGHLIGHT) {
+		if (event->type == LEFTMOUSE && event->val == KM_PRESS) {
 			button_activate_state(C, but, BUTTON_STATE_WAIT_RELEASE);
 			return WM_UI_HANDLER_BREAK;
 		}
-		else if(event->type == LEFTMOUSE && but->block->handle) {
+		else if (event->type == LEFTMOUSE && but->block->handle) {
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 			return WM_UI_HANDLER_BREAK;
 		}
 	}
-	else if(data->state == BUTTON_STATE_WAIT_RELEASE) {
+	else if (data->state == BUTTON_STATE_WAIT_RELEASE) {
 		
-		if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
-			if(!(but->flag & UI_SELECT))
-				data->cancel= 1;
+		if (event->type == LEFTMOUSE && event->val != KM_PRESS) {
+			if (!(but->flag & UI_SELECT))
+				data->cancel = 1;
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 			return WM_UI_HANDLER_BREAK;
 		}
@@ -4291,37 +4177,38 @@ static int ui_do_but_LINK(bContext *C, uiBut *but, uiHandleButtonData *data, wmE
 static int ui_numedit_but_TRACKPREVIEW(bContext *C, uiBut *but, uiHandleButtonData *data, int mx, int my, int shift)
 {
 	MovieClipScopes *scopes = (MovieClipScopes *)but->poin;
-	int changed= 1;
+	int changed = 1;
 	float dx, dy;
 
 	dx = mx - data->draglastx;
 	dy = my - data->draglasty;
 
-	if(shift) {
+	if (shift) {
 		dx /= 5.0f;
 		dy /= 5.0f;
 	}
 
 	if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) {
-		 /* resize preview widget itself */
+		/* resize preview widget itself */
 		scopes->track_preview_height = (but->y2 - but->y1) + (data->dragstarty - my);
-	} else {
-		if(scopes->marker) {
-			if(scopes->marker->framenr!=scopes->framenr)
-				scopes->marker= BKE_tracking_ensure_marker(scopes->track, scopes->framenr);
+	}
+	else {
+		if (scopes->marker) {
+			if (scopes->marker->framenr != scopes->framenr)
+				scopes->marker = BKE_tracking_ensure_marker(scopes->track, scopes->framenr);
 
-			scopes->marker->flag&= ~(MARKER_DISABLED|MARKER_TRACKED);
-			scopes->marker->pos[0]+= -dx*scopes->slide_scale[0] / (but->block->maxx-but->block->minx);
-			scopes->marker->pos[1]+= -dy*scopes->slide_scale[1] / (but->block->maxy-but->block->miny);
+			scopes->marker->flag &= ~(MARKER_DISABLED | MARKER_TRACKED);
+			scopes->marker->pos[0] += -dx * scopes->slide_scale[0] / (but->block->maxx - but->block->minx);
+			scopes->marker->pos[1] += -dy * scopes->slide_scale[1] / (but->block->maxy - but->block->miny);
 
-			WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, NULL);
+			WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, NULL);
 		}
 
-		scopes->ok= 0;
+		scopes->ok = 0;
 	}
 
-	data->draglastx= mx;
-	data->draglasty= my;
+	data->draglastx = mx;
+	data->draglasty = my;
 
 	return changed;
 }
@@ -4330,38 +4217,38 @@ static int ui_do_but_TRACKPREVIEW(bContext *C, uiBlock *block, uiBut *but, uiHan
 {
 	int mx, my;
 
-	mx= event->x;
-	my= event->y;
+	mx = event->x;
+	my = event->y;
 	ui_window_to_block(data->region, block, &mx, &my);
 
-	if(data->state == BUTTON_STATE_HIGHLIGHT) {
-		if(event->type==LEFTMOUSE && event->val==KM_PRESS) {
-			data->dragstartx= mx;
-			data->dragstarty= my;
-			data->draglastx= mx;
-			data->draglasty= my;
+	if (data->state == BUTTON_STATE_HIGHLIGHT) {
+		if (event->type == LEFTMOUSE && event->val == KM_PRESS) {
+			data->dragstartx = mx;
+			data->dragstarty = my;
+			data->draglastx = mx;
+			data->draglasty = my;
 			button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
 
 			/* also do drag the first time */
-			if(ui_numedit_but_TRACKPREVIEW(C, but, data, mx, my, event->shift))
+			if (ui_numedit_but_TRACKPREVIEW(C, but, data, mx, my, event->shift))
 				ui_numedit_apply(C, block, but, data);
 
 			return WM_UI_HANDLER_BREAK;
 		}
 	}
-	else if(data->state == BUTTON_STATE_NUM_EDITING) {
-		if(event->type == ESCKEY) {
-			data->cancel= 1;
-			data->escapecancel= 1;
+	else if (data->state == BUTTON_STATE_NUM_EDITING) {
+		if (event->type == ESCKEY) {
+			data->cancel = 1;
+			data->escapecancel = 1;
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 		}
-		else if(event->type == MOUSEMOVE) {
-			if(mx!=data->draglastx || my!=data->draglasty) {
-				if(ui_numedit_but_TRACKPREVIEW(C, but, data, mx, my, event->shift))
+		else if (event->type == MOUSEMOVE) {
+			if (mx != data->draglastx || my != data->draglasty) {
+				if (ui_numedit_but_TRACKPREVIEW(C, but, data, mx, my, event->shift))
 					ui_numedit_apply(C, block, but, data);
 			}
 		}
-		else if(event->type==LEFTMOUSE && event->val!=KM_PRESS) {
+		else if (event->type == LEFTMOUSE && event->val != KM_PRESS) {
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
 		}
 		return WM_UI_HANDLER_BREAK;
@@ -4377,11 +4264,11 @@ static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event))
 	if (but->optype) {
 		char shortcut_str[128];
 
-		IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
+		IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
 		
 		/* complex code to change name of button */
-		if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE,
-		                                shortcut_str, sizeof(shortcut_str)))
+		if (WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE,
+		                                 shortcut_str, sizeof(shortcut_str)))
 		{
 			ui_but_add_shortcut(but, shortcut_str, TRUE);
 		}
@@ -4394,29 +4281,29 @@ static void but_shortcut_name_func(bContext *C, void *arg1, int UNUSED(event))
 
 static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 	uiBlock *block;
 	uiBut *but = (uiBut *)arg;
 	wmKeyMap *km;
 	wmKeyMapItem *kmi;
 	PointerRNA ptr;
 	uiLayout *layout;
-	uiStyle *style= UI_GetStyle();
-	IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
+	uiStyle *style = UI_GetStyle();
+	IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
 	int kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, 1, &km);
 
 	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);
+	block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
 	uiBlockSetHandleFunc(block, but_shortcut_name_func, but);
 	uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT);
 	uiBlockSetDirection(block, UI_CENTER);
 	
-	layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 200, 20, style);
+	layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 200, 20, style);
 	
-	uiItemR(layout, &ptr, "type", UI_ITEM_R_FULL_EVENT|UI_ITEM_R_IMMEDIATE, "", ICON_NONE);
+	uiItemR(layout, &ptr, "type", UI_ITEM_R_FULL_EVENT | UI_ITEM_R_IMMEDIATE, "", ICON_NONE);
 	
 	uiPopupBoundsBlock(block, 6, -50, 26);
 	uiEndBlock(C, block);
@@ -4426,15 +4313,15 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion *ar, void *arg)
 
 static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 	uiBlock *block;
 	uiBut *but = (uiBut *)arg;
 	wmKeyMap *km;
 	wmKeyMapItem *kmi;
 	PointerRNA ptr;
 	uiLayout *layout;
-	uiStyle *style= UI_GetStyle();
-	IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
+	uiStyle *style = UI_GetStyle();
+	IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
 	int kmi_id;
 	
 	/* XXX this guess_opname can potentially return a different keymap than being found on adding later... */
@@ -4443,8 +4330,8 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
 	kmi_id = kmi->id;
 
 	/* copy properties, prop can be NULL for reset */	
-	if(prop)
-		prop= IDP_CopyProperty(prop);
+	if (prop)
+		prop = IDP_CopyProperty(prop);
 	WM_keymap_properties_reset(kmi, prop);
 
 	/* update and get pointers again */
@@ -4455,14 +4342,14 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *ar, void *arg)
 
 	RNA_pointer_create(&wm->id, &RNA_KeyMapItem, kmi, &ptr);
 
-	block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
+	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);
+	layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 200, 20, style);
 
-	uiItemR(layout, &ptr, "type", UI_ITEM_R_FULL_EVENT|UI_ITEM_R_IMMEDIATE, "", ICON_NONE);
+	uiItemR(layout, &ptr, "type", UI_ITEM_R_FULL_EVENT | UI_ITEM_R_IMMEDIATE, "", ICON_NONE);
 	
 	uiPopupBoundsBlock(block, 6, -50, 26);
 	uiEndBlock(C, block);
@@ -4482,7 +4369,7 @@ static void remove_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2))
 	uiBut *but = (uiBut *)arg1;
 	wmKeyMap *km;
 	wmKeyMapItem *kmi;
-	IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
+	IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
 	int kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, 1, &km);
 	
 	kmi = WM_keymap_item_find_id(km, kmi_id);
@@ -4506,36 +4393,36 @@ static int ui_but_menu(bContext *C, uiBut *but)
 	int length;
 	const char *name;
 
-	if((but->rnapoin.data && but->rnaprop)==0 && but->optype==NULL)
+	if ((but->rnapoin.data && but->rnaprop) == 0 && but->optype == NULL)
 		return 0;
 	
 	button_timers_tooltip_remove(C, but);
 
-	if(but->rnaprop)
-		name= RNA_property_ui_name(but->rnaprop);
+	if (but->rnaprop)
+		name = RNA_property_ui_name(but->rnaprop);
 	else if (but->optype)
-		name= but->optype->name;
+		name = but->optype->name;
 	else
-		name= "<needs_name>"; // XXX - should never happen.
+		name = "<needs_name>";  // XXX - should never happen.
 
-	pup= uiPupMenuBegin(C, name, ICON_NONE);
-	layout= uiPupMenuLayout(pup);
+	pup = uiPupMenuBegin(C, name, ICON_NONE);
+	layout = uiPupMenuLayout(pup);
 	
 	uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT);
 
-	if(but->rnapoin.data && but->rnaprop) {
-		short is_anim= RNA_property_animateable(&but->rnapoin, but->rnaprop);
+	if (but->rnapoin.data && but->rnaprop) {
+		short is_anim = RNA_property_animateable(&but->rnapoin, but->rnaprop);
 
 		/* second slower test, saved people finding keyframe items in menus when its not possible */
-		if(is_anim)
-			is_anim= RNA_property_path_from_ID_check(&but->rnapoin, but->rnaprop);
+		if (is_anim)
+			is_anim = RNA_property_path_from_ID_check(&but->rnapoin, but->rnaprop);
 
-		length= RNA_property_array_length(&but->rnapoin, but->rnaprop);
+		length = RNA_property_array_length(&but->rnapoin, but->rnaprop);
 		
 		/* Keyframes */
-		if(but->flag & UI_BUT_ANIMATED_KEY) {
+		if (but->flag & UI_BUT_ANIMATED_KEY) {
 			/* replace/delete keyfraemes */
-			if(length) {
+			if (length) {
 				uiItemBooleanO(layout, "Replace Keyframes", ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 1);
 				uiItemBooleanO(layout, "Replace Single Keyframe", ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 0);
 				uiItemBooleanO(layout, "Delete Keyframes", ICON_NONE, "ANIM_OT_keyframe_delete_button", "all", 1);
@@ -4551,9 +4438,9 @@ static int ui_but_menu(bContext *C, uiBut *but)
 			
 			
 		}
-		else if(but->flag & UI_BUT_DRIVEN);
-		else if(is_anim) {
-			if(length) {
+		else if (but->flag & UI_BUT_DRIVEN) ;
+		else if (is_anim) {
+			if (length) {
 				uiItemBooleanO(layout, "Insert Keyframes", ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 1);
 				uiItemBooleanO(layout, "Insert Single Keyframe", ICON_NONE, "ANIM_OT_keyframe_insert_button", "all", 0);
 			}
@@ -4562,10 +4449,10 @@ static int ui_but_menu(bContext *C, uiBut *but)
 		}
 		
 		/* Drivers */
-		if(but->flag & UI_BUT_DRIVEN) {
+		if (but->flag & UI_BUT_DRIVEN) {
 			uiItemS(layout);
 
-			if(length) {
+			if (length) {
 				uiItemBooleanO(layout, "Delete Drivers", ICON_NONE, "ANIM_OT_driver_button_remove", "all", 1);
 				uiItemBooleanO(layout, "Delete Single Driver", ICON_NONE, "ANIM_OT_driver_button_remove", "all", 0);
 			}
@@ -4576,11 +4463,11 @@ static int ui_but_menu(bContext *C, uiBut *but)
 			if (ANIM_driver_can_paste())
 				uiItemO(layout, "Paste Driver", ICON_NONE, "ANIM_OT_paste_driver_button");
 		}
-		else if(but->flag & (UI_BUT_ANIMATED_KEY|UI_BUT_ANIMATED));
-		else if(is_anim) {
+		else if (but->flag & (UI_BUT_ANIMATED_KEY | UI_BUT_ANIMATED)) ;
+		else if (is_anim) {
 			uiItemS(layout);
 
-			if(length) {
+			if (length) {
 				uiItemBooleanO(layout, "Add Drivers", ICON_NONE, "ANIM_OT_driver_button_add", "all", 1);
 				uiItemBooleanO(layout, "Add Single Driver", ICON_NONE, "ANIM_OT_driver_button_add", "all", 0);
 			}
@@ -4593,10 +4480,10 @@ static int ui_but_menu(bContext *C, uiBut *but)
 		
 		/* Keying Sets */
 		// TODO: check on modifyability of Keying Set when doing this
-		if(is_anim) {
+		if (is_anim) {
 			uiItemS(layout);
 
-			if(length) {
+			if (length) {
 				uiItemBooleanO(layout, "Add All to Keying Set", ICON_NONE, "ANIM_OT_keyingset_button_add", "all", 1);
 				uiItemBooleanO(layout, "Add Single to Keying Set", ICON_NONE, "ANIM_OT_keyingset_button_add", "all", 0);
 				uiItemO(layout, "Remove from Keying Set", ICON_NONE, "ANIM_OT_keyingset_button_remove");
@@ -4614,7 +4501,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
 		//Copy Property Value
 		//Paste Property Value
 		
-		if(length) {
+		if (length) {
 			uiItemBooleanO(layout, "Reset All to Default Values", ICON_NONE, "UI_OT_reset_default_button", "all", 1);
 			uiItemBooleanO(layout, "Reset Single to Default Value", ICON_NONE, "UI_OT_reset_default_button", "all", 0);
 		}
@@ -4628,17 +4515,17 @@ static int ui_but_menu(bContext *C, uiBut *but)
 	}
 
 	/* Operator buttons */
-	if(but->optype) {
+	if (but->optype) {
 		uiBlock *block = uiLayoutGetBlock(layout);
 		uiBut *but2;
-		IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
+		IDProperty *prop = (but->opptr) ? but->opptr->data : NULL;
 		int w = uiLayoutGetWidth(layout);
 		wmKeyMap *km;
-		wmKeyMapItem *kmi= NULL;
-		int kmi_id= WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, 1, &km);
+		wmKeyMapItem *kmi = NULL;
+		int kmi_id = WM_key_event_operator_id(C, but->optype->idname, but->opcontext, prop, 1, &km);
 
 		if (kmi_id)
-			kmi= WM_keymap_item_find_id(km, kmi_id);
+			kmi = WM_keymap_item_find_id(km, kmi_id);
 
 		/* keyboard shortcuts */
 		if ((kmi) && ISKEYBOARD(kmi->type)) {
@@ -4662,11 +4549,11 @@ static int ui_but_menu(bContext *C, uiBut *but)
 	}
 
 	
-	{	/* Docs */
+	{   /* Docs */
 		char buf[512];
 		PointerRNA ptr_props;
 
-		if(but->rnapoin.data && but->rnaprop) {
+		if (but->rnapoin.data && but->rnaprop) {
 			BLI_snprintf(buf, sizeof(buf), "%s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop));
 
 			WM_operator_properties_create(&ptr_props, "WM_OT_doc_view");
@@ -4674,12 +4561,13 @@ static int ui_but_menu(bContext *C, uiBut *but)
 			uiItemFullO(layout, "WM_OT_doc_view", "View Docs", ICON_NONE, ptr_props.data, WM_OP_EXEC_DEFAULT, 0);
 
 			/* XXX inactive option, not for public! */
-/*			WM_operator_properties_create(&ptr_props, "WM_OT_doc_edit");
+#if 0
+			WM_operator_properties_create(&ptr_props, "WM_OT_doc_edit");
 			RNA_string_set(&ptr_props, "doc_id", buf);
 			RNA_string_set(&ptr_props, "doc_new", RNA_property_description(but->rnaprop));
 
 			uiItemFullO(layout, "WM_OT_doc_edit", "Submit Description", ICON_NONE, ptr_props.data, WM_OP_INVOKE_DEFAULT, 0);
- */
+ #endif
 		}
 		else if (but->optype) {
 			WM_operator_py_idname(buf, but->optype->idname);
@@ -4697,7 +4585,7 @@ static int ui_but_menu(bContext *C, uiBut *but)
 		}
 	}
 
-	/* perhaps we should move this into (G.f & G_DEBUG) - campbell */
+	/* perhaps we should move this into (G.debug & G_DEBUG) - campbell */
 	uiItemFullO(layout, "UI_OT_editsource", "Edit Source", ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0);
 
 	uiPupMenuEnd(C, pup);
@@ -4711,30 +4599,30 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
 	uiHandleButtonData *data;
 	int retval;
 
-	data= but->active;
-	retval= WM_UI_HANDLER_CONTINUE;
+	data = but->active;
+	retval = WM_UI_HANDLER_CONTINUE;
 
-	if(but->flag & UI_BUT_DISABLED)
+	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) &&
+	    /* 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)))
+	{
 		/* 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');
+		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;
 		}
 		/* handle drop */
-		else if(event->type == EVT_DROP) {
-			ui_but_drop	(C, event, but, data);
+		else if (event->type == EVT_DROP) {
+			ui_but_drop(C, event, but, data);
 		}
 		/* handle keyframing */
-		else if(event->type == IKEY && !ELEM3(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift) && event->val == KM_PRESS) {
-			if(event->alt)
+		else if (event->type == IKEY && !ELEM3(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift) && event->val == KM_PRESS) {
+			if (event->alt)
 				ui_but_anim_delete_keyframe(C);
 			else
 				ui_but_anim_insert_keyframe(C);
@@ -4744,8 +4632,8 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
 			return WM_UI_HANDLER_BREAK;
 		}
 		/* handle drivers */
-		else if(event->type == DKEY && !ELEM3(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift) && event->val == KM_PRESS) {
-			if(event->alt)
+		else if (event->type == DKEY && !ELEM3(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift) && event->val == KM_PRESS) {
+			if (event->alt)
 				ui_but_anim_remove_driver(C);
 			else
 				ui_but_anim_add_driver(C);
@@ -4755,8 +4643,8 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
 			return WM_UI_HANDLER_BREAK;
 		}
 		/* handle keyingsets */
-		else if(event->type == KKEY && !ELEM3(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift) && event->val == KM_PRESS) {
-			if(event->alt)
+		else if (event->type == KKEY && !ELEM3(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift) && event->val == KM_PRESS) {
+			if (event->alt)
 				ui_but_anim_remove_keyingset(C);
 			else
 				ui_but_anim_add_keyingset(C);
@@ -4767,13 +4655,13 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
 		}
 		/* reset to default */
 		/* XXX hardcoded keymap check.... */
-		else if(ELEM(event->type, DELKEY, PADPERIOD) && event->val == KM_PRESS) {
-			/* ctrl+del - reset active button; del - reset a whole array*/
+		else if (event->type == BACKSPACEKEY && event->val == KM_PRESS) {
+			/* ctrl+backspace = reset active button; backspace = reset a whole array*/
 			if (!(ELEM3(but->type, HSVCIRCLE, HSVCUBE, HISTOGRAM)))
 				ui_set_but_default(C, !event->ctrl);
 		}
 		/* handle menu */
-		else if(event->type == RIGHTMOUSE && event->val == KM_PRESS) {
+		else if (event->type == RIGHTMOUSE && event->val == KM_PRESS) {
 			/* RMB has two options now */
 			if (ui_but_menu(C, but)) {
 				return WM_UI_HANDLER_BREAK;
@@ -4782,16 +4670,16 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
 	}
 
 	/* verify if we can edit this button */
-	if(ELEM(event->type, LEFTMOUSE, RETKEY)) {
+	if (ELEM(event->type, LEFTMOUSE, RETKEY)) {
 		/* this should become disabled button .. */
-		if(but->lock) {
-			if(but->lockstr) {
+		if (but->lock) {
+			if (but->lockstr) {
 				BKE_report(NULL, RPT_WARNING, but->lockstr);
 				button_activate_state(C, but, BUTTON_STATE_EXIT);
 				return WM_UI_HANDLER_BREAK;
 			}
 		} 
-		else if(but->pointype && but->poin==NULL) {
+		else if (but->pointype && but->poin == NULL) {
 			/* there's a pointer needed */
 			BKE_reportf(NULL, RPT_WARNING, "DoButton pointer error: %s", but->str);
 			button_activate_state(C, but, BUTTON_STATE_EXIT);
@@ -4799,107 +4687,107 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
 		}
 	}
 
-	switch(but->type) {
-	case BUT:
-		retval= ui_do_but_BUT(C, but, data, event);
-		break;
-	case KEYEVT:
-		retval= ui_do_but_KEYEVT(C, but, data, event);
-		break;
-	case HOTKEYEVT:
-		retval= ui_do_but_HOTKEYEVT(C, but, data, event);
-		break;
-	case TOGBUT: 
-	case TOG: 
-	case TOGR: 
-	case ICONTOG:
-	case ICONTOGN:
-	case TOGN:
-	case BUT_TOGDUAL:
-	case OPTION:
-	case OPTIONN:
-		retval= ui_do_but_TOG(C, but, data, event);
-		break;
-	case SCROLL:
-		retval= ui_do_but_SCROLL(C, block, but, data, event);
-		break;
-	case NUM:
-	case NUMABS:
-		retval= ui_do_but_NUM(C, block, but, data, event);
-		break;
-	case SLI:
-	case NUMSLI:
-	case HSVSLI:
-		retval= ui_do_but_SLI(C, block, but, data, event);
-		break;
-	case ROUNDBOX:	
-	case LISTBOX:
-	case LABEL:	
-	case TOG3:	
-	case ROW:
-	case LISTROW:
-	case BUT_IMAGE:
-	case PROGRESSBAR:
-		retval= ui_do_but_EXIT(C, but, data, event);
-		break;
-	case HISTOGRAM:
-		retval= ui_do_but_HISTOGRAM(C, block, but, data, event);
-		break;
-	case WAVEFORM:
-		retval= ui_do_but_WAVEFORM(C, block, but, data, event);
-		break;
-	case VECTORSCOPE:
-		retval= ui_do_but_VECTORSCOPE(C, block, but, data, event);
-		break;
-	case TEX:
-	case IDPOIN:
-	case SEARCH_MENU:
-		retval= ui_do_but_TEX(C, block, but, data, event);
-		break;
-	case MENU:
-	case ICONROW:
-	case ICONTEXTROW:
-	case BLOCK:
-	case PULLDOWN:
-		retval= ui_do_but_BLOCK(C, but, data, event);
-		break;
-	case BUTM:
-		retval= ui_do_but_BUT(C, but, data, event);
-		break;
-	case COL:
-		if(but->a1 == UI_GRAD_V_ALT)  // signal to prevent calling up color picker
-			retval= ui_do_but_EXIT(C, but, data, event);
-		else
-			retval= ui_do_but_BLOCK(C, but, data, event);
-		break;
-	case BUT_NORMAL:
-		retval= ui_do_but_NORMAL(C, block, but, data, event);
-		break;
-	case BUT_COLORBAND:
-		retval= ui_do_but_COLORBAND(C, block, but, data, event);
-		break;
-	case BUT_CURVE:
-		retval= ui_do_but_CURVE(C, block, but, data, event);
-		break;
-	case HSVCUBE:
-		retval= ui_do_but_HSVCUBE(C, block, but, data, event);
-		break;
-	case HSVCIRCLE:
-		retval= ui_do_but_HSVCIRCLE(C, block, but, data, event);
-		break;
+	switch (but->type) {
+		case BUT:
+			retval = ui_do_but_BUT(C, but, data, event);
+			break;
+		case KEYEVT:
+			retval = ui_do_but_KEYEVT(C, but, data, event);
+			break;
+		case HOTKEYEVT:
+			retval = ui_do_but_HOTKEYEVT(C, but, data, event);
+			break;
+		case TOGBUT:
+		case TOG:
+		case TOGR:
+		case ICONTOG:
+		case ICONTOGN:
+		case TOGN:
+		case BUT_TOGDUAL:
+		case OPTION:
+		case OPTIONN:
+			retval = ui_do_but_TOG(C, but, data, event);
+			break;
+		case SCROLL:
+			retval = ui_do_but_SCROLL(C, block, but, data, event);
+			break;
+		case NUM:
+		case NUMABS:
+			retval = ui_do_but_NUM(C, block, but, data, event);
+			break;
+		case SLI:
+		case NUMSLI:
+		case HSVSLI:
+			retval = ui_do_but_SLI(C, block, but, data, event);
+			break;
+		case ROUNDBOX:
+		case LISTBOX:
+		case LABEL:
+		case TOG3:
+		case ROW:
+		case LISTROW:
+		case BUT_IMAGE:
+		case PROGRESSBAR:
+			retval = ui_do_but_EXIT(C, but, data, event);
+			break;
+		case HISTOGRAM:
+			retval = ui_do_but_HISTOGRAM(C, block, but, data, event);
+			break;
+		case WAVEFORM:
+			retval = ui_do_but_WAVEFORM(C, block, but, data, event);
+			break;
+		case VECTORSCOPE:
+			retval = ui_do_but_VECTORSCOPE(C, block, but, data, event);
+			break;
+		case TEX:
+		case IDPOIN:
+		case SEARCH_MENU:
+			retval = ui_do_but_TEX(C, block, but, data, event);
+			break;
+		case MENU:
+		case ICONROW:
+		case ICONTEXTROW:
+		case BLOCK:
+		case PULLDOWN:
+			retval = ui_do_but_BLOCK(C, but, data, event);
+			break;
+		case BUTM:
+			retval = ui_do_but_BUT(C, but, data, event);
+			break;
+		case COL:
+			if (but->a1 == UI_GRAD_V_ALT) // signal to prevent calling up color picker
+				retval = ui_do_but_EXIT(C, but, data, event);
+			else
+				retval = ui_do_but_BLOCK(C, but, data, event);
+			break;
+		case BUT_NORMAL:
+			retval = ui_do_but_NORMAL(C, block, but, data, event);
+			break;
+		case BUT_COLORBAND:
+			retval = ui_do_but_COLORBAND(C, block, but, data, event);
+			break;
+		case BUT_CURVE:
+			retval = ui_do_but_CURVE(C, block, but, data, event);
+			break;
+		case HSVCUBE:
+			retval = ui_do_but_HSVCUBE(C, block, but, data, event);
+			break;
+		case HSVCIRCLE:
+			retval = ui_do_but_HSVCIRCLE(C, block, but, data, event);
+			break;
 #ifdef WITH_INTERNATIONAL
-	case CHARTAB:
-		retval= ui_do_but_CHARTAB(C, block, but, data, event);
-		break;
+		case CHARTAB:
+			retval = ui_do_but_CHARTAB(C, block, but, data, event);
+			break;
 #endif
 
-	case LINK:
-	case INLINK:
-		retval= ui_do_but_LINK(C, but, data, event);
-		break;
-	case TRACKPREVIEW:
-		retval= ui_do_but_TRACKPREVIEW(C, block, but, data, event);
-		break;
+		case LINK:
+		case INLINK:
+			retval = ui_do_but_LINK(C, but, data, event);
+			break;
+		case TRACKPREVIEW:
+			retval = ui_do_but_TRACKPREVIEW(C, block, but, data, event);
+			break;
 	}
 	
 	return retval;
@@ -4909,7 +4797,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
 
 static int ui_but_contains_pt(uiBut *but, int mx, int my)
 {
-	return ((but->x1<mx && but->x2>=mx) && (but->y1<my && but->y2>=my));
+	return ((but->x1 < mx && but->x2 >= mx) && (but->y1 < my && but->y2 >= my));
 }
 
 static uiBut *ui_but_find_activated(ARegion *ar)
@@ -4917,9 +4805,9 @@ static uiBut *ui_but_find_activated(ARegion *ar)
 	uiBlock *block;
 	uiBut *but;
 
-	for(block=ar->uiblocks.first; block; block=block->next)
-		for(but=block->buttons.first; but; but= but->next)
-			if(but->active)
+	for (block = ar->uiblocks.first; block; block = block->next)
+		for (but = block->buttons.first; but; but = but->next)
+			if (but->active)
 				return but;
 
 	return NULL;
@@ -4933,17 +4821,17 @@ int ui_button_is_active(ARegion *ar)
 /* is called by notifier */
 void uiFreeActiveButtons(const bContext *C, bScreen *screen)
 {
-	ScrArea *sa= screen->areabase.first;
+	ScrArea *sa = screen->areabase.first;
 	
-	for(;sa; sa= sa->next) {
-		ARegion *ar= sa->regionbase.first;
-		for(;ar; ar= ar->next) {
-			uiBut *but= ui_but_find_activated(ar);
-			if(but) {
-				uiHandleButtonData *data= but->active;
+	for (; sa; sa = sa->next) {
+		ARegion *ar = sa->regionbase.first;
+		for (; ar; ar = ar->next) {
+			uiBut *but = ui_but_find_activated(ar);
+			if (but) {
+				uiHandleButtonData *data = but->active;
 				
-				if(data->menu==NULL && data->searchbox==NULL)
-					if(data->state == BUTTON_STATE_HIGHLIGHT)
+				if (data->menu == NULL && data->searchbox == NULL)
+					if (data->state == BUTTON_STATE_HIGHLIGHT)
 						ui_button_active_free(C, but);
 			}
 		}
@@ -4956,11 +4844,11 @@ void uiFreeActiveButtons(const bContext *C, bScreen *screen)
 /* called in region context */
 int UI_but_active_drop_name(bContext *C)
 {
-	ARegion *ar= CTX_wm_region(C);
-	uiBut *but= ui_but_find_activated(ar);
+	ARegion *ar = CTX_wm_region(C);
+	uiBut *but = ui_but_find_activated(ar);
 
-	if(but) {
-		if(ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU))
+	if (but) {
+		if (ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU))
 			return 1;
 	}
 	
@@ -4971,13 +4859,13 @@ static void ui_blocks_set_tooltips(ARegion *ar, int enable)
 {
 	uiBlock *block;
 
-	if(!ar)
+	if (!ar)
 		return;
 
 	/* we disabled buttons when when they were already shown, and
 	 * re-enable them on mouse move */
-	for(block=ar->uiblocks.first; block; block=block->next)
-		block->tooltipdisabled= !enable;
+	for (block = ar->uiblocks.first; block; block = block->next)
+		block->tooltipdisabled = !enable;
 }
 
 static int ui_mouse_inside_region(ARegion *ar, int x, int y)
@@ -4985,9 +4873,9 @@ static int ui_mouse_inside_region(ARegion *ar, int x, int y)
 	uiBlock *block;
 	
 	/* check if the mouse is in the region */
-	if(!BLI_in_rcti(&ar->winrct, x, y)) {
-		for(block=ar->uiblocks.first; block; block=block->next)
-			block->auto_open= FALSE;
+	if (!BLI_in_rcti(&ar->winrct, x, y)) {
+		for (block = ar->uiblocks.first; block; block = block->next)
+			block->auto_open = FALSE;
 		
 		return 0;
 	}
@@ -4997,37 +4885,37 @@ static int ui_mouse_inside_region(ARegion *ar, int x, int y)
 	 * even when they are not visible, so we need to make a copy of the mask to
 	 * use to check
 	 */
-	if(ar->v2d.mask.xmin!=ar->v2d.mask.xmax) {
-		View2D *v2d= &ar->v2d;
+	if (ar->v2d.mask.xmin != ar->v2d.mask.xmax) {
+		View2D *v2d = &ar->v2d;
 		rcti mask_rct;
 		int mx, my;
 		
 		/* convert window coordinates to region coordinates */
-		mx= x;
-		my= y;
+		mx = x;
+		my = y;
 		ui_window_to_region(ar, &mx, &my);
 		
 		/* make a copy of the mask rect, and tweak accordingly for hidden scrollbars */
-		mask_rct.xmin= v2d->mask.xmin;
-		mask_rct.xmax= v2d->mask.xmax;
-		mask_rct.ymin= v2d->mask.ymin;
-		mask_rct.ymax= v2d->mask.ymax;
+		mask_rct.xmin = v2d->mask.xmin;
+		mask_rct.xmax = v2d->mask.xmax;
+		mask_rct.ymin = v2d->mask.ymin;
+		mask_rct.ymax = v2d->mask.ymax;
 		
-		if (v2d->scroll & (V2D_SCROLL_VERTICAL_HIDE|V2D_SCROLL_VERTICAL_FULLR)) {
+		if (v2d->scroll & (V2D_SCROLL_VERTICAL_HIDE | V2D_SCROLL_VERTICAL_FULLR)) {
 			if (v2d->scroll & V2D_SCROLL_LEFT)
-				mask_rct.xmin= v2d->vert.xmin;
+				mask_rct.xmin = v2d->vert.xmin;
 			else if (v2d->scroll & V2D_SCROLL_RIGHT)
-				mask_rct.xmax= v2d->vert.xmax;
+				mask_rct.xmax = v2d->vert.xmax;
 		}
-		if (v2d->scroll & (V2D_SCROLL_HORIZONTAL_HIDE|V2D_SCROLL_HORIZONTAL_FULLR)) {
-			if (v2d->scroll & (V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O))
-				mask_rct.ymin= v2d->hor.ymin;
+		if (v2d->scroll & (V2D_SCROLL_HORIZONTAL_HIDE | V2D_SCROLL_HORIZONTAL_FULLR)) {
+			if (v2d->scroll & (V2D_SCROLL_BOTTOM | V2D_SCROLL_BOTTOM_O))
+				mask_rct.ymin = v2d->hor.ymin;
 			else if (v2d->scroll & V2D_SCROLL_TOP)
-				mask_rct.ymax= v2d->hor.ymax;
+				mask_rct.ymax = v2d->hor.ymax;
 		}
 		
 		/* check if in the rect */
-		if(!BLI_in_rcti(&mask_rct, mx, my)) 
+		if (!BLI_in_rcti(&mask_rct, mx, my)) 
 			return 0;
 	}
 	
@@ -5036,12 +4924,12 @@ static int ui_mouse_inside_region(ARegion *ar, int x, int y)
 
 static int ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y)
 {
-	if(!ui_mouse_inside_region(ar, x, y))
+	if (!ui_mouse_inside_region(ar, x, y))
 		return 0;
 
 	ui_window_to_block(ar, but->block, &x, &y);
 
-	if(!ui_but_contains_pt(but, x, y))
+	if (!ui_but_contains_pt(but, x, y))
 		return 0;
 	
 	return 1;
@@ -5050,39 +4938,41 @@ static int ui_mouse_inside_button(ARegion *ar, uiBut *but, int x, int y)
 static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y)
 {
 	uiBlock *block;
-	uiBut *but, *butover= NULL;
+	uiBut *but, *butover = NULL;
 	int mx, my;
 
-//	if(!win->active)
+//	if (!win->active)
 //		return NULL;
-	if(!ui_mouse_inside_region(ar, x, y))
+	if (!ui_mouse_inside_region(ar, x, y))
 		return NULL;
 
-	for(block=ar->uiblocks.first; block; block=block->next) {
-		mx= x;
-		my= y;
+	for (block = ar->uiblocks.first; block; block = block->next) {
+		mx = x;
+		my = y;
 		ui_window_to_block(ar, block, &mx, &my);
 
-		for(but=block->buttons.first; but; but= but->next) {
+		for (but = block->buttons.first; but; but = but->next) {
 			/* note, LABEL is included for hilights, this allows drags */
-			if(but->type==LABEL && but->dragpoin==NULL)
+			if (but->type == LABEL && but->dragpoin == NULL)
 				continue;
-			if(ELEM3(but->type, ROUNDBOX, SEPR, LISTBOX))
+			if (ELEM3(but->type, ROUNDBOX, SEPR, LISTBOX))
 				continue;
-			if(but->flag & UI_HIDDEN)
+			if (but->flag & UI_HIDDEN)
 				continue;
-			if(but->flag & UI_SCROLLED)
+			if (but->flag & UI_SCROLLED)
 				continue;
-			if(ui_but_contains_pt(but, mx, my))
-				butover= but;
+			if (ui_but_contains_pt(but, mx, my))
+				butover = but;
 		}
 
 		/* CLIP_EVENTS prevents the event from reaching other blocks */
 		if (block->flag & UI_BLOCK_CLIP_EVENTS) {
 			/* check if mouse is inside block */
-			if(block->minx <= mx && block->maxx >= mx &&
-			   block->miny <= my && block->maxy >= my)
+			if (block->minx <= mx && block->maxx >= mx &&
+			    block->miny <= my && block->maxy >= my)
+			{
 				break;
+			}
 		}
 	}
 
@@ -5095,18 +4985,18 @@ static uiBut *ui_list_find_mouse_over(ARegion *ar, int x, int y)
 	uiBut *but;
 	int mx, my;
 
-//	if(!win->active)
+//	if (!win->active)
 //		return NULL;
-	if(!ui_mouse_inside_region(ar, x, y))
+	if (!ui_mouse_inside_region(ar, x, y))
 		return NULL;
 
-	for(block=ar->uiblocks.first; block; block=block->next) {
-		mx= x;
-		my= y;
+	for (block = ar->uiblocks.first; block; block = block->next) {
+		mx = x;
+		my = y;
 		ui_window_to_block(ar, block, &mx, &my);
 
-		for(but=block->buttons.last; but; but= but->prev)
-			if(but->type == LISTBOX && ui_but_contains_pt(but, mx, my))
+		for (but = block->buttons.last; but; but = but->prev)
+			if (but->type == LISTBOX && ui_but_contains_pt(but, mx, my))
 				return but;
 	}
 
@@ -5118,77 +5008,77 @@ static uiBut *ui_list_find_mouse_over(ARegion *ar, int x, int y)
 static int button_modal_state(uiHandleButtonState state)
 {
 	return ELEM6(state, BUTTON_STATE_WAIT_RELEASE, BUTTON_STATE_WAIT_KEY_EVENT,
-		BUTTON_STATE_NUM_EDITING, BUTTON_STATE_TEXT_EDITING,
-		BUTTON_STATE_TEXT_SELECTING, BUTTON_STATE_MENU_OPEN);
+	             BUTTON_STATE_NUM_EDITING, BUTTON_STATE_TEXT_EDITING,
+	             BUTTON_STATE_TEXT_SELECTING, BUTTON_STATE_MENU_OPEN);
 }
 
 static void button_timers_tooltip_remove(bContext *C, uiBut *but)
 {
 	uiHandleButtonData *data;
 
-	data= but->active;
-	if(data) {
+	data = but->active;
+	if (data) {
 
-		if(data->tooltiptimer) {
+		if (data->tooltiptimer) {
 			WM_event_remove_timer(data->wm, data->window, data->tooltiptimer);
-			data->tooltiptimer= NULL;
+			data->tooltiptimer = NULL;
 		}
-		if(data->tooltip) {
+		if (data->tooltip) {
 			ui_tooltip_free(C, data->tooltip);
-			data->tooltip= NULL;
+			data->tooltip = NULL;
 		}
 
-		if(data->autoopentimer) {
+		if (data->autoopentimer) {
 			WM_event_remove_timer(data->wm, data->window, data->autoopentimer);
-			data->autoopentimer= NULL;
+			data->autoopentimer = NULL;
 		}
 	}
 }
 
 static void button_tooltip_timer_reset(bContext *C, uiBut *but)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 	uiHandleButtonData *data;
 
-	data= but->active;
+	data = but->active;
 
-	if(data->tooltiptimer) {
+	if (data->tooltiptimer) {
 		WM_event_remove_timer(data->wm, data->window, data->tooltiptimer);
-		data->tooltiptimer= NULL;
+		data->tooltiptimer = NULL;
 	}
 
-	if(U.flag & USER_TOOLTIPS)
-		if(!but->block->tooltipdisabled)
-			if(!wm->drags.first)
-				data->tooltiptimer= WM_event_add_timer(data->wm, data->window, TIMER, BUTTON_TOOLTIP_DELAY);
+	if (U.flag & USER_TOOLTIPS)
+		if (!but->block->tooltipdisabled)
+			if (!wm->drags.first)
+				data->tooltiptimer = WM_event_add_timer(data->wm, data->window, TIMER, BUTTON_TOOLTIP_DELAY);
 }
 
 static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState state)
 {
 	uiHandleButtonData *data;
 
-	data= but->active;
-	if(data->state == state)
+	data = but->active;
+	if (data->state == state)
 		return;
 
 	/* highlight has timers for tooltips and auto open */
-	if(state == BUTTON_STATE_HIGHLIGHT) {
+	if (state == BUTTON_STATE_HIGHLIGHT) {
 		but->flag &= ~UI_SELECT;
 
 		button_tooltip_timer_reset(C, but);
 
 		/* automatic open pulldown block timer */
-		if(ELEM3(but->type, BLOCK, PULLDOWN, ICONTEXTROW)) {
-			if(data->used_mouse && !data->autoopentimer) {
+		if (ELEM3(but->type, BLOCK, PULLDOWN, ICONTEXTROW)) {
+			if (data->used_mouse && !data->autoopentimer) {
 				int time;
 
-				if(but->block->auto_open==TRUE) time= 1;    // test for toolbox
-				else if((but->block->flag & UI_BLOCK_LOOP && but->type != BLOCK) || but->block->auto_open==TRUE) time= 5*U.menuthreshold2;
-				else if(U.uiflag & USER_MENUOPENAUTO) time= 5*U.menuthreshold1;
-				else time= -1;
+				if (but->block->auto_open == TRUE) time = 1;  // test for toolbox
+				else if ((but->block->flag & UI_BLOCK_LOOP && but->type != BLOCK) || but->block->auto_open == TRUE) time = 5 * U.menuthreshold2;
+				else if (U.uiflag & USER_MENUOPENAUTO) time = 5 * U.menuthreshold1;
+				else time = -1;
 
-				if(time >= 0)
-					data->autoopentimer= WM_event_add_timer(data->wm, data->window, TIMER, 0.02*(double)time);
+				if (time >= 0)
+					data->autoopentimer = WM_event_add_timer(data->wm, data->window, TIMER, 0.02 * (double)time);
 			}
 		}
 	}
@@ -5198,65 +5088,66 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
 	}
 	
 	/* text editing */
-	if(state == BUTTON_STATE_TEXT_EDITING && data->state != BUTTON_STATE_TEXT_SELECTING)
+	if (state == BUTTON_STATE_TEXT_EDITING && data->state != BUTTON_STATE_TEXT_SELECTING)
 		ui_textedit_begin(C, but, data);
-	else if(data->state == BUTTON_STATE_TEXT_EDITING && state != BUTTON_STATE_TEXT_SELECTING)
+	else if (data->state == BUTTON_STATE_TEXT_EDITING && state != BUTTON_STATE_TEXT_SELECTING)
 		ui_textedit_end(C, but, data);
-	else if(data->state == BUTTON_STATE_TEXT_SELECTING && state != BUTTON_STATE_TEXT_EDITING)
+	else if (data->state == BUTTON_STATE_TEXT_SELECTING && state != BUTTON_STATE_TEXT_EDITING)
 		ui_textedit_end(C, but, data);
 	
 	/* number editing */
-	if(state == BUTTON_STATE_NUM_EDITING) {
-		if(ui_is_a_warp_but(but))
+	if (state == BUTTON_STATE_NUM_EDITING) {
+		if (ui_is_a_warp_but(but))
 			WM_cursor_grab(CTX_wm_window(C), TRUE, TRUE, NULL);
 		ui_numedit_begin(but, data);
-	} else if(data->state == BUTTON_STATE_NUM_EDITING) {
+	}
+	else if (data->state == BUTTON_STATE_NUM_EDITING) {
 		ui_numedit_end(but, data);
-		if(ui_is_a_warp_but(but))
+		if (ui_is_a_warp_but(but))
 			WM_cursor_ungrab(CTX_wm_window(C));
 	}
 	/* menu open */
-	if(state == BUTTON_STATE_MENU_OPEN)
+	if (state == BUTTON_STATE_MENU_OPEN)
 		ui_blockopen_begin(C, but, data);
-	else if(data->state == BUTTON_STATE_MENU_OPEN)
+	else if (data->state == BUTTON_STATE_MENU_OPEN)
 		ui_blockopen_end(C, but, data);
 
 	/* add a short delay before exiting, to ensure there is some feedback */
-	if(state == BUTTON_STATE_WAIT_FLASH) {
-		data->flashtimer= WM_event_add_timer(data->wm, data->window, TIMER, BUTTON_FLASH_DELAY);
+	if (state == BUTTON_STATE_WAIT_FLASH) {
+		data->flashtimer = WM_event_add_timer(data->wm, data->window, TIMER, BUTTON_FLASH_DELAY);
 	}
-	else if(data->flashtimer) {
+	else if (data->flashtimer) {
 		WM_event_remove_timer(data->wm, data->window, data->flashtimer);
-		data->flashtimer= NULL;
+		data->flashtimer = NULL;
 	}
 
 	/* add a blocking ui handler at the window handler for blocking, modal states
 	 * but not for popups, because we already have a window level handler*/
-	if(!(but->block->handle && but->block->handle->popup)) {
-		if(button_modal_state(state)) {
-			if(!button_modal_state(data->state))
+	if (!(but->block->handle && but->block->handle->popup)) {
+		if (button_modal_state(state)) {
+			if (!button_modal_state(data->state))
 				WM_event_add_ui_handler(C, &data->window->modalhandlers, ui_handler_region_menu, NULL, data);
 		}
 		else {
-			if(button_modal_state(data->state))
-				WM_event_remove_ui_handler(&data->window->modalhandlers, ui_handler_region_menu, NULL, data, 1); /* 1 = postpone free */
+			if (button_modal_state(data->state))
+				WM_event_remove_ui_handler(&data->window->modalhandlers, ui_handler_region_menu, NULL, data, 1);  /* 1 = postpone free */
 		}
 	}
 	
 	/* wait for mousemove to enable drag */
-	if(state == BUTTON_STATE_WAIT_DRAG) {
+	if (state == BUTTON_STATE_WAIT_DRAG) {
 		but->flag &= ~UI_SELECT;
 	}
 
-	data->state= state;
+	data->state = state;
 
-	if(state != BUTTON_STATE_EXIT) {
+	if (state != BUTTON_STATE_EXIT) {
 		/* When objects for eg. are removed, running ui_check_but() can access
-		   the removed data - so disable update on exit. Also in case of
-		   highlight when not in a popup menu, we remove because data used in
-		   button below popup might have been removed by action of popup. Needs
-		   a more reliable solution... */
-		if(state != BUTTON_STATE_HIGHLIGHT || (but->block->flag & UI_BLOCK_LOOP))
+		 * the removed data - so disable update on exit. Also in case of
+		 * highlight when not in a popup menu, we remove because data used in
+		 * button below popup might have been removed by action of popup. Needs
+		 * a more reliable solution... */
+		if (state != BUTTON_STATE_HIGHLIGHT || (but->block->flag & UI_BLOCK_LOOP))
 			ui_check_but(but);
 	}
 
@@ -5269,110 +5160,110 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
 	uiHandleButtonData *data;
 
 	/* setup struct */
-	data= MEM_callocN(sizeof(uiHandleButtonData), "uiHandleButtonData");
-	data->wm= CTX_wm_manager(C);
-	data->window= CTX_wm_window(C);
-	data->region= ar;
-	if( ELEM(but->type, BUT_CURVE, SEARCH_MENU) );  // XXX curve is temp
-	else data->interactive= 1;
+	data = MEM_callocN(sizeof(uiHandleButtonData), "uiHandleButtonData");
+	data->wm = CTX_wm_manager(C);
+	data->window = CTX_wm_window(C);
+	data->region = ar;
+	if (ELEM(but->type, BUT_CURVE, SEARCH_MENU) ) ;  // XXX curve is temp
+	else data->interactive = 1;
 	
 	data->state = BUTTON_STATE_INIT;
 
 	/* activate button */
 	but->flag |= UI_ACTIVE;
-	but->active= data;
+	but->active = data;
 
 	/* we disable auto_open in the block after a threshold, because we still
 	 * want to allow auto opening adjacent menus even if no button is activated
 	 * in between going over to the other button, but only for a short while */
-	if(type == BUTTON_ACTIVATE_OVER && but->block->auto_open==TRUE)
-		if(but->block->auto_open_last+BUTTON_AUTO_OPEN_THRESH < PIL_check_seconds_timer())
-			but->block->auto_open= FALSE;
+	if (type == BUTTON_ACTIVATE_OVER && but->block->auto_open == TRUE)
+		if (but->block->auto_open_last + BUTTON_AUTO_OPEN_THRESH < PIL_check_seconds_timer())
+			but->block->auto_open = FALSE;
 
-	if(type == BUTTON_ACTIVATE_OVER) {
-		data->used_mouse= 1;
+	if (type == BUTTON_ACTIVATE_OVER) {
+		data->used_mouse = 1;
 	}
 	button_activate_state(C, but, BUTTON_STATE_HIGHLIGHT);
 	
 	/* activate right away */
-	if(but->flag & UI_BUT_IMMEDIATE) {
-		if(but->type==HOTKEYEVT)
+	if (but->flag & UI_BUT_IMMEDIATE) {
+		if (but->type == HOTKEYEVT)
 			button_activate_state(C, but, BUTTON_STATE_WAIT_KEY_EVENT);
 		/* .. more to be added here */
 	}
 	
-	if(type == BUTTON_ACTIVATE_OPEN) {
+	if (type == BUTTON_ACTIVATE_OPEN) {
 		button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);
 
 		/* activate first button in submenu */
-		if(data->menu && data->menu->region) {
-			ARegion *subar= data->menu->region;
-			uiBlock *subblock= subar->uiblocks.first;
+		if (data->menu && data->menu->region) {
+			ARegion *subar = data->menu->region;
+			uiBlock *subblock = subar->uiblocks.first;
 			uiBut *subbut;
 			
-			if(subblock) {
-				subbut= ui_but_first(subblock);
+			if (subblock) {
+				subbut = ui_but_first(subblock);
 
-				if(subbut)
+				if (subbut)
 					ui_handle_button_activate(C, subar, subbut, BUTTON_ACTIVATE);
 			}
 		}
 	}
-	else if(type == BUTTON_ACTIVATE_TEXT_EDITING)
+	else if (type == BUTTON_ACTIVATE_TEXT_EDITING)
 		button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
-	else if(type == BUTTON_ACTIVATE_APPLY)
+	else if (type == BUTTON_ACTIVATE_APPLY)
 		button_activate_state(C, but, BUTTON_STATE_WAIT_FLASH);
 }
 
 static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *but, int mousemove, int onfree)
 {
-	uiBlock *block= but->block;
+	uiBlock *block = but->block;
 	uiBut *bt;
 
 	/* ensure we are in the exit state */
-	if(data->state != BUTTON_STATE_EXIT)
+	if (data->state != BUTTON_STATE_EXIT)
 		button_activate_state(C, but, BUTTON_STATE_EXIT);
 
 	/* apply the button action or value */
-	if(!onfree)
+	if (!onfree)
 		ui_apply_button(C, block, but, data, 0);
 
 	/* if this button is in a menu, this will set the button return
 	 * value to the button value and the menu return value to ok, the
 	 * menu return value will be picked up and the menu will close */
-	if(block->handle && !(block->flag & UI_BLOCK_KEEP_OPEN)) {
-		if(!data->cancel || data->escapecancel) {
+	if (block->handle && !(block->flag & UI_BLOCK_KEEP_OPEN)) {
+		if (!data->cancel || data->escapecancel) {
 			uiPopupBlockHandle *menu;
 
-			menu= block->handle;
-			menu->butretval= data->retval;
-			menu->menuretval= (data->cancel)? UI_RETURN_CANCEL: UI_RETURN_OK;
+			menu = block->handle;
+			menu->butretval = data->retval;
+			menu->menuretval = (data->cancel) ? UI_RETURN_CANCEL : UI_RETURN_OK;
 		}
 	}
 
-	if(!onfree && !data->cancel) {
+	if (!onfree && !data->cancel) {
 		/* autokey & undo push */
 		ui_apply_autokey_undo(C, but);
 
 		/* popup menu memory */
-		if(block->flag & UI_BLOCK_POPUP_MEMORY)
+		if (block->flag & UI_BLOCK_POPUP_MEMORY)
 			ui_popup_menu_memory(block, but);
 	}
 
 	/* disable tooltips until mousemove + last active flag */
-	for(block=data->region->uiblocks.first; block; block=block->next) {
-		for(bt=block->buttons.first; bt; bt=bt->next)
+	for (block = data->region->uiblocks.first; block; block = block->next) {
+		for (bt = block->buttons.first; bt; bt = bt->next)
 			bt->flag &= ~UI_BUT_LAST_ACTIVE;
 
-		block->tooltipdisabled= 1;
+		block->tooltipdisabled = 1;
 	}
 
 	ui_blocks_set_tooltips(data->region, 0);
 
 	/* clean up */
-	if(data->str)
+	if (data->str)
 		MEM_freeN(data->str);
-	if(data->origstr)
+	if (data->origstr)
 		MEM_freeN(data->origstr);
 
 	/* redraw (data is but->active!) */
@@ -5380,16 +5271,16 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b
 	
 	/* clean up button */
 	MEM_freeN(but->active);
-	but->active= NULL;
-	but->flag &= ~(UI_ACTIVE|UI_SELECT);
+	but->active = NULL;
+	but->flag &= ~(UI_ACTIVE | UI_SELECT);
 	but->flag |= UI_BUT_LAST_ACTIVE;
-	if(!onfree)
+	if (!onfree)
 		ui_check_but(but);
 
 	/* adds empty mousemove in queue for re-init handler, in case mouse is
 	 * still over a button. we cannot just check for this ourselfs because
 	 * at this point the mouse may be over a button in another region */
-	if(mousemove)
+	if (mousemove)
 		WM_event_add_mousemove(C);
 }
 
@@ -5400,41 +5291,41 @@ void ui_button_active_free(const bContext *C, uiBut *but)
 	/* this gets called when the button somehow disappears while it is still
 	 * active, this is bad for user interaction, but we need to handle this
 	 * case cleanly anyway in case it happens */
-	if(but->active) {
-		data= but->active;
-		data->cancel= 1;
-		button_activate_exit((bContext*)C, data, but, 0, 1);
+	if (but->active) {
+		data = but->active;
+		data->cancel = 1;
+		button_activate_exit((bContext *)C, data, but, 0, 1);
 	}
 }
 
 /* returns the active button with an optional checking function */
 static uiBut *ui_context_button_active(const bContext *C, int (*but_check_cb)(uiBut *))
 {
-	uiBut *but_found= NULL;
+	uiBut *but_found = NULL;
 
-	ARegion *ar= CTX_wm_region(C);
+	ARegion *ar = CTX_wm_region(C);
 
-	while(ar) {
+	while (ar) {
 		uiBlock *block;
-		uiBut *but, *activebut= NULL;
+		uiBut *but, *activebut = NULL;
 
 		/* find active button */
-		for(block=ar->uiblocks.first; block; block=block->next) {
-			for(but=block->buttons.first; but; but= but->next) {
-				if(but->active)
-					activebut= but;
-				else if(!activebut && (but->flag & UI_BUT_LAST_ACTIVE))
-					activebut= but;
+		for (block = ar->uiblocks.first; block; block = block->next) {
+			for (but = block->buttons.first; but; but = but->next) {
+				if (but->active)
+					activebut = but;
+				else if (!activebut && (but->flag & UI_BUT_LAST_ACTIVE))
+					activebut = but;
 			}
 		}
 
-		if(activebut && (but_check_cb == NULL || but_check_cb(activebut))) {
-			uiHandleButtonData *data= activebut->active;
+		if (activebut && (but_check_cb == NULL || but_check_cb(activebut))) {
+			uiHandleButtonData *data = activebut->active;
 
-			but_found= activebut;
+			but_found = activebut;
 
 			/* recurse into opened menu, like colorpicker case */
-			if(data && data->menu && (ar != data->menu->region)) {
+			if (data && data->menu && (ar != data->menu->region)) {
 				ar = data->menu->region;
 			}
 			else {
@@ -5467,29 +5358,29 @@ uiBut *uiContextActiveButton(const struct bContext *C)
 /* helper function for insert keyframe, reset to default, etc operators */
 void uiContextActiveProperty(const bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop, int *index)
 {
-	uiBut *activebut= ui_context_rna_button_active(C);
+	uiBut *activebut = ui_context_rna_button_active(C);
 
 	memset(ptr, 0, sizeof(*ptr));
 
-	if(activebut && activebut->rnapoin.data) {
-		*ptr= activebut->rnapoin;
-		*prop= activebut->rnaprop;
-		*index= activebut->rnaindex;
+	if (activebut && activebut->rnapoin.data) {
+		*ptr = activebut->rnapoin;
+		*prop = activebut->rnaprop;
+		*index = activebut->rnaindex;
 	}
 	else {
-		*prop= NULL;
-		*index= 0;
+		*prop = NULL;
+		*index = 0;
 	}
 }
 
 void uiContextActivePropertyHandle(bContext *C)
 {
-	uiBut *activebut= ui_context_rna_button_active(C);
-	if(activebut) {
+	uiBut *activebut = ui_context_rna_button_active(C);
+	if (activebut) {
 		/* TODO, look into a better way to handle the button change
 		 * currently this is mainly so reset defaults works for the
 		 * operator redo panel - campbell */
-		uiBlock *block= activebut->block;
+		uiBlock *block = activebut->block;
 		if (block->handle_func) {
 			block->handle_func(C, block->handle_func_arg, 0);
 		}
@@ -5498,7 +5389,7 @@ void uiContextActivePropertyHandle(bContext *C)
 
 wmOperator *uiContextActiveOperator(const struct bContext *C)
 {
-	ARegion *ar_ctx= CTX_wm_region(C);
+	ARegion *ar_ctx = CTX_wm_region(C);
 	uiBlock *block;
 
 	/* background mode */
@@ -5507,7 +5398,7 @@ wmOperator *uiContextActiveOperator(const struct bContext *C)
 	}
 
 	/* scan active regions ui */
-	for(block=ar_ctx->uiblocks.first; block; block=block->next) {
+	for (block = ar_ctx->uiblocks.first; block; block = block->next) {
 		if (block->ui_operator) {
 			return block->ui_operator;
 		}
@@ -5515,14 +5406,14 @@ wmOperator *uiContextActiveOperator(const struct bContext *C)
 
 	/* scan popups */
 	{
-		bScreen *sc= CTX_wm_screen(C);
+		bScreen *sc = CTX_wm_screen(C);
 		ARegion *ar;
 
-		for (ar= sc->regionbase.first; ar; ar= ar->next) {
+		for (ar = sc->regionbase.first; ar; ar = ar->next) {
 			if (ar == ar_ctx) {
 				continue;
 			}
-			for(block=ar->uiblocks.first; block; block=block->next) {
+			for (block = ar->uiblocks.first; block; block = block->next) {
 				if (block->ui_operator) {
 					return block->ui_operator;
 				}
@@ -5536,31 +5427,31 @@ wmOperator *uiContextActiveOperator(const struct bContext *C)
 /* helper function for insert keyframe, reset to default, etc operators */
 void uiContextAnimUpdate(const bContext *C)
 {
-	Scene *scene= CTX_data_scene(C);
-	ARegion *ar= CTX_wm_region(C);
+	Scene *scene = CTX_data_scene(C);
+	ARegion *ar = CTX_wm_region(C);
 	uiBlock *block;
 	uiBut *but, *activebut;
 
-	while(ar) {
+	while (ar) {
 		/* find active button */
-		activebut= NULL;
+		activebut = NULL;
 
-		for(block=ar->uiblocks.first; block; block=block->next) {
-			for(but=block->buttons.first; but; but= but->next) {
-				ui_but_anim_flag(but, (scene)? scene->r.cfra: 0.0f);
+		for (block = ar->uiblocks.first; block; block = block->next) {
+			for (but = block->buttons.first; but; but = but->next) {
+				ui_but_anim_flag(but, (scene) ? scene->r.cfra : 0.0f);
 				ED_region_tag_redraw(ar);
 				
-				if(but->active)
-					activebut= but;
-				else if(!activebut && (but->flag & UI_BUT_LAST_ACTIVE))
-					activebut= but;
+				if (but->active)
+					activebut = but;
+				else if (!activebut && (but->flag & UI_BUT_LAST_ACTIVE))
+					activebut = but;
 			}
 		}
 
-		if(activebut) {
+		if (activebut) {
 			/* always recurse into opened menu, so all buttons update (like colorpicker) */
-			uiHandleButtonData *data= activebut->active;
-			if(data && data->menu)
+			uiHandleButtonData *data = activebut->active;
+			if (data && data->menu)
 				ar = data->menu->region;
 			else
 				return;
@@ -5579,9 +5470,9 @@ static uiBut *uit_but_find_open_event(ARegion *ar, wmEvent *event)
 	uiBlock *block;
 	uiBut *but;
 	
-	for(block=ar->uiblocks.first; block; block=block->next) {
-		for(but=block->buttons.first; but; but= but->next)
-			if(but==event->customdata)
+	for (block = ar->uiblocks.first; block; block = block->next) {
+		for (but = block->buttons.first; but; but = but->next)
+			if (but == event->customdata)
 				return but;
 	}
 	return NULL;
@@ -5591,14 +5482,14 @@ static int ui_handle_button_over(bContext *C, wmEvent *event, ARegion *ar)
 {
 	uiBut *but;
 
-	if(event->type == MOUSEMOVE) {
-		but= ui_but_find_mouse_over(ar, event->x, event->y);
-		if(but)
+	if (event->type == MOUSEMOVE) {
+		but = ui_but_find_mouse_over(ar, event->x, event->y);
+		if (but)
 			button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER);
 	}
-	else if(event->type == EVT_BUT_OPEN) {
-		but= uit_but_find_open_event(ar, event);
-		if(but) {
+	else if (event->type == EVT_BUT_OPEN) {
+		but = uit_but_find_open_event(ar, event);
+		if (but) {
 			button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER);
 			ui_do_button(C, but->block, but, event);
 		}
@@ -5610,16 +5501,16 @@ static int ui_handle_button_over(bContext *C, wmEvent *event, ARegion *ar)
 /* exported to interface.c: uiButActiveOnly() */
 void ui_button_activate_do(bContext *C, ARegion *ar, uiBut *but)
 {
-	wmWindow *win= CTX_wm_window(C);
+	wmWindow *win = CTX_wm_window(C);
 	wmEvent event;
 	
 	button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER);
 	
-	event= *(win->eventstate);	/* XXX huh huh? make api call */
-	event.type= EVT_BUT_OPEN;
-	event.val= KM_PRESS;
-	event.customdata= but;
-	event.customdatafree= FALSE;
+	event = *(win->eventstate);  /* XXX huh huh? make api call */
+	event.type = EVT_BUT_OPEN;
+	event.val = KM_PRESS;
+	event.customdata = but;
+	event.customdatafree = FALSE;
 	
 	ui_do_button(C, but->block, but, &event);
 }
@@ -5629,10 +5520,10 @@ static void ui_handle_button_activate(bContext *C, ARegion *ar, uiBut *but, uiBu
 	uiBut *oldbut;
 	uiHandleButtonData *data;
 
-	oldbut= ui_but_find_activated(ar);
-	if(oldbut) {
-		data= oldbut->active;
-		data->cancel= 1;
+	oldbut = ui_but_find_activated(ar);
+	if (oldbut) {
+		data = oldbut->active;
+		data->cancel = 1;
 		button_activate_exit(C, data, oldbut, 0, 0);
 	}
 
@@ -5650,31 +5541,31 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
 	uiButtonActivateType posttype;
 	int retval;
 
-	data= but->active;
-	block= but->block;
-	ar= data->region;
+	data = but->active;
+	block = but->block;
+	ar = data->region;
 
-	retval= WM_UI_HANDLER_CONTINUE;
+	retval = WM_UI_HANDLER_CONTINUE;
 	
-	if(data->state == BUTTON_STATE_HIGHLIGHT) {
-		switch(event->type) {
+	if (data->state == BUTTON_STATE_HIGHLIGHT) {
+		switch (event->type) {
 			case WINDEACTIVATE:
 			case EVT_BUT_CANCEL:
-				data->cancel= 1;
+				data->cancel = 1;
 				button_activate_state(C, but, BUTTON_STATE_EXIT);
-				retval= WM_UI_HANDLER_CONTINUE;
+				retval = WM_UI_HANDLER_CONTINUE;
 				break;
 			case MOUSEMOVE:
 				/* verify if we are still over the button, if not exit */
-				if(!ui_mouse_inside_button(ar, but, event->x, event->y)) {
-					data->cancel= 1;
+				if (!ui_mouse_inside_button(ar, but, event->x, event->y)) {
+					data->cancel = 1;
 					button_activate_state(C, but, BUTTON_STATE_EXIT);
 				}
-				else if(ui_but_find_mouse_over(ar, event->x, event->y) != but) {
-					data->cancel= 1;
+				else if (ui_but_find_mouse_over(ar, event->x, event->y) != but) {
+					data->cancel = 1;
 					button_activate_state(C, but, BUTTON_STATE_EXIT);
 				}
-				else if(event->x!=event->prevx || event->y!=event->prevy) {
+				else if (event->x != event->prevx || event->y != event->prevy) {
 					/* re-enable tooltip on mouse move */
 					ui_blocks_set_tooltips(ar, 1);
 					button_tooltip_timer_reset(C, but);
@@ -5683,48 +5574,48 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
 				break;
 			case TIMER: {
 				/* handle tooltip timer */
-				if(event->customdata == data->tooltiptimer) {
+				if (event->customdata == data->tooltiptimer) {
 					WM_event_remove_timer(data->wm, data->window, data->tooltiptimer);
-					data->tooltiptimer= NULL;
+					data->tooltiptimer = NULL;
 
-					if(!data->tooltip)
-						data->tooltip= ui_tooltip_create(C, data->region, but);
+					if (!data->tooltip)
+						data->tooltip = ui_tooltip_create(C, data->region, but);
 				}
 				/* handle menu auto open timer */
-				else if(event->customdata == data->autoopentimer) {
+				else if (event->customdata == data->autoopentimer) {
 					WM_event_remove_timer(data->wm, data->window, data->autoopentimer);
-					data->autoopentimer= NULL;
+					data->autoopentimer = NULL;
 
-					if(ui_mouse_inside_button(ar, but, event->x, event->y))
+					if (ui_mouse_inside_button(ar, but, event->x, event->y))
 						button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);
 				}
 
-				retval= WM_UI_HANDLER_CONTINUE;
+				retval = WM_UI_HANDLER_CONTINUE;
 				break;
-			case WHEELUPMOUSE:
-			case WHEELDOWNMOUSE:
-			case MIDDLEMOUSE:
-				/* XXX hardcoded keymap check... but anyway, while view changes, tooltips should be removed */
-				if(data->tooltiptimer) {
-					WM_event_remove_timer(data->wm, data->window, data->tooltiptimer);
-					data->tooltiptimer= NULL;
-				}
+				case WHEELUPMOUSE:
+				case WHEELDOWNMOUSE:
+				case MIDDLEMOUSE:
+					/* XXX hardcoded keymap check... but anyway, while view changes, tooltips should be removed */
+					if (data->tooltiptimer) {
+						WM_event_remove_timer(data->wm, data->window, data->tooltiptimer);
+						data->tooltiptimer = NULL;
+					}
 				/* pass on purposedly */
-			default:
-				/* handle button type specific events */
-				retval= ui_do_button(C, block, but, event);
+				default:
+					/* handle button type specific events */
+					retval = ui_do_button(C, block, but, event);
 			}
 		}
 	}
-	else if(data->state == BUTTON_STATE_WAIT_RELEASE) {
-		switch(event->type) {
+	else if (data->state == BUTTON_STATE_WAIT_RELEASE) {
+		switch (event->type) {
 			case WINDEACTIVATE:
-				data->cancel= 1;
+				data->cancel = 1;
 				button_activate_state(C, but, BUTTON_STATE_EXIT);
 				break;
 
 			case MOUSEMOVE:
-				if(ELEM(but->type,LINK, INLINK)) {
+				if (ELEM(but->type, LINK, INLINK)) {
 					but->flag |= UI_SELECT;
 					ui_do_button(C, block, but, event);
 					ED_region_tag_redraw(data->region);
@@ -5732,17 +5623,17 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
 				else {
 					/* deselect the button when moving the mouse away */
 					/* also de-activate for buttons that only show higlights */
-					if(ui_mouse_inside_button(ar, but, event->x, event->y)) {
-						if(!(but->flag & UI_SELECT)) {
-							but->flag |= (UI_SELECT|UI_ACTIVE);
-							data->cancel= 0;
+					if (ui_mouse_inside_button(ar, but, event->x, event->y)) {
+						if (!(but->flag & UI_SELECT)) {
+							but->flag |= (UI_SELECT | UI_ACTIVE);
+							data->cancel = 0;
 							ED_region_tag_redraw(data->region);
 						}
 					}
 					else {
-						if(but->flag & UI_SELECT) {
-							but->flag &= ~(UI_SELECT|UI_ACTIVE);
-							data->cancel= 1;
+						if (but->flag & UI_SELECT) {
+							but->flag &= ~(UI_SELECT | UI_ACTIVE);
+							data->cancel = 1;
 							ED_region_tag_redraw(data->region);
 						}
 					}
@@ -5754,55 +5645,55 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
 				break;
 		}
 
-		retval= WM_UI_HANDLER_BREAK;
+		retval = WM_UI_HANDLER_BREAK;
 	}
-	else if(data->state == BUTTON_STATE_WAIT_FLASH) {
-		switch(event->type) {
+	else if (data->state == BUTTON_STATE_WAIT_FLASH) {
+		switch (event->type) {
 			case TIMER: {
-				if(event->customdata == data->flashtimer)
+				if (event->customdata == data->flashtimer)
 					button_activate_state(C, but, BUTTON_STATE_EXIT);
 			}
 		}
 
-		retval= WM_UI_HANDLER_CONTINUE;
+		retval = WM_UI_HANDLER_CONTINUE;
 	}
-	else if(data->state == BUTTON_STATE_MENU_OPEN) {
+	else if (data->state == BUTTON_STATE_MENU_OPEN) {
 		/* check for exit because of mouse-over another button */
-		switch(event->type) {
+		switch (event->type) {
 			case MOUSEMOVE:
 				
-				if(data->menu && data->menu->region)
-					if(ui_mouse_inside_region(data->menu->region, event->x, event->y))
+				if (data->menu && data->menu->region)
+					if (ui_mouse_inside_region(data->menu->region, event->x, event->y))
 						break;
 			
-			{
-				uiBut *bt= ui_but_find_mouse_over(ar, event->x, event->y);
+				{
+					uiBut *bt = ui_but_find_mouse_over(ar, event->x, event->y);
 
-				if(bt && bt->active != data) {
-					if(but->type != COL) /* exception */
-						data->cancel= 1;
-					button_activate_state(C, but, BUTTON_STATE_EXIT);
+					if (bt && bt->active != data) {
+						if (but->type != COL) /* exception */
+							data->cancel = 1;
+						button_activate_state(C, but, BUTTON_STATE_EXIT);
+					}
+					break;
 				}
-				break;
-			}
 		}
 
 		ui_do_button(C, block, but, event);
-		retval= WM_UI_HANDLER_CONTINUE;
+		retval = WM_UI_HANDLER_CONTINUE;
 	}
 	else {
-		retval= ui_do_button(C, block, but, event);
+		retval = ui_do_button(C, block, but, event);
 		// retval= WM_UI_HANDLER_BREAK; XXX why ? 
 	}
 
-	if(data->state == BUTTON_STATE_EXIT) {
-		postbut= data->postbut;
-		posttype= data->posttype;
+	if (data->state == BUTTON_STATE_EXIT) {
+		postbut = data->postbut;
+		posttype = data->posttype;
 
 		button_activate_exit(C, data, but, (postbut == NULL), 0);
 
 		/* for jumping to the next button with tab while text editing */
-		if(postbut)
+		if (postbut)
 			button_activate_init(C, ar, postbut, posttype);
 	}
 
@@ -5811,64 +5702,64 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
 
 static int ui_handle_list_event(bContext *C, wmEvent *event, ARegion *ar)
 {
-	uiBut *but= ui_list_find_mouse_over(ar, event->x, event->y);
-	int retval= WM_UI_HANDLER_CONTINUE;
+	uiBut *but = ui_list_find_mouse_over(ar, event->x, event->y);
+	int retval = WM_UI_HANDLER_CONTINUE;
 	int value, min, max;
 
-	if(but && (event->val == KM_PRESS)) {
-		Panel *pa= but->block->panel;
+	if (but && (event->val == KM_PRESS)) {
+		Panel *pa = but->block->panel;
 
-		if(ELEM(event->type, UPARROWKEY, DOWNARROWKEY) ||
-		   ((ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE) && event->alt))) {
+		if (ELEM(event->type, UPARROWKEY, DOWNARROWKEY) ||
+		    ((ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE) && event->alt))) {
 			/* activate up/down the list */
-			value= RNA_property_int_get(&but->rnapoin, but->rnaprop);
+			value = RNA_property_int_get(&but->rnapoin, but->rnaprop);
 
-			if(ELEM(event->type, UPARROWKEY, WHEELUPMOUSE))
+			if (ELEM(event->type, UPARROWKEY, WHEELUPMOUSE))
 				value--;
 			else
 				value++;
 
-			if(value < pa->list_scroll)
-				pa->list_scroll= value;
-			else if(value >= pa->list_scroll+pa->list_size)
-				pa->list_scroll= value - pa->list_size + 1;
+			if (value < pa->list_scroll)
+				pa->list_scroll = value;
+			else if (value >= pa->list_scroll + pa->list_size)
+				pa->list_scroll = value - pa->list_size + 1;
 
 			RNA_property_int_range(&but->rnapoin, but->rnaprop, &min, &max);
-			value= CLAMPIS(value, min, max);
+			value = CLAMPIS(value, min, max);
 
 			RNA_property_int_set(&but->rnapoin, but->rnaprop, value);
 			RNA_property_update(C, &but->rnapoin, but->rnaprop);
 			ED_region_tag_redraw(ar);
 
-			retval= WM_UI_HANDLER_BREAK;
+			retval = WM_UI_HANDLER_BREAK;
 		}
-		else if(ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE) && event->shift) {
+		else if (ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE) && event->shift) {
 			/* silly replacement for proper grip */
-			if(pa->list_grip_size == 0)
-				pa->list_grip_size= pa->list_size;
+			if (pa->list_grip_size == 0)
+				pa->list_grip_size = pa->list_size;
 
-			if(event->type == WHEELUPMOUSE)
+			if (event->type == WHEELUPMOUSE)
 				pa->list_grip_size--;
 			else
 				pa->list_grip_size++;
 
-			pa->list_grip_size= MAX2(pa->list_grip_size, 1);
+			pa->list_grip_size = MAX2(pa->list_grip_size, 1);
 
 			ED_region_tag_redraw(ar);
 
-			retval= WM_UI_HANDLER_BREAK;
+			retval = WM_UI_HANDLER_BREAK;
 		}
-		else if(ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE)) {
-			if(pa->list_last_len > pa->list_size) {
+		else if (ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE)) {
+			if (pa->list_last_len > pa->list_size) {
 				/* list template will clamp */
-				if(event->type == WHEELUPMOUSE)
+				if (event->type == WHEELUPMOUSE)
 					pa->list_scroll--;
 				else
 					pa->list_scroll++;
 
 				ED_region_tag_redraw(ar);
 
-				retval= WM_UI_HANDLER_BREAK;
+				retval = WM_UI_HANDLER_BREAK;
 			}
 		}
 	}
@@ -5881,43 +5772,43 @@ static void ui_handle_button_return_submenu(bContext *C, wmEvent *event, uiBut *
 	uiHandleButtonData *data;
 	uiPopupBlockHandle *menu;
 
-	data= but->active;
-	menu= data->menu;
+	data = but->active;
+	menu = data->menu;
 
 	/* copy over return values from the closing menu */
-	if((menu->menuretval & UI_RETURN_OK) || (menu->menuretval & UI_RETURN_UPDATE)) {
-		if(but->type == COL)
+	if ((menu->menuretval & UI_RETURN_OK) || (menu->menuretval & UI_RETURN_UPDATE)) {
+		if (but->type == COL)
 			copy_v3_v3(data->vec, menu->retvec);
-		else if(ELEM3(but->type, MENU, ICONROW, ICONTEXTROW))
-			data->value= menu->retvalue;
+		else if (ELEM3(but->type, MENU, ICONROW, ICONTEXTROW))
+			data->value = menu->retvalue;
 	}
 
-	if(menu->menuretval & UI_RETURN_UPDATE) {
-		if(data->interactive) ui_apply_button(C, but->block, but, data, 1);
+	if (menu->menuretval & UI_RETURN_UPDATE) {
+		if (data->interactive) ui_apply_button(C, but->block, but, data, 1);
 		else ui_check_but(but);
 
-		menu->menuretval= 0;
+		menu->menuretval = 0;
 	}
 	
 	/* now change button state or exit, which will close the submenu */
-	if((menu->menuretval & UI_RETURN_OK) || (menu->menuretval & UI_RETURN_CANCEL)) {
-		if(menu->menuretval != UI_RETURN_OK)
-			data->cancel= 1;
+	if ((menu->menuretval & UI_RETURN_OK) || (menu->menuretval & UI_RETURN_CANCEL)) {
+		if (menu->menuretval != UI_RETURN_OK)
+			data->cancel = 1;
 
 		button_activate_exit(C, data, but, 1, 0);
 	}
-	else if(menu->menuretval & UI_RETURN_OUT) {
-		if(event->type==MOUSEMOVE && ui_mouse_inside_button(data->region, but, event->x, event->y)) {
+	else if (menu->menuretval & UI_RETURN_OUT) {
+		if (event->type == MOUSEMOVE && ui_mouse_inside_button(data->region, but, event->x, event->y)) {
 			button_activate_state(C, but, BUTTON_STATE_HIGHLIGHT);
 		}
 		else {
 			if (ISKEYBOARD(event->type)) {
 				/* keyboard menu hierarchy navigation, going back to previous level */
-				but->active->used_mouse= 0;
+				but->active->used_mouse = 0;
 				button_activate_state(C, but, BUTTON_STATE_HIGHLIGHT);
 			}
 			else {
-				data->cancel= 1;
+				data->cancel = 1;
 				button_activate_exit(C, data, but, 1, 0);
 			}
 		}
@@ -5937,15 +5828,15 @@ static void ui_handle_button_return_submenu(bContext *C, wmEvent *event, uiBut *
 
 static void ui_mouse_motion_towards_init(uiPopupBlockHandle *menu, int mx, int my, int force)
 {
-	if(!menu->dotowards || force) {
-		menu->dotowards= 1;
-		menu->towardsx= mx;
-		menu->towardsy= my;
+	if (!menu->dotowards || force) {
+		menu->dotowards = 1;
+		menu->towardsx = mx;
+		menu->towardsy = my;
 
-		if(force)
-			menu->towardstime= DBL_MAX; /* unlimited time */
+		if (force)
+			menu->towardstime = DBL_MAX;  /* unlimited time */
 		else
-			menu->towardstime= PIL_check_seconds_timer();
+			menu->towardstime = PIL_check_seconds_timer();
 	}
 }
 
@@ -5954,56 +5845,56 @@ static int ui_mouse_motion_towards_check(uiBlock *block, uiPopupBlockHandle *men
 	float p1[2], p2[2], p3[2], p4[2], oldp[2], newp[2];
 	int closer;
 
-	if(!menu->dotowards) return 0;
+	if (!menu->dotowards) return 0;
 
 	/* verify that we are moving towards one of the edges of the
 	 * menu block, in other words, in the triangle formed by the
 	 * initial mouse location and two edge points. */
-	p1[0]= block->minx-20;
-	p1[1]= block->miny-20;
+	p1[0] = block->minx - 20;
+	p1[1] = block->miny - 20;
 
-	p2[0]= block->maxx+20;
-	p2[1]= block->miny-20;
+	p2[0] = block->maxx + 20;
+	p2[1] = block->miny - 20;
 	
-	p3[0]= block->maxx+20;
-	p3[1]= block->maxy+20;
+	p3[0] = block->maxx + 20;
+	p3[1] = block->maxy + 20;
 
-	p4[0]= block->minx-20;
-	p4[1]= block->maxy+20;
+	p4[0] = block->minx - 20;
+	p4[1] = block->maxy + 20;
 
-	oldp[0]= menu->towardsx;
-	oldp[1]= menu->towardsy;
+	oldp[0] = menu->towardsx;
+	oldp[1] = menu->towardsy;
 
-	newp[0]= mx;
-	newp[1]= my;
+	newp[0] = mx;
+	newp[1] = my;
 
-	if(len_v2v2(oldp, newp) < 4.0f)
+	if (len_v2v2(oldp, newp) < 4.0f)
 		return menu->dotowards;
 
-	closer= 0;
+	closer = 0;
 	closer |= isect_point_tri_v2(newp, oldp, p1, p2);
 	closer |= isect_point_tri_v2(newp, oldp, p2, p3);
 	closer |= isect_point_tri_v2(newp, oldp, p3, p4);
 	closer |= isect_point_tri_v2(newp, oldp, p4, p1);
 
-	if(!closer)
-		menu->dotowards= 0;
+	if (!closer)
+		menu->dotowards = 0;
 
 	/* 1 second timer */
-	if(PIL_check_seconds_timer() - menu->towardstime > BUTTON_MOUSE_TOWARDS_THRESH)
-		menu->dotowards= 0;
+	if (PIL_check_seconds_timer() - menu->towardstime > BUTTON_MOUSE_TOWARDS_THRESH)
+		menu->dotowards = 0;
 
 	return menu->dotowards;
 }
 
 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->maxy-14)
+	if (block->flag & (UI_BLOCK_CLIPTOP | UI_BLOCK_CLIPBOTTOM)) {
+		if (block->flag & UI_BLOCK_CLIPTOP) 
+			if (my > block->maxy - 14)
 				return 't';
-		if(block->flag & UI_BLOCK_CLIPBOTTOM)
-			if(my < block->miny+14)
+		if (block->flag & UI_BLOCK_CLIPBOTTOM)
+			if (my < block->miny + 14)
 				return 'b';
 	}
 	return 0;
@@ -6011,46 +5902,46 @@ static char ui_menu_scroll_test(uiBlock *block, int my)
 
 static int ui_menu_scroll(ARegion *ar, uiBlock *block, int my)
 {
-	char test= ui_menu_scroll_test(block, my);
+	char test = ui_menu_scroll_test(block, my);
 	
-	if(test) {
-		uiBut *b1= block->buttons.first;
-		uiBut *b2= block->buttons.last;
+	if (test) {
+		uiBut *b1 = block->buttons.first;
+		uiBut *b2 = block->buttons.last;
 		uiBut *bnext;
 		uiBut *bprev;
-		int dy= 0;
+		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);
+		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);
+		bnext = ui_but_next(b1);
+		bprev = ui_but_prev(b2);
 		
-		if(bnext==NULL || bprev==NULL)
+		if (bnext == NULL || bprev == NULL)
 			return 0;
 		
-		if(test=='t') {
+		if (test == 't') {
 			/* bottom button is first button */
-			if(b1->y1 < b2->y1)
-				dy= bnext->y1 - b1->y1;
+			if (b1->y1 < b2->y1)
+				dy = bnext->y1 - b1->y1;
 			/* bottom button is last button */
 			else 
-				dy= bprev->y1 - b2->y1;
+				dy = bprev->y1 - b2->y1;
 		}
-		else if(test=='b') {
+		else if (test == 'b') {
 			/* bottom button is first button */
-			if(b1->y1 < b2->y1)
-				dy= b1->y1 - bnext->y1;
+			if (b1->y1 < b2->y1)
+				dy = b1->y1 - bnext->y1;
 			/* bottom button is last button */
 			else 
-				dy= b2->y1 - bprev->y1;
+				dy = b2->y1 - bprev->y1;
 		}
-		if(dy) {
+		if (dy) {
 			
-			for(b1= block->buttons.first; b1; b1= b1->next) {
+			for (b1 = block->buttons.first; b1; b1 = b1->next) {
 				b1->y1 -= dy;
 				b1->y2 -= dy;
 			}
@@ -6073,76 +5964,76 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
 	uiBut *but, *bt;
 	int inside, act, count, mx, my, retval;
 
-	ar= menu->region;
-	block= ar->uiblocks.first;
+	ar = menu->region;
+	block = ar->uiblocks.first;
 	
-	act= 0;
-	retval= WM_UI_HANDLER_CONTINUE;
+	act = 0;
+	retval = WM_UI_HANDLER_CONTINUE;
 
-	mx= event->x;
-	my= event->y;
+	mx = event->x;
+	my = event->y;
 	ui_window_to_block(ar, block, &mx, &my);
 
 	/* check if mouse is inside block */
-	inside= 0;
-	if(block->minx <= mx && block->maxx >= mx)
-		if(block->miny <= my && block->maxy >= my)
-			inside= 1;
+	inside = 0;
+	if (block->minx <= mx && block->maxx >= mx)
+		if (block->miny <= my && block->maxy >= my)
+			inside = 1;
 
 	/* if there's an active modal button, don't check events or outside, except for search menu */
-	but= ui_but_find_activated(ar);
-	if(but && button_modal_state(but->active->state) && but->type!=SEARCH_MENU) {
+	but = ui_but_find_activated(ar);
+	if (but && button_modal_state(but->active->state) && but->type != SEARCH_MENU) {
 		/* if a button is activated modal, always reset the start mouse
 		 * position of the towards mechanism to avoid loosing focus,
 		 * and don't handle events */
 		ui_mouse_motion_towards_init(menu, mx, my, 1);
 	}
-	else if(event->type == TIMER) {
-		if(event->customdata == menu->scrolltimer)
+	else if (event->type == TIMER) {
+		if (event->customdata == menu->scrolltimer)
 			ui_menu_scroll(ar, block, my);
 	}
 	else {
 		/* for ui_mouse_motion_towards_block */
-		if(event->type == MOUSEMOVE) {
+		if (event->type == MOUSEMOVE) {
 			ui_mouse_motion_towards_init(menu, mx, my, 0);
 			
 			/* add menu scroll timer, if needed */
-			if(ui_menu_scroll_test(block, my))
-				if(menu->scrolltimer==NULL)
-					menu->scrolltimer= 
-					WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, MENU_SCROLL_INTERVAL);
+			if (ui_menu_scroll_test(block, my))
+				if (menu->scrolltimer == NULL)
+					menu->scrolltimer =
+					    WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, MENU_SCROLL_INTERVAL);
 		}
 		
 		/* first block own event func */
-		if(block->block_event_func && block->block_event_func(C, block, event));
+		if (block->block_event_func && block->block_event_func(C, block, event)) ;
 		/* events not for active search menu button */
-		else if(but==NULL || but->type!=SEARCH_MENU) {
-			switch(event->type) {
+		else if (but == NULL || but->type != SEARCH_MENU) {
+			switch (event->type) {
 				/* closing sublevels of pulldowns */
 				case LEFTARROWKEY:
-					if(event->val==KM_PRESS && (block->flag & UI_BLOCK_LOOP))
-						if(block->saferct.first)
-							menu->menuretval= UI_RETURN_OUT;
+					if (event->val == KM_PRESS && (block->flag & UI_BLOCK_LOOP))
+						if (block->saferct.first)
+							menu->menuretval = UI_RETURN_OUT;
 
-					retval= WM_UI_HANDLER_BREAK;
+					retval = WM_UI_HANDLER_BREAK;
 					break;
 
 				/* opening sublevels of pulldowns */
 				case RIGHTARROWKEY:	
-					if(event->val==KM_PRESS && (block->flag & UI_BLOCK_LOOP)) {
-						but= ui_but_find_activated(ar);
+					if (event->val == KM_PRESS && (block->flag & UI_BLOCK_LOOP)) {
+						but = ui_but_find_activated(ar);
 
-						if(!but) {
+						if (!but) {
 							/* no item active, we make first active */
-							if(block->direction & UI_TOP) but= ui_but_last(block);
-							else but= ui_but_first(block);
+							if (block->direction & UI_TOP) but = ui_but_last(block);
+							else but = ui_but_first(block);
 						}
 
-						if(but && ELEM(but->type, BLOCK, PULLDOWN))
+						if (but && ELEM(but->type, BLOCK, PULLDOWN))
 							ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_OPEN);
 					}
 
-					retval= WM_UI_HANDLER_BREAK;
+					retval = WM_UI_HANDLER_BREAK;
 					break;
 				
 				case UPARROWKEY:
@@ -6150,118 +6041,118 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
 				case WHEELUPMOUSE:
 				case WHEELDOWNMOUSE:
 					/* arrowkeys: only handle for block_loop blocks */
-					if(event->alt || event->shift || event->ctrl || event->oskey);
-					else if(inside || (block->flag & UI_BLOCK_LOOP)) {
-						if(event->val==KM_PRESS) {
-							but= ui_but_find_activated(ar);
-							if(but) {
+					if (event->alt || event->shift || event->ctrl || event->oskey) ;
+					else if (inside || (block->flag & UI_BLOCK_LOOP)) {
+						if (event->val == KM_PRESS) {
+							but = ui_but_find_activated(ar);
+							if (but) {
 								/* is there a situation where UI_LEFT or UI_RIGHT would also change navigation direction? */
-								if(	((ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_DOWN)) ||
-									((ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_RIGHT)) ||
-									((ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_TOP))
-								) {
+								if (((ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_DOWN)) ||
+								    ((ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_RIGHT)) ||
+								    ((ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_TOP)))
+								{
 									/* the following is just a hack - uiBut->type set to BUT and BUTM have there menus built 
 									 * opposite ways - this should be changed so that all popup-menus use the same uiBlock->direction */
-									if(but->type & BUT)
-										but= ui_but_next(but);
+									if (but->type & BUT)
+										but = ui_but_next(but);
 									else
-										but= ui_but_prev(but);
+										but = ui_but_prev(but);
 								}
 								else {
-									if(but->type & BUT)
-										but= ui_but_prev(but);
+									if (but->type & BUT)
+										but = ui_but_prev(but);
 									else
-										but= ui_but_next(but);
+										but = ui_but_next(but);
 								}
 
-								if(but)
+								if (but)
 									ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE);
 							}
 
-							if(!but) {
-								if(	((ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_DOWN)) ||
-									((ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_RIGHT)) ||
-									((ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_TOP))
-								) {
-									if((bt= ui_but_first(block)) && (bt->type & BUT)) {
-										bt= ui_but_last(block);
+							if (!but) {
+								if (((ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_DOWN)) ||
+								    ((ELEM(event->type, UPARROWKEY, WHEELUPMOUSE)) && (block->direction & UI_RIGHT)) ||
+								    ((ELEM(event->type, DOWNARROWKEY, WHEELDOWNMOUSE)) && (block->direction & UI_TOP)))
+								{
+									if ((bt = ui_but_first(block)) && (bt->type & BUT)) {
+										bt = ui_but_last(block);
 									}
 									else {
 										/* keep ui_but_first() */
 									}
 								}
 								else {
-									if((bt= ui_but_first(block)) && (bt->type & BUT)) {
+									if ((bt = ui_but_first(block)) && (bt->type & BUT)) {
 										/* keep ui_but_first() */
 									}
 									else {
-										bt= ui_but_last(block);
+										bt = ui_but_last(block);
 									}
 								}
 
-								if(bt)
+								if (bt)
 									ui_handle_button_activate(C, ar, bt, BUTTON_ACTIVATE);
 							}
 						}
 
-						retval= WM_UI_HANDLER_BREAK;
+						retval = WM_UI_HANDLER_BREAK;
 					}
 
 					break;
 
-				case ONEKEY:	case PAD1:
-					act= 1;
-				case TWOKEY:	case PAD2:
-					if(act==0) act= 2;
-				case THREEKEY:	case PAD3:
-					if(act==0) act= 3;
-				case FOURKEY:	case PAD4:
-					if(act==0) act= 4;
-				case FIVEKEY:	case PAD5:
-					if(act==0) act= 5;
-				case SIXKEY:	case PAD6:
-					if(act==0) act= 6;
-				case SEVENKEY:	case PAD7:
-					if(act==0) act= 7;
-				case EIGHTKEY:	case PAD8:
-					if(act==0) act= 8;
-				case NINEKEY:	case PAD9:
-					if(act==0) act= 9;
-				case ZEROKEY:	case PAD0:
-					if(act==0) act= 10;
-				
-					if((block->flag & UI_BLOCK_NUMSELECT) && event->val==KM_PRESS) {
-						if(event->alt) act+= 10;
-						
-						count= 0;
-						for(but= block->buttons.first; but; but= but->next) {
-							int doit= 0;
+				case ONEKEY:    case PAD1:
+					act = 1;
+				case TWOKEY:    case PAD2:
+					if (act == 0) act = 2;
+				case THREEKEY:  case PAD3:
+					if (act == 0) act = 3;
+				case FOURKEY:   case PAD4:
+					if (act == 0) act = 4;
+				case FIVEKEY:   case PAD5:
+					if (act == 0) act = 5;
+				case SIXKEY:    case PAD6:
+					if (act == 0) act = 6;
+				case SEVENKEY:  case PAD7:
+					if (act == 0) act = 7;
+				case EIGHTKEY:  case PAD8:
+					if (act == 0) act = 8;
+				case NINEKEY:   case PAD9:
+					if (act == 0) act = 9;
+				case ZEROKEY:   case PAD0:
+					if (act == 0) act = 10;
+
+					if ((block->flag & UI_BLOCK_NUMSELECT) && event->val == KM_PRESS) {
+						if (event->alt) act += 10;
+
+						count = 0;
+						for (but = block->buttons.first; but; but = but->next) {
+							int doit = 0;
 							
-							if(but->type!=LABEL && but->type!=SEPR)
+							if (but->type != LABEL && but->type != SEPR)
 								count++;
 							
 							/* exception for rna layer buts */
-							if(but->rnapoin.data && but->rnaprop) {
+							if (but->rnapoin.data && but->rnaprop) {
 								if (ELEM(RNA_property_subtype(but->rnaprop), PROP_LAYER, PROP_LAYER_MEMBER)) {
-									if (but->rnaindex== act-1)
-										doit=1;
+									if (but->rnaindex == act - 1)
+										doit = 1;
 								}
 							}
 							/* exception for menus like layer buts, with button aligning they're not drawn in order */
-							else if(but->type==TOGR) {
-								if(but->bitnr==act-1)
-									doit= 1;
+							else if (but->type == TOGR) {
+								if (but->bitnr == act - 1)
+									doit = 1;
 							}
-							else if(count==act)
-								doit=1;
+							else if (count == act)
+								doit = 1;
 							
-							if(doit) {
+							if (doit) {
 								ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_APPLY);
 								break;
 							}
 						}
 
-						retval= WM_UI_HANDLER_BREAK;
+						retval = WM_UI_HANDLER_BREAK;
 					}
 					break;
 
@@ -6293,19 +6184,19 @@ 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->shift == FALSE) &&
 					    (event->ctrl ==  FALSE) &&
-					    (event->oskey == FALSE)
-					) {
-						for(but= block->buttons.first; but; but= but->next) {
+					    (event->oskey == FALSE))
+					{
+						for (but = block->buttons.first; but; but = but->next) {
 
-							if(but->menu_key==event->type) {
-								if(but->type == BUT) {
+							if (but->menu_key == event->type) {
+								if (but->type == BUT) {
 									/* mainly for operator buttons */
 									ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_APPLY);
 								}
-								else if(ELEM(but->type, BLOCK, PULLDOWN)) {
+								else if (ELEM(but->type, BLOCK, PULLDOWN)) {
 									/* open submenus (like right arrow key) */
 									ui_handle_button_activate(C, ar, but, BUTTON_ACTIVATE_OPEN);
 								}
@@ -6321,7 +6212,7 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
 							}
 						}
 
-						retval= WM_UI_HANDLER_BREAK;
+						retval = WM_UI_HANDLER_BREAK;
 					}
 					break;
 				}
@@ -6329,62 +6220,62 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
 		}
 		
 		/* here we check return conditions for menus */
-		if(block->flag & UI_BLOCK_LOOP) {
+		if (block->flag & UI_BLOCK_LOOP) {
 			/* if we click outside the block, verify if we clicked on the
 			 * button that opened us, otherwise we need to close */
-			if(inside==0) {
-				uiSafetyRct *saferct= block->saferct.first;
+			if (inside == 0) {
+				uiSafetyRct *saferct = block->saferct.first;
 
-				if(ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE) && event->val==KM_PRESS) {
-					if(saferct && !BLI_in_rctf(&saferct->parent, event->x, event->y)) {
-						if(block->flag & (UI_BLOCK_OUT_1))
-							menu->menuretval= UI_RETURN_OK;
+				if (ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE) && event->val == KM_PRESS) {
+					if (saferct && !BLI_in_rctf(&saferct->parent, event->x, event->y)) {
+						if (block->flag & (UI_BLOCK_OUT_1))
+							menu->menuretval = UI_RETURN_OK;
 						else
-							menu->menuretval= UI_RETURN_OUT;
+							menu->menuretval = UI_RETURN_OUT;
 					}
 				}
 			}
 
-			if(menu->menuretval);
-			else if(event->type==ESCKEY && event->val==KM_PRESS) {
+			if (menu->menuretval) ;
+			else if (event->type == ESCKEY && event->val == KM_PRESS) {
 				/* esc cancels this and all preceding menus */
-				menu->menuretval= UI_RETURN_CANCEL;
+				menu->menuretval = UI_RETURN_CANCEL;
 			}
-			else if(ELEM(event->type, RETKEY, PADENTER) && event->val==KM_PRESS) {
+			else if (ELEM(event->type, RETKEY, PADENTER) && event->val == KM_PRESS) {
 				/* enter will always close this block, we let the event
 				 * get handled by the button if it is activated, otherwise we cancel */
-				if(!ui_but_find_activated(ar))
-					menu->menuretval= UI_RETURN_CANCEL | UI_RETURN_POPUP_OK;
+				if (!ui_but_find_activated(ar))
+					menu->menuretval = UI_RETURN_CANCEL | UI_RETURN_POPUP_OK;
 			}
 			else {
 				ui_mouse_motion_towards_check(block, menu, mx, my);
 
 				/* check mouse moving outside of the menu */
-				if(inside==0 && (block->flag & UI_BLOCK_MOVEMOUSE_QUIT)) {
+				if (inside == 0 && (block->flag & UI_BLOCK_MOVEMOUSE_QUIT)) {
 					uiSafetyRct *saferct;
 					
 					/* check for all parent rects, enables arrowkeys to be used */
-					for(saferct=block->saferct.first; saferct; saferct= saferct->next) {
+					for (saferct = block->saferct.first; saferct; saferct = saferct->next) {
 						/* for mouse move we only check our own rect, for other
 						 * events we check all preceding block rects too to make
 						 * arrow keys navigation work */
-						if(event->type!=MOUSEMOVE || saferct==block->saferct.first) {
-							if(BLI_in_rctf(&saferct->parent, (float)event->x, (float)event->y))
+						if (event->type != MOUSEMOVE || saferct == block->saferct.first) {
+							if (BLI_in_rctf(&saferct->parent, (float)event->x, (float)event->y))
 								break;
-							if(BLI_in_rctf(&saferct->safety, (float)event->x, (float)event->y))
+							if (BLI_in_rctf(&saferct->safety, (float)event->x, (float)event->y))
 								break;
 						}
 					}
 
 					/* strict check, and include the parent rect */
-					if(!menu->dotowards && !saferct) {
-						if(block->flag & (UI_BLOCK_OUT_1))
-							menu->menuretval= UI_RETURN_OK;
+					if (!menu->dotowards && !saferct) {
+						if (block->flag & (UI_BLOCK_OUT_1))
+							menu->menuretval = UI_RETURN_OK;
 						else
-							menu->menuretval= UI_RETURN_OUT;
+							menu->menuretval = UI_RETURN_OUT;
 					}
-					else if(menu->dotowards && event->type==MOUSEMOVE)
-						retval= WM_UI_HANDLER_BREAK;
+					else if (menu->dotowards && event->type == MOUSEMOVE)
+						retval = WM_UI_HANDLER_BREAK;
 				}
 			}
 		}
@@ -6394,31 +6285,31 @@ static int ui_handle_menu_event(bContext *C, wmEvent *event, uiPopupBlockHandle
 	 * buttons inside this region. disabled inside check .. not sure
 	 * anymore why it was there? but it meant enter didn't work
 	 * for example when mouse was not over submenu */
-	if((/*inside &&*/ (!menu->menuretval || (menu->menuretval & UI_RETURN_UPDATE)) && retval == WM_UI_HANDLER_CONTINUE) || event->type == TIMER) {
-		but= ui_but_find_activated(ar);
+	if ((/*inside &&*/ (!menu->menuretval || (menu->menuretval & UI_RETURN_UPDATE)) && retval == WM_UI_HANDLER_CONTINUE) || event->type == TIMER) {
+		but = ui_but_find_activated(ar);
 
-		if(but) {
-			ScrArea *ctx_area= CTX_wm_area(C);
-			ARegion *ctx_region= CTX_wm_region(C);
+		if (but) {
+			ScrArea *ctx_area = CTX_wm_area(C);
+			ARegion *ctx_region = CTX_wm_region(C);
 			
-			if(menu->ctx_area) CTX_wm_area_set(C, menu->ctx_area);
-			if(menu->ctx_region) CTX_wm_region_set(C, menu->ctx_region);
+			if (menu->ctx_area) CTX_wm_area_set(C, menu->ctx_area);
+			if (menu->ctx_region) CTX_wm_region_set(C, menu->ctx_region);
 			
-			retval= ui_handle_button_event(C, event, but);
+			retval = ui_handle_button_event(C, event, but);
 			
-			if(menu->ctx_area) CTX_wm_area_set(C, ctx_area);
-			if(menu->ctx_region) CTX_wm_region_set(C, ctx_region);
+			if (menu->ctx_area) CTX_wm_area_set(C, ctx_area);
+			if (menu->ctx_region) CTX_wm_region_set(C, ctx_region);
 		}
 		else
-			retval= ui_handle_button_over(C, event, ar);
+			retval = ui_handle_button_over(C, event, ar);
 	}
 
 	/* if we set a menu return value, ensure we continue passing this on to
 	 * lower menus and buttons, so always set continue then, and if we are
 	 * inside the region otherwise, ensure we swallow the event */
-	if(menu->menuretval)
+	if (menu->menuretval)
 		return WM_UI_HANDLER_CONTINUE;
-	else if(inside)
+	else if (inside)
 		return WM_UI_HANDLER_BREAK;
 	else
 		return retval;
@@ -6433,41 +6324,41 @@ static int ui_handle_menu_return_submenu(bContext *C, wmEvent *event, uiPopupBlo
 	uiPopupBlockHandle *submenu;
 	int mx, my, update;
 
-	ar= menu->region;
-	block= ar->uiblocks.first;
+	ar = menu->region;
+	block = ar->uiblocks.first;
 
-	but= ui_but_find_activated(ar);
-	data= but->active;
-	submenu= data->menu;
+	but = ui_but_find_activated(ar);
+	data = but->active;
+	submenu = data->menu;
 
-	if(submenu->menuretval) {
+	if (submenu->menuretval) {
 		/* first decide if we want to close our own menu cascading, if
 		 * so pass on the sub menu return value to our own menu handle */
-		if((submenu->menuretval & UI_RETURN_OK) || (submenu->menuretval & UI_RETURN_CANCEL)) {
-			if(!(block->flag & UI_BLOCK_KEEP_OPEN)) {
-				menu->menuretval= submenu->menuretval;
-				menu->butretval= data->retval;
+		if ((submenu->menuretval & UI_RETURN_OK) || (submenu->menuretval & UI_RETURN_CANCEL)) {
+			if (!(block->flag & UI_BLOCK_KEEP_OPEN)) {
+				menu->menuretval = submenu->menuretval;
+				menu->butretval = data->retval;
 			}
 		}
 
-		update= (submenu->menuretval & UI_RETURN_UPDATE);
+		update = (submenu->menuretval & UI_RETURN_UPDATE);
 
 		/* now let activated button in this menu exit, which
 		 * will actually close the submenu too */
 		ui_handle_button_return_submenu(C, event, but);
 
-		if(update)
+		if (update)
 			submenu->menuretval = 0;
 	}
 
 	/* for cases where close does not cascade, allow the user to
 	 * move the mouse back towards the menu without closing */
-	mx= event->x;
-	my= event->y;
+	mx = event->x;
+	my = event->y;
 	ui_window_to_block(ar, block, &mx, &my);
 	ui_mouse_motion_towards_init(menu, mx, my, 1);
 
-	if(menu->menuretval)
+	if (menu->menuretval)
 		return WM_UI_HANDLER_CONTINUE;
 	else
 		return WM_UI_HANDLER_BREAK;
@@ -6478,22 +6369,22 @@ static int ui_handle_menus_recursive(bContext *C, wmEvent *event, uiPopupBlockHa
 	uiBut *but;
 	uiHandleButtonData *data;
 	uiPopupBlockHandle *submenu;
-	int retval= WM_UI_HANDLER_CONTINUE;
+	int retval = WM_UI_HANDLER_CONTINUE;
 
 	/* check if we have a submenu, and handle events for it first */
-	but= ui_but_find_activated(menu->region);
-	data= (but)? but->active: NULL;
-	submenu= (data)? data->menu: NULL;
+	but = ui_but_find_activated(menu->region);
+	data = (but) ? but->active : NULL;
+	submenu = (data) ? data->menu : NULL;
 
-	if(submenu)
-		retval= ui_handle_menus_recursive(C, event, submenu);
+	if (submenu)
+		retval = ui_handle_menus_recursive(C, event, submenu);
 
 	/* now handle events for our own menu */
-	if(retval == WM_UI_HANDLER_CONTINUE || event->type == TIMER) {
-		if(submenu && submenu->menuretval)
-			retval= ui_handle_menu_return_submenu(C, event, menu);
+	if (retval == WM_UI_HANDLER_CONTINUE || event->type == TIMER) {
+		if (submenu && submenu->menuretval)
+			retval = ui_handle_menu_return_submenu(C, event, menu);
 		else
-			retval= ui_handle_menu_event(C, event, menu, (submenu == NULL));
+			retval = ui_handle_menu_event(C, event, menu, (submenu == NULL));
 	}
 
 	return retval;
@@ -6508,29 +6399,29 @@ static int ui_handler_region(bContext *C, wmEvent *event, void *UNUSED(userdata)
 	int retval;
 
 	/* here we handle buttons at the region level, non-modal */
-	ar= CTX_wm_region(C);
-	retval= WM_UI_HANDLER_CONTINUE;
+	ar = CTX_wm_region(C);
+	retval = WM_UI_HANDLER_CONTINUE;
 
-	if(ar==NULL) return retval;
-	if(ar->uiblocks.first==NULL) return retval;
+	if (ar == NULL) return retval;
+	if (ar->uiblocks.first == NULL) return retval;
 
 	/* either handle events for already activated button or try to activate */
-	but= ui_but_find_activated(ar);
+	but = ui_but_find_activated(ar);
 
-	retval= ui_handler_panel_region(C, event);
+	retval = ui_handler_panel_region(C, event);
 
-	if(retval == WM_UI_HANDLER_CONTINUE)
-		retval= ui_handle_list_event(C, event, ar);
+	if (retval == WM_UI_HANDLER_CONTINUE)
+		retval = ui_handle_list_event(C, event, ar);
 
-	if(retval == WM_UI_HANDLER_CONTINUE) {
-		if(but)
-			retval= ui_handle_button_event(C, event, but);
+	if (retval == WM_UI_HANDLER_CONTINUE) {
+		if (but)
+			retval = ui_handle_button_event(C, event, but);
 		else
-			retval= ui_handle_button_over(C, event, ar);
+			retval = ui_handle_button_over(C, event, ar);
 	}
 
 	/* re-enable tooltips */
-	if(event->type == MOUSEMOVE && (event->x!=event->prevx || event->y!=event->prevy))
+	if (event->type == MOUSEMOVE && (event->x != event->prevx || event->y != event->prevy))
 		ui_blocks_set_tooltips(ar, 1);
 	
 	/* delayed apply callbacks */
@@ -6544,18 +6435,18 @@ static void ui_handler_remove_region(bContext *C, void *UNUSED(userdata))
 	bScreen *sc;
 	ARegion *ar;
 
-	ar= CTX_wm_region(C);
-	if(ar == NULL) return;
+	ar = CTX_wm_region(C);
+	if (ar == NULL) return;
 
 	uiFreeBlocks(C, &ar->uiblocks);
 	
-	sc= CTX_wm_screen(C);
-	if(sc == NULL) return;
+	sc = CTX_wm_screen(C);
+	if (sc == NULL) return;
 
 	/* delayed apply callbacks, but not for screen level regions, those
 	 * we rather do at the very end after closing them all, which will
 	 * be done in ui_handler_region/window */
-	if(BLI_findindex(&sc->regionbase, ar) == -1)
+	if (BLI_findindex(&sc->regionbase, ar) == -1)
 		ui_apply_but_funcs_after(C);
 }
 
@@ -6568,24 +6459,24 @@ static int ui_handler_region_menu(bContext *C, wmEvent *event, void *UNUSED(user
 
 	/* here we handle buttons at the window level, modal, for example
 	 * while number sliding, text editing, or when a menu block is open */
-	ar= CTX_wm_menu(C);
-	if(!ar)
-		ar= CTX_wm_region(C);
+	ar = CTX_wm_menu(C);
+	if (!ar)
+		ar = CTX_wm_region(C);
 
-	but= ui_but_find_activated(ar);
+	but = ui_but_find_activated(ar);
 
-	if(but) {
+	if (but) {
 		/* handle activated button events */
-		data= but->active;
+		data = but->active;
 
-		if(data->state == BUTTON_STATE_MENU_OPEN) {
+		if (data->state == BUTTON_STATE_MENU_OPEN) {
 			/* handle events for menus and their buttons recursively,
 			 * this will handle events from the top to the bottom menu */
-			retval= ui_handle_menus_recursive(C, event, data->menu);
+			retval = ui_handle_menus_recursive(C, event, data->menu);
 
 			/* handle events for the activated button */
-			if(retval == WM_UI_HANDLER_CONTINUE || event->type == TIMER) {
-				if(data->menu->menuretval)
+			if (retval == WM_UI_HANDLER_CONTINUE || event->type == TIMER) {
+				if (data->menu->menuretval)
 					ui_handle_button_return_submenu(C, event, but);
 				else
 					ui_handle_button_event(C, event, but);
@@ -6598,7 +6489,7 @@ static int ui_handler_region_menu(bContext *C, wmEvent *event, void *UNUSED(user
 	}
 
 	/* re-enable tooltips */
-	if(event->type == MOUSEMOVE && (event->x!=event->prevx || event->y!=event->prevy))
+	if (event->type == MOUSEMOVE && (event->x != event->prevx || event->y != event->prevy))
 		ui_blocks_set_tooltips(ar, 1);
 
 	/* delayed apply callbacks */
@@ -6611,30 +6502,30 @@ static int ui_handler_region_menu(bContext *C, wmEvent *event, void *UNUSED(user
 /* two types of popups, one with operator + enum, other with regular callbacks */
 static int ui_handler_popup(bContext *C, wmEvent *event, void *userdata)
 {
-	uiPopupBlockHandle *menu= userdata;
+	uiPopupBlockHandle *menu = userdata;
 
 	ui_handle_menus_recursive(C, event, menu);
 
 	/* free if done, does not free handle itself */
-	if(menu->menuretval) {
+	if (menu->menuretval) {
 		/* copy values, we have to free first (closes region) */
-		uiPopupBlockHandle temp= *menu;
+		uiPopupBlockHandle temp = *menu;
 		
 		ui_popup_block_free(C, menu);
 		UI_remove_popup_handlers(&CTX_wm_window(C)->modalhandlers, menu);
 
-		if((temp.menuretval & UI_RETURN_OK) || (temp.menuretval & UI_RETURN_POPUP_OK)) {
-			if(temp.popup_func)
+		if ((temp.menuretval & UI_RETURN_OK) || (temp.menuretval & UI_RETURN_POPUP_OK)) {
+			if (temp.popup_func)
 				temp.popup_func(C, temp.popup_arg, temp.retvalue);
-			if(temp.optype)
+			if (temp.optype)
 				WM_operator_name_call(C, temp.optype->idname, temp.opcontext, NULL);
 		}
-		else if(temp.cancel_func)
+		else if (temp.cancel_func)
 			temp.cancel_func(temp.popup_arg);
 	}
 	else {
 		/* re-enable tooltips */
-		if(event->type == MOUSEMOVE && (event->x!=event->prevx || event->y!=event->prevy))
+		if (event->type == MOUSEMOVE && (event->x != event->prevx || event->y != event->prevy))
 			ui_blocks_set_tooltips(menu->region, 1);
 	}
 
@@ -6647,7 +6538,7 @@ static int ui_handler_popup(bContext *C, wmEvent *event, void *userdata)
 
 static void ui_handler_remove_popup(bContext *C, void *userdata)
 {
-	uiPopupBlockHandle *menu= userdata;
+	uiPopupBlockHandle *menu = userdata;
 
 	/* free menu block if window is closed for some reason */
 	ui_popup_block_free(C, menu);
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 3feda5d..e20b60c 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -33,12 +33,13 @@
 #include <string.h>
 
 #ifndef WIN32
-#include <unistd.h>
+#  include <unistd.h>
 #else
-#include <io.h>
-#include <direct.h>
-#include "BLI_winstuff.h"
-#endif   
+#  include <io.h>
+#  include <direct.h>
+#  include "BLI_winstuff.h"
+#endif
+
 #include "MEM_guardedalloc.h"
 
 #include "GPU_extensions.h"
@@ -75,15 +76,15 @@
 #include "interface_intern.h"
 
 
-#define ICON_IMAGE_W		600
-#define ICON_IMAGE_H		640
+#define ICON_IMAGE_W        600
+#define ICON_IMAGE_H        640
 
-#define ICON_GRID_COLS		26
-#define ICON_GRID_ROWS		30
+#define ICON_GRID_COLS      26
+#define ICON_GRID_ROWS      30
 
-#define ICON_GRID_MARGIN	5
-#define ICON_GRID_W		16
-#define ICON_GRID_H		16
+#define ICON_GRID_MARGIN    5
+#define ICON_GRID_W         16
+#define ICON_GRID_H         16
 
 typedef struct IconImage {
 	int w;
@@ -93,10 +94,10 @@ typedef struct IconImage {
 
 typedef void (*VectorDrawFunc)(int x, int y, int w, int h, float alpha);
 
-#define ICON_TYPE_PREVIEW	0
-#define ICON_TYPE_TEXTURE	1
-#define ICON_TYPE_BUFFER	2
-#define ICON_TYPE_VECTOR	3
+#define ICON_TYPE_PREVIEW   0
+#define ICON_TYPE_TEXTURE   1
+#define ICON_TYPE_BUFFER    2
+#define ICON_TYPE_VECTOR    3
 
 typedef struct DrawInfo {
 	int type;
@@ -107,7 +108,7 @@ typedef struct DrawInfo {
 			VectorDrawFunc func;
 		} vector;
 		struct {
-			IconImage* image;
+			IconImage *image;
 		} buffer;
 		struct {
 			int x, y, w, h;
@@ -145,24 +146,24 @@ static void def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs, int
 	new_icon->type = 0;	
 
 	di = MEM_callocN(sizeof(DrawInfo), "drawinfo");
-	di->type= type;
+	di->type = type;
 
-	if(type == ICON_TYPE_TEXTURE) {
-		di->data.texture.x= xofs;
-		di->data.texture.y= yofs;
-		di->data.texture.w= size;
-		di->data.texture.h= size;
+	if (type == ICON_TYPE_TEXTURE) {
+		di->data.texture.x = xofs;
+		di->data.texture.y = yofs;
+		di->data.texture.w = size;
+		di->data.texture.h = size;
 	}
-	else if(type == ICON_TYPE_BUFFER) {
+	else if (type == ICON_TYPE_BUFFER) {
 		iimg = MEM_mallocN(sizeof(IconImage), "icon_img");
-		iimg->rect = MEM_mallocN(size*size*sizeof(unsigned int), "icon_rect");
+		iimg->rect = MEM_mallocN(size * size * sizeof(unsigned int), "icon_rect");
 		iimg->w = size;
 		iimg->h = size;
 
 		/* Here we store the rect in the icon - same as before */
 		imgsize = bbuf->x;
-		for (y=0; y<size; y++) {
-			memcpy(&iimg->rect[y*size], &bbuf->rect[(y+yofs)*imgsize+xofs], size*sizeof(int));
+		for (y = 0; y < size; y++) {
+			memcpy(&iimg->rect[y * size], &bbuf->rect[(y + yofs) * imgsize + xofs], size * sizeof(int));
 		}
 
 		di->data.buffer.image = iimg;
@@ -174,10 +175,10 @@ static void def_internal_icon(ImBuf *bbuf, int icon_id, int xofs, int yofs, int
 	BKE_icon_set(icon_id, new_icon);
 }
 
-static void def_internal_vicon( int icon_id, VectorDrawFunc drawFunc)
+static void def_internal_vicon(int icon_id, VectorDrawFunc drawFunc)
 {
 	Icon *new_icon = NULL;
-	DrawInfo* di;
+	DrawInfo *di;
 
 	new_icon = MEM_callocN(sizeof(Icon), "texicon");
 
@@ -185,8 +186,8 @@ static void def_internal_vicon( int icon_id, VectorDrawFunc drawFunc)
 	new_icon->type = 0;
 
 	di = MEM_callocN(sizeof(DrawInfo), "drawinfo");
-	di->type= ICON_TYPE_VECTOR;
-	di->data.vector.func =drawFunc;
+	di->type = ICON_TYPE_VECTOR;
+	di->data.vector.func = drawFunc;
 
 	new_icon->drawinfo_free = NULL;
 	new_icon->drawinfo = di;
@@ -196,7 +197,7 @@ static void def_internal_vicon( int icon_id, VectorDrawFunc drawFunc)
 
 /* Vector Icon Drawing Routines */
 
-	/* Utilities */
+/* Utilities */
 
 static void viconutil_set_point(GLint pt[2], int x, int y)
 {
@@ -204,7 +205,7 @@ static void viconutil_set_point(GLint pt[2], int x, int y)
 	pt[1] = y;
 }
 
-static void viconutil_draw_tri(GLint (*pts)[2])
+static void viconutil_draw_tri(GLint(*pts)[2])
 {
 	glBegin(GL_TRIANGLES);
 	glVertex2iv(pts[0]);
@@ -213,41 +214,41 @@ static void viconutil_draw_tri(GLint (*pts)[2])
 	glEnd();
 }
 
-static void viconutil_draw_lineloop(GLint (*pts)[2], int numPoints)
+static void viconutil_draw_lineloop(GLint(*pts)[2], int numPoints)
 {
 	int i;
 
 	glBegin(GL_LINE_LOOP);
-	for (i=0; i<numPoints; i++) {
+	for (i = 0; i < numPoints; i++) {
 		glVertex2iv(pts[i]);
 	}
 	glEnd();
 }
 
-static void viconutil_draw_lineloop_smooth(GLint (*pts)[2], int numPoints)
+static void viconutil_draw_lineloop_smooth(GLint(*pts)[2], int numPoints)
 {
 	glEnable(GL_LINE_SMOOTH);
 	viconutil_draw_lineloop(pts, numPoints);
 	glDisable(GL_LINE_SMOOTH);
 }
 
-static void viconutil_draw_points(GLint (*pts)[2], int numPoints, int pointSize)
+static void viconutil_draw_points(GLint(*pts)[2], int numPoints, int pointSize)
 {
 	int i;
 
 	glBegin(GL_QUADS);
-	for (i=0; i<numPoints; i++) {
+	for (i = 0; i < numPoints; i++) {
 		int x = pts[i][0], y = pts[i][1];
 
-		glVertex2i(x-pointSize,y-pointSize);
-		glVertex2i(x+pointSize,y-pointSize);
-		glVertex2i(x+pointSize,y+pointSize);
-		glVertex2i(x-pointSize,y+pointSize);
+		glVertex2i(x - pointSize, y - pointSize);
+		glVertex2i(x + pointSize, y - pointSize);
+		glVertex2i(x + pointSize, y + pointSize);
+		glVertex2i(x - pointSize, y + pointSize);
 	}
 	glEnd();
 }
 
-	/* Drawing functions */
+/* Drawing functions */
 
 static void vicon_x_draw(int x, int y, int w, int h, float alpha)
 {
@@ -256,48 +257,48 @@ static void vicon_x_draw(int x, int y, int w, int h, float alpha)
 	w -= 6;
 	h -= 6;
 
-	glEnable( GL_LINE_SMOOTH );
+	glEnable(GL_LINE_SMOOTH);
 
 	glLineWidth(2.5);
 	
 	glColor4f(0.0, 0.0, 0.0, alpha);
 	glBegin(GL_LINES);
-	glVertex2i(x  ,y  );
-	glVertex2i(x+w,y+h);
-	glVertex2i(x+w,y  );
-	glVertex2i(x  ,y+h);
+	glVertex2i(x, y);
+	glVertex2i(x + w, y + h);
+	glVertex2i(x + w, y);
+	glVertex2i(x, y + h);
 	glEnd();
 
 	glLineWidth(1.0);
 	
-	glDisable( GL_LINE_SMOOTH );
+	glDisable(GL_LINE_SMOOTH);
 }
 
 static void vicon_view3d_draw(int x, int y, int w, int h, float alpha)
 {
-	int cx = x + w/2;
-	int cy = y + h/2;
-	int d = MAX2(2, h/3);
+	int cx = x + w / 2;
+	int cy = y + h / 2;
+	int d = MAX2(2, h / 3);
 
 	glColor4f(0.5, 0.5, 0.5, alpha);
 	glBegin(GL_LINES);
-	glVertex2i(x  , cy-d);
-	glVertex2i(x+w, cy-d);
-	glVertex2i(x  , cy+d);
-	glVertex2i(x+w, cy+d);
-
-	glVertex2i(cx-d, y  );
-	glVertex2i(cx-d, y+h);
-	glVertex2i(cx+d, y  );
-	glVertex2i(cx+d, y+h);
+	glVertex2i(x, cy - d);
+	glVertex2i(x + w, cy - d);
+	glVertex2i(x, cy + d);
+	glVertex2i(x + w, cy + d);
+
+	glVertex2i(cx - d, y);
+	glVertex2i(cx - d, y + h);
+	glVertex2i(cx + d, y);
+	glVertex2i(cx + d, y + h);
 	glEnd();
 	
 	glColor4f(0.0, 0.0, 0.0, alpha);
 	glBegin(GL_LINES);
-	glVertex2i(x  , cy);
-	glVertex2i(x+w, cy);
-	glVertex2i(cx, y  );
-	glVertex2i(cx, y+h);
+	glVertex2i(x, cy);
+	glVertex2i(x + w, cy);
+	glVertex2i(cx, y);
+	glVertex2i(cx, y + h);
 	glEnd();
 }
 
@@ -305,10 +306,10 @@ static void vicon_edit_draw(int x, int y, int w, int h, float alpha)
 {
 	GLint pts[4][2];
 
-	viconutil_set_point(pts[0], x+3  , y+3  );
-	viconutil_set_point(pts[1], x+w-3, y+3  );
-	viconutil_set_point(pts[2], x+w-3, y+h-3);
-	viconutil_set_point(pts[3], x+3  , y+h-3);
+	viconutil_set_point(pts[0], x + 3,     y + 3);
+	viconutil_set_point(pts[1], x + w - 3, y + 3);
+	viconutil_set_point(pts[2], x + w - 3, y + h - 3);
+	viconutil_set_point(pts[3], x + 3,     y + h - 3);
 
 	glColor4f(0.0, 0.0, 0.0, alpha);
 	viconutil_draw_lineloop(pts, 4);
@@ -321,9 +322,9 @@ static void vicon_editmode_hlt_draw(int x, int y, int w, int h, float alpha)
 {
 	GLint pts[3][2];
 
-	viconutil_set_point(pts[0], x+w/2, y+h-2);
-	viconutil_set_point(pts[1], x+3, y+4);
-	viconutil_set_point(pts[2], x+w-3, y+4);
+	viconutil_set_point(pts[0], x + w / 2, y + h - 2);
+	viconutil_set_point(pts[1], x + 3,     y + 4);
+	viconutil_set_point(pts[2], x + w - 3, y + 4);
 
 	glColor4f(0.5, 0.5, 0.5, alpha);
 	viconutil_draw_tri(pts);
@@ -339,9 +340,9 @@ static void vicon_editmode_dehlt_draw(int x, int y, int w, int h, float UNUSED(a
 {
 	GLint pts[3][2];
 
-	viconutil_set_point(pts[0], x+w/2, y+h-2);
-	viconutil_set_point(pts[1], x+3, y+4);
-	viconutil_set_point(pts[2], x+w-3, y+4);
+	viconutil_set_point(pts[0], x + w / 2, y + h - 2);
+	viconutil_set_point(pts[1], x + 3,     y + 4);
+	viconutil_set_point(pts[2], x + w - 3, y + 4);
 
 	glColor4f(0.0f, 0.0f, 0.0f, 1);
 	viconutil_draw_lineloop_smooth(pts, 3);
@@ -353,13 +354,13 @@ static void vicon_editmode_dehlt_draw(int x, int y, int w, int h, float UNUSED(a
 static void vicon_disclosure_tri_right_draw(int x, int y, int w, int UNUSED(h), float alpha)
 {
 	GLint pts[3][2];
-	int cx = x+w/2;
-	int cy = y+w/2;
-	int d = w/3, d2 = w/5;
+	int cx = x + w / 2;
+	int cy = y + w / 2;
+	int d = w / 3, d2 = w / 5;
 
-	viconutil_set_point(pts[0], cx-d2, cy+d);
-	viconutil_set_point(pts[1], cx-d2, cy-d);
-	viconutil_set_point(pts[2], cx+d2, cy);
+	viconutil_set_point(pts[0], cx - d2, cy + d);
+	viconutil_set_point(pts[1], cx - d2, cy - d);
+	viconutil_set_point(pts[2], cx + d2, cy);
 
 	glShadeModel(GL_SMOOTH);
 	glBegin(GL_TRIANGLES);
@@ -378,13 +379,13 @@ static void vicon_disclosure_tri_right_draw(int x, int y, int w, int UNUSED(h),
 static void vicon_small_tri_right_draw(int x, int y, int w, int UNUSED(h), float alpha)
 {
 	GLint pts[3][2];
-	int cx = x+w/2-4;
-	int cy = y+w/2;
-	int d = w/5, d2 = w/7;
+	int cx = x + w / 2 - 4;
+	int cy = y + w / 2;
+	int d = w / 5, d2 = w / 7;
 
-	viconutil_set_point(pts[0], cx-d2, cy+d);
-	viconutil_set_point(pts[1], cx-d2, cy-d);
-	viconutil_set_point(pts[2], cx+d2, cy);
+	viconutil_set_point(pts[0], cx - d2, cy + d);
+	viconutil_set_point(pts[1], cx - d2, cy - d);
+	viconutil_set_point(pts[2], cx + d2, cy);
 
 	glColor4f(0.2f, 0.2f, 0.2f, alpha);
 
@@ -400,13 +401,13 @@ static void vicon_small_tri_right_draw(int x, int y, int w, int UNUSED(h), float
 static void vicon_disclosure_tri_down_draw(int x, int y, int w, int UNUSED(h), float alpha)
 {
 	GLint pts[3][2];
-	int cx = x+w/2;
-	int cy = y+w/2;
-	int d = w/3, d2 = w/5;
+	int cx = x + w / 2;
+	int cy = y + w / 2;
+	int d = w / 3, d2 = w / 5;
 
-	viconutil_set_point(pts[0], cx+d, cy+d2);
-	viconutil_set_point(pts[1], cx-d, cy+d2);
-	viconutil_set_point(pts[2], cx, cy-d2);
+	viconutil_set_point(pts[0], cx + d, cy + d2);
+	viconutil_set_point(pts[1], cx - d, cy + d2);
+	viconutil_set_point(pts[2], cx, cy - d2);
 
 	glShadeModel(GL_SMOOTH);
 	glBegin(GL_TRIANGLES);
@@ -424,16 +425,16 @@ static void vicon_disclosure_tri_down_draw(int x, int y, int w, int UNUSED(h), f
 
 static void vicon_move_up_draw(int x, int y, int w, int h, float UNUSED(alpha))
 {
-	int d=-2;
+	int d = -2;
 
 	glEnable(GL_LINE_SMOOTH);
 	glLineWidth(1);
 	glColor3f(0.0, 0.0, 0.0);
 
 	glBegin(GL_LINE_STRIP);
-	glVertex2i(x+w/2-d*2, y+h/2+d);
-	glVertex2i(x+w/2, y+h/2-d + 1);
-	glVertex2i(x+w/2+d*2, y+h/2+d);
+	glVertex2i(x + w / 2 - d * 2, y + h / 2 + d);
+	glVertex2i(x + w / 2, y + h / 2 - d + 1);
+	glVertex2i(x + w / 2 + d * 2, y + h / 2 + d);
 	glEnd();
 
 	glLineWidth(1.0);
@@ -442,16 +443,16 @@ static void vicon_move_up_draw(int x, int y, int w, int h, float UNUSED(alpha))
 
 static void vicon_move_down_draw(int x, int y, int w, int h, float UNUSED(alpha))
 {
-	int d=2;
+	int d = 2;
 
 	glEnable(GL_LINE_SMOOTH);
 	glLineWidth(1);
 	glColor3f(0.0, 0.0, 0.0);
 
 	glBegin(GL_LINE_STRIP);
-	glVertex2i(x+w/2-d*2, y+h/2+d);
-	glVertex2i(x+w/2, y+h/2-d - 1);
-	glVertex2i(x+w/2+d*2, y+h/2+d);
+	glVertex2i(x + w / 2 - d * 2, y + h / 2 + d);
+	glVertex2i(x + w / 2, y + h / 2 - d - 1);
+	glVertex2i(x + w / 2 + d * 2, y + h / 2 + d);
 	glEnd();
 
 	glLineWidth(1.0);
@@ -462,12 +463,15 @@ static void vicon_move_down_draw(int x, int y, int w, int h, float UNUSED(alpha)
 static void init_brush_icons(void)
 {
 
-#define INIT_BRUSH_ICON(icon_id, name)                                         \
-	bbuf = IMB_ibImageFromMemory((unsigned char*)datatoc_ ##name## _png,       \
-					 datatoc_ ##name## _png_size, IB_rect, "<brush icon>");    \
-	def_internal_icon(bbuf, icon_id, 0, 0, w, ICON_TYPE_BUFFER);               \
-	IMB_freeImBuf(bbuf);
-	// end INIT_BRUSH_ICON
+#define INIT_BRUSH_ICON(icon_id, name)                                        \
+	{                                                                         \
+		bbuf = IMB_ibImageFromMemory((unsigned char *)datatoc_ ##name## _png, \
+		                             datatoc_ ##name## _png_size,             \
+		                             IB_rect, "<brush icon>");                \
+		def_internal_icon(bbuf, icon_id, 0, 0, w, ICON_TYPE_BUFFER);          \
+		IMB_freeImBuf(bbuf);                                                  \
+	} (void)0
+	/* end INIT_BRUSH_ICON */
 
 	ImBuf *bbuf;
 	const int w = 96;
@@ -476,6 +480,7 @@ static void init_brush_icons(void)
 	INIT_BRUSH_ICON(ICON_BRUSH_BLOB, blob);
 	INIT_BRUSH_ICON(ICON_BRUSH_BLUR, blur);
 	INIT_BRUSH_ICON(ICON_BRUSH_CLAY, clay);
+	INIT_BRUSH_ICON(ICON_BRUSH_CLAY_STRIPS, claystrips);
 	INIT_BRUSH_ICON(ICON_BRUSH_CLONE, clone);
 	INIT_BRUSH_ICON(ICON_BRUSH_CREASE, crease);
 	INIT_BRUSH_ICON(ICON_BRUSH_DARKEN, darken);
@@ -506,45 +511,45 @@ static void init_brush_icons(void)
 
 static void init_internal_icons(void)
 {
-	bTheme *btheme= UI_GetTheme();
-	ImBuf *bbuf= NULL;
+	bTheme *btheme = UI_GetTheme();
+	ImBuf *bbuf = NULL;
 	int x, y, icontype;
 	char iconfilestr[FILE_MAX];
 	
-	if ((btheme!=NULL) && btheme->tui.iconfile[0]) {
-		char *icondir= BLI_get_folder(BLENDER_DATAFILES, "icons");
+	if ((btheme != NULL) && btheme->tui.iconfile[0]) {
+		char *icondir = BLI_get_folder(BLENDER_DATAFILES, "icons");
 		if (icondir) {
 			BLI_join_dirfile(iconfilestr, sizeof(iconfilestr), icondir, btheme->tui.iconfile);
 			bbuf = IMB_loadiffname(iconfilestr, IB_rect); /* if the image is missing bbuf will just be NULL */
-			if(bbuf && (bbuf->x < ICON_IMAGE_W || bbuf->y < ICON_IMAGE_H)) {
+			if (bbuf && (bbuf->x < ICON_IMAGE_W || bbuf->y < ICON_IMAGE_H)) {
 				printf("\n***WARNING***\nIcons file %s too small.\nUsing built-in Icons instead\n", iconfilestr);
 				IMB_freeImBuf(bbuf);
-				bbuf= NULL;
+				bbuf = NULL;
 			}
 		}
 		else {
 			printf("%s: 'icons' data path not found, continuing\n", __func__);
 		}
 	}
-	if(bbuf==NULL)
-		bbuf = IMB_ibImageFromMemory((unsigned char*)datatoc_blender_icons_png, datatoc_blender_icons_png_size, IB_rect, "<blender icons>");
+	if (bbuf == NULL)
+		bbuf = IMB_ibImageFromMemory((unsigned char *)datatoc_blender_icons_png, datatoc_blender_icons_png_size, IB_rect, "<blender icons>");
 
-	if(bbuf) {
+	if (bbuf) {
 		/* free existing texture if any */
-		if(icongltex.id) {
+		if (icongltex.id) {
 			glDeleteTextures(1, &icongltex.id);
-			icongltex.id= 0;
+			icongltex.id = 0;
 		}
 
 		/* we only use a texture for cards with non-power of two */
-		if(GPU_non_power_of_two_support()) {
+		if (GPU_non_power_of_two_support()) {
 			glGenTextures(1, &icongltex.id);
 
-			if(icongltex.id) {
+			if (icongltex.id) {
 				icongltex.w = bbuf->x;
 				icongltex.h = bbuf->y;
-				icongltex.invw = 1.0f/bbuf->x;
-				icongltex.invh = 1.0f/bbuf->y;
+				icongltex.invw = 1.0f / bbuf->x;
+				icongltex.invh = 1.0f / bbuf->y;
 
 				glBindTexture(GL_TEXTURE_2D, icongltex.id);
 				glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bbuf->x, bbuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, bbuf->rect);
@@ -552,26 +557,26 @@ static void init_internal_icons(void)
 				glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 				glBindTexture(GL_TEXTURE_2D, 0);
 
-				if(glGetError() == GL_OUT_OF_MEMORY) {
+				if (glGetError() == GL_OUT_OF_MEMORY) {
 					glDeleteTextures(1, &icongltex.id);
-					icongltex.id= 0;
+					icongltex.id = 0;
 				}
 			}
 		}
 	}
 
-	if(icongltex.id)
-		icontype= ICON_TYPE_TEXTURE;
+	if (icongltex.id)
+		icontype = ICON_TYPE_TEXTURE;
 	else
-		icontype= ICON_TYPE_BUFFER;
+		icontype = ICON_TYPE_BUFFER;
 	
-	if(bbuf) {
-		for (y=0; y<ICON_GRID_ROWS; y++) {
-			for (x=0; x<ICON_GRID_COLS; x++) {
-				def_internal_icon(bbuf, BIFICONID_FIRST + y*ICON_GRID_COLS + x,
-					x*(ICON_GRID_W+ICON_GRID_MARGIN)+ICON_GRID_MARGIN,
-					y*(ICON_GRID_H+ICON_GRID_MARGIN)+ICON_GRID_MARGIN, ICON_GRID_W,
-					icontype);
+	if (bbuf) {
+		for (y = 0; y < ICON_GRID_ROWS; y++) {
+			for (x = 0; x < ICON_GRID_COLS; x++) {
+				def_internal_icon(bbuf, BIFICONID_FIRST + y * ICON_GRID_COLS + x,
+				                  x * (ICON_GRID_W + ICON_GRID_MARGIN) + ICON_GRID_MARGIN,
+				                  y * (ICON_GRID_H + ICON_GRID_MARGIN) + ICON_GRID_MARGIN, ICON_GRID_W,
+				                  icontype);
 			}
 		}
 	}
@@ -596,47 +601,47 @@ static void init_iconfile_list(struct ListBase *list)
 	IconFile *ifile;
 	struct direntry *dir;
 	int restoredir = 1; /* restore to current directory */
-	int totfile, i, index=1;
+	int totfile, i, index = 1;
 	const char *icondir;
 	char olddir[FILE_MAX];
 
 	list->first = list->last = NULL;
 	icondir = BLI_get_folder(BLENDER_DATAFILES, "icons");
 
-	if(icondir==NULL)
+	if (icondir == NULL)
 		return;
 	
 	/* since BLI_dir_contents changes the current working directory, restore it 
-	   back to old value afterwards */
-	if(!BLI_current_working_dir(olddir, sizeof(olddir))) 
+	 * back to old value afterwards */
+	if (!BLI_current_working_dir(olddir, sizeof(olddir))) 
 		restoredir = 0;
 	totfile = BLI_dir_contents(icondir, &dir);
 	if (restoredir && !chdir(olddir)) {} /* fix warning about checking return value */
 
-	for(i=0; i<totfile; i++) {
-		if( (dir[i].type & S_IFREG) ) {
+	for (i = 0; i < totfile; i++) {
+		if ( (dir[i].type & S_IFREG) ) {
 			char *filename = dir[i].relname;
 			
-			if(BLI_testextensie(filename, ".png")) {
+			if (BLI_testextensie(filename, ".png")) {
 				/* loading all icons on file start is overkill & slows startup
 				 * its possible they change size after blender load anyway. */
 #if 0
 				int ifilex, ifiley;
-				char iconfilestr[FILE_MAX+16]; /* allow 256 chars for file+dir */
-				ImBuf *bbuf= NULL;
+				char iconfilestr[FILE_MAX + 16]; /* allow 256 chars for file+dir */
+				ImBuf *bbuf = NULL;
 				/* check to see if the image is the right size, continue if not */
 				/* copying strings here should go ok, assuming that we never get back
-				   a complete path to file longer than 256 chars */
+				 * a complete path to file longer than 256 chars */
 				BLI_join_dirfile(iconfilestr, sizeof(iconfilestr), icondir, filename);
-				bbuf= IMB_loadiffname(iconfilestr, IB_rect);
+				bbuf = IMB_loadiffname(iconfilestr, IB_rect);
 
-				if(bbuf) {
+				if (bbuf) {
 					ifilex = bbuf->x;
 					ifiley = bbuf->y;
 					IMB_freeImBuf(bbuf);
 				}
 				else {
-					ifilex= ifiley= 0;
+					ifilex = ifiley = 0;
 				}
 				
 				/* bad size or failed to load */
@@ -644,7 +649,7 @@ static void init_iconfile_list(struct ListBase *list)
 					printf("icon '%s' is wrong size %dx%d\n", iconfilestr, ifilex, ifiley);
 					continue;
 				}
-#endif			/* removed */
+#endif          /* removed */
 
 				/* found a potential icon file, so make an entry for it in the cache list */
 				ifile = MEM_callocN(sizeof(IconFile), "IconFile");
@@ -660,9 +665,9 @@ static void init_iconfile_list(struct ListBase *list)
 	}
 	
 	/* free temporary direntry structure that's been created by BLI_dir_contents() */
-	i= totfile-1;
+	i = totfile - 1;
 	
-	for(; i>=0; i--){
+	for (; i >= 0; i--) {
 		MEM_freeN(dir[i].relname);
 		MEM_freeN(dir[i].path);
 		if (dir[i].string) {
@@ -670,14 +675,14 @@ static void init_iconfile_list(struct ListBase *list)
 		}
 	}
 	free(dir);
-	dir= NULL;
+	dir = NULL;
 }
 
 static void free_iconfile_list(struct ListBase *list)
 {
-	IconFile *ifile=NULL, *next_ifile=NULL;
+	IconFile *ifile = NULL, *next_ifile = NULL;
 	
-	for(ifile=list->first; ifile; ifile=next_ifile) {
+	for (ifile = list->first; ifile; ifile = next_ifile) {
 		next_ifile = ifile->next;
 		BLI_freelinkN(list, ifile);
 	}
@@ -686,9 +691,9 @@ static void free_iconfile_list(struct ListBase *list)
 int UI_iconfile_get_index(const char *filename)
 {
 	IconFile *ifile;
-	ListBase *list=&(iconfilelist);
+	ListBase *list = &(iconfilelist);
 	
-	for(ifile=list->first; ifile; ifile=ifile->next) {
+	for (ifile = list->first; ifile; ifile = ifile->next) {
 		if (BLI_path_cmp(filename, ifile->filename) == 0) {
 			return ifile->index;
 		}
@@ -699,7 +704,7 @@ int UI_iconfile_get_index(const char *filename)
 
 ListBase *UI_iconfile_list(void)
 {
-	ListBase *list=&(iconfilelist);
+	ListBase *list = &(iconfilelist);
 	
 	return list;
 }
@@ -708,9 +713,9 @@ ListBase *UI_iconfile_list(void)
 void UI_icons_free(void)
 {
 #ifndef WITH_HEADLESS
-	if(icongltex.id) {
+	if (icongltex.id) {
 		glDeleteTextures(1, &icongltex.id);
-		icongltex.id= 0;
+		icongltex.id = 0;
 	}
 
 	free_iconfile_list(&iconfilelist);
@@ -722,9 +727,9 @@ void UI_icons_free_drawinfo(void *drawinfo)
 {
 	DrawInfo *di = drawinfo;
 
-	if(di) {
-		if(di->type == ICON_TYPE_BUFFER) {
-			if(di->data.buffer.image) {
+	if (di) {
+		if (di->type == ICON_TYPE_BUFFER) {
+			if (di->data.buffer.image) {
 				MEM_freeN(di->data.buffer.image->rect);
 				MEM_freeN(di->data.buffer.image);
 			}
@@ -739,7 +744,7 @@ static DrawInfo *icon_create_drawinfo(void)
 	DrawInfo *di = NULL;
 
 	di = MEM_callocN(sizeof(DrawInfo), "di_icon");
-	di->type= ICON_TYPE_PREVIEW;
+	di->type = ICON_TYPE_PREVIEW;
 
 	return di;
 }
@@ -752,8 +757,8 @@ int UI_icon_get_width(int icon_id)
 
 	icon = BKE_icon_get(icon_id);
 	
-	if (icon==NULL) {
-		if (G.f & G_DEBUG)
+	if (icon == NULL) {
+		if (G.debug & G_DEBUG)
 			printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id);
 		return 0;
 	}
@@ -777,13 +782,13 @@ int UI_icon_get_height(int icon_id)
 
 	icon = BKE_icon_get(icon_id);
 	
-	if (icon==NULL) {
-		if (G.f & G_DEBUG)
+	if (icon == NULL) {
+		if (G.debug & G_DEBUG)
 			printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id);
 		return 0;
 	}
 	
-	di = (DrawInfo*)icon->drawinfo;
+	di = (DrawInfo *)icon->drawinfo;
 
 	if (!di) {
 		di = icon_create_drawinfo();
@@ -813,7 +818,7 @@ void UI_icons_init(int first_dyn_id)
 static int preview_render_size(enum eIconSizes size)
 {
 	switch (size) {
-		case ICON_SIZE_ICON:	return 32;
+		case ICON_SIZE_ICON:    return 32;
 		case ICON_SIZE_PREVIEW: return PREVIEW_DEFAULT_HEIGHT;
 	}
 	return 0;
@@ -821,12 +826,12 @@ static int preview_render_size(enum eIconSizes size)
 
 /* Create rect for the icon
  */
-static void icon_create_rect(struct PreviewImage* prv_img, enum eIconSizes size) 
+static void icon_create_rect(struct PreviewImage *prv_img, enum eIconSizes size)
 {
 	unsigned int render_size = preview_render_size(size);
 
 	if (!prv_img) {
-		if (G.f & G_DEBUG)
+		if (G.debug & G_DEBUG)
 			printf("%s, error: requested preview image does not exist", __func__);
 	}
 	if (!prv_img->rect[size]) {
@@ -834,16 +839,16 @@ static void icon_create_rect(struct PreviewImage* prv_img, enum eIconSizes size)
 		prv_img->h[size] = render_size;
 		prv_img->changed[size] = 1;
 		prv_img->changed_timestamp[size] = 0;
-		prv_img->rect[size] = MEM_callocN(render_size*render_size*sizeof(unsigned int), "prv_rect"); 
+		prv_img->rect[size] = MEM_callocN(render_size * render_size * sizeof(unsigned int), "prv_rect");
 	}
 }
 
 /* only called when icon has changed */
 /* only call with valid pointer from UI_icon_draw */
-static void icon_set_image(bContext *C, ID *id, PreviewImage* prv_img, enum eIconSizes size)
+static void icon_set_image(bContext *C, ID *id, PreviewImage *prv_img, enum eIconSizes size)
 {
 	if (!prv_img) {
-		if (G.f & G_DEBUG)
+		if (G.debug & G_DEBUG)
 			printf("%s: no preview image for this ID: %s\n", __func__, id->name);
 		return;
 	}	
@@ -851,41 +856,41 @@ static void icon_set_image(bContext *C, ID *id, PreviewImage* prv_img, enum eIco
 	icon_create_rect(prv_img, size);
 
 	ED_preview_icon_job(C, prv_img, id, prv_img->rect[size],
-		prv_img->w[size], prv_img->h[size]);
+	                    prv_img->w[size], prv_img->h[size]);
 }
 
-static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh, unsigned int *rect, float alpha, float *rgb, short is_preview)
+static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh, unsigned int *rect, float alpha, const float rgb[3], short is_preview)
 {
-	ImBuf *ima= NULL;
+	ImBuf *ima = NULL;
 
 	/* sanity check */
-	if(w<=0 || h<=0 || w>2000 || h>2000) {
+	if (w <= 0 || h <= 0 || w > 2000 || h > 2000) {
 		printf("%s: icons are %i x %i pixels?\n", __func__, w, h);
 		BLI_assert(!"invalid icon size");
 		return;
 	}
 
 	/* modulate color */
-	if(alpha != 1.0f)
+	if (alpha != 1.0f)
 		glPixelTransferf(GL_ALPHA_SCALE, alpha);
 
-	if(rgb) {
+	if (rgb) {
 		glPixelTransferf(GL_RED_SCALE, rgb[0]);
 		glPixelTransferf(GL_GREEN_SCALE, rgb[1]);
 		glPixelTransferf(GL_BLUE_SCALE, rgb[2]);
 	}
 
 	/* rect contains image in 'rendersize', we only scale if needed */
-	if(rw!=w && rh!=h) {
+	if (rw != w && rh != h) {
 		/* first allocate imbuf for scaling and copy preview into it */
 		ima = IMB_allocImBuf(rw, rh, 32, IB_rect);
-		memcpy(ima->rect, rect, rw*rh*sizeof(unsigned int));	
+		memcpy(ima->rect, rect, rw * rh * sizeof(unsigned int));
 		IMB_scaleImBuf(ima, w, h); /* scale it */
-		rect= ima->rect;
+		rect = ima->rect;
 	}
 
 	/* draw */
-	if(is_preview) {
+	if (is_preview) {
 		glaDrawPixelsSafe(x, y, w, h, w, GL_RGBA, GL_UNSIGNED_BYTE, rect);
 	}
 	else {
@@ -893,31 +898,31 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect),
 		glDrawPixels(w, h, GL_RGBA, GL_UNSIGNED_BYTE, rect);
 	}
 
-	if(ima)
+	if (ima)
 		IMB_freeImBuf(ima);
 
 	/* restore color */
-	if(alpha != 0.0f)
+	if (alpha != 0.0f)
 		glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
 	
-	if(rgb) {
+	if (rgb) {
 		glPixelTransferf(GL_RED_SCALE, 1.0f);
 		glPixelTransferf(GL_GREEN_SCALE, 1.0f);
 		glPixelTransferf(GL_BLUE_SCALE, 1.0f);
 	}
 }
 
-static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy, int UNUSED(iw), int ih, float alpha, float *rgb)
+static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy, int UNUSED(iw), int ih, float alpha, const float rgb[3])
 {
 	float x1, x2, y1, y2;
 
-	if(rgb) glColor4f(rgb[0], rgb[1], rgb[2], alpha);
+	if (rgb) glColor4f(rgb[0], rgb[1], rgb[2], alpha);
 	else glColor4f(1.0f, 1.0f, 1.0f, alpha);
 
-	x1= ix*icongltex.invw;
-	x2= (ix + ih)*icongltex.invw;
-	y1= iy*icongltex.invh;
-	y2= (iy + ih)*icongltex.invh;
+	x1 = ix * icongltex.invw;
+	x2 = (ix + ih) * icongltex.invw;
+	y1 = iy * icongltex.invh;
+	y2 = (iy + ih) * icongltex.invh;
 
 	glEnable(GL_TEXTURE_2D);
 	glBindTexture(GL_TEXTURE_2D, icongltex.id);
@@ -927,13 +932,13 @@ static void icon_draw_texture(float x, float y, float w, float h, int ix, int iy
 	glVertex2f(x, y);
 
 	glTexCoord2f(x2, y1);
-	glVertex2f(x+w, y);
+	glVertex2f(x + w, y);
 
 	glTexCoord2f(x2, y2);
-	glVertex2f(x+w, y+h);
+	glVertex2f(x + w, y + h);
 
 	glTexCoord2f(x1, y2);
-	glVertex2f(x, y+h);
+	glVertex2f(x, y + h);
 	glEnd();
 
 	glBindTexture(GL_TEXTURE_2D, 0);
@@ -950,25 +955,25 @@ static int get_draw_size(enum eIconSizes size)
 	return 0;
 }
 
-static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, float *rgb, enum eIconSizes size, int draw_size, int UNUSED(nocreate), short is_preview)
+static void icon_draw_size(float x, float y, int icon_id, float aspect, float alpha, const float rgb[3], enum eIconSizes size, int draw_size, int UNUSED(nocreate), short is_preview)
 {
-	bTheme *btheme= UI_GetTheme();
+	bTheme *btheme = UI_GetTheme();
 	Icon *icon = NULL;
 	DrawInfo *di = NULL;
 	IconImage *iimg;
-	float fdraw_size= is_preview ? draw_size : (draw_size * UI_DPI_ICON_FAC);
+	float fdraw_size = is_preview ? draw_size : (draw_size * UI_DPI_ICON_FAC);
 	int w, h;
 	
 	icon = BKE_icon_get(icon_id);
 	alpha *= btheme->tui.icon_alpha;
 	
-	if (icon==NULL) {
-		if (G.f & G_DEBUG)
+	if (icon == NULL) {
+		if (G.debug & G_DEBUG)
 			printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id);
 		return;
 	}
 
-	di = (DrawInfo*)icon->drawinfo;
+	di = (DrawInfo *)icon->drawinfo;
 	
 	if (!di) {
 		di = icon_create_drawinfo();
@@ -978,32 +983,32 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al
 	}
 	
 	/* scale width and height according to aspect */
-	w = (int)(fdraw_size/aspect + 0.5f);
-	h = (int)(fdraw_size/aspect + 0.5f);
+	w = (int)(fdraw_size / aspect + 0.5f);
+	h = (int)(fdraw_size / aspect + 0.5f);
 	
-	if(di->type == ICON_TYPE_VECTOR) {
+	if (di->type == ICON_TYPE_VECTOR) {
 		/* vector icons use the uiBlock transformation, they are not drawn
-		with untransformed coordinates like the other icons */
+		 * 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) {
+	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);
+		                  di->data.texture.w, di->data.texture.h, alpha, rgb);
 	}
-	else if(di->type == ICON_TYPE_BUFFER) {
+	else if (di->type == ICON_TYPE_BUFFER) {
 		/* it is a builtin icon */		
-		iimg= di->data.buffer.image;
+		iimg = di->data.buffer.image;
 
-		if(!iimg->rect) return; /* something has gone wrong! */
+		if (!iimg->rect) return;  /* something has gone wrong! */
 
 		icon_draw_rect(x, y, w, h, aspect, iimg->w, iimg->h, iimg->rect, alpha, rgb, is_preview);
 	}
-	else if(di->type == ICON_TYPE_PREVIEW) {
-		PreviewImage* pi = BKE_previewimg_get((ID*)icon->obj); 
+	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! */
+			if (!pi->rect[size]) return;  /* something has gone wrong! */
 			
 			/* preview images use premul alpha ... */
 			glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
@@ -1013,21 +1018,25 @@ static void icon_draw_size(float x, float y, int icon_id, float aspect, float al
 	}
 }
 
+static void ui_id_preview_image_render_size(bContext *C, ID *id, PreviewImage *pi, int size)
+{
+	if ((pi->changed[size] || !pi->rect[size])) { /* changed only ever set by dynamic icons */
+		/* create the rect if necessary */
+		icon_set_image(C, id, pi, size);
+
+		pi->changed[size] = 0;
+	}
+}
+
 static void ui_id_icon_render(bContext *C, ID *id, int big)
 {
-	PreviewImage *pi = BKE_previewimg_get(id); 
-	
-	if (pi) {			
-		if ((pi->changed[0] ||!pi->rect[0])) /* changed only ever set by dynamic icons */
-		{
-			/* create the rect if necessary */				
-			
-			icon_set_image(C, id, pi, ICON_SIZE_ICON);		/* icon size */
-			if (big)
-				icon_set_image(C, id, pi, ICON_SIZE_PREVIEW);	/* bigger preview size */
-			
-			pi->changed[0] = 0;
-		}
+	PreviewImage *pi = BKE_previewimg_get(id);
+
+	if (pi) {
+		if (big)
+			ui_id_preview_image_render_size(C, id, pi, ICON_SIZE_PREVIEW);  /* bigger preview size */
+		else
+			ui_id_preview_image_render_size(C, id, pi, ICON_SIZE_ICON);     /* icon size */
 	}
 }
 
@@ -1036,13 +1045,13 @@ static void ui_id_brush_render(bContext *C, ID *id)
 	PreviewImage *pi = BKE_previewimg_get(id); 
 	enum eIconSizes i;
 	
-	if(!pi)
+	if (!pi)
 		return;
 	
-	for(i = 0; i < NUM_ICON_SIZES; i++) {
+	for (i = 0; i < NUM_ICON_SIZES; i++) {
 		/* check if rect needs to be created; changed
-		 only set by dynamic icons */
-		if((pi->changed[i] || !pi->rect[i])) {
+		 * only set by dynamic icons */
+		if ((pi->changed[i] || !pi->rect[i])) {
 			icon_set_image(C, id, pi, i);
 			pi->changed[i] = 0;
 		}
@@ -1052,9 +1061,9 @@ static void ui_id_brush_render(bContext *C, ID *id)
 
 static int ui_id_brush_get_icon(bContext *C, ID *id)
 {
-	Brush *br = (Brush*)id;
+	Brush *br = (Brush *)id;
 
-	if(br->flag & BRUSH_CUSTOM_ICON) {
+	if (br->flag & BRUSH_CUSTOM_ICON) {
 		BKE_icon_getid(id);
 		ui_id_brush_render(C, id);
 	}
@@ -1065,37 +1074,38 @@ static int ui_id_brush_get_icon(bContext *C, ID *id)
 		int tool, mode = 0;
 
 		/* XXX: this is not nice, should probably make brushes
-		   be strictly in one paint mode only to avoid
-		   checking various context stuff here */
+		 * be strictly in one paint mode only to avoid
+		 * checking various context stuff here */
 
-		if(CTX_wm_view3d(C) && ob) {
-			if(ob->mode & OB_MODE_SCULPT)
+		if (CTX_wm_view3d(C) && ob) {
+			if (ob->mode & OB_MODE_SCULPT)
 				mode = OB_MODE_SCULPT;
-			else if(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT))
+			else if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT))
 				mode = OB_MODE_VERTEX_PAINT;
-			else if(ob->mode & OB_MODE_TEXTURE_PAINT)
+			else if (ob->mode & OB_MODE_TEXTURE_PAINT)
 				mode = OB_MODE_TEXTURE_PAINT;
 		}
-		else if((sima = CTX_wm_space_image(C)) &&
-			(sima->flag & SI_DRAWTOOL)) {
+		else if ((sima = CTX_wm_space_image(C)) &&
+		         (sima->flag & SI_DRAWTOOL))
+		{
 			mode = OB_MODE_TEXTURE_PAINT;
 		}
 
 		/* reset the icon */
-		if(mode == OB_MODE_SCULPT) {
+		if (mode == OB_MODE_SCULPT) {
 			items = brush_sculpt_tool_items;
 			tool = br->sculpt_tool;
 		}
-		else if(mode == OB_MODE_VERTEX_PAINT) {
+		else if (mode == OB_MODE_VERTEX_PAINT) {
 			items = brush_vertex_tool_items;
 			tool = br->vertexpaint_tool;
 		}
-		else if(mode == OB_MODE_TEXTURE_PAINT) {
+		else if (mode == OB_MODE_TEXTURE_PAINT) {
 			items = brush_image_tool_items;
 			tool = br->imagepaint_tool;
 		}
 
-		if(!items || !RNA_enum_icon_from_value(items, tool, &id->icon_id))
+		if (!items || !RNA_enum_icon_from_value(items, tool, &id->icon_id))
 			id->icon_id = 0;
 	}
 
@@ -1104,19 +1114,19 @@ static int ui_id_brush_get_icon(bContext *C, ID *id)
 
 int ui_id_icon_get(bContext *C, ID *id, int big)
 {
-	int iconid= 0;
+	int iconid = 0;
 	
 	/* icon */
-	switch(GS(id->name)) {
+	switch (GS(id->name)) {
 		case ID_BR:
-			iconid= ui_id_brush_get_icon(C, id);
+			iconid = ui_id_brush_get_icon(C, id);
 			break;
 		case ID_MA: /* fall through */
 		case ID_TE: /* fall through */
 		case ID_IM: /* fall through */
 		case ID_WO: /* fall through */
 		case ID_LA: /* fall through */
-			iconid= BKE_icon_getid(id);
+			iconid = BKE_icon_getid(id);
 			/* checks if not exists, or changed */
 			ui_id_icon_render(C, id, big);
 			break;
@@ -1138,7 +1148,7 @@ void UI_icon_draw_aspect(float x, float y, int icon_id, float aspect, float alph
 	icon_draw_at_size(x, y, icon_id, aspect, alpha, ICON_SIZE_ICON, 0);
 }
 
-void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, float *rgb)
+void UI_icon_draw_aspect_color(float x, float y, int icon_id, float aspect, const float rgb[3])
 {
 	int draw_size = get_draw_size(ICON_SIZE_ICON);
 	icon_draw_size(x, y, icon_id, aspect, 1.0f, rgb, ICON_SIZE_ICON, draw_size, FALSE, FALSE);
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 2d8de47..a0935e7 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef INTERFACE_H
-#define INTERFACE_H
+#ifndef __INTERFACE_INTERN_H__
+#define __INTERFACE_INTERN_H__
 
 #include "UI_resources.h"
 #include "RNA_types.h"
@@ -68,6 +68,7 @@ typedef enum {
 	UI_WTYPE_NUMBER,
 	UI_WTYPE_SLIDER,
 	UI_WTYPE_EXEC,
+	UI_WTYPE_TOOLTIP,
 	
 	/* strings */
 	UI_WTYPE_NAME,
@@ -84,7 +85,7 @@ typedef enum {
 	UI_WTYPE_PULLDOWN,
 	UI_WTYPE_MENU_ITEM,
 	UI_WTYPE_MENU_BACK,
-	
+
 	/* specials */
 	UI_WTYPE_ICON,
 	UI_WTYPE_SWATCH,
@@ -176,10 +177,10 @@ struct uiBut {
 	struct bContextStore *context;
 
 	/* not ysed yet, was used in 2.4x for ui_draw_pulldown_round & friends */
-	/*
+#if 0
 	void (*embossfunc)(int , int , float, float, float, float, float, int);
 	void (*sliderfunc)(int , float, float, float, float, float, float, int);
-	*/
+#endif
 
 	uiButCompleteFunc autocomplete_func;
 	void *autofunc_arg;
@@ -465,6 +466,8 @@ extern int ui_button_is_active(struct ARegion *ar);
 void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3);
 void ui_draw_anti_roundbox(int mode, float minx, float miny, float maxx, float maxy, float rad);
 void ui_draw_menu_back(struct uiStyle *style, uiBlock *block, rcti *rect);
+uiWidgetColors* ui_tooltip_get_theme(void);
+void ui_draw_tooltip_background(uiStyle *UNUSED(style), uiBlock *block, rcti *rect);
 void ui_draw_search_back(struct uiStyle *style, uiBlock *block, rcti *rect);
 int ui_link_bezier_points(rcti *rect, float coord_array[][2], int resol);
 void ui_draw_link_bezier(rcti *rect);
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 429cd65..67e2955 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -60,11 +60,11 @@
 
 /************************ Structs and Defines *************************/
 
-#define RNA_NO_INDEX	-1
-#define RNA_ENUM_VALUE	-2
+#define RNA_NO_INDEX    -1
+#define RNA_ENUM_VALUE  -2
 
-#define EM_SEPR_X		6
-#define EM_SEPR_Y		6
+#define EM_SEPR_X       6
+#define EM_SEPR_Y       6
 
 #define UI_OPERATOR_ERROR_RET(_ot, _opname, return_statement)                 \
 	if (ot == NULL) {                                                         \
@@ -170,12 +170,12 @@ typedef struct uiLayoutItemRoot {
 
 static const char *ui_item_name_add_colon(const char *name, char namestr[UI_MAX_NAME_STR])
 {
-	int len= strlen(name);
+	int len = strlen(name);
 
-	if(len != 0 && len+1 < UI_MAX_NAME_STR) {
+	if (len != 0 && len + 1 < UI_MAX_NAME_STR) {
 		BLI_strncpy(namestr, name, UI_MAX_NAME_STR);
-		namestr[len]= ':';
-		namestr[len+1]= '\0';
+		namestr[len] = ':';
+		namestr[len + 1] = '\0';
 		return namestr;
 	}
 
@@ -185,26 +185,26 @@ static const char *ui_item_name_add_colon(const char *name, char namestr[UI_MAX_
 static int ui_item_fit(int item, int pos, int all, int available, int last, int alignment, int *offset)
 {
 	/* available == 0 is unlimited */
-	if(available == 0)
+	if (available == 0)
 		return item;
 	
-	if(offset)
-		*offset= 0;
+	if (offset)
+		*offset = 0;
 	
-	if(all > available) {
+	if (all > available) {
 		/* contents is bigger than available space */
-		if(last)
-			return available-pos;
+		if (last)
+			return available - pos;
 		else
-			return (item*available)/all;
+			return (item * available) / all;
 	}
 	else {
 		/* contents is smaller or equal to available space */
-		if(alignment == UI_LAYOUT_ALIGN_EXPAND) {
-			if(last)
-				return available-pos;
+		if (alignment == UI_LAYOUT_ALIGN_EXPAND) {
+			if (last)
+				return available - pos;
 			else
-				return (item*available)/all;
+				return (item * available) / all;
 		}
 		else
 			return item;
@@ -212,12 +212,12 @@ static int ui_item_fit(int item, int pos, int all, int available, int last, int
 }
 
 /* variable button size in which direction? */
-#define UI_ITEM_VARY_X	1
-#define UI_ITEM_VARY_Y	2
+#define UI_ITEM_VARY_X  1
+#define UI_ITEM_VARY_Y  2
 
 static int ui_layout_vary_direction(uiLayout *layout)
 {
-	return (layout->root->type == UI_LAYOUT_HEADER || layout->alignment != UI_LAYOUT_ALIGN_EXPAND)? UI_ITEM_VARY_X: UI_ITEM_VARY_Y;
+	return (layout->root->type == UI_LAYOUT_HEADER || layout->alignment != UI_LAYOUT_ALIGN_EXPAND) ? UI_ITEM_VARY_X : UI_ITEM_VARY_Y;
 }
 
 /* estimated size of text + icon */
@@ -225,63 +225,63 @@ static int ui_text_icon_width(uiLayout *layout, const char *name, int icon, int
 {
 	int variable = ui_layout_vary_direction(layout) == UI_ITEM_VARY_X;
 
-	if(icon && !name[0])
-		return UI_UNIT_X; /* icon only */
-	else if(icon)
-		return (variable)? UI_GetStringWidth(name) + (compact? 5: 10) + UI_UNIT_X: 10*UI_UNIT_X; /* icon + text */
+	if (icon && !name[0])
+		return UI_UNIT_X;  /* icon only */
+	else if (icon)
+		return (variable) ? UI_GetStringWidth(name) + (compact ? 5 : 10) + UI_UNIT_X : 10 * UI_UNIT_X;  /* icon + text */
 	else
-		return (variable)? UI_GetStringWidth(name) + (compact? 5: 10) + UI_UNIT_X: 10*UI_UNIT_X; /* text only */
+		return (variable) ? UI_GetStringWidth(name) + (compact ? 5 : 10) + UI_UNIT_X : 10 * UI_UNIT_X;  /* text only */
 }
 
 static void ui_item_size(uiItem *item, int *r_w, int *r_h)
 {
-	if(item->type == ITEM_BUTTON) {
-		uiButtonItem *bitem= (uiButtonItem*)item;
+	if (item->type == ITEM_BUTTON) {
+		uiButtonItem *bitem = (uiButtonItem *)item;
 
-		if(r_w) *r_w= bitem->but->x2 - bitem->but->x1;
-		if(r_h) *r_h= bitem->but->y2 - bitem->but->y1;
+		if (r_w) *r_w = bitem->but->x2 - bitem->but->x1;
+		if (r_h) *r_h = bitem->but->y2 - bitem->but->y1;
 	}
 	else {
-		uiLayout *litem= (uiLayout*)item;
+		uiLayout *litem = (uiLayout *)item;
 
-		if(r_w) *r_w= litem->w;
-		if(r_h) *r_h= litem->h;
+		if (r_w) *r_w = litem->w;
+		if (r_h) *r_h = litem->h;
 	}
 }
 
 static void ui_item_offset(uiItem *item, int *r_x, int *r_y)
 {
-	if(item->type == ITEM_BUTTON) {
-		uiButtonItem *bitem= (uiButtonItem*)item;
+	if (item->type == ITEM_BUTTON) {
+		uiButtonItem *bitem = (uiButtonItem *)item;
 
-		if(r_x) *r_x= bitem->but->x1;
-		if(r_y) *r_y= bitem->but->y1;
+		if (r_x) *r_x = bitem->but->x1;
+		if (r_y) *r_y = bitem->but->y1;
 	}
 	else {
-		if(r_x) *r_x= 0;
-		if(r_y) *r_y= 0;
+		if (r_x) *r_x = 0;
+		if (r_y) *r_y = 0;
 	}
 }
 
 static void ui_item_position(uiItem *item, int x, int y, int w, int h)
 {
-	if(item->type == ITEM_BUTTON) {
-		uiButtonItem *bitem= (uiButtonItem*)item;
+	if (item->type == ITEM_BUTTON) {
+		uiButtonItem *bitem = (uiButtonItem *)item;
 
-		bitem->but->x1= x;
-		bitem->but->y1= y;
-		bitem->but->x2= x+w;
-		bitem->but->y2= y+h;
+		bitem->but->x1 = x;
+		bitem->but->y1 = y;
+		bitem->but->x2 = x + w;
+		bitem->but->y2 = y + h;
 		
 		ui_check_but(bitem->but); /* for strlen */
 	}
 	else {
-		uiLayout *litem= (uiLayout*)item;
+		uiLayout *litem = (uiLayout *)item;
 
-		litem->x= x;
-		litem->y= y+h;
-		litem->w= w;
-		litem->h= h;
+		litem->x = x;
+		litem->y = y + h;
+		litem->w = w;
+		litem->h = h;
 	}
 }
 
@@ -289,7 +289,7 @@ static void ui_item_position(uiItem *item, int x, int y, int w, int h)
 
 static int ui_layout_local_dir(uiLayout *layout)
 {
-	switch(layout->item.type) {
+	switch (layout->item.type) {
 		case ITEM_LAYOUT_ROW:
 		case ITEM_LAYOUT_ROOT:
 		case ITEM_LAYOUT_OVERLAP:
@@ -308,35 +308,35 @@ static uiLayout *ui_item_local_sublayout(uiLayout *test, uiLayout *layout, int a
 {
 	uiLayout *sub;
 
-	if(ui_layout_local_dir(test) == UI_LAYOUT_HORIZONTAL)
-		sub= uiLayoutRow(layout, align);
+	if (ui_layout_local_dir(test) == UI_LAYOUT_HORIZONTAL)
+		sub = uiLayoutRow(layout, align);
 	else
-		sub= uiLayoutColumn(layout, align);
+		sub = uiLayoutColumn(layout, align);
 	
-	sub->space= 0;
+	sub->space = 0;
 	return sub;
 }
 
 static void ui_layer_but_cb(bContext *C, void *arg_but, void *arg_index)
 {
-	wmWindow *win= CTX_wm_window(C);
-	uiBut *but= arg_but, *cbut;
-	PointerRNA *ptr= &but->rnapoin;
-	PropertyRNA *prop= but->rnaprop;
-	int i, index= GET_INT_FROM_POINTER(arg_index);
-	int shift= win->eventstate->shift;
-	int len= RNA_property_array_length(ptr, prop);
+	wmWindow *win = CTX_wm_window(C);
+	uiBut *but = arg_but, *cbut;
+	PointerRNA *ptr = &but->rnapoin;
+	PropertyRNA *prop = but->rnaprop;
+	int i, index = GET_INT_FROM_POINTER(arg_index);
+	int shift = win->eventstate->shift;
+	int len = RNA_property_array_length(ptr, prop);
 
-	if(!shift) {
+	if (!shift) {
 		RNA_property_boolean_set_index(ptr, prop, index, TRUE);
 
-		for(i=0; i<len; i++)
-			if(i != index)
+		for (i = 0; i < len; i++)
+			if (i != index)
 				RNA_property_boolean_set_index(ptr, prop, i, 0);
 
 		RNA_property_update(C, ptr, prop);
 
-		for(cbut=but->block->buttons.first; cbut; cbut=cbut->next)
+		for (cbut = but->block->buttons.first; cbut; cbut = cbut->next)
 			ui_check_but(cbut);
 	}
 }
@@ -344,7 +344,7 @@ static void ui_layer_but_cb(bContext *C, void *arg_but, void *arg_index)
 /* create buttons for an item with an RNA array */
 static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int len, int x, int y, int w, int UNUSED(h), int expand, int slider, int toggle, int icon_only)
 {
-	uiStyle *style= layout->root->style;
+	uiStyle *style = layout->root->style;
 	uiBut *but;
 	PropertyType type;
 	PropertySubType subtype;
@@ -352,122 +352,122 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
 	int a, b;
 
 	/* retrieve type and subtype */
-	type= RNA_property_type(prop);
-	subtype= RNA_property_subtype(prop);
+	type = RNA_property_type(prop);
+	subtype = RNA_property_subtype(prop);
 
-	sub= ui_item_local_sublayout(layout, layout, 1);
+	sub = ui_item_local_sublayout(layout, layout, 1);
 	uiBlockSetCurLayout(block, sub);
 
 	/* create label */
-	if(name[0])
+	if (name[0])
 		uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
 
 	/* create buttons */
-	if(type == PROP_BOOLEAN && ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER)) {
+	if (type == PROP_BOOLEAN && ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER)) {
 		/* special check for layer layout */
 		int butw, buth, unit;
-		int cols= (len >= 20)? 2: 1;
-		int colbuts= len/(2*cols);
-		int layer_used= 0;
+		int cols = (len >= 20) ? 2 : 1;
+		int colbuts = len / (2 * cols);
+		int layer_used = 0;
 
 		uiBlockSetCurLayout(block, uiLayoutAbsolute(layout, 0));
 
-		unit= UI_UNIT_X*0.75;
-		butw= unit;
-		buth= unit;
+		unit = UI_UNIT_X * 0.75;
+		butw = unit;
+		buth = unit;
 
-		if(ptr->type == &RNA_Armature) {
-			bArmature *arm= (bArmature *)ptr->data;
-			layer_used= arm->layer_used;
+		if (ptr->type == &RNA_Armature) {
+			bArmature *arm = (bArmature *)ptr->data;
+			layer_used = arm->layer_used;
 		}
 
-		for(b=0; b<cols; b++) {
+		for (b = 0; b < cols; b++) {
 			uiBlockBeginAlign(block);
 
-			for(a=0; a<colbuts; a++) {
-				if(layer_used & (1<<(a+b*colbuts))) icon= ICON_LAYER_USED;
-				else icon= ICON_BLANK1;
+			for (a = 0; a < colbuts; a++) {
+				if (layer_used & (1 << (a + b * colbuts))) icon = ICON_LAYER_USED;
+				else icon = ICON_BLANK1;
 
-				but= uiDefAutoButR(block, ptr, prop, a+b*colbuts, "", icon, x + butw*a, y+buth, butw, buth);
-				if(subtype == PROP_LAYER_MEMBER)
-					uiButSetFunc(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(a+b*colbuts));
+				but = uiDefAutoButR(block, ptr, prop, a + b * colbuts, "", icon, x + butw * a, y + buth, butw, buth);
+				if (subtype == PROP_LAYER_MEMBER)
+					uiButSetFunc(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(a + b * colbuts));
 			}
-			for(a=0; a<colbuts; a++) {
-				if(layer_used & (1<<(a+len/2+b*colbuts))) icon= ICON_LAYER_USED;
-				else icon= ICON_BLANK1;
+			for (a = 0; a < colbuts; a++) {
+				if (layer_used & (1 << (a + len / 2 + b * colbuts))) icon = ICON_LAYER_USED;
+				else icon = ICON_BLANK1;
 
-				but= uiDefAutoButR(block, ptr, prop, a+len/2+b*colbuts, "", icon, x + butw*a, y, butw, buth);
-				if(subtype == PROP_LAYER_MEMBER)
-					uiButSetFunc(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(a+len/2+b*colbuts));
+				but = uiDefAutoButR(block, ptr, prop, a + len / 2 + b * colbuts, "", icon, x + butw * a, y, butw, buth);
+				if (subtype == PROP_LAYER_MEMBER)
+					uiButSetFunc(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(a + len / 2 + b * colbuts));
 			}
 			uiBlockEndAlign(block);
 
-			x += colbuts*butw + style->buttonspacex;
+			x += colbuts * butw + style->buttonspacex;
 		}
 	}
-	else if(subtype == PROP_MATRIX) {
-		int totdim, dim_size[3];	/* 3 == RNA_MAX_ARRAY_DIMENSION */
+	else if (subtype == PROP_MATRIX) {
+		int totdim, dim_size[3];    /* 3 == RNA_MAX_ARRAY_DIMENSION */
 		int row, col;
 
 		uiBlockSetCurLayout(block, uiLayoutAbsolute(layout, 1));
 
-		totdim= RNA_property_array_dimension(ptr, prop, dim_size);
-		if (totdim != 2) return;	/* only 2D matrices supported in UI so far */
+		totdim = RNA_property_array_dimension(ptr, prop, dim_size);
+		if (totdim != 2) return;    /* only 2D matrices supported in UI so far */
 		
 		w /= dim_size[0];
 		/* h /= dim_size[1]; */ /* UNUSED */
 
-		for(a=0; a<len; a++) {
-			col= a % dim_size[0];
-			row= a / dim_size[0];
-			
-			but= uiDefAutoButR(block, ptr, prop, a, "", ICON_NONE, x + w*col, y+(dim_size[1]*UI_UNIT_Y)-(row*UI_UNIT_Y), w, UI_UNIT_Y);
-			if(slider && but->type==NUM)
-				but->type= NUMSLI;
+		for (a = 0; a < len; a++) {
+			col = a % dim_size[0];
+			row = a / dim_size[0];
+
+			but = uiDefAutoButR(block, ptr, prop, a, "", ICON_NONE, x + w * col, y + (dim_size[1] * UI_UNIT_Y) - (row * UI_UNIT_Y), w, UI_UNIT_Y);
+			if (slider && but->type == NUM)
+				but->type = NUMSLI;
 		}
 	}
-	else if(subtype == PROP_DIRECTION) {
-		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 if (subtype == PROP_DIRECTION) {
+		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 {
 		/* note, this block of code is a bit arbitrary and has just been made
 		 * to work with common cases, but may need to be re-worked */
 
 		/* special case, boolean array in a menu, this could be used in a more generic way too */
-		if(ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) && !expand) {
+		if (ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA) && !expand) {
 			uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, 0, 0, w, UI_UNIT_Y);
 		}
 		else {
-			int *boolarr= NULL;
+			int *boolarr = NULL;
 
 			/* even if 'expand' is fale, expanding anyway */
 
 			/* layout for known array subtypes */
-			char str[3]= {'\0'};
+			char str[3] = {'\0'};
 
-			if(!icon_only) {
-				if(type != PROP_BOOLEAN) {
-					str[1]= ':';
+			if (!icon_only) {
+				if (type != PROP_BOOLEAN) {
+					str[1] = ':';
 				}
 			}
 
 			/* show checkboxes for rna on a non-emboss block (menu for eg) */
-			if(type == PROP_BOOLEAN && ELEM(layout->root->block->dt, UI_EMBOSSN, UI_EMBOSSP)) {
-				boolarr= MEM_callocN(sizeof(int)*len, "ui_item_array");
+			if (type == PROP_BOOLEAN && ELEM(layout->root->block->dt, UI_EMBOSSN, UI_EMBOSSP)) {
+				boolarr = MEM_callocN(sizeof(int) * len, "ui_item_array");
 				RNA_property_boolean_get_array(ptr, prop, boolarr);
 			}
 
-			for(a=0; a<len; a++) {
-				if(!icon_only) str[0]= RNA_property_array_item_char(prop, a);
-				if(boolarr) icon= boolarr[a] ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
-				but= uiDefAutoButR(block, ptr, prop, a, str, icon, 0, 0, w, UI_UNIT_Y);
-				if(slider && but->type==NUM)
-					but->type= NUMSLI;
-				if(toggle && but->type==OPTION)
-					but->type= TOG;
+			for (a = 0; a < len; a++) {
+				if (!icon_only) str[0] = RNA_property_array_item_char(prop, a);
+				if (boolarr) icon = boolarr[a] ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT;
+				but = uiDefAutoButR(block, ptr, prop, a, str, icon, 0, 0, w, UI_UNIT_Y);
+				if (slider && but->type == NUM)
+					but->type = NUMSLI;
+				if (toggle && but->type == OPTION)
+					but->type = TOG;
 			}
 
-			if(boolarr) {
+			if (boolarr) {
 				MEM_freeN(boolarr);
 			}
 		}
@@ -486,23 +486,23 @@ static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *pt
 	RNA_property_enum_items_gettexted(block->evil_C, ptr, prop, &item, &totitem, &free);
 
 	uiBlockSetCurLayout(block, ui_item_local_sublayout(layout, layout, 1));
-	for(a=0; a<totitem; a++) {
-		if(!item[a].identifier[0])
+	for (a = 0; a < totitem; a++) {
+		if (!item[a].identifier[0])
 			continue;
 
-		name= (!uiname || uiname[0])? item[a].name: "";
-		icon= item[a].icon;
-		value= item[a].value;
-		itemw= ui_text_icon_width(block->curlayout, name, icon, 0);
+		name = (!uiname || uiname[0]) ? item[a].name : "";
+		icon = item[a].icon;
+		value = item[a].value;
+		itemw = ui_text_icon_width(block->curlayout, name, icon, 0);
 
-		if(icon && name[0] && !icon_only)
-			but= uiDefIconTextButR_prop(block, ROW, 0, icon, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL);
-		else if(icon)
-			but= uiDefIconButR_prop(block, ROW, 0, icon, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL);
+		if (icon && name[0] && !icon_only)
+			but = uiDefIconTextButR_prop(block, ROW, 0, icon, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL);
+		else if (icon)
+			but = uiDefIconButR_prop(block, ROW, 0, icon, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL);
 		else
-			but= uiDefButR_prop(block, ROW, 0, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL);
+			but = uiDefButR_prop(block, ROW, 0, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, NULL);
 
-		if(ui_layout_local_dir(layout) != UI_LAYOUT_HORIZONTAL)
+		if (ui_layout_local_dir(layout) != UI_LAYOUT_HORIZONTAL)
 			but->flag |= UI_TEXT_LEFT;
 	}
 	uiBlockSetCurLayout(block, layout);
@@ -515,7 +515,7 @@ static void ui_item_enum_expand(uiLayout *layout, uiBlock *block, PointerRNA *pt
 /* callback for keymap item change button */
 static void ui_keymap_but_cb(bContext *UNUSED(C), void *but_v, void *UNUSED(key_v))
 {
-	uiBut *but= but_v;
+	uiBut *but = but_v;
 
 	RNA_boolean_set(&but->rnapoin, "shift", (but->modifier_key & KM_SHIFT) != 0);
 	RNA_boolean_set(&but->rnapoin, "ctrl", (but->modifier_key & KM_CTRL) != 0);
@@ -527,53 +527,55 @@ static void ui_keymap_but_cb(bContext *UNUSED(C), void *but_v, void *UNUSED(key_
 static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, const char *name, int icon, PointerRNA *ptr, PropertyRNA *prop, int index, int x, int y, int w, int h, int flag)
 {
 	uiLayout *sub;
-	uiBut *but=NULL;
+	uiBut *but = NULL;
 	PropertyType type;
 	PropertySubType subtype;
 	int labelw;
 
-	sub= uiLayoutRow(layout, 0);
+	sub = uiLayoutRow(layout, 0);
 	uiBlockSetCurLayout(block, sub);
 
-	if(name[0]) {
-		/* XXX UI_GetStringWidth is not accurate
-		labelw= UI_GetStringWidth(name);
-		CLAMP(labelw, w/4, 3*w/4);*/
-		labelw= w/3;
+	if (name[0]) {
+		/* XXX UI_GetStringWidth is not accurate */
+#if 0
+		labelw = UI_GetStringWidth(name);
+		CLAMP(labelw, w / 4, 3 * w / 4);
+#endif
+		labelw = w / 3;
 		uiDefBut(block, LABEL, 0, name, x, y, labelw, h, NULL, 0.0, 0.0, 0, 0, "");
-		w= w-labelw;
+		w = w - labelw;
 	}
 
-	type= RNA_property_type(prop);
-	subtype= RNA_property_subtype(prop);
+	type = RNA_property_type(prop);
+	subtype = RNA_property_subtype(prop);
 
-	if(subtype == PROP_FILEPATH || subtype == PROP_DIRPATH) {
+	if (subtype == PROP_FILEPATH || subtype == PROP_DIRPATH) {
 		uiBlockSetCurLayout(block, uiLayoutRow(sub, 1));
-		uiDefAutoButR(block, ptr, prop, index, "", icon, x, y, w-UI_UNIT_X, h);
+		uiDefAutoButR(block, ptr, prop, index, "", icon, x, y, w - UI_UNIT_X, h);
 
 		/* BUTTONS_OT_file_browse calls uiFileBrowseContextProperty */
-		but= uiDefIconButO(block, BUT, subtype==PROP_DIRPATH ?
-		                       "BUTTONS_OT_directory_browse" :
-		                       "BUTTONS_OT_file_browse",
-		                   WM_OP_INVOKE_DEFAULT, ICON_FILESEL, x, y, UI_UNIT_X, h, NULL);
+		but = uiDefIconButO(block, BUT, subtype == PROP_DIRPATH ?
+		                    "BUTTONS_OT_directory_browse" :
+		                    "BUTTONS_OT_file_browse",
+		                    WM_OP_INVOKE_DEFAULT, ICON_FILESEL, x, y, UI_UNIT_X, h, NULL);
 	}
-	else if(flag & UI_ITEM_R_EVENT) {
+	else if (flag & UI_ITEM_R_EVENT) {
 		uiDefButR_prop(block, KEYEVT, 0, name, x, y, w, h, ptr, prop, index, 0, 0, -1, -1, NULL);
 	}
-	else if(flag & UI_ITEM_R_FULL_EVENT) {
-		if(RNA_struct_is_a(ptr->type, &RNA_KeyMapItem)) {
+	else if (flag & UI_ITEM_R_FULL_EVENT) {
+		if (RNA_struct_is_a(ptr->type, &RNA_KeyMapItem)) {
 			char buf[128];
 
 			WM_keymap_item_to_string(ptr->data, buf, sizeof(buf));
 
-			but= uiDefButR_prop(block, HOTKEYEVT, 0, buf, x, y, w, h, ptr, prop, 0, 0, 0, -1, -1, NULL);
+			but = uiDefButR_prop(block, HOTKEYEVT, 0, buf, x, y, w, h, ptr, prop, 0, 0, 0, -1, -1, NULL);
 			uiButSetFunc(but, ui_keymap_but_cb, but, NULL);
 			if (flag & UI_ITEM_R_IMMEDIATE)
 				uiButSetFlag(but, UI_BUT_IMMEDIATE);
 		}
 	}
 	else
-		but= uiDefAutoButR(block, ptr, prop, index, (type == PROP_ENUM && !(flag & UI_ITEM_R_ICON_ONLY))? NULL: "", icon, x, y, w, h);
+		but = uiDefAutoButR(block, ptr, prop, index, (type == PROP_ENUM && !(flag & UI_ITEM_R_ICON_ONLY)) ? NULL : "", icon, x, y, w, h);
 
 	uiBlockSetCurLayout(block, layout);
 	return but;
@@ -581,25 +583,25 @@ static uiBut *ui_item_with_label(uiLayout *layout, uiBlock *block, const char *n
 
 void uiFileBrowseContextProperty(const bContext *C, PointerRNA *ptr, PropertyRNA **prop)
 {
-	ARegion *ar= CTX_wm_region(C);
+	ARegion *ar = CTX_wm_region(C);
 	uiBlock *block;
 	uiBut *but, *prevbut;
 
 	memset(ptr, 0, sizeof(*ptr));
-	*prop= NULL;
+	*prop = NULL;
 
-	if(!ar)
+	if (!ar)
 		return;
 
-	for(block=ar->uiblocks.first; block; block=block->next) {
-		for(but=block->buttons.first; but; but= but->next) {
-			prevbut= but->prev;
+	for (block = ar->uiblocks.first; block; block = block->next) {
+		for (but = block->buttons.first; but; but = but->next) {
+			prevbut = but->prev;
 
 			/* find the button before the active one */
-			if((but->flag & UI_BUT_LAST_ACTIVE) && prevbut && prevbut->rnapoin.data) {
-				if(RNA_property_type(prevbut->rnaprop) == PROP_STRING) {
-					*ptr= prevbut->rnapoin;
-					*prop= prevbut->rnaprop;
+			if ((but->flag & UI_BUT_LAST_ACTIVE) && prevbut && prevbut->rnapoin.data) {
+				if (RNA_property_type(prevbut->rnaprop) == PROP_STRING) {
+					*ptr = prevbut->rnapoin;
+					*prop = prevbut->rnaprop;
 					return;
 				}
 			}
@@ -612,18 +614,18 @@ void uiFileBrowseContextProperty(const bContext *C, PointerRNA *ptr, PropertyRNA
 /* disabled item */
 static void ui_item_disabled(uiLayout *layout, const char *name)
 {
-	uiBlock *block= layout->root->block;
+	uiBlock *block = layout->root->block;
 	uiBut *but;
 	int w;
 
 	uiBlockSetCurLayout(block, layout);
 
-	if(!name)
-		name= "";
+	if (!name)
+		name = "";
 
-	w= ui_text_icon_width(layout, name, 0, 0);
+	w = ui_text_icon_width(layout, name, 0, 0);
 
-	but= uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+	but = uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
 	but->flag |= UI_BUT_DISABLED;
 	but->lock = 1;
 	but->lockstr = "";
@@ -632,27 +634,30 @@ static void ui_item_disabled(uiLayout *layout, const char *name)
 /* operator items */
 PointerRNA uiItemFullO_ptr(uiLayout *layout, wmOperatorType *ot, const char *name, int icon, IDProperty *properties, int context, int flag)
 {
-	uiBlock *block= layout->root->block;
+	uiBlock *block = layout->root->block;
 	uiBut *but;
 	int w;
 
-	if(!name) {
-		name= IFACE_(ot->name);
+	if (!name) {
+		if (ot && ot->srna)
+			name = RNA_struct_ui_name(ot->srna);
+		else
+			name = "";
 	}
 
-	if(layout->root->type == UI_LAYOUT_MENU && !icon)
-		icon= ICON_BLANK1;
+	if (layout->root->type == UI_LAYOUT_MENU && !icon)
+		icon = ICON_BLANK1;
 
 	/* create button */
 	uiBlockSetCurLayout(block, layout);
 
-	w= ui_text_icon_width(layout, name, icon, 0);
+	w = ui_text_icon_width(layout, name, icon, 0);
 
 	if (flag & UI_ITEM_R_NO_BG)
 		uiBlockSetEmboss(block, UI_EMBOSSN);
 
 	/* create the button */
-	if(icon) {
+	if (icon) {
 		if (name[0]) {
 			but = uiDefIconTextButO_ptr(block, BUT, ot, context, icon, name, 0, 0, w, UI_UNIT_Y, NULL);
 		}
@@ -661,31 +666,31 @@ PointerRNA uiItemFullO_ptr(uiLayout *layout, wmOperatorType *ot, const char *nam
 		}
 	}
 	else {
-		but= uiDefButO_ptr(block, BUT, ot, context, name, 0, 0, w, UI_UNIT_Y, NULL);
+		but = uiDefButO_ptr(block, BUT, ot, context, name, 0, 0, w, UI_UNIT_Y, NULL);
 	}
 
 	assert(but->optype != NULL);
 
 	/* text alignment for toolbar buttons */
-	if((layout->root->type == UI_LAYOUT_TOOLBAR) && !icon)
+	if ((layout->root->type == UI_LAYOUT_TOOLBAR) && !icon)
 		but->flag |= UI_TEXT_LEFT;
 
 	if (flag & UI_ITEM_R_NO_BG)
 		uiBlockSetEmboss(block, UI_EMBOSS);
 
-	if(layout->redalert)
+	if (layout->redalert)
 		uiButSetFlag(but, UI_BUT_REDALERT);
 
 	/* assign properties */
-	if(properties || (flag & UI_ITEM_O_RETURN_PROPS)) {
-		PointerRNA *opptr= uiButGetOperatorPtrRNA(but);
+	if (properties || (flag & UI_ITEM_O_RETURN_PROPS)) {
+		PointerRNA *opptr = uiButGetOperatorPtrRNA(but);
 
-		if(properties) {
-			opptr->data= properties;
+		if (properties) {
+			opptr->data = properties;
 		}
 		else {
 			IDPropertyTemplate val = {0};
-			opptr->data= IDP_New(IDP_GROUP, &val, "wmOperatorProperties");
+			opptr->data = IDP_New(IDP_GROUP, &val, "wmOperatorProperties");
 		}
 
 		return *opptr;
@@ -728,7 +733,7 @@ static void uiItemEnumO_ptr__internal(uiLayout *layout, wmOperatorType *ot, cons
 	WM_operator_properties_create_ptr(&ptr, ot);
 	RNA_property_enum_set(&ptr, prop, value);
 
-	if(!name)
+	if (!name)
 		name = ui_menu_enumpropname(layout, &ptr, prop, value);
 
 	uiItemFullO_ptr(layout, ot, name, icon, ptr.data, layout->root->opcontext, 0);
@@ -750,7 +755,7 @@ void uiItemEnumO_ptr(uiLayout *layout, wmOperatorType *ot, const char *name, int
 
 	RNA_property_enum_set(&ptr, prop, value);
 
-	if(!name)
+	if (!name)
 		name = ui_menu_enumpropname(layout, &ptr, prop, value);
 
 	uiItemFullO_ptr(layout, ot, name, icon, ptr.data, layout->root->opcontext, 0);
@@ -759,7 +764,7 @@ void uiItemEnumO(uiLayout *layout, const char *opname, const char *name, int ico
 {
 	wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
 
-	if(ot) {
+	if (ot) {
 		uiItemEnumO_ptr(layout, ot, name, icon, propname, value);
 	}
 	else {
@@ -776,9 +781,9 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
 	PointerRNA ptr;
 	PropertyRNA *prop;
 	uiBut *bt;
-	uiBlock *block= layout->root->block;
+	uiBlock *block = layout->root->block;
 
-	if(!ot || !ot->srna) {
+	if (!ot || !ot->srna) {
 		ui_item_disabled(layout, opname);
 		RNA_warning("%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
 		return;
@@ -790,25 +795,25 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
 	/* don't let bad properties slip through */
 	BLI_assert((prop == NULL) || (RNA_property_type(prop) == PROP_ENUM));
 
-	if(prop && RNA_property_type(prop) == PROP_ENUM) {
+	if (prop && RNA_property_type(prop) == PROP_ENUM) {
 		EnumPropertyItem *item;
 		int totitem, i, free;
-		uiLayout *split= uiLayoutSplit(layout, 0, 0);
-		uiLayout *column= uiLayoutColumn(split, 0);
+		uiLayout *split = uiLayoutSplit(layout, 0, 0);
+		uiLayout *column = uiLayoutColumn(split, 0);
 
 		RNA_property_enum_items_gettexted(block->evil_C, &ptr, prop, &item, &totitem, &free);
 
-		for(i=0; i<totitem; i++) {
-			if(item[i].identifier[0]) {
-				if(properties) {
+		for (i = 0; i < totitem; i++) {
+			if (item[i].identifier[0]) {
+				if (properties) {
 					PointerRNA tptr;
 
 					WM_operator_properties_create_ptr(&tptr, ot);
-					if(tptr.data) {
+					if (tptr.data) {
 						IDP_FreeProperty(tptr.data);
 						MEM_freeN(tptr.data);
 					}
-					tptr.data= IDP_CopyProperty(properties);
+					tptr.data = IDP_CopyProperty(properties);
 					RNA_property_enum_set(&tptr, prop, item[i].value);
 
 					uiItemFullO_ptr(column, ot, item[i].name, item[i].icon, tptr.data, context, flag);
@@ -818,16 +823,16 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname
 				}
 			}
 			else {
-				if(item[i].name) {
-					if(i != 0) {
-						column= uiLayoutColumn(split, 0);
+				if (item[i].name) {
+					if (i != 0) {
+						column = uiLayoutColumn(split, 0);
 						/* inconsistent, but menus with labels do not look good flipped */
 						block->flag |= UI_BLOCK_NO_FLIP;
 					}
 
 					uiItemL(column, item[i].name, ICON_NONE);
-					bt= block->buttons.last;
-					bt->flag= UI_TEXT_LEFT;
+					bt = block->buttons.last;
+					bt->flag = UI_TEXT_LEFT;
 				}
 				else /* XXX bug here, collums draw bottom item badly */
 					uiItemS(column);
@@ -852,7 +857,7 @@ void uiItemEnumO_value(uiLayout *layout, const char *name, int icon, const char
 	PointerRNA ptr;
 	PropertyRNA *prop;
 
-	UI_OPERATOR_ERROR_RET(ot, opname, return);
+	UI_OPERATOR_ERROR_RET(ot, opname, return );
 
 	WM_operator_properties_create_ptr(&ptr, ot);
 
@@ -868,7 +873,7 @@ void uiItemEnumO_value(uiLayout *layout, const char *name, int icon, const char
 	RNA_property_enum_set(&ptr, prop, value);
 
 	/* same as uiItemEnumO */
-	if(!name)
+	if (!name)
 		name = ui_menu_enumpropname(layout, &ptr, prop, value);
 
 	uiItemFullO_ptr(layout, ot, name, icon, ptr.data, layout->root->opcontext, 0);
@@ -883,15 +888,15 @@ void uiItemEnumO_string(uiLayout *layout, const char *name, int icon, const char
 	EnumPropertyItem *item;
 	int value, free;
 
-	UI_OPERATOR_ERROR_RET(ot, opname, return);
+	UI_OPERATOR_ERROR_RET(ot, opname, return );
 
 	WM_operator_properties_create_ptr(&ptr, ot);
 	
 	/* enum lookup */
-	if((prop= RNA_struct_find_property(&ptr, propname))) {
+	if ((prop = RNA_struct_find_property(&ptr, propname))) {
 		RNA_property_enum_items_gettexted(layout->root->block->evil_C, &ptr, prop, &item, NULL, &free);
-		if(item==NULL || RNA_enum_value_from_id(item, value_str, &value)==0) {
-			if(free) {
+		if (item == NULL || RNA_enum_value_from_id(item, value_str, &value) == 0) {
+			if (free) {
 				MEM_freeN(item);
 			}
 			RNA_warning("%s.%s, enum %s not found", RNA_struct_identifier(ptr.type), propname, value_str);
@@ -910,7 +915,7 @@ void uiItemEnumO_string(uiLayout *layout, const char *name, int icon, const char
 	RNA_property_enum_set(&ptr, prop, value);
 	
 	/* same as uiItemEnumO */
-	if(!name)
+	if (!name)
 		name = ui_menu_enumpropname(layout, &ptr, prop, value);
 
 	uiItemFullO_ptr(layout, ot, name, icon, ptr.data, layout->root->opcontext, 0);
@@ -921,7 +926,7 @@ void uiItemBooleanO(uiLayout *layout, const char *name, int icon, const char *op
 	wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
 	PointerRNA ptr;
 
-	UI_OPERATOR_ERROR_RET(ot, opname, return);
+	UI_OPERATOR_ERROR_RET(ot, opname, return );
 
 	WM_operator_properties_create_ptr(&ptr, ot);
 	RNA_boolean_set(&ptr, propname, value);
@@ -934,7 +939,7 @@ void uiItemIntO(uiLayout *layout, const char *name, int icon, const char *opname
 	wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
 	PointerRNA ptr;
 
-	UI_OPERATOR_ERROR_RET(ot, opname, return);
+	UI_OPERATOR_ERROR_RET(ot, opname, return );
 
 	WM_operator_properties_create_ptr(&ptr, ot);
 	RNA_int_set(&ptr, propname, value);
@@ -947,7 +952,7 @@ void uiItemFloatO(uiLayout *layout, const char *name, int icon, const char *opna
 	wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
 	PointerRNA ptr;
 
-	UI_OPERATOR_ERROR_RET(ot, opname, return);
+	UI_OPERATOR_ERROR_RET(ot, opname, return );
 
 	WM_operator_properties_create_ptr(&ptr, ot);
 	RNA_float_set(&ptr, propname, value);
@@ -960,7 +965,7 @@ void uiItemStringO(uiLayout *layout, const char *name, int icon, const char *opn
 	wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
 	PointerRNA ptr;
 
-	UI_OPERATOR_ERROR_RET(ot, opname, return);
+	UI_OPERATOR_ERROR_RET(ot, opname, return );
 
 	WM_operator_properties_create_ptr(&ptr, ot);
 	RNA_string_set(&ptr, propname, value);
@@ -982,46 +987,46 @@ static void ui_item_rna_size(uiLayout *layout, const char *name, int icon, Point
 	int len, w, h;
 
 	/* arbitrary extended width by type */
-	type= RNA_property_type(prop);
-	subtype= RNA_property_subtype(prop);
-	len= RNA_property_array_length(ptr, prop);
+	type = RNA_property_type(prop);
+	subtype = RNA_property_subtype(prop);
+	len = RNA_property_array_length(ptr, prop);
 
-	if(ELEM3(type, PROP_STRING, PROP_POINTER, PROP_ENUM) && !name[0] && !icon_only)
-		name= "non-empty text";
-	else if(type == PROP_BOOLEAN && !name[0] && !icon_only)
-		icon= ICON_DOT;
+	if (ELEM3(type, PROP_STRING, PROP_POINTER, PROP_ENUM) && !name[0] && !icon_only)
+		name = "non-empty text";
+	else if (type == PROP_BOOLEAN && !name[0] && !icon_only)
+		icon = ICON_DOT;
 
-	w= ui_text_icon_width(layout, name, icon, 0);
-	h= UI_UNIT_Y;
+	w = ui_text_icon_width(layout, name, icon, 0);
+	h = UI_UNIT_Y;
 
 	/* increase height for arrays */
-	if(index == RNA_NO_INDEX && len > 0) {
-		if(!name[0] && icon == ICON_NONE)
-			h= 0;
-
-		if(ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER))
-			h += 2*UI_UNIT_Y;
-		else if(subtype == PROP_MATRIX)
-			h += ceil(sqrt(len))*UI_UNIT_Y;
+	if (index == RNA_NO_INDEX && len > 0) {
+		if (!name[0] && icon == ICON_NONE)
+			h = 0;
+
+		if (ELEM(subtype, PROP_LAYER, PROP_LAYER_MEMBER))
+			h += 2 * UI_UNIT_Y;
+		else if (subtype == PROP_MATRIX)
+			h += ceil(sqrt(len)) * UI_UNIT_Y;
 		else
-			h += len*UI_UNIT_Y;
+			h += len * UI_UNIT_Y;
 	}
-	else if(ui_layout_vary_direction(layout) == UI_ITEM_VARY_X) {
-		if(type == PROP_BOOLEAN && name[0])
-			w += UI_UNIT_X/5;
-		else if(type == PROP_ENUM)
-			w += UI_UNIT_X/4;
-		else if(type == PROP_FLOAT || type == PROP_INT)
-			w += UI_UNIT_X*3;
+	else if (ui_layout_vary_direction(layout) == UI_ITEM_VARY_X) {
+		if (type == PROP_BOOLEAN && name[0])
+			w += UI_UNIT_X / 5;
+		else if (type == PROP_ENUM)
+			w += UI_UNIT_X / 4;
+		else if (type == PROP_FLOAT || type == PROP_INT)
+			w += UI_UNIT_X * 3;
 	}
 
-	*r_w= w;
-	*r_h= h;
+	*r_w = w;
+	*r_h = h;
 }
 
 void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index, int value, int flag, const char *name, int icon)
 {
-	uiBlock *block= layout->root->block;
+	uiBlock *block = layout->root->block;
 	uiBut *but;
 	PropertyType type;
 	char namestr[UI_MAX_NAME_STR];
@@ -1030,44 +1035,44 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
 	uiBlockSetCurLayout(block, layout);
 
 	/* retrieve info */
-	type= RNA_property_type(prop);
-	is_array= RNA_property_array_check(prop);
-	len= (is_array) ? RNA_property_array_length(ptr, prop) : 0;
+	type = RNA_property_type(prop);
+	is_array = RNA_property_array_check(prop);
+	len = (is_array) ? RNA_property_array_length(ptr, prop) : 0;
 
 	/* set name and icon */
-	if(!name)
-		name= RNA_property_ui_name(prop);
-	if(icon == ICON_NONE)
-		icon= RNA_property_ui_icon(prop);
+	if (!name)
+		name = RNA_property_ui_name(prop);
+	if (icon == ICON_NONE)
+		icon = RNA_property_ui_icon(prop);
 	
-	if(ELEM4(type, PROP_INT, PROP_FLOAT, PROP_STRING, PROP_POINTER))
-		name= ui_item_name_add_colon(name, namestr);
-	else if(type == PROP_BOOLEAN && is_array && index == RNA_NO_INDEX)
-		name= ui_item_name_add_colon(name, namestr);
-	else if(type == PROP_ENUM && index != RNA_ENUM_VALUE)
-		name= ui_item_name_add_colon(name, namestr);
-
-	if(layout->root->type == UI_LAYOUT_MENU) {
-		if(type == PROP_BOOLEAN && ((is_array == FALSE) || (index != RNA_NO_INDEX))) {
-			if(is_array) icon= (RNA_property_boolean_get_index(ptr, prop, index)) ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
-			else         icon= (RNA_property_boolean_get(ptr, prop)) ? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
+	if (ELEM4(type, PROP_INT, PROP_FLOAT, PROP_STRING, PROP_POINTER))
+		name = ui_item_name_add_colon(name, namestr);
+	else if (type == PROP_BOOLEAN && is_array && index == RNA_NO_INDEX)
+		name = ui_item_name_add_colon(name, namestr);
+	else if (type == PROP_ENUM && index != RNA_ENUM_VALUE)
+		name = ui_item_name_add_colon(name, namestr);
+
+	if (layout->root->type == UI_LAYOUT_MENU) {
+		if (type == PROP_BOOLEAN && ((is_array == FALSE) || (index != RNA_NO_INDEX))) {
+			if (is_array) icon = (RNA_property_boolean_get_index(ptr, prop, index)) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT;
+			else icon = (RNA_property_boolean_get(ptr, prop)) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT;
 		}
-		else if(type == PROP_ENUM && index == RNA_ENUM_VALUE) {
-			int enum_value= RNA_property_enum_get(ptr, prop);
-			if(RNA_property_flag(prop) & PROP_ENUM_FLAG) {
-				icon= (enum_value & value)? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
+		else if (type == PROP_ENUM && index == RNA_ENUM_VALUE) {
+			int enum_value = RNA_property_enum_get(ptr, prop);
+			if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
+				icon = (enum_value & value) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT;
 			}
 			else {
-				icon= (enum_value == value)? ICON_CHECKBOX_HLT: ICON_CHECKBOX_DEHLT;
+				icon = (enum_value == value) ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT;
 			}
 		}
 	}
 
-	slider= (flag & UI_ITEM_R_SLIDER);
-	toggle= (flag & UI_ITEM_R_TOGGLE);
-	expand= (flag & UI_ITEM_R_EXPAND);
-	icon_only= (flag & UI_ITEM_R_ICON_ONLY);
-	no_bg= (flag & UI_ITEM_R_NO_BG);
+	slider = (flag & UI_ITEM_R_SLIDER);
+	toggle = (flag & UI_ITEM_R_TOGGLE);
+	expand = (flag & UI_ITEM_R_EXPAND);
+	icon_only = (flag & UI_ITEM_R_ICON_ONLY);
+	no_bg = (flag & UI_ITEM_R_NO_BG);
 
 	/* get size */
 	ui_item_rna_size(layout, name, icon, ptr, prop, index, icon_only, &w, &h);
@@ -1076,39 +1081,39 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
 		uiBlockSetEmboss(block, UI_EMBOSSN);
 	
 	/* array property */
-	if(index == RNA_NO_INDEX && is_array)
+	if (index == RNA_NO_INDEX && is_array)
 		ui_item_array(layout, block, name, icon, ptr, prop, len, 0, 0, w, h, expand, slider, toggle, icon_only);
 	/* enum item */
-	else if(type == PROP_ENUM && index == RNA_ENUM_VALUE) {
-		if(icon && name[0] && !icon_only)
+	else if (type == PROP_ENUM && index == RNA_ENUM_VALUE) {
+		if (icon && name[0] && !icon_only)
 			uiDefIconTextButR_prop(block, ROW, 0, icon, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
-		else if(icon)
+		else if (icon)
 			uiDefIconButR_prop(block, ROW, 0, icon, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
 		else
 			uiDefButR_prop(block, ROW, 0, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, NULL);
 	}
 	/* expanded enum */
-	else if(type == PROP_ENUM && (expand || RNA_property_flag(prop) & PROP_ENUM_FLAG))
+	else if (type == PROP_ENUM && (expand || RNA_property_flag(prop) & PROP_ENUM_FLAG))
 		ui_item_enum_expand(layout, block, ptr, prop, name, h, icon_only);
 	/* property with separate label */
-	else if(type == PROP_ENUM || type == PROP_STRING || type == PROP_POINTER) {
-		but= ui_item_with_label(layout, block, name, icon, ptr, prop, index, 0, 0, w, h, flag);
+	else if (type == PROP_ENUM || type == PROP_STRING || type == PROP_POINTER) {
+		but = ui_item_with_label(layout, block, name, icon, ptr, prop, index, 0, 0, w, h, flag);
 		ui_but_add_search(but, ptr, prop, NULL, NULL);
 		
-		if(layout->redalert)
+		if (layout->redalert)
 			uiButSetFlag(but, UI_BUT_REDALERT);
 	}
 	/* single button */
 	else {
-		but= uiDefAutoButR(block, ptr, prop, index, name, icon, 0, 0, w, h);
+		but = uiDefAutoButR(block, ptr, prop, index, name, icon, 0, 0, w, h);
 
-		if(slider && but->type==NUM)
-			but->type= NUMSLI;
+		if (slider && but->type == NUM)
+			but->type = NUMSLI;
 
-		if(toggle && but->type==OPTION)
-			but->type= TOG;
+		if (toggle && but->type == OPTION)
+			but->type = TOG;
 		
-		if(layout->redalert)
+		if (layout->redalert)
 			uiButSetFlag(but, UI_BUT_REDALERT);
 	}
 	
@@ -1118,9 +1123,9 @@ void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index
 
 void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
 
-	if(!prop) {
+	if (!prop) {
 		ui_item_disabled(layout, propname);
 		RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
 		return;
@@ -1131,9 +1136,9 @@ void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, int flag,
 
 void uiItemEnumR(uiLayout *layout, const char *name, int icon, struct PointerRNA *ptr, const char *propname, int value)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
 
-	if(!prop || RNA_property_type(prop) != PROP_ENUM) {
+	if (!prop || RNA_property_type(prop) != PROP_ENUM) {
 		ui_item_disabled(layout, propname);
 		RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
 		return;
@@ -1144,11 +1149,11 @@ void uiItemEnumR(uiLayout *layout, const char *name, int icon, struct PointerRNA
 
 void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *value, const char *name, int icon)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
 	EnumPropertyItem *item;
 	int ivalue, a, free;
 
-	if(!prop || RNA_property_type(prop) != PROP_ENUM) {
+	if (!prop || RNA_property_type(prop) != PROP_ENUM) {
 		ui_item_disabled(layout, propname);
 		RNA_warning("enum property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
 		return;
@@ -1156,7 +1161,7 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *pr
 
 	RNA_property_enum_items_gettexted(layout->root->block->evil_C, ptr, prop, &item, NULL, &free);
 
-	if(!RNA_enum_value_from_id(item, value, &ivalue)) {
+	if (!RNA_enum_value_from_id(item, value, &ivalue)) {
 		if (free) {
 			MEM_freeN(item);
 		}
@@ -1165,8 +1170,8 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *pr
 		return;
 	}
 
-	for(a=0; item[a].identifier; a++) {
-		if(item[a].value == ivalue) {
+	for (a = 0; item[a].identifier; a++) {
+		if (item[a].value == ivalue) {
 			uiItemFullR(layout, ptr, prop, RNA_ENUM_VALUE, ivalue, 0, name ? name : item[a].name, icon ? icon : item[a].icon);
 			break;
 		}
@@ -1180,44 +1185,44 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *pr
 void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname)
 {
 	PropertyRNA *prop;
-	uiBlock *block= layout->root->block;
+	uiBlock *block = layout->root->block;
 	uiBut *bt;
 
-	prop= RNA_struct_find_property(ptr, propname);
+	prop = RNA_struct_find_property(ptr, propname);
 
-	if(!prop) {
+	if (!prop) {
 		ui_item_disabled(layout, propname);
 		RNA_warning("enum property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
 		return;
 	}
 
-	if(RNA_property_type(prop) != PROP_ENUM) {
+	if (RNA_property_type(prop) != PROP_ENUM) {
 		RNA_warning("not an enum property: %s.%s", RNA_struct_identifier(ptr->type), propname);
 		return;
 	}
 	else {
 		EnumPropertyItem *item;
 		int totitem, i, free;
-		uiLayout *split= uiLayoutSplit(layout, 0, 0);
-		uiLayout *column= uiLayoutColumn(split, 0);
+		uiLayout *split = uiLayoutSplit(layout, 0, 0);
+		uiLayout *column = uiLayoutColumn(split, 0);
 
 		RNA_property_enum_items_gettexted(block->evil_C, ptr, prop, &item, &totitem, &free);
 
-		for(i=0; i<totitem; i++) {
-			if(item[i].identifier[0]) {
+		for (i = 0; i < totitem; i++) {
+			if (item[i].identifier[0]) {
 				uiItemEnumR(column, item[i].name, ICON_NONE, ptr, propname, item[i].value);
 			}
 			else {
-				if(item[i].name) {
-					if(i != 0) {
-						column= uiLayoutColumn(split, 0);
+				if (item[i].name) {
+					if (i != 0) {
+						column = uiLayoutColumn(split, 0);
 						/* inconsistent, but menus with labels do not look good flipped */
 						block->flag |= UI_BLOCK_NO_FLIP;
 					}
 
 					uiItemL(column, item[i].name, ICON_NONE);
-					bt= block->buttons.last;
-					bt->flag= UI_TEXT_LEFT;
+					bt = block->buttons.last;
+					bt->flag = UI_TEXT_LEFT;
 				}
 				else
 					uiItemS(column);
@@ -1244,7 +1249,7 @@ static int sort_search_items_list(void *a, void *b)
 	CollItemSearch *cis1 = (CollItemSearch *)a;
 	CollItemSearch *cis2 = (CollItemSearch *)b;
 	
-	if (BLI_strcasecmp(cis1->name, cis2->name)>0)
+	if (BLI_strcasecmp(cis1->name, cis2->name) > 0)
 		return 1;
 	else
 		return 0;
@@ -1252,44 +1257,44 @@ static int sort_search_items_list(void *a, void *b)
 
 static void rna_search_cb(const struct bContext *C, void *arg_but, const char *str, uiSearchItems *items)
 {
-	uiBut *but= arg_but;
+	uiBut *but = arg_but;
 	char *name;
-	int i=0, iconid=0, flag= RNA_property_flag(but->rnaprop);
-	ListBase *items_list= MEM_callocN(sizeof(ListBase), "items_list");
+	int i = 0, iconid = 0, flag = RNA_property_flag(but->rnaprop);
+	ListBase *items_list = MEM_callocN(sizeof(ListBase), "items_list");
 	CollItemSearch *cis;
-	const int skip_filter= !but->changed;
+	const int skip_filter = !but->changed;
 
 	/* build a temporary list of relevant items first */
 	RNA_PROP_BEGIN(&but->rnasearchpoin, itemptr, but->rnasearchprop) {
-		if(flag & PROP_ID_SELF_CHECK)
-			if(itemptr.data == but->rnapoin.id.data)
+		if (flag & PROP_ID_SELF_CHECK)
+			if (itemptr.data == but->rnapoin.id.data)
 				continue;
 
 		/* use filter */
-		if(RNA_property_type(but->rnaprop)==PROP_POINTER) {
-			if(RNA_property_pointer_poll(&but->rnapoin, but->rnaprop, &itemptr)==0)
+		if (RNA_property_type(but->rnaprop) == PROP_POINTER) {
+			if (RNA_property_pointer_poll(&but->rnapoin, but->rnaprop, &itemptr) == 0)
 				continue;
 		}
 
-		if(itemptr.type && RNA_struct_is_ID(itemptr.type)) {
-			ID *id= itemptr.data;
+		if (itemptr.type && RNA_struct_is_ID(itemptr.type)) {
+			ID *id = itemptr.data;
 			char name_ui[MAX_ID_NAME];
 
-#if 0		/* this name is used for a string comparison and can't be modified, TODO */
+#if 0       /* this name is used for a string comparison and can't be modified, TODO */
 			name_uiprefix_id(name_ui, id);
 #else
-			BLI_strncpy(name_ui, id->name+2, sizeof(name_ui));
+			BLI_strncpy(name_ui, id->name + 2, sizeof(name_ui));
 #endif
-			name= BLI_strdup(name_ui);
-			iconid= ui_id_icon_get((bContext*)C, id, 1);
+			name = BLI_strdup(name_ui);
+			iconid = ui_id_icon_get((bContext *)C, id, 0);
 		}
 		else {
-			name= RNA_struct_name_get_alloc(&itemptr, NULL, 0, NULL); /* could use the string length here */
+			name = RNA_struct_name_get_alloc(&itemptr, NULL, 0, NULL); /* could use the string length here */
 			iconid = 0;
 		}
 
-		if(name) {
-			if(skip_filter || BLI_strcasestr(name, str)) {
+		if (name) {
+			if (skip_filter || BLI_strcasestr(name, str)) {
 				cis = MEM_callocN(sizeof(CollItemSearch), "CollectionItemSearch");
 				cis->name = MEM_dupallocN(name);
 				cis->index = i;
@@ -1306,13 +1311,13 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, const char *s
 	BLI_sortlist(items_list, sort_search_items_list);
 	
 	/* add search items from temporary list */
-	for (cis=items_list->first; cis; cis=cis->next) {
+	for (cis = items_list->first; cis; cis = cis->next) {
 		if (!uiSearchItemAdd(items, cis->name, SET_INT_IN_POINTER(cis->index), cis->iconid)) {
 			break;
 		}
 	}
 
-	for (cis=items_list->first; cis; cis=cis->next) {
+	for (cis = items_list->first; cis; cis = cis->next) {
 		MEM_freeN(cis->name);
 	}
 	BLI_freelistN(items_list);
@@ -1326,15 +1331,15 @@ static void search_id_collection(StructRNA *ptype, PointerRNA *ptr, PropertyRNA
 	/* look for collection property in Main */
 	RNA_main_pointer_create(G.main, ptr);
 
-	*prop= NULL;
+	*prop = NULL;
 
 	RNA_STRUCT_BEGIN(ptr, iprop) {
 		/* if it's a collection and has same pointer type, we've got it */
-		if(RNA_property_type(iprop) == PROP_COLLECTION) {
-			srna= RNA_property_pointer_type(ptr, iprop);
+		if (RNA_property_type(iprop) == PROP_COLLECTION) {
+			srna = RNA_property_pointer_type(ptr, iprop);
 
-			if(ptype == srna) {
-				*prop= iprop;
+			if (ptype == srna) {
+				*prop = iprop;
 				break;
 			}
 		}
@@ -1348,21 +1353,21 @@ void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRN
 	PointerRNA sptr;
 
 	/* for ID's we do automatic lookup */
-	if(!searchprop) {
-		if(RNA_property_type(prop) == PROP_POINTER) {
-			ptype= RNA_property_pointer_type(ptr, prop);
+	if (!searchprop) {
+		if (RNA_property_type(prop) == PROP_POINTER) {
+			ptype = RNA_property_pointer_type(ptr, prop);
 			search_id_collection(ptype, &sptr, &searchprop);
-			searchptr= &sptr;
+			searchptr = &sptr;
 		}
 	}
 
 	/* turn button into search button */
-	if(searchprop) {
-		but->type= SEARCH_MENU;
-		but->hardmax= MAX2(but->hardmax, 256);
-		but->rnasearchpoin= *searchptr;
-		but->rnasearchprop= searchprop;
-		but->flag |= UI_ICON_LEFT|UI_TEXT_LEFT;
+	if (searchprop) {
+		but->type = SEARCH_MENU;
+		but->hardmax = MAX2(but->hardmax, 256);
+		but->rnasearchpoin = *searchptr;
+		but->rnasearchprop = searchprop;
+		but->flag |= UI_ICON_LEFT | UI_TEXT_LEFT;
 
 		uiButSetSearchFunc(but, rna_search_cb, but, NULL, NULL);
 	}
@@ -1378,23 +1383,23 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna
 	int w, h;
 	
 	/* validate arguments */
-	prop= RNA_struct_find_property(ptr, propname);
+	prop = RNA_struct_find_property(ptr, propname);
 
-	if(!prop) {
+	if (!prop) {
 		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)) {
+	type = RNA_property_type(prop);
+	if (!ELEM(type, PROP_POINTER, PROP_STRING)) {
 		RNA_warning("Property %s must be a pointer or string", propname);
 		return;
 	}
 
-	searchprop= RNA_struct_find_property(searchptr, searchpropname);
+	searchprop = RNA_struct_find_property(searchptr, searchpropname);
 
 
-	if(!searchprop) {
+	if (!searchprop) {
 		RNA_warning("search collection property not found: %s.%s", RNA_struct_identifier(ptr->type), searchpropname);
 		return;
 	}
@@ -1404,22 +1409,22 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna
 	}
 
 	/* get icon & name */
-	if(icon==ICON_NONE) {
-		if(type == PROP_POINTER)
-			icontype= RNA_property_pointer_type(ptr, prop);
+	if (icon == ICON_NONE) {
+		if (type == PROP_POINTER)
+			icontype = RNA_property_pointer_type(ptr, prop);
 		else
-			icontype= RNA_property_pointer_type(searchptr, searchprop);
+			icontype = RNA_property_pointer_type(searchptr, searchprop);
 
-		icon= RNA_struct_ui_icon(icontype);
+		icon = RNA_struct_ui_icon(icontype);
 	}
-	if(!name)
-		name= RNA_property_ui_name(prop);
+	if (!name)
+		name = RNA_property_ui_name(prop);
 
 	/* create button */
-	block= uiLayoutGetBlock(layout);
+	block = uiLayoutGetBlock(layout);
 
 	ui_item_rna_size(layout, name, icon, ptr, prop, 0, 0, &w, &h);
-	but= ui_item_with_label(layout, block, name, icon, ptr, prop, 0, 0, 0, w, h, 0);
+	but = ui_item_with_label(layout, block, name, icon, ptr, prop, 0, 0, 0, w, h, 0);
 
 	ui_but_add_search(but, ptr, prop, searchptr, searchprop);
 }
@@ -1427,52 +1432,52 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna
 /* menu item */
 static void ui_item_menutype_func(bContext *C, uiLayout *layout, void *arg_mt)
 {
-	MenuType *mt= (MenuType*)arg_mt;
+	MenuType *mt = (MenuType *)arg_mt;
 	Menu menu = {NULL};
 
-	menu.type= mt;
-	menu.layout= layout;
+	menu.type = mt;
+	menu.layout = layout;
 	mt->draw(C, &menu);
 }
 
 static void ui_item_menu(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg, void *argN, const char *tip)
 {
-	uiBlock *block= layout->root->block;
+	uiBlock *block = layout->root->block;
 	uiBut *but;
 	int w, h;
 
 	uiBlockSetCurLayout(block, layout);
 
-	if(layout->root->type == UI_LAYOUT_HEADER)
+	if (layout->root->type == UI_LAYOUT_HEADER)
 		uiBlockSetEmboss(block, UI_EMBOSS);
 
-	if(!name)
-		name= "";
-	if(layout->root->type == UI_LAYOUT_MENU && !icon)
-		icon= ICON_BLANK1;
+	if (!name)
+		name = "";
+	if (layout->root->type == UI_LAYOUT_MENU && !icon)
+		icon = ICON_BLANK1;
 
-	w= ui_text_icon_width(layout, name, icon, 1);
-	h= UI_UNIT_Y;
+	w = ui_text_icon_width(layout, name, icon, 1);
+	h = UI_UNIT_Y;
 
-	if(layout->root->type == UI_LAYOUT_HEADER) /* ugly .. */
+	if (layout->root->type == UI_LAYOUT_HEADER) /* ugly .. */
 		w -= 10;
 
-	if(name[0] && icon)
-		but= uiDefIconTextMenuBut(block, func, arg, icon, name, 0, 0, w, h, tip);
-	else if(icon)
-		but= uiDefIconMenuBut(block, func, arg, icon, 0, 0, w, h, tip);
+	if (name[0] && icon)
+		but = uiDefIconTextMenuBut(block, func, arg, icon, name, 0, 0, w, h, tip);
+	else if (icon)
+		but = uiDefIconMenuBut(block, func, arg, icon, 0, 0, w, h, tip);
 	else
-		but= uiDefMenuBut(block, func, arg, name, 0, 0, w, h, tip);
+		but = uiDefMenuBut(block, func, arg, name, 0, 0, w, h, tip);
 
-	if(argN) { /* ugly .. */
-		but->poin= (char*)but;
-		but->func_argN= argN;
+	if (argN) { /* ugly .. */
+		but->poin = (char *)but;
+		but->func_argN = argN;
 	}
 
-	if(layout->root->type == UI_LAYOUT_HEADER)
+	if (layout->root->type == UI_LAYOUT_HEADER)
 		uiBlockSetEmboss(block, UI_EMBOSS);
-	else if(ELEM(layout->root->type, UI_LAYOUT_PANEL, UI_LAYOUT_TOOLBAR)) {
-		but->type= MENU;
+	else if (ELEM(layout->root->type, UI_LAYOUT_PANEL, UI_LAYOUT_TOOLBAR)) {
+		but->type = MENU;
 		but->flag |= UI_TEXT_LEFT;
 	}
 }
@@ -1481,45 +1486,45 @@ void uiItemM(uiLayout *layout, bContext *UNUSED(C), const char *menuname, const
 {
 	MenuType *mt;
 
-	mt= WM_menutype_find(menuname, FALSE);
+	mt = WM_menutype_find(menuname, FALSE);
 
-	if(mt==NULL) {
+	if (mt == NULL) {
 		RNA_warning("not found %s", menuname);
 		return;
 	}
 
-	if(!name) {
-		name= IFACE_(mt->label);
+	if (!name) {
+		name = IFACE_(mt->label);
 	}
 
-	if(layout->root->type == UI_LAYOUT_MENU && !icon)
-		icon= ICON_BLANK1;
+	if (layout->root->type == UI_LAYOUT_MENU && !icon)
+		icon = ICON_BLANK1;
 
-	ui_item_menu(layout, name, icon, ui_item_menutype_func, mt, NULL, mt->description);
+	ui_item_menu(layout, name, icon, ui_item_menutype_func, mt, NULL, TIP_(mt->description));
 }
 
 /* label item */
 static uiBut *uiItemL_(uiLayout *layout, const char *name, int icon)
 {
-	uiBlock *block= layout->root->block;
+	uiBlock *block = layout->root->block;
 	uiBut *but;
 	int w;
 
 	uiBlockSetCurLayout(block, layout);
 
-	if(!name)
-		name= "";
-	if(layout->root->type == UI_LAYOUT_MENU && !icon)
-		icon= ICON_BLANK1;
+	if (!name)
+		name = "";
+	if (layout->root->type == UI_LAYOUT_MENU && !icon)
+		icon = ICON_BLANK1;
 
-	w= ui_text_icon_width(layout, name, icon, 0);
+	w = ui_text_icon_width(layout, name, icon, 0);
 
-	if(icon && name[0])
-		but= uiDefIconTextBut(block, LABEL, 0, icon, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
-	else if(icon)
-		but= uiDefIconBut(block, LABEL, 0, icon, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+	if (icon && name[0])
+		but = uiDefIconTextBut(block, LABEL, 0, icon, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+	else if (icon)
+		but = uiDefIconBut(block, LABEL, 0, icon, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
 	else
-		but= uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+		but = uiDefBut(block, LABEL, 0, name, 0, 0, w, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
 	
 	return but;
 }
@@ -1531,10 +1536,10 @@ void uiItemL(uiLayout *layout, const char *name, int icon)
 
 void uiItemLDrag(uiLayout *layout, PointerRNA *ptr, const char *name, int icon)
 {
-	uiBut *but= uiItemL_(layout, name, icon);
+	uiBut *but = uiItemL_(layout, name, icon);
 
-	if(ptr && ptr->type)
-		if(RNA_struct_is_ID(ptr->type))
+	if (ptr && ptr->type)
+		if (RNA_struct_is_ID(ptr->type))
 			uiButSetDragID(but, ptr->id.data);
 }
 
@@ -1543,22 +1548,22 @@ void uiItemLDrag(uiLayout *layout, PointerRNA *ptr, const char *name, int icon)
 void uiItemV(uiLayout *layout, const char *name, int icon, int argval)
 {
 	/* label */
-	uiBlock *block= layout->root->block;
-	float *retvalue= (block->handle)? &block->handle->retvalue: NULL;
+	uiBlock *block = layout->root->block;
+	float *retvalue = (block->handle) ? &block->handle->retvalue : NULL;
 	int w;
 
 	uiBlockSetCurLayout(block, layout);
 
-	if(!name)
-		name= "";
-	if(layout->root->type == UI_LAYOUT_MENU && !icon)
-		icon= ICON_BLANK1;
+	if (!name)
+		name = "";
+	if (layout->root->type == UI_LAYOUT_MENU && !icon)
+		icon = ICON_BLANK1;
 
-	w= ui_text_icon_width(layout, name, icon, 0);
+	w = ui_text_icon_width(layout, name, icon, 0);
 
-	if(icon && name[0])
+	if (icon && name[0])
 		uiDefIconTextButF(block, BUT, argval, icon, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, 0, "");
-	else if(icon)
+	else if (icon)
 		uiDefIconButF(block, BUT, argval, icon, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, 0, "");
 	else
 		uiDefButF(block, BUT, argval, name, 0, 0, w, UI_UNIT_Y, retvalue, 0.0, 0.0, 0, 0, "");
@@ -1567,7 +1572,7 @@ void uiItemV(uiLayout *layout, const char *name, int icon, int argval)
 /* separator item */
 void uiItemS(uiLayout *layout)
 {
-	uiBlock *block= layout->root->block;
+	uiBlock *block = layout->root->block;
 
 	uiBlockSetCurLayout(block, layout);
 	uiDefBut(block, SEPR, 0, "", 0, 0, EM_SEPR_X, EM_SEPR_Y, NULL, 0.0, 0.0, 0, 0, "");
@@ -1576,7 +1581,7 @@ void uiItemS(uiLayout *layout)
 /* level items */
 void uiItemMenuF(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg)
 {
-	if(!func)
+	if (!func)
 		return;
 
 	ui_item_menu(layout, name, icon, func, arg, NULL, "");
@@ -1584,7 +1589,7 @@ void uiItemMenuF(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc
 
 typedef struct MenuItemLevel {
 	int opcontext;
-	/* dont use pointers to the strings because python can dynamically
+	/* don't use pointers to the strings because python can dynamically
 	 * allocate strings and free before the menu draws, see [#27304] */
 	char opname[OP_MAX_TYPENAME];
 	char propname[MAX_IDPROP_NAME];
@@ -1593,7 +1598,7 @@ typedef struct MenuItemLevel {
 
 static void menu_item_enum_opname_menu(bContext *UNUSED(C), uiLayout *layout, void *arg)
 {
-	MenuItemLevel *lvl= (MenuItemLevel*)(((uiBut*)arg)->func_argN);
+	MenuItemLevel *lvl = (MenuItemLevel *)(((uiBut *)arg)->func_argN);
 
 	uiLayoutSetOperatorContext(layout, lvl->opcontext);
 	uiItemsEnumO(layout, lvl->opname, lvl->propname);
@@ -1604,30 +1609,30 @@ void uiItemMenuEnumO(uiLayout *layout, const char *opname, const char *propname,
 	wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
 	MenuItemLevel *lvl;
 
-	UI_OPERATOR_ERROR_RET(ot, opname, return);
+	UI_OPERATOR_ERROR_RET(ot, opname, return );
 
-	if(!ot->srna) {
+	if (!ot->srna) {
 		ui_item_disabled(layout, opname);
 		RNA_warning("operator missing srna '%s'", opname);
 		return;
 	}
 
-	if(!name)
-		name= ot->name;
-	if(layout->root->type == UI_LAYOUT_MENU && !icon)
-		icon= ICON_BLANK1;
+	if (!name)
+		name = RNA_struct_ui_name(ot->srna);
+	if (layout->root->type == UI_LAYOUT_MENU && !icon)
+		icon = ICON_BLANK1;
 
-	lvl= MEM_callocN(sizeof(MenuItemLevel), "MenuItemLevel");
+	lvl = MEM_callocN(sizeof(MenuItemLevel), "MenuItemLevel");
 	BLI_strncpy(lvl->opname, opname, sizeof(lvl->opname));
 	BLI_strncpy(lvl->propname, propname, sizeof(lvl->propname));
-	lvl->opcontext= layout->root->opcontext;
+	lvl->opcontext = layout->root->opcontext;
 
-	ui_item_menu(layout, name, icon, menu_item_enum_opname_menu, NULL, lvl, ot->description);
+	ui_item_menu(layout, name, icon, menu_item_enum_opname_menu, NULL, lvl, RNA_struct_ui_description(ot->srna));
 }
 
 static void menu_item_enum_rna_menu(bContext *UNUSED(C), uiLayout *layout, void *arg)
 {
-	MenuItemLevel *lvl= (MenuItemLevel*)(((uiBut*)arg)->func_argN);
+	MenuItemLevel *lvl = (MenuItemLevel *)(((uiBut *)arg)->func_argN);
 
 	uiLayoutSetOperatorContext(layout, lvl->opcontext);
 	uiItemsEnumR(layout, &lvl->rnapoin, lvl->propname);
@@ -1638,22 +1643,22 @@ void uiItemMenuEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propn
 	MenuItemLevel *lvl;
 	PropertyRNA *prop;
 
-	prop= RNA_struct_find_property(ptr, propname);
-	if(!prop) {
+	prop = RNA_struct_find_property(ptr, propname);
+	if (!prop) {
 		ui_item_disabled(layout, propname);
 		RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
 		return;
 	}
 
-	if(!name)
-		name= RNA_property_ui_name(prop);
-	if(layout->root->type == UI_LAYOUT_MENU && !icon)
-		icon= ICON_BLANK1;
+	if (!name)
+		name = RNA_property_ui_name(prop);
+	if (layout->root->type == UI_LAYOUT_MENU && !icon)
+		icon = ICON_BLANK1;
 
-	lvl= MEM_callocN(sizeof(MenuItemLevel), "MenuItemLevel");
-	lvl->rnapoin= *ptr;
+	lvl = MEM_callocN(sizeof(MenuItemLevel), "MenuItemLevel");
+	lvl->rnapoin = *ptr;
 	BLI_strncpy(lvl->propname, propname, sizeof(lvl->propname));
-	lvl->opcontext= layout->root->opcontext;
+	lvl->opcontext = layout->root->opcontext;
 
 	ui_item_menu(layout, name, icon, menu_item_enum_rna_menu, NULL, lvl, RNA_property_description(prop));
 }
@@ -1666,129 +1671,129 @@ static void ui_litem_estimate_row(uiLayout *litem)
 	uiItem *item;
 	int itemw, itemh;
 
-	litem->w= 0;
-	litem->h= 0;
+	litem->w = 0;
+	litem->h = 0;
 
-	for(item=litem->items.first; item; item=item->next) {
+	for (item = litem->items.first; item; item = item->next) {
 		ui_item_size(item, &itemw, &itemh);
 
 		litem->w += itemw;
-		litem->h= MAX2(itemh, litem->h);
+		litem->h = MAX2(itemh, litem->h);
 
-		if(item->next)
+		if (item->next)
 			litem->w += litem->space;
 	}
 }
 
 static int ui_litem_min_width(int itemw)
 {
-	return MIN2(2*UI_UNIT_X, itemw);
+	return MIN2(2 * UI_UNIT_X, itemw);
 }
 
 static void ui_litem_layout_row(uiLayout *litem)
 {
 	uiItem *item;
 	int x, y, w, tot, totw, neww, itemw, minw, itemh, offset;
-	int fixedw, freew, fixedx, freex, flag= 0, lastw= 0;
+	int fixedw, freew, fixedx, freex, flag = 0, lastw = 0;
 
 	/* x= litem->x; */ /* UNUSED */
-	y= litem->y;
-	w= litem->w;
-	totw= 0;
-	tot= 0;
+	y = litem->y;
+	w = litem->w;
+	totw = 0;
+	tot = 0;
 
-	for(item=litem->items.first; item; item=item->next) {
+	for (item = litem->items.first; item; item = item->next) {
 		ui_item_size(item, &itemw, &itemh);
 		totw += itemw;
 		tot++;
 	}
 
-	if(totw == 0)
+	if (totw == 0)
 		return;
 	
-	if(w != 0)
-		w -= (tot-1)*litem->space;
-	fixedw= 0;
+	if (w != 0)
+		w -= (tot - 1) * litem->space;
+	fixedw = 0;
 
 	/* keep clamping items to fixed minimum size until all are done */
 	do {
-		freew= 0;
-		x= 0;
-		flag= 0;
+		freew = 0;
+		x = 0;
+		flag = 0;
 
-		for(item=litem->items.first; item; item=item->next) {
-			if(item->flag)
+		for (item = litem->items.first; item; item = item->next) {
+			if (item->flag)
 				continue;
 
 			ui_item_size(item, &itemw, &itemh);
-			minw= ui_litem_min_width(itemw);
+			minw = ui_litem_min_width(itemw);
 
-			if(w - lastw > 0)
-				neww= ui_item_fit(itemw, x, totw, w-lastw, !item->next, litem->alignment, NULL);
+			if (w - lastw > 0)
+				neww = ui_item_fit(itemw, x, totw, w - lastw, !item->next, litem->alignment, NULL);
 			else
-				neww= 0; /* no space left, all will need clamping to minimum size */
+				neww = 0;  /* no space left, all will need clamping to minimum size */
 
 			x += neww;
 
-			if((neww < minw || itemw == minw) && w != 0) {
+			if ((neww < minw || itemw == minw) && w != 0) {
 				/* fixed size */
-				item->flag= 1;
+				item->flag = 1;
 				fixedw += minw;
-				flag= 1;
+				flag = 1;
 				totw -= itemw;
 			}
 			else {
 				/* keep free size */
-				item->flag= 0;
+				item->flag = 0;
 				freew += itemw;
 			}
 		}
 
-		lastw= fixedw;
-	} while(flag);
+		lastw = fixedw;
+	} while (flag);
 
-	freex= 0;
-	fixedx= 0;
-	x= litem->x;
+	freex = 0;
+	fixedx = 0;
+	x = litem->x;
 
-	for(item=litem->items.first; item; item=item->next) {
+	for (item = litem->items.first; item; item = item->next) {
 		ui_item_size(item, &itemw, &itemh);
-		minw= ui_litem_min_width(itemw);
+		minw = ui_litem_min_width(itemw);
 
-		if(item->flag) {
+		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, MIN2(w, fixedw), !item->next, litem->alignment, NULL);
 			fixedx += itemw;
 		}
 		else {
 			/* free size item */
-			itemw= ui_item_fit(itemw, freex, freew, w-fixedw, !item->next, litem->alignment, NULL);
+			itemw = ui_item_fit(itemw, freex, freew, w - fixedw, !item->next, litem->alignment, NULL);
 			freex += itemw;
 		}
 
 		/* align right/center */
-		offset= 0;
-		if(litem->alignment == UI_LAYOUT_ALIGN_RIGHT) {
-			if(freew > 0 && freew < w-fixedw)
-				offset= (w - fixedw) - freew;
+		offset = 0;
+		if (litem->alignment == UI_LAYOUT_ALIGN_RIGHT) {
+			if (freew > 0 && freew < w - fixedw)
+				offset = (w - fixedw) - freew;
 		}
-		else if(litem->alignment == UI_LAYOUT_ALIGN_CENTER) {
-			if(freew > 0 && freew < w-fixedw)
-				offset= ((w - fixedw) - freew)/2;
+		else if (litem->alignment == UI_LAYOUT_ALIGN_CENTER) {
+			if (freew > 0 && freew < w - fixedw)
+				offset = ((w - fixedw) - freew) / 2;
 		}
 
 		/* position item */
-		ui_item_position(item, x+offset, y-itemh, itemw, itemh);
+		ui_item_position(item, x + offset, y - itemh, itemw, itemh);
 
 		x += itemw;
-		if(item->next)
+		if (item->next)
 			x += litem->space;
 	}
 
-	litem->w= x - litem->x;
-	litem->h= litem->y - y;
-	litem->x= x;
-	litem->y= y;
+	litem->w = x - litem->x;
+	litem->h = litem->y - y;
+	litem->x = x;
+	litem->y = y;
 }
 
 /* single-column layout */
@@ -1797,16 +1802,16 @@ static void ui_litem_estimate_column(uiLayout *litem)
 	uiItem *item;
 	int itemw, itemh;
 
-	litem->w= 0;
-	litem->h= 0;
+	litem->w = 0;
+	litem->h = 0;
 
-	for(item=litem->items.first; item; item=item->next) {
+	for (item = litem->items.first; item; item = item->next) {
 		ui_item_size(item, &itemw, &itemh);
 
-		litem->w= MAX2(litem->w, itemw);
+		litem->w = MAX2(litem->w, itemw);
 		litem->h += itemh;
 
-		if(item->next)
+		if (item->next)
 			litem->h += litem->space;
 	}
 }
@@ -1816,22 +1821,22 @@ static void ui_litem_layout_column(uiLayout *litem)
 	uiItem *item;
 	int itemh, x, y;
 
-	x= litem->x;
-	y= litem->y;
+	x = litem->x;
+	y = litem->y;
 
-	for(item=litem->items.first; item; item=item->next) {
+	for (item = litem->items.first; item; item = item->next) {
 		ui_item_size(item, NULL, &itemh);
 
 		y -= itemh;
 		ui_item_position(item, x, y, litem->w, itemh);
 
-		if(item->next)
+		if (item->next)
 			y -= litem->space;
 	}
 
-	litem->h= litem->y - y;
-	litem->x= x;
-	litem->y= y;
+	litem->h = litem->y - y;
+	litem->x = x;
+	litem->y = y;
 }
 
 /* root layout */
@@ -1842,7 +1847,7 @@ static void ui_litem_estimate_root(uiLayout *UNUSED(litem))
 
 static void ui_litem_layout_root(uiLayout *litem)
 {
-	if(litem->root->type == UI_LAYOUT_HEADER)
+	if (litem->root->type == UI_LAYOUT_HEADER)
 		ui_litem_layout_row(litem);
 	else
 		ui_litem_layout_column(litem);
@@ -1851,157 +1856,157 @@ static void ui_litem_layout_root(uiLayout *litem)
 /* box layout */
 static void ui_litem_estimate_box(uiLayout *litem)
 {
-	uiStyle *style= litem->root->style;
+	uiStyle *style = litem->root->style;
 
 	ui_litem_estimate_column(litem);
-	litem->w += 2*style->boxspace;
+	litem->w += 2 * style->boxspace;
 	litem->h += style->boxspace;
 }
 
 static void ui_litem_layout_box(uiLayout *litem)
 {
-	uiLayoutItemBx *box= (uiLayoutItemBx*)litem;
-	uiStyle *style= litem->root->style;
+	uiLayoutItemBx *box = (uiLayoutItemBx *)litem;
+	uiStyle *style = litem->root->style;
 	uiBut *but;
 	int w, h;
 
-	w= litem->w;
-	h= litem->h;
+	w = litem->w;
+	h = litem->h;
 
 	litem->x += style->boxspace;
 
-	if(w != 0) litem->w -= 2*style->boxspace;
-	if(h != 0) litem->h -= 2*style->boxspace;
+	if (w != 0) litem->w -= 2 * style->boxspace;
+	if (h != 0) litem->h -= 2 * style->boxspace;
 
 	ui_litem_layout_column(litem);
 
 	litem->x -= style->boxspace;
 	litem->y -= style->boxspace;
 
-	if(w != 0) litem->w += 2*style->boxspace;
-	if(h != 0) litem->h += style->boxspace;
+	if (w != 0) litem->w += 2 * style->boxspace;
+	if (h != 0) litem->h += style->boxspace;
 
 	/* roundbox around the sublayout */
-	but= box->roundbox;
-	but->x1= litem->x;
-	but->y1= litem->y;
-	but->x2= litem->x+litem->w;
-	but->y2= litem->y+litem->h;
+	but = box->roundbox;
+	but->x1 = litem->x;
+	but->y1 = litem->y;
+	but->x2 = litem->x + litem->w;
+	but->y2 = litem->y + litem->h;
 }
 
 /* multi-column layout, automatically flowing to the next */
 static void ui_litem_estimate_column_flow(uiLayout *litem)
 {
-	uiStyle *style= litem->root->style;
-	uiLayoutItemFlow *flow= (uiLayoutItemFlow*)litem;
+	uiStyle *style = litem->root->style;
+	uiLayoutItemFlow *flow = (uiLayoutItemFlow *)litem;
 	uiItem *item;
-	int col, x, y, emh, emy, miny, itemw, itemh, maxw=0;
+	int col, x, y, emh, emy, miny, itemw, itemh, maxw = 0;
 	int toth, totitem;
 
 	/* compute max needed width and total height */
-	toth= 0;
-	totitem= 0;
-	for(item=litem->items.first; item; item=item->next) {
+	toth = 0;
+	totitem = 0;
+	for (item = litem->items.first; item; item = item->next) {
 		ui_item_size(item, &itemw, &itemh);
-		maxw= MAX2(maxw, itemw);
+		maxw = MAX2(maxw, itemw);
 		toth += itemh;
 		totitem++;
 	}
 
-	if(flow->number <= 0) {
+	if (flow->number <= 0) {
 		/* auto compute number of columns, not very good */
-		if(maxw == 0) {
-			flow->totcol= 1;
+		if (maxw == 0) {
+			flow->totcol = 1;
 			return;
 		}
 
-		flow->totcol= MAX2(litem->root->emw/maxw, 1);
-		flow->totcol= MIN2(flow->totcol, totitem);
+		flow->totcol = MAX2(litem->root->emw / maxw, 1);
+		flow->totcol = MIN2(flow->totcol, totitem);
 	}
 	else
-		flow->totcol= flow->number;
+		flow->totcol = flow->number;
 
 	/* compute sizes */
-	x= 0;
-	y= 0;
-	emy= 0;
-	miny= 0;
+	x = 0;
+	y = 0;
+	emy = 0;
+	miny = 0;
 
-	maxw= 0;
-	emh= toth/flow->totcol;
+	maxw = 0;
+	emh = toth / flow->totcol;
 
 	/* create column per column */
-	col= 0;
-	for(item=litem->items.first; item; item=item->next) {
+	col = 0;
+	for (item = litem->items.first; item; item = item->next) {
 		ui_item_size(item, &itemw, &itemh);
 
 		y -= itemh + style->buttonspacey;
-		miny= MIN2(miny, y);
+		miny = MIN2(miny, y);
 		emy -= itemh;
-		maxw= MAX2(itemw, maxw);
+		maxw = MAX2(itemw, maxw);
 
 		/* decide to go to next one */
-		if(col < flow->totcol-1 && emy <= -emh) {
+		if (col < flow->totcol - 1 && emy <= -emh) {
 			x += maxw + litem->space;
-			maxw= 0;
-			y= 0;
+			maxw = 0;
+			y = 0;
 			col++;
 		}
 	}
 
-	litem->w= x;
-	litem->h= litem->y - miny;
+	litem->w = x;
+	litem->h = litem->y - miny;
 }
 
 static void ui_litem_layout_column_flow(uiLayout *litem)
 {
-	uiStyle *style= litem->root->style;
-	uiLayoutItemFlow *flow= (uiLayoutItemFlow*)litem;
+	uiStyle *style = litem->root->style;
+	uiLayoutItemFlow *flow = (uiLayoutItemFlow *)litem;
 	uiItem *item;
 	int col, x, y, w, emh, emy, miny, itemw, itemh;
 	int toth, totitem, offset;
 
 	/* compute max needed width and total height */
-	toth= 0;
-	totitem= 0;
-	for(item=litem->items.first; item; item=item->next) {
+	toth = 0;
+	totitem = 0;
+	for (item = litem->items.first; item; item = item->next) {
 		ui_item_size(item, &itemw, &itemh);
 		toth += itemh;
 		totitem++;
 	}
 
 	/* compute sizes */
-	x= litem->x;
-	y= litem->y;
-	emy= 0;
-	miny= 0;
+	x = litem->x;
+	y = litem->y;
+	emy = 0;
+	miny = 0;
 
-	w= litem->w - (flow->totcol-1)*style->columnspace;
-	emh= toth/flow->totcol;
+	w = litem->w - (flow->totcol - 1) * style->columnspace;
+	emh = toth / flow->totcol;
 
 	/* create column per column */
-	col= 0;
-	for(item=litem->items.first; item; item=item->next) {
+	col = 0;
+	for (item = litem->items.first; item; item = item->next) {
 		ui_item_size(item, NULL, &itemh);
-		itemw= ui_item_fit(1, x-litem->x, flow->totcol, w, col == flow->totcol-1, litem->alignment, &offset);
+		itemw = ui_item_fit(1, x - litem->x, flow->totcol, w, col == flow->totcol - 1, litem->alignment, &offset);
 	
 		y -= itemh;
 		emy -= itemh;
-		ui_item_position(item, x+offset, y, itemw, itemh);
+		ui_item_position(item, x + offset, y, itemw, itemh);
 		y -= style->buttonspacey;
-		miny= MIN2(miny, y);
+		miny = MIN2(miny, y);
 
 		/* decide to go to next one */
-		if(col < flow->totcol-1 && emy <= -emh) {
+		if (col < flow->totcol - 1 && emy <= -emh) {
 			x += itemw + style->columnspace;
-			y= litem->y;
+			y = litem->y;
 			col++;
 		}
 	}
 
-	litem->h= litem->y - miny;
-	litem->x= x;
-	litem->y= miny;
+	litem->h = litem->y - miny;
+	litem->x = x;
+	litem->y = miny;
 }
 
 /* free layout */
@@ -2010,20 +2015,20 @@ static void ui_litem_estimate_absolute(uiLayout *litem)
 	uiItem *item;
 	int itemx, itemy, itemw, itemh, minx, miny;
 
-	minx= 1e6;
-	miny= 1e6;
-	litem->w= 0;
-	litem->h= 0;
+	minx = 1e6;
+	miny = 1e6;
+	litem->w = 0;
+	litem->h = 0;
 
-	for(item=litem->items.first; item; item=item->next) {
+	for (item = litem->items.first; item; item = item->next) {
 		ui_item_offset(item, &itemx, &itemy);
 		ui_item_size(item, &itemw, &itemh);
 
-		minx= MIN2(minx, itemx);
-		miny= MIN2(miny, itemy);
+		minx = MIN2(minx, itemx);
+		miny = MIN2(miny, itemy);
 
-		litem->w= MAX2(litem->w, itemx+itemw);
-		litem->h= MAX2(litem->h, itemy+itemh);
+		litem->w = MAX2(litem->w, itemx + itemw);
+		litem->h = MAX2(litem->h, itemy + itemh);
 	}
 
 	litem->w -= minx;
@@ -2033,59 +2038,59 @@ static void ui_litem_estimate_absolute(uiLayout *litem)
 static void ui_litem_layout_absolute(uiLayout *litem)
 {
 	uiItem *item;
-	float scalex=1.0f, scaley=1.0f;
+	float scalex = 1.0f, scaley = 1.0f;
 	int x, y, newx, newy, itemx, itemy, itemh, itemw, minx, miny, totw, toth;
 
-	minx= 1e6;
-	miny= 1e6;
-	totw= 0;
-	toth= 0;
+	minx = 1e6;
+	miny = 1e6;
+	totw = 0;
+	toth = 0;
 
-	for(item=litem->items.first; item; item=item->next) {
+	for (item = litem->items.first; item; item = item->next) {
 		ui_item_offset(item, &itemx, &itemy);
 		ui_item_size(item, &itemw, &itemh);
 
-		minx= MIN2(minx, itemx);
-		miny= MIN2(miny, itemy);
+		minx = MIN2(minx, itemx);
+		miny = MIN2(miny, itemy);
 
-		totw= MAX2(totw, itemx+itemw);
-		toth= MAX2(toth, itemy+itemh);
+		totw = MAX2(totw, itemx + itemw);
+		toth = MAX2(toth, itemy + itemh);
 	}
 
 	totw -= minx;
 	toth -= miny;
 
-	if(litem->w && totw > 0)
-		scalex= (float)litem->w/(float)totw;
-	if(litem->h && toth > 0)
-		scaley= (float)litem->h/(float)toth;
+	if (litem->w && totw > 0)
+		scalex = (float)litem->w / (float)totw;
+	if (litem->h && toth > 0)
+		scaley = (float)litem->h / (float)toth;
 	
-	x= litem->x;
-	y= litem->y - scaley*toth;
+	x = litem->x;
+	y = litem->y - scaley * toth;
 
-	for(item=litem->items.first; item; item=item->next) {
+	for (item = litem->items.first; item; item = item->next) {
 		ui_item_offset(item, &itemx, &itemy);
 		ui_item_size(item, &itemw, &itemh);
 
-		if(scalex != 1.0f) {
-			newx= (itemx - minx)*scalex;
-			itemw= (itemx - minx + itemw)*scalex - newx;
-			itemx= minx + newx;
+		if (scalex != 1.0f) {
+			newx = (itemx - minx) * scalex;
+			itemw = (itemx - minx + itemw) * scalex - newx;
+			itemx = minx + newx;
 		}
 
-		if(scaley != 1.0f) {
-			newy= (itemy - miny)*scaley;
-			itemh= (itemy - miny + itemh)*scaley - newy;
-			itemy= miny + newy;
+		if (scaley != 1.0f) {
+			newy = (itemy - miny) * scaley;
+			itemh = (itemy - miny + itemh) * scaley - newy;
+			itemy = miny + newy;
 		}
 
-		ui_item_position(item, x+itemx-minx, y+itemy-miny, itemw, itemh);
+		ui_item_position(item, x + itemx - minx, y + itemy - miny, itemw, itemh);
 	}
 
-	litem->w= scalex*totw;
-	litem->h= litem->y - y;
-	litem->x= x + litem->w;
-	litem->y= y;
+	litem->w = scalex * totw;
+	litem->h = litem->y - y;
+	litem->x = x + litem->w;
+	litem->y = y;
 }
 
 /* split layout */
@@ -2096,42 +2101,42 @@ static void ui_litem_estimate_split(uiLayout *litem)
 
 static void ui_litem_layout_split(uiLayout *litem)
 {
-	uiLayoutItemSplit *split= (uiLayoutItemSplit*)litem;
+	uiLayoutItemSplit *split = (uiLayoutItemSplit *)litem;
 	uiItem *item;
 	float percentage;
-	const int tot= BLI_countlist(&litem->items);
-	int itemh, x, y, w, colw=0;
+	const int tot = BLI_countlist(&litem->items);
+	int itemh, x, y, w, colw = 0;
 
-	if(tot == 0)
+	if (tot == 0)
 		return;
 
-	x= litem->x;
-	y= litem->y;
+	x = litem->x;
+	y = litem->y;
 
-	percentage= (split->percentage == 0.0f)? 1.0f/(float)tot: split->percentage;
+	percentage = (split->percentage == 0.0f) ? 1.0f / (float)tot : split->percentage;
 	
-	w= (litem->w - (tot-1)*litem->space);
-	colw= w*percentage;
-	colw= MAX2(colw, 0);
+	w = (litem->w - (tot - 1) * litem->space);
+	colw = w * percentage;
+	colw = MAX2(colw, 0);
 
-	for(item=litem->items.first; item; item=item->next) {
+	for (item = litem->items.first; item; item = item->next) {
 		ui_item_size(item, NULL, &itemh);
 
-		ui_item_position(item, x, y-itemh, colw, itemh);
+		ui_item_position(item, x, y - itemh, colw, itemh);
 		x += colw;
 
-		if(item->next) {
-			colw= (w - (int)(w*percentage))/(tot-1);
-			colw= MAX2(colw, 0);
+		if (item->next) {
+			colw = (w - (int)(w * percentage)) / (tot - 1);
+			colw = MAX2(colw, 0);
 
 			x += litem->space;
 		}
 	}
 
-	litem->w= x - litem->x;
-	litem->h= litem->y - y;
-	litem->x= x;
-	litem->y= y;
+	litem->w = x - litem->x;
+	litem->h = litem->y - y;
+	litem->x = x;
+	litem->y = y;
 }
 
 /* overlap layout */
@@ -2140,14 +2145,14 @@ static void ui_litem_estimate_overlap(uiLayout *litem)
 	uiItem *item;
 	int itemw, itemh;
 
-	litem->w= 0;
-	litem->h= 0;
+	litem->w = 0;
+	litem->h = 0;
 
-	for(item=litem->items.first; item; item=item->next) {
+	for (item = litem->items.first; item; item = item->next) {
 		ui_item_size(item, &itemw, &itemh);
 
-		litem->w= MAX2(itemw, litem->w);
-		litem->h= MAX2(itemh, litem->h);
+		litem->w = MAX2(itemw, litem->w);
+		litem->h = MAX2(itemh, litem->h);
 	}
 }
 
@@ -2156,18 +2161,18 @@ static void ui_litem_layout_overlap(uiLayout *litem)
 	uiItem *item;
 	int itemw, itemh, x, y;
 
-	x= litem->x;
-	y= litem->y;
+	x = litem->x;
+	y = litem->y;
 
-	for(item=litem->items.first; item; item=item->next) {
+	for (item = litem->items.first; item; item = item->next) {
 		ui_item_size(item, &itemw, &itemh);
-		ui_item_position(item, x, y-itemh, litem->w, itemh);
+		ui_item_position(item, x, y - itemh, litem->w, itemh);
 
-		litem->h= MAX2(litem->h, itemh);
+		litem->h = MAX2(litem->h, itemh);
 	}
 
-	litem->x= x;
-	litem->y= y - litem->h;
+	litem->x = x;
+	litem->y = y - litem->h;
 }
 
 /* layout create functions */
@@ -2175,14 +2180,14 @@ uiLayout *uiLayoutRow(uiLayout *layout, int align)
 {
 	uiLayout *litem;
 
-	litem= MEM_callocN(sizeof(uiLayout), "uiLayoutRow");
-	litem->item.type= ITEM_LAYOUT_ROW;
-	litem->root= layout->root;
-	litem->align= align;
-	litem->active= 1;
-	litem->enabled= 1;
-	litem->context= layout->context;
-	litem->space= (align)? 0: layout->root->style->buttonspacex;
+	litem = MEM_callocN(sizeof(uiLayout), "uiLayoutRow");
+	litem->item.type = ITEM_LAYOUT_ROW;
+	litem->root = layout->root;
+	litem->align = align;
+	litem->active = 1;
+	litem->enabled = 1;
+	litem->context = layout->context;
+	litem->space = (align) ? 0 : layout->root->style->buttonspacex;
 	litem->w = layout->w;
 	BLI_addtail(&layout->items, litem);
 
@@ -2195,14 +2200,14 @@ uiLayout *uiLayoutColumn(uiLayout *layout, int align)
 {
 	uiLayout *litem;
 
-	litem= MEM_callocN(sizeof(uiLayout), "uiLayoutColumn");
-	litem->item.type= ITEM_LAYOUT_COLUMN;
-	litem->root= layout->root;
-	litem->align= align;
-	litem->active= 1;
-	litem->enabled= 1;
-	litem->context= layout->context;
-	litem->space= (litem->align)? 0: layout->root->style->buttonspacey;
+	litem = MEM_callocN(sizeof(uiLayout), "uiLayoutColumn");
+	litem->item.type = ITEM_LAYOUT_COLUMN;
+	litem->root = layout->root;
+	litem->align = align;
+	litem->active = 1;
+	litem->enabled = 1;
+	litem->context = layout->context;
+	litem->space = (litem->align) ? 0 : layout->root->style->buttonspacey;
 	litem->w = layout->w;
 	BLI_addtail(&layout->items, litem);
 
@@ -2215,16 +2220,16 @@ uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, int align)
 {
 	uiLayoutItemFlow *flow;
 
-	flow= MEM_callocN(sizeof(uiLayoutItemFlow), "uiLayoutItemFlow");
-	flow->litem.item.type= ITEM_LAYOUT_COLUMN_FLOW;
-	flow->litem.root= layout->root;
-	flow->litem.align= align;
-	flow->litem.active= 1;
-	flow->litem.enabled= 1;
-	flow->litem.context= layout->context;
-	flow->litem.space= (flow->litem.align)? 0: layout->root->style->columnspace;
+	flow = MEM_callocN(sizeof(uiLayoutItemFlow), "uiLayoutItemFlow");
+	flow->litem.item.type = ITEM_LAYOUT_COLUMN_FLOW;
+	flow->litem.root = layout->root;
+	flow->litem.align = align;
+	flow->litem.active = 1;
+	flow->litem.enabled = 1;
+	flow->litem.context = layout->context;
+	flow->litem.space = (flow->litem.align) ? 0 : layout->root->style->columnspace;
 	flow->litem.w = layout->w;
-	flow->number= number;
+	flow->number = number;
 	BLI_addtail(&layout->items, flow);
 
 	uiBlockSetCurLayout(layout->root->block, &flow->litem);
@@ -2236,52 +2241,52 @@ static uiLayoutItemBx *ui_layout_box(uiLayout *layout, int type)
 {
 	uiLayoutItemBx *box;
 
-	box= MEM_callocN(sizeof(uiLayoutItemBx), "uiLayoutItemBx");
-	box->litem.item.type= ITEM_LAYOUT_BOX;
-	box->litem.root= layout->root;
-	box->litem.active= 1;
-	box->litem.enabled= 1;
-	box->litem.context= layout->context;
-	box->litem.space= layout->root->style->columnspace;
+	box = MEM_callocN(sizeof(uiLayoutItemBx), "uiLayoutItemBx");
+	box->litem.item.type = ITEM_LAYOUT_BOX;
+	box->litem.root = layout->root;
+	box->litem.active = 1;
+	box->litem.enabled = 1;
+	box->litem.context = layout->context;
+	box->litem.space = layout->root->style->columnspace;
 	box->litem.w = layout->w;
 	BLI_addtail(&layout->items, box);
 
 	uiBlockSetCurLayout(layout->root->block, &box->litem);
 
-	box->roundbox= uiDefBut(layout->root->block, type, 0, "", 0, 0, 0, 0, NULL, 0.0, 0.0, 0, 0, "");
+	box->roundbox = uiDefBut(layout->root->block, type, 0, "", 0, 0, 0, 0, NULL, 0.0, 0.0, 0, 0, "");
 
 	return box;
 }
 
 uiLayout *uiLayoutBox(uiLayout *layout)
 {
-	return (uiLayout*)ui_layout_box(layout, ROUNDBOX);
+	return (uiLayout *)ui_layout_box(layout, ROUNDBOX);
 }
 
 uiLayout *uiLayoutListBox(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, PointerRNA *actptr, PropertyRNA *actprop)
 {
-	uiLayoutItemBx *box= ui_layout_box(layout, LISTBOX);
-	uiBut *but= box->roundbox;
+	uiLayoutItemBx *box = ui_layout_box(layout, LISTBOX);
+	uiBut *but = box->roundbox;
 
-	but->rnasearchpoin= *ptr;
-	but->rnasearchprop= prop;
-	but->rnapoin= *actptr;
-	but->rnaprop= actprop;
+	but->rnasearchpoin = *ptr;
+	but->rnasearchprop = prop;
+	but->rnapoin = *actptr;
+	but->rnaprop = actprop;
 
-	return (uiLayout*)box;
+	return (uiLayout *)box;
 }
 
 uiLayout *uiLayoutAbsolute(uiLayout *layout, int align)
 {
 	uiLayout *litem;
 
-	litem= MEM_callocN(sizeof(uiLayout), "uiLayoutAbsolute");
-	litem->item.type= ITEM_LAYOUT_ABSOLUTE;
-	litem->root= layout->root;
-	litem->align= align;
-	litem->active= 1;
-	litem->enabled= 1;
-	litem->context= layout->context;
+	litem = MEM_callocN(sizeof(uiLayout), "uiLayoutAbsolute");
+	litem->item.type = ITEM_LAYOUT_ABSOLUTE;
+	litem->root = layout->root;
+	litem->align = align;
+	litem->active = 1;
+	litem->enabled = 1;
+	litem->context = layout->context;
 	BLI_addtail(&layout->items, litem);
 
 	uiBlockSetCurLayout(layout->root->block, litem);
@@ -2293,7 +2298,7 @@ uiBlock *uiLayoutAbsoluteBlock(uiLayout *layout)
 {
 	uiBlock *block;
 
-	block= uiLayoutGetBlock(layout);
+	block = uiLayoutGetBlock(layout);
 	uiLayoutAbsolute(layout, 0);
 
 	return block;
@@ -2303,12 +2308,12 @@ uiLayout *uiLayoutOverlap(uiLayout *layout)
 {
 	uiLayout *litem;
 
-	litem= MEM_callocN(sizeof(uiLayout), "uiLayoutOverlap");
-	litem->item.type= ITEM_LAYOUT_OVERLAP;
-	litem->root= layout->root;
-	litem->active= 1;
-	litem->enabled= 1;
-	litem->context= layout->context;
+	litem = MEM_callocN(sizeof(uiLayout), "uiLayoutOverlap");
+	litem->item.type = ITEM_LAYOUT_OVERLAP;
+	litem->root = layout->root;
+	litem->active = 1;
+	litem->enabled = 1;
+	litem->context = layout->context;
 	BLI_addtail(&layout->items, litem);
 
 	uiBlockSetCurLayout(layout->root->block, litem);
@@ -2320,16 +2325,16 @@ uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, int align)
 {
 	uiLayoutItemSplit *split;
 
-	split= MEM_callocN(sizeof(uiLayoutItemSplit), "uiLayoutItemSplit");
-	split->litem.item.type= ITEM_LAYOUT_SPLIT;
-	split->litem.root= layout->root;
-	split->litem.align= align;
-	split->litem.active= 1;
-	split->litem.enabled= 1;
-	split->litem.context= layout->context;
-	split->litem.space= layout->root->style->columnspace;
-	split->litem.w= layout->w;
-	split->percentage= percentage;
+	split = MEM_callocN(sizeof(uiLayoutItemSplit), "uiLayoutItemSplit");
+	split->litem.item.type = ITEM_LAYOUT_SPLIT;
+	split->litem.root = layout->root;
+	split->litem.align = align;
+	split->litem.active = 1;
+	split->litem.enabled = 1;
+	split->litem.context = layout->context;
+	split->litem.space = layout->root->style->columnspace;
+	split->litem.w = layout->w;
+	split->percentage = percentage;
 	BLI_addtail(&layout->items, split);
 
 	uiBlockSetCurLayout(layout->root->block, &split->litem);
@@ -2339,37 +2344,37 @@ uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, int align)
 
 void uiLayoutSetActive(uiLayout *layout, int active)
 {
-	layout->active= active;
+	layout->active = active;
 }
 
 void uiLayoutSetEnabled(uiLayout *layout, int enabled)
 {
-	layout->enabled= enabled;
+	layout->enabled = enabled;
 }
 
 void uiLayoutSetRedAlert(uiLayout *layout, int redalert)
 {
-	layout->redalert= redalert;
+	layout->redalert = redalert;
 }
 
 void uiLayoutSetKeepAspect(uiLayout *layout, int keepaspect)
 {
-	layout->keepaspect= keepaspect;
+	layout->keepaspect = keepaspect;
 }
 
 void uiLayoutSetAlignment(uiLayout *layout, int alignment)
 {
-	layout->alignment= alignment;
+	layout->alignment = alignment;
 }
 
 void uiLayoutSetScaleX(uiLayout *layout, float scale)
 {
-	layout->scale[0]= scale;
+	layout->scale[0] = scale;
 }
 
 void uiLayoutSetScaleY(uiLayout *layout, float scale)
 {
-	layout->scale[1]= scale;
+	layout->scale[1] = scale;
 }
 
 int uiLayoutGetActive(uiLayout *layout)
@@ -2409,7 +2414,7 @@ float uiLayoutGetScaleX(uiLayout *layout)
 
 float uiLayoutGetScaleY(uiLayout *layout)
 {
-	return layout->scale[0];
+	return layout->scale[1];
 }
 
 /********************** Layout *******************/
@@ -2419,16 +2424,16 @@ static void ui_item_scale(uiLayout *litem, float scale[2])
 	uiItem *item;
 	int x, y, w, h;
 
-	for(item=litem->items.last; item; item=item->prev) {
+	for (item = litem->items.last; item; item = item->prev) {
 		ui_item_size(item, &w, &h);
 		ui_item_offset(item, &x, &y);
 
-		if(scale[0] != 0.0f) {
+		if (scale[0] != 0.0f) {
 			x *= scale[0];
 			w *= scale[0];
 		}
 
-		if(scale[1] != 0.0f) {
+		if (scale[1] != 0.0f) {
 			y *= scale[1];
 			h *= scale[1];
 		}
@@ -2441,19 +2446,19 @@ static void ui_item_estimate(uiItem *item)
 {
 	uiItem *subitem;
 
-	if(item->type != ITEM_BUTTON) {
-		uiLayout *litem= (uiLayout*)item;
+	if (item->type != ITEM_BUTTON) {
+		uiLayout *litem = (uiLayout *)item;
 
-		for(subitem=litem->items.first; subitem; subitem=subitem->next)
+		for (subitem = litem->items.first; subitem; subitem = subitem->next)
 			ui_item_estimate(subitem);
 
-		if(litem->items.first == NULL)
+		if (litem->items.first == NULL)
 			return;
 
-		if(litem->scale[0] != 0.0f || litem->scale[1] != 0.0f)
+		if (litem->scale[0] != 0.0f || litem->scale[1] != 0.0f)
 			ui_item_scale(litem, litem->scale);
 
-		switch(litem->item.type) {
+		switch (litem->item.type) {
 			case ITEM_LAYOUT_COLUMN:
 				ui_litem_estimate_column(litem);
 				break;
@@ -2490,23 +2495,23 @@ static void ui_item_align(uiLayout *litem, short nr)
 	uiButtonItem *bitem;
 	uiLayoutItemBx *box;
 
-	for(item=litem->items.last; item; item=item->prev) {
-		if(item->type == ITEM_BUTTON) {
-			bitem= (uiButtonItem*)item;
-			if(ui_but_can_align(bitem->but))
-				if(!bitem->but->alignnr)
-					bitem->but->alignnr= nr;
+	for (item = litem->items.last; item; item = item->prev) {
+		if (item->type == ITEM_BUTTON) {
+			bitem = (uiButtonItem *)item;
+			if (ui_but_can_align(bitem->but))
+				if (!bitem->but->alignnr)
+					bitem->but->alignnr = nr;
 		}
-		else if(item->type == ITEM_LAYOUT_ABSOLUTE);
-		else if(item->type == ITEM_LAYOUT_OVERLAP);
-		else if(item->type == ITEM_LAYOUT_BOX) {
-			box= (uiLayoutItemBx*)item;
-			box->roundbox->alignnr= nr;
+		else if (item->type == ITEM_LAYOUT_ABSOLUTE) ;
+		else if (item->type == ITEM_LAYOUT_OVERLAP) ;
+		else if (item->type == ITEM_LAYOUT_BOX) {
+			box = (uiLayoutItemBx *)item;
+			box->roundbox->alignnr = nr;
 			BLI_remlink(&litem->root->block->buttons, box->roundbox);
 			BLI_addhead(&litem->root->block->buttons, box->roundbox);
 		}
 		else
-			ui_item_align((uiLayout*)item, nr);
+			ui_item_align((uiLayout *)item, nr);
 	}
 }
 
@@ -2515,13 +2520,13 @@ static void ui_item_flag(uiLayout *litem, int flag)
 	uiItem *item;
 	uiButtonItem *bitem;
 
-	for(item=litem->items.last; item; item=item->prev) {
-		if(item->type == ITEM_BUTTON) {
-			bitem= (uiButtonItem*)item;
+	for (item = litem->items.last; item; item = item->prev) {
+		if (item->type == ITEM_BUTTON) {
+			bitem = (uiButtonItem *)item;
 			bitem->but->flag |= flag;
 		}
 		else
-			ui_item_flag((uiLayout*)item, flag);
+			ui_item_flag((uiLayout *)item, flag);
 	}
 }
 
@@ -2529,20 +2534,20 @@ static void ui_item_layout(uiItem *item)
 {
 	uiItem *subitem;
 
-	if(item->type != ITEM_BUTTON) {
-		uiLayout *litem= (uiLayout*)item;
+	if (item->type != ITEM_BUTTON) {
+		uiLayout *litem = (uiLayout *)item;
 
-		if(litem->items.first == NULL)
+		if (litem->items.first == NULL)
 			return;
 
-		if(litem->align)
+		if (litem->align)
 			ui_item_align(litem, ++litem->root->block->alignnr);
-		if(!litem->active)
+		if (!litem->active)
 			ui_item_flag(litem, UI_BUT_INACTIVE);
-		if(!litem->enabled)
+		if (!litem->enabled)
 			ui_item_flag(litem, UI_BUT_DISABLED);
 
-		switch(litem->item.type) {
+		switch (litem->item.type) {
 			case ITEM_LAYOUT_COLUMN:
 				ui_litem_layout_column(litem);
 				break;
@@ -2571,34 +2576,34 @@ static void ui_item_layout(uiItem *item)
 				break;
 		}
 
-		for(subitem=litem->items.first; subitem; subitem=subitem->next)
+		for (subitem = litem->items.first; subitem; subitem = subitem->next)
 			ui_item_layout(subitem);
 	}
 }
 
 static void ui_layout_end(uiBlock *block, uiLayout *layout, int *x, int *y)
 {
-	if(layout->root->handlefunc)
+	if (layout->root->handlefunc)
 		uiBlockSetHandleFunc(block, layout->root->handlefunc, layout->root->argv);
 
 	ui_item_estimate(&layout->item);
 	ui_item_layout(&layout->item);
 
-	if(x) *x= layout->x;
-	if(y) *y= layout->y;
+	if (x) *x = layout->x;
+	if (y) *y = layout->y;
 }
 
 static void ui_layout_free(uiLayout *layout)
 {
 	uiItem *item, *next;
 
-	for(item=layout->items.first; item; item=next) {
-		next= item->next;
+	for (item = layout->items.first; item; item = next) {
+		next = item->next;
 
-		if(item->type == ITEM_BUTTON)
+		if (item->type == ITEM_BUTTON)
 			MEM_freeN(item);
 		else
-			ui_layout_free((uiLayout*)item);
+			ui_layout_free((uiLayout *)item);
 	}
 
 	MEM_freeN(layout);
@@ -2609,37 +2614,37 @@ uiLayout *uiBlockLayout(uiBlock *block, int dir, int type, int x, int y, int siz
 	uiLayout *layout;
 	uiLayoutRoot *root;
 
-	root= MEM_callocN(sizeof(uiLayoutRoot), "uiLayoutRoot");
-	root->type= type;
-	root->style= style;
-	root->block= block;
-	root->opcontext= WM_OP_INVOKE_REGION_WIN;
+	root = MEM_callocN(sizeof(uiLayoutRoot), "uiLayoutRoot");
+	root->type = type;
+	root->style = style;
+	root->block = block;
+	root->opcontext = WM_OP_INVOKE_REGION_WIN;
 
-	layout= MEM_callocN(sizeof(uiLayout), "uiLayout");
-	layout->item.type= ITEM_LAYOUT_ROOT;
+	layout = MEM_callocN(sizeof(uiLayout), "uiLayout");
+	layout->item.type = ITEM_LAYOUT_ROOT;
 
-	layout->x= x;
-	layout->y= y;
-	layout->root= root;
-	layout->space= style->templatespace;
-	layout->active= 1;
-	layout->enabled= 1;
-	layout->context= NULL;
+	layout->x = x;
+	layout->y = y;
+	layout->root = root;
+	layout->space = style->templatespace;
+	layout->active = 1;
+	layout->enabled = 1;
+	layout->context = NULL;
 
-	if(type == UI_LAYOUT_MENU)
-		layout->space= 0;
+	if (type == UI_LAYOUT_MENU)
+		layout->space = 0;
 
-	if(dir == UI_LAYOUT_HORIZONTAL) {
-		layout->h= size;
-		layout->root->emh= em*UI_UNIT_Y;
+	if (dir == UI_LAYOUT_HORIZONTAL) {
+		layout->h = size;
+		layout->root->emh = em * UI_UNIT_Y;
 	}
 	else {
-		layout->w= size;
-		layout->root->emw= em*UI_UNIT_X;
+		layout->w = size;
+		layout->root->emw = em * UI_UNIT_X;
 	}
 
-	block->curlayout= layout;
-	root->layout= layout;
+	block->curlayout = layout;
+	root->layout = layout;
 	BLI_addtail(&block->layouts, root);
 	
 	return layout;
@@ -2658,45 +2663,45 @@ int uiLayoutGetOperatorContext(uiLayout *layout)
 
 void uiBlockSetCurLayout(uiBlock *block, uiLayout *layout)
 {
-	block->curlayout= layout;
+	block->curlayout = layout;
 }
 
 void ui_layout_add_but(uiLayout *layout, uiBut *but)
 {
 	uiButtonItem *bitem;
 	
-	bitem= MEM_callocN(sizeof(uiButtonItem), "uiButtonItem");
-	bitem->item.type= ITEM_BUTTON;
-	bitem->but= but;
+	bitem = MEM_callocN(sizeof(uiButtonItem), "uiButtonItem");
+	bitem->item.type = ITEM_BUTTON;
+	bitem->but = but;
 	BLI_addtail(&layout->items, bitem);
 
-	if(layout->context) {
-		but->context= layout->context;
-		but->context->used= 1;
+	if (layout->context) {
+		but->context = layout->context;
+		but->context->used = 1;
 	}
 }
 
 void uiLayoutSetOperatorContext(uiLayout *layout, int opcontext)
 {
-	layout->root->opcontext= opcontext;
+	layout->root->opcontext = opcontext;
 }
 
 void uiLayoutSetFunc(uiLayout *layout, uiMenuHandleFunc handlefunc, void *argv)
 {
-	layout->root->handlefunc= handlefunc;
-	layout->root->argv= argv;
+	layout->root->handlefunc = handlefunc;
+	layout->root->argv = argv;
 }
 
 void uiBlockLayoutResolve(uiBlock *block, int *x, int *y)
 {
 	uiLayoutRoot *root;
 
-	if(x) *x= 0;
-	if(y) *y= 0;
+	if (x) *x = 0;
+	if (y) *y = 0;
 
-	block->curlayout= NULL;
+	block->curlayout = NULL;
 
-	for(root=block->layouts.first; root; root=root->next) {
+	for (root = block->layouts.first; root; root = root->next) {
 		/* NULL in advance so we don't interfere when adding button */
 		ui_layout_end(block, root->layout, x, y);
 		ui_layout_free(root->layout);
@@ -2713,8 +2718,14 @@ void uiBlockLayoutResolve(uiBlock *block, int *x, int *y)
 
 void uiLayoutSetContextPointer(uiLayout *layout, const char *name, PointerRNA *ptr)
 {
+	uiBlock *block = layout->root->block;
+	layout->context = CTX_store_add(&block->contexts, name, ptr);
+}
+
+void uiLayoutContextCopy(uiLayout *layout, bContextStore *context)
+{
 	uiBlock *block= layout->root->block;
-	layout->context= CTX_store_add(&block->contexts, name, ptr);
+	layout->context= CTX_store_add_all(&block->contexts, context);
 }
 
 
@@ -2728,13 +2739,13 @@ static void ui_intro_button(DynStr *ds, uiButtonItem *bitem)
 	BLI_dynstr_appendf(ds, "'draw_string':'''%s''', ", but->drawstr);
 	BLI_dynstr_appendf(ds, "'tip':'''%s''', ", but->tip ? but->tip : ""); // not exactly needed, rna has this
 
-	if(but->optype) {
+	if (but->optype) {
 		char *opstr = WM_operator_pystring(but->block->evil_C, but->optype, but->opptr, 0);
 		BLI_dynstr_appendf(ds, "'operator':'''%s''', ", opstr ? opstr : "");
 		MEM_freeN(opstr);
 	}
 
-	if(but->rnaprop) {
+	if (but->rnaprop) {
 		BLI_dynstr_appendf(ds, "'rna':'%s.%s[%d]', ", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop), but->rnaindex);
 	}
 
@@ -2746,38 +2757,38 @@ static void ui_intro_items(DynStr *ds, ListBase *lb)
 
 	BLI_dynstr_append(ds, "[");
 
-	for(item=lb->first; item; item=item->next) {
+	for (item = lb->first; item; item = item->next) {
 
 		BLI_dynstr_append(ds, "{");
 
 		/* could also use the INT but this is nicer*/
-		switch(item->type) {
-		case ITEM_BUTTON:			BLI_dynstr_append(ds, "'type':'BUTTON', ");break;
-		case ITEM_LAYOUT_ROW:		BLI_dynstr_append(ds, "'type':'ROW', "); break;
-		case ITEM_LAYOUT_COLUMN:	BLI_dynstr_append(ds, "'type':'COLUMN', "); break;
-		case ITEM_LAYOUT_COLUMN_FLOW:BLI_dynstr_append(ds, "'type':'COLUMN_FLOW', "); break;
-		case ITEM_LAYOUT_ROW_FLOW:	BLI_dynstr_append(ds, "'type':'ROW_FLOW', "); break;
-		case ITEM_LAYOUT_BOX:		BLI_dynstr_append(ds, "'type':'BOX', "); break;
-		case ITEM_LAYOUT_ABSOLUTE:	BLI_dynstr_append(ds, "'type':'ABSOLUTE', "); break;
-		case ITEM_LAYOUT_SPLIT:		BLI_dynstr_append(ds, "'type':'SPLIT', "); break;
-		case ITEM_LAYOUT_OVERLAP:	BLI_dynstr_append(ds, "'type':'OVERLAP', "); break;
-		case ITEM_LAYOUT_ROOT:		BLI_dynstr_append(ds, "'type':'ROOT', "); break;
-		default:					BLI_dynstr_append(ds, "'type':'UNKNOWN', "); break;
+		switch (item->type) {
+			case ITEM_BUTTON:             BLI_dynstr_append(ds, "'type':'BUTTON', "); break;
+			case ITEM_LAYOUT_ROW:         BLI_dynstr_append(ds, "'type':'ROW', "); break;
+			case ITEM_LAYOUT_COLUMN:      BLI_dynstr_append(ds, "'type':'COLUMN', "); break;
+			case ITEM_LAYOUT_COLUMN_FLOW: BLI_dynstr_append(ds, "'type':'COLUMN_FLOW', "); break;
+			case ITEM_LAYOUT_ROW_FLOW:    BLI_dynstr_append(ds, "'type':'ROW_FLOW', "); break;
+			case ITEM_LAYOUT_BOX:         BLI_dynstr_append(ds, "'type':'BOX', "); break;
+			case ITEM_LAYOUT_ABSOLUTE:    BLI_dynstr_append(ds, "'type':'ABSOLUTE', "); break;
+			case ITEM_LAYOUT_SPLIT:       BLI_dynstr_append(ds, "'type':'SPLIT', "); break;
+			case ITEM_LAYOUT_OVERLAP:     BLI_dynstr_append(ds, "'type':'OVERLAP', "); break;
+			case ITEM_LAYOUT_ROOT:        BLI_dynstr_append(ds, "'type':'ROOT', "); break;
+			default:                      BLI_dynstr_append(ds, "'type':'UNKNOWN', "); break;
 		}
 
-		switch(item->type) {
-		case ITEM_BUTTON:
-			ui_intro_button(ds, (uiButtonItem *)item);
-			break;
-		default:
-			BLI_dynstr_append(ds, "'items':");
-			ui_intro_items(ds, &((uiLayout*)item)->items);
-			break;
+		switch (item->type) {
+			case ITEM_BUTTON:
+				ui_intro_button(ds, (uiButtonItem *)item);
+				break;
+			default:
+				BLI_dynstr_append(ds, "'items':");
+				ui_intro_items(ds, &((uiLayout *)item)->items);
+				break;
 		}
 
 		BLI_dynstr_append(ds, "}");
 
-		if(item != lb->last)
+		if (item != lb->last)
 			BLI_dynstr_append(ds, ", ");
 	}
 	BLI_dynstr_append(ds, "], ");
@@ -2791,7 +2802,7 @@ static void ui_intro_uiLayout(DynStr *ds, uiLayout *layout)
 static char *str = NULL; // XXX, constant re-freeing, far from ideal.
 const char *uiLayoutIntrospect(uiLayout *layout)
 {
-	DynStr *ds= BLI_dynstr_new();
+	DynStr *ds = BLI_dynstr_new();
 
 	if (str) {
 		MEM_freeN(str);
@@ -2811,63 +2822,63 @@ static void ui_layout_operator_buts__reset_cb(bContext *UNUSED(C), void *op_pt,
 }
 
 /* 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,int (*check_prop)(struct PointerRNA *, struct PropertyRNA *), const char label_align, const short flag)
+void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op, int (*check_prop)(struct PointerRNA *, struct PropertyRNA *), const char label_align, const short flag)
 {
-	if(!op->properties) {
+	if (!op->properties) {
 		IDPropertyTemplate val = {0};
-		op->properties= IDP_New(IDP_GROUP, &val, "wmOperatorProperties");
+		op->properties = IDP_New(IDP_GROUP, &val, "wmOperatorProperties");
 	}
 
-	if(flag & UI_LAYOUT_OP_SHOW_TITLE) {
-		uiItemL(layout, op->type->name, ICON_NONE);
+	if (flag & UI_LAYOUT_OP_SHOW_TITLE) {
+		uiItemL(layout, RNA_struct_ui_name(op->type->srna), ICON_NONE);
 	}
 
 	/* poll() on this operator may still fail, at the moment there is no nice feedback when this happens
 	 * just fails silently */
-	if(!WM_operator_repeat_check(C, op)) {
+	if (!WM_operator_repeat_check(C, op)) {
 		uiBlockSetButLock(uiLayoutGetBlock(layout), TRUE, "Operator cannot redo");
-		uiItemL(layout, "* Redo Unsupported *", ICON_NONE); // XXX, could give some nicer feedback or not show redo panel at all?
+		uiItemL(layout, IFACE_("* Redo Unsupported *"), ICON_NONE); // XXX, could give some nicer feedback or not show redo panel at all?
 	}
 
 	/* menu */
-	if(op->type->flag & OPTYPE_PRESET) {
+	if (op->type->flag & OPTYPE_PRESET) {
 		/* XXX, no simple way to get WM_MT_operator_presets.bl_label from python! Label remains the same always! */
 		PointerRNA op_ptr;
 		uiLayout *row;
 
-		uiLayoutGetBlock(layout)->ui_operator= op;
+		uiLayoutGetBlock(layout)->ui_operator = op;
 
-		row= uiLayoutRow(layout, TRUE);
+		row = uiLayoutRow(layout, TRUE);
 		uiItemM(row, (bContext *)C, "WM_MT_operator_presets", NULL, ICON_NONE);
 
 		WM_operator_properties_create(&op_ptr, "WM_OT_operator_preset_add");
 		RNA_string_set(&op_ptr, "operator", op->type->idname);
-		op_ptr= uiItemFullO(row, "WM_OT_operator_preset_add", "", ICON_ZOOMIN, op_ptr.data, WM_OP_INVOKE_DEFAULT, 0);
+		op_ptr = uiItemFullO(row, "WM_OT_operator_preset_add", "", ICON_ZOOMIN, op_ptr.data, WM_OP_INVOKE_DEFAULT, 0);
 
 		WM_operator_properties_create(&op_ptr, "WM_OT_operator_preset_add");
 		RNA_string_set(&op_ptr, "operator", op->type->idname);
 		RNA_boolean_set(&op_ptr, "remove_active", TRUE);
-		op_ptr= uiItemFullO(row, "WM_OT_operator_preset_add", "", ICON_ZOOMOUT, op_ptr.data, WM_OP_INVOKE_DEFAULT, 0);
+		op_ptr = uiItemFullO(row, "WM_OT_operator_preset_add", "", ICON_ZOOMOUT, op_ptr.data, WM_OP_INVOKE_DEFAULT, 0);
 	}
 
-	if(op->type->ui) {
-		op->layout= layout;
-		op->type->ui((bContext*)C, op);
-		op->layout= NULL;
+	if (op->type->ui) {
+		op->layout = layout;
+		op->type->ui((bContext *)C, op);
+		op->layout = NULL;
 
 		/* UI_LAYOUT_OP_SHOW_EMPTY ignored */
 	}
 	else {
-		wmWindowManager *wm= CTX_wm_manager(C);
+		wmWindowManager *wm = CTX_wm_manager(C);
 		PointerRNA ptr;
 		int empty;
 
 		RNA_pointer_create(&wm->id, op->type->srna, op->properties, &ptr);
 
 		/* main draw call */
-		empty= uiDefAutoButsRNA(layout, &ptr, check_prop, label_align) == 0;
+		empty = uiDefAutoButsRNA(layout, &ptr, check_prop, label_align) == 0;
 
-		if(empty && (flag & UI_LAYOUT_OP_SHOW_EMPTY)) {
+		if (empty && (flag & UI_LAYOUT_OP_SHOW_EMPTY)) {
 			uiItemL(layout, IFACE_("No Properties"), ICON_NONE);
 		}
 	}
@@ -2880,10 +2891,10 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,in
 		uiBut *but;
 		uiLayout *col; /* needed to avoid alignment errors with previous buttons */
 
-		col= uiLayoutColumn(layout, 0);
-		block= uiLayoutGetBlock(col);
-		but = uiDefIconTextBut(block , BUT, 0, ICON_FILE_REFRESH, "Reset", 0, 0, 18, 20, NULL, 0.0, 0.0, 0.0, 0.0,
-		                       "Reset operator defaults");
+		col = uiLayoutColumn(layout, 0);
+		block = uiLayoutGetBlock(col);
+		but = uiDefIconTextBut(block, BUT, 0, ICON_FILE_REFRESH, IFACE_("Reset"), 0, 0, 18, 20,
+		                       NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Reset operator defaults"));
 		uiButSetFunc(but, ui_layout_operator_buts__reset_cb, op, NULL);
 	}
 
@@ -2891,7 +2902,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,in
 	{
 		uiBut *but;
 		
-		for(but= uiLayoutGetBlock(layout)->buttons.first; but; but= but->next) {
+		for (but = uiLayoutGetBlock(layout)->buttons.first; but; but = but->next) {
 			/* no undo for buttons for operator redo panels */
 			uiButClearFlag(but, UI_BUT_UNDO);
 			
@@ -2908,7 +2919,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op,in
 /* this is a bit of a hack but best keep it in one place at least */
 MenuType *uiButGetMenuType(uiBut *but)
 {
-	if(but->menu_create_func == ui_item_menutype_func) {
+	if (but->menu_create_func == ui_item_menutype_func) {
 		return (MenuType *)but->poin;
 	}
 	else {
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 0521ecb..93546d7 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -78,7 +78,7 @@ static int eyedropper_init(bContext *C, wmOperator *op)
 {
 	Eyedropper *eye;
 	
-	op->customdata= eye= MEM_callocN(sizeof(Eyedropper), "Eyedropper");
+	op->customdata = eye = MEM_callocN(sizeof(Eyedropper), "Eyedropper");
 	
 	uiContextActiveProperty(C, &eye->ptr, &eye->prop, &eye->index);
 	
@@ -89,9 +89,9 @@ static void eyedropper_exit(bContext *C, wmOperator *op)
 {
 	WM_cursor_restore(CTX_wm_window(C));
 	
-	if(op->customdata)
+	if (op->customdata)
 		MEM_freeN(op->customdata);
-	op->customdata= NULL;
+	op->customdata = NULL;
 }
 
 static int eyedropper_cancel(bContext *C, wmOperator *op)
@@ -102,7 +102,7 @@ static int eyedropper_cancel(bContext *C, wmOperator *op)
 
 static void eyedropper_sample(bContext *C, Eyedropper *eye, int mx, int my)
 {
-	if(RNA_property_type(eye->prop) == PROP_FLOAT) {
+	if (RNA_property_type(eye->prop) == PROP_FLOAT) {
 		Scene *scene = CTX_data_scene(C);
 		const int color_manage = scene->r.color_mgt_flag & R_COLOR_MANAGEMENT;
 		float col[4];
@@ -130,12 +130,12 @@ static int eyedropper_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
 	Eyedropper *eye = (Eyedropper *)op->customdata;
 	
-	switch(event->type) {
+	switch (event->type) {
 		case ESCKEY:
 		case RIGHTMOUSE:
 			return eyedropper_cancel(C, op);
 		case LEFTMOUSE:
-			if(event->val==KM_RELEASE) {
+			if (event->val == KM_RELEASE) {
 				eyedropper_sample(C, eye, event->x, event->y);
 				eyedropper_exit(C, op);
 				return OPERATOR_FINISHED;
@@ -157,14 +157,15 @@ static int eyedropper_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
 		WM_event_add_modal_handler(C, op);
 		
 		return OPERATOR_RUNNING_MODAL;
-	} else {
+	}
+	else {
 		eyedropper_exit(C, op);
 		return OPERATOR_CANCELLED;
 	}
 }
 
 /* Repeat operator */
-static int eyedropper_exec (bContext *C, wmOperator *op)
+static int eyedropper_exec(bContext *C, wmOperator *op)
 {
 	/* init */
 	if (eyedropper_init(C, op)) {
@@ -175,7 +176,8 @@ static int eyedropper_exec (bContext *C, wmOperator *op)
 		eyedropper_exit(C, op);
 		
 		return OPERATOR_FINISHED;
-	} else {
+	}
+	else {
 		return OPERATOR_CANCELLED;
 	}
 }
@@ -189,19 +191,19 @@ static int eyedropper_poll(bContext *C)
 static void UI_OT_eyedropper(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Eyedropper";
-	ot->idname= "UI_OT_eyedropper";
-	ot->description= "Sample a color from the Blender Window to store in a property";
+	ot->name = "Eyedropper";
+	ot->idname = "UI_OT_eyedropper";
+	ot->description = "Sample a color from the Blender Window to store in a property";
 	
 	/* api callbacks */
-	ot->invoke= eyedropper_invoke;
-	ot->modal= eyedropper_modal;
-	ot->cancel= eyedropper_cancel;
-	ot->exec= eyedropper_exec;
-	ot->poll= eyedropper_poll;
+	ot->invoke = eyedropper_invoke;
+	ot->modal = eyedropper_modal;
+	ot->cancel = eyedropper_cancel;
+	ot->exec = eyedropper_exec;
+	ot->poll = eyedropper_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_BLOCKING;
 	
 	/* properties */
 }
@@ -219,15 +221,15 @@ static int reset_default_theme_exec(bContext *C, wmOperator *UNUSED(op))
 static void UI_OT_reset_default_theme(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Reset to Default Theme";
-	ot->idname= "UI_OT_reset_default_theme";
-	ot->description= "Reset to the default theme colors";
+	ot->name = "Reset to Default Theme";
+	ot->idname = "UI_OT_reset_default_theme";
+	ot->description = "Reset to the default theme colors";
 	
 	/* callbacks */
-	ot->exec= reset_default_theme_exec;
+	ot->exec = reset_default_theme_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER;
+	ot->flag = OPTYPE_REGISTER;
 }
 
 /* Copy Data Path Operator ------------------------ */
@@ -237,14 +239,14 @@ static int copy_data_path_button_exec(bContext *C, wmOperator *UNUSED(op))
 	PointerRNA ptr;
 	PropertyRNA *prop;
 	char *path;
-	int success= 0;
+	int success = 0;
 	int index;
 
 	/* try to create driver using property retrieved from UI */
 	uiContextActiveProperty(C, &ptr, &prop, &index);
 
 	if (ptr.id.data && ptr.data && prop) {
-		path= RNA_path_from_ID_to_property(&ptr, prop);
+		path = RNA_path_from_ID_to_property(&ptr, prop);
 		
 		if (path) {
 			WM_clipboard_text_set(path, FALSE);
@@ -253,22 +255,22 @@ static int copy_data_path_button_exec(bContext *C, wmOperator *UNUSED(op))
 	}
 
 	/* since we're just copying, we don't really need to do anything else...*/
-	return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
+	return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
 }
 
 static void UI_OT_copy_data_path_button(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Copy Data Path";
-	ot->idname= "UI_OT_copy_data_path_button";
-	ot->description= "Copy the RNA data path for this property to the clipboard";
+	ot->name = "Copy Data Path";
+	ot->idname = "UI_OT_copy_data_path_button";
+	ot->description = "Copy the RNA data path for this property to the clipboard";
 
 	/* callbacks */
-	ot->exec= copy_data_path_button_exec;
+	ot->exec = copy_data_path_button_exec;
 	//op->poll= ??? // TODO: need to have some valid property before this can be done
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER;
+	ot->flag = OPTYPE_REGISTER;
 }
 
 /* Reset to Default Values Button Operator ------------------------ */
@@ -288,7 +290,7 @@ static int reset_default_button_exec(bContext *C, wmOperator *op)
 {
 	PointerRNA ptr;
 	PropertyRNA *prop;
-	int success= 0;
+	int success = 0;
 	int index, all = RNA_boolean_get(op->ptr, "all");
 
 	/* try to reset the nominated setting to its default value */
@@ -296,23 +298,23 @@ static int reset_default_button_exec(bContext *C, wmOperator *op)
 	
 	/* if there is a valid property that is editable... */
 	if (ptr.data && prop && RNA_property_editable(&ptr, prop)) {
-		if(RNA_property_reset(&ptr, prop, (all)? -1: index)) {
+		if (RNA_property_reset(&ptr, prop, (all) ? -1 : index)) {
 			/* perform updates required for this property */
 			RNA_property_update(C, &ptr, prop);
 
 			/* as if we pressed the button */
 			uiContextActivePropertyHandle(C);
 
-			success= 1;
+			success = 1;
 		}
 	}
 
-	/* Since we dont want to undo _all_ edits to settings, eg window
+	/* Since we don't want to undo _all_ edits to settings, eg window
 	 * edits on the screen or on operator settings.
 	 * it might be better to move undo's inline - campbell */
-	if(success) {
-		ID *id= ptr.id.data;
-		if(id && ID_CHECK_UNDO(id)) {
+	if (success) {
+		ID *id = ptr.id.data;
+		if (id && ID_CHECK_UNDO(id)) {
 			/* do nothing, go ahead with undo */
 		}
 		else {
@@ -321,22 +323,22 @@ static int reset_default_button_exec(bContext *C, wmOperator *op)
 	}
 	/* end hack */
 
-	return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
+	return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
 }
 
 static void UI_OT_reset_default_button(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Reset to Default Value";
-	ot->idname= "UI_OT_reset_default_button";
-	ot->description= "Reset this property's value to its default value";
+	ot->name = "Reset to Default Value";
+	ot->idname = "UI_OT_reset_default_button";
+	ot->description = "Reset this property's value to its default value";
 
 	/* callbacks */
-	ot->poll= reset_default_button_poll;
-	ot->exec= reset_default_button_exec;
+	ot->poll = reset_default_button_poll;
+	ot->exec = reset_default_button_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_UNDO;
+	ot->flag = OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_boolean(ot->srna, "all", 1, "All", "Reset to default values all elements of the array");
@@ -344,41 +346,72 @@ static void UI_OT_reset_default_button(wmOperatorType *ot)
 
 /* Copy To Selected Operator ------------------------ */
 
-static int copy_to_selected_list(bContext *C, PointerRNA *ptr, ListBase *lb)
+static int copy_to_selected_list(bContext *C, PointerRNA *ptr, ListBase *lb, int *use_path)
 {
-	if(RNA_struct_is_a(ptr->type, &RNA_Object))
-		*lb = CTX_data_collection_get(C, "selected_editable_objects");
-	else if(RNA_struct_is_a(ptr->type, &RNA_EditBone))
+	*use_path = 0;
+
+	if (RNA_struct_is_a(ptr->type, &RNA_EditBone))
 		*lb = CTX_data_collection_get(C, "selected_editable_bones");
-	else if(RNA_struct_is_a(ptr->type, &RNA_PoseBone))
+	else if (RNA_struct_is_a(ptr->type, &RNA_PoseBone))
 		*lb = CTX_data_collection_get(C, "selected_pose_bones");
-	else if(RNA_struct_is_a(ptr->type, &RNA_Sequence))
+	else if (RNA_struct_is_a(ptr->type, &RNA_Sequence))
 		*lb = CTX_data_collection_get(C, "selected_editable_sequences");
-	else
-		return 0;
+	else {
+		ID *id = ptr->id.data;
+
+		if (id && GS(id->name) == ID_OB) {
+			*lb = CTX_data_collection_get(C, "selected_editable_objects");
+			*use_path = 1;
+		}
+		else
+			return 0;
+	}
 	
 	return 1;
 }
 
 static int copy_to_selected_button_poll(bContext *C)
 {
-	PointerRNA ptr;
-	PropertyRNA *prop;
-	int index, success= 0;
+	PointerRNA ptr, lptr, idptr;
+	PropertyRNA *prop, *lprop;
+	int index, success = 0;
 
 	uiContextActiveProperty(C, &ptr, &prop, &index);
 
 	if (ptr.data && prop) {
+		char *path = NULL;
+		int use_path;
 		CollectionPointerLink *link;
 		ListBase lb;
 
-		if(copy_to_selected_list(C, &ptr, &lb)) {
-			for(link= lb.first; link; link=link->next)
-				if(link->ptr.data != ptr.data && RNA_property_editable(&link->ptr, prop))
-					success= 1;
+		if (!copy_to_selected_list(C, &ptr, &lb, &use_path))
+			return success;
+
+		if (!use_path || (path = RNA_path_from_ID_to_property(&ptr, prop))) {
+			for (link = lb.first; link; link = link->next) {
+				if (link->ptr.data != ptr.data) {
+					if (use_path) {
+						lprop = NULL;
+						RNA_id_pointer_create(link->ptr.id.data, &idptr);
+						RNA_path_resolve(&idptr, path, &lptr, &lprop);
+					}
+					else {
+						lptr = link->ptr;
+						lprop = prop;
+					}
+
+					if (lprop == prop) {
+						if (RNA_property_editable(&lptr, prop))
+							success = 1;
+					}
+				}
+			}
 
-			BLI_freelistN(&lb);
+			if (path)
+				MEM_freeN(path);
 		}
+
+		BLI_freelistN(&lb);
 	}
 
 	return success;
@@ -386,9 +419,9 @@ static int copy_to_selected_button_poll(bContext *C)
 
 static int copy_to_selected_button_exec(bContext *C, wmOperator *op)
 {
-	PointerRNA ptr;
-	PropertyRNA *prop;
-	int success= 0;
+	PointerRNA ptr, lptr, idptr;
+	PropertyRNA *prop, *lprop;
+	int success = 0;
 	int index, all = RNA_boolean_get(op->ptr, "all");
 
 	/* try to reset the nominated setting to its default value */
@@ -396,39 +429,61 @@ static int copy_to_selected_button_exec(bContext *C, wmOperator *op)
 	
 	/* if there is a valid property that is editable... */
 	if (ptr.data && prop) {
+		char *path = NULL;
+		int use_path;
 		CollectionPointerLink *link;
 		ListBase lb;
 
-		if(copy_to_selected_list(C, &ptr, &lb)) {
-			for(link= lb.first; link; link=link->next) {
-				if(link->ptr.data != ptr.data && RNA_property_editable(&link->ptr, prop)) {
-					if(RNA_property_copy(&link->ptr, &ptr, prop, (all)? -1: index)) {
-						RNA_property_update(C, &link->ptr, prop);
-						success= 1;
+		if (!copy_to_selected_list(C, &ptr, &lb, &use_path))
+			return success;
+
+		if (!use_path || (path = RNA_path_from_ID_to_property(&ptr, prop))) {
+			for (link = lb.first; link; link = link->next) {
+				if (link->ptr.data != ptr.data) {
+					if (use_path) {
+						lprop = NULL;
+						RNA_id_pointer_create(link->ptr.id.data, &idptr);
+						RNA_path_resolve(&idptr, path, &lptr, &lprop);
+					}
+					else {
+						lptr = link->ptr;
+						lprop = prop;
+					}
+
+					if (lprop == prop) {
+						if (RNA_property_editable(&lptr, lprop)) {
+							if (RNA_property_copy(&lptr, &ptr, prop, (all) ? -1 : index)) {
+								RNA_property_update(C, &lptr, prop);
+								success = 1;
+							}
+						}
 					}
 				}
 			}
 
-			BLI_freelistN(&lb);
+			if (path)
+				MEM_freeN(path);
 		}
+
+		BLI_freelistN(&lb);
 	}
 	
-	return (success)? OPERATOR_FINISHED: OPERATOR_CANCELLED;
+	return (success) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
 }
 
 static void UI_OT_copy_to_selected_button(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Copy To Selected";
-	ot->idname= "UI_OT_copy_to_selected_button";
-	ot->description= "Copy property from this object to selected objects or bones";
+	ot->name = "Copy To Selected";
+	ot->idname = "UI_OT_copy_to_selected_button";
+	ot->description = "Copy property from this object to selected objects or bones";
 
 	/* callbacks */
-	ot->poll= copy_to_selected_button_poll;
-	ot->exec= copy_to_selected_button_exec;
+	ot->poll = copy_to_selected_button_poll;
+	ot->exec = copy_to_selected_button_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "all", 1, "All", "Reset to default values all elements of the array");
@@ -458,7 +513,7 @@ static int reports_to_text_exec(bContext *C, wmOperator *UNUSED(op))
 	 *	- if commandline debug option enabled, show debug reports too
 	 *	- otherwise, up to info (which is what users normally see)
 	 */
-	str = BKE_reports_string(reports, (G.f & G_DEBUG)? RPT_DEBUG : RPT_INFO);
+	str = BKE_reports_string(reports, (G.debug & G_DEBUG) ? RPT_DEBUG : RPT_INFO);
 
 	if (str) {
 		write_text(txt, str);
@@ -474,20 +529,20 @@ static int reports_to_text_exec(bContext *C, wmOperator *UNUSED(op))
 static void UI_OT_reports_to_textblock(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Reports to Text Block";
-	ot->idname= "UI_OT_reports_to_textblock";
-	ot->description= "Write the reports ";
+	ot->name = "Reports to Text Block";
+	ot->idname = "UI_OT_reports_to_textblock";
+	ot->description = "Write the reports ";
 	
 	/* callbacks */
-	ot->poll= reports_to_text_poll;
-	ot->exec= reports_to_text_exec;
+	ot->poll = reports_to_text_poll;
+	ot->exec = reports_to_text_exec;
 }
 
 #ifdef WITH_PYTHON
 
 /* ------------------------------------------------------------------------- */
 /* EditSource Utility funcs and operator,
- * note, this includes itility functions and button matching checks */
+ * note, this includes utility functions and button matching checks */
 
 struct uiEditSourceStore {
 	uiBut but_orig;
@@ -500,7 +555,7 @@ struct uiEditSourceButStore {
 } uiEditSourceButStore;
 
 /* should only ever be set while the edit source operator is running */
-static struct uiEditSourceStore *ui_editsource_info= NULL;
+static struct uiEditSourceStore *ui_editsource_info = NULL;
 
 int  UI_editsource_enable_check(void)
 {
@@ -511,7 +566,7 @@ static void ui_editsource_active_but_set(uiBut *but)
 {
 	BLI_assert(ui_editsource_info == NULL);
 
-	ui_editsource_info= MEM_callocN(sizeof(uiEditSourceStore), __func__);
+	ui_editsource_info = MEM_callocN(sizeof(uiEditSourceStore), __func__);
 	memcpy(&ui_editsource_info->but_orig, but, sizeof(uiBut));
 
 	ui_editsource_info->hash = BLI_ghash_new(BLI_ghashutil_ptrhash,
@@ -523,7 +578,7 @@ static void ui_editsource_active_but_clear(void)
 {
 	BLI_ghash_free(ui_editsource_info->hash, NULL, (GHashValFreeFP)MEM_freeN);
 	MEM_freeN(ui_editsource_info);
-	ui_editsource_info= NULL;
+	ui_editsource_info = NULL;
 }
 
 static int ui_editsource_uibut_match(uiBut *but_a, uiBut *but_b)
@@ -536,16 +591,16 @@ static int ui_editsource_uibut_match(uiBut *but_a, uiBut *but_b)
 	/* this just needs to be a 'good-enough' comparison so we can know beyond
 	 * reasonable doubt that these buttons are the same between redraws.
 	 * if this fails it only means edit-source fails - campbell */
-	if(     (but_a->x1 == but_b->x1) &&
-	        (but_a->x2 == but_b->x2) &&
-	        (but_a->y1 == but_b->y1) &&
-	        (but_a->y2 == but_b->y2) &&
-	        (but_a->type == but_b->type) &&
-	        (but_a->rnaprop == but_b->rnaprop) &&
-	        (but_a->optype == but_b->optype) &&
-	        (but_a->unit_type == but_b->unit_type) &&
-	        strncmp(but_a->drawstr, but_b->drawstr, UI_MAX_DRAW_STR) == 0
-	) {
+	if ((but_a->x1 == but_b->x1) &&
+	    (but_a->x2 == but_b->x2) &&
+	    (but_a->y1 == but_b->y1) &&
+	    (but_a->y2 == but_b->y2) &&
+	    (but_a->type == but_b->type) &&
+	    (but_a->rnaprop == but_b->rnaprop) &&
+	    (but_a->optype == but_b->optype) &&
+	    (but_a->unit_type == but_b->unit_type) &&
+	    (strncmp(but_a->drawstr, but_b->drawstr, UI_MAX_DRAW_STR) == 0))
+	{
 		return TRUE;
 	}
 	else {
@@ -557,10 +612,10 @@ void UI_editsource_active_but_test(uiBut *but)
 {
 	extern void PyC_FileAndNum_Safe(const char **filename, int *lineno);
 
-	struct uiEditSourceButStore *but_store= MEM_callocN(sizeof(uiEditSourceButStore), __func__);
+	struct uiEditSourceButStore *but_store = MEM_callocN(sizeof(uiEditSourceButStore), __func__);
 
 	const char *fn;
-	int lineno= -1;
+	int lineno = -1;
 
 #if 0
 	printf("comparing buttons: '%s' == '%s'\n",
@@ -571,12 +626,12 @@ void UI_editsource_active_but_test(uiBut *but)
 
 	if (lineno != -1) {
 		BLI_strncpy(but_store->py_dbg_fn, fn,
-					sizeof(but_store->py_dbg_fn));
-		but_store->py_dbg_ln= lineno;
+		            sizeof(but_store->py_dbg_fn));
+		but_store->py_dbg_ln = lineno;
 	}
 	else {
-		but_store->py_dbg_fn[0]= '\0';
-		but_store->py_dbg_ln= -1;
+		but_store->py_dbg_fn[0] = '\0';
+		but_store->py_dbg_ln = -1;
 	}
 
 	BLI_ghash_insert(ui_editsource_info->hash, but, but_store);
@@ -587,17 +642,17 @@ void UI_editsource_active_but_test(uiBut *but)
 static int editsource_text_edit(bContext *C, wmOperator *op,
                                 char filepath[FILE_MAX], int line)
 {
-	struct Main *bmain= CTX_data_main(C);
+	struct Main *bmain = CTX_data_main(C);
 	Text *text;
 
-	for (text=bmain->text.first; text; text=text->id.next) {
+	for (text = bmain->text.first; text; text = text->id.next) {
 		if (text->name && BLI_path_cmp(text->name, filepath) == 0) {
 			break;
 		}
 	}
 
 	if (text == NULL) {
-		text= add_text(filepath, bmain->name);
+		text = add_text(filepath, bmain->name);
 	}
 
 	if (text == NULL) {
@@ -608,10 +663,10 @@ static int editsource_text_edit(bContext *C, wmOperator *op,
 	else {
 		/* naughty!, find text area to set, not good behavior
 		 * but since this is a dev tool lets allow it - campbell */
-		ScrArea *sa= BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_TEXT, 0);
-		if(sa) {
-			SpaceText *st= sa->spacedata.first;
-			st->text= text;
+		ScrArea *sa = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_TEXT, 0);
+		if (sa) {
+			SpaceText *st = sa->spacedata.first;
+			st->text = text;
 		}
 		else {
 			BKE_reportf(op->reports, RPT_INFO,
@@ -619,7 +674,7 @@ static int editsource_text_edit(bContext *C, wmOperator *op,
 		}
 
 		txt_move_toline(text, line - 1, FALSE);
-		WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, text);
+		WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
 	}
 
 	return OPERATOR_FINISHED;
@@ -627,13 +682,13 @@ static int editsource_text_edit(bContext *C, wmOperator *op,
 
 static int editsource_exec(bContext *C, wmOperator *op)
 {
-	uiBut *but= uiContextActiveButton(C);
+	uiBut *but = uiContextActiveButton(C);
 
 	if (but) {
 		GHashIterator ghi;
-		struct uiEditSourceButStore *but_store= NULL;
+		struct uiEditSourceButStore *but_store = NULL;
 
-		ARegion *ar= CTX_wm_region(C);
+		ARegion *ar = CTX_wm_region(C);
 		int ret;
 
 		/* needed else the active button does not get tested */
@@ -647,13 +702,13 @@ static int editsource_exec(bContext *C, wmOperator *op)
 		/* redraw and get active button python info */
 		ED_region_do_draw(C, ar);
 
-		for(BLI_ghashIterator_init(&ghi, ui_editsource_info->hash);
-		    !BLI_ghashIterator_isDone(&ghi);
-		    BLI_ghashIterator_step(&ghi))
+		for (BLI_ghashIterator_init(&ghi, ui_editsource_info->hash);
+		     !BLI_ghashIterator_isDone(&ghi);
+		     BLI_ghashIterator_step(&ghi))
 		{
-			uiBut *but= BLI_ghashIterator_getKey(&ghi);
+			uiBut *but = BLI_ghashIterator_getKey(&ghi);
 			if (but && ui_editsource_uibut_match(&ui_editsource_info->but_orig, but)) {
-				but_store= BLI_ghashIterator_getValue(&ghi);
+				but_store = BLI_ghashIterator_getValue(&ghi);
 				break;
 			}
 
@@ -661,20 +716,20 @@ static int editsource_exec(bContext *C, wmOperator *op)
 
 		if (but_store) {
 			if (but_store->py_dbg_ln != -1) {
-				ret= editsource_text_edit(C, op,
-				                          but_store->py_dbg_fn,
-				                          but_store->py_dbg_ln);
+				ret = editsource_text_edit(C, op,
+				                           but_store->py_dbg_fn,
+				                           but_store->py_dbg_ln);
 			}
 			else {
 				BKE_report(op->reports, RPT_ERROR,
-						   "Active button isn't from a script, cant edit source.");
-				ret= OPERATOR_CANCELLED;
+				           "Active button isn't from a script, cant edit source.");
+				ret = OPERATOR_CANCELLED;
 			}
 		}
 		else {
 			BKE_report(op->reports, RPT_ERROR,
-					   "Active button match can't be found.");
-			ret= OPERATOR_CANCELLED;
+			           "Active button match can't be found.");
+			ret = OPERATOR_CANCELLED;
 		}
 
 
@@ -693,12 +748,12 @@ static int editsource_exec(bContext *C, wmOperator *op)
 static void UI_OT_editsource(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Reports to Text Block";
-	ot->idname= "UI_OT_editsource";
-	ot->description= "Edit source code for a button";
+	ot->name = "Reports to Text Block";
+	ot->idname = "UI_OT_editsource";
+	ot->description = "Edit source code for a button";
 
 	/* callbacks */
-	ot->exec= editsource_exec;
+	ot->exec = editsource_exec;
 }
 
 #endif /* WITH_PYTHON */
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index d802c86..0be1761 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -65,15 +65,15 @@
 
 /*********************** defines and structs ************************/
 
-#define ANIMATION_TIME		0.30
-#define ANIMATION_INTERVAL	0.02
+#define ANIMATION_TIME      0.30
+#define ANIMATION_INTERVAL  0.02
 
-#define PNL_LAST_ADDED		1
-#define PNL_ACTIVE			2
-#define PNL_WAS_ACTIVE		4
-#define PNL_ANIM_ALIGN		8
-#define PNL_NEW_ADDED		16
-#define PNL_FIRST			32
+#define PNL_LAST_ADDED      1
+#define PNL_ACTIVE          2
+#define PNL_WAS_ACTIVE      4
+#define PNL_ANIM_ALIGN      8
+#define PNL_NEW_ADDED       16
+#define PNL_FIRST           32
 
 typedef enum uiHandlePanelState {
 	PANEL_STATE_DRAG,
@@ -103,17 +103,17 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
 
 static int panel_aligned(ScrArea *sa, ARegion *ar)
 {
-	if(sa->spacetype==SPACE_BUTS && ar->regiontype == RGN_TYPE_WINDOW) {
-		SpaceButs *sbuts= sa->spacedata.first;
+	if (sa->spacetype == SPACE_BUTS && ar->regiontype == RGN_TYPE_WINDOW) {
+		SpaceButs *sbuts = sa->spacedata.first;
 		return sbuts->align;
 	}
-	else if(sa->spacetype==SPACE_USERPREF && ar->regiontype == RGN_TYPE_WINDOW)
+	else if (sa->spacetype == SPACE_USERPREF && ar->regiontype == RGN_TYPE_WINDOW)
 		return BUT_VERTICAL;
-	else if(sa->spacetype==SPACE_FILE && ar->regiontype == RGN_TYPE_CHANNELS)
+	else if (sa->spacetype == SPACE_FILE && ar->regiontype == RGN_TYPE_CHANNELS)
 		return BUT_VERTICAL;
-	else if(sa->spacetype==SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW)
+	else if (sa->spacetype == SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW)
 		return BUT_VERTICAL; 
-	else if(ELEM3(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS))
+	else if (ELEM3(ar->regiontype, RGN_TYPE_UI, RGN_TYPE_TOOLS, RGN_TYPE_TOOL_PROPS))
 		return BUT_VERTICAL;
 	
 	return 0;
@@ -122,39 +122,39 @@ static int panel_aligned(ScrArea *sa, ARegion *ar)
 static int panels_re_align(ScrArea *sa, ARegion *ar, Panel **r_pa)
 {
 	Panel *pa;
-	int active= 0;
+	int active = 0;
 
-	*r_pa= NULL;
+	*r_pa = NULL;
 
-	if(sa->spacetype==SPACE_BUTS && ar->regiontype == RGN_TYPE_WINDOW) {
-		SpaceButs *sbuts= sa->spacedata.first;
+	if (sa->spacetype == SPACE_BUTS && ar->regiontype == RGN_TYPE_WINDOW) {
+		SpaceButs *sbuts = sa->spacedata.first;
 
-		if(sbuts->align)
-			if(sbuts->re_align || sbuts->mainbo!=sbuts->mainb)
+		if (sbuts->align)
+			if (sbuts->re_align || sbuts->mainbo != sbuts->mainb)
 				return 1;
 	}
-	else if(ar->regiontype==RGN_TYPE_UI)
+	else if (ar->regiontype == RGN_TYPE_UI)
 		return 1;
-	else if(sa->spacetype==SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW)
+	else if (sa->spacetype == SPACE_IMAGE && ar->regiontype == RGN_TYPE_PREVIEW)
 		return 1;
-	else if(sa->spacetype==SPACE_FILE && ar->regiontype == RGN_TYPE_CHANNELS)
+	else if (sa->spacetype == SPACE_FILE && ar->regiontype == RGN_TYPE_CHANNELS)
 		return 1;
 
 	/* in case panel is added or disappears */
-	for(pa=ar->panels.first; pa; pa=pa->next) {
-		if((pa->runtime_flag & PNL_WAS_ACTIVE) && !(pa->runtime_flag & PNL_ACTIVE))
+	for (pa = ar->panels.first; pa; pa = pa->next) {
+		if ((pa->runtime_flag & PNL_WAS_ACTIVE) && !(pa->runtime_flag & PNL_ACTIVE))
 			return 1;
-		if(!(pa->runtime_flag & PNL_WAS_ACTIVE) && (pa->runtime_flag & PNL_ACTIVE))
+		if (!(pa->runtime_flag & PNL_WAS_ACTIVE) && (pa->runtime_flag & PNL_ACTIVE))
 			return 1;
-		if(pa->activedata)
-			active= 1;
+		if (pa->activedata)
+			active = 1;
 	}
 
 	/* in case we need to do an animation (size changes) */
-	for(pa=ar->panels.first; pa; pa=pa->next) {
-		if(pa->runtime_flag & PNL_ANIM_ALIGN) {
-			if(!active)
-				*r_pa= pa;
+	for (pa = ar->panels.first; pa; pa = pa->next) {
+		if (pa->runtime_flag & PNL_ANIM_ALIGN) {
+			if (!active)
+				*r_pa = pa;
 			return 1;
 		}
 	}
@@ -168,60 +168,60 @@ static void ui_panel_copy_offset(Panel *pa, Panel *papar)
 {
 	/* with respect to sizes... papar is parent */
 
-	pa->ofsx= papar->ofsx;
-	pa->ofsy= papar->ofsy + papar->sizey-pa->sizey;
+	pa->ofsx = papar->ofsx;
+	pa->ofsy = papar->ofsy + papar->sizey - pa->sizey;
 }
 
 Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int *open)
 {
 	Panel *pa, *patab, *palast, *panext;
-	char *drawname= pt->label;
-	char *idname= pt->idname;
-	char *tabname= pt->idname;
-	char *hookname= NULL;
+	char *drawname = pt->label;
+	char *idname = pt->idname;
+	char *tabname = pt->idname;
+	char *hookname = NULL;
 	int newpanel;
-	int align= panel_aligned(sa, ar);
+	int align = panel_aligned(sa, ar);
 	
 	/* check if Panel exists, then use that one */
-	for(pa=ar->panels.first; pa; pa=pa->next)
-		if(strncmp(pa->panelname, idname, UI_MAX_NAME_STR)==0)
-			if(strncmp(pa->tabname, tabname, UI_MAX_NAME_STR)==0)
+	for (pa = ar->panels.first; pa; pa = pa->next)
+		if (strncmp(pa->panelname, idname, UI_MAX_NAME_STR) == 0)
+			if (strncmp(pa->tabname, tabname, UI_MAX_NAME_STR) == 0)
 				break;
 	
-	newpanel= (pa == NULL);
+	newpanel = (pa == NULL);
 
-	if(!newpanel) {
-		pa->type= pt;
+	if (!newpanel) {
+		pa->type = pt;
 	}
 	else {
 		/* new panel */
-		pa= MEM_callocN(sizeof(Panel), "new panel");
-		pa->type= pt;
+		pa = MEM_callocN(sizeof(Panel), "new panel");
+		pa->type = pt;
 		BLI_strncpy(pa->panelname, idname, UI_MAX_NAME_STR);
 		BLI_strncpy(pa->tabname, tabname, UI_MAX_NAME_STR);
 
-		if(pt->flag & PNL_DEFAULT_CLOSED) {
-			if(align == BUT_VERTICAL)
+		if (pt->flag & PNL_DEFAULT_CLOSED) {
+			if (align == BUT_VERTICAL)
 				pa->flag |= PNL_CLOSEDY;
 			else
 				pa->flag |= PNL_CLOSEDX;
 		}
 	
-		pa->ofsx= 0;
-		pa->ofsy= 0;
-		pa->sizex= 0;
-		pa->sizey= 0;
+		pa->ofsx = 0;
+		pa->ofsy = 0;
+		pa->sizex = 0;
+		pa->sizey = 0;
 		pa->runtime_flag |= PNL_NEW_ADDED;
 
 		BLI_addtail(&ar->panels, pa);
 		
 		/* make new Panel tabbed? */
-		if(hookname) {
-			for(patab= ar->panels.first; patab; patab= patab->next) {
-				if((patab->runtime_flag & PNL_ACTIVE) && patab->paneltab==NULL) {
-					if(strncmp(hookname, patab->panelname, UI_MAX_NAME_STR)==0) {
-						if(strncmp(tabname, patab->tabname, UI_MAX_NAME_STR)==0) {
-							pa->paneltab= patab;
+		if (hookname) {
+			for (patab = ar->panels.first; patab; patab = patab->next) {
+				if ((patab->runtime_flag & PNL_ACTIVE) && patab->paneltab == NULL) {
+					if (strncmp(hookname, patab->panelname, UI_MAX_NAME_STR) == 0) {
+						if (strncmp(tabname, patab->tabname, UI_MAX_NAME_STR) == 0) {
+							pa->paneltab = patab;
 							ui_panel_copy_offset(pa, patab);
 							break;
 						}
@@ -236,79 +236,79 @@ Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int
 	/* if a new panel is added, we insert it right after the panel
 	 * that was last added. this way new panels are inserted in the
 	 * right place between versions */
-	for(palast=ar->panels.first; palast; palast=palast->next)
-		if(palast->runtime_flag & PNL_LAST_ADDED)
+	for (palast = ar->panels.first; palast; palast = palast->next)
+		if (palast->runtime_flag & PNL_LAST_ADDED)
 			break;
 	
-	if(newpanel) {
-		pa->sortorder= (palast)? palast->sortorder+1: 0;
+	if (newpanel) {
+		pa->sortorder = (palast) ? palast->sortorder + 1 : 0;
 
-		for(panext=ar->panels.first; panext; panext=panext->next)
-			if(panext != pa && panext->sortorder >= pa->sortorder)
+		for (panext = ar->panels.first; panext; panext = panext->next)
+			if (panext != pa && panext->sortorder >= pa->sortorder)
 				panext->sortorder++;
 	}
 
-	if(palast)
+	if (palast)
 		palast->runtime_flag &= ~PNL_LAST_ADDED;
 
 	/* assign to block */
-	block->panel= pa;
-	pa->runtime_flag |= PNL_ACTIVE|PNL_LAST_ADDED;
+	block->panel = pa;
+	pa->runtime_flag |= PNL_ACTIVE | PNL_LAST_ADDED;
 
-	*open= 0;
+	*open = 0;
 
-	if(pa->paneltab) return pa;
-	if(pa->flag & PNL_CLOSED) return pa;
+	if (pa->paneltab) return pa;
+	if (pa->flag & PNL_CLOSED) return pa;
 
-	*open= 1;
+	*open = 1;
 	
 	return pa;
 }
 
 void uiEndPanel(uiBlock *block, int width, int height)
 {
-	Panel *pa= block->panel;
+	Panel *pa = block->panel;
 
-	if(pa->runtime_flag & PNL_NEW_ADDED) {
+	if (pa->runtime_flag & PNL_NEW_ADDED) {
 		pa->runtime_flag &= ~PNL_NEW_ADDED;
-		pa->sizex= width;
-		pa->sizey= height;
+		pa->sizex = width;
+		pa->sizey = height;
 	}
 	else {
 		/* check if we need to do an animation */
-		if(!ELEM(width, 0, pa->sizex) || !ELEM(height, 0, pa->sizey)) {
+		if (!ELEM(width, 0, pa->sizex) || !ELEM(height, 0, pa->sizey)) {
 			pa->runtime_flag |= PNL_ANIM_ALIGN;
-			if(height != 0)
-				pa->ofsy += pa->sizey-height;
+			if (height != 0)
+				pa->ofsy += pa->sizey - height;
 		}
 
 		/* update width/height if non-zero */
-		if(width != 0)
-			pa->sizex= width;
-		if(height != 0)
-			pa->sizey= height;
+		if (width != 0)
+			pa->sizex = width;
+		if (height != 0)
+			pa->sizey = height;
 	}
 }
 
 static void ui_offset_panel_block(uiBlock *block)
 {
-	uiStyle *style= UI_GetStyle();
+	uiStyle *style = UI_GetStyle();
 	uiBut *but;
 	int ofsy;
 
 	/* compute bounds and offset */
 	ui_bounds_block(block);
 
-	ofsy= block->panel->sizey - style->panelspace;
+	ofsy = block->panel->sizey - style->panelspace;
 
-	for(but= block->buttons.first; but; but=but->next) {
+	for (but = block->buttons.first; but; but = but->next) {
 		but->y1 += ofsy;
 		but->y2 += ofsy;
 	}
 
-	block->maxx= block->panel->sizex;
-	block->maxy= block->panel->sizey;
-	block->minx= block->miny= 0.0;
+	block->maxx = block->panel->sizex;
+	block->maxy = block->panel->sizey;
+	block->minx = block->miny = 0.0;
 }
 
 /**************************** drawing *******************************/
@@ -319,7 +319,7 @@ static void uiPanelPush(uiBlock *block)
 {
 	glPushMatrix(); 
 
-	if(block->panel)
+	if (block->panel)
 		glTranslatef((float)block->panel->ofsx, (float)block->panel->ofsy, 0.0);
 }
 
@@ -332,27 +332,27 @@ static void uiPanelPop(uiBlock *UNUSED(block))
 /* triangle 'icon' for panel header */
 void UI_DrawTriIcon(float x, float y, char dir)
 {
-	if(dir=='h') {
-		ui_draw_anti_tria( x-3, y-5, x-3, y+5, x+7,y );
+	if (dir == 'h') {
+		ui_draw_anti_tria(x - 3, y - 5, x - 3, y + 5, x + 7, y);
 	}
-	else if(dir=='t') {
-		ui_draw_anti_tria( x-5, y-7, x+5, y-7, x, y+3);	
+	else if (dir == 't') {
+		ui_draw_anti_tria(x - 5, y - 7, x + 5, y - 7, x, y + 3);
 	}
 	else { /* 'v' = vertical, down */
-		ui_draw_anti_tria( x-5, y+3, x+5, y+3, x, y-7);	
+		ui_draw_anti_tria(x - 5, y + 3, x + 5, y + 3, x, y - 7);
 	}
 }
 
 /* triangle 'icon' inside rect */
 static void ui_draw_tria_rect(rctf *rect, char dir)
 {
-	if(dir=='h') {
-		float half= 0.5f*(rect->ymax - rect->ymin);
-		ui_draw_anti_tria(rect->xmin, rect->ymin, rect->xmin, rect->ymax, rect->xmax, rect->ymin+half);
+	if (dir == 'h') {
+		float half = 0.5f * (rect->ymax - rect->ymin);
+		ui_draw_anti_tria(rect->xmin, rect->ymin, rect->xmin, rect->ymax, rect->xmax, rect->ymin + half);
 	}
 	else {
-		float half= 0.5f*(rect->xmax - rect->xmin);
-		ui_draw_anti_tria(rect->xmin, rect->ymax, rect->xmax, rect->ymax, rect->xmin+half, rect->ymin);
+		float half = 0.5f * (rect->xmax - rect->xmin);
+		ui_draw_anti_tria(rect->xmin, rect->ymax, rect->xmax, rect->ymax, rect->xmin + half, rect->ymin);
 	}
 }
 
@@ -379,33 +379,33 @@ static void ui_draw_anti_x(float x1, float y1, float x2, float y2)
 static void ui_draw_x_icon(float x, float y)
 {
 
-	ui_draw_anti_x(x, y, x+9.375f, y+9.375f);
+	ui_draw_anti_x(x, y, x + 9.375f, y + 9.375f);
 
 }
 
-#define PNL_ICON 	UI_UNIT_X  /* could be UI_UNIT_Y too */
+#define PNL_ICON    UI_UNIT_X  /* could be UI_UNIT_Y too */
 
 static void ui_draw_panel_scalewidget(rcti *rect)
 {
 	float xmin, xmax, dx;
 	float ymin, ymax, dy;
 	
-	xmin= rect->xmax-PNL_HEADER+2;
-	xmax= rect->xmax-3;
-	ymin= rect->ymin+3;
-	ymax= rect->ymin+PNL_HEADER-2;
+	xmin = rect->xmax - PNL_HEADER + 2;
+	xmax = rect->xmax - 3;
+	ymin = rect->ymin + 3;
+	ymax = rect->ymin + PNL_HEADER - 2;
 		
-	dx= 0.5f*(xmax-xmin);
-	dy= 0.5f*(ymax-ymin);
+	dx = 0.5f * (xmax - xmin);
+	dy = 0.5f * (ymax - ymin);
 	
 	glEnable(GL_BLEND);
 	glColor4ub(255, 255, 255, 50);
 	fdrawline(xmin, ymin, xmax, ymax);
-	fdrawline(xmin+dx, ymin, xmax, ymax-dy);
+	fdrawline(xmin + dx, ymin, xmax, ymax - dy);
 	
 	glColor4ub(0, 0, 0, 50);
-	fdrawline(xmin, ymin+1, xmax, ymax+1);
-	fdrawline(xmin+dx, ymin+1, xmax, ymax-dy+1);
+	fdrawline(xmin, ymin + 1, xmax, ymax + 1);
+	fdrawline(xmin + dx, ymin + 1, xmax, ymax - dy + 1);
 	glDisable(GL_BLEND);
 }
 
@@ -414,114 +414,114 @@ static void ui_draw_panel_dragwidget(rctf *rect)
 	float xmin, xmax, dx;
 	float ymin, ymax, dy;
 	
-	xmin= rect->xmin;
-	xmax= rect->xmax;
-	ymin= rect->ymin;
-	ymax= rect->ymax;
+	xmin = rect->xmin;
+	xmax = rect->xmax;
+	ymin = rect->ymin;
+	ymax = rect->ymax;
 	
-	dx= 0.333f*(xmax-xmin);
-	dy= 0.333f*(ymax-ymin);
+	dx = 0.333f * (xmax - xmin);
+	dy = 0.333f * (ymax - ymin);
 	
 	glEnable(GL_BLEND);
 	glColor4ub(255, 255, 255, 50);
 	fdrawline(xmin, ymax, xmax, ymin);
-	fdrawline(xmin+dx, ymax, xmax, ymin+dy);
-	fdrawline(xmin+2*dx, ymax, xmax, ymin+2*dy);
+	fdrawline(xmin + dx, ymax, xmax, ymin + dy);
+	fdrawline(xmin + 2 * dx, ymax, xmax, ymin + 2 * dy);
 	
 	glColor4ub(0, 0, 0, 50);
-	fdrawline(xmin, ymax+1, xmax, ymin+1);
-	fdrawline(xmin+dx, ymax+1, xmax, ymin+dy+1);
-	fdrawline(xmin+2*dx, ymax+1, xmax, ymin+2*dy+1);
+	fdrawline(xmin, ymax + 1, xmax, ymin + 1);
+	fdrawline(xmin + dx, ymax + 1, xmax, ymin + dy + 1);
+	fdrawline(xmin + 2 * dx, ymax + 1, xmax, ymin + 2 * dy + 1);
 	glDisable(GL_BLEND);
 }
 
 
 static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *rect, char dir)
 {
-	Panel *panel= block->panel;
+	Panel *panel = block->panel;
 	rcti hrect;
-	int  pnl_icons;
-	const char *activename= IFACE_(panel->drawname[0] ? panel->drawname : panel->panelname);
+	int pnl_icons;
+	const char *activename = IFACE_(panel->drawname[0] ? panel->drawname : panel->panelname);
 
 	/* + 0.001f to avoid flirting with float inaccuracy */
-	if(panel->control & UI_PNL_CLOSE) pnl_icons=(panel->labelofs+2*PNL_ICON+5)/block->aspect + 0.001f;
-	else pnl_icons= (panel->labelofs+PNL_ICON+5)/block->aspect + 0.001f;
+	if (panel->control & UI_PNL_CLOSE) pnl_icons = (panel->labelofs + 2 * PNL_ICON + 5) / block->aspect + 0.001f;
+	else pnl_icons = (panel->labelofs + PNL_ICON + 5) / block->aspect + 0.001f;
 	
 	/* active tab */
 	/* draw text label */
 	UI_ThemeColor(TH_TITLE);
 	
-	hrect= *rect;
-	if(dir == 'h') {
-		hrect.xmin= rect->xmin+pnl_icons;
-		hrect.ymin += 2.0f/block->aspect;
+	hrect = *rect;
+	if (dir == 'h') {
+		hrect.xmin = rect->xmin + pnl_icons;
+		hrect.ymin += 2.0f / block->aspect;
 		uiStyleFontDraw(&style->paneltitle, &hrect, activename);
 	}
 	else {
 		/* ignore 'pnl_icons', otherwise the text gets offset horizontally 
 		 * + 0.001f to avoid flirting with float inaccuracy
 		 */
-		hrect.xmin= rect->xmin + (PNL_ICON+5)/block->aspect + 0.001f;
+		hrect.xmin = rect->xmin + (PNL_ICON + 5) / block->aspect + 0.001f;
 		uiStyleFontDrawRotated(&style->paneltitle, &hrect, activename);
 	}
 }
 
 static void rectf_scale(rctf *rect, float scale)
 {
-	float centx= 0.5f*(rect->xmin+rect->xmax);
-	float centy= 0.5f*(rect->ymin+rect->ymax);
-	float sizex= 0.5f*scale*(rect->xmax - rect->xmin);
-	float sizey= 0.5f*scale*(rect->ymax - rect->ymin);
+	float centx = 0.5f * (rect->xmin + rect->xmax);
+	float centy = 0.5f * (rect->ymin + rect->ymax);
+	float sizex = 0.5f * scale * (rect->xmax - rect->xmin);
+	float sizey = 0.5f * scale * (rect->ymax - rect->ymin);
 	
-	rect->xmin= centx - sizex;
-	rect->xmax= centx + sizex;
-	rect->ymin= centy - sizey;
-	rect->ymax= centy + sizey;
+	rect->xmin = centx - sizex;
+	rect->xmax = centx + sizex;
+	rect->ymin = centy - sizey;
+	rect->ymax = centy + sizey;
 }
 
 /* panel integrated in buttonswindow, tool/property lists etc */
 void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
 {
-	bTheme *btheme= UI_GetTheme();
-	Panel *panel= block->panel;
+	bTheme *btheme = UI_GetTheme();
+	Panel *panel = block->panel;
 	rcti headrect;
 	rctf itemrect;
 	int ofsx;
 	
-	if(panel->paneltab) return;
-	if(panel->type && (panel->type->flag & PNL_NO_HEADER)) return;
+	if (panel->paneltab) return;
+	if (panel->type && (panel->type->flag & PNL_NO_HEADER)) return;
 
 	/* calculate header rect */
 	/* + 0.001f to prevent flicker due to float inaccuracy */
-	headrect= *rect;
-	headrect.ymin= headrect.ymax;
-	headrect.ymax= headrect.ymin + floor(PNL_HEADER/block->aspect + 0.001f);
+	headrect = *rect;
+	headrect.ymin = headrect.ymax;
+	headrect.ymax = headrect.ymin + floor(PNL_HEADER / block->aspect + 0.001f);
 	
 	{
-		float minx= rect->xmin;
-		float maxx= rect->xmax;
-		float y= headrect.ymax;
+		float minx = rect->xmin;
+		float maxx = rect->xmax;
+		float y = headrect.ymax;
 
 		glEnable(GL_BLEND);
 
-		if(btheme->tui.panel.show_header) {
+		if (btheme->tui.panel.show_header) {
 			/* draw with background color */
 			glEnable(GL_BLEND);
-			glColor4ubv((unsigned char*)btheme->tui.panel.header);
-			glRectf(minx, headrect.ymin+1, maxx, y);
+			glColor4ubv((unsigned char *)btheme->tui.panel.header);
+			glRectf(minx, headrect.ymin + 1, maxx, y);
 
 			fdrawline(minx, y, maxx, y);
 			fdrawline(minx, y, maxx, y);
 		}
-		else if(!(panel->runtime_flag & PNL_FIRST)) {
+		else if (!(panel->runtime_flag & PNL_FIRST)) {
 			/* draw embossed separator */
-			minx += 5.0f/block->aspect;
-			maxx -= 5.0f/block->aspect;
+			minx += 5.0f / block->aspect;
+			maxx -= 5.0f / block->aspect;
 			
 			glColor4f(0.0f, 0.0f, 0.0f, 0.5f);
 			fdrawline(minx, y, maxx, y);
 			glColor4f(1.0f, 1.0f, 1.0f, 0.25f);
-			fdrawline(minx, y-1, maxx, y-1);
+			fdrawline(minx, y - 1, maxx, y - 1);
 			glDisable(GL_BLEND);
 		}
 
@@ -529,26 +529,26 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
 	}
 	
 	/* horizontal title */
-	if(!(panel->flag & PNL_CLOSEDX)) {
+	if (!(panel->flag & PNL_CLOSEDX)) {
 		ui_draw_aligned_panel_header(style, block, &headrect, 'h');
 		
 		/* itemrect smaller */	
-		itemrect.xmax= headrect.xmax - 5.0f/block->aspect;
-		itemrect.xmin= itemrect.xmax - (headrect.ymax-headrect.ymin);
-		itemrect.ymin= headrect.ymin;
-		itemrect.ymax= headrect.ymax;
+		itemrect.xmax = headrect.xmax - 5.0f / block->aspect;
+		itemrect.xmin = itemrect.xmax - (headrect.ymax - headrect.ymin);
+		itemrect.ymin = headrect.ymin;
+		itemrect.ymax = headrect.ymax;
 
 		rectf_scale(&itemrect, 0.7f);
 		ui_draw_panel_dragwidget(&itemrect);
 	}
 	
 	/* if the panel is minimized vertically:
-		* (------)
-		*/
-	if(panel->flag & PNL_CLOSEDY) {
+	 * (------)
+	 */
+	if (panel->flag & PNL_CLOSEDY) {
 		
 	}
-	else if(panel->flag & PNL_CLOSEDX) {
+	else if (panel->flag & PNL_CLOSEDX) {
 		/* draw vertical title */
 		ui_draw_aligned_panel_header(style, block, &headrect, 'v');
 	}
@@ -556,42 +556,42 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
 	else {
 		
 		/* in some occasions, draw a border */
-		if(panel->flag & PNL_SELECT) {
-			if(panel->control & UI_PNL_SOLID) uiSetRoundBox(UI_CNR_ALL);
+		if (panel->flag & PNL_SELECT) {
+			if (panel->control & UI_PNL_SOLID) uiSetRoundBox(UI_CNR_ALL);
 			else uiSetRoundBox(UI_CNR_NONE);
 			
 			UI_ThemeColorShade(TH_BACK, -120);
-			uiRoundRect(0.5f + rect->xmin, 0.5f + rect->ymin, 0.5f + rect->xmax, 0.5f + headrect.ymax+1, 8);
+			uiRoundRect(0.5f + rect->xmin, 0.5f + rect->ymin, 0.5f + rect->xmax, 0.5f + headrect.ymax + 1, 8);
 		}
 		
-		if(panel->control & UI_PNL_SCALE)
+		if (panel->control & UI_PNL_SCALE)
 			ui_draw_panel_scalewidget(rect);
 	}
 	
 	/* draw optional close icon */
 	
-	ofsx= 6;
-	if(panel->control & UI_PNL_CLOSE) {
+	ofsx = 6;
+	if (panel->control & UI_PNL_CLOSE) {
 		
 		UI_ThemeColor(TH_TEXT);
-		ui_draw_x_icon(rect->xmin+2+ofsx, rect->ymax+2);
-		ofsx= 22;
+		ui_draw_x_icon(rect->xmin + 2 + ofsx, rect->ymax + 2);
+		ofsx = 22;
 	}
 	
 	/* draw collapse icon */
 	UI_ThemeColor(TH_TEXT);
 	
 	/* itemrect smaller */	
-	itemrect.xmin= headrect.xmin + 5.0f/block->aspect;
-	itemrect.xmax= itemrect.xmin + (headrect.ymax-headrect.ymin);
-	itemrect.ymin= headrect.ymin;
-	itemrect.ymax= headrect.ymax;
+	itemrect.xmin = headrect.xmin + 5.0f / block->aspect;
+	itemrect.xmax = itemrect.xmin + (headrect.ymax - headrect.ymin);
+	itemrect.ymin = headrect.ymin;
+	itemrect.ymax = headrect.ymax;
 	
 	rectf_scale(&itemrect, 0.35f);
 	
-	if(panel->flag & PNL_CLOSEDY)
+	if (panel->flag & PNL_CLOSEDY)
 		ui_draw_tria_rect(&itemrect, 'h');
-	else if(panel->flag & PNL_CLOSEDX)
+	else if (panel->flag & PNL_CLOSEDX)
 		ui_draw_tria_rect(&itemrect, 'h');
 	else
 		ui_draw_tria_rect(&itemrect, 'v');
@@ -603,7 +603,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
 
 static int get_panel_header(Panel *pa)
 {
-	if(pa->type && (pa->type->flag & PNL_NO_HEADER))
+	if (pa->type && (pa->type->flag & PNL_NO_HEADER))
 		return 0;
 
 	return PNL_HEADER;
@@ -611,27 +611,27 @@ static int get_panel_header(Panel *pa)
 
 static int get_panel_size_y(Panel *pa)
 {
-	if(pa->type && (pa->type->flag & PNL_NO_HEADER))
+	if (pa->type && (pa->type->flag & PNL_NO_HEADER))
 		return pa->sizey;
 
 	return PNL_HEADER + pa->sizey;
 }
 
-/* this function is needed because uiBlock and Panel itself dont
-change sizey or location when closed */
+/* this function is needed because uiBlock and Panel itself don't
+ * change sizey or location when closed */
 static int get_panel_real_ofsy(Panel *pa)
 {
-	if(pa->flag & PNL_CLOSEDY) return pa->ofsy+pa->sizey;
-	else if(pa->paneltab && (pa->paneltab->flag & PNL_CLOSEDY)) return pa->ofsy+pa->sizey;
-	else if(pa->paneltab) return pa->paneltab->ofsy;
+	if (pa->flag & PNL_CLOSEDY) return pa->ofsy + pa->sizey;
+	else if (pa->paneltab && (pa->paneltab->flag & PNL_CLOSEDY)) return pa->ofsy + pa->sizey;
+	else if (pa->paneltab) return pa->paneltab->ofsy;
 	else return pa->ofsy;
 }
 
 static int get_panel_real_ofsx(Panel *pa)
 {
-	if(pa->flag & PNL_CLOSEDX) return pa->ofsx+get_panel_header(pa);
-	else if(pa->paneltab && (pa->paneltab->flag & PNL_CLOSEDX)) return pa->ofsx+get_panel_header(pa);
-	else return pa->ofsx+pa->sizex;
+	if (pa->flag & PNL_CLOSEDX) return pa->ofsx + get_panel_header(pa);
+	else if (pa->paneltab && (pa->paneltab->flag & PNL_CLOSEDX)) return pa->ofsx + get_panel_header(pa);
+	else return pa->ofsx + pa->sizex;
 }
 
 typedef struct PanelSort {
@@ -639,19 +639,19 @@ typedef struct PanelSort {
 } PanelSort;
 
 /* note about sorting;
-   the sortorder has a lower value for new panels being added.
-   however, that only works to insert a single panel, when more new panels get
-   added the coordinates of existing panels and the previously stored to-be-insterted
-   panels do not match for sorting */
+ * the sortorder has a lower value for new panels being added.
+ * however, that only works to insert a single panel, when more new panels get
+ * added the coordinates of existing panels and the previously stored to-be-inserted
+ * panels do not match for sorting */
 
 static int find_leftmost_panel(const void *a1, const void *a2)
 {
-	const PanelSort *ps1=a1, *ps2=a2;
+	const PanelSort *ps1 = a1, *ps2 = a2;
 	
-	if(ps1->pa->ofsx > ps2->pa->ofsx) return 1;
-	else if(ps1->pa->ofsx < ps2->pa->ofsx) return -1;
-	else if(ps1->pa->sortorder > ps2->pa->sortorder) return 1;
-	else if(ps1->pa->sortorder < ps2->pa->sortorder) return -1;
+	if (ps1->pa->ofsx > ps2->pa->ofsx) return 1;
+	else if (ps1->pa->ofsx < ps2->pa->ofsx) return -1;
+	else if (ps1->pa->sortorder > ps2->pa->sortorder) return 1;
+	else if (ps1->pa->sortorder < ps2->pa->sortorder) return -1;
 
 	return 0;
 }
@@ -659,26 +659,26 @@ static int find_leftmost_panel(const void *a1, const void *a2)
 
 static int find_highest_panel(const void *a1, const void *a2)
 {
-	const PanelSort *ps1=a1, *ps2=a2;
+	const PanelSort *ps1 = a1, *ps2 = a2;
 	
 	/* stick uppermost header-less panels to the top of the region -
 	 * prevent them from being sorted */
 	if (ps1->pa->sortorder < ps2->pa->sortorder && ps1->pa->type->flag & PNL_NO_HEADER) return -1;
 	
-	if(ps1->pa->ofsy+ps1->pa->sizey < ps2->pa->ofsy+ps2->pa->sizey) return 1;
-	else if(ps1->pa->ofsy+ps1->pa->sizey > ps2->pa->ofsy+ps2->pa->sizey) return -1;
-	else if(ps1->pa->sortorder > ps2->pa->sortorder) return 1;
-	else if(ps1->pa->sortorder < ps2->pa->sortorder) return -1;
+	if (ps1->pa->ofsy + ps1->pa->sizey < ps2->pa->ofsy + ps2->pa->sizey) return 1;
+	else if (ps1->pa->ofsy + ps1->pa->sizey > ps2->pa->ofsy + ps2->pa->sizey) return -1;
+	else if (ps1->pa->sortorder > ps2->pa->sortorder) return 1;
+	else if (ps1->pa->sortorder < ps2->pa->sortorder) return -1;
 	
 	return 0;
 }
 
 static int compare_panel(const void *a1, const void *a2)
 {
-	const PanelSort *ps1=a1, *ps2=a2;
+	const PanelSort *ps1 = a1, *ps2 = a2;
 	
-	if(ps1->pa->sortorder > ps2->pa->sortorder) return 1;
-	else if(ps1->pa->sortorder < ps2->pa->sortorder) return -1;
+	if (ps1->pa->sortorder > ps2->pa->sortorder) return 1;
+	else if (ps1->pa->sortorder < ps2->pa->sortorder) return -1;
 	
 	return 0;
 }
@@ -689,86 +689,86 @@ static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag)
 {
 	Panel *pa;
 	PanelSort *ps, *panelsort, *psnext;
-	int a, tot=0, done;
-	int align= panel_aligned(sa, ar);
+	int a, tot = 0, done;
+	int align = panel_aligned(sa, ar);
 	
 	/* count active, not tabbed panels */
-	for(pa= ar->panels.first; pa; pa= pa->next)
-		if((pa->runtime_flag & PNL_ACTIVE) && pa->paneltab==NULL)
+	for (pa = ar->panels.first; pa; pa = pa->next)
+		if ((pa->runtime_flag & PNL_ACTIVE) && pa->paneltab == NULL)
 			tot++;
 
-	if(tot==0) return 0;
+	if (tot == 0) return 0;
 
 	/* extra; change close direction? */
-	for(pa= ar->panels.first; pa; pa= pa->next) {
-		if((pa->runtime_flag & PNL_ACTIVE) && pa->paneltab==NULL) {
-			if((pa->flag & PNL_CLOSEDX) && (align==BUT_VERTICAL))
+	for (pa = ar->panels.first; pa; pa = pa->next) {
+		if ((pa->runtime_flag & PNL_ACTIVE) && pa->paneltab == NULL) {
+			if ((pa->flag & PNL_CLOSEDX) && (align == BUT_VERTICAL))
 				pa->flag ^= PNL_CLOSED;
-			else if((pa->flag & PNL_CLOSEDY) && (align==BUT_HORIZONTAL))
+			else if ((pa->flag & PNL_CLOSEDY) && (align == BUT_HORIZONTAL))
 				pa->flag ^= PNL_CLOSED;
 		}
 	}
 
 	/* sort panels */
-	panelsort= MEM_callocN(tot*sizeof(PanelSort), "panelsort");
+	panelsort = MEM_callocN(tot * sizeof(PanelSort), "panelsort");
 	
-	ps= panelsort;
-	for(pa= ar->panels.first; pa; pa= pa->next) {
-		if((pa->runtime_flag & PNL_ACTIVE) && pa->paneltab==NULL) {
-			ps->pa= MEM_dupallocN(pa);
-			ps->orig= pa;
+	ps = panelsort;
+	for (pa = ar->panels.first; pa; pa = pa->next) {
+		if ((pa->runtime_flag & PNL_ACTIVE) && pa->paneltab == NULL) {
+			ps->pa = MEM_dupallocN(pa);
+			ps->orig = pa;
 			ps++;
 		}
 	}
 	
-	if(drag) {
+	if (drag) {
 		/* while we are dragging, we sort on location and update sortorder */
-		if(align==BUT_VERTICAL) 
+		if (align == BUT_VERTICAL)
 			qsort(panelsort, tot, sizeof(PanelSort), find_highest_panel);
 		else
 			qsort(panelsort, tot, sizeof(PanelSort), find_leftmost_panel);
 
-		for(ps=panelsort, a=0; a<tot; a++, ps++)
-			ps->orig->sortorder= a;
+		for (ps = panelsort, a = 0; a < tot; a++, ps++)
+			ps->orig->sortorder = a;
 	}
 	else
 		/* otherwise use sortorder */
 		qsort(panelsort, tot, sizeof(PanelSort), compare_panel);
 	
 	/* no smart other default start loc! this keeps switching f5/f6/etc compatible */
-	ps= panelsort;
-	ps->pa->ofsx= 0;
-	ps->pa->ofsy= -get_panel_size_y(ps->pa);
+	ps = panelsort;
+	ps->pa->ofsx = 0;
+	ps->pa->ofsy = -get_panel_size_y(ps->pa);
 
-	for(a=0; a<tot-1; a++, ps++) {
-		psnext= ps+1;
-	
-		if(align==BUT_VERTICAL) {
-			psnext->pa->ofsx= ps->pa->ofsx;
-			psnext->pa->ofsy= get_panel_real_ofsy(ps->pa) - get_panel_size_y(psnext->pa);
+	for (a = 0; a < tot - 1; a++, ps++) {
+		psnext = ps + 1;
+
+		if (align == BUT_VERTICAL) {
+			psnext->pa->ofsx = ps->pa->ofsx;
+			psnext->pa->ofsy = get_panel_real_ofsy(ps->pa) - get_panel_size_y(psnext->pa);
 		}
 		else {
-			psnext->pa->ofsx= get_panel_real_ofsx(ps->pa);
-			psnext->pa->ofsy= ps->pa->ofsy + get_panel_size_y(ps->pa) - get_panel_size_y(psnext->pa);
+			psnext->pa->ofsx = get_panel_real_ofsx(ps->pa);
+			psnext->pa->ofsy = ps->pa->ofsy + get_panel_size_y(ps->pa) - get_panel_size_y(psnext->pa);
 		}
 	}
 	
 	/* we interpolate */
-	done= 0;
-	ps= panelsort;
-	for(a=0; a<tot; a++, ps++) {
-		if((ps->pa->flag & PNL_SELECT)==0) {
-			if((ps->orig->ofsx != ps->pa->ofsx) || (ps->orig->ofsy != ps->pa->ofsy)) {
-				ps->orig->ofsx= floorf(0.5f + fac*(float)ps->pa->ofsx + (1.0f-fac)*(float)ps->orig->ofsx);
-				ps->orig->ofsy= floorf(0.5f + fac*(float)ps->pa->ofsy + (1.0f-fac)*(float)ps->orig->ofsy);
-				done= 1;
+	done = 0;
+	ps = panelsort;
+	for (a = 0; a < tot; a++, ps++) {
+		if ((ps->pa->flag & PNL_SELECT) == 0) {
+			if ((ps->orig->ofsx != ps->pa->ofsx) || (ps->orig->ofsy != ps->pa->ofsy)) {
+				ps->orig->ofsx = floorf(0.5f + fac * (float)ps->pa->ofsx + (1.0f - fac) * (float)ps->orig->ofsx);
+				ps->orig->ofsy = floorf(0.5f + fac * (float)ps->pa->ofsy + (1.0f - fac) * (float)ps->orig->ofsy);
+				done = 1;
 			}
 		}
 	}
 
 	/* copy locations to tabs */
-	for(pa= ar->panels.first; pa; pa= pa->next)
-		if(pa->paneltab && (pa->runtime_flag & PNL_ACTIVE))
+	for (pa = ar->panels.first; pa; pa = pa->next)
+		if (pa->paneltab && (pa->runtime_flag & PNL_ACTIVE))
 			ui_panel_copy_offset(pa, pa->paneltab);
 
 	/* free panelsort array */
@@ -783,51 +783,51 @@ static int uiAlignPanelStep(ScrArea *sa, ARegion *ar, float fac, int drag)
 static void ui_panels_size(ScrArea *sa, ARegion *ar, int *x, int *y)
 {
 	Panel *pa;
-	int align= panel_aligned(sa, ar);
+	int align = panel_aligned(sa, ar);
 	int sizex = UI_PANEL_WIDTH;
 	int sizey = UI_PANEL_WIDTH;
 
 	/* compute size taken up by panels, for setting in view2d */
-	for(pa= ar->panels.first; pa; pa= pa->next) {
-		if(pa->runtime_flag & PNL_ACTIVE) {
+	for (pa = ar->panels.first; pa; pa = pa->next) {
+		if (pa->runtime_flag & PNL_ACTIVE) {
 			int pa_sizex, pa_sizey;
 
-			if(align==BUT_VERTICAL) {
-				pa_sizex= pa->ofsx + pa->sizex;
-				pa_sizey= get_panel_real_ofsy(pa);
+			if (align == BUT_VERTICAL) {
+				pa_sizex = pa->ofsx + pa->sizex;
+				pa_sizey = get_panel_real_ofsy(pa);
 			}
 			else {
-				pa_sizex= get_panel_real_ofsx(pa) + pa->sizex;
-				pa_sizey= pa->ofsy + get_panel_size_y(pa);
+				pa_sizex = get_panel_real_ofsx(pa) + pa->sizex;
+				pa_sizey = pa->ofsy + get_panel_size_y(pa);
 			}
 
-			sizex= MAX2(sizex, pa_sizex);
-			sizey= MIN2(sizey, pa_sizey);
+			sizex = MAX2(sizex, pa_sizex);
+			sizey = MIN2(sizey, pa_sizey);
 		}
 	}
 
-	*x= sizex;
-	*y= sizey;
+	*x = sizex;
+	*y = sizey;
 }
 
 static void ui_do_animate(const bContext *C, Panel *panel)
 {
-	uiHandlePanelData *data= panel->activedata;
-	ScrArea *sa= CTX_wm_area(C);
-	ARegion *ar= CTX_wm_region(C);
+	uiHandlePanelData *data = panel->activedata;
+	ScrArea *sa = CTX_wm_area(C);
+	ARegion *ar = CTX_wm_region(C);
 	float fac;
 
-	fac= (PIL_check_seconds_timer()-data->starttime)/ANIMATION_TIME;
-	fac= sqrt(fac);
-	fac= MIN2(fac, 1.0f);
+	fac = (PIL_check_seconds_timer() - data->starttime) / ANIMATION_TIME;
+	fac = sqrt(fac);
+	fac = MIN2(fac, 1.0f);
 
 	/* for max 1 second, interpolate positions */
-	if(uiAlignPanelStep(sa, ar, fac, 0))
+	if (uiAlignPanelStep(sa, ar, fac, 0))
 		ED_region_tag_redraw(ar);
 	else
-		fac= 1.0f;
+		fac = 1.0f;
 
-	if(fac >= 1.0f) {
+	if (fac >= 1.0f) {
 		panel_activate_state(C, panel, PANEL_STATE_EXIT);
 		return;
 	}
@@ -837,69 +837,69 @@ void uiBeginPanels(const bContext *UNUSED(C), ARegion *ar)
 {
 	Panel *pa;
   
-	  /* set all panels as inactive, so that at the end we know
+	/* set all panels as inactive, so that at the end we know
 	 * which ones were used */
-	for(pa=ar->panels.first; pa; pa=pa->next) {
-		if(pa->runtime_flag & PNL_ACTIVE)
-			pa->runtime_flag= PNL_WAS_ACTIVE;
+	for (pa = ar->panels.first; pa; pa = pa->next) {
+		if (pa->runtime_flag & PNL_ACTIVE)
+			pa->runtime_flag = PNL_WAS_ACTIVE;
 		else
-			pa->runtime_flag= 0;
+			pa->runtime_flag = 0;
 	}
 }
 
 /* only draws blocks with panels */
 void uiEndPanels(const bContext *C, ARegion *ar, int *x, int *y)
 {
-	ScrArea *sa= CTX_wm_area(C);
+	ScrArea *sa = CTX_wm_area(C);
 	uiBlock *block;
 	Panel *panot, *panew, *patest, *pa, *firstpa;
 	
 	/* offset contents */
-	for(block= ar->uiblocks.first; block; block= block->next)
-		if(block->active && block->panel)
+	for (block = ar->uiblocks.first; block; block = block->next)
+		if (block->active && block->panel)
 			ui_offset_panel_block(block);
 
 	/* consistency; are panels not made, whilst they have tabs */
-	for(panot= ar->panels.first; panot; panot= panot->next) {
-		if((panot->runtime_flag & PNL_ACTIVE)==0) { // not made
+	for (panot = ar->panels.first; panot; panot = panot->next) {
+		if ((panot->runtime_flag & PNL_ACTIVE) == 0) { // not made
 
-			for(panew= ar->panels.first; panew; panew= panew->next) {
-				if((panew->runtime_flag & PNL_ACTIVE)) {
-					if(panew->paneltab==panot) { // panew is tab in notmade pa
+			for (panew = ar->panels.first; panew; panew = panew->next) {
+				if ((panew->runtime_flag & PNL_ACTIVE)) {
+					if (panew->paneltab == panot) { // panew is tab in notmade pa
 						break;
 					}
 				}
 			}
 			/* now panew can become the new parent, check all other tabs */
-			if(panew) {
-				for(patest= ar->panels.first; patest; patest= patest->next) {
-					if(patest->paneltab == panot) {
-						patest->paneltab= panew;
+			if (panew) {
+				for (patest = ar->panels.first; patest; patest = patest->next) {
+					if (patest->paneltab == panot) {
+						patest->paneltab = panew;
 					}
 				}
-				panot->paneltab= panew;
-				panew->paneltab= NULL;
+				panot->paneltab = panew;
+				panew->paneltab = NULL;
 				ED_region_tag_redraw(ar); // the buttons panew were not made
 			}
 		}	
 	}
 
 	/* re-align, possibly with animation */
-	if(panels_re_align(sa, ar, &pa)) {
-		if(pa)
+	if (panels_re_align(sa, ar, &pa)) {
+		if (pa)
 			panel_activate_state(C, pa, PANEL_STATE_ANIMATION);
 		else
 			uiAlignPanelStep(sa, ar, 1.0, 0);
 	}
 
 	/* tag first panel */
-	firstpa= NULL;
-	for(block= ar->uiblocks.first; block; block=block->next)
-		if(block->active && block->panel)
-			if(!firstpa || block->panel->sortorder < firstpa->sortorder)
-				firstpa= block->panel;
+	firstpa = NULL;
+	for (block = ar->uiblocks.first; block; block = block->next)
+		if (block->active && block->panel)
+			if (!firstpa || block->panel->sortorder < firstpa->sortorder)
+				firstpa = block->panel;
 	
-	if(firstpa)
+	if (firstpa)
 		firstpa->runtime_flag |= PNL_FIRST;
 	
 	/* compute size taken up by panel */
@@ -913,14 +913,14 @@ void uiDrawPanels(const bContext *C, ARegion *ar)
 	UI_ThemeClearColor(TH_BACK);
 	
 	/* draw panels, selected on top */
-	for(block= ar->uiblocks.first; block; block=block->next) {
-		if(block->active && block->panel && !(block->panel->flag & PNL_SELECT)) {
+	for (block = ar->uiblocks.first; block; block = block->next) {
+		if (block->active && block->panel && !(block->panel->flag & PNL_SELECT)) {
 			uiDrawBlock(C, block);
 		}
 	}
 
-	for(block= ar->uiblocks.first; block; block=block->next) {
-		if(block->active && block->panel && (block->panel->flag & PNL_SELECT)) {
+	for (block = ar->uiblocks.first; block; block = block->next) {
+		if (block->active && block->panel && (block->panel->flag & PNL_SELECT)) {
 			uiDrawBlock(C, block);
 		}
 	}
@@ -934,22 +934,22 @@ static void check_panel_overlap(ARegion *ar, Panel *panel)
 
 	/* also called with panel==NULL for clear */
 	
-	for(pa=ar->panels.first; pa; pa=pa->next) {
+	for (pa = ar->panels.first; pa; pa = pa->next) {
 		pa->flag &= ~PNL_OVERLAP;
-		if(panel && (pa != panel)) {
-			if(pa->paneltab==NULL && (pa->runtime_flag & PNL_ACTIVE)) {
-				float safex= 0.2, safey= 0.2;
-				
-				if(pa->flag & PNL_CLOSEDX) safex= 0.05;
-				else if(pa->flag & PNL_CLOSEDY) safey= 0.05;
-				else if(panel->flag & PNL_CLOSEDX) safex= 0.05;
-				else if(panel->flag & PNL_CLOSEDY) safey= 0.05;
+		if (panel && (pa != panel)) {
+			if (pa->paneltab == NULL && (pa->runtime_flag & PNL_ACTIVE)) {
+				float safex = 0.2, safey = 0.2;
 				
-				if(pa->ofsx > panel->ofsx- safex*panel->sizex)
-				if(pa->ofsx+pa->sizex < panel->ofsx+ (1.0f+safex)*panel->sizex)
-				if(pa->ofsy > panel->ofsy- safey*panel->sizey)
-				if(pa->ofsy+pa->sizey < panel->ofsy+ (1.0f+safey)*panel->sizey)
-					pa->flag |= PNL_OVERLAP;
+				if (pa->flag & PNL_CLOSEDX) safex = 0.05;
+				else if (pa->flag & PNL_CLOSEDY) safey = 0.05;
+				else if (panel->flag & PNL_CLOSEDX) safex = 0.05;
+				else if (panel->flag & PNL_CLOSEDY) safey = 0.05;
+
+				if (pa->ofsx > panel->ofsx - safex * panel->sizex)
+					if (pa->ofsx + pa->sizex < panel->ofsx + (1.0f + safex) * panel->sizex)
+						if (pa->ofsy > panel->ofsy - safey * panel->sizey)
+							if (pa->ofsy + pa->sizey < panel->ofsy + (1.0f + safey) * panel->sizey)
+								pa->flag |= PNL_OVERLAP;
 			}
 		}
 	}
@@ -959,39 +959,39 @@ static void check_panel_overlap(ARegion *ar, Panel *panel)
 
 static void ui_do_drag(const bContext *C, wmEvent *event, Panel *panel)
 {
-	uiHandlePanelData *data= panel->activedata;
-	ScrArea *sa= CTX_wm_area(C);
-	ARegion *ar= CTX_wm_region(C);
-	short align= panel_aligned(sa, ar), dx=0, dy=0;
+	uiHandlePanelData *data = panel->activedata;
+	ScrArea *sa = CTX_wm_area(C);
+	ARegion *ar = CTX_wm_region(C);
+	short align = panel_aligned(sa, ar), dx = 0, dy = 0;
 	
 	/* first clip for window, no dragging outside */
-	if(!BLI_in_rcti(&ar->winrct, event->x, event->y))
+	if (!BLI_in_rcti(&ar->winrct, event->x, event->y))
 		return;
 
-	dx= (event->x-data->startx) & ~(PNL_GRID-1);
-	dy= (event->y-data->starty) & ~(PNL_GRID-1);
+	dx = (event->x - data->startx) & ~(PNL_GRID - 1);
+	dy = (event->y - data->starty) & ~(PNL_GRID - 1);
 
-	dx *= (float)(ar->v2d.cur.xmax - ar->v2d.cur.xmin)/(float)(ar->winrct.xmax - ar->winrct.xmin);
-	dy *= (float)(ar->v2d.cur.ymax - ar->v2d.cur.ymin)/(float)(ar->winrct.ymax - ar->winrct.ymin);
+	dx *= (float)(ar->v2d.cur.xmax - ar->v2d.cur.xmin) / (float)(ar->winrct.xmax - ar->winrct.xmin);
+	dy *= (float)(ar->v2d.cur.ymax - ar->v2d.cur.ymin) / (float)(ar->winrct.ymax - ar->winrct.ymin);
 	
-	if(data->state == PANEL_STATE_DRAG_SCALE) {
-		panel->sizex = MAX2(data->startsizex+dx, UI_PANEL_MINX);
+	if (data->state == PANEL_STATE_DRAG_SCALE) {
+		panel->sizex = MAX2(data->startsizex + dx, UI_PANEL_MINX);
 		
-		if(data->startsizey-dy < UI_PANEL_MINY)
-			dy= -UI_PANEL_MINY+data->startsizey;
+		if (data->startsizey - dy < UI_PANEL_MINY)
+			dy = -UI_PANEL_MINY + data->startsizey;
 
-		panel->sizey= data->startsizey-dy;
-		panel->ofsy= data->startofsy+dy;
+		panel->sizey = data->startsizey - dy;
+		panel->ofsy = data->startofsy + dy;
 	}
 	else {
 		/* reset the panel snapping, to allow dragging away from snapped edges */
 		panel->snap = PNL_SNAP_NONE;
 		
-		panel->ofsx = data->startofsx+dx;
-		panel->ofsy = data->startofsy+dy;
+		panel->ofsx = data->startofsx + dx;
+		panel->ofsy = data->startofsy + dy;
 		check_panel_overlap(ar, panel);
 		
-		if(align) uiAlignPanelStep(sa, ar, 0.2, 1);
+		if (align) uiAlignPanelStep(sa, ar, 0.2, 1);
 	}
 
 	ED_region_tag_redraw(ar);
@@ -1001,70 +1001,70 @@ static void ui_do_drag(const bContext *C, wmEvent *event, Panel *panel)
 
 
 /* this function is supposed to call general window drawing too */
-/* also it supposes a block has panel, and isnt a menu */
+/* also it supposes a block has panel, and isn't a menu */
 static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, int my, int event)
 {
-	ScrArea *sa= CTX_wm_area(C);
-	ARegion *ar= CTX_wm_region(C);
+	ScrArea *sa = CTX_wm_area(C);
+	ARegion *ar = CTX_wm_region(C);
 	Panel *pa;
-	int align= panel_aligned(sa, ar), button= 0;
+	int align = panel_aligned(sa, ar), button = 0;
 
 	/* mouse coordinates in panel space! */
 	
 	/* XXX weak code, currently it assumes layout style for location of widgets */
 	
 	/* check open/collapsed button */
-	if(event==RETKEY)
-		button= 1;
-	else if(event==AKEY)
-		button= 1;
-	else if(block->panel->flag & PNL_CLOSEDX) {
-		if(my >= block->maxy) button= 1;
+	if (event == RETKEY)
+		button = 1;
+	else if (event == AKEY)
+		button = 1;
+	else if (block->panel->flag & PNL_CLOSEDX) {
+		if (my >= block->maxy) button = 1;
 	}
-	else if(block->panel->control & UI_PNL_CLOSE) {
+	else if (block->panel->control & UI_PNL_CLOSE) {
 		/* whole of header can be used to collapse panel (except top-right corner) */
-		if(mx <= block->maxx-8-PNL_ICON) button= 2;
-		//else if(mx <= block->minx+10+2*PNL_ICON+2) button= 1;
+		if (mx <= block->maxx - 8 - PNL_ICON) button = 2;
+		//else if (mx <= block->minx+10+2*PNL_ICON+2) button= 1;
 	}
-	else if(mx <= block->maxx-PNL_ICON-12) {
-		button= 1;
+	else if (mx <= block->maxx - PNL_ICON - 12) {
+		button = 1;
 	}
 	
-	if(button) {
-		if(button==2) { // close
+	if (button) {
+		if (button == 2) { // close
 			ED_region_tag_redraw(ar);
 		}
-		else {	// collapse
-			if(block->panel->flag & PNL_CLOSED) {
+		else {  // collapse
+			if (block->panel->flag & PNL_CLOSED) {
 				block->panel->flag &= ~PNL_CLOSED;
 				/* snap back up so full panel aligns with screen edge */
 				if (block->panel->snap & PNL_SNAP_BOTTOM) 
-					block->panel->ofsy= 0;
+					block->panel->ofsy = 0;
 			}
-			else if(align==BUT_HORIZONTAL) {
+			else if (align == BUT_HORIZONTAL) {
 				block->panel->flag |= PNL_CLOSEDX;
 			}
 			else {
 				/* snap down to bottom screen edge*/
 				block->panel->flag |= PNL_CLOSEDY;
 				if (block->panel->snap & PNL_SNAP_BOTTOM) 
-					block->panel->ofsy= -block->panel->sizey;
+					block->panel->ofsy = -block->panel->sizey;
 			}
 			
-			for(pa= ar->panels.first; pa; pa= pa->next) {
-				if(pa->paneltab==block->panel) {
-					if(block->panel->flag & PNL_CLOSED) pa->flag |= PNL_CLOSED;
+			for (pa = ar->panels.first; pa; pa = pa->next) {
+				if (pa->paneltab == block->panel) {
+					if (block->panel->flag & PNL_CLOSED) pa->flag |= PNL_CLOSED;
 					else pa->flag &= ~PNL_CLOSED;
 				}
 			}
 		}
 
-		if(align)
+		if (align)
 			panel_activate_state(C, block->panel, PANEL_STATE_ANIMATION);
 		else
 			ED_region_tag_redraw(ar);
 	}
-	else if(mx <= (block->maxx-PNL_ICON-12)+PNL_ICON+2) {
+	else if (mx <= (block->maxx - PNL_ICON - 12) + PNL_ICON + 2) {
 		panel_activate_state(C, block->panel, PANEL_STATE_DRAG);
 	}
 }
@@ -1074,35 +1074,35 @@ static void ui_handle_panel_header(const bContext *C, uiBlock *block, int mx, in
 
 int ui_handler_panel_region(bContext *C, wmEvent *event)
 {
-	ARegion *ar= CTX_wm_region(C);
+	ARegion *ar = CTX_wm_region(C);
 	uiBlock *block;
 	Panel *pa;
-	int retval, mx, my, inside_header= 0, inside_scale= 0, inside;
+	int retval, mx, my, inside_header = 0, inside_scale = 0, inside;
 
-	retval= WM_UI_HANDLER_CONTINUE;
-	for(block=ar->uiblocks.last; block; block=block->prev) {
-		mx= event->x;
-		my= event->y;
+	retval = WM_UI_HANDLER_CONTINUE;
+	for (block = ar->uiblocks.last; block; block = block->prev) {
+		mx = event->x;
+		my = event->y;
 		ui_window_to_block(ar, block, &mx, &my);
 
 		/* check if inside boundbox */
-		inside= 0;
-		pa= block->panel;
+		inside = 0;
+		pa = block->panel;
 
-		if(!pa || pa->paneltab!=NULL)
+		if (!pa || pa->paneltab != NULL)
 			continue;
-		if(pa->type && pa->type->flag & PNL_NO_HEADER) // XXX - accessed freed panels when scripts reload, need to fix.
+		if (pa->type && pa->type->flag & PNL_NO_HEADER) // XXX - accessed freed panels when scripts reload, need to fix.
 			continue;
 
-		if(block->minx <= mx && block->maxx >= mx)
-			if(block->miny <= my && block->maxy+PNL_HEADER >= my)
-				inside= 1;
+		if (block->minx <= mx && block->maxx >= mx)
+			if (block->miny <= my && block->maxy + PNL_HEADER >= my)
+				inside = 1;
 		
-		if(inside && event->val==KM_PRESS) {
-			if(event->type == AKEY && !ELEM4(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift, event->alt)) {
+		if (inside && event->val == KM_PRESS) {
+			if (event->type == AKEY && !ELEM4(KM_MOD_FIRST, event->ctrl, event->oskey, event->shift, event->alt)) {
 				
-				if(pa->flag & PNL_CLOSEDY) {
-					if((block->maxy <= my) && (block->maxy+PNL_HEADER >= my))
+				if (pa->flag & PNL_CLOSEDY) {
+					if ((block->maxy <= my) && (block->maxy + PNL_HEADER >= my))
 						ui_handle_panel_header(C, block, mx, my, event->type);
 				}
 				else
@@ -1113,73 +1113,76 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
 		}
 		
 		/* on active button, do not handle panels */
-		if(ui_button_is_active(ar))
+		if (ui_button_is_active(ar))
 			continue;
 		
-		if(inside) {
+		if (inside) {
 			/* clicked at panel header? */
-			if(pa->flag & PNL_CLOSEDX) {
-				if(block->minx <= mx && block->minx+PNL_HEADER >= mx) 
-					inside_header= 1;
+			if (pa->flag & PNL_CLOSEDX) {
+				if (block->minx <= mx && block->minx + PNL_HEADER >= mx)
+					inside_header = 1;
 			}
-			else if((block->maxy <= my) && (block->maxy+PNL_HEADER >= my)) {
-				inside_header= 1;
+			else if ((block->maxy <= my) && (block->maxy + PNL_HEADER >= my)) {
+				inside_header = 1;
 			}
-			else if(pa->control & UI_PNL_SCALE) {
-				if(block->maxx-PNL_HEADER <= mx)
-					if(block->miny+PNL_HEADER >= my)
-						inside_scale= 1;
+			else if (pa->control & UI_PNL_SCALE) {
+				if (block->maxx - PNL_HEADER <= mx)
+					if (block->miny + PNL_HEADER >= my)
+						inside_scale = 1;
 			}
 
-			if(event->val==KM_PRESS) {
+			if (event->val == KM_PRESS) {
 				/* open close on header */
-				if(ELEM(event->type, RETKEY, PADENTER)) {
-					if(inside_header) {
+				if (ELEM(event->type, RETKEY, PADENTER)) {
+					if (inside_header) {
 						ui_handle_panel_header(C, block, mx, my, RETKEY);
 						break;
 					}
 				}
-				else if(event->type == LEFTMOUSE) {
-					if(inside_header) {
+				else if (event->type == LEFTMOUSE) {
+					if (inside_header) {
 						ui_handle_panel_header(C, block, mx, my, 0);
 						break;
 					}
-					else if(inside_scale && !(pa->flag & PNL_CLOSED)) {
+					else if (inside_scale && !(pa->flag & PNL_CLOSED)) {
 						panel_activate_state(C, pa, PANEL_STATE_DRAG_SCALE);
 						break;
 					}
 				}
-				else if(event->type == ESCKEY) {
-					/*XXX 2.50 if(block->handler) {
+				else if (event->type == ESCKEY) {
+					/*XXX 2.50*/
+#if 0
+					if (block->handler) {
 						rem_blockhandler(sa, block->handler);
 						ED_region_tag_redraw(ar);
-						retval= WM_UI_HANDLER_BREAK;
-					}*/
+						retval = WM_UI_HANDLER_BREAK;
+					}
+#endif
 				}
-				else if(event->type==PADPLUSKEY || event->type==PADMINUS) {
+				else if (event->type == PADPLUSKEY || event->type == PADMINUS) {
 #if 0 // XXX make float panel exception?
-					int zoom=0;
+					int zoom = 0;
 				
 					/* if panel is closed, only zoom if mouse is over the header */
-					if (pa->flag & (PNL_CLOSEDX|PNL_CLOSEDY)) {
+					if (pa->flag & (PNL_CLOSEDX | PNL_CLOSEDY)) {
 						if (inside_header)
-							zoom=1;
+							zoom = 1;
 					}
 					else
-						zoom=1;
+						zoom = 1;
 
-					if(zoom) {
-						ScrArea *sa= CTX_wm_area(C);
-						SpaceLink *sl= sa->spacedata.first;
+					if (zoom) {
+						ScrArea *sa = CTX_wm_area(C);
+						SpaceLink *sl = sa->spacedata.first;
 
-						if(sa->spacetype!=SPACE_BUTS) {
-							if(!(pa->control & UI_PNL_SCALE)) {
-								if(event->type==PADPLUSKEY) sl->blockscale+= 0.1;
-								else sl->blockscale-= 0.1;
+						if (sa->spacetype != SPACE_BUTS) {
+							if (!(pa->control & UI_PNL_SCALE)) {
+								if (event->type == PADPLUSKEY) sl->blockscale += 0.1;
+								else sl->blockscale -= 0.1;
 								CLAMP(sl->blockscale, 0.6, 1.0);
 
 								ED_region_tag_redraw(ar);
-								retval= WM_UI_HANDLER_BREAK;
+								retval = WM_UI_HANDLER_BREAK;
 							}						
 						}
 					}
@@ -1197,34 +1200,34 @@ int ui_handler_panel_region(bContext *C, wmEvent *event)
 /* note, this is modal handler and should not swallow events for animation */
 static int ui_handler_panel(bContext *C, wmEvent *event, void *userdata)
 {
-	Panel *panel= userdata;
-	uiHandlePanelData *data= panel->activedata;
+	Panel *panel = userdata;
+	uiHandlePanelData *data = panel->activedata;
 
 	/* verify if we can stop */
-	if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
-		ScrArea *sa= CTX_wm_area(C);
-		ARegion *ar= CTX_wm_region(C);
-		int align= panel_aligned(sa, ar);
+	if (event->type == LEFTMOUSE && event->val != KM_PRESS) {
+		ScrArea *sa = CTX_wm_area(C);
+		ARegion *ar = CTX_wm_region(C);
+		int align = panel_aligned(sa, ar);
 
-		if(align)
+		if (align)
 			panel_activate_state(C, panel, PANEL_STATE_ANIMATION);
 		else
 			panel_activate_state(C, panel, PANEL_STATE_EXIT);
 	}
-	else if(event->type == MOUSEMOVE) {
-		if(data->state == PANEL_STATE_DRAG)
+	else if (event->type == MOUSEMOVE) {
+		if (data->state == PANEL_STATE_DRAG)
 			ui_do_drag(C, event, panel);
 	}
-	else if(event->type == TIMER && event->customdata == data->animtimer) {
-		if(data->state == PANEL_STATE_ANIMATION)
+	else if (event->type == TIMER && event->customdata == data->animtimer) {
+		if (data->state == PANEL_STATE_ANIMATION)
 			ui_do_animate(C, panel);
-		else if(data->state == PANEL_STATE_DRAG)
+		else if (data->state == PANEL_STATE_DRAG)
 			ui_do_drag(C, event, panel);
 	}
 
-	data= panel->activedata;
+	data = panel->activedata;
 
-	if(data && data->state == PANEL_STATE_ANIMATION)
+	if (data && data->state == PANEL_STATE_ANIMATION)
 		return WM_UI_HANDLER_CONTINUE;
 	else
 		return WM_UI_HANDLER_BREAK;
@@ -1232,22 +1235,22 @@ static int ui_handler_panel(bContext *C, wmEvent *event, void *userdata)
 
 static void ui_handler_remove_panel(bContext *C, void *userdata)
 {
-	Panel *pa= userdata;
+	Panel *pa = userdata;
 
 	panel_activate_state(C, pa, PANEL_STATE_EXIT);
 }
 
 static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelState state)
 {
-	uiHandlePanelData *data= pa->activedata;
-	wmWindow *win= CTX_wm_window(C);
-	ARegion *ar= CTX_wm_region(C);
+	uiHandlePanelData *data = pa->activedata;
+	wmWindow *win = CTX_wm_window(C);
+	ARegion *ar = CTX_wm_region(C);
 	
-	if(data && data->state == state)
+	if (data && data->state == state)
 		return;
 
-	if(state == PANEL_STATE_EXIT || state == PANEL_STATE_ANIMATION) {
-		if(data && data->state != PANEL_STATE_ANIMATION) {
+	if (state == PANEL_STATE_EXIT || state == PANEL_STATE_ANIMATION) {
+		if (data && data->state != PANEL_STATE_ANIMATION) {
 			/* XXX:
 			 *	- the panel tabbing function call below (test_add_new_tabs()) has been commented out
 			 *	  "It is too easy to do by accident when reordering panels, is very hard to control and use, and has no real benefit." - BillRey
@@ -1262,48 +1265,52 @@ static void panel_activate_state(const bContext *C, Panel *pa, uiHandlePanelStat
 	else
 		pa->flag |= PNL_SELECT;
 
-	if(data && data->animtimer) {
+	if (data && data->animtimer) {
 		WM_event_remove_timer(CTX_wm_manager(C), win, data->animtimer);
-		data->animtimer= NULL;
+		data->animtimer = NULL;
 	}
 
-	if(state == PANEL_STATE_EXIT) {
+	if (state == PANEL_STATE_EXIT) {
 		MEM_freeN(data);
-		pa->activedata= NULL;
+		pa->activedata = NULL;
 
 		WM_event_remove_ui_handler(&win->modalhandlers, ui_handler_panel, ui_handler_remove_panel, pa, 0);
 	}
 	else {
-		if(!data) {
-			data= MEM_callocN(sizeof(uiHandlePanelData), "uiHandlePanelData");
-			pa->activedata= data;
+		if (!data) {
+			data = MEM_callocN(sizeof(uiHandlePanelData), "uiHandlePanelData");
+			pa->activedata = data;
 
 			WM_event_add_ui_handler(C, &win->modalhandlers, ui_handler_panel, ui_handler_remove_panel, pa);
 		}
 
-		if(ELEM(state, PANEL_STATE_ANIMATION, PANEL_STATE_DRAG))
-			data->animtimer= WM_event_add_timer(CTX_wm_manager(C), win, TIMER, ANIMATION_INTERVAL);
-
-		data->state= state;
-		data->startx= win->eventstate->x;
-		data->starty= win->eventstate->y;
-		data->startofsx= pa->ofsx;
-		data->startofsy= pa->ofsy;
-		data->startsizex= pa->sizex;
-		data->startsizey= pa->sizey;
-		data->starttime= PIL_check_seconds_timer();
+		if (ELEM(state, PANEL_STATE_ANIMATION, PANEL_STATE_DRAG))
+			data->animtimer = WM_event_add_timer(CTX_wm_manager(C), win, TIMER, ANIMATION_INTERVAL);
+
+		data->state = state;
+		data->startx = win->eventstate->x;
+		data->starty = win->eventstate->y;
+		data->startofsx = pa->ofsx;
+		data->startofsy = pa->ofsy;
+		data->startsizex = pa->sizex;
+		data->startsizey = pa->sizey;
+		data->starttime = PIL_check_seconds_timer();
 	}
 
 	ED_region_tag_redraw(ar);
 
 	/* XXX exception handling, 3d window preview panel */
-	/* if(block->drawextra==BIF_view3d_previewdraw)
-		BIF_view3d_previewrender_clear(curarea);*/
-	
+#if 0
+	if (block->drawextra == BIF_view3d_previewdraw)
+		BIF_view3d_previewrender_clear(curarea);
+#endif
+
 	/* XXX exception handling, 3d window preview panel */
-	/* if(block->drawextra==BIF_view3d_previewdraw)
+#if 0
+	if (block->drawextra == BIF_view3d_previewdraw)
 		BIF_view3d_previewrender_signal(curarea, PR_DISPRECT);
-	else if(strcmp(block->name, "image_panel_preview")==0)
-		image_preview_event(2); */
+	else if (strcmp(block->name, "image_panel_preview") == 0)
+		image_preview_event(2);
+#endif
 }
 
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index c912bce..9bcda7d 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -68,11 +68,11 @@
 
 #include "interface_intern.h"
 
-#define MENU_SEPR_HEIGHT	6
-#define B_NOP              	-1
-#define MENU_SHADOW_SIDE	8
-#define MENU_SHADOW_BOTTOM	10
-#define MENU_TOP			8
+#define MENU_SEPR_HEIGHT    6
+#define B_NOP               -1
+#define MENU_SHADOW_SIDE    8
+#define MENU_SHADOW_BOTTOM  10
+#define MENU_TOP            8
 
 /*********************** Menu Data Parsing ********************* */
 
@@ -94,13 +94,13 @@ typedef struct MenuData {
 
 static MenuData *menudata_new(const char *instr)
 {
-	MenuData *md= MEM_mallocN(sizeof(*md), "MenuData");
+	MenuData *md = MEM_mallocN(sizeof(*md), "MenuData");
 
-	md->instr= instr;
-	md->title= NULL;
-	md->titleicon= 0;
-	md->items= NULL;
-	md->nitems= md->itemssize= 0;
+	md->instr = instr;
+	md->title = NULL;
+	md->titleicon = 0;
+	md->items = NULL;
+	md->nitems = md->itemssize = 0;
 	
 	return md;
 }
@@ -108,30 +108,30 @@ static MenuData *menudata_new(const char *instr)
 static void menudata_set_title(MenuData *md, const char *title, int titleicon)
 {
 	if (!md->title)
-		md->title= title;
+		md->title = title;
 	if (!md->titleicon)
-		md->titleicon= titleicon;
+		md->titleicon = titleicon;
 }
 
 static void menudata_add_item(MenuData *md, const char *str, int retval, int icon, int sepr)
 {
-	if (md->nitems==md->itemssize) {
-		int nsize= md->itemssize?(md->itemssize<<1):1;
-		MenuEntry *oitems= md->items;
+	if (md->nitems == md->itemssize) {
+		int nsize = md->itemssize ? (md->itemssize << 1) : 1;
+		MenuEntry *oitems = md->items;
 		
-		md->items= MEM_mallocN(nsize*sizeof(*md->items), "md->items");
+		md->items = MEM_mallocN(nsize * sizeof(*md->items), "md->items");
 		if (oitems) {
-			memcpy(md->items, oitems, md->nitems*sizeof(*md->items));
+			memcpy(md->items, oitems, md->nitems * sizeof(*md->items));
 			MEM_freeN(oitems);
 		}
 		
-		md->itemssize= nsize;
+		md->itemssize = nsize;
 	}
 	
-	md->items[md->nitems].str= str;
-	md->items[md->nitems].retval= retval;
-	md->items[md->nitems].icon= icon;
-	md->items[md->nitems].sepr= sepr;
+	md->items[md->nitems].str = str;
+	md->items[md->nitems].retval = retval;
+	md->items[md->nitems].icon = icon;
+	md->items[md->nitems].sepr = sepr;
 	md->nitems++;
 }
 
@@ -144,81 +144,86 @@ static void menudata_free(MenuData *md)
 	MEM_freeN(md);
 }
 
-	/**
-	 * Parse menu description strings, string is of the
-	 * form "[sss%t|]{(sss[%xNN]|), (%l|), (sss%l|)}", ssss%t indicates the
-	 * menu title, sss or sss%xNN indicates an option, 
-	 * if %xNN is given then NN is the return value if
-	 * that option is selected otherwise the return value
-	 * is the index of the option (starting with 1). %l
-	 * indicates a seperator, sss%l indicates a label and
-	 * new column.
-	 * 
-	 * @param str String to be parsed.
-	 * @retval new menudata structure, free with menudata_free()
-	 */
+/**
+ * Parse menu description strings, string is of the
+ * form "[sss%t|]{(sss[%xNN]|), (%l|), (sss%l|)}", ssss%t indicates the
+ * menu title, sss or sss%xNN indicates an option,
+ * if %xNN is given then NN is the return value if
+ * that option is selected otherwise the return value
+ * is the index of the option (starting with 1). %l
+ * indicates a seperator, sss%l indicates a label and
+ * new column.
+ *
+ * \param str String to be parsed.
+ * \retval new menudata structure, free with menudata_free()
+ */
 static MenuData *decompose_menu_string(const char *str)
 {
-	char *instr= BLI_strdup(str);
-	MenuData *md= menudata_new(instr);
-	const char *nitem= NULL;
-	char *s= instr;
-	int nicon=0, nretval= 1, nitem_is_title= 0, nitem_is_sepr= 0;
+	char *instr = BLI_strdup(str);
+	MenuData *md = menudata_new(instr);
+	const char *nitem = NULL;
+	char *s = instr;
+	int nicon = 0, nretval = 1, nitem_is_title = 0, nitem_is_sepr = 0;
 	
 	while (1) {
-		char c= *s;
+		char c = *s;
 
-		if (c=='%') {
-			if (s[1]=='x') {
-				nretval= atoi(s+2);
+		if (c == '%') {
+			if (s[1] == 'x') {
+				nretval = atoi(s + 2);
 
-				*s= '\0';
+				*s = '\0';
 				s++;
-			} else if (s[1]=='t') {
-				nitem_is_title= (s != instr); /* check for empty title */
+			}
+			else if (s[1] == 't') {
+				nitem_is_title = (s != instr); /* check for empty title */
 
-				*s= '\0';
+				*s = '\0';
 				s++;
-			} else if (s[1]=='l') {
-				nitem_is_sepr= 1;
-				if(!nitem) nitem= "";
+			}
+			else if (s[1] == 'l') {
+				nitem_is_sepr = 1;
+				if (!nitem) nitem = "";
 
-				*s= '\0';
+				*s = '\0';
 				s++;
-			} else if (s[1]=='i') {
-				nicon= atoi(s+2);
+			}
+			else if (s[1] == 'i') {
+				nicon = atoi(s + 2);
 				
-				*s= '\0';
+				*s = '\0';
 				s++;
 			}
-		} else if (c=='|' || c == '\n' || c=='\0') {
+		}
+		else if (c == '|' || c == '\n' || c == '\0') {
 			if (nitem) {
-				*s= '\0';
+				*s = '\0';
 
-				if(nitem_is_title) {
+				if (nitem_is_title) {
 					menudata_set_title(md, nitem, nicon);
-					nitem_is_title= 0;
+					nitem_is_title = 0;
 				}
-				else if(nitem_is_sepr) {
+				else if (nitem_is_sepr) {
 					/* prevent separator to get a value */
 					menudata_add_item(md, nitem, -1, nicon, 1);
-					nretval= md->nitems+1;
-					nitem_is_sepr= 0;
+					nretval = md->nitems + 1;
+					nitem_is_sepr = 0;
 				}
 				else {
 					menudata_add_item(md, nitem, nretval, nicon, 0);
-					nretval= md->nitems+1;
+					nretval = md->nitems + 1;
 				} 
 				
-				nitem= NULL;
-				nicon= 0;
+				nitem = NULL;
+				nicon = 0;
 			}
 			
-			if (c=='\0') {
+			if (c == '\0') {
 				break;
 			}
-		} else if (!nitem) {
-			nitem= s;
+		}
+		else if (!nitem) {
+			nitem = s;
 		}
 
 		s++;
@@ -232,9 +237,9 @@ void ui_set_name_menu(uiBut *but, int value)
 	MenuData *md;
 	int i;
 	
-	md= decompose_menu_string(but->str);
-	for (i=0; i<md->nitems; i++) {
-		if (md->items[i].retval==value) {
+	md = decompose_menu_string(but->str);
+	for (i = 0; i < md->nitems; i++) {
+		if (md->items[i].retval == value) {
 			BLI_strncpy(but->drawstr, md->items[i].str, sizeof(but->drawstr));
 			break;
 		}
@@ -246,29 +251,29 @@ void ui_set_name_menu(uiBut *but, int value)
 int ui_step_name_menu(uiBut *but, int step)
 {
 	MenuData *md;
-	int value= ui_get_but_val(but);
+	int value = ui_get_but_val(but);
 	int i;
 	
-	md= decompose_menu_string(but->str);
-	for (i=0; i<md->nitems; i++)
-		if (md->items[i].retval==value)
+	md = decompose_menu_string(but->str);
+	for (i = 0; i < md->nitems; i++)
+		if (md->items[i].retval == value)
 			break;
 	
-	if(step==1) {
+	if (step == 1) {
 		/* skip separators */
-		for(; i<md->nitems-1; i++) {
-			if(md->items[i+1].retval != -1) {
-				value= md->items[i+1].retval;
+		for (; i < md->nitems - 1; i++) {
+			if (md->items[i + 1].retval != -1) {
+				value = md->items[i + 1].retval;
 				break;
 			}
 		}
 	}
 	else {
-		if(i>0) {
+		if (i > 0) {
 			/* skip separators */
-			for(; i>0; i--) {
-				if(md->items[i-1].retval != -1) {
-					value= md->items[i-1].retval;
+			for (; i > 0; i--) {
+				if (md->items[i - 1].retval != -1) {
+					value = md->items[i - 1].retval;
 					break;
 				}
 			}
@@ -287,55 +292,111 @@ static ARegion *ui_add_temporary_region(bScreen *sc)
 {
 	ARegion *ar;
 
-	ar= MEM_callocN(sizeof(ARegion), "area region");
+	ar = MEM_callocN(sizeof(ARegion), "area region");
 	BLI_addtail(&sc->regionbase, ar);
 
-	ar->regiontype= RGN_TYPE_TEMPORARY;
-	ar->alignment= RGN_ALIGN_FLOAT;
+	ar->regiontype = RGN_TYPE_TEMPORARY;
+	ar->alignment = RGN_ALIGN_FLOAT;
 
 	return ar;
 }
 
 static void ui_remove_temporary_region(bContext *C, bScreen *sc, ARegion *ar)
 {
-	if(CTX_wm_window(C))
+	if (CTX_wm_window(C))
 		wm_draw_region_clear(CTX_wm_window(C), ar);
 
 	ED_region_exit(C, ar);
-	BKE_area_region_free(NULL, ar);		/* NULL: no spacetype */
+	BKE_area_region_free(NULL, ar);     /* NULL: no spacetype */
 	BLI_freelinkN(&sc->regionbase, ar);
 }
 
 /************************* Creating Tooltips **********************/
 
-#define MAX_TOOLTIP_LINES 8
+typedef enum {
+	UI_TIP_LC_MAIN,
+	UI_TIP_LC_NORMAL,
+	UI_TIP_LC_PYTHON,
+	UI_TIP_LC_ALERT,
+	UI_TIP_LC_SUBMENU
+} uiTooltipLineColor;
+#define UI_TIP_LC_MAX 5
 
+#define MAX_TOOLTIP_LINES 8
 typedef struct uiTooltipData {
 	rcti bbox;
 	uiFontStyle fstyle;
 	char lines[MAX_TOOLTIP_LINES][512];
-	unsigned int color[MAX_TOOLTIP_LINES];
+	uiTooltipLineColor color_id[MAX_TOOLTIP_LINES];
 	int totline;
 	int toth, spaceh, lineh;
 } uiTooltipData;
 
+static void rgb_tint(float col[3],
+                     float h, float h_strength,
+                     float v, float v_strength)
+{
+	float col_hsv_from[3];
+	float col_hsv_to[3];
+
+	rgb_to_hsv(col[0], col[1], col[2],    col_hsv_from + 0, col_hsv_from + 1, col_hsv_from + 2);
+
+	col_hsv_to[0] = h;
+	col_hsv_to[1] = h_strength;
+	col_hsv_to[2] = (col_hsv_from[2] * (1.0f - v_strength)) + (v * v_strength);
+
+	hsv_to_rgb(col_hsv_to[0], col_hsv_to[1], col_hsv_to[2], col + 0, col + 1, col + 2);
+}
+
 static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
 {
-	uiTooltipData *data= ar->regiondata;
-	rcti bbox= data->bbox;
-	int a;
-	
-	ui_draw_menu_back(UI_GetStyle(), NULL, &data->bbox);
+	uiTooltipData *data = ar->regiondata;
+	uiWidgetColors *theme = ui_tooltip_get_theme();
+	rcti bbox = data->bbox;
+	float tip_colors[UI_TIP_LC_MAX][3];
+
+	float *main_color    = tip_colors[UI_TIP_LC_MAIN]; /* the color from the theme */
+	float *normal_color  = tip_colors[UI_TIP_LC_NORMAL];
+	float *python_color  = tip_colors[UI_TIP_LC_PYTHON];
+	float *alert_color   = tip_colors[UI_TIP_LC_ALERT];
+	float *submenu_color = tip_colors[UI_TIP_LC_SUBMENU];
+
+	float background_color[3];
+	float tone_bg;
+	int i;
+
+	/* draw background */
+	ui_draw_tooltip_background(UI_GetStyle(), NULL, &bbox);
+
+	/* set background_color */
+	rgb_uchar_to_float(background_color, (const unsigned char *)theme->inner);
+
+	/* calculate normal_color */
+	rgb_uchar_to_float(main_color, (const unsigned char *)theme->text);
+	copy_v3_v3(normal_color, main_color);
+	copy_v3_v3(python_color, main_color);
+	copy_v3_v3(alert_color, main_color);
+	copy_v3_v3(submenu_color, main_color);
+
+	/* find the brightness difference between background and text colors */
 	
+	tone_bg = rgb_to_grayscale(background_color);
+	/* tone_fg = rgb_to_grayscale(main_color); */
+
+	rgb_tint(normal_color, 0.0f, 0.0f, tone_bg, 0.3f);   /* a shade darker (to bg) */
+	rgb_tint(python_color, 0.666f, 0.25f, tone_bg, 0.3f); /* blue */
+	rgb_tint(alert_color, 0.0f, 0.8f, tone_bg, 0.1f);    /* bright red */
+	rgb_tint(submenu_color, 0.0f, 0.0f, tone_bg, 0.3f);  /* a shade darker (to bg) */
+
 	/* draw text */
 	uiStyleFontSet(&data->fstyle);
 
-	bbox.ymax= bbox.ymax - 0.5f*((bbox.ymax - bbox.ymin) - data->toth);
-	bbox.ymin= bbox.ymax - data->lineh;
+	bbox.ymax = bbox.ymax - 0.5f * ((bbox.ymax - bbox.ymin) - data->toth);
+	bbox.ymin = bbox.ymax - data->lineh;
 
-	for(a=0; a<data->totline; a++) {
-		cpack(data->color[a]);
-		uiStyleFontDraw(&data->fstyle, &bbox, data->lines[a]);
+	for (i = 0; i < data->totline; i++) {
+		glColor3fv(tip_colors[data->color_id[i]]);
+		uiStyleFontDraw(&data->fstyle, &bbox, data->lines[i]);
 		bbox.ymin -= data->lineh + data->spaceh;
 		bbox.ymax -= data->lineh + data->spaceh;
 	}
@@ -345,50 +406,50 @@ static void ui_tooltip_region_free_cb(ARegion *ar)
 {
 	uiTooltipData *data;
 
-	data= ar->regiondata;
+	data = ar->regiondata;
 	MEM_freeN(data);
-	ar->regiondata= NULL;
+	ar->regiondata = NULL;
 }
 
 ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
 {
-	uiStyle *style= UI_GetStyle();
+	uiStyle *style = UI_GetStyle();
 	static ARegionType type;
 	ARegion *ar;
 	uiTooltipData *data;
 	IDProperty *prop;
 	char buf[512];
-	float fonth, fontw, aspect= but->block->aspect;
+	float fonth, fontw, aspect = but->block->aspect;
 	float x1f, x2f, y1f, y2f;
 	int x1, x2, y1, y2, winx, winy, ofsx, ofsy, w, h, a;
 
-	if(but->flag & UI_BUT_NO_TOOLTIP)
+	if (but->flag & UI_BUT_NO_TOOLTIP)
 		return NULL;
 
 	/* create tooltip data */
-	data= MEM_callocN(sizeof(uiTooltipData), "uiTooltipData");
+	data = MEM_callocN(sizeof(uiTooltipData), "uiTooltipData");
 
 	/* special case, enum rna buttons only have enum item description, use general enum description too before the specific one */
-	if(but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) {
-		const char *descr= RNA_property_description(but->rnaprop);
-		if(descr && descr[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[data->totline]= 0xFFFFFF;
+			data->color_id[data->totline] = UI_TIP_LC_MAIN;
 			data->totline++;
 		}
 
-		if(ELEM(but->type, ROW, MENU)) {
+		if (ELEM(but->type, ROW, MENU)) {
 			EnumPropertyItem *item;
 			int i, totitem, free;
-			int value = (but->type == ROW)? but->hardmax: ui_get_but_val(but);
+			int value = (but->type == ROW) ? but->hardmax : 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]) {
+			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[data->totline]= 0xDDDDDD;
+						data->color_id[data->totline] = UI_TIP_LC_SUBMENU;
 						data->totline++;
 					}
 					break;
@@ -401,52 +462,52 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
 		}
 	}
 	
-	if(but->tip && but->tip[0] != '\0') {
+	if (but->tip && but->tip[0] != '\0') {
 		BLI_strncpy(data->lines[data->totline], but->tip, sizeof(data->lines[0]));
-		data->color[data->totline]= 0xFFFFFF;
+		data->color_id[data->totline] = UI_TIP_LC_MAIN;
 		data->totline++;
 	}
 
-	if(but->optype && !(but->block->flag & UI_BLOCK_LOOP)) {
+	if (but->optype && !(but->block->flag & UI_BLOCK_LOOP)) {
 		/* operator keymap (not menus, they already have it) */
-		prop= (but->opptr)? but->opptr->data: NULL;
+		prop = (but->opptr) ? but->opptr->data : NULL;
 
-		if(WM_key_event_operator_string(C, but->optype->idname, but->opcontext, prop, TRUE,
-		                                buf, sizeof(buf)))
+		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[data->totline]= 0x888888;
+			data->color_id[data->totline] = UI_TIP_LC_NORMAL;
 			data->totline++;
 		}
 	}
 
-	if(ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
+	if (ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
 		/* full string */
 		ui_get_but_string(but, buf, sizeof(buf));
-		if(buf[0]) {
+		if (buf[0]) {
 			BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Value: %s"), buf);
-			data->color[data->totline]= 0x888888;
+			data->color_id[data->totline] = UI_TIP_LC_NORMAL;
 			data->totline++;
 		}
 	}
 
-	if(but->rnaprop) {
-		int unit_type= uiButGetUnitType(but);
+	if (but->rnaprop) {
+		int unit_type = uiButGetUnitType(but);
 		
 		if (unit_type == PROP_UNIT_ROTATION) {
 			if (RNA_property_type(but->rnaprop) == PROP_FLOAT) {
-				float value= RNA_property_array_check(but->rnaprop) ? RNA_property_float_get_index(&but->rnapoin, but->rnaprop, but->rnaindex) : RNA_property_float_get(&but->rnapoin, but->rnaprop);
+				float value = RNA_property_array_check(but->rnaprop) ? RNA_property_float_get_index(&but->rnapoin, but->rnaprop, but->rnaindex) : RNA_property_float_get(&but->rnapoin, but->rnaprop);
 				BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Radians: %f"), value);
-				data->color[data->totline]= 0x888888;
+				data->color_id[data->totline] = UI_TIP_LC_NORMAL;
 				data->totline++;
 			}
 		}
 		
-		if(but->flag & UI_BUT_DRIVEN) {
-			if(ui_but_anim_expression_get(but, buf, sizeof(buf))) {
+		if (but->flag & UI_BUT_DRIVEN) {
+			if (ui_but_anim_expression_get(but, buf, sizeof(buf))) {
 				/* expression */
 				BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Expression: %s"), buf);
-				data->color[data->totline]= 0x888888;
+				data->color_id[data->totline] = UI_TIP_LC_NORMAL;
 				data->totline++;
 			}
 		}
@@ -454,15 +515,15 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
 		/* 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[data->totline]= 0x888888;
+			data->color_id[data->totline] = UI_TIP_LC_PYTHON;
 			data->totline++;
 		}
 		
-		if(but->rnapoin.id.data) {
-			ID *id= but->rnapoin.id.data;
-			if(id->lib && id->lib->name) {
+		if (but->rnapoin.id.data) {
+			ID *id = but->rnapoin.id.data;
+			if (id->lib && id->lib->name) {
 				BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Library: %s"), id->lib->name);
-				data->color[data->totline]= 0x888888;
+				data->color_id[data->totline] = UI_TIP_LC_NORMAL;
 				data->totline++;
 			}
 		}
@@ -470,38 +531,38 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
 	else if (but->optype) {
 		PointerRNA *opptr;
 		char *str;
-		opptr= uiButGetOperatorPtrRNA(but); /* allocated when needed, the button owns it */
+		opptr = uiButGetOperatorPtrRNA(but); /* allocated when needed, the button owns it */
 
-		str= WM_operator_pystring(C, but->optype, opptr, 0);
+		str = WM_operator_pystring(C, but->optype, opptr, 0);
 
 		/* operator info */
 		if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) {
 			BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s"), str);
-			data->color[data->totline]= 0x888888;
+			data->color_id[data->totline] = UI_TIP_LC_PYTHON;
 			data->totline++;
 		}
 
 		MEM_freeN(str);
 
 		/* second check if we are disabled - why */
-		if(but->flag & UI_BUT_DISABLED) {
+		if (but->flag & UI_BUT_DISABLED) {
 			const char *poll_msg;
 			CTX_wm_operator_poll_msg_set(C, NULL);
 			WM_operator_poll_context(C, but->optype, but->opcontext);
-			poll_msg= CTX_wm_operator_poll_msg_get(C);
-			if(poll_msg) {
+			poll_msg = CTX_wm_operator_poll_msg_get(C);
+			if (poll_msg) {
 				BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Disabled: %s"), poll_msg);
-				data->color[data->totline]= 0x6666ff; /* alert */
+				data->color_id[data->totline] = UI_TIP_LC_ALERT; /* alert */
 				data->totline++;			
 			}
 		}
 	}
 	else if (ELEM(but->type, MENU, PULLDOWN)) {
 		if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) {
-			MenuType *mt= uiButGetMenuType(but);
+			MenuType *mt = uiButGetMenuType(but);
 			if (mt) {
 				BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), TIP_("Python: %s"), mt->idname);
-				data->color[data->totline]= 0x888888;
+				data->color_id[data->totline] = UI_TIP_LC_PYTHON;
 				data->totline++;
 			}
 		}
@@ -510,22 +571,22 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
 
 	assert(data->totline < MAX_TOOLTIP_LINES);
 	
-	if(data->totline == 0) {
+	if (data->totline == 0) {
 		MEM_freeN(data);
 		return NULL;
 	}
 
 	/* create area region */
-	ar= ui_add_temporary_region(CTX_wm_screen(C));
+	ar = ui_add_temporary_region(CTX_wm_screen(C));
 
 	memset(&type, 0, sizeof(ARegionType));
-	type.draw= ui_tooltip_region_draw_cb;
-	type.free= ui_tooltip_region_free_cb;
-	ar->type= &type;
+	type.draw = ui_tooltip_region_draw_cb;
+	type.free = ui_tooltip_region_free_cb;
+	ar->type = &type;
 	
 	/* set font, get bb */
-	data->fstyle= style->widget; /* copy struct */
-	data->fstyle.align= UI_STYLE_TEXT_CENTER;
+	data->fstyle = style->widget; /* copy struct */
+	data->fstyle.align = UI_STYLE_TEXT_CENTER;
 	uiStyleFontSet(&data->fstyle);
 
 	/* these defines may need to be tweaked depending on font */
@@ -533,42 +594,42 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
 #define TIP_BORDER_X 16.0f
 #define TIP_BORDER_Y 6.0f
 
-	h= BLF_height_max(data->fstyle.uifont_id);
+	h = BLF_height_max(data->fstyle.uifont_id);
 
-	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);
-		fonth += (a == 0)? h: h+TIP_MARGIN_Y;
+	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);
+		fonth += (a == 0) ? h : h + TIP_MARGIN_Y;
 	}
 
 	fontw *= aspect;
 
-	ar->regiondata= data;
+	ar->regiondata = data;
 
-	data->toth= fonth;
-	data->lineh= h;
-	data->spaceh= TIP_MARGIN_Y;
+	data->toth = fonth;
+	data->lineh = h;
+	data->spaceh = TIP_MARGIN_Y;
 
 
 	/* compute position */
-	ofsx= (but->block->panel)? but->block->panel->ofsx: 0;
-	ofsy= (but->block->panel)? but->block->panel->ofsy: 0;
+	ofsx = (but->block->panel) ? but->block->panel->ofsx : 0;
+	ofsy = (but->block->panel) ? but->block->panel->ofsy : 0;
 
-	x1f= (but->x1 + but->x2) * 0.5f + ofsx - (TIP_BORDER_X * aspect);
-	x2f= x1f + fontw + (TIP_BORDER_X * aspect);
-	y2f= but->y1 + ofsy - (TIP_BORDER_Y * aspect);
-	y1f= y2f - fonth*aspect - (TIP_BORDER_Y * aspect);
+	x1f = (but->x1 + but->x2) * 0.5f + ofsx - (TIP_BORDER_X * aspect);
+	x2f = x1f + fontw + (TIP_BORDER_X * aspect);
+	y2f = but->y1 + ofsy - (TIP_BORDER_Y * aspect);
+	y1f = y2f - fonth * aspect - (TIP_BORDER_Y * aspect);
 	
 #undef TIP_MARGIN_Y
 #undef TIP_BORDER_X
 #undef TIP_BORDER_Y
 
 	/* copy to int, gets projected if possible too */
-	x1= x1f; y1= y1f; x2= x2f; y2= y2f; 
+	x1 = x1f; y1 = y1f; x2 = x2f; y2 = y2f;
 	
-	if(butregion) {
+	if (butregion) {
 		/* XXX temp, region v2ds can be empty still */
-		if(butregion->v2d.cur.xmin != butregion->v2d.cur.xmax) {
+		if (butregion->v2d.cur.xmin != butregion->v2d.cur.xmax) {
 			UI_view2d_to_region_no_clip(&butregion->v2d, x1f, y1f, &x1, &y1);
 			UI_view2d_to_region_no_clip(&butregion->v2d, x2f, y2f, &x2, &y2);
 		}
@@ -581,35 +642,35 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
 
 	wm_window_get_size(CTX_wm_window(C), &winx, &winy);
 
-	if(x2 > winx) {
+	if (x2 > winx) {
 		/* super size */
-		if(x2 > winx + x1) {
-			x2= winx;
-			x1= 0;
+		if (x2 > winx + x1) {
+			x2 = winx;
+			x1 = 0;
 		}
 		else {
-			x1 -= x2-winx;
-			x2= winx;
+			x1 -= x2 - winx;
+			x2 = winx;
 		}
 	}
 	/* ensure at least 5 px above screen bounds
 	 * 25 is just a guess to be above the menu item */
-	if(y1 < 5) {
+	if (y1 < 5) {
 		y2 += (-y1) + 30;
 		y1 = 30;
 	}
 
 	/* widget rect, in region coords */
-	data->bbox.xmin= MENU_SHADOW_SIDE;
-	data->bbox.xmax= x2-x1 + MENU_SHADOW_SIDE;
-	data->bbox.ymin= MENU_SHADOW_BOTTOM;
-	data->bbox.ymax= y2-y1 + MENU_SHADOW_BOTTOM;
+	data->bbox.xmin = MENU_SHADOW_SIDE;
+	data->bbox.xmax = x2 - x1 + MENU_SHADOW_SIDE;
+	data->bbox.ymin = MENU_SHADOW_BOTTOM;
+	data->bbox.ymax = y2 - y1 + MENU_SHADOW_BOTTOM;
 	
 	/* region bigger for shadow */
-	ar->winrct.xmin= x1 - MENU_SHADOW_SIDE;
-	ar->winrct.xmax= x2 + MENU_SHADOW_SIDE;
-	ar->winrct.ymin= y1 - MENU_SHADOW_BOTTOM;
-	ar->winrct.ymax= y2 + MENU_TOP;
+	ar->winrct.xmin = x1 - MENU_SHADOW_SIDE;
+	ar->winrct.xmax = x2 + MENU_SHADOW_SIDE;
+	ar->winrct.ymin = y1 - MENU_SHADOW_BOTTOM;
+	ar->winrct.ymax = y2 + MENU_TOP;
 
 	/* adds subwindow */
 	ED_region_init(C, ar);
@@ -646,49 +707,49 @@ typedef struct uiSearchboxData {
 	rcti bbox;
 	uiFontStyle fstyle;
 	uiSearchItems items;
-	int active;		/* index in items array */
-	int noback;		/* when menu opened with enough space for this */
-	int preview;	/* draw thumbnail previews, rather than list */
+	int active;     /* index in items array */
+	int noback;     /* when menu opened with enough space for this */
+	int preview;    /* draw thumbnail previews, rather than list */
 	int prv_rows, prv_cols;
 } uiSearchboxData;
 
-#define SEARCH_ITEMS	10
+#define SEARCH_ITEMS    10
 
 /* exported for use by search callbacks */
 /* returns zero if nothing to add */
 int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin, int iconid)
 {
 	/* hijack for autocomplete */
-	if(items->autocpl) {
+	if (items->autocpl) {
 		autocomplete_do_name(items->autocpl, name);
 		return 1;
 	}
 	
 	/* hijack for finding active item */
-	if(items->active) {
-		if(poin==items->active)
-			items->offset_i= items->totitem;
+	if (items->active) {
+		if (poin == items->active)
+			items->offset_i = items->totitem;
 		items->totitem++;
 		return 1;
 	}
 	
-	if(items->totitem>=items->maxitem) {
-		items->more= 1;
+	if (items->totitem >= items->maxitem) {
+		items->more = 1;
 		return 0;
 	}
 	
 	/* skip first items in list */
-	if(items->offset_i > 0) {
+	if (items->offset_i > 0) {
 		items->offset_i--;
 		return 1;
 	}
 	
-	if(items->names)
+	if (items->names)
 		BLI_strncpy(items->names[items->totitem], name, items->maxstrlen);
-	if(items->pointers)
-		items->pointers[items->totitem]= poin;
-	if(items->icons)
-		items->icons[items->totitem]= iconid;
+	if (items->pointers)
+		items->pointers[items->totitem] = poin;
+	if (items->icons)
+		items->icons[items->totitem] = iconid;
 	
 	items->totitem++;
 	
@@ -697,36 +758,36 @@ int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin, int icon
 
 int uiSearchBoxhHeight(void)
 {
-	return SEARCH_ITEMS*UI_UNIT_Y + 2*MENU_TOP;
+	return SEARCH_ITEMS * UI_UNIT_Y + 2 * MENU_TOP;
 }
 
 /* ar is the search box itself */
 static void ui_searchbox_select(bContext *C, ARegion *ar, uiBut *but, int step)
 {
-	uiSearchboxData *data= ar->regiondata;
+	uiSearchboxData *data = ar->regiondata;
 	
 	/* apply step */
-	data->active+= step;
+	data->active += step;
 	
-	if(data->items.totitem==0)
-		data->active= 0;
-	else if(data->active > data->items.totitem) {
-		if(data->items.more) {
+	if (data->items.totitem == 0)
+		data->active = 0;
+	else if (data->active > data->items.totitem) {
+		if (data->items.more) {
 			data->items.offset++;
-			data->active= data->items.totitem;
+			data->active = data->items.totitem;
 			ui_searchbox_update(C, ar, but, 0);
 		}
 		else
-			data->active= data->items.totitem;
+			data->active = data->items.totitem;
 	}
-	else if(data->active < 1) {
-		if(data->items.offset) {
+	else if (data->active < 1) {
+		if (data->items.offset) {
 			data->items.offset--;
-			data->active= 1;
+			data->active = 1;
 			ui_searchbox_update(C, ar, but, 0);
 		}
-		else if(data->active < 0)
-			data->active= 0;
+		else if (data->active < 0)
+			data->active = 0;
 	}
 	
 	ED_region_tag_redraw(ar);
@@ -736,11 +797,11 @@ static void ui_searchbox_butrect(rcti *rect, uiSearchboxData *data, int itemnr)
 {
 	/* thumbnail preview */
 	if (data->preview) {
-		int buth = (data->bbox.ymax - data->bbox.ymin - 2*MENU_TOP) / data->prv_rows;
+		int buth = (data->bbox.ymax - data->bbox.ymin - 2 * MENU_TOP) / data->prv_rows;
 		int butw = (data->bbox.xmax - data->bbox.xmin) / data->prv_cols;
 		int row, col;
 		
-		*rect= data->bbox;
+		*rect = data->bbox;
 		
 		col = itemnr % data->prv_cols;
 		row = itemnr / data->prv_cols;
@@ -753,14 +814,14 @@ static void ui_searchbox_butrect(rcti *rect, uiSearchboxData *data, int itemnr)
 	}
 	/* list view */
 	else {
-		int buth= (data->bbox.ymax-data->bbox.ymin - 2*MENU_TOP)/SEARCH_ITEMS;
+		int buth = (data->bbox.ymax - data->bbox.ymin - 2 * MENU_TOP) / SEARCH_ITEMS;
 		
-		*rect= data->bbox;
-		rect->xmin= data->bbox.xmin + 3.0f;
-		rect->xmax= data->bbox.xmax - 3.0f;
+		*rect = data->bbox;
+		rect->xmin = data->bbox.xmin + 3.0f;
+		rect->xmax = data->bbox.xmax - 3.0f;
 		
-		rect->ymax= data->bbox.ymax - MENU_TOP - itemnr*buth;
-		rect->ymin= rect->ymax - buth;
+		rect->ymax = data->bbox.ymax - MENU_TOP - itemnr * buth;
+		rect->ymin = rect->ymax - buth;
 	}
 	
 }
@@ -768,35 +829,35 @@ static void ui_searchbox_butrect(rcti *rect, uiSearchboxData *data, int itemnr)
 /* x and y in screencoords */
 int ui_searchbox_inside(ARegion *ar, int x, int y)
 {
-	uiSearchboxData *data= ar->regiondata;
+	uiSearchboxData *data = ar->regiondata;
 	
-	return(BLI_in_rcti(&data->bbox, x-ar->winrct.xmin, y-ar->winrct.ymin));
+	return(BLI_in_rcti(&data->bbox, x - ar->winrct.xmin, y - ar->winrct.ymin));
 }
 
 /* string validated to be of correct length (but->hardmax) */
 void ui_searchbox_apply(uiBut *but, ARegion *ar)
 {
-	uiSearchboxData *data= ar->regiondata;
+	uiSearchboxData *data = ar->regiondata;
 
-	but->func_arg2= NULL;
+	but->func_arg2 = NULL;
 	
-	if(data->active) {
-		char *name= data->items.names[data->active-1];
-		char *cpoin= strchr(name, '|');
+	if (data->active) {
+		char *name = data->items.names[data->active - 1];
+		char *cpoin = strchr(name, '|');
 		
-		if(cpoin) cpoin[0]= 0;
+		if (cpoin) cpoin[0] = 0;
 		BLI_strncpy(but->editstr, name, data->items.maxstrlen);
-		if(cpoin) cpoin[0]= '|';
+		if (cpoin) cpoin[0] = '|';
 		
-		but->func_arg2= data->items.pointers[data->active-1];
+		but->func_arg2 = data->items.pointers[data->active - 1];
 	}
 }
 
 void ui_searchbox_event(bContext *C, ARegion *ar, uiBut *but, wmEvent *event)
 {
-	uiSearchboxData *data= ar->regiondata;
+	uiSearchboxData *data = ar->regiondata;
 	
-	switch(event->type) {
+	switch (event->type) {
 		case WHEELUPMOUSE:
 		case UPARROWKEY:
 			ui_searchbox_select(C, ar, but, -1);
@@ -806,15 +867,15 @@ void ui_searchbox_event(bContext *C, ARegion *ar, uiBut *but, wmEvent *event)
 			ui_searchbox_select(C, ar, but, 1);
 			break;
 		case MOUSEMOVE:
-			if(BLI_in_rcti(&ar->winrct, event->x, event->y)) {
+			if (BLI_in_rcti(&ar->winrct, event->x, event->y)) {
 				rcti rect;
 				int a;
 				
-				for(a=0; a<data->items.totitem; a++) {
+				for (a = 0; a < data->items.totitem; a++) {
 					ui_searchbox_butrect(&rect, data, a);
-					if(BLI_in_rcti(&rect, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin)) {
-						if( data->active!= a+1) {
-							data->active= a+1;
+					if (BLI_in_rcti(&rect, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin)) {
+						if (data->active != a + 1) {
+							data->active = a + 1;
 							ui_searchbox_select(C, ar, but, 0);
 							break;
 						}
@@ -828,67 +889,67 @@ void ui_searchbox_event(bContext *C, ARegion *ar, uiBut *but, wmEvent *event)
 /* ar is the search box itself */
 void ui_searchbox_update(bContext *C, ARegion *ar, uiBut *but, int reset)
 {
-	uiSearchboxData *data= ar->regiondata;
+	uiSearchboxData *data = ar->regiondata;
 	
 	/* reset vars */
-	data->items.totitem= 0;
-	data->items.more= 0;
-	if(reset==0) {
-		data->items.offset_i= data->items.offset;
+	data->items.totitem = 0;
+	data->items.more = 0;
+	if (reset == 0) {
+		data->items.offset_i = data->items.offset;
 	}
 	else {
-		data->items.offset_i= data->items.offset= 0;
-		data->active= 0;
+		data->items.offset_i = data->items.offset = 0;
+		data->active = 0;
 		
 		/* handle active */
-		if(but->search_func && but->func_arg2) {
-			data->items.active= but->func_arg2;
+		if (but->search_func && but->func_arg2) {
+			data->items.active = but->func_arg2;
 			but->search_func(C, but->search_arg, but->editstr, &data->items);
-			data->items.active= NULL;
+			data->items.active = NULL;
 			
 			/* found active item, calculate real offset by centering it */
-			if(data->items.totitem) {
+			if (data->items.totitem) {
 				/* first case, begin of list */
-				if(data->items.offset_i < data->items.maxitem) {
-					data->active= data->items.offset_i+1;
-					data->items.offset_i= 0;
+				if (data->items.offset_i < data->items.maxitem) {
+					data->active = data->items.offset_i + 1;
+					data->items.offset_i = 0;
 				}
 				else {
 					/* second case, end of list */
-					if(data->items.totitem - data->items.offset_i <= data->items.maxitem) {
-						data->active= 1 + data->items.offset_i - data->items.totitem + data->items.maxitem;
-						data->items.offset_i= data->items.totitem - data->items.maxitem;
+					if (data->items.totitem - data->items.offset_i <= data->items.maxitem) {
+						data->active = 1 + data->items.offset_i - data->items.totitem + data->items.maxitem;
+						data->items.offset_i = data->items.totitem - data->items.maxitem;
 					}
 					else {
 						/* center active item */
-						data->items.offset_i -= data->items.maxitem/2;
-						data->active= 1 + data->items.maxitem/2;
+						data->items.offset_i -= data->items.maxitem / 2;
+						data->active = 1 + data->items.maxitem / 2;
 					}
 				}
 			}
-			data->items.offset= data->items.offset_i;
-			data->items.totitem= 0;
+			data->items.offset = data->items.offset_i;
+			data->items.totitem = 0;
 		}
 	}
 	
 	/* callback */
-	if(but->search_func)
+	if (but->search_func)
 		but->search_func(C, but->search_arg, but->editstr, &data->items);
 	
 	/* handle case where editstr is equal to one of items */
-	if(reset && data->active==0) {
+	if (reset && data->active == 0) {
 		int a;
 		
-		for(a=0; a<data->items.totitem; a++) {
-			char *cpoin= strchr(data->items.names[a], '|');
+		for (a = 0; a < data->items.totitem; a++) {
+			char *cpoin = strchr(data->items.names[a], '|');
 			
-			if(cpoin) cpoin[0]= 0;
-			if(0==strcmp(but->editstr, data->items.names[a]))
-				data->active= a+1;
-			if(cpoin) cpoin[0]= '|';
+			if (cpoin) cpoin[0] = 0;
+			if (0 == strcmp(but->editstr, data->items.names[a]))
+				data->active = a + 1;
+			if (cpoin) cpoin[0] = '|';
 		}
-		if(data->items.totitem==1 && but->editstr[0])
-			data->active= 1;
+		if (data->items.totitem == 1 && but->editstr[0])
+			data->active = 1;
 	}
 
 	/* validate selected item */
@@ -899,79 +960,80 @@ void ui_searchbox_update(bContext *C, ARegion *ar, uiBut *but, int reset)
 
 void ui_searchbox_autocomplete(bContext *C, ARegion *ar, uiBut *but, char *str)
 {
-	uiSearchboxData *data= ar->regiondata;
+	uiSearchboxData *data = ar->regiondata;
 
-	if(str[0]) {
-		data->items.autocpl= autocomplete_begin(str, ui_get_but_string_max_length(but));
+	if (str[0]) {
+		data->items.autocpl = autocomplete_begin(str, ui_get_but_string_max_length(but));
 
 		but->search_func(C, but->search_arg, but->editstr, &data->items);
 
 		autocomplete_end(data->items.autocpl, str);
-		data->items.autocpl= NULL;
+		data->items.autocpl = NULL;
 	}
 }
 
 static void ui_searchbox_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
 {
-	uiSearchboxData *data= ar->regiondata;
+	uiSearchboxData *data = ar->regiondata;
 	
 	/* pixel space */
-	wmOrtho2(-0.01f, ar->winx-0.01f, -0.01f, ar->winy-0.01f);
+	wmOrtho2(-0.01f, ar->winx - 0.01f, -0.01f, ar->winy - 0.01f);
 
-	if(!data->noback)
-		ui_draw_search_back(NULL, NULL, &data->bbox); /* style not used yet */
+	if (!data->noback)
+		ui_draw_search_back(NULL, NULL, &data->bbox);  /* style not used yet */
 	
 	/* draw text */
-	if(data->items.totitem) {
+	if (data->items.totitem) {
 		rcti rect;
 		int a;
 		
 		if (data->preview) {
 			/* draw items */
-			for(a=0; a<data->items.totitem; a++) {
+			for (a = 0; a < data->items.totitem; a++) {
 				ui_searchbox_butrect(&rect, data, a);
 				
 				/* widget itself */
 				if (data->preview)
-					ui_draw_preview_item(&data->fstyle, &rect, data->items.names[a], data->items.icons[a], (a+1)==data->active?UI_ACTIVE:0);
+					ui_draw_preview_item(&data->fstyle, &rect, data->items.names[a], data->items.icons[a], (a + 1) == data->active ? UI_ACTIVE : 0);
 				else 
-					ui_draw_menu_item(&data->fstyle, &rect, data->items.names[a], data->items.icons[a], (a+1)==data->active?UI_ACTIVE:0);
+					ui_draw_menu_item(&data->fstyle, &rect, data->items.names[a], data->items.icons[a], (a + 1) == data->active ? UI_ACTIVE : 0);
 			}
 			
 			/* indicate more */
-			if(data->items.more) {
-				ui_searchbox_butrect(&rect, data, data->items.maxitem-1);
+			if (data->items.more) {
+				ui_searchbox_butrect(&rect, data, data->items.maxitem - 1);
 				glEnable(GL_BLEND);
-				UI_icon_draw(rect.xmax-18, rect.ymin-7, ICON_TRIA_DOWN);
+				UI_icon_draw(rect.xmax - 18, rect.ymin - 7, ICON_TRIA_DOWN);
 				glDisable(GL_BLEND);
 			}
-			if(data->items.offset) {
+			if (data->items.offset) {
 				ui_searchbox_butrect(&rect, data, 0);
 				glEnable(GL_BLEND);
-				UI_icon_draw(rect.xmin, rect.ymax-9, ICON_TRIA_UP);
+				UI_icon_draw(rect.xmin, rect.ymax - 9, ICON_TRIA_UP);
 				glDisable(GL_BLEND);
 			}
 			
-		} else {
+		}
+		else {
 			/* draw items */
-			for(a=0; a<data->items.totitem; a++) {
+			for (a = 0; a < data->items.totitem; a++) {
 				ui_searchbox_butrect(&rect, data, a);
 				
 				/* widget itself */
-				ui_draw_menu_item(&data->fstyle, &rect, data->items.names[a], data->items.icons[a], (a+1)==data->active?UI_ACTIVE:0);
+				ui_draw_menu_item(&data->fstyle, &rect, data->items.names[a], data->items.icons[a], (a + 1) == data->active ? UI_ACTIVE : 0);
 				
 			}
 			/* indicate more */
-			if(data->items.more) {
-				ui_searchbox_butrect(&rect, data, data->items.maxitem-1);
+			if (data->items.more) {
+				ui_searchbox_butrect(&rect, data, data->items.maxitem - 1);
 				glEnable(GL_BLEND);
-				UI_icon_draw((rect.xmax-rect.xmin)/2, rect.ymin-9, ICON_TRIA_DOWN);
+				UI_icon_draw((rect.xmax - rect.xmin) / 2, rect.ymin - 9, ICON_TRIA_DOWN);
 				glDisable(GL_BLEND);
 			}
-			if(data->items.offset) {
+			if (data->items.offset) {
 				ui_searchbox_butrect(&rect, data, 0);
 				glEnable(GL_BLEND);
-				UI_icon_draw((rect.xmax-rect.xmin)/2, rect.ymax-7, ICON_TRIA_UP);
+				UI_icon_draw((rect.xmax - rect.xmin) / 2, rect.ymax - 7, ICON_TRIA_UP);
 				glDisable(GL_BLEND);
 			}
 		}
@@ -980,7 +1042,7 @@ static void ui_searchbox_region_draw_cb(const bContext *UNUSED(C), ARegion *ar)
 
 static void ui_searchbox_region_free_cb(ARegion *ar)
 {
-	uiSearchboxData *data= ar->regiondata;
+	uiSearchboxData *data = ar->regiondata;
 	int a;
 
 	/* free search data */
@@ -992,42 +1054,42 @@ static void ui_searchbox_region_free_cb(ARegion *ar)
 	MEM_freeN(data->items.icons);
 	
 	MEM_freeN(data);
-	ar->regiondata= NULL;
+	ar->regiondata = NULL;
 }
 
 ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
 {
-	uiStyle *style= UI_GetStyle();
+	uiStyle *style = UI_GetStyle();
 	static ARegionType type;
 	ARegion *ar;
 	uiSearchboxData *data;
-	float aspect= but->block->aspect;
+	float aspect = but->block->aspect;
 	float x1f, x2f, y1f, y2f;
 	int x1, x2, y1, y2, winx, winy, ofsx, ofsy;
 	
 	/* create area region */
-	ar= ui_add_temporary_region(CTX_wm_screen(C));
+	ar = ui_add_temporary_region(CTX_wm_screen(C));
 	
 	memset(&type, 0, sizeof(ARegionType));
-	type.draw= ui_searchbox_region_draw_cb;
-	type.free= ui_searchbox_region_free_cb;
-	ar->type= &type;
+	type.draw = ui_searchbox_region_draw_cb;
+	type.free = ui_searchbox_region_free_cb;
+	ar->type = &type;
 	
 	/* create searchbox data */
-	data= MEM_callocN(sizeof(uiSearchboxData), "uiSearchboxData");
+	data = MEM_callocN(sizeof(uiSearchboxData), "uiSearchboxData");
 
 	/* set font, get bb */
-	data->fstyle= style->widget; /* copy struct */
-	data->fstyle.align= UI_STYLE_TEXT_CENTER;
+	data->fstyle = style->widget; /* copy struct */
+	data->fstyle.align = UI_STYLE_TEXT_CENTER;
 	ui_fontscale(&data->fstyle.points, aspect);
 	uiStyleFontSet(&data->fstyle);
 	
-	ar->regiondata= data;
+	ar->regiondata = data;
 	
 	/* 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)
-		data->noback= 1;
+	 * assume for design that popup already added it */
+	if (but->block->flag & UI_BLOCK_LOOP)
+		data->noback = 1;
 	
 	if (but->a1 > 0 && but->a2 > 0) {
 		data->preview = 1;
@@ -1036,34 +1098,34 @@ 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_LOOP) {
 		/* this case is search menu inside other menu */
 		/* we copy region size */
 
-		ar->winrct= butregion->winrct;
+		ar->winrct = butregion->winrct;
 		
 		/* widget rect, in region coords */
-		data->bbox.xmin= MENU_SHADOW_SIDE;
-		data->bbox.xmax= (ar->winrct.xmax-ar->winrct.xmin) - MENU_SHADOW_SIDE;
-		data->bbox.ymin= MENU_SHADOW_BOTTOM;
-		data->bbox.ymax= (ar->winrct.ymax-ar->winrct.ymin) - MENU_SHADOW_BOTTOM;
+		data->bbox.xmin = MENU_SHADOW_SIDE;
+		data->bbox.xmax = (ar->winrct.xmax - ar->winrct.xmin) - MENU_SHADOW_SIDE;
+		data->bbox.ymin = MENU_SHADOW_BOTTOM;
+		data->bbox.ymax = (ar->winrct.ymax - ar->winrct.ymin) - MENU_SHADOW_BOTTOM;
 		
 		/* check if button is lower half */
-		if( but->y2 < (but->block->miny+but->block->maxy)/2 ) {
-			data->bbox.ymin += (but->y2-but->y1);
+		if (but->y2 < (but->block->miny + but->block->maxy) / 2) {
+			data->bbox.ymin += (but->y2 - but->y1);
 		}
 		else {
-			data->bbox.ymax -= (but->y2-but->y1);
+			data->bbox.ymax -= (but->y2 - but->y1);
 		}
 	}
 	else {
-		x1f= but->x1 - 5;	/* align text with button */
-		x2f= but->x2 + 5;	/* symmetrical */
-		y2f= but->y1;
-		y1f= y2f - uiSearchBoxhHeight();
+		x1f = but->x1 - 5;   /* align text with button */
+		x2f = but->x2 + 5;   /* symmetrical */
+		y2f = but->y1;
+		y1f = y2f - uiSearchBoxhHeight();
 
-		ofsx= (but->block->panel)? but->block->panel->ofsx: 0;
-		ofsy= (but->block->panel)? but->block->panel->ofsy: 0;
+		ofsx = (but->block->panel) ? but->block->panel->ofsx : 0;
+		ofsy = (but->block->panel) ? but->block->panel->ofsy : 0;
 
 		x1f += ofsx;
 		x2f += ofsx;
@@ -1071,12 +1133,12 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
 		y2f += ofsy;
 	
 		/* minimal width */
-		if(x2f - x1f < 150) x2f= x1f+150; // XXX arbitrary
+		if (x2f - x1f < 150) x2f = x1f + 150;  // XXX arbitrary
 		
 		/* copy to int, gets projected if possible too */
-		x1= x1f; y1= y1f; x2= x2f; y2= y2f; 
+		x1 = x1f; y1 = y1f; x2 = x2f; y2 = y2f;
 		
-		if(butregion->v2d.cur.xmin != butregion->v2d.cur.xmax) {
+		if (butregion->v2d.cur.xmin != butregion->v2d.cur.xmax) {
 			UI_view2d_to_region_no_clip(&butregion->v2d, x1f, y1f, &x1, &y1);
 			UI_view2d_to_region_no_clip(&butregion->v2d, x2f, y2f, &x2, &y2);
 		}
@@ -1088,38 +1150,38 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
 
 		wm_window_get_size(CTX_wm_window(C), &winx, &winy);
 		
-		if(x2 > winx) {
+		if (x2 > winx) {
 			/* super size */
-			if(x2 > winx + x1) {
-				x2= winx;
-				x1= 0;
+			if (x2 > winx + x1) {
+				x2 = winx;
+				x1 = 0;
 			}
 			else {
-				x1 -= x2-winx;
-				x2= winx;
+				x1 -= x2 - winx;
+				x2 = winx;
 			}
 		}
 
-		if(y1 < 0) {
+		if (y1 < 0) {
 			int newy1;
 			UI_view2d_to_region_no_clip(&butregion->v2d, 0, but->y2 + ofsy, NULL, &newy1);
 			newy1 += butregion->winrct.ymin;
 
-			y2= y2-y1 + newy1;
-			y1= newy1;
+			y2 = y2 - y1 + newy1;
+			y1 = newy1;
 		}
 
 		/* widget rect, in region coords */
-		data->bbox.xmin= MENU_SHADOW_SIDE;
-		data->bbox.xmax= x2-x1 + MENU_SHADOW_SIDE;
-		data->bbox.ymin= MENU_SHADOW_BOTTOM;
-		data->bbox.ymax= y2-y1 + MENU_SHADOW_BOTTOM;
+		data->bbox.xmin = MENU_SHADOW_SIDE;
+		data->bbox.xmax = x2 - x1 + MENU_SHADOW_SIDE;
+		data->bbox.ymin = MENU_SHADOW_BOTTOM;
+		data->bbox.ymax = y2 - y1 + MENU_SHADOW_BOTTOM;
 		
 		/* region bigger for shadow */
-		ar->winrct.xmin= x1 - MENU_SHADOW_SIDE;
-		ar->winrct.xmax= x2 + MENU_SHADOW_SIDE;
-		ar->winrct.ymin= y1 - MENU_SHADOW_BOTTOM;
-		ar->winrct.ymax= y2;
+		ar->winrct.xmin = x1 - MENU_SHADOW_SIDE;
+		ar->winrct.xmax = x2 + MENU_SHADOW_SIDE;
+		ar->winrct.ymin = y1 - MENU_SHADOW_BOTTOM;
+		ar->winrct.ymax = y2;
 	}
 	
 	/* adds subwindow */
@@ -1130,17 +1192,18 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
 	
 	/* prepare search data */
 	if (data->preview) {
-		data->items.maxitem= data->prv_rows * data->prv_cols;
-	} else {
-		data->items.maxitem= SEARCH_ITEMS;
-	}
-	data->items.maxstrlen= but->hardmax;
-	data->items.totitem= 0;
-	data->items.names= MEM_callocN(data->items.maxitem*sizeof(void *), "search names");
-	data->items.pointers= MEM_callocN(data->items.maxitem*sizeof(void *), "search pointers");
-	data->items.icons= MEM_callocN(data->items.maxitem*sizeof(int), "search icons");
-	for(x1=0; x1<data->items.maxitem; x1++)
-		data->items.names[x1]= MEM_callocN(but->hardmax+1, "search pointers");
+		data->items.maxitem = data->prv_rows * data->prv_cols;
+	}
+	else {
+		data->items.maxitem = SEARCH_ITEMS;
+	}
+	data->items.maxstrlen = but->hardmax;
+	data->items.totitem = 0;
+	data->items.names = MEM_callocN(data->items.maxitem * sizeof(void *), "search names");
+	data->items.pointers = MEM_callocN(data->items.maxitem * sizeof(void *), "search pointers");
+	data->items.icons = MEM_callocN(data->items.maxitem * sizeof(int), "search icons");
+	for (x1 = 0; x1 < data->items.maxitem; x1++)
+		data->items.names[x1] = MEM_callocN(but->hardmax + 1, "search pointers");
 	
 	return ar;
 }
@@ -1159,29 +1222,29 @@ void ui_but_search_test(uiBut *but)
 
 	/* possibly very large lists (such as ID datablocks) only
 	 * only validate string RNA buts (not pointers) */
-	if(but->rnaprop && RNA_property_type(but->rnaprop) != PROP_STRING) {
+	if (but->rnaprop && RNA_property_type(but->rnaprop) != PROP_STRING) {
 		return;
 	}
 
-	items= MEM_callocN(sizeof(uiSearchItems), "search items");
+	items = MEM_callocN(sizeof(uiSearchItems), "search items");
 
 	/* setup search struct */
-	items->maxitem= 10;
-	items->maxstrlen= 256;
-	items->names= MEM_callocN(items->maxitem*sizeof(void *), "search names");
-	for(x1=0; x1<items->maxitem; x1++)
-		items->names[x1]= MEM_callocN(but->hardmax+1, "search names");
+	items->maxitem = 10;
+	items->maxstrlen = 256;
+	items->names = MEM_callocN(items->maxitem * sizeof(void *), "search names");
+	for (x1 = 0; x1 < items->maxitem; x1++)
+		items->names[x1] = MEM_callocN(but->hardmax + 1, "search names");
 	
 	but->search_func(but->block->evil_C, but->search_arg, but->drawstr, items);
 	
 	/* only redalert when we are sure of it, this can miss cases when >10 matches */
-	if(items->totitem==0)
+	if (items->totitem == 0)
 		uiButSetFlag(but, UI_BUT_REDALERT);
-	else if(items->more==0) {
-		for(x1= 0; x1<items->totitem; x1++)
-			if(strcmp(but->drawstr, items->names[x1])==0)
+	else if (items->more == 0) {
+		for (x1 = 0; x1 < items->totitem; x1++)
+			if (strcmp(but->drawstr, items->names[x1]) == 0)
 				break;
-		if(x1==items->totitem)
+		if (x1 == items->totitem)
 			uiButSetFlag(but, UI_BUT_REDALERT);
 	}
 	
@@ -1202,37 +1265,37 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
 	uiSafetyRct *saferct;
 	rctf butrct;
 	/*float aspect;*/ /*UNUSED*/
-	int xsize, ysize, xof=0, yof=0, center;
-	short dir1= 0, dir2=0;
+	int xsize, ysize, xof = 0, yof = 0, center;
+	short dir1 = 0, dir2 = 0;
 	
 	/* transform to window coordinates, using the source button region/block */
-	butrct.xmin= but->x1; butrct.xmax= but->x2;
-	butrct.ymin= but->y1; butrct.ymax= but->y2;
+	butrct.xmin = but->x1; butrct.xmax = but->x2;
+	butrct.ymin = but->y1; butrct.ymax = but->y2;
 
 	ui_block_to_window_fl(butregion, but->block, &butrct.xmin, &butrct.ymin);
 	ui_block_to_window_fl(butregion, but->block, &butrct.xmax, &butrct.ymax);
 
 	/* calc block rect */
-	if(block->minx == 0.0f && block->maxx == 0.0f) {
-		if(block->buttons.first) {
-			block->minx= block->miny= 10000;
-			block->maxx= block->maxy= -10000;
+	if (block->minx == 0.0f && block->maxx == 0.0f) {
+		if (block->buttons.first) {
+			block->minx = block->miny = 10000;
+			block->maxx = block->maxy = -10000;
 			
-			bt= block->buttons.first;
-			while(bt) {
-				if(bt->x1 < block->minx) block->minx= bt->x1;
-				if(bt->y1 < block->miny) block->miny= bt->y1;
+			bt = block->buttons.first;
+			while (bt) {
+				if (bt->x1 < block->minx) block->minx = bt->x1;
+				if (bt->y1 < block->miny) block->miny = bt->y1;
 
-				if(bt->x2 > block->maxx) block->maxx= bt->x2;
-				if(bt->y2 > block->maxy) block->maxy= bt->y2;
+				if (bt->x2 > block->maxx) block->maxx = bt->x2;
+				if (bt->y2 > block->maxy) block->maxy = bt->y2;
 				
-				bt= bt->next;
+				bt = bt->next;
 			}
 		}
 		else {
 			/* we're nice and allow empty blocks too */
-			block->minx= block->miny= 0;
-			block->maxx= block->maxy= 20;
+			block->minx = block->miny = 0;
+			block->maxx = block->maxy = 20;
 		}
 	}
 	
@@ -1243,124 +1306,124 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
 	//block->minx-= 2.0; block->miny-= 2.0;
 	//block->maxx+= 2.0; block->maxy+= 2.0;
 	
-	xsize= block->maxx - block->minx+4; // 4 for shadow
-	ysize= block->maxy - block->miny+4;
+	xsize = block->maxx - block->minx + 4; // 4 for shadow
+	ysize = block->maxy - block->miny + 4;
 	/*aspect/= (float)xsize;*/ /*UNUSED*/
 
 	{
-		int left=0, right=0, top=0, down=0;
+		int left = 0, right = 0, top = 0, down = 0;
 		int winx, winy;
 		// int offscreen;
 
 		wm_window_get_size(window, &winx, &winy);
 
-		if(block->direction & UI_CENTER) center= ysize/2;
-		else center= 0;
+		if (block->direction & UI_CENTER) center = ysize / 2;
+		else center = 0;
 		
 		/* check if there's space at all */
-		if( butrct.xmin-xsize > 0.0f) left= 1;
-		if( butrct.xmax+xsize < winx) right= 1;
-		if( butrct.ymin-ysize+center > 0.0f) down= 1;
-		if( butrct.ymax+ysize-center < winy) top= 1;
-		
-		if(top==0 && down==0) {
-			if (butrct.ymin-ysize < winy-butrct.ymax-ysize)
-				top= 1;
+		if (butrct.xmin - xsize > 0.0f) left = 1;
+		if (butrct.xmax + xsize < winx) right = 1;
+		if (butrct.ymin - ysize + center > 0.0f) down = 1;
+		if (butrct.ymax + ysize - center < winy) top = 1;
+
+		if (top == 0 && down == 0) {
+			if (butrct.ymin - ysize < winy - butrct.ymax - ysize)
+				top = 1;
 			else
-				down= 1;
+				down = 1;
 		}
 		
-		dir1= block->direction & UI_DIRECTION;
+		dir1 = block->direction & UI_DIRECTION;
 
 		/* secundary directions */
-		if(dir1 & (UI_TOP|UI_DOWN)) {
-			if(dir1 & UI_LEFT) dir2= UI_LEFT;
-			else if(dir1 & UI_RIGHT) dir2= UI_RIGHT;
-			dir1 &= (UI_TOP|UI_DOWN);
+		if (dir1 & (UI_TOP | UI_DOWN)) {
+			if (dir1 & UI_LEFT) dir2 = UI_LEFT;
+			else if (dir1 & UI_RIGHT) dir2 = UI_RIGHT;
+			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) if (dir1 == UI_LEFT || dir1 == UI_RIGHT) dir2 = UI_DOWN;
+		if (dir2 == 0) if (dir1 == UI_TOP || dir1 == UI_DOWN) dir2 = UI_LEFT;
 		
-		/* no space at all? dont change */
-		if(left || right) {
-			if(dir1==UI_LEFT && left==0) dir1= UI_RIGHT;
-			if(dir1==UI_RIGHT && right==0) dir1= UI_LEFT;
+		/* no space at all? don't change */
+		if (left || right) {
+			if (dir1 == UI_LEFT && left == 0) dir1 = UI_RIGHT;
+			if (dir1 == UI_RIGHT && right == 0) dir1 = UI_LEFT;
 			/* this is aligning, not append! */
-			if(dir2==UI_LEFT && right==0) dir2= UI_RIGHT;
-			if(dir2==UI_RIGHT && left==0) dir2= UI_LEFT;
-		}
-		if(down || top) {
-			if(dir1==UI_TOP && top==0) dir1= UI_DOWN;
-			if(dir1==UI_DOWN && down==0) dir1= UI_TOP;
-			if(dir2==UI_TOP && top==0) dir2= UI_DOWN;
-			if(dir2==UI_DOWN && down==0) dir2= UI_TOP;
-		}
-		
-		if(dir1==UI_LEFT) {
-			xof= butrct.xmin - block->maxx;
-			if(dir2==UI_TOP) yof= butrct.ymin - block->miny-center;
-			else yof= butrct.ymax - block->maxy+center;
-		}
-		else if(dir1==UI_RIGHT) {
-			xof= butrct.xmax - block->minx;
-			if(dir2==UI_TOP) yof= butrct.ymin - block->miny-center;
-			else yof= butrct.ymax - block->maxy+center;
-		}
-		else if(dir1==UI_TOP) {
-			yof= butrct.ymax - block->miny;
-			if(dir2==UI_RIGHT) xof= butrct.xmax - block->maxx;
-			else xof= butrct.xmin - block->minx;
+			if (dir2 == UI_LEFT && right == 0) dir2 = UI_RIGHT;
+			if (dir2 == UI_RIGHT && left == 0) dir2 = UI_LEFT;
+		}
+		if (down || top) {
+			if (dir1 == UI_TOP && top == 0) dir1 = UI_DOWN;
+			if (dir1 == UI_DOWN && down == 0) dir1 = UI_TOP;
+			if (dir2 == UI_TOP && top == 0) dir2 = UI_DOWN;
+			if (dir2 == UI_DOWN && down == 0) dir2 = UI_TOP;
+		}
+
+		if (dir1 == UI_LEFT) {
+			xof = butrct.xmin - block->maxx;
+			if (dir2 == UI_TOP) yof = butrct.ymin - block->miny - center;
+			else yof = butrct.ymax - block->maxy + center;
+		}
+		else if (dir1 == UI_RIGHT) {
+			xof = butrct.xmax - block->minx;
+			if (dir2 == UI_TOP) yof = butrct.ymin - block->miny - center;
+			else yof = butrct.ymax - block->maxy + center;
+		}
+		else if (dir1 == UI_TOP) {
+			yof = butrct.ymax - block->miny;
+			if (dir2 == UI_RIGHT) xof = butrct.xmax - block->maxx;
+			else xof = butrct.xmin - block->minx;
 			// changed direction? 
-			if((dir1 & block->direction)==0) {
-				if(block->direction & UI_SHIFT_FLIPPED)
-					xof+= dir2==UI_LEFT?25:-25;
+			if ((dir1 & block->direction) == 0) {
+				if (block->direction & UI_SHIFT_FLIPPED)
+					xof += dir2 == UI_LEFT ? 25 : -25;
 				uiBlockFlipOrder(block);
 			}
 		}
-		else if(dir1==UI_DOWN) {
-			yof= butrct.ymin - block->maxy;
-			if(dir2==UI_RIGHT) xof= butrct.xmax - block->maxx;
-			else xof= butrct.xmin - block->minx;
+		else if (dir1 == UI_DOWN) {
+			yof = butrct.ymin - block->maxy;
+			if (dir2 == UI_RIGHT) xof = butrct.xmax - block->maxx;
+			else xof = butrct.xmin - block->minx;
 			// changed direction?
-			if((dir1 & block->direction)==0) {
-				if(block->direction & UI_SHIFT_FLIPPED)
-					xof+= dir2==UI_LEFT?25:-25;
+			if ((dir1 & block->direction) == 0) {
+				if (block->direction & UI_SHIFT_FLIPPED)
+					xof += dir2 == UI_LEFT ? 25 : -25;
 				uiBlockFlipOrder(block);
 			}
 		}
 
 		/* and now we handle the exception; no space below or to top */
-		if(top==0 && down==0) {
-			if(dir1==UI_LEFT || dir1==UI_RIGHT) {
+		if (top == 0 && down == 0) {
+			if (dir1 == UI_LEFT || dir1 == UI_RIGHT) {
 				// align with bottom of screen 
 				// yof= ysize; (not with menu scrolls)
 			}
 		}
 		
 		/* or no space left or right */
-		if(left==0 && right==0) {
-			if(dir1==UI_TOP || dir1==UI_DOWN) {
+		if (left == 0 && right == 0) {
+			if (dir1 == UI_TOP || dir1 == UI_DOWN) {
 				// align with left size of screen 
-				xof= -block->minx+5;
+				xof = -block->minx + 5;
 			}
 		}
 		
 		// apply requested offset in the block
-		xof += block->xofs/block->aspect;
-		yof += block->yofs/block->aspect;
+		xof += block->xofs / block->aspect;
+		yof += block->yofs / block->aspect;
 #if 0
 		/* clamp to window bounds, could be made into an option if its ever annoying */
-		if(     (offscreen= (block->miny+yof)) < 0)      yof -= offscreen; /* bottom */
-		else if((offscreen= (block->maxy+yof)-winy) > 0) yof -= offscreen; /* top */
-		if(     (offscreen= (block->minx+xof)) < 0)      xof -= offscreen; /* left */
-		else if((offscreen= (block->maxx+xof)-winx) > 0) xof -= offscreen; /* right */
+		if (     (offscreen = (block->miny + yof)) < 0) yof -= offscreen;   /* bottom */
+		else if ((offscreen = (block->maxy + yof) - winy) > 0) yof -= offscreen;  /* top */
+		if (     (offscreen = (block->minx + xof)) < 0) xof -= offscreen;   /* left */
+		else if ((offscreen = (block->maxx + xof) - winx) > 0) xof -= offscreen;  /* right */
 #endif
 	}
 	
 	/* apply offset, buttons in window coords */
 	
-	for(bt= block->buttons.first; bt; bt= bt->next) {
+	for (bt = block->buttons.first; bt; bt = bt->next) {
 		ui_block_to_window_fl(butregion, but->block, &bt->x1, &bt->y1);
 		ui_block_to_window_fl(butregion, but->block, &bt->x2, &bt->y2);
 
@@ -1369,7 +1432,7 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
 		bt->y1 += yof;
 		bt->y2 += yof;
 
-		bt->aspect= 1.0;
+		bt->aspect = 1.0;
 		// ui_check_but recalculates drawstring size in pixels
 		ui_check_but(bt);
 	}
@@ -1380,46 +1443,46 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but,
 	block->maxy += yof;
 
 	/* safety calculus */
-	if(but) {
-		float midx= (butrct.xmin+butrct.xmax)/2.0f;
-		float midy= (butrct.ymin+butrct.ymax)/2.0f;
+	if (but) {
+		float midx = (butrct.xmin + butrct.xmax) / 2.0f;
+		float midy = (butrct.ymin + butrct.ymax) / 2.0f;
 		
 		/* when you are outside parent button, safety there should be smaller */
 		
 		// parent button to left
-		if( midx < block->minx ) block->safety.xmin= block->minx-3; 
-		else block->safety.xmin= block->minx-40;
+		if (midx < block->minx) block->safety.xmin = block->minx - 3;
+		else block->safety.xmin = block->minx - 40;
 		// parent button to right
-		if( midx > block->maxx ) block->safety.xmax= block->maxx+3; 
-		else block->safety.xmax= block->maxx+40;
+		if (midx > block->maxx) block->safety.xmax = block->maxx + 3;
+		else block->safety.xmax = block->maxx + 40;
 		
 		// parent button on bottom
-		if( midy < block->miny ) block->safety.ymin= block->miny-3; 
-		else block->safety.ymin= block->miny-40;
+		if (midy < block->miny) block->safety.ymin = block->miny - 3;
+		else block->safety.ymin = block->miny - 40;
 		// parent button on top
-		if( midy > block->maxy ) block->safety.ymax= block->maxy+3; 
-		else block->safety.ymax= block->maxy+40;
+		if (midy > block->maxy) block->safety.ymax = block->maxy + 3;
+		else block->safety.ymax = block->maxy + 40;
 		
 		// exception for switched pulldowns...
-		if(dir1 && (dir1 & block->direction)==0) {
-			if(dir2==UI_RIGHT) block->safety.xmax= block->maxx+3; 
-			if(dir2==UI_LEFT) block->safety.xmin= block->minx-3; 
+		if (dir1 && (dir1 & block->direction) == 0) {
+			if (dir2 == UI_RIGHT) block->safety.xmax = block->maxx + 3;
+			if (dir2 == UI_LEFT) block->safety.xmin = block->minx - 3;
 		}
-		block->direction= dir1;
+		block->direction = dir1;
 	}
 	else {
-		block->safety.xmin= block->minx-40;
-		block->safety.ymin= block->miny-40;
-		block->safety.xmax= block->maxx+40;
-		block->safety.ymax= block->maxy+40;
+		block->safety.xmin = block->minx - 40;
+		block->safety.ymin = block->miny - 40;
+		block->safety.xmax = block->maxx + 40;
+		block->safety.ymax = block->maxy + 40;
 	}
 
 	/* keep a list of these, needed for pulldown menus */
-	saferct= MEM_callocN(sizeof(uiSafetyRct), "uiSafetyRct");
-	saferct->parent= butrct;
-	saferct->safety= block->safety;
+	saferct = MEM_callocN(sizeof(uiSafetyRct), "uiSafetyRct");
+	saferct->parent = butrct;
+	saferct->safety = block->safety;
 	BLI_freelistN(&block->saferct);
-	if(but)
+	if (but)
 		BLI_duplicatelist(&block->saferct, &but->block->saferct);
 	BLI_addhead(&block->saferct, saferct);
 }
@@ -1428,7 +1491,7 @@ static void ui_block_region_draw(const bContext *C, ARegion *ar)
 {
 	uiBlock *block;
 
-	for(block=ar->uiblocks.first; block; block=block->next)
+	for (block = ar->uiblocks.first; block; block = block->next)
 		uiDrawBlock(C, block);
 }
 
@@ -1438,15 +1501,15 @@ static void ui_popup_block_clip(wmWindow *window, uiBlock *block)
 	
 	wm_window_get_size(window, &winx, &winy);
 	
-	if(block->minx < MENU_SHADOW_SIDE)
-		block->minx= MENU_SHADOW_SIDE;
-	if(block->maxx > winx-MENU_SHADOW_SIDE)
-		block->maxx= winx-MENU_SHADOW_SIDE;
+	if (block->minx < MENU_SHADOW_SIDE)
+		block->minx = MENU_SHADOW_SIDE;
+	if (block->maxx > winx - MENU_SHADOW_SIDE)
+		block->maxx = winx - MENU_SHADOW_SIDE;
 	
-	if(block->miny < MENU_SHADOW_BOTTOM)
-		block->miny= MENU_SHADOW_BOTTOM;
-	if(block->maxy > winy-MENU_TOP)
-		block->maxy= winy-MENU_TOP;
+	if (block->miny < MENU_SHADOW_BOTTOM)
+		block->miny = MENU_SHADOW_BOTTOM;
+	if (block->maxy > winy - MENU_TOP)
+		block->maxy = winy - MENU_TOP;
 }
 
 void ui_popup_block_scrolltest(uiBlock *block)
@@ -1455,35 +1518,35 @@ void ui_popup_block_scrolltest(uiBlock *block)
 	/* 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);
+	block->flag &= ~(UI_BLOCK_CLIPBOTTOM | UI_BLOCK_CLIPTOP);
 	
-	for(bt= block->buttons.first; bt; bt= bt->next)
+	for (bt = block->buttons.first; bt; bt = bt->next)
 		bt->flag &= ~UI_SCROLLED;
 	
-	if(block->buttons.first==block->buttons.last)
+	if (block->buttons.first == block->buttons.last)
 		return;
 	
 	/* mark buttons that are outside boundary and the ones next to it for arrow(s) */
-	for(bt= block->buttons.first; bt; bt= bt->next) {
-		if(bt->y1 < block->miny) {
+	for (bt = block->buttons.first; bt; bt = bt->next) {
+		if (bt->y1 < block->miny) {
 			bt->flag |= UI_SCROLLED;
 			block->flag |= UI_BLOCK_CLIPBOTTOM;
 			/* make space for arrow */
-			if(bt->y2 < block->miny +10) {
-				if(is_flip && bt->next && bt->next->y1 > bt->y1)
+			if (bt->y2 < block->miny + 10) {
+				if (is_flip && bt->next && bt->next->y1 > bt->y1)
 					bt->next->flag |= UI_SCROLLED;
-				else if(!is_flip && bt->prev && bt->prev->y1 > bt->y1)
+				else if (!is_flip && bt->prev && bt->prev->y1 > bt->y1)
 					bt->prev->flag |= UI_SCROLLED;
 			}
 		}
-		if(bt->y2 > block->maxy) {
+		if (bt->y2 > block->maxy) {
 			bt->flag |= UI_SCROLLED;
 			block->flag |= UI_BLOCK_CLIPTOP;
 			/* make space for arrow */
-			if(bt->y1 > block->maxy -10) {
-				if(!is_flip && bt->next && bt->next->y2 < bt->y2)
+			if (bt->y1 > block->maxy - 10) {
+				if (!is_flip && bt->next && bt->next->y2 < bt->y2)
 					bt->next->flag |= UI_SCROLLED;
-				else if(is_flip && bt->prev && bt->prev->y2 < bt->y2)
+				else if (is_flip && bt->prev && bt->prev->y2 < bt->y2)
 					bt->prev->flag |= UI_SCROLLED;
 			}
 		}
@@ -1492,7 +1555,7 @@ void ui_popup_block_scrolltest(uiBlock *block)
 
 uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut *but, uiBlockCreateFunc create_func, uiBlockHandleCreateFunc handle_create_func, void *arg)
 {
-	wmWindow *window= CTX_wm_window(C);
+	wmWindow *window = CTX_wm_window(C);
 	static ARegionType type;
 	ARegion *ar;
 	uiBlock *block;
@@ -1501,45 +1564,45 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut
 	uiSafetyRct *saferct;
 
 	/* create handle */
-	handle= MEM_callocN(sizeof(uiPopupBlockHandle), "uiPopupBlockHandle");
+	handle = MEM_callocN(sizeof(uiPopupBlockHandle), "uiPopupBlockHandle");
 
 	/* store context for operator */
-	handle->ctx_area= CTX_wm_area(C);
-	handle->ctx_region= CTX_wm_region(C);
+	handle->ctx_area = CTX_wm_area(C);
+	handle->ctx_region = CTX_wm_region(C);
 	
 	/* create area region */
-	ar= ui_add_temporary_region(CTX_wm_screen(C));
-	handle->region= ar;
+	ar = ui_add_temporary_region(CTX_wm_screen(C));
+	handle->region = ar;
 
 	memset(&type, 0, sizeof(ARegionType));
-	type.draw= ui_block_region_draw;
-	ar->type= &type;
+	type.draw = ui_block_region_draw;
+	ar->type = &type;
 
 	UI_add_region_handlers(&ar->handlers);
 
 	/* create ui block */
-	if(create_func)
-		block= create_func(C, handle->region, arg);
+	if (create_func)
+		block = create_func(C, handle->region, arg);
 	else
-		block= handle_create_func(C, handle, arg);
+		block = handle_create_func(C, handle, arg);
 	
-	if(block->handle) {
+	if (block->handle) {
 		memcpy(block->handle, handle, sizeof(uiPopupBlockHandle));
 		MEM_freeN(handle);
-		handle= block->handle;
+		handle = block->handle;
 	}
 	else
-		block->handle= handle;
+		block->handle = handle;
 
-	ar->regiondata= handle;
+	ar->regiondata = handle;
 
-	if(!block->endblock)
+	if (!block->endblock)
 		uiEndBlock(C, block);
 
 	/* if this is being created from a button */
-	if(but) {
-		if(ELEM(but->type, BLOCK, PULLDOWN))
-			block->xofs = -2;	/* for proper alignment */
+	if (but) {
+		if (ELEM(but->type, BLOCK, PULLDOWN))
+			block->xofs = -2;   /* for proper alignment */
 
 		block->aspect = but->block->aspect;
 
@@ -1547,10 +1610,10 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut
 	}
 	else {
 		/* keep a list of these, needed for pulldown menus */
-		saferct= MEM_callocN(sizeof(uiSafetyRct), "uiSafetyRct");
-		saferct->safety= block->safety;
+		saferct = MEM_callocN(sizeof(uiSafetyRct), "uiSafetyRct");
+		saferct->safety = block->safety;
 		BLI_addhead(&block->saferct, saferct);
-		block->flag |= UI_BLOCK_POPUP|UI_BLOCK_NUMSELECT;
+		block->flag |= UI_BLOCK_POPUP | UI_BLOCK_NUMSELECT;
 	}
 
 	/* clip block with window boundary */
@@ -1559,17 +1622,17 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut
 	/* the block and buttons were positioned in window space as in 2.4x, now
 	 * these menu blocks are regions so we bring it back to region space.
 	 * additionally we add some padding for the menu shadow or rounded menus */
-	ar->winrct.xmin= block->minx - MENU_SHADOW_SIDE;
-	ar->winrct.xmax= block->maxx + MENU_SHADOW_SIDE;
-	ar->winrct.ymin= block->miny - MENU_SHADOW_BOTTOM;
-	ar->winrct.ymax= block->maxy + MENU_TOP;
+	ar->winrct.xmin = block->minx - MENU_SHADOW_SIDE;
+	ar->winrct.xmax = block->maxx + MENU_SHADOW_SIDE;
+	ar->winrct.ymin = block->miny - MENU_SHADOW_BOTTOM;
+	ar->winrct.ymax = block->maxy + MENU_TOP;
 	
 	block->minx -= ar->winrct.xmin;
 	block->maxx -= ar->winrct.xmin;
 	block->miny -= ar->winrct.ymin;
 	block->maxy -= ar->winrct.ymin;
 
-	for(bt= block->buttons.first; bt; bt= bt->next) {
+	for (bt = block->buttons.first; bt; bt = bt->next) {
 		bt->x1 -= ar->winrct.xmin;
 		bt->x2 -= ar->winrct.xmin;
 		bt->y1 -= ar->winrct.ymin;
@@ -1599,7 +1662,7 @@ void ui_popup_block_free(bContext *C, uiPopupBlockHandle *handle)
 {
 	ui_remove_temporary_region(C, CTX_wm_screen(C), handle->region);
 	
-	if(handle->scrolltimer)
+	if (handle->scrolltimer)
 		WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), handle->scrolltimer);
 	
 	MEM_freeN(handle);
@@ -1609,95 +1672,95 @@ void ui_popup_block_free(bContext *C, uiPopupBlockHandle *handle)
 
 static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *arg_str)
 {
-	uiBlock *block= uiLayoutGetBlock(layout);
-	uiPopupBlockHandle *handle= block->handle;
-	uiLayout *split, *column=NULL;
+	uiBlock *block = uiLayoutGetBlock(layout);
+	uiPopupBlockHandle *handle = block->handle;
+	uiLayout *split, *column = NULL;
 	uiBut *bt;
 	MenuData *md;
 	MenuEntry *entry;
-	const char *instr= arg_str;
+	const char *instr = arg_str;
 	int columns, rows, a, b;
-	int column_start= 0, column_end= 0;
+	int column_start = 0, column_end = 0;
 
 	uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT);
 	
 	/* compute menu data */
-	md= decompose_menu_string(instr);
+	md = decompose_menu_string(instr);
 
 	/* columns and row estimation */
-	columns= (md->nitems+20)/20;
-	if(columns<1)
-		columns= 1;
-	if(columns>8)
-		columns= (md->nitems+25)/25;
-	
-	rows= md->nitems/columns;
-	if(rows<1)
-		rows= 1;
-	while(rows*columns<md->nitems)
+	columns = (md->nitems + 20) / 20;
+	if (columns < 1)
+		columns = 1;
+	if (columns > 8)
+		columns = (md->nitems + 25) / 25;
+
+	rows = md->nitems / columns;
+	if (rows < 1)
+		rows = 1;
+	while (rows * columns < md->nitems)
 		rows++;
 
 	/* create title */
-	if(md->title) {
-		if(md->titleicon) {
+	if (md->title) {
+		if (md->titleicon) {
 			uiItemL(layout, md->title, md->titleicon);
 		}
 		else {
 			uiItemL(layout, md->title, ICON_NONE);
-			bt= block->buttons.last;
-			bt->flag= UI_TEXT_LEFT;
+			bt = block->buttons.last;
+			bt->flag = UI_TEXT_LEFT;
 		}
 	}
 
 	/* inconsistent, but menus with labels do not look good flipped */
-	entry= md->items;
-	for(a=0; a<md->nitems; a++, entry++) {
-		if(entry->sepr && entry->str[0]) {
+	entry = md->items;
+	for (a = 0; a < md->nitems; a++, entry++) {
+		if (entry->sepr && entry->str[0]) {
 			block->flag |= UI_BLOCK_NO_FLIP;
 			break;
 		}
 	}
 
 	/* create items */
-	split= uiLayoutSplit(layout, 0, 0);
+	split = uiLayoutSplit(layout, 0, 0);
 
-	for(a=0; a<md->nitems; a++) {
-		if(a == column_end) {
+	for (a = 0; a < md->nitems; a++) {
+		if (a == column_end) {
 			/* start new column, and find out where it ends in advance, so we
-			   can flip the order of items properly per column */
-			column_start= a;
-			column_end= md->nitems;
+			 * can flip the order of items properly per column */
+			column_start = a;
+			column_end = md->nitems;
 
-			for(b=a+1; b<md->nitems; b++) {
-				entry= &md->items[b];
+			for (b = a + 1; b < md->nitems; b++) {
+				entry = &md->items[b];
 
 				/* new column on N rows or on separation label */
-				if(((b-a) % rows == 0) || (entry->sepr && entry->str[0])) {
+				if (((b - a) % rows == 0) || (entry->sepr && entry->str[0])) {
 					column_end = b;
 					break;
 				}
 			}
 
-			column= uiLayoutColumn(split, 0);
+			column = uiLayoutColumn(split, 0);
 		}
 
-		if(block->flag & UI_BLOCK_NO_FLIP)
-			entry= &md->items[a];
+		if (block->flag & UI_BLOCK_NO_FLIP)
+			entry = &md->items[a];
 		else
-			entry= &md->items[column_start + column_end-1-a];
+			entry = &md->items[column_start + column_end - 1 - a];
 
-		if(entry->sepr) {
+		if (entry->sepr) {
 			uiItemL(column, entry->str, entry->icon);
-			bt= block->buttons.last;
-			bt->flag= UI_TEXT_LEFT;
+			bt = block->buttons.last;
+			bt->flag = UI_TEXT_LEFT;
 		}
-		else if(entry->icon) {
-			uiDefIconTextButF(block, BUTM|FLO, B_NOP, entry->icon, entry->str, 0, 0,
-				UI_UNIT_X*5, UI_UNIT_Y, &handle->retvalue, (float) entry->retval, 0.0, 0, 0, "");
+		else if (entry->icon) {
+			uiDefIconTextButF(block, BUTM | FLO, B_NOP, entry->icon, entry->str, 0, 0,
+			                  UI_UNIT_X * 5, UI_UNIT_Y, &handle->retvalue, (float) entry->retval, 0.0, 0, 0, "");
 		}
 		else {
-			uiDefButF(block, BUTM|FLO, B_NOP, entry->str, 0, 0,
-				UI_UNIT_X*5, UI_UNIT_X, &handle->retvalue, (float) entry->retval, 0.0, 0, 0, "");
+			uiDefButF(block, BUTM | FLO, B_NOP, entry->str, 0, 0,
+			          UI_UNIT_X * 5, UI_UNIT_X, &handle->retvalue, (float) entry->retval, 0.0, 0, 0, "");
 		}
 	}
 	
@@ -1706,46 +1769,46 @@ static void ui_block_func_MENUSTR(bContext *UNUSED(C), uiLayout *layout, void *a
 
 void ui_block_func_ICONROW(bContext *UNUSED(C), uiLayout *layout, void *arg_but)
 {
-	uiBlock *block= uiLayoutGetBlock(layout);
-	uiPopupBlockHandle *handle= block->handle;
-	uiBut *but= arg_but;
+	uiBlock *block = uiLayoutGetBlock(layout);
+	uiPopupBlockHandle *handle = block->handle;
+	uiBut *but = arg_but;
 	int a;
 	
 	uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT);
 	
-	for(a=(int)but->hardmin; a<=(int)but->hardmax; a++)
-		uiDefIconButF(block, BUTM|FLO, B_NOP, but->icon+(a-but->hardmin), 0, 0, UI_UNIT_X*5, UI_UNIT_Y,
-			&handle->retvalue, (float)a, 0.0, 0, 0, "");
+	for (a = (int)but->hardmin; a <= (int)but->hardmax; a++)
+		uiDefIconButF(block, BUTM | FLO, B_NOP, but->icon + (a - but->hardmin), 0, 0, UI_UNIT_X * 5, UI_UNIT_Y,
+		              &handle->retvalue, (float)a, 0.0, 0, 0, "");
 }
 
 void ui_block_func_ICONTEXTROW(bContext *UNUSED(C), uiLayout *layout, void *arg_but)
 {
-	uiBlock *block= uiLayoutGetBlock(layout);
-	uiPopupBlockHandle *handle= block->handle;
-	uiBut *but= arg_but, *bt;
+	uiBlock *block = uiLayoutGetBlock(layout);
+	uiPopupBlockHandle *handle = block->handle;
+	uiBut *but = arg_but, *bt;
 	MenuData *md;
 	MenuEntry *entry;
 	int a;
 	
 	uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT);
 
-	md= decompose_menu_string(but->str);
+	md = decompose_menu_string(but->str);
 
 	/* title */
-	if(md->title) {
-		bt= uiDefBut(block, LABEL, 0, md->title, 0, 0, UI_UNIT_X*5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
-		bt->flag= UI_TEXT_LEFT;
+	if (md->title) {
+		bt = uiDefBut(block, LABEL, 0, md->title, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+		bt->flag = UI_TEXT_LEFT;
 	}
 
 	/* loop through the menu options and draw them out with icons & text labels */
-	for(a=0; a<md->nitems; a++) {
-		entry= &md->items[md->nitems-a-1];
+	for (a = 0; a < md->nitems; a++) {
+		entry = &md->items[md->nitems - a - 1];
 
-		if(entry->sepr)
+		if (entry->sepr)
 			uiItemS(layout);
 		else
-			uiDefIconTextButF(block, BUTM|FLO, B_NOP, (short)((but->icon)+(entry->retval-but->hardmin)), entry->str,
-				0, 0, UI_UNIT_X*5, UI_UNIT_Y, &handle->retvalue, (float) entry->retval, 0.0, 0, 0, "");
+			uiDefIconTextButF(block, BUTM | FLO, B_NOP, (short)((but->icon) + (entry->retval - but->hardmin)), entry->str,
+			                  0, 0, UI_UNIT_X * 5, UI_UNIT_Y, &handle->retvalue, (float) entry->retval, 0.0, 0, 0, "");
 	}
 
 	menudata_free(md);
@@ -1755,51 +1818,51 @@ void ui_block_func_ICONTEXTROW(bContext *UNUSED(C), uiLayout *layout, void *arg_
 static void ui_warp_pointer(int x, int y)
 {
 	/* XXX 2.50 which function to use for this? */
-	/* OSX has very poor mousewarp support, it sends events;
-	   this causes a menu being pressed immediately ... */
-	#ifndef __APPLE__
+	/* OSX has very poor mouse-warp support, it sends events;
+	 * this causes a menu being pressed immediately ... */
+#  ifndef __APPLE__
 	warp_pointer(x, y);
-	#endif
+#  endif
 }
 #endif
 
 /********************* Color Button ****************/
 
 /* picker sizes S hsize, F full size, D spacer, B button/pallette height  */
-#define SPICK	110.0
-#define FPICK	180.0
-#define DPICK	6.0
-#define BPICK	24.0
+#define SPICK   110.0
+#define FPICK   180.0
+#define DPICK   6.0
+#define BPICK   24.0
 
 /* for picker, while editing hsv */
 void ui_set_but_hsv(uiBut *but)
 {
 	float col[3];
-	float *hsv= ui_block_hsv_get(but->block);
+	float *hsv = ui_block_hsv_get(but->block);
 	
-	hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2);
+	hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col + 1, col + 2);
 	ui_set_but_vectorf(but, col);
 }
 
 /* also used by small picker, be careful with name checks below... */
-static void ui_update_block_buts_rgb(uiBlock *block, float *rgb)
+static void ui_update_block_buts_rgb(uiBlock *block, const float rgb[3])
 {
 	uiBut *bt;
-	float *hsv= ui_block_hsv_get(block);
+	float *hsv = ui_block_hsv_get(block);
 	
 	/* this is to keep the H and S value when V is equal to zero
 	 * and we are working in HSV mode, of course!
 	 */
-	rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+	rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv + 1, hsv + 2);
 	
 	// this updates button strings, is hackish... but button pointers are on stack of caller function
-	for(bt= block->buttons.first; bt; bt= bt->next) {
+	for (bt = block->buttons.first; bt; bt = bt->next) {
 		if (bt->rnaprop) {
 			
 			ui_set_but_vectorf(bt, rgb);
 			
 		}
-		else if(strcmp(bt->str, "Hex: ")==0) {
+		else if (strcmp(bt->str, "Hex: ") == 0) {
 			float rgb_gamma[3];
 			double intpart;
 			char col[16];
@@ -1808,7 +1871,8 @@ static void ui_update_block_buts_rgb(uiBlock *block, float *rgb)
 			
 			if (block->color_profile == BLI_PR_NONE) {
 				copy_v3_v3(rgb_gamma, rgb);
-			} else {
+			}
+			else {
 				/* make an sRGB version, for Hex code */
 				linearrgb_to_srgb_v3_v3(rgb_gamma, rgb);
 			}
@@ -1821,23 +1885,23 @@ static void ui_update_block_buts_rgb(uiBlock *block, float *rgb)
 			
 			strcpy(bt->poin, col);
 		}
-		else if(bt->str[1]==' ') {
-			if(bt->str[0]=='R') {
+		else if (bt->str[1] == ' ') {
+			if (bt->str[0] == 'R') {
 				ui_set_but_val(bt, rgb[0]);
 			}
-			else if(bt->str[0]=='G') {
+			else if (bt->str[0] == 'G') {
 				ui_set_but_val(bt, rgb[1]);
 			}
-			else if(bt->str[0]=='B') {
+			else if (bt->str[0] == 'B') {
 				ui_set_but_val(bt, rgb[2]);
 			}
-			else if(bt->str[0]=='H') {
+			else if (bt->str[0] == 'H') {
 				ui_set_but_val(bt, hsv[0]);
 			}
-			else if(bt->str[0]=='S') {
+			else if (bt->str[0] == 'S') {
 				ui_set_but_val(bt, hsv[1]);
 			}
-			else if(bt->str[0]=='V') {
+			else if (bt->str[0] == 'V') {
 				ui_set_but_val(bt, hsv[2]);
 			}
 		}		
@@ -1848,8 +1912,8 @@ static void ui_update_block_buts_rgb(uiBlock *block, float *rgb)
 
 static void do_picker_rna_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
 {
-	uiBut *but= (uiBut *)bt1;
-	uiPopupBlockHandle *popup= but->block->handle;
+	uiBut *but = (uiBut *)bt1;
+	uiPopupBlockHandle *popup = but->block->handle;
 	PropertyRNA *prop = but->rnaprop;
 	PointerRNA ptr = but->rnapoin;
 	float rgb[4];
@@ -1859,33 +1923,33 @@ static void do_picker_rna_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
 		ui_update_block_buts_rgb(but->block, rgb);
 	}
 	
-	if(popup)
-		popup->menuretval= UI_RETURN_UPDATE;
+	if (popup)
+		popup->menuretval = UI_RETURN_UPDATE;
 }
 
 static void do_hsv_rna_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
 {
-	uiBut *but= (uiBut *)bt1;
-	uiPopupBlockHandle *popup= but->block->handle;
+	uiBut *but = (uiBut *)bt1;
+	uiPopupBlockHandle *popup = but->block->handle;
 	float rgb[3];
-	float *hsv= ui_block_hsv_get(but->block);
+	float *hsv = ui_block_hsv_get(but->block);
 	
-	hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb+1, rgb+2);
+	hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb + 1, rgb + 2);
 	
 	ui_update_block_buts_rgb(but->block, rgb);
 	
-	if(popup)
-		popup->menuretval= UI_RETURN_UPDATE;
+	if (popup)
+		popup->menuretval = UI_RETURN_UPDATE;
 }
 
 static void do_hex_rna_cb(bContext *UNUSED(C), void *bt1, void *hexcl)
 {
-	uiBut *but= (uiBut *)bt1;
-	uiPopupBlockHandle *popup= but->block->handle;
-	char *hexcol= (char *)hexcl;
+	uiBut *but = (uiBut *)bt1;
+	uiPopupBlockHandle *popup = but->block->handle;
+	char *hexcol = (char *)hexcl;
 	float rgb[3];
 	
-	hex_to_rgb(hexcol, rgb, rgb+1, rgb+2);
+	hex_to_rgb(hexcol, rgb, rgb + 1, rgb + 2);
 	
 	/* Hex code is assumed to be in sRGB space (coming from other applications, web, etc) */
 	if (but->block->color_profile != BLI_PR_NONE) {
@@ -1895,17 +1959,17 @@ static void do_hex_rna_cb(bContext *UNUSED(C), void *bt1, void *hexcl)
 	
 	ui_update_block_buts_rgb(but->block, rgb);
 	
-	if(popup)
-		popup->menuretval= UI_RETURN_UPDATE;
+	if (popup)
+		popup->menuretval = UI_RETURN_UPDATE;
 }
 
 static void close_popup_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
 {
-	uiBut *but= (uiBut *)bt1;
-	uiPopupBlockHandle *popup= but->block->handle;
+	uiBut *but = (uiBut *)bt1;
+	uiPopupBlockHandle *popup = but->block->handle;
 	
-	if(popup)
-		popup->menuretval= UI_RETURN_OK;
+	if (popup)
+		popup->menuretval = UI_RETURN_OK;
 }
 
 static void picker_new_hide_reveal(uiBlock *block, short colormode)
@@ -1913,26 +1977,26 @@ static void picker_new_hide_reveal(uiBlock *block, short colormode)
 	uiBut *bt;
 	
 	/* tag buttons */
-	for(bt= block->buttons.first; bt; bt= bt->next) {
+	for (bt = block->buttons.first; bt; bt = bt->next) {
 		
 		if (bt->type == LABEL) {
-			if( bt->str[1]=='G') {
-				if(colormode==2) bt->flag &= ~UI_HIDDEN;
+			if (bt->str[1] == 'G') {
+				if (colormode == 2) bt->flag &= ~UI_HIDDEN;
 				else bt->flag |= UI_HIDDEN;
 			}
 		}
 		
-		if(bt->type==NUMSLI || bt->type==TEX) {
-			if( bt->str[1]=='e') {
-				if(colormode==2) bt->flag &= ~UI_HIDDEN;
+		if (bt->type == NUMSLI || bt->type == TEX) {
+			if (bt->str[1] == 'e') {
+				if (colormode == 2) bt->flag &= ~UI_HIDDEN;
 				else bt->flag |= UI_HIDDEN;
 			}
-			else if( ELEM3(bt->str[0], 'R', 'G', 'B')) {
-				if(colormode==0) bt->flag &= ~UI_HIDDEN;
+			else if (ELEM3(bt->str[0], 'R', 'G', 'B')) {
+				if (colormode == 0) bt->flag &= ~UI_HIDDEN;
 				else bt->flag |= UI_HIDDEN;
 			}
-			else if( ELEM3(bt->str[0], 'H', 'S', 'V')) {
-				if(colormode==1) bt->flag &= ~UI_HIDDEN;
+			else if (ELEM3(bt->str[0], 'H', 'S', 'V')) {
+				if (colormode == 1) bt->flag &= ~UI_HIDDEN;
 				else bt->flag |= UI_HIDDEN;
 			}
 		}
@@ -1941,32 +2005,32 @@ static void picker_new_hide_reveal(uiBlock *block, short colormode)
 
 static void do_picker_new_mode_cb(bContext *UNUSED(C), void *bt1, void *UNUSED(arg))
 {
-	uiBut *bt= bt1;
-	short colormode= ui_get_but_val(bt);
+	uiBut *bt = bt1;
+	short colormode = ui_get_but_val(bt);
 	picker_new_hide_reveal(bt->block, colormode);
 }
 
 /* picker sizes S hsize, F full size, D spacer, B button/pallette height  */
-#define SPICK1	150.0
-#define DPICK1	6.0
+#define SPICK1  150.0
+#define DPICK1  6.0
 
-#define PICKER_H	150
-#define PICKER_W	150
-#define PICKER_SPACE	6
-#define PICKER_BAR		14
+#define PICKER_H    150
+#define PICKER_W    150
+#define PICKER_SPACE    6
+#define PICKER_BAR      14
 
-#define PICKER_TOTAL_W	(PICKER_W+PICKER_SPACE+PICKER_BAR)
+#define PICKER_TOTAL_W  (PICKER_W + PICKER_SPACE + PICKER_BAR)
 
 static void circle_picker(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop)
 {
 	uiBut *bt;
 	
 	/* HS circle */
-	bt= uiDefButR_prop(block, HSVCIRCLE, 0, "",	0, 0, PICKER_H, PICKER_W, ptr, prop, 0, 0.0, 0.0, 0, 0, "Color");
+	bt = uiDefButR_prop(block, HSVCIRCLE, 0, "", 0, 0, PICKER_H, PICKER_W, ptr, prop, 0, 0.0, 0.0, 0, 0, "Color");
 	uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
 	
 	/* value */
-	bt= uiDefButR_prop(block, HSVCUBE, 0, "", PICKER_W+PICKER_SPACE,0,PICKER_BAR,PICKER_H, ptr, prop, 0, 0.0, 0.0, UI_GRAD_V_ALT, 0, "Value");
+	bt = uiDefButR_prop(block, HSVCUBE, 0, "", PICKER_W + PICKER_SPACE, 0, PICKER_BAR, PICKER_H, ptr, prop, 0, 0.0, 0.0, UI_GRAD_V_ALT, 0, "Value");
 	uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
 }
 
@@ -1977,47 +2041,49 @@ static void square_picker(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, in
 	int bartype = type + 3;
 	
 	/* HS square */
-	bt= uiDefButR_prop(block, HSVCUBE, 0, "",	0, PICKER_BAR+PICKER_SPACE, PICKER_TOTAL_W, PICKER_H, ptr, prop, 0, 0.0, 0.0, type, 0, "Color");
+	bt = uiDefButR_prop(block, HSVCUBE, 0, "",   0, PICKER_BAR + PICKER_SPACE, PICKER_TOTAL_W, PICKER_H, ptr, prop, 0, 0.0, 0.0, type, 0, "Color");
 	uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
 	
 	/* value */
-	bt= uiDefButR_prop(block, HSVCUBE, 0, "",		0, 0, PICKER_TOTAL_W, PICKER_BAR, ptr, prop, 0, 0.0, 0.0, bartype, 0, "Value");
+	bt = uiDefButR_prop(block, HSVCUBE, 0, "",       0, 0, PICKER_TOTAL_W, PICKER_BAR, ptr, prop, 0, 0.0, 0.0, bartype, 0, "Value");
 	uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
 }
 
 
 /* a HS circle, V slider, rgb/hsv/hex sliders */
-static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyRNA *prop)
+static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, PropertyRNA *prop)
 {
-	static short colormode= 0;	/* temp? 0=rgb, 1=hsv, 2=hex */
+	static short colormode = 0;  /* temp? 0=rgb, 1=hsv, 2=hex */
 	uiBut *bt;
 	int width, butwidth;
 	static char tip[50];
 	static char hexcol[128];
 	float rgb_gamma[3];
 	float min, max, step, precision;
-	float *hsv= ui_block_hsv_get(block);
+	float *hsv = ui_block_hsv_get(block);
 	
 	ui_block_hsv_get(block);
 	
-	width= PICKER_TOTAL_W;
+	width = PICKER_TOTAL_W;
 	butwidth = width - UI_UNIT_X - 10;
 	
 	/* existence of profile means storage is in linear color space, with display correction */
+	/* XXX That tip message is not use anywhere! */
 	if (block->color_profile == BLI_PR_NONE) {
-		BLI_strncpy(tip, "Value in Display Color Space", sizeof(tip));
-		copy_v3_v3(rgb_gamma, rgb);
-	} else {
-		BLI_strncpy(tip, "Value in Linear RGB Color Space", sizeof(tip));
+		BLI_strncpy(tip, N_("Value in Display Color Space"), sizeof(tip));
+		copy_v3_v3(rgb_gamma, rgba);
+	}
+	else {
+		BLI_strncpy(tip, N_("Value in Linear RGB Color Space"), sizeof(tip));
 		/* make an sRGB version, for Hex code */
-		linearrgb_to_srgb_v3_v3(rgb_gamma, rgb);
+		linearrgb_to_srgb_v3_v3(rgb_gamma, rgba);
 	}
 	
 	/* sneaky way to check for alpha */
-	rgb[3]= FLT_MAX;
+	rgba[3] = FLT_MAX;
 
 	RNA_property_float_ui_range(ptr, prop, &min, &max, &step, &precision);
-	RNA_property_float_get_array(ptr, prop, rgb);
+	RNA_property_float_get_array(ptr, prop, rgba);
 
 	switch (U.color_picker_type) {
 		case USER_CP_CIRCLE:
@@ -2036,24 +2102,24 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR
 	
 	/* mode */
 	uiBlockBeginAlign(block);
-	bt= uiDefButS(block, ROW, 0, "RGB",	0, -30, width/3, UI_UNIT_Y, &colormode, 0.0, 0.0, 0, 0, "");
+	bt = uiDefButS(block, ROW, 0, IFACE_("RGB"), 0, -30, width / 3, UI_UNIT_Y, &colormode, 0.0, 0.0, 0, 0, "");
 	uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL);
-	bt= uiDefButS(block, ROW, 0, "HSV",	width/3, -30, width/3, UI_UNIT_Y, &colormode, 0.0, 1.0, 0, 0, "");
+	bt = uiDefButS(block, ROW, 0, IFACE_("HSV"), width / 3, -30, width / 3, UI_UNIT_Y, &colormode, 0.0, 1.0, 0, 0, "");
 	uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL);
-	bt= uiDefButS(block, ROW, 0, "Hex",	2*width/3, -30, width/3, UI_UNIT_Y, &colormode, 0.0, 2.0, 0, 0, "");
+	bt = uiDefButS(block, ROW, 0, IFACE_("Hex"), 2 * width / 3, -30, width / 3, UI_UNIT_Y, &colormode, 0.0, 2.0, 0, 0, "");
 	uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL);
 	uiBlockEndAlign(block);
 
-	bt= uiDefIconButO(block, BUT, "UI_OT_eyedropper", WM_OP_INVOKE_DEFAULT, ICON_EYEDROPPER, butwidth+10, -60, UI_UNIT_X, UI_UNIT_Y, NULL);
+	bt = uiDefIconButO(block, BUT, "UI_OT_eyedropper", WM_OP_INVOKE_DEFAULT, ICON_EYEDROPPER, butwidth + 10, -60, UI_UNIT_X, UI_UNIT_Y, NULL);
 	uiButSetFunc(bt, close_popup_cb, bt, NULL);
 	
 	/* RGB values */
 	uiBlockBeginAlign(block);
-	bt= uiDefButR_prop(block, NUMSLI, 0, "R ",	0, -60, butwidth, UI_UNIT_Y, ptr, prop, 0, 0.0, 0.0, 0, 3, "Red");
+	bt = uiDefButR_prop(block, NUMSLI, 0, IFACE_("R "),  0, -60, butwidth, UI_UNIT_Y, ptr, prop, 0, 0.0, 0.0, 0, 3, TIP_("Red"));
 	uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
-	bt= uiDefButR_prop(block, NUMSLI, 0, "G ",	0, -80, butwidth, UI_UNIT_Y, ptr, prop, 1, 0.0, 0.0, 0, 3, "Green");
+	bt = uiDefButR_prop(block, NUMSLI, 0, IFACE_("G "),  0, -80, butwidth, UI_UNIT_Y, ptr, prop, 1, 0.0, 0.0, 0, 3, TIP_("Green"));
 	uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
-	bt= uiDefButR_prop(block, NUMSLI, 0, "B ",	0, -100, butwidth, UI_UNIT_Y, ptr, prop, 2, 0.0, 0.0, 0, 3, "Blue");
+	bt = uiDefButR_prop(block, NUMSLI, 0, IFACE_("B "),  0, -100, butwidth, UI_UNIT_Y, ptr, prop, 2, 0.0, 0.0, 0, 3, TIP_("Blue"));
 	uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
 
 	// could use uiItemFullR(col, ptr, prop, -1, 0, UI_ITEM_R_EXPAND|UI_ITEM_R_SLIDER, "", ICON_NONE);
@@ -2061,29 +2127,29 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR
 	
 	/* HSV values */
 	uiBlockBeginAlign(block);
-	bt= uiDefButF(block, NUMSLI, 0, "H ",	0, -60, butwidth, UI_UNIT_Y, hsv, 0.0, 1.0, 10, 3, "Hue");
+	bt = uiDefButF(block, NUMSLI, 0, IFACE_("H "),   0, -60, butwidth, UI_UNIT_Y, hsv, 0.0, 1.0, 10, 3, TIP_("Hue"));
 	uiButSetFunc(bt, do_hsv_rna_cb, bt, hsv);
-	bt= uiDefButF(block, NUMSLI, 0, "S ",	0, -80, butwidth, UI_UNIT_Y, hsv+1, 0.0, 1.0, 10, 3, "Saturation");
+	bt = uiDefButF(block, NUMSLI, 0, IFACE_("S "),   0, -80, butwidth, UI_UNIT_Y, hsv + 1, 0.0, 1.0, 10, 3, TIP_("Saturation"));
 	uiButSetFunc(bt, do_hsv_rna_cb, bt, hsv);
-	bt= uiDefButF(block, NUMSLI, 0, "V ",	0, -100, butwidth, UI_UNIT_Y, hsv+2, 0.0, max, 10, 3, "Value");
+	bt = uiDefButF(block, NUMSLI, 0, IFACE_("V "),   0, -100, butwidth, UI_UNIT_Y, hsv + 2, 0.0, max, 10, 3, TIP_("Value"));
 	uiButSetFunc(bt, do_hsv_rna_cb, bt, hsv);
 	uiBlockEndAlign(block);
 
-	if(rgb[3] != FLT_MAX) {
-		bt= uiDefButR_prop(block, NUMSLI, 0, "A ",	0, -120, butwidth, UI_UNIT_Y, ptr, prop, 3, 0.0, 0.0, 0, 0, "Alpha");
+	if (rgba[3] != FLT_MAX) {
+		bt = uiDefButR_prop(block, NUMSLI, 0, IFACE_("A "),  0, -120, butwidth, UI_UNIT_Y, ptr, prop, 3, 0.0, 0.0, 0, 0, TIP_("Alpha"));
 		uiButSetFunc(bt, do_picker_rna_cb, bt, NULL);
 	}
 	else {
-		rgb[3]= 1.0f;
+		rgba[3] = 1.0f;
 	}
 
 	BLI_snprintf(hexcol, sizeof(hexcol), "%02X%02X%02X", FTOCHAR(rgb_gamma[0]), FTOCHAR(rgb_gamma[1]), FTOCHAR(rgb_gamma[2]));
 
-	bt= uiDefBut(block, TEX, 0, "Hex: ", 0, -60, butwidth, UI_UNIT_Y, hexcol, 0, 8, 0, 0, "Hex triplet for color (#RRGGBB)");
+	bt = uiDefBut(block, TEX, 0, IFACE_("Hex: "), 0, -60, butwidth, UI_UNIT_Y, hexcol, 0, 8, 0, 0, TIP_("Hex triplet for color (#RRGGBB)"));
 	uiButSetFunc(bt, do_hex_rna_cb, bt, hexcol);
-	uiDefBut(block, LABEL, 0, "(Gamma Corrected)", 0, -80, butwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+	uiDefBut(block, LABEL, 0, IFACE_("(Gamma Corrected)"), 0, -80, butwidth, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
 
-	rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+	rgb_to_hsv(rgba[0], rgba[1], rgba[2], hsv, hsv + 1, hsv + 2);
 
 	picker_new_hide_reveal(block, colormode);
 }
@@ -2091,33 +2157,33 @@ static void uiBlockPicker(uiBlock *block, float *rgb, PointerRNA *ptr, PropertyR
 
 static int ui_picker_small_wheel_cb(const bContext *UNUSED(C), uiBlock *block, wmEvent *event)
 {
-	float add= 0.0f;
+	float add = 0.0f;
 	
-	if(event->type==WHEELUPMOUSE)
-		add= 0.05f;
-	else if(event->type==WHEELDOWNMOUSE)
-		add= -0.05f;
+	if (event->type == WHEELUPMOUSE)
+		add = 0.05f;
+	else if (event->type == WHEELDOWNMOUSE)
+		add = -0.05f;
 	
-	if(add!=0.0f) {
+	if (add != 0.0f) {
 		uiBut *but;
 		
-		for(but= block->buttons.first; but; but= but->next) {
-			if(but->type==HSVCUBE && but->active==NULL) {
-				uiPopupBlockHandle *popup= block->handle;
+		for (but = block->buttons.first; but; but = but->next) {
+			if (but->type == HSVCUBE && but->active == NULL) {
+				uiPopupBlockHandle *popup = block->handle;
 				float col[3];
-				float *hsv= ui_block_hsv_get(block);
+				float *hsv = ui_block_hsv_get(block);
 				
 				ui_get_but_vectorf(but, col);
 				
-				rgb_to_hsv_compat(col[0], col[1], col[2], hsv, hsv+1, hsv+2);
-				hsv[2]= CLAMPIS(hsv[2]+add, 0.0f, 1.0f);
-				hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2);
+				rgb_to_hsv_compat(col[0], col[1], col[2], hsv, hsv + 1, hsv + 2);
+				hsv[2] = CLAMPIS(hsv[2] + add, 0.0f, 1.0f);
+				hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col + 1, col + 2);
 
 				ui_set_but_vectorf(but, col);
 				
 				ui_update_block_buts_rgb(block, col);
-				if(popup)
-					popup->menuretval= UI_RETURN_UPDATE;
+				if (popup)
+					popup->menuretval = UI_RETURN_UPDATE;
 				
 				return 1;
 			}
@@ -2128,10 +2194,10 @@ static int ui_picker_small_wheel_cb(const bContext *UNUSED(C), uiBlock *block, w
 
 uiBlock *ui_block_func_COL(bContext *C, uiPopupBlockHandle *handle, void *arg_but)
 {
-	uiBut *but= arg_but;
+	uiBut *but = arg_but;
 	uiBlock *block;
 	
-	block= uiBeginBlock(C, handle->region, __func__, UI_EMBOSS);
+	block = uiBeginBlock(C, handle->region, __func__, UI_EMBOSS);
 	
 	if (but->rnaprop) {
 		if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) {
@@ -2145,13 +2211,13 @@ uiBlock *ui_block_func_COL(bContext *C, uiPopupBlockHandle *handle, void *arg_bu
 	
 	uiBlockPicker(block, handle->retvec, &but->rnapoin, but->rnaprop);
 	
-	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;
 	uiBoundsBlock(block, 10);
 	
-	block->block_event_func= ui_picker_small_wheel_cb;
+	block->block_event_func = ui_picker_small_wheel_cb;
 	
 	/* and lets go */
-	block->direction= UI_TOP;
+	block->direction = UI_TOP;
 	
 	return block;
 }
@@ -2162,11 +2228,11 @@ static int ui_popup_string_hash(char *str)
 {
 	/* sometimes button contains hotkey, sometimes not, strip for proper compare */
 	int hash;
-	char *delimit= strchr(str, '|');
+	char *delimit = strchr(str, '|');
 
-	if(delimit) *delimit= 0;
-	hash= BLI_ghashutil_strhash(str);
-	if(delimit) *delimit= '|';
+	if (delimit) *delimit = 0;
+	hash = BLI_ghashutil_strhash(str);
+	if (delimit) *delimit = '|';
 
 	return hash;
 }
@@ -2179,24 +2245,24 @@ static int ui_popup_menu_hash(const char *str)
 /* but == NULL read, otherwise set */
 uiBut *ui_popup_menu_memory(uiBlock *block, uiBut *but)
 {
-	static int mem[256], first=1;
-	int hash= block->puphash;
+	static int mem[256], first = 1;
+	int hash = block->puphash;
 	
-	if(first) {
+	if (first) {
 		/* init */
 		memset(mem, -1, sizeof(mem));
-		first= 0;
+		first = 0;
 	}
 
-	if(but) {
+	if (but) {
 		/* set */
-		mem[hash & 255 ]= ui_popup_string_hash(but->str);
+		mem[hash & 255] = ui_popup_string_hash(but->str);
 		return NULL;
 	}
 	else {
 		/* get */
-		for(but=block->buttons.first; but; but=but->next)
-			if(ui_popup_string_hash(but->str) == mem[hash & 255])
+		for (but = block->buttons.first; but; but = but->next)
+			if (ui_popup_string_hash(but->str) == mem[hash & 255])
 				return but;
 
 		return NULL;
@@ -2221,93 +2287,94 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
 {
 	uiBlock *block;
 	uiBut *bt;
-	uiPopupMenu *pup= arg_pup;
+	uiPopupMenu *pup = arg_pup;
 	int offset[2], direction, minwidth, width, height, flip;
 
-	if(pup->menu_func) {
-		pup->block->handle= handle;
+	if (pup->menu_func) {
+		pup->block->handle = handle;
 		pup->menu_func(C, pup->layout, pup->menu_arg);
-		pup->block->handle= NULL;
+		pup->block->handle = NULL;
 	}
 
-	if(pup->but) {
+	if (pup->but) {
 		/* minimum width to enforece */
-		minwidth= pup->but->x2 - pup->but->x1;
+		minwidth = pup->but->x2 - pup->but->x1;
 
-		if(pup->but->type == PULLDOWN || pup->but->menu_create_func) {
-			direction= UI_DOWN;
-			flip= 1;
+		if (pup->but->type == PULLDOWN || pup->but->menu_create_func) {
+			direction = UI_DOWN;
+			flip = 1;
 		}
 		else {
-			direction= UI_TOP;
-			flip= 0;
+			direction = UI_TOP;
+			flip = 0;
 		}
 	}
 	else {
-		minwidth= 50;
-		direction= UI_DOWN;
-		flip= 1;
+		minwidth = 50;
+		direction = UI_DOWN;
+		flip = 1;
 	}
 
-	block= pup->block;
+	block = pup->block;
 	
 	/* in some cases we create the block before the region,
-	   so we set it delayed here if necessary */
-	if(BLI_findindex(&handle->region->uiblocks, block) == -1)
+	 * so we set it delayed here if necessary */
+	if (BLI_findindex(&handle->region->uiblocks, block) == -1)
 		uiBlockSetRegion(block, handle->region);
 
-	block->direction= direction;
+	block->direction = direction;
 
 	uiBlockLayoutResolve(block, &width, &height);
 
 	uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT);
 	
-	if(pup->popup) {
-		uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_NUMSELECT|UI_BLOCK_RET_1);
+	if (pup->popup) {
+		uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_NUMSELECT | UI_BLOCK_RET_1);
 		uiBlockSetDirection(block, direction);
 
 		/* offset the mouse position, possibly based on earlier selection */
-		if((block->flag & UI_BLOCK_POPUP_MEMORY) &&
-			(bt= ui_popup_menu_memory(block, NULL))) {
+		if ((block->flag & UI_BLOCK_POPUP_MEMORY) &&
+		    (bt = ui_popup_menu_memory(block, NULL)))
+		{
 			/* position mouse on last clicked item, at 0.8*width of the
-			   button, so it doesn't overlap the text too much, also note
-			   the offset is negative because we are inverse moving the
-			   block to be under the mouse */
-			offset[0]= -(bt->x1 + 0.8f*(bt->x2 - bt->x1));
-			offset[1]= -(bt->y1 + 0.5f*UI_UNIT_Y);
+			 * button, so it doesn't overlap the text too much, also note
+			 * the offset is negative because we are inverse moving the
+			 * block to be under the mouse */
+			offset[0] = -(bt->x1 + 0.8f * (bt->x2 - bt->x1));
+			offset[1] = -(bt->y1 + 0.5f * UI_UNIT_Y);
 		}
 		else {
 			/* position mouse at 0.8*width of the button and below the tile
-			   on the first item */
-			offset[0]= 0;
-			for(bt=block->buttons.first; bt; bt=bt->next)
-				offset[0]= MIN2(offset[0], -(bt->x1 + 0.8f*(bt->x2 - bt->x1)));
+			 * on the first item */
+			offset[0] = 0;
+			for (bt = block->buttons.first; bt; bt = bt->next)
+				offset[0] = MIN2(offset[0], -(bt->x1 + 0.8f * (bt->x2 - bt->x1)));
 
-			offset[1]= 1.5*UI_UNIT_Y;
+			offset[1] = 1.5 * UI_UNIT_Y;
 		}
 
-		block->minbounds= minwidth;
+		block->minbounds = minwidth;
 		uiMenuPopupBoundsBlock(block, 1, offset[0], offset[1]);
 	}
 	else {
 		/* for a header menu we set the direction automatic */
-		if(!pup->slideout && flip) {
-			ScrArea *sa= CTX_wm_area(C);
-			if(sa && sa->headertype==HEADERDOWN) {
-				ARegion *ar= CTX_wm_region(C);
-				if(ar && ar->regiontype == RGN_TYPE_HEADER) {
+		if (!pup->slideout && flip) {
+			ScrArea *sa = CTX_wm_area(C);
+			if (sa && sa->headertype == HEADERDOWN) {
+				ARegion *ar = CTX_wm_region(C);
+				if (ar && ar->regiontype == RGN_TYPE_HEADER) {
 					uiBlockSetDirection(block, UI_TOP);
 					uiBlockFlipOrder(block);
 				}
 			}
 		}
 
-		block->minbounds= minwidth;
+		block->minbounds = minwidth;
 		uiTextBoundsBlock(block, 50);
 	}
 
 	/* if menu slides out of other menu, override direction */
-	if(pup->slideout)
+	if (pup->slideout)
 		uiBlockSetDirection(block, UI_RIGHT);
 
 	uiEndBlock(C, block);
@@ -2317,53 +2384,55 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi
 
 uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut *but, uiMenuCreateFunc menu_func, void *arg, char *str)
 {
-	wmWindow *window= CTX_wm_window(C);
-	uiStyle *style= UI_GetStyle();
+	wmWindow *window = CTX_wm_window(C);
+	uiStyle *style = UI_GetStyle();
 	uiPopupBlockHandle *handle;
 	uiPopupMenu *pup;
-	pup= MEM_callocN(sizeof(uiPopupMenu), __func__);
-	pup->block= uiBeginBlock(C, NULL, __func__, UI_EMBOSSP);
-	pup->layout= uiBlockLayout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, style);
-	pup->slideout= (but && (but->block->flag & UI_BLOCK_LOOP));
-	pup->but= but;
+	pup = MEM_callocN(sizeof(uiPopupMenu), __func__);
+	pup->block = uiBeginBlock(C, NULL, __func__, UI_EMBOSSP);
+	pup->layout = uiBlockLayout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, style);
+	pup->slideout = (but && (but->block->flag & UI_BLOCK_LOOP));
+	pup->but = but;
 	uiLayoutSetOperatorContext(pup->layout, WM_OP_INVOKE_REGION_WIN);
 
-	if(!but) {
+	if (!but) {
 		/* no button to start from, means we are a popup */
-		pup->mx= window->eventstate->x;
-		pup->my= window->eventstate->y;
-		pup->popup= 1;
+		pup->mx = window->eventstate->x;
+		pup->my = window->eventstate->y;
+		pup->popup = 1;
 		pup->block->flag |= UI_BLOCK_NO_FLIP;
 	}
 	/* some enums reversing is strange, currently we have no good way to
 	 * reverse some enum's but not others, so reverse all so the first menu
 	 * items are always close to the mouse cursor */
-#if 0
 	else {
+#if 0
 		/* if this is an rna button then we can assume its an enum
 		 * flipping enums is generally not good since the order can be
 		 * important [#28786] */
-		if(but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) {
+		if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) {
 			pup->block->flag |= UI_BLOCK_NO_FLIP;
 		}
-	}
 #endif
+		if (but->context)
+			uiLayoutContextCopy(pup->layout, but->context);
+	}
 
-	if(str) {
+	if (str) {
 		/* menu is created from a string */
-		pup->menu_func= ui_block_func_MENUSTR;
-		pup->menu_arg= str;
+		pup->menu_func = ui_block_func_MENUSTR;
+		pup->menu_arg = str;
 	}
 	else {
 		/* menu is created from a callback */
-		pup->menu_func= menu_func;
-		pup->menu_arg= arg;
+		pup->menu_func = menu_func;
+		pup->menu_arg = arg;
 	}
 	
-	handle= ui_popup_block_create(C, butregion, but, NULL, ui_block_func_POPUP, pup);
+	handle = ui_popup_block_create(C, butregion, but, NULL, ui_block_func_POPUP, pup);
 
-	if(!but) {
-		handle->popup= 1;
+	if (!but) {
+		handle->popup = 1;
 
 		UI_add_popup_handlers(C, &window->modalhandlers, handle);
 		WM_event_add_mousemove(C);
@@ -2379,30 +2448,30 @@ uiPopupBlockHandle *ui_popup_menu_create(bContext *C, ARegion *butregion, uiBut
 /* only return handler, and set optional title */
 uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon)
 {
-	uiStyle *style= UI_GetStyle();
-	uiPopupMenu *pup= MEM_callocN(sizeof(uiPopupMenu), "popup menu");
+	uiStyle *style = UI_GetStyle();
+	uiPopupMenu *pup = MEM_callocN(sizeof(uiPopupMenu), "popup menu");
 	uiBut *but;
 	
-	pup->block= uiBeginBlock(C, NULL, __func__, UI_EMBOSSP);
+	pup->block = uiBeginBlock(C, NULL, __func__, UI_EMBOSSP);
 	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);
+	pup->block->puphash = ui_popup_menu_hash(title);
+	pup->layout = uiBlockLayout(pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, style);
 	uiLayoutSetOperatorContext(pup->layout, WM_OP_EXEC_REGION_WIN);
 
 	/* create in advance so we can let buttons point to retval already */
-	pup->block->handle= MEM_callocN(sizeof(uiPopupBlockHandle), "uiPopupBlockHandle");
+	pup->block->handle = MEM_callocN(sizeof(uiPopupBlockHandle), "uiPopupBlockHandle");
 	
 	/* create title button */
-	if(title && title[0]) {
+	if (title && title[0]) {
 		char titlestr[256];
 		
-		if(icon) {
+		if (icon) {
 			BLI_snprintf(titlestr, sizeof(titlestr), " %s", title);
 			uiDefIconTextBut(pup->block, LABEL, 0, icon, titlestr, 0, 0, 200, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
 		}
 		else {
-			but= uiDefBut(pup->block, LABEL, 0, title, 0, 0, 200, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
-			but->flag= UI_TEXT_LEFT;
+			but = uiDefBut(pup->block, LABEL, 0, title, 0, 0, 200, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "");
+			but->flag = UI_TEXT_LEFT;
 		}
 	}
 
@@ -2412,15 +2481,15 @@ uiPopupMenu *uiPupMenuBegin(bContext *C, const char *title, int icon)
 /* set the whole structure to work */
 void uiPupMenuEnd(bContext *C, uiPopupMenu *pup)
 {
-	wmWindow *window= CTX_wm_window(C);
+	wmWindow *window = CTX_wm_window(C);
 	uiPopupBlockHandle *menu;
 	
-	pup->popup= 1;
-	pup->mx= window->eventstate->x;
-	pup->my= window->eventstate->y;
+	pup->popup = 1;
+	pup->mx = window->eventstate->x;
+	pup->my = window->eventstate->y;
 	
-	menu= ui_popup_block_create(C, NULL, NULL, NULL, ui_block_func_POPUP, pup);
-	menu->popup= 1;
+	menu = ui_popup_block_create(C, NULL, NULL, NULL, ui_block_func_POPUP, pup);
+	menu->popup = 1;
 	
 	UI_add_popup_handlers(C, &window->modalhandlers, menu);
 	WM_event_add_mousemove(C);
@@ -2437,17 +2506,17 @@ uiLayout *uiPupMenuLayout(uiPopupMenu *pup)
 
 static void operator_name_cb(bContext *C, void *arg, int retval)
 {
-	const char *opname= arg;
+	const char *opname = arg;
 
-	if(opname && retval > 0)
+	if (opname && retval > 0)
 		WM_operator_name_call(C, opname, WM_OP_EXEC_DEFAULT, NULL);
 }
 
 static void operator_cb(bContext *C, void *arg, int retval)
 {
-	wmOperator *op= arg;
+	wmOperator *op = arg;
 	
-	if(op && retval > 0)
+	if (op && retval > 0)
 		WM_operator_call(C, op);
 	else
 		WM_operator_free(op);
@@ -2463,15 +2532,15 @@ static void vconfirm_opname(bContext *C, const char *opname, const char *title,
 	uiPopupBlockHandle *handle;
 	char *s, buf[512];
 
-	s= buf;
-	if (title) s+= sprintf(s, "%s%%t|", title);
+	s = buf;
+	if (title) s += sprintf(s, "%s%%t|", title);
 	vsnprintf(s, sizeof(buf) - (s - buf), itemfmt, ap);
-	buf[sizeof(buf) - 1]= '\0';
+	buf[sizeof(buf) - 1] = '\0';
 
-	handle= ui_popup_menu_create(C, NULL, NULL, NULL, NULL, buf);
+	handle = ui_popup_menu_create(C, NULL, NULL, NULL, NULL, buf);
 
-	handle->popup_func= operator_name_cb;
-	handle->popup_arg= (void *)opname;
+	handle->popup_func = operator_name_cb;
+	handle->popup_arg = (void *)opname;
 }
 
 static void confirm_operator(bContext *C, wmOperator *op, const char *title, const char *item)
@@ -2479,15 +2548,15 @@ static void confirm_operator(bContext *C, wmOperator *op, const char *title, con
 	uiPopupBlockHandle *handle;
 	char *s, buf[512];
 	
-	s= buf;
-	if (title) s+= BLI_snprintf(s, sizeof(buf), "%s%%t|%s", title, item);
+	s = buf;
+	if (title) s += BLI_snprintf(s, sizeof(buf), "%s%%t|%s", title, item);
 	(void)s;
 	
-	handle= ui_popup_menu_create(C, NULL, NULL, NULL, NULL, buf);
+	handle = ui_popup_menu_create(C, NULL, NULL, NULL, NULL, buf);
 
-	handle->popup_func= operator_cb;
-	handle->popup_arg= op;
-	handle->cancel_func= confirm_cancel_operator;
+	handle->popup_func = operator_cb;
+	handle->popup_arg = op;
+	handle->cancel_func = confirm_cancel_operator;
 }
 
 void uiPupMenuOkee(bContext *C, const char *opname, const char *str, ...)
@@ -2542,26 +2611,26 @@ void uiPupMenuReports(bContext *C, ReportList *reports)
 	DynStr *ds;
 	char *str;
 
-	if(!reports || !reports->list.first)
+	if (!reports || !reports->list.first)
 		return;
-	if(!CTX_wm_window(C))
+	if (!CTX_wm_window(C))
 		return;
 
-	ds= BLI_dynstr_new();
+	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)
+	for (report = reports->list.first; report; report = report->next) {
+		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);
-	if(str[0] != '\0')
+	str = BLI_dynstr_get_cstring(ds);
+	if (str[0] != '\0')
 		ui_popup_menu_create(C, NULL, NULL, NULL, NULL, str);
 	MEM_freeN(str);
 
@@ -2573,21 +2642,21 @@ void uiPupMenuInvoke(bContext *C, const char *idname)
 	uiPopupMenu *pup;
 	uiLayout *layout;
 	Menu menu;
-	MenuType *mt= WM_menutype_find(idname, TRUE);
+	MenuType *mt = WM_menutype_find(idname, TRUE);
 
-	if(mt==NULL) {
+	if (mt == NULL) {
 		printf("%s: named menu \"%s\" not found\n", __func__, idname);
 		return;
 	}
 
-	if(mt->poll && mt->poll(C, mt)==0)
+	if (mt->poll && mt->poll(C, mt) == 0)
 		return;
 
-	pup= uiPupMenuBegin(C, mt->label, ICON_NONE);
-	layout= uiPupMenuLayout(pup);
+	pup = uiPupMenuBegin(C, IFACE_(mt->label), ICON_NONE);
+	layout = uiPupMenuLayout(pup);
 
-	menu.layout= layout;
-	menu.type= mt;
+	menu.layout = layout;
+	menu.type = mt;
 
 	mt->draw(C, &menu);
 
@@ -2599,13 +2668,13 @@ void uiPupMenuInvoke(bContext *C, const char *idname)
 
 void uiPupBlockO(bContext *C, uiBlockCreateFunc func, void *arg, const char *opname, int opcontext)
 {
-	wmWindow *window= CTX_wm_window(C);
+	wmWindow *window = CTX_wm_window(C);
 	uiPopupBlockHandle *handle;
 	
-	handle= ui_popup_block_create(C, NULL, NULL, func, NULL, arg);
-	handle->popup= 1;
-	handle->optype= (opname)? WM_operatortype_find(opname, 0): NULL;
-	handle->opcontext= opcontext;
+	handle = ui_popup_block_create(C, NULL, NULL, func, NULL, arg);
+	handle->popup = 1;
+	handle->optype = (opname) ? WM_operatortype_find(opname, 0) : NULL;
+	handle->opcontext = opcontext;
 	
 	UI_add_popup_handlers(C, &window->modalhandlers, handle);
 	WM_event_add_mousemove(C);
@@ -2618,16 +2687,16 @@ void uiPupBlock(bContext *C, uiBlockCreateFunc func, void *arg)
 
 void uiPupBlockEx(bContext *C, uiBlockCreateFunc func, uiBlockHandleFunc popup_func, uiBlockCancelFunc cancel_func, void *arg)
 {
-	wmWindow *window= CTX_wm_window(C);
+	wmWindow *window = CTX_wm_window(C);
 	uiPopupBlockHandle *handle;
 	
-	handle= ui_popup_block_create(C, NULL, NULL, func, NULL, arg);
-	handle->popup= 1;
-	handle->retvalue= 1;
+	handle = ui_popup_block_create(C, NULL, NULL, func, NULL, arg);
+	handle->popup = 1;
+	handle->retvalue = 1;
 
-	handle->popup_arg= arg;
-	handle->popup_func= popup_func;
-	handle->cancel_func= cancel_func;
+	handle->popup_arg = arg;
+	handle->popup_func = popup_func;
+	handle->cancel_func = cancel_func;
 	// handle->opcontext= opcontext;
 	
 	UI_add_popup_handlers(C, &window->modalhandlers, handle);
@@ -2637,17 +2706,17 @@ void uiPupBlockEx(bContext *C, uiBlockCreateFunc func, uiBlockHandleFunc popup_f
 #if 0 /* UNUSED */
 void uiPupBlockOperator(bContext *C, uiBlockCreateFunc func, wmOperator *op, int opcontext)
 {
-	wmWindow *window= CTX_wm_window(C);
+	wmWindow *window = CTX_wm_window(C);
 	uiPopupBlockHandle *handle;
 	
-	handle= ui_popup_block_create(C, NULL, NULL, func, NULL, op);
-	handle->popup= 1;
-	handle->retvalue= 1;
+	handle = ui_popup_block_create(C, NULL, NULL, func, NULL, op);
+	handle->popup = 1;
+	handle->retvalue = 1;
 
-	handle->popup_arg= op;
-	handle->popup_func= operator_cb;
-	handle->cancel_func= confirm_cancel_operator;
-	handle->opcontext= opcontext;
+	handle->popup_arg = op;
+	handle->popup_func = operator_cb;
+	handle->cancel_func = confirm_cancel_operator;
+	handle->opcontext = opcontext;
 	
 	UI_add_popup_handlers(C, &window->modalhandlers, handle);
 	WM_event_add_mousemove(C);
@@ -2656,11 +2725,11 @@ void uiPupBlockOperator(bContext *C, uiBlockCreateFunc func, wmOperator *op, int
 
 void uiPupBlockClose(bContext *C, uiBlock *block)
 {
-	if(block->handle) {
+	if (block->handle) {
 		wmWindow *win = CTX_wm_window(C);
 
 		/* if loading new .blend while popup is open, window will be NULL */
-		if(win) {
+		if (win) {
 			UI_remove_popup_handlers(&win->modalhandlers, block->handle);
 			ui_popup_block_free(C, block->handle);
 		}
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index 16b5437..5d52766 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -60,81 +60,80 @@
 /* style + theme + layout-engine = UI */
 
 /* 
- This is a complete set of layout rules, the 'state' of the Layout 
- Engine. Multiple styles are possible, defined via C or Python. Styles 
- get a name, and will typically get activated per region type, like 
- "Header", or "Listview" or "Toolbar". Properties of Style definitions 
- are:
- 
- - default collumn properties, internal spacing, aligning, min/max width
- - button alignment rules (for groups)
- - label placement rules
- - internal labeling or external labeling default
- - default minimum widths for buttons/labels (in amount of characters)
- - font types, styles and relative sizes for Panel titles, labels, etc.
-
-*/
+ * This is a complete set of layout rules, the 'state' of the Layout 
+ * Engine. Multiple styles are possible, defined via C or Python. Styles 
+ * get a name, and will typically get activated per region type, like 
+ * "Header", or "Listview" or "Toolbar". Properties of Style definitions 
+ * are:
+ *
+ * - default column properties, internal spacing, aligning, min/max width
+ * - button alignment rules (for groups)
+ * - label placement rules
+ * - internal labeling or external labeling default
+ * - default minimum widths for buttons/labels (in amount of characters)
+ * - font types, styles and relative sizes for Panel titles, labels, etc.
+ */
 
 
 /* ********************************************** */
 
 static uiStyle *ui_style_new(ListBase *styles, const char *name, short uifont_id)
 {
-	uiStyle *style= MEM_callocN(sizeof(uiStyle), "new style");
+	uiStyle *style = MEM_callocN(sizeof(uiStyle), "new style");
 	
 	BLI_addtail(styles, style);
 	BLI_strncpy(style->name, name, MAX_STYLE_NAME);
 	
-	style->panelzoom= 1.0; /* unused */
-
-	style->paneltitle.uifont_id= uifont_id;
-	style->paneltitle.points= 12;
-	style->paneltitle.kerning= 1;
-	style->paneltitle.shadow= 1;
-	style->paneltitle.shadx= 0;
-	style->paneltitle.shady= -1;
-	style->paneltitle.shadowalpha= 0.15f;
-	style->paneltitle.shadowcolor= 1.0f;
-	
-	style->grouplabel.uifont_id= uifont_id;
-	style->grouplabel.points= 12;
-	style->grouplabel.kerning= 1;
-	style->grouplabel.shadow= 3;
-	style->grouplabel.shadx= 0;
-	style->grouplabel.shady= -1;
-	style->grouplabel.shadowalpha= 0.25f;
-	
-	style->widgetlabel.uifont_id= uifont_id;
-	style->widgetlabel.points= 11;
-	style->widgetlabel.kerning= 1;
-	style->widgetlabel.shadow= 3;
-	style->widgetlabel.shadx= 0;
-	style->widgetlabel.shady= -1;
-	style->widgetlabel.shadowalpha= 0.15f;
-	style->widgetlabel.shadowcolor= 1.0f;
-	
-	style->widget.uifont_id= uifont_id;
-	style->widget.points= 11;
-	style->widget.kerning= 1;
-	style->widget.shadowalpha= 0.25f;
-
-	style->columnspace= 8;
-	style->templatespace= 5;
-	style->boxspace= 5;
-	style->buttonspacex= 8;
-	style->buttonspacey= 2;
-	style->panelspace= 8;
-	style->panelouter= 4;
+	style->panelzoom = 1.0; /* unused */
+
+	style->paneltitle.uifont_id = uifont_id;
+	style->paneltitle.points = 12;
+	style->paneltitle.kerning = 1;
+	style->paneltitle.shadow = 1;
+	style->paneltitle.shadx = 0;
+	style->paneltitle.shady = -1;
+	style->paneltitle.shadowalpha = 0.15f;
+	style->paneltitle.shadowcolor = 1.0f;
+
+	style->grouplabel.uifont_id = uifont_id;
+	style->grouplabel.points = 12;
+	style->grouplabel.kerning = 1;
+	style->grouplabel.shadow = 3;
+	style->grouplabel.shadx = 0;
+	style->grouplabel.shady = -1;
+	style->grouplabel.shadowalpha = 0.25f;
+
+	style->widgetlabel.uifont_id = uifont_id;
+	style->widgetlabel.points = 11;
+	style->widgetlabel.kerning = 1;
+	style->widgetlabel.shadow = 3;
+	style->widgetlabel.shadx = 0;
+	style->widgetlabel.shady = -1;
+	style->widgetlabel.shadowalpha = 0.15f;
+	style->widgetlabel.shadowcolor = 1.0f;
+
+	style->widget.uifont_id = uifont_id;
+	style->widget.points = 11;
+	style->widget.kerning = 1;
+	style->widget.shadowalpha = 0.25f;
+
+	style->columnspace = 8;
+	style->templatespace = 5;
+	style->boxspace = 5;
+	style->buttonspacex = 8;
+	style->buttonspacey = 2;
+	style->panelspace = 8;
+	style->panelouter = 4;
 	
 	return style;
 }
 
 static uiFont *uifont_to_blfont(int id)
 {
-	uiFont *font= U.uifonts.first;
+	uiFont *font = U.uifonts.first;
 	
-	for(; font; font= font->next) {
-		if(font->uifont_id==id) {
+	for (; font; font = font->next) {
+		if (font->uifont_id == id) {
 			return font;
 		}
 	}
@@ -145,31 +144,31 @@ static uiFont *uifont_to_blfont(int id)
 
 
 void uiStyleFontDrawExt(uiFontStyle *fs, rcti *rect, const char *str,
-	float *r_xofs, float *r_yofs)
+                        float *r_xofs, float *r_yofs)
 {
 	float height;
-	int xofs=0, yofs;
+	int xofs = 0, yofs;
 	
 	uiStyleFontSet(fs);
 
-	height= BLF_ascender(fs->uifont_id);
-	yofs= ceil( 0.5f*(rect->ymax - rect->ymin - height));
+	height = BLF_ascender(fs->uifont_id);
+	yofs = ceil(0.5f * (rect->ymax - rect->ymin - height));
 
-	if(fs->align==UI_STYLE_TEXT_CENTER) {
-		xofs= floor( 0.5f*(rect->xmax - rect->xmin - BLF_width(fs->uifont_id, str)));
+	if (fs->align == UI_STYLE_TEXT_CENTER) {
+		xofs = floor(0.5f * (rect->xmax - rect->xmin - BLF_width(fs->uifont_id, str)));
 		/* don't center text if it chops off the start of the text, 2 gives some margin */
-		if(xofs < 2) {
-			xofs= 2;
+		if (xofs < 2) {
+			xofs = 2;
 		}
 	}
-	else if(fs->align==UI_STYLE_TEXT_RIGHT) {
-		xofs= rect->xmax - rect->xmin - BLF_width(fs->uifont_id, str) - 1;
+	else if (fs->align == UI_STYLE_TEXT_RIGHT) {
+		xofs = rect->xmax - rect->xmin - BLF_width(fs->uifont_id, str) - 1;
 	}
 	
 	/* clip is very strict, so we give it some space */
-	BLF_clipping(fs->uifont_id, rect->xmin-1, rect->ymin-4, rect->xmax+1, rect->ymax+4);
+	BLF_clipping(fs->uifont_id, rect->xmin - 1, rect->ymin - 4, rect->xmax + 1, rect->ymax + 4);
 	BLF_enable(fs->uifont_id, BLF_CLIPPING);
-	BLF_position(fs->uifont_id, rect->xmin+xofs, rect->ymin+yofs, 0.0f);
+	BLF_position(fs->uifont_id, rect->xmin + xofs, rect->ymin + yofs, 0.0f);
 
 	if (fs->shadow) {
 		BLF_enable(fs->uifont_id, BLF_SHADOW);
@@ -187,15 +186,15 @@ void uiStyleFontDrawExt(uiFontStyle *fs, rcti *rect, const char *str,
 	if (fs->kerning == 1)
 		BLF_disable(fs->uifont_id, BLF_KERNING_DEFAULT);
 
-	*r_xofs= xofs;
-	*r_yofs= yofs;
+	*r_xofs = xofs;
+	*r_yofs = yofs;
 }
 
 void uiStyleFontDraw(uiFontStyle *fs, rcti *rect, const char *str)
 {
 	float xofs, yofs;
 	uiStyleFontDrawExt(fs, rect, str,
-		&xofs, &yofs);
+	                   &xofs, &yofs);
 }
 
 /* drawn same as above, but at 90 degree angle */
@@ -208,28 +207,28 @@ void uiStyleFontDrawRotated(uiFontStyle *fs, rcti *rect, const char *str)
 
 	uiStyleFontSet(fs);
 
-	height= BLF_ascender(fs->uifont_id);
+	height = BLF_ascender(fs->uifont_id);
 	/* becomes x-offset when rotated */
-	xofs= ceil( 0.5f*(rect->ymax - rect->ymin - height));
+	xofs = ceil(0.5f * (rect->ymax - rect->ymin - height));
 
 	/* ignore UI_STYLE, always aligned to top */
 
 	/* rotate counter-clockwise for now (assumes left-to-right language)*/
-	xofs+= height;
-	yofs= BLF_width(fs->uifont_id, str) + 5;
-	angle= 90.0f;
+	xofs += height;
+	yofs = BLF_width(fs->uifont_id, str) + 5;
+	angle = 90.0f;
 
 	/* translate rect to vertical */
-	txtrect.xmin= rect->xmin - (rect->ymax - rect->ymin);
-	txtrect.ymin= rect->ymin - (rect->xmax - rect->xmin);
-	txtrect.xmax= rect->xmin;
-	txtrect.ymax= rect->ymin;
+	txtrect.xmin = rect->xmin - (rect->ymax - rect->ymin);
+	txtrect.ymin = rect->ymin - (rect->xmax - rect->xmin);
+	txtrect.xmax = rect->xmin;
+	txtrect.ymax = rect->ymin;
 
 	/* clip is very strict, so we give it some space */
 	/* clipping is done without rotation, so make rect big enough to contain both positions */
-	BLF_clipping(fs->uifont_id, txtrect.xmin-1, txtrect.ymin-yofs-xofs-4, rect->xmax+1, rect->ymax+4);
+	BLF_clipping(fs->uifont_id, txtrect.xmin - 1, txtrect.ymin - yofs - xofs - 4, rect->xmax + 1, rect->ymax + 4);
 	BLF_enable(fs->uifont_id, BLF_CLIPPING);
-	BLF_position(fs->uifont_id, txtrect.xmin+xofs, txtrect.ymax-yofs, 0.0f);
+	BLF_position(fs->uifont_id, txtrect.xmin + xofs, txtrect.ymax - yofs, 0.0f);
 
 	BLF_enable(fs->uifont_id, BLF_ROTATION);
 	BLF_rotation(fs->uifont_id, angle);
@@ -254,7 +253,7 @@ void uiStyleFontDrawRotated(uiFontStyle *fs, rcti *rect, const char *str)
 
 /* ************** helpers ************************ */
 /* XXX: read a style configure */
-uiStyle* UI_GetStyle(void)
+uiStyle *UI_GetStyle(void)
 {
 	uiStyle *style = NULL;
 	/* offset is two struct uiStyle pointers */
@@ -265,17 +264,17 @@ uiStyle* UI_GetStyle(void)
 /* temporarily, does widget font */
 int UI_GetStringWidth(const char *str)
 {
-	uiStyle *style= UI_GetStyle();
-	uiFontStyle *fstyle= &style->widget;
+	uiStyle *style = UI_GetStyle();
+	uiFontStyle *fstyle = &style->widget;
 	int width;
 	
-	if (fstyle->kerning==1)	/* for BLF_width */
+	if (fstyle->kerning == 1) /* for BLF_width */
 		BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
 	
 	uiStyleFontSet(fstyle);
-	width= BLF_width(fstyle->uifont_id, str);	
+	width = BLF_width(fstyle->uifont_id, str);
 	
-	if (fstyle->kerning==1)
+	if (fstyle->kerning == 1)
 		BLF_disable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
 	
 	return width;
@@ -284,7 +283,7 @@ int UI_GetStringWidth(const char *str)
 /* temporarily, does widget font */
 void UI_DrawString(float x, float y, const char *str)
 {
-	uiStyle *style= UI_GetStyle();
+	uiStyle *style = UI_GetStyle();
 	
 	if (style->widget.kerning == 1)
 		BLF_enable(style->widget.uifont_id, BLF_KERNING_DEFAULT);
@@ -303,61 +302,61 @@ void UI_DrawString(float x, float y, const char *str)
 /* reading without uifont will create one */
 void uiStyleInit(void)
 {
-	uiFont *font= U.uifonts.first;
-	uiStyle *style= U.uistyles.first;
+	uiFont *font = U.uifonts.first;
+	uiStyle *style = U.uistyles.first;
 	
 	/* recover from uninitialized dpi */
-	if(U.dpi == 0)
-		U.dpi= 72;
+	if (U.dpi == 0)
+		U.dpi = 72;
 	CLAMP(U.dpi, 48, 128);
 	
 	/* default builtin */
-	if(font==NULL) {
-		font= MEM_callocN(sizeof(uiFont), "ui font");
+	if (font == NULL) {
+		font = MEM_callocN(sizeof(uiFont), "ui font");
 		BLI_addtail(&U.uifonts, font);
 		
 		BLI_strncpy(font->filename, "default", sizeof(font->filename));
-		font->uifont_id= UIFONT_DEFAULT;
+		font->uifont_id = UIFONT_DEFAULT;
 	}
 	
-	for(font= U.uifonts.first; font; font= font->next) {
+	for (font = U.uifonts.first; font; font = font->next) {
 		
-		if(font->uifont_id==UIFONT_DEFAULT) {
+		if (font->uifont_id == UIFONT_DEFAULT) {
 #ifdef WITH_INTERNATIONAL
-			int font_size= datatoc_bfont_ttf_size;
-			unsigned char *font_ttf= (unsigned char*)datatoc_bfont_ttf;
+			int font_size = datatoc_bfont_ttf_size;
+			unsigned char *font_ttf = (unsigned char *)datatoc_bfont_ttf;
 			static int last_font_size = 0;
 
 			/* use unicode font for translation */
-			if(U.transopts & USER_DOTRANSLATE) {
-				font_ttf= BLF_get_unifont(&font_size);
+			if (U.transopts & USER_DOTRANSLATE) {
+				font_ttf = BLF_get_unifont(&font_size);
 
-				if(!font_ttf) {
+				if (!font_ttf) {
 					/* fall back if not found */
-					font_size= datatoc_bfont_ttf_size;
-					font_ttf= (unsigned char*)datatoc_bfont_ttf;
+					font_size = datatoc_bfont_ttf_size;
+					font_ttf = (unsigned char *)datatoc_bfont_ttf;
 				}
 			}
 
 			/* relload only if needed */
-			if(last_font_size != font_size) {
+			if (last_font_size != font_size) {
 				BLF_unload("default");
 				last_font_size = font_size;
 			}
 
-			font->blf_id= BLF_load_mem("default", font_ttf, font_size);
+			font->blf_id = BLF_load_mem("default", font_ttf, font_size);
 #else
-			font->blf_id= BLF_load_mem("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size);
+			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)
-				font->blf_id= BLF_load_mem("default", (unsigned char*)datatoc_bfont_ttf, datatoc_bfont_ttf_size);
+			font->blf_id = BLF_load(font->filename);
+			if (font->blf_id == -1)
+				font->blf_id = BLF_load_mem("default", (unsigned char *)datatoc_bfont_ttf, datatoc_bfont_ttf_size);
 		}
 
 		if (font->blf_id == -1) {
-			if (G.f & G_DEBUG)
+			if (G.debug & G_DEBUG)
 				printf("%s: error, no fonts available\n", __func__);
 		}
 		else {
@@ -371,26 +370,26 @@ void uiStyleInit(void)
 		}
 	}
 	
-	if(style==NULL) {
-		ui_style_new(&U.uistyles, "Default Style", UIFONT_DEFAULT );
+	if (style == NULL) {
+		ui_style_new(&U.uistyles, "Default Style", UIFONT_DEFAULT);
 	}
 	
 	// XXX, this should be moved into a style, but for now best only load the monospaced font once.
 	if (blf_mono_font == -1)
-		blf_mono_font= BLF_load_mem_unique("monospace", (unsigned char *)datatoc_bmonofont_ttf, datatoc_bmonofont_ttf_size);
+		blf_mono_font = BLF_load_mem_unique("monospace", (unsigned char *)datatoc_bmonofont_ttf, datatoc_bmonofont_ttf_size);
 
 	BLF_size(blf_mono_font, 12, 72);
 	
 	/* second for rendering else we get threading problems */
 	if (blf_mono_font_render == -1)
-		blf_mono_font_render= BLF_load_mem_unique("monospace", (unsigned char *)datatoc_bmonofont_ttf, datatoc_bmonofont_ttf_size);
+		blf_mono_font_render = BLF_load_mem_unique("monospace", (unsigned char *)datatoc_bmonofont_ttf, datatoc_bmonofont_ttf_size);
 
 	BLF_size(blf_mono_font_render, 12, 72);
 }
 
 void uiStyleFontSet(uiFontStyle *fs)
 {
-	uiFont *font= uifont_to_blfont(fs->uifont_id);
+	uiFont *font = uifont_to_blfont(fs->uifont_id);
 	
 	BLF_size(font->blf_id, fs->points, U.dpi);
 }
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 4a797b0..d0f760d 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -83,8 +83,8 @@ void uiTemplateHeader(uiLayout *layout, bContext *C, int menus)
 {
 	uiBlock *block;
 
-	block= uiLayoutAbsoluteBlock(layout);
-	if(menus) ED_area_header_standardbuttons(C, block, 0);
+	block = uiLayoutAbsoluteBlock(layout);
+	if (menus) ED_area_header_standardbuttons(C, block, 0);
 	else ED_area_header_switchbutton(C, block, 0);
 }
 
@@ -96,15 +96,16 @@ typedef struct TemplateID {
 
 	ListBase *idlb;
 	int prv_rows, prv_cols;
+	int preview;
 } TemplateID;
 
 /* Search browse menu, assign  */
 static void id_search_call_cb(bContext *C, void *arg_template, void *item)
 {
-	TemplateID *template= (TemplateID*)arg_template;
+	TemplateID *template = (TemplateID *)arg_template;
 
 	/* ID */
-	if(item) {
+	if (item) {
 		PointerRNA idptr;
 
 		RNA_id_pointer_create(item, &idptr);
@@ -116,36 +117,36 @@ static void id_search_call_cb(bContext *C, void *arg_template, void *item)
 /* ID Search browse menu, do the search */
 static void id_search_cb(const bContext *C, void *arg_template, const char *str, uiSearchItems *items)
 {
-	TemplateID *template= (TemplateID*)arg_template;
-	ListBase *lb= template->idlb;
-	ID *id, *id_from= template->ptr.id.data;
+	TemplateID *template = (TemplateID *)arg_template;
+	ListBase *lb = template->idlb;
+	ID *id, *id_from = template->ptr.id.data;
 	int iconid;
-	int flag= RNA_property_flag(template->prop);
+	int flag = RNA_property_flag(template->prop);
 
 	/* ID listbase */
-	for(id= lb->first; id; id= id->next) {
-		if(!((flag & PROP_ID_SELF_CHECK) && id == id_from)) {
+	for (id = lb->first; id; id = id->next) {
+		if (!((flag & PROP_ID_SELF_CHECK) && id == id_from)) {
 
 			/* use filter */
-			if(RNA_property_type(template->prop)==PROP_POINTER) {
+			if (RNA_property_type(template->prop) == PROP_POINTER) {
 				PointerRNA ptr;
 				RNA_id_pointer_create(id, &ptr);
-				if(RNA_property_pointer_poll(&template->ptr, template->prop, &ptr)==0)
+				if (RNA_property_pointer_poll(&template->ptr, template->prop, &ptr) == 0)
 					continue;
 			}
 
 			/* hide dot-datablocks, but only if filter does not force it visible */
-			if(U.uiflag & USER_HIDE_DOT)
-				if ((id->name[2]=='.') && (str[0] != '.'))
+			if (U.uiflag & USER_HIDE_DOT)
+				if ((id->name[2] == '.') && (str[0] != '.'))
 					continue;
 
-			if(BLI_strcasestr(id->name+2, str)) {
+			if (BLI_strcasestr(id->name + 2, str)) {
 				char name_ui[MAX_ID_NAME];
 				name_uiprefix_id(name_ui, id);
 
-				iconid= ui_id_icon_get((bContext*)C, id, 1);
+				iconid = ui_id_icon_get((bContext *)C, id, template->preview);
 
-				if(!uiSearchItemAdd(items, name_ui, id, iconid))
+				if (!uiSearchItemAdd(items, name_ui, id, iconid))
 					break;
 			}
 		}
@@ -158,20 +159,20 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem)
 	static char search[256];
 	static TemplateID template;
 	PointerRNA idptr;
-	wmWindow *win= CTX_wm_window(C);
+	wmWindow *win = CTX_wm_window(C);
 	uiBlock *block;
 	uiBut *but;
 	
 	/* clear initial search string, then all items show */
-	search[0]= 0;
+	search[0] = 0;
 	/* arg_litem is malloced, can be freed by parent button */
-	template= *((TemplateID*)arg_litem);
+	template = *((TemplateID *)arg_litem);
 	
 	/* get active id for showing first item */
-	idptr= RNA_property_pointer_get(&template.ptr, template.prop);
+	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);
+	block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
+	uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_RET_1);
 	
 	/* preview thumbnails */
 	if (template.prv_rows > 0 && template.prv_cols > 0) {
@@ -181,7 +182,7 @@ 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 */
@@ -189,7 +190,7 @@ 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, 150, uiSearchBoxhHeight(), 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, 150, 19, 0, 0, "");
 		uiButSetSearchFunc(but, id_search_cb, &template, id_search_call_cb, idptr.data);
 	}
 		
@@ -213,24 +214,24 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem)
 void uiIDContextProperty(bContext *C, PointerRNA *ptr, PropertyRNA **prop)
 {
 	TemplateID *template;
-	ARegion *ar= CTX_wm_region(C);
+	ARegion *ar = CTX_wm_region(C);
 	uiBlock *block;
 	uiBut *but;
 
 	memset(ptr, 0, sizeof(*ptr));
-	*prop= NULL;
+	*prop = NULL;
 
-	if(!ar)
+	if (!ar)
 		return;
 
-	for(block=ar->uiblocks.first; block; block=block->next) {
-		for(but=block->buttons.first; but; but= but->next) {
+	for (block = ar->uiblocks.first; block; block = block->next) {
+		for (but = block->buttons.first; but; but = but->next) {
 			/* find the button before the active one */
-			if((but->flag & (UI_BUT_LAST_ACTIVE|UI_ACTIVE))) {
-				if(but->func_argN) {
-					template= but->func_argN;
-					*ptr= template->ptr;
-					*prop= template->prop;
+			if ((but->flag & (UI_BUT_LAST_ACTIVE | UI_ACTIVE))) {
+				if (but->func_argN) {
+					template = but->func_argN;
+					*ptr = template->ptr;
+					*prop = template->prop;
 					return;
 				}
 			}
@@ -241,12 +242,12 @@ void uiIDContextProperty(bContext *C, PointerRNA *ptr, PropertyRNA **prop)
 
 static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
 {
-	TemplateID *template= (TemplateID*)arg_litem;
-	PointerRNA idptr= RNA_property_pointer_get(&template->ptr, template->prop);
-	ID *id= idptr.data;
-	int event= GET_INT_FROM_POINTER(arg_event);
+	TemplateID *template = (TemplateID *)arg_litem;
+	PointerRNA idptr = RNA_property_pointer_get(&template->ptr, template->prop);
+	ID *id = idptr.data;
+	int event = GET_INT_FROM_POINTER(arg_event);
 	
-	switch(event) {
+	switch (event) {
 		case UI_ID_BROWSE:
 		case UI_ID_PIN:
 			RNA_warning("warning, id event %d shouldnt come here", event);
@@ -260,40 +261,40 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
 			RNA_property_pointer_set(&template->ptr, template->prop, idptr);
 			RNA_property_update(C, &template->ptr, template->prop);
 
-			if(id && CTX_wm_window(C)->eventstate->shift) /* useful hidden functionality, */
-				id->us= 0;
+			if (id && CTX_wm_window(C)->eventstate->shift) /* useful hidden functionality, */
+				id->us = 0;
 
 			break;
 		case UI_ID_FAKE_USER:
-			if(id) {
-				if(id->flag & LIB_FAKEUSER) id_us_plus(id);
+			if (id) {
+				if (id->flag & LIB_FAKEUSER) id_us_plus(id);
 				else id_us_min(id);
 			}
 			else return;
 			break;
 		case UI_ID_LOCAL:
-			if(id) {
-				if(id_make_local(id, 0)) {
+			if (id) {
+				if (id_make_local(id, 0)) {
 					/* reassign to get get proper updates/notifiers */
-					idptr= RNA_property_pointer_get(&template->ptr, template->prop);
+					idptr = RNA_property_pointer_get(&template->ptr, template->prop);
 					RNA_property_pointer_set(&template->ptr, template->prop, idptr);
 					RNA_property_update(C, &template->ptr, template->prop);
 				}
 			}
 			break;
 		case UI_ID_ALONE:
-			if(id) {
-				const int do_scene_obj= (GS(id->name) == ID_OB) &&
-				                        (template->ptr.type == &RNA_SceneObjects);
+			if (id) {
+				const int do_scene_obj = (GS(id->name) == ID_OB) &&
+				                         (template->ptr.type == &RNA_SceneObjects);
 
 				/* make copy */
-				if(do_scene_obj) {
-					Scene *scene= CTX_data_scene(C);
+				if (do_scene_obj) {
+					Scene *scene = CTX_data_scene(C);
 					ED_object_single_user(scene, (struct Object *)id);
-					WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
+					WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
 				}
 				else {
-					if(id) {
+					if (id) {
 						id_single_user(C, id, &template->ptr, template->prop);
 					}
 				}
@@ -308,13 +309,13 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event)
 
 static const char *template_id_browse_tip(StructRNA *type)
 {
-	if(type) {
-		switch(RNA_type_to_ID_code(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_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");
@@ -344,147 +345,148 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str
 	PointerRNA idptr;
 	// ListBase *lb; // UNUSED
 	ID *id, *idfrom;
-	int editable= RNA_property_editable(&template->ptr, template->prop);
+	int editable = RNA_property_editable(&template->ptr, template->prop);
 
-	idptr= RNA_property_pointer_get(&template->ptr, template->prop);
-	id= idptr.data;
-	idfrom= template->ptr.id.data;
+	idptr = RNA_property_pointer_get(&template->ptr, template->prop);
+	id = idptr.data;
+	idfrom = template->ptr.id.data;
 	// lb= template->idlb;
 
-	block= uiLayoutGetBlock(layout);
+	block = uiLayoutGetBlock(layout);
 	uiBlockBeginAlign(block);
 
-	if(idptr.type)
-		type= idptr.type;
+	if (idptr.type)
+		type = idptr.type;
 
-	if(flag & UI_ID_PREVIEWS) {
+	if (flag & UI_ID_PREVIEWS) {
 
-		but= uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X*6, UI_UNIT_Y*6,
-				TIP_(template_id_browse_tip(type)));
-		if(type) {
-			but->icon= RNA_struct_ui_icon(type);
+		but = uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X * 6, UI_UNIT_Y * 6,
+		                     TIP_(template_id_browse_tip(type)));
+		if (type) {
+			but->icon = RNA_struct_ui_icon(type);
 			if (id) but->icon = ui_id_icon_get(C, id, 1);
-			uiButSetFlag(but, UI_HAS_ICON|UI_ICON_PREVIEW);
+			uiButSetFlag(but, UI_HAS_ICON | UI_ICON_PREVIEW);
 		}
-		if((idfrom && idfrom->lib) || !editable)
+		if ((idfrom && idfrom->lib) || !editable)
 			uiButSetFlag(but, UI_BUT_DISABLED);
 		
 		uiLayoutRow(layout, 1);
+		template->preview = 1;
 	}
-	else if(flag & UI_ID_BROWSE) {
-		but= uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X*1.6, UI_UNIT_Y,
-				TIP_(template_id_browse_tip(type)));
-		if(type) {
-			but->icon= RNA_struct_ui_icon(type);
+	else if (flag & UI_ID_BROWSE) {
+		but = uiDefBlockButN(block, id_search_menu, MEM_dupallocN(template), "", 0, 0, UI_UNIT_X * 1.6, UI_UNIT_Y,
+		                     TIP_(template_id_browse_tip(type)));
+		if (type) {
+			but->icon = RNA_struct_ui_icon(type);
 			/* default dragging of icon for id browse buttons */
 			uiButSetDragID(but, id);
-			uiButSetFlag(but, UI_HAS_ICON|UI_ICON_LEFT);
+			uiButSetFlag(but, UI_HAS_ICON | UI_ICON_LEFT);
 		}
 
-		if((idfrom && idfrom->lib) || !editable)
+		if ((idfrom && idfrom->lib) || !editable)
 			uiButSetFlag(but, UI_BUT_DISABLED);
 	}
 
 	/* text button with name */
-	if(id) {
+	if (id) {
 		char name[UI_MAX_NAME_STR];
-		const short user_alert= (id->us <= 0);
+		const short user_alert = (id->us <= 0);
 
 		//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);
+		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);
 		uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_RENAME));
-		if(user_alert) uiButSetFlag(but, UI_BUT_REDALERT);
+		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"));
+		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"));
 				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"));
-				if(!id_make_local(id, 1 /* test */) || (idfrom && idfrom->lib))
+				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);
 			}
 
 			uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_LOCAL));
 		}
 
-		if(id->us > 1) {
+		if (id->us > 1) {
 			char numstr[32];
 
 			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,
-			              TIP_("Display number of users of this data (click to make a single-user copy)"));
+			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));
-			if(!id_copy(id, NULL, 1 /* test only */) || (idfrom && idfrom->lib) || !editable)
+			if (!id_copy(id, NULL, 1 /* test only */) || (idfrom && idfrom->lib) || !editable)
 				uiButSetFlag(but, UI_BUT_DISABLED);
 		}
 	
-		if(user_alert) uiButSetFlag(but, UI_BUT_REDALERT);
+		if (user_alert) uiButSetFlag(but, UI_BUT_REDALERT);
 		
-		if(id->lib == NULL && !(ELEM5(GS(id->name), ID_GR, ID_SCE, ID_SCR, ID_TXT, ID_OB))) {
+		if (id->lib == NULL && !(ELEM5(GS(id->name), ID_GR, ID_SCE, ID_SCR, ID_TXT, ID_OB))) {
 			uiDefButR(block, TOG, 0, "F", 0, 0, UI_UNIT_X, UI_UNIT_Y, &idptr, "use_fake_user", -1, 0, 0, -1, -1, NULL);
 		}
 	}
 	
-	if(flag & UI_ID_ADD_NEW) {
-		int w= id?UI_UNIT_X: (flag & UI_ID_OPEN)? UI_UNIT_X*3: UI_UNIT_X*6;
+	if (flag & UI_ID_ADD_NEW) {
+		int w = id ? UI_UNIT_X : (flag & UI_ID_OPEN) ? UI_UNIT_X * 3 : UI_UNIT_X * 6;
 		
-		if(newop) {
-			but= uiDefIconTextButO(block, BUT, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN, (id)? "": IFACE_("New"), 0, 0, w, UI_UNIT_Y, NULL);
+		if (newop) {
+			but = uiDefIconTextButO(block, BUT, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN, (id) ? "" : IFACE_("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) ? "" : IFACE_("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));
 		}
 
-		if((idfrom && idfrom->lib) || !editable)
+		if ((idfrom && idfrom->lib) || !editable)
 			uiButSetFlag(but, UI_BUT_DISABLED);
 	}
 
-	if(flag & UI_ID_OPEN) {
-		int w= id?UI_UNIT_X: (flag & UI_ID_ADD_NEW)? UI_UNIT_X*3: UI_UNIT_X*6;
+	if (flag & UI_ID_OPEN) {
+		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);
+		if (openop) {
+			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));
 		}
 
-		if((idfrom && idfrom->lib) || !editable)
+		if ((idfrom && idfrom->lib) || !editable)
 			uiButSetFlag(but, UI_BUT_DISABLED);
 	}
 	
 	/* delete button */
-	if(id && (flag & UI_ID_DELETE) && (RNA_property_flag(template->prop) & PROP_NEVER_UNLINK)==0) {
-		if(unlinkop) {
-			but= uiDefIconButO(block, BUT, unlinkop, WM_OP_INVOKE_REGION_WIN, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL);
+	if (id && (flag & UI_ID_DELETE) && (RNA_property_flag(template->prop) & PROP_NEVER_UNLINK) == 0) {
+		if (unlinkop) {
+			but = uiDefIconButO(block, BUT, unlinkop, WM_OP_INVOKE_REGION_WIN, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL);
 			/* so we can access the template from operators, font unlinking needs this */
 			uiButSetNFunc(but, NULL, MEM_dupallocN(template), NULL);
 		}
 		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"));
+			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"));
 			uiButSetNFunc(but, template_id_cb, MEM_dupallocN(template), SET_INT_IN_POINTER(UI_ID_DELETE));
 
-			if(RNA_property_flag(template->prop) & PROP_NEVER_NULL)
+			if (RNA_property_flag(template->prop) & PROP_NEVER_NULL)
 				uiButSetFlag(but, UI_BUT_DISABLED);
 		}
 
-		if((idfrom && idfrom->lib) || !editable)
+		if ((idfrom && idfrom->lib) || !editable)
 			uiButSetFlag(but, UI_BUT_DISABLED);
 	}
 
-	if(idcode == ID_TE)
+	if (idcode == ID_TE)
 		uiTemplateTextureShow(layout, C, &template->ptr, template->prop);
 	
 	uiBlockEndAlign(block);
@@ -497,32 +499,32 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const
 	StructRNA *type;
 	short idcode;
 
-	prop= RNA_struct_find_property(ptr, propname);
+	prop = RNA_struct_find_property(ptr, propname);
 
-	if(!prop || RNA_property_type(prop) != PROP_POINTER) {
+	if (!prop || RNA_property_type(prop) != PROP_POINTER) {
 		RNA_warning("pointer property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
 		return;
 	}
 
-	template= MEM_callocN(sizeof(TemplateID), "TemplateID");
-	template->ptr= *ptr;
-	template->prop= prop;
+	template = MEM_callocN(sizeof(TemplateID), "TemplateID");
+	template->ptr = *ptr;
+	template->prop = prop;
 	template->prv_rows = prv_rows;
 	template->prv_cols = prv_cols;
 
-	if(newop)
+	if (newop)
 		flag |= UI_ID_ADD_NEW;
-	if(openop)
+	if (openop)
 		flag |= UI_ID_OPEN;
 
-	type= RNA_property_pointer_type(ptr, prop);
-	idcode= RNA_type_to_ID_code(type);
-	template->idlb= which_libbase(CTX_data_main(C), idcode);
+	type = RNA_property_pointer_type(ptr, prop);
+	idcode = RNA_type_to_ID_code(type);
+	template->idlb = which_libbase(CTX_data_main(C), idcode);
 	
 	/* create UI elements for this template
 	 *	- template_ID makes a copy of the template data and assigns it to the relevant buttons
 	 */
-	if(template->idlb) {
+	if (template->idlb) {
 		uiLayoutRow(layout, 1);
 		template_ID(C, layout, template, type, idcode, flag, newop, openop, unlinkop);
 	}
@@ -532,17 +534,17 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const
 
 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)
 {
-	ui_template_id(layout, C, ptr, propname, newop, openop, unlinkop, UI_ID_BROWSE|UI_ID_RENAME, 0, 0);
+	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)
 {
-	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 ***************************/
@@ -558,8 +560,8 @@ void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, co
 	uiLayout *row;
 	
 	/* get properties... */
-	propID= RNA_struct_find_property(ptr, propname);
-	propType= RNA_struct_find_property(ptr, proptypename);
+	propID = RNA_struct_find_property(ptr, propname);
+	propType = RNA_struct_find_property(ptr, proptypename);
 
 	if (!propID || RNA_property_type(propID) != PROP_POINTER) {
 		RNA_warning("pointer property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
@@ -571,7 +573,7 @@ void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, co
 	}
 	
 	/* Start drawing UI Elements using standard defines */
-	row= uiLayoutRow(layout, 1);
+	row = uiLayoutRow(layout, 1);
 	
 	/* Label - either use the provided text, or will become "ID-Block:" */
 	if (text)
@@ -603,14 +605,14 @@ void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, const char *propna
 	uiLayout *row;
 	
 	/* check that properties are valid */
-	propPath= RNA_struct_find_property(ptr, propname);
+	propPath = RNA_struct_find_property(ptr, propname);
 	if (!propPath || RNA_property_type(propPath) != PROP_STRING) {
 		RNA_warning("path property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
 		return;
 	}
 	
 	/* Start drawing UI Elements using standard defines */
-	row= uiLayoutRow(layout, 1);
+	row = uiLayoutRow(layout, 1);
 	
 	/* Path (existing string) Widget */
 	uiItemR(row, ptr, propname, 0, text, ICON_RNA);
@@ -641,21 +643,21 @@ static void modifiers_setOnCage(bContext *C, void *ob_v, void *md_v)
 {
 	Scene *scene = CTX_data_scene(C);
 	Object *ob = ob_v;
-	ModifierData *md= md_v;
+	ModifierData *md = md_v;
 	int i, cageIndex = modifiers_getCageIndex(scene, ob, NULL, 0);
 
 	/* undo button operation */
 	md->mode ^= eModifierMode_OnCage;
 
-	for(i = 0, md=ob->modifiers.first; md; ++i, md=md->next) {
-		if(md == md_v) {
-			if(i >= cageIndex)
+	for (i = 0, md = ob->modifiers.first; md; ++i, md = md->next) {
+		if (md == md_v) {
+			if (i >= cageIndex)
 				md->mode ^= eModifierMode_OnCage;
 			break;
 		}
 	}
 
-	WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+	WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 }
 
@@ -674,7 +676,7 @@ static void modifiers_convertToReal(bContext *C, void *ob_v, void *md_v)
 
 	ob->partype = PAROBJECT;
 
-	WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+	WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 
 	ED_undo_push(C, "Modifier convert to real");
@@ -683,8 +685,8 @@ static void modifiers_convertToReal(bContext *C, void *ob_v, void *md_v)
 static int modifier_can_delete(ModifierData *md)
 {
 	/* fluid particle modifier can't be deleted here */
-	if(md->type == eModifierType_ParticleSystem)
-		if(((ParticleSystemModifierData *)md)->psys->part->type == PART_FLUID)
+	if (md->type == eModifierType_ParticleSystem)
+		if (((ParticleSystemModifierData *)md)->psys->part->type == PART_FLUID)
 			return 0;
 
 	return 1;
@@ -695,7 +697,7 @@ static int modifier_is_simulation(ModifierData *md)
 {
 	/* Physic Tab */
 	if (ELEM7(md->type, eModifierType_Cloth, eModifierType_Collision, eModifierType_Fluidsim, eModifierType_Smoke,
-	                    eModifierType_Softbody, eModifierType_Surface, eModifierType_DynamicPaint))
+	          eModifierType_Softbody, eModifierType_Surface, eModifierType_DynamicPaint))
 	{
 		return 1;
 	}
@@ -716,30 +718,30 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
 	uiBut *but;
 	uiBlock *block;
 	uiLayout *box, *column, *row;
-	uiLayout *result= NULL;
+	uiLayout *result = NULL;
 	int isVirtual = (md->mode & eModifierMode_Virtual);
 	char str[128];
 
 	/* create RNA pointer */
 	RNA_pointer_create(&ob->id, &RNA_Modifier, md, &ptr);
 
-	column= uiLayoutColumn(layout, 1);
+	column = uiLayoutColumn(layout, 1);
 	uiLayoutSetContextPointer(column, "modifier", &ptr);
 
 	/* rounded header ------------------------------------------------------------------- */
-	box= uiLayoutBox(column);
+	box = uiLayoutBox(column);
 	
 	if (isVirtual) {
-		row= uiLayoutRow(box, 0);
+		row = uiLayoutRow(box, 0);
 		uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_EXPAND);
-		block= uiLayoutGetBlock(row);
+		block = uiLayoutGetBlock(row);
 		/* VIRTUAL MODIFIER */
 		// XXX this is not used now, since these cannot be accessed via RNA
 		BLI_snprintf(str, sizeof(str), "%s parent deform", md->name);
 		uiDefBut(block, LABEL, 0, str, 0, 0, 185, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Modifier name"); 
 		
 		but = uiDefBut(block, BUT, 0, IFACE_("Make Real"), 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0,
-					TIP_("Convert virtual modifier to a real modifier"));
+		               TIP_("Convert virtual modifier to a real modifier"));
 		uiButSetFunc(but, modifiers_convertToReal, ob, md);
 	}
 	else {
@@ -761,8 +763,8 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
 		/* mode enabling buttons */
 		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) ) 
+		if (((md->type != eModifierType_Softbody && md->type != eModifierType_Collision) || !(ob->pd && ob->pd->deflect)) &&
+		     (md->type != eModifierType_Surface) )
 		{
 			uiItemR(row, &ptr, "show_render", 0, "", ICON_NONE);
 			uiItemR(row, &ptr, "show_viewport", 0, "", ICON_NONE);
@@ -771,12 +773,11 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
 				uiItemR(row, &ptr, "show_in_editmode", 0, "", ICON_NONE);
 		}
 
-		if (ob->type==OB_MESH) {
-			if (modifier_couldBeCage(scene, md) && (index <= lastCageIndex))
-			{
+		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,
-						TIP_("Apply modifier to editing cage during Editmode"));
+				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 Editmode"));
 				if (index < cageIndex)
 					uiButSetFlag(but, UI_BUT_DISABLED);
 				uiButSetFunc(but, modifiers_setOnCage, ob, md);
@@ -786,21 +787,22 @@ 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);
 			}
-		} /* tesselation point for curve-typed objects */
+		} /* tessellation point for curve-typed objects */
 		else if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
-			/* some modifiers could work with pre-tesselated curves only */
+			/* some modifiers could work with pre-tessellated curves only */
 			if (ELEM3(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) {
-				/* add disabled pre-tesselated 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,
-						TIP_("This modifier could be applied on splines' points only"));
+				/* 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,
+				                       TIP_("This modifier could be applied on splines' points only"));
 				uiButSetFlag(but, UI_BUT_DISABLED);
-			} else if (mti->type != eModifierTypeType_Constructive) {
-				/* constructive modifiers tesselates curve before applying */
+			}
+			else if (mti->type != eModifierTypeType_Constructive) {
+				/* constructive modifiers tessellates curve before applying */
 				uiItemR(row, &ptr, "use_apply_on_spline", 0, "", ICON_NONE);
 			}
 		}
@@ -828,20 +830,20 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
 	/* modifier settings (under the header) --------------------------------------------------- */
 	if (!isVirtual && (md->mode & eModifierMode_Expanded)) {
 		/* apply/convert/copy */
-		box= uiLayoutBox(column);
-		row= uiLayoutRow(box, 0);
+		box = uiLayoutBox(column);
+		row = uiLayoutRow(box, 0);
 		
 		if (!ELEM(md->type, eModifierType_Collision, eModifierType_Surface)) {
 			/* only here obdata, the rest of modifiers is ob level */
 			uiBlockSetButLock(block, object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
 			
-			if (md->type==eModifierType_ParticleSystem) {
-				ParticleSystem *psys= ((ParticleSystemModifierData *)md)->psys;
+			if (md->type == eModifierType_ParticleSystem) {
+				ParticleSystem *psys = ((ParticleSystemModifierData *)md)->psys;
 				
 				if (!(ob->mode & OB_MODE_PARTICLE_EDIT) && psys->pathcache) {
-					if(ELEM(psys->part->ren_as, PART_DRAW_GR, PART_DRAW_OB))
+					if (ELEM(psys->part->ren_as, PART_DRAW_GR, PART_DRAW_OB))
 						uiItemO(row, "Convert", ICON_NONE, "OBJECT_OT_duplicates_make_real");
-					else if(psys->part->ren_as == PART_DRAW_PATH)
+					else if (psys->part->ren_as == PART_DRAW_PATH)
 						uiItemO(row, "Convert", ICON_NONE, "OBJECT_OT_modifier_convert");
 				}
 			}
@@ -861,12 +863,12 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob,
 		}
 		
 		/* result is the layout block inside the box, that we return so that modifier settings can be drawn */
-		result= uiLayoutColumn(box, 0);
-		block= uiLayoutAbsoluteBlock(box);
+		result = uiLayoutColumn(box, 0);
+		block = uiLayoutAbsoluteBlock(box);
 	}
 	
 	/* error messages */
-	if(md->error) {
+	if (md->error) {
 		box = uiLayoutBox(column);
 		row = uiLayoutRow(box, 0);
 		uiItemL(row, md->error, ICON_ERROR);
@@ -883,15 +885,15 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr)
 	int i, lastCageIndex, cageIndex;
 
 	/* verify we have valid data */
-	if(!RNA_struct_is_a(ptr->type, &RNA_Modifier)) {
+	if (!RNA_struct_is_a(ptr->type, &RNA_Modifier)) {
 		RNA_warning("Expected modifier on object");
 		return NULL;
 	}
 
-	ob= ptr->id.data;
-	md= ptr->data;
+	ob = ptr->id.data;
+	md = ptr->data;
 
-	if(!ob || !(GS(ob->id.name) == ID_OB)) {
+	if (!ob || !(GS(ob->id.name) == ID_OB)) {
 		RNA_warning("Expected modifier on object");
 		return NULL;
 	}
@@ -904,10 +906,10 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr)
 	// XXX virtual modifiers are not accesible for python
 	vmd = modifiers_getVirtualModifierList(ob);
 
-	for(i=0; vmd; i++, vmd=vmd->next) {
-		if(md == vmd)
+	for (i = 0; vmd; i++, vmd = vmd->next) {
+		if (md == vmd)
 			return draw_modifier(layout, scene, ob, md, i, cageIndex, lastCageIndex);
-		else if(vmd->mode & eModifierMode_Virtual)
+		else if (vmd->mode & eModifierMode_Virtual)
 			i--;
 	}
 
@@ -921,42 +923,42 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr)
 #include "BKE_action.h"
 #include "BKE_constraint.h"
 
-#define REDRAWIPO					1
-#define REDRAWNLA					2
-#define REDRAWBUTSOBJECT			3		
-#define REDRAWACTION				4
-#define B_CONSTRAINT_TEST			5
-#define B_CONSTRAINT_CHANGETARGET	6
-#define REMAKEIPO					8
-#define B_DIFF						9
+#define REDRAWIPO                   1
+#define REDRAWNLA                   2
+#define REDRAWBUTSOBJECT            3
+#define REDRAWACTION                4
+#define B_CONSTRAINT_TEST           5
+#define B_CONSTRAINT_CHANGETARGET   6
+#define REMAKEIPO                   8
+#define B_DIFF                      9
 
 static void do_constraint_panels(bContext *C, void *ob_pt, int event)
 {
-	Main *bmain= CTX_data_main(C);
-	Scene *scene= CTX_data_scene(C);
-	Object *ob= (Object *)ob_pt;
-	
-	switch(event) {
-	case B_CONSTRAINT_TEST:
-		break;  // no handling
-	case B_CONSTRAINT_CHANGETARGET:
-		if (ob->pose) ob->pose->flag |= POSE_RECALC;	// checks & sorts pose channels
-		DAG_scene_sort(bmain, scene);
-		break;
-	default:
-		break;
+	Main *bmain = CTX_data_main(C);
+	Scene *scene = CTX_data_scene(C);
+	Object *ob = (Object *)ob_pt;
+
+	switch (event) {
+		case B_CONSTRAINT_TEST:
+			break; // no handling
+		case B_CONSTRAINT_CHANGETARGET:
+			if (ob->pose) ob->pose->flag |= POSE_RECALC;  // checks & sorts pose channels
+			DAG_scene_sort(bmain, scene);
+			break;
+		default:
+			break;
 	}
 
 	// note: RNA updates now call this, commenting else it gets called twice.
 	// if there are problems because of this, then rna needs changed update functions.
 	// 
 	// object_test_constraints(ob);
-	// if(ob->pose) update_pose_constraint_flags(ob->pose);
+	// if (ob->pose) update_pose_constraint_flags(ob->pose);
 	
-	if(ob->type==OB_ARMATURE) DAG_id_tag_update(&ob->id, OB_RECALC_DATA|OB_RECALC_OB);
+	if (ob->type == OB_ARMATURE) DAG_id_tag_update(&ob->id, OB_RECALC_DATA | OB_RECALC_OB);
 	else DAG_id_tag_update(&ob->id, OB_RECALC_OB);
 
-	WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
+	WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob);
 }
 
 static void constraint_active_func(bContext *UNUSED(C), void *ob_v, void *con_v)
@@ -967,17 +969,17 @@ static void constraint_active_func(bContext *UNUSED(C), void *ob_v, void *con_v)
 /* draw panel showing settings for a constraint */
 static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
 {
-	bPoseChannel *pchan= get_active_posechannel(ob);
+	bPoseChannel *pchan = get_active_posechannel(ob);
 	bConstraintTypeInfo *cti;
 	uiBlock *block;
-	uiLayout *result= NULL, *col, *box, *row;
+	uiLayout *result = NULL, *col, *box, *row;
 	PointerRNA ptr;
 	char typestr[32];
-	short proxy_protected, xco=0, yco=0;
+	short proxy_protected, xco = 0, yco = 0;
 	// int rb_col; // UNUSED
 
 	/* get constraint typeinfo */
-	cti= constraint_get_typeinfo(con);
+	cti = constraint_get_typeinfo(con);
 	if (cti == NULL) {
 		/* exception for 'Null' constraint - it doesn't have constraint typeinfo! */
 		BLI_strncpy(typestr, (con->type == CONSTRAINT_TYPE_NULL) ? "Null" : "Unknown", sizeof(typestr));
@@ -987,23 +989,23 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
 		
 	/* determine whether constraint is proxy protected or not */
 	if (proxylocked_constraints_owner(ob, pchan))
-		proxy_protected= (con->flag & CONSTRAINT_PROXY_LOCAL)==0;
+		proxy_protected = (con->flag & CONSTRAINT_PROXY_LOCAL) == 0;
 	else
-		proxy_protected= 0;
+		proxy_protected = 0;
 
 	/* unless button has own callback, it adds this callback to button */
-	block= uiLayoutGetBlock(layout);
+	block = uiLayoutGetBlock(layout);
 	uiBlockSetHandleFunc(block, do_constraint_panels, ob);
 	uiBlockSetFunc(block, constraint_active_func, ob, con);
 
 	RNA_pointer_create(&ob->id, &RNA_Constraint, con, &ptr);
 
-	col= uiLayoutColumn(layout, 1);
+	col = uiLayoutColumn(layout, 1);
 	uiLayoutSetContextPointer(col, "constraint", &ptr);
 
-	box= uiLayoutBox(col);
+	box = uiLayoutBox(col);
 	row = uiLayoutRow(box, 0);
-	block= uiLayoutGetBlock(box);
+	block = uiLayoutGetBlock(box);
 
 	/* Draw constraint header */
 
@@ -1013,12 +1015,12 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
 	uiBlockSetEmboss(block, UI_EMBOSS);
 	
 	/* name */
-	uiDefBut(block, LABEL, B_CONSTRAINT_TEST, typestr, xco+10, yco, 100, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); 
+	uiDefBut(block, LABEL, B_CONSTRAINT_TEST, typestr, xco + 10, yco, 100, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
 
 	if (con->flag & CONSTRAINT_DISABLE)
 		uiLayoutSetRedAlert(row, 1);
 	
-	if(proxy_protected == 0) {
+	if (proxy_protected == 0) {
 		uiItemR(row, &ptr, "name", 0, "", ICON_NONE);
 	}
 	else
@@ -1031,8 +1033,8 @@ 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);
 	}
@@ -1044,20 +1046,20 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
 		 *	as that poses problems when restoring them, so disable the "up" button where
 		 *	it may cause this situation. 
 		 *
-		 * 	Up/Down buttons should only be shown (or not greyed - todo) if they serve some purpose. 
+		 *  Up/Down buttons should only be shown (or not greyed - todo) if they serve some purpose.
 		 */
 		if (proxylocked_constraints_owner(ob, pchan)) {
 			if (con->prev) {
-				prev_proxylock= (con->prev->flag & CONSTRAINT_PROXY_LOCAL) ? 0 : 1;
+				prev_proxylock = (con->prev->flag & CONSTRAINT_PROXY_LOCAL) ? 0 : 1;
 			}
 			else
-				prev_proxylock= 0;
+				prev_proxylock = 0;
 		}
 		else
-			prev_proxylock= 0;
+			prev_proxylock = 0;
 			
-		show_upbut= ((prev_proxylock == 0) && (con->prev));
-		show_downbut= (con->next) ? 1 : 0;
+		show_upbut = ((prev_proxylock == 0) && (con->prev));
+		show_downbut = (con->next) ? 1 : 0;
 		
 		/* enabled */
 		uiBlockSetEmboss(block, UI_EMBOSSN);
@@ -1092,9 +1094,9 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
 		(yco) -= 21;
 	}
 	else {
-		box= uiLayoutBox(col);
-		block= uiLayoutAbsoluteBlock(box);
-		result= box;
+		box = uiLayoutBox(col);
+		block = uiLayoutAbsoluteBlock(box);
+		result = box;
 	}
 
 	/* clear any locks set up for proxies/lib-linking */
@@ -1109,15 +1111,15 @@ uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr)
 	bConstraint *con;
 
 	/* verify we have valid data */
-	if(!RNA_struct_is_a(ptr->type, &RNA_Constraint)) {
+	if (!RNA_struct_is_a(ptr->type, &RNA_Constraint)) {
 		RNA_warning("Expected constraint on object");
 		return NULL;
 	}
 
-	ob= ptr->id.data;
-	con= ptr->data;
+	ob = ptr->id.data;
+	con = ptr->data;
 
-	if(!ob || !(GS(ob->id.name) == ID_OB)) {
+	if (!ob || !(GS(ob->id.name) == ID_OB)) {
 		RNA_warning("Expected constraint on object");
 		return NULL;
 	}
@@ -1125,9 +1127,9 @@ uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr)
 	uiBlockSetButLock(uiLayoutGetBlock(layout), (ob && ob->id.lib), ERROR_LIBDATA_MESSAGE);
 
 	/* hrms, the temporal constraint should not draw! */
-	if(con->type==CONSTRAINT_TYPE_KINEMATIC) {
-		bKinematicConstraint *data= con->data;
-		if(data->flag & CONSTRAINT_IK_TEMP)
+	if (con->type == CONSTRAINT_TYPE_KINEMATIC) {
+		bKinematicConstraint *data = con->data;
+		if (data->flag & CONSTRAINT_IK_TEMP)
 			return NULL;
 	}
 
@@ -1145,9 +1147,9 @@ uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr)
 
 static void do_preview_buttons(bContext *C, void *arg, int event)
 {
-	switch(event) {
+	switch (event) {
 		case B_MATPRV:
-			WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING, arg);
+			WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING, arg);
 			break;
 	}
 }
@@ -1156,54 +1158,54 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M
 {
 	uiLayout *row, *col;
 	uiBlock *block;
-	Material *ma= NULL;
-	Tex *tex = (Tex*)id;
+	Material *ma = NULL;
+	Tex *tex = (Tex *)id;
 	ID *pid, *pparent;
-	short *pr_texture= NULL;
+	short *pr_texture = NULL;
 	PointerRNA material_ptr;
 	PointerRNA texture_ptr;
 
-	if(id && !ELEM4(GS(id->name), ID_MA, ID_TE, ID_WO, ID_LA)) {
+	if (id && !ELEM4(GS(id->name), ID_MA, ID_TE, ID_WO, ID_LA)) {
 		RNA_warning("Expected ID of type material, texture, lamp or world");
 		return;
 	}
 
 	/* decide what to render */
-	pid= id;
-	pparent= NULL;
-
-	if(id && (GS(id->name) == ID_TE)) {
-		if(parent && (GS(parent->name) == ID_MA))
-			pr_texture= &((Material*)parent)->pr_texture;
-		else if(parent && (GS(parent->name) == ID_WO))
-			pr_texture= &((World*)parent)->pr_texture;
-		else if(parent && (GS(parent->name) == ID_LA))
-			pr_texture= &((Lamp*)parent)->pr_texture;
-
-		if(pr_texture) {
-			if(*pr_texture == TEX_PR_OTHER)
-				pid= parent;
-			else if(*pr_texture == TEX_PR_BOTH)
-				pparent= parent;
+	pid = id;
+	pparent = NULL;
+
+	if (id && (GS(id->name) == ID_TE)) {
+		if (parent && (GS(parent->name) == ID_MA))
+			pr_texture = &((Material *)parent)->pr_texture;
+		else if (parent && (GS(parent->name) == ID_WO))
+			pr_texture = &((World *)parent)->pr_texture;
+		else if (parent && (GS(parent->name) == ID_LA))
+			pr_texture = &((Lamp *)parent)->pr_texture;
+
+		if (pr_texture) {
+			if (*pr_texture == TEX_PR_OTHER)
+				pid = parent;
+			else if (*pr_texture == TEX_PR_BOTH)
+				pparent = parent;
 		}
 	}
 
 	/* layout */
-	block= uiLayoutGetBlock(layout);
-	row= uiLayoutRow(layout, 0);
-	col= uiLayoutColumn(row, 0);
+	block = uiLayoutGetBlock(layout);
+	row = uiLayoutRow(layout, 0);
+	col = uiLayoutColumn(row, 0);
 	uiLayoutSetKeepAspect(col, 1);
 	
 	/* add preview */
-	uiDefBut(block, BUT_EXTRA, 0, "", 0, 0, UI_UNIT_X*6, UI_UNIT_Y*6, pid, 0.0, 0.0, 0, 0, "");
+	uiDefBut(block, BUT_EXTRA, 0, "", 0, 0, UI_UNIT_X * 6, UI_UNIT_Y * 6, pid, 0.0, 0.0, 0, 0, "");
 	uiBlockSetDrawExtraFunc(block, ED_preview_draw, pparent, slot);
 	uiBlockSetHandleFunc(block, do_preview_buttons, NULL);
 	
 	/* add buttons */
 	if (pid && show_buttons) {
-		if(GS(pid->name) == ID_MA || (pparent && GS(pparent->name) == ID_MA)) {
-			if(GS(pid->name) == ID_MA) ma= (Material*)pid;
-			else ma= (Material*)pparent;
+		if (GS(pid->name) == ID_MA || (pparent && GS(pparent->name) == ID_MA)) {
+			if (GS(pid->name) == ID_MA) ma = (Material *)pid;
+			else ma = (Material *)pparent;
 			
 			/* Create RNA Pointer */
 			RNA_pointer_create(id, &RNA_Material, ma, &material_ptr);
@@ -1213,22 +1215,22 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M
 			uiItemR(col, &material_ptr, "preview_render_type", UI_ITEM_R_EXPAND, "", ICON_NONE);
 		}
 
-		if(pr_texture) {
+		if (pr_texture) {
 			/* Create RNA Pointer */
 			RNA_pointer_create(id, &RNA_Texture, tex, &texture_ptr);
 			
 			uiLayoutRow(layout, 1);
-			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) {
+			if (*pr_texture != TEX_PR_OTHER) {
 				row = uiLayoutRow(layout, 0);
 				uiItemR(row, &texture_ptr, "use_preview_alpha", 0, NULL, ICON_NONE);
 			}
@@ -1246,11 +1248,11 @@ typedef struct RNAUpdateCb {
 
 static void rna_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg))
 {
-	RNAUpdateCb *cb= (RNAUpdateCb*)arg_cb;
+	RNAUpdateCb *cb = (RNAUpdateCb *)arg_cb;
 
 	/* we call update here on the pointer property, this way the
-	   owner of the curve mapping can still define it's own update
-	   and notifier, even if the CurveMapping struct is shared. */
+	 * owner of the curve mapping can still define it's own update
+	 * and notifier, even if the CurveMapping struct is shared. */
 	RNA_property_update(C, &cb->ptr, cb->prop);
 }
 
@@ -1258,15 +1260,15 @@ static void rna_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg))
 
 static void colorband_add_cb(bContext *C, void *cb_v, void *coba_v)
 {
-	ColorBand *coba= coba_v;
-	float pos= 0.5f;
+	ColorBand *coba = coba_v;
+	float pos = 0.5f;
 
-	if(coba->tot > 1) {
-		if(coba->cur > 0)	pos= (coba->data[coba->cur-1].pos + coba->data[coba->cur].pos) * 0.5f;
-		else				pos= (coba->data[coba->cur+1].pos + coba->data[coba->cur].pos) * 0.5f;
+	if (coba->tot > 1) {
+		if (coba->cur > 0) pos = (coba->data[coba->cur - 1].pos + coba->data[coba->cur].pos) * 0.5f;
+		else pos = (coba->data[coba->cur + 1].pos + coba->data[coba->cur].pos) * 0.5f;
 	}
 
-	if(colorband_element_add(coba, pos)) {
+	if (colorband_element_add(coba, pos)) {
 		rna_update_cb(C, cb_v, NULL);
 		ED_undo_push(C, "Add colorband");	
 	}
@@ -1274,9 +1276,9 @@ static void colorband_add_cb(bContext *C, void *cb_v, void *coba_v)
 
 static void colorband_del_cb(bContext *C, void *cb_v, void *coba_v)
 {
-	ColorBand *coba= coba_v;
+	ColorBand *coba = coba_v;
 
-	if(colorband_element_remove(coba, coba->cur)) {
+	if (colorband_element_remove(coba, coba->cur)) {
 		ED_undo_push(C, "Delete colorband");
 		rna_update_cb(C, cb_v, NULL);
 	}
@@ -1286,19 +1288,19 @@ static void colorband_flip_cb(bContext *C, void *cb_v, void *coba_v)
 {
 	CBData data_tmp[MAXCOLORBAND];
 
-	ColorBand *coba= coba_v;
+	ColorBand *coba = coba_v;
 	int a;
 
-	for(a=0; a<coba->tot; a++) {
-		data_tmp[a]= coba->data[coba->tot - (a + 1)];
+	for (a = 0; a < coba->tot; a++) {
+		data_tmp[a] = coba->data[coba->tot - (a + 1)];
 	}
-	for(a=0; a<coba->tot; a++) {
+	for (a = 0; a < coba->tot; a++) {
 		data_tmp[a].pos = 1.0f - data_tmp[a].pos;
-		coba->data[a]= data_tmp[a];
+		coba->data[a] = data_tmp[a];
 	}
 
 	/* may as well flip the cur*/
-	coba->cur= coba->tot - (coba->cur + 1);
+	coba->cur = coba->tot - (coba->cur + 1);
 
 	ED_undo_push(C, "Flip colorband");
 
@@ -1307,11 +1309,11 @@ static void colorband_flip_cb(bContext *C, void *cb_v, void *coba_v)
 
 static void colorband_update_cb(bContext *UNUSED(C), void *bt_v, void *coba_v)
 {
-	uiBut *bt= bt_v;
-	ColorBand *coba= coba_v;
+	uiBut *bt = bt_v;
+	ColorBand *coba = coba_v;
 
 	/* sneaky update here, we need to sort the colorband points to be in order,
-	   however the RNA pointer then is wrong, so we update it */
+	 * however the RNA pointer then is wrong, so we update it */
 	colorband_update_sort(coba);
 	bt->rnapoin.data = coba->data + coba->cur;
 }
@@ -1321,46 +1323,46 @@ static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand
 {
 	uiBut *bt;
 	uiLayout *row;
-	const int line1_y= yoffs + 65 + UI_UNIT_Y + 2; /* 2 for some space between the buttons */
-	const int line2_y= yoffs + 65;
+	const int line1_y = yoffs + 65 + UI_UNIT_Y + 2; /* 2 for some space between the buttons */
+	const int line2_y = yoffs + 65;
 
-	if(coba==NULL) return;
+	if (coba == NULL) return;
 
-	bt= uiDefBut(block, BUT, 0,	IFACE_("Add"), 0+xoffs,line1_y,40,UI_UNIT_Y, NULL, 0, 0, 0, 0,
-			TIP_("Add a new color stop to the colorband"));
+	bt = uiDefBut(block, BUT, 0, IFACE_("Add"), 0 + xoffs, line1_y, 40, 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"), 45+xoffs,line1_y,45,UI_UNIT_Y, NULL, 0, 0, 0, 0,
-			TIP_("Delete the active position"));
+	bt = uiDefBut(block, BUT, 0, IFACE_("Delete"), 45 + xoffs, line1_y, 45, UI_UNIT_Y, NULL, 0, 0, 0, 0,
+	              TIP_("Delete the active position"));
 	uiButSetNFunc(bt, colorband_del_cb, MEM_dupallocN(cb), coba);
 
 
 	/* 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);
 
-	bt= uiDefBut(block, BUT_COLORBAND, 0, "", 	xoffs,line2_y,300,UI_UNIT_Y, coba, 0, 0, 0, 0, "");
+	bt = uiDefBut(block, BUT_COLORBAND, 0, "",   xoffs, line2_y, 300, UI_UNIT_Y, coba, 0, 0, 0, 0, "");
 	uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
 
 
 
-	if(coba->tot) {
-		CBData *cbd= coba->data + coba->cur;
+	if (coba->tot) {
+		CBData *cbd = coba->data + coba->cur;
 
 		/* better to use rna so we can animate them */
 		PointerRNA ptr;
 		RNA_pointer_create(cb->ptr.id.data, &RNA_ColorRampElement, cbd, &ptr);
-		row= uiLayoutRow(layout, 0);
+		row = uiLayoutRow(layout, 0);
 
 		uiItemR(row, &ptr, "position", 0, "Pos", ICON_NONE);
-		bt= block->buttons.last;
+		bt = block->buttons.last;
 		uiButSetFunc(bt, colorband_update_cb, bt, coba);
 
 		uiItemR(row, &ptr, "color", 0, "", ICON_NONE);
@@ -1371,33 +1373,33 @@ static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand
 static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand *coba, rctf *butr, RNAUpdateCb *cb)
 {
 	uiBut *bt;
-	float unit= (butr->xmax-butr->xmin)/14.0f;
-	float xs= butr->xmin;
+	float unit = (butr->xmax - butr->xmin) / 14.0f;
+	float xs = butr->xmin;
 
 	uiBlockBeginAlign(block);
-	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"));
+	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);
 
-	if(coba->tot) {
-		CBData *cbd= coba->data + coba->cur;
+	if (coba->tot) {
+		CBData *cbd = coba->data + coba->cur;
 		PointerRNA ptr;
 		RNA_pointer_create(cb->ptr.id.data, &RNA_ColorRampElement, cbd, &ptr);
 		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,
-			TIP_("Set interpolation between color stops"));
+	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,
+	               TIP_("Set interpolation between color stops"));
 	uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
 
-	bt= uiDefBut(block, BUT_COLORBAND, 0, "",		xs,butr->ymin,butr->xmax-butr->xmin,UI_UNIT_Y, coba, 0, 0, 0, 0, "");
+	bt = uiDefBut(block, BUT_COLORBAND, 0, "",       xs, butr->ymin, butr->xmax - butr->xmin, UI_UNIT_Y, coba, 0, 0, 0, 0, "");
 	uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
 
 	uiBlockEndAlign(block);
@@ -1405,7 +1407,7 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand
 
 static void colorband_buttons_layout(uiLayout *layout, uiBlock *block, ColorBand *coba, rctf *butr, int small, RNAUpdateCb *cb)
 {
-	if(small)
+	if (small)
 		colorband_buttons_small(layout, block, coba, butr, cb);
 	else
 		colorband_buttons_large(layout, block, coba, 0, 0, cb);
@@ -1413,27 +1415,27 @@ static void colorband_buttons_layout(uiLayout *layout, uiBlock *block, ColorBand
 
 void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, const char *propname, int expand)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
 	PointerRNA cptr;
 	RNAUpdateCb *cb;
 	uiBlock *block;
 	rctf rect;
 
-	if(!prop || RNA_property_type(prop) != PROP_POINTER)
+	if (!prop || RNA_property_type(prop) != PROP_POINTER)
 		return;
 
-	cptr= RNA_property_pointer_get(ptr, prop);
-	if(!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_ColorRamp))
+	cptr = RNA_property_pointer_get(ptr, prop);
+	if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_ColorRamp))
 		return;
 
-	cb= MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb");
-	cb->ptr= *ptr;
-	cb->prop= prop;
+	cb = MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb");
+	cb->ptr = *ptr;
+	cb->prop = prop;
 
-	rect.xmin= 0; rect.xmax= 200;
-	rect.ymin= 0; rect.ymax= 190;
+	rect.xmin = 0; rect.xmax = 200;
+	rect.ymin = 0; rect.ymax = 190;
 
-	block= uiLayoutAbsoluteBlock(layout);
+	block = uiLayoutAbsoluteBlock(layout);
 	colorband_buttons_layout(layout, block, cptr.data, &rect, !expand, cb);
 
 	MEM_freeN(cb);
@@ -1443,7 +1445,7 @@ void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, const char *propname
 
 void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, const char *propname)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
 	PointerRNA cptr;
 	RNAUpdateCb *cb;
 	uiBlock *block;
@@ -1451,28 +1453,28 @@ void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, const char *propname
 	Histogram *hist;
 	rctf rect;
 	
-	if(!prop || RNA_property_type(prop) != PROP_POINTER)
+	if (!prop || RNA_property_type(prop) != PROP_POINTER)
 		return;
 	
-	cptr= RNA_property_pointer_get(ptr, prop);
-	if(!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Histogram))
+	cptr = RNA_property_pointer_get(ptr, prop);
+	if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Histogram))
 		return;
 	
-	cb= MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb");
-	cb->ptr= *ptr;
-	cb->prop= prop;
+	cb = MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb");
+	cb->ptr = *ptr;
+	cb->prop = prop;
 	
-	rect.xmin= 0; rect.xmax= 200;
-	rect.ymin= 0; rect.ymax= 190;
+	rect.xmin = 0; rect.xmax = 200;
+	rect.ymin = 0; rect.ymax = 190;
 	
-	block= uiLayoutAbsoluteBlock(layout);
+	block = uiLayoutAbsoluteBlock(layout);
 	//colorband_buttons_layout(layout, block, cptr.data, &rect, !expand, cb);
 
 	hist = (Histogram *)cptr.data;
 
-	hist->height= (hist->height<=UI_UNIT_Y)?UI_UNIT_Y:hist->height;
+	hist->height = (hist->height <= UI_UNIT_Y) ? UI_UNIT_Y : hist->height;
 
-	bt= uiDefBut(block, HISTOGRAM, 0, "", rect.xmin, rect.ymin, rect.xmax-rect.xmin, hist->height, hist, 0, 0, 0, 0, "");
+	bt = uiDefBut(block, HISTOGRAM, 0, "", rect.xmin, rect.ymin, rect.xmax - rect.xmin, hist->height, hist, 0, 0, 0, 0, "");
 	uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
 
 	MEM_freeN(cb);
@@ -1482,7 +1484,7 @@ void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, const char *propname
 
 void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, const char *propname)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
 	PointerRNA cptr;
 	RNAUpdateCb *cb;
 	uiBlock *block;
@@ -1490,26 +1492,26 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, const char *propname)
 	Scopes *scopes;
 	rctf rect;
 	
-	if(!prop || RNA_property_type(prop) != PROP_POINTER)
+	if (!prop || RNA_property_type(prop) != PROP_POINTER)
 		return;
 	
-	cptr= RNA_property_pointer_get(ptr, prop);
-	if(!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Scopes))
+	cptr = RNA_property_pointer_get(ptr, prop);
+	if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Scopes))
 		return;
 	scopes = (Scopes *)cptr.data;
 	
-	cb= MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb");
-	cb->ptr= *ptr;
-	cb->prop= prop;
+	cb = MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb");
+	cb->ptr = *ptr;
+	cb->prop = prop;
 	
-	rect.xmin= 0; rect.xmax= 200;
-	rect.ymin= 0; rect.ymax= 190;
+	rect.xmin = 0; rect.xmax = 200;
+	rect.ymin = 0; rect.ymax = 190;
 	
-	block= uiLayoutAbsoluteBlock(layout);
+	block = uiLayoutAbsoluteBlock(layout);
 	
-	scopes->wavefrm_height= (scopes->wavefrm_height<=UI_UNIT_Y)?UI_UNIT_Y:scopes->wavefrm_height;
+	scopes->wavefrm_height = (scopes->wavefrm_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->wavefrm_height;
 
-	bt= uiDefBut(block, WAVEFORM, 0, "", rect.xmin, rect.ymin, rect.xmax-rect.xmin, scopes->wavefrm_height, scopes, 0, 0, 0, 0, "");
+	bt = uiDefBut(block, WAVEFORM, 0, "", rect.xmin, rect.ymin, rect.xmax - rect.xmin, scopes->wavefrm_height, scopes, 0, 0, 0, 0, "");
 	(void)bt; // UNUSED
 	
 	MEM_freeN(cb);
@@ -1519,7 +1521,7 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, const char *propname)
 
 void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, const char *propname)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
 	PointerRNA cptr;
 	RNAUpdateCb *cb;
 	uiBlock *block;
@@ -1527,26 +1529,26 @@ void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, const char *propna
 	Scopes *scopes;
 	rctf rect;
 	
-	if(!prop || RNA_property_type(prop) != PROP_POINTER)
+	if (!prop || RNA_property_type(prop) != PROP_POINTER)
 		return;
 	
-	cptr= RNA_property_pointer_get(ptr, prop);
-	if(!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Scopes))
+	cptr = RNA_property_pointer_get(ptr, prop);
+	if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_Scopes))
 		return;
 	scopes = (Scopes *)cptr.data;
 
-	cb= MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb");
-	cb->ptr= *ptr;
-	cb->prop= prop;
+	cb = MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb");
+	cb->ptr = *ptr;
+	cb->prop = prop;
 	
-	rect.xmin= 0; rect.xmax= 200;
-	rect.ymin= 0; rect.ymax= 190;
+	rect.xmin = 0; rect.xmax = 200;
+	rect.ymin = 0; rect.ymax = 190;
 	
-	block= uiLayoutAbsoluteBlock(layout);
+	block = uiLayoutAbsoluteBlock(layout);
 
-	scopes->vecscope_height= (scopes->vecscope_height<=UI_UNIT_Y)?UI_UNIT_Y:scopes->vecscope_height;
+	scopes->vecscope_height = (scopes->vecscope_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->vecscope_height;
 	
-	bt= uiDefBut(block, VECTORSCOPE, 0, "", rect.xmin, rect.ymin, rect.xmax-rect.xmin, scopes->vecscope_height, scopes, 0, 0, 0, 0, "");
+	bt = uiDefBut(block, VECTORSCOPE, 0, "", rect.xmin, rect.ymin, rect.xmax - rect.xmin, scopes->vecscope_height, scopes, 0, 0, 0, 0, "");
 	uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
 	
 	MEM_freeN(cb);
@@ -1561,13 +1563,13 @@ static void curvemap_buttons_zoom_in(bContext *C, void *cumap_v, void *UNUSED(ar
 	float d;
 
 	/* we allow 20 times zoom */
-	if( (cumap->curr.xmax - cumap->curr.xmin) > 0.04f*(cumap->clipr.xmax - cumap->clipr.xmin) ) {
-		d= 0.1154f*(cumap->curr.xmax - cumap->curr.xmin);
-		cumap->curr.xmin+= d;
-		cumap->curr.xmax-= d;
-		d= 0.1154f*(cumap->curr.ymax - cumap->curr.ymin);
-		cumap->curr.ymin+= d;
-		cumap->curr.ymax-= d;
+	if ( (cumap->curr.xmax - cumap->curr.xmin) > 0.04f * (cumap->clipr.xmax - cumap->clipr.xmin) ) {
+		d = 0.1154f * (cumap->curr.xmax - cumap->curr.xmin);
+		cumap->curr.xmin += d;
+		cumap->curr.xmax -= d;
+		d = 0.1154f * (cumap->curr.ymax - cumap->curr.ymin);
+		cumap->curr.ymin += d;
+		cumap->curr.ymax -= d;
 	}
 
 	ED_region_tag_redraw(CTX_wm_region(C));
@@ -1578,33 +1580,33 @@ static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *UNUSED(u
 	CurveMapping *cumap = cumap_v;
 	float d, d1;
 
-	/* we allow 20 times zoom, but dont view outside clip */
-	if( (cumap->curr.xmax - cumap->curr.xmin) < 20.0f*(cumap->clipr.xmax - cumap->clipr.xmin) ) {
-		d= d1= 0.15f*(cumap->curr.xmax - cumap->curr.xmin);
+	/* we allow 20 times zoom, but don't view outside clip */
+	if ( (cumap->curr.xmax - cumap->curr.xmin) < 20.0f * (cumap->clipr.xmax - cumap->clipr.xmin) ) {
+		d = d1 = 0.15f * (cumap->curr.xmax - cumap->curr.xmin);
 
-		if(cumap->flag & CUMA_DO_CLIP) 
-			if(cumap->curr.xmin-d < cumap->clipr.xmin)
-				d1= cumap->curr.xmin - cumap->clipr.xmin;
-		cumap->curr.xmin-= d1;
+		if (cumap->flag & CUMA_DO_CLIP) 
+			if (cumap->curr.xmin - d < cumap->clipr.xmin)
+				d1 = cumap->curr.xmin - cumap->clipr.xmin;
+		cumap->curr.xmin -= d1;
 
-		d1= d;
-		if(cumap->flag & CUMA_DO_CLIP) 
-			if(cumap->curr.xmax+d > cumap->clipr.xmax)
-				d1= -cumap->curr.xmax + cumap->clipr.xmax;
-		cumap->curr.xmax+= d1;
+		d1 = d;
+		if (cumap->flag & CUMA_DO_CLIP) 
+			if (cumap->curr.xmax + d > cumap->clipr.xmax)
+				d1 = -cumap->curr.xmax + cumap->clipr.xmax;
+		cumap->curr.xmax += d1;
 
-		d= d1= 0.15f*(cumap->curr.ymax - cumap->curr.ymin);
+		d = d1 = 0.15f * (cumap->curr.ymax - cumap->curr.ymin);
 
-		if(cumap->flag & CUMA_DO_CLIP) 
-			if(cumap->curr.ymin-d < cumap->clipr.ymin)
-				d1= cumap->curr.ymin - cumap->clipr.ymin;
-		cumap->curr.ymin-= d1;
+		if (cumap->flag & CUMA_DO_CLIP) 
+			if (cumap->curr.ymin - d < cumap->clipr.ymin)
+				d1 = cumap->curr.ymin - cumap->clipr.ymin;
+		cumap->curr.ymin -= d1;
 
-		d1= d;
-		if(cumap->flag & CUMA_DO_CLIP) 
-			if(cumap->curr.ymax+d > cumap->clipr.ymax)
-				d1= -cumap->curr.ymax + cumap->clipr.ymax;
-		cumap->curr.ymax+= d1;
+		d1 = d;
+		if (cumap->flag & CUMA_DO_CLIP) 
+			if (cumap->curr.ymax + d > cumap->clipr.ymax)
+				d1 = -cumap->curr.ymax + cumap->clipr.ymax;
+		cumap->curr.ymax += d1;
 	}
 
 	ED_region_tag_redraw(CTX_wm_region(C));
@@ -1621,7 +1623,7 @@ static void curvemap_buttons_delete(bContext *C, void *cb_v, void *cumap_v)
 {
 	CurveMapping *cumap = cumap_v;
 
-	curvemap_remove(cumap->cm+cumap->cur, SELECT);
+	curvemap_remove(cumap->cm + cumap->cur, SELECT);
 	curvemapping_changed(cumap, 0);
 
 	rna_update_cb(C, cb_v, NULL);
@@ -1633,22 +1635,22 @@ static uiBlock *curvemap_clipping_func(bContext *C, struct ARegion *ar, void *cu
 	CurveMapping *cumap = cumap_v;
 	uiBlock *block;
 	uiBut *bt;
-	float width= 8*UI_UNIT_X;
+	float width = 8 * UI_UNIT_X;
 
 	block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
 
 	/* use this for a fake extra empy space around the buttons */
-	uiDefBut(block, LABEL, 0, "",			-4, 16, width+8, 6*UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
+	uiDefBut(block, LABEL, 0, "",           -4, 16, width + 8, 6 * UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
 
-	bt= uiDefButBitI(block, TOG, CUMA_DO_CLIP, 1, "Use Clipping",	 
-			0,5*UI_UNIT_Y,width,UI_UNIT_Y, &cumap->flag, 0.0, 0.0, 10, 0, "");
+	bt = uiDefButBitI(block, TOG, CUMA_DO_CLIP, 1, "Use Clipping",
+	                  0, 5 * UI_UNIT_Y, width, UI_UNIT_Y, &cumap->flag, 0.0, 0.0, 10, 0, "");
 	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);
 
@@ -1659,17 +1661,17 @@ static uiBlock *curvemap_clipping_func(bContext *C, struct ARegion *ar, void *cu
 static void curvemap_tools_dofunc(bContext *C, void *cumap_v, int event)
 {
 	CurveMapping *cumap = cumap_v;
-	CurveMap *cuma= cumap->cm+cumap->cur;
+	CurveMap *cuma = cumap->cm + cumap->cur;
 
-	switch(event) {
+	switch (event) {
 		case 0: /* reset */
-			curvemap_reset(cuma, &cumap->clipr,	cumap->preset, CURVEMAP_SLOPE_POSITIVE);
+			curvemap_reset(cuma, &cumap->clipr, cumap->preset, CURVEMAP_SLOPE_POSITIVE);
 			curvemapping_changed(cumap, 0);
 			break;
 		case 1:
-			cumap->curr= cumap->clipr;
+			cumap->curr = cumap->clipr;
 			break;
-		case 2:	/* set vector */
+		case 2: /* set vector */
 			curvemap_sethandle(cuma, 1);
 			curvemapping_changed(cumap, 0);
 			break;
@@ -1692,17 +1694,17 @@ static void curvemap_tools_dofunc(bContext *C, void *cumap_v, int event)
 static uiBlock *curvemap_tools_func(bContext *C, struct ARegion *ar, void *cumap_v)
 {
 	uiBlock *block;
-	short yco= 0, menuwidth=10*UI_UNIT_X;
+	short yco = 0, menuwidth = 10 * UI_UNIT_X;
 
-	block= uiBeginBlock(C, ar, __func__, UI_EMBOSS);
+	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);
@@ -1714,15 +1716,15 @@ static uiBlock *curvemap_tools_func(bContext *C, struct ARegion *ar, void *cumap
 static uiBlock *curvemap_brush_tools_func(bContext *C, struct ARegion *ar, void *cumap_v)
 {
 	uiBlock *block;
-	short yco= 0, menuwidth=10*UI_UNIT_X;
+	short yco = 0, menuwidth = 10 * UI_UNIT_X;
 
-	block= uiBeginBlock(C, ar, __func__, UI_EMBOSS);
+	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);
@@ -1742,11 +1744,11 @@ static void curvemap_buttons_reset(bContext *C, void *cb_v, void *cumap_v)
 	int a;
 	
 	cumap->preset = CURVE_PRESET_LINE;
-	for(a=0; a<CM_TOT; a++)
-		curvemap_reset(cumap->cm+a, &cumap->clipr, cumap->preset, CURVEMAP_SLOPE_POSITIVE);
+	for (a = 0; a < CM_TOT; a++)
+		curvemap_reset(cumap->cm + a, &cumap->clipr, cumap->preset, CURVEMAP_SLOPE_POSITIVE);
 	
-	cumap->black[0]=cumap->black[1]=cumap->black[2]= 0.0f;
-	cumap->white[0]=cumap->white[1]=cumap->white[2]= 1.0f;
+	cumap->black[0] = cumap->black[1] = cumap->black[2] = 0.0f;
+	cumap->white[0] = cumap->white[1] = cumap->white[2] = 1.0f;
 	curvemapping_set_black_white(cumap, NULL, NULL);
 	
 	curvemapping_changed(cumap, 0);
@@ -1757,106 +1759,106 @@ 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)
 {
-	CurveMapping *cumap= ptr->data;
+	CurveMapping *cumap = ptr->data;
 	uiLayout *row, *sub, *split;
 	uiBlock *block;
 	uiBut *bt;
-	float dx= UI_UNIT_X;
+	float dx = UI_UNIT_X;
 	int icon, size;
-	int bg=-1;
+	int bg = -1;
 
-	block= uiLayoutGetBlock(layout);
+	block = uiLayoutGetBlock(layout);
 
 	/* curve chooser */
-	row= uiLayoutRow(layout, 0);
+	row = uiLayoutRow(layout, 0);
 
-	if(labeltype=='v') {
+	if (labeltype == 'v') {
 		/* vector */
-		sub= uiLayoutRow(row, 1);
+		sub = uiLayoutRow(row, 1);
 		uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);
 
-		if(cumap->cm[0].curve) {
-			bt= uiDefButI(block, ROW, 0, "X", 0, 0, dx, dx, &cumap->cur, 0.0, 0.0, 0.0, 0.0, "");
+		if (cumap->cm[0].curve) {
+			bt = uiDefButI(block, ROW, 0, "X", 0, 0, dx, dx, &cumap->cur, 0.0, 0.0, 0.0, 0.0, "");
 			uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
 		}
-		if(cumap->cm[1].curve) {
-			bt= uiDefButI(block, ROW, 0, "Y", 0, 0, dx, dx, &cumap->cur, 0.0, 1.0, 0.0, 0.0, "");
+		if (cumap->cm[1].curve) {
+			bt = uiDefButI(block, ROW, 0, "Y", 0, 0, dx, dx, &cumap->cur, 0.0, 1.0, 0.0, 0.0, "");
 			uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
 		}
-		if(cumap->cm[2].curve) {
-			bt= uiDefButI(block, ROW, 0, "Z", 0, 0, dx, dx, &cumap->cur, 0.0, 2.0, 0.0, 0.0, "");
+		if (cumap->cm[2].curve) {
+			bt = uiDefButI(block, ROW, 0, "Z", 0, 0, dx, dx, &cumap->cur, 0.0, 2.0, 0.0, 0.0, "");
 			uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
 		}
 	}
-	else if(labeltype=='c') {
+	else if (labeltype == 'c') {
 		/* color */
-		sub= uiLayoutRow(row, 1);
+		sub = uiLayoutRow(row, 1);
 		uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);
 
-		if(cumap->cm[3].curve) {
-			bt= uiDefButI(block, ROW, 0, "C", 0, 0, dx, dx, &cumap->cur, 0.0, 3.0, 0.0, 0.0, "");
+		if (cumap->cm[3].curve) {
+			bt = uiDefButI(block, ROW, 0, "C", 0, 0, dx, dx, &cumap->cur, 0.0, 3.0, 0.0, 0.0, "");
 			uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
 		}
-		if(cumap->cm[0].curve) {
-			bt= uiDefButI(block, ROW, 0, "R", 0, 0, dx, dx, &cumap->cur, 0.0, 0.0, 0.0, 0.0, "");
+		if (cumap->cm[0].curve) {
+			bt = uiDefButI(block, ROW, 0, "R", 0, 0, dx, dx, &cumap->cur, 0.0, 0.0, 0.0, 0.0, "");
 			uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
 		}
-		if(cumap->cm[1].curve) {
-			bt= uiDefButI(block, ROW, 0, "G", 0, 0, dx, dx, &cumap->cur, 0.0, 1.0, 0.0, 0.0, "");
+		if (cumap->cm[1].curve) {
+			bt = uiDefButI(block, ROW, 0, "G", 0, 0, dx, dx, &cumap->cur, 0.0, 1.0, 0.0, 0.0, "");
 			uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
 		}
-		if(cumap->cm[2].curve) {
-			bt= uiDefButI(block, ROW, 0, "B", 0, 0, dx, dx, &cumap->cur, 0.0, 2.0, 0.0, 0.0, "");
+		if (cumap->cm[2].curve) {
+			bt = uiDefButI(block, ROW, 0, "B", 0, 0, dx, dx, &cumap->cur, 0.0, 2.0, 0.0, 0.0, "");
 			uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
 		}
 	}
 	else if (labeltype == 'h') {
 		/* HSV */
-		sub= uiLayoutRow(row, 1);
+		sub = uiLayoutRow(row, 1);
 		uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_LEFT);
 		
-		if(cumap->cm[0].curve) {
-			bt= uiDefButI(block, ROW, 0, "H", 0, 0, dx, dx, &cumap->cur, 0.0, 0.0, 0.0, 0.0, "");
+		if (cumap->cm[0].curve) {
+			bt = uiDefButI(block, ROW, 0, "H", 0, 0, dx, dx, &cumap->cur, 0.0, 0.0, 0.0, 0.0, "");
 			uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
 		}
-		if(cumap->cm[1].curve) {
-			bt= uiDefButI(block, ROW, 0, "S", 0, 0, dx, dx, &cumap->cur, 0.0, 1.0, 0.0, 0.0, "");
+		if (cumap->cm[1].curve) {
+			bt = uiDefButI(block, ROW, 0, "S", 0, 0, dx, dx, &cumap->cur, 0.0, 1.0, 0.0, 0.0, "");
 			uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
 		}
-		if(cumap->cm[2].curve) {
-			bt= uiDefButI(block, ROW, 0, "V", 0, 0, dx, dx, &cumap->cur, 0.0, 2.0, 0.0, 0.0, "");
+		if (cumap->cm[2].curve) {
+			bt = uiDefButI(block, ROW, 0, "V", 0, 0, dx, dx, &cumap->cur, 0.0, 2.0, 0.0, 0.0, "");
 			uiButSetFunc(bt, curvemap_buttons_redraw, NULL, NULL);
 		}
 	}
 	else
 		uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT);
 	
-	if (labeltype=='h')
+	if (labeltype == 'h')
 		bg = UI_GRAD_H;
 
 	/* operation buttons */
-	sub= uiLayoutRow(row, 1);
+	sub = uiLayoutRow(row, 1);
 
 	uiBlockSetEmboss(block, UI_EMBOSSN);
 
-	bt= uiDefIconBut(block, BUT, 0, ICON_ZOOMIN, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Zoom in"));
+	bt = uiDefIconBut(block, BUT, 0, ICON_ZOOMIN, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Zoom in"));
 	uiButSetFunc(bt, curvemap_buttons_zoom_in, cumap, NULL);
 
-	bt= uiDefIconBut(block, BUT, 0, ICON_ZOOMOUT, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Zoom out"));
+	bt = uiDefIconBut(block, BUT, 0, ICON_ZOOMOUT, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Zoom out"));
 	uiButSetFunc(bt, curvemap_buttons_zoom_out, cumap, NULL);
 
-	if(brush)
-		bt= uiDefIconBlockBut(block, curvemap_brush_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, TIP_("Tools"));
+	if (brush)
+		bt = uiDefIconBlockBut(block, curvemap_brush_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, TIP_("Tools"));
 	else
-		bt= uiDefIconBlockBut(block, curvemap_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, TIP_("Tools"));
+		bt = uiDefIconBlockBut(block, curvemap_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, TIP_("Tools"));
 
 	uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
 
-	if(cumap->flag & CUMA_DO_CLIP) icon= ICON_CLIPUV_HLT; else icon= ICON_CLIPUV_DEHLT;
-	bt= uiDefIconBlockBut(block, curvemap_clipping_func, cumap, 0, icon, 0, 0, dx, dx, TIP_("Clipping Options"));
+	if (cumap->flag & CUMA_DO_CLIP) icon = ICON_CLIPUV_HLT; else icon = ICON_CLIPUV_DEHLT;
+	bt = uiDefIconBlockBut(block, curvemap_clipping_func, cumap, 0, icon, 0, 0, dx, dx, TIP_("Clipping Options"));
 	uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL);
 
-	bt= uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete points"));
+	bt = uiDefIconBut(block, BUT, 0, ICON_X, 0, 0, dx, dx, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Delete points"));
 	uiButSetNFunc(bt, curvemap_buttons_delete, MEM_dupallocN(cb), cumap);
 
 	uiBlockSetEmboss(block, UI_EMBOSS);
@@ -1864,19 +1866,19 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe
 	uiBlockSetNFunc(block, rna_update_cb, MEM_dupallocN(cb), NULL);
 
 	/* curve itself */
-	size= uiLayoutGetWidth(layout);
-	row= uiLayoutRow(layout, 0);
+	size = uiLayoutGetWidth(layout);
+	row = uiLayoutRow(layout, 0);
 	uiDefBut(block, BUT_CURVE, 0, "", 0, 0, size, MIN2(size, 200), cumap, 0.0f, 1.0f, bg, 0, "");
 
 	/* black/white levels */
-	if(levels) {
-		split= uiLayoutSplit(layout, 0, 0);
+	if (levels) {
+		split = uiLayoutSplit(layout, 0, 0);
 		uiItemR(uiLayoutColumn(split, 0), ptr, "black_level", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
 		uiItemR(uiLayoutColumn(split, 0), ptr, "white_level", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
 
 		uiLayoutRow(layout, 0);
-		bt=uiDefBut(block, BUT, 0, IFACE_("Reset"),	0, 0, UI_UNIT_X*10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0,
-				TIP_("Reset Black/White point and curves"));
+		bt = uiDefBut(block, BUT, 0, IFACE_("Reset"), 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0,
+		              TIP_("Reset Black/White point and curves"));
 		uiButSetNFunc(bt, curvemap_buttons_reset, MEM_dupallocN(cb), cumap);
 	}
 
@@ -1886,28 +1888,28 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe
 void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, const char *propname, int type, int levels, int brush)
 {
 	RNAUpdateCb *cb;
-	PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
 	PointerRNA cptr;
 
-	if(!prop) {
+	if (!prop) {
 		RNA_warning("curve property not found: %s.%s",
 		            RNA_struct_identifier(ptr->type), propname);
 		return;
 	}
 
-	if(RNA_property_type(prop) != PROP_POINTER) {
+	if (RNA_property_type(prop) != PROP_POINTER) {
 		RNA_warning("curve is not a pointer: %s.%s",
 		            RNA_struct_identifier(ptr->type), propname);
 		return;
 	}
 
-	cptr= RNA_property_pointer_get(ptr, prop);
-	if(!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_CurveMapping))
+	cptr = RNA_property_pointer_get(ptr, prop);
+	if (!cptr.data || !RNA_struct_is_a(cptr.type, &RNA_CurveMapping))
 		return;
 
-	cb= MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb");
-	cb->ptr= *ptr;
-	cb->prop= prop;
+	cb = MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb");
+	cb->ptr = *ptr;
+	cb->prop = prop;
 
 	curvemap_buttons_layout(layout, &cptr, type, levels, brush, cb);
 
@@ -1916,12 +1918,12 @@ void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, const char *propn
 
 /********************* ColorWheel Template ************************/
 
-#define WHEEL_SIZE	100
+#define WHEEL_SIZE  100
 
 void uiTemplateColorWheel(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);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
+	uiBlock *block = uiLayoutGetBlock(layout);
 	uiLayout *col, *row;
 	uiBut *but;
 	float softmin, softmax, step, precision;
@@ -1934,28 +1936,28 @@ void uiTemplateColorWheel(uiLayout *layout, PointerRNA *ptr, const char *propnam
 	RNA_property_float_ui_range(ptr, prop, &softmin, &softmax, &step, &precision);
 	
 	col = uiLayoutColumn(layout, 0);
-	row= uiLayoutRow(col, 1);
+	row = uiLayoutRow(col, 1);
 	
-	but= uiDefButR_prop(block, HSVCIRCLE, 0, "",	0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, -1, 0.0, 0.0, 0, 0, "");
+	but = uiDefButR_prop(block, HSVCIRCLE, 0, "",   0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, -1, 0.0, 0.0, 0, 0, "");
 
-	if(lock) {
+	if (lock) {
 		but->flag |= UI_BUT_COLOR_LOCK;
 	}
 
-	if(lock_luminosity) {
-		float color[4]; /* incase of alpha */
+	if (lock_luminosity) {
+		float color[4]; /* in case of alpha */
 		but->flag |= UI_BUT_VEC_SIZE_LOCK;
 		RNA_property_float_get_array(ptr, prop, color);
-		but->a2= len_v3(color);
+		but->a2 = len_v3(color);
 	}
 
-	if(cubic)
+	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, "");
+		uiDefButR_prop(block, HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop, -1, softmin, softmax, UI_GRAD_V_ALT, 0, "");
 }
 
 /********************* Layer Buttons Template ************************/
@@ -1964,16 +1966,16 @@ static void handle_layer_buttons(bContext *C, void *arg1, void *arg2)
 {
 	uiBut *but = arg1;
 	int cur = GET_INT_FROM_POINTER(arg2);
-	wmWindow *win= CTX_wm_window(C);
-	int i, tot, shift= win->eventstate->shift;
+	wmWindow *win = CTX_wm_window(C);
+	int i, tot, shift = win->eventstate->shift;
 
-	if(!shift) {
-		tot= RNA_property_array_length(&but->rnapoin, but->rnaprop);
+	if (!shift) {
+		tot = RNA_property_array_length(&but->rnapoin, but->rnaprop);
 		
 		/* Normally clicking only selects one layer */
 		RNA_property_boolean_set_index(&but->rnapoin, but->rnaprop, cur, TRUE);
-		for(i = 0; i < tot; ++i) {
-			if(i != cur)
+		for (i = 0; i < tot; ++i) {
+			if (i != cur)
 				RNA_property_boolean_set_index(&but->rnapoin, but->rnaprop, i, FALSE);
 		}
 	}
@@ -1987,15 +1989,15 @@ static void handle_layer_buttons(bContext *C, void *arg1, void *arg2)
 //	  the array of layer bitflags
 
 void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, const char *propname,
-			  PointerRNA *used_ptr, const char *used_propname, int active_layer)
+                      PointerRNA *used_ptr, const char *used_propname, int active_layer)
 {
 	uiLayout *uRow, *uCol;
-	PropertyRNA *prop, *used_prop= NULL;
+	PropertyRNA *prop, *used_prop = NULL;
 	int groups, cols, layers;
 	int group, col, layer, row;
 	int cols_per_group = 5;
 
-	prop= RNA_struct_find_property(ptr, propname);
+	prop = RNA_struct_find_property(ptr, propname);
 	if (!prop) {
 		RNA_warning("layers property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
 		return;
@@ -2007,47 +2009,47 @@ void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, const char *propname,
 	 *	  the 'remainder' is added to this, as it will be ok to have first row slightly wider if need be
 	 *	- for now, only split into groups if group will have at least 5 items
 	 */
-	layers= RNA_property_array_length(ptr, prop);
-	cols= (layers / 2) + (layers % 2);
-	groups= ((cols / 2) < cols_per_group) ? (1) : (cols / cols_per_group);
+	layers = RNA_property_array_length(ptr, prop);
+	cols = (layers / 2) + (layers % 2);
+	groups = ((cols / 2) < cols_per_group) ? (1) : (cols / cols_per_group);
 
-	if(used_ptr && used_propname) {
-		used_prop= RNA_struct_find_property(used_ptr, used_propname);
+	if (used_ptr && used_propname) {
+		used_prop = RNA_struct_find_property(used_ptr, used_propname);
 		if (!used_prop) {
 			RNA_warning("used layers property not found: %s.%s", RNA_struct_identifier(ptr->type), used_propname);
 			return;
 		}
 
-		if(RNA_property_array_length(used_ptr, used_prop) < layers)
+		if (RNA_property_array_length(used_ptr, used_prop) < layers)
 			used_prop = NULL;
 	}
 	
 	/* layers are laid out going across rows, with the columns being divided into groups */
 	
-	for (group= 0; group < groups; group++) {
-		uCol= uiLayoutColumn(layout, 1);
+	for (group = 0; group < groups; group++) {
+		uCol = uiLayoutColumn(layout, 1);
 		
-		for (row= 0; row < 2; row++) {
+		for (row = 0; row < 2; row++) {
 			uiBlock *block;
 			uiBut *but;
 
-			uRow= uiLayoutRow(uCol, 1);
-			block= uiLayoutGetBlock(uRow);
-			layer= groups*cols_per_group*row + cols_per_group*group;
+			uRow = uiLayoutRow(uCol, 1);
+			block = uiLayoutGetBlock(uRow);
+			layer = groups * cols_per_group * row + cols_per_group * group;
 			
 			/* add layers as toggle buts */
-			for (col= 0; (col < cols_per_group) && (layer < layers); col++, layer++) {
+			for (col = 0; (col < cols_per_group) && (layer < layers); col++, layer++) {
 				int icon = 0;
 				int butlay = 1 << layer;
 
-				if(active_layer & butlay)
+				if (active_layer & butlay)
 					icon = ICON_LAYER_ACTIVE;
-				else if(used_prop && RNA_property_boolean_get_index(used_ptr, used_prop, layer))
+				else if (used_prop && RNA_property_boolean_get_index(used_ptr, used_prop, layer))
 					icon = ICON_LAYER_USED;
 				
-				but= uiDefAutoButR(block, ptr, prop, layer, "", icon, 0, 0, UI_UNIT_X/2, UI_UNIT_Y/2);
+				but = uiDefAutoButR(block, ptr, prop, layer, "", icon, 0, 0, UI_UNIT_X / 2, UI_UNIT_Y / 2);
 				uiButSetFunc(but, handle_layer_buttons, but, SET_INT_IN_POINTER(layer));
-				but->type= TOG;
+				but->type = TOG;
 			}
 		}
 	}
@@ -2058,24 +2060,24 @@ void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, const char *propname,
 
 static int list_item_icon_get(bContext *C, PointerRNA *itemptr, int rnaicon, int big)
 {
-	ID *id= NULL;
+	ID *id = NULL;
 	int icon;
 
-	if(!itemptr->data)
+	if (!itemptr->data)
 		return rnaicon;
 
 	/* try ID, material or texture slot */
-	if(RNA_struct_is_ID(itemptr->type)) {
-		id= itemptr->id.data;
+	if (RNA_struct_is_ID(itemptr->type)) {
+		id = itemptr->id.data;
 	}
-	else if(RNA_struct_is_a(itemptr->type, &RNA_MaterialSlot)) {
-		id= RNA_pointer_get(itemptr, "material").data;
+	else if (RNA_struct_is_a(itemptr->type, &RNA_MaterialSlot)) {
+		id = RNA_pointer_get(itemptr, "material").data;
 	}
-	else if(RNA_struct_is_a(itemptr->type, &RNA_TextureSlot)) {
-		id= RNA_pointer_get(itemptr, "texture").data;
+	else if (RNA_struct_is_a(itemptr->type, &RNA_TextureSlot)) {
+		id = RNA_pointer_get(itemptr, "texture").data;
 	}
-	else if(RNA_struct_is_a(itemptr->type, &RNA_DynamicPaintSurface)) {
-		DynamicPaintSurface *surface= (DynamicPaintSurface*)itemptr->data;
+	else if (RNA_struct_is_a(itemptr->type, &RNA_DynamicPaintSurface)) {
+		DynamicPaintSurface *surface = (DynamicPaintSurface *)itemptr->data;
 
 		if (surface->format == MOD_DPAINT_SURFACE_F_PTEX) return ICON_TEXTURE_SHADED;
 		else if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) return ICON_OUTLINER_DATA_MESH;
@@ -2083,10 +2085,10 @@ static int list_item_icon_get(bContext *C, PointerRNA *itemptr, int rnaicon, int
 	}
 
 	/* get icon from ID */
-	if(id) {
-		icon= ui_id_icon_get(C, id, big);
+	if (id) {
+		icon = ui_id_icon_get(C, id, big);
 
-		if(icon)
+		if (icon)
 			return icon;
 	}
 
@@ -2095,94 +2097,95 @@ static int list_item_icon_get(bContext *C, PointerRNA *itemptr, int rnaicon, int
 
 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);
+	uiBlock *block = uiLayoutGetBlock(layout);
 	uiBut *but;
 	uiLayout *split, *overlap, *sub, *row;
 	char *namebuf;
 	const char *name;
 	int icon;
 
-	overlap= uiLayoutOverlap(layout);
+	overlap = uiLayoutOverlap(layout);
 
 	/* list item behind label & other buttons */
-	sub= uiLayoutRow(overlap, 0);
+	sub = uiLayoutRow(overlap, 0);
 
-	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, 0);
+	sub = uiLayoutRow(overlap, 0);
 
 	/* retrieve icon and name */
-	icon= list_item_icon_get(C, itemptr, rnaicon, 0);
-	if(icon == ICON_NONE || icon == ICON_DOT)
-		icon= 0;
+	icon = list_item_icon_get(C, itemptr, rnaicon, 0);
+	if (icon == ICON_NONE || icon == ICON_DOT)
+		icon = 0;
 
-	namebuf= RNA_struct_name_get_alloc(itemptr, NULL, 0, NULL);
-	name= (namebuf)? namebuf: "";
+	namebuf = RNA_struct_name_get_alloc(itemptr, NULL, 0, NULL);
+	name = (namebuf) ? namebuf : "";
 
 	/* hardcoded types */
-	if(itemptr->type == &RNA_MeshTextureFaceLayer || itemptr->type == &RNA_MeshColorLayer) {
+	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);
 		uiBlockSetEmboss(block, UI_EMBOSS);
 	}
-	else if(RNA_struct_is_a(itemptr->type, &RNA_MaterialTextureSlot)) {
+	else if (RNA_struct_is_a(itemptr->type, &RNA_MaterialTextureSlot)) {
 		uiItemL(sub, name, icon);
 		uiBlockSetEmboss(block, UI_EMBOSS);
 		uiDefButR(block, OPTION, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, ptr, "use_textures", i, 0, 0, 0, 0,  NULL);
 	}
-	else if(RNA_struct_is_a(itemptr->type, &RNA_SceneRenderLayer)) {
+	else if (RNA_struct_is_a(itemptr->type, &RNA_SceneRenderLayer)) {
 		uiItemL(sub, name, icon);
 		uiBlockSetEmboss(block, UI_EMBOSS);
 		uiDefButR(block, OPTION, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "use", 0, 0, 0, 0, 0,  NULL);
 	}
-	else if(RNA_struct_is_a(itemptr->type, &RNA_MaterialSlot)) {
+	else if (RNA_struct_is_a(itemptr->type, &RNA_MaterialSlot)) {
 		/* provision to draw active node name */
 		Material *ma, *manode;
-		Scene *scene= CTX_data_scene(C);
-		Object *ob= (Object*)ptr->id.data;
-		int index= (Material**)itemptr->data - ob->mat;
+		Scene *scene = CTX_data_scene(C);
+		Object *ob = (Object *)ptr->id.data;
+		int index = (Material **)itemptr->data - ob->mat;
 		
 		/* default item with material base name */
 		uiItemL(sub, name, icon);
 		
-		ma= give_current_material(ob, index+1);
-		if (ma && !scene_use_new_shading_nodes(scene)){
-			manode= give_node_material(ma);
-			if(manode) {
+		ma = give_current_material(ob, index + 1);
+		if (ma && !scene_use_new_shading_nodes(scene)) {
+			manode = give_node_material(ma);
+			if (manode) {
 				char str[MAX_ID_NAME + 12];
-				BLI_snprintf(str, sizeof(str), "Node %s", manode->id.name+2);
+				BLI_snprintf(str, sizeof(str), "Node %s", manode->id.name + 2);
 				uiItemL(sub, str, ui_id_icon_get(C, &manode->id, 1));
 			}
-			else if(ma->use_nodes) {
+			else if (ma->use_nodes) {
 				uiItemL(sub, "Node <none>", ICON_NONE);
 			}
 		}
 	}
-	else if(itemptr->type == &RNA_ShapeKey) {
-		Object *ob= (Object*)activeptr->data;
-		Key *key= (Key*)itemptr->id.data;
+	else if (itemptr->type == &RNA_ShapeKey) {
+		Object *ob = (Object *)activeptr->data;
+		Key *key = (Key *)itemptr->id.data;
+		KeyBlock *kb = (KeyBlock *)itemptr->data;
 
-		split= uiLayoutSplit(sub, 0.66f, 0);
+		split = uiLayoutSplit(sub, 0.66f, 0);
 
 		uiItemL(split, name, icon);
 
 		uiBlockSetEmboss(block, UI_EMBOSSN);
-		row= uiLayoutRow(split, 1);
-		if(i == 0 || (key->type != KEY_RELATIVE)) uiItemL(row, "", ICON_NONE);
+		row = uiLayoutRow(split, 1);
+		if (i == 0 || (key->type != KEY_RELATIVE)) uiItemL(row, "", ICON_NONE);
 		else uiItemR(row, itemptr, "value", 0, "", ICON_NONE);
 		uiItemR(row, itemptr, "mute", 0, "", 0);
 
-		if( (key->flag & KEYBLOCK_MUTE) ||
-		    (ob->mode == OB_MODE_EDIT && !((ob->shapeflag & OB_SHAPE_EDIT_MODE) && ob->type == OB_MESH)) )
+		if ((kb->flag & KEYBLOCK_MUTE) ||
+		    (ob->mode == OB_MODE_EDIT && !((ob->shapeflag & OB_SHAPE_EDIT_MODE) && ob->type == OB_MESH)))
 		{
 			uiLayoutSetActive(row, 0);
 		}
 		uiBlockSetEmboss(block, UI_EMBOSS);
 	}
-	else if(itemptr->type == &RNA_VertexGroup) {
-		bDeformGroup *dg= (bDeformGroup *)itemptr->data;
+	else if (itemptr->type == &RNA_VertexGroup) {
+		bDeformGroup *dg = (bDeformGroup *)itemptr->data;
 		uiItemL(sub, name, icon);
 		/* RNA does not allow nice lock icons, use lower level buttons */
 #if 0
@@ -2193,8 +2196,8 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
 		uiBlockSetEmboss(block, UI_EMBOSS);
 #endif
 	}
-	else if(itemptr->type == &RNA_KeyingSetPath) {
-		KS_Path *ksp = (KS_Path*)itemptr->data;
+	else if (itemptr->type == &RNA_KeyingSetPath) {
+		KS_Path *ksp = (KS_Path *)itemptr->data;
 		
 		/* icon needs to be the type of ID which is currently active */
 		RNA_enum_icon_from_value(id_type_items, ksp->idtype, &icon);
@@ -2202,29 +2205,29 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
 		/* nothing else special to do... */
 		uiItemL(sub, name, icon); /* fails, backdrop LISTROW... */
 	}
-	else if(itemptr->type == &RNA_DynamicPaintSurface) {
+	else if (itemptr->type == &RNA_DynamicPaintSurface) {
 		char name_final[96];
 		const char *enum_name;
 		PropertyRNA *prop = RNA_struct_find_property(itemptr, "surface_type");
-		DynamicPaintSurface *surface= (DynamicPaintSurface*)itemptr->data;
+		DynamicPaintSurface *surface = (DynamicPaintSurface *)itemptr->data;
 
 		RNA_property_enum_name(C, itemptr, prop, RNA_property_enum_get(itemptr, prop), &enum_name);
 
-		BLI_snprintf(name_final, sizeof(name_final), "%s (%s)",name,enum_name);
+		BLI_snprintf(name_final, sizeof(name_final), "%s (%s)", name, enum_name);
 		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,
-				0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "show_preview", 0, 0, 0, 0, 0, NULL);
+			              0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "show_preview", 0, 0, 0, 0, 0, NULL);
 			uiBlockSetEmboss(block, UI_EMBOSS);
 		}
 		uiDefButR(block, OPTION, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "is_active", i, 0, 0, 0, 0,  NULL);
 	}
-	else if(itemptr->type == &RNA_MovieTrackingObject) {
-		MovieTrackingObject *tracking_object= (MovieTrackingObject*)itemptr->data;
+	else if (itemptr->type == &RNA_MovieTrackingObject) {
+		MovieTrackingObject *tracking_object = (MovieTrackingObject *)itemptr->data;
 
-		split= uiLayoutSplit(sub, 0.75f, 0);
-		if(tracking_object->flag&TRACKING_OBJECT_CAMERA) {
+		split = uiLayoutSplit(sub, 0.75f, 0);
+		if (tracking_object->flag & TRACKING_OBJECT_CAMERA) {
 			uiItemL(split, name, ICON_CAMERA_DATA);
 		}
 		else {
@@ -2245,11 +2248,11 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
 	 *     integer = IntProperty()
 	 *     string  = StringProperty()
 	 * 
-	 *     # A string of all identifiers (colon-separated) which property’s controls should be
+	 *     # A string of all identifiers (colon-separated) which property's controls should be
 	 *     # displayed in a template_list.
 	 *     template_list_controls = StringProperty(default="integer:bool:string", options={"HIDDEN"})
 	 *
-	 * … you’ll get a numfield for the integer prop, a check box for the bool prop, and a textfield
+	 * ... you'll get a numfield for the integer prop, a check box for the bool prop, and a textfield
 	 * for the string prop, after the name of each item of the collection.
 	 */
 	else if (prop_list_id) {
@@ -2258,22 +2261,22 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
 
 		/* XXX: Check, as sometimes we get an itemptr looking like
 		 *      {id = {data = 0x0}, type = 0x0, data = 0x0}
-		 *      which would obviously produce a sigsev… */
+		 *      which would obviously produce a sigsev... */
 		if (itemptr->type) {
-			/* If the special property is set for the item, and it is a collection… */
-			PropertyRNA *prop_list= RNA_struct_find_property(itemptr, prop_list_id);
+			/* If the special property is set for the item, and it is a collection... */
+			PropertyRNA *prop_list = RNA_struct_find_property(itemptr, prop_list_id);
 
-			if(prop_list && RNA_property_type(prop_list) == PROP_STRING) {
+			if (prop_list && RNA_property_type(prop_list) == PROP_STRING) {
 				int prop_names_len;
 				char *prop_names = RNA_property_string_get_alloc(itemptr, prop_list, NULL, 0, &prop_names_len);
-				char *prop_names_end= prop_names + prop_names_len;
-				char *id= prop_names;
+				char *prop_names_end = prop_names + prop_names_len;
+				char *id = prop_names;
 				char *id_next;
 				while (id < prop_names_end) {
-					if ((id_next= strchr(id, ':'))) *id_next++= '\0';
-					else id_next= prop_names_end;
+					if ((id_next = strchr(id, ':'))) *id_next++ = '\0';
+					else id_next = prop_names_end;
 					uiItemR(row, itemptr, id, 0, NULL, 0);
-					id= id_next;
+					id = id_next;
 				}
 				MEM_freeN(prop_names);
 			}
@@ -2281,7 +2284,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
 	}
 
 	else
-		uiItemL(sub, name, icon); /* fails, backdrop LISTROW... */
+		uiItemL(sub, name, icon);  /* fails, backdrop LISTROW... */
 
 	/* free name */
 	if (namebuf) {
@@ -2292,7 +2295,7 @@ 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)
 {
 	//Scene *scene= CTX_data_scene(C);
-	PropertyRNA *prop= NULL, *activeprop;
+	PropertyRNA *prop = NULL, *activeprop;
 	PropertyType type, activetype;
 	StructRNA *ptype;
 	uiLayout *box, *row, *col;
@@ -2301,71 +2304,71 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
 	Panel *pa;
 	const char *name;
 	char numstr[32];
-	int rnaicon=0, icon=0, i= 0, activei= 0, len= 0, items, found, min, max;
+	int rnaicon = 0, icon = 0, i = 0, activei = 0, len = 0, items, found, min, max;
 
 	/* validate arguments */
-	block= uiLayoutGetBlock(layout);
-	pa= block->panel;
+	block = uiLayoutGetBlock(layout);
+	pa = block->panel;
 
-	if(!pa) {
+	if (!pa) {
 		RNA_warning("Only works inside a panel");
 		return;
 	}
 
-	if(!activeptr->data)
+	if (!activeptr->data)
 		return;
 	
-	if(ptr->data) {
-		prop= RNA_struct_find_property(ptr, propname);
-		if(!prop) {
+	if (ptr->data) {
+		prop = RNA_struct_find_property(ptr, propname);
+		if (!prop) {
 			RNA_warning("Property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
 			return;
 		}
 	}
 
-	activeprop= RNA_struct_find_property(activeptr, activepropname);
-	if(!activeprop) {
+	activeprop = RNA_struct_find_property(activeptr, activepropname);
+	if (!activeprop) {
 		RNA_warning("Property not found: %s.%s", RNA_struct_identifier(ptr->type), activepropname);
 		return;
 	}
 
-	if(prop) {
-		type= RNA_property_type(prop);
-		if(type != PROP_COLLECTION) {
+	if (prop) {
+		type = RNA_property_type(prop);
+		if (type != PROP_COLLECTION) {
 			RNA_warning("uiExpected collection property");
 			return;
 		}
 	}
 
-	activetype= RNA_property_type(activeprop);
-	if(activetype != PROP_INT) {
+	activetype = RNA_property_type(activeprop);
+	if (activetype != PROP_INT) {
 		RNA_warning("Expected integer property");
 		return;
 	}
 
 	/* get icon */
-	if(ptr->data && prop) {
-		ptype= RNA_property_pointer_type(ptr, prop);
-		rnaicon= RNA_struct_ui_icon(ptype);
+	if (ptr->data && prop) {
+		ptype = RNA_property_pointer_type(ptr, prop);
+		rnaicon = RNA_struct_ui_icon(ptype);
 	}
 
 	/* get active data */
-	activei= RNA_property_int_get(activeptr, activeprop);
+	activei = RNA_property_int_get(activeptr, activeprop);
 
-	if(listtype == 'i') {
-		box= uiLayoutListBox(layout, ptr, prop, activeptr, activeprop);
-		col= uiLayoutColumn(box, 1);
-		row= uiLayoutRow(col, 0);
+	if (listtype == 'i') {
+		box = uiLayoutListBox(layout, ptr, prop, activeptr, activeprop);
+		col = uiLayoutColumn(box, 1);
+		row = uiLayoutRow(col, 0);
 
-		if(ptr->data && prop) {
+		if (ptr->data && prop) {
 			/* create list items */
 			RNA_PROP_BEGIN(ptr, itemptr, prop) {
 				/* create button */
-				if(!(i % 9))
-					row= uiLayoutRow(col, 0);
+				if (!(i % 9))
+					row = uiLayoutRow(col, 0);
 
-				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, "");
+				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, "");
 				uiButSetFlag(but, UI_BUT_NO_TOOLTIP);
 				
 
@@ -2374,21 +2377,21 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
 			RNA_PROP_END;
 		}
 	}
-	else if(listtype == 'c') {
+	else if (listtype == 'c') {
 		/* compact layout */
 
-		row= uiLayoutRow(layout, 1);
+		row = uiLayoutRow(layout, 1);
 
-		if(ptr->data && prop) {
+		if (ptr->data && prop) {
 			/* create list items */
 			RNA_PROP_BEGIN(ptr, itemptr, prop) {
-				found= (activei == i);
+				found = (activei == i);
 
-				if(found) {
+				if (found) {
 					/* create button */
-					name= RNA_struct_name_get_alloc(&itemptr, NULL, 0, NULL);
-					icon= list_item_icon_get(C, &itemptr, rnaicon, 0);
-					uiItemL(row, (name)? name: "", icon);
+					name = RNA_struct_name_get_alloc(&itemptr, NULL, 0, NULL);
+					icon = list_item_icon_get(C, &itemptr, rnaicon, 0);
+					uiItemL(row, (name) ? name : "", icon);
 
 					if (name) {
 						MEM_freeN((void *)name);
@@ -2401,50 +2404,50 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
 		}
 
 		/* if not found, add in dummy button */
-		if(i == 0)
+		if (i == 0)
 			uiItemL(row, "", ICON_NONE);
 
 		/* 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, "");
-		if(i == 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);
 	}
 	else {
 		/* default rows */
-		if(rows == 0)
-			rows= 5;
+		if (rows == 0)
+			rows = 5;
 		if (maxrows == 0)
 			maxrows = 5;
-		if(pa->list_grip_size != 0)
-			rows= pa->list_grip_size;
+		if (pa->list_grip_size != 0)
+			rows = pa->list_grip_size;
 
 		/* layout */
-		box= uiLayoutListBox(layout, ptr, prop, activeptr, activeprop);
-		row= uiLayoutRow(box, 0);
+		box = uiLayoutListBox(layout, ptr, prop, activeptr, activeprop);
+		row = uiLayoutRow(box, 0);
 		col = uiLayoutColumn(row, 1);
 
 		/* init numbers */
 		RNA_property_int_range(activeptr, activeprop, &min, &max);
 
-		if(prop)
-			len= RNA_property_collection_length(ptr, prop);
-		items= CLAMPIS(len, rows, MAX2(rows, maxrows));
+		if (prop)
+			len = RNA_property_collection_length(ptr, prop);
+		items = CLAMPIS(len, rows, MAX2(rows, maxrows));
 
 		/* if list length changes and active is out of view, scroll to it */
-		if(pa->list_last_len != len)
-			if((activei < pa->list_scroll || activei >= pa->list_scroll+items))
-				pa->list_scroll= activei;
+		if (pa->list_last_len != len)
+			if ((activei < pa->list_scroll || activei >= pa->list_scroll + items))
+				pa->list_scroll = activei;
 
-		pa->list_scroll= MIN2(pa->list_scroll, len-items);
-		pa->list_scroll= MAX2(pa->list_scroll, 0);
-		pa->list_size= items;
-		pa->list_last_len= len;
+		pa->list_scroll = MIN2(pa->list_scroll, len - items);
+		pa->list_scroll = MAX2(pa->list_scroll, 0);
+		pa->list_size = items;
+		pa->list_last_len = len;
 
-		if(ptr->data && prop) {
+		if (ptr->data && prop) {
 			/* create list items */
 			RNA_PROP_BEGIN(ptr, itemptr, prop) {
-				if(i >= pa->list_scroll && i<pa->list_scroll+items)
+				if (i >= pa->list_scroll && i < pa->list_scroll + items)
 					list_item_row(C, col, ptr, &itemptr, i, rnaicon, activeptr, activeprop, prop_list);
 
 				i++;
@@ -2453,16 +2456,16 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
 		}
 
 		/* add dummy buttons to fill space */
-		while(i < pa->list_scroll+items) {
-			if(i >= pa->list_scroll)
+		while (i < pa->list_scroll + items) {
+			if (i >= pa->list_scroll)
 				uiItemL(col, "", ICON_NONE);
 			i++;
 		}
 
 		/* add scrollbar */
-		if(len > items) {
-			col= uiLayoutColumn(row, 0);
-			uiDefButI(block, SCROLL, 0, "", 0,0,UI_UNIT_X*0.75,UI_UNIT_Y*items, &pa->list_scroll, 0, len-items, items, 0, "");
+		if (len > items) {
+			col = uiLayoutColumn(row, 0);
+			uiDefButI(block, SCROLL, 0, "", 0, 0, UI_UNIT_X * 0.75, UI_UNIT_Y * items, &pa->list_scroll, 0, len - items, items, 0, "");
 		}
 	}
 }
@@ -2471,37 +2474,37 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *
 
 static void operator_call_cb(bContext *C, void *UNUSED(arg1), void *arg2)
 {
-	wmOperatorType *ot= arg2;
+	wmOperatorType *ot = arg2;
 	
-	if(ot)
+	if (ot)
 		WM_operator_name_call(C, ot->idname, WM_OP_INVOKE_DEFAULT, NULL);
 }
 
 static void operator_search_cb(const bContext *C, void *UNUSED(arg), const char *str, uiSearchItems *items)
 {
-	GHashIterator *iter= WM_operatortype_iter();
+	GHashIterator *iter = WM_operatortype_iter();
 
-	for( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
-		wmOperatorType *ot= BLI_ghashIterator_getValue(iter);
+	for (; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
+		wmOperatorType *ot = BLI_ghashIterator_getValue(iter);
 
-		if(BLI_strcasestr(ot->name, str)) {
-			if(WM_operator_poll((bContext*)C, ot)) {
+		if (BLI_strcasestr(ot->name, str)) {
+			if (WM_operator_poll((bContext *)C, ot)) {
 				char name[256];
-				int len= strlen(ot->name);
+				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 (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 + 1], sizeof(name) - len - 1))
 					{
-						name[len]= '|';
+						name[len] = '|';
 					}
 				}
 				
-				if(0==uiSearchItemAdd(items, name, ot, 0))
+				if (0 == uiSearchItemAdd(items, name, ot, 0))
 					break;
 			}
 		}
@@ -2513,29 +2516,29 @@ void uiTemplateOperatorSearch(uiLayout *layout)
 {
 	uiBlock *block;
 	uiBut *but;
-	static char search[256]= "";
+	static char search[256] = "";
 		
-	block= uiLayoutGetBlock(layout);
+	block = uiLayoutGetBlock(layout);
 	uiBlockSetCurLayout(block, layout);
 
-	but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 0, 0, UI_UNIT_X*6, UI_UNIT_Y, 0, 0, "");
+	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);
 }
 
 /************************* Running Jobs Template **************************/
 
-#define B_STOPRENDER	1
-#define B_STOPCAST		2
-#define B_STOPANIM		3
-#define B_STOPCOMPO		4
-#define B_STOPSEQ		5
-#define B_STOPCLIP		6
+#define B_STOPRENDER    1
+#define B_STOPCAST      2
+#define B_STOPANIM      3
+#define B_STOPCOMPO     4
+#define B_STOPSEQ       5
+#define B_STOPCLIP      6
 
 static void do_running_jobs(bContext *C, void *UNUSED(arg), int event)
 {
-	switch(event) {
+	switch (event) {
 		case B_STOPRENDER:
-			G.afbreek= 1;
+			G.afbreek = 1;
 			break;
 		case B_STOPCAST:
 			WM_jobs_stop(CTX_wm_manager(C), CTX_wm_screen(C), NULL);
@@ -2557,59 +2560,62 @@ static void do_running_jobs(bContext *C, void *UNUSED(arg), int event)
 
 void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
 {
-	bScreen *screen= CTX_wm_screen(C);
-	wmWindowManager *wm= CTX_wm_manager(C);
-	ScrArea *sa= CTX_wm_area(C);
+	bScreen *screen = CTX_wm_screen(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
+	ScrArea *sa = CTX_wm_area(C);
 	uiBlock *block;
-	void *owner= NULL;
+	void *owner = NULL;
 	int handle_event;
 	
-	block= uiLayoutGetBlock(layout);
+	block = uiLayoutGetBlock(layout);
 	uiBlockSetCurLayout(block, layout);
 
 	uiBlockSetHandleFunc(block, do_running_jobs, NULL);
 
-	if(sa->spacetype==SPACE_NODE) {
-		if(WM_jobs_test(wm, sa))
-		   owner = sa;
-		handle_event= B_STOPCOMPO;
-	} else if (sa->spacetype==SPACE_SEQ) {
-		if(WM_jobs_test(wm, sa))
+	if (sa->spacetype == SPACE_NODE) {
+		if (WM_jobs_test(wm, sa))
+			owner = sa;
+		handle_event = B_STOPCOMPO;
+	}
+	else if (sa->spacetype == SPACE_SEQ) {
+		if (WM_jobs_test(wm, sa))
 			owner = sa;
 		handle_event = B_STOPSEQ;
-	} else if(sa->spacetype==SPACE_CLIP) {
-		if(WM_jobs_test(wm, sa))
-		   owner = sa;
-		handle_event= B_STOPCLIP;
-	} else {
+	}
+	else if (sa->spacetype == SPACE_CLIP) {
+		if (WM_jobs_test(wm, sa))
+			owner = sa;
+		handle_event = B_STOPCLIP;
+	}
+	else {
 		Scene *scene;
 		/* another scene can be rendering too, for example via compositor */
-		for(scene= CTX_data_main(C)->scene.first; scene; scene= scene->id.next)
-			if(WM_jobs_test(wm, scene))
+		for (scene = CTX_data_main(C)->scene.first; scene; scene = scene->id.next)
+			if (WM_jobs_test(wm, scene))
 				break;
 		owner = scene;
-		handle_event= B_STOPRENDER;
+		handle_event = B_STOPRENDER;
 	}
 
-	if(owner) {
+	if (owner) {
 		uiLayout *ui_abs;
 		
-		ui_abs= uiLayoutAbsolute(layout, 0);
+		ui_abs = uiLayoutAbsolute(layout, 0);
 		(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"));
+		             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"));
+		         UI_UNIT_X, 0, 100, UI_UNIT_Y, NULL, 0.0f, 0.0f, WM_jobs_progress(wm, owner), 0, TIP_("Progress"));
 		
 		uiLayoutRow(layout, 0);
 	}
-	if(WM_jobs_test(wm, screen))
-		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"));
+	if (WM_jobs_test(wm, screen))
+		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"));
 }
 
 /************************* Reports for Last Operator Template **************************/
@@ -2617,50 +2623,50 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
 void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
 {
 	ReportList *reports = CTX_wm_reports(C);
-	Report *report= BKE_reports_last_displayable(reports);
+	Report *report = BKE_reports_last_displayable(reports);
 	ReportTimerInfo *rti;
 	
 	uiLayout *ui_abs;
 	uiBlock *block;
 	uiBut *but;
-	uiStyle *style= UI_GetStyle();
+	uiStyle *style = UI_GetStyle();
 	int width;
-	int icon=0;
+	int icon = 0;
 	
 	/* if the report display has timed out, don't show */
 	if (!reports->reporttimer) return;
 	
-	rti= (ReportTimerInfo *)reports->reporttimer->customdata;
+	rti = (ReportTimerInfo *)reports->reporttimer->customdata;
 	
-	if (!rti || rti->widthfac==0.0f || !report) return;
+	if (!rti || rti->widthfac == 0.0f || !report) return;
 	
-	ui_abs= uiLayoutAbsolute(layout, 0);
-	block= uiLayoutGetBlock(ui_abs);
+	ui_abs = uiLayoutAbsolute(layout, 0);
+	block = uiLayoutGetBlock(ui_abs);
 	
 	width = BLF_width(style->widget.uifont_id, report->message);
-	width = MIN2(rti->widthfac*width, width);
+	width = MIN2(rti->widthfac * width, width);
 	width = MAX2(width, 10);
 	
 	/* make a box around the report to make it stand out */
 	uiBlockBeginAlign(block);
-	but= uiDefBut(block, ROUNDBOX, 0, "", 0, 0, UI_UNIT_X+10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
+	but = uiDefBut(block, ROUNDBOX, 0, "", 0, 0, UI_UNIT_X + 10, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
 	/* set the report's bg color in but->col - ROUNDBOX feature */
 	rgb_float_to_uchar(but->col, rti->col);
-	but->col[3]= 255; 
+	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->col[0]= but->col[1]= but->col[2]= FTOCHAR(rti->greyscale);
-	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->col[0] = but->col[1] = but->col[2] = FTOCHAR(rti->greyscale);
+	but->col[3] = 255;
 
 	uiBlockEndAlign(block);
 	
 	
 	/* icon and report message on top */
-	if(report->type & RPT_ERROR_ALL)
+	if (report->type & RPT_ERROR_ALL)
 		icon = ICON_ERROR;
-	else if(report->type & RPT_WARNING_ALL)
+	else if (report->type & RPT_WARNING_ALL)
 		icon = ICON_ERROR;
-	else if(report->type & RPT_INFO_ALL)
+	else if (report->type & RPT_INFO_ALL)
 		icon = ICON_INFO;
 	
 	/* XXX: temporary operator to dump all reports to a text block, but only if more than 1 report 
@@ -2675,14 +2681,14 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
 
 	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 *************************************/
 
 static void keymap_item_modified(bContext *UNUSED(C), void *kmi_p, void *UNUSED(unused))
 {
-	wmKeyMapItem *kmi= (wmKeyMapItem*)kmi_p;
+	wmKeyMapItem *kmi = (wmKeyMapItem *)kmi_p;
 	WM_keyconfig_update_tag(NULL, kmi);
 }
 
@@ -2692,23 +2698,23 @@ static void template_keymap_item_properties(uiLayout *layout, const char *title,
 
 	uiItemS(layout);
 
-	if(title)
+	if (title)
 		uiItemL(layout, title, ICON_NONE);
 	
-	flow= uiLayoutColumnFlow(layout, 2, 0);
+	flow = uiLayoutColumnFlow(layout, 2, 0);
 
 	RNA_STRUCT_BEGIN(ptr, prop) {
-		int flag= RNA_property_flag(prop);
+		int flag = RNA_property_flag(prop);
 
-		if(flag & PROP_HIDDEN)
+		if (flag & PROP_HIDDEN)
 			continue;
 
 		/* recurse for nested properties */
-		if(RNA_property_type(prop) == PROP_POINTER) {
-			PointerRNA propptr= RNA_property_pointer_get(ptr, prop);
-			const char *name= RNA_property_ui_name(prop);
+		if (RNA_property_type(prop) == PROP_POINTER) {
+			PointerRNA propptr = RNA_property_pointer_get(ptr, prop);
+			const char *name = RNA_property_ui_name(prop);
 
-			if(propptr.data && RNA_struct_is_a(propptr.type, &RNA_OperatorProperties)) {
+			if (propptr.data && RNA_struct_is_a(propptr.type, &RNA_OperatorProperties)) {
 				template_keymap_item_properties(layout, name, &propptr);
 				continue;
 			}
@@ -2722,16 +2728,16 @@ static void template_keymap_item_properties(uiLayout *layout, const char *title,
 
 void uiTemplateKeymapItemProperties(uiLayout *layout, PointerRNA *ptr)
 {
-	PointerRNA propptr= RNA_pointer_get(ptr, "properties");
+	PointerRNA propptr = RNA_pointer_get(ptr, "properties");
 
-	if(propptr.data) {
-		uiBut *but= uiLayoutGetBlock(layout)->buttons.last;
+	if (propptr.data) {
+		uiBut *but = uiLayoutGetBlock(layout)->buttons.last;
 
 		template_keymap_item_properties(layout, NULL, &propptr);
 
 		/* attach callbacks to compensate for missing properties update,
-		   we don't know which keymap (item) is being modified there */
-		for(; but; but=but->next)
+		 * we don't know which keymap (item) is being modified there */
+		for (; but; but = but->next)
 			uiButSetFunc(but, keymap_item_modified, ptr->data, NULL);
 	}
 }
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index 8335668..c903040 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -53,77 +53,77 @@
 
 uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int index, const char *name, int icon, int x1, int y1, int x2, int y2)
 {
-	uiBut *but=NULL;
+	uiBut *but = NULL;
 
-	switch(RNA_property_type(prop)) {
+	switch (RNA_property_type(prop)) {
 		case PROP_BOOLEAN:
 		{
-			int arraylen= RNA_property_array_length(ptr, prop);
+			int arraylen = RNA_property_array_length(ptr, prop);
 
-			if(arraylen && index == -1)
+			if (arraylen && index == -1)
 				return NULL;
 			
-			if(icon && name && name[0] == '\0')
-				but= uiDefIconButR_prop(block, ICONTOG, 0, icon, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
-			else if(icon)
-				but= uiDefIconTextButR_prop(block, ICONTOG, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
+			if (icon && name && name[0] == '\0')
+				but = uiDefIconButR_prop(block, ICONTOG, 0, icon, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
+			else if (icon)
+				but = uiDefIconTextButR_prop(block, ICONTOG, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
 			else
-				but= uiDefButR_prop(block, OPTION, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
+				but = uiDefButR_prop(block, OPTION, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
 			break;
 		}
 		case PROP_INT:
 		case PROP_FLOAT:
 		{
-			int arraylen= RNA_property_array_length(ptr, prop);
+			int arraylen = RNA_property_array_length(ptr, prop);
 
-			if(arraylen && index == -1) {
-				if(ELEM(RNA_property_subtype(prop), PROP_COLOR, PROP_COLOR_GAMMA))
-					but= uiDefButR_prop(block, COL, 0, name, x1, y1, x2, y2, ptr, prop, 0, 0, 0, -1, -1, NULL);
+			if (arraylen && index == -1) {
+				if (ELEM(RNA_property_subtype(prop), PROP_COLOR, PROP_COLOR_GAMMA))
+					but = uiDefButR_prop(block, COL, 0, name, x1, y1, x2, y2, ptr, prop, 0, 0, 0, -1, -1, NULL);
 			}
-			else if(RNA_property_subtype(prop) == PROP_PERCENTAGE || RNA_property_subtype(prop) == PROP_FACTOR)
-				but= uiDefButR_prop(block, NUMSLI, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
+			else if (RNA_property_subtype(prop) == PROP_PERCENTAGE || RNA_property_subtype(prop) == PROP_FACTOR)
+				but = uiDefButR_prop(block, NUMSLI, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
 			else
-				but= uiDefButR_prop(block, NUM, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
+				but = uiDefButR_prop(block, NUM, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
 			break;
 		}
 		case PROP_ENUM:
-			if(icon && name && name[0] == '\0')
-				but= uiDefIconButR_prop(block, MENU, 0, icon, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
-			else if(icon)
-				but= uiDefIconTextButR_prop(block, MENU, 0, icon, NULL, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
+			if (icon && name && name[0] == '\0')
+				but = uiDefIconButR_prop(block, MENU, 0, icon, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
+			else if (icon)
+				but = uiDefIconTextButR_prop(block, MENU, 0, icon, NULL, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
 			else
-				but= uiDefButR_prop(block, MENU, 0, NULL, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
+				but = uiDefButR_prop(block, MENU, 0, NULL, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
 			break;
 		case PROP_STRING:
-			if(icon && name && name[0] == '\0')
-				but= uiDefIconButR_prop(block, TEX, 0, icon, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
-			else if(icon)
-				but= uiDefIconTextButR_prop(block, TEX, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
+			if (icon && name && name[0] == '\0')
+				but = uiDefIconButR_prop(block, TEX, 0, icon, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
+			else if (icon)
+				but = uiDefIconTextButR_prop(block, TEX, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
 			else
-				but= uiDefButR_prop(block, TEX, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
+				but = uiDefButR_prop(block, TEX, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
 			break;
 		case PROP_POINTER: {
 			PointerRNA pptr;
 
-			pptr= RNA_property_pointer_get(ptr, prop);
-			if(!pptr.type)
-				pptr.type= RNA_property_pointer_type(ptr, prop);
-			icon= RNA_struct_ui_icon(pptr.type);
-			if(icon == ICON_DOT)
-				icon= 0;
+			pptr = RNA_property_pointer_get(ptr, prop);
+			if (!pptr.type)
+				pptr.type = RNA_property_pointer_type(ptr, prop);
+			icon = RNA_struct_ui_icon(pptr.type);
+			if (icon == ICON_DOT)
+				icon = 0;
 
-			but= uiDefIconTextButR_prop(block, IDPOIN, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
+			but = uiDefIconTextButR_prop(block, IDPOIN, 0, icon, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
 			break;
 		}
 		case PROP_COLLECTION: {
 			char text[256];
 			BLI_snprintf(text, sizeof(text), IFACE_("%d items"), RNA_property_collection_length(ptr, prop));
-			but= uiDefBut(block, LABEL, 0, text, x1, y1, x2, y2, NULL, 0, 0, 0, 0, NULL);
+			but = uiDefBut(block, LABEL, 0, text, x1, y1, x2, y2, NULL, 0, 0, 0, 0, NULL);
 			uiButSetFlag(but, UI_BUT_DISABLED);
 			break;
 		}
 		default:
-			but= NULL;
+			but = NULL;
 			break;
 	}
 
@@ -135,47 +135,47 @@ int uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, int (*check_prop)(Pointe
 	uiLayout *split, *col;
 	int flag;
 	const char *name;
-	int tot= 0;
+	int tot = 0;
 
 	assert(ELEM3(label_align, '\0', 'H', 'V'));
 
 	RNA_STRUCT_BEGIN(ptr, prop) {
-		flag= RNA_property_flag(prop);
-		if(flag & PROP_HIDDEN || (check_prop && check_prop(ptr, prop)==FALSE))
+		flag = RNA_property_flag(prop);
+		if (flag & PROP_HIDDEN || (check_prop && check_prop(ptr, prop) == FALSE))
 			continue;
 
-		if(label_align != '\0') {
+		if (label_align != '\0') {
 			PropertyType type = RNA_property_type(prop);
 			int is_boolean = (type == PROP_BOOLEAN && !RNA_property_array_check(prop));
 
-			name= RNA_property_ui_name(prop);
+			name = RNA_property_ui_name(prop);
 
-			if(label_align=='V') {
-				col= uiLayoutColumn(layout, 1);
+			if (label_align == 'V') {
+				col = uiLayoutColumn(layout, 1);
 
-				if(!is_boolean)
+				if (!is_boolean)
 					uiItemL(col, name, ICON_NONE);
 			}
-			else if(label_align=='H') {
+			else if (label_align == 'H') {
 				split = uiLayoutSplit(layout, 0.5f, 0);
 
-				col= uiLayoutColumn(split, 0);
-				uiItemL(col, (is_boolean)? "": name, ICON_NONE);
-				col= uiLayoutColumn(split, 0);
+				col = uiLayoutColumn(split, 0);
+				uiItemL(col, (is_boolean) ? "" : name, ICON_NONE);
+				col = uiLayoutColumn(split, 0);
 			}
 			else {
-				col= NULL;
+				col = NULL;
 			}
 
 			/* may meed to add more cases here.
 			 * don't override enum flag names */
 
 			/* name is shown above, empty name for button below */
-			name= (flag & PROP_ENUM_FLAG || is_boolean)? NULL: "";
+			name = (flag & PROP_ENUM_FLAG || is_boolean) ? NULL : "";
 		}
 		else {
-			col= layout;
-			name= NULL; /* no smart label alignment, show default name with button */
+			col = layout;
+			name = NULL; /* no smart label alignment, show default name with button */
 		}
 
 		uiItemFullR(col, ptr, prop, -1, 0, 0, name, ICON_NONE);
@@ -194,24 +194,24 @@ int uiIconFromID(ID *id)
 	PointerRNA ptr;
 	short idcode;
 
-	if(id==NULL)
+	if (id == NULL)
 		return ICON_NONE;
 	
-	idcode= GS(id->name);
+	idcode = GS(id->name);
 
 	/* exception for objects */
-	if(idcode == ID_OB) {
-		ob= (Object*)id;
+	if (idcode == ID_OB) {
+		ob = (Object *)id;
 
-		if(ob->type == OB_EMPTY)
+		if (ob->type == OB_EMPTY)
 			return ICON_EMPTY_DATA;
 		else
 			return uiIconFromID(ob->data);
 	}
 
 	/* otherwise get it through RNA, creating the pointer
-	   will set the right type, also with subclassing */
+	 * will set the right type, also with subclassing */
 	RNA_id_pointer_create(id, &ptr);
 
-	return (ptr.type)? RNA_struct_ui_icon(ptr.type) : ICON_NONE;
+	return (ptr.type) ? RNA_struct_ui_icon(ptr.type) : ICON_NONE;
 }
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index cd0844a..cce0378 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -41,6 +41,7 @@
 #include "BLI_listbase.h"
 #include "BLI_rect.h"
 #include "BLI_string.h"
+#include "BLI_string_utf8.h"
 #include "BLI_utildefines.h"
 
 #include "BKE_context.h"
@@ -62,17 +63,16 @@
 
 /* ************** widget base functions ************** */
 /*
-	 - in: roundbox codes for corner types and radius
-	 - return: array of [size][2][x,y] points, the edges of the roundbox, + UV coords
- 
-	 - draw black box with alpha 0 on exact button boundbox
-	 - for ever AA step:
-		- draw the inner part for a round filled box, with color blend codes or texture coords
-		- draw outline in outline color
-		- draw outer part, bottom half, extruded 1 pixel to bottom, for emboss shadow
-		- draw extra decorations
-	 - draw background color box with alpha 1 on exact button boundbox
- 
+ * - in: roundbox codes for corner types and radius
+ * - return: array of [size][2][x,y] points, the edges of the roundbox, + UV coords
+ *
+ * - draw black box with alpha 0 on exact button boundbox
+ * - for ever AA step:
+ *    - draw the inner part for a round filled box, with color blend codes or texture coords
+ *    - draw outline in outline color
+ *    - draw outer part, bottom half, extruded 1 pixel to bottom, for emboss shadow
+ *    - draw extra decorations
+ * - draw background color box with alpha 1 on exact button boundbox
  */
 
 /* fill this struct with polygon info to draw AA'ed */
@@ -88,7 +88,7 @@ typedef struct uiWidgetTrias {
 
 /* max as used by round_box__edges */
 #define WIDGET_CURVE_RESOLU 9
-#define WIDGET_SIZE_MAX (WIDGET_CURVE_RESOLU*4)
+#define WIDGET_SIZE_MAX (WIDGET_CURVE_RESOLU * 4)
 
 typedef struct uiWidgetBase {
 	
@@ -106,8 +106,8 @@ typedef struct uiWidgetBase {
 } uiWidgetBase;
 
 /* uiWidgetType: for time being only for visual appearance,
-   later, a handling callback can be added too 
-*/
+ * later, a handling callback can be added too 
+ */
 typedef struct uiWidgetType {
 	
 	/* pointer to theme color definition */
@@ -127,62 +127,70 @@ typedef struct uiWidgetType {
 
 /* *********************** draw data ************************** */
 
-static float cornervec[WIDGET_CURVE_RESOLU][2]= {{0.0, 0.0}, {0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169},
-{0.707, 0.293}, {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}, {1.0, 1.0}};
+static float cornervec[WIDGET_CURVE_RESOLU][2] = {{0.0, 0.0}, {0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169},
+												  {0.707, 0.293}, {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}, {1.0, 1.0}};
 
 #define WIDGET_AA_JITTER 8
-static float jit[WIDGET_AA_JITTER][2]= {
-    { 0.468813 , -0.481430}, {-0.155755 , -0.352820},
-    { 0.219306 , -0.238501}, {-0.393286 , -0.110949},
-    {-0.024699 ,  0.013908}, { 0.343805 ,  0.147431},
-    {-0.272855 ,  0.269918}, { 0.095909 ,  0.388710}};
-
-static float num_tria_vert[3][2]= { 
-{-0.352077, 0.532607}, {-0.352077, -0.549313}, {0.330000, -0.008353}};
-
-static unsigned int num_tria_face[1][3]= {
-{0, 1, 2}};
-
-static float scroll_circle_vert[16][2]= {
-{0.382684, 0.923879}, {0.000001, 1.000000}, {-0.382683, 0.923880}, {-0.707107, 0.707107},
-{-0.923879, 0.382684}, {-1.000000, 0.000000}, {-0.923880, -0.382684}, {-0.707107, -0.707107},
-{-0.382683, -0.923880}, {0.000000, -1.000000}, {0.382684, -0.923880}, {0.707107, -0.707107},
-{0.923880, -0.382684}, {1.000000, -0.000000}, {0.923880, 0.382683}, {0.707107, 0.707107}};
-
-static unsigned int scroll_circle_face[14][3]= {
-{0, 1, 2}, {2, 0, 3}, {3, 0, 15}, {3, 15, 4}, {4, 15, 14}, {4, 14, 5}, {5, 14, 13}, {5, 13, 6}, 
-{6, 13, 12}, {6, 12, 7}, {7, 12, 11}, {7, 11, 8}, {8, 11, 10}, {8, 10, 9}};
-
-static float menu_tria_vert[6][2]= {
-{-0.41, 0.16}, {0.41, 0.16}, {0, 0.82}, 
-{0, -0.82}, {-0.41, -0.16}, {0.41, -0.16}};
-
-static unsigned int menu_tria_face[2][3]= {{2, 0, 1}, {3, 5, 4}};
-
-static float check_tria_vert[6][2]= {
-{-0.578579, 0.253369}, 	{-0.392773, 0.412794}, 	{-0.004241, -0.328551}, 
-{-0.003001, 0.034320}, 	{1.055313, 0.864744}, 	{0.866408, 1.026895}};
-
-static unsigned int check_tria_face[4][3]= {
-{3, 2, 4}, {3, 4, 5}, {1, 0, 3}, {0, 2, 3}};
-
-GLubyte checker_stipple_sml[32*32/8] =
-{
-	255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,
-	255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,
-	0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,
-	0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,
-	255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,
-	255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,
-	0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,
-	0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,
+static float jit[WIDGET_AA_JITTER][2] = {
+	{ 0.468813, -0.481430}, {-0.155755, -0.352820},
+	{ 0.219306, -0.238501}, {-0.393286, -0.110949},
+	{-0.024699,  0.013908}, { 0.343805,  0.147431},
+	{-0.272855,  0.269918}, { 0.095909,  0.388710}
+};
+
+static float num_tria_vert[3][2] = {
+	{-0.352077, 0.532607}, {-0.352077, -0.549313}, {0.330000, -0.008353}
+};
+
+static unsigned int num_tria_face[1][3] = {
+	{0, 1, 2}
+};
+
+static float scroll_circle_vert[16][2] = {
+	{0.382684, 0.923879}, {0.000001, 1.000000}, {-0.382683, 0.923880}, {-0.707107, 0.707107},
+	{-0.923879, 0.382684}, {-1.000000, 0.000000}, {-0.923880, -0.382684}, {-0.707107, -0.707107},
+	{-0.382683, -0.923880}, {0.000000, -1.000000}, {0.382684, -0.923880}, {0.707107, -0.707107},
+	{0.923880, -0.382684}, {1.000000, -0.000000}, {0.923880, 0.382683}, {0.707107, 0.707107}
+};
+
+static unsigned int scroll_circle_face[14][3] = {
+	{0, 1, 2}, {2, 0, 3}, {3, 0, 15}, {3, 15, 4}, {4, 15, 14}, {4, 14, 5}, {5, 14, 13}, {5, 13, 6},
+	{6, 13, 12}, {6, 12, 7}, {7, 12, 11}, {7, 11, 8}, {8, 11, 10}, {8, 10, 9}
+};
+
+static float menu_tria_vert[6][2] = {
+	{-0.41, 0.16}, {0.41, 0.16}, {0, 0.82},
+	{0, -0.82}, {-0.41, -0.16}, {0.41, -0.16}
+};
+
+static unsigned int menu_tria_face[2][3] = {{2, 0, 1}, {3, 5, 4}};
+
+static float check_tria_vert[6][2] = {
+	{-0.578579, 0.253369},  {-0.392773, 0.412794},  {-0.004241, -0.328551},
+	{-0.003001, 0.034320},  {1.055313, 0.864744},   {0.866408, 1.026895}
+};
+
+static unsigned int check_tria_face[4][3] = {
+	{3, 2, 4}, {3, 4, 5}, {1, 0, 3}, {0, 2, 3}
+};
+
+GLubyte checker_stipple_sml[32 * 32 / 8] =
+{
+	255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0,
+	255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0,
+	0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255,
+	0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255,
+	255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0,
+	255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0,
+	0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255,
+	0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255,
 };
 
 /* ************************************************* */
 
 void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3)
 {
-	float tri_arr[3][2]= {{x1, y1}, {x2, y2}, {x3, y3}};
+	float tri_arr[3][2] = {{x1, y1}, {x2, y2}, {x3, y3}};
 	float color[4];
 	int j;
 	
@@ -215,7 +223,7 @@ void ui_draw_anti_roundbox(int mode, float minx, float miny, float maxx, float m
 	color[3] *= 0.125f;
 	glColor4fv(color);
 	
-	for (j = 0;  j < WIDGET_AA_JITTER; j++) {
+	for (j = 0; j < WIDGET_AA_JITTER; j++) {
 		glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f);
 		uiDrawBox(mode, minx, miny, maxx, maxy, rad);
 		glTranslatef(-1.0f * jit[j][0], -1.0f * jit[j][1], 0.0f);
@@ -226,14 +234,14 @@ void ui_draw_anti_roundbox(int mode, float minx, float miny, float maxx, float m
 
 static void widget_init(uiWidgetBase *wtb)
 {
-	wtb->totvert= wtb->halfwayvert= 0;
-	wtb->tria1.tot= 0;
-	wtb->tria2.tot= 0;
-	
-	wtb->inner= 1;
-	wtb->outline= 1;
-	wtb->emboss= 1;
-	wtb->shadedir= 1;
+	wtb->totvert = wtb->halfwayvert = 0;
+	wtb->tria1.tot = 0;
+	wtb->tria2.tot = 0;
+
+	wtb->inner = 1;
+	wtb->outline = 1;
+	wtb->emboss = 1;
+	wtb->shadedir = 1;
 }
 
 /* helper call, makes shadow rect, with 'sun' above menu, so only shadow to left/right/bottom */
@@ -242,74 +250,74 @@ static int round_box_shadow_edges(float (*vert)[2], rcti *rect, float rad, int r
 {
 	float vec[WIDGET_CURVE_RESOLU][2];
 	float minx, miny, maxx, maxy;
-	int a, tot= 0;
+	int a, tot = 0;
 	
-	rad+= step;
+	rad += step;
 	
-	if(2.0f*rad > rect->ymax-rect->ymin)
-		rad= 0.5f*(rect->ymax-rect->ymin);
+	if (2.0f * rad > rect->ymax - rect->ymin)
+		rad = 0.5f * (rect->ymax - rect->ymin);
 	
-	minx= rect->xmin-step;
-	miny= rect->ymin-step;
-	maxx= rect->xmax+step;
-	maxy= rect->ymax+step;
+	minx = rect->xmin - step;
+	miny = rect->ymin - step;
+	maxx = rect->xmax + step;
+	maxy = rect->ymax + step;
 	
 	/* mult */
-	for(a=0; a < WIDGET_CURVE_RESOLU; a++) {
-		vec[a][0]= rad*cornervec[a][0]; 
-		vec[a][1]= rad*cornervec[a][1]; 
+	for (a = 0; a < WIDGET_CURVE_RESOLU; a++) {
+		vec[a][0] = rad * cornervec[a][0];
+		vec[a][1] = rad * cornervec[a][1];
 	}
 	
 	/* start with left-top, anti clockwise */
-	if(roundboxalign & UI_CNR_TOP_LEFT) {
-		for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
-			vert[tot][0]= minx+rad-vec[a][0];
-			vert[tot][1]= maxy-vec[a][1];
+	if (roundboxalign & UI_CNR_TOP_LEFT) {
+		for (a = 0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+			vert[tot][0] = minx + rad - vec[a][0];
+			vert[tot][1] = maxy - vec[a][1];
 		}
 	}
 	else {
-		for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
-			vert[tot][0]= minx;
-			vert[tot][1]= maxy;
+		for (a = 0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+			vert[tot][0] = minx;
+			vert[tot][1] = maxy;
 		}
 	}
 	
-	if(roundboxalign & UI_CNR_BOTTOM_LEFT) {
-		for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
-			vert[tot][0]= minx+vec[a][1];
-			vert[tot][1]= miny+rad-vec[a][0];
+	if (roundboxalign & UI_CNR_BOTTOM_LEFT) {
+		for (a = 0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+			vert[tot][0] = minx + vec[a][1];
+			vert[tot][1] = miny + rad - vec[a][0];
 		}
 	}
 	else {
-		for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
-			vert[tot][0]= minx;
-			vert[tot][1]= miny;
+		for (a = 0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+			vert[tot][0] = minx;
+			vert[tot][1] = miny;
 		}
 	}
 	
-	if(roundboxalign & UI_CNR_BOTTOM_RIGHT) {
-		for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
-			vert[tot][0]= maxx-rad+vec[a][0];
-			vert[tot][1]= miny+vec[a][1];
+	if (roundboxalign & UI_CNR_BOTTOM_RIGHT) {
+		for (a = 0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+			vert[tot][0] = maxx - rad + vec[a][0];
+			vert[tot][1] = miny + vec[a][1];
 		}
 	}
 	else {
-		for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
-			vert[tot][0]= maxx;
-			vert[tot][1]= miny;
+		for (a = 0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+			vert[tot][0] = maxx;
+			vert[tot][1] = miny;
 		}
 	}
 	
-	if(roundboxalign & UI_CNR_TOP_RIGHT) {
-		for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
-			vert[tot][0]= maxx-vec[a][1];
-			vert[tot][1]= maxy-rad+vec[a][0];
+	if (roundboxalign & UI_CNR_TOP_RIGHT) {
+		for (a = 0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+			vert[tot][0] = maxx - vec[a][1];
+			vert[tot][1] = maxy - rad + vec[a][0];
 		}
 	}
 	else {
-		for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
-			vert[tot][0]= maxx;
-			vert[tot][1]= maxy;
+		for (a = 0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+			vert[tot][0] = maxx;
+			vert[tot][1] = maxy;
 		}
 	}
 	return tot;
@@ -319,155 +327,155 @@ static int round_box_shadow_edges(float (*vert)[2], rcti *rect, float rad, int r
 static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, float rad, float radi)
 {
 	float vec[WIDGET_CURVE_RESOLU][2], veci[WIDGET_CURVE_RESOLU][2];
-	float minx= rect->xmin, miny= rect->ymin, maxx= rect->xmax, maxy= rect->ymax;
-	float minxi= minx + 1.0f; /* boundbox inner */
-	float maxxi= maxx - 1.0f;
-	float minyi= miny + 1.0f;
-	float maxyi= maxy - 1.0f;
-	float facxi= (maxxi!=minxi) ? 1.0f/(maxxi-minxi) : 0.0f; /* for uv, can divide by zero */
-	float facyi= (maxyi!=minyi) ? 1.0f/(maxyi-minyi) : 0.0f;
-	int a, tot= 0, minsize;
-	const int hnum= ((roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT))==(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT) ||
-	                 (roundboxalign & (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT))==(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT)) ? 1 : 2;
-	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= MIN2((rect->xmax-rect->xmin)*hnum, (rect->ymax-rect->ymin)*vnum);
-	
-	if(2.0f*rad > minsize)
-		rad= 0.5f*minsize;
-
-	if(2.0f*(radi+1.0f) > minsize)
-		radi= 0.5f*minsize - 1.0f;
+	float minx = rect->xmin, miny = rect->ymin, maxx = rect->xmax, maxy = rect->ymax;
+	float minxi = minx + 1.0f; /* boundbox inner */
+	float maxxi = maxx - 1.0f;
+	float minyi = miny + 1.0f;
+	float maxyi = maxy - 1.0f;
+	float facxi = (maxxi != minxi) ? 1.0f / (maxxi - minxi) : 0.0f; /* for uv, can divide by zero */
+	float facyi = (maxyi != minyi) ? 1.0f / (maxyi - minyi) : 0.0f;
+	int a, tot = 0, minsize;
+	const int hnum = ((roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT)) == (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT) ||
+	                  (roundboxalign & (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT)) == (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT)) ? 1 : 2;
+	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 = MIN2((rect->xmax - rect->xmin) * hnum, (rect->ymax - rect->ymin) * vnum);
+	
+	if (2.0f * rad > minsize)
+		rad = 0.5f * minsize;
+
+	if (2.0f * (radi + 1.0f) > minsize)
+		radi = 0.5f * minsize - 1.0f;
 	
 	/* mult */
-	for(a=0; a < WIDGET_CURVE_RESOLU; a++) {
-		veci[a][0]= radi*cornervec[a][0]; 
-		veci[a][1]= radi*cornervec[a][1]; 
-		vec[a][0]= rad*cornervec[a][0]; 
-		vec[a][1]= rad*cornervec[a][1]; 
+	for (a = 0; a < WIDGET_CURVE_RESOLU; a++) {
+		veci[a][0] = radi * cornervec[a][0];
+		veci[a][1] = radi * cornervec[a][1];
+		vec[a][0] = rad * cornervec[a][0];
+		vec[a][1] = rad * cornervec[a][1];
 	}
 	
 	/* corner left-bottom */
-	if(roundboxalign & UI_CNR_BOTTOM_LEFT) {
+	if (roundboxalign & UI_CNR_BOTTOM_LEFT) {
 		
-		for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
-			wt->inner_v[tot][0]= minxi+veci[a][1];
-			wt->inner_v[tot][1]= minyi+radi-veci[a][0];
+		for (a = 0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+			wt->inner_v[tot][0] = minxi + veci[a][1];
+			wt->inner_v[tot][1] = minyi + radi - veci[a][0];
 			
-			wt->outer_v[tot][0]= minx+vec[a][1];
-			wt->outer_v[tot][1]= miny+rad-vec[a][0];
+			wt->outer_v[tot][0] = minx + vec[a][1];
+			wt->outer_v[tot][1] = miny + rad - vec[a][0];
 			
-			wt->inner_uv[tot][0]= facxi*(wt->inner_v[tot][0] - minxi);
-			wt->inner_uv[tot][1]= facyi*(wt->inner_v[tot][1] - minyi);
+			wt->inner_uv[tot][0] = facxi * (wt->inner_v[tot][0] - minxi);
+			wt->inner_uv[tot][1] = facyi * (wt->inner_v[tot][1] - minyi);
 		}
 	}
 	else {
-		wt->inner_v[tot][0]= minxi;
-		wt->inner_v[tot][1]= minyi;
+		wt->inner_v[tot][0] = minxi;
+		wt->inner_v[tot][1] = minyi;
 		
-		wt->outer_v[tot][0]= minx;
-		wt->outer_v[tot][1]= miny;
+		wt->outer_v[tot][0] = minx;
+		wt->outer_v[tot][1] = miny;
 
-		wt->inner_uv[tot][0]= 0.0f;
-		wt->inner_uv[tot][1]= 0.0f;
+		wt->inner_uv[tot][0] = 0.0f;
+		wt->inner_uv[tot][1] = 0.0f;
 		
 		tot++;
 	}
 	
 	/* corner right-bottom */
-	if(roundboxalign & UI_CNR_BOTTOM_RIGHT) {
+	if (roundboxalign & UI_CNR_BOTTOM_RIGHT) {
 		
-		for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
-			wt->inner_v[tot][0]= maxxi-radi+veci[a][0];
-			wt->inner_v[tot][1]= minyi+veci[a][1];
+		for (a = 0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+			wt->inner_v[tot][0] = maxxi - radi + veci[a][0];
+			wt->inner_v[tot][1] = minyi + veci[a][1];
 			
-			wt->outer_v[tot][0]= maxx-rad+vec[a][0];
-			wt->outer_v[tot][1]= miny+vec[a][1];
+			wt->outer_v[tot][0] = maxx - rad + vec[a][0];
+			wt->outer_v[tot][1] = miny + vec[a][1];
 			
-			wt->inner_uv[tot][0]= facxi*(wt->inner_v[tot][0] - minxi);
-			wt->inner_uv[tot][1]= facyi*(wt->inner_v[tot][1] - minyi);
+			wt->inner_uv[tot][0] = facxi * (wt->inner_v[tot][0] - minxi);
+			wt->inner_uv[tot][1] = facyi * (wt->inner_v[tot][1] - minyi);
 		}
 	}
 	else {
-		wt->inner_v[tot][0]= maxxi;
-		wt->inner_v[tot][1]= minyi;
+		wt->inner_v[tot][0] = maxxi;
+		wt->inner_v[tot][1] = minyi;
 		
-		wt->outer_v[tot][0]= maxx;
-		wt->outer_v[tot][1]= miny;
+		wt->outer_v[tot][0] = maxx;
+		wt->outer_v[tot][1] = miny;
 
-		wt->inner_uv[tot][0]= 1.0f;
-		wt->inner_uv[tot][1]= 0.0f;
+		wt->inner_uv[tot][0] = 1.0f;
+		wt->inner_uv[tot][1] = 0.0f;
 		
 		tot++;
 	}
 	
-	wt->halfwayvert= tot;
+	wt->halfwayvert = tot;
 	
 	/* corner right-top */
-	if(roundboxalign & UI_CNR_TOP_RIGHT) {
+	if (roundboxalign & UI_CNR_TOP_RIGHT) {
 		
-		for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
-			wt->inner_v[tot][0]= maxxi-veci[a][1];
-			wt->inner_v[tot][1]= maxyi-radi+veci[a][0];
+		for (a = 0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+			wt->inner_v[tot][0] = maxxi - veci[a][1];
+			wt->inner_v[tot][1] = maxyi - radi + veci[a][0];
 			
-			wt->outer_v[tot][0]= maxx-vec[a][1];
-			wt->outer_v[tot][1]= maxy-rad+vec[a][0];
+			wt->outer_v[tot][0] = maxx - vec[a][1];
+			wt->outer_v[tot][1] = maxy - rad + vec[a][0];
 			
-			wt->inner_uv[tot][0]= facxi*(wt->inner_v[tot][0] - minxi);
-			wt->inner_uv[tot][1]= facyi*(wt->inner_v[tot][1] - minyi);
+			wt->inner_uv[tot][0] = facxi * (wt->inner_v[tot][0] - minxi);
+			wt->inner_uv[tot][1] = facyi * (wt->inner_v[tot][1] - minyi);
 		}
 	}
 	else {
-		wt->inner_v[tot][0]= maxxi;
-		wt->inner_v[tot][1]= maxyi;
+		wt->inner_v[tot][0] = maxxi;
+		wt->inner_v[tot][1] = maxyi;
 		
-		wt->outer_v[tot][0]= maxx;
-		wt->outer_v[tot][1]= maxy;
+		wt->outer_v[tot][0] = maxx;
+		wt->outer_v[tot][1] = maxy;
 		
-		wt->inner_uv[tot][0]= 1.0f;
-		wt->inner_uv[tot][1]= 1.0f;
+		wt->inner_uv[tot][0] = 1.0f;
+		wt->inner_uv[tot][1] = 1.0f;
 		
 		tot++;
 	}
 	
 	/* corner left-top */
-	if(roundboxalign & UI_CNR_TOP_LEFT) {
+	if (roundboxalign & UI_CNR_TOP_LEFT) {
 		
-		for(a=0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
-			wt->inner_v[tot][0]= minxi+radi-veci[a][0];
-			wt->inner_v[tot][1]= maxyi-veci[a][1];
+		for (a = 0; a < WIDGET_CURVE_RESOLU; a++, tot++) {
+			wt->inner_v[tot][0] = minxi + radi - veci[a][0];
+			wt->inner_v[tot][1] = maxyi - veci[a][1];
 			
-			wt->outer_v[tot][0]= minx+rad-vec[a][0];
-			wt->outer_v[tot][1]= maxy-vec[a][1];
+			wt->outer_v[tot][0] = minx + rad - vec[a][0];
+			wt->outer_v[tot][1] = maxy - vec[a][1];
 			
-			wt->inner_uv[tot][0]= facxi*(wt->inner_v[tot][0] - minxi);
-			wt->inner_uv[tot][1]= facyi*(wt->inner_v[tot][1] - minyi);
+			wt->inner_uv[tot][0] = facxi * (wt->inner_v[tot][0] - minxi);
+			wt->inner_uv[tot][1] = facyi * (wt->inner_v[tot][1] - minyi);
 		}
 		
 	}
 	else {
 		
-		wt->inner_v[tot][0]= minxi;
-		wt->inner_v[tot][1]= maxyi;
+		wt->inner_v[tot][0] = minxi;
+		wt->inner_v[tot][1] = maxyi;
 		
-		wt->outer_v[tot][0]= minx;
-		wt->outer_v[tot][1]= maxy;
+		wt->outer_v[tot][0] = minx;
+		wt->outer_v[tot][1] = maxy;
 		
-		wt->inner_uv[tot][0]= 0.0f;
-		wt->inner_uv[tot][1]= 1.0f;
+		wt->inner_uv[tot][0] = 0.0f;
+		wt->inner_uv[tot][1] = 1.0f;
 		
 		tot++;
 	}
 
 	BLI_assert(tot <= WIDGET_SIZE_MAX);
 
-	wt->totvert= tot;
+	wt->totvert = tot;
 }
 
 static void round_box_edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, float rad)
 {
-	round_box__edges(wt, roundboxalign, rect, rad, rad-1.0f);
+	round_box__edges(wt, roundboxalign, rect, rad, rad - 1.0f);
 }
 
 
@@ -475,78 +483,78 @@ static void round_box_edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, flo
 static void widget_num_tria(uiWidgetTrias *tria, rcti *rect, float triasize, char where)
 {
 	float centx, centy, sizex, sizey, minsize;
-	int a, i1=0, i2=1;
+	int a, i1 = 0, i2 = 1;
 	
-	minsize= MIN2(rect->xmax-rect->xmin, rect->ymax-rect->ymin);
+	minsize = MIN2(rect->xmax - rect->xmin, rect->ymax - rect->ymin);
 	
 	/* center position and size */
-	centx= (float)rect->xmin + 0.5f*minsize;
-	centy= (float)rect->ymin + 0.5f*minsize;
-	sizex= sizey= -0.5f*triasize*minsize;
+	centx = (float)rect->xmin + 0.5f * minsize;
+	centy = (float)rect->ymin + 0.5f * minsize;
+	sizex = sizey = -0.5f * triasize * minsize;
 
-	if(where=='r') {
-		centx= (float)rect->xmax - 0.5f*minsize;
-		sizex= -sizex;
+	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 == 't') {
+		centy = (float)rect->ymax - 0.5f * minsize;
+		sizey = -sizey;
+		i2 = 0; i1 = 1;
 	}	
-	else if(where=='b') {
-		sizex= -sizex;
-		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;
-		tria->vec[a][1]= sizey*num_tria_vert[a][i2] + centy;
+	for (a = 0; a < 3; a++) {
+		tria->vec[a][0] = sizex * num_tria_vert[a][i1] + centx;
+		tria->vec[a][1] = sizey * num_tria_vert[a][i2] + centy;
 	}
 	
-	tria->tot= 1;
-	tria->index= num_tria_face;
+	tria->tot = 1;
+	tria->index = num_tria_face;
 }
 
 static void widget_scroll_circle(uiWidgetTrias *tria, rcti *rect, float triasize, char where)
 {
 	float centx, centy, sizex, sizey, minsize;
-	int a, i1=0, i2=1;
+	int a, i1 = 0, i2 = 1;
 	
-	minsize= MIN2(rect->xmax-rect->xmin, rect->ymax-rect->ymin);
+	minsize = MIN2(rect->xmax - rect->xmin, rect->ymax - rect->ymin);
 	
 	/* center position and size */
-	centx= (float)rect->xmin + 0.5f*minsize;
-	centy= (float)rect->ymin + 0.5f*minsize;
-	sizex= sizey= -0.5f*triasize*minsize;
+	centx = (float)rect->xmin + 0.5f * minsize;
+	centy = (float)rect->ymin + 0.5f * minsize;
+	sizex = sizey = -0.5f * triasize * minsize;
 
-	if(where=='r') {
-		centx= (float)rect->xmax - 0.5f*minsize;
-		sizex= -sizex;
+	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 == 't') {
+		centy = (float)rect->ymax - 0.5f * minsize;
+		sizey = -sizey;
+		i2 = 0; i1 = 1;
 	}	
-	else if(where=='b') {
-		sizex= -sizex;
-		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;
-		tria->vec[a][1]= sizey*scroll_circle_vert[a][i2] + centy;
+	for (a = 0; a < 16; a++) {
+		tria->vec[a][0] = sizex * scroll_circle_vert[a][i1] + centx;
+		tria->vec[a][1] = sizey * scroll_circle_vert[a][i2] + centy;
 	}
 	
-	tria->tot= 14;
-	tria->index= scroll_circle_face;
+	tria->tot = 14;
+	tria->index = scroll_circle_face;
 }
 
 static void widget_trias_draw(uiWidgetTrias *tria)
 {
 	glEnableClientState(GL_VERTEX_ARRAY);
 	glVertexPointer(2, GL_FLOAT, 0, tria->vec);
-	glDrawElements(GL_TRIANGLES, tria->tot*3, GL_UNSIGNED_INT, tria->index);
+	glDrawElements(GL_TRIANGLES, tria->tot * 3, GL_UNSIGNED_INT, tria->index);
 	glDisableClientState(GL_VERTEX_ARRAY);
 }
 
@@ -556,22 +564,22 @@ static void widget_menu_trias(uiWidgetTrias *tria, rcti *rect)
 	int a;
 		
 	/* center position and size */
-	centx= rect->xmax - 0.5f*(rect->ymax-rect->ymin);
-	centy= rect->ymin + 0.5f*(rect->ymax-rect->ymin);
-	size= 0.4f*(rect->ymax-rect->ymin);
+	centx = rect->xmax - 0.5f * (rect->ymax - rect->ymin);
+	centy = rect->ymin + 0.5f * (rect->ymax - rect->ymin);
+	size = 0.4f * (rect->ymax - rect->ymin);
 	
 	/* XXX exception */
-	asp= ((float)rect->xmax-rect->xmin)/((float)rect->ymax-rect->ymin);
-	if(asp > 1.2f && asp < 2.6f)
-		centx= rect->xmax - 0.3f*(rect->ymax-rect->ymin);
+	asp = ((float)rect->xmax - rect->xmin) / ((float)rect->ymax - rect->ymin);
+	if (asp > 1.2f && asp < 2.6f)
+		centx = rect->xmax - 0.3f * (rect->ymax - rect->ymin);
 	
-	for(a=0; a<6; a++) {
-		tria->vec[a][0]= size*menu_tria_vert[a][0] + centx;
-		tria->vec[a][1]= size*menu_tria_vert[a][1] + centy;
+	for (a = 0; a < 6; a++) {
+		tria->vec[a][0] = size * menu_tria_vert[a][0] + centx;
+		tria->vec[a][1] = size * menu_tria_vert[a][1] + centy;
 	}
 
-	tria->tot= 2;
-	tria->index= menu_tria_face;
+	tria->tot = 2;
+	tria->index = menu_tria_face;
 }
 
 static void widget_check_trias(uiWidgetTrias *tria, rcti *rect)
@@ -580,17 +588,17 @@ static void widget_check_trias(uiWidgetTrias *tria, rcti *rect)
 	int a;
 	
 	/* center position and size */
-	centx= rect->xmin + 0.5f*(rect->ymax-rect->ymin);
-	centy= rect->ymin + 0.5f*(rect->ymax-rect->ymin);
-	size= 0.5f*(rect->ymax-rect->ymin);
+	centx = rect->xmin + 0.5f * (rect->ymax - rect->ymin);
+	centy = rect->ymin + 0.5f * (rect->ymax - rect->ymin);
+	size = 0.5f * (rect->ymax - rect->ymin);
 	
-	for(a=0; a<6; a++) {
-		tria->vec[a][0]= size*check_tria_vert[a][0] + centx;
-		tria->vec[a][1]= size*check_tria_vert[a][1] + centy;
+	for (a = 0; a < 6; a++) {
+		tria->vec[a][0] = size * check_tria_vert[a][0] + centx;
+		tria->vec[a][1] = size * check_tria_vert[a][1] + centy;
 	}
 	
-	tria->tot= 4;
-	tria->index= check_tria_face;
+	tria->tot = 4;
+	tria->index = check_tria_face;
 }
 
 
@@ -598,58 +606,58 @@ static void widget_check_trias(uiWidgetTrias *tria, rcti *rect)
 static void shadecolors4(char coltop[4], char *coldown, const char *color, short shadetop, short shadedown)
 {
 	
-	coltop[0]= CLAMPIS(color[0]+shadetop, 0, 255);
-	coltop[1]= CLAMPIS(color[1]+shadetop, 0, 255);
-	coltop[2]= CLAMPIS(color[2]+shadetop, 0, 255);
-	coltop[3]= color[3];
+	coltop[0] = CLAMPIS(color[0] + shadetop, 0, 255);
+	coltop[1] = CLAMPIS(color[1] + shadetop, 0, 255);
+	coltop[2] = CLAMPIS(color[2] + shadetop, 0, 255);
+	coltop[3] = color[3];
 
-	coldown[0]= CLAMPIS(color[0]+shadedown, 0, 255);
-	coldown[1]= CLAMPIS(color[1]+shadedown, 0, 255);
-	coldown[2]= CLAMPIS(color[2]+shadedown, 0, 255);
-	coldown[3]= color[3];	
+	coldown[0] = CLAMPIS(color[0] + shadedown, 0, 255);
+	coldown[1] = CLAMPIS(color[1] + shadedown, 0, 255);
+	coldown[2] = CLAMPIS(color[2] + shadedown, 0, 255);
+	coldown[3] = color[3];
 }
 
 static void round_box_shade_col4_r(unsigned char col_r[4], const char col1[4], const char col2[4], const float fac)
 {
-	const int faci= FTOCHAR(fac);
-	const int facm= 255-faci;
+	const int faci = FTOCHAR(fac);
+	const int facm = 255 - faci;
 
-	col_r[0]= (faci*col1[0] + facm*col2[0])>>8;
-	col_r[1]= (faci*col1[1] + facm*col2[1])>>8;
-	col_r[2]= (faci*col1[2] + facm*col2[2])>>8;
-	col_r[3]= (faci*col1[3] + facm*col2[3])>>8;
+	col_r[0] = (faci * col1[0] + facm * col2[0]) >> 8;
+	col_r[1] = (faci * col1[1] + facm * col2[1]) >> 8;
+	col_r[2] = (faci * col1[2] + facm * col2[2]) >> 8;
+	col_r[3] = (faci * col1[3] + facm * col2[3]) >> 8;
 }
 
-static void widget_verts_to_quad_strip(uiWidgetBase *wtb, const int totvert, float quad_strip[WIDGET_SIZE_MAX*2+2][2])
+static void widget_verts_to_quad_strip(uiWidgetBase *wtb, const int totvert, float quad_strip[WIDGET_SIZE_MAX * 2 + 2][2])
 {
 	int a;
-	for(a=0; a<totvert; a++) {
-		copy_v2_v2(quad_strip[a*2], wtb->outer_v[a]);
-		copy_v2_v2(quad_strip[a*2+1], wtb->inner_v[a]);
+	for (a = 0; a < totvert; a++) {
+		copy_v2_v2(quad_strip[a * 2], wtb->outer_v[a]);
+		copy_v2_v2(quad_strip[a * 2 + 1], wtb->inner_v[a]);
 	}
-	copy_v2_v2(quad_strip[a*2], wtb->outer_v[0]);
-	copy_v2_v2(quad_strip[a*2+1], wtb->inner_v[0]);
+	copy_v2_v2(quad_strip[a * 2], wtb->outer_v[0]);
+	copy_v2_v2(quad_strip[a * 2 + 1], wtb->inner_v[0]);
 }
 
-static void widget_verts_to_quad_strip_open(uiWidgetBase *wtb, const int totvert, float quad_strip[WIDGET_SIZE_MAX*2][2])
+static void widget_verts_to_quad_strip_open(uiWidgetBase *wtb, const int totvert, float quad_strip[WIDGET_SIZE_MAX * 2][2])
 {
 	int a;
-	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;
+	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;
 	}
 }
 
 static void widgetbase_outline(uiWidgetBase *wtb)
 {
-	float quad_strip[WIDGET_SIZE_MAX*2+2][2]; /* + 2 because the last pair is wrapped */
+	float quad_strip[WIDGET_SIZE_MAX * 2 + 2][2]; /* + 2 because the last pair is wrapped */
 	widget_verts_to_quad_strip(wtb, wtb->totvert, quad_strip);
 
 	glEnableClientState(GL_VERTEX_ARRAY);
 	glVertexPointer(2, GL_FLOAT, 0, quad_strip);
-	glDrawArrays(GL_QUAD_STRIP, 0, wtb->totvert*2 + 2);
+	glDrawArrays(GL_QUAD_STRIP, 0, wtb->totvert * 2 + 2);
 	glDisableClientState(GL_VERTEX_ARRAY);
 }
 
@@ -660,11 +668,11 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
 	glEnable(GL_BLEND);
 
 	/* backdrop non AA */
-	if(wtb->inner) {
-		if(wcol->shaded==0) {
+	if (wtb->inner) {
+		if (wcol->shaded == 0) {
 			if (wcol->alpha_check) {
 				float inner_v_half[WIDGET_SIZE_MAX][2];
-				float x_mid= 0.0f; /* used for dumb clamping of values */
+				float x_mid = 0.0f; /* used for dumb clamping of values */
 
 				/* dark checkers */
 				glColor4ub(UI_TRANSP_DARK, UI_TRANSP_DARK, UI_TRANSP_DARK, 255);
@@ -688,10 +696,10 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
 				/* alpha fill */
 				glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 
-				glColor4ubv((unsigned char*)wcol->inner);
+				glColor4ubv((unsigned char *)wcol->inner);
 				glEnableClientState(GL_VERTEX_ARRAY);
 
-				for(a=0; a<wtb->totvert; a++) {
+				for (a = 0; a < wtb->totvert; a++) {
 					x_mid += wtb->inner_v[a][0];
 				}
 				x_mid /= wtb->totvert;
@@ -703,9 +711,9 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
 				/* 1/2 solid color */
 				glColor4ub(wcol->inner[0], wcol->inner[1], wcol->inner[2], 255);
 
-				for(a=0; a<wtb->totvert; a++) {
-					inner_v_half[a][0]= MIN2(wtb->inner_v[a][0], x_mid);
-					inner_v_half[a][1]= wtb->inner_v[a][1];
+				for (a = 0; a < wtb->totvert; a++) {
+					inner_v_half[a][0] = MIN2(wtb->inner_v[a][0], x_mid);
+					inner_v_half[a][1] = wtb->inner_v[a][1];
 				}
 
 				glEnableClientState(GL_VERTEX_ARRAY);
@@ -715,7 +723,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
 			}
 			else {
 				/* simple fill */
-				glColor4ubv((unsigned char*)wcol->inner);
+				glColor4ubv((unsigned char *)wcol->inner);
 
 				glEnableClientState(GL_VERTEX_ARRAY);
 				glVertexPointer(2, GL_FLOAT, 0, wtb->inner_v);
@@ -726,12 +734,12 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
 		else {
 			char col1[4], col2[4];
 			unsigned char col_array[WIDGET_SIZE_MAX * 4];
-			unsigned char *col_pt= col_array;
+			unsigned char *col_pt = col_array;
 			
 			shadecolors4(col1, col2, wcol->inner, wcol->shadetop, wcol->shadedown);
 			
 			glShadeModel(GL_SMOOTH);
-			for(a=0; a<wtb->totvert; a++, col_pt += 4) {
+			for (a = 0; a < wtb->totvert; a++, col_pt += 4) {
 				round_box_shade_col4_r(col_pt, col1, col2, wtb->inner_uv[a][wtb->shadedir]);
 			}
 
@@ -748,9 +756,9 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
 	}
 	
 	/* for each AA step */
-	if(wtb->outline) {
-		float quad_strip[WIDGET_SIZE_MAX*2+2][2]; /* + 2 because the last pair is wrapped */
-		float quad_strip_emboss[WIDGET_SIZE_MAX*2][2]; /* only for emboss */
+	if (wtb->outline) {
+		float quad_strip[WIDGET_SIZE_MAX * 2 + 2][2]; /* + 2 because the last pair is wrapped */
+		float quad_strip_emboss[WIDGET_SIZE_MAX * 2][2]; /* only for emboss */
 
 		const unsigned char tcol[4] = {wcol->outline[0],
 		                               wcol->outline[1],
@@ -759,7 +767,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
 
 		widget_verts_to_quad_strip(wtb, wtb->totvert, quad_strip);
 
-		if(wtb->emboss) {
+		if (wtb->emboss) {
 			widget_verts_to_quad_strip_open(wtb, wtb->halfwayvert, quad_strip_emboss);
 		}
 
@@ -772,14 +780,14 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
 			glColor4ubv(tcol);
 
 			glVertexPointer(2, GL_FLOAT, 0, quad_strip);
-			glDrawArrays(GL_QUAD_STRIP, 0, wtb->totvert*2 + 2);
+			glDrawArrays(GL_QUAD_STRIP, 0, wtb->totvert * 2 + 2);
 		
 			/* emboss bottom shadow */
-			if(wtb->emboss) {
+			if (wtb->emboss) {
 				glColor4f(1.0f, 1.0f, 1.0f, 0.02f);
 
 				glVertexPointer(2, GL_FLOAT, 0, quad_strip_emboss);
-				glDrawArrays(GL_QUAD_STRIP, 0, wtb->halfwayvert*2);
+				glDrawArrays(GL_QUAD_STRIP, 0, wtb->halfwayvert * 2);
 			}
 			
 			glTranslatef(-1.0f * jit[j][0], -1.0f * jit[j][1], 0.0f);
@@ -789,7 +797,7 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
 	}
 	
 	/* decoration */
-	if(wtb->tria1.tot || wtb->tria2.tot) {
+	if (wtb->tria1.tot || wtb->tria2.tot) {
 		const unsigned char tcol[4] = {wcol->item[0],
 		                               wcol->item[1],
 		                               wcol->item[2],
@@ -798,11 +806,11 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
 		for (j = 0; j < WIDGET_AA_JITTER; j++) {
 			glTranslatef(1.0f * jit[j][0], 1.0f * jit[j][1], 0.0f);
 
-			if(wtb->tria1.tot) {
+			if (wtb->tria1.tot) {
 				glColor4ubv(tcol);
 				widget_trias_draw(&wtb->tria1);
 			}
-			if(wtb->tria2.tot) {
+			if (wtb->tria2.tot) {
 				glColor4ubv(tcol);
 				widget_trias_draw(&wtb->tria2);
 			}
@@ -817,23 +825,23 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
 
 /* *********************** text/icon ************************************** */
 
-#define PREVIEW_PAD	4
+#define PREVIEW_PAD 4
 
 static void widget_draw_preview(BIFIconID icon, float UNUSED(alpha), rcti *rect)
 {
 	int w, h, size;
 
-	if(icon==ICON_NONE)
+	if (icon == ICON_NONE)
 		return;
 
 	w = rect->xmax - rect->xmin;
 	h = rect->ymax - rect->ymin;
 	size = MIN2(w, h);
-	size -= PREVIEW_PAD*2;	/* padding */
+	size -= PREVIEW_PAD * 2;  /* padding */
 
-	if(size > 0) {
-		int x = rect->xmin + w/2 - size/2;
-		int y = rect->ymin + h/2 - size/2;
+	if (size > 0) {
+		int x = rect->xmin + w / 2 - size / 2;
+		int y = rect->ymin + h / 2 - size / 2;
 
 		UI_icon_draw_preview_aspect_size(x, y, icon, 1.0f, size);
 	}
@@ -849,7 +857,7 @@ static int ui_but_draw_menu_icon(uiBut *but)
 
 static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect)
 {
-	int xs=0, ys=0;
+	int xs = 0, ys = 0;
 	float aspect, height;
 	
 	if (but->flag & UI_ICON_PREVIEW) {
@@ -858,66 +866,67 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect
 	}
 	
 	/* this icon doesn't need draw... */
-	if(icon==ICON_BLANK1 && (but->flag & UI_ICON_SUBMENU)==0) return;
+	if (icon == ICON_BLANK1 && (but->flag & UI_ICON_SUBMENU) == 0) return;
 	
 	/* we need aspect from block, for menus... these buttons are scaled in uiPositionBlock() */
-	aspect= but->block->aspect;
-	if(aspect != but->aspect) {
+	aspect = but->block->aspect;
+	if (aspect != but->aspect) {
 		/* prevent scaling up icon in pupmenu */
 		if (aspect < 1.0f) {			
-			height= UI_DPI_ICON_SIZE;
+			height = UI_DPI_ICON_SIZE;
 			aspect = 1.0f;
 			
 		}
 		else 
-			height= UI_DPI_ICON_SIZE/aspect;
+			height = UI_DPI_ICON_SIZE / aspect;
 	}
 	else
-		height= UI_DPI_ICON_SIZE;
+		height = UI_DPI_ICON_SIZE;
 	
 	/* calculate blend color */
-	if ELEM4(but->type, TOG, ROW, TOGN, LISTROW) {
-		if(but->flag & UI_SELECT);
-		else if(but->flag & UI_ACTIVE);
-		else alpha= 0.5f;
+	if (ELEM4(but->type, TOG, ROW, TOGN, LISTROW)) {
+		if (but->flag & UI_SELECT) ;
+		else if (but->flag & UI_ACTIVE) ;
+		else alpha = 0.5f;
 	}
 	
 	/* extra feature allows more alpha blending */
-	if(but->type==LABEL && but->a1==1.0f) alpha *= but->a2;
+	if (but->type == LABEL && but->a1 == 1.0f) alpha *= but->a2;
 	
 	glEnable(GL_BLEND);
 	
-	if(icon && icon!=ICON_BLANK1) {
-		if(but->flag & UI_ICON_LEFT) {
-			if (but->type==BUT_TOGDUAL) {
+	if (icon && icon != ICON_BLANK1) {
+		if (but->flag & UI_ICON_LEFT) {
+			if (but->type == BUT_TOGDUAL) {
 				if (but->drawstr[0]) {
-					xs= rect->xmin-1;
-				} else {
-					xs= (rect->xmin+rect->xmax- height)/2;
+					xs = rect->xmin - 1;
+				}
+				else {
+					xs = (rect->xmin + rect->xmax - height) / 2;
 				}
 			}
 			else if (but->block->flag & UI_BLOCK_LOOP) {
-				if(but->type==SEARCH_MENU)
-					xs= rect->xmin+4;
+				if (but->type == SEARCH_MENU)
+					xs = rect->xmin + 4;
 				else
-					xs= rect->xmin+1;
+					xs = rect->xmin + 1;
 			}
-			else if ((but->type==ICONROW) || (but->type==ICONTEXTROW)) {
-				xs= rect->xmin+3;
+			else if ((but->type == ICONROW) || (but->type == ICONTEXTROW)) {
+				xs = rect->xmin + 3;
 			}
 			else {
-				xs= rect->xmin+4;
+				xs = rect->xmin + 4;
 			}
-			ys= (rect->ymin+rect->ymax- height)/2;
+			ys = (rect->ymin + rect->ymax - height) / 2;
 		}
 		else {
-			xs= (rect->xmin+rect->xmax- height)/2;
-			ys= (rect->ymin+rect->ymax- height)/2;
+			xs = (rect->xmin + rect->xmax - height) / 2;
+			ys = (rect->ymin + rect->ymax - height) / 2;
 		}
 		
 		/* to indicate draggable */
-		if(but->dragpoin && (but->flag & UI_ACTIVE)) {
-			float rgb[3]= {1.25f, 1.25f, 1.25f};
+		if (but->dragpoin && (but->flag & UI_ACTIVE)) {
+			float rgb[3] = {1.25f, 1.25f, 1.25f};
 			UI_icon_draw_aspect_color(xs, ys, icon, aspect, rgb);
 		}
 		else
@@ -925,8 +934,8 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect
 	}
 
 	if (ui_but_draw_menu_icon(but)) {
-		xs= rect->xmax-17;
-		ys= (rect->ymin+rect->ymax- height)/2;
+		xs = rect->xmax - UI_DPI_ICON_SIZE - 1;
+		ys = (rect->ymin + rect->ymax - height) / 2;
 		
 		UI_icon_draw_aspect(xs, ys, ICON_RIGHTARROW_THIN, aspect, alpha);
 	}
@@ -934,122 +943,147 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, float alpha, rcti *rect
 	glDisable(GL_BLEND);
 }
 
+static void ui_text_clip_give_prev_off(uiBut *but)
+{
+	char *prev_utf8 = BLI_str_find_prev_char_utf8(but->drawstr, but->drawstr + but->ofs);
+	int bytes = but->drawstr + but->ofs - prev_utf8;
+
+	but->ofs -= bytes;
+}
+
+static void ui_text_clip_give_next_off(uiBut *but)
+{
+	char *next_utf8 = BLI_str_find_next_char_utf8(but->drawstr + but->ofs, NULL);
+	int bytes = next_utf8 - (but->drawstr + but->ofs);
+
+	but->ofs += bytes;
+}
+
 /* sets but->ofs to make sure text is correctly visible */
 static void ui_text_leftclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
 {
-	int border= (but->flag & UI_BUT_ALIGN_RIGHT)? 8: 10;
-	int okwidth= rect->xmax-rect->xmin - border;
+	int border = (but->flag & UI_BUT_ALIGN_RIGHT) ? 8 : 10;
+	int okwidth = rect->xmax - rect->xmin - border;
 	
 	if (but->flag & UI_HAS_ICON) okwidth -= UI_DPI_ICON_SIZE;
 	
 	/* need to set this first */
 	uiStyleFontSet(fstyle);
 	
-	if (fstyle->kerning==1)	/* for BLF_width */
+	if (fstyle->kerning == 1) /* for BLF_width */
 		BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
 
 	/* if text editing we define ofs dynamically */
-	if(but->editstr && but->pos >= 0) {
-		if(but->ofs > but->pos)
-			but->ofs= but->pos;
+	if (but->editstr && but->pos >= 0) {
+		if (but->ofs > but->pos)
+			but->ofs = but->pos;
 
-		if(BLF_width(fstyle->uifont_id, but->drawstr) <= okwidth)
+		if (BLF_width(fstyle->uifont_id, but->drawstr) <= okwidth)
 			but->ofs = 0;
 	}
-	else but->ofs= 0;
+	else but->ofs = 0;
 	
-	but->strwidth= BLF_width(fstyle->uifont_id, but->drawstr + but->ofs);
+	but->strwidth = BLF_width(fstyle->uifont_id, but->drawstr + but->ofs);
 	
-	while(but->strwidth > okwidth) {
+	while (but->strwidth > okwidth) {
 		
 		/* textbut exception, clip right when... */
-		if(but->editstr && but->pos >= 0) {
+		if (but->editstr && but->pos >= 0) {
 			float width;
 			char buf[UI_MAX_DRAW_STR];
 			
 			/* copy draw string */
-			BLI_strncpy(buf, but->drawstr, sizeof(buf));
+			BLI_strncpy_utf8(buf, but->drawstr, sizeof(buf));
 			/* string position of cursor */
-			buf[but->pos]= 0;
-			width= BLF_width(fstyle->uifont_id, buf+but->ofs);
+			buf[but->pos] = 0;
+			width = BLF_width(fstyle->uifont_id, buf + but->ofs);
 			
 			/* if cursor is at 20 pixels of right side button we clip left */
-			if(width > okwidth-20)
-				but->ofs++;
+			if (width > okwidth - 20)
+				ui_text_clip_give_next_off(but);
 			else {
+				int len, bytes;
 				/* shift string to the left */
-				if(width < 20 && but->ofs > 0)
-					but->ofs--;
-				but->drawstr[ strlen(but->drawstr)-1 ]= 0;
+				if (width < 20 && but->ofs > 0)
+					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));
+				but->drawstr[len - bytes] = 0;
 			}
 		}
 		else
-			but->ofs++;
+			ui_text_clip_give_next_off(but);
 
-		but->strwidth= BLF_width(fstyle->uifont_id, but->drawstr+but->ofs);
+		but->strwidth = BLF_width(fstyle->uifont_id, but->drawstr + but->ofs);
 		
-		if(but->strwidth < 10) break;
+		if (but->strwidth < 10) break;
 	}
 	
-	if (fstyle->kerning==1)
+	if (fstyle->kerning == 1)
 		BLF_disable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
 }
 
 static void ui_text_label_rightclip(uiFontStyle *fstyle, uiBut *but, rcti *rect)
 {
-	int border= (but->flag & UI_BUT_ALIGN_RIGHT)? 8: 10;
-	int okwidth= rect->xmax-rect->xmin - border;
-	char *cpoin=NULL;
+	int border = (but->flag & UI_BUT_ALIGN_RIGHT) ? 8 : 10;
+	int okwidth = rect->xmax - rect->xmin - border;
+	char *cpoin = NULL;
 	char *cpend = but->drawstr + strlen(but->drawstr);
 	
 	/* need to set this first */
 	uiStyleFontSet(fstyle);
 	
-	if (fstyle->kerning==1)	/* for BLF_width */
+	if (fstyle->kerning == 1) /* for BLF_width */
 		BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
 	
-	but->strwidth= BLF_width(fstyle->uifont_id, but->drawstr);
-	but->ofs= 0;
+	but->strwidth = BLF_width(fstyle->uifont_id, but->drawstr);
+	but->ofs = 0;
 	
 	/* find the space after ':' separator */
-	cpoin= strrchr(but->drawstr, ':');
+	cpoin = strrchr(but->drawstr, ':');
 	
-	if (cpoin && (cpoin < cpend-2)) {
+	if (cpoin && (cpoin < cpend - 2)) {
 		char *cp2 = cpoin;
 		
 		/* chop off the leading text, starting from the right */
 		while (but->strwidth > okwidth && cp2 > but->drawstr) {
+			int bytes = BLI_str_utf8_size(cp2);
+			if (bytes < 0)
+				bytes = 1;
+
 			/* shift the text after and including cp2 back by 1 char, +1 to include null terminator */
-			memmove(cp2-1, cp2, strlen(cp2)+1);
-			cp2--;
+			memmove(cp2 - bytes, cp2, strlen(cp2) + 1);
+			cp2 -= bytes;
 			
-			but->strwidth= BLF_width(fstyle->uifont_id, but->drawstr+but->ofs);
-			if(but->strwidth < 10) break;
+			but->strwidth = BLF_width(fstyle->uifont_id, but->drawstr + but->ofs);
+			if (but->strwidth < 10) break;
 		}
 	
 	
 		/* after the leading text is gone, chop off the : and following space, with ofs */
 		while ((but->strwidth > okwidth) && (but->ofs < 2))
 		{
-			but->ofs++;
-			but->strwidth= BLF_width(fstyle->uifont_id, but->drawstr+but->ofs);
-			if(but->strwidth < 10) break;
+			ui_text_clip_give_next_off(but);
+			but->strwidth = BLF_width(fstyle->uifont_id, but->drawstr + but->ofs);
+			if (but->strwidth < 10) break;
 		}
 		
 	}
 
 	/* once the label's gone, chop off the least significant digits */
-	while(but->strwidth > okwidth ) {
-		int pos= strlen(but->drawstr);
-		
-		but->drawstr[ pos-1 ] = 0;
-		pos--;
+	while (but->strwidth > okwidth) {
+		int len = strlen(but->drawstr);
+		int 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;
 		
-		but->strwidth= BLF_width(fstyle->uifont_id, but->drawstr+but->ofs);
-		if(but->strwidth < 10) break;
+		but->strwidth = BLF_width(fstyle->uifont_id, but->drawstr + but->ofs);
+		if (but->strwidth < 10) break;
 	}
 	
-	if (fstyle->kerning==1)
+	if (fstyle->kerning == 1)
 		BLF_disable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
 }
 
@@ -1064,17 +1098,17 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
 
 	uiStyleFontSet(fstyle);
 	
-	if(but->editstr || (but->flag & UI_TEXT_LEFT))
-		fstyle->align= UI_STYLE_TEXT_LEFT;
+	if (but->editstr || (but->flag & UI_TEXT_LEFT))
+		fstyle->align = UI_STYLE_TEXT_LEFT;
 	else
-		fstyle->align= UI_STYLE_TEXT_CENTER;			
+		fstyle->align = UI_STYLE_TEXT_CENTER;
 	
-	if (fstyle->kerning==1)	/* for BLF_width */
+	if (fstyle->kerning == 1) /* for BLF_width */
 		BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
 	
 	/* text button selection and cursor */
-	if(but->editstr && but->pos != -1) {
-		short t=0, pos=0, ch;
+	if (but->editstr && but->pos != -1) {
+		short t = 0, pos = 0, ch;
 		short selsta_tmp, selend_tmp, selsta_draw, selwidth_draw;
 
 		if ((but->selend - but->selsta) > 0) {
@@ -1082,43 +1116,46 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
 			selsta_tmp = but->selsta;
 			selend_tmp = but->selend;
 			
-			if(but->drawstr[0]!=0) {
+			if (but->drawstr[0] != 0) {
 
 				if (but->selsta >= but->ofs) {
-					ch= but->drawstr[selsta_tmp];
-					but->drawstr[selsta_tmp]= 0;
+					ch = but->drawstr[selsta_tmp];
+					but->drawstr[selsta_tmp] = 0;
 					
-					selsta_draw = BLF_width(fstyle->uifont_id, but->drawstr+but->ofs);
+					selsta_draw = BLF_width(fstyle->uifont_id, but->drawstr + but->ofs);
 					
-					but->drawstr[selsta_tmp]= ch;
-				} else
+					but->drawstr[selsta_tmp] = ch;
+				}
+				else {
 					selsta_draw = 0;
+				}
 				
-				ch= but->drawstr[selend_tmp];
-				but->drawstr[selend_tmp]= 0;
+				ch = but->drawstr[selend_tmp];
+				but->drawstr[selend_tmp] = 0;
 				
-				selwidth_draw = BLF_width(fstyle->uifont_id, but->drawstr+but->ofs);
+				selwidth_draw = BLF_width(fstyle->uifont_id, but->drawstr + but->ofs);
 				
-				but->drawstr[selend_tmp]= ch;
+				but->drawstr[selend_tmp] = ch;
 
-				glColor3ubv((unsigned char*)wcol->item);
-				glRects(rect->xmin+selsta_draw, rect->ymin+2, rect->xmin+selwidth_draw, rect->ymax-2);
+				glColor3ubv((unsigned char *)wcol->item);
+				glRects(rect->xmin + selsta_draw, rect->ymin + 2, rect->xmin + selwidth_draw, rect->ymax - 2);
 			}
-		} else {
+		}
+		else {
 			/* text cursor */
-			pos= but->pos;
-			if(pos >= but->ofs) {
-				if(but->drawstr[0]!=0) {
-					ch= but->drawstr[pos];
-					but->drawstr[pos]= 0;
+			pos = but->pos;
+			if (pos >= but->ofs) {
+				if (but->drawstr[0] != 0) {
+					ch = but->drawstr[pos];
+					but->drawstr[pos] = 0;
 					
-					t= BLF_width(fstyle->uifont_id, but->drawstr+but->ofs) / but->aspect;
+					t = BLF_width(fstyle->uifont_id, but->drawstr + but->ofs) / but->aspect;
 					
-					but->drawstr[pos]= ch;
+					but->drawstr[pos] = ch;
 				}
 
 				glColor3f(0.20, 0.6, 0.9);
-				glRects(rect->xmin+t, rect->ymin+2, rect->xmin+t+2, rect->ymax-2);
+				glRects(rect->xmin + t, rect->ymin + 2, rect->xmin + t + 2, rect->ymax - 2);
 			}
 		}
 	}
@@ -1127,45 +1164,45 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
 		BLF_disable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
 	
 	//	ui_rasterpos_safe(x, y, but->aspect);
-//	if(but->type==IDPOIN) transopts= 0;	// no translation, of course!
+//	if (but->type==IDPOIN) transopts= 0;	// no translation, of course!
 //	else transopts= ui_translate_buttons();
 	
 	/* cut string in 2 parts - only for menu entries */
-	if((but->block->flag & UI_BLOCK_LOOP)) {
-		if(ELEM5(but->type, SLI, NUM, TEX, NUMSLI, NUMABS)==0) {
-			cpoin= strchr(but->drawstr, '|');
-			if(cpoin) *cpoin= 0;		
+	if ((but->block->flag & UI_BLOCK_LOOP)) {
+		if (ELEM5(but->type, SLI, NUM, TEX, NUMSLI, NUMABS) == 0) {
+			cpoin = strchr(but->drawstr, '|');
+			if (cpoin) *cpoin = 0;
 		}
 	}
 	
-	glColor3ubv((unsigned char*)wcol->text);
+	glColor3ubv((unsigned char *)wcol->text);
 
-	uiStyleFontDrawExt(fstyle, rect, but->drawstr+but->ofs, &font_xofs, &font_yofs);
+	uiStyleFontDrawExt(fstyle, rect, but->drawstr + but->ofs, &font_xofs, &font_yofs);
 
-	if(but->menu_key != '\0') {
+	if (but->menu_key != '\0') {
 		char fixedbuf[128];
 		char *str;
 
 		BLI_strncpy(fixedbuf, but->drawstr + but->ofs, sizeof(fixedbuf));
 
-		str= strchr(fixedbuf, but->menu_key-32); /* upper case */
-		if(str==NULL)
-			str= strchr(fixedbuf, but->menu_key);
+		str = strchr(fixedbuf, but->menu_key - 32); /* upper case */
+		if (str == NULL)
+			str = strchr(fixedbuf, but->menu_key);
 
-		if(str) {
-			int ul_index= -1;
+		if (str) {
+			int ul_index = -1;
 			float ul_advance;
 
-			ul_index= (int)(str - fixedbuf);
+			ul_index = (int)(str - fixedbuf);
 
 			if (fstyle->kerning == 1) {
 				BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
 			}
 
-			fixedbuf[ul_index]= '\0';
-			ul_advance= BLF_width(fstyle->uifont_id, fixedbuf);
+			fixedbuf[ul_index] = '\0';
+			ul_advance = BLF_width(fstyle->uifont_id, fixedbuf);
 
-			BLF_position(fstyle->uifont_id, rect->xmin+font_xofs + ul_advance, rect->ymin+font_yofs, 0.0f);
+			BLF_position(fstyle->uifont_id, rect->xmin + font_xofs + ul_advance, rect->ymin + font_yofs, 0.0f);
 			BLF_draw(fstyle->uifont_id, "_", 2);
 
 			if (fstyle->kerning == 1) {
@@ -1175,11 +1212,11 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
 	}
 
 	/* part text right aligned */
-	if(cpoin) {
-		fstyle->align= UI_STYLE_TEXT_RIGHT;
+	if (cpoin) {
+		fstyle->align = UI_STYLE_TEXT_RIGHT;
 		rect->xmax -= ui_but_draw_menu_icon(but) ? UI_DPI_ICON_SIZE : 5;
-		uiStyleFontDraw(fstyle, rect, cpoin+1);
-		*cpoin= '|';
+		uiStyleFontDraw(fstyle, rect, cpoin + 1);
+		*cpoin = '|';
 	}
 }
 
@@ -1187,7 +1224,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
 static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *but, rcti *rect)
 {
 	
-	if(but==NULL) return;
+	if (but == NULL) return;
 
 	/* clip but->drawstr to fit in available space */
 	if (but->editstr && but->pos >= 0) {
@@ -1202,24 +1239,24 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
 	else if ((but->block->flag & UI_BLOCK_LOOP) && (but->type == BUT)) {
 		ui_text_leftclip(fstyle, but, rect);
 	}
-	else but->ofs= 0;
+	else but->ofs = 0;
 	
 	/* check for button text label */
 	if (but->type == ICONTEXTROW) {
-		widget_draw_icon(but, (BIFIconID) (but->icon+but->iconadd), 1.0f, rect);
+		widget_draw_icon(but, (BIFIconID) (but->icon + but->iconadd), 1.0f, rect);
 	}
 	else {
 				
-		if(but->type==BUT_TOGDUAL) {
-			int dualset= 0;
-			if(but->pointype==SHO)
-				dualset= BTST( *(((short *)but->poin)+1), but->bitnr);
-			else if(but->pointype==INT)
-				dualset= BTST( *(((int *)but->poin)+1), but->bitnr);
+		if (but->type == BUT_TOGDUAL) {
+			int dualset = 0;
+			if (but->pointype == SHO)
+				dualset = BTST(*(((short *)but->poin) + 1), but->bitnr);
+			else if (but->pointype == INT)
+				dualset = BTST(*(((int *)but->poin) + 1), but->bitnr);
 			
-			widget_draw_icon(but, ICON_DOT, dualset?1.0f:0.25f, rect);
+			widget_draw_icon(but, ICON_DOT, dualset ? 1.0f : 0.25f, rect);
 		}
-		else if(but->type==MENU && (but->flag & UI_BUT_NODE_LINK)) {
+		else if (but->type == MENU && (but->flag & UI_BUT_NODE_LINK)) {
 			int tmp = rect->xmin;
 			rect->xmin = rect->xmax - (rect->ymax - rect->ymin) - 1;
 			widget_draw_icon(but, ICON_LAYER_USED, 1.0f, rect);
@@ -1227,17 +1264,17 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
 		}
 		
 		/* If there's an icon too (made with uiDefIconTextBut) then draw the icon
-		and offset the text label to accommodate it */
+		 * and offset the text label to accommodate it */
 		
 		if (but->flag & UI_HAS_ICON) {
-			widget_draw_icon(but, but->icon+but->iconadd, 1.0f, rect);
+			widget_draw_icon(but, but->icon + but->iconadd, 1.0f, rect);
 			
-			rect->xmin += (int)((float)UI_icon_get_width(but->icon+but->iconadd) * UI_DPI_ICON_FAC);
+			rect->xmin += (int)((float)UI_icon_get_width(but->icon + but->iconadd) * UI_DPI_ICON_FAC);
 			
-			if(but->editstr || (but->flag & UI_TEXT_LEFT)) 
+			if (but->editstr || (but->flag & UI_TEXT_LEFT)) 
 				rect->xmin += 5;
 		}
-		else if((but->flag & UI_TEXT_LEFT)) 
+		else if ((but->flag & UI_TEXT_LEFT)) 
 			rect->xmin += 5;
 		
 		/* always draw text for textbutton cursor */
@@ -1251,18 +1288,17 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
 /* *********************** widget types ************************************* */
 
 
-/*   uiWidgetStateColors
-	char inner_anim[4];
-	char inner_anim_sel[4];
-	char inner_key[4];
-	char inner_key_sel[4];
-	char inner_driven[4];
-	char inner_driven_sel[4];
-	float blend;
- 
-*/
+/* uiWidgetStateColors
+ *     char inner_anim[4];
+ *     char inner_anim_sel[4];
+ *     char inner_key[4];
+ *     char inner_key_sel[4];
+ *     char inner_driven[4];
+ *     char inner_driven_sel[4];
+ *     float blend;
+ */
 
-static struct uiWidgetStateColors wcol_state_colors= {
+static struct uiWidgetStateColors wcol_state_colors = {
 	{115, 190, 76, 255},
 	{90, 166, 51, 255},
 	{240, 235, 100, 255},
@@ -1272,19 +1308,19 @@ static struct uiWidgetStateColors wcol_state_colors= {
 	0.5f, 0.0f
 };
 
-/*  uiWidgetColors
-	float outline[3];
-	float inner[4];
-	float inner_sel[4];
-	float item[3];
-	float text[3];
-	float text_sel[3];
-
-	short shaded;
-	float shadetop, shadedown;
-*/	
+/* uiWidgetColors
+ *     float outline[3];
+ *     float inner[4];
+ *     float inner_sel[4];
+ *     float item[3];
+ *     float text[3];
+ *     float text_sel[3];
+ *     
+ *     short shaded;
+ *     float shadetop, shadedown;
+ */
 
-static struct uiWidgetColors wcol_num= {
+static struct uiWidgetColors wcol_num = {
 	{25, 25, 25, 255},
 	{180, 180, 180, 255},
 	{153, 153, 153, 255},
@@ -1297,7 +1333,7 @@ static struct uiWidgetColors wcol_num= {
 	-20, 0
 };
 
-static struct uiWidgetColors wcol_numslider= {
+static struct uiWidgetColors wcol_numslider = {
 	{25, 25, 25, 255},
 	{180, 180, 180, 255},
 	{153, 153, 153, 255},
@@ -1310,7 +1346,7 @@ static struct uiWidgetColors wcol_numslider= {
 	-20, 0
 };
 
-static struct uiWidgetColors wcol_text= {
+static struct uiWidgetColors wcol_text = {
 	{25, 25, 25, 255},
 	{153, 153, 153, 255},
 	{153, 153, 153, 255},
@@ -1323,7 +1359,7 @@ static struct uiWidgetColors wcol_text= {
 	0, 25
 };
 
-static struct uiWidgetColors wcol_option= {
+static struct uiWidgetColors wcol_option = {
 	{0, 0, 0, 255},
 	{70, 70, 70, 255},
 	{70, 70, 70, 255},
@@ -1337,7 +1373,7 @@ static struct uiWidgetColors wcol_option= {
 };
 
 /* button that shows popup */
-static struct uiWidgetColors wcol_menu= {
+static struct uiWidgetColors wcol_menu = {
 	{0, 0, 0, 255},
 	{70, 70, 70, 255},
 	{70, 70, 70, 255},
@@ -1351,7 +1387,7 @@ static struct uiWidgetColors wcol_menu= {
 };
 
 /* button that starts pulldown */
-static struct uiWidgetColors wcol_pulldown= {
+static struct uiWidgetColors wcol_pulldown = {
 	{0, 0, 0, 255},
 	{63, 63, 63, 255},
 	{86, 128, 194, 255},
@@ -1365,11 +1401,11 @@ static struct uiWidgetColors wcol_pulldown= {
 };
 
 /* button inside menu */
-static struct uiWidgetColors wcol_menu_item= {
+static struct uiWidgetColors wcol_menu_item = {
 	{0, 0, 0, 255},
 	{0, 0, 0, 0},
 	{86, 128, 194, 255},
-	{255, 255, 255, 255},
+	{172, 172, 172, 128},
 	
 	{255, 255, 255, 255},
 	{0, 0, 0, 255},
@@ -1379,7 +1415,7 @@ static struct uiWidgetColors wcol_menu_item= {
 };
 
 /* backdrop menu + title text color */
-static struct uiWidgetColors wcol_menu_back= {
+static struct uiWidgetColors wcol_menu_back = {
 	{0, 0, 0, 255},
 	{25, 25, 25, 230},
 	{45, 45, 45, 230},
@@ -1392,8 +1428,21 @@ static struct uiWidgetColors wcol_menu_back= {
 	25, -20
 };
 
+/* tooltip colour */
+static struct uiWidgetColors wcol_tooltip = {
+	{0, 0, 0, 255},
+	{25, 25, 25, 230},
+	{45, 45, 45, 230},
+	{100, 100, 100, 255},
 
-static struct uiWidgetColors wcol_radio= {
+	{160, 160, 160, 255},
+	{255, 255, 255, 255},
+
+	0,
+	25, -20
+};
+
+static struct uiWidgetColors wcol_radio = {
 	{0, 0, 0, 255},
 	{70, 70, 70, 255},
 	{86, 128, 194, 255},
@@ -1406,7 +1455,7 @@ static struct uiWidgetColors wcol_radio= {
 	15, -15
 };
 
-static struct uiWidgetColors wcol_regular= {
+static struct uiWidgetColors wcol_regular = {
 	{25, 25, 25, 255},
 	{153, 153, 153, 255},
 	{100, 100, 100, 255},
@@ -1419,7 +1468,7 @@ static struct uiWidgetColors wcol_regular= {
 	0, 0
 };
 
-static struct uiWidgetColors wcol_tool= {
+static struct uiWidgetColors wcol_tool = {
 	{25, 25, 25, 255},
 	{153, 153, 153, 255},
 	{100, 100, 100, 255},
@@ -1432,7 +1481,7 @@ static struct uiWidgetColors wcol_tool= {
 	15, -15
 };
 
-static struct uiWidgetColors wcol_box= {
+static struct uiWidgetColors wcol_box = {
 	{25, 25, 25, 255},
 	{128, 128, 128, 255},
 	{100, 100, 100, 255},
@@ -1445,7 +1494,7 @@ static struct uiWidgetColors wcol_box= {
 	0, 0
 };
 
-static struct uiWidgetColors wcol_toggle= {
+static struct uiWidgetColors wcol_toggle = {
 	{25, 25, 25, 255},
 	{153, 153, 153, 255},
 	{100, 100, 100, 255},
@@ -1458,7 +1507,7 @@ static struct uiWidgetColors wcol_toggle= {
 	0, 0
 };
 
-static struct uiWidgetColors wcol_scroll= {
+static struct uiWidgetColors wcol_scroll = {
 	{50, 50, 50, 180},
 	{80, 80, 80, 180},
 	{100, 100, 100, 180},
@@ -1471,7 +1520,7 @@ static struct uiWidgetColors wcol_scroll= {
 	5, -5
 };
 
-static struct uiWidgetColors wcol_progress= {
+static struct uiWidgetColors wcol_progress = {
 	{0, 0, 0, 255},
 	{190, 190, 190, 255},
 	{100, 100, 100, 180},
@@ -1484,7 +1533,7 @@ static struct uiWidgetColors wcol_progress= {
 	0, 0
 };
 
-static struct uiWidgetColors wcol_list_item= {
+static struct uiWidgetColors wcol_list_item = {
 	{0, 0, 0, 255},
 	{0, 0, 0, 0},
 	{86, 128, 194, 255},
@@ -1498,7 +1547,7 @@ static struct uiWidgetColors wcol_list_item= {
 };
 
 /* free wcol struct to play with */
-static struct uiWidgetColors wcol_tmp= {
+static struct uiWidgetColors wcol_tmp = {
 	{0, 0, 0, 255},
 	{128, 128, 128, 255},
 	{100, 100, 100, 255},
@@ -1515,80 +1564,81 @@ static struct uiWidgetColors wcol_tmp= {
 /* called for theme init (new theme) and versions */
 void ui_widget_color_init(ThemeUI *tui)
 {
-	tui->wcol_regular= wcol_regular;
-	tui->wcol_tool= wcol_tool;
-	tui->wcol_text= wcol_text;
-	tui->wcol_radio= wcol_radio;
-	tui->wcol_option= wcol_option;
-	tui->wcol_toggle= wcol_toggle;
-	tui->wcol_num= wcol_num;
-	tui->wcol_numslider= wcol_numslider;
-	tui->wcol_menu= wcol_menu;
-	tui->wcol_pulldown= wcol_pulldown;
-	tui->wcol_menu_back= wcol_menu_back;
-	tui->wcol_menu_item= wcol_menu_item;
-	tui->wcol_box= wcol_box;
-	tui->wcol_scroll= wcol_scroll;
-	tui->wcol_list_item= wcol_list_item;
-	tui->wcol_progress= wcol_progress;
-
-	tui->wcol_state= wcol_state_colors;
+	tui->wcol_regular = wcol_regular;
+	tui->wcol_tool = wcol_tool;
+	tui->wcol_text = wcol_text;
+	tui->wcol_radio = wcol_radio;
+	tui->wcol_option = wcol_option;
+	tui->wcol_toggle = wcol_toggle;
+	tui->wcol_num = wcol_num;
+	tui->wcol_numslider = wcol_numslider;
+	tui->wcol_menu = wcol_menu;
+	tui->wcol_pulldown = wcol_pulldown;
+	tui->wcol_menu_back = wcol_menu_back;
+	tui->wcol_tooltip = wcol_tooltip;
+	tui->wcol_menu_item = wcol_menu_item;
+	tui->wcol_box = wcol_box;
+	tui->wcol_scroll = wcol_scroll;
+	tui->wcol_list_item = wcol_list_item;
+	tui->wcol_progress = wcol_progress;
+
+	tui->wcol_state = wcol_state_colors;
 }
 
 /* ************ button callbacks, state ***************** */
 
 static void widget_state_blend(char cp[3], const char cpstate[3], const float fac)
 {
-	if(fac != 0.0f) {
-		cp[0]= (int)((1.0f-fac)*cp[0] + fac*cpstate[0]);
-		cp[1]= (int)((1.0f-fac)*cp[1] + fac*cpstate[1]);
-		cp[2]= (int)((1.0f-fac)*cp[2] + fac*cpstate[2]);
+	if (fac != 0.0f) {
+		cp[0] = (int)((1.0f - fac) * cp[0] + fac * cpstate[0]);
+		cp[1] = (int)((1.0f - fac) * cp[1] + fac * cpstate[1]);
+		cp[2] = (int)((1.0f - fac) * cp[2] + fac * cpstate[2]);
 	}
 }
 
 /* copy colors from theme, and set changes in it based on state */
 static void widget_state(uiWidgetType *wt, int state)
 {
-	uiWidgetStateColors *wcol_state= wt->wcol_state;
+	uiWidgetStateColors *wcol_state = wt->wcol_state;
 
-	wt->wcol= *(wt->wcol_theme);
+	wt->wcol = *(wt->wcol_theme);
 	
-	if(state & UI_SELECT) {
+	if (state & UI_SELECT) {
 		copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel);
 
-		if(state & UI_BUT_ANIMATED_KEY)
+		if (state & UI_BUT_ANIMATED_KEY)
 			widget_state_blend(wt->wcol.inner, wcol_state->inner_key_sel, wcol_state->blend);
-		else if(state & UI_BUT_ANIMATED)
+		else if (state & UI_BUT_ANIMATED)
 			widget_state_blend(wt->wcol.inner, wcol_state->inner_anim_sel, wcol_state->blend);
-		else if(state & UI_BUT_DRIVEN)
+		else if (state & UI_BUT_DRIVEN)
 			widget_state_blend(wt->wcol.inner, wcol_state->inner_driven_sel, wcol_state->blend);
 
 		copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel);
 		
-		if(state & UI_SELECT)
+		if (state & UI_SELECT)
 			SWAP(short, wt->wcol.shadetop, wt->wcol.shadedown);
 	}
 	else {
-		if(state & UI_BUT_ANIMATED_KEY)
+		if (state & UI_BUT_ANIMATED_KEY)
 			widget_state_blend(wt->wcol.inner, wcol_state->inner_key, wcol_state->blend);
-		else if(state & UI_BUT_ANIMATED)
+		else if (state & UI_BUT_ANIMATED)
 			widget_state_blend(wt->wcol.inner, wcol_state->inner_anim, wcol_state->blend);
-		else if(state & UI_BUT_DRIVEN)
+		else if (state & UI_BUT_DRIVEN)
 			widget_state_blend(wt->wcol.inner, wcol_state->inner_driven, wcol_state->blend);
 
-		if(state & UI_ACTIVE) { /* mouse over? */
-			wt->wcol.inner[0]= wt->wcol.inner[0]>=240? 255 : wt->wcol.inner[0]+15;
-			wt->wcol.inner[1]= wt->wcol.inner[1]>=240? 255 : wt->wcol.inner[1]+15;
-			wt->wcol.inner[2]= wt->wcol.inner[2]>=240? 255 : wt->wcol.inner[2]+15;
+		if (state & UI_ACTIVE) { /* mouse over? */
+			wt->wcol.inner[0] = wt->wcol.inner[0] >= 240 ? 255 : wt->wcol.inner[0] + 15;
+			wt->wcol.inner[1] = wt->wcol.inner[1] >= 240 ? 255 : wt->wcol.inner[1] + 15;
+			wt->wcol.inner[2] = wt->wcol.inner[2] >= 240 ? 255 : wt->wcol.inner[2] + 15;
 		}
 	}
 
-	if(state & UI_BUT_REDALERT) {
-		char red[4]= {255, 0, 0};
+	if (state & UI_BUT_REDALERT) {
+		char red[4] = {255, 0, 0};
 		widget_state_blend(wt->wcol.inner, red, 0.4f);
 	}
-	if(state & UI_BUT_NODE_ACTIVE) {
-		char blue[4]= {86, 128, 194};
+	if (state & UI_BUT_NODE_ACTIVE) {
+		char blue[4] = {86, 128, 194};
 		widget_state_blend(wt->wcol.inner, blue, 0.3f);
 	}
 }
@@ -1596,32 +1646,32 @@ static void widget_state(uiWidgetType *wt, int state)
 /* sliders use special hack which sets 'item' as inner when drawing filling */
 static void widget_state_numslider(uiWidgetType *wt, int state)
 {
-	uiWidgetStateColors *wcol_state= wt->wcol_state;
-	float blend= wcol_state->blend - 0.2f; // XXX special tweak to make sure that bar will still be visible
+	uiWidgetStateColors *wcol_state = wt->wcol_state;
+	float blend = wcol_state->blend - 0.2f; // XXX special tweak to make sure that bar will still be visible
 
 	/* call this for option button */
 	widget_state(wt, state);
 	
 	/* now, set the inner-part so that it reflects state settings too */
 	// TODO: maybe we should have separate settings for the blending colors used for this case?
-	if(state & UI_SELECT) {
+	if (state & UI_SELECT) {
 		
-		if(state & UI_BUT_ANIMATED_KEY)
+		if (state & UI_BUT_ANIMATED_KEY)
 			widget_state_blend(wt->wcol.item, wcol_state->inner_key_sel, blend);
-		else if(state & UI_BUT_ANIMATED)
+		else if (state & UI_BUT_ANIMATED)
 			widget_state_blend(wt->wcol.item, wcol_state->inner_anim_sel, blend);
-		else if(state & UI_BUT_DRIVEN)
+		else if (state & UI_BUT_DRIVEN)
 			widget_state_blend(wt->wcol.item, wcol_state->inner_driven_sel, blend);
 		
-		if(state & UI_SELECT)
+		if (state & UI_SELECT)
 			SWAP(short, wt->wcol.shadetop, wt->wcol.shadedown);
 	}
 	else {
-		if(state & UI_BUT_ANIMATED_KEY)
+		if (state & UI_BUT_ANIMATED_KEY)
 			widget_state_blend(wt->wcol.item, wcol_state->inner_key, blend);
-		else if(state & UI_BUT_ANIMATED)
+		else if (state & UI_BUT_ANIMATED)
 			widget_state_blend(wt->wcol.item, wcol_state->inner_anim, blend);
-		else if(state & UI_BUT_DRIVEN)
+		else if (state & UI_BUT_DRIVEN)
 			widget_state_blend(wt->wcol.item, wcol_state->inner_driven, blend);
 	}
 }
@@ -1632,7 +1682,7 @@ static void widget_state_label(uiWidgetType *wt, int state)
 	/* call this for option button */
 	widget_state(wt, state);
 
-	if(state & UI_SELECT)
+	if (state & UI_SELECT)
 		UI_GetThemeColor4ubv(TH_TEXT_HI, (unsigned char *)wt->wcol.text);
 	else
 		UI_GetThemeColor4ubv(TH_TEXT, (unsigned char *)wt->wcol.text);
@@ -1647,10 +1697,10 @@ static void widget_state_option_menu(uiWidgetType *wt, int state)
 	widget_state(wt, state);
 	
 	/* if not selected we get theme from menu back */
-	if(state & UI_SELECT)
+	if (state & UI_SELECT)
 		UI_GetThemeColor4ubv(TH_TEXT_HI, (unsigned char *)wt->wcol.text);
 	else {
-		bTheme *btheme= UI_GetTheme(); /* XXX */
+		bTheme *btheme = UI_GetTheme(); /* XXX */
 
 		copy_v3_v3_char(wt->wcol.text, btheme->tui.wcol_menu_back.text);
 	}
@@ -1659,32 +1709,32 @@ static void widget_state_option_menu(uiWidgetType *wt, int state)
 
 static void widget_state_nothing(uiWidgetType *wt, int UNUSED(state))
 {
-	wt->wcol= *(wt->wcol_theme);
+	wt->wcol = *(wt->wcol_theme);
 }	
 
 /* special case, button that calls pulldown */
 static void widget_state_pulldown(uiWidgetType *wt, int state)
 {
-	wt->wcol= *(wt->wcol_theme);
+	wt->wcol = *(wt->wcol_theme);
 	
 	copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel);
 	copy_v3_v3_char(wt->wcol.outline, wt->wcol.inner);
 
-	if(state & UI_ACTIVE)
+	if (state & UI_ACTIVE)
 		copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel);
 }
 
 /* special case, menu items */
 static void widget_state_menu_item(uiWidgetType *wt, int state)
 {
-	wt->wcol= *(wt->wcol_theme);
+	wt->wcol = *(wt->wcol_theme);
 	
-	if(state & (UI_BUT_DISABLED|UI_BUT_INACTIVE)) {
-		wt->wcol.text[0]= 0.5f*(wt->wcol.text[0]+wt->wcol.text_sel[0]);
-		wt->wcol.text[1]= 0.5f*(wt->wcol.text[1]+wt->wcol.text_sel[1]);
-		wt->wcol.text[2]= 0.5f*(wt->wcol.text[2]+wt->wcol.text_sel[2]);
+	if (state & (UI_BUT_DISABLED | UI_BUT_INACTIVE)) {
+		wt->wcol.text[0] = 0.5f * (wt->wcol.text[0] + wt->wcol.text_sel[0]);
+		wt->wcol.text[1] = 0.5f * (wt->wcol.text[1] + wt->wcol.text_sel[1]);
+		wt->wcol.text[2] = 0.5f * (wt->wcol.text[2] + wt->wcol.text_sel[2]);
 	}
-	else if(state & UI_ACTIVE) {
+	else if (state & UI_ACTIVE) {
 		copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel);
 		copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel);
 	}
@@ -1697,27 +1747,27 @@ static void widget_state_menu_item(uiWidgetType *wt, int state)
 static void widget_softshadow(rcti *rect, int roundboxalign, float radin, float radout)
 {
 	uiWidgetBase wtb;
-	rcti rect1= *rect;
+	rcti rect1 = *rect;
 	float alpha, alphastep;
 	int step, totvert;
-	float quad_strip[WIDGET_SIZE_MAX*2][2];
+	float quad_strip[WIDGET_SIZE_MAX * 2][2];
 	
 	/* prevent tooltips to not show round shadow */
-	if( 2.0f*radout > 0.2f*(rect1.ymax-rect1.ymin) )
-		rect1.ymax -= 0.2f*(rect1.ymax-rect1.ymin);
+	if (2.0f * radout > 0.2f * (rect1.ymax - rect1.ymin) )
+		rect1.ymax -= 0.2f * (rect1.ymax - rect1.ymin);
 	else
-		rect1.ymax -= 2.0f*radout;
+		rect1.ymax -= 2.0f * radout;
 	
 	/* inner part */
-	totvert= round_box_shadow_edges(wtb.inner_v, &rect1, radin, roundboxalign & (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT), 0.0f);
+	totvert = round_box_shadow_edges(wtb.inner_v, &rect1, radin, roundboxalign & (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT), 0.0f);
 
 	/* inverse linear shadow alpha */
-	alpha= 0.15;
-	alphastep= 0.67;
+	alpha = 0.15;
+	alphastep = 0.67;
 	
 	glEnableClientState(GL_VERTEX_ARRAY);
 
-	for(step= 1; step<=radout; step++, alpha*=alphastep) {
+	for (step = 1; step <= radout; step++, alpha *= alphastep) {
 		round_box_shadow_edges(wtb.outer_v, &rect1, radin, UI_CNR_ALL, (float)step);
 		
 		glColor4f(0.0f, 0.0f, 0.0f, alpha);
@@ -1725,7 +1775,7 @@ static void widget_softshadow(rcti *rect, int roundboxalign, float radin, float
 		widget_verts_to_quad_strip_open(&wtb, totvert, quad_strip);
 
 		glVertexPointer(2, GL_FLOAT, 0, quad_strip);
-		glDrawArrays(GL_QUAD_STRIP, 0, totvert*2);
+		glDrawArrays(GL_QUAD_STRIP, 0, totvert * 2);
 	}
 
 	glDisableClientState(GL_VERTEX_ARRAY);
@@ -1734,7 +1784,7 @@ static void widget_softshadow(rcti *rect, int roundboxalign, float radin, float
 static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int direction)
 {
 	uiWidgetBase wtb;
-	int roundboxalign= UI_CNR_ALL;
+	int roundboxalign = UI_CNR_ALL;
 	
 	widget_init(&wtb);
 	
@@ -1744,11 +1794,11 @@ static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int dir
 		//rect->ymax += 4.0;
 	}
 	else if (direction == UI_DOWN) {
-		roundboxalign= (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT);
+		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;
+		roundboxalign = UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT;
 		rect->ymax += 4.0;
 	}
 	
@@ -1756,7 +1806,7 @@ static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int dir
 	widget_softshadow(rect, roundboxalign, 5.0f, 8.0f);
 	
 	round_box_edges(&wtb, roundboxalign, rect, 5.0f);
-	wtb.emboss= 0;
+	wtb.emboss = 0;
 	widgetbase_draw(&wtb, wcol);
 	
 	glDisable(GL_BLEND);
@@ -1770,14 +1820,14 @@ static void ui_hsv_cursor(float x, float y)
 	glTranslatef(x, y, 0.0f);
 	
 	glColor3f(1.0f, 1.0f, 1.0f);
-	glutil_draw_filled_arc(0.0f, M_PI*2.0, 3.0f, 8);
+	glutil_draw_filled_arc(0.0f, M_PI * 2.0, 3.0f, 8);
 	
 	glEnable(GL_BLEND);
-	glEnable(GL_LINE_SMOOTH );
+	glEnable(GL_LINE_SMOOTH);
 	glColor3f(0.0f, 0.0f, 0.0f);
-	glutil_draw_lined_arc(0.0f, M_PI*2.0, 3.0f, 12);
+	glutil_draw_lined_arc(0.0f, M_PI * 2.0, 3.0f, 12);
 	glDisable(GL_BLEND);
-	glDisable(GL_LINE_SMOOTH );
+	glDisable(GL_LINE_SMOOTH);
 	
 	glPopMatrix();
 	
@@ -1786,51 +1836,51 @@ static void ui_hsv_cursor(float x, float y)
 void ui_hsvcircle_vals_from_pos(float *valrad, float *valdist, rcti *rect, float mx, float my)
 {
 	/* duplication of code... well, simple is better now */
-	float centx= (float)(rect->xmin + rect->xmax)/2;
-	float centy= (float)(rect->ymin + rect->ymax)/2;
+	float centx = (float)(rect->xmin + rect->xmax) / 2;
+	float centy = (float)(rect->ymin + rect->ymax) / 2;
 	float radius, dist;
 	
-	if( rect->xmax-rect->xmin > rect->ymax-rect->ymin )
-		radius= (float)(rect->ymax - rect->ymin)/2; 
+	if (rect->xmax - rect->xmin > rect->ymax - rect->ymin)
+		radius = (float)(rect->ymax - rect->ymin) / 2;
 	else
-		radius= (float)(rect->xmax - rect->xmin)/2; 
+		radius = (float)(rect->xmax - rect->xmin) / 2;
 
-	mx-= centx;
-	my-= centy;
-	dist= sqrt( mx*mx + my*my);
-	if(dist < radius)
-		*valdist= dist/radius;
+	mx -= centx;
+	my -= centy;
+	dist = sqrt(mx * mx + my * my);
+	if (dist < radius)
+		*valdist = dist / radius;
 	else
-		*valdist= 1.0f;
+		*valdist = 1.0f;
 	
-	*valrad= atan2f(mx, my)/(2.0f*(float)M_PI) + 0.5f;
+	*valrad = atan2f(mx, my) / (2.0f * (float)M_PI) + 0.5f;
 }
 
 static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
 {
 	/* gouraud triangle fan */
-	float radstep, ang= 0.0f;
+	float radstep, ang = 0.0f;
 	float centx, centy, radius, cursor_radius;
 	float rgb[3], hsvo[3], hsv[3], col[3], colcent[3];
-	int a, tot= 32;
+	int a, tot = 32;
 	int color_profile = but->block->color_profile;
 	
 	if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA)
 		color_profile = BLI_PR_NONE;
 	
-	radstep= 2.0f*(float)M_PI/(float)tot;
-	centx= (float)(rect->xmin + rect->xmax)/2;
-	centy= (float)(rect->ymin + rect->ymax)/2;
+	radstep = 2.0f * (float)M_PI / (float)tot;
+	centx = (float)(rect->xmin + rect->xmax) / 2;
+	centy = (float)(rect->ymin + rect->ymax) / 2;
 	
-	if( rect->xmax-rect->xmin > rect->ymax-rect->ymin )
-		radius= (float)(rect->ymax - rect->ymin)/2; 
+	if (rect->xmax - rect->xmin > rect->ymax - rect->ymin)
+		radius = (float)(rect->ymax - rect->ymin) / 2;
 	else
-		radius= (float)(rect->xmax - rect->xmin)/2; 
+		radius = (float)(rect->xmax - rect->xmin) / 2;
 	
 	/* color */
 	ui_get_but_vectorf(but, rgb);
 	copy_v3_v3(hsv, ui_block_hsv_get(but->block));
-	rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+	rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv + 1, hsv + 2);
 	copy_v3_v3(hsvo, hsv);
 	
 	/* exception: if 'lock' is set
@@ -1841,24 +1891,24 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
 	else if (color_profile)
 		hsv[2] = linearrgb_to_srgb(hsv[2]);
 	
-	hsv_to_rgb(0.f, 0.f, hsv[2], colcent, colcent+1, colcent+2);
+	hsv_to_rgb(0.f, 0.f, hsv[2], colcent, colcent + 1, colcent + 2);
 	
 	glShadeModel(GL_SMOOTH);
 
 	glBegin(GL_TRIANGLE_FAN);
 	glColor3fv(colcent);
-	glVertex2f( centx, centy);
+	glVertex2f(centx, centy);
 	
-	for(a=0; a<=tot; a++, ang+=radstep) {
-		float si= sin(ang);
-		float co= cos(ang);
+	for (a = 0; a <= tot; a++, ang += radstep) {
+		float si = sin(ang);
+		float co = cos(ang);
 		
-		ui_hsvcircle_vals_from_pos(hsv, hsv+1, rect, centx + co*radius, centy + si*radius);
+		ui_hsvcircle_vals_from_pos(hsv, hsv + 1, rect, centx + co * radius, centy + si * radius);
 		CLAMP(hsv[2], 0.0f, 1.0f); /* for display only */
 
-		hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2);
+		hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col + 1, col + 2);
 		glColor3fv(col);
-		glVertex2f( centx + co*radius, centy + si*radius);
+		glVertex2f(centx + co * radius, centy + si * radius);
 	}
 	glEnd();
 	
@@ -1868,23 +1918,23 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
 	glPushMatrix();
 	glTranslatef(centx, centy, 0.0f);
 	glEnable(GL_BLEND);
-	glEnable(GL_LINE_SMOOTH );
-	glColor3ubv((unsigned char*)wcol->outline);
-	glutil_draw_lined_arc(0.0f, M_PI*2.0, radius, tot + 1);
+	glEnable(GL_LINE_SMOOTH);
+	glColor3ubv((unsigned char *)wcol->outline);
+	glutil_draw_lined_arc(0.0f, M_PI * 2.0, radius, tot + 1);
 	glDisable(GL_BLEND);
-	glDisable(GL_LINE_SMOOTH );
+	glDisable(GL_LINE_SMOOTH);
 	glPopMatrix();
 
 	/* cursor */
-	ang= 2.0f*(float)M_PI*hsvo[0] + 0.5f*(float)M_PI;
+	ang = 2.0f * (float)M_PI * hsvo[0] + 0.5f * (float)M_PI;
 
-	if(but->flag & UI_BUT_COLOR_CUBIC)
+	if (but->flag & UI_BUT_COLOR_CUBIC)
 		cursor_radius = (1.0f - powf(1.0f - hsvo[1], 3.0f));
 	else
 		cursor_radius = hsvo[1];
 
-	radius= CLAMPIS(cursor_radius, 0.0f, 1.0f) * radius;
-	ui_hsv_cursor(centx + cosf(-ang)*radius, centy + sinf(-ang)*radius);
+	radius = CLAMPIS(cursor_radius, 0.0f, 1.0f) * radius;
+	ui_hsv_cursor(centx + cosf(-ang) * radius, centy + sinf(-ang) * radius);
 }
 
 /* ************ custom buttons, old stuff ************** */
@@ -1893,15 +1943,15 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
 void ui_draw_gradient(rcti *rect, const float hsv[3], int type, float alpha)
 {
 	int a;
-	float h= hsv[0], s= hsv[1], v= hsv[2];
+	float h = hsv[0], s = hsv[1], v = hsv[2];
 	float dx, dy, sx1, sx2, sy;
-	float col0[4][3];	// left half, rect bottom to top
-	float col1[4][3];	// right half, rect bottom to top
+	float col0[4][3];   // left half, rect bottom to top
+	float col1[4][3];   // right half, rect bottom to top
 
 	/* draw series of gouraud rects */
 	glShadeModel(GL_SMOOTH);
 	
-	switch(type) {
+	switch (type) {
 		case UI_GRAD_SV:
 			hsv_to_rgb(h, 0.0, 0.0,   &col1[0][0], &col1[0][1], &col1[0][2]);
 			hsv_to_rgb(h, 0.333, 0.0, &col1[1][0], &col1[1][1], &col1[1][2]);
@@ -1948,7 +1998,7 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], int type, float alpha)
 	
 	/* old below */
 	
-	for(dx=0.0f; dx<1.0f; dx+= 0.05f) {
+	for (dx = 0.0f; dx < 1.0f; dx += 0.05f) {
 		// previous color
 		copy_v3_v3(col0[0], col1[0]);
 		copy_v3_v3(col0[1], col1[1]);
@@ -1956,7 +2006,7 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], int type, float alpha)
 		copy_v3_v3(col0[3], col1[3]);
 		
 		// new color
-		switch(type) {
+		switch (type) {
 			case UI_GRAD_SV:
 				hsv_to_rgb(h, 0.0, dx,   &col1[0][0], &col1[0][1], &col1[0][2]);
 				hsv_to_rgb(h, 0.333, dx, &col1[1][0], &col1[1][1], &col1[1][2]);
@@ -1996,24 +2046,24 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], int type, float alpha)
 		}
 		
 		// rect
-		sx1= rect->xmin + dx*(rect->xmax-rect->xmin);
-		sx2= rect->xmin + (dx+0.05f)*(rect->xmax-rect->xmin);
-		sy= rect->ymin;
-		dy= (rect->ymax-rect->ymin)/3.0;
+		sx1 = rect->xmin + dx * (rect->xmax - rect->xmin);
+		sx2 = rect->xmin + (dx + 0.05f) * (rect->xmax - rect->xmin);
+		sy = rect->ymin;
+		dy = (rect->ymax - rect->ymin) / 3.0;
 		
 		glBegin(GL_QUADS);
-		for(a=0; a<3; a++, sy+=dy) {
+		for (a = 0; a < 3; a++, sy += dy) {
 			glColor4f(col0[a][0], col0[a][1], col0[a][2], alpha);
 			glVertex2f(sx1, sy);
 			
 			glColor4f(col1[a][0], col1[a][1], col1[a][2], alpha);
 			glVertex2f(sx2, sy);
 
-			glColor4f(col1[a+1][0], col1[a+1][1], col1[a+1][2], alpha);
-			glVertex2f(sx2, sy+dy);
+			glColor4f(col1[a + 1][0], col1[a + 1][1], col1[a + 1][2], alpha);
+			glVertex2f(sx2, sy + dy);
 			
-			glColor4f(col0[a+1][0], col0[a+1][1], col0[a+1][2], alpha);
-			glVertex2f(sx1, sy+dy);
+			glColor4f(col0[a + 1][0], col0[a + 1][1], col0[a + 1][2], alpha);
+			glVertex2f(sx1, sy + dy);
 		}
 		glEnd();
 	}
@@ -2026,44 +2076,44 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], int type, float alpha)
 
 static void ui_draw_but_HSVCUBE(uiBut *but, rcti *rect)
 {
-	float rgb[3], h,s,v;
-	float x=0.0f, y=0.0f;
-	float *hsv= ui_block_hsv_get(but->block);
+	float rgb[3], h, s, v;
+	float x = 0.0f, y = 0.0f;
+	float *hsv = ui_block_hsv_get(but->block);
 	float hsvn[3];
 	
-	h= hsv[0];
-	s= hsv[1];
-	v= hsv[2];
+	h = hsv[0];
+	s = hsv[1];
+	v = hsv[2];
 	
 	ui_get_but_vectorf(but, rgb);
 	rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], &h, &s, &v);
 
-	hsvn[0]= h;
-	hsvn[1]= s;
-	hsvn[2]= v;
+	hsvn[0] = h;
+	hsvn[1] = s;
+	hsvn[2] = v;
 	
 	ui_draw_gradient(rect, hsvn, but->a1, 1.f);
 	
-	switch((int)but->a1) {
+	switch ((int)but->a1) {
 		case UI_GRAD_SV:
-			x= v; y= s; break;
+			x = v; y = s; break;
 		case UI_GRAD_HV:
-			x= h; y= v; break;
+			x = h; y = v; break;
 		case UI_GRAD_HS:
-			x= h; y= s; break;
+			x = h; y = s; break;
 		case UI_GRAD_H:
-			x= h; y= 0.5; break;
+			x = h; y = 0.5; break;
 		case UI_GRAD_S:
-			x= s; y= 0.5; break;
+			x = s; y = 0.5; break;
 		case UI_GRAD_V:
-			x= v; y= 0.5; break;
+			x = v; y = 0.5; break;
 	}
 	
 	/* cursor */
-	x= rect->xmin + x*(rect->xmax-rect->xmin);
-	y= rect->ymin + y*(rect->ymax-rect->ymin);
-	CLAMP(x, rect->xmin+3.0f, rect->xmax-3.0f);
-	CLAMP(y, rect->ymin+3.0f, rect->ymax-3.0f);
+	x = rect->xmin + x * (rect->xmax - rect->xmin);
+	y = rect->ymin + y * (rect->ymax - rect->ymin);
+	CLAMP(x, rect->xmin + 3.0f, rect->xmax - 3.0f);
+	CLAMP(y, rect->ymin + 3.0f, rect->ymax - 3.0f);
 	
 	ui_hsv_cursor(x, y);
 	
@@ -2076,7 +2126,7 @@ static void ui_draw_but_HSVCUBE(uiBut *but, rcti *rect)
 static void ui_draw_but_HSV_v(uiBut *but, rcti *rect)
 {
 	uiWidgetBase wtb;
-	float rad= 0.5f*(rect->xmax - rect->xmin);
+	float rad = 0.5f * (rect->xmax - rect->xmin);
 	float x, y;
 	float rgb[3], hsv[3], v, range;
 	int color_profile = but->block->color_profile;
@@ -2085,7 +2135,7 @@ static void ui_draw_but_HSV_v(uiBut *but, rcti *rect)
 		color_profile = BLI_PR_NONE;
 
 	ui_get_but_vectorf(but, rgb);
-	rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+	rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv + 1, hsv + 2);
 	v = hsv[2];
 	
 	if (color_profile)
@@ -2093,7 +2143,7 @@ static void ui_draw_but_HSV_v(uiBut *but, rcti *rect)
 
 	/* map v from property range to [0,1] */
 	range = but->softmax - but->softmin;
-	v =	(v - but->softmin)/range;
+	v = (v - but->softmin) / range;
 	
 	widget_init(&wtb);
 	
@@ -2101,18 +2151,18 @@ static void ui_draw_but_HSV_v(uiBut *but, rcti *rect)
 	round_box_edges(&wtb, UI_CNR_ALL, rect, rad);
 	
 	/* setup temp colors */
-	wcol_tmp.outline[0]= wcol_tmp.outline[1]= wcol_tmp.outline[2]= 0;
-	wcol_tmp.inner[0]= wcol_tmp.inner[1]= wcol_tmp.inner[2]= 128;
-	wcol_tmp.shadetop= 127;
-	wcol_tmp.shadedown= -128;
-	wcol_tmp.shaded= 1;
+	wcol_tmp.outline[0] = wcol_tmp.outline[1] = wcol_tmp.outline[2] = 0;
+	wcol_tmp.inner[0] = wcol_tmp.inner[1] = wcol_tmp.inner[2] = 128;
+	wcol_tmp.shadetop = 127;
+	wcol_tmp.shadedown = -128;
+	wcol_tmp.shaded = 1;
 	
 	widgetbase_draw(&wtb, &wcol_tmp);
 
 	/* cursor */
-	x= rect->xmin + 0.5f * (rect->xmax-rect->xmin);
-	y= rect->ymin + v * (rect->ymax-rect->ymin);
-	CLAMP(y, rect->ymin+3.0f, rect->ymax-3.0f);
+	x = rect->xmin + 0.5f * (rect->xmax - rect->xmin);
+	y = rect->ymin + v * (rect->ymax - rect->ymin);
+	CLAMP(y, rect->ymin + 3.0f, rect->ymax - 3.0f);
 	
 	ui_hsv_cursor(x, y);
 	
@@ -2122,7 +2172,7 @@ static void ui_draw_but_HSV_v(uiBut *but, rcti *rect)
 /* ************ separator, for menus etc ***************** */
 static void ui_draw_separator(rcti *rect,  uiWidgetColors *wcol)
 {
-	int y = rect->ymin + (rect->ymax - rect->ymin)/2 - 1;
+	int y = rect->ymin + (rect->ymax - rect->ymin) / 2 - 1;
 	unsigned char col[4];
 	
 	col[0] = wcol->text[0];
@@ -2141,10 +2191,10 @@ static void ui_draw_separator(rcti *rect,  uiWidgetColors *wcol)
 static void widget_numbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
 {
 	uiWidgetBase wtb;
-	float rad= 0.5f*(rect->ymax - rect->ymin);
-	float textofs = rad*0.75f;
+	float rad = 0.5f * (rect->ymax - rect->ymin);
+	float textofs = rad * 0.75f;
 
-	if(state & UI_SELECT)
+	if (state & UI_SELECT)
 		SWAP(short, wcol->shadetop, wcol->shadedown);
 	
 	widget_init(&wtb);
@@ -2153,7 +2203,7 @@ static void widget_numbut(uiWidgetColors *wcol, rcti *rect, int state, int round
 	round_box_edges(&wtb, roundboxalign, rect, rad);
 	
 	/* decoration */
-	if(!(state & UI_TEXTINPUT)) {
+	if (!(state & UI_TEXTINPUT)) {
 		widget_num_tria(&wtb.tria1, rect, 0.6f, 'l');
 		widget_num_tria(&wtb.tria2, rect, 0.6f, 'r');
 	}
@@ -2170,31 +2220,31 @@ int ui_link_bezier_points(rcti *rect, float coord_array[][2], int resol)
 {
 	float dist, vec[4][2];
 
-	vec[0][0]= rect->xmin;
-	vec[0][1]= rect->ymin;
-	vec[3][0]= rect->xmax;
-	vec[3][1]= rect->ymax;
+	vec[0][0] = rect->xmin;
+	vec[0][1] = rect->ymin;
+	vec[3][0] = rect->xmax;
+	vec[3][1] = rect->ymax;
 	
-	dist= 0.5f*ABS(vec[0][0] - vec[3][0]);
+	dist = 0.5f * ABS(vec[0][0] - vec[3][0]);
 	
-	vec[1][0]= vec[0][0]+dist;
-	vec[1][1]= vec[0][1];
+	vec[1][0] = vec[0][0] + dist;
+	vec[1][1] = vec[0][1];
 	
-	vec[2][0]= vec[3][0]-dist;
-	vec[2][1]= vec[3][1];
+	vec[2][0] = vec[3][0] - dist;
+	vec[2][1] = vec[3][1];
 	
-	forward_diff_bezier(vec[0][0], vec[1][0], vec[2][0], vec[3][0], coord_array[0], resol, sizeof(float)*2);
-	forward_diff_bezier(vec[0][1], vec[1][1], vec[2][1], vec[3][1], coord_array[0]+1, resol, sizeof(float)*2);
+	forward_diff_bezier(vec[0][0], vec[1][0], vec[2][0], vec[3][0], coord_array[0], resol, sizeof(float) * 2);
+	forward_diff_bezier(vec[0][1], vec[1][1], vec[2][1], vec[3][1], coord_array[0] + 1, resol, sizeof(float) * 2);
 	
 	return 1;
 }
 
-#define LINK_RESOL	24
+#define LINK_RESOL  24
 void ui_draw_link_bezier(rcti *rect)
 {
-	float coord_array[LINK_RESOL+1][2];
+	float coord_array[LINK_RESOL + 1][2];
 	
-	if(ui_link_bezier_points(rect, coord_array, LINK_RESOL)) {
+	if (ui_link_bezier_points(rect, coord_array, LINK_RESOL)) {
 		/* we can reuse the dist variable here to increment the GL curve eval amount*/
 		// const float dist= 1.0f/(float)LINK_RESOL; // UNUSED
 
@@ -2218,47 +2268,47 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat
 	uiWidgetBase wtb;
 	float rad;
 	int horizontal;
-	short outline=0;
+	short outline = 0;
 
 	widget_init(&wtb);
 
 	/* determine horizontal/vertical */
-	horizontal= (rect->xmax - rect->xmin > rect->ymax - rect->ymin);
+	horizontal = (rect->xmax - rect->xmin > rect->ymax - rect->ymin);
 	
-	if(horizontal)
-		rad= 0.5f*(rect->ymax - rect->ymin);
+	if (horizontal)
+		rad = 0.5f * (rect->ymax - rect->ymin);
 	else
-		rad= 0.5f*(rect->xmax - rect->xmin);
+		rad = 0.5f * (rect->xmax - rect->xmin);
 	
-	wtb.shadedir= (horizontal)? 1: 0;
+	wtb.shadedir = (horizontal) ? 1 : 0;
 	
 	/* draw back part, colors swapped and shading inverted */
-	if(horizontal)
+	if (horizontal)
 		SWAP(short, wcol->shadetop, wcol->shadedown);
 	
 	round_box_edges(&wtb, UI_CNR_ALL, rect, rad);
 	widgetbase_draw(&wtb, wcol);
 	
 	/* slider */
-	if(slider->xmax-slider->xmin<2 || slider->ymax-slider->ymin<2);
+	if (slider->xmax - slider->xmin < 2 || slider->ymax - slider->ymin < 2) ;
 	else {
 		
 		SWAP(short, wcol->shadetop, wcol->shadedown);
 		
 		copy_v4_v4_char(wcol->inner, wcol->item);
 		
-		if(wcol->shadetop>wcol->shadedown)
-			wcol->shadetop+= 20;	/* XXX violates themes... */
-		else wcol->shadedown+= 20;
+		if (wcol->shadetop > wcol->shadedown)
+			wcol->shadetop += 20;   /* XXX violates themes... */
+		else wcol->shadedown += 20;
 		
-		if(state & UI_SCROLL_PRESSED) {
-			wcol->inner[0]= wcol->inner[0]>=250? 255 : wcol->inner[0]+5;
-			wcol->inner[1]= wcol->inner[1]>=250? 255 : wcol->inner[1]+5;
-			wcol->inner[2]= wcol->inner[2]>=250? 255 : wcol->inner[2]+5;
+		if (state & UI_SCROLL_PRESSED) {
+			wcol->inner[0] = wcol->inner[0] >= 250 ? 255 : wcol->inner[0] + 5;
+			wcol->inner[1] = wcol->inner[1] >= 250 ? 255 : wcol->inner[1] + 5;
+			wcol->inner[2] = wcol->inner[2] >= 250 ? 255 : wcol->inner[2] + 5;
 		}
 
 		/* draw */
-		wtb.emboss= 0; /* only emboss once */
+		wtb.emboss = 0; /* only emboss once */
 		
 		/* exception for progress bar */
 		if (state & UI_SCROLL_NO_OUTLINE)	
@@ -2266,13 +2316,13 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat
 		
 		round_box_edges(&wtb, UI_CNR_ALL, slider, rad);
 		
-		if(state & UI_SCROLL_ARROWS) {
-			if(wcol->item[0] > 48) wcol->item[0]-= 48;
-			if(wcol->item[1] > 48) wcol->item[1]-= 48;
-			if(wcol->item[2] > 48) wcol->item[2]-= 48;
-			wcol->item[3]= 255;
+		if (state & UI_SCROLL_ARROWS) {
+			if (wcol->item[0] > 48) wcol->item[0] -= 48;
+			if (wcol->item[1] > 48) wcol->item[1] -= 48;
+			if (wcol->item[2] > 48) wcol->item[2] -= 48;
+			wcol->item[3] = 255;
 			
-			if(horizontal) {
+			if (horizontal) {
 				widget_scroll_circle(&wtb.tria1, slider, 0.6f, 'l');
 				widget_scroll_circle(&wtb.tria2, slider, 0.6f, 'r');
 			}
@@ -2296,56 +2346,56 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
 	int horizontal;
 
 	/* calculate slider part */
-	value= ui_get_but_val(but);
+	value = ui_get_but_val(but);
 
-	size= (but->softmax + but->a1 - but->softmin);
-	size= MAX2(size, 2);
+	size = (but->softmax + but->a1 - but->softmin);
+	size = MAX2(size, 2);
 	
 	/* position */
-	rect1= *rect;
+	rect1 = *rect;
 
 	/* determine horizontal/vertical */
-	horizontal= (rect->xmax - rect->xmin > rect->ymax - rect->ymin);
+	horizontal = (rect->xmax - rect->xmin > rect->ymax - rect->ymin);
 	
-	if(horizontal) {
-		fac= (rect->xmax - rect->xmin)/(size);
-		rect1.xmin= rect1.xmin + ceilf(fac*((float)value - but->softmin));
-		rect1.xmax= rect1.xmin + ceilf(fac*(but->a1 - but->softmin));
+	if (horizontal) {
+		fac = (rect->xmax - rect->xmin) / (size);
+		rect1.xmin = rect1.xmin + ceilf(fac * ((float)value - but->softmin));
+		rect1.xmax = rect1.xmin + ceilf(fac * (but->a1 - but->softmin));
 
 		/* ensure minimium size */
-		min= rect->ymax - rect->ymin;
+		min = rect->ymax - rect->ymin;
 
-		if(rect1.xmax - rect1.xmin < min) {
-			rect1.xmax= rect1.xmin + min;
+		if (rect1.xmax - rect1.xmin < min) {
+			rect1.xmax = rect1.xmin + min;
 
-			if(rect1.xmax > rect->xmax) {
-				rect1.xmax= rect->xmax;
-				rect1.xmin= MAX2(rect1.xmax - min, rect->xmin);
+			if (rect1.xmax > rect->xmax) {
+				rect1.xmax = rect->xmax;
+				rect1.xmin = MAX2(rect1.xmax - min, rect->xmin);
 			}
 		}
 	}
 	else {
-		fac= (rect->ymax - rect->ymin)/(size);
-		rect1.ymax= rect1.ymax - ceilf(fac*((float)value - but->softmin));
-		rect1.ymin= rect1.ymax - ceilf(fac*(but->a1 - but->softmin));
+		fac = (rect->ymax - rect->ymin) / (size);
+		rect1.ymax = rect1.ymax - ceilf(fac * ((float)value - but->softmin));
+		rect1.ymin = rect1.ymax - ceilf(fac * (but->a1 - but->softmin));
 
 		/* ensure minimium size */
-		min= rect->xmax - rect->xmin;
+		min = rect->xmax - rect->xmin;
 
-		if(rect1.ymax - rect1.ymin < min) {
-			rect1.ymax= rect1.ymin + min;
+		if (rect1.ymax - rect1.ymin < min) {
+			rect1.ymax = rect1.ymin + min;
 
-			if(rect1.ymax > rect->ymax) {
-				rect1.ymax= rect->ymax;
-				rect1.ymin= MAX2(rect1.ymax - min, rect->ymin);
+			if (rect1.ymax > rect->ymax) {
+				rect1.ymax = rect->ymax;
+				rect1.ymin = MAX2(rect1.ymax - min, rect->ymin);
 			}
 		}
 	}
 
-	if(state & UI_SELECT)
-		state= UI_SCROLL_PRESSED;
+	if (state & UI_SELECT)
+		state = UI_SCROLL_PRESSED;
 	else
-		state= 0;
+		state = 0;
 	uiWidgetScrollDraw(wcol, rect, &rect1, state);
 }
 
@@ -2363,7 +2413,7 @@ static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int
 	w = value * (rect_prog.xmax - rect_prog.xmin);
 	
 	/* ensure minimium size */
-	min= rect_prog.ymax - rect_prog.ymin;
+	min = rect_prog.ymax - rect_prog.ymin;
 	w = MAX2(w, min);
 	
 	rect_bar.xmax = rect_bar.xmin + w;
@@ -2378,15 +2428,15 @@ static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int
 static void widget_link(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect, int UNUSED(state), int UNUSED(roundboxalign))
 {
 	
-	if(but->flag & UI_SELECT) {
+	if (but->flag & UI_SELECT) {
 		rcti rectlink;
 		
 		UI_ThemeColor(TH_TEXT_HI);
 		
-		rectlink.xmin= (rect->xmin+rect->xmax)/2;
-		rectlink.ymin= (rect->ymin+rect->ymax)/2;
-		rectlink.xmax= but->linkto[0];
-		rectlink.ymax= but->linkto[1];
+		rectlink.xmin = (rect->xmin + rect->xmax) / 2;
+		rectlink.ymin = (rect->ymin + rect->ymax) / 2;
+		rectlink.xmax = but->linkto[0];
+		rectlink.ymax = but->linkto[1];
 		
 		ui_draw_link_bezier(&rectlink);
 	}
@@ -2406,54 +2456,54 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
 	/* backdrop first */
 	
 	/* fully rounded */
-	offs= 0.5f*(rect->ymax - rect->ymin);
-	toffs = offs*0.75f;
+	offs = 0.5f * (rect->ymax - rect->ymin);
+	toffs = offs * 0.75f;
 	round_box_edges(&wtb, roundboxalign, rect, offs);
 
-	wtb.outline= 0;
+	wtb.outline = 0;
 	widgetbase_draw(&wtb, wcol);
 	
 	/* draw left/right parts only when not in text editing */
-	if(!(state & UI_TEXTINPUT)) {
+	if (!(state & UI_TEXTINPUT)) {
 		
-			/* slider part */
+		/* slider part */
 		copy_v3_v3_char(outline, wcol->outline);
 		copy_v3_v3_char(wcol->outline, wcol->item);
 		copy_v3_v3_char(wcol->inner, wcol->item);
 
-		if(!(state & UI_SELECT))
+		if (!(state & UI_SELECT))
 			SWAP(short, wcol->shadetop, wcol->shadedown);
 		
-		rect1= *rect;
+		rect1 = *rect;
 		
-		value= ui_get_but_val(but);
-		fac= ((float)value-but->softmin)*(rect1.xmax - rect1.xmin - offs)/(but->softmax - but->softmin);
+		value = ui_get_but_val(but);
+		fac = ((float)value - but->softmin) * (rect1.xmax - rect1.xmin - offs) / (but->softmax - but->softmin);
 		
 		/* left part of slider, always rounded */
-		rect1.xmax= rect1.xmin + ceil(offs+1.0f);
+		rect1.xmax = rect1.xmin + ceil(offs + 1.0f);
 		round_box_edges(&wtb1, roundboxalign & ~(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT), &rect1, offs);
-		wtb1.outline= 0;
+		wtb1.outline = 0;
 		widgetbase_draw(&wtb1, wcol);
 		
 		/* right part of slider, interpolate roundness */
-		rect1.xmax= rect1.xmin + fac + offs;
-		rect1.xmin+=  floor(offs-1.0f);
-		if(rect1.xmax + offs > rect->xmax)
-			offs*= (rect1.xmax + offs - rect->xmax)/offs;
+		rect1.xmax = rect1.xmin + fac + offs;
+		rect1.xmin +=  floor(offs - 1.0f);
+		if (rect1.xmax + offs > rect->xmax)
+			offs *= (rect1.xmax + offs - rect->xmax) / offs;
 		else 
-			offs= 0.0f;
+			offs = 0.0f;
 		round_box_edges(&wtb1, roundboxalign & ~(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT), &rect1, offs);
 		
 		widgetbase_draw(&wtb1, wcol);
 		copy_v3_v3_char(wcol->outline, outline);
 		
-		if(!(state & UI_SELECT))
+		if (!(state & UI_SELECT))
 			SWAP(short, wcol->shadetop, wcol->shadedown);
 	}
 	
 	/* outline */
-	wtb.outline= 1;
-	wtb.inner= 0;
+	wtb.outline = 1;
+	wtb.inner = 0;
 	widgetbase_draw(&wtb, wcol);
 	
 	/* text space */
@@ -2470,14 +2520,14 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
 	float col[4];
 	int color_profile = but->block->color_profile;
 	
-	col[3]= 1.0f;
+	col[3] = 1.0f;
 
 	if (but->rnaprop) {
 		if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA)
 			color_profile = BLI_PR_NONE;
 
-		if(RNA_property_array_length(&but->rnapoin, but->rnaprop)==4) {
-			col[3]= RNA_property_float_get_index(&but->rnapoin, but->rnaprop, 3);
+		if (RNA_property_array_length(&but->rnapoin, but->rnaprop) == 4) {
+			col[3] = RNA_property_float_get_index(&but->rnapoin, but->rnaprop, 3);
 		}
 	}
 	
@@ -2488,15 +2538,15 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
 		
 	ui_get_but_vectorf(but, col);
 	
-	if(state & (UI_BUT_ANIMATED|UI_BUT_ANIMATED_KEY|UI_BUT_DRIVEN|UI_BUT_REDALERT)) {
+	if (state & (UI_BUT_ANIMATED | UI_BUT_ANIMATED_KEY | UI_BUT_DRIVEN | UI_BUT_REDALERT)) {
 		// draw based on state - color for keyed etc
 		widgetbase_draw(&wtb, wcol);
 		
 		// inset to draw swatch color
-		rect->xmin+= SWATCH_KEYED_BORDER;
-		rect->xmax-= SWATCH_KEYED_BORDER;
-		rect->ymin+= SWATCH_KEYED_BORDER;
-		rect->ymax-= SWATCH_KEYED_BORDER;
+		rect->xmin += SWATCH_KEYED_BORDER;
+		rect->xmax -= SWATCH_KEYED_BORDER;
+		rect->ymin += SWATCH_KEYED_BORDER;
+		rect->ymax -= SWATCH_KEYED_BORDER;
 		
 		round_box_edges(&wtb, roundboxalign, rect, 5.0f);
 	}
@@ -2515,11 +2565,11 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat
 
 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)) {
+	if (state & (UI_BUT_ANIMATED | UI_BUT_ANIMATED_KEY | UI_BUT_DRIVEN | UI_BUT_REDALERT)) {
 		uiWidgetBase wtb;
 	
 		widget_init(&wtb);
-		wtb.outline= 0;
+		wtb.outline = 0;
 		
 		/* rounded */
 		round_box_edges(&wtb, UI_CNR_ALL, rect, 10.0f);
@@ -2532,7 +2582,7 @@ static void widget_textbut(uiWidgetColors *wcol, rcti *rect, int state, int roun
 {
 	uiWidgetBase wtb;
 	
-	if(state & UI_SELECT)
+	if (state & UI_SELECT)
 		SWAP(short, wcol->shadetop, wcol->shadedown);
 	
 	widget_init(&wtb);
@@ -2560,7 +2610,7 @@ static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state),
 	widgetbase_draw(&wtb, wcol);
 	
 	/* text space */
-	rect->xmax -= (rect->ymax-rect->ymin);
+	rect->xmax -= (rect->ymax - rect->ymin);
 }
 
 static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
@@ -2580,7 +2630,7 @@ static void widget_menunodebut(uiWidgetColors *wcol, rcti *rect, int UNUSED(stat
 {
 	/* silly node link button hacks */
 	uiWidgetBase wtb;
-	uiWidgetColors wcol_backup= *wcol;
+	uiWidgetColors wcol_backup = *wcol;
 	
 	widget_init(&wtb);
 	
@@ -2596,14 +2646,14 @@ static void widget_menunodebut(uiWidgetColors *wcol, rcti *rect, int UNUSED(stat
 	
 	/* decoration */
 	widgetbase_draw(&wtb, wcol);
-	*wcol= wcol_backup;
+	*wcol = wcol_backup;
 }
 
 static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign))
 {
-	if(state & UI_ACTIVE) {
+	if (state & UI_ACTIVE) {
 		uiWidgetBase wtb;
-		float rad= 0.5f*(rect->ymax - rect->ymin); // 4.0f
+		float rad = 0.5f * (rect->ymax - rect->ymin); // 4.0f
 		
 		widget_init(&wtb);
 		
@@ -2621,7 +2671,7 @@ static void widget_menu_itembut(uiWidgetColors *wcol, rcti *rect, int UNUSED(sta
 	widget_init(&wtb);
 	
 	/* not rounded, no outline */
-	wtb.outline= 0;
+	wtb.outline = 0;
 	round_box_edges(&wtb, 0, rect, 0.0f);
 	
 	widgetbase_draw(&wtb, wcol);
@@ -2634,7 +2684,7 @@ static void widget_list_itembut(uiWidgetColors *wcol, rcti *rect, int UNUSED(sta
 	widget_init(&wtb);
 	
 	/* rounded, but no outline */
-	wtb.outline= 0;
+	wtb.outline = 0;
 	round_box_edges(&wtb, UI_CNR_ALL, rect, 4.0f);
 	
 	widgetbase_draw(&wtb, wcol);
@@ -2643,33 +2693,33 @@ static void widget_list_itembut(uiWidgetColors *wcol, rcti *rect, int UNUSED(sta
 static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign))
 {
 	uiWidgetBase wtb;
-	rcti recttemp= *rect;
+	rcti recttemp = *rect;
 	int delta;
 	
 	widget_init(&wtb);
 	
 	/* square */
-	recttemp.xmax= recttemp.xmin + (recttemp.ymax-recttemp.ymin);
+	recttemp.xmax = recttemp.xmin + (recttemp.ymax - recttemp.ymin);
 	
 	/* smaller */
-	delta= 1 + (recttemp.ymax-recttemp.ymin)/8;
-	recttemp.xmin+= delta;
-	recttemp.ymin+= delta;
-	recttemp.xmax-= delta;
-	recttemp.ymax-= delta;
+	delta = 1 + (recttemp.ymax - recttemp.ymin) / 8;
+	recttemp.xmin += delta;
+	recttemp.ymin += delta;
+	recttemp.xmax -= delta;
+	recttemp.ymax -= delta;
 	
 	/* half rounded */
 	round_box_edges(&wtb, UI_CNR_ALL, &recttemp, 4.0f);
 	
 	/* decoration */
-	if(state & UI_SELECT) {
+	if (state & UI_SELECT) {
 		widget_check_trias(&wtb.tria1, &recttemp);
 	}
 	
 	widgetbase_draw(&wtb, wcol);
 	
 	/* text space */
-	rect->xmin += (rect->ymax-rect->ymin)*0.7 + delta;
+	rect->xmin += (rect->ymax - rect->ymin) * 0.7 + delta;
 }
 
 
@@ -2710,7 +2760,7 @@ static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(
 	/* store the box bg as gl clearcolor, to retrieve later when drawing semi-transparent rects
 	 * over the top to indicate disabled buttons */
 	/* XXX, this doesnt work right since the color applies to buttons outside the box too. */
-	glClearColor(wcol->inner[0]/255.0, wcol->inner[1]/255.0, wcol->inner[2]/255.0, 1.0);
+	glClearColor(wcol->inner[0] / 255.0, wcol->inner[1] / 255.0, wcol->inner[2] / 255.0, 1.0);
 	
 	copy_v3_v3_char(wcol->inner, old_col);
 }
@@ -2731,7 +2781,7 @@ static void widget_but(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int
 static void widget_roundbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
 {
 	uiWidgetBase wtb;
-	float rad= 5.0f; //0.5f*(rect->ymax - rect->ymin);
+	float rad = 5.0f; //0.5f*(rect->ymax - rect->ymin);
 	
 	widget_init(&wtb);
 	
@@ -2747,11 +2797,11 @@ static void widget_draw_extra_mask(const bContext *C, uiBut *but, uiWidgetType *
 	unsigned char col[4];
 	
 	/* state copy! */
-	wt->wcol= *(wt->wcol_theme);
+	wt->wcol = *(wt->wcol_theme);
 	
 	widget_init(&wtb);
 	
-	if(but->block->drawextra) {
+	if (but->block->drawextra) {
 		/* note: drawextra can change rect +1 or -1, to match round errors of existing previews */
 		but->block->drawextra(C, but->poin, but->block->drawextra_arg1, but->block->drawextra_arg2, rect);
 		
@@ -2765,8 +2815,8 @@ static void widget_draw_extra_mask(const bContext *C, uiBut *but, uiWidgetType *
 	
 	/* outline */
 	round_box_edges(&wtb, UI_CNR_ALL, rect, 5.0f);
-	wtb.outline= 1;
-	wtb.inner= 0;
+	wtb.outline = 1;
+	wtb.inner = 0;
 	widgetbase_draw(&wtb, &wt->wcol);
 	
 }
@@ -2784,68 +2834,73 @@ static void widget_disabled(rcti *rect)
 
 	/* need -1 and +1 to make it work right for aligned buttons,
 	 * but problem may be somewhere else? */
-	glRectf(rect->xmin-1, rect->ymin-1, rect->xmax, rect->ymax+1);
+	glRectf(rect->xmin - 1, rect->ymin - 1, rect->xmax, rect->ymax + 1);
 	
 	glDisable(GL_BLEND);
 }
 
 static uiWidgetType *widget_type(uiWidgetTypeEnum type)
 {
-	bTheme *btheme= UI_GetTheme();
+	bTheme *btheme = UI_GetTheme();
 	static uiWidgetType wt;
 	
 	/* defaults */
-	wt.wcol_theme= &btheme->tui.wcol_regular;
-	wt.wcol_state= &btheme->tui.wcol_state;
-	wt.state= widget_state;
-	wt.draw= widget_but;
-	wt.custom= NULL;
-	wt.text= widget_draw_text_icon;
-	
-	switch(type) {
+	wt.wcol_theme = &btheme->tui.wcol_regular;
+	wt.wcol_state = &btheme->tui.wcol_state;
+	wt.state = widget_state;
+	wt.draw = widget_but;
+	wt.custom = NULL;
+	wt.text = widget_draw_text_icon;
+	
+	switch (type) {
 		case UI_WTYPE_REGULAR:
 			break;
 
 		case UI_WTYPE_LABEL:
-			wt.draw= NULL;
-			wt.state= widget_state_label;
+			wt.draw = NULL;
+			wt.state = widget_state_label;
 			break;
 			
 		case UI_WTYPE_TOGGLE:
-			wt.wcol_theme= &btheme->tui.wcol_toggle;
+			wt.wcol_theme = &btheme->tui.wcol_toggle;
 			break;
 			
 		case UI_WTYPE_OPTION:
-			wt.wcol_theme= &btheme->tui.wcol_option;
-			wt.draw= widget_optionbut;
+			wt.wcol_theme = &btheme->tui.wcol_option;
+			wt.draw = widget_optionbut;
 			break;
 			
 		case UI_WTYPE_RADIO:
-			wt.wcol_theme= &btheme->tui.wcol_radio;
-			wt.draw= widget_radiobut;
+			wt.wcol_theme = &btheme->tui.wcol_radio;
+			wt.draw = widget_radiobut;
 			break;
 
 		case UI_WTYPE_NUMBER:
-			wt.wcol_theme= &btheme->tui.wcol_num;
-			wt.draw= widget_numbut;
+			wt.wcol_theme = &btheme->tui.wcol_num;
+			wt.draw = widget_numbut;
 			break;
 			
 		case UI_WTYPE_SLIDER:
-			wt.wcol_theme= &btheme->tui.wcol_numslider;
-			wt.custom= widget_numslider;
-			wt.state= widget_state_numslider;
+			wt.wcol_theme = &btheme->tui.wcol_numslider;
+			wt.custom = widget_numslider;
+			wt.state = widget_state_numslider;
 			break;
 			
 		case UI_WTYPE_EXEC:
-			wt.wcol_theme= &btheme->tui.wcol_tool;
-			wt.draw= widget_roundbut;
+			wt.wcol_theme = &btheme->tui.wcol_tool;
+			wt.draw = widget_roundbut;
+			break;
+
+		case UI_WTYPE_TOOLTIP:
+			wt.wcol_theme = &btheme->tui.wcol_tooltip;
+			wt.draw = widget_menu_back;
 			break;
 			
 			
-			/* strings */
+		/* strings */
 		case UI_WTYPE_NAME:
-			wt.wcol_theme= &btheme->tui.wcol_text;
-			wt.draw= widget_textbut;
+			wt.wcol_theme = &btheme->tui.wcol_text;
+			wt.draw = widget_textbut;
 			break;
 			
 		case UI_WTYPE_NAME_LINK:
@@ -2858,57 +2913,57 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type)
 			break;
 			
 			
-			/* start menus */
+		/* start menus */
 		case UI_WTYPE_MENU_RADIO:
-			wt.wcol_theme= &btheme->tui.wcol_menu;
-			wt.draw= widget_menubut;
+			wt.wcol_theme = &btheme->tui.wcol_menu;
+			wt.draw = widget_menubut;
 			break;
 
 		case UI_WTYPE_MENU_ICON_RADIO:
-			wt.wcol_theme= &btheme->tui.wcol_menu;
-			wt.draw= widget_menuiconbut;
+			wt.wcol_theme = &btheme->tui.wcol_menu;
+			wt.draw = widget_menuiconbut;
 			break;
 			
 		case UI_WTYPE_MENU_POINTER_LINK:
-			wt.wcol_theme= &btheme->tui.wcol_menu;
-			wt.draw= widget_menubut;
+			wt.wcol_theme = &btheme->tui.wcol_menu;
+			wt.draw = widget_menubut;
 			break;
 
 		case UI_WTYPE_MENU_NODE_LINK:
-			wt.wcol_theme= &btheme->tui.wcol_menu;
-			wt.draw= widget_menunodebut;
+			wt.wcol_theme = &btheme->tui.wcol_menu;
+			wt.draw = widget_menunodebut;
 			break;
 			
 		case UI_WTYPE_PULLDOWN:
-			wt.wcol_theme= &btheme->tui.wcol_pulldown;
-			wt.draw= widget_pulldownbut;
-			wt.state= widget_state_pulldown;
+			wt.wcol_theme = &btheme->tui.wcol_pulldown;
+			wt.draw = widget_pulldownbut;
+			wt.state = widget_state_pulldown;
 			break;
 			
-			/* in menus */
+		/* in menus */
 		case UI_WTYPE_MENU_ITEM:
-			wt.wcol_theme= &btheme->tui.wcol_menu_item;
-			wt.draw= widget_menu_itembut;
-			wt.state= widget_state_menu_item;
+			wt.wcol_theme = &btheme->tui.wcol_menu_item;
+			wt.draw = widget_menu_itembut;
+			wt.state = widget_state_menu_item;
 			break;
 			
 		case UI_WTYPE_MENU_BACK:
-			wt.wcol_theme= &btheme->tui.wcol_menu_back;
-			wt.draw= widget_menu_back;
+			wt.wcol_theme = &btheme->tui.wcol_menu_back;
+			wt.draw = widget_menu_back;
 			break;
 			
-			/* specials */
+		/* specials */
 		case UI_WTYPE_ICON:
-			wt.custom= widget_icon_has_anim;
+			wt.custom = widget_icon_has_anim;
 			break;
 			
 		case UI_WTYPE_SWATCH:
-			wt.custom= widget_swatch;
+			wt.custom = widget_swatch;
 			break;
 			
 		case UI_WTYPE_BOX:
-			wt.custom= widget_box;
-			wt.wcol_theme= &btheme->tui.wcol_box;
+			wt.custom = widget_box;
+			wt.wcol_theme = &btheme->tui.wcol_box;
 			break;
 			
 		case UI_WTYPE_RGB_PICKER:
@@ -2918,19 +2973,19 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type)
 			break;
 
 		case UI_WTYPE_SCROLL:
-			wt.wcol_theme= &btheme->tui.wcol_scroll;
-			wt.state= widget_state_nothing;
-			wt.custom= widget_scroll;
+			wt.wcol_theme = &btheme->tui.wcol_scroll;
+			wt.state = widget_state_nothing;
+			wt.custom = widget_scroll;
 			break;
 
 		case UI_WTYPE_LISTITEM:
-			wt.wcol_theme= &btheme->tui.wcol_list_item;
-			wt.draw= widget_list_itembut;
+			wt.wcol_theme = &btheme->tui.wcol_list_item;
+			wt.draw = widget_list_itembut;
 			break;
 			
 		case UI_WTYPE_PROGRESSBAR:
-			wt.wcol_theme= &btheme->tui.wcol_progress;
-			wt.custom= widget_progressbar;
+			wt.wcol_theme = &btheme->tui.wcol_progress;
+			wt.custom = widget_progressbar;
 			break;
 	}
 	
@@ -2941,14 +2996,14 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type)
 static int widget_roundbox_set(uiBut *but, rcti *rect)
 {
 	/* alignment */
-	if(but->flag & UI_BUT_ALIGN) {
+	if (but->flag & UI_BUT_ALIGN) {
 		
-		if(but->flag & UI_BUT_ALIGN_TOP)
-			rect->ymax+= 1;
-		if(but->flag & UI_BUT_ALIGN_LEFT)
-			rect->xmin-= 1;
+		if (but->flag & UI_BUT_ALIGN_TOP)
+			rect->ymax += 1;
+		if (but->flag & UI_BUT_ALIGN_LEFT)
+			rect->xmin -= 1;
 		
-		switch(but->flag & UI_BUT_ALIGN) {
+		switch (but->flag & UI_BUT_ALIGN) {
 			case UI_BUT_ALIGN_TOP:
 				return UI_CNR_BOTTOM_LEFT | UI_CNR_BOTTOM_RIGHT;
 			case UI_BUT_ALIGN_DOWN:
@@ -2976,13 +3031,13 @@ static int widget_roundbox_set(uiBut *but, rcti *rect)
 /* conversion from old to new buttons, so still messy */
 void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rcti *rect)
 {
-	bTheme *btheme= UI_GetTheme();
-	ThemeUI *tui= &btheme->tui;
-	uiFontStyle *fstyle= &style->widget;
-	uiWidgetType *wt= NULL;
+	bTheme *btheme = UI_GetTheme();
+	ThemeUI *tui = &btheme->tui;
+	uiFontStyle *fstyle = &style->widget;
+	uiWidgetType *wt = NULL;
 
 	/* handle menus separately */
-	if(but->dt==UI_EMBOSSP) {
+	if (but->dt == UI_EMBOSSP) {
 		switch (but->type) {
 			case LABEL:
 				widget_draw_text_icon(&style->widgetlabel, &tui->wcol_menu_back, but, rect);
@@ -2992,22 +3047,22 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
 				break;
 				
 			default:
-				wt= widget_type(UI_WTYPE_MENU_ITEM);
+				wt = widget_type(UI_WTYPE_MENU_ITEM);
 		}
 	}
-	else if(but->dt==UI_EMBOSSN) {
+	else if (but->dt == UI_EMBOSSN) {
 		/* "nothing" */
-		wt= widget_type(UI_WTYPE_ICON);
+		wt = widget_type(UI_WTYPE_ICON);
 	}
 	else {
 		
 		switch (but->type) {
 			case LABEL:
-				if(but->block->flag & UI_BLOCK_LOOP)
+				if (but->block->flag & UI_BLOCK_LOOP)
 					widget_draw_text_icon(&style->widgetlabel, &tui->wcol_menu_back, but, rect);
 				else {
-					wt= widget_type(UI_WTYPE_LABEL);
-					fstyle= &style->widgetlabel;
+					wt = widget_type(UI_WTYPE_LABEL);
+					fstyle = &style->widgetlabel;
 				}
 				break;
 				
@@ -3015,90 +3070,90 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
 				break;
 				
 			case BUT:
-				wt= widget_type(UI_WTYPE_EXEC);
+				wt = widget_type(UI_WTYPE_EXEC);
 				break;
 
 			case NUM:
-				wt= widget_type(UI_WTYPE_NUMBER);
+				wt = widget_type(UI_WTYPE_NUMBER);
 				break;
 				
 			case NUMSLI:
 			case HSVSLI:
-				wt= widget_type(UI_WTYPE_SLIDER);
+				wt = widget_type(UI_WTYPE_SLIDER);
 				break;
 				
 			case ROW:
-				wt= widget_type(UI_WTYPE_RADIO);
+				wt = widget_type(UI_WTYPE_RADIO);
 				break;
 
 			case LISTROW:
-				wt= widget_type(UI_WTYPE_LISTITEM);
+				wt = widget_type(UI_WTYPE_LISTITEM);
 				break;
 				
 			case TEX:
-				wt= widget_type(UI_WTYPE_NAME);
+				wt = widget_type(UI_WTYPE_NAME);
 				break;
 				
 			case SEARCH_MENU:
-				wt= widget_type(UI_WTYPE_NAME);
-				if(but->block->flag & UI_BLOCK_LOOP)
-					wt->wcol_theme= &btheme->tui.wcol_menu_back;
+				wt = widget_type(UI_WTYPE_NAME);
+				if (but->block->flag & UI_BLOCK_LOOP)
+					wt->wcol_theme = &btheme->tui.wcol_menu_back;
 				break;
 				
 			case TOGBUT:
 			case TOG:
 			case TOGN:
 			case TOG3:
-				wt= widget_type(UI_WTYPE_TOGGLE);
+				wt = widget_type(UI_WTYPE_TOGGLE);
 				break;
 				
 			case OPTION:
 			case OPTIONN:
 				if (!(but->flag & UI_HAS_ICON)) {
-					wt= widget_type(UI_WTYPE_OPTION);
+					wt = widget_type(UI_WTYPE_OPTION);
 					but->flag |= UI_TEXT_LEFT;
 				}
 				else
-					wt= widget_type(UI_WTYPE_TOGGLE);
+					wt = widget_type(UI_WTYPE_TOGGLE);
 				
 				/* option buttons have strings outside, on menus use different colors */
-				if(but->block->flag & UI_BLOCK_LOOP)
-					wt->state= widget_state_option_menu;
+				if (but->block->flag & UI_BLOCK_LOOP)
+					wt->state = widget_state_option_menu;
 				
 				break;
 				
 			case MENU:
 			case BLOCK:
 			case ICONTEXTROW:
-				if(but->flag & UI_BUT_NODE_LINK)
-					wt= widget_type(UI_WTYPE_MENU_NODE_LINK);
-				else if(!but->str[0] && but->icon)
-					wt= widget_type(UI_WTYPE_MENU_ICON_RADIO);
+				if (but->flag & UI_BUT_NODE_LINK)
+					wt = widget_type(UI_WTYPE_MENU_NODE_LINK);
+				else if (!but->str[0] && but->icon)
+					wt = widget_type(UI_WTYPE_MENU_ICON_RADIO);
 				else
-					wt= widget_type(UI_WTYPE_MENU_RADIO);
+					wt = widget_type(UI_WTYPE_MENU_RADIO);
 				break;
 				
 			case PULLDOWN:
-				wt= widget_type(UI_WTYPE_PULLDOWN);
+				wt = widget_type(UI_WTYPE_PULLDOWN);
 				break;
 			
 			case BUTM:
-				wt= widget_type(UI_WTYPE_MENU_ITEM);
+				wt = widget_type(UI_WTYPE_MENU_ITEM);
 				break;
 				
 			case COL:
-				wt= widget_type(UI_WTYPE_SWATCH);
+				wt = widget_type(UI_WTYPE_SWATCH);
 				break;
 				
 			case ROUNDBOX:
 			case LISTBOX:
-				wt= widget_type(UI_WTYPE_BOX);
+				wt = widget_type(UI_WTYPE_BOX);
 				break;
 				
 			case LINK:
 			case INLINK:
-				wt= widget_type(UI_WTYPE_ICON);
-				wt->custom= widget_link;
+				wt = widget_type(UI_WTYPE_ICON);
+				wt->custom = widget_link;
 				
 				break;
 			
@@ -3107,7 +3162,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
 				break;
 				
 			case HSVCUBE:
-				if(but->a1 == UI_GRAD_V_ALT) // vertical V slider, uses new widget draw now
+				if (but->a1 == UI_GRAD_V_ALT) // vertical V slider, uses new widget draw now
 					ui_draw_but_HSV_v(but, rect);
 				else  // other HSV pickers...
 					ui_draw_but_HSVCUBE(but, rect);
@@ -3146,12 +3201,12 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
 				break;
 				
 			case PROGRESSBAR:
-				wt= widget_type(UI_WTYPE_PROGRESSBAR);
-				fstyle= &style->widgetlabel;
+				wt = widget_type(UI_WTYPE_PROGRESSBAR);
+				fstyle = &style->widgetlabel;
 				break;
 
 			case SCROLL:
-				wt= widget_type(UI_WTYPE_SCROLL);
+				wt = widget_type(UI_WTYPE_SCROLL);
 				break;
 
 			case TRACKPREVIEW:
@@ -3159,66 +3214,80 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct
 				break;
 
 			default:
-				wt= widget_type(UI_WTYPE_REGULAR);
+				wt = widget_type(UI_WTYPE_REGULAR);
 		}
 	}
 	
-	if(wt) {
-		rcti disablerect= *rect; /* rect gets clipped smaller for text */
+	if (wt) {
+		rcti disablerect = *rect; /* rect gets clipped smaller for text */
 		int roundboxalign, state;
 		
-		roundboxalign= widget_roundbox_set(but, rect);
+		roundboxalign = widget_roundbox_set(but, rect);
 
-		state= but->flag;
-		if(but->editstr) state |= UI_TEXTINPUT;
+		state = but->flag;
+		if (but->editstr) state |= UI_TEXTINPUT;
 		
 		wt->state(wt, state);
-		if(wt->custom)
+		if (wt->custom)
 			wt->custom(but, &wt->wcol, rect, state, roundboxalign);
-		else if(wt->draw)
+		else if (wt->draw)
 			wt->draw(&wt->wcol, rect, state, roundboxalign);
 		wt->text(fstyle, &wt->wcol, but, rect);
 		
-		if(state & (UI_BUT_DISABLED|UI_BUT_INACTIVE))
-			if(but->dt!=UI_EMBOSSP)
+		if (state & (UI_BUT_DISABLED | UI_BUT_INACTIVE))
+			if (but->dt != UI_EMBOSSP)
 				widget_disabled(&disablerect);
 	}
 }
 
 void ui_draw_menu_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
 {
-	uiWidgetType *wt= widget_type(UI_WTYPE_MENU_BACK);
+	uiWidgetType *wt = widget_type(UI_WTYPE_MENU_BACK);
 	
 	wt->state(wt, 0);
-	if(block)
+	if (block)
 		wt->draw(&wt->wcol, rect, block->flag, block->direction);
 	else
 		wt->draw(&wt->wcol, rect, 0, 0);
 	
-	if(block) {
-		if(block->flag & UI_BLOCK_CLIPTOP) {
+	if (block) {
+		if (block->flag & UI_BLOCK_CLIPTOP) {
 			/* XXX no scaling for UI here yet */
-			glColor3ubv((unsigned char*)wt->wcol.text);
-			UI_DrawTriIcon((rect->xmax+rect->xmin)/2, rect->ymax-8, 't');
+			glColor3ubv((unsigned char *)wt->wcol.text);
+			UI_DrawTriIcon((rect->xmax + rect->xmin) / 2, rect->ymax - 8, 't');
 		}
-		if(block->flag & UI_BLOCK_CLIPBOTTOM) {
+		if (block->flag & UI_BLOCK_CLIPBOTTOM) {
 			/* XXX no scaling for UI here yet */
-			glColor3ubv((unsigned char*)wt->wcol.text);
-			UI_DrawTriIcon((rect->xmax+rect->xmin)/2, rect->ymin+10, 'v');
+			glColor3ubv((unsigned char *)wt->wcol.text);
+			UI_DrawTriIcon((rect->xmax + rect->xmin) / 2, rect->ymin + 10, 'v');
 		}
 	}	
 }
 
+uiWidgetColors *ui_tooltip_get_theme(void)
+{
+	uiWidgetType *wt = widget_type(UI_WTYPE_TOOLTIP);
+	return wt->wcol_theme;
+}
+
+void ui_draw_tooltip_background(uiStyle *UNUSED(style), uiBlock *UNUSED(block), rcti *rect)
+{
+	uiWidgetType *wt = widget_type(UI_WTYPE_TOOLTIP);
+	wt->state(wt, 0);
+	/* wt->draw ends up using same function to draw the tooltip as menu_back */
+	wt->draw(&wt->wcol, rect, 0, 0);
+}
+
 void ui_draw_search_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
 {
-	uiWidgetType *wt= widget_type(UI_WTYPE_BOX);
+	uiWidgetType *wt = widget_type(UI_WTYPE_BOX);
 	
 	glEnable(GL_BLEND);
 	widget_softshadow(rect, UI_CNR_ALL, 5.0f, 8.0f);
 	glDisable(GL_BLEND);
 
 	wt->state(wt, 0);
-	if(block)
+	if (block)
 		wt->draw(&wt->wcol, rect, block->flag, UI_CNR_ALL);
 	else
 		wt->draw(&wt->wcol, rect, 0, UI_CNR_ALL);
@@ -3230,44 +3299,44 @@ void ui_draw_search_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect)
 /* state: UI_ACTIVE or 0 */
 void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state)
 {
-	uiWidgetType *wt= widget_type(UI_WTYPE_MENU_ITEM);
-	rcti _rect= *rect;
+	uiWidgetType *wt = widget_type(UI_WTYPE_MENU_ITEM);
+	rcti _rect = *rect;
 	char *cpoin;
 	
 	wt->state(wt, state);
 	wt->draw(&wt->wcol, rect, 0, 0);
 	
 	uiStyleFontSet(fstyle);
-	fstyle->align= UI_STYLE_TEXT_LEFT;
+	fstyle->align = UI_STYLE_TEXT_LEFT;
 	
 	/* text location offset */
-	rect->xmin+=5;
-	if(iconid) rect->xmin+= UI_DPI_ICON_SIZE;
+	rect->xmin += 5;
+	if (iconid) rect->xmin += UI_DPI_ICON_SIZE;
 
 	/* cut string in 2 parts? */
-	cpoin= strchr(name, '|');
-	if(cpoin) {
-		*cpoin= 0;
-		rect->xmax -= BLF_width(fstyle->uifont_id, cpoin+1) + 10;
+	cpoin = strchr(name, '|');
+	if (cpoin) {
+		*cpoin = 0;
+		rect->xmax -= BLF_width(fstyle->uifont_id, cpoin + 1) + 10;
 	}
 	
-	glColor3ubv((unsigned char*)wt->wcol.text);
+	glColor3ubv((unsigned char *)wt->wcol.text);
 	uiStyleFontDraw(fstyle, rect, name);
 	
 	/* part text right aligned */
-	if(cpoin) {
-		fstyle->align= UI_STYLE_TEXT_RIGHT;
-		rect->xmax= _rect.xmax - 5;
-		uiStyleFontDraw(fstyle, rect, cpoin+1);
-		*cpoin= '|';
+	if (cpoin) {
+		fstyle->align = UI_STYLE_TEXT_RIGHT;
+		rect->xmax = _rect.xmax - 5;
+		uiStyleFontDraw(fstyle, rect, cpoin + 1);
+		*cpoin = '|';
 	}
 	
 	/* restore rect, was messed with */
-	*rect= _rect;
+	*rect = _rect;
 
-	if(iconid) {
-		int xs= rect->xmin+4;
-		int ys= 1 + (rect->ymin+rect->ymax- UI_DPI_ICON_SIZE)/2;
+	if (iconid) {
+		int xs = rect->xmin + 4;
+		int ys = 1 + (rect->ymin + rect->ymax - UI_DPI_ICON_SIZE) / 2;
 		glEnable(GL_BLEND);
 		UI_icon_draw_aspect(xs, ys, iconid, 1.2f, 0.5f); /* XXX scale weak get from fstyle? */
 		glDisable(GL_BLEND);
@@ -3276,25 +3345,45 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic
 
 void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state)
 {
-	rcti trect = *rect;
+	rcti trect = *rect, bg_rect;
 	float font_dims[2] = {0.0f, 0.0f};
-	uiWidgetType *wt= widget_type(UI_WTYPE_MENU_ITEM);
+	uiWidgetType *wt = widget_type(UI_WTYPE_MENU_ITEM);
+	unsigned char bg_col[3];
 	
 	wt->state(wt, state);
 	wt->draw(&wt->wcol, rect, 0, 0);
 	
 	widget_draw_preview(iconid, 1.0f, rect);
 	
-	if (state == UI_ACTIVE)
-		glColor3ubv((unsigned char*)wt->wcol.text);
-	else
-		glColor3ubv((unsigned char*)wt->wcol.text_sel);
-
 	BLF_width_and_height(fstyle->uifont_id, name, &font_dims[0], &font_dims[1]);
 
+	/* text rect */
 	trect.xmin += 0;
 	trect.xmax = trect.xmin + font_dims[0] + 10;
 	trect.ymin += 10;
 	trect.ymax = trect.ymin + font_dims[1];
+	if (trect.xmax > rect->xmax - PREVIEW_PAD)
+		trect.xmax = rect->xmax - PREVIEW_PAD;
+
+	bg_rect = trect;
+	bg_rect.xmin = rect->xmin + PREVIEW_PAD;
+	bg_rect.ymin = rect->ymin + PREVIEW_PAD;
+	bg_rect.xmax = rect->xmax - PREVIEW_PAD;
+	bg_rect.ymax += PREVIEW_PAD / 2;
+	
+	if (bg_rect.xmax > rect->xmax - PREVIEW_PAD)
+		bg_rect.xmax = rect->xmax - PREVIEW_PAD;
+
+	UI_GetThemeColor3ubv(TH_BUTBACK, bg_col);
+	glColor4ubv((unsigned char *)wt->wcol.item);
+	glEnable(GL_BLEND);
+	glRecti(bg_rect.xmin, bg_rect.ymin, bg_rect.xmax, bg_rect.ymax);
+	glDisable(GL_BLEND);
+	
+	if (state == UI_ACTIVE)
+		glColor3ubv((unsigned char *)wt->wcol.text);
+	else
+		glColor3ubv((unsigned char *)wt->wcol.text_sel);
+
 	uiStyleFontDraw(fstyle, &trect, name);
 }
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 5eacef1..9f4a351 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -43,6 +43,7 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
+#include "BLI_math.h"
 
 #include "BKE_DerivedMesh.h"
 #include "BKE_global.h"
@@ -60,9 +61,9 @@
 /* global for themes */
 typedef void (*VectorDrawFunc)(int x, int y, int w, int h, float alpha);
 
-static bTheme *theme_active=NULL;
-static int theme_spacetype= SPACE_VIEW3D;
-static int theme_regionid= RGN_TYPE_WINDOW;
+static bTheme *theme_active = NULL;
+static int theme_spacetype = SPACE_VIEW3D;
+static int theme_regionid = RGN_TYPE_WINDOW;
 
 void ui_resources_init(void)
 {
@@ -81,385 +82,393 @@ void ui_resources_free(void)
 
 const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
 {
-	ThemeSpace *ts= NULL;
-	static char error[4]={240, 0, 240, 255};
-	static char alert[4]={240, 60, 60, 255};
-	static char headerdesel[4]={0,0,0,255};
+	ThemeSpace *ts = NULL;
+	static char error[4] = {240, 0, 240, 255};
+	static char alert[4] = {240, 60, 60, 255};
+	static char headerdesel[4] = {0, 0, 0, 255};
 	
-	const char *cp= error;
+	const char *cp = error;
 	
-	if(btheme) {
+	if (btheme) {
 	
 		// first check for ui buttons theme
-		if(colorid < TH_THEMEUI) {
+		if (colorid < TH_THEMEUI) {
 		
-			switch(colorid) {
+			switch (colorid) {
 
-			case TH_REDALERT:
-				cp= alert; break;
+				case TH_REDALERT:
+					cp = alert; break;
 			}
 		}
 		else {
 		
-			switch(spacetype) {
-			case SPACE_BUTS:
-				ts= &btheme->tbuts;
-				break;
-			case SPACE_VIEW3D:
-				ts= &btheme->tv3d;
-				break;
-			case SPACE_IPO:
-				ts= &btheme->tipo;
-				break;
-			case SPACE_FILE:
-				ts= &btheme->tfile;
-				break;
-			case SPACE_NLA:
-				ts= &btheme->tnla;
-				break;
-			case SPACE_ACTION:
-				ts= &btheme->tact;
-				break;
-			case SPACE_SEQ:
-				ts= &btheme->tseq;
-				break;
-			case SPACE_IMAGE:
-				ts= &btheme->tima;
-				break;
-			case SPACE_TEXT:
-				ts= &btheme->text;
-				break;
-			case SPACE_OUTLINER:
-				ts= &btheme->toops;
-				break;
-			case SPACE_INFO:
-				ts= &btheme->tinfo;
-				break;
-			case SPACE_USERPREF:
-				ts= &btheme->tuserpref;
-				break;
-			case SPACE_CONSOLE:
-				ts= &btheme->tconsole;
-				break;
-			case SPACE_TIME:
-				ts= &btheme->ttime;
-				break;
-			case SPACE_NODE:
-				ts= &btheme->tnode;
-				break;
-			case SPACE_LOGIC:
-				ts= &btheme->tlogic;
-				break;
-			case SPACE_CLIP:
-				ts= &btheme->tclip;
-				break;
-			default:
-				ts= &btheme->tv3d;
-				break;
+			switch (spacetype) {
+				case SPACE_BUTS:
+					ts = &btheme->tbuts;
+					break;
+				case SPACE_VIEW3D:
+					ts = &btheme->tv3d;
+					break;
+				case SPACE_IPO:
+					ts = &btheme->tipo;
+					break;
+				case SPACE_FILE:
+					ts = &btheme->tfile;
+					break;
+				case SPACE_NLA:
+					ts = &btheme->tnla;
+					break;
+				case SPACE_ACTION:
+					ts = &btheme->tact;
+					break;
+				case SPACE_SEQ:
+					ts = &btheme->tseq;
+					break;
+				case SPACE_IMAGE:
+					ts = &btheme->tima;
+					break;
+				case SPACE_TEXT:
+					ts = &btheme->text;
+					break;
+				case SPACE_OUTLINER:
+					ts = &btheme->toops;
+					break;
+				case SPACE_INFO:
+					ts = &btheme->tinfo;
+					break;
+				case SPACE_USERPREF:
+					ts = &btheme->tuserpref;
+					break;
+				case SPACE_CONSOLE:
+					ts = &btheme->tconsole;
+					break;
+				case SPACE_TIME:
+					ts = &btheme->ttime;
+					break;
+				case SPACE_NODE:
+					ts = &btheme->tnode;
+					break;
+				case SPACE_LOGIC:
+					ts = &btheme->tlogic;
+					break;
+				case SPACE_CLIP:
+					ts = &btheme->tclip;
+					break;
+				default:
+					ts = &btheme->tv3d;
+					break;
 			}
-			
-			switch(colorid) {
-			case TH_BACK:
-				if(theme_regionid==RGN_TYPE_WINDOW)
-					cp= ts->back;
-				else if(theme_regionid==RGN_TYPE_CHANNELS)
-					cp= ts->list;
-				else if(theme_regionid==RGN_TYPE_HEADER)
-					cp= ts->header;
-				else
-					cp= ts->button; 
-				break;
-			case TH_TEXT:
-				if(theme_regionid==RGN_TYPE_WINDOW)
-					cp= ts->text; 
-				else if(theme_regionid==RGN_TYPE_CHANNELS)
-					cp= ts->list_text;
-				else if(theme_regionid==RGN_TYPE_HEADER)
-					cp= ts->header_text;
-				else
-					cp= ts->button_text; 
-				break;
-			case TH_TEXT_HI:
-				if(theme_regionid==RGN_TYPE_WINDOW)
-					cp= ts->text_hi;
-				else if(theme_regionid==RGN_TYPE_CHANNELS)
-					cp= ts->list_text_hi;
-				else if(theme_regionid==RGN_TYPE_HEADER)
-					cp= ts->header_text_hi;
-				else
-					cp= ts->button_text_hi; 
-				break;
-			case TH_TITLE:
-				if(theme_regionid==RGN_TYPE_WINDOW)
-					cp= ts->title;
-				else if(theme_regionid==RGN_TYPE_CHANNELS)
-					cp= ts->list_title;
-				else if(theme_regionid==RGN_TYPE_HEADER)
-					cp= ts->header_title;
-				else
-					cp= ts->button_title; 
-				break;
-				
-			case TH_HEADER:
-				cp= ts->header; break;
-			case TH_HEADERDESEL:
-				/* we calculate a dynamic builtin header deselect color, also for pulldowns... */
-				cp= ts->header; 
-				headerdesel[0]= cp[0]>10?cp[0]-10:0;
-				headerdesel[1]= cp[1]>10?cp[1]-10:0;
-				headerdesel[2]= cp[2]>10?cp[2]-10:0;
-				cp= headerdesel;
-				break;
-			case TH_HEADER_TEXT:
-				cp= ts->header_text; break;
-			case TH_HEADER_TEXT_HI:
-				cp= ts->header_text_hi; break;
-				
-			case TH_PANEL:
-				cp= ts->panel; break;
-			case TH_PANEL_TEXT:
-				cp= ts->panel_text; break;
-			case TH_PANEL_TEXT_HI:
-				cp= ts->panel_text_hi; break;
-				
-			case TH_BUTBACK:
-				cp= ts->button; break;
-			case TH_BUTBACK_TEXT:
-				cp= ts->button_text; break;
-			case TH_BUTBACK_TEXT_HI:
-				cp= ts->button_text_hi; break;
-				
-			case TH_SHADE1:
-				cp= ts->shade1; break;
-			case TH_SHADE2:
-				cp= ts->shade2; break;
-			case TH_HILITE:
-				cp= ts->hilite; break;
-				
-			case TH_GRID:
-				cp= ts->grid; break;
-			case TH_WIRE:
-				cp= ts->wire; break;
-			case TH_LAMP:
-				cp= ts->lamp; break;
-			case TH_SPEAKER:
-				cp= ts->speaker; break;
-			case TH_SELECT:
-				cp= ts->select; break;
-			case TH_ACTIVE:
-				cp= ts->active; break;
-			case TH_GROUP:
-				cp= ts->group; break;
-			case TH_GROUP_ACTIVE:
-				cp= ts->group_active; break;
-			case TH_TRANSFORM:
-				cp= ts->transform; break;
-			case TH_VERTEX:
-				cp= ts->vertex; break;
-			case TH_VERTEX_SELECT:
-				cp= ts->vertex_select; break;
-			case TH_VERTEX_SIZE:
-				cp= &ts->vertex_size; break;
-			case TH_OUTLINE_WIDTH:
-				cp= &ts->outline_width; break;
-			case TH_EDGE:
-				cp= ts->edge; break;
-			case TH_EDGE_SELECT:
-				cp= ts->edge_select; break;
-			case TH_EDGE_SEAM:
-				cp= ts->edge_seam; break;
-			case TH_EDGE_SHARP:
-				cp= ts->edge_sharp; break;
-			case TH_EDGE_CREASE:
-				cp= ts->edge_crease; break;
-			case TH_EDITMESH_ACTIVE:
-				cp= ts->editmesh_active; break;
-			case TH_EDGE_FACESEL:
-				cp= ts->edge_facesel; break;
-			case TH_FACE:
-				cp= ts->face; break;
-			case TH_FACE_SELECT:
-				cp= ts->face_select; break;
-			case TH_FACE_DOT:
-				cp= ts->face_dot; break;
-			case TH_FACEDOT_SIZE:
-				cp= &ts->facedot_size; break;
-			case TH_DRAWEXTRA_EDGELEN:
-				cp= ts->extra_edge_len; break;
-			case TH_DRAWEXTRA_FACEAREA:
-				cp= ts->extra_face_area; break;
-			case TH_DRAWEXTRA_FACEANG:
-				cp= ts->extra_face_angle; break;
-			case TH_NORMAL:
-				cp= ts->normal; break;
-			case TH_VNORMAL:
-				cp= ts->vertex_normal; break;
-			case TH_BONE_SOLID:
-				cp= ts->bone_solid; break;
-			case TH_BONE_POSE:
-				cp= ts->bone_pose; break;
-			case TH_STRIP:
-				cp= ts->strip; break;
-			case TH_STRIP_SELECT:
-				cp= ts->strip_select; break;
-			case TH_CFRAME:
-				cp= ts->cframe; break;
-			case TH_NURB_ULINE:
-				cp= ts->nurb_uline; break;
-			case TH_NURB_VLINE:
-				cp= ts->nurb_vline; break;
-			case TH_NURB_SEL_ULINE:
-				cp= ts->nurb_sel_uline; break;
-			case TH_NURB_SEL_VLINE:
-				cp= ts->nurb_sel_vline; break;
-			case TH_ACTIVE_SPLINE:
-				cp= ts->act_spline; break;
-			case TH_LASTSEL_POINT:
-				cp= ts->lastsel_point; break;
-			case TH_HANDLE_FREE:
-				cp= ts->handle_free; break;
-			case TH_HANDLE_AUTO:
-				cp= ts->handle_auto; break;
-			case TH_HANDLE_AUTOCLAMP:
-				cp= ts->handle_auto_clamped; break;
-			case TH_HANDLE_VECT:
-				cp= ts->handle_vect; break;
-			case TH_HANDLE_ALIGN:
-				cp= ts->handle_align; break;
-			case TH_HANDLE_SEL_FREE:
-				cp= ts->handle_sel_free; break;
-			case TH_HANDLE_SEL_AUTO:
-				cp= ts->handle_sel_auto; break;
-			case TH_HANDLE_SEL_AUTOCLAMP:
-				cp= ts->handle_sel_auto_clamped; break;
-			case TH_HANDLE_SEL_VECT:
-				cp= ts->handle_sel_vect; break;
-			case TH_HANDLE_SEL_ALIGN:
-				cp= ts->handle_sel_align; break;
-		
-			case TH_SYNTAX_B:
-				cp= ts->syntaxb; break;
-			case TH_SYNTAX_V:
-				cp= ts->syntaxv; break;
-			case TH_SYNTAX_C:
-				cp= ts->syntaxc; break;
-			case TH_SYNTAX_L:
-				cp= ts->syntaxl; break;
-			case TH_SYNTAX_N:
-				cp= ts->syntaxn; break;
-
-			case TH_NODE:
-				cp= ts->syntaxl; break;
-			case TH_NODE_IN_OUT:
-				cp= ts->syntaxn; break;
-			case TH_NODE_OPERATOR:
-				cp= ts->syntaxb; break;
-			case TH_NODE_CONVERTOR:
-				cp= ts->syntaxv; break;
-			case TH_NODE_GROUP:
-				cp= ts->syntaxc; break;
-			case TH_NODE_CURVING:
-				cp= &ts->noodle_curving; break;
-
-			case TH_SEQ_MOVIE:
-				cp= ts->movie; break;
-			case TH_SEQ_IMAGE:
-				cp= ts->image; break;
-			case TH_SEQ_SCENE:
-				cp= ts->scene; break;
-			case TH_SEQ_AUDIO:
-				cp= ts->audio; break;
-			case TH_SEQ_EFFECT:
-				cp= ts->effect; break;
-			case TH_SEQ_PLUGIN:
-				cp= ts->plugin; break;
-			case TH_SEQ_TRANSITION:
-				cp= ts->transition; break;
-			case TH_SEQ_META:
-				cp= ts->meta; break;
-				
-			case TH_CONSOLE_OUTPUT:
-				cp= ts->console_output; break;
-			case TH_CONSOLE_INPUT:
-				cp= ts-> console_input; break;
-			case TH_CONSOLE_INFO:
-				cp= ts->console_info; break;
-			case TH_CONSOLE_ERROR:
-				cp= ts->console_error; break;
-			case TH_CONSOLE_CURSOR:
-				cp= ts->console_cursor; break;
-
-			case TH_HANDLE_VERTEX:
-				cp= ts->handle_vertex;
-				break;
-			case TH_HANDLE_VERTEX_SELECT:
-				cp= ts->handle_vertex_select;
-				break;
-			case TH_HANDLE_VERTEX_SIZE:
-				cp= &ts->handle_vertex_size;
-				break;
-				
-			case TH_DOPESHEET_CHANNELOB:
-				cp= ts->ds_channel;
-				break;
-			case TH_DOPESHEET_CHANNELSUBOB:
-				cp= ts->ds_subchannel;
-				break;	
-					
-			case TH_PREVIEW_BACK:
-				cp= ts->preview_back;
-				break;	
-
-			case TH_STITCH_PREVIEW_FACE:
-				cp = ts->preview_stitch_face;
-				break;
-
-			case TH_STITCH_PREVIEW_EDGE:
-				cp = ts->preview_stitch_edge;
-				break;
-
-			case TH_STITCH_PREVIEW_VERT:
-				cp = ts->preview_stitch_vert;
-				break;
-
-			case TH_STITCH_PREVIEW_STITCHABLE:
-				cp = ts->preview_stitch_stitchable;
-				break;
-
-			case TH_STITCH_PREVIEW_UNSTITCHABLE:
-				cp = ts->preview_stitch_unstitchable;
-				break;
-			case TH_STITCH_PREVIEW_ACTIVE:
-				cp = ts->preview_stitch_active;
-				break;
-			case TH_MARKER_OUTLINE:
-				cp= ts->marker_outline; break;
-			case TH_MARKER:
-				cp= ts->marker; break;
-			case TH_ACT_MARKER:
-				cp= ts->act_marker; break;
-			case TH_SEL_MARKER:
-				cp= ts->sel_marker; break;
-			case TH_BUNDLE_SOLID:
-				cp= ts->bundle_solid; break;
-			case TH_DIS_MARKER:
-				cp= ts->dis_marker; break;
-			case TH_PATH_BEFORE:
-				cp= ts->path_before; break;
-			case TH_PATH_AFTER:
-				cp= ts->path_after; break;
-			case TH_CAMERA_PATH:
-				cp= ts->camera_path; break;
-			case TH_LOCK_MARKER:
-				cp= ts->lock_marker; break;
-			
-			case TH_MATCH:
-				cp= ts->match;
-				break;
-				
-			case TH_SELECT_HIGHLIGHT:
-				cp= ts->selected_highlight;
-				break;
+
+			switch (colorid) {
+				case TH_BACK:
+					if (theme_regionid == RGN_TYPE_WINDOW)
+						cp = ts->back;
+					else if (theme_regionid == RGN_TYPE_CHANNELS)
+						cp = ts->list;
+					else if (theme_regionid == RGN_TYPE_HEADER)
+						cp = ts->header;
+					else
+						cp = ts->button;
+					break;
+				case TH_TEXT:
+					if (theme_regionid == RGN_TYPE_WINDOW)
+						cp = ts->text;
+					else if (theme_regionid == RGN_TYPE_CHANNELS)
+						cp = ts->list_text;
+					else if (theme_regionid == RGN_TYPE_HEADER)
+						cp = ts->header_text;
+					else
+						cp = ts->button_text;
+					break;
+				case TH_TEXT_HI:
+					if (theme_regionid == RGN_TYPE_WINDOW)
+						cp = ts->text_hi;
+					else if (theme_regionid == RGN_TYPE_CHANNELS)
+						cp = ts->list_text_hi;
+					else if (theme_regionid == RGN_TYPE_HEADER)
+						cp = ts->header_text_hi;
+					else
+						cp = ts->button_text_hi;
+					break;
+				case TH_TITLE:
+					if (theme_regionid == RGN_TYPE_WINDOW)
+						cp = ts->title;
+					else if (theme_regionid == RGN_TYPE_CHANNELS)
+						cp = ts->list_title;
+					else if (theme_regionid == RGN_TYPE_HEADER)
+						cp = ts->header_title;
+					else
+						cp = ts->button_title;
+					break;
+
+				case TH_HEADER:
+					cp = ts->header; break;
+				case TH_HEADERDESEL:
+					/* we calculate a dynamic builtin header deselect color, also for pulldowns... */
+					cp = ts->header;
+					headerdesel[0] = cp[0] > 10 ? cp[0] - 10 : 0;
+					headerdesel[1] = cp[1] > 10 ? cp[1] - 10 : 0;
+					headerdesel[2] = cp[2] > 10 ? cp[2] - 10 : 0;
+					cp = headerdesel;
+					break;
+				case TH_HEADER_TEXT:
+					cp = ts->header_text; break;
+				case TH_HEADER_TEXT_HI:
+					cp = ts->header_text_hi; break;
+
+				case TH_PANEL:
+					cp = ts->panel; break;
+				case TH_PANEL_TEXT:
+					cp = ts->panel_text; break;
+				case TH_PANEL_TEXT_HI:
+					cp = ts->panel_text_hi; break;
+
+				case TH_BUTBACK:
+					cp = ts->button; break;
+				case TH_BUTBACK_TEXT:
+					cp = ts->button_text; break;
+				case TH_BUTBACK_TEXT_HI:
+					cp = ts->button_text_hi; break;
+
+				case TH_SHADE1:
+					cp = ts->shade1; break;
+				case TH_SHADE2:
+					cp = ts->shade2; break;
+				case TH_HILITE:
+					cp = ts->hilite; break;
+
+				case TH_GRID:
+					cp = ts->grid; break;
+				case TH_WIRE:
+					cp = ts->wire; break;
+				case TH_LAMP:
+					cp = ts->lamp; break;
+				case TH_SPEAKER:
+					cp = ts->speaker; break;
+				case TH_CAMERA:
+					cp = ts->camera; break;
+				case TH_EMPTY:
+					cp = ts->empty; break;
+				case TH_SELECT:
+					cp = ts->select; break;
+				case TH_ACTIVE:
+					cp = ts->active; break;
+				case TH_GROUP:
+					cp = ts->group; break;
+				case TH_GROUP_ACTIVE:
+					cp = ts->group_active; break;
+				case TH_TRANSFORM:
+					cp = ts->transform; break;
+				case TH_VERTEX:
+					cp = ts->vertex; break;
+				case TH_VERTEX_SELECT:
+					cp = ts->vertex_select; break;
+				case TH_VERTEX_SIZE:
+					cp = &ts->vertex_size; break;
+				case TH_OUTLINE_WIDTH:
+					cp = &ts->outline_width; break;
+				case TH_EDGE:
+					cp = ts->edge; break;
+				case TH_EDGE_SELECT:
+					cp = ts->edge_select; break;
+				case TH_EDGE_SEAM:
+					cp = ts->edge_seam; break;
+				case TH_EDGE_SHARP:
+					cp = ts->edge_sharp; break;
+				case TH_EDGE_CREASE:
+					cp = ts->edge_crease; break;
+				case TH_EDITMESH_ACTIVE:
+					cp = ts->editmesh_active; break;
+				case TH_EDGE_FACESEL:
+					cp = ts->edge_facesel; break;
+				case TH_FACE:
+					cp = ts->face; break;
+				case TH_FACE_SELECT:
+					cp = ts->face_select; break;
+				case TH_FACE_DOT:
+					cp = ts->face_dot; break;
+				case TH_FACEDOT_SIZE:
+					cp = &ts->facedot_size; break;
+				case TH_DRAWEXTRA_EDGELEN:
+					cp = ts->extra_edge_len; break;
+				case TH_DRAWEXTRA_FACEAREA:
+					cp = ts->extra_face_area; break;
+				case TH_DRAWEXTRA_FACEANG:
+					cp = ts->extra_face_angle; break;
+				case TH_NORMAL:
+					cp = ts->normal; break;
+				case TH_VNORMAL:
+					cp = ts->vertex_normal; break;
+				case TH_BONE_SOLID:
+					cp = ts->bone_solid; break;
+				case TH_BONE_POSE:
+					cp = ts->bone_pose; break;
+				case TH_STRIP:
+					cp = ts->strip; break;
+				case TH_STRIP_SELECT:
+					cp = ts->strip_select; break;
+				case TH_CFRAME:
+					cp = ts->cframe; break;
+				case TH_NURB_ULINE:
+					cp = ts->nurb_uline; break;
+				case TH_NURB_VLINE:
+					cp = ts->nurb_vline; break;
+				case TH_NURB_SEL_ULINE:
+					cp = ts->nurb_sel_uline; break;
+				case TH_NURB_SEL_VLINE:
+					cp = ts->nurb_sel_vline; break;
+				case TH_ACTIVE_SPLINE:
+					cp = ts->act_spline; break;
+				case TH_LASTSEL_POINT:
+					cp = ts->lastsel_point; break;
+				case TH_HANDLE_FREE:
+					cp = ts->handle_free; break;
+				case TH_HANDLE_AUTO:
+					cp = ts->handle_auto; break;
+				case TH_HANDLE_AUTOCLAMP:
+					cp = ts->handle_auto_clamped; break;
+				case TH_HANDLE_VECT:
+					cp = ts->handle_vect; break;
+				case TH_HANDLE_ALIGN:
+					cp = ts->handle_align; break;
+				case TH_HANDLE_SEL_FREE:
+					cp = ts->handle_sel_free; break;
+				case TH_HANDLE_SEL_AUTO:
+					cp = ts->handle_sel_auto; break;
+				case TH_HANDLE_SEL_AUTOCLAMP:
+					cp = ts->handle_sel_auto_clamped; break;
+				case TH_HANDLE_SEL_VECT:
+					cp = ts->handle_sel_vect; break;
+				case TH_HANDLE_SEL_ALIGN:
+					cp = ts->handle_sel_align; break;
+
+				case TH_SYNTAX_B:
+					cp = ts->syntaxb; break;
+				case TH_SYNTAX_V:
+					cp = ts->syntaxv; break;
+				case TH_SYNTAX_C:
+					cp = ts->syntaxc; break;
+				case TH_SYNTAX_L:
+					cp = ts->syntaxl; break;
+				case TH_SYNTAX_N:
+					cp = ts->syntaxn; break;
+
+				case TH_NODE:
+					cp = ts->syntaxl; break;
+				case TH_NODE_IN_OUT:
+					cp = ts->syntaxn; break;
+				case TH_NODE_OPERATOR:
+					cp = ts->syntaxb; break;
+				case TH_NODE_CONVERTOR:
+					cp = ts->syntaxv; break;
+				case TH_NODE_GROUP:
+					cp = ts->syntaxc; break;
+				case TH_NODE_CURVING:
+					cp = &ts->noodle_curving; break;
+
+				case TH_SEQ_MOVIE:
+					cp = ts->movie; break;
+				case TH_SEQ_MOVIECLIP:
+					cp = ts->movieclip; break;
+				case TH_SEQ_IMAGE:
+					cp = ts->image; break;
+				case TH_SEQ_SCENE:
+					cp = ts->scene; break;
+				case TH_SEQ_AUDIO:
+					cp = ts->audio; break;
+				case TH_SEQ_EFFECT:
+					cp = ts->effect; break;
+				case TH_SEQ_PLUGIN:
+					cp = ts->plugin; break;
+				case TH_SEQ_TRANSITION:
+					cp = ts->transition; break;
+				case TH_SEQ_META:
+					cp = ts->meta; break;
+				case TH_SEQ_PREVIEW:
+					cp = ts->preview_back; break;
+
+				case TH_CONSOLE_OUTPUT:
+					cp = ts->console_output; break;
+				case TH_CONSOLE_INPUT:
+					cp = ts->console_input; break;
+				case TH_CONSOLE_INFO:
+					cp = ts->console_info; break;
+				case TH_CONSOLE_ERROR:
+					cp = ts->console_error; break;
+				case TH_CONSOLE_CURSOR:
+					cp = ts->console_cursor; break;
+
+				case TH_HANDLE_VERTEX:
+					cp = ts->handle_vertex;
+					break;
+				case TH_HANDLE_VERTEX_SELECT:
+					cp = ts->handle_vertex_select;
+					break;
+				case TH_HANDLE_VERTEX_SIZE:
+					cp = &ts->handle_vertex_size;
+					break;
+
+				case TH_DOPESHEET_CHANNELOB:
+					cp = ts->ds_channel;
+					break;
+				case TH_DOPESHEET_CHANNELSUBOB:
+					cp = ts->ds_subchannel;
+					break;
+
+				case TH_PREVIEW_BACK:
+					cp = ts->preview_back;
+					break;
+
+				case TH_STITCH_PREVIEW_FACE:
+					cp = ts->preview_stitch_face;
+					break;
+
+				case TH_STITCH_PREVIEW_EDGE:
+					cp = ts->preview_stitch_edge;
+					break;
+
+				case TH_STITCH_PREVIEW_VERT:
+					cp = ts->preview_stitch_vert;
+					break;
+
+				case TH_STITCH_PREVIEW_STITCHABLE:
+					cp = ts->preview_stitch_stitchable;
+					break;
+
+				case TH_STITCH_PREVIEW_UNSTITCHABLE:
+					cp = ts->preview_stitch_unstitchable;
+					break;
+				case TH_STITCH_PREVIEW_ACTIVE:
+					cp = ts->preview_stitch_active;
+					break;
+				case TH_MARKER_OUTLINE:
+					cp = ts->marker_outline; break;
+				case TH_MARKER:
+					cp = ts->marker; break;
+				case TH_ACT_MARKER:
+					cp = ts->act_marker; break;
+				case TH_SEL_MARKER:
+					cp = ts->sel_marker; break;
+				case TH_BUNDLE_SOLID:
+					cp = ts->bundle_solid; break;
+				case TH_DIS_MARKER:
+					cp = ts->dis_marker; break;
+				case TH_PATH_BEFORE:
+					cp = ts->path_before; break;
+				case TH_PATH_AFTER:
+					cp = ts->path_after; break;
+				case TH_CAMERA_PATH:
+					cp = ts->camera_path; break;
+				case TH_LOCK_MARKER:
+					cp = ts->lock_marker; break;
+
+				case TH_MATCH:
+					cp = ts->match;
+					break;
+
+				case TH_SELECT_HIGHLIGHT:
+					cp = ts->selected_highlight;
+					break;
 			}
 		}
 	}
@@ -467,77 +476,72 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
 	return (unsigned char *)cp;
 }
 
-
-#define SETCOL(col, r, g, b, a)  col[0]=r; col[1]=g; col[2]= b; col[3]= a;
-#define SETCOLF(col, r, g, b, a)  col[0]=r*255; col[1]=g*255; col[2]= b*255; col[3]= a*255;
-#define SETCOLTEST(col, r, g, b, a)  if(col[3]==0) {col[0]=r; col[1]=g; col[2]= b; col[3]= a;}
-
 /* use this call to init new bone color sets in Theme */
 static void ui_theme_init_boneColorSets(bTheme *btheme)
 {
 	int i;
 	
 	/* define default color sets - currently we only define 15 of these, though that should be ample */
-		/* set 1 */
-	SETCOL(btheme->tarm[0].solid, 0x9a, 0x00, 0x00, 255);
-	SETCOL(btheme->tarm[0].select, 0xbd, 0x11, 0x11, 255);
-	SETCOL(btheme->tarm[0].active, 0xf7, 0x0a, 0x0a, 255);
-		/* set 2 */
-	SETCOL(btheme->tarm[1].solid, 0xf7, 0x40, 0x18, 255);
-	SETCOL(btheme->tarm[1].select, 0xf6, 0x69, 0x13, 255);
-	SETCOL(btheme->tarm[1].active, 0xfa, 0x99, 0x00, 255);
-		/* set 3 */
-	SETCOL(btheme->tarm[2].solid, 0x1e, 0x91, 0x09, 255);
-	SETCOL(btheme->tarm[2].select, 0x59, 0xb7, 0x0b, 255);
-	SETCOL(btheme->tarm[2].active, 0x83, 0xef, 0x1d, 255);
-		/* set 4 */
-	SETCOL(btheme->tarm[3].solid, 0x0a, 0x36, 0x94, 255);
-	SETCOL(btheme->tarm[3].select, 0x36, 0x67, 0xdf, 255);
-	SETCOL(btheme->tarm[3].active, 0x5e, 0xc1, 0xef, 255);
-		/* set 5 */
-	SETCOL(btheme->tarm[4].solid, 0xa9, 0x29, 0x4e, 255);
-	SETCOL(btheme->tarm[4].select, 0xc1, 0x41, 0x6a, 255);
-	SETCOL(btheme->tarm[4].active, 0xf0, 0x5d, 0x91, 255);
-		/* set 6 */
-	SETCOL(btheme->tarm[5].solid, 0x43, 0x0c, 0x78, 255);
-	SETCOL(btheme->tarm[5].select, 0x54, 0x3a, 0xa3, 255);
-	SETCOL(btheme->tarm[5].active, 0x87, 0x64, 0xd5, 255);
-		/* set 7 */
-	SETCOL(btheme->tarm[6].solid, 0x24, 0x78, 0x5a, 255);
-	SETCOL(btheme->tarm[6].select, 0x3c, 0x95, 0x79, 255);
-	SETCOL(btheme->tarm[6].active, 0x6f, 0xb6, 0xab, 255);
-		/* set 8 */
-	SETCOL(btheme->tarm[7].solid, 0x4b, 0x70, 0x7c, 255);
-	SETCOL(btheme->tarm[7].select, 0x6a, 0x86, 0x91, 255);
-	SETCOL(btheme->tarm[7].active, 0x9b, 0xc2, 0xcd, 255);
-		/* set 9 */
-	SETCOL(btheme->tarm[8].solid, 0xf4, 0xc9, 0x0c, 255);
-	SETCOL(btheme->tarm[8].select, 0xee, 0xc2, 0x36, 255);
-	SETCOL(btheme->tarm[8].active, 0xf3, 0xff, 0x00, 255);
-		/* set 10 */
-	SETCOL(btheme->tarm[9].solid, 0x1e, 0x20, 0x24, 255);
-	SETCOL(btheme->tarm[9].select, 0x48, 0x4c, 0x56, 255);
-	SETCOL(btheme->tarm[9].active, 0xff, 0xff, 0xff, 255);
-		/* set 11 */
-	SETCOL(btheme->tarm[10].solid, 0x6f, 0x2f, 0x6a, 255);
-	SETCOL(btheme->tarm[10].select, 0x98, 0x45, 0xbe, 255);
-	SETCOL(btheme->tarm[10].active, 0xd3, 0x30, 0xd6, 255);
-		/* set 12 */
-	SETCOL(btheme->tarm[11].solid, 0x6c, 0x8e, 0x22, 255);
-	SETCOL(btheme->tarm[11].select, 0x7f, 0xb0, 0x22, 255);
-	SETCOL(btheme->tarm[11].active, 0xbb, 0xef, 0x5b, 255);
-		/* set 13 */
-	SETCOL(btheme->tarm[12].solid, 0x8d, 0x8d, 0x8d, 255);
-	SETCOL(btheme->tarm[12].select, 0xb0, 0xb0, 0xb0, 255);
-	SETCOL(btheme->tarm[12].active, 0xde, 0xde, 0xde, 255);
-		/* set 14 */
-	SETCOL(btheme->tarm[13].solid, 0x83, 0x43, 0x26, 255);
-	SETCOL(btheme->tarm[13].select, 0x8b, 0x58, 0x11, 255);
-	SETCOL(btheme->tarm[13].active, 0xbd, 0x6a, 0x11, 255);
-		/* set 15 */
-	SETCOL(btheme->tarm[14].solid, 0x08, 0x31, 0x0e, 255);
-	SETCOL(btheme->tarm[14].select, 0x1c, 0x43, 0x0b, 255);
-	SETCOL(btheme->tarm[14].active, 0x34, 0x62, 0x2b, 255);
+	/* set 1 */
+	rgba_char_args_set(btheme->tarm[0].solid, 0x9a, 0x00, 0x00, 255);
+	rgba_char_args_set(btheme->tarm[0].select, 0xbd, 0x11, 0x11, 255);
+	rgba_char_args_set(btheme->tarm[0].active, 0xf7, 0x0a, 0x0a, 255);
+	/* set 2 */
+	rgba_char_args_set(btheme->tarm[1].solid, 0xf7, 0x40, 0x18, 255);
+	rgba_char_args_set(btheme->tarm[1].select, 0xf6, 0x69, 0x13, 255);
+	rgba_char_args_set(btheme->tarm[1].active, 0xfa, 0x99, 0x00, 255);
+	/* set 3 */
+	rgba_char_args_set(btheme->tarm[2].solid, 0x1e, 0x91, 0x09, 255);
+	rgba_char_args_set(btheme->tarm[2].select, 0x59, 0xb7, 0x0b, 255);
+	rgba_char_args_set(btheme->tarm[2].active, 0x83, 0xef, 0x1d, 255);
+	/* set 4 */
+	rgba_char_args_set(btheme->tarm[3].solid, 0x0a, 0x36, 0x94, 255);
+	rgba_char_args_set(btheme->tarm[3].select, 0x36, 0x67, 0xdf, 255);
+	rgba_char_args_set(btheme->tarm[3].active, 0x5e, 0xc1, 0xef, 255);
+	/* set 5 */
+	rgba_char_args_set(btheme->tarm[4].solid, 0xa9, 0x29, 0x4e, 255);
+	rgba_char_args_set(btheme->tarm[4].select, 0xc1, 0x41, 0x6a, 255);
+	rgba_char_args_set(btheme->tarm[4].active, 0xf0, 0x5d, 0x91, 255);
+	/* set 6 */
+	rgba_char_args_set(btheme->tarm[5].solid, 0x43, 0x0c, 0x78, 255);
+	rgba_char_args_set(btheme->tarm[5].select, 0x54, 0x3a, 0xa3, 255);
+	rgba_char_args_set(btheme->tarm[5].active, 0x87, 0x64, 0xd5, 255);
+	/* set 7 */
+	rgba_char_args_set(btheme->tarm[6].solid, 0x24, 0x78, 0x5a, 255);
+	rgba_char_args_set(btheme->tarm[6].select, 0x3c, 0x95, 0x79, 255);
+	rgba_char_args_set(btheme->tarm[6].active, 0x6f, 0xb6, 0xab, 255);
+	/* set 8 */
+	rgba_char_args_set(btheme->tarm[7].solid, 0x4b, 0x70, 0x7c, 255);
+	rgba_char_args_set(btheme->tarm[7].select, 0x6a, 0x86, 0x91, 255);
+	rgba_char_args_set(btheme->tarm[7].active, 0x9b, 0xc2, 0xcd, 255);
+	/* set 9 */
+	rgba_char_args_set(btheme->tarm[8].solid, 0xf4, 0xc9, 0x0c, 255);
+	rgba_char_args_set(btheme->tarm[8].select, 0xee, 0xc2, 0x36, 255);
+	rgba_char_args_set(btheme->tarm[8].active, 0xf3, 0xff, 0x00, 255);
+	/* set 10 */
+	rgba_char_args_set(btheme->tarm[9].solid, 0x1e, 0x20, 0x24, 255);
+	rgba_char_args_set(btheme->tarm[9].select, 0x48, 0x4c, 0x56, 255);
+	rgba_char_args_set(btheme->tarm[9].active, 0xff, 0xff, 0xff, 255);
+	/* set 11 */
+	rgba_char_args_set(btheme->tarm[10].solid, 0x6f, 0x2f, 0x6a, 255);
+	rgba_char_args_set(btheme->tarm[10].select, 0x98, 0x45, 0xbe, 255);
+	rgba_char_args_set(btheme->tarm[10].active, 0xd3, 0x30, 0xd6, 255);
+	/* set 12 */
+	rgba_char_args_set(btheme->tarm[11].solid, 0x6c, 0x8e, 0x22, 255);
+	rgba_char_args_set(btheme->tarm[11].select, 0x7f, 0xb0, 0x22, 255);
+	rgba_char_args_set(btheme->tarm[11].active, 0xbb, 0xef, 0x5b, 255);
+	/* set 13 */
+	rgba_char_args_set(btheme->tarm[12].solid, 0x8d, 0x8d, 0x8d, 255);
+	rgba_char_args_set(btheme->tarm[12].select, 0xb0, 0xb0, 0xb0, 255);
+	rgba_char_args_set(btheme->tarm[12].active, 0xde, 0xde, 0xde, 255);
+	/* set 14 */
+	rgba_char_args_set(btheme->tarm[13].solid, 0x83, 0x43, 0x26, 255);
+	rgba_char_args_set(btheme->tarm[13].select, 0x8b, 0x58, 0x11, 255);
+	rgba_char_args_set(btheme->tarm[13].active, 0xbd, 0x6a, 0x11, 255);
+	/* set 15 */
+	rgba_char_args_set(btheme->tarm[14].solid, 0x08, 0x31, 0x0e, 255);
+	rgba_char_args_set(btheme->tarm[14].select, 0x1c, 0x43, 0x0b, 255);
+	rgba_char_args_set(btheme->tarm[14].active, 0x34, 0x62, 0x2b, 255);
 	
 	/* reset flags too */
 	for (i = 0; i < 20; i++)
@@ -547,23 +551,23 @@ static void ui_theme_init_boneColorSets(bTheme *btheme)
 /* use this call to init new variables in themespace, if they're same for all */
 static void ui_theme_init_new_do(ThemeSpace *ts)
 {
-	SETCOLTEST(ts->header_text,		0, 0, 0, 255);
-	SETCOLTEST(ts->header_title,	0, 0, 0, 255);
-	SETCOLTEST(ts->header_text_hi,	255, 255, 255, 255);
-	
-	SETCOLTEST(ts->panel_text,		0, 0, 0, 255);
-	SETCOLTEST(ts->panel_title,		0, 0, 0, 255);
-	SETCOLTEST(ts->panel_text_hi,	255, 255, 255, 255);
-	
-	SETCOLTEST(ts->button,			145, 145, 145, 245);
-	SETCOLTEST(ts->button_title,	0, 0, 0, 255);
-	SETCOLTEST(ts->button_text,		0, 0, 0, 255);
-	SETCOLTEST(ts->button_text_hi,	255, 255, 255, 255);
-	
-	SETCOLTEST(ts->list,			165, 165, 165, 255);
-	SETCOLTEST(ts->list_title,		0, 0, 0, 255);
-	SETCOLTEST(ts->list_text,		0, 0, 0, 255);
-	SETCOLTEST(ts->list_text_hi,	255, 255, 255, 255);
+	rgba_char_args_test_set(ts->header_text,        0, 0, 0, 255);
+	rgba_char_args_test_set(ts->header_title,   0, 0, 0, 255);
+	rgba_char_args_test_set(ts->header_text_hi, 255, 255, 255, 255);
+
+	rgba_char_args_test_set(ts->panel_text,     0, 0, 0, 255);
+	rgba_char_args_test_set(ts->panel_title,        0, 0, 0, 255);
+	rgba_char_args_test_set(ts->panel_text_hi,  255, 255, 255, 255);
+
+	rgba_char_args_test_set(ts->button,         145, 145, 145, 245);
+	rgba_char_args_test_set(ts->button_title,   0, 0, 0, 255);
+	rgba_char_args_test_set(ts->button_text,        0, 0, 0, 255);
+	rgba_char_args_test_set(ts->button_text_hi, 255, 255, 255, 255);
+
+	rgba_char_args_test_set(ts->list,           165, 165, 165, 255);
+	rgba_char_args_test_set(ts->list_title,     0, 0, 0, 255);
+	rgba_char_args_test_set(ts->list_text,      0, 0, 0, 255);
+	rgba_char_args_test_set(ts->list_text_hi,   255, 255, 255, 255);
 }
 
 static void ui_theme_init_new(bTheme *btheme)
@@ -598,23 +602,23 @@ void ui_theme_init_default(void)
 	bTheme *btheme;
 	
 	/* we search for the theme with name Default */
-	for(btheme= U.themes.first; btheme; btheme= btheme->next) {
-		if(strcmp("Default", btheme->name)==0) break;
+	for (btheme = U.themes.first; btheme; btheme = btheme->next) {
+		if (strcmp("Default", btheme->name) == 0) break;
 	}
 	
-	if(btheme==NULL) {
-		btheme= MEM_callocN(sizeof(bTheme), "theme");
+	if (btheme == NULL) {
+		btheme = MEM_callocN(sizeof(bTheme), "theme");
 		BLI_addtail(&U.themes, btheme);
 		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.iconfile[0] = 0;
 	btheme->tui.panel.show_header = FALSE;
-	SETCOL(btheme->tui.panel.header, 0, 0, 0, 25);
+	rgba_char_args_set(btheme->tui.panel.header, 0, 0, 0, 25);
 
 	/* Bone Color Sets */
 	ui_theme_init_boneColorSets(btheme);
@@ -623,256 +627,259 @@ void ui_theme_init_default(void)
 	ui_theme_init_new(btheme);
 	
 	/* space view3d */
-	SETCOLF(btheme->tv3d.back,       0.225, 0.225, 0.225, 1.0);
-	SETCOL(btheme->tv3d.text,       0, 0, 0, 255);
-	SETCOL(btheme->tv3d.text_hi, 255, 255, 255, 255);
+	rgba_char_args_set_fl(btheme->tv3d.back,       0.225, 0.225, 0.225, 1.0);
+	rgba_char_args_set(btheme->tv3d.text,       0, 0, 0, 255);
+	rgba_char_args_set(btheme->tv3d.text_hi, 255, 255, 255, 255);
 	
-	SETCOLF(btheme->tv3d.header,	0.45, 0.45, 0.45, 1.0);
-	SETCOLF(btheme->tv3d.button,	0.45, 0.45, 0.45, 1.0);
-	SETCOL(btheme->tv3d.panel,      165, 165, 165, 127);
+	rgba_char_args_set_fl(btheme->tv3d.header,  0.45, 0.45, 0.45, 1.0);
+	rgba_char_args_set_fl(btheme->tv3d.button,  0.45, 0.45, 0.45, 1.0);
+	rgba_char_args_set(btheme->tv3d.panel,      165, 165, 165, 127);
 	
-	SETCOL(btheme->tv3d.shade1,  160, 160, 160, 100);
-	SETCOL(btheme->tv3d.shade2,  0x7f, 0x70, 0x70, 100);
-
-	SETCOLF(btheme->tv3d.grid,     0.251, 0.251, 0.251, 1.0);
-	SETCOL(btheme->tv3d.wire,       0x0, 0x0, 0x0, 255);
-	SETCOL(btheme->tv3d.lamp,       0, 0, 0, 40);
-	SETCOL(btheme->tv3d.speaker,    0, 0, 0, 255);
-	SETCOL(btheme->tv3d.select, 241, 88, 0, 255);
-	SETCOL(btheme->tv3d.active, 255, 170, 64, 255);
-	SETCOL(btheme->tv3d.group,      8, 48, 8, 255);
-	SETCOL(btheme->tv3d.group_active, 85, 187, 85, 255);
-	SETCOL(btheme->tv3d.transform, 0xff, 0xff, 0xff, 255);
-	SETCOL(btheme->tv3d.vertex, 0, 0, 0, 255);
-	SETCOL(btheme->tv3d.vertex_select, 255, 133, 0, 255);
-	btheme->tv3d.vertex_size= 3;
-	btheme->tv3d.outline_width= 1;
-	SETCOL(btheme->tv3d.edge,       0x0, 0x0, 0x0, 255);
-	SETCOL(btheme->tv3d.edge_select, 255, 160, 0, 255);
-	SETCOL(btheme->tv3d.edge_seam, 219, 37, 18, 255);
-	SETCOL(btheme->tv3d.edge_facesel, 75, 75, 75, 255);
-	SETCOL(btheme->tv3d.face,       0, 0, 0, 18);
-	SETCOL(btheme->tv3d.face_select, 255, 133, 0, 60);
-	SETCOL(btheme->tv3d.normal, 0x22, 0xDD, 0xDD, 255);
-	SETCOL(btheme->tv3d.vertex_normal, 0x23, 0x61, 0xDD, 255);
-	SETCOL(btheme->tv3d.face_dot, 255, 133, 0, 255);
-	SETCOL(btheme->tv3d.editmesh_active, 255, 255, 255, 128);
-	SETCOLF(btheme->tv3d.edge_crease, 0.8, 0, 0.6, 1.0);
-	SETCOL(btheme->tv3d.edge_sharp, 0, 255, 255, 255);
-	SETCOL(btheme->tv3d.header_text, 0, 0, 0, 255);
-	SETCOL(btheme->tv3d.header_text_hi, 255, 255, 255, 255);
-	SETCOL(btheme->tv3d.button_text, 0, 0, 0, 255);
-	SETCOL(btheme->tv3d.button_text_hi, 255, 255, 255, 255);
-	SETCOL(btheme->tv3d.button_title, 0, 0, 0, 255);
-	SETCOL(btheme->tv3d.title, 0, 0, 0, 255);
-
-	btheme->tv3d.facedot_size= 4;
-
-	SETCOL(btheme->tv3d.extra_edge_len, 32, 0, 0, 255);
-	SETCOL(btheme->tv3d.extra_face_area, 0, 32, 0, 255);
-	SETCOL(btheme->tv3d.extra_face_angle, 0, 0, 128, 255);
-
-	SETCOL(btheme->tv3d.cframe, 0x60, 0xc0,	 0x40, 255);
-
-	SETCOL(btheme->tv3d.nurb_uline, 0x90, 0x90, 0x00, 255);
-	SETCOL(btheme->tv3d.nurb_vline, 0x80, 0x30, 0x60, 255);
-	SETCOL(btheme->tv3d.nurb_sel_uline, 0xf0, 0xff, 0x40, 255);
-	SETCOL(btheme->tv3d.nurb_sel_vline, 0xf0, 0x90, 0xa0, 255);
-
-	SETCOL(btheme->tv3d.handle_free, 0, 0, 0, 255);
-	SETCOL(btheme->tv3d.handle_auto, 0x90, 0x90, 0x00, 255);
-	SETCOL(btheme->tv3d.handle_vect, 0x40, 0x90, 0x30, 255);
-	SETCOL(btheme->tv3d.handle_align, 0x80, 0x30, 0x60, 255);
-	SETCOL(btheme->tv3d.handle_sel_free, 0, 0, 0, 255);
-	SETCOL(btheme->tv3d.handle_sel_auto, 0xf0, 0xff, 0x40, 255);
-	SETCOL(btheme->tv3d.handle_sel_vect, 0x40, 0xc0, 0x30, 255);
-	SETCOL(btheme->tv3d.handle_sel_align, 0xf0, 0x90, 0xa0, 255);
-
-	SETCOL(btheme->tv3d.act_spline, 0xdb, 0x25, 0x12, 255);
-	SETCOL(btheme->tv3d.lastsel_point,  0xff, 0xff, 0xff, 255);
-
-	SETCOL(btheme->tv3d.bone_solid, 200, 200, 200, 255);
-	SETCOL(btheme->tv3d.bone_pose, 80, 200, 255, 80);               // alpha 80 is not meant editable, used for wire+action draw
-
-	SETCOL(btheme->tv3d.bundle_solid, 200, 200, 200, 255);
-	SETCOL(btheme->tv3d.camera_path, 0x00, 0x00, 0x00, 255);
+	rgba_char_args_set(btheme->tv3d.shade1,  160, 160, 160, 100);
+	rgba_char_args_set(btheme->tv3d.shade2,  0x7f, 0x70, 0x70, 100);
+
+	rgba_char_args_set_fl(btheme->tv3d.grid,     0.251, 0.251, 0.251, 1.0);
+	rgba_char_args_set(btheme->tv3d.wire,       0x0, 0x0, 0x0, 255);
+	rgba_char_args_set(btheme->tv3d.lamp,       0, 0, 0, 40);
+	rgba_char_args_set(btheme->tv3d.speaker,    0, 0, 0, 255);
+	rgba_char_args_set(btheme->tv3d.camera,    0, 0, 0, 255);
+	rgba_char_args_set(btheme->tv3d.empty,    0, 0, 0, 255);
+	rgba_char_args_set(btheme->tv3d.select, 241, 88, 0, 255);
+	rgba_char_args_set(btheme->tv3d.active, 255, 170, 64, 255);
+	rgba_char_args_set(btheme->tv3d.group,      8, 48, 8, 255);
+	rgba_char_args_set(btheme->tv3d.group_active, 85, 187, 85, 255);
+	rgba_char_args_set(btheme->tv3d.transform, 0xff, 0xff, 0xff, 255);
+	rgba_char_args_set(btheme->tv3d.vertex, 0, 0, 0, 255);
+	rgba_char_args_set(btheme->tv3d.vertex_select, 255, 133, 0, 255);
+	btheme->tv3d.vertex_size = 3;
+	btheme->tv3d.outline_width = 1;
+	rgba_char_args_set(btheme->tv3d.edge,       0x0, 0x0, 0x0, 255);
+	rgba_char_args_set(btheme->tv3d.edge_select, 255, 160, 0, 255);
+	rgba_char_args_set(btheme->tv3d.edge_seam, 219, 37, 18, 255);
+	rgba_char_args_set(btheme->tv3d.edge_facesel, 75, 75, 75, 255);
+	rgba_char_args_set(btheme->tv3d.face,       0, 0, 0, 18);
+	rgba_char_args_set(btheme->tv3d.face_select, 255, 133, 0, 60);
+	rgba_char_args_set(btheme->tv3d.normal, 0x22, 0xDD, 0xDD, 255);
+	rgba_char_args_set(btheme->tv3d.vertex_normal, 0x23, 0x61, 0xDD, 255);
+	rgba_char_args_set(btheme->tv3d.face_dot, 255, 133, 0, 255);
+	rgba_char_args_set(btheme->tv3d.editmesh_active, 255, 255, 255, 128);
+	rgba_char_args_set_fl(btheme->tv3d.edge_crease, 0.8, 0, 0.6, 1.0);
+	rgba_char_args_set(btheme->tv3d.edge_sharp, 0, 255, 255, 255);
+	rgba_char_args_set(btheme->tv3d.header_text, 0, 0, 0, 255);
+	rgba_char_args_set(btheme->tv3d.header_text_hi, 255, 255, 255, 255);
+	rgba_char_args_set(btheme->tv3d.button_text, 0, 0, 0, 255);
+	rgba_char_args_set(btheme->tv3d.button_text_hi, 255, 255, 255, 255);
+	rgba_char_args_set(btheme->tv3d.button_title, 0, 0, 0, 255);
+	rgba_char_args_set(btheme->tv3d.title, 0, 0, 0, 255);
+
+	btheme->tv3d.facedot_size = 4;
+
+	rgba_char_args_set(btheme->tv3d.extra_edge_len, 32, 0, 0, 255);
+	rgba_char_args_set(btheme->tv3d.extra_face_area, 0, 32, 0, 255);
+	rgba_char_args_set(btheme->tv3d.extra_face_angle, 0, 0, 128, 255);
+
+	rgba_char_args_set(btheme->tv3d.cframe, 0x60, 0xc0,  0x40, 255);
+
+	rgba_char_args_set(btheme->tv3d.nurb_uline, 0x90, 0x90, 0x00, 255);
+	rgba_char_args_set(btheme->tv3d.nurb_vline, 0x80, 0x30, 0x60, 255);
+	rgba_char_args_set(btheme->tv3d.nurb_sel_uline, 0xf0, 0xff, 0x40, 255);
+	rgba_char_args_set(btheme->tv3d.nurb_sel_vline, 0xf0, 0x90, 0xa0, 255);
+
+	rgba_char_args_set(btheme->tv3d.handle_free, 0, 0, 0, 255);
+	rgba_char_args_set(btheme->tv3d.handle_auto, 0x90, 0x90, 0x00, 255);
+	rgba_char_args_set(btheme->tv3d.handle_vect, 0x40, 0x90, 0x30, 255);
+	rgba_char_args_set(btheme->tv3d.handle_align, 0x80, 0x30, 0x60, 255);
+	rgba_char_args_set(btheme->tv3d.handle_sel_free, 0, 0, 0, 255);
+	rgba_char_args_set(btheme->tv3d.handle_sel_auto, 0xf0, 0xff, 0x40, 255);
+	rgba_char_args_set(btheme->tv3d.handle_sel_vect, 0x40, 0xc0, 0x30, 255);
+	rgba_char_args_set(btheme->tv3d.handle_sel_align, 0xf0, 0x90, 0xa0, 255);
+
+	rgba_char_args_set(btheme->tv3d.act_spline, 0xdb, 0x25, 0x12, 255);
+	rgba_char_args_set(btheme->tv3d.lastsel_point,  0xff, 0xff, 0xff, 255);
+
+	rgba_char_args_set(btheme->tv3d.bone_solid, 200, 200, 200, 255);
+	rgba_char_args_set(btheme->tv3d.bone_pose, 80, 200, 255, 80);               // alpha 80 is not meant editable, used for wire+action draw
+
+	rgba_char_args_set(btheme->tv3d.bundle_solid, 200, 200, 200, 255);
+	rgba_char_args_set(btheme->tv3d.camera_path, 0x00, 0x00, 0x00, 255);
 	
 	/* space buttons */
 	/* to have something initialized */
-	btheme->tbuts= btheme->tv3d;
+	btheme->tbuts = btheme->tv3d;
 
-	SETCOLF(btheme->tbuts.back, 	0.45, 0.45, 0.45, 1.0);
-	SETCOL(btheme->tbuts.panel, 0x82, 0x82, 0x82, 255);
+	rgba_char_args_set_fl(btheme->tbuts.back,   0.45, 0.45, 0.45, 1.0);
+	rgba_char_args_set(btheme->tbuts.panel, 0x82, 0x82, 0x82, 255);
 
 	/* graph editor */
-	btheme->tipo= btheme->tv3d;
-	SETCOLF(btheme->tipo.back, 	0.42, 0.42, 0.42, 1.0);
-	SETCOLF(btheme->tipo.list, 	0.4, 0.4, 0.4, 1.0);
-	SETCOL(btheme->tipo.grid, 	94, 94, 94, 255);
-	SETCOL(btheme->tipo.panel,  255, 255, 255, 150);
-	SETCOL(btheme->tipo.shade1,		150, 150, 150, 100);	/* scrollbars */
-	SETCOL(btheme->tipo.shade2,		0x70, 0x70, 0x70, 100);
-	SETCOL(btheme->tipo.vertex,		0, 0, 0, 255);
-	SETCOL(btheme->tipo.vertex_select, 255, 133, 0, 255);
-	SETCOL(btheme->tipo.hilite, 0x60, 0xc0, 0x40, 255); 
-	btheme->tipo.vertex_size= 3;
-
-	SETCOL(btheme->tipo.handle_vertex, 		0, 0, 0, 255);
-	SETCOL(btheme->tipo.handle_vertex_select, 255, 133, 0, 255);
-	SETCOL(btheme->tipo.handle_auto_clamped, 0x99, 0x40, 0x30, 255);
-	SETCOL(btheme->tipo.handle_sel_auto_clamped, 0xf0, 0xaf, 0x90, 255);
-	btheme->tipo.handle_vertex_size= 4;
+	btheme->tipo = btheme->tv3d;
+	rgba_char_args_set_fl(btheme->tipo.back,    0.42, 0.42, 0.42, 1.0);
+	rgba_char_args_set_fl(btheme->tipo.list,    0.4, 0.4, 0.4, 1.0);
+	rgba_char_args_set(btheme->tipo.grid,   94, 94, 94, 255);
+	rgba_char_args_set(btheme->tipo.panel,  255, 255, 255, 150);
+	rgba_char_args_set(btheme->tipo.shade1,     150, 150, 150, 100);    /* scrollbars */
+	rgba_char_args_set(btheme->tipo.shade2,     0x70, 0x70, 0x70, 100);
+	rgba_char_args_set(btheme->tipo.vertex,     0, 0, 0, 255);
+	rgba_char_args_set(btheme->tipo.vertex_select, 255, 133, 0, 255);
+	rgba_char_args_set(btheme->tipo.hilite, 0x60, 0xc0, 0x40, 255);
+	btheme->tipo.vertex_size = 3;
+
+	rgba_char_args_set(btheme->tipo.handle_vertex,      0, 0, 0, 255);
+	rgba_char_args_set(btheme->tipo.handle_vertex_select, 255, 133, 0, 255);
+	rgba_char_args_set(btheme->tipo.handle_auto_clamped, 0x99, 0x40, 0x30, 255);
+	rgba_char_args_set(btheme->tipo.handle_sel_auto_clamped, 0xf0, 0xaf, 0x90, 255);
+	btheme->tipo.handle_vertex_size = 4;
 	
-	SETCOL(btheme->tipo.ds_channel, 	82, 96, 110, 255);
-	SETCOL(btheme->tipo.ds_subchannel,	124, 137, 150, 255);
-	SETCOL(btheme->tipo.group, 79, 101, 73, 255);
-	SETCOL(btheme->tipo.group_active, 135, 177, 125, 255);
+	rgba_char_args_set(btheme->tipo.ds_channel,     82, 96, 110, 255);
+	rgba_char_args_set(btheme->tipo.ds_subchannel,  124, 137, 150, 255);
+	rgba_char_args_set(btheme->tipo.group, 79, 101, 73, 255);
+	rgba_char_args_set(btheme->tipo.group_active, 135, 177, 125, 255);
 
 	/* dopesheet */
-	btheme->tact= btheme->tipo;
-	SETCOL(btheme->tact.strip, 			12, 10, 10, 128); 
-	SETCOL(btheme->tact.strip_select, 	255, 140, 0, 255); 
+	btheme->tact = btheme->tipo;
+	rgba_char_args_set(btheme->tact.strip,          12, 10, 10, 128);
+	rgba_char_args_set(btheme->tact.strip_select,   255, 140, 0, 255);
 	
 	/* space nla */
-	btheme->tnla= btheme->tact;
+	btheme->tnla = btheme->tact;
 	
 	/* space file */
 	/* to have something initialized */
-	btheme->tfile= btheme->tv3d;
-	SETCOLF(btheme->tfile.back, 0.3, 0.3, 0.3, 1);
-	SETCOLF(btheme->tfile.panel, 0.3, 0.3, 0.3, 1);
-	SETCOLF(btheme->tfile.list, 0.4, 0.4, 0.4, 1);
-	SETCOL(btheme->tfile.text, 	250, 250, 250, 255);
-	SETCOL(btheme->tfile.text_hi, 15, 15, 15, 255);
-	SETCOL(btheme->tfile.panel, 145, 145, 145, 255);	// bookmark/ui regions
-	SETCOL(btheme->tfile.active, 130, 130, 130, 255); // selected files
-	SETCOL(btheme->tfile.hilite, 255, 140, 25, 255); // selected files
+	btheme->tfile = btheme->tv3d;
+	rgba_char_args_set_fl(btheme->tfile.back, 0.3, 0.3, 0.3, 1);
+	rgba_char_args_set_fl(btheme->tfile.panel, 0.3, 0.3, 0.3, 1);
+	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
 	
-	SETCOL(btheme->tfile.grid,	250, 250, 250, 255);
-	SETCOL(btheme->tfile.image,	250, 250, 250, 255);
-	SETCOL(btheme->tfile.movie,	250, 250, 250, 255);
-	SETCOL(btheme->tfile.scene,	250, 250, 250, 255);
+	rgba_char_args_set(btheme->tfile.grid,  250, 250, 250, 255);
+	rgba_char_args_set(btheme->tfile.image, 250, 250, 250, 255);
+	rgba_char_args_set(btheme->tfile.movie, 250, 250, 250, 255);
+	rgba_char_args_set(btheme->tfile.scene, 250, 250, 250, 255);
 
 	
 	/* space seq */
-	btheme->tseq= btheme->tv3d;
-	SETCOL(btheme->tseq.back, 	116, 116, 116, 255);
-	SETCOL(btheme->tseq.movie, 	81, 105, 135, 255);
-	SETCOL(btheme->tseq.image, 	109, 88, 129, 255);
-	SETCOL(btheme->tseq.scene, 	78, 152, 62, 255);
-	SETCOL(btheme->tseq.audio, 	46, 143, 143, 255);
-	SETCOL(btheme->tseq.effect, 	169, 84, 124, 255);
-	SETCOL(btheme->tseq.plugin, 	126, 126, 80, 255);
-	SETCOL(btheme->tseq.transition, 162, 95, 111, 255);
-	SETCOL(btheme->tseq.meta, 	109, 145, 131, 255);
-	
+	btheme->tseq = btheme->tv3d;
+	rgba_char_args_set(btheme->tseq.back,   116, 116, 116, 255);
+	rgba_char_args_set(btheme->tseq.movie,  81, 105, 135, 255);
+	rgba_char_args_set(btheme->tseq.movieclip,  32, 32, 143, 255);
+	rgba_char_args_set(btheme->tseq.image,  109, 88, 129, 255);
+	rgba_char_args_set(btheme->tseq.scene,  78, 152, 62, 255);
+	rgba_char_args_set(btheme->tseq.audio,  46, 143, 143, 255);
+	rgba_char_args_set(btheme->tseq.effect,     169, 84, 124, 255);
+	rgba_char_args_set(btheme->tseq.plugin,     126, 126, 80, 255);
+	rgba_char_args_set(btheme->tseq.transition, 162, 95, 111, 255);
+	rgba_char_args_set(btheme->tseq.meta,   109, 145, 131, 255);
+	rgba_char_args_set(btheme->tseq.preview_back,   0, 0, 0, 255);
 
 	/* space image */
-	btheme->tima= btheme->tv3d;
-	SETCOL(btheme->tima.back, 	53, 53, 53, 255);
-	SETCOL(btheme->tima.vertex, 0, 0, 0, 255);
-	SETCOL(btheme->tima.vertex_select, 255, 133, 0, 255);
-	btheme->tima.vertex_size= 3;
-	btheme->tima.facedot_size= 3;
-	SETCOL(btheme->tima.face,   255, 255, 255, 10);
-	SETCOL(btheme->tima.face_select, 255, 133, 0, 60);
-	SETCOL(btheme->tima.editmesh_active, 255, 255, 255, 128);
-	SETCOLF(btheme->tima.preview_back, 	0.45, 0.45, 0.45, 1.0);
-	SETCOLF(btheme->tima.preview_stitch_face, 0.5, 0.5, 0.0, 0.2);
-	SETCOLF(btheme->tima.preview_stitch_edge, 1.0, 0.0, 1.0, 0.2);
-	SETCOLF(btheme->tima.preview_stitch_vert, 0.0, 0.0, 1.0, 0.2);
-	SETCOLF(btheme->tima.preview_stitch_stitchable, 0.0, 1.0, 0.0, 1.0);
-	SETCOLF(btheme->tima.preview_stitch_unstitchable, 1.0, 0.0, 0.0, 1.0);
+	btheme->tima = btheme->tv3d;
+	rgba_char_args_set(btheme->tima.back,   53, 53, 53, 255);
+	rgba_char_args_set(btheme->tima.vertex, 0, 0, 0, 255);
+	rgba_char_args_set(btheme->tima.vertex_select, 255, 133, 0, 255);
+	btheme->tima.vertex_size = 3;
+	btheme->tima.facedot_size = 3;
+	rgba_char_args_set(btheme->tima.face,   255, 255, 255, 10);
+	rgba_char_args_set(btheme->tima.face_select, 255, 133, 0, 60);
+	rgba_char_args_set(btheme->tima.editmesh_active, 255, 255, 255, 128);
+	rgba_char_args_set_fl(btheme->tima.preview_back,    0.45, 0.45, 0.45, 1.0);
+	rgba_char_args_set_fl(btheme->tima.preview_stitch_face, 0.5, 0.5, 0.0, 0.2);
+	rgba_char_args_set_fl(btheme->tima.preview_stitch_edge, 1.0, 0.0, 1.0, 0.2);
+	rgba_char_args_set_fl(btheme->tima.preview_stitch_vert, 0.0, 0.0, 1.0, 0.2);
+	rgba_char_args_set_fl(btheme->tima.preview_stitch_stitchable, 0.0, 1.0, 0.0, 1.0);
+	rgba_char_args_set_fl(btheme->tima.preview_stitch_unstitchable, 1.0, 0.0, 0.0, 1.0);
 
 	/* space text */
-	btheme->text= btheme->tv3d;
-	SETCOL(btheme->text.back, 	153, 153, 153, 255);
-	SETCOL(btheme->text.shade1, 	143, 143, 143, 255);
-	SETCOL(btheme->text.shade2, 	0xc6, 0x77, 0x77, 255);
-	SETCOL(btheme->text.hilite, 	255, 0, 0, 255);
+	btheme->text = btheme->tv3d;
+	rgba_char_args_set(btheme->text.back,   153, 153, 153, 255);
+	rgba_char_args_set(btheme->text.shade1,     143, 143, 143, 255);
+	rgba_char_args_set(btheme->text.shade2,     0xc6, 0x77, 0x77, 255);
+	rgba_char_args_set(btheme->text.hilite,     255, 0, 0, 255);
 	
 	/* syntax highlighting */
-	SETCOL(btheme->text.syntaxn,	0, 0, 200, 255);	/* Numbers  Blue*/
-	SETCOL(btheme->text.syntaxl,	100, 0, 0, 255);	/* Strings  red */
-	SETCOL(btheme->text.syntaxc,	0, 100, 50, 255);	/* Comments greenish */
-	SETCOL(btheme->text.syntaxv,	95, 95, 0, 255);	/* Special */
-	SETCOL(btheme->text.syntaxb,	128, 0, 80, 255);	/* Builtin, red-purple */
+	rgba_char_args_set(btheme->text.syntaxn,    0, 0, 200, 255);    /* Numbers  Blue*/
+	rgba_char_args_set(btheme->text.syntaxl,    100, 0, 0, 255);    /* Strings  red */
+	rgba_char_args_set(btheme->text.syntaxc,    0, 100, 50, 255);   /* Comments greenish */
+	rgba_char_args_set(btheme->text.syntaxv,    95, 95, 0, 255);    /* Special */
+	rgba_char_args_set(btheme->text.syntaxb,    128, 0, 80, 255);   /* Builtin, red-purple */
 	
 	/* space oops */
-	btheme->toops= btheme->tv3d;
-	SETCOLF(btheme->toops.back, 	0.45, 0.45, 0.45, 1.0);
+	btheme->toops = btheme->tv3d;
+	rgba_char_args_set_fl(btheme->toops.back,   0.45, 0.45, 0.45, 1.0);
 	
-	SETCOLF(btheme->toops.match, 	0.2, 0.5, 0.2, 0.3);	/* highlighting search match - soft green*/
-	SETCOLF(btheme->toops.selected_highlight, 0.51, 0.53, 0.55, 0.3);
+	rgba_char_args_set_fl(btheme->toops.match,  0.2, 0.5, 0.2, 0.3);    /* highlighting search match - soft green*/
+	rgba_char_args_set_fl(btheme->toops.selected_highlight, 0.51, 0.53, 0.55, 0.3);
 
 	/* space info */
-	btheme->tinfo= btheme->tv3d;
-	SETCOLF(btheme->tinfo.back, 	0.45, 0.45, 0.45, 1.0);
+	btheme->tinfo = btheme->tv3d;
+	rgba_char_args_set_fl(btheme->tinfo.back,   0.45, 0.45, 0.45, 1.0);
 
 	/* space user preferences */
-	btheme->tuserpref= btheme->tv3d;
-	SETCOLF(btheme->tuserpref.back, 0.45, 0.45, 0.45, 1.0);
+	btheme->tuserpref = btheme->tv3d;
+	rgba_char_args_set_fl(btheme->tuserpref.back, 0.45, 0.45, 0.45, 1.0);
 	
 	/* space console */
-	btheme->tconsole= btheme->tv3d;
-	SETCOL(btheme->tconsole.back, 0, 0, 0, 255);
-	SETCOL(btheme->tconsole.console_output, 96, 128, 255, 255);
-	SETCOL(btheme->tconsole.console_input, 255, 255, 255, 255);
-	SETCOL(btheme->tconsole.console_info, 0, 170, 0, 255);
-	SETCOL(btheme->tconsole.console_error, 220, 96, 96, 255);
-	SETCOL(btheme->tconsole.console_cursor, 220, 96, 96, 255);
+	btheme->tconsole = btheme->tv3d;
+	rgba_char_args_set(btheme->tconsole.back, 0, 0, 0, 255);
+	rgba_char_args_set(btheme->tconsole.console_output, 96, 128, 255, 255);
+	rgba_char_args_set(btheme->tconsole.console_input, 255, 255, 255, 255);
+	rgba_char_args_set(btheme->tconsole.console_info, 0, 170, 0, 255);
+	rgba_char_args_set(btheme->tconsole.console_error, 220, 96, 96, 255);
+	rgba_char_args_set(btheme->tconsole.console_cursor, 220, 96, 96, 255);
 	
 	/* space time */
-	btheme->ttime= btheme->tv3d;
-	SETCOLF(btheme->ttime.back, 	0.45, 0.45, 0.45, 1.0);
-	SETCOLF(btheme->ttime.grid, 	0.36, 0.36, 0.36, 1.0);
-	SETCOL(btheme->ttime.shade1,  173, 173, 173, 255);		// sliders
+	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
 	
 	/* space node, re-uses syntax color storage */
-	btheme->tnode= btheme->tv3d;
-	SETCOL(btheme->tnode.edge_select, 255, 255, 255, 255);
-	SETCOL(btheme->tnode.syntaxl, 155, 155, 155, 160);	/* TH_NODE, backdrop */
-	SETCOL(btheme->tnode.syntaxn, 100, 100, 100, 255);	/* in/output */
-	SETCOL(btheme->tnode.syntaxb, 108, 105, 111, 255);	/* operator */
-	SETCOL(btheme->tnode.syntaxv, 104, 106, 117, 255);	/* generator */
-	SETCOL(btheme->tnode.syntaxc, 105, 117, 110, 255);	/* group */
+	btheme->tnode = btheme->tv3d;
+	rgba_char_args_set(btheme->tnode.edge_select, 255, 255, 255, 255);
+	rgba_char_args_set(btheme->tnode.syntaxl, 155, 155, 155, 160);  /* TH_NODE, backdrop */
+	rgba_char_args_set(btheme->tnode.syntaxn, 100, 100, 100, 255);  /* in/output */
+	rgba_char_args_set(btheme->tnode.syntaxb, 108, 105, 111, 255);  /* operator */
+	rgba_char_args_set(btheme->tnode.syntaxv, 104, 106, 117, 255);  /* generator */
+	rgba_char_args_set(btheme->tnode.syntaxc, 105, 117, 110, 255);  /* group */
 	btheme->tnode.noodle_curving = 5;
 
 	/* space logic */
-	btheme->tlogic= btheme->tv3d;
-	SETCOL(btheme->tlogic.back, 100, 100, 100, 255);
+	btheme->tlogic = btheme->tv3d;
+	rgba_char_args_set(btheme->tlogic.back, 100, 100, 100, 255);
 	
 	/* space clip */
-	btheme->tclip= btheme->tv3d;
-
-	SETCOL(btheme->tclip.marker_outline, 0x00, 0x00, 0x00, 255);
-	SETCOL(btheme->tclip.marker, 0x7f, 0x7f, 0x00, 255);
-	SETCOL(btheme->tclip.act_marker, 0xff, 0xff, 0xff, 255);
-	SETCOL(btheme->tclip.sel_marker, 0xff, 0xff, 0x00, 255);
-	SETCOL(btheme->tclip.dis_marker, 0x7f, 0x00, 0x00, 255);
-	SETCOL(btheme->tclip.lock_marker, 0x7f, 0x7f, 0x7f, 255);
-	SETCOL(btheme->tclip.path_before, 0xff, 0x00, 0x00, 255);
-	SETCOL(btheme->tclip.path_after, 0x00, 0x00, 0xff, 255);
-	SETCOL(btheme->tclip.grid, 0x5e, 0x5e, 0x5e, 255);
-	SETCOL(btheme->tclip.cframe, 0x60, 0xc0, 0x40, 255);
-	SETCOL(btheme->tclip.handle_vertex, 0x00, 0x00, 0x00, 0xff);
-	SETCOL(btheme->tclip.handle_vertex_select, 0xff, 0xff, 0, 0xff);
-	btheme->tclip.handle_vertex_size= 4;
+	btheme->tclip = btheme->tv3d;
+
+	rgba_char_args_set(btheme->tclip.marker_outline, 0x00, 0x00, 0x00, 255);
+	rgba_char_args_set(btheme->tclip.marker, 0x7f, 0x7f, 0x00, 255);
+	rgba_char_args_set(btheme->tclip.act_marker, 0xff, 0xff, 0xff, 255);
+	rgba_char_args_set(btheme->tclip.sel_marker, 0xff, 0xff, 0x00, 255);
+	rgba_char_args_set(btheme->tclip.dis_marker, 0x7f, 0x00, 0x00, 255);
+	rgba_char_args_set(btheme->tclip.lock_marker, 0x7f, 0x7f, 0x7f, 255);
+	rgba_char_args_set(btheme->tclip.path_before, 0xff, 0x00, 0x00, 255);
+	rgba_char_args_set(btheme->tclip.path_after, 0x00, 0x00, 0xff, 255);
+	rgba_char_args_set(btheme->tclip.grid, 0x5e, 0x5e, 0x5e, 255);
+	rgba_char_args_set(btheme->tclip.cframe, 0x60, 0xc0, 0x40, 255);
+	rgba_char_args_set(btheme->tclip.handle_vertex, 0x00, 0x00, 0x00, 0xff);
+	rgba_char_args_set(btheme->tclip.handle_vertex_select, 0xff, 0xff, 0, 0xff);
+	btheme->tclip.handle_vertex_size = 4;
 }
 
 
 void UI_SetTheme(int spacetype, int regionid)
 {
-	if(spacetype==0) {	// called for safety, when delete themes
-		theme_active= U.themes.first;
-		theme_spacetype= SPACE_VIEW3D;
-		theme_regionid= RGN_TYPE_WINDOW;
+	if (spacetype == 0) { // called for safety, when delete themes
+		theme_active = U.themes.first;
+		theme_spacetype = SPACE_VIEW3D;
+		theme_regionid = RGN_TYPE_WINDOW;
 	}
 	else {
 		// later on, a local theme can be found too
-		theme_active= U.themes.first;
-		theme_spacetype= spacetype;
-		theme_regionid= regionid;
+		theme_active = U.themes.first;
+		theme_spacetype = spacetype;
+		theme_regionid = regionid;
 	}
 }
 
@@ -886,7 +893,7 @@ void UI_ThemeColor(int colorid)
 {
 	const unsigned char *cp;
 	
-	cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
+	cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
 	glColor3ubv(cp);
 
 }
@@ -896,7 +903,7 @@ void UI_ThemeColor4(int colorid)
 {
 	const unsigned char *cp;
 	
-	cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
+	cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
 	glColor4ubv(cp);
 
 }
@@ -907,12 +914,12 @@ void UI_ThemeColorShade(int colorid, int offset)
 	int r, g, b;
 	const unsigned char *cp;
 	
-	cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
-	r= offset + (int) cp[0];
+	cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
+	r = offset + (int) cp[0];
 	CLAMP(r, 0, 255);
-	g= offset + (int) cp[1];
+	g = offset + (int) cp[1];
 	CLAMP(g, 0, 255);
-	b= offset + (int) cp[2];
+	b = offset + (int) cp[2];
 	CLAMP(b, 0, 255);
 	//glColor3ub(r, g, b);
 	glColor4ub(r, g, b, cp[3]);
@@ -922,14 +929,14 @@ void UI_ThemeColorShadeAlpha(int colorid, int coloffset, int alphaoffset)
 	int r, g, b, a;
 	const unsigned char *cp;
 	
-	cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
-	r= coloffset + (int) cp[0];
+	cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
+	r = coloffset + (int) cp[0];
 	CLAMP(r, 0, 255);
-	g= coloffset + (int) cp[1];
+	g = coloffset + (int) cp[1];
 	CLAMP(g, 0, 255);
-	b= coloffset + (int) cp[2];
+	b = coloffset + (int) cp[2];
 	CLAMP(b, 0, 255);
-	a= alphaoffset + (int) cp[3];
+	a = alphaoffset + (int) cp[3];
 	CLAMP(a, 0, 255);
 	glColor4ub(r, g, b, a);
 }
@@ -940,13 +947,13 @@ void UI_ThemeColorBlend(int colorid1, int colorid2, float fac)
 	int r, g, b;
 	const unsigned char *cp1, *cp2;
 	
-	cp1= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
-	cp2= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
+	cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
+	cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
 
 	CLAMP(fac, 0.0f, 1.0f);
-	r= floorf((1.0f-fac)*cp1[0] + fac*cp2[0]);
-	g= floorf((1.0f-fac)*cp1[1] + fac*cp2[1]);
-	b= floorf((1.0f-fac)*cp1[2] + fac*cp2[2]);
+	r = floorf((1.0f - fac) * cp1[0] + fac * cp2[0]);
+	g = floorf((1.0f - fac) * cp1[1] + fac * cp2[1]);
+	b = floorf((1.0f - fac) * cp1[2] + fac * cp2[2]);
 	
 	glColor3ub(r, g, b);
 }
@@ -957,13 +964,13 @@ void UI_ThemeColorBlendShade(int colorid1, int colorid2, float fac, int offset)
 	int r, g, b;
 	const unsigned char *cp1, *cp2;
 	
-	cp1= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
-	cp2= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
+	cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
+	cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
 
 	CLAMP(fac, 0.0f, 1.0f);
-	r= offset+floorf((1.0f-fac)*cp1[0] + fac*cp2[0]);
-	g= offset+floorf((1.0f-fac)*cp1[1] + fac*cp2[1]);
-	b= offset+floorf((1.0f-fac)*cp1[2] + fac*cp2[2]);
+	r = offset + floorf((1.0f - fac) * cp1[0] + fac * cp2[0]);
+	g = offset + floorf((1.0f - fac) * cp1[1] + fac * cp2[1]);
+	b = offset + floorf((1.0f - fac) * cp1[2] + fac * cp2[2]);
 	
 	CLAMP(r, 0, 255);
 	CLAMP(g, 0, 255);
@@ -978,14 +985,14 @@ void UI_ThemeColorBlendShadeAlpha(int colorid1, int colorid2, float fac, int off
 	int r, g, b, a;
 	const unsigned char *cp1, *cp2;
 	
-	cp1= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
-	cp2= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
+	cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
+	cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
 
 	CLAMP(fac, 0.0f, 1.0f);
-	r= offset+floorf((1.0f-fac)*cp1[0] + fac*cp2[0]);
-	g= offset+floorf((1.0f-fac)*cp1[1] + fac*cp2[1]);
-	b= offset+floorf((1.0f-fac)*cp1[2] + fac*cp2[2]);
-	a= alphaoffset + floorf((1.0f-fac)*cp1[3] + fac*cp2[3]);
+	r = offset + floorf((1.0f - fac) * cp1[0] + fac * cp2[0]);
+	g = offset + floorf((1.0f - fac) * cp1[1] + fac * cp2[1]);
+	b = offset + floorf((1.0f - fac) * cp1[2] + fac * cp2[2]);
+	a = alphaoffset + floorf((1.0f - fac) * cp1[3] + fac * cp2[3]);
 	
 	CLAMP(r, 0, 255);
 	CLAMP(g, 0, 255);
@@ -1001,7 +1008,7 @@ float UI_GetThemeValuef(int colorid)
 {
 	const unsigned char *cp;
 	
-	cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
+	cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
 	return ((float)cp[0]);
 
 }
@@ -1011,7 +1018,7 @@ int UI_GetThemeValue(int colorid)
 {
 	const unsigned char *cp;
 	
-	cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
+	cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
 	return ((int) cp[0]);
 
 }
@@ -1022,10 +1029,10 @@ void UI_GetThemeColor3fv(int colorid, float *col)
 {
 	const unsigned char *cp;
 	
-	cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
-	col[0]= ((float)cp[0])/255.0f;
-	col[1]= ((float)cp[1])/255.0f;
-	col[2]= ((float)cp[2])/255.0f;
+	cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
+	col[0] = ((float)cp[0]) / 255.0f;
+	col[1] = ((float)cp[1]) / 255.0f;
+	col[2] = ((float)cp[2]) / 255.0f;
 }
 
 // get the color, range 0.0-1.0, complete with shading offset
@@ -1034,18 +1041,18 @@ void UI_GetThemeColorShade3fv(int colorid, int offset, float *col)
 	int r, g, b;
 	const unsigned char *cp;
 	
-	cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
+	cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
 	
-	r= offset + (int) cp[0];
+	r = offset + (int) cp[0];
 	CLAMP(r, 0, 255);
-	g= offset + (int) cp[1];
+	g = offset + (int) cp[1];
 	CLAMP(g, 0, 255);
-	b= offset + (int) cp[2];
+	b = offset + (int) cp[2];
 	CLAMP(b, 0, 255);
 	
-	col[0]= ((float)r)/255.0f;
-	col[1]= ((float)g)/255.0f;
-	col[2]= ((float)b)/255.0f;
+	col[0] = ((float)r) / 255.0f;
+	col[1] = ((float)g) / 255.0f;
+	col[2] = ((float)b) / 255.0f;
 }
 
 // get the color, in char pointer
@@ -1053,10 +1060,10 @@ void UI_GetThemeColor3ubv(int colorid, unsigned char col[3])
 {
 	const unsigned char *cp;
 	
-	cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
-	col[0]= cp[0];
-	col[1]= cp[1];
-	col[2]= cp[2];
+	cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
+	col[0] = cp[0];
+	col[1] = cp[1];
+	col[2] = cp[2];
 }
 
 // get the color, in char pointer
@@ -1064,22 +1071,22 @@ void UI_GetThemeColor4ubv(int colorid, unsigned char col[4])
 {
 	const unsigned char *cp;
 	
-	cp= UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
-	col[0]= cp[0];
-	col[1]= cp[1];
-	col[2]= cp[2];
-	col[3]= cp[3];
+	cp = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid);
+	col[0] = cp[0];
+	col[1] = cp[1];
+	col[2] = cp[2];
+	col[3] = cp[3];
 }
 
 void UI_GetThemeColorType4ubv(int colorid, int spacetype, char col[4])
 {
 	const unsigned char *cp;
 	
-	cp= UI_ThemeGetColorPtr(theme_active, spacetype, colorid);
-	col[0]= cp[0];
-	col[1]= cp[1];
-	col[2]= cp[2];
-	col[3]= cp[3];
+	cp = UI_ThemeGetColorPtr(theme_active, spacetype, colorid);
+	col[0] = cp[0];
+	col[1] = cp[1];
+	col[2] = cp[2];
+	col[3] = cp[3];
 }
 
 // blends and shades between two char color pointers
@@ -1087,13 +1094,13 @@ void UI_ColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char c
 {
 	int r, g, b;
 	CLAMP(fac, 0.0f, 1.0f);
-	r= offset+floorf((1.0f-fac)*cp1[0] + fac*cp2[0]);
-	g= offset+floorf((1.0f-fac)*cp1[1] + fac*cp2[1]);
-	b= offset+floorf((1.0f-fac)*cp1[2] + fac*cp2[2]);
-	
-	r= r<0?0:(r>255?255:r);
-	g= g<0?0:(g>255?255:g);
-	b= b<0?0:(b>255?255:b);
+	r = offset + floorf((1.0f - fac) * cp1[0] + fac * cp2[0]);
+	g = offset + floorf((1.0f - fac) * cp1[1] + fac * cp2[1]);
+	b = offset + floorf((1.0f - fac) * cp1[2] + fac * cp2[2]);
+
+	r = r < 0 ? 0 : (r > 255 ? 255 : r);
+	g = g < 0 ? 0 : (g > 255 ? 255 : g);
+	b = b < 0 ? 0 : (b > 255 ? 255 : b);
 	
 	glColor3ub(r, g, b);
 }
@@ -1102,9 +1109,9 @@ void UI_GetColorPtrShade3ubv(const unsigned char cp[3], unsigned char col[3], in
 {
 	int r, g, b;
 
-	r= offset+(int)cp[0];
-	g= offset+(int)cp[1];
-	b= offset+(int)cp[2];
+	r = offset + (int)cp[0];
+	g = offset + (int)cp[1];
+	b = offset + (int)cp[2];
 
 	CLAMP(r, 0, 255);
 	CLAMP(g, 0, 255);
@@ -1121,9 +1128,9 @@ void UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned cha
 	int r, g, b;
 
 	CLAMP(fac, 0.0f, 1.0f);
-	r= offset+floor((1.0f-fac)*cp1[0] + fac*cp2[0]);
-	g= offset+floor((1.0f-fac)*cp1[1] + fac*cp2[1]);
-	b= offset+floor((1.0f-fac)*cp1[2] + fac*cp2[2]);
+	r = offset + floor((1.0f - fac) * cp1[0] + fac * cp2[0]);
+	g = offset + floor((1.0f - fac) * cp1[1] + fac * cp2[1]);
+	b = offset + floor((1.0f - fac) * cp1[2] + fac * cp2[2]);
 
 	CLAMP(r, 0, 255);
 	CLAMP(g, 0, 255);
@@ -1144,22 +1151,22 @@ void UI_ThemeClearColor(int colorid)
 
 void UI_make_axis_color(const unsigned char src_col[3], unsigned char dst_col[3], const char axis)
 {
-	switch(axis)
+	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;
+			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;
 			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;
+			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;
 			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;
+			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;
 			break;
 		default:
 			BLI_assert(!"invalid axis arg");
@@ -1171,20 +1178,20 @@ void UI_make_axis_color(const unsigned char src_col[3], unsigned char dst_col[3]
 /* patching UserDef struct and Themes */
 void init_userdef_do_versions(void)
 {
-	Main *bmain= G.main;
+	Main *bmain = G.main;
 //	countall();
 	
 	/* the UserDef struct is not corrected with do_versions() .... ugh! */
-	if(U.wheellinescroll == 0) U.wheellinescroll = 3;
-	if(U.menuthreshold1==0) {
-		U.menuthreshold1= 5;
-		U.menuthreshold2= 2;
+	if (U.wheellinescroll == 0) U.wheellinescroll = 3;
+	if (U.menuthreshold1 == 0) {
+		U.menuthreshold1 = 5;
+		U.menuthreshold2 = 2;
 	}
-	if(U.tb_leftmouse==0) {
-		U.tb_leftmouse= 5;
-		U.tb_rightmouse= 5;
+	if (U.tb_leftmouse == 0) {
+		U.tb_leftmouse = 5;
+		U.tb_rightmouse = 5;
 	}
-	if(U.mixbufsize==0) U.mixbufsize= 2048;
+	if (U.mixbufsize == 0) U.mixbufsize = 2048;
 	if (strcmp(U.tempdir, "/") == 0) {
 		BLI_system_temporary_dir(U.tempdir);
 	}
@@ -1197,17 +1204,21 @@ void init_userdef_do_versions(void)
 // XXX		error(STRINGIFY(BLENDER_STARTUP_FILE)" is buggy, please consider removing it.\n");
 	}
 	/* transform widget settings */
-	if(U.tw_hotspot==0) {
-		U.tw_hotspot= 14;
-		U.tw_size= 20;			// percentage of window size
-		U.tw_handlesize= 16;	// percentage of widget radius
+	if (U.tw_hotspot == 0) {
+		U.tw_hotspot = 14;
+		U.tw_size = 20;          // percentage of window size
+		U.tw_handlesize = 16;    // percentage of widget radius
 	}
-	if(U.pad_rot_angle==0)
-		U.pad_rot_angle= 15;
-
+	if (U.pad_rot_angle == 0)
+		U.pad_rot_angle = 15;
+	/* graph editor - unselected F-Curve visibility */
+	if (U.fcu_inactive_alpha == 0) {
+		U.fcu_inactive_alpha = 0.25f;
+	}
+	
 	/* signal for derivedmesh to use colorband */
-	/* run incase this was on and is now off in the user prefs [#28096] */
-	vDM_ColorBand_store((U.flag & USER_CUSTOM_RANGE) ? (&U.coba_weight):NULL);
+	/* run in case this was on and is now off in the user prefs [#28096] */
+	vDM_ColorBand_store((U.flag & USER_CUSTOM_RANGE) ? (&U.coba_weight) : NULL);
 
 	if (bmain->versionfile <= 191) {
 		BLI_strncpy(U.plugtexdir, U.textudir, sizeof(U.plugtexdir));
@@ -1224,22 +1235,22 @@ void init_userdef_do_versions(void)
 		bTheme *btheme;
 		
 		U.uiflag |= USER_GLOBALUNDO;
-		if (U.undosteps==0) U.undosteps=32;
+		if (U.undosteps == 0) U.undosteps = 32;
 		
-		for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 			/* check for alpha==0 is safe, then color was never set */
-			if(btheme->tv3d.edge_seam[3]==0) {
-				SETCOL(btheme->tv3d.edge_seam, 230, 150, 50, 255);
+			if (btheme->tv3d.edge_seam[3] == 0) {
+				rgba_char_args_set(btheme->tv3d.edge_seam, 230, 150, 50, 255);
 			}
-			if(btheme->tv3d.normal[3]==0) {
-				SETCOL(btheme->tv3d.normal, 0x22, 0xDD, 0xDD, 255);
+			if (btheme->tv3d.normal[3] == 0) {
+				rgba_char_args_set(btheme->tv3d.normal, 0x22, 0xDD, 0xDD, 255);
 			}
-			if(btheme->tv3d.vertex_normal[3]==0) {
-				SETCOL(btheme->tv3d.vertex_normal, 0x23, 0x61, 0xDD, 255);
+			if (btheme->tv3d.vertex_normal[3] == 0) {
+				rgba_char_args_set(btheme->tv3d.vertex_normal, 0x23, 0x61, 0xDD, 255);
 			}
-			if(btheme->tv3d.face_dot[3]==0) {
-				SETCOL(btheme->tv3d.face_dot, 255, 138, 48, 255);
-				btheme->tv3d.facedot_size= 4;
+			if (btheme->tv3d.face_dot[3] == 0) {
+				rgba_char_args_set(btheme->tv3d.face_dot, 255, 138, 48, 255);
+				btheme->tv3d.facedot_size = 4;
 			}
 		}
 	}
@@ -1251,89 +1262,89 @@ void init_userdef_do_versions(void)
 	if (bmain->versionfile <= 236) {
 		bTheme *btheme;
 		/* new space type */
-		for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 			/* check for alpha==0 is safe, then color was never set */
-			if(btheme->ttime.back[3]==0) {
+			if (btheme->ttime.back[3] == 0) {
 				// copied from ui_theme_init_default
-				btheme->ttime= btheme->tv3d;
-				SETCOLF(btheme->ttime.back, 	0.45, 0.45, 0.45, 1.0);
-				SETCOLF(btheme->ttime.grid, 	0.36, 0.36, 0.36, 1.0);
-				SETCOL(btheme->ttime.shade1,  173, 173, 173, 255);		// sliders
+				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
 			}
-			if(btheme->text.syntaxn[3]==0) {
-				SETCOL(btheme->text.syntaxn,	0, 0, 200, 255);	/* Numbers  Blue*/
-				SETCOL(btheme->text.syntaxl,	100, 0, 0, 255);	/* Strings  red */
-				SETCOL(btheme->text.syntaxc,	0, 100, 50, 255);	/* Comments greenish */
-				SETCOL(btheme->text.syntaxv,	95, 95, 0, 255);	/* Special */
-				SETCOL(btheme->text.syntaxb,	128, 0, 80, 255);	/* Builtin, red-purple */
+			if (btheme->text.syntaxn[3] == 0) {
+				rgba_char_args_set(btheme->text.syntaxn,    0, 0, 200, 255);    /* Numbers  Blue*/
+				rgba_char_args_set(btheme->text.syntaxl,    100, 0, 0, 255);    /* Strings  red */
+				rgba_char_args_set(btheme->text.syntaxc,    0, 100, 50, 255);   /* Comments greenish */
+				rgba_char_args_set(btheme->text.syntaxv,    95, 95, 0, 255);    /* Special */
+				rgba_char_args_set(btheme->text.syntaxb,    128, 0, 80, 255);   /* Builtin, red-purple */
 			}
 		}
 	}
 	if (bmain->versionfile <= 237) {
 		bTheme *btheme;
 		/* bone colors */
-		for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 			/* check for alpha==0 is safe, then color was never set */
-			if(btheme->tv3d.bone_solid[3]==0) {
-				SETCOL(btheme->tv3d.bone_solid, 200, 200, 200, 255);
-				SETCOL(btheme->tv3d.bone_pose, 80, 200, 255, 80);
+			if (btheme->tv3d.bone_solid[3] == 0) {
+				rgba_char_args_set(btheme->tv3d.bone_solid, 200, 200, 200, 255);
+				rgba_char_args_set(btheme->tv3d.bone_pose, 80, 200, 255, 80);
 			}
 		}
 	}
 	if (bmain->versionfile <= 238) {
 		bTheme *btheme;
 		/* bone colors */
-		for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 			/* check for alpha==0 is safe, then color was never set */
-			if(btheme->tnla.strip[3]==0) {
-				SETCOL(btheme->tnla.strip_select, 	0xff, 0xff, 0xaa, 255);
-				SETCOL(btheme->tnla.strip, 0xe4, 0x9c, 0xc6, 255);
+			if (btheme->tnla.strip[3] == 0) {
+				rgba_char_args_set(btheme->tnla.strip_select,   0xff, 0xff, 0xaa, 255);
+				rgba_char_args_set(btheme->tnla.strip, 0xe4, 0x9c, 0xc6, 255);
 			}
 		}
 	}
 	if (bmain->versionfile <= 239) {
 		bTheme *btheme;
 		
-		for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 			/* Lamp theme, check for alpha==0 is safe, then color was never set */
-			if(btheme->tv3d.lamp[3]==0) {
-				SETCOL(btheme->tv3d.lamp, 	0, 0, 0, 40);
+			if (btheme->tv3d.lamp[3] == 0) {
+				rgba_char_args_set(btheme->tv3d.lamp,   0, 0, 0, 40);
 /* TEMPORAL, remove me! (ton) */				
 				U.uiflag |= USER_PLAINMENUS;
 			}
 			
 		}
-		if(U.obcenter_dia==0) U.obcenter_dia= 6;
+		if (U.obcenter_dia == 0) U.obcenter_dia = 6;
 	}
 	if (bmain->versionfile <= 241) {
 		bTheme *btheme;
-		for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 			/* Node editor theme, check for alpha==0 is safe, then color was never set */
-			if(btheme->tnode.syntaxn[3]==0) {
+			if (btheme->tnode.syntaxn[3] == 0) {
 				/* re-uses syntax color storage */
-				btheme->tnode= btheme->tv3d;
-				SETCOL(btheme->tnode.edge_select, 255, 255, 255, 255);
-				SETCOL(btheme->tnode.syntaxl, 150, 150, 150, 255);	/* TH_NODE, backdrop */
-				SETCOL(btheme->tnode.syntaxn, 129, 131, 144, 255);	/* in/output */
-				SETCOL(btheme->tnode.syntaxb, 127,127,127, 255);	/* operator */
-				SETCOL(btheme->tnode.syntaxv, 142, 138, 145, 255);	/* generator */
-				SETCOL(btheme->tnode.syntaxc, 120, 145, 120, 255);	/* group */
+				btheme->tnode = btheme->tv3d;
+				rgba_char_args_set(btheme->tnode.edge_select, 255, 255, 255, 255);
+				rgba_char_args_set(btheme->tnode.syntaxl, 150, 150, 150, 255);  /* TH_NODE, backdrop */
+				rgba_char_args_set(btheme->tnode.syntaxn, 129, 131, 144, 255);  /* in/output */
+				rgba_char_args_set(btheme->tnode.syntaxb, 127, 127, 127, 255);  /* operator */
+				rgba_char_args_set(btheme->tnode.syntaxv, 142, 138, 145, 255);  /* generator */
+				rgba_char_args_set(btheme->tnode.syntaxc, 120, 145, 120, 255);  /* group */
 			}
 			/* Group theme colors */
-			if(btheme->tv3d.group[3]==0) {
-				SETCOL(btheme->tv3d.group, 0x0C, 0x30, 0x0C, 255);
-				SETCOL(btheme->tv3d.group_active, 0x66, 0xFF, 0x66, 255);
+			if (btheme->tv3d.group[3] == 0) {
+				rgba_char_args_set(btheme->tv3d.group, 0x0C, 0x30, 0x0C, 255);
+				rgba_char_args_set(btheme->tv3d.group_active, 0x66, 0xFF, 0x66, 255);
 			}
 			/* Sequence editor theme*/
-			if(btheme->tseq.movie[3]==0) {
-				SETCOL(btheme->tseq.movie, 	81, 105, 135, 255);
-				SETCOL(btheme->tseq.image, 	109, 88, 129, 255);
-				SETCOL(btheme->tseq.scene, 	78, 152, 62, 255);
-				SETCOL(btheme->tseq.audio, 	46, 143, 143, 255);
-				SETCOL(btheme->tseq.effect, 	169, 84, 124, 255);
-				SETCOL(btheme->tseq.plugin, 	126, 126, 80, 255);
-				SETCOL(btheme->tseq.transition, 162, 95, 111, 255);
-				SETCOL(btheme->tseq.meta, 	109, 145, 131, 255);
+			if (btheme->tseq.movie[3] == 0) {
+				rgba_char_args_set(btheme->tseq.movie,  81, 105, 135, 255);
+				rgba_char_args_set(btheme->tseq.image,  109, 88, 129, 255);
+				rgba_char_args_set(btheme->tseq.scene,  78, 152, 62, 255);
+				rgba_char_args_set(btheme->tseq.audio,  46, 143, 143, 255);
+				rgba_char_args_set(btheme->tseq.effect,     169, 84, 124, 255);
+				rgba_char_args_set(btheme->tseq.plugin,     126, 126, 80, 255);
+				rgba_char_args_set(btheme->tseq.transition, 162, 95, 111, 255);
+				rgba_char_args_set(btheme->tseq.meta,   109, 145, 131, 255);
 			}
 		}
 		
@@ -1349,18 +1360,18 @@ void init_userdef_do_versions(void)
 	if (bmain->versionfile <= 242) {
 		bTheme *btheme;
 		
-		for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 			/* long keyframe color */
 			/* check for alpha==0 is safe, then color was never set */
-			if(btheme->tact.strip[3]==0) {
-				SETCOL(btheme->tv3d.edge_sharp, 255, 32, 32, 255);
-				SETCOL(btheme->tact.strip_select, 	0xff, 0xff, 0xaa, 204);
-				SETCOL(btheme->tact.strip, 0xe4, 0x9c, 0xc6, 204);
+			if (btheme->tact.strip[3] == 0) {
+				rgba_char_args_set(btheme->tv3d.edge_sharp, 255, 32, 32, 255);
+				rgba_char_args_set(btheme->tact.strip_select,   0xff, 0xff, 0xaa, 204);
+				rgba_char_args_set(btheme->tact.strip, 0xe4, 0x9c, 0xc6, 204);
 			}
 			
 			/* IPO-Editor - Vertex Size*/
-			if(btheme->tipo.vertex_size == 0) {
-				btheme->tipo.vertex_size= 3;
+			if (btheme->tipo.vertex_size == 0) {
+				btheme->tipo.vertex_size = 3;
 			}
 		}
 	}
@@ -1370,31 +1381,31 @@ void init_userdef_do_versions(void)
 	}
 	if (bmain->versionfile < 245 || (bmain->versionfile == 245 && bmain->subversionfile < 3)) {
 		bTheme *btheme;
-		for(btheme= U.themes.first; btheme; btheme= btheme->next) {
-			SETCOL(btheme->tv3d.editmesh_active, 255, 255, 255, 128);
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
+			rgba_char_args_set(btheme->tv3d.editmesh_active, 255, 255, 255, 128);
 		}
-		if(U.coba_weight.tot==0)
+		if (U.coba_weight.tot == 0)
 			init_colorband(&U.coba_weight, 1);
 	}
 	if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 11)) {
 		bTheme *btheme;
-		for (btheme= U.themes.first; btheme; btheme= btheme->next) {
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 			/* these should all use the same color */
-			SETCOL(btheme->tv3d.cframe, 0x60, 0xc0, 0x40, 255);
-			SETCOL(btheme->tipo.cframe, 0x60, 0xc0, 0x40, 255);
-			SETCOL(btheme->tact.cframe, 0x60, 0xc0, 0x40, 255);
-			SETCOL(btheme->tnla.cframe, 0x60, 0xc0, 0x40, 255);
-			SETCOL(btheme->tseq.cframe, 0x60, 0xc0, 0x40, 255);
-			//SETCOL(btheme->tsnd.cframe, 0x60, 0xc0, 0x40, 255); Not needed anymore
-			SETCOL(btheme->ttime.cframe, 0x60, 0xc0, 0x40, 255);
+			rgba_char_args_set(btheme->tv3d.cframe, 0x60, 0xc0, 0x40, 255);
+			rgba_char_args_set(btheme->tipo.cframe, 0x60, 0xc0, 0x40, 255);
+			rgba_char_args_set(btheme->tact.cframe, 0x60, 0xc0, 0x40, 255);
+			rgba_char_args_set(btheme->tnla.cframe, 0x60, 0xc0, 0x40, 255);
+			rgba_char_args_set(btheme->tseq.cframe, 0x60, 0xc0, 0x40, 255);
+			//rgba_char_args_set(btheme->tsnd.cframe, 0x60, 0xc0, 0x40, 255); Not needed anymore
+			rgba_char_args_set(btheme->ttime.cframe, 0x60, 0xc0, 0x40, 255);
 		}
 	}
 	if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 13)) {
 		bTheme *btheme;
-		for (btheme= U.themes.first; btheme; btheme= btheme->next) {
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 			/* action channel groups (recolor anyway) */
-			SETCOL(btheme->tact.group, 0x39, 0x7d, 0x1b, 255);
-			SETCOL(btheme->tact.group_active, 0x7d, 0xe9, 0x60, 255);
+			rgba_char_args_set(btheme->tact.group, 0x39, 0x7d, 0x1b, 255);
+			rgba_char_args_set(btheme->tact.group_active, 0x7d, 0xe9, 0x60, 255);
 			
 			/* bone custom-color sets */
 			if (btheme->tarm[0].solid[3] == 0)
@@ -1402,99 +1413,99 @@ void init_userdef_do_versions(void)
 		}
 	}
 	if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 16)) {
-		U.flag |= USER_ADD_VIEWALIGNED|USER_ADD_EDITMODE;
+		U.flag |= USER_ADD_VIEWALIGNED | USER_ADD_EDITMODE;
 	}
 	if ((bmain->versionfile < 247) || (bmain->versionfile == 247 && bmain->subversionfile <= 2)) {
 		bTheme *btheme;
 		
 		/* adjust themes */
-		for (btheme= U.themes.first; btheme; btheme= btheme->next) {
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 			char *col;
 			
 			/* IPO Editor: Handles/Vertices */
 			col = btheme->tipo.vertex;
-			SETCOL(btheme->tipo.handle_vertex, col[0], col[1], col[2], 255);
+			rgba_char_args_set(btheme->tipo.handle_vertex, col[0], col[1], col[2], 255);
 			col = btheme->tipo.vertex_select;
-			SETCOL(btheme->tipo.handle_vertex_select, col[0], col[1], col[2], 255);
-			btheme->tipo.handle_vertex_size= btheme->tipo.vertex_size;
+			rgba_char_args_set(btheme->tipo.handle_vertex_select, col[0], col[1], col[2], 255);
+			btheme->tipo.handle_vertex_size = btheme->tipo.vertex_size;
 			
 			/* Sequence/Image Editor: colors for GPencil text */
 			col = btheme->tv3d.bone_pose;
-			SETCOL(btheme->tseq.bone_pose, col[0], col[1], col[2], 255);
-			SETCOL(btheme->tima.bone_pose, col[0], col[1], col[2], 255);
+			rgba_char_args_set(btheme->tseq.bone_pose, col[0], col[1], col[2], 255);
+			rgba_char_args_set(btheme->tima.bone_pose, col[0], col[1], col[2], 255);
 			col = btheme->tv3d.vertex_select;
-			SETCOL(btheme->tseq.vertex_select, col[0], col[1], col[2], 255);
+			rgba_char_args_set(btheme->tseq.vertex_select, col[0], col[1], col[2], 255);
 		}
 	}
 	if (bmain->versionfile < 250) {
 		bTheme *btheme;
 		
-		for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 			/* this was not properly initialized in 2.45 */
-			if(btheme->tima.face_dot[3]==0) {
-				SETCOL(btheme->tima.editmesh_active, 255, 255, 255, 128);
-				SETCOL(btheme->tima.face_dot, 255, 133, 0, 255);
-				btheme->tima.facedot_size= 2;
+			if (btheme->tima.face_dot[3] == 0) {
+				rgba_char_args_set(btheme->tima.editmesh_active, 255, 255, 255, 128);
+				rgba_char_args_set(btheme->tima.face_dot, 255, 133, 0, 255);
+				btheme->tima.facedot_size = 2;
 			}
 			
 			/* DopeSheet - (Object) Channel color */
-			SETCOL(btheme->tact.ds_channel, 	82, 96, 110, 255);
-			SETCOL(btheme->tact.ds_subchannel,	124, 137, 150, 255);
+			rgba_char_args_set(btheme->tact.ds_channel,     82, 96, 110, 255);
+			rgba_char_args_set(btheme->tact.ds_subchannel,  124, 137, 150, 255);
 			/* DopeSheet - Group Channel color (saner version) */
-			SETCOL(btheme->tact.group, 79, 101, 73, 255);
-			SETCOL(btheme->tact.group_active, 135, 177, 125, 255);
+			rgba_char_args_set(btheme->tact.group, 79, 101, 73, 255);
+			rgba_char_args_set(btheme->tact.group_active, 135, 177, 125, 255);
 			
 			/* Graph Editor - (Object) Channel color */
-			SETCOL(btheme->tipo.ds_channel, 	82, 96, 110, 255);
-			SETCOL(btheme->tipo.ds_subchannel,	124, 137, 150, 255);
+			rgba_char_args_set(btheme->tipo.ds_channel,     82, 96, 110, 255);
+			rgba_char_args_set(btheme->tipo.ds_subchannel,  124, 137, 150, 255);
 			/* Graph Editor - Group Channel color */
-			SETCOL(btheme->tipo.group, 79, 101, 73, 255);
-			SETCOL(btheme->tipo.group_active, 135, 177, 125, 255);
+			rgba_char_args_set(btheme->tipo.group, 79, 101, 73, 255);
+			rgba_char_args_set(btheme->tipo.group_active, 135, 177, 125, 255);
 			
 			/* Nla Editor - (Object) Channel color */
-			SETCOL(btheme->tnla.ds_channel, 	82, 96, 110, 255);
-			SETCOL(btheme->tnla.ds_subchannel,	124, 137, 150, 255);
+			rgba_char_args_set(btheme->tnla.ds_channel,     82, 96, 110, 255);
+			rgba_char_args_set(btheme->tnla.ds_subchannel,  124, 137, 150, 255);
 			/* NLA Editor - New Strip colors */
-			SETCOL(btheme->tnla.strip, 			12, 10, 10, 128); 
-			SETCOL(btheme->tnla.strip_select, 	255, 140, 0, 255);
+			rgba_char_args_set(btheme->tnla.strip,          12, 10, 10, 128);
+			rgba_char_args_set(btheme->tnla.strip_select,   255, 140, 0, 255);
 		}
 		
 		/* adjust grease-pencil distances */
-		U.gp_manhattendist= 1;
-		U.gp_euclideandist= 2;
+		U.gp_manhattendist = 1;
+		U.gp_euclideandist = 2;
 		
 		/* adjust default interpolation for new IPO-curves */
-		U.ipo_new= BEZT_IPO_BEZ;
+		U.ipo_new = BEZT_IPO_BEZ;
 	}
 	
 	if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 1)) {
 		bTheme *btheme;
 
-		for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 			
 			/* common (new) variables, it checks for alpha==0 */
 			ui_theme_init_new(btheme);
 
-			if(btheme->tui.wcol_num.outline[3]==0)
+			if (btheme->tui.wcol_num.outline[3] == 0)
 				ui_widget_color_init(&btheme->tui);
 			
 			/* Logic editor theme, check for alpha==0 is safe, then color was never set */
-			if(btheme->tlogic.syntaxn[3]==0) {
+			if (btheme->tlogic.syntaxn[3] == 0) {
 				/* re-uses syntax color storage */
-				btheme->tlogic= btheme->tv3d;
-				SETCOL(btheme->tlogic.back, 100, 100, 100, 255);
+				btheme->tlogic = btheme->tv3d;
+				rgba_char_args_set(btheme->tlogic.back, 100, 100, 100, 255);
 			}
 
-			SETCOLF(btheme->tinfo.back, 0.45, 0.45, 0.45, 1.0);
-			SETCOLF(btheme->tuserpref.back, 0.45, 0.45, 0.45, 1.0);
+			rgba_char_args_set_fl(btheme->tinfo.back, 0.45, 0.45, 0.45, 1.0);
+			rgba_char_args_set_fl(btheme->tuserpref.back, 0.45, 0.45, 0.45, 1.0);
 		}
 	}
 
 	if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 3)) {
 		/* new audio system */
-		if(U.audiochannels == 0)
+		if (U.audiochannels == 0)
 			U.audiochannels = 2;
-		if(U.audiodevice == 0) {
+		if (U.audiodevice == 0) {
 #ifdef WITH_OPENAL
 			U.audiodevice = 2;
 #endif
@@ -1502,9 +1513,9 @@ void init_userdef_do_versions(void)
 			U.audiodevice = 1;
 #endif
 		}
-		if(U.audioformat == 0)
+		if (U.audioformat == 0)
 			U.audioformat = 0x24;
-		if(U.audiorate == 0)
+		if (U.audiorate == 0)
 			U.audiorate = 44100;
 	}
 
@@ -1514,45 +1525,45 @@ void init_userdef_do_versions(void)
 	if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 8)) {
 		wmKeyMap *km;
 		
-		for(km=U.user_keymaps.first; km; km=km->next) {
-			if (strcmp(km->idname, "Armature_Sketch")==0)
+		for (km = U.user_keymaps.first; km; km = km->next) {
+			if (strcmp(km->idname, "Armature_Sketch") == 0)
 				strcpy(km->idname, "Armature Sketch");
-			else if (strcmp(km->idname, "View3D")==0)
+			else if (strcmp(km->idname, "View3D") == 0)
 				strcpy(km->idname, "3D View");
-			else if (strcmp(km->idname, "View3D Generic")==0)
+			else if (strcmp(km->idname, "View3D Generic") == 0)
 				strcpy(km->idname, "3D View Generic");
-			else if (strcmp(km->idname, "EditMesh")==0)
+			else if (strcmp(km->idname, "EditMesh") == 0)
 				strcpy(km->idname, "Mesh");
-			else if (strcmp(km->idname, "TimeLine")==0)
+			else if (strcmp(km->idname, "TimeLine") == 0)
 				strcpy(km->idname, "Timeline");
-			else if (strcmp(km->idname, "UVEdit")==0)
+			else if (strcmp(km->idname, "UVEdit") == 0)
 				strcpy(km->idname, "UV Editor");
-			else if (strcmp(km->idname, "Animation_Channels")==0)
+			else if (strcmp(km->idname, "Animation_Channels") == 0)
 				strcpy(km->idname, "Animation Channels");
-			else if (strcmp(km->idname, "GraphEdit Keys")==0)
+			else if (strcmp(km->idname, "GraphEdit Keys") == 0)
 				strcpy(km->idname, "Graph Editor");
-			else if (strcmp(km->idname, "GraphEdit Generic")==0)
+			else if (strcmp(km->idname, "GraphEdit Generic") == 0)
 				strcpy(km->idname, "Graph Editor Generic");
-			else if (strcmp(km->idname, "Action_Keys")==0)
+			else if (strcmp(km->idname, "Action_Keys") == 0)
 				strcpy(km->idname, "Dopesheet");
-			else if (strcmp(km->idname, "NLA Data")==0)
+			else if (strcmp(km->idname, "NLA Data") == 0)
 				strcpy(km->idname, "NLA Editor");
-			else if (strcmp(km->idname, "Node Generic")==0)
+			else if (strcmp(km->idname, "Node Generic") == 0)
 				strcpy(km->idname, "Node Editor");
-			else if (strcmp(km->idname, "Logic Generic")==0)
+			else if (strcmp(km->idname, "Logic Generic") == 0)
 				strcpy(km->idname, "Logic Editor");
-			else if (strcmp(km->idname, "File")==0)
+			else if (strcmp(km->idname, "File") == 0)
 				strcpy(km->idname, "File Browser");
-			else if (strcmp(km->idname, "FileMain")==0)
+			else if (strcmp(km->idname, "FileMain") == 0)
 				strcpy(km->idname, "File Browser Main");
-			else if (strcmp(km->idname, "FileButtons")==0)
+			else if (strcmp(km->idname, "FileButtons") == 0)
 				strcpy(km->idname, "File Browser Buttons");
-			else if (strcmp(km->idname, "Buttons Generic")==0)
+			else if (strcmp(km->idname, "Buttons Generic") == 0)
 				strcpy(km->idname, "Property Editor");
 		}
 	}
 	if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 16)) {
-		if(U.wmdrawmethod == USER_DRAW_TRIPLE)
+		if (U.wmdrawmethod == USER_DRAW_TRIPLE)
 			U.wmdrawmethod = USER_DRAW_AUTOMATIC;
 	}
 	
@@ -1567,46 +1578,46 @@ void init_userdef_do_versions(void)
 		U.keyhandles_new = HD_AUTO;
 		
 		/* init new curve colors */
-		for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 			/* init colors used for handles in 3D-View  */
-			SETCOL(btheme->tv3d.handle_free, 0, 0, 0, 255);
-			SETCOL(btheme->tv3d.handle_auto, 0x90, 0x90, 0x00, 255);
-			SETCOL(btheme->tv3d.handle_vect, 0x40, 0x90, 0x30, 255);
-			SETCOL(btheme->tv3d.handle_align, 0x80, 0x30, 0x60, 255);
-			SETCOL(btheme->tv3d.handle_sel_free, 0, 0, 0, 255);
-			SETCOL(btheme->tv3d.handle_sel_auto, 0xf0, 0xff, 0x40, 255);
-			SETCOL(btheme->tv3d.handle_sel_vect, 0x40, 0xc0, 0x30, 255);
-			SETCOL(btheme->tv3d.handle_sel_align, 0xf0, 0x90, 0xa0, 255);
-			SETCOL(btheme->tv3d.act_spline, 0xdb, 0x25, 0x12, 255);
+			rgba_char_args_set(btheme->tv3d.handle_free, 0, 0, 0, 255);
+			rgba_char_args_set(btheme->tv3d.handle_auto, 0x90, 0x90, 0x00, 255);
+			rgba_char_args_set(btheme->tv3d.handle_vect, 0x40, 0x90, 0x30, 255);
+			rgba_char_args_set(btheme->tv3d.handle_align, 0x80, 0x30, 0x60, 255);
+			rgba_char_args_set(btheme->tv3d.handle_sel_free, 0, 0, 0, 255);
+			rgba_char_args_set(btheme->tv3d.handle_sel_auto, 0xf0, 0xff, 0x40, 255);
+			rgba_char_args_set(btheme->tv3d.handle_sel_vect, 0x40, 0xc0, 0x30, 255);
+			rgba_char_args_set(btheme->tv3d.handle_sel_align, 0xf0, 0x90, 0xa0, 255);
+			rgba_char_args_set(btheme->tv3d.act_spline, 0xdb, 0x25, 0x12, 255);
 			
 			/* same colors again for Graph Editor... */
-			SETCOL(btheme->tipo.handle_free, 0, 0, 0, 255);
-			SETCOL(btheme->tipo.handle_auto, 0x90, 0x90, 0x00, 255);
-			SETCOL(btheme->tipo.handle_vect, 0x40, 0x90, 0x30, 255);
-			SETCOL(btheme->tipo.handle_align, 0x80, 0x30, 0x60, 255);
-			SETCOL(btheme->tipo.handle_sel_free, 0, 0, 0, 255);
-			SETCOL(btheme->tipo.handle_sel_auto, 0xf0, 0xff, 0x40, 255);
-			SETCOL(btheme->tipo.handle_sel_vect, 0x40, 0xc0, 0x30, 255);
-			SETCOL(btheme->tipo.handle_sel_align, 0xf0, 0x90, 0xa0, 255);
+			rgba_char_args_set(btheme->tipo.handle_free, 0, 0, 0, 255);
+			rgba_char_args_set(btheme->tipo.handle_auto, 0x90, 0x90, 0x00, 255);
+			rgba_char_args_set(btheme->tipo.handle_vect, 0x40, 0x90, 0x30, 255);
+			rgba_char_args_set(btheme->tipo.handle_align, 0x80, 0x30, 0x60, 255);
+			rgba_char_args_set(btheme->tipo.handle_sel_free, 0, 0, 0, 255);
+			rgba_char_args_set(btheme->tipo.handle_sel_auto, 0xf0, 0xff, 0x40, 255);
+			rgba_char_args_set(btheme->tipo.handle_sel_vect, 0x40, 0xc0, 0x30, 255);
+			rgba_char_args_set(btheme->tipo.handle_sel_align, 0xf0, 0x90, 0xa0, 255);
 			
 			/* edge crease */
-			SETCOLF(btheme->tv3d.edge_crease, 0.8, 0, 0.6, 1.0);
+			rgba_char_args_set_fl(btheme->tv3d.edge_crease, 0.8, 0, 0.6, 1.0);
 		}
 	}
 	if (bmain->versionfile <= 252) {
 		bTheme *btheme;
 
 		/* init new curve colors */
-		for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 			if (btheme->tv3d.lastsel_point[3] == 0)
-				SETCOL(btheme->tv3d.lastsel_point, 0xff, 0xff, 0xff, 255);
+				rgba_char_args_set(btheme->tv3d.lastsel_point, 0xff, 0xff, 0xff, 255);
 		}
 	}
 	if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 5)) {
 		bTheme *btheme;
 		
 		/* interface_widgets.c */
-		struct uiWidgetColors wcol_progress= {
+		struct uiWidgetColors wcol_progress = {
 			{0, 0, 0, 255},
 			{190, 190, 190, 255},
 			{100, 100, 100, 180},
@@ -1619,25 +1630,25 @@ void init_userdef_do_versions(void)
 			5, -5
 		};
 		
-		for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 			/* init progress bar theme */
-			btheme->tui.wcol_progress= wcol_progress;
+			btheme->tui.wcol_progress = wcol_progress;
 		}
 	}
 
 	if (bmain->versionfile < 255 || (bmain->versionfile == 255 && bmain->subversionfile < 2)) {
 		bTheme *btheme;
-		for(btheme= U.themes.first; btheme; btheme= btheme->next) {
-			SETCOL(btheme->tv3d.extra_edge_len, 32, 0, 0, 255);
-			SETCOL(btheme->tv3d.extra_face_angle, 0, 32, 0, 255);
-			SETCOL(btheme->tv3d.extra_face_area, 0, 0, 128, 255);
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
+			rgba_char_args_set(btheme->tv3d.extra_edge_len, 32, 0, 0, 255);
+			rgba_char_args_set(btheme->tv3d.extra_face_angle, 0, 32, 0, 255);
+			rgba_char_args_set(btheme->tv3d.extra_face_area, 0, 0, 128, 255);
 		}
 	}
 	
 	if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 4)) {
 		bTheme *btheme;
-		for(btheme= U.themes.first; btheme; btheme= btheme->next) {
-			if((btheme->tv3d.outline_width) == 0) btheme->tv3d.outline_width= 1;
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
+			if ((btheme->tv3d.outline_width) == 0) btheme->tv3d.outline_width = 1;
 		}
 	}
 
@@ -1648,7 +1659,7 @@ void init_userdef_do_versions(void)
 
 	if (bmain->versionfile < 258 || (bmain->versionfile == 258 && bmain->subversionfile < 2)) {
 		bTheme *btheme;
-		for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 			btheme->tnode.noodle_curving = 5;
 		}
 	}
@@ -1656,7 +1667,7 @@ void init_userdef_do_versions(void)
 	if (bmain->versionfile < 259 || (bmain->versionfile == 259 && bmain->subversionfile < 1)) {
 		bTheme *btheme;
 		
-		for(btheme= U.themes.first; btheme; btheme= btheme->next) {
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
 			btheme->tv3d.speaker[3] = 255;
 		}
 	}
@@ -1670,41 +1681,41 @@ void init_userdef_do_versions(void)
 		if (U.keyhandles_new == HD_AUTO) 
 			U.keyhandles_new = HD_AUTO_ANIM;
 		
-		for(btheme= U.themes.first; btheme; btheme= btheme->next) {		
-			if(btheme->tv3d.bundle_solid[3] == 0)
-				SETCOL(btheme->tv3d.bundle_solid, 200, 200, 200, 255);
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
+			if (btheme->tv3d.bundle_solid[3] == 0)
+				rgba_char_args_set(btheme->tv3d.bundle_solid, 200, 200, 200, 255);
 			
-			if(btheme->tv3d.camera_path[3] == 0)
-				SETCOL(btheme->tv3d.camera_path, 0x00, 0x00, 0x00, 255);
+			if (btheme->tv3d.camera_path[3] == 0)
+				rgba_char_args_set(btheme->tv3d.camera_path, 0x00, 0x00, 0x00, 255);
 				
-			if((btheme->tclip.back[3]) == 0) {
-				btheme->tclip= btheme->tv3d;
+			if ((btheme->tclip.back[3]) == 0) {
+				btheme->tclip = btheme->tv3d;
 				
-				SETCOL(btheme->tclip.marker_outline, 0x00, 0x00, 0x00, 255);
-				SETCOL(btheme->tclip.marker, 0x7f, 0x7f, 0x00, 255);
-				SETCOL(btheme->tclip.act_marker, 0xff, 0xff, 0xff, 255);
-				SETCOL(btheme->tclip.sel_marker, 0xff, 0xff, 0x00, 255);
-				SETCOL(btheme->tclip.dis_marker, 0x7f, 0x00, 0x00, 255);
-				SETCOL(btheme->tclip.lock_marker, 0x7f, 0x7f, 0x7f, 255);
-				SETCOL(btheme->tclip.path_before, 0xff, 0x00, 0x00, 255);
-				SETCOL(btheme->tclip.path_after, 0x00, 0x00, 0xff, 255);
-				SETCOL(btheme->tclip.grid, 0x5e, 0x5e, 0x5e, 255);
-				SETCOL(btheme->tclip.cframe, 0x60, 0xc0, 0x40, 255);
-				SETCOL(btheme->tclip.handle_vertex, 0x00, 0x00, 0x00, 0xff);
-				SETCOL(btheme->tclip.handle_vertex_select, 0xff, 0xff, 0, 0xff);
-				btheme->tclip.handle_vertex_size= 4;
+				rgba_char_args_set(btheme->tclip.marker_outline, 0x00, 0x00, 0x00, 255);
+				rgba_char_args_set(btheme->tclip.marker, 0x7f, 0x7f, 0x00, 255);
+				rgba_char_args_set(btheme->tclip.act_marker, 0xff, 0xff, 0xff, 255);
+				rgba_char_args_set(btheme->tclip.sel_marker, 0xff, 0xff, 0x00, 255);
+				rgba_char_args_set(btheme->tclip.dis_marker, 0x7f, 0x00, 0x00, 255);
+				rgba_char_args_set(btheme->tclip.lock_marker, 0x7f, 0x7f, 0x7f, 255);
+				rgba_char_args_set(btheme->tclip.path_before, 0xff, 0x00, 0x00, 255);
+				rgba_char_args_set(btheme->tclip.path_after, 0x00, 0x00, 0xff, 255);
+				rgba_char_args_set(btheme->tclip.grid, 0x5e, 0x5e, 0x5e, 255);
+				rgba_char_args_set(btheme->tclip.cframe, 0x60, 0xc0, 0x40, 255);
+				rgba_char_args_set(btheme->tclip.handle_vertex, 0x00, 0x00, 0x00, 0xff);
+				rgba_char_args_set(btheme->tclip.handle_vertex_select, 0xff, 0xff, 0, 0xff);
+				btheme->tclip.handle_vertex_size = 4;
 			}
 			
 			/* auto-clamped handles -> based on auto */
-			if(btheme->tipo.handle_auto_clamped[3] == 0)
-				SETCOL(btheme->tipo.handle_auto_clamped, 0x99, 0x40, 0x30, 255);
-			if(btheme->tipo.handle_sel_auto_clamped[3] == 0)
-				SETCOL(btheme->tipo.handle_sel_auto_clamped, 0xf0, 0xaf, 0x90, 255);
+			if (btheme->tipo.handle_auto_clamped[3] == 0)
+				rgba_char_args_set(btheme->tipo.handle_auto_clamped, 0x99, 0x40, 0x30, 255);
+			if (btheme->tipo.handle_sel_auto_clamped[3] == 0)
+				rgba_char_args_set(btheme->tipo.handle_sel_auto_clamped, 0xf0, 0xaf, 0x90, 255);
 		}
 		
 		/* enable (Cycles) addon by default */
-		if(!BLI_findstring(&U.addons, "cycles", offsetof(bAddon, module))) {
-			bAddon *baddon= MEM_callocN(sizeof(bAddon), "bAddon");
+		if (!BLI_findstring(&U.addons, "cycles", offsetof(bAddon, module))) {
+			bAddon *baddon = MEM_callocN(sizeof(bAddon), "bAddon");
 			BLI_strncpy(baddon->module, "cycles", sizeof(baddon->module));
 			BLI_addtail(&U.addons, baddon);
 		}
@@ -1713,29 +1724,58 @@ void init_userdef_do_versions(void)
 	if (bmain->versionfile < 260 || (bmain->versionfile == 260 && bmain->subversionfile < 5)) {
 		bTheme *btheme;
 		
-		for(btheme= U.themes.first; btheme; btheme= btheme->next) {
-			SETCOL(btheme->tui.panel.header, 0, 0, 0, 25);
-			btheme->tui.icon_alpha= 1.0;
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
+			rgba_char_args_set(btheme->tui.panel.header, 0, 0, 0, 25);
+			btheme->tui.icon_alpha = 1.0;
 		}
 	}
 	
 	if (bmain->versionfile < 261 || (bmain->versionfile == 261 && bmain->subversionfile < 4)) {
 		bTheme *btheme;
-		for(btheme= U.themes.first; btheme; btheme= btheme->next) {
-			SETCOLF(btheme->tima.preview_stitch_face, 0.071, 0.259, 0.694, 0.150);
-			SETCOLF(btheme->tima.preview_stitch_edge, 1.0, 0.522, 0.0, 0.7);
-			SETCOLF(btheme->tima.preview_stitch_vert, 1.0, 0.522, 0.0, 0.5);
-			SETCOLF(btheme->tima.preview_stitch_stitchable, 0.0, 1.0, 0.0, 1.0);
-			SETCOLF(btheme->tima.preview_stitch_unstitchable, 1.0, 0.0, 0.0, 1.0);
-			SETCOLF(btheme->tima.preview_stitch_active, 0.886, 0.824, 0.765, 0.140);
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
+			rgba_char_args_set_fl(btheme->tima.preview_stitch_face, 0.071, 0.259, 0.694, 0.150);
+			rgba_char_args_set_fl(btheme->tima.preview_stitch_edge, 1.0, 0.522, 0.0, 0.7);
+			rgba_char_args_set_fl(btheme->tima.preview_stitch_vert, 1.0, 0.522, 0.0, 0.5);
+			rgba_char_args_set_fl(btheme->tima.preview_stitch_stitchable, 0.0, 1.0, 0.0, 1.0);
+			rgba_char_args_set_fl(btheme->tima.preview_stitch_unstitchable, 1.0, 0.0, 0.0, 1.0);
+			rgba_char_args_set_fl(btheme->tima.preview_stitch_active, 0.886, 0.824, 0.765, 0.140);
 			
-			SETCOLF(btheme->toops.match, 0.2, 0.5, 0.2, 0.3);
-			SETCOLF(btheme->toops.selected_highlight, 0.51, 0.53, 0.55, 0.3);
+			rgba_char_args_set_fl(btheme->toops.match, 0.2, 0.5, 0.2, 0.3);
+			rgba_char_args_set_fl(btheme->toops.selected_highlight, 0.51, 0.53, 0.55, 0.3);
 		}
 		
 		U.use_16bit_textures = 1;
 	}
 
+	if (bmain->versionfile < 262 || (bmain->versionfile == 262 && bmain->subversionfile < 2)) {
+		bTheme *btheme;
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
+			if (btheme->tui.wcol_menu_item.item[3] == 255)
+				rgba_char_args_set(btheme->tui.wcol_menu_item.item, 172, 172, 172, 128);
+		}
+	}
+
+	if (bmain->versionfile < 262 || (bmain->versionfile == 262 && bmain->subversionfile < 3)) {
+		bTheme *btheme;
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
+			if (btheme->tui.wcol_tooltip.inner[3] == 0) {
+				btheme->tui.wcol_tooltip = btheme->tui.wcol_menu_back;
+			}
+			if (btheme->tui.wcol_tooltip.text[0] == 160) { /* hrmf */
+				rgba_char_args_set(btheme->tui.wcol_tooltip.text, 255, 255, 255, 255);
+			}
+		}
+	}
+
+	if (bmain->versionfile < 262 || (bmain->versionfile == 262 && bmain->subversionfile < 4)) {
+		bTheme *btheme;
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
+			if (btheme->tseq.movieclip[0] == 0) {
+				rgba_char_args_set(btheme->tseq.movieclip,  32, 32, 143, 255);
+			}
+		}
+	}
+
 	/* GL Texture Garbage Collection (variable abused above!) */
 	if (U.textimeout == 0) {
 		U.texcollectrate = 60;
@@ -1751,29 +1791,29 @@ void init_userdef_do_versions(void)
 		U.dbl_click_time = 350;
 	}
 	if (U.anim_player_preset == 0) {
-		U.anim_player_preset = 1 ;
+		U.anim_player_preset = 1;
 	}
 	if (U.scrcastfps == 0) {
 		U.scrcastfps = 10;
 		U.scrcastwait = 50;
 	}
 	if (U.v2d_min_gridsize == 0) {
-		U.v2d_min_gridsize= 35;
+		U.v2d_min_gridsize = 35;
 	}
-	if (U.dragthreshold == 0 )
-		U.dragthreshold= 5;
-	if (U.widget_unit==0)
-		U.widget_unit= (U.dpi * 20 + 36)/72;
+	if (U.dragthreshold == 0)
+		U.dragthreshold = 5;
+	if (U.widget_unit == 0)
+		U.widget_unit = (U.dpi * 20 + 36) / 72;
 	if (U.anisotropic_filter <= 0)
 		U.anisotropic_filter = 1;
 
 	if (U.ndof_sensitivity == 0.0f) {
 		U.ndof_sensitivity = 1.0f;
 		U.ndof_flag = NDOF_LOCK_HORIZON |
-			NDOF_SHOULD_PAN | NDOF_SHOULD_ZOOM | NDOF_SHOULD_ROTATE;
+		              NDOF_SHOULD_PAN | NDOF_SHOULD_ZOOM | NDOF_SHOULD_ROTATE;
 	}
-	if (U.tweak_threshold == 0 )
-		U.tweak_threshold= 10;
+	if (U.tweak_threshold == 0)
+		U.tweak_threshold = 10;
 
 	/* funny name, but it is GE stuff, moves userdef stuff to engine */
 // XXX	space_set_commmandline_options();
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 3eb8aba..ed010dc 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -66,16 +66,16 @@
 /* XXX there's V2D_SCROLL_HORIZONTAL_HIDE and V2D_SCROLL_HORIZONTAL_FULLR ... */
 
 /* helper to allow scrollbars to dynamically hide
- * 	- returns a copy of the scrollbar settings with the flags to display 
+ *  - returns a copy of the scrollbar settings with the flags to display
  *	  horizontal/vertical scrollbars removed
  *	- input scroll value is the v2d->scroll var
  *	- hide flags are set per region at drawtime
  */
 static int view2d_scroll_mapped(int scroll)
 {
-	if(scroll & V2D_SCROLL_HORIZONTAL_HIDE)
+	if (scroll & V2D_SCROLL_HORIZONTAL_HIDE)
 		scroll &= ~(V2D_SCROLL_HORIZONTAL);
-	if(scroll & V2D_SCROLL_VERTICAL_HIDE)
+	if (scroll & V2D_SCROLL_VERTICAL_HIDE)
 		scroll &= ~(V2D_SCROLL_VERTICAL);
 	return scroll;
 }
@@ -86,24 +86,24 @@ static void view2d_masks(View2D *v2d)
 	int scroll;
 	
 	/* mask - view frame */
-	v2d->mask.xmin= v2d->mask.ymin= 0;
-	v2d->mask.xmax= v2d->winx - 1;	/* -1 yes! masks are pixels */
-	v2d->mask.ymax= v2d->winy - 1;
+	v2d->mask.xmin = v2d->mask.ymin = 0;
+	v2d->mask.xmax = v2d->winx - 1; /* -1 yes! masks are pixels */
+	v2d->mask.ymax = v2d->winy - 1;
 
 #if 0
 	// XXX see above
-	v2d->scroll &= ~(V2D_SCROLL_HORIZONTAL_HIDE|V2D_SCROLL_VERTICAL_HIDE);
+	v2d->scroll &= ~(V2D_SCROLL_HORIZONTAL_HIDE | V2D_SCROLL_VERTICAL_HIDE);
 	/* check size if: */
 	if (v2d->scroll & V2D_SCROLL_HORIZONTAL)
-		if(!(v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL))
-			if (v2d->tot.xmax-v2d->tot.xmin <= v2d->cur.xmax-v2d->cur.xmin)
+		if (!(v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL))
+			if (v2d->tot.xmax - v2d->tot.xmin <= v2d->cur.xmax - v2d->cur.xmin)
 				v2d->scroll |= V2D_SCROLL_HORIZONTAL_HIDE;
 	if (v2d->scroll & V2D_SCROLL_VERTICAL)
-		if(!(v2d->scroll & V2D_SCROLL_SCALE_VERTICAL))
-			if (v2d->tot.ymax-v2d->tot.ymin <= v2d->cur.ymax-v2d->cur.ymin)
+		if (!(v2d->scroll & V2D_SCROLL_SCALE_VERTICAL))
+			if (v2d->tot.ymax - v2d->tot.ymin <= v2d->cur.ymax - v2d->cur.ymin)
 				v2d->scroll |= V2D_SCROLL_VERTICAL_HIDE;
 #endif
-	scroll= view2d_scroll_mapped(v2d->scroll);
+	scroll = view2d_scroll_mapped(v2d->scroll);
 	
 	/* scrollers shrink mask area, but should be based off regionsize 
 	 *	- they can only be on one to two edges of the region they define
@@ -113,42 +113,42 @@ static void view2d_masks(View2D *v2d)
 		/* vertical scroller */
 		if (scroll & V2D_SCROLL_LEFT) {
 			/* on left-hand edge of region */
-			v2d->vert= v2d->mask;
-			v2d->vert.xmax= V2D_SCROLL_WIDTH;
-			v2d->mask.xmin= v2d->vert.xmax + 1;
+			v2d->vert = v2d->mask;
+			v2d->vert.xmax = V2D_SCROLL_WIDTH;
+			v2d->mask.xmin = v2d->vert.xmax + 1;
 		}
 		else if (scroll & V2D_SCROLL_RIGHT) {
 			/* on right-hand edge of region */
-			v2d->vert= v2d->mask;
+			v2d->vert = v2d->mask;
 			v2d->vert.xmax++; /* one pixel extra... was leaving a minor gap... */
-			v2d->vert.xmin= v2d->vert.xmax - V2D_SCROLL_WIDTH;
-			v2d->mask.xmax= v2d->vert.xmin - 1;
+			v2d->vert.xmin = v2d->vert.xmax - V2D_SCROLL_WIDTH;
+			v2d->mask.xmax = v2d->vert.xmin - 1;
 		}
 		
 		/* horizontal scroller */
-		if (scroll & (V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O)) {
+		if (scroll & (V2D_SCROLL_BOTTOM | V2D_SCROLL_BOTTOM_O)) {
 			/* on bottom edge of region (V2D_SCROLL_BOTTOM_O is outliner, the other is for standard) */
-			v2d->hor= v2d->mask;
-			v2d->hor.ymax= V2D_SCROLL_HEIGHT;
-			v2d->mask.ymin= v2d->hor.ymax + 1;
+			v2d->hor = v2d->mask;
+			v2d->hor.ymax = V2D_SCROLL_HEIGHT;
+			v2d->mask.ymin = v2d->hor.ymax + 1;
 		}
 		else if (scroll & V2D_SCROLL_TOP) {
 			/* on upper edge of region */
-			v2d->hor= v2d->mask;
-			v2d->hor.ymin= v2d->hor.ymax - V2D_SCROLL_HEIGHT;
-			v2d->mask.ymax= v2d->hor.ymin - 1;
+			v2d->hor = v2d->mask;
+			v2d->hor.ymin = v2d->hor.ymax - V2D_SCROLL_HEIGHT;
+			v2d->mask.ymax = v2d->hor.ymin - 1;
 		}
 		
 		/* adjust vertical scroller if there's a horizontal scroller, to leave corner free */
 		if (scroll & V2D_SCROLL_VERTICAL) {
 			/* just set y min/max for vertical scroller to y min/max of mask as appropriate */
-			if (scroll & (V2D_SCROLL_BOTTOM|V2D_SCROLL_BOTTOM_O)) {
+			if (scroll & (V2D_SCROLL_BOTTOM | V2D_SCROLL_BOTTOM_O)) {
 				/* on bottom edge of region (V2D_SCROLL_BOTTOM_O is outliner, the other is for standard) */
-				v2d->vert.ymin= v2d->mask.ymin;
+				v2d->vert.ymin = v2d->mask.ymin;
 			}
 			else if (scroll & V2D_SCROLL_TOP) {
 				/* on upper edge of region */
-				v2d->vert.ymax= v2d->mask.ymax;
+				v2d->vert.ymax = v2d->mask.ymax;
 			}
 		}
 	}
@@ -157,146 +157,146 @@ static void view2d_masks(View2D *v2d)
 
 /* Refresh and Validation */
 
-/* Initialise all relevant View2D data (including view rects if first time) and/or refresh mask sizes after view resize
+/* Initialize all relevant View2D data (including view rects if first time) and/or refresh mask sizes after view resize
  *	- for some of these presets, it is expected that the region will have defined some
- * 	  additional settings necessary for the customisation of the 2D viewport to its requirements
+ *    additional settings necessary for the customization of the 2D viewport to its requirements
  *	- this function should only be called from region init() callbacks, where it is expected that
- *	  this is called before UI_view2d_size_update(), as this one checks that the rects are properly initialised. 
+ *	  this is called before UI_view2d_size_update(), as this one checks that the rects are properly initialized. 
  */
 void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
 {
-	short tot_changed= 0, init= 0;
-	uiStyle *style= UI_GetStyle();
+	short tot_changed = 0, init = 0;
+	uiStyle *style = UI_GetStyle();
 
-	/* initialise data if there is a need for such */
+	/* initialize data if there is a need for such */
 	if ((v2d->flag & V2D_IS_INITIALISED) == 0) {
-		/* set initialised flag so that View2D doesn't get reinitialised next time again */
+		/* set initialized flag so that View2D doesn't get reinitialised next time again */
 		v2d->flag |= V2D_IS_INITIALISED;
 
-		init= 1;
+		init = 1;
 		
 		/* see eView2D_CommonViewTypes in UI_view2d.h for available view presets */
 		switch (type) {
-			/* 'standard view' - optimum setup for 'standard' view behaviour,
+			/* 'standard view' - optimum setup for 'standard' view behavior,
 			 *  that should be used new views as basis for their
-			 * 	own unique View2D settings, which should be used instead of this in most cases...
+			 *  own unique View2D settings, which should be used instead of this in most cases...
 			 */
 			case V2D_COMMONVIEW_STANDARD:
 			{
 				/* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */
-				v2d->keepzoom= (V2D_KEEPASPECT|V2D_LIMITZOOM);
-				v2d->minzoom= 0.01f;
-				v2d->maxzoom= 1000.0f;
+				v2d->keepzoom = (V2D_KEEPASPECT | V2D_LIMITZOOM);
+				v2d->minzoom = 0.01f;
+				v2d->maxzoom = 1000.0f;
 				
 				/* tot rect and cur should be same size, and aligned using 'standard' OpenGL coordinates for now 
 				 *	- region can resize 'tot' later to fit other data
 				 *	- keeptot is only within bounds, as strict locking is not that critical
 				 *	- view is aligned for (0,0) -> (winx-1, winy-1) setup
 				 */
-				v2d->align= (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y);
-				v2d->keeptot= V2D_KEEPTOT_BOUNDS;
+				v2d->align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y);
+				v2d->keeptot = V2D_KEEPTOT_BOUNDS;
 				
-				v2d->tot.xmin= v2d->tot.ymin= 0.0f;
-				v2d->tot.xmax= (float)(winx - 1);
-				v2d->tot.ymax= (float)(winy - 1);
+				v2d->tot.xmin = v2d->tot.ymin = 0.0f;
+				v2d->tot.xmax = (float)(winx - 1);
+				v2d->tot.ymax = (float)(winy - 1);
 				
-				v2d->cur= v2d->tot;
+				v2d->cur = v2d->tot;
 				
 				/* scrollers - should we have these by default? */
 				// XXX for now, we don't override this, or set it either!
 			}
-				break;
+			break;
 			
 			/* 'list/channel view' - zoom, aspect ratio, and alignment restrictions are set here */
 			case V2D_COMMONVIEW_LIST:
 			{
 				/* zoom + aspect ratio are locked */
-				v2d->keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_LIMITZOOM|V2D_KEEPASPECT);
-				v2d->minzoom= v2d->maxzoom= 1.0f;
+				v2d->keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
+				v2d->minzoom = v2d->maxzoom = 1.0f;
 				
 				/* tot rect has strictly regulated placement, and must only occur in +/- quadrant */
-				v2d->align = (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y);
+				v2d->align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y);
 				v2d->keeptot = V2D_KEEPTOT_STRICT;
-				tot_changed= 1;
+				tot_changed = 1;
 				
 				/* scroller settings are currently not set here... that is left for regions... */
 			}
-				break;
+			break;
 				
 			/* 'stack view' - practically the same as list/channel view, except is located in the pos y half instead. 
-			 * 	zoom, aspect ratio, and alignment restrictions are set here */
+			 *  zoom, aspect ratio, and alignment restrictions are set here */
 			case V2D_COMMONVIEW_STACK:
 			{
 				/* zoom + aspect ratio are locked */
-				v2d->keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_LIMITZOOM|V2D_KEEPASPECT);
-				v2d->minzoom= v2d->maxzoom= 1.0f;
+				v2d->keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
+				v2d->minzoom = v2d->maxzoom = 1.0f;
 				
 				/* tot rect has strictly regulated placement, and must only occur in +/+ quadrant */
-				v2d->align = (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y);
+				v2d->align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y);
 				v2d->keeptot = V2D_KEEPTOT_STRICT;
-				tot_changed= 1;
+				tot_changed = 1;
 				
 				/* scroller settings are currently not set here... that is left for regions... */
 			}
-				break;
+			break;
 				
 			/* 'header' regions - zoom, aspect ratio, alignment, and panning restrictions are set here */
 			case V2D_COMMONVIEW_HEADER:
 			{
 				/* zoom + aspect ratio are locked */
-				v2d->keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_LIMITZOOM|V2D_KEEPASPECT);
-				v2d->minzoom= v2d->maxzoom= 1.0f;
-				v2d->min[0]= v2d->max[0]= (float)(winx-1);
-				v2d->min[1]= v2d->max[1]= (float)(winy-1);
+				v2d->keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
+				v2d->minzoom = v2d->maxzoom = 1.0f;
+				v2d->min[0] = v2d->max[0] = (float)(winx - 1);
+				v2d->min[1] = v2d->max[1] = (float)(winy - 1);
 				
 				/* tot rect has strictly regulated placement, and must only occur in +/+ quadrant */
-				v2d->align = (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y);
+				v2d->align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y);
 				v2d->keeptot = V2D_KEEPTOT_STRICT;
-				tot_changed= 1;
+				tot_changed = 1;
 				
 				/* panning in y-axis is prohibited */
-				v2d->keepofs= V2D_LOCKOFS_Y;
+				v2d->keepofs = V2D_LOCKOFS_Y;
 				
 				/* absolutely no scrollers allowed */
-				v2d->scroll= 0;
+				v2d->scroll = 0;
 				
 			}
-				break;
+			break;
 			
 			/* panels view, with horizontal/vertical align */
 			case V2D_COMMONVIEW_PANELS_UI:
 			{
-				float panelzoom= (style) ? style->panelzoom : 1.0f;
+				float panelzoom = (style) ? style->panelzoom : 1.0f;
 				
 				/* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */
-				v2d->keepzoom= (V2D_KEEPASPECT|V2D_LIMITZOOM|V2D_KEEPZOOM);
-				v2d->minzoom= 0.5f;
-				v2d->maxzoom= 2.0f;
+				v2d->keepzoom = (V2D_KEEPASPECT | V2D_LIMITZOOM | V2D_KEEPZOOM);
+				v2d->minzoom = 0.5f;
+				v2d->maxzoom = 2.0f;
 				//tot_changed= 1;
 				
-				v2d->align= (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y);
-				v2d->keeptot= V2D_KEEPTOT_BOUNDS;
+				v2d->align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y);
+				v2d->keeptot = V2D_KEEPTOT_BOUNDS;
 				
-				v2d->scroll |= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
+				v2d->scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
 				v2d->scroll |= V2D_SCROLL_HORIZONTAL_HIDE;
 				v2d->scroll &= ~V2D_SCROLL_VERTICAL_HIDE;
 
-				v2d->tot.xmin= 0.0f;
-				v2d->tot.xmax= winx;
+				v2d->tot.xmin = 0.0f;
+				v2d->tot.xmax = winx;
 				
-				v2d->tot.ymax= 0.0f;
-				v2d->tot.ymin= -winy;
+				v2d->tot.ymax = 0.0f;
+				v2d->tot.ymin = -winy;
 				
-				v2d->cur.xmin= 0.0f;
+				v2d->cur.xmin = 0.0f;
 				/* bad workaround for keeping zoom level with scrollers */
-				v2d->cur.xmax= (winx - V2D_SCROLL_WIDTH)*panelzoom;
+				v2d->cur.xmax = (winx - V2D_SCROLL_WIDTH) * panelzoom;
 				
-				v2d->cur.ymax= 0.0f;
-				v2d->cur.ymin= (-winy)*panelzoom;
+				v2d->cur.ymax = 0.0f;
+				v2d->cur.ymin = (-winy) * panelzoom;
 			}
-				break;
+			break;
 				
-				/* other view types are completely defined using their own settings already */
+			/* 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;	
@@ -304,8 +304,8 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy)
 	}
 	
 	/* store view size */
-	v2d->winx= winx;
-	v2d->winy= winy;
+	v2d->winx = winx;
+	v2d->winy = winy;
 	
 	/* set masks */
 	view2d_masks(v2d);
@@ -328,12 +328,12 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
 	rctf *cur, *tot;
 	
 	/* use mask as size of region that View2D resides in, as it takes into account scrollbars already  */
-	winx= (float)(v2d->mask.xmax - v2d->mask.xmin + 1);
-	winy= (float)(v2d->mask.ymax - v2d->mask.ymin + 1);
+	winx = (float)(v2d->mask.xmax - v2d->mask.xmin + 1);
+	winy = (float)(v2d->mask.ymax - v2d->mask.ymin + 1);
 	
 	/* get pointers to rcts for less typing */
-	cur= &v2d->cur;
-	tot= &v2d->tot;
+	cur = &v2d->cur;
+	tot = &v2d->tot;
 	
 	/* we must satisfy the following constraints (in decreasing order of importance):
 	 *	- alignment restrictions are respected
@@ -347,44 +347,44 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
 	 *	- firstly, we calculate the sizes of the rects
 	 *	- curwidth and curheight are saved as reference... modify width and height values here
 	 */
-	totwidth= tot->xmax - tot->xmin;
-	totheight= tot->ymax - tot->ymin;
-	curwidth= width= cur->xmax - cur->xmin;
-	curheight= height= cur->ymax - cur->ymin;
+	totwidth = tot->xmax - tot->xmin;
+	totheight = tot->ymax - tot->ymin;
+	curwidth = width = cur->xmax - cur->xmin;
+	curheight = height = cur->ymax - cur->ymin;
 	
 	/* if zoom is locked, size on the appropriate axis is reset to mask size */
 	if (v2d->keepzoom & V2D_LOCKZOOM_X)
-		width= winx;
+		width = winx;
 	if (v2d->keepzoom & V2D_LOCKZOOM_Y)
-		height= winy;
+		height = winy;
 		
 	/* values used to divide, so make it safe 
 	 * NOTE: width and height must use FLT_MIN instead of 1, otherwise it is impossible to
-	 * 		get enough resolution in Graph Editor for editing some curves
+	 *       get enough resolution in Graph Editor for editing some curves
 	 */
-	if(width < FLT_MIN) width= 1;
-	if(height < FLT_MIN) height= 1;
-	if(winx < 1) winx= 1;
-	if(winy < 1) winy= 1;
+	if (width < FLT_MIN) width = 1;
+	if (height < FLT_MIN) height = 1;
+	if (winx < 1) winx = 1;
+	if (winy < 1) winy = 1;
 	
 	/* V2D_LIMITZOOM indicates that zoom level should be preserved when the window size changes */
 	if (resize && (v2d->keepzoom & V2D_KEEPZOOM)) {
 		float zoom, oldzoom;
 
-		if ((v2d->keepzoom & V2D_LOCKZOOM_X)==0) {
-			zoom= winx / width;
-			oldzoom= v2d->oldwinx / curwidth;
+		if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0) {
+			zoom = winx / width;
+			oldzoom = v2d->oldwinx / curwidth;
 
-			if(oldzoom != zoom)
-				width *= zoom/oldzoom;
+			if (oldzoom != zoom)
+				width *= zoom / oldzoom;
 		}
 
-		if ((v2d->keepzoom & V2D_LOCKZOOM_Y)==0) {
-			zoom= winy / height;
-			oldzoom= v2d->oldwiny / curheight;
+		if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0) {
+			zoom = winy / height;
+			oldzoom = v2d->oldwiny / curheight;
 
-			if(oldzoom != zoom)
-				height *= zoom/oldzoom;
+			if (oldzoom != zoom)
+				height *= zoom / oldzoom;
 		}
 	}
 	/* keepzoom (V2D_LIMITZOOM set), indicates that zoom level on each axis must not exceed limits 
@@ -394,19 +394,19 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
 		float zoom, fac;
 		
 		/* check if excessive zoom on x-axis */
-		if ((v2d->keepzoom & V2D_LOCKZOOM_X)==0) {
-			zoom= winx / width;
+		if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0) {
+			zoom = winx / width;
 			if ((zoom < v2d->minzoom) || (zoom > v2d->maxzoom)) {
-				fac= (zoom < v2d->minzoom) ? (zoom / v2d->minzoom) : (zoom / v2d->maxzoom);
+				fac = (zoom < v2d->minzoom) ? (zoom / v2d->minzoom) : (zoom / v2d->maxzoom);
 				width *= fac;
 			}
 		}
 		
 		/* check if excessive zoom on y-axis */
-		if ((v2d->keepzoom & V2D_LOCKZOOM_Y)==0) {
-			zoom= winy / height;
+		if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0) {
+			zoom = winy / height;
 			if ((zoom < v2d->minzoom) || (zoom > v2d->maxzoom)) {
-				fac= (zoom < v2d->minzoom) ? (zoom / v2d->minzoom) : (zoom / v2d->maxzoom);
+				fac = (zoom < v2d->minzoom) ? (zoom / v2d->minzoom) : (zoom / v2d->maxzoom);
 				height *= fac;
 			}
 		}
@@ -419,35 +419,35 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
 	
 	/* check if we should restore aspect ratio (if view size changed) */
 	if (v2d->keepzoom & V2D_KEEPASPECT) {
-		short do_x=0, do_y=0, do_cur /* , do_win */ /* UNUSED */;
+		short do_x = 0, do_y = 0, do_cur /* , do_win */ /* UNUSED */;
 		float /* curRatio, */ /* UNUSED */ winRatio;
 		
 		/* when a window edge changes, the aspect ratio can't be used to
 		 * find which is the best new 'cur' rect. thats why it stores 'old' 
 		 */
-		if (winx != v2d->oldwinx) do_x= 1;
-		if (winy != v2d->oldwiny) do_y= 1;
+		if (winx != v2d->oldwinx) do_x = 1;
+		if (winy != v2d->oldwiny) do_y = 1;
 		
 		/* curRatio= height / width; */ /* UNUSED */
-		winRatio= winy / winx;
+		winRatio = winy / winx;
 		
 		/* both sizes change (area/region maximised)  */
 		if (do_x == do_y) {
 			if (do_x && do_y) {
 				/* here is 1,1 case, so all others must be 0,0 */
-				if (ABS(winx - v2d->oldwinx) > ABS(winy - v2d->oldwiny)) do_y= 0;
-				else do_x= 0;
+				if (ABS(winx - v2d->oldwinx) > ABS(winy - v2d->oldwiny)) do_y = 0;
+				else do_x = 0;
 			}
-			else if (winRatio > 1.0f) do_x= 0; 
-			else do_x= 1;
+			else if (winRatio > 1.0f) do_x = 0;
+			else do_x = 1;
 		}
-		do_cur= do_x;
+		do_cur = do_x;
 		/* do_win= do_y; */ /* UNUSED */
 		
 		if (do_cur) {
 			if ((v2d->keeptot == V2D_KEEPTOT_STRICT) && (winx != v2d->oldwinx)) {
 				/* special exception for Outliner (and later channel-lists):
-				 * 	- The view may be moved left to avoid contents being pushed out of view when view shrinks. 
+				 *  - The view may be moved left to avoid contents being pushed out of view when view shrinks.
 				 *	- The keeptot code will make sure cur->xmin will not be less than tot->xmin (which cannot be allowed)
 				 *	- width is not adjusted for changed ratios here...
 				 */
@@ -464,7 +464,7 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
 			}
 			else {
 				/* portrait window: correct for x */
-				width= height / winRatio;
+				width = height / winRatio;
 			}
 		}
 		else {
@@ -488,8 +488,8 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
 		}
 		
 		/* store region size for next time */
-		v2d->oldwinx= (short)winx; 
-		v2d->oldwiny= (short)winy;
+		v2d->oldwinx = (short)winx;
+		v2d->oldwiny = (short)winy;
 	}
 	
 	/* Step 2: apply new sizes to cur rect, but need to take into account alignment settings here... */
@@ -502,14 +502,14 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
 				cur->xmax += width - (cur->xmax - cur->xmin);
 			}
 			else if (v2d->keepofs & V2D_KEEPOFS_X) {
-				if(v2d->align & V2D_ALIGN_NO_POS_X)
+				if (v2d->align & V2D_ALIGN_NO_POS_X)
 					cur->xmin -= width - (cur->xmax - cur->xmin);
 				else
 					cur->xmax += width - (cur->xmax - cur->xmin);
 			}
 			else {
-				temp= (cur->xmax + cur->xmin) * 0.5f;
-				dh= width * 0.5f;
+				temp = (cur->xmax + cur->xmin) * 0.5f;
+				dh = width * 0.5f;
 				
 				cur->xmin = temp - dh;
 				cur->xmax = temp + dh;
@@ -520,14 +520,14 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
 				cur->ymax += height - (cur->ymax - cur->ymin);
 			}
 			else if (v2d->keepofs & V2D_KEEPOFS_Y) {
-				if(v2d->align & V2D_ALIGN_NO_POS_Y)
+				if (v2d->align & V2D_ALIGN_NO_POS_Y)
 					cur->ymin -= height - (cur->ymax - cur->ymin);
 				else
 					cur->ymax += height - (cur->ymax - cur->ymin);
 			}
 			else {
-				temp= (cur->ymax + cur->ymin) * 0.5f;
-				dh= height * 0.5f;
+				temp = (cur->ymax + cur->ymin) * 0.5f;
+				dh = height * 0.5f;
 				
 				cur->ymin = temp - dh;
 				cur->ymax = temp + dh;
@@ -540,14 +540,14 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
 		float temp, diff;
 		
 		/* recalculate extents of cur */
-		curwidth= cur->xmax - cur->xmin;
-		curheight= cur->ymax - cur->ymin;
+		curwidth = cur->xmax - cur->xmin;
+		curheight = cur->ymax - cur->ymin;
 		
 		/* width */
-		if ( (curwidth > totwidth) && !(v2d->keepzoom & (V2D_KEEPZOOM|V2D_LOCKZOOM_X|V2D_LIMITZOOM)) ) {
+		if ( (curwidth > totwidth) && !(v2d->keepzoom & (V2D_KEEPZOOM | V2D_LOCKZOOM_X | V2D_LIMITZOOM)) ) {
 			/* if zoom doesn't have to be maintained, just clamp edges */
-			if (cur->xmin < tot->xmin) cur->xmin= tot->xmin;
-			if (cur->xmax > tot->xmax) cur->xmax= tot->xmax;
+			if (cur->xmin < tot->xmin) cur->xmin = tot->xmin;
+			if (cur->xmax > tot->xmax) cur->xmax = tot->xmax;
 		}
 		else if (v2d->keeptot == V2D_KEEPTOT_STRICT) {
 			/* This is an exception for the outliner (and later channel-lists, headers) 
@@ -556,21 +556,21 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
 			 */
 			if (cur->xmin < tot->xmin) {
 				/* move cur across so that it sits at minimum of tot */
-				temp= tot->xmin - cur->xmin;
+				temp = tot->xmin - cur->xmin;
 				
 				cur->xmin += temp;
 				cur->xmax += temp;
 			}
 			else if (cur->xmax > tot->xmax) {
 				/* - only offset by difference of cur-xmax and tot-xmax if that would not move 
-				 * 	cur-xmin to lie past tot-xmin
+				 *  cur-xmin to lie past tot-xmin
 				 * - otherwise, simply shift to tot-xmin???
 				 */
-				temp= cur->xmax - tot->xmax;
+				temp = cur->xmax - tot->xmax;
 				
 				if ((cur->xmin - temp) < tot->xmin) {
 					/* only offset by difference from cur-min and tot-min */
-					temp= cur->xmin - tot->xmin;
+					temp = cur->xmin - tot->xmin;
 					
 					cur->xmin -= temp;
 					cur->xmax -= temp;
@@ -583,38 +583,38 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
 		}
 		else {
 			/* This here occurs when:
-			 * 	- width too big, but maintaining zoom (i.e. widths cannot be changed)
+			 *  - width too big, but maintaining zoom (i.e. widths cannot be changed)
 			 *	- width is OK, but need to check if outside of boundaries
 			 * 
 			 * So, resolution is to just shift view by the gap between the extremities.
 			 * We favour moving the 'minimum' across, as that's origin for most things
-			 * (XXX - in the past, max was favoured... if there are bugs, swap!)
+			 * (XXX - in the past, max was favored... if there are bugs, swap!)
 			 */
 			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= (tot->xmax + tot->xmin) * 0.5f;
-				diff= curheight * 0.5f;
+				temp = (tot->xmax + tot->xmin) * 0.5f;
+				diff = curheight * 0.5f;
 				
-				cur->xmin= temp - diff;
-				cur->xmax= temp + diff;
+				cur->xmin = temp - diff;
+				cur->xmax = temp + diff;
 			}
 			else if (cur->xmin < tot->xmin) {
 				/* move cur across so that it sits at minimum of tot */
-				temp= tot->xmin - cur->xmin;
+				temp = tot->xmin - cur->xmin;
 				
 				cur->xmin += temp;
 				cur->xmax += temp;
 			}
 			else if (cur->xmax > tot->xmax) {
 				/* - only offset by difference of cur-xmax and tot-xmax if that would not move 
-				 * 	cur-xmin to lie past tot-xmin
+				 *  cur-xmin to lie past tot-xmin
 				 * - otherwise, simply shift to tot-xmin???
 				 */
-				temp= cur->xmax - tot->xmax;
+				temp = cur->xmax - tot->xmax;
 				
 				if ((cur->xmin - temp) < tot->xmin) {
 					/* only offset by difference from cur-min and tot-min */
-					temp= cur->xmin - tot->xmin;
+					temp = cur->xmin - tot->xmin;
 					
 					cur->xmin -= temp;
 					cur->xmax -= temp;
@@ -627,14 +627,14 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
 		}
 		
 		/* height */
-		if ( (curheight > totheight) && !(v2d->keepzoom & (V2D_KEEPZOOM|V2D_LOCKZOOM_Y|V2D_LIMITZOOM)) ) {
+		if ( (curheight > totheight) && !(v2d->keepzoom & (V2D_KEEPZOOM | V2D_LOCKZOOM_Y | V2D_LIMITZOOM)) ) {
 			/* if zoom doesn't have to be maintained, just clamp edges */
-			if (cur->ymin < tot->ymin) cur->ymin= tot->ymin;
-			if (cur->ymax > tot->ymax) cur->ymax= tot->ymax;
+			if (cur->ymin < tot->ymin) cur->ymin = tot->ymin;
+			if (cur->ymax > tot->ymax) cur->ymax = tot->ymax;
 		}
 		else {
 			/* This here occurs when:
-			 * 	- height too big, but maintaining zoom (i.e. heights cannot be changed)
+			 *  - height too big, but maintaining zoom (i.e. heights cannot be changed)
 			 *	- height is OK, but need to check if outside of boundaries
 			 * 
 			 * So, resolution is to just shift view by the gap between the extremities.
@@ -642,22 +642,22 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
 			 */
 			if ((cur->ymin < tot->ymin) && (cur->ymax > tot->ymax)) {
 				/* outside boundaries on both sides, so take middle-point of tot, and place in balanced way */
-				temp= (tot->ymax + tot->ymin) * 0.5f;
-				diff= curheight * 0.5f;
+				temp = (tot->ymax + tot->ymin) * 0.5f;
+				diff = curheight * 0.5f;
 				
-				cur->ymin= temp - diff;
-				cur->ymax= temp + diff;
+				cur->ymin = temp - diff;
+				cur->ymax = temp + diff;
 			}
 			else if (cur->ymin < tot->ymin) {
 				/* there's still space remaining, so shift up */
-				temp= tot->ymin - cur->ymin;
+				temp = tot->ymin - cur->ymin;
 				
 				cur->ymin += temp;
 				cur->ymax += temp;
 			}
 			else if (cur->ymax > tot->ymax) {
 				/* there's still space remaining, so shift down */
-				temp= cur->ymax - tot->ymax;
+				temp = cur->ymax - tot->ymax;
 				
 				cur->ymin -= temp;
 				cur->ymax -= temp;
@@ -680,7 +680,7 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize)
 			/* width is in negative-x half */
 			if (v2d->cur.xmax > 0) {
 				v2d->cur.xmin -= v2d->cur.xmax;
-				v2d->cur.xmax= 0.0f;
+				v2d->cur.xmax = 0.0f;
 			}
 		}
 		else if ((v2d->align & V2D_ALIGN_NO_NEG_X) && !(v2d->align & V2D_ALIGN_NO_POS_X)) {
@@ -726,25 +726,25 @@ void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag)
 	ARegion *ar;
 	
 	/* don't continue if no view syncing to be done */
-	if ((v2dcur->flag & (V2D_VIEWSYNC_SCREEN_TIME|V2D_VIEWSYNC_AREA_VERTICAL)) == 0)
+	if ((v2dcur->flag & (V2D_VIEWSYNC_SCREEN_TIME | V2D_VIEWSYNC_AREA_VERTICAL)) == 0)
 		return;
 		
 	/* check if doing within area syncing (i.e. channels/vertical) */
 	if ((v2dcur->flag & V2D_VIEWSYNC_AREA_VERTICAL) && (area)) {
-		for (ar= area->regionbase.first; ar; ar= ar->next) {
+		for (ar = area->regionbase.first; ar; ar = ar->next) {
 			/* don't operate on self */
 			if (v2dcur != &ar->v2d) {
 				/* only if view has vertical locks enabled */
 				if (ar->v2d.flag & V2D_VIEWSYNC_AREA_VERTICAL) {
 					if (flag == V2D_LOCK_COPY) {
 						/* other views with locks on must copy active */
-						ar->v2d.cur.ymin= v2dcur->cur.ymin;
-						ar->v2d.cur.ymax= v2dcur->cur.ymax;
+						ar->v2d.cur.ymin = v2dcur->cur.ymin;
+						ar->v2d.cur.ymax = v2dcur->cur.ymax;
 					}
 					else { /* V2D_LOCK_SET */
-						/* active must copy others */
-						v2dcur->cur.ymin= ar->v2d.cur.ymin;
-						v2dcur->cur.ymax= ar->v2d.cur.ymax;
+						   /* active must copy others */
+						v2dcur->cur.ymin = ar->v2d.cur.ymin;
+						v2dcur->cur.ymax = ar->v2d.cur.ymax;
 					}
 					
 					/* region possibly changed, so refresh */
@@ -756,21 +756,21 @@ void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag)
 	
 	/* check if doing whole screen syncing (i.e. time/horizontal) */
 	if ((v2dcur->flag & V2D_VIEWSYNC_SCREEN_TIME) && (screen)) {
-		for (sa= screen->areabase.first; sa; sa= sa->next) {
-			for (ar= sa->regionbase.first; ar; ar= ar->next) {
+		for (sa = screen->areabase.first; sa; sa = sa->next) {
+			for (ar = sa->regionbase.first; ar; ar = ar->next) {
 				/* don't operate on self */
 				if (v2dcur != &ar->v2d) {
 					/* only if view has horizontal locks enabled */
 					if (ar->v2d.flag & V2D_VIEWSYNC_SCREEN_TIME) {
 						if (flag == V2D_LOCK_COPY) {
 							/* other views with locks on must copy active */
-							ar->v2d.cur.xmin= v2dcur->cur.xmin;
-							ar->v2d.cur.xmax= v2dcur->cur.xmax;
+							ar->v2d.cur.xmin = v2dcur->cur.xmin;
+							ar->v2d.cur.xmax = v2dcur->cur.xmax;
 						}
 						else { /* V2D_LOCK_SET */
-							/* active must copy others */
-							v2dcur->cur.xmin= ar->v2d.cur.xmin;
-							v2dcur->cur.xmax= ar->v2d.cur.xmax;
+							   /* active must copy others */
+							v2dcur->cur.xmin = ar->v2d.cur.xmin;
+							v2dcur->cur.xmax = ar->v2d.cur.xmax;
 						}
 						
 						/* region possibly changed, so refresh */
@@ -786,113 +786,113 @@ void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag)
 /* Restore 'cur' rect to standard orientation (i.e. optimal maximum view of tot) 
  * This does not take into account if zooming the view on an axis will improve the view (if allowed)
  */
-void UI_view2d_curRect_reset (View2D *v2d)
+void UI_view2d_curRect_reset(View2D *v2d)
 {
 	float width, height;
 	
 	/* assume width and height of 'cur' rect by default, should be same size as mask */
-	width= (float)(v2d->mask.xmax - v2d->mask.xmin + 1);
-	height= (float)(v2d->mask.ymax - v2d->mask.ymin + 1);
+	width = (float)(v2d->mask.xmax - v2d->mask.xmin + 1);
+	height = (float)(v2d->mask.ymax - v2d->mask.ymin + 1);
 	
 	/* handle width - posx and negx flags are mutually exclusive, so watch out */
 	if ((v2d->align & V2D_ALIGN_NO_POS_X) && !(v2d->align & V2D_ALIGN_NO_NEG_X)) {
 		/* width is in negative-x half */
-		v2d->cur.xmin= (float)-width;
-		v2d->cur.xmax= 0.0f;
+		v2d->cur.xmin = (float)-width;
+		v2d->cur.xmax = 0.0f;
 	}
 	else if ((v2d->align & V2D_ALIGN_NO_NEG_X) && !(v2d->align & V2D_ALIGN_NO_POS_X)) {
 		/* width is in positive-x half */
-		v2d->cur.xmin= 0.0f;
-		v2d->cur.xmax= (float)width;
+		v2d->cur.xmin = 0.0f;
+		v2d->cur.xmax = (float)width;
 	}
 	else {
 		/* width is centered around x==0 */
-		const float dx= (float)width / 2.0f;
+		const float dx = (float)width / 2.0f;
 		
-		v2d->cur.xmin= -dx;
-		v2d->cur.xmax= dx;
+		v2d->cur.xmin = -dx;
+		v2d->cur.xmax = dx;
 	}
 	
 	/* handle height - posx and negx flags are mutually exclusive, so watch out */
 	if ((v2d->align & V2D_ALIGN_NO_POS_Y) && !(v2d->align & V2D_ALIGN_NO_NEG_Y)) {
 		/* height is in negative-y half */
-		v2d->cur.ymin= (float)-height;
-		v2d->cur.ymax= 0.0f;
+		v2d->cur.ymin = (float)-height;
+		v2d->cur.ymax = 0.0f;
 	}
 	else if ((v2d->align & V2D_ALIGN_NO_NEG_Y) && !(v2d->align & V2D_ALIGN_NO_POS_Y)) {
 		/* height is in positive-y half */
-		v2d->cur.ymin= 0.0f;
-		v2d->cur.ymax= (float)height;
+		v2d->cur.ymin = 0.0f;
+		v2d->cur.ymax = (float)height;
 	}
 	else {
 		/* height is centered around y==0 */
-		const float dy= (float)height / 2.0f;
+		const float dy = (float)height / 2.0f;
 		
-		v2d->cur.ymin= -dy;
-		v2d->cur.ymax= dy;
+		v2d->cur.ymin = -dy;
+		v2d->cur.ymax = dy;
 	}
 }
 
 /* ------------------ */
 
 /* Change the size of the maximum viewable area (i.e. 'tot' rect) */
-void UI_view2d_totRect_set_resize (View2D *v2d, int width, int height, int resize)
+void UI_view2d_totRect_set_resize(View2D *v2d, int width, int height, int resize)
 {
-	int scroll= view2d_scroll_mapped(v2d->scroll);
+	int scroll = view2d_scroll_mapped(v2d->scroll);
 	
 	/* don't do anything if either value is 0 */
-	width= abs(width);
-	height= abs(height);
+	width = abs(width);
+	height = abs(height);
 	
 	/* hrumf! */
 	/* XXX: there are work arounds for this in the panel and file browse code. */
-	if(scroll & V2D_SCROLL_HORIZONTAL) 
+	if (scroll & V2D_SCROLL_HORIZONTAL) 
 		width -= V2D_SCROLL_WIDTH;
-	if(scroll & V2D_SCROLL_VERTICAL) 
+	if (scroll & V2D_SCROLL_VERTICAL) 
 		height -= V2D_SCROLL_HEIGHT;
 	
 	if (ELEM3(0, v2d, width, height)) {
-		if (G.f & G_DEBUG)
-			printf("Error: View2D totRect set exiting: v2d=%p width=%d height=%d \n", (void *)v2d, width, height); // XXX temp debug info
+		if (G.debug & G_DEBUG)
+			printf("Error: View2D totRect set exiting: v2d=%p width=%d height=%d\n", (void *)v2d, width, height);  // XXX temp debug info
 		return;
 	}
 	
 	/* handle width - posx and negx flags are mutually exclusive, so watch out */
 	if ((v2d->align & V2D_ALIGN_NO_POS_X) && !(v2d->align & V2D_ALIGN_NO_NEG_X)) {
 		/* width is in negative-x half */
-		v2d->tot.xmin= (float)-width;
-		v2d->tot.xmax= 0.0f;
+		v2d->tot.xmin = (float)-width;
+		v2d->tot.xmax = 0.0f;
 	}
 	else if ((v2d->align & V2D_ALIGN_NO_NEG_X) && !(v2d->align & V2D_ALIGN_NO_POS_X)) {
 		/* width is in positive-x half */
-		v2d->tot.xmin= 0.0f;
-		v2d->tot.xmax= (float)width;
+		v2d->tot.xmin = 0.0f;
+		v2d->tot.xmax = (float)width;
 	}
 	else {
 		/* width is centered around x==0 */
-		const float dx= (float)width / 2.0f;
+		const float dx = (float)width / 2.0f;
 		
-		v2d->tot.xmin= -dx;
-		v2d->tot.xmax= dx;
+		v2d->tot.xmin = -dx;
+		v2d->tot.xmax = dx;
 	}
 	
 	/* handle height - posx and negx flags are mutually exclusive, so watch out */
 	if ((v2d->align & V2D_ALIGN_NO_POS_Y) && !(v2d->align & V2D_ALIGN_NO_NEG_Y)) {
 		/* height is in negative-y half */
-		v2d->tot.ymin= (float)-height;
-		v2d->tot.ymax= 0.0f;
+		v2d->tot.ymin = (float)-height;
+		v2d->tot.ymax = 0.0f;
 	}
 	else if ((v2d->align & V2D_ALIGN_NO_NEG_Y) && !(v2d->align & V2D_ALIGN_NO_POS_Y)) {
 		/* height is in positive-y half */
-		v2d->tot.ymin= 0.0f;
-		v2d->tot.ymax= (float)height;
+		v2d->tot.ymin = 0.0f;
+		v2d->tot.ymax = (float)height;
 	}
 	else {
 		/* height is centered around y==0 */
-		const float dy= (float)height / 2.0f;
+		const float dy = (float)height / 2.0f;
 		
-		v2d->tot.ymin= -dy;
-		v2d->tot.ymax= dy;
+		v2d->tot.ymin = -dy;
+		v2d->tot.ymax = dy;
 	}
 	
 	/* make sure that 'cur' rect is in a valid state as a result of these changes */
@@ -906,45 +906,45 @@ void UI_view2d_totRect_set(View2D *v2d, int width, int height)
 
 int UI_view2d_tab_set(View2D *v2d, int tab)
 {
-	float default_offset[2]= {0.0f, 0.0f};
+	float default_offset[2] = {0.0f, 0.0f};
 	float *offset, *new_offset;
-	int changed= 0;
+	int changed = 0;
 
 	/* if tab changed, change offset */
-	if(tab != v2d->tab_cur && v2d->tab_offset) {
-		if(tab < v2d->tab_num)
-			offset= &v2d->tab_offset[tab*2];
+	if (tab != v2d->tab_cur && v2d->tab_offset) {
+		if (tab < v2d->tab_num)
+			offset = &v2d->tab_offset[tab * 2];
 		else
-			offset= default_offset;
+			offset = default_offset;
 
 		v2d->cur.xmax += offset[0] - v2d->cur.xmin;
-		v2d->cur.xmin= offset[0];
+		v2d->cur.xmin = offset[0];
 
 		v2d->cur.ymin += offset[1] - v2d->cur.ymax;
-		v2d->cur.ymax= offset[1];
+		v2d->cur.ymax = offset[1];
 
 		/* validation should happen in subsequent totRect_set */
 
-		changed= 1;
+		changed = 1;
 	}
 
 	/* resize array if needed */
-	if(tab >= v2d->tab_num) {
-		new_offset= MEM_callocN(sizeof(float)*(tab+1)*2, "view2d tab offset");
+	if (tab >= v2d->tab_num) {
+		new_offset = MEM_callocN(sizeof(float) * (tab + 1) * 2, "view2d tab offset");
 
-		if(v2d->tab_offset) {
-			memcpy(new_offset, v2d->tab_offset, sizeof(float)*v2d->tab_num*2);
+		if (v2d->tab_offset) {
+			memcpy(new_offset, v2d->tab_offset, sizeof(float) * v2d->tab_num * 2);
 			MEM_freeN(v2d->tab_offset);
 		}
 
-		v2d->tab_offset= new_offset;
-		v2d->tab_num= tab+1;
+		v2d->tab_offset = new_offset;
+		v2d->tab_num = tab + 1;
 	}
 
 	/* set current tab and offset */
-	v2d->tab_cur= tab;
-	v2d->tab_offset[2*tab+0]= v2d->cur.xmin;
-	v2d->tab_offset[2*tab+1]= v2d->cur.ymax;
+	v2d->tab_cur = tab;
+	v2d->tab_offset[2 * tab + 0] = v2d->cur.xmin;
+	v2d->tab_offset[2 * tab + 1] = v2d->cur.ymax;
 
 	return changed;
 }
@@ -955,21 +955,21 @@ int UI_view2d_tab_set(View2D *v2d, int tab)
 /* mapping function to ensure 'cur' draws extended over the area where sliders are */
 static void view2d_map_cur_using_mask(View2D *v2d, rctf *curmasked)
 {
-	*curmasked= v2d->cur;
+	*curmasked = v2d->cur;
 	
 	if (view2d_scroll_mapped(v2d->scroll)) {
-		float dx= (v2d->cur.xmax-v2d->cur.xmin)/((float)(v2d->mask.xmax-v2d->mask.xmin+1));
-		float dy= (v2d->cur.ymax-v2d->cur.ymin)/((float)(v2d->mask.ymax-v2d->mask.ymin+1));
+		float dx = (v2d->cur.xmax - v2d->cur.xmin) / ((float)(v2d->mask.xmax - v2d->mask.xmin + 1));
+		float dy = (v2d->cur.ymax - v2d->cur.ymin) / ((float)(v2d->mask.ymax - v2d->mask.ymin + 1));
 		
 		if (v2d->mask.xmin != 0)
-			curmasked->xmin -= dx*(float)v2d->mask.xmin;
-		if (v2d->mask.xmax+1 != v2d->winx)
-			curmasked->xmax += dx*(float)(v2d->winx - v2d->mask.xmax-1);
+			curmasked->xmin -= dx * (float)v2d->mask.xmin;
+		if (v2d->mask.xmax + 1 != v2d->winx)
+			curmasked->xmax += dx * (float)(v2d->winx - v2d->mask.xmax - 1);
 		
 		if (v2d->mask.ymin != 0)
-			curmasked->ymin -= dy*(float)v2d->mask.ymin;
-		if (v2d->mask.ymax+1 != v2d->winy)
-			curmasked->ymax += dy*(float)(v2d->winy - v2d->mask.ymax-1);
+			curmasked->ymin -= dy * (float)v2d->mask.ymin;
+		if (v2d->mask.ymax + 1 != v2d->winy)
+			curmasked->ymax += dy * (float)(v2d->winy - v2d->mask.ymax - 1);
 		
 	}
 }
@@ -980,60 +980,60 @@ void UI_view2d_view_ortho(View2D *v2d)
 	rctf curmasked;
 	float xofs, yofs;
 	
-	/* pixel offsets (-0.375f) are needed to get 1:1 correspondance with pixels for smooth UI drawing, 
-	 * but only applied where requsted
+	/* pixel offsets (-0.375f) are needed to get 1:1 correspondence with pixels for smooth UI drawing, 
+	 * but only applied where requested
 	 */
 	/* XXX brecht: instead of zero at least use a tiny offset, otherwise
 	 * pixel rounding is effectively random due to float inaccuracy */
-	xofs= 0.001f*(v2d->cur.xmax - v2d->cur.xmin)/(v2d->mask.xmax - v2d->mask.xmin);
-	yofs= 0.001f*(v2d->cur.ymax - v2d->cur.ymin)/(v2d->mask.ymax - v2d->mask.ymin);
+	xofs = 0.001f * (v2d->cur.xmax - v2d->cur.xmin) / (v2d->mask.xmax - v2d->mask.xmin);
+	yofs = 0.001f * (v2d->cur.ymax - v2d->cur.ymin) / (v2d->mask.ymax - v2d->mask.ymin);
 	
 	/* apply mask-based adjustments to cur rect (due to scrollers), to eliminate scaling artifacts */
 	view2d_map_cur_using_mask(v2d, &curmasked);
 	
-	curmasked.xmin-= xofs; curmasked.xmax-=xofs;
-	curmasked.ymin-= yofs; curmasked.ymax-=yofs;
+	curmasked.xmin -= xofs; curmasked.xmax -= xofs;
+	curmasked.ymin -= yofs; curmasked.ymax -= yofs;
 	
 	/* XXX ton: this flag set by outliner, for icons */
-	if(v2d->flag & V2D_PIXELOFS_X) {
-		curmasked.xmin= floorf(curmasked.xmin) - 0.001f;
-		curmasked.xmax= floorf(curmasked.xmax) - 0.001f;
+	if (v2d->flag & V2D_PIXELOFS_X) {
+		curmasked.xmin = floorf(curmasked.xmin) - 0.001f;
+		curmasked.xmax = floorf(curmasked.xmax) - 0.001f;
 	}
-	if(v2d->flag & V2D_PIXELOFS_Y) {
-		curmasked.ymin= floorf(curmasked.ymin) - 0.001f;
-		curmasked.ymax= floorf(curmasked.ymax) - 0.001f;
+	if (v2d->flag & V2D_PIXELOFS_Y) {
+		curmasked.ymin = floorf(curmasked.ymin) - 0.001f;
+		curmasked.ymax = floorf(curmasked.ymax) - 0.001f;
 	}
 	
 	/* set matrix on all appropriate axes */
-	wmOrtho2(curmasked.xmin-xofs, curmasked.xmax-xofs, curmasked.ymin-yofs, curmasked.ymax-yofs);
+	wmOrtho2(curmasked.xmin - xofs, curmasked.xmax - xofs, curmasked.ymin - yofs, curmasked.ymax - yofs);
 
 	/* XXX is this necessary? */
 	glLoadIdentity();
 }
 
 /* Set view matrices to only use one axis of 'cur' only
- *	- xaxis 	= if non-zero, only use cur x-axis, otherwise use cur-yaxis (mostly this will be used for x)
+ *	- xaxis     = if non-zero, only use cur x-axis, otherwise use cur-yaxis (mostly this will be used for x)
  */
 void UI_view2d_view_orthoSpecial(ARegion *ar, View2D *v2d, short xaxis)
 {
 	rctf curmasked;
 	float xofs, yofs;
 	
-	/* pixel offsets (-0.375f) are needed to get 1:1 correspondance with pixels for smooth UI drawing, 
-	 * but only applied where requsted
+	/* pixel offsets (-0.375f) are needed to get 1:1 correspondence with pixels for smooth UI drawing, 
+	 * but only applied where requested
 	 */
 	/* XXX temp (ton) */
-	xofs= 0.0f; // (v2d->flag & V2D_PIXELOFS_X) ? 0.375f : 0.0f;
-	yofs= 0.0f; // (v2d->flag & V2D_PIXELOFS_Y) ? 0.375f : 0.0f;
+	xofs = 0.0f; // (v2d->flag & V2D_PIXELOFS_X) ? 0.375f : 0.0f;
+	yofs = 0.0f; // (v2d->flag & V2D_PIXELOFS_Y) ? 0.375f : 0.0f;
 	
 	/* apply mask-based adjustments to cur rect (due to scrollers), to eliminate scaling artifacts */
 	view2d_map_cur_using_mask(v2d, &curmasked);
 	
 	/* only set matrix with 'cur' coordinates on relevant axes */
 	if (xaxis)
-		wmOrtho2(curmasked.xmin-xofs, curmasked.xmax-xofs, -yofs, ar->winy-yofs);
+		wmOrtho2(curmasked.xmin - xofs, curmasked.xmax - xofs, -yofs, ar->winy - yofs);
 	else
-		wmOrtho2(-xofs, ar->winx-xofs, curmasked.ymin-yofs, curmasked.ymax-yofs);
+		wmOrtho2(-xofs, ar->winx - xofs, curmasked.ymin - yofs, curmasked.ymax - yofs);
 		
 	/* XXX is this necessary? */
 	glLoadIdentity();
@@ -1043,9 +1043,9 @@ void UI_view2d_view_orthoSpecial(ARegion *ar, View2D *v2d, short xaxis)
 /* Restore view matrices after drawing */
 void UI_view2d_view_restore(const bContext *C)
 {
-	ARegion *ar= CTX_wm_region(C);
-	int width= ar->winrct.xmax-ar->winrct.xmin+1;
-	int height= ar->winrct.ymax-ar->winrct.ymin+1;
+	ARegion *ar = CTX_wm_region(C);
+	int width = ar->winrct.xmax - ar->winrct.xmin + 1;
+	int height = ar->winrct.ymax - ar->winrct.ymin + 1;
 	
 	wmOrtho2(0.0f, (float)width, 0.0f, (float)height);
 	glLoadIdentity();
@@ -1058,9 +1058,9 @@ void UI_view2d_view_restore(const bContext *C)
 
 /* View2DGrid is typedef'd in UI_view2d.h */
 struct View2DGrid {
-	float dx, dy;			/* stepsize (in pixels) between gridlines */
-	float startx, starty;	/* initial coordinates to start drawing grid from */
-	int powerx, powery;		/* step as power of 10 */
+	float dx, dy;           /* stepsize (in pixels) between gridlines */
+	float startx, starty;   /* initial coordinates to start drawing grid from */
+	int powerx, powery;     /* step as power of 10 */
 };
 
 /* --------------- */
@@ -1068,20 +1068,20 @@ struct View2DGrid {
 /* try to write step as a power of 10 */
 static void step_to_grid(float *step, int *power, int unit)
 {
-	const float loga= (float)log10(*step);
+	const float loga = (float)log10(*step);
 	float rem;
 	
-	*power= (int)(loga);
+	*power = (int)(loga);
 	
-	rem= loga - (*power);
-	rem= (float)pow(10.0, rem);
+	rem = loga - (*power);
+	rem = (float)pow(10.0, rem);
 	
 	if (loga < 0.0f) {
-		if (rem < 0.2f) rem= 0.2f;
-		else if(rem < 0.5f) rem= 0.5f;
-		else rem= 1.0f;
+		if (rem < 0.2f) rem = 0.2f;
+		else if (rem < 0.5f) rem = 0.5f;
+		else rem = 1.0f;
 		
-		*step= rem * (float)pow(10.0, (*power));
+		*step = rem * (float)pow(10.0, (*power));
 		
 		/* for frames, we want 1.0 frame intervals only */
 		if (unit == V2D_UNIT_FRAMES) {
@@ -1093,11 +1093,11 @@ static void step_to_grid(float *step, int *power, int unit)
 		if (rem == 1.0f) (*power)++;	
 	}
 	else {
-		if (rem < 2.0f) rem= 2.0f;
-		else if(rem < 5.0f) rem= 5.0f;
-		else rem= 10.0f;
+		if (rem < 2.0f) rem = 2.0f;
+		else if (rem < 5.0f) rem = 5.0f;
+		else rem = 10.0f;
 		
-		*step= rem * (float)pow(10.0, (*power));
+		*step = rem * (float)pow(10.0, (*power));
 		
 		(*power)++;
 		/* prevents printing 1.0, 2.0, 3.0, etc. */
@@ -1105,7 +1105,7 @@ static void step_to_grid(float *step, int *power, int unit)
 	}
 }
 
-/* Intialise settings necessary for drawing gridlines in a 2d-view 
+/* Initialize settings necessary for drawing gridlines in a 2d-view
  *	- Currently, will return pointer to View2DGrid struct that needs to 
  *	  be freed with UI_view2d_grid_free()
  *	- Is used for scrollbar drawing too (for units drawing)
@@ -1128,62 +1128,62 @@ View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d, short xunits, short x
 		return NULL;
 	
 	/* grid here is allocated... */
-	grid= MEM_callocN(sizeof(View2DGrid), "View2DGrid");
+	grid = MEM_callocN(sizeof(View2DGrid), "View2DGrid");
 	
 	/* rule: gridstep is minimal GRIDSTEP pixels */
 	if (xunits == V2D_UNIT_SECONDS) {
-		seconddiv= (float)(0.01 * FPS);
+		seconddiv = (float)(0.01 * FPS);
 	}
 	else {
-		seconddiv= 1.0f;
+		seconddiv = 1.0f;
 	}
 	
 	/* calculate x-axis grid scale (only if both args are valid) */
 	if (ELEM(V2D_ARG_DUMMY, xunits, xclamp) == 0) {
-		space= v2d->cur.xmax - v2d->cur.xmin;
-		pixels= (float)(v2d->mask.xmax - v2d->mask.xmin);
+		space = v2d->cur.xmax - v2d->cur.xmin;
+		pixels = (float)(v2d->mask.xmax - v2d->mask.xmin);
 		
-		if(pixels!=0.0f) {
-			grid->dx= (U.v2d_min_gridsize * space) / (seconddiv * pixels);
+		if (pixels != 0.0f) {
+			grid->dx = (U.v2d_min_gridsize * space) / (seconddiv * pixels);
 			step_to_grid(&grid->dx, &grid->powerx, xunits);
 			grid->dx *= seconddiv;
 		}
 		
 		if (xclamp == V2D_GRID_CLAMP) {
-			if (grid->dx < 0.1f) grid->dx= 0.1f;
-			grid->powerx-= 2;
-			if (grid->powerx < -2) grid->powerx= -2;
+			if (grid->dx < 0.1f) grid->dx = 0.1f;
+			grid->powerx -= 2;
+			if (grid->powerx < -2) grid->powerx = -2;
 		}
 	}
 	
 	/* calculate y-axis grid scale (only if both args are valid) */
 	if (ELEM(V2D_ARG_DUMMY, yunits, yclamp) == 0) {
-		space= v2d->cur.ymax - v2d->cur.ymin;
-		pixels= (float)winy;
+		space = v2d->cur.ymax - v2d->cur.ymin;
+		pixels = (float)winy;
 		
-		grid->dy= U.v2d_min_gridsize * space / pixels;
+		grid->dy = U.v2d_min_gridsize * space / pixels;
 		step_to_grid(&grid->dy, &grid->powery, yunits);
 		
 		if (yclamp == V2D_GRID_CLAMP) {
-			if (grid->dy < 1.0f) grid->dy= 1.0f;
-			if (grid->powery < 1) grid->powery= 1;
+			if (grid->dy < 1.0f) grid->dy = 1.0f;
+			if (grid->powery < 1) grid->powery = 1;
 		}
 	}
 	
 	/* calculate start position */
 	if (ELEM(V2D_ARG_DUMMY, xunits, xclamp) == 0) {
-		grid->startx= seconddiv*(v2d->cur.xmin/seconddiv - (float)fmod(v2d->cur.xmin/seconddiv, grid->dx/seconddiv));
-		if (v2d->cur.xmin < 0.0f) grid->startx-= grid->dx;
+		grid->startx = seconddiv * (v2d->cur.xmin / seconddiv - (float)fmod(v2d->cur.xmin / seconddiv, grid->dx / seconddiv));
+		if (v2d->cur.xmin < 0.0f) grid->startx -= grid->dx;
 	}
 	else
-		grid->startx= v2d->cur.xmin;
+		grid->startx = v2d->cur.xmin;
 		
 	if (ELEM(V2D_ARG_DUMMY, yunits, yclamp) == 0) {
-		grid->starty= (v2d->cur.ymin - (float)fmod(v2d->cur.ymin, grid->dy));
-		if (v2d->cur.ymin < 0.0f) grid->starty-= grid->dy;
+		grid->starty = (v2d->cur.ymin - (float)fmod(v2d->cur.ymin, grid->dy));
+		if (v2d->cur.ymin < 0.0f) grid->starty -= grid->dy;
 	}
 	else
-		grid->starty= v2d->cur.ymin;
+		grid->starty = v2d->cur.ymin;
 	
 	return grid;
 }
@@ -1200,71 +1200,71 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag)
 	
 	/* vertical lines */
 	if (flag & V2D_VERTICAL_LINES) {
-		/* initialise initial settings */
-		vec1[0]= vec2[0]= grid->startx;
-		vec1[1]= grid->starty;
-		vec2[1]= v2d->cur.ymax;
+		/* initialize initial settings */
+		vec1[0] = vec2[0] = grid->startx;
+		vec1[1] = grid->starty;
+		vec2[1] = v2d->cur.ymax;
 		
 		/* minor gridlines */
-		step= (v2d->mask.xmax - v2d->mask.xmin + 1) / U.v2d_min_gridsize;
+		step = (v2d->mask.xmax - v2d->mask.xmin + 1) / U.v2d_min_gridsize;
 		UI_ThemeColor(TH_GRID);
 		
-		for (a=0; a<step; a++) {
+		for (a = 0; a < step; a++) {
 			glBegin(GL_LINE_STRIP);
-				glVertex2fv(vec1); 
-				glVertex2fv(vec2);
+			glVertex2fv(vec1);
+			glVertex2fv(vec2);
 			glEnd();
 			
-			vec2[0]= vec1[0]+= grid->dx;
+			vec2[0] = vec1[0] += grid->dx;
 		}
 		
 		/* major gridlines */
-		vec2[0]= vec1[0]-= 0.5f*grid->dx;
+		vec2[0] = vec1[0] -= 0.5f * grid->dx;
 		UI_ThemeColorShade(TH_GRID, 16);
 		
 		step++;
-		for (a=0; a<=step; a++) {
+		for (a = 0; a <= step; a++) {
 			glBegin(GL_LINE_STRIP);
-				glVertex2fv(vec1); 
-				glVertex2fv(vec2);
+			glVertex2fv(vec1);
+			glVertex2fv(vec2);
 			glEnd();
 			
-			vec2[0]= vec1[0]-= grid->dx;
+			vec2[0] = vec1[0] -= grid->dx;
 		}
 	}
 	
 	/* horizontal lines */
 	if (flag & V2D_HORIZONTAL_LINES) {
 		/* only major gridlines */
-		vec1[1]= vec2[1]= grid->starty;
-		vec1[0]= grid->startx;
-		vec2[0]= v2d->cur.xmax;
+		vec1[1] = vec2[1] = grid->starty;
+		vec1[0] = grid->startx;
+		vec2[0] = v2d->cur.xmax;
 		
-		step= (v2d->mask.ymax - v2d->mask.ymin + 1) / U.v2d_min_gridsize;
+		step = (v2d->mask.ymax - v2d->mask.ymin + 1) / U.v2d_min_gridsize;
 		
 		UI_ThemeColor(TH_GRID);
-		for (a=0; a<=step; a++) {
+		for (a = 0; a <= step; a++) {
 			glBegin(GL_LINE_STRIP);
-				glVertex2fv(vec1); 
-				glVertex2fv(vec2);
+			glVertex2fv(vec1);
+			glVertex2fv(vec2);
 			glEnd();
 			
-			vec2[1]= vec1[1]+= grid->dy;
+			vec2[1] = vec1[1] += grid->dy;
 		}
 		
 		/* fine grid lines */
-		vec2[1]= vec1[1]-= 0.5f*grid->dy;
+		vec2[1] = vec1[1] -= 0.5f * grid->dy;
 		step++;
 		
 		if (flag & V2D_HORIZONTAL_FINELINES) { 
 			UI_ThemeColorShade(TH_GRID, 16);
-			for (a=0; a<step; a++) {
+			for (a = 0; a < step; a++) {
 				glBegin(GL_LINE_STRIP);
-					glVertex2fv(vec1); 
-					glVertex2fv(vec2);
+				glVertex2fv(vec1);
+				glVertex2fv(vec2);
 				glEnd();
 				
-				vec2[1]= vec1[1]-= grid->dy;
+				vec2[1] = vec1[1] -= grid->dy;
 			}
 		}
 	}
@@ -1274,25 +1274,25 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag)
 	
 	/* horizontal axis */
 	if (flag & V2D_HORIZONTAL_AXIS) {
-		vec1[0]= v2d->cur.xmin;
-		vec2[0]= v2d->cur.xmax;
-		vec1[1]= vec2[1]= 0.0f;
+		vec1[0] = v2d->cur.xmin;
+		vec2[0] = v2d->cur.xmax;
+		vec1[1] = vec2[1] = 0.0f;
 		
 		glBegin(GL_LINE_STRIP);
-			glVertex2fv(vec1);
-			glVertex2fv(vec2);
+		glVertex2fv(vec1);
+		glVertex2fv(vec2);
 		glEnd();
 	}
 	
 	/* vertical axis */
 	if (flag & V2D_VERTICAL_AXIS) {
-		vec1[1]= v2d->cur.ymin;
-		vec2[1]= v2d->cur.ymax;
-		vec1[0]= vec2[0]= 0.0f;
+		vec1[1] = v2d->cur.ymin;
+		vec2[1] = v2d->cur.ymax;
+		vec1[0] = vec2[0] = 0.0f;
 		
 		glBegin(GL_LINE_STRIP);
-			glVertex2fv(vec1); 
-			glVertex2fv(vec2);
+		glVertex2fv(vec1);
+		glVertex2fv(vec2);
 		glEnd();
 	}
 }
@@ -1300,20 +1300,20 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag)
 /* Draw a constant grid in given 2d-region */
 void UI_view2d_constant_grid_draw(View2D *v2d)
 {
-	float start, step= 25.0f;
+	float start, step = 25.0f;
 
 	UI_ThemeColorShade(TH_BACK, -10);
 	
-	start= v2d->cur.xmin - (float)fmod(v2d->cur.xmin, step);
+	start = v2d->cur.xmin - (float)fmod(v2d->cur.xmin, step);
 	
 	glBegin(GL_LINES);
-	for(; start<v2d->cur.xmax; start+=step) {
+	for (; start < v2d->cur.xmax; start += step) {
 		glVertex2f(start, v2d->cur.ymin);
 		glVertex2f(start, v2d->cur.ymax);
 	}
 
-	start= v2d->cur.ymin - (float)fmod(v2d->cur.ymin, step);
-	for(; start<v2d->cur.ymax; start+=step) {
+	start = v2d->cur.ymin - (float)fmod(v2d->cur.ymin, step);
+	for (; start < v2d->cur.ymax; start += step) {
 		glVertex2f(v2d->cur.xmin, start);
 		glVertex2f(v2d->cur.xmax, start);
 	}
@@ -1331,8 +1331,8 @@ void UI_view2d_constant_grid_draw(View2D *v2d)
 /* the price we pay for not exposting structs :( */
 void UI_view2d_grid_size(View2DGrid *grid, float *r_dx, float *r_dy)
 {
-	*r_dx= grid->dx;
-	*r_dy= grid->dy;
+	*r_dx = grid->dx;
+	*r_dy = grid->dy;
 }
 
 /* free temporary memory used for drawing grid */
@@ -1349,20 +1349,20 @@ void UI_view2d_grid_free(View2DGrid *grid)
 
 /* View2DScrollers is typedef'd in UI_view2d.h 
  * WARNING: the start of this struct must not change, as view2d_ops.c uses this too. 
- * 		   For now, we don't need to have a separate (internal) header for structs like this...
+ *         For now, we don't need to have a separate (internal) header for structs like this...
  */
 struct View2DScrollers {
-		/* focus bubbles */
-	int vert_min, vert_max;	/* vertical scrollbar */
-	int hor_min, hor_max;	/* horizontal scrollbar */
+	/* focus bubbles */
+	int vert_min, vert_max; /* vertical scrollbar */
+	int hor_min, hor_max;   /* horizontal scrollbar */
 	
-	rcti hor, vert;			/* exact size of slider backdrop */
-	int horfull, vertfull;	/* set if sliders are full, we don't draw them */
+	rcti hor, vert;         /* exact size of slider backdrop */
+	int horfull, vertfull;  /* set if sliders are full, we don't draw them */
 	
 	/* scales */
-	View2DGrid *grid;		/* grid for coordinate drawing */
-	short xunits, xclamp;	/* units and clamping options for x-axis */
-	short yunits, yclamp;	/* units and clamping options for y-axis */
+	View2DGrid *grid;       /* grid for coordinate drawing */
+	short xunits, xclamp;   /* units and clamping options for x-axis */
+	short yunits, yclamp;   /* units and clamping options for y-axis */
 };
 
 /* Calculate relevant scroller properties */
@@ -1371,35 +1371,35 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
 	View2DScrollers *scrollers;
 	rcti vert, hor;
 	float fac1, fac2, totsize, scrollsize;
-	int scroll= view2d_scroll_mapped(v2d->scroll);
+	int scroll = view2d_scroll_mapped(v2d->scroll);
 	
 	/* scrollers is allocated here... */
-	scrollers= MEM_callocN(sizeof(View2DScrollers), "View2DScrollers");
+	scrollers = MEM_callocN(sizeof(View2DScrollers), "View2DScrollers");
 	
-	vert= v2d->vert;
-	hor= v2d->hor;
+	vert = v2d->vert;
+	hor = v2d->hor;
 	
 	/* slider rects need to be smaller than region */
-	hor.xmin+=4;
-	hor.xmax-=4;
+	hor.xmin += 4;
+	hor.xmax -= 4;
 	if (scroll & V2D_SCROLL_BOTTOM)
-		hor.ymin+=4;
+		hor.ymin += 4;
 	else
-		hor.ymax-=4;
+		hor.ymax -= 4;
 	
 	if (scroll & V2D_SCROLL_LEFT)
-		vert.xmin+=4;
+		vert.xmin += 4;
 	else
-		vert.xmax-=4;
-	vert.ymin+=4;
-	vert.ymax-=4;
+		vert.xmax -= 4;
+	vert.ymin += 4;
+	vert.ymax -= 4;
 	
-	CLAMP(vert.ymin, vert.ymin, vert.ymax-V2D_SCROLLER_HANDLE_SIZE);
-	CLAMP(hor.xmin, hor.xmin, hor.xmax-V2D_SCROLLER_HANDLE_SIZE);
+	CLAMP(vert.ymin, vert.ymin, vert.ymax - V2D_SCROLLER_HANDLE_SIZE);
+	CLAMP(hor.xmin, hor.xmin, hor.xmax - V2D_SCROLLER_HANDLE_SIZE);
 	
 	/* store in scrollers, used for drawing */
-	scrollers->vert= vert;
-	scrollers->hor= hor;
+	scrollers->vert = vert;
+	scrollers->hor = hor;
 	
 	/* scroller 'buttons':
 	 *	- These should always remain within the visible region of the scrollbar
@@ -1409,38 +1409,38 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
 	/* horizontal scrollers */
 	if (scroll & V2D_SCROLL_HORIZONTAL) {
 		/* scroller 'button' extents */
-		totsize= v2d->tot.xmax - v2d->tot.xmin;
-		scrollsize= (float)(hor.xmax - hor.xmin);
-		if(totsize==0.0f) totsize = 1.0f; /* avoid divide by zero */
-		
-		fac1= (v2d->cur.xmin - v2d->tot.xmin) / totsize;
-		if(fac1<=0.0f)
-			scrollers->hor_min= hor.xmin;
+		totsize = v2d->tot.xmax - v2d->tot.xmin;
+		scrollsize = (float)(hor.xmax - hor.xmin);
+		if (totsize == 0.0f) totsize = 1.0f;  /* avoid divide by zero */
+
+		fac1 = (v2d->cur.xmin - v2d->tot.xmin) / totsize;
+		if (fac1 <= 0.0f)
+			scrollers->hor_min = hor.xmin;
 		else
-			scrollers->hor_min= (int)(hor.xmin + (fac1 * scrollsize));
+			scrollers->hor_min = (int)(hor.xmin + (fac1 * scrollsize));
 		
-		fac2= (v2d->cur.xmax - v2d->tot.xmin) / totsize;
-		if(fac2>=1.0f)
-			scrollers->hor_max= hor.xmax;
+		fac2 = (v2d->cur.xmax - v2d->tot.xmin) / totsize;
+		if (fac2 >= 1.0f)
+			scrollers->hor_max = hor.xmax;
 		else
-			scrollers->hor_max= (int)(hor.xmin + (fac2 * scrollsize));
+			scrollers->hor_max = (int)(hor.xmin + (fac2 * scrollsize));
 		
 		/* prevent inverted sliders */
 		if (scrollers->hor_min > scrollers->hor_max) 
-			scrollers->hor_min= scrollers->hor_max;
+			scrollers->hor_min = scrollers->hor_max;
 		/* prevent sliders from being too small, and disappearing */
 		if ((scrollers->hor_max - scrollers->hor_min) < V2D_SCROLLER_HANDLE_SIZE) {
-			scrollers->hor_max= scrollers->hor_min + V2D_SCROLLER_HANDLE_SIZE;
+			scrollers->hor_max = scrollers->hor_min + V2D_SCROLLER_HANDLE_SIZE;
 
-			CLAMP(scrollers->hor_max, hor.xmin+V2D_SCROLLER_HANDLE_SIZE, hor.xmax);
-			CLAMP(scrollers->hor_min, hor.xmin, hor.xmax-V2D_SCROLLER_HANDLE_SIZE);
+			CLAMP(scrollers->hor_max, hor.xmin + V2D_SCROLLER_HANDLE_SIZE, hor.xmax);
+			CLAMP(scrollers->hor_min, hor.xmin, hor.xmax - V2D_SCROLLER_HANDLE_SIZE);
 		}
 		
 		/* check whether sliders can disappear due to the full-range being used */
-		if(v2d->keeptot) {
+		if (v2d->keeptot) {
 			if ((fac1 <= 0.0f) && (fac2 >= 1.0f)) { 
 				v2d->scroll |= V2D_SCROLL_HORIZONTAL_FULLR;
-				scrollers->horfull= 1;
+				scrollers->horfull = 1;
 			}
 			else	
 				v2d->scroll &= ~V2D_SCROLL_HORIZONTAL_FULLR;
@@ -1450,39 +1450,39 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
 	/* vertical scrollers */
 	if (scroll & V2D_SCROLL_VERTICAL) {
 		/* scroller 'button' extents */
-		totsize= v2d->tot.ymax - v2d->tot.ymin;
-		scrollsize= (float)(vert.ymax - vert.ymin);
-		if(totsize==0.0f) totsize = 1.0f; /* avoid divide by zero */
-		
-		fac1= (v2d->cur.ymin- v2d->tot.ymin) / totsize;
-		if(fac1<=0.0f)
-			scrollers->vert_min= vert.ymin;
+		totsize = v2d->tot.ymax - v2d->tot.ymin;
+		scrollsize = (float)(vert.ymax - vert.ymin);
+		if (totsize == 0.0f) totsize = 1.0f;  /* avoid divide by zero */
+
+		fac1 = (v2d->cur.ymin - v2d->tot.ymin) / totsize;
+		if (fac1 <= 0.0f)
+			scrollers->vert_min = vert.ymin;
 		else
-			scrollers->vert_min= (int)(vert.ymin + (fac1 * scrollsize));
+			scrollers->vert_min = (int)(vert.ymin + (fac1 * scrollsize));
 		
-		fac2= (v2d->cur.ymax - v2d->tot.ymin) / totsize;
-		if(fac2>=1.0f)
-			scrollers->vert_max= vert.ymax;
+		fac2 = (v2d->cur.ymax - v2d->tot.ymin) / totsize;
+		if (fac2 >= 1.0f)
+			scrollers->vert_max = vert.ymax;
 		else
-			scrollers->vert_max= (int)(vert.ymin + (fac2 * scrollsize));
+			scrollers->vert_max = (int)(vert.ymin + (fac2 * scrollsize));
 		
 		/* prevent inverted sliders */
 		if (scrollers->vert_min > scrollers->vert_max) 
-			scrollers->vert_min= scrollers->vert_max;
+			scrollers->vert_min = scrollers->vert_max;
 		/* prevent sliders from being too small, and disappearing */
 		if ((scrollers->vert_max - scrollers->vert_min) < V2D_SCROLLER_HANDLE_SIZE) {
 			
-			scrollers->vert_max= scrollers->vert_min + V2D_SCROLLER_HANDLE_SIZE;
+			scrollers->vert_max = scrollers->vert_min + V2D_SCROLLER_HANDLE_SIZE;
 			
-			CLAMP(scrollers->vert_max, vert.ymin+V2D_SCROLLER_HANDLE_SIZE, vert.ymax);
-			CLAMP(scrollers->vert_min, vert.ymin, vert.ymax-V2D_SCROLLER_HANDLE_SIZE);
+			CLAMP(scrollers->vert_max, vert.ymin + V2D_SCROLLER_HANDLE_SIZE, vert.ymax);
+			CLAMP(scrollers->vert_min, vert.ymin, vert.ymax - V2D_SCROLLER_HANDLE_SIZE);
 		}
 
 		/* check whether sliders can disappear due to the full-range being used */
-		if(v2d->keeptot) {
+		if (v2d->keeptot) {
 			if ((fac1 <= 0.0f) && (fac2 >= 1.0f)) { 
 				v2d->scroll |= V2D_SCROLL_VERTICAL_FULLR;
-				scrollers->vertfull= 1;
+				scrollers->vertfull = 1;
 			}
 			else	
 				v2d->scroll &= ~V2D_SCROLL_VERTICAL_FULLR;
@@ -1490,14 +1490,14 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short
 	}
 	
 	/* grid markings on scrollbars */
-	if (scroll & (V2D_SCROLL_SCALE_HORIZONTAL|V2D_SCROLL_SCALE_VERTICAL)) {
+	if (scroll & (V2D_SCROLL_SCALE_HORIZONTAL | V2D_SCROLL_SCALE_VERTICAL)) {
 		/* store clamping */
-		scrollers->xclamp= xclamp;
-		scrollers->xunits= xunits;
-		scrollers->yclamp= yclamp;
-		scrollers->yunits= yunits;
+		scrollers->xclamp = xclamp;
+		scrollers->xunits = xunits;
+		scrollers->yclamp = yclamp;
+		scrollers->yunits = yunits;
 		
-		scrollers->grid= UI_view2d_grid_calc(CTX_data_scene(C), v2d, xunits, xclamp, yunits, yclamp, (hor.xmax - hor.xmin), (vert.ymax - vert.ymin));
+		scrollers->grid = UI_view2d_grid_calc(CTX_data_scene(C), v2d, xunits, xclamp, yunits, yclamp, (hor.xmax - hor.xmin), (vert.ymax - vert.ymin));
 	}
 	
 	/* return scrollers */
@@ -1526,19 +1526,19 @@ static void scroll_printstr(Scene *scene, float x, float y, float val, int power
 	ANIM_timecode_string_from_frame(timecode_str, scene, power, (unit == V2D_UNIT_SECONDS), val);
 	
 	/* get length of string, and adjust printing location to fit it into the horizontal scrollbar */
-	len= strlen(timecode_str);
+	len = strlen(timecode_str);
 	if (dir == 'h') {
 		/* seconds/timecode display has slightly longer strings... */
 		if (unit == V2D_UNIT_SECONDS)
-			x-= 3*len;
+			x -= 3 * len;
 		else
-			x-= 4*len;
+			x -= 4 * len;
 	}
 	
 	/* Add degree sympbol to end of string for vertical scrollbar? */
 	if ((dir == 'v') && (unit == V2D_UNIT_DEGREES)) {
-		timecode_str[len]= 186;
-		timecode_str[len+1]= 0;
+		timecode_str[len] = 186;
+		timecode_str[len + 1] = 0;
 	}
 	
 	/* draw it */
@@ -1548,29 +1548,29 @@ static void scroll_printstr(Scene *scene, float x, float y, float val, int power
 /* Draw scrollbars in the given 2d-region */
 void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *vs)
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	rcti vert, hor;
-	int scroll= view2d_scroll_mapped(v2d->scroll);
+	int scroll = view2d_scroll_mapped(v2d->scroll);
 	
 	/* make copies of rects for less typing */
-	vert= vs->vert;
-	hor= vs->hor;
+	vert = vs->vert;
+	hor = vs->hor;
 	
 	/* horizontal scrollbar */
 	if (scroll & V2D_SCROLL_HORIZONTAL) {
 		/* only draw scrollbar when it doesn't fill the entire space */
-		if(vs->horfull==0) {
-			bTheme *btheme= UI_GetTheme();
-			uiWidgetColors wcol= btheme->tui.wcol_scroll;
+		if (vs->horfull == 0) {
+			bTheme *btheme = UI_GetTheme();
+			uiWidgetColors wcol = btheme->tui.wcol_scroll;
 			rcti slider;
 			int state;
 			
-			slider.xmin= vs->hor_min;
-			slider.xmax= vs->hor_max;
-			slider.ymin= hor.ymin;
-			slider.ymax= hor.ymax;
+			slider.xmin = vs->hor_min;
+			slider.xmax = vs->hor_max;
+			slider.ymin = hor.ymin;
+			slider.ymax = hor.ymax;
 			
-			state= (v2d->scroll_ui & V2D_SCROLL_H_ACTIVE)?UI_SCROLL_PRESSED:0;
+			state = (v2d->scroll_ui & V2D_SCROLL_H_ACTIVE) ? UI_SCROLL_PRESSED : 0;
 			
 			/* show zoom handles if:
 			 *	- zooming on x-axis is allowed (no scroll otherwise)
@@ -1579,9 +1579,9 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
 			 *	  (workaround to make sure that button windows don't show these, 
 			 *		and only the time-grids with their zoomability can do so)
 			 */
-			if ((v2d->keepzoom & V2D_LOCKZOOM_X)==0 && 
-				(v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL) &&
-				(slider.xmax - slider.xmin > V2D_SCROLLER_HANDLE_SIZE))
+			if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0 &&
+			    (v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL) &&
+			    (slider.xmax - slider.xmin > V2D_SCROLLER_HANDLE_SIZE))
 			{
 				state |= UI_SCROLL_ARROWS;
 			}
@@ -1594,22 +1594,22 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
 		
 		/* scale indicators */
 		if ((scroll & V2D_SCROLL_SCALE_HORIZONTAL) && (vs->grid)) {
-			View2DGrid *grid= vs->grid;
+			View2DGrid *grid = vs->grid;
 			float fac, dfac, fac2, val;
 			
 			/* the numbers: convert grid->startx and -dx to scroll coordinates 
 			 *	- fac is x-coordinate to draw to
 			 *	- dfac is gap between scale markings
 			 */
-			fac= (grid->startx - v2d->cur.xmin) / (v2d->cur.xmax - v2d->cur.xmin);
-			fac= (float)hor.xmin + fac*(hor.xmax - hor.xmin);
+			fac = (grid->startx - v2d->cur.xmin) / (v2d->cur.xmax - v2d->cur.xmin);
+			fac = (float)hor.xmin + fac * (hor.xmax - hor.xmin);
 			
-			dfac= (grid->dx) / (v2d->cur.xmax - v2d->cur.xmin);
-			dfac= dfac * (hor.xmax - hor.xmin);
+			dfac = (grid->dx) / (v2d->cur.xmax - v2d->cur.xmin);
+			dfac = dfac * (hor.xmax - hor.xmin);
 			
 			/* set starting value, and text color */
 			UI_ThemeColor(TH_TEXT);
-			val= grid->startx;
+			val = grid->startx;
 			
 			/* if we're clamping to whole numbers only, make sure entries won't be repeated */
 			if (vs->xclamp == V2D_GRID_CLAMP) {
@@ -1619,45 +1619,45 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
 				}
 			}
 			if (vs->xunits == V2D_UNIT_FRAMES)
-				grid->powerx= 1;
+				grid->powerx = 1;
 			
 			/* draw numbers in the appropriate range */
 			if (dfac > 0.0f) {
-				float h= 2.0f+(float)(hor.ymin);
+				float h = 2.0f + (float)(hor.ymin);
 				
-				for (; fac < hor.xmax-10; fac+=dfac, val+=grid->dx) {
+				for (; fac < hor.xmax - 10; fac += dfac, val += grid->dx) {
 					
 					/* make prints look nicer for scrollers */
-					if(fac < hor.xmin+10)
+					if (fac < hor.xmin + 10)
 						continue;
 					
 					switch (vs->xunits) {							
-						case V2D_UNIT_FRAMES:		/* frames (as whole numbers)*/
+						case V2D_UNIT_FRAMES:       /* frames (as whole numbers)*/
 							scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMES, 'h');
 							break;
 							
-						case V2D_UNIT_FRAMESCALE:	/* frames (not always as whole numbers) */
+						case V2D_UNIT_FRAMESCALE:   /* frames (not always as whole numbers) */
 							scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_FRAMESCALE, 'h');
 							break;
 						
-						case V2D_UNIT_SECONDS:		/* seconds */
-							fac2= val/(float)FPS;
+						case V2D_UNIT_SECONDS:      /* seconds */
+							fac2 = val / (float)FPS;
 							scroll_printstr(scene, fac, h, fac2, grid->powerx, V2D_UNIT_SECONDS, 'h');
 							break;
 							
-						case V2D_UNIT_SECONDSSEQ:	/* seconds with special calculations (only used for sequencer only) */
+						case V2D_UNIT_SECONDSSEQ:   /* seconds with special calculations (only used for sequencer only) */
 						{
 							float time;
 							
-							fac2= val/(float)FPS;
-							time= (float)floor(fac2);
-							fac2= fac2-time;
+							fac2 = val / (float)FPS;
+							time = (float)floor(fac2);
+							fac2 = fac2 - time;
 							
-							scroll_printstr(scene, fac, h, time+(float)FPS*fac2/100.0f, grid->powerx, V2D_UNIT_SECONDSSEQ, 'h');
+							scroll_printstr(scene, fac, h, time + (float)FPS * fac2 / 100.0f, grid->powerx, V2D_UNIT_SECONDSSEQ, 'h');
 						}
-							break;
+						break;
 							
-						case V2D_UNIT_DEGREES:		/* Graph Editor for rotation Drivers */
+						case V2D_UNIT_DEGREES:      /* Graph Editor for rotation Drivers */
 							/* HACK: although we're drawing horizontal, we make this draw as 'vertical', just to get degree signs */
 							scroll_printstr(scene, fac, h, val, grid->powerx, V2D_UNIT_DEGREES, 'v');
 							break;
@@ -1670,18 +1670,18 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
 	/* vertical scrollbar */
 	if (scroll & V2D_SCROLL_VERTICAL) {
 		/* only draw scrollbar when it doesn't fill the entire space */
-		if(vs->vertfull==0) {
-			bTheme *btheme= UI_GetTheme();
-			uiWidgetColors wcol= btheme->tui.wcol_scroll;
+		if (vs->vertfull == 0) {
+			bTheme *btheme = UI_GetTheme();
+			uiWidgetColors wcol = btheme->tui.wcol_scroll;
 			rcti slider;
 			int state;
 			
-			slider.xmin= vert.xmin;
-			slider.xmax= vert.xmax;
-			slider.ymin= vs->vert_min;
-			slider.ymax= vs->vert_max;
+			slider.xmin = vert.xmin;
+			slider.xmax = vert.xmax;
+			slider.ymin = vs->vert_min;
+			slider.ymax = vs->vert_max;
 			
-			state= (v2d->scroll_ui & V2D_SCROLL_V_ACTIVE)?UI_SCROLL_PRESSED:0;
+			state = (v2d->scroll_ui & V2D_SCROLL_V_ACTIVE) ? UI_SCROLL_PRESSED : 0;
 			
 			/* show zoom handles if:
 			 *	- zooming on y-axis is allowed (no scroll otherwise)
@@ -1690,9 +1690,9 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
 			 *	  (workaround to make sure that button windows don't show these, 
 			 *		and only the time-grids with their zoomability can do so)
 			 */
-			if ((v2d->keepzoom & V2D_LOCKZOOM_Y)==0 && 
-				(v2d->scroll & V2D_SCROLL_SCALE_VERTICAL) &&
-				(slider.ymax - slider.ymin > V2D_SCROLLER_HANDLE_SIZE))
+			if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0 &&
+			    (v2d->scroll & V2D_SCROLL_SCALE_VERTICAL) &&
+			    (slider.ymax - slider.ymin > V2D_SCROLLER_HANDLE_SIZE))
 			{
 				state |= UI_SCROLL_ARROWS;
 			}
@@ -1706,7 +1706,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
 		
 		/* scale indiators */
 		if ((scroll & V2D_SCROLL_SCALE_VERTICAL) && (vs->grid)) {
-			View2DGrid *grid= vs->grid;
+			View2DGrid *grid = vs->grid;
 			float fac, dfac, val;
 			
 			/* the numbers: convert grid->starty and dy to scroll coordinates 
@@ -1715,15 +1715,15 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
 			 *	- these involve a correction for horizontal scrollbar
 			 *	  NOTE: it's assumed that that scrollbar is there if this is involved!
 			 */
-			fac= (grid->starty- v2d->cur.ymin) / (v2d->cur.ymax - v2d->cur.ymin);
-			fac= vert.ymin + fac*(vert.ymax - vert.ymin);
+			fac = (grid->starty - v2d->cur.ymin) / (v2d->cur.ymax - v2d->cur.ymin);
+			fac = vert.ymin + fac * (vert.ymax - vert.ymin);
 			
-			dfac= (grid->dy) / (v2d->cur.ymax - v2d->cur.ymin);
-			dfac= dfac * (vert.ymax - vert.ymin);
+			dfac = (grid->dy) / (v2d->cur.ymax - v2d->cur.ymin);
+			dfac = dfac * (vert.ymax - vert.ymin);
 			
 			/* set starting value, and text color */
 			UI_ThemeColor(TH_TEXT);
-			val= grid->starty;
+			val = grid->starty;
 			
 			/* if vertical clamping (to whole numbers) is used (i.e. in Sequencer), apply correction */
 			if (vs->yclamp == V2D_GRID_CLAMP)
@@ -1735,13 +1735,13 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v
 				BLF_rotation_default(90.0f);
 				BLF_enable_default(BLF_ROTATION);
 
-				for (; fac < vert.ymax-10; fac+= dfac, val += grid->dy) {
+				for (; fac < vert.ymax - 10; fac += dfac, val += grid->dy) {
 					
 					/* make prints look nicer for scrollers */
-					if(fac < vert.ymin+10)
+					if (fac < vert.ymin + 10)
 						continue;
 					
-					scroll_printstr(scene, (float)(vert.xmax)-2.0f, fac, val, grid->powery, vs->yunits, 'v');
+					scroll_printstr(scene, (float)(vert.xmax) - 2.0f, fac, val, grid->powery, vs->yunits, 'v');
 				}
 				
 				BLF_disable_default(BLF_ROTATION);
@@ -1776,17 +1776,19 @@ void UI_view2d_scrollers_free(View2DScrollers *scrollers)
 void UI_view2d_listview_cell_to_view(View2D *v2d, short columnwidth, short rowheight, float startx, float starty, int column, int row, rctf *rect)
 {
 	/* sanity checks */
-	if ELEM(NULL, v2d, rect)
+	if (ELEM(NULL, v2d, rect)) {
 		return;
+	}
+
 	if ((columnwidth <= 0) && (rowheight <= 0)) {
-		rect->xmin= rect->xmax= 0.0f;
-		rect->ymin= rect->ymax= 0.0f;
+		rect->xmin = rect->xmax = 0.0f;
+		rect->ymin = rect->ymax = 0.0f;
 		return;
 	}
 	
 	/* x-coordinates */
-	rect->xmin= startx + (float)(columnwidth * column);
-	rect->xmax= startx + (float)(columnwidth * (column + 1));
+	rect->xmin = startx + (float)(columnwidth * column);
+	rect->xmax = startx + (float)(columnwidth * (column + 1));
 	
 	if ((v2d->align & V2D_ALIGN_NO_POS_X) && !(v2d->align & V2D_ALIGN_NO_NEG_X)) {
 		/* simply negate the values for the coordinates if in negative half */
@@ -1795,8 +1797,8 @@ void UI_view2d_listview_cell_to_view(View2D *v2d, short columnwidth, short rowhe
 	}
 	
 	/* y-coordinates */
-	rect->ymin= starty + (float)(rowheight * row);
-	rect->ymax= starty + (float)(rowheight * (row + 1));
+	rect->ymin = starty + (float)(rowheight * row);
+	rect->ymax = starty + (float)(rowheight * (row + 1));
 	
 	if ((v2d->align & V2D_ALIGN_NO_POS_Y) && !(v2d->align & V2D_ALIGN_NO_NEG_Y)) {
 		/* simply negate the values for the coordinates if in negative half */
@@ -1815,31 +1817,31 @@ void UI_view2d_listview_cell_to_view(View2D *v2d, short columnwidth, short rowhe
  *	- column, row				= the 'coordinates' of the relevant 'cell'
  */
 void UI_view2d_listview_view_to_cell(View2D *v2d, short columnwidth, short rowheight, float startx, float starty, 
-						float viewx, float viewy, int *column, int *row)
+                                     float viewx, float viewy, int *column, int *row)
 {
 	/* adjust view coordinates to be all positive ints, corrected for the start offset */
-	const int x= (int)(floorf(fabsf(viewx) + 0.5f) - startx);
-	const int y= (int)(floorf(fabsf(viewy) + 0.5f) - starty);
+	const int x = (int)(floorf(fabsf(viewx) + 0.5f) - startx);
+	const int y = (int)(floorf(fabsf(viewy) + 0.5f) - starty);
 	
 	/* sizes must not be negative */
 	if ( (v2d == NULL) || ((columnwidth <= 0) && (rowheight <= 0)) ) {
-		if (column) *column= 0;
-		if (row) *row= 0;
+		if (column) *column = 0;
+		if (row) *row = 0;
 		
 		return;
 	}
 	
 	/* get column */
 	if ((column) && (columnwidth > 0))
-		*column= x / columnwidth;
+		*column = x / columnwidth;
 	else if (column)
-		*column= 0;
+		*column = 0;
 	
 	/* get row */
 	if ((row) && (rowheight > 0))
-		*row= y / rowheight;
+		*row = y / rowheight;
 	else if (row)
-		*row= 0;
+		*row = 0;
 }
 
 /* Get the 'extreme' (min/max) column and row indices which are visible within the 'cur' rect 
@@ -1848,17 +1850,17 @@ void UI_view2d_listview_view_to_cell(View2D *v2d, short columnwidth, short rowhe
  *	- column/row_min/max		= the starting and ending column/row indices
  */
 void UI_view2d_listview_visible_cells(View2D *v2d, short columnwidth, short rowheight, float startx, float starty, 
-						int *column_min, int *column_max, int *row_min, int *row_max)
+                                      int *column_min, int *column_max, int *row_min, int *row_max)
 {
 	/* using 'cur' rect coordinates, call the cell-getting function to get the cells for this */
 	if (v2d) {
 		/* min */
 		UI_view2d_listview_view_to_cell(v2d, columnwidth, rowheight, startx, starty, 
-					v2d->cur.xmin, v2d->cur.ymin, column_min, row_min);
+		                                v2d->cur.xmin, v2d->cur.ymin, column_min, row_min);
 					
 		/* max*/
 		UI_view2d_listview_view_to_cell(v2d, columnwidth, rowheight, startx, starty, 
-					v2d->cur.xmax, v2d->cur.ymax, column_max, row_max);
+		                                v2d->cur.xmax, v2d->cur.ymax, column_max, row_max);
 	}
 }
 
@@ -1867,81 +1869,81 @@ void UI_view2d_listview_visible_cells(View2D *v2d, short columnwidth, short rowh
 
 /* Convert from screen/region space to 2d-View space 
  *	
- *	- x,y 			= coordinates to convert
+ *	- x,y           = coordinates to convert
  *	- viewx,viewy		= resultant coordinates
  */
-void UI_view2d_region_to_view(View2D *v2d, int x, int y, float *viewx, float *viewy)
+void UI_view2d_region_to_view(View2D *v2d, int x, int y, float *r_viewx, float *r_viewy)
 {
 	float div, ofs;
 
-	if (viewx) {
-		div= (float)(v2d->mask.xmax - v2d->mask.xmin);
-		ofs= (float)v2d->mask.xmin;
+	if (r_viewx) {
+		div = (float)(v2d->mask.xmax - v2d->mask.xmin);
+		ofs = (float)v2d->mask.xmin;
 		
-		*viewx= v2d->cur.xmin + (v2d->cur.xmax-v2d->cur.xmin) * ((float)x - ofs) / div;
+		*r_viewx = v2d->cur.xmin + (v2d->cur.xmax - v2d->cur.xmin) * ((float)x - ofs) / div;
 	}
 
-	if (viewy) {
-		div= (float)(v2d->mask.ymax - v2d->mask.ymin);
-		ofs= (float)v2d->mask.ymin;
+	if (r_viewy) {
+		div = (float)(v2d->mask.ymax - v2d->mask.ymin);
+		ofs = (float)v2d->mask.ymin;
 		
-		*viewy= v2d->cur.ymin + (v2d->cur.ymax - v2d->cur.ymin) * ((float)y - ofs) / div;
+		*r_viewy = v2d->cur.ymin + (v2d->cur.ymax - v2d->cur.ymin) * ((float)y - ofs) / div;
 	}
 }
 
 /* Convert from 2d-View space to screen/region space
  *	- Coordinates are clamped to lie within bounds of region
  *
- *	- x,y 				= coordinates to convert
- *	- regionx,regiony 	= resultant coordinates 
+ *	- x,y               = coordinates to convert
+ *	- regionx,regiony   = resultant coordinates
  */
 void UI_view2d_view_to_region(View2D *v2d, float x, float y, int *regionx, int *regiony)
 {
 	/* set initial value in case coordinate lies outside of bounds */
 	if (regionx)
-		*regionx= V2D_IS_CLIPPED;
+		*regionx = V2D_IS_CLIPPED;
 	if (regiony)
-		*regiony= V2D_IS_CLIPPED;
+		*regiony = V2D_IS_CLIPPED;
 	
 	/* express given coordinates as proportional values */
-	x= (x - v2d->cur.xmin) / (v2d->cur.xmax - v2d->cur.xmin);
-	y= (y - v2d->cur.ymin) / (v2d->cur.ymax - v2d->cur.ymin);
+	x = (x - v2d->cur.xmin) / (v2d->cur.xmax - v2d->cur.xmin);
+	y = (y - v2d->cur.ymin) / (v2d->cur.ymax - v2d->cur.ymin);
 	
 	/* check if values are within bounds */
-	if ((x>=0.0f) && (x<=1.0f) && (y>=0.0f) && (y<=1.0f)) {
+	if ((x >= 0.0f) && (x <= 1.0f) && (y >= 0.0f) && (y <= 1.0f)) {
 		if (regionx)
-			*regionx= (int)(v2d->mask.xmin + x*(v2d->mask.xmax-v2d->mask.xmin));
+			*regionx = (int)(v2d->mask.xmin + x * (v2d->mask.xmax - v2d->mask.xmin));
 		if (regiony)
-			*regiony= (int)(v2d->mask.ymin + y*(v2d->mask.ymax-v2d->mask.ymin));
+			*regiony = (int)(v2d->mask.ymin + y * (v2d->mask.ymax - v2d->mask.ymin));
 	}
 }
 
 /* Convert from 2d-view space to screen/region space
  *	- Coordinates are NOT clamped to lie within bounds of region
  *
- *	- x,y 				= coordinates to convert
- *	- regionx,regiony 	= resultant coordinates 
+ *	- x,y               = coordinates to convert
+ *	- regionx,regiony   = resultant coordinates
  */
 void UI_view2d_to_region_no_clip(View2D *v2d, float x, float y, int *regionx, int *regiony)
 {
 	/* step 1: express given coordinates as proportional values */
-	x= (x - v2d->cur.xmin) / (v2d->cur.xmax - v2d->cur.xmin);
-	y= (y - v2d->cur.ymin) / (v2d->cur.ymax - v2d->cur.ymin);
+	x = (x - v2d->cur.xmin) / (v2d->cur.xmax - v2d->cur.xmin);
+	y = (y - v2d->cur.ymin) / (v2d->cur.ymax - v2d->cur.ymin);
 	
 	/* step 2: convert proportional distances to screen coordinates  */
-	x= v2d->mask.xmin + x*(v2d->mask.xmax - v2d->mask.xmin);
-	y= v2d->mask.ymin + y*(v2d->mask.ymax - v2d->mask.ymin);
+	x = v2d->mask.xmin + x * (v2d->mask.xmax - v2d->mask.xmin);
+	y = v2d->mask.ymin + y * (v2d->mask.ymax - v2d->mask.ymin);
 	
 	/* although we don't clamp to lie within region bounds, we must avoid exceeding size of ints */
 	if (regionx) {
-		if (x < INT_MIN) *regionx= INT_MIN;
-		else if(x > INT_MAX) *regionx= INT_MAX;
-		else *regionx= (int)x;
+		if (x < INT_MIN) *regionx = INT_MIN;
+		else if (x > INT_MAX) *regionx = INT_MAX;
+		else *regionx = (int)x;
 	}
 	if (regiony) {
-		if (y < INT_MIN) *regiony= INT_MIN;
-		else if(y > INT_MAX) *regiony= INT_MAX;
-		else *regiony= (int)y;
+		if (y < INT_MIN) *regiony = INT_MIN;
+		else if (y > INT_MAX) *regiony = INT_MAX;
+		else *regiony = (int)y;
 	}
 }
 
@@ -1951,8 +1953,8 @@ void UI_view2d_to_region_no_clip(View2D *v2d, float x, float y, int *regionx, in
 /* View2D data by default resides in region, so get from region stored in context */
 View2D *UI_view2d_fromcontext(const bContext *C)
 {
-	ScrArea *area= CTX_wm_area(C);
-	ARegion *region= CTX_wm_region(C);
+	ScrArea *area = CTX_wm_area(C);
+	ARegion *region = CTX_wm_region(C);
 
 	if (area == NULL) return NULL;
 	if (region == NULL) return NULL;
@@ -1962,13 +1964,13 @@ View2D *UI_view2d_fromcontext(const bContext *C)
 /* same as above, but it returns regionwindow. Utility for pulldowns or buttons */
 View2D *UI_view2d_fromcontext_rwin(const bContext *C)
 {
-	ScrArea *sa= CTX_wm_area(C);
-	ARegion *region= CTX_wm_region(C);
+	ScrArea *sa = CTX_wm_area(C);
+	ARegion *region = CTX_wm_region(C);
 
 	if (sa == NULL) return NULL;
 	if (region == NULL) return NULL;
-	if (region->regiontype!=RGN_TYPE_WINDOW) {
-		ARegion *ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+	if (region->regiontype != RGN_TYPE_WINDOW) {
+		ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
 		return ar ? &(ar->v2d) : NULL;
 	}
 	return &(region->v2d);
@@ -1995,15 +1997,15 @@ void UI_view2d_getscale(View2D *v2d, float *x, float *y)
  *	
  *	- x,y	= mouse coordinates in screen (not region) space
  */
-short UI_view2d_mouse_in_scrollers (const bContext *C, View2D *v2d, int x, int y)
+short UI_view2d_mouse_in_scrollers(const bContext *C, View2D *v2d, int x, int y)
 {
-	ARegion *ar= CTX_wm_region(C);
+	ARegion *ar = CTX_wm_region(C);
 	int co[2];
-	int scroll= view2d_scroll_mapped(v2d->scroll);
+	int scroll = view2d_scroll_mapped(v2d->scroll);
 	
 	/* clamp x,y to region-coordinates first */
-	co[0]= x - ar->winrct.xmin;
-	co[1]= y - ar->winrct.ymin;
+	co[0] = x - ar->winrct.xmin;
+	co[1] = y - ar->winrct.ymin;
 	
 	/* check if within scrollbars */
 	if (scroll & V2D_SCROLL_HORIZONTAL) {
@@ -2020,7 +2022,7 @@ short UI_view2d_mouse_in_scrollers (const bContext *C, View2D *v2d, int x, int y
 /* ******************* view2d text drawing cache ******************** */
 
 /* assumes caches are used correctly, so for time being no local storage in v2d */
-static ListBase strings= {NULL, NULL};
+static ListBase strings = {NULL, NULL};
 
 typedef struct View2DString {
 	struct View2DString *next, *prev;
@@ -2037,36 +2039,36 @@ void UI_view2d_text_cache_add(View2D *v2d, float x, float y, const char *str, co
 {
 	int mval[2];
 	
-	UI_view2d_view_to_region(v2d, x, y, mval, mval+1);
+	UI_view2d_view_to_region(v2d, x, y, mval, mval + 1);
 	
-	if(mval[0]!=V2D_IS_CLIPPED && mval[1]!=V2D_IS_CLIPPED) {
-		int len= strlen(str)+1;
+	if (mval[0] != V2D_IS_CLIPPED && mval[1] != V2D_IS_CLIPPED) {
+		int len = strlen(str) + 1;
 		/* use calloc, rect has to be zeroe'd */
-		View2DString *v2s= MEM_callocN(sizeof(View2DString)+len, "View2DString");
-		char *v2s_str= (char *)(v2s+1);
+		View2DString *v2s = MEM_callocN(sizeof(View2DString) + len, "View2DString");
+		char *v2s_str = (char *)(v2s + 1);
 		memcpy(v2s_str, str, len);
 
 		BLI_addtail(&strings, v2s);
-		v2s->col.pack= *((int *)col);
-		v2s->mval[0]= mval[0];
-		v2s->mval[1]= mval[1];
+		v2s->col.pack = *((int *)col);
+		v2s->mval[0] = mval[0];
+		v2s->mval[1] = mval[1];
 	}
 }
 
 /* no clip (yet) */
 void UI_view2d_text_cache_rectf(View2D *v2d, rctf *rect, const char *str, const char col[4])
 {
-	int len= strlen(str)+1;
-	View2DString *v2s= MEM_callocN(sizeof(View2DString)+len, "View2DString");
-	char *v2s_str= (char *)(v2s+1);
+	int len = strlen(str) + 1;
+	View2DString *v2s = MEM_callocN(sizeof(View2DString) + len, "View2DString");
+	char *v2s_str = (char *)(v2s + 1);
 	memcpy(v2s_str, str, len);
 
 	UI_view2d_to_region_no_clip(v2d, rect->xmin, rect->ymin, &v2s->rect.xmin, &v2s->rect.ymin);
 	UI_view2d_to_region_no_clip(v2d, rect->xmax, rect->ymax, &v2s->rect.xmax, &v2s->rect.ymax);
 
-	v2s->col.pack= *((int *)col);
-	v2s->mval[0]= v2s->rect.xmin;
-	v2s->mval[1]= v2s->rect.ymin;
+	v2s->col.pack = *((int *)col);
+	v2s->mval[0] = v2s->rect.xmin;
+	v2s->mval[1] = v2s->rect.ymin;
 
 	BLI_addtail(&strings, v2s);
 }
@@ -2075,7 +2077,7 @@ void UI_view2d_text_cache_rectf(View2D *v2d, rctf *rect, const char *str, const
 void UI_view2d_text_cache_draw(ARegion *ar)
 {
 	View2DString *v2s;
-	int col_pack_prev= 0;
+	int col_pack_prev = 0;
 	
 	// glMatrixMode(GL_PROJECTION);
 	// glPushMatrix();
@@ -2083,24 +2085,24 @@ void UI_view2d_text_cache_draw(ARegion *ar)
 	// glPushMatrix();
 	ED_region_pixelspace(ar);
 	
-	for(v2s= strings.first; v2s; v2s= v2s->next) {
-		const char *str= (const char *)(v2s+1);
-		int xofs=0, yofs;
+	for (v2s = strings.first; v2s; v2s = v2s->next) {
+		const char *str = (const char *)(v2s + 1);
+		int xofs = 0, yofs;
 
-		yofs= ceil( 0.5f*(v2s->rect.ymax - v2s->rect.ymin - BLF_height_default("28")));
-		if(yofs<1) yofs= 1;
+		yofs = ceil(0.5f * (v2s->rect.ymax - v2s->rect.ymin - BLF_height_default("28")));
+		if (yofs < 1) yofs = 1;
 
-		if(col_pack_prev != v2s->col.pack) {
+		if (col_pack_prev != v2s->col.pack) {
 			glColor3ubv(v2s->col.ub);
-			col_pack_prev= v2s->col.pack;
+			col_pack_prev = v2s->col.pack;
 		}
 
-		if(v2s->rect.xmin >= v2s->rect.xmax)
-			BLF_draw_default((float)v2s->mval[0]+xofs, (float)v2s->mval[1]+yofs, 0.0, str, BLF_DRAW_STR_DUMMY_MAX);
+		if (v2s->rect.xmin >= v2s->rect.xmax)
+			BLF_draw_default((float)v2s->mval[0] + xofs, (float)v2s->mval[1] + yofs, 0.0, str, BLF_DRAW_STR_DUMMY_MAX);
 		else {
-			BLF_clipping_default(v2s->rect.xmin-4, v2s->rect.ymin-4, v2s->rect.xmax+4, v2s->rect.ymax+4);
+			BLF_clipping_default(v2s->rect.xmin - 4, v2s->rect.ymin - 4, v2s->rect.xmax + 4, v2s->rect.ymax + 4);
 			BLF_enable_default(BLF_CLIPPING);
-			BLF_draw_default(v2s->rect.xmin+xofs, v2s->rect.ymin+yofs, 0.0f, str, BLF_DRAW_STR_DUMMY_MAX);
+			BLF_draw_default(v2s->rect.xmin + xofs, v2s->rect.ymin + yofs, 0.0f, str, BLF_DRAW_STR_DUMMY_MAX);
 			BLF_disable_default(BLF_CLIPPING);
 		}
 	}
@@ -2110,7 +2112,7 @@ void UI_view2d_text_cache_draw(ARegion *ar)
 	// glMatrixMode(GL_MODELVIEW);
 	// glPopMatrix();
 	
-	if(strings.first) 
+	if (strings.first) 
 		BLI_freelistN(&strings);
 }
 
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 234b273..129a47c 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -55,7 +55,7 @@
 
 static int view2d_poll(bContext *C)
 {
-	ARegion *ar= CTX_wm_region(C);
+	ARegion *ar = CTX_wm_region(C);
 
 	return (ar != NULL) && (ar->v2d.flag & V2D_IS_INITIALISED);
 }
@@ -63,37 +63,37 @@ static int view2d_poll(bContext *C)
 /* ********************************************************* */
 /* VIEW PANNING OPERATOR								 */
 
-/* 	This group of operators come in several forms:
+/*  This group of operators come in several forms:
  *		1) Modal 'dragging' with MMB - where movement of mouse dictates amount to pan view by
  *		2) Scrollwheel 'steps' - rolling mousewheel by one step moves view by predefined amount
  *
  *	In order to make sure this works, each operator must define the following RNA-Operator Props:
- *		deltax, deltay 	- define how much to move view by (relative to zoom-correction factor)
+ *		deltax, deltay  - define how much to move view by (relative to zoom-correction factor)
  */
 
 /* ------------------ Shared 'core' stuff ---------------------- */
  
 /* temp customdata for operator */
 typedef struct v2dViewPanData {
-	bScreen *sc;			/* screen where view pan was initiated */
-	ScrArea *sa;			/* area where view pan was initiated */
-	ARegion *ar;			/* region where view pan was initiated */
-	View2D *v2d;			/* view2d we're operating in */
-	
-	float facx, facy;		/* amount to move view relative to zoom */
-	
-		/* options for version 1 */
-	int startx, starty;		/* mouse x/y values in window when operator was initiated */
-	int lastx, lasty;		/* previous x/y values of mouse in window */
-	int invoke_event;		/* event starting pan, for modal exit */
+	bScreen *sc;            /* screen where view pan was initiated */
+	ScrArea *sa;            /* area where view pan was initiated */
+	ARegion *ar;            /* region where view pan was initiated */
+	View2D *v2d;            /* view2d we're operating in */
+
+	float facx, facy;       /* amount to move view relative to zoom */
+
+	/* options for version 1 */
+	int startx, starty;     /* mouse x/y values in window when operator was initiated */
+	int lastx, lasty;       /* previous x/y values of mouse in window */
+	int invoke_event;       /* event starting pan, for modal exit */
 	
-	short in_scroller;		/* for MMB in scrollers (old feature in past, but now not that useful) */
+	short in_scroller;      /* for MMB in scrollers (old feature in past, but now not that useful) */
 } v2dViewPanData;
  
-/* initialise panning customdata */
+/* initialize panning customdata */
 static int view_pan_init(bContext *C, wmOperator *op)
 {
-	ARegion *ar= CTX_wm_region(C);
+	ARegion *ar = CTX_wm_region(C);
 	v2dViewPanData *vpd;
 	View2D *v2d;
 	float winx, winy;
@@ -103,25 +103,25 @@ static int view_pan_init(bContext *C, wmOperator *op)
 		return 0;
 		
 	/* check if panning is allowed at all */
-	v2d= &ar->v2d;
+	v2d = &ar->v2d;
 	if ((v2d->keepofs & V2D_LOCKOFS_X) && (v2d->keepofs & V2D_LOCKOFS_Y))
 		return 0;
 	
 	/* set custom-data for operator */
-	vpd= MEM_callocN(sizeof(v2dViewPanData), "v2dViewPanData");
-	op->customdata= vpd;
+	vpd = MEM_callocN(sizeof(v2dViewPanData), "v2dViewPanData");
+	op->customdata = vpd;
 	
 	/* set pointers to owners */
-	vpd->sc= CTX_wm_screen(C);
-	vpd->sa= CTX_wm_area(C);
-	vpd->v2d= v2d;
+	vpd->sc = CTX_wm_screen(C);
+	vpd->sa = CTX_wm_area(C);
+	vpd->v2d = v2d;
 	vpd->ar = ar;
 	
 	/* calculate translation factor - based on size of view */
-	winx= (float)(ar->winrct.xmax - ar->winrct.xmin + 1);
-	winy= (float)(ar->winrct.ymax - ar->winrct.ymin + 1);
-	vpd->facx= (v2d->cur.xmax - v2d->cur.xmin) / winx;
-	vpd->facy= (v2d->cur.ymax - v2d->cur.ymin) / winy;
+	winx = (float)(ar->winrct.xmax - ar->winrct.xmin + 1);
+	winy = (float)(ar->winrct.ymax - ar->winrct.ymin + 1);
+	vpd->facx = (v2d->cur.xmax - v2d->cur.xmin) / winx;
+	vpd->facy = (v2d->cur.ymax - v2d->cur.ymin) / winy;
 	
 	return 1;
 }
@@ -129,20 +129,20 @@ static int view_pan_init(bContext *C, wmOperator *op)
 /* apply transform to view (i.e. adjust 'cur' rect) */
 static void view_pan_apply(wmOperator *op)
 {
-	v2dViewPanData *vpd= op->customdata;
-	View2D *v2d= vpd->v2d;
+	v2dViewPanData *vpd = op->customdata;
+	View2D *v2d = vpd->v2d;
 	float dx, dy;
 	
 	/* calculate amount to move view by */
-	dx= vpd->facx * (float)RNA_int_get(op->ptr, "deltax");
-	dy= vpd->facy * (float)RNA_int_get(op->ptr, "deltay");
+	dx = vpd->facx * (float)RNA_int_get(op->ptr, "deltax");
+	dy = vpd->facy * (float)RNA_int_get(op->ptr, "deltay");
 	
 	/* only move view on an axis if change is allowed */
-	if ((v2d->keepofs & V2D_LOCKOFS_X)==0) {
+	if ((v2d->keepofs & V2D_LOCKOFS_X) == 0) {
 		v2d->cur.xmin += dx;
 		v2d->cur.xmax += dx;
 	}
-	if ((v2d->keepofs & V2D_LOCKOFS_Y)==0) {
+	if ((v2d->keepofs & V2D_LOCKOFS_Y) == 0) {
 		v2d->cur.ymin += dy;
 		v2d->cur.ymax += dy;
 	}
@@ -156,9 +156,9 @@ static void view_pan_apply(wmOperator *op)
 	UI_view2d_sync(vpd->sc, vpd->sa, v2d, V2D_LOCK_COPY);
 	
 	/* exceptions */
-	if (vpd->sa->spacetype==SPACE_OUTLINER) {
+	if (vpd->sa->spacetype == SPACE_OUTLINER) {
 		/* don't rebuild full tree, since we're just changing our view */
-		SpaceOops *soops= vpd->sa->spacedata.first;
+		SpaceOops *soops = vpd->sa->spacedata.first;
 		soops->storeflag |= SO_TREESTORE_REDRAW;
 	}
 }
@@ -168,7 +168,7 @@ static void view_pan_exit(wmOperator *op)
 {
 	if (op->customdata) {
 		MEM_freeN(op->customdata);
-		op->customdata= NULL;				
+		op->customdata = NULL;
 	}
 } 
  
@@ -188,7 +188,7 @@ static int view_pan_exec(bContext *C, wmOperator *op)
 /* set up modal operator and relevant settings */
 static int view_pan_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	wmWindow *window= CTX_wm_window(C);
+	wmWindow *window = CTX_wm_window(C);
 	v2dViewPanData *vpd;
 	View2D *v2d;
 	
@@ -196,13 +196,13 @@ static int view_pan_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	if (!view_pan_init(C, op))
 		return OPERATOR_PASS_THROUGH;
 	
-	vpd= op->customdata;
-	v2d= vpd->v2d;
+	vpd = op->customdata;
+	v2d = vpd->v2d;
 	
 	/* set initial settings */
-	vpd->startx= vpd->lastx= event->x;
-	vpd->starty= vpd->lasty= event->y;
-	vpd->invoke_event= event->type;
+	vpd->startx = vpd->lastx = event->x;
+	vpd->starty = vpd->lasty = event->y;
+	vpd->invoke_event = event->type;
 	
 	if (event->type == MOUSEPAN) {
 		RNA_int_set(op->ptr, "deltax", event->prevx - event->x);
@@ -232,7 +232,7 @@ static int view_pan_invoke(bContext *C, wmOperator *op, wmEvent *event)
 /* handle user input - calculations of mouse-movement need to be done here, not in the apply callback! */
 static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
-	v2dViewPanData *vpd= op->customdata;
+	v2dViewPanData *vpd = op->customdata;
 	
 	/* execute the events */
 	switch (event->type) {
@@ -242,17 +242,18 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event)
 			RNA_int_set(op->ptr, "deltax", (vpd->lastx - event->x));
 			RNA_int_set(op->ptr, "deltay", (vpd->lasty - event->y));
 			
-			vpd->lastx= event->x;
-			vpd->lasty= event->y;
+			vpd->lastx = event->x;
+			vpd->lasty = event->y;
 			
 			view_pan_apply(op);
 		}
-			break;
-		/* XXX - Mode switching isn't implemented. See comments in 36818.
-		 * switch to zoom *
+		break;
+			/* XXX - Mode switching isn't implemented. See comments in 36818.
+			 * switch to zoom */
+#if 0
 		case LEFTMOUSE:
-			if (event->val==KM_PRESS) {
-				* calculate overall delta mouse-movement for redo *
+			if (event->val == KM_PRESS) {
+				/* calculate overall delta mouse-movement for redo */
 				RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx));
 				RNA_int_set(op->ptr, "deltay", (vpd->starty - vpd->lasty));
 				
@@ -260,11 +261,11 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event)
 				WM_cursor_restore(CTX_wm_window(C));
 				WM_operator_name_call(C, "VIEW2D_OT_zoom", WM_OP_INVOKE_DEFAULT, NULL);
 				return OPERATOR_FINISHED;
-			}*/
-			
+			}
+#endif
 		default:
-			if (event->type == vpd->invoke_event || event->type==ESCKEY) {
-				if (event->val==KM_RELEASE) {
+			if (event->type == vpd->invoke_event || event->type == ESCKEY) {
+				if (event->val == KM_RELEASE) {
 					/* calculate overall delta mouse-movement for redo */
 					RNA_int_set(op->ptr, "deltax", (vpd->startx - vpd->lastx));
 					RNA_int_set(op->ptr, "deltay", (vpd->starty - vpd->lasty));
@@ -290,18 +291,18 @@ static int view_pan_cancel(bContext *UNUSED(C), wmOperator *op)
 static void VIEW2D_OT_pan(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Pan View";
-	ot->description= "Pan the view";
-	ot->idname= "VIEW2D_OT_pan";
+	ot->name = "Pan View";
+	ot->description = "Pan the view";
+	ot->idname = "VIEW2D_OT_pan";
 	
 	/* api callbacks */
-	ot->exec= view_pan_exec;
-	ot->invoke= view_pan_invoke;
-	ot->modal= view_pan_modal;
-	ot->cancel= view_pan_cancel;
+	ot->exec = view_pan_exec;
+	ot->invoke = view_pan_invoke;
+	ot->modal = view_pan_modal;
+	ot->cancel = view_pan_cancel;
 	
 	/* operator is modal */
-	ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
+	ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_POINTER;
 	
 	/* rna - must keep these in sync with the other operators */
 	RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX);
@@ -315,12 +316,12 @@ static int view_scrollright_exec(bContext *C, wmOperator *op)
 {
 	v2dViewPanData *vpd;
 	
-	/* initialise default settings (and validate if ok to run) */
+	/* initialize default settings (and validate if ok to run) */
 	if (!view_pan_init(C, op))
 		return OPERATOR_PASS_THROUGH;
 		
 	/* also, check if can pan in horizontal axis */
-	vpd= op->customdata;
+	vpd = op->customdata;
 	if (vpd->v2d->keepofs & V2D_LOCKOFS_X) {
 		view_pan_exit(op);
 		return OPERATOR_PASS_THROUGH;
@@ -340,12 +341,12 @@ static int view_scrollright_exec(bContext *C, wmOperator *op)
 static void VIEW2D_OT_scroll_right(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Scroll Right";
-	ot->description= "Scroll the view right";
-	ot->idname= "VIEW2D_OT_scroll_right";
+	ot->name = "Scroll Right";
+	ot->description = "Scroll the view right";
+	ot->idname = "VIEW2D_OT_scroll_right";
 	
 	/* api callbacks */
-	ot->exec= view_scrollright_exec;
+	ot->exec = view_scrollright_exec;
 	
 	/* rna - must keep these in sync with the other operators */
 	RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX);
@@ -359,12 +360,12 @@ static int view_scrollleft_exec(bContext *C, wmOperator *op)
 {
 	v2dViewPanData *vpd;
 	
-	/* initialise default settings (and validate if ok to run) */
+	/* initialize default settings (and validate if ok to run) */
 	if (!view_pan_init(C, op))
 		return OPERATOR_PASS_THROUGH;
 		
 	/* also, check if can pan in horizontal axis */
-	vpd= op->customdata;
+	vpd = op->customdata;
 	if (vpd->v2d->keepofs & V2D_LOCKOFS_X) {
 		view_pan_exit(op);
 		return OPERATOR_PASS_THROUGH;
@@ -384,12 +385,12 @@ static int view_scrollleft_exec(bContext *C, wmOperator *op)
 static void VIEW2D_OT_scroll_left(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Scroll Left";
-	ot->description= "Scroll the view left";
-	ot->idname= "VIEW2D_OT_scroll_left";
+	ot->name = "Scroll Left";
+	ot->description = "Scroll the view left";
+	ot->idname = "VIEW2D_OT_scroll_left";
 	
 	/* api callbacks */
-	ot->exec= view_scrollleft_exec;
+	ot->exec = view_scrollleft_exec;
 	
 	/* rna - must keep these in sync with the other operators */
 	RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX);
@@ -402,12 +403,12 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op)
 {
 	v2dViewPanData *vpd;
 	
-	/* initialise default settings (and validate if ok to run) */
+	/* initialize default settings (and validate if ok to run) */
 	if (!view_pan_init(C, op))
 		return OPERATOR_PASS_THROUGH;
 		
 	/* also, check if can pan in vertical axis */
-	vpd= op->customdata;
+	vpd = op->customdata;
 	if (vpd->v2d->keepofs & V2D_LOCKOFS_Y) {
 		view_pan_exit(op);
 		return OPERATOR_PASS_THROUGH;
@@ -417,8 +418,8 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op)
 	RNA_int_set(op->ptr, "deltax", 0);
 	RNA_int_set(op->ptr, "deltay", -40);
 	
-	if(RNA_boolean_get(op->ptr, "page")) {
-		ARegion *ar= CTX_wm_region(C);
+	if (RNA_boolean_get(op->ptr, "page")) {
+		ARegion *ar = CTX_wm_region(C);
 		RNA_int_set(op->ptr, "deltay", ar->v2d.mask.ymin - ar->v2d.mask.ymax);
 	}
 	
@@ -432,12 +433,12 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op)
 static void VIEW2D_OT_scroll_down(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Scroll Down";
-	ot->description= "Scroll the view down";
-	ot->idname= "VIEW2D_OT_scroll_down";
+	ot->name = "Scroll Down";
+	ot->description = "Scroll the view down";
+	ot->idname = "VIEW2D_OT_scroll_down";
 	
 	/* api callbacks */
-	ot->exec= view_scrolldown_exec;
+	ot->exec = view_scrolldown_exec;
 	
 	/* rna - must keep these in sync with the other operators */
 	RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX);
@@ -452,12 +453,12 @@ static int view_scrollup_exec(bContext *C, wmOperator *op)
 {
 	v2dViewPanData *vpd;
 	
-	/* initialise default settings (and validate if ok to run) */
+	/* initialize default settings (and validate if ok to run) */
 	if (!view_pan_init(C, op))
 		return OPERATOR_PASS_THROUGH;
 		
 	/* also, check if can pan in vertical axis */
-	vpd= op->customdata;
+	vpd = op->customdata;
 	if (vpd->v2d->keepofs & V2D_LOCKOFS_Y) {
 		view_pan_exit(op);
 		return OPERATOR_PASS_THROUGH;
@@ -467,8 +468,8 @@ static int view_scrollup_exec(bContext *C, wmOperator *op)
 	RNA_int_set(op->ptr, "deltax", 0);
 	RNA_int_set(op->ptr, "deltay", 40);
 	
-	if(RNA_boolean_get(op->ptr, "page")) {
-		ARegion *ar= CTX_wm_region(C);
+	if (RNA_boolean_get(op->ptr, "page")) {
+		ARegion *ar = CTX_wm_region(C);
 		RNA_int_set(op->ptr, "deltay", ar->v2d.mask.ymax - ar->v2d.mask.ymin);
 	}
 	
@@ -482,12 +483,12 @@ static int view_scrollup_exec(bContext *C, wmOperator *op)
 static void VIEW2D_OT_scroll_up(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Scroll Up";
-	ot->description= "Scroll the view up";
-	ot->idname= "VIEW2D_OT_scroll_up";
+	ot->name = "Scroll Up";
+	ot->description = "Scroll the view up";
+	ot->idname = "VIEW2D_OT_scroll_up";
 	
 	/* api callbacks */
-	ot->exec= view_scrollup_exec;
+	ot->exec = view_scrollup_exec;
 	
 	/* rna - must keep these in sync with the other operators */
 	RNA_def_int(ot->srna, "deltax", 0, INT_MIN, INT_MAX, "Delta X", "", INT_MIN, INT_MAX);
@@ -498,7 +499,7 @@ static void VIEW2D_OT_scroll_up(wmOperatorType *ot)
 /* ********************************************************* */
 /* SINGLE-STEP VIEW ZOOMING OPERATOR						 */
 
-/* 	This group of operators come in several forms:
+/*  This group of operators come in several forms:
  *		1) Scrollwheel 'steps' - rolling mousewheel by one step zooms view by predefined amount
  *		2) Scrollwheel 'steps' + alt + ctrl/shift - zooms view on one axis only (ctrl=x, shift=y)  // XXX this could be implemented...
  *		3) Pad +/- Keys - pressing each key moves the zooms the view by a predefined amount
@@ -513,42 +514,42 @@ static void VIEW2D_OT_scroll_up(wmOperatorType *ot)
 
 /* temp customdata for operator */
 typedef struct v2dViewZoomData {
-	View2D *v2d;			/* view2d we're operating in */
+	View2D *v2d;            /* view2d we're operating in */
 	ARegion *ar;
 
 	/* needed for continuous zoom */
 	wmTimer *timer;
 	double timer_lastdraw;
 
-	int lastx, lasty;		/* previous x/y values of mouse in window */
-	int invoke_event;		/* event type that invoked, for modal exits */
-	float dx, dy;			/* running tally of previous delta values (for obtaining final zoom) */
-	float mx_2d, my_2d;		/* initial mouse location in v2d coords */
+	int lastx, lasty;       /* previous x/y values of mouse in window */
+	int invoke_event;       /* event type that invoked, for modal exits */
+	float dx, dy;           /* running tally of previous delta values (for obtaining final zoom) */
+	float mx_2d, my_2d;     /* initial mouse location in v2d coords */
 } v2dViewZoomData;
 
 
-/* initialise panning customdata */
+/* initialize panning customdata */
 static int view_zoomdrag_init(bContext *C, wmOperator *op)
 {
-	ARegion *ar= CTX_wm_region(C);
+	ARegion *ar = CTX_wm_region(C);
 	v2dViewZoomData *vzd;
 	View2D *v2d;
 	
 	/* regions now have v2d-data by default, so check for region */
 	if (ar == NULL)
 		return 0;
-	v2d= &ar->v2d;
+	v2d = &ar->v2d;
 	
 	/* check that 2d-view is zoomable */
 	if ((v2d->keepzoom & V2D_LOCKZOOM_X) && (v2d->keepzoom & V2D_LOCKZOOM_Y))
 		return 0;
 	
 	/* set custom-data for operator */
-	vzd= MEM_callocN(sizeof(v2dViewZoomData), "v2dViewZoomData");
-	op->customdata= vzd;
+	vzd = MEM_callocN(sizeof(v2dViewZoomData), "v2dViewZoomData");
+	op->customdata = vzd;
 	
 	/* set pointers to owners */
-	vzd->v2d= v2d;
+	vzd->v2d = v2d;
 	vzd->ar = ar;
 	
 	return 1;
@@ -557,13 +558,13 @@ static int view_zoomdrag_init(bContext *C, wmOperator *op)
 /* check if step-zoom can be applied */
 static int view_zoom_poll(bContext *C)
 {
-	ARegion *ar= CTX_wm_region(C);
+	ARegion *ar = CTX_wm_region(C);
 	View2D *v2d;
 	
 	/* check if there's a region in context to work with */
 	if (ar == NULL)
 		return 0;
-	v2d= &ar->v2d;
+	v2d = &ar->v2d;
 	
 	/* check that 2d-view is zoomable */
 	if ((v2d->keepzoom & V2D_LOCKZOOM_X) && (v2d->keepzoom & V2D_LOCKZOOM_Y))
@@ -576,42 +577,42 @@ static int view_zoom_poll(bContext *C)
 /* apply transform to view (i.e. adjust 'cur' rect) */
 static void view_zoomstep_apply(bContext *C, wmOperator *op)
 {
-	v2dViewZoomData *vzd= op->customdata;
-	ARegion *ar= CTX_wm_region(C);
-	View2D *v2d= &ar->v2d;
+	v2dViewZoomData *vzd = op->customdata;
+	ARegion *ar = CTX_wm_region(C);
+	View2D *v2d = &ar->v2d;
 	float dx, dy, facx, facy;
 	
 	/* calculate amount to move view by, ensuring symmetry so the
 	 * old zoom level is restored after zooming back the same amount 
 	 */
-	facx= RNA_float_get(op->ptr, "zoomfacx");
-	facy= RNA_float_get(op->ptr, "zoomfacy");
+	facx = RNA_float_get(op->ptr, "zoomfacx");
+	facy = RNA_float_get(op->ptr, "zoomfacy");
 
 	if (facx >= 0.0f) {
-		dx= (v2d->cur.xmax - v2d->cur.xmin) * facx;
-		dy= (v2d->cur.ymax - v2d->cur.ymin) * facy;
+		dx = (v2d->cur.xmax - v2d->cur.xmin) * facx;
+		dy = (v2d->cur.ymax - v2d->cur.ymin) * facy;
 	}
 	else {
-		dx= ((v2d->cur.xmax - v2d->cur.xmin)/(1.0f + 2.0f*facx)) * facx;
-		dy= ((v2d->cur.ymax - v2d->cur.ymin)/(1.0f + 2.0f*facy)) * facy;
+		dx = ((v2d->cur.xmax - v2d->cur.xmin) / (1.0f + 2.0f * facx)) * facx;
+		dy = ((v2d->cur.ymax - v2d->cur.ymin) / (1.0f + 2.0f * facy)) * facy;
 	}
 
 	/* only resize view on an axis if change is allowed */
-	if ((v2d->keepzoom & V2D_LOCKZOOM_X)==0) {
+	if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0) {
 		if (v2d->keepofs & V2D_LOCKOFS_X) {
-			v2d->cur.xmax -= 2*dx;
+			v2d->cur.xmax -= 2 * dx;
 		}
 		else if (v2d->keepofs & V2D_KEEPOFS_X) {
 			if (v2d->align & V2D_ALIGN_NO_POS_X)
-				v2d->cur.xmin += 2*dx;
+				v2d->cur.xmin += 2 * dx;
 			else
-				v2d->cur.xmax -= 2*dx;
+				v2d->cur.xmax -= 2 * dx;
 		}
 		else {
 			if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
-				float mval_fac = (vzd->mx_2d - v2d->cur.xmin) / (v2d->cur.xmax-v2d->cur.xmin);
+				float mval_fac = (vzd->mx_2d - v2d->cur.xmin) / (v2d->cur.xmax - v2d->cur.xmin);
 				float mval_faci = 1.0f - mval_fac;
-				float ofs= (mval_fac * dx) - (mval_faci * dx);
+				float ofs = (mval_fac * dx) - (mval_faci * dx);
 				
 				v2d->cur.xmin += ofs + dx;
 				v2d->cur.xmax += ofs - dx;
@@ -622,21 +623,21 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op)
 			}
 		}
 	}
-	if ((v2d->keepzoom & V2D_LOCKZOOM_Y)==0) {
+	if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0) {
 		if (v2d->keepofs & V2D_LOCKOFS_Y) {
-			v2d->cur.ymax -= 2*dy;
+			v2d->cur.ymax -= 2 * dy;
 		}
 		else if (v2d->keepofs & V2D_KEEPOFS_Y) {
 			if (v2d->align & V2D_ALIGN_NO_POS_Y)
-				v2d->cur.ymin += 2*dy;
+				v2d->cur.ymin += 2 * dy;
 			else
-				v2d->cur.ymax -= 2*dy;
+				v2d->cur.ymax -= 2 * dy;
 		}
 		else {
 			if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
-				float mval_fac = (vzd->my_2d - v2d->cur.ymin) / (v2d->cur.ymax-v2d->cur.ymin);
+				float mval_fac = (vzd->my_2d - v2d->cur.ymin) / (v2d->cur.ymax - v2d->cur.ymin);
 				float mval_faci = 1.0f - mval_fac;
-				float ofs= (mval_fac * dy) - (mval_faci * dy);
+				float ofs = (mval_fac * dy) - (mval_faci * dy);
 				
 				v2d->cur.ymin += ofs + dy;
 				v2d->cur.ymax += ofs - dy;
@@ -663,7 +664,7 @@ static void view_zoomstep_exit(wmOperator *op)
 {
 	if (op->customdata) {
 		MEM_freeN(op->customdata);
-		op->customdata= NULL;				
+		op->customdata = NULL;
 	}
 }
 
@@ -693,15 +694,15 @@ static int view_zoomin_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	if (!view_zoomdrag_init(C, op))
 		return OPERATOR_PASS_THROUGH;
 	
-	vzd= op->customdata;
+	vzd = op->customdata;
 	
 	if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
-		ARegion *ar= CTX_wm_region(C);
+		ARegion *ar = CTX_wm_region(C);
 		
 		/* store initial mouse position (in view space) */
 		UI_view2d_region_to_view(&ar->v2d, 
-				event->mval[0], event->mval[1],
-				&vzd->mx_2d, &vzd->my_2d);
+		                         event->mval[0], event->mval[1],
+		                         &vzd->mx_2d, &vzd->my_2d);
 	}
 	
 	return view_zoomin_exec(C, op);
@@ -710,14 +711,14 @@ static int view_zoomin_invoke(bContext *C, wmOperator *op, wmEvent *event)
 static void VIEW2D_OT_zoom_in(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Zoom In";
-	ot->description= "Zoom in the view";
-	ot->idname= "VIEW2D_OT_zoom_in";
+	ot->name = "Zoom In";
+	ot->description = "Zoom in the view";
+	ot->idname = "VIEW2D_OT_zoom_in";
 	
 	/* api callbacks */
-	ot->invoke= view_zoomin_invoke;
-//	ot->exec= view_zoomin_exec;  // XXX, needs view_zoomdrag_init called first.
-	ot->poll= view_zoom_poll;
+	ot->invoke = view_zoomin_invoke;
+//	ot->exec = view_zoomin_exec;  // XXX, needs view_zoomdrag_init called first.
+	ot->poll = view_zoom_poll;
 	
 	/* rna - must keep these in sync with the other operators */
 	RNA_def_float(ot->srna, "zoomfacx", 0, -FLT_MAX, FLT_MAX, "Zoom Factor X", "", -FLT_MAX, FLT_MAX);
@@ -750,15 +751,15 @@ static int view_zoomout_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	if (!view_zoomdrag_init(C, op))
 		return OPERATOR_PASS_THROUGH;
 
-	vzd= op->customdata;
+	vzd = op->customdata;
 	
-	if(U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
-		ARegion *ar= CTX_wm_region(C);
+	if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
+		ARegion *ar = CTX_wm_region(C);
 		
 		/* store initial mouse position (in view space) */
 		UI_view2d_region_to_view(&ar->v2d, 
-				event->mval[0], event->mval[1],
-				&vzd->mx_2d, &vzd->my_2d);
+		                         event->mval[0], event->mval[1],
+		                         &vzd->mx_2d, &vzd->my_2d);
 	}
 	
 	return view_zoomout_exec(C, op);
@@ -767,14 +768,14 @@ static int view_zoomout_invoke(bContext *C, wmOperator *op, wmEvent *event)
 static void VIEW2D_OT_zoom_out(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Zoom Out";
-	ot->description= "Zoom out the view";
-	ot->idname= "VIEW2D_OT_zoom_out";
+	ot->name = "Zoom Out";
+	ot->description = "Zoom out the view";
+	ot->idname = "VIEW2D_OT_zoom_out";
 	
 	/* api callbacks */
-	ot->invoke= view_zoomout_invoke;
-//	ot->exec= view_zoomout_exec; // XXX, needs view_zoomdrag_init called first.
-	ot->poll= view_zoom_poll;
+	ot->invoke = view_zoomout_invoke;
+//	ot->exec = view_zoomout_exec; // XXX, needs view_zoomdrag_init called first.
+	ot->poll = view_zoom_poll;
 	
 	/* rna - must keep these in sync with the other operators */
 	RNA_def_float(ot->srna, "zoomfacx", 0, -FLT_MAX, FLT_MAX, "Zoom Factor X", "", -FLT_MAX, FLT_MAX);
@@ -784,7 +785,7 @@ static void VIEW2D_OT_zoom_out(wmOperatorType *ot)
 /* ********************************************************* */
 /* DRAG-ZOOM OPERATOR									 */
 
-/* 	MMB Drag - allows non-uniform scaling by dragging mouse
+/*  MMB Drag - allows non-uniform scaling by dragging mouse
  *
  *	In order to make sure this works, each operator must define the following RNA-Operator Props:
  *		deltax, deltay	- amounts to add to each side of the 'cur' rect
@@ -793,35 +794,35 @@ static void VIEW2D_OT_zoom_out(wmOperatorType *ot)
 /* apply transform to view (i.e. adjust 'cur' rect) */
 static void view_zoomdrag_apply(bContext *C, wmOperator *op)
 {
-	v2dViewZoomData *vzd= op->customdata;
-	View2D *v2d= vzd->v2d;
+	v2dViewZoomData *vzd = op->customdata;
+	View2D *v2d = vzd->v2d;
 	float dx, dy;
 	
 	/* get amount to move view by */
-	dx= RNA_float_get(op->ptr, "deltax");
-	dy= RNA_float_get(op->ptr, "deltay");
+	dx = RNA_float_get(op->ptr, "deltax");
+	dy = RNA_float_get(op->ptr, "deltay");
 
-	/* continous zoom shouldn't move that fast... */
+	/* 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();
-		float time_step= (float)(time - vzd->timer_lastdraw);
+		double time = PIL_check_seconds_timer();
+		float time_step = (float)(time - vzd->timer_lastdraw);
 
 		dx *= time_step * 0.5f;
 		dy *= time_step * 0.5f;
 		
-		vzd->timer_lastdraw= time;
+		vzd->timer_lastdraw = time;
 	}
 
 	/* only move view on an axis if change is allowed */
-	if ((v2d->keepzoom & V2D_LOCKZOOM_X)==0) {
+	if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0) {
 		if (v2d->keepofs & V2D_LOCKOFS_X) {
-			v2d->cur.xmax -= 2*dx;
+			v2d->cur.xmax -= 2 * dx;
 		}
 		else {
 			if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
-				float mval_fac = (vzd->mx_2d - v2d->cur.xmin) / (v2d->cur.xmax-v2d->cur.xmin);
+				float mval_fac = (vzd->mx_2d - v2d->cur.xmin) / (v2d->cur.xmax - v2d->cur.xmin);
 				float mval_faci = 1.0f - mval_fac;
-				float ofs= (mval_fac * dx) - (mval_faci * dx);
+				float ofs = (mval_fac * dx) - (mval_faci * dx);
 				
 				v2d->cur.xmin += ofs + dx;
 				v2d->cur.xmax += ofs - dx;
@@ -832,15 +833,15 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op)
 			}
 		}
 	}
-	if ((v2d->keepzoom & V2D_LOCKZOOM_Y)==0) {
+	if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0) {
 		if (v2d->keepofs & V2D_LOCKOFS_Y) {
-			v2d->cur.ymax -= 2*dy;
+			v2d->cur.ymax -= 2 * dy;
 		}
 		else {
 			if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
-				float mval_fac = (vzd->my_2d - v2d->cur.ymin) / (v2d->cur.ymax-v2d->cur.ymin);
+				float mval_fac = (vzd->my_2d - v2d->cur.ymin) / (v2d->cur.ymax - v2d->cur.ymin);
 				float mval_faci = 1.0f - mval_fac;
-				float ofs= (mval_fac * dy) - (mval_faci * dy);
+				float ofs = (mval_fac * dy) - (mval_faci * dy);
 				
 				v2d->cur.ymin += ofs + dy;
 				v2d->cur.ymax += ofs - dy;
@@ -864,13 +865,13 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op)
 static void view_zoomdrag_exit(bContext *C, wmOperator *op)
 {
 	if (op->customdata) {
-		v2dViewZoomData *vzd= op->customdata;
+		v2dViewZoomData *vzd = op->customdata;
 		
-		if(vzd->timer)
+		if (vzd->timer)
 			WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), vzd->timer);
 		
 		MEM_freeN(op->customdata);
-		op->customdata= NULL;				
+		op->customdata = NULL;
 	}
 } 
 
@@ -895,7 +896,7 @@ static int view_zoomdrag_exec(bContext *C, wmOperator *op)
 /* set up modal operator and relevant settings */
 static int view_zoomdrag_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	wmWindow *window= CTX_wm_window(C);
+	wmWindow *window = CTX_wm_window(C);
 	v2dViewZoomData *vzd;
 	View2D *v2d;
 	
@@ -903,21 +904,21 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	if (!view_zoomdrag_init(C, op))
 		return OPERATOR_PASS_THROUGH;
 	
-	vzd= op->customdata;
-	v2d= vzd->v2d;
+	vzd = op->customdata;
+	v2d = vzd->v2d;
 	
 	if (event->type == MOUSEZOOM) {
 		float dx, dy, fac;
 		
-		vzd->lastx= event->prevx;
-		vzd->lasty= event->prevy;
+		vzd->lastx = event->prevx;
+		vzd->lasty = event->prevy;
 		
 		/* As we have only 1D information (magnify value), feed both axes
 		 * with magnify information that is stored in x axis 
 		 */
-		fac= 0.01f * (event->x - event->prevx);
-		dx= fac * (v2d->cur.xmax - v2d->cur.xmin) / 10.0f;
-		dy= fac * (v2d->cur.ymax - v2d->cur.ymin) / 10.0f;
+		fac = 0.01f * (event->x - event->prevx);
+		dx = fac * (v2d->cur.xmax - v2d->cur.xmin) / 10.0f;
+		dy = fac * (v2d->cur.ymax - v2d->cur.ymin) / 10.0f;
 
 		RNA_float_set(op->ptr, "deltax", dx);
 		RNA_float_set(op->ptr, "deltay", dy);
@@ -928,21 +929,21 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	}	
 	
 	/* set initial settings */
-	vzd->lastx= event->x;
-	vzd->lasty= event->y;
+	vzd->lastx = event->x;
+	vzd->lasty = event->y;
 	RNA_float_set(op->ptr, "deltax", 0);
 	RNA_float_set(op->ptr, "deltay", 0);
 	
 	/* for modal exit test */
-	vzd->invoke_event= event->type;
+	vzd->invoke_event = event->type;
 	
 	if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
-		ARegion *ar= CTX_wm_region(C);
+		ARegion *ar = CTX_wm_region(C);
 		
 		/* store initial mouse position (in view space) */
 		UI_view2d_region_to_view(&ar->v2d, 
-				event->mval[0], event->mval[1],
-				&vzd->mx_2d, &vzd->my_2d);
+		                         event->mval[0], event->mval[1],
+		                         &vzd->mx_2d, &vzd->my_2d);
 	}
 
 	if (v2d->keepofs & V2D_LOCKOFS_X)
@@ -957,8 +958,8 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 	if (U.viewzoom == USER_ZOOM_CONT) {
 		/* needs a timer to continue redrawing */
-		vzd->timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
-		vzd->timer_lastdraw= PIL_check_seconds_timer();
+		vzd->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
+		vzd->timer_lastdraw = PIL_check_seconds_timer();
 	}
 
 	return OPERATOR_RUNNING_MODAL;
@@ -967,14 +968,14 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, wmEvent *event)
 /* handle user input - calculations of mouse-movement need to be done here, not in the apply callback! */
 static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
-	v2dViewZoomData *vzd= op->customdata;
-	View2D *v2d= vzd->v2d;
+	v2dViewZoomData *vzd = op->customdata;
+	View2D *v2d = vzd->v2d;
 	
 	/* execute the events */
 	if (event->type == TIMER && event->customdata == vzd->timer) {
 		view_zoomdrag_apply(C, op);
 	}
-	else if(event->type == MOUSEMOVE) {
+	else if (event->type == MOUSEMOVE) {
 		float dx, dy;
 		
 		/* calculate new delta transform, based on zooming mode */
@@ -984,35 +985,35 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event)
 			
 			/* x-axis transform */
 			dist = (v2d->mask.xmax - v2d->mask.xmin) / 2.0f;
-			dx= 1.0f - (fabsf(vzd->lastx - dist) + 2.0f) / (fabsf(event->x - dist) + 2.0f);
-			dx*= 0.5f * (v2d->cur.xmax - v2d->cur.xmin);
+			dx = 1.0f - (fabsf(vzd->lastx - dist) + 2.0f) / (fabsf(event->x - dist) + 2.0f);
+			dx *= 0.5f * (v2d->cur.xmax - v2d->cur.xmin);
 			
 			/* y-axis transform */
 			dist = (v2d->mask.ymax - v2d->mask.ymin) / 2.0f;
-			dy= 1.0f - (fabsf(vzd->lasty - dist) + 2.0f) / (fabsf(event->y - dist) + 2.0f);
-			dy*= 0.5f * (v2d->cur.ymax - v2d->cur.ymin);
+			dy = 1.0f - (fabsf(vzd->lasty - dist) + 2.0f) / (fabsf(event->y - dist) + 2.0f);
+			dy *= 0.5f * (v2d->cur.ymax - v2d->cur.ymin);
 		}
 		else {
 			/* 'continuous' or 'dolly' */
 			float fac;
 			
 			/* x-axis transform */
-			fac= 0.01f * (event->x - vzd->lastx);
-			dx= fac * (v2d->cur.xmax - v2d->cur.xmin);
+			fac = 0.01f * (event->x - vzd->lastx);
+			dx = fac * (v2d->cur.xmax - v2d->cur.xmin);
 			
 			/* y-axis transform */
-			fac= 0.01f * (event->y - vzd->lasty);
-			dy= fac * (v2d->cur.ymax - v2d->cur.ymin);
+			fac = 0.01f * (event->y - vzd->lasty);
+			dy = fac * (v2d->cur.ymax - v2d->cur.ymin);
 #if 0
-			/* continous zoom shouldn't move that fast... */
+			/* 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();
-				float time_step= (float)(time - vzd->timer_lastdraw);
+				double time = PIL_check_seconds_timer();
+				float time_step = (float)(time - vzd->timer_lastdraw);
 
 				dx /= (0.1f / time_step);
 				dy /= (0.1f / time_step);
 				
-				vzd->timer_lastdraw= time;
+				vzd->timer_lastdraw = time;
 			}
 #endif
 		}
@@ -1027,23 +1028,23 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event)
 		 *	- continuous zoom only depends on distance of mouse to starting point to determine rate of change
 		 */
 		if (U.viewzoom != USER_ZOOM_CONT) { // XXX store this setting as RNA prop?
-			vzd->lastx= event->x;
-			vzd->lasty= event->y;
+			vzd->lastx = event->x;
+			vzd->lasty = event->y;
 		}
 		
 		/* apply zooming */
 		view_zoomdrag_apply(C, op);
 	} 
-	else if (event->type == vzd->invoke_event || event->type==ESCKEY) {
+	else if (event->type == vzd->invoke_event || event->type == ESCKEY) {
 		if (event->val == KM_RELEASE) {
 			
 			/* for redo, store the overall deltas - need to respect zoom-locks here... */
-			if ((v2d->keepzoom & V2D_LOCKZOOM_X)==0)
+			if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0)
 				RNA_float_set(op->ptr, "deltax", vzd->dx);
 			else
 				RNA_float_set(op->ptr, "deltax", 0);
 				
-			if ((v2d->keepzoom & V2D_LOCKZOOM_Y)==0)
+			if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0)
 				RNA_float_set(op->ptr, "deltay", vzd->dy);
 			else
 				RNA_float_set(op->ptr, "deltay", 0);
@@ -1062,20 +1063,20 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event)
 static void VIEW2D_OT_zoom(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Zoom 2D View";
-	ot->description= "Zoom in/out the view";
-	ot->idname= "VIEW2D_OT_zoom";
+	ot->name = "Zoom 2D View";
+	ot->description = "Zoom in/out the view";
+	ot->idname = "VIEW2D_OT_zoom";
 	
 	/* api callbacks */
-	ot->exec= view_zoomdrag_exec;
-	ot->invoke= view_zoomdrag_invoke;
-	ot->modal= view_zoomdrag_modal;
-	ot->cancel= view_zoomdrag_cancel;
+	ot->exec = view_zoomdrag_exec;
+	ot->invoke = view_zoomdrag_invoke;
+	ot->modal = view_zoomdrag_modal;
+	ot->cancel = view_zoomdrag_cancel;
 	
-	ot->poll= view_zoom_poll;
+	ot->poll = view_zoom_poll;
 	
 	/* operator is repeatable */
-	// ot->flag= OPTYPE_BLOCKING;
+	// ot->flag = OPTYPE_BLOCKING;
 	
 	/* rna - must keep these in sync with the other operators */
 	RNA_def_float(ot->srna, "deltax", 0, -FLT_MAX, FLT_MAX, "Delta X", "", -FLT_MAX, FLT_MAX);
@@ -1096,8 +1097,8 @@ static void VIEW2D_OT_zoom(wmOperatorType *ot)
  
 static int view_borderzoom_exec(bContext *C, wmOperator *op)
 {
-	ARegion *ar= CTX_wm_region(C);
-	View2D *v2d= &ar->v2d;
+	ARegion *ar = CTX_wm_region(C);
+	View2D *v2d = &ar->v2d;
 	rctf rect;
 	int gesture_mode;
 	
@@ -1106,7 +1107,7 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op)
 	UI_view2d_region_to_view(v2d, RNA_int_get(op->ptr, "xmax"), RNA_int_get(op->ptr, "ymax"), &rect.xmax, &rect.ymax);
 	
 	/* check if zooming in/out view */
-	gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
+	gesture_mode = RNA_int_get(op->ptr, "gesture_mode");
 	
 	if (gesture_mode == GESTURE_MODAL_IN) {
 		/* zoom in: 
@@ -1114,39 +1115,40 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op)
 		 *	- just set the 'cur' rect to have the same coordinates as the border region
 		 *	  if zoom is allowed to be changed
 		 */
-		if ((v2d->keepzoom & V2D_LOCKZOOM_X)==0) {
-			v2d->cur.xmin= rect.xmin;
-			v2d->cur.xmax= rect.xmax;
+		if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0) {
+			v2d->cur.xmin = rect.xmin;
+			v2d->cur.xmax = rect.xmax;
 		}
-		if ((v2d->keepzoom & V2D_LOCKZOOM_Y)==0) {
-			v2d->cur.ymin= rect.ymin;
-			v2d->cur.ymax= rect.ymax;
+		if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0) {
+			v2d->cur.ymin = rect.ymin;
+			v2d->cur.ymax = rect.ymax;
 		}
 	}
-	else /* if (gesture_mode == GESTURE_MODAL_OUT) */ {
+	else { /* if (gesture_mode == GESTURE_MODAL_OUT) */
+
 		/* zoom out:
-		 *	- the current 'cur' rect coordinates are going to end upwhere the 'rect' ones are, 
+		 *	- the current 'cur' rect coordinates are going to end up where the 'rect' ones are,
 		 *	  but the 'cur' rect coordinates will need to be adjusted to take in more of the view
 		 *	- calculate zoom factor, and adjust using center-point
 		 */
 		float zoom, center, size;
 		
 		// TODO: is this zoom factor calculation valid? It seems to produce same results everytime...
-		if ((v2d->keepzoom & V2D_LOCKZOOM_X)==0) {
-			size= (v2d->cur.xmax - v2d->cur.xmin);
-			zoom= size / (rect.xmax - rect.xmin);
-			center= (v2d->cur.xmax + v2d->cur.xmin) * 0.5f;
+		if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0) {
+			size = (v2d->cur.xmax - v2d->cur.xmin);
+			zoom = size / (rect.xmax - rect.xmin);
+			center = (v2d->cur.xmax + v2d->cur.xmin) * 0.5f;
 			
-			v2d->cur.xmin= center - (size * zoom);
-			v2d->cur.xmax= center + (size * zoom);
+			v2d->cur.xmin = center - (size * zoom);
+			v2d->cur.xmax = center + (size * zoom);
 		}
-		if ((v2d->keepzoom & V2D_LOCKZOOM_Y)==0) {
-			size= (v2d->cur.ymax - v2d->cur.ymin);
-			zoom= size / (rect.ymax - rect.ymin);
-			center= (v2d->cur.ymax + v2d->cur.ymin) * 0.5f;
+		if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0) {
+			size = (v2d->cur.ymax - v2d->cur.ymin);
+			zoom = size / (rect.ymax - rect.ymin);
+			center = (v2d->cur.ymax + v2d->cur.ymin) * 0.5f;
 			
-			v2d->cur.ymin= center - (size * zoom);
-			v2d->cur.ymax= center + (size * zoom);
+			v2d->cur.ymin = center - (size * zoom);
+			v2d->cur.ymax = center + (size * zoom);
 		}
 	}
 	
@@ -1163,17 +1165,17 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op)
 static void VIEW2D_OT_zoom_border(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Zoom to Border";
-	ot->description= "Zoom in the view to the nearest item contained in the border";
-	ot->idname= "VIEW2D_OT_zoom_border";
+	ot->name = "Zoom to Border";
+	ot->description = "Zoom in the view to the nearest item contained in the border";
+	ot->idname = "VIEW2D_OT_zoom_border";
 	
 	/* api callbacks */
-	ot->invoke= WM_border_select_invoke;
-	ot->exec= view_borderzoom_exec;
-	ot->modal= WM_border_select_modal;
-	ot->cancel= WM_border_select_cancel;
+	ot->invoke = WM_border_select_invoke;
+	ot->exec = view_borderzoom_exec;
+	ot->modal = WM_border_select_modal;
+	ot->cancel = WM_border_select_cancel;
 	
-	ot->poll= view_zoom_poll;
+	ot->poll = view_zoom_poll;
 	
 	/* rna */
 	RNA_def_int(ot->srna, "gesture_mode", 0, INT_MIN, INT_MAX, "Gesture Mode", "", INT_MIN, INT_MAX);
@@ -1186,47 +1188,47 @@ static void VIEW2D_OT_zoom_border(wmOperatorType *ot)
 /* ********************************************************* */
 /* SCROLLERS */
 
-/* 	Scrollers should behave in the following ways, when clicked on with LMB (and dragged):
+/*  Scrollers should behave in the following ways, when clicked on with LMB (and dragged):
  *		1) 'Handles' on end of 'bubble' - when the axis that the scroller represents is zoomable, 
  *			enlarge 'cur' rect on the relevant side 
  *		2) 'Bubble'/'bar' - just drag, and bar should move with mouse (view pans opposite)
  *
  *	In order to make sure this works, each operator must define the following RNA-Operator Props:
- *		deltax, deltay 	- define how much to move view by (relative to zoom-correction factor)
+ *		deltax, deltay  - define how much to move view by (relative to zoom-correction factor)
  */
 
 /* customdata for scroller-invoke data */
 typedef struct v2dScrollerMove {
-	View2D *v2d;			/* View2D data that this operation affects */
-	ARegion *ar;			/* region that the scroller is in */
+	View2D *v2d;            /* View2D data that this operation affects */
+	ARegion *ar;            /* region that the scroller is in */
 	
-	short scroller;			/* scroller that mouse is in ('h' or 'v') */
-	short zone;				/* -1 is min zoomer, 0 is bar, 1 is max zoomer */ // XXX find some way to provide visual feedback of this (active color?)
+	short scroller;         /* scroller that mouse is in ('h' or 'v') */
+	short zone; /* -1 is min zoomer, 0 is bar, 1 is max zoomer */             // XXX find some way to provide visual feedback of this (active color?)
 	
-	float fac;				/* view adjustment factor, based on size of region */
-	float delta;			/* amount moved by mouse on axis of interest */
+	float fac;              /* view adjustment factor, based on size of region */
+	float delta;            /* amount moved by mouse on axis of interest */
 	
-	float scrollbarwidth;	/* width of the scrollbar itself, used for page up/down clicks */
+	float scrollbarwidth;   /* width of the scrollbar itself, used for page up/down clicks */
 	int scrollbar_orig;      /* initial location of scrollbar x/y, mouse relative */
 	
-	int lastx, lasty;		/* previous mouse coordinates (in screen coordinates) for determining movement */
+	int lastx, lasty;       /* previous mouse coordinates (in screen coordinates) for determining movement */
 } v2dScrollerMove;
 
 
 /* View2DScrollers is typedef'd in UI_view2d.h 
  * This is a CUT DOWN VERSION of the 'real' version, which is defined in view2d.c, as we only need focus bubble info
  * WARNING: the start of this struct must not change, so that it stays in sync with the 'real' version
- * 		   For now, we don't need to have a separate (internal) header for structs like this...
+ *         For now, we don't need to have a separate (internal) header for structs like this...
  */
 struct View2DScrollers {	
-		/* focus bubbles */
-	int vert_min, vert_max;	/* vertical scrollbar */
-	int hor_min, hor_max;	/* horizontal scrollbar */
+	/* focus bubbles */
+	int vert_min, vert_max; /* vertical scrollbar */
+	int hor_min, hor_max;   /* horizontal scrollbar */
 };
 
 /* quick enum for vsm->zone (scroller handles) */
 enum {
-	SCROLLHANDLE_MIN= -1,
+	SCROLLHANDLE_MIN = -1,
 	SCROLLHANDLE_BAR,
 	SCROLLHANDLE_MAX,
 	SCROLLHANDLE_MIN_OUTSIDE,
@@ -1236,26 +1238,26 @@ enum {
 /* ------------------------ */
 
 /* check if mouse is within scroller handle 
- *	- mouse			= 	relevant mouse coordinate in region space
- *	- sc_min, sc_max	= 	extents of scroller 'groove' (potential available space for scroller)
- *	- sh_min, sh_max	= 	positions of scrollbar handles
+ *	- mouse			=   relevant mouse coordinate in region space
+ *	- sc_min, sc_max	=   extents of scroller 'groove' (potential available space for scroller)
+ *	- sh_min, sh_max	=   positions of scrollbar handles
  */
 static short mouse_in_scroller_handle(int mouse, int sc_min, int sc_max, int sh_min, int sh_max)
 {
-	short in_min, in_max, in_bar, out_min, out_max, in_view=1;
+	short in_min, in_max, in_bar, out_min, out_max, in_view = 1;
 	
 	/* firstly, check if 
 	 *	- 'bubble' fills entire scroller 
 	 *	- 'bubble' completely out of view on either side 
 	 */
-	if ((sh_min <= sc_min) && (sh_max >= sc_max)) in_view= 0;
+	if ((sh_min <= sc_min) && (sh_max >= sc_max)) in_view = 0;
 	if (sh_min == sh_max) {
-		if (sh_min <= sc_min) in_view= 0;
-		if (sh_max >= sc_max) in_view= 0;
+		if (sh_min <= sc_min) in_view = 0;
+		if (sh_max >= sc_max) in_view = 0;
 	}
 	else {
-		if (sh_max <= sc_min) in_view= 0;
-		if (sh_min >= sc_max) in_view= 0;
+		if (sh_max <= sc_min) in_view = 0;
+		if (sh_min >= sc_max) in_view = 0;
 	}
 	
 	
@@ -1265,11 +1267,11 @@ static short mouse_in_scroller_handle(int mouse, int sc_min, int sc_max, int sh_
 	
 	/* check if mouse is in or past either handle */
 	// TODO: check if these extents are still valid or not
-	in_max= ( (mouse >= (sh_max - V2D_SCROLLER_HANDLE_SIZE)) && (mouse <= (sh_max + V2D_SCROLLER_HANDLE_SIZE)) );
-	in_min= ( (mouse <= (sh_min + V2D_SCROLLER_HANDLE_SIZE)) && (mouse >= (sh_min - V2D_SCROLLER_HANDLE_SIZE)) );
-	in_bar= ( (mouse < (sh_max - V2D_SCROLLER_HANDLE_SIZE)) && (mouse > (sh_min + V2D_SCROLLER_HANDLE_SIZE)) );
-	out_min= mouse < (sh_min - V2D_SCROLLER_HANDLE_SIZE);
-	out_max= mouse > (sh_max + V2D_SCROLLER_HANDLE_SIZE);
+	in_max = ( (mouse >= (sh_max - V2D_SCROLLER_HANDLE_SIZE)) && (mouse <= (sh_max + V2D_SCROLLER_HANDLE_SIZE)) );
+	in_min = ( (mouse <= (sh_min + V2D_SCROLLER_HANDLE_SIZE)) && (mouse >= (sh_min - V2D_SCROLLER_HANDLE_SIZE)) );
+	in_bar = ( (mouse < (sh_max - V2D_SCROLLER_HANDLE_SIZE)) && (mouse > (sh_min + V2D_SCROLLER_HANDLE_SIZE)) );
+	out_min = mouse < (sh_min - V2D_SCROLLER_HANDLE_SIZE);
+	out_max = mouse > (sh_max + V2D_SCROLLER_HANDLE_SIZE);
 	
 	if (in_bar)
 		return SCROLLHANDLE_BAR;
@@ -1286,23 +1288,23 @@ static short mouse_in_scroller_handle(int mouse, int sc_min, int sc_max, int sh_
 	return SCROLLHANDLE_BAR;
 } 
 
-/* initialise customdata for scroller manipulation operator */
+/* initialize customdata for scroller manipulation operator */
 static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event, short in_scroller)
 {
 	v2dScrollerMove *vsm;
 	View2DScrollers *scrollers;
-	ARegion *ar= CTX_wm_region(C);
-	View2D *v2d= &ar->v2d;
+	ARegion *ar = CTX_wm_region(C);
+	View2D *v2d = &ar->v2d;
 	float mask_size;
 	
 	/* set custom-data for operator */
-	vsm= MEM_callocN(sizeof(v2dScrollerMove), "v2dScrollerMove");
-	op->customdata= vsm;
+	vsm = MEM_callocN(sizeof(v2dScrollerMove), "v2dScrollerMove");
+	op->customdata = vsm;
 	
 	/* set general data */
-	vsm->v2d= v2d;
-	vsm->ar= ar;
-	vsm->scroller= in_scroller;
+	vsm->v2d = v2d;
+	vsm->ar = ar;
+	vsm->scroller = in_scroller;
 
 	/* store mouse-coordinates, and convert mouse/screen coordinates to region coordinates */
 	vsm->lastx = event->x;
@@ -1310,20 +1312,20 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event,
 	/* 'zone' depends on where mouse is relative to bubble 
 	 *	- zooming must be allowed on this axis, otherwise, default to pan
 	 */
-	scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, 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);
 
 
 	if (in_scroller == 'h') {
 		/* horizontal scroller - calculate adjustment factor first */
-		mask_size= (float)(v2d->hor.xmax - v2d->hor.xmin);
-		vsm->fac= (v2d->tot.xmax - v2d->tot.xmin) / mask_size;
+		mask_size = (float)(v2d->hor.xmax - v2d->hor.xmin);
+		vsm->fac = (v2d->tot.xmax - v2d->tot.xmin) / mask_size;
 		
 		/* get 'zone' (i.e. which part of scroller is activated) */
-		vsm->zone= mouse_in_scroller_handle(event->mval[0], v2d->hor.xmin, v2d->hor.xmax, scrollers->hor_min, scrollers->hor_max);
+		vsm->zone = mouse_in_scroller_handle(event->mval[0], v2d->hor.xmin, v2d->hor.xmax, scrollers->hor_min, scrollers->hor_max);
 		
 		if ((v2d->keepzoom & V2D_LOCKZOOM_X) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) {
 			/* default to scroll, as handles not usable */
-			vsm->zone= SCROLLHANDLE_BAR;
+			vsm->zone = SCROLLHANDLE_BAR;
 		}
 
 		vsm->scrollbarwidth = scrollers->hor_max - scrollers->hor_min;
@@ -1331,19 +1333,19 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event,
 	}
 	else {
 		/* vertical scroller - calculate adjustment factor first */
-		mask_size= (float)(v2d->vert.ymax - v2d->vert.ymin);
-		vsm->fac= (v2d->tot.ymax - v2d->tot.ymin) / mask_size;
+		mask_size = (float)(v2d->vert.ymax - v2d->vert.ymin);
+		vsm->fac = (v2d->tot.ymax - v2d->tot.ymin) / mask_size;
 		
 		/* get 'zone' (i.e. which part of scroller is activated) */
-		vsm->zone= mouse_in_scroller_handle(event->mval[1], v2d->vert.ymin, v2d->vert.ymax, scrollers->vert_min, scrollers->vert_max);
+		vsm->zone = mouse_in_scroller_handle(event->mval[1], v2d->vert.ymin, v2d->vert.ymax, scrollers->vert_min, scrollers->vert_max);
 			
 		if ((v2d->keepzoom & V2D_LOCKZOOM_Y) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) {
 			/* default to scroll, as handles not usable */
-			vsm->zone= SCROLLHANDLE_BAR;
+			vsm->zone = SCROLLHANDLE_BAR;
 		}
 		
 		vsm->scrollbarwidth = scrollers->vert_max - scrollers->vert_min;
-		vsm->scrollbar_orig = ((scrollers->vert_max + scrollers->vert_min) / 2) +  + ar->winrct.ymin;
+		vsm->scrollbar_orig = ((scrollers->vert_max + scrollers->vert_min) / 2) +  +ar->winrct.ymin;
 	}
 	
 	UI_view2d_scrollers_free(scrollers);
@@ -1354,12 +1356,12 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event,
 static void scroller_activate_exit(bContext *C, wmOperator *op)
 {
 	if (op->customdata) {
-		v2dScrollerMove *vsm= op->customdata;
+		v2dScrollerMove *vsm = op->customdata;
 
-		vsm->v2d->scroll_ui &= ~(V2D_SCROLL_H_ACTIVE|V2D_SCROLL_V_ACTIVE);
+		vsm->v2d->scroll_ui &= ~(V2D_SCROLL_H_ACTIVE | V2D_SCROLL_V_ACTIVE);
 		
 		MEM_freeN(op->customdata);
-		op->customdata= NULL;		
+		op->customdata = NULL;
 		
 		ED_region_tag_redraw(CTX_wm_region(C));
 	}
@@ -1375,12 +1377,12 @@ static int scroller_activate_cancel(bContext *C, wmOperator *op)
 /* apply transform to view (i.e. adjust 'cur' rect) */
 static void scroller_activate_apply(bContext *C, wmOperator *op)
 {
-	v2dScrollerMove *vsm= op->customdata;
-	View2D *v2d= vsm->v2d;
+	v2dScrollerMove *vsm = op->customdata;
+	View2D *v2d = vsm->v2d;
 	float temp;
 	
 	/* calculate amount to move view by */
-	temp= vsm->fac * vsm->delta;
+	temp = vsm->fac * vsm->delta;
 	
 	/* type of movement */
 	switch (vsm->zone) {
@@ -1429,7 +1431,7 @@ static void scroller_activate_apply(bContext *C, wmOperator *op)
 /* handle user input for scrollers - calculations of mouse-movement need to be done here, not in the apply callback! */
 static int scroller_activate_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
-	v2dScrollerMove *vsm= op->customdata;
+	v2dScrollerMove *vsm = op->customdata;
 	
 	/* execute the events */
 	switch (event->type) {
@@ -1440,10 +1442,10 @@ static int scroller_activate_modal(bContext *C, wmOperator *op, wmEvent *event)
 				/* if using bar (i.e. 'panning') or 'max' zoom widget */
 				switch (vsm->scroller) {
 					case 'h': /* horizontal scroller - so only horizontal movement ('cur' moves opposite to mouse) */
-						vsm->delta= (float)(event->x - vsm->lastx);
+						vsm->delta = (float)(event->x - vsm->lastx);
 						break;
 					case 'v': /* vertical scroller - so only vertical movement ('cur' moves opposite to mouse) */
-						vsm->delta= (float)(event->y - vsm->lasty);
+						vsm->delta = (float)(event->y - vsm->lasty);
 						break;
 				}
 			}
@@ -1451,25 +1453,25 @@ static int scroller_activate_modal(bContext *C, wmOperator *op, wmEvent *event)
 				/* using 'min' zoom widget */
 				switch (vsm->scroller) {
 					case 'h': /* horizontal scroller - so only horizontal movement ('cur' moves with mouse) */
-						vsm->delta= (float)(vsm->lastx - event->x);
+						vsm->delta = (float)(vsm->lastx - event->x);
 						break;
 					case 'v': /* vertical scroller - so only vertical movement ('cur' moves with to mouse) */
-						vsm->delta= (float)(vsm->lasty - event->y);
+						vsm->delta = (float)(vsm->lasty - event->y);
 						break;
 				}
 			}
 			
 			/* store previous coordinates */
-			vsm->lastx= event->x;
-			vsm->lasty= event->y;
+			vsm->lastx = event->x;
+			vsm->lasty = event->y;
 			
 			scroller_activate_apply(C, op);
 		}
-			break;
+		break;
 			
 		case LEFTMOUSE:
 		case MIDDLEMOUSE:
-			if (event->val==KM_RELEASE) {
+			if (event->val == KM_RELEASE) {
 				/* single-click was in empty space outside bubble, so scroll by 1 'page' */
 				if (ELEM(vsm->zone, SCROLLHANDLE_MIN_OUTSIDE, SCROLLHANDLE_MAX_OUTSIDE)) {
 					if (vsm->zone == SCROLLHANDLE_MIN_OUTSIDE)
@@ -1499,54 +1501,54 @@ static int scroller_activate_modal(bContext *C, wmOperator *op, wmEvent *event)
 /* a click (or click drag in progress) should have occurred, so check if it happened in scrollbar */
 static int scroller_activate_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	ARegion *ar= CTX_wm_region(C);
-	View2D *v2d= &ar->v2d;
-	short in_scroller= 0;
+	ARegion *ar = CTX_wm_region(C);
+	View2D *v2d = &ar->v2d;
+	short in_scroller = 0;
 		
 	/* check if mouse in scrollbars, if they're enabled */
-	in_scroller= UI_view2d_mouse_in_scrollers(C, v2d, event->x, event->y);
+	in_scroller = UI_view2d_mouse_in_scrollers(C, v2d, event->x, event->y);
 	
 	/* if in a scroller, init customdata then set modal handler which will catch mousedown to start doing useful stuff */
 	if (in_scroller) {
 		v2dScrollerMove *vsm;
 		
-		/* initialise customdata */
+		/* initialize customdata */
 		scroller_activate_init(C, op, event, in_scroller);
-		vsm= (v2dScrollerMove *)op->customdata;
+		vsm = (v2dScrollerMove *)op->customdata;
 		
 		/* support for quick jump to location - gtk and qt do this on linux */
 		if (event->type == MIDDLEMOUSE) {
 			switch (vsm->scroller) {
 				case 'h': /* horizontal scroller - so only horizontal movement ('cur' moves opposite to mouse) */
-					vsm->delta= (float)(event->x - vsm->scrollbar_orig);
+					vsm->delta = (float)(event->x - vsm->scrollbar_orig);
 					break;
 				case 'v': /* vertical scroller - so only vertical movement ('cur' moves opposite to mouse) */
-					vsm->delta= (float)(event->y - vsm->scrollbar_orig);
+					vsm->delta = (float)(event->y - vsm->scrollbar_orig);
 					break;
 			}
 			scroller_activate_apply(C, op);
 
-			vsm->zone= SCROLLHANDLE_BAR;
+			vsm->zone = SCROLLHANDLE_BAR;
 		}
 
 		/* check if zoom zones are inappropriate (i.e. zoom widgets not shown), so cannot continue
 		 * NOTE: see view2d.c for latest conditions, and keep this in sync with that
 		 */
 		if (ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) {
-			if ( ((vsm->scroller=='h') && (v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL)==0) ||
-				 ((vsm->scroller=='v') && (v2d->scroll & V2D_SCROLL_SCALE_VERTICAL)==0) )
+			if ( ((vsm->scroller == 'h') && (v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL) == 0) ||
+			     ((vsm->scroller == 'v') && (v2d->scroll & V2D_SCROLL_SCALE_VERTICAL) == 0) )
 			{
 				/* switch to bar (i.e. no scaling gets handled) */
-				vsm->zone= SCROLLHANDLE_BAR;
+				vsm->zone = SCROLLHANDLE_BAR;
 			}
 		}
 		
 		/* check if zone is inappropriate (i.e. 'bar' but panning is banned), so cannot continue */
 		if (vsm->zone == SCROLLHANDLE_BAR) {
-			if ( ((vsm->scroller=='h') && (v2d->keepofs & V2D_LOCKOFS_X)) ||
-				 ((vsm->scroller=='v') && (v2d->keepofs & V2D_LOCKOFS_Y)) )
+			if ( ((vsm->scroller == 'h') && (v2d->keepofs & V2D_LOCKOFS_X)) ||
+			     ((vsm->scroller == 'v') && (v2d->keepofs & V2D_LOCKOFS_Y)) )
 			{
-				/* free customdata initialised */
+				/* free customdata initialized */
 				scroller_activate_exit(C, op);
 				
 				/* can't catch this event for ourselves, so let it go to someone else? */
@@ -1555,10 +1557,10 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, wmEvent *event)
 		}
 		
 		/* zone is also inappropriate if scroller is not visible... */
-		if ( ((vsm->scroller=='h') && (v2d->scroll & (V2D_SCROLL_HORIZONTAL_HIDE|V2D_SCROLL_HORIZONTAL_FULLR))) ||
-			 ((vsm->scroller=='v') && (v2d->scroll & (V2D_SCROLL_VERTICAL_HIDE|V2D_SCROLL_VERTICAL_FULLR))) )
+		if ( ((vsm->scroller == 'h') && (v2d->scroll & (V2D_SCROLL_HORIZONTAL_HIDE | V2D_SCROLL_HORIZONTAL_FULLR))) ||
+		     ((vsm->scroller == 'v') && (v2d->scroll & (V2D_SCROLL_VERTICAL_HIDE | V2D_SCROLL_VERTICAL_FULLR))) )
 		{
-			/* free customdata initialised */
+			/* free customdata initialized */
 			scroller_activate_exit(C, op);
 				
 			/* can't catch this event for ourselves, so let it go to someone else? */
@@ -1567,7 +1569,7 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, wmEvent *event)
 		}
 		
 		/* activate the scroller */
-		if (vsm->scroller=='h')
+		if (vsm->scroller == 'h')
 			v2d->scroll_ui |= V2D_SCROLL_H_ACTIVE;
 		else
 			v2d->scroll_ui |= V2D_SCROLL_V_ACTIVE;
@@ -1586,19 +1588,19 @@ static int scroller_activate_invoke(bContext *C, wmOperator *op, wmEvent *event)
 static void VIEW2D_OT_scroller_activate(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Scroller Activate";
-	ot->description= "Scroll view by mouse click and drag";
-	ot->idname= "VIEW2D_OT_scroller_activate";
+	ot->name = "Scroller Activate";
+	ot->description = "Scroll view by mouse click and drag";
+	ot->idname = "VIEW2D_OT_scroller_activate";
 
 	/* flags */
-	ot->flag= OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_BLOCKING;
 	
 	/* api callbacks */
-	ot->invoke= scroller_activate_invoke;
-	ot->modal= scroller_activate_modal;
-	ot->cancel= scroller_activate_cancel;
+	ot->invoke = scroller_activate_invoke;
+	ot->modal = scroller_activate_modal;
+	ot->cancel = scroller_activate_cancel;
 
-	ot->poll= view2d_poll;
+	ot->poll = view2d_poll;
 }
 
 /* ********************************************************* */
@@ -1606,38 +1608,38 @@ static void VIEW2D_OT_scroller_activate(wmOperatorType *ot)
 
 static int reset_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	uiStyle *style= UI_GetStyle();
-	ARegion *ar= CTX_wm_region(C);
-	View2D *v2d= &ar->v2d;
+	uiStyle *style = UI_GetStyle();
+	ARegion *ar = CTX_wm_region(C);
+	View2D *v2d = &ar->v2d;
 	int winx, winy;
 
 	/* zoom 1.0 */
-	winx= (float)(v2d->mask.xmax - v2d->mask.xmin + 1);
-	winy= (float)(v2d->mask.ymax - v2d->mask.ymin + 1);
+	winx = (float)(v2d->mask.xmax - v2d->mask.xmin + 1);
+	winy = (float)(v2d->mask.ymax - v2d->mask.ymin + 1);
 
-	v2d->cur.xmax= v2d->cur.xmin + winx;
-	v2d->cur.ymax= v2d->cur.ymin + winy;
+	v2d->cur.xmax = v2d->cur.xmin + winx;
+	v2d->cur.ymax = v2d->cur.ymin + winy;
 	
 	/* align */
 	if (v2d->align) {
 		/* posx and negx flags are mutually exclusive, so watch out */
 		if ((v2d->align & V2D_ALIGN_NO_POS_X) && !(v2d->align & V2D_ALIGN_NO_NEG_X)) {
-			v2d->cur.xmax= 0.0f;
-			v2d->cur.xmin= -winx*style->panelzoom;
+			v2d->cur.xmax = 0.0f;
+			v2d->cur.xmin = -winx * style->panelzoom;
 		}
 		else if ((v2d->align & V2D_ALIGN_NO_NEG_X) && !(v2d->align & V2D_ALIGN_NO_POS_X)) {
-			v2d->cur.xmax= winx*style->panelzoom;
-			v2d->cur.xmin= 0.0f;
+			v2d->cur.xmax = winx * style->panelzoom;
+			v2d->cur.xmin = 0.0f;
 		}
 
 		/* - posx and negx flags are mutually exclusive, so watch out */
 		if ((v2d->align & V2D_ALIGN_NO_POS_Y) && !(v2d->align & V2D_ALIGN_NO_NEG_Y)) {
-			v2d->cur.ymax= 0.0f;
-			v2d->cur.ymin= -winy*style->panelzoom;
+			v2d->cur.ymax = 0.0f;
+			v2d->cur.ymin = -winy * style->panelzoom;
 		}
 		else if ((v2d->align & V2D_ALIGN_NO_NEG_Y) && !(v2d->align & V2D_ALIGN_NO_POS_Y)) {
-			v2d->cur.ymax= winy*style->panelzoom;
-			v2d->cur.ymin= 0.0f;
+			v2d->cur.ymax = winy * style->panelzoom;
+			v2d->cur.ymin = 0.0f;
 		}
 	}
 
@@ -1654,13 +1656,13 @@ static int reset_exec(bContext *C, wmOperator *UNUSED(op))
 static void VIEW2D_OT_reset(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Reset View";
-	ot->description= "Reset the view";
-	ot->idname= "VIEW2D_OT_reset";
+	ot->name = "Reset View";
+	ot->description = "Reset the view";
+	ot->idname = "VIEW2D_OT_reset";
 	
 	/* api callbacks */
-	ot->exec= reset_exec;
-	ot->poll= view2d_poll;
+	ot->exec = reset_exec;
+	ot->poll = view2d_poll;
 }
  
 /* ********************************************************* */
@@ -1688,7 +1690,7 @@ void UI_view2d_operatortypes(void)
 
 void UI_view2d_keymap(wmKeyConfig *keyconf)
 {
-	wmKeyMap *keymap= WM_keymap_find(keyconf, "View2D", 0, 0);
+	wmKeyMap *keymap = WM_keymap_find(keyconf, "View2D", 0, 0);
 	wmKeyMapItem *kmi;
 
 	/* scrollers */
@@ -1714,21 +1716,21 @@ void UI_view2d_keymap(wmKeyConfig *keyconf)
 	WM_keymap_add_item(keymap, "VIEW2D_OT_zoom_in", PADPLUSKEY, KM_PRESS, 0, 0);
 	
 	/* scroll up/down - no modifiers, only when zoom fails */
-		/* these may fail if zoom is disallowed, in which case they should pass on event */
+	/* these may fail if zoom is disallowed, in which case they should pass on event */
 	WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_down", WHEELDOWNMOUSE, KM_PRESS, 0, 0);
 	WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_up", WHEELUPMOUSE, KM_PRESS, 0, 0);
-		/* these may be necessary if vertical scroll is disallowed */
+	/* these may be necessary if vertical scroll is disallowed */
 	WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_right", WHEELDOWNMOUSE, KM_PRESS, 0, 0);
 	WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_left", WHEELUPMOUSE, KM_PRESS, 0, 0);
 	
 	/* alternatives for page up/down to scroll */
 #if 0 // XXX disabled, since this causes conflicts with hotkeys in animation editors
-		/* scroll up/down may fall through to left/right */
+	/* scroll up/down may fall through to left/right */
 	WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_down", PAGEDOWNKEY, KM_PRESS, 0, 0);
 	WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_up", PAGEUPKEY, KM_PRESS, 0, 0);
 	WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_right", PAGEDOWNKEY, KM_PRESS, 0, 0);
 	WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_left", PAGEUPKEY, KM_PRESS, 0, 0);
-		/* shift for moving view left/right with page up/down */
+	/* shift for moving view left/right with page up/down */
 	WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_right", PAGEDOWNKEY, KM_PRESS, KM_SHIFT, 0);
 	WM_keymap_add_item(keymap, "VIEW2D_OT_scroll_left", PAGEUPKEY, KM_PRESS, KM_SHIFT, 0);
 #endif
@@ -1741,7 +1743,7 @@ void UI_view2d_keymap(wmKeyConfig *keyconf)
 	WM_keymap_add_item(keymap, "VIEW2D_OT_zoom_border", BKEY, KM_PRESS, KM_SHIFT, 0);
 
 	/* Alternative keymap for buttons listview */
-	keymap= WM_keymap_find(keyconf, "View2D Buttons List", 0, 0);
+	keymap = WM_keymap_find(keyconf, "View2D Buttons List", 0, 0);
 
 	WM_keymap_add_item(keymap, "VIEW2D_OT_scroller_activate", LEFTMOUSE, KM_PRESS, 0, 0);
 	WM_keymap_add_item(keymap, "VIEW2D_OT_scroller_activate", MIDDLEMOUSE, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/mesh/CMakeLists.txt b/source/blender/editors/mesh/CMakeLists.txt
index 7849b71..246c323 100644
--- a/source/blender/editors/mesh/CMakeLists.txt
+++ b/source/blender/editors/mesh/CMakeLists.txt
@@ -20,9 +20,11 @@
 
 set(INC
 	../include
+	../uvedit
 	../../blenkernel
 	../../blenlib
 	../../blenloader
+	../../bmesh
 	../../imbuf
 	../../makesdna
 	../../makesrna
@@ -37,17 +39,20 @@ set(INC_SYS
 
 set(SRC
 	editface.c
-	editmesh.c
 	editmesh_add.c
-	editmesh_lib.c
-	editmesh_loop.c
-	editmesh_mods.c
+	editmesh_bvh.c
+	editmesh_knife.c
+	editmesh_loopcut.c
+	editmesh_rip.c
+	editmesh_select.c
 	editmesh_tools.c
-	loopcut.c
+	editmesh_utils.c
+	editmesh_slide.c
 	mesh_data.c
 	mesh_ops.c
 	meshtools.c
 
+	editmesh_bvh.h
 	mesh_intern.h
 )
 
diff --git a/source/blender/editors/mesh/SConscript b/source/blender/editors/mesh/SConscript
index 6546a44..b3aba97 100644
--- a/source/blender/editors/mesh/SConscript
+++ b/source/blender/editors/mesh/SConscript
@@ -9,12 +9,13 @@ incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
 incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
 incs += ' ../../gpu ../../blenloader'
 incs += ' ../../makesrna ../../render/extern/include  #/intern/elbeem/extern'
+incs += ' ../../bmesh ../uvedit '
 
 if env['OURPLATFORM'] == 'linux':
     cflags='-pthread'
     incs += ' ../../../extern/binreloc/include'
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
 
 if env['WITH_BF_GAMEENGINE']:
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c
index 42a1b7e..294a39e 100644
--- a/source/blender/editors/mesh/editface.c
+++ b/source/blender/editors/mesh/editface.c
@@ -27,23 +27,20 @@
  *  \ingroup edmesh
  */
 
-
-
 #include <math.h>
 #include <string.h>
 
 #include "MEM_guardedalloc.h"
 
+#include "BLI_utildefines.h"
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
-#include "BLI_heap.h"
 #include "BLI_edgehash.h"
-#include "BLI_editVert.h"
-#include "BLI_utildefines.h"
 
 #include "IMB_imbuf_types.h"
 #include "IMB_imbuf.h"
 
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
@@ -52,6 +49,7 @@
 #include "BKE_global.h"
 #include "BKE_mesh.h"
 #include "BKE_context.h"
+#include "BKE_tessmesh.h"
 
 #include "BIF_gl.h"
 
@@ -69,59 +67,92 @@
  * use in object mode when selecting faces (while painting) */
 void paintface_flush_flags(Object *ob)
 {
-	Mesh *me= get_mesh(ob);
-	DerivedMesh *dm= ob->derivedFinal;
-	MFace *faces, *mf, *mf_orig;
+	Mesh *me = get_mesh(ob);
+	DerivedMesh *dm = ob->derivedFinal;
+	MPoly *polys, *mp_orig;
+	MFace *faces;
 	int *index_array = NULL;
-	int totface;
+	int totface, totpoly;
 	int i;
 	
-	if(me==NULL || dm==NULL)
+	if (me == NULL || dm == NULL)
 		return;
 
-	index_array = dm->getFaceDataArray(dm, CD_ORIGINDEX);
+	/*
+	 * Try to push updated mesh poly flags to three other data sets:
+	 *  - Mesh polys => Mesh tess faces
+	 *  - Mesh polys => Final derived polys
+	 *  - Final derived polys => Final derived tessfaces
+	 */
 
-	if(!index_array)
-		return;
-	
-	faces = dm->getFaceArray(dm);
-	totface = dm->getNumFaces(dm);
-	
-	mf= faces;
-	
-	for (i= 0; i<totface; i++, mf++) { /* loop over derived mesh faces */
-		mf_orig= me->mface + index_array[i];
-		mf->flag= mf_orig->flag;
+	if ((index_array = CustomData_get_layer(&me->fdata, CD_POLYINDEX))) {
+		faces = me->mface;
+		totface = me->totface;
+		
+		/* loop over tessfaces */
+		for (i = 0; i < totface; i++) {
+			/* Copy flags onto the original tessface from its original poly */
+			mp_orig = me->mpoly + index_array[i];
+			faces[i].flag = mp_orig->flag;
+		}
+	}
+
+	if ((index_array = CustomData_get_layer(&dm->polyData, CD_ORIGINDEX))) {
+		polys = dm->getPolyArray(dm);
+		totpoly = dm->getNumPolys(dm);
+
+		/* loop over final derived polys */
+		for (i = 0; i < totpoly; i++) {
+			/* Copy flags onto the final derived poly from the original mesh poly */
+			mp_orig = me->mpoly + index_array[i];
+			polys[i].flag = mp_orig->flag;
+		}
+	}
+
+	if ((index_array = CustomData_get_layer(&dm->faceData, CD_POLYINDEX))) {
+		polys = dm->getPolyArray(dm);
+		faces = dm->getTessFaceArray(dm);
+		totface = dm->getNumTessFaces(dm);
+
+		/* loop over tessfaces */
+		for (i = 0; i < totface; i++) {
+			/* Copy flags onto the final tessface from its final poly */
+			mp_orig = polys + index_array[i];
+			faces[i].flag = mp_orig->flag;
+		}
 	}
 }
 
 /* returns 0 if not found, otherwise 1 */
-static int facesel_face_pick(struct bContext *C, Mesh *me, const int mval[2], unsigned int *index, short rect)
+static int facesel_face_pick(struct bContext *C, Mesh *me, Object *ob, const int mval[2], unsigned int *index, short rect)
 {
+	Scene *scene = CTX_data_scene(C);
 	ViewContext vc;
 	view3d_set_viewcontext(C, &vc);
 
-	if (!me || me->totface==0)
+	if (!me || me->totpoly == 0)
 		return 0;
 
-// XXX 	if (v3d->flag & V3D_INVALID_BACKBUF) {
+	makeDerivedMesh(scene, ob, NULL, CD_MASK_BAREMESH, 0);
+
+	// XXX  if (v3d->flag & V3D_INVALID_BACKBUF) {
 // XXX drawview.c!		check_backbuf();
 // XXX		persp(PERSP_VIEW);
-// XXX 	}
+// XXX  }
 
 	if (rect) {
 		/* sample rect to increase changes of selecting, so that when clicking
-		   on an edge in the backbuf, we can still select a face */
+		 * on an edge in the backbuf, we can still select a face */
 
 		int dist;
-		*index = view3d_sample_backbuf_rect(&vc, mval, 3, 1, me->totface+1, &dist,0,NULL, NULL);
+		*index = view3d_sample_backbuf_rect(&vc, mval, 3, 1, me->totpoly + 1, &dist, 0, NULL, NULL);
 	}
 	else {
 		/* sample only on the exact position */
 		*index = view3d_sample_backbuf(&vc, mval[0], mval[1]);
 	}
 
-	if ((*index)<=0 || (*index)>(unsigned int)me->totface)
+	if ((*index) <= 0 || (*index) > (unsigned int)me->totpoly)
 		return 0;
 
 	(*index)--;
@@ -129,55 +160,29 @@ static int facesel_face_pick(struct bContext *C, Mesh *me, const int mval[2], un
 	return 1;
 }
 
-/* last_sel, use em->act_face otherwise get the last selected face in the editselections
- * at the moment, last_sel is mainly useful for gaking sure the space image dosnt flicker */
-MTFace *EM_get_active_mtface(EditMesh *em, EditFace **act_efa, MCol **mcol, int sloppy)
-{
-	EditFace *efa = NULL;
-	
-	if(!EM_texFaceCheck(em))
-		return NULL;
-	
-	efa = EM_get_actFace(em, sloppy);
-	
-	if (efa) {
-		if (mcol) {
-			if (CustomData_has_layer(&em->fdata, CD_MCOL))
-				*mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
-			else
-				*mcol = NULL;
-		}
-		if (act_efa) *act_efa = efa; 
-		return CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-	}
-	if (act_efa) *act_efa= NULL;
-	if(mcol) *mcol = NULL;
-	return NULL;
-}
-
 void paintface_hide(Object *ob, const int unselected)
 {
 	Mesh *me;
-	MFace *mface;
+	MPoly *mpoly;
 	int a;
 	
-	me= get_mesh(ob);
-	if(me==NULL || me->totface==0) return;
-
-	mface= me->mface;
-	a= me->totface;
-	while(a--) {
-		if((mface->flag & ME_HIDE) == 0) {
-			if(unselected) {
-				if( (mface->flag & ME_FACE_SEL)==0) mface->flag |= ME_HIDE;
+	me = get_mesh(ob);
+	if (me == NULL || me->totpoly == 0) return;
+
+	mpoly = me->mpoly;
+	a = me->totpoly;
+	while (a--) {
+		if ((mpoly->flag & ME_HIDE) == 0) {
+			if (unselected) {
+				if ( (mpoly->flag & ME_FACE_SEL) == 0) mpoly->flag |= ME_HIDE;
 			}
 			else {
-				if( (mface->flag & ME_FACE_SEL)) mface->flag |= ME_HIDE;
+				if ( (mpoly->flag & ME_FACE_SEL)) mpoly->flag |= ME_HIDE;
 			}
 		}
-		if(mface->flag & ME_HIDE) mface->flag &= ~ME_FACE_SEL;
+		if (mpoly->flag & ME_HIDE) mpoly->flag &= ~ME_FACE_SEL;
 		
-		mface++;
+		mpoly++;
 	}
 	
 	paintface_flush_flags(ob);
@@ -187,20 +192,20 @@ void paintface_hide(Object *ob, const int unselected)
 void paintface_reveal(Object *ob)
 {
 	Mesh *me;
-	MFace *mface;
+	MPoly *mpoly;
 	int a;
 
-	me= get_mesh(ob);
-	if(me==NULL || me->totface==0) return;
-
-	mface= me->mface;
-	a= me->totface;
-	while(a--) {
-		if(mface->flag & ME_HIDE) {
-			mface->flag |= ME_FACE_SEL;
-			mface->flag -= ME_HIDE;
+	me = get_mesh(ob);
+	if (me == NULL || me->totpoly == 0) return;
+
+	mpoly = me->mpoly;
+	a = me->totpoly;
+	while (a--) {
+		if (mpoly->flag & ME_HIDE) {
+			mpoly->flag |= ME_FACE_SEL;
+			mpoly->flag -= ME_HIDE;
 		}
-		mface++;
+		mpoly++;
 	}
 
 	paintface_flush_flags(ob);
@@ -208,87 +213,77 @@ void paintface_reveal(Object *ob)
 
 /* Set tface seams based on edge data, uses hash table to find seam edges. */
 
-static void hash_add_face(EdgeHash *ehash, MFace *mf)
+static void hash_add_face(EdgeHash *ehash, MPoly *mp, MLoop *mloop)
 {
-	BLI_edgehash_insert(ehash, mf->v1, mf->v2, NULL);
-	BLI_edgehash_insert(ehash, mf->v2, mf->v3, NULL);
-	if(mf->v4) {
-		BLI_edgehash_insert(ehash, mf->v3, mf->v4, NULL);
-		BLI_edgehash_insert(ehash, mf->v4, mf->v1, NULL);
+	MLoop *ml;
+	int i;
+
+	for (i = 0, ml = mloop; i < mp->totloop; i++, ml++) {
+		BLI_edgehash_insert(ehash, ml->v, ME_POLY_LOOP_NEXT(mloop, mp, i)->v, NULL);
 	}
-	else
-		BLI_edgehash_insert(ehash, mf->v3, mf->v1, NULL);
 }
 
 
 static void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int index)
 {
-	MFace *mf;
-	int a, doit=1, mark=0;
-	char *linkflag;
 	EdgeHash *ehash, *seamhash;
+	MPoly *mp;
+	MLoop *ml;
 	MEdge *med;
+	char *linkflag;
+	int a, b, doit = 1, mark = 0;
 
-	ehash= BLI_edgehash_new();
+	ehash = BLI_edgehash_new();
 	seamhash = BLI_edgehash_new();
-	linkflag= MEM_callocN(sizeof(char)*me->totface, "linkflaguv");
+	linkflag = MEM_callocN(sizeof(char) * me->totpoly, "linkflaguv");
 
-	for(med=me->medge, a=0; a < me->totedge; a++, med++)
-		if(med->flag & ME_SEAM)
+	for (med = me->medge, a = 0; a < me->totedge; a++, med++)
+		if (med->flag & ME_SEAM)
 			BLI_edgehash_insert(seamhash, med->v1, med->v2, NULL);
 
-	if (mode==0 || mode==1) {
+	if (mode == 0 || mode == 1) {
 		/* only put face under cursor in array */
-		mf= ((MFace*)me->mface) + index;
-		hash_add_face(ehash, mf);
-		linkflag[index]= 1;
+		mp = ((MPoly *)me->mpoly) + index;
+		hash_add_face(ehash, mp, me->mloop + mp->loopstart);
+		linkflag[index] = 1;
 	}
 	else {
 		/* fill array by selection */
-		mf= me->mface;
-		for(a=0; a<me->totface; a++, mf++) {
-			if(mf->flag & ME_HIDE);
-			else if(mf->flag & ME_FACE_SEL) {
-				hash_add_face(ehash, mf);
-				linkflag[a]= 1;
+		mp = me->mpoly;
+		for (a = 0; a < me->totpoly; a++, mp++) {
+			if (mp->flag & ME_HIDE) ;
+			else if (mp->flag & ME_FACE_SEL) {
+				hash_add_face(ehash, mp, me->mloop + mp->loopstart);
+				linkflag[a] = 1;
 			}
 		}
 	}
 
-	while(doit) {
-		doit= 0;
+	while (doit) {
+		doit = 0;
 
 		/* expand selection */
-		mf= me->mface;
-		for(a=0; a<me->totface; a++, mf++) {
-			if(mf->flag & ME_HIDE)
+		mp = me->mpoly;
+		for (a = 0; a < me->totpoly; a++, mp++) {
+			if (mp->flag & ME_HIDE)
 				continue;
 
-			if(!linkflag[a]) {
-				mark= 0;
-
-				if(!BLI_edgehash_haskey(seamhash, mf->v1, mf->v2))
-					if(BLI_edgehash_haskey(ehash, mf->v1, mf->v2))
-						mark= 1;
-				if(!BLI_edgehash_haskey(seamhash, mf->v2, mf->v3))
-					if(BLI_edgehash_haskey(ehash, mf->v2, mf->v3))
-						mark= 1;
-				if(mf->v4) {
-					if(!BLI_edgehash_haskey(seamhash, mf->v3, mf->v4))
-						if(BLI_edgehash_haskey(ehash, mf->v3, mf->v4))
-							mark= 1;
-					if(!BLI_edgehash_haskey(seamhash, mf->v4, mf->v1))
-						if(BLI_edgehash_haskey(ehash, mf->v4, mf->v1))
-							mark= 1;
+			if (!linkflag[a]) {
+				MLoop *mnextl;
+				mark = 0;
+
+				ml = me->mloop + mp->loopstart;
+				for (b = 0; b < mp->totloop; b++, ml++) {
+					mnextl = b < mp->totloop - 1 ? ml - 1 : me->mloop + mp->loopstart;
+					if (!BLI_edgehash_haskey(seamhash, ml->v, mnextl->v))
+						if (!BLI_edgehash_haskey(ehash, ml->v, mnextl->v))
+							mark = 1;
 				}
-				else if(!BLI_edgehash_haskey(seamhash, mf->v3, mf->v1))
-					if(BLI_edgehash_haskey(ehash, mf->v3, mf->v1))
-						mark = 1;
-
-				if(mark) {
-					linkflag[a]= 1;
-					hash_add_face(ehash, mf);
-					doit= 1;
+
+				if (mark) {
+					linkflag[a] = 1;
+					hash_add_face(ehash, mp, me->mloop + mp->loopstart);
+					doit = 1;
 				}
 			}
 		}
@@ -298,27 +293,27 @@ static void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int ind
 	BLI_edgehash_free(ehash, NULL);
 	BLI_edgehash_free(seamhash, NULL);
 
-	if(mode==0 || mode==2) {
-		for(a=0, mf=me->mface; a<me->totface; a++, mf++)
-			if(linkflag[a])
-				mf->flag |= ME_FACE_SEL;
+	if (mode == 0 || mode == 2) {
+		for (a = 0, mp = me->mpoly; a < me->totpoly; a++, mp++)
+			if (linkflag[a])
+				mp->flag |= ME_FACE_SEL;
 			else
-				mf->flag &= ~ME_FACE_SEL;
+				mp->flag &= ~ME_FACE_SEL;
 	}
-	else if(mode==1) {
-		for(a=0, mf=me->mface; a<me->totface; a++, mf++)
-			if(linkflag[a] && (mf->flag & ME_FACE_SEL))
+	else if (mode == 1) {
+		for (a = 0, mp = me->mpoly; a < me->totpoly; a++, mp++)
+			if (linkflag[a] && (mp->flag & ME_FACE_SEL))
 				break;
 
-		if (a<me->totface) {
-			for(a=0, mf=me->mface; a<me->totface; a++, mf++)
-				if(linkflag[a])
-					mf->flag &= ~ME_FACE_SEL;
+		if (a < me->totpoly) {
+			for (a = 0, mp = me->mpoly; a < me->totpoly; a++, mp++)
+				if (linkflag[a])
+					mp->flag &= ~ME_FACE_SEL;
 		}
 		else {
-			for(a=0, mf=me->mface; a<me->totface; a++, mf++)
-				if(linkflag[a])
-					mf->flag |= ME_FACE_SEL;
+			for (a = 0, mp = me->mpoly; a < me->totpoly; a++, mp++)
+				if (linkflag[a])
+					mp->flag |= ME_FACE_SEL;
 		}
 	}
 
@@ -328,17 +323,17 @@ static void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int ind
 void paintface_select_linked(bContext *UNUSED(C), Object *ob, int UNUSED(mval[2]), int mode)
 {
 	Mesh *me;
-	unsigned int index=0;
+	unsigned int index = 0;
 
 	me = get_mesh(ob);
-	if(me==NULL || me->totface==0) return;
+	if (me == NULL || me->totpoly == 0) return;
 
-	if (mode==0 || mode==1) {
+	if (mode == 0 || mode == 1) {
 		// XXX - Causes glitches, not sure why
-		/*
+#if 0
 		if (!facesel_face_pick(C, me, mval, &index, 1))
 			return;
-		*/
+#endif
 	}
 
 	select_linked_tfaces_with_seams(mode, me, index);
@@ -349,322 +344,123 @@ void paintface_select_linked(bContext *UNUSED(C), Object *ob, int UNUSED(mval[2]
 void paintface_deselect_all_visible(Object *ob, int action, short flush_flags)
 {
 	Mesh *me;
-	MFace *mface;
+	MPoly *mpoly;
 	int a;
 
-	me= get_mesh(ob);
-	if(me==NULL) return;
+	me = get_mesh(ob);
+	if (me == NULL) return;
 	
-	if(action == SEL_INVERT) {
-		mface= me->mface;
-		a= me->totface;
-		while(a--) {
-			if((mface->flag & ME_HIDE) == 0) {
-				mface->flag ^= ME_FACE_SEL;
+	if (action == SEL_INVERT) {
+		mpoly = me->mpoly;
+		a = me->totpoly;
+		while (a--) {
+			if ((mpoly->flag & ME_HIDE) == 0) {
+				mpoly->flag ^= ME_FACE_SEL;
 			}
-			mface++;
+			mpoly++;
 		}
 	}
 	else {
 		if (action == SEL_TOGGLE) {
 			action = SEL_SELECT;
 
-			mface= me->mface;
-			a= me->totface;
-			while(a--) {
-				if((mface->flag & ME_HIDE) == 0 && mface->flag & ME_FACE_SEL) {
+			mpoly = me->mpoly;
+			a = me->totpoly;
+			while (a--) {
+				if ((mpoly->flag & ME_HIDE) == 0 && mpoly->flag & ME_FACE_SEL) {
 					action = SEL_DESELECT;
 					break;
 				}
-				mface++;
+				mpoly++;
 			}
 		}
 
-		mface= me->mface;
-		a= me->totface;
-		while(a--) {
-			if((mface->flag & ME_HIDE) == 0) {
+		mpoly = me->mpoly;
+		a = me->totpoly;
+		while (a--) {
+			if ((mpoly->flag & ME_HIDE) == 0) {
 				switch (action) {
-				case SEL_SELECT:
-					mface->flag |= ME_FACE_SEL;
-					break;
-				case SEL_DESELECT:
-					mface->flag &= ~ME_FACE_SEL;
-					break;
-				case SEL_INVERT:
-					mface->flag ^= ME_FACE_SEL;
-					break;
+					case SEL_SELECT:
+						mpoly->flag |= ME_FACE_SEL;
+						break;
+					case SEL_DESELECT:
+						mpoly->flag &= ~ME_FACE_SEL;
+						break;
+					case SEL_INVERT:
+						mpoly->flag ^= ME_FACE_SEL;
+						break;
 				}
 			}
-			mface++;
+			mpoly++;
 		}
 	}
 
-	if(flush_flags) {
+	if (flush_flags) {
 		paintface_flush_flags(ob);
 	}
 }
 
 int paintface_minmax(Object *ob, float *min, float *max)
 {
-	Mesh *me= get_mesh(ob);
-	MFace *mf;
-	MVert *mv;
-	int a, ok=0;
-	float vec[3];
-
-	if(me==NULL)
-		return ok;
-
-	mv= me->mvert;
-	mf= me->mface;
-	for (a=me->totface; a>0; a--, mf++) {
-		if ((mf->flag & ME_HIDE || !(mf->flag & ME_FACE_SEL)) == 0) {
-			int i= mf->v4 ? 3:2;
-			do {
-				mul_v3_m4v3(vec, ob->obmat, (mv + (*(&mf->v1 + i)))->co);
-				DO_MINMAX(vec, min, max);
-			} while (i--);
-			ok= 1;
-		}
-	}
-	return ok;
-}
-
-/* ******************** edge loop shortest path ********************* */
-
-#define ME_SEAM_DONE 2		/* reuse this flag */
-
-static float edgetag_cut_cost(int e1, int e2, int vert)
-{
-	EditVert *v = EM_get_vert_for_index(vert);
-	EditEdge *eed1 = EM_get_edge_for_index(e1), *eed2 = EM_get_edge_for_index(e2);
-	EditVert *v1 = EM_get_vert_for_index( (eed1->v1->tmp.l == vert)? eed1->v2->tmp.l: eed1->v1->tmp.l );
-	EditVert *v2 = EM_get_vert_for_index( (eed2->v1->tmp.l == vert)? eed2->v2->tmp.l: eed2->v1->tmp.l );
-	float cost, d1[3], d2[3];
-
-	cost = len_v3v3(v1->co, v->co);
-	cost += len_v3v3(v->co, v2->co);
-
-	sub_v3_v3v3(d1, v->co, v1->co);
-	sub_v3_v3v3(d2, v2->co, v->co);
-
-	cost = cost + 0.5f*cost*(2.0f - fabsf(d1[0]*d2[0] + d1[1]*d2[1] + d1[2]*d2[2]));
-
-	return cost;
-}
-
-static void edgetag_add_adjacent(Heap *heap, int mednum, int vertnum, int *nedges, int *edges, int *prevedge, float *cost)
-{
-	int startadj, endadj = nedges[vertnum+1];
-
-	for (startadj = nedges[vertnum]; startadj < endadj; startadj++) {
-		int adjnum = edges[startadj];
-		EditEdge *eedadj = EM_get_edge_for_index(adjnum);
-		float newcost;
-
-		if (eedadj->f2 & ME_SEAM_DONE)
-			continue;
-
-		newcost = cost[mednum] + edgetag_cut_cost(mednum, adjnum, vertnum);
-
-		if (cost[adjnum] > newcost) {
-			cost[adjnum] = newcost;
-			prevedge[adjnum] = mednum;
-			BLI_heap_insert(heap, newcost, SET_INT_IN_POINTER(adjnum));
-		}
-	}
-}
-
-void edgetag_context_set(Scene *scene, EditEdge *eed, int val)
-{
-	
-	switch (scene->toolsettings->edge_mode) {
-	case EDGE_MODE_SELECT:
-		EM_select_edge(eed, val);
-		break;
-	case EDGE_MODE_TAG_SEAM:
-		if (val)		{eed->seam = 255;}
-		else			{eed->seam = 0;}
-		break;
-	case EDGE_MODE_TAG_SHARP:
-		if (val)		{eed->sharp = 1;}
-		else			{eed->sharp = 0;}
-		break;				
-	case EDGE_MODE_TAG_CREASE:	
-		if (val)		{eed->crease = 1.0f;}
-		else			{eed->crease = 0.0f;}
-		break;
-	case EDGE_MODE_TAG_BEVEL:
-		if (val)		{eed->bweight = 1.0f;}
-		else			{eed->bweight = 0.0f;}
-		break;
-	}
-}
-
-int edgetag_context_check(Scene *scene, EditEdge *eed)
-{
-	switch (scene->toolsettings->edge_mode) {
-	case EDGE_MODE_SELECT:
-		return (eed->f & SELECT) ? 1 : 0;
-	case EDGE_MODE_TAG_SEAM:
-		return eed->seam ? 1 : 0;
-	case EDGE_MODE_TAG_SHARP:
-		return eed->sharp ? 1 : 0;
-	case EDGE_MODE_TAG_CREASE:	
-		return eed->crease ? 1 : 0;
-	case EDGE_MODE_TAG_BEVEL:
-		return eed->bweight ? 1 : 0;
-	}
-	return 0;
-}
-
+	Mesh *me;
+	MPoly *mp;
+	MTexPoly *tf;
+	MLoop *ml;
+	MVert *mvert;
+	int a, b, ok = 0;
+	float vec[3], bmat[3][3];
 
-int edgetag_shortest_path(Scene *scene, EditMesh *em, EditEdge *source, EditEdge *target)
-{
-	EditEdge *eed;
-	EditVert *ev;
+	me = get_mesh(ob);
+	if (!me || !me->mtpoly) return ok;
 	
-	Heap *heap;
-	float *cost;
-	int a, totvert=0, totedge=0, *nedges, *edges, *prevedge, mednum = -1, nedgeswap = 0;
-
-
-	/* we need the vert */
-	for (ev= em->verts.first, totvert=0; ev; ev= ev->next) {
-		ev->tmp.l = totvert;
-		totvert++;
-	}
-
-	for (eed= em->edges.first; eed; eed = eed->next) {
-		eed->f2 = 0;
-		if (eed->h) {
-			eed->f2 |= ME_SEAM_DONE;
-		}
-		eed->tmp.l = totedge;
-		totedge++;
-	}
-
-	/* alloc */
-	nedges = MEM_callocN(sizeof(*nedges)*totvert+1, "SeamPathNEdges");
-	edges = MEM_mallocN(sizeof(*edges)*totedge*2, "SeamPathEdges");
-	prevedge = MEM_mallocN(sizeof(*prevedge)*totedge, "SeamPathPrevious");
-	cost = MEM_mallocN(sizeof(*cost)*totedge, "SeamPathCost");
-
-	/* count edges, compute adjacent edges offsets and fill adjacent edges */
-	for (eed= em->edges.first; eed; eed = eed->next) {
-		nedges[eed->v1->tmp.l+1]++;
-		nedges[eed->v2->tmp.l+1]++;
-	}
-
-	for (a=1; a<totvert; a++) {
-		int newswap = nedges[a+1];
-		nedges[a+1] = nedgeswap + nedges[a];
-		nedgeswap = newswap;
-	}
-	nedges[0] = nedges[1] = 0;
-
-	for (a=0, eed= em->edges.first; eed; a++, eed = eed->next) {
-		edges[nedges[eed->v1->tmp.l+1]++] = a;
-		edges[nedges[eed->v2->tmp.l+1]++] = a;
+	copy_m3_m4(bmat, ob->obmat);
 
-		cost[a] = 1e20f;
-		prevedge[a] = -1;
-	}
-
-	/* regular dijkstra shortest path, but over edges instead of vertices */
-	heap = BLI_heap_new();
-	BLI_heap_insert(heap, 0.0f, SET_INT_IN_POINTER(source->tmp.l));
-	cost[source->tmp.l] = 0.0f;
-
-	EM_init_index_arrays(em, 1, 1, 0);
-
-
-	while (!BLI_heap_empty(heap)) {
-		mednum = GET_INT_FROM_POINTER(BLI_heap_popmin(heap));
-		eed = EM_get_edge_for_index( mednum );
-
-		if (mednum == target->tmp.l)
-			break;
-
-		if (eed->f2 & ME_SEAM_DONE)
+	mvert = me->mvert;
+	mp = me->mpoly;
+	tf = me->mtpoly;
+	for (a = me->totpoly; a > 0; a--, mp++, tf++) {
+		if (mp->flag & ME_HIDE || !(mp->flag & ME_FACE_SEL))
 			continue;
 
-		eed->f2 |= ME_SEAM_DONE;
-
-		edgetag_add_adjacent(heap, mednum, eed->v1->tmp.l, nedges, edges, prevedge, cost);
-		edgetag_add_adjacent(heap, mednum, eed->v2->tmp.l, nedges, edges, prevedge, cost);
-	}
-	
-	
-	MEM_freeN(nedges);
-	MEM_freeN(edges);
-	MEM_freeN(cost);
-	BLI_heap_free(heap, NULL);
-
-	for (eed= em->edges.first; eed; eed = eed->next) {
-		eed->f2 &= ~ME_SEAM_DONE;
-	}
-
-	if (mednum != target->tmp.l) {
-		MEM_freeN(prevedge);
-		EM_free_index_arrays();
-		return 0;
-	}
-
-	/* follow path back to source and mark as seam */
-	if (mednum == target->tmp.l) {
-		short allseams = 1;
+		ml = me->mloop + mp->totloop;
+		for (b = 0; b < mp->totloop; b++, ml++) {
+			copy_v3_v3(vec, (mvert[ml->v].co));
+			mul_m3_v3(bmat, vec);
+			add_v3_v3v3(vec, vec, ob->obmat[3]);
+			DO_MINMAX(vec, min, max);		
+		}
 
-		mednum = target->tmp.l;
-		do {
-			eed = EM_get_edge_for_index( mednum );
-			if (!edgetag_context_check(scene, eed)) {
-				allseams = 0;
-				break;
-			}
-			mednum = prevedge[mednum];
-		} while (mednum != source->tmp.l);
-
-		mednum = target->tmp.l;
-		do {
-			eed = EM_get_edge_for_index( mednum );
-			if (allseams)
-				edgetag_context_set(scene, eed, 0);
-			else
-				edgetag_context_set(scene, eed, 1);
-			mednum = prevedge[mednum];
-		} while (mednum != -1);
+		ok = 1;
 	}
 
-	MEM_freeN(prevedge);
-	EM_free_index_arrays();
-	return 1;
+	return ok;
 }
 
 /* *************************************** */
 #if 0
-static void seam_edgehash_insert_face(EdgeHash *ehash, MFace *mf)
+static void seam_edgehash_insert_face(EdgeHash *ehash, MPoly *mp, MLoop *loopstart)
 {
-	BLI_edgehash_insert(ehash, mf->v1, mf->v2, NULL);
-	BLI_edgehash_insert(ehash, mf->v2, mf->v3, NULL);
-	if (mf->v4) {
-		BLI_edgehash_insert(ehash, mf->v3, mf->v4, NULL);
-		BLI_edgehash_insert(ehash, mf->v4, mf->v1, NULL);
+	MLoop *ml1, *ml2;
+	int a;
+
+	for (a = 0; a < mp->totloop; a++) {
+		ml1 = loopstart + a;
+		ml2 = loopstart + (a + 1) % mp->totloop;
+
+		BLI_edgehash_insert(ehash, ml1->v, ml2->v, NULL);
 	}
-	else
-		BLI_edgehash_insert(ehash, mf->v3, mf->v1, NULL);
 }
 
 void seam_mark_clear_tface(Scene *scene, short mode)
 {
 	Mesh *me;
-	MFace *mf;
+	MPoly *mp;
+	MLoop *ml1, *ml2;
 	MEdge *med;
-	int a;
+	int a, b;
 	
-	me= get_mesh(OBACT);
-	if(me==0 ||  me->totface==0) return;
+	me = get_mesh(OBACT);
+	if (me == 0 ||  me->totpoly == 0) return;
 
 	if (mode == 0)
 		mode = pupmenu("Seams%t|Mark Border Seam %x1|Clear Seam %x2");
@@ -675,11 +471,11 @@ void seam_mark_clear_tface(Scene *scene, short mode)
 	if (mode == 2) {
 		EdgeHash *ehash = BLI_edgehash_new();
 
-		for (a=0, mf=me->mface; a<me->totface; a++, mf++)
-			if (!(mf->flag & ME_HIDE) && (mf->flag & ME_FACE_SEL))
-				seam_edgehash_insert_face(ehash, mf);
+		for (a = 0, mp = me->mpoly; a < me->totpoly; a++, mp++)
+			if (!(mp->flag & ME_HIDE) && (mp->flag & ME_FACE_SEL))
+				seam_edgehash_insert_face(ehash, mp, me->mloop + mp->loopstart);
 
-		for (a=0, med=me->medge; a<me->totedge; a++, med++)
+		for (a = 0, med = me->medge; a < me->totedge; a++, med++)
 			if (BLI_edgehash_haskey(ehash, med->v1, med->v2))
 				med->flag &= ~ME_SEAM;
 
@@ -690,16 +486,16 @@ void seam_mark_clear_tface(Scene *scene, short mode)
 		EdgeHash *ehash1 = BLI_edgehash_new();
 		EdgeHash *ehash2 = BLI_edgehash_new();
 
-		for (a=0, mf=me->mface; a<me->totface; a++, mf++) {
-			if ((mf->flag & ME_HIDE) || !(mf->flag & ME_FACE_SEL))
-				seam_edgehash_insert_face(ehash1, mf);
+		for (a = 0, mp = me->mpoly; a < me->totpoly; a++, mp++) {
+			if ((mp->flag & ME_HIDE) || !(mp->flag & ME_FACE_SEL))
+				seam_edgehash_insert_face(ehash1, mp, me->mloop + mp->loopstart);
 			else
-				seam_edgehash_insert_face(ehash2, mf);
+				seam_edgehash_insert_face(ehash2, mp, me->mloop + mp->loopstart);
 		}
 
-		for (a=0, med=me->medge; a<me->totedge; a++, med++)
+		for (a = 0, med = me->medge; a < me->totedge; a++, med++)
 			if (BLI_edgehash_haskey(ehash1, med->v1, med->v2) &&
-				BLI_edgehash_haskey(ehash2, med->v1, med->v2))
+			    BLI_edgehash_haskey(ehash2, med->v1, med->v2))
 				med->flag |= ME_SEAM;
 
 		BLI_edgehash_free(ehash1, NULL);
@@ -716,90 +512,101 @@ void seam_mark_clear_tface(Scene *scene, short mode)
 int paintface_mouse_select(struct bContext *C, Object *ob, const int mval[2], int extend)
 {
 	Mesh *me;
-	MFace *mface, *msel;
+	MPoly *mpoly, *mpoly_sel;
 	unsigned int a, index;
 	
 	/* Get the face under the cursor */
 	me = get_mesh(ob);
 
-	if (!facesel_face_pick(C, me, mval, &index, 1))
+	if (!facesel_face_pick(C, me, ob, mval, &index, 1))
 		return 0;
 	
-	msel= (((MFace*)me->mface)+index);
-	if (msel->flag & ME_HIDE) return 0;
+	if (index >= me->totpoly || index < 0)
+		return 0;
+
+	mpoly_sel = me->mpoly + index;
+	if (mpoly_sel->flag & ME_HIDE) return 0;
 	
 	/* clear flags */
-	mface = me->mface;
-	a = me->totface;
+	mpoly = me->mpoly;
+	a = me->totpoly;
 	if (!extend) {
 		while (a--) {
-			mface->flag &= ~ME_FACE_SEL;
-			mface++;
+			mpoly->flag &= ~ME_FACE_SEL;
+			mpoly++;
 		}
 	}
 	
 	me->act_face = (int)index;
 
 	if (extend) {
-		if (msel->flag & ME_FACE_SEL)
-			msel->flag &= ~ME_FACE_SEL;
+		if (mpoly_sel->flag & ME_FACE_SEL)
+			mpoly_sel->flag &= ~ME_FACE_SEL;
 		else
-			msel->flag |= ME_FACE_SEL;
+			mpoly_sel->flag |= ME_FACE_SEL;
 	}
-	else msel->flag |= ME_FACE_SEL;
+	else mpoly_sel->flag |= ME_FACE_SEL;
 	
 	/* image window redraw */
 	
 	paintface_flush_flags(ob);
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, ob->data);
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data);
 	ED_region_tag_redraw(CTX_wm_region(C)); // XXX - should redraw all 3D views
 	return 1;
 }
 
 int do_paintface_box_select(ViewContext *vc, rcti *rect, int select, int extend)
 {
+	Object *ob = vc->obact;
 	Mesh *me;
-	MFace *mface;
+	MPoly *mpoly;
 	struct ImBuf *ibuf;
 	unsigned int *rt;
-	int a, index;
 	char *selar;
-	int sx= rect->xmax-rect->xmin+1;
-	int sy= rect->ymax-rect->ymin+1;
-
-	me= get_mesh(vc->obact);
+	int a, index;
+	int sx = rect->xmax - rect->xmin + 1;
+	int sy = rect->ymax - rect->ymin + 1;
+	
+	me = get_mesh(ob);
 
-	if(me==NULL || me->totface==0 || sx*sy <= 0)
+	if (me == NULL || me->totpoly == 0 || sx * sy <= 0)
 		return OPERATOR_CANCELLED;
 
-	selar= MEM_callocN(me->totface+1, "selar");
+	selar = MEM_callocN(me->totpoly + 1, "selar");
 
-	if (extend == 0 && select)
+	if (extend == 0 && select) {
 		paintface_deselect_all_visible(vc->obact, SEL_DESELECT, FALSE);
 
+		mpoly = me->mpoly;
+		for (a = 1; a <= me->totpoly; a++, mpoly++) {
+			if ((mpoly->flag & ME_HIDE) == 0)
+				mpoly->flag &= ~ME_FACE_SEL;
+		}
+	}
+
 	view3d_validate_backbuf(vc);
 
-	ibuf = IMB_allocImBuf(sx,sy,32,IB_rect);
+	ibuf = IMB_allocImBuf(sx, sy, 32, IB_rect);
 	rt = ibuf->rect;
-	glReadPixels(rect->xmin+vc->ar->winrct.xmin,  rect->ymin+vc->ar->winrct.ymin, sx, sy, GL_RGBA, GL_UNSIGNED_BYTE,  ibuf->rect);
-	if(ENDIAN_ORDER==B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf);
-
-	a= sx*sy;
-	while(a--) {
-		if(*rt) {
-			index= WM_framebuffer_to_index(*rt);
-			if(index<=me->totface) selar[index]= 1;
+	glReadPixels(rect->xmin + vc->ar->winrct.xmin,  rect->ymin + vc->ar->winrct.ymin, sx, sy, GL_RGBA, GL_UNSIGNED_BYTE,  ibuf->rect);
+	if (ENDIAN_ORDER == B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf);
+
+	a = sx * sy;
+	while (a--) {
+		if (*rt) {
+			index = WM_framebuffer_to_index(*rt);
+			if (index <= me->totpoly) selar[index] = 1;
 		}
 		rt++;
 	}
 
-	mface= me->mface;
-	for(a=1; a<=me->totface; a++, mface++) {
-		if(selar[a]) {
-			if(mface->flag & ME_HIDE);
+	mpoly = me->mpoly;
+	for (a = 1; a <= me->totpoly; a++, mpoly++) {
+		if (selar[a]) {
+			if (mpoly->flag & ME_HIDE) ;
 			else {
-				if(select) mface->flag |= ME_FACE_SEL;
-				else mface->flag &= ~ME_FACE_SEL;
+				if (select) mpoly->flag |= ME_FACE_SEL;
+				else mpoly->flag &= ~ME_FACE_SEL;
 			}
 		}
 	}
@@ -817,6 +624,104 @@ int do_paintface_box_select(ViewContext *vc, rcti *rect, int select, int extend)
 }
 
 
+/*  (similar to void paintface_flush_flags(Object *ob))
+ * copy the vertex flags, most importantly selection from the mesh to the final derived mesh,
+ * use in object mode when selecting vertices (while painting) */
+void paintvert_flush_flags(Object *ob)
+{
+	Mesh *me = get_mesh(ob);
+	DerivedMesh *dm = ob->derivedFinal;
+	MVert *dm_mvert, *dm_mv;
+	int *index_array = NULL;
+	int totvert;
+	int i;
+
+	if (me == NULL || dm == NULL)
+		return;
+
+	index_array = dm->getVertDataArray(dm, CD_ORIGINDEX);
+
+	dm_mvert = dm->getVertArray(dm);
+	totvert = dm->getNumVerts(dm);
+
+	dm_mv = dm_mvert;
+
+	if (index_array) {
+		int orig_index;
+		for (i = 0; i < totvert; i++, dm_mv++) {
+			orig_index = index_array[i];
+			if (orig_index != ORIGINDEX_NONE) {
+				dm_mv->flag = me->mvert[index_array[i]].flag;
+			}
+		}
+	}
+	else {
+		for (i = 0; i < totvert; i++, dm_mv++) {
+			dm_mv->flag = me->mvert[i].flag;
+		}
+	}
+}
+/*  note: if the caller passes FALSE to flush_flags, then they will need to run paintvert_flush_flags(ob) themselves */
+void paintvert_deselect_all_visible(Object *ob, int action, short flush_flags)
+{
+	Mesh *me;
+	MVert *mvert;
+	int a;
+
+	me = get_mesh(ob);
+	if (me == NULL) return;
+	
+	if (action == SEL_INVERT) {
+		mvert = me->mvert;
+		a = me->totvert;
+		while (a--) {
+			if ((mvert->flag & ME_HIDE) == 0) {
+				mvert->flag ^= SELECT;
+			}
+			mvert++;
+		}
+	}
+	else {
+		if (action == SEL_TOGGLE) {
+			action = SEL_SELECT;
+
+			mvert = me->mvert;
+			a = me->totvert;
+			while (a--) {
+				if ((mvert->flag & ME_HIDE) == 0 && mvert->flag & SELECT) {
+					action = SEL_DESELECT;
+					break;
+				}
+				mvert++;
+			}
+		}
+
+		mvert = me->mvert;
+		a = me->totvert;
+		while (a--) {
+			if ((mvert->flag & ME_HIDE) == 0) {
+				switch (action) {
+					case SEL_SELECT:
+						mvert->flag |= SELECT;
+						break;
+					case SEL_DESELECT:
+						mvert->flag &= ~SELECT;
+						break;
+					case SEL_INVERT:
+						mvert->flag ^= SELECT;
+						break;
+				}
+			}
+			mvert++;
+		}
+	}
+
+	if (flush_flags) {
+		paintvert_flush_flags(ob);
+	}
+}
+
+
 /* ********************* MESH VERTEX MIRR TOPO LOOKUP *************** */
 /* note, this is not the best place for the function to be but moved
  * here to for the purpose of syncing with bmesh */
@@ -824,21 +729,21 @@ int do_paintface_box_select(ViewContext *vc, rcti *rect, int select, int extend)
 typedef int MirrTopoHash_t;
 
 typedef struct MirrTopoVert_t {
-	MirrTopoHash_t  hash;
-	int             v_index;
+	MirrTopoHash_t hash;
+	int v_index;
 } MirrTopoVert_t;
 
 static int mirrtopo_hash_sort(const void *l1, const void *l2)
 {
-	if       ((MirrTopoHash_t)(intptr_t)l1 > (MirrTopoHash_t)(intptr_t)l2 ) return  1;
-	else if  ((MirrTopoHash_t)(intptr_t)l1 < (MirrTopoHash_t)(intptr_t)l2 ) return -1;
+	if      ((MirrTopoHash_t)(intptr_t)l1 > (MirrTopoHash_t)(intptr_t)l2) return 1;
+	else if ((MirrTopoHash_t)(intptr_t)l1 < (MirrTopoHash_t)(intptr_t)l2) return -1;
 	return 0;
 }
 
 static int mirrtopo_vert_sort(const void *v1, const void *v2)
 {
-	if      (((MirrTopoVert_t *)v1)->hash > ((MirrTopoVert_t *)v2)->hash ) return  1;
-	else if (((MirrTopoVert_t *)v1)->hash < ((MirrTopoVert_t *)v2)->hash ) return -1;
+	if      (((MirrTopoVert_t *)v1)->hash > ((MirrTopoVert_t *)v2)->hash) return 1;
+	else if (((MirrTopoVert_t *)v1)->hash < ((MirrTopoVert_t *)v2)->hash) return -1;
 	return 0;
 }
 
@@ -847,19 +752,19 @@ int ED_mesh_mirrtopo_recalc_check(Mesh *me, const int ob_mode, MirrTopoStore_t *
 	int totvert;
 	int totedge;
 
-	if (me->edit_mesh) {
-		totvert = me->edit_mesh->totvert;
-		totedge = me->edit_mesh->totedge;
+	if (me->edit_btmesh) {
+		totvert = me->edit_btmesh->bm->totvert;
+		totedge = me->edit_btmesh->bm->totedge;
 	}
 	else {
 		totvert = me->totvert;
 		totedge = me->totedge;
 	}
 
-	if(	(mesh_topo_store->index_lookup==NULL) ||
-		(mesh_topo_store->prev_ob_mode != ob_mode) ||
-		(totvert != mesh_topo_store->prev_vert_tot) ||
-		(totedge != mesh_topo_store->prev_edge_tot))
+	if ((mesh_topo_store->index_lookup == NULL) ||
+	    (mesh_topo_store->prev_ob_mode != ob_mode) ||
+	    (totvert != mesh_topo_store->prev_vert_tot) ||
+	    (totedge != mesh_topo_store->prev_edge_tot))
 	{
 		return TRUE;
 	}
@@ -873,11 +778,11 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to
                            const short skip_em_vert_array_init)
 {
 	MEdge *medge;
-	EditMesh *em = me->edit_mesh;
-	void **eve_tmp_back = NULL; /* some of the callers are using eve->tmp so restore after */
+	BMEditMesh *em = me->edit_btmesh;
 
 	/* editmode*/
-	EditEdge *eed;
+	BMEdge *eed;
+	BMIter iter;
 
 	int a, last;
 	int totvert, totedge;
@@ -894,14 +799,10 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to
 
 	mesh_topo_store->prev_ob_mode = ob_mode;
 
-	if(em) {
-		EditVert *eve;
-		totvert = 0;
-		eve_tmp_back = MEM_mallocN(em->totvert * sizeof(void *), "TopoMirr");
-		for(eve = em->verts.first; eve; eve = eve->next) {
-			eve_tmp_back[totvert]= eve->tmp.p;
-			eve->tmp.l = totvert++;
-		}
+	if (em) {
+		BM_mesh_elem_index_ensure(em->bm, BM_VERT);
+
+		totvert = em->bm->totvert;
 	}
 	else {
 		totvert = me->totvert;
@@ -910,18 +811,18 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to
 	topo_hash = MEM_callocN(totvert * sizeof(MirrTopoHash_t), "TopoMirr");
 
 	/* Initialize the vert-edge-user counts used to detect unique topology */
-	if(em) {
-		totedge = 0;
+	if (em) {
+		totedge = me->edit_btmesh->bm->totedge;
 
-		for(eed=em->edges.first; eed; eed = eed->next, totedge++) {
-			topo_hash[eed->v1->tmp.l]++;
-			topo_hash[eed->v2->tmp.l]++;
+		BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
+			topo_hash[BM_elem_index_get(eed->v1)]++;
+			topo_hash[BM_elem_index_get(eed->v2)]++;
 		}
 	}
 	else {
 		totedge = me->totedge;
 
-		for(a=0, medge=me->medge; a < me->totedge; a++, medge++) {
+		for (a = 0, medge = me->medge; a < me->totedge; a++, medge++) {
 			topo_hash[medge->v1]++;
 			topo_hash[medge->v2]++;
 		}
@@ -930,17 +831,17 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to
 	topo_hash_prev = MEM_dupallocN(topo_hash);
 
 	tot_unique_prev = -1;
-	while(1) {
+	while (1) {
 		/* use the number of edges per vert to give verts unique topology IDs */
 
-		if(em) {
-			for(eed=em->edges.first; eed; eed = eed->next) {
-				topo_hash[eed->v1->tmp.l] += topo_hash_prev[eed->v2->tmp.l];
-				topo_hash[eed->v2->tmp.l] += topo_hash_prev[eed->v1->tmp.l];
+		if (em) {
+			BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
+				topo_hash[BM_elem_index_get(eed->v1)] += topo_hash_prev[BM_elem_index_get(eed->v2)];
+				topo_hash[BM_elem_index_get(eed->v2)] += topo_hash_prev[BM_elem_index_get(eed->v1)];
 			}
 		}
 		else {
-			for(a=0, medge=me->medge; a<me->totedge; a++, medge++) {
+			for (a = 0, medge = me->medge; a < me->totedge; a++, medge++) {
 				/* This can make really big numbers, wrapping around here is fine */
 				topo_hash[medge->v1] += topo_hash_prev[medge->v2];
 				topo_hash[medge->v2] += topo_hash_prev[medge->v1];
@@ -952,8 +853,8 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to
 		qsort(topo_hash_prev, totvert, sizeof(MirrTopoHash_t), mirrtopo_hash_sort);
 
 		tot_unique = 1; /* account for skiping the first value */
-		for(a=1; a<totvert; a++) {
-			if (topo_hash_prev[a-1] != topo_hash_prev[a]) {
+		for (a = 1; a < totvert; a++) {
+			if (topo_hash_prev[a - 1] != topo_hash_prev[a]) {
 				tot_unique++;
 			}
 		}
@@ -970,33 +871,20 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to
 		memcpy(topo_hash_prev, topo_hash, sizeof(MirrTopoHash_t) * totvert);
 	}
 
-	/* restore eve->tmp.* */
-	if(eve_tmp_back) {
-		EditVert *eve;
-		totvert = 0;
-		for(eve = em->verts.first; eve; eve = eve->next) {
-			eve->tmp.p = eve_tmp_back[totvert++];
-		}
-
-		MEM_freeN(eve_tmp_back);
-		eve_tmp_back = NULL;
-	}
-
-
 	/* Hash/Index pairs are needed for sorting to find index pairs */
-	topo_pairs = MEM_callocN( sizeof(MirrTopoVert_t) * totvert, "MirrTopoPairs");
+	topo_pairs = MEM_callocN(sizeof(MirrTopoVert_t) * totvert, "MirrTopoPairs");
 
 	/* since we are looping through verts, initialize these values here too */
 	index_lookup = MEM_mallocN(totvert * sizeof(*index_lookup), "mesh_topo_lookup");
 
-	if(em) {
+	if (em) {
 		if (skip_em_vert_array_init == FALSE) {
-			EM_init_index_arrays(em, 1, 0, 0);
+			EDBM_index_arrays_init(em, 1, 0, 0);
 		}
 	}
 
 
-	for(a=0; a<totvert; a++) {
+	for (a = 0; a < totvert; a++) {
 		topo_pairs[a].hash    = topo_hash[a];
 		topo_pairs[a].v_index = a;
 
@@ -1011,25 +899,25 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to
 
 	/* Get the pairs out of the sorted hashes, note, totvert+1 means we can use the previous 2,
 	 * but you cant ever access the last 'a' index of MirrTopoPairs */
-	for(a=2; a <= totvert; a++) {
-		/* printf("I %d %ld %d\n", (a-last), MirrTopoPairs[a  ].hash, MirrTopoPairs[a  ].vIndex ); */
-		if ((a==totvert) || (topo_pairs[a-1].hash != topo_pairs[a].hash)) {
-			if (a-last==2) {
-				if(em) {
-					index_lookup[topo_pairs[a-1].v_index] =	(intptr_t)EM_get_vert_for_index(topo_pairs[a-2].v_index);
-					index_lookup[topo_pairs[a-2].v_index] =	(intptr_t)EM_get_vert_for_index(topo_pairs[a-1].v_index);
+	for (a = 2; a <= totvert; a++) {
+		/* printf("I %d %ld %d\n", (a-last), MirrTopoPairs[a  ].hash, MirrTopoPairs[a  ].v_index ); */
+		if ((a == totvert) || (topo_pairs[a - 1].hash != topo_pairs[a].hash)) {
+			if (a - last == 2) {
+				if (em) {
+					index_lookup[topo_pairs[a - 1].v_index] = (intptr_t)EDBM_vert_at_index(em, topo_pairs[a - 2].v_index);
+					index_lookup[topo_pairs[a - 2].v_index] = (intptr_t)EDBM_vert_at_index(em, topo_pairs[a - 1].v_index);
 				}
 				else {
-					index_lookup[topo_pairs[a-1].v_index] =	topo_pairs[a-2].v_index;
-					index_lookup[topo_pairs[a-2].v_index] =	topo_pairs[a-1].v_index;
+					index_lookup[topo_pairs[a - 1].v_index] = topo_pairs[a - 2].v_index;
+					index_lookup[topo_pairs[a - 2].v_index] = topo_pairs[a - 1].v_index;
 				}
 			}
 			last = a;
 		}
 	}
-	if(em) {
+	if (em) {
 		if (skip_em_vert_array_init == FALSE) {
-			EM_free_index_arrays();
+			EDBM_index_arrays_free(em);
 		}
 	}
 
diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c
deleted file mode 100644
index 6ebee79..0000000
--- a/source/blender/editors/mesh/editmesh.c
+++ /dev/null
@@ -1,2069 +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.
- *
- * Contributor(s): Blender Foundation, full recode 2002-2008
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/mesh/editmesh.c
- *  \ingroup edmesh
- */
-
-
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_scene_types.h"
-#include "DNA_object_types.h"
-#include "DNA_key_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_modifier_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
-#include "BLI_editVert.h"
-#include "BLI_dynstr.h"
-#include "BLI_rand.h"
-#include "BLI_utildefines.h"
-
-#include "BKE_DerivedMesh.h"
-#include "BKE_context.h"
-#include "BKE_depsgraph.h"
-#include "BKE_global.h"
-#include "BKE_key.h"
-#include "BKE_main.h"
-#include "BKE_material.h"
-#include "BKE_mesh.h"
-#include "BKE_paint.h"
-#include "BKE_report.h"
-#include "BKE_multires.h"
-
-#include "ED_mesh.h"
-#include "ED_object.h"
-#include "ED_screen.h"
-#include "ED_util.h"
-#include "ED_view3d.h"
-
-#include "RNA_access.h"
-#include "RNA_define.h"
-
-#include "WM_api.h"
-#include "WM_types.h"
-
-/* own include */
-#include "mesh_intern.h"
-
-/* 
-editmesh.c:
-	- add/alloc/free data
-	- hashtables
-	- enter/exit editmode
-*/
-
-/* XXX */
-static void BIF_undo_push(const char *UNUSED(arg)) {}
-static void error(const char *UNUSED(arg)) {}
-
-
-/* ***************** HASH ********************* */
-
-
-#define EDHASHSIZE		(512*512)
-#define EDHASH(a, b)	(a % EDHASHSIZE)
-
-
-/* ************ ADD / REMOVE / FIND ****************** */
-
-static void *calloc_em(EditMesh *UNUSED(em), size_t size, size_t nr)
-{
-	return calloc(size, nr);
-}
-
-/* used to bypass normal calloc with fast one */
-static void *(*callocvert)(EditMesh *, size_t, size_t) = calloc_em;
-static void *(*callocedge)(EditMesh *, size_t, size_t) = calloc_em;
-static void *(*callocface)(EditMesh *, size_t, size_t) = calloc_em;
-
-EditVert *addvertlist(EditMesh *em, float *vec, EditVert *example)
-{
-	EditVert *eve;
-	static int hashnr= 0;
-
-	eve= callocvert(em, sizeof(EditVert), 1);
-	BLI_addtail(&em->verts, eve);
-	em->totvert++;
-	
-	if(vec) VECCOPY(eve->co, vec);
-
-	eve->hash= hashnr++;
-	if( hashnr>=EDHASHSIZE) hashnr= 0;
-
-	/* new verts get keyindex of -1 since they did not
-	 * have a pre-editmode vertex order
-	 */
-	eve->keyindex = -1;
-
-	if(example) {
-		CustomData_em_copy_data(&em->vdata, &em->vdata, example->data, &eve->data);
-		eve->bweight = example->bweight;
-	}
-	else {
-		CustomData_em_set_default(&em->vdata, &eve->data);
-	}
-
-	return eve;
-}
-
-void free_editvert (EditMesh *em, EditVert *eve)
-{
-
-	EM_remove_selection(em, eve, EDITVERT);
-	CustomData_em_free_block(&em->vdata, &eve->data);
-	if(eve->fast==0)
-		free(eve);
-	
-	em->totvert--;
-}
-
-
-EditEdge *findedgelist(EditMesh *em, EditVert *v1, EditVert *v2)
-{
-	EditVert *v3;
-	struct HashEdge *he;
-
-	/* swap ? */
-	if( v1 > v2) {
-		v3= v2; 
-		v2= v1; 
-		v1= v3;
-	}
-	
-	if(em->hashedgetab==NULL)
-		em->hashedgetab= MEM_callocN(EDHASHSIZE*sizeof(struct HashEdge), "hashedgetab");
-
-	he= em->hashedgetab + EDHASH(v1->hash, v2->hash);
-	
-	while(he) {
-		
-		if(he->eed && he->eed->v1==v1 && he->eed->v2==v2) return he->eed;
-		
-		he= he->next;
-	}
-	return 0;
-}
-
-static void insert_hashedge(EditMesh *em, EditEdge *eed)
-{
-	/* assuming that eed is not in the list yet, and that a find has been done before */
-	
-	struct HashEdge *first, *he;
-
-	first= em->hashedgetab + EDHASH(eed->v1->hash, eed->v2->hash);
-
-	if( first->eed==0 ) {
-		first->eed= eed;
-	}
-	else {
-		he= &eed->hash; 
-		he->eed= eed;
-		he->next= first->next;
-		first->next= he;
-	}
-}
-
-static void remove_hashedge(EditMesh *em, EditEdge *eed)
-{
-	/* assuming eed is in the list */
-	
-	struct HashEdge *first, *he, *prev=NULL;
-
-	he=first= em->hashedgetab + EDHASH(eed->v1->hash, eed->v2->hash);
-
-	while(he) {
-		if(he->eed == eed) {
-			/* remove from list */
-			if(he==first) {
-				if(first->next) {
-					he= first->next;
-					first->eed= he->eed;
-					first->next= he->next;
-				}
-				else he->eed= 0;
-			}
-			else {
-				prev->next= he->next;
-			}
-			return;
-		}
-		prev= he;
-		he= he->next;
-	}
-}
-
-EditEdge *addedgelist(EditMesh *em, EditVert *v1, EditVert *v2, EditEdge *example)
-{
-	EditVert *v3;
-	EditEdge *eed;
-	int swap= 0;
-	
-	if(v1==v2) return NULL;
-	if(v1==NULL || v2==NULL) return NULL;
-
-	/* swap ? */
-	if(v1>v2) {
-		v3= v2; 
-		v2= v1; 
-		v1= v3;
-		swap= 1;
-	}
-	
-	/* find in hashlist */
-	eed= findedgelist(em, v1, v2);
-
-	if(eed==NULL) {
-	
-		eed= (EditEdge *)callocedge(em, sizeof(EditEdge), 1);
-		eed->v1= v1;
-		eed->v2= v2;
-		BLI_addtail(&em->edges, eed);
-		eed->dir= swap;
-		insert_hashedge(em, eed);
-		em->totedge++;
-		
-		/* copy edge data:
-		   rule is to do this with addedgelist call, before addfacelist */
-		if(example) {
-			eed->crease= example->crease;
-			eed->bweight= example->bweight;
-			eed->sharp = example->sharp;
-			eed->seam = example->seam;
-			eed->h |= (example->h & EM_FGON);
-		}
-	}
-	
-	return eed;
-}
-
-void remedge(EditMesh *em, EditEdge *eed)
-{
-	BLI_remlink(&em->edges, eed);
-	remove_hashedge(em, eed);
-	
-	em->totedge--;
-}
-
-void free_editedge(EditMesh *em, EditEdge *eed)
-{
-	EM_remove_selection(em, eed, EDITEDGE);
-	if(eed->fast==0){ 
-		free(eed);
-	}
-}
-
-void free_editface(EditMesh *em, EditFace *efa)
-{
-	EM_remove_selection(em, efa, EDITFACE);
-	
-	if (em->act_face==efa) {
-		EM_set_actFace(em, em->faces.first == efa ? NULL : em->faces.first);
-	}
-		
-	CustomData_em_free_block(&em->fdata, &efa->data);
-	if(efa->fast==0)
-		free(efa);
-	
-	em->totface--;
-}
-
-void free_vertlist(EditMesh *em, ListBase *edve) 
-{
-	EditVert *eve, *next;
-
-	if (!edve) return;
-
-	eve= edve->first;
-	while(eve) {
-		next= eve->next;
-		free_editvert(em, eve);
-		eve= next;
-	}
-	edve->first= edve->last= NULL;
-	em->totvert= em->totvertsel= 0;
-}
-
-void free_edgelist(EditMesh *em, ListBase *lb)
-{
-	EditEdge *eed, *next;
-	
-	eed= lb->first;
-	while(eed) {
-		next= eed->next;
-		free_editedge(em, eed);
-		eed= next;
-	}
-	lb->first= lb->last= NULL;
-	em->totedge= em->totedgesel= 0;
-}
-
-void free_facelist(EditMesh *em, ListBase *lb)
-{
-	EditFace *efa, *next;
-	
-	efa= lb->first;
-	while(efa) {
-		next= efa->next;
-		free_editface(em, efa);
-		efa= next;
-	}
-	lb->first= lb->last= NULL;
-	em->totface= em->totfacesel= 0;
-}
-
-EditFace *addfacelist(EditMesh *em, EditVert *v1, EditVert *v2, EditVert *v3, EditVert *v4, EditFace *example, EditFace *exampleEdges)
-{
-	EditFace *efa;
-	EditEdge *e1, *e2=0, *e3=0, *e4=0;
-
-	/* added sanity check... seems to happen for some tools, or for enter editmode for corrupted meshes */
-	if(v1==v4 || v2==v4 || v3==v4) v4= NULL;
-	
-	/* add face to list and do the edges */
-	if(exampleEdges) {
-		e1= addedgelist(em, v1, v2, exampleEdges->e1);
-		e2= addedgelist(em, v2, v3, exampleEdges->e2);
-		if(v4) e3= addedgelist(em, v3, v4, exampleEdges->e3); 
-		else e3= addedgelist(em, v3, v1, exampleEdges->e3);
-		if(v4) e4= addedgelist(em, v4, v1, exampleEdges->e4);
-	}
-	else {
-		e1= addedgelist(em, v1, v2, NULL);
-		e2= addedgelist(em, v2, v3, NULL);
-		if(v4) e3= addedgelist(em, v3, v4, NULL); 
-		else e3= addedgelist(em, v3, v1, NULL);
-		if(v4) e4= addedgelist(em, v4, v1, NULL);
-	}
-	
-	if(v1==v2 || v2==v3 || v1==v3) return NULL;
-	if(e2==0) return NULL;
-
-	efa= (EditFace *)callocface(em, sizeof(EditFace), 1);
-	efa->v1= v1;
-	efa->v2= v2;
-	efa->v3= v3;
-	efa->v4= v4;
-
-	efa->e1= e1;
-	efa->e2= e2;
-	efa->e3= e3;
-	efa->e4= e4;
-
-	if(example) {
-		efa->mat_nr= example->mat_nr;
-		efa->flag= example->flag;
-		CustomData_em_copy_data(&em->fdata, &em->fdata, example->data, &efa->data);
-		CustomData_em_validate_data(&em->fdata, efa->data, efa->v4 ? 4 : 3);
-	}
-	else {
-		efa->mat_nr= em->mat_nr;
-
-		CustomData_em_set_default(&em->fdata, &efa->data);
-	}
-
-	BLI_addtail(&em->faces, efa);
-	em->totface++;
-	
-	if(efa->v4) {
-		normal_quad_v3( efa->n,efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co);
-		cent_quad_v3(efa->cent, efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co);
-	}
-	else {
-		normal_tri_v3( efa->n,efa->v1->co, efa->v2->co, efa->v3->co);
-		cent_tri_v3(efa->cent, efa->v1->co, efa->v2->co, efa->v3->co);
-	}
-
-	return efa;
-}
-
-/* ************************ end add/new/find ************  */
-
-/* ************************ Edit{Vert,Edge,Face} utilss ***************************** */
-
-/* some nice utility functions */
-
-EditVert *editedge_getOtherVert(EditEdge *eed, EditVert *eve)
-{
-	if (eve==eed->v1) {
-		return eed->v2;
-	} else if (eve==eed->v2) {
-		return eed->v1;
-	} else {
-		return NULL;
-	}
-}
-
-EditVert *editedge_getSharedVert(EditEdge *eed, EditEdge *eed2) 
-{
-	if (eed->v1==eed2->v1 || eed->v1==eed2->v2) {
-		return eed->v1;
-	} else if (eed->v2==eed2->v1 || eed->v2==eed2->v2) {
-		return eed->v2;
-	} else {
-		return NULL;
-	}
-}
-
-int editedge_containsVert(EditEdge *eed, EditVert *eve) 
-{
-	return (eed->v1==eve || eed->v2==eve);
-}
-
-int editface_containsVert(EditFace *efa, EditVert *eve) 
-{
-	return (efa->v1==eve || efa->v2==eve || efa->v3==eve || (efa->v4 && efa->v4==eve));
-}
-
-int editface_containsEdge(EditFace *efa, EditEdge *eed) 
-{
-	return (efa->e1==eed || efa->e2==eed || efa->e3==eed || (efa->e4 && efa->e4==eed));
-}
-
-
-/* ************************ stuct EditMesh manipulation ***************************** */
-
-/* fake callocs for fastmalloc below */
-static void *calloc_fastvert(EditMesh *em, size_t UNUSED(size), size_t UNUSED(nr))
-{
-	EditVert *eve= em->curvert++;
-	eve->fast= 1;
-	return eve;
-}
-static void *calloc_fastedge(EditMesh *em, size_t UNUSED(size), size_t UNUSED(nr))
-{
-	EditEdge *eed= em->curedge++;
-	eed->fast= 1;
-	return eed;
-}
-static void *calloc_fastface(EditMesh *em, size_t UNUSED(size), size_t UNUSED(nr))
-{
-	EditFace *efa= em->curface++;
-	efa->fast= 1;
-	return efa;
-}
-
-/* allocate 1 chunk for all vertices, edges, faces. These get tagged to
-   prevent it from being freed
-*/
-static void init_editmesh_fastmalloc(EditMesh *em, int totvert, int totedge, int totface)
-{
-	if(totvert) em->allverts= MEM_callocN(totvert*sizeof(EditVert), "allverts");
-	else em->allverts= NULL;
-	em->curvert= em->allverts;
-	
-	if(totedge==0) totedge= 4*totface;	// max possible
-
-	if(totedge) em->alledges= MEM_callocN(totedge*sizeof(EditEdge), "alledges");
-	else em->alledges= NULL;
-	em->curedge= em->alledges;
-	
-	if(totface) em->allfaces= MEM_callocN(totface*sizeof(EditFace), "allfaces");
-	else em->allfaces= NULL;
-	em->curface= em->allfaces;
-
-	callocvert= calloc_fastvert;
-	callocedge= calloc_fastedge;
-	callocface= calloc_fastface;
-}
-
-static void end_editmesh_fastmalloc(void)
-{
-	callocvert= calloc_em;
-	callocedge= calloc_em;
-	callocface= calloc_em;
-}
-
-/* do not free editmesh itself here */
-void free_editMesh(EditMesh *em)
-{
-	if(em==NULL) return;
-
-	if(em->verts.first) free_vertlist(em, &em->verts);
-	if(em->edges.first) free_edgelist(em, &em->edges);
-	if(em->faces.first) free_facelist(em, &em->faces);
-	if(em->selected.first) BLI_freelistN(&(em->selected));
-
-	CustomData_free(&em->vdata, 0);
-	CustomData_free(&em->fdata, 0);
-
-	if(em->derivedFinal) {
-		if (em->derivedFinal!=em->derivedCage) {
-			em->derivedFinal->needsFree= 1;
-			em->derivedFinal->release(em->derivedFinal);
-		}
-		em->derivedFinal= NULL;
-	}
-	if(em->derivedCage) {
-		em->derivedCage->needsFree= 1;
-		em->derivedCage->release(em->derivedCage);
-		em->derivedCage= NULL;
-	}
-
-	/* DEBUG: hashtabs are slowest part of enter/exit editmode. here a testprint */
-#if 0
-	if(em->hashedgetab) {
-		HashEdge *he, *hen;
-		int a, used=0, max=0, nr;
-		he= em->hashedgetab;
-		for(a=0; a<EDHASHSIZE; a++, he++) {
-			if(he->eed) used++;
-			hen= he->next;
-			nr= 0;
-			while(hen) {
-				nr++;
-				hen= hen->next;
-			}
-			if(max<nr) max= nr;
-		}
-		printf("hastab used %d max %d\n", used, max);
-	}
-#endif
-	if(em->hashedgetab) MEM_freeN(em->hashedgetab);
-	em->hashedgetab= NULL;
-	
-	if(em->allverts) MEM_freeN(em->allverts);
-	if(em->alledges) MEM_freeN(em->alledges);
-	if(em->allfaces) MEM_freeN(em->allfaces);
-	
-	em->allverts= em->curvert= NULL;
-	em->alledges= em->curedge= NULL;
-	em->allfaces= em->curface= NULL;
-	
-	mesh_octree_table(NULL, NULL, NULL, 'e');
-	mesh_mirrtopo_table(NULL, 'e');
-
-	em->totvert= em->totedge= em->totface= 0;
-
-	em->act_face = NULL;
-}
-
-static void editMesh_set_hash(EditMesh *em)
-{
-	EditEdge *eed;
-
-	if(em->hashedgetab) MEM_freeN(em->hashedgetab);
-	em->hashedgetab= NULL;
-	
-	for(eed=em->edges.first; eed; eed= eed->next)  {
-		if( findedgelist(em, eed->v1, eed->v2)==NULL )
-			insert_hashedge(em, eed);
-	}
-
-}
-
-
-/* ************************ IN & OUT EDITMODE ***************************** */
-
-
-static void edge_normal_compare(EditEdge *eed, EditFace *efa1)
-{
-	EditFace *efa2;
-	float cent1[3], cent2[3];
-	float inp;
-	
-	efa2 = eed->tmp.f;
-	if(efa1==efa2) return;
-	
-	inp= efa1->n[0]*efa2->n[0] + efa1->n[1]*efa2->n[1] + efa1->n[2]*efa2->n[2];
-	if(inp<0.999f && inp >-0.999f) eed->f2= 1;
-		
-	if(efa1->v4) cent_quad_v3(cent1, efa1->v1->co, efa1->v2->co, efa1->v3->co, efa1->v4->co);
-	else cent_tri_v3(cent1, efa1->v1->co, efa1->v2->co, efa1->v3->co);
-	if(efa2->v4) cent_quad_v3(cent2, efa2->v1->co, efa2->v2->co, efa2->v3->co, efa2->v4->co);
-	else cent_tri_v3(cent2, efa2->v1->co, efa2->v2->co, efa2->v3->co);
-	
-	sub_v3_v3v3(cent1, cent2, cent1);
-	normalize_v3(cent1);
-	inp= cent1[0]*efa1->n[0] + cent1[1]*efa1->n[1] + cent1[2]*efa1->n[2]; 
-
-	if(inp < -0.001f) eed->f1= 1;
-}
-
-#if 0
-typedef struct {
-	EditEdge *eed;
-	float noLen,no[3];
-	int adjCount;
-} EdgeDrawFlagInfo;
-
-static int edgeDrawFlagInfo_cmp(const void *av, const void *bv)
-{
-	const EdgeDrawFlagInfo *a = av;
-	const EdgeDrawFlagInfo *b = bv;
-
-	if (a->noLen<b->noLen) return -1;
-	else if (a->noLen>b->noLen) return 1;
-	else return 0;
-}
-#endif
-
-static void edge_drawflags(Mesh *me, EditMesh *em)
-{
-	EditVert *eve;
-	EditEdge *eed, *e1, *e2, *e3, *e4;
-	EditFace *efa;
-	
-	/* - count number of times edges are used in faces: 0 en 1 time means draw edge
-	 * - edges more than 1 time used: in *tmp.f is pointer to first face
-	 * - check all faces, when normal differs to much: draw (flag becomes 1)
-	 */
-
-	/* later on: added flags for 'cylinder' and 'sphere' intersection tests in old
-	   game engine (2.04)
-	 */
-	
-	recalc_editnormals(em);
-	
-	/* init */
-	eve= em->verts.first;
-	while(eve) {
-		eve->f1= 1;		/* during test it's set at zero */
-		eve= eve->next;
-	}
-	eed= em->edges.first;
-	while(eed) {
-		eed->f2= eed->f1= 0;
-		eed->tmp.f = 0;
-		eed= eed->next;
-	}
-
-	efa= em->faces.first;
-	while(efa) {
-		e1= efa->e1;
-		e2= efa->e2;
-		e3= efa->e3;
-		e4= efa->e4;
-		if(e1->f2<4) e1->f2+= 1;
-		if(e2->f2<4) e2->f2+= 1;
-		if(e3->f2<4) e3->f2+= 1;
-		if(e4 && e4->f2<4) e4->f2+= 1;
-		
-		if(e1->tmp.f == 0) e1->tmp.f = (void *) efa;
-		if(e2->tmp.f == 0) e2->tmp.f = (void *) efa;
-		if(e3->tmp.f ==0) e3->tmp.f = (void *) efa;
-		if(e4 && (e4->tmp.f == 0)) e4->tmp.f = (void *) efa;
-		
-		efa= efa->next;
-	}
-
-	if(me->drawflag & ME_ALLEDGES) {
-		efa= em->faces.first;
-		while(efa) {
-			if(efa->e1->f2>=2) efa->e1->f2= 1;
-			if(efa->e2->f2>=2) efa->e2->f2= 1;
-			if(efa->e3->f2>=2) efa->e3->f2= 1;
-			if(efa->e4 && efa->e4->f2>=2) efa->e4->f2= 1;
-			
-			efa= efa->next;
-		}		
-	}	
-	else {
-		
-		/* handle single-edges for 'test cylinder flag' (old engine) */
-		
-		eed= em->edges.first;
-		while(eed) {
-			if(eed->f2==1) eed->f1= 1;
-			eed= eed->next;
-		}
-
-		/* all faces, all edges with flag==2: compare normal */
-		efa= em->faces.first;
-		while(efa) {
-			if(efa->e1->f2==2) edge_normal_compare(efa->e1, efa);
-			else efa->e1->f2= 1;
-			if(efa->e2->f2==2) edge_normal_compare(efa->e2, efa);
-			else efa->e2->f2= 1;
-			if(efa->e3->f2==2) edge_normal_compare(efa->e3, efa);
-			else efa->e3->f2= 1;
-			if(efa->e4) {
-				if(efa->e4->f2==2) edge_normal_compare(efa->e4, efa);
-				else efa->e4->f2= 1;
-			}
-			efa= efa->next;
-		}
-		
-		/* sphere collision flag */
-		
-		eed= em->edges.first;
-		while(eed) {
-			if(eed->f1!=1) {
-				eed->v1->f1= eed->v2->f1= 0;
-			}
-			eed= eed->next;
-		}
-		
-	}
-}
-
-/* turns Mesh into editmesh */
-void make_editMesh(Scene *scene, Object *ob)
-{
-	Mesh *me= ob->data;
-	MFace *mface;
-	MVert *mvert;
-	MSelect *mselect;
-	KeyBlock *actkey;
-	EditMesh *em;
-	EditVert *eve, **evlist, *eve1, *eve2, *eve3, *eve4;
-	EditFace *efa, *efa_last_sel= NULL;
-	EditEdge *eed;
-	EditSelection *ese;
-	float *co, (*keyco)[3]= NULL;
-	int tot, a, eekadoodle= 0;
-	const short is_paint_face_sel=                             paint_facesel_test(ob);
-	const short is_paint_vert_sel= is_paint_face_sel ? FALSE : paint_vertsel_test(ob);
-
-	if(me->edit_mesh==NULL)
-		me->edit_mesh= MEM_callocN(sizeof(EditMesh), "editmesh");
-	else 
-		/* because of reload */
-		free_editMesh(me->edit_mesh);
-	
-	em= me->edit_mesh;
-	
-	em->selectmode= scene->toolsettings->selectmode; // warning needs to be synced
-	em->act_face = NULL;
-	em->totvert= tot= me->totvert;
-	em->totedge= me->totedge;
-	em->totface= me->totface;
-	
-	if(tot==0) {
-		return;
-	}
-	
-	if(ob->actcol > 0)
-		em->mat_nr= ob->actcol-1;
-
-	/* initialize fastmalloc for editmesh */
-	init_editmesh_fastmalloc(em, me->totvert, me->totedge, me->totface);
-
-	actkey = ob_get_keyblock(ob);
-	if(actkey) {
-		/* undo-ing in past for previous editmode sessions gives corrupt 'keyindex' values */
-		undo_editmode_clear();
-		keyco= actkey->data;
-		em->shapenr= ob->shapenr;
-	}
-
-	/* make editverts */
-	CustomData_copy(&me->vdata, &em->vdata, CD_MASK_EDITMESH, CD_CALLOC, 0);
-	mvert= me->mvert;
-
-	evlist= (EditVert **)MEM_mallocN(tot*sizeof(void *),"evlist");
-	for(a=0; a<tot; a++, mvert++) {
-		
-		co= mvert->co;
-
-		/* edit the shape key coordinate if available */
-		if(keyco && a < actkey->totelem)
-			co= keyco[a];
-
-		eve= addvertlist(em, co, NULL);
-		evlist[a]= eve;
-		
-		/* face select sets selection in next loop */
-		if(!is_paint_face_sel)
-			eve->f |= (mvert->flag & SELECT);
-		
-		if (mvert->flag & ME_HIDE) eve->h= 1;
-		normal_short_to_float_v3(eve->no, mvert->no);
-
-		eve->bweight= ((float)mvert->bweight)/255.0f;
-
-		/* lets overwrite the keyindex of the editvert
-		 * with the order it used to be in before
-		 * editmode
-		 */
-		eve->keyindex = a;
-
-		CustomData_to_em_block(&me->vdata, &em->vdata, a, &eve->data);
-	}
-
-	if(actkey && actkey->totelem!=me->totvert);
-	else {
-		MEdge *medge= me->medge;
-		
-		CustomData_copy(&me->edata, &em->edata, CD_MASK_EDITMESH, CD_CALLOC, 0);
-		/* make edges */
-		for(a=0; a<me->totedge; a++, medge++) {
-			eed= addedgelist(em, evlist[medge->v1], evlist[medge->v2], NULL);
-			/* eed can be zero when v1 and v2 are identical, dxf import does this... */
-			if(eed) {
-				int is_sel;
-				if (is_paint_vert_sel) {
-					/* when from vertex select, flush flags to edges,
-					 * allow selection, code below handles editmode selection conversion */
-					is_sel= (eed->v1->f & SELECT) && (eed->v2->f & SELECT);
-				}
-				else {
-					is_sel= (medge->flag & SELECT);
-				}
-
-				eed->crease= ((float)medge->crease)/255.0f;
-				eed->bweight= ((float)medge->bweight)/255.0f;
-				
-				if(medge->flag & ME_SEAM) eed->seam= 1;
-				if(medge->flag & ME_SHARP) eed->sharp = 1;
-				if(medge->flag & ME_FGON) eed->h= EM_FGON;	// 2 different defines!
-				if(medge->flag & ME_HIDE) eed->h |= 1;
-				if(is_sel) eed->f |= SELECT;
-				if(em->selectmode==SCE_SELECT_EDGE)
-					EM_select_edge(eed, eed->f & SELECT);		// force edge selection to vertices, seems to be needed ...
-				CustomData_to_em_block(&me->edata,&em->edata, a, &eed->data);
-			}
-		}
-		
-		CustomData_copy(&me->fdata, &em->fdata, CD_MASK_EDITMESH, CD_CALLOC, 0);
-
-		/* make faces */
-		mface= me->mface;
-
-		for(a=0; a<me->totface; a++, mface++) {
-			eve1= evlist[mface->v1];
-			eve2= evlist[mface->v2];
-			if(!mface->v3) eekadoodle= 1;
-			eve3= evlist[mface->v3];
-			if(mface->v4) eve4= evlist[mface->v4]; else eve4= NULL;
-			
-			efa= addfacelist(em, eve1, eve2, eve3, eve4, NULL, NULL);
-
-			if(efa) {
-				CustomData_to_em_block(&me->fdata, &em->fdata, a, &efa->data);
-
-				efa->mat_nr= mface->mat_nr;
-				efa->flag= mface->flag & ~ME_HIDE;
-				
-				/* select and hide face flag */
-				if(mface->flag & ME_HIDE) {
-					efa->h= 1;
-				} else {
-					int is_sel;
-
-					if (!is_paint_vert_sel) {
-						is_sel= (mface->flag & ME_FACE_SEL);
-					}
-					else {
-						/* when from vertex select, flush flags to edges,
-						 * allow selection, code below handles editmode selection conversion */
-						is_sel= ( (efa->v1->f & SELECT) &&
-						          (efa->v2->f & SELECT) &&
-						          (efa->v3->f & SELECT) &&
-						          (efa->v4 == NULL || efa->v4->f & SELECT)
-						          );
-					}
-
-					if (a==me->act_face) {
-						EM_set_actFace(em, efa);
-					}
-					
-					/* dont allow hidden and selected */
-					if(is_sel) {
-						efa->f |= SELECT;
-						
-						if(is_paint_face_sel) {
-							EM_select_face(efa, 1); /* flush down */
-						}
-
-						efa_last_sel= efa;
-					}
-				}
-			}
-		}
-	}
-	
-	if(EM_get_actFace(em, 0)==NULL && efa_last_sel) {
-		EM_set_actFace(em, efa_last_sel);
-	}
-
-	if(eekadoodle)
-		error("This Mesh has old style edgecodes, please put it in the bugtracker!");
-	
-	MEM_freeN(evlist);
-
-	end_editmesh_fastmalloc();	// resets global function pointers
-	
-	if(me->mselect){
-		//restore editselections
-		EM_init_index_arrays(em, 1,1,1);
-		mselect = me->mselect;
-		
-		for(a=0; a<me->totselect; a++, mselect++){
-			/*check if recorded selection is still valid, if so copy into editmesh*/
-			if ( (mselect->type == EDITVERT && me->mvert[mselect->index].flag & SELECT) ||
-			     (mselect->type == EDITEDGE && me->medge[mselect->index].flag & SELECT) ||
-			     (mselect->type == EDITFACE && me->mface[mselect->index].flag & ME_FACE_SEL) )
-			{
-				ese = MEM_callocN(sizeof(EditSelection), "Edit Selection");
-				ese->type = mselect->type;	
-				if(ese->type == EDITVERT) ese->data = EM_get_vert_for_index(mselect->index); else
-				if(ese->type == EDITEDGE) ese->data = EM_get_edge_for_index(mselect->index); else
-				if(ese->type == EDITFACE) ese->data = EM_get_face_for_index(mselect->index);
-				BLI_addtail(&(em->selected),ese);
-			}
-		}
-		EM_free_index_arrays();
-	}
-	/* this creates coherent selections. also needed for older files */
-	EM_selectmode_set(em);
-	/* paranoia check to enforce hide rules */
-	EM_hide_reset(em);
-	/* sets helper flags which arent saved */
-	EM_fgon_flags(em);
-	
-	if (EM_get_actFace(em, 0)==NULL) {
-		EM_set_actFace(em, em->faces.first ); /* will use the first face, this is so we alwats have an active face */
-	}
-}
-
-/* makes Mesh out of editmesh */
-void load_editMesh(Scene *scene, Object *obedit)
-{
-	Mesh *me= obedit->data;
-	MVert *mvert, *oldverts;
-	MEdge *medge;
-	MFace *mface;
-	MSelect *mselect;
-	EditMesh *em= me->edit_mesh;
-	EditVert *eve;
-	EditFace *efa, *efa_act;
-	EditEdge *eed;
-	EditSelection *ese;
-	float *fp, *newkey, *oldkey;
-	int i, a, ototvert;
-	
-	/* this one also tests of edges are not in faces: */
-	/* eed->f2==0: not in face, f2==1: draw it */
-	/* eed->f1 : flag for dynaface (cylindertest, old engine) */
-	/* eve->f1 : flag for dynaface (sphere test, old engine) */
-	/* eve->f2 : being used in vertexnormals */
-	edge_drawflags(me, em);
-	
-	EM_stats_update(em);
-	
-	/* new Vertex block */
-	if(em->totvert==0) mvert= NULL;
-	else mvert= MEM_callocN(em->totvert*sizeof(MVert), "loadeditMesh vert");
-
-	/* new Edge block */
-	if(em->totedge==0) medge= NULL;
-	else medge= MEM_callocN(em->totedge*sizeof(MEdge), "loadeditMesh edge");
-	
-	/* new Face block */
-	if(em->totface==0) mface= NULL;
-	else mface= MEM_callocN(em->totface*sizeof(MFace), "loadeditMesh face");
-
-	/* lets save the old verts just in case we are actually working on
-	 * a key ... we now do processing of the keys at the end */
-	oldverts= me->mvert;
-	ototvert= me->totvert;
-
-	/* don't free this yet */
-	CustomData_set_layer(&me->vdata, CD_MVERT, NULL);
-
-	/* free custom data */
-	CustomData_free(&me->vdata, me->totvert);
-	CustomData_free(&me->edata, me->totedge);
-	CustomData_free(&me->fdata, me->totface);
-
-	/* add new custom data */
-	me->totvert= em->totvert;
-	me->totedge= em->totedge;
-	me->totface= em->totface;
-
-	CustomData_copy(&em->vdata, &me->vdata, CD_MASK_MESH, CD_CALLOC, me->totvert);
-	CustomData_copy(&em->edata, &me->edata, CD_MASK_MESH, CD_CALLOC, me->totedge);
-	CustomData_copy(&em->fdata, &me->fdata, CD_MASK_MESH, CD_CALLOC, me->totface);
-
-	CustomData_add_layer(&me->vdata, CD_MVERT, CD_ASSIGN, mvert, me->totvert);
-	CustomData_add_layer(&me->edata, CD_MEDGE, CD_ASSIGN, medge, me->totedge);
-	CustomData_add_layer(&me->fdata, CD_MFACE, CD_ASSIGN, mface, me->totface);
-	mesh_update_customdata_pointers(me);
-
-	/* the vertices, use ->tmp.l as counter */
-	eve= em->verts.first;
-	a= 0;
-
-	while(eve) {
-		VECCOPY(mvert->co, eve->co);
-
-		/* vertex normal */
-		normal_float_to_short_v3(mvert->no, eve->no);
-
-		/* note: it used to remove me->dvert when it was not in use, cancelled
-		   that... annoying when you have a fresh vgroup */
-		CustomData_from_em_block(&em->vdata, &me->vdata, eve->data, a);
-
-		eve->tmp.l = a++;  /* counter */
-			
-		mvert->flag= 0;
-		mvert->flag |= (eve->f & SELECT);
-		if (eve->h) mvert->flag |= ME_HIDE;
-		
-		mvert->bweight= (char)(255.0f*eve->bweight);
-
-		eve= eve->next;
-		mvert++;
-	}
-
-	/* the edges */
-	a= 0;
-	eed= em->edges.first;
-	while(eed) {
-		medge->v1= (unsigned int) eed->v1->tmp.l;
-		medge->v2= (unsigned int) eed->v2->tmp.l;
-		
-		medge->flag= (eed->f & SELECT) | ME_EDGERENDER;
-		if(eed->f2<2) medge->flag |= ME_EDGEDRAW;
-		if(eed->f2==0) medge->flag |= ME_LOOSEEDGE;
-		if(eed->sharp) medge->flag |= ME_SHARP;
-		if(eed->seam) medge->flag |= ME_SEAM;
-		if(eed->h & EM_FGON) medge->flag |= ME_FGON;	// different defines yes
-		if(eed->h & 1) medge->flag |= ME_HIDE;
-		
-		medge->crease= (char)(255.0f*eed->crease);
-		medge->bweight= (char)(255.0f*eed->bweight);
-		CustomData_from_em_block(&em->edata, &me->edata, eed->data, a);		
-
-		eed->tmp.l = a++;
-		
-		medge++;
-		eed= eed->next;
-	}
-
-	/* the faces */
-	a = 0;
-	efa= em->faces.first;
-	efa_act= EM_get_actFace(em, 0);
-	i = 0;
-	me->act_face = -1;
-	while(efa) {
-		mface= &((MFace *) me->mface)[i];
-		
-		mface->v1= (unsigned int) efa->v1->tmp.l;
-		mface->v2= (unsigned int) efa->v2->tmp.l;
-		mface->v3= (unsigned int) efa->v3->tmp.l;
-		if (efa->v4) mface->v4 = (unsigned int) efa->v4->tmp.l;
-
-		mface->mat_nr= efa->mat_nr;
-		
-		mface->flag= efa->flag;
-		/* bit 0 of flag is already taken for smooth... */
-		
-		if(efa->h) {
-			mface->flag |= ME_HIDE;
-			mface->flag &= ~ME_FACE_SEL;
-		} else {
-			if(efa->f & 1) mface->flag |= ME_FACE_SEL;
-			else mface->flag &= ~ME_FACE_SEL;
-		}
-			
-		/* watch: efa->e1->f2==0 means loose edge */ 
-			
-		if(efa->e1->f2==1) {
-			efa->e1->f2= 2;
-		}			
-		if(efa->e2->f2==1) {
-			efa->e2->f2= 2;
-		}
-		if(efa->e3->f2==1) {
-			efa->e3->f2= 2;
-		}
-		if(efa->e4 && efa->e4->f2==1) {
-			efa->e4->f2= 2;
-		}
-
-		CustomData_from_em_block(&em->fdata, &me->fdata, efa->data, i);
-
-		/* no index '0' at location 3 or 4 */
-		test_index_face(mface, &me->fdata, i, efa->v4?4:3);
-		
-		if (efa_act == efa)
-			me->act_face = a;
-
-		efa->tmp.l = a++;
-		i++;
-		efa= efa->next;
-	}
-
-	/* patch hook indices and vertex parents */
-	{
-		Object *ob;
-		ModifierData *md;
-		EditVert **vertMap = NULL;
-		int j;
-
-		for (ob=G.main->object.first; ob; ob=ob->id.next) {
-			if (ob->parent==obedit && ELEM(ob->partype, PARVERT1,PARVERT3)) {
-				
-				/* duplicate code from below, make it function later...? */
-				if (!vertMap) {
-					vertMap = MEM_callocN(sizeof(*vertMap)*ototvert, "vertMap");
-					
-					for (eve=em->verts.first; eve; eve=eve->next) {
-						if (eve->keyindex!=-1)
-							vertMap[eve->keyindex] = eve;
-					}
-				}
-				if(ob->par1 < ototvert) {
-					eve = vertMap[ob->par1];
-					if(eve) ob->par1= eve->tmp.l;
-				}
-				if(ob->par2 < ototvert) {
-					eve = vertMap[ob->par2];
-					if(eve) ob->par2= eve->tmp.l;
-				}
-				if(ob->par3 < ototvert) {
-					eve = vertMap[ob->par3];
-					if(eve) ob->par3= eve->tmp.l;
-				}
-				
-			}
-			if (ob->data==me) {
-				for (md=ob->modifiers.first; md; md=md->next) {
-					if (md->type==eModifierType_Hook) {
-						HookModifierData *hmd = (HookModifierData*) md;
-
-						if (!vertMap) {
-							vertMap = MEM_callocN(sizeof(*vertMap)*ototvert, "vertMap");
-
-							for (eve=em->verts.first; eve; eve=eve->next) {
-								if (eve->keyindex!=-1)
-									vertMap[eve->keyindex] = eve;
-							}
-						}
-						
-						for (i=j=0; i<hmd->totindex; i++) {
-							if(hmd->indexar[i] < ototvert) {
-								eve = vertMap[hmd->indexar[i]];
-								
-								if (eve) {
-									hmd->indexar[j++] = eve->tmp.l;
-								}
-							}
-							else j++;
-						}
-
-						hmd->totindex = j;
-					}
-				}
-			}
-		}
-
-		if (vertMap) MEM_freeN(vertMap);
-	}
-
-	/* are there keys? */
-	if(me->key) {
-		KeyBlock *currkey;
-		KeyBlock *actkey= BLI_findlink(&me->key->block, em->shapenr-1);
-
-		float (*ofs)[3] = NULL;
-
-		/* editing the base key should update others */
-		if(me->key->type==KEY_RELATIVE && oldverts) {
-			int act_is_basis = 0;
-			/* find if this key is a basis for any others */
-			for(currkey = me->key->block.first; currkey; currkey= currkey->next) {
-				if(em->shapenr-1 == currkey->relative) {
-					act_is_basis = 1;
-					break;
-				}
-			}
-
-			if(act_is_basis) { /* active key is a base */
-				float (*fp)[3]= actkey->data;
-				i=0;
-				ofs= MEM_callocN(sizeof(float) * 3 * em->totvert,  "currkey->data");
-				eve= em->verts.first;
-				mvert = me->mvert;
-				while(eve) {
-					if(eve->keyindex>=0) {
-						sub_v3_v3v3(ofs[i], mvert->co, fp[eve->keyindex]);
-					}
-
-					eve= eve->next;
-					i++;
-					mvert++;
-				}
-			}
-		}
-
-
-		/* Lets reorder the key data so that things line up roughly
-		 * with the way things were before editmode */
-		currkey = me->key->block.first;
-		while(currkey) {
-			int apply_offset = (ofs && (currkey != actkey) && (em->shapenr-1 == currkey->relative));
-
-			fp= newkey= MEM_callocN(me->key->elemsize*em->totvert,  "currkey->data");
-			oldkey = currkey->data;
-
-			eve= em->verts.first;
-
-			i = 0;
-			mvert = me->mvert;
-			while(eve) {
-				if (eve->keyindex >= 0 && eve->keyindex < currkey->totelem) { // valid old vertex
-					if(currkey == actkey) {
-						if(actkey == me->key->refkey) {
-							VECCOPY(fp, mvert->co);
-						}
-						else {
-							VECCOPY(fp, mvert->co);
-							if(oldverts) {
-								VECCOPY(mvert->co, oldverts[eve->keyindex].co);
-							}
-						}
-					}
-					else {
-						if(oldkey) {
-							VECCOPY(fp, oldkey + 3 * eve->keyindex);
-						}
-					}
-				}
-				else {
-					VECCOPY(fp, mvert->co);
-				}
-
-				/* propagate edited basis offsets to other shapes */
-				if(apply_offset) {
-					VECADD(fp, fp, ofs[i]);
-				}
-
-				fp+= 3;
-				++i;
-				++mvert;
-				eve= eve->next;
-			}
-			currkey->totelem= em->totvert;
-			if(currkey->data) MEM_freeN(currkey->data);
-			currkey->data = newkey;
-			
-			currkey= currkey->next;
-		}
-
-		if(ofs) MEM_freeN(ofs);
-	}
-
-	if(oldverts) MEM_freeN(oldverts);
-	
-	i = 0;
-	for(ese=em->selected.first; ese; ese=ese->next) i++;
-	me->totselect = i;
-	if(i==0) mselect= NULL;
-	else mselect= MEM_callocN(i*sizeof(MSelect), "loadeditMesh selections");
-	
-	if(me->mselect) MEM_freeN(me->mselect);
-	me->mselect= mselect;
-	
-	for(ese=em->selected.first; ese; ese=ese->next){
-		mselect->type = ese->type;
-		if(ese->type == EDITVERT) mselect->index = ((EditVert*)ese->data)->tmp.l;
-		else if(ese->type == EDITEDGE) mselect->index = ((EditEdge*)ese->data)->tmp.l;
-		else if(ese->type == EDITFACE) mselect->index = ((EditFace*)ese->data)->tmp.l;
-		mselect++;
-	}
-	
-	/* to be sure: clear ->tmp.l pointers */
-	eve= em->verts.first;
-	while(eve) {
-		eve->tmp.l = 0;
-		eve= eve->next;
-	}
-	
-	eed= em->edges.first;
-	while(eed) { 
-		eed->tmp.l = 0;
-		eed= eed->next;
-	}
-	
-	efa= em->faces.first;
-	while(efa) {
-		efa->tmp.l = 0;
-		efa= efa->next;
-	}
-	
-	/* remake softbody of all users */
-	if(me->id.us>1) {
-		Base *base;
-		for(base= scene->base.first; base; base= base->next)
-			if(base->object->data==me)
-				base->object->recalc |= OB_RECALC_DATA;
-	}
-
-	mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
-
-	/* topology could be changed, ensure mdisps are ok */
-	multires_topology_changed(scene, obedit);
-}
-
-void remake_editMesh(Scene *scene, Object *ob)
-{
-	make_editMesh(scene, ob);
-	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
-	BIF_undo_push("Undo all changes");
-}
-
-/* *************** Operator: separate parts *************/
-
-static EnumPropertyItem prop_separate_types[] = {
-	{0, "SELECTED", 0, "Selection", ""},
-	{1, "MATERIAL", 0, "By Material", ""},
-	{2, "LOOSE", 0, "By loose parts", ""},
-	{0, NULL, 0, NULL, NULL}
-};
-
-/* return 1: success */
-static int mesh_separate_selected(wmOperator *op, Main *bmain, Scene *scene, Base *editbase)
-{
-	EditMesh *em, *emnew;
-	EditVert *eve, *v1;
-	EditEdge *eed, *e1;
-	EditFace *efa, *f1;
-	Object *obedit;
-	Mesh *me, *menew;
-	Base *basenew;
-	
-	if(editbase==NULL) return 0;
-	
-	obedit= editbase->object;
-	me= obedit->data;
-	em= BKE_mesh_get_editmesh(me);
-	if(me->key) {
-		BKE_report(op->reports, RPT_WARNING, "Can't separate mesh with shape keys");
-		BKE_mesh_end_editmesh(me, em);
-		return 0;
-	}
-	
-	if(em->selected.first) 
-		BLI_freelistN(&(em->selected)); /* clear the selection order */
-		
-	EM_selectmode_set(em);	// enforce full consistent selection flags 
-	
-	EM_stats_update(em);
-	
-	if(em->totvertsel==0) {
-		BKE_mesh_end_editmesh(me, em);
-		return 0;
-	}
-	
-	/* we are going to work as follows:
-	 * 1. add a linked duplicate object: this will be the new one, we remember old pointer
-	 * 2. give new object empty mesh and put in editmode
-	 * 3: do a split if needed on current editmesh.
-	 * 4. copy over: all NOT selected verts, edges, faces
-	 * 5. call load_editMesh() on the new object
-	 */
-	
-	/* 1 */
-	basenew= ED_object_add_duplicate(bmain, scene, editbase, 0);	/* 0 = fully linked */
-	ED_base_object_select(basenew, BA_DESELECT);
-	
-	/* 2 */
-	basenew->object->data= menew= add_mesh(me->id.name+2);	/* empty */
-	assign_matarar(basenew->object, give_matarar(obedit), *give_totcolp(obedit)); /* new in 2.5 */
-	me->id.us--;
-	make_editMesh(scene, basenew->object);
-	emnew= menew->edit_mesh;
-	CustomData_copy(&em->vdata, &emnew->vdata, CD_MASK_EDITMESH, CD_DEFAULT, 0);
-	CustomData_copy(&em->edata, &emnew->edata, CD_MASK_EDITMESH, CD_DEFAULT, 0);
-	CustomData_copy(&em->fdata, &emnew->fdata, CD_MASK_EDITMESH, CD_DEFAULT, 0);
-	
-	/* 3 */
-	/* SPLIT: first make duplicate */
-	adduplicateflag(em, SELECT);
-	/* SPLIT: old faces have 3x flag 128 set, delete these ones */
-	delfaceflag(em, 128);
-	/* since we do tricky things with verts/edges/faces, this makes sure all is selected coherent */
-	EM_selectmode_set(em);
-	
-	/* 4 */
-	/* move over: everything that is selected */
-	for(eve= em->verts.first; eve; eve= v1) {
-		v1= eve->next;
-		if(eve->f & SELECT) {
-			BLI_remlink(&em->verts, eve);
-			BLI_addtail(&emnew->verts, eve);
-		}
-	}
-	
-	for(eed= em->edges.first; eed; eed= e1) {
-		e1= eed->next;
-		if(eed->f & SELECT) {
-			BLI_remlink(&em->edges, eed);
-			BLI_addtail(&emnew->edges, eed);
-		}
-	}
-	
-	for(efa= em->faces.first; efa; efa= f1) {
-		f1= efa->next;
-		if (efa == em->act_face && (efa->f & SELECT)) {
-			EM_set_actFace(em, NULL);
-		}
-
-		if(efa->f & SELECT) {
-			BLI_remlink(&em->faces, efa);
-			BLI_addtail(&emnew->faces, efa);
-		}
-	}
-
-	/* 5 */
-	load_editMesh(scene, basenew->object);
-	free_editMesh(emnew);
-	MEM_freeN(menew->edit_mesh);
-	menew->edit_mesh= NULL;
-
-	/* copy settings */
-	menew->texflag= me->texflag;
-	menew->drawflag= me->drawflag;
-	menew->flag= me->flag;
-	menew->editflag= me->editflag;
-	menew->smoothresh= me->smoothresh;
-
-	/* hashedges are invalid now, make new! */
-	editMesh_set_hash(em);
-
-	DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);	
-	DAG_id_tag_update(&basenew->object->id, OB_RECALC_DATA);	
-
-	BKE_mesh_end_editmesh(me, em);
-
-	return 1;
-}
-
-/* return 1: success */
-static int mesh_separate_material(wmOperator *op, Main *bmain, Scene *scene, Base *editbase)
-{
-	Mesh *me= editbase->object->data;
-	EditMesh *em= BKE_mesh_get_editmesh(me);
-	unsigned char curr_mat;
-	
-	for (curr_mat = 1; curr_mat < editbase->object->totcol; ++curr_mat) {
-		/* clear selection, we're going to use that to select material group */
-		EM_clear_flag_all(em, SELECT);
-		/* select the material */
-		EM_select_by_material(em, curr_mat);
-		/* and now separate */
-		if(em->totfacesel > 0) {
-			mesh_separate_selected(op, bmain, scene, editbase);
-		}
-	}
-
-	BKE_mesh_end_editmesh(me, em);
-	return 1;
-}
-
-/* return 1: success */
-static int mesh_separate_loose(wmOperator *op, Main *bmain, Scene *scene, Base *editbase)
-{
-	Mesh *me;
-	EditMesh *em;
-	int doit= 1;
-	
-	me= editbase->object->data;
-	em= BKE_mesh_get_editmesh(me);
-	
-	if(me->key) {
-		error("Can't separate with vertex keys");
-		BKE_mesh_end_editmesh(me, em);
-		return 0;
-	}
-	
-	EM_clear_flag_all(em, SELECT);
-
-	while(doit) {
-		/* Select a random vert to start with */
-		EditVert *eve;
-		int tot;
-
-		/* check if all verts that are visible have been done */
-		for(eve=em->verts.first; eve; eve= eve->next)
-			if(!eve->h) break;
-		if(eve==NULL) break; /* only hidden verts left, quit early */
-
-		/* first non hidden vert */
-		eve->f |= SELECT;
-		
-		selectconnected_mesh_all(em);
-		
-		/* don't separate the very last part */
-		for(eve=em->verts.first; eve; eve= eve->next)
-			if((eve->f & SELECT)==0) break;
-		if(eve==NULL) break;
-
-		tot= BLI_countlist(&em->verts);
-
-		/* and now separate */
-		doit= mesh_separate_selected(op, bmain, scene, editbase);
-
-		/* with hidden verts this can happen */
-		if(tot == BLI_countlist(&em->verts))
-			break;
-	}
-
-	BKE_mesh_end_editmesh(me, em);
-	return 1;
-}
-
-
-static int mesh_separate_exec(bContext *C, wmOperator *op)
-{
-	Main *bmain= CTX_data_main(C);
-	Scene *scene= CTX_data_scene(C);
-	Base *base= CTX_data_active_base(C);
-	int retval= 0, type= RNA_enum_get(op->ptr, "type");
-	
-	if(type == 0)
-		retval= mesh_separate_selected(op, bmain, scene, base);
-	else if(type == 1)
-		retval= mesh_separate_material(op, bmain, scene, base);
-	else if(type == 2)
-		retval= mesh_separate_loose(op, bmain, scene, base);
-	   
-	if(retval) {
-		WM_event_add_notifier(C, NC_GEOM|ND_DATA, base->object->data);
-
-		// XXX: new object was created, but selection wasn't actually changed
-		//      need this for outliner update without adding new ND. nazgul.
-		WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
-
-		return OPERATOR_FINISHED;
-	}
-	return OPERATOR_CANCELLED;
-}
-
-void MESH_OT_separate(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Separate";
-	ot->description= "Separate selected geometry into a new mesh";
-	ot->idname= "MESH_OT_separate";
-	
-	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= mesh_separate_exec;
-	ot->poll= ED_operator_editmesh;
-	
-	/* flags */
-	ot->flag= OPTYPE_UNDO;
-	
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_separate_types, 0, "Type", "");
-}
-
-
-/* ******************************************** */
-
-/* *************** UNDO ***************************** */
-/* new mesh undo, based on pushing editmesh data itself */
-/* reuses same code as for global and curve undo... unify that (ton) */
-
-/* only one 'hack', to save memory it doesn't store the first push, but does a remake editmesh */
-
-/* a compressed version of editmesh data */
-
-typedef struct EditVertC
-{
-	float no[3];
-	float co[3];
-	unsigned char f, h;
-	short bweight;
-	int keyindex;
-} EditVertC;
-
-typedef struct EditEdgeC
-{
-	int v1, v2;
-	unsigned char f, h, seam, sharp, pad;
-	short crease, bweight, fgoni;
-} EditEdgeC;
-
-typedef struct EditFaceC
-{
-	int v1, v2, v3, v4;
-	unsigned char flag, f, h, fgonf, pad1;
-	short mat_nr;
-} EditFaceC;
-
-typedef struct EditSelectionC{
-	short type;
-	int index;
-}EditSelectionC;
-
-typedef struct UndoMesh {
-	EditVertC *verts;
-	EditEdgeC *edges;
-	EditFaceC *faces;
-	EditSelectionC *selected;
-	int totvert, totedge, totface, totsel;
-	int selectmode, shapenr;
-	CustomData vdata, edata, fdata;
-} UndoMesh;
-
-/* for callbacks */
-
-static void free_undoMesh(void *umv)
-{
-	UndoMesh *um= umv;
-	
-	if(um->verts) MEM_freeN(um->verts);
-	if(um->edges) MEM_freeN(um->edges);
-	if(um->faces) MEM_freeN(um->faces);
-	if(um->selected) MEM_freeN(um->selected);
-	CustomData_free(&um->vdata, um->totvert);
-	CustomData_free(&um->edata, um->totedge);
-	CustomData_free(&um->fdata, um->totface);
-	MEM_freeN(um);
-}
-
-static void *editMesh_to_undoMesh(void *emv)
-{
-	EditMesh *em= (EditMesh *)emv;
-	UndoMesh *um;
-	EditVert *eve;
-	EditEdge *eed;
-	EditFace *efa;
-	EditSelection *ese;
-	EditVertC *evec=NULL;
-	EditEdgeC *eedc=NULL;
-	EditFaceC *efac=NULL;
-	EditSelectionC *esec=NULL;
-	int a;
-
-	um= MEM_callocN(sizeof(UndoMesh), "undomesh");
-	
-	um->selectmode = em->selectmode;
-	um->shapenr = em->shapenr;
-	
-	for(eve=em->verts.first; eve; eve= eve->next) um->totvert++;
-	for(eed=em->edges.first; eed; eed= eed->next) um->totedge++;
-	for(efa=em->faces.first; efa; efa= efa->next) um->totface++;
-	for(ese=em->selected.first; ese; ese=ese->next) um->totsel++; 
-	/* malloc blocks */
-	
-	if(um->totvert) evec= um->verts= MEM_callocN(um->totvert*sizeof(EditVertC), "allvertsC");
-	if(um->totedge) eedc= um->edges= MEM_callocN(um->totedge*sizeof(EditEdgeC), "alledgesC");
-	if(um->totface) efac= um->faces= MEM_callocN(um->totface*sizeof(EditFaceC), "allfacesC");
-	if(um->totsel) esec= um->selected= MEM_callocN(um->totsel*sizeof(EditSelectionC), "allselections");
-
-	if(um->totvert) CustomData_copy(&em->vdata, &um->vdata, CD_MASK_EDITMESH, CD_CALLOC, um->totvert);
-	if(um->totedge) CustomData_copy(&em->edata, &um->edata, CD_MASK_EDITMESH, CD_CALLOC, um->totedge);
-	if(um->totface) CustomData_copy(&em->fdata, &um->fdata, CD_MASK_EDITMESH, CD_CALLOC, um->totface);
-	
-	/* now copy vertices */
-	a = 0;
-	for(eve=em->verts.first; eve; eve= eve->next, evec++, a++) {
-		copy_v3_v3(evec->co, eve->co);
-		copy_v3_v3(evec->no, eve->no);
-
-		evec->f= eve->f;
-		evec->h= eve->h;
-		evec->keyindex= eve->keyindex;
-		eve->tmp.l = a; /*store index*/
-		evec->bweight= (short)(eve->bweight*255.0f);
-
-		CustomData_from_em_block(&em->vdata, &um->vdata, eve->data, a);
-	}
-	
-	/* copy edges */
-	a = 0;
-	for(eed=em->edges.first; eed; eed= eed->next, eedc++, a++)  {
-		eedc->v1= (int)eed->v1->tmp.l;
-		eedc->v2= (int)eed->v2->tmp.l;
-		eedc->f= eed->f;
-		eedc->h= eed->h;
-		eedc->seam= eed->seam;
-		eedc->sharp= eed->sharp;
-		eedc->crease= (short)(eed->crease*255.0f);
-		eedc->bweight= (short)(eed->bweight*255.0f);
-		eedc->fgoni= eed->fgoni;
-		eed->tmp.l = a; /*store index*/
-		CustomData_from_em_block(&em->edata, &um->edata, eed->data, a);
-	
-	}
-	
-	/* copy faces */
-	a = 0;
-	for(efa=em->faces.first; efa; efa= efa->next, efac++, a++) {
-		efac->v1= (int)efa->v1->tmp.l;
-		efac->v2= (int)efa->v2->tmp.l;
-		efac->v3= (int)efa->v3->tmp.l;
-		if(efa->v4) efac->v4= (int)efa->v4->tmp.l;
-		else efac->v4= -1;
-		
-		efac->mat_nr= efa->mat_nr;
-		efac->flag= efa->flag;
-		efac->f= efa->f;
-		efac->h= efa->h;
-		efac->fgonf= efa->fgonf;
-
-		efa->tmp.l = a; /*store index*/
-
-		CustomData_from_em_block(&em->fdata, &um->fdata, efa->data, a);
-	}
-	
-	a = 0;
-	for(ese=em->selected.first; ese; ese=ese->next, esec++){
-		esec->type = ese->type;
-		if(ese->type == EDITVERT) a = esec->index = ((EditVert*)ese->data)->tmp.l; 
-		else if(ese->type == EDITEDGE) a = esec->index = ((EditEdge*)ese->data)->tmp.l; 
-		else if(ese->type == EDITFACE) a = esec->index = ((EditFace*)ese->data)->tmp.l;
-	}
-
-	return um;
-}
-
-static void undoMesh_to_editMesh(void *umv, void *emv)
-{
-	EditMesh *em= (EditMesh *)emv;
-	UndoMesh *um= (UndoMesh *)umv;
-	EditVert *eve, **evar=NULL;
-	EditEdge *eed;
-	EditFace *efa;
-	EditSelection *ese;
-	EditVertC *evec;
-	EditEdgeC *eedc;
-	EditFaceC *efac;
-	EditSelectionC *esec;
-	int a=0;
-
-	free_editMesh(em);
-	
-	/* malloc blocks */
-	memset(em, 0, sizeof(EditMesh));
-		
-	em->selectmode = um->selectmode;
-	em->shapenr = um->shapenr;
-	
-	init_editmesh_fastmalloc(em, um->totvert, um->totedge, um->totface);
-
-	CustomData_free(&em->vdata, 0);
-	CustomData_free(&em->edata, 0);
-	CustomData_free(&em->fdata, 0);
-
-	CustomData_copy(&um->vdata, &em->vdata, CD_MASK_EDITMESH, CD_CALLOC, 0);
-	CustomData_copy(&um->edata, &em->edata, CD_MASK_EDITMESH, CD_CALLOC, 0);
-	CustomData_copy(&um->fdata, &em->fdata, CD_MASK_EDITMESH, CD_CALLOC, 0);
-
-	/* now copy vertices */
-
-	if(um->totvert) evar= MEM_mallocN(um->totvert*sizeof(EditVert *), "vertex ar");
-	for(a=0, evec= um->verts; a<um->totvert; a++, evec++) {
-		eve= addvertlist(em, evec->co, NULL);
-		evar[a]= eve;
-
-		copy_v3_v3(eve->no, evec->no);
-		eve->f= evec->f;
-		eve->h= evec->h;
-		eve->keyindex= evec->keyindex;
-		eve->bweight= ((float)evec->bweight)/255.0f;
-
-		CustomData_to_em_block(&um->vdata, &em->vdata, a, &eve->data);
-	}
-
-	/* copy edges */
-	for(a=0, eedc= um->edges; a<um->totedge; a++, eedc++) {
-		eed= addedgelist(em, evar[eedc->v1], evar[eedc->v2], NULL);
-
-		eed->f= eedc->f;
-		eed->h= eedc->h;
-		eed->seam= eedc->seam;
-		eed->sharp= eedc->sharp;
-		eed->fgoni= eedc->fgoni;
-		eed->crease= ((float)eedc->crease)/255.0f;
-		eed->bweight= ((float)eedc->bweight)/255.0f;
-		CustomData_to_em_block(&um->edata, &em->edata, a, &eed->data);
-	}
-	
-	/* copy faces */
-	for(a=0, efac= um->faces; a<um->totface; a++, efac++) {
-		if(efac->v4 != -1)
-			efa= addfacelist(em, evar[efac->v1], evar[efac->v2], evar[efac->v3], evar[efac->v4], NULL, NULL);
-		else 
-			efa= addfacelist(em, evar[efac->v1], evar[efac->v2], evar[efac->v3], NULL, NULL ,NULL);
-
-		efa->mat_nr= efac->mat_nr;
-		efa->flag= efac->flag;
-		efa->f= efac->f;
-		efa->h= efac->h;
-		efa->fgonf= efac->fgonf;
-		
-		CustomData_to_em_block(&um->fdata, &em->fdata, a, &efa->data);
-	}
-	
-	end_editmesh_fastmalloc();
-	if(evar) MEM_freeN(evar);
-	
-	em->totvert = um->totvert;
-	em->totedge = um->totedge;
-	em->totface = um->totface;
-	/*restore stored editselections*/
-	if(um->totsel){
-		EM_init_index_arrays(em, 1,1,1);
-		for(a=0, esec= um->selected; a<um->totsel; a++, esec++){
-			ese = MEM_callocN(sizeof(EditSelection), "Edit Selection");
-			ese->type = esec->type;
-			if(ese->type == EDITVERT) ese->data = EM_get_vert_for_index(esec->index); else
-			if(ese->type == EDITEDGE) ese->data = EM_get_edge_for_index(esec->index); else
-			if(ese->type == EDITFACE) ese->data = EM_get_face_for_index(esec->index);
-			BLI_addtail(&(em->selected),ese);
-		}
-		EM_free_index_arrays();
-	}
-
-	/* restore total selections */
-	EM_nvertices_selected(em);
-	EM_nedges_selected(em);
-	EM_nfaces_selected(em);
-}
-
-static void *getEditMesh(bContext *C)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	if(obedit && obedit->type==OB_MESH) {
-		Mesh *me= obedit->data;
-		return me->edit_mesh;
-	}
-	return NULL;
-}
-
-/* and this is all the undo system needs to know */
-void undo_push_mesh(bContext *C, const char *name)
-{
-	undo_editmode_push(C, name, getEditMesh, free_undoMesh, undoMesh_to_editMesh, editMesh_to_undoMesh, NULL);
-}
-
-
-
-/* *************** END UNDO *************/
-
-static EditVert **g_em_vert_array = NULL;
-static EditEdge **g_em_edge_array = NULL;
-static EditFace **g_em_face_array = NULL;
-
-void EM_init_index_arrays(EditMesh *em, int forVert, int forEdge, int forFace)
-{
-	EditVert *eve;
-	EditEdge *eed;
-	EditFace *efa;
-	int i;
-
-	if (forVert) {
-		em->totvert= BLI_countlist(&em->verts);
-
-		if(em->totvert) {
-			g_em_vert_array = MEM_mallocN(sizeof(*g_em_vert_array)*em->totvert, "em_v_arr");
-
-			for (i=0,eve=em->verts.first; eve; i++,eve=eve->next)
-				g_em_vert_array[i] = eve;
-		}
-	}
-
-	if (forEdge) {
-		em->totedge= BLI_countlist(&em->edges);
-
-		if(em->totedge) {
-			g_em_edge_array = MEM_mallocN(sizeof(*g_em_edge_array)*em->totedge, "em_e_arr");
-
-			for (i=0,eed=em->edges.first; eed; i++,eed=eed->next)
-				g_em_edge_array[i] = eed;
-		}
-	}
-
-	if (forFace) {
-		em->totface= BLI_countlist(&em->faces);
-
-		if(em->totface) {
-			g_em_face_array = MEM_mallocN(sizeof(*g_em_face_array)*em->totface, "em_f_arr");
-
-			for (i=0,efa=em->faces.first; efa; i++,efa=efa->next)
-				g_em_face_array[i] = efa;
-		}
-	}
-}
-
-void EM_free_index_arrays(void)
-{
-	if (g_em_vert_array) MEM_freeN(g_em_vert_array);
-	if (g_em_edge_array) MEM_freeN(g_em_edge_array);
-	if (g_em_face_array) MEM_freeN(g_em_face_array);
-	g_em_vert_array = NULL;
-	g_em_edge_array = NULL;
-	g_em_face_array = NULL;
-}
-
-EditVert *EM_get_vert_for_index(int index)
-{
-	return g_em_vert_array?g_em_vert_array[index]:NULL;
-}
-
-EditEdge *EM_get_edge_for_index(int index)
-{
-	return g_em_edge_array?g_em_edge_array[index]:NULL;
-}
-
-EditFace *EM_get_face_for_index(int index)
-{
-	return g_em_face_array?g_em_face_array[index]:NULL;
-}
-
-/* can we edit UV's for this mesh?*/
-int EM_texFaceCheck(EditMesh *em)
-{
-	/* some of these checks could be a touch overkill */
-	if (	(em) &&
-			(em->faces.first) &&
-			(CustomData_has_layer(&em->fdata, CD_MTFACE)))
-		return 1;
-	return 0;
-}
-
-/* can we edit colors for this mesh?*/
-int EM_vertColorCheck(EditMesh *em)
-{
-	/* some of these checks could be a touch overkill */
-	if (	(em) &&
-			(em->faces.first) &&
-			(CustomData_has_layer(&em->fdata, CD_MCOL)))
-		return 1;
-	return 0;
-}
-
-
-void em_setup_viewcontext(bContext *C, ViewContext *vc)
-{
-	view3d_set_viewcontext(C, vc);
-	
-	if(vc->obedit) {
-		Mesh *me= vc->obedit->data;
-		vc->em= me->edit_mesh;
-	}
-}
-
-
-/*  (similar to void paintface_flush_flags(Object *ob))
- * copy the vertex flags, most importantly selection from the mesh to the final derived mesh,
- * use in object mode when selecting vertices (while painting) */
-void paintvert_flush_flags(Object *ob)
-{
-	Mesh *me= get_mesh(ob);
-	DerivedMesh *dm= ob->derivedFinal;
-	MVert *dm_mvert, *dm_mv;
-	int *index_array = NULL;
-	int totvert;
-	int i;
-
-	if(me==NULL || dm==NULL)
-		return;
-
-	index_array = dm->getVertDataArray(dm, CD_ORIGINDEX);
-
-	dm_mvert = dm->getVertArray(dm);
-	totvert = dm->getNumVerts(dm);
-
-	dm_mv= dm_mvert;
-
-	if(index_array) {
-		int orig_index;
-		for (i= 0; i<totvert; i++, dm_mv++) {
-			orig_index= index_array[i];
-			if(orig_index != ORIGINDEX_NONE) {
-				dm_mv->flag= me->mvert[index_array[i]].flag;
-			}
-		}
-	}
-	else {
-		for (i= 0; i<totvert; i++, dm_mv++) {
-			dm_mv->flag= me->mvert[i].flag;
-		}
-	}
-}
-/*  note: if the caller passes FALSE to flush_flags, then they will need to run paintvert_flush_flags(ob) themselves */
-void paintvert_deselect_all_visible(Object *ob, int action, short flush_flags)
-{
-	Mesh *me;
-	MVert *mvert;
-	int a;
-
-	me= get_mesh(ob);
-	if(me==NULL) return;
-	
-	if(action == SEL_INVERT) {
-		mvert= me->mvert;
-		a= me->totvert;
-		while(a--) {
-			if((mvert->flag & ME_HIDE) == 0) {
-				mvert->flag ^= SELECT;
-			}
-			mvert++;
-		}
-	}
-	else {
-		if (action == SEL_TOGGLE) {
-			action = SEL_SELECT;
-
-			mvert= me->mvert;
-			a= me->totvert;
-			while(a--) {
-				if((mvert->flag & ME_HIDE) == 0 && mvert->flag & SELECT) {
-					action = SEL_DESELECT;
-					break;
-				}
-				mvert++;
-			}
-		}
-
-		mvert= me->mvert;
-		a= me->totvert;
-		while(a--) {
-			if((mvert->flag & ME_HIDE) == 0) {
-				switch (action) {
-				case SEL_SELECT:
-					mvert->flag |= SELECT;
-					break;
-				case SEL_DESELECT:
-					mvert->flag &= ~SELECT;
-					break;
-				case SEL_INVERT:
-					mvert->flag ^= SELECT;
-					break;
-				}
-			}
-			mvert++;
-		}
-	}
-
-	if(flush_flags) {
-		paintvert_flush_flags(ob);
-	}
-}
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c
index 043e02a..c2a97b3 100644
--- a/source/blender/editors/mesh/editmesh_add.c
+++ b/source/blender/editors/mesh/editmesh_add.c
@@ -20,7 +20,7 @@
  *
  * The Original Code is: all of this file.
  *
- * Contributor(s): none yet.
+ * Contributor(s): Joseph Eagar
  *
  * ***** END GPL LICENSE BLOCK *****
  */
@@ -29,1456 +29,227 @@
  *  \ingroup edmesh
  */
 
-
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_meshdata_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 
 #include "RNA_define.h"
 #include "RNA_access.h"
-#include "RNA_enum_types.h"
 
-#include "BLI_blenlib.h"
 #include "BLI_math.h"
-#include "BLI_editVert.h"
-#include "BLI_utildefines.h"
 
 #include "BKE_context.h"
 #include "BKE_depsgraph.h"
 #include "BKE_library.h"
-#include "BKE_mesh.h"
-#include "BKE_report.h"
+#include "BKE_tessmesh.h"
+
 
 #include "WM_api.h"
 #include "WM_types.h"
 
 #include "ED_mesh.h"
 #include "ED_screen.h"
-#include "ED_transform.h"
-#include "ED_view3d.h"
 #include "ED_object.h"
 
 #include "mesh_intern.h"
 
-/* bpymenu removed XXX */
-
-/* XXX */
-#define add_numbut(a, b, c, d, e, f, g) {}
-/* XXX */
-
-static float icovert[12][3] = {
-	{0.0f,0.0f,-200.0f}, 
-	{144.72f, -105.144f,-89.443f},
-	{-55.277f, -170.128,-89.443f}, 
-	{-178.885f,0.0f,-89.443f},
-	{-55.277f,170.128f,-89.443f}, 
-	{144.72f,105.144f,-89.443f},
-	{55.277f,-170.128f,89.443f},
-	{-144.72f,-105.144f,89.443f},
-	{-144.72f,105.144f,89.443f},
-	{55.277f,170.128f,89.443f},
-	{178.885f,0.0f,89.443f},
-	{0.0f,0.0f,200.0f}
-};
-static short icoface[20][3] = {
-	{2,0,1},
-	{1,0,5},
-	{3,0,2},
-	{4,0,3},
-	{5,0,4},
-	{1,5,10},
-	{2,1,6},
-	{3,2,7},
-	{4,3,8},
-	{5,4,9},
-	{6,1,10},
-	{7,2,6},
-	{8,3,7},
-	{9,4,8},
-	{10,5,9},
-	{6,10,11},
-	{7,6,11},
-	{8,7,11},
-	{9,8,11},
-	{10,9,11}
-};
-
-/* *************** add-click-mesh (extrude) operator ************** */
-
-static int dupli_extrude_cursor(bContext *C, wmOperator *op, wmEvent *event)
+/* uses context to figure out transform for primitive */
+/* returns standard diameter */
+static float new_primitive_matrix(bContext *C, float *loc, float *rot, float primmat[][4])
 {
-	ViewContext vc;
-	EditVert *eve;
-	float min[3], max[3];
-	int done= 0;
-	short use_proj;
-
-	em_setup_viewcontext(C, &vc);
-
-	use_proj= (vc.scene->toolsettings->snap_flag & SCE_SNAP) &&	(vc.scene->toolsettings->snap_mode==SCE_SNAP_MODE_FACE);
-	
-	invert_m4_m4(vc.obedit->imat, vc.obedit->obmat); 
-	
-	INIT_MINMAX(min, max);
+	Object *obedit = CTX_data_edit_object(C);
+	View3D *v3d = CTX_wm_view3d(C);
+	float mat[3][3], rmat[3][3], cmat[3][3], imat[3][3];
 	
-	for(eve= vc.em->verts.first; eve; eve= eve->next) {
-		if(eve->f & SELECT) {
-			DO_MINMAX(eve->co, min, max);
-			done= 1;
-		}
-	}
-
-	/* call extrude? */
-	if(done) {
-		const short rot_src= RNA_boolean_get(op->ptr, "rotate_source");
-		EditEdge *eed;
-		float vec[3], cent[3], mat[3][3];
-		float nor[3]= {0.0, 0.0, 0.0};
-		
-		/* 2D normal calc */
-		float mval_f[2];
-
-		mval_f[0]= (float)event->mval[0];
-		mval_f[1]= (float)event->mval[1];
-
-		done= 0;
-
-		/* calculate the normal for selected edges */
-		for(eed= vc.em->edges.first; eed; eed= eed->next) {
-			if(eed->f & SELECT) {
-				float co1[3], co2[3];
-				mul_v3_m4v3(co1, vc.obedit->obmat, eed->v1->co);
-				mul_v3_m4v3(co2, vc.obedit->obmat, eed->v2->co);
-				project_float_noclip(vc.ar, co1, co1);
-				project_float_noclip(vc.ar, co2, co2);
-				
-				/* 2D rotate by 90d while adding.
-				 *  (x, y) = (y, -x)
-				 *
-				 * accumulate the screenspace normal in 2D,
-				 * with screenspace edge length weighting the result. */
-				if(line_point_side_v2(co1, co2, mval_f) >= 0.0f) {
-					nor[0] +=  (co1[1] - co2[1]);
-					nor[1] += -(co1[0] - co2[0]);
-				}
-				else {
-					nor[0] +=  (co2[1] - co1[1]);
-					nor[1] += -(co2[0] - co1[0]);
-				}
-				done= 1;
-			}
-		}
-
-		if(done) {
-			float view_vec[3], cross[3];
-
-			/* convert the 2D nomal into 3D */
-			mul_mat3_m4_v3(vc.rv3d->viewinv, nor); /* worldspace */
-			mul_mat3_m4_v3(vc.obedit->imat, nor); /* local space */
-			
-			/* correct the normal to be aligned on the view plane */
-			copy_v3_v3(view_vec, vc.rv3d->viewinv[2]);
-			mul_mat3_m4_v3(vc.obedit->imat, view_vec);
-			cross_v3_v3v3(cross, nor, view_vec);
-			cross_v3_v3v3(nor, view_vec, cross);
-			normalize_v3(nor);
-		}
-		
-		/* center */
-		mid_v3_v3v3(cent, min, max);
-		copy_v3_v3(min, cent);
-		
-		mul_m4_v3(vc.obedit->obmat, min);	// view space
-		view3d_get_view_aligned_coordinate(&vc, min, event->mval, TRUE);
-		mul_m4_v3(vc.obedit->imat, min); // back in object space
-		
-		sub_v3_v3(min, cent);
-		
-		/* calculate rotation */
-		unit_m3(mat);
-		if(done) {
-			float dot;
-			
-			copy_v3_v3(vec, min);
-			normalize_v3(vec);
-			dot= dot_v3v3(vec, nor);
-
-			if( fabs(dot)<0.999) {
-				float cross[3], si, q1[4];
-				
-				cross_v3_v3v3(cross, nor, vec);
-				normalize_v3(cross);
-				dot= 0.5f*saacos(dot);
-				
-				/* halve the rotation if its applied twice */
-				if(rot_src) dot *= 0.5f;
-				
-				si= (float)sin(dot);
-				q1[0]= (float)cos(dot);
-				q1[1]= cross[0]*si;
-				q1[2]= cross[1]*si;
-				q1[3]= cross[2]*si;				
-				quat_to_mat3( mat,q1);
-			}
-		}
-		
-		if(rot_src) {
-			rotateflag(vc.em, SELECT, cent, mat);
-			/* also project the source, for retopo workflow */
-			if(use_proj)
-				EM_project_snap_verts(C, vc.ar, vc.obedit, vc.em);
-		}
-		
-		extrudeflag(vc.obedit, vc.em, SELECT, nor, 0);
-		rotateflag(vc.em, SELECT, cent, mat);
-		translateflag(vc.em, SELECT, min);
-		
-		recalc_editnormals(vc.em);
-	}
-	else if(vc.em->selectmode & SCE_SELECT_VERTEX) {
-
-		float imat[4][4];
-		const float *curs= give_cursor(vc.scene, vc.v3d);
-		
-		copy_v3_v3(min, curs);
-		view3d_get_view_aligned_coordinate(&vc, min, event->mval, TRUE);
-
-		eve= addvertlist(vc.em, 0, NULL);
-
-		invert_m4_m4(imat, vc.obedit->obmat);
-		mul_v3_m4v3(eve->co, imat, min);
-		
-		eve->f= SELECT;
-	}
+	unit_m4(primmat);
 
-	if(use_proj)
-		EM_project_snap_verts(C, vc.ar, vc.obedit, vc.em);
-
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, vc.obedit->data); 
-	DAG_id_tag_update(vc.obedit->data, 0);
+	eul_to_mat3(rmat, rot);
+	invert_m3(rmat);
 	
-	return OPERATOR_FINISHED;
-}
+	/* inverse transform for initial rotation and object */
+	copy_m3_m4(mat, obedit->obmat);
+	mul_m3_m3m3(cmat, rmat, mat);
+	invert_m3_m3(imat, cmat);
+	copy_m4_m3(primmat, imat);
 
-void MESH_OT_dupli_extrude_cursor(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Duplicate or Extrude at 3D Cursor";
-	ot->description= "Duplicate and extrude selected vertices, edges or faces towards 3D Cursor";
-	ot->idname= "MESH_OT_dupli_extrude_cursor";
-	
-	/* api callbacks */
-	ot->invoke= dupli_extrude_cursor;
-	ot->poll= ED_operator_editmesh;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
-	RNA_def_boolean(ot->srna, "rotate_source", 1, "Rotate Source", "Rotate initial selection giving better shape");
-}
-
-
-/* ********************** */
+	/* center */
+	copy_v3_v3(primmat[3], loc);
+	sub_v3_v3(primmat[3], obedit->obmat[3]);
+	invert_m3_m3(imat, mat);
+	mul_m3_v3(imat, primmat[3]);
 
-/* selected faces get hidden edges */
-static int make_fgon(EditMesh *em, wmOperator *op, int make)
-{
-	EditFace *efa;
-	EditEdge *eed;
-	EditVert *eve;
-	float *nor=NULL;	// reference
-	int done=0;
-	
-	if(make==0) {
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->f & SELECT) {
-				efa->fgonf= 0;
-				efa->e1->h &= ~EM_FGON;
-				efa->e2->h &= ~EM_FGON;
-				efa->e3->h &= ~EM_FGON;
-				if(efa->e4) efa->e4->h &= ~EM_FGON;
-				done= 1;
-			}
-		}
-		EM_fgon_flags(em);	// redo flags and indices for fgons
-		
-		return done;
-	}
-
-	/* tagging edges. rule is:
-	   - edge used by exactly 2 selected faces
-	   - no vertices allowed with only tagged edges (return)
-	   - face normals are allowed to difffer
-	 
-	*/
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		eed->f1= 0;	// amount of selected
-		eed->f2= 0; // amount of unselected
-	}
-	
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		if(efa->f & SELECT) {
-			if(nor==NULL) nor= efa->n;
-			if(efa->e1->f1 < 3) efa->e1->f1++;
-			if(efa->e2->f1 < 3) efa->e2->f1++;
-			if(efa->e3->f1 < 3) efa->e3->f1++;
-			if(efa->e4 && efa->e4->f1 < 3) efa->e4->f1++;
-		}
-		else {
-			if(efa->e1->f2 < 3) efa->e1->f2++;
-			if(efa->e2->f2 < 3) efa->e2->f2++;
-			if(efa->e3->f2 < 3) efa->e3->f2++;
-			if(efa->e4 && efa->e4->f2 < 3) efa->e4->f2++;
-		}
-	}
-	// now eed->f1 becomes tagged edge
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		if(eed->f1==2 && eed->f2==0) eed->f1= 1;
-		else eed->f1= 0;
-	}
-	
-	// no vertices allowed with only tagged edges
-	for(eve= em->verts.first; eve; eve= eve->next) eve->f1= 0;
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		if(eed->f1) {
-			eed->v1->f1 |= 1;
-			eed->v2->f1 |= 1;
-		}
-		else {
-			eed->v1->f1 |= 2;
-			eed->v2->f1 |= 2;
-		}
-	}
-	for(eve= em->verts.first; eve; eve= eve->next) {
-		if(eve->f1==1) break;
-	}
-	if(eve) {
-		BKE_report(op->reports, RPT_WARNING, "Cannot make a polygon with interior vertices");
-		return 0;
-	}
-	
-	// check for faces
-	if(nor==NULL) {
-		BKE_report(op->reports, RPT_WARNING, "No faces were selected to make FGon");
-		return 0;
-	}
-
-	// and there we go
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		if(eed->f1) {
-			eed->h |= EM_FGON;
-			done= 1;
-		}
-	}
-	
-	if(done)
-		EM_fgon_flags(em);	// redo flags and indices for fgons
-	return done;
-}
-
-static int make_fgon_exec(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
-
-	if( make_fgon(em, op, 1) ) {
-		DAG_id_tag_update(obedit->data, 0);
-		WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-
-		BKE_mesh_end_editmesh(obedit->data, em);
-		return OPERATOR_FINISHED;
-	}
-
-	BKE_mesh_end_editmesh(obedit->data, em);
-	return OPERATOR_CANCELLED;
-}
-
-void MESH_OT_fgon_make(struct wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Make F-gon";
-	ot->description= "Make fgon from selected faces";
-	ot->idname= "MESH_OT_fgon_make";
-	
-	/* api callbacks */
-	ot->exec= make_fgon_exec;
-	ot->poll= ED_operator_editmesh;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	return v3d ? v3d->grid : 1.0f;
 }
 
-static int clear_fgon_exec(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
-	
-	if( make_fgon(em, op, 0) ) {
-		DAG_id_tag_update(obedit->data, 0);
-		WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-		
-		BKE_mesh_end_editmesh(obedit->data, em);
-		return OPERATOR_FINISHED;
-	}
-
-	BKE_mesh_end_editmesh(obedit->data, em);
-	return OPERATOR_CANCELLED;
-}
+/* ********* add primitive operators ************* */
 
-void MESH_OT_fgon_clear(struct wmOperatorType *ot)
+static void make_prim_init(bContext *C, const char *idname,
+                           float *dia, float mat[][4],
+                           int *state, float *loc, float *rot, unsigned int layer)
 {
-	/* identifiers */
-	ot->name= "Clear F-gon";
-	ot->description= "Clear fgon from selected face";
-	ot->idname= "MESH_OT_fgon_clear";
-	
-	/* api callbacks */
-	ot->exec= clear_fgon_exec;
-	ot->poll= ED_operator_editmesh;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
+	Object *obedit = CTX_data_edit_object(C);
 
-/* precondition; 4 vertices selected, check for 4 edges and create face */
-static EditFace *addface_from_edges(EditMesh *em)
-{
-	EditEdge *eed, *eedar[4]={NULL, NULL, NULL, NULL};
-	EditVert *v1=NULL, *v2=NULL, *v3=NULL, *v4=NULL;
-	int a;
-	
-	/* find the 4 edges */
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		if( (eed->f & SELECT) || (eed->v1->f & eed->v2->f & SELECT) ) {
-			if(eedar[0]==NULL) eedar[0]= eed;
-			else if(eedar[1]==NULL) eedar[1]= eed;
-			else if(eedar[2]==NULL) eedar[2]= eed;
-			else eedar[3]= eed;
-			
-		}
-	}
-	
-	
-	if(eedar[3]) {
-		/* first 2 points */
-		v1= eedar[0]->v1;
-		v2= eedar[0]->v2;
-		
-		/* find the 2 edges connected to first edge */
-		for(a=1; a<4; a++) {
-			if( eedar[a]->v1 == v2) v3= eedar[a]->v2;
-			else if(eedar[a]->v2 == v2) v3= eedar[a]->v1;
-			else if( eedar[a]->v1 == v1) v4= eedar[a]->v2;
-			else if(eedar[a]->v2 == v1) v4= eedar[a]->v1;
-		}
+	*state = 0;
+	if (obedit == NULL || obedit->type != OB_MESH) {
+		obedit = ED_object_add_type(C, OB_MESH, loc, rot, FALSE, layer);
 		
-		/* verify if last edge exists */
-		if(v3 && v4) {
-			for(a=1; a<4; a++) {
-				if( eedar[a]->v1==v3 && eedar[a]->v2==v4) break;
-				if( eedar[a]->v2==v3 && eedar[a]->v1==v4) break;
-			}
-			if(a!=4) {
-				return addfacelist(em, v1, v2, v3, v4, NULL, NULL);
-			}
-		}
-	}
-	return NULL;
-}
-
-/* ******************************* */
-
-/* this also allows to prevent triangles being made in quads */
-static int compareface_overlaps(EditFace *vl1, EditFace *vl2)
-{
-	EditVert *v1, *v2, *v3, *v4;
-	int equal= 0;
-	
-	v1= vl2->v1;
-	v2= vl2->v2;
-	v3= vl2->v3;
-	v4= vl2->v4;
-	
-	if(vl1==vl2) return 0;
-	
-	if(v4==NULL && vl1->v4==NULL) {
-		if(vl1->v1==v1 || vl1->v2==v1 || vl1->v3==v1) equal++;
-		if(vl1->v1==v2 || vl1->v2==v2 || vl1->v3==v2) equal++;
-		if(vl1->v1==v3 || vl1->v2==v3 || vl1->v3==v3) equal++;
-	}
-	else {
-		if(vl1->v1==v1 || vl1->v2==v1 || vl1->v3==v1 || vl1->v4==v1) equal++;
-		if(vl1->v1==v2 || vl1->v2==v2 || vl1->v3==v2 || vl1->v4==v2) equal++;
-		if(vl1->v1==v3 || vl1->v2==v3 || vl1->v3==v3 || vl1->v4==v3) equal++;
-		if(vl1->v1==v4 || vl1->v2==v4 || vl1->v3==v4 || vl1->v4==v4) equal++;
-	}
+		rename_id((ID *)obedit, idname);
+		rename_id((ID *)obedit->data, idname);
 
-	if(v4 && vl1->v4) {
-		if(equal==4) return 1;
-	}
-	else 
-		if(equal>=3) return 1;
-	
-	return 0;
-}
-
-/* checks for existence, and for tria overlapping inside quad */
-static EditFace *exist_face_overlaps(EditMesh *em, EditVert *v1, EditVert *v2, EditVert *v3, EditVert *v4)
-{
-	EditFace *efa, efatest;
-	
-	efatest.v1= v1;
-	efatest.v2= v2;
-	efatest.v3= v3;
-	efatest.v4= v4;
-	
-	efa= em->faces.first;
-	while(efa) {
-		if(compareface_overlaps(&efatest, efa)) return efa;
-		efa= efa->next;
-	}
-	return NULL;
-}
-
-/* will be new face smooth or solid? depends on smoothness of face neighbours
- * of new face, if function return 1, then new face will be smooth, when functio
- * will return zero, then new face will be solid */
-static void fix_new_face(EditMesh *em, EditFace *eface)
-{
-	struct EditFace *efa;
-	struct EditEdge *eed=NULL;
-	struct EditVert *v1 = eface->v1, *v2 = eface->v2, *v3 = eface->v3, *v4 = eface->v4;
-	struct EditVert *ev1=NULL, *ev2=NULL;
-	short smooth=0; /* "total smoothnes" of faces in neighbourhood */
-	short coef;	/* "weight" of smoothness */
-	short count=0;	/* number of edges with same direction as eface */
-	short vi00=0, vi01=0, vi10=0, vi11=0; /* vertex indexes */
-
-	efa = em->faces.first;
-
-	while(efa) {
-
-		if(efa==eface) {
-			efa = efa->next;
-			continue;
-		}
-
-		coef = 0;
-		ev1 = ev2 = NULL;
-		eed = NULL;
-
-		if(efa->v1==v1 || efa->v2==v1 || efa->v3==v1 || efa->v4==v1) {
-			ev1 = v1;
-			coef++;
-		}
-		if(efa->v1==v2 || efa->v2==v2 || efa->v3==v2 || efa->v4==v2) {
-			if(ev1) ev2 = v2;
-			else ev1 = v2;
-			coef++;
-		}
-		if(efa->v1==v3 || efa->v2==v3 || efa->v3==v3 || efa->v4==v3) {
-			if(coef<2) {
-				if(ev1) ev2 = v3;
-				else ev1 = v3;
-			}
-			coef++;
-		}
-		if((v4) && (efa->v1==v4 || efa->v2==v4 || efa->v3==v4 || efa->v4==v4)) {
-			if(ev1 && coef<2) ev2 = v4;
-			coef++;
-		}
-
-		/* "democracy" of smoothness */
-		if(efa->flag & ME_SMOOTH)
-			smooth += coef;
-		else
-			smooth -= coef;
-
-		/* try to find edge using vertexes ev1 and ev2 */
-		if((ev1) && (ev2) && (ev1!=ev2)) eed = findedgelist(em, ev1, ev2);
-
-		/* has bordering edge of efa same direction as edge of eface ? */
-		if(eed) {
-			if(eed->v1==v1) vi00 = 1;
-			else if(eed->v1==v2) vi00 = 2;
-			else if(eed->v1==v3) vi00 = 3;
-			else if(v4 && eed->v1==v4) vi00 = 4;
-
-			if(eed->v2==v1) vi01 = 1;
-			else if(eed->v2==v2) vi01 = 2;
-			else if(eed->v2==v3) vi01 = 3;
-			else if(v4 && eed->v2==v4) vi01 = 4;
-
-			if(v4) {
-				if(vi01==1 && vi00==4) vi00 = 0;
-				if(vi01==4 && vi00==1) vi01 = 0;
-			}
-			else {
-				if(vi01==1 && vi00==3) vi00 = 0;
-				if(vi01==3 && vi00==1) vi01 = 0;
-			}
-
-			if(eed->v1==efa->v1) vi10 = 1;
-			else if(eed->v1==efa->v2) vi10 = 2;
-			else if(eed->v1==efa->v3) vi10 = 3;
-			else if(efa->v4 && eed->v1==efa->v4) vi10 = 4;
-
-			if(eed->v2==efa->v1) vi11 = 1;
-			else if(eed->v2==efa->v2) vi11 = 2;
-			else if(eed->v2==efa->v3) vi11 = 3;
-			else if(efa->v4 && eed->v2==efa->v4) vi11 = 4;
-
-			if(efa->v4) {
-				if(vi11==1 && vi10==4) vi10 = 0;
-				if(vi11==4 && vi10==1) vi11 = 0;
-			}
-			else {
-				if(vi11==1 && vi10==3) vi10 = 0;
-				if(vi11==3 && vi10==1) vi11 = 0;
-			}
-
-			if(((vi00>vi01) && (vi10>vi11)) ||
-				((vi00<vi01) && (vi10<vi11)))
-				count++;
-			else
-				count--;
-		}
-
-		efa = efa->next;
-	}
-
-	/* set up smoothness according voting of face in neighbourhood */
-	if(smooth >= 0)
-		eface->flag |= ME_SMOOTH;
-	else
-		eface->flag &= ~ME_SMOOTH;
-
-	/* flip face, when too much "face normals" in neighbourhood is different */
-	if(count > 0) {
-		flipface(em, eface);
-	}
-}
-
-/* only adds quads or trias when there's edges already */
-static void addfaces_from_edgenet(EditMesh *em)
-{
-	EditVert *eve1, *eve2, *eve3, *eve4;
-	
-	for(eve1= em->verts.first; eve1; eve1= eve1->next) {
-		for(eve2= em->verts.first; (eve1->f & 1) && eve2; eve2= eve2->next) {
-			if(findedgelist(em, eve1,eve2)) {
-				for(eve3= em->verts.first; (eve2->f & 1) && eve3; eve3= eve3->next) {
-					if((eve2!=eve3 && (eve3->f & 1) && findedgelist(em, eve1,eve3))) {
-						EditEdge *sh_edge= NULL;
-						EditVert *sh_vert= NULL;
-						
-						sh_edge= findedgelist(em, eve2,eve3);
-						
-						if(sh_edge) { /* Add a triangle */
-							if(!exist_face_overlaps(em, eve1,eve2,eve3,NULL))
-								fix_new_face(em, addfacelist(em, eve1,eve2,eve3,NULL,NULL,NULL));
-						}
-						else { /* Check for a shared vertex */
-							for(eve4= em->verts.first; eve4; eve4= eve4->next) {
-								if(eve4!=eve1 && eve4!=eve2 && eve4!=eve3 && (eve4->f & 1) &&
-								   !findedgelist(em, eve1,eve4) && findedgelist(em, eve2,eve4) &&
-								   findedgelist(em, eve3,eve4)) {
-									sh_vert= eve4;
-									break;
-								}
-							}
-							
-							if(sh_vert) {
-								if(sh_vert) {
-									if(!exist_face_overlaps(em, eve1,eve2,eve4,eve3))
-										fix_new_face(em, addfacelist(em, eve1,eve2,eve4,eve3,NULL,NULL));
-								}
-							}
-						}
-					}
-				}
-			}
-		}
-	}
-
-	EM_select_flush(em);
-	
-// XXX	DAG_id_tag_update(obedit->data, 0);
-}
-
-static void addedgeface_mesh(EditMesh *em, wmOperator *op)
-{
-	EditVert *eve, *neweve[4];
-	EditEdge *eed;
-	EditFace *efa;
-	short amount=0;
-
-	/* how many selected ? */
-	if(em->selectmode & SCE_SELECT_EDGE) {
-		/* in edge mode finding selected vertices means flushing down edge codes... */
-		/* can't make face with only edge selection info... */
-		EM_selectmode_set(em);
-	}
-	
-	for(eve= em->verts.first; eve; eve= eve->next) {
-		if(eve->f & SELECT) {
-			amount++;
-			if(amount>4) break;			
-			neweve[amount-1]= eve;
-		}
-	}
-
-	if(amount==2) {
-		eed= addedgelist(em, neweve[0], neweve[1], NULL);
-		EM_select_edge(eed, 1);
-
-		// XXX		DAG_id_tag_update(obedit->data, 0);
-		return;
-	}
-	else if(amount > 4) {
-		addfaces_from_edgenet(em);
-		return;
-	}
-	else if(amount<2) {
-		BKE_report(op->reports, RPT_WARNING, "More vertices are needed to make an edge/face");
-		return;
-	}
-
-	efa= NULL; // check later
-
-	if(amount==3) {
-		
-		if(exist_face_overlaps(em, neweve[0], neweve[1], neweve[2], NULL)==0) {
-			efa= addfacelist(em, neweve[0], neweve[1], neweve[2], 0, NULL, NULL);
-			EM_select_face(efa, 1);
-		}
-		else BKE_report(op->reports, RPT_WARNING, "The selected vertices already form a face");
-	}
-	else if(amount==4) {
-		/* this test survives when theres 2 triangles */
-		if(exist_face(em, neweve[0], neweve[1], neweve[2], neweve[3])==0) {
-			int tria= 0;
-			
-			/* remove trias if they exist, 4 cases.... */
-			if(exist_face(em, neweve[0], neweve[1], neweve[2], NULL)) tria++;
-			if(exist_face(em, neweve[0], neweve[1], neweve[3], NULL)) tria++;
-			if(exist_face(em, neweve[0], neweve[2], neweve[3], NULL)) tria++;
-			if(exist_face(em, neweve[1], neweve[2], neweve[3], NULL)) tria++;
-		
-			if(tria==2) join_triangles(em);
-			else if(exist_face_overlaps(em, neweve[0], neweve[1], neweve[2], neweve[3])==0) {
-				 /* If there are 4 Verts, But more selected edges, we need to call addfaces_from_edgenet */
-					EditEdge *eedcheck;
-					int count;
-					count = 0;
-					for(eedcheck= em->edges.first; eedcheck; eedcheck= eedcheck->next) {
-						if(eedcheck->f & SELECT) {
-							count++;
-						}
-					}	
-				
-				if(count++ > 4){
-					addfaces_from_edgenet(em);
-					return;
-				} else {
-				/* if 4 edges exist, we just create the face, convex or not */
-					efa= addface_from_edges(em);
-					if(efa==NULL) {
-						
-						/* the order of vertices can be anything, 6 cases to check */
-						if( convex(neweve[0]->co, neweve[1]->co, neweve[2]->co, neweve[3]->co) ) {
-							efa= addfacelist(em, neweve[0], neweve[1], neweve[2], neweve[3], NULL, NULL);
-						}
-						else if( convex(neweve[0]->co, neweve[2]->co, neweve[3]->co, neweve[1]->co) ) {
-							efa= addfacelist(em, neweve[0], neweve[2], neweve[3], neweve[1], NULL, NULL);
-						}
-						else if( convex(neweve[0]->co, neweve[2]->co, neweve[1]->co, neweve[3]->co) ) {
-							efa= addfacelist(em, neweve[0], neweve[2], neweve[1], neweve[3], NULL, NULL);
-						}
-						else if( convex(neweve[0]->co, neweve[1]->co, neweve[3]->co, neweve[2]->co) ) {
-							efa= addfacelist(em, neweve[0], neweve[1], neweve[3], neweve[2], NULL, NULL);
-						}
-						else if( convex(neweve[0]->co, neweve[3]->co, neweve[2]->co, neweve[1]->co) ) {
-							efa= addfacelist(em, neweve[0], neweve[3], neweve[2], neweve[1], NULL, NULL);
-						}
-						else if( convex(neweve[0]->co, neweve[3]->co, neweve[1]->co, neweve[2]->co) ) {
-							efa= addfacelist(em, neweve[0], neweve[3], neweve[1], neweve[2], NULL, NULL);
-						}
-						else BKE_report(op->reports, RPT_WARNING, "cannot find nice quad from concave set of vertices");
-
-					}
-				}
-			}
-			else BKE_report(op->reports, RPT_WARNING, "The selected vertices already form a face");
-		}
-		else BKE_report(op->reports, RPT_WARNING, "The selected vertices already form a face");
-	}
-	
-	if(efa) {
-		EM_select_face(efa, 1);
-
-		fix_new_face(em, efa);
-		
-		recalc_editnormals(em);
-	}
-	}
-
-static int addedgeface_mesh_exec(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
-	
-	addedgeface_mesh(em, op);
-	
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-	
-	BKE_mesh_end_editmesh(obedit->data, em);
-	return OPERATOR_FINISHED;
-}
-
-void MESH_OT_edge_face_add(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Make Edge/Face";
-	ot->description= "Add an edge or face to selected";
-	ot->idname= "MESH_OT_edge_face_add";
-	
-	/* api callbacks */
-	ot->exec= addedgeface_mesh_exec;
-	ot->poll= ED_operator_editmesh;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-	
-}
-
-
-
-/* ************************ primitives ******************* */
-
-// HACK: these can also be found in cmoview.tga.c, but are here so that they can be found by linker
-// this hack is only used so that scons+mingw + split-sources hack works
-	// ------------------------------- start copied code
-/* these are not the monkeys you are looking for */
-static int monkeyo= 4;
-static int monkeynv= 271;
-static int monkeynf= 250;
-static signed char monkeyv[271][3]= {
-{-71,21,98},{-63,12,88},{-57,7,74},{-82,-3,79},{-82,4,92},
-{-82,17,100},{-92,21,102},{-101,12,95},{-107,7,83},
-{-117,31,84},{-109,31,95},{-96,31,102},{-92,42,102},
-{-101,50,95},{-107,56,83},{-82,66,79},{-82,58,92},
-{-82,46,100},{-71,42,98},{-63,50,88},{-57,56,74},
-{-47,31,72},{-55,31,86},{-67,31,97},{-66,31,99},
-{-70,43,100},{-82,48,103},{-93,43,105},{-98,31,105},
-{-93,20,105},{-82,31,106},{-82,15,103},{-70,20,100},
-{-127,55,95},{-127,45,105},{-127,-87,94},{-127,-41,100},
-{-127,-24,102},{-127,-99,92},{-127,52,77},{-127,73,73},
-{-127,115,-70},{-127,72,-109},{-127,9,-106},{-127,-49,-45},
-{-101,-24,72},{-87,-56,73},{-82,-89,73},{-80,-114,68},
-{-85,-121,67},{-104,-124,71},{-127,-126,74},{-71,-18,68},
-{-46,-5,69},{-21,19,57},{-17,55,76},{-36,62,80},
-{-64,77,88},{-86,97,94},{-107,92,97},{-119,63,96},
-{-106,53,99},{-111,39,98},{-101,12,95},{-79,2,90},
-{-64,8,86},{-47,24,83},{-45,38,83},{-50,48,85},
-{-72,56,92},{-95,60,97},{-127,-98,94},{-113,-92,94},
-{-112,-107,91},{-119,-113,89},{-127,-114,88},{-127,-25,96},
-{-127,-18,95},{-114,-19,95},{-111,-29,96},{-116,-37,95},
-{-76,-6,86},{-48,7,80},{-34,26,77},{-32,48,84},
-{-39,53,93},{-71,70,102},{-87,82,107},{-101,79,109},
-{-114,55,108},{-111,-13,104},{-100,-57,91},{-95,-90,88},
-{-93,-105,85},{-97,-117,81},{-106,-119,81},{-127,-121,82},
-{-127,6,93},{-127,27,98},{-85,61,95},{-106,18,96},
-{-110,27,97},{-112,-88,94},{-117,-57,96},{-127,-57,96},
-{-127,-42,95},{-115,-35,100},{-110,-29,102},{-113,-17,100},
-{-122,-16,100},{-127,-26,106},{-121,-19,104},{-115,-20,104},
-{-113,-29,106},{-117,-32,103},{-127,-37,103},{-94,-40,71},
-{-106,-31,91},{-104,-40,91},{-97,-32,71},{-127,-112,88},
-{-121,-111,88},{-115,-105,91},{-115,-95,93},{-127,-100,84},
-{-115,-96,85},{-115,-104,82},{-121,-109,81},{-127,-110,81},
-{-105,28,100},{-103,20,99},{-84,55,97},{-92,54,99},
-{-73,51,99},{-55,45,89},{-52,37,88},{-53,25,87},
-{-66,13,92},{-79,8,95},{-98,14,100},{-104,38,100},
-{-100,48,100},{-97,46,97},{-102,38,97},{-96,16,97},
-{-79,11,93},{-68,15,90},{-57,27,86},{-56,36,86},
-{-59,43,87},{-74,50,96},{-91,51,98},{-84,52,96},
-{-101,22,96},{-102,29,96},{-113,59,78},{-102,85,79},
-{-84,88,76},{-65,71,71},{-40,58,63},{-25,52,59},
-{-28,21,48},{-50,0,53},{-71,-12,60},{-127,115,37},
-{-127,126,-10},{-127,-25,-86},{-127,-59,24},{-127,-125,59},
-{-127,-103,44},{-127,-73,41},{-127,-62,36},{-18,30,7},
-{-17,41,-6},{-28,34,-56},{-68,56,-90},{-33,-6,9},
-{-51,-16,-21},{-45,-1,-55},{-84,7,-85},{-97,-45,52},
-{-104,-53,33},{-90,-91,49},{-95,-64,50},{-85,-117,51},
-{-109,-97,47},{-111,-69,46},{-106,-121,56},{-99,-36,55},
-{-100,-29,60},{-101,-22,64},{-100,-50,21},{-89,-40,-34},
-{-83,-19,-69},{-69,111,-49},{-69,119,-9},{-69,109,30},
-{-68,67,55},{-34,52,43},{-46,58,36},{-45,90,7},
-{-25,72,16},{-25,79,-15},{-45,96,-25},{-45,87,-57},
-{-25,69,-46},{-48,42,-75},{-65,3,-70},{-22,42,-26},
-{-75,-22,19},{-72,-25,-27},{-13,52,-30},{-28,-18,-16},
-{6,-13,-42},{37,7,-55},{46,41,-54},{31,65,-54},
-{4,61,-40},{3,53,-37},{25,56,-50},{35,37,-52},
-{28,10,-52},{5,-5,-39},{-21,-9,-17},{-9,46,-28},
-{-6,39,-37},{-14,-3,-27},{6,0,-47},{25,12,-57},
-{31,32,-57},{23,46,-56},{4,44,-46},{-19,37,-27},
-{-20,22,-35},{-30,12,-35},{-22,11,-35},{-19,2,-35},
-{-23,-2,-35},{-34,0,-9},{-35,-3,-22},{-35,5,-24},
-{-25,26,-27},{-13,31,-34},{-13,30,-41},{-23,-2,-41},
-{-18,2,-41},{-21,10,-41},{-29,12,-41},{-19,22,-41},
-{6,42,-53},{25,44,-62},{34,31,-63},{28,11,-62},
-{7,0,-54},{-14,-2,-34},{-5,37,-44},{-13,14,-42},
-{-7,8,-43},{1,16,-47},{-4,22,-45},{3,30,-48},
-{8,24,-49},{15,27,-50},{12,35,-50},{4,56,-62},
-{33,60,-70},{48,38,-64},{41,7,-68},{6,-11,-63},
-{-26,-16,-42},{-17,49,-49},
-};
-
-static signed char monkeyf[250][4]= {
-{27,4,5,26}, {25,4,5,24}, {3,6,5,4}, {1,6,5,2}, {5,6,7,4}, 
-{3,6,7,2}, {5,8,7,6}, {3,8,7,4}, {7,8,9,6}, 
-{5,8,9,4}, {7,10,9,8}, {5,10,9,6}, {9,10,11,8}, 
-{7,10,11,6}, {9,12,11,10}, {7,12,11,8}, {11,6,13,12}, 
-{5,4,13,12}, {3,-2,13,12}, {-3,-4,13,12}, {-5,-10,13,12}, 
-{-11,-12,14,12}, {-13,-18,14,13}, {-19,4,5,13}, {10,12,4,4}, 
-{10,11,9,9}, {8,7,9,9}, {7,5,6,6}, {6,3,4,4}, 
-{5,1,2,2}, {4,-1,0,0}, {3,-3,-2,-2}, {22,67,68,23}, 
-{20,65,66,21}, {18,63,64,19}, {16,61,62,17}, {14,59,60,15}, 
-{12,19,48,57}, {18,19,48,47}, {18,19,48,47}, {18,19,48,47}, 
-{18,19,48,47}, {18,19,48,47}, {18,19,48,47}, {18,19,48,47}, 
-{18,19,48,47}, {18,-9,-8,47}, {18,27,45,46}, {26,55,43,44}, 
-{24,41,42,54}, {22,39,40,23}, {20,37,38,21}, {18,35,36,19}, 
-{16,33,34,17}, {14,31,32,15}, {12,39,30,13}, {11,48,45,38}, 
-{8,36,-19,9}, {8,-20,44,47}, {42,45,46,43}, {18,19,40,39}, 
-{16,17,38,37}, {14,15,36,35}, {32,44,43,33}, {12,33,32,42}, 
-{19,44,43,42}, {40,41,42,-27}, {8,9,39,-28}, {15,43,42,16}, 
-{13,43,42,14}, {11,43,42,12}, {9,-30,42,10}, {37,12,38,-32}, 
-{-33,37,45,46}, {-33,40,41,39}, {38,40,41,37}, {36,40,41,35}, 
-{34,40,41,33}, {36,39,38,37}, {35,40,39,38}, {1,2,14,21}, 
-{1,2,40,13}, {1,2,40,39}, {1,24,12,39}, {-34,36,38,11}, 
-{35,38,36,37}, {-37,8,35,37}, {-11,-12,-45,40}, {-11,-12,39,38}, 
-{-11,-12,37,36}, {-11,-12,35,34}, {33,34,40,41}, {33,34,38,39}, 
-{33,34,36,37}, {33,-52,34,35}, {33,37,36,34}, {33,35,34,34}, 
-{8,7,37,36}, {-32,7,35,46}, {-34,-33,45,46}, {4,-33,43,34}, 
-{-34,-33,41,42}, {-34,-33,39,40}, {-34,-33,37,38}, {-34,-33,35,36}, 
-{-34,-33,33,34}, {-34,-33,31,32}, {-34,-4,28,30}, {-5,-34,28,27}, 
-{-35,-44,36,27}, {26,35,36,45}, {24,25,44,45}, {25,23,44,42}, 
-{25,24,41,40}, {25,24,39,38}, {25,24,37,36}, {25,24,35,34}, 
-{25,24,33,32}, {25,24,31,30}, {15,24,29,38}, {25,24,27,26}, 
-{23,12,37,26}, {11,12,35,36}, {-86,-59,36,-80}, {-60,-61,36,35}, 
-{-62,-63,36,35}, {-64,-65,36,35}, {-66,-67,36,35}, {-68,-69,36,35}, 
-{-70,-71,36,35}, {-72,-73,36,35}, {-74,-75,36,35}, {42,43,53,58}, 
-{40,41,57,56}, {38,39,55,57}, {-81,-80,37,56}, {-83,-82,55,52}, 
-{-85,-84,51,49}, {-87,-86,48,49}, {47,50,51,48}, {46,48,51,49}, 
-{43,46,49,44}, {-92,-91,45,42}, {-23,49,50,-20}, {-94,40,48,-24}, 
-{-96,-22,48,49}, {-97,48,21,-90}, {-100,36,50,23}, {22,49,48,-100}, 
-{-101,47,46,22}, {21,45,35,25}, {33,34,44,41}, {13,14,28,24}, 
-{-107,26,30,-106}, {14,46,45,15}, {14,44,43,-110}, {-111,42,23,-110}, 
-{6,7,45,46}, {45,44,47,46}, {45,46,47,48}, {47,46,49,48}, 
-{17,49,47,48}, {17,36,46,48}, {35,36,44,45}, {35,36,40,43}, 
-{35,36,38,39}, {-4,-3,37,35}, {-123,34,33,1}, {-9,-8,-7,-6}, 
-{-10,-7,32,-125}, {-127,-11,-126,-126}, {-7,-6,5,31}, {4,5,33,30}, 
-{4,39,33,32}, {4,35,32,38}, {20,21,39,38}, {4,37,38,5}, 
-{-11,-10,36,3}, {-11,15,14,35}, {13,16,34,34}, {-13,14,13,13}, 
-{-3,1,30,29}, {-3,28,29,1}, {-2,31,28,-1}, {12,13,27,30}, 
-{-2,26,12,12}, {35,29,42,36}, {34,35,36,33}, {32,35,36,31}, 
-{30,35,36,29}, {28,35,36,27}, {26,35,36,25}, {34,39,38,35}, 
-{32,39,38,33}, {30,39,38,31}, {28,39,38,29}, {26,39,38,27}, 
-{25,31,32,38}, {-18,-17,45,44}, {-18,17,28,44}, {-24,-20,42,-23}, 
-{11,35,27,14}, {25,28,39,41}, {37,41,40,38}, {34,40,36,35}, 
-{32,40,39,33}, {30,39,31,40}, {21,29,39,22}, {-31,37,28,4}, 
-{-32,33,35,36}, {32,33,34,34}, {18,35,36,48}, {34,25,40,35}, 
-{24,25,38,39}, {24,25,36,37}, {24,25,34,35}, {24,25,32,33}, 
-{24,13,41,31}, {17,11,41,35}, {15,16,34,35}, {13,14,34,35}, 
-{11,12,34,35}, {9,10,34,35}, {7,8,34,35}, {26,25,37,36}, 
-{35,36,37,38}, {37,36,39,38}, {37,38,39,40}, {25,31,36,39}, 
-{18,34,35,30}, {17,22,30,33}, {19,29,21,20}, {16,26,29,17}, 
-{24,29,28,25}, {22,31,28,23}, {20,31,30,21}, {18,31,30,19}, 
-{16,30,17,17}, {-21,-22,35,34}, {-21,-22,33,32}, {-21,-22,31,30}, 
-{-21,-22,29,28}, {-21,-22,27,26}, {-28,-22,25,31}, {24,28,29,30}, 
-{23,24,26,27}, {23,24,25,25}, {-69,-35,-32,27}, {-70,26,25,-66}, 
-{-68,-67,24,-33}, 
-};
-	// ------------------------------- end copied code
-
-
-#define PRIM_PLANE		0
-#define PRIM_CUBE		1
-#define PRIM_CIRCLE		4
-#define PRIM_CYLINDER 	5
-#define PRIM_CONE 		7
-#define PRIM_GRID		10
-#define PRIM_UVSPHERE	11
-#define PRIM_ICOSPHERE 	12
-#define PRIM_MONKEY		13
-
-static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int seg,
-		int subdiv, float dia, float depth, int ext, int fill)
-{
-	/*
-	 * type - for the type of shape
-	 * dia - the radius for cone,sphere cylinder etc.
-	 * depth - 
-	 * ext - extrude
-	 * fill - end capping, and option to fill in circle
-	 * cent[3] - center of the data. 
-	 * */
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
-	EditVert *eve, *v1=NULL, *v2, *v3, *v4=NULL, *vtop, *vdown;
-	float phi, phid, vec[3];
-	float q[4], cmat[3][3], nor[3]= {0.0, 0.0, 0.0};
-	short a, b;
-	float len, len2, vec2[3];
-	
-	EM_clear_flag_all(em, SELECT);
-
-	phid= 2.0f*(float)M_PI/tot;
-	phi= .25f*(float)M_PI;
-
-	switch(type) {
-	case PRIM_GRID: /*  grid */
-		/* clear flags */
-		eve= em->verts.first;
-		while(eve) {
-			eve->f= 0;
-			eve= eve->next;
-		}
-		
-		/* one segment first: the X axis */		
-		phi = (2*dia)/(float)(tot-1);
-		phid = (2*dia)/(float)(seg-1);
-		for(a=tot-1;a>=0;a--) {
-			vec[0] = (phi*a) - dia;
-			vec[1]= - dia;
-			vec[2]= 0.0f;
-			eve= addvertlist(em, vec, NULL);
-			eve->f= 1+2+4;
-			if(a < tot -1) addedgelist(em, eve->prev, eve, NULL);
-		}
-		/* extrude and translate */
-		vec[0]= vec[2]= 0.0;
-		vec[1]= phid;
-		
-		for(a=0;a<seg-1;a++) {
-			extrudeflag_vert(obedit, em, 2, nor, 0);	// nor unused
-			translateflag(em, 2, vec);
-		}
-			
-		/* and now do imat */
-		eve= em->verts.first;
-		while(eve) {
-			if(eve->f & SELECT) {
-				mul_m4_v3(mat,eve->co);
-			}
-			eve= eve->next;
-		}
-		recalc_editnormals(em);
-		break;
-			
-	case PRIM_UVSPHERE: /*  UVsphere */
-		
-		/* clear all flags */
-		eve= em->verts.first;
-		while(eve) {
-			eve->f= 0;
-			eve= eve->next;
-		}
-		
-		/* one segment first */
-		phi= 0; 
-		phid/=2;
-		for(a=0; a<=tot; a++) {
-			vec[0]= dia*sinf(phi);
-			vec[1]= 0.0;
-			vec[2]= dia*cosf(phi);
-			eve= addvertlist(em, vec, NULL);
-			eve->f= 1+2+4;
-			if(a==0) v1= eve;
-			else addedgelist(em, eve, eve->prev, NULL);
-			phi+= phid;
-		}
-		
-		/* extrude and rotate */
-		phi= M_PI/seg;
-		q[0]= cos(phi);
-		q[3]= sin(phi);
-		q[1]=q[2]= 0;
-		quat_to_mat3( cmat,q);
-		
-		for(a=0; a<seg; a++) {
-			extrudeflag_vert(obedit, em, 2, nor, 0); // nor unused
-			rotateflag(em, 2, v1->co, cmat);
-		}
-
-		/* length of one segment on meridian */
-		len= 2*dia*sinf(phid / 2.0f);
-
-		/* length of one segment in shortest parallen */
-		vec[0]= dia*sinf(phid);
-		vec[1]= 0.0;
-		vec[2]= dia*cosf(phid);
-
-		mul_v3_m3v3(vec2, cmat, vec);
-		len2= len_v3v3(vec, vec2);
-
-		/* use shortest segment length divided by 3 as merge threshold */
-		removedoublesflag(em, 4, 0, MIN2(len, len2) / 3.0f);
-
-		/* and now do imat */
-		eve= em->verts.first;
-		while(eve) {
-			if(eve->f & SELECT) {
-				mul_m4_v3(mat,eve->co);
-			}
-			eve= eve->next;
-		}
-		recalc_editnormals(em);
-		break;
-	case PRIM_ICOSPHERE: /* Icosphere */
-		{
-			EditVert *eva[12];
-			EditEdge *eed;
-			
-			/* clear all flags */
-			eve= em->verts.first;
-			while(eve) {
-				eve->f= 0;
-				eve= eve->next;
-			}
-			dia/=200;
-			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]= addvertlist(em, vec, NULL);
-				eva[a]->f= 1+2;
-			}
-			for(a=0;a<20;a++) {
-				EditFace *evtemp;
-				v1= eva[ icoface[a][0] ];
-				v2= eva[ icoface[a][1] ];
-				v3= eva[ icoface[a][2] ];
-				evtemp = addfacelist(em, v1, v2, v3, 0, NULL, NULL);
-				evtemp->e1->f = 1+2;
-				evtemp->e2->f = 1+2;
-				evtemp->e3->f = 1+2;
-			}
-
-			dia*=200;
-			for(a=1; a<subdiv; a++) esubdivideflag(obedit, em, 2, dia, 0, B_SPHERE,1, SUBDIV_CORNER_PATH, 0);
-			/* and now do imat */
-			eve= em->verts.first;
-			while(eve) {
-				if(eve->f & 2) {
-					mul_m4_v3(mat,eve->co);
-				}
-				eve= eve->next;
-			}
-			
-			// Clear the flag 2 from the edges
-			for(eed=em->edges.first;eed;eed=eed->next){
-				if(eed->f & 2){
-					   eed->f &= !2;
-				}   
-			}
-		}
-		break;
-	case PRIM_MONKEY: /* Monkey */
-		{
-			//extern int monkeyo, monkeynv, monkeynf;
-			//extern signed char monkeyf[][4];
-			//extern signed char monkeyv[][3];
-			EditVert **tv= MEM_mallocN(sizeof(*tv)*monkeynv*2, "tv");
-			int i;
-
-			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]= addvertlist(em, v, NULL);
-				tv[i]->f |= SELECT;
-				tv[monkeynv+i]= (fabs(v[0]= -v[0])<0.001)?tv[i]:addvertlist(em, v, NULL);
-				tv[monkeynv+i]->f |= SELECT;
-			}
-			for (i=0; i<monkeynf; i++) {
-				addfacelist(em, tv[monkeyf[i][0]+i-monkeyo], tv[monkeyf[i][1]+i-monkeyo], tv[monkeyf[i][2]+i-monkeyo], (monkeyf[i][3]!=monkeyf[i][2])?tv[monkeyf[i][3]+i-monkeyo]:NULL, NULL, NULL);
-				addfacelist(em, tv[monkeynv+monkeyf[i][2]+i-monkeyo], tv[monkeynv+monkeyf[i][1]+i-monkeyo], tv[monkeynv+monkeyf[i][0]+i-monkeyo], (monkeyf[i][3]!=monkeyf[i][2])?tv[monkeynv+monkeyf[i][3]+i-monkeyo]:NULL, NULL, NULL);
-			}
-
-			MEM_freeN(tv);
-
-			/* and now do imat */
-			for(eve= em->verts.first; eve; eve= eve->next) {
-				if(eve->f & SELECT) {
-					mul_m4_v3(mat,eve->co);
-				}
-			}
-			recalc_editnormals(em);
-		}
-		break;
-	default: /* all types except grid, sphere... */
-		if(type==PRIM_CONE);
-		else if(ext==0) 
-			depth= 0.0f;
-	
-		/* first vertex at 0° for circular objects */
-		if( ELEM3(type, PRIM_CIRCLE,PRIM_CYLINDER,PRIM_CONE) )
-			phi = 0.0f;
-			
-		vtop= vdown= v1= v2= 0;
-		for(b=0; b<=ext; b++) {
-			for(a=0; a<tot; a++) {
-				
-				vec[0]= dia*sinf(phi);
-				vec[1]= dia*cosf(phi);
-				vec[2]= b?depth:-depth;
-				
-				mul_m4_v3(mat, vec);
-				eve= addvertlist(em, vec, NULL);
-				eve->f= SELECT;
-				if(a==0) {
-					if(b==0) v1= eve;
-					else v2= eve;
-				}
-				phi+=phid;
-			}
-		}
-			
-		/* center vertices */
-		/* type PRIM_CONE can only have 1 one side filled
-		 * if the cone has no capping, dont add vtop */
-		if(type == PRIM_CONE || (fill && !ELEM(type, PRIM_PLANE, PRIM_CUBE))) {
-			vec[0]= vec[1]= 0.0f;
-			vec[2]= type==PRIM_CONE ? depth : -depth;
-			mul_m4_v3(mat, vec);
-			vdown= addvertlist(em, vec, NULL);
-			if((ext || type==PRIM_CONE) && fill) {
-				vec[0]= vec[1]= 0.0f;
-				vec[2]= type==PRIM_CONE ? -depth : depth;
-				mul_m4_v3(mat,vec);
-				vtop= addvertlist(em, vec, NULL);
-			}
-		} else {
-			vdown= v1;
-			vtop= v2;
-		}
-		if(vtop) vtop->f= SELECT;
-		if(vdown) vdown->f= SELECT;
-	
-		/* top and bottom face */
-		if(fill || type==PRIM_CONE) {
-			if(tot==4 && ELEM(type, PRIM_PLANE, PRIM_CUBE)) {
-				v3= v1->next->next;
-				if(ext) v4= v2->next->next;
-				
-				addfacelist(em, v3, v1->next, v1, v3->next, NULL, NULL);
-				if(ext) addfacelist(em, v2, v2->next, v4, v4->next, NULL, NULL);
-				
-			}
-			else {
-				v3= v1;
-				v4= v2;
-				for(a=1; a<tot; a++) {
-					addfacelist(em, vdown, v3, v3->next, 0, NULL, NULL);
-					v3= v3->next;
-					if(ext && fill) {
-						addfacelist(em, vtop, v4, v4->next, 0, NULL, NULL);
-						v4= v4->next;
-					}
-				}
-				if(!ELEM(type, PRIM_PLANE, PRIM_CUBE)) {
-					addfacelist(em, vdown, v3, v1, 0, NULL, NULL);
-					if(ext) addfacelist(em, vtop, v4, v2, 0, NULL, NULL);
-				}
-			}
-		}
-		else if(type==PRIM_CIRCLE) {  /* we need edges for a circle */
-			v3= v1;
-			for(a=1;a<tot;a++) {
-				addedgelist(em, v3, v3->next, NULL);
-				v3= v3->next;
-			}
-			addedgelist(em, v3, v1, NULL);
-		}
-		/* side faces */
-		if(ext) {
-			v3= v1;
-			v4= v2;
-			for(a=1; a<tot; a++) {
-				addfacelist(em, v3, v3->next, v4->next, v4, NULL, NULL);
-				v3= v3->next;
-				v4= v4->next;
-			}
-			addfacelist(em, v3, v1, v2, v4, NULL, NULL);
-		}
-		else if(fill && type==PRIM_CONE) {
-			/* add the bottom flat area of the cone
-			 * if capping is disabled dont bother */
-			v3= v1;
-			for(a=1; a<tot; a++) {
-				addfacelist(em, vtop, v3->next, v3, 0, NULL, NULL);
-				v3= v3->next;
-			}
-			addfacelist(em, vtop, v1, v3, 0, NULL, NULL);
-		}
+		/* create editmode */
+		ED_object_enter_editmode(C, EM_DO_UNDO | EM_IGNORE_LAYER); /* rare cases the active layer is messed up */
+		*state = 1;
 	}
-	
-	EM_stats_update(em);
-	/* simple selection flush OK, based on fact it's a single model */
-	EM_select_flush(em); /* flushes vertex -> edge -> face selection */
-
-	if(!ELEM5(type, PRIM_GRID, PRIM_PLANE, PRIM_ICOSPHERE, PRIM_UVSPHERE, PRIM_MONKEY))
-		EM_recalc_normal_direction(em, FALSE, TRUE);	/* otherwise monkey has eyes in wrong direction */
 
-	BKE_mesh_end_editmesh(obedit->data, em);
+	*dia = new_primitive_matrix(C, loc, rot, mat);
 }
 
-/* ********* add primitive operators ************* */
-
-static const char *get_mesh_defname(int type)
+static void make_prim_finish(bContext *C, int *state, int enter_editmode)
 {
-	switch (type) {
-		case PRIM_PLANE: return "Plane";
-		case PRIM_CUBE: return "Cube";
-		case PRIM_CIRCLE: return "Circle";
-		case PRIM_CYLINDER: return "Cylinder";
-		case PRIM_CONE: return "Cone";
-		case PRIM_GRID: return "Grid";
-		case PRIM_UVSPHERE: return "Sphere";
-		case PRIM_ICOSPHERE: return "Icosphere";
-		case PRIM_MONKEY: return "Monkey";
-		default:
-			return "Mesh";
-	}
-}
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
 
-static void make_prim_ext(bContext *C, float *loc, float *rot, int enter_editmode, unsigned int layer, 
-		int type, int tot, int seg,
-		int subdiv, float dia, float depth, int ext, int fill)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	int newob = 0;
-	float mat[4][4];
-	float scale;
-
-	if(obedit==NULL || obedit->type!=OB_MESH) {
-		obedit= ED_object_add_type(C, OB_MESH, loc, rot, FALSE, layer);
-		
-		rename_id((ID *)obedit, get_mesh_defname(type));
-		rename_id((ID *)obedit->data, get_mesh_defname(type));
-		
-		/* create editmode */
-		ED_object_enter_editmode(C, EM_DO_UNDO|EM_IGNORE_LAYER); /* rare cases the active layer is messed up */
-		newob = 1;
-	}
-	else DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
-
-	scale= ED_object_new_primitive_matrix(C, obedit, loc, rot, mat);
-
-	dia *= scale;
-	depth *= scale * 0.5f;
-
-	make_prim(obedit, type, mat, tot, seg, subdiv, dia, depth, ext, fill);
-
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	/* 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);
 
 	/* userdef */
-	if (newob && !enter_editmode) {
+	if (*state && !enter_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);
+	WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit);
 }
 
 static int add_primitive_plane_exec(bContext *C, wmOperator *op)
 {
+	Object *obedit;
+	Mesh *me;
+	BMEditMesh *em;
+	float loc[3], rot[3], mat[4][4], dia;
 	int enter_editmode;
+	int state;
 	unsigned int layer;
-	float loc[3], rot[3];
 	
-	if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer))
+	ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
+	make_prim_init(C, "Plane", &dia, mat, &state, loc, rot, layer);
+
+	obedit = CTX_data_edit_object(C);
+	me = obedit->data;
+	em = me->edit_btmesh;
+
+	if (!EDBM_op_call_and_selectf(em, op, "vertout",
+	                              "create_grid xsegments=%i ysegments=%i size=%f mat=%m4", 1, 1, dia, mat))
+	{
 		return OPERATOR_CANCELLED;
+	}
 
-	/* sqrt(2.0f) - plane (diameter of 1.41 makes it unit size) */
-	make_prim_ext(C, loc, rot, enter_editmode, layer,
-			PRIM_PLANE, 4, 0, 0, sqrt(2.0f), 0.0f, 0, 1);
-	return OPERATOR_FINISHED;	
+	make_prim_finish(C, &state, enter_editmode);
+
+	return OPERATOR_FINISHED;
 }
 
 void MESH_OT_primitive_plane_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Plane";
-	ot->description= "Construct a filled planar mesh with 4 vertices";
-	ot->idname= "MESH_OT_primitive_plane_add";
+	ot->name = "Add Plane";
+	ot->description = "Construct a filled planar mesh with 4 vertices";
+	ot->idname = "MESH_OT_primitive_plane_add";
 	
 	/* api callbacks */
-	ot->invoke= ED_object_add_generic_invoke;
-	ot->exec= add_primitive_plane_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->invoke = ED_object_add_generic_invoke;
+	ot->exec = add_primitive_plane_exec;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	ED_object_add_generic_props(ot, TRUE);
 }
 
 static int add_primitive_cube_exec(bContext *C, wmOperator *op)
 {
+	Object *obedit;
+	Mesh *me;
+	BMEditMesh *em;
+	float loc[3], rot[3], mat[4][4], dia;
 	int enter_editmode;
+	int state;
 	unsigned int layer;
-	float loc[3], rot[3];
 	
-	if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer))
+	ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
+	make_prim_init(C, "Cube", &dia, mat, &state, loc, rot, layer);
+
+	obedit = CTX_data_edit_object(C);
+	me = obedit->data;
+	em = me->edit_btmesh;
+
+	if (!EDBM_op_call_and_selectf(em, op, "vertout", "create_cube mat=%m4 size=%f", mat, dia * 2.0f)) {
 		return OPERATOR_CANCELLED;
+	}
+	
+	/* BMESH_TODO make plane side this: M_SQRT2 - plane (diameter of 1.41 makes it unit size) */
+	make_prim_finish(C, &state, enter_editmode);
 
-	/* sqrt(2.0f) - plane (diameter of 1.41 makes it unit size) */
-	make_prim_ext(C, loc, rot, enter_editmode, layer,
-			PRIM_CUBE, 4, 0, 0, sqrt(2.0f), 2.0f, 1, 1);
 	return OPERATOR_FINISHED;
 }
 
 void MESH_OT_primitive_cube_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Cube";
-	ot->description= "Construct a cube mesh";
-	ot->idname= "MESH_OT_primitive_cube_add";
+	ot->name = "Add Cube";
+	ot->description = "Construct a cube mesh";
+	ot->idname = "MESH_OT_primitive_cube_add";
 	
 	/* api callbacks */
-	ot->invoke= ED_object_add_generic_invoke;
-	ot->exec= add_primitive_cube_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->invoke = ED_object_add_generic_invoke;
+	ot->exec = add_primitive_cube_exec;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	ED_object_add_generic_props(ot, TRUE);
 }
 
+static const EnumPropertyItem fill_type_items[] = {
+	{0, "NOTHING", 0, "Nothing", "Don't fill at all"},
+	{1, "NGON", 0, "Ngon", "Use ngons"},
+	{2, "TRIFAN", 0, "Triangle Fan", "Use triangle fans"},
+	{0, NULL, 0, NULL, NULL}};
+
 static int add_primitive_circle_exec(bContext *C, wmOperator *op)
 {
+	Object *obedit;
+	Mesh *me;
+	BMEditMesh *em;
+	float loc[3], rot[3], mat[4][4], dia;
 	int enter_editmode;
+	int state, cap_end, cap_tri;
 	unsigned int layer;
-	float loc[3], rot[3];
 	
-	if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer))
-		return OPERATOR_CANCELLED;
+	cap_end = RNA_enum_get(op->ptr, "fill_type");
+	cap_tri = (cap_end == 2);
+	
+	ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
+	make_prim_init(C, "Circle", &dia, mat, &state, loc, rot, layer);
 
-	make_prim_ext(C, loc, rot, enter_editmode, layer,
-			PRIM_CIRCLE, RNA_int_get(op->ptr, "vertices"), 0, 0,
-			RNA_float_get(op->ptr,"radius"), 0.0f, 0,
-			RNA_boolean_get(op->ptr, "fill"));
+	obedit = CTX_data_edit_object(C);
+	me = obedit->data;
+	em = me->edit_btmesh;
 
-	return OPERATOR_FINISHED;	
+	if (!EDBM_op_call_and_selectf(em, op, "vertout",
+	                              "create_circle segments=%i diameter=%f cap_ends=%b cap_tris=%b mat=%m4",
+	                              RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius"),
+	                              cap_end, cap_tri, mat))
+	{
+		return OPERATOR_CANCELLED;
+	}
+	
+	make_prim_finish(C, &state, enter_editmode);
+	
+	return OPERATOR_FINISHED;
 }
 
 void MESH_OT_primitive_circle_add(wmOperatorType *ot)
@@ -1486,42 +257,61 @@ void MESH_OT_primitive_circle_add(wmOperatorType *ot)
 	PropertyRNA *prop;
 
 	/* identifiers */
-	ot->name= "Add Circle";
-	ot->description= "Construct a circle mesh";
-	ot->idname= "MESH_OT_primitive_circle_add";
+	ot->name = "Add Circle";
+	ot->description = "Construct a circle mesh";
+	ot->idname = "MESH_OT_primitive_circle_add";
 	
 	/* api callbacks */
-	ot->invoke= ED_object_add_generic_invoke;
-	ot->exec= add_primitive_circle_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->invoke = ED_object_add_generic_invoke;
+	ot->exec = add_primitive_circle_exec;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* props */
 	RNA_def_int(ot->srna, "vertices", 32, 3, INT_MAX, "Vertices", "", 3, 500);
 	prop = RNA_def_float(ot->srna, "radius", 1.0f, 0.0, FLT_MAX, "Radius", "", 0.001, 100.00);
 	RNA_def_property_subtype(prop, PROP_DISTANCE);
-	RNA_def_boolean(ot->srna, "fill", 0, "Fill", "");
+	RNA_def_enum(ot->srna, "fill_type", fill_type_items, 0, "Fill Type", "");
 
 	ED_object_add_generic_props(ot, TRUE);
 }
 
 static int add_primitive_cylinder_exec(bContext *C, wmOperator *op)
 {
+	Object *obedit;
+	Mesh *me;
+	BMEditMesh *em;
+	float loc[3], rot[3], mat[4][4], dia;
 	int enter_editmode;
+	int state, cap_end, cap_tri;
 	unsigned int layer;
-	float loc[3], rot[3];
 	
-	if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer))
+	cap_end = RNA_enum_get(op->ptr, "end_fill_type");
+	cap_tri = (cap_end == 2);
+	
+	ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
+	make_prim_init(C, "Cylinder", &dia, mat, &state, loc, rot, layer);
+
+	obedit = CTX_data_edit_object(C);
+	me = obedit->data;
+	em = me->edit_btmesh;
+
+	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",
+	        RNA_int_get(op->ptr, "vertices"),
+	        RNA_float_get(op->ptr, "radius"),
+	        RNA_float_get(op->ptr, "radius"),
+	        cap_end, cap_tri,
+	        RNA_float_get(op->ptr, "depth"), mat))
+	{
 		return OPERATOR_CANCELLED;
-
-	make_prim_ext(C, loc, rot, enter_editmode, layer,
-			PRIM_CYLINDER, RNA_int_get(op->ptr, "vertices"), 0, 0,
-			RNA_float_get(op->ptr,"radius"),
-			RNA_float_get(op->ptr, "depth"), 1, 
-			RNA_boolean_get(op->ptr, "cap_ends"));
-
+	}
+	
+	make_prim_finish(C, &state, enter_editmode);
+	
 	return OPERATOR_FINISHED;
 }
 
@@ -1530,42 +320,59 @@ void MESH_OT_primitive_cylinder_add(wmOperatorType *ot)
 	PropertyRNA *prop;
 
 	/* identifiers */
-	ot->name= "Add Cylinder";
-	ot->description= "Construct a cylinder mesh";
-	ot->idname= "MESH_OT_primitive_cylinder_add";
+	ot->name = "Add Cylinder";
+	ot->description = "Construct a cylinder mesh";
+	ot->idname = "MESH_OT_primitive_cylinder_add";
 	
 	/* api callbacks */
-	ot->invoke= ED_object_add_generic_invoke;
-	ot->exec= add_primitive_cylinder_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->invoke = ED_object_add_generic_invoke;
+	ot->exec = add_primitive_cylinder_exec;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* props */
-	RNA_def_int(ot->srna, "vertices", 32, 2, INT_MAX, "Vertices", "", 2, 500);
+	RNA_def_int(ot->srna, "vertices", 32, 3, INT_MAX, "Vertices", "", 3, 500);
 	prop = RNA_def_float(ot->srna, "radius", 1.0f, 0.0, FLT_MAX, "Radius", "", 0.001, 100.00);
 	RNA_def_property_subtype(prop, PROP_DISTANCE);
 	prop = RNA_def_float(ot->srna, "depth", 2.0f, 0.0, FLT_MAX, "Depth", "", 0.001, 100.00);
 	RNA_def_property_subtype(prop, PROP_DISTANCE);
-	RNA_def_boolean(ot->srna, "cap_ends", 1, "Cap Ends", "");
+	RNA_def_enum(ot->srna, "end_fill_type", fill_type_items, 1, "Cap Fill Type", "");
 
 	ED_object_add_generic_props(ot, TRUE);
 }
 
 static int add_primitive_cone_exec(bContext *C, wmOperator *op)
 {
+	Object *obedit;
+	Mesh *me;
+	BMEditMesh *em;
+	float loc[3], rot[3], mat[4][4], dia;
 	int enter_editmode;
+	int state, cap_end, cap_tri;
 	unsigned int layer;
-	float loc[3], rot[3];
 	
-	if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer))
-		return OPERATOR_CANCELLED;
+	cap_end = RNA_enum_get(op->ptr, "end_fill_type");
+	cap_tri = (cap_end == 2);
+	
+	ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
+	make_prim_init(C, "Cone", &dia, mat, &state, loc, rot, layer);
 
-	make_prim_ext(C, loc, rot, enter_editmode, layer,
-			PRIM_CONE, RNA_int_get(op->ptr, "vertices"), 0, 0,
-			RNA_float_get(op->ptr,"radius"), RNA_float_get(op->ptr, "depth"),
-			0, RNA_boolean_get(op->ptr, "cap_end"));
+	obedit = CTX_data_edit_object(C);
+	me = obedit->data;
+	em = me->edit_btmesh;
+
+	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",
+	        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))
+	{
+		return OPERATOR_CANCELLED;
+	}
+	
+	make_prim_finish(C, &state, enter_editmode);
 
 	return OPERATOR_FINISHED;
 }
@@ -1575,43 +382,58 @@ void MESH_OT_primitive_cone_add(wmOperatorType *ot)
 	PropertyRNA *prop;
 
 	/* identifiers */
-	ot->name= "Add Cone";
-	ot->description= "Construct a conic mesh (ends filled)";
-	ot->idname= "MESH_OT_primitive_cone_add";
+	ot->name = "Add Cone";
+	ot->description = "Construct a conic mesh";
+	ot->idname = "MESH_OT_primitive_cone_add";
 	
 	/* api callbacks */
-	ot->invoke= ED_object_add_generic_invoke;
-	ot->exec= add_primitive_cone_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->invoke = ED_object_add_generic_invoke;
+	ot->exec = add_primitive_cone_exec;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* props */
-	RNA_def_int(ot->srna, "vertices", 32, 2, INT_MAX, "Vertices", "", 2, 500);
-	prop = RNA_def_float(ot->srna, "radius", 1.0f, 0.0, FLT_MAX, "Radius", "", 0.001, 100.00);
+	RNA_def_int(ot->srna, "vertices", 32, 3, INT_MAX, "Vertices", "", 3, 500);
+	prop = RNA_def_float(ot->srna, "radius1", 1.0f, 0.0, FLT_MAX, "Radius 1", "", 0.001, 100.00);
+	RNA_def_property_subtype(prop, PROP_DISTANCE);
+	prop = RNA_def_float(ot->srna, "radius2", 0.0f, 0.0, FLT_MAX, "Radius 2", "", 0.001, 100.00);
 	RNA_def_property_subtype(prop, PROP_DISTANCE);
 	prop = RNA_def_float(ot->srna, "depth", 2.0f, 0.0, FLT_MAX, "Depth", "", 0.001, 100.00);
 	RNA_def_property_subtype(prop, PROP_DISTANCE);
-	RNA_def_boolean(ot->srna, "cap_end", 1, "Cap End", "");
+	RNA_def_enum(ot->srna, "end_fill_type", fill_type_items, 1, "Base Fill Type", "");
 
 	ED_object_add_generic_props(ot, TRUE);
 }
 
 static int add_primitive_grid_exec(bContext *C, wmOperator *op)
 {
+	Object *obedit;
+	Mesh *me;
+	BMEditMesh *em;
+	float loc[3], rot[3], mat[4][4], dia;
 	int enter_editmode;
+	int state;
 	unsigned int layer;
-	float loc[3], rot[3];
 	
-	if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer))
-		return OPERATOR_CANCELLED;
+	ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
+	make_prim_init(C, "Grid", &dia, mat, &state, loc, rot, layer);
 
-	make_prim_ext(C, loc, rot, enter_editmode, layer,
-			PRIM_GRID, RNA_int_get(op->ptr, "x_subdivisions"),
-			RNA_int_get(op->ptr, "y_subdivisions"), 0,
-			RNA_float_get(op->ptr,"size"), 0.0f, 0, 1);
+	obedit = CTX_data_edit_object(C);
+	me = obedit->data;
+	em = me->edit_btmesh;
 
+	if (!EDBM_op_call_and_selectf(em, op, "vertout",
+	                              "create_grid xsegments=%i ysegments=%i size=%f mat=%m4",
+	                              RNA_int_get(op->ptr, "x_subdivisions"),
+	                              RNA_int_get(op->ptr, "y_subdivisions"),
+	                              RNA_float_get(op->ptr, "size") * dia, mat))
+	{
+		return OPERATOR_CANCELLED;
+	}
+	
+	make_prim_finish(C, &state, enter_editmode);
 	return OPERATOR_FINISHED;
 }
 
@@ -1620,17 +442,17 @@ void MESH_OT_primitive_grid_add(wmOperatorType *ot)
 	PropertyRNA *prop;
 
 	/* identifiers */
-	ot->name= "Add Grid";
-	ot->description= "Construct a grid mesh";
-	ot->idname= "MESH_OT_primitive_grid_add";
+	ot->name = "Add Grid";
+	ot->description = "Construct a grid mesh";
+	ot->idname = "MESH_OT_primitive_grid_add";
 	
 	/* api callbacks */
-	ot->invoke= ED_object_add_generic_invoke;
-	ot->exec= add_primitive_grid_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->invoke = ED_object_add_generic_invoke;
+	ot->exec = add_primitive_grid_exec;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* props */
 	RNA_def_int(ot->srna, "x_subdivisions", 10, 3, INT_MAX, "X Subdivisions", "", 3, 1000);
@@ -1643,50 +465,76 @@ void MESH_OT_primitive_grid_add(wmOperatorType *ot)
 
 static int add_primitive_monkey_exec(bContext *C, wmOperator *op)
 {
+	Object *obedit;
+	Mesh *me;
+	BMEditMesh *em;
+	float loc[3], rot[3], mat[4][4], dia;
 	int enter_editmode;
+	int state, view_aligned;
 	unsigned int layer;
-	float loc[3], rot[3];
 	
-	if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer))
-		return OPERATOR_CANCELLED;
+	ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, &view_aligned);
+	if (!view_aligned)
+		rot[0] += M_PI / 2.0f;
+	
+	make_prim_init(C, "Monkey", &dia, mat, &state, loc, rot, layer);
 
-	make_prim_ext(C, loc, rot, enter_editmode, layer,
-			PRIM_MONKEY, 0, 0, 2, 0.0f, 0.0f, 0, 0);
+	obedit = CTX_data_edit_object(C);
+	me = obedit->data;
+	em = me->edit_btmesh;
 
+	if (!EDBM_op_call_and_selectf(em, op, "vertout", "create_monkey mat=%m4", mat)) {
+		return OPERATOR_CANCELLED;
+	}
+	
+	make_prim_finish(C, &state, enter_editmode);
 	return OPERATOR_FINISHED;
 }
 
 void MESH_OT_primitive_monkey_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Monkey";
-	ot->description= "Construct a Suzanne mesh";
-	ot->idname= "MESH_OT_primitive_monkey_add";
+	ot->name = "Add Monkey";
+	ot->description = "Construct a Suzanne mesh";
+	ot->idname = "MESH_OT_primitive_monkey_add";
 	
 	/* api callbacks */
-	ot->invoke= ED_object_add_generic_invoke;
-	ot->exec= add_primitive_monkey_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->invoke = ED_object_add_generic_invoke;
+	ot->exec = add_primitive_monkey_exec;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	ED_object_add_generic_props(ot, TRUE);
 }
 
 static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op)
 {
+	Object *obedit;
+	Mesh *me;
+	BMEditMesh *em;
+	float loc[3], rot[3], mat[4][4], dia;
 	int enter_editmode;
+	int state;
 	unsigned int layer;
-	float loc[3], rot[3];
 	
-	if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer))
-		return OPERATOR_CANCELLED;
+	ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
+	make_prim_init(C, "Sphere", &dia, mat, &state, loc, rot, layer);
+
+	obedit = CTX_data_edit_object(C);
+	me = obedit->data;
+	em = me->edit_btmesh;
 
-	make_prim_ext(C, loc, rot, enter_editmode, layer,
-			PRIM_UVSPHERE, RNA_int_get(op->ptr, "ring_count"),
-			RNA_int_get(op->ptr, "segments"), 0,
-			RNA_float_get(op->ptr,"size"), 0.0f, 0, 0);
+	if (!EDBM_op_call_and_selectf(em, op, "vertout",
+	                              "create_uvsphere segments=%i revolutions=%i diameter=%f mat=%m4",
+	                              RNA_int_get(op->ptr, "segments"), RNA_int_get(op->ptr, "ring_count"),
+	                              RNA_float_get(op->ptr, "size"), mat))
+	{
+		return OPERATOR_CANCELLED;
+	}
+	
+	make_prim_finish(C, &state, enter_editmode);
 
 	return OPERATOR_FINISHED;	
 }
@@ -1696,17 +544,17 @@ void MESH_OT_primitive_uv_sphere_add(wmOperatorType *ot)
 	PropertyRNA *prop;
 
 	/* identifiers */
-	ot->name= "Add UV Sphere";
-	ot->description= "Construct a UV sphere mesh";
-	ot->idname= "MESH_OT_primitive_uv_sphere_add";
+	ot->name = "Add UV Sphere";
+	ot->description = "Construct a UV sphere mesh";
+	ot->idname = "MESH_OT_primitive_uv_sphere_add";
 	
 	/* api callbacks */
-	ot->invoke= ED_object_add_generic_invoke;
-	ot->exec= add_primitive_uvsphere_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->invoke = ED_object_add_generic_invoke;
+	ot->exec = add_primitive_uvsphere_exec;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* props */
 	RNA_def_int(ot->srna, "segments", 32, 3, INT_MAX, "Segments", "", 3, 500);
@@ -1719,16 +567,31 @@ void MESH_OT_primitive_uv_sphere_add(wmOperatorType *ot)
 
 static int add_primitive_icosphere_exec(bContext *C, wmOperator *op)
 {
+	Object *obedit;
+	Mesh *me;
+	BMEditMesh *em;
+	float loc[3], rot[3], mat[4][4], dia;
 	int enter_editmode;
+	int state;
 	unsigned int layer;
-	float loc[3], rot[3];
 	
-	if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer))
-		return OPERATOR_CANCELLED;
+	ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL);
+	make_prim_init(C, "Icosphere", &dia, mat, &state, loc, rot, layer);
 
-	make_prim_ext(C, loc, rot, enter_editmode, layer,
-			PRIM_ICOSPHERE, 0, 0, RNA_int_get(op->ptr, "subdivisions"),
-			RNA_float_get(op->ptr,"size"), 0.0f, 0, 0);
+	obedit = CTX_data_edit_object(C);
+	me = obedit->data;
+	em = me->edit_btmesh;
+
+	if (!EDBM_op_call_and_selectf(
+	        em, op, "vertout",
+	        "create_icosphere subdivisions=%i diameter=%f mat=%m4",
+	        RNA_int_get(op->ptr, "subdivisions"),
+	        RNA_float_get(op->ptr, "size"), mat))
+	{
+		return OPERATOR_CANCELLED;
+	}
+	
+	make_prim_finish(C, &state, enter_editmode);
 
 	return OPERATOR_FINISHED;	
 }
@@ -1738,17 +601,17 @@ void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot)
 	PropertyRNA *prop;
 
 	/* identifiers */
-	ot->name= "Add Ico Sphere";
-	ot->description= "Construct an Icosphere mesh";
-	ot->idname= "MESH_OT_primitive_ico_sphere_add";
+	ot->name = "Add Ico Sphere";
+	ot->description = "Construct an Icosphere mesh";
+	ot->idname = "MESH_OT_primitive_ico_sphere_add";
 	
 	/* api callbacks */
-	ot->invoke= ED_object_add_generic_invoke;
-	ot->exec= add_primitive_icosphere_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->invoke = ED_object_add_generic_invoke;
+	ot->exec = add_primitive_icosphere_exec;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* props */
 	RNA_def_int(ot->srna, "subdivisions", 2, 1, INT_MAX, "Subdivisions", "", 1, 8);
@@ -1757,47 +620,3 @@ void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot)
 
 	ED_object_add_generic_props(ot, TRUE);
 }
-
-/****************** add duplicate operator ***************/
-
-static int mesh_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
-{
-	Object *ob= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(ob->data);
-
-	adduplicateflag(em, SELECT);
-
-	BKE_mesh_end_editmesh(ob->data, em);
-
-	DAG_id_tag_update(ob->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, ob->data);
-	
-	return OPERATOR_FINISHED;
-}
-
-static int mesh_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
-{
-	WM_cursor_wait(1);
-	mesh_duplicate_exec(C, op);
-	WM_cursor_wait(0);
-	
-	return OPERATOR_FINISHED;
-}
-
-void MESH_OT_duplicate(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Duplicate Mesh";
-	ot->description= "Duplicate selected vertices, edges or faces";
-	ot->idname= "MESH_OT_duplicate";
-	
-	/* api callbacks */
-	ot->invoke= mesh_duplicate_invoke;
-	ot->exec= mesh_duplicate_exec;
-	
-	ot->poll= ED_operator_editmesh;
-	
-	/* to give to transform */
-	RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
-}
-
diff --git a/source/blender/editors/mesh/editmesh_bvh.c b/source/blender/editors/mesh/editmesh_bvh.c
new file mode 100644
index 0000000..6155ad1
--- /dev/null
+++ b/source/blender/editors/mesh/editmesh_bvh.c
@@ -0,0 +1,452 @@
+/*
+ * ***** 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) 2010 by Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Joseph Eagar
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/editors/mesh/editmesh_bvh.c
+ *  \ingroup edmesh
+ */
+
+#define IN_EDITMESHBVH
+
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_scene_types.h"
+#include "DNA_object_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_view3d_types.h"
+
+
+#include "BLI_math.h"
+#include "BLI_smallhash.h"
+
+#include "BKE_DerivedMesh.h"
+#include "BKE_tessmesh.h"
+
+#include "ED_mesh.h"
+#include "ED_view3d.h"
+
+
+typedef struct BMBVHTree {
+	BMEditMesh *em;
+	BMesh *bm;
+	BVHTree *tree;
+	float epsilon;
+	float maxdist; //for nearest point search
+	float uv[2];
+	
+	/* stuff for topological vert search */
+	BMVert *v, *curv;
+	GHash *gh;
+	float curw, curd;
+	float co[3], (*cagecos)[3], (*cos)[3];
+	int curtag, flag;
+	
+	Object *ob;
+	Scene *scene;
+} BMBVHTree;
+
+static void cage_mapped_verts_callback(void *userData, int index, const float co[3],
+                                       const float UNUSED(no_f[3]), const short UNUSED(no_s[3]))
+{
+	void **data = userData;
+	BMEditMesh *em = data[0];
+	float (*cagecos)[3] = data[1];
+	SmallHash *hash = data[2];
+	
+	if (index >= 0 && index < em->bm->totvert && !BLI_smallhash_haskey(hash, index)) {
+		BLI_smallhash_insert(hash, index, NULL);
+		copy_v3_v3(cagecos[index], co);
+	}
+}
+
+BMBVHTree *BMBVH_NewBVH(BMEditMesh *em, int flag, Scene *scene, Object *obedit)
+{
+	BMBVHTree *tree = MEM_callocN(sizeof(*tree), "BMBVHTree");
+	DerivedMesh *cage, *final;
+	SmallHash shash;
+	float cos[3][3], (*cagecos)[3] = NULL;
+	int i;
+	int tottri;
+
+	/* when initializing cage verts, we only want the first cage coordinate for each vertex,
+	 * so that e.g. mirror or array use original vertex coordinates and not mirrored or duplicate */
+	BLI_smallhash_init(&shash);
+	
+	BMEdit_RecalcTessellation(em);
+
+	tree->ob = obedit;
+	tree->scene = scene;
+	tree->em = em;
+	tree->bm = em->bm;
+	tree->epsilon = FLT_EPSILON * 2.0f;
+	tree->flag = flag;
+
+	if (flag & (BMBVH_RESPECT_SELECT)) {
+		tottri = 0;
+		for (i = 0; i < em->tottri; i++) {
+			if (BM_elem_flag_test(em->looptris[i][0]->f, BM_ELEM_SELECT)) {
+				tottri++;
+			}
+		}
+	}
+	else if (flag & (BMBVH_RESPECT_HIDDEN)) {
+		tottri = 0;
+		for (i = 0; i < em->tottri; i++) {
+			if (!BM_elem_flag_test(em->looptris[i][0]->f, BM_ELEM_HIDDEN)) {
+				tottri++;
+			}
+		}
+	}
+	else {
+		tottri = em->tottri;
+	}
+
+	tree->tree = BLI_bvhtree_new(tottri, tree->epsilon, 8, 8);
+	
+	if (flag & BMBVH_USE_CAGE) {
+		BMIter iter;
+		BMVert *v;
+		void *data[3];
+		
+		tree->cos = MEM_callocN(sizeof(float) * 3 * em->bm->totvert, "bmbvh cos");
+		BM_ITER_MESH_INDEX (v, &iter, em->bm, BM_VERTS_OF_MESH, i) {
+			BM_elem_index_set(v, i); /* set_inline */
+			copy_v3_v3(tree->cos[i], v->co);
+		}
+		em->bm->elem_index_dirty &= ~BM_VERT;
+
+
+		cage = editbmesh_get_derived_cage_and_final(scene, obedit, em, &final, CD_MASK_DERIVEDMESH);
+		cagecos = MEM_callocN(sizeof(float) * 3 * em->bm->totvert, "bmbvh cagecos");
+		
+		data[0] = em;
+		data[1] = cagecos;
+		data[2] = &shash;
+		
+		cage->foreachMappedVert(cage, cage_mapped_verts_callback, data);
+	}
+	
+	tree->cagecos = cagecos;
+	
+	for (i = 0; i < em->tottri; i++) {
+
+
+		if (flag & BMBVH_RESPECT_SELECT) {
+			/* note, the arrays wont allign 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 */
+			if (BM_elem_flag_test(em->looptris[i][0]->f, BM_ELEM_HIDDEN)) {
+				continue;
+			}
+		}
+
+		if (flag & BMBVH_USE_CAGE) {
+			copy_v3_v3(cos[0], cagecos[BM_elem_index_get(em->looptris[i][0]->v)]);
+			copy_v3_v3(cos[1], cagecos[BM_elem_index_get(em->looptris[i][1]->v)]);
+			copy_v3_v3(cos[2], cagecos[BM_elem_index_get(em->looptris[i][2]->v)]);
+		}
+		else {
+			copy_v3_v3(cos[0], em->looptris[i][0]->v->co);
+			copy_v3_v3(cos[1], em->looptris[i][1]->v->co);
+			copy_v3_v3(cos[2], em->looptris[i][2]->v->co);
+		}
+
+		BLI_bvhtree_insert(tree->tree, i, (float *)cos, 3);
+	}
+	
+	BLI_bvhtree_balance(tree->tree);
+	BLI_smallhash_release(&shash);
+	
+	return tree;
+}
+
+void BMBVH_FreeBVH(BMBVHTree *tree)
+{
+	BLI_bvhtree_free(tree->tree);
+	
+	if (tree->cagecos)
+		MEM_freeN(tree->cagecos);
+	if (tree->cos)
+		MEM_freeN(tree->cos);
+	
+	MEM_freeN(tree);
+}
+
+/* taken from bvhutils.c */
+static float ray_tri_intersection(const BVHTreeRay *ray, const float UNUSED(m_dist), float *v0, 
+                                  float *v1, float *v2, float *uv, float UNUSED(e))
+{
+	float dist;
+
+	if (isect_ray_tri_v3((float *)ray->origin, (float *)ray->direction, v0, v1, v2, &dist, uv)) {
+		return dist;
+	}
+
+	return FLT_MAX;
+}
+
+static void raycallback(void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit)
+{
+	BMBVHTree *tree = userdata;
+	BMLoop **ls = tree->em->looptris[index];
+	float dist, uv[2];
+	 
+	if (!ls[0] || !ls[1] || !ls[2])
+		return;
+	
+	dist = ray_tri_intersection(ray, hit->dist, ls[0]->v->co, ls[1]->v->co,
+	                            ls[2]->v->co, uv, tree->epsilon);
+	if (dist < hit->dist) {
+		hit->dist = dist;
+		hit->index = index;
+		
+		copy_v3_v3(hit->no, ls[0]->v->no);
+
+		copy_v3_v3(hit->co, ray->direction);
+		normalize_v3(hit->co);
+		mul_v3_fl(hit->co, dist);
+		add_v3_v3(hit->co, ray->origin);
+		
+		copy_v2_v2(tree->uv, uv);
+	}
+}
+
+BMFace *BMBVH_RayCast(BMBVHTree *tree, float *co, float *dir, float *hitout, float *cagehit)
+{
+	BVHTreeRayHit hit;
+
+	hit.dist = FLT_MAX;
+	hit.index = -1;
+	
+	tree->uv[0] = tree->uv[1] = 0.0f;
+	
+	BLI_bvhtree_ray_cast(tree->tree, co, dir, 0.0f, &hit, raycallback, tree);
+	if (hit.dist != FLT_MAX && hit.index != -1) {
+		if (hitout) {
+			if (tree->flag & BMBVH_RETURN_ORIG) {
+				BMVert *v1, *v2, *v3;
+				float co[3];
+				int i;
+				
+				v1 = tree->em->looptris[hit.index][0]->v;
+				v2 = tree->em->looptris[hit.index][1]->v;
+				v3 = tree->em->looptris[hit.index][2]->v;
+				
+				for (i = 0; i < 3; i++) {
+					co[i] = v1->co[i] + ((v2->co[i] - v1->co[i]) * tree->uv[0]) +
+					                    ((v3->co[i] - v1->co[i]) * tree->uv[1]);
+				}
+				copy_v3_v3(hitout, co);
+			}
+			else {
+				copy_v3_v3(hitout, hit.co);
+			}
+
+			if (cagehit)
+				copy_v3_v3(cagehit, hit.co);
+		}
+
+		return tree->em->looptris[hit.index][0]->f;
+	}
+
+	return NULL;
+}
+
+BVHTree *BMBVH_BVHTree(BMBVHTree *tree)
+{
+	return tree->tree;
+}
+
+static void vertsearchcallback(void *userdata, int index, const float *UNUSED(co), BVHTreeNearest *hit)
+{
+	BMBVHTree *tree = userdata;
+	BMLoop **ls = tree->em->looptris[index];
+	float dist, maxdist, v[3];
+	int i;
+
+	maxdist = tree->maxdist;
+
+	for (i = 0; i < 3; i++) {
+		sub_v3_v3v3(v, hit->co, ls[i]->v->co);
+
+		dist = len_v3(v);
+		if (dist < hit->dist && dist < maxdist) {
+			copy_v3_v3(hit->co, ls[i]->v->co);
+			copy_v3_v3(hit->no, ls[i]->v->no);
+			hit->dist = dist;
+			hit->index = index;
+		}
+	}
+}
+
+BMVert *BMBVH_FindClosestVert(BMBVHTree *tree, float *co, float maxdist)
+{
+	BVHTreeNearest hit;
+
+	copy_v3_v3(hit.co, co);
+	hit.dist = maxdist * 5;
+	hit.index = -1;
+
+	tree->maxdist = maxdist;
+
+	BLI_bvhtree_find_nearest(tree->tree, co, &hit, vertsearchcallback, tree);
+	if (hit.dist != FLT_MAX && hit.index != -1) {
+		BMLoop **ls = tree->em->looptris[hit.index];
+		float dist, curdist = tree->maxdist, v[3];
+		int cur = 0, i;
+
+		maxdist = tree->maxdist;
+
+		for (i = 0; i < 3; i++) {
+			sub_v3_v3v3(v, hit.co, ls[i]->v->co);
+
+			dist = len_v3(v);
+			if (dist < curdist) {
+				cur = i;
+				curdist = dist;
+			}
+		}
+
+		return ls[cur]->v;
+	}
+
+	return NULL;
+}
+
+/* UNUSED */
+#if 0
+static short winding(float *v1, float *v2, float *v3)
+/* is v3 to the right of (v1 - v2) ? With exception: v3 == v1 || v3 == v2 */
+{
+	double inp;
+
+	//inp = (v2[cox] - v1[cox]) * (v1[coy] - v3[coy]) + (v1[coy] - v2[coy]) * (v1[cox] - v3[cox]);
+	inp = (v2[0] - v1[0]) * (v1[1] - v3[1]) + (v1[1] - v2[1]) * (v1[0] - v3[0]);
+
+	if (inp < 0.0) {
+		return 0;
+	}
+	else if (inp == 0) {
+		if (v1[0] == v3[0] && v1[1] == v3[1]) return 0;
+		if (v2[0] == v3[0] && v2[1] == v3[1]) return 0;
+	}
+	return 1;
+}
+#endif
+
+#if 0 //BMESH_TODO: not implemented yet
+int BMBVH_VertVisible(BMBVHTree *tree, BMEdge *e, RegionView3D *r3d)
+{
+
+}
+#endif
+
+static BMFace *edge_ray_cast(BMBVHTree *tree, float *co, float *dir, float *hitout, BMEdge *e)
+{
+	BMFace *f = BMBVH_RayCast(tree, co, dir, hitout, NULL);
+	
+	if (f && BM_edge_in_face(f, e))
+		return NULL;
+
+	return f;
+}
+
+static void scale_point(float *c1, float *p, float s)
+{
+	sub_v3_v3(c1, p);
+	mul_v3_fl(c1, s);
+	add_v3_v3(c1, p);
+}
+
+
+int BMBVH_EdgeVisible(BMBVHTree *tree, BMEdge *e, ARegion *ar, View3D *v3d, Object *obedit)
+{
+	BMFace *f;
+	float co1[3], co2[3], co3[3], dir1[4], dir2[4], dir3[4];
+	float origin[3], invmat[4][4];
+	float epsilon = 0.01f; 
+	float mval_f[2], end[3];
+	
+	if (!ar) {
+		printf("error in BMBVH_EdgeVisible!\n");
+		return 0;
+	}
+	
+	mval_f[0] = ar->winx / 2.0f;
+	mval_f[1] = ar->winy / 2.0f;
+	ED_view3d_win_to_segment_clip(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);
+	copy_v3_v3(co3, e->v2->co);
+	
+	scale_point(co1, co2, 0.99);
+	scale_point(co3, co2, 0.99);
+	
+	/* ok, idea is to generate rays going from the camera origin to the 
+	 * three points on the edge (v1, mid, v2)*/
+	sub_v3_v3v3(dir1, origin, co1);
+	sub_v3_v3v3(dir2, origin, co2);
+	sub_v3_v3v3(dir3, origin, co3);
+	
+	normalize_v3(dir1);
+	normalize_v3(dir2);
+	normalize_v3(dir3);
+
+	mul_v3_fl(dir1, epsilon);
+	mul_v3_fl(dir2, epsilon);
+	mul_v3_fl(dir3, epsilon);
+	
+	/* offset coordinates slightly along view vectors, to avoid
+	 * hitting the faces that own the edge.*/
+	add_v3_v3v3(co1, co1, dir1);
+	add_v3_v3v3(co2, co2, dir2);
+	add_v3_v3v3(co3, co3, dir3);
+
+	normalize_v3(dir1);
+	normalize_v3(dir2);
+	normalize_v3(dir3);
+
+	/* do three samplings: left, middle, right */
+	f = edge_ray_cast(tree, co1, dir1, NULL, e);
+	if (f && !edge_ray_cast(tree, co2, dir2, NULL, e))
+		return 1;
+	else if (f && !edge_ray_cast(tree, co3, dir3, NULL, e))
+		return 1;
+	else if (!f)
+		return 1;
+
+	return 0;
+}
diff --git a/source/blender/editors/mesh/editmesh_bvh.h b/source/blender/editors/mesh/editmesh_bvh.h
new file mode 100644
index 0000000..e2b4506
--- /dev/null
+++ b/source/blender/editors/mesh/editmesh_bvh.h
@@ -0,0 +1,71 @@
+/*
+ * ***** 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 blender/editors/mesh/editmesh_bvh.h
+ *  \ingroup edmesh
+ */
+
+#ifndef __EDITBMESH_BVH_H__
+#define __EDITBMESH_BVH_H__
+
+struct BMEditMesh;
+struct BMFace;
+struct BMEdge;
+struct BMVert;
+struct RegionView3D;
+struct BMBVHTree;
+struct BVHTree;
+struct Scene;
+struct Object;
+
+#ifndef IN_EDITMESHBVH
+typedef struct BMBVHTree BMBVHTree;
+#endif
+
+struct BMBVHTree *BMBVH_NewBVH(struct BMEditMesh *em, int flag, struct Scene *scene, struct Object *obedit);
+void BMBVH_FreeBVH(struct BMBVHTree *tree);
+struct BVHTree *BMBVH_BVHTree(struct BMBVHTree *tree);
+
+struct BMFace *BMBVH_RayCast(struct BMBVHTree *tree, float *co, float *dir, float *hitout, float *cagehit);
+
+int BMBVH_EdgeVisible(struct BMBVHTree *tree, struct BMEdge *e, 
+                      struct ARegion *ar, struct View3D *v3d, struct Object *obedit);
+
+#define BM_SEARCH_MAXDIST	0.4f
+
+/*find a vert closest to co in a sphere of radius maxdist*/
+struct BMVert *BMBVH_FindClosestVert(struct BMBVHTree *tree, float *co, float maxdist);
+                                         
+/* BMBVH_NewBVH flag parameter */
+enum {
+	BMBVH_USE_CAGE        = 1, /* project geometry onto modifier cage */
+	BMBVH_RETURN_ORIG     = 2, /* use with BMBVH_USE_CAGE, returns hits in relation to original geometry */
+	BMBVH_RESPECT_SELECT  = 4, /* restrict to hidden geometry (overrides BMBVH_RESPECT_HIDDEN) */
+	BMBVH_RESPECT_HIDDEN  = 8  /* omit hidden geometry */
+};
+
+#endif /* __EDITBMESH_BVH_H__ */
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
new file mode 100644
index 0000000..b3bc0a1
--- /dev/null
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -0,0 +1,3089 @@
+/*
+ * ***** 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) 2007 Blender Foundation.
+ * All rights reserved.
+ *
+ * 
+ * Contributor(s): Joseph Eagar, Joshua Leung, Howard Trickey,
+ *                 Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/editors/mesh/editmesh_knife.c
+ *  \ingroup edmesh
+ */
+
+#define _USE_MATH_DEFINES
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_array.h"
+#include "BLI_math.h"
+#include "BLI_rand.h"
+#include "BLI_smallhash.h"
+#include "BLI_scanfill.h"
+#include "BLI_memarena.h"
+
+#include "BKE_DerivedMesh.h"
+#include "BKE_context.h"
+#include "BKE_depsgraph.h"
+
+#include "BIF_gl.h"
+#include "BIF_glutil.h" /* for paint cursor */
+
+#include "ED_screen.h"
+#include "ED_space_api.h"
+#include "ED_view3d.h"
+#include "ED_mesh.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "DNA_scene_types.h"
+#include "DNA_mesh_types.h"
+#include "DNA_object_types.h"
+#include "BKE_tessmesh.h"
+#include "UI_resources.h"
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+
+#include "mesh_intern.h"
+
+/* this code here is kindof messy. . .I might need to eventually rework it - joeedh */
+
+#define KMAXDIST    10  /* max mouse distance from edge before not detecting it */
+
+typedef struct KnifeColors {
+	unsigned char line[3];
+	unsigned char edge[3];
+	unsigned char curpoint[3];
+	unsigned char curpoint_a[4];
+	unsigned char point[3];
+	unsigned char point_a[4];
+} KnifeColors;
+
+/* knifetool operator */
+typedef struct KnifeVert {
+	BMVert *v; /* non-NULL if this is an original vert */
+	ListBase edges;
+
+	float co[3], cageco[3], sco[3]; /* sco is screen coordinates for cageco */
+	short flag, draw, isface, inspace;
+} KnifeVert;
+
+typedef struct Ref {
+	struct Ref *next, *prev;
+	void *ref;
+} Ref;
+
+typedef struct KnifeEdge {
+	KnifeVert *v1, *v2;
+	BMFace *basef; /* face to restrict face fill to */
+	ListBase faces;
+	int draw;
+
+	BMEdge *e, *oe; /* non-NULL if this is an original edge */
+} KnifeEdge;
+
+typedef struct BMEdgeHit {
+	KnifeEdge *kfe;
+	float hit[3], cagehit[3];
+	float realhit[3]; /* used in midpoint mode */
+	float schit[3];
+	float l; /* lambda along cut line */
+	float perc; /* lambda along hit line */
+	KnifeVert *v; /* set if snapped to a vert */
+	BMFace *f;
+} BMEdgeHit;
+
+typedef struct KnifePosData {
+	float co[3];
+	float cage[3];
+
+	/* At most one of vert, edge, or bmface should be non-NULL,
+	 * saying whether the point is snapped to a vertex, edge, or in a face.
+	 * If none are set, this point is in space and is_space should be true. */
+	KnifeVert *vert;
+	KnifeEdge *edge;
+	BMFace *bmface;
+	int is_space;
+
+	int mval[2]; /* mouse screen position */
+} KnifePosData;
+
+/* struct for properties used while drawing */
+typedef struct KnifeTool_OpData {
+	ARegion *ar;        /* region that knifetool was activated in */
+	void *draw_handle;  /* for drawing preview loop */
+	ViewContext vc;
+	//bContext *C;
+
+	Object *ob;
+	BMEditMesh *em;
+
+	MemArena *arena;
+
+	GHash *origvertmap;
+	GHash *origedgemap;
+
+	GHash *kedgefacemap;
+
+	BMBVHTree *bmbvh;
+
+	BLI_mempool *kverts;
+	BLI_mempool *kedges;
+
+	float vthresh;
+	float ethresh;
+
+	/* used for drag-cutting */
+	BMEdgeHit *linehits;
+	int totlinehit;
+
+	/* Data for mouse-position-derived data (cur) and previous click (prev) */
+	KnifePosData cur, prev;
+
+	int totkedge, totkvert;
+
+	BLI_mempool *refs;
+
+	float projmat[4][4];
+
+	KnifeColors colors;
+
+	/* operatpr options */
+	char cut_through;    /* preference, can be modified at runtime (that feature may go) */
+	char only_select;    /* set on initialization */
+	char select_result;  /* set on initialization */
+
+	short is_ortho;
+	float clipsta, clipend;
+
+	enum {
+		MODE_IDLE,
+		MODE_DRAGGING,
+		MODE_CONNECT,
+		MODE_PANNING
+	} mode;
+
+	int snap_midpoints, prevmode, extend;
+	int ignore_edge_snapping, ignore_vert_snapping;
+
+	enum {
+		ANGLE_FREE,
+		ANGLE_0,
+		ANGLE_45,
+		ANGLE_90,
+		ANGLE_135
+	} angle_snapping;
+
+	float (*cagecos)[3];
+} KnifeTool_OpData;
+
+static ListBase *knife_get_face_kedges(KnifeTool_OpData *kcd, BMFace *f);
+
+static void knife_input_ray_cast(KnifeTool_OpData *kcd, const int mval_i[2],
+                                 float r_origin[3], float r_ray[3]);
+
+static void knife_update_header(bContext *C, KnifeTool_OpData *kcd)
+{
+	#define HEADER_LENGTH 190
+	char header[HEADER_LENGTH];
+
+	BLI_snprintf(header, HEADER_LENGTH, "LMB: define cut lines, Return/Spacebar: confirm, Esc or RMB: cancel, E: new cut, Ctrl: midpoint snap (%s), "
+	             "Shift: ignore snap (%s), C: angle constrain (%s), Z: cut through (%s)",
+	             kcd->snap_midpoints ? "On" : "Off",
+	             kcd->ignore_edge_snapping ?  "On" : "Off",
+	             kcd->angle_snapping ? "On" : "Off",
+	             kcd->cut_through ? "On" : "Off");
+
+	ED_area_headerprint(CTX_wm_area(C), header);
+}
+
+
+static void knife_project_v3(KnifeTool_OpData *kcd, const float co[3], float sco[3])
+{
+	ED_view3d_project_float_v3(kcd->ar, co, sco, kcd->projmat);
+}
+
+static void knife_pos_data_clear(KnifePosData *kpd)
+{
+	zero_v3(kpd->co);
+	zero_v3(kpd->cage);
+	kpd->vert = NULL;
+	kpd->edge = NULL;
+	kpd->bmface = NULL;
+	kpd->mval[0] = 0;
+	kpd->mval[1] = 0;
+}
+
+static ListBase *knife_empty_list(KnifeTool_OpData *kcd)
+{
+	ListBase *lst;
+
+	lst = BLI_memarena_alloc(kcd->arena, sizeof(ListBase));
+	lst->first = lst->last = NULL;
+	return lst;
+}
+
+static void knife_append_list(KnifeTool_OpData *kcd, ListBase *lst, void *elem)
+{
+	Ref *ref;
+
+	ref = BLI_mempool_calloc(kcd->refs);
+	ref->ref = elem;
+	BLI_addtail(lst, ref);
+}
+
+static Ref *find_ref(ListBase *lb, void *ref)
+{
+	Ref *ref1;
+
+	for (ref1 = lb->first; ref1; ref1 = ref1->next) {
+		if (ref1->ref == ref)
+			return ref1;
+	}
+
+	return NULL;
+}
+
+static KnifeEdge *new_knife_edge(KnifeTool_OpData *kcd)
+{
+	kcd->totkedge++;
+	return BLI_mempool_calloc(kcd->kedges);
+}
+
+static void knife_add_to_vert_edges(KnifeTool_OpData *kcd, KnifeEdge *kfe)
+{
+	knife_append_list(kcd, &kfe->v1->edges, kfe);
+	knife_append_list(kcd, &kfe->v2->edges, kfe);
+}
+
+static KnifeVert *new_knife_vert(KnifeTool_OpData *kcd, float *co, float *cageco)
+{
+	KnifeVert *kfv = BLI_mempool_calloc(kcd->kverts);
+
+	kcd->totkvert++;
+
+	copy_v3_v3(kfv->co, co);
+	copy_v3_v3(kfv->cageco, cageco);
+	copy_v3_v3(kfv->sco, co);
+
+	knife_project_v3(kcd, kfv->co, kfv->sco);
+
+	return kfv;
+}
+
+/* get a KnifeVert wrapper for an existing BMVert */
+static KnifeVert *get_bm_knife_vert(KnifeTool_OpData *kcd, BMVert *v)
+{
+	KnifeVert *kfv = BLI_ghash_lookup(kcd->origvertmap, v);
+
+	if (!kfv) {
+		kfv = new_knife_vert(kcd, v->co, kcd->cagecos[BM_elem_index_get(v)]);
+		kfv->v = v;
+		BLI_ghash_insert(kcd->origvertmap, v, kfv);
+	}
+
+	return kfv;
+}
+
+/**
+ * get a KnifeEdge wrapper for an existing BMEdge
+ * \note #knife_get_face_kedges / #get_bm_knife_edge are called recusively - KEEP STACK MEM USAGE LOW */
+static KnifeEdge *get_bm_knife_edge(KnifeTool_OpData *kcd, BMEdge *e)
+{
+	KnifeEdge *kfe = BLI_ghash_lookup(kcd->origedgemap, e);
+	if (!kfe) {
+		BMLoop *l_iter, *l_first;
+
+		kfe = new_knife_edge(kcd);
+		kfe->e = e;
+		kfe->v1 = get_bm_knife_vert(kcd, e->v1);
+		kfe->v2 = get_bm_knife_vert(kcd, e->v2);
+
+		knife_add_to_vert_edges(kcd, kfe);
+
+		BLI_ghash_insert(kcd->origedgemap, e, kfe);
+
+		/* avoid BM_ITER because of stack memory usage
+		 * otherwise we could use BM_FACES_OF_EDGE */
+		l_iter = l_first = e->l;
+		do {
+			knife_append_list(kcd, &kfe->faces, l_iter->f);
+
+			/* ensures the kedges lst for this f is initialized,
+			 * it automatically adds kfe by itself */
+			knife_get_face_kedges(kcd, l_iter->f);
+
+		} while ((l_iter = l_iter->radial_next) != l_first);
+	}
+
+	return kfe;
+}
+
+/* User has just clicked for first time or first time after a restart (E key).
+ * Copy the current position data into prev. */
+static void knife_start_cut(KnifeTool_OpData *kcd)
+{
+	kcd->prev = kcd->cur;
+	kcd->cur.is_space = 0; /*TODO: why do we do this? */
+
+	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];
+		BMVert *v0;
+
+		knife_input_ray_cast(kcd, kcd->cur.mval, origin, ray);
+		add_v3_v3v3(co, origin, ray);
+		v0 = BM_vert_at_index(kcd->em->bm, 0);
+		if (v0) {
+			closest_to_line_v3(kcd->prev.cage, v0->co, co, origin);
+			copy_v3_v3(kcd->prev.co, kcd->prev.cage); /*TODO: do we need this? */
+			copy_v3_v3(kcd->cur.cage, kcd->prev.cage);
+			copy_v3_v3(kcd->cur.co, kcd->prev.co);
+		}
+	}
+}
+
+/**
+ * \note #knife_get_face_kedges / #get_bm_knife_edge are called recusively - KEEP STACK MEM USAGE LOW */
+static ListBase *knife_get_face_kedges(KnifeTool_OpData *kcd, BMFace *f)
+{
+	ListBase *lst = BLI_ghash_lookup(kcd->kedgefacemap, f);
+
+	if (!lst) {
+		BMLoop *l_iter, *l_first;
+
+		lst = knife_empty_list(kcd);
+
+		/* avoid BM_ITER because of stack memory usage
+		 * otherwise we could use BM_EDGES_OF_FACE */
+		l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+		do {
+			knife_append_list(kcd, lst, get_bm_knife_edge(kcd, l_iter->e));
+		} while ((l_iter = l_iter->next) != l_first);
+
+		BLI_ghash_insert(kcd->kedgefacemap, f, lst);
+	}
+
+	return lst;
+}
+
+/* finds the proper face to restrict face fill to */
+static void knife_find_basef(KnifeTool_OpData *kcd, KnifeEdge *kfe)
+{
+	if (!kfe->basef) {
+		Ref *r1, *r2, *r3, *r4;
+
+		if (kfe->v1->isface || kfe->v2->isface) {
+			if (kfe->v2->isface)
+				kfe->basef = kcd->cur.bmface;
+			else
+				kfe->basef = kcd->prev.bmface;
+		}
+		else {
+			for (r1 = kfe->v1->edges.first; r1 && !kfe->basef; r1 = r1->next) {
+				KnifeEdge *ke1 = r1->ref;
+				for (r2 = ke1->faces.first; r2 && !kfe->basef; r2 = r2->next) {
+					for (r3 = kfe->v2->edges.first; r3 && !kfe->basef; r3 = r3->next) {
+						KnifeEdge *ke2 = r3->ref;
+
+						for (r4 = ke2->faces.first; r4 && !kfe->basef; r4 = r4->next) {
+							if (r2->ref == r4->ref) {
+								kfe->basef = r2->ref;
+							}
+						}
+					}
+				}
+			}
+		}
+		/* ok, at this point kfe->basef should be set if any valid possibility exists */
+	}
+}
+
+static void knife_edge_append_face(KnifeTool_OpData *kcd, KnifeEdge *kfe, BMFace *f)
+{
+	knife_append_list(kcd, knife_get_face_kedges(kcd, f), kfe);
+	knife_append_list(kcd, &kfe->faces, f);
+}
+
+static KnifeVert *knife_split_edge(KnifeTool_OpData *kcd, KnifeEdge *kfe, float co[3], KnifeEdge **newkfe_out)
+{
+	KnifeEdge *newkfe = new_knife_edge(kcd);
+	Ref *ref;
+	float perc, cageco[3], l12;
+
+	l12 = len_v3v3(kfe->v1->co, kfe->v2->co);
+	if (l12 < FLT_EPSILON * 80) {
+		copy_v3_v3(cageco, kfe->v1->cageco);
+	}
+	else {
+		perc = len_v3v3(co, kfe->v1->co) / l12;
+		interp_v3_v3v3(cageco, kfe->v1->cageco, kfe->v2->cageco, perc);
+	}
+
+	newkfe->v1 = kfe->v1;
+	newkfe->v2 = new_knife_vert(kcd, co, cageco);
+	newkfe->v2->draw = 1;
+	newkfe->basef = kfe->basef;
+
+	ref = find_ref(&kfe->v1->edges, kfe);
+	BLI_remlink(&kfe->v1->edges, ref);
+
+	kfe->v1 = newkfe->v2;
+	BLI_addtail(&kfe->v1->edges, ref);
+
+	for (ref = kfe->faces.first; ref; ref = ref->next)
+		knife_edge_append_face(kcd, newkfe, ref->ref);
+
+	knife_add_to_vert_edges(kcd, newkfe);
+
+	newkfe->draw = kfe->draw;
+	newkfe->e = kfe->e;
+
+	*newkfe_out = newkfe;
+
+	return newkfe->v2;
+}
+
+/* Make a single KnifeEdge for cut from kcd->prev to kcd->cur.
+ * and move cur data to prev. */
+static void knife_add_single_cut(KnifeTool_OpData *kcd)
+{
+	KnifeEdge *kfe = new_knife_edge(kcd), *kfe2 = NULL, *kfe3 = NULL;
+
+	if (kcd->prev.vert && kcd->prev.vert == kcd->cur.vert)
+		return;
+	if (kcd->prev.edge && kcd->prev.edge == kcd->cur.edge)
+		return;
+
+	kfe->draw = 1;
+
+	if (kcd->prev.vert) {
+		kfe->v1 = kcd->prev.vert;
+	}
+	else if (kcd->prev.edge) {
+		kfe->v1 = knife_split_edge(kcd, kcd->prev.edge, kcd->prev.co, &kfe2);
+	}
+	else {
+		kfe->v1 = new_knife_vert(kcd, kcd->prev.co, kcd->prev.co);
+		kfe->v1->draw = kfe->draw = !kcd->prev.is_space;
+		kfe->v1->inspace = kcd->prev.is_space;
+		kfe->draw = !kcd->prev.is_space;
+		kfe->v1->isface = 1;
+	}
+
+	if (kcd->cur.vert) {
+		kfe->v2 = kcd->cur.vert;
+	}
+	else if (kcd->cur.edge) {
+		kfe->v2 = knife_split_edge(kcd, kcd->cur.edge, kcd->cur.co, &kfe3);
+		kcd->cur.vert = kfe->v2;
+	}
+	else {
+		kfe->v2 = new_knife_vert(kcd, kcd->cur.co, kcd->cur.co);
+		kfe->v2->draw = !kcd->cur.is_space;
+		kfe->v2->isface = 1;
+		kfe->v2->inspace = kcd->cur.is_space;
+
+		if (kcd->cur.is_space)
+			kfe->draw = 0;
+
+		kcd->cur.vert = kfe->v2;
+	}
+
+	knife_find_basef(kcd, kfe);
+
+	knife_add_to_vert_edges(kcd, kfe);
+
+	if (kfe->basef && !find_ref(&kfe->faces, kfe->basef))
+		knife_edge_append_face(kcd, kfe, kfe->basef);
+
+	/* sanity check to make sure we're in the right edge/face lists */
+	if (kcd->cur.bmface) {
+		if (!find_ref(&kfe->faces, kcd->cur.bmface)) {
+			knife_edge_append_face(kcd, kfe, kcd->cur.bmface);
+		}
+
+		if (kcd->prev.bmface && kcd->prev.bmface != kcd->cur.bmface) {
+			if (!find_ref(&kfe->faces, kcd->prev.bmface)) {
+				knife_edge_append_face(kcd, kfe, kcd->prev.bmface);
+			}
+		}
+	}
+
+	/* set up for next cut */
+	kcd->prev = kcd->cur;
+}
+
+static int verge_linehit(const void *vlh1, const void *vlh2)
+{
+	const BMEdgeHit *lh1 = vlh1, *lh2 = vlh2;
+
+	if      (lh1->l < lh2->l) return -1;
+	else if (lh1->l > lh2->l) return 1;
+	else return 0;
+}
+
+static void knife_add_single_cut_through(KnifeTool_OpData *kcd, KnifeVert *v1, KnifeVert *v2, BMFace *f)
+{
+	KnifeEdge *kfenew;
+
+	kfenew = new_knife_edge(kcd);
+	kfenew->draw = 1;
+	kfenew->basef = f;
+	kfenew->v1 = v1;
+	kfenew->v2 = v2;
+	kfenew->draw = 1;
+
+	knife_add_to_vert_edges(kcd, kfenew);
+
+	if (!find_ref(&kfenew->faces, f))
+		knife_edge_append_face(kcd, kfenew, f);
+}
+
+static void knife_get_vert_faces(KnifeTool_OpData *kcd, KnifeVert *kfv, BMFace *facef, ListBase *lst)
+{
+	BMIter bmiter;
+	BMFace *f;
+
+	if (kfv->isface && facef) {
+		knife_append_list(kcd, lst, facef);
+	}
+	else if (kfv->v) {
+		BM_ITER_ELEM (f, &bmiter, kfv->v, BM_FACES_OF_VERT) {
+			knife_append_list(kcd, lst, f);
+		}
+	}
+}
+
+static void knife_get_edge_faces(KnifeTool_OpData *kcd, KnifeEdge *kfe, ListBase *lst)
+{
+	BMIter bmiter;
+	BMFace *f;
+
+	if (kfe->e) {
+		BM_ITER_ELEM (f, &bmiter, kfe->e, BM_FACES_OF_EDGE) {
+			knife_append_list(kcd, lst, f);
+		}
+	}
+}
+
+/* BMESH_TODO: add more functionality to cut-through:
+ *    - cutting "in face" (e.g., holes) should cut in all faces, not just visible one
+ *    - perhaps improve O(n^2) algorithm used here */
+static void knife_cut_through(KnifeTool_OpData *kcd)
+{
+	BMEdgeHit *lh, *lh2;
+	BMFace *f;
+	KnifeEdge *kfe, *kfe2, *kfe3;
+	KnifeVert *v1, *v2, *firstv = NULL, *lastv = NULL;
+	ListBase firstfaces = {NULL, NULL}, lastfaces = {NULL, NULL};
+	Ref *r, *r2;
+	KnifeEdge **splitkfe;
+	int i, j, found;
+
+	if (!kcd->totlinehit) {
+		/* if no linehits then no interesting back face stuff to do */
+		knife_add_single_cut(kcd);
+		return;
+	}
+
+	qsort(kcd->linehits, kcd->totlinehit, sizeof(BMEdgeHit), verge_linehit);
+	splitkfe = MEM_callocN(kcd->totlinehit * sizeof(KnifeEdge *), "knife_cut_through");
+
+	if (kcd->prev.vert) {
+		if (kcd->prev.vert == kcd->cur.vert)
+			return;
+		firstv = kcd->prev.vert;
+		knife_get_vert_faces(kcd, firstv, kcd->prev.bmface, &firstfaces);
+	}
+	else if (kcd->prev.edge) {
+		if (kcd->prev.edge == kcd->cur.edge)
+			return;
+		firstv = knife_split_edge(kcd, kcd->prev.edge, kcd->prev.co, &kfe3);
+		knife_get_edge_faces(kcd, kcd->prev.edge, &firstfaces);
+	}
+
+	if (kcd->cur.vert) {
+		lastv = kcd->cur.vert;
+		knife_get_vert_faces(kcd, lastv, kcd->cur.bmface, &lastfaces);
+	}
+	else if (kcd->cur.edge) {
+		lastv = knife_split_edge(kcd, kcd->cur.edge, kcd->cur.co, &kfe3);
+		knife_get_edge_faces(kcd, kcd->cur.edge, &lastfaces);
+	}
+
+	if (firstv) {
+		/* For each face incident to firstv,
+		 * find the first following linehit (if any) sharing that face and connect */
+		for (r = firstfaces.first; r; r = r->next) {
+			f = r->ref;
+			found = 0;
+			for (j = 0, lh2 = kcd->linehits; j < kcd->totlinehit; j++, lh2++) {
+				kfe2 = lh2->kfe;
+				for (r2 = kfe2->faces.first; r2; r2 = r2->next) {
+					if (r2->ref == f) {
+						v2 = splitkfe[j] ? kfe2->v1 : knife_split_edge(kcd, kfe2, lh2->hit, &splitkfe[j]);
+						knife_add_single_cut_through(kcd, firstv, v2, f);
+						found = 1;
+						break;
+					}
+				}
+			}
+			if (!found && lastv) {
+				for (r2 = lastfaces.first; r2; r2 = r2->next) {
+					if (r2->ref == f) {
+						knife_add_single_cut_through(kcd, firstv, lastv, f);
+						break;
+					}
+				}
+			}
+		}
+	}
+
+	for (i = 0, lh = kcd->linehits; i < kcd->totlinehit; i++, lh++) {
+		kfe = lh->kfe;
+
+		/* For each face attached to edge for this linehit,
+		 * find the first following linehit (if any) sharing that face and connect */
+		for (r = kfe->faces.first; r; r = r->next) {
+			f = r->ref;
+			found = 0;
+			for (j = i + 1, lh2 = lh + 1; j < kcd->totlinehit; j++, lh2++) {
+				kfe2 = lh2->kfe;
+				for (r2 = kfe2->faces.first; r2; r2 = r2->next) {
+					if (r2->ref == f) {
+						v1 = splitkfe[i] ? kfe->v1 : knife_split_edge(kcd, kfe, lh->hit, &splitkfe[i]);
+						v2 = splitkfe[j] ? kfe2->v1 : knife_split_edge(kcd, kfe2, lh2->hit, &splitkfe[j]);
+						knife_add_single_cut_through(kcd, v1, v2, f);
+						found = 1;
+						break;
+					}
+				}
+			}
+			if (!found && lastv) {
+				for (r2 = lastfaces.first; r2; r2 = r2->next) {
+					if (r2->ref == f) {
+						v1 = splitkfe[i] ? kfe->v1 : knife_split_edge(kcd, kfe, lh->hit, &splitkfe[i]);
+						knife_add_single_cut_through(kcd, v1, lastv, f);
+						break;
+					}
+				}
+			}
+		}
+	}
+
+	MEM_freeN(splitkfe);
+	MEM_freeN(kcd->linehits);
+	kcd->linehits = NULL;
+	kcd->totlinehit = 0;
+
+	/* set up for next cut */
+	kcd->prev = kcd->cur;
+}
+
+/* User has just left-clicked after the first time.
+ * Add all knife cuts implied by line from prev to cur.
+ * If that line crossed edges then kcd->linehits will be non-NULL. */
+static void knife_add_cut(KnifeTool_OpData *kcd)
+{
+	KnifePosData savcur = kcd->cur;
+
+	if (kcd->cut_through) {
+		knife_cut_through(kcd);
+	}
+	else if (kcd->linehits) {
+		BMEdgeHit *lh, *lastlh, *firstlh;
+		int i;
+
+		qsort(kcd->linehits, kcd->totlinehit, sizeof(BMEdgeHit), verge_linehit);
+
+		lh = kcd->linehits;
+		lastlh = firstlh = NULL;
+		for (i = 0; i < kcd->totlinehit; i++, (lastlh = lh), lh++) {
+			BMFace *f = lastlh ? lastlh->f : lh->f;
+
+			if (lastlh && len_v3v3(lastlh->hit, lh->hit) == 0.0f) {
+				if (!firstlh)
+					firstlh = lastlh;
+				continue;
+			}
+			else if (lastlh && firstlh) {
+				if (firstlh->v || lastlh->v) {
+					KnifeVert *kfv = firstlh->v ? firstlh->v : lastlh->v;
+
+					kcd->prev.vert = kfv;
+					copy_v3_v3(kcd->prev.co, firstlh->hit);
+					copy_v3_v3(kcd->prev.cage, firstlh->cagehit);
+					kcd->prev.edge = NULL;
+					kcd->prev.bmface = f;
+					/* TODO: should we set prev.in_space = 0 ? */
+				}
+				lastlh = firstlh = NULL;
+			}
+
+			if (len_v3v3(kcd->prev.cage, lh->realhit) < FLT_EPSILON * 80)
+				continue;
+			if (len_v3v3(kcd->cur.cage, lh->realhit) < FLT_EPSILON * 80)
+				continue;
+
+			if (kcd->prev.is_space) {
+				kcd->prev.is_space = 0;
+				copy_v3_v3(kcd->prev.co, lh->hit);
+				copy_v3_v3(kcd->prev.cage, lh->cagehit);
+				kcd->prev.vert = NULL;
+				kcd->prev.edge = lh->kfe;
+				kcd->prev.bmface = lh->f;
+				continue;
+			}
+
+			kcd->cur.is_space = 0;
+			kcd->cur.edge = lh->kfe;
+			kcd->cur.bmface = lh->f;
+			kcd->cur.vert = lh->v;
+			copy_v3_v3(kcd->cur.co, lh->hit);
+			copy_v3_v3(kcd->cur.cage, lh->cagehit);
+
+			knife_add_single_cut(kcd);
+		}
+
+		if (savcur.is_space) {
+			kcd->prev = savcur;
+		}
+		else {
+			kcd->cur = savcur;
+			knife_add_single_cut(kcd);
+		}
+
+		MEM_freeN(kcd->linehits);
+		kcd->linehits = NULL;
+		kcd->totlinehit = 0;
+	}
+	else {
+		knife_add_single_cut(kcd);
+	}
+}
+
+static void knife_finish_cut(KnifeTool_OpData *UNUSED(kcd))
+{
+
+}
+
+static void knifetool_draw_angle_snapping(KnifeTool_OpData *kcd)
+{
+	bglMats mats;
+	double u[3], u1[2], u2[2], v1[3], v2[3], dx, dy;
+	double wminx, wminy, wmaxx, wmaxy;
+
+	/* make u the window coords of prevcage */
+	view3d_get_transformation(kcd->ar, kcd->vc.rv3d, kcd->ob, &mats);
+	gluProject(kcd->prev.cage[0], kcd->prev.cage[1], kcd->prev.cage[2],
+	           mats.modelview, mats.projection, mats.viewport,
+	           &u[0], &u[1], &u[2]);
+
+	/* make u1, u2 the points on window going through u at snap angle */
+	wminx = kcd->ar->winrct.xmin;
+	wmaxx = kcd->ar->winrct.xmin + kcd->ar->winx;
+	wminy = kcd->ar->winrct.ymin;
+	wmaxy = kcd->ar->winrct.ymin + kcd->ar->winy;
+
+	switch (kcd->angle_snapping) {
+		case ANGLE_0:
+			u1[0] = wminx;
+			u2[0] = wmaxx;
+			u1[1] = u2[1] = u[1];
+			break;
+		case ANGLE_90:
+			u1[0] = u2[0] = u[0];
+			u1[1] = wminy;
+			u2[1] = wmaxy;
+			break;
+		case ANGLE_45:
+			/* clip against left or bottom */
+			dx = u[0] - wminx;
+			dy = u[1] - wminy;
+			if (dy > dx) {
+				u1[0] = wminx;
+				u1[1] = u[1] - dx;
+			}
+			else {
+				u1[0] = u[0] - dy;
+				u1[1] = wminy;
+			}
+			/* clip against right or top */
+			dx = wmaxx - u[0];
+			dy = wmaxy - u[1];
+			if (dy > dx) {
+				u2[0] = wmaxx;
+				u2[1] = u[1] + dx;
+			}
+			else {
+				u2[0] = u[0] + dy;
+				u2[1] = wmaxy;
+			}
+			break;
+		case ANGLE_135:
+			/* clip against right or bottom */
+			dx = wmaxx - u[0];
+			dy = u[1] - wminy;
+			if (dy > dx) {
+				u1[0] = wmaxx;
+				u1[1] = u[1] - dx;
+			}
+			else {
+				u1[0] = u[0] + dy;
+				u1[1] = wminy;
+			}
+			/* clip against left or top */
+			dx = u[0] - wminx;
+			dy = wmaxy - u[1];
+			if (dy > dx) {
+				u2[0] = wminx;
+				u2[1] = u[1] + dx;
+			}
+			else {
+				u2[0] = u[0] - dy;
+				u2[1] = wmaxy;
+			}
+			break;
+		default:
+			return;
+	}
+
+	/* unproject u1 and u2 back into object space */
+	gluUnProject(u1[0], u1[1], 0.0,
+	             mats.modelview, mats.projection, mats.viewport,
+	             &v1[0], &v1[1], &v1[2]);
+	gluUnProject(u2[0], u2[1], 0.0,
+	             mats.modelview, mats.projection, mats.viewport,
+	             &v2[0], &v2[1], &v2[2]);
+
+	UI_ThemeColor(TH_TRANSFORM);
+	glLineWidth(2.0);
+	glBegin(GL_LINES);
+	glVertex3dv(v1);
+	glVertex3dv(v2);
+	glEnd();
+}
+
+static void knife_init_colors(KnifeColors *colors)
+{
+	/* possible BMESH_TODO: add explicit themes or calculate these by
+	 * figuring out constrasting colors with grid / edges / verts
+	 * a la UI_make_axis_color */
+	UI_GetThemeColor3ubv(TH_NURB_VLINE, colors->line);
+	UI_GetThemeColor3ubv(TH_NURB_ULINE, colors->edge);
+	UI_GetThemeColor3ubv(TH_HANDLE_SEL_VECT, colors->curpoint);
+	UI_GetThemeColor3ubv(TH_HANDLE_SEL_VECT, colors->curpoint_a);
+	colors->curpoint_a[3] = 102;
+	UI_GetThemeColor3ubv(TH_ACTIVE_SPLINE, colors->point);
+	UI_GetThemeColor3ubv(TH_ACTIVE_SPLINE, colors->point_a);
+	colors->point_a[3] = 102;
+}
+
+/* modal loop selection drawing callback */
+static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
+{
+	View3D *v3d = CTX_wm_view3d(C);
+	KnifeTool_OpData *kcd = arg;
+
+	if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
+
+	glPolygonOffset(1.0f, 1.0f);
+
+	glPushMatrix();
+	glMultMatrixf(kcd->ob->obmat);
+
+	if (kcd->mode == MODE_DRAGGING) {
+		if (kcd->angle_snapping != ANGLE_FREE)
+			knifetool_draw_angle_snapping(kcd);
+
+		glColor3ubv(kcd->colors.line);
+		
+		glLineWidth(2.0);
+
+		glBegin(GL_LINES);
+		glVertex3fv(kcd->prev.cage);
+		glVertex3fv(kcd->cur.cage);
+		glEnd();
+
+		glLineWidth(1.0);
+	}
+
+	if (kcd->cur.edge) {
+		glColor3ubv(kcd->colors.edge);
+		glLineWidth(2.0);
+
+		glBegin(GL_LINES);
+		glVertex3fv(kcd->cur.edge->v1->cageco);
+		glVertex3fv(kcd->cur.edge->v2->cageco);
+		glEnd();
+
+		glLineWidth(1.0);
+	}
+	else if (kcd->cur.vert) {
+		glColor3ubv(kcd->colors.point);
+		glPointSize(11);
+
+		glBegin(GL_POINTS);
+		glVertex3fv(kcd->cur.cage);
+		glEnd();
+	}
+
+	if (kcd->cur.bmface) {
+		glColor3ubv(kcd->colors.curpoint);
+		glPointSize(9);
+
+		glBegin(GL_POINTS);
+		glVertex3fv(kcd->cur.cage);
+		glEnd();
+	}
+
+	if (kcd->totlinehit > 0) {
+		BMEdgeHit *lh;
+		int i;
+
+		glEnable(GL_BLEND);
+		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+		/* draw any snapped verts first */
+		glColor4ubv(kcd->colors.point_a);
+		glPointSize(11);
+		glBegin(GL_POINTS);
+		lh = kcd->linehits;
+		for (i = 0; i < kcd->totlinehit; i++, lh++) {
+			float sv1[3], sv2[3];
+
+			knife_project_v3(kcd, lh->kfe->v1->cageco, sv1);
+			knife_project_v3(kcd, lh->kfe->v2->cageco, sv2);
+			knife_project_v3(kcd, lh->cagehit, lh->schit);
+
+			if (len_v2v2(lh->schit, sv1) < kcd->vthresh / 4.0f) {
+				copy_v3_v3(lh->cagehit, lh->kfe->v1->cageco);
+				glVertex3fv(lh->cagehit);
+				lh->v = lh->kfe->v1;
+			}
+			else if (len_v2v2(lh->schit, sv2) < kcd->vthresh / 4.0f) {
+				copy_v3_v3(lh->cagehit, lh->kfe->v2->cageco);
+				glVertex3fv(lh->cagehit);
+				lh->v = lh->kfe->v2;
+			}
+		}
+		glEnd();
+
+		/* now draw the rest */
+		glColor4ubv(kcd->colors.curpoint_a);
+		glPointSize(7);
+		glBegin(GL_POINTS);
+		lh = kcd->linehits;
+		for (i = 0; i < kcd->totlinehit; i++, lh++) {
+			glVertex3fv(lh->cagehit);
+		}
+		glEnd();
+		glDisable(GL_BLEND);
+	}
+
+	if (kcd->totkedge > 0) {
+		BLI_mempool_iter iter;
+		KnifeEdge *kfe;
+
+		glLineWidth(1.0);
+		glBegin(GL_LINES);
+
+		BLI_mempool_iternew(kcd->kedges, &iter);
+		for (kfe = BLI_mempool_iterstep(&iter); kfe; kfe = BLI_mempool_iterstep(&iter)) {
+			if (!kfe->draw)
+				continue;
+
+			glColor3ubv(kcd->colors.line);
+
+			glVertex3fv(kfe->v1->cageco);
+			glVertex3fv(kfe->v2->cageco);
+		}
+
+		glEnd();
+		glLineWidth(1.0);
+	}
+
+	if (kcd->totkvert > 0) {
+		BLI_mempool_iter iter;
+		KnifeVert *kfv;
+
+		glPointSize(5.0);
+
+		glBegin(GL_POINTS);
+		BLI_mempool_iternew(kcd->kverts, &iter);
+		for (kfv = BLI_mempool_iterstep(&iter); kfv; kfv = BLI_mempool_iterstep(&iter)) {
+			if (!kfv->draw)
+				continue;
+
+			glColor3ubv(kcd->colors.point);
+
+			glVertex3fv(kfv->cageco);
+		}
+
+		glEnd();
+	}
+
+	glPopMatrix();
+
+	if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
+}
+
+static float len_v3_tri_side_max(const float v1[3], const float v2[3], const float v3[3])
+{
+	const float s1 = len_v3v3(v1, v2);
+	const float s2 = len_v3v3(v2, v3);
+	const float s3 = len_v3v3(v3, v1);
+
+	return MAX3(s1, s2, s3);
+}
+
+static BMEdgeHit *knife_edge_tri_isect(KnifeTool_OpData *kcd, BMBVHTree *bmtree,
+                                       const float v1[3],  const float v2[3], const float v3[3],
+                                       SmallHash *ehash, bglMats *mats, int *count)
+{
+	BVHTree *tree2 = BLI_bvhtree_new(3, FLT_EPSILON * 4, 8, 8), *tree = BMBVH_BVHTree(bmtree);
+	BMEdgeHit *edges = NULL;
+	BLI_array_declare(edges);
+	BVHTreeOverlap *results, *result;
+	BMLoop **ls;
+	float cos[9], uv[3], lambda;
+	unsigned int tot = 0;
+	int i, j;
+
+	/* for comparing distances, error of intersection depends on triangle scale.
+	 * need to scale down before squaring for accurate comparison */
+	const float depsilon = 50 * FLT_EPSILON * len_v3_tri_side_max(v1, v2, v3);
+	const float depsilon_squared = depsilon * depsilon;
+
+	copy_v3_v3(cos + 0, v1);
+	copy_v3_v3(cos + 3, v2);
+	copy_v3_v3(cos + 6, v3);
+
+	BLI_bvhtree_insert(tree2, 0, cos, 3);
+	BLI_bvhtree_balance(tree2);
+
+	result = results = BLI_bvhtree_overlap(tree, tree2, &tot);
+
+	for (i = 0; i < tot; i++, result++) {
+		float p[3];
+
+		ls = (BMLoop **)kcd->em->looptris[result->indexA];
+
+		for (j = 0; j < 3; j++) {
+			BMLoop *l1 = ls[j];
+			BMFace *hitf;
+			ListBase *lst = knife_get_face_kedges(kcd, l1->f);
+			Ref *ref;
+
+			for (ref = lst->first; ref; ref = ref->next) {
+				KnifeEdge *kfe = ref->ref;
+
+				//if (kfe == kcd->cur.edge || kfe == kcd->prev.edge)
+				//	continue;
+
+				if (isect_line_tri_v3(kfe->v1->cageco, kfe->v2->cageco, v1, v2, v3, &lambda, uv)) {
+					float no[3], view[3], sp[3];
+
+					interp_v3_v3v3(p, kfe->v1->cageco, kfe->v2->cageco, lambda);
+
+					if (kcd->cur.vert && len_squared_v3v3(kcd->cur.vert->cageco, p) < depsilon_squared)
+						continue;
+					if (kcd->prev.vert && len_squared_v3v3(kcd->prev.vert->cageco, p) < depsilon_squared)
+						continue;
+					if (len_squared_v3v3(kcd->prev.cage, p) < depsilon_squared ||
+					    len_squared_v3v3(kcd->cur.cage, p) < depsilon_squared)
+					{
+						continue;
+					}
+
+					knife_project_v3(kcd, p, sp);
+					view3d_unproject(mats, view, sp[0], sp[1], 0.0f);
+					mul_m4_v3(kcd->ob->imat, view);
+
+					if (kcd->cut_through) {
+						hitf = FALSE;
+					}
+					else {
+						/* check if this point is visible in the viewport */
+						sub_v3_v3(view, p);
+						normalize_v3(view);
+
+						copy_v3_v3(no, view);
+						mul_v3_fl(no, 0.003);
+
+						/* go towards view a bit */
+						add_v3_v3(p, no);
+
+						/* ray cast */
+						hitf = BMBVH_RayCast(bmtree, p, no, NULL, NULL);
+					}
+
+					/* ok, if visible add the new point */
+					if (!hitf && !BLI_smallhash_haskey(ehash, (intptr_t)kfe)) {
+						BMEdgeHit hit;
+						
+						if (len_squared_v3v3(p, kcd->cur.co) < depsilon_squared ||
+						    len_squared_v3v3(p, kcd->prev.co) < depsilon_squared)
+						{
+							continue;
+						}
+
+						hit.kfe = kfe;
+						hit.v = NULL;
+
+						knife_find_basef(kcd, kfe);
+						hit.f = kfe->basef;
+						hit.perc = len_v3v3(p, kfe->v1->cageco) / len_v3v3(kfe->v1->cageco, kfe->v2->cageco);
+						copy_v3_v3(hit.cagehit, p);
+
+						interp_v3_v3v3(p, kfe->v1->co, kfe->v2->co, hit.perc);
+						copy_v3_v3(hit.realhit, p);
+
+						/* BMESH_TODO: should also snap to vertices */
+						if (kcd->snap_midpoints) {
+							float perc = hit.perc;
+
+							/* select the closest from the edge endpoints or the midpoint */
+							if (perc < 0.25f) {
+								perc = 0.0f;
+							}
+							else if (perc < 0.75f) {
+								perc = 0.5f;
+							}
+							else {
+								perc = 1.0f;
+							}
+
+							interp_v3_v3v3(hit.hit, kfe->v1->co, kfe->v2->co, perc);
+							interp_v3_v3v3(hit.cagehit, kfe->v1->cageco, kfe->v2->cageco, perc);
+						}
+						else {
+							copy_v3_v3(hit.hit, p);
+						}
+						knife_project_v3(kcd, hit.cagehit, hit.schit);
+
+						BLI_array_append(edges, hit);
+						BLI_smallhash_insert(ehash, (intptr_t)kfe, NULL);
+					}
+				}
+			}
+		}
+	}
+
+	if (results)
+		MEM_freeN(results);
+
+	BLI_bvhtree_free(tree2);
+	*count = BLI_array_count(edges);
+
+	return edges;
+}
+
+static void knife_bgl_get_mats(KnifeTool_OpData *UNUSED(kcd), bglMats *mats)
+{
+	bgl_get_mats(mats);
+	//copy_m4_m4(mats->modelview, kcd->vc.rv3d->viewmat);
+	//copy_m4_m4(mats->projection, kcd->vc.rv3d->winmat);
+}
+
+/* Finds visible (or all, if cutting through) edges that intersects the current screen drag line */
+static void knife_find_line_hits(KnifeTool_OpData *kcd)
+{
+	bglMats mats;
+	BMEdgeHit *e1, *e2;
+	SmallHash hash, *ehash = &hash;
+	float v1[3], v2[3], v3[3], v4[4], s1[3], s2[3];
+	int i, c1, c2;
+
+	knife_bgl_get_mats(kcd, &mats);
+
+	if (kcd->linehits) {
+		MEM_freeN(kcd->linehits);
+		kcd->linehits = NULL;
+		kcd->totlinehit = 0;
+	}
+
+	copy_v3_v3(v1, kcd->prev.cage);
+	copy_v3_v3(v2, kcd->cur.cage);
+
+	/* project screen line's 3d coordinates back into 2d */
+	knife_project_v3(kcd, v1, s1);
+	knife_project_v3(kcd, v2, s2);
+
+	if (len_v2v2(s1, s2) < 1)
+		return;
+
+	/* unproject screen line */
+	ED_view3d_win_to_segment_clip(kcd->ar, kcd->vc.v3d, s1, v1, v3);
+	ED_view3d_win_to_segment_clip(kcd->ar, kcd->vc.v3d, s2, v2, v4);
+
+	mul_m4_v3(kcd->ob->imat, v1);
+	mul_m4_v3(kcd->ob->imat, v2);
+	mul_m4_v3(kcd->ob->imat, v3);
+	mul_m4_v3(kcd->ob->imat, v4);
+
+	/* numeric error, 'v1' -> 'v2', 'v2' -> 'v4' can end up being ~2000 units apart in otho mode
+	 * (from ED_view3d_win_to_segment_clip() above)
+	 * this gives precision error in 'knife_edge_tri_isect', rather then solving properly
+	 * (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);
+	}
+
+	BLI_smallhash_init(ehash);
+
+	/* test two triangles of sceen line's plane */
+	e1 = knife_edge_tri_isect(kcd, kcd->bmbvh, v1, v2, v3, ehash, &mats, &c1);
+	e2 = knife_edge_tri_isect(kcd, kcd->bmbvh, v2, v3, v4, ehash, &mats, &c2);
+	if (c1 && c2) {
+		e1 = MEM_reallocN(e1, sizeof(BMEdgeHit) * (c1 + c2));
+		memcpy(e1 + c1, e2, sizeof(BMEdgeHit) * c2);
+		MEM_freeN(e2);
+	}
+	else if (c2) {
+		e1 = e2;
+	}
+
+	kcd->linehits = e1;
+	kcd->totlinehit = c1 + c2;
+
+	/* find position along screen line, used for sorting */
+	for (i = 0; i < kcd->totlinehit; i++) {
+		BMEdgeHit *lh = e1 + i;
+
+		lh->l = len_v2v2(lh->schit, s1) / len_v2v2(s2, s1);
+	}
+
+	BLI_smallhash_release(ehash);
+}
+
+static void knife_input_ray_cast(KnifeTool_OpData *kcd, const int mval_i[2],
+                                 float r_origin[3], float r_ray[3])
+{
+	bglMats mats;
+	float mval[2], imat[3][3];
+
+	knife_bgl_get_mats(kcd, &mats);
+
+	mval[0] = (float)mval_i[0];
+	mval[1] = (float)mval_i[1];
+
+	/* unproject to find view ray */
+	view3d_unproject(&mats, r_origin, mval[0], mval[1], 0.0f);
+
+	if (kcd->is_ortho) {
+		negate_v3_v3(r_ray, kcd->vc.rv3d->viewinv[2]);
+	}
+	else {
+		sub_v3_v3v3(r_ray, r_origin, kcd->vc.rv3d->viewinv[3]);
+	}
+	normalize_v3(r_ray);
+
+	/* transform into object space */
+	invert_m4_m4(kcd->ob->imat, kcd->ob->obmat);
+	copy_m3_m4(imat, kcd->ob->obmat);
+	invert_m3(imat);
+
+	mul_m4_v3(kcd->ob->imat, r_origin);
+	mul_m3_v3(imat, r_ray);
+}
+
+static BMFace *knife_find_closest_face(KnifeTool_OpData *kcd, float co[3], float cageco[3], int *is_space)
+{
+	BMFace *f;
+	int dist = KMAXDIST;
+	float origin[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);
+
+	f = BMBVH_RayCast(kcd->bmbvh, origin, ray, co, cageco);
+
+	if (is_space)
+		*is_space = !f;
+
+	if (!f) {
+		/* try to use backbuffer selection method if ray casting failed */
+		f = EDBM_face_find_nearest(&kcd->vc, &dist);
+
+		/* cheat for now; just put in the origin instead
+		 * of a true coordinate on the face.
+		 * This just puts a point 1.0f infront of the view. */
+		add_v3_v3v3(co, origin, ray);
+	}
+
+	return f;
+}
+
+/* find the 2d screen space density of vertices within a radius.  used to scale snapping
+ * distance for picking edges/verts.*/
+static int knife_sample_screen_density(KnifeTool_OpData *kcd, float radius)
+{
+	BMFace *f;
+	int is_space;
+	float co[3], cageco[3], sco[3];
+
+	f = knife_find_closest_face(kcd, co, cageco, &is_space);
+
+	if (f && !is_space) {
+		ListBase *lst;
+		Ref *ref;
+		float dis;
+		int c = 0;
+
+		knife_project_v3(kcd, cageco, sco);
+
+		lst = knife_get_face_kedges(kcd, f);
+		for (ref = lst->first; ref; ref = ref->next) {
+			KnifeEdge *kfe = ref->ref;
+			int i;
+
+			for (i = 0; i < 2; i++) {
+				KnifeVert *kfv = i ? kfe->v2 : kfe->v1;
+
+				knife_project_v3(kcd, kfv->cageco, kfv->sco);
+
+				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) {
+							c++;
+						}
+					}
+					else {
+						c++;
+					}
+				}
+			}
+		}
+
+		return c;
+	}
+
+	return 0;
+}
+
+/* returns snapping distance for edges/verts, scaled by the density of the
+ * surrounding mesh (in screen space)*/
+static float knife_snap_size(KnifeTool_OpData *kcd, float maxsize)
+{
+	float density = (float)knife_sample_screen_density(kcd, maxsize * 2.0f);
+
+	density = MAX2(density, 1);
+
+	return MIN2(maxsize / (density * 0.5f), maxsize);
+}
+
+/* p is closest point on edge to the mouse cursor */
+static KnifeEdge *knife_find_closest_edge(KnifeTool_OpData *kcd, float p[3], float cagep[3], BMFace **fptr, int *is_space)
+{
+	BMFace *f;
+	float co[3], cageco[3], sco[3], maxdist = knife_snap_size(kcd, kcd->ethresh);
+
+	if (kcd->ignore_vert_snapping)
+		maxdist *= 0.5;
+
+	f = knife_find_closest_face(kcd, co, cageco, NULL);
+	*is_space = !f;
+
+	/* set p to co, in case we don't find anything, means a face cut */
+	copy_v3_v3(p, co);
+	copy_v3_v3(cagep, cageco);
+
+	kcd->cur.bmface = f;
+
+	if (f) {
+		KnifeEdge *cure = NULL;
+		ListBase *lst;
+		Ref *ref;
+		float dis, curdis = FLT_MAX;
+
+		knife_project_v3(kcd, cageco, sco);
+
+		/* look through all edges associated with this face */
+		lst = knife_get_face_kedges(kcd, f);
+		for (ref = lst->first; ref; ref = ref->next) {
+			KnifeEdge *kfe = ref->ref;
+
+			/* project edge vertices into screen space */
+			knife_project_v3(kcd, kfe->v1->cageco, kfe->v1->sco);
+			knife_project_v3(kcd, kfe->v2->cageco, kfe->v2->sco);
+
+			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 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);
+
+					if (ED_view3d_clipping_test(kcd->vc.rv3d, vec, TRUE) == 0) {
+						cure = kfe;
+						curdis = dis;
+					}
+				}
+				else {
+					cure = kfe;
+					curdis = dis;
+				}
+			}
+		}
+
+		if (fptr)
+			*fptr = f;
+
+		if (cure && p) {
+			if (!kcd->ignore_edge_snapping || !(cure->e)) {
+				if (kcd->snap_midpoints) {
+					mid_v3_v3v3(p, cure->v1->co, cure->v2->co);
+					mid_v3_v3v3(cagep, cure->v1->cageco, cure->v2->cageco);
+				}
+				else {
+					float d;
+
+					closest_to_line_segment_v3(cagep, cageco, cure->v1->cageco, cure->v2->cageco);
+					d = len_v3v3(cagep, cure->v1->cageco) / len_v3v3(cure->v1->cageco, cure->v2->cageco);
+					interp_v3_v3v3(p, cure->v1->co, cure->v2->co, d);
+				}
+			}
+			else {
+				return NULL;
+			}
+		}
+
+		return cure;
+	}
+
+	if (fptr)
+		*fptr = NULL;
+
+	return NULL;
+}
+
+/* find a vertex near the mouse cursor, if it exists */
+static KnifeVert *knife_find_closest_vert(KnifeTool_OpData *kcd, float p[3], float cagep[3], BMFace **fptr,
+                                          int *is_space)
+{
+	BMFace *f;
+	float co[3], cageco[3], sco[3], maxdist = knife_snap_size(kcd, kcd->vthresh);
+
+	if (kcd->ignore_vert_snapping)
+		maxdist *= 0.5;
+
+	f = knife_find_closest_face(kcd, co, cageco, is_space);
+
+	/* set p to co, in case we don't find anything, means a face cut */
+	copy_v3_v3(p, co);
+	copy_v3_v3(cagep, p);
+	kcd->cur.bmface = f;
+
+	if (f) {
+		ListBase *lst;
+		Ref *ref;
+		KnifeVert *curv = NULL;
+		float dis, curdis = FLT_MAX;
+
+		knife_project_v3(kcd, cageco, sco);
+
+		lst = knife_get_face_kedges(kcd, f);
+		for (ref = lst->first; ref; ref = ref->next) {
+			KnifeEdge *kfe = ref->ref;
+			int i;
+
+			for (i = 0; i < 2; i++) {
+				KnifeVert *kfv = i ? kfe->v2 : kfe->v1;
+
+				knife_project_v3(kcd, kfv->cageco, kfv->sco);
+
+				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) {
+							curv = kfv;
+							curdis = dis;
+						}
+					}
+					else {
+						curv = kfv;
+						curdis = dis;
+					}
+				}
+			}
+		}
+
+		if (!kcd->ignore_vert_snapping || !(curv && curv->v)) {
+			if (fptr)
+				*fptr = f;
+
+			if (curv && p) {
+				copy_v3_v3(p, curv->co);
+				copy_v3_v3(cagep, curv->cageco);
+			}
+
+			return curv;
+		}
+		else {
+			if (fptr)
+				*fptr = f;
+
+			return NULL;
+		}
+	}
+
+	if (fptr)
+		*fptr = NULL;
+
+	return NULL;
+}
+
+static void knife_snap_angle(KnifeTool_OpData *kcd)
+{
+	int dx, dy;
+	float w, abs_tan;
+
+	dx = kcd->vc.mval[0] - kcd->prev.mval[0];
+	dy = kcd->vc.mval[1] - kcd->prev.mval[1];
+	if (dx == 0 || dy == 0)
+		return;
+
+	w = (float)dy / (float)dx;
+	abs_tan = fabsf(w);
+	if (abs_tan <= 0.4142f) { /* tan(22.5 degrees) = 0.4142 */
+		kcd->angle_snapping = ANGLE_0;
+		kcd->vc.mval[1] = kcd->prev.mval[1];
+	}
+	else if (abs_tan < 2.4142f) { /* tan(67.5 degrees) = 2.4142 */
+		if (w > 0) {
+			kcd->angle_snapping = ANGLE_45;
+			kcd->vc.mval[1] = kcd->prev.mval[1] + dx;
+		}
+		else {
+			kcd->angle_snapping = ANGLE_135;
+			kcd->vc.mval[1] = kcd->prev.mval[1] - dx;
+		}
+	}
+	else {
+		kcd->angle_snapping = ANGLE_90;
+		kcd->vc.mval[0] = kcd->prev.mval[0];
+	}
+}
+
+/* update active knife edge/vert pointers */
+static int knife_update_active(KnifeTool_OpData *kcd)
+{
+	if (kcd->angle_snapping != ANGLE_FREE && kcd->mode == MODE_DRAGGING)
+		knife_snap_angle(kcd);
+
+	knife_pos_data_clear(&kcd->cur);
+	kcd->cur.mval[0] = kcd->vc.mval[0];
+	kcd->cur.mval[1] = kcd->vc.mval[1];
+
+	kcd->cur.vert = knife_find_closest_vert(kcd, kcd->cur.co, kcd->cur.cage, &kcd->cur.bmface, &kcd->cur.is_space);
+	if (!kcd->cur.vert) {
+		kcd->cur.edge = knife_find_closest_edge(kcd, kcd->cur.co, kcd->cur.cage, &kcd->cur.bmface, &kcd->cur.is_space);
+	}
+
+	/* if no hits are found this would normally default to (0, 0, 0) so instead
+	 * get a point at the mouse ray closest to the previous point.
+	 * 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->cur.vert == NULL && kcd->cur.edge == NULL) {
+		float origin[3], ray[3], co[3];
+
+		knife_input_ray_cast(kcd, kcd->vc.mval, origin, ray);
+		add_v3_v3v3(co, origin, ray);
+
+		closest_to_line_v3(kcd->cur.cage, kcd->prev.cage, co, origin);
+	}
+
+	if (kcd->mode == MODE_DRAGGING) {
+		knife_find_line_hits(kcd);
+	}
+	return 1;
+}
+
+#define MARK            4
+#define DEL             8
+#define VERT_ON_EDGE    16
+#define VERT_ORIG       32
+#define FACE_FLIP       64
+#define BOUNDARY        128
+#define FACE_NEW        256
+
+#define SCANFILL_CUTS 0
+#if SCANFILL_CUTS
+
+typedef struct facenet_entry {
+	struct facenet_entry *next, *prev;
+	KnifeEdge *kfe;
+} facenet_entry;
+
+static void rnd_offset_co(float co[3], float scale)
+{
+	int i;
+
+	for (i = 0; i < 3; i++) {
+		co[i] += (BLI_frand() - 0.5) * scale;
+	}
+}
+
+static void remerge_faces(KnifeTool_OpData *kcd)
+{
+	BMesh *bm = kcd->em->bm;
+	SmallHash svisit, *visit = &svisit;
+	BMIter iter;
+	BMFace *f;
+	BMFace **stack = NULL;
+	BLI_array_declare(stack);
+	BMFace **faces = NULL;
+	BLI_array_declare(faces);
+	BMOperator bmop;
+	int idx;
+
+	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_op_finish(bm, &bmop);
+
+	BLI_smallhash_init(visit);
+	BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+		BMIter eiter;
+		BMEdge *e;
+		BMFace *f2;
+
+		if (!BMO_elem_flag_test(bm, f, FACE_NEW))
+			continue;
+
+		if (BLI_smallhash_haskey(visit, (intptr_t)f))
+			continue;
+
+		BLI_array_empty(stack);
+		BLI_array_empty(faces);
+		BLI_array_append(stack, f);
+		BLI_smallhash_insert(visit, (intptr_t)f, NULL);
+
+		do {
+			f2 = BLI_array_pop(stack);
+
+			BLI_array_append(faces, f2);
+
+			BM_ITER_ELEM (e, &eiter, f2, BM_EDGES_OF_FACE) {
+				BMIter fiter;
+				BMFace *f3;
+
+				if (BMO_elem_flag_test(bm, e, BOUNDARY))
+					continue;
+
+				BM_ITER_ELEM (f3, &fiter, e, BM_FACES_OF_EDGE) {
+					if (!BMO_elem_flag_test(bm, f3, FACE_NEW))
+						continue;
+					if (BLI_smallhash_haskey(visit, (intptr_t)f3))
+						continue;
+
+					BLI_smallhash_insert(visit, (intptr_t)f3, NULL);
+					BLI_array_append(stack, f3);
+				}
+			}
+		} while (BLI_array_count(stack) > 0);
+
+		if (BLI_array_count(faces) > 0) {
+			idx = BM_elem_index_get(faces[0]);
+
+			f2 = BM_faces_join(bm, faces, BLI_array_count(faces), TRUE);
+			if (f2) {
+				BMO_elem_flag_enable(bm, f2, FACE_NEW);
+				BM_elem_index_set(f2, idx); /* set_dirty! *//* BMESH_TODO, check if this is valid or not */
+			}
+		}
+	}
+	/* BMESH_TODO, check if the code above validates the indices */
+	/* bm->elem_index_dirty &= ~BM_FACE; */
+	bm->elem_index_dirty |= BM_FACE;
+
+	BLI_smallhash_release(visit);
+
+	BLI_array_free(stack);
+	BLI_array_free(faces);
+}
+
+/* use edgenet to fill faces.  this is a bit annoying and convoluted.*/
+static void knifenet_fill_faces(KnifeTool_OpData *kcd)
+{
+	ScanFillContext sf_ctx;
+	BMesh *bm = kcd->em->bm;
+	BMIter bmiter;
+	BLI_mempool_iter iter;
+	BMFace *f;
+	BMEdge *e;
+	KnifeVert *kfv;
+	KnifeEdge *kfe;
+	facenet_entry *entry;
+	ListBase *face_nets = MEM_callocN(sizeof(ListBase) * bm->totface, "face_nets");
+	BMFace **faces = MEM_callocN(sizeof(BMFace *) * bm->totface, "faces knife");
+	MemArena *arena = BLI_memarena_new(1 << 16, "knifenet_fill_faces");
+	SmallHash shash;
+	int i, j, k = 0, totface = bm->totface;
+
+	BMO_push(bm, NULL);
+	bmesh_edit_begin(bm, BMO_OP_FLAG_UNTAN_MULTIRES);
+
+	/* BMESH_TODO this should be valid now, leaving here until we can ensure this - campbell */
+	i = 0;
+	BM_ITER_MESH (f, &bmiter, bm, BM_FACES_OF_MESH) {
+		BM_elem_index_set(f, i); /* set_inline */
+		faces[i] = f;
+		i++;
+	}
+	bm->elem_index_dirty &= ~BM_FACE;
+
+	BM_ITER_MESH (e, &bmiter, bm, BM_EDGES_OF_MESH) {
+		BMO_elem_flag_enable(bm, e, BOUNDARY);
+	}
+
+	/* turn knife verts into real verts, as necessary */
+	BLI_mempool_iternew(kcd->kverts, &iter);
+	for (kfv = BLI_mempool_iterstep(&iter); kfv; kfv = BLI_mempool_iterstep(&iter)) {
+		if (!kfv->v) {
+			/* shouldn't we be at least copying the normal? - if not some comment here should explain why - campbell */
+			kfv->v = BM_vert_create(bm, kfv->co, NULL);
+			kfv->flag = 1;
+			BMO_elem_flag_enable(bm, kfv->v, DEL);
+		}
+		else {
+			kfv->flag = 0;
+			BMO_elem_flag_enable(bm, kfv->v, VERT_ORIG);
+		}
+
+		BMO_elem_flag_enable(bm, kfv->v, MARK);
+	}
+
+	/* we want to only do changed faces.  first, go over new edges and add to
+	 * face net lists.*/
+	i = j = k = 0;
+	BLI_mempool_iternew(kcd->kedges, &iter);
+	for (kfe = BLI_mempool_iterstep(&iter); kfe; kfe = BLI_mempool_iterstep(&iter)) {
+		Ref *ref;
+		if (!kfe->v1 || !kfe->v2 || kfe->v1->inspace || kfe->v2->inspace)
+			continue;
+
+		i++;
+
+		if (kfe->e && kfe->v1->v == kfe->e->v1 && kfe->v2->v == kfe->e->v2) {
+			kfe->oe = kfe->e;
+			continue;
+		}
+
+		j++;
+
+		if (kfe->e) {
+			kfe->oe = kfe->e;
+
+			BMO_elem_flag_enable(bm, kfe->e, DEL);
+			BMO_elem_flag_disable(bm, kfe->e, BOUNDARY);
+			kfe->e = NULL;
+		}
+
+		kfe->e = BM_edge_create(bm, kfe->v1->v, kfe->v2->v, NULL, TRUE);
+		BMO_elem_flag_enable(bm, kfe->e, BOUNDARY);
+
+		for (ref = kfe->faces.first; ref; ref = ref->next) {
+			f = ref->ref;
+
+			entry = BLI_memarena_alloc(arena, sizeof(*entry));
+			entry->kfe = kfe;
+			BLI_addtail(face_nets + BM_elem_index_get(f), entry);
+		}
+	}
+
+	/* go over original edges, and add to faces with new geometry */
+	BLI_mempool_iternew(kcd->kedges, &iter);
+	for (kfe = BLI_mempool_iterstep(&iter); kfe; kfe = BLI_mempool_iterstep(&iter)) {
+		Ref *ref;
+
+		if (!kfe->v1 || !kfe->v2 || kfe->v1->inspace || kfe->v2->inspace)
+			continue;
+		if (!(kfe->oe && kfe->v1->v == kfe->oe->v1 && kfe->v2->v == kfe->oe->v2))
+			continue;
+
+		k++;
+
+		BMO_elem_flag_enable(bm, kfe->e, BOUNDARY);
+		kfe->oe = kfe->e;
+
+		for (ref = kfe->faces.first; ref; ref = ref->next) {
+			f = ref->ref;
+
+			if (face_nets[BM_elem_index_get(f)].first) {
+				entry = BLI_memarena_alloc(arena, sizeof(*entry));
+				entry->kfe = kfe;
+				BLI_addtail(face_nets + BM_elem_index_get(f), entry);
+			}
+		}
+	}
+
+	BLI_srand(0);
+
+	for (i = 0; i < totface; i++) {
+		SmallHash *hash = &shash;
+		ScanFillFace *efa;
+		ScanFillVert *eve, *lasteve;
+		int j;
+		float rndscale = FLT_EPSILON * 25;
+
+		f = faces[i];
+		BLI_smallhash_init(hash);
+
+		if (face_nets[i].first)
+			BMO_elem_flag_enable(bm, f, DEL);
+
+		BLI_begin_edgefill(&sf_ctx);
+
+		for (entry = face_nets[i].first; entry; entry = entry->next) {
+			if (!BLI_smallhash_haskey(hash, (intptr_t)entry->kfe->v1)) {
+				eve = BLI_addfillvert(&sf_ctx, entry->kfe->v1->v->co);
+				eve->poly_nr = 0;
+				rnd_offset_co(eve->co, rndscale);
+				eve->tmp.p = entry->kfe->v1->v;
+				BLI_smallhash_insert(hash, (intptr_t)entry->kfe->v1, eve);
+			}
+
+			if (!BLI_smallhash_haskey(hash, (intptr_t)entry->kfe->v2)) {
+				eve = BLI_addfillvert(&sf_ctx, entry->kfe->v2->v->co);
+				eve->poly_nr = 0;
+				rnd_offset_co(eve->co, rndscale);
+				eve->tmp.p = entry->kfe->v2->v;
+				BLI_smallhash_insert(hash, (intptr_t)entry->kfe->v2, eve);
+			}
+		}
+
+		for (j = 0, entry = face_nets[i].first; entry; entry = entry->next, j++) {
+			lasteve = BLI_smallhash_lookup(hash, (intptr_t)entry->kfe->v1);
+			eve = BLI_smallhash_lookup(hash, (intptr_t)entry->kfe->v2);
+
+			eve->poly_nr++;
+			lasteve->poly_nr++;
+		}
+
+		for (j = 0, entry = face_nets[i].first; entry; entry = entry->next, j++) {
+			lasteve = BLI_smallhash_lookup(hash, (intptr_t)entry->kfe->v1);
+			eve = BLI_smallhash_lookup(hash, (intptr_t)entry->kfe->v2);
+
+			if (eve->poly_nr > 1 && lasteve->poly_nr > 1) {
+				ScanFillEdge *eed;
+				eed = BLI_addfilledge(&sf_ctx, lasteve, eve);
+				if (entry->kfe->oe)
+					eed->f = SF_EDGE_BOUNDARY;  /* mark as original boundary edge */
+
+				BMO_elem_flag_disable(bm, entry->kfe->e->v1, DEL);
+				BMO_elem_flag_disable(bm, entry->kfe->e->v2, DEL);
+			}
+			else {
+				if (lasteve->poly_nr < 2)
+					BLI_remlink(&sf_ctx.fillvertbase, lasteve);
+				if (eve->poly_nr < 2)
+					BLI_remlink(&sf_ctx.fillvertbase, eve);
+			}
+		}
+
+		BLI_edgefill(&sf_ctx, FALSE);
+
+		for (efa = sf_ctx.fillfacebase.first; efa; efa = efa->next) {
+			BMVert *v1 = efa->v3->tmp.p, *v2 = efa->v2->tmp.p, *v3 = efa->v1->tmp.p;
+			BMFace *f2;
+			BMLoop *l_iter;
+			BMVert *verts[3] = {v1, v2, v3};
+
+			if (v1 == v2 || v2 == v3 || v1 == v3)
+				continue;
+			if (BM_face_exists(bm, verts, 3, &f2))
+				continue;
+
+			f2 = BM_face_create_quad_tri(bm,
+			                             v1, v2, v3, NULL,
+			                             NULL, FALSE);
+
+			BMO_elem_flag_enable(bm, f2, FACE_NEW);
+
+			l_iter = BM_FACE_FIRST_LOOP(f2);
+			do {
+				BMO_elem_flag_disable(bm, l_iter->e, DEL);
+			} while ((l_iter = l_iter->next) != BM_FACE_FIRST_LOOP(f2));
+
+			BMO_elem_flag_disable(bm, f2, DEL);
+			BM_elem_index_set(f2, i); /* set_dirty! *//* note, not 100% sure this is dirty? need to check */
+
+			BM_face_normal_update(f2);
+			if (dot_v3v3(f->no, f2->no) < 0.0f) {
+				BM_face_normal_flip(bm, f2);
+			}
+		}
+
+		BLI_end_edgefill(&sf_ctx);
+		BLI_smallhash_release(hash);
+	}
+	bm->elem_index_dirty |= BM_FACE;
+
+	/* interpolate customdata */
+	BM_ITER_MESH (f, &bmiter, bm, BM_FACES_OF_MESH) {
+		BMLoop *l1;
+		BMFace *f2;
+		BMIter liter1;
+
+		if (!BMO_elem_flag_test(bm, f, FACE_NEW))
+			continue;
+
+		f2 = faces[BM_elem_index_get(f)];
+		if (BM_elem_index_get(f) < 0 || BM_elem_index_get(f) >= totface) {
+			fprintf(stderr, "%s: face index out of range! (bmesh internal error)\n", __func__);
+		}
+
+		BM_elem_attrs_copy(bm, bm, f2, f);
+
+		BM_ITER_ELEM (l1, &liter1, f, BM_LOOPS_OF_FACE) {
+			BM_loop_interp_from_face(bm, l1, f2, TRUE, TRUE);
+		}
+	}
+
+	/* merge triangles back into faces */
+	remerge_faces(kcd);
+
+	/* delete left over faces */
+	BMO_op_callf(bm, "del geom=%ff context=%i", DEL, DEL_ONLYFACES);
+	BMO_op_callf(bm, "del geom=%fe context=%i", DEL, DEL_EDGES);
+	BMO_op_callf(bm, "del geom=%fv context=%i", DEL, DEL_VERTS);
+
+	if (face_nets) 
+		MEM_freeN(face_nets);
+	if (faces)
+		MEM_freeN(faces);
+	BLI_memarena_free(arena);
+
+	BMO_error_clear(bm); /* remerge_faces sometimes raises errors, so make sure to clear them */
+
+	bmesh_edit_end(bm, BMO_OP_FLAG_UNTAN_MULTIRES);
+	BMO_pop(bm);
+}
+
+#else  /* use direct (non-scanfill) method for cuts */
+
+/* assuming v is on line ab, what fraction of the way is v from a to b? */
+static float frac_along(const float a[3], const float b[3], const float v[3])
+{
+	float lab;
+
+	lab = len_v3v3(a, b);
+	if (lab == 0.0f) {
+		return 0.0f;
+	}
+	else {
+		return len_v3v3(a, v) / lab;
+	}
+}
+
+/* sort list of kverts by fraction along edge e */
+static void sort_by_frac_along(ListBase *lst, BMEdge *e)
+{
+	KnifeVert *vcur, *vprev;
+	float *v1co, *v2co;
+	Ref *cur = NULL, *prev = NULL, *next = NULL;
+
+	if (lst->first == lst->last)
+		return;
+
+	v1co = e->v1->co;
+	v2co = e->v2->co;
+
+	for (cur = ((Ref *)lst->first)->next; cur; cur = next) {
+		next = cur->next;
+		prev = cur->prev;
+
+		BLI_remlink(lst, cur);
+
+		vcur = cur->ref;
+		while (prev) {
+			vprev = prev->ref;
+			if (frac_along(v1co, v2co, vprev->co) <= frac_along(v1co, v2co, vcur->co))
+				break;
+			prev = prev->prev;
+		}
+
+		BLI_insertlinkafter(lst, prev, cur);
+	}
+}
+
+/* The chain so far goes from an instantiated vertex to kfv (some may be reversed).
+ * If possible, complete the chain to another instantiated vertex and return 1, else return 0.
+ * The visited hash says which KnifeVert's have already been tried, not including kfv. */
+static int find_chain_search(KnifeTool_OpData *kcd, KnifeVert *kfv, ListBase *fedges, SmallHash *visited,
+                             ListBase *chain)
+{
+	Ref *r;
+	KnifeEdge *kfe;
+	KnifeVert *kfv_other;
+
+	if (kfv->v)
+		return TRUE;
+
+	BLI_smallhash_insert(visited, (uintptr_t)kfv, NULL);
+	/* Try all possible next edges. Could either go through fedges
+	 * (all the KnifeEdges for the face being cut) or could go through
+	 * kve->edges and restrict to cutting face and uninstantiated edges.
+	 * Not clear which is better. Let's do the first. */
+	for (r = fedges->first; r; r = r->next) {
+		kfe = r->ref;
+		kfv_other = NULL;
+		if (kfe->v1 == kfv)
+			kfv_other = kfe->v2;
+		else if (kfe->v2 == kfv)
+			kfv_other = kfe->v1;
+		if (kfv_other && !BLI_smallhash_haskey(visited, (uintptr_t)kfv_other)) {
+			knife_append_list(kcd, chain, kfe);
+			if (find_chain_search(kcd, kfv_other, fedges, visited, chain))
+				return TRUE;
+			BLI_remlink(chain, chain->last);
+		}
+	}
+	return FALSE;
+}
+
+static ListBase *find_chain_from_vertex(KnifeTool_OpData *kcd, KnifeEdge *kfe, BMVert *v, ListBase *fedges)
+{
+	SmallHash visited_, *visited = &visited_;
+	ListBase *ans;
+	int found;
+
+	ans = knife_empty_list(kcd);
+	knife_append_list(kcd, ans, kfe);
+	found = 0;
+	BLI_smallhash_init(visited);
+	if (kfe->v1->v == v) {
+		BLI_smallhash_insert(visited, (uintptr_t)(kfe->v1), NULL);
+		found = find_chain_search(kcd, kfe->v2, fedges, visited, ans);
+	}
+	else {
+		BLI_assert(kfe->v2->v == v);
+		BLI_smallhash_insert(visited, (uintptr_t)(kfe->v2), NULL);
+		found = find_chain_search(kcd, kfe->v1, fedges, visited, ans);
+	}
+
+	BLI_smallhash_release(visited);
+
+	if (found)
+		return ans;
+	else
+		return NULL;
+}
+
+/* Find a chain in fedges from one instantiated vertex to another.
+ * Remove the edges in the chain from fedges and return a separate list of the chain. */
+static ListBase *find_chain(KnifeTool_OpData *kcd, ListBase *fedges)
+{
+	Ref *r, *ref;
+	KnifeEdge *kfe;
+	BMVert *v1, *v2;
+	ListBase *ans;
+
+	ans = NULL;
+
+	for (r = fedges->first; r; r = r->next) {
+		kfe = r->ref;
+		v1 = kfe->v1->v;
+		v2 = kfe->v2->v;
+		if (v1 && v2) {
+			ans = knife_empty_list(kcd);
+			knife_append_list(kcd, ans, kfe);
+			break;
+		}
+		if (v1)
+			ans = find_chain_from_vertex(kcd, kfe, v1, fedges);
+		else if (v2)
+			ans = find_chain_from_vertex(kcd, kfe, v2, fedges);
+		if (ans)
+			break;
+	}
+	if (ans) {
+		BLI_assert(BLI_countlist(ans) > 0);
+		for (r = ans->first; r; r = r->next) {
+			ref = find_ref(fedges, r->ref);
+			BLI_assert(ref != NULL);
+			BLI_remlink(fedges, ref);
+		}
+	}
+	return ans;
+}
+
+/* The hole so far goes from kfvfirst to kfv (some may be reversed).
+ * If possible, complete the hole back to kfvfirst and return 1, else return 0.
+ * The visited hash says which KnifeVert's have already been tried, not including kfv or kfvfirst. */
+static int find_hole_search(KnifeTool_OpData *kcd, KnifeVert *kfvfirst, KnifeVert *kfv, ListBase *fedges,
+                            SmallHash *visited, ListBase *hole)
+{
+	Ref *r;
+	KnifeEdge *kfe, *kfelast;
+	KnifeVert *kfv_other;
+
+	if (kfv == kfvfirst)
+		return TRUE;
+
+	BLI_smallhash_insert(visited, (uintptr_t)kfv, NULL);
+	kfelast = ((Ref *)hole->last)->ref;
+	for (r = fedges->first; r; r = r->next) {
+		kfe = r->ref;
+		if (kfe == kfelast)
+			continue;
+		if (kfe->v1->v || kfe->v2->v)
+			continue;
+		kfv_other = NULL;
+		if (kfe->v1 == kfv)
+			kfv_other = kfe->v2;
+		else if (kfe->v2 == kfv)
+			kfv_other = kfe->v1;
+		if (kfv_other && !BLI_smallhash_haskey(visited, (uintptr_t)kfv_other)) {
+			knife_append_list(kcd, hole, kfe);
+			if (find_hole_search(kcd, kfvfirst, kfv_other, fedges, visited, hole))
+				return TRUE;
+			BLI_remlink(hole, hole->last);
+		}
+	}
+	return FALSE;
+}
+
+/* Find a hole (simple cycle with no instantiated vertices).
+ * Remove the edges in the cycle from fedges and return a separate list of the cycle */
+static ListBase *find_hole(KnifeTool_OpData *kcd, ListBase *fedges)
+{
+	ListBase *ans;
+	Ref *r, *ref;
+	KnifeEdge *kfe;
+	SmallHash visited_, *visited = &visited_;
+	int found;
+
+	ans = NULL;
+	found = FALSE;
+
+	for (r = fedges->first; r && !found; r = r->next) {
+		kfe = r->ref;
+		if (kfe->v1->v || kfe->v2->v || kfe->v1 == kfe->v2)
+			continue;
+
+		BLI_smallhash_init(visited);
+		ans = knife_empty_list(kcd);
+		knife_append_list(kcd, ans, kfe);
+
+		found = find_hole_search(kcd, kfe->v1, kfe->v2, fedges, visited, ans);
+
+		BLI_smallhash_release(visited);
+	}
+
+	if (found) {
+		for (r = ans->first; r; r = r->next) {
+			kfe = r->ref;
+			ref = find_ref(fedges, r->ref);
+			if (ref)
+				BLI_remlink(fedges, ref);
+		}
+		return ans;
+	}
+	else {
+		return NULL;
+	}
+}
+
+/* Try to find "nice" diagonals - short, and far apart from each other.
+ * If found, return TRUE and make a 'main chain' going across f which uses
+ * the two diagonals and one part of the hole, and a 'side chain' that
+ * completes the hole. */
+static int find_hole_chains(KnifeTool_OpData *kcd, ListBase *hole, BMFace *f, ListBase **mainchain,
+                            ListBase **sidechain)
+{
+	float **fco, **hco;
+	BMVert **fv;
+	KnifeVert **hv;
+	KnifeEdge **he;
+	Ref *r;
+	KnifeVert *kfv, *kfvother;
+	KnifeEdge *kfe;
+	ListBase *chain;
+	BMVert *v;
+	BMIter iter;
+	int nh, nf, i, j, k, m, ax, ay, ok, sep, bestsep;
+	int besti[2], bestj[2];
+	float d, bestd;
+
+	nh = BLI_countlist(hole);
+	nf = f->len;
+	if (nh < 2 || nf < 3)
+		return 0;
+
+	/* Gather 2d projections of hole and face vertex coordinates.
+	 * Use best-axis projection - not completely accurate, maybe revisit */
+	axis_dominant_v3(&ax, &ay, f->no);
+	hco = BLI_memarena_alloc(kcd->arena, nh * sizeof(float *));
+	fco = BLI_memarena_alloc(kcd->arena, nf * sizeof(float *));
+	hv = BLI_memarena_alloc(kcd->arena, nh * sizeof(KnifeVert *));
+	fv = BLI_memarena_alloc(kcd->arena, nf * sizeof(BMVert *));
+	he = BLI_memarena_alloc(kcd->arena, nh * sizeof(KnifeEdge *));
+
+	i = 0;
+	kfv = NULL;
+	kfvother = NULL;
+	for (r = hole->first; r; r = r->next) {
+		kfe = r->ref;
+		he[i] = kfe;
+		if (kfvother == NULL) {
+			kfv = kfe->v1;
+		}
+		else {
+			kfv = kfvother;
+			BLI_assert(kfv == kfe->v1 || kfv == kfe->v2);
+		}
+		hco[i] = BLI_memarena_alloc(kcd->arena, 2 * sizeof(float));
+		hco[i][0] = kfv->co[ax];
+		hco[i][1] = kfv->co[ay];
+		hv[i] = kfv;
+		kfvother = (kfe->v1 == kfv) ? kfe->v2 : kfe->v1;
+		i++;
+	}
+
+	j = 0;
+	BM_ITER_ELEM (v, &iter, f, BM_VERTS_OF_FACE) {
+		fco[j] = BLI_memarena_alloc(kcd->arena, 2 * sizeof(float));
+		fco[j][0] = v->co[ax];
+		fco[j][1] = v->co[ay];
+		fv[j] = v;
+		j++;
+	}
+
+	/* For first diagonal  (m == 0), want shortest length.
+	 * For second diagonal (m == 1), want max separation of index of hole
+	 * vertex from the hole vertex used in the first diagonal, and from there
+	 * want the one with shortest length not to the same vertex as the first diagonal. */
+	for (m = 0; m < 2; m++) {
+		besti[m] = -1;
+		bestj[m] = -1;
+		bestd = FLT_MAX;
+		bestsep = 0;
+		for (i = 0; i < nh; i++) {
+			if (m == 1) {
+				if (i == besti[0])
+					continue;
+				sep = (i + nh - besti[0]) % nh;
+				sep = MIN2(sep, nh - sep);
+				if (sep < bestsep)
+					continue;
+				bestd = FLT_MAX;
+			}
+			for (j = 0; j < nf; j++) {
+				if (m == 1 && j == bestj[0])
+					continue;
+				d = len_squared_v2v2(hco[i], fco[j]);
+				if (d > bestd)
+					continue;
+
+				ok = TRUE;
+				for (k = 0; k < nh && ok; k++) {
+					if (k == i || (k + 1) % nh == i)
+						continue;
+					if (isect_line_line_v2(hco[i], fco[j], hco[k], hco[(k + 1) % nh]))
+						ok = FALSE;
+				}
+				if (!ok)
+					continue;
+				for (k = 0; k < nf && ok; k++) {
+					if (k == j || (k + 1) % nf == j)
+						continue;
+					if (isect_line_line_v2(hco[i], fco[j], fco[k], fco[(k + 1) % nf]))
+						ok = FALSE;
+				}
+				if (ok) {
+					besti[m] = i;
+					bestj[m] = j;
+					if (m == 1)
+						bestsep = sep;
+					bestd = d;
+				}
+			}
+		}
+	}
+
+	if (besti[0] != -1 && besti[1] != -1) {
+		BLI_assert(besti[0] != besti[1] && bestj[0] != bestj[1]);
+		kfe = new_knife_edge(kcd);
+		kfe->v1 = get_bm_knife_vert(kcd, fv[bestj[0]]);
+		kfe->v2 = hv[besti[0]];
+		chain = knife_empty_list(kcd);
+		knife_append_list(kcd, chain, kfe);
+		for (i = besti[0]; i != besti[1]; i = (i + 1) % nh) {
+			knife_append_list(kcd, chain, he[i]);
+		}
+		kfe = new_knife_edge(kcd);
+		kfe->v1 = hv[besti[1]];
+		kfe->v2 = get_bm_knife_vert(kcd, fv[bestj[1]]);
+		knife_append_list(kcd, chain, kfe);
+		*mainchain = chain;
+
+		chain = knife_empty_list(kcd);
+		for (i = besti[1]; i != besti[0]; i = (i + 1) % nh) {
+			knife_append_list(kcd, chain, he[i]);
+		}
+		*sidechain = chain;
+
+		return TRUE;
+	}
+	else {
+		return FALSE;
+	}
+}
+
+static int knife_edge_in_face(KnifeTool_OpData *UNUSED(kcd), KnifeEdge *kfe, BMFace *f)
+{
+	/* BMesh *bm = kcd->em->bm; */ /* UNUSED */
+	BMVert *v1, *v2;
+	BMLoop *l1, *l2, *l;
+	float mid[3];
+	BMIter iter;
+	int v1inside, v2inside;
+
+	if (!f)
+		return FALSE;
+
+	v1 = kfe->v1->v;
+	v2 = kfe->v2->v;
+	l1 = NULL;
+	l2 = NULL;
+
+	/* find out if v1 and v2, if set, are part of the face */
+	BM_ITER_ELEM (l, &iter, f, BM_LOOPS_OF_FACE) {
+		if (v1 && l->v == v1)
+			l1 = l;
+		if (v2 && l->v == v2)
+			l2 = l;
+	}
+
+	/* BM_face_point_inside_test uses best-axis projection so this isn't most accurate test... */
+	v1inside = l1 ? 0 : BM_face_point_inside_test(f, kfe->v1->co);
+	v2inside = l2 ? 0 : BM_face_point_inside_test(f, kfe->v2->co);
+	if ((l1 && v2inside) || (l2 && v1inside) || (v1inside && v2inside))
+		return TRUE;
+	if (l1 && l2) {
+		/* Can have case where v1 and v2 are on shared chain between two faces.
+		 * BM_face_legal_splits does visibility and self-intersection tests,
+		 * but it is expensive and maybe a bit buggy, so use a simple
+		 * "is the midpoint in the face" test */
+		mid_v3_v3v3(mid, kfe->v1->co, kfe->v2->co);
+		return BM_face_point_inside_test(f, mid);
+	}
+	return FALSE;
+}
+
+/* Split face f with KnifeEdges on chain.  f remains as one side, the face formed is put in *newface.
+ * The new face will be on the left side of the chain as viewed from the normal-out side of f. */
+static void knife_make_chain_cut(KnifeTool_OpData *kcd, BMFace *f, ListBase *chain, BMFace **newface)
+{
+	BMesh *bm = kcd->em->bm;
+	KnifeEdge *kfe, *kfelast;
+	BMVert *v1, *v2;
+	BMFace *fnew;
+	Ref *ref;
+	KnifeVert *kfv, *kfvprev;
+	BMLoop *lnew, *l_iter;
+	int i;
+	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__);
+
+	kfe = ((Ref *)chain->first)->ref;
+	v1 = kfe->v1->v ? kfe->v1->v : kfe->v2->v;
+	kfelast = ((Ref *)chain->last)->ref;
+	v2 = kfelast->v2->v ? kfelast->v2->v : kfelast->v1->v;
+	BLI_assert(v1 != NULL && v2 != NULL);
+	kfvprev = kfe->v1->v == v1 ? kfe->v1 : kfe->v2;
+	for (ref = chain->first, i = 0; i < nco && ref != chain->last; ref = ref->next, i++) {
+		kfe = ref->ref;
+		BLI_assert(kfvprev == kfe->v1 || kfvprev == kfe->v2);
+		kfv = kfe->v1 == kfvprev ? kfe->v2 : kfe->v1;
+		copy_v3_v3(cos[i], kfv->co);
+		kverts[i] = kfv;
+		kfvprev = kfv;
+	}
+	BLI_assert(i == nco);
+	lnew = NULL;
+	if (nco == 0) {
+		/* Want to prevent creating two-sided polygons */
+		if (BM_edge_exists(v1, v2)) {
+			*newface = NULL;
+		}
+		else {
+			*newface = BM_face_split(bm, f, v1, v2, &lnew, NULL, TRUE);
+		}
+	}
+	else {
+		fnew = BM_face_split_n(bm, f, v1, v2, cos, nco, &lnew, NULL);
+		*newface = fnew;
+
+		if (fnew) {
+			/* Now go through lnew chain matching up chain kv's and assign real v's to them */
+			for (l_iter = lnew->next, i = 0; i < nco; l_iter = l_iter->next, i++) {
+				BLI_assert(equals_v3v3(cos[i], l_iter->v->co));
+				if (kcd->select_result) {
+					BM_edge_select_set(bm, l_iter->e, TRUE);
+				}
+				kverts[i]->v = l_iter->v;
+			}
+		}
+	}
+
+	/* the select chain above doesnt account for the first loop */
+	if (kcd->select_result) {
+		if (lnew) {
+			BM_edge_select_set(bm, lnew->e, TRUE);
+		}
+	}
+
+	BLI_array_fixedstack_free(cos);
+	BLI_array_fixedstack_free(kverts);
+}
+
+static void knife_make_face_cuts(KnifeTool_OpData *kcd, BMFace *f, ListBase *kfedges)
+{
+	BMesh *bm = kcd->em->bm;
+	KnifeEdge *kfe;
+	BMFace *fnew, *fnew2, *fhole;
+	ListBase *chain, *hole, *sidechain;
+	ListBase *fnew_kfedges, *fnew2_kfedges;
+	Ref *ref, *refnext;
+	int count, oldcount;
+
+	oldcount = BLI_countlist(kfedges);
+	while ((chain = find_chain(kcd, kfedges)) != NULL) {
+		knife_make_chain_cut(kcd, f, chain, &fnew);
+		if (!fnew) {
+			return;
+		}
+
+		/* Move kfedges to fnew_kfedges if they are now in fnew.
+		 * The chain edges were removed already */
+		fnew_kfedges = knife_empty_list(kcd);
+		for (ref = kfedges->first; ref; ref = refnext) {
+			kfe = ref->ref;
+			refnext = ref->next;
+			if (knife_edge_in_face(kcd, kfe, fnew)) {
+				BLI_remlink(kfedges, ref);
+				kfe->basef = fnew;
+				knife_append_list(kcd, fnew_kfedges, kfe);
+			}
+		}
+		if (fnew_kfedges->first)
+			knife_make_face_cuts(kcd, fnew, fnew_kfedges);
+
+		/* find_chain should always remove edges if it returns TRUE,
+		 * but guard against infinite loop anyway */
+		count = BLI_countlist(kfedges);
+		if (count >= oldcount) {
+			BLI_assert(!"knife find_chain infinite loop");
+			return;
+		}
+		oldcount = count;
+	}
+
+	while ((hole = find_hole(kcd, kfedges)) != NULL) {
+		if (find_hole_chains(kcd, hole, f, &chain, &sidechain)) {
+			/* chain goes across f and sidechain comes back
+			 * from the second last vertex to the second vertex.
+			 */
+			knife_make_chain_cut(kcd, f, chain, &fnew);
+			if (!fnew) {
+				BLI_assert(!"knife failed hole cut");
+				return;
+			}
+			kfe = ((Ref *)sidechain->first)->ref;
+			if (knife_edge_in_face(kcd, kfe, f)) {
+				knife_make_chain_cut(kcd, f, sidechain, &fnew2);
+				fhole = f;
+			}
+			else if (knife_edge_in_face(kcd, kfe, fnew)) {
+				knife_make_chain_cut(kcd, fnew, sidechain, &fnew2);
+				fhole = fnew2;
+			}
+			else {
+				/* shouldn't happen except in funny edge cases */
+				return;
+			}
+			BM_face_kill(bm, fhole);
+			/* Move kfedges to either fnew or fnew2 if appropriate.
+			 * The hole edges were removed already */
+			fnew_kfedges = knife_empty_list(kcd);
+			fnew2_kfedges = knife_empty_list(kcd);
+			for (ref = kfedges->first; ref; ref = refnext) {
+				kfe = ref->ref;
+				refnext = ref->next;
+				if (knife_edge_in_face(kcd, kfe, fnew)) {
+					BLI_remlink(kfedges, ref);
+					kfe->basef = fnew;
+					knife_append_list(kcd, fnew_kfedges, kfe);
+				}
+				else if (knife_edge_in_face(kcd, kfe, fnew2)) {
+					BLI_remlink(kfedges, ref);
+					kfe->basef = fnew2;
+					knife_append_list(kcd, fnew2_kfedges, kfe);
+				}
+			}
+			/* We'll skip knife edges that are in the newly formed hole.
+			 * (Maybe we shouldn't have made a hole in the first place?) */
+			if (fnew != fhole && fnew_kfedges->first)
+				knife_make_face_cuts(kcd, fnew, fnew_kfedges);
+			if (fnew2 != fhole && fnew2_kfedges->first)
+				knife_make_face_cuts(kcd, fnew2, fnew2_kfedges);
+			if (f == fhole)
+				break;
+			/* find_hole should always remove edges if it returns TRUE,
+			 * but guard against infinite loop anyway */
+			count = BLI_countlist(kfedges);
+			if (count >= oldcount) {
+				BLI_assert(!"knife find_hole infinite loop");
+				return;
+			}
+			oldcount = count;
+		}
+	}
+}
+
+/* Use the network of KnifeEdges and KnifeVerts accumulated to make real BMVerts and BMEdedges */
+static void knife_make_cuts(KnifeTool_OpData *kcd)
+{
+	BMesh *bm = kcd->em->bm;
+	KnifeEdge *kfe;
+	KnifeVert *kfv;
+	BMFace *f;
+	BMEdge *e, *enew;
+	ListBase *lst;
+	Ref *ref;
+	float pct;
+	SmallHashIter hiter;
+	BLI_mempool_iter iter;
+	SmallHash fhash_, *fhash = &fhash_;
+	SmallHash ehash_, *ehash = &ehash_;
+
+	BLI_smallhash_init(fhash);
+	BLI_smallhash_init(ehash);
+
+	/* put list of cutting edges for a face into fhash, keyed by face */
+	BLI_mempool_iternew(kcd->kedges, &iter);
+	for (kfe = BLI_mempool_iterstep(&iter); kfe; kfe = BLI_mempool_iterstep(&iter)) {
+		f = kfe->basef;
+		if (!f || kfe->e)
+			continue;
+		lst = BLI_smallhash_lookup(fhash, (uintptr_t)f);
+		if (!lst) {
+			lst = knife_empty_list(kcd);
+			BLI_smallhash_insert(fhash, (uintptr_t)f, lst);
+		}
+		knife_append_list(kcd, lst, kfe);
+	}
+
+	/* put list of splitting vertices for an edge into ehash, keyed by edge */
+	BLI_mempool_iternew(kcd->kverts, &iter);
+	for (kfv = BLI_mempool_iterstep(&iter); kfv; kfv = BLI_mempool_iterstep(&iter)) {
+		if (kfv->v)
+			continue;  /* already have a BMVert */
+		for (ref = kfv->edges.first; ref; ref = ref->next) {
+			kfe = ref->ref;
+			e = kfe->e;
+			if (!e)
+				continue;
+			lst = BLI_smallhash_lookup(ehash, (uintptr_t)e);
+			if (!lst) {
+				lst = knife_empty_list(kcd);
+				BLI_smallhash_insert(ehash, (uintptr_t)e, lst);
+			}
+			/* there can be more than one kfe in kfv's list with same e */
+			if (!find_ref(lst, kfv))
+				knife_append_list(kcd, lst, kfv);
+		}
+	}
+
+	/* split bmesh edges where needed */
+	for (lst = BLI_smallhash_iternew(ehash, &hiter, (uintptr_t *)&e); lst;
+	     lst = BLI_smallhash_iternext(&hiter, (uintptr_t *)&e))
+	{
+		sort_by_frac_along(lst, e);
+		for (ref = lst->first; ref; ref = ref->next) {
+			kfv = ref->ref;
+			pct = frac_along(e->v1->co, e->v2->co, kfv->co);
+			kfv->v = BM_edge_split(bm, e, e->v1, &enew, pct);
+		}
+	}
+
+	if (kcd->only_select) {
+		EDBM_flag_disable_all(kcd->em, BM_ELEM_SELECT);
+	}
+
+	/* do cuts for each face */
+	for (lst = BLI_smallhash_iternew(fhash, &hiter, (uintptr_t *)&f); lst;
+	     lst = BLI_smallhash_iternext(&hiter, (uintptr_t *)&f))
+	{
+		knife_make_face_cuts(kcd, f, lst);
+	}
+
+	BLI_smallhash_release(fhash);
+	BLI_smallhash_release(ehash);
+}
+#endif
+
+/* called on tool confirmation */
+static void knifetool_finish(bContext *C, wmOperator *op)
+{
+	KnifeTool_OpData *kcd = op->customdata;
+
+#if SCANFILL_CUTS
+	knifenet_fill_faces(kcd);
+#else
+	knife_make_cuts(kcd);
+#endif
+
+	EDBM_update_generic(C, kcd->em, TRUE);
+}
+
+/* copied from paint_image.c */
+static int project_knife_view_clip(View3D *v3d, RegionView3D *rv3d, float *clipsta, float *clipend)
+{
+	int orth = ED_view3d_clip_range_get(v3d, rv3d, clipsta, clipend);
+
+	if (orth) { /* only needed for ortho */
+		float fac = 2.0f / ((*clipend) - (*clipsta));
+		*clipsta *= fac;
+		*clipend *= fac;
+	}
+
+	return orth;
+}
+
+static void knife_recalc_projmat(KnifeTool_OpData *kcd)
+{
+	invert_m4_m4(kcd->ob->imat, kcd->ob->obmat);
+	ED_view3d_ob_project_mat_get(kcd->ar->regiondata, kcd->ob, kcd->projmat);
+	//mult_m4_m4m4(kcd->projmat, kcd->vc.rv3d->winmat, kcd->vc.rv3d->viewmat);
+
+	kcd->is_ortho = project_knife_view_clip(kcd->vc.v3d, kcd->vc.rv3d, 
+	                                        &kcd->clipsta, &kcd->clipend);
+}
+
+/* called when modal loop selection is done... */
+static void knifetool_exit(bContext *C, wmOperator *op)
+{
+	KnifeTool_OpData *kcd = op->customdata;
+
+	if (!kcd)
+		return;
+
+	WM_cursor_restore(CTX_wm_window(C));
+
+	/* deactivate the extra drawing stuff in 3D-View */
+	ED_region_draw_cb_exit(kcd->ar->type, kcd->draw_handle);
+
+	/* free the custom data */
+	BLI_mempool_destroy(kcd->refs);
+	BLI_mempool_destroy(kcd->kverts);
+	BLI_mempool_destroy(kcd->kedges);
+
+	BLI_ghash_free(kcd->origedgemap, NULL, NULL);
+	BLI_ghash_free(kcd->origvertmap, NULL, NULL);
+	BLI_ghash_free(kcd->kedgefacemap, NULL, NULL);
+
+	BMBVH_FreeBVH(kcd->bmbvh);
+	BLI_memarena_free(kcd->arena);
+
+	/* tag for redraw */
+	ED_region_tag_redraw(kcd->ar);
+
+	if (kcd->cagecos)
+		MEM_freeN(kcd->cagecos);
+
+	if (kcd->linehits)
+		MEM_freeN(kcd->linehits);
+
+	/* destroy kcd itself */
+	MEM_freeN(kcd);
+	op->customdata = NULL;
+}
+
+static void cage_mapped_verts_callback(void *userData, int index, const float co[3],
+                                       const float UNUSED(no_f[3]), const short UNUSED(no_s[3]))
+{
+	void **data = userData;
+	BMEditMesh *em = data[0];
+	float (*cagecos)[3] = data[1];
+	SmallHash *hash = data[2];
+
+	if (index >= 0 && index < em->bm->totvert && !BLI_smallhash_haskey(hash, index)) {
+		BLI_smallhash_insert(hash, index, NULL);
+		copy_v3_v3(cagecos[index], co);
+	}
+}
+
+static void knifetool_update_mval(KnifeTool_OpData *kcd, int mval[2])
+{
+	knife_recalc_projmat(kcd);
+	kcd->vc.mval[0] = mval[0];
+	kcd->vc.mval[1] = mval[1];
+
+	if (knife_update_active(kcd)) {
+		ED_region_tag_redraw(kcd->ar);
+	}
+}
+
+/* called when modal loop selection gets set up... */
+static int knifetool_init(bContext *C, wmOperator *op, int UNUSED(do_cut))
+{
+	KnifeTool_OpData *kcd;
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit = CTX_data_edit_object(C);
+	DerivedMesh *cage, *final;
+	SmallHash shash;
+	void *data[3];
+	const short only_select = RNA_boolean_get(op->ptr, "only_select");
+
+	/* alloc new customdata */
+	kcd = op->customdata = MEM_callocN(sizeof(KnifeTool_OpData), "knifetool Modal Op Data");
+
+	/* assign the drawing handle for drawing preview line... */
+	kcd->ob = obedit;
+	kcd->ar = CTX_wm_region(C);
+	kcd->draw_handle = ED_region_draw_cb_activate(kcd->ar->type, knifetool_draw, kcd, REGION_DRAW_POST_VIEW);
+	em_setup_viewcontext(C, &kcd->vc);
+
+	kcd->em = BMEdit_FromObject(kcd->ob);
+
+	BM_mesh_elem_index_ensure(kcd->em->bm, BM_VERT);
+
+	cage = editbmesh_get_derived_cage_and_final(scene, obedit, kcd->em, &final, CD_MASK_DERIVEDMESH);
+	kcd->cagecos = MEM_callocN(sizeof(float) * 3 * kcd->em->bm->totvert, "knife cagecos");
+	data[0] = kcd->em;
+	data[1] = kcd->cagecos;
+	data[2] = &shash;
+
+	BLI_smallhash_init(&shash);
+	cage->foreachMappedVert(cage, cage_mapped_verts_callback, data);
+	BLI_smallhash_release(&shash);
+
+	kcd->bmbvh = BMBVH_NewBVH(kcd->em,
+	                          (BMBVH_USE_CAGE | BMBVH_RETURN_ORIG) |
+	                          (only_select ? BMBVH_RESPECT_SELECT : BMBVH_RESPECT_HIDDEN),
+	                          scene, obedit);
+
+	kcd->arena = BLI_memarena_new(1 << 15, "knife");
+	kcd->vthresh = KMAXDIST - 1;
+	kcd->ethresh = KMAXDIST;
+
+	kcd->extend = 1;
+
+	knife_recalc_projmat(kcd);
+
+	ED_region_tag_redraw(kcd->ar);
+
+	kcd->refs = BLI_mempool_create(sizeof(Ref), 1, 2048, 0);
+	kcd->kverts = BLI_mempool_create(sizeof(KnifeVert), 1, 512, BLI_MEMPOOL_ALLOW_ITER);
+	kcd->kedges = BLI_mempool_create(sizeof(KnifeEdge), 1, 512, BLI_MEMPOOL_ALLOW_ITER);
+
+	kcd->origedgemap = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "knife origedgemap");
+	kcd->origvertmap = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "knife origvertmap");
+	kcd->kedgefacemap = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "knife origvertmap");
+
+	/* cut all the way through the mesh if use_occlude_geometry button not pushed */
+	kcd->cut_through = !RNA_boolean_get(op->ptr, "use_occlude_geometry");
+	kcd->only_select = only_select;
+
+	/* can't usefully select resulting edges in face mode */
+	kcd->select_result = (kcd->em->selectmode != SCE_SELECT_FACE);
+
+	knife_pos_data_clear(&kcd->cur);
+	knife_pos_data_clear(&kcd->prev);
+
+	knife_init_colors(&kcd->colors);
+
+	return 1;
+}
+
+static int knifetool_cancel(bContext *C, wmOperator *op)
+{
+	/* this is just a wrapper around exit() */
+	knifetool_exit(C, op);
+	return OPERATOR_CANCELLED;
+}
+
+static int knifetool_invoke(bContext *C, wmOperator *op, wmEvent *evt)
+{
+	KnifeTool_OpData *kcd;
+
+	view3d_operator_needs_opengl(C);
+
+	if (!knifetool_init(C, op, 0))
+		return OPERATOR_CANCELLED;
+
+	/* add a modal handler for this operator - handles loop selection */
+	WM_cursor_modal(CTX_wm_window(C), BC_KNIFECURSOR);
+	WM_event_add_modal_handler(C, op);
+
+	kcd = op->customdata;
+	knifetool_update_mval(kcd, evt->mval);
+
+	knife_update_header(C, kcd);
+
+	return OPERATOR_RUNNING_MODAL;
+}
+
+enum {
+	KNF_MODAL_CANCEL = 1,
+	KNF_MODAL_CONFIRM,
+	KNF_MODAL_MIDPOINT_ON,
+	KNF_MODAL_MIDPOINT_OFF,
+	KNF_MODAL_NEW_CUT,
+	KNF_MODEL_IGNORE_SNAP_ON,
+	KNF_MODEL_IGNORE_SNAP_OFF,
+	KNF_MODAL_ADD_CUT,
+	KNF_MODAL_ANGLE_SNAP_TOGGLE,
+	KNF_MODAL_CUT_THROUGH_TOGGLE
+};
+
+wmKeyMap *knifetool_modal_keymap(wmKeyConfig *keyconf)
+{
+	static EnumPropertyItem modal_items[] = {
+		{KNF_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
+		{KNF_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""},
+		{KNF_MODAL_MIDPOINT_ON, "SNAP_MIDPOINTS_ON", 0, "Snap To Midpoints On", ""},
+		{KNF_MODAL_MIDPOINT_OFF, "SNAP_MIDPOINTS_OFF", 0, "Snap To Midpoints Off", ""},
+		{KNF_MODEL_IGNORE_SNAP_ON, "IGNORE_SNAP_ON", 0, "Ignore Snapping On", ""},
+		{KNF_MODEL_IGNORE_SNAP_OFF, "IGNORE_SNAP_OFF", 0, "Ignore Snapping Off", ""},
+		{KNF_MODAL_ANGLE_SNAP_TOGGLE, "ANGLE_SNAP_TOGGLE", 0, "Toggle Angle Snapping", ""},
+		{KNF_MODAL_CUT_THROUGH_TOGGLE, "CUT_THROUGH_TOGGLE", 0, "Toggle Cut Through", ""},
+		{KNF_MODAL_NEW_CUT, "NEW_CUT", 0, "End Current Cut", ""},
+		{KNF_MODAL_ADD_CUT, "ADD_CUT", 0, "Add Cut", ""},
+		{0, NULL, 0, NULL, NULL}};
+
+	wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Knife Tool Modal Map");
+
+	/* this function is called for each spacetype, only needs to add map once */
+	if (keymap && keymap->modal_items)
+		return NULL;
+
+	keymap = WM_modalkeymap_add(keyconf, "Knife Tool Modal Map", modal_items);
+
+	/* items for modal map */
+	WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, KNF_MODAL_CANCEL);
+	WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, KM_ANY, 0, KNF_MODAL_ADD_CUT);
+	WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_PRESS, KM_ANY, 0, KNF_MODAL_CANCEL);
+	WM_modalkeymap_add_item(keymap, RETKEY, KM_PRESS, KM_ANY, 0, KNF_MODAL_CONFIRM);
+	WM_modalkeymap_add_item(keymap, PADENTER, KM_PRESS, KM_ANY, 0, KNF_MODAL_CONFIRM);
+	WM_modalkeymap_add_item(keymap, SPACEKEY, KM_PRESS, KM_ANY, 0, KNF_MODAL_CONFIRM);
+	WM_modalkeymap_add_item(keymap, EKEY, KM_PRESS, 0, 0, KNF_MODAL_NEW_CUT);
+
+	WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_PRESS, KM_ANY, 0, KNF_MODAL_MIDPOINT_ON);
+	WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_RELEASE, KM_ANY, 0, KNF_MODAL_MIDPOINT_OFF);
+	WM_modalkeymap_add_item(keymap, RIGHTCTRLKEY, KM_PRESS, KM_ANY, 0, KNF_MODAL_MIDPOINT_ON);
+	WM_modalkeymap_add_item(keymap, RIGHTCTRLKEY, KM_RELEASE, KM_ANY, 0, KNF_MODAL_MIDPOINT_OFF);
+
+	WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_PRESS, KM_ANY, 0, KNF_MODEL_IGNORE_SNAP_ON);
+	WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_RELEASE, KM_ANY, 0, KNF_MODEL_IGNORE_SNAP_OFF);
+	WM_modalkeymap_add_item(keymap, RIGHTSHIFTKEY, KM_PRESS, KM_ANY, 0, KNF_MODEL_IGNORE_SNAP_ON);
+	WM_modalkeymap_add_item(keymap, RIGHTSHIFTKEY, KM_RELEASE, KM_ANY, 0, KNF_MODEL_IGNORE_SNAP_OFF);
+
+	WM_modalkeymap_add_item(keymap, CKEY, KM_PRESS, 0, 0, KNF_MODAL_ANGLE_SNAP_TOGGLE);
+	WM_modalkeymap_add_item(keymap, ZKEY, KM_PRESS, 0, 0, KNF_MODAL_CUT_THROUGH_TOGGLE);
+
+	WM_modalkeymap_assign(keymap, "MESH_OT_knife_tool");
+
+	return keymap;
+}
+
+static int knifetool_modal(bContext *C, wmOperator *op, wmEvent *event)
+{
+	Object *obedit;
+	KnifeTool_OpData *kcd = op->customdata;
+
+	if (!C) {
+		return OPERATOR_FINISHED;
+	}
+
+	obedit = CTX_data_edit_object(C);
+	if (!obedit || obedit->type != OB_MESH || BMEdit_FromObject(obedit) != kcd->em) {
+		knifetool_exit(C, op);
+		ED_area_headerprint(CTX_wm_area(C), NULL);
+		return OPERATOR_FINISHED;
+	}
+
+	view3d_operator_needs_opengl(C);
+
+	if (kcd->mode == MODE_PANNING)
+		kcd->mode = kcd->prevmode;
+
+	/* handle modal keymap */
+	if (event->type == EVT_MODAL_MAP) {
+		switch (event->val) {
+			case KNF_MODAL_CANCEL:
+				/* finish */
+				ED_region_tag_redraw(kcd->ar);
+
+				knifetool_exit(C, op);
+				ED_area_headerprint(CTX_wm_area(C), NULL);
+
+				return OPERATOR_CANCELLED;
+			case KNF_MODAL_CONFIRM:
+				/* finish */
+				ED_region_tag_redraw(kcd->ar);
+
+				knifetool_finish(C, op);
+				knifetool_exit(C, op);
+				ED_area_headerprint(CTX_wm_area(C), NULL);
+
+				return OPERATOR_FINISHED;
+			case KNF_MODAL_MIDPOINT_ON:
+				kcd->snap_midpoints = 1;
+
+				knife_recalc_projmat(kcd);
+				knife_update_active(kcd);
+				knife_update_header(C, kcd);
+				ED_region_tag_redraw(kcd->ar);
+				break;
+			case KNF_MODAL_MIDPOINT_OFF:
+				kcd->snap_midpoints = 0;
+
+				knife_recalc_projmat(kcd);
+				knife_update_active(kcd);
+				knife_update_header(C, kcd);
+				ED_region_tag_redraw(kcd->ar);
+				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);
+				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);
+				break;
+			case KNF_MODAL_ANGLE_SNAP_TOGGLE:
+				kcd->angle_snapping = !kcd->angle_snapping;
+				knife_update_header(C, kcd);
+				break;
+			case KNF_MODAL_CUT_THROUGH_TOGGLE:
+				kcd->cut_through = !kcd->cut_through;
+				knife_update_header(C, kcd);
+				break;
+			case KNF_MODAL_NEW_CUT:
+				ED_region_tag_redraw(kcd->ar);
+				knife_finish_cut(kcd);
+				kcd->mode = MODE_IDLE;
+				break;
+			case KNF_MODAL_ADD_CUT:
+				knife_recalc_projmat(kcd);
+
+				if (kcd->mode == MODE_DRAGGING) {
+					knife_add_cut(kcd);
+					if (!kcd->extend) {
+						knife_finish_cut(kcd);
+						kcd->mode = MODE_IDLE;
+					}
+				}
+				else if (kcd->mode != MODE_PANNING) {
+					knife_start_cut(kcd);
+					kcd->mode = MODE_DRAGGING;
+				}
+
+				ED_region_tag_redraw(kcd->ar);
+				break;
+		}
+	}
+	else { /* non-modal-mapped events */
+		switch (event->type) {
+			case WHEELUPMOUSE:
+			case WHEELDOWNMOUSE:
+				return OPERATOR_PASS_THROUGH;
+			case MIDDLEMOUSE:
+				if (event->val != KM_RELEASE) {
+					if (kcd->mode != MODE_PANNING)
+						kcd->prevmode = kcd->mode;
+					kcd->mode = MODE_PANNING;
+				}
+				else {
+					kcd->mode = kcd->prevmode;
+				}
+
+				ED_region_tag_redraw(kcd->ar);
+				return OPERATOR_PASS_THROUGH;
+
+			case MOUSEMOVE: /* mouse moved somewhere to select another loop */
+				if (kcd->mode != MODE_PANNING) {
+					knifetool_update_mval(kcd, event->mval);
+				}
+
+				break;
+		}
+	}
+
+	/* keep going until the user confirms */
+	return OPERATOR_RUNNING_MODAL;
+}
+
+void MESH_OT_knife_tool(wmOperatorType *ot)
+{
+	/* description */
+	ot->name = "Knife Topology Tool";
+	ot->idname = "MESH_OT_knife_tool";
+	ot->description = "Cut new topology";
+
+	/* callbacks */
+	ot->invoke = knifetool_invoke;
+	ot->modal = knifetool_modal;
+	ot->cancel = knifetool_cancel;
+	ot->poll = ED_operator_editmesh_view3d;
+
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
+
+	RNA_def_boolean(ot->srna, "use_occlude_geometry", TRUE, "Occlude Geometry", "Only cut the front most geometry");
+	RNA_def_boolean(ot->srna, "only_select", FALSE, "Only Selected", "Only cut selected geometry");
+}
diff --git a/source/blender/editors/mesh/editmesh_lib.c b/source/blender/editors/mesh/editmesh_lib.c
deleted file mode 100644
index 5ec147a..0000000
--- a/source/blender/editors/mesh/editmesh_lib.c
+++ /dev/null
@@ -1,3070 +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) 2004 by Blender Foundation
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/mesh/editmesh_lib.c
- *  \ingroup edmesh
- */
-
-
-/*
-
-editmesh_lib: generic (no UI, no menus) operations/evaluators for editmesh data
-
-*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_meshdata_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
-#include "BLI_editVert.h"
-#include "BLI_edgehash.h"
-#include "BLI_utildefines.h"
-
-#include "BKE_customdata.h"
-#include "BKE_context.h"
-#include "BKE_global.h"
-#include "BKE_mesh.h"
-
-
-#include "ED_mesh.h"
-#include "ED_screen.h"
-#include "ED_view3d.h"
-#include "ED_transform.h"
-
-#include "mesh_intern.h"
-
-/* Helpers for EM_set_flag_all_selectmode */
-#define SET_EVE_FLAG(eve, flag) \
-	if (eve->h==0) { \
-		if (flag & SELECT && !(eve->f & SELECT)) { \
-			++selvert; \
-		} \
-		eve->f |= flag; \
-	}
-
-#define SET_EED_FLAG(eed, flag) \
-	if (eed->h==0) { \
-		if (flag & SELECT && !(eed->f & SELECT)) { \
-			++seledge; \
-		} \
-		eed->f |= flag; \
-		SET_EVE_FLAG(eed->v1, flag); \
-		SET_EVE_FLAG(eed->v2, flag); \
-	}
-
-
-/* ****************** stats *************** */
-
-int EM_nfaces_selected(EditMesh *em)
-{
-	EditFace *efa;
-	int count= 0;
-	
-	for (efa= em->faces.first; efa; efa= efa->next)
-		if (efa->f & SELECT)
-			count++;
-	
-	em->totfacesel= count;
-	
-	return count;
-}
-
-int EM_nedges_selected(EditMesh *em)
-{
-	EditEdge *eed;
-	int count= 0;
-	
-	for (eed= em->edges.first; eed; eed= eed->next) 
-		if(eed->f & SELECT)
-			count++;
-	
-	em->totedgesel= count;
-	
-	return count;
-}
-
-int EM_nvertices_selected(EditMesh *em)
-{
-	EditVert *eve;
-	int count= 0;
-	
-	for (eve= em->verts.first; eve; eve= eve->next)
-		if (eve->f & SELECT)
-			count++;
-	
-	em->totvertsel= count;
-	
-	return count;
-}
-
-void EM_stats_update(EditMesh *em)
-{
-	
-	em->totvert= BLI_countlist(&em->verts);
-	em->totedge= BLI_countlist(&em->edges);
-	em->totface= BLI_countlist(&em->faces);
-	
-	EM_nvertices_selected(em);
-	EM_nedges_selected(em);
-	EM_nfaces_selected(em);
-}
-
-/* ************************************** */
-
-/* this replaces the active flag used in uv/face mode */
-void EM_set_actFace(EditMesh *em, EditFace *efa)
-{
-	em->act_face = efa;
-}
-
-EditFace *EM_get_actFace(EditMesh *em, int sloppy)
-{
-	if (em->act_face) {
-		return em->act_face;
-	} else if (sloppy) {
-		EditFace *efa= NULL;
-		EditSelection *ese;
-		
-		ese = em->selected.last;
-		for (; ese; ese=ese->prev){
-			if(ese->type == EDITFACE) {
-				efa = (EditFace *)ese->data;
-				
-				if (efa->h)	efa= NULL;
-				else		break;
-			}
-		}
-		if (efa==NULL) {
-			for (efa= em->faces.first; efa; efa= efa->next) {
-				if (efa->f & SELECT)
-					break;
-			}
-		}
-		return efa; /* can still be null */
-	}
-	return NULL;
-}
-
-int EM_get_actSelection(EditMesh *em, EditSelection *ese)
-{
-	EditSelection *ese_last = em->selected.last;
-	EditFace *efa = EM_get_actFace(em, 0);
-
-	ese->next = ese->prev = NULL;
-	
-	if (ese_last) {
-		if (ese_last->type == EDITFACE) { /* if there is an active face, use it over the last selected face */
-			if (efa) {
-				ese->data = (void *)efa;
-			} else {
-				ese->data = ese_last->data;
-			}
-			ese->type = EDITFACE;
-		} else {
-			ese->data = ese_last->data;
-			ese->type = ese_last->type;
-		}
-	} else if (efa) { /* no */
-		ese->data = (void *)efa;
-		ese->type = EDITFACE;
-	} else {
-		ese->data = NULL;
-		return 0;
-	}
-	return 1;
-}
-
-/* ********* Selection History ************ */
-static int EM_check_selection(EditMesh *em, void *data)
-{
-	EditSelection *ese;
-	
-	for(ese = em->selected.first; ese; ese = ese->next){
-		if(ese->data == data) return 1;
-	}
-	
-	return 0;
-}
-
-void EM_remove_selection(EditMesh *em, void *data, int UNUSED(type))
-{
-	EditSelection *ese;
-	for(ese=em->selected.first; ese; ese = ese->next){
-		if(ese->data == data){
-			BLI_freelinkN(&(em->selected),ese);
-			break;
-		}
-	}
-}
-
-void EM_store_selection(EditMesh *em, void *data, int type)
-{
-	EditSelection *ese;
-	if(!EM_check_selection(em, data)){
-		ese = (EditSelection*) MEM_callocN( sizeof(EditSelection), "Edit Selection");
-		ese->type = type;
-		ese->data = data;
-		BLI_addtail(&(em->selected),ese);
-	}
-}
-
-void EM_validate_selections(EditMesh *em)
-{
-	EditSelection *ese, *nextese;
-
-	ese = em->selected.first;
-
-	while(ese){
-		nextese = ese->next;
-		if(ese->type == EDITVERT && !(((EditVert*)ese->data)->f & SELECT)) BLI_freelinkN(&(em->selected), ese);
-		else if(ese->type == EDITEDGE && !(((EditEdge*)ese->data)->f & SELECT)) BLI_freelinkN(&(em->selected), ese);
-		else if(ese->type == EDITFACE && !(((EditFace*)ese->data)->f & SELECT)) BLI_freelinkN(&(em->selected), ese);
-		ese = nextese;
-	}
-}
-
-static void EM_strip_selections(EditMesh *em)
-{
-	EditSelection *ese, *nextese;
-	if(!(em->selectmode & SCE_SELECT_VERTEX)){
-		ese = em->selected.first;
-		while(ese){
-			nextese = ese->next; 
-			if(ese->type == EDITVERT) BLI_freelinkN(&(em->selected),ese);
-			ese = nextese;
-		}
-	}
-	if(!(em->selectmode & SCE_SELECT_EDGE)){
-		ese=em->selected.first;
-		while(ese){
-			nextese = ese->next;
-			if(ese->type == EDITEDGE) BLI_freelinkN(&(em->selected), ese);
-			ese = nextese;
-		}
-	}
-	if(!(em->selectmode & SCE_SELECT_FACE)){
-		ese=em->selected.first;
-		while(ese){
-			nextese = ese->next;
-			if(ese->type == EDITFACE) BLI_freelinkN(&(em->selected), ese);
-			ese = nextese;
-		}
-	}
-}
-
-/* generic way to get data from an EditSelection type 
-These functions were written to be used by the Modifier widget when in Rotate about active mode,
-but can be used anywhere.
-EM_editselection_center
-EM_editselection_normal
-EM_editselection_plane
-*/
-void EM_editselection_center(float *center, EditSelection *ese)
-{
-	if (ese->type==EDITVERT) {
-		EditVert *eve= ese->data;
-		copy_v3_v3(center, eve->co);
-	} else if (ese->type==EDITEDGE) {
-		EditEdge *eed= ese->data;
-		add_v3_v3v3(center, eed->v1->co, eed->v2->co);
-		mul_v3_fl(center, 0.5);
-	} else if (ese->type==EDITFACE) {
-		EditFace *efa= ese->data;
-		copy_v3_v3(center, efa->cent);
-	}
-}
-
-void EM_editselection_normal(float *normal, EditSelection *ese)
-{
-	if (ese->type==EDITVERT) {
-		EditVert *eve= ese->data;
-		copy_v3_v3(normal, eve->no);
-	} else if (ese->type==EDITEDGE) {
-		EditEdge *eed= ese->data;
-		float plane[3]; /* need a plane to correct the normal */
-		float vec[3]; /* temp vec storage */
-		
-		add_v3_v3v3(normal, eed->v1->no, eed->v2->no);
-		sub_v3_v3v3(plane, eed->v2->co, eed->v1->co);
-		
-		/* the 2 vertex normals will be close but not at rightangles to the edge
-		for rotate about edge we want them to be at right angles, so we need to
-		do some extra colculation to correct the vert normals,
-		we need the plane for this */
-		cross_v3_v3v3(vec, normal, plane);
-		cross_v3_v3v3(normal, plane, vec); 
-		normalize_v3(normal);
-		
-	} else if (ese->type==EDITFACE) {
-		EditFace *efa= ese->data;
-		copy_v3_v3(normal, efa->n);
-	}
-}
-
-/* Calculate a plane that is rightangles to the edge/vert/faces normal
-also make the plane run along an axis that is related to the geometry,
-because this is used for the manipulators Y axis.*/
-void EM_editselection_plane(float *plane, EditSelection *ese)
-{
-	if (ese->type==EDITVERT) {
-		EditVert *eve= ese->data;
-		float vec[3]={0,0,0};
-		
-		if (ese->prev) { /*use previously selected data to make a useful vertex plane */
-			EM_editselection_center(vec, ese->prev);
-			sub_v3_v3v3(plane, vec, eve->co);
-		} else {
-			/* make a fake  plane thats at rightangles to the normal
-			we cant make a crossvec from a vec thats the same as the vec
-			unlikely but possible, so make sure if the normal is (0,0,1)
-			that vec isnt the same or in the same direction even.*/
-			if (eve->no[0]<0.5f)		vec[0]=1;
-			else if (eve->no[1]<0.5f)	vec[1]=1;
-			else						vec[2]=1;
-			cross_v3_v3v3(plane, eve->no, vec);
-		}
-	} else if (ese->type==EDITEDGE) {
-		EditEdge *eed= ese->data;
-
-		/*the plane is simple, it runs along the edge
-		however selecting different edges can swap the direction of the y axis.
-		this makes it less likely for the y axis of the manipulator
-		(running along the edge).. to flip less often.
-		at least its more predictable */
-		if (eed->v2->co[1] > eed->v1->co[1]) /*check which to do first */
-			sub_v3_v3v3(plane, eed->v2->co, eed->v1->co);
-		else
-			sub_v3_v3v3(plane, eed->v1->co, eed->v2->co);
-		
-	} else if (ese->type==EDITFACE) {
-		EditFace *efa= ese->data;
-		float vec[3];
-		if (efa->v4) { /*if its a quad- set the plane along the 2 longest edges.*/
-			float vecA[3], vecB[3];
-			sub_v3_v3v3(vecA, efa->v4->co, efa->v3->co);
-			sub_v3_v3v3(vecB, efa->v1->co, efa->v2->co);
-			add_v3_v3v3(plane, vecA, vecB);
-			
-			sub_v3_v3v3(vecA, efa->v1->co, efa->v4->co);
-			sub_v3_v3v3(vecB, efa->v2->co, efa->v3->co);
-			add_v3_v3v3(vec, vecA, vecB);						
-			/*use the biggest edge length*/
-			if (plane[0]*plane[0]+plane[1]*plane[1]+plane[2]*plane[2] < vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2])
-				copy_v3_v3(plane, vec);
-		} else {
-			/*start with v1-2 */
-			sub_v3_v3v3(plane, efa->v1->co, efa->v2->co);
-			
-			/*test the edge between v2-3, use if longer */
-			sub_v3_v3v3(vec, efa->v2->co, efa->v3->co);
-			if (plane[0]*plane[0]+plane[1]*plane[1]+plane[2]*plane[2] < vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2])
-				copy_v3_v3(plane, vec);
-			
-			/*test the edge between v1-3, use if longer */
-			sub_v3_v3v3(vec, efa->v3->co, efa->v1->co);
-			if (plane[0]*plane[0]+plane[1]*plane[1]+plane[2]*plane[2] < vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2])
-				copy_v3_v3(plane, vec);
-		}
-	}
-	normalize_v3(plane);
-}
-
-
-
-void EM_select_face(EditFace *efa, int sel)
-{
-	if(sel) {
-		efa->f |= SELECT;
-		efa->e1->f |= SELECT;
-		efa->e2->f |= SELECT;
-		efa->e3->f |= SELECT;
-		if(efa->e4) efa->e4->f |= SELECT;
-		efa->v1->f |= SELECT;
-		efa->v2->f |= SELECT;
-		efa->v3->f |= SELECT;
-		if(efa->v4) efa->v4->f |= SELECT;
-	}
-	else {
-		efa->f &= ~SELECT;
-		efa->e1->f &= ~SELECT;
-		efa->e2->f &= ~SELECT;
-		efa->e3->f &= ~SELECT;
-		if(efa->e4) efa->e4->f &= ~SELECT;
-		efa->v1->f &= ~SELECT;
-		efa->v2->f &= ~SELECT;
-		efa->v3->f &= ~SELECT;
-		if(efa->v4) efa->v4->f &= ~SELECT;
-	}
-}
-
-void EM_select_edge(EditEdge *eed, int sel)
-{
-	if(sel) {
-		eed->f |= SELECT;
-		eed->v1->f |= SELECT;
-		eed->v2->f |= SELECT;
-	}
-	else {
-		eed->f &= ~SELECT;
-		eed->v1->f &= ~SELECT;
-		eed->v2->f &= ~SELECT;
-	}
-}
-
-void EM_select_face_fgon(EditMesh *em, EditFace *efa, int val)
-{
-	short index=0;
-	
-	if(efa->fgonf==0) EM_select_face(efa, val);
-	else {
-		if(efa->e1->fgoni) index= efa->e1->fgoni;
-		if(efa->e2->fgoni) index= efa->e2->fgoni;
-		if(efa->e3->fgoni) index= efa->e3->fgoni;
-		if(efa->v4 && efa->e4->fgoni) index= efa->e4->fgoni;
-		
-		if((index==0) && (G.f & G_DEBUG))printf("wrong fgon select\n");
-		
-		// select all ngon faces with index
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->fgonf) {
-				if(efa->e1->fgoni==index || efa->e2->fgoni==index || 
-				   efa->e3->fgoni==index || (efa->e4 && efa->e4->fgoni==index) ) {
-					EM_select_face(efa, val);
-				}
-			}
-		}
-	}
-}
-
-
-/* only vertices */
-int faceselectedOR(EditFace *efa, int flag)
-{
-	if ((efa->v1->f | efa->v2->f | efa->v3->f | (efa->v4?efa->v4->f:0))&flag) {
-		return 1;
-	} else {
-		return 0;
-	}
-}
-
-// replace with (efa->f & SELECT)
-int faceselectedAND(EditFace *efa, int flag)
-{
-	if ((efa->v1->f & efa->v2->f & efa->v3->f & (efa->v4?efa->v4->f:flag))&flag) {
-		return 1;
-	} else {
-		return 0;
-	}
-}
-
-void EM_clear_flag_all(EditMesh *em, int flag)
-{
-	EditVert *eve;
-	EditEdge *eed;
-	EditFace *efa;
-	
-	for (eve= em->verts.first; eve; eve= eve->next) eve->f &= ~flag;
-	for (eed= em->edges.first; eed; eed= eed->next) eed->f &= ~flag;
-	for (efa= em->faces.first; efa; efa= efa->next) efa->f &= ~flag;
-	
-	if(flag & SELECT) {
-		BLI_freelistN(&(em->selected));
-		em->totvertsel= em->totedgesel= em->totfacesel= 0;
-	}
-}
-
-void EM_set_flag_all(EditMesh *em, int flag)
-{
-	EditVert *eve;
-	EditEdge *eed;
-	EditFace *efa;
-	
-	for (eve= em->verts.first; eve; eve= eve->next) if(eve->h==0) eve->f |= flag;
-	for (eed= em->edges.first; eed; eed= eed->next) if(eed->h==0) eed->f |= flag;
-	for (efa= em->faces.first; efa; efa= efa->next) if(efa->h==0) efa->f |= flag;
-	
-	if(flag & SELECT) {
-		em->totvertsel= em->totvert;
-		em->totedgesel= em->totedge;
-		em->totfacesel= em->totface;
-	}
-}
-
-void EM_set_flag_all_selectmode(EditMesh *em, int flag)
-{
-	EditVert *eve;
-	EditEdge *eed;
-	EditFace *efa;
-
-	int selvert= 0, seledge= 0, selface= 0;
-
-	if (em->selectmode & SCE_SELECT_VERTEX) {
-		/* If vertex select mode enabled all the data could be affected */
-		for (eve= em->verts.first; eve; eve= eve->next) if(eve->h==0) eve->f |= flag;
-		for (eed= em->edges.first; eed; eed= eed->next) if(eed->h==0) eed->f |= flag;
-		for (efa= em->faces.first; efa; efa= efa->next) if(efa->h==0) efa->f |= flag;
-
-		if (flag & SELECT) {
-			selvert= em->totvert;
-			seledge= em->totedge;
-			selface= em->totface;
-		}
-	} else if (em->selectmode & SCE_SELECT_EDGE) {
-		/* If edge select mode is enabled we should affect on all edges, faces and */
-		/* vertices, connected to them */
-
-		for (eed= em->edges.first; eed; eed= eed->next) {
-			SET_EED_FLAG(eed, flag)
-		}
-
-		for (efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->h==0) {
-				efa->f |= flag;
-
-				if (flag & SELECT) {
-					++selface;
-				}
-			}
-		}
-	} else if (em->selectmode & SCE_SELECT_FACE) {
-		/* No vertex and edge select mode, only face selection */
-		/* In face select mode only edges and vertices belongs to faces should be affected */
-
-		for (efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->h==0) {
-				efa->f |= flag;
-				SET_EED_FLAG(efa->e1, flag);
-				SET_EED_FLAG(efa->e2, flag);
-				SET_EED_FLAG(efa->e3, flag);
-
-				if (efa->e4) {
-					SET_EED_FLAG(efa->e4, flag);
-				}
-
-				if (flag & SELECT) {
-					++selface;
-				}
-			}
-		}
-	}
-
-	if(flag & SELECT) {
-		em->totvertsel= selvert;
-		em->totedgesel= seledge;
-		em->totfacesel= selface;
-	 }
- }
-/* flush for changes in vertices only */
-void EM_deselect_flush(EditMesh *em)
-{
-	EditEdge *eed;
-	EditFace *efa;
-	
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		if(eed->v1->f & eed->v2->f & SELECT);
-		else eed->f &= ~SELECT;
-	}
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		if(efa->v4) {
-			if(efa->v1->f & efa->v2->f & efa->v3->f & efa->v4->f & SELECT );
-			else efa->f &= ~SELECT;
-		}
-		else {
-			if(efa->v1->f & efa->v2->f & efa->v3->f & SELECT );
-			else efa->f &= ~SELECT;
-		}
-	}
-	EM_nedges_selected(em);
-	EM_nfaces_selected(em);
-}
-
-
-/* flush selection to edges & faces */
-
-/*  this only based on coherent selected vertices, for example when adding new
-	objects. call clear_flag_all() before you select vertices to be sure it ends OK!
-	
-*/
-
-void EM_select_flush(EditMesh *em)
-{
-	EditEdge *eed;
-	EditFace *efa;
-	
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		if(eed->v1->f & eed->v2->f & SELECT) eed->f |= SELECT;
-	}
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		if(efa->v4) {
-			if(efa->v1->f & efa->v2->f & efa->v3->f & efa->v4->f & SELECT ) efa->f |= SELECT;
-		}
-		else {
-			if(efa->v1->f & efa->v2->f & efa->v3->f & SELECT ) efa->f |= SELECT;
-		}
-	}
-	EM_nedges_selected(em);
-	EM_nfaces_selected(em);
-}
-
-/* when vertices or edges can be selected, also make fgon consistent */
-static void check_fgons_selection(EditMesh *em)
-{
-	EditFace *efa, *efan;
-	EditEdge *eed;
-	ListBase *lbar;
-	int sel, desel, index, totfgon= 0;
-	
-	/* count amount of fgons */
-	for(eed= em->edges.first; eed; eed= eed->next) 
-		if(eed->fgoni>totfgon) totfgon= eed->fgoni;
-	
-	if(totfgon==0) return;
-	
-	lbar= MEM_callocN((totfgon+1)*sizeof(ListBase), "listbase array");
-	
-	/* put all fgons in lbar */
-	for(efa= em->faces.first; efa; efa= efan) {
-		efan= efa->next;
-		index= efa->e1->fgoni;
-		if(index==0) index= efa->e2->fgoni;
-		if(index==0) index= efa->e3->fgoni;
-		if(index==0 && efa->e4) index= efa->e4->fgoni;
-		if(index) {
-			BLI_remlink(&em->faces, efa);
-			BLI_addtail(&lbar[index], efa);
-		}
-	}
-	
-	/* now check the fgons */
-	for(index=1; index<=totfgon; index++) {
-		/* we count on vertices/faces/edges being set OK, so we only have to set ngon itself */
-		sel= desel= 0;
-		for(efa= lbar[index].first; efa; efa= efa->next) {
-			if(efa->e1->fgoni==0) {
-				if(efa->e1->f & SELECT) sel++;
-				else desel++;
-			}
-			if(efa->e2->fgoni==0) {
-				if(efa->e2->f & SELECT) sel++;
-				else desel++;
-			}
-			if(efa->e3->fgoni==0) {
-				if(efa->e3->f & SELECT) sel++;
-				else desel++;
-			}
-			if(efa->e4 && efa->e4->fgoni==0) {
-				if(efa->e4->f & SELECT) sel++;
-				else desel++;
-			}
-			
-			if(sel && desel) break;
-		}
-
-		if(sel && desel) sel= 0;
-		else if(sel) sel= 1;
-		else sel= 0;
-		
-		/* select/deselect and put back */
-		for(efa= lbar[index].first; efa; efa= efa->next) {
-			if(sel) efa->f |= SELECT;
-			else efa->f &= ~SELECT;
-		}
-		BLI_movelisttolist(&em->faces, &lbar[index]);
-	}
-	
-	MEM_freeN(lbar);
-}
-
-
-/* flush to edges & faces */
-
-/* based on select mode it selects edges/faces 
-   assumed is that verts/edges/faces were properly selected themselves
-   with the calls above
-*/
-
-void EM_selectmode_flush(EditMesh *em)
-{
-	EditEdge *eed;
-	EditFace *efa;
-	
-	// flush to edges & faces
-	if(em->selectmode & SCE_SELECT_VERTEX) {
-		for(eed= em->edges.first; eed; eed= eed->next) {
-			if(eed->v1->f & eed->v2->f & SELECT) eed->f |= SELECT;
-			else eed->f &= ~SELECT;
-		}
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->v4) {
-				if(efa->v1->f & efa->v2->f & efa->v3->f & efa->v4->f & SELECT) efa->f |= SELECT;
-				else efa->f &= ~SELECT;
-			}
-			else {
-				if(efa->v1->f & efa->v2->f & efa->v3->f & SELECT) efa->f |= SELECT;
-				else efa->f &= ~SELECT;
-			}
-		}
-	}
-	// flush to faces
-	else if(em->selectmode & SCE_SELECT_EDGE) {
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->e4) {
-				if(efa->e1->f & efa->e2->f & efa->e3->f & efa->e4->f & SELECT) efa->f |= SELECT;
-				else efa->f &= ~SELECT;
-			}
-			else {
-				if(efa->e1->f & efa->e2->f & efa->e3->f & SELECT) efa->f |= SELECT;
-				else efa->f &= ~SELECT;
-			}
-		}
-	}	
-	// make sure selected faces have selected edges too, for extrude (hack?)
-	else if(em->selectmode & SCE_SELECT_FACE) {
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->f & SELECT) EM_select_face(efa, 1);
-		}
-	}
-	
-	if(!(em->selectmode & SCE_SELECT_FACE))
-		check_fgons_selection(em);
-
-	EM_nvertices_selected(em);
-	EM_nedges_selected(em);
-	EM_nfaces_selected(em);
-}
-
-void EM_convertsel(EditMesh *em, short oldmode, short selectmode)
-{
-	EditVert *eve;
-	EditEdge *eed;
-	EditFace *efa;
-	/*clear flags*/
-	for(eve= em->verts.first; eve; eve= eve->next) eve->f1 = 0;
-	for(eed= em->edges.first; eed; eed= eed->next) eed->f1 = 0;
-	for(efa= em->faces.first; efa; efa= efa->next) efa->f1 = 0;
-	
-	/*have to find out what the selectionmode was previously*/
-	if(oldmode == SCE_SELECT_VERTEX) {
-		if(selectmode == SCE_SELECT_EDGE){
-			/*select all edges associated with every selected vertex*/
-			for(eed= em->edges.first; eed; eed= eed->next){
-				if(eed->v1->f&SELECT) eed->f1 = 1;
-				else if(eed->v2->f&SELECT) eed->f1 = 1;
-			}
-			
-			for(eed= em->edges.first; eed; eed= eed->next){
-				if(eed->f1 == 1) EM_select_edge(eed,1);	
-			}
-		}		
-		else if(selectmode == SCE_SELECT_FACE){
-			/*select all faces associated with every selected vertex*/
-			for(efa= em->faces.first; efa; efa= efa->next){
-				if(efa->v1->f&SELECT) efa->f1 = 1;
-				else if(efa->v2->f&SELECT) efa->f1 = 1;
-				else if(efa->v3->f&SELECT) efa->f1 = 1;
-				else{ 
-					if(efa->v4){
-						if(efa->v4->f&SELECT) efa->f1 =1;
-					}
-				}
-			}
-			for(efa= em->faces.first; efa; efa= efa->next){
-				if(efa->f1 == 1) EM_select_face(efa,1);
-			}
-		}
-	}
-	
-	if(oldmode == SCE_SELECT_EDGE){
-		if(selectmode == SCE_SELECT_FACE){
-			for(efa= em->faces.first; efa; efa= efa->next){
-				if(efa->e1->f&SELECT) efa->f1 = 1;
-				else if(efa->e2->f&SELECT) efa->f1 = 1;
-				else if(efa->e3->f&SELECT) efa->f1 = 1;
-				else if(efa->e4){
-					if(efa->e4->f&SELECT) efa->f1 = 1;
-				}
-			}
-			for(efa= em->faces.first; efa; efa= efa->next){
-				if(efa->f1 == 1) EM_select_face(efa,1);
-			}
-		}
-	}
-	
-	check_fgons_selection(em);
-
-	EM_nvertices_selected(em);
-	EM_nedges_selected(em);
-	EM_nfaces_selected(em);
-}
-
-void EM_selectmode_to_scene(struct Scene *scene, struct Object *obedit)
-{
-	scene->toolsettings->selectmode= get_mesh(obedit)->edit_mesh->selectmode;
-}
-
-/* when switching select mode, makes sure selection is consistent for editing */
-/* also for paranoia checks to make sure edge or face mode works */
-void EM_selectmode_set(EditMesh *em)
-{
-	EditVert *eve;
-	EditEdge *eed;
-	EditFace *efa;
-	
-	EM_strip_selections(em); /*strip EditSelections from em->selected that are not relevant to new mode*/
-	
-	if(em->selectmode & SCE_SELECT_VERTEX) {
-		/* vertices -> edges -> faces */
-		for (eed= em->edges.first; eed; eed= eed->next) eed->f &= ~SELECT;
-		for (efa= em->faces.first; efa; efa= efa->next) efa->f &= ~SELECT;
-		
-		EM_select_flush(em);
-	}
-	else if(em->selectmode & SCE_SELECT_EDGE) {
-		/* deselect vertices, and select again based on edge select */
-		for(eve= em->verts.first; eve; eve= eve->next) eve->f &= ~SELECT;
-		for(eed= em->edges.first; eed; eed= eed->next) 
-			if(eed->f & SELECT) EM_select_edge(eed, 1);
-		/* selects faces based on edge status */
-		EM_selectmode_flush(em);
-	}
-	else if(em->selectmode & SCE_SELECT_FACE) {
-		/* deselect eges, and select again based on face select */
-		for(eed= em->edges.first; eed; eed= eed->next) EM_select_edge(eed, 0);
-		
-		for(efa= em->faces.first; efa; efa= efa->next) 
-			if(efa->f & SELECT) EM_select_face(efa, 1);
-	}
-
-	EM_nvertices_selected(em);
-	EM_nedges_selected(em);
-	EM_nfaces_selected(em);
-}
-
-/* paranoia check, actually only for entering editmode. rule:
-- vertex hidden, always means edge is hidden too
-- edge hidden, always means face is hidden too
-- face hidden, dont change anything
-*/
-void EM_hide_reset(EditMesh *em)
-{
-	EditEdge *eed;
-	EditFace *efa;
-	
-	for(eed= em->edges.first; eed; eed= eed->next) 
-		if(eed->v1->h || eed->v2->h) eed->h |= 1;
-		
-	for(efa= em->faces.first; efa; efa= efa->next) 
-		if((efa->e1->h & 1) || (efa->e2->h & 1) || (efa->e3->h & 1) || (efa->e4 && (efa->e4->h & 1)))
-			efa->h= 1;
-		
-}
-
-void EM_data_interp_from_verts(EditMesh *em, EditVert *v1, EditVert *v2, EditVert *eve, float fac)
-{
-	void *src[2];
-	float w[2];
-
-	if (v1->data && v2->data) {
-		src[0]= v1->data;
-		src[1]= v2->data;
-		w[0] = 1.0f-fac;
-		w[1] = fac;
-
-		CustomData_em_interp(&em->vdata, src, w, NULL, 2, eve->data);
-	}
-}
-
-void EM_data_interp_from_faces(EditMesh *em, EditFace *efa1, EditFace *efa2, EditFace *efan, int i1, int i2, int i3, int i4)
-{
-	float w[2][4][4];
-	void *src[2];
-	int count = (efa2)? 2: 1;
-
-	if (efa1->data) {
-		/* set weights for copying from corners directly to other corners */
-		memset(w, 0, sizeof(w));
-
-		w[i1/4][0][i1%4]= 1.0f;
-		w[i2/4][1][i2%4]= 1.0f;
-		w[i3/4][2][i3%4]= 1.0f;
-		if (i4 != -1)
-			w[i4/4][3][i4%4]= 1.0f;
-
-		src[0]= efa1->data;
-		src[1]= (efa2)? efa2->data: NULL;
-
-		CustomData_em_interp(&em->fdata, src, NULL, (float*)w, count, efan->data);
-	}
-}
-
-EditFace *EM_face_from_faces(EditMesh *em, EditFace *efa1, EditFace *efa2, int i1, int i2, int i3, int i4)
-{
-	EditFace *efan;
-	EditVert **v[2];
-	
-	v[0]= &efa1->v1;
-	v[1]= (efa2)? &efa2->v1: NULL;
-
-	efan= addfacelist(em, v[i1/4][i1%4], v[i2/4][i2%4], v[i3/4][i3%4],
-		(i4 == -1)? 0: v[i4/4][i4%4], efa1, NULL);
-
-	EM_data_interp_from_faces(em, efa1, efa2, efan, i1, i2, i3, i4);
-	
-	return efan;
-}
-
-static void update_data_blocks(EditMesh *em, CustomData *olddata, CustomData *data)
-{
-	EditFace *efa;
-	EditVert *eve;
-	void *block;
-
-	if (data == &em->vdata) {
-		for(eve= em->verts.first; eve; eve= eve->next) {
-			block = NULL;
-			CustomData_em_set_default(data, &block);
-			CustomData_em_copy_data(olddata, data, eve->data, &block);
-			CustomData_em_free_block(olddata, &eve->data);
-			eve->data= block;
-		}
-	}
-	else if (data == &em->fdata) {
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			block = NULL;
-			CustomData_em_set_default(data, &block);
-			CustomData_em_copy_data(olddata, data, efa->data, &block);
-			CustomData_em_free_block(olddata, &efa->data);
-			efa->data= block;
-		}
-	}
-}
-
-void EM_add_data_layer(EditMesh *em, CustomData *data, int type, const char *name)
-{
-	CustomData olddata;
-
-	olddata= *data;
-	olddata.layers= (olddata.layers)? MEM_dupallocN(olddata.layers): NULL;
-	CustomData_add_layer_named(data, type, CD_CALLOC, NULL, 0, name);
-
-	update_data_blocks(em, &olddata, data);
-	if (olddata.layers) MEM_freeN(olddata.layers);
-}
-
-void EM_free_data_layer(EditMesh *em, CustomData *data, int type)
-{
-	CustomData olddata;
-
-	olddata= *data;
-	olddata.layers= (olddata.layers)? MEM_dupallocN(olddata.layers): NULL;
-	CustomData_free_layer_active(data, type, 0);
-
-	update_data_blocks(em, &olddata, data);
-	if (olddata.layers) MEM_freeN(olddata.layers);
-}
-
-/* ********  EXTRUDE ********* */
-
-static void add_normal_aligned(float *nor, float *add)
-{
-	if(dot_v3v3(nor, add) < -0.9999f)
-		sub_v3_v3(nor, add);
-	else
-		add_v3_v3(nor, add);
-}
-
-static void set_edge_directions_f2(EditMesh *em, int val)
-{
-	EditFace *efa;
-	int do_all= 1;
-	
-	/* edge directions are used for extrude, to detect direction of edges that make new faces */
-	/* we have set 'f2' flags in edges that need to get a direction set (e.g. get new face) */
-	/* the val argument differs... so we need it as arg */
-	
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		if(efa->f & SELECT) {
-			do_all= 0;
-			if(efa->e1->f2<val) {
-				if(efa->e1->v1 == efa->v1) efa->e1->dir= 0;
-				else efa->e1->dir= 1;
-			}
-			if(efa->e2->f2<val) {
-				if(efa->e2->v1 == efa->v2) efa->e2->dir= 0;
-				else efa->e2->dir= 1;
-			}
-			if(efa->e3->f2<val) {
-				if(efa->e3->v1 == efa->v3) efa->e3->dir= 0;
-				else efa->e3->dir= 1;
-			}
-			if(efa->e4 && efa->e4->f2<val) {
-				if(efa->e4->v1 == efa->v4) efa->e4->dir= 0;
-				else efa->e4->dir= 1;
-			}
-		}
-	}	
-	/* ok, no faces done... then we at least set it for exterior edges */
-	if(do_all) {
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->e1->v1 == efa->v1) efa->e1->dir= 0;
-			else efa->e1->dir= 1;
-			if(efa->e2->v1 == efa->v2) efa->e2->dir= 0;
-			else efa->e2->dir= 1;
-			if(efa->e3->v1 == efa->v3) efa->e3->dir= 0;
-			else efa->e3->dir= 1;
-			if(efa->e4) {
-				if(efa->e4->v1 == efa->v4) efa->e4->dir= 0;
-				else efa->e4->dir= 1;
-			}
-		}	
-	}
-}
-
-/* individual face extrude */
-/* will use vertex normals for extrusion directions, so *nor is unaffected */
-short extrudeflag_face_indiv(EditMesh *em, short UNUSED(flag), float *UNUSED(nor))
-{
-	EditVert *eve, *v1, *v2, *v3, *v4;
-	EditEdge *eed;
-	EditFace *efa, *nextfa;
-	
-	if(em==NULL) return 0;
-	
-	/* selected edges with 1 or more selected face become faces */
-	/* selected faces each makes new faces */
-	/* always remove old faces, keeps volumes manifold */
-	/* select the new extrusion, deselect old */
-	
-	/* step 1; init, count faces in edges */
-	recalc_editnormals(em);
-	
-	for(eve= em->verts.first; eve; eve= eve->next) eve->f1= 0;	// new select flag
-
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		eed->f2= 0; // amount of unselected faces
-	}
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		if(efa->f & SELECT);
-		else {
-			efa->e1->f2++;
-			efa->e2->f2++;
-			efa->e3->f2++;
-			if(efa->e4) efa->e4->f2++;
-		}
-	}
-
-	/* step 2: make new faces from faces */
-	for(efa= em->faces.last; efa; efa= efa->prev) {
-		if(efa->f & SELECT) {
-			v1= addvertlist(em, efa->v1->co, efa->v1);
-			v2= addvertlist(em, efa->v2->co, efa->v2);
-			v3= addvertlist(em, efa->v3->co, efa->v3);
-			
-			v1->f1= v2->f1= v3->f1= 1;
-			copy_v3_v3(v1->no, efa->n);
-			copy_v3_v3(v2->no, efa->n);
-			copy_v3_v3(v3->no, efa->n);
-			if(efa->v4) {
-				v4= addvertlist(em, efa->v4->co, efa->v4); 
-				v4->f1= 1;
-				copy_v3_v3(v4->no, efa->n);
-			}
-			else v4= NULL;
-			
-			/* side faces, clockwise */
-			addfacelist(em, efa->v2, v2, v1, efa->v1, efa, NULL);
-			addfacelist(em, efa->v3, v3, v2, efa->v2, efa, NULL);
-			if(efa->v4) {
-				addfacelist(em, efa->v4, v4, v3, efa->v3, efa, NULL);
-				addfacelist(em, efa->v1, v1, v4, efa->v4, efa, NULL);
-			}
-			else {
-				addfacelist(em, efa->v1, v1, v3, efa->v3, efa, NULL);
-			}
-			/* top face */
-			addfacelist(em, v1, v2, v3, v4, efa, NULL);
-		}
-	}
-	
-	/* step 3: remove old faces */
-	efa= em->faces.first;
-	while(efa) {
-		nextfa= efa->next;
-		if(efa->f & SELECT) {
-			BLI_remlink(&em->faces, efa);
-			free_editface(em, efa);
-		}
-		efa= nextfa;
-	}
-
-	/* step 4: redo selection */
-	EM_clear_flag_all(em, SELECT);
-	
-	for(eve= em->verts.first; eve; eve= eve->next) {
-		if(eve->f1)  eve->f |= SELECT;
-	}
-	
-	EM_select_flush(em);
-	
-	/* step 5; update normals after extrude */
-	recalc_editnormals(em);
-
-	return 'n';
-}
-
-
-/* extrudes individual edges */
-/* nor is filled with constraint vector */
-short extrudeflag_edges_indiv(EditMesh *em, short flag, float *nor) 
-{
-	EditVert *eve;
-	EditEdge *eed;
-	EditFace *efa;
-	
-	for(eve= em->verts.first; eve; eve= eve->next) eve->tmp.v = NULL;
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		eed->tmp.f = NULL;
-		eed->f2= ((eed->f & flag)!=0);
-	}
-	
-	set_edge_directions_f2(em, 2);
-
-	/* sample for next loop */
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		efa->e1->tmp.f = efa;
-		efa->e2->tmp.f = efa;
-		efa->e3->tmp.f = efa;
-		if(efa->e4) efa->e4->tmp.f = efa;
-	}
-	/* make the faces */
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		if(eed->f & flag) {
-			if(eed->v1->tmp.v == NULL)
-				eed->v1->tmp.v = addvertlist(em, eed->v1->co, eed->v1);
-			if(eed->v2->tmp.v == NULL)
-				eed->v2->tmp.v = addvertlist(em, eed->v2->co, eed->v2);
-
-			if(eed->dir==1) 
-				addfacelist(em, eed->v1, eed->v2, 
-							eed->v2->tmp.v, eed->v1->tmp.v, 
-							eed->tmp.f, NULL);
-			else 
-				addfacelist(em, eed->v2, eed->v1, 
-							eed->v1->tmp.v, eed->v2->tmp.v, 
-							eed->tmp.f, NULL);
-
-			/* for transform */
-			if(eed->tmp.f) {
-				efa = eed->tmp.f;
-				if (efa->f & SELECT) add_normal_aligned(nor, efa->n);
-			}
-		}
-	}
-	normalize_v3(nor);
-	
-	/* set correct selection */
-	EM_clear_flag_all(em, SELECT);
-	for(eve= em->verts.last; eve; eve= eve->prev) {
-		if(eve->tmp.v) {
-			eve->tmp.v->f |= flag;
-		}
-	}
-
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		if(eed->v1->f & eed->v2->f & flag) eed->f |= flag;
-	}
-	
-	/* update normals after extrude */
-	recalc_editnormals(em);
-
-	if(is_zero_v3(nor)) return 'g'; // g is grab
-	return 'n';  // n is for normal constraint
-}
-
-/* extrudes individual vertices */
-short extrudeflag_verts_indiv(EditMesh *em, short flag, float *UNUSED(nor)) 
-{
-	EditVert *eve;
-	
-	/* make the edges */
-	for(eve= em->verts.first; eve; eve= eve->next) {
-		if(eve->f & flag) {
-			eve->tmp.v = addvertlist(em, eve->co, eve);
-			addedgelist(em, eve, eve->tmp.v, NULL);
-		}
-		else eve->tmp.v = NULL;
-	}
-	
-	/* set correct selection */
-	EM_clear_flag_all(em, SELECT);
-
-	for(eve= em->verts.last; eve; eve= eve->prev) 
-		if (eve->tmp.v) 
-			eve->tmp.v->f |= flag;
-
-	return 'g';	// g is grab
-}
-
-
-/* this is actually a recode of extrudeflag(), using proper edge/face select */
-/* hurms, doesnt use 'flag' yet, but its not called by primitive making stuff anyway */
-static short extrudeflag_edge(Object *obedit, EditMesh *em, short UNUSED(flag), float *nor, int all)
-{
-	/* all select edges/faces: extrude */
-	/* old select is cleared, in new ones it is set */
-	EditVert *eve, *nextve;
-	EditEdge *eed, *nexted;
-	EditFace *efa, *nextfa, *efan;
-	short del_old= 0;
-	ModifierData *md;
-	
-	if(em==NULL) return 0;
-
-	md = obedit->modifiers.first;
-	
-	/* selected edges with 0 or 1 selected face become faces */
-	/* selected faces generate new faces */
-
-	/* if *one* selected face has edge with unselected face; remove old selected faces */
-	
-	/* if selected edge is not used anymore; remove */
-	/* if selected vertex is not used anymore: remove */
-	
-	/* select the new extrusion, deselect old */
-	
-	
-	/* step 1; init, count faces in edges */
-	recalc_editnormals(em);
-	
-	for(eve= em->verts.first; eve; eve= eve->next) {
-		eve->tmp.v = NULL;
-		eve->f1= 0;
-	}
-
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		eed->f1= 0; // amount of unselected faces
-		eed->f2= 0; // amount of selected faces
-		if(eed->f & SELECT) {
-			eed->v1->f1= 1; // we call this 'selected vertex' now
-			eed->v2->f1= 1;
-		}
-		eed->tmp.f = NULL;		// here we tuck face pointer, as sample
-	}
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		if(efa->f & SELECT) {
-			efa->e1->f2++;
-			efa->e2->f2++;
-			efa->e3->f2++;
-			if(efa->e4) efa->e4->f2++;
-			
-			// sample for next loop
-			efa->e1->tmp.f = efa;
-			efa->e2->tmp.f = efa;
-			efa->e3->tmp.f = efa;
-			if(efa->e4) efa->e4->tmp.f = efa;
-		}
-		else {
-			efa->e1->f1++;
-			efa->e2->f1++;
-			efa->e3->f1++;
-			if(efa->e4) efa->e4->f1++;
-		}
-	}
-	
-	/* 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.
-	 */
-	for (; md; md=md->next) {
-		if ((md->type==eModifierType_Mirror) && (md->mode & eModifierMode_Realtime)) {
-			MirrorModifierData *mmd = (MirrorModifierData*) md;	
-		
-			if(mmd->flag & MOD_MIR_CLIPPING) {
-				float mtx[4][4];
-				if (mmd->mirror_ob) {
-					float imtx[4][4];
-					invert_m4_m4(imtx, mmd->mirror_ob->obmat);
-					mult_m4_m4m4(mtx, imtx, obedit->obmat);
-				}
-
-				for (eed= em->edges.first; eed; eed= eed->next) {
-					if(eed->f2 == 1) {
-						float co1[3], co2[3];
-
-						copy_v3_v3(co1, eed->v1->co);
-						copy_v3_v3(co2, eed->v2->co);
-
-						if (mmd->mirror_ob) {
-							mul_m4_v3(mtx, co1);
-							mul_m4_v3(mtx, co2);
-						}
-
-						if (mmd->flag & MOD_MIR_AXIS_X)
-							if ( (fabsf(co1[0]) < mmd->tolerance) &&
-								 (fabsf(co2[0]) < mmd->tolerance) )
-								++eed->f2;
-
-						if (mmd->flag & MOD_MIR_AXIS_Y)
-							if ( (fabsf(co1[1]) < mmd->tolerance) &&
-								 (fabsf(co2[1]) < mmd->tolerance) )
-								++eed->f2;
-
-						if (mmd->flag & MOD_MIR_AXIS_Z)
-							if ( (fabsf(co1[2]) < mmd->tolerance) &&
-								 (fabsf(co2[2]) < mmd->tolerance) )
-								++eed->f2;
-					}
-				}
-			}
-		}
-	}
-
-	set_edge_directions_f2(em, 2);
-	
-	/* step 1.5: if *one* selected face has edge with unselected face; remove old selected faces */
-	if(all == 0) {
-		for(efa= em->faces.last; efa; efa= efa->prev) {
-			if(efa->f & SELECT) {
-				if(efa->e1->f1 || efa->e2->f1 || efa->e3->f1 || (efa->e4 && efa->e4->f1)) {
-					del_old= 1;
-					break;
-				}
-			}
-		}
-	}
-				
-	/* step 2: make new faces from edges */
-	for(eed= em->edges.last; eed; eed= eed->prev) {
-		if(eed->f & SELECT) {
-			if(eed->f2<2) {
-				if(eed->v1->tmp.v == NULL)
-					eed->v1->tmp.v = addvertlist(em, eed->v1->co, eed->v1);
-				if(eed->v2->tmp.v == NULL)
-					eed->v2->tmp.v = addvertlist(em, eed->v2->co, eed->v2);
-
-				/* if del_old, the preferred normal direction is exact 
-				 * opposite as for keep old faces
-				 */
-				if(eed->dir!=del_old) 
-					addfacelist(em, eed->v1, eed->v2, 
-								eed->v2->tmp.v, eed->v1->tmp.v, 
-								eed->tmp.f, NULL);
-				else 
-					addfacelist(em, eed->v2, eed->v1, 
-								eed->v1->tmp.v, eed->v2->tmp.v,
-								eed->tmp.f, NULL);
-			}
-		}
-	}
-	
-	/* step 3: make new faces from faces */
-	for(efa= em->faces.last; efa; efa= efa->prev) {
-		if(efa->f & SELECT) {
-			if (efa->v1->tmp.v == NULL)
-				efa->v1->tmp.v = addvertlist(em, efa->v1->co, efa->v1);
-			if (efa->v2->tmp.v ==NULL)
-				efa->v2->tmp.v = addvertlist(em, efa->v2->co, efa->v2);
-			if (efa->v3->tmp.v ==NULL)
-				efa->v3->tmp.v = addvertlist(em, efa->v3->co, efa->v3);
-			if (efa->v4 && (efa->v4->tmp.v == NULL))
-				efa->v4->tmp.v = addvertlist(em, efa->v4->co, efa->v4);
-			
-			if(efa->v4)
-				efan = addfacelist(em, efa->v1->tmp.v, efa->v2->tmp.v,
-							efa->v3->tmp.v, efa->v4->tmp.v, efa, efa);
-			else
-				efan = addfacelist(em, efa->v1->tmp.v, efa->v2->tmp.v,
-							efa->v3->tmp.v, NULL, efa, efa);
-
-			/* keep old faces means flipping normal, reverse vertex order gives bad UV's & VCols etc - [#25260] */
-			if(del_old==0) {
-				flipface(em, efan);
-			}
-
-			if (em->act_face == efa) {
-				em->act_face = efan; 
-			}
-
-			/* for transform */
-			add_normal_aligned(nor, efa->n);
-		}
-	}
-	
-	if(del_old) {
-		
-		/* step 4: remove old faces, if del_old */
-		efa= em->faces.first;
-		while(efa) {
-			nextfa= efa->next;
-			if(efa->f & SELECT) {
-				BLI_remlink(&em->faces, efa);
-				free_editface(em, efa);
-			}
-			efa= nextfa;
-		}
-		
-		
-		/* step 5: remove selected unused edges */
-		/* start tagging again */
-		for(eed= em->edges.first; eed; eed= eed->next) eed->f1=0;
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			efa->e1->f1= 1;
-			efa->e2->f1= 1;
-			efa->e3->f1= 1;
-			if(efa->e4) efa->e4->f1= 1;
-		}
-		/* remove */
-		eed= em->edges.first; 
-		while(eed) {
-			nexted= eed->next;
-			if(eed->f & SELECT) {
-				if(eed->f1==0) {
-					remedge(em, eed);
-					free_editedge(em, eed);
-				}
-			}
-			eed= nexted;
-		}
-	
-		/* step 6: remove selected unused vertices */
-		for(eed= em->edges.first; eed; eed= eed->next) 
-			eed->v1->f1= eed->v2->f1= 0;
-		
-		eve= em->verts.first;
-		while(eve) {
-			nextve= eve->next;
-			if(eve->f1) {
-				// hack... but we need it for step 7, redoing selection
-				if(eve->tmp.v) eve->tmp.v->tmp.v= eve->tmp.v;
-				
-				BLI_remlink(&em->verts, eve);
-				free_editvert(em, eve);
-			}
-			eve= nextve;
-		}
-	}
-	
-	normalize_v3(nor);	// translation normal grab
-	
-	/* step 7: redo selection */
-	EM_clear_flag_all(em, SELECT);
-
-	for(eve= em->verts.first; eve; eve= eve->next) {
-		if(eve->tmp.v) {
-			eve->tmp.v->f |= SELECT;
-		}
-	}
-
-	EM_select_flush(em);
-
-	/* step 8; update normals after extrude */
-	recalc_editnormals(em);
-
-	if(is_zero_v3(nor)) return 'g'; // grab
-	return 'n'; // normal constraint 
-}
-
-short extrudeflag_vert(Object *obedit, EditMesh *em, short flag, float *nor, int all)
-{
-	/* all verts/edges/faces with (f & 'flag'): extrude */
-	/* from old verts, 'flag' is cleared, in new ones it is set */
-	EditVert *eve, *v1, *v2, *v3, *v4, *nextve;
-	EditEdge *eed, *e1, *e2, *e3, *e4, *nexted;
-	EditFace *efa, *efa2, *nextvl;
-	short sel=0, del_old= 0, is_face_sel=0;
-	ModifierData *md;
-
-	if(em==NULL) return 0;
-
-	md = obedit->modifiers.first;
-
-	/* clear vert flag f1, we use this to detect a loose selected vertice */
-	eve= em->verts.first;
-	while(eve) {
-		if(eve->f & flag) eve->f1= 1;
-		else eve->f1= 0;
-		eve= eve->next;
-	}
-	/* clear edges counter flag, if selected we set it at 1 */
-	eed= em->edges.first;
-	while(eed) {
-		if( (eed->v1->f & flag) && (eed->v2->f & flag) ) {
-			eed->f2= 1;
-			eed->v1->f1= 0;
-			eed->v2->f1= 0;
-		}
-		else eed->f2= 0;
-		
-		eed->f1= 1;		/* this indicates it is an 'old' edge (in this routine we make new ones) */
-		eed->tmp.f = NULL;	/* used as sample */
-		
-		eed= eed->next;
-	}
-
-	/* we set a flag in all selected faces, and increase the associated edge counters */
-
-	efa= em->faces.first;
-	while(efa) {
-		efa->f1= 0;
-
-		if(faceselectedAND(efa, flag)) {
-			e1= efa->e1;
-			e2= efa->e2;
-			e3= efa->e3;
-			e4= efa->e4;
-
-			if(e1->f2 < 3) e1->f2++;
-			if(e2->f2 < 3) e2->f2++;
-			if(e3->f2 < 3) e3->f2++;
-			if(e4 && e4->f2 < 3) e4->f2++;
-			
-			efa->f1= 1;
-			is_face_sel= 1;	// for del_old
-		}
-		else if(faceselectedOR(efa, flag)) {
-			e1= efa->e1;
-			e2= efa->e2;
-			e3= efa->e3;
-			e4= efa->e4;
-			
-			if( (e1->v1->f & flag) && (e1->v2->f & flag) ) e1->f1= 2;
-			if( (e2->v1->f & flag) && (e2->v2->f & flag) ) e2->f1= 2;
-			if( (e3->v1->f & flag) && (e3->v2->f & flag) ) e3->f1= 2;
-			if( e4 && (e4->v1->f & flag) && (e4->v2->f & flag) ) e4->f1= 2;
-		}
-		
-		// sample for next loop
-		efa->e1->tmp.f = efa;
-		efa->e2->tmp.f = efa;
-		efa->e3->tmp.f = efa;
-		if(efa->e4) efa->e4->tmp.f = efa;
-
-		efa= efa->next;
-	}
-
-	set_edge_directions_f2(em, 3);
-
-	/* the current state now is:
-		eve->f1==1: loose selected vertex 
-
-		eed->f2==0 : edge is not selected, no extrude
-		eed->f2==1 : edge selected, is not part of a face, extrude
-		eed->f2==2 : edge selected, is part of 1 face, extrude
-		eed->f2==3 : edge selected, is part of more faces, no extrude
-		
-		eed->f1==0: new edge
-		eed->f1==1: edge selected, is part of selected face, when eed->f==3: remove
-		eed->f1==2: edge selected, part of a partially selected face
-					
-		efa->f1==1 : duplicate this face
-	*/
-
-	/* 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.
-	 */
-	for (; md; md=md->next) {
-		if ((md->type==eModifierType_Mirror) && (md->mode & eModifierMode_Realtime)) {
-			MirrorModifierData *mmd = (MirrorModifierData*) md;	
-		
-			if(mmd->flag & MOD_MIR_CLIPPING) {
-				float mtx[4][4];
-				if (mmd->mirror_ob) {
-					float imtx[4][4];
-					invert_m4_m4(imtx, mmd->mirror_ob->obmat);
-					mult_m4_m4m4(mtx, imtx, obedit->obmat);
-				}
-
-				for (eed= em->edges.first; eed; eed= eed->next) {
-					if(eed->f2 == 2) {
-						float co1[3], co2[3];
-
-						copy_v3_v3(co1, eed->v1->co);
-						copy_v3_v3(co2, eed->v2->co);
-
-						if (mmd->mirror_ob) {
-							mul_m4_v3(mtx, co1);
-							mul_m4_v3(mtx, co2);
-						}
-
-						if (mmd->flag & MOD_MIR_AXIS_X)
-							if ( (fabsf(co1[0]) < mmd->tolerance) &&
-								 (fabsf(co2[0]) < mmd->tolerance) )
-								++eed->f2;
-
-						if (mmd->flag & MOD_MIR_AXIS_Y)
-							if ( (fabsf(co1[1]) < mmd->tolerance) &&
-								 (fabsf(co2[1]) < mmd->tolerance) )
-								++eed->f2;
-						if (mmd->flag & MOD_MIR_AXIS_Z)
-							if ( (fabsf(co1[2]) < mmd->tolerance) &&
-								 (fabsf(co2[2]) < mmd->tolerance) )
-								++eed->f2;
-					}
-				}
-			}
-		}
-	}
-
-	/* copy all selected vertices, */
-	/* write pointer to new vert in old struct at eve->tmp.v */
-	eve= em->verts.last;
-	while(eve) {
-		eve->f &= ~128;  /* clear, for later test for loose verts */
-		if(eve->f & flag) {
-			sel= 1;
-			v1= addvertlist(em, 0, NULL);
-			
-			copy_v3_v3(v1->co, eve->co);
-			copy_v3_v3(v1->no, eve->no);
-			v1->f= eve->f;
-			eve->f &= ~flag;
-			eve->tmp.v = v1;
-		}
-		else eve->tmp.v = NULL;
-		eve= eve->prev;
-	}
-
-	if(sel==0) return 0;
-
-	/* all edges with eed->f2==1 or eed->f2==2 become faces */
-	
-	/* if del_old==1 then extrude is in partial geometry, to keep it manifold.
-					 verts with f1==0 and (eve->f & 128)==0) are removed
-					 edges with eed->f2>2 are removed
-					 faces with efa->f1 are removed
-	   if del_old==0 the extrude creates a volume.
-	*/
-	
-	 /* find if we delete old faces */
-	if(is_face_sel && all==0) {
-		for(eed= em->edges.first; eed; eed= eed->next) {
-			if( (eed->f2==1 || eed->f2==2) ) {
-				if(eed->f1==2) {
-					del_old= 1;
-					break;
-				}
-			}
-		}
-	}
-	
-	eed= em->edges.last;
-	while(eed) {
-		nexted= eed->prev;
-		if( eed->f2<3) {
-			eed->v1->f |= 128;  /* = no loose vert! */
-			eed->v2->f |= 128;
-		}
-		if( (eed->f2==1 || eed->f2==2) ) {
-	
-			/* if del_old, the preferred normal direction is exact opposite as for keep old faces */
-			if(eed->dir != del_old) 
-				efa2 = addfacelist(em, eed->v1, eed->v2, 
-								  eed->v2->tmp.v, eed->v1->tmp.v, 
-								  eed->tmp.f, NULL);
-			else 
-				efa2 = addfacelist(em, eed->v2, eed->v1, 
-								   eed->v1->tmp.v, eed->v2->tmp.v, 
-								   eed->tmp.f, NULL);
-			
-			/* Needs smarter adaption of existing creases.
-			 * If addedgelist is used, make sure seams are set to 0 on these
-			 * new edges, since we do not want to add any seams on extrusion.
-			 */
-			efa2->e1->crease= eed->crease;
-			efa2->e2->crease= eed->crease;
-			efa2->e3->crease= eed->crease;
-			if(efa2->e4) efa2->e4->crease= eed->crease;
-		}
-
-		eed= nexted;
-	}
-	
-	/* duplicate faces, if necessary remove old ones  */
-	efa= em->faces.first;
-	while(efa) {
-		nextvl= efa->next;
-		if(efa->f1 & 1) {
-		
-			v1 = efa->v1->tmp.v;
-			v2 = efa->v2->tmp.v;
-			v3 = efa->v3->tmp.v;
-			if(efa->v4) 
-				v4 = efa->v4->tmp.v; 
-			else
-				v4= NULL;
-
-			/* hmm .. not sure about edges here */
-			if(del_old==0)	// if we keep old, we flip normal
-				efa2= addfacelist(em, v3, v2, v1, v4, efa, efa); 
-			else
-				efa2= addfacelist(em, v1, v2, v3, v4, efa, efa);
-			
-			/* for transform */
-			add_normal_aligned(nor, efa->n);
-
-			if(del_old) {
-				BLI_remlink(&em->faces, efa);
-				free_editface(em, efa);
-			}
-		}
-		efa= nextvl;
-	}
-	/* delete edges after copying edges above! */
-	if(del_old) {
-		eed= em->edges.first;
-		while(eed) {
-			nexted= eed->next;
-			if(eed->f2==3 && eed->f1==1) {
-				remedge(em, eed);
-				free_editedge(em, eed);
-			}
-			eed= nexted;
-		}
-	}
-	
-	normalize_v3(nor);	// for grab
-	
-	/* for all vertices with eve->tmp.v!=0 
-		if eve->f1==1: make edge
-		if flag!=128 : if del_old==1: remove
-	*/
-	eve= em->verts.last;
-	while(eve) {
-		nextve= eve->prev;
-		if(eve->tmp.v) {
-			if(eve->f1==1) addedgelist(em, eve, eve->tmp.v, NULL);
-			else if( (eve->f & 128)==0) {
-				if(del_old) {
-					BLI_remlink(&em->verts,eve);
-					free_editvert(em, eve);
-					eve= NULL;
-				}
-			}
-		}
-		if(eve) {
-			eve->f &= ~128;
-		}
-		eve= nextve;
-	}
-	// since its vertex select mode now, it also deselects higher order
-	EM_selectmode_flush(em);
-
-	if(is_zero_v3(nor)) return 'g'; // g is grab, for correct undo print
-	return 'n';
-}
-
-/* generic extrude */
-short extrudeflag(Object *obedit, EditMesh *em, short flag, float *nor, int all)
-{
-	if(em->selectmode & SCE_SELECT_VERTEX)
-		return extrudeflag_vert(obedit, em, flag, nor, all);
-	else 
-		return extrudeflag_edge(obedit, em, flag, nor, all);
-		
-}
-
-void rotateflag(EditMesh *em, short flag, float *cent, float rotmat[][3])
-{
-	/* all verts with (flag & 'flag') rotate */
-	EditVert *eve;
-
-	eve= em->verts.first;
-	while(eve) {
-		if(eve->f & flag) {
-			eve->co[0]-=cent[0];
-			eve->co[1]-=cent[1];
-			eve->co[2]-=cent[2];
-			mul_m3_v3(rotmat,eve->co);
-			eve->co[0]+=cent[0];
-			eve->co[1]+=cent[1];
-			eve->co[2]+=cent[2];
-		}
-		eve= eve->next;
-	}
-}
-
-void translateflag(EditMesh *em, short flag, float *vec)
-{
-	/* all verts with (flag & 'flag') translate */
-	EditVert *eve;
-
-	eve= em->verts.first;
-	while(eve) {
-		if(eve->f & flag) {
-			eve->co[0]+=vec[0];
-			eve->co[1]+=vec[1];
-			eve->co[2]+=vec[2];
-		}
-		eve= eve->next;
-	}
-}
-
-/* helper call for below */
-static EditVert *adduplicate_vertex(EditMesh *em, EditVert *eve, int flag)
-{
-	/* FIXME: copy deformation weight from eve ok here? */
-	EditVert *v1= addvertlist(em, eve->co, eve);
-	
-	v1->f= eve->f;
-	eve->f &= ~flag;
-	eve->f|= 128;
-	
-	eve->tmp.v = v1;
-	
-	return v1;
-}
-
-/* old selection has flag 128 set, and flag 'flag' cleared
-new selection has flag 'flag' set */
-void adduplicateflag(EditMesh *em, int flag)
-{
-	EditVert *eve, *v1, *v2, *v3, *v4;
-	EditEdge *eed, *newed;
-	EditFace *efa, *newfa, *act_efa = EM_get_actFace(em, 0);
-
-	EM_clear_flag_all(em, 128);
-	EM_selectmode_set(em);	// paranoia check, selection now is consistent
-
-	/* vertices first */
-	for(eve= em->verts.last; eve; eve= eve->prev) {
-
-		if(eve->f & flag)
-			adduplicate_vertex(em, eve, flag);
-		else 
-			eve->tmp.v = NULL;
-	}
-	
-	/* copy edges, note that vertex selection can be independent of edge */
-	for(eed= em->edges.last; eed; eed= eed->prev) {
-		if( eed->f & flag ) {
-			v1 = eed->v1->tmp.v;
-			if(v1==NULL) v1= adduplicate_vertex(em, eed->v1, flag);
-			v2 = eed->v2->tmp.v;
-			if(v2==NULL) v2= adduplicate_vertex(em, eed->v2, flag);
-			
-			newed= addedgelist(em, v1, v2, eed);
-			
-			newed->f= eed->f;
-			eed->f &= ~flag;
-			eed->f |= 128;
-		}
-	}
-
-	/* then duplicate faces, again create new vertices if needed */
-	for(efa= em->faces.last; efa; efa= efa->prev) {
-		if(efa->f & flag) {
-			v1 = efa->v1->tmp.v;
-			if(v1==NULL) v1= adduplicate_vertex(em, efa->v1, flag);
-			v2 = efa->v2->tmp.v;
-			if(v2==NULL) v2= adduplicate_vertex(em, efa->v2, flag);
-			v3 = efa->v3->tmp.v;
-			if(v3==NULL) v3= adduplicate_vertex(em, efa->v3, flag);
-			if(efa->v4) {
-				v4 = efa->v4->tmp.v; 
-				if(v4==NULL) v4= adduplicate_vertex(em, efa->v4, flag);
-			}
-			else v4= NULL;
-			
-			newfa= addfacelist(em, v1, v2, v3, v4, efa, efa); 
-			
-			if (efa==act_efa) {
-				EM_set_actFace(em, newfa);
-			}
-			
-			newfa->f= efa->f;
-			efa->f &= ~flag;
-			efa->f |= 128;
-		}
-	}
-	
-	EM_fgon_flags(em);	// redo flags and indices for fgons
-}
-
-void delfaceflag(EditMesh *em, int flag)
-{
-	/* delete all faces with 'flag', including loose edges and loose vertices */
-	/* this is maybe a bit weird, but this function is used for 'split' and 'separate' */
-	/* in remaining vertices/edges 'flag' is cleared */
-	EditVert *eve,*nextve;
-	EditEdge *eed, *nexted;
-	EditFace *efa,*nextvl;
-
-	/* to detect loose edges, we put f2 flag on 1 */
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		if(eed->f & flag) eed->f2= 1;
-		else eed->f2= 0;
-	}
-	
-	/* delete faces */
-	efa= em->faces.first;
-	while(efa) {
-		nextvl= efa->next;
-		if(efa->f & flag) {
-			
-			efa->e1->f2= 1;
-			efa->e2->f2= 1;
-			efa->e3->f2= 1;
-			if(efa->e4) {
-				efa->e4->f2= 1;
-			}
-								
-			BLI_remlink(&em->faces, efa);
-			free_editface(em, efa);
-		}
-		efa= nextvl;
-	}
-	
-	/* all remaining faces: make sure we keep the edges */
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		efa->e1->f2= 0;
-		efa->e2->f2= 0;
-		efa->e3->f2= 0;
-		if(efa->e4) {
-			efa->e4->f2= 0;
-		}
-	}
-	
-	/* remove tagged edges, and clear remaining ones */
-	eed= em->edges.first;
-	while(eed) {
-		nexted= eed->next;
-		
-		if(eed->f2==1) {
-			remedge(em, eed);
-			free_editedge(em, eed);
-		}
-		else {
-			eed->f &= ~flag;
-			eed->v1->f &= ~flag;
-			eed->v2->f &= ~flag;
-		}
-		eed= nexted;
-	}
-	
-	/* vertices with 'flag' now are the loose ones, and will be removed */
-	eve= em->verts.first;
-	while(eve) {
-		nextve= eve->next;
-		if(eve->f & flag) {
-			BLI_remlink(&em->verts, eve);
-			free_editvert(em, eve);
-		}
-		eve= nextve;
-	}
-
-}
-
-/* ********************* */
-#if 0
-static int check_vnormal_flip(float *n, float *vnorm) 
-{
-	float inp;
-
-	inp= n[0]*vnorm[0]+n[1]*vnorm[1]+n[2]*vnorm[2];
-
-	/* angles 90 degrees: dont flip */
-	if(inp> -0.000001) return 0;
-
-	return 1;
-}
-#endif
-
-
-
-/* does face centers too */
-void recalc_editnormals(EditMesh *em)
-{
-	EditFace *efa;
-	EditVert *eve;
-
-	for(eve= em->verts.first; eve; eve=eve->next)
-		zero_v3(eve->no);
-
-	for(efa= em->faces.first; efa; efa=efa->next) {
-		float *n4= (efa->v4)? efa->v4->no: NULL;
-		float *c4= (efa->v4)? efa->v4->co: NULL;
-
-		if(efa->v4) {
-			normal_quad_v3(efa->n, efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co);
-			cent_quad_v3(efa->cent, efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co);
-		}
-		else {
-			normal_tri_v3(efa->n, efa->v1->co, efa->v2->co, efa->v3->co);
-			cent_tri_v3(efa->cent, efa->v1->co, efa->v2->co, efa->v3->co);
-		}
-
-		accumulate_vertex_normals(efa->v1->no, efa->v2->no, efa->v3->no, n4,
-			efa->n, efa->v1->co, efa->v2->co, efa->v3->co, c4);
-	}
-
-	/* following Mesh convention; we use vertex coordinate itself for normal in this case */
-	for(eve= em->verts.first; eve; eve=eve->next) {
-		if(normalize_v3(eve->no) == 0.0f) {
-			copy_v3_v3(eve->no, eve->co);
-			normalize_v3(eve->no);
-		}
-	}
-}
-
-int compareface(EditFace *vl1, EditFace *vl2)
-{
-	EditVert *v1, *v2, *v3, *v4;
-	
-	if(vl1->v4 && vl2->v4) {
-		v1= vl2->v1;
-		v2= vl2->v2;
-		v3= vl2->v3;
-		v4= vl2->v4;
-		
-		if(vl1->v1==v1 || vl1->v2==v1 || vl1->v3==v1 || vl1->v4==v1) {
-			if(vl1->v1==v2 || vl1->v2==v2 || vl1->v3==v2 || vl1->v4==v2) {
-				if(vl1->v1==v3 || vl1->v2==v3 || vl1->v3==v3 || vl1->v4==v3) {
-					if(vl1->v1==v4 || vl1->v2==v4 || vl1->v3==v4 || vl1->v4==v4) {
-						return 1;
-					}
-				}
-			}
-		}
-	}
-	else if(vl1->v4==0 && vl2->v4==0) {
-		v1= vl2->v1;
-		v2= vl2->v2;
-		v3= vl2->v3;
-		
-		if(vl1->v1==v1 || vl1->v2==v1 || vl1->v3==v1) {
-			if(vl1->v1==v2 || vl1->v2==v2 || vl1->v3==v2) {
-				if(vl1->v1==v3 || vl1->v2==v3 || vl1->v3==v3) {
-					return 1;
-				}
-			}
-		}
-	}
-	
-	return 0;
-}
-
-/* checks for existence, not tria overlapping inside quad */
-EditFace *exist_face(EditMesh *em, EditVert *v1, EditVert *v2, EditVert *v3, EditVert *v4)
-{
-	EditFace *efa, efatest;
-	
-	efatest.v1= v1;
-	efatest.v2= v2;
-	efatest.v3= v3;
-	efatest.v4= v4;
-	
-	efa= em->faces.first;
-	while(efa) {
-		if(compareface(&efatest, efa)) return efa;
-		efa= efa->next;
-	}
-	return NULL;
-}
-
-/* evaluate if entire quad is a proper convex quad */
-int convex(float *v1, float *v2, float *v3, float *v4)
-{
-	float nor[3], nor1[3], nor2[3], vec[4][2];
-	
-	/* define projection, do both trias apart, quad is undefined! */
-	normal_tri_v3( nor1,v1, v2, v3);
-	normal_tri_v3( nor2,v1, v3, v4);
-	nor[0]= ABS(nor1[0]) + ABS(nor2[0]);
-	nor[1]= ABS(nor1[1]) + ABS(nor2[1]);
-	nor[2]= ABS(nor1[2]) + ABS(nor2[2]);
-
-	if(nor[2] >= nor[0] && nor[2] >= nor[1]) {
-		vec[0][0]= v1[0]; vec[0][1]= v1[1];
-		vec[1][0]= v2[0]; vec[1][1]= v2[1];
-		vec[2][0]= v3[0]; vec[2][1]= v3[1];
-		vec[3][0]= v4[0]; vec[3][1]= v4[1];
-	}
-	else if(nor[1] >= nor[0] && nor[1]>= nor[2]) {
-		vec[0][0]= v1[0]; vec[0][1]= v1[2];
-		vec[1][0]= v2[0]; vec[1][1]= v2[2];
-		vec[2][0]= v3[0]; vec[2][1]= v3[2];
-		vec[3][0]= v4[0]; vec[3][1]= v4[2];
-	}
-	else {
-		vec[0][0]= v1[1]; vec[0][1]= v1[2];
-		vec[1][0]= v2[1]; vec[1][1]= v2[2];
-		vec[2][0]= v3[1]; vec[2][1]= v3[2];
-		vec[3][0]= v4[1]; vec[3][1]= v4[2];
-	}
-	
-	/* linetests, the 2 diagonals have to instersect to be convex */
-	if( isect_line_line_v2(vec[0], vec[2], vec[1], vec[3]) > 0 ) return 1;
-	return 0;
-}
-
-
-/* ********************* Fake Polgon support (FGon) ***************** */
-
-
-/* results in:
-   - faces having ->fgonf flag set (also for draw)
-   - edges having ->fgoni index set (for select)
-*/
-
-float EM_face_area(EditFace *efa)
-{
-	if(efa->v4) return area_quad_v3(efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co);
-	else return area_tri_v3(efa->v1->co, efa->v2->co, efa->v3->co);
-}
-
-float EM_face_perimeter(EditFace *efa)
-{	
-	if(efa->v4) return
-		len_v3v3(efa->v1->co, efa->v2->co)+
-		len_v3v3(efa->v2->co, efa->v3->co)+
-		len_v3v3(efa->v3->co, efa->v4->co)+
-		len_v3v3(efa->v4->co, efa->v1->co);
-	
-	else return
-		len_v3v3(efa->v1->co, efa->v2->co)+
-		len_v3v3(efa->v2->co, efa->v3->co)+
-		len_v3v3(efa->v3->co, efa->v1->co);
-}
-
-void EM_fgon_flags(EditMesh *em)
-{
-	EditFace *efa, *efan, *efamax;
-	EditEdge *eed;
-	ListBase listb={NULL, NULL};
-	float size, maxsize;
-	short done, curindex= 1;
-	
-	// for each face with fgon edge AND not fgon flag set
-	for(eed= em->edges.first; eed; eed= eed->next) eed->fgoni= 0;  // index
-	for(efa= em->faces.first; efa; efa= efa->next) efa->fgonf= 0;  // flag
-	
-	// for speed & simplicity, put fgon face candidates in new listbase
-	efa= em->faces.first;
-	while(efa) {
-		efan= efa->next;
-		if( (efa->e1->h & EM_FGON) || (efa->e2->h & EM_FGON) || 
-			(efa->e3->h & EM_FGON) || (efa->e4 && (efa->e4->h & EM_FGON)) ) {
-			BLI_remlink(&em->faces, efa);
-			BLI_addtail(&listb, efa);
-		}
-		efa= efan;
-	}
-	
-	// find an undone face with fgon edge
-	for(efa= listb.first; efa; efa= efa->next) {
-		if(efa->fgonf==0) {
-			
-			// init this face
-			efa->fgonf= EM_FGON;
-			if(efa->e1->h & EM_FGON) efa->e1->fgoni= curindex;
-			if(efa->e2->h & EM_FGON) efa->e2->fgoni= curindex;
-			if(efa->e3->h & EM_FGON) efa->e3->fgoni= curindex;
-			if(efa->e4 && (efa->e4->h & EM_FGON)) efa->e4->fgoni= curindex;
-			
-			// we search for largest face, to give facedot drawing rights
-			maxsize= EM_face_area(efa);
-			efamax= efa;
-			
-			// now flush curendex over edges and set faceflags
-			done= 1;
-			while(done==1) {
-				done= 0;
-				
-				for(efan= listb.first; efan; efan= efan->next) {
-					if(efan->fgonf==0) {
-						// if one if its edges has index set, do other too
-						if( (efan->e1->fgoni==curindex) || (efan->e2->fgoni==curindex) ||
-							(efan->e3->fgoni==curindex) || (efan->e4 && (efan->e4->fgoni==curindex)) ) {
-							
-							efan->fgonf= EM_FGON;
-							if(efan->e1->h & EM_FGON) efan->e1->fgoni= curindex;
-							if(efan->e2->h & EM_FGON) efan->e2->fgoni= curindex;
-							if(efan->e3->h & EM_FGON) efan->e3->fgoni= curindex;
-							if(efan->e4 && (efan->e4->h & EM_FGON)) efan->e4->fgoni= curindex;
-							
-							size= EM_face_area(efan);
-							if(size>maxsize) {
-								efamax= efan;
-								maxsize= size;
-							}
-							done= 1;
-						}
-					}
-				}
-			}
-			
-			efamax->fgonf |= EM_FGON_DRAW;
-			curindex++;
-
-		}
-	}
-
-	// put fgon face candidates back in listbase
-	efa= listb.first;
-	while(efa) {
-		efan= efa->next;
-		BLI_remlink(&listb, efa);
-		BLI_addtail(&em->faces, efa);
-		efa= efan;
-	}
-	
-	// remove fgon flags when edge not in fgon (anymore)
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		if(eed->fgoni==0) eed->h &= ~EM_FGON;
-	}
-	
-}
-
-/* editmesh vertmap, copied from intern.mesh.c
- * if do_face_idx_array is 0 it means we need to run it as well as freeing
- * */
-
-UvVertMap *EM_make_uv_vert_map(EditMesh *em, int selected, int do_face_idx_array, float *limit)
-{
-	EditVert *ev;
-	EditFace *efa;
-	int totverts;
-	
-	/* vars from original func */
-	UvVertMap *vmap;
-	UvMapVert *buf;
-	MTFace *tf;
-	unsigned int a;
-	int	i, totuv, nverts;
-	
-	if (do_face_idx_array)
-		EM_init_index_arrays(em, 0, 0, 1);
-	
-	/* we need the vert */
-	for (ev= em->verts.first, totverts=0; ev; ev= ev->next, totverts++) {
-		ev->tmp.l = totverts;
-	}
-	
-	totuv = 0;
-
-	/* generate UvMapVert array */
-	for (efa= em->faces.first; efa; efa= efa->next)
-		if(!selected || ((!efa->h) && (efa->f & SELECT)))
-			totuv += (efa->v4)? 4: 3;
-		
-	if(totuv==0) {
-		if (do_face_idx_array)
-			EM_free_index_arrays();
-		return NULL;
-	}
-	vmap= (UvVertMap*)MEM_callocN(sizeof(*vmap), "UvVertMap");
-	if (!vmap) {
-		if (do_face_idx_array)
-			EM_free_index_arrays();
-		return NULL;
-	}
-
-	vmap->vert= (UvMapVert**)MEM_callocN(sizeof(*vmap->vert)*totverts, "UvMapVert*");
-	buf= vmap->buf= (UvMapVert*)MEM_callocN(sizeof(*vmap->buf)*totuv, "UvMapVert");
-
-	if (!vmap->vert || !vmap->buf) {
-		free_uv_vert_map(vmap);
-		if (do_face_idx_array)
-			EM_free_index_arrays();
-		return NULL;
-	}
-
-	for (a=0, efa= em->faces.first; efa; a++, efa= efa->next) {
-		if(!selected || ((!efa->h) && (efa->f & SELECT))) {
-			nverts= (efa->v4)? 4: 3;
-			
-			for(i=0; i<nverts; i++) {
-				buf->tfindex= i;
-				buf->f= a;
-				buf->separate = 0;
-				
-				buf->next= vmap->vert[(*(&efa->v1 + i))->tmp.l];
-				vmap->vert[(*(&efa->v1 + i))->tmp.l]= buf;
-				
-				buf++;
-			}
-		}
-	}
-	
-	/* sort individual uvs for each vert */
-	for(a=0, ev=em->verts.first; ev; a++, ev= ev->next) {
-		UvMapVert *newvlist= NULL, *vlist=vmap->vert[a];
-		UvMapVert *iterv, *v, *lastv, *next;
-		float *uv, *uv2;
-
-		while(vlist) {
-			v= vlist;
-			vlist= vlist->next;
-			v->next= newvlist;
-			newvlist= v;
-
-			efa = EM_get_face_for_index(v->f);
-			tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-			uv = tf->uv[v->tfindex];
-
-			lastv= NULL;
-			iterv= vlist;
-
-			while(iterv) {
-				next= iterv->next;
-				efa = EM_get_face_for_index(iterv->f);
-				tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-				uv2 = tf->uv[iterv->tfindex];
-
-				if(fabsf(uv[0]-uv2[0]) < limit[0] && fabsf(uv[1]-uv2[1]) < limit[1]) {
-					if(lastv) lastv->next= next;
-					else vlist= next;
-					iterv->next= newvlist;
-					newvlist= iterv;
-				}
-				else
-					lastv=iterv;
-				iterv= next;
-			}
-			newvlist->separate = 1;
-		}
-		vmap->vert[a]= newvlist;
-	}
-
-
-	if (do_face_idx_array)
-		EM_free_index_arrays();
-
-	return vmap;
-}
-
-/* A specialized vert map used by stitch operator */
-UvElementMap *EM_make_uv_element_map(EditMesh *em, int selected, int do_islands)
-{
-	EditVert *ev;
-	EditFace *efa;
-
-	/* vars from original func */
-	UvElementMap *vmap;
-	UvElement *buf;
-	UvElement *islandbuf;
-	MTFace *tf;
-	unsigned int a;
-	int	i,j, totuv, nverts, nislands = 0, islandbufsize = 0;
-	unsigned int *map;
-	/* for uv island creation */
-	EditFace **stack;
-	int stacksize = 0;
-
-	/* we need the vert */
-	for(ev = em->verts.first, i = 0; ev; ev = ev->next, i++)
-		ev->tmp.l = i;
-
-	totuv = 0;
-
-	for(efa = em->faces.first; efa; efa = efa->next)
-		if(!selected || ((!efa->h) && (efa->f & SELECT)))
-			totuv += (efa->v4)? 4: 3;
-
-	if(totuv == 0)
-		return NULL;
-
-	vmap = (UvElementMap *)MEM_callocN(sizeof(*vmap), "UvVertElementMap");
-	if(!vmap)
-		return NULL;
-
-	vmap->vert = (UvElement**)MEM_callocN(sizeof(*vmap->vert)*em->totvert, "UvElementVerts");
-	buf = vmap->buf = (UvElement*)MEM_callocN(sizeof(*vmap->buf)*totuv, "UvElement");
-
-	if(!vmap->vert || !vmap->buf) {
-		EM_free_uv_element_map(vmap);
-		return NULL;
-	}
-
-	vmap->totalUVs = totuv;
-
-	for(efa = em->faces.first; efa; a++, efa = efa->next) {
-		if(!selected || ((!efa->h) && (efa->f & SELECT))) {
-			nverts = (efa->v4)? 4: 3;
-
-			for(i = 0; i<nverts; i++) {
-				buf->tfindex = i;
-				buf->face = efa;
-				buf->separate = 0;
-				buf->island = INVALID_ISLAND;
-
-				buf->next = vmap->vert[(*(&efa->v1 + i))->tmp.l];
-				vmap->vert[(*(&efa->v1 + i))->tmp.l] = buf;
-
-				buf++;
-			}
-		}
-
-		efa->tmp.l = INVALID_ISLAND;
-	}
-
-	/* sort individual uvs for each vert */
-	for(a = 0, ev = em->verts.first; ev; a++, ev = ev->next) {
-		UvElement *newvlist = NULL, *vlist = vmap->vert[a];
-		UvElement *iterv, *v, *lastv, *next;
-		float *uv, *uv2;
-
-		while(vlist) {
-			v= vlist;
-			vlist= vlist->next;
-			v->next= newvlist;
-			newvlist= v;
-
-			efa = v->face;
-			tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-			uv = tf->uv[v->tfindex];
-
-			lastv= NULL;
-			iterv= vlist;
-
-			while(iterv) {
-				next= iterv->next;
-				efa = iterv->face;
-				tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-				uv2 = tf->uv[iterv->tfindex];
-
-				if(fabsf(uv[0]-uv2[0]) < STD_UV_CONNECT_LIMIT && fabsf(uv[1]-uv2[1]) < STD_UV_CONNECT_LIMIT) {
-					if(lastv) lastv->next = next;
-					else vlist = next;
-					iterv->next = newvlist;
-					newvlist = iterv;
-				}
-				else
-					lastv = iterv;
-
-				iterv = next;
-			}
-
-			newvlist->separate = 1;
-		}
-
-		vmap->vert[a] = newvlist;
-	}
-
-	if(do_islands) {
-		/* at this point, every UvElement in vert points to a UvElement sharing the same vertex. Now we should sort uv's in islands. */
-
-		/* map holds the map from current vmap->buf to the new, sorted map*/
-		map = MEM_mallocN(sizeof(*map)*totuv, "uvelement_remap");
-		stack = MEM_mallocN(sizeof(*stack)*em->totface, "uv_island_face_stack");
-		islandbuf = MEM_callocN(sizeof(*islandbuf)*totuv, "uvelement_island_buffer");
-
-		for(i = 0; i < totuv; i++) {
-			if(vmap->buf[i].island == INVALID_ISLAND) {
-				vmap->buf[i].island = nislands;
-				stack[0] = vmap->buf[i].face;
-				stack[0]->tmp.l = nislands;
-				stacksize=1;
-
-				while(stacksize > 0) {
-					efa = stack[--stacksize];
-					nverts = efa->v4? 4 : 3;
-
-					for(j = 0; j < nverts; j++) {
-						UvElement *element, *initelement = vmap->vert[(*(&efa->v1 + j))->tmp.l];
-
-						for(element = initelement; element; element = element->next) {
-							if(element->separate)
-								initelement = element;
-
-							if(element->face == efa) {
-								/* found the uv corresponding to our face and vertex. Now fill it to the buffer */
-								element->island = nislands;
-								map[element - vmap->buf] = islandbufsize;
-								islandbuf[islandbufsize].tfindex = element->tfindex;
-								islandbuf[islandbufsize].face = element->face;
-								islandbuf[islandbufsize].separate = element->separate;
-								islandbuf[islandbufsize].island =  nislands;
-								islandbufsize++;
-
-								for(element = initelement; element; element = element->next) {
-									if(element->separate && element != initelement)
-										break;
-
-									if(element->face->tmp.l == INVALID_ISLAND) {
-										stack[stacksize++] = element->face;
-										element->face->tmp.l = nislands;
-									}
-								}
-								break;
-							}
-						}
-					}
-				}
-
-				nislands++;
-			}
-		}
-
-		/* remap */
-		for(i = 0; i < em->totvert; i++) {
-			/* important since we may do selection only. Some of these may be NULL */
-			if(vmap->vert[i])
-				vmap->vert[i] = &islandbuf[map[vmap->vert[i] - vmap->buf]];
-		}
-
-		vmap->islandIndices = MEM_callocN(sizeof(*vmap->islandIndices)*nislands,"UvVertMap2_island_indices");
-		if(!vmap->islandIndices) {
-			MEM_freeN(islandbuf);
-			MEM_freeN(stack);
-			MEM_freeN(map);
-			EM_free_uv_element_map(vmap);
-		}
-
-		j = 0;
-		for(i = 0; i < totuv; i++) {
-			UvElement *element = vmap->buf[i].next;
-			if(element == NULL)
-				islandbuf[map[i]].next = NULL;
-			else
-				islandbuf[map[i]].next = &islandbuf[map[element - vmap->buf]];
-
-			if(islandbuf[i].island != j) {
-				j++;
-				vmap->islandIndices[j] = i;
-			}
-		}
-
-		MEM_freeN(vmap->buf);
-
-		vmap->buf = islandbuf;
-		vmap->totalIslands = nislands;
-		MEM_freeN(stack);
-		MEM_freeN(map);
-	}
-
-	return vmap;
-}
-
-
-UvMapVert *EM_get_uv_map_vert(UvVertMap *vmap, unsigned int v)
-{
-	return vmap->vert[v];
-}
-
-void EM_free_uv_vert_map(UvVertMap *vmap)
-{
-	if (vmap) {
-		if (vmap->vert) MEM_freeN(vmap->vert);
-		if (vmap->buf) MEM_freeN(vmap->buf);
-		MEM_freeN(vmap);
-	}
-}
-
-void EM_free_uv_element_map(UvElementMap *vmap)
-{
-	if (vmap) {
-		if (vmap->vert) MEM_freeN(vmap->vert);
-		if (vmap->buf) MEM_freeN(vmap->buf);
-		if (vmap->islandIndices) MEM_freeN(vmap->islandIndices);
-		MEM_freeN(vmap);
-	}
-}
-
-/* poll call for mesh operators requiring a view3d context */
-int EM_view3d_poll(bContext *C)
-{
-	if(ED_operator_editmesh(C) && ED_operator_view3d_active(C))
-		return 1;
-	return 0;
-}
-
-/* higher quality normals */
-
-/* NormalCalc */
-/* NormalCalc modifier: calculates higher quality normals
-*/
-
-/* each edge uses this to  */
-typedef struct EdgeFaceRef {
-	int f1; /* init as -1 */
-	int f2;
-} EdgeFaceRef;
-
-void EM_make_hq_normals(EditMesh *em)
-{
-	EditFace *efa;
-	EditVert *eve;
-	int i;
-
-	EdgeHash *edge_hash = BLI_edgehash_new();
-	EdgeHashIterator *edge_iter;
-	int edge_ref_count = 0;
-	unsigned int ed_v1, ed_v2; /* use when getting the key */
-	EdgeFaceRef *edge_ref_array = MEM_callocN(em->totedge * sizeof(EdgeFaceRef), "Edge Connectivity");
-	EdgeFaceRef *edge_ref;
-	float edge_normal[3];
-
-	EM_init_index_arrays(em, 1, 1, 1);
-
-	for(eve= em->verts.first, i=0; eve; eve= eve->next, i++) {
-		zero_v3(eve->no);
-		eve->tmp.l= i;
-	}
-
-	/* This function adds an edge hash if its not there, and adds the face index */
-#define NOCALC_EDGEWEIGHT_ADD_EDGEREF_FACE(EDV1, EDV2); \
-		{ \
-			const unsigned int mf_v1 = EDV1; \
-			const unsigned int mf_v2 = EDV2; \
-			edge_ref = (EdgeFaceRef *)BLI_edgehash_lookup(edge_hash, mf_v1, mf_v2); \
-			if (!edge_ref) { \
-				edge_ref = &edge_ref_array[edge_ref_count]; edge_ref_count++; \
-				edge_ref->f1 = i; \
-				edge_ref->f2 = -1; \
-				BLI_edgehash_insert(edge_hash, mf_v1, mf_v2, edge_ref); \
-			} \
-			else { \
-				edge_ref->f2 = i; \
-			} \
-		}
-
-
-	efa= em->faces.first;
-	for(i = 0; i < em->totface; i++, efa= efa->next) {
-		if(efa->v4) {
-			NOCALC_EDGEWEIGHT_ADD_EDGEREF_FACE(efa->v1->tmp.l, efa->v2->tmp.l);
-			NOCALC_EDGEWEIGHT_ADD_EDGEREF_FACE(efa->v2->tmp.l, efa->v3->tmp.l);
-			NOCALC_EDGEWEIGHT_ADD_EDGEREF_FACE(efa->v3->tmp.l, efa->v4->tmp.l);
-			NOCALC_EDGEWEIGHT_ADD_EDGEREF_FACE(efa->v4->tmp.l, efa->v1->tmp.l);
-		} else {
-			NOCALC_EDGEWEIGHT_ADD_EDGEREF_FACE(efa->v1->tmp.l, efa->v2->tmp.l);
-			NOCALC_EDGEWEIGHT_ADD_EDGEREF_FACE(efa->v2->tmp.l, efa->v3->tmp.l);
-			NOCALC_EDGEWEIGHT_ADD_EDGEREF_FACE(efa->v3->tmp.l, efa->v1->tmp.l);
-		}
-	}
-
-#undef NOCALC_EDGEWEIGHT_ADD_EDGEREF_FACE
-
-
-	for(edge_iter = BLI_edgehashIterator_new(edge_hash); !BLI_edgehashIterator_isDone(edge_iter); BLI_edgehashIterator_step(edge_iter)) {
-		/* Get the edge vert indices, and edge value (the face indices that use it)*/
-		BLI_edgehashIterator_getKey(edge_iter, &ed_v1, &ed_v2);
-		edge_ref = BLI_edgehashIterator_getValue(edge_iter);
-
-		if (edge_ref->f2 != -1) {
-			EditFace *ef1= EM_get_face_for_index(edge_ref->f1), *ef2= EM_get_face_for_index(edge_ref->f2);
-			float angle= angle_normalized_v3v3(ef1->n, ef2->n);
-			if(angle > 0.0f) {
-				/* We have 2 faces using this edge, calculate the edges normal
-				 * using the angle between the 2 faces as a weighting */
-				add_v3_v3v3(edge_normal, ef1->n, ef2->n);
-				normalize_v3(edge_normal);
-				mul_v3_fl(edge_normal, angle);
-			}
-			else {
-				/* cant do anything useful here!
-				   Set the face index for a vert incase it gets a zero normal */
-				EM_get_vert_for_index(ed_v1)->tmp.l=
-				EM_get_vert_for_index(ed_v2)->tmp.l= -(edge_ref->f1 + 1);
-				continue;
-			}
-		} else {
-			/* only one face attached to that edge */
-			/* an edge without another attached- the weight on this is
-			 * undefined, M_PI/2 is 90d in radians and that seems good enough */
-			copy_v3_v3(edge_normal, EM_get_face_for_index(edge_ref->f1)->n);
-			mul_v3_fl(edge_normal, M_PI/2);
-		}
-		add_v3_v3(EM_get_vert_for_index(ed_v1)->no, edge_normal );
-		add_v3_v3(EM_get_vert_for_index(ed_v2)->no, edge_normal );
-
-
-	}
-	BLI_edgehashIterator_free(edge_iter);
-	BLI_edgehash_free(edge_hash, NULL);
-	MEM_freeN(edge_ref_array);
-
-	/* normalize vertex normals and assign */
-	for(eve= em->verts.first; eve; eve= eve->next) {
-		if(normalize_v3(eve->no) == 0.0f && eve->tmp.l < 0) {
-			/* exceptional case, totally flat */
-			efa= EM_get_face_for_index(-(eve->tmp.l) - 1);
-			copy_v3_v3(eve->no, efa->n);
-		}	
-	}
-
-	EM_free_index_arrays();
-}
-
-void EM_solidify(EditMesh *em, float dist)
-{
-	EditFace *efa;
-	EditVert *eve;
-	float *vert_angles= MEM_callocN(sizeof(float) * em->totvert * 2, "EM_solidify"); /* 2 in 1 */
-	float *vert_accum= vert_angles + em->totvert;
-	float face_angles[4];
-	int i, j;
-
-	for(eve= em->verts.first, i=0; eve; eve= eve->next, i++) {
-		eve->tmp.l= i;
-	}
-
-	efa= em->faces.first;
-	for(i = 0; i < em->totface; i++, efa= efa->next) {
-
-		if(!(efa->f & SELECT))
-			continue;
-
-		if(efa->v4) {
-			angle_quad_v3(face_angles, efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co);
-			j= 3;
-		}
-		else {
-			angle_tri_v3(face_angles, efa->v1->co, efa->v2->co, efa->v3->co);
-			j= 2;
-		}
-
-		for(; j>=0; j--) {
-			eve= *(&efa->v1 + j);
-			vert_accum[eve->tmp.l] += face_angles[j];
-			vert_angles[eve->tmp.l]+= shell_angle_to_dist(angle_normalized_v3v3(eve->no, efa->n)) * face_angles[j];
-		}
-	}
-
-	for(eve= em->verts.first, i=0; eve; eve= eve->next, i++) {
-		if(vert_accum[i]) { /* zero if unselected */
-			madd_v3_v3fl(eve->co, eve->no, dist * vert_angles[i] / vert_accum[i]);
-		}
-	}
-
-	MEM_freeN(vert_angles);
-}
-
-/* not that optimal!, should be nicer with bmesh */
-static void tag_face_edges(EditFace *efa)
-{
-	if(efa->v4)
-		efa->e1->tmp.l= efa->e2->tmp.l= efa->e3->tmp.l= efa->e4->tmp.l= 1;
-	else
-		efa->e1->tmp.l= efa->e2->tmp.l= efa->e3->tmp.l= 1;
-}
-static int tag_face_edges_test(EditFace *efa)
-{
-	if(efa->v4)
-		return (efa->e1->tmp.l || efa->e2->tmp.l || efa->e3->tmp.l || efa->e4->tmp.l) ? 1:0;
-	else
-		return (efa->e1->tmp.l || efa->e2->tmp.l || efa->e3->tmp.l) ? 1:0;
-}
-
-static void em_deselect_nth_face(EditMesh *em, int nth, EditFace *efa_act)
-{
-	EditFace *efa;
-	EditEdge *eed;
-	int ok= 1;
-
-	if(efa_act==NULL) {
-		return;
-	}
-
-	/* to detect loose edges, we put f2 flag on 1 */
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		eed->tmp.l= 0;
-	}
-
-	for (efa= em->faces.first; efa; efa= efa->next) {
-		efa->tmp.l = 0;
-	}
-
-	efa_act->tmp.l = 1;
-
-	while(ok) {
-		ok = 0;
-
-		for (efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->f & SELECT) {
-				if(efa->tmp.l==1) { /* initialize */
-					tag_face_edges(efa);
-				}
-	
-				if(efa->tmp.l) {
-					efa->tmp.l++;
-				}
-			}
-		}
-
-		for (efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->f & SELECT) {
-				if(efa->tmp.l==0 && tag_face_edges_test(efa)) {
-					efa->tmp.l= 1;
-					ok = 1; /* keep looping */
-				}
-			}
-		}
-	}
-
-	for (efa= em->faces.first; efa; efa= efa->next) {
-		if(efa->tmp.l > 0 && efa->tmp.l % nth) {
-			EM_select_face(efa, 0);
-		}
-	}
-	for (efa= em->faces.first; efa; efa= efa->next) {
-		if(efa->f & SELECT) {
-			EM_select_face(efa, 1);
-		}
-	}
-
-	EM_nvertices_selected(em);
-	EM_nedges_selected(em);
-	EM_nfaces_selected(em);
-}
-
-/* not that optimal!, should be nicer with bmesh */
-static void tag_edge_verts(EditEdge *eed)
-{
-	eed->v1->tmp.l= eed->v2->tmp.l= 1;
-}
-static int tag_edge_verts_test(EditEdge *eed)
-{
-	return (eed->v1->tmp.l || eed->v2->tmp.l) ? 1:0;
-}
-
-static void em_deselect_nth_edge(EditMesh *em, int nth, EditEdge *eed_act)
-{
-	EditEdge *eed;
-	EditVert *eve;
-	int ok= 1;
-
-	if(eed_act==NULL) {
-		return;
-	}
-
-	for(eve= em->verts.first; eve; eve= eve->next) {
-		eve->tmp.l= 0;
-	}
-
-	for (eed= em->edges.first; eed; eed= eed->next) {
-		eed->tmp.l = 0;
-	}
-
-	eed_act->tmp.l = 1;
-
-	while(ok) {
-		ok = 0;
-
-		for (eed= em->edges.first; eed; eed= eed->next) {
-			if(eed->f & SELECT) {
-				if(eed->tmp.l==1) { /* initialize */
-					tag_edge_verts(eed);
-				}
-	
-				if(eed->tmp.l) {
-					eed->tmp.l++;
-				}
-			}
-		}
-
-		for (eed= em->edges.first; eed; eed= eed->next) {
-			if(eed->f & SELECT) {
-				if(eed->tmp.l==0 && tag_edge_verts_test(eed)) {
-					eed->tmp.l= 1;
-					ok = 1; /* keep looping */
-				}
-			}
-		}
-	}
-
-	for (eed= em->edges.first; eed; eed= eed->next) {
-		if(eed->tmp.l > 0 && eed->tmp.l % nth) {
-			EM_select_edge(eed, 0);
-		}
-	}
-	for (eed= em->edges.first; eed; eed= eed->next) {
-		if(eed->f & SELECT) {
-			EM_select_edge(eed, 1);
-		}
-	}
-
-	{
-		/* grr, should be a function */
-		EditFace *efa;
-		for (efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->v4) {
-				if(efa->e1->f & efa->e2->f & efa->e3->f & efa->e4->f & SELECT );
-				else efa->f &= ~SELECT;
-			}
-			else {
-				if(efa->e1->f & efa->e2->f & efa->e3->f & SELECT );
-				else efa->f &= ~SELECT;
-			}
-		}
-	}
-
-	EM_nvertices_selected(em);
-	EM_nedges_selected(em);
-	EM_nfaces_selected(em);
-}
-
-static void em_deselect_nth_vert(EditMesh *em, int nth, EditVert *eve_act)
-{
-	EditVert *eve;
-	EditEdge *eed;
-	int ok= 1;
-
-	if(eve_act==NULL) {
-		return;
-	}
-
-	for (eve= em->verts.first; eve; eve= eve->next) {
-		eve->tmp.l = 0;
-	}
-
-	eve_act->tmp.l = 1;
-
-	while(ok) {
-		ok = 0;
-
-		for (eve= em->verts.first; eve; eve= eve->next) {
-			if(eve->f & SELECT) {
-				if(eve->tmp.l)
-					eve->tmp.l++;
-			}
-		}
-
-		for (eed= em->edges.first; eed; eed= eed->next) {
-			if(eed->f & SELECT) {
-				if(eed->v1->tmp.l==2 && eed->v2->tmp.l==0) { /* initialize */
-					eed->v2->tmp.l= 1;
-					ok = 1; /* keep looping */
-				}
-				else if(eed->v2->tmp.l==2 && eed->v1->tmp.l==0) { /* initialize */
-					eed->v1->tmp.l= 1;
-					ok = 1; /* keep looping */
-				}
-			}
-		}
-	}
-
-	for (eve= em->verts.first; eve; eve= eve->next) {
-		if(eve->tmp.l > 0 && eve->tmp.l % nth) {
-			eve->f &= ~SELECT;
-		}
-	}
-
-	EM_deselect_flush(em);
-
-	EM_nvertices_selected(em);
-	// EM_nedges_selected(em); // flush does these
-	// EM_nfaces_selected(em); // flush does these
-}
-
-static void deselect_nth_active(EditMesh *em, EditVert **eve_p, EditEdge **eed_p, EditFace **efa_p)
-{
-	EditSelection *ese;
-
-	*eve_p= NULL;
-	*eed_p= NULL;
-	*efa_p= NULL;
-
-	ese= (EditSelection*)em->selected.last;
-
-	if(ese) {
-		switch(ese->type) {
-		case EDITVERT:
-			*eve_p= (EditVert *)ese->data;
-			return;
-		case EDITEDGE:
-			*eed_p= (EditEdge *)ese->data;
-			return;
-		case EDITFACE:
-			*efa_p= (EditFace *)ese->data;
-			return;
-		}
-	}
-
-	if(em->selectmode & SCE_SELECT_VERTEX) {
-		EditVert *eve;
-		for (eve= em->verts.first; eve; eve= eve->next) {
-			if(eve->f & SELECT) {
-				*eve_p= eve;
-				return;
-			}
-		}
-	}
-
-	if(em->selectmode & SCE_SELECT_EDGE) {
-		EditEdge *eed;
-		for (eed= em->edges.first; eed; eed= eed->next) {
-			if(eed->f & SELECT) {
-				*eed_p= eed;
-				return;
-			}
-		}
-	}
-
-	if(em->selectmode & SCE_SELECT_FACE) {
-		EditFace *efa= EM_get_actFace(em, 1);
-		if(efa) {
-			*efa_p= efa;
-			return;
-		}
-	}
-}
-
-int EM_deselect_nth(EditMesh *em, int nth)
-{
-	EditVert *eve;
-	EditEdge *eed;
-	EditFace *efa;
-
-	deselect_nth_active(em, &eve, &eed, &efa);
-
-	if(eve)
-		em_deselect_nth_vert(em, nth, eve);
-	else if (eed)
-		em_deselect_nth_edge(em, nth, eed);
-	else if (efa)
-		em_deselect_nth_face(em, nth, efa);
-	else
-		return 0;
-	
-	return 1;
-}
-
-void EM_project_snap_verts(bContext *C, ARegion *ar, Object *obedit, EditMesh *em)
-{
-	EditVert *eve;
-	for(eve= em->verts.first;eve; eve=eve->next) {
-		if(eve->f & SELECT) {
-			float mval[2], vec[3], no_dummy[3];
-			int dist_dummy;
-			mul_v3_m4v3(vec, obedit->obmat, eve->co);
-			project_float_noclip(ar, vec, mval);
-			if(snapObjectsContext(C, mval, &dist_dummy, vec, no_dummy, SNAP_NOT_OBEDIT)) {
-				mul_v3_m4v3(eve->co, obedit->imat, vec);
-			}
-		}
-	}
-}
diff --git a/source/blender/editors/mesh/editmesh_loop.c b/source/blender/editors/mesh/editmesh_loop.c
deleted file mode 100644
index 0169533..0000000
--- a/source/blender/editors/mesh/editmesh_loop.c
+++ /dev/null
@@ -1,427 +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) 2004 by Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/mesh/editmesh_loop.c
- *  \ingroup edmesh
- */
-
-
-/*
-
-editmesh_loop: tools with own drawing subloops, select, knife, subdiv
-
-*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include "MEM_guardedalloc.h"
-
-
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
-#include "BLI_utildefines.h"
-#include "BLI_editVert.h"
-#include "BLI_ghash.h"
-
-#include "BKE_context.h"
-#include "BKE_depsgraph.h"
-#include "BKE_mesh.h"
-
-#include "PIL_time.h"
-
-#include "BIF_gl.h"
-
-#include "RNA_access.h"
-#include "RNA_define.h"
-
-#include "WM_api.h"
-#include "WM_types.h"
-
-#include "ED_mesh.h"
-#include "ED_view3d.h"
-
-#include "mesh_intern.h"
-
-/* **** XXX ******** */
-static void error(const char *UNUSED(arg)) {}
-/* **** XXX ******** */
-
-/*   ***************** TRAIL ************************
-
-Read a trail of mouse coords and return them as an array of CutCurve structs
-len returns number of mouse coords read before commiting with RETKEY   
-It is up to the caller to free the block when done with it,
-
-XXX Is only used here, so local inside this file (ton)
- */
-
-#define TRAIL_POLYLINE 1 /* For future use, They don't do anything yet */
-#define TRAIL_FREEHAND 2
-#define TRAIL_MIXED    3 /* (1|2) */
-#define TRAIL_AUTO     4 
-#define	TRAIL_MIDPOINTS 8
-
-typedef struct CutCurve {
-	float  x; 
-	float  y;
-} CutCurve;
-
-
-/* ******************************************************************** */
-/* Knife Subdivide Tool.  Subdivides edges intersected by a mouse trail
-	drawn by user.
-	
-	Currently mapped to KKey when in MeshEdit mode.
-	Usage:
-		Hit Shift K, Select Centers or Exact
-		Hold LMB down to draw path, hit RETKEY.
-		ESC cancels as expected.
-   
-	Contributed by Robert Wenzlaff (Det. Thorn).
-
-	2.5 revamp:
-	- non modal (no menu before cutting)
-	- exit on mouse release
-	- polygon/segment drawing can become handled by WM cb later
-
-*/
-
-#define KNIFE_EXACT		1
-#define KNIFE_MIDPOINT	2
-#define KNIFE_MULTICUT	3
-
-static EnumPropertyItem knife_items[]= {
-	{KNIFE_EXACT, "EXACT", 0, "Exact", ""},
-	{KNIFE_MIDPOINT, "MIDPOINTS", 0, "Midpoints", ""},
-	{KNIFE_MULTICUT, "MULTICUT", 0, "Multicut", ""},
-	{0, NULL, 0, NULL, NULL}
-};
-
-/* seg_intersect() Determines if and where a mouse trail intersects an EditEdge */
-
-static float seg_intersect(EditEdge *e, CutCurve *c, int len, char mode, struct GHash *gh)
-{
-#define MAXSLOPE 100000
-	float  x11, y11, x12=0, y12=0, x2max, x2min, y2max;
-	float  y2min, dist, lastdist=0, xdiff2, xdiff1;
-	float  m1, b1, m2, b2, x21, x22, y21, y22, xi;
-	float  yi, x1min, x1max, y1max, y1min, perc=0; 
-	float  *scr;
-	float  threshold;
-	int  i;
-	
-	threshold = 0.000001; /*tolerance for vertex intersection*/
-	// XXX	threshold = scene->toolsettings->select_thresh / 100;
-	
-	/* Get screen coords of verts */
-	scr = BLI_ghash_lookup(gh, e->v1);
-	x21=scr[0];
-	y21=scr[1];
-	
-	scr = BLI_ghash_lookup(gh, e->v2);
-	x22=scr[0];
-	y22=scr[1];
-	
-	xdiff2=(x22-x21);  
-	if (xdiff2) {
-		m2=(y22-y21)/xdiff2;
-		b2= ((x22*y21)-(x21*y22))/xdiff2;
-	}
-	else {
-		m2=MAXSLOPE;  /* Verticle slope  */
-		b2=x22;      
-	}
-	
-	/*check for *exact* vertex intersection first*/
-	if(mode!=KNIFE_MULTICUT){
-		for (i=0; i<len; i++){
-			if (i>0){
-				x11=x12;
-				y11=y12;
-			}
-			else {
-				x11=c[i].x;
-				y11=c[i].y;
-			}
-			x12=c[i].x;
-			y12=c[i].y;
-			
-			/*test e->v1*/
-			if((x11 == x21 && y11 == y21) || (x12 == x21 && y12 == y21)){
-				e->v1->f1 = 1;
-				perc = 0;
-				return(perc);
-			}
-			/*test e->v2*/
-			else if((x11 == x22 && y11 == y22) || (x12 == x22 && y12 == y22)){
-				e->v2->f1 = 1;
-				perc = 0;
-				return(perc);
-			}
-		}
-	}
-	
-	/*now check for edge interesect (may produce vertex intersection as well)*/
-	for (i=0; i<len; i++){
-		if (i>0){
-			x11=x12;
-			y11=y12;
-		}
-		else {
-			x11=c[i].x;
-			y11=c[i].y;
-		}
-		x12=c[i].x;
-		y12=c[i].y;
-		
-		/* Perp. Distance from point to line */
-		if (m2!=MAXSLOPE) dist=(y12-m2*x12-b2);/* /sqrt(m2*m2+1); Only looking for */
-			/* change in sign.  Skip extra math */	
-		else dist=x22-x12;	
-		
-		if (i==0) lastdist=dist;
-		
-		/* if dist changes sign, and intersect point in edge's Bound Box*/
-		if ((lastdist*dist)<=0){
-			xdiff1=(x12-x11); /* Equation of line between last 2 points */
-			if (xdiff1){
-				m1=(y12-y11)/xdiff1;
-				b1= ((x12*y11)-(x11*y12))/xdiff1;
-			}
-			else{
-				m1=MAXSLOPE;
-				b1=x12;
-			}
-			x2max=MAX2(x21,x22)+0.001f; /* prevent missed edges   */
-			x2min=MIN2(x21,x22)-0.001f; /* due to round off error */
-			y2max=MAX2(y21,y22)+0.001f;
-			y2min=MIN2(y21,y22)-0.001f;
-			
-			/* Found an intersect,  calc intersect point */
-			if (m1==m2){ /* co-incident lines */
-				/* cut at 50% of overlap area*/
-				x1max=MAX2(x11, x12);
-				x1min=MIN2(x11, x12);
-				xi= (MIN2(x2max,x1max)+MAX2(x2min,x1min))/2.0f;
-				
-				y1max=MAX2(y11, y12);
-				y1min=MIN2(y11, y12);
-				yi= (MIN2(y2max,y1max)+MAX2(y2min,y1min))/2.0f;
-			}			
-			else if (m2==MAXSLOPE){ 
-				xi=x22;
-				yi=m1*x22+b1;
-			}
-			else if (m1==MAXSLOPE){ 
-				xi=x12;
-				yi=m2*x12+b2;
-			}
-			else {
-				xi=(b1-b2)/(m2-m1);
-				yi=(b1*m2-m1*b2)/(m2-m1);
-			}
-			
-			/* Intersect inside bounding box of edge?*/
-			if ((xi>=x2min)&&(xi<=x2max)&&(yi<=y2max)&&(yi>=y2min)){
-				/*test for vertex intersect that may be 'close enough'*/
-				if(mode!=KNIFE_MULTICUT){
-					if(xi <= (x21 + threshold) && xi >= (x21 - threshold)){
-						if(yi <= (y21 + threshold) && yi >= (y21 - threshold)){
-							e->v1->f1 = 1;
-							perc = 0;
-							break;
-						}
-					}
-					if(xi <= (x22 + threshold) && xi >= (x22 - threshold)){
-						if(yi <= (y22 + threshold) && yi >= (y22 - threshold)){
-							e->v2->f1 = 1;
-							perc = 0;
-							break;
-						}
-					}
-				}
-				if ((m2 <= 1.0f) && (m2 >= -1.0f)) perc = (xi-x21)/(x22-x21);
-				else perc=(yi-y21)/(y22-y21); /*lower slope more accurate*/
-				//isect=32768.0*(perc+0.0000153); /* Percentage in 1/32768ths */
-				
-				break;
-			}
-		}	
-		lastdist=dist;
-	}
-	return(perc);
-} 
-
-/* for multicut */
-#define MAX_CUTS 256
-
-/* for amount of edges */
-#define MAX_CUT_EDGES 1024
-
-static int knife_cut_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
-	ED_view3d_operator_properties_viewmat_set(C, op);
-
-	return WM_gesture_lines_invoke(C, op, event);
-}
-
-static int knife_cut_exec(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
-	EditEdge *eed;
-	EditVert *eve;
-	CutCurve curve[MAX_CUT_EDGES];
-	struct GHash *gh;
-	float isect=0.0;
-	float  *scr, co[4];
-	int len=0;
-	short numcuts= RNA_int_get(op->ptr, "num_cuts"); 
-	short mode= RNA_enum_get(op->ptr, "type");
-	int winx, winy;
-	float persmat[4][4];
-//	int corner_cut_pattern= RNA_enum_get(op->ptr,"corner_cut_pattern");
-	
-	/* edit-object needed for matrix, and ar->regiondata for projections to work */
-	if (obedit == NULL)
-		return OPERATOR_CANCELLED;
-	
-	if (EM_nvertices_selected(em) < 2) {
-		error("No edges are selected to operate on");
-		BKE_mesh_end_editmesh(obedit->data, em);
-		return OPERATOR_CANCELLED;
-	}
-
-	/* get the cut curve */
-	RNA_BEGIN(op->ptr, itemptr, "path") {
-		
-		RNA_float_get_array(&itemptr, "loc", (float *)&curve[len]);
-		len++;
-		if(len>= MAX_CUT_EDGES) break;
-	}
-	RNA_END;
-	
-	if(len<2) {
-		BKE_mesh_end_editmesh(obedit->data, em);
-		return OPERATOR_CANCELLED;
-	}
-
-	ED_view3d_operator_properties_viewmat_get(op, &winx, &winy, persmat);
-
-	/*store percentage of edge cut for KNIFE_EXACT here.*/
-	for(eed=em->edges.first; eed; eed= eed->next) 
-		eed->tmp.fp = 0.0; 
-	
-	/*the floating point coordinates of verts in screen space will be stored in a hash table according to the vertices pointer*/
-	gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "knife_cut_exec gh");
-	for(eve=em->verts.first; eve; eve=eve->next){
-		scr = MEM_mallocN(sizeof(float)*2, "Vertex Screen Coordinates");
-		VECCOPY(co, eve->co);
-		co[3]= 1.0;
-		mul_m4_v4(obedit->obmat, co);
-		apply_project_float(persmat, winx, winy, co, scr);
-		BLI_ghash_insert(gh, eve, scr);
-		eve->f1 = 0; /*store vertex intersection flag here*/
-	
-	}
-	
-	eed= em->edges.first;		
-	while(eed) {	
-		if( eed->v1->f & eed->v2->f & SELECT ){		// NOTE: uses vertex select, subdiv doesnt do edges yet
-			isect= seg_intersect(eed, curve, len, mode, gh);
-			if (isect!=0.0f) eed->f2= 1;
-			else eed->f2=0;
-			eed->tmp.fp= isect;
-		}
-		else {
-			eed->f2=0;
-			eed->f1=0;
-		}
-		eed= eed->next;
-	}
-	
-	if (mode==KNIFE_MIDPOINT) esubdivideflag(obedit, em, SELECT, 0, 0, B_KNIFE, 1, SUBDIV_CORNER_INNERVERT, SUBDIV_SELECT_INNER);
-	else if (mode==KNIFE_MULTICUT) esubdivideflag(obedit, em, SELECT, 0, 0, B_KNIFE, numcuts, SUBDIV_CORNER_INNERVERT, SUBDIV_SELECT_INNER);
-	else esubdivideflag(obedit, em, SELECT, 0, 0, B_KNIFE|B_PERCENTSUBD, 1, SUBDIV_CORNER_INNERVERT, SUBDIV_SELECT_INNER);
-
-	eed=em->edges.first;
-	while(eed){
-		eed->f2=0;
-		eed->f1=0;
-		eed=eed->next;
-	}	
-	
-	BLI_ghash_free(gh, NULL, (GHashValFreeFP)MEM_freeN);
-	
-	BKE_mesh_end_editmesh(obedit->data, em);
-
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-
-	return OPERATOR_FINISHED;
-}
-
-
-void MESH_OT_knife_cut(wmOperatorType *ot)
-{
-	PropertyRNA *prop;
-	
-	ot->name= "Knife Cut";
-	ot->description= "Cut selected edges and faces into parts";
-	ot->idname= "MESH_OT_knife_cut";
-	
-	ot->invoke= knife_cut_invoke;
-	ot->modal= WM_gesture_lines_modal;
-	ot->exec= knife_cut_exec;
-	ot->cancel= WM_gesture_lines_cancel;
-	
-	ot->poll= EM_view3d_poll;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-	
-	RNA_def_enum(ot->srna, "type", knife_items, KNIFE_EXACT, "Type", "");
-	prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
-	RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
-	RNA_def_int(ot->srna, "num_cuts", 1, 1, MAX_CUTS, "Number of Cuts", "Only for Multi-Cut", 1, MAX_CUTS);
-	// doesn't work atm.. RNA_def_enum(ot->srna, "corner_cut_pattern", corner_type_items, SUBDIV_CORNER_INNERVERT, "Corner Cut Pattern", "Topology pattern to use to fill a face after cutting across its corner");
-	
-	/* internal */
-	prop = RNA_def_int(ot->srna, "cursor", BC_KNIFECURSOR, 0, INT_MAX, "Cursor", "", 0, INT_MAX);
-	RNA_def_property_flag(prop, PROP_HIDDEN);
-
-	ED_view3d_operator_properties_viewmat(ot);
-}
-
-/* ******************************************************* */
-
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
new file mode 100644
index 0000000..12174d5
--- /dev/null
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -0,0 +1,591 @@
+/*
+ * ***** 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) 2007 Blender Foundation.
+ * All rights reserved.
+ *
+ * 
+ * Contributor(s): Joseph Eagar, Joshua Leung
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/editors/mesh/editmesh_loopcut.c
+ *  \ingroup edmesh
+ */
+
+#include <float.h>
+#define _USE_MATH_DEFINES
+#include <math.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdio.h>
+
+#include "DNA_ID.h"
+#include "DNA_object_types.h"
+#include "DNA_mesh_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_userdef_types.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "PIL_time.h"
+
+#include "BLI_array.h"
+#include "BLI_blenlib.h"
+#include "BLI_math.h"
+#include "BLI_dynstr.h" /*for WM_operator_pystring */
+#include "BLI_utildefines.h"
+
+#include "BKE_blender.h"
+#include "BKE_context.h"
+#include "BKE_depsgraph.h"
+#include "BKE_mesh.h"
+#include "BKE_modifier.h"
+#include "BKE_report.h"
+#include "BKE_scene.h"
+#include "BKE_tessmesh.h"
+#include "BKE_depsgraph.h"
+
+#include "BIF_gl.h"
+#include "BIF_glutil.h" /* for paint cursor */
+
+#include "IMB_imbuf_types.h"
+
+#include "ED_screen.h"
+#include "ED_space_api.h"
+#include "ED_view3d.h"
+#include "ED_mesh.h"
+#include "ED_numinput.h"
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+
+#include "UI_interface.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "mesh_intern.h"
+
+/* ringsel operator */
+
+/* struct for properties used while drawing */
+typedef struct tringselOpData {
+	ARegion *ar;        /* region that ringsel was activated in */
+	void *draw_handle;  /* for drawing preview loop */
+	
+	float (*edges)[2][3];
+	int totedge;
+
+	ViewContext vc;
+
+	Object *ob;
+	BMEditMesh *em;
+	BMEdge *eed;
+	NumInput num;
+
+	int extend;
+	int do_cut;
+} tringselOpData;
+
+/* modal loop selection drawing callback */
+static void ringsel_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
+{
+	View3D *v3d = CTX_wm_view3d(C);
+	tringselOpData *lcd = arg;
+	int i;
+	
+	if (lcd->totedge > 0) {
+		if (v3d && v3d->zbuf)
+			glDisable(GL_DEPTH_TEST);
+
+		glPushMatrix();
+		glMultMatrixf(lcd->ob->obmat);
+
+		glColor3ub(255, 0, 255);
+		glBegin(GL_LINES);
+		for (i = 0; i < lcd->totedge; i++) {
+			glVertex3fv(lcd->edges[i][0]);
+			glVertex3fv(lcd->edges[i][1]);
+		}
+		glEnd();
+
+		glPopMatrix();
+		if (v3d && v3d->zbuf)
+			glEnable(GL_DEPTH_TEST);
+	}
+}
+
+/* given two opposite edges in a face, finds the ordering of their vertices so
+ * that cut preview lines won't cross each other */
+static void edgering_find_order(BMEdge *lasteed, BMEdge *eed,
+                                BMVert *lastv1, BMVert *v[2][2])
+{
+	BMIter liter;
+	BMLoop *l, *l2;
+	int rev;
+
+	l = eed->l;
+
+	/* find correct order for v[1] */
+	if (!(BM_edge_in_face(l->f, eed) && BM_edge_in_face(l->f, lasteed))) {
+		BM_ITER_ELEM (l, &liter, l, BM_LOOPS_OF_LOOP) {
+			if (BM_edge_in_face(l->f, eed) && BM_edge_in_face(l->f, lasteed))
+				break;
+		}
+	}
+	
+	/* this should never happen */
+	if (!l) {
+		v[0][0] = eed->v1;
+		v[0][1] = eed->v2;
+		v[1][0] = lasteed->v1;
+		v[1][1] = lasteed->v2;
+		return;
+	}
+	
+	l2 = BM_face_other_edge_loop(l->f, l->e, eed->v1);
+	rev = (l2 == l->prev);
+	while (l2->v != lasteed->v1 && l2->v != lasteed->v2) {
+		l2 = rev ? l2->prev : l2->next;
+	}
+
+	if (l2->v == lastv1) {
+		v[0][0] = eed->v1;
+		v[0][1] = eed->v2;
+	}
+	else {
+		v[0][0] = eed->v2;
+		v[0][1] = eed->v1;
+	}
+}
+
+static void edgering_sel(tringselOpData *lcd, int previewlines, int select)
+{
+	BMEditMesh *em = lcd->em;
+	BMEdge *startedge = lcd->eed;
+	BMEdge *eed, *lasteed;
+	BMVert *v[2][2], *lastv1;
+	BMWalker walker;
+	float (*edges)[2][3] = NULL;
+	BLI_array_declare(edges);
+	float co[2][3];
+	int i, tot = 0;
+	
+	memset(v, 0, sizeof(v));
+	
+	if (!startedge)
+		return;
+
+	if (lcd->edges) {
+		MEM_freeN(lcd->edges);
+		lcd->edges = NULL;
+		lcd->totedge = 0;
+	}
+
+	if (!lcd->extend) {
+		EDBM_flag_disable_all(lcd->em, BM_ELEM_SELECT);
+	}
+
+	if (select) {
+		BMW_init(&walker, em->bm, BMW_EDGERING,
+		         BMW_MASK_NOP, BMW_MASK_NOP, BMW_MASK_NOP,
+		         BMW_FLAG_TEST_HIDDEN,
+		         BMW_NIL_LAY);
+
+		eed = BMW_begin(&walker, startedge);
+		for ( ; eed; eed = BMW_step(&walker)) {
+			BM_edge_select_set(em->bm, eed, TRUE);
+		}
+		BMW_end(&walker);
+
+		return;
+	}
+
+	BMW_init(&walker, em->bm, BMW_EDGERING,
+	         BMW_MASK_NOP, BMW_MASK_NOP, BMW_MASK_NOP,
+	         BMW_FLAG_TEST_HIDDEN,
+	         BMW_NIL_LAY);
+
+	eed = startedge = BMW_begin(&walker, startedge);
+	lastv1 = NULL;
+	for (lasteed = NULL; eed; eed = BMW_step(&walker)) {
+		if (lasteed) {
+			if (lastv1) {
+				v[1][0] = v[0][0];
+				v[1][1] = v[0][1];
+			}
+			else {
+				v[1][0] = lasteed->v1;
+				v[1][1] = lasteed->v2;
+				lastv1 = lasteed->v1;
+			}
+
+			edgering_find_order(lasteed, eed, lastv1, v);
+			lastv1 = v[0][0];
+
+			BLI_array_growitems(edges, previewlines);
+
+			for (i = 1; i <= previewlines; i++) {
+				co[0][0] = (v[0][1]->co[0] - v[0][0]->co[0]) * (i / ((float)previewlines + 1)) + v[0][0]->co[0];
+				co[0][1] = (v[0][1]->co[1] - v[0][0]->co[1]) * (i / ((float)previewlines + 1)) + v[0][0]->co[1];
+				co[0][2] = (v[0][1]->co[2] - v[0][0]->co[2]) * (i / ((float)previewlines + 1)) + v[0][0]->co[2];
+
+				co[1][0] = (v[1][1]->co[0] - v[1][0]->co[0]) * (i / ((float)previewlines + 1)) + v[1][0]->co[0];
+				co[1][1] = (v[1][1]->co[1] - v[1][0]->co[1]) * (i / ((float)previewlines + 1)) + v[1][0]->co[1];
+				co[1][2] = (v[1][1]->co[2] - v[1][0]->co[2]) * (i / ((float)previewlines + 1)) + v[1][0]->co[2];
+
+				copy_v3_v3(edges[tot][0], co[0]);
+				copy_v3_v3(edges[tot][1], co[1]);
+				tot++;
+			}
+		}
+		lasteed = eed;
+	}
+	
+	if (lasteed != startedge && BM_edge_share_face_count(lasteed, startedge)) {
+		v[1][0] = v[0][0];
+		v[1][1] = v[0][1];
+
+		edgering_find_order(lasteed, startedge, lastv1, v);
+		
+		BLI_array_growitems(edges, previewlines);
+
+		for (i = 1; i <= previewlines; i++) {
+			if (!v[0][0] || !v[0][1] || !v[1][0] || !v[1][1])
+				continue;
+			
+			co[0][0] = (v[0][1]->co[0] - v[0][0]->co[0]) * (i / ((float)previewlines + 1)) + v[0][0]->co[0];
+			co[0][1] = (v[0][1]->co[1] - v[0][0]->co[1]) * (i / ((float)previewlines + 1)) + v[0][0]->co[1];
+			co[0][2] = (v[0][1]->co[2] - v[0][0]->co[2]) * (i / ((float)previewlines + 1)) + v[0][0]->co[2];
+
+			co[1][0] = (v[1][1]->co[0] - v[1][0]->co[0]) * (i / ((float)previewlines + 1)) + v[1][0]->co[0];
+			co[1][1] = (v[1][1]->co[1] - v[1][0]->co[1]) * (i / ((float)previewlines + 1)) + v[1][0]->co[1];
+			co[1][2] = (v[1][1]->co[2] - v[1][0]->co[2]) * (i / ((float)previewlines + 1)) + v[1][0]->co[2];
+			
+			copy_v3_v3(edges[tot][0], co[0]);
+			copy_v3_v3(edges[tot][1], co[1]);
+			tot++;
+		}
+	}
+
+	BMW_end(&walker);
+	lcd->edges = edges;
+	lcd->totedge = tot;
+}
+
+static void ringsel_find_edge(tringselOpData *lcd, int cuts)
+{
+	if (lcd->eed) {
+		edgering_sel(lcd, cuts, 0);
+	}
+	else if (lcd->edges) {
+		MEM_freeN(lcd->edges);
+		lcd->edges = NULL;
+		lcd->totedge = 0;
+	}
+}
+
+static void ringsel_finish(bContext *C, wmOperator *op)
+{
+	tringselOpData *lcd = op->customdata;
+	int cuts = RNA_int_get(op->ptr, "number_cuts");
+
+	if (lcd->eed) {
+		BMEditMesh *em = lcd->em;
+
+		edgering_sel(lcd, cuts, 1);
+		
+		if (lcd->do_cut) {
+			BM_mesh_esubdivide(em->bm, BM_ELEM_SELECT,
+			                   0.0f, 0.0f,
+			                   cuts,
+			                   SUBDIV_SELECT_LOOPCUT, SUBD_PATH, 0, FALSE, 0);
+
+			/* force edge slide to edge select mode in in face select mode */
+			if (em->selectmode & SCE_SELECT_FACE) {
+				if (em->selectmode == SCE_SELECT_FACE)
+					em->selectmode = SCE_SELECT_EDGE;
+				else
+					em->selectmode &= ~SCE_SELECT_FACE;
+				CTX_data_tool_settings(C)->selectmode = em->selectmode;
+				EDBM_selectmode_set(em);
+
+				WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, CTX_data_scene(C));
+			}
+
+			WM_event_add_notifier(C, NC_GEOM | ND_SELECT | ND_DATA, lcd->ob->data);
+			DAG_id_tag_update(lcd->ob->data, 0);
+		}
+		else {
+			
+			/* sets as active, useful for other tools */
+			if (em->selectmode & SCE_SELECT_VERTEX)
+				BM_select_history_store(em->bm, lcd->eed->v1);  /* low priority TODO, get vertrex close to mouse */
+			if (em->selectmode & SCE_SELECT_EDGE)
+				BM_select_history_store(em->bm, lcd->eed);
+			
+			EDBM_selectmode_flush(lcd->em);
+			WM_event_add_notifier(C, NC_GEOM | ND_SELECT, lcd->ob->data);
+		}
+	}
+}
+
+/* called when modal loop selection is done... */
+static void ringsel_exit(bContext *UNUSED(C), wmOperator *op)
+{
+	tringselOpData *lcd = op->customdata;
+
+	/* deactivate the extra drawing stuff in 3D-View */
+	ED_region_draw_cb_exit(lcd->ar->type, lcd->draw_handle);
+	
+	if (lcd->edges)
+		MEM_freeN(lcd->edges);
+
+	ED_region_tag_redraw(lcd->ar);
+
+	/* free the custom data */
+	MEM_freeN(lcd);
+	op->customdata = NULL;
+}
+
+/* called when modal loop selection gets set up... */
+static int ringsel_init(bContext *C, wmOperator *op, int do_cut)
+{
+	tringselOpData *lcd;
+	
+	/* alloc new customdata */
+	lcd = op->customdata = MEM_callocN(sizeof(tringselOpData), "ringsel Modal Op Data");
+	
+	/* assign the drawing handle for drawing preview line... */
+	lcd->ar = CTX_wm_region(C);
+	lcd->draw_handle = ED_region_draw_cb_activate(lcd->ar->type, ringsel_draw, lcd, REGION_DRAW_POST_VIEW);
+	lcd->ob = CTX_data_edit_object(C);
+	lcd->em = BMEdit_FromObject(lcd->ob);
+	lcd->extend = do_cut ? 0 : RNA_boolean_get(op->ptr, "extend");
+	lcd->do_cut = do_cut;
+	
+	initNumInput(&lcd->num);
+	lcd->num.idx_max = 0;
+	lcd->num.flag |= NUM_NO_NEGATIVE | NUM_NO_FRACTION;
+	
+	em_setup_viewcontext(C, &lcd->vc);
+
+	ED_region_tag_redraw(lcd->ar);
+
+	return 1;
+}
+
+static int ringcut_cancel(bContext *C, wmOperator *op)
+{
+	/* this is just a wrapper around exit() */
+	ringsel_exit(C, op);
+	return OPERATOR_CANCELLED;
+}
+
+static int ringcut_invoke(bContext *C, wmOperator *op, wmEvent *evt)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	tringselOpData *lcd;
+	BMEdge *edge;
+	int dist = 75;
+
+	if (modifiers_isDeformedByLattice(obedit) || modifiers_isDeformedByArmature(obedit))
+		BKE_report(op->reports, RPT_WARNING, "Loop cut doesn't work well on deformed edit mesh display");
+	
+	view3d_operator_needs_opengl(C);
+
+	if (!ringsel_init(C, op, 1))
+		return OPERATOR_CANCELLED;
+	
+	/* add a modal handler for this operator - handles loop selection */
+	WM_event_add_modal_handler(C, op);
+
+	lcd = op->customdata;
+	lcd->vc.mval[0] = evt->mval[0];
+	lcd->vc.mval[1] = evt->mval[1];
+	
+	edge = EDBM_edge_find_nearest(&lcd->vc, &dist);
+	if (edge != lcd->eed) {
+		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");
+	
+	return OPERATOR_RUNNING_MODAL;
+}
+
+static int loopcut_modal(bContext *C, wmOperator *op, wmEvent *event)
+{
+	int cuts = RNA_int_get(op->ptr, "number_cuts");
+	tringselOpData *lcd = op->customdata;
+	int show_cuts = 0;
+
+	view3d_operator_needs_opengl(C);
+
+	switch (event->type) {
+		case RETKEY:
+		case LEFTMOUSE: /* confirm */ // XXX hardcoded
+			if (event->val == KM_PRESS) {
+				/* finish */
+				ED_region_tag_redraw(lcd->ar);
+				
+				ringsel_finish(C, op);
+				ringsel_exit(C, op);
+				
+				ED_area_headerprint(CTX_wm_area(C), NULL);
+				
+				return OPERATOR_FINISHED;
+			}
+			
+			ED_region_tag_redraw(lcd->ar);
+			break;
+		case RIGHTMOUSE: /* abort */ // XXX hardcoded
+			ED_region_tag_redraw(lcd->ar);
+			ringsel_exit(C, op);
+			ED_area_headerprint(CTX_wm_area(C), NULL);
+
+			return OPERATOR_FINISHED;
+		case ESCKEY:
+			if (event->val == KM_RELEASE) {
+				/* cancel */
+				ED_region_tag_redraw(lcd->ar);
+				ED_area_headerprint(CTX_wm_area(C), NULL);
+				
+				return ringcut_cancel(C, op);
+			}
+			
+			ED_region_tag_redraw(lcd->ar);
+			break;
+		case PADPLUSKEY:
+		case PAGEUPKEY:
+		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;
+			
+			ED_region_tag_redraw(lcd->ar);
+			break;
+		case PADMINUS:
+		case PAGEDOWNKEY:
+		case WHEELDOWNMOUSE:  /* change number of cuts */
+			if (event->val == KM_RELEASE)
+				break;
+
+			cuts = MAX2(cuts - 1, 1);
+			RNA_int_set(op->ptr, "number_cuts", cuts);
+			ringsel_find_edge(lcd, cuts);
+			show_cuts = TRUE;
+			
+			ED_region_tag_redraw(lcd->ar);
+			break;
+		case MOUSEMOVE: { /* mouse moved somewhere to select another loop */
+			int dist = 75;
+			BMEdge *edge;
+
+			lcd->vc.mval[0] = event->mval[0];
+			lcd->vc.mval[1] = event->mval[1];
+			edge = EDBM_edge_find_nearest(&lcd->vc, &dist);
+
+			if (edge != lcd->eed) {
+				lcd->eed = edge;
+				ringsel_find_edge(lcd, cuts);
+			}
+
+			ED_region_tag_redraw(lcd->ar);
+			break;
+		}			
+	}
+	
+	/* using the keyboard to input the number of cuts */
+	if (event->val == KM_PRESS) {
+		float value;
+		
+		if (handleNumInput(&lcd->num, event)) {
+			applyNumInput(&lcd->num, &value);
+			
+			cuts = CLAMPIS(value, 1, 130);
+			
+			RNA_int_set(op->ptr, "number_cuts", cuts);
+			ringsel_find_edge(lcd, cuts);
+			show_cuts = TRUE;
+			
+			ED_region_tag_redraw(lcd->ar);
+		}
+	}
+	
+	if (show_cuts) {
+		char buf[64];
+		BLI_snprintf(buf, sizeof(buf), "Number of Cuts: %d", cuts);
+		ED_area_headerprint(CTX_wm_area(C), buf);
+	}
+	
+	/* keep going until the user confirms */
+	return OPERATOR_RUNNING_MODAL;
+}
+
+/* for bmesh this tool is in bmesh_select.c */
+#if 0
+
+void MESH_OT_edgering_select(wmOperatorType *ot)
+{
+	/* description */
+	ot->name = "Edge Ring Select";
+	ot->idname = "MESH_OT_edgering_select";
+	ot->description = "Select an edge ring";
+	
+	/* callbacks */
+	ot->invoke = ringsel_invoke;
+	ot->poll = ED_operator_editmesh_region_view3d; 
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+	RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection");
+}
+
+#endif
+
+void MESH_OT_loopcut(wmOperatorType *ot)
+{
+	PropertyRNA *prop;
+
+	/* description */
+	ot->name = "Loop Cut";
+	ot->idname = "MESH_OT_loopcut";
+	ot->description = "Add a new loop between existing loops";
+	
+	/* callbacks */
+	ot->invoke = ringcut_invoke;
+	ot->modal = loopcut_modal;
+	ot->cancel = ringcut_cancel;
+	ot->poll = ED_operator_editmesh_region_view3d;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
+
+	/* properties */
+	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);
+}
diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c
deleted file mode 100644
index 0f374e0..0000000
--- a/source/blender/editors/mesh/editmesh_mods.c
+++ /dev/null
@@ -1,4456 +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) 2004 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/mesh/editmesh_mods.c
- *  \ingroup edmesh
- */
-
-
-/*
-
-editmesh_mods.c, UI level access, no geometry changes 
-
-*/
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_material_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
-#include "BLI_editVert.h"
-#include "BLI_rand.h"
-#include "BLI_utildefines.h"
-
-#include "BKE_context.h"
-#include "BKE_displist.h"
-#include "BKE_depsgraph.h"
-#include "BKE_mesh.h"
-#include "BKE_material.h"
-#include "BKE_paint.h"
-#include "BKE_report.h"
-#include "BKE_texture.h"
-
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-
-#include "RE_render_ext.h"  /* externtex */
-
-#include "WM_api.h"
-#include "WM_types.h"
-
-
-#include "RNA_access.h"
-#include "RNA_define.h"
-
-#include "ED_mesh.h"
-#include "ED_screen.h"
-#include "ED_view3d.h"
-#include "ED_uvedit.h"
-
-#include "BIF_gl.h"
-
-#include "mesh_intern.h"
-
-#include "BLO_sys_types.h" // for intptr_t support
-
-/* XXX */
-static void waitcursor(int UNUSED(val)) {}
-static int pupmenu(const char *UNUSED(arg)) {return 0;}
-
-/* ****************************** MIRROR **************** */
-
-void EM_cache_x_mirror_vert(struct Object *ob, struct EditMesh *em)
-{
-	EditVert *eve, *eve_mirror;
-	int index= 0;
-
-	for(eve= em->verts.first; eve; eve= eve->next) {
-		eve->tmp.v= NULL;
-	}
-
-	for(eve= em->verts.first; eve; eve= eve->next, index++) {
-		if(eve->tmp.v==NULL) {
-			eve_mirror = editmesh_get_x_mirror_vert(ob, em, eve, eve->co, index);
-			if(eve_mirror) {
-				eve->tmp.v= eve_mirror;
-				eve_mirror->tmp.v = eve;
-			}
-		}
-	}
-}
-
-static void EM_select_mirrored(Object *obedit, EditMesh *em, int extend)
-{
-
-	EditVert *eve;
-
-	EM_cache_x_mirror_vert(obedit, em);
-
-	for(eve= em->verts.first; eve; eve= eve->next) {
-		if(eve->f & SELECT && eve->tmp.v && (eve->tmp.v != eve->tmp.v->tmp.v)) {
-			eve->tmp.v->f |= SELECT;
-
-			if(extend==FALSE)
-				eve->f &= ~SELECT;
-
-			/* remove the interference */
-			eve->tmp.v->tmp.v= NULL;
-			eve->tmp.v= NULL;
-		}
-	}
-}
-
-void EM_automerge(Scene *scene, Object *obedit, int update)
-{
-	Mesh *me= obedit ? obedit->data : NULL; /* can be NULL */
-	/* int len; */ /* UNUSED */
-
-	if ((scene->toolsettings->automerge) &&
-		(obedit && obedit->type==OB_MESH && (obedit->mode & OB_MODE_EDIT))
-	  ) {
-		EditMesh *em= me->edit_mesh;
-		int totvert= em->totvert, totedge= em->totedge, totface= em->totface;
-
-		/* len = */ /* UNUSED */ removedoublesflag(em, 1, 1, scene->toolsettings->doublimit);
-		if (totvert != em->totvert || totedge != em->totedge || totface != em->totface) {
-			if (update) {
-				DAG_id_tag_update(&me->id, 0);
-			}
-		}
-	}
-}
-
-/* ****************************** SELECTION ROUTINES **************** */
-
-unsigned int em_solidoffs=0, em_wireoffs=0, em_vertoffs=0;	/* set in drawobject.c ... for colorindices */
-
-/* facilities for border select and circle select */
-static char *selbuf= NULL;
-
-/* opengl doesn't support concave... */
-static void draw_triangulated(int mcords[][2], short tot)
-{
-	ListBase lb={NULL, NULL};
-	DispList *dl;
-	float *fp;
-	int a;
-	
-	/* make displist */
-	dl= MEM_callocN(sizeof(DispList), "poly disp");
-	dl->type= DL_POLY;
-	dl->parts= 1;
-	dl->nr= tot;
-	dl->verts= fp=  MEM_callocN(tot*3*sizeof(float), "poly verts");
-	BLI_addtail(&lb, dl);
-	
-	for(a=0; a<tot; a++, fp+=3) {
-		fp[0]= (float)mcords[a][0];
-		fp[1]= (float)mcords[a][1];
-	}
-	
-	/* do the fill */
-	filldisplist(&lb, &lb, 0);
-
-	/* do the draw */
-	dl= lb.first;	/* filldisplist adds in head of list */
-	if(dl->type==DL_INDEX3) {
-		int *index;
-		
-		a= dl->parts;
-		fp= dl->verts;
-		index= dl->index;
-		glBegin(GL_TRIANGLES);
-		while(a--) {
-			glVertex3fv(fp+3*index[0]);
-			glVertex3fv(fp+3*index[1]);
-			glVertex3fv(fp+3*index[2]);
-			index+= 3;
-		}
-		glEnd();
-	}
-	
-	freedisplist(&lb);
-}
-
-
-/* reads rect, and builds selection array for quick lookup */
-/* returns if all is OK */
-int EM_init_backbuf_border(ViewContext *vc, short xmin, short ymin, short xmax, short ymax)
-{
-	struct ImBuf *buf;
-	unsigned int *dr;
-	int a;
-	
-	if(vc->obedit==NULL || vc->v3d->drawtype<OB_SOLID || (vc->v3d->flag & V3D_ZBUF_SELECT)==0) return 0;
-	
-	buf= view3d_read_backbuf(vc, xmin, ymin, xmax, ymax);
-	if(buf==NULL) return 0;
-	if(em_vertoffs==0) return 0;
-
-	dr = buf->rect;
-	
-	/* build selection lookup */
-	selbuf= MEM_callocN(em_vertoffs+1, "selbuf");
-	
-	a= (xmax-xmin+1)*(ymax-ymin+1);
-	while(a--) {
-		if(*dr>0 && *dr<=em_vertoffs) 
-			selbuf[*dr]= 1;
-		dr++;
-	}
-	IMB_freeImBuf(buf);
-	return 1;
-}
-
-int EM_check_backbuf(unsigned int index)
-{
-	if(selbuf==NULL) return 1;
-	if(index>0 && index<=em_vertoffs)
-		return selbuf[index];
-	return 0;
-}
-
-void EM_free_backbuf(void)
-{
-	if(selbuf) MEM_freeN(selbuf);
-	selbuf= NULL;
-}
-
-/* mcords is a polygon mask
-   - grab backbuffer,
-   - draw with black in backbuffer, 
-   - grab again and compare
-   returns 'OK' 
-*/
-int EM_mask_init_backbuf_border(ViewContext *vc, int mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax)
-{
-	unsigned int *dr, *drm;
-	struct ImBuf *buf, *bufmask;
-	int a;
-	GLboolean is_cull;
-	
-	/* method in use for face selecting too */
-	if(vc->obedit==NULL) {
-		if(paint_facesel_test(vc->obact));
-		else if(paint_vertsel_test(vc->obact));
-		else return 0;
-	}
-	else if(vc->v3d->drawtype<OB_SOLID || (vc->v3d->flag & V3D_ZBUF_SELECT)==0) return 0;
-
-	buf= view3d_read_backbuf(vc, xmin, ymin, xmax, ymax);
-	if(buf==NULL) return 0;
-	if(em_vertoffs==0) return 0;
-
-	dr = buf->rect;
-
-	/* draw the mask */
-	glDisable(GL_DEPTH_TEST);
-	
-	glColor3ub(0, 0, 0);
-
-	/* some opengl drivers have problems with draw direction */
-	glGetBooleanv(GL_CULL_FACE, &is_cull);
-	if(is_cull) glDisable(GL_CULL_FACE);
-	
-	/* yah, opengl doesn't do concave... tsk! */
-	ED_region_pixelspace(vc->ar);
-	draw_triangulated(mcords, tot);
-	
-	glBegin(GL_LINE_LOOP);	/* for zero sized masks, lines */
-	for(a=0; a<tot; a++) glVertex2iv(mcords[a]);
-	glEnd();
-	
-	glFinish();	/* to be sure readpixels sees mask */
-	
-	/* grab mask */
-	bufmask= view3d_read_backbuf(vc, xmin, ymin, xmax, ymax);
-	drm = bufmask->rect;
-	if(bufmask==NULL) return 0; /* only when mem alloc fails, go crash somewhere else! */
-	
-	/* build selection lookup */
-	selbuf= MEM_callocN(em_vertoffs+1, "selbuf");
-	
-	a= (xmax-xmin+1)*(ymax-ymin+1);
-	while(a--) {
-		if(*dr>0 && *dr<=em_vertoffs && *drm==0) selbuf[*dr]= 1;
-		dr++; drm++;
-	}
-	IMB_freeImBuf(buf);
-	IMB_freeImBuf(bufmask);
-	
-	if(is_cull) glEnable(GL_CULL_FACE);
-
-	return 1;
-	
-}
-
-/* circle shaped sample area */
-int EM_init_backbuf_circle(ViewContext *vc, short xs, short ys, short rads)
-{
-	struct ImBuf *buf;
-	unsigned int *dr;
-	short xmin, ymin, xmax, ymax, xc, yc;
-	int radsq;
-	
-	/* method in use for face selecting too */
-	if(vc->obedit==NULL) {
-		if(paint_facesel_test(vc->obact));
-		else if (paint_vertsel_test(vc->obact));
-		else return 0;
-	}
-	else if(vc->v3d->drawtype<OB_SOLID || (vc->v3d->flag & V3D_ZBUF_SELECT)==0) return 0;
-	
-	xmin= xs-rads; xmax= xs+rads;
-	ymin= ys-rads; ymax= ys+rads;
-	buf= view3d_read_backbuf(vc, xmin, ymin, xmax, ymax);
-	if(em_vertoffs==0) return 0;
-	if(buf==NULL) return 0;
-
-	dr = buf->rect;
-	
-	/* build selection lookup */
-	selbuf= MEM_callocN(em_vertoffs+1, "selbuf");
-	radsq= rads*rads;
-	for(yc= -rads; yc<=rads; yc++) {
-		for(xc= -rads; xc<=rads; xc++, dr++) {
-			if(xc*xc + yc*yc < radsq) {
-				if(*dr>0 && *dr<=em_vertoffs) selbuf[*dr]= 1;
-			}
-		}
-	}
-
-	IMB_freeImBuf(buf);
-	return 1;
-	
-}
-
-static void findnearestvert__doClosest(void *userData, EditVert *eve, int x, int y, int index)
-{
-	struct { int mval[2]; short pass, select, strict; int dist, lastIndex, closestIndex; EditVert *closest; } *data = userData;
-
-	if (data->pass==0) {
-		if (index<=data->lastIndex)
-			return;
-	} else {
-		if (index>data->lastIndex)
-			return;
-	}
-
-	if (data->dist>3) {
-		int temp = abs(data->mval[0] - x) + abs(data->mval[1]- y);
-		if ((eve->f&1) == data->select) {
-			if (data->strict == 1)
-				return;
-			else
-				temp += 5;
-		}
-
-		if (temp<data->dist) {
-			data->dist = temp;
-			data->closest = eve;
-			data->closestIndex = index;
-		}
-	}
-}
-
-
-
-
-static unsigned int findnearestvert__backbufIndextest(void *handle, unsigned int index)
-{
-	EditMesh *em= (EditMesh *)handle;
-	EditVert *eve = BLI_findlink(&em->verts, index-1);
-
-	if(eve && (eve->f & SELECT)) return 0;
-	return 1; 
-}
-/**
- * findnearestvert
- * 
- * dist (in/out): minimal distance to the nearest and at the end, actual distance
- * sel: selection bias
- * 		if SELECT, selected vertice are given a 5 pixel bias to make them farter than unselect verts
- * 		if 0, unselected vertice are given the bias
- * strict: if 1, the vertice corresponding to the sel parameter are ignored and not just biased 
- */
-EditVert *findnearestvert(ViewContext *vc, int *dist, short sel, short strict)
-{
-	if(vc->v3d->drawtype>OB_WIRE && (vc->v3d->flag & V3D_ZBUF_SELECT)){
-		int distance;
-		unsigned int index;
-		EditVert *eve;
-		
-		if(strict) index = view3d_sample_backbuf_rect(vc, vc->mval, 50, em_wireoffs, 0xFFFFFF, &distance, strict, vc->em, findnearestvert__backbufIndextest); 
-		else index = view3d_sample_backbuf_rect(vc, vc->mval, 50, em_wireoffs, 0xFFFFFF, &distance, 0, NULL, NULL); 
-		
-		eve = BLI_findlink(&vc->em->verts, index-1);
-		
-		if(eve && distance < *dist) {
-			*dist = distance;
-			return eve;
-		} else {
-			return NULL;
-		}
-			
-	}
-	else {
-		struct { int mval[2]; short pass, select, strict; int dist, lastIndex, closestIndex; EditVert *closest; } data;
-		static int lastSelectedIndex=0;
-		static EditVert *lastSelected=NULL;
-
-		if (lastSelected && BLI_findlink(&vc->em->verts, lastSelectedIndex)!=lastSelected) {
-			lastSelectedIndex = 0;
-			lastSelected = NULL;
-		}
-
-		data.lastIndex = lastSelectedIndex;
-		data.mval[0] = vc->mval[0];
-		data.mval[1] = vc->mval[1];
-		data.select = sel;
-		data.dist = *dist;
-		data.strict = strict;
-		data.closest = NULL;
-		data.closestIndex = 0;
-
-		data.pass = 0;
-
-		ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
-
-		mesh_foreachScreenVert(vc, findnearestvert__doClosest, &data, V3D_CLIP_TEST_RV3D_CLIPPING);
-
-		if (data.dist>3) {
-			data.pass = 1;
-			mesh_foreachScreenVert(vc, findnearestvert__doClosest, &data, V3D_CLIP_TEST_RV3D_CLIPPING);
-		}
-
-		*dist = data.dist;
-		lastSelected = data.closest;
-		lastSelectedIndex = data.closestIndex;
-
-		return data.closest;
-	}
-}
-
-/* returns labda for closest distance v1 to line-piece v2-v3 */
-static float labda_PdistVL2Dfl( float *v1, float *v2, float *v3) 
-{
-	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, EditEdge *eed, int x0, int y0, int x1, int y1, int UNUSED(index))
-{
-	struct { ViewContext vc; float mval[2]; int dist; EditEdge *closest; } *data = userData;
-	float v1[2], v2[2];
-	int distance;
-
-	ED_view3d_local_clipping(data->vc.rv3d, data->vc.obedit->obmat); /* for local clipping lookups */
-
-	v1[0] = x0;
-	v1[1] = y0;
-	v2[0] = x1;
-	v2[1] = y1;
-
-	distance= dist_to_line_segment_v2(data->mval, v1, v2);
-
-
-	if(eed->f & SELECT) distance+=5;
-	if(distance < data->dist) {
-		if(data->vc.rv3d->rflag & RV3D_CLIPPING) {
-			float labda= labda_PdistVL2Dfl(data->mval, v1, v2);
-			float vec[3];
-
-			vec[0]= eed->v1->co[0] + labda*(eed->v2->co[0] - eed->v1->co[0]);
-			vec[1]= eed->v1->co[1] + labda*(eed->v2->co[1] - eed->v1->co[1]);
-			vec[2]= eed->v1->co[2] + labda*(eed->v2->co[2] - eed->v1->co[2]);
-
-			if(ED_view3d_test_clipping(data->vc.rv3d, vec, 1)==0) {
-				data->dist = distance;
-				data->closest = eed;
-			}
-		}
-		else {
-			data->dist = distance;
-			data->closest = eed;
-		}
-	}
-}
-EditEdge *findnearestedge(ViewContext *vc, int *dist)
-{
-
-	if(vc->v3d->drawtype>OB_WIRE && (vc->v3d->flag & V3D_ZBUF_SELECT)) {
-		int distance;
-		unsigned int index = view3d_sample_backbuf_rect(vc, vc->mval, 50, em_solidoffs, em_wireoffs, &distance,0, NULL, NULL);
-		EditEdge *eed = BLI_findlink(&vc->em->edges, index-1);
-
-		if (eed && distance<*dist) {
-			*dist = distance;
-			return eed;
-		} else {
-			return NULL;
-		}
-	}
-	else {
-		struct { ViewContext vc; float mval[2]; int dist; EditEdge *closest; } data;
-
-		data.vc= *vc;
-		data.mval[0] = vc->mval[0];
-		data.mval[1] = vc->mval[1];
-		data.dist = *dist;
-		data.closest = NULL;
-
-		ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
-		mesh_foreachScreenEdge(vc, findnearestedge__doClosest, &data, V3D_CLIP_TEST_REGION);
-
-		*dist = data.dist;
-		return data.closest;
-	}
-}
-
-static void findnearestface__getDistance(void *userData, EditFace *efa, int x, int y, int UNUSED(index))
-{
-	struct { int mval[2]; int dist; EditFace *toFace; } *data = userData;
-
-	if (efa==data->toFace) {
-		int temp = abs(data->mval[0]-x) + abs(data->mval[1]-y);
-
-		if (temp<data->dist)
-			data->dist = temp;
-	}
-}
-static void findnearestface__doClosest(void *userData, EditFace *efa, int x, int y, int index)
-{
-	struct { int mval[2]; short pass; int dist, lastIndex, closestIndex; EditFace *closest; } *data = userData;
-
-	if (data->pass==0) {
-		if (index<=data->lastIndex)
-			return;
-	} else {
-		if (index>data->lastIndex)
-			return;
-	}
-
-	if (data->dist>3) {
-		int temp = abs(data->mval[0]-x) + abs(data->mval[1]-y);
-
-		if (temp<data->dist) {
-			data->dist = temp;
-			data->closest = efa;
-			data->closestIndex = index;
-		}
-	}
-}
-static EditFace *findnearestface(ViewContext *vc, int *dist)
-{
-
-	if(vc->v3d->drawtype>OB_WIRE && (vc->v3d->flag & V3D_ZBUF_SELECT)) {
-		unsigned int index = view3d_sample_backbuf(vc, vc->mval[0], vc->mval[1]);
-		EditFace *efa = BLI_findlink(&vc->em->faces, index-1);
-
-		if (efa) {
-			struct { int mval[2]; int dist; EditFace *toFace; } data;
-
-			data.mval[0] = vc->mval[0];
-			data.mval[1] = vc->mval[1];
-			data.dist = 0x7FFF;		/* largest short */
-			data.toFace = efa;
-
-			ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
-			mesh_foreachScreenFace(vc, findnearestface__getDistance, &data);
-
-			if(vc->em->selectmode == SCE_SELECT_FACE || data.dist<*dist) {	/* only faces, no dist check */
-				*dist= data.dist;
-				return efa;
-			}
-		}
-		
-		return NULL;
-	}
-	else {
-		struct { int mval[2]; short pass; int dist, lastIndex, closestIndex; EditFace *closest; } data;
-		static int lastSelectedIndex=0;
-		static EditFace *lastSelected=NULL;
-
-		if (lastSelected && BLI_findlink(&vc->em->faces, lastSelectedIndex)!=lastSelected) {
-			lastSelectedIndex = 0;
-			lastSelected = NULL;
-		}
-
-		data.lastIndex = lastSelectedIndex;
-		data.mval[0] = vc->mval[0];
-		data.mval[1] = vc->mval[1];
-		data.dist = *dist;
-		data.closest = NULL;
-		data.closestIndex = 0;
-
-		data.pass = 0;
-
-		ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
-		mesh_foreachScreenFace(vc, findnearestface__doClosest, &data);
-
-		if (data.dist>3) {
-			data.pass = 1;
-			mesh_foreachScreenFace(vc, findnearestface__doClosest, &data);
-		}
-
-		*dist = data.dist;
-		lastSelected = data.closest;
-		lastSelectedIndex = data.closestIndex;
-
-		return data.closest;
-	}
-}
-
-/* best distance based on screen coords. 
-   use em->selectmode to define how to use 
-   selected vertices and edges get disadvantage
-   return 1 if found one
-*/
-static int unified_findnearest(ViewContext *vc, EditVert **eve, EditEdge **eed, EditFace **efa) 
-{
-	EditMesh *em= vc->em;
-	int dist= 75;
-	
-	*eve= NULL;
-	*eed= NULL;
-	*efa= NULL;
-	
-	/* no afterqueue (yet), so we check it now, otherwise the em_xxxofs indices are bad */
-	view3d_validate_backbuf(vc);
-	
-	if(em->selectmode & SCE_SELECT_VERTEX)
-		*eve= findnearestvert(vc, &dist, SELECT, 0);
-	if(em->selectmode & SCE_SELECT_FACE)
-		*efa= findnearestface(vc, &dist);
-
-	dist-= 20;	/* since edges select lines, we give dots advantage of 20 pix */
-	if(em->selectmode & SCE_SELECT_EDGE)
-		*eed= findnearestedge(vc, &dist);
-
-	/* return only one of 3 pointers, for frontbuffer redraws */
-	if(*eed) {
-		*efa= NULL; *eve= NULL;
-	}
-	else if(*efa) {
-		*eve= NULL;
-	}
-	
-	return (*eve || *eed || *efa);
-}
-
-
-/* ****************  SIMILAR "group" SELECTS. FACE, EDGE AND VERTEX ************** */
-
-/* selects new faces/edges/verts based on the existing selection */
-
-/* VERT GROUP */
-
-#define SIMVERT_NORMAL	0
-#define SIMVERT_FACE	1
-#define SIMVERT_VGROUP	2
-#define SIMVERT_TOT		3
-
-/* EDGE GROUP */
-
-#define SIMEDGE_LENGTH		101
-#define SIMEDGE_DIR			102
-#define SIMEDGE_FACE		103
-#define SIMEDGE_FACE_ANGLE	104
-#define SIMEDGE_CREASE		105
-#define SIMEDGE_SEAM		106
-#define SIMEDGE_SHARP		107
-#define SIMEDGE_TOT			108
-
-/* FACE GROUP */
-
-#define SIMFACE_MATERIAL	201
-#define SIMFACE_IMAGE		202
-#define SIMFACE_AREA		203
-#define SIMFACE_PERIMETER	204
-#define SIMFACE_NORMAL		205
-#define SIMFACE_COPLANAR	206
-#define SIMFACE_TOT			207
-
-static EnumPropertyItem prop_similar_types[] = {
-	{SIMVERT_NORMAL, "NORMAL", 0, "Normal", ""},
-	{SIMVERT_FACE, "FACE", 0, "Amount of Vertices in Face", ""},
-	{SIMVERT_VGROUP, "VGROUP", 0, "Vertex Groups", ""},
-	{SIMEDGE_LENGTH, "LENGTH", 0, "Length", ""},
-	{SIMEDGE_DIR, "DIR", 0, "Direction", ""},
-	{SIMEDGE_FACE, "FACE", 0, "Amount of Vertices in Face", ""},
-	{SIMEDGE_FACE_ANGLE, "FACE_ANGLE", 0, "Face Angles", ""},
-	{SIMEDGE_CREASE, "CREASE", 0, "Crease", ""},
-	{SIMEDGE_SEAM, "SEAM", 0, "Seam", ""},
-	{SIMEDGE_SHARP, "SHARP", 0, "Sharpness", ""},
-	{SIMFACE_MATERIAL, "MATERIAL", 0, "Material", ""},
-	{SIMFACE_IMAGE, "IMAGE", 0, "Image", ""},
-	{SIMFACE_AREA, "AREA", 0, "Area", ""},
-	{SIMFACE_PERIMETER, "PERIMETER", 0, "Perimeter", ""},
-	{SIMFACE_NORMAL, "NORMAL", 0, "Normal", ""},
-	{SIMFACE_COPLANAR, "COPLANAR", 0, "Co-planar", ""},
-	{0, NULL, 0, NULL, NULL}
-};
-
-
-/* this as a way to compare the ares, perim  of 2 faces thay will scale to different sizes
-*0.5 so smaller faces arnt ALWAYS selected with a thresh of 1.0 */
-#define SCALE_CMP(a,b) ((a+a*thresh >= b) && (a-(a*thresh*0.5f) <= b))
-
-static int similar_face_select__internal(EditMesh *em, int mode, float thresh)
-{
-	EditFace *efa, *base_efa=NULL;
-	unsigned int selcount=0; /*count how many new faces we select*/
-	
-	/*deselcount, count how many deselected faces are left, so we can bail out early
-	also means that if there are no deselected faces, we can avoid a lot of looping */
-	unsigned int deselcount=0; 
-	short ok=0;
-	
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		if (!efa->h) {
-			if (efa->f & SELECT) {
-				efa->f1=1;
-				ok=1;
-			} else {
-				efa->f1=0;
-				deselcount++; /* a deselected face we may select later */
-			}
-		}
-	}
-	
-	if (!ok || !deselcount) /* no data selected OR no more data to select */
-		return 0;
-	
-	if (mode==SIMFACE_AREA) {
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			efa->tmp.fp= EM_face_area(efa);
-		}
-	} else if (mode==SIMFACE_PERIMETER) {
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			efa->tmp.fp= EM_face_perimeter(efa);
-		}
-	}
-	
-	for(base_efa= em->faces.first; base_efa; base_efa= base_efa->next) {
-		if (base_efa->f1) { /* This was one of the faces originaly selected */
-			if (mode==SIMFACE_MATERIAL) { /* same material */
-				for(efa= em->faces.first; efa; efa= efa->next) {
-					if (
-						!(efa->f & SELECT) &&
-						!efa->h &&
-						base_efa->mat_nr == efa->mat_nr
-					) {
-						EM_select_face(efa, 1);
-						selcount++;
-						deselcount--;
-						if (!deselcount) /*have we selected all posible faces?, if so return*/
-							return selcount;
-					}
-				}
-			} else if (mode==SIMFACE_IMAGE) { /* same image */
-				MTFace *tf, *base_tf;
-
-				base_tf = (MTFace*)CustomData_em_get(&em->fdata, base_efa->data,
-													 CD_MTFACE);
-
-				if(!base_tf)
-					return selcount;
-
-				for(efa= em->faces.first; efa; efa= efa->next) {
-					if (!(efa->f & SELECT) && !efa->h) {
-						tf = (MTFace*)CustomData_em_get(&em->fdata, efa->data,
-														CD_MTFACE);
-
-						if(base_tf->tpage == tf->tpage) {
-							EM_select_face(efa, 1);
-							selcount++;
-							deselcount--;
-							if (!deselcount) /*have we selected all posible faces?, if so return*/
-								return selcount;
-						}
-					}
-				}
-			} else if (mode==SIMFACE_AREA || mode==SIMFACE_PERIMETER) { /* same area OR same perimeter, both use the same temp var */
-				for(efa= em->faces.first; efa; efa= efa->next) {
-					if (
-						(!(efa->f & SELECT) && !efa->h) &&
-						SCALE_CMP(base_efa->tmp.fp, efa->tmp.fp)
-					) {
-						EM_select_face(efa, 1);
-						selcount++;
-						deselcount--;
-						if (!deselcount) /*have we selected all posible faces?, if so return*/
-							return selcount;
-					}
-				}
-			} else if (mode==SIMFACE_NORMAL) {
-				float angle;
-				for(efa= em->faces.first; efa; efa= efa->next) {
-					if (!(efa->f & SELECT) && !efa->h) {
-						angle= RAD2DEGF(angle_v3v3(base_efa->n, efa->n));
-						if (angle/180.0f<=thresh) {
-							EM_select_face(efa, 1);
-							selcount++;
-							deselcount--;
-							if (!deselcount) /*have we selected all posible faces?, if so return*/
-								return selcount;
-						}
-					}
-				}
-			} else if (mode==SIMFACE_COPLANAR) { /* same planer */
-				float angle, base_dot, dot;
-				base_dot= dot_v3v3(base_efa->cent, base_efa->n);
-				for(efa= em->faces.first; efa; efa= efa->next) {
-					if (!(efa->f & SELECT) && !efa->h) {
-						angle= RAD2DEGF(angle_v3v3(base_efa->n, efa->n));
-						if (angle/180.0f<=thresh) {
-							dot=dot_v3v3(efa->cent, base_efa->n);
-							if (fabsf(base_dot-dot) <= thresh) {
-								EM_select_face(efa, 1);
-								selcount++;
-								deselcount--;
-								if (!deselcount) /*have we selected all posible faces?, if so return*/
-									return selcount;
-							}
-						}
-					}
-				}
-			}
-		}
-	} /* end base_efa loop */
-	return selcount;
-}
-
-static int similar_face_select_exec(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	Mesh *me= obedit->data;
-	EditMesh *em= BKE_mesh_get_editmesh(me); 
-
-	int selcount = similar_face_select__internal(em, RNA_enum_get(op->ptr, "type"), RNA_float_get(op->ptr, "threshold"));
-	
-	if (selcount) {
-		/* here was an edge-mode only select flush case, has to be generalized */
-		EM_selectmode_flush(em);
-		WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
-	}
-	
-	BKE_mesh_end_editmesh(me, em);
-	return OPERATOR_FINISHED;
-}	
-
-/* ***************************************************** */
-
-static int similar_edge_select__internal(EditMesh *em, int mode, float thresh)
-{
-	EditEdge *eed, *base_eed=NULL;
-	unsigned int selcount=0; /* count how many new edges we select*/
-	
-	/*count how many visible selected edges there are,
-	so we can return when there are none left */
-	unsigned int deselcount=0;
-	
-	short ok=0;
-	
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		if (!eed->h) {
-			if (eed->f & SELECT) {
-				eed->f1=1;
-				ok=1;
-			} else {
-				eed->f1=0;
-				deselcount++;
-			}
-			/* set all eed->tmp.l to 0 we use it later.
-			for counting face users*/
-			eed->tmp.l=0;
-			eed->f2=0; /* only for mode SIMEDGE_FACE_ANGLE, edge animations */
-		}
-	}
-	
-	if (!ok || !deselcount) /* no data selected OR no more data to select*/
-		return 0;
-	
-	if (mode==SIMEDGE_LENGTH) { /*store length*/
-		for(eed= em->edges.first; eed; eed= eed->next) {
-			if (!eed->h) /* dont calc data for hidden edges*/
-				eed->tmp.fp= len_v3v3(eed->v1->co, eed->v2->co);
-		}
-	} else if (mode==SIMEDGE_FACE) { /*store face users*/
-		EditFace *efa;
-		/* cound how many faces each edge uses use tmp->l */
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			efa->e1->tmp.l++;
-			efa->e2->tmp.l++;
-			efa->e3->tmp.l++;
-			if (efa->e4) efa->e4->tmp.l++;
-		}
-	} else if (mode==SIMEDGE_FACE_ANGLE) { /*store edge angles */
-		EditFace *efa;
-		int j;
-		/* cound how many faces each edge uses use tmp.l */
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			/* here we use the edges temp data to assign a face
-			if a face has already been assigned (eed->f2==1)
-			we calculate the angle between the current face and
-			the edges previously found face.
-			store the angle in eed->tmp.fp (loosing the face eed->tmp.f)
-			but tagging eed->f2==2, so we know not to look at it again.
-			This only works for edges that connect to 2 faces. but its good enough
-			*/
-			
-			/* se we can loop through face edges*/
-			j=0;
-			eed= efa->e1;
-			while (j<4) {
-				if (j==1) eed= efa->e2;
-				else if (j==2) eed= efa->e3;
-				else if (j==3) {
-					eed= efa->e4;
-					if (!eed)
-						break;
-				} /* done looping */
-				
-				if (!eed->h) { /* dont calc data for hidden edges*/
-					if (eed->f2==2)
-						break;
-					else if (eed->f2==0) /* first access, assign the face */
-						eed->tmp.f= efa;
-					else if (eed->f2==1) /* second, we assign the angle*/
-						eed->tmp.fp= RAD2DEGF(angle_v3v3(eed->tmp.f->n, efa->n))/180;
-					eed->f2++; /* f2==0 no face assigned. f2==1 one face found. f2==2 angle calculated.*/
-				}
-				j++;
-			}
-		}
-	}
-	
-	for(base_eed= em->edges.first; base_eed; base_eed= base_eed->next) {
-		if (base_eed->f1) {
-			if (mode==SIMEDGE_LENGTH) { /* same length */
-				for(eed= em->edges.first; eed; eed= eed->next) {
-					if (
-						!(eed->f & SELECT) &&
-						!eed->h &&
-						SCALE_CMP(base_eed->tmp.fp, eed->tmp.fp)
-					) {
-						EM_select_edge(eed, 1);
-						selcount++;
-						deselcount--;
-						if (!deselcount) /*have we selected all posible faces?, if so return*/
-							return selcount;
-					}
-				}
-			} else if (mode==SIMEDGE_DIR) { /* same direction */
-				float base_dir[3], dir[3], angle;
-				sub_v3_v3v3(base_dir, base_eed->v1->co, base_eed->v2->co);
-				for(eed= em->edges.first; eed; eed= eed->next) {
-					if (!(eed->f & SELECT) && !eed->h) {
-						sub_v3_v3v3(dir, eed->v1->co, eed->v2->co);
-						angle= RAD2DEGF(angle_v3v3(base_dir, dir));
-						
-						if (angle>90.0f) /* use the smallest angle between the edges */
-							angle= fabsf(angle-180.0f);
-						
-						if (angle / 90.0f<=thresh) {
-							EM_select_edge(eed, 1);
-							selcount++;
-							deselcount--;
-							if (!deselcount) /*have we selected all posible faces?, if so return*/
-								return selcount;
-						}
-					}
-				}
-			} else if (mode==SIMEDGE_FACE) { /* face users */				
-				for(eed= em->edges.first; eed; eed= eed->next) {
-					if (
-						!(eed->f & SELECT) &&
-						!eed->h &&
-						base_eed->tmp.l==eed->tmp.l
-					) {
-						EM_select_edge(eed, 1);
-						selcount++;
-						deselcount--;
-						if (!deselcount) /*have we selected all posible faces?, if so return*/
-							return selcount;
-					}
-				}
-			} else if (mode==SIMEDGE_FACE_ANGLE && base_eed->f2==2) { /* edge angles, f2==2 means the edge has an angle. */				
-				for(eed= em->edges.first; eed; eed= eed->next) {
-					if (
-						!(eed->f & SELECT) &&
-						!eed->h &&
-						eed->f2==2 &&
-						(fabsf(base_eed->tmp.fp-eed->tmp.fp)<=thresh)
-					) {
-						EM_select_edge(eed, 1);
-						selcount++;
-						deselcount--;
-						if (!deselcount) /*have we selected all posible faces?, if so return*/
-							return selcount;
-					}
-				}
-			} else if (mode==SIMEDGE_CREASE) { /* edge crease */
-				for(eed= em->edges.first; eed; eed= eed->next) {
-					if (
-						!(eed->f & SELECT) &&
-						!eed->h &&
-						(fabsf(base_eed->crease-eed->crease) <= thresh)
-					) {
-						EM_select_edge(eed, 1);
-						selcount++;
-						deselcount--;
-						if (!deselcount) /*have we selected all posible faces?, if so return*/
-							return selcount;
-					}
-				}
-			} else if (mode==SIMEDGE_SEAM) { /* edge seam */
-				for(eed= em->edges.first; eed; eed= eed->next) {
-					if (
-						!(eed->f & SELECT) &&
-						!eed->h &&
-						(eed->seam == base_eed->seam)
-					) {
-						EM_select_edge(eed, 1);
-						selcount++;
-						deselcount--;
-						if (!deselcount) /*have we selected all posible faces?, if so return*/
-							return selcount;
-					}
-				}
-			} else if (mode==SIMEDGE_SHARP) { /* edge sharp */
-				for(eed= em->edges.first; eed; eed= eed->next) {
-					if (
-						!(eed->f & SELECT) &&
-						!eed->h &&
-						(eed->sharp == base_eed->sharp)
-					) {
-						EM_select_edge(eed, 1);
-						selcount++;
-						deselcount--;
-						if (!deselcount) /*have we selected all posible faces?, if so return*/
-							return selcount;
-					}
-				}
-			}
-		}
-	}	
-	return selcount;
-}
-/* wrap the above function but do selection flushing edge to face */
-static int similar_edge_select_exec(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	Mesh *me= obedit->data;
-	EditMesh *em= BKE_mesh_get_editmesh(me); 
-
-	int selcount = similar_edge_select__internal(em, RNA_enum_get(op->ptr, "type"), RNA_float_get(op->ptr, "threshold"));
-	
-	if (selcount) {
-		/* here was an edge-mode only select flush case, has to be generalized */
-		EM_selectmode_flush(em);
-		WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
-	}
-
-	BKE_mesh_end_editmesh(me, em);
-	return OPERATOR_FINISHED;
-}
-
-/* ********************************* */
-
-static int similar_vert_select_exec(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	Mesh *me= obedit->data;
-	EditMesh *em= BKE_mesh_get_editmesh(me); 
-	EditVert *eve, *base_eve=NULL;
-	unsigned int selcount=0; /* count how many new edges we select*/
-	
-	/*count how many visible selected edges there are,
-	so we can return when there are none left */
-	unsigned int deselcount=0;
-	int mode= RNA_enum_get(op->ptr, "type");
-	float thresh = RNA_float_get(op->ptr, "threshold");
-	
-	short ok=0;
-	
-	for(eve= em->verts.first; eve; eve= eve->next) {
-		if (!eve->h) {
-			if (eve->f & SELECT) {
-				eve->f1=1;
-				ok=1;
-			} else {
-				eve->f1=0;
-				deselcount++;
-			}
-			/* set all eve->tmp.l to 0 we use them later.*/
-			eve->tmp.l=0;
-		}
-		
-	}
-	
-	if (!ok || !deselcount) { /* no data selected OR no more data to select*/
-		BKE_mesh_end_editmesh(me, em);
-		return OPERATOR_CANCELLED;
-	}
-	
-	if(mode == SIMVERT_FACE) {
-		/* store face users */
-		EditFace *efa;
-		
-		/* count how many faces each edge uses use tmp->l */
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			efa->v1->tmp.l++;
-			efa->v2->tmp.l++;
-			efa->v3->tmp.l++;
-			if (efa->v4) efa->v4->tmp.l++;
-		}
-	}
-	
-	
-	for(base_eve= em->verts.first; base_eve; base_eve= base_eve->next) {
-		if (base_eve->f1) {
-				
-			if(mode == SIMVERT_NORMAL) {
-				float angle;
-				for(eve= em->verts.first; eve; eve= eve->next) {
-					if (!(eve->f & SELECT) && !eve->h) {
-						angle= RAD2DEGF(angle_v3v3(base_eve->no, eve->no));
-						if (angle/180.0f<=thresh) {
-							eve->f |= SELECT;
-							selcount++;
-							deselcount--;
-							if (!deselcount) {/*have we selected all posible faces?, if so return*/
-								BKE_mesh_end_editmesh(me, em);
-								return OPERATOR_FINISHED;
-							}
-						}
-					}
-				}
-			}
-			else if(mode == SIMVERT_FACE) {
-				for(eve= em->verts.first; eve; eve= eve->next) {
-					if (
-						!(eve->f & SELECT) &&
-						!eve->h &&
-						base_eve->tmp.l==eve->tmp.l
-					) {
-						eve->f |= SELECT;
-						selcount++;
-						deselcount--;
-						if (!deselcount) {/*have we selected all posible faces?, if so return*/
-							BKE_mesh_end_editmesh(me, em);
-							return OPERATOR_FINISHED;
-						}
-					}
-				}
-			} 
-			else if(mode == SIMVERT_VGROUP) {
-				MDeformVert *dvert, *base_dvert;
-				short i, j; /* weight index */
-
-				base_dvert= CustomData_em_get(&em->vdata, base_eve->data,
-					CD_MDEFORMVERT);
-
-				if (!base_dvert || base_dvert->totweight == 0) {
-					BKE_mesh_end_editmesh(me, em);
-					return OPERATOR_FINISHED;
-				}
-				
-				for(eve= em->verts.first; eve; eve= eve->next) {
-					dvert= CustomData_em_get(&em->vdata, eve->data,
-						CD_MDEFORMVERT);
-
-					if (dvert && !(eve->f & SELECT) && !eve->h && dvert->totweight) {
-						/* do the extra check for selection in the following if, so were not
-						checking verts that may be already selected */
-						for (i=0; base_dvert->totweight >i && !(eve->f & SELECT); i++) { 
-							for (j=0; dvert->totweight >j; j++) {
-								if (base_dvert->dw[i].def_nr==dvert->dw[j].def_nr) {
-									eve->f |= SELECT;
-									selcount++;
-									deselcount--;
-									if (!deselcount) { /*have we selected all posible faces?, if so return*/
-										BKE_mesh_end_editmesh(me, em);
-										return OPERATOR_FINISHED;
-									}
-									break;
-								}
-							}
-						}
-					}
-				}
-			}
-		}
-	} /* end basevert loop */
-
-	if(selcount) {
-		WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
-	}
-
-	BKE_mesh_end_editmesh(me, em);
-	return OPERATOR_FINISHED;
-}
-
-static int select_similar_exec(bContext *C, wmOperator *op)
-{
-	int type= RNA_enum_get(op->ptr, "type");
-
-	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);
-}
-
-static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EnumPropertyItem *item= NULL;
-	int a, totitem= 0;
-
-	if (C == NULL) {
-		return prop_similar_types;
-	}
-		
-	if(obedit && obedit->type == OB_MESH) {
-		EditMesh *em= BKE_mesh_get_editmesh(obedit->data); 
-
-		if(em->selectmode & SCE_SELECT_VERTEX) {
-			for(a=SIMVERT_NORMAL; a<=SIMVERT_TOT; a++)
-				RNA_enum_items_add_value(&item, &totitem, prop_similar_types, a);
-		}
-		else if(em->selectmode & SCE_SELECT_EDGE) {
-			for(a=SIMEDGE_LENGTH; a<=SIMEDGE_TOT; a++)
-				RNA_enum_items_add_value(&item, &totitem, prop_similar_types, a);
-		}
-		else if(em->selectmode & SCE_SELECT_FACE) {
-			for(a=SIMFACE_MATERIAL; a<=SIMFACE_TOT; a++)
-				RNA_enum_items_add_value(&item, &totitem, prop_similar_types, a);
-		}
-	}
-
-	RNA_enum_item_end(&item, &totitem);
-	*free= 1;
-
-	return item;
-}
-
-void MESH_OT_select_similar(wmOperatorType *ot)
-{
-	PropertyRNA *prop;
-
-	/* identifiers */
-	ot->name= "Select Similar";
-	ot->description= "Select similar vertices, edges or faces by property types";
-	ot->idname= "MESH_OT_select_similar";
-	
-	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= select_similar_exec;
-	ot->poll= ED_operator_editmesh;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-	
-	/* properties */
-	prop= RNA_def_enum(ot->srna, "type", prop_similar_types, SIMVERT_NORMAL, "Type", "");
-	RNA_def_enum_funcs(prop, select_similar_type_itemf);
-	ot->prop= prop;
-	RNA_def_float(ot->srna, "threshold", 0.01f, 0.0f, FLT_MAX, "Threshold", "", 0.0f, 100.f);
-}
-
-/* ******************************************* */
-
-
-int mesh_layers_menu_charlen(CustomData *data, int type)
-{
-	int i, len = 0;
-	/* see if there is a duplicate */
-	for(i=0; i<data->totlayer; i++) {
-		if((&data->layers[i])->type == type) {
-			/* we could count the chars here but we'll just assumeme each
-			 * is 32 chars with some room for the menu text - 40 should be fine */
-			len+=40; 
-		}
-	}
-	return len;
-}
-
-/* this function adds menu text into an existing string.
- * this string's size should be allocated with mesh_layers_menu_charlen */
-void mesh_layers_menu_concat(CustomData *data, int type, char *str) 
-{
-	int i, count = 0;
-	char *str_pt = str;
-	CustomDataLayer *layer;
-	
-	/* see if there is a duplicate */
-	for(i=0; i<data->totlayer; i++) {
-		layer = &data->layers[i];
-		if(layer->type == type) {
-			str_pt += sprintf(str_pt, "%s%%x%d|", layer->name, count);
-			count++;
-		}
-	}
-}
-
-int mesh_layers_menu(CustomData *data, int type)
-{
-	int ret;
-	char *str_pt, *str;
-	
-	str_pt = str = MEM_mallocN(mesh_layers_menu_charlen(data, type) + 18, "layer menu");
-	str[0] = '\0';
-	
-	str_pt += sprintf(str_pt, "Layers%%t|");
-	
-	mesh_layers_menu_concat(data, type, str_pt);
-	
-	ret = pupmenu(str);
-	MEM_freeN(str);
-	return ret;
-}
-
-static void EM_mesh_copy_edge(EditMesh *em, short type) 
-{
-	EditSelection *ese;
-	short change=0;
-	
-	EditEdge *eed, *eed_act;
-	float vec[3], vec_mid[3], eed_len, eed_len_act;
-	
-	if (!em) return;
-	
-	ese = em->selected.last;
-	if (!ese) return;
-	
-	eed_act = (EditEdge*)ese->data;
-	
-	switch (type) {
-	case 1: /* copy crease */
-		for(eed=em->edges.first; eed; eed=eed->next) {
-			if (eed->f & SELECT && eed != eed_act && eed->crease != eed_act->crease) {
-				eed->crease = eed_act->crease;
-				change = 1;
-			}
-		}
-		break;
-	case 2: /* copy bevel weight */
-		for(eed=em->edges.first; eed; eed=eed->next) {
-			if (eed->f & SELECT && eed != eed_act && eed->bweight != eed_act->bweight) {
-				eed->bweight = eed_act->bweight;
-				change = 1;
-			}
-		}
-		break;
-
-	case 3: /* copy length */
-		eed_len_act = len_v3v3(eed_act->v1->co, eed_act->v2->co);
-		for(eed=em->edges.first; eed; eed=eed->next) {
-			if (eed->f & SELECT && eed != eed_act) {
-
-				eed_len = len_v3v3(eed->v1->co, eed->v2->co);
-
-				if (eed_len == eed_len_act) continue;
-				/* if this edge is zero length we cont do anything with it*/
-				if (eed_len == 0.0f) continue;
-				if (eed_len_act == 0.0f) {
-					add_v3_v3v3(vec_mid, eed->v1->co, eed->v2->co);
-					mul_v3_fl(vec_mid, 0.5);
-					VECCOPY(eed->v1->co, vec_mid);
-					VECCOPY(eed->v2->co, vec_mid);
-				} else {
-					/* copy the edge length */
-					add_v3_v3v3(vec_mid, eed->v1->co, eed->v2->co);
-					mul_v3_fl(vec_mid, 0.5);
-
-					/* SCALE 1 */
-					sub_v3_v3v3(vec, eed->v1->co, vec_mid);
-					mul_v3_fl(vec, eed_len_act/eed_len);
-					add_v3_v3v3(eed->v1->co, vec, vec_mid);
-
-					/* SCALE 2 */
-					sub_v3_v3v3(vec, eed->v2->co, vec_mid);
-					mul_v3_fl(vec, eed_len_act/eed_len);
-					add_v3_v3v3(eed->v2->co, vec, vec_mid);
-				}
-				change = 1;
-			}
-		}
-
-		if (change)
-			recalc_editnormals(em);
-
-		break;
-	}
-	
-	if (change) {
-//		DAG_id_tag_update(obedit->data, 0);
-		
-	}
-}
-
-static void EM_mesh_copy_face(EditMesh *em, wmOperator *op, short type)
-{
-	short change=0;
-	
-	EditFace *efa, *efa_act;
-	MTFace *tf, *tf_act = NULL;
-	MCol *mcol, *mcol_act = NULL;
-	if (!em) return;
-	efa_act = EM_get_actFace(em, 0);
-	
-	if (!efa_act) return;
-	
-	tf_act =	CustomData_em_get(&em->fdata, efa_act->data, CD_MTFACE);
-	mcol_act =	CustomData_em_get(&em->fdata, efa_act->data, CD_MCOL);
-	
-	switch (type) {
-	case 1: /* copy material */
-		for(efa=em->faces.first; efa; efa=efa->next) {
-			if (efa->f & SELECT && efa->mat_nr != efa_act->mat_nr) {
-				efa->mat_nr = efa_act->mat_nr;
-				change = 1;
-			}
-		}
-		break;
-	case 2:	/* copy image */
-		if (!tf_act) {
-			BKE_report(op->reports, RPT_WARNING, "Mesh has no uv/image layers");
-			return;
-		}
-		for(efa=em->faces.first; efa; efa=efa->next) {
-			if (efa->f & SELECT && efa != efa_act) {
-				tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-				if (tf_act->tpage) {
-					tf->tpage = tf_act->tpage;
-				} else {
-					tf->tpage = NULL;
-				}
-				tf->tile= tf_act->tile;
-				change = 1;
-			}
-		}
-		break;
-
-	case 3: /* copy UV's */
-		if (!tf_act) {
-			BKE_report(op->reports, RPT_WARNING, "Mesh has no uv/image layers");
-			return;
-		}
-		for(efa=em->faces.first; efa; efa=efa->next) {
-			if (efa->f & SELECT && efa != efa_act) {
-				tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-				memcpy(tf->uv, tf_act->uv, sizeof(tf->uv));
-				change = 1;
-			}
-		}
-		break;
-	case 4: /* mode's */
-		if (!tf_act) {
-			BKE_report(op->reports, RPT_WARNING, "Mesh has no uv/image layers");
-			return;
-		}
-		for(efa=em->faces.first; efa; efa=efa->next) {
-			if (efa->f & SELECT && efa != efa_act) {
-				tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-				tf->mode= tf_act->mode;
-				change = 1;
-			}
-		}
-		break;
-	case 5: /* copy transp's */
-		if (!tf_act) {
-			BKE_report(op->reports, RPT_WARNING, "Mesh has no uv/image layers");
-			return;
-		}
-		for(efa=em->faces.first; efa; efa=efa->next) {
-			if (efa->f & SELECT && efa != efa_act) {
-				tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-				tf->transp= tf_act->transp;
-				change = 1;
-			}
-		}
-		break;
-
-	case 6: /* copy vcols's */
-		if (!mcol_act) {
-			BKE_report(op->reports, RPT_WARNING, "Mesh has no color layers");
-			return;
-		} else {
-			/* guess the 4th color if needs be */
-			float val =- 1;
-
-			if (!efa_act->v4) {
-				/* guess the othe vale, we may need to use it
-				 * 
-				 * Modifying the 4th value of the mcol is ok here since its not seen
-				 * on a triangle
-				 * */
-				val = ((float)(mcol_act->r +  (mcol_act+1)->r + (mcol_act+2)->r)) / 3; CLAMP(val, 0, 255);
-				(mcol_act+3)->r = (char)val;
-
-				val = ((float)(mcol_act->g +  (mcol_act+1)->g + (mcol_act+2)->g)) / 3; CLAMP(val, 0, 255);
-				(mcol_act+3)->g = (char)val;
-
-				val = ((float)(mcol_act->b +  (mcol_act+1)->b + (mcol_act+2)->b)) / 3; CLAMP(val, 0, 255);
-				(mcol_act+3)->b = (char)val;
-			} 
-
-
-			for(efa=em->faces.first; efa; efa=efa->next) {
-				if (efa->f & SELECT && efa != efa_act) {
-					/* TODO - make copy from tri to quad guess the 4th vert */
-					mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
-					memcpy(mcol, mcol_act, sizeof(MCol)*4);	
-					change = 1;
-				}
-			}
-		}
-		break;
-	}
-	
-	if (change) {
-//		DAG_id_tag_update(obedit->data, 0);
-		
-	}
-}
-
-
-void EM_mesh_copy_face_layer(EditMesh *em, wmOperator *op, short type) 
-{
-	short change=0;
-	
-	EditFace *efa;
-	MTFace *tf, *tf_from;
-	MCol *mcol, *mcol_from;
-	
-	if (!em) return;
-	
-	switch(type) {
-	case 7:
-	case 8:
-	case 9:
-		if (CustomData_number_of_layers(&em->fdata, CD_MTFACE)<2) {
-			BKE_report(op->reports, RPT_WARNING, "mesh does not have multiple uv/image layers");
-			return;
-		} else {
-			int layer_orig_idx, layer_idx;
-
-			layer_idx = mesh_layers_menu(&em->fdata, CD_MTFACE);
-			if (layer_idx<0) return;
-
-			/* warning, have not updated mesh pointers however this is not needed since we swicth back */
-			layer_orig_idx = CustomData_get_active_layer(&em->fdata, CD_MTFACE);
-			if (layer_idx==layer_orig_idx)
-				return;
-
-			/* get the tfaces */
-			CustomData_set_layer_active(&em->fdata, CD_MTFACE, (int)layer_idx);
-			/* store the tfaces in our temp */
-			for(efa=em->faces.first; efa; efa=efa->next) {
-				if (efa->f & SELECT) {
-					efa->tmp.p = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-				}	
-			}
-			CustomData_set_layer_active(&em->fdata, CD_MTFACE, layer_orig_idx);
-		}
-		break;
-
-	case 10: /* select vcol layers - make sure this stays in sync with above code */
-		if (CustomData_number_of_layers(&em->fdata, CD_MCOL)<2) {
-			BKE_report(op->reports, RPT_WARNING, "mesh does not have multiple color layers");
-			return;
-		} else {
-			int layer_orig_idx, layer_idx;
-
-			layer_idx = mesh_layers_menu(&em->fdata, CD_MCOL);
-			if (layer_idx<0) return;
-
-			/* warning, have not updated mesh pointers however this is not needed since we swicth back */
-			layer_orig_idx = CustomData_get_active_layer(&em->fdata, CD_MCOL);
-			if (layer_idx==layer_orig_idx)
-				return;
-
-			/* get the tfaces */
-			CustomData_set_layer_active(&em->fdata, CD_MCOL, (int)layer_idx);
-			/* store the tfaces in our temp */
-			for(efa=em->faces.first; efa; efa=efa->next) {
-				if (efa->f & SELECT) {
-					efa->tmp.p = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
-				}	
-			}
-			CustomData_set_layer_active(&em->fdata, CD_MCOL, layer_orig_idx);
-
-		}
-		break;
-	}
-
-	/* layer copy only - sanity checks done above */
-	switch (type) {
-	case 7: /* copy UV's only */
-		for(efa=em->faces.first; efa; efa=efa->next) {
-			if (efa->f & SELECT) {
-				tf_from = (MTFace *)efa->tmp.p; /* not active but easier to use this way */
-				tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-				memcpy(tf->uv, tf_from->uv, sizeof(tf->uv));
-				change = 1;
-			}
-		}
-		break;
-	case 8: /* copy image settings only */
-		for(efa=em->faces.first; efa; efa=efa->next) {
-			if (efa->f & SELECT) {
-				tf_from = (MTFace *)efa->tmp.p; /* not active but easier to use this way */
-				tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-				if (tf_from->tpage) {
-					tf->tpage = tf_from->tpage;
-				} else {
-					tf->tpage = NULL;
-				}
-				tf->tile= tf_from->tile;
-				change = 1;
-			}
-		}
-		break;
-	case 9: /* copy all tface info */
-		for(efa=em->faces.first; efa; efa=efa->next) {
-			if (efa->f & SELECT) {
-				tf_from = (MTFace *)efa->tmp.p; /* not active but easier to use this way */
-				tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-				memcpy(tf->uv, ((MTFace *)efa->tmp.p)->uv, sizeof(tf->uv));
-				tf->tpage = tf_from->tpage;
-				tf->mode = tf_from->mode;
-				tf->transp = tf_from->transp;
-				change = 1;
-			}
-		}
-		break;
-	case 10:
-		for(efa=em->faces.first; efa; efa=efa->next) {
-			if (efa->f & SELECT) {
-				mcol_from = (MCol *)efa->tmp.p; 
-				mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
-				memcpy(mcol, mcol_from, sizeof(MCol)*4);	
-				change = 1;
-			}
-		}
-		break;
-	}
-
-	if (change) {
-//		DAG_id_tag_update(obedit->data, 0);
-		
-	}
-}
-
-
-/* ctrl+c in mesh editmode */
-static void UNUSED_FUNCTION(mesh_copy_menu)(EditMesh *em, wmOperator *op)
-{
-	EditSelection *ese;
-	int ret;
-	if (!em) return;
-	
-	ese = em->selected.last;
-	
-	/* Faces can have a NULL ese, so dont return on a NULL ese here */
-	
-	if(ese && ese->type == EDITVERT) {
-		/* EditVert *ev, *ev_act = (EditVert*)ese->data;
-		ret= pupmenu(""); */
-	} else if(ese && ese->type == EDITEDGE) {
-		ret= pupmenu("Copy Active Edge to Selected%t|Crease%x1|Bevel Weight%x2|Length%x3");
-		if (ret<1) return;
-		
-		EM_mesh_copy_edge(em, ret);
-		
-	} else if(ese==NULL || ese->type == EDITFACE) {
-		ret= pupmenu(
-			"Copy Face Selected%t|"
-			"Active Material%x1|Active Image%x2|Active UV Coords%x3|"
-			"Active Mode%x4|Active Transp%x5|Active Vertex Colors%x6|%l|"
-
-			"TexFace UVs from layer%x7|"
-			"TexFace Images from layer%x8|"
-			"TexFace All from layer%x9|"
-			"Vertex Colors from layer%x10");
-		if (ret<1) return;
-		
-		if (ret<=6) {
-			EM_mesh_copy_face(em, op, ret);
-		} else {
-			EM_mesh_copy_face_layer(em, op, ret);
-		}
-	}
-}
-
-/* ****************  LOOP SELECTS *************** */
-
-/* selects quads in loop direction of indicated edge */
-/* only flush over edges with valence <= 2 */
-void faceloop_select(EditMesh *em, EditEdge *startedge, int select)
-{
-	EditEdge *eed;
-	EditFace *efa;
-	int looking= 1;
-	
-	/* in eed->f1 we put the valence (amount of faces in edge) */
-	/* in eed->f2 we put tagged flag as correct loop */
-	/* in efa->f1 we put tagged flag as correct to select */
-
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		eed->f1= 0;
-		eed->f2= 0;
-	}
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		efa->f1= 0;
-		if(efa->h==0) {
-			efa->e1->f1++;
-			efa->e2->f1++;
-			efa->e3->f1++;
-			if(efa->e4) efa->e4->f1++;
-		}
-	}
-	
-	/* tag startedge OK*/
-	startedge->f2= 1;
-	
-	while(looking) {
-		looking= 0;
-		
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->h==0 && efa->e4 && efa->f1==0) {	/* not done quad */
-				if(efa->e1->f1<=2 && efa->e2->f1<=2 && efa->e3->f1<=2 && efa->e4->f1<=2) { /* valence ok */
-
-					/* if edge tagged, select opposing edge and mark face ok */
-					if(efa->e1->f2) {
-						efa->e3->f2= 1;
-						efa->f1= 1;
-						looking= 1;
-					}
-					else if(efa->e2->f2) {
-						efa->e4->f2= 1;
-						efa->f1= 1;
-						looking= 1;
-					}
-					if(efa->e3->f2) {
-						efa->e1->f2= 1;
-						efa->f1= 1;
-						looking= 1;
-					}
-					if(efa->e4->f2) {
-						efa->e2->f2= 1;
-						efa->f1= 1;
-						looking= 1;
-					}
-				}
-			}
-		}
-	}
-	
-	/* (de)select the faces */
-	if(select!=2) {
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->f1) EM_select_face(efa, select);
-		}
-	}
-}
-
-
-/* helper for edgeloop_select, checks for eed->f2 tag in faces */
-static int edge_not_in_tagged_face(EditMesh *em, EditEdge *eed)
-{
-	EditFace *efa;
-	
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		if(efa->h==0) {
-			if(efa->e1==eed || efa->e2==eed || efa->e3==eed || efa->e4==eed) {	/* edge is in face */
-				if(efa->e1->f2 || efa->e2->f2 || efa->e3->f2 || (efa->e4 && efa->e4->f2)) {	/* face is tagged */
-					return 0;
-				}
-			}
-		}
-	}
-	return 1;
-}
-
-static void ensure_ed_vert_sel(EditMesh *em)
-{
-	EditEdge *eed;
-
-	/* EM_selectmode_flush() doesnt take into account that deselected edges
-	 * may be still connected to selected edges [#26885] */
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		if(eed->f & SELECT) {
-			eed->v1->f |= SELECT;
-			eed->v2->f |= SELECT;
-		}
-	}
-}
-
-/* selects or deselects edges that:
-- if edges has 2 faces:
-	- has vertices with valence of 4
-	- not shares face with previous edge
-- if edge has 1 face:
-	- has vertices with valence 4
-	- not shares face with previous edge
-	- but also only 1 face
-- if edge no face:
-	- has vertices with valence 2
-*/
-static void edgeloop_select(EditMesh *em, EditEdge *starteed, int select)
-{
-	EditVert *eve;
-	EditEdge *eed;
-	EditFace *efa;
-	int looking= 1;
-	
-	/* in f1 we put the valence (amount of edges in a vertex, or faces in edge) */
-	/* in eed->f2 and efa->f1 we put tagged flag as correct loop */
-	for(eve= em->verts.first; eve; eve= eve->next) {
-		eve->f1= 0;
-		eve->f2= 0;
-	}
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		eed->f1= 0;
-		eed->f2= 0;
-		if((eed->h & 1)==0) {	/* fgon edges add to valence too */
-			eed->v1->f1++; eed->v2->f1++;
-		}
-	}
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		efa->f1= 0;
-		if(efa->h==0) {
-			efa->e1->f1++;
-			efa->e2->f1++;
-			efa->e3->f1++;
-			if(efa->e4) efa->e4->f1++;
-		}
-	}
-	
-	/* looped edges & vertices get tagged f2 */
-	starteed->f2= 1;
-	if(starteed->v1->f1<5) starteed->v1->f2= 1;
-	if(starteed->v2->f1<5) starteed->v2->f2= 1;
-	/* sorry, first edge isnt even ok */
-	if(starteed->v1->f2==0 && starteed->v2->f2==0) looking= 0;
-	
-	while(looking) {
-		looking= 0;
-		
-		/* find correct valence edges which are not tagged yet, but connect to tagged one */
-		for(eed= em->edges.first; eed; eed= eed->next) {
-			if(eed->h==0 && eed->f2==0) { /* edge not hidden, not tagged */
-				if( (eed->v1->f1<5 && eed->v1->f2) || (eed->v2->f1<5 && eed->v2->f2)) { /* valence of vertex OK, and is tagged */
-					/* new edge is not allowed to be in face with tagged edge */
-					if(edge_not_in_tagged_face(em, eed)) {
-						if(eed->f1==starteed->f1) {	/* same amount of faces */
-							looking= 1;
-							eed->f2= 1;
-							if(eed->v2->f1<5) eed->v2->f2= 1;
-							if(eed->v1->f1<5) eed->v1->f2= 1;
-						}
-					}
-				}
-			}
-		}
-	}
-	/* and we do the select */
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		if(eed->f2) EM_select_edge(eed, select);
-	}
-
-	if(select == FALSE && !(em->selectmode & SCE_SELECT_VERTEX)) { /* only when not in vert sel [#26931] */
-		ensure_ed_vert_sel(em);
-	}
-}
-
-/* 
-   Almostly exactly the same code as faceloop select
-*/
-static void edgering_select(EditMesh *em, EditEdge *startedge, int select)
-{
-	EditEdge *eed;
-	EditFace *efa;
-	int looking= 1;
-	
-	/* in eed->f1 we put the valence (amount of faces in edge) */
-	/* in eed->f2 we put tagged flag as correct loop */
-	/* in efa->f1 we put tagged flag as correct to select */
-
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		eed->f1= 0;
-		eed->f2= 0;
-	}
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		efa->f1= 0;
-		if(efa->h==0) {
-			efa->e1->f1++;
-			efa->e2->f1++;
-			efa->e3->f1++;
-			if(efa->e4) efa->e4->f1++;
-		}
-	}
-	
-	/* tag startedge OK */
-	startedge->f2= 1;
-	
-	while(looking) {
-		looking= 0;
-		
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->e4 && efa->f1==0 && !efa->h) {	/* not done quad */
-				if(efa->e1->f1<=2 && efa->e2->f1<=2 && efa->e3->f1<=2 && efa->e4->f1<=2) { /* valence ok */
-
-					/* if edge tagged, select opposing edge and mark face ok */
-					if(efa->e1->f2) {
-						efa->e3->f2= 1;
-						efa->f1= 1;
-						looking= 1;
-					}
-					else if(efa->e2->f2) {
-						efa->e4->f2= 1;
-						efa->f1= 1;
-						looking= 1;
-					}
-					if(efa->e3->f2) {
-						efa->e1->f2= 1;
-						efa->f1= 1;
-						looking= 1;
-					}
-					if(efa->e4->f2) {
-						efa->e2->f2= 1;
-						efa->f1= 1;
-						looking= 1;
-					}
-				}
-			}
-		}
-	}
-	
-	/* (de)select the edges */
-	for(eed= em->edges.first; eed; eed= eed->next) {
-			if(eed->f2) EM_select_edge(eed, select);
-	}
-
-	if(select == FALSE && !(em->selectmode & SCE_SELECT_VERTEX)) { /* only when not in vert sel [#26931] */
-		ensure_ed_vert_sel(em);
-	}
-}
-
-static int loop_multiselect(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
-	EditEdge *eed;
-	EditEdge **edarray;
-	int edindex, edfirstcount;
-	int looptype= RNA_boolean_get(op->ptr, "ring");
-	
-	/* sets em->totedgesel */
-	EM_nedges_selected(em);
-	
-	edarray = MEM_mallocN(sizeof(EditEdge*)*em->totedgesel,"edge array");
-	edindex = 0;
-	edfirstcount = em->totedgesel;
-	
-	for(eed=em->edges.first; eed; eed=eed->next){
-		if(eed->f&SELECT){
-			edarray[edindex] = eed;
-			edindex += 1;
-		}
-	}
-	
-	if(looptype){
-		for(edindex = 0; edindex < edfirstcount; edindex +=1){
-			eed = edarray[edindex];
-			edgering_select(em, eed,SELECT);
-		}
-		EM_selectmode_flush(em);
-	}
-	else{
-		for(edindex = 0; edindex < edfirstcount; edindex +=1){
-			eed = edarray[edindex];
-			edgeloop_select(em, eed,SELECT);
-		}
-		EM_selectmode_flush(em);
-	}
-	MEM_freeN(edarray);
-//	if (EM_texFaceCheck())
-	
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
-
-	BKE_mesh_end_editmesh(obedit->data, em);
-	return OPERATOR_FINISHED;	
-}
-
-void MESH_OT_loop_multi_select(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Multi Select Loops";
-	ot->description= "Select a loop of connected edges by connection type";
-	ot->idname= "MESH_OT_loop_multi_select";
-	
-	/* api callbacks */
-	ot->exec= loop_multiselect;
-	ot->poll= ED_operator_editmesh;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-	
-	/* properties */
-	RNA_def_boolean(ot->srna, "ring", 0, "Ring", "");
-}
-
-		
-/* ***************** MAIN MOUSE SELECTION ************** */
-
-
-/* ***************** loop select (non modal) ************** */
-
-static void mouse_mesh_loop(bContext *C, const int mval[2], short extend, short ring)
-{
-	ViewContext vc;
-	EditMesh *em;
-	EditEdge *eed;
-	int select= 1;
-	int dist= 50;
-	
-	em_setup_viewcontext(C, &vc);
-	vc.mval[0]= mval[0];
-	vc.mval[1]= mval[1];
-	em= vc.em;
-
-	/* no afterqueue (yet), so we check it now, otherwise the em_xxxofs indices are bad */
-	view3d_validate_backbuf(&vc);
-	
-	eed= findnearestedge(&vc, &dist);
-	if(eed) {
-		if(extend==0) EM_clear_flag_all(em, SELECT);
-	
-		if((eed->f & SELECT)==0) select=1;
-		else if(extend) select=0;
-
-		if(em->selectmode & SCE_SELECT_FACE) {
-			faceloop_select(em, eed, select);
-		}
-		else if(em->selectmode & SCE_SELECT_EDGE) {
-			if(ring)
-				edgering_select(em, eed, select);
-			else
-				edgeloop_select(em, eed, select);
-		}
-		else if(em->selectmode & SCE_SELECT_VERTEX) {
-			if(ring)
-				edgering_select(em, eed, select);
-			else 
-				edgeloop_select(em, eed, select);
-		}
-
-		EM_selectmode_flush(em);
-//			if (EM_texFaceCheck())
-		
-		/* sets as active, useful for other tools */
-		if(select) {
-			if(em->selectmode & SCE_SELECT_VERTEX)
-				EM_store_selection(em, eed->v1, EDITVERT);
-			if(em->selectmode & SCE_SELECT_EDGE)
-				EM_store_selection(em, eed, EDITEDGE);
-		}
-
-		WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc.obedit->data);
-	}
-}
-
-static int mesh_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, "ring"));
-	
-	/* cannot do tweaks for as long this keymap is after transform map */
-	return OPERATOR_FINISHED;
-}
-
-void MESH_OT_loop_select(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Loop Select";
-	ot->description= "Select a loop of connected edges";
-	ot->idname= "MESH_OT_loop_select";
-	
-	/* api callbacks */
-	ot->invoke= mesh_select_loop_invoke;
-	ot->poll= ED_operator_editmesh_region_view3d;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-	
-	/* properties */
-	RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", "");
-	RNA_def_boolean(ot->srna, "ring", 0, "Select Ring", "");
-}
-
-/* ******************* mesh shortest path select, uses prev-selected edge ****************** */
-
-/* since you want to create paths with multiple selects, it doesn't have extend option */
-static void mouse_mesh_shortest_path(bContext *C, const int mval[2])
-{
-	ViewContext vc;
-	EditMesh *em;
-	EditEdge *eed, *eed_act= NULL;
-	int dist= 50;
-	
-	em_setup_viewcontext(C, &vc);
-	vc.mval[0]= mval[0];
-	vc.mval[1]= mval[1];
-	em= vc.em;
-	
-	/* no afterqueue (yet), so we check it now, otherwise the em_xxxofs indices are bad */
-	view3d_validate_backbuf(&vc);
-	
-	eed= findnearestedge(&vc, &dist);
-	if(eed) {
-		Mesh *me= vc.obedit->data;
-		int path = 0;
-		
-		if (em->selected.last) {
-			EditSelection *ese = em->selected.last;
-			
-			if(ese && ese->type == EDITEDGE) {
-				eed_act = (EditEdge*)ese->data;
-				if (eed_act != eed) {
-					if (edgetag_shortest_path(vc.scene, em, eed_act, eed)) { /* <- this is where the magic happens */
-						EM_remove_selection(em, eed_act, EDITEDGE);
-						path = 1;
-					}
-				}
-			}
-		}
-		if (path==0) {
-			int act = (edgetag_context_check(vc.scene, eed)==0);
-			edgetag_context_set(vc.scene, eed, act); /* switch the edge option */
-		}
-
-		/* even if this is selected it may not be in the selection list */
-		if(edgetag_context_check(vc.scene, eed)==0) {
-			EM_remove_selection(em, eed, EDITEDGE);
-		}
-		else {
-			/* other modes need to keep the last edge tagged */
-			if(eed_act) {
-				if(vc.scene->toolsettings->edge_mode!=EDGE_MODE_SELECT) {
-					/* for non-select modes, always de-select the previous active edge */
-					EM_select_edge(eed_act, 0);
-				}
-			}
-
-			/* set the new edge active */
-			EM_select_edge(eed, 1);
-			EM_store_selection(em, eed, EDITEDGE);
-		}
-
-		EM_selectmode_flush(em);
-	
-		/* force drawmode for mesh */
-		switch (vc.scene->toolsettings->edge_mode) {
-			
-			case EDGE_MODE_TAG_SEAM:
-				me->drawflag |= ME_DRAWSEAMS;
-				break;
-			case EDGE_MODE_TAG_SHARP:
-				me->drawflag |= ME_DRAWSHARP;
-				break;
-			case EDGE_MODE_TAG_CREASE:	
-				me->drawflag |= ME_DRAWCREASES;
-				break;
-			case EDGE_MODE_TAG_BEVEL:
-				me->drawflag |= ME_DRAWBWEIGHTS;
-				break;
-		}
-
-		/* live unwrap while tagging */
-		if(	(vc.scene->toolsettings->edge_mode_live_unwrap) &&
-			(vc.scene->toolsettings->edge_mode == EDGE_MODE_TAG_SEAM) &&
-			(CustomData_has_layer(&em->fdata, CD_MTFACE))
-		) {
-			ED_unwrap_lscm(vc.scene, vc.obedit, FALSE); /* unwrap all not just sel */
-		}
-
-		DAG_id_tag_update(vc.obedit->data, 0);
-		WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc.obedit->data);
-	}
-}
-
-
-static int mesh_shortest_path_select_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
-{
-	
-	view3d_operator_needs_opengl(C);
-
-	mouse_mesh_shortest_path(C, event->mval);
-	
-	return OPERATOR_FINISHED;
-}
-
-static int mesh_shortest_path_select_poll(bContext *C)
-{
-	if(ED_operator_editmesh_region_view3d(C)) {
-		Object *obedit= CTX_data_edit_object(C);
-		EditMesh *em= BKE_mesh_get_editmesh(obedit->data);
-		return (em->selectmode & SCE_SELECT_EDGE);
-	}
-	return 0;
-}
-	
-void MESH_OT_select_shortest_path(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Shortest Path Select";
-	ot->description= "Select shortest path between two selections";
-	ot->idname= "MESH_OT_select_shortest_path";
-	
-	/* api callbacks */
-	ot->invoke= mesh_shortest_path_select_invoke;
-	ot->poll= mesh_shortest_path_select_poll;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-	
-	/* properties */
-	RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", "");
-}
-
-
-/* ************************************************** */
-
-
-/* here actual select happens */
-/* gets called via generic mouse select operator */
-int mouse_mesh(bContext *C, const int mval[2], short extend)
-{
-	ViewContext vc;
-	EditVert *eve;
-	EditEdge *eed;
-	EditFace *efa;
-	
-	/* setup view context for argument to callbacks */
-	em_setup_viewcontext(C, &vc);
-	vc.mval[0]= mval[0];
-	vc.mval[1]= mval[1];
-	
-	if(unified_findnearest(&vc, &eve, &eed, &efa)) {
-		
-		if(extend==0) EM_clear_flag_all(vc.em, SELECT);
-		
-		if(efa) {
-			/* set the last selected face */
-			EM_set_actFace(vc.em, efa);
-			
-			if( (efa->f & SELECT)==0 ) {
-				EM_store_selection(vc.em, efa, EDITFACE);
-				EM_select_face_fgon(vc.em, efa, 1);
-			}
-			else if(extend) {
-				EM_remove_selection(vc.em, efa, EDITFACE);
-				EM_select_face_fgon(vc.em, efa, 0);
-			}
-		}
-		else if(eed) {
-			if((eed->f & SELECT)==0) {
-				EM_store_selection(vc.em, eed, EDITEDGE);
-				EM_select_edge(eed, 1);
-			}
-			else if(extend) {
-				EM_remove_selection(vc.em, eed, EDITEDGE);
-				EM_select_edge(eed, 0);
-			}
-		}
-		else if(eve) {
-			if((eve->f & SELECT)==0) {
-				eve->f |= SELECT;
-				EM_store_selection(vc.em, eve, EDITVERT);
-			}
-			else if(extend){ 
-				EM_remove_selection(vc.em, eve, EDITVERT);
-				eve->f &= ~SELECT;
-			}
-		}
-		
-		EM_selectmode_flush(vc.em);
-		  
-//		if (EM_texFaceCheck()) {
-
-		if (efa && efa->mat_nr != vc.obedit->actcol-1) {
-			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_GEOM|ND_SELECT, vc.obedit->data);
-
-		return 1;
-	}
-	
-	return 0;
-}
-
-/* *********** select linked ************* */
-
-/* for use with selectconnected_delimit_mesh only! */
-#define is_edge_delimit_ok(eed) ((eed->tmp.l == 1) && (eed->seam==0))
-#define is_face_tag(efa) is_edge_delimit_ok(efa->e1) || is_edge_delimit_ok(efa->e2) || is_edge_delimit_ok(efa->e3) || (efa->v4 && is_edge_delimit_ok(efa->e4))
-
-#define face_tag(efa)\
-if(efa->v4)	efa->tmp.l=		efa->e1->tmp.l= efa->e2->tmp.l= efa->e3->tmp.l= efa->e4->tmp.l= 1;\
-else		efa->tmp.l=		efa->e1->tmp.l= efa->e2->tmp.l= efa->e3->tmp.l= 1;
-
-/* all - 1) use all faces for extending the selection  2) only use the mouse face
-* sel - 1) select  0) deselect 
-* */
-
-/* legacy warning, this function combines too much :) */
-static int select_linked_limited_invoke(ViewContext *vc, short all, short sel)
-{
-	EditMesh *em= vc->em;
-	EditFace *efa;
-	EditEdge *eed;
-	EditVert *eve;
-	short done=1, change=0;
-	
-	if(em->faces.first==0) return OPERATOR_CANCELLED;
-	
-	/* flag all edges+faces as off*/
-	for(eed= em->edges.first; eed; eed= eed->next)
-		eed->tmp.l=0;
-	
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		efa->tmp.l = 0;
-	}
-	
-	if (all) {
-		// XXX verts?
-		for(eed= em->edges.first; eed; eed= eed->next) {
-			if(eed->f & SELECT)
-				eed->tmp.l= 1;
-		}
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			
-			if (efa->f & SELECT) {
-				face_tag(efa);
-			} else {
-				efa->tmp.l = 0;
-			}
-		}
-	} 
-	else {
-		if( unified_findnearest(vc, &eve, &eed, &efa) ) {
-			
-			if(efa) {
-				efa->tmp.l = 1;
-				face_tag(efa);
-			}
-			else if(eed)
-				eed->tmp.l= 1;
-			else {
-				for(eed= em->edges.first; eed; eed= eed->next)
-					if(eed->v1==eve || eed->v2==eve)
-						break;
-				eed->tmp.l= 1;
-			}
-		}
-		else
-			return OPERATOR_FINISHED;
-	}
-	
-	while(done==1) {
-		done= 0;
-		/* simple algo - select all faces that have a selected edge
-		* this intern selects the edge, repeat until nothing is left to do */
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if ((efa->tmp.l == 0) && (!efa->h)) {
-				if (is_face_tag(efa)) {
-					face_tag(efa);
-					done= 1;
-				}
-			}
-		}
-	}
-	
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		if (efa->tmp.l) {
-			if (sel) {
-				if (!(efa->f & SELECT)) {
-					EM_select_face(efa, 1);
-					change = 1;
-				}
-			} else {
-				if (efa->f & SELECT) {
-					EM_select_face(efa, 0);
-					change = 1;
-				}
-			}
-		}
-	}
-	
-	if (!change)
-		return OPERATOR_CANCELLED;
-	
-	if (!sel) /* make sure de-selecting faces didnt de-select the verts/edges connected to selected faces, this is common with boundaries */
-		for(efa= em->faces.first; efa; efa= efa->next)
-			if (efa->f & SELECT)
-				EM_select_face(efa, 1);
-	
-	//	if (EM_texFaceCheck())
-	
-	return OPERATOR_FINISHED;
-}
-
-#undef is_edge_delimit_ok
-#undef is_face_tag
-#undef face_tag
-
-static void linked_limit_default(bContext *C, wmOperator *op)
-{
-	if(!RNA_struct_property_is_set(op->ptr, "limit")) {
-		Object *obedit= CTX_data_edit_object(C);
-		EditMesh *em= BKE_mesh_get_editmesh(obedit->data);
-		if(em->selectmode == SCE_SELECT_FACE)
-			RNA_boolean_set(op->ptr, "limit", TRUE);
-		else
-			RNA_boolean_set(op->ptr, "limit", FALSE);
-	}
-}
-
-static int select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	ViewContext vc;
-	EditVert *eve, *v1, *v2;
-	EditEdge *eed;
-	EditFace *efa;
-	short done=1, toggle=0;
-	int sel= !RNA_boolean_get(op->ptr, "deselect");
-	int limit;
-	
-	linked_limit_default(C, op);
-
-	limit = RNA_boolean_get(op->ptr, "limit");
-
-	/* unified_finednearest needs ogl */
-	view3d_operator_needs_opengl(C);
-	
-	/* setup view context for argument to callbacks */
-	em_setup_viewcontext(C, &vc);
-	
-	if(vc.em->edges.first==0) return OPERATOR_CANCELLED;
-	
-	vc.mval[0]= event->mval[0];
-	vc.mval[1]= event->mval[1];
-	
-	/* return warning! */
-	if(limit) {
-		int retval= select_linked_limited_invoke(&vc, 0, sel);
-		WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
-		return retval;
-	}
-	
-	if( unified_findnearest(&vc, &eve, &eed, &efa)==0 ) {
-		WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
-	
-		return OPERATOR_CANCELLED;
-	}
-
-	/* clear test flags */
-	for(v1= vc.em->verts.first; v1; v1= v1->next) v1->f1= 0;
-	
-	/* start vertex/face/edge */
-	if(eve) eve->f1= 1;
-	else if(eed) eed->v1->f1= eed->v2->f1= 1;
-	else efa->v1->f1= efa->v2->f1= efa->v3->f1= 1;
-	
-	/* set flag f1 if affected */
-	while(done==1) {
-		done= 0;
-		toggle++;
-		
-		if(toggle & 1) eed= vc.em->edges.first;
-		else eed= vc.em->edges.last;
-		
-		while(eed) {
-			v1= eed->v1;
-			v2= eed->v2;
-			
-			if(eed->h==0) {
-				if(v1->f1 && v2->f1==0) {
-					v2->f1= 1;
-					done= 1;
-				}
-				else if(v1->f1==0 && v2->f1) {
-					v1->f1= 1;
-					done= 1;
-				}
-			}
-			
-			if(toggle & 1) eed= eed->next;
-			else eed= eed->prev;
-		}
-	}
-	
-	/* now use vertex f1 flag to select/deselect */
-	for(eed= vc.em->edges.first; eed; eed= eed->next) {
-		if(eed->v1->f1 && eed->v2->f1) 
-			EM_select_edge(eed, sel);
-	}
-	for(efa= vc.em->faces.first; efa; efa= efa->next) {
-		if(efa->v1->f1 && efa->v2->f1 && efa->v3->f1 && (efa->v4==NULL || efa->v4->f1)) 
-			EM_select_face(efa, sel);
-	}
-	/* no flush needed, connected geometry is done */
-	
-//	if (EM_texFaceCheck())
-	
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
-	return OPERATOR_FINISHED;	
-}
-
-void MESH_OT_select_linked_pick(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Select Linked";
-	ot->description= "(un)select all vertices linked to the active mesh";
-	ot->idname= "MESH_OT_select_linked_pick";
-	
-	/* api callbacks */
-	ot->invoke= select_linked_pick_invoke;
-	ot->poll= ED_operator_editmesh_region_view3d;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-	
-	RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "");
-	RNA_def_boolean(ot->srna, "limit", 0, "Limit by Seams", "Limit selection by seam boundaries (faces only)");
-}
-
-
-/* ************************* */
-
-void selectconnected_mesh_all(EditMesh *em)
-{
-	EditVert *v1,*v2;
-	EditEdge *eed;
-	short done=1, toggle=0;
-	
-	if(em->edges.first==0) return;
-	
-	while(done==1) {
-		done= 0;
-		
-		toggle++;
-		if(toggle & 1) eed= em->edges.first;
-		else eed= em->edges.last;
-		
-		while(eed) {
-			v1= eed->v1;
-			v2= eed->v2;
-			if(eed->h==0) {
-				if(v1->f & SELECT) {
-					if( (v2->f & SELECT)==0 ) {
-						v2->f |= SELECT;
-						done= 1;
-					}
-				}
-				else if(v2->f & SELECT) {
-					if( (v1->f & SELECT)==0 ) {
-						v1->f |= SELECT;
-						done= 1;
-					}
-				}
-			}
-			if(toggle & 1) eed= eed->next;
-			else eed= eed->prev;
-		}
-	}
-	
-	/* now use vertex select flag to select rest */
-	EM_select_flush(em);
-	
-	//	if (EM_texFaceCheck())
-}
-
-static int select_linked_exec(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(obedit->data);
-	
-	if( RNA_boolean_get(op->ptr, "limit") ) {
-		ViewContext vc;
-		em_setup_viewcontext(C, &vc);
-		select_linked_limited_invoke(&vc, 1, 1);
-	}
-	else
-		selectconnected_mesh_all(em);
-	
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
-
-	BKE_mesh_end_editmesh(obedit->data, em);
-	return OPERATOR_FINISHED;	
-}
-
-static int select_linked_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
-{
-	linked_limit_default(C, op);
-	return select_linked_exec(C, op);
-}
-
-void MESH_OT_select_linked(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Select Linked All";
-	ot->description= "Select all vertices linked to the active mesh";
-	ot->idname= "MESH_OT_select_linked";
-	
-	/* api callbacks */
-	ot->exec= select_linked_exec;
-	ot->invoke= select_linked_invoke;
-	ot->poll= ED_operator_editmesh;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-	
-	RNA_def_boolean(ot->srna, "limit", 0, "Limit by Seams", "Limit selection by seam boundaries (faces only)");
-}
-
-
-/* ************************* */
-
-/* swap is 0 or 1, if 1 it hides not selected */
-void EM_hide_mesh(EditMesh *em, int swap)
-{
-	EditVert *eve;
-	EditEdge *eed;
-	EditFace *efa;
-	int a;
-	
-	if(em==NULL) return;
-
-	/* hide happens on least dominant select mode, and flushes up, not down! (helps preventing errors in subsurf) */
-	/*  - vertex hidden, always means edge is hidden too
-		- edge hidden, always means face is hidden too
-		- face hidden, only set face hide
-		- then only flush back down what's absolute hidden
-	*/
-	if(em->selectmode & SCE_SELECT_VERTEX) {
-		for(eve= em->verts.first; eve; eve= eve->next) {
-			if((eve->f & SELECT)!=swap) {
-				eve->f &= ~SELECT;
-				eve->h= 1;
-			}
-		}
-	
-		for(eed= em->edges.first; eed; eed= eed->next) {
-			if(eed->v1->h || eed->v2->h) {
-				eed->h |= 1;
-				eed->f &= ~SELECT;
-			}
-		}
-	
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->e1->h & 1 || efa->e2->h & 1 || efa->e3->h & 1 || (efa->e4 && efa->e4->h & 1)) {
-				efa->h= 1;
-				efa->f &= ~SELECT;
-			}
-		}
-	}
-	else if(em->selectmode & SCE_SELECT_EDGE) {
-
-		for(eed= em->edges.first; eed; eed= eed->next) {
-			if((eed->f & SELECT)!=swap) {
-				eed->h |= 1;
-				EM_select_edge(eed, 0);
-			}
-		}
-
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->e1->h & 1 || efa->e2->h & 1 || efa->e3->h & 1 || (efa->e4 && efa->e4->h & 1)) {
-				efa->h= 1;
-				efa->f &= ~SELECT;
-			}
-		}
-	}
-	else {
-
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if((efa->f & SELECT)!=swap) {
-				efa->h= 1;
-				EM_select_face(efa, 0);
-			}
-		}
-	}
-	
-	/* flush down, only whats 100% hidden */
-	for(eve= em->verts.first; eve; eve= eve->next) eve->f1= 0;
-	for(eed= em->edges.first; eed; eed= eed->next) eed->f1= 0;
-	
-	if(em->selectmode & SCE_SELECT_FACE) {
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->h) a= 1; else a= 2;
-			efa->e1->f1 |= a;
-			efa->e2->f1 |= a;
-			efa->e3->f1 |= a;
-			if(efa->e4) efa->e4->f1 |= a;
-			/* When edges are not delt with in their own loop, we need to explicitly re-selct select edges that are joined to unselected faces */
-			if (swap && (em->selectmode == SCE_SELECT_FACE) && (efa->f & SELECT)) {
-				EM_select_face(efa, 1);
-			}
-		}
-	}
-	
-	if(em->selectmode >= SCE_SELECT_EDGE) {
-		for(eed= em->edges.first; eed; eed= eed->next) {
-			if(eed->f1==1) eed->h |= 1;
-			if(eed->h & 1) a= 1; else a= 2;
-			eed->v1->f1 |= a;
-			eed->v2->f1 |= a;
-		}
-	}
-
-	if(em->selectmode >= SCE_SELECT_VERTEX) {
-		for(eve= em->verts.first; eve; eve= eve->next) {
-			if(eve->f1==1) eve->h= 1;
-		}
-	}
-	
-	em->totedgesel= em->totfacesel= em->totvertsel= 0;
-//	if(EM_texFaceCheck())
-
-	//	DAG_id_tag_update(obedit->data, 0);
-}
-
-static int hide_mesh_exec(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
-	
-	EM_hide_mesh(em, RNA_boolean_get(op->ptr, "unselected"));
-		
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
-
-	BKE_mesh_end_editmesh(obedit->data, em);
-	return OPERATOR_FINISHED;	
-}
-
-void MESH_OT_hide(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Hide Selection";
-	ot->description= "Hide (un)selected vertices, edges or faces";
-	ot->idname= "MESH_OT_hide";
-	
-	/* api callbacks */
-	ot->exec= hide_mesh_exec;
-	ot->poll= ED_operator_editmesh;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-	
-	/* props */
-	RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected");
-}
-
-void EM_reveal_mesh(EditMesh *em)
-{
-	EditVert *eve;
-	EditEdge *eed;
-	EditFace *efa;
-	
-	if(em==NULL) return;
-
-	for(eve= em->verts.first; eve; eve= eve->next) {
-		if(eve->h) {
-			eve->h= 0;
-			eve->f |= SELECT;
-		}
-	}
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		if(eed->h & 1) {
-			eed->h &= ~1;
-			if(em->selectmode & SCE_SELECT_VERTEX); 
-			else EM_select_edge(eed, 1);
-		}
-	}
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		if(efa->h) {
-			efa->h= 0;
-			if(em->selectmode & (SCE_SELECT_EDGE|SCE_SELECT_VERTEX)); 
-			else EM_select_face(efa, 1);
-		}
-	}
-
-	EM_fgon_flags(em);	/* redo flags and indices for fgons */
-	EM_selectmode_flush(em);
-
-//	if (EM_texFaceCheck())
-//	DAG_id_tag_update(obedit->data, 0);
-}
-
-static int reveal_mesh_exec(bContext *C, wmOperator *UNUSED(op))
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
-	
-	EM_reveal_mesh(em);
-
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
-
-	BKE_mesh_end_editmesh(obedit->data, em);
-	return OPERATOR_FINISHED;	
-}
-
-void MESH_OT_reveal(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Reveal Hidden";
-	ot->description= "Reveal all hidden vertices, edges and faces";
-	ot->idname= "MESH_OT_reveal";
-	
-	/* api callbacks */
-	ot->exec= reveal_mesh_exec;
-	ot->poll= ED_operator_editmesh;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
-
-static int select_by_number_vertices_exec(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
-	EditFace *efa;
-	int numverts= RNA_enum_get(op->ptr, "type");
-
-	/* Selects trias/qiads or isolated verts, and edges that do not have 2 neighboring
-	 * faces
-	 */
-
-	/* for loose vertices/edges, we first select all, loop below will deselect */
-	if(numverts==5) {
-		EM_set_flag_all(em, SELECT);
-	}
-	else if(em->selectmode!=SCE_SELECT_FACE) {
-		BKE_report(op->reports, RPT_WARNING, "Only works in face selection mode");
-		return OPERATOR_CANCELLED;
-	}
-	
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		if (efa->e4) {
-			EM_select_face(efa, (numverts==4) );
-		}
-		else {
-			EM_select_face(efa, (numverts==3) );
-		}
-	}
-	
-	EM_selectmode_flush(em);
-
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
-	
-	return OPERATOR_FINISHED;
-}
-
-void MESH_OT_select_by_number_vertices(wmOperatorType *ot)
-{
-	static const EnumPropertyItem type_items[]= {
-		{3, "TRIANGLES", 0, "Triangles", NULL},
-		{4, "QUADS", 0, "Quads", NULL},
-		{5, "OTHER", 0, "Other", NULL},
-		{0, NULL, 0, NULL, NULL}};
-
-	/* 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";
-	
-	/* api callbacks */
-	ot->exec= select_by_number_vertices_exec;
-	ot->invoke= WM_menu_invoke;
-	ot->poll= ED_operator_editmesh;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-	
-	/* props */
-	ot->prop= RNA_def_enum(ot->srna, "type", type_items, 3, "Type", "Type of elements to select");
-}
-
-
-static int select_mirror_exec(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
-
-	int extend= RNA_boolean_get(op->ptr, "extend");
-
-	EM_select_mirrored(obedit, em, extend);
-	EM_selectmode_flush(em);
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
-
-	return OPERATOR_FINISHED;
-}
-
-void MESH_OT_select_mirror(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Select Mirror";
-	ot->description= "Select mesh items at mirrored locations";
-	ot->idname= "MESH_OT_select_mirror";
-
-	/* api callbacks */
-	ot->exec= select_mirror_exec;
-	ot->poll= ED_operator_editmesh;
-
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
-	/* props */
-	RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the existing selection");
-}
-
-static int select_sharp_edges_exec(bContext *C, wmOperator *op)
-{
-	/* Find edges that have exactly two neighboring faces,
-	* check the angle between those faces, and if angle is
-	* small enough, select the edge
-	*/
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
-	EditEdge *eed;
-	EditFace *efa;
-	EditFace **efa1;
-	EditFace **efa2;
-	intptr_t edgecount = 0, i = 0;
-	float sharpness, fsharpness;
-	
-	/* 'standard' behaviour - check if selected, then apply relevant selection */
-	
-	if(em->selectmode==SCE_SELECT_FACE) {
-		BKE_report(op->reports, RPT_WARNING, "Doesn't work in face selection mode");
-		BKE_mesh_end_editmesh(obedit->data, em);
-		return OPERATOR_CANCELLED;
-	}
-
-	sharpness= RNA_float_get(op->ptr, "sharpness");
-	fsharpness = ((180.0f - sharpness) * (float)M_PI) / 180.0f;
-
-	/* count edges, use tmp.l  */
-	eed= em->edges.first;
-	while(eed) {
-		edgecount++;
-		eed->tmp.l = i;
-		eed= eed->next;
-		++i;
-	}
-
-	/* for each edge, we want a pointer to two adjacent faces */
-	efa1 = MEM_callocN(edgecount*sizeof(EditFace *), 
-					   "pairs of edit face pointers");
-	efa2 = MEM_callocN(edgecount*sizeof(EditFace *), 
-					   "pairs of edit face pointers");
-
-#define face_table_edge(eed) { \
-		i = eed->tmp.l; \
-		if (i != -1) { \
-			if (efa1[i]) { \
-				if (efa2[i]) { \
-					/* invalidate, edge has more than two neighbors */ \
-					eed->tmp.l = -1; \
-				} \
-				else { \
-					efa2[i] = efa; \
-				} \
-			} \
-			else { \
-				efa1[i] = efa; \
-			} \
-		} \
-	}
-
-	/* find the adjacent faces of each edge, we want only two */
-	efa= em->faces.first;
-	while(efa) {
-		face_table_edge(efa->e1);
-		face_table_edge(efa->e2);
-		face_table_edge(efa->e3);
-		if (efa->e4) {
-			face_table_edge(efa->e4);
-		}
-		efa= efa->next;
-	}
-
-#undef face_table_edge
-
-	eed = em->edges.first;
-	while(eed) {
-		i = eed->tmp.l;
-		if (i != -1) { 
-			/* edge has two or less neighboring faces */
-			if ( (efa1[i]) && (efa2[i]) ) { 
-				/* edge has exactly two neighboring faces, check angle */
-				float angle;
-				angle = saacos(efa1[i]->n[0]*efa2[i]->n[0] +
-							   efa1[i]->n[1]*efa2[i]->n[1] +
-							   efa1[i]->n[2]*efa2[i]->n[2]);
-				if (fabsf(angle) >= fsharpness)
-					EM_select_edge(eed, 1);
-			}
-		}
-
-		eed= eed->next;
-	}
-
-	MEM_freeN(efa1);
-	MEM_freeN(efa2);
-
-//	if (EM_texFaceCheck())
-	
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); //TODO is this needed ?
-
-	BKE_mesh_end_editmesh(obedit->data, em);
-	return OPERATOR_FINISHED;	
-}
-
-void MESH_OT_edges_select_sharp(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Select Sharp Edges";
-	ot->description= "Marked selected edges as sharp";
-	ot->idname= "MESH_OT_edges_select_sharp";
-	
-	/* api callbacks */
-	ot->exec= select_sharp_edges_exec;
-	ot->poll= ED_operator_editmesh;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-	
-	/* props */
-	RNA_def_float(ot->srna, "sharpness", 0.01f, 0.0f, FLT_MAX, "sharpness", "", 0.0f, 180.0f);
-}
-
-
-static void select_linked_flat_faces(EditMesh *em, wmOperator *op, float sharpness)
-{
-	/* Find faces that are linked to selected faces that are 
-	 * relatively flat (angle between faces is higher than
-	 * specified angle)
-	 */
-	EditEdge *eed;
-	EditFace *efa;
-	EditFace **efa1;
-	EditFace **efa2;
-	intptr_t edgecount = 0, i, faceselcount=0, faceselcountold=0;
-	float fsharpness;
-	
-	if(em->selectmode!=SCE_SELECT_FACE) {
-		BKE_report(op->reports, RPT_WARNING, "Only works in face selection mode");
-		return;
-	}
-
-	fsharpness = ((180.0f - sharpness) * (float)M_PI) / 180.0f;
-
-	i=0;
-	/* count edges, use tmp.l */
-	eed= em->edges.first;
-	while(eed) {
-		edgecount++;
-		eed->tmp.l = i;
-		eed= eed->next;
-		++i;
-	}
-
-	/* for each edge, we want a pointer to two adjacent faces */
-	efa1 = MEM_callocN(edgecount*sizeof(EditFace *), 
-					   "pairs of edit face pointers");
-	efa2 = MEM_callocN(edgecount*sizeof(EditFace *), 
-					   "pairs of edit face pointers");
-
-#define face_table_edge(eed) { \
-		i = eed->tmp.l; \
-		if (i != -1) { \
-			if (efa1[i]) { \
-				if (efa2[i]) { \
-					/* invalidate, edge has more than two neighbors */ \
-					eed->tmp.l = -1; \
-				} \
-				else { \
-					efa2[i] = efa; \
-				} \
-			} \
-			else { \
-				efa1[i] = efa; \
-			} \
-		} \
-	}
-
-	/* find the adjacent faces of each edge, we want only two */
-	efa= em->faces.first;
-	while(efa) {
-		face_table_edge(efa->e1);
-		face_table_edge(efa->e2);
-		face_table_edge(efa->e3);
-		if (efa->e4) {
-			face_table_edge(efa->e4);
-		}
-
-		/* while were at it, count the selected faces */
-		if (efa->f & SELECT) ++faceselcount;
-
-		efa= efa->next;
-	}
-
-#undef face_table_edge
-
-	eed= em->edges.first;
-	while(eed) {
-		i = eed->tmp.l;
-		if (i != -1) { 
-			/* edge has two or less neighboring faces */
-			if ( (efa1[i]) && (efa2[i]) ) { 
-				/* edge has exactly two neighboring faces, check angle */
-				float angle;
-				angle = saacos(efa1[i]->n[0]*efa2[i]->n[0] +
-							   efa1[i]->n[1]*efa2[i]->n[1] +
-							   efa1[i]->n[2]*efa2[i]->n[2]);
-				/* invalidate: edge too sharp */
-				if (fabsf(angle) >= fsharpness)
-					eed->tmp.l = -1;
-			}
-			else {
-				/* invalidate: less than two neighbors */
-				eed->tmp.l = -1;
-			}
-		}
-
-		eed= eed->next;
-	}
-
-#define select_flat_neighbor(eed) { \
-				i = eed->tmp.l; \
-				if (i!=-1) { \
-					if (! (efa1[i]->f & SELECT) ) { \
-						EM_select_face(efa1[i], 1); \
-						++faceselcount; \
-					} \
-					if (! (efa2[i]->f & SELECT) ) { \
-						EM_select_face(efa2[i], 1); \
-						++faceselcount; \
-					} \
-				} \
-	}
-
-	while (faceselcount != faceselcountold) {
-		faceselcountold = faceselcount;
-
-		efa= em->faces.first;
-		while(efa) {
-			if (efa->f & SELECT) {
-				select_flat_neighbor(efa->e1);
-				select_flat_neighbor(efa->e2);
-				select_flat_neighbor(efa->e3);
-				if (efa->e4) {
-					select_flat_neighbor(efa->e4);
-				}
-			}
-			efa= efa->next;
-		}
-	}
-
-#undef select_flat_neighbor
-
-	MEM_freeN(efa1);
-	MEM_freeN(efa2);
-
-//	if (EM_texFaceCheck())
-
-}
-
-static int select_linked_flat_faces_exec(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
-	
-	select_linked_flat_faces(em, op, RNA_float_get(op->ptr, "sharpness"));
-	
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
-
-	BKE_mesh_end_editmesh(obedit->data, em);
-	return OPERATOR_FINISHED;	
-}
-
-void MESH_OT_faces_select_linked_flat(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Select Linked Flat Faces";
-	ot->description= "Select linked faces by angle";
-	ot->idname= "MESH_OT_faces_select_linked_flat";
-	
-	/* api callbacks */
-	ot->exec= select_linked_flat_faces_exec;
-	ot->poll= ED_operator_editmesh;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-	
-	/* props */
-	RNA_def_float(ot->srna, "sharpness", 135.0f, 0.0f, FLT_MAX, "sharpness", "", 0.0f, 180.0f);
-}
-
-static void select_non_manifold(EditMesh *em, wmOperator *op )
-{
-	EditVert *eve;
-	EditEdge *eed;
-	EditFace *efa;
-
-	/* Selects isolated verts, and edges that do not have 2 neighboring
-	 * faces
-	 */
-	
-	if(em->selectmode==SCE_SELECT_FACE) {
-		BKE_report(op->reports, RPT_WARNING, "Doesn't work in face selection mode");
-		return;
-	}
-
-	eve= em->verts.first;
-	while(eve) {
-		/* this will count how many edges are connected
-		 * to this vert */
-		eve->f1= 0;
-		eve= eve->next;
-	}
-
-	eed= em->edges.first;
-	while(eed) {
-		/* this will count how many faces are connected to
-		 * this edge */
-		eed->f1= 0;
-		/* increase edge count for verts */
-		++eed->v1->f1;
-		++eed->v2->f1;
-		eed= eed->next;
-	}
-
-	efa= em->faces.first;
-	while(efa) {
-		/* increase face count for edges */
-		++efa->e1->f1;
-		++efa->e2->f1;
-		++efa->e3->f1;
-		if (efa->e4)
-			++efa->e4->f1;			
-		efa= efa->next;
-	}
-
-	/* select verts that are attached to an edge that does not
-	 * have 2 neighboring faces */
-	eed= em->edges.first;
-	while(eed) {
-		if (eed->h==0 && eed->f1 != 2) {
-			EM_select_edge(eed, 1);
-		}
-		eed= eed->next;
-	}
-
-	/* select isolated verts */
-	if(em->selectmode & SCE_SELECT_VERTEX) {
-		eve= em->verts.first;
-		while(eve) {
-			if (eve->f1 == 0) {
-				if (!eve->h) eve->f |= SELECT;
-			}
-			eve= eve->next;
-		}
-	}
-
-//	if (EM_texFaceCheck())
-
-}
-
-static int select_non_manifold_exec(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
-	
-	select_non_manifold(em, op);
-	
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
-
-	BKE_mesh_end_editmesh(obedit->data, em);
-	return OPERATOR_FINISHED;	
-}
-
-void MESH_OT_select_non_manifold(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Select Non Manifold";
-	ot->description= "Select all non-manifold vertices or edges";
-	ot->idname= "MESH_OT_select_non_manifold";
-	
-	/* api callbacks */
-	ot->exec= select_non_manifold_exec;
-	ot->poll= ED_operator_editmesh;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
-
-void EM_select_swap(EditMesh *em) /* exported for UV */
-{
-	EditVert *eve;
-	EditEdge *eed;
-	EditFace *efa;
-	
-	if(em->selectmode & SCE_SELECT_VERTEX) {
-
-		for(eve= em->verts.first; eve; eve= eve->next) {
-			if(eve->h==0) {
-				if(eve->f & SELECT) eve->f &= ~SELECT;
-				else eve->f|= SELECT;
-			}
-		}
-	}
-	else if(em->selectmode & SCE_SELECT_EDGE) {
-		for(eed= em->edges.first; eed; eed= eed->next) {
-			if(eed->h==0) {
-				EM_select_edge(eed, !(eed->f & SELECT));
-			}
-		}
-	}
-	else {
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->h==0) {
-				EM_select_face(efa, !(efa->f & SELECT));
-			}
-		}
-	}
-
-	EM_selectmode_flush(em);
-	
-//	if (EM_texFaceCheck())
-
-}
-	
-/* ******************** (de)select all operator **************** */
-
-void EM_toggle_select_all(EditMesh *em) /* exported for UV */
-{
-	if(EM_nvertices_selected(em))
-		EM_clear_flag_all(em, SELECT);
-	else 
-		EM_set_flag_all_selectmode(em, SELECT);
-}
-
-void EM_select_all(EditMesh *em)
-{
-	EM_set_flag_all_selectmode(em, SELECT);
-}
-
-void EM_deselect_all(EditMesh *em)
-{
-	EM_clear_flag_all(em, SELECT);
-}
-
-static int editmesh_select_all_exec(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
-	int action = RNA_enum_get(op->ptr, "action");
-	
-	switch (action) {
-	case SEL_TOGGLE:
-		EM_toggle_select_all(em);
-		break;
-	case SEL_SELECT:
-		EM_select_all(em);
-		break;
-	case SEL_DESELECT:
-		EM_deselect_all(em);
-		break;
-	case SEL_INVERT:
-		EM_select_swap(em);
-		break;
-	}
-	
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);	
-	BKE_mesh_end_editmesh(obedit->data, em);
-
-	return OPERATOR_FINISHED;
-}
-
-void MESH_OT_select_all(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Select or Deselect All";
-	ot->description= "Change selection of all vertices, edges or faces";
-	ot->idname= "MESH_OT_select_all";
-	
-	/* api callbacks */
-	ot->exec= editmesh_select_all_exec;
-	ot->poll= ED_operator_editmesh;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
-	WM_operator_properties_select_all(ot);
-}
-
-/* ******************** **************** */
-
-void EM_select_more(EditMesh *em)
-{
-	EditVert *eve;
-	EditEdge *eed;
-	EditFace *efa;
-	
-	for(eve= em->verts.first; eve; eve= eve->next) {
-		if(eve->f & SELECT) eve->f1= 1;
-		else eve->f1 = 0;
-	}
-	
-	/* set f1 flags in vertices to select 'more' */
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		if(eed->h==0) {
-			if (eed->v1->f & SELECT)
-				eed->v2->f1 = 1;
-			if (eed->v2->f & SELECT)
-				eed->v1->f1 = 1;
-		}
-	}
-
-	/* new selected edges, but not in facemode */
-	if(em->selectmode <= SCE_SELECT_EDGE) {
-		
-		for(eed= em->edges.first; eed; eed= eed->next) {
-			if(eed->h==0) {
-				if(eed->v1->f1 && eed->v2->f1) EM_select_edge(eed, 1);
-			}
-		}
-	}
-	/* new selected faces */
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		if(efa->h==0) {
-			if(efa->v1->f1 && efa->v2->f1 && efa->v3->f1 && (efa->v4==NULL || efa->v4->f1)) 
-				EM_select_face(efa, 1);
-		}
-	}
-}
-
-static int select_more(bContext *C, wmOperator *UNUSED(op))
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)) ;
-
-	EM_select_more(em);
-
-//	if (EM_texFaceCheck(em))
-
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
-
-	BKE_mesh_end_editmesh(obedit->data, em);
-	return OPERATOR_FINISHED;
-}
-
-void MESH_OT_select_more(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Select More";
-	ot->description= "Select more vertices, edges or faces connected to initial selection";
-	ot->idname= "MESH_OT_select_more";
-
-	/* api callbacks */
-	ot->exec= select_more;
-	ot->poll= ED_operator_editmesh;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
-
-static void EM_select_less(EditMesh *em)
-{
-	EditEdge *eed;
-	EditFace *efa;
-
-	if(em->selectmode <= SCE_SELECT_EDGE) {
-		/* eed->f1 == 1:  edge with a selected and deselected vert */ 
-
-		for(eed= em->edges.first; eed; eed= eed->next) {
-			eed->f1= 0;
-			if(eed->h==0) {
-				
-				if ( !(eed->v1->f & SELECT) && (eed->v2->f & SELECT) ) 
-					eed->f1= 1;
-				if ( (eed->v1->f & SELECT) && !(eed->v2->f & SELECT) ) 
-					eed->f1= 1;
-			}
-		}
-		
-		/* deselect edges with flag set */
-		for(eed= em->edges.first; eed; eed= eed->next) {
-			if (eed->h==0 && eed->f1 == 1) {
-				EM_select_edge(eed, 0);
-			}
-		}
-		EM_deselect_flush(em);
-		
-	}
-	else {
-		/* deselect faces with 1 or more deselect edges */
-		/* eed->f1 == mixed selection edge */
-		for(eed= em->edges.first; eed; eed= eed->next) eed->f1= 0;
-
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->h==0) {
-				if(efa->f & SELECT) {
-					efa->e1->f1 |= 1;
-					efa->e2->f1 |= 1;
-					efa->e3->f1 |= 1;
-					if(efa->e4) efa->e4->f1 |= 1;
-				}
-				else {
-					efa->e1->f1 |= 2;
-					efa->e2->f1 |= 2;
-					efa->e3->f1 |= 2;
-					if(efa->e4) efa->e4->f1 |= 2;
-				}
-			}
-		}
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->h==0) {
-				if(efa->e1->f1==3 || efa->e2->f1==3 || efa->e3->f1==3 || (efa->e4 && efa->e4->f1==3)) { 
-					EM_select_face(efa, 0);
-				}
-			}
-		}
-		EM_selectmode_flush(em);
-		
-	}
-}
-
-static int select_less(bContext *C, wmOperator *UNUSED(op))
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
-
-	EM_select_less(em);
-
-//	if (EM_texFaceCheck(em))
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
-
-	BKE_mesh_end_editmesh(obedit->data, em);
-	return OPERATOR_FINISHED;
-}
-
-void MESH_OT_select_less(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Select Less";
-	ot->description= "Select less vertices, edges or faces connected to initial selection";
-	ot->idname= "MESH_OT_select_less";
-
-	/* api callbacks */
-	ot->exec= select_less;
-	ot->poll= ED_operator_editmesh;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
-
-static void selectrandom_mesh(EditMesh *em, float randfac) /* randomly selects a user-set % of vertices/edges/faces */
-{
-	EditVert *eve;
-	EditEdge *eed;
-	EditFace *efa;
-
-	BLI_srand( BLI_rand() ); /* random seed */
-	
-	if(em->selectmode & SCE_SELECT_VERTEX) {
-		for(eve= em->verts.first; eve; eve= eve->next) {
-			if(eve->h==0) {
-				if (BLI_frand() < randfac) 
-					eve->f |= SELECT;
-			}
-		}
-		EM_selectmode_flush(em);
-	}
-	else if(em->selectmode & SCE_SELECT_EDGE) {
-		for(eed= em->edges.first; eed; eed= eed->next) {
-			if(eed->h==0) {
-				if (BLI_frand() < randfac) 
-					EM_select_edge(eed, 1);
-			}
-		}
-		EM_selectmode_flush(em);
-	}
-	else {
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->h==0) {
-				if (BLI_frand() < randfac) 
-					EM_select_face(efa, 1);
-			}
-		}
-		
-		EM_selectmode_flush(em);
-	}
-//	if (EM_texFaceCheck())
-}
-
-static int mesh_select_random_exec(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
-	
-	if(!RNA_boolean_get(op->ptr, "extend"))
-		EM_deselect_all(em);
-	
-	selectrandom_mesh(em, RNA_float_get(op->ptr, "percent")/100.0f);
-		
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
-	
-	BKE_mesh_end_editmesh(obedit->data, em);
-	return OPERATOR_FINISHED;	
-}
-
-void MESH_OT_select_random(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Select Random";
-	ot->description= "Randomly select vertices";
-	ot->idname= "MESH_OT_select_random";
-
-	/* api callbacks */
-	ot->exec= mesh_select_random_exec;
-	ot->poll= ED_operator_editmesh;
-
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-	
-	/* props */
-	RNA_def_float_percentage(ot->srna, "percent", 50.f, 0.0f, 100.0f, "Percent", "Percentage of elements to select randomly", 0.f, 100.0f);
-	RNA_def_boolean(ot->srna, "extend", FALSE, "Extend Selection", "Extend selection instead of deselecting everything first");
-}
-
-void EM_select_by_material(EditMesh *em, int index) 
-{
-	EditFace *efa;
-	
-	for (efa=em->faces.first; efa; efa= efa->next) {
-		if (efa->mat_nr==index) {
-			EM_select_face(efa, 1);
-		}
-	}
-
-	EM_selectmode_flush(em);
-}
-
-void EM_deselect_by_material(EditMesh *em, int index) 
-{
-	EditFace *efa;
-	
-	for (efa=em->faces.first; efa; efa= efa->next) {
-		if (efa->mat_nr==index) {
-			EM_select_face(efa, 0);
-		}
-	}
-
-	EM_selectmode_flush(em);
-}
-
-/* ************************* SEAMS AND EDGES **************** */
-
-static int editmesh_mark_seam(bContext *C, wmOperator *op)
-{
-	Scene *scene= CTX_data_scene(C);
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
-	Mesh *me= ((Mesh *)obedit->data);
-	EditEdge *eed;
-	int clear = RNA_boolean_get(op->ptr, "clear");
-	
-	/* auto-enable seams drawing */
-	if(clear==0) {
-		me->drawflag |= ME_DRAWSEAMS;
-	}
-
-	if(clear) {
-		eed= em->edges.first;
-		while(eed) {
-			if((eed->h==0) && (eed->f & SELECT)) {
-				eed->seam = 0;
-			}
-			eed= eed->next;
-		}
-	}
-	else {
-		eed= em->edges.first;
-		while(eed) {
-			if((eed->h==0) && (eed->f & SELECT)) {
-				eed->seam = 1;
-			}
-			eed= eed->next;
-		}
-	}
-
-	/* live unwrap while tagging */
-	if(	(scene->toolsettings->edge_mode_live_unwrap) &&
-		(CustomData_has_layer(&em->fdata, CD_MTFACE))
-	) {
-		ED_unwrap_lscm(scene, obedit, FALSE); /* unwrap all not just sel */
-	}
-
-	BKE_mesh_end_editmesh(obedit->data, em);
-
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-
-	return OPERATOR_FINISHED;
-}
-
-void MESH_OT_mark_seam(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Mark Seam";
-	ot->description= "(un)mark selected edges as a seam";
-	ot->idname= "MESH_OT_mark_seam";
-	
-	/* api callbacks */
-	ot->exec= editmesh_mark_seam;
-	ot->poll= ED_operator_editmesh;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-	
-	RNA_def_boolean(ot->srna, "clear", 0, "Clear", "");
-}
-
-static int editmesh_mark_sharp(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
-	Mesh *me= ((Mesh *)obedit->data);
-	int clear = RNA_boolean_get(op->ptr, "clear");
-	EditEdge *eed;
-
-	/* auto-enable sharp edge drawing */
-	if(clear == 0) {
-		me->drawflag |= ME_DRAWSHARP;
-	}
-
-	if(!clear) {
-		eed= em->edges.first;
-		while(eed) {
-			if(!eed->h && (eed->f & SELECT)) eed->sharp = 1;
-			eed = eed->next;
-		}
-	} else {
-		eed= em->edges.first;
-		while(eed) {
-			if(!eed->h && (eed->f & SELECT)) eed->sharp = 0;
-			eed = eed->next;
-		}
-	}
-
-	BKE_mesh_end_editmesh(obedit->data, em);
-
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-
-	return OPERATOR_FINISHED;
-}
-
-void MESH_OT_mark_sharp(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Mark Sharp";
-	ot->description= "(un)mark selected edges as sharp";
-	ot->idname= "MESH_OT_mark_sharp";
-	
-	/* api callbacks */
-	ot->exec= editmesh_mark_sharp;
-	ot->poll= ED_operator_editmesh;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-	
-	RNA_def_boolean(ot->srna, "clear", 0, "Clear", "");
-}
-
-/* **************** NORMALS ************** */
-
-void EM_recalc_normal_direction(EditMesh *em, int inside, int select)	/* makes faces righthand turning */
-{
-	EditEdge *eed, *ed1, *ed2, *ed3, *ed4;
-	EditFace *efa, *startvl;
-	float maxx, nor[3], cent[3];
-	int totsel, found, foundone, direct, turn, tria_nr;
-
-   /* based at a select-connected to witness loose objects */
-
-	/* count per edge the amount of faces */
-
-	/* find the ultimate left, front, upper face (not manhattan dist!!) */
-	/* also evaluate both triangle cases in quad, since these can be non-flat */
-
-	/* put normal to the outside, and set the first direction flags in edges */
-
-	/* then check the object, and set directions / direction-flags: but only for edges with 1 or 2 faces */
-	/* this is in fact the 'select connected' */
-	
-	/* in case (selected) faces were not done: start over with 'find the ultimate ...' */
-
-	waitcursor(1);
-	
-	eed= em->edges.first;
-	while(eed) {
-		eed->f2= 0;		/* edge direction */
-		eed->f1= 0;		/* counter */
-		eed= eed->next;
-	}
-
-	/* count faces and edges */
-	totsel= 0;
-	efa= em->faces.first;
-	while(efa) {
-		if(select==0 || (efa->f & SELECT) ) {
-			efa->f1= 1;
-			totsel++;
-			efa->e1->f1++;
-			efa->e2->f1++;
-			efa->e3->f1++;
-			if(efa->v4) efa->e4->f1++;
-		}
-		else efa->f1= 0;
-
-		efa= efa->next;
-	}
-
-	while(totsel>0) {
-		/* from the outside to the inside */
-
-		efa= em->faces.first;
-		startvl= NULL;
-		maxx= -1.0e10;
-		tria_nr= 0;
-
-		while(efa) {
-			if(efa->f1) {
-				cent_tri_v3(cent, efa->v1->co, efa->v2->co, efa->v3->co);
-				cent[0]= cent[0]*cent[0] + cent[1]*cent[1] + cent[2]*cent[2];
-				
-				if(cent[0]>maxx) {
-					maxx= cent[0];
-					startvl= efa;
-					tria_nr= 0;
-				}
-				if(efa->v4) {
-					cent_tri_v3(cent, efa->v1->co, efa->v3->co, efa->v4->co);
-					cent[0]= cent[0]*cent[0] + cent[1]*cent[1] + cent[2]*cent[2];
-					
-					if(cent[0]>maxx) {
-						maxx= cent[0];
-						startvl= efa;
-						tria_nr= 1;
-					}
-				}
-			}
-			efa= efa->next;
-		}
-
-		if (startvl==NULL)
-			startvl= em->faces.first;
-		
-		/* set first face correct: calc normal */
-		
-		if(tria_nr==1) {
-			normal_tri_v3( nor,startvl->v1->co, startvl->v3->co, startvl->v4->co);
-			cent_tri_v3(cent, startvl->v1->co, startvl->v3->co, startvl->v4->co);
-		} else {
-			normal_tri_v3( nor,startvl->v1->co, startvl->v2->co, startvl->v3->co);
-			cent_tri_v3(cent, startvl->v1->co, startvl->v2->co, startvl->v3->co);
-		}
-		/* first normal is oriented this way or the other */
-		if(inside) {
-			if(cent[0]*nor[0]+cent[1]*nor[1]+cent[2]*nor[2] > 0.0f) flipface(em, startvl);
-		}
-		else {
-			if(cent[0]*nor[0]+cent[1]*nor[1]+cent[2]*nor[2] < 0.0f) flipface(em, startvl);
-		}
-
-		eed= startvl->e1;
-		if(eed->v1==startvl->v1) eed->f2= 1; 
-		else eed->f2= 2;
-		
-		eed= startvl->e2;
-		if(eed->v1==startvl->v2) eed->f2= 1; 
-		else eed->f2= 2;
-		
-		eed= startvl->e3;
-		if(eed->v1==startvl->v3) eed->f2= 1; 
-		else eed->f2= 2;
-		
-		eed= startvl->e4;
-		if(eed) {
-			if(eed->v1==startvl->v4) eed->f2= 1; 
-			else eed->f2= 2;
-		}
-		
-		startvl->f1= 0;
-		totsel--;
-
-		/* test normals */
-		found= 1;
-		direct= 1;
-		while(found) {
-			found= 0;
-			if(direct) efa= em->faces.first;
-			else efa= em->faces.last;
-			while(efa) {
-				if(efa->f1) {
-					turn= 0;
-					foundone= 0;
-
-					ed1= efa->e1;
-					ed2= efa->e2;
-					ed3= efa->e3;
-					ed4= efa->e4;
-
-					if(ed1->f2) {
-						if(ed1->v1==efa->v1 && ed1->f2==1) turn= 1;
-						if(ed1->v2==efa->v1 && ed1->f2==2) turn= 1;
-						foundone= 1;
-					}
-					else if(ed2->f2) {
-						if(ed2->v1==efa->v2 && ed2->f2==1) turn= 1;
-						if(ed2->v2==efa->v2 && ed2->f2==2) turn= 1;
-						foundone= 1;
-					}
-					else if(ed3->f2) {
-						if(ed3->v1==efa->v3 && ed3->f2==1) turn= 1;
-						if(ed3->v2==efa->v3 && ed3->f2==2) turn= 1;
-						foundone= 1;
-					}
-					else if(ed4 && ed4->f2) {
-						if(ed4->v1==efa->v4 && ed4->f2==1) turn= 1;
-						if(ed4->v2==efa->v4 && ed4->f2==2) turn= 1;
-						foundone= 1;
-					}
-
-					if(foundone) {
-						found= 1;
-						totsel--;
-						efa->f1= 0;
-
-						if(turn) {
-							if(ed1->v1==efa->v1) ed1->f2= 2; 
-							else ed1->f2= 1;
-							if(ed2->v1==efa->v2) ed2->f2= 2; 
-							else ed2->f2= 1;
-							if(ed3->v1==efa->v3) ed3->f2= 2; 
-							else ed3->f2= 1;
-							if(ed4) {
-								if(ed4->v1==efa->v4) ed4->f2= 2; 
-								else ed4->f2= 1;
-							}
-
-							flipface(em, efa);
-
-						}
-						else {
-							if(ed1->v1== efa->v1) ed1->f2= 1; 
-							else ed1->f2= 2;
-							if(ed2->v1==efa->v2) ed2->f2= 1; 
-							else ed2->f2= 2;
-							if(ed3->v1==efa->v3) ed3->f2= 1; 
-							else ed3->f2= 2;
-							if(ed4) {
-								if(ed4->v1==efa->v4) ed4->f2= 1; 
-								else ed4->f2= 2;
-							}
-						}
-					}
-				}
-				if(direct) efa= efa->next;
-				else efa= efa->prev;
-			}
-			direct= 1-direct;
-		}
-	}
-
-	recalc_editnormals(em);
-	
-//	DAG_id_tag_update(obedit->data, 0);
-
-	waitcursor(0);
-}
-
-
-static int normals_make_consistent_exec(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
-	
-	/* 'standard' behaviour - check if selected, then apply relevant selection */
-	
-	// XXX  need other args
-	EM_recalc_normal_direction(em, RNA_boolean_get(op->ptr, "inside"), 1);
-	
-	BKE_mesh_end_editmesh(obedit->data, em);
-
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); //TODO is this needed ?
-
-	return OPERATOR_FINISHED;	
-}
-
-void MESH_OT_normals_make_consistent(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Make Normals Consistent";
-	ot->description= "Flip all selected vertex and face normals in a consistent direction";
-	ot->idname= "MESH_OT_normals_make_consistent";
-	
-	/* api callbacks */
-	ot->exec= normals_make_consistent_exec;
-	ot->poll= ED_operator_editmesh;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-	
-	RNA_def_boolean(ot->srna, "inside", 0, "Inside", "");
-}
-
-/* **************** VERTEX DEFORMS *************** */
-
-static int smooth_vertex(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
-	EditVert *eve, *eve_mir = NULL;
-	EditEdge *eed;
-	float *adror, *adr, fac;
-	float fvec[3];
-	int teller=0;
-	ModifierData *md;
-	int index;
-
-	/* count */
-	eve= em->verts.first;
-	while(eve) {
-		if(eve->f & SELECT) teller++;
-		eve= eve->next;
-	}
-	if(teller==0) {
-		BKE_mesh_end_editmesh(obedit->data, em);
-		return OPERATOR_CANCELLED;
-	}
-	
-	adr=adror= (float *)MEM_callocN(3*sizeof(float *)*teller, "vertsmooth");
-	eve= em->verts.first;
-	while(eve) {
-		if(eve->f & SELECT) {
-			eve->tmp.p = (void*)adr;
-			eve->f1= 0;
-			eve->f2= 0;
-			adr+= 3;
-		}
-		eve= eve->next;
-	}
-
-	/* if there is a mirror modifier with clipping, flag the verts that
-	 * are within tolerance of the plane(s) of reflection 
-	 */
-	for(md=obedit->modifiers.first; md; md=md->next) {
-		if((md->type==eModifierType_Mirror) && (md->mode & eModifierMode_Realtime)) {
-			MirrorModifierData *mmd = (MirrorModifierData*) md;	
-		
-			if(mmd->flag & MOD_MIR_CLIPPING) {
-				for (eve= em->verts.first; eve; eve= eve->next) {
-					if(eve->f & SELECT) {
-
-						if (mmd->flag & MOD_MIR_AXIS_X && fabsf(eve->co[0]) < mmd->tolerance) eve->f2 |= 1;
-						if (mmd->flag & MOD_MIR_AXIS_Y && fabsf(eve->co[1]) < mmd->tolerance) eve->f2 |= 2;
-						if (mmd->flag & MOD_MIR_AXIS_Z && fabsf(eve->co[2]) < mmd->tolerance) eve->f2 |= 4;
-
-					}
-				}
-			}
-		}
-	}
-	
-	eed= em->edges.first;
-	while(eed) {
-		if( (eed->v1->f & SELECT) || (eed->v2->f & SELECT) ) {
-			mid_v3_v3v3(fvec, eed->v1->co, eed->v2->co);
-			
-			if((eed->v1->f & SELECT) && eed->v1->f1<255) {
-				eed->v1->f1++;
-				add_v3_v3(eed->v1->tmp.p, fvec);
-			}
-			if((eed->v2->f & SELECT) && eed->v2->f1<255) {
-				eed->v2->f1++;
-				add_v3_v3(eed->v2->tmp.p, fvec);
-			}
-		}
-		eed= eed->next;
-	}
-
-	index= 0;
-	eve= em->verts.first;
-	while(eve) {
-		if(eve->f & SELECT) {
-			if(eve->f1) {
-				
-				int xaxis= RNA_boolean_get(op->ptr, "xaxis");
-				int yaxis= RNA_boolean_get(op->ptr, "yaxis");
-				int zaxis= RNA_boolean_get(op->ptr, "zaxis");
-				
-				if (((Mesh *)obedit->data)->editflag & ME_EDIT_MIRROR_X) {
-					eve_mir= editmesh_get_x_mirror_vert(obedit, em, eve, eve->co, index);
-				}
-				
-				adr = eve->tmp.p;
-				fac= 0.5f/(float)eve->f1;
-				
-				if(xaxis)
-					eve->co[0]= 0.5f*eve->co[0]+fac*adr[0];
-				if(yaxis)
-					eve->co[1]= 0.5f*eve->co[1]+fac*adr[1];
-				if(zaxis)
-					eve->co[2]= 0.5f*eve->co[2]+fac*adr[2];
-				
-				
-				/* clip if needed by mirror modifier */
-				if (eve->f2) {
-					if (eve->f2 & 1) {
-						eve->co[0]= 0.0f;
-					}
-					if (eve->f2 & 2) {
-						eve->co[1]= 0.0f;
-					}
-					if (eve->f2 & 4) {
-						eve->co[2]= 0.0f;
-					}
-				}
-				
-				if (eve_mir) {
-					eve_mir->co[0]=-eve->co[0];
-					eve_mir->co[1]= eve->co[1];
-					eve_mir->co[2]= eve->co[2];
-				}
-				
-			}
-			eve->tmp.p= NULL;
-		}
-		index++;
-		eve= eve->next;
-	}
-	MEM_freeN(adror);
-
-	recalc_editnormals(em);
-
-	BKE_mesh_end_editmesh(obedit->data, em);
-
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-
-	return OPERATOR_FINISHED;
-}
-
-static int smooth_vertex_exec(bContext *C, wmOperator *op)
-{
-	int repeat = RNA_int_get(op->ptr, "repeat");
-	int i;
-
-	if (!repeat) repeat = 1;
-
-	for (i=0; i<repeat; i++) {
-		smooth_vertex(C, op);
-	}
-
-	return OPERATOR_FINISHED;
-}
-
-void MESH_OT_vertices_smooth(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Smooth Vertex";
-	ot->description= "Flatten angles of selected vertices";
-	ot->idname= "MESH_OT_vertices_smooth";
-	
-	/* api callbacks */
-	ot->exec= smooth_vertex_exec;
-	ot->poll= ED_operator_editmesh;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
-	RNA_def_int(ot->srna, "repeat", 1, 1, 100, "Smooth Iterations", "", 1, INT_MAX);
-	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 mesh_noise_exec(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
-	Material *ma;
-	Tex *tex;
-	EditVert *eve;
-	float fac= RNA_float_get(op->ptr, "factor");
-
-	if(em==NULL) return OPERATOR_FINISHED;
-
-	ma= give_current_material(obedit, obedit->actcol);
-	if(ma==0 || ma->mtex[0]==0 || ma->mtex[0]->tex==0) {
-		BKE_report(op->reports, RPT_WARNING, "Mesh has no material or texture assigned");
-		return OPERATOR_FINISHED;
-	}
-	tex= give_current_material_texture(ma);
-
-
-	if(tex->type==TEX_STUCCI) {
-		float b2, vec[3];
-		float ofs= tex->turbul/200.0f;
-		for(eve= em->verts.first; eve; eve= eve->next) {
-			if(eve->f & SELECT) {
-				b2= BLI_hnoise(tex->noisesize, eve->co[0], eve->co[1], eve->co[2]);
-				if(tex->stype) ofs*=(b2*b2);
-				vec[0]= fac*(b2-BLI_hnoise(tex->noisesize, eve->co[0]+ofs, eve->co[1], eve->co[2]));
-				vec[1]= fac*(b2-BLI_hnoise(tex->noisesize, eve->co[0], eve->co[1]+ofs, eve->co[2]));
-				vec[2]= fac*(b2-BLI_hnoise(tex->noisesize, eve->co[0], eve->co[1], eve->co[2]+ofs));
-				
-				add_v3_v3(eve->co, vec);
-			}
-		}
-	}
-	else {
-		for(eve= em->verts.first; eve; eve= eve->next) {
-			if(eve->f & SELECT) {
-				float tin, dum;
-				externtex(ma->mtex[0], eve->co, &tin, &dum, &dum, &dum, &dum, 0);
-				eve->co[2]+= fac*tin;
-			}
-		}
-	}
-
-	recalc_editnormals(em);
-
-	BKE_mesh_end_editmesh(obedit->data, em);
-
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-
-	return OPERATOR_FINISHED;
-}
-
-void MESH_OT_noise(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Noise";
-	ot->description= "Use vertex coordinate as texture coordinate";
-	ot->idname= "MESH_OT_noise";
-
-	/* api callbacks */
-	ot->exec= mesh_noise_exec;
-	ot->poll= ED_operator_editmesh;
-
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
-	RNA_def_float(ot->srna, "factor", 0.1f, -FLT_MAX, FLT_MAX, "Factor", "", 0.0f, 1.0f);
-}
-
-void flipface(EditMesh *em, EditFace *efa)
-{
-	if(efa->v4) {
-		SWAP(EditVert *, efa->v2, efa->v4);
-		SWAP(EditEdge *, efa->e1, efa->e4);
-		SWAP(EditEdge *, efa->e2, efa->e3);
-		EM_data_interp_from_faces(em, efa, NULL, efa, 0, 3, 2, 1);
-	}
-	else {
-		SWAP(EditVert *, efa->v2, efa->v3);
-		SWAP(EditEdge *, efa->e1, efa->e3);
-		efa->e2->dir= 1-efa->e2->dir;
-		EM_data_interp_from_faces(em, efa, NULL, efa, 0, 2, 1, 3);
-	}
-
-	if(efa->v4) normal_quad_v3( efa->n,efa->v1->co, efa->v2->co, efa->v3->co, efa->v4->co);
-	else normal_tri_v3( efa->n,efa->v1->co, efa->v2->co, efa->v3->co);
-}
-
-
-static int flip_normals(bContext *C, wmOperator *UNUSED(op))
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
-	EditFace *efa;
-	
-	efa= em->faces.first;
-	while(efa) {
-		if( efa->f & SELECT ){
-			flipface(em, efa);
-		}
-		efa= efa->next;
-	}
-	
-	/* update vertex normals too */
-	recalc_editnormals(em);
-
-	BKE_mesh_end_editmesh(obedit->data, em);
-
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-
-	return OPERATOR_FINISHED;
-}
-
-void MESH_OT_flip_normals(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Flip Normals";
-	ot->description= "Toggle the direction of selected face's vertex and face normals";
-	ot->idname= "MESH_OT_flip_normals";
-	
-	/* api callbacks */
-	ot->exec= flip_normals;
-	ot->poll= ED_operator_editmesh;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
-
-
-static int solidify_exec(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
-	float nor[3] = {0,0,1};
-
-	float thickness= RNA_float_get(op->ptr, "thickness");
-
-	extrudeflag(obedit, em, SELECT, nor, 1);
-	EM_make_hq_normals(em);
-	EM_solidify(em, thickness);
-
-
-	/* update vertex normals too */
-	recalc_editnormals(em);
-
-	BKE_mesh_end_editmesh(obedit->data, em);
-
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-
-	return OPERATOR_FINISHED;
-}
-
-
-void MESH_OT_solidify(wmOperatorType *ot)
-{
-	PropertyRNA *prop;
-	/* identifiers */
-	ot->name= "Solidify";
-	ot->description= "Create a solid skin by extruding, compensating for sharp angles";
-	ot->idname= "MESH_OT_solidify";
-
-	/* api callbacks */
-	ot->exec= solidify_exec;
-	ot->poll= ED_operator_editmesh;
-
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
-	prop= RNA_def_float(ot->srna, "thickness", 0.01f, -FLT_MAX, FLT_MAX, "Thickness", "", -10.0f, 10.0f);
-	RNA_def_property_ui_range(prop, -10, 10, 0.1, 4);
-}
-
-static int mesh_select_nth_exec(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
-	int nth = RNA_int_get(op->ptr, "nth");
-
-	EM_deselect_nth(em, nth);
-
-	BKE_mesh_end_editmesh(obedit->data, em);
-
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-
-	return OPERATOR_FINISHED;
-}
-
-
-void MESH_OT_select_nth(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Select Nth";
-	ot->description= "";
-	ot->idname= "MESH_OT_select_nth";
-
-	/* api callbacks */
-	ot->exec= mesh_select_nth_exec;
-	ot->poll= ED_operator_editmesh;
-
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
-	RNA_def_int(ot->srna, "nth", 2, 2, 100, "Nth Selection", "", 1, INT_MAX);
-}
-
diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c
new file mode 100644
index 0000000..e755df1
--- /dev/null
+++ b/source/blender/editors/mesh/editmesh_rip.c
@@ -0,0 +1,776 @@
+/*
+ * ***** 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) 2004 by Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Joseph Eagar
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/editors/mesh/editmesh_rip.c
+ *  \ingroup edmesh
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_scene_types.h"
+#include "DNA_object_types.h"
+
+#include "RNA_define.h"
+#include "RNA_access.h"
+
+#include "BLI_math.h"
+#include "BLI_array.h"
+
+#include "BKE_context.h"
+#include "BKE_object.h"
+#include "BKE_report.h"
+#include "BKE_tessmesh.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "ED_mesh.h"
+#include "ED_screen.h"
+#include "ED_transform.h"
+#include "ED_view3d.h"
+
+#include "mesh_intern.h"
+
+/* helper to find edge for edge_rip */
+static float edbm_rip_rip_edgedist(ARegion *ar, float mat[][4], float *co1, float *co2, const float mvalf[2])
+{
+	float vec1[3], vec2[3];
+
+	ED_view3d_project_float_v2(ar, co1, vec1, mat);
+	ED_view3d_project_float_v2(ar, co2, vec2, mat);
+
+	return dist_to_line_segment_v2(mvalf, vec1, vec2);
+}
+
+static float edbm_rip_edge_side_measure(BMEdge *e, BMLoop *e_l,
+                                        ARegion *ar,
+                                        float projectMat[4][4], const float fmval[2])
+{
+	float cent[3] = {0, 0, 0}, mid[3];
+
+	float vec[2];
+	float fmval_tweak[2];
+	float e_v1_co[2], e_v2_co[2];
+	float score;
+
+	BMVert *v1_other;
+	BMVert *v2_other;
+
+	BLI_assert(BM_vert_in_edge(e, e_l->v));
+
+	/* method for calculating distance:
+	 *
+	 * for each edge: calculate face center, then made a vector
+	 * from edge midpoint to face center.  offset edge midpoint
+	 * by a small amount along this vector. */
+
+	/* rather then the face center, get the middle of
+	 * both edge verts connected to this one */
+	v1_other = BM_face_other_vert_loop(e_l->f, e->v2, e->v1)->v;
+	v2_other = BM_face_other_vert_loop(e_l->f, e->v1, e->v2)->v;
+	mid_v3_v3v3(cent, v1_other->co, v2_other->co);
+	mid_v3_v3v3(mid, e->v1->co, e->v2->co);
+
+	ED_view3d_project_float_v2(ar, cent, cent, projectMat);
+	ED_view3d_project_float_v2(ar, mid, mid, projectMat);
+
+	ED_view3d_project_float_v2(ar, e->v1->co, e_v1_co, projectMat);
+	ED_view3d_project_float_v2(ar, e->v2->co, e_v2_co, projectMat);
+
+	sub_v2_v2v2(vec, cent, mid);
+	normalize_v2(vec);
+	mul_v2_fl(vec, 0.01f);
+
+	/* rather then adding to both verts, subtract from the mouse */
+	sub_v2_v2v2(fmval_tweak, fmval, vec);
+
+	score = len_v2v2(e_v1_co, e_v2_co);
+
+	if (dist_to_line_segment_v2(fmval_tweak, e_v1_co, e_v2_co) >
+		dist_to_line_segment_v2(fmval,       e_v1_co, e_v2_co))
+	{
+		return  score;
+	}
+	else {
+		return -score;
+	}
+}
+
+
+/* - Advanced selection handling 'ripsel' functions ----- */
+
+/**
+ * How rip selection works
+ *
+ * Firstly - rip is basically edge split with side-selection & grab.
+ * Things would be much more simple if we didn't have to worry about side selection
+ *
+ * The method used for checking the side of selection is as follows...
+ * - First tag all rip-able edges.
+ * - Build a contiguous edge list by looping over tagged edges and following each ones tagged siblings in both
+ *   directions.
+ *   - The loops are not stored in an array, Instead both loops on either side of each edge has its index values set
+ *     to count down from the last edge, this way, once we have the 'last' edge its very easy to walk down the
+ *     connected edge loops.
+ *     The reason for using loops like this is because when the edges are split we don't which face user gets the newly
+ *     created edge (its as good as random so we cant assume new edges will be on once side).
+ *     After splittingm, its very simple to walk along boundary loops since each only has one edge from a single side.
+ * - The end loop pairs are stored in an array however to support multiple edge-selection-islands, so you can rip
+ *   multiple selections at once.
+ * - * Execute the split *
+ * - For each #EdgeLoopPair walk down both sides of the split using the loops and measure which is facing the mouse.
+ * - Deselect the edge loop facing away.
+ *
+ * Limitation!
+ * This currently works very poorly with intersecting edge islands (verts with more then 2 tagged edges)
+ * This is nice to but for now not essential.
+ *
+ * - campbell.
+ */
+
+
+#define IS_VISIT_POSSIBLE(e)   (BM_edge_is_manifold(e) && BM_elem_flag_test(e, BM_ELEM_TAG))
+#define IS_VISIT_DONE(e) ((e)->l && (BM_elem_index_get((e)->l) != INVALID_UID))
+#define INVALID_UID INT_MIN
+
+/* mark, assign uid and step */
+static BMEdge *edbm_ripsel_edge_mark_step(BMVert *v, const int uid)
+{
+	BMIter iter;
+	BMEdge *e;
+	BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
+		if (IS_VISIT_POSSIBLE(e) && !IS_VISIT_DONE(e)) {
+			BMLoop *l_a, *l_b;
+
+			BM_edge_loop_pair(e, &l_a, &l_b); /* no need to check, we know this will be true */
+
+			/* so (IS_VISIT_DONE == TRUE) */
+			BM_elem_index_set(l_a, uid);
+			BM_elem_index_set(l_b, uid);
+
+			return e;
+		}
+	}
+	return NULL;
+}
+
+typedef struct EdgeLoopPair {
+	BMLoop *l_a;
+	BMLoop *l_b;
+} EdgeLoopPair;
+
+static EdgeLoopPair *edbm_ripsel_looptag_helper(BMesh *bm)
+{
+	BMIter fiter;
+	BMIter liter;
+
+	BMFace *f;
+	BMLoop *l;
+
+	int uid_start;
+	int uid_end;
+	int uid = bm->totedge; /* can start anywhere */
+
+	EdgeLoopPair *eloop_pairs = NULL;
+	BLI_array_declare(eloop_pairs);
+	EdgeLoopPair *lp;
+
+	/* initialize loops with dummy invalid index values */
+	BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
+		BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+			BM_elem_index_set(l, INVALID_UID);
+		}
+	}
+
+	/* set contiguous loops ordered 'uid' values for walking after split */
+	while (TRUE) {
+		int tot = 0;
+		BMIter eiter;
+		BMEdge *e_step;
+		BMVert *v_step;
+		BMEdge *e;
+		BMEdge *e_first;
+		BMEdge *e_last;
+
+		e_first = NULL;
+		BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) {
+			if (IS_VISIT_POSSIBLE(e) && !IS_VISIT_DONE(e)) {
+				e_first = e;
+				break;
+			}
+		}
+
+		if (e_first == NULL) {
+			break;
+		}
+
+		/* initialize  */
+		e_first = e;
+		v_step = e_first->v1;
+		e_step = NULL; /* quiet warning, will never remain this value */
+
+		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++;
+		}
+
+		/* this edges loops have the highest uid's, store this to walk down later */
+		e_last = e_step;
+
+		/* always store the highest 'uid' edge for the stride */
+		uid_end = uid - 1;
+		uid = uid_start - 1;
+
+		/* initialize */
+		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++;
+		}
+
+		/* stride far enough not to _ever_ overlap range */
+		uid_start = uid;
+		uid = uid_end + bm->totedge;
+
+		BLI_array_growone(eloop_pairs);
+		lp = &eloop_pairs[BLI_array_count(eloop_pairs) - 1];
+		BM_edge_loop_pair(e_last, &lp->l_a, &lp->l_b); /* no need to check, we know this will be true */
+
+
+		BLI_assert(tot == uid_end - uid_start);
+
+#if 0
+		printf("%s: found contiguous edge loop of (%d)\n", __func__, uid_end - uid_start);
+#endif
+
+	}
+
+	/* null terminate */
+	BLI_array_growone(eloop_pairs);
+	lp = &eloop_pairs[BLI_array_count(eloop_pairs) - 1];
+	lp->l_a = lp->l_b = NULL;
+
+	return eloop_pairs;
+}
+
+
+/* - De-Select the worst rip-edge side -------------------------------- */
+
+
+static BMEdge *edbm_ripsel_edge_uid_step(BMEdge *e_orig, BMVert **v_prev)
+{
+	BMIter eiter;
+	BMEdge *e;
+	BMVert *v = BM_edge_other_vert(e_orig, *v_prev);
+	const int uid_cmp = BM_elem_index_get(e_orig->l) - 1;
+
+	BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
+		if (BM_elem_index_get(e->l) == uid_cmp) {
+			*v_prev = v;
+			return e;
+		}
+	}
+	return NULL;
+}
+
+static BMVert *edbm_ripsel_edloop_pair_start_vert(BMEdge *e)
+{
+	/* try step in a direction, if it fails we know do go the other way */
+	BMVert *v_test = e->v1;
+	return (edbm_ripsel_edge_uid_step(e, &v_test)) ? e->v1 : e->v2;
+}
+
+static void edbm_ripsel_deselect_helper(BMesh *bm, EdgeLoopPair *eloop_pairs,
+                                        ARegion *ar, float projectMat[4][4], float fmval[2])
+{
+	EdgeLoopPair *lp;
+
+	for (lp = eloop_pairs; lp->l_a; lp++) {
+		BMEdge *e;
+		BMVert *v_prev;
+
+		float score_a = 0.0f;
+		float score_b = 0.0f;
+
+		e = lp->l_a->e;
+		v_prev = edbm_ripsel_edloop_pair_start_vert(e);
+		for (; e; e = edbm_ripsel_edge_uid_step(e, &v_prev)) {
+			score_a += edbm_rip_edge_side_measure(e, e->l, ar, projectMat, fmval);
+		}
+		e = lp->l_b->e;
+		v_prev = edbm_ripsel_edloop_pair_start_vert(e);
+		for (; e; e = edbm_ripsel_edge_uid_step(e, &v_prev)) {
+			score_b += edbm_rip_edge_side_measure(e, e->l, ar, projectMat, fmval);
+		}
+
+		e = (score_a > score_b) ? lp->l_a->e : lp->l_b->e;
+		v_prev = edbm_ripsel_edloop_pair_start_vert(e);
+		for (; e; e = edbm_ripsel_edge_uid_step(e, &v_prev)) {
+			BM_edge_select_set(bm, e, FALSE);
+		}
+	}
+}
+/* --- end 'ripsel' selection handling code --- */
+
+static int edbm_rip_call_edgesplit(BMEditMesh *em, wmOperator *op)
+{
+	BMOperator bmop;
+
+	if (!EDBM_op_init(em, &bmop, op, "edgesplit edges=%he verts=%hv use_verts=%b",
+					  BM_ELEM_TAG, BM_ELEM_SELECT, TRUE)) {
+		return FALSE;
+	}
+	BMO_op_exec(em->bm, &bmop);
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+		return FALSE;
+	}
+
+	return TRUE;
+}
+
+/**
+ * This is the main vert ripping function (rip when one vertex is selected)
+ */
+static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, wmEvent *event)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	ARegion *ar = CTX_wm_region(C);
+	RegionView3D *rv3d = CTX_wm_region_view3d(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMesh *bm = em->bm;
+	BMIter iter, liter;
+	BMLoop *l;
+	BMEdge *e, *e2;
+	BMVert *v, *ripvert = NULL;
+	const int totvert_orig = bm->totvert;
+	int i;
+	float projectMat[4][4], fmval[3] = {event->mval[0], event->mval[1]};
+	float dist = FLT_MAX;
+	float d;
+
+	BMEditSelection ese;
+	int totboundary_edge = 0;
+
+	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) {
+		v = (BMVert *)ese.ele;
+	}
+	else {
+		ese.ele = NULL;
+
+		BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+			if (BM_elem_flag_test(v, BM_ELEM_SELECT))
+				break;
+		}
+	}
+
+	/* this should be impossible, but sanity checks are a good thing */
+	if (!v)
+		return OPERATOR_CANCELLED;
+
+	e2 = NULL;
+
+	if (v->e) {
+		/* find closest edge to mouse cursor */
+		BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
+			int is_boundary = BM_edge_is_boundary(e);
+			/* consider wire as boundary for this purpose,
+			 * otherwise we can't a face away from a wire edge */
+			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);
+					if (d < dist) {
+						dist = d;
+						e2 = e;
+					}
+				}
+			}
+		}
+
+	}
+
+	/* should we go ahead with edge rip or do we need to do special case, split off vertex?:
+	 * split off vertex if...
+	 * - we cant find an edge - this means we are ripping a faces vert that is connected to other
+	 *   geometry only at the vertex.
+	 * - the boundary edge total is greater then 2,
+	 *   in this case edge split _can_ work but we get far nicer results if we use this special case. */
+	if (totboundary_edge > 2) {
+		BMVert **vout;
+		int vout_len;
+
+		BM_vert_select_set(bm, v, FALSE);
+
+		if (bmesh_vert_separate(bm, v, &vout, &vout_len) == FALSE) {
+			BKE_report(op->reports, RPT_ERROR, "Error ripping vertex from faces");
+			return OPERATOR_CANCELLED;
+		}
+		else if (vout_len < 2) {
+			MEM_freeN(vout);
+			/* set selection back to avoid active-unselected vertex */
+			BM_vert_select_set(bm, v, TRUE);
+			/* should never happen */
+			BKE_report(op->reports, RPT_ERROR, "Error ripping vertex from faces");
+			return OPERATOR_CANCELLED;
+		}
+		else {
+			int vi_best = 0;
+
+			if (ese.ele) {
+				BM_select_history_remove(em->bm, ese.ele);
+			}
+
+			dist = FLT_MAX;
+
+			for (i = 0; i < vout_len; i++) {
+				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);
+
+						/* scale to average of surrounding edge size, only needs to be approx */
+						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);
+
+						if (d < dist) {
+							dist = d;
+							vi_best = i;
+						}
+					}
+				}
+			}
+
+			/* select the vert from the best region */
+			v = vout[vi_best];
+			BM_vert_select_set(bm, v, TRUE);
+
+			if (ese.ele) {
+				BM_select_history_store(em->bm, v);
+			}
+
+			/* splice all others back together */
+			if (vout_len > 2) {
+
+				/* vout[0]  == best
+				 * vout[1]  == glue
+				 * vout[2+] == splice with glue
+				 */
+				if (vi_best != 0) {
+					SWAP(BMVert *, vout[0], vout[vi_best]);
+					vi_best = 0;
+				}
+
+				for (i = 2; i < vout_len; i++) {
+					BM_vert_splice(bm, vout[i], vout[1]);
+				}
+			}
+
+			MEM_freeN(vout);
+
+			return OPERATOR_FINISHED;
+		}
+	}
+
+	if (!e2) {
+		BKE_report(op->reports, RPT_ERROR, "Selected vertex has no edge/face pairs attached");
+		return OPERATOR_CANCELLED;
+	}
+
+	/* rip two adjacent edges */
+	if (BM_edge_is_boundary(e2) || BM_vert_face_count(v) == 2) {
+		l = e2->l;
+		ripvert = BM_face_vert_separate(bm, l->f, v);
+
+		BLI_assert(ripvert);
+		if (!ripvert) {
+			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);
+
+		l = e2->l->radial_next;
+		e = BM_face_other_edge_loop(l->f, e2, v)->e;
+		BM_elem_flag_enable(e, BM_ELEM_TAG);
+	}
+
+	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) {
+			if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
+				/* disable by default, re-enable winner at end */
+				BM_vert_select_set(bm, v, FALSE);
+
+				BM_ITER_ELEM (l, &liter, v, BM_LOOPS_OF_VERT) {
+					/* calculate a point in the face, rather then calculate the middle,
+					 * make a vector pointing between the 2 edges attached to this loop */
+					sub_v3_v3v3(l_prev_co, l->prev->v->co, l->v->co);
+					sub_v3_v3v3(l_next_co, l->next->v->co, l->v->co);
+
+					scale = normalize_v3(l_prev_co) + normalize_v3(l_next_co);
+					mul_v3_fl(l_prev_co, scale);
+					mul_v3_fl(l_next_co, scale);
+
+					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);
+					if (d < dist) {
+						v_best = v;
+						dist = d;
+					}
+				}
+			}
+		}
+
+		if (v_best) {
+			BM_vert_select_set(bm, v_best, TRUE);
+			if (ese.ele) {
+				BM_select_history_store(em->bm, v_best);
+			}
+		}
+	}
+
+	if (totvert_orig == bm->totvert) {
+		BKE_report(op->reports, RPT_ERROR, "No vertices could be ripped");
+		return OPERATOR_CANCELLED;
+	}
+
+	return OPERATOR_FINISHED;
+}
+
+/**
+ * This is the main edge ripping function
+ */
+static int edbm_rip_invoke__edge(bContext *C, wmOperator *op, wmEvent *event)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	ARegion *ar = CTX_wm_region(C);
+	RegionView3D *rv3d = CTX_wm_region_view3d(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMesh *bm = em->bm;
+	BMIter iter, eiter;
+	BMLoop *l;
+	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 */
+	eloop_pairs = edbm_ripsel_looptag_helper(bm);
+
+	/* expand edge selection */
+	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+		e2 = NULL;
+		i = 0;
+		totedge = 0;
+		all_minifold = TRUE;
+		BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
+
+			if (!BM_edge_is_wire(e) &&
+			    !BM_elem_flag_test(e, BM_ELEM_HIDDEN))
+			{
+				/* important to check selection rather then tag here
+				 * else we get feedback loop */
+				if (BM_elem_flag_test(e, BM_ELEM_SELECT)) {
+					e2 = e;
+					i++;
+				}
+				totedge++;
+			}
+
+			/** #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;
+			}
+		}
+
+		/* single edge, extend */
+		if (i == 1 && e2->l) {
+			if ((totedge == 4) || (all_minifold == 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
+				 * 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;
+
+				l = BM_face_other_edge_loop(l->f, e2, v);
+				/* important edge is manifold else we can be attempting to split off a fan that don't budge,
+				 * 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 (l) {
+						BM_elem_flag_enable(l->e, BM_ELEM_TAG);
+					}
+				}
+			}
+			else {
+				e = BM_vert_other_disk_edge(v, e2);
+
+				if (e) {
+					BM_elem_flag_enable(e, BM_ELEM_TAG);
+				}
+			}
+		}
+	}
+
+	if (!edbm_rip_call_edgesplit(em, op)) {
+		return OPERATOR_CANCELLED;
+	}
+
+	/* note: the output of the bmesh operator is ignored, since we built
+	 * the contiguous loop pairs to split already, its possible that some
+	 * edge did not split even though it was tagged which would not work
+	 * as expected (but not crash), however there are checks to ensure
+	 * tagged edges will split. So far its not been an issue. */
+	edbm_ripsel_deselect_helper(bm, eloop_pairs,
+	                            ar, projectMat, fmval);
+	MEM_freeN(eloop_pairs);
+
+	if (totedge_orig == bm->totedge) {
+		BKE_report(op->reports, RPT_ERROR, "No edges could be ripped");
+		return OPERATOR_CANCELLED;
+	}
+
+	EDBM_selectmode_flush(em);
+
+	return OPERATOR_FINISHED;
+}
+
+/* based on mouse cursor position, it defines how is being ripped */
+static int edbm_rip_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMesh *bm = em->bm;
+	BMIter iter;
+	BMEdge *e;
+	int singlesel = (bm->totvertsel == 1 && bm->totedgesel == 0 && bm->totfacesel == 0);
+	int ret;
+
+	/* running in face mode hardly makes sense, so convert to region loop and rip */
+	if (em->bm->totfacesel) {
+		/* highly nifty but hard to sypport 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");
+		return OPERATOR_CANCELLED;
+	}
+
+	/* note on selection:
+	 * When calling edge split we operate on tagged edges rather then selected
+	 * this is important because the edges to operate on are extended by one,
+	 * but the selection is left alone.
+	 *
+	 * After calling edge split - the duplicated edges have the same selection state as the
+	 * original, so all we do is de-select the far side from the mouse and we have a
+	 * useful selection for grabbing.
+	 */
+
+	/* BM_ELEM_SELECT --> BM_ELEM_TAG */
+	BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) {
+		BM_elem_flag_set(e, BM_ELEM_TAG, BM_elem_flag_test(e, BM_ELEM_SELECT));
+	}
+
+	/* split 2 main parts of this operator out into vertex and edge ripping */
+	if (singlesel) {
+		ret = edbm_rip_invoke__vert(C, op, event);
+	}
+	else {
+		ret = edbm_rip_invoke__edge(C, op, event);
+	}
+
+	if (ret == OPERATOR_CANCELLED) {
+		return OPERATOR_CANCELLED;
+	}
+
+	BLI_assert(singlesel ? (bm->totvertsel > 0) : (bm->totedgesel > 0));
+
+	if (bm->totvertsel == 0) {
+		return OPERATOR_CANCELLED;
+	}
+
+	EDBM_update_generic(C, em, TRUE);
+
+	return OPERATOR_FINISHED;
+}
+
+
+void MESH_OT_rip(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Rip";
+	ot->idname = "MESH_OT_rip";
+	ot->description = "Disconnect vertex or edges from connected geometry";
+
+	/* api callbacks */
+	ot->invoke = edbm_rip_invoke;
+	ot->poll = EM_view3d_poll;
+
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+	/* to give to transform */
+	Transform_Properties(ot, P_PROPORTIONAL);
+	RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
+}
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
new file mode 100644
index 0000000..0535293
--- /dev/null
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -0,0 +1,2777 @@
+/*
+ * ***** 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) 2004 Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/editors/mesh/editmesh_select.c
+ *  \ingroup edmesh
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_math.h"
+#include "BLI_rand.h"
+#include "BLI_array.h"
+#include "BLI_smallhash.h"
+#include "BLI_heap.h"
+
+#include "BKE_context.h"
+#include "BKE_displist.h"
+#include "BKE_depsgraph.h"
+#include "BKE_report.h"
+#include "BKE_paint.h"
+#include "BKE_tessmesh.h"
+
+#include "IMB_imbuf_types.h"
+#include "IMB_imbuf.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+
+#include "ED_mesh.h"
+#include "ED_screen.h"
+#include "ED_uvedit.h"
+#include "ED_view3d.h"
+
+#include "BIF_gl.h"
+
+#include "DNA_scene_types.h"
+#include "DNA_object_types.h"
+#include "DNA_mesh_types.h"
+
+#include "mesh_intern.h"
+
+
+/* ****************************** MIRROR **************** */
+
+void EDBM_select_mirrored(Object *UNUSED(obedit), BMEditMesh *em, int extend)
+{
+	BMVert *v1, *v2;
+	BMIter iter;
+
+	BM_ITER_MESH (v1, &iter, em->bm, BM_VERTS_OF_MESH) {
+		if (!BM_elem_flag_test(v1, BM_ELEM_SELECT) || BM_elem_flag_test(v1, BM_ELEM_HIDDEN)) {
+			BM_elem_flag_disable(v1, BM_ELEM_TAG);
+		}
+		else {
+			BM_elem_flag_enable(v1, BM_ELEM_TAG);
+		}
+	}
+
+	EDBM_verts_mirror_cache_begin(em, TRUE);
+
+	if (!extend)
+		EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+
+	BM_ITER_MESH (v1, &iter, em->bm, BM_VERTS_OF_MESH) {
+		if (!BM_elem_flag_test(v1, BM_ELEM_TAG) || BM_elem_flag_test(v1, BM_ELEM_HIDDEN))
+			continue;
+
+		v2 = EDBM_verts_mirror_get(em, v1);
+		if (v2 && !BM_elem_flag_test(v2, BM_ELEM_HIDDEN)) {
+			BM_vert_select_set(em->bm, v2, TRUE);
+		}
+	}
+
+	EDBM_verts_mirror_cache_end(em);
+}
+
+void EDBM_automerge(Scene *scene, Object *obedit, int update)
+{
+	BMEditMesh *em;
+	
+	if ((scene->toolsettings->automerge) &&
+	    (obedit && obedit->type == OB_MESH))
+	{
+		em = BMEdit_FromObject(obedit);
+		if (!em)
+			return;
+
+		BMO_op_callf(em->bm, "automerge verts=%hv dist=%f", BM_ELEM_SELECT, scene->toolsettings->doublimit);
+		if (update) {
+			DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
+			BMEdit_RecalcTessellation(em);
+		}
+	}
+}
+
+/* ****************************** SELECTION ROUTINES **************** */
+
+unsigned int bm_solidoffs = 0, bm_wireoffs = 0, bm_vertoffs = 0;    /* set in drawobject.c ... for colorindices */
+
+/* facilities for border select and circle select */
+static char *selbuf = NULL;
+
+/* opengl doesn't support concave... */
+static void draw_triangulated(int mcords[][2], short tot)
+{
+	ListBase lb = {NULL, NULL};
+	DispList *dl;
+	float *fp;
+	int a;
+	
+	/* make displist */
+	dl = MEM_callocN(sizeof(DispList), "poly disp");
+	dl->type = DL_POLY;
+	dl->parts = 1;
+	dl->nr = tot;
+	dl->verts = fp = MEM_callocN(tot * 3 * sizeof(float), "poly verts");
+	BLI_addtail(&lb, dl);
+	
+	for (a = 0; a < tot; a++, fp += 3) {
+		fp[0] = (float)mcords[a][0];
+		fp[1] = (float)mcords[a][1];
+	}
+	
+	/* do the fill */
+	filldisplist(&lb, &lb, 0);
+
+	/* do the draw */
+	dl = lb.first;  /* filldisplist adds in head of list */
+	if (dl->type == DL_INDEX3) {
+		int *index;
+		
+		a = dl->parts;
+		fp = dl->verts;
+		index = dl->index;
+		glBegin(GL_TRIANGLES);
+		while (a--) {
+			glVertex3fv(fp + 3 * index[0]);
+			glVertex3fv(fp + 3 * index[1]);
+			glVertex3fv(fp + 3 * index[2]);
+			index += 3;
+		}
+		glEnd();
+	}
+	
+	freedisplist(&lb);
+}
+
+
+/* reads rect, and builds selection array for quick lookup */
+/* returns if all is OK */
+int EDBM_backbuf_border_init(ViewContext *vc, short xmin, short ymin, short xmax, short ymax)
+{
+	struct ImBuf *buf;
+	unsigned int *dr;
+	int a;
+	
+	if (vc->obedit == NULL || vc->v3d->drawtype < OB_SOLID || (vc->v3d->flag & V3D_ZBUF_SELECT) == 0) {
+		return 0;
+	}
+	
+	buf = view3d_read_backbuf(vc, xmin, ymin, xmax, ymax);
+	if (buf == NULL) return 0;
+	if (bm_vertoffs == 0) return 0;
+
+	dr = buf->rect;
+	
+	/* build selection lookup */
+	selbuf = MEM_callocN(bm_vertoffs + 1, "selbuf");
+	
+	a = (xmax - xmin + 1) * (ymax - ymin + 1);
+	while (a--) {
+		if (*dr > 0 && *dr <= bm_vertoffs)
+			selbuf[*dr] = 1;
+		dr++;
+	}
+	IMB_freeImBuf(buf);
+	return 1;
+}
+
+int EDBM_backbuf_check(unsigned int index)
+{
+	if (selbuf == NULL) return 1;
+	if (index > 0 && index <= bm_vertoffs)
+		return selbuf[index];
+	return 0;
+}
+
+void EDBM_backbuf_free(void)
+{
+	if (selbuf) MEM_freeN(selbuf);
+	selbuf = NULL;
+}
+
+/* mcords is a polygon mask
+ * - grab backbuffer,
+ * - draw with black in backbuffer, 
+ * - grab again and compare
+ * returns 'OK' 
+ */
+int EDBM_backbuf_border_mask_init(ViewContext *vc, int mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax)
+{
+	unsigned int *dr, *drm;
+	struct ImBuf *buf, *bufmask;
+	int a;
+	
+	/* method in use for face selecting too */
+	if (vc->obedit == NULL) {
+		if (!(paint_facesel_test(vc->obact) || paint_vertsel_test(vc->obact))) {
+			return 0;
+		}
+	}
+	else if (vc->v3d->drawtype < OB_SOLID || (vc->v3d->flag & V3D_ZBUF_SELECT) == 0) {
+		return 0;
+	}
+
+	buf = view3d_read_backbuf(vc, xmin, ymin, xmax, ymax);
+	if (buf == NULL) return 0;
+	if (bm_vertoffs == 0) return 0;
+
+	dr = buf->rect;
+
+	/* draw the mask */
+	glDisable(GL_DEPTH_TEST);
+	
+	glColor3ub(0, 0, 0);
+	
+	/* yah, opengl doesn't do concave... tsk! */
+	ED_region_pixelspace(vc->ar);
+	draw_triangulated(mcords, tot);
+	
+	glBegin(GL_LINE_LOOP);  /* for zero sized masks, lines */
+	for (a = 0; a < tot; a++) {
+		glVertex2iv(mcords[a]);
+	}
+	glEnd();
+	
+	glFinish(); /* to be sure readpixels sees mask */
+	
+	/* grab mask */
+	bufmask = view3d_read_backbuf(vc, xmin, ymin, xmax, ymax);
+	drm = bufmask->rect;
+	if (bufmask == NULL) {
+		return 0; /* only when mem alloc fails, go crash somewhere else! */
+	}
+	
+	/* build selection lookup */
+	selbuf = MEM_callocN(bm_vertoffs + 1, "selbuf");
+	
+	a = (xmax - xmin + 1) * (ymax - ymin + 1);
+	while (a--) {
+		if (*dr > 0 && *dr <= bm_vertoffs && *drm == 0) selbuf[*dr] = 1;
+		dr++; drm++;
+	}
+	IMB_freeImBuf(buf);
+	IMB_freeImBuf(bufmask);
+
+	return 1;
+}
+
+/* circle shaped sample area */
+int EDBM_backbuf_circle_init(ViewContext *vc, short xs, short ys, short rads)
+{
+	struct ImBuf *buf;
+	unsigned int *dr;
+	short xmin, ymin, xmax, ymax, xc, yc;
+	int radsq;
+	
+	/* method in use for face selecting too */
+	if (vc->obedit == NULL) {
+		if (!(paint_facesel_test(vc->obact) || paint_vertsel_test(vc->obact))) {
+			return 0;
+		}
+	}
+	else if (vc->v3d->drawtype < OB_SOLID || (vc->v3d->flag & V3D_ZBUF_SELECT) == 0) return 0;
+	
+	xmin = xs - rads; xmax = xs + rads;
+	ymin = ys - rads; ymax = ys + rads;
+	buf = view3d_read_backbuf(vc, xmin, ymin, xmax, ymax);
+	if (bm_vertoffs == 0) return 0;
+	if (buf == NULL) return 0;
+
+	dr = buf->rect;
+	
+	/* build selection lookup */
+	selbuf = MEM_callocN(bm_vertoffs + 1, "selbuf");
+	radsq = rads * rads;
+	for (yc = -rads; yc <= rads; yc++) {
+		for (xc = -rads; xc <= rads; xc++, dr++) {
+			if (xc * xc + yc * yc < radsq) {
+				if (*dr > 0 && *dr <= bm_vertoffs) selbuf[*dr] = 1;
+			}
+		}
+	}
+
+	IMB_freeImBuf(buf);
+	return 1;
+	
+}
+
+static void findnearestvert__doClosest(void *userData, BMVert *eve, int x, int y, int index)
+{
+	struct { short mval[2], pass, select, strict; int dist, lastIndex, closestIndex; BMVert *closest; } *data = userData;
+
+	if (data->pass == 0) {
+		if (index <= data->lastIndex)
+			return;
+	}
+	else {
+		if (index > data->lastIndex)
+			return;
+	}
+
+	if (data->dist > 3) {
+		int temp = abs(data->mval[0] - x) + abs(data->mval[1] - y);
+		if (BM_elem_flag_test(eve, BM_ELEM_SELECT) == data->select) {
+			if (data->strict == 1) {
+				return;
+			}
+			else {
+				temp += 5;
+			}
+		}
+
+		if (temp < data->dist) {
+			data->dist = temp;
+			data->closest = eve;
+			data->closestIndex = index;
+		}
+	}
+}
+
+
+
+
+static unsigned int findnearestvert__backbufIndextest(void *handle, unsigned int index)
+{
+	BMEditMesh *em = (BMEditMesh *)handle;
+	BMVert *eve = BM_vert_at_index(em->bm, index - 1);
+
+	if (eve && BM_elem_flag_test(eve, BM_ELEM_SELECT)) return 0;
+	return 1;
+}
+/**
+ * findnearestvert
+ * 
+ * dist (in/out): minimal distance to the nearest and at the end, actual distance
+ * sel: selection bias
+ *      if SELECT, selected vertice are given a 5 pixel bias to make them further than unselect verts
+ *      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)
+{
+	if (vc->v3d->drawtype > OB_WIRE && (vc->v3d->flag & V3D_ZBUF_SELECT)) {
+		int distance;
+		unsigned int index;
+		BMVert *eve;
+		
+		if (strict) {
+			index = view3d_sample_backbuf_rect(vc, vc->mval, 50, bm_wireoffs, 0xFFFFFF, &distance,
+			                                   strict, vc->em, findnearestvert__backbufIndextest);
+		}
+		else {
+			index = view3d_sample_backbuf_rect(vc, vc->mval, 50, bm_wireoffs, 0xFFFFFF, &distance,
+			                                   0, NULL, NULL);
+		}
+		
+		eve = BM_vert_at_index(vc->em->bm, index - 1);
+		
+		if (eve && distance < *dist) {
+			*dist = distance;
+			return eve;
+		}
+		else {
+			return NULL;
+		}
+			
+	}
+	else {
+		struct { short mval[2], pass, select, strict; int dist, lastIndex, closestIndex; BMVert *closest; } data;
+		static int lastSelectedIndex = 0;
+		static BMVert *lastSelected = NULL;
+		
+		if (lastSelected && BM_vert_at_index(vc->em->bm, lastSelectedIndex) != lastSelected) {
+			lastSelectedIndex = 0;
+			lastSelected = NULL;
+		}
+
+		data.lastIndex = lastSelectedIndex;
+		data.mval[0] = vc->mval[0];
+		data.mval[1] = vc->mval[1];
+		data.select = sel;
+		data.dist = *dist;
+		data.strict = strict;
+		data.closest = NULL;
+		data.closestIndex = 0;
+
+		data.pass = 0;
+
+		ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
+
+		mesh_foreachScreenVert(vc, findnearestvert__doClosest, &data, V3D_CLIP_TEST_RV3D_CLIPPING);
+
+		if (data.dist > 3) {
+			data.pass = 1;
+			mesh_foreachScreenVert(vc, findnearestvert__doClosest, &data, V3D_CLIP_TEST_RV3D_CLIPPING);
+		}
+
+		*dist = data.dist;
+		lastSelected = data.closest;
+		lastSelectedIndex = data.closestIndex;
+
+		return data.closest;
+	}
+}
+
+/* returns labda for closest distance v1 to line-piece v2 - v3 */
+float labda_PdistVL2Dfl(const float v1[3], const float v2[3], const float v3[3])
+{
+	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))
+{
+	struct { ViewContext vc; float mval[2]; int dist; BMEdge *closest; } *data = userData;
+	float v1[2], v2[2];
+	int distance;
+		
+	v1[0] = x0;
+	v1[1] = y0;
+	v2[0] = x1;
+	v2[1] = y1;
+		
+	distance = dist_to_line_segment_v2(data->mval, v1, v2);
+		
+	if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
+		distance += 5;
+	}
+
+	if (distance < data->dist) {
+		if (data->vc.rv3d->rflag & RV3D_CLIPPING) {
+			float labda = labda_PdistVL2Dfl(data->mval, v1, v2);
+			float vec[3];
+
+			vec[0] = eed->v1->co[0] + labda * (eed->v2->co[0] - eed->v1->co[0]);
+			vec[1] = eed->v1->co[1] + labda * (eed->v2->co[1] - eed->v1->co[1]);
+			vec[2] = eed->v1->co[2] + labda * (eed->v2->co[2] - eed->v1->co[2]);
+			mul_m4_v3(data->vc.obedit->obmat, vec);
+
+			if (ED_view3d_clipping_test(data->vc.rv3d, vec, TRUE) == 0) {
+				data->dist = distance;
+				data->closest = eed;
+			}
+		}
+		else {
+			data->dist = distance;
+			data->closest = eed;
+		}
+	}
+}
+BMEdge *EDBM_edge_find_nearest(ViewContext *vc, int *dist)
+{
+
+	if (vc->v3d->drawtype > OB_WIRE && (vc->v3d->flag & V3D_ZBUF_SELECT)) {
+		int distance;
+		unsigned int index;
+		BMEdge *eed;
+		
+		view3d_validate_backbuf(vc);
+		
+		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;
+			return eed;
+		}
+		else {
+			return NULL;
+		}
+	}
+	else {
+		struct { ViewContext vc; float mval[2]; int dist; BMEdge *closest; } data;
+
+		data.vc = *vc;
+		data.mval[0] = vc->mval[0];
+		data.mval[1] = vc->mval[1];
+		data.dist = *dist;
+		data.closest = NULL;
+		ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
+
+		mesh_foreachScreenEdge(vc, findnearestedge__doClosest, &data, 2);
+
+		*dist = data.dist;
+		return data.closest;
+	}
+}
+
+static void findnearestface__getDistance(void *userData, BMFace *efa, int x, int y, int UNUSED(index))
+{
+	struct { short mval[2]; int dist; BMFace *toFace; } *data = userData;
+
+	if (efa == data->toFace) {
+		int temp = abs(data->mval[0] - x) + abs(data->mval[1] - y);
+
+		if (temp < data->dist)
+			data->dist = temp;
+	}
+}
+static void findnearestface__doClosest(void *userData, BMFace *efa, int x, int y, int index)
+{
+	struct { short mval[2], pass; int dist, lastIndex, closestIndex; BMFace *closest; } *data = userData;
+
+	if (data->pass == 0) {
+		if (index <= data->lastIndex)
+			return;
+	}
+	else {
+		if (index > data->lastIndex)
+			return;
+	}
+
+	if (data->dist > 3) {
+		int temp = abs(data->mval[0] - x) + abs(data->mval[1] - y);
+
+		if (temp < data->dist) {
+			data->dist = temp;
+			data->closest = efa;
+			data->closestIndex = index;
+		}
+	}
+}
+
+BMFace *EDBM_face_find_nearest(ViewContext *vc, int *dist)
+{
+
+	if (vc->v3d->drawtype > OB_WIRE && (vc->v3d->flag & V3D_ZBUF_SELECT)) {
+		unsigned int index;
+		BMFace *efa;
+
+		view3d_validate_backbuf(vc);
+
+		index = view3d_sample_backbuf(vc, vc->mval[0], vc->mval[1]);
+		efa = BM_face_at_index(vc->em->bm, index - 1);
+		
+		if (efa) {
+			struct { short mval[2]; int dist; BMFace *toFace; } data;
+
+			data.mval[0] = vc->mval[0];
+			data.mval[1] = vc->mval[1];
+			data.dist = 0x7FFF;     /* largest short */
+			data.toFace = efa;
+
+			mesh_foreachScreenFace(vc, findnearestface__getDistance, &data);
+
+			if (vc->em->selectmode == SCE_SELECT_FACE || data.dist < *dist) {   /* only faces, no dist check */
+				*dist = data.dist;
+				return efa;
+			}
+		}
+		
+		return NULL;
+	}
+	else {
+		struct { short mval[2], pass; int dist, lastIndex, closestIndex; BMFace *closest; } data;
+		static int lastSelectedIndex = 0;
+		static BMFace *lastSelected = NULL;
+
+		if (lastSelected && BM_face_at_index(vc->em->bm, lastSelectedIndex) != lastSelected) {
+			lastSelectedIndex = 0;
+			lastSelected = NULL;
+		}
+
+		data.lastIndex = lastSelectedIndex;
+		data.mval[0] = vc->mval[0];
+		data.mval[1] = vc->mval[1];
+		data.dist = *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);
+
+		if (data.dist > 3) {
+			data.pass = 1;
+			ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
+			mesh_foreachScreenFace(vc, findnearestface__doClosest, &data);
+		}
+
+		*dist = data.dist;
+		lastSelected = data.closest;
+		lastSelectedIndex = data.closestIndex;
+
+		return data.closest;
+	}
+}
+
+/* best distance based on screen coords. 
+ * use em->selectmode to define how to use 
+ * selected vertices and edges get disadvantage
+ * return 1 if found one
+ */
+static int unified_findnearest(ViewContext *vc, BMVert **r_eve, BMEdge **r_eed, BMFace **r_efa)
+{
+	BMEditMesh *em = vc->em;
+	int dist = 75;
+	
+	*r_eve = NULL;
+	*r_eed = NULL;
+	*r_efa = NULL;
+	
+	/* no afterqueue (yet), so we check it now, otherwise the em_xxxofs indices are bad */
+	view3d_validate_backbuf(vc);
+	
+	if (em->selectmode & SCE_SELECT_VERTEX)
+		*r_eve = EDBM_vert_find_nearest(vc, &dist, BM_ELEM_SELECT, 0);
+	if (em->selectmode & SCE_SELECT_FACE)
+		*r_efa = EDBM_face_find_nearest(vc, &dist);
+
+	dist -= 20; /* since edges select lines, we give dots advantage of 20 pix */
+	if (em->selectmode & SCE_SELECT_EDGE)
+		*r_eed = EDBM_edge_find_nearest(vc, &dist);
+
+	/* return only one of 3 pointers, for frontbuffer redraws */
+	if (*r_eed) {
+		*r_efa = NULL; *r_eve = NULL;
+	}
+	else if (*r_efa) {
+		*r_eve = NULL;
+	}
+	
+	return (*r_eve || *r_eed || *r_efa);
+}
+
+/* ****************  SIMILAR "group" SELECTS. FACE, EDGE AND VERTEX ************** */
+
+static EnumPropertyItem prop_similar_types[] = {
+	{SIMVERT_NORMAL, "NORMAL", 0, "Normal", ""},
+	{SIMVERT_FACE, "FACE", 0, "Amount of Adjacent Faces", ""},
+	{SIMVERT_VGROUP, "VGROUP", 0, "Vertex Groups", ""},
+
+	{SIMEDGE_LENGTH, "LENGTH", 0, "Length", ""},
+	{SIMEDGE_DIR, "DIR", 0, "Direction", ""},
+	{SIMEDGE_FACE, "FACE", 0, "Amount of Faces Around an Edge", ""},
+	{SIMEDGE_FACE_ANGLE, "FACE_ANGLE", 0, "Face Angles", ""},
+	{SIMEDGE_CREASE, "CREASE", 0, "Crease", ""},
+	{SIMEDGE_SEAM, "SEAM", 0, "Seam", ""},
+	{SIMEDGE_SHARP, "SHARP", 0, "Sharpness", ""},
+
+	{SIMFACE_MATERIAL, "MATERIAL", 0, "Material", ""},
+	{SIMFACE_IMAGE, "IMAGE", 0, "Image", ""},
+	{SIMFACE_AREA, "AREA", 0, "Area", ""},
+	{SIMFACE_PERIMETER, "PERIMETER", 0, "Perimeter", ""},
+	{SIMFACE_NORMAL, "NORMAL", 0, "Normal", ""},
+	{SIMFACE_COPLANAR, "COPLANAR", 0, "Co-planar", ""},
+
+	{0, NULL, 0, NULL, NULL}
+};
+
+/* selects new faces/edges/verts based on the existing selection */
+
+static int similar_face_select_exec(bContext *C, wmOperator *op)
+{
+	Object *ob = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(ob);
+	BMOperator bmop;
+
+	/* get the type from RNA */
+	int type = RNA_enum_get(op->ptr, "type");
+	float thresh = RNA_float_get(op->ptr, "threshold");
+
+	/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
+	EDBM_op_init(em, &bmop, op, "similarfaces faces=%hf type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
+
+	/* execute the operator */
+	BMO_op_exec(em->bm, &bmop);
+
+	/* clear the existing selection */
+	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);
+
+	/* finish the operator */
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+		return OPERATOR_CANCELLED;
+	}
+
+	EDBM_update_generic(C, em, FALSE);
+
+	/* we succeeded */
+	return OPERATOR_FINISHED;
+}	
+
+/* ***************************************************** */
+
+/* EDGE GROUP */
+
+/* wrap the above function but do selection flushing edge to face */
+static int similar_edge_select_exec(bContext *C, wmOperator *op)
+{
+	Object *ob = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(ob);
+	BMOperator bmop;
+
+	/* get the type from RNA */
+	int type = RNA_enum_get(op->ptr, "type");
+	float thresh = RNA_float_get(op->ptr, "threshold");
+
+	/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
+	EDBM_op_init(em, &bmop, op, "similaredges edges=%he type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
+
+	/* execute the operator */
+	BMO_op_exec(em->bm, &bmop);
+
+	/* clear the existing selection */
+	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);
+	EDBM_selectmode_flush(em);
+
+	/* finish the operator */
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+		return OPERATOR_CANCELLED;
+	}
+
+	EDBM_update_generic(C, em, FALSE);
+
+	/* we succeeded */
+	return OPERATOR_FINISHED;
+}
+
+/* ********************************* */
+
+/*
+ * VERT GROUP
+ * mode 1: same normal
+ * mode 2: same number of face users
+ * mode 3: same vertex groups
+ */
+static int similar_vert_select_exec(bContext *C, wmOperator *op)
+{
+	Object *ob = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(ob);
+	BMOperator bmop;
+	/* get the type from RNA */
+	int type = RNA_enum_get(op->ptr, "type");
+	float thresh = RNA_float_get(op->ptr, "threshold");
+
+	/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
+	EDBM_op_init(em, &bmop, op, "similarverts verts=%hv type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
+
+	/* execute the operator */
+	BMO_op_exec(em->bm, &bmop);
+
+	/* clear the existing selection */
+	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);
+
+	/* finish the operator */
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+		return OPERATOR_CANCELLED;
+	}
+
+	EDBM_selectmode_flush(em);
+
+	EDBM_update_generic(C, em, FALSE);
+
+	/* we succeeded */
+	return OPERATOR_FINISHED;
+}
+
+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");
+
+	if (!RNA_property_is_set(op->ptr, prop)) {
+		RNA_property_float_set(op->ptr, prop, ts->select_thresh);
+	}
+	else {
+		ts->select_thresh = RNA_property_float_get(op->ptr, prop);
+	}
+
+	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);
+}
+
+static EnumPropertyItem *select_similar_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop),
+                                                   int *free)
+{
+	Object *obedit = CTX_data_edit_object(C);
+
+	if (obedit && obedit->type == OB_MESH) {
+		EnumPropertyItem *item = NULL;
+		int a, totitem = 0;
+		BMEditMesh *em = BMEdit_FromObject(obedit);
+
+		if (em->selectmode & SCE_SELECT_VERTEX) {
+			for (a = SIMVERT_NORMAL; a < SIMEDGE_LENGTH; a++) {
+				RNA_enum_items_add_value(&item, &totitem, prop_similar_types, a);
+			}
+		}
+		else if (em->selectmode & SCE_SELECT_EDGE) {
+			for (a = SIMEDGE_LENGTH; a < SIMFACE_MATERIAL; a++) {
+				RNA_enum_items_add_value(&item, &totitem, prop_similar_types, a);
+			}
+		}
+		else if (em->selectmode & SCE_SELECT_FACE) {
+			for (a = SIMFACE_MATERIAL; a <= SIMFACE_COPLANAR; a++) {
+				RNA_enum_items_add_value(&item, &totitem, prop_similar_types, a);
+			}
+		}
+		RNA_enum_item_end(&item, &totitem);
+
+		*free = 1;
+
+		return item;
+	}
+	
+	return NULL;
+}
+
+void MESH_OT_select_similar(wmOperatorType *ot)
+{
+	PropertyRNA *prop;
+
+	/* identifiers */
+	ot->name = "Select Similar";
+	ot->idname = "MESH_OT_select_similar";
+	ot->description = "Select similar vertices, edges or faces by property types";
+	
+	/* api callbacks */
+	ot->invoke = WM_menu_invoke;
+	ot->exec = edbm_select_similar_exec;
+	ot->poll = ED_operator_editmesh;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+	
+	/* properties */
+	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);
+}
+
+/* ***************************************************** */
+
+/* ****************  LOOP SELECTS *************** */
+
+static void walker_select(BMEditMesh *em, int walkercode, void *start, int select)
+{
+	BMesh *bm = em->bm;
+	BMElem *ele;
+	BMWalker walker;
+
+	BMW_init(&walker, bm, walkercode,
+	         BMW_MASK_NOP, BMW_MASK_NOP, BMW_MASK_NOP,
+	         BMW_FLAG_TEST_HIDDEN,
+	         BMW_NIL_LAY);
+	ele = BMW_begin(&walker, start);
+	for (; ele; ele = BMW_step(&walker)) {
+		if (!select) {
+			BM_select_history_remove(bm, ele);
+		}
+		BM_elem_select_set(bm, ele, select);
+	}
+	BMW_end(&walker);
+}
+
+static int edbm_loop_multiselect_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMEdge *eed;
+	BMEdge **edarray;
+	int edindex;
+	int looptype = RNA_boolean_get(op->ptr, "ring");
+	
+	BMIter iter;
+	int totedgesel = 0;
+
+	for (eed = BM_iter_new(&iter, em->bm, BM_EDGES_OF_MESH, NULL);
+	     eed; eed = BM_iter_step(&iter)) {
+
+		if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
+			totedgesel++;
+		}
+	}
+
+	
+	edarray = MEM_mallocN(sizeof(BMEdge *) * totedgesel, "edge array");
+	edindex = 0;
+	
+	for (eed = BM_iter_new(&iter, em->bm, BM_EDGES_OF_MESH, NULL);
+	     eed;
+	     eed = BM_iter_step(&iter))
+	{
+
+		if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
+			edarray[edindex] = eed;
+			edindex++;
+		}
+	}
+	
+	if (looptype) {
+		for (edindex = 0; edindex < totedgesel; edindex += 1) {
+			eed = edarray[edindex];
+			walker_select(em, BMW_EDGERING, eed, TRUE);
+		}
+		EDBM_selectmode_flush(em);
+	}
+	else {
+		for (edindex = 0; edindex < totedgesel; edindex += 1) {
+			eed = edarray[edindex];
+			walker_select(em, BMW_LOOP, eed, TRUE);
+		}
+		EDBM_selectmode_flush(em);
+	}
+	MEM_freeN(edarray);
+//	if (EM_texFaceCheck())
+	
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit);
+
+	return OPERATOR_FINISHED;
+}
+
+void MESH_OT_loop_multi_select(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Multi Select Loops";
+	ot->idname = "MESH_OT_loop_multi_select";
+	ot->description = "Select a loop of connected edges by connection type";
+	
+	/* api callbacks */
+	ot->exec = edbm_loop_multiselect_exec;
+	ot->poll = ED_operator_editmesh;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+	
+	/* properties */
+	RNA_def_boolean(ot->srna, "ring", 0, "Ring", "");
+}
+
+		
+/* ***************** MAIN MOUSE SELECTION ************** */
+
+
+/* ***************** loop select (non modal) ************** */
+
+static void mouse_mesh_loop(bContext *C, int mval[2], short extend, short ring)
+{
+	ViewContext vc;
+	BMEditMesh *em;
+	BMEdge *eed;
+	int select = TRUE;
+	int dist = 50;
+	
+	em_setup_viewcontext(C, &vc);
+	vc.mval[0] = mval[0];
+	vc.mval[1] = mval[1];
+	em = vc.em;
+	
+	/* no afterqueue (yet), so we check it now, otherwise the bm_xxxofs indices are bad */
+	view3d_validate_backbuf(&vc);
+
+	eed = EDBM_edge_find_nearest(&vc, &dist);
+	if (eed) {
+		if (extend == 0) {
+			EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+		}
+	
+		if (BM_elem_flag_test(eed, BM_ELEM_SELECT) == 0) {
+			select = TRUE;
+		}
+		else if (extend) {
+			select = FALSE;
+		}
+
+		if (em->selectmode & SCE_SELECT_FACE) {
+			walker_select(em, BMW_FACELOOP, eed, select);
+		}
+		else if (em->selectmode & SCE_SELECT_EDGE) {
+			if (ring)
+				walker_select(em, BMW_EDGERING, eed, select);
+			else
+				walker_select(em, BMW_LOOP, eed, select);
+		}
+		else if (em->selectmode & SCE_SELECT_VERTEX) {
+			if (ring)
+				walker_select(em, BMW_EDGERING, eed, select);
+
+			else
+				walker_select(em, BMW_LOOP, eed, select);
+		}
+
+		EDBM_selectmode_flush(em);
+//			if (EM_texFaceCheck())
+		
+		/* sets as active, useful for other tools */
+		if (select) {
+			if (em->selectmode & SCE_SELECT_VERTEX) {
+				/* TODO: would be nice if the edge vertex chosen here
+				 * was the one closer to the selection pointer, instead
+				 * of arbitrarily selecting the first one */
+				BM_select_history_store(em->bm, eed->v1);
+			}
+			else if (em->selectmode & SCE_SELECT_EDGE) {
+				BM_select_history_store(em->bm, eed);
+			}
+			/* TODO: would be nice if the nearest face that
+			 * belongs to the selected edge could be set to
+			 * active here in face select mode */
+		}
+
+		WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit);
+	}
+}
+
+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, "ring"));
+	
+	/* cannot do tweaks for as long this keymap is after transform map */
+	return OPERATOR_FINISHED;
+}
+
+void MESH_OT_loop_select(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Loop Select";
+	ot->idname = "MESH_OT_loop_select";
+	ot->description = "Select a loop of connected edges";
+	
+	/* api callbacks */
+	ot->invoke = edbm_select_loop_invoke;
+	ot->poll = ED_operator_editmesh_region_view3d;
+	
+	/* flags */
+	ot->flag = OPTYPE_UNDO;
+	
+	/* properties */
+	RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", "Extend the selection");
+	RNA_def_boolean(ot->srna, "ring", 0, "Select Ring", "Select ring");
+}
+
+void MESH_OT_edgering_select(wmOperatorType *ot)
+{
+	/* description */
+	ot->name = "Edge Ring Select";
+	ot->idname = "MESH_OT_edgering_select";
+	ot->description = "Select an edge ring";
+	
+	/* callbacks */
+	ot->invoke = edbm_select_loop_invoke;
+	ot->poll = ED_operator_editmesh_region_view3d;
+	
+	/* flags */
+	ot->flag = OPTYPE_UNDO;
+
+	RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection");
+	RNA_def_boolean(ot->srna, "ring", 1, "Select Ring", "Select ring");
+}
+
+/* ******************* edgetag_shortest_path and helpers ****************** */
+
+static float edgetag_cut_cost(BMEditMesh *UNUSED(em), BMEdge *e1, BMEdge *e2, BMVert *v)
+{
+	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);
+
+	/* 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 - sqrt(fabs(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;
+
+		if (BLI_smallhash_haskey(visithash, (uintptr_t)e2))
+			continue;
+
+		cutcost = edgetag_cut_cost(em, e1, e2, v);
+		newcost = cost[mednum] + cutcost;
+
+		if (cost[adjnum] > newcost) {
+			cost[adjnum] = newcost;
+			prevedge[adjnum] = mednum;
+			BLI_heap_insert(heap, newcost, SET_INT_IN_POINTER(adjnum));
+		}
+	}
+}
+
+static void edgetag_context_set(BMEditMesh *em, Scene *scene, BMEdge *e, int val)
+{
+	
+	switch (scene->toolsettings->edge_mode) {
+		case EDGE_MODE_SELECT:
+			BM_edge_select_set(em->bm, e, val);
+			break;
+		case EDGE_MODE_TAG_SEAM:
+			BM_elem_flag_set(e, BM_ELEM_SEAM, val);
+			break;
+		case EDGE_MODE_TAG_SHARP:
+			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;
+			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;
+			break;
+		}
+	}
+}
+
+static int edgetag_context_check(Scene *scene, BMEditMesh *em, BMEdge *e)
+{
+	switch (scene->toolsettings->edge_mode) {
+		case EDGE_MODE_SELECT:
+			return BM_elem_flag_test(e, BM_ELEM_SELECT) ? 1 : 0;
+		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;
+		case EDGE_MODE_TAG_BEVEL:
+			return BM_elem_float_data_get(&em->bm->edata, e, CD_BWEIGHT) ? 1 : 0;
+	}
+	return 0;
+}
+
+static int edgetag_shortest_path(Scene *scene, BMEditMesh *em, BMEdge *source, BMEdge *target)
+{
+	BMEdge *e;
+	BMIter iter;
+	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);
+
+	/* 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_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_elem_index_set(e, totedge); /* set_inline */
+		totedge++;
+	}
+	em->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");
+	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++;
+	}
+
+	/*
+	 * 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
+	 * path to edge n found so far, Finally, heap is a priority heap which is built on the
+	 * the same data as the cost arry, but inverted: it is a worklist of edges prioritized
+	 * by the shortest path found so far to the edge.
+	 */
+
+	/* 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);
+
+	while (!BLI_heap_empty(heap)) {
+		mednum = GET_INT_FROM_POINTER(BLI_heap_popmin(heap));
+		e = EDBM_edge_at_index(em, mednum);
+
+		if (mednum == targetnum)
+			break;
+
+		if (BLI_smallhash_haskey(&visithash, (uintptr_t)e))
+			continue;
+
+		BLI_smallhash_insert(&visithash, (uintptr_t)e, NULL);
+
+		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 (mednum == targetnum) {
+		short allseams = 1;
+
+		/* Check whether the path is already completely tagged.
+		 * if it is, the tags will be cleared instead of set. */
+		mednum = targetnum;
+		do {
+			e = EDBM_edge_at_index(em, mednum);
+			if (!edgetag_context_check(scene, em, e)) {
+				allseams = 0;
+				break;
+			}
+			mednum = prevedge[mednum];
+		} while (mednum != BM_elem_index_get(source));
+
+		/* Follow path back and source and add or remove tags */
+		mednum = targetnum;
+		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);
+	}
+
+	EDBM_index_arrays_free(em);
+	MEM_freeN(nedges);
+	MEM_freeN(edges);
+	MEM_freeN(prevedge);
+	MEM_freeN(cost);
+	BLI_heap_free(heap, NULL);
+	BLI_smallhash_release(&visithash);
+
+	return 1;
+}
+
+/* ******************* 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])
+{
+	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;
+	
+	e = EDBM_edge_find_nearest(&vc, &dist);
+	if (e) {
+		Mesh *me = vc.obedit->data;
+		int path = 0;
+		
+		if (em->bm->selected.last) {
+			BMEditSelection *ese = em->bm->selected.last;
+			
+			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)) {
+						BM_select_history_remove(em->bm, e_act);
+						path = 1;
+					}
+				}
+			}
+		}
+		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 */
+		}
+		
+		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);
+		else
+			BM_select_history_store(em->bm, e);
+	
+		/* 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);
+				break;
+			case EDGE_MODE_TAG_SHARP:
+				me->drawflag |= ME_DRAWSHARP;
+				break;
+			case EDGE_MODE_TAG_CREASE:	
+				me->drawflag |= ME_DRAWCREASES;
+				break;
+			case EDGE_MODE_TAG_BEVEL:
+				me->drawflag |= ME_DRAWBWEIGHTS;
+				break;
+		}
+		
+		EDBM_update_generic(C, em, FALSE);
+
+		return TRUE;
+	}
+	else {
+		return FALSE;
+	}
+}
+
+
+static int edbm_shortest_path_select_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
+{
+	
+	view3d_operator_needs_opengl(C);
+
+	if (mouse_mesh_shortest_path(C, event->mval)) {
+		return OPERATOR_FINISHED;
+	}
+	else {
+		return OPERATOR_PASS_THROUGH;
+	}
+}
+
+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 0;
+}
+
+void MESH_OT_select_shortest_path(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Shortest Path Select";
+	ot->idname = "MESH_OT_select_shortest_path";
+	ot->description = "Select shortest path between two selections";
+	
+	/* api callbacks */
+	ot->invoke = edbm_shortest_path_select_invoke;
+	ot->poll = edbm_shortest_path_select_poll;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+	
+	/* properties */
+	RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", "");
+}
+
+/* ************************************************** */
+/* here actual select happens */
+/* gets called via generic mouse select operator */
+int mouse_mesh(bContext *C, const int mval[2], short extend)
+{
+	ViewContext vc;
+	BMVert *eve = NULL;
+	BMEdge *eed = NULL;
+	BMFace *efa = NULL;
+	
+	/* setup view context for argument to callbacks */
+	em_setup_viewcontext(C, &vc);
+	vc.mval[0] = mval[0];
+	vc.mval[1] = mval[1];
+	
+	if (unified_findnearest(&vc, &eve, &eed, &efa)) {
+		
+		if (extend == 0) EDBM_flag_disable_all(vc.em, BM_ELEM_SELECT);
+		
+		if (efa) {
+			/* set the last selected face */
+			BM_active_face_set(vc.em->bm, efa);
+			
+			if (!BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
+				BM_select_history_store(vc.em->bm, efa);
+				BM_face_select_set(vc.em->bm, efa, TRUE);
+			}
+			else if (extend) {
+				BM_select_history_remove(vc.em->bm, efa);
+				BM_face_select_set(vc.em->bm, efa, FALSE);
+			}
+		}
+		else if (eed) {
+			if (!BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
+				BM_select_history_store(vc.em->bm, eed);
+				BM_edge_select_set(vc.em->bm, eed, TRUE);
+			}
+			else if (extend) {
+				BM_select_history_remove(vc.em->bm, eed);
+				BM_edge_select_set(vc.em->bm, eed, FALSE);
+			}
+		}
+		else if (eve) {
+			if (!BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
+				BM_select_history_store(vc.em->bm, eve);
+				BM_vert_select_set(vc.em->bm, eve, TRUE);
+			}
+			else if (extend) {
+				BM_select_history_remove(vc.em->bm, eve);
+				BM_vert_select_set(vc.em->bm, eve, FALSE);
+			}
+		}
+		
+		EDBM_selectmode_flush(vc.em);
+		  
+		/* change active material on object */
+		if (efa && efa->mat_nr != vc.obedit->actcol - 1) {
+			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_GEOM | ND_SELECT, vc.obedit);
+		return 1;
+	}
+
+	return 0;
+}
+
+static void edbm_strip_selections(BMEditMesh *em)
+{
+	BMEditSelection *ese, *nextese;
+
+	if (!(em->selectmode & SCE_SELECT_VERTEX)) {
+		ese = em->bm->selected.first;
+		while (ese) {
+			nextese = ese->next;
+			if (ese->htype == BM_VERT) BLI_freelinkN(&(em->bm->selected), ese);
+			ese = nextese;
+		}
+	}
+	if (!(em->selectmode & SCE_SELECT_EDGE)) {
+		ese = em->bm->selected.first;
+		while (ese) {
+			nextese = ese->next;
+			if (ese->htype == BM_EDGE) BLI_freelinkN(&(em->bm->selected), ese);
+			ese = nextese;
+		}
+	}
+	if (!(em->selectmode & SCE_SELECT_FACE)) {
+		ese = em->bm->selected.first;
+		while (ese) {
+			nextese = ese->next;
+			if (ese->htype == BM_FACE) BLI_freelinkN(&(em->bm->selected), ese);
+			ese = nextese;
+		}
+	}
+}
+
+/* when switching select mode, makes sure selection is consistent for editing */
+/* also for paranoia checks to make sure edge or face mode works */
+void EDBM_selectmode_set(BMEditMesh *em)
+{
+	BMVert *eve;
+	BMEdge *eed;
+	BMFace *efa;
+	BMIter iter;
+	
+	em->bm->selectmode = em->selectmode;
+
+	edbm_strip_selections(em); /* strip BMEditSelections from em->selected that are not relevant to new mode */
+	
+	if (em->selectmode & SCE_SELECT_VERTEX) {
+		EDBM_select_flush(em);
+	}
+	else if (em->selectmode & SCE_SELECT_EDGE) {
+		/* deselect vertices, and select again based on edge select */
+		eve = BM_iter_new(&iter, em->bm, BM_VERTS_OF_MESH, NULL);
+		for (; eve; eve = BM_iter_step(&iter)) BM_vert_select_set(em->bm, eve, FALSE);
+		
+		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, BM_ELEM_SELECT)) {
+				BM_edge_select_set(em->bm, eed, TRUE);
+			}
+		}
+		
+		/* selects faces based on edge status */
+		EDBM_selectmode_flush(em);
+	}
+	else if (em->selectmode & SCE_SELECT_FACE) {
+		/* deselect eges, and select again based on face select */
+		eed = BM_iter_new(&iter, em->bm, BM_EDGES_OF_MESH, NULL);
+		for (; eed; eed = BM_iter_step(&iter)) BM_edge_select_set(em->bm, eed, FALSE);
+		
+		efa = BM_iter_new(&iter, em->bm, BM_FACES_OF_MESH, NULL);
+		for (; efa; efa = BM_iter_step(&iter)) {
+			if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
+				BM_face_select_set(em->bm, efa, TRUE);
+			}
+		}
+	}
+}
+
+void EDBM_selectmode_convert(BMEditMesh *em, short oldmode, short selectmode)
+{
+	BMEdge *eed;
+	BMFace *efa;
+	BMIter iter;
+
+	/* have to find out what the selectionmode was previously */
+	if (oldmode == SCE_SELECT_VERTEX) {
+		if (selectmode == 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)))
+				{
+					BM_edge_select_set(em->bm, eed, TRUE);
+				}
+			}
+		}		
+		else if (selectmode == 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;
+					}
+				}
+			}
+		}
+	}
+	
+	if (oldmode == SCE_SELECT_EDGE) {
+		if (selectmode == 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;
+					}
+				}
+			}
+		}
+	}
+}
+
+
+void EDBM_deselect_by_material(BMEditMesh *em, const short index, const short select)
+{
+	BMIter iter;
+	BMFace *efa;
+
+	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+		if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN))
+			continue;
+		if (efa->mat_nr == index) {
+			BM_face_select_set(em->bm, efa, select);
+		}
+	}
+}
+
+void EDBM_select_toggle_all(BMEditMesh *em) /* exported for UV */
+{
+	if (em->bm->totvertsel || em->bm->totedgesel || em->bm->totfacesel)
+		EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+	else
+		EDBM_flag_enable_all(em, BM_ELEM_SELECT);
+}
+
+void EDBM_select_swap(BMEditMesh *em) /* exported for UV */
+{
+	BMIter iter;
+	BMVert *eve;
+	BMEdge *eed;
+	BMFace *efa;
+	
+	if (em->bm->selectmode & SCE_SELECT_VERTEX) {
+		BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+			if (BM_elem_flag_test(eve, BM_ELEM_HIDDEN))
+				continue;
+			BM_vert_select_set(em->bm, eve, !BM_elem_flag_test(eve, BM_ELEM_SELECT));
+		}
+	}
+	else if (em->selectmode & SCE_SELECT_EDGE) {
+		BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
+			if (BM_elem_flag_test(eed, BM_ELEM_HIDDEN))
+				continue;
+			BM_edge_select_set(em->bm, eed, !BM_elem_flag_test(eed, BM_ELEM_SELECT));
+		}
+	}
+	else {
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN))
+				continue;
+			BM_face_select_set(em->bm, efa, !BM_elem_flag_test(efa, BM_ELEM_SELECT));
+		}
+
+	}
+//	if (EM_texFaceCheck())
+}
+
+int EDBM_select_interior_faces(BMEditMesh *em)
+{
+	BMesh *bm = em->bm;
+	BMIter iter;
+	BMIter eiter;
+	BMFace *efa;
+	BMEdge *eed;
+	int ok;
+	int change = FALSE;
+
+	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+		if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN))
+			continue;
+
+
+		ok = TRUE;
+		BM_ITER_ELEM (eed, &eiter, efa, BM_EDGES_OF_FACE) {
+			if (BM_edge_face_count(eed) < 3) {
+				ok = FALSE;
+				break;
+			}
+		}
+
+		if (ok) {
+			BM_face_select_set(bm, efa, TRUE);
+			change = TRUE;
+		}
+	}
+
+	return change;
+}
+
+static void linked_limit_default(bContext *C, wmOperator *op)
+{
+	if (!RNA_struct_property_is_set(op->ptr, "limit")) {
+		Object *obedit = CTX_data_edit_object(C);
+		BMEditMesh *em = BMEdit_FromObject(obedit);
+		if (em->selectmode == SCE_SELECT_FACE)
+			RNA_boolean_set(op->ptr, "limit", TRUE);
+		else
+			RNA_boolean_set(op->ptr, "limit", FALSE);
+	}
+}
+
+static int edbm_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	ViewContext vc;
+	BMesh *bm;
+	BMWalker walker;
+	BMEditMesh *em;
+	BMVert *eve;
+	BMEdge *e, *eed;
+	BMFace *efa;
+	int sel = !RNA_boolean_get(op->ptr, "deselect");
+
+	int limit;
+
+	linked_limit_default(C, op);
+
+	limit = RNA_boolean_get(op->ptr, "limit");
+
+	/* unified_finednearest needs ogl */
+	view3d_operator_needs_opengl(C);
+	
+	/* setup view context for argument to callbacks */
+	em_setup_viewcontext(C, &vc);
+	em = vc.em;
+
+	if (em->bm->totedge == 0)
+		return OPERATOR_CANCELLED;
+	
+	bm = em->bm;
+
+	vc.mval[0] = event->mval[0];
+	vc.mval[1] = event->mval[1];
+	
+	/* return warning! */
+	
+	if (unified_findnearest(&vc, &eve, &eed, &efa) == 0) {
+		WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit);
+	
+		return OPERATOR_CANCELLED;
+	}
+	
+	if (em->selectmode == SCE_SELECT_FACE) {
+		BMIter iter;
+
+		if (efa == NULL)
+			return OPERATOR_CANCELLED;
+
+		if (limit) {
+			/* 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! */
+				BMO_elem_flag_set(bm, e, BM_ELEM_SELECT, !BM_elem_flag_test(e, BM_ELEM_SEAM));
+			}
+		}
+
+		/* walk */
+		BMW_init(&walker, bm, BMW_ISLAND,
+		         BMW_MASK_NOP, limit ? BM_ELEM_SELECT : BMW_MASK_NOP, BMW_MASK_NOP,
+		         BMW_FLAG_TEST_HIDDEN,
+		         BMW_NIL_LAY);
+
+		e = BMW_begin(&walker, efa);
+		for (; efa; efa = BMW_step(&walker)) {
+			BM_face_select_set(bm, efa, sel);
+		}
+		BMW_end(&walker);
+	}
+	else {
+		if (efa) {
+			eed = BM_FACE_FIRST_LOOP(efa)->e;
+		}
+		else if (!eed) {
+			if (!eve || !eve->e)
+				return OPERATOR_CANCELLED;
+
+			eed = eve->e;
+		}
+
+		BMW_init(&walker, bm, BMW_SHELL,
+		         BMW_MASK_NOP, BMW_MASK_NOP, BMW_MASK_NOP,
+		         BMW_FLAG_TEST_HIDDEN,
+		         BMW_NIL_LAY);
+
+		e = BMW_begin(&walker, eed->v1);
+		for (; e; e = BMW_step(&walker)) {
+			BM_edge_select_set(bm, e, sel);
+		}
+		BMW_end(&walker);
+
+		BM_mesh_select_mode_flush(bm);
+	}
+
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit);
+	return OPERATOR_FINISHED;
+}
+
+void MESH_OT_select_linked_pick(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Select Linked";
+	ot->idname = "MESH_OT_select_linked_pick";
+	ot->description = "(De)select all vertices linked to the edge under the mouse cursor";
+	
+	/* api callbacks */
+	ot->invoke = edbm_select_linked_pick_invoke;
+	ot->poll = ED_operator_editmesh;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+	
+	RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "");
+	RNA_def_boolean(ot->srna, "limit", 0, "Limit by Seams", "");
+}
+
+
+static int edbm_select_linked_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMesh *bm = em->bm;
+	BMIter iter;
+	BMVert *v;
+	BMEdge *e;
+	BMWalker walker;
+
+	int limit;
+
+	linked_limit_default(C, op);
+
+	limit = RNA_boolean_get(op->ptr, "limit");
+
+	if (em->selectmode == SCE_SELECT_FACE) {
+		BMFace *efa;
+
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			BM_elem_flag_set(efa, BM_ELEM_TAG, (BM_elem_flag_test(efa, BM_ELEM_SELECT) &&
+			                                    !BM_elem_flag_test(efa, BM_ELEM_HIDDEN)));
+		}
+
+		if (limit) {
+			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));
+			}
+		}
+
+		BMW_init(&walker, bm, BMW_ISLAND,
+		         BMW_MASK_NOP, limit ? BM_ELEM_SELECT : BMW_MASK_NOP, BMW_MASK_NOP,
+		         BMW_FLAG_TEST_HIDDEN,
+		         BMW_NIL_LAY);
+
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			if (BM_elem_flag_test(efa, BM_ELEM_TAG)) {
+				e = BMW_begin(&walker, efa);
+				for (; efa; efa = BMW_step(&walker)) {
+					BM_face_select_set(bm, efa, TRUE);
+				}
+			}
+		}
+		BMW_end(&walker);
+	}
+	else {
+		BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) {
+			if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
+				BM_elem_flag_enable(v, BM_ELEM_TAG);
+			}
+			else {
+				BM_elem_flag_disable(v, BM_ELEM_TAG);
+			}
+		}
+
+		BMW_init(&walker, em->bm, BMW_SHELL,
+		         BMW_MASK_NOP, BMW_MASK_NOP, BMW_MASK_NOP,
+		         BMW_FLAG_TEST_HIDDEN,
+		         BMW_NIL_LAY);
+
+		BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) {
+			if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
+				e = BMW_begin(&walker, v);
+				for (; e; e = BMW_step(&walker)) {
+					BM_vert_select_set(em->bm, e->v1, TRUE);
+					BM_vert_select_set(em->bm, e->v2, TRUE);
+				}
+			}
+		}
+		BMW_end(&walker);
+	}
+	EDBM_selectmode_flush_ex(em, SCE_SELECT_VERTEX);
+
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit);
+
+	return OPERATOR_FINISHED;
+}
+
+void MESH_OT_select_linked(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Select Linked All";
+	ot->idname = "MESH_OT_select_linked";
+	ot->description = "Select all vertices linked to the active mesh";
+	
+	/* api callbacks */
+	ot->exec = edbm_select_linked_exec;
+	ot->poll = ED_operator_editmesh;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+	
+	RNA_def_boolean(ot->srna, "limit", 0, "Limit by Seams", "");
+}
+
+/* ******************** **************** */
+
+static int edbm_select_more_exec(bContext *C, wmOperator *UNUSED(op))
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+
+	EDBM_select_more(em);
+
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit);
+	return OPERATOR_FINISHED;
+}
+
+void MESH_OT_select_more(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Select More";
+	ot->idname = "MESH_OT_select_more";
+	ot->description = "Select more vertices, edges or faces connected to initial selection";
+
+	/* api callbacks */
+	ot->exec = edbm_select_more_exec;
+	ot->poll = ED_operator_editmesh;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+static int edbm_select_less_exec(bContext *C, wmOperator *UNUSED(op))
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+
+	EDBM_select_less(em);
+
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit);
+	return OPERATOR_FINISHED;
+}
+
+void MESH_OT_select_less(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Select Less";
+	ot->idname = "MESH_OT_select_less";
+	ot->description = "Deselect vertices, edges or faces at the boundary of each selection region";
+
+	/* api callbacks */
+	ot->exec = edbm_select_less_exec;
+	ot->poll = ED_operator_editmesh;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+/* Walk all reachable elements of the same type as h_act in breadth-first
+ * order, starting from h_act. Deselects elements if the depth when they
+ * are reached is not a multiple of "nth". */
+static void walker_deselect_nth(BMEditMesh *em, int nth, int offset, BMHeader *h_act)
+{
+	BMElem *ele;
+	BMesh *bm = em->bm;
+	BMWalker walker;
+	BMIter iter;
+	int walktype = 0, itertype = 0, flushtype = 0;
+	short mask_vert = 0, mask_edge = 0, mask_face = 0;
+
+	/* No active element from which to start - nothing to do */
+	if (h_act == NULL) {
+		return;
+	}
+
+	/* Determine which type of iter, walker, and select flush to use
+	 * based on type of the elements being deselected */
+	switch (h_act->htype) {
+		case BM_VERT:
+			itertype = BM_VERTS_OF_MESH;
+			walktype = BMW_CONNECTED_VERTEX;
+			flushtype = SCE_SELECT_VERTEX;
+			mask_vert = BM_ELEM_SELECT;
+			break;
+		case BM_EDGE:
+			itertype = BM_EDGES_OF_MESH;
+			walktype = BMW_SHELL;
+			flushtype = SCE_SELECT_EDGE;
+			mask_edge = BM_ELEM_SELECT;
+			break;
+		case BM_FACE:
+			itertype = BM_FACES_OF_MESH;
+			walktype = BMW_ISLAND;
+			flushtype = SCE_SELECT_FACE;
+			mask_face = BM_ELEM_SELECT;
+			break;
+	}
+
+	/* Walker restrictions uses BMO flags, not header flags,
+	 * so transfer BM_ELEM_SELECT from HFlags onto a BMO flag layer. */
+	BMO_push(bm, NULL);
+	BM_ITER_MESH (ele, &iter, bm, itertype) {
+		if (BM_elem_flag_test(ele, BM_ELEM_SELECT)) {
+			/* BMESH_TODO, don't use 'BM_ELEM_SELECT' here, its a HFLAG only! */
+			BMO_elem_flag_enable(bm, (BMElemF *)ele, BM_ELEM_SELECT);
+		}
+	}
+
+	/* Walk over selected elements starting at active */
+	BMW_init(&walker, bm, walktype,
+	         mask_vert, mask_edge, mask_face,
+	         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 (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);
+		}
+	}
+	BMW_end(&walker);
+
+	BMO_pop(bm);
+
+	/* Flush selection up */
+	EDBM_selectmode_flush_ex(em, flushtype);
+}
+
+static void deselect_nth_active(BMEditMesh *em, BMVert **r_eve, BMEdge **r_eed, BMFace **r_efa)
+{
+	BMVert *v;
+	BMEdge *e;
+	BMFace *f;
+	BMIter iter;
+	BMEditSelection *ese;
+
+	*r_eve = NULL;
+	*r_eed = NULL;
+	*r_efa = NULL;
+
+	EDBM_selectmode_flush(em);
+	ese = (BMEditSelection *)em->bm->selected.last;
+
+	if (ese) {
+		switch (ese->htype) {
+			case BM_VERT:
+				*r_eve = (BMVert *)ese->ele;
+				return;
+			case BM_EDGE:
+				*r_eed = (BMEdge *)ese->ele;
+				return;
+			case BM_FACE:
+				*r_efa = (BMFace *)ese->ele;
+				return;
+		}
+	}
+
+	if (em->selectmode & SCE_SELECT_VERTEX) {
+		BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) {
+			if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
+				*r_eve = v;
+				return;
+			}
+		}
+	}
+	else if (em->selectmode & SCE_SELECT_EDGE) {
+		BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) {
+			if (BM_elem_flag_test(e, BM_ELEM_SELECT)) {
+				*r_eed = e;
+				return;
+			}
+		}
+	}
+	else if (em->selectmode & SCE_SELECT_FACE) {
+		f = BM_active_face_get(em->bm, TRUE);
+		if (f) {
+			*r_efa = f;
+			return;
+		}
+	}
+}
+
+static int edbm_deselect_nth(BMEditMesh *em, int nth, int offset)
+{
+	BMVert *v;
+	BMEdge *e;
+	BMFace *f;
+
+	deselect_nth_active(em, &v, &e, &f);
+
+	if (v) {
+		walker_deselect_nth(em, nth, offset, &v->head);
+		return 1;
+	}
+	else if (e) {
+		walker_deselect_nth(em, nth, offset, &e->head);
+		return 1;
+	}
+	else if (f) {
+		walker_deselect_nth(em, nth, offset, &f->head);
+		return 1;
+	}
+
+	return 0;
+}
+
+static int edbm_select_nth_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	int nth = RNA_int_get(op->ptr, "nth");
+	int offset = RNA_int_get(op->ptr, "offset");
+
+	offset = MIN2(nth, offset);
+
+	if (edbm_deselect_nth(em, nth, offset) == 0) {
+		BKE_report(op->reports, RPT_ERROR, "Mesh has no active vert/edge/face");
+		return OPERATOR_CANCELLED;
+	}
+
+	EDBM_update_generic(C, em, FALSE);
+
+	return OPERATOR_FINISHED;
+}
+
+
+void MESH_OT_select_nth(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Select Nth";
+	ot->idname = "MESH_OT_select_nth";
+	ot->description = "Select every Nth element starting from a selected vertex, edge or face";
+
+	/* api callbacks */
+	ot->exec = edbm_select_nth_exec;
+	ot->poll = ED_operator_editmesh;
+
+	/* 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);
+}
+
+void em_setup_viewcontext(bContext *C, ViewContext *vc)
+{
+	view3d_set_viewcontext(C, vc);
+	
+	if (vc->obedit) {
+		Mesh *me = vc->obedit->data;
+		vc->em = me->edit_btmesh;
+	}
+}
+
+/* poll call for mesh operators requiring a view3d context */
+int EM_view3d_poll(bContext *C)
+{
+	if (ED_operator_editmesh(C) && ED_operator_view3d_active(C))
+		return 1;
+
+	return 0;
+}
+
+
+static int edbm_select_sharp_edges_exec(bContext *C, wmOperator *op)
+{
+	/* Find edges that have exactly two neighboring faces,
+	 * check the angle between those faces, and if angle is
+	 * small enough, select the edge
+	 */
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMIter iter;
+	BMEdge *e;
+	BMLoop *l1, *l2;
+	float sharp = RNA_float_get(op->ptr, "sharpness"), angle;
+
+	sharp = DEG2RADF(sharp);
+
+	BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) {
+		if (BM_elem_flag_test(e, BM_ELEM_HIDDEN) || !e->l)
+			continue;
+
+		l1 = e->l;
+		l2 = l1->radial_next;
+
+		if (l1 == l2)
+			continue;
+
+		/* edge has exactly two neighboring faces, check angle */
+		angle = angle_normalized_v3v3(l1->f->no, l2->f->no);
+
+		if (fabsf(angle) > sharp) {
+			BM_edge_select_set(em->bm, e, TRUE);
+		}
+
+	}
+
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+
+	return OPERATOR_FINISHED;
+}
+
+void MESH_OT_edges_select_sharp(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Select Sharp Edges";
+	ot->description = "Marked selected edges as sharp";
+	ot->idname = "MESH_OT_edges_select_sharp";
+	
+	/* api callbacks */
+	ot->exec = edbm_select_sharp_edges_exec;
+	ot->poll = ED_operator_editmesh;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+	
+	/* props */
+	RNA_def_float(ot->srna, "sharpness", 1.0f, 0.01f, FLT_MAX, "sharpness", "", 1.0f, 180.0f);
+}
+
+static int edbm_select_linked_flat_faces_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMIter iter, liter, liter2;
+	BMFace *f, **stack = NULL;
+	BLI_array_declare(stack);
+	BMLoop *l, *l2;
+	float sharp = RNA_float_get(op->ptr, "sharpness");
+	int i;
+
+	sharp = (sharp * M_PI) / 180.0;
+
+	BM_ITER_MESH (f, &iter, em->bm, BM_FACES_OF_MESH) {
+		BM_elem_flag_disable(f, BM_ELEM_TAG);
+	}
+
+	BM_ITER_MESH (f, &iter, em->bm, BM_FACES_OF_MESH) {
+		if (BM_elem_flag_test(f, BM_ELEM_HIDDEN) || !BM_elem_flag_test(f, BM_ELEM_SELECT) || BM_elem_flag_test(f, BM_ELEM_TAG))
+			continue;
+
+		BLI_array_empty(stack);
+		i = 1;
+
+		BLI_array_growone(stack);
+		stack[i - 1] = f;
+
+		while (i) {
+			f = stack[i - 1];
+			i--;
+
+			BM_face_select_set(em->bm, f, TRUE);
+
+			BM_elem_flag_enable(f, BM_ELEM_TAG);
+
+			BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+				BM_ITER_ELEM (l2, &liter2, l, BM_LOOPS_OF_LOOP) {
+					float angle;
+
+					if (BM_elem_flag_test(l2->f, BM_ELEM_TAG) || BM_elem_flag_test(l2->f, BM_ELEM_HIDDEN))
+						continue;
+
+					/* edge has exactly two neighboring faces, check angle */
+					angle = angle_normalized_v3v3(f->no, l2->f->no);
+
+					/* invalidate: edge too sharp */
+					if (angle < sharp) {
+						BLI_array_growone(stack);
+						stack[i] = l2->f;
+						i++;
+					}
+				}
+			}
+		}
+	}
+
+	BLI_array_free(stack);
+
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+
+	return OPERATOR_FINISHED;
+}
+
+void MESH_OT_faces_select_linked_flat(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Select Linked Flat Faces";
+	ot->description = "Select linked faces by angle";
+	ot->idname = "MESH_OT_faces_select_linked_flat";
+	
+	/* api callbacks */
+	ot->exec = edbm_select_linked_flat_faces_exec;
+	ot->poll = ED_operator_editmesh;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+	
+	/* props */
+	RNA_def_float(ot->srna, "sharpness", 1.0f, 0.01f, FLT_MAX, "sharpness", "", 1.0f, 180.0f);
+}
+
+static int edbm_select_non_manifold_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMVert *v;
+	BMEdge *e;
+	BMIter iter;
+
+	/* Selects isolated verts, and edges that do not have 2 neighboring
+	 * faces
+	 */
+	
+	if (em->selectmode == SCE_SELECT_FACE) {
+		BKE_report(op->reports, RPT_ERROR, "Doesn't work in face selection mode");
+		return OPERATOR_CANCELLED;
+	}
+	
+	BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) {
+		if (!BM_elem_flag_test(v, BM_ELEM_HIDDEN) && !BM_vert_is_manifold(v)) {
+			BM_vert_select_set(em->bm, v, TRUE);
+		}
+	}
+	
+	BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) {
+		if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN) && !BM_edge_is_manifold(e)) {
+			BM_edge_select_set(em->bm, e, TRUE);
+		}
+	}
+
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+
+	return OPERATOR_FINISHED;
+}
+
+void MESH_OT_select_non_manifold(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Select Non Manifold";
+	ot->description = "Select all non-manifold vertices or edges";
+	ot->idname = "MESH_OT_select_non_manifold";
+	
+	/* api callbacks */
+	ot->exec = edbm_select_non_manifold_exec;
+	ot->poll = ED_operator_editmesh;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+static int edbm_select_random_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMVert *eve;
+	BMEdge *eed;
+	BMFace *efa;
+	BMIter iter;
+	float randfac =  RNA_float_get(op->ptr, "percent") / 100.0f;
+
+	BLI_srand(BLI_rand()); /* random seed */
+	
+	if (!RNA_boolean_get(op->ptr, "extend"))
+		EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+
+	if (em->selectmode & SCE_SELECT_VERTEX) {
+		BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+			if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN) && BLI_frand() < randfac) {
+				BM_vert_select_set(em->bm, eve, TRUE);
+			}
+		}
+		EDBM_selectmode_flush(em);
+	}
+	else if (em->selectmode & SCE_SELECT_EDGE) {
+		BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
+			if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && BLI_frand() < randfac) {
+				BM_edge_select_set(em->bm, eed, TRUE);
+			}
+		}
+		EDBM_selectmode_flush(em);
+	}
+	else {
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && BLI_frand() < randfac) {
+				BM_face_select_set(em->bm, efa, TRUE);
+			}
+		}
+		EDBM_selectmode_flush(em);
+	}
+	
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+	
+	return OPERATOR_FINISHED;
+}
+
+void MESH_OT_select_random(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Select Random";
+	ot->description = "Randomly select vertices";
+	ot->idname = "MESH_OT_select_random";
+
+	/* api callbacks */
+	ot->exec = edbm_select_random_exec;
+	ot->poll = ED_operator_editmesh;
+
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+	
+	/* props */
+	RNA_def_float_percentage(ot->srna, "percent", 50.f, 0.0f, 100.0f,
+	                         "Percent", "Percentage of elements to select randomly", 0.f, 100.0f);
+	RNA_def_boolean(ot->srna, "extend", 0,
+	                "Extend Selection", "Extend selection instead of deselecting everything first");
+}
+
+static int edbm_select_next_loop_exec(bContext *C, wmOperator *UNUSED(op))
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMFace *f;
+	BMVert *v;
+	BMIter iter;
+	
+	BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) {
+		BM_elem_flag_disable(v, BM_ELEM_TAG);
+	}
+	
+	BM_ITER_MESH (f, &iter, em->bm, BM_FACES_OF_MESH) {
+		BMLoop *l;
+		BMIter liter;
+		
+		BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+			if (BM_elem_flag_test(l->v, BM_ELEM_SELECT)) {
+				BM_elem_flag_enable(l->next->v, BM_ELEM_TAG);
+				BM_vert_select_set(em->bm, l->v, FALSE);
+			}
+		}
+	}
+
+	BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) {
+		if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
+			BM_vert_select_set(em->bm, v, TRUE);
+		}
+	}
+
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit);
+	return OPERATOR_FINISHED;
+}
+
+void MESH_OT_select_next_loop(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Select Next Loop";
+	ot->idname = "MESH_OT_select_next_loop";
+	ot->description = "Select next edge loop adjacent to a selected loop";
+
+	/* api callbacks */
+	ot->exec = edbm_select_next_loop_exec;
+	ot->poll = ED_operator_editmesh;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+
+static int edbm_region_to_loop_exec(bContext *C, wmOperator *UNUSED(op))
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMFace *f;
+	BMEdge *e;
+	BMIter iter;
+
+	BM_mesh_elem_hflag_disable_all(em->bm, BM_EDGE, BM_ELEM_TAG, FALSE);
+
+	BM_ITER_MESH (f, &iter, em->bm, BM_FACES_OF_MESH) {
+		BMLoop *l1, *l2;
+		BMIter liter1, liter2;
+		
+		BM_ITER_ELEM (l1, &liter1, f, BM_LOOPS_OF_FACE) {
+			int tot = 0, totsel = 0;
+			
+			BM_ITER_ELEM (l2, &liter2, l1->e, BM_LOOPS_OF_EDGE) {
+				tot++;
+				totsel += BM_elem_flag_test(l2->f, BM_ELEM_SELECT) != 0;
+			}
+			
+			if ((tot != totsel && totsel > 0) || (totsel == 1 && tot == 1))
+				BM_elem_flag_enable(l1->e, BM_ELEM_TAG);
+		}
+	}
+
+	EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+	
+	BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) {
+		if (BM_elem_flag_test(e, BM_ELEM_TAG)) {
+			BM_edge_select_set(em->bm, e, TRUE);
+		}
+	}
+
+	/* If in face-only select mode, switch to edge select mode so that
+	 * an edge-only selection is not inconsistent state */
+	if (em->selectmode == SCE_SELECT_FACE) {
+		em->selectmode = SCE_SELECT_EDGE;
+		EDBM_selectmode_set(em);
+		EDBM_selectmode_to_scene(C);
+	}
+
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+
+	return OPERATOR_FINISHED;
+}
+
+void MESH_OT_region_to_loop(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Select Boundary Loop";
+	ot->idname = "MESH_OT_region_to_loop";
+	ot->description = "Select boundary edges around the selected faces";
+
+	/* api callbacks */
+	ot->exec = edbm_region_to_loop_exec;
+	ot->poll = ED_operator_editmesh;
+
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+static int loop_find_region(BMLoop *l, int flag,
+                            SmallHash *fhash, BMFace ***region_out)
+{
+	BLI_array_declare(region);
+	BLI_array_declare(stack);
+	BMFace **region = NULL;
+	BMFace **stack = NULL;
+	BMFace *f;
+	
+	BLI_array_append(stack, l->f);
+	BLI_smallhash_insert(fhash, (uintptr_t)l->f, NULL);
+	
+	while (BLI_array_count(stack) > 0) {
+		BMIter liter1, liter2;
+		BMLoop *l1, *l2;
+		
+		f = BLI_array_pop(stack);
+		BLI_array_append(region, f);
+		
+		BM_ITER_ELEM (l1, &liter1, f, BM_LOOPS_OF_FACE) {
+			if (BM_elem_flag_test(l1->e, flag))
+				continue;
+			
+			BM_ITER_ELEM (l2, &liter2, l1->e, BM_LOOPS_OF_EDGE) {
+				if (BLI_smallhash_haskey(fhash, (uintptr_t)l2->f))
+					continue;
+				
+				BLI_array_append(stack, l2->f);
+				BLI_smallhash_insert(fhash, (uintptr_t)l2->f, NULL);
+			}
+		}
+	}
+	
+	BLI_array_free(stack);
+	
+	*region_out = region;
+	return BLI_array_count(region);
+}
+
+static int verg_radial(const void *va, const void *vb)
+{
+	BMEdge *e1 = *((void **)va);
+	BMEdge *e2 = *((void **)vb);
+	int a, b;
+	
+	a = BM_edge_face_count(e1);
+	b = BM_edge_face_count(e2);
+	
+	if (a > b)  return -1;
+	if (a == b) return  0;
+	if (a < b)  return  1;
+	
+	return -1;
+}
+
+static int loop_find_regions(BMEditMesh *em, int selbigger)
+{
+	SmallHash visithash;
+	BMIter iter;
+	BMEdge *e, **edges = NULL;
+	BLI_array_declare(edges);
+	BMFace *f;
+	int count = 0, i;
+	
+	BLI_smallhash_init(&visithash);
+	
+	BM_ITER_MESH (f, &iter, em->bm, BM_FACES_OF_MESH) {
+		BM_elem_flag_disable(f, BM_ELEM_TAG);
+	}
+
+	BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) {
+		if (BM_elem_flag_test(e, BM_ELEM_SELECT)) {
+			BLI_array_append(edges, e);
+			BM_elem_flag_enable(e, BM_ELEM_TAG);
+		}
+		else {
+			BM_elem_flag_disable(e, BM_ELEM_TAG);
+		}
+	}
+	
+	/* sort edges by radial cycle length */
+	qsort(edges,  BLI_array_count(edges), sizeof(void *), verg_radial);
+	
+	for (i = 0; i < BLI_array_count(edges); i++) {
+		BMIter liter;
+		BMLoop *l;
+		BMFace **region = NULL, **region_out;
+		int c, tot = 0;
+		
+		e = edges[i];
+		
+		if (!BM_elem_flag_test(e, BM_ELEM_TAG))
+			continue;
+		
+		BM_ITER_ELEM (l, &liter, e, BM_LOOPS_OF_EDGE) {
+			if (BLI_smallhash_haskey(&visithash, (uintptr_t)l->f))
+				continue;
+						
+			c = loop_find_region(l, BM_ELEM_SELECT, &visithash, &region_out);
+
+			if (!region || (selbigger ? c >= tot : c < tot)) {
+				/* this region is the best seen so far */
+				tot = c;
+				if (region) {
+					/* free the previous best */
+					MEM_freeN(region);
+				}
+				/* track the current region as the new best */
+				region = region_out;
+			}
+			else {
+				/* this region is not as good as best so far, just free it */
+				MEM_freeN(region_out);
+			}
+		}
+		
+		if (region) {
+			int j;
+			
+			for (j = 0; j < tot; j++) {
+				BM_elem_flag_enable(region[j], BM_ELEM_TAG);
+				BM_ITER_ELEM (l, &liter, region[j], BM_LOOPS_OF_FACE) {
+					BM_elem_flag_disable(l->e, BM_ELEM_TAG);
+				}
+			}
+			
+			count += tot;
+			
+			MEM_freeN(region);
+		}
+	}
+	
+	BLI_array_free(edges);
+	BLI_smallhash_release(&visithash);
+	
+	return count;
+}
+
+static int edbm_loop_to_region_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMIter iter;
+	BMFace *f;
+	int selbigger = RNA_boolean_get(op->ptr, "select_bigger");
+	int a, b;
+
+	/* find the set of regions with smallest number of total faces */
+	a = loop_find_regions(em, selbigger);
+	b = loop_find_regions(em, !selbigger);
+	
+	if ((a <= b) ^ selbigger) {
+		loop_find_regions(em, selbigger);
+	}
+	
+	EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+	
+	BM_ITER_MESH (f, &iter, em->bm, BM_FACES_OF_MESH) {
+		if (BM_elem_flag_test(f, BM_ELEM_TAG) && !BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
+			BM_face_select_set(em->bm, f, TRUE);
+		}
+	}
+	
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+	return OPERATOR_FINISHED;
+}
+
+void MESH_OT_loop_to_region(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Select Loop Inner-Region";
+	ot->idname = "MESH_OT_loop_to_region";
+	ot->description = "Select region of faces inside of a selected loop of edges";
+
+	/* api callbacks */
+	ot->exec = edbm_loop_to_region_exec;
+	ot->poll = ED_operator_editmesh;
+
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+	
+	RNA_def_boolean(ot->srna, "select_bigger", 0, "Select Bigger", "Select bigger regions instead of smaller ones");
+}
diff --git a/source/blender/editors/mesh/editmesh_slide.c b/source/blender/editors/mesh/editmesh_slide.c
new file mode 100644
index 0000000..3cbb099
--- /dev/null
+++ b/source/blender/editors/mesh/editmesh_slide.c
@@ -0,0 +1,741 @@
+/*
+ * ***** 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): Francisco De La Cruz
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/editors/mesh/editmesh_slide.c
+ *  \ingroup edmesh
+ */
+
+/* Takes heavily from editmesh_loopcut.c */
+
+#include "DNA_object_types.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_array.h"
+#include "BLI_math.h"
+
+#include "BKE_context.h"
+#include "BKE_report.h"
+#include "BKE_tessmesh.h"
+
+#include "BIF_gl.h"
+#include "BIF_glutil.h"
+
+#include "ED_screen.h"
+#include "ED_view3d.h"
+#include "ED_mesh.h"
+#include "ED_space_api.h"
+
+#include "UI_resources.h"
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "mesh_intern.h"
+
+#define VTX_SLIDE_SNAP_THRSH 15
+
+/* Cusom VertexSlide Operator data */
+typedef struct VertexSlideOp {
+	/* Starting Vertex */
+	BMVert *start_vtx;
+	BMEdge *sel_edge;
+
+	ViewContext *view_context;
+	ARegion *active_region;
+
+	/* Draw callback handle */
+	void *draw_handle;
+
+	/* Active Object */
+	Object *obj;
+
+	/* Are we in slide mode */
+	int slide_mode;
+	int snap_n_merge;
+	int snap_to_end_vtx;
+	int snap_to_mid;
+
+	/* Snap threshold */
+	float snap_threshold;
+
+	float distance;
+	float interp[3];
+
+	/* Edge Frame Count */
+	int disk_edges;
+
+	/* Edges */
+	BMEdge** edge_frame;
+
+	/* Slide Frame Endpoints */
+	float (*vtx_frame)[3];
+
+	/* Mouse Click 2d pos */
+	int m_co[2];
+
+} VertexSlideOp;
+
+static void vtx_slide_draw(const bContext *C, ARegion *ar, void *arg);
+static int edbm_vertex_slide_exec(bContext *C, wmOperator *op);
+static void vtx_slide_exit(const bContext *C, wmOperator *op);
+static int vtx_slide_set_frame(VertexSlideOp *vso);
+
+static int vtx_slide_init(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMEditSelection *ese;
+
+	/* 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";
+
+	if (!obedit) {
+		BKE_report(op->reports, RPT_ERROR, "Vertex Slide Error: Not object in context");
+		return FALSE;
+	}
+
+	EDBM_selectmode_flush(em);
+	ese = em->bm->selected.last;
+
+	/* 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");
+		return FALSE;
+	}
+
+	vso = MEM_callocN(sizeof(VertexSlideOp), "Vertex Slide Operator");
+	vso->view_context = MEM_callocN(sizeof(ViewContext), "Vertex Slide View Context");
+
+	op->customdata = vso;
+
+	/* Set the start vertex */
+	vso->start_vtx = (BMVert *)ese->ele;
+
+	vso->sel_edge = NULL;
+
+	/* Edges */
+	vso->edge_frame = NULL;
+
+	vso->vtx_frame = NULL;
+
+	vso->disk_edges = 0;
+
+	vso->slide_mode = FALSE;
+
+	vso->snap_n_merge = FALSE;
+
+	vso->snap_to_end_vtx = FALSE;
+
+	vso->snap_to_mid = FALSE;
+
+	vso->distance = 0.0f;
+
+	vso->snap_threshold = 0.2f;
+
+	/* Notify the viewport */
+	view3d_operator_needs_opengl(C);
+
+	/* Set the drawing region */
+	vso->active_region = CTX_wm_region(C);
+
+	/* Set the draw callback */
+	vso->draw_handle = ED_region_draw_cb_activate(vso->active_region->type, vtx_slide_draw, vso, REGION_DRAW_POST_VIEW);
+
+	ED_area_headerprint(CTX_wm_area(C), header_str);
+	
+	em_setup_viewcontext(C, vso->view_context);
+
+	/* Set the object */
+	vso->obj = obedit;
+
+	/* Init frame */
+	if (!vtx_slide_set_frame(vso)) {
+		BKE_report(op->reports, RPT_ERROR_INVALID_INPUT, "Vertex Slide: Can't find starting vertex!");
+		vtx_slide_exit(C, op);
+		return FALSE;
+	}
+
+	/* Add handler for the vertex sliding */
+	WM_event_add_modal_handler(C, op);
+
+	/* Tag for redraw */
+	ED_region_tag_redraw(vso->active_region);
+
+	return TRUE;
+}
+
+static void vtx_slide_confirm(bContext *C, wmOperator *op)
+{
+	VertexSlideOp *vso = op->customdata;
+	BMEditMesh *em = BMEdit_FromObject(vso->obj);
+	BMesh* bm = em->bm;
+
+	/* Select new edge */
+	BM_edge_select_set(bm, vso->sel_edge, TRUE);
+
+	/* Invoke operator */
+	edbm_vertex_slide_exec(C, op);
+
+	if (vso->snap_n_merge) {
+		float other_d;
+		BMVert* other = BM_edge_other_vert(vso->sel_edge, vso->start_vtx);
+		other_d = len_v3v3(vso->interp, other->co);
+
+		/* Only snap if within threshold */
+		if (other_d < vso->snap_threshold) {
+			BM_vert_select_set(bm, other, TRUE);
+			BM_vert_select_set(bm, vso->start_vtx, TRUE);
+			EDBM_op_callf(em, op, "pointmerge verts=%hv mergeco=%v", BM_ELEM_SELECT, other->co);
+			EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+		}
+		else {
+			/* Store in historty if not merging */
+			BM_select_history_store(em->bm, vso->start_vtx);
+		}
+	}
+	else {
+		/* Store edit selection of the active vertex, allows other
+		 *  ops to run without reselecting */
+		BM_select_history_store(em->bm, vso->start_vtx);
+	}
+
+	EDBM_selectmode_flush(em);
+	
+	/* NC_GEOM | ND_DATA & Retess */
+	EDBM_update_generic(C, em, TRUE);
+	
+	ED_region_tag_redraw(vso->active_region);
+}
+
+static void vtx_slide_exit(const bContext *C, wmOperator *op)
+{
+	/* Fetch custom data */
+	VertexSlideOp *vso = op->customdata;
+
+	/* Clean-up the custom data */
+	ED_region_draw_cb_exit(vso->active_region->type, vso->draw_handle);
+
+	/* Free Custom Data
+	 *
+	 */
+	MEM_freeN(vso->view_context);
+
+	vso->view_context = NULL;
+
+	if (vso->edge_frame) {
+		MEM_freeN(vso->edge_frame);
+	}
+
+	if (vso->vtx_frame) {
+		MEM_freeN(vso->vtx_frame);
+	}
+
+	vso->edge_frame = NULL;
+
+	vso->vtx_frame = NULL;
+
+	vso->slide_mode = FALSE;
+
+	MEM_freeN(vso);
+	vso = NULL;
+	op->customdata = NULL;
+
+	/* Clear the header */
+	ED_area_headerprint(CTX_wm_area(C), NULL);
+}
+
+static void vtx_slide_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
+{
+	VertexSlideOp *vso = arg;
+
+	/* Have an edge to draw */
+	if (vso && vso->sel_edge) {
+		/* Get 3d view */
+		View3D *view3d = CTX_wm_view3d(C);
+		const float outline_w = UI_GetThemeValuef(TH_OUTLINE_WIDTH) + 0.8f;
+		const float pt_size = UI_GetThemeValuef(TH_FACEDOT_SIZE) + 1.5;
+
+		int i = 0;
+
+		if (view3d && view3d->zbuf)
+			glDisable(GL_DEPTH_TEST);
+
+		glPushAttrib(GL_CURRENT_BIT | GL_LINE_BIT | GL_POINT_BIT);
+
+		glPushMatrix();
+		glMultMatrixf(vso->obj->obmat);
+
+		glEnable(GL_BLEND);
+		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+			
+
+		if (vso->slide_mode && vso->disk_edges > 0) {
+			/* Draw intermediate edge frame */
+			UI_ThemeColorShadeAlpha(TH_EDGE_SELECT, 50, -50);
+
+			for (i = 0; i < vso->disk_edges; i++) {
+				glBegin(GL_LINES);
+				glVertex3fv(vso->vtx_frame[i]);
+				glVertex3fv(vso->interp);
+				glEnd();
+			}
+		}
+
+		/* Draw selected edge
+		 * Add color offset and reduce alpha */
+		UI_ThemeColorShadeAlpha(TH_EDGE_SELECT, 40, -50);
+
+		glLineWidth(outline_w);
+
+		glBegin(GL_LINES);
+		bglVertex3fv(vso->sel_edge->v1->co);
+		bglVertex3fv(vso->sel_edge->v2->co);
+		glEnd();
+
+		if (vso->slide_mode) {
+			/* Draw interpolated vertex */
+			
+			UI_ThemeColorShadeAlpha(TH_FACE_DOT, -80, -50);
+
+			glPointSize(pt_size);
+
+			bglBegin(GL_POINTS);
+			bglVertex3fv(vso->interp);
+			bglEnd();
+		}
+
+		glDisable(GL_BLEND);
+		glPopMatrix();
+		glPopAttrib();
+
+		if (view3d && view3d->zbuf)
+			glEnable(GL_DEPTH_TEST);
+	}
+}
+
+static BMEdge* vtx_slide_nrst_in_frame(VertexSlideOp *vso, const float mval[2])
+{
+	BMEdge* cl_edge = NULL;
+	if (vso->disk_edges > 0) {
+		int i = 0;
+		BMEdge* edge = NULL;
+		
+		float v1_proj[3], v2_proj[3];
+		float dist = 0;
+		float min_dist = FLT_MAX;
+
+		for (i = 0; i < vso->disk_edges; i++) {
+			edge = vso->edge_frame[i];
+
+			mul_v3_m4v3(v1_proj, vso->obj->obmat, edge->v1->co);
+			project_float_noclip(vso->active_region, v1_proj, v1_proj);
+
+			mul_v3_m4v3(v2_proj, vso->obj->obmat, edge->v2->co);
+			project_float_noclip(vso->active_region, v2_proj, v2_proj);
+
+			dist = dist_to_line_segment_v2(mval, v1_proj, v2_proj);
+			if (dist < min_dist) {
+				min_dist = dist;
+				cl_edge = edge;
+			}
+		}
+	}
+	return cl_edge;
+}
+
+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]};
+
+	/* Set mouse coords */
+	copy_v2_v2_int(vso->view_context->mval, event->mval);
+
+	/* Find nearest edge */
+	nst_edge = vtx_slide_nrst_in_frame(vso, mval_float);
+
+	if (nst_edge) {
+		/* Find a connected edge */
+		if (BM_vert_in_edge(nst_edge, vso->start_vtx)) {
+
+			/* Save mouse coords */
+			copy_v2_v2_int(vso->m_co, event->mval);
+
+			/* Set edge */
+			vso->sel_edge = nst_edge;
+		}
+	}
+}
+
+/* Updates the status of the operator - Invoked on mouse movement */
+static void vtx_slide_update(VertexSlideOp *vso, wmEvent *event)
+{
+	BMEdge *edge;
+
+	/* Find nearest edge */
+	edge = vso->sel_edge;
+
+	if (edge) {
+		float edge_other_proj[3];
+		float start_vtx_proj[3];
+		float edge_len;
+		BMVert *other;
+
+		float interp[3];
+
+		/* Calculate interpolation value for preview */
+		float t_val;
+
+		float mval_float[] = { (float)event->mval[0], (float)event->mval[1]};
+		float closest_2d[2];
+
+		other = BM_edge_other_vert(edge, vso->start_vtx);
+
+		/* Project points onto screen and do interpolation in 2D */
+		mul_v3_m4v3(start_vtx_proj, vso->obj->obmat, vso->start_vtx->co);
+		project_float_noclip(vso->active_region, start_vtx_proj, start_vtx_proj);
+
+		mul_v3_m4v3(edge_other_proj, vso->obj->obmat, other->co);
+		project_float_noclip(vso->active_region, edge_other_proj, edge_other_proj);
+
+		closest_to_line_v2(closest_2d, mval_float, start_vtx_proj, edge_other_proj);
+
+		t_val = line_point_factor_v2(closest_2d, start_vtx_proj, edge_other_proj);
+
+		/* Set snap threshold to be proportional to edge length */
+		edge_len = len_v3v3(start_vtx_proj, edge_other_proj);
+		
+		if (edge_len <= 0.0f)
+			edge_len = VTX_SLIDE_SNAP_THRSH;
+
+		edge_len =  (len_v3v3(edge->v1->co, edge->v2->co) * VTX_SLIDE_SNAP_THRSH) / edge_len;
+
+		vso->snap_threshold =  edge_len;
+
+		/* Snap to mid */
+		if (vso->snap_to_mid) {
+			t_val = 0.5f;
+		}
+
+		/* Interpolate preview vertex 3D */
+		interp_v3_v3v3(interp, vso->start_vtx->co, other->co, t_val);
+		copy_v3_v3(vso->interp, interp);
+
+		vso->distance = t_val;
+
+		/* If snapping */
+		if (vso->snap_to_end_vtx) {
+			int start_at_v1 = edge->v1 == vso->start_vtx;
+			float v1_d = len_v3v3(vso->interp, edge->v1->co);
+			float v2_d = len_v3v3(vso->interp, edge->v2->co);
+
+			if (v1_d > v2_d && v2_d < vso->snap_threshold) {
+				copy_v3_v3(vso->interp, edge->v2->co);
+
+				if (start_at_v1)
+					vso->distance = 1.0f;
+				else
+					vso->distance = 0.0f;
+			}
+			if (v2_d > v1_d && v1_d < vso->snap_threshold) {
+				copy_v3_v3(vso->interp, edge->v1->co);
+				if (start_at_v1)
+					vso->distance = 0.0f;
+				else
+					vso->distance = 1.0f;
+			}
+		}
+	}
+}
+
+/* Sets the outline frame */
+static int vtx_slide_set_frame(VertexSlideOp *vso)
+{
+	BMEdge *edge;
+	float (*vtx_frame)[3] = NULL;
+	BMEdge** edge_frame = NULL;
+	BMVert *curr_vert = NULL;
+	BLI_array_declare(vtx_frame);
+	BLI_array_declare(edge_frame);
+	BMIter iter;
+	BMVert *sel_vtx = vso->start_vtx;
+	int idx = 0;
+
+	vso->disk_edges = 0;
+
+	if (vso->edge_frame) {
+		MEM_freeN(vso->edge_frame);
+		vso->edge_frame = NULL;
+	}
+
+	if (vso->vtx_frame) {
+		MEM_freeN(vso->vtx_frame);
+		vso->vtx_frame = NULL;
+	}
+
+	/* Iterate over edges of vertex and copy them */
+	BM_ITER_ELEM_INDEX (edge, &iter, sel_vtx, BM_EDGES_OF_VERT, idx) {
+		curr_vert = BM_edge_other_vert(edge, sel_vtx);
+		if (curr_vert) {
+			BLI_array_growone(vtx_frame);
+
+			copy_v3_v3(vtx_frame[idx], curr_vert->co);
+
+			BLI_array_append(edge_frame, edge);
+			vso->disk_edges++;
+		}
+	}
+
+	vso->edge_frame = edge_frame;
+	vso->vtx_frame = vtx_frame;
+
+	/* Set the interp at starting vtx */
+	copy_v3_v3(vso->interp, sel_vtx->co);
+
+	return vso->disk_edges > 0;
+}
+
+static int edbm_vertex_slide_modal(bContext *C, wmOperator *op, wmEvent *event)
+{
+	VertexSlideOp *vso = op->customdata;
+	char buff[128];
+
+	if (!vso)
+		return OPERATOR_CANCELLED;
+
+	/* Notify the viewport */
+	view3d_operator_needs_opengl(C);
+
+	switch (event->type) {
+		case LEFTSHIFTKEY:
+		{
+			switch (event->val) {
+				case KM_PRESS:
+					vso->snap_to_mid = TRUE;
+					break;
+				case KM_RELEASE:
+					vso->snap_to_mid = FALSE;
+					break;
+			}
+
+			break;
+		}
+		case LEFTCTRLKEY:
+		{
+			switch (event->val) {
+				case KM_PRESS:
+					vso->snap_n_merge = TRUE;
+					vso->snap_to_end_vtx = TRUE;
+					break;
+				case KM_RELEASE:
+					vso->snap_n_merge = FALSE;
+					vso->snap_to_end_vtx = FALSE;
+					break;
+			}
+
+			break;
+		}
+		case LEFTALTKEY:
+		{
+			switch (event->val) {
+				case KM_PRESS:
+					vso->snap_to_end_vtx = TRUE;
+					break;
+				case KM_RELEASE:
+					vso->snap_to_end_vtx = FALSE;
+					break;
+			}
+
+			break;
+		}
+		case RIGHTMOUSE:
+		{
+			/* Enforce redraw */
+			ED_region_tag_redraw(vso->active_region);
+
+			/* Clean-up */
+			vtx_slide_exit(C, op);
+
+			return OPERATOR_CANCELLED;
+		}
+		case LEFTMOUSE:
+		{
+			if (event->val == KM_PRESS) {
+				/* Update mouse coords */
+				copy_v2_v2_int(vso->m_co, event->mval);
+
+				if (vso->slide_mode) {
+					vtx_slide_confirm(C, op);
+					/* Clean-up */
+					vtx_slide_exit(C, op);
+					return OPERATOR_FINISHED;
+				}
+				else if (vso->sel_edge) {
+					vso->slide_mode = TRUE;
+				}
+			}
+
+			ED_region_tag_redraw(vso->active_region);
+			break;
+
+		}
+		case MOUSEMOVE:
+		{
+			sprintf(buff, "Vertex Slide: %f", vso->distance);
+			if (!vso->slide_mode) {
+				vtx_slide_find_edge(vso, event);
+			}
+			else {
+				vtx_slide_update(vso, event);
+			}
+			ED_area_headerprint(CTX_wm_area(C), buff);
+			ED_region_tag_redraw(vso->active_region);
+			break;
+		}
+	}
+
+	return OPERATOR_RUNNING_MODAL;
+}
+
+static int edbm_vertex_slide_cancel(bContext *C, wmOperator *op)
+{
+	/* Exit the modal */
+	vtx_slide_exit(C, op);
+
+	return OPERATOR_CANCELLED;
+}
+
+static int edbm_vertex_slide_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+{
+	/* Initialize the operator */
+	if (vtx_slide_init(C, op))
+		return OPERATOR_RUNNING_MODAL;
+	else
+		return OPERATOR_CANCELLED;
+}
+
+/* Vertex Slide */
+static int edbm_vertex_slide_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMesh *bm = em->bm;
+	BMVert *start_vert;
+	BMOperator bmop;
+	BMEditSelection *ese = (BMEditSelection *)em->bm->selected.last;
+
+	float distance_t = 0.0f;
+
+	/* Invoked modally? */
+	if (op->type->modal == edbm_vertex_slide_modal && op->customdata) {
+		VertexSlideOp *vso = (VertexSlideOp *)op->customdata;
+
+		if (bm->totedgesel > 1) {
+			/* Reset selections */
+			EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+			BM_edge_select_set(bm, vso->sel_edge, TRUE);
+			BM_vert_select_set(bm, vso->start_vtx, TRUE);
+
+			BM_select_history_store(em->bm, vso->sel_edge);
+			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);
+	}
+	else {
+		/* Get Properties */
+		distance_t = RNA_float_get(op->ptr, "distance_t");
+	}
+
+	/* 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");
+		return OPERATOR_CANCELLED;
+	}
+
+	start_vert = (BMVert *)ese->ele;
+
+	/* Prepare operator */
+	if (!EDBM_op_init(em, &bmop, op,
+	                  "vertex_slide vert=%e edge=%hev distance_t=%f",
+	                  start_vert, BM_ELEM_SELECT, distance_t))
+	{
+		return OPERATOR_CANCELLED;
+	}
+	/* Execute operator */
+	BMO_op_exec(bm, &bmop);
+
+	/* Deselect the input edges */
+	BMO_slot_buffer_hflag_disable(bm, &bmop, "edge", BM_ALL, BM_ELEM_SELECT, TRUE);
+
+	/* Select the output vert */
+	BMO_slot_buffer_hflag_enable(bm, &bmop, "vertout", BM_ALL, BM_ELEM_SELECT, TRUE);
+
+	/* Flush the select buffers */
+	EDBM_selectmode_flush(em);
+
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+		return OPERATOR_CANCELLED;
+	}
+
+	/* Update Geometry */
+	EDBM_update_generic(C, em, TRUE);
+
+	return OPERATOR_FINISHED;
+}
+
+void MESH_OT_vert_slide(wmOperatorType *ot)
+{
+	PropertyRNA *prop;
+
+	/* identifiers */
+	ot->name = "Vertex Slide";
+	ot->idname = "MESH_OT_vert_slide";
+	ot->description = "Vertex slide";
+
+	/* api callback */
+	ot->invoke = edbm_vertex_slide_invoke;
+	ot->modal = edbm_vertex_slide_modal;
+	ot->cancel = edbm_vertex_slide_cancel;
+	ot->poll = ED_operator_editmesh_region_view3d;
+
+	/* ot->exec = edbm_vertex_slide_exec;
+	 * ot->poll = ED_operator_editmesh; */
+
+	/* flags */
+	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);
+	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 71b37be..f373792 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -20,7 +20,7 @@
  *
  * The Original Code is: all of this file.
  *
- * Contributor(s): Johnny Matthews, Geoffrey Bantle.
+ * Contributor(s): Joseph Eagar
  *
  * ***** END GPL LICENSE BLOCK *****
  */
@@ -29,6328 +29,3720 @@
  *  \ingroup edmesh
  */
 
+#include "MEM_guardedalloc.h"
 
-/*
-
-editmesh_tool.c: UI called tools for editmesh, geometry changes here, otherwise in mods.c
-
-*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <float.h>
-
-#include "BLO_sys_types.h" // for intptr_t support
-
-#include "DNA_meshdata_types.h"
+#include "DNA_material_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_modifier_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
-#include "DNA_key_types.h"
-
-#include "MEM_guardedalloc.h"
 
 #include "RNA_define.h"
 #include "RNA_access.h"
 
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
-#include "BLI_utildefines.h"
-#include "BLI_editVert.h"
 #include "BLI_rand.h"
-#include "BLI_ghash.h"
-#include "BLI_linklist.h"
-#include "BLI_heap.h"
-#include "BLI_scanfill.h"
 
+#include "BKE_material.h"
 #include "BKE_context.h"
+#include "BKE_cdderivedmesh.h"
 #include "BKE_depsgraph.h"
-#include "BKE_global.h"
-#include "BKE_key.h"
-#include "BKE_mesh.h"
-#include "BKE_bmesh.h"
+#include "BKE_object.h"
 #include "BKE_report.h"
-
+#include "BKE_texture.h"
+#include "BKE_main.h"
+#include "BKE_tessmesh.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
 
 #include "ED_mesh.h"
+#include "ED_object.h"
 #include "ED_screen.h"
 #include "ED_transform.h"
+#include "ED_uvedit.h"
 #include "ED_view3d.h"
-#include "ED_object.h"
 
+#include "RE_render_ext.h"
 
 #include "mesh_intern.h"
 
-/* XXX */
-static void waitcursor(int UNUSED(val)) {}
-#define add_numbut(a, b, c, d, e, f, g) {}
-
-/* XXX */
-
-/* RNA corner cut enum property - used in multiple files for tools
- * that need this property for esubdivideflag() */
-EnumPropertyItem corner_type_items[] = {
-	{SUBDIV_CORNER_PATH,  "PATH", 0, "Path", ""},
-	{SUBDIV_CORNER_INNERVERT,  "INNER_VERTEX", 0, "Inner Vertex", ""},
-	{SUBDIV_CORNER_FAN,  "FAN",  0, "Fan", ""},
-	{0, NULL, 0, NULL, NULL}};
-
-
-/* local prototypes ---------------*/
-static void free_tagged_edges_faces(EditMesh *em, EditEdge *eed, EditFace *efa);
-int EdgeLoopDelete(EditMesh *em, wmOperator *op);
-
-/********* qsort routines *********/
-
-
-typedef struct xvertsort {
-	float x;
-	EditVert *v1;
-} xvertsort;
-
-static int vergxco(const void *v1, const void *v2)
+/* 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])
 {
-	const xvertsort *x1=v1, *x2=v2;
-
-	if( x1->x > x2->x ) return 1;
-	else if( x1->x < x2->x) return -1;
-	return 0;
+	if (dot_v3v3(nor, add) < -0.9999f) {
+		sub_v3_v3(nor, add);
+	}
+	else {
+		add_v3_v3(nor, add);
+	}
 }
 
-struct facesort {
-	uintptr_t x;
-	struct EditFace *efa;
-};
+static int edbm_subdivide_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	int cuts = RNA_int_get(op->ptr, "number_cuts");
+	float smooth = 0.292f * RNA_float_get(op->ptr, "smoothness");
+	float fractal = RNA_float_get(op->ptr, "fractal") / 2.5f;
 
+	if (RNA_boolean_get(op->ptr, "quadtri") && 
+	    RNA_enum_get(op->ptr, "quadcorner") == SUBD_STRAIGHT_CUT)
+	{
+		RNA_enum_set(op->ptr, "quadcorner", SUBD_INNERVERT);
+	}
+	
+	BM_mesh_esubdivide(em->bm, BM_ELEM_SELECT,
+	                   smooth, fractal,
+	                   cuts,
+	                   SUBDIV_SELECT_ORIG, RNA_enum_get(op->ptr, "quadcorner"),
+	                   RNA_boolean_get(op->ptr, "quadtri"), TRUE,
+	                   RNA_int_get(op->ptr, "seed"));
 
-static int vergface(const void *v1, const void *v2)
-{
-	const struct facesort *x1=v1, *x2=v2;
+	EDBM_update_generic(C, em, TRUE);
 
-	if( x1->x > x2->x ) return 1;
-	else if( x1->x < x2->x) return -1;
-	return 0;
+	return OPERATOR_FINISHED;
 }
 
+/* Note, these values must match delete_mesh() event values */
+static EnumPropertyItem prop_mesh_cornervert_types[] = {
+	{SUBD_INNERVERT,     "INNERVERT", 0,      "Inner Vert", ""},
+	{SUBD_PATH,          "PATH", 0,           "Path", ""},
+	{SUBD_STRAIGHT_CUT,  "STRAIGHT_CUT", 0,   "Straight Cut", ""},
+	{SUBD_FAN,           "FAN", 0,            "Fan", ""},
+	{0, NULL, 0, NULL, NULL}
+};
 
-/* *********************************** */
-
-static void convert_to_triface(EditMesh *em, int direction)
+void MESH_OT_subdivide(wmOperatorType *ot)
 {
-	EditFace *efa, *efan, *next;
-	float fac;
-
-	efa= em->faces.last;
-	while(efa) {
-		next= efa->prev;
-		if(efa->v4) {
-			if(efa->f & SELECT) {
-				/* choose shortest diagonal for split */
-				fac= len_v3v3(efa->v1->co, efa->v3->co) - len_v3v3(efa->v2->co, efa->v4->co);
-				/* this makes sure exact squares get split different in both cases */
-				if( (direction==0 && fac<FLT_EPSILON) || (direction && fac>0.0f) ) {
-					efan= EM_face_from_faces(em, efa, NULL, 0, 1, 2, -1);
-					if(efa->f & SELECT) EM_select_face(efan, 1);
-					efan= EM_face_from_faces(em, efa, NULL, 0, 2, 3, -1);
-					if(efa->f & SELECT) EM_select_face(efan, 1);
-				}
-				else {
-					efan= EM_face_from_faces(em, efa, NULL, 0, 1, 3, -1);
-					if(efa->f & SELECT) EM_select_face(efan, 1);
-					efan= EM_face_from_faces(em, efa, NULL, 1, 2, 3, -1);
-					if(efa->f & SELECT) EM_select_face(efan, 1);
-				}
-
-				BLI_remlink(&em->faces, efa);
-				free_editface(em, efa);
-			}
-		}
-		efa= next;
-	}
-
-	EM_fgon_flags(em);	// redo flags and indices for fgons
+	PropertyRNA *prop;
 
+	/* identifiers */
+	ot->name = "Subdivide";
+	ot->description = "Subdivide selected edges";
+	ot->idname = "MESH_OT_subdivide";
 
-}
+	/* api callbacks */
+	ot->exec = edbm_subdivide_exec;
+	ot->poll = ED_operator_editmesh;
 
-int removedoublesflag(EditMesh *em, short flag, short automerge, float limit)		/* return amount */
-{
-	/*
-		flag -		Test with vert->flags
-		automerge -	Alternative operation, merge unselected into selected.
-					Used for "Auto Weld" mode. warning.
-		limit -		Quick manhattan distance between verts.
-	*/
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-	/* all verts with (flag & 'flag') are being evaluated */
-	EditVert *eve, *v1, *nextve;
-	EditEdge *eed, *e1, *nexted;
-	EditFace *efa, *nextvl;
-	xvertsort *sortblock, *sb, *sb1;
-	struct facesort *vlsortblock, *vsb, *vsb1;
-	int a, b, test, amount;
+	/* properties */
+	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);
 
+	RNA_def_float(ot->srna, "smoothness", 0.0f, 0.0f, FLT_MAX, "Smoothness", "Smoothness factor", 0.0f, 1.0f);
 
-	/* flag 128 is cleared, count */
+	RNA_def_boolean(ot->srna, "quadtri", 0, "Quad/Tri Mode", "Tries to prevent ngons");
+	RNA_def_enum(ot->srna, "quadcorner", prop_mesh_cornervert_types, SUBD_STRAIGHT_CUT,
+	             "Quad Corner Type", "How to subdivide quad corners (anything other than Straight Cut will prevent ngons)");
 
-	/* Normal non weld operation */
-	eve= em->verts.first;
-	amount= 0;
-	while(eve) {
-		eve->f &= ~128;
-		if(eve->h==0 && (automerge || (eve->f & flag))) amount++;
-		eve= eve->next;
-	}
-	if(amount==0) return 0;
+	RNA_def_float(ot->srna, "fractal", 0.0f, 0.0f, FLT_MAX, "Fractal", "Fractal randomness factor", 0.0f, 1000.0f);
+	RNA_def_int(ot->srna, "seed", 0, 0, 10000, "Random Seed", "Seed for the random number generator", 0, 50);
+}
 
-	/* allocate memory and qsort */
-	sb= sortblock= MEM_mallocN(sizeof(xvertsort)*amount,"sortremovedoub");
-	eve= em->verts.first;
-	while(eve) {
-		if(eve->h==0 && (automerge || (eve->f & flag))) {
-			sb->x= eve->co[0]+eve->co[1]+eve->co[2];
-			sb->v1= eve;
-			sb++;
-		}
-		eve= eve->next;
-	}
-	qsort(sortblock, amount, sizeof(xvertsort), vergxco);
-
-
-	/* test for doubles */
-	sb= sortblock;
-	if (automerge) {
-		for(a=0; a<amount; a++, sb++) {
-			eve= sb->v1;
-			if( (eve->f & 128)==0 ) {
-				sb1= sb+1;
-				for(b=a+1; b<amount && (eve->f & 128)==0; b++, sb1++) {
-					if(sb1->x - sb->x > limit) break;
-
-					/* when automarge, only allow unselected->selected */
-					v1= sb1->v1;
-					if( (v1->f & 128)==0 ) {
-						if ((eve->f & flag)==0 && (v1->f & flag)==1) {
-							if(	(float)fabs(v1->co[0]-eve->co[0])<=limit &&
-								(float)fabs(v1->co[1]-eve->co[1])<=limit &&
-								(float)fabs(v1->co[2]-eve->co[2])<=limit)
-							{	/* unique bit */
-								eve->f|= 128;
-								eve->tmp.v = v1;
-							}
-						} else if(	(eve->f & flag)==1 && (v1->f & flag)==0 ) {
-							if(	(float)fabs(v1->co[0]-eve->co[0])<=limit &&
-								(float)fabs(v1->co[1]-eve->co[1])<=limit &&
-								(float)fabs(v1->co[2]-eve->co[2])<=limit)
-							{	/* unique bit */
-								v1->f|= 128;
-								v1->tmp.v = eve;
-							}
-						}
-					}
-				}
-			}
-		}
-	} else {
-		for(a=0; a<amount; a++, sb++) {
-			eve= sb->v1;
-			if( (eve->f & 128)==0 ) {
-				sb1= sb+1;
-				for(b=a+1; b<amount; b++, sb1++) {
-					/* first test: simpel dist */
-					if(sb1->x - sb->x > limit) break;
-					v1= sb1->v1;
-
-					/* second test: is vertex allowed */
-					if( (v1->f & 128)==0 ) {
-						if(	(float)fabs(v1->co[0]-eve->co[0])<=limit &&
-							(float)fabs(v1->co[1]-eve->co[1])<=limit &&
-							(float)fabs(v1->co[2]-eve->co[2])<=limit)
-						{
-							v1->f|= 128;
-							v1->tmp.v = eve;
-						}
-					}
-				}
-			}
-		}
-	}
-	MEM_freeN(sortblock);
 
-	if (!automerge)
-		for(eve = em->verts.first; eve; eve=eve->next)
-			if((eve->f & flag) && (eve->f & 128))
-				EM_data_interp_from_verts(em, eve, eve->tmp.v, eve->tmp.v, 0.5f);
-
-	/* test edges and insert again */
-	eed= em->edges.first;
-	while(eed) {
-		eed->f2= 0;
-		eed= eed->next;
-	}
-	eed= em->edges.last;
-	while(eed) {
-		nexted= eed->prev;
-
-		if(eed->f2==0) {
-			if( (eed->v1->f & 128) || (eed->v2->f & 128) ) {
-				remedge(em, eed);
-
-				if(eed->v1->f & 128) eed->v1 = eed->v1->tmp.v;
-				if(eed->v2->f & 128) eed->v2 = eed->v2->tmp.v;
-				e1= addedgelist(em, eed->v1, eed->v2, eed);
-
-				if(e1) {
-					e1->f2= 1;
-					if(eed->f & SELECT)
-						e1->f |= SELECT;
-				}
-				if(e1!=eed) free_editedge(em, eed);
-			}
-		}
-		eed= nexted;
-	}
-
-	/* first count amount of test faces */
-	efa= (struct EditFace *)em->faces.first;
-	amount= 0;
-	while(efa) {
-		efa->f1= 0;
-		if(efa->v1->f & 128) efa->f1= 1;
-		else if(efa->v2->f & 128) efa->f1= 1;
-		else if(efa->v3->f & 128) efa->f1= 1;
-		else if(efa->v4 && (efa->v4->f & 128)) efa->f1= 1;
-
-		if(efa->f1==1) amount++;
-		efa= efa->next;
-	}
-
-	/* test faces for double vertices, and if needed remove them */
-	efa= (struct EditFace *)em->faces.first;
-	while(efa) {
-		nextvl= efa->next;
-		if(efa->f1==1) {
-
-			if(efa->v1->f & 128) efa->v1= efa->v1->tmp.v;
-			if(efa->v2->f & 128) efa->v2= efa->v2->tmp.v;
-			if(efa->v3->f & 128) efa->v3= efa->v3->tmp.v;
-			if(efa->v4 && (efa->v4->f & 128)) efa->v4= efa->v4->tmp.v;
-
-			test= 0;
-			if(efa->v1==efa->v2) test+=1;
-			if(efa->v2==efa->v3) test+=2;
-			if(efa->v3==efa->v1) test+=4;
-			if(efa->v4==efa->v1) test+=8;
-			if(efa->v3==efa->v4) test+=16;
-			if(efa->v2==efa->v4) test+=32;
-
-			if(test) {
-				if(efa->v4) {
-					if(test==1 || test==2) {
-						efa->v2= efa->v3;
-						efa->v3= efa->v4;
-						efa->v4= 0;
-
-						EM_data_interp_from_faces(em, efa, NULL, efa, 0, 2, 3, 3);
-
-						test= 0;
-					}
-					else if(test==8 || test==16) {
-						efa->v4= 0;
-						test= 0;
-					}
-					else {
-						BLI_remlink(&em->faces, efa);
-						free_editface(em, efa);
-						amount--;
-					}
-				}
-				else {
-					BLI_remlink(&em->faces, efa);
-					free_editface(em, efa);
-					amount--;
-				}
-			}
+void EMBM_project_snap_verts(bContext *C, ARegion *ar, Object *obedit, BMEditMesh *em)
+{
+	BMIter iter;
+	BMVert *eve;
 
-			if(test==0) {
-				/* set edge pointers */
-				efa->e1= findedgelist(em, efa->v1, efa->v2);
-				efa->e2= findedgelist(em, efa->v2, efa->v3);
-				if(efa->v4==0) {
-					efa->e3= findedgelist(em, efa->v3, efa->v1);
-					efa->e4= 0;
-				}
-				else {
-					efa->e3= findedgelist(em, efa->v3, efa->v4);
-					efa->e4= findedgelist(em, efa->v4, efa->v1);
-				}
+	BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+		if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
+			float mval[2], vec[3], no_dummy[3];
+			int dist_dummy;
+			mul_v3_m4v3(vec, obedit->obmat, eve->co);
+			project_float_noclip(ar, vec, mval);
+			if (snapObjectsContext(C, mval, &dist_dummy, vec, no_dummy, SNAP_NOT_OBEDIT)) {
+				mul_v3_m4v3(eve->co, obedit->imat, vec);
 			}
 		}
-		efa= nextvl;
-	}
-
-	/* double faces: sort block */
-	/* count again, now all selected faces */
-	amount= 0;
-	efa= em->faces.first;
-	while(efa) {
-		efa->f1= 0;
-		if(faceselectedOR(efa, 1)) {
-			efa->f1= 1;
-			amount++;
-		}
-		efa= efa->next;
 	}
+}
 
-	if(amount) {
-		/* double faces: sort block */
-		vsb= vlsortblock= MEM_mallocN(sizeof(struct facesort)*amount, "sortremovedoub");
-		efa= em->faces.first;
-		while(efa) {
-			if(efa->f1 & 1) {
-				if(efa->v4) vsb->x= (uintptr_t) MIN4( (uintptr_t)efa->v1, (uintptr_t)efa->v2, (uintptr_t)efa->v3, (uintptr_t)efa->v4);
-				else vsb->x= (uintptr_t) MIN3( (uintptr_t)efa->v1, (uintptr_t)efa->v2, (uintptr_t)efa->v3);
-
-				vsb->efa= efa;
-				vsb++;
-			}
-			efa= efa->next;
-		}
-
-		qsort(vlsortblock, amount, sizeof(struct facesort), vergface);
-
-		vsb= vlsortblock;
-		for(a=0; a<amount; a++) {
-			efa= vsb->efa;
-			if( (efa->f1 & 128)==0 ) {
-				vsb1= vsb+1;
-
-				for(b=a+1; b<amount; b++) {
 
-					/* first test: same pointer? */
-					if(vsb->x != vsb1->x) break;
+/* individual face extrude */
+/* will use vertex normals for extrusion directions, so *nor is unaffected */
+static short edbm_extrude_face_indiv(BMEditMesh *em, wmOperator *op, const char hflag, float *UNUSED(nor))
+{
+	BMOIter siter;
+	BMIter liter;
+	BMFace *f;
+	BMLoop *l;
+	BMOperator bmop;
 
-					/* second test: is test permitted? */
-					efa= vsb1->efa;
-					if( (efa->f1 & 128)==0 ) {
-						if( compareface(efa, vsb->efa)) efa->f1 |= 128;
+	EDBM_op_init(em, &bmop, op, "extrude_face_indiv faces=%hf", hflag);
 
-					}
-					vsb1++;
-				}
-			}
-			vsb++;
-		}
+	/* deselect original verts */
+	EDBM_flag_disable_all(em, BM_ELEM_SELECT);
 
-		MEM_freeN(vlsortblock);
+	BMO_op_exec(em->bm, &bmop);
+	
+	BMO_ITER (f, &siter, em->bm, &bmop, "faceout", BM_FACE) {
+		BM_face_select_set(em->bm, f, TRUE);
 
-		/* remove double faces */
-		efa= (struct EditFace *)em->faces.first;
-		while(efa) {
-			nextvl= efa->next;
-			if(efa->f1 & 128) {
-				BLI_remlink(&em->faces, efa);
-				free_editface(em, efa);
-			}
-			efa= nextvl;
+		/* set face vertex normals to face normal */
+		BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+			copy_v3_v3(l->v->no, f->no);
 		}
 	}
 
-	/* remove double vertices */
-	a= 0;
-	eve= (struct EditVert *)em->verts.first;
-	while(eve) {
-		nextve= eve->next;
-		if(automerge || eve->f & flag) {
-			if(eve->f & 128) {
-				a++;
-				BLI_remlink(&em->verts, eve);
-				free_editvert(em, eve);
-			}
-		}
-		eve= nextve;
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+		return 0;
 	}
 
-	return a;	/* amount */
+	return 's'; // s is shrink/fatten
 }
 
-static int removedoublesflag_exec(bContext *C, wmOperator *op)
+/* extrudes individual edges */
+static short edbm_extrude_edges_indiv(BMEditMesh *em, wmOperator *op, const char hflag, float *UNUSED(nor))
 {
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
-	int totvert= em->totvert, totedge= em->totedge, totface= em->totface;
+	BMOperator bmop;
 
-	int count = removedoublesflag(em,1,0,RNA_float_get(op->ptr, "limit"));
-	
-	if (totvert != em->totvert || totedge != em->totedge || totface != em->totface) {
-		recalc_editnormals(em);
+	EDBM_op_init(em, &bmop, op, "extrude_edge_only edges=%he", hflag);
 
-		DAG_id_tag_update(obedit->data, 0);
-		WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-	}
+	/* deselect original verts */
+	EDBM_flag_disable_all(em, BM_ELEM_SELECT);
 
-	BKE_reportf(op->reports, RPT_INFO, "Removed %d vert%s", count, (count==1)?"ex":"ices");
+	BMO_op_exec(em->bm, &bmop);
+	BMO_slot_buffer_hflag_enable(em->bm, &bmop, "geomout", BM_VERT | BM_EDGE, BM_ELEM_SELECT, TRUE);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+		return 0;
+	}
 
-	return OPERATOR_FINISHED;
+	return 'n'; // n is normal grab
 }
 
-void MESH_OT_remove_doubles(wmOperatorType *ot)
+/* extrudes individual vertices */
+static short edbm_extrude_verts_indiv(BMEditMesh *em, wmOperator *op, const char hflag, float *UNUSED(nor))
 {
-	PropertyRNA *prop;
-
-	/* identifiers */
-	ot->name= "Remove Doubles";
-	ot->description= "Remove duplicate vertices";
-	ot->idname= "MESH_OT_remove_doubles";
+	BMOperator bmop;
 
-	/* api callbacks */
-	ot->exec= removedoublesflag_exec;
-	ot->poll= ED_operator_editmesh;
+	EDBM_op_init(em, &bmop, op, "extrude_vert_indiv verts=%hv", hflag);
 
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	/* deselect original verts */
+	BMO_slot_buffer_hflag_disable(em->bm, &bmop, "verts", BM_VERT, BM_ELEM_SELECT, TRUE);
 
-	prop= RNA_def_float(ot->srna, "limit", 0.0001f, 0.000001f, 50.0f, "Merge Threshold", "Minimum distance between merged verts", 0.00001f, 2.0f);
-	RNA_def_property_ui_range(prop,  0.000001f, 50.0f, 0.001, 5);
-}
+	BMO_op_exec(em->bm, &bmop);
+	BMO_slot_buffer_hflag_enable(em->bm, &bmop, "vertout", BM_VERT, BM_ELEM_SELECT, TRUE);
 
-// XXX is this needed?
-/* called from buttons */
-static void xsortvert_flag__doSetX(void *userData, EditVert *UNUSED(eve), int x, int UNUSED(y), int index)
-{
-	xvertsort *sortblock = userData;
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+		return 0;
+	}
 
-	sortblock[index].x = x;
+	return 'g'; // g is grab
 }
 
-/* all verts with (flag & 'flag') are sorted */
-static void xsortvert_flag(bContext *C, int flag)
+static short edbm_extrude_edge(Object *obedit, BMEditMesh *em, const char hflag, float nor[3])
 {
-	ViewContext vc;
-	EditVert *eve;
-	xvertsort *sortblock;
-	ListBase tbase;
-	int i, amount;
-
-	em_setup_viewcontext(C, &vc);
-
-	amount = BLI_countlist(&vc.em->verts);
-	sortblock = MEM_callocN(sizeof(xvertsort)*amount,"xsort");
-	for (i=0,eve= vc.em->verts.first; eve; i++,eve=eve->next)
-		if(eve->f & flag)
-			sortblock[i].v1 = eve;
-
-	ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d);
-	mesh_foreachScreenVert(&vc, xsortvert_flag__doSetX, sortblock, V3D_CLIP_TEST_OFF);
+	BMesh *bm = em->bm;
+	BMIter iter;
+	BMOIter siter;
+	BMOperator extop;
+	BMEdge *edge;
+	BMFace *f;
+	ModifierData *md;
+	BMElem *ele;
+	
+	BMO_op_init(bm, &extop, "extrude_face_region");
+	BMO_slot_buffer_from_enabled_hflag(bm, &extop, "edgefacein", BM_VERT | BM_EDGE | BM_FACE, hflag);
 
-	qsort(sortblock, amount, sizeof(xvertsort), vergxco);
+	/* 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.
+	 */
+	md = obedit->modifiers.first;
+	for (; md; md = md->next) {
+		if ((md->type == eModifierType_Mirror) && (md->mode & eModifierMode_Realtime)) {
+			MirrorModifierData *mmd = (MirrorModifierData *) md;
+		
+			if (mmd->flag & MOD_MIR_CLIPPING) {
+				float mtx[4][4];
+				if (mmd->mirror_ob) {
+					float imtx[4][4];
+					invert_m4_m4(imtx, mmd->mirror_ob->obmat);
+					mult_m4_m4m4(mtx, imtx, obedit->obmat);
+				}
 
-		/* make temporal listbase */
-	tbase.first= tbase.last= 0;
-	for (i=0; i<amount; i++) {
-		eve = sortblock[i].v1;
+				for (edge = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, NULL);
+				     edge;
+				     edge = BM_iter_step(&iter))
+				{
+					if (BM_elem_flag_test(edge, hflag) &&
+					    BM_edge_is_boundary(edge) &&
+					    BM_elem_flag_test(edge->l->f, hflag))
+					{
+						float co1[3], co2[3];
+
+						copy_v3_v3(co1, edge->v1->co);
+						copy_v3_v3(co2, edge->v2->co);
+
+						if (mmd->mirror_ob) {
+							mul_v3_m4v3(co1, mtx, co1);
+							mul_v3_m4v3(co2, mtx, co2);
+						}
 
-		if (eve) {
-			BLI_remlink(&vc.em->verts, eve);
-			BLI_addtail(&tbase, eve);
+						if (mmd->flag & MOD_MIR_AXIS_X) {
+							if ((fabsf(co1[0]) < mmd->tolerance) &&
+							    (fabsf(co2[0]) < mmd->tolerance))
+							{
+								BMO_slot_map_ptr_insert(bm, &extop, "exclude", edge, NULL);
+							}
+						}
+						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);
+							}
+						}
+						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);
+							}
+						}
+					}
+				}
+			}
 		}
 	}
 
-	BLI_movelisttolist(&vc.em->verts, &tbase);
-
-	MEM_freeN(sortblock);
+	EDBM_flag_disable_all(em, BM_ELEM_SELECT);
 
-}
+	BMO_op_exec(bm, &extop);
 
-static int mesh_vertices_sort_exec(bContext *C, wmOperator *UNUSED(op))
-{
-	xsortvert_flag(C, SELECT);
-	return OPERATOR_FINISHED;
-}
+	zero_v3(nor);
+	
+	BMO_ITER (ele, &siter, bm, &extop, "geomout", BM_ALL) {
+		BM_elem_select_set(bm, ele, TRUE);
 
-void MESH_OT_vertices_sort(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Vertex Sort";
-	ot->description= "Sort vertex order";
-	ot->idname= "MESH_OT_vertices_sort";
+		if (ele->head.htype == BM_FACE) {
+			f = (BMFace *)ele;
+			add_normal_aligned(nor, f->no);
+		};
+	}
 
-	/* api callbacks */
-	ot->exec= mesh_vertices_sort_exec;
+	normalize_v3(nor);
 
-	ot->poll= EM_view3d_poll; /* uses view relative X axis to sort verts */
+	BMO_op_finish(bm, &extop);
 
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	/* grab / normal constraint */
+	return is_zero_v3(nor) ? 'g' : 'n';
 }
 
-
-/* called from buttons */
-static void hashvert_flag(EditMesh *em, int flag)
+static short edbm_extrude_vert(Object *obedit, BMEditMesh *em, const char hflag, float nor[3])
 {
-	/* switch vertex order using hash table */
-	EditVert *eve;
-	struct xvertsort *sortblock, *sb, onth, *newsort;
-	ListBase tbase;
-	int amount, a, b;
+	BMIter iter;
+	BMEdge *eed;
+		
+	/* ensure vert flags are consistent for edge selections */
+	BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
+		if (BM_elem_flag_test(eed, hflag)) {
+			if (hflag & BM_ELEM_SELECT) {
+				BM_vert_select_set(em->bm, eed->v1, TRUE);
+				BM_vert_select_set(em->bm, eed->v2, TRUE);
+			}
 
-	/* count */
-	eve= em->verts.first;
-	amount= 0;
-	while(eve) {
-		if(eve->f & flag) amount++;
-		eve= eve->next;
-	}
-	if(amount==0) return;
+			BM_elem_flag_enable(eed->v1, hflag & ~BM_ELEM_SELECT);
+			BM_elem_flag_enable(eed->v2, hflag & ~BM_ELEM_SELECT);
+		}
+		else {
+			if (BM_elem_flag_test(eed->v1, hflag) && BM_elem_flag_test(eed->v2, hflag)) {
+				if (hflag & BM_ELEM_SELECT) {
+					BM_edge_select_set(em->bm, eed, TRUE);
+				}
 
-	/* allocate memory */
-	sb= sortblock= (struct xvertsort *)MEM_mallocN(sizeof(struct xvertsort)*amount,"sortremovedoub");
-	eve= em->verts.first;
-	while(eve) {
-		if(eve->f & flag) {
-			sb->v1= eve;
-			sb++;
+				BM_elem_flag_enable(eed, hflag & ~BM_ELEM_SELECT);
+			}
 		}
-		eve= eve->next;
 	}
 
-	BLI_srand(1);
+	return edbm_extrude_edge(obedit, em, hflag, nor);
+}
 
-	sb= sortblock;
-	for(a=0; a<amount; a++, sb++) {
-		b= (int)(amount*BLI_drand());
-		if(b>=0 && b<amount) {
-			newsort= sortblock+b;
-			onth= *sb;
-			*sb= *newsort;
-			*newsort= onth;
-		}
-	}
+static int edbm_extrude_repeat_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	RegionView3D *rv3d = CTX_wm_region_view3d(C);
+		
+	int steps = RNA_int_get(op->ptr, "steps");
+	
+	float offs = RNA_float_get(op->ptr, "offset");
+	float dvec[3], tmat[3][3], bmat[3][3], nor[3] = {0.0, 0.0, 0.0};
+	short a;
 
-	/* make temporal listbase */
-	tbase.first= tbase.last= 0;
-	sb= sortblock;
-	while(amount--) {
-		eve= sb->v1;
-		BLI_remlink(&em->verts, eve);
-		BLI_addtail(&tbase, eve);
-		sb++;
-	}
+	/* dvec */
+	normalize_v3_v3(dvec, rv3d->persinv[2]);
+	mul_v3_fl(dvec, offs);
 
-	BLI_movelisttolist(&em->verts, &tbase);
+	/* base correction */
+	copy_m3_m4(bmat, obedit->obmat);
+	invert_m3_m3(tmat, bmat);
+	mul_m3_v3(tmat, dvec);
 
-	MEM_freeN(sortblock);
+	for (a = 0; a < steps; a++) {
+		edbm_extrude_edge(obedit, em, BM_ELEM_SELECT, nor);
+		//BMO_op_callf(em->bm, "extrude_face_region edgefacein=%hef", BM_ELEM_SELECT);
+		BMO_op_callf(em->bm, "translate vec=%v verts=%hv", (float *)dvec, BM_ELEM_SELECT);
+		//extrudeflag(obedit, em, SELECT, nor);
+		//translateflag(em, SELECT, dvec);
+	}
+	
+	EDBM_mesh_normals_update(em);
 
-}
+	EDBM_update_generic(C, em, TRUE);
 
-static int mesh_vertices_randomize_exec(bContext *C, wmOperator *UNUSED(op))
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-	hashvert_flag(em, SELECT);
 	return OPERATOR_FINISHED;
 }
 
-void MESH_OT_vertices_randomize(wmOperatorType *ot)
+void MESH_OT_extrude_repeat(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Vertex Randomize";
-	ot->description= "Randomize vertex order";
-	ot->idname= "MESH_OT_vertices_randomize";
-
+	ot->name = "Extrude Repeat Mesh";
+	ot->description = "Extrude selected vertices, edges or faces repeatedly";
+	ot->idname = "MESH_OT_extrude_repeat";
+	
 	/* api callbacks */
-	ot->exec= mesh_vertices_randomize_exec;
-
-	ot->poll= ED_operator_editmesh;
-
+	ot->exec = edbm_extrude_repeat_exec;
+	ot->poll = ED_operator_editmesh_view3d;
+	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	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);
 }
 
-
 /* generic extern called extruder */
-static void extrude_mesh(Object *obedit, EditMesh *em, wmOperator *op, short type)
-{
-	float nor[3]= {0.0, 0.0, 0.0};
-	short transmode= 0;
-
-	if(type<1) return;
-
-	if(type==1)  transmode= extrudeflag(obedit, em, SELECT, nor, 0);
-	else if(type==4) transmode= extrudeflag_verts_indiv(em, SELECT, nor);
-	else if(type==3) transmode= extrudeflag_edges_indiv(em, SELECT, nor);
-	else transmode= extrudeflag_face_indiv(em, SELECT, nor);
+static int edbm_extrude_mesh(Scene *scene, Object *obedit, BMEditMesh *em, wmOperator *op, float *norin)
+{
+	short nr, transmode = 0;
+	float stacknor[3] = {0.0f, 0.0f, 0.0f};
+	float *nor = norin ? norin : stacknor;
+
+	zero_v3(nor);
+
+	if (em->selectmode & SCE_SELECT_VERTEX) {
+		if (em->bm->totvertsel == 0) nr = 0;
+		else if (em->bm->totvertsel == 1) nr = 4;
+		else if (em->bm->totedgesel == 0) nr = 4;
+		else if (em->bm->totfacesel == 0)
+			nr = 3;  // pupmenu("Extrude %t|Only Edges%x3|Only Vertices%x4");
+		else if (em->bm->totfacesel == 1)
+			nr = 1;  // pupmenu("Extrude %t|Region %x1|Only Edges%x3|Only Vertices%x4");
+		else 
+			nr = 1;  // pupmenu("Extrude %t|Region %x1||Individual Faces %x2|Only Edges%x3|Only Vertices%x4");
+	}
+	else if (em->selectmode & SCE_SELECT_EDGE) {
+		if (em->bm->totedgesel == 0) nr = 0;
+		
+		nr = 1;
+#if 0
+		else if (em->totedgesel == 1) nr = 3;
+		else if (em->totfacesel == 0) nr = 3;
+		else if (em->totfacesel == 1)
+			nr = 1;  // pupmenu("Extrude %t|Region %x1|Only Edges%x3");
+		else
+			nr = 1;  // pupmenu("Extrude %t|Region %x1||Individual Faces %x2|Only Edges%x3");
+#endif
+	}
+	else {
+		if (em->bm->totfacesel == 0) nr = 0;
+		else if (em->bm->totfacesel == 1) nr = 1;
+		else
+			nr = 1;  // pupmenu("Extrude %t|Region %x1||Individual Faces %x2");
+	}
 
-	EM_stats_update(em);
+	if (nr < 1) return 'g';
 
-	if(transmode==0) {
-		BKE_report(op->reports, RPT_WARNING, "Not a valid selection for extrude");
+	if (nr == 1 && (em->selectmode & SCE_SELECT_VERTEX))
+		transmode = edbm_extrude_vert(obedit, em, BM_ELEM_SELECT, nor);
+	else if (nr == 1) transmode = edbm_extrude_edge(obedit, em, BM_ELEM_SELECT, nor);
+	else if (nr == 4) transmode = edbm_extrude_verts_indiv(em, op, BM_ELEM_SELECT, nor);
+	else if (nr == 3) transmode = edbm_extrude_edges_indiv(em, op, BM_ELEM_SELECT, nor);
+	else transmode = edbm_extrude_face_indiv(em, op, BM_ELEM_SELECT, nor);
+	
+	if (transmode == 0) {
+		BKE_report(op->reports, RPT_ERROR, "Not a valid selection for extrude");
 	}
 	else {
-		EM_fgon_flags(em);
-
-			/* We need to force immediate calculation here because
-			* transform may use derived objects (which are now stale).
-			*
-			* This shouldn't be necessary, derived queries should be
-			* automatically building this data if invalid. Or something.
-			*/
-		DAG_id_tag_update(obedit->data, 0);
+		
+		/* We need to force immediate calculation here because
+		 * transform may use derived objects (which are now stale).
+		 *
+		 * This shouldn't be necessary, derived queries should be
+		 * automatically building this data if invalid. Or something.
+		 */
+//		DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
+		object_handle_update(scene, obedit);
 
 		/* individual faces? */
 //		BIF_TransformSetUndo("Extrude");
-		if(type==2) {
+		if (nr == 2) {
 //			initTransform(TFM_SHRINKFATTEN, CTX_NO_PET|CTX_NO_MIRROR);
 //			Transform();
 		}
 		else {
 //			initTransform(TFM_TRANSLATION, CTX_NO_PET|CTX_NO_MIRROR);
-			if(transmode=='n') {
+			if (transmode == 'n') {
 				mul_m4_v3(obedit->obmat, nor);
-				sub_v3_v3(nor, obedit->obmat[3]);
+				sub_v3_v3v3(nor, nor, obedit->obmat[3]);
 //				BIF_setSingleAxisConstraint(nor, "along normal");
 			}
 //			Transform();
 		}
 	}
-
+	
+	return transmode;
 }
 
-// XXX should be a menu item
-static int mesh_extrude_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+/* extrude without transform */
+static int edbm_extrude_region_exec(bContext *C, wmOperator *op)
 {
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
 	
-	extrude_mesh(obedit, em, op, RNA_enum_get(op->ptr, "type"));
+	edbm_extrude_mesh(scene, obedit, em, op, NULL);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
-
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	/* This normally happens when pushing undo but modal operators
+	 * like this one don't push undo data until after modal mode is
+	 * done.*/
+	EDBM_mesh_normals_update(em);
 
+	EDBM_update_generic(C, em, TRUE);
+	
 	return OPERATOR_FINISHED;
 }
 
-/* extrude without transform */
-static int mesh_extrude_exec(bContext *C, wmOperator *op)
+void MESH_OT_extrude_region(wmOperatorType *ot)
 {
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh(obedit->data);
+	/* identifiers */
+	ot->name = "Extrude Region";
+	ot->idname = "MESH_OT_extrude_region";
+	ot->description = "Extrude region of faces";
+	
+	/* api callbacks */
+	//ot->invoke = mesh_extrude_region_invoke;
+	ot->exec = edbm_extrude_region_exec;
+	ot->poll = ED_operator_editmesh;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-	extrude_mesh(obedit, em, op, RNA_enum_get(op->ptr, "type"));
+	RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
+}
 
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+static int edbm_extrude_verts_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	float nor[3];
 
-	BKE_mesh_end_editmesh(obedit->data, em);
+	edbm_extrude_verts_indiv(em, op, BM_ELEM_SELECT, nor);
+	
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit);
+	
 	return OPERATOR_FINISHED;
 }
 
-static EnumPropertyItem extrude_items[] = {
-		{1, "REGION", 0, "Region", ""},
-		{2, "FACES", 0, "Individual Faces", ""},
-		{3, "EDGES", 0, "Only Edges", ""},
-		{4, "VERTS", 0, "Only Vertices", ""},
-		{0, NULL, 0, NULL, NULL}};
+void MESH_OT_extrude_verts_indiv(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Extrude Only Vertices";
+	ot->idname = "MESH_OT_extrude_verts_indiv";
+	ot->description = "Extrude individual vertices only";
+	
+	/* api callbacks */
+	ot->exec = edbm_extrude_verts_exec;
+	ot->poll = ED_operator_editmesh;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
+	/* to give to transform */
+	RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
+}
 
-static EnumPropertyItem *mesh_extrude_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
+static int edbm_extrude_edges_exec(bContext *C, wmOperator *op)
 {
-	EnumPropertyItem *item= NULL;
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em;
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	float nor[3];
 
-	int totitem= 0;
+	edbm_extrude_edges_indiv(em, op, BM_ELEM_SELECT, nor);
+	
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit);
+	
+	return OPERATOR_FINISHED;
+}
 
-	if(obedit==NULL || obedit->type != OB_MESH)
-		return extrude_items;
+void MESH_OT_extrude_edges_indiv(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Extrude Only Edges";
+	ot->idname = "MESH_OT_extrude_edges_indiv";
+	ot->description = "Extrude individual edges only";
+	
+	/* api callbacks */
+	ot->exec = edbm_extrude_edges_exec;
+	ot->poll = ED_operator_editmesh;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-	em = BKE_mesh_get_editmesh(obedit->data);
+	/* to give to transform */
+	RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
+}
 
-	EM_stats_update(em);
+static int edbm_extrude_faces_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	float nor[3];
 
-	if(em->selectmode & SCE_SELECT_VERTEX) {
-		if(em->totvertsel==0) {}
-		else if(em->totvertsel==1) { RNA_enum_item_add(&item, &totitem, &extrude_items[3]); }
-		else if(em->totedgesel==0) { RNA_enum_item_add(&item, &totitem, &extrude_items[3]); }
-		else if(em->totfacesel==0) {
-			RNA_enum_item_add(&item, &totitem, &extrude_items[2]);
-			RNA_enum_item_add(&item, &totitem, &extrude_items[3]);
-		}
-		else if(em->totfacesel==1) {
-			RNA_enum_item_add(&item, &totitem, &extrude_items[0]);
-			RNA_enum_item_add(&item, &totitem, &extrude_items[2]);
-			RNA_enum_item_add(&item, &totitem, &extrude_items[3]);
-		}
-		else {
-			RNA_enum_item_add(&item, &totitem, &extrude_items[0]);
-			RNA_enum_item_add(&item, &totitem, &extrude_items[1]);
-			RNA_enum_item_add(&item, &totitem, &extrude_items[2]);
-			RNA_enum_item_add(&item, &totitem, &extrude_items[3]);
-		}
-	}
-	else if(em->selectmode & SCE_SELECT_EDGE) {
-		if (em->totedgesel==0) {}
-		else if (em->totedgesel==1) { RNA_enum_item_add(&item, &totitem, &extrude_items[2]); }
-		else if(em->totfacesel==0) { RNA_enum_item_add(&item, &totitem, &extrude_items[2]); }
-		else if(em->totfacesel==1) {
-			RNA_enum_item_add(&item, &totitem, &extrude_items[0]);
-			RNA_enum_item_add(&item, &totitem, &extrude_items[2]);
-		}
-		else {
-			RNA_enum_item_add(&item, &totitem, &extrude_items[0]);
-			RNA_enum_item_add(&item, &totitem, &extrude_items[1]);
-			RNA_enum_item_add(&item, &totitem, &extrude_items[2]);
-		}
-	}
-	else {
-		if (em->totfacesel == 0) {}
-		else if (em->totfacesel == 1) { RNA_enum_item_add(&item, &totitem, &extrude_items[0]); }
-		else {
-			RNA_enum_item_add(&item, &totitem, &extrude_items[0]);
-			RNA_enum_item_add(&item, &totitem, &extrude_items[1]);
-		}
-	}
-
-	if(item) {
-		RNA_enum_item_end(&item, &totitem);
-		*free= 1;
-		return item;
-	}
-	else {
-		return NULL;
-	}
+	edbm_extrude_face_indiv(em, op, BM_ELEM_SELECT, nor);
+	
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit);
+	
+	return OPERATOR_FINISHED;
 }
 
-void MESH_OT_extrude(wmOperatorType *ot)
+void MESH_OT_extrude_faces_indiv(wmOperatorType *ot)
 {
-	PropertyRNA *prop;
-
 	/* identifiers */
-	ot->name= "Extrude";
-	ot->description= "Extrude selected vertices, edges or faces";
-	ot->idname= "MESH_OT_extrude";
-
+	ot->name = "Extrude Individual Faces";
+	ot->idname = "MESH_OT_extrude_faces_indiv";
+	ot->description = "Extrude individual faces only";
+	
 	/* api callbacks */
-	ot->invoke= mesh_extrude_invoke;
-	ot->exec= mesh_extrude_exec;
-	ot->poll= ED_operator_editmesh;
-
+	ot->exec = edbm_extrude_faces_exec;
+	ot->poll = ED_operator_editmesh;
+	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-	/* properties */
-	prop= RNA_def_enum(ot->srna, "type", extrude_items, 0, "Type", "");
-	RNA_def_property_flag(prop, PROP_HIDDEN);
-	RNA_def_enum_funcs(prop, mesh_extrude_itemf);
-	ot->prop= prop;
+	RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
 }
 
-static int split_mesh(bContext *C, wmOperator *UNUSED(op))
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-
-	WM_cursor_wait(1);
-
-	/* make duplicate first */
-	adduplicateflag(em, SELECT);
-	/* old faces have flag 128 set, delete them */
-	delfaceflag(em, 128);
-	recalc_editnormals(em);
+/* ******************** (de)select all operator **************** */
 
-	WM_cursor_wait(0);
+static int edbm_select_all_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	int action = RNA_enum_get(op->ptr, "action");
+	
+	switch (action) {
+		case SEL_TOGGLE:
+			EDBM_select_toggle_all(em);
+			break;
+		case SEL_SELECT:
+			EDBM_flag_enable_all(em, BM_ELEM_SELECT);
+			break;
+		case SEL_DESELECT:
+			EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+			break;
+		case SEL_INVERT:
+			EDBM_select_swap(em);
+			EDBM_selectmode_flush(em);
+			break;
+	}
 
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
 	return OPERATOR_FINISHED;
 }
 
-void MESH_OT_split(wmOperatorType *ot)
+void MESH_OT_select_all(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Split";
-	ot->description= "Split selected geometry into separate disconnected mesh";
-	ot->idname= "MESH_OT_split";
-
+	ot->name = "(De)select All";
+	ot->idname = "MESH_OT_select_all";
+	ot->description = "(De)select all vertices, edges or faces";
+	
 	/* api callbacks */
-	ot->exec= split_mesh;
-	ot->poll= ED_operator_editmesh;
-
+	ot->exec = edbm_select_all_exec;
+	ot->poll = ED_operator_editmesh;
+	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
+	WM_operator_properties_select_all(ot);
+}
 
-static int extrude_repeat_mesh_exec(bContext *C, wmOperator *op)
+static int edbm_faces_select_interior_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-
-	int steps = RNA_int_get(op->ptr,"steps");
-
-	float offs = RNA_float_get(op->ptr,"offset");
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
 
-	float dvec[3], tmat[3][3], bmat[3][3], nor[3]= {0.0, 0.0, 0.0};
-	short a;
-
-	/* dvec */
-	RNA_float_get_array(op->ptr, "direction", dvec);
-	normalize_v3(dvec);
-	dvec[0]*= offs;
-	dvec[1]*= offs;
-	dvec[2]*= offs;
-
-	/* base correction */
-	copy_m3_m4(bmat, obedit->obmat);
-	invert_m3_m3(tmat, bmat);
-	mul_m3_v3(tmat, dvec);
+	if (EDBM_select_interior_faces(em)) {
+		WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit);
 
-	for(a=0; a<steps; a++) {
-		extrudeflag(obedit, em, SELECT, nor, 0);
-		translateflag(em, SELECT, dvec);
+		return OPERATOR_FINISHED;
+	}
+	else {
+		return OPERATOR_CANCELLED;
 	}
 
-	recalc_editnormals(em);
-
-	EM_fgon_flags(em);
-
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-
-	BKE_mesh_end_editmesh(obedit->data, em);
-	return OPERATOR_FINISHED;
-}
-
-/* get center and axis, in global coords */
-static int extrude_repeat_mesh_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
-{
-	RegionView3D *rv3d= ED_view3d_context_rv3d(C);
-
-	if(rv3d)
-		RNA_float_set_array(op->ptr, "direction", rv3d->persinv[2]);
-
-	return extrude_repeat_mesh_exec(C, op);
 }
 
-void MESH_OT_extrude_repeat(wmOperatorType *ot)
+void MESH_OT_select_interior_faces(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Extrude Repeat Mesh";
-	ot->description= "Extrude selected vertices, edges or faces repeatedly";
-	ot->idname= "MESH_OT_extrude_repeat";
+	ot->name = "Select Interior Faces";
+	ot->idname = "MESH_OT_select_interior_faces";
+	ot->description = "Select faces where all edges have more than 2 face users";
 
 	/* api callbacks */
-	ot->invoke= extrude_repeat_mesh_invoke;
-	ot->exec= extrude_repeat_mesh_exec;
-	ot->poll= ED_operator_editmesh;
+	ot->exec = edbm_faces_select_interior_exec;
+	ot->poll = ED_operator_editmesh;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
-	/* props */
-	RNA_def_float(ot->srna, "offset", 2.0f, 0.0f, 100.0f, "Offset", "", 0.0f, 100.0f);
-	RNA_def_int(ot->srna, "steps", 10, 0, 180, "Steps", "", 0, 180);
-	RNA_def_float_vector(ot->srna, "direction", 3, NULL, -FLT_MAX, FLT_MAX, "Direction", "Direction of extrude", -FLT_MAX, FLT_MAX);
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
-/* ************************** spin operator ******************** */
-
-
-static int spin_mesh(bContext *C, wmOperator *op, float *dvec, int steps, float degr, int dupli )
+/* *************** add-click-mesh (extrude) operator ************** */
+static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	Object *obedit= CTX_data_edit_object(C);
-	ToolSettings *ts= CTX_data_tool_settings(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-	EditVert *eve,*nextve;
-	float nor[3]= {0.0f, 0.0f, 0.0f};
-	float si, n[3], q[4], cmat[3][3], imat[3][3], tmat[3][3];
-	float cent[3], bmat[3][3];
-	float phi;
-	short a, ok= 1;
+	ViewContext vc;
+	BMVert *v1;
+	BMIter iter;
+	float min[3], max[3];
+	int done = 0;
+	short use_proj;
+	
+	em_setup_viewcontext(C, &vc);
+	
+	use_proj = ((vc.scene->toolsettings->snap_flag & SCE_SNAP) &&
+	            (vc.scene->toolsettings->snap_mode == SCE_SNAP_MODE_FACE));
 
-	RNA_float_get_array(op->ptr, "center", cent);
+	INIT_MINMAX(min, max);
+	
+	BM_ITER_MESH (v1, &iter, vc.em->bm, BM_VERTS_OF_MESH) {
+		if (BM_elem_flag_test(v1, BM_ELEM_SELECT)) {
+			DO_MINMAX(v1->co, min, max);
+			done = 1;
+		}
+	}
+
+	/* call extrude? */
+	if (done) {
+		const short rot_src = RNA_boolean_get(op->ptr, "rotate_source");
+		BMEdge *eed;
+		float vec[3], cent[3], mat[3][3];
+		float nor[3] = {0.0, 0.0, 0.0};
+
+		/* 2D normal calc */
+		float mval_f[2];
+
+		mval_f[0] = (float)event->mval[0];
+		mval_f[1] = (float)event->mval[1];
+
+		/* check for edges that are half selected, use for rotation */
+		done = 0;
+		BM_ITER_MESH (eed, &iter, vc.em->bm, BM_EDGES_OF_MESH) {
+			if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
+				float co1[3], co2[3];
+				mul_v3_m4v3(co1, vc.obedit->obmat, eed->v1->co);
+				mul_v3_m4v3(co2, vc.obedit->obmat, eed->v2->co);
+				project_float_noclip(vc.ar, co1, co1);
+				project_float_noclip(vc.ar, co2, co2);
+
+				/* 2D rotate by 90d while adding.
+				 *  (x, y) = (y, -x)
+				 *
+				 * accumulate the screenspace normal in 2D,
+				 * with screenspace edge length weighting the result. */
+				if (line_point_side_v2(co1, co2, mval_f) >= 0.0f) {
+					nor[0] +=  (co1[1] - co2[1]);
+					nor[1] += -(co1[0] - co2[0]);
+				}
+				else {
+					nor[0] +=  (co2[1] - co1[1]);
+					nor[1] += -(co2[0] - co1[0]);
+				}
+			}
+			done = 1;
+		}
 
-	/* imat and center and size */
-	copy_m3_m4(bmat, obedit->obmat);
-	invert_m3_m3(imat,bmat);
+		if (done) {
+			float view_vec[3], cross[3];
 
-	cent[0]-= obedit->obmat[3][0];
-	cent[1]-= obedit->obmat[3][1];
-	cent[2]-= obedit->obmat[3][2];
-	mul_m3_v3(imat, cent);
+			/* convert the 2D nomal into 3D */
+			mul_mat3_m4_v3(vc.rv3d->viewinv, nor); /* worldspace */
+			mul_mat3_m4_v3(vc.obedit->imat, nor); /* local space */
 
-	phi= degr*(float)M_PI/360.0f;
-	phi/= steps;
-	if(ts->editbutflag & B_CLOCKWISE) phi= -phi;
+			/* correct the normal to be aligned on the view plane */
+			copy_v3_v3(view_vec, vc.rv3d->viewinv[2]);
+			mul_mat3_m4_v3(vc.obedit->imat, view_vec);
+			cross_v3_v3v3(cross, nor, view_vec);
+			cross_v3_v3v3(nor, view_vec, cross);
+			normalize_v3(nor);
+		}
+		
+		/* center */
+		mid_v3_v3v3(cent, min, max);
+		copy_v3_v3(min, cent);
 
-	RNA_float_get_array(op->ptr, "axis", n);
-	normalize_v3(n);
+		mul_m4_v3(vc.obedit->obmat, min);  /* view space */
+		view3d_get_view_aligned_coordinate(&vc, min, event->mval, TRUE);
+		mul_m4_v3(vc.obedit->imat, min); // back in object space
 
-	q[0]= (float)cos(phi);
-	si= (float)sin(phi);
-	q[1]= n[0]*si;
-	q[2]= n[1]*si;
-	q[3]= n[2]*si;
-	quat_to_mat3( cmat,q);
+		sub_v3_v3(min, cent);
+		
+		/* calculate rotation */
+		unit_m3(mat);
+		if (done) {
+			float angle;
 
-	mul_m3_m3m3(tmat,cmat,bmat);
-	mul_m3_m3m3(bmat,imat,tmat);
+			normalize_v3_v3(vec, min);
 
-	if(dupli==0)
-		if(ts->editbutflag & B_KEEPORIG)
-			adduplicateflag(em, 1);
+			angle = angle_normalized_v3v3(vec, nor);
 
-	for(a=0; a<steps; a++) {
-		if(dupli==0) ok= extrudeflag(obedit, em, SELECT, nor, 0);
-		else adduplicateflag(em, SELECT);
+			if (angle != 0.0f) {
+				float axis[3];
 
-		if(ok==0)
-			break;
+				cross_v3_v3v3(axis, nor, vec);
 
-		rotateflag(em, SELECT, cent, bmat);
-		if(dvec) {
-			mul_m3_v3(bmat,dvec);
-			translateflag(em, SELECT, dvec);
-		}
-	}
+				/* halve the rotation if its applied twice */
+				if (rot_src) {
+					angle *= 0.5f;
+				}
 
-	if(ok==0) {
-		/* no vertices or only loose ones selected, remove duplicates */
-		eve= em->verts.first;
-		while(eve) {
-			nextve= eve->next;
-			if(eve->f & SELECT) {
-				BLI_remlink(&em->verts,eve);
-				free_editvert(em, eve);
+				axis_angle_to_mat3(mat, axis, angle);
 			}
-			eve= nextve;
 		}
-	}
-	else {
-		recalc_editnormals(em);
+		
+		if (rot_src) {
+			EDBM_op_callf(vc.em, op, "rotate verts=%hv cent=%v mat=%m3",
+			              BM_ELEM_SELECT, cent, mat);
 
-		EM_fgon_flags(em);
+			/* also project the source, for retopo workflow */
+			if (use_proj)
+				EMBM_project_snap_verts(C, vc.ar, vc.obedit, vc.em);
+		}
 
-		DAG_id_tag_update(obedit->data, 0);
+		edbm_extrude_edge(vc.obedit, vc.em, BM_ELEM_SELECT, nor);
+		EDBM_op_callf(vc.em, op, "rotate verts=%hv cent=%v mat=%m3",
+		              BM_ELEM_SELECT, cent, mat);
+		EDBM_op_callf(vc.em, op, "translate verts=%hv vec=%v",
+		              BM_ELEM_SELECT, min);
 	}
+	else {
+		float *curs = give_cursor(vc.scene, vc.v3d);
+		BMOperator bmop;
+		BMOIter oiter;
+		
+		copy_v3_v3(min, curs);
+		view3d_get_view_aligned_coordinate(&vc, min, event->mval, 0);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
-	return ok;
-}
+		invert_m4_m4(vc.obedit->imat, vc.obedit->obmat);
+		mul_m4_v3(vc.obedit->imat, min); // back in object space
+		
+		EDBM_op_init(vc.em, &bmop, op, "makevert co=%v", min);
+		BMO_op_exec(vc.em->bm, &bmop);
 
-static int spin_mesh_exec(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	int ok;
+		BMO_ITER (v1, &oiter, vc.em->bm, &bmop, "newvertout", BM_VERT) {
+			BM_vert_select_set(vc.em->bm, v1, TRUE);
+		}
 
-	ok= spin_mesh(C, op, NULL, RNA_int_get(op->ptr,"steps"), RNA_float_get(op->ptr,"degrees"), RNA_boolean_get(op->ptr,"dupli"));
-	if(ok==0) {
-		BKE_report(op->reports, RPT_WARNING, "No valid vertices are selected");
-		return OPERATOR_CANCELLED;
+		if (!EDBM_op_finish(vc.em, &bmop, op, TRUE)) {
+			return OPERATOR_CANCELLED;
+		}
 	}
 
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	if (use_proj)
+		EMBM_project_snap_verts(C, vc.ar, vc.obedit, vc.em);
 
-	return OPERATOR_FINISHED;
-}
-
-/* get center and axis, in global coords */
-static int spin_mesh_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
-{
-	Scene *scene = CTX_data_scene(C);
-	View3D *v3d = CTX_wm_view3d(C);
-	RegionView3D *rv3d= ED_view3d_context_rv3d(C);
+	/* This normally happens when pushing undo but modal operators
+	 * like this one don't push undo data until after modal mode is
+	 * done. */
+	EDBM_mesh_normals_update(vc.em);
 
-	RNA_float_set_array(op->ptr, "center", give_cursor(scene, v3d));
-	RNA_float_set_array(op->ptr, "axis", rv3d->viewinv[2]);
+	EDBM_update_generic(C, vc.em, TRUE);
 
-	return spin_mesh_exec(C, op);
+	return OPERATOR_FINISHED;
 }
 
-void MESH_OT_spin(wmOperatorType *ot)
+void MESH_OT_dupli_extrude_cursor(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Spin";
-	ot->description= "Extrude selected vertices in a circle around the cursor in indicated viewport";
-	ot->idname= "MESH_OT_spin";
-
+	ot->name = "Duplicate or Extrude at 3D Cursor";
+	ot->idname = "MESH_OT_dupli_extrude_cursor";
+	ot->description = "Duplicate and extrude selected vertices, edges or faces towards the mouse cursor";
+	
 	/* api callbacks */
-	ot->invoke= spin_mesh_invoke;
-	ot->exec= spin_mesh_exec;
-	ot->poll= EM_view3d_poll;
-
+	ot->invoke = edbm_dupli_extrude_cursor_invoke;
+	ot->poll = ED_operator_editmesh;
+	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
-	/* props */
-	RNA_def_int(ot->srna, "steps", 9, 0, INT_MAX, "Steps", "Steps", 0, 128);
-	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);
-
-	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);
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
+	RNA_def_boolean(ot->srna, "rotate_source", 1, "Rotate Source", "Rotate initial selection giving better shape");
 }
 
-static int screw_mesh_exec(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-	EditVert *eve,*v1=0,*v2=0;
-	EditEdge *eed;
-	float dvec[3], nor[3];
-	int steps, turns;
-
-	turns= RNA_int_get(op->ptr, "turns");
-	steps= RNA_int_get(op->ptr, "steps");
+/* Note, these values must match delete_mesh() event values */
+static EnumPropertyItem prop_mesh_delete_types[] = {
+	{0, "VERT",      0, "Vertices", ""},
+	{1,  "EDGE",      0, "Edges", ""},
+	{2,  "FACE",      0, "Faces", ""},
+	{3,  "EDGE_FACE", 0, "Edges & Faces", ""},
+	{4,  "ONLY_FACE", 0, "Only Faces", ""},
+	{0, NULL, 0, NULL, NULL}
+};
 
-	/* clear flags */
-	for(eve= em->verts.first; eve; eve= eve->next)
-		eve->f1= 0;
+static int edbm_delete_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	int type = RNA_enum_get(op->ptr, "type");
 
-	/* edges set flags in verts */
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		if(eed->v1->f & SELECT) {
-			if(eed->v2->f & SELECT) {
-				/* watch: f1 is a byte */
-				if(eed->v1->f1<2) eed->v1->f1++;
-				if(eed->v2->f1<2) eed->v2->f1++;
-			}
-		}
+	if (type == 0) {
+		if (!EDBM_op_callf(em, op, "del geom=%hv context=%i", BM_ELEM_SELECT, DEL_VERTS)) /* Erase Vertices */
+			return OPERATOR_CANCELLED;
 	}
-	/* find two vertices with eve->f1==1, more or less is wrong */
-	for(eve= em->verts.first; eve; eve= eve->next) {
-		if(eve->f1==1) {
-			if(v1==NULL) v1= eve;
-			else if(v2==NULL) v2= eve;
-			else {
-				v1= NULL;
-				break;
-			}
-		}
+	else if (type == 1) {
+		if (!EDBM_op_callf(em, op, "del geom=%he context=%i", BM_ELEM_SELECT, DEL_EDGES)) /* Erase Edges */
+			return OPERATOR_CANCELLED;
 	}
-	if(v1==NULL || v2==NULL) {
-		BKE_report(op->reports, RPT_WARNING, "You have to select a string of connected vertices too");
-		BKE_mesh_end_editmesh(obedit->data, em);
-		return OPERATOR_CANCELLED;
+	else if (type == 2) {
+		if (!EDBM_op_callf(em, op, "del geom=%hf context=%i", BM_ELEM_SELECT, DEL_FACES)) /* Erase Faces */
+			return OPERATOR_CANCELLED;
+	}
+	else if (type == 3) {
+		if (!EDBM_op_callf(em, op, "del geom=%hef context=%i", BM_ELEM_SELECT, DEL_EDGESFACES)) /* Edges and Faces */
+			return OPERATOR_CANCELLED;
+	}
+	else if (type == 4) {
+		//"Erase Only Faces";
+		if (!EDBM_op_callf(em, op, "del geom=%hf context=%i",
+		                   BM_ELEM_SELECT, DEL_ONLYFACES))
+			return OPERATOR_CANCELLED;
 	}
 
-	/* calculate dvec */
-	dvec[0]= ( v1->co[0]- v2->co[0] )/steps;
-	dvec[1]= ( v1->co[1]- v2->co[1] )/steps;
-	dvec[2]= ( v1->co[2]- v2->co[2] )/steps;
-
-	VECCOPY(nor, obedit->obmat[2]);
+	EDBM_flag_disable_all(em, BM_ELEM_SELECT);
 
-	if(nor[0]*dvec[0]+nor[1]*dvec[1]+nor[2]*dvec[2]>0.0f) {
-		negate_v3(dvec);
-	}
+	EDBM_update_generic(C, em, TRUE);
+	
+	return OPERATOR_FINISHED;
+}
 
-	if(spin_mesh(C, op, dvec, turns*steps, 360.0f*turns, 0)) {
-		DAG_id_tag_update(obedit->data, 0);
-		WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+void MESH_OT_delete(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Delete";
+	ot->description = "Delete selected vertices, edges or faces";
+	ot->idname = "MESH_OT_delete";
+	
+	/* api callbacks */
+	ot->invoke = WM_menu_invoke;
+	ot->exec = edbm_delete_exec;
+	
+	ot->poll = ED_operator_editmesh;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-		BKE_mesh_end_editmesh(obedit->data, em);
-		return OPERATOR_FINISHED;
-	}
-	else {
-		BKE_report(op->reports, RPT_WARNING, "No valid vertices are selected");
-		BKE_mesh_end_editmesh(obedit->data, em);
-		return OPERATOR_CANCELLED;
-	}
+	/* props */
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_mesh_delete_types, 0, "Type", "Method used for deleting mesh data");
 }
 
-/* get center and axis, in global coords */
-static int screw_mesh_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+static int edbm_collapse_edge_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene = CTX_data_scene(C);
-	View3D *v3d = CTX_wm_view3d(C);
-	RegionView3D *rv3d= ED_view3d_context_rv3d(C);
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
 
-	RNA_float_set_array(op->ptr, "center", give_cursor(scene, v3d));
-	RNA_float_set_array(op->ptr, "axis", rv3d->viewinv[1]);
+	if (!EDBM_op_callf(em, op, "collapse edges=%he", BM_ELEM_SELECT))
+		return OPERATOR_CANCELLED;
 
-	return screw_mesh_exec(C, op);
+	EDBM_update_generic(C, em, TRUE);
+
+	return OPERATOR_FINISHED;
 }
 
-void MESH_OT_screw(wmOperatorType *ot)
+void MESH_OT_edge_collapse(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Screw";
-	ot->description= "Extrude selected vertices in screw-shaped rotation around the cursor in indicated viewport";
-	ot->idname= "MESH_OT_screw";
+	ot->name = "Edge Collapse";
+	ot->description = "Collapse selected edges";
+	ot->idname = "MESH_OT_edge_collapse";
 
 	/* api callbacks */
-	ot->invoke= screw_mesh_invoke;
-	ot->exec= screw_mesh_exec;
-	ot->poll= EM_view3d_poll;
+	ot->exec = edbm_collapse_edge_exec;
+	ot->poll = ED_operator_editmesh;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
-	/*props */
-	RNA_def_int(ot->srna, "steps", 9, 0, INT_MAX, "Steps", "Steps", 0, 256);
-	RNA_def_int(ot->srna, "turns", 1, 0, INT_MAX, "Turns", "Turns", 0, 256);
-
-	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);
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
-static void erase_edges(EditMesh *em, ListBase *l)
+static int edbm_collapse_edge_loop_exec(bContext *C, wmOperator *op)
 {
-	EditEdge *ed, *nexted;
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
 
-	ed = (EditEdge *) l->first;
-	while(ed) {
-		nexted= ed->next;
-		if( (ed->v1->f & SELECT) || (ed->v2->f & SELECT) ) {
-			remedge(em, ed);
-			free_editedge(em, ed);
-		}
-		ed= nexted;
-	}
+	if (!EDBM_op_callf(em, op, "dissolve_edge_loop edges=%he", BM_ELEM_SELECT))
+		return OPERATOR_CANCELLED;
+
+	EDBM_update_generic(C, em, TRUE);
+
+	return OPERATOR_FINISHED;
 }
 
-static void erase_faces(EditMesh *em, ListBase *l)
+void MESH_OT_edge_collapse_loop(wmOperatorType *ot)
 {
-	EditFace *f, *nextf;
+	/* identifiers */
+	ot->name = "Edge Collapse Loop";
+	ot->description = "Collapse selected edge loops";
+	ot->idname = "MESH_OT_edge_collapse_loop";
 
-	f = (EditFace *) l->first;
+	/* api callbacks */
+	ot->exec = edbm_collapse_edge_loop_exec;
+	ot->poll = ED_operator_editmesh;
 
-	while(f) {
-		nextf= f->next;
-		if( faceselectedOR(f, SELECT) ) {
-			BLI_remlink(l, f);
-			free_editface(em, f);
-		}
-		f = nextf;
-	}
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
-static void erase_vertices(EditMesh *em, ListBase *l)
+static int edbm_add_edge_face__smooth_get(BMesh *bm)
 {
-	EditVert *v, *nextv;
+	BMEdge *e;
+	BMIter iter;
+
+	unsigned int vote_on_smooth[2] = {0, 0};
 
-	v = (EditVert *) l->first;
-	while(v) {
-		nextv= v->next;
-		if(v->f & 1) {
-			BLI_remlink(l, v);
-			free_editvert(em, v);
+	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+		if (BM_elem_flag_test(e, BM_ELEM_SELECT) && e->l)
+		{
+			vote_on_smooth[BM_elem_flag_test_bool(e->l->f, BM_ELEM_SMOOTH)]++;
 		}
-		v = nextv;
 	}
+
+	return (vote_on_smooth[0] < vote_on_smooth[1]);
 }
 
-static void delete_mesh(EditMesh *em, wmOperator *op, int event)
+static int edbm_add_edge_face_exec(bContext *C, wmOperator *op)
 {
-	EditFace *efa, *nextvl;
-	EditVert *eve,*nextve;
-	EditEdge *eed,*nexted;
-	int count;
-	/* const char *str="Erase"; */
-
-
-	if(event<1) return;
-
-	if(event==10 ) {
-		/* str= "Erase Vertices"; */
-		erase_edges(em, &em->edges);
-		erase_faces(em, &em->faces);
-		erase_vertices(em, &em->verts);
-	}
-	else if(event==6) {
-		if(!EdgeLoopDelete(em, op))
-			return;
-
-		/* str= "Erase Edge Loop"; */
-	}
-	else if(event==4) {
-		/* str= "Erase Edges & Faces"; */
-		efa= em->faces.first;
-		while(efa) {
-			nextvl= efa->next;
-			/* delete only faces with 1 or more edges selected */
-			count= 0;
-			if(efa->e1->f & SELECT) count++;
-			if(efa->e2->f & SELECT) count++;
-			if(efa->e3->f & SELECT) count++;
-			if(efa->e4 && (efa->e4->f & SELECT)) count++;
-			if(count) {
-				BLI_remlink(&em->faces, efa);
-				free_editface(em, efa);
-			}
-			efa= nextvl;
-		}
-		eed= em->edges.first;
-		while(eed) {
-			nexted= eed->next;
-			if(eed->f & SELECT) {
-				remedge(em, eed);
-				free_editedge(em, eed);
-			}
-			eed= nexted;
-		}
-		efa= em->faces.first;
-		while(efa) {
-			nextvl= efa->next;
-			event=0;
-			if( efa->v1->f & SELECT) event++;
-			if( efa->v2->f & SELECT) event++;
-			if( efa->v3->f & SELECT) event++;
-			if(efa->v4 && (efa->v4->f & SELECT)) event++;
-
-			if(event>1) {
-				BLI_remlink(&em->faces, efa);
-				free_editface(em, efa);
-			}
-			efa= nextvl;
-		}
-	}
-	else if(event==1) {
-		/* str= "Erase Edges"; */
-		// faces first
-		efa= em->faces.first;
-		while(efa) {
-			nextvl= efa->next;
-			event=0;
-			if( efa->e1->f & SELECT) event++;
-			if( efa->e2->f & SELECT) event++;
-			if( efa->e3->f & SELECT) event++;
-			if(efa->e4 && (efa->e4->f & SELECT)) event++;
-
-			if(event) {
-				BLI_remlink(&em->faces, efa);
-				free_editface(em, efa);
-			}
-			efa= nextvl;
-		}
-		eed= em->edges.first;
-		while(eed) {
-			nexted= eed->next;
-			if(eed->f & SELECT) {
-				remedge(em, eed);
-				free_editedge(em, eed);
-			}
-			eed= nexted;
-		}
-		/* to remove loose vertices: */
-		eed= em->edges.first;
-		while(eed) {
-			if( eed->v1->f & SELECT) eed->v1->f-=SELECT;
-			if( eed->v2->f & SELECT) eed->v2->f-=SELECT;
-			eed= eed->next;
-		}
-		eve= em->verts.first;
-		while(eve) {
-			nextve= eve->next;
-			if(eve->f & SELECT) {
-				BLI_remlink(&em->verts,eve);
-				free_editvert(em, eve);
-			}
-			eve= nextve;
-		}
+	BMOperator bmop;
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	const short use_smooth = edbm_add_edge_face__smooth_get(em->bm);
+	/* when this is used to dissolve we could avoid this, but checking isnt too slow */
 
+	if (!EDBM_op_init(em, &bmop, op,
+	                  "contextual_create geom=%hfev mat_nr=%i use_smooth=%b",
+	                  BM_ELEM_SELECT, em->mat_nr, use_smooth))
+	{
+		return OPERATOR_CANCELLED;
 	}
-	else if(event==2) {
-		/* str="Erase Faces"; */
-		delfaceflag(em, SELECT);
-	}
-	else if(event==3) {
-		/* str= "Erase All"; */
-		if(em->verts.first) free_vertlist(em, &em->verts);
-		if(em->edges.first) free_edgelist(em, &em->edges);
-		if(em->faces.first) free_facelist(em, &em->faces);
-		if(em->selected.first) BLI_freelistN(&(em->selected));
-	}
-	else if(event==5) {
-		/* str= "Erase Only Faces"; */
-		efa= em->faces.first;
-		while(efa) {
-			nextvl= efa->next;
-			if(efa->f & SELECT) {
-				BLI_remlink(&em->faces, efa);
-				free_editface(em, efa);
-			}
-			efa= nextvl;
-		}
+	
+	BMO_op_exec(em->bm, &bmop);
+	BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faceout", BM_FACE, BM_ELEM_SELECT, TRUE);
+
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+		return OPERATOR_CANCELLED;
 	}
 
-	recalc_editnormals(em);
+	EDBM_update_generic(C, em, TRUE);
+	
+	return OPERATOR_FINISHED;
+}
 
-	EM_fgon_flags(em);	// redo flags and indices for fgons
+void MESH_OT_edge_face_add(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Make Edge/Face";
+	ot->description = "Add an edge or face to selected";
+	ot->idname = "MESH_OT_edge_face_add";
+	
+	/* api callbacks */
+	ot->exec = edbm_add_edge_face_exec;
+	ot->poll = ED_operator_editmesh;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
-/* Note, these values must match delete_mesh() event values */
-static EnumPropertyItem prop_mesh_delete_types[] = {
-	{10,"VERT",		0, "Vertices", ""},
-	{1, "EDGE",		0, "Edges", ""},
-	{2, "FACE",		0, "Faces", ""},
-	{3, "ALL",		0, "All", ""},
-	{4, "EDGE_FACE",0, "Edges & Faces", ""},
-	{5, "ONLY_FACE",0, "Only Faces", ""},
-	{6, "EDGE_LOOP",0, "Edge Loop", ""},
-	{0, NULL, 0, NULL, NULL}
-};
+/* ************************* SEAMS AND EDGES **************** */
 
-static int delete_mesh_exec(bContext *C, wmOperator *op)
+static int edbm_mark_seam(bContext *C, wmOperator *op)
 {
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-	int type= RNA_enum_get(op->ptr, "type");
-
-	if(type==6)
-		return WM_operator_name_call(C, "MESH_OT_delete_edgeloop", WM_OP_EXEC_DEFAULT, NULL);
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit = CTX_data_edit_object(C);
+	Mesh *me = ((Mesh *)obedit->data);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMesh *bm = em->bm;
+	BMEdge *eed;
+	BMIter iter;
+	int clear = RNA_boolean_get(op->ptr, "clear");
+	
+	/* auto-enable seams drawing */
+	if (clear == 0) {
+		me->drawflag |= ME_DRAWSEAMS;
+	}
 
-	delete_mesh(em, op, type);
+	if (clear) {
+		BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
+			if (!BM_elem_flag_test(eed, BM_ELEM_SELECT) || BM_elem_flag_test(eed, BM_ELEM_HIDDEN))
+				continue;
+			
+			BM_elem_flag_disable(eed, BM_ELEM_SEAM);
+		}
+	}
+	else {
+		BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
+			if (!BM_elem_flag_test(eed, BM_ELEM_SELECT) || BM_elem_flag_test(eed, BM_ELEM_HIDDEN))
+				continue;
+			BM_elem_flag_enable(eed, BM_ELEM_SEAM);
+		}
+	}
 
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	ED_uvedit_live_unwrap(scene, obedit);
+	EDBM_update_generic(C, em, TRUE);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
 	return OPERATOR_FINISHED;
 }
 
-void MESH_OT_delete(wmOperatorType *ot)
+void MESH_OT_mark_seam(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete";
-	ot->description= "Delete selected vertices, edges or faces";
-	ot->idname= "MESH_OT_delete";
-
+	ot->name = "Mark Seam";
+	ot->idname = "MESH_OT_mark_seam";
+	ot->description = "(Un)mark selected edges as a seam";
+	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= delete_mesh_exec;
-
-	ot->poll= ED_operator_editmesh;
-
+	ot->exec = edbm_mark_seam;
+	ot->poll = ED_operator_editmesh;
+	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
-	/*props */
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_mesh_delete_types, 10, "Type", "Method used for deleting mesh data");
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+	
+	RNA_def_boolean(ot->srna, "clear", 0, "Clear", "");
 }
 
+static int edbm_mark_sharp(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	Mesh *me = ((Mesh *)obedit->data);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMesh *bm = em->bm;
+	BMEdge *eed;
+	BMIter iter;
+	int clear = RNA_boolean_get(op->ptr, "clear");
 
-/*GB*/
-/*-------------------------------------------------------------------------------*/
-/*--------------------------- Edge Based Subdivide ------------------------------*/
-
-#define EDGENEW	2
-#define FACENEW	2
-#define EDGEINNER  4
-#define EDGEOLD  8
+	/* auto-enable sharp edge drawing */
+	if (clear == 0) {
+		me->drawflag |= ME_DRAWSHARP;
+	}
 
-/*used by faceloop cut to select only edges valid for edge slide*/
-#define DOUBLEOPFILL 16
-
-/* calculates offset for co, based on fractal, sphere or smooth settings  */
-static void alter_co(float *co, EditEdge *edge, float smooth, float fractal, int beauty, float perc)
-{
-	float tvec[3], fac;
-
-	if(beauty & B_SMOOTH) {
-		/* we calculate an offset vector tvec[], to be added to *co */
-		float len, nor[3], nor1[3], nor2[3];
-
-		sub_v3_v3v3(nor, edge->v1->co, edge->v2->co);
-		len= 0.5f*normalize_v3(nor);
-
-		copy_v3_v3(nor1, edge->v1->no);
-		copy_v3_v3(nor2, edge->v2->no);
-
-		/* cosine angle */
-		fac=  dot_v3v3(nor, nor1);
-		mul_v3_v3fl(tvec, nor1, fac);
-
-		/* cosine angle */
-		fac= -dot_v3v3(nor, nor2);
-		madd_v3_v3fl(tvec, nor2, fac);
-
-		/* falloff for multi subdivide */
-		smooth *= sqrtf(fabs(1.0f - 2.0f*fabsf(0.5f-perc)));
-
-		mul_v3_fl(tvec, smooth * len);
-
-		add_v3_v3(co, tvec);
-	}
-	else if(beauty & B_SPHERE) { /* subdivide sphere */
-		normalize_v3(co);
-		mul_v3_fl(co, smooth);
-	}
-
-	if(beauty & B_FRACTAL) {
-		fac= fractal*len_v3v3(edge->v1->co, edge->v2->co);
-		tvec[0]= fac*(float)(0.5-BLI_drand());
-		tvec[1]= fac*(float)(0.5-BLI_drand());
-		tvec[2]= fac*(float)(0.5-BLI_drand());
-		add_v3_v3(co, tvec);
-	}
-}
-
-/* assumes in the edge is the correct interpolated vertices already */
-/* percent defines the interpolation, smooth, fractal and beauty are for special options */
-/* results in new vertex with correct coordinate, vertex normal and weight group info */
-static EditVert *subdivide_edge_addvert(EditMesh *em, EditEdge *edge, float smooth, float fractal, int beauty, float percent)
-{
-	EditVert *ev;
-	float co[3];
-
-	interp_v3_v3v3(co, edge->v1->co, edge->v2->co, percent);
-
-	/* offset for smooth or sphere or fractal */
-	alter_co(co, edge, smooth, fractal, beauty, percent);
-
-	/* clip if needed by mirror modifier */
-	if (edge->v1->f2) {
-		if ( edge->v1->f2 & edge->v2->f2 & 1) {
-			co[0]= 0.0f;
-		}
-		if ( edge->v1->f2 & edge->v2->f2 & 2) {
-			co[1]= 0.0f;
+	if (!clear) {
+		BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
+			if (!BM_elem_flag_test(eed, BM_ELEM_SELECT) || BM_elem_flag_test(eed, BM_ELEM_HIDDEN))
+				continue;
+			
+			BM_elem_flag_disable(eed, BM_ELEM_SMOOTH);
 		}
-		if ( edge->v1->f2 & edge->v2->f2 & 4) {
-			co[2]= 0.0f;
+	}
+	else {
+		BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
+			if (!BM_elem_flag_test(eed, BM_ELEM_SELECT) || BM_elem_flag_test(eed, BM_ELEM_HIDDEN))
+				continue;
+			
+			BM_elem_flag_enable(eed, BM_ELEM_SMOOTH);
 		}
 	}
 
-	ev = addvertlist(em, co, NULL);
-
-	/* vert data (vgroups, ..) */
-	EM_data_interp_from_verts(em, edge->v1, edge->v2, ev, percent);
+	EDBM_update_generic(C, em, TRUE);
 
-	/* normal */
-	interp_v3_v3v3(ev->no, edge->v1->no, edge->v2->no, percent);
-	normalize_v3(ev->no);
-
-	return ev;
+	return OPERATOR_FINISHED;
 }
 
-static void flipvertarray(EditVert** arr, short size)
+void MESH_OT_mark_sharp(wmOperatorType *ot)
 {
-	EditVert *hold;
-	int i;
-
-	for(i=0; i<size/2; i++) {
-		hold = arr[i];
-		arr[i] = arr[size-i-1];
-		arr[size-i-1] = hold;
-	}
-}
-
-static void facecopy(EditMesh *em, EditFace *source, EditFace *target)
-{
-	float *v1 = source->v1->co, *v2 = source->v2->co, *v3 = source->v3->co;
-	float *v4 = source->v4? source->v4->co: NULL;
-	float w[4][4];
-
-	CustomData_em_copy_data(&em->fdata, &em->fdata, source->data, &target->data);
-
-	target->mat_nr = source->mat_nr;
-	target->flag   = source->flag;
-	target->h	   = source->h;
-
-	interp_weights_face_v3( w[0],v1, v2, v3, v4, target->v1->co);
-	interp_weights_face_v3( w[1],v1, v2, v3, v4, target->v2->co);
-	interp_weights_face_v3( w[2],v1, v2, v3, v4, target->v3->co);
-	if (target->v4)
-		interp_weights_face_v3( w[3],v1, v2, v3, v4, target->v4->co);
-
-	CustomData_em_validate_data(&em->fdata, target->data, target->v4 ? 4 : 3);
-	CustomData_em_interp(&em->fdata, &source->data, NULL, (float*)w, 1, target->data);
-}
-
-static void fill_quad_single(EditMesh *em, EditFace *efa, struct GHash *gh, int numcuts, int seltype)
-{
-	EditEdge *cedge=NULL;
-	EditVert *v[4], **verts;
-	EditFace *hold;
-	short start=0, /* end, */ /* UNUSED */ left, right, vertsize,i;
-
-	v[0] = efa->v1;
-	v[1] = efa->v2;
-	v[2] = efa->v3;
-	v[3] = efa->v4;
-
-	if(efa->e1->f & SELECT)	  { cedge = efa->e1; start = 0;}
-	else if(efa->e2->f & SELECT) { cedge = efa->e2; start = 1;}
-	else if(efa->e3->f & SELECT) { cedge = efa->e3; start = 2;}
-	else if(efa->e4->f & SELECT) { cedge = efa->e4; start = 3;}
-
-	// Point verts to the array of new verts for cedge
-	verts = BLI_ghash_lookup(gh, cedge);
-	//This is the index size of the verts array
-	vertsize = numcuts+2;
-
-	// Is the original v1 the same as the first vert on the selected edge?
-	// if not, the edge is running the opposite direction in this face so flip
-	// the array to the correct direction
-
-	if(verts[0] != v[start]) {flipvertarray(verts,numcuts+2);}
-	/* end	= (start+1)%4; */ /* UNUSED */
-	left   = (start+2)%4;
-	right  = (start+3)%4;
-
-	/*
-	We should have something like this now
-
-			  end		 start
-			   3   2   1   0
-			   |---*---*---|
-			   |		   |
-			   |		   |
-			   |		   |
-			   -------------
-			  left	   right
-
-	where start,end,left, right are indexes of EditFace->v1, etc (stored in v)
-	and 0,1,2... are the indexes of the new verts stored in verts
-
-	We will fill this case like this or this depending on even or odd cuts
-
-			   |---*---*---|		  |---*---|
-			   |  /	 \  |		  |  / \  |
-			   | /	   \ |		  | /   \ |
-			   |/		 \|		  |/	 \|
-			   -------------		  ---------
-	*/
-
-	// Make center face
-	if(vertsize % 2 == 0) {
-		hold = addfacelist(em, verts[(vertsize-1)/2],verts[((vertsize-1)/2)+1],v[left],v[right], NULL,NULL);
-		hold->e2->f2 |= EDGEINNER;
-		hold->e4->f2 |= EDGEINNER;
-	}else{
-		hold = addfacelist(em, verts[(vertsize-1)/2],v[left],v[right],NULL, NULL,NULL);
-		hold->e1->f2 |= EDGEINNER;
-		hold->e3->f2 |= EDGEINNER;
-	}
-	facecopy(em, efa,hold);
-
-	// Make side faces
-	for(i=0;i<(vertsize-1)/2;i++) {
-		hold = addfacelist(em, verts[i],verts[i+1],v[right],NULL,NULL,NULL);
-		facecopy(em, efa,hold);
-		if(i+1 != (vertsize-1)/2) {
-			if(seltype == SUBDIV_SELECT_INNER) {
-				hold->e2->f2 |= EDGEINNER;
-			}
-		}
-		hold = addfacelist(em, verts[vertsize-2-i],verts[vertsize-1-i],v[left],NULL,NULL,NULL);
-		facecopy(em, efa,hold);
-		if(i+1 != (vertsize-1)/2) {
-			if(seltype == SUBDIV_SELECT_INNER) {
-				hold->e3->f2 |= EDGEINNER;
-			}
-		}
-	}
+	/* identifiers */
+	ot->name = "Mark Sharp";
+	ot->idname = "MESH_OT_mark_sharp";
+	ot->description = "(Un)mark selected edges as sharp";
+	
+	/* api callbacks */
+	ot->exec = edbm_mark_sharp;
+	ot->poll = ED_operator_editmesh;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+	
+	RNA_def_boolean(ot->srna, "clear", 0, "Clear", "");
 }
 
-static void fill_tri_single(EditMesh *em, EditFace *efa, struct GHash *gh, int numcuts, int seltype)
-{
-	EditEdge *cedge=NULL;
-	EditVert *v[3], **verts;
-	EditFace *hold;
-	short start=0, /* end, */ /* UNUSED */ op, vertsize,i;
-
-	v[0] = efa->v1;
-	v[1] = efa->v2;
-	v[2] = efa->v3;
-
-	if(efa->e1->f & SELECT)	  { cedge = efa->e1; start = 0;}
-	else if(efa->e2->f & SELECT) { cedge = efa->e2; start = 1;}
-	else if(efa->e3->f & SELECT) { cedge = efa->e3; start = 2;}
-
-	// Point verts to the array of new verts for cedge
-	verts = BLI_ghash_lookup(gh, cedge);
-	//This is the index size of the verts array
-	vertsize = numcuts+2;
-
-	// Is the original v1 the same as the first vert on the selected edge?
-	// if not, the edge is running the opposite direction in this face so flip
-	// the array to the correct direction
-
-	if(verts[0] != v[start]) {flipvertarray(verts,numcuts+2);}
-	/* end = (start+1)%3; */ /* UNUSED */
-	op = (start+2)%3;
-
-	/*
-	We should have something like this now
-
-			  end		 start
-			   3   2   1   0
-			   |---*---*---|
-			   \		   |
-				 \		 |
-				   \	   |
-					 \	 |
-					   \   |
-						 \ |
-						   |op
-
-	where start,end,op are indexes of EditFace->v1, etc (stored in v)
-	and 0,1,2... are the indexes of the new verts stored in verts
-
-	We will fill this case like this or this depending on even or odd cuts
-
-			   3   2   1   0
-			   |---*---*---|
-			   \	\  \   |
-				 \	\ \  |
-				   \   \ \ |
-					 \  \ \|
-					   \ \\|
-						 \ |
-						   |op
-	*/
-
-	// Make side faces
-	for(i=0;i<(vertsize-1);i++) {
-		hold = addfacelist(em, verts[i],verts[i+1],v[op],NULL,NULL,NULL);
-		if(i+1 != vertsize-1) {
-			if(seltype == SUBDIV_SELECT_INNER) {
-				hold->e2->f2 |= EDGEINNER;
-			}
-		}
-		facecopy(em, efa,hold);
-	}
-}
-
-static void fill_quad_double_op(EditMesh *em, EditFace *efa, struct GHash *gh, int numcuts)
-{
-	EditEdge *cedge[2]={NULL, NULL};
-	EditVert *v[4], **verts[2];
-	EditFace *hold;
-	short start=0, /*end,*/ left, /* right,*/ vertsize,i;
-
-	v[0] = efa->v1;
-	v[1] = efa->v2;
-	v[2] = efa->v3;
-	v[3] = efa->v4;
-
-	if(efa->e1->f & SELECT)	  { cedge[0] = efa->e1;  cedge[1] = efa->e3; start = 0;}
-	else if(efa->e2->f & SELECT)	  { cedge[0] = efa->e2;  cedge[1] = efa->e4; start = 1;}
-
-	// Point verts[0] and [1] to the array of new verts for cedge[0] and cedge[1]
-	verts[0] = BLI_ghash_lookup(gh, cedge[0]);
-	verts[1] = BLI_ghash_lookup(gh, cedge[1]);
-	//This is the index size of the verts array
-	vertsize = numcuts+2;
-
-	// Is the original v1 the same as the first vert on the selected edge?
-	// if not, the edge is running the opposite direction in this face so flip
-	// the array to the correct direction
-
-	if(verts[0][0] != v[start]) {flipvertarray(verts[0],numcuts+2);}
-	/* end	= (start+1)%4; */ /* UNUSED */
-	left   = (start+2)%4;
-	/* right  = (start+3)%4; */ /* UNUSED */
-	if(verts[1][0] != v[left]) {flipvertarray(verts[1],numcuts+2);}
-	/*
-	We should have something like this now
-
-			  end		 start
-			   3   2   1   0
-			   |---*---*---|
-			   |		   |
-			   |		   |
-			   |		   |
-			   |---*---*---|
-			   0   1   2   3
-			  left	   right
-
-	We will fill this case like this or this depending on even or odd cuts
-
-			   |---*---*---|
-			   |   |   |   |
-			   |   |   |   |
-			   |   |   |   |
-			   |---*---*---|
-	*/
-
-	// Make side faces
-	for(i=0;i<vertsize-1;i++) {
-		hold = addfacelist(em, verts[0][i],verts[0][i+1],verts[1][vertsize-2-i],verts[1][vertsize-1-i],NULL,NULL);
-		if(i < vertsize-2) {
-			hold->e2->f2 |= EDGEINNER;
-			hold->e2->f2 |= DOUBLEOPFILL;
-		}
-		facecopy(em, efa,hold);
-	}
-}
-
-static void fill_quad_double_adj_path(EditMesh *em, EditFace *efa, struct GHash *gh, int numcuts)
-{
-	EditEdge *cedge[2]={NULL, NULL};
-	EditVert *v[4], **verts[2];
-	EditFace *hold;
-	short start=0, start2=0, vertsize,i;
-	int ctrl= 0; // XXX
-
-	v[0] = efa->v1;
-	v[1] = efa->v2;
-	v[2] = efa->v3;
-	v[3] = efa->v4;
-
-	if(efa->e1->f & SELECT && efa->e2->f & SELECT) {cedge[0] = efa->e1;  cedge[1] = efa->e2; start = 0; start2 = 1;}
-	if(efa->e2->f & SELECT && efa->e3->f & SELECT) {cedge[0] = efa->e2;  cedge[1] = efa->e3; start = 1; start2 = 2;}
-	if(efa->e3->f & SELECT && efa->e4->f & SELECT) {cedge[0] = efa->e3;  cedge[1] = efa->e4; start = 2; start2 = 3;}
-	if(efa->e4->f & SELECT && efa->e1->f & SELECT) {cedge[0] = efa->e4;  cedge[1] = efa->e1; start = 3; start2 = 0;}
-
-	// Point verts[0] and [1] to the array of new verts for cedge[0] and cedge[1]
-	verts[0] = BLI_ghash_lookup(gh, cedge[0]);
-	verts[1] = BLI_ghash_lookup(gh, cedge[1]);
-	//This is the index size of the verts array
-	vertsize = numcuts+2;
-
-	// Is the original v1 the same as the first vert on the selected edge?
-	// if not, the edge is running the opposite direction in this face so flip
-	// the array to the correct direction
-
-	if(verts[0][0] != v[start]) {flipvertarray(verts[0],numcuts+2);}
-	if(verts[1][0] != v[start2]) {flipvertarray(verts[1],numcuts+2);}
-	/*
-	We should have something like this now
-
-			   end		 start
-				3   2   1   0
-		start2 0|---*---*---|
-				|		   |
-			   1*		   |
-				|		   |
-			   2*		   |
-				|		   |
-		 end2  3|-----------|
-
-	We will fill this case like this or this depending on even or odd cuts
-			   |---*---*---|
-			   | /   /   / |
-			   *   /   /   |
-			   | /   /	 |
-			   *   /	   |
-			   | /		 |
-			   |-----------|
-	*/
-
-	// Make outside tris
-	hold = addfacelist(em, verts[0][vertsize-2],verts[0][vertsize-1],verts[1][1],NULL,NULL,NULL);
-	/* when ctrl is depressed, only want verts on the cutline selected */
-	if (ctrl)
-		hold->e3->f2 |= EDGEINNER;
-	facecopy(em, efa,hold);
-	hold = addfacelist(em, verts[0][0],verts[1][vertsize-1],v[(start2+2)%4],NULL,NULL,NULL);
-	/* when ctrl is depressed, only want verts on the cutline selected */
-	if (ctrl)
-		hold->e1->f2 |= EDGEINNER;
-	facecopy(em, efa,hold);
-	//if(scene->toolsettings->editbutflag & B_AUTOFGON) {
-	//	hold->e1->h |= EM_FGON;
-	//}
-	// Make side faces
-
-	for(i=0;i<numcuts;i++) {
-		hold = addfacelist(em, verts[0][i],verts[0][i+1],verts[1][vertsize-1-(i+1)],verts[1][vertsize-1-i],NULL,NULL);
-		hold->e2->f2 |= EDGEINNER;
-		facecopy(em, efa,hold);
-	}
-	//EM_fgon_flags(em);
-
-}
-
-static void fill_quad_double_adj_fan(EditMesh *em, EditFace *efa, struct GHash *gh, int numcuts)
-{
-	EditEdge *cedge[2]={NULL, NULL};
-	EditVert *v[4], *op=NULL, **verts[2];
-	EditFace *hold;
-	short start=0, start2=0, /* vertsize, */ /* UNUSED */ i;
-
-	v[0] = efa->v1;
-	v[1] = efa->v2;
-	v[2] = efa->v3;
-	v[3] = efa->v4;
-
-	if(efa->e1->f & SELECT && efa->e2->f & SELECT) {cedge[0] = efa->e1;  cedge[1] = efa->e2; start = 0; start2 = 1; op = efa->v4;}
-	if(efa->e2->f & SELECT && efa->e3->f & SELECT) {cedge[0] = efa->e2;  cedge[1] = efa->e3; start = 1; start2 = 2; op = efa->v1;}
-	if(efa->e3->f & SELECT && efa->e4->f & SELECT) {cedge[0] = efa->e3;  cedge[1] = efa->e4; start = 2; start2 = 3; op = efa->v2;}
-	if(efa->e4->f & SELECT && efa->e1->f & SELECT) {cedge[0] = efa->e4;  cedge[1] = efa->e1; start = 3; start2 = 0; op = efa->v3;}
-
-
-	// Point verts[0] and [1] to the array of new verts for cedge[0] and cedge[1]
-	verts[0] = BLI_ghash_lookup(gh, cedge[0]);
-	verts[1] = BLI_ghash_lookup(gh, cedge[1]);
-	//This is the index size of the verts array
-	/* vertsize = numcuts+2; */ /* UNUSED */
-
-	// Is the original v1 the same as the first vert on the selected edge?
-	// if not, the edge is running the opposite direction in this face so flip
-	// the array to the correct direction
-
-	if(verts[0][0] != v[start]) {flipvertarray(verts[0],numcuts+2);}
-	if(verts[1][0] != v[start2]) {flipvertarray(verts[1],numcuts+2);}
-	/*
-	We should have something like this now
-
-			   end		 start
-				3   2   1   0
-		start2 0|---*---*---|
-				|		   |
-			   1*		   |
-				|		   |
-			   2*		   |
-				|		   |
-		 end2  3|-----------|op
-
-	We will fill this case like this or this (warning horrible ascii art follows)
-			   |---*---*---|
-			   | \  \   \  |
-			   *---\  \  \ |
-			   |   \ \ \  \|
-			   *---- \ \  \ |
-			   |    ---  \\\|
-			   |-----------|
-	*/
-
-	for(i=0;i<=numcuts;i++) {
-		hold = addfacelist(em, op,verts[1][numcuts-i],verts[1][numcuts-i+1],NULL,NULL,NULL);
-		hold->e1->f2 |= EDGEINNER;
-		facecopy(em, efa,hold);
-
-		hold = addfacelist(em, op,verts[0][i],verts[0][i+1],NULL,NULL,NULL);
-		hold->e3->f2 |= EDGEINNER;
-		facecopy(em, efa,hold);
-	}
-}
-
-static void fill_quad_double_adj_inner(EditMesh *em, EditFace *efa, struct GHash *gh, int numcuts)
-{
-	EditEdge *cedge[2]={NULL, NULL};
-	EditVert *v[4], *op=NULL, **verts[2],**inner;
-	EditFace *hold;
-	short start=0, start2=0, /* vertsize, */ /* UNUSED */ i;
-	float co[3];
-
-	v[0] = efa->v1;
-	v[1] = efa->v2;
-	v[2] = efa->v3;
-	v[3] = efa->v4;
-
-	if(efa->e1->f & SELECT && efa->e2->f & SELECT) {cedge[0] = efa->e1;  cedge[1] = efa->e2; start = 0; start2 = 1; op = efa->v4;}
-	if(efa->e2->f & SELECT && efa->e3->f & SELECT) {cedge[0] = efa->e2;  cedge[1] = efa->e3; start = 1; start2 = 2; op = efa->v1;}
-	if(efa->e3->f & SELECT && efa->e4->f & SELECT) {cedge[0] = efa->e3;  cedge[1] = efa->e4; start = 2; start2 = 3; op = efa->v2;}
-	if(efa->e4->f & SELECT && efa->e1->f & SELECT) {cedge[0] = efa->e4;  cedge[1] = efa->e1; start = 3; start2 = 0; op = efa->v3;}
-
-
-	// Point verts[0] and [1] to the array of new verts for cedge[0] and cedge[1]
-	verts[0] = BLI_ghash_lookup(gh, cedge[0]);
-	verts[1] = BLI_ghash_lookup(gh, cedge[1]);
-	//This is the index size of the verts array
-	/* vertsize = numcuts+2; */ /* UNUSED */
-
-	// Is the original v1 the same as the first vert on the selected edge?
-	// if not, the edge is running the opposite direction in this face so flip
-	// the array to the correct direction
-
-	if(verts[0][0] != v[start]) {flipvertarray(verts[0],numcuts+2);}
-	if(verts[1][0] != v[start2]) {flipvertarray(verts[1],numcuts+2);}
-	/*
-	We should have something like this now
-
-			   end		 start
-				3   2   1   0
-		start2 0|---*---*---|
-				|		   |
-			   1*		   |
-				|		   |
-			   2*		   |
-				|		   |
-		 end2  3|-----------|op
-
-	We will fill this case like this or this (warning horrible ascii art follows)
-			   |---*-----*---|
-			   | *     /     |
-			   *   \ /       |
-			   |    *        |
-			   | /	  \	     |
-			   *        \    |
-			   |           \ |
-			   |-------------|
-	*/
-
-	// Add Inner Vert(s)
-	inner = MEM_mallocN(sizeof(EditVert*)*numcuts,"New inner verts");
-
-	for(i=0;i<numcuts;i++) {
-		co[0] = (verts[0][numcuts-i]->co[0] + verts[1][i+1]->co[0] ) / 2 ;
-		co[1] = (verts[0][numcuts-i]->co[1] + verts[1][i+1]->co[1] ) / 2 ;
-		co[2] = (verts[0][numcuts-i]->co[2] + verts[1][i+1]->co[2] ) / 2 ;
-		inner[i] = addvertlist(em, co, NULL);
-		inner[i]->f2 |= EDGEINNER;
-
-		EM_data_interp_from_verts(em, verts[0][numcuts-i], verts[1][i+1], inner[i], 0.5f);
-	}
-
-	// Add Corner Quad
-	hold = addfacelist(em, verts[0][numcuts+1],verts[1][1],inner[0],verts[0][numcuts],NULL,NULL);
-	hold->e2->f2 |= EDGEINNER;
-	hold->e3->f2 |= EDGEINNER;
-	facecopy(em, efa,hold);
-	// Add Bottom Quads
-	hold = addfacelist(em, verts[0][0],verts[0][1],inner[numcuts-1],op,NULL,NULL);
-	hold->e2->f2 |= EDGEINNER;
-	facecopy(em, efa,hold);
-
-	hold = addfacelist(em, op,inner[numcuts-1],verts[1][numcuts],verts[1][numcuts+1],NULL,NULL);
-	hold->e2->f2 |= EDGEINNER;
-	facecopy(em, efa,hold);
-
-	//if(scene->toolsettings->editbutflag & B_AUTOFGON) {
-	//	hold->e1->h |= EM_FGON;
-	//}
-	// Add Fill Quads (if # cuts > 1)
-
-	for(i=0;i<numcuts-1;i++) {
-		hold = addfacelist(em, inner[i],verts[1][i+1],verts[1][i+2],inner[i+1],NULL,NULL);
-		hold->e1->f2 |= EDGEINNER;
-		hold->e3->f2 |= EDGEINNER;
-		facecopy(em, efa,hold);
-
-		hold = addfacelist(em, inner[i],inner[i+1],verts[0][numcuts-1-i],verts[0][numcuts-i],NULL,NULL);
-		hold->e2->f2 |= EDGEINNER;
-		hold->e4->f2 |= EDGEINNER;
-		facecopy(em, efa,hold);
-
-		//if(scene->toolsettings->editbutflag & B_AUTOFGON) {
-		//	hold->e1->h |= EM_FGON;
-		//}
-	}
-
-	//EM_fgon_flags(em);
-
-	MEM_freeN(inner);
-}
-
-static void fill_tri_double(EditMesh *em, EditFace *efa, struct GHash *gh, int numcuts)
-{
-	EditEdge *cedge[2]={NULL, NULL};
-	EditVert *v[3], **verts[2];
-	EditFace *hold;
-	short start=0, start2=0, vertsize,i;
-
-	v[0] = efa->v1;
-	v[1] = efa->v2;
-	v[2] = efa->v3;
-
-	if(efa->e1->f & SELECT && efa->e2->f & SELECT) {cedge[0] = efa->e1;  cedge[1] = efa->e2; start = 0; start2 = 1;}
-	if(efa->e2->f & SELECT && efa->e3->f & SELECT) {cedge[0] = efa->e2;  cedge[1] = efa->e3; start = 1; start2 = 2;}
-	if(efa->e3->f & SELECT && efa->e1->f & SELECT) {cedge[0] = efa->e3;  cedge[1] = efa->e1; start = 2; start2 = 0;}
-
-	// Point verts[0] and [1] to the array of new verts for cedge[0] and cedge[1]
-	verts[0] = BLI_ghash_lookup(gh, cedge[0]);
-	verts[1] = BLI_ghash_lookup(gh, cedge[1]);
-	//This is the index size of the verts array
-	vertsize = numcuts+2;
-
-	// Is the original v1 the same as the first vert on the selected edge?
-	// if not, the edge is running the opposite direction in this face so flip
-	// the array to the correct direction
-
-	if(verts[0][0] != v[start]) {flipvertarray(verts[0],numcuts+2);}
-	if(verts[1][0] != v[start2]) {flipvertarray(verts[1],numcuts+2);}
-	/*
-	We should have something like this now
-
-			   end		 start
-				3   2   1   0
-		start2 0|---*---*---|
-				|		 /
-			   1*	   /
-				|	 /
-			   2*   /
-				| /
-		 end2  3|
-
-	We will fill this case like this or this depending on even or odd cuts
-			   |---*---*---|
-			   | /   /   /
-			   *   /   /
-			   | /   /
-			   *   /
-			   | /
-			   |
-	*/
-
-	// Make outside tri
-	hold = addfacelist(em, verts[0][vertsize-2],verts[0][vertsize-1],verts[1][1],NULL,NULL,NULL);
-	hold->e3->f2 |= EDGEINNER;
-	facecopy(em, efa,hold);
-	// Make side faces
-
-	for(i=0;i<numcuts;i++) {
-		hold = addfacelist(em, verts[0][i],verts[0][i+1],verts[1][vertsize-1-(i+1)],verts[1][vertsize-1-i],NULL,NULL);
-		hold->e2->f2 |= EDGEINNER;
-		facecopy(em, efa,hold);
-	}
-}
-
-static void fill_quad_triple(EditMesh *em, EditFace *efa, struct GHash *gh, int numcuts)
-{
-	EditEdge *cedge[3]={0};
-	EditVert *v[4], **verts[3];
-	EditFace *hold;
-	short start=0, start2=0, start3=0, vertsize, i, repeats;
-
-	v[0] = efa->v1;
-	v[1] = efa->v2;
-	v[2] = efa->v3;
-	v[3] = efa->v4;
-
-	if(!(efa->e1->f & SELECT)) {
-		cedge[0] = efa->e2;
-		cedge[1] = efa->e3;
-		cedge[2] = efa->e4;
-		start = 1;start2 = 2;start3 = 3;
-	}
-	if(!(efa->e2->f & SELECT)) {
-		cedge[0] = efa->e3;
-		cedge[1] = efa->e4;
-		cedge[2] = efa->e1;
-		start = 2;start2 = 3;start3 = 0;
-	}
-	if(!(efa->e3->f & SELECT)) {
-		cedge[0] = efa->e4;
-		cedge[1] = efa->e1;
-		cedge[2] = efa->e2;
-		start = 3;start2 = 0;start3 = 1;
-	}
-	if(!(efa->e4->f & SELECT)) {
-		cedge[0] = efa->e1;
-		cedge[1] = efa->e2;
-		cedge[2] = efa->e3;
-		start = 0;start2 = 1;start3 = 2;
-	}
-	// Point verts[0] and [1] to the array of new verts for cedge[0] and cedge[1]
-	verts[0] = BLI_ghash_lookup(gh, cedge[0]);
-	verts[1] = BLI_ghash_lookup(gh, cedge[1]);
-	verts[2] = BLI_ghash_lookup(gh, cedge[2]);
-	//This is the index size of the verts array
-	vertsize = numcuts+2;
-
-	// Is the original v1 the same as the first vert on the selected edge?
-	// if not, the edge is running the opposite direction in this face so flip
-	// the array to the correct direction
-
-	if(verts[0][0] != v[start]) {flipvertarray(verts[0],numcuts+2);}
-	if(verts[1][0] != v[start2]) {flipvertarray(verts[1],numcuts+2);}
-	if(verts[2][0] != v[start3]) {flipvertarray(verts[2],numcuts+2);}
-	/*
-	 We should have something like this now
-
-	 start2
-	 3   2   1   0
-	 start3 0|---*---*---|3
-	 |		   |
-	 1*		   *2
-	 |		   |
-	 2*		   *1
-	 |		   |
-	 3|-----------|0 start
-
-	 We will fill this case like this or this depending on even or odd cuts
-	 there are a couple of differences. For odd cuts, there is a tri in the
-	 middle as well as 1 quad at the bottom (not including the extra quads
-	 for odd cuts > 1
-
-	 For even cuts, there is a quad in the middle and 2 quads on the bottom
-
-	 they are numbered here for clarity
-
-	 1 outer tris and bottom quads
-	 2 inner tri or quad
-	 3 repeating quads
-
-	 |---*---*---*---|
-	 |1/   /  \   \ 1|
-	 |/ 3 /	\  3 \|
-	 *  /	2   \   *
-	 | /		  \  |
-	 |/			\ |
-	 *---------------*
-	 |	  3		|
-	 |			   |
-	 *---------------*
-	 |			   |
-	 |	  1		|
-	 |			   |
-	 |---------------|
-
-	 |---*---*---*---*---|
-	 | 1/   /	 \   \ 1|
-	 | /   /	   \   \ |
-	 |/ 3 /		 \ 3 \|
-	 *   /		   \   *
-	 |  /			 \  |
-	 | /	   2	   \ |
-	 |/				 \|
-	 *-------------------*
-	 |				   |
-	 |		 3		 |
-	 |				   |
-	 *-------------------*
-	 |				   |
-	 |		 1		 |
-	 |				   |
-	 *-------------------*
-	 |				   |
-	 |		1		  |
-	 |				   |
-	 |-------------------|
-
-	 */
 
-	// Make outside tris
-	hold = addfacelist(em, verts[0][vertsize-2],verts[0][vertsize-1],verts[1][1],NULL,NULL,NULL);
-	hold->e3->f2 |= EDGEINNER;
-	facecopy(em, efa,hold);
-	hold = addfacelist(em, verts[1][vertsize-2],verts[1][vertsize-1],verts[2][1],NULL,NULL,NULL);
-	hold->e3->f2 |= EDGEINNER;
-	facecopy(em, efa,hold);
-	// Make bottom quad
-	hold = addfacelist(em, verts[0][0],verts[0][1],verts[2][vertsize-2],verts[2][vertsize-1],NULL,NULL);
-	hold->e2->f2 |= EDGEINNER;
-	facecopy(em, efa,hold);
-	//If it is even cuts, add the 2nd lower quad
-	if(numcuts % 2 == 0) {
-		hold = addfacelist(em, verts[0][1],verts[0][2],verts[2][vertsize-3],verts[2][vertsize-2],NULL,NULL);
-		hold->e2->f2 |= EDGEINNER;
-		facecopy(em, efa,hold);
-		// Also Make inner quad
-		hold = addfacelist(em, verts[1][numcuts/2],verts[1][(numcuts/2)+1],verts[2][numcuts/2],verts[0][(numcuts/2)+1],NULL,NULL);
-		hold->e3->f2 |= EDGEINNER;
-		//if(scene->toolsettings->editbutflag & B_AUTOFGON) {
-		//	hold->e3->h |= EM_FGON;
-		//}
-		facecopy(em, efa,hold);
-		repeats = (numcuts / 2) -1;
-	} else {
-		// Make inner tri
-		hold = addfacelist(em, verts[1][(numcuts/2)+1],verts[2][(numcuts/2)+1],verts[0][(numcuts/2)+1],NULL,NULL,NULL);
-		hold->e2->f2 |= EDGEINNER;
-		//if(scene->toolsettings->editbutflag & B_AUTOFGON) {
-		//	hold->e2->h |= EM_FGON;
-		//}
-		facecopy(em, efa,hold);
-		repeats = ((numcuts+1) / 2)-1;
-	}
-
-	// cuts for 1 and 2 do not have the repeating quads
-	if(numcuts < 3) {repeats = 0;}
-	for(i=0;i<repeats;i++) {
-		//Make side repeating Quads
-		hold = addfacelist(em, verts[1][i+1],verts[1][i+2],verts[0][vertsize-i-3],verts[0][vertsize-i-2],NULL,NULL);
-		hold->e2->f2 |= EDGEINNER;
-		facecopy(em, efa,hold);
-		hold = addfacelist(em, verts[1][vertsize-i-3],verts[1][vertsize-i-2],verts[2][i+1],verts[2][i+2],NULL,NULL);
-		hold->e4->f2 |= EDGEINNER;
-		facecopy(em, efa,hold);
-	}
-	// Do repeating bottom quads
-	for(i=0;i<repeats;i++) {
-		if(numcuts % 2 == 1) {
-			hold = addfacelist(em, verts[0][1+i],verts[0][2+i],verts[2][vertsize-3-i],verts[2][vertsize-2-i],NULL,NULL);
-		} else {
-			hold = addfacelist(em, verts[0][2+i],verts[0][3+i],verts[2][vertsize-4-i],verts[2][vertsize-3-i],NULL,NULL);
-		}
-		hold->e2->f2 |= EDGEINNER;
-		facecopy(em, efa,hold);
-	}
-	//EM_fgon_flags(em);
-}
-
-static void fill_quad_quadruple(EditMesh *em, EditFace *efa, struct GHash *gh, int numcuts, float smooth, float fractal, int beauty)
-{
-	EditVert **verts[4], ***innerverts;
-	EditFace *hold;
-	EditEdge temp;
-	short /* vertsize, */ /* UNUSED */ i, j;
-
-	// Point verts[0] and [1] to the array of new verts for cedge[0] and cedge[1]
-	verts[0] = BLI_ghash_lookup(gh, efa->e1);
-	verts[1] = BLI_ghash_lookup(gh, efa->e2);
-	verts[2] = BLI_ghash_lookup(gh, efa->e3);
-	verts[3] = BLI_ghash_lookup(gh, efa->e4);
-
-	//This is the index size of the verts array
-	/* vertsize = numcuts+2; */ /* UNUSED */
-
-	// Is the original v1 the same as the first vert on the selected edge?
-	// if not, the edge is running the opposite direction in this face so flip
-	// the array to the correct direction
-
-	if(verts[0][0] != efa->v1) {flipvertarray(verts[0],numcuts+2);}
-	if(verts[1][0] != efa->v2) {flipvertarray(verts[1],numcuts+2);}
-	if(verts[2][0] == efa->v3) {flipvertarray(verts[2],numcuts+2);}
-	if(verts[3][0] == efa->v4) {flipvertarray(verts[3],numcuts+2);}
-	/*
-	We should have something like this now
-					  1
-
-				3   2   1   0
-			   0|---*---*---|0
-				|           |
-			   1*           *1
-			 2  |           |   4
-			   2*           *2
-				|           |
-			   3|---*---*---|3
-				3   2   1   0
-
-					  3
-	// we will fill a 2 dim array of editvert*s to make filling easier
-	//  the innervert order is shown
-
-				0   0---1---2---3
-					|   |   |   |
-				1   0---1---2---3
-					|   |   |   |
-				2   0---1---2---3
-					|   |   |   |
-				3   0---1---2---3
-
-	 */
-	innerverts = MEM_mallocN(sizeof(EditVert*)*(numcuts+2),"quad-quad subdiv inner verts outer array");
-	for(i=0;i<numcuts+2;i++) {
-		innerverts[i] = MEM_mallocN(sizeof(EditVert*)*(numcuts+2),"quad-quad subdiv inner verts inner array");
+static int edbm_vert_connect(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMesh *bm = em->bm;
+	BMOperator bmop;
+	int len = 0;
+	
+	if (!EDBM_op_init(em, &bmop, op, "connectverts verts=%hv", BM_ELEM_SELECT)) {
+		return OPERATOR_CANCELLED;
 	}
-
-	// first row is e1 last row is e3
-	for(i=0;i<numcuts+2;i++) {
-		innerverts[0][i]		  = verts[0][(numcuts+1)-i];
-		innerverts[numcuts+1][i]  = verts[2][(numcuts+1)-i];
+	BMO_op_exec(bm, &bmop);
+	len = BMO_slot_get(&bmop, "edgeout")->len;
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+		return OPERATOR_CANCELLED;
 	}
+	
+	EDBM_update_generic(C, em, TRUE);
 
-	for(i=1;i<=numcuts;i++) {
-		/* we create a fake edge for the next loop */
-		temp.v2 = innerverts[i][0]			= verts[1][i];
-		temp.v1 = innerverts[i][numcuts+1]  = verts[3][i];
-
-		for(j=1;j<=numcuts;j++) {
-			float percent= (float)j/(float)(numcuts+1);
-
-			innerverts[i][(numcuts+1)-j]= subdivide_edge_addvert(em, &temp, smooth, fractal, beauty, percent);
-		}
-	}
-	// Fill with faces
-	for(i=0;i<numcuts+1;i++) {
-		for(j=0;j<numcuts+1;j++) {
-			hold = addfacelist(em, innerverts[i][j+1],innerverts[i][j],innerverts[i+1][j],innerverts[i+1][j+1],NULL,NULL);
-			hold->e1->f2 = EDGENEW;
-			hold->e2->f2 = EDGENEW;
-			hold->e3->f2 = EDGENEW;
-			hold->e4->f2 = EDGENEW;
-
-			if(i != 0) { hold->e1->f2 |= EDGEINNER; }
-			if(j != 0) { hold->e2->f2 |= EDGEINNER; }
-			if(i != numcuts) { hold->e3->f2 |= EDGEINNER; }
-			if(j != numcuts) { hold->e4->f2 |= EDGEINNER; }
-
-			facecopy(em, efa,hold);
-		}
-	}
-	// Clean up our dynamic multi-dim array
-	for(i=0;i<numcuts+2;i++) {
-		MEM_freeN(innerverts[i]);
-	}
-	MEM_freeN(innerverts);
+	return len ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
 }
 
-static void fill_tri_triple(EditMesh *em, EditFace *efa, struct GHash *gh, int numcuts, float smooth, float fractal, int beauty)
+void MESH_OT_vert_connect(wmOperatorType *ot)
 {
-	EditVert **verts[3], ***innerverts;
-	short /* vertsize, */ /* UNUSED */ i, j;
-	EditFace *hold;
-	EditEdge temp;
-
-	// Point verts[0] and [1] to the array of new verts for cedge[0] and cedge[1]
-	verts[0] = BLI_ghash_lookup(gh, efa->e1);
-	verts[1] = BLI_ghash_lookup(gh, efa->e2);
-	verts[2] = BLI_ghash_lookup(gh, efa->e3);
-
-	//This is the index size of the verts array
-	/* vertsize = numcuts+2; */ /* UNUSED */
-
-	// Is the original v1 the same as the first vert on the selected edge?
-	// if not, the edge is running the opposite direction in this face so flip
-	// the array to the correct direction
-
-	if(verts[0][0] != efa->v1) {flipvertarray(verts[0],numcuts+2);}
-	if(verts[1][0] != efa->v2) {flipvertarray(verts[1],numcuts+2);}
-	if(verts[2][0] != efa->v3) {flipvertarray(verts[2],numcuts+2);}
-	/*
-	We should have something like this now
-					   3
-
-				3   2   1   0
-			   0|---*---*---|3
-				|		  /
-		  1	1*		*2
-				|	  /
-			   2*	*1	   2
-				|  /
-			   3|/
-				 0
-
-	we will fill a 2 dim array of editvert*s to make filling easier
-
-						3
-
-			 0  0---1---2---3---4
-				| / | /  |/  | /
-			 1  0---1----2---3
-	   1		| /  | / | /
-			 2  0----1---2	 2
-				|  / |  /
-				|/   |/
-			 3  0---1
-				|  /
-				|/
-			 4  0
-
-	*/
-
-	innerverts = MEM_mallocN(sizeof(EditVert*)*(numcuts+2),"tri-tri subdiv inner verts outer array");
-	for(i=0;i<numcuts+2;i++) {
-		  innerverts[i] = MEM_mallocN(sizeof(EditVert*)*((numcuts+2)-i),"tri-tri subdiv inner verts inner array");
-	}
-	//top row is e3 backwards
-	for(i=0;i<numcuts+2;i++) {
-		  innerverts[0][i]		  = verts[2][(numcuts+1)-i];
-	}
-
-	for(i=1;i<=numcuts+1;i++) {
-		//fake edge, first vert is from e1, last is from e2
-		temp.v1= innerverts[i][0]			  = verts[0][i];
-		temp.v2= innerverts[i][(numcuts+1)-i]  = verts[1][(numcuts+1)-i];
-
-		for(j=1;j<(numcuts+1)-i;j++) {
-			float percent= (float)j/(float)((numcuts+1)-i);
+	/* identifiers */
+	ot->name = "Vertex Connect";
+	ot->idname = "MESH_OT_vert_connect";
+	ot->description = "Connect 2 vertices of a face by an edge, splitting the face in two";
+	
+	/* api callbacks */
+	ot->exec = edbm_vert_connect;
+	ot->poll = ED_operator_editmesh;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
 
-			innerverts[i][((numcuts+1)-i)-j]= subdivide_edge_addvert(em, &temp, smooth, fractal, beauty, 1-percent);
-		}
+static int edbm_edge_split_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMesh *bm = em->bm;
+	BMOperator bmop;
+	int len = 0;
+	
+	if (!EDBM_op_init(em, &bmop, op, "edgesplit edges=%he", BM_ELEM_SELECT)) {
+		return OPERATOR_CANCELLED;
 	}
-
-	// Now fill the verts with happy little tris :)
-	for(i=0;i<=numcuts+1;i++) {
-		for(j=0;j<(numcuts+1)-i;j++) {
-			//We always do the first tri
-			hold = addfacelist(em, innerverts[i][j+1],innerverts[i][j],innerverts[i+1][j],NULL,NULL,NULL);
-			hold->e1->f2 |= EDGENEW;
-			hold->e2->f2 |= EDGENEW;
-			hold->e3->f2 |= EDGENEW;
-			if(i != 0) { hold->e1->f2 |= EDGEINNER; }
-			if(j != 0) { hold->e2->f2 |= EDGEINNER; }
-			if(j+1 != (numcuts+1)-i) {hold->e3->f2 |= EDGEINNER;}
-
-			facecopy(em, efa,hold);
-			//if there are more to come, we do the 2nd
-			if(j+1 <= numcuts-i) {
-				hold = addfacelist(em, innerverts[i+1][j],innerverts[i+1][j+1],innerverts[i][j+1],NULL,NULL,NULL);
-				facecopy(em, efa,hold);
-				hold->e1->f2 |= EDGENEW;
-				hold->e2->f2 |= EDGENEW;
-				hold->e3->f2 |= EDGENEW;
-			}
-		}
+	BMO_op_exec(bm, &bmop);
+	len = BMO_slot_get(&bmop, "edgeout")->len;
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+		return OPERATOR_CANCELLED;
 	}
+	
+	EDBM_update_generic(C, em, TRUE);
 
-	// Clean up our dynamic multi-dim array
-	for(i=0;i<numcuts+2;i++) {
-		MEM_freeN(innerverts[i]);
-	}
-	MEM_freeN(innerverts);
-}
-
-//Next two fill types are for knife exact only and are provided to allow for knifing through vertices
-//This means there is no multicut!
-static void fill_quad_doublevert(EditMesh *em, EditFace *efa, int v1, int v2)
-{
-	EditFace *hold;
-	/*
-		Depending on which two vertices have been knifed through (v1 and v2), we
-		triangulate like the patterns below.
-				X-------|	|-------X
-				| \  	|	|     / |
-				|   \	|	|   /	|
-				|	  \	|	| /	    |
-				--------X	X--------
-	*/
-
-	if(v1 == 1 && v2 == 3){
-		hold= addfacelist(em, efa->v1, efa->v2, efa->v3, 0, efa, NULL);
-		hold->e1->f2 |= EDGENEW;
-		hold->e2->f2 |= EDGENEW;
-		hold->e3->f2 |= EDGENEW;
-		hold->e3->f2 |= EDGEINNER;
-		facecopy(em, efa, hold);
-
-		hold= addfacelist(em, efa->v1, efa->v3, efa->v4, 0, efa, NULL);
-		hold->e1->f2 |= EDGENEW;
-		hold->e2->f2 |= EDGENEW;
-		hold->e3->f2 |= EDGENEW;
-		hold->e1->f2 |= EDGEINNER;
-		facecopy(em, efa, hold);
-	}
-	else{
-		hold= addfacelist(em, efa->v1, efa->v2, efa->v4, 0, efa, NULL);
-		hold->e1->f2 |= EDGENEW;
-		hold->e2->f2 |= EDGENEW;
-		hold->e3->f2 |= EDGENEW;
-		hold->e2->f2 |= EDGEINNER;
-		facecopy(em, efa, hold);
-
-		hold= addfacelist(em, efa->v2, efa->v3, efa->v4, 0, efa, NULL);
-		hold->e1->f2 |= EDGENEW;
-		hold->e2->f2 |= EDGENEW;
-		hold->e3->f2 |= EDGENEW;
-		hold->e3->f2 |= EDGEINNER;
-		facecopy(em, efa, hold);
-	}
-}
-
-static void fill_quad_singlevert(EditMesh *em, EditFace *efa, struct GHash *gh)
-{
-	EditEdge *cedge=NULL;
-	EditVert *v[4], **verts;
-	EditFace *hold;
-	short start=0, end, left, right /* , vertsize */ /* UNUSED */;
-
-	v[0] = efa->v1;
-	v[1] = efa->v2;
-	v[2] = efa->v3;
-	v[3] = efa->v4;
-
-	if(efa->e1->f & SELECT)	  { cedge = efa->e1; start = 0;}
-	else if(efa->e2->f & SELECT) { cedge = efa->e2; start = 1;}
-	else if(efa->e3->f & SELECT) { cedge = efa->e3; start = 2;}
-	else if(efa->e4->f & SELECT) { cedge = efa->e4; start = 3;}
-
-	// Point verts to the array of new verts for cedge
-	verts = BLI_ghash_lookup(gh, cedge);
-	//This is the index size of the verts array
-	/* vertsize = 3; */ /* UNUSED */
-
-	// Is the original v1 the same as the first vert on the selected edge?
-	// if not, the edge is running the opposite direction in this face so flip
-	// the array to the correct direction
-
-	if(verts[0] != v[start]) {flipvertarray(verts,3);}
-	end	= (start+1)%4;
-	left   = (start+2)%4;
-	right  = (start+3)%4;
-
-/*
-	We should have something like this now
-
-			  end		 start
-			   2     1     0
-			   |-----*-----|
-			   |		   |
-			   |		   |
-			   |		   |
-			   -------------
-			  left	   right
-
-	where start,end,left, right are indexes of EditFace->v1, etc (stored in v)
-	and 0,1,2 are the indexes of the new verts stored in verts. We fill like
-	this, depending on whether its vertex 'left' or vertex 'right' thats
-	been knifed through...
-
-				|---*---|	|---*---|
-				|  /	|	|    \  |
-				| /		|	|	  \ |
-				|/		|	|	   \|
-				X--------	--------X
-*/
-
-	if(v[left]->f1){
-		//triangle is composed of cutvert, end and left
-		hold = addfacelist(em, verts[1],v[end],v[left],NULL, NULL,NULL);
-		hold->e1->f2 |= EDGENEW;
-		hold->e2->f2 |= EDGENEW;
-		hold->e3->f2 |= EDGENEW;
-		hold->e3->f2 |= EDGEINNER;
-		facecopy(em, efa, hold);
-
-		//quad is composed of cutvert, left, right and start
-		hold = addfacelist(em, verts[1],v[left],v[right],v[start], NULL, NULL);
-		hold->e1->f2 |= EDGENEW;
-		hold->e2->f2 |= EDGENEW;
-		hold->e3->f2 |= EDGENEW;
-		hold->e4->f2 |= EDGENEW;
-		hold->e1->f2 |= EDGEINNER;
-		facecopy(em, efa, hold);
-	}
-	else if(v[right]->f1){
-		//triangle is composed of cutvert, right and start
-		hold = addfacelist(em, verts[1],v[right],v[start], NULL, NULL, NULL);
-		hold->e1->f2 |= EDGENEW;
-		hold->e2->f2 |= EDGENEW;
-		hold->e3->f2 |= EDGENEW;
-		hold->e1->f2 |= EDGEINNER;
-		facecopy(em, efa, hold);
-		//quad is composed of cutvert, end, left, right
-		hold = addfacelist(em, verts[1],v[end], v[left], v[right], NULL, NULL);
-		hold->e1->f2 |= EDGENEW;
-		hold->e2->f2 |= EDGENEW;
-		hold->e3->f2 |= EDGENEW;
-		hold->e4->f2 |= EDGENEW;
-		hold->e4->f2 |= EDGEINNER;
-		facecopy(em, efa, hold);
-	}
-
-}
-
-// This function takes an example edge, the current point to create and
-// the total # of points to create, then creates the point and return the
-// editvert pointer to it.
-static EditVert *subdivideedgenum(EditMesh *em, EditEdge *edge, int curpoint, int totpoint, float smooth, float fractal, int beauty)
-{
-	EditVert *ev;
-	float percent;
-
-	if (beauty & (B_PERCENTSUBD) && totpoint == 1)
-		//percent=(float)(edge->tmp.l)/32768.0f;
-		percent= edge->tmp.fp;
-	else
-		percent= (float)curpoint/(float)(totpoint+1);
-
-	ev= subdivide_edge_addvert(em, edge, smooth, fractal, beauty, percent);
-	ev->f = edge->v1->f;
-
-	return ev;
-}
-
-void esubdivideflag(Object *obedit, EditMesh *em, int flag, float smooth, float fractal, int beauty, int numcuts, int corner_pattern, int seltype)
-{
-	EditFace *ef;
-	EditEdge *eed, *cedge, *sort[4];
-	EditVert *eve, **templist;
-	struct GHash *gh;
-	float length[4], v1mat[3], v2mat[3], v3mat[3], v4mat[3];
-	int i, j, edgecount, touchcount, facetype,hold;
-	ModifierData *md= obedit->modifiers.first;
-	int ctrl= 0; // XXX
+	return len ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
+}
 
-	//Set faces f1 to 0 cause we need it later
-	for(ef=em->faces.first;ef;ef = ef->next) ef->f1 = 0;
-	for(eve=em->verts.first; eve; eve=eve->next) {
-		if(!(beauty & B_KNIFE)) /* knife sets this flag for vertex cuts */
-			eve->f1 = 0;
-		eve->f2 = 0;
-	}
+void MESH_OT_edge_split(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Edge Split";
+	ot->idname = "MESH_OT_edge_split";
+	
+	/* api callbacks */
+	ot->exec = edbm_edge_split_exec;
+	ot->poll = ED_operator_editmesh;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
 
-	for (; md; md=md->next) {
-		if ((md->type==eModifierType_Mirror) && (md->mode & eModifierMode_Realtime)) {
-			MirrorModifierData *mmd = (MirrorModifierData*) md;
+/****************** add duplicate operator ***************/
 
-			if(mmd->flag & MOD_MIR_CLIPPING) {
-				for (eve= em->verts.first; eve; eve= eve->next) {
-					eve->f2= 0;
+static int edbm_duplicate_exec(bContext *C, wmOperator *op)
+{
+	Object *ob = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(ob);
+	BMOperator bmop;
 
-					if (mmd->flag & MOD_MIR_AXIS_X && fabsf(eve->co[0]) < mmd->tolerance) eve->f2 |= 1;
-					if (mmd->flag & MOD_MIR_AXIS_Y && fabsf(eve->co[1]) < mmd->tolerance) eve->f2 |= 2;
-					if (mmd->flag & MOD_MIR_AXIS_Z && fabsf(eve->co[2]) < mmd->tolerance) eve->f2 |= 4;
+	EDBM_op_init(em, &bmop, op, "dupe geom=%hvef", BM_ELEM_SELECT);
+	
+	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);
 
-	//Flush vertex flags upward to the edges
-	for(eed = em->edges.first;eed;eed = eed->next) {
-		//if(eed->f & flag && eed->v1->f == eed->v2->f) {
-		//	eed->f |= eed->v1->f;
-		// }
-		eed->f2 = 0;
-		if(eed->f & flag) {
-			eed->f2	|= EDGEOLD;
-		}
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+		return OPERATOR_CANCELLED;
 	}
 
-	// We store an array of verts for each edge that is subdivided,
-	// we put this array as a value in a ghash which is keyed by the EditEdge*
+	EDBM_update_generic(C, em, TRUE);
+	
+	return OPERATOR_FINISHED;
+}
 
-	// Now for beauty subdivide deselect edges based on length
-	if(beauty & B_BEAUTY) {
-		for(ef = em->faces.first;ef;ef = ef->next) {
-			if(!ef->v4) {
-				continue;
-			}
-			if(ef->f & SELECT) {
-				VECCOPY(v1mat, ef->v1->co);
-				VECCOPY(v2mat, ef->v2->co);
-				VECCOPY(v3mat, ef->v3->co);
-				VECCOPY(v4mat, ef->v4->co);
-				mul_mat3_m4_v3(obedit->obmat, v1mat);
-				mul_mat3_m4_v3(obedit->obmat, v2mat);
-				mul_mat3_m4_v3(obedit->obmat, v3mat);
-				mul_mat3_m4_v3(obedit->obmat, v4mat);
-
-				length[0] = len_v3v3(v1mat, v2mat);
-				length[1] = len_v3v3(v2mat, v3mat);
-				length[2] = len_v3v3(v3mat, v4mat);
-				length[3] = len_v3v3(v4mat, v1mat);
-				sort[0] = ef->e1;
-				sort[1] = ef->e2;
-				sort[2] = ef->e3;
-				sort[3] = ef->e4;
-
-
-				// Beauty Short Edges
-				if(beauty & B_BEAUTY_SHORT) {
-					for(j=0;j<2;j++) {
-						hold = -1;
-						for(i=0;i<4;i++) {
-							if(length[i] < 0) {
-								continue;
-							} else if(hold == -1) {
-								hold = i;
-							} else {
-								if(length[hold] < length[i]) {
-									hold = i;
-								}
-							}
-						}
-						if (hold > -1) {
-							sort[hold]->f &= ~SELECT;
-							sort[hold]->f2 |= EDGENEW;
-							length[hold] = -1;
-						}
-					}
-				}
+static int edbm_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+{
+	WM_cursor_wait(1);
+	edbm_duplicate_exec(C, op);
+	WM_cursor_wait(0);
+	
+	return OPERATOR_FINISHED;
+}
 
-				// Beauty Long Edges
-				else {
-					for(j=0;j<2;j++) {
-						hold = -1;
-						for(i=0;i<4;i++) {
-							if(length[i] < 0) {
-								continue;
-							} else if(hold == -1) {
-								hold = i;
-							} else {
-								if(length[hold] > length[i]) {
-									hold = i;
-								}
-							}
-						}
-						if (hold > -1) {
-							sort[hold]->f &= ~SELECT;
-							sort[hold]->f2 |= EDGENEW;
-							length[hold] = -1;
-						}
-					}
-				}
-			}
-		}
-	}
+void MESH_OT_duplicate(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Duplicate";
+	ot->description = "Duplicate selected vertices, edges or faces";
+	ot->idname = "MESH_OT_duplicate";
+	
+	/* api callbacks */
+	ot->invoke = edbm_duplicate_invoke;
+	ot->exec = edbm_duplicate_exec;
+	
+	ot->poll = ED_operator_editmesh;
+	
+	/* to give to transform */
+	RNA_def_int(ot->srna, "mode", TFM_TRANSLATION, 0, INT_MAX, "Mode", "", 0, INT_MAX);
+}
 
-	gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "subdivideedgenum gh");
+static int edbm_flip_normals_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	
+	if (!EDBM_op_callf(em, op, "reversefaces faces=%hf", BM_ELEM_SELECT))
+		return OPERATOR_CANCELLED;
+	
+	EDBM_update_generic(C, em, TRUE);
 
-	// If we are knifing, We only need the selected edges that were cut, so deselect if it was not cut
-	if(beauty & B_KNIFE) {
-		for(eed= em->edges.first;eed;eed=eed->next) {
-			if( eed->tmp.fp == 0 ) {
-				EM_select_edge(eed,0);
-			}
-		}
-	}
-	// So for each edge, if it is selected, we allocate an array of size cuts+2
-	// so we can have a place for the v1, the new verts and v2
-	for(eed=em->edges.first;eed;eed = eed->next) {
-		if(eed->f & flag) {
-			templist = MEM_mallocN(sizeof(EditVert*)*(numcuts+2),"vertlist");
-			templist[0] = eed->v1;
-			for(i=0;i<numcuts;i++) {
-				// This function creates the new vert and returns it back
-				// to the array
-				templist[i+1] = subdivideedgenum(em, eed, i+1, numcuts, smooth, fractal, beauty);
-				//while we are here, we can copy edge info from the original edge
-				cedge = addedgelist(em, templist[i],templist[i+1],eed);
-				// Also set the edge f2 to EDGENEW so that we can use this info later
-				cedge->f2 = EDGENEW;
-			}
-			templist[i+1] = eed->v2;
-			//Do the last edge too
-			cedge = addedgelist(em, templist[i],templist[i+1],eed);
-			cedge->f2 = EDGENEW;
-			// Now that the edge is subdivided, we can put its verts in the ghash
-			BLI_ghash_insert(gh, eed, templist);
-		}
-	}
+	return OPERATOR_FINISHED;
+}
 
-//	DAG_id_tag_update(obedit->data, 0);
-	// Now for each face in the mesh we need to figure out How many edges were cut
-	// and which filling method to use for that face
-	for(ef = em->faces.first;ef;ef = ef->next) {
-		edgecount = 0;
-		facetype = 3;
-		if(ef->e1->f & flag) {edgecount++;}
-		if(ef->e2->f & flag) {edgecount++;}
-		if(ef->e3->f & flag) {edgecount++;}
-		if(ef->v4) {
-			facetype = 4;
-			if(ef->e4->f & flag) {edgecount++;}
-		}
-		if(facetype == 4) {
-			switch(edgecount) {
-				case 0:
-					if(beauty & B_KNIFE && numcuts == 1){
-						/*Test for when knifing through two opposite verts but no edges*/
-						touchcount = 0;
-						if(ef->v1->f1) touchcount++;
-						if(ef->v2->f1) touchcount++;
-						if(ef->v3->f1) touchcount++;
-						if(ef->v4->f1) touchcount++;
-						if(touchcount == 2){
-							if(ef->v1->f1 && ef->v3->f1){
-								ef->f1 = SELECT;
-								fill_quad_doublevert(em, ef, 1, 3);
-							}
-							else if(ef->v2->f1 && ef->v4->f1){
-								ef->f1 = SELECT;
-								fill_quad_doublevert(em, ef, 2, 4);
-							}
-						}
-					}
-					break;
-
-				case 1:
-					if(beauty & B_KNIFE && numcuts == 1){
-						/*Test for when knifing through an edge and one vert*/
-						touchcount = 0;
-						if(ef->v1->f1) touchcount++;
-						if(ef->v2->f1) touchcount++;
-						if(ef->v3->f1) touchcount++;
-						if(ef->v4->f1) touchcount++;
-
-						if(touchcount == 1){
-							if( (ef->e1->f & flag && ( !ef->e1->v1->f1 && !ef->e1->v2->f1 )) ||
-								(ef->e2->f & flag && ( !ef->e2->v1->f1 && !ef->e2->v2->f1 )) ||
-								(ef->e3->f & flag && ( !ef->e3->v1->f1 && !ef->e3->v2->f1 )) ||
-								(ef->e4->f & flag && ( !ef->e4->v1->f1 && !ef->e4->v2->f1 )) ){
-
-								ef->f1 = SELECT;
-								fill_quad_singlevert(em, ef, gh);
-							}
-							else{
-								ef->f1 = SELECT;
-								fill_quad_single(em, ef, gh, numcuts, seltype);
-							}
-						}
-						else{
-							ef->f1 = SELECT;
-							fill_quad_single(em, ef, gh, numcuts, seltype);
-						}
-					}
-					else{
-						ef->f1 = SELECT;
-						fill_quad_single(em, ef, gh, numcuts, seltype);
-					}
-					break;
-				case 2: ef->f1 = SELECT;
-					// if there are 2, we check if edge 1 and 3 are either both on or off that way
-					// we can tell if the selected pair is Adjacent or Opposite of each other
-					if((ef->e1->f & flag && ef->e3->f & flag) ||
-					   (ef->e2->f & flag && ef->e4->f & flag)) {
-						fill_quad_double_op(em, ef, gh, numcuts);
-					}else{
-						switch(corner_pattern) {
-							case 0:	fill_quad_double_adj_path(em, ef, gh, numcuts); break;
-							case 1:	fill_quad_double_adj_inner(em, ef, gh, numcuts); break;
-							case 2:	fill_quad_double_adj_fan(em, ef, gh, numcuts); break;
-						}
+void MESH_OT_flip_normals(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Flip Normals";
+	ot->description = "Flip the direction of selected faces' normals (and of their vertices)";
+	ot->idname = "MESH_OT_flip_normals";
+	
+	/* api callbacks */
+	ot->exec = edbm_flip_normals_exec;
+	ot->poll = ED_operator_editmesh;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
 
-					}
-						break;
-				case 3: ef->f1 = SELECT;
-					fill_quad_triple(em, ef, gh, numcuts);
-					break;
-				case 4: ef->f1 = SELECT;
-					fill_quad_quadruple(em, ef, gh, numcuts, smooth, fractal, beauty);
-					break;
-			}
-		} else {
-			switch(edgecount) {
-				case 0: break;
-				case 1: ef->f1 = SELECT;
-					fill_tri_single(em, ef, gh, numcuts, seltype);
-					break;
-				case 2: ef->f1 = SELECT;
-					fill_tri_double(em, ef, gh, numcuts);
-					break;
-				case 3: ef->f1 = SELECT;
-					fill_tri_triple(em, ef, gh, numcuts, smooth, fractal, beauty);
-					break;
-			}
-		}
-	}
+static const EnumPropertyItem direction_items[] = {
+	{DIRECTION_CW, "CW", 0, "Clockwise", ""},
+	{DIRECTION_CCW, "CCW", 0, "Counter Clockwise", ""},
+	{0, NULL, 0, NULL, NULL}};
 
-	// Delete Old Edges and Faces
-	for(eed = em->edges.first;eed;eed = eed->next) {
-		if(BLI_ghash_haskey(gh,eed)) {
-			eed->f1 = SELECT;
-		} else {
-			eed->f1 = 0;
-		}
+/* only accepts 1 selected edge, or 2 selected faces */
+static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMOperator bmop;
+	BMEdge *eed;
+	BMIter iter;
+	const int do_ccw = RNA_enum_get(op->ptr, "direction") == 1;
+	int tot = 0;
+
+	if (em->bm->totedgesel == 0) {
+		BKE_report(op->reports, RPT_ERROR, "Select edges or face pairs for edge loops to rotate about");
+		return OPERATOR_CANCELLED;
 	}
-	free_tagged_edges_faces(em, em->edges.first, em->faces.first);
 
-	if(seltype == SUBDIV_SELECT_ORIG  && !ctrl) {
-		/* bugfix: vertex could get flagged as "not-selected"
-		// solution: clear flags before, not at the same time as setting SELECT flag -dg
-		*/
-		for(eed = em->edges.first;eed;eed = eed->next) {
-			if(!(eed->f2 & EDGENEW || eed->f2 & EDGEOLD)) {
-				eed->f &= !flag;
-				EM_select_edge(eed,0);
-			}
-		}
-		for(eed = em->edges.first;eed;eed = eed->next) {
-			if(eed->f2 & EDGENEW || eed->f2 & EDGEOLD) {
-				eed->f |= flag;
-				EM_select_edge(eed,1);
-			}
-		}
-	} else if ((seltype == SUBDIV_SELECT_INNER || seltype == SUBDIV_SELECT_INNER_SEL)|| ctrl) {
-		for(eed = em->edges.first;eed;eed = eed->next) {
-			if(eed->f2 & EDGEINNER) {
-				eed->f |= flag;
-				EM_select_edge(eed,1);
-				if(eed->v1->f & EDGEINNER) eed->v1->f |= SELECT;
-				if(eed->v2->f & EDGEINNER) eed->v2->f |= SELECT;
-			}else{
-				eed->f &= !flag;
-				EM_select_edge(eed,0);
-			}
-		}
-	} else if(seltype == SUBDIV_SELECT_LOOPCUT){
-		for(eed = em->edges.first;eed;eed = eed->next) {
-			if(eed->f2 & DOUBLEOPFILL){
-				eed->f |= flag;
-				EM_select_edge(eed,1);
-			}else{
-				eed->f &= !flag;
-				EM_select_edge(eed,0);
-			}
-		}
-	}
-	if(em->selectmode & SCE_SELECT_VERTEX) {
-		for(eed = em->edges.first;eed;eed = eed->next) {
-			if(eed->f & SELECT) {
-				eed->v1->f |= SELECT;
-				eed->v2->f |= SELECT;
+	/* first see if we have two adjacent faces */
+	BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
+		BM_elem_flag_disable(eed, BM_ELEM_TAG);
+		if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
+			BMFace *fa, *fb;
+			if (BM_edge_face_pair(eed, &fa, &fb)) {
+				/* if both faces are selected we rotate between them,
+				 * otherwise - rotate between 2 unselected - but not mixed */
+				if (BM_elem_flag_test(fa, BM_ELEM_SELECT) == BM_elem_flag_test(fb, BM_ELEM_SELECT)) {
+					BM_elem_flag_enable(eed, BM_ELEM_TAG);
+					tot++;
+				}
 			}
 		}
 	}
-
-	//fix hide flags for edges. First pass, hide edges of hidden faces
-	for(ef=em->faces.first; ef; ef=ef->next){
-		if(ef->h){
-			ef->e1->h |= 1;
-			ef->e2->h |= 1;
-			ef->e3->h |= 1;
-			if(ef->e4) ef->e4->h |= 1;
-		}
-	}
-	//second pass: unhide edges of visible faces adjacent to hidden faces
-	for(ef=em->faces.first; ef; ef=ef->next){
-		if(ef->h == 0){
-			ef->e1->h &= ~1;
-			ef->e2->h &= ~1;
-			ef->e3->h &= ~1;
-			if(ef->e4) ef->e4->h &= ~1;
-		}
+	
+	/* ok, we don't have two adjacent faces, but we do have two selected ones.
+	 * that's an error condition.*/
+	if (tot == 0) {
+		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, "edgerotate edges=%he ccw=%b", BM_ELEM_TAG, do_ccw);
 
-	//third pass: unhide edges that have both verts visible
-	//(these were missed if all faces were hidden, bug #21976)
-	for(eed=em->edges.first; eed; eed=eed->next){
-		if(eed->v1->h == 0 && eed->v2->h == 0)
-			eed->h &= ~1;
-	}
+	/* 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);
 
-	// Free the ghash and call MEM_freeN on all the value entries to return
-	// that memory
-	BLI_ghash_free(gh, NULL, (GHashValFreeFP)MEM_freeN);
+	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);
+	EDBM_selectmode_flush(em);
 
-	EM_selectmode_flush(em);
-	for(ef=em->faces.first;ef;ef = ef->next) {
-		if(ef->e4) {
-			if(  (ef->e1->f & SELECT && ef->e2->f & SELECT) &&
-			 (ef->e3->f & SELECT && ef->e4->f & SELECT) ) {
-				ef->f |= SELECT;
-			}
-		} else {
-			if(  (ef->e1->f & SELECT && ef->e2->f & SELECT) && ef->e3->f & SELECT) {
-				ef->f |= SELECT;
-			}
-		}
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+		return OPERATOR_CANCELLED;
 	}
 
-	recalc_editnormals(em);
-}
+	EDBM_update_generic(C, em, TRUE);
 
-static int count_selected_edges(EditEdge *ed)
-{
-	int totedge = 0;
-	while(ed) {
-		ed->tmp.p = 0;
-		if( ed->f & SELECT ) totedge++;
-		ed= ed->next;
-	}
-	return totedge;
+	return OPERATOR_FINISHED;
 }
 
-/* hurms, as if this makes code readable! It's pointerpointer hiding... (ton) */
-typedef EditFace *EVPtr;
-typedef EVPtr EVPTuple[2];
-
-/** builds EVPTuple array efaa of face tuples (in fact pointers to EditFaces)
-	sharing one edge.
-	arguments: selected edge list, face list.
-	Edges will also be tagged accordingly (see eed->f2)		  */
-
-static int collect_quadedges(EVPTuple *efaa, EditEdge *eed, EditFace *efa)
+void MESH_OT_edge_rotate(wmOperatorType *ot)
 {
-	EditEdge *e1, *e2, *e3;
-	EVPtr *evp;
-	int i = 0;
-
-	/* run through edges, if selected, set pointer edge-> facearray */
-	while(eed) {
-		eed->f2= 0;
-		eed->f1= 0;
-		if( eed->f & SELECT ) {
-			eed->tmp.p = (EditVert *) (&efaa[i]);
-			i++;
-		}
-		else eed->tmp.p = NULL;
-
-		eed= eed->next;
-	}
-
-
-	/* find edges pointing to 2 faces by procedure:
+	/* identifiers */
+	ot->name = "Rotate Selected Edge";
+	ot->description = "Rotate selected edge or adjoining faces";
+	ot->idname = "MESH_OT_edge_rotate";
 
-	- run through faces and their edges, increase
-	  face counter e->f1 for each face
-	*/
+	/* api callbacks */
+	ot->exec = edbm_edge_rotate_selected_exec;
+	ot->poll = ED_operator_editmesh;
 
-	while(efa) {
-		efa->f1= 0;
-		if(efa->v4==0 && (efa->f & SELECT)) {  /* if selected triangle */
-			e1= efa->e1;
-			e2= efa->e2;
-			e3= efa->e3;
-			if(e1->f2<3 && e1->tmp.p) {
-				if(e1->f2<2) {
-					evp= (EVPtr *) e1->tmp.p;
-					evp[(int)e1->f2] = efa;
-				}
-				e1->f2+= 1;
-			}
-			if(e2->f2<3 && e2->tmp.p) {
-				if(e2->f2<2) {
-					evp= (EVPtr *) e2->tmp.p;
-					evp[(int)e2->f2]= efa;
-				}
-				e2->f2+= 1;
-			}
-			if(e3->f2<3 && e3->tmp.p) {
-				if(e3->f2<2) {
-					evp= (EVPtr *) e3->tmp.p;
-					evp[(int)e3->f2]= efa;
-				}
-				e3->f2+= 1;
-			}
-		}
-		else {
-			/* set to 3 to make sure these are not flipped or joined */
-			efa->e1->f2= 3;
-			efa->e2->f2= 3;
-			efa->e3->f2= 3;
-			if (efa->e4) efa->e4->f2= 3;
-		}
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-		efa= efa->next;
-	}
-	return i;
+	/* props */
+	RNA_def_enum(ot->srna, "direction", direction_items, DIRECTION_CW, "Direction", "Direction to rotate edge around");
 }
 
 
-/* returns vertices of two adjacent triangles forming a quad
-   - can be righthand or lefthand
-
-			4-----3
-			|\	|
-			| \ 2 | <- efa1
-			|  \  |
-	  efa-> | 1 \ |
-			|	\|
-			1-----2
-
-*/
-#define VTEST(face, num, other) \
-	(face->v##num != other->v1 && face->v##num != other->v2 && face->v##num != other->v3)
-
-static void givequadverts(EditFace *efa, EditFace *efa1, EditVert **v1, EditVert **v2, EditVert **v3, EditVert **v4, int *vindex)
+static int edbm_hide_exec(bContext *C, wmOperator *op)
 {
-	if VTEST(efa, 1, efa1) {
-		*v1= efa->v1;
-		*v2= efa->v2;
-		vindex[0]= 0;
-		vindex[1]= 1;
-	}
-	else if VTEST(efa, 2, efa1) {
-		*v1= efa->v2;
-		*v2= efa->v3;
-		vindex[0]= 1;
-		vindex[1]= 2;
-	}
-	else if VTEST(efa, 3, efa1) {
-		*v1= efa->v3;
-		*v2= efa->v1;
-		vindex[0]= 2;
-		vindex[1]= 0;
-	}
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	
+	EDBM_mesh_hide(em, RNA_boolean_get(op->ptr, "unselected"));
 
-	if VTEST(efa1, 1, efa) {
-		*v3= efa1->v1;
-		*v4= (efa1->v2 == *v2)? efa1->v3: efa1->v2;
-		vindex[2]= 0;
-		vindex[3]= (efa1->v2 == *v2)? 2: 1;
-	}
-	else if VTEST(efa1, 2, efa) {
-		*v3= efa1->v2;
-		*v4= (efa1->v3 == *v2)? efa1->v1: efa1->v3;
-		vindex[2]= 1;
-		vindex[3]= (efa1->v3 == *v2)? 0: 2;
-	}
-	else if VTEST(efa1, 3, efa) {
-		*v3= efa1->v3;
-		*v4= (efa1->v1 == *v2)? efa1->v2: efa1->v1;
-		vindex[2]= 2;
-		vindex[3]= (efa1->v1 == *v2)? 1: 0;
-	}
-	else
-		*v3= *v4= NULL;
-}
+	EDBM_update_generic(C, em, TRUE);
 
-/* Helper functions for edge/quad edit features*/
-static void untag_edges(EditFace *f)
-{
-	f->e1->f1 = 0;
-	f->e2->f1 = 0;
-	f->e3->f1 = 0;
-	if (f->e4) f->e4->f1 = 0;
+	return OPERATOR_FINISHED;
 }
 
-/** remove and free list of tagged edges and faces */
-static void free_tagged_edges_faces(EditMesh *em, EditEdge *eed, EditFace *efa)
+void MESH_OT_hide(wmOperatorType *ot)
 {
-	EditEdge *nexted;
-	EditFace *nextvl;
-
-	while(efa) {
-		nextvl= efa->next;
-		if(efa->f1) {
-			BLI_remlink(&em->faces, efa);
-			free_editface(em, efa);
-		}
-		else
-			/* avoid deleting edges that are still in use */
-			untag_edges(efa);
-		efa= nextvl;
-	}
+	/* identifiers */
+	ot->name = "Hide Selection";
+	ot->idname = "MESH_OT_hide";
+	ot->description = "Hide (un)selected vertices, edges or faces";
+	
+	/* api callbacks */
+	ot->exec = edbm_hide_exec;
+	ot->poll = ED_operator_editmesh;
 
-	while(eed) {
-		nexted= eed->next;
-		if(eed->f1) {
-			remedge(em, eed);
-			free_editedge(em, eed);
-		}
-		eed= nexted;
-	}
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+	
+	/* props */
+	RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected");
 }
 
-
-/* ******************** BEGIN TRIANGLE TO QUAD ************************************* */
-static float measure_facepair(EditVert *v1, EditVert *v2, EditVert *v3, EditVert *v4, float limit)
+static int edbm_reveal_exec(bContext *C, wmOperator *UNUSED(op))
 {
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	
+	EDBM_mesh_reveal(em);
 
-	/*gives a 'weight' to a pair of triangles that join an edge to decide how good a join they would make*/
-	/*Note: this is more complicated than it needs to be and should be cleaned up...*/
-	float	measure = 0.0, noA1[3], noA2[3], noB1[3], noB2[3], normalADiff, normalBDiff,
-			edgeVec1[3], edgeVec2[3], edgeVec3[3], edgeVec4[3], diff,
-			minarea, maxarea, areaA, areaB;
-
-	/*First Test: Normal difference*/
-	normal_tri_v3( noA1,v1->co, v2->co, v3->co);
-	normal_tri_v3( noA2,v1->co, v3->co, v4->co);
-
-	if(noA1[0] == noA2[0] && noA1[1] == noA2[1] && noA1[2] == noA2[2]) normalADiff = 0.0;
-	else normalADiff = RAD2DEGF(angle_v3v3(noA1, noA2));
-		//if(!normalADiff) normalADiff = 179;
-	normal_tri_v3( noB1,v2->co, v3->co, v4->co);
-	normal_tri_v3( noB2,v4->co, v1->co, v2->co);
-
-	if(noB1[0] == noB2[0] && noB1[1] == noB2[1] && noB1[2] == noB2[2]) normalBDiff = 0.0;
-	else normalBDiff = RAD2DEGF(angle_v3v3(noB1, noB2));
-		//if(!normalBDiff) normalBDiff = 179;
-
-	measure += (normalADiff/360) + (normalBDiff/360);
-	if(measure > limit) return measure;
-
-	/*Second test: Colinearity*/
-	sub_v3_v3v3(edgeVec1, v1->co, v2->co);
-	sub_v3_v3v3(edgeVec2, v2->co, v3->co);
-	sub_v3_v3v3(edgeVec3, v3->co, v4->co);
-	sub_v3_v3v3(edgeVec4, v4->co, v1->co);
-
-	diff = 0.0;
-
-	diff = (
-		fabsf(RAD2DEGF(angle_v3v3(edgeVec1, edgeVec2)) - 90) +
-		fabsf(RAD2DEGF(angle_v3v3(edgeVec2, edgeVec3)) - 90) +
-		fabsf(RAD2DEGF(angle_v3v3(edgeVec3, edgeVec4)) - 90) +
-		fabsf(RAD2DEGF(angle_v3v3(edgeVec4, edgeVec1)) - 90)) / 360;
-	if(!diff) return 0.0;
-
-	measure +=  diff;
-	if(measure > limit) return measure;
-
-	/*Third test: Concavity*/
-	areaA = area_tri_v3(v1->co, v2->co, v3->co) + area_tri_v3(v1->co, v3->co, v4->co);
-	areaB = area_tri_v3(v2->co, v3->co, v4->co) + area_tri_v3(v4->co, v1->co, v2->co);
-
-	if(areaA <= areaB) minarea = areaA;
-	else minarea = areaB;
-
-	if(areaA >= areaB) maxarea = areaA;
-	else maxarea = areaB;
-
-	if(!maxarea) measure += 1;
-	else measure += (1 - (minarea / maxarea));
+	EDBM_update_generic(C, em, TRUE);
 
-	return measure;
+	return OPERATOR_FINISHED;
 }
 
-#define T2QUV_LIMIT 0.005f
-#define T2QCOL_LIMIT 3
-static int compareFaceAttribs(EditMesh *em, EditFace *f1, EditFace *f2, EditEdge *eed)
+void MESH_OT_reveal(wmOperatorType *ot)
 {
-	/*Test to see if the per-face attributes for the joining edge match within limit*/
-	MTFace *tf1, *tf2;
-	unsigned int *col1, *col2;
-	short i,attrok=0, flag = 0, /* XXX scene->toolsettings->editbutflag,*/ fe1[2], fe2[2];
-
-	tf1 = CustomData_em_get(&em->fdata, f1->data, CD_MTFACE);
-	tf2 = CustomData_em_get(&em->fdata, f2->data, CD_MTFACE);
-
-	col1 = CustomData_em_get(&em->fdata, f1->data, CD_MCOL);
-	col2 = CustomData_em_get(&em->fdata, f2->data, CD_MCOL);
-
-	/*store indices for faceedges*/
-	f1->v1->f1 = 0;
-	f1->v2->f1 = 1;
-	f1->v3->f1 = 2;
-
-	fe1[0] = eed->v1->f1;
-	fe1[1] = eed->v2->f1;
-
-	f2->v1->f1 = 0;
-	f2->v2->f1 = 1;
-	f2->v3->f1 = 2;
-
-	fe2[0] = eed->v1->f1;
-	fe2[1] = eed->v2->f1;
-
-	/*compare faceedges for each face attribute. Additional per face attributes can be added later*/
-	/*do UVs*/
-	if(flag & B_JOINTRIA_UV){
+	/* identifiers */
+	ot->name = "Reveal Hidden";
+	ot->idname = "MESH_OT_reveal";
+	ot->description = "Reveal all hidden vertices, edges and faces";
+	
+	/* api callbacks */
+	ot->exec = edbm_reveal_exec;
+	ot->poll = ED_operator_editmesh;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
 
-		if(tf1 == NULL || tf2 == NULL) attrok |= B_JOINTRIA_UV;
-		else if(tf1->tpage != tf2->tpage); /*do nothing*/
-		else{
-			for(i = 0; i < 2; i++){
-				if(tf1->uv[fe1[i]][0] + T2QUV_LIMIT > tf2->uv[fe2[i]][0] && tf1->uv[fe1[i]][0] - T2QUV_LIMIT < tf2->uv[fe2[i]][0] &&
-					tf1->uv[fe1[i]][1] + T2QUV_LIMIT > tf2->uv[fe2[i]][1] && tf1->uv[fe1[i]][1] - T2QUV_LIMIT < tf2->uv[fe2[i]][1]) attrok |= B_JOINTRIA_UV;
-			}
-		}
-	}
+static int edbm_normals_make_consistent_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	
+	/* doflip has to do with bmesh_rationalize_normals, it's an internal
+	 * thing */
+	if (!EDBM_op_callf(em, op, "righthandfaces faces=%hf do_flip=%b", BM_ELEM_SELECT, TRUE))
+		return OPERATOR_CANCELLED;
 
-	/*do VCOLs*/
-	if(flag & B_JOINTRIA_VCOL){
-		if(!col1 || !col2) attrok |= B_JOINTRIA_VCOL;
-		else{
-			char *f1vcol, *f2vcol;
-			for(i = 0; i < 2; i++){
-				f1vcol = (char *)&(col1[fe1[i]]);
-				f2vcol = (char *)&(col2[fe2[i]]);
+	if (RNA_boolean_get(op->ptr, "inside"))
+		EDBM_op_callf(em, op, "reversefaces faces=%hf", BM_ELEM_SELECT);
 
-				/*compare f1vcol with f2vcol*/
-				if(	f1vcol[1] + T2QCOL_LIMIT > f2vcol[1] && f1vcol[1] - T2QCOL_LIMIT < f2vcol[1] &&
-					f1vcol[2] + T2QCOL_LIMIT > f2vcol[2] && f1vcol[2] - T2QCOL_LIMIT < f2vcol[2] &&
-					f1vcol[3] + T2QCOL_LIMIT > f2vcol[3] && f1vcol[3] - T2QCOL_LIMIT < f2vcol[3]) attrok |= B_JOINTRIA_VCOL;
-			}
-		}
-	}
+	EDBM_update_generic(C, em, TRUE);
 
-	if( ((attrok & B_JOINTRIA_UV) == (flag & B_JOINTRIA_UV)) && ((attrok & B_JOINTRIA_VCOL) == (flag & B_JOINTRIA_VCOL)) ) return 1;
-	return 0;
+	return OPERATOR_FINISHED;
 }
 
-static int fplcmp(const void *v1, const void *v2)
+void MESH_OT_normals_make_consistent(wmOperatorType *ot)
 {
-	const EditEdge *e1= *((EditEdge**)v1), *e2=*((EditEdge**)v2);
-
-	if( e1->crease > e2->crease) return 1;
-	else if( e1->crease < e2->crease) return -1;
-
-	return 0;
+	/* identifiers */
+	ot->name = "Make Normals Consistent";
+	ot->description = "Make face and vertex normals point either outside or inside the mesh";
+	ot->idname = "MESH_OT_normals_make_consistent";
+	
+	/* api callbacks */
+	ot->exec = edbm_normals_make_consistent_exec;
+	ot->poll = ED_operator_editmesh;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+	
+	RNA_def_boolean(ot->srna, "inside", 0, "Inside", "");
 }
 
-/*Bitflags for edges.*/
-#define T2QDELETE	1
-#define T2QCOMPLEX	2
-#define T2QJOIN		4
-void join_triangles(EditMesh *em)
-{
-	EditVert *v1, *v2, *v3, *v4, *eve;
-	EditEdge *eed, **edsortblock = NULL, **edb = NULL;
-	EditFace *efa;
-	EVPTuple *efaar = NULL;
-	EVPtr *efaa = NULL;
-	float *creases = NULL;
-	float measure; /*Used to set tolerance*/
-	float limit = 0.8f; // XXX scene->toolsettings->jointrilimit;
-	int i, ok, totedge=0, totseledge=0, complexedges, vindex[4];
-
-	/*if we take a long time on very dense meshes we want waitcursor to display*/
-	waitcursor(1);
-
-	totseledge = count_selected_edges(em->edges.first);
-	if(totseledge==0) return;
-
-	/*abusing crease value to store weights for edge pairs. Nasty*/
-	for(eed=em->edges.first; eed; eed=eed->next) totedge++;
-	if(totedge) creases = MEM_callocN(sizeof(float) * totedge, "Join Triangles Crease Array");
-	for(eed=em->edges.first, i = 0; eed; eed=eed->next, i++){
-		creases[i] = eed->crease;
-		eed->crease = 0.0;
-	}
-
-	/*clear temp flags*/
-	for(eve=em->verts.first; eve; eve=eve->next) eve->f1 = eve->f2 = 0;
-	for(eed=em->edges.first; eed; eed=eed->next) eed->f2 = eed->f1 = 0;
-	for(efa=em->faces.first; efa; efa=efa->next) efa->f1 = efa->tmp.l = 0;
-
-	/*For every selected 2 manifold edge, create pointers to its two faces.*/
-	efaar= (EVPTuple *) MEM_callocN(totseledge * sizeof(EVPTuple), "Tri2Quad");
-	ok = collect_quadedges(efaar, em->edges.first, em->faces.first);
-	complexedges = 0;
-
-	if(ok){
-
-
-		/*clear tmp.l flag and store number of faces that are selected and coincident to current face here.*/
-		for(eed=em->edges.first; eed; eed=eed->next){
-			/* eed->f2 is 2 only if this edge is part of exactly two
-			   triangles, and both are selected, and it has EVPTuple assigned */
-			if(eed->f2 == 2){
-				efaa= (EVPtr *) eed->tmp.p;
-				efaa[0]->tmp.l++;
-				efaa[1]->tmp.l++;
-			}
-		}
 
-		for(eed=em->edges.first; eed; eed=eed->next){
-			if(eed->f2 == 2){
-				efaa= (EVPtr *) eed->tmp.p;
-				v1 = v2 = v3 = v4 = NULL;
-				givequadverts(efaa[0], efaa[1], &v1, &v2, &v3, &v4, vindex);
-				if(v1 && v2 && v3 && v4){
-					/*test if simple island first. This mimics 2.42 behaviour and the tests are less restrictive.*/
-					if(efaa[0]->tmp.l == 1 && efaa[1]->tmp.l == 1){
-						eed->f1 |= T2QJOIN;
-						efaa[0]->f1 = 1; //mark for join
-						efaa[1]->f1 = 1; //mark for join
-					}
-					else{
-
-						/*	The face pair is part of a 'complex' island, so the rules for dealing with it are more involved.
-							Depending on what options the user has chosen, this face pair can be 'thrown out' based upon the following criteria:
-
-							1: the two faces do not share the same material
-							2: the edge joining the two faces is marked as sharp.
-							3: the two faces UV's do not make a good match
-							4: the two faces Vertex colors do not make a good match
-
-							If the face pair passes all the applicable tests, it is then given a 'weight' with the measure_facepair() function.
-							This measures things like concavity, colinearity ect. If this weight is below the threshold set by the user
-							the edge joining them is marked as being 'complex' and will be compared against other possible pairs which contain one of the
-							same faces in the current pair later.
-
-							This technique is based upon an algorithm that Campbell Barton developed for his Tri2Quad script that was previously part of
-							the python scripts bundled with Blender releases.
-						*/
-
-// XXX						if(scene->toolsettings->editbutflag & B_JOINTRIA_SHARP && eed->sharp); /*do nothing*/
-//						else if(scene->toolsettings->editbutflag & B_JOINTRIA_MAT && efaa[0]->mat_nr != efaa[1]->mat_nr); /*do nothing*/
-//						else if(((scene->toolsettings->editbutflag & B_JOINTRIA_UV) || (scene->toolsettings->editbutflag & B_JOINTRIA_VCOL)) &&
-						compareFaceAttribs(em, efaa[0], efaa[1], eed); // XXX == 0); /*do nothing*/
-//						else{
-							measure = measure_facepair(v1, v2, v3, v4, limit);
-							if(measure < limit){
-								complexedges++;
-								eed->f1 |= T2QCOMPLEX;
-								eed->crease = measure; /*we dont mark edges for join yet*/
-							}
-//						}
-					}
-				}
-			}
-		}
 
-		/*Quicksort the complex edges according to their weighting*/
-		if(complexedges){
-			edsortblock = edb = MEM_callocN(sizeof(EditEdge*) * complexedges, "Face Pairs quicksort Array");
-			for(eed = em->edges.first; eed; eed=eed->next){
-				if(eed->f1 & T2QCOMPLEX){
-					*edb = eed;
-					edb++;
-				}
-			}
-			qsort(edsortblock, complexedges, sizeof(EditEdge*), fplcmp);
-			/*now go through and mark the edges who get the highest weighting*/
-			for(edb=edsortblock, i=0; i < complexedges; edb++, i++){
-				efaa = (EVPtr *)((*edb)->tmp.p); /*suspect!*/
-				if( !efaa[0]->f1 && !efaa[1]->f1){
-					efaa[0]->f1 = 1; //mark for join
-					efaa[1]->f1 = 1; //mark for join
-					(*edb)->f1 |= T2QJOIN;
-				}
-			}
-		}
-
-		/*finally go through all edges marked for join (simple and complex) and create new faces*/
-		for(eed=em->edges.first; eed; eed=eed->next){
-			if(eed->f1 & T2QJOIN){
-				efaa= (EVPtr *)eed->tmp.p;
-				v1 = v2 = v3 = v4 = NULL;
-				givequadverts(efaa[0], efaa[1], &v1, &v2, &v3, &v4, vindex);
-				if((v1 && v2 && v3 && v4) && (exist_face(em, v1, v2, v3, v4)==0)){ /*exist_face is very slow! Needs to be addressed.*/
-					/*flag for delete*/
-					eed->f1 |= T2QDELETE;
-					/*create new quad and select*/
-					efa = EM_face_from_faces(em, efaa[0], efaa[1], vindex[0], vindex[1], 4+vindex[2], 4+vindex[3]);
-					EM_select_face(efa,1);
-				}
-				else{
-						efaa[0]->f1 = 0;
-						efaa[1]->f1 = 0;
-				}
-			}
-		}
-	}
+static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	ModifierData *md;
+	int mirrx = FALSE, mirry = FALSE, mirrz = FALSE;
+	int i, repeat;
+	float clipdist = 0.0f;
 
-	/*free data and cleanup*/
-	if(creases){
-		for(eed=em->edges.first, i = 0; eed; eed=eed->next, i++) eed->crease = creases[i];
-		MEM_freeN(creases);
+	/* mirror before smooth */
+	if (((Mesh *)obedit->data)->editflag & ME_EDIT_MIRROR_X) {
+		EDBM_verts_mirror_cache_begin(em, TRUE);
 	}
-	for(eed=em->edges.first; eed; eed=eed->next){
-		if(eed->f1 & T2QDELETE) eed->f1 = 1;
-		else eed->f1 = 0;
-	}
-	free_tagged_edges_faces(em, em->edges.first, em->faces.first);
-	if(efaar) MEM_freeN(efaar);
-	if(edsortblock) MEM_freeN(edsortblock);
-
-	EM_selectmode_flush(em);
-
-}
-/* ******************** END TRIANGLE TO QUAD ************************************* */
-
-#define FACE_MARKCLEAR(f) (f->f1 = 1)
-
-/* quick hack, basically a copy of beautify_fill */
-static void edge_flip(EditMesh *em)
-{
-	EditVert *v1, *v2, *v3, *v4;
-	EditEdge *eed, *nexted;
-	EditFace *efa, *w;
-	//void **efaar, **efaa;
-	EVPTuple *efaar;
-	EVPtr *efaa;
-	int totedge, ok, vindex[4];
 
-	/* - all selected edges with two faces
-	 * - find the faces: store them in edges (using datablock)
-	 * - per edge: - test convex
-	 *			   - test edge: flip?
-						- if true: remedge,  addedge, all edges at the edge get new face pointers
+	/* if there is a mirror modifier with clipping, flag the verts that
+	 * are within tolerance of the plane(s) of reflection 
 	 */
-
-	EM_selectmode_flush(em);	// makes sure in selectmode 'face' the edges of selected faces are selected too
-
-	totedge = count_selected_edges(em->edges.first);
-	if(totedge==0) return;
-
-	/* temporary array for : edge -> face[1], face[2] */
-	efaar= (EVPTuple *) MEM_callocN(totedge * sizeof(EVPTuple), "edgeflip");
-
-	ok = collect_quadedges(efaar, em->edges.first, em->faces.first);
-
-	eed= em->edges.first;
-	while(eed) {
-		nexted= eed->next;
-
-		if(eed->f2==2) {  /* points to 2 faces */
-
-			efaa= (EVPtr *) eed->tmp.p;
-
-			/* don't do it if flagged */
-
-			ok= 1;
-			efa= efaa[0];
-			if(efa->e1->f1 || efa->e2->f1 || efa->e3->f1) ok= 0;
-			efa= efaa[1];
-			if(efa->e1->f1 || efa->e2->f1 || efa->e3->f1) ok= 0;
-
-			if(ok) {
-				/* test convex */
-				givequadverts(efaa[0], efaa[1], &v1, &v2, &v3, &v4, vindex);
-
-/*
-		4-----3		4-----3
-		|\	|		|	/|
-		| \ 1 |		| 1 / |
-		|  \  |  ->	|  /  |
-		| 0 \ |		| / 0 |
-		|	\|		|/	|
-		1-----2		1-----2
-*/
-				/* make new faces */
-				if (v1 && v2 && v3) {
-					if( convex(v1->co, v2->co, v3->co, v4->co) ) {
-						if(exist_face(em, v1, v2, v3, v4)==0) {
-							/* outch this may break seams */
-							w= EM_face_from_faces(em, efaa[0], efaa[1], vindex[0],
-								vindex[1], 4+vindex[2], -1);
-
-							EM_select_face(w, 1);
-
-							/* outch this may break seams */
-							w= EM_face_from_faces(em, efaa[0], efaa[1], vindex[0],
-								4+vindex[2], 4+vindex[3], -1);
-
-							EM_select_face(w, 1);
-						}
-						/* tag as to-be-removed */
-						FACE_MARKCLEAR(efaa[1]);
-						FACE_MARKCLEAR(efaa[0]);
-						eed->f1 = 1;
-
-					} /* endif test convex */
-				}
+	for (md = obedit->modifiers.first; md; md = md->next) {
+		if (md->type == eModifierType_Mirror && (md->mode & eModifierMode_Realtime)) {
+			MirrorModifierData *mmd = (MirrorModifierData *)md;
+		
+			if (mmd->flag & MOD_MIR_CLIPPING) {
+				if (mmd->flag & MOD_MIR_AXIS_X)
+					mirrx = TRUE;
+				if (mmd->flag & MOD_MIR_AXIS_Y)
+					mirry = TRUE;
+				if (mmd->flag & MOD_MIR_AXIS_Z)
+					mirrz = TRUE;
+
+				clipdist = mmd->tolerance;
 			}
 		}
-		eed= nexted;
 	}
 
-	/* clear tagged edges and faces: */
-	free_tagged_edges_faces(em, em->edges.first, em->faces.first);
-
-	MEM_freeN(efaar);
-}
-
-#define DIRECTION_CW	1
-#define DIRECTION_CCW	2
-
-static const EnumPropertyItem direction_items[]= {
-	{DIRECTION_CW, "CW", 0, "Clockwise", ""},
-	{DIRECTION_CCW, "CCW", 0, "Counter Clockwise", ""},
-	{0, NULL, 0, NULL, NULL}};
-
-#define AXIS_X		1
-#define AXIS_Y		2
-
-static const EnumPropertyItem axis_items_xy[]= {
-	{AXIS_X, "X", 0, "X", ""},
-	{AXIS_Y, "Y", 0, "Y", ""},
-	{0, NULL, 0, NULL, NULL}};
-
-static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed, int dir)
-{
-	EditVert **verts[2];
-	EditFace *face[2], *efa /* , *newFace[2] */ /* UNUSED */;
-	EditEdge **edges[2], **hiddenedges, *srchedge;
-	int facecount, p1, p2, p3, p4, fac1, fac2, i, j;
-	int numhidden, numshared, p[2][4];
-
-	/* check to make sure that the edge is only part of 2 faces */
-	facecount = 0;
-	for(efa = em->faces.first;efa;efa = efa->next) {
-		if((efa->e1 == eed || efa->e2 == eed) || (efa->e3 == eed || efa->e4 == eed)) {
-			if(facecount >= 2) {
-				/* more than two faces with this edge */
-				return;
-			}
-			else {
-				face[facecount] = efa;
-				facecount++;
-			}
+	repeat = RNA_int_get(op->ptr, "repeat");
+	if (!repeat)
+		repeat = 1;
+	
+	for (i = 0; i < repeat; i++) {
+		if (!EDBM_op_callf(em, op,
+		                   "vertexsmooth verts=%hv mirror_clip_x=%b mirror_clip_y=%b mirror_clip_z=%b clipdist=%f",
+		                   BM_ELEM_SELECT, mirrx, mirry, mirrz, clipdist))
+		{
+			return OPERATOR_CANCELLED;
 		}
 	}
 
-	if(facecount < 2)
-		return;
-
-	/* how many edges does each face have */
-	if(face[0]->e4) fac1= 4;
-	else fac1= 3;
-
-	if(face[1]->e4) fac2= 4;
-	else fac2= 3;
-
-	/* make a handy array for verts and edges */
-	verts[0]= &face[0]->v1;
-	edges[0]= &face[0]->e1;
-	verts[1]= &face[1]->v1;
-	edges[1]= &face[1]->e1;
-
-	/* we don't want to rotate edges between faces that share more than one edge */
-	numshared= 0;
-	for(i=0; i<fac1; i++)
-		for(j=0; j<fac2; j++)
-			if (edges[0][i] == edges[1][j])
-				numshared++;
-
-	if(numshared > 1)
-		return;
-
-	/* we want to construct an array of vertex indicis in both faces, starting at
-	   the last vertex of the edge being rotated.
-	   - first we find the two vertices that lie on the rotating edge
-	   - then we make sure they are ordered according to the face vertex order
-	   - and then we construct the array */
-	p1= p2= p3= p4= 0;
-
-	for(i=0; i<4; i++) {
-		if(eed->v1 == verts[0][i]) p1 = i;
-		if(eed->v2 == verts[0][i]) p2 = i;
-		if(eed->v1 == verts[1][i]) p3 = i;
-		if(eed->v2 == verts[1][i]) p4 = i;
-	}
-
-	if((p1+1)%fac1 == p2)
-		SWAP(int, p1, p2);
-	if((p3+1)%fac2 == p4)
-		SWAP(int, p3, p4);
-
-	for (i = 0; i < 4; i++) {
-		p[0][i]= (p1 + i)%fac1;
-		p[1][i]= (p3 + i)%fac2;
+	/* 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);
 	}
 
-	/* create an Array of the Edges who have h set prior to rotate */
-	numhidden = 0;
-	for(srchedge = em->edges.first;srchedge;srchedge = srchedge->next)
-		if(srchedge->h && ((srchedge->v1->f & SELECT) || (srchedge->v2->f & SELECT)))
-			numhidden++;
+	EDBM_update_generic(C, em, TRUE);
 
-	hiddenedges = MEM_mallocN(sizeof(EditVert*)*numhidden+1, "RotateEdgeHiddenVerts");
-	if(!hiddenedges) {
-		BKE_report(op->reports, RPT_ERROR, "Memory allocation failed");
-		return;
-	}
-
-	numhidden = 0;
-	for(srchedge=em->edges.first; srchedge; srchedge=srchedge->next)
-		if(srchedge->h && (srchedge->v1->f & SELECT || srchedge->v2->f & SELECT))
-			hiddenedges[numhidden++] = srchedge;
-
-	/* create the 2 new faces */
-	if(fac1 == 3 && fac2 == 3) {
-		/* no need of reverse setup */
-
-		/* newFace[0]= */ /* UNUSED */EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], 4+p[1][1], -1);
-		/* newFace[1]= */ /* UNUSED */EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], 4+p[0][1], -1);
-	}
-	else if(fac1 == 4 && fac2 == 3) {
-		if(dir == DIRECTION_CCW) {
-			/* newFace[0]= */ /* UNUSED */EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], p[0][3], 4+p[1][1]);
-			/* newFace[1]= */ /* UNUSED */EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], 4+p[0][1], -1);
-		} else if (dir == DIRECTION_CW) {
-			/* newFace[0]= */ /* UNUSED */EM_face_from_faces(em, face[0], face[1], p[0][2], 4+p[1][1], p[0][0], p[0][1]);
-			/* newFace[1]= */ /* UNUSED */EM_face_from_faces(em, face[1], face[0], 4+p[0][2], p[1][0], p[1][1], -1);
-
-			verts[0][p[0][2]]->f |= SELECT;
-			verts[1][p[1][1]]->f |= SELECT;
-		}
-	}
-	else if(fac1 == 3 && fac2 == 4) {
-		if(dir == DIRECTION_CCW) {
-			/* newFace[0]= */ /* UNUSED */EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], 4+p[1][1], -1);
-			/* newFace[1]= */ /* UNUSED */EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], p[1][3], 4+p[0][1]);
-		} else if (dir == DIRECTION_CW) {
-			/* newFace[0]= */ /* UNUSED */EM_face_from_faces(em, face[0], face[1], p[0][0], p[0][1], 4+p[1][2], -1);
-			/* newFace[1]= */ /* UNUSED */EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], 4+p[0][1], 4+p[0][2]);
-
-			verts[0][p[0][1]]->f |= SELECT;
-			verts[1][p[1][2]]->f |= SELECT;
-		}
+	return OPERATOR_FINISHED;
+}	
+	
+void MESH_OT_vertices_smooth(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Smooth Vertex";
+	ot->description = "Flatten angles of selected vertices";
+	ot->idname = "MESH_OT_vertices_smooth";
+	
+	/* api callbacks */
+	ot->exec = edbm_do_smooth_vertex_exec;
+	ot->poll = ED_operator_editmesh;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-	}
-	else if(fac1 == 4 && fac2 == 4) {
-		if(dir == DIRECTION_CCW) {
-			/* newFace[0]= */ /* UNUSED */EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], p[0][3], 4+p[1][1]);
-			/* newFace[1]= */ /* UNUSED */EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], p[1][3], 4+p[0][1]);
-		} else if (dir == DIRECTION_CW) {
-			/* newFace[0]= */ /* UNUSED */EM_face_from_faces(em, face[0], face[1], p[0][2], p[0][3], 4+p[1][1], 4+p[1][2]);
-			/* newFace[1]= */ /* UNUSED */EM_face_from_faces(em, face[1], face[0], p[1][2], p[1][3], 4+p[0][1], 4+p[0][2]);
+	RNA_def_int(ot->srna, "repeat", 1, 1, 100, "Number of times to smooth the mesh", "", 1, INT_MAX);
+}
 
-			verts[0][p[0][2]]->f |= SELECT;
-			verts[1][p[1][2]]->f |= SELECT;
-		}
-	}
-	else
-		return; /* This should never happen */
+/********************** Smooth/Solid Operators *************************/
 
-	if(dir == DIRECTION_CCW || (fac1 == 3 && fac2 == 3)) {
-		verts[0][p[0][1]]->f |= SELECT;
-		verts[1][p[1][1]]->f |= SELECT;
-	}
+static void mesh_set_smooth_faces(BMEditMesh *em, short smooth)
+{
+	BMIter iter;
+	BMFace *efa;
 
-	/* copy old edge's flags to new center edge*/
-	for(srchedge=em->edges.first;srchedge;srchedge=srchedge->next) {
-		if((srchedge->v1->f & SELECT) && (srchedge->v2->f & SELECT)) {
-			srchedge->f = eed->f;
-			srchedge->h = eed->h;
-			srchedge->dir = eed->dir;
-			srchedge->seam = eed->seam;
-			srchedge->crease = eed->crease;
-			srchedge->bweight = eed->bweight;
+	if (em == NULL) return;
+	
+	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+		if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
+			BM_elem_flag_set(efa, BM_ELEM_SMOOTH, smooth);
 		}
 	}
-
-	/* resetting hidden flag */
-	for(numhidden--; numhidden>=0; numhidden--)
-		hiddenedges[numhidden]->h= 1;
-
-	/* check for orhphan edges */
-	for(srchedge=em->edges.first; srchedge; srchedge=srchedge->next)
-		srchedge->f1= -1;
-
-	/* cleanup */
-	MEM_freeN(hiddenedges);
-
-	/* get rid of the old edge and faces*/
-	remedge(em, eed);
-	free_editedge(em, eed);
-	BLI_remlink(&em->faces, face[0]);
-	free_editface(em, face[0]);
-	BLI_remlink(&em->faces, face[1]);
-	free_editface(em, face[1]);
 }
 
-/* only accepts 1 selected edge, or 2 selected faces */
-static int edge_rotate_selected(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-	EditEdge *eed;
-	EditFace *efa;
-	int dir = RNA_enum_get(op->ptr, "direction"); // dir == 2 when clockwise and ==1 for counter CW.
-	short edgeCount = 0;
-
-	/*clear new flag for new edges, count selected edges */
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		eed->f1= 0;
-		eed->f2 &= ~2;
-		if(eed->f & SELECT) edgeCount++;
-	}
-
-	if(edgeCount>1) {
-		/* more selected edges, check faces */
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->f & SELECT) {
-				efa->e1->f1++;
-				efa->e2->f1++;
-				efa->e3->f1++;
-				if(efa->e4) efa->e4->f1++;
-			}
-		}
-		edgeCount= 0;
-		for(eed= em->edges.first; eed; eed= eed->next) {
-			if(eed->f1==2) edgeCount++;
-		}
-		if(edgeCount==1) {
-			for(eed= em->edges.first; eed; eed= eed->next) {
-				if(eed->f1==2) {
-					edge_rotate(em, op, eed,dir);
-					break;
-				}
-			}
-		}
-		else
-		{
-			BKE_report(op->reports, RPT_WARNING, "Select one edge or two adjacent faces");
-			BKE_mesh_end_editmesh(obedit->data, em);
-			return OPERATOR_CANCELLED;
-		}
-	}
-	else if(edgeCount==1) {
-		for(eed= em->edges.first; eed; eed= eed->next) {
-			if(eed->f & SELECT) {
-				EM_select_edge(eed, 0);
-				edge_rotate(em, op, eed,dir);
-				break;
-			}
-		}
-	}
-	else  {
-		BKE_report(op->reports, RPT_WARNING, "Select one edge or two adjacent faces");
-		BKE_mesh_end_editmesh(obedit->data, em);
-		return OPERATOR_CANCELLED;
-	}
-
-	/* flush selected vertices (again) to edges/faces */
-	EM_select_flush(em);
+static int edbm_faces_shade_smooth_exec(bContext *C, wmOperator *UNUSED(op))
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
+	mesh_set_smooth_faces(em, 1);
 
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	EDBM_update_generic(C, em, FALSE);
 
 	return OPERATOR_FINISHED;
 }
 
-void MESH_OT_edge_rotate(wmOperatorType *ot)
+void MESH_OT_faces_shade_smooth(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Rotate Selected Edge";
-	ot->description= "Rotate selected edge or adjoining faces";
-	ot->idname= "MESH_OT_edge_rotate";
+	ot->name = "Shade Smooth";
+	ot->description = "Display faces smooth (using vertex normals)";
+	ot->idname = "MESH_OT_faces_shade_smooth";
 
 	/* api callbacks */
-	ot->exec= edge_rotate_selected;
-	ot->poll= ED_operator_editmesh;
+	ot->exec = edbm_faces_shade_smooth_exec;
+	ot->poll = ED_operator_editmesh;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
-	/* props */
-	RNA_def_enum(ot->srna, "direction", direction_items, DIRECTION_CW, "Direction", "Direction to rotate the edge around");
-}
-
-
-/******************* BEVEL CODE STARTS HERE ********************/
-
-  /* XXX old bevel not ported yet */
-
-static void UNUSED_FUNCTION(bevel_menu)(EditMesh *em)
-{
-	BME_Mesh *bm;
-	BME_TransData_Head *td;
-//	TransInfo *t;
-	int options, res, gbm_free = 0;
-
-//	t = BIF_GetTransInfo();
-	if (!G.editBMesh) {
-		G.editBMesh = MEM_callocN(sizeof(*(G.editBMesh)),"bevel_menu() G.editBMesh");
-		gbm_free = 1;
-	}
-
-	G.editBMesh->options = BME_BEVEL_RUNNING | BME_BEVEL_SELECT;
-	G.editBMesh->res = 1;
-
-	while(G.editBMesh->options & BME_BEVEL_RUNNING) {
-		options = G.editBMesh->options;
-		res = G.editBMesh->res;
-		bm = BME_editmesh_to_bmesh(em);
-//		BIF_undo_push("Pre-Bevel");
-		free_editMesh(em);
-		BME_bevel(bm,0.1f,res,options,0,0,&td);
-		BME_bmesh_to_editmesh(bm, td, em);
-		EM_selectmode_flush(em);
-		G.editBMesh->bm = bm;
-		G.editBMesh->td = td;
-//		initTransform(TFM_BEVEL,CTX_BMESH);
-//		Transform();
-		BME_free_transdata(td);
-		BME_free_mesh(bm);
-//		if (t->state != TRANS_CONFIRM) {
-//			BIF_undo();
-//		}
-		if (options == G.editBMesh->options) {
-			G.editBMesh->options &= ~BME_BEVEL_RUNNING;
-		}
-	}
-
-	if (gbm_free) {
-		MEM_freeN(G.editBMesh);
-		G.editBMesh = NULL;
-	}
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
+static int edbm_faces_shade_flat_exec(bContext *C, wmOperator *UNUSED(op))
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
 
-/* *********** END BEVEL *********/
+	mesh_set_smooth_faces(em, 0);
 
-/* this utility function checks to see if 2 edit edges share a face,
-returns 1 if they do
-returns 0 if they do not, or if the function is passed the same edge 2 times
-*/
-short sharesFace(EditMesh *em, EditEdge* e1, EditEdge* e2)
-{
-	EditFace *search=NULL;
+	EDBM_update_generic(C, em, FALSE);
 
-	search = em->faces.first;
-	if (e1 == e2){
-		return 0 ;
-	}
-	while(search){
-		if(
-		   ((search->e1 == e1 || search->e2 == e1) || (search->e3 == e1 || search->e4 == e1)) &&
-		   ((search->e1 == e2 || search->e2 == e2) || (search->e3 == e2 || search->e4 == e2))
-		   ) {
-			return 1;
-		}
-		search = search->next;
-	}
-	return 0;
+	return OPERATOR_FINISHED;
 }
 
-int EdgeLoopDelete(EditMesh *UNUSED(em), wmOperator *UNUSED(op))
+void MESH_OT_faces_shade_flat(wmOperatorType *ot)
 {
-#if 0 //XXX won't work with new edgeslide
-
-	/* temporal flag setting so we keep UVs when deleting edge loops,
-	* this is a bit of a hack but it works how you would want in almost all cases */
-	//	short uvcalc_flag_orig = 0; // XXX scene->toolsettings->uvcalc_flag;
-	//	scene->toolsettings->uvcalc_flag |= UVCALC_TRANSFORM_CORRECT;
-
-	if(!EdgeSlide(em, op, 1, 1)) {
-		return 0;
-	}
+	/* identifiers */
+	ot->name = "Shade Flat";
+	ot->description = "Display faces flat";
+	ot->idname = "MESH_OT_faces_shade_flat";
 
-	/* restore uvcalc flag */
-	//	scene->toolsettings->uvcalc_flag = uvcalc_flag_orig;
+	/* api callbacks */
+	ot->exec = edbm_faces_shade_flat_exec;
+	ot->poll = ED_operator_editmesh;
 
-	EM_select_more(em);
-	removedoublesflag(em, 1,0, 0.001);
-	EM_select_flush(em);
-	//	DAG_id_tag_update(obedit->data, 0);
-	return 1;
-#endif
-	return 0;
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 
-/* -------------------- More tools ------------------ */
-#if 0
-void mesh_set_face_flags(EditMesh *em, short mode)
-{
-	EditFace *efa;
-	MTFace *tface;
-	short	m_tex=0, m_shared=0,
-			m_light=0, m_invis=0, m_collision=0,
-			m_twoside=0, m_obcolor=0, m_halo=0,
-			m_billboard=0, m_shadow=0, m_text=0,
-			m_sort=0;
-	short flag = 0, change = 0;
-
-// XXX	if (!EM_texFaceCheck()) {
-//		error("not a mesh with uv/image layers");
-//		return;
-//	}
-
-	add_numbut(0, TOG|SHO, "Texture", 0, 0, &m_tex, NULL);
-	add_numbut(2, TOG|SHO, "Light", 0, 0, &m_light, NULL);
-	add_numbut(3, TOG|SHO, "Invisible", 0, 0, &m_invis, NULL);
-	add_numbut(4, TOG|SHO, "Collision", 0, 0, &m_collision, NULL);
-	add_numbut(5, TOG|SHO, "Shared", 0, 0, &m_shared, NULL);
-	add_numbut(6, TOG|SHO, "Twoside", 0, 0, &m_twoside, NULL);
-	add_numbut(7, TOG|SHO, "ObColor", 0, 0, &m_obcolor, NULL);
-	add_numbut(8, TOG|SHO, "Halo", 0, 0, &m_halo, NULL);
-	add_numbut(9, TOG|SHO, "Billboard", 0, 0, &m_billboard, NULL);
-	add_numbut(10, TOG|SHO, "Shadow", 0, 0, &m_shadow, NULL);
-	add_numbut(11, TOG|SHO, "Text", 0, 0, &m_text, NULL);
-	add_numbut(12, TOG|SHO, "Sort", 0, 0, &m_sort, NULL);
-
-	if (!do_clever_numbuts((mode ? "Set Flags" : "Clear Flags"), 13, REDRAW))
-		return;
-
-	/* these 2 cant both be on */
-	if (mode) /* are we seeting*/
-		if (m_halo)
-			m_billboard = 0;
-
-	if (m_tex)			flag |= TF_TEX;
-	if (m_shared)		flag |= TF_SHAREDCOL;
-	if (m_light)		flag |= TF_LIGHT;
-	if (m_invis)		flag |= TF_INVISIBLE;
-	if (m_collision)	flag |= TF_DYNAMIC;
-	if (m_twoside)		flag |= TF_TWOSIDE;
-	if (m_obcolor)		flag |= TF_OBCOL;
-	if (m_halo)			flag |= TF_BILLBOARD;
-	if (m_billboard)	flag |= TF_BILLBOARD2;
-	if (m_shadow)		flag |= TF_SHADOW;
-	if (m_text)			flag |= TF_BMFONT;
-	if (m_sort)			flag |= TF_ALPHASORT;
-
-	if (flag==0)
-		return;
-
-	efa= em->faces.first;
-	while(efa) {
-		if(efa->f & SELECT) {
-			tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-			if (mode)	tface->mode |= flag;
-			else		tface->mode &= ~flag;
-			change = 1;
-		}
-		efa= efa->next;
-	}
-
-}
-#endif
-
-/********************** Rip Operator *************************/
+/********************** UV/Color Operators *************************/
 
-/* helper to find edge for edge_rip */
-static float mesh_rip_edgedist(ARegion *ar, float mat[][4], float *co1, float *co2, const int mval[2])
+static int edbm_rotate_uvs_exec(bContext *C, wmOperator *op)
 {
-	float vec1[2], vec2[2], mvalf[2];
+	Object *ob = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(ob);
+	BMOperator bmop;
 
-	ED_view3d_project_float(ar, co1, vec1, mat);
-	ED_view3d_project_float(ar, co2, vec2, mat);
-	mvalf[0]= (float)mval[0];
-	mvalf[1]= (float)mval[1];
+	/* get the direction from RNA */
+	int dir = RNA_enum_get(op->ptr, "direction");
 
-	return dist_to_line_segment_v2(mvalf, vec1, vec2);
-}
+	/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
+	EDBM_op_init(em, &bmop, op, "face_rotateuvs faces=%hf dir=%i", BM_ELEM_SELECT, dir);
 
-/* helper for below */
-static void mesh_rip_setface(EditMesh *em, EditFace *sefa)
-{
-	/* put new vertices & edges in best face */
-	if(sefa->v1->tmp.v) sefa->v1= sefa->v1->tmp.v;
-	if(sefa->v2->tmp.v) sefa->v2= sefa->v2->tmp.v;
-	if(sefa->v3->tmp.v) sefa->v3= sefa->v3->tmp.v;
-	if(sefa->v4 && sefa->v4->tmp.v) sefa->v4= sefa->v4->tmp.v;
+	/* execute the operator */
+	BMO_op_exec(em->bm, &bmop);
 
-	sefa->e1= addedgelist(em, sefa->v1, sefa->v2, sefa->e1);
-	sefa->e2= addedgelist(em, sefa->v2, sefa->v3, sefa->e2);
-	if(sefa->v4) {
-		sefa->e3= addedgelist(em, sefa->v3, sefa->v4, sefa->e3);
-		sefa->e4= addedgelist(em, sefa->v4, sefa->v1, sefa->e4);
+	/* finish the operator */
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+		return OPERATOR_CANCELLED;
 	}
-	else
-		sefa->e3= addedgelist(em, sefa->v3, sefa->v1, sefa->e3);
 
+	EDBM_update_generic(C, em, FALSE);
+
+	/* we succeeded */
+	return OPERATOR_FINISHED;
 }
 
-/* based on mouse cursor position, it defines how is being ripped */
-static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int edbm_reverse_uvs_exec(bContext *C, wmOperator *op)
 {
-	ARegion *ar= CTX_wm_region(C);
-	RegionView3D *rv3d= ar->regiondata;
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-	EditVert *eve, *nextve;
-	EditEdge *eed, *seed= NULL;
-	EditFace *efa, *sefa= NULL;
-	float projectMat[4][4], vec[3], dist, mindist;
-	short doit= 1;
-	int *mval= event->mval;
-
-	/* select flush... vertices are important */
-	EM_selectmode_set(em);
-
-	ED_view3d_ob_project_mat_get(rv3d, obedit, projectMat);
-
-	/* find best face, exclude triangles and break on face select or faces with 2 edges select */
-	mindist= 1000000.0f;
-	for(efa= em->faces.first; efa; efa=efa->next) {
-		if( efa->f & 1)
-			break;
-		if(efa->v4 && faceselectedOR(efa, SELECT) ) {
-			int totsel=0;
+	Object *ob = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(ob);
+	BMOperator bmop;
 
-			if(efa->e1->f & SELECT) totsel++;
-			if(efa->e2->f & SELECT) totsel++;
-			if(efa->e3->f & SELECT) totsel++;
-			if(efa->e4->f & SELECT) totsel++;
+	/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
+	EDBM_op_init(em, &bmop, op, "face_reverseuvs faces=%hf", BM_ELEM_SELECT);
 
-			if(totsel>1)
-				break;
-			ED_view3d_project_float(ar, efa->cent, vec, projectMat);
-			dist= sqrt( (vec[0]-mval[0])*(vec[0]-mval[0]) + (vec[1]-mval[1])*(vec[1]-mval[1]) );
-			if(dist<mindist) {
-				mindist= dist;
-				sefa= efa;
-			}
-		}
-	}
-
-	if(efa) {
-		BKE_report(op->reports, RPT_WARNING, "Can't perform ripping with faces selected this way");
-		BKE_mesh_end_editmesh(obedit->data, em);
-		return OPERATOR_CANCELLED;
-	}
-	if(sefa==NULL) {
-		BKE_report(op->reports, RPT_WARNING, "No proper selection or faces included");
-		BKE_mesh_end_editmesh(obedit->data, em);
+	/* execute the operator */
+	BMO_op_exec(em->bm, &bmop);
+
+	/* finish the operator */
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
 		return OPERATOR_CANCELLED;
 	}
 
+	EDBM_update_generic(C, em, FALSE);
 
-	/* duplicate vertices, new vertices get selected */
-	for(eve = em->verts.last; eve; eve= eve->prev) {
-		eve->tmp.v = NULL;
-		if(eve->f & SELECT) {
-			eve->tmp.v = addvertlist(em, eve->co, eve);
-			eve->f &= ~SELECT;
-			eve->tmp.v->f |= SELECT;
-		}
-	}
+	/* we succeeded */
+	return OPERATOR_FINISHED;
+}
 
-	/* find the best candidate edge */
-	/* or one of sefa edges is selected... */
-	if(sefa->e1->f & SELECT) seed= sefa->e2;
-	if(sefa->e2->f & SELECT) seed= sefa->e1;
-	if(sefa->e3->f & SELECT) seed= sefa->e2;
-	if(sefa->e4 && sefa->e4->f & SELECT) seed= sefa->e3;
-
-	/* or we do the distance trick */
-	if(seed==NULL) {
-		mindist= 1000000.0f;
-		if(sefa->e1->v1->tmp.v || sefa->e1->v2->tmp.v) {
-			dist = mesh_rip_edgedist(ar, projectMat,
-									 sefa->e1->v1->co,
-									 sefa->e1->v2->co, mval);
-			if(dist<mindist) {
-				seed= sefa->e1;
-				mindist= dist;
-			}
-		}
-		if(sefa->e2->v1->tmp.v || sefa->e2->v2->tmp.v) {
-			dist = mesh_rip_edgedist(ar, projectMat,
-									 sefa->e2->v1->co,
-									 sefa->e2->v2->co, mval);
-			if(dist<mindist) {
-				seed= sefa->e2;
-				mindist= dist;
-			}
-		}
-		if(sefa->e3->v1->tmp.v || sefa->e3->v2->tmp.v) {
-			dist= mesh_rip_edgedist(ar, projectMat,
-									sefa->e3->v1->co,
-									sefa->e3->v2->co, mval);
-			if(dist<mindist) {
-				seed= sefa->e3;
-				mindist= dist;
-			}
-		}
-		if(sefa->e4 && (sefa->e4->v1->tmp.v || sefa->e4->v2->tmp.v)) {
-			dist= mesh_rip_edgedist(ar, projectMat,
-									sefa->e4->v1->co,
-									sefa->e4->v2->co, mval);
-			if(dist<mindist) {
-				seed= sefa->e4;
-				mindist= dist;
-			}
-		}
-	}
+static int edbm_rotate_colors_exec(bContext *C, wmOperator *op)
+{
+	Object *ob = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(ob);
+	BMOperator bmop;
+
+	/* get the direction from RNA */
+	int dir = RNA_enum_get(op->ptr, "direction");
 
-	if(seed==NULL) {	// never happens?
-		BKE_report(op->reports, RPT_WARNING, "No proper edge found to start");
-		BKE_mesh_end_editmesh(obedit->data, em);
+	/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
+	EDBM_op_init(em, &bmop, op, "face_rotatecolors faces=%hf dir=%i", BM_ELEM_SELECT, dir);
+
+	/* execute the operator */
+	BMO_op_exec(em->bm, &bmop);
+
+	/* finish the operator */
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
 		return OPERATOR_CANCELLED;
 	}
 
-	faceloop_select(em, seed, 2);	// tmp abuse for finding all edges that need duplicated, returns OK faces with f1
+	/* dependencies graph and notification stuff */
+	EDBM_update_generic(C, em, FALSE);
 
-	/* duplicate edges in the loop, with at least 1 vertex selected, needed for selection flip */
-	for(eed = em->edges.last; eed; eed= eed->prev) {
-		eed->tmp.v = NULL;
-		if((eed->v1->tmp.v) || (eed->v2->tmp.v)) {
-			EditEdge *newed;
+	/* we succeeded */
+	return OPERATOR_FINISHED;
+}
 
-			newed= addedgelist(em, eed->v1->tmp.v?eed->v1->tmp.v:eed->v1,
-							   eed->v2->tmp.v?eed->v2->tmp.v:eed->v2, eed);
-			if(eed->f & SELECT) {
-				EM_select_edge(eed, 0);
-				EM_remove_selection(em, eed, EDITEDGE);
-				EM_select_edge(newed, 1);
-			}
-			eed->tmp.v = (EditVert *)newed;
-		}
-	}
 
-	/* first clear edges to help finding neighbours */
-	for(eed = em->edges.last; eed; eed= eed->prev) eed->f1= 0;
+static int edbm_reverse_colors_exec(bContext *C, wmOperator *op)
+{
+	Object *ob = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(ob);
+	BMOperator bmop;
 
-	/* put new vertices & edges && flag in best face */
-	mesh_rip_setface(em, sefa);
+	/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
+	EDBM_op_init(em, &bmop, op, "face_reversecolors faces=%hf", BM_ELEM_SELECT);
 
-	/* starting with neighbours of best face, we loop over the seam */
-	sefa->f1= 2;
-	doit= 1;
-	while(doit) {
-		doit= 0;
+	/* execute the operator */
+	BMO_op_exec(em->bm, &bmop);
 
-		for(efa= em->faces.first; efa; efa=efa->next) {
-			/* new vert in face */
-			if (efa->v1->tmp.v || efa->v2->tmp.v ||
-				efa->v3->tmp.v || (efa->v4 && efa->v4->tmp.v)) {
-				/* face is tagged with loop */
-				if(efa->f1==1) {
-					mesh_rip_setface(em, efa);
-					efa->f1= 2;
-					doit= 1;
-				}
-			}
-		}
+	/* finish the operator */
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+		return OPERATOR_CANCELLED;
 	}
 
-	/* remove loose edges, that were part of a ripped face */
-	for(eve = em->verts.first; eve; eve= eve->next) eve->f1= 0;
-	for(eed = em->edges.last; eed; eed= eed->prev) eed->f1= 0;
-	for(efa= em->faces.first; efa; efa=efa->next) {
-		efa->e1->f1= 1;
-		efa->e2->f1= 1;
-		efa->e3->f1= 1;
-		if(efa->e4) efa->e4->f1= 1;
-	}
-
-	for(eed = em->edges.last; eed; eed= seed) {
-		seed= eed->prev;
-		if(eed->f1==0) {
-			if(eed->v1->tmp.v || eed->v2->tmp.v ||
-			   (eed->v1->f & SELECT) || (eed->v2->f & SELECT)) {
-				remedge(em, eed);
-				free_editedge(em, eed);
-				eed= NULL;
-			}
-		}
-		if(eed) {
-			eed->v1->f1= 1;
-			eed->v2->f1= 1;
-		}
-	}
+	EDBM_update_generic(C, em, FALSE);
 
-	/* and remove loose selected vertices, that got duplicated accidentally */
-	for(eve = em->verts.first; eve; eve= nextve) {
-		nextve= eve->next;
-		if(eve->f1==0 && (eve->tmp.v || (eve->f & SELECT))) {
-			BLI_remlink(&em->verts,eve);
-			free_editvert(em, eve);
-		}
-	}
+	/* we succeeded */
+	return OPERATOR_FINISHED;
+}
 
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+void MESH_OT_uvs_rotate(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Rotate UVs";
+	ot->idname = "MESH_OT_uvs_rotate";
+	ot->description = "Rotate UV coordinates inside faces";
 
-	BKE_mesh_end_editmesh(obedit->data, em);
+	/* api callbacks */
+	ot->exec = edbm_rotate_uvs_exec;
+	ot->poll = ED_operator_editmesh;
 
-//	RNA_enum_set(op->ptr, "proportional", 0);
-//	RNA_boolean_set(op->ptr, "mirror", FALSE);
-//	WM_operator_name_call(C, "TRANSFORM_OT_translate", WM_OP_INVOKE_REGION_WIN, op->ptr);
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-	return OPERATOR_FINISHED;
+	/* props */
+	RNA_def_enum(ot->srna, "direction", direction_items, DIRECTION_CW, "Direction", "Direction to rotate UVs around");
 }
 
-void MESH_OT_rip(wmOperatorType *ot)
+//void MESH_OT_uvs_mirror(wmOperatorType *ot)
+void MESH_OT_uvs_reverse(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Rip";
-	ot->description= "Rip selection from mesh (quads only)";
-	ot->idname= "MESH_OT_rip";
+	ot->name = "Reverse UVs";
+	ot->idname = "MESH_OT_uvs_reverse";
+	ot->description = "Flip direction of UV coordinates inside faces";
 
 	/* api callbacks */
-	ot->invoke= mesh_rip_invoke;
-	ot->poll= EM_view3d_poll;
+	ot->exec = edbm_reverse_uvs_exec;
+	ot->poll = ED_operator_editmesh;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-	/* to give to transform */
-	/* XXX Transform this in a macro */
-	Transform_Properties(ot, P_CONSTRAINT|P_MIRROR);
+	/* props */
+	//RNA_def_enum(ot->srna, "axis", axis_items, DIRECTION_CW, "Axis", "Axis to mirror UVs around");
 }
 
+void MESH_OT_colors_rotate(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Rotate Colors";
+	ot->idname = "MESH_OT_colors_rotate";
+	ot->description = "Rotate vertex colors inside faces";
 
-/************************ Shape Operators *************************/
+	/* api callbacks */
+	ot->exec = edbm_rotate_colors_exec;
+	ot->poll = ED_operator_editmesh;
 
-static void shape_propagate(Object *obedit, EditMesh *em, wmOperator *op)
-{
-	EditVert *ev = NULL;
-	Mesh* me = (Mesh*)obedit->data;
-	Key*  ky = NULL;
-	KeyBlock* kb = NULL;
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
+	/* props */
+	RNA_def_enum(ot->srna, "direction", direction_items, DIRECTION_CCW, "Direction", "Direction to rotate edge around");
+}
 
-	if(me->key){
-		ky = me->key;
-	} else {
-		BKE_report(op->reports, RPT_WARNING, "Object Has No Key");
-		return;
-	}
+void MESH_OT_colors_reverse(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Reverse Colors";
+	ot->idname = "MESH_OT_colors_reverse";
+	ot->description = "Flip direction of vertex colors inside faces";
 
-	if(ky->block.first){
-		for(ev = em->verts.first; ev ; ev = ev->next){
-			if(ev->f & SELECT){
-				for(kb=ky->block.first;kb;kb = kb->next){
-					float *data;
-					data = kb->data;
-					VECCOPY(data+(ev->keyindex*3),ev->co);
-				}
-			}
-		}
-	} else {
-		BKE_report(op->reports, RPT_WARNING, "Object Has No Blendshapes");
-		return;
-	}
+	/* api callbacks */
+	ot->exec = edbm_reverse_colors_exec;
+	ot->poll = ED_operator_editmesh;
 
-#if 0
-	//TAG Mesh Objects that share this data
-	for(base = scene->base.first; base; base = base->next){
-		if(base->object && base->object->data == me){
-			base->object->recalc = OB_RECALC_DATA;
-		}
-	}
-#endif
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-	DAG_id_tag_update(obedit->data, 0);
-	return;
+	/* props */
+	//RNA_def_enum(ot->srna, "axis", axis_items, DIRECTION_CW, "Axis", "Axis to mirror colors around");
 }
 
 
-static int shape_propagate_to_all_exec(bContext *C, wmOperator *op)
+static int merge_firstlast(BMEditMesh *em, int first, int uvmerge, wmOperator *wmop)
 {
-	Object *obedit= CTX_data_edit_object(C);
-	Mesh *me= obedit->data;
-	EditMesh *em= BKE_mesh_get_editmesh(me);
+	BMVert *mergevert;
+	BMEditSelection *ese;
+
+	/* do sanity check in mergemenu in edit.c ?*/
+	if (first == 0) {
+		ese = em->bm->selected.last;
+		mergevert = (BMVert *)ese->ele;
+	}
+	else {
+		ese = em->bm->selected.first;
+		mergevert = (BMVert *)ese->ele;
+	}
 
-	shape_propagate(obedit, em, op);
+	if (!BM_elem_flag_test(mergevert, BM_ELEM_SELECT))
+		return OPERATOR_CANCELLED;
+	
+	if (uvmerge) {
+		if (!EDBM_op_callf(em, wmop, "pointmerge_facedata verts=%hv snapv=%e", BM_ELEM_SELECT, mergevert))
+			return OPERATOR_CANCELLED;
+	}
 
-	DAG_id_tag_update(&me->id, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
+	if (!EDBM_op_callf(em, wmop, "pointmerge verts=%hv mergeco=%v", BM_ELEM_SELECT, mergevert->co))
+		return OPERATOR_CANCELLED;
 
 	return OPERATOR_FINISHED;
 }
 
-
-void MESH_OT_shape_propagate_to_all(wmOperatorType *ot)
+static int merge_target(BMEditMesh *em, Scene *scene, View3D *v3d, Object *ob, 
+                        int target, int uvmerge, wmOperator *wmop)
 {
-	/* identifiers */
-	ot->name= "Shape Propagate";
-	ot->description= "Apply selected vertex locations to all other shape keys";
-	ot->idname= "MESH_OT_shape_propagate_to_all";
-
-	/* api callbacks */
-	ot->exec= shape_propagate_to_all_exec;
-	ot->poll= ED_operator_editmesh;
+	BMIter iter;
+	BMVert *v;
+	float *vco = NULL, co[3], cent[3] = {0.0f, 0.0f, 0.0f};
 
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
-
-static int blend_from_shape_exec(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	Mesh *me= obedit->data;
-	Key *key= me->key;
-	EditMesh *em= BKE_mesh_get_editmesh(me);
-	EditVert *eve;
-	KeyBlock *kb, *refkb= NULL;
-	float *data, *refdata= NULL, co[3];
-	float blend= RNA_float_get(op->ptr, "blend");
-	int shape= RNA_enum_get(op->ptr, "shape");
-	int add= RNA_boolean_get(op->ptr, "add");
-	int blended= 0;
-
-	if(key && (kb= BLI_findlink(&key->block, shape))) {
-		data= kb->data;
-
-		if(add) {
-			refkb= BLI_findlink(&key->block, kb->relative);
-			if(refkb)
-				refdata = refkb->data;
+	if (target) {
+		vco = give_cursor(scene, v3d);
+		copy_v3_v3(co, vco);
+		mul_m4_v3(ob->imat, co);
+	}
+	else {
+		float fac;
+		int i = 0;
+		BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) {
+			if (!BM_elem_flag_test(v, BM_ELEM_SELECT))
+				continue;
+			add_v3_v3(cent, v->co);
+			i++;
 		}
+		
+		if (!i)
+			return OPERATOR_CANCELLED;
+
+		fac = 1.0f / (float)i;
+		mul_v3_fl(cent, fac);
+		copy_v3_v3(co, cent);
+		vco = co;
+	}
 
-		for(eve=em->verts.first; eve; eve=eve->next){
-			if(eve->f & SELECT) {
-				if(eve->keyindex >= 0 && eve->keyindex < kb->totelem) {
-					copy_v3_v3(co, data + eve->keyindex*3);
+	if (!vco)
+		return OPERATOR_CANCELLED;
+	
+	if (uvmerge) {
+		if (!EDBM_op_callf(em, wmop, "vert_average_facedata verts=%hv", BM_ELEM_SELECT))
+			return OPERATOR_CANCELLED;
+	}
 
-					if(add) {
-						/* in add mode, we add relative shape key offset */
-						if(refdata && eve->keyindex < refkb->totelem)
-							sub_v3_v3v3(co, co, refdata + eve->keyindex*3);
+	if (!EDBM_op_callf(em, wmop, "pointmerge verts=%hv mergeco=%v", BM_ELEM_SELECT, co))
+		return OPERATOR_CANCELLED;
 
-						madd_v3_v3fl(eve->co, co, blend);
-					}
-					else {
-						/* in blend mode, we interpolate to the shape key */
-						interp_v3_v3v3(eve->co, eve->co, co, blend);
-					}
+	return OPERATOR_FINISHED;
+}
 
-					blended= 1;
-				}
-			}
-		}
-	}
+static int edbm_merge_exec(bContext *C, wmOperator *op)
+{
+	Scene *scene = CTX_data_scene(C);
+	View3D *v3d = CTX_wm_view3d(C);
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	int status = 0, uvs = RNA_boolean_get(op->ptr, "uvs");
 
-	BKE_mesh_end_editmesh(me, em);
+	switch (RNA_enum_get(op->ptr, "type")) {
+		case 3:
+			status = merge_target(em, scene, v3d, obedit, 0, uvs, op);
+			break;
+		case 4:
+			status = merge_target(em, scene, v3d, obedit, 1, uvs, op);
+			break;
+		case 1:
+			status = merge_firstlast(em, 0, uvs, op);
+			break;
+		case 6:
+			status = merge_firstlast(em, 1, uvs, op);
+			break;
+		case 5:
+			status = 1;
+			if (!EDBM_op_callf(em, op, "collapse edges=%he", BM_ELEM_SELECT))
+				status = 0;
+			break;
+	}
 
-	if(!blended)
+	if (!status)
 		return OPERATOR_CANCELLED;
 
-	DAG_id_tag_update(&me->id, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
+	EDBM_update_generic(C, em, TRUE);
 
 	return OPERATOR_FINISHED;
 }
 
-static EnumPropertyItem *shape_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
+static EnumPropertyItem merge_type_items[] = {
+	{6, "FIRST", 0, "At First", ""},
+	{1, "LAST", 0, "At Last", ""},
+	{3, "CENTER", 0, "At Center", ""},
+	{4, "CURSOR", 0, "At Cursor", ""},
+	{5, "COLLAPSE", 0, "Collapse", ""},
+	{0, NULL, 0, NULL, NULL}};
+
+static EnumPropertyItem *merge_type_itemf(bContext *C, PointerRNA *UNUSED(ptr),  PropertyRNA *UNUSED(prop), int *free)
 {	
-	Object *obedit= CTX_data_edit_object(C);
-	Mesh *me= (obedit) ? obedit->data : NULL;
-	Key *key;
-	KeyBlock *kb, *actkb;
-	EnumPropertyItem tmp= {0, "", 0, "", ""}, *item= NULL;
-	int totitem= 0, a;
-
-	if(obedit && obedit->type == OB_MESH) {
-		key= me->key;
-		actkb= ob_get_keyblock(obedit);
-
-		if(key && actkb) {
-			for(kb=key->block.first, a=0; kb; kb=kb->next, a++) {
-				if(kb != actkb) {
-					tmp.value= a;
-					tmp.identifier= kb->name;
-					tmp.name= kb->name;
-					RNA_enum_item_add(&item, &totitem, &tmp);
-				}
+	Object *obedit;
+	EnumPropertyItem *item = NULL;
+	int totitem = 0;
+	
+	if (!C) /* needed for docs */
+		return merge_type_items;
+	
+	obedit = CTX_data_edit_object(C);
+	if (obedit && obedit->type == OB_MESH) {
+		BMEditMesh *em = BMEdit_FromObject(obedit);
+
+		if (em->selectmode & SCE_SELECT_VERTEX) {
+			if (em->bm->selected.first && em->bm->selected.last &&
+			    ((BMEditSelection *)em->bm->selected.first)->htype == BM_VERT &&
+			    ((BMEditSelection *)em->bm->selected.last)->htype == BM_VERT)
+			{
+				RNA_enum_items_add_value(&item, &totitem, merge_type_items, 6);
+				RNA_enum_items_add_value(&item, &totitem, merge_type_items, 1);
+			}
+			else if (em->bm->selected.first && ((BMEditSelection *)em->bm->selected.first)->htype == BM_VERT) {
+				RNA_enum_items_add_value(&item, &totitem, merge_type_items, 6);
+			}
+			else if (em->bm->selected.last && ((BMEditSelection *)em->bm->selected.last)->htype == BM_VERT) {
+				RNA_enum_items_add_value(&item, &totitem, merge_type_items, 1);
 			}
 		}
-	}
 
-	RNA_enum_item_end(&item, &totitem);
-	*free= 1;
+		RNA_enum_items_add_value(&item, &totitem, merge_type_items, 3);
+		RNA_enum_items_add_value(&item, &totitem, merge_type_items, 4);
+		RNA_enum_items_add_value(&item, &totitem, merge_type_items, 5);
+		RNA_enum_item_end(&item, &totitem);
 
-	return item;
+		*free = 1;
+
+		return item;
+	}
+	
+	return NULL;
 }
 
-void MESH_OT_blend_from_shape(wmOperatorType *ot)
+void MESH_OT_merge(wmOperatorType *ot)
 {
-	PropertyRNA *prop;
-	static EnumPropertyItem shape_items[]= {{0, NULL, 0, NULL, NULL}};
-
 	/* identifiers */
-	ot->name= "Blend From Shape";
-	ot->description= "Blend in shape from a shape key";
-	ot->idname= "MESH_OT_blend_from_shape";
+	ot->name = "Merge";
+	ot->description = "Merge selected vertices";
+	ot->idname = "MESH_OT_merge";
 
 	/* api callbacks */
-	ot->exec= blend_from_shape_exec;
-	ot->invoke= WM_operator_props_popup;
-	ot->poll= ED_operator_editmesh;
+	ot->exec = edbm_merge_exec;
+	ot->invoke = WM_menu_invoke;
+	ot->poll = ED_operator_editmesh;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* properties */
-	prop= RNA_def_enum(ot->srna, "shape", shape_items, 0, "Shape", "Shape key to use for blending");
-	RNA_def_enum_funcs(prop, shape_itemf);
-	RNA_def_float(ot->srna, "blend", 1.0f, -FLT_MAX, FLT_MAX, "Blend", "Blending factor", -2.0f, 2.0f);
-	RNA_def_boolean(ot->srna, "add", 0, "Add", "Add rather than blend between shapes");
+	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");
 }
 
-/************************ Merge Operator *************************/
-
-/* Collection Routines|Currently used by the improved merge code*/
-/* buildEdge_collection() creates a list of lists*/
-/* these lists are filled with edges that are topologically connected.*/
-/* This whole tool needs to be redone, its rather poorly implemented...*/
-
-typedef struct Collection{
-	struct Collection *next, *prev;
-	int index;
-	ListBase collectionbase;
-} Collection;
 
-typedef struct CollectedEdge{
-	struct CollectedEdge *next, *prev;
-	EditEdge *eed;
-} CollectedEdge;
-
-#define MERGELIMIT 0.000001
-
-static void build_edgecollection(EditMesh *em, ListBase *allcollections)
+static int edbm_remove_doubles_exec(bContext *C, wmOperator *op)
 {
-	EditEdge *eed;
-	Collection *edgecollection, *newcollection;
-	CollectedEdge *newedge;
-
-	int currtag = 1;
-	short ebalanced = 0;
-	short collectionfound = 0;
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMOperator bmop;
+	int count;
 
-	for (eed=em->edges.first; eed; eed = eed->next){
-		eed->tmp.l = 0;
-		eed->v1->tmp.l = 0;
-		eed->v2->tmp.l = 0;
-	}
+	EDBM_op_init(em, &bmop, op, "finddoubles verts=%hv dist=%f", BM_ELEM_SELECT, RNA_float_get(op->ptr, "mergedist"));
+	BMO_op_exec(em->bm, &bmop);
 
-	/*1st pass*/
-	for(eed=em->edges.first; eed; eed=eed->next){
-			if(eed->f&SELECT){
-				eed->v1->tmp.l = currtag;
-				eed->v2->tmp.l = currtag;
-				currtag +=1;
-			}
-	}
+	count = BMO_slot_map_count(em->bm, &bmop, "targetmapout");
 
-	/*2nd pass - Brute force. Loop through selected faces until there are no 'unbalanced' edges left (those with both vertices 'tmp.l' tag matching */
-	while(ebalanced == 0){
-		ebalanced = 1;
-		for(eed=em->edges.first; eed; eed = eed->next){
-			if(eed->f&SELECT){
-				if(eed->v1->tmp.l != eed->v2->tmp.l) /*unbalanced*/{
-					if(eed->v1->tmp.l > eed->v2->tmp.l && eed->v2->tmp.l !=0) eed->v1->tmp.l = eed->v2->tmp.l;
-					else if(eed->v1 != 0) eed->v2->tmp.l = eed->v1->tmp.l;
-					ebalanced = 0;
-				}
-			}
-		}
+	if (!EDBM_op_callf(em, op, "weldverts targetmap=%s", &bmop, "targetmapout")) {
+		BMO_op_finish(em->bm, &bmop);
+		return OPERATOR_CANCELLED;
 	}
 
-	/*3rd pass, set all the edge flags (unnessecary?)*/
-	for(eed=em->edges.first; eed; eed = eed->next){
-		if(eed->f&SELECT) eed->tmp.l = eed->v1->tmp.l;
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+		return OPERATOR_CANCELLED;
 	}
+	
+	BKE_reportf(op->reports, RPT_INFO, "Removed %d vert%s", count, (count == 1) ? "ex" : "ices");
 
-	for(eed=em->edges.first; eed; eed=eed->next){
-		if(eed->f&SELECT){
-			if(allcollections->first){
-				for(edgecollection = allcollections->first; edgecollection; edgecollection=edgecollection->next){
-					if(edgecollection->index == eed->tmp.l){
-						newedge = MEM_mallocN(sizeof(CollectedEdge), "collected edge");
-						newedge->eed = eed;
-						BLI_addtail(&(edgecollection->collectionbase), newedge);
-						collectionfound = 1;
-						break;
-					}
-					else collectionfound = 0;
-				}
-			}
-			if(allcollections->first == NULL || collectionfound == 0){
-				newcollection = MEM_mallocN(sizeof(Collection), "element collection");
-				newcollection->index = eed->tmp.l;
-				newcollection->collectionbase.first = 0;
-				newcollection->collectionbase.last = 0;
-
-				newedge = MEM_mallocN(sizeof(CollectedEdge), "collected edge");
-				newedge->eed = eed;
-
-				BLI_addtail(&(newcollection->collectionbase), newedge);
-				BLI_addtail(allcollections, newcollection);
-			}
-		}
+	EDBM_update_generic(C, em, TRUE);
 
-	}
+	return OPERATOR_FINISHED;
 }
 
-static void freecollections(ListBase *allcollections)
+void MESH_OT_remove_doubles(wmOperatorType *ot)
 {
-	struct Collection *curcollection;
+	/* identifiers */
+	ot->name = "Remove Doubles";
+	ot->description = "Remove duplicate vertices";
+	ot->idname = "MESH_OT_remove_doubles";
+
+	/* api callbacks */
+	ot->exec = edbm_remove_doubles_exec;
+	ot->poll = ED_operator_editmesh;
+
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-	for(curcollection = allcollections->first; curcollection; curcollection = curcollection->next)
-		BLI_freelistN(&(curcollection->collectionbase));
-	BLI_freelistN(allcollections);
+	RNA_def_float(ot->srna, "mergedist", 0.0001f, 0.000001f, 50.0f, 
+	              "Merge Distance",
+	              "Minimum distance between elements to merge", 0.00001, 10.0);
 }
 
-/*Begin UV Edge Collapse Code
-	Like Edge subdivide, Edge Collapse should handle UV's intelligently, but since UV's are a per-face attribute, normal edge collapse will fail
-	in areas such as the boundaries of 'UV islands'. So for each edge collection we need to build a set of 'welded' UV vertices and edges for it.
-	The welded UV edges can then be sorted and collapsed.
-*/
-typedef struct wUV{
-	struct wUV *next, *prev;
-	ListBase nodes;
-	float u, v; /*cached copy of UV coordinates pointed to by nodes*/
-	EditVert *eve;
-	int f;
-} wUV;
+/************************ Vertex Path Operator *************************/
+
+typedef struct PathNode {
+	/* int u; */       /* UNUSED */
+	/* int visited; */ /* UNUSED */
+	ListBase edges;
+} PathNode;
 
-typedef struct wUVNode{
-	struct wUVNode *next, *prev;
-	float *u; /*pointer to original tface data*/
-	float *v; /*pointer to original tface data*/
-} wUVNode;
+typedef struct PathEdge {
+	struct PathEdge *next, *prev;
+	int v;
+	float w;
+} PathEdge;
 
-typedef struct wUVEdge{
-	struct wUVEdge *next, *prev;
-	float v1uv[2], v2uv[2]; /*nasty.*/
-	struct wUV *v1, *v2; /*oriented same as editedge*/
-	EditEdge *eed;
-	int f;
-} wUVEdge;
 
-typedef struct wUVEdgeCollect{ /*used for grouping*/
-	struct wUVEdgeCollect *next, *prev;
-	wUVEdge *uved;
-	int id;
-} wUVEdgeCollect;
 
-static void append_weldedUV(EditMesh *em, EditFace *efa, EditVert *eve, int tfindex, ListBase *uvverts)
+static int edbm_select_vertex_path_exec(bContext *C, wmOperator *op)
 {
-	wUV *curwvert, *newwvert;
-	wUVNode *newnode;
-	int found;
-	MTFace *tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+	Object *ob = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(ob);
+	BMOperator bmop;
+	BMEditSelection *sv, *ev;
 
-	found = 0;
+	/* get the type from RNA */
+	int type = RNA_enum_get(op->ptr, "type");
 
-	for(curwvert=uvverts->first; curwvert; curwvert=curwvert->next){
-		if(curwvert->eve == eve && curwvert->u == tf->uv[tfindex][0] && curwvert->v == tf->uv[tfindex][1]){
-			newnode = MEM_callocN(sizeof(wUVNode), "Welded UV Vert Node");
-			newnode->u = &(tf->uv[tfindex][0]);
-			newnode->v = &(tf->uv[tfindex][1]);
-			BLI_addtail(&(curwvert->nodes), newnode);
-			found = 1;
-			break;
-		}
-	}
+	sv = em->bm->selected.last;
+	if (sv != NULL)
+		ev = sv->prev;
+	else return OPERATOR_CANCELLED;
+	if (ev == NULL)
+		return OPERATOR_CANCELLED;
+
+	if ((sv->htype != BM_VERT) || (ev->htype != BM_VERT))
+		return OPERATOR_CANCELLED;
 
-	if(!found){
-		newnode = MEM_callocN(sizeof(wUVNode), "Welded UV Vert Node");
-		newnode->u = &(tf->uv[tfindex][0]);
-		newnode->v = &(tf->uv[tfindex][1]);
+	/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
+	EDBM_op_init(em, &bmop, op, "vertexshortestpath startv=%e endv=%e type=%i", sv->ele, ev->ele, type);
 
-		newwvert = MEM_callocN(sizeof(wUV), "Welded UV Vert");
-		newwvert->u = *(newnode->u);
-		newwvert->v = *(newnode->v);
-		newwvert->eve = eve;
+	/* execute the operator */
+	BMO_op_exec(em->bm, &bmop);
 
-		BLI_addtail(&(newwvert->nodes), newnode);
-		BLI_addtail(uvverts, newwvert);
+	/* DO NOT clear the existing selection */
+	/* 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);
 
-static void build_weldedUVs(EditMesh *em, ListBase *uvverts)
-{
-	EditFace *efa;
-	for(efa=em->faces.first; efa; efa=efa->next){
-		if(efa->v1->f1) append_weldedUV(em, efa, efa->v1, 0, uvverts);
-		if(efa->v2->f1) append_weldedUV(em, efa, efa->v2, 1, uvverts);
-		if(efa->v3->f1) append_weldedUV(em, efa, efa->v3, 2, uvverts);
-		if(efa->v4 && efa->v4->f1) append_weldedUV(em, efa, efa->v4, 3, uvverts);
+	/* finish the operator */
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+		return OPERATOR_CANCELLED;
 	}
-}
 
-static void append_weldedUVEdge(EditMesh *em, EditFace *efa, EditEdge *eed, ListBase *uvedges)
-{
-	wUVEdge *curwedge, *newwedge;
-	int v1tfindex, v2tfindex, found;
-	MTFace *tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+	EDBM_selectmode_flush(em);
+
+	EDBM_update_generic(C, em, FALSE);
 
-	found = 0;
+	/* we succeeded */
+	return OPERATOR_FINISHED;
+}
 
-	if(eed->v1 == efa->v1) v1tfindex = 0;
-	else if(eed->v1 == efa->v2) v1tfindex = 1;
-	else if(eed->v1 == efa->v3) v1tfindex = 2;
-	else /* if(eed->v1 == efa->v4) */ v1tfindex = 3;
+void MESH_OT_select_vertex_path(wmOperatorType *ot)
+{
+	static const EnumPropertyItem type_items[] = {
+		{VPATH_SELECT_EDGE_LENGTH, "EDGE_LENGTH", 0, "Edge Length", NULL},
+		{VPATH_SELECT_TOPOLOGICAL, "TOPOLOGICAL", 0, "Topological", NULL},
+		{0, NULL, 0, NULL, NULL}
+	};
 
-	if(eed->v2 == efa->v1) v2tfindex = 0;
-	else if(eed->v2 == efa->v2) v2tfindex = 1;
-	else if(eed->v2 == efa->v3) v2tfindex = 2;
-	else /* if(eed->v2 == efa->v4) */ v2tfindex = 3;
+	/* identifiers */
+	ot->name = "Select Vertex Path";
+	ot->idname = "MESH_OT_select_vertex_path";
+	ot->description = "Selected vertex path between two vertices";
 
-	for(curwedge=uvedges->first; curwedge; curwedge=curwedge->next){
-			if(curwedge->eed == eed && curwedge->v1uv[0] == tf->uv[v1tfindex][0] && curwedge->v1uv[1] == tf->uv[v1tfindex][1] && curwedge->v2uv[0] == tf->uv[v2tfindex][0] && curwedge->v2uv[1] == tf->uv[v2tfindex][1]){
-				found = 1;
-				break; //do nothing, we don't need another welded uv edge
-			}
-	}
+	/* api callbacks */
+	ot->exec = edbm_select_vertex_path_exec;
+	ot->poll = ED_operator_editmesh;
 
-	if(!found){
-		newwedge = MEM_callocN(sizeof(wUVEdge), "Welded UV Edge");
-		newwedge->v1uv[0] = tf->uv[v1tfindex][0];
-		newwedge->v1uv[1] = tf->uv[v1tfindex][1];
-		newwedge->v2uv[0] = tf->uv[v2tfindex][0];
-		newwedge->v2uv[1] = tf->uv[v2tfindex][1];
-		newwedge->eed = eed;
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-		BLI_addtail(uvedges, newwedge);
-	}
+	/* properties */
+	RNA_def_enum(ot->srna, "type", type_items, VPATH_SELECT_EDGE_LENGTH, "Type", "Method to compute distance");
 }
+/********************** Rip Operator *************************/
+
+/************************ Shape Operators *************************/
 
-static void build_weldedUVEdges(EditMesh *em, ListBase *uvedges, ListBase *uvverts)
+/* BMESH_TODO this should be properly encapsulated in a bmop.  but later.*/
+static void shape_propagate(BMEditMesh *em, wmOperator *op)
 {
-	wUV *curwvert;
-	wUVEdge *curwedge;
-	EditFace *efa;
+	BMIter iter;
+	BMVert *eve = NULL;
+	float *co;
+	int i, totshape = CustomData_number_of_layers(&em->bm->vdata, CD_SHAPEKEY);
 
-	for(efa=em->faces.first; efa; efa=efa->next){
-		if(efa->e1->f1) append_weldedUVEdge(em, efa, efa->e1, uvedges);
-		if(efa->e2->f1) append_weldedUVEdge(em, efa, efa->e2, uvedges);
-		if(efa->e3->f1) append_weldedUVEdge(em, efa, efa->e3, uvedges);
-		if(efa->e4 && efa->e4->f1) append_weldedUVEdge(em, efa, efa->e4, uvedges);
+	if (!CustomData_has_layer(&em->bm->vdata, CD_SHAPEKEY)) {
+		BKE_report(op->reports, RPT_ERROR, "Mesh does not have shape keys");
+		return;
 	}
+	
+	BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+		if (!BM_elem_flag_test(eve, BM_ELEM_SELECT) || BM_elem_flag_test(eve, BM_ELEM_HIDDEN))
+			continue;
 
-
-	//link vertices: for each uvedge, search uvverts to populate v1 and v2 pointers
-	for(curwedge=uvedges->first; curwedge; curwedge=curwedge->next){
-		for(curwvert=uvverts->first; curwvert; curwvert=curwvert->next){
-			if(curwedge->eed->v1 == curwvert->eve && curwedge->v1uv[0] == curwvert->u && curwedge->v1uv[1] == curwvert->v){
-				curwedge->v1 = curwvert;
-				break;
-			}
+		for (i = 0; i < totshape; i++) {
+			co = CustomData_bmesh_get_n(&em->bm->vdata, eve->head.data, CD_SHAPEKEY, i);
+			copy_v3_v3(co, eve->co);
 		}
-		for(curwvert=uvverts->first; curwvert; curwvert=curwvert->next){
-			if(curwedge->eed->v2 == curwvert->eve && curwedge->v2uv[0] == curwvert->u && curwedge->v2uv[1] == curwvert->v){
-				curwedge->v2 = curwvert;
-				break;
-			}
+	}
+
+#if 0
+	//TAG Mesh Objects that share this data
+	for (base = scene->base.first; base; base = base->next) {
+		if (base->object && base->object->data == me) {
+			base->object->recalc = OB_RECALC_DATA;
 		}
 	}
+#endif
 }
 
-static void free_weldedUVs(ListBase *uvverts)
-{
-	wUV *curwvert;
-	for(curwvert = uvverts->first; curwvert; curwvert=curwvert->next) BLI_freelistN(&(curwvert->nodes));
-	BLI_freelistN(uvverts);
-}
 
-static void collapse_edgeuvs(EditMesh *em)
+static int edbm_shape_propagate_to_all_exec(bContext *C, wmOperator *op)
 {
-	ListBase uvedges, uvverts, allcollections;
-	wUVEdge *curwedge;
-	wUVNode *curwnode;
-	wUVEdgeCollect *collectedwuve, *newcollectedwuve;
-	Collection *wuvecollection, *newcollection;
-	int curtag, balanced, collectionfound= 0, vcount;
-	float avg[2];
+	Object *obedit = CTX_data_edit_object(C);
+	Mesh *me = obedit->data;
+	BMEditMesh *em = me->edit_btmesh;
 
-	if (!EM_texFaceCheck(em))
-		return;
+	shape_propagate(em, op);
 
-	uvverts.first = uvverts.last = uvedges.first = uvedges.last = allcollections.first = allcollections.last = NULL;
+	EDBM_update_generic(C, em, FALSE);
 
-	build_weldedUVs(em, &uvverts);
-	build_weldedUVEdges(em, &uvedges, &uvverts);
+	return OPERATOR_FINISHED;
+}
 
-	curtag = 0;
 
-	for(curwedge=uvedges.first; curwedge; curwedge=curwedge->next){
-		curwedge->v1->f = curtag;
-		curwedge->v2->f = curtag;
-		curtag +=1;
-	}
+void MESH_OT_shape_propagate_to_all(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Shape Propagate";
+	ot->description = "Apply selected vertex locations to all other shape keys";
+	ot->idname = "MESH_OT_shape_propagate_to_all";
 
-	balanced = 0;
-	while(!balanced){
-		balanced = 1;
-		for(curwedge=uvedges.first; curwedge; curwedge=curwedge->next){
-			if(curwedge->v1->f != curwedge->v2->f){
-				if(curwedge->v1->f > curwedge->v2->f) curwedge->v1->f = curwedge->v2->f;
-				else curwedge->v2->f = curwedge->v1->f;
-				balanced = 0;
-			}
-		}
-	}
+	/* api callbacks */
+	ot->exec = edbm_shape_propagate_to_all_exec;
+	ot->poll = ED_operator_editmesh;
+
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+/* BMESH_TODO this should be properly encapsulated in a bmop.  but later.*/
+static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	Mesh *me = obedit->data;
+	BMEditMesh *em = me->edit_btmesh;
+	BMVert *eve;
+	BMIter iter;
+	float co[3], *sco;
+	float blend = RNA_float_get(op->ptr, "blend");
+	int shape = RNA_enum_get(op->ptr, "shape");
+	int add = RNA_boolean_get(op->ptr, "add");
+	int totshape;
+
+	/* sanity check */
+	totshape = CustomData_number_of_layers(&em->bm->vdata, CD_SHAPEKEY);
+	if (totshape == 0 || shape < 0 || shape >= totshape)
+		return OPERATOR_CANCELLED;
 
-	for(curwedge=uvedges.first; curwedge; curwedge=curwedge->next) curwedge->f = curwedge->v1->f;
+	BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+		if (!BM_elem_flag_test(eve, BM_ELEM_SELECT) || BM_elem_flag_test(eve, BM_ELEM_HIDDEN))
+			continue;
 
+		sco = CustomData_bmesh_get_n(&em->bm->vdata, eve->head.data, CD_SHAPEKEY, shape);
+		copy_v3_v3(co, sco);
 
-	for(curwedge=uvedges.first; curwedge; curwedge=curwedge->next){
-		if(allcollections.first){
-			for(wuvecollection = allcollections.first; wuvecollection; wuvecollection=wuvecollection->next){
-				if(wuvecollection->index == curwedge->f){
-					newcollectedwuve = MEM_callocN(sizeof(wUVEdgeCollect), "Collected Welded UV Edge");
-					newcollectedwuve->uved = curwedge;
-					BLI_addtail(&(wuvecollection->collectionbase), newcollectedwuve);
-					collectionfound = 1;
-					break;
-				}
 
-				else collectionfound = 0;
-			}
+		if (add) {
+			mul_v3_fl(co, blend);
+			add_v3_v3v3(eve->co, eve->co, co);
+		}
+		else {
+			interp_v3_v3v3(eve->co, eve->co, co, blend);
 		}
-		if(allcollections.first == NULL || collectionfound == 0){
-			newcollection = MEM_callocN(sizeof(Collection), "element collection");
-			newcollection->index = curwedge->f;
-			newcollection->collectionbase.first = 0;
-			newcollection->collectionbase.last = 0;
+		
+		copy_v3_v3(sco, co);
+	}
+
+	EDBM_update_generic(C, em, TRUE);
+
+	return OPERATOR_FINISHED;
+}
 
-			newcollectedwuve = MEM_callocN(sizeof(wUVEdgeCollect), "Collected Welded UV Edge");
-			newcollectedwuve->uved = curwedge;
+static EnumPropertyItem *shape_itemf(bContext *C, PointerRNA *UNUSED(ptr),  PropertyRNA *UNUSED(prop), int *free)
+{	
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em;
+	EnumPropertyItem *item = NULL;
+	int totitem = 0;
+
+	if ((obedit && obedit->type == OB_MESH) &&
+	    (em = BMEdit_FromObject(obedit)) &&
+	    CustomData_has_layer(&em->bm->vdata, CD_SHAPEKEY))
+	{
+		EnumPropertyItem tmp = {0, "", 0, "", ""};
+		int a;
+
+		for (a = 0; a < em->bm->vdata.totlayer; a++) {
+			if (em->bm->vdata.layers[a].type != CD_SHAPEKEY)
+				continue;
 
-			BLI_addtail(&(newcollection->collectionbase), newcollectedwuve);
-			BLI_addtail(&allcollections, newcollection);
+			tmp.value = totitem;
+			tmp.identifier = em->bm->vdata.layers[a].name;
+			tmp.name = em->bm->vdata.layers[a].name;
+			/* RNA_enum_item_add sets totitem itself! */
+			RNA_enum_item_add(&item, &totitem, &tmp);
 		}
 	}
 
-	for(wuvecollection=allcollections.first; wuvecollection; wuvecollection=wuvecollection->next){
+	RNA_enum_item_end(&item, &totitem);
+	*free = 1;
+
+	return item;
+}
 
-		vcount = avg[0] = avg[1] = 0;
+void MESH_OT_blend_from_shape(wmOperatorType *ot)
+{
+	PropertyRNA *prop;
+	static EnumPropertyItem shape_items[] = {{0, NULL, 0, NULL, NULL}};
 
-		for(collectedwuve= wuvecollection->collectionbase.first; collectedwuve; collectedwuve = collectedwuve->next){
-			avg[0] += collectedwuve->uved->v1uv[0];
-			avg[1] += collectedwuve->uved->v1uv[1];
+	/* identifiers */
+	ot->name = "Blend From Shape";
+	ot->description = "Blend in shape from a shape key";
+	ot->idname = "MESH_OT_blend_from_shape";
 
-			avg[0] += collectedwuve->uved->v2uv[0];
-			avg[1] += collectedwuve->uved->v2uv[1];
+	/* api callbacks */
+	ot->exec = edbm_blend_from_shape_exec;
+	ot->invoke = WM_operator_props_popup;
+	ot->poll = ED_operator_editmesh;
 
-			vcount +=2;
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-		}
+	/* properties */
+	prop = RNA_def_enum(ot->srna, "shape", shape_items, 0, "Shape", "Shape key to use for blending");
+	RNA_def_enum_funcs(prop, shape_itemf);
+	RNA_def_float(ot->srna, "blend", 1.0f, -FLT_MAX, FLT_MAX, "Blend", "Blending factor", -2.0f, 2.0f);
+	RNA_def_boolean(ot->srna, "add", 1, "Add", "Add rather than blend between shapes");
+}
 
-		avg[0] /= vcount; avg[1] /= vcount;
+/* BMESH_TODO - some way to select on an arbitrary axis */
+static int edbm_select_axis_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMEditSelection *ese = em->bm->selected.last;
+	int axis = RNA_enum_get(op->ptr, "axis");
+	int mode = RNA_enum_get(op->ptr, "mode"); /* -1 == aligned, 0 == neg, 1 == pos */
 
-		for(collectedwuve= wuvecollection->collectionbase.first; collectedwuve; collectedwuve = collectedwuve->next){
-			for(curwnode=collectedwuve->uved->v1->nodes.first; curwnode; curwnode=curwnode->next){
-				*(curwnode->u) = avg[0];
-				*(curwnode->v) = avg[1];
-			}
-			for(curwnode=collectedwuve->uved->v2->nodes.first; curwnode; curwnode=curwnode->next){
-				*(curwnode->u) = avg[0];
-				*(curwnode->v) = avg[1];
+	if (ese == NULL || ese->htype != BM_VERT) {
+		BKE_report(op->reports, RPT_WARNING, "This operator requires an active vertex (last selected)");
+		return OPERATOR_CANCELLED;
+	}
+	else {
+		BMVert *ev, *act_vert = (BMVert *)ese->ele;
+		BMIter iter;
+		float value = act_vert->co[axis];
+		float limit =  CTX_data_tool_settings(C)->doublimit; // XXX
+
+		if (mode == 0)
+			value -= limit;
+		else if (mode == 1)
+			value += limit;
+
+		BM_ITER_MESH (ev, &iter, em->bm, BM_VERTS_OF_MESH) {
+			if (!BM_elem_flag_test(ev, BM_ELEM_HIDDEN)) {
+				switch (mode) {
+					case -1: /* aligned */
+						if (fabs(ev->co[axis] - value) < limit)
+							BM_vert_select_set(em->bm, ev, TRUE);
+						break;
+					case 0: /* neg */
+						if (ev->co[axis] > value)
+							BM_vert_select_set(em->bm, ev, TRUE);
+						break;
+					case 1: /* pos */
+						if (ev->co[axis] < value)
+							BM_vert_select_set(em->bm, ev, TRUE);
+						break;
+				}
 			}
 		}
 	}
 
-	free_weldedUVs(&uvverts);
-	BLI_freelistN(&uvedges);
-	freecollections(&allcollections);
-}
+	EDBM_selectmode_flush(em);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 
-/*End UV Edge collapse code*/
+	return OPERATOR_FINISHED;
+}
 
-static void collapseuvs(EditMesh *em, EditVert *mergevert)
+void MESH_OT_select_axis(wmOperatorType *ot)
 {
-	EditFace *efa;
-	MTFace *tf;
-	int uvcount;
-	float uvav[2];
+	static EnumPropertyItem axis_mode_items[] = {
+		{0,  "POSITIVE", 0, "Positive Axis", ""},
+		{1,  "NEGATIVE", 0, "Negative Axis", ""},
+		{-1, "ALIGNED",  0, "Aligned Axis", ""},
+		{0, NULL, 0, NULL, NULL}};
 
-	if (!EM_texFaceCheck(em))
-		return;
+	static EnumPropertyItem axis_items_xyz[] = {
+		{0, "X_AXIS", 0, "X Axis", ""},
+		{1, "Y_AXIS", 0, "Y Axis", ""},
+		{2, "Z_AXIS", 0, "Z Axis", ""},
+		{0, NULL, 0, NULL, NULL}};
 
-	uvcount = 0;
-	uvav[0] = 0;
-	uvav[1] = 0;
+	/* identifiers */
+	ot->name = "Select Axis";
+	ot->description = "Select all data in the mesh on a single axis";
+	ot->idname = "MESH_OT_select_axis";
 
-	for(efa = em->faces.first; efa; efa=efa->next){
-		tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+	/* api callbacks */
+	ot->exec = edbm_select_axis_exec;
+	ot->poll = ED_operator_editmesh;
 
-		if(efa->v1->f1 && ELEM(mergevert, NULL, efa->v1)) {
-			uvav[0] += tf->uv[0][0];
-			uvav[1] += tf->uv[0][1];
-			uvcount += 1;
-		}
-		if(efa->v2->f1 && ELEM(mergevert, NULL, efa->v2)){
-			uvav[0] += tf->uv[1][0];
-			uvav[1] += tf->uv[1][1];
-			uvcount += 1;
-		}
-		if(efa->v3->f1 && ELEM(mergevert, NULL, efa->v3)){
-			uvav[0] += tf->uv[2][0];
-			uvav[1] += tf->uv[2][1];
-			uvcount += 1;
-		}
-		if(efa->v4 && efa->v4->f1 && ELEM(mergevert, NULL, efa->v4)){
-			uvav[0] += tf->uv[3][0];
-			uvav[1] += tf->uv[3][1];
-			uvcount += 1;
-		}
-	}
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+	/* properties */
+	RNA_def_enum(ot->srna, "mode", axis_mode_items, 0, "Axis Mode", "Axis side to use when selecting");
+	RNA_def_enum(ot->srna, "axis", axis_items_xyz, 0, "Axis", "Select the axis to compare each vertex on");
+}
 
-	if(uvcount > 0) {
-		uvav[0] /= uvcount;
-		uvav[1] /= uvcount;
+static int edbm_solidify_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	Mesh *me = obedit->data;
+	BMEditMesh *em = me->edit_btmesh;
+	BMesh *bm = em->bm;
+	BMOperator bmop;
 
-		for(efa = em->faces.first; efa; efa=efa->next){
-			tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+	float thickness = RNA_float_get(op->ptr, "thickness");
 
-			if(efa->v1->f1){
-				tf->uv[0][0] = uvav[0];
-				tf->uv[0][1] = uvav[1];
-			}
-			if(efa->v2->f1){
-				tf->uv[1][0] = uvav[0];
-				tf->uv[1][1] = uvav[1];
-			}
-			if(efa->v3->f1){
-				tf->uv[2][0] = uvav[0];
-				tf->uv[2][1] = uvav[1];
-			}
-			if(efa->v4 && efa->v4->f1){
-				tf->uv[3][0] = uvav[0];
-				tf->uv[3][1] = uvav[1];
-			}
-		}
+	if (!EDBM_op_init(em, &bmop, op, "solidify geom=%hf thickness=%f", BM_ELEM_SELECT, thickness)) {
+		return OPERATOR_CANCELLED;
 	}
-}
 
-static int collapseEdges(EditMesh *em)
-{
-	EditVert *eve;
-	EditEdge *eed;
+	/* 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);
 
-	ListBase allcollections;
-	CollectedEdge *curredge;
-	Collection *edgecollection;
+	/* run the solidify operator */
+	BMO_op_exec(bm, &bmop);
 
-	int totedges, mergecount,vcount /*, groupcount*/;
-	float avgcount[3];
+	/* select the newly generated faces */
+	BMO_slot_buffer_hflag_enable(bm, &bmop, "geomout", BM_FACE, BM_ELEM_SELECT, TRUE);
 
-	allcollections.first = 0;
-	allcollections.last = 0;
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+		return OPERATOR_CANCELLED;
+	}
 
-	mergecount = 0;
+	EDBM_update_generic(C, em, TRUE);
 
-	build_edgecollection(em, &allcollections);
-	/*groupcount = BLI_countlist(&allcollections);*/ /*UNUSED*/
+	return OPERATOR_FINISHED;
+}
 
 
-	for(edgecollection = allcollections.first; edgecollection; edgecollection = edgecollection->next){
-		totedges = BLI_countlist(&(edgecollection->collectionbase));
-		mergecount += totedges;
-		avgcount[0] = 0; avgcount[1] = 0; avgcount[2] = 0;
+void MESH_OT_solidify(wmOperatorType *ot)
+{
+	PropertyRNA *prop;
+	/* identifiers */
+	ot->name = "Solidify";
+	ot->description = "Create a solid skin by extruding, compensating for sharp angles";
+	ot->idname = "MESH_OT_solidify";
 
-		vcount = 0;
+	/* api callbacks */
+	ot->exec = edbm_solidify_exec;
+	ot->poll = ED_operator_editmesh;
 
-		for(curredge = edgecollection->collectionbase.first; curredge; curredge = curredge->next){
-			avgcount[0] += ((EditEdge*)curredge->eed)->v1->co[0];
-			avgcount[1] += ((EditEdge*)curredge->eed)->v1->co[1];
-			avgcount[2] += ((EditEdge*)curredge->eed)->v1->co[2];
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-			avgcount[0] += ((EditEdge*)curredge->eed)->v2->co[0];
-			avgcount[1] += ((EditEdge*)curredge->eed)->v2->co[1];
-			avgcount[2] += ((EditEdge*)curredge->eed)->v2->co[2];
+	prop = RNA_def_float(ot->srna, "thickness", 0.01f, -FLT_MAX, FLT_MAX, "thickness", "", -10.0f, 10.0f);
+	RNA_def_property_ui_range(prop, -10, 10, 0.1, 4);
+}
 
-			vcount +=2;
-		}
+#define TRAIL_POLYLINE 1 /* For future use, They don't do anything yet */
+#define TRAIL_FREEHAND 2
+#define TRAIL_MIXED    3 /* (1|2) */
+#define TRAIL_AUTO     4 
+#define TRAIL_MIDPOINTS 8
 
-		avgcount[0] /= vcount; avgcount[1] /=vcount; avgcount[2] /= vcount;
+typedef struct CutCurve {
+	float x;
+	float y;
+} CutCurve;
 
-		for(curredge = edgecollection->collectionbase.first; curredge; curredge = curredge->next){
-			VECCOPY(((EditEdge*)curredge->eed)->v1->co,avgcount);
-			VECCOPY(((EditEdge*)curredge->eed)->v2->co,avgcount);
-		}
+/* ******************************************************************** */
+/* Knife Subdivide Tool.  Subdivides edges intersected by a mouse trail
+ * drawn by user.
+ *
+ * Currently mapped to KKey when in MeshEdit mode.
+ * Usage:
+ * - Hit Shift K, Select Centers or Exact
+ * - Hold LMB down to draw path, hit RETKEY.
+ * - ESC cancels as expected.
+ *
+ * Contributed by Robert Wenzlaff (Det. Thorn).
+ *
+ * 2.5 Revamp:
+ *  - non modal (no menu before cutting)
+ *  - exit on mouse release
+ *  - polygon/segment drawing can become handled by WM cb later
+ *
+ * bmesh port version
+ */
 
-		if (EM_texFaceCheck(em)) {
-			/*uv collapse*/
-			for(eve=em->verts.first; eve; eve=eve->next) eve->f1 = 0;
-			for(eed=em->edges.first; eed; eed=eed->next) eed->f1 = 0;
-			for(curredge = edgecollection->collectionbase.first; curredge; curredge = curredge->next){
-				curredge->eed->v1->f1 = 1;
-				curredge->eed->v2->f1 = 1;
-				curredge->eed->f1 = 1;
-			}
-			collapse_edgeuvs(em);
-		}
+#define KNIFE_EXACT     1
+#define KNIFE_MIDPOINT  2
+#define KNIFE_MULTICUT  3
 
-	}
-	freecollections(&allcollections);
-	removedoublesflag(em, 1, 0, MERGELIMIT);
+static EnumPropertyItem knife_items[] = {
+	{KNIFE_EXACT, "EXACT", 0, "Exact", ""},
+	{KNIFE_MIDPOINT, "MIDPOINTS", 0, "Midpoints", ""},
+	{KNIFE_MULTICUT, "MULTICUT", 0, "Multicut", ""},
+	{0, NULL, 0, NULL, NULL}
+};
 
-	return mergecount;
-}
+/* bm_edge_seg_isect() Determines if and where a mouse trail intersects an BMEdge */
 
-static int merge_firstlast(EditMesh *em, int first, int uvmerge)
+static float bm_edge_seg_isect(BMEdge *e, CutCurve *c, int len, char mode,
+                               struct GHash *gh, int *isected)
 {
-	EditVert *eve,*mergevert;
-	EditSelection *ese;
-
-	/* do sanity check in mergemenu in edit.c ?*/
-	if(first == 0){
-		ese = em->selected.last;
-		mergevert= (EditVert*)ese->data;
+#define MAXSLOPE 100000
+	float x11, y11, x12 = 0, y12 = 0, x2max, x2min, y2max;
+	float y2min, dist, lastdist = 0, xdiff2, xdiff1;
+	float m1, b1, m2, b2, x21, x22, y21, y22, xi;
+	float yi, x1min, x1max, y1max, y1min, perc = 0;
+	float  *scr;
+	float threshold = 0.0;
+	int i;
+	
+	//threshold = 0.000001; /* tolerance for vertex intersection */
+	// XXX threshold = scene->toolsettings->select_thresh / 100;
+	
+	/* Get screen coords of verts */
+	scr = BLI_ghash_lookup(gh, e->v1);
+	x21 = scr[0];
+	y21 = scr[1];
+	
+	scr = BLI_ghash_lookup(gh, e->v2);
+	x22 = scr[0];
+	y22 = scr[1];
+	
+	xdiff2 = (x22 - x21);
+	if (xdiff2) {
+		m2 = (y22 - y21) / xdiff2;
+		b2 = ((x22 * y21) - (x21 * y22)) / xdiff2;
 	}
-	else{
-		ese = em->selected.first;
-		mergevert = (EditVert*)ese->data;
+	else {
+		m2 = MAXSLOPE;  /* Verticle slope  */
+		b2 = x22;
 	}
 
-	if(mergevert->f&SELECT){
-		for (eve=em->verts.first; eve; eve=eve->next){
-			if (eve->f&SELECT)
-			VECCOPY(eve->co,mergevert->co);
+	*isected = 0;
+
+	/* check for _exact_ vertex intersection first */
+	if (mode != KNIFE_MULTICUT) {
+		for (i = 0; i < len; i++) {
+			if (i > 0) {
+				x11 = x12;
+				y11 = y12;
+			}
+			else {
+				x11 = c[i].x;
+				y11 = c[i].y;
+			}
+			x12 = c[i].x;
+			y12 = c[i].y;
+			
+			/* test e->v1 */
+			if ((x11 == x21 && y11 == y21) || (x12 == x21 && y12 == y21)) {
+				perc = 0;
+				*isected = 1;
+				return perc;
+			}
+			/* test e->v2 */
+			else if ((x11 == x22 && y11 == y22) || (x12 == x22 && y12 == y22)) {
+				perc = 0;
+				*isected = 2;
+				return perc;
+			}
 		}
 	}
-
-	if(uvmerge && CustomData_has_layer(&em->fdata, CD_MTFACE)){
-
-		for(eve=em->verts.first; eve; eve=eve->next) eve->f1 = 0;
-		for(eve=em->verts.first; eve; eve=eve->next){
-			if(eve->f&SELECT) eve->f1 = 1;
+	
+	/* now check for edge intersect (may produce vertex intersection as well) */
+	for (i = 0; i < len; i++) {
+		if (i > 0) {
+			x11 = x12;
+			y11 = y12;
+		}
+		else {
+			x11 = c[i].x;
+			y11 = c[i].y;
 		}
-		collapseuvs(em, mergevert);
+		x12 = c[i].x;
+		y12 = c[i].y;
+		
+		/* Perp. Distance from point to line */
+		if (m2 != MAXSLOPE) dist = (y12 - m2 * x12 - b2);  /* /sqrt(m2 * m2 + 1); Only looking for */
+		/* change in sign.  Skip extra math */
+		else dist = x22 - x12;
+		
+		if (i == 0) lastdist = dist;
+		
+		/* if dist changes sign, and intersect point in edge's Bound Box */
+		if ((lastdist * dist) <= 0) {
+			xdiff1 = (x12 - x11); /* Equation of line between last 2 points */
+			if (xdiff1) {
+				m1 = (y12 - y11) / xdiff1;
+				b1 = ((x12 * y11) - (x11 * y12)) / xdiff1;
+			}
+			else {
+				m1 = MAXSLOPE;
+				b1 = x12;
+			}
+			x2max = MAX2(x21, x22) + 0.001; /* prevent missed edges   */
+			x2min = MIN2(x21, x22) - 0.001; /* due to round off error */
+			y2max = MAX2(y21, y22) + 0.001;
+			y2min = MIN2(y21, y22) - 0.001;
+			
+			/* Found an intersect,  calc intersect point */
+			if (m1 == m2) { /* co-incident lines */
+				/* cut at 50% of overlap area */
+				x1max = MAX2(x11, x12);
+				x1min = MIN2(x11, x12);
+				xi = (MIN2(x2max, x1max) + MAX2(x2min, x1min)) / 2.0;
+				
+				y1max = MAX2(y11, y12);
+				y1min = MIN2(y11, y12);
+				yi = (MIN2(y2max, y1max) + MAX2(y2min, y1min)) / 2.0;
+			}
+			else if (m2 == MAXSLOPE) {
+				xi = x22;
+				yi = m1 * x22 + b1;
+			}
+			else if (m1 == MAXSLOPE) {
+				xi = x12;
+				yi = m2 * x12 + b2;
+			}
+			else {
+				xi = (b1 - b2) / (m2 - m1);
+				yi = (b1 * m2 - m1 * b2) / (m2 - m1);
+			}
+			
+			/* Intersect inside bounding box of edge?*/
+			if ((xi >= x2min) && (xi <= x2max) && (yi <= y2max) && (yi >= y2min)) {
+				/* test for vertex intersect that may be 'close enough'*/
+				if (mode != KNIFE_MULTICUT) {
+					if (xi <= (x21 + threshold) && xi >= (x21 - threshold)) {
+						if (yi <= (y21 + threshold) && yi >= (y21 - threshold)) {
+							*isected = 1;
+							perc = 0;
+							break;
+						}
+					}
+					if (xi <= (x22 + threshold) && xi >= (x22 - threshold)) {
+						if (yi <= (y22 + threshold) && yi >= (y22 - threshold)) {
+							*isected = 2;
+							perc = 0;
+							break;
+						}
+					}
+				}
+				if ((m2 <= 1.0f) && (m2 >= -1.0f)) perc = (xi - x21) / (x22 - x21);
+				else perc = (yi - y21) / (y22 - y21);  /* lower slope more accurate */
+				//isect = 32768.0 * (perc + 0.0000153); /* Percentage in 1 / 32768ths */
+				
+				break;
+			}
+		}	
+		lastdist = dist;
 	}
+	return perc;
+} 
 
-	return removedoublesflag(em, 1, 0, MERGELIMIT);
-}
+#define MAX_CUTS 2048
 
-static void em_snap_to_center(EditMesh *em)
+static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
 {
-	EditVert *eve;
-	float cent[3] = {0.0f, 0.0f, 0.0f};
-	int i=0;
-
-	for (eve=em->verts.first; eve; eve=eve->next) {
-		if (eve->f & SELECT) {
-			add_v3_v3(cent, eve->co);
-			i++;
-		}
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMesh *bm = em->bm;
+	ARegion *ar = CTX_wm_region(C);
+	BMVert *bv;
+	BMIter iter;
+	BMEdge *be;
+	BMOperator bmop;
+	CutCurve curve[MAX_CUTS];
+	struct GHash *gh;
+	float isect = 0.0f;
+	float  *scr, co[4];
+	int len = 0, isected;
+	short numcuts = 1, mode = RNA_int_get(op->ptr, "type");
+	
+	/* edit-object needed for matrix, and ar->regiondata for projections to work */
+	if (ELEM3(NULL, obedit, ar, ar->regiondata))
+		return OPERATOR_CANCELLED;
+	
+	if (bm->totvertsel < 2) {
+		//error("No edges are selected to operate on");
+		return OPERATOR_CANCELLED;
 	}
 
-	if (!i)
-		return;
-
-	mul_v3_fl(cent, 1.0f / (float)i);
-
-	for (eve=em->verts.first; eve; eve=eve->next) {
-		if (eve->f & SELECT) {
-			VECCOPY(eve->co, cent);
+	/* get the cut curve */
+	RNA_BEGIN (op->ptr, itemptr, "path") {
+		RNA_float_get_array(&itemptr, "loc", (float *)&curve[len]);
+		len++;
+		if (len >= MAX_CUTS) {
+			break;
 		}
 	}
-}
-
-static void em_snap_to_cursor(EditMesh *em, bContext *C)
-{
-	Scene *scene = CTX_data_scene(C);
-	Object *ob= CTX_data_edit_object(C);
-	View3D *v3d = CTX_wm_view3d(C);
-	EditVert *eve;
-	float co[3], *vco, invmat[4][4];
-		
-	invert_m4_m4(invmat, ob->obmat);
-
-	vco = give_cursor(scene, v3d);
-	VECCOPY(co, vco);
-	mul_m4_v3(invmat, co);
-
-	for (eve=em->verts.first; eve; eve=eve->next) {
-		if (eve->f & SELECT) {
-			VECCOPY(eve->co, co);
-		}
+	RNA_END;
+	
+	if (len < 2) {
+		return OPERATOR_CANCELLED;
 	}
-}
-
-static int merge_target(bContext *C, EditMesh *em, int target, int uvmerge)
-{
-	EditVert *eve;
 
-	// XXX not working
-	if(target) em_snap_to_cursor(em, C);
-	else em_snap_to_center(em);
-
-	if(uvmerge && CustomData_has_layer(&em->fdata, CD_MTFACE)){
-		for(eve=em->verts.first; eve; eve=eve->next) eve->f1 = 0;
-		for(eve=em->verts.first; eve; eve=eve->next){
-				if(eve->f&SELECT) eve->f1 = 1;
-		}
-		collapseuvs(em, NULL);
+	/* the floating point coordinates of verts in screen space will be stored in a hash table according to the vertices pointer */
+	gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "knife cut exec");
+	for (bv = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL); bv; bv = BM_iter_step(&iter)) {
+		scr = MEM_mallocN(sizeof(float) * 2, "Vertex Screen Coordinates");
+		copy_v3_v3(co, bv->co);
+		co[3] = 1.0f;
+		mul_m4_v4(obedit->obmat, co);
+		project_float(ar, co, scr);
+		BLI_ghash_insert(gh, bv, scr);
 	}
 
-	return removedoublesflag(em, 1, 0, MERGELIMIT);
-}
-#undef MERGELIMIT
+	if (!EDBM_op_init(em, &bmop, op, "esubd")) {
+		return OPERATOR_CANCELLED;
+	}
 
-static int merge_exec(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-	int count= 0, uvs= RNA_boolean_get(op->ptr, "uvs");
-	EditSelection *ese;
-	int totvert= em->totvert, totedge= em->totedge, totface= em->totface;
+	/* store percentage of edge cut for KNIFE_EXACT here.*/
+	for (be = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, NULL); be; be = BM_iter_step(&iter)) {
+		if (BM_elem_flag_test(be, BM_ELEM_SELECT)) {
+			isect = bm_edge_seg_isect(be, curve, len, mode, gh, &isected);
+			
+			if (isect != 0.0f) {
+				if (mode != KNIFE_MULTICUT && mode != KNIFE_MIDPOINT) {
+					BMO_slot_map_float_insert(bm, &bmop,
+					                          "edgepercents",
+					                          be, isect);
 
-	switch(RNA_enum_get(op->ptr, "type")) {
-		case 3:
-			count = merge_target(C, em, 0, uvs);
-			break;
-		case 4:
-			count = merge_target(C, em, 1, uvs);
-			break;
-		case 1:
-			ese= (EditSelection *)em->selected.last;
-			if(ese && ese->type == EDITVERT) {
-				count = merge_firstlast(em, 0, uvs);
-			} else {
-				BKE_report(op->reports, RPT_WARNING, "no last selected vertex set");
-			}
-			break;
-		case 6:
-			ese= (EditSelection *)em->selected.first;
-			if(ese && ese->type == EDITVERT) {
-				count = merge_firstlast(em, 1, uvs);
+				}
+				BMO_elem_flag_enable(bm, be, 1);
 			}
 			else {
-				BKE_report(op->reports, RPT_WARNING, "no last selected vertex set");
+				BMO_elem_flag_disable(bm, be, 1);
 			}
-			break;
-		case 5:
-			count = collapseEdges(em);
-			break;
+		}
+		else {
+			BMO_elem_flag_disable(bm, be, 1);
+		}
 	}
+	
+	BMO_slot_buffer_from_enabled_flag(bm, &bmop, "edges", BM_EDGE, 1);
 
-	if (!(totvert != em->totvert || totedge != em->totedge || totface != em->totface))
-		return OPERATOR_CANCELLED;
+	if (mode == KNIFE_MIDPOINT) numcuts = 1;
+	BMO_slot_int_set(&bmop, "numcuts", numcuts);
 
-	recalc_editnormals(em);
-	
-	BKE_reportf(op->reports, RPT_INFO, "Removed %d vert%s", count, (count==1)?"ex":"ices");
+	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);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
+	BMO_slot_float_set(&bmop, "radius", 0);
+	
+	BMO_op_exec(bm, &bmop);
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
+		return OPERATOR_CANCELLED;
+	}
+	
+	BLI_ghash_free(gh, NULL, (GHashValFreeFP)MEM_freeN);
 
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	EDBM_update_generic(C, em, TRUE);
 
 	return OPERATOR_FINISHED;
 }
 
-static EnumPropertyItem merge_type_items[]= {
-	{6, "FIRST", 0, "At First", ""},
-	{1, "LAST", 0, "At Last", ""},
-	{3, "CENTER", 0, "At Center", ""},
-	{4, "CURSOR", 0, "At Cursor", ""},
-	{5, "COLLAPSE", 0, "Collapse", ""},
-	{0, NULL, 0, NULL, NULL}};
+void MESH_OT_knife_cut(wmOperatorType *ot)
+{
+	PropertyRNA *prop;
+	
+	ot->name = "Knife Cut";
+	ot->description = "Cut selected edges and faces into parts";
+	ot->idname = "MESH_OT_knife_cut";
+	
+	ot->invoke = WM_gesture_lines_invoke;
+	ot->modal = WM_gesture_lines_modal;
+	ot->exec = edbm_knife_cut_exec;
+	
+	ot->poll = EM_view3d_poll;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+	
+	RNA_def_enum(ot->srna, "type", knife_items, KNIFE_EXACT, "Type", "");
+	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);
+}
 
-static EnumPropertyItem *merge_type_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
-{	
-	Object *obedit= CTX_data_edit_object(C);
-	EnumPropertyItem *item= NULL;
-	int totitem= 0;
+static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase, wmOperator *wmop)
+{
+	Base *basenew;
+	BMIter iter;
+	BMVert *v;
+	BMEdge *e;
+	Object *obedit = editbase->object;
+	Mesh *me = obedit->data;
+	BMEditMesh *em = me->edit_btmesh;
+	BMesh *bm_new;
+	
+	if (!em)
+		return FALSE;
+		
+	bm_new = BM_mesh_create(&bm_mesh_allocsize_default);
+	CustomData_copy(&em->bm->vdata, &bm_new->vdata, CD_MASK_BMESH, CD_CALLOC, 0);
+	CustomData_copy(&em->bm->edata, &bm_new->edata, CD_MASK_BMESH, CD_CALLOC, 0);
+	CustomData_copy(&em->bm->ldata, &bm_new->ldata, CD_MASK_BMESH, CD_CALLOC, 0);
+	CustomData_copy(&em->bm->pdata, &bm_new->pdata, CD_MASK_BMESH, CD_CALLOC, 0);
+
+	CustomData_bmesh_init_pool(&bm_new->vdata, bm_mesh_allocsize_default.totvert, BM_VERT);
+	CustomData_bmesh_init_pool(&bm_new->edata, bm_mesh_allocsize_default.totedge, BM_EDGE);
+	CustomData_bmesh_init_pool(&bm_new->ldata, bm_mesh_allocsize_default.totloop, BM_LOOP);
+	CustomData_bmesh_init_pool(&bm_new->pdata, bm_mesh_allocsize_default.totface, BM_FACE);
+		
+	basenew = ED_object_add_duplicate(bmain, scene, editbase, USER_DUP_MESH);   /* 0 = fully linked */
+	assign_matarar(basenew->object, give_matarar(obedit), *give_totcolp(obedit)); /* new in 2.5 */
 
-	if (C==NULL) {
-		return merge_type_items;
-	}
+	ED_base_object_select(basenew, BA_DESELECT);
+	
+	EDBM_op_callf(em, wmop, "dupe geom=%hvef dest=%p", BM_ELEM_SELECT, bm_new);
+	EDBM_op_callf(em, wmop, "del geom=%hvef context=%i", BM_ELEM_SELECT, DEL_FACES);
 
-	if(obedit && obedit->type == OB_MESH) {
-		EditMesh *em= BKE_mesh_get_editmesh(obedit->data);
+	/* clean up any loose edges */
+	BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) {
+		if (BM_elem_flag_test(e, BM_ELEM_HIDDEN))
+			continue;
 
-		if(em->selectmode & SCE_SELECT_VERTEX) {
-			if(em->selected.first && em->selected.last &&
-				((EditSelection*)em->selected.first)->type == EDITVERT && ((EditSelection*)em->selected.last)->type == EDITVERT) {
-				RNA_enum_items_add_value(&item, &totitem, merge_type_items, 6);
-				RNA_enum_items_add_value(&item, &totitem, merge_type_items, 1);
-			}
-			else if(em->selected.first && ((EditSelection*)em->selected.first)->type == EDITVERT)
-				RNA_enum_items_add_value(&item, &totitem, merge_type_items, 1);
-			else if(em->selected.last && ((EditSelection*)em->selected.last)->type == EDITVERT)
-				RNA_enum_items_add_value(&item, &totitem, merge_type_items, 6);
+		if (!BM_edge_is_wire(e)) {
+			BM_edge_select_set(em->bm, e, FALSE);
 		}
+	}
+	EDBM_op_callf(em, wmop, "del geom=%hvef context=%i", BM_ELEM_SELECT, DEL_EDGES);
 
-		RNA_enum_items_add_value(&item, &totitem, merge_type_items, 3);
-		RNA_enum_items_add_value(&item, &totitem, merge_type_items, 4);
-		RNA_enum_items_add_value(&item, &totitem, merge_type_items, 5);
+	/* clean up any loose verts */
+	BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) {
+		if (BM_elem_flag_test(v, BM_ELEM_HIDDEN))
+			continue;
+
+		if (BM_vert_edge_count(v) != 0) {
+			BM_vert_select_set(em->bm, v, FALSE);
+		}
 	}
 
-	RNA_enum_item_end(&item, &totitem);
-	*free= 1;
+	EDBM_op_callf(em, wmop, "del geom=%hvef context=%i", BM_ELEM_SELECT, DEL_VERTS);
 
-	return item;
+	BM_mesh_normals_update(bm_new, TRUE);
+
+	BM_mesh_bm_to_me(bm_new, basenew->object->data, FALSE);
+		
+	BM_mesh_free(bm_new);
+	((Mesh *)basenew->object->data)->edit_btmesh = NULL;
+	
+	return TRUE;
 }
 
-void MESH_OT_merge(wmOperatorType *ot)
+static int mesh_separate_material(Main *bmain, Scene *scene, Base *editbase, wmOperator *wmop)
 {
-	PropertyRNA *prop;
-
-	/* identifiers */
-	ot->name= "Merge";
-	ot->description= "Merge selected vertices";
-	ot->idname= "MESH_OT_merge";
-
-	/* api callbacks */
-	ot->exec= merge_exec;
-	ot->invoke= WM_menu_invoke;
-	ot->poll= ED_operator_editmesh;
+	BMFace *f_cmp, *f;
+	BMIter iter;
+	int result = FALSE;
+	Object *obedit = editbase->object;
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMesh *bm = em->bm;
 
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	EDBM_flag_disable_all(em, BM_ELEM_SELECT);
 
-	/* properties */
-	prop= RNA_def_enum(ot->srna, "type", merge_type_items, 3, "Type", "Merge method to use");
-	RNA_def_enum_funcs(prop, merge_type_itemf);
-	ot->prop= prop;
-	RNA_def_boolean(ot->srna, "uvs", 0, "UVs", "Move UVs according to merge");
-}
+	while ((f_cmp = BM_iter_at_index(bm, BM_FACES_OF_MESH, NULL, 0))) {
+		const short mat_nr = f_cmp->mat_nr;
+		int tot = 0;
 
-/************************ Vertex Path Operator *************************/
+		BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+			if (f->mat_nr == mat_nr) {
+				BM_face_select_set(bm, f, TRUE);
+				tot++;
+			}
+		}
 
-typedef struct PathNode {
-	int u;
-	int visited;
-	ListBase edges;
-} PathNode;
+		/* leave the current object with some materials */
+		if (tot == bm->totface) {
+			break;
+		}
 
-typedef struct PathEdge {
-	struct PathEdge *next, *prev;
-	int v;
-	float w;
-} PathEdge;
+		/* Move selection into a separate object */
+		result |= mesh_separate_selected(bmain, scene, editbase, wmop);
+	}
 
-#define PATH_SELECT_EDGE_LENGTH 0
-#define PATH_SELECT_TOPOLOGICAL 1
-
-static int select_vertex_path_exec(bContext *C, wmOperator *op)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-	EditVert *eve, *s, *t;
-	EditEdge *eed;
-	PathEdge *newpe, *currpe;
-	PathNode *currpn;
-	PathNode *Q;
-	int v, *previous, pathvert, pnindex; /*pnindex redundant?*/
-	int unbalanced, totnodes;
-	float *cost;
-	int type= RNA_enum_get(op->ptr, "type");
-	Heap *heap; /*binary heap for sorting pointers to PathNodes based upon a 'cost'*/
-
-	s = t = NULL;
-	for(eve=em->verts.first; eve; eve=eve->next) {
-		if(eve->f&SELECT) {
-			if(s == NULL) s= eve;
-			else if(t == NULL) t= eve;
-			else {
-				/* more than two vertices are selected,
-				   show warning message and cancel operator */
-				s = t = NULL;
-				break;
-			}
+	return result;
+}
 
+static int mesh_separate_loose(Main *bmain, Scene *scene, Base *editbase, wmOperator *wmop)
+{
+	int i;
+	BMVert *v;
+	BMEdge *e;
+	BMVert *v_seed;
+	BMWalker walker;
+	BMIter iter;
+	int result = FALSE;
+	Object *obedit = editbase->object;
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMesh *bm = em->bm;
+	int max_iter = bm->totvert;
+
+	/* Clear all selected vertices */
+	EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+
+	/* A "while (true)" loop should work here as each iteration should
+	 * select and remove at least one vertex and when all vertices
+	 * are selected the loop will break out. But guard against bad
+	 * behavior by limiting iterations to the number of vertices in the
+	 * original mesh.*/
+	for (i = 0; i < max_iter; i++) {
+		/* Get a seed vertex to start the walk */
+		v_seed = NULL;
+		BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+			v_seed = v;
+			break;
 		}
 
-		/*need to find out if t is actually reachable by s....*/
-		eve->f1 = 0;
-	}
+		/* No vertices available, can't do anything */
+		if (v_seed == NULL) {
+			break;
+		}
 
-	if(s != NULL && t != NULL) {
-		s->f1 = 1;
+		/* Select the seed explicitly, in case it has no edges */
+		BM_vert_select_set(bm, v_seed, TRUE);
 
-		unbalanced = 1;
-		totnodes = 1;
-		while(unbalanced){
-			unbalanced = 0;
-			for(eed=em->edges.first; eed; eed=eed->next){
-				if(!eed->h){
-					if(eed->v1->f1 && !eed->v2->f1){
-							eed->v2->f1 = 1;
-							totnodes++;
-							unbalanced = 1;
-					}
-					else if(eed->v2->f1 && !eed->v1->f1){
-							eed->v1->f1 = 1;
-							totnodes++;
-							unbalanced = 1;
-					}
-				}
-			}
+		/* Walk from the single vertex, selecting everything connected
+		 * to it */
+		BMW_init(&walker, bm, BMW_SHELL,
+		         BMW_MASK_NOP, BMW_MASK_NOP, BMW_MASK_NOP,
+		         BMW_FLAG_NOP, /* BMESH_TODO - should be BMW_FLAG_TEST_HIDDEN ? */
+		         BMW_NIL_LAY);
+
+		e = BMW_begin(&walker, v_seed);
+		for (; e; e = BMW_step(&walker)) {
+			BM_vert_select_set(bm, e->v1, TRUE);
+			BM_vert_select_set(bm, e->v2, TRUE);
 		}
+		BMW_end(&walker);
+				
+		/* Flush the selection to get edge/face selections matching
+		 * the vertex selection */
+		EDBM_selectmode_flush_ex(em, SCE_SELECT_VERTEX);
 
-		if(s->f1 && t->f1){ /* t can be reached by s */
-			Q = MEM_callocN(sizeof(PathNode)*totnodes, "Path Select Nodes");
-			totnodes = 0;
-			for(eve=em->verts.first; eve; eve=eve->next){
-				if(eve->f1){
-					Q[totnodes].u = totnodes;
-					Q[totnodes].edges.first = 0;
-					Q[totnodes].edges.last = 0;
-					Q[totnodes].visited = 0;
-					eve->tmp.p = &(Q[totnodes]);
-					totnodes++;
-				}
-				else eve->tmp.p = NULL;
-			}
+		if (bm->totvert == bm->totvertsel) {
+			/* Every vertex selected, nothing to separate, work is done */
+			break;
+		}
 
-			for(eed=em->edges.first; eed; eed=eed->next){
-				if(!eed->h){
-					if(eed->v1->f1){
-						currpn = ((PathNode*)eed->v1->tmp.p);
+		/* Move selection into a separate object */
+		result |= mesh_separate_selected(bmain, scene, editbase, wmop);
+	}
 
-						newpe = MEM_mallocN(sizeof(PathEdge), "Path Edge");
-						newpe->v = ((PathNode*)eed->v2->tmp.p)->u;
-						if (type == PATH_SELECT_EDGE_LENGTH) {
-								newpe->w = len_v3v3(eed->v1->co, eed->v2->co);
-						}
-						else newpe->w = 1;
-						newpe->next = 0;
-						newpe->prev = 0;
-						BLI_addtail(&(currpn->edges), newpe);
-					}
-					if(eed->v2->f1){
-						currpn = ((PathNode*)eed->v2->tmp.p);
-						newpe = MEM_mallocN(sizeof(PathEdge), "Path Edge");
-						newpe->v = ((PathNode*)eed->v1->tmp.p)->u;
-						if (type == PATH_SELECT_EDGE_LENGTH) {
-								newpe->w = len_v3v3(eed->v1->co, eed->v2->co);
-						}
-						else newpe->w = 1;
-						newpe->next = 0;
-						newpe->prev = 0;
-						BLI_addtail(&(currpn->edges), newpe);
-					}
-				}
-			}
+	return result;
+}
 
-			heap = BLI_heap_new();
-			cost = MEM_callocN(sizeof(float)*totnodes, "Path Select Costs");
-			previous = MEM_callocN(sizeof(int)*totnodes, "PathNode indices");
+static int edbm_separate_exec(bContext *C, wmOperator *op)
+{
+	Main *bmain = CTX_data_main(C);
+	Scene *scene = CTX_data_scene(C);
+	Base *base = CTX_data_active_base(C);
+	int retval = 0, type = RNA_enum_get(op->ptr, "type");
+	
+	if (type == 0)
+		retval = mesh_separate_selected(bmain, scene, base, op);
+	else if (type == 1)
+		retval = mesh_separate_material(bmain, scene, base, op);
+	else if (type == 2)
+		retval = mesh_separate_loose(bmain, scene, base, op);
 
-			for(v=0; v < totnodes; v++){
-				cost[v] = 1000000;
-				previous[v] = -1; /*array of indices*/
-			}
+	if (retval) {
+		BMEditMesh *em = BMEdit_FromObject(base->object);
+		EDBM_update_generic(C, em, TRUE);
 
-			pnindex = ((PathNode*)s->tmp.p)->u;
-			cost[pnindex] = 0;
-			BLI_heap_insert(heap,  0.0f, SET_INT_IN_POINTER(pnindex));
+		return OPERATOR_FINISHED;
+	}
 
-			while( !BLI_heap_empty(heap) ){
+	return OPERATOR_CANCELLED;
+}
 
-				pnindex = GET_INT_FROM_POINTER(BLI_heap_popmin(heap));
-				currpn = &(Q[pnindex]);
+/* *************** Operator: separate parts *************/
 
-				if(currpn == (PathNode*)t->tmp.p) /*target has been reached....*/
-					break;
+static EnumPropertyItem prop_separate_types[] = {
+	{0, "SELECTED", 0, "Selection", ""},
+	{1, "MATERIAL", 0, "By Material", ""},
+	{2, "LOOSE", 0, "By loose parts", ""},
+	{0, NULL, 0, NULL, NULL}
+};
 
-				for(currpe=currpn->edges.first; currpe; currpe=currpe->next){
-					if(!Q[currpe->v].visited){
-						if( cost[currpe->v] > (cost[currpn->u ] + currpe->w) ){
-							cost[currpe->v] = cost[currpn->u] + currpe->w;
-							previous[currpe->v] = currpn->u;
-							Q[currpe->v].visited = 1;
-							BLI_heap_insert(heap, cost[currpe->v], SET_INT_IN_POINTER(currpe->v));
-						}
-					}
-				}
-			}
+void MESH_OT_separate(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Separate";
+	ot->description = "Separate selected geometry into a new mesh";
+	ot->idname = "MESH_OT_separate";
+	
+	/* api callbacks */
+	ot->invoke = WM_menu_invoke;
+	ot->exec = edbm_separate_exec;
+	ot->poll = ED_operator_editmesh;
+	
+	/* flags */
+	ot->flag = OPTYPE_UNDO;
+	
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_separate_types, 0, "Type", "");
+}
 
-			pathvert = ((PathNode*)t->tmp.p)->u;
-			while(pathvert != -1){
-				for(eve=em->verts.first; eve; eve=eve->next){
-					if(eve->f1){
-						if( ((PathNode*)eve->tmp.p)->u == pathvert) eve->f |= SELECT;
-					}
-				}
-				pathvert = previous[pathvert];
-			}
 
-			for(v=0; v < totnodes; v++) BLI_freelistN(&(Q[v].edges));
-			MEM_freeN(Q);
-			MEM_freeN(cost);
-			MEM_freeN(previous);
-			BLI_heap_free(heap, NULL);
-			EM_select_flush(em);
-		}
+static int edbm_fill_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMOperator bmop;
+	
+	if (!EDBM_op_init(em, &bmop, op, "triangle_fill edges=%he", BM_ELEM_SELECT)) {
+		return OPERATOR_CANCELLED;
 	}
-	else {
-		BKE_mesh_end_editmesh(obedit->data, em);
-		BKE_report(op->reports, RPT_WARNING, "Path Selection requires that exactly two vertices be selected");
+	
+	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);
+	
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
 		return OPERATOR_CANCELLED;
 	}
 
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
-	BKE_mesh_end_editmesh(obedit->data, em);
-
+	EDBM_update_generic(C, em, TRUE);
+	
 	return OPERATOR_FINISHED;
+
 }
 
-void MESH_OT_select_vertex_path(wmOperatorType *ot)
+void MESH_OT_fill(wmOperatorType *ot)
 {
-	static const EnumPropertyItem type_items[] = {
-		{PATH_SELECT_EDGE_LENGTH, "EDGE_LENGTH", 0, "Edge Length", NULL},
-		{PATH_SELECT_TOPOLOGICAL, "TOPOLOGICAL", 0, "Topological", NULL},
-		{0, NULL, 0, NULL, NULL}};
-
 	/* identifiers */
-	ot->name= "Select Vertex Path";
-	ot->description= "Select shortest path between two vertices by distance type";
-	ot->idname= "MESH_OT_select_vertex_path";
+	ot->name = "Fill";
+	ot->idname = "MESH_OT_fill";
+	ot->description = "Fill a selected edge loop with faces";
 
 	/* api callbacks */
-	ot->exec= select_vertex_path_exec;
-	ot->poll= ED_operator_editmesh;
+	ot->exec = edbm_fill_exec;
+	ot->poll = ED_operator_editmesh;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
-	/* properties */
-	ot->prop= RNA_def_enum(ot->srna, "type", type_items, PATH_SELECT_EDGE_LENGTH, "Type", "Method to compute distance");
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
-/********************** Region/Loop Operators *************************/
-
-static int region_to_loop(bContext *C, wmOperator *UNUSED(op))
+static int edbm_beautify_fill_exec(bContext *C, wmOperator *op)
 {
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-	EditEdge *eed;
-	EditFace *efa;
-	int selected= 0;
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
 
-	for(eed=em->edges.first; eed; eed=eed->next) eed->f1 = 0;
+	if (!EDBM_op_callf(em, op, "beautify_fill faces=%hf", BM_ELEM_SELECT))
+		return OPERATOR_CANCELLED;
 
-	for(efa=em->faces.first; efa; efa=efa->next){
-		if(efa->f&SELECT){
-			efa->e1->f1++;
-			efa->e2->f1++;
-			efa->e3->f1++;
-			if(efa->e4)
-				efa->e4->f1++;
+	EDBM_update_generic(C, em, TRUE);
+	
+	return OPERATOR_FINISHED;
+}
 
-			selected= 1;
-		}
-	}
+void MESH_OT_beautify_fill(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Beautify Fill";
+	ot->idname = "MESH_OT_beautify_fill";
 
-	if(!selected)
-		return OPERATOR_CANCELLED;
+	/* api callbacks */
+	ot->exec = edbm_beautify_fill_exec;
+	ot->poll = ED_operator_editmesh;
 
-	EM_clear_flag_all(em, SELECT);
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
 
-	for(eed=em->edges.first; eed; eed=eed->next){
-		if(eed->f1 == 1) EM_select_edge(eed, 1);
-	}
+/********************** Quad/Tri Operators *************************/
 
-	em->selectmode = SCE_SELECT_EDGE;
-	CTX_data_tool_settings(C)->selectmode= em->selectmode;
-	EM_selectmode_set(em);
+static int edbm_quads_convert_to_tris_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	int use_beauty = RNA_boolean_get(op->ptr, "use_beauty");
 
-	BKE_mesh_end_editmesh(obedit->data, em);
+	if (!EDBM_op_callf(em, op, "triangulate faces=%hf use_beauty=%b", BM_ELEM_SELECT, use_beauty))
+		return OPERATOR_CANCELLED;
 
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
+	EDBM_update_generic(C, em, TRUE);
 
 	return OPERATOR_FINISHED;
 }
 
-void MESH_OT_region_to_loop(wmOperatorType *ot)
+void MESH_OT_quads_convert_to_tris(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Region to Loop";
-	ot->description= "Select a region as a loop of connected edges";
-	ot->idname= "MESH_OT_region_to_loop";
+	ot->name = "Triangulate Faces";
+	ot->idname = "MESH_OT_quads_convert_to_tris";
+	ot->description = "Triangulate selected faces";
 
 	/* api callbacks */
-	ot->exec= region_to_loop;
-	ot->poll= ED_operator_editmesh;
+	ot->exec = edbm_quads_convert_to_tris_exec;
+	ot->poll = ED_operator_editmesh;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+	RNA_def_boolean(ot->srna, "use_beauty", 1, "Beauty", "Use best triangulation division (currently quads only)");
 }
 
-static int validate_loop(EditMesh *em, Collection *edgecollection)
+static int edbm_tris_convert_to_quads_exec(bContext *C, wmOperator *op)
 {
-	EditEdge *eed;
-	EditFace *efa;
-	CollectedEdge *curredge;
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	int dosharp, douvs, dovcols, domaterials;
+	float limit = RNA_float_get(op->ptr, "limit");
 
-	/*1st test*/
-	for(curredge = (CollectedEdge*)edgecollection->collectionbase.first; curredge; curredge=curredge->next){
-		curredge->eed->v1->f1 = 0;
-		curredge->eed->v2->f1 = 0;
-	}
-	for(curredge = (CollectedEdge*)edgecollection->collectionbase.first; curredge; curredge=curredge->next){
-		curredge->eed->v1->f1++;
-		curredge->eed->v2->f1++;
-	}
-	for(curredge = (CollectedEdge*)edgecollection->collectionbase.first; curredge; curredge=curredge->next){
-		if(curredge->eed->v1->f1 > 2) return(0); else
-		if(curredge->eed->v2->f1 > 2) return(0);
-	}
+	dosharp = RNA_boolean_get(op->ptr, "sharp");
+	douvs = RNA_boolean_get(op->ptr, "uvs");
+	dovcols = RNA_boolean_get(op->ptr, "vcols");
+	domaterials = RNA_boolean_get(op->ptr, "materials");
 
-	/*2nd test*/
-	for(eed = em->edges.first; eed; eed=eed->next) eed->f1 = 0;
-	for(efa=em->faces.first; efa; efa=efa->next){
-		efa->e1->f1++;
-		efa->e2->f1++;
-		efa->e3->f1++;
-		if(efa->e4) efa->e4->f1++;
-	}
-	for(curredge = (CollectedEdge*)edgecollection->collectionbase.first; curredge; curredge=curredge->next){
-		if(curredge->eed->f1 > 2) return(0);
+	if (!EDBM_op_callf(em, op,
+	                   "join_triangles faces=%hf limit=%f cmp_sharp=%b cmp_uvs=%b cmp_vcols=%b cmp_materials=%b",
+	                   BM_ELEM_SELECT, limit, dosharp, douvs, dovcols, domaterials))
+	{
+		return OPERATOR_CANCELLED;
 	}
-	return(1);
-}
 
-static int loop_bisect(EditMesh *em, Collection *edgecollection)
-{
-	EditFace *efa, *sf1, *sf2;
-	EditEdge *eed, *sed;
-	CollectedEdge *curredge;
-	int totsf1, totsf2, unbalanced,balancededges;
+	EDBM_update_generic(C, em, TRUE);
 
-	for(eed=em->edges.first; eed; eed=eed->next) eed->f1 = eed->f2 = 0;
-	for(efa=em->faces.first; efa; efa=efa->next) efa->f1 = 0;
+	return OPERATOR_FINISHED;
+}
 
-	for(curredge = (CollectedEdge*)edgecollection->collectionbase.first; curredge; curredge=curredge->next) curredge->eed->f1 = 1;
+void MESH_OT_tris_convert_to_quads(wmOperatorType *ot)
+{
+	PropertyRNA *prop;
 
-	sf1 = sf2 = NULL;
-	sed = ((CollectedEdge*)edgecollection->collectionbase.first)->eed;
+	/* identifiers */
+	ot->name = "Tris to Quads";
+	ot->idname = "MESH_OT_tris_convert_to_quads";
+	ot->description = "Join triangles into quads";
 
-	for(efa=em->faces.first; efa; efa=efa->next){
-		if(sf2) break;
-		else if(sf1){
-			if(efa->e1 == sed || efa->e2 == sed || efa->e3 == sed || ( (efa->e4) ? efa->e4 == sed : 0) ) sf2 = efa;
-		}
-		else{
-			if(efa->e1 == sed || efa->e2 == sed || efa->e3 == sed || ( (efa->e4) ? efa->e4 == sed : 0) ) sf1 = efa;
-		}
-	}
+	/* api callbacks */
+	ot->exec = edbm_tris_convert_to_quads_exec;
+	ot->poll = ED_operator_editmesh;
 
-	if(sf1==NULL || sf2==NULL)
-		return(-1);
-
-	if(!(sf1->e1->f1)) sf1->e1->f2 = 1;
-	if(!(sf1->e2->f1)) sf1->e2->f2 = 1;
-	if(!(sf1->e3->f1)) sf1->e3->f2 = 1;
-	if(sf1->e4 && !(sf1->e4->f1)) sf1->e4->f2 = 1;
-	sf1->f1 = 1;
-	totsf1 = 1;
-
-	if(!(sf2->e1->f1)) sf2->e1->f2 = 2;
-	if(!(sf2->e2->f1)) sf2->e2->f2 = 2;
-	if(!(sf2->e3->f1)) sf2->e3->f2 = 2;
-	if(sf2->e4 && !(sf2->e4->f1)) sf2->e4->f2 = 2;
-	sf2->f1 = 2;
-	totsf2 = 1;
-
-	/*do sf1*/
-	unbalanced = 1;
-	while(unbalanced){
-		unbalanced = 0;
-		for(efa=em->faces.first; efa; efa=efa->next){
-			balancededges = 0;
-			if(efa->f1 == 0){
-				if(efa->e1->f2 == 1 || efa->e2->f2 == 1 || efa->e3->f2 == 1 || ( (efa->e4) ? efa->e4->f2 == 1 : 0) ){
-					balancededges += efa->e1->f2 = (efa->e1->f1) ? 0 : 1;
-					balancededges += efa->e2->f2 = (efa->e2->f1) ? 0 : 1;
-					balancededges += efa->e3->f2 = (efa->e3->f1) ? 0 : 1;
-					if(efa->e4) balancededges += efa->e4->f2 = (efa->e4->f1) ? 0 : 1;
-					if(balancededges){
-						unbalanced = 1;
-						efa->f1 = 1;
-						totsf1++;
-					}
-				}
-			}
-		}
-	}
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-	/*do sf2*/
-	unbalanced = 1;
-	while(unbalanced){
-		unbalanced = 0;
-		for(efa=em->faces.first; efa; efa=efa->next){
-			balancededges = 0;
-			if(efa->f1 == 0){
-				if(efa->e1->f2 == 2 || efa->e2->f2 == 2 || efa->e3->f2 == 2 || ( (efa->e4) ? efa->e4->f2 == 2 : 0) ){
-					balancededges += efa->e1->f2 = (efa->e1->f1) ? 0 : 2;
-					balancededges += efa->e2->f2 = (efa->e2->f1) ? 0 : 2;
-					balancededges += efa->e3->f2 = (efa->e3->f1) ? 0 : 2;
-					if(efa->e4) balancededges += efa->e4->f2 = (efa->e4->f1) ? 0 : 2;
-					if(balancededges){
-						unbalanced = 1;
-						efa->f1 = 2;
-						totsf2++;
-					}
-				}
-			}
-		}
-	}
+	prop = RNA_def_float_rotation(ot->srna, "limit", 0, NULL, 0.0f, DEG2RADF(180.0f),
+	                              "Max Angle", "Angle Limit", 0.0f, DEG2RADF(180.0f));
+	RNA_def_property_float_default(prop, DEG2RADF(40.0f));
 
-	if(totsf1 < totsf2) return(1);
-	else return(2);
+	RNA_def_boolean(ot->srna, "uvs", 0, "Compare UVs", "");
+	RNA_def_boolean(ot->srna, "vcols", 0, "Compare VCols", "");
+	RNA_def_boolean(ot->srna, "sharp", 0, "Compare Sharp", "");
+	RNA_def_boolean(ot->srna, "materials", 0, "Compare Materials", "");
 }
 
-static int loop_to_region(bContext *C, wmOperator *UNUSED(op))
+static int edbm_dissolve_exec(bContext *C, wmOperator *op)
 {
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-
-
-	EditFace *efa;
-	ListBase allcollections={NULL,NULL};
-	Collection *edgecollection;
-	int testflag;
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
 
-	build_edgecollection(em, &allcollections);
+	int use_verts = RNA_boolean_get(op->ptr, "use_verts");
 
-	for(edgecollection = (Collection *)allcollections.first; edgecollection; edgecollection=edgecollection->next){
-		if(validate_loop(em, edgecollection)){
-			testflag = loop_bisect(em, edgecollection);
-			for(efa=em->faces.first; efa; efa=efa->next){
-				if(efa->f1 == testflag){
-					if(efa->f&SELECT) EM_select_face(efa, 0);
-					else EM_select_face(efa,1);
-				}
-			}
-		}
+	if (em->selectmode & SCE_SELECT_FACE) {
+		if (!EDBM_op_callf(em, op, "dissolve_faces faces=%hf use_verts=%b", BM_ELEM_SELECT, use_verts))
+			return OPERATOR_CANCELLED;
 	}
-
-	for(efa=em->faces.first; efa; efa=efa->next){ /*fix this*/
-		if(efa->f&SELECT) EM_select_face(efa,1);
+	else if (em->selectmode & SCE_SELECT_EDGE) {
+		if (!EDBM_op_callf(em, op, "dissolve_edges edges=%he use_verts=%b", BM_ELEM_SELECT, use_verts))
+			return OPERATOR_CANCELLED;
+	}
+	else if (em->selectmode & SCE_SELECT_VERTEX) {
+		if (!EDBM_op_callf(em, op, "dissolve_verts verts=%hv", BM_ELEM_SELECT))
+			return OPERATOR_CANCELLED;
 	}
 
-	freecollections(&allcollections);
-	BKE_mesh_end_editmesh(obedit->data, em);
-
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
+	EDBM_update_generic(C, em, TRUE);
 
 	return OPERATOR_FINISHED;
 }
 
-void MESH_OT_loop_to_region(wmOperatorType *ot)
+void MESH_OT_dissolve(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Loop to Region";
-	ot->description= "Select a loop of connected edges as a region";
-	ot->idname= "MESH_OT_loop_to_region";
+	ot->name = "Dissolve";
+	ot->description = "Dissolve geometry";
+	ot->idname = "MESH_OT_dissolve";
 
 	/* api callbacks */
-	ot->exec= loop_to_region;
-	ot->poll= ED_operator_editmesh;
+	ot->exec = edbm_dissolve_exec;
+	ot->poll = ED_operator_editmesh;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
-
-/********************** UV/Color Operators *************************/
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-// XXX please check if these functions do what you want them to
-/* texface and vertex color editmode tools for the face menu */
+	/* TODO, move dissolve into its own operator so this doesnt confuse non-dissolve options */
+	RNA_def_boolean(ot->srna, "use_verts", 0, "Dissolve Verts",
+	                "When dissolving faces/edges, also dissolve remaining vertices");
+}
 
-static int mesh_rotate_uvs(bContext *C, wmOperator *op)
+static int edbm_dissolve_limited_exec(bContext *C, wmOperator *op)
 {
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-
-	EditFace *efa;
-	short change = 0;
-	MTFace *tf;
-	float u1, v1;
-	int dir= RNA_enum_get(op->ptr, "direction");
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	float angle_limit = RNA_float_get(op->ptr, "angle_limit");
 
-	if (!EM_texFaceCheck(em)) {
-		BKE_report(op->reports, RPT_WARNING, "Mesh has no uv/image layers");
-		BKE_mesh_end_editmesh(obedit->data, em);
+	if (!EDBM_op_callf(em, op,
+	                   "dissolve_limit edges=%he verts=%hv angle_limit=%f",
+	                   BM_ELEM_SELECT, BM_ELEM_SELECT, angle_limit))
+	{
 		return OPERATOR_CANCELLED;
 	}
 
-	for(efa=em->faces.first; efa; efa=efa->next) {
-		if (efa->f & SELECT) {
-			tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-			u1= tf->uv[0][0];
-			v1= tf->uv[0][1];
-
-			if (dir == DIRECTION_CCW) {
-				if(efa->v4) {
-					tf->uv[0][0]= tf->uv[3][0];
-					tf->uv[0][1]= tf->uv[3][1];
-
-					tf->uv[3][0]= tf->uv[2][0];
-					tf->uv[3][1]= tf->uv[2][1];
-				} else {
-					tf->uv[0][0]= tf->uv[2][0];
-					tf->uv[0][1]= tf->uv[2][1];
-				}
-
-				tf->uv[2][0]= tf->uv[1][0];
-				tf->uv[2][1]= tf->uv[1][1];
-
-				tf->uv[1][0]= u1;
-				tf->uv[1][1]= v1;
-			} else {
-				tf->uv[0][0]= tf->uv[1][0];
-				tf->uv[0][1]= tf->uv[1][1];
-
-				tf->uv[1][0]= tf->uv[2][0];
-				tf->uv[1][1]= tf->uv[2][1];
+	EDBM_update_generic(C, em, TRUE);
 
-				if(efa->v4) {
-					tf->uv[2][0]= tf->uv[3][0];
-					tf->uv[2][1]= tf->uv[3][1];
+	return OPERATOR_FINISHED;
+}
 
-					tf->uv[3][0]= u1;
-					tf->uv[3][1]= v1;
-				}
-				else {
-					tf->uv[2][0]= u1;
-					tf->uv[2][1]= v1;
-				}
-			}
-			change = 1;
-		}
-	}
+void MESH_OT_dissolve_limited(wmOperatorType *ot)
+{
+	PropertyRNA *prop;
 
-	BKE_mesh_end_editmesh(obedit->data, em);
+	/* identifiers */
+	ot->name = "Limited Dissolve";
+	ot->idname = "MESH_OT_dissolve_limited";
+	ot->description = "Dissolve selected edges and verts, limited by the angle of surrounding geometry";
 
-	if(!change)
-		return OPERATOR_CANCELLED;
+	/* api callbacks */
+	ot->exec = edbm_dissolve_limited_exec;
+	ot->poll = ED_operator_editmesh;
 
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-	return OPERATOR_FINISHED;
+	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));
+	RNA_def_property_float_default(prop, DEG2RADF(15.0f));
 }
 
-static int mesh_mirror_uvs(bContext *C, wmOperator *op)
+static int edbm_split_exec(bContext *C, wmOperator *op)
 {
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-
-	EditFace *efa;
-	short change = 0;
-	MTFace *tf;
-	float u1, v1;
-	int axis= RNA_enum_get(op->ptr, "axis");
+	Object *ob = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(ob);
+	BMOperator bmop;
 
-	if (!EM_texFaceCheck(em)) {
-		BKE_report(op->reports, RPT_WARNING, "Mesh has no uv/image layers");
-		BKE_mesh_end_editmesh(obedit->data, em);
+	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);
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
 		return OPERATOR_CANCELLED;
 	}
 
-	for(efa=em->faces.first; efa; efa=efa->next) {
-		if (efa->f & SELECT) {
-			tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-			if (axis == AXIS_Y) {
-				u1= tf->uv[1][0];
-				v1= tf->uv[1][1];
-				if(efa->v4) {
+	/* Geometry has changed, need to recalc normals and looptris */
+	EDBM_mesh_normals_update(em);
 
-					tf->uv[1][0]= tf->uv[2][0];
-					tf->uv[1][1]= tf->uv[2][1];
+	EDBM_update_generic(C, em, TRUE);
 
-					tf->uv[2][0]= u1;
-					tf->uv[2][1]= v1;
-
-					u1= tf->uv[3][0];
-					v1= tf->uv[3][1];
-
-					tf->uv[3][0]= tf->uv[0][0];
-					tf->uv[3][1]= tf->uv[0][1];
+	return OPERATOR_FINISHED;
+}
 
-					tf->uv[0][0]= u1;
-					tf->uv[0][1]= v1;
-				}
-				else {
-					tf->uv[1][0]= tf->uv[2][0];
-					tf->uv[1][1]= tf->uv[2][1];
-					tf->uv[2][0]= u1;
-					tf->uv[2][1]= v1;
-				}
+void MESH_OT_split(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Split";
+	ot->idname = "MESH_OT_split";
+	ot->description = "Split off selected geometry from connected unselected geometry";
 
-			} else {
-				u1= tf->uv[0][0];
-				v1= tf->uv[0][1];
-				if(efa->v4) {
+	/* api callbacks */
+	ot->exec = edbm_split_exec;
+	ot->poll = ED_operator_editmesh;
 
-					tf->uv[0][0]= tf->uv[1][0];
-					tf->uv[0][1]= tf->uv[1][1];
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
 
-					tf->uv[1][0]= u1;
-					tf->uv[1][1]= v1;
 
-					u1= tf->uv[3][0];
-					v1= tf->uv[3][1];
+static int edbm_spin_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMesh *bm = em->bm;
+	BMOperator spinop;
+	float cent[3], axis[3], imat[3][3];
+	float d[3] = {0.0f, 0.0f, 0.0f};
+	int steps, dupli;
+	float degr;
 
-					tf->uv[3][0]= tf->uv[2][0];
-					tf->uv[3][1]= tf->uv[2][1];
+	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");
+	//if (ts->editbutflag & B_CLOCKWISE)
+	degr = -degr;
+	dupli = RNA_boolean_get(op->ptr, "dupli");
+
+	/* undo object transformation */
+	copy_m3_m4(imat, obedit->imat);
+	sub_v3_v3(cent, obedit->obmat[3]);
+	mul_m3_v3(imat, cent);
+	mul_m3_v3(imat, axis);
 
-					tf->uv[2][0]= u1;
-					tf->uv[2][1]= v1;
-				}
-				else {
-					tf->uv[0][0]= tf->uv[1][0];
-					tf->uv[0][1]= tf->uv[1][1];
-					tf->uv[1][0]= u1;
-					tf->uv[1][1]= v1;
-				}
-			}
-			change = 1;
-		}
+	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))
+	{
+		return OPERATOR_CANCELLED;
 	}
-
-	BKE_mesh_end_editmesh(obedit->data, em);
-
-	if(!change)
+	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);
+	if (!EDBM_op_finish(em, &spinop, op, TRUE)) {
 		return OPERATOR_CANCELLED;
+	}
 
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	EDBM_update_generic(C, em, TRUE);
 
 	return OPERATOR_FINISHED;
 }
 
-static int mesh_rotate_colors(bContext *C, wmOperator *op)
+/* get center and axis, in global coords */
+static int edbm_spin_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
+	Scene *scene = CTX_data_scene(C);
+	View3D *v3d = CTX_wm_view3d(C);
+	RegionView3D *rv3d = ED_view3d_context_rv3d(C);
 
-	EditFace *efa;
-	short change = 0;
-	MCol tmpcol, *mcol;
-	int dir= RNA_enum_get(op->ptr, "direction");
+	RNA_float_set_array(op->ptr, "center", give_cursor(scene, v3d));
+	RNA_float_set_array(op->ptr, "axis", rv3d->viewinv[2]);
 
-	if (!EM_vertColorCheck(em)) {
-		BKE_report(op->reports, RPT_WARNING, "Mesh has no color layers");
-		BKE_mesh_end_editmesh(obedit->data, em);
-		return OPERATOR_CANCELLED;
-	}
+	return edbm_spin_exec(C, op);
+}
 
-	for(efa=em->faces.first; efa; efa=efa->next) {
-		if (efa->f & SELECT) {
-			mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
-			tmpcol= mcol[0];
+void MESH_OT_spin(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Spin";
+	ot->description = "Extrude selected vertices in a circle around the cursor in indicated viewport";
+	ot->idname = "MESH_OT_spin";
 
-			if (dir == DIRECTION_CCW) {
-				if(efa->v4) {
-					mcol[0]= mcol[3];
-					mcol[3]= mcol[2];
-				} else {
-					mcol[0]= mcol[2];
-				}
-				mcol[2]= mcol[1];
-				mcol[1]= tmpcol;
-			} else {
-				mcol[0]= mcol[1];
-				mcol[1]= mcol[2];
-
-				if(efa->v4) {
-					mcol[2]= mcol[3];
-					mcol[3]= tmpcol;
-				}
-				else
-					mcol[2]= tmpcol;
-			}
-			change = 1;
-		}
-	}
+	/* api callbacks */
+	ot->invoke = edbm_spin_invoke;
+	ot->exec = edbm_spin_exec;
+	ot->poll = EM_view3d_poll;
 
-	BKE_mesh_end_editmesh(obedit->data, em);
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-	if(!change)
-		return OPERATOR_CANCELLED;
+	/* 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);
 
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	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);
 
-	return OPERATOR_FINISHED;
 }
 
-
-static int mesh_mirror_colors(bContext *C, wmOperator *op)
+static int edbm_screw_exec(bContext *C, wmOperator *op)
 {
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMesh *bm = em->bm;
+	BMEdge *eed;
+	BMVert *eve, *v1, *v2;
+	BMIter iter, eiter;
+	BMOperator spinop;
+	float dvec[3], nor[3], cent[3], axis[3];
+	float imat[3][3];
+	int steps, turns;
+	int valence;
 
-	EditFace *efa;
-	short change = 0;
-	MCol tmpcol, *mcol;
-	int axis= RNA_enum_get(op->ptr, "axis");
 
-	if (!EM_vertColorCheck(em)) {
-		BKE_report(op->reports, RPT_WARNING, "Mesh has no color layers");
-		BKE_mesh_end_editmesh(obedit->data, em);
-		return OPERATOR_CANCELLED;
-	}
+	turns = RNA_int_get(op->ptr, "turns");
+	steps = RNA_int_get(op->ptr, "steps");
+	RNA_float_get_array(op->ptr, "center", cent);
+	RNA_float_get_array(op->ptr, "axis", axis);
 
-	for(efa=em->faces.first; efa; efa=efa->next) {
-		if (efa->f & SELECT) {
-			mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL);
-			if (axis == AXIS_Y) {
-				tmpcol= mcol[1];
-				mcol[1]= mcol[2];
-				mcol[2]= tmpcol;
+	/* undo object transformation */
+	copy_m3_m4(imat, obedit->imat);
+	sub_v3_v3(cent, obedit->obmat[3]);
+	mul_m3_v3(imat, cent);
+	mul_m3_v3(imat, axis);
 
-				if(efa->v4) {
-					tmpcol= mcol[0];
-					mcol[0]= mcol[3];
-					mcol[3]= tmpcol;
-				}
-			} else {
-				tmpcol= mcol[0];
-				mcol[0]= mcol[1];
-				mcol[1]= tmpcol;
-
-				if(efa->v4) {
-					tmpcol= mcol[2];
-					mcol[2]= mcol[3];
-					mcol[3]= tmpcol;
-				}
-			}
-			change = 1;
-		}
-	}
 
-	BKE_mesh_end_editmesh(obedit->data, em);
+	/* find two vertices with valence count == 1, more or less is wrong */
+	v1 = NULL;
+	v2 = NULL;
+	for (eve = BM_iter_new(&iter, em->bm, BM_VERTS_OF_MESH, NULL); eve; eve = BM_iter_step(&iter)) {
 
-	if(!change)
-		return OPERATOR_CANCELLED;
+		valence = 0;
 
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+		for (eed = BM_iter_new(&eiter, em->bm, BM_EDGES_OF_VERT, eve); eed; eed = BM_iter_step(&eiter)) {
 
-	return OPERATOR_FINISHED;
-}
+			if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
+				valence++;
+			}
 
-void MESH_OT_uvs_rotate(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Rotate UVs";
-	ot->description= "Rotate selected UVs";
-	ot->idname= "MESH_OT_uvs_rotate";
+		}
 
-	/* api callbacks */
-	ot->exec= mesh_rotate_uvs;
-	ot->poll= ED_operator_editmesh;
+		if (valence == 1) {
+			if (v1 == NULL) {
+				v1 = eve;
+			}
+			else if (v2 == NULL) {
+				v2 = eve;
+			}
+			else {
+				v1 = NULL;
+				break;
+			}
+		}
+	}
 
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	if (v1 == NULL || v2 == NULL) {
+		BKE_report(op->reports, RPT_ERROR, "You have to select a string of connected vertices too");
+		return OPERATOR_CANCELLED;
+	}
 
-	/* props */
-	RNA_def_enum(ot->srna, "direction", direction_items, DIRECTION_CW, "Direction", "Direction to rotate UVs around");
-}
+	/* calculate dvec */
+	sub_v3_v3v3(dvec, v1->co, v2->co);
+	mul_v3_fl(dvec, 1.0f / steps);
 
-void MESH_OT_uvs_mirror(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Mirror UVs";
-	ot->description= "Mirror selected UVs";
-	ot->idname= "MESH_OT_uvs_mirror";
+	if (dot_v3v3(nor, dvec) > 0.000f)
+		negate_v3(dvec);
 
-	/* api callbacks */
-	ot->exec= mesh_mirror_uvs;
-	ot->poll= ED_operator_editmesh;
+	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, 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);
+	if (!EDBM_op_finish(em, &spinop, op, TRUE)) {
+		return OPERATOR_CANCELLED;
+	}
 
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	EDBM_update_generic(C, em, TRUE);
 
-	/* props */
-	RNA_def_enum(ot->srna, "axis", axis_items_xy, DIRECTION_CW, "Axis", "Axis to mirror UVs around");
+	return OPERATOR_FINISHED;
 }
 
-void MESH_OT_colors_rotate(wmOperatorType *ot)
+/* get center and axis, in global coords */
+static int edbm_screw_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	/* identifiers */
-	ot->name= "Rotate Colors";
-	ot->description= "Rotate UV/image color layer";
-	ot->idname= "MESH_OT_colors_rotate";
-
-	/* api callbacks */
-	ot->exec= mesh_rotate_colors;
-	ot->poll= ED_operator_editmesh;
+	Scene *scene = CTX_data_scene(C);
+	View3D *v3d = CTX_wm_view3d(C);
+	RegionView3D *rv3d = ED_view3d_context_rv3d(C);
 
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	RNA_float_set_array(op->ptr, "center", give_cursor(scene, v3d));
+	RNA_float_set_array(op->ptr, "axis", rv3d->viewinv[1]);
 
-	/* props */
-	RNA_def_enum(ot->srna, "direction", direction_items, DIRECTION_CW, "Direction", "Direction to rotate edge around");
+	return edbm_screw_exec(C, op);
 }
 
-void MESH_OT_colors_mirror(wmOperatorType *ot)
+void MESH_OT_screw(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Mirror Colors";
-	ot->description= "Mirror UV/image color layer";
-	ot->idname= "MESH_OT_colors_mirror";
+	ot->name = "Screw";
+	ot->description = "Extrude selected vertices in screw-shaped rotation around the cursor in indicated viewport";
+	ot->idname = "MESH_OT_screw";
 
 	/* api callbacks */
-	ot->exec= mesh_mirror_colors;
-	ot->poll= ED_operator_editmesh;
+	ot->invoke = edbm_screw_invoke;
+	ot->exec = edbm_screw_exec;
+	ot->poll = EM_view3d_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* props */
-	RNA_def_enum(ot->srna, "axis", axis_items_xy, DIRECTION_CW, "Axis", "Axis to mirror colors around");
-}
+	RNA_def_int(ot->srna, "steps", 9, 0, INT_MAX, "Steps", "Steps", 0, 256);
+	RNA_def_int(ot->srna, "turns", 1, 0, INT_MAX, "Turns", "Turns", 0, 256);
 
-/********************** Subdivide Operator *************************/
+	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);
+}
 
-static int subdivide_exec(bContext *C, wmOperator *op)
+static int edbm_select_by_number_vertices_exec(bContext *C, wmOperator *op)
 {
-	ToolSettings *ts= CTX_data_tool_settings(C);
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-	int cuts= RNA_int_get(op->ptr,"number_cuts");
-	float smooth= 0.292f*RNA_float_get(op->ptr, "smoothness");
-	float fractal= RNA_float_get(op->ptr, "fractal")/100;
-	int corner_cut_pattern= RNA_enum_get(op->ptr,"corner_cut_pattern");
-	int flag= 0;
+	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");
 
-	if(smooth != 0.0f)
-		flag |= B_SMOOTH;
-	if(fractal != 0.0f)
-		flag |= B_FRACTAL;
+	for (efa = BM_iter_new(&iter, em->bm, BM_FACES_OF_MESH, NULL);
+	     efa; efa = BM_iter_step(&iter)) {
+
+		int select = 0;
+
+		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;
+		}
 
-	esubdivideflag(obedit, em, 1, smooth, fractal, ts->editbutflag|flag, cuts, corner_cut_pattern, 0);
+		if (select) {
+			BM_face_select_set(em->bm, efa, TRUE);
+		}
+	}
 
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	EDBM_selectmode_flush(em);
 
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 	return OPERATOR_FINISHED;
 }
 
-void MESH_OT_subdivide(wmOperatorType *ot)
-{	
-	/* identifiers */
-	ot->name= "Subdivide";
-	ot->description= "Subdivide selected edges";
-	ot->idname= "MESH_OT_subdivide";
+void MESH_OT_select_by_number_vertices(wmOperatorType *ot)
+{
+	static const EnumPropertyItem type_items[] = {
+		{0, "LESS", 0, "Less Than", ""},
+		{1, "EQUAL", 0, "Equal To", ""},
+		{2, "GREATER", 0, "Greater Than", ""},
+		{3, "NOTEQUAL", 0, "Not Equal To", ""},
+		{0, NULL, 0, NULL, NULL}};
 
+	/* 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";
+	
 	/* api callbacks */
-	ot->exec= subdivide_exec;
-	ot->poll= ED_operator_editmesh;
-
+	ot->exec = edbm_select_by_number_vertices_exec;
+	ot->poll = ED_operator_editmesh;
+	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* properties */
-	RNA_def_int(ot->srna, "number_cuts", 1, 1, INT_MAX, "Number of Cuts", "", 1, 10);
-	RNA_def_float(ot->srna, "smoothness", 0.0f, 0.0f, FLT_MAX, "Smoothness", "Smoothness factor", 0.0f, 1.0f);
-	RNA_def_float(ot->srna, "fractal", 0.0, 0.0f, FLT_MAX, "Fractal", "Fractal randomness factor", 0.0f, 1000.0f);
-	RNA_def_enum(ot->srna, "corner_cut_pattern", corner_type_items, SUBDIV_CORNER_INNERVERT, "Corner Cut Pattern", "Topology pattern to use to fill a face after cutting across its corner");
+	RNA_def_int(ot->srna, "number", 4, 3, INT_MAX, "Number of Vertices", "", 3, INT_MAX);
+	RNA_def_enum(ot->srna, "type", type_items, 1, "Type", "Type of comparison to make");
 }
 
-/********************** Fill Operators *************************/
-
-/* note; the EM_selectmode_set() calls here illustrate how badly constructed it all is... from before the
-edge/face flags, with very mixed results.... */
-static void beautify_fill(EditMesh *em)
+static int edbm_select_loose_verts_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	EditVert *v1, *v2, *v3, *v4;
-	EditEdge *eed, *nexted;
-	EditEdge dia1, dia2;
-	EditFace *efa, *w;
-	// void **efaar, **efaa;
-	EVPTuple *efaar;
-	EVPtr *efaa;
-	float len1, len2, len3, len4, len5, len6, opp1, opp2, fac1, fac2;
-	int totedge, ok, notbeauty=8, onedone, vindex[4];
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMVert *eve;
+	BMEdge *eed;
+	BMIter iter;
 
-	/* - all selected edges with two faces
-		* - find the faces: store them in edges (using datablock)
-		* - per edge: - test convex
-		*			   - test edge: flip?
-		*			   - if true: remedge,  addedge, all edges at the edge get new face pointers
-		*/
+	for (eve = BM_iter_new(&iter, em->bm, BM_VERTS_OF_MESH, NULL);
+	     eve; eve = BM_iter_step(&iter)) {
 
-	EM_selectmode_set(em);	// makes sure in selectmode 'face' the edges of selected faces are selected too
-
-	totedge = count_selected_edges(em->edges.first);
-	if(totedge==0) return;
-
-	/* temp block with face pointers */
-	efaar= (EVPTuple *) MEM_callocN(totedge * sizeof(EVPTuple), "beautyfill");
-
-	while (notbeauty) {
-		notbeauty--;
-
-		ok = collect_quadedges(efaar, em->edges.first, em->faces.first);
-
-		/* there we go */
-		onedone= 0;
-
-		eed= em->edges.first;
-		while(eed) {
-			nexted= eed->next;
-
-			/* f2 is set in collect_quadedges() */
-			if(eed->f2==2 && eed->h==0) {
-
-				efaa = (EVPtr *) eed->tmp.p;
-
-				/* none of the faces should be treated before, nor be part of fgon */
-				ok= 1;
-				efa= efaa[0];
-				if(efa->e1->f1 || efa->e2->f1 || efa->e3->f1) ok= 0;
-				if(efa->fgonf) ok= 0;
-				efa= efaa[1];
-				if(efa->e1->f1 || efa->e2->f1 || efa->e3->f1) ok= 0;
-				if(efa->fgonf) ok= 0;
+		if (!eve->e) {
+			BM_vert_select_set(em->bm, eve, TRUE);
+		}
+	}
 
-				if(ok) {
-					/* test convex */
-					givequadverts(efaa[0], efaa[1], &v1, &v2, &v3, &v4, vindex);
-					if(v1 && v2 && v3 && v4) {
-						if( convex(v1->co, v2->co, v3->co, v4->co) ) {
+	for (eed = BM_iter_new(&iter, em->bm, BM_EDGES_OF_MESH, NULL);
+	     eed; eed = BM_iter_step(&iter)) {
 
-							/* test edges */
-							if( (v1) > (v3) ) {
-								dia1.v1= v3;
-								dia1.v2= v1;
-							}
-							else {
-								dia1.v1= v1;
-								dia1.v2= v3;
-							}
+		if (!eed->l) {
+			BM_edge_select_set(em->bm, eed, TRUE);
+		}
+	}
 
-							if( (v2) > (v4) ) {
-								dia2.v1= v4;
-								dia2.v2= v2;
-							}
-							else {
-								dia2.v1= v2;
-								dia2.v2= v4;
-							}
+	EDBM_selectmode_flush(em);
 
-							/* testing rule:
-							* the area divided by the total edge lengths
-							*/
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+	return OPERATOR_FINISHED;
+}
 
-							len1= len_v3v3(v1->co, v2->co);
-							len2= len_v3v3(v2->co, v3->co);
-							len3= len_v3v3(v3->co, v4->co);
-							len4= len_v3v3(v4->co, v1->co);
-							len5= len_v3v3(v1->co, v3->co);
-							len6= len_v3v3(v2->co, v4->co);
+void MESH_OT_select_loose_verts(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Select Loose Vertices/Edges";
+	ot->description = "Select vertices with no edges nor faces, and edges with no faces";
+	ot->idname = "MESH_OT_select_loose_verts";
 
-							opp1= area_tri_v3(v1->co, v2->co, v3->co);
-							opp2= area_tri_v3(v1->co, v3->co, v4->co);
+	/* api callbacks */
+	ot->exec = edbm_select_loose_verts_exec;
+	ot->poll = ED_operator_editmesh;
 
-							fac1= opp1/(len1+len2+len5) + opp2/(len3+len4+len5);
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
 
-							opp1= area_tri_v3(v2->co, v3->co, v4->co);
-							opp2= area_tri_v3(v2->co, v4->co, v1->co);
+static int edbm_select_mirror_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	int extend = RNA_boolean_get(op->ptr, "extend");
 
-							fac2= opp1/(len2+len3+len6) + opp2/(len4+len1+len6);
+	EDBM_select_mirrored(obedit, em, extend);
+	EDBM_selectmode_flush(em);
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
-							ok= 0;
-							if(fac1 > fac2) {
-								if(dia2.v1==eed->v1 && dia2.v2==eed->v2) {
-									eed->f1= 1;
-									efa= efaa[0];
-									efa->f1= 1;
-									efa= efaa[1];
-									efa->f1= 1;
+	return OPERATOR_FINISHED;
+}
 
-									w= EM_face_from_faces(em, efaa[0], efaa[1],
-														  vindex[0], vindex[1], 4+vindex[2], -1);
-									EM_select_face(w, 1);
+void MESH_OT_select_mirror(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Select Mirror";
+	ot->description = "Select mesh items at mirrored locations";
+	ot->idname = "MESH_OT_select_mirror";
 
+	/* api callbacks */
+	ot->exec = edbm_select_mirror_exec;
+	ot->poll = ED_operator_editmesh;
 
-									w= EM_face_from_faces(em, efaa[0], efaa[1],
-														  vindex[0], 4+vindex[2], 4+vindex[3], -1);
-									EM_select_face(w, 1);
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-									onedone= 1;
-								}
-							}
-							else if(fac1 < fac2) {
-								if(dia1.v1==eed->v1 && dia1.v2==eed->v2) {
-									eed->f1= 1;
-									efa= efaa[0];
-									efa->f1= 1;
-									efa= efaa[1];
-									efa->f1= 1;
+	/* props */
+	RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the existing selection");
+}
 
+/* qsort routines.  not sure how to make these
+ * work, since we aren't using linked lists for
+ * geometry anymore.  might need a sort of "swap"
+ * function for bmesh elements. */
 
-									w= EM_face_from_faces(em, efaa[0], efaa[1],
-														  vindex[1], 4+vindex[2], 4+vindex[3], -1);
-									EM_select_face(w, 1);
+/* TODO All this section could probably use a refresh...
+ *      face code works in object mode, does everything in one op, while vert uses several...
+ */
 
-									w= EM_face_from_faces(em, efaa[0], efaa[1],
-														  vindex[0], 4+vindex[1], 4+vindex[3], -1);
-									EM_select_face(w, 1);
+typedef struct xvertsort {
+	int x; /* X screen-coordinate */
+	int org_idx; /* Original index of this vertex _in the mempool_ */
+} xvertsort;
 
-									onedone= 1;
-								}
-							}
-						}
-					}
-				}
 
-			}
-			eed= nexted;
-		}
+static int vergxco(const void *v1, const void *v2)
+{
+	const xvertsort *x1 = v1, *x2 = v2;
 
-		free_tagged_edges_faces(em, em->edges.first, em->faces.first);
+	/* We move unchanged vertices (org_idx < 0) at the begining of the sorted list. */
+	if (x1->org_idx >= 0 && x2->org_idx >= 0)
+		return (x1->x > x2->x) - (x1->x < x2->x);
+	return (x2->org_idx < 0) - (x1->org_idx < 0);
+}
 
-		if(onedone==0) break;
+#if 0 /* Unused */
+struct facesort {
+	uintptr_t x;
+	struct EditFace *efa;
+};
 
-		EM_selectmode_set(em);	// new edges/faces were added
-	}
+static int vergface(const void *v1, const void *v2)
+{
+	const struct facesort *x1 = v1, *x2 = v2;
 
-	MEM_freeN(efaar);
+	if (x1->x > x2->x) return 1;
+	else if (x1->x < x2->x) return -1;
+	return 0;
+}
+#endif
 
-	EM_select_flush(em);
+static void xsortvert_flag__doSetX(void *userData, BMVert *UNUSED(eve), int x, int UNUSED(y), int index)
+{
+	xvertsort *sortblock = userData;
 
+	sortblock[index].x = x;
 }
 
-/* Got this from scanfill.c. You will need to juggle around the
-* callbacks for the scanfill.c code a bit for this to work. */
-static void fill_mesh(EditMesh *em)
+/* all verts with (flag & 'flag') are sorted */
+static void xsortvert_flag(bContext *C, int flag)
 {
-	EditVert *eve,*v1;
-	EditEdge *eed,*e1,*nexted;
-	EditFace *efa,*nextvl, *efan;
-	short ok;
+	ViewContext vc;
+	BMEditMesh *em;
+	BMVert *ve;
+	BMIter iter;
+	xvertsort *sortblock;
+	int *unchangedblock, *vmap;
+	int totvert, sorted = 0, unchanged = 0, i;
 
-	if(em==NULL) return;
-	waitcursor(1);
+	em_setup_viewcontext(C, &vc);
+	em = vc.em;
 
-	/* copy all selected vertices */
-	eve= em->verts.first;
-	while(eve) {
-		if(eve->f & SELECT) {
-			v1= BLI_addfillvert(eve->co);
-			eve->tmp.v= v1;
-			v1->tmp.v= eve;
-			v1->xs= 0;	// used for counting edges
-		}
-		eve= eve->next;
-	}
-	/* copy all selected edges */
-	eed= em->edges.first;
-	while(eed) {
-		if( (eed->v1->f & SELECT) && (eed->v2->f & SELECT) ) {
-			e1= BLI_addfilledge(eed->v1->tmp.v, eed->v2->tmp.v);
-			e1->v1->xs++;
-			e1->v2->xs++;
-		}
-		eed= eed->next;
-	}
-	/* from all selected faces: remove vertices and edges to prevent doubles */
-	/* all edges add values, faces subtract,
-		then remove edges with vertices ->xs<2 */
-	efa= em->faces.first;
-	ok= 0;
-	while(efa) {
-		nextvl= efa->next;
-		if( faceselectedAND(efa, 1) ) {
-			efa->v1->tmp.v->xs--;
-			efa->v2->tmp.v->xs--;
-			efa->v3->tmp.v->xs--;
-			if(efa->v4) efa->v4->tmp.v->xs--;
-			ok= 1;
+	totvert = em->bm->totvert;
 
+	sortblock = MEM_callocN(sizeof(xvertsort) * totvert, "xsort sorted");
+	/* Stores unchanged verts, will be reused as final old2new vert mapping... */
+	unchangedblock = MEM_callocN(sizeof(int) * totvert, "xsort unchanged");
+	BM_ITER_MESH_INDEX (ve, &iter, em->bm, BM_VERTS_OF_MESH, i) {
+		if (BM_elem_flag_test(ve, flag)) {
+			sortblock[i].org_idx = i;
+			sorted++;
 		}
-		efa= nextvl;
-	}
-	if(ok) {	/* there are faces selected */
-		eed= filledgebase.first;
-		while(eed) {
-			nexted= eed->next;
-			if(eed->v1->xs<2 || eed->v2->xs<2) {
-				BLI_remlink(&filledgebase,eed);
-			}
-			eed= nexted;
-		}
-	}
-
-	if(BLI_edgefill(em->mat_nr)) {
-		efa= fillfacebase.first;
-		while(efa) {
-			/* normals default pointing up */
-			efan= addfacelist(em, efa->v3->tmp.v, efa->v2->tmp.v,
-							  efa->v1->tmp.v, 0, NULL, NULL);
-			if(efan) EM_select_face(efan, 1);
-			efa= efa->next;
+		else {
+			unchangedblock[unchanged++] = i;
+			sortblock[i].org_idx = -1;
 		}
 	}
+/*	printf("%d verts: %d to be sorted, %d unchanged…\n", totvert, sorted, unchanged);*/
+	if (sorted == 0)
+		return;
 
-	BLI_end_edgefill();
-	beautify_fill(em);
-
-	WM_cursor_wait(0);
-	EM_select_flush(em);
-
-}
-
-static int fill_mesh_exec(bContext *C, wmOperator *UNUSED(op))
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-
-	fill_mesh(em);
-
-	BKE_mesh_end_editmesh(obedit->data, em);
-
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d);
+	mesh_foreachScreenVert(&vc, xsortvert_flag__doSetX, sortblock, V3D_CLIP_TEST_OFF);
 
-	return OPERATOR_FINISHED;
+	qsort(sortblock, totvert, sizeof(xvertsort), vergxco);
 
-}
+	/* Convert sortblock into an array mapping old idx to new. */
+	vmap = unchangedblock;
+	unchangedblock = NULL;
+	if (unchanged) {
+		unchangedblock = MEM_mallocN(sizeof(int) * unchanged, "xsort unchanged");
+		memcpy(unchangedblock, vmap, unchanged * sizeof(int));
+	}
+	for (i = totvert; i--; ) {
+		if (i < unchanged)
+			vmap[unchangedblock[i]] = i;
+		else
+			vmap[sortblock[i].org_idx] = i;
+	}
 
-void MESH_OT_fill(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Fill";
-	ot->description= "Create a segment, edge or face";
-	ot->idname= "MESH_OT_fill";
+	MEM_freeN(sortblock);
+	if (unchangedblock)
+		MEM_freeN(unchangedblock);
 
-	/* api callbacks */
-	ot->exec= fill_mesh_exec;
-	ot->poll= ED_operator_editmesh;
+	BM_mesh_remap(em->bm, vmap, NULL, NULL);
 
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	MEM_freeN(vmap);
 }
 
-static int beautify_fill_exec(bContext *C, wmOperator *UNUSED(op))
+static int edbm_vertices_sort_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-
-	beautify_fill(em);
-
-	BKE_mesh_end_editmesh(obedit->data, em);
-
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-
+	xsortvert_flag(C, BM_ELEM_SELECT);
 	return OPERATOR_FINISHED;
 }
 
-void MESH_OT_beautify_fill(wmOperatorType *ot)
+void MESH_OT_vertices_sort(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Beautify Fill";
-	ot->description= "Rearrange geometry on a selected surface to avoid skinny faces";
-	ot->idname= "MESH_OT_beautify_fill";
+	ot->name = "Vertex Sort";
+	ot->description = "Sort vertex order";
+	ot->idname = "MESH_OT_vertices_sort";
 
 	/* api callbacks */
-	ot->exec= beautify_fill_exec;
-	ot->poll= ED_operator_editmesh;
+	ot->exec = edbm_vertices_sort_exec;
+
+	ot->poll = EM_view3d_poll; /* uses view relative X axis to sort verts */
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /* ********************** SORT FACES ******************* */
@@ -6381,24 +3773,23 @@ static int float_sort(const void *v1, const void *v2)
 	x1 = face_sort_floats[((int *) v1)[0]];
 	x2 = face_sort_floats[((int *) v2)[0]];
 	
-	if( x1 > x2 ) return 1;
-	else if( x1 < x2 ) return -1;
+	if      (x1 > x2) return  1;
+	else if (x1 < x2) return -1;
 	return 0;
 }
 
-
-static int sort_faces_exec(bContext *C, wmOperator *op)
+static int edbm_sort_faces_exec(bContext *C, wmOperator *op)
 {
-	RegionView3D *rv3d= ED_view3d_context_rv3d(C);
-	View3D *v3d= CTX_wm_view3d(C);
-	Object *ob= CTX_data_edit_object(C);
-	Scene *scene= CTX_data_scene(C);
+	RegionView3D *rv3d = ED_view3d_context_rv3d(C);
+	View3D *v3d = CTX_wm_view3d(C);
+	Object *ob = CTX_data_edit_object(C);
+	Scene *scene = CTX_data_scene(C);
 	Mesh *me;
 	CustomDataLayer *layer;
-	int i, *index;
+	int i, j, *index;
 	int event;
 	float reverse = 1;
-	// XXX int ctrl= 0;
+	// XXX int ctrl = 0;
 	
 	if (!v3d) return OPERATOR_CANCELLED;
 
@@ -6408,91 +3799,96 @@ static int sort_faces_exec(bContext *C, wmOperator *op)
 	 */
 	ED_object_exit_editmode(C, EM_FREEDATA);
 
-	me= ob->data;
-	if(me->totface==0) {
+	me = ob->data;
+	if (me->totpoly == 0) {
 		ED_object_enter_editmode(C, 0);
 		return OPERATOR_FINISHED;
 	}
 
-	event= RNA_enum_get(op->ptr, "type");
+	event = RNA_enum_get(op->ptr, "type");
 
 	// XXX
-	//if(ctrl)
+	//if (ctrl)
 	//	reverse = -1;
 	
 	/* create index list */
-	index= (int *)MEM_mallocN(sizeof(int) * me->totface, "sort faces");
-	for (i = 0; i < me->totface; i++) {
+	index = (int *)MEM_mallocN(sizeof(int) * me->totpoly, "sort faces");
+	for (i = 0; i < me->totpoly; i++) {
 		index[i] = i;
 	}
 	
-	face_sort_floats = (float *) MEM_mallocN(sizeof(float) * me->totface, "sort faces float");
+	face_sort_floats = (float *) MEM_mallocN(sizeof(float) * me->totpoly, "sort faces float");
 
 	/* sort index list instead of faces itself 
 	 * and apply this permutation to all face layers
 	 */
 	if (event == 5) {
 		/* Random */
-		for(i=0; i<me->totface; i++) {
+		for (i = 0; i < me->totpoly; i++) {
 			face_sort_floats[i] = BLI_frand();
 		}
-		qsort(index, me->totface, sizeof(int), float_sort);		
-	} else {
-		MFace *mf;
+		qsort(index, me->totpoly, sizeof(int), float_sort);
+	}
+	else {
+		MPoly *mp;
+		MLoop *ml;
+		MVert *mv;
 		float vec[3];
 		float mat[4][4];
 		float cur[3];
 		
 		if (event == 1)
-			mult_m4_m4m4(mat, rv3d->viewmat, OBACT->obmat); /* apply the view matrix to the object matrix */
+			mult_m4_m4m4(mat, rv3d->viewmat, OBACT->obmat);  /* apply the view matrix to the object matrix */
 		else if (event == 2) { /* sort from cursor */
-			if( v3d && v3d->localvd ) {
-				VECCOPY(cur, v3d->cursor);
-			} else {
-				VECCOPY(cur, scene->cursor);
+			if (v3d && v3d->localvd) {
+				copy_v3_v3(cur, v3d->cursor);
+			}
+			else {
+				copy_v3_v3(cur, scene->cursor);
 			}
 			invert_m4_m4(mat, OBACT->obmat);
 			mul_m4_v3(mat, cur);
 		}
 		
-		mf= me->mface;
-
-		for(i=0; i<me->totface; i++, mf++) {
-			if (event==3) {
-				face_sort_floats[i] = ((float)mf->mat_nr)*reverse;
-			} else if (event==4) {
-				/*selected first*/
-				if (mf->flag & ME_FACE_SEL)
+		mp = me->mpoly;
+
+		for (i = 0; i < me->totpoly; i++, mp++) {
+			if (event == 3) {
+				face_sort_floats[i] = ((float)mp->mat_nr) * reverse;
+			}
+			else if (event == 4) {
+				/* selected first */
+				if (mp->flag & ME_FACE_SEL)
 					face_sort_floats[i] = 0.0;
 				else
 					face_sort_floats[i] = reverse;
-			} else {
-				/* find the faces center */
-				add_v3_v3v3(vec, (me->mvert+mf->v1)->co, (me->mvert+mf->v2)->co);
-				if (mf->v4) {
-					add_v3_v3(vec, (me->mvert+mf->v3)->co);
-					add_v3_v3(vec, (me->mvert+mf->v4)->co);
-					mul_v3_fl(vec, 0.25f);
-				} else {
-					add_v3_v3(vec, (me->mvert+mf->v3)->co);
-					mul_v3_fl(vec, 1.0f/3.0f);
-				} /* done */
+			}
+			else {
+				/* find the face's center */
+				ml = me->mloop + mp->loopstart;
+				zero_v3(vec);
+				for (j = 0; j < mp->totloop; j++, ml++) {
+					mv = me->mvert + ml->v;
+					add_v3_v3(vec, mv->co);
+				}
+				mul_v3_fl(vec, 1.0f / (float)mp->totloop);
 				
 				if (event == 1) { /* sort on view axis */
 					mul_m4_v3(mat, vec);
 					face_sort_floats[i] = vec[2] * reverse;
-				} else if(event == 2) { /* distance from cursor*/
+				}
+				else if (event == 2) { /* distance from cursor */
 					face_sort_floats[i] = len_v3v3(cur, vec) * reverse; /* back to front */
 				}
 			}
 		}
-		qsort(index, me->totface, sizeof(int), float_sort);
+		qsort(index, me->totpoly, sizeof(int), float_sort);
 	}
 	
 	MEM_freeN(face_sort_floats);
-	for(i = 0; i < me->fdata.totlayer; i++) {
-		layer = &me->fdata.layers[i];
-		permutate(layer->data, me->totface, CustomData_sizeof(layer->type), index);
+	for (i = 0; i < me->pdata.totlayer; i++) {
+		layer = &me->pdata.layers[i];
+		permutate(layer->data, me->totpoly, CustomData_sizeof(layer->type), index);
 	}
 
 	MEM_freeN(index);
@@ -6506,7 +3902,7 @@ static int sort_faces_exec(bContext *C, wmOperator *op)
 
 void MESH_OT_sort_faces(wmOperatorType *ot)
 {
-	static EnumPropertyItem type_items[]= {
+	static EnumPropertyItem type_items[] = {
 		{ 1, "VIEW_AXIS", 0, "View Axis", "" },
 		{ 2, "CURSOR_DISTANCE", 0, "Cursor Distance", "" },
 		{ 3, "MATERIAL", 0, "Material", "" },
@@ -6515,266 +3911,372 @@ void MESH_OT_sort_faces(wmOperatorType *ot)
 		{ 0, NULL, 0, NULL, NULL }};
 
 	/* identifiers */
-	ot->name= "Sort Faces"; // XXX (Ctrl to reverse)%t|
-	ot->description= "The faces of the active Mesh Object are sorted, based on the current view";
-	ot->idname= "MESH_OT_sort_faces";
+	ot->name = "Sort Faces"; // XXX (Ctrl to reverse)%t|
+	ot->description = "The faces of the active Mesh Object are sorted, based on the current view";
+	ot->idname = "MESH_OT_sort_faces";
 
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= sort_faces_exec;
-	ot->poll= ED_operator_editmesh;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = edbm_sort_faces_exec;
+	ot->poll = ED_operator_editmesh;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* properties */
-	ot->prop= RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "");
 }
 
-/********************** Quad/Tri Operators *************************/
-
-static int quads_convert_to_tris_exec(bContext *C, wmOperator *UNUSED(op))
+/* ******************************* Randomize verts ************************* */
+static void hashvert_flag(BMEditMesh *em, int flag, unsigned int seed)
 {
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
+	BMVert *ve;
+	BMIter iter;
+	char *block /* Just to mark protected vertices */, *t_blk;
+	int *randblock, *vmap, *t_idx, *r_idx;
+	int totvert, randomized = 0, /*protected = 0, */ i;
 
-	convert_to_triface(em,0);
+	totvert = em->bm->totvert;
 
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	block = MEM_callocN(sizeof(char) * totvert, "randvert block");
+	randblock = MEM_callocN(sizeof(int) * totvert, "randvert randblock");
+	BM_ITER_MESH_INDEX (ve, &iter, em->bm, BM_VERTS_OF_MESH, i) {
+		if (BM_elem_flag_test(ve, flag)) {
+			block[i] = FALSE;
+			randblock[randomized++] = i;
+		}
+		else {
+			block[i] = TRUE;
+		}
+	}
+/*	protected = totvert - randomized;*/
+/*	printf("%d verts: %d to be randomized, %d protected…\n", totvert, randomized, protected);*/
+	if (randomized == 0)
+		return;
 
-	BKE_mesh_end_editmesh(obedit->data, em);
-	return OPERATOR_FINISHED;
-}
+	
+	/* Randomize non-protected vertices indices, and create an array mapping old idx to new
+	 *  from both blocks, keeping protected vertices at the same indices. */
+	vmap = randblock;
+	randblock = MEM_mallocN(sizeof(int) * randomized, "randvert randblock");
+	memcpy(randblock, vmap, randomized * sizeof(int));
+	BLI_array_randomize((void *)randblock, sizeof(int), randomized, seed);
+	t_blk = block + totvert - 1;
+	t_idx = vmap + totvert - 1;
+	r_idx = randblock + randomized - 1;
+	for (i = totvert; i--; t_blk--, t_idx--) {
+		if (*t_blk) /* Protected! */
+			*t_idx = i;
+		else
+			*t_idx = *r_idx--;
+	}
 
-void MESH_OT_quads_convert_to_tris(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Quads to Tris";
-	ot->description= "Convert selected quads to triangles";
-	ot->idname= "MESH_OT_quads_convert_to_tris";
+	MEM_freeN(randblock);
+	MEM_freeN(block);
 
-	/* api callbacks */
-	ot->exec= quads_convert_to_tris_exec;
-	ot->poll= ED_operator_editmesh;
+	BM_mesh_remap(em->bm, vmap, NULL, NULL);
 
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	MEM_freeN(vmap);
 }
 
-static int tris_convert_to_quads_exec(bContext *C, wmOperator *UNUSED(op))
+static int edbm_vertices_randomize_exec(bContext *C, wmOperator *op)
 {
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-
-	join_triangles(em);
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	unsigned int seed = RNA_int_get(op->ptr, "seed");
 
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	hashvert_flag(em, BM_ELEM_SELECT, seed);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
 	return OPERATOR_FINISHED;
 }
 
-void MESH_OT_tris_convert_to_quads(wmOperatorType *ot)
+void MESH_OT_vertices_randomize(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Tris to Quads";
-	ot->description= "Convert selected triangles to quads";
-	ot->idname= "MESH_OT_tris_convert_to_quads";
+	ot->name = "Vertex Randomize";
+	ot->description = "Randomize vertex order";
+	ot->idname = "MESH_OT_vertices_randomize";
 
 	/* api callbacks */
-	ot->exec= tris_convert_to_quads_exec;
-	ot->poll= ED_operator_editmesh;
+	ot->exec = edbm_vertices_randomize_exec;
+
+	ot->poll = ED_operator_editmesh;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+	/* Properties */
+	ot->prop = RNA_def_int(ot->srna, "seed", 0, 0, INT_MAX, "Seed", "Seed for the random generator", 0, 255);
 }
 
-static int edge_flip_exec(bContext *C, wmOperator *UNUSED(op))
+/******end of qsort stuff ****/
+
+
+static int edbm_noise_exec(bContext *C, wmOperator *op)
 {
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	Material *ma;
+	Tex *tex;
+	BMVert *eve;
+	BMIter iter;
+	float fac = RNA_float_get(op->ptr, "factor");
+
+	if (em == NULL) {
+		return OPERATOR_FINISHED;
+	}
+
+	if ((ma  = give_current_material(obedit, obedit->actcol)) == NULL ||
+	    (tex = give_current_material_texture(ma)) == NULL)
+	{
+		BKE_report(op->reports, RPT_WARNING, "Mesh has no material or texture assigned");
+		return OPERATOR_FINISHED;
+	}
 
-	edge_flip(em);
+	if (tex->type == TEX_STUCCI) {
+		float b2, vec[3];
+		float ofs = tex->turbul / 200.0;
+		BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+			if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
+				b2 = BLI_hnoise(tex->noisesize, eve->co[0], eve->co[1], eve->co[2]);
+				if (tex->stype) ofs *= (b2 * b2);
+				vec[0] = fac * (b2 - BLI_hnoise(tex->noisesize, eve->co[0] + ofs, eve->co[1], eve->co[2]));
+				vec[1] = fac * (b2 - BLI_hnoise(tex->noisesize, eve->co[0], eve->co[1] + ofs, eve->co[2]));
+				vec[2] = fac * (b2 - BLI_hnoise(tex->noisesize, eve->co[0], eve->co[1], eve->co[2] + ofs));
+				
+				add_v3_v3(eve->co, vec);
+			}
+		}
+	}
+	else {
+		BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+			if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
+				float tin, dum;
+				externtex(ma->mtex[0], eve->co, &tin, &dum, &dum, &dum, &dum, 0);
+				eve->co[2] += fac * tin;
+			}
+		}
+	}
 
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	EDBM_mesh_normals_update(em);
+
+	EDBM_update_generic(C, em, TRUE);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
 	return OPERATOR_FINISHED;
 }
 
-void MESH_OT_edge_flip(wmOperatorType *ot)
+void MESH_OT_noise(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Edge Flip";
-	ot->description= "Flip selected edge or adjoining faces";
-	ot->idname= "MESH_OT_edge_flip";
+	ot->name = "Noise";
+	ot->description = "Use vertex coordinate as texture coordinate";
+	ot->idname = "MESH_OT_noise";
 
 	/* api callbacks */
-	ot->exec= edge_flip_exec;
-	ot->poll= ED_operator_editmesh;
+	ot->exec = edbm_noise_exec;
+	ot->poll = ED_operator_editmesh;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-/********************** Smooth/Solid Operators *************************/
+	RNA_def_float(ot->srna, "factor", 0.1f, -FLT_MAX, FLT_MAX, "Factor", "", 0.0f, 1.0f);
+}
 
-static void mesh_set_smooth_faces(EditMesh *em, short smooth)
+/* bevel! yay!!*/
+static int edbm_bevel_exec(bContext *C, wmOperator *op)
 {
-	EditFace *efa;
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMIter iter;
+	BMEdge *eed;
+	BMOperator bmop;
+	float factor = RNA_float_get(op->ptr, "percent") /*, dfac */ /* UNUSED */, df, s;
+	int i, recursion = 1; /* RNA_int_get(op->ptr, "recursion"); */ /* temp removed, see comment below */
+	const int use_even = RNA_boolean_get(op->ptr, "use_even");
+	const int use_dist = RNA_boolean_get(op->ptr, "use_dist");
+	float *w = NULL, ftot;
+	int li;
+	
+	BM_data_layer_add(em->bm, &em->bm->edata, CD_PROP_FLT);
+	li = CustomData_number_of_layers(&em->bm->edata, CD_PROP_FLT) - 1;
+	
+	BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
+		float d = len_v3v3(eed->v1->co, eed->v2->co);
+		float *dv = CustomData_bmesh_get_n(&em->bm->edata, eed->head.data, CD_PROP_FLT, li);
+		
+		*dv = d;
+	}
+	
+	if (em == NULL) {
+		return OPERATOR_CANCELLED;
+	}
+	
+	w = MEM_mallocN(sizeof(float) * recursion, "bevel weights");
 
-	if(em==NULL) return;
+	/* ugh, stupid math depends somewhat on angles!*/
+	/* dfac = 1.0/(float)(recursion + 1); */ /* UNUSED */
+	df = 1.0;
+	for (i = 0, ftot = 0.0f; i < recursion; i++) {
+		s = powf(df, 1.25f);
 
-	for(efa= em->faces.first; efa; efa=efa->next) {
-		if(efa->f & SELECT) {
-			if(smooth) efa->flag |= ME_SMOOTH;
-			else efa->flag &= ~ME_SMOOTH;
-		}
+		w[i] = s;
+		ftot += s;
+
+		df *= 2.0;
 	}
 
-	recalc_editnormals(em);
-}
+	mul_vn_fl(w, recursion, 1.0f / (float)ftot);
 
-static int mesh_faces_shade_smooth_exec(bContext *C, wmOperator *UNUSED(op))
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
+	for (i = 0; i < recursion; i++) {
+		float fac = w[recursion - i - 1] * factor;
 
-	mesh_set_smooth_faces(em, 1);
+		if (!EDBM_op_init(em, &bmop, op,
+		                  "bevel geom=%hev percent=%f lengthlayer=%i use_lengths=%b use_even=%b use_dist=%b",
+		                  BM_ELEM_SELECT, fac, li, TRUE, use_even, use_dist))
+		{
+			return OPERATOR_CANCELLED;
+		}
+		
+		BMO_op_exec(em->bm, &bmop);
+		if (!EDBM_op_finish(em, &bmop, op, TRUE))
+			return OPERATOR_CANCELLED;
+	}
+	
+	BM_data_layer_free_n(em->bm, &em->bm->edata, CD_PROP_FLT, li);
+	
+	MEM_freeN(w);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
+	EDBM_mesh_normals_update(em);
 
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	EDBM_update_generic(C, em, TRUE);
 
 	return OPERATOR_FINISHED;
 }
 
-void MESH_OT_faces_shade_smooth(wmOperatorType *ot)
+void MESH_OT_bevel(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Shade Smooth";
-	ot->description= "Display faces 'smooth' (using vertex normals)";
-	ot->idname= "MESH_OT_faces_shade_smooth";
+	ot->name = "Bevel";
+	ot->description = "Edge Bevel";
+	ot->idname = "MESH_OT_bevel";
 
 	/* api callbacks */
-	ot->exec= mesh_faces_shade_smooth_exec;
-	ot->poll= ED_operator_editmesh;
+	ot->exec = edbm_bevel_exec;
+	ot->poll = ED_operator_editmesh;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-static int mesh_faces_shade_flat_exec(bContext *C, wmOperator *UNUSED(op))
-{
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
+	RNA_def_float(ot->srna, "percent", 0.5f, -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);
 
-	mesh_set_smooth_faces(em, 0);
+	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");
+
+}
 
-	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+static int edbm_bridge_edge_loops_exec(bContext *C, wmOperator *op)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	
+	if (!EDBM_op_callf(em, op, "bridge_loops edges=%he", BM_ELEM_SELECT))
+		return OPERATOR_CANCELLED;
+	
+	EDBM_update_generic(C, em, TRUE);
 
 	return OPERATOR_FINISHED;
 }
 
-void MESH_OT_faces_shade_flat(wmOperatorType *ot)
+void MESH_OT_bridge_edge_loops(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Shade Flat";
-	ot->description= "Display faces 'flat'";
-	ot->idname= "MESH_OT_faces_shade_flat";
-
+	ot->name = "Bridge Two Edge Loops";
+	ot->description = "Make faces between two edge loops";
+	ot->idname = "MESH_OT_bridge_edge_loops";
+	
 	/* api callbacks */
-	ot->exec= mesh_faces_shade_flat_exec;
-	ot->poll= ED_operator_editmesh;
-
+	ot->exec = edbm_bridge_edge_loops_exec;
+	ot->poll = ED_operator_editmesh;
+	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+	
+	RNA_def_boolean(ot->srna, "inside", 0, "Inside", "");
 }
 
-/* TODO - some way to select on an arbitrary axis */
-static int select_axis_exec(bContext *C, wmOperator *op)
+
+
+static int edbm_inset_exec(bContext *C, wmOperator *op)
 {
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMOperator bmop;
+	const int use_boundary        = RNA_boolean_get(op->ptr, "use_boundary");
+	const int use_even_offset     = RNA_boolean_get(op->ptr, "use_even_offset");
+	const int use_relative_offset = RNA_boolean_get(op->ptr, "use_relative_offset");
+	const float thickness         = RNA_float_get(op->ptr,   "thickness");
+	const float depth             = RNA_float_get(op->ptr,   "depth");
+	const int use_outset          = RNA_boolean_get(op->ptr, "use_outset");
+	const int use_select_inset    = RNA_boolean_get(op->ptr, "use_select_inset"); /* not passed onto the BMO */
 
-	int axis= RNA_enum_get(op->ptr, "axis");
-	int mode= RNA_enum_get(op->ptr, "mode"); /* -1==aligned, 0==neg, 1==pos*/
+	EDBM_op_init(em, &bmop, op,
+	             "inset faces=%hf use_boundary=%b use_even_offset=%b use_relative_offset=%b "
+	             "thickness=%f depth=%f use_outset=%b",
+	             BM_ELEM_SELECT, use_boundary, use_even_offset, use_relative_offset,
+	             thickness, depth, use_outset);
 
-	EditSelection *ese = em->selected.last;
+	BMO_op_exec(em->bm, &bmop);
 
+	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);
+	}
+	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);
+		/* 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);
+	}
 
-	if (ese==NULL || ese->type != EDITVERT) {
-		BKE_report(op->reports, RPT_WARNING, "This operator requires an active vertex (last selected)");
+	if (!EDBM_op_finish(em, &bmop, op, TRUE)) {
 		return OPERATOR_CANCELLED;
 	}
 	else {
-		EditVert *ev;
-		EditVert *act_vert= (EditVert*)ese->data;
-		float value= act_vert->co[axis];
-		float limit=  CTX_data_tool_settings(C)->doublimit; // XXX
-
-		if(mode==0)			value -= limit;
-		else if (mode==1)	value += limit;
-
-		for(ev=em->verts.first;ev;ev=ev->next) {
-			if(!ev->h) {
-				switch(mode) {
-				case -1: /* aligned */
-					if(fabs(ev->co[axis] - value) < limit)
-						ev->f |= SELECT;
-					break;
-				case 0: /* neg */
-					if(ev->co[axis] > value)
-						ev->f |= SELECT;
-					break;
-				case 1: /* pos */
-					if(ev->co[axis] < value)
-						ev->f |= SELECT;
-					break;
-				}
-			}
-		}
+		EDBM_update_generic(C, em, TRUE);
+		return OPERATOR_FINISHED;
 	}
-
-	EM_select_flush(em);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-
-	return OPERATOR_FINISHED;
 }
 
-void MESH_OT_select_axis(wmOperatorType *ot)
+void MESH_OT_inset(wmOperatorType *ot)
 {
-	static EnumPropertyItem axis_mode_items[] = {
-		{0,  "POSITIVE", 0, "Positive Axis", ""},
-		{1,  "NEGATIVE", 0, "Negative Axis", ""},
-		{-1, "ALIGNED",  0, "Aligned Axis", ""},
-		{0, NULL, 0, NULL, NULL}};
-	
-	static EnumPropertyItem axis_items_xyz[] = {
-		{0, "X_AXIS", 0, "X Axis", ""},
-		{1, "Y_AXIS", 0, "Y Axis", ""},
-		{2, "Z_AXIS", 0, "Z Axis", ""},
-		{0, NULL, 0, NULL, NULL}};
+	PropertyRNA *prop;
 
 	/* identifiers */
-	ot->name= "Select Axis";
-	ot->description= "Select all data in the mesh on a single axis";
-	ot->idname= "MESH_OT_select_axis";
+	ot->name = "Inset Faces";
+	ot->idname = "MESH_OT_inset";
+	ot->description = "Inset new faces into selected faces";
 
 	/* api callbacks */
-	ot->exec= select_axis_exec;
-	ot->poll= ED_operator_editmesh;
+	ot->exec = edbm_inset_exec;
+	ot->poll = ED_operator_editmesh;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* properties */
-	RNA_def_enum(ot->srna, "mode", axis_mode_items, 0, "Axis Mode", "Axis side to use when selecting");
-	RNA_def_enum(ot->srna, "axis", axis_items_xyz, 0, "Axis", "Select the axis to compare each vertex on");
-}
+	RNA_def_boolean(ot->srna, "use_boundary",        TRUE, "Boundary",  "Inset face boundaries");
+	RNA_def_boolean(ot->srna, "use_even_offset",     TRUE, "Offset Even",      "Scale the offset to give more even thickness");
+	RNA_def_boolean(ot->srna, "use_relative_offset", FALSE, "Offset Relative", "Scale the offset by surrounding geometry");
 
+	prop = RNA_def_float(ot->srna, "thickness", 0.01f, 0.0f, FLT_MAX, "Thickness", "", 0.0f, 10.0f);
+	/* use 1 rather then 10 for max else dragging the button moves too far */
+	RNA_def_property_ui_range(prop, 0.0, 1.0, 0.01, 4);
+	prop = RNA_def_float(ot->srna, "depth", 0.0f, -FLT_MAX, FLT_MAX, "Depth", "", -10.0f, 10.0f);
+	RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.01, 4);
+
+	RNA_def_boolean(ot->srna, "use_outset", FALSE, "Outset", "Outset rather than inset");
+	RNA_def_boolean(ot->srna, "use_select_inset", TRUE, "Select Outer", "Select the new inset faces");
+}
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
new file mode 100644
index 0000000..4ec3c22
--- /dev/null
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -0,0 +1,1241 @@
+/*
+ * ***** 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) 2004 by Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Joseph Eagar
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/editors/mesh/editmesh_utils.c
+ *  \ingroup edmesh
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_mesh_types.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_math.h"
+
+#include "BKE_DerivedMesh.h"
+#include "BKE_bmesh.h"
+#include "BKE_context.h"
+#include "BKE_depsgraph.h"
+#include "BKE_key.h"
+#include "BKE_library.h"
+#include "BKE_mesh.h"
+#include "BKE_report.h"
+#include "BKE_tessmesh.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "ED_mesh.h"
+#include "ED_util.h"
+
+#include "bmesh.h"
+
+#include "mesh_intern.h"
+
+void EDBM_mesh_normals_update(BMEditMesh *em)
+{
+	BM_mesh_normals_update(em->bm, TRUE);
+}
+
+void EDBM_mesh_clear(BMEditMesh *em)
+{
+	/* clear bmesh */
+	BM_mesh_clear(em->bm);
+	
+	/* free derived meshes */
+	if (em->derivedCage) {
+		em->derivedCage->needsFree = 1;
+		em->derivedCage->release(em->derivedCage);
+	}
+	if (em->derivedFinal && em->derivedFinal != em->derivedCage) {
+		em->derivedFinal->needsFree = 1;
+		em->derivedFinal->release(em->derivedFinal);
+	}
+	
+	em->derivedCage = em->derivedFinal = NULL;
+	
+	/* free tessellation data */
+	em->tottri = 0;
+	if (em->looptris) 
+		MEM_freeN(em->looptris);
+}
+
+void EDBM_stats_update(BMEditMesh *em)
+{
+	const char iter_types[3] = {BM_VERTS_OF_MESH,
+	                            BM_EDGES_OF_MESH,
+	                            BM_FACES_OF_MESH};
+
+	BMIter iter;
+	BMElem *ele;
+	int *tots[3];
+	int i;
+
+	tots[0] = &em->bm->totvertsel;
+	tots[1] = &em->bm->totedgesel;
+	tots[2] = &em->bm->totfacesel;
+	
+	em->bm->totvertsel = em->bm->totedgesel = em->bm->totfacesel = 0;
+
+	for (i = 0; i < 3; i++) {
+		ele = BM_iter_new(&iter, em->bm, iter_types[i], NULL);
+		for ( ; ele; ele = BM_iter_step(&iter)) {
+			if (BM_elem_flag_test(ele, BM_ELEM_SELECT)) {
+				(*tots[i])++;
+			}
+		}
+	}
+}
+
+int EDBM_op_init(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const char *fmt, ...)
+{
+	BMesh *bm = em->bm;
+	va_list list;
+
+	va_start(list, fmt);
+
+	if (!BMO_op_vinitf(bm, bmop, fmt, list)) {
+		BKE_reportf(op->reports, RPT_ERROR, "Parse error in %s", __func__);
+		va_end(list);
+		return 0;
+	}
+	
+	if (!em->emcopy)
+		em->emcopy = BMEdit_Copy(em);
+	em->emcopyusers++;
+
+	va_end(list);
+
+	return 1;
+}
+
+
+/* returns 0 on error, 1 on success.  executes and finishes a bmesh operator */
+int EDBM_op_finish(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const int report)
+{
+	const char *errmsg;
+	
+	BMO_op_finish(em->bm, bmop);
+
+	if (BMO_error_get(em->bm, &errmsg, NULL)) {
+		BMEditMesh *emcopy = em->emcopy;
+
+		if (report) {
+			BKE_report(op->reports, RPT_ERROR, errmsg);
+		}
+
+		EDBM_mesh_free(em);
+		*em = *emcopy;
+
+		MEM_freeN(emcopy);
+		em->emcopyusers = 0;
+		em->emcopy = NULL;
+
+		/* when copying, tessellation isn't to for faster copying,
+		 * but means we need to re-tessellate here */
+		if (em->looptris == NULL) {
+			BMEdit_RecalcTessellation(em);
+		}
+
+		return FALSE;
+	}
+	else {
+		em->emcopyusers--;
+		if (em->emcopyusers < 0) {
+			printf("warning: em->emcopyusers was less then zero.\n");
+		}
+
+		if (em->emcopyusers <= 0) {
+			BMEdit_Free(em->emcopy);
+			MEM_freeN(em->emcopy);
+			em->emcopy = NULL;
+		}
+
+		return TRUE;
+	}
+}
+
+int EDBM_op_callf(BMEditMesh *em, wmOperator *op, const char *fmt, ...)
+{
+	BMesh *bm = em->bm;
+	BMOperator bmop;
+	va_list list;
+
+	va_start(list, fmt);
+
+	if (!BMO_op_vinitf(bm, &bmop, fmt, list)) {
+		BKE_reportf(op->reports, RPT_ERROR, "Parse error in %s", __func__);
+		va_end(list);
+		return 0;
+	}
+
+	if (!em->emcopy)
+		em->emcopy = BMEdit_Copy(em);
+	em->emcopyusers++;
+
+	BMO_op_exec(bm, &bmop);
+
+	va_end(list);
+	return EDBM_op_finish(em, &bmop, op, TRUE);
+}
+
+int EDBM_op_call_and_selectf(BMEditMesh *em, wmOperator *op, const char *selectslot, const char *fmt, ...)
+{
+	BMesh *bm = em->bm;
+	BMOperator bmop;
+	va_list list;
+
+	va_start(list, fmt);
+
+	if (!BMO_op_vinitf(bm, &bmop, fmt, list)) {
+		BKE_reportf(op->reports, RPT_ERROR, "Parse error in %s", __func__);
+		va_end(list);
+		return 0;
+	}
+
+	if (!em->emcopy)
+		em->emcopy = BMEdit_Copy(em);
+	em->emcopyusers++;
+
+	BMO_op_exec(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, selectslot, BM_ALL, BM_ELEM_SELECT, TRUE);
+
+	va_end(list);
+	return EDBM_op_finish(em, &bmop, op, TRUE);
+}
+
+int EDBM_op_call_silentf(BMEditMesh *em, const char *fmt, ...)
+{
+	BMesh *bm = em->bm;
+	BMOperator bmop;
+	va_list list;
+
+	va_start(list, fmt);
+
+	if (!BMO_op_vinitf(bm, &bmop, fmt, list)) {
+		va_end(list);
+		return 0;
+	}
+
+	if (!em->emcopy)
+		em->emcopy = BMEdit_Copy(em);
+	em->emcopyusers++;
+
+	BMO_op_exec(bm, &bmop);
+
+	va_end(list);
+	return EDBM_op_finish(em, &bmop, NULL, FALSE);
+}
+
+void EDBM_selectmode_to_scene(bContext *C)
+{
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+
+	if (!em)
+		return;
+
+	scene->toolsettings->selectmode = em->selectmode;
+
+	/* Request redraw of header buttons (to show new select mode) */
+	WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, scene);
+}
+
+void EDBM_mesh_make(ToolSettings *ts, Scene *UNUSED(scene), Object *ob)
+{
+	Mesh *me = ob->data;
+	BMesh *bm;
+
+	if (UNLIKELY(!me->mpoly && me->totface)) {
+		BKE_mesh_convert_mfaces_to_mpolys(me);
+	}
+
+	bm = BKE_mesh_to_bmesh(me, ob);
+
+	if (me->edit_btmesh) {
+		/* this happens when switching shape keys */
+		EDBM_mesh_free(me->edit_btmesh);
+		MEM_freeN(me->edit_btmesh);
+	}
+
+	/* currently executing operators re-tessellates, so we can avoid doing here
+	 * but at some point it may need to be added back. */
+#if 0
+	me->edit_btmesh = BMEdit_Create(bm, TRUE);
+#else
+	me->edit_btmesh = BMEdit_Create(bm, FALSE);
+#endif
+
+	me->edit_btmesh->selectmode = me->edit_btmesh->bm->selectmode = ts->selectmode;
+	me->edit_btmesh->mat_nr = (ob->actcol > 0) ? ob->actcol - 1 : 0;
+
+	me->edit_btmesh->me = me;
+	me->edit_btmesh->ob = ob;
+}
+
+void EDBM_mesh_load(Object *ob)
+{
+	Mesh *me = ob->data;
+	BMesh *bm = me->edit_btmesh->bm;
+
+	BM_mesh_bm_to_me(bm, me, FALSE);
+
+#ifdef USE_TESSFACE_DEFAULT
+	BKE_mesh_tessface_calc(me);
+#endif
+}
+
+/**
+ * Should only be called on the active editmesh, otherwise call #BMEdit_Free
+ */
+void EDBM_mesh_free(BMEditMesh *em)
+{
+	/* These tables aren't used yet, so it's not strictly necessary
+	 * to 'end' them (with 'e' param) but if someone tries to start
+	 * using them, having these in place will save a lot of pain */
+	mesh_octree_table(NULL, NULL, NULL, 'e');
+	mesh_mirrtopo_table(NULL, 'e');
+
+	BMEdit_Free(em);
+}
+
+void EDBM_index_arrays_init(BMEditMesh *tm, int forvert, int foredge, int forface)
+{
+	EDBM_index_arrays_free(tm);
+
+	if (forvert) {
+		BMIter iter;
+		BMVert *ele;
+		int i = 0;
+		
+		tm->vert_index = MEM_mallocN(sizeof(void **) * tm->bm->totvert, "tm->vert_index");
+
+		ele = BM_iter_new(&iter, tm->bm, BM_VERTS_OF_MESH, NULL);
+		for ( ; ele; ele = BM_iter_step(&iter)) {
+			tm->vert_index[i++] = ele;
+		}
+	}
+
+	if (foredge) {
+		BMIter iter;
+		BMEdge *ele;
+		int i = 0;
+		
+		tm->edge_index = MEM_mallocN(sizeof(void **) * tm->bm->totedge, "tm->edge_index");
+
+		ele = BM_iter_new(&iter, tm->bm, BM_EDGES_OF_MESH, NULL);
+		for ( ; ele; ele = BM_iter_step(&iter)) {
+			tm->edge_index[i++] = ele;
+		}
+	}
+
+	if (forface) {
+		BMIter iter;
+		BMFace *ele;
+		int i = 0;
+		
+		tm->face_index = MEM_mallocN(sizeof(void **) * tm->bm->totface, "tm->face_index");
+
+		ele = BM_iter_new(&iter, tm->bm, BM_FACES_OF_MESH, NULL);
+		for ( ; ele; ele = BM_iter_step(&iter)) {
+			tm->face_index[i++] = ele;
+		}
+	}
+}
+
+void EDBM_index_arrays_free(BMEditMesh *tm)
+{
+	if (tm->vert_index) {
+		MEM_freeN(tm->vert_index);
+		tm->vert_index = NULL;
+	}
+
+	if (tm->edge_index) {
+		MEM_freeN(tm->edge_index);
+		tm->edge_index = NULL;
+	}
+
+	if (tm->face_index) {
+		MEM_freeN(tm->face_index);
+		tm->face_index = NULL;
+	}
+}
+
+BMVert *EDBM_vert_at_index(BMEditMesh *tm, int index)
+{
+	return tm->vert_index && index < tm->bm->totvert ? tm->vert_index[index] : NULL;
+}
+
+BMEdge *EDBM_edge_at_index(BMEditMesh *tm, int index)
+{
+	return tm->edge_index && index < tm->bm->totedge ? tm->edge_index[index] : NULL;
+}
+
+BMFace *EDBM_face_at_index(BMEditMesh *tm, int index)
+{
+	return (tm->face_index && index < tm->bm->totface && index >= 0) ? tm->face_index[index] : NULL;
+}
+
+void EDBM_selectmode_flush_ex(BMEditMesh *em, int selectmode)
+{
+	em->bm->selectmode = selectmode;
+	BM_mesh_select_mode_flush(em->bm);
+	em->bm->selectmode = em->selectmode;
+}
+
+void EDBM_selectmode_flush(BMEditMesh *em)
+{
+	EDBM_selectmode_flush_ex(em, em->selectmode);
+}
+
+void EDBM_deselect_flush(BMEditMesh *em)
+{
+	/* function below doesnt use. just do this to keep the values in sync */
+	em->bm->selectmode = em->selectmode;
+	BM_mesh_deselect_flush(em->bm);
+}
+
+
+void EDBM_select_flush(BMEditMesh *em)
+{
+	/* function below doesnt use. just do this to keep the values in sync */
+	em->bm->selectmode = em->selectmode;
+	BM_mesh_select_flush(em->bm);
+}
+
+void EDBM_select_more(BMEditMesh *em)
+{
+	BMOperator bmop;
+	int use_faces = em->selectmode == SCE_SELECT_FACE;
+
+	BMO_op_initf(em->bm, &bmop,
+	             "regionextend geom=%hvef 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_op_finish(em->bm, &bmop);
+
+	EDBM_select_flush(em);
+}
+
+void EDBM_select_less(BMEditMesh *em)
+{
+	BMOperator bmop;
+	int use_faces = em->selectmode == SCE_SELECT_FACE;
+
+	BMO_op_initf(em->bm, &bmop,
+	             "regionextend geom=%hvef 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_op_finish(em->bm, &bmop);
+
+	EDBM_selectmode_flush(em);
+}
+
+void EDBM_flag_disable_all(BMEditMesh *em, const char hflag)
+{
+	BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, hflag, FALSE);
+}
+
+void EDBM_flag_enable_all(BMEditMesh *em, const char hflag)
+{
+	BM_mesh_elem_hflag_enable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, hflag, TRUE);
+}
+
+/**************-------------- Undo ------------*****************/
+
+/* for callbacks */
+
+static void *getEditMesh(bContext *C)
+{
+	Object *obedit = CTX_data_edit_object(C);
+	if (obedit && obedit->type == OB_MESH) {
+		Mesh *me = obedit->data;
+		return me->edit_btmesh;
+	}
+	return NULL;
+}
+
+typedef struct UndoMesh {
+	Mesh me;
+	int selectmode;
+} UndoMesh;
+
+/* undo simply makes copies of a bmesh */
+static void *editbtMesh_to_undoMesh(void *emv, void *obdata)
+{
+	BMEditMesh *em = emv;
+	Mesh *obme = obdata;
+	
+	UndoMesh *um = MEM_callocN(sizeof(UndoMesh), "undo Mesh");
+	
+	/* make sure shape keys work */
+	um->me.key = obme->key ? copy_key_nolib(obme->key) : NULL;
+
+	/* BM_mesh_validate(em->bm); */ /* for troubleshooting */
+
+	BM_mesh_bm_to_me(em->bm, &um->me, FALSE);
+
+	um->selectmode = em->selectmode;
+
+	return um;
+}
+
+static void undoMesh_to_editbtMesh(void *umv, void *em_v, void *UNUSED(obdata))
+{
+	BMEditMesh *em = em_v, *em_tmp;
+	Object *ob = em->ob;
+	UndoMesh *um = umv;
+	BMesh *bm;
+
+	ob->shapenr = em->bm->shapenr;
+
+	EDBM_mesh_free(em);
+
+	bm = BM_mesh_create(&bm_mesh_allocsize_default);
+
+	BM_mesh_bm_from_me(bm, &um->me, FALSE, ob->shapenr);
+
+	/* face normals need recalculation since we are not calling through an operator */
+	BM_mesh_normals_update(bm, TRUE);
+
+	em_tmp = BMEdit_Create(bm, TRUE);
+	*em = *em_tmp;
+	
+	em->selectmode = um->selectmode;
+	em->ob = ob;
+
+	MEM_freeN(em_tmp);
+}
+
+static void free_undo(void *me_v)
+{
+	Mesh *me = me_v;
+	if (me->key) {
+		free_key(me->key);
+		MEM_freeN(me->key);
+	}
+
+	free_mesh(me, FALSE);
+	MEM_freeN(me);
+}
+
+/* and this is all the undo system needs to know */
+void undo_push_mesh(bContext *C, const char *name)
+{
+	/* em->ob gets out of date and crashes on mesh undo,
+	 * this is an easy way to ensure its OK
+	 * though we could investigate the matter further. */
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	em->ob = obedit;
+
+	undo_editmode_push(C, name, getEditMesh, free_undo, undoMesh_to_editbtMesh, editbtMesh_to_undoMesh, NULL);
+}
+
+/* write comment here */
+UvVertMap *EDBM_uv_vert_map_create(BMEditMesh *em, int selected, int do_face_idx_array, float *limit)
+{
+	BMVert *ev;
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	/* vars from original func */
+	UvVertMap *vmap;
+	UvMapVert *buf;
+	/* MTexPoly *tf; */ /* UNUSED */
+	MLoopUV *luv;
+	unsigned int a;
+	int totverts, i, totuv;
+	
+	if (do_face_idx_array)
+		EDBM_index_arrays_init(em, 0, 0, 1);
+
+	BM_mesh_elem_index_ensure(em->bm, BM_VERT);
+	
+	totverts = em->bm->totvert;
+	totuv = 0;
+
+	/* generate UvMapVert array */
+	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+		if (!selected || ((!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) && BM_elem_flag_test(efa, BM_ELEM_SELECT)))
+			totuv += efa->len;
+	}
+
+	if (totuv == 0) {
+		if (do_face_idx_array)
+			EDBM_index_arrays_free(em);
+		return NULL;
+	}
+	vmap = (UvVertMap *)MEM_callocN(sizeof(*vmap), "UvVertMap");
+	if (!vmap) {
+		if (do_face_idx_array)
+			EDBM_index_arrays_free(em);
+		return NULL;
+	}
+
+	vmap->vert = (UvMapVert **)MEM_callocN(sizeof(*vmap->vert) * totverts, "UvMapVert_pt");
+	buf = vmap->buf = (UvMapVert *)MEM_callocN(sizeof(*vmap->buf) * totuv, "UvMapVert");
+
+	if (!vmap->vert || !vmap->buf) {
+		free_uv_vert_map(vmap);
+		if (do_face_idx_array)
+			EDBM_index_arrays_free(em);
+		return NULL;
+	}
+	
+	a = 0;
+	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+		if (!selected || ((!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) && BM_elem_flag_test(efa, BM_ELEM_SELECT))) {
+			i = 0;
+			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+				buf->tfindex = i;
+				buf->f = a;
+				buf->separate = 0;
+				
+				buf->next = vmap->vert[BM_elem_index_get(l->v)];
+				vmap->vert[BM_elem_index_get(l->v)] = buf;
+				
+				buf++;
+				i++;
+			}
+		}
+
+		a++;
+	}
+	
+	/* sort individual uvs for each vert */
+	a = 0;
+	BM_ITER_MESH (ev, &iter, em->bm, BM_VERTS_OF_MESH) {
+		UvMapVert *newvlist = NULL, *vlist = vmap->vert[a];
+		UvMapVert *iterv, *v, *lastv, *next;
+		float *uv, *uv2, uvdiff[2];
+
+		while (vlist) {
+			v = vlist;
+			vlist = vlist->next;
+			v->next = newvlist;
+			newvlist = v;
+
+			efa = EDBM_face_at_index(em, v->f);
+			/* tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); */ /* UNUSED */
+			
+			l = BM_iter_at_index(em->bm, BM_LOOPS_OF_FACE, efa, v->tfindex);
+			luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+			uv = luv->uv;
+			
+			lastv = NULL;
+			iterv = vlist;
+
+			while (iterv) {
+				next = iterv->next;
+				efa = EDBM_face_at_index(em, iterv->f);
+				/* tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); */ /* UNUSED */
+				
+				l = BM_iter_at_index(em->bm, BM_LOOPS_OF_FACE, efa, iterv->tfindex);
+				luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+				uv2 = luv->uv;
+				
+				sub_v2_v2v2(uvdiff, uv2, uv);
+
+				if (fabs(uvdiff[0]) < limit[0] && fabs(uvdiff[1]) < limit[1]) {
+					if (lastv) lastv->next = next;
+					else vlist = next;
+					iterv->next = newvlist;
+					newvlist = iterv;
+				}
+				else {
+					lastv = iterv;
+				}
+
+				iterv = next;
+			}
+
+			newvlist->separate = 1;
+		}
+
+		vmap->vert[a] = newvlist;
+		a++;
+	}
+	
+	if (do_face_idx_array)
+		EDBM_index_arrays_free(em);
+	
+	return vmap;
+}
+
+
+UvMapVert *EDBM_uv_vert_map_at_index(UvVertMap *vmap, unsigned int v)
+{
+	return vmap->vert[v];
+}
+
+/* from editmesh_lib.c in trunk */
+
+
+/* A specialized vert map used by stitch operator */
+UvElementMap *EDBM_uv_element_map_create(BMEditMesh *em, int selected, int do_islands)
+{
+	BMVert *ev;
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	/* vars from original func */
+	UvElementMap *element_map;
+	UvElement *buf;
+	UvElement *islandbuf;
+	/* island number for faces */
+	int *island_number;
+
+	MLoopUV *luv;
+	int totverts, i, totuv, j, nislands = 0, islandbufsize = 0;
+
+	unsigned int *map;
+	BMFace **stack;
+	int stacksize = 0;
+
+	BM_mesh_elem_index_ensure(em->bm, BM_VERT | BM_FACE);
+
+	totverts = em->bm->totvert;
+	totuv = 0;
+
+	island_number = MEM_mallocN(sizeof(*stack) * em->bm->totface, "uv_island_number_face");
+	if (!island_number) {
+		return NULL;
+	}
+
+	/* generate UvElement array */
+	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+		if (!selected || ((!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) && BM_elem_flag_test(efa, BM_ELEM_SELECT)))
+			totuv += efa->len;
+	}
+
+	if (totuv == 0) {
+		MEM_freeN(island_number);
+		return NULL;
+	}
+	element_map = (UvElementMap *)MEM_callocN(sizeof(*element_map), "UvElementMap");
+	if (!element_map) {
+		MEM_freeN(island_number);
+		return NULL;
+	}
+	element_map->totalUVs = totuv;
+	element_map->vert = (UvElement **)MEM_callocN(sizeof(*element_map->vert) * totverts, "UvElementVerts");
+	buf = element_map->buf = (UvElement *)MEM_callocN(sizeof(*element_map->buf) * totuv, "UvElement");
+
+	if (!element_map->vert || !element_map->buf) {
+		EDBM_uv_element_map_free(element_map);
+		MEM_freeN(island_number);
+		return NULL;
+	}
+
+	j = 0;
+	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+		island_number[j++] = INVALID_ISLAND;
+		if (!selected || ((!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) && BM_elem_flag_test(efa, BM_ELEM_SELECT))) {
+			BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) {
+				buf->l = l;
+				buf->face = efa;
+				buf->separate = 0;
+				buf->island = INVALID_ISLAND;
+				buf->tfindex = i;
+
+				buf->next = element_map->vert[BM_elem_index_get(l->v)];
+				element_map->vert[BM_elem_index_get(l->v)] = buf;
+
+				buf++;
+			}
+		}
+	}
+
+	/* sort individual uvs for each vert */
+	i = 0;
+	BM_ITER_MESH (ev, &iter, em->bm, BM_VERTS_OF_MESH) {
+		UvElement *newvlist = NULL, *vlist = element_map->vert[i];
+		UvElement *iterv, *v, *lastv, *next;
+		float *uv, *uv2, uvdiff[2];
+
+		while (vlist) {
+			v = vlist;
+			vlist = vlist->next;
+			v->next = newvlist;
+			newvlist = v;
+
+			l = v->l;
+			luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+			uv = luv->uv;
+
+			lastv = NULL;
+			iterv = vlist;
+
+			while (iterv) {
+				next = iterv->next;
+
+				l = iterv->l;
+				luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+				uv2 = luv->uv;
+
+				sub_v2_v2v2(uvdiff, uv2, uv);
+
+				if (fabsf(uvdiff[0]) < STD_UV_CONNECT_LIMIT && fabsf(uvdiff[1]) < STD_UV_CONNECT_LIMIT) {
+					if (lastv) lastv->next = next;
+					else vlist = next;
+					iterv->next = newvlist;
+					newvlist = iterv;
+				}
+				else {
+					lastv = iterv;
+				}
+
+				iterv = next;
+			}
+
+			newvlist->separate = 1;
+		}
+
+		element_map->vert[i] = newvlist;
+		i++;
+	}
+
+	if (do_islands) {
+		/* map holds the map from current vmap->buf to the new, sorted map */
+		map = MEM_mallocN(sizeof(*map) * totuv, "uvelement_remap");
+		stack = MEM_mallocN(sizeof(*stack) * em->bm->totface, "uv_island_face_stack");
+		islandbuf = MEM_callocN(sizeof(*islandbuf) * totuv, "uvelement_island_buffer");
+
+		/* at this point, every UvElement in vert points to a UvElement sharing the same vertex. Now we should sort uv's in islands. */
+		for (i = 0; i < totuv; i++) {
+			if (element_map->buf[i].island == INVALID_ISLAND) {
+				element_map->buf[i].island = nislands;
+				stack[0] = element_map->buf[i].face;
+				island_number[BM_elem_index_get(stack[0])] = nislands;
+				stacksize = 1;
+
+				while (stacksize > 0) {
+					efa = stack[--stacksize];
+
+					BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+						UvElement *element, *initelement = element_map->vert[BM_elem_index_get(l->v)];
+
+						for (element = initelement; element; element = element->next) {
+							if (element->separate)
+								initelement = element;
+
+							if (element->face == efa) {
+								/* found the uv corresponding to our face and vertex. Now fill it to the buffer */
+								element->island = nislands;
+								map[element - element_map->buf] = islandbufsize;
+								islandbuf[islandbufsize].l = element->l;
+								islandbuf[islandbufsize].face = element->face;
+								islandbuf[islandbufsize].separate = element->separate;
+								islandbuf[islandbufsize].tfindex = element->tfindex;
+								islandbuf[islandbufsize].island =  nislands;
+								islandbufsize++;
+
+								for (element = initelement; element; element = element->next) {
+									if (element->separate && element != initelement)
+										break;
+
+									if (island_number[BM_elem_index_get(element->face)] == INVALID_ISLAND) {
+										stack[stacksize++] = element->face;
+										island_number[BM_elem_index_get(element->face)] = nislands;
+									}
+								}
+								break;
+							}
+						}
+					}
+				}
+
+				nislands++;
+			}
+		}
+
+		/* remap */
+		for (i = 0; i < em->bm->totvert; i++) {
+			/* important since we may do selection only. Some of these may be NULL */
+			if (element_map->vert[i])
+				element_map->vert[i] = &islandbuf[map[element_map->vert[i] - element_map->buf]];
+		}
+
+		element_map->islandIndices = MEM_callocN(sizeof(*element_map->islandIndices) * nislands, "UvElementMap_island_indices");
+		if (!element_map->islandIndices) {
+			MEM_freeN(islandbuf);
+			MEM_freeN(stack);
+			MEM_freeN(map);
+			EDBM_uv_element_map_free(element_map);
+			MEM_freeN(island_number);
+		}
+
+		j = 0;
+		for (i = 0; i < totuv; i++) {
+			UvElement *element = element_map->buf[i].next;
+			if (element == NULL)
+				islandbuf[map[i]].next = NULL;
+			else
+				islandbuf[map[i]].next = &islandbuf[map[element - element_map->buf]];
+
+			if (islandbuf[i].island != j) {
+				j++;
+				element_map->islandIndices[j] = i;
+			}
+		}
+
+		MEM_freeN(element_map->buf);
+
+		element_map->buf = islandbuf;
+		element_map->totalIslands = nislands;
+		MEM_freeN(stack);
+		MEM_freeN(map);
+	}
+	MEM_freeN(island_number);
+
+	return element_map;
+}
+
+void EDBM_uv_vert_map_free(UvVertMap *vmap)
+{
+	if (vmap) {
+		if (vmap->vert) MEM_freeN(vmap->vert);
+		if (vmap->buf) MEM_freeN(vmap->buf);
+		MEM_freeN(vmap);
+	}
+}
+
+void EDBM_uv_element_map_free(UvElementMap *element_map)
+{
+	if (element_map) {
+		if (element_map->vert) MEM_freeN(element_map->vert);
+		if (element_map->buf) MEM_freeN(element_map->buf);
+		if (element_map->islandIndices) MEM_freeN(element_map->islandIndices);
+		MEM_freeN(element_map);
+	}
+}
+
+/* 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)
+{
+	BMFace *efa = NULL;
+	
+	if (!EDBM_mtexpoly_check(em))
+		return NULL;
+	
+	efa = BM_active_face_get(em->bm, sloppy);
+	
+	if (efa) {
+		if (r_act_efa) *r_act_efa = efa;
+		return CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
+	}
+
+	if (r_act_efa) *r_act_efa = NULL;
+	return NULL;
+}
+
+/* can we edit UV's for this mesh?*/
+int EDBM_mtexpoly_check(BMEditMesh *em)
+{
+	/* some of these checks could be a touch overkill */
+	return em && em->bm->totface && CustomData_has_layer(&em->bm->pdata, CD_MTEXPOLY) &&
+	       CustomData_has_layer(&em->bm->ldata, CD_MLOOPUV);
+}
+
+int EDBM_vert_color_check(BMEditMesh *em)
+{
+	/* some of these checks could be a touch overkill */
+	return em && em->bm->totface && CustomData_has_layer(&em->bm->ldata, CD_MLOOPCOL);
+}
+
+static BMVert *cache_mirr_intptr_as_bmvert(intptr_t *index_lookup, int index)
+{
+	intptr_t eve_i = index_lookup[index];
+	return (eve_i == -1) ? NULL : (BMVert *)eve_i;
+}
+
+/**
+ * [note: I've decided to use ideasman's code for non-editmode stuff, but since
+ *  it has a big "not for editmode!" disclaimer, I'm going to keep what I have here
+ *  - joeedh]
+ *
+ * x-mirror editing api.  usage:
+ *
+ *  EDBM_verts_mirror_cache_begin(em);
+ *  ...
+ *  ...
+ *  BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) {
+ *     mirrorv = EDBM_verts_mirror_get(em, v);
+ *  }
+ *  ...
+ *  ...
+ *  EDBM_verts_mirror_cache_end(em);
+ *
+ * \note why do we only allow x axis mirror editing?
+ */
+
+/* BM_SEARCH_MAXDIST is too big, copied from 2.6x MOC_THRESH, should become a
+ * preference */
+#define BM_SEARCH_MAXDIST_MIRR 0.00002f
+#define BM_CD_LAYER_ID "__mirror_index"
+void EDBM_verts_mirror_cache_begin(BMEditMesh *em, const short use_select)
+{
+	Mesh *me = em->me;
+	BMesh *bm = em->bm;
+	BMIter iter;
+	BMVert *v;
+	int li, topo = 0;
+
+	/* one or the other is used depending if topo is enabled */
+	BMBVHTree *tree = NULL;
+	MirrTopoStore_t mesh_topo_store = {NULL, -1, -1, -1};
+
+	if (me && (me->editflag & ME_EDIT_MIRROR_TOPO)) {
+		topo = 1;
+	}
+
+	if (!em->vert_index) {
+		EDBM_index_arrays_init(em, 1, 0, 0);
+		em->mirr_free_arrays = 1;
+	}
+
+	if (!CustomData_get_layer_named(&bm->vdata, CD_PROP_INT, BM_CD_LAYER_ID)) {
+		BM_data_layer_add_named(bm, &bm->vdata, CD_PROP_INT, BM_CD_LAYER_ID);
+	}
+
+	li = CustomData_get_named_layer_index(&bm->vdata, CD_PROP_INT, BM_CD_LAYER_ID);
+
+	bm->vdata.layers[li].flag |= CD_FLAG_TEMPORARY;
+
+	BM_mesh_elem_index_ensure(bm, BM_VERT);
+
+	if (topo) {
+		ED_mesh_mirrtopo_init(me, -1, &mesh_topo_store, TRUE);
+	}
+	else {
+		tree = BMBVH_NewBVH(em, 0, NULL, NULL);
+	}
+
+	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+
+		/* temporary for testing, check for selection */
+		if (use_select && !BM_elem_flag_test(v, BM_ELEM_SELECT)) {
+			/* do nothing */
+		}
+		else {
+			BMVert *mirr;
+			int *idx = CustomData_bmesh_get_layer_n(&bm->vdata, v->head.data, li);
+
+			if (topo) {
+				mirr = cache_mirr_intptr_as_bmvert(mesh_topo_store.index_lookup, BM_elem_index_get(v));
+			}
+			else {
+				float co[3] = {-v->co[0], v->co[1], v->co[2]};
+				mirr = BMBVH_FindClosestVert(tree, co, BM_SEARCH_MAXDIST_MIRR);
+			}
+
+			if (mirr && mirr != v) {
+				*idx = BM_elem_index_get(mirr);
+				idx = CustomData_bmesh_get_layer_n(&bm->vdata, mirr->head.data, li);
+				*idx = BM_elem_index_get(v);
+			}
+			else {
+				*idx = -1;
+			}
+		}
+
+	}
+
+
+	if (topo) {
+		ED_mesh_mirrtopo_free(&mesh_topo_store);
+	}
+	else {
+		BMBVH_FreeBVH(tree);
+	}
+
+	em->mirror_cdlayer = li;
+}
+
+BMVert *EDBM_verts_mirror_get(BMEditMesh *em, BMVert *v)
+{
+	int *mirr = CustomData_bmesh_get_layer_n(&em->bm->vdata, v->head.data, em->mirror_cdlayer);
+
+	BLI_assert(em->mirror_cdlayer != -1); /* invalid use */
+
+	if (mirr && *mirr >= 0 && *mirr < em->bm->totvert) {
+		if (!em->vert_index) {
+			printf("err: should only be called between "
+			       "EDBM_verts_mirror_cache_begin and EDBM_verts_mirror_cache_end");
+			return NULL;
+		}
+
+		return em->vert_index[*mirr];
+	}
+
+	return NULL;
+}
+
+void EDBM_verts_mirror_cache_clear(BMEditMesh *em, BMVert *v)
+{
+	int *mirr = CustomData_bmesh_get_layer_n(&em->bm->vdata, v->head.data, em->mirror_cdlayer);
+
+	BLI_assert(em->mirror_cdlayer != -1); /* invalid use */
+
+	if (mirr) {
+		*mirr = -1;
+	}
+}
+
+void EDBM_verts_mirror_cache_end(BMEditMesh *em)
+{
+	if (em->mirr_free_arrays) {
+		MEM_freeN(em->vert_index);
+		em->vert_index = NULL;
+	}
+
+	em->mirror_cdlayer = -1;
+}
+
+void EDBM_verts_mirror_apply(BMEditMesh *em, const int sel_from, const int sel_to)
+{
+	BMIter iter;
+	BMVert *v;
+
+	BLI_assert(em->vert_index != NULL);
+
+	BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) {
+		if (BM_elem_flag_test(v, BM_ELEM_SELECT) == sel_from) {
+			BMVert *mirr = EDBM_verts_mirror_get(em, v);
+			if (mirr) {
+				if (BM_elem_flag_test(mirr, BM_ELEM_SELECT) == sel_to) {
+					copy_v3_v3(mirr->co, v->co);
+					mirr->co[0] *= -1.0f;
+				}
+			}
+		}
+	}
+}
+
+
+/* swap is 0 or 1, if 1 it hides not selected */
+void EDBM_mesh_hide(BMEditMesh *em, int swap)
+{
+	BMIter iter;
+	BMElem *ele;
+	int itermode;
+
+	if (em == NULL) return;
+
+	if (em->selectmode & SCE_SELECT_VERTEX)
+		itermode = BM_VERTS_OF_MESH;
+	else if (em->selectmode & SCE_SELECT_EDGE)
+		itermode = BM_EDGES_OF_MESH;
+	else
+		itermode = BM_FACES_OF_MESH;
+
+	BM_ITER_MESH (ele, &iter, em->bm, itermode) {
+		if (BM_elem_flag_test(ele, BM_ELEM_SELECT) ^ swap)
+			BM_elem_hide_set(em->bm, ele, TRUE);
+	}
+
+	EDBM_selectmode_flush(em);
+
+	/* original hide flushing comment (OUTDATED):
+	 * hide happens on least dominant select mode, and flushes up, not down! (helps preventing errors in subsurf) */
+	/* - vertex hidden, always means edge is hidden too
+	 * - edge hidden, always means face is hidden too
+	 * - face hidden, only set face hide
+	 * - then only flush back down what's absolute hidden
+	 */
+}
+
+
+void EDBM_mesh_reveal(BMEditMesh *em)
+{
+	const char iter_types[3] = {BM_VERTS_OF_MESH,
+	                            BM_EDGES_OF_MESH,
+	                            BM_FACES_OF_MESH};
+
+	int sels[3] = {(em->selectmode & SCE_SELECT_VERTEX),
+	               (em->selectmode & SCE_SELECT_EDGE),
+	               (em->selectmode & SCE_SELECT_FACE), };
+
+	BMIter iter;
+	BMElem *ele;
+	int i;
+
+	/* Use tag flag to remember what was hidden before all is revealed.
+	 * BM_ELEM_HIDDEN --> BM_ELEM_TAG */
+	for (i = 0; i < 3; i++) {
+		BM_ITER_MESH (ele, &iter, em->bm, iter_types[i]) {
+			BM_elem_flag_set(ele, BM_ELEM_TAG, BM_elem_flag_test(ele, BM_ELEM_HIDDEN));
+		}
+	}
+
+	/* Reveal everything */
+	EDBM_flag_disable_all(em, BM_ELEM_HIDDEN);
+
+	/* Select relevant just-revealed elements */
+	for (i = 0; i < 3; i++) {
+		if (!sels[i]) {
+			continue;
+		}
+
+		BM_ITER_MESH (ele, &iter, em->bm, iter_types[i]) {
+			if (BM_elem_flag_test(ele, BM_ELEM_TAG)) {
+				BM_elem_select_set(em->bm, ele, TRUE);
+			}
+		}
+	}
+
+	EDBM_selectmode_flush(em);
+
+	/* hidden faces can have invalid normals */
+	EDBM_mesh_normals_update(em);
+}
+
+/* so many tools call these that we better make it a generic function.
+ */
+void EDBM_update_generic(bContext *C, BMEditMesh *em, const short do_tessface)
+{
+	Object *ob = em->ob;
+	/* order of calling isn't important */
+	DAG_id_tag_update(ob->data, OB_RECALC_DATA);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
+
+	if (do_tessface) {
+		BMEdit_RecalcTessellation(em);
+	}
+}
diff --git a/source/blender/editors/mesh/loopcut.c b/source/blender/editors/mesh/loopcut.c
deleted file mode 100644
index c317eab..0000000
--- a/source/blender/editors/mesh/loopcut.c
+++ /dev/null
@@ -1,577 +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) 2007 Blender Foundation.
- * All rights reserved.
- *
- * 
- * Contributor(s): Joseph Eagar, Joshua Leung
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/mesh/loopcut.c
- *  \ingroup edmesh
- */
-
-
-#include <float.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdio.h>
-
-#include "DNA_ID.h"
-#include "DNA_object_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_windowmanager_types.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "PIL_time.h"
-
-#include "BLI_array.h"
-#include "BLI_blenlib.h"
-#include "BLI_dynstr.h" /*for WM_operator_pystring */
-#include "BLI_editVert.h"
-#include "BLI_math.h"
-#include "BLI_utildefines.h"
-
-#include "BKE_blender.h"
-#include "BKE_context.h"
-#include "BKE_depsgraph.h"
-#include "BKE_mesh.h"
-#include "BKE_modifier.h"
-#include "BKE_report.h"
-#include "BKE_scene.h"
-
-#include "BIF_gl.h"
-#include "BIF_glutil.h" /* for paint cursor */
-
-#include "IMB_imbuf_types.h"
-
-#include "ED_screen.h"
-#include "ED_space_api.h"
-#include "ED_view3d.h"
-#include "ED_mesh.h"
-#include "ED_numinput.h"
-
-#include "RNA_access.h"
-#include "RNA_define.h"
-
-#include "UI_interface.h"
-
-#include "WM_api.h"
-#include "WM_types.h"
-
-#include "mesh_intern.h"
-
-/* ringsel operator */
-
-/* struct for properties used while drawing */
-typedef struct tringselOpData {
-	ARegion *ar;		/* region that ringsel was activated in */
-	void *draw_handle;	/* for drawing preview loop */
-	
-	float (*edges)[2][3];
-	int totedge;
-
-	ViewContext vc;
-
-	Object *ob;
-	EditMesh *em;
-	EditEdge *eed;
-	NumInput num;
-
-	int extend;
-	int do_cut;
-} tringselOpData;
-
-/* modal loop selection drawing callback */
-static void ringsel_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
-{
-	View3D *v3d = CTX_wm_view3d(C);
-	tringselOpData *lcd = arg;
-	int i;
-	
-	if (lcd->totedge > 0) {
-		if(v3d && v3d->zbuf)
-			glDisable(GL_DEPTH_TEST);
-
-		glPushMatrix();
-		glMultMatrixf(lcd->ob->obmat);
-
-		glColor3ub(255, 0, 255);
-		glBegin(GL_LINES);
-		for (i=0; i<lcd->totedge; i++) {
-			glVertex3fv(lcd->edges[i][0]);
-			glVertex3fv(lcd->edges[i][1]);
-		}
-		glEnd();
-
-		glPopMatrix();
-		if(v3d && v3d->zbuf)
-			glEnable(GL_DEPTH_TEST);
-	}
-}
-
-static void edgering_sel(tringselOpData *lcd, int previewlines, int select)
-{
-	EditMesh *em = lcd->em;
-	EditEdge *startedge = lcd->eed;
-	EditEdge *eed;
-	EditFace *efa;
-	EditVert *v[2][2];
-	float (*edges)[2][3] = NULL;
-	BLI_array_declare(edges);
-	float co[2][3];
-	int looking=1, i, tot=0;
-	
-	if (!startedge)
-		return;
-
-	if (lcd->edges) {
-		MEM_freeN(lcd->edges);
-		lcd->edges = NULL;
-		lcd->totedge = 0;
-	}
-
-	if (!lcd->extend) {
-		EM_clear_flag_all(lcd->em, SELECT);
-	}
-
-	/* in eed->f1 we put the valence (amount of faces in edge) */
-	/* in eed->f2 we put tagged flag as correct loop */
-	/* in efa->f1 we put tagged flag as correct to select */
-
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		eed->f1= 0;
-		eed->f2= 0;
-	}
-
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		efa->f1= 0;
-		if(efa->h==0) {
-			efa->e1->f1++;
-			efa->e2->f1++;
-			efa->e3->f1++;
-			if(efa->e4) efa->e4->f1++;
-		}
-	}
-	
-	// tag startedge OK
-	startedge->f2= 1;
-	
-	while(looking) {
-		looking= 0;
-		
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->e4 && efa->f1==0 && efa->h == 0) {	// not done quad
-				if(efa->e1->f1<=2 && efa->e2->f1<=2 && efa->e3->f1<=2 && efa->e4->f1<=2) { // valence ok
-
-					// if edge tagged, select opposing edge and mark face ok
-					if(efa->e1->f2) {
-						efa->e3->f2= 1;
-						efa->f1= 1;
-						looking= 1;
-					}
-					else if(efa->e2->f2) {
-						efa->e4->f2= 1;
-						efa->f1= 1;
-						looking= 1;
-					}
-					if(efa->e3->f2) {
-						efa->e1->f2= 1;
-						efa->f1= 1;
-						looking= 1;
-					}
-					if(efa->e4->f2) {
-						efa->e2->f2= 1;
-						efa->f1= 1;
-						looking= 1;
-					}
-				}
-			}
-		}
-	}
-	
-	if(previewlines > 0 && !select){
-			for(efa= em->faces.first; efa; efa= efa->next) {
-				if(efa->v4 == NULL) {  continue; }
-				if(efa->h == 0){
-					if(efa->e1->f2 == 1){
-						if(efa->e1->h == 1 || efa->e3->h == 1 )
-							continue;
-						
-						v[0][0] = efa->v1;
-						v[0][1] = efa->v2;
-						v[1][0] = efa->v4;
-						v[1][1] = efa->v3;
-					} else if(efa->e2->f2 == 1){
-						if(efa->e2->h == 1 || efa->e4->h == 1)
-							continue;
-						v[0][0] = efa->v2;
-						v[0][1] = efa->v3;
-						v[1][0] = efa->v1;
-						v[1][1] = efa->v4;					
-					} else { continue; }
-										  
-					for(i=1;i<=previewlines;i++){
-						co[0][0] = (v[0][1]->co[0] - v[0][0]->co[0])*(i/((float)previewlines+1))+v[0][0]->co[0];
-						co[0][1] = (v[0][1]->co[1] - v[0][0]->co[1])*(i/((float)previewlines+1))+v[0][0]->co[1];
-						co[0][2] = (v[0][1]->co[2] - v[0][0]->co[2])*(i/((float)previewlines+1))+v[0][0]->co[2];
-
-						co[1][0] = (v[1][1]->co[0] - v[1][0]->co[0])*(i/((float)previewlines+1))+v[1][0]->co[0];
-						co[1][1] = (v[1][1]->co[1] - v[1][0]->co[1])*(i/((float)previewlines+1))+v[1][0]->co[1];
-						co[1][2] = (v[1][1]->co[2] - v[1][0]->co[2])*(i/((float)previewlines+1))+v[1][0]->co[2];					
-						
-						BLI_array_growone(edges);
-						copy_v3_v3(edges[tot][0], co[0]);
-						copy_v3_v3(edges[tot][1], co[1]);
-						tot++;
-					}
-				}
-			}
-	} else {
-		select = (startedge->f & SELECT) == 0;
-
-		/* select the edges */
-		for(eed= em->edges.first; eed; eed= eed->next) {
-			if(eed->f2) EM_select_edge(eed, select);
-		}
-	}
-
-	lcd->edges = edges;
-	lcd->totedge = tot;
-}
-
-static void ringsel_find_edge(tringselOpData *lcd, int cuts)
-{
-	if (lcd->eed) {
-		edgering_sel(lcd, cuts, 0);
-	} else if(lcd->edges) {
-		MEM_freeN(lcd->edges);
-		lcd->edges = NULL;
-		lcd->totedge = 0;
-	}
-}
-
-static void ringsel_finish(bContext *C, wmOperator *op)
-{
-	tringselOpData *lcd= op->customdata;
-	int cuts= (lcd->do_cut)? RNA_int_get(op->ptr,"number_cuts"): 0;
-
-	if (lcd->eed) {
-		EditMesh *em = BKE_mesh_get_editmesh(lcd->ob->data);
-		
-		edgering_sel(lcd, cuts, 1);
-		
-		if (lcd->do_cut) {
-
-			esubdivideflag(lcd->ob, em, SELECT, 0.0f, 0.0f, 0, cuts, 0, SUBDIV_SELECT_LOOPCUT);
-
-			/* force edge slide to edge select mode in in face select mode */
-			if (em->selectmode & SCE_SELECT_FACE) {
-				if (em->selectmode == SCE_SELECT_FACE)
-					em->selectmode = SCE_SELECT_EDGE;
-				else
-					em->selectmode &= ~SCE_SELECT_FACE;
-				CTX_data_tool_settings(C)->selectmode= em->selectmode;
-				EM_selectmode_set(em);
-
-				WM_event_add_notifier(C, NC_SCENE|ND_TOOLSETTINGS, CTX_data_scene(C));
-			}
-			
-			DAG_id_tag_update(lcd->ob->data, 0);
-			WM_event_add_notifier(C, NC_GEOM|ND_DATA, lcd->ob->data);
-		}
-		else {
-			
-			/* sets as active, useful for other tools */
-			if(em->selectmode & SCE_SELECT_VERTEX)
-				EM_store_selection(em, lcd->eed->v1, EDITVERT);
-			if(em->selectmode & SCE_SELECT_EDGE)
-				EM_store_selection(em, lcd->eed, EDITEDGE);
-			
-			EM_selectmode_flush(lcd->em);
-			WM_event_add_notifier(C, NC_GEOM|ND_SELECT, lcd->ob->data);
-		}
-	}
-}
-
-/* called when modal loop selection is done... */
-static void ringsel_exit(wmOperator *op)
-{
-	tringselOpData *lcd= op->customdata;
-
-	/* deactivate the extra drawing stuff in 3D-View */
-	ED_region_draw_cb_exit(lcd->ar->type, lcd->draw_handle);
-	
-	if (lcd->edges)
-		MEM_freeN(lcd->edges);
-
-	ED_region_tag_redraw(lcd->ar);
-
-	/* free the custom data */
-	MEM_freeN(lcd);
-	op->customdata= NULL;
-}
-
-/* called when modal loop selection gets set up... */
-static int ringsel_init (bContext *C, wmOperator *op, int do_cut)
-{
-	tringselOpData *lcd;
-	
-	/* alloc new customdata */
-	lcd= op->customdata= MEM_callocN(sizeof(tringselOpData), "ringsel Modal Op Data");
-	
-	/* assign the drawing handle for drawing preview line... */
-	lcd->ar= CTX_wm_region(C);
-	lcd->draw_handle= ED_region_draw_cb_activate(lcd->ar->type, ringsel_draw, lcd, REGION_DRAW_POST_VIEW);
-	lcd->ob = CTX_data_edit_object(C);
-	lcd->em= BKE_mesh_get_editmesh((Mesh *)lcd->ob->data);
-	lcd->extend = do_cut ? 0 : RNA_boolean_get(op->ptr, "extend");
-	lcd->do_cut = do_cut;
-	
-	initNumInput(&lcd->num);
-	lcd->num.idx_max = 0;
-	lcd->num.flag |= NUM_NO_NEGATIVE | NUM_NO_FRACTION;
-	
-	em_setup_viewcontext(C, &lcd->vc);
-
-	ED_region_tag_redraw(lcd->ar);
-
-	return 1;
-}
-
-static int ringcut_cancel (bContext *UNUSED(C), wmOperator *op)
-{
-	/* this is just a wrapper around exit() */
-	ringsel_exit(op);
-	return OPERATOR_CANCELLED;
-}
-
-static int ringsel_invoke (bContext *C, wmOperator *op, wmEvent *evt)
-{
-	tringselOpData *lcd;
-	EditEdge *edge;
-	int dist = 75;
-	
-	view3d_operator_needs_opengl(C);
-
-	if (!ringsel_init(C, op, 0))
-		return OPERATOR_CANCELLED;
-	
-	lcd = op->customdata;
-	
-	if (lcd->em->selectmode == SCE_SELECT_FACE) {
-		PointerRNA props_ptr;
-		int extend = RNA_boolean_get(op->ptr, "extend");
-
-		ringsel_exit(op);
-
-		WM_operator_properties_create(&props_ptr, "MESH_OT_loop_select");
-		RNA_boolean_set(&props_ptr, "extend", extend);
-		WM_operator_name_call(C, "MESH_OT_loop_select", WM_OP_INVOKE_REGION_WIN, &props_ptr);
-		WM_operator_properties_free(&props_ptr);
-
-		return OPERATOR_CANCELLED;
-	}
-
-	lcd->vc.mval[0] = evt->mval[0];
-	lcd->vc.mval[1] = evt->mval[1];
-	
-	edge = findnearestedge(&lcd->vc, &dist);
-	if(!edge) {
-		ringsel_exit(op);
-		return OPERATOR_CANCELLED;
-	}
-
-	lcd->eed = edge;
-	ringsel_find_edge(lcd, 1);
-
-	ringsel_finish(C, op);
-	ringsel_exit(op);
-
-	return OPERATOR_FINISHED;
-}
-
-static int ringcut_invoke (bContext *C, wmOperator *op, wmEvent *evt)
-{
-	Object *obedit= CTX_data_edit_object(C);
-	tringselOpData *lcd;
-	EditEdge *edge;
-	int dist = 75;
-
-	if(modifiers_isDeformedByLattice(obedit) || modifiers_isDeformedByArmature(obedit))
-		BKE_report(op->reports, RPT_WARNING, "Loop cut doesn't work well on deformed edit mesh display");
-	
-	view3d_operator_needs_opengl(C);
-
-	if (!ringsel_init(C, op, 1))
-		return OPERATOR_CANCELLED;
-	
-	/* add a modal handler for this operator - handles loop selection */
-	WM_event_add_modal_handler(C, op);
-
-	lcd = op->customdata;
-	lcd->vc.mval[0] = evt->mval[0];
-	lcd->vc.mval[1] = evt->mval[1];
-	
-	edge = findnearestedge(&lcd->vc, &dist);
-	if (edge != lcd->eed) {
-		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");
-	
-	return OPERATOR_RUNNING_MODAL;
-}
-
-static int ringcut_modal (bContext *C, wmOperator *op, wmEvent *event)
-{
-	int cuts= RNA_int_get(op->ptr,"number_cuts");
-	tringselOpData *lcd= op->customdata;
-
-	view3d_operator_needs_opengl(C);
-
-
-	switch (event->type) {
-		case LEFTMOUSE: /* confirm */ // XXX hardcoded
-			if (event->val == KM_PRESS) {
-				/* finish */
-				ED_region_tag_redraw(lcd->ar);
-				
-				ringsel_finish(C, op);
-				ringsel_exit(op);
-				ED_area_headerprint(CTX_wm_area(C), NULL);
-				
-				return OPERATOR_FINISHED;
-			}
-			
-			ED_region_tag_redraw(lcd->ar);
-			break;
-		case RIGHTMOUSE: /* abort */ // XXX hardcoded
-		case ESCKEY:
-			if (event->val == KM_RELEASE) {
-				/* cancel */
-				ED_region_tag_redraw(lcd->ar);
-				ED_area_headerprint(CTX_wm_area(C), NULL);
-				
-				return ringcut_cancel(C, op);
-			}
-			
-			ED_region_tag_redraw(lcd->ar);
-			break;
-		case WHEELUPMOUSE:  /* change number of cuts */
-		case PADPLUSKEY:
-		case PAGEUPKEY:
-			if (event->val == KM_PRESS) {
-				cuts++;
-				RNA_int_set(op->ptr, "number_cuts",cuts);
-				ringsel_find_edge(lcd, cuts);
-				
-				ED_region_tag_redraw(lcd->ar);
-			}
-			break;
-		case WHEELDOWNMOUSE:  /* change number of cuts */
-		case PADMINUS:
-		case PAGEDOWNKEY:
-			if (event->val == KM_PRESS) {
-				cuts=MAX2(cuts-1,1);
-				RNA_int_set(op->ptr,"number_cuts",cuts);
-				ringsel_find_edge(lcd, cuts);
-				
-				ED_region_tag_redraw(lcd->ar);
-			}
-			break;
-		case MOUSEMOVE: { /* mouse moved somewhere to select another loop */
-			int dist = 75;
-			EditEdge *edge;
-
-			lcd->vc.mval[0] = event->mval[0];
-			lcd->vc.mval[1] = event->mval[1];
-			edge = findnearestedge(&lcd->vc, &dist);
-
-			if (edge != lcd->eed) {
-				lcd->eed = edge;
-				ringsel_find_edge(lcd, cuts);
-			}
-
-			ED_region_tag_redraw(lcd->ar);
-			break;
-		}			
-	}
-	
-	/* using the keyboard to input the number of cuts */
-	if (event->val==KM_PRESS) {
-		float value;
-		
-		if (handleNumInput(&lcd->num, event))
-		{
-			applyNumInput(&lcd->num, &value);
-			
-			cuts= CLAMPIS(value, 1, 32);
-			
-			RNA_int_set(op->ptr,"number_cuts",cuts);
-			ringsel_find_edge(lcd, cuts);
-			
-			ED_region_tag_redraw(lcd->ar);
-		}
-	}
-	
-	/* keep going until the user confirms */
-	return OPERATOR_RUNNING_MODAL;
-}
-
-void MESH_OT_edgering_select (wmOperatorType *ot)
-{
-	/* description */
-	ot->name= "Edge Ring Select";
-	ot->idname= "MESH_OT_edgering_select";
-	ot->description= "Select an edge ring";
-	
-	/* callbacks */
-	ot->invoke= ringsel_invoke;
-	ot->poll= ED_operator_editmesh_region_view3d; 
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
-	RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection");
-}
-
-void MESH_OT_loopcut (wmOperatorType *ot)
-{
-	/* description */
-	ot->name= "Loop Cut";
-	ot->idname= "MESH_OT_loopcut";
-	ot->description= "Add a new loop between existing loops";
-	
-	/* callbacks */
-	ot->invoke= ringcut_invoke;
-	ot->modal= ringcut_modal;
-	ot->cancel= ringcut_cancel;
-	ot->poll= ED_operator_editmesh_region_view3d;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
-
-	/* properties */
-	RNA_def_int(ot->srna, "number_cuts", 1, 1, INT_MAX, "Number of Cuts", "", 1, 10);
-}
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index 09ae5e0..5aea6f8 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -36,13 +36,15 @@
 #include "MEM_guardedalloc.h"
 
 #include "DNA_material_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_view3d_types.h"
 
+#include "BLI_utildefines.h"
+#include "BLI_array.h"
 #include "BLI_math.h"
-#include "BLI_editVert.h"
 #include "BLI_edgehash.h"
 #include "BLI_utildefines.h"
 
@@ -55,6 +57,7 @@
 #include "BKE_material.h"
 #include "BKE_mesh.h"
 #include "BKE_report.h"
+#include "BKE_tessmesh.h"
 
 #include "RNA_access.h"
 #include "RNA_define.h"
@@ -71,44 +74,68 @@
 
 #include "mesh_intern.h"
 
+#define GET_CD_DATA(me, data) (me->edit_btmesh ? &me->edit_btmesh->bm->data : &me->data)
 static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *layer)
 {
 	Mesh *me = ob->data;
-	CustomData *data= (me->edit_mesh)? &me->edit_mesh->fdata: &me->fdata;
-	void *actlayerdata, *rndlayerdata, *clonelayerdata, *stencillayerdata, *layerdata=layer->data;
-	int type= layer->type;
-	int index= CustomData_get_layer_index(data, type);
-	int i, actindex, rndindex, cloneindex, stencilindex;
+	CustomData *data;
+	void *actlayerdata, *rndlayerdata, *clonelayerdata, *stencillayerdata, *layerdata = layer->data;
+	int type = layer->type;
+	int index;
+	int i, actindex, rndindex, cloneindex, stencilindex, tot;
+
+	if (layer->type == CD_MLOOPCOL || layer->type == CD_MLOOPUV) {
+		if (me->edit_btmesh) {
+			data = &me->edit_btmesh->bm->ldata;
+			tot = me->edit_btmesh->bm->totloop;
+		}
+		else {
+			data = &me->ldata;
+			tot = me->totloop;
+		}
+	}
+	else {
+		if (me->edit_btmesh) {
+			data = &me->edit_btmesh->bm->pdata;
+			tot = me->edit_btmesh->bm->totface;
+		}
+		else {
+			data = &me->pdata;
+			tot = me->totpoly;
+		}
+	}
 	
+	index = CustomData_get_layer_index(data, type);
+
 	/* ok, deleting a non-active layer needs to preserve the active layer indices.
-	  to do this, we store a pointer to the .data member of both layer and the active layer,
-	  (to detect if we're deleting the active layer or not), then use the active
-	  layer data pointer to find where the active layer has ended up.
-	  
-	  this is necassary because the deletion functions only support deleting the active
-	  layer. */
+	 * to do this, we store a pointer to the .data member of both layer and the active layer,
+	 * (to detect if we're deleting the active layer or not), then use the active
+	 * layer data pointer to find where the active layer has ended up.
+	 *
+	 * this is necessary because the deletion functions only support deleting the active
+	 * layer. */
 	actlayerdata = data->layers[CustomData_get_active_layer_index(data, type)].data;
 	rndlayerdata = data->layers[CustomData_get_render_layer_index(data, type)].data;
 	clonelayerdata = data->layers[CustomData_get_clone_layer_index(data, type)].data;
 	stencillayerdata = data->layers[CustomData_get_stencil_layer_index(data, type)].data;
 	CustomData_set_layer_active(data, type, layer - &data->layers[index]);
 
-	if(me->edit_mesh) {
-		EM_free_data_layer(me->edit_mesh, data, type);
+	if (me->edit_btmesh) {
+		BM_data_layer_free(me->edit_btmesh->bm, data, type);
 	}
 	else {
-		CustomData_free_layer_active(data, type, me->totface);
-		mesh_update_customdata_pointers(me);
+		CustomData_free_layer_active(data, type, tot);
+		mesh_update_customdata_pointers(me, TRUE);
 	}
 
-	if(!CustomData_has_layer(data, type) && (type == CD_MCOL && (ob->mode & OB_MODE_VERTEX_PAINT)))
+	if (!CustomData_has_layer(data, type) && (type == CD_MLOOPCOL && (ob->mode & OB_MODE_VERTEX_PAINT)))
 		ED_object_toggle_modes(C, OB_MODE_VERTEX_PAINT);
 
 	/* reconstruct active layer */
 	if (actlayerdata != layerdata) {
 		/* find index */
 		actindex = CustomData_get_layer_index(data, type);
-		for (i=actindex; i<data->totlayer; i++) {
+		for (i = actindex; i < data->totlayer; i++) {
 			if (data->layers[i].data == actlayerdata) {
 				actindex = i - actindex;
 				break;
@@ -122,7 +149,7 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
 	if (rndlayerdata != layerdata) {
 		/* find index */
 		rndindex = CustomData_get_layer_index(data, type);
-		for (i=rndindex; i<data->totlayer; i++) {
+		for (i = rndindex; i < data->totlayer; i++) {
 			if (data->layers[i].data == rndlayerdata) {
 				rndindex = i - rndindex;
 				break;
@@ -136,7 +163,7 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
 	if (clonelayerdata != layerdata) {
 		/* find index */
 		cloneindex = CustomData_get_layer_index(data, type);
-		for (i=cloneindex; i<data->totlayer; i++) {
+		for (i = cloneindex; i < data->totlayer; i++) {
 			if (data->layers[i].data == clonelayerdata) {
 				cloneindex = i - cloneindex;
 				break;
@@ -150,7 +177,7 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
 	if (stencillayerdata != layerdata) {
 		/* find index */
 		stencilindex = CustomData_get_layer_index(data, type);
-		for (i=stencilindex; i<data->totlayer; i++) {
+		for (i = stencilindex; i < data->totlayer; i++) {
 			if (data->layers[i].data == stencillayerdata) {
 				stencilindex = i - stencilindex;
 				break;
@@ -162,154 +189,343 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
 	}
 }
 
-static void copy_editface_active_customdata(EditMesh *em, int type, int index)
+/* copies from active to 'index' */
+static void editmesh_face_copy_customdata(BMEditMesh *em, int type, int index)
 {
-	EditFace *efa;
-	int n= CustomData_get_active_layer(&em->fdata, type);
+	BMesh *bm = em->bm;
+	CustomData *pdata = &bm->pdata;
+	BMIter iter;
+	BMFace *efa;
+	const int n = CustomData_get_active_layer(pdata, type);
+
+	/* ensure all current elements follow new customdata layout */
+	BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+		void *data = CustomData_bmesh_get_n(pdata, efa->head.data, type, n);
+		CustomData_bmesh_set_n(pdata, efa->head.data, type, index, data);
+	}
+}
 
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		void *data= CustomData_em_get_n(&em->fdata, efa->data, type, n);
-		CustomData_em_set_n(&em->fdata, efa->data, type, index, data);
+/* copies from active to 'index' */
+static void editmesh_loop_copy_customdata(BMEditMesh *em, int type, int index)
+{
+	BMesh *bm = em->bm;
+	CustomData *ldata = &bm->ldata;
+	BMIter iter;
+	BMIter liter;
+	BMFace *efa;
+	BMLoop *loop;
+	const int n = CustomData_get_active_layer(ldata, type);
+
+	/* ensure all current elements follow new customdata layout */
+	BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+		BM_ITER_ELEM (loop, &liter, efa, BM_LOOPS_OF_FACE) {
+			void *data = CustomData_bmesh_get_n(ldata, loop->head.data, type, n);
+			CustomData_bmesh_set_n(ldata, loop->head.data, type, index, data);
+		}
 	}
 }
 
+int ED_mesh_uv_loop_reset_ex(struct bContext *C, struct Mesh *me, const int layernum)
+{
+	BMEditMesh *em = me->edit_btmesh;
+	MLoopUV *luv;
+	BLI_array_declare(polylengths);
+	int *polylengths = NULL;
+	BLI_array_declare(uvs);
+	float **uvs = NULL;
+	float **fuvs = NULL;
+	int i, j;
+
+	if (em) {
+		/* Collect BMesh UVs */
+
+		BMFace *efa;
+		BMLoop *l;
+		BMIter iter, liter;
+
+		BLI_assert(CustomData_has_layer(&em->bm->ldata, CD_MLOOPUV));
+
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			if (!BM_elem_flag_test(efa, BM_ELEM_SELECT))
+				continue;
+
+			i = 0;
+			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+				luv = CustomData_bmesh_get_n(&em->bm->ldata, l->head.data, CD_MLOOPUV, layernum);
+				BLI_array_append(uvs, luv->uv);
+				i++;
+			}
+
+			BLI_array_append(polylengths, efa->len);
+		}
+	}
+	else {
+		/* Collect Mesh UVs */
+
+		MPoly *mp;
+		MLoopUV *mloouv;
+
+		BLI_assert(CustomData_has_layer(&me->ldata, CD_MLOOPUV));
+		mloouv = CustomData_get_layer_n(&me->ldata, CD_MLOOPUV, layernum);
+
+		for (j = 0; j < me->totpoly; j++) {
+			mp = &me->mpoly[j];
+
+			for (i = 0; i < mp->totloop; i++) {
+				luv = &mloouv[mp->loopstart + i];
+				BLI_array_append(uvs, luv->uv);
+			}
+
+			BLI_array_append(polylengths, mp->totloop);
+		}
+	}
+
+	fuvs = uvs;
+	for (j = 0; j < BLI_array_count(polylengths); j++) {
+		int len = polylengths[j];
+
+		if (len == 3) {
+			fuvs[0][0] = 0.0;
+			fuvs[0][1] = 0.0;
+			
+			fuvs[1][0] = 1.0;
+			fuvs[1][1] = 0.0;
+
+			fuvs[2][0] = 1.0;
+			fuvs[2][1] = 1.0;
+		}
+		else if (len == 4) {
+			fuvs[0][0] = 0.0;
+			fuvs[0][1] = 0.0;
+			
+			fuvs[1][0] = 1.0;
+			fuvs[1][1] = 0.0;
+
+			fuvs[2][0] = 1.0;
+			fuvs[2][1] = 1.0;
+
+			fuvs[3][0] = 0.0;
+			fuvs[3][1] = 1.0;
+			/*make sure we ignore 2-sided faces*/
+		}
+		else if (len > 2) {
+			float fac = 0.0f, dfac = 1.0f / (float)len;
+
+			dfac *= M_PI * 2;
+
+			for (i = 0; i < len; i++) {
+				fuvs[i][0] = 0.5f * sin(fac) + 0.5f;
+				fuvs[i][1] = 0.5f * cos(fac) + 0.5f;
+
+				fac += dfac;
+			}
+		}
+
+		fuvs += len;
+	}
+
+	BLI_array_free(uvs);
+	BLI_array_free(polylengths);
+
+	DAG_id_tag_update(&me->id, 0);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
+
+	return 1;
+}
+
+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);
+}
+
+/* note: keep in sync with ED_mesh_color_add */
 int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_set)
 {
-	EditMesh *em;
+	BMEditMesh *em;
 	int layernum;
 
-	if(me->edit_mesh) {
-		em= me->edit_mesh;
+	short is_init = FALSE;
 
-		layernum= CustomData_number_of_layers(&em->fdata, CD_MTFACE);
-		if(layernum >= MAX_MTFACE)
-			return -1;
+	if (me->edit_btmesh) {
+		em = me->edit_btmesh;
 
-		EM_add_data_layer(em, &em->fdata, CD_MTFACE, name);
+		layernum = CustomData_number_of_layers(&em->bm->pdata, CD_MTEXPOLY);
+		if (layernum >= MAX_MTFACE)
+			return -1;
 
-		if(layernum) /* copy data from active UV */
-			copy_editface_active_customdata(em, CD_MTFACE, layernum);
+		/* CD_MTEXPOLY */
+		BM_data_layer_add_named(em->bm, &em->bm->pdata, CD_MTEXPOLY, name);
+		/* copy data from active UV */
+		if (layernum) {
+			editmesh_face_copy_customdata(em, CD_MTEXPOLY, layernum);
+		}
+		if (active_set || layernum == 0) {
+			CustomData_set_layer_active(&em->bm->pdata, CD_MTEXPOLY, layernum);
+		}
 
-		if(active_set || layernum==0)
-			CustomData_set_layer_active(&em->fdata, CD_MTFACE, layernum);
+		/* CD_MLOOPUV */
+		BM_data_layer_add_named(em->bm, &em->bm->ldata, CD_MLOOPUV, name);
+		/* copy data from active UV */
+		if (layernum) {
+			editmesh_loop_copy_customdata(em, CD_MLOOPUV, layernum);
+			is_init = TRUE;
+		}
+		if (active_set || layernum == 0) {
+			CustomData_set_layer_active(&em->bm->ldata, CD_MLOOPUV, layernum);
+		}
 	}
 	else {
-		layernum= CustomData_number_of_layers(&me->fdata, CD_MTFACE);
-		if(layernum >= MAX_MTFACE)
+		layernum = CustomData_number_of_layers(&me->pdata, CD_MTEXPOLY);
+		if (layernum >= MAX_MTFACE)
 			return -1;
 
-		if(me->mtface)
+		if (me->mtpoly) {
+			CustomData_add_layer_named(&me->pdata, CD_MTEXPOLY, CD_DUPLICATE, me->mtpoly, me->totpoly, name);
+			CustomData_add_layer_named(&me->ldata, CD_MLOOPUV, CD_DUPLICATE, me->mloopuv, me->totloop, name);
 			CustomData_add_layer_named(&me->fdata, CD_MTFACE, CD_DUPLICATE, me->mtface, me->totface, name);
-		else
+			is_init = TRUE;
+		}
+		else {
+			CustomData_add_layer_named(&me->pdata, CD_MTEXPOLY, CD_DEFAULT, NULL, me->totpoly, name);
+			CustomData_add_layer_named(&me->ldata, CD_MLOOPUV, CD_DEFAULT, NULL, me->totloop, name);
 			CustomData_add_layer_named(&me->fdata, CD_MTFACE, CD_DEFAULT, NULL, me->totface, name);
+		}
+		
+		if (active_set || layernum == 0) {
+			CustomData_set_layer_active(&me->pdata, CD_MTEXPOLY, layernum);
+			CustomData_set_layer_active(&me->ldata, CD_MLOOPUV, layernum);
 
-		if(active_set || layernum==0)
 			CustomData_set_layer_active(&me->fdata, CD_MTFACE, layernum);
+		}
 
-		mesh_update_customdata_pointers(me);
+		mesh_update_customdata_pointers(me, TRUE);
+	}
+
+	/* don't overwrite our copied coords */
+	if (is_init == FALSE) {
+		ED_mesh_uv_loop_reset_ex(C, me, layernum);
 	}
 
 	DAG_id_tag_update(&me->id, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
 
 	return layernum;
 }
 
 int ED_mesh_uv_texture_remove(bContext *C, Object *ob, Mesh *me)
 {
-	CustomData *data= (me->edit_mesh)? &me->edit_mesh->fdata: &me->fdata;
-	CustomDataLayer *cdl;
+	CustomData *pdata = GET_CD_DATA(me, pdata), *ldata = GET_CD_DATA(me, ldata);
+	CustomDataLayer *cdlp, *cdlu;
 	int index;
 
-	index= CustomData_get_active_layer_index(data, CD_MTFACE);
-	cdl= (index == -1) ? NULL: &data->layers[index];
+	index = CustomData_get_active_layer_index(pdata, CD_MTEXPOLY);
+	cdlp = (index == -1) ? NULL : &pdata->layers[index];
 
-	if(!cdl)
+	index = CustomData_get_active_layer_index(ldata, CD_MLOOPUV);
+	cdlu = (index == -1) ? NULL : &ldata->layers[index];
+	
+	if (!cdlp || !cdlu)
 		return 0;
 
-	delete_customdata_layer(C, ob, cdl);
+	delete_customdata_layer(C, ob, cdlp);
+	delete_customdata_layer(C, ob, cdlu);
+	
 	DAG_id_tag_update(&me->id, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
 
 	return 1;
 }
 
+/* note: keep in sync with ED_mesh_uv_texture_add */
 int ED_mesh_color_add(bContext *C, Scene *UNUSED(scene), Object *UNUSED(ob), Mesh *me, const char *name, int active_set)
 {
-	EditMesh *em;
+	BMEditMesh *em;
 	int layernum;
 
-	if(me->edit_mesh) {
-		em= me->edit_mesh;
+	if (me->edit_btmesh) {
+		em = me->edit_btmesh;
 
-		layernum= CustomData_number_of_layers(&em->fdata, CD_MCOL);
-		if(layernum >= MAX_MCOL)
+		layernum = CustomData_number_of_layers(&em->bm->ldata, CD_MLOOPCOL);
+		if (layernum >= MAX_MCOL) {
 			return -1;
+		}
 
-		EM_add_data_layer(em, &em->fdata, CD_MCOL, name);
-
-		if(layernum) /* copy data from active vertex color layer */
-			copy_editface_active_customdata(em, CD_MCOL, layernum);
-
-		if(active_set || layernum==0)
-			CustomData_set_layer_active(&em->fdata, CD_MCOL, layernum);
+		/* CD_MLOOPCOL */
+		BM_data_layer_add_named(em->bm, &em->bm->ldata, CD_MLOOPCOL, name);
+		/* copy data from active vertex color layer */
+		if (layernum) {
+			editmesh_loop_copy_customdata(em, CD_MLOOPCOL, layernum);
+		}
+		if (active_set || layernum == 0) {
+			CustomData_set_layer_active(&em->bm->ldata, CD_MLOOPCOL, layernum);
+		}
 	}
 	else {
-		layernum= CustomData_number_of_layers(&me->fdata, CD_MCOL);
-		if(layernum >= MAX_MCOL)
+		layernum = CustomData_number_of_layers(&me->ldata, CD_MLOOPCOL);
+		if (layernum >= CD_MLOOPCOL) {
 			return -1;
+		}
 
-		if(me->mcol)
+		if (me->mloopcol) {
+			CustomData_add_layer_named(&me->ldata, CD_MLOOPCOL, CD_DUPLICATE, me->mloopcol, me->totloop, name);
 			CustomData_add_layer_named(&me->fdata, CD_MCOL, CD_DUPLICATE, me->mcol, me->totface, name);
-		else
+		}
+		else {
+			CustomData_add_layer_named(&me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, me->totloop, name);
 			CustomData_add_layer_named(&me->fdata, CD_MCOL, CD_DEFAULT, NULL, me->totface, name);
+		}
 
-		if(active_set || layernum==0)
+		if (active_set || layernum == 0) {
+			CustomData_set_layer_active(&me->ldata, CD_MLOOPCOL, layernum);
 			CustomData_set_layer_active(&me->fdata, CD_MCOL, layernum);
+		}
 
-		mesh_update_customdata_pointers(me);
+		mesh_update_customdata_pointers(me, TRUE);
 	}
 
 	DAG_id_tag_update(&me->id, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
 
 	return layernum;
 }
 
 int ED_mesh_color_remove(bContext *C, Object *ob, Mesh *me)
 {
-	CustomData *data= (me->edit_mesh)? &me->edit_mesh->fdata: &me->fdata;
+	CustomData *ldata = GET_CD_DATA(me, ldata);
 	CustomDataLayer *cdl;
 	int index;
 
-	index= CustomData_get_active_layer_index(data, CD_MCOL);
-	cdl= (index == -1)? NULL: &data->layers[index];
+	index = CustomData_get_active_layer_index(ldata, CD_MLOOPCOL);
+	cdl = (index == -1) ? NULL : &ldata->layers[index];
 
-	if(!cdl)
+	if (!cdl)
 		return 0;
 
 	delete_customdata_layer(C, ob, cdl);
 	DAG_id_tag_update(&me->id, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
 
 	return 1;
 }
 
 int ED_mesh_color_remove_named(bContext *C, Object *ob, Mesh *me, const char *name)
 {
-	CustomData *data= (me->edit_mesh)? &me->edit_mesh->fdata: &me->fdata;
+	CustomData *ldata = GET_CD_DATA(me, ldata);
 	CustomDataLayer *cdl;
 	int index;
 
-	index= CustomData_get_named_layer_index(data, CD_MCOL, name);
-	cdl= (index == -1)? NULL: &data->layers[index];
+	index = CustomData_get_named_layer_index(ldata, CD_MLOOPCOL, name);
+	cdl = (index == -1) ? NULL : &ldata->layers[index];
 
-	if(!cdl)
+	if (!cdl)
 		return 0;
 
 	delete_customdata_layer(C, ob, cdl);
 	DAG_id_tag_update(&me->id, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
 
 	return 1;
 }
@@ -318,17 +534,17 @@ int ED_mesh_color_remove_named(bContext *C, Object *ob, Mesh *me, const char *na
 
 static int layers_poll(bContext *C)
 {
-	Object *ob= ED_object_context(C);
-	ID *data= (ob)? ob->data: NULL;
-	return (ob && !ob->id.lib && ob->type==OB_MESH && data && !data->lib);
+	Object *ob = ED_object_context(C);
+	ID *data = (ob) ? ob->data : NULL;
+	return (ob && !ob->id.lib && ob->type == OB_MESH && data && !data->lib);
 }
 
-static int uv_texture_add_exec(bContext *C, wmOperator *UNUSED(op))
+static int mesh_uv_texture_add_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Object *ob= ED_object_context(C);
-	Mesh *me= ob->data;
+	Object *ob = ED_object_context(C);
+	Mesh *me = ob->data;
 
-	if(ED_mesh_uv_texture_add(C, me, NULL, TRUE) == -1)
+	if (ED_mesh_uv_texture_add(C, me, NULL, TRUE) == -1)
 		return OPERATOR_CANCELLED;
 
 	return OPERATOR_FINISHED;
@@ -337,72 +553,71 @@ static int uv_texture_add_exec(bContext *C, wmOperator *UNUSED(op))
 void MESH_OT_uv_texture_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add UV Map";
-	ot->description= "Add UV Map";
-	ot->idname= "MESH_OT_uv_texture_add";
+	ot->name = "Add UV Map";
+	ot->description = "Add UV Map";
+	ot->idname = "MESH_OT_uv_texture_add";
 	
 	/* api callbacks */
-	ot->poll= layers_poll;
-	ot->exec= uv_texture_add_exec;
+	ot->poll = layers_poll;
+	ot->exec = mesh_uv_texture_add_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	Main *bmain= CTX_data_main(C);
-	Scene *scene= CTX_data_scene(C);
-	View3D *v3d= CTX_wm_view3d(C);
-	Base *base= ED_view3d_give_base_under_cursor(C, event->mval);
-	Image *ima= NULL;
+	Main *bmain = CTX_data_main(C);
+	Scene *scene = CTX_data_scene(C);
+	View3D *v3d = CTX_wm_view3d(C);
+	Base *base = ED_view3d_give_base_under_cursor(C, event->mval);
+	Image *ima = NULL;
 	Mesh *me;
 	Object *obedit;
-	int exitmode= 0;
-	char name[MAX_ID_NAME-2];
+	int exitmode = 0;
+	char name[MAX_ID_NAME - 2];
 	
 	/* Check context */
-	if(base==NULL || base->object->type!=OB_MESH) {
+	if (base == NULL || base->object->type != OB_MESH) {
 		BKE_report(op->reports, RPT_ERROR, "Not an Object or Mesh");
 		return OPERATOR_CANCELLED;
 	}
 	
 	/* check input variables */
-	if(RNA_struct_property_is_set(op->ptr, "filepath")) {
+	if (RNA_struct_property_is_set(op->ptr, "filepath")) {
 		char path[FILE_MAX];
 		
 		RNA_string_get(op->ptr, "filepath", path);
-		ima= BKE_add_image_file(path);
+		ima = BKE_add_image_file(path);
 	}
 	else {
 		RNA_string_get(op->ptr, "name", name);
-		ima= (Image *)find_id("IM", name);
+		ima = (Image *)find_id("IM", name);
 	}
 	
-	if(!ima) {
+	if (!ima) {
 		BKE_report(op->reports, RPT_ERROR, "Not an Image");
 		return OPERATOR_CANCELLED;
 	}
 	
-	/* turn mesh in editmode */
-	/* BKE_mesh_get/end_editmesh: ED_uvedit_assign_image also calls this */
+	/* put mesh in editmode */
 
-	obedit= base->object;
-	me= obedit->data;
-	if(me->edit_mesh==NULL) {
-		make_editMesh(scene, obedit);
-		exitmode= 1;
+	obedit = base->object;
+	me = obedit->data;
+	if (me->edit_btmesh == NULL) {
+		EDBM_mesh_make(scene->toolsettings, scene, obedit);
+		exitmode = 1;
 	}
-	if(me->edit_mesh==NULL)
+	if (me->edit_btmesh == NULL)
 		return OPERATOR_CANCELLED;
 	
 	ED_uvedit_assign_image(bmain, scene, obedit, ima, NULL);
 
-	if(exitmode) {
-		load_editMesh(scene, obedit);
-		free_editMesh(me->edit_mesh);
-		MEM_freeN(me->edit_mesh);
-		me->edit_mesh= NULL;
+	if (exitmode) {
+		EDBM_mesh_load(obedit);
+		EDBM_mesh_free(me->edit_btmesh);
+		MEM_freeN(me->edit_btmesh);
+		me->edit_btmesh = NULL;
 
 		/* load_editMesh free's pointers used by CustomData layers which might be used by DerivedMesh too,
 		 * so signal to re-create DerivedMesh here (sergey) */
@@ -410,10 +625,10 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	}
 
 	/* dummie drop support; ensure view shows a result :) */
-	if(v3d)
+	if (v3d)
 		v3d->flag2 |= V3D_SOLID_TEX;
 	
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 	
 	return OPERATOR_FINISHED;
 }
@@ -421,28 +636,28 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
 void MESH_OT_drop_named_image(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Assign Image to UV Map";
-	ot->description= "Assign Image to active UV Map, or create an UV Map";
-	ot->idname= "MESH_OT_drop_named_image";
+	ot->name = "Assign Image to UV Map";
+	ot->description = "Assign Image to active UV Map, or create an UV Map";
+	ot->idname = "MESH_OT_drop_named_image";
 	
 	/* api callbacks */
-	ot->poll= layers_poll;
-	ot->invoke= drop_named_image_invoke;
+	ot->poll = layers_poll;
+	ot->invoke = drop_named_image_invoke;
 	
 	/* flags */
-	ot->flag= OPTYPE_UNDO;
+	ot->flag = OPTYPE_UNDO;
 	
 	/* properties */
-	RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME-2, "Name", "Image name to assign");
+	RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME - 2, "Name", "Image name to assign");
 	RNA_def_string(ot->srna, "filepath", "Path", FILE_MAX, "Filepath", "Path to image file");
 }
 
-static int uv_texture_remove_exec(bContext *C, wmOperator *UNUSED(op))
+static int mesh_uv_texture_remove_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Object *ob= ED_object_context(C);
-	Mesh *me= ob->data;
+	Object *ob = ED_object_context(C);
+	Mesh *me = ob->data;
 
-	if(!ED_mesh_uv_texture_remove(C, ob, me))
+	if (!ED_mesh_uv_texture_remove(C, ob, me))
 		return OPERATOR_CANCELLED;
 
 	return OPERATOR_FINISHED;
@@ -451,27 +666,27 @@ static int uv_texture_remove_exec(bContext *C, wmOperator *UNUSED(op))
 void MESH_OT_uv_texture_remove(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove UV Map";
-	ot->description= "Remove UV Map";
-	ot->idname= "MESH_OT_uv_texture_remove";
+	ot->name = "Remove UV Map";
+	ot->description = "Remove UV Map";
+	ot->idname = "MESH_OT_uv_texture_remove";
 	
 	/* api callbacks */
-	ot->poll= layers_poll;
-	ot->exec= uv_texture_remove_exec;
+	ot->poll = layers_poll;
+	ot->exec = mesh_uv_texture_remove_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /*********************** vertex color operators ************************/
 
-static int vertex_color_add_exec(bContext *C, wmOperator *UNUSED(op))
+static int mesh_vertex_color_add_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
-	Object *ob= ED_object_context(C);
-	Mesh *me= ob->data;
+	Scene *scene = CTX_data_scene(C);
+	Object *ob = ED_object_context(C);
+	Mesh *me = ob->data;
 
-	if(ED_mesh_color_add(C, scene, ob, me, NULL, TRUE) == -1)
+	if (ED_mesh_color_add(C, scene, ob, me, NULL, TRUE) == -1)
 		return OPERATOR_CANCELLED;
 
 	return OPERATOR_FINISHED;
@@ -480,24 +695,24 @@ static int vertex_color_add_exec(bContext *C, wmOperator *UNUSED(op))
 void MESH_OT_vertex_color_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Vertex Color";
-	ot->description= "Add vertex color layer";
-	ot->idname= "MESH_OT_vertex_color_add";
+	ot->name = "Add Vertex Color";
+	ot->description = "Add vertex color layer";
+	ot->idname = "MESH_OT_vertex_color_add";
 	
 	/* api callbacks */
-	ot->poll= layers_poll;
-	ot->exec= vertex_color_add_exec;
+	ot->poll = layers_poll;
+	ot->exec = mesh_vertex_color_add_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
-static int vertex_color_remove_exec(bContext *C, wmOperator *UNUSED(op))
+static int mesh_vertex_color_remove_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Object *ob= ED_object_context(C);
-	Mesh *me= ob->data;
+	Object *ob = ED_object_context(C);
+	Mesh *me = ob->data;
 
-	if(!ED_mesh_color_remove(C, ob, me))
+	if (!ED_mesh_color_remove(C, ob, me))
 		return OPERATOR_CANCELLED;
 
 	return OPERATOR_FINISHED;
@@ -506,34 +721,37 @@ static int vertex_color_remove_exec(bContext *C, wmOperator *UNUSED(op))
 void MESH_OT_vertex_color_remove(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove Vertex Color";
-	ot->description= "Remove vertex color layer";
-	ot->idname= "MESH_OT_vertex_color_remove";
+	ot->name = "Remove Vertex Color";
+	ot->description = "Remove vertex color layer";
+	ot->idname = "MESH_OT_vertex_color_remove";
 	
 	/* api callbacks */
-	ot->exec= vertex_color_remove_exec;
-	ot->poll= layers_poll;
+	ot->exec = mesh_vertex_color_remove_exec;
+	ot->poll = layers_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /*********************** sticky operators ************************/
 
-static int sticky_add_exec(bContext *C, wmOperator *UNUSED(op))
+static int mesh_sticky_add_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
-	View3D *v3d= CTX_wm_view3d(C);
-	Object *ob= ED_object_context(C);
-	Mesh *me= ob->data;
+	Scene *scene = CTX_data_scene(C);
+	View3D *v3d = CTX_wm_view3d(C);
+	Object *ob = ED_object_context(C);
+	Mesh *me = ob->data;
 
-	/*if(me->msticky)
-		return OPERATOR_CANCELLED;*/
+	/* why is this commented out? */
+#if 0
+	if (me->msticky)
+		return OPERATOR_CANCELLED;
+#endif
 
 	RE_make_sticky(scene, v3d);
 
 	DAG_id_tag_update(&me->id, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
 
 	return OPERATOR_FINISHED;
 }
@@ -541,31 +759,31 @@ static int sticky_add_exec(bContext *C, wmOperator *UNUSED(op))
 void MESH_OT_sticky_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Sticky";
-	ot->description= "Add sticky UV texture layer";
-	ot->idname= "MESH_OT_sticky_add";
+	ot->name = "Add Sticky";
+	ot->description = "Add sticky UV texture layer";
+	ot->idname = "MESH_OT_sticky_add";
 	
 	/* api callbacks */
-	ot->poll= layers_poll;
-	ot->exec= sticky_add_exec;
+	ot->poll = layers_poll;
+	ot->exec = mesh_sticky_add_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
-static int sticky_remove_exec(bContext *C, wmOperator *UNUSED(op))
+static int mesh_sticky_remove_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Object *ob= ED_object_context(C);
-	Mesh *me= ob->data;
+	Object *ob = ED_object_context(C);
+	Mesh *me = ob->data;
 
-	if(!me->msticky)
+	if (!me->msticky)
 		return OPERATOR_CANCELLED;
 
 	CustomData_free_layer_active(&me->vdata, CD_MSTICKY, me->totvert);
-	me->msticky= NULL;
+	me->msticky = NULL;
 
 	DAG_id_tag_update(&me->id, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
 
 	return OPERATOR_FINISHED;
 }
@@ -573,29 +791,71 @@ static int sticky_remove_exec(bContext *C, wmOperator *UNUSED(op))
 void MESH_OT_sticky_remove(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove Sticky";
-	ot->description= "Remove sticky UV texture layer";
-	ot->idname= "MESH_OT_sticky_remove";
+	ot->name = "Remove Sticky";
+	ot->description = "Remove sticky UV texture layer";
+	ot->idname = "MESH_OT_sticky_remove";
 	
 	/* api callbacks */
-	ot->poll= layers_poll;
-	ot->exec= sticky_remove_exec;
+	ot->poll = layers_poll;
+	ot->exec = mesh_sticky_remove_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /************************** Add Geometry Layers *************************/
 
-void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges)
+void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges, int calc_tessface)
 {
-	if(calc_edges || (mesh->totface && mesh->totedge == 0))
+	int *polyindex = NULL;
+	float (*face_nors)[3];
+	int tessface_input = FALSE;
+
+	if (mesh->totface > 0 && mesh->totpoly == 0) {
+		BKE_mesh_convert_mfaces_to_mpolys(mesh);
+
+		/* would only be converting back again, don't bother */
+		tessface_input = TRUE;
+	}
+
+	if (calc_edges || ((mesh->totpoly || mesh->totface) && mesh->totedge == 0))
 		BKE_mesh_calc_edges(mesh, calc_edges);
 
-	mesh_calc_normals(mesh->mvert, mesh->totvert, mesh->mface, mesh->totface, NULL);
+	if (calc_tessface) {
+		if (tessface_input == FALSE) {
+			BKE_mesh_tessface_calc(mesh);
+		}
+	}
+	else {
+		/* default state is not to have tessface's so make sure this is the case */
+		BKE_mesh_tessface_clear(mesh);
+	}
+
+	/* note on this if/else - looks like these layers are not needed
+	 * 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);
+	/* 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);
+
+	mesh_calc_normals_mapping_ex(mesh->mvert, mesh->totvert,
+	                             mesh->mloop, mesh->mpoly,
+	                             mesh->totloop, mesh->totpoly,
+	                             NULL /* polyNors_r */,
+	                             mesh->mface, mesh->totface,
+	                             polyindex, face_nors, FALSE);
+#else
+	mesh_calc_normals(mesh->mvert, mesh->totvert,
+	                  mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly,
+	                  NULL);
+	(void)polyindex;
+	(void)face_nors;
+#endif
 
 	DAG_id_tag_update(&mesh->id, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, mesh);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, mesh);
 }
 
 static void mesh_add_verts(Mesh *mesh, int len)
@@ -604,39 +864,39 @@ static void mesh_add_verts(Mesh *mesh, int len)
 	MVert *mvert;
 	int i, totvert;
 
-	if(len == 0)
+	if (len == 0)
 		return;
 
-	totvert= mesh->totvert + len;
+	totvert = mesh->totvert + len;
 	CustomData_copy(&mesh->vdata, &vdata, CD_MASK_MESH, CD_DEFAULT, totvert);
 	CustomData_copy_data(&mesh->vdata, &vdata, 0, 0, mesh->totvert);
 
-	if(!CustomData_has_layer(&vdata, CD_MVERT))
+	if (!CustomData_has_layer(&vdata, CD_MVERT))
 		CustomData_add_layer(&vdata, CD_MVERT, CD_CALLOC, NULL, totvert);
 
 	CustomData_free(&mesh->vdata, mesh->totvert);
-	mesh->vdata= vdata;
-	mesh_update_customdata_pointers(mesh);
+	mesh->vdata = vdata;
+	mesh_update_customdata_pointers(mesh, FALSE);
 
 	/* scan the input list and insert the new vertices */
 
-	mvert= &mesh->mvert[mesh->totvert];
-	for(i=0; i<len; i++, mvert++)
+	mvert = &mesh->mvert[mesh->totvert];
+	for (i = 0; i < len; i++, mvert++)
 		mvert->flag |= SELECT;
 
 	/* set final vertex list size */
-	mesh->totvert= totvert;
+	mesh->totvert = totvert;
 }
 
 void ED_mesh_transform(Mesh *me, float *mat)
 {
 	int i;
-	MVert *mvert= me->mvert;
+	MVert *mvert = me->mvert;
 
-	for(i= 0; i < me->totvert; i++, mvert++)
+	for (i = 0; i < me->totvert; i++, mvert++)
 		mul_m4_v3((float (*)[4])mat, mvert->co);
 
-	mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
+	/* don't update normals, caller can do this explicitly */
 }
 
 static void mesh_add_edges(Mesh *mesh, int len)
@@ -645,130 +905,189 @@ static void mesh_add_edges(Mesh *mesh, int len)
 	MEdge *medge;
 	int i, totedge;
 
-	if(len == 0)
+	if (len == 0)
 		return;
 
-	totedge= mesh->totedge+len;
+	totedge = mesh->totedge + len;
 
 	/* update customdata  */
 	CustomData_copy(&mesh->edata, &edata, CD_MASK_MESH, CD_DEFAULT, totedge);
 	CustomData_copy_data(&mesh->edata, &edata, 0, 0, mesh->totedge);
 
-	if(!CustomData_has_layer(&edata, CD_MEDGE))
+	if (!CustomData_has_layer(&edata, CD_MEDGE))
 		CustomData_add_layer(&edata, CD_MEDGE, CD_CALLOC, NULL, totedge);
 
 	CustomData_free(&mesh->edata, mesh->totedge);
-	mesh->edata= edata;
-	mesh_update_customdata_pointers(mesh);
+	mesh->edata = edata;
+	mesh_update_customdata_pointers(mesh, FALSE); /* new edges don't change tessellation */
 
 	/* set default flags */
-	medge= &mesh->medge[mesh->totedge];
-	for(i=0; i<len; i++, medge++)
-		medge->flag= ME_EDGEDRAW|ME_EDGERENDER|SELECT;
+	medge = &mesh->medge[mesh->totedge];
+	for (i = 0; i < len; i++, medge++)
+		medge->flag = ME_EDGEDRAW | ME_EDGERENDER | SELECT;
 
-	mesh->totedge= totedge;
+	mesh->totedge = totedge;
 }
 
-static void mesh_add_faces(Mesh *mesh, int len)
+static void mesh_add_tessfaces(Mesh *mesh, int len)
 {
 	CustomData fdata;
 	MFace *mface;
 	int i, totface;
 
-	if(len == 0)
+	if (len == 0)
 		return;
 
-	totface= mesh->totface + len;	/* new face count */
+	totface = mesh->totface + len;   /* new face count */
 
 	/* update customdata */
 	CustomData_copy(&mesh->fdata, &fdata, CD_MASK_MESH, CD_DEFAULT, totface);
 	CustomData_copy_data(&mesh->fdata, &fdata, 0, 0, mesh->totface);
 
-	if(!CustomData_has_layer(&fdata, CD_MFACE))
+	if (!CustomData_has_layer(&fdata, CD_MFACE))
 		CustomData_add_layer(&fdata, CD_MFACE, CD_CALLOC, NULL, totface);
 
 	CustomData_free(&mesh->fdata, mesh->totface);
-	mesh->fdata= fdata;
-	mesh_update_customdata_pointers(mesh);
+	mesh->fdata = fdata;
+	mesh_update_customdata_pointers(mesh, TRUE);
 
 	/* set default flags */
-	mface= &mesh->mface[mesh->totface];
-	for(i=0; i<len; i++, mface++)
-		mface->flag= ME_FACE_SEL;
+	mface = &mesh->mface[mesh->totface];
+	for (i = 0; i < len; i++, mface++)
+		mface->flag = ME_FACE_SEL;
 
-	mesh->totface= totface;
+	mesh->totface = totface;
+}
+
+static void mesh_add_loops(Mesh *mesh, int len)
+{
+	CustomData ldata;
+	int totloop;
+
+	if (len == 0)
+		return;
+
+	totloop = mesh->totloop + len;   /* new face count */
+
+	/* update customdata */
+	CustomData_copy(&mesh->ldata, &ldata, CD_MASK_MESH, CD_DEFAULT, totloop);
+	CustomData_copy_data(&mesh->ldata, &ldata, 0, 0, mesh->totloop);
+
+	if (!CustomData_has_layer(&ldata, CD_MLOOP))
+		CustomData_add_layer(&ldata, CD_MLOOP, CD_CALLOC, NULL, totloop);
+
+	CustomData_free(&mesh->ldata, mesh->totloop);
+	mesh->ldata = ldata;
+	mesh_update_customdata_pointers(mesh, TRUE);
+
+	mesh->totloop = totloop;
+}
+
+static void mesh_add_polys(Mesh *mesh, int len)
+{
+	CustomData pdata;
+	MPoly *mpoly;
+	int i, totpoly;
+
+	if (len == 0)
+		return;
+
+	totpoly = mesh->totpoly + len;   /* new face count */
+
+	/* update customdata */
+	CustomData_copy(&mesh->pdata, &pdata, CD_MASK_MESH, CD_DEFAULT, totpoly);
+	CustomData_copy_data(&mesh->pdata, &pdata, 0, 0, mesh->totpoly);
+
+	if (!CustomData_has_layer(&pdata, CD_MPOLY))
+		CustomData_add_layer(&pdata, CD_MPOLY, CD_CALLOC, NULL, totpoly);
+
+	CustomData_free(&mesh->pdata, mesh->totpoly);
+	mesh->pdata = pdata;
+	mesh_update_customdata_pointers(mesh, TRUE);
+
+	/* set default flags */
+	mpoly = &mesh->mpoly[mesh->totpoly];
+	for (i = 0; i < len; i++, mpoly++)
+		mpoly->flag = ME_FACE_SEL;
+
+	mesh->totpoly = totpoly;
 }
 
 static void mesh_remove_verts(Mesh *mesh, int len)
 {
 	int totvert;
 
-	if(len == 0)
+	if (len == 0)
 		return;
 
-	totvert= mesh->totvert - len;
+	totvert = mesh->totvert - len;
 	CustomData_free_elem(&mesh->vdata, totvert, len);
 
 	/* set final vertex list size */
-	mesh->totvert= totvert;
+	mesh->totvert = totvert;
 }
 
 static void mesh_remove_edges(Mesh *mesh, int len)
 {
 	int totedge;
 
-	if(len == 0)
+	if (len == 0)
 		return;
 
-	totedge= mesh->totedge - len;
+	totedge = mesh->totedge - len;
 	CustomData_free_elem(&mesh->edata, totedge, len);
 
-	mesh->totedge= totedge;
+	mesh->totedge = totedge;
 }
 
 static void mesh_remove_faces(Mesh *mesh, int len)
 {
 	int totface;
 
-	if(len == 0)
+	if (len == 0)
 		return;
 
-	totface= mesh->totface - len;	/* new face count */
+	totface = mesh->totface - len;   /* new face count */
 	CustomData_free_elem(&mesh->fdata, totface, len);
 
-	mesh->totface= totface;
+	mesh->totface = totface;
 }
 
-/*
+#if 0
 void ED_mesh_geometry_add(Mesh *mesh, ReportList *reports, int verts, int edges, int faces)
 {
-	if(mesh->edit_mesh) {
+	if (mesh->edit_btmesh) {
 		BKE_report(reports, RPT_ERROR, "Can't add geometry in edit mode");
 		return;
 	}
 
-	if(verts)
+	if (verts)
 		mesh_add_verts(mesh, verts);
-	if(edges)
+	if (edges)
 		mesh_add_edges(mesh, edges);
-	if(faces)
+	if (faces)
 		mesh_add_faces(mesh, faces);
 }
-*/
+#endif
 
-void ED_mesh_faces_add(Mesh *mesh, ReportList *reports, int count)
+void ED_mesh_tessfaces_add(Mesh *mesh, ReportList *reports, int count)
 {
-	if(mesh->edit_mesh) {
-		BKE_report(reports, RPT_ERROR, "Can't add faces in edit mode");
+	if (mesh->edit_btmesh) {
+		BKE_report(reports, RPT_ERROR, "Can't add tessfaces in edit mode");
 		return;
 	}
 
-	mesh_add_faces(mesh, count);
+	if (mesh->mpoly) {
+		BKE_report(reports, RPT_ERROR, "Can't add tessfaces to a mesh that already has polygons");
+		return;
+	}
+
+	mesh_add_tessfaces(mesh, count);
 }
 
 void ED_mesh_edges_add(Mesh *mesh, ReportList *reports, int count)
 {
-	if(mesh->edit_mesh) {
+	if (mesh->edit_btmesh) {
 		BKE_report(reports, RPT_ERROR, "Can't add edges in edit mode");
 		return;
 	}
@@ -778,7 +1097,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_mesh) {
+	if (mesh->edit_btmesh) {
 		BKE_report(reports, RPT_ERROR, "Can't add vertices in edit mode");
 		return;
 	}
@@ -788,11 +1107,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_mesh) {
+	if (mesh->edit_btmesh) {
 		BKE_report(reports, RPT_ERROR, "Can't remove faces in edit mode");
 		return;
 	}
-	else if(count > mesh->totface) {
+	else if (count > mesh->totface) {
 		BKE_report(reports, RPT_ERROR, "Can't remove more faces than the mesh contains");
 		return;
 	}
@@ -802,11 +1121,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_mesh) {
+	if (mesh->edit_btmesh) {
 		BKE_report(reports, RPT_ERROR, "Can't remove edges in edit mode");
 		return;
 	}
-	else if(count > mesh->totedge) {
+	else if (count > mesh->totedge) {
 		BKE_report(reports, RPT_ERROR, "Can't remove more edges than the mesh contains");
 		return;
 	}
@@ -816,11 +1135,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_mesh) {
+	if (mesh->edit_btmesh) {
 		BKE_report(reports, RPT_ERROR, "Can't remove vertices in edit mode");
 		return;
 	}
-	else if(count > mesh->totvert) {
+	else if (count > mesh->totvert) {
 		BKE_report(reports, RPT_ERROR, "Can't remove more vertices than the mesh contains");
 		return;
 	}
@@ -828,7 +1147,45 @@ void ED_mesh_vertices_remove(Mesh *mesh, ReportList *reports, int count)
 	mesh_remove_verts(mesh, count);
 }
 
-void ED_mesh_calc_normals(Mesh *me)
+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.");
+		return;
+	}
+
+	mesh_add_loops(mesh, count);
+}
+
+void ED_mesh_polys_add(Mesh *mesh, ReportList *reports, int count)
 {
-	mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
+	if (mesh->edit_btmesh) {
+		BKE_report(reports, RPT_ERROR, "Can't add polys in edit mode.");
+		return;
+	}
+
+	mesh_add_polys(mesh, count);
+}
+
+void ED_mesh_calc_normals(Mesh *mesh)
+{
+#ifdef USE_BMESH_MPOLY_NORMALS
+	mesh_calc_normals_mapping_ex(mesh->mvert, mesh->totvert,
+	                             mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly,
+	                             NULL, NULL, 0, NULL, NULL, FALSE);
+#else
+	mesh_calc_normals(mesh->mvert, mesh->totvert,
+	                  mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly,
+	                  NULL);
+#endif
+}
+
+void ED_mesh_calc_tessface(Mesh *mesh)
+{
+	if (mesh->edit_btmesh) {
+		BMEdit_RecalcTessellation(mesh->edit_btmesh);
+	}
+	else {
+		BKE_mesh_tessface_calc(mesh);
+	}
 }
diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h
index 91cba8a..70ae970 100644
--- a/source/blender/editors/mesh/mesh_intern.h
+++ b/source/blender/editors/mesh/mesh_intern.h
@@ -32,36 +32,58 @@
 
 /* Internal for editmesh_xxxx.c functions */
 
-#ifndef MESH_INTERN_H
-#define MESH_INTERN_H
-
+#ifndef __MESH_INTERN_H__
+#define __MESH_INTERN_H__
+
+struct BMEdge;
+struct BMEditMesh;
+struct BMFace;
+struct BMHeader;
+struct BMOperator;
+struct BMesh;
+struct EnumPropertyItem;
+struct ViewContext;
 struct bContext;
-struct wmOperatorType;
+struct wmKeyConfig;
+struct wmKeyMap;
 struct wmOperator;
-struct ViewContext;
+struct wmOperatorType;
 
-/* ******************** editface.c */
+/* ******************** editmesh_utils.c */
+
+/*
+ * ok: the EDBM module is for editmode bmesh stuff.  in contrast, the 
+ * BMEdit module is for code shared with blenkernel that concerns
+ * the BMEditMesh structure.
+ */
+
+/*calls a bmesh op, reporting errors to the user, etc*/
+int EDBM_op_callf(struct BMEditMesh *em, struct wmOperator *op, const char *fmt, ...);
 
-int edgetag_context_check(Scene *scene, EditEdge *eed);
-void edgetag_context_set(Scene *scene, EditEdge *eed, int val);
-int edgetag_shortest_path(Scene *scene, EditMesh *em, EditEdge *source, EditEdge *target);
+int EDBM_op_call_and_selectf(struct BMEditMesh *em, struct wmOperator *op,
+                             const char *selectslot, const char *fmt, ...);
 
-/* ******************* editmesh.c */
+/* same as above, but doesn't report errors.*/
+int EDBM_op_call_silentf(struct BMEditMesh *em, const char *fmt, ...);
 
-extern void free_editvert(EditMesh *em, EditVert *eve);
-extern void free_editedge(EditMesh *em, EditEdge *eed);
-extern void free_editface(EditMesh *em, EditFace *efa);
+/* these next two functions are the split version of EDBM_op_callf, so you can
+ * do stuff with a bmesh operator, after initializing it but before executing
+ * it.
+ *
+ * execute the operator with BM_Exec_Op */
+int EDBM_op_init(struct BMEditMesh *em, struct BMOperator *bmop,
+                 struct wmOperator *op, const char *fmt, ...);
+/*cleans up after a bmesh operator*/
+int EDBM_op_finish(struct BMEditMesh *em, struct BMOperator *bmop,
+                   struct wmOperator *op, const int report);
 
-extern void free_vertlist(EditMesh *em, ListBase *edve);
-extern void free_edgelist(EditMesh *em, ListBase *lb);
-extern void free_facelist(EditMesh *em, ListBase *lb);
+void EDBM_flag_disable_all(struct BMEditMesh *em, const char hflag);
+void EDBM_stats_update(struct BMEditMesh *em);
 
-extern void remedge(EditMesh *em, EditEdge *eed);
+/* TODO, move to math_geometry.c */
+float labda_PdistVL2Dfl(const float v1[3], const float v2[3], const float v3[3]);
 
-extern struct EditVert *addvertlist(EditMesh *em, float *vec, struct EditVert *example);
-extern struct EditEdge *addedgelist(EditMesh *em, struct EditVert *v1, struct EditVert *v2, struct EditEdge *example);
-extern struct EditFace *addfacelist(EditMesh *em, struct EditVert *v1, struct EditVert *v2, struct EditVert *v3, struct EditVert *v4, struct EditFace *example, struct EditFace *exampleEdges);
-extern struct EditEdge *findedgelist(EditMesh *em, struct EditVert *v1, struct EditVert *v2);
+/* ******************** editface.c */
 
 void em_setup_viewcontext(struct bContext *C, struct ViewContext *vc);
 
@@ -82,66 +104,18 @@ void MESH_OT_edge_face_add(struct wmOperatorType *ot);
 void MESH_OT_dupli_extrude_cursor(struct wmOperatorType *ot);
 void MESH_OT_duplicate(struct wmOperatorType *ot);
 
-void MESH_OT_fgon_make(struct wmOperatorType *ot);
-void MESH_OT_fgon_clear(struct wmOperatorType *ot);
-
-/* ******************* editmesh_lib.c */
-void EM_stats_update(EditMesh *em);
-
-extern void EM_fgon_flags(EditMesh *em);
-extern void EM_hide_reset(EditMesh *em);
-
-extern int faceselectedOR(EditFace *efa, int flag);
-extern int faceselectedAND(EditFace *efa, int flag);
-
-void EM_remove_selection(EditMesh *em, void *data, int type);
-void EM_clear_flag_all(EditMesh *em, int flag);
-void EM_set_flag_all(EditMesh *em, int flag);
-void EM_set_flag_all_selectmode(EditMesh *em, int flag);
-
-void EM_data_interp_from_verts(EditMesh *em, EditVert *v1, EditVert *v2, EditVert *eve, float fac);
-void EM_data_interp_from_faces(EditMesh *em, EditFace *efa1, EditFace *efa2, EditFace *efan, int i1, int i2, int i3, int i4);
-
-int EM_nvertices_selected(EditMesh *em);
-int EM_nedges_selected(EditMesh *em);
-int EM_nfaces_selected(EditMesh *em);
-
-float EM_face_perimeter(EditFace *efa);
-
-void EM_store_selection(EditMesh *em, void *data, int type);
-
-extern EditFace *exist_face(EditMesh *em, EditVert *v1, EditVert *v2, EditVert *v3, EditVert *v4);
-extern void flipface(EditMesh *em, EditFace *efa); // flips for normal direction
-extern int compareface(EditFace *vl1, EditFace *vl2);
-
-/* flag for selection bits, *nor will be filled with normal for extrusion constraint */
-/* return value defines if such normal was set */
-extern short extrudeflag_face_indiv(EditMesh *em, short flag, float *nor);
-extern short extrudeflag_verts_indiv(EditMesh *em, short flag, float *nor);
-extern short extrudeflag_edges_indiv(EditMesh *em, short flag, float *nor);
-extern short extrudeflag_vert(Object *obedit, EditMesh *em, short flag, float *nor, int all);
-extern short extrudeflag(Object *obedit, EditMesh *em, short flag, float *nor, int all);
-
-extern void adduplicateflag(EditMesh *em, int flag);
-extern void delfaceflag(EditMesh *em, int flag);
-
-extern void rotateflag(EditMesh *em, short flag, float *cent, float rotmat[][3]);
-extern void translateflag(EditMesh *em, short flag, float *vec);
-
-extern int convex(float *v1, float *v2, float *v3, float *v4);
-
-extern struct EditFace *EM_face_from_faces(EditMesh *em, struct EditFace *efa1,
-										   struct EditFace *efa2, int i1, int i2, int i3, int i4);
-
 extern int EM_view3d_poll(struct bContext *C);
 
-/* ******************* editmesh_loop.c */
+struct wmKeyMap* knifetool_modal_keymap(struct wmKeyConfig *keyconf);
+
+/* ******************* knifetool.c */
 
 void MESH_OT_knife_cut(struct wmOperatorType *ot);
 
-/* ******************* editmesh_mods.c */
+/* ******************* bmesh_select.c */
 void MESH_OT_loop_select(struct wmOperatorType *ot);
 void MESH_OT_select_all(struct wmOperatorType *ot);
+void MESH_OT_select_interior_faces(struct wmOperatorType *ot);
 void MESH_OT_select_more(struct wmOperatorType *ot);
 void MESH_OT_select_less(struct wmOperatorType *ot);
 void MESH_OT_select_non_manifold(struct wmOperatorType *ot);
@@ -150,6 +124,7 @@ 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_loose_verts(struct wmOperatorType *ot);
 void MESH_OT_select_mirror(struct wmOperatorType *ot);
 void MESH_OT_normals_make_consistent(struct wmOperatorType *ot);
 void MESH_OT_faces_select_linked_flat(struct wmOperatorType *ot);
@@ -165,52 +140,15 @@ void MESH_OT_noise(struct wmOperatorType *ot);
 void MESH_OT_flip_normals(struct wmOperatorType *ot);
 void MESH_OT_solidify(struct wmOperatorType *ot);
 void MESH_OT_select_nth(struct wmOperatorType *ot);
+void MESH_OT_select_next_loop(struct wmOperatorType *ot);
 
-
-extern EditEdge *findnearestedge(struct ViewContext *vc, int *dist);
-void editmesh_select_by_material(EditMesh *em, int index);
-void EM_recalc_normal_direction(EditMesh *em, int inside, int select);	/* makes faces righthand turning */
-void EM_select_more(EditMesh *em);
-void selectconnected_mesh_all(EditMesh *em);
-void faceloop_select(EditMesh *em, EditEdge *startedge, int select);
-
-/**
- * findnearestvert
- * 
- * dist (in/out): minimal distance to the nearest and at the end, actual distance
- * sel: selection bias
- * 		if SELECT, selected vertice are given a 5 pixel bias to make them farter than unselect verts
- * 		if 0, unselected vertice are given the bias
- * strict: if 1, the vertice corresponding to the sel parameter are ignored and not just biased 
- */
-extern EditVert *findnearestvert(struct ViewContext *vc, int *dist, short sel, short strict);
-
-
-/* ******************* editmesh_tools.c */
-
-#define SUBDIV_SELECT_ORIG      0
-#define SUBDIV_SELECT_INNER     1
-#define SUBDIV_SELECT_INNER_SEL 2
-#define SUBDIV_SELECT_LOOPCUT 3
-
-/* edge subdivide corner cut types */
-#define SUBDIV_CORNER_PATH		0
-#define SUBDIV_CORNER_INNERVERT	1
-#define SUBDIV_CORNER_FAN		2
-
-extern EnumPropertyItem corner_type_items[];
-
-void join_triangles(EditMesh *em);
-int removedoublesflag(EditMesh *em, short flag, short automerge, float limit);		/* return amount */
-void esubdivideflag(Object *obedit, EditMesh *em, int flag, float smooth, float fractal, int beautify, int numcuts, int corner_pattern, int seltype);
-int EdgeSlide(EditMesh *em, struct wmOperator *op, short immediate, float imperc);
+extern struct EnumPropertyItem *corner_type_items;
 
 void MESH_OT_merge(struct wmOperatorType *ot);
 void MESH_OT_subdivide(struct wmOperatorType *ot);
 void MESH_OT_remove_doubles(struct wmOperatorType *ot);
 void MESH_OT_vertices_randomize(struct wmOperatorType *ot);
 void MESH_OT_vertices_sort(struct wmOperatorType *ot);
-void MESH_OT_extrude(struct wmOperatorType *ot);
 void MESH_OT_spin(struct wmOperatorType *ot);
 void MESH_OT_screw(struct wmOperatorType *ot);
 
@@ -218,7 +156,8 @@ void MESH_OT_fill(struct wmOperatorType *ot);
 void MESH_OT_beautify_fill(struct wmOperatorType *ot);
 void MESH_OT_quads_convert_to_tris(struct wmOperatorType *ot);
 void MESH_OT_tris_convert_to_quads(struct wmOperatorType *ot);
-void MESH_OT_edge_flip(struct wmOperatorType *ot);
+void MESH_OT_dissolve(struct wmOperatorType *ot);
+void MESH_OT_dissolve_limited(struct wmOperatorType *ot);
 void MESH_OT_faces_shade_smooth(struct wmOperatorType *ot);
 void MESH_OT_faces_shade_flat(struct wmOperatorType *ot);
 void MESH_OT_split(struct wmOperatorType *ot);
@@ -230,11 +169,16 @@ void MESH_OT_region_to_loop(struct wmOperatorType *ot);
 void MESH_OT_select_axis(struct wmOperatorType *ot);
 
 void MESH_OT_uvs_rotate(struct wmOperatorType *ot);
-void MESH_OT_uvs_mirror(struct wmOperatorType *ot);
+//void MESH_OT_uvs_mirror(struct wmOperatorType *ot);
+void MESH_OT_uvs_reverse(struct wmOperatorType *ot);
 void MESH_OT_colors_rotate(struct wmOperatorType *ot);
-void MESH_OT_colors_mirror(struct wmOperatorType *ot);
+//void MESH_OT_colors_mirror(struct wmOperatorType *ot);
+
+void MESH_OT_colors_reverse(struct wmOperatorType *ot);
 
 void MESH_OT_delete(struct wmOperatorType *ot);
+void MESH_OT_edge_collapse(struct wmOperatorType *ot);
+void MESH_OT_edge_collapse_loop(struct wmOperatorType *ot);
 void MESH_OT_rip(struct wmOperatorType *ot);
 
 void MESH_OT_shape_propagate_to_all(struct wmOperatorType *ot);
@@ -251,9 +195,24 @@ void MESH_OT_sticky_add(struct wmOperatorType *ot);
 void MESH_OT_sticky_remove(struct wmOperatorType *ot);
 void MESH_OT_drop_named_image(struct wmOperatorType *ot);
 
+/* ************* bmesh_tools.c ***********/
+void MESH_OT_vert_connect(struct wmOperatorType *ot);
+void MESH_OT_edge_split(struct wmOperatorType *ot);
+void MESH_OT_extrude_region(struct wmOperatorType *ot);
+void MESH_OT_extrude_verts_indiv(struct wmOperatorType *ot);
+void MESH_OT_extrude_edges_indiv(struct wmOperatorType *ot);
+void MESH_OT_extrude_faces_indiv(struct wmOperatorType *ot);
+
 void MESH_OT_edgering_select(struct wmOperatorType *ot);
 void MESH_OT_loopcut(struct wmOperatorType *ot);
 
+void MESH_OT_knife_tool(struct wmOperatorType *ot);
+void MESH_OT_bevel(struct wmOperatorType *ot);
+
+void MESH_OT_bridge_edge_loops(struct wmOperatorType *ot);
+void MESH_OT_inset(struct wmOperatorType *ot);
+void MESH_OT_vert_slide(struct wmOperatorType *ot);
+
 /* ******************* mesh_navmesh.c */
 void MESH_OT_navmesh_make(struct wmOperatorType *ot);
 void MESH_OT_navmesh_face_copy(struct wmOperatorType *ot);
@@ -261,5 +220,5 @@ void MESH_OT_navmesh_face_add(struct wmOperatorType *ot);
 void MESH_OT_navmesh_reset(struct wmOperatorType *ot);
 void MESH_OT_navmesh_clear(struct wmOperatorType *ot);
 
-#endif // MESH_INTERN_H
+#endif // __MESH_INTERN_H__
 
diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c
index 973659c..71aaacb 100644
--- a/source/blender/editors/mesh/mesh_navmesh.c
+++ b/source/blender/editors/mesh/mesh_navmesh.c
@@ -32,10 +32,16 @@
 
 #include "DNA_scene_types.h"
 #include "DNA_object_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_modifier_types.h"
 #include "DNA_ID.h"
 
+#include "BLI_listbase.h"
+#include "BLI_utildefines.h"
+#include "BLI_math_vector.h"
+#include "BLI_linklist.h"
+
 #include "BKE_library.h"
 #include "BKE_depsgraph.h"
 #include "BKE_context.h"
@@ -46,12 +52,7 @@
 #include "BKE_DerivedMesh.h"
 #include "BKE_cdderivedmesh.h"
 #include "BKE_report.h"
-
-#include "BLI_editVert.h"
-#include "BLI_listbase.h"
-#include "BLI_utildefines.h"
-#include "BLI_math_vector.h"
-#include "BLI_linklist.h"
+#include "BKE_tessmesh.h"
 
 #include "ED_object.h"
 #include "ED_mesh.h"
@@ -65,113 +66,114 @@
 #include "mesh_intern.h"
 #include "recast-capi.h"
 
-static void createVertsTrisData(bContext *C, LinkNode* obs, int *nverts_r, float **verts_r, int *ntris_r, int **tris_r)
+static void createVertsTrisData(bContext *C, LinkNode *obs, int *nverts_r, float **verts_r, int *ntris_r, int **tris_r)
 {
 	MVert *mvert;
-	int nfaces= 0, *tri, i, curnverts, basenverts, curnfaces;
+	int nfaces = 0, *tri, i, curnverts, basenverts, curnfaces;
 	MFace *mface;
 	float co[3], wco[3];
 	Object *ob;
 	LinkNode *oblink, *dmlink;
 	DerivedMesh *dm;
-	Scene* scene= CTX_data_scene(C);
-	LinkNode* dms= NULL;
+	Scene *scene = CTX_data_scene(C);
+	LinkNode *dms = NULL;
 
 	int nverts, ntris, *tris;
 	float *verts;
 
-	nverts= 0;
-	ntris= 0;
+	nverts = 0;
+	ntris = 0;
 
 	/* calculate number of verts and tris */
-	for(oblink= obs; oblink; oblink= oblink->next) {
-		ob= (Object*) oblink->link;
-		dm= mesh_create_derived_no_virtual(scene, ob, NULL, CD_MASK_MESH);
-		BLI_linklist_append(&dms, (void*)dm);
+	for (oblink = obs; oblink; oblink = oblink->next) {
+		ob = (Object *) oblink->link;
+		dm = mesh_create_derived_no_virtual(scene, ob, NULL, CD_MASK_MESH);
+		BLI_linklist_append(&dms, (void *)dm);
 
-		nverts+= dm->getNumVerts(dm);
-		nfaces= dm->getNumFaces(dm);
-		ntris+= nfaces;
+		nverts += dm->getNumVerts(dm);
+		nfaces = dm->getNumTessFaces(dm);
+		ntris += nfaces;
 
 		/* resolve quad faces */
-		mface= dm->getFaceArray(dm);
-		for(i= 0; i<nfaces; i++) {
-			MFace* mf= &mface[i];
-			if(mf->v4)
-				ntris+=1;
+		mface = dm->getTessFaceArray(dm);
+		for (i = 0; i < nfaces; i++) {
+			MFace *mf = &mface[i];
+			if (mf->v4)
+				ntris += 1;
 		}
 	}
 
 	/* create data */
-	verts= MEM_mallocN(sizeof(float)*3*nverts, "createVertsTrisData verts");
-	tris= MEM_mallocN(sizeof(int)*3*ntris, "createVertsTrisData faces");
+	verts = MEM_mallocN(sizeof(float) * 3 * nverts, "createVertsTrisData verts");
+	tris = MEM_mallocN(sizeof(int) * 3 * ntris, "createVertsTrisData faces");
 
-	basenverts= 0;
-	tri= tris;
-	for(oblink= obs, dmlink= dms; oblink && dmlink;
-			oblink= oblink->next, dmlink= dmlink->next) {
-		ob= (Object*) oblink->link;
-		dm= (DerivedMesh*) dmlink->link;
+	basenverts = 0;
+	tri = tris;
+	for (oblink = obs, dmlink = dms; oblink && dmlink;
+	     oblink = oblink->next, dmlink = dmlink->next)
+	{
+		ob = (Object *) oblink->link;
+		dm = (DerivedMesh *) dmlink->link;
 
-		curnverts= dm->getNumVerts(dm);
-		mvert= dm->getVertArray(dm);
+		curnverts = dm->getNumVerts(dm);
+		mvert = dm->getVertArray(dm);
 
 		/* copy verts */
-		for(i= 0; i<curnverts; i++) {
-			MVert *v= &mvert[i];
+		for (i = 0; i < curnverts; i++) {
+			MVert *v = &mvert[i];
 
 			copy_v3_v3(co, v->co);
 			mul_v3_m4v3(wco, ob->obmat, co);
 
-			verts[3*(basenverts+i)+0]= wco[0];
-			verts[3*(basenverts+i)+1]= wco[2];
-			verts[3*(basenverts+i)+2]= wco[1];
+			verts[3 * (basenverts + i) + 0] = wco[0];
+			verts[3 * (basenverts + i) + 1] = wco[2];
+			verts[3 * (basenverts + i) + 2] = wco[1];
 		}
 
 		/* create tris */
-		curnfaces= dm->getNumFaces(dm);
-		mface= dm->getFaceArray(dm);
+		curnfaces = dm->getNumTessFaces(dm);
+		mface = dm->getTessFaceArray(dm);
 
-		for(i= 0; i<curnfaces; i++) {
-			MFace* mf= &mface[i];
+		for (i = 0; i < curnfaces; i++) {
+			MFace *mf = &mface[i];
 
-			tri[0]= basenverts + mf->v1;
-			tri[1]= basenverts + mf->v3;
-			tri[2]= basenverts + mf->v2;
+			tri[0] = basenverts + mf->v1;
+			tri[1] = basenverts + mf->v3;
+			tri[2] = basenverts + mf->v2;
 			tri += 3;
 
-			if(mf->v4) {
-				tri[0]= basenverts + mf->v1;
-				tri[1]= basenverts + mf->v4;
-				tri[2]= basenverts + mf->v3;
+			if (mf->v4) {
+				tri[0] = basenverts + mf->v1;
+				tri[1] = basenverts + mf->v4;
+				tri[2] = basenverts + mf->v3;
 				tri += 3;
 			}
 		}
 
-		basenverts+= curnverts;
+		basenverts += curnverts;
 	}
 
 	/* release derived mesh */
-	for(dmlink= dms; dmlink; dmlink= dmlink->next) {
-		dm= (DerivedMesh*) dmlink->link;
+	for (dmlink = dms; dmlink; dmlink = dmlink->next) {
+		dm = (DerivedMesh *) dmlink->link;
 		dm->release(dm);
 	}
 
 	BLI_linklist_free(dms, NULL);
 
-	*nverts_r= nverts;
-	*verts_r= verts;
-	*ntris_r= ntris;
-	*tris_r= tris;
+	*nverts_r = nverts;
+	*verts_r = verts;
+	*ntris_r = ntris;
+	*tris_r = tris;
 }
 
 static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts, int ntris, int *tris,
-								 struct recast_polyMesh **pmesh, struct recast_polyMeshDetail **dmesh)
+                        struct recast_polyMesh **pmesh, struct recast_polyMeshDetail **dmesh)
 {
 	float bmin[3], bmax[3];
 	struct recast_heightfield *solid;
 	unsigned char *triflags;
-	struct recast_compactHeightfield* chf;
+	struct recast_compactHeightfield *chf;
 	struct recast_contourSet *cset;
 	int width, height, walkableHeight, walkableClimb, walkableRadius;
 	int minRegionArea, mergeRegionArea, maxEdgeLen;
@@ -180,31 +182,31 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts
 	recast_calcBounds(verts, nverts, bmin, bmax);
 
 	/* ** Step 1. Initialize build config ** */
-	walkableHeight= (int)ceilf(recastParams->agentheight/ recastParams->cellheight);
-	walkableClimb= (int)floorf(recastParams->agentmaxclimb / recastParams->cellheight);
-	walkableRadius= (int)ceilf(recastParams->agentradius / recastParams->cellsize);
-	minRegionArea= (int)(recastParams->regionminsize * recastParams->regionminsize);
-	mergeRegionArea= (int)(recastParams->regionmergesize * recastParams->regionmergesize);
-	maxEdgeLen= (int)(recastParams->edgemaxlen/recastParams->cellsize);
-	detailSampleDist= recastParams->detailsampledist< 0.9f ? 0 :
-			recastParams->cellsize * recastParams->detailsampledist;
-	detailSampleMaxError= recastParams->cellheight * recastParams->detailsamplemaxerror;
+	walkableHeight = (int)ceilf(recastParams->agentheight / recastParams->cellheight);
+	walkableClimb = (int)floorf(recastParams->agentmaxclimb / recastParams->cellheight);
+	walkableRadius = (int)ceilf(recastParams->agentradius / recastParams->cellsize);
+	minRegionArea = (int)(recastParams->regionminsize * recastParams->regionminsize);
+	mergeRegionArea = (int)(recastParams->regionmergesize * recastParams->regionmergesize);
+	maxEdgeLen = (int)(recastParams->edgemaxlen / recastParams->cellsize);
+	detailSampleDist = recastParams->detailsampledist < 0.9f ? 0 :
+	                   recastParams->cellsize * recastParams->detailsampledist;
+	detailSampleMaxError = recastParams->cellheight * recastParams->detailsamplemaxerror;
 
 	/* Set the area where the navigation will be build. */
 	recast_calcGridSize(bmin, bmax, recastParams->cellsize, &width, &height);
 
 	/* ** Step 2: Rasterize input polygon soup ** */
 	/* Allocate voxel heightfield where we rasterize our input data to */
-	solid= recast_newHeightfield();
+	solid = recast_newHeightfield();
 
-	if(!recast_createHeightfield(solid, width, height, bmin, bmax, recastParams->cellsize, recastParams->cellheight)) {
+	if (!recast_createHeightfield(solid, width, height, bmin, bmax, recastParams->cellsize, recastParams->cellheight)) {
 		recast_destroyHeightfield(solid);
 
 		return 0;
 	}
 
 	/* Allocate array that can hold triangle flags */
-	triflags= MEM_callocN(sizeof(unsigned char)*ntris, "buildNavMesh triflags");
+	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);
@@ -218,8 +220,8 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts
 
 	/* ** Step 4: Partition walkable surface to simple regions ** */
 
-	chf= recast_newCompactHeightfield();
-	if(!recast_buildCompactHeightfield(walkableHeight, walkableClimb, solid, chf)) {
+	chf = recast_newCompactHeightfield();
+	if (!recast_buildCompactHeightfield(walkableHeight, walkableClimb, solid, chf)) {
 		recast_destroyHeightfield(solid);
 		recast_destroyCompactHeightfield(chf);
 
@@ -236,14 +238,14 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts
 	}
 
 	/* Prepare for region partitioning, by calculating distance field along the walkable surface */
-	if(!recast_buildDistanceField(chf)) {
+	if (!recast_buildDistanceField(chf)) {
 		recast_destroyCompactHeightfield(chf);
 
 		return 0;
 	}
 
 	/* Partition the walkable surface into simple regions without holes */
-	if(!recast_buildRegions(chf, 0, minRegionArea, mergeRegionArea)) {
+	if (!recast_buildRegions(chf, 0, minRegionArea, mergeRegionArea)) {
 		recast_destroyCompactHeightfield(chf);
 
 		return 0;
@@ -251,9 +253,9 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts
 
 	/* ** Step 5: Trace and simplify region contours ** */
 	/* Create contours */
-	cset= recast_newContourSet();
+	cset = recast_newContourSet();
 
-	if(!recast_buildContours(chf, recastParams->edgemaxerror, maxEdgeLen, cset)) {
+	if (!recast_buildContours(chf, recastParams->edgemaxerror, maxEdgeLen, cset)) {
 		recast_destroyCompactHeightfield(chf);
 		recast_destroyContourSet(cset);
 
@@ -261,8 +263,8 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts
 	}
 
 	/* ** Step 6: Build polygons mesh from contours ** */
-	*pmesh= recast_newPolyMesh();
-	if(!recast_buildPolyMesh(cset, recastParams->vertsperpoly, *pmesh)) {
+	*pmesh = recast_newPolyMesh();
+	if (!recast_buildPolyMesh(cset, recastParams->vertsperpoly, *pmesh)) {
 		recast_destroyCompactHeightfield(chf);
 		recast_destroyContourSet(cset);
 		recast_destroyPolyMesh(*pmesh);
@@ -273,8 +275,8 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts
 
 	/* ** Step 7: Create detail mesh which allows to access approximate height on each polygon ** */
 
-	*dmesh= recast_newPolyMeshDetail();
-	if(!recast_buildPolyMeshDetail(*pmesh, chf, detailSampleDist, detailSampleMaxError, *dmesh)) {
+	*dmesh = recast_newPolyMeshDetail();
+	if (!recast_buildPolyMeshDetail(*pmesh, chf, detailSampleDist, detailSampleMaxError, *dmesh)) {
 		recast_destroyCompactHeightfield(chf);
 		recast_destroyContourSet(cset);
 		recast_destroyPolyMesh(*pmesh);
@@ -289,16 +291,16 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts
 	return 1;
 }
 
-static Object* createRepresentation(bContext *C, struct recast_polyMesh *pmesh, struct recast_polyMeshDetail *dmesh, Base* base)
+static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, struct recast_polyMeshDetail *dmesh, Base *base)
 {
 	float co[3], rot[3];
-	EditMesh *em;
-	int i,j, k;
-	unsigned short* v;
+	BMEditMesh *em;
+	int i, j, k;
+	unsigned short *v;
 	int face[3];
-	Scene *scene= CTX_data_scene(C);
-	Object* obedit;
-	int createob= base==NULL;
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit;
+	int createob = base == NULL;
 	int nverts, nmeshes, nvp;
 	unsigned short *verts, *polys;
 	unsigned int *meshes;
@@ -308,113 +310,112 @@ static Object* createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
 	zero_v3(co);
 	zero_v3(rot);
 
-	if(createob) {
+	if (createob) {
 		/* create new object */
-		obedit= ED_object_add_type(C, OB_MESH, co, rot, FALSE, 1);
+		obedit = ED_object_add_type(C, OB_MESH, co, rot, FALSE, 1);
 	}
 	else {
-		obedit= base->object;
+		obedit = base->object;
 		scene_select_base(scene, base);
 		copy_v3_v3(obedit->loc, co);
 		copy_v3_v3(obedit->rot, rot);
 	}
 
-	ED_object_enter_editmode(C, EM_DO_UNDO|EM_IGNORE_LAYER);
-	em= BKE_mesh_get_editmesh(((Mesh *)obedit->data));
+	ED_object_enter_editmode(C, EM_DO_UNDO | EM_IGNORE_LAYER);
+	em = BMEdit_FromObject(obedit);
 
-	if(!createob) {
+	if (!createob) {
 		/* clear */
-		if(em->verts.first) free_vertlist(em, &em->verts);
-		if(em->edges.first) free_edgelist(em, &em->edges);
-		if(em->faces.first) free_facelist(em, &em->faces);
-		if(em->selected.first) BLI_freelistN(&(em->selected));
+		EDBM_mesh_clear(em);
 	}
 
 	/* create verts for polygon mesh */
-	verts= recast_polyMeshGetVerts(pmesh, &nverts);
+	verts = recast_polyMeshGetVerts(pmesh, &nverts);
 	recast_polyMeshGetBoundbox(pmesh, bmin, NULL);
 	recast_polyMeshGetCell(pmesh, &cs, &ch);
 
-	for(i= 0; i<nverts; i++) {
-		v= &verts[3*i];
-		co[0]= bmin[0] + v[0]*cs;
-		co[1]= bmin[1] + v[1]*ch;
-		co[2]= bmin[2] + v[2]*cs;
+	for (i = 0; i < nverts; i++) {
+		v = &verts[3 * i];
+		co[0] = bmin[0] + v[0] * cs;
+		co[1] = bmin[1] + v[1] * ch;
+		co[2] = bmin[2] + v[2] * cs;
 		SWAP(float, co[1], co[2]);
-		addvertlist(em, co, NULL);
+		BM_vert_create(em->bm, co, NULL);
 	}
 
 	/* create custom data layer to save polygon idx */
-	CustomData_add_layer_named(&em->fdata, CD_RECAST, CD_CALLOC, NULL, 0, "createRepresentation recastData");
-
+	CustomData_add_layer_named(&em->bm->pdata, CD_RECAST, CD_CALLOC, NULL, 0, "createRepresentation recastData");
+	CustomData_bmesh_init_pool(&em->bm->pdata, 0, BM_FACE);
+	
 	/* create verts and faces for detailed mesh */
-	meshes= recast_polyMeshDetailGetMeshes(dmesh, &nmeshes);
-	polys= recast_polyMeshGetPolys(pmesh, NULL, &nvp);
-	dverts= recast_polyMeshDetailGetVerts(dmesh, NULL);
-	tris= recast_polyMeshDetailGetTris(dmesh, NULL);
-
-	for(i= 0; i<nmeshes; i++) {
-		int uniquevbase= em->totvert;
-		unsigned int vbase= meshes[4*i+0];
-		unsigned short ndv= meshes[4*i+1];
-		unsigned short tribase= meshes[4*i+2];
-		unsigned short trinum= meshes[4*i+3];
-		const unsigned short* p= &polys[i*nvp*2];
-		int nv= 0;
-
-		for(j= 0; j < nvp; ++j) {
-			if(p[j]==0xffff) break;
+	meshes = recast_polyMeshDetailGetMeshes(dmesh, &nmeshes);
+	polys = recast_polyMeshGetPolys(pmesh, NULL, &nvp);
+	dverts = recast_polyMeshDetailGetVerts(dmesh, NULL);
+	tris = recast_polyMeshDetailGetTris(dmesh, NULL);
+
+	for (i = 0; i < nmeshes; i++) {
+		int uniquevbase = em->bm->totvert;
+		unsigned int vbase = meshes[4 * i + 0];
+		unsigned short ndv = meshes[4 * i + 1];
+		unsigned short tribase = meshes[4 * i + 2];
+		unsigned short trinum = meshes[4 * i + 3];
+		const unsigned short *p = &polys[i * nvp * 2];
+		int nv = 0;
+
+		for (j = 0; j < nvp; ++j) {
+			if (p[j] == 0xffff) break;
 			nv++;
 		}
 
 		/* create unique verts  */
-		for(j= nv; j<ndv; j++) {
-			copy_v3_v3(co, &dverts[3*(vbase + j)]);
+		for (j = nv; j < ndv; j++) {
+			copy_v3_v3(co, &dverts[3 * (vbase + j)]);
 			SWAP(float, co[1], co[2]);
-			addvertlist(em, co, NULL);
+			BM_vert_create(em->bm, co, NULL);
 		}
 
-		EM_init_index_arrays(em, 1, 0, 0);
+		EDBM_index_arrays_init(em, 1, 0, 0);
 
 		/* create faces */
-		for(j= 0; j<trinum; j++) {
-			unsigned char* tri= &tris[4*(tribase+j)];
-			EditFace* newFace;
-			int* polygonIdx;
-
-			for(k= 0; k<3; k++) {
-				if(tri[k]<nv)
-					face[k]= p[tri[k]]; /* shared vertex */
+		for (j = 0; j < trinum; j++) {
+			unsigned char *tri = &tris[4 * (tribase + j)];
+			BMFace *newFace;
+			int *polygonIdx;
+
+			for (k = 0; k < 3; k++) {
+				if (tri[k] < nv)
+					face[k] = p[tri[k]];  /* shared vertex */
 				else
-					face[k]= uniquevbase+tri[k]-nv; /* unique vertex */
+					face[k] = uniquevbase + tri[k] - nv;  /* unique vertex */
 			}
-			newFace= addfacelist(em, EM_get_vert_for_index(face[0]), EM_get_vert_for_index(face[2]),
-									EM_get_vert_for_index(face[1]), NULL, NULL, NULL);
+			newFace = BM_face_create_quad_tri(em->bm,
+			                                  EDBM_vert_at_index(em, face[0]),
+			                                  EDBM_vert_at_index(em, face[2]),
+			                                  EDBM_vert_at_index(em, face[1]), NULL,
+			                                  NULL, FALSE);
 
 			/* set navigation polygon idx to the custom layer */
-			polygonIdx= (int*)CustomData_em_get(&em->fdata, newFace->data, CD_RECAST);
-			*polygonIdx= i+1; /* add 1 to avoid zero idx */
+			polygonIdx = (int *)CustomData_bmesh_get(&em->bm->pdata, newFace->head.data, CD_RECAST);
+			*polygonIdx = i + 1; /* add 1 to avoid zero idx */
 		}
 		
-		EM_free_index_arrays();
+		EDBM_index_arrays_free(em);
 	}
 
 	recast_destroyPolyMesh(pmesh);
 	recast_destroyPolyMeshDetail(dmesh);
 
-	BKE_mesh_end_editmesh((Mesh*)obedit->data, em);
-	
-	DAG_id_tag_update((ID*)obedit->data, OB_RECALC_DATA);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	DAG_id_tag_update((ID *)obedit->data, OB_RECALC_DATA);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 
 
 	ED_object_exit_editmode(C, EM_FREEDATA); 
-	WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit);
+	WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit);
 
-	if(createob) {
-		obedit->gameflag&= ~OB_COLLISION;
-		obedit->gameflag|= OB_NAVMESH;
-		obedit->body_type= OB_BODY_TYPE_NAVMESH;
+	if (createob) {
+		obedit->gameflag &= ~OB_COLLISION;
+		obedit->gameflag |= OB_NAVMESH;
+		obedit->body_type = OB_BODY_TYPE_NAVMESH;
 		rename_id((ID *)obedit, "Navmesh");
 	}
 
@@ -423,33 +424,33 @@ static Object* createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
 	return obedit;
 }
 
-static int create_navmesh_exec(bContext *C, wmOperator *op)
+static int navmesh_create_exec(bContext *C, wmOperator *op)
 {
-	Scene* scene= CTX_data_scene(C);
-	LinkNode* obs= NULL;
-	Base* navmeshBase= NULL;
+	Scene *scene = CTX_data_scene(C);
+	LinkNode *obs = NULL;
+	Base *navmeshBase = NULL;
 
 	CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
 		if (base->object->type == OB_MESH) {
-			if (base->object->body_type==OB_BODY_TYPE_NAVMESH) {
+			if (base->object->body_type == OB_BODY_TYPE_NAVMESH) {
 				if (!navmeshBase || base == scene->basact) {
-					navmeshBase= base;
+					navmeshBase = base;
 				}
 			}
 			else {
-				BLI_linklist_append(&obs, (void*)base->object);
+				BLI_linklist_append(&obs, (void *)base->object);
 			}
 		}
 	}
 	CTX_DATA_END;
 
 	if (obs) {
-		struct recast_polyMesh *pmesh= NULL;
-		struct recast_polyMeshDetail *dmesh= NULL;
+		struct recast_polyMesh *pmesh = NULL;
+		struct recast_polyMeshDetail *dmesh = NULL;
 
-		int nverts= 0, ntris= 0;
-		int *tris= 0;
-		float *verts= NULL;
+		int nverts = 0, ntris = 0;
+		int *tris = 0;
+		float *verts = NULL;
 
 		createVertsTrisData(C, obs, &nverts, &verts, &ntris, &tris);
 		BLI_linklist_free(obs, NULL);
@@ -471,37 +472,38 @@ static int create_navmesh_exec(bContext *C, wmOperator *op)
 void MESH_OT_navmesh_make(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Create navigation mesh";
-	ot->description= "Create navigation mesh for selected objects";
-	ot->idname= "MESH_OT_navmesh_make";
+	ot->name = "Create navigation mesh";
+	ot->description = "Create navigation mesh for selected objects";
+	ot->idname = "MESH_OT_navmesh_make";
 
 	/* api callbacks */
-	ot->exec= create_navmesh_exec;
+	ot->exec = navmesh_create_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 static int navmesh_face_copy_exec(bContext *C, wmOperator *op)
 {
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
 
 	/* do work here */
-	EditFace *efa_act= EM_get_actFace(em, 0);
+	BMFace *efa_act = BM_active_face_get(em->bm, FALSE);
 
-	if(efa_act) {
-		if(CustomData_has_layer(&em->fdata, CD_RECAST)) {
-			EditFace *efa;
-			int targetPolyIdx= *(int*)CustomData_em_get(&em->fdata, efa_act->data, CD_RECAST);
-			targetPolyIdx= targetPolyIdx>=0? targetPolyIdx : -targetPolyIdx;
+	if (efa_act) {
+		if (CustomData_has_layer(&em->bm->pdata, CD_RECAST)) {
+			BMFace *efa;
+			BMIter iter;
+			int targetPolyIdx = *(int *)CustomData_bmesh_get(&em->bm->pdata, efa_act->head.data, CD_RECAST);
+			targetPolyIdx = targetPolyIdx >= 0 ? targetPolyIdx : -targetPolyIdx;
 
-			if(targetPolyIdx > 0) {
+			if (targetPolyIdx > 0) {
 				/* set target poly idx to other selected faces */
-				for (efa= (EditFace *)em->faces.first; efa; efa= efa->next) {
-					if((efa->f & SELECT) && efa != efa_act)  {
-						int* recastDataBlock= (int*)CustomData_em_get(&em->fdata, efa->data, CD_RECAST);
-						*recastDataBlock= targetPolyIdx;
+				BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+					if (BM_elem_flag_test(efa, BM_ELEM_SELECT) && efa != efa_act) {
+						int *recastDataBlock = (int *)CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_RECAST);
+						*recastDataBlock = targetPolyIdx;
 					}
 				}
 			}
@@ -511,10 +513,8 @@ static int navmesh_face_copy_exec(bContext *C, wmOperator *op)
 		}
 	}
 
-	DAG_id_tag_update((ID*)obedit->data, OB_RECALC_DATA);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-
-	BKE_mesh_end_editmesh((Mesh*)obedit->data, em);
+	DAG_id_tag_update((ID *)obedit->data, OB_RECALC_DATA);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 
 	return OPERATOR_FINISHED;
 }
@@ -522,46 +522,47 @@ static int navmesh_face_copy_exec(bContext *C, wmOperator *op)
 void MESH_OT_navmesh_face_copy(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "NavMesh Copy Face Index";
-	ot->description= "Copy the index from the active face";
-	ot->idname= "MESH_OT_navmesh_face_copy";
+	ot->name = "NavMesh Copy Face Index";
+	ot->description = "Copy the index from the active face";
+	ot->idname = "MESH_OT_navmesh_face_copy";
 
 	/* api callbacks */
-	ot->poll= ED_operator_editmesh;
-	ot->exec= navmesh_face_copy_exec;
+	ot->poll = ED_operator_editmesh;
+	ot->exec = navmesh_face_copy_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
-static int compare(const void * a, const void * b)
+static int compare(const void *a, const void *b)
 {
-	return ( *(int*)a - *(int*)b );
+	return (*(int *)a - *(int *)b);
 }
 
-static int findFreeNavPolyIndex(EditMesh* em)
+static int findFreeNavPolyIndex(BMEditMesh *em)
 {
 	/* construct vector of indices */
-	int numfaces= em->totface;
-	int* indices= MEM_callocN(sizeof(int)*numfaces, "findFreeNavPolyIndex(indices)");
-	EditFace* ef= (EditFace*)em->faces.last;
-	int i, idx= 0, freeIdx= 1;
-
-	while(ef) {
-		int polyIdx= *(int*)CustomData_em_get(&em->fdata, ef->data, CD_RECAST);
-		indices[idx]= polyIdx;
-		idx++;
-		ef= ef->prev;
+	int numfaces = em->bm->totface;
+	int *indices = MEM_callocN(sizeof(int) * numfaces, "findFreeNavPolyIndex(indices)");
+	BMFace *ef;
+	BMIter iter;
+	int i, idx = em->bm->totface - 1, freeIdx = 1;
+
+	/*XXX this originally went last to first, but that isn't possible anymore*/
+	BM_ITER_MESH (ef, &iter, em->bm, BM_FACES_OF_MESH) {
+		int polyIdx = *(int *)CustomData_bmesh_get(&em->bm->pdata, ef->head.data, CD_RECAST);
+		indices[idx] = polyIdx;
+		idx--;
 	}
 
 	qsort(indices, numfaces, sizeof(int), compare);
 
 	/* search first free index */
-	freeIdx= 1;
-	for(i= 0; i<numfaces; i++) {
-		if(indices[i]==freeIdx)
+	freeIdx = 1;
+	for (i = 0; i < numfaces; i++) {
+		if (indices[i] == freeIdx)
 			freeIdx++;
-		else if(indices[i]>freeIdx)
+		else if (indices[i] > freeIdx)
 			break;
 	}
 
@@ -572,54 +573,54 @@ static int findFreeNavPolyIndex(EditMesh* em)
 
 static int navmesh_face_add_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
-	EditFace *ef;
-
-	if(CustomData_has_layer(&em->fdata, CD_RECAST)) {
-		int targetPolyIdx= findFreeNavPolyIndex(em);
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMFace *ef;
+	BMIter iter;
+	
+	if (CustomData_has_layer(&em->bm->pdata, CD_RECAST)) {
+		int targetPolyIdx = findFreeNavPolyIndex(em);
 
-		if(targetPolyIdx>0) {
+		if (targetPolyIdx > 0) {
 			/* set target poly idx to selected faces */
-			ef= (EditFace*)em->faces.last;
-			while(ef) {
-				if(ef->f & SELECT) {
-					int *recastDataBlock= (int*)CustomData_em_get(&em->fdata, ef->data, CD_RECAST);
-					*recastDataBlock= targetPolyIdx;
+			/*XXX this originally went last to first, but that isn't possible anymore*/
+			
+			BM_ITER_MESH (ef, &iter, em->bm, BM_FACES_OF_MESH) {
+				if (BM_elem_flag_test(ef, BM_ELEM_SELECT)) {
+					int *recastDataBlock = (int *)CustomData_bmesh_get(&em->bm->pdata, ef->head.data, CD_RECAST);
+					*recastDataBlock = targetPolyIdx;
 				}
-				ef= ef->prev;
 			}
 		}
 	}
 
-	DAG_id_tag_update((ID*)obedit->data, OB_RECALC_DATA);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	DAG_id_tag_update((ID *)obedit->data, OB_RECALC_DATA);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 
-	BKE_mesh_end_editmesh((Mesh*)obedit->data, em);
 	return OPERATOR_FINISHED;
 }
 
 void MESH_OT_navmesh_face_add(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "NavMesh New Face Index";
-	ot->description= "Add a new index and assign it to selected faces";
-	ot->idname= "MESH_OT_navmesh_face_add";
+	ot->name = "NavMesh New Face Index";
+	ot->description = "Add a new index and assign it to selected faces";
+	ot->idname = "MESH_OT_navmesh_face_add";
 
 	/* api callbacks */
-	ot->poll= ED_operator_editmesh;
-	ot->exec= navmesh_face_add_exec;
+	ot->poll = ED_operator_editmesh;
+	ot->exec = navmesh_face_add_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 static int navmesh_obmode_data_poll(bContext *C)
 {
 	Object *ob = ED_object_active_context(C);
 	if (ob && (ob->mode == OB_MODE_OBJECT) && (ob->type == OB_MESH)) {
-		Mesh *me= ob->data;
-		return CustomData_has_layer(&me->fdata, CD_RECAST);
+		Mesh *me = ob->data;
+		return CustomData_has_layer(&me->pdata, CD_RECAST);
 	}
 	return FALSE;
 }
@@ -636,14 +637,14 @@ static int navmesh_obmode_poll(bContext *C)
 static int navmesh_reset_exec(bContext *C, wmOperator *UNUSED(op))
 {
 	Object *ob = ED_object_active_context(C);
-	Mesh *me= ob->data;
+	Mesh *me = ob->data;
 
-	CustomData_free_layers(&me->fdata, CD_RECAST, me->totface);
+	CustomData_free_layers(&me->pdata, CD_RECAST, me->totpoly);
 
 	BKE_mesh_ensure_navmesh(me);
 
 	DAG_id_tag_update(&me->id, OB_RECALC_DATA);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, &me->id);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, &me->id);
 
 	return OPERATOR_FINISHED;
 }
@@ -651,27 +652,27 @@ static int navmesh_reset_exec(bContext *C, wmOperator *UNUSED(op))
 void MESH_OT_navmesh_reset(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "NavMesh Reset Index Values";
-	ot->description= "Assign a new index to every face";
-	ot->idname= "MESH_OT_navmesh_reset";
+	ot->name = "NavMesh Reset Index Values";
+	ot->description = "Assign a new index to every face";
+	ot->idname = "MESH_OT_navmesh_reset";
 
 	/* api callbacks */
-	ot->poll= navmesh_obmode_poll;
-	ot->exec= navmesh_reset_exec;
+	ot->poll = navmesh_obmode_poll;
+	ot->exec = navmesh_reset_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 static int navmesh_clear_exec(bContext *C, wmOperator *UNUSED(op))
 {
 	Object *ob = ED_object_active_context(C);
-	Mesh *me= ob->data;
+	Mesh *me = ob->data;
 
-	CustomData_free_layers(&me->fdata, CD_RECAST, me->totface);
+	CustomData_free_layers(&me->pdata, CD_RECAST, me->totpoly);
 
 	DAG_id_tag_update(&me->id, OB_RECALC_DATA);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, &me->id);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, &me->id);
 
 	return OPERATOR_FINISHED;
 }
@@ -679,14 +680,14 @@ static int navmesh_clear_exec(bContext *C, wmOperator *UNUSED(op))
 void MESH_OT_navmesh_clear(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "NavMesh Clear Data";
-	ot->description= "Remove navmesh data from this mesh";
-	ot->idname= "MESH_OT_navmesh_clear";
+	ot->name = "NavMesh Clear Data";
+	ot->description = "Remove navmesh data from this mesh";
+	ot->idname = "MESH_OT_navmesh_clear";
 
 	/* api callbacks */
-	ot->poll= navmesh_obmode_data_poll;
-	ot->exec= navmesh_clear_exec;
+	ot->poll = navmesh_obmode_data_poll;
+	ot->exec = navmesh_clear_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index 2ff9052..4b4fef5 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -38,7 +38,6 @@
 
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
-#include "BLI_editVert.h"
 
 #include "BKE_context.h"
 
@@ -60,6 +59,7 @@
 void ED_operatortypes_mesh(void)
 {
 	WM_operatortype_append(MESH_OT_select_all);
+	WM_operatortype_append(MESH_OT_select_interior_faces);
 	WM_operatortype_append(MESH_OT_select_more);
 	WM_operatortype_append(MESH_OT_select_less);
 	WM_operatortype_append(MESH_OT_select_non_manifold);
@@ -69,6 +69,7 @@ void ED_operatortypes_mesh(void)
 	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_loose_verts);
 	WM_operatortype_append(MESH_OT_select_mirror);
 	WM_operatortype_append(MESH_OT_normals_make_consistent);
 	WM_operatortype_append(MESH_OT_merge);
@@ -84,16 +85,18 @@ void ED_operatortypes_mesh(void)
 	WM_operatortype_append(MESH_OT_primitive_monkey_add);
 	WM_operatortype_append(MESH_OT_primitive_uv_sphere_add);
 	WM_operatortype_append(MESH_OT_primitive_ico_sphere_add);
-	WM_operatortype_append(MESH_OT_fgon_clear);
-	WM_operatortype_append(MESH_OT_fgon_make);
 	WM_operatortype_append(MESH_OT_duplicate);
 	WM_operatortype_append(MESH_OT_remove_doubles);
 	WM_operatortype_append(MESH_OT_vertices_sort);
 	WM_operatortype_append(MESH_OT_vertices_randomize);
-	WM_operatortype_append(MESH_OT_extrude);
 	WM_operatortype_append(MESH_OT_spin);
 	WM_operatortype_append(MESH_OT_screw);
-	
+
+	WM_operatortype_append(MESH_OT_extrude_region);
+	WM_operatortype_append(MESH_OT_extrude_faces_indiv);
+	WM_operatortype_append(MESH_OT_extrude_edges_indiv);
+	WM_operatortype_append(MESH_OT_extrude_verts_indiv);
+
 	WM_operatortype_append(MESH_OT_split);
 	WM_operatortype_append(MESH_OT_extrude_repeat);
 	WM_operatortype_append(MESH_OT_edge_rotate);
@@ -103,20 +106,23 @@ void ED_operatortypes_mesh(void)
 	WM_operatortype_append(MESH_OT_select_axis);
 	
 	WM_operatortype_append(MESH_OT_uvs_rotate);
-	WM_operatortype_append(MESH_OT_uvs_mirror);
+	WM_operatortype_append(MESH_OT_uvs_reverse);
 	WM_operatortype_append(MESH_OT_colors_rotate);
-	WM_operatortype_append(MESH_OT_colors_mirror);
+	WM_operatortype_append(MESH_OT_colors_reverse);
 	
 	WM_operatortype_append(MESH_OT_fill);
 	WM_operatortype_append(MESH_OT_beautify_fill);
 	WM_operatortype_append(MESH_OT_quads_convert_to_tris);
 	WM_operatortype_append(MESH_OT_tris_convert_to_quads);
-	WM_operatortype_append(MESH_OT_edge_flip);
+	WM_operatortype_append(MESH_OT_dissolve);
+	WM_operatortype_append(MESH_OT_dissolve_limited);
 	WM_operatortype_append(MESH_OT_faces_shade_smooth);
 	WM_operatortype_append(MESH_OT_faces_shade_flat);
 	WM_operatortype_append(MESH_OT_sort_faces);
 
 	WM_operatortype_append(MESH_OT_delete);
+	WM_operatortype_append(MESH_OT_edge_collapse);
+	WM_operatortype_append(MESH_OT_edge_collapse_loop);
 
 	WM_operatortype_append(MESH_OT_separate);
 	WM_operatortype_append(MESH_OT_dupli_extrude_cursor);
@@ -130,7 +136,7 @@ void ED_operatortypes_mesh(void)
 	WM_operatortype_append(MESH_OT_vertices_smooth);
 	WM_operatortype_append(MESH_OT_noise);
 	WM_operatortype_append(MESH_OT_flip_normals);
-	WM_operatortype_append(MESH_OT_knife_cut);
+	//WM_operatortype_append(MESH_OT_knife_cut);
 	WM_operatortype_append(MESH_OT_rip);
 	WM_operatortype_append(MESH_OT_blend_from_shape);
 	WM_operatortype_append(MESH_OT_shape_propagate_to_all);
@@ -148,6 +154,17 @@ void ED_operatortypes_mesh(void)
 
 	WM_operatortype_append(MESH_OT_solidify);
 	WM_operatortype_append(MESH_OT_select_nth);
+	WM_operatortype_append(MESH_OT_vert_connect);
+	WM_operatortype_append(MESH_OT_vert_slide);
+	WM_operatortype_append(MESH_OT_knife_tool);
+
+	WM_operatortype_append(MESH_OT_bevel);
+
+	WM_operatortype_append(MESH_OT_select_next_loop);
+
+	WM_operatortype_append(MESH_OT_bridge_edge_loops);
+	WM_operatortype_append(MESH_OT_inset);
+	WM_operatortype_append(MESH_OT_edge_split);
 
 #ifdef WITH_GAMEENGINE
 	WM_operatortype_append(MESH_OT_navmesh_make);
@@ -161,9 +178,9 @@ void ED_operatortypes_mesh(void)
 #if 0 /* UNUSED, remove? */
 static int ED_operator_editmesh_face_select(bContext *C)
 {
-	Object *obedit= CTX_data_edit_object(C);
-	if(obedit && obedit->type==OB_MESH) {
-		EditMesh *em = ((Mesh *)obedit->data)->edit_mesh;
+	Object *obedit = CTX_data_edit_object(C);
+	if (obedit && obedit->type == OB_MESH) {
+		BMEditMesh *em = BMEdit_FromObject(obedit);
 		if (em && em->selectmode & SCE_SELECT_FACE) {
 			return 1;
 		}
@@ -177,55 +194,51 @@ void ED_operatormacros_mesh(void)
 	wmOperatorType *ot;
 	wmOperatorTypeMacro *otmacro;
 	
-	ot= WM_operatortype_append_macro("MESH_OT_loopcut_slide", "Loop Cut and Slide", OPTYPE_UNDO|OPTYPE_REGISTER);
+	ot = WM_operatortype_append_macro("MESH_OT_loopcut_slide", "Loop Cut and Slide", OPTYPE_UNDO | OPTYPE_REGISTER);
 	ot->description = "Cut mesh loop and slide it";
 	WM_operatortype_macro_define(ot, "MESH_OT_loopcut");
-	otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_edge_slide");
+	otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_edge_slide");
 	RNA_struct_idprops_unset(otmacro->ptr, "release_confirm");
 
-	ot= WM_operatortype_append_macro("MESH_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
+	ot = WM_operatortype_append_macro("MESH_OT_duplicate_move", "Add Duplicate", OPTYPE_UNDO | OPTYPE_REGISTER);
 	ot->description = "Duplicate mesh and move";
 	WM_operatortype_macro_define(ot, "MESH_OT_duplicate");
-	otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+	otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
 	RNA_enum_set(otmacro->ptr, "proportional", 0);
 	RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
 
-	ot= WM_operatortype_append_macro("MESH_OT_rip_move", "Rip", OPTYPE_UNDO|OPTYPE_REGISTER);
+	ot = WM_operatortype_append_macro("MESH_OT_rip_move", "Rip", OPTYPE_UNDO | OPTYPE_REGISTER);
 	ot->description = "Rip polygons and move the result";
 	WM_operatortype_macro_define(ot, "MESH_OT_rip");
-	otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+	otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
 	RNA_enum_set(otmacro->ptr, "proportional", 0);
 	RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
 
-	ot= WM_operatortype_append_macro("MESH_OT_extrude_region_move", "Extrude Region and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
+	ot = WM_operatortype_append_macro("MESH_OT_extrude_region_move", "Extrude Region and Move", OPTYPE_UNDO | OPTYPE_REGISTER);
 	ot->description = "Extrude region and move result";
-	otmacro= WM_operatortype_macro_define(ot, "MESH_OT_extrude");
-	RNA_enum_set(otmacro->ptr, "type", 1);
-	otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+	otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_region");
+	otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
 	RNA_enum_set(otmacro->ptr, "proportional", 0);
 	RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
 
-	ot= WM_operatortype_append_macro("MESH_OT_extrude_faces_move", "Extrude Individual Faces and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
+	ot = WM_operatortype_append_macro("MESH_OT_extrude_faces_move", "Extrude Individual Faces and Move", OPTYPE_UNDO | OPTYPE_REGISTER);
 	ot->description = "Extrude faces and move result";
-	otmacro= WM_operatortype_macro_define(ot, "MESH_OT_extrude");
-	RNA_enum_set(otmacro->ptr, "type", 2);
-	otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_shrink_fatten");
+	otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_faces_indiv");
+	otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_shrink_fatten");
 	RNA_enum_set(otmacro->ptr, "proportional", 0);
 	RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
 
-	ot= WM_operatortype_append_macro("MESH_OT_extrude_edges_move", "Extrude Only Edges and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
+	ot = WM_operatortype_append_macro("MESH_OT_extrude_edges_move", "Extrude Only Edges and Move", OPTYPE_UNDO | OPTYPE_REGISTER);
 	ot->description = "Extrude edges and move result";
-	otmacro= WM_operatortype_macro_define(ot, "MESH_OT_extrude");
-	RNA_enum_set(otmacro->ptr, "type", 3);
-	otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+	otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_edges_indiv");
+	otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
 	RNA_enum_set(otmacro->ptr, "proportional", 0);
 	RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
 
-	ot= WM_operatortype_append_macro("MESH_OT_extrude_vertices_move", "Extrude Only Vertices and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
+	ot = WM_operatortype_append_macro("MESH_OT_extrude_vertices_move", "Extrude Only Vertices and Move", OPTYPE_UNDO | OPTYPE_REGISTER);
 	ot->description = "Extrude vertices and move result";
-	otmacro= WM_operatortype_macro_define(ot, "MESH_OT_extrude");
-	RNA_enum_set(otmacro->ptr, "type", 4);
-	otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+	otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_verts_indiv");
+	otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
 	RNA_enum_set(otmacro->ptr, "proportional", 0);
 	RNA_boolean_set(otmacro->ptr, "mirror", FALSE);
 }
@@ -237,8 +250,8 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
 	wmKeyMapItem *kmi;
 	int i;
 	
-	keymap= WM_keymap_find(keyconf, "Mesh", 0, 0);
-	keymap->poll= ED_operator_editmesh;
+	keymap = WM_keymap_find(keyconf, "Mesh", 0, 0);
+	keymap->poll = ED_operator_editmesh;
 	
 	WM_keymap_add_item(keymap, "MESH_OT_loopcut_slide", RKEY, KM_PRESS, KM_CTRL, 0);
 
@@ -246,12 +259,12 @@ 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);
-	kmi = WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0);
+	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);
 
-	kmi = WM_keymap_add_item(keymap, "MESH_OT_edgering_select", SELECTMOUSE, KM_PRESS, KM_ALT|KM_CTRL, 0);
+	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);
-	kmi = WM_keymap_add_item(keymap, "MESH_OT_edgering_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT|KM_CTRL, 0);
+	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);
 
 	WM_keymap_add_item(keymap, "MESH_OT_select_shortest_path", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
@@ -263,7 +276,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
 
 	WM_keymap_add_item(keymap, "MESH_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
 	WM_keymap_add_item(keymap, "MESH_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
-	WM_keymap_add_item(keymap, "MESH_OT_select_non_manifold", MKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0);
+	WM_keymap_add_item(keymap, "MESH_OT_select_non_manifold", MKEY, KM_PRESS, (KM_CTRL | KM_SHIFT | KM_ALT), 0);
 	
 	WM_keymap_add_item(keymap, "MESH_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0);
 	kmi = WM_keymap_add_item(keymap, "MESH_OT_select_linked_pick", LKEY, KM_PRESS, 0, 0);
@@ -271,7 +284,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
 	kmi = WM_keymap_add_item(keymap, "MESH_OT_select_linked_pick", LKEY, KM_PRESS, KM_SHIFT, 0);
 	RNA_boolean_set(kmi->ptr, "deselect", TRUE);
 	
-	WM_keymap_add_item(keymap, "MESH_OT_faces_select_linked_flat", FKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0);
+	WM_keymap_add_item(keymap, "MESH_OT_faces_select_linked_flat", FKEY, KM_PRESS, (KM_CTRL | KM_SHIFT | KM_ALT), 0);
 
 	WM_keymap_add_item(keymap, "MESH_OT_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0);
 	
@@ -288,7 +301,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
 	/* tools */
 	kmi = WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_CTRL, 0);
 	RNA_boolean_set(kmi->ptr, "inside", FALSE);
-	kmi = WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+	kmi = WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
 	RNA_boolean_set(kmi->ptr, "inside", TRUE);
 	
 	WM_keymap_add_item(keymap, "VIEW3D_OT_edit_mesh_extrude_move_normal", EKEY, KM_PRESS, 0, 0); /* python operator */
@@ -299,13 +312,16 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
 	WM_keymap_add_item(keymap, "MESH_OT_spin", RKEY, KM_PRESS, KM_ALT, 0);
 	
 	WM_keymap_add_item(keymap, "MESH_OT_fill", FKEY, KM_PRESS, KM_ALT, 0);
-	WM_keymap_add_item(keymap, "MESH_OT_beautify_fill", FKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0);
+	WM_keymap_add_item(keymap, "MESH_OT_beautify_fill", FKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0);
+
+	kmi = WM_keymap_add_item(keymap, "MESH_OT_quads_convert_to_tris", TKEY, KM_PRESS, KM_CTRL, 0);
+	RNA_boolean_set(kmi->ptr, "use_beauty", TRUE);
+	kmi = WM_keymap_add_item(keymap, "MESH_OT_quads_convert_to_tris", TKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
+	RNA_boolean_set(kmi->ptr, "use_beauty", FALSE);
 
-	WM_keymap_add_item(keymap, "MESH_OT_quads_convert_to_tris", TKEY, KM_PRESS, KM_CTRL, 0);
 	WM_keymap_add_item(keymap, "MESH_OT_tris_convert_to_quads", JKEY, KM_PRESS, KM_ALT, 0);
-	WM_keymap_add_item(keymap, "MESH_OT_edge_flip", FKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
 
-	WM_keymap_add_item(keymap, "MESH_OT_rip_move",VKEY, KM_PRESS, 0, 0);
+	WM_keymap_add_item(keymap, "MESH_OT_rip_move", VKEY, KM_PRESS, 0, 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);
@@ -319,18 +335,26 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
 	
 	WM_keymap_add_item(keymap, "MESH_OT_separate", PKEY, KM_PRESS, 0, 0);
 	WM_keymap_add_item(keymap, "MESH_OT_split", YKEY, KM_PRESS, 0, 0);
+	WM_keymap_add_item(keymap, "MESH_OT_vert_connect", JKEY, KM_PRESS, 0, 0);
 
+	/* Vertex Slide */
+	WM_keymap_add_item(keymap, "MESH_OT_vert_slide", VKEY, KM_PRESS, KM_SHIFT, 0);
 	/* use KM_CLICK because same key is used for tweaks */
 	kmi = WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", ACTIONMOUSE, KM_CLICK, KM_CTRL, 0);
 	RNA_boolean_set(kmi->ptr, "rotate_source", TRUE);
-	kmi = WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", ACTIONMOUSE, KM_CLICK, KM_SHIFT|KM_CTRL, 0);
+	kmi = WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", ACTIONMOUSE, KM_CLICK, KM_SHIFT | KM_CTRL, 0);
 	RNA_boolean_set(kmi->ptr, "rotate_source", FALSE);
 
-	WM_keymap_add_item(keymap, "MESH_OT_delete", XKEY, KM_PRESS, 0, 0);
-	WM_keymap_add_item(keymap, "MESH_OT_delete", DELKEY, KM_PRESS, 0, 0);
+	WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_delete", XKEY, KM_PRESS, 0, 0);
+	WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_delete", DELKEY, KM_PRESS, 0, 0);
 	
-	WM_keymap_add_item(keymap, "MESH_OT_knife_cut", LEFTMOUSE, KM_PRESS, 0, KKEY);
-	RNA_enum_set(WM_keymap_add_item(keymap, "MESH_OT_knife_cut", LEFTMOUSE, KM_PRESS, KM_SHIFT, KKEY)->ptr, "type", 2/*KNIFE_MIDPOINT*/);
+	kmi = WM_keymap_add_item(keymap, "MESH_OT_knife_tool", KKEY, KM_PRESS, 0, 0);
+	RNA_boolean_set(kmi->ptr, "use_occlude_geometry", TRUE);
+	RNA_boolean_set(kmi->ptr, "only_select",          FALSE);
+
+	kmi = WM_keymap_add_item(keymap, "MESH_OT_knife_tool", KKEY, KM_PRESS, KM_SHIFT, 0);
+	RNA_boolean_set(kmi->ptr, "use_occlude_geometry", FALSE);
+	RNA_boolean_set(kmi->ptr, "only_select",          TRUE);
 	
 	WM_keymap_add_item(keymap, "OBJECT_OT_vertex_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
 
@@ -344,11 +368,12 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
 	WM_keymap_add_menu(keymap, "VIEW3D_MT_vertex_group", GKEY, KM_PRESS, KM_CTRL, 0);
 	
 	/* useful stuff from object-mode */
-	for (i=0; i<=5; i++) {
-		kmi = WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", ZEROKEY+i, KM_PRESS, KM_CTRL, 0);
+	for (i = 0; i <= 5; i++) {
+		kmi = WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", ZEROKEY + i, KM_PRESS, KM_CTRL, 0);
 		RNA_int_set(kmi->ptr, "level", i);
 	}
 	
 	ED_object_generic_keymap(keyconf, keymap, 3);
+	knifetool_modal_keymap(keyconf);
 }
 
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index b94b60f..7c02f26 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -31,8 +31,8 @@
 
 
 /*
-	meshtools.c: no editmode (violated already :), tools operating on meshes
-*/
+ * meshtools.c: no editmode (violated already :), tools operating on meshes
+ */
 
 #include <stddef.h>
 #include <stdlib.h>
@@ -41,6 +41,7 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "DNA_mesh_types.h"
 #include "DNA_key_types.h"
 #include "DNA_material_types.h"
 #include "DNA_meshdata_types.h"
@@ -50,7 +51,6 @@
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
-#include "BLI_editVert.h"
 #include "BLI_ghash.h"
 #include "BLI_rand.h" /* for randome face sorting */
 #include "BLI_threads.h"
@@ -66,6 +66,7 @@
 #include "BKE_mesh.h"
 #include "BKE_material.h"
 #include "BKE_report.h"
+#include "BKE_tessmesh.h"
 #include "BKE_multires.h"
 
 #include "BLO_sys_types.h" // for intptr_t support
@@ -79,191 +80,193 @@
 
 /* own include */
 #include "mesh_intern.h"
-
+#include "uvedit_intern.h"
 
 /* * ********************** no editmode!!! *********** */
 
 /*********************** JOIN ***************************/
 
 /* join selected meshes into the active mesh, context sensitive
-return 0 if no join is made (error) and 1 of the join is done */
+ * return 0 if no join is made (error) and 1 if the join is done */
 
 int join_mesh_exec(bContext *C, wmOperator *op)
 {
-	Main *bmain= CTX_data_main(C);
-	Scene *scene= CTX_data_scene(C);
-	Object *ob= CTX_data_active_object(C);
+	Main *bmain = CTX_data_main(C);
+	Scene *scene = CTX_data_scene(C);
+	Object *ob = CTX_data_active_object(C);
 	Material **matar, *ma;
 	Mesh *me;
 	MVert *mvert, *mv;
 	MEdge *medge = NULL;
-	MFace *mface = NULL;
-	Key *key, *nkey=NULL;
+	MPoly *mpoly = NULL;
+	MLoop *mloop = NULL;
+	Key *key, *nkey = NULL;
 	KeyBlock *kb, *okb, *kbn;
 	float imat[4][4], cmat[4][4], *fp1, *fp2, curpos;
-	int a, b, totcol, totmat=0, totedge=0, totvert=0, totface=0, ok=0;
-	int vertofs, *matmap=NULL;
-	int	i, j, index, haskey=0, edgeofs, faceofs;
+	int a, b, totcol, totmat = 0, totedge = 0, totvert = 0, ok = 0;
+	int totloop = 0, totpoly = 0, vertofs, *matmap = NULL;
+	int i, j, index, haskey = 0, edgeofs, loopofs, polyofs;
 	bDeformGroup *dg, *odg;
 	MDeformVert *dvert;
-	CustomData vdata, edata, fdata;
+	CustomData vdata, edata, fdata, ldata, pdata;
 
-	if(scene->obedit) {
+	if (scene->obedit) {
 		BKE_report(op->reports, RPT_WARNING, "Cant join while in editmode");
 		return OPERATOR_CANCELLED;
 	}
 	
 	/* ob is the object we are adding geometry to */
-	if(!ob || ob->type!=OB_MESH) {
+	if (!ob || ob->type != OB_MESH) {
 		BKE_report(op->reports, RPT_WARNING, "Active object is not a mesh");
 		return OPERATOR_CANCELLED;
 	}
 	
 	/* count & check */
-	CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
-		if(base->object->type==OB_MESH) {
-			me= base->object->data;
+	CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases) {
+		if (base->object->type == OB_MESH) {
+			me = base->object->data;
+
+			totvert += me->totvert;
+			totedge += me->totedge;
+			totloop += me->totloop;
+			totpoly += me->totpoly;
+			totmat += base->object->totcol;
 			
-			totvert+= me->totvert;
-			totedge+= me->totedge;
-			totface+= me->totface;
-			totmat+= base->object->totcol;
-			
-			if(base->object == ob)
-				ok= 1;
+			if (base->object == ob)
+				ok = 1;
 			
 			/* check for shapekeys */
-			if(me->key)
+			if (me->key)
 				haskey++;
 		}
 	}
 	CTX_DATA_END;
 	
 	/* that way the active object is always selected */ 
-	if(ok==0) {
+	if (ok == 0) {
 		BKE_report(op->reports, RPT_WARNING, "Active object is not a selected mesh");
 		return OPERATOR_CANCELLED;
 	}
 	
 	/* only join meshes if there are verts to join, there aren't too many, and we only had one mesh selected */
-	me= (Mesh *)ob->data;
-	key= me->key;
+	me = (Mesh *)ob->data;
+	key = me->key;
 
-	if(totvert==0 || totvert==me->totvert) {
+	if (totvert == 0 || totvert == me->totvert) {
 		BKE_report(op->reports, RPT_WARNING, "No mesh data to join");
 		return OPERATOR_CANCELLED;
 	}
 	
-	if(totvert > MESH_MAX_VERTS) {
+	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;		
 	}
 
 	/* 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");
-	totcol= ob->totcol;
+	matar = MEM_callocN(sizeof(void *) * totmat, "join_mesh matar");
+	if (totmat) matmap = MEM_callocN(sizeof(int) * totmat, "join_mesh matmap");
+	totcol = ob->totcol;
 	
 	/* obact materials in new main array, is nicer start! */
-	for(a=0; a<ob->totcol; a++) {
-		matar[a]= give_current_material(ob, a+1);
+	for (a = 0; a < ob->totcol; a++) {
+		matar[a] = give_current_material(ob, a + 1);
 		id_us_plus((ID *)matar[a]);
 		/* increase id->us : will be lowered later */
 	}
 	
 	/* - if destination mesh had shapekeys, move them somewhere safe, and set up placeholders
-	 * 	with arrays that are large enough to hold shapekey data for all meshes
+	 *  with arrays that are large enough to hold shapekey data for all meshes
 	 * -	if destination mesh didn't have shapekeys, but we encountered some in the meshes we're 
 	 *	joining, set up a new keyblock and assign to the mesh
 	 */
-	if(key) {
+	if (key) {
 		/* make a duplicate copy that will only be used here... (must remember to free it!) */
-		nkey= copy_key(key);
+		nkey = copy_key(key);
 		
 		/* for all keys in old block, clear data-arrays */
-		for(kb= key->block.first; kb; kb= kb->next) {
-			if(kb->data) MEM_freeN(kb->data);
-			kb->data= MEM_callocN(sizeof(float)*3*totvert, "join_shapekey");
-			kb->totelem= totvert;
-			kb->weights= NULL;
+		for (kb = key->block.first; kb; kb = kb->next) {
+			if (kb->data) MEM_freeN(kb->data);
+			kb->data = MEM_callocN(sizeof(float) * 3 * totvert, "join_shapekey");
+			kb->totelem = totvert;
+			kb->weights = NULL;
 		}
 	}
-	else if(haskey) {
+	else if (haskey) {
 		/* add a new key-block and add to the mesh */
-		key= me->key= add_key((ID *)me);
+		key = me->key = add_key((ID *)me);
 		key->type = KEY_RELATIVE;
 	}
 	
 	/* first pass over objects - copying materials and vertexgroups across */
-	CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+	CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases)
+	{
 		/* only act if a mesh, and not the one we're joining to */
-		if((ob!=base->object) && (base->object->type==OB_MESH)) {
-			me= base->object->data;
+		if ((ob != base->object) && (base->object->type == OB_MESH)) {
+			me = base->object->data;
 			
 			/* Join this object's vertex groups to the base one's */
-			for(dg=base->object->defbase.first; dg; dg=dg->next) {
+			for (dg = base->object->defbase.first; dg; dg = dg->next) {
 				/* See if this group exists in the object (if it doesn't, add it to the end) */
-				if(!defgroup_find_name(ob, dg->name)) {
+				if (!defgroup_find_name(ob, dg->name)) {
 					odg = MEM_callocN(sizeof(bDeformGroup), "join deformGroup");
 					memcpy(odg, dg, sizeof(bDeformGroup));
 					BLI_addtail(&ob->defbase, odg);
 				}
 			}
-			if(ob->defbase.first && ob->actdef==0)
-				ob->actdef=1;
+			if (ob->defbase.first && ob->actdef == 0)
+				ob->actdef = 1;
 			
 			
-			if(me->totvert) {
+			if (me->totvert) {
 				/* Add this object's materials to the base one's if they don't exist already (but only if limits not exceeded yet) */
-				if(totcol < MAXMAT) {
-					for(a=1; a<=base->object->totcol; a++) {
-						ma= give_current_material(base->object, a);
+				if (totcol < MAXMAT) {
+					for (a = 1; a <= base->object->totcol; a++) {
+						ma = give_current_material(base->object, a);
 
-						for(b=0; b<totcol; b++) {
-							if(ma == matar[b]) break;
+						for (b = 0; b < totcol; b++) {
+							if (ma == matar[b]) break;
 						}
-						if(b==totcol) {
-							matar[b]= ma;
-							if(ma) {
+						if (b == totcol) {
+							matar[b] = ma;
+							if (ma) {
 								id_us_plus(&ma->id);
 							}
 							totcol++;
 						}
-						if(totcol >= MAXMAT)
+						if (totcol >= MAXMAT)
 							break;
 					}
 				}
 				
 				/* if this mesh has shapekeys, check if destination mesh already has matching entries too */
-				if(me->key && key) {
-					for(kb= me->key->block.first; kb; kb= kb->next) {
+				if (me->key && key) {
+					for (kb = me->key->block.first; kb; kb = kb->next) {
 						/* if key doesn't exist in destination mesh, add it */
-						if(key_get_named_keyblock(key, kb->name) == NULL) {
+						if (key_get_named_keyblock(key, kb->name) == NULL) {
 							/* copy this existing one over to the new shapekey block */
-							kbn= MEM_dupallocN(kb);
-							kbn->prev= kbn->next= NULL;
+							kbn = MEM_dupallocN(kb);
+							kbn->prev = kbn->next = NULL;
 							
-							/* adjust adrcode and other settings to fit (allocate a new data-array) */
-							kbn->data= MEM_callocN(sizeof(float)*3*totvert, "joined_shapekey");
-							kbn->totelem= totvert;
-							kbn->weights= NULL;
+							/* adjust settings to fit (allocate a new data-array) */
+							kbn->data = MEM_callocN(sizeof(float) * 3 * totvert, "joined_shapekey");
+							kbn->totelem = totvert;
+							kbn->weights = NULL;
 							
-							okb= key->block.last;
-							curpos= (okb) ? okb->pos : -0.1f;
-							if(key->type == KEY_RELATIVE)
-								kbn->pos= curpos + 0.1f;
+							okb = key->block.last;
+							curpos = (okb) ? okb->pos : -0.1f;
+							if (key->type == KEY_RELATIVE)
+								kbn->pos = curpos + 0.1f;
 							else
-								kbn->pos= curpos;
+								kbn->pos = curpos;
 							
 							BLI_addtail(&key->block, kbn);
-							kbn->adrcode= key->totkey;
 							key->totkey++;
-							if(key->totkey==1) key->refkey= kbn;
+							if (key->totkey == 1) key->refkey = kbn;
 							
 							// XXX 2.5 Animato
 #if 0
 							/* also, copy corresponding ipo-curve to ipo-block if applicable */
-							if(me->key->ipo && key->ipo) {
+							if (me->key->ipo && key->ipo) {
 								// FIXME... this is a luxury item!
 								puts("FIXME: ignoring IPO's when joining shapekeys on Meshes for now...");
 							}
@@ -280,41 +283,46 @@ int join_mesh_exec(bContext *C, wmOperator *op)
 	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));
 	
-	mvert= CustomData_add_layer(&vdata, CD_MVERT, CD_CALLOC, NULL, totvert);
-	medge= CustomData_add_layer(&edata, CD_MEDGE, CD_CALLOC, NULL, totedge);
-	mface= CustomData_add_layer(&fdata, CD_MFACE, CD_CALLOC, NULL, totface);
-
-	vertofs= 0;
-	edgeofs= 0;
-	faceofs= 0;
+	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);
+	mpoly = CustomData_add_layer(&pdata, CD_MPOLY, CD_CALLOC, NULL, totpoly);
+
+	vertofs = 0;
+	edgeofs = 0;
+	loopofs = 0;
+	polyofs = 0;
 	
 	/* inverse transform for all selected meshes in this object */
 	invert_m4_m4(imat, ob->obmat);
 	
-	CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+	CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases)
+	{
 		/* only join if this is a mesh */
-		if(base->object->type==OB_MESH) {
-			me= base->object->data;
+		if (base->object->type == OB_MESH) {
+			me = base->object->data;
 			
-			if(me->totvert) {
+			if (me->totvert) {
 				/* standard data */
 				CustomData_merge(&me->vdata, &vdata, CD_MASK_MESH, CD_DEFAULT, totvert);
 				CustomData_copy_data(&me->vdata, &vdata, 0, vertofs, me->totvert);
 				
 				/* vertex groups */
-				dvert= CustomData_get(&vdata, vertofs, CD_MDEFORMVERT);
+				dvert = CustomData_get(&vdata, vertofs, CD_MDEFORMVERT);
 				
 				/* NB: vertex groups here are new version */
-				if(dvert) {
-					for(i=0; i<me->totvert; i++) {
-						for(j=0; j<dvert[i].totweight; j++) {
+				if (dvert) {
+					for (i = 0; i < me->totvert; i++) {
+						for (j = 0; j < dvert[i].totweight; j++) {
 							/*	Find the old vertex group */
 							odg = BLI_findlink(&base->object->defbase, dvert[i].dw[j].def_nr);
-							if(odg) {
+							if (odg) {
 								/*	Search for a match in the new object, and set new index */
-								for(dg=ob->defbase.first, index=0; dg; dg=dg->next, index++) {
-									if(!strcmp(dg->name, odg->name)) {
+								for (dg = ob->defbase.first, index = 0; dg; dg = dg->next, index++) {
+									if (!strcmp(dg->name, odg->name)) {
 										dvert[i].dw[j].def_nr = index;
 										break;
 									}
@@ -325,12 +333,12 @@ int join_mesh_exec(bContext *C, wmOperator *op)
 				}
 				
 				/* if this is the object we're merging into, no need to do anything */
-				if(base->object != ob) {
+				if (base->object != ob) {
 					/* watch this: switch matmul order really goes wrong */
 					mult_m4_m4m4(cmat, imat, base->object->obmat);
 					
 					/* transform vertex coordinates into new space */
-					for(a=0, mv=mvert; a < me->totvert; a++, mv++) {
+					for (a = 0, mv = mvert; a < me->totvert; a++, mv++) {
 						mul_m4_v3(cmat, mv->co);
 					}
 					
@@ -338,27 +346,27 @@ int join_mesh_exec(bContext *C, wmOperator *op)
 					 *	- if there's a matching one, copy it across (will need to transform vertices into new space...)
 					 *	- otherwise, just copy own coordinates of mesh (no need to transform vertex coordinates into new space)
 					 */
-					if(key) {
+					if (key) {
 						/* if this mesh has any shapekeys, check first, otherwise just copy coordinates */
-						for(kb= key->block.first; kb; kb= kb->next) {
+						for (kb = key->block.first; kb; kb = kb->next) {
 							/* get pointer to where to write data for this mesh in shapekey's data array */
-							fp1= ((float *)kb->data) + (vertofs*3);	
+							fp1 = ((float *)kb->data) + (vertofs * 3);
 							
 							/* check if this mesh has such a shapekey */
-							okb= key_get_named_keyblock(me->key, kb->name);
-							if(okb) {
+							okb = key_get_named_keyblock(me->key, kb->name);
+							if (okb) {
 								/* copy this mesh's shapekey to the destination shapekey (need to transform first) */
-								fp2= ((float *)(okb->data));
-								for(a=0; a < me->totvert; a++, fp1+=3, fp2+=3) {
-									VECCOPY(fp1, fp2);
+								fp2 = ((float *)(okb->data));
+								for (a = 0; a < me->totvert; a++, fp1 += 3, fp2 += 3) {
+									copy_v3_v3(fp1, fp2);
 									mul_m4_v3(cmat, fp1);
 								}
 							}
 							else {
 								/* copy this mesh's vertex coordinates to the destination shapekey */
-								mv= mvert;
-								for(a=0; a < me->totvert; a++, fp1+=3, mv++) {
-									VECCOPY(fp1, mv->co);
+								mv = mvert;
+								for (a = 0; a < me->totvert; a++, fp1 += 3, mv++) {
+									copy_v3_v3(fp1, mv->co);
 								}
 							}
 						}
@@ -369,25 +377,25 @@ int join_mesh_exec(bContext *C, wmOperator *op)
 					 *	- if it was an 'original', copy the appropriate data from nkey
 					 *	- otherwise, copy across plain coordinates (no need to transform coordinates)
 					 */
-					if(key) {
-						for(kb= key->block.first; kb; kb= kb->next) {
+					if (key) {
+						for (kb = key->block.first; kb; kb = kb->next) {
 							/* get pointer to where to write data for this mesh in shapekey's data array */
-							fp1= ((float *)kb->data) + (vertofs*3);	
+							fp1 = ((float *)kb->data) + (vertofs * 3);
 							
 							/* check if this was one of the original shapekeys */
-							okb= key_get_named_keyblock(nkey, kb->name);
-							if(okb) {
+							okb = key_get_named_keyblock(nkey, kb->name);
+							if (okb) {
 								/* copy this mesh's shapekey to the destination shapekey */
-								fp2= ((float *)(okb->data));
-								for(a=0; a < me->totvert; a++, fp1+=3, fp2+=3) {
-									VECCOPY(fp1, fp2);
+								fp2 = ((float *)(okb->data));
+								for (a = 0; a < me->totvert; a++, fp1 += 3, fp2 += 3) {
+									copy_v3_v3(fp1, fp2);
 								}
 							}
 							else {
 								/* copy base-coordinates to the destination shapekey */
-								mv= mvert;
-								for(a=0; a < me->totvert; a++, fp1+=3, mv++) {
-									VECCOPY(fp1, mv->co);
+								mv = mvert;
+								for (a = 0; a < me->totvert; a++, fp1 += 3, mv++) {
+									copy_v3_v3(fp1, mv->co);
 								}
 							}
 						}
@@ -395,108 +403,114 @@ int join_mesh_exec(bContext *C, wmOperator *op)
 				}
 				
 				/* advance mvert pointer to end of base mesh's data */
-				mvert+= me->totvert;
+				mvert += me->totvert;
+			}
+			
+			if (me->totedge) {
+				CustomData_merge(&me->edata, &edata, CD_MASK_MESH, CD_DEFAULT, totedge);
+				CustomData_copy_data(&me->edata, &edata, 0, edgeofs, me->totedge);
+				
+				for (a = 0; a < me->totedge; a++, medge++) {
+					medge->v1 += vertofs;
+					medge->v2 += vertofs;
+				}
+			}
+
+			if (me->totloop) {
+				if (base->object != ob)
+					multiresModifier_prepare_join(scene, base->object, ob);
+				
+				CustomData_merge(&me->ldata, &ldata, CD_MASK_MESH, CD_DEFAULT, totloop);
+				CustomData_copy_data(&me->ldata, &ldata, 0, loopofs, me->totloop);
+				
+				for (a = 0; a < me->totloop; a++, mloop++) {
+					mloop->v += vertofs;
+					mloop->e += edgeofs;
+				}
 			}
 			
-			if(me->totface) {
+			if (me->totpoly) {
 				/* make mapping for materials */
-				for(a=1; a<=base->object->totcol; a++) {
-					ma= give_current_material(base->object, a);
+				for (a = 1; a <= base->object->totcol; a++) {
+					ma = give_current_material(base->object, a);
 
-					for(b=0; b<totcol; b++) {
-						if(ma == matar[b]) {
-							matmap[a-1]= b;
+					for (b = 0; b < totcol; b++) {
+						if (ma == matar[b]) {
+							matmap[a - 1] = b;
 							break;
 						}
 					}
 				}
 				
-				if(base->object!=ob)
-					multiresModifier_prepare_join(scene, base->object, ob);
-
-				CustomData_merge(&me->fdata, &fdata, CD_MASK_MESH, CD_DEFAULT, totface);
-				CustomData_copy_data(&me->fdata, &fdata, 0, faceofs, me->totface);
+				CustomData_merge(&me->pdata, &pdata, CD_MASK_MESH, CD_DEFAULT, totpoly);
+				CustomData_copy_data(&me->pdata, &pdata, 0, polyofs, me->totpoly);
 				
-				for(a=0; a<me->totface; a++, mface++) {
-					mface->v1+= vertofs;
-					mface->v2+= vertofs;
-					mface->v3+= vertofs;
-					if(mface->v4) mface->v4+= vertofs;
-					
-					if (matmap)
-						mface->mat_nr= matmap[(int)mface->mat_nr];
-					else 
-						mface->mat_nr= 0;
+				for (a = 0; a < me->totpoly; a++, mpoly++) {
+					mpoly->loopstart += loopofs;
+					mpoly->mat_nr = matmap ? matmap[(int)mpoly->mat_nr] : 0;
 				}
 				
-				faceofs += me->totface;
+				polyofs += me->totpoly;
 			}
-			
-			if(me->totedge) {
-				CustomData_merge(&me->edata, &edata, CD_MASK_MESH, CD_DEFAULT, totedge);
-				CustomData_copy_data(&me->edata, &edata, 0, edgeofs, me->totedge);
-				
-				for(a=0; a<me->totedge; a++, medge++) {
-					medge->v1+= vertofs;
-					medge->v2+= vertofs;
-				}
-				
-				edgeofs += me->totedge;
-			}
-			
-			/* vertofs is used to help newly added verts be reattached to their edge/face 
-			 * (cannot be set earlier, or else reattaching goes wrong)
+
+			/* these are used for relinking (cannot be set earlier, 
+			 * or else reattaching goes wrong)
 			 */
 			vertofs += me->totvert;
+			edgeofs += me->totedge;
+			loopofs += me->totloop;
 			
 			/* free base, now that data is merged */
-			if(base->object != ob)
+			if (base->object != ob)
 				ED_base_object_free_and_unlink(bmain, scene, base);
 		}
 	}
 	CTX_DATA_END;
 	
 	/* return to mesh we're merging to */
-	me= ob->data;
+	me = ob->data;
 	
 	CustomData_free(&me->vdata, me->totvert);
 	CustomData_free(&me->edata, me->totedge);
-	CustomData_free(&me->fdata, me->totface);
+	CustomData_free(&me->ldata, me->totloop);
+	CustomData_free(&me->pdata, me->totpoly);
 
-	me->totvert= totvert;
-	me->totedge= totedge;
-	me->totface= totface;
-	
-	me->vdata= vdata;
-	me->edata= edata;
-	me->fdata= fdata;
+	me->totvert = totvert;
+	me->totedge = totedge;
+	me->totloop = totloop;
+	me->totpoly = totpoly;
+
+	me->vdata = vdata;
+	me->edata = edata;
+	me->ldata = ldata;
+	me->pdata = pdata;
 
-	mesh_update_customdata_pointers(me);
+	mesh_update_customdata_pointers(me, TRUE); /* BMESH_TODO, check if this arg can be failse, non urgent - campbell */
 	
 	/* old material array */
-	for(a=1; a<=ob->totcol; a++) {
-		ma= ob->mat[a-1];
-		if(ma) ma->id.us--;
+	for (a = 1; a <= ob->totcol; a++) {
+		ma = ob->mat[a - 1];
+		if (ma) ma->id.us--;
 	}
-	for(a=1; a<=me->totcol; a++) {
-		ma= me->mat[a-1];
-		if(ma) ma->id.us--;
+	for (a = 1; a <= me->totcol; a++) {
+		ma = me->mat[a - 1];
+		if (ma) ma->id.us--;
 	}
-	if(ob->mat) MEM_freeN(ob->mat);
-	if(ob->matbits) MEM_freeN(ob->matbits);
-	if(me->mat) MEM_freeN(me->mat);
-	ob->mat= me->mat= NULL;
-	ob->matbits= NULL;
+	if (ob->mat) MEM_freeN(ob->mat);
+	if (ob->matbits) MEM_freeN(ob->matbits);
+	if (me->mat) MEM_freeN(me->mat);
+	ob->mat = me->mat = NULL;
+	ob->matbits = NULL;
 	
-	if(totcol) {
-		me->mat= matar;
-		ob->mat= MEM_callocN(sizeof(void *)*totcol, "join obmatar");
-		ob->matbits= MEM_callocN(sizeof(char)*totcol, "join obmatbits");
+	if (totcol) {
+		me->mat = matar;
+		ob->mat = MEM_callocN(sizeof(void *) * totcol, "join obmatar");
+		ob->matbits = MEM_callocN(sizeof(char) * totcol, "join obmatbits");
 	}
 	else
 		MEM_freeN(matar);
 	
-	ob->totcol= me->totcol= totcol;
+	ob->totcol = me->totcol = totcol;
 
 	if (matmap) MEM_freeN(matmap);
 	
@@ -504,11 +518,11 @@ int join_mesh_exec(bContext *C, wmOperator *op)
 	test_object_materials((ID *)me);
 	
 	/* free temp copy of destination shapekeys (if applicable) */
-	if(nkey) {
+	if (nkey) {
 		// XXX 2.5 Animato
 #if 0
 		/* free it's ipo too - both are not actually freed from memory yet as ID-blocks */
-		if(nkey->ipo) {
+		if (nkey->ipo) {
 			free_ipo(nkey->ipo);
 			BLI_remlink(&bmain->ipo, nkey->ipo);
 			MEM_freeN(nkey->ipo);
@@ -520,21 +534,21 @@ int join_mesh_exec(bContext *C, wmOperator *op)
 		MEM_freeN(nkey);
 	}
 	
-	DAG_scene_sort(bmain, scene);	// removed objects, need to rebuild dag before editmode call
+	DAG_scene_sort(bmain, scene);   // removed objects, need to rebuild dag before editmode call
 
 #if 0
 	ED_object_enter_editmode(C, EM_WAITCURSOR);
-	ED_object_exit_editmode(C, EM_FREEDATA|EM_WAITCURSOR|EM_DO_UNDO);
+	ED_object_exit_editmode(C, EM_FREEDATA | EM_WAITCURSOR | EM_DO_UNDO);
 #else
 	/* toggle editmode using lower level functions so this can be called from python */
-	make_editMesh(scene, ob);
-	load_editMesh(scene, ob);
-	free_editMesh(me->edit_mesh);
-	MEM_freeN(me->edit_mesh);
-	me->edit_mesh= NULL;
-	DAG_id_tag_update(&ob->id, OB_RECALC_OB|OB_RECALC_DATA);
+	EDBM_mesh_make(scene->toolsettings, scene, ob);
+	EDBM_mesh_load(ob);
+	EDBM_mesh_free(me->edit_btmesh);
+	MEM_freeN(me->edit_btmesh);
+	me->edit_btmesh = NULL;
+	DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA);
 #endif
-	WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
 
 	return OPERATOR_FINISHED;
 }
@@ -542,29 +556,29 @@ int join_mesh_exec(bContext *C, wmOperator *op)
 /*********************** JOIN AS SHAPES ***************************/
 
 /* Append selected meshes vertex locations as shapes of the active mesh, 
-  return 0 if no join is made (error) and 1 of the join is done */
+ * return 0 if no join is made (error) and 1 of the join is done */
 
 int join_mesh_shapes_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Object *ob= CTX_data_active_object(C);
-	Mesh *me= (Mesh *)ob->data;
-	Mesh *selme=NULL;
-	DerivedMesh *dm=NULL;
-	Key *key=me->key;
+	Scene *scene = CTX_data_scene(C);
+	Object *ob = CTX_data_active_object(C);
+	Mesh *me = (Mesh *)ob->data;
+	Mesh *selme = NULL;
+	DerivedMesh *dm = NULL;
+	Key *key = me->key;
 	KeyBlock *kb;
-	int ok=0, nonequal_verts=0;
+	int ok = 0, nonequal_verts = 0;
 	
-	CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+	CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases) {
 		if (base->object == ob) continue;
 		
-		if (base->object->type==OB_MESH) {
+		if (base->object->type == OB_MESH) {
 			selme = (Mesh *)base->object->data;
 			
-			if (selme->totvert==me->totvert)
+			if (selme->totvert == me->totvert)
 				ok++;
 			else
-				nonequal_verts=1;
+				nonequal_verts = 1;
 		}
 	}
 	CTX_DATA_END;
@@ -577,28 +591,29 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op)
 		return OPERATOR_CANCELLED;
 	}
 	
-	if(key == NULL) {
-		key= me->key= add_key((ID *)me);
-		key->type= KEY_RELATIVE;
+	if (key == NULL) {
+		key = me->key = add_key((ID *)me);
+		key->type = KEY_RELATIVE;
 
-		/* first key added, so it was the basis. initialise it with the existing mesh */
-		kb= add_keyblock(key, NULL);
+		/* first key added, so it was the basis. initialize it with the existing mesh */
+		kb = add_keyblock(key, NULL);
 		mesh_to_key(me, kb);
 	}
 	
 	/* now ready to add new keys from selected meshes */
-	CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
+	CTX_DATA_BEGIN(C, Base *, base, selected_editable_bases)
+	{
 		if (base->object == ob) continue;
 		
-		if(base->object->type==OB_MESH) {
+		if (base->object->type == OB_MESH) {
 			selme = (Mesh *)base->object->data;
 			
-			if (selme->totvert==me->totvert) {
+			if (selme->totvert == me->totvert) {
 				dm = mesh_get_derived_deform(scene, base->object, CD_MASK_BAREMESH);
 				
 				if (!dm) continue;
 					
-				kb= add_keyblock(key, base->object->id.name+2);
+				kb = add_keyblock(key, base->object->id.name + 2);
 				
 				DM_to_meshkey(dm, me, kb);
 				
@@ -608,7 +623,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op)
 	}
 	CTX_DATA_END;
 	
-	WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
 	
 	return OPERATOR_FINISHED;
 }
@@ -617,9 +632,9 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op)
 
 /* important note; this is unfinished, needs better API for editmode, and custom threshold */
 
-#define MOC_RES			8
-#define MOC_NODE_RES	8
-#define MOC_THRESH		0.00002f
+#define MOC_RES         8
+#define MOC_NODE_RES    8
+#define MOC_THRESH      0.00002f
 
 typedef struct MocNode {
 	struct MocNode *next;
@@ -630,30 +645,30 @@ static int mesh_octree_get_base_offs(float *co, float *offs, float *div)
 {
 	int vx, vy, vz;
 	
-	vx= floor( (co[0]-offs[0])/div[0] );
-	vy= floor( (co[1]-offs[1])/div[1] );
-	vz= floor( (co[2]-offs[2])/div[2] );
-	
-	CLAMP(vx, 0, MOC_RES-1);
-	CLAMP(vy, 0, MOC_RES-1);
-	CLAMP(vz, 0, MOC_RES-1);
+	vx = floor( (co[0] - offs[0]) / div[0]);
+	vy = floor( (co[1] - offs[1]) / div[1]);
+	vz = floor( (co[2] - offs[2]) / div[2]);
+
+	CLAMP(vx, 0, MOC_RES - 1);
+	CLAMP(vy, 0, MOC_RES - 1);
+	CLAMP(vz, 0, MOC_RES - 1);
 
-	return (vx*MOC_RES*MOC_RES) + vy*MOC_RES + vz;
+	return (vx * MOC_RES * MOC_RES) + vy * MOC_RES + vz;
 }
 
 static void mesh_octree_add_node(MocNode **bt, intptr_t index)
 {
-	if(*bt==NULL) {
-		*bt= MEM_callocN(sizeof(MocNode), "MocNode");
-		(*bt)->index[0]= index;
+	if (*bt == NULL) {
+		*bt = MEM_callocN(sizeof(MocNode), "MocNode");
+		(*bt)->index[0] = index;
 	}
 	else {
 		int a;
-		for(a=0; a<MOC_NODE_RES; a++) {
-			if((*bt)->index[a]==index)
+		for (a = 0; a < MOC_NODE_RES; a++) {
+			if ((*bt)->index[a] == index)
 				return;
-			else if((*bt)->index[a]==0) {
-				(*bt)->index[a]= index;
+			else if ((*bt)->index[a] == 0) {
+				(*bt)->index[a] = index;
 				return;
 			}
 		}
@@ -663,7 +678,7 @@ static void mesh_octree_add_node(MocNode **bt, intptr_t index)
 
 static void mesh_octree_free_node(MocNode **bt)
 {
-	if( (*bt)->next ) {
+	if ( (*bt)->next) {
 		mesh_octree_free_node(&(*bt)->next);
 	}
 	MEM_freeN(*bt);
@@ -671,52 +686,52 @@ static void mesh_octree_free_node(MocNode **bt)
 
 
 /* temporal define, just to make nicer code below */
-#define MOC_INDEX(vx, vy, vz)  (((vx)*MOC_RES*MOC_RES) + (vy)*MOC_RES + (vz))
+#define MOC_INDEX(vx, vy, vz)  (((vx) * MOC_RES * MOC_RES) + (vy) * MOC_RES + (vz))
 
 static void mesh_octree_add_nodes(MocNode **basetable, float *co, float *offs, float *div, intptr_t index)
 {
 	float fx, fy, fz;
 	int vx, vy, vz;
 	
-	if ( !finite(co[0]) ||
-	     !finite(co[1]) ||
-	     !finite(co[2]))
+	if (!finite(co[0]) ||
+	    !finite(co[1]) ||
+	    !finite(co[2]))
 	{
 		return;
 	}
 	
-	fx= (co[0]-offs[0])/div[0];
-	fy= (co[1]-offs[1])/div[1];
-	fz= (co[2]-offs[2])/div[2];
-	CLAMP(fx, 0.0f, MOC_RES-MOC_THRESH);
-	CLAMP(fy, 0.0f, MOC_RES-MOC_THRESH);
-	CLAMP(fz, 0.0f, MOC_RES-MOC_THRESH);
-	
-	vx= (int)floorf(fx);
-	vy= (int)floorf(fy);
-	vz= (int)floorf(fz);
+	fx = (co[0] - offs[0]) / div[0];
+	fy = (co[1] - offs[1]) / div[1];
+	fz = (co[2] - offs[2]) / div[2];
+	CLAMP(fx, 0.0f, MOC_RES - MOC_THRESH);
+	CLAMP(fy, 0.0f, MOC_RES - MOC_THRESH);
+	CLAMP(fz, 0.0f, MOC_RES - MOC_THRESH);
+
+	vx = (int)floorf(fx);
+	vy = (int)floorf(fy);
+	vz = (int)floorf(fz);
 
 	mesh_octree_add_node(basetable + MOC_INDEX(vx, vy, vz), index);
 
 	if (vx > 0)
-		if (fx-((float)vx)-MOC_THRESH < 0.0f)
+		if (fx - ((float)vx) - MOC_THRESH < 0.0f)
 			mesh_octree_add_node(basetable + MOC_INDEX(vx - 1, vy, vz), index);
 	if (vx < MOC_RES - 2)
-		if (fx-((float)vx)+MOC_THRESH > 1.0f)
+		if (fx - ((float)vx) + MOC_THRESH > 1.0f)
 			mesh_octree_add_node(basetable + MOC_INDEX(vx + 1, vy, vz), index);
 
 	if (vy > 0)
-		if (fy-((float)vy)-MOC_THRESH < 0.0f)
+		if (fy - ((float)vy) - MOC_THRESH < 0.0f)
 			mesh_octree_add_node(basetable + MOC_INDEX(vx, vy - 1, vz), index);
 	if (vy < MOC_RES - 2)
-		if (fy-((float)vy)+MOC_THRESH > 1.0f)
+		if (fy - ((float)vy) + MOC_THRESH > 1.0f)
 			mesh_octree_add_node(basetable + MOC_INDEX(vx, vy + 1, vz), index);
 
 	if (vz > 0)
-		if (fz-((float)vz)-MOC_THRESH < 0.0f)
+		if (fz - ((float)vz) - MOC_THRESH < 0.0f)
 			mesh_octree_add_node(basetable + MOC_INDEX(vx, vy, vz - 1), index);
-	if (vz <MOC_RES - 2)
-		if (fz-((float)vz)+MOC_THRESH > 1.0f)
+	if (vz < MOC_RES - 2)
+		if (fz - ((float)vz) + MOC_THRESH > 1.0f)
 			mesh_octree_add_node(basetable + MOC_INDEX(vx, vy, vz + 1), index);
 
 }
@@ -726,26 +741,26 @@ static intptr_t mesh_octree_find_index(MocNode **bt, MVert *mvert, float *co)
 	float *vec;
 	int a;
 	
-	if(*bt==NULL)
+	if (*bt == NULL)
 		return -1;
 	
-	for(a=0; a<MOC_NODE_RES; a++) {
-		if((*bt)->index[a]) {
+	for (a = 0; a < MOC_NODE_RES; a++) {
+		if ((*bt)->index[a]) {
 			/* does mesh verts and editmode, code looks potential dangerous, octree should really be filled OK! */
-			if(mvert) {
-				vec= (mvert+(*bt)->index[a]-1)->co;
-				if(compare_v3v3(vec, co, MOC_THRESH))
-					return (*bt)->index[a]-1;
+			if (mvert) {
+				vec = (mvert + (*bt)->index[a] - 1)->co;
+				if (compare_v3v3(vec, co, MOC_THRESH))
+					return (*bt)->index[a] - 1;
 			}
 			else {
-				EditVert *eve= (EditVert *)((*bt)->index[a]);
-				if(compare_v3v3(eve->co, co, MOC_THRESH))
+				BMVert *eve = (BMVert *)((*bt)->index[a]);
+				if (compare_v3v3(eve->co, co, MOC_THRESH))
 					return (*bt)->index[a];
 			}
 		}
 		else return -1;
 	}
-	if( (*bt)->next)
+	if ( (*bt)->next)
 		return mesh_octree_find_index(&(*bt)->next, mvert, co);
 	
 	return -1;
@@ -758,71 +773,74 @@ static struct {
 
 /* mode is 's' start, or 'e' end, or 'u' use */
 /* if end, ob can be NULL */
-intptr_t mesh_octree_table(Object *ob, EditMesh *em, float *co, char mode)
+intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, float *co, char mode)
 {
 	MocNode **bt;
 	
-	if(mode=='u') {		/* use table */
-		if(MeshOctree.table==NULL)
+	if (mode == 'u') {        /* use table */
+		if (MeshOctree.table == NULL)
 			mesh_octree_table(ob, em, NULL, 's');
 
-		if(MeshOctree.table) {
-			Mesh *me= ob->data;
-			bt= MeshOctree.table + mesh_octree_get_base_offs(co, MeshOctree.offs, MeshOctree.div);
-			if(em)
+		if (MeshOctree.table) {
+			Mesh *me = ob->data;
+			bt = MeshOctree.table + mesh_octree_get_base_offs(co, MeshOctree.offs, MeshOctree.div);
+			if (em)
 				return mesh_octree_find_index(bt, NULL, co);
 			else
 				return mesh_octree_find_index(bt, me->mvert, co);
 		}
 		return -1;
 	}
-	else if(mode=='s') {	/* start table */
-		Mesh *me= ob->data;
+	else if (mode == 's') {   /* start table */
+		Mesh *me = ob->data;
 		float min[3], max[3];
 
 		/* we compute own bounding box and don't reuse ob->bb because
 		 * we are using the undeformed coordinates*/
 		INIT_MINMAX(min, max);
 
-		if(em && me->edit_mesh==em) {
-			EditVert *eve;
+		if (em && me->edit_btmesh == em) {
+			BMIter iter;
+			BMVert *eve;
 			
-			for(eve= em->verts.first; eve; eve= eve->next)
-				DO_MINMAX(eve->co, min, max)
+			BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+				DO_MINMAX(eve->co, min, max);
+			}
 		}
 		else {		
 			MVert *mvert;
 			int a;
 			
-			for(a=0, mvert= me->mvert; a<me->totvert; a++, mvert++)
+			for (a = 0, mvert = me->mvert; a < me->totvert; a++, mvert++)
 				DO_MINMAX(mvert->co, min, max);
 		}
 		
 		/* for quick unit coordinate calculus */
-		VECCOPY(MeshOctree.offs, min);
-		MeshOctree.offs[0]-= MOC_THRESH;		/* we offset it 1 threshold unit extra */
-		MeshOctree.offs[1]-= MOC_THRESH;
-		MeshOctree.offs[2]-= MOC_THRESH;
+		copy_v3_v3(MeshOctree.offs, min);
+		MeshOctree.offs[0] -= MOC_THRESH;        /* we offset it 1 threshold unit extra */
+		MeshOctree.offs[1] -= MOC_THRESH;
+		MeshOctree.offs[2] -= MOC_THRESH;
 		
 		sub_v3_v3v3(MeshOctree.div, max, min);
-		MeshOctree.div[0]+= 2*MOC_THRESH;	/* and divide with 2 threshold unit more extra (try 8x8 unit grid on paint) */
-		MeshOctree.div[1]+= 2*MOC_THRESH;
-		MeshOctree.div[2]+= 2*MOC_THRESH;
-		
-		mul_v3_fl(MeshOctree.div, 1.0f/MOC_RES);
-		if(MeshOctree.div[0]==0.0f) MeshOctree.div[0]= 1.0f;
-		if(MeshOctree.div[1]==0.0f) MeshOctree.div[1]= 1.0f;
-		if(MeshOctree.div[2]==0.0f) MeshOctree.div[2]= 1.0f;
+		MeshOctree.div[0] += 2 * MOC_THRESH;   /* and divide with 2 threshold unit more extra (try 8x8 unit grid on paint) */
+		MeshOctree.div[1] += 2 * MOC_THRESH;
+		MeshOctree.div[2] += 2 * MOC_THRESH;
+
+		mul_v3_fl(MeshOctree.div, 1.0f / MOC_RES);
+		if (MeshOctree.div[0] == 0.0f) MeshOctree.div[0] = 1.0f;
+		if (MeshOctree.div[1] == 0.0f) MeshOctree.div[1] = 1.0f;
+		if (MeshOctree.div[2] == 0.0f) MeshOctree.div[2] = 1.0f;
 			
-		if(MeshOctree.table) /* happens when entering this call without ending it */
+		if (MeshOctree.table) /* happens when entering this call without ending it */
 			mesh_octree_table(ob, em, co, 'e');
 		
-		MeshOctree.table= MEM_callocN(MOC_RES*MOC_RES*MOC_RES*sizeof(void *), "sym table");
+		MeshOctree.table = MEM_callocN(MOC_RES * MOC_RES * MOC_RES * sizeof(void *), "sym table");
 		
-		if(em && me->edit_mesh==em) {
-			EditVert *eve;
+		if (em && me->edit_btmesh == em) {
+			BMVert *eve;
+			BMIter iter;
 
-			for(eve= em->verts.first; eve; eve= eve->next) {
+			BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
 				mesh_octree_add_nodes(MeshOctree.table, eve->co, MeshOctree.offs, MeshOctree.div, (intptr_t)(eve));
 			}
 		}
@@ -830,40 +848,40 @@ intptr_t mesh_octree_table(Object *ob, EditMesh *em, float *co, char mode)
 			MVert *mvert;
 			int a;
 			
-			for(a=0, mvert= me->mvert; a<me->totvert; a++, mvert++)
-				mesh_octree_add_nodes(MeshOctree.table, mvert->co, MeshOctree.offs, MeshOctree.div, a+1);
+			for (a = 0, mvert = me->mvert; a < me->totvert; a++, mvert++)
+				mesh_octree_add_nodes(MeshOctree.table, mvert->co, MeshOctree.offs, MeshOctree.div, a + 1);
 		}
 	}
-	else if(mode=='e') { /* end table */
-		if(MeshOctree.table) {
+	else if (mode == 'e') { /* end table */
+		if (MeshOctree.table) {
 			int a;
 			
-			for(a=0, bt=MeshOctree.table; a<MOC_RES*MOC_RES*MOC_RES; a++, bt++) {
-				if(*bt) mesh_octree_free_node(bt);
+			for (a = 0, bt = MeshOctree.table; a < MOC_RES * MOC_RES * MOC_RES; a++, bt++) {
+				if (*bt) mesh_octree_free_node(bt);
 			}
 			MEM_freeN(MeshOctree.table);
-			MeshOctree.table= NULL;
+			MeshOctree.table = NULL;
 		}
 	}
 	return 0;
 }
 
-MirrTopoStore_t mesh_topo_store= {NULL, -1. -1, -1};
+MirrTopoStore_t mesh_topo_store = {NULL, -1. - 1, -1};
 
 /* mode is 's' start, or 'e' end, or 'u' use */
 /* if end, ob can be NULL */
 /* note, is supposed return -1 on error, which callers are currently checking for, but is not used so far */
 int mesh_mirrtopo_table(Object *ob, char mode)
 {
-	if(mode=='u') {		/* use table */
+	if (mode == 'u') {        /* use table */
 		if (ED_mesh_mirrtopo_recalc_check(ob->data, ob->mode, &mesh_topo_store)) {
 			mesh_mirrtopo_table(ob, 's');
 		}
 	}
-	else if(mode=='s') { /* start table */
+	else if (mode == 's') { /* start table */
 		ED_mesh_mirrtopo_init(ob->data, ob->mode, &mesh_topo_store, FALSE);
 	}
-	else if(mode=='e') { /* end table */
+	else if (mode == 'e') { /* end table */
 		ED_mesh_mirrtopo_free(&mesh_topo_store);
 	}
 	return 0;
@@ -871,21 +889,21 @@ int mesh_mirrtopo_table(Object *ob, char mode)
 
 static int mesh_get_x_mirror_vert_spacial(Object *ob, int index)
 {
-	Mesh *me= ob->data;
+	Mesh *me = ob->data;
 	MVert *mvert;
 	float vec[3];
 	
-	mvert= me->mvert+index;
-	vec[0]= -mvert->co[0];
-	vec[1]= mvert->co[1];
-	vec[2]= mvert->co[2];
+	mvert = me->mvert + index;
+	vec[0] = -mvert->co[0];
+	vec[1] = mvert->co[1];
+	vec[2] = mvert->co[2];
 	
 	return mesh_octree_table(ob, NULL, vec, 'u');
 }
 
 static int mesh_get_x_mirror_vert_topo(Object *ob, int index)
 {
-	if (mesh_mirrtopo_table(ob, 'u')==-1)
+	if (mesh_mirrtopo_table(ob, 'u') == -1)
 		return -1;
 
 	return mesh_topo_store.index_lookup[index];
@@ -895,66 +913,77 @@ int mesh_get_x_mirror_vert(Object *ob, int index)
 {
 	if (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_TOPO) {
 		return mesh_get_x_mirror_vert_topo(ob, index);
-	} else {
+	}
+	else {
 		return mesh_get_x_mirror_vert_spacial(ob, index);
 	}
+	return 0;
 }
 
-static EditVert *editmesh_get_x_mirror_vert_spacial(Object *ob, EditMesh *em, float *co)
+static BMVert *editbmesh_get_x_mirror_vert_spacial(Object *ob, BMEditMesh *em, float *co)
 {
 	float vec[3];
 	intptr_t poinval;
 	
 	/* ignore nan verts */
 	if (!finite(co[0]) ||
-		!finite(co[1]) ||
-		!finite(co[2])
-	   )
+	    !finite(co[1]) ||
+	    !finite(co[2])
+	    )
 		return NULL;
 	
-	vec[0]= -co[0];
-	vec[1]= co[1];
-	vec[2]= co[2];
+	vec[0] = -co[0];
+	vec[1] = co[1];
+	vec[2] = co[2];
 	
-	poinval= mesh_octree_table(ob, em, vec, 'u');
-	if(poinval != -1)
-		return (EditVert *)(poinval);
+	poinval = mesh_octree_table(ob, em, vec, 'u');
+	if (poinval != -1)
+		return (BMVert *)(poinval);
 	return NULL;
 }
 
-static EditVert *editmesh_get_x_mirror_vert_topo(Object *ob, struct EditMesh *em, EditVert *eve, int index)
+static BMVert *editbmesh_get_x_mirror_vert_topo(Object *ob, struct BMEditMesh *em, BMVert *eve, int index)
 {
 	intptr_t poinval;
-	if (mesh_mirrtopo_table(ob, 'u')==-1)
+	if (mesh_mirrtopo_table(ob, 'u') == -1)
 		return NULL;
 
 	if (index == -1) {
-		index = BLI_findindex(&em->verts, eve);
-
-		if (index == -1) {
+		BMIter iter;
+		BMVert *v;
+		
+		index = 0;
+		BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) {
+			if (v == eve)
+				break;
+			index++;
+		}
+		
+		if (index == em->bm->totvert) {
 			return NULL;
 		}
 	}
 
-	poinval= mesh_topo_store.index_lookup[index];
+	poinval = mesh_topo_store.index_lookup[index];
 
-	if(poinval != -1)
-		return (EditVert *)(poinval);
+	if (poinval != -1)
+		return (BMVert *)(poinval);
 	return NULL;
 }	
 
-EditVert *editmesh_get_x_mirror_vert(Object *ob, struct EditMesh *em, EditVert *eve, float *co, int index)
+BMVert *editbmesh_get_x_mirror_vert(Object *ob, struct BMEditMesh *em, BMVert *eve, float *co, int index)
 {
 	if (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_TOPO) {
-		return editmesh_get_x_mirror_vert_topo(ob, em, eve, index);
-	} else {
-		return editmesh_get_x_mirror_vert_spacial(ob, em, co);
+		return editbmesh_get_x_mirror_vert_topo(ob, em, eve, index);
+	}
+	else {
+		return editbmesh_get_x_mirror_vert_spacial(ob, em, co);
 	}
 }
 
-
 #if 0
-float *editmesh_get_mirror_uv(int axis, float *uv, float *mirrCent, float *face_cent)
+
+static float *editmesh_get_mirror_uv(BMEditMesh *em, int axis, float *uv, float *mirrCent, float *face_cent)
 {
 	float vec[2];
 	float cent_vec[2];
@@ -962,37 +991,42 @@ float *editmesh_get_mirror_uv(int axis, float *uv, float *mirrCent, float *face_
 
 	/* ignore nan verts */
 	if (isnan(uv[0]) || !finite(uv[0]) ||
-		isnan(uv[1]) || !finite(uv[1])
-	   )
+	    isnan(uv[1]) || !finite(uv[1])
+	    )
 		return NULL;
 
 	if (axis) {
-		vec[0]= uv[0];
-		vec[1]= -((uv[1])-mirrCent[1]) + mirrCent[1];
+		vec[0] = uv[0];
+		vec[1] = -((uv[1]) - mirrCent[1]) + mirrCent[1];
 
 		cent_vec[0] = face_cent[0];
-		cent_vec[1]= -((face_cent[1])-mirrCent[1]) + mirrCent[1];
-	} else {
-		vec[0]= -((uv[0])-mirrCent[0]) + mirrCent[0];
-		vec[1]= uv[1];
+		cent_vec[1] = -((face_cent[1]) - mirrCent[1]) + mirrCent[1];
+	}
+	else {
+		vec[0] = -((uv[0]) - mirrCent[0]) + mirrCent[0];
+		vec[1] = uv[1];
 
-		cent_vec[0]= -((face_cent[0])-mirrCent[0]) + mirrCent[0];
+		cent_vec[0] = -((face_cent[0]) - mirrCent[0]) + mirrCent[0];
 		cent_vec[1] = face_cent[1];
 	}
 
 	/* TODO - Optimize */
 	{
-		EditFace *efa;
-		int i, len;
-		for(efa=em->faces.first; efa; efa=efa->next) {
-			MTFace *tf= (MTFace *)CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-			uv_center(tf->uv, cent, (void *)efa->v4);
-
+		BMIter iter;
+		BMFace *efa;
+		
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			poly_uv_center(em, efa, cent);
+			
 			if ( (fabs(cent[0] - cent_vec[0]) < 0.001) && (fabs(cent[1] - cent_vec[1]) < 0.001) ) {
-				len = efa->v4 ? 4 : 3;
-				for (i=0; i<len; i++) {
-					if ( (fabs(tf->uv[i][0] - vec[0]) < 0.001) && (fabs(tf->uv[i][1] - vec[1]) < 0.001) ) {
-						return tf->uv[i];
+				BMIter liter;
+				BMLoop *l;
+				
+				BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+					MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+					if ( (fabs(luv->uv[0] - vec[0]) < 0.001) && (fabs(luv->uv[1] - vec[1]) < 0.001) ) {
+						return luv->uv;
+								
 					}
 				}
 			}
@@ -1001,43 +1035,44 @@ float *editmesh_get_mirror_uv(int axis, float *uv, float *mirrCent, float *face_
 
 	return NULL;
 }
+
 #endif
 
 static unsigned int mirror_facehash(const void *ptr)
 {
-	const MFace *mf= ptr;
+	const MFace *mf = ptr;
 	int v0, v1;
 
-	if(mf->v4) {
-		v0= MIN4(mf->v1, mf->v2, mf->v3, mf->v4);
-		v1= MAX4(mf->v1, mf->v2, mf->v3, mf->v4);
+	if (mf->v4) {
+		v0 = MIN4(mf->v1, mf->v2, mf->v3, mf->v4);
+		v1 = MAX4(mf->v1, mf->v2, mf->v3, mf->v4);
 	}
 	else {
-		v0= MIN3(mf->v1, mf->v2, mf->v3);
-		v1= MAX3(mf->v1, mf->v2, mf->v3);
+		v0 = MIN3(mf->v1, mf->v2, mf->v3);
+		v1 = MAX3(mf->v1, mf->v2, mf->v3);
 	}
 
-	return ((v0*39)^(v1*31));
+	return ((v0 * 39) ^ (v1 * 31));
 }
 
 static int mirror_facerotation(MFace *a, MFace *b)
 {
-	if(b->v4) {
-		if(a->v1==b->v1 && a->v2==b->v2 && a->v3==b->v3 && a->v4==b->v4)
+	if (b->v4) {
+		if (a->v1 == b->v1 && a->v2 == b->v2 && a->v3 == b->v3 && a->v4 == b->v4)
 			return 0;
-		else if(a->v4==b->v1 && a->v1==b->v2 && a->v2==b->v3 && a->v3==b->v4)
+		else if (a->v4 == b->v1 && a->v1 == b->v2 && a->v2 == b->v3 && a->v3 == b->v4)
 			return 1;
-		else if(a->v3==b->v1 && a->v4==b->v2 && a->v1==b->v3 && a->v2==b->v4)
+		else if (a->v3 == b->v1 && a->v4 == b->v2 && a->v1 == b->v3 && a->v2 == b->v4)
 			return 2;
-		else if(a->v2==b->v1 && a->v3==b->v2 && a->v4==b->v3 && a->v1==b->v4)
+		else if (a->v2 == b->v1 && a->v3 == b->v2 && a->v4 == b->v3 && a->v1 == b->v4)
 			return 3;
 	}
 	else {
-		if(a->v1==b->v1 && a->v2==b->v2 && a->v3==b->v3)
+		if (a->v1 == b->v1 && a->v2 == b->v2 && a->v3 == b->v3)
 			return 0;
-		else if(a->v3==b->v1 && a->v1==b->v2 && a->v2==b->v3)
+		else if (a->v3 == b->v1 && a->v1 == b->v2 && a->v2 == b->v3)
 			return 1;
-		else if(a->v2==b->v1 && a->v3==b->v2 && a->v1==b->v3)
+		else if (a->v2 == b->v1 && a->v3 == b->v2 && a->v1 == b->v3)
 			return 2;
 	}
 	
@@ -1046,51 +1081,52 @@ static int mirror_facerotation(MFace *a, MFace *b)
 
 static int mirror_facecmp(const void *a, const void *b)
 {
-	return (mirror_facerotation((MFace*)a, (MFace*)b) == -1);
+	return (mirror_facerotation((MFace *)a, (MFace *)b) == -1);
 }
 
-int *mesh_get_x_mirror_faces(Object *ob, EditMesh *em)
+/* BMESH_TODO, convert to MPoly (functions above also) */
+int *mesh_get_x_mirror_faces(Object *ob, BMEditMesh *em)
 {
-	Mesh *me= ob->data;
-	MVert *mv, *mvert= me->mvert;
-	MFace mirrormf, *mf, *hashmf, *mface= me->mface;
+	Mesh *me = ob->data;
+	MVert *mv, *mvert = me->mvert;
+	MFace mirrormf, *mf, *hashmf, *mface = me->mface;
 	GHash *fhash;
 	int *mirrorverts, *mirrorfaces;
 	int a;
 
-	mirrorverts= MEM_callocN(sizeof(int)*me->totvert, "MirrorVerts");
-	mirrorfaces= MEM_callocN(sizeof(int)*2*me->totface, "MirrorFaces");
+	mirrorverts = MEM_callocN(sizeof(int) * me->totvert, "MirrorVerts");
+	mirrorfaces = MEM_callocN(sizeof(int) * 2 * me->totface, "MirrorFaces");
 
 	mesh_octree_table(ob, em, NULL, 's');
 
-	for(a=0, mv=mvert; a<me->totvert; a++, mv++)
-		mirrorverts[a]= mesh_get_x_mirror_vert(ob, a);
+	for (a = 0, mv = mvert; a < me->totvert; a++, mv++)
+		mirrorverts[a] = mesh_get_x_mirror_vert(ob, a);
 
 	mesh_octree_table(ob, em, NULL, 'e');
 
-	fhash= BLI_ghash_new(mirror_facehash, mirror_facecmp, "mirror_facehash gh");
-	for(a=0, mf=mface; a<me->totface; a++, mf++)
+	fhash = BLI_ghash_new(mirror_facehash, mirror_facecmp, "mirror_facehash gh");
+	for (a = 0, mf = mface; a < me->totface; a++, mf++)
 		BLI_ghash_insert(fhash, mf, mf);
 
-	for(a=0, mf=mface; a<me->totface; a++, mf++) {
-		mirrormf.v1= mirrorverts[mf->v3];
-		mirrormf.v2= mirrorverts[mf->v2];
-		mirrormf.v3= mirrorverts[mf->v1];
-		mirrormf.v4= (mf->v4)? mirrorverts[mf->v4]: 0;
+	for (a = 0, mf = mface; a < me->totface; a++, mf++) {
+		mirrormf.v1 = mirrorverts[mf->v3];
+		mirrormf.v2 = mirrorverts[mf->v2];
+		mirrormf.v3 = mirrorverts[mf->v1];
+		mirrormf.v4 = (mf->v4) ? mirrorverts[mf->v4] : 0;
 
 		/* make sure v4 is not 0 if a quad */
-		if(mf->v4 && mirrormf.v4==0) {
+		if (mf->v4 && mirrormf.v4 == 0) {
 			SWAP(unsigned int, mirrormf.v1, mirrormf.v3);
 			SWAP(unsigned int, mirrormf.v2, mirrormf.v4);
 		}
 
-		hashmf= BLI_ghash_lookup(fhash, &mirrormf);
-		if(hashmf) {
-			mirrorfaces[a*2]= hashmf - mface;
-			mirrorfaces[a*2+1]= mirror_facerotation(&mirrormf, hashmf);
+		hashmf = BLI_ghash_lookup(fhash, &mirrormf);
+		if (hashmf) {
+			mirrorfaces[a * 2] = hashmf - mface;
+			mirrorfaces[a * 2 + 1] = mirror_facerotation(&mirrormf, hashmf);
 		}
 		else
-			mirrorfaces[a*2]= -1;
+			mirrorfaces[a * 2] = -1;
 	}
 
 	BLI_ghash_free(fhash, NULL, NULL);
diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c
index c8adfbd..713009d 100644
--- a/source/blender/editors/metaball/mball_edit.c
+++ b/source/blender/editors/metaball/mball_edit.c
@@ -82,8 +82,8 @@ void make_editMball(Object *obedit)
 
 	ml= mb->elems.first;
 	
-	while(ml) {
-		if(ml->flag & SELECT) mb->lastelem = ml;
+	while (ml) {
+		if (ml->flag & SELECT) mb->lastelem = ml;
 		ml= ml->next;
 	}
 
@@ -106,7 +106,7 @@ MetaElem *add_metaball_primitive(bContext *C, float mat[4][4], int type, int UNU
 
 	/* Deselect all existing metaelems */
 	ml= mball->editelems->first;
-	while(ml) {
+	while (ml) {
 		ml->flag &= ~SELECT;
 		ml= ml->next;
 	}
@@ -131,11 +131,11 @@ static int mball_select_all_exec(bContext *C, wmOperator *op)
 	int action = RNA_enum_get(op->ptr, "action");
 
 	ml= mb->editelems->first;
-	if(ml) {
+	if (ml) {
 		if (action == SEL_TOGGLE) {
 			action = SEL_SELECT;
-			while(ml) {
-				if(ml->flag & SELECT) {
+			while (ml) {
+				if (ml->flag & SELECT) {
 					action = SEL_DESELECT;
 					break;
 				}
@@ -144,7 +144,7 @@ static int mball_select_all_exec(bContext *C, wmOperator *op)
 		}
 
 		ml= mb->editelems->first;
-		while(ml) {
+		while (ml) {
 			switch (action) {
 			case SEL_SELECT:
 				ml->flag |= SELECT;
@@ -167,16 +167,16 @@ static int mball_select_all_exec(bContext *C, wmOperator *op)
 void MBALL_OT_select_all(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select or Deselect All";
-	ot->description= "Change selection of all meta elements";
-	ot->idname= "MBALL_OT_select_all";
+	ot->name = "(De)select All";
+	ot->description = "Change selection of all meta elements";
+	ot->idname = "MBALL_OT_select_all";
 
 	/* callback functions */
-	ot->exec= mball_select_all_exec;
-	ot->poll= ED_operator_editmball;
+	ot->exec = mball_select_all_exec;
+	ot->poll = ED_operator_editmball;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	WM_operator_properties_select_all(ot);
 }
@@ -191,15 +191,15 @@ static int select_random_metaelems_exec(bContext *C, wmOperator *op)
 	MetaElem *ml;
 	float percent= RNA_float_get(op->ptr, "percent");
 	
-	if(percent == 0.0f)
+	if (percent == 0.0f)
 		return OPERATOR_CANCELLED;
 	
 	ml= mb->editelems->first;
 	BLI_srand( BLI_rand() );	/* Random seed */
 	
 	/* Stupid version of random selection. Should be improved. */
-	while(ml) {
-		if(BLI_frand() < percent)
+	while (ml) {
+		if (BLI_frand() < percent)
 			ml->flag |= SELECT;
 		else
 			ml->flag &= ~SELECT;
@@ -215,17 +215,17 @@ static int select_random_metaelems_exec(bContext *C, wmOperator *op)
 void MBALL_OT_select_random_metaelems(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Random...";
-	ot->description= "Randomly select metaelements";
-	ot->idname= "MBALL_OT_select_random_metaelems";
+	ot->name = "Random...";
+	ot->description = "Randomly select metaelements";
+	ot->idname = "MBALL_OT_select_random_metaelems";
 	
 	/* callback functions */
-	ot->exec= select_random_metaelems_exec;
-	ot->invoke= WM_operator_props_popup;
-	ot->poll= ED_operator_editmball;
+	ot->exec = select_random_metaelems_exec;
+	ot->invoke = WM_operator_props_popup;
+	ot->poll = ED_operator_editmball;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_float_percentage(ot->srna, "percent", 0.5f, 0.0f, 1.0f, "Percent", "Percentage of metaelems to select randomly", 0.0001f, 1.0f);
@@ -241,9 +241,9 @@ static int duplicate_metaelems_exec(bContext *C, wmOperator *UNUSED(op))
 	MetaElem *ml, *newml;
 	
 	ml= mb->editelems->last;
-	if(ml) {
-		while(ml) {
-			if(ml->flag & SELECT) {
+	if (ml) {
+		while (ml) {
+			if (ml->flag & SELECT) {
 				newml= MEM_dupallocN(ml);
 				BLI_addtail(mb->editelems, newml);
 				mb->lastelem= newml;
@@ -274,17 +274,17 @@ static int duplicate_metaelems_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
 void MBALL_OT_duplicate_metaelems(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Duplicate Metaelements";
-	ot->description= "Delete selected metaelement(s)";
-	ot->idname= "MBALL_OT_duplicate_metaelems";
+	ot->name = "Duplicate Metaelements";
+	ot->description = "Delete selected metaelement(s)";
+	ot->idname = "MBALL_OT_duplicate_metaelems";
 
 	/* callback functions */
-	ot->exec= duplicate_metaelems_exec;
-	ot->invoke= duplicate_metaelems_invoke;
-	ot->poll= ED_operator_editmball;
+	ot->exec = duplicate_metaelems_exec;
+	ot->invoke = duplicate_metaelems_invoke;
+	ot->poll = ED_operator_editmball;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* to give to transform */
 	RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
@@ -300,11 +300,11 @@ static int delete_metaelems_exec(bContext *C, wmOperator *UNUSED(op))
 	MetaElem *ml, *next;
 	
 	ml= mb->editelems->first;
-	if(ml) {
-		while(ml) {
+	if (ml) {
+		while (ml) {
 			next= ml->next;
-			if(ml->flag & SELECT) {
-				if(mb->lastelem==ml) mb->lastelem= NULL;
+			if (ml->flag & SELECT) {
+				if (mb->lastelem==ml) mb->lastelem= NULL;
 				BLI_remlink(mb->editelems, ml);
 				MEM_freeN(ml);
 			}
@@ -320,16 +320,16 @@ static int delete_metaelems_exec(bContext *C, wmOperator *UNUSED(op))
 void MBALL_OT_delete_metaelems(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete";
-	ot->description= "Delete selected metaelement(s)";
-	ot->idname= "MBALL_OT_delete_metaelems";
+	ot->name = "Delete";
+	ot->description = "Delete selected metaelement(s)";
+	ot->idname = "MBALL_OT_delete_metaelems";
 
 	/* callback functions */
-	ot->exec= delete_metaelems_exec;
-	ot->poll= ED_operator_editmball;
+	ot->exec = delete_metaelems_exec;
+	ot->poll = ED_operator_editmball;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;	
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;	
 }
 
 /***************************** Hide operator *****************************/
@@ -344,9 +344,9 @@ static int hide_metaelems_exec(bContext *C, wmOperator *op)
 
 	ml= mb->editelems->first;
 
-	if(ml) {
-		while(ml){
-			if((ml->flag & SELECT) != invert)
+	if (ml) {
+		while (ml) {
+			if ((ml->flag & SELECT) != invert)
 				ml->flag |= MB_HIDE;
 			ml= ml->next;
 		}
@@ -360,16 +360,16 @@ static int hide_metaelems_exec(bContext *C, wmOperator *op)
 void MBALL_OT_hide_metaelems(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Hide";
-	ot->description= "Hide (un)selected metaelement(s)";
-	ot->idname= "MBALL_OT_hide_metaelems";
+	ot->name = "Hide";
+	ot->description = "Hide (un)selected metaelement(s)";
+	ot->idname = "MBALL_OT_hide_metaelems";
 
 	/* callback functions */
-	ot->exec= hide_metaelems_exec;
-	ot->poll= ED_operator_editmball;
+	ot->exec = hide_metaelems_exec;
+	ot->poll = ED_operator_editmball;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* props */
 	RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected");
@@ -386,8 +386,8 @@ static int reveal_metaelems_exec(bContext *C, wmOperator *UNUSED(op))
 
 	ml= mb->editelems->first;
 
-	if(ml) {
-		while(ml) {
+	if (ml) {
+		while (ml) {
 			ml->flag &= ~MB_HIDE;
 			ml= ml->next;
 		}
@@ -401,16 +401,16 @@ static int reveal_metaelems_exec(bContext *C, wmOperator *UNUSED(op))
 void MBALL_OT_reveal_metaelems(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Reveal";
-	ot->description= "Reveal all hidden metaelements";
-	ot->idname= "MBALL_OT_reveal_metaelems";
+	ot->name = "Reveal";
+	ot->description = "Reveal all hidden metaelements";
+	ot->idname = "MBALL_OT_reveal_metaelems";
 	
 	/* callback functions */
-	ot->exec= reveal_metaelems_exec;
-	ot->poll= ED_operator_editmball;
+	ot->exec = reveal_metaelems_exec;
+	ot->poll = ED_operator_editmball;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;	
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;	
 }
 
 /* Select MetaElement with mouse click (user can select radius circle or
@@ -428,49 +428,49 @@ int mouse_mball(bContext *C, const int mval[2], int extend)
 
 	view3d_set_viewcontext(C, &vc);
 
-	rect.xmin= mval[0]-12;
-	rect.xmax= mval[0]+12;
-	rect.ymin= mval[1]-12;
-	rect.ymax= mval[1]+12;
+	rect.xmin = mval[0]-12;
+	rect.xmax = mval[0]+12;
+	rect.ymin = mval[1]-12;
+	rect.ymax = mval[1]+12;
 
 	hits= view3d_opengl_select(&vc, buffer, MAXPICKBUF, &rect);
 
 	/* does startelem exist? */
 	ml= mb->editelems->first;
-	while(ml) {
-		if(ml==startelem) break;
+	while (ml) {
+		if (ml==startelem) break;
 		ml= ml->next;
 	}
 
-	if(ml==NULL) startelem= mb->editelems->first;
+	if (ml==NULL) startelem= mb->editelems->first;
 	
-	if(hits>0) {
+	if (hits>0) {
 		ml= startelem;
-		while(ml) {
-			for(a=0; a<hits; a++) {
+		while (ml) {
+			for (a=0; a<hits; a++) {
 				/* index converted for gl stuff */
-				if(ml->selcol1==buffer[ 4 * a + 3 ]){
+				if (ml->selcol1==buffer[ 4 * a + 3 ]) {
 					ml->flag |= MB_SCALE_RAD;
 					act= ml;
 				}
-				if(ml->selcol2==buffer[ 4 * a + 3 ]){
+				if (ml->selcol2==buffer[ 4 * a + 3 ]) {
 					ml->flag &= ~MB_SCALE_RAD;
 					act= ml;
 				}
 			}
-			if(act) break;
+			if (act) break;
 			ml= ml->next;
-			if(ml==NULL) ml= mb->editelems->first;
-			if(ml==startelem) break;
+			if (ml==NULL) ml= mb->editelems->first;
+			if (ml==startelem) break;
 		}
 		
 		/* When some metaelem was found, then it is necessary to select or
-		 * deselet it. */
-		if(act) {
-			if(extend==0) {
+		 * deselect it. */
+		if (act) {
+			if (extend==0) {
 				/* Deselect all existing metaelems */
 				ml= mb->editelems->first;
-				while(ml) {
+				while (ml) {
 					ml->flag &= ~SELECT;
 					ml= ml->next;
 				}
@@ -478,7 +478,7 @@ int mouse_mball(bContext *C, const int mval[2], int extend)
 				act->flag |= SELECT;
 			}
 			else {
-				if(act->flag & SELECT)
+				if (act->flag & SELECT)
 					act->flag &= ~SELECT;
 				else
 					act->flag |= SELECT;
@@ -502,10 +502,10 @@ static void freeMetaElemlist(ListBase *lb)
 {
 	MetaElem *ml, *next;
 
-	if(lb==NULL) return;
+	if (lb==NULL) return;
 
 	ml= lb->first;
-	while(ml){
+	while (ml) {
 		next= ml->next;
 		BLI_remlink(lb, ml);
 		MEM_freeN(ml);
@@ -516,7 +516,7 @@ static void freeMetaElemlist(ListBase *lb)
 }
 
 
-static void undoMball_to_editMball(void *lbu, void *lbe)
+static void undoMball_to_editMball(void *lbu, void *lbe, void *UNUSED(obe))
 {
 	ListBase *lb= lbu;
 	ListBase *editelems= lbe;
@@ -526,7 +526,7 @@ static void undoMball_to_editMball(void *lbu, void *lbe)
 
 	/* copy 'undo' MetaElems to 'edit' MetaElems */
 	ml= lb->first;
-	while(ml){
+	while (ml) {
 		newml= MEM_dupallocN(ml);
 		BLI_addtail(editelems, newml);
 		ml= ml->next;
@@ -534,7 +534,7 @@ static void undoMball_to_editMball(void *lbu, void *lbe)
 	
 }
 
-static void *editMball_to_undoMball(void *lbe)
+static void *editMball_to_undoMball(void *lbe, void *UNUSED(obe))
 {
 	ListBase *editelems= lbe;
 	ListBase *lb;
@@ -546,7 +546,7 @@ static void *editMball_to_undoMball(void *lbe)
 	
 	/* copy contents of current ListBase to the undo ListBase */
 	ml= editelems->first;
-	while(ml){
+	while (ml) {
 		newml= MEM_dupallocN(ml);
 		BLI_addtail(lb, newml);
 		ml= ml->next;
@@ -566,7 +566,7 @@ static void free_undoMball(void *lbv)
 
 static ListBase *metaball_get_editelems(Object *ob)
 {
-	if(ob && ob->type==OB_MBALL) {
+	if (ob && ob->type==OB_MBALL) {
 		struct MetaBall *mb= (struct MetaBall*)ob->data;
 		return mb->editelems;
 	}
diff --git a/source/blender/editors/metaball/mball_intern.h b/source/blender/editors/metaball/mball_intern.h
index 1cb4c19..0329f8e 100644
--- a/source/blender/editors/metaball/mball_intern.h
+++ b/source/blender/editors/metaball/mball_intern.h
@@ -29,8 +29,8 @@
  */
 
 
-#ifndef ED_MBALL_INTERN_H
-#define ED_MBALL_INTERN_H
+#ifndef __MBALL_INTERN_H__
+#define __MBALL_INTERN_H__
 
 #include "DNA_object_types.h"
 
diff --git a/source/blender/editors/metaball/mball_ops.c b/source/blender/editors/metaball/mball_ops.c
index f689fb0..5d019cc 100644
--- a/source/blender/editors/metaball/mball_ops.c
+++ b/source/blender/editors/metaball/mball_ops.c
@@ -59,8 +59,8 @@ void ED_keymap_metaball(wmKeyConfig *keyconf)
 	wmKeyMap *keymap;
 	wmKeyMapItem *kmi;
 	
-	keymap= WM_keymap_find(keyconf, "Metaball", 0, 0);
-	keymap->poll= ED_operator_editmball;
+	keymap = WM_keymap_find(keyconf, "Metaball", 0, 0);
+	keymap->poll = ED_operator_editmball;
 
 	WM_keymap_add_item(keymap, "OBJECT_OT_metaball_add", AKEY, KM_PRESS, KM_SHIFT, 0);
 	
diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt
index e723252..05c042a 100644
--- a/source/blender/editors/object/CMakeLists.txt
+++ b/source/blender/editors/object/CMakeLists.txt
@@ -23,6 +23,7 @@ set(INC
 	../../blenkernel
 	../../blenlib
 	../../blenloader
+	../../bmesh
 	../../gpu
 	../../ikplugin
 	../../imbuf
diff --git a/source/blender/editors/object/SConscript b/source/blender/editors/object/SConscript
index d473923..b53ea54 100644
--- a/source/blender/editors/object/SConscript
+++ b/source/blender/editors/object/SConscript
@@ -5,7 +5,7 @@ sources = env.Glob('*.c')
 
 incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
 incs += ' ../../windowmanager #/intern/guardedalloc ../../blenloader'
-incs += ' ../../makesrna ../../python ../../ikplugin'
+incs += ' ../../makesrna ../../python ../../ikplugin ../../bmesh'
 incs += ' ../../render/extern/include ../../gpu' # for object_bake.c
 incs += ' #extern/recastnavigation'
 
@@ -15,7 +15,7 @@ if env['OURPLATFORM'] == 'linux':
     cflags='-pthread'
     incs += ' ../../../extern/binreloc/include'
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
 
 if env['WITH_BF_PYTHON']:
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index dce2179..3717591 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -123,7 +123,7 @@ void ED_object_location_from_view(bContext *C, float *loc)
 void ED_object_rotation_from_view(bContext *C, float *rot)
 {
 	RegionView3D *rv3d= CTX_wm_region_view3d(C);
-	if(rv3d) {
+	if (rv3d) {
 		float quat[4];
 		copy_qt_qt(quat, rv3d->viewquat);
 		quat[0]= -quat[0];
@@ -154,7 +154,7 @@ void ED_object_base_init_transform(bContext *C, Base *base, float *loc, float *r
 /* returns standard diameter */
 float ED_object_new_primitive_matrix(bContext *C, Object *obedit, float *loc, float *rot, float primmat[][4])
 {
-	View3D *v3d =CTX_wm_view3d(C);
+	View3D *v3d = CTX_wm_view3d(C);
 	float mat[3][3], rmat[3][3], cmat[3][3], imat[3][3];
 	
 	unit_m4(primmat);
@@ -174,7 +174,7 @@ float ED_object_new_primitive_matrix(bContext *C, Object *obedit, float *loc, fl
 	invert_m3_m3(imat, mat);
 	mul_m3_v3(imat, primmat[3]);
 	
-	if(v3d) return v3d->grid;
+	if (v3d) return v3d->grid;
 	return 1.0f;
 }
 
@@ -193,7 +193,7 @@ void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode)
 	prop = RNA_def_boolean(ot->srna, "view_align", 0, "Align to View", "Align the new object to the view");
 	RNA_def_property_update_runtime(prop, view_align_update);
 
-	if(do_editmode) {
+	if (do_editmode) {
 		prop = RNA_def_boolean(ot->srna, "enter_editmode", 0, "Enter Editmode",
 		                      "Enter editmode when adding this object");
 		RNA_def_property_flag(prop, PROP_HIDDEN|PROP_SKIP_SAVE);
@@ -212,23 +212,23 @@ void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode)
 
 static void object_add_generic_invoke_options(bContext *C, wmOperator *op)
 {
-	if(RNA_struct_find_property(op->ptr, "enter_editmode")) /* optional */
+	if (RNA_struct_find_property(op->ptr, "enter_editmode")) /* optional */
 		if (!RNA_struct_property_is_set(op->ptr, "enter_editmode"))
 			RNA_boolean_set(op->ptr, "enter_editmode", U.flag & USER_ADD_EDITMODE);
 	
-	if(!RNA_struct_property_is_set(op->ptr, "location")) {
+	if (!RNA_struct_property_is_set(op->ptr, "location")) {
 		float loc[3];
 		
 		ED_object_location_from_view(C, loc);
 		RNA_float_set_array(op->ptr, "location", loc);
 	}
 	 
-	if(!RNA_struct_property_is_set(op->ptr, "layers")) {
+	if (!RNA_struct_property_is_set(op->ptr, "layers")) {
 		View3D *v3d = CTX_wm_view3d(C);
 		Scene *scene = CTX_data_scene(C);
 		int a, values[20], layer;
 
-		if(v3d) {
+		if (v3d) {
 			layer = (v3d->scenelock && !v3d->localvd)? scene->layact: v3d->layact;
 		}
 		else {
@@ -250,22 +250,22 @@ int ED_object_add_generic_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev
 }
 
 int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc,
-	float *rot, int *enter_editmode, unsigned int *layer)
+	float *rot, int *enter_editmode, unsigned int *layer, int *is_view_aligned)
 {
 	View3D *v3d = CTX_wm_view3d(C);
 	int a, layer_values[20];
 	int view_align;
 	
 	*enter_editmode = FALSE;
-	if(RNA_struct_find_property(op->ptr, "enter_editmode") && RNA_boolean_get(op->ptr, "enter_editmode")) {
+	if (RNA_struct_find_property(op->ptr, "enter_editmode") && RNA_boolean_get(op->ptr, "enter_editmode")) {
 		*enter_editmode = TRUE;
 	}
 
-	if(RNA_struct_property_is_set(op->ptr, "layers")) {
+	if (RNA_struct_property_is_set(op->ptr, "layers")) {
 		RNA_boolean_get_array(op->ptr, "layers", layer_values);
 		*layer= 0;
-		for(a=0; a<20; a++) {
-			if(layer_values[a])
+		for (a=0; a<20; a++) {
+			if (layer_values[a])
 				*layer |= (1 << a);
 			else
 				*layer &= ~(1 << a);
@@ -278,11 +278,11 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc,
 	}
 
 	/* in local view we additionally add local view layers,
-	   not part of operator properties */
-	if(v3d && v3d->localvd)
+	 * not part of operator properties */
+	if (v3d && v3d->localvd)
 		*layer |= v3d->lay;
 
-	if(RNA_struct_property_is_set(op->ptr, "rotation"))
+	if (RNA_struct_property_is_set(op->ptr, "rotation"))
 		view_align = FALSE;
 	else if (RNA_struct_property_is_set(op->ptr, "view_align"))
 		view_align = RNA_boolean_get(op->ptr, "view_align");
@@ -298,10 +298,12 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc,
 	else
 		RNA_float_get_array(op->ptr, "rotation", rot);
 	
-
+	if (is_view_aligned)
+		*is_view_aligned = view_align;
+	
 	RNA_float_get_array(op->ptr, "location", loc);
 
-	if(*layer == 0) {
+	if (*layer == 0) {
 		BKE_report(op->reports, RPT_ERROR, "Property 'layer' has no values set");
 		return 0;
 	}
@@ -337,7 +339,7 @@ Object *ED_object_add_type(bContext *C, int type, float *loc, float *rot,
 		ED_render_id_flush_update(bmain, ob->data);
 	}
 
-	if(enter_editmode)
+	if (enter_editmode)
 		ED_object_enter_editmode(C, EM_IGNORE_LAYER);
 
 	WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, scene);
@@ -352,7 +354,7 @@ static int object_add_exec(bContext *C, wmOperator *op)
 	unsigned int layer;
 	float loc[3], rot[3];
 	
-	if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer))
+	if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
 		return OPERATOR_CANCELLED;
 
 	ED_object_add_type(C, RNA_enum_get(op->ptr, "type"), loc, rot, enter_editmode, layer);
@@ -363,18 +365,18 @@ static int object_add_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Object";
+	ot->name = "Add Object";
 	ot->description = "Add an object to the scene";
-	ot->idname= "OBJECT_OT_add";
+	ot->idname = "OBJECT_OT_add";
 	
 	/* api callbacks */
-	ot->invoke= ED_object_add_generic_invoke;
-	ot->exec= object_add_exec;
+	ot->invoke = ED_object_add_generic_invoke;
+	ot->exec = object_add_exec;
 	
-	ot->poll= ED_operator_objectmode;
+	ot->poll = ED_operator_objectmode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	RNA_def_enum(ot->srna, "type", object_type_items, 0, "Type", "");
 
@@ -409,10 +411,10 @@ static Object *effector_add_type(bContext *C, wmOperator *op, int type)
 	
 	object_add_generic_invoke_options(C, op);
 
-	if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer))
+	if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
 		return NULL;
 
-	if(type==PFIELD_GUIDE) {
+	if (type==PFIELD_GUIDE) {
 		ob= ED_object_add_type(C, OB_CURVE, loc, rot, FALSE, layer);
 		rename_id(&ob->id, "CurveGuide");
 
@@ -421,7 +423,7 @@ static Object *effector_add_type(bContext *C, wmOperator *op, int type)
 		ED_object_new_primitive_matrix(C, ob, loc, rot, mat);
 		BLI_addtail(object_editcurve_get(ob), add_nurbs_primitive(C, mat, CU_NURBS|CU_PRIM_PATH, 1));
 
-		if(!enter_editmode)
+		if (!enter_editmode)
 			ED_object_exit_editmode(C, EM_FREEDATA);
 	}
 	else {
@@ -446,7 +448,7 @@ static Object *effector_add_type(bContext *C, wmOperator *op, int type)
 /* for object add operator */
 static int effector_add_exec(bContext *C, wmOperator *op)
 {
-	if(effector_add_type(C, op, RNA_enum_get(op->ptr, "type")) == NULL)
+	if (effector_add_type(C, op, RNA_enum_get(op->ptr, "type")) == NULL)
 		return OPERATOR_CANCELLED;
 
 	return OPERATOR_FINISHED;
@@ -455,20 +457,20 @@ static int effector_add_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_effector_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Effector";
+	ot->name = "Add Effector";
 	ot->description = "Add an empty object with a physics effector to the scene";
-	ot->idname= "OBJECT_OT_effector_add";
+	ot->idname = "OBJECT_OT_effector_add";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= effector_add_exec;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = effector_add_exec;
 	
-	ot->poll= ED_operator_objectmode;
+	ot->poll = ED_operator_objectmode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
-	ot->prop= RNA_def_enum(ot->srna, "type", field_type_items, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", field_type_items, 0, "Type", "");
 
 	ED_object_add_generic_props(ot, TRUE);
 }
@@ -489,7 +491,7 @@ static int object_camera_add_exec(bContext *C, wmOperator *op)
 	
 	object_add_generic_invoke_options(C, op);
 
-	if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer))
+	if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
 		return OPERATOR_CANCELLED;
 
 	ob= ED_object_add_type(C, OB_CAMERA, loc, rot, FALSE, layer);
@@ -510,16 +512,16 @@ void OBJECT_OT_camera_add(wmOperatorType *ot)
 	PropertyRNA *prop;
 	
 	/* identifiers */
-	ot->name= "Add Camera";
+	ot->name = "Add Camera";
 	ot->description = "Add a camera object to the scene";
-	ot->idname= "OBJECT_OT_camera_add";
+	ot->idname = "OBJECT_OT_camera_add";
 	
 	/* api callbacks */
-	ot->exec= object_camera_add_exec;
-	ot->poll= ED_operator_objectmode;
+	ot->exec = object_camera_add_exec;
+	ot->poll = ED_operator_objectmode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 		
 	ED_object_add_generic_props(ot, TRUE);
 	
@@ -543,10 +545,10 @@ static int object_metaball_add_exec(bContext *C, wmOperator *op)
 	
 	object_add_generic_invoke_options(C, op); // XXX these props don't get set right when only exec() is called
 
-	if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer))
+	if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
 		return OPERATOR_CANCELLED;
 	
-	if(obedit==NULL || obedit->type!=OB_MBALL) {
+	if (obedit==NULL || obedit->type!=OB_MBALL) {
 		obedit= ED_object_add_type(C, OB_MBALL, loc, rot, TRUE, layer);
 		newob = 1;
 	}
@@ -576,7 +578,7 @@ static int object_metaball_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
 
 	pup= uiPupMenuBegin(C, op->type->name, ICON_NONE);
 	layout= uiPupMenuLayout(pup);
-	if(!obedit || obedit->type == OB_MBALL)
+	if (!obedit || obedit->type == OB_MBALL)
 		uiItemsEnumO(layout, op->type->idname, "type");
 	else
 		uiItemsEnumO(layout, "OBJECT_OT_metaball_add", "type");
@@ -588,17 +590,17 @@ static int object_metaball_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
 void OBJECT_OT_metaball_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Metaball";
-	ot->description= "Add an metaball object to the scene";
-	ot->idname= "OBJECT_OT_metaball_add";
+	ot->name = "Add Metaball";
+	ot->description = "Add an metaball object to the scene";
+	ot->idname = "OBJECT_OT_metaball_add";
 
 	/* api callbacks */
-	ot->invoke= object_metaball_add_invoke;
-	ot->exec= object_metaball_add_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->invoke = object_metaball_add_invoke;
+	ot->exec = object_metaball_add_exec;
+	ot->poll = ED_operator_scene_editable;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	RNA_def_enum(ot->srna, "type", metaelem_type_items, 0, "Primitive", "");
 	ED_object_add_generic_props(ot, TRUE);
@@ -612,10 +614,10 @@ static int object_add_text_exec(bContext *C, wmOperator *op)
 	float loc[3], rot[3];
 	
 	object_add_generic_invoke_options(C, op); // XXX these props don't get set right when only exec() is called
-	if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer))
+	if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
 		return OPERATOR_CANCELLED;
 	
-	if(obedit && obedit->type==OB_FONT)
+	if (obedit && obedit->type==OB_FONT)
 		return OPERATOR_CANCELLED;
 
 	obedit= ED_object_add_type(C, OB_FONT, loc, rot, enter_editmode, layer);
@@ -628,17 +630,17 @@ static int object_add_text_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_text_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Text";
+	ot->name = "Add Text";
 	ot->description = "Add a text object to the scene";
-	ot->idname= "OBJECT_OT_text_add";
+	ot->idname = "OBJECT_OT_text_add";
 	
 	/* api callbacks */
-	ot->invoke= ED_object_add_generic_invoke;
-	ot->exec= object_add_text_exec;
-	ot->poll= ED_operator_objectmode;
+	ot->invoke = ED_object_add_generic_invoke;
+	ot->exec = object_add_text_exec;
+	ot->poll = ED_operator_objectmode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	ED_object_add_generic_props(ot, TRUE);
 }
 
@@ -653,7 +655,7 @@ static int object_armature_add_exec(bContext *C, wmOperator *op)
 	float loc[3], rot[3];
 	
 	object_add_generic_invoke_options(C, op); // XXX these props don't get set right when only exec() is called
-	if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer))
+	if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
 		return OPERATOR_CANCELLED;
 	
 	if ((obedit==NULL) || (obedit->type != OB_ARMATURE)) {
@@ -663,7 +665,7 @@ static int object_armature_add_exec(bContext *C, wmOperator *op)
 	}
 	else DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
 	
-	if(obedit==NULL) {
+	if (obedit==NULL) {
 		BKE_report(op->reports, RPT_ERROR, "Cannot create editmode armature");
 		return OPERATOR_CANCELLED;
 	}
@@ -683,17 +685,17 @@ static int object_armature_add_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_armature_add(wmOperatorType *ot)
 {	
 	/* identifiers */
-	ot->name= "Add Armature";
+	ot->name = "Add Armature";
 	ot->description = "Add an armature object to the scene";
-	ot->idname= "OBJECT_OT_armature_add";
+	ot->idname = "OBJECT_OT_armature_add";
 	
 	/* api callbacks */
-	ot->invoke= ED_object_add_generic_invoke;
-	ot->exec= object_armature_add_exec;
-	ot->poll= ED_operator_objectmode;
+	ot->invoke = ED_object_add_generic_invoke;
+	ot->exec = object_armature_add_exec;
+	ot->poll = ED_operator_objectmode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	ED_object_add_generic_props(ot, TRUE);
 }
 
@@ -721,7 +723,7 @@ static int object_lamp_add_exec(bContext *C, wmOperator *op)
 	float loc[3], rot[3];
 	
 	object_add_generic_invoke_options(C, op);
-	if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer))
+	if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
 		return OPERATOR_CANCELLED;
 
 	ob= ED_object_add_type(C, OB_LAMP, loc, rot, FALSE, layer);
@@ -731,7 +733,7 @@ static int object_lamp_add_exec(bContext *C, wmOperator *op)
 	rename_id(&ob->id, get_lamp_defname(type));
 	rename_id(&la->id, get_lamp_defname(type));
 
-	if(scene_use_new_shading_nodes(scene)) {
+	if (scene_use_new_shading_nodes(scene)) {
 		ED_node_shader_default(scene, &la->id);
 		la->use_nodes= 1;
 	}
@@ -750,20 +752,20 @@ void OBJECT_OT_lamp_add(wmOperatorType *ot)
 		{0, NULL, 0, NULL, NULL}};
 
 	/* identifiers */
-	ot->name= "Add Lamp";
+	ot->name = "Add Lamp";
 	ot->description = "Add a lamp object to the scene";
-	ot->idname= "OBJECT_OT_lamp_add";
+	ot->idname = "OBJECT_OT_lamp_add";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= object_lamp_add_exec;
-	ot->poll= ED_operator_objectmode;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = object_lamp_add_exec;
+	ot->poll = ED_operator_objectmode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
-	ot->prop= RNA_def_enum(ot->srna, "type", lamp_type_items, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", lamp_type_items, 0, "Type", "");
 
 	ED_object_add_generic_props(ot, FALSE);
 }
@@ -777,10 +779,10 @@ static int group_instance_add_exec(bContext *C, wmOperator *op)
 	float loc[3], rot[3];
 	
 	object_add_generic_invoke_options(C, op);
-	if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer))
+	if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
 		return OPERATOR_CANCELLED;
 
-	if(group) {
+	if (group) {
 		Main *bmain= CTX_data_main(C);
 		Scene *scene= CTX_data_scene(C);
 		Object *ob= ED_object_add_type(C, OB_EMPTY, loc, rot, FALSE, layer);
@@ -809,7 +811,7 @@ static int object_speaker_add_exec(bContext *C, wmOperator *op)
 	Scene *scene = CTX_data_scene(C);
 
 	object_add_generic_invoke_options(C, op);
-	if(!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer))
+	if (!ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, NULL))
 		return OPERATOR_CANCELLED;
 
 	ob= ED_object_add_type(C, OB_SPEAKER, loc, rot, FALSE, layer);
@@ -841,16 +843,16 @@ static int object_speaker_add_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_speaker_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Speaker";
+	ot->name = "Add Speaker";
 	ot->description = "Add a speaker object to the scene";
-	ot->idname= "OBJECT_OT_speaker_add";
+	ot->idname = "OBJECT_OT_speaker_add";
 
 	/* api callbacks */
-	ot->exec= object_speaker_add_exec;
-	ot->poll= ED_operator_objectmode;
+	ot->exec = object_speaker_add_exec;
+	ot->poll = ED_operator_objectmode;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	ED_object_add_generic_props(ot, TRUE);
 }
@@ -861,23 +863,23 @@ void OBJECT_OT_group_instance_add(wmOperatorType *ot)
 	PropertyRNA *prop;
 
 	/* identifiers */
-	ot->name= "Add Group Instance";
+	ot->name = "Add Group Instance";
 	ot->description = "Add a dupligroup instance";
-	ot->idname= "OBJECT_OT_group_instance_add";
+	ot->idname = "OBJECT_OT_group_instance_add";
 
 	/* api callbacks */
-	ot->invoke= WM_enum_search_invoke;
-	ot->exec= group_instance_add_exec;
+	ot->invoke = WM_enum_search_invoke;
+	ot->exec = group_instance_add_exec;
 
-	ot->poll= ED_operator_objectmode;
+	ot->poll = ED_operator_objectmode;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	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 = prop;
 	ED_object_add_generic_props(ot, FALSE);
 }
 
@@ -890,7 +892,7 @@ void ED_base_object_free_and_unlink(Main *bmain, Scene *scene, Base *base)
 	DAG_id_type_tag(bmain, ID_OB);
 	BLI_remlink(&scene->base, base);
 	free_libblock_us(&bmain->object, base->object);
-	if(scene->basact==base) scene->basact= NULL;
+	if (scene->basact==base) scene->basact= NULL;
 	MEM_freeN(base);
 }
 
@@ -901,12 +903,12 @@ static int object_delete_exec(bContext *C, wmOperator *op)
 	const short use_global= RNA_boolean_get(op->ptr, "use_global");
 	/* int islamp= 0; */ /* UNUSED */
 	
-	if(CTX_data_edit_object(C)) 
+	if (CTX_data_edit_object(C)) 
 		return OPERATOR_CANCELLED;
 	
 	CTX_DATA_BEGIN(C, Base*, base, selected_bases) {
 
-		/* if(base->object->type==OB_LAMP) islamp= 1; */
+		/* if (base->object->type==OB_LAMP) islamp= 1; */
 
 		/* deselect object -- it could be used in other scenes */
 		base->object->flag &= ~SELECT;
@@ -944,17 +946,17 @@ static int object_delete_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_delete(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete";
+	ot->name = "Delete";
 	ot->description = "Delete selected objects";
-	ot->idname= "OBJECT_OT_delete";
+	ot->idname = "OBJECT_OT_delete";
 	
 	/* api callbacks */
-	ot->invoke= WM_operator_confirm;
-	ot->exec= object_delete_exec;
-	ot->poll= ED_operator_objectmode;
+	ot->invoke = WM_operator_confirm;
+	ot->exec = object_delete_exec;
+	ot->poll = ED_operator_objectmode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	RNA_def_boolean(ot->srna, "use_global", 0, "Delete Globally", "Remove object from all scenes");
 }
@@ -976,18 +978,18 @@ static void copy_object_set_idnew(bContext *C, int dupflag)
 	CTX_DATA_END;
 	
 	/* materials */
-	if( dupflag & USER_DUP_MAT) {
+	if ( dupflag & USER_DUP_MAT) {
 		mao= bmain->mat.first;
-		while(mao) {
-			if(mao->id.newid) {
+		while (mao) {
+			if (mao->id.newid) {
 				
 				ma= (Material *)mao->id.newid;
 				
-				if(dupflag & USER_DUP_TEX) {
-					for(a=0; a<MAX_MTEX; a++) {
-						if(ma->mtex[a]) {
+				if (dupflag & USER_DUP_TEX) {
+					for (a=0; a<MAX_MTEX; a++) {
+						if (ma->mtex[a]) {
 							id= (ID *)ma->mtex[a]->tex;
-							if(id) {
+							if (id) {
 								ID_NEW_US(ma->mtex[a]->tex)
 								else ma->mtex[a]->tex= copy_texture(ma->mtex[a]->tex);
 								id->us--;
@@ -997,7 +999,7 @@ static void copy_object_set_idnew(bContext *C, int dupflag)
 				}
 #if 0 // XXX old animation system
 				id= (ID *)ma->ipo;
-				if(id) {
+				if (id) {
 					ID_NEW_US(ma->ipo)
 					else ma->ipo= copy_ipo(ma->ipo);
 					id->us--;
@@ -1010,13 +1012,13 @@ static void copy_object_set_idnew(bContext *C, int dupflag)
 	
 #if 0 // XXX old animation system
 	/* lamps */
-	if( dupflag & USER_DUP_IPO) {
+	if ( dupflag & USER_DUP_IPO) {
 		Lamp *la= bmain->lamp.first;
-		while(la) {
-			if(la->id.newid) {
+		while (la) {
+			if (la->id.newid) {
 				Lamp *lan= (Lamp *)la->id.newid;
 				id= (ID *)lan->ipo;
-				if(id) {
+				if (id) {
 					ID_NEW_US(lan->ipo)
 					else lan->ipo= copy_ipo(lan->ipo);
 					id->us--;
@@ -1028,12 +1030,12 @@ static void copy_object_set_idnew(bContext *C, int dupflag)
 	
 	/* ipos */
 	ipo= bmain->ipo.first;
-	while(ipo) {
-		if(ipo->id.lib==NULL && ipo->id.newid) {
+	while (ipo) {
+		if (ipo->id.lib==NULL && ipo->id.newid) {
 			Ipo *ipon= (Ipo *)ipo->id.newid;
 			IpoCurve *icu;
-			for(icu= ipon->curve.first; icu; icu= icu->next) {
-				if(icu->driver) {
+			for (icu= ipon->curve.first; icu; icu= icu->next) {
+				if (icu->driver) {
 					ID_NEW(icu->driver->ob);
 				}
 			}
@@ -1057,23 +1059,23 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
 	DupliObject *dob;
 	GHash *dupli_gh= NULL, *parent_gh= NULL;
 	
-	if(!(base->object->transflag & OB_DUPLI))
+	if (!(base->object->transflag & OB_DUPLI))
 		return;
 	
 	lb= object_duplilist(scene, base->object);
 
-	if(use_hierarchy || use_base_parent) {
+	if (use_hierarchy || use_base_parent) {
 		dupli_gh= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "make_object_duplilist_real dupli_gh");
 		parent_gh= BLI_ghash_new(BLI_ghashutil_pairhash, BLI_ghashutil_paircmp, "make_object_duplilist_real parent_gh");
 	}
 	
-	for(dob= lb->first; dob; dob= dob->next) {
+	for (dob= lb->first; dob; dob= dob->next) {
 		Base *basen;
 		Object *ob= copy_object(dob->ob);
 		/* font duplis can have a totcol without material, we get them from parent
-		* should be implemented better...
-		*/
-		if(ob->mat==NULL) ob->totcol= 0;
+		 * should be implemented better...
+		 */
+		if (ob->mat==NULL) ob->totcol= 0;
 		
 		basen= MEM_dupallocN(base);
 		basen->flag &= ~(OB_FROMDUPLI|OB_FROMGROUP);
@@ -1095,14 +1097,14 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
 		copy_m4_m4(ob->obmat, dob->mat);
 		object_apply_mat4(ob, ob->obmat, FALSE, FALSE);
 
-		if(dupli_gh)
+		if (dupli_gh)
 			BLI_ghash_insert(dupli_gh, dob, ob);
-		if(parent_gh)
+		if (parent_gh)
 			BLI_ghash_insert(parent_gh, BLI_ghashutil_pairalloc(dob->ob, dob->index), ob);
 	}
 	
 	if (use_hierarchy) {
-		for(dob= lb->first; dob; dob= dob->next) {
+		for (dob= lb->first; dob; dob= dob->next) {
 			/* original parents */
 			Object *ob_src=     dob->ob;
 			Object *ob_src_par= ob_src->parent;
@@ -1111,7 +1113,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
 			Object *ob_dst_par= NULL;
 
 			/* find parent that was also made real */
-			if(ob_src_par) {
+			if (ob_src_par) {
 				GHashPair *pair = BLI_ghashutil_pairalloc(ob_src_par, dob->index);
 				ob_dst_par = BLI_ghash_lookup(parent_gh, pair);
 				BLI_ghashutil_pairfree(pair);
@@ -1141,7 +1143,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
 				 * still work out ok */
 				object_apply_mat4(ob_dst, dob->mat, FALSE, TRUE);
 
-				/* to set ob_dst->orig and incase theres any other discrepicies */
+				/* to set ob_dst->orig and in case theres any other discrepicies */
 				DAG_id_tag_update(&ob_dst->id, OB_RECALC_OB);
 			}
 		}
@@ -1149,7 +1151,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
 	else if (use_base_parent) {
 		/* since we are ignoring the internal hierarchy - parent all to the
 		 * base object */
-		for(dob= lb->first; dob; dob= dob->next) {
+		for (dob= lb->first; dob; dob= dob->next) {
 			/* original parents */
 			Object *ob_dst= BLI_ghash_lookup(dupli_gh, dob);
 
@@ -1165,9 +1167,9 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
 		}
 	}
 
-	if(dupli_gh)
+	if (dupli_gh)
 		BLI_ghash_free(dupli_gh, NULL, NULL);
-	if(parent_gh)
+	if (parent_gh)
 		BLI_ghash_free(parent_gh, BLI_ghashutil_pairfree, NULL);
 
 	copy_object_set_idnew(C, 0);
@@ -1207,17 +1209,17 @@ void OBJECT_OT_duplicates_make_real(wmOperatorType *ot)
 {
 	
 	/* identifiers */
-	ot->name= "Make Duplicates Real";
+	ot->name = "Make Duplicates Real";
 	ot->description = "Make dupli objects attached to this object real";
-	ot->idname= "OBJECT_OT_duplicates_make_real";
+	ot->idname = "OBJECT_OT_duplicates_make_real";
 	
 	/* api callbacks */
-	ot->exec= object_duplicates_make_real_exec;
+	ot->exec = object_duplicates_make_real_exec;
 	
-	ot->poll= ED_operator_objectmode;
+	ot->poll = ED_operator_objectmode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	RNA_def_boolean(ot->srna, "use_base_parent", 0, "Parent", "Parent newly created objects to the original duplicator");
 	RNA_def_boolean(ot->srna, "use_hierarchy", 0, "Keep Hierarchy", "Maintain parent child relationships");
@@ -1232,12 +1234,12 @@ static EnumPropertyItem convert_target_items[]= {
 
 static void curvetomesh(Scene *scene, Object *ob) 
 {
-	if(ob->disp.first == NULL)
+	if (ob->disp.first == NULL)
 		makeDispListCurveTypes(scene, ob, 0); /* force creation */
 
 	nurbs_to_mesh(ob); /* also does users */
 
-	if(ob->type == OB_MESH)
+	if (ob->type == OB_MESH)
 		object_free_modifiers(ob);
 }
 
@@ -1297,7 +1299,7 @@ static int convert_exec(bContext *C, wmOperator *op)
 		ob->flag &= ~OB_DONE;
 
 		/* flag data thats not been edited (only needed for !keep_original) */
-		if(ob->data) {
+		if (ob->data) {
 			((ID *)ob->data)->flag |= LIB_DOIT;
 		}
 	}
@@ -1306,17 +1308,17 @@ static int convert_exec(bContext *C, wmOperator *op)
 	CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
 		ob= base->object;
 
-		if(ob->flag & OB_DONE || !IS_TAGGED(ob->data)) {
+		if (ob->flag & OB_DONE || !IS_TAGGED(ob->data)) {
 			if (ob->type != target) {
 				base->flag &= ~SELECT;
 				ob->flag &= ~SELECT;
 			}
 
 			/* obdata already modified */
-			if(!IS_TAGGED(ob->data)) {
+			if (!IS_TAGGED(ob->data)) {
 				/* When 2 objects with linked data are selected, converting both
 				 * would keep modifiers on all but the converted object [#26003] */
-				if(ob->type == OB_MESH) {
+				if (ob->type == OB_MESH) {
 					object_free_modifiers(ob);	/* after derivedmesh calls! */
 				}
 			}
@@ -1334,16 +1336,17 @@ static int convert_exec(bContext *C, wmOperator *op)
 
 				/* make a new copy of the mesh */
 				newob->data= copy_mesh(me);
-			} else {
+			}
+			else {
 				newob = ob;
 			}
 
 			mesh_to_curve(scene, newob);
 
-			if(newob->type==OB_CURVE)
+			if (newob->type==OB_CURVE)
 				object_free_modifiers(newob);	/* after derivedmesh calls! */
 		}
-		else if(ob->type==OB_MESH && ob->modifiers.first) { /* converting a mesh with no modifiers causes a segfault */
+		else if (ob->type==OB_MESH && ob->modifiers.first) { /* converting a mesh with no modifiers causes a segfault */
 			ob->flag |= OB_DONE;
 
 			if (keep_original) {
@@ -1356,7 +1359,8 @@ static int convert_exec(bContext *C, wmOperator *op)
 
 				/* make a new copy of the mesh */
 				newob->data= copy_mesh(me);
-			} else {
+			}
+			else {
 				newob = ob;
 				ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
 			}
@@ -1368,12 +1372,14 @@ static int convert_exec(bContext *C, wmOperator *op)
 			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_to_mesh(dm, newob->data);
+			DM_to_mesh(dm, newob->data, newob);
+
+			/* re-tessellation is called by DM_to_mesh */
 
 			dm->release(dm);
 			object_free_modifiers(newob);	/* after derivedmesh calls! */
 		}
-		else if(ob->type==OB_FONT) {
+		else if (ob->type==OB_FONT) {
 			ob->flag |= OB_DONE;
 
 			if (keep_original) {
@@ -1385,7 +1391,8 @@ static int convert_exec(bContext *C, wmOperator *op)
 
 				/* make a new copy of the curve */
 				newob->data= copy_curve(ob->data);
-			} else {
+			}
+			else {
 				newob= ob;
 			}
 
@@ -1397,28 +1404,28 @@ static int convert_exec(bContext *C, wmOperator *op)
 			newob->type= OB_CURVE;
 			cu->type= OB_CURVE;
 
-			if(cu->vfont) {
+			if (cu->vfont) {
 				cu->vfont->id.us--;
 				cu->vfont= NULL;
 			}
-			if(cu->vfontb) {
+			if (cu->vfontb) {
 				cu->vfontb->id.us--;
 				cu->vfontb= NULL;
 			}
-			if(cu->vfonti) {
+			if (cu->vfonti) {
 				cu->vfonti->id.us--;
 				cu->vfonti= NULL;
 			}
-			if(cu->vfontbi) {
+			if (cu->vfontbi) {
 				cu->vfontbi->id.us--;
 				cu->vfontbi= NULL;
 			}
 
 			if (!keep_original) {
 				/* other users */
-				if(cu->id.us>1) {
-					for(ob1= bmain->object.first; ob1; ob1=ob1->id.next) {
-						if(ob1->data==ob->data) {
+				if (cu->id.us>1) {
+					for (ob1= bmain->object.first; ob1; ob1=ob1->id.next) {
+						if (ob1->data==ob->data) {
 							ob1->type= OB_CURVE;
 							ob1->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
 						}
@@ -1426,20 +1433,20 @@ static int convert_exec(bContext *C, wmOperator *op)
 				}
 			}
 
-			for(nu=cu->nurb.first; nu; nu=nu->next)
+			for (nu=cu->nurb.first; nu; nu=nu->next)
 				nu->charidx= 0;
 
-			if(target == OB_MESH) {
+			if (target == OB_MESH) {
 				curvetomesh(scene, newob);
 
 				/* meshes doesn't use displist */
 				freedisplist(&newob->disp);
 			}
 		}
-		else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
+		else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
 			ob->flag |= OB_DONE;
 
-			if(target == OB_MESH) {
+			if (target == OB_MESH) {
 				if (keep_original) {
 					basen= duplibase_for_convert(scene, base, NULL);
 					newob= basen->object;
@@ -1449,7 +1456,8 @@ static int convert_exec(bContext *C, wmOperator *op)
 
 					/* make a new copy of the curve */
 					newob->data= copy_curve(ob->data);
-				} else {
+				}
+				else {
 					newob= ob;
 
 					/* meshes doesn't use displist */
@@ -1459,7 +1467,7 @@ static int convert_exec(bContext *C, wmOperator *op)
 				curvetomesh(scene, newob);
 			}
 		}
-		else if(ob->type==OB_MBALL && target == OB_MESH) {
+		else if (ob->type==OB_MBALL && target == OB_MESH) {
 			Object *baseob;
 
 			base->flag &= ~SELECT;
@@ -1476,7 +1484,7 @@ static int convert_exec(bContext *C, wmOperator *op)
 				makeDispListMBall(scene, baseob);
 			}
 
-			if(!(baseob->flag & OB_DONE)) {
+			if (!(baseob->flag & OB_DONE)) {
 				baseob->flag |= OB_DONE;
 
 				basen= duplibase_for_convert(scene, base, baseob);
@@ -1490,9 +1498,9 @@ static int convert_exec(bContext *C, wmOperator *op)
 
 				me= newob->data;
 				me->totcol= mb->totcol;
-				if(newob->totcol) {
+				if (newob->totcol) {
 					me->mat= MEM_dupallocN(mb->mat);
-					for(a=0; a<newob->totcol; a++) id_us_plus((ID *)me->mat[a]);
+					for (a=0; a<newob->totcol; a++) id_us_plus((ID *)me->mat[a]);
 				}
 
 				mball_to_mesh(&baseob->disp, newob->data);
@@ -1511,8 +1519,8 @@ static int convert_exec(bContext *C, wmOperator *op)
 		/* tag obdata if it was been changed */
 
 		/* If the original object is active then make this object active */
-		if(basen) {
-			if(ob == obact) {
+		if (basen) {
+			if (ob == obact) {
 				/* store new active base to update BASACT */
 				basact= basen;
 			}
@@ -1526,8 +1534,8 @@ static int convert_exec(bContext *C, wmOperator *op)
 		}
 
 		/* delete original if needed */
-		if(basedel) {
-			if(!keep_original)
+		if (basedel) {
+			if (!keep_original)
 				ED_base_object_free_and_unlink(bmain, scene, basedel);	
 
 			basedel = NULL;
@@ -1535,7 +1543,7 @@ static int convert_exec(bContext *C, wmOperator *op)
 	}
 	CTX_DATA_END;
 
-	if(!keep_original) {
+	if (!keep_original) {
 		if (mballConverted) {
 			Base *base= scene->base.first, *tmpbase;
 			while (base) {
@@ -1560,7 +1568,8 @@ static int convert_exec(bContext *C, wmOperator *op)
 		/* active base was changed */
 		ED_base_object_activate(C, basact);
 		BASACT= basact;
-	} else if (BASACT->object->flag & OB_DONE) {
+	}
+	else if (BASACT->object->flag & OB_DONE) {
 		WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, BASACT->object);
 		WM_event_add_notifier(C, NC_OBJECT|ND_DATA, BASACT->object);
 	}
@@ -1576,30 +1585,30 @@ static int convert_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_convert(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Convert to";
+	ot->name = "Convert to";
 	ot->description = "Convert selected objects to another type";
-	ot->idname= "OBJECT_OT_convert";
+	ot->idname = "OBJECT_OT_convert";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= convert_exec;
-	ot->poll= convert_poll;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = convert_exec;
+	ot->poll = convert_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
-	ot->prop= RNA_def_enum(ot->srna, "target", convert_target_items, OB_MESH, "Target", "Type of object to convert to");
+	ot->prop = RNA_def_enum(ot->srna, "target", convert_target_items, OB_MESH, "Target", "Type of object to convert to");
 	RNA_def_boolean(ot->srna, "keep_original", 0, "Keep Original", "Keep original objects instead of replacing them");
 }
 
 /**************************** Duplicate ************************/
 
 /* 
-	dupflag: a flag made from constants declared in DNA_userdef_types.h
-	The flag tells adduplicate() weather to copy data linked to the object, or to reference the existing data.
-	U.dupflag for default operations or you can construct a flag as python does
-	if the dupflag is 0 then no data will be copied (linked duplicate) */
+ * dupflag: a flag made from constants declared in DNA_userdef_types.h
+ * The flag tells adduplicate() weather to copy data linked to the object, or to reference the existing data.
+ * U.dupflag for default operations or you can construct a flag as python does
+ * if the dupflag is 0 then no data will be copied (linked duplicate) */
 
 /* used below, assumes id.new is correct */
 /* leaves selection of base/object unaltered */
@@ -1612,7 +1621,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
 	int a, didit;
 
 	ob= base->object;
-	if(ob->mode & OB_MODE_POSE) {
+	if (ob->mode & OB_MODE_POSE) {
 		; /* nothing? */
 	}
 	else {
@@ -1624,42 +1633,42 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
 		BLI_addhead(&scene->base, basen);	/* addhead: prevent eternal loop */
 		basen->object= obn;
 		
-		if(basen->flag & OB_FROMGROUP) {
+		if (basen->flag & OB_FROMGROUP) {
 			Group *group;
-			for(group= bmain->group.first; group; group= group->id.next) {
-				if(object_in_group(ob, group))
+			for (group= bmain->group.first; group; group= group->id.next) {
+				if (object_in_group(ob, group))
 					add_to_group(group, obn, scene, basen);
 			}
 		}
 		
 		/* duplicates using userflags */
-		if(dupflag & USER_DUP_ACT) {
+		if (dupflag & USER_DUP_ACT) {
 			BKE_copy_animdata_id_action(&obn->id);
 		}
 		
-		if(dupflag & USER_DUP_MAT) {
-			for(a=0; a<obn->totcol; a++) {
+		if (dupflag & USER_DUP_MAT) {
+			for (a=0; a<obn->totcol; a++) {
 				id= (ID *)obn->mat[a];
-				if(id) {
+				if (id) {
 					ID_NEW_US(obn->mat[a])
 					else obn->mat[a]= copy_material(obn->mat[a]);
 					id->us--;
 					
-					if(dupflag & USER_DUP_ACT) {
+					if (dupflag & USER_DUP_ACT) {
 						BKE_copy_animdata_id_action(&obn->mat[a]->id);
 					}
 				}
 			}
 		}
-		if(dupflag & USER_DUP_PSYS) {
+		if (dupflag & USER_DUP_PSYS) {
 			ParticleSystem *psys;
-			for(psys=obn->particlesystem.first; psys; psys=psys->next) {
+			for (psys=obn->particlesystem.first; psys; psys=psys->next) {
 				id= (ID*) psys->part;
-				if(id) {
+				if (id) {
 					ID_NEW_US(psys->part)
 					else psys->part= psys_copy_settings(psys->part);
 					
-					if(dupflag & USER_DUP_ACT) {
+					if (dupflag & USER_DUP_ACT) {
 						BKE_copy_animdata_id_action(&psys->part->id);
 					}
 
@@ -1673,12 +1682,12 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
 		
 		switch(obn->type) {
 			case OB_MESH:
-				if(dupflag & USER_DUP_MESH) {
+				if (dupflag & USER_DUP_MESH) {
 					ID_NEW_US2( obn->data )
 					else {
 						obn->data= copy_mesh(obn->data);
 						
-						if(obn->fluidsimSettings) {
+						if (obn->fluidsimSettings) {
 							obn->fluidsimSettings->orgMesh = (Mesh *)obn->data;
 						}
 						
@@ -1688,7 +1697,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
 				}
 				break;
 			case OB_CURVE:
-				if(dupflag & USER_DUP_CURVE) {
+				if (dupflag & USER_DUP_CURVE) {
 					ID_NEW_US2(obn->data )
 					else {
 						obn->data= copy_curve(obn->data);
@@ -1698,7 +1707,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
 				}
 				break;
 			case OB_SURF:
-				if(dupflag & USER_DUP_SURF) {
+				if (dupflag & USER_DUP_SURF) {
 					ID_NEW_US2( obn->data )
 					else {
 						obn->data= copy_curve(obn->data);
@@ -1708,7 +1717,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
 				}
 				break;
 			case OB_FONT:
-				if(dupflag & USER_DUP_FONT) {
+				if (dupflag & USER_DUP_FONT) {
 					ID_NEW_US2( obn->data )
 					else {
 						obn->data= copy_curve(obn->data);
@@ -1718,7 +1727,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
 				}
 				break;
 			case OB_MBALL:
-				if(dupflag & USER_DUP_MBALL) {
+				if (dupflag & USER_DUP_MBALL) {
 					ID_NEW_US2(obn->data )
 					else {
 						obn->data= copy_mball(obn->data);
@@ -1728,7 +1737,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
 				}
 				break;
 			case OB_LAMP:
-				if(dupflag & USER_DUP_LAMP) {
+				if (dupflag & USER_DUP_LAMP) {
 					ID_NEW_US2(obn->data )
 					else {
 						obn->data= copy_lamp(obn->data);
@@ -1740,9 +1749,9 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
 				
 			case OB_ARMATURE:
 				obn->recalc |= OB_RECALC_DATA;
-				if(obn->pose) obn->pose->flag |= POSE_RECALC;
+				if (obn->pose) obn->pose->flag |= POSE_RECALC;
 					
-					if(dupflag & USER_DUP_ARM) {
+					if (dupflag & USER_DUP_ARM) {
 						ID_NEW_US2(obn->data )
 						else {
 							obn->data= copy_armature(obn->data);
@@ -1755,7 +1764,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
 						break;
 				
 			case OB_LATTICE:
-				if(dupflag!=0) {
+				if (dupflag!=0) {
 					ID_NEW_US2(obn->data )
 					else {
 						obn->data= copy_lattice(obn->data);
@@ -1765,7 +1774,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
 				}
 				break;
 			case OB_CAMERA:
-				if(dupflag!=0) {
+				if (dupflag!=0) {
 					ID_NEW_US2(obn->data )
 					else {
 						obn->data= copy_camera(obn->data);
@@ -1775,7 +1784,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
 				}
 				break;
 			case OB_SPEAKER:
-				if(dupflag!=0) {
+				if (dupflag!=0) {
 					ID_NEW_US2(obn->data )
 					else {
 						obn->data= copy_speaker(obn->data);
@@ -1788,34 +1797,34 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
 		}
 
 		/* check if obdata is copied */
-		if(didit) {
+		if (didit) {
 			Key *key = ob_get_key(obn);
 			
-			if(dupflag & USER_DUP_ACT) {
+			if (dupflag & USER_DUP_ACT) {
 				bActuator *act;
 
 				BKE_copy_animdata_id_action((ID *)obn->data);
-				if(key) {
+				if (key) {
 					BKE_copy_animdata_id_action((ID*)key);
 				}
 
 				/* Update the duplicated action in the action actuators */
 				for (act = obn->actuators.first; act; act = act->next) {
-					if(act->type == ACT_ACTION) {
+					if (act->type == ACT_ACTION) {
 						bActionActuator* actact = (bActionActuator*) act->data;
-						if(actact->act == ob->adt->action) {
+						if (ob->adt && actact->act == ob->adt->action) {
 							actact->act = obn->adt->action;
 						}
 					}
 				}
 			}
 			
-			if(dupflag & USER_DUP_MAT) {
+			if (dupflag & USER_DUP_MAT) {
 				matarar= give_matarar(obn);
-				if(matarar) {
-					for(a=0; a<obn->totcol; a++) {
+				if (matarar) {
+					for (a=0; a<obn->totcol; a++) {
 						id= (ID *)(*matarar)[a];
-						if(id) {
+						if (id) {
 							ID_NEW_US( (*matarar)[a] )
 							else (*matarar)[a]= copy_material((*matarar)[a]);
 							
@@ -1874,7 +1883,7 @@ static int duplicate_exec(bContext *C, wmOperator *op)
 		Base *basen= object_add_duplicate_internal(bmain, scene, base, dupflag);
 		
 		/* note that this is safe to do with this context iterator,
-		   the list is made in advance */
+		 * the list is made in advance */
 		ED_base_object_select(base, BA_DESELECT);
 
 		if (basen == NULL) {
@@ -1882,10 +1891,10 @@ static int duplicate_exec(bContext *C, wmOperator *op)
 		}
 
 		/* new object becomes active */
-		if(BASACT==base)
+		if (BASACT==base)
 			ED_base_object_activate(C, basen);
 
-		if(basen->object->data) {
+		if (basen->object->data) {
 			DAG_id_tag_update(basen->object->data, 0);
 		}
 	}
@@ -1906,16 +1915,16 @@ void OBJECT_OT_duplicate(wmOperatorType *ot)
 	PropertyRNA *prop;
 	
 	/* identifiers */
-	ot->name= "Duplicate Objects";
+	ot->name = "Duplicate Objects";
 	ot->description = "Duplicate selected objects";
-	ot->idname= "OBJECT_OT_duplicate";
+	ot->idname = "OBJECT_OT_duplicate";
 	
 	/* api callbacks */
-	ot->exec= duplicate_exec;
-	ot->poll= ED_operator_objectmode;
+	ot->exec = duplicate_exec;
+	ot->poll = ED_operator_objectmode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* to give to transform */
 	RNA_def_boolean(ot->srna, "linked", 0, "Linked", "Duplicate object but not object data, linking to the original data");
@@ -1939,7 +1948,7 @@ static int add_named_exec(bContext *C, wmOperator *op)
 	/* find object, create fake base */
 	RNA_string_get(op->ptr, "name", name);
 	ob= (Object *)find_id("OB", name);
-	if(ob==NULL) 
+	if (ob==NULL) 
 		return OPERATOR_CANCELLED;
 
 	base= MEM_callocN(sizeof(Base), "duplibase");
@@ -1977,16 +1986,16 @@ static int add_named_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_add_named(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Named Object";
+	ot->name = "Add Named Object";
 	ot->description = "Add named object";
-	ot->idname= "OBJECT_OT_add_named";
+	ot->idname = "OBJECT_OT_add_named";
 	
 	/* api callbacks */
-	ot->exec= add_named_exec;
-	ot->poll= ED_operator_objectmode;
+	ot->exec = add_named_exec;
+	ot->poll = ED_operator_objectmode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	RNA_def_boolean(ot->srna, "linked", 0, "Linked", "Duplicate object but not object data, linking to the original data");
 	RNA_def_string(ot->srna, "name", "Cube", MAX_ID_NAME-2, "Name", "Object name to add");
@@ -2013,20 +2022,20 @@ static int join_exec(bContext *C, wmOperator *op)
 	Scene *scene= CTX_data_scene(C);
 	Object *ob= CTX_data_active_object(C);
 
-	if(scene->obedit) {
+	if (scene->obedit) {
 		BKE_report(op->reports, RPT_ERROR, "This data does not support joining in editmode");
 		return OPERATOR_CANCELLED;
 	}
-	else if(object_data_is_libdata(ob)) {
+	else if (object_data_is_libdata(ob)) {
 		BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata");
 		return OPERATOR_CANCELLED;
 	}
 
-	if(ob->type == OB_MESH)
+	if (ob->type == OB_MESH)
 		return join_mesh_exec(C, op);
-	else if(ELEM(ob->type, OB_CURVE, OB_SURF))
+	else if (ELEM(ob->type, OB_CURVE, OB_SURF))
 		return join_curve_exec(C, op);
-	else if(ob->type == OB_ARMATURE)
+	else if (ob->type == OB_ARMATURE)
 		return join_armature_exec(C, op);
 	
 	return OPERATOR_CANCELLED;
@@ -2035,16 +2044,16 @@ static int join_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_join(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Join";
+	ot->name = "Join";
 	ot->description = "Join selected objects into active object";
-	ot->idname= "OBJECT_OT_join";
+	ot->idname = "OBJECT_OT_join";
 	
 	/* api callbacks */
-	ot->exec= join_exec;
-	ot->poll= join_poll;
+	ot->exec = join_exec;
+	ot->poll = join_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /**************************** Join as Shape Key*************************/
@@ -2066,16 +2075,16 @@ static int join_shapes_exec(bContext *C, wmOperator *op)
 	Scene *scene= CTX_data_scene(C);
 	Object *ob= CTX_data_active_object(C);
 	
-	if(scene->obedit) {
+	if (scene->obedit) {
 		BKE_report(op->reports, RPT_ERROR, "This data does not support joining in editmode");
 		return OPERATOR_CANCELLED;
 	}
-	else if(object_data_is_libdata(ob)) {
+	else if (object_data_is_libdata(ob)) {
 		BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata");
 		return OPERATOR_CANCELLED;
 	}
 	
-	if(ob->type == OB_MESH)
+	if (ob->type == OB_MESH)
 		return join_mesh_shapes_exec(C, op);
 	
 	return OPERATOR_CANCELLED;
@@ -2084,14 +2093,14 @@ static int join_shapes_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_join_shapes(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Join as Shapes";
+	ot->name = "Join as Shapes";
 	ot->description = "Merge selected objects to shapes of active object";
-	ot->idname= "OBJECT_OT_join_shapes";
+	ot->idname = "OBJECT_OT_join_shapes";
 	
 	/* api callbacks */
-	ot->exec= join_shapes_exec;
-	ot->poll= join_shapes_poll;
+	ot->exec = join_shapes_exec;
+	ot->poll = join_shapes_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c
index d325b49..1f012c6 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -30,11 +30,6 @@
  *  \ingroup edobj
  */
 
-
-/*
-	meshtools.c: no editmode (violated already :), tools operating on meshes
-*/
-
 #include <string.h>
 
 #include "MEM_guardedalloc.h"
@@ -86,7 +81,7 @@
 /* ****************** multires BAKING ********************** */
 
 /* holder of per-object data needed for bake job
-   needed to make job totally thread-safe */
+ * needed to make job totally thread-safe */
 typedef struct MultiresBakerJobData {
 	struct MultiresBakerJobData *next, *prev;
 	DerivedMesh *lores_dm, *hires_dm;
@@ -166,10 +161,11 @@ static void multiresbake_get_normal(const MResolvePixelData *data, float norm[],
 	                         data->mface[face_num].v3, data->mface[face_num].v4};
 	const int smoothnormal= (data->mface[face_num].flag & ME_SMOOTH);
 
-	if(!smoothnormal)  { /* flat */
-		if(data->precomputed_normals) {
+	if (!smoothnormal) { /* flat */
+		if (data->precomputed_normals) {
 			copy_v3_v3(norm, &data->precomputed_normals[3*face_num]);
-		} else {
+		}
+		else {
 			float nor[3];
 			float *p0, *p1, *p2;
 			const int iGetNrVerts= data->mface[face_num].v4!=0 ? 4 : 3;
@@ -178,16 +174,18 @@ static void multiresbake_get_normal(const MResolvePixelData *data, float norm[],
 			p1= data->mvert[indices[1]].co;
 			p2= data->mvert[indices[2]].co;
 
-			if(iGetNrVerts==4) {
+			if (iGetNrVerts==4) {
 				float *p3= data->mvert[indices[3]].co;
 				normal_quad_v3(nor, p0, p1, p2, p3);
-			} else {
+			}
+			else {
 				normal_tri_v3(nor, p0, p1, p2);
 			}
 
 			copy_v3_v3(norm, nor);
 		}
-	} else {
+	}
+	else {
 		short *no= data->mvert[indices[vert_index]].no;
 
 		normal_short_to_float_v3(norm, no);
@@ -239,12 +237,12 @@ static void flush_pixel(const MResolvePixelData *data, const int x, const int y)
 	w= 1-u-v;
 
 	/* the sign is the same at all face vertices for any non degenerate face.
-	   Just in case we clamp the interpolated value though. */
+	 * Just in case we clamp the interpolated value though. */
 	sign= (tang0[3]*u + tang1[3]*v + tang2[3]*w)<0 ? (-1.0f) : 1.0f;
 
 	/* this sequence of math is designed specifically as is with great care
-	   to be compatible with our shader. Please don't change without good reason. */
-	for(r= 0; r<3; r++) {
+	 * to be compatible with our shader. Please don't change without good reason. */
+	for (r= 0; r<3; r++) {
 		from_tang[0][r]= tang0[r]*u + tang1[r]*v + tang2[r]*w;
 		from_tang[2][r]= no0[r]*u + no1[r]*v + no2[r]*w;
 	}
@@ -263,8 +261,8 @@ static void set_rast_triangle(const MBakeRast *bake_rast, const int x, const int
 	const int w= bake_rast->w;
 	const int h= bake_rast->h;
 
-	if(x>=0 && x<w && y>=0 && y<h) {
-		if((bake_rast->texels[y*w+x])==0) {
+	if (x>=0 && x<w && y>=0 && y<h) {
+		if ((bake_rast->texels[y*w+x])==0) {
 			flush_pixel(bake_rast->data, x, y);
 			bake_rast->texels[y*w+x]= FILTER_MASK_USED;
 		}
@@ -282,29 +280,29 @@ static void rasterize_half(const MBakeRast *bake_rast,
 	const int h= bake_rast->h;
 	int y, y0, y1;
 
-	if(y1_in<=0 || y0_in>=h)
+	if (y1_in<=0 || y0_in>=h)
 		return;
 
 	y0= y0_in<0 ? 0 : y0_in;
 	y1= y1_in>=h ? h : y1_in;
 
-	for(y= y0; y<y1; y++) {
+	for (y= y0; y<y1; y++) {
 		/*-b(x-x0) + a(y-y0) = 0 */
 		int iXl, iXr, x;
 		float x_l= s_stable!=0 ? (s0_s + (((s1_s-s0_s)*(y-t0_s))/(t1_s-t0_s))) : s0_s;
 		float x_r= l_stable!=0 ? (s0_l + (((s1_l-s0_l)*(y-t0_l))/(t1_l-t0_l))) : s0_l;
 
-		if(is_mid_right!=0)
+		if (is_mid_right!=0)
 			SWAP(float, x_l, x_r);
 
 		iXl= (int)ceilf(x_l);
 		iXr= (int)ceilf(x_r);
 
-		if(iXr>0 && iXl<w) {
+		if (iXr>0 && iXl<w) {
 			iXl= iXl<0?0:iXl;
 			iXr= iXr>=w?w:iXr;
 
-			for(x= iXl; x<iXr; x++)
+			for (x= iXl; x<iXr; x++)
 				set_rast_triangle(bake_rast, x, y);
 		}
 	}
@@ -323,19 +321,20 @@ static void bake_rasterize(const MBakeRast *bake_rast, const float st0_in[2], co
 	int is_mid_right= 0, ylo, yhi, yhi_beg;
 
 	/* skip degenerates */
-	if((slo==smi && tlo==tmi) || (slo==shi && tlo==thi) || (smi==shi && tmi==thi))
+	if ((slo==smi && tlo==tmi) || (slo==shi && tlo==thi) || (smi==shi && tmi==thi))
 		return;
 
 	/* sort by T */
-	if(tlo>tmi && tlo>thi) {
+	if (tlo>tmi && tlo>thi) {
 		SWAP(float, shi, slo);
 		SWAP(float, thi, tlo);
-	} else if(tmi>thi) {
+	}
+	else if (tmi>thi) {
 		SWAP(float, shi, smi);
 		SWAP(float, thi, tmi);
 	}
 
-	if(tlo>tmi) {
+	if (tlo>tmi) {
 		SWAP(float, slo, smi);
 		SWAP(float, tlo, tmi);
 	}
@@ -346,14 +345,14 @@ static void bake_rasterize(const MBakeRast *bake_rast, const float st0_in[2], co
 	yhi_beg= (int) ceilf(tmi);
 	yhi= (int) ceilf(thi);
 
-	/*if(fTmi>ceilf(fTlo))*/
+	/*if (fTmi>ceilf(fTlo))*/
 	rasterize_half(bake_rast, slo, tlo, smi, tmi, slo, tlo, shi, thi, ylo, yhi_beg, is_mid_right);
 	rasterize_half(bake_rast, smi, tmi, shi, thi, slo, tlo, shi, thi, yhi_beg, yhi, is_mid_right);
 }
 
 static int multiresbake_test_break(MultiresBakeRender *bkr)
 {
-	if(!bkr->stop) {
+	if (!bkr->stop) {
 		/* this means baker is executed outside from job system */
 		return 0;
 	}
@@ -367,18 +366,18 @@ static void do_multires_bake(MultiresBakeRender *bkr, Image* ima, MPassKnownData
 	DerivedMesh *dm= bkr->lores_dm;
 	ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
 	const int lvl= bkr->lvl;
-	const int tot_face= dm->getNumFaces(dm);
+	const int tot_face= dm->getNumTessFaces(dm);
 	MVert *mvert= dm->getVertArray(dm);
-	MFace *mface= dm->getFaceArray(dm);
-	MTFace *mtface= dm->getFaceDataArray(dm, CD_MTFACE);
+	MFace *mface= dm->getTessFaceArray(dm);
+	MTFace *mtface= dm->getTessFaceDataArray(dm, CD_MTFACE);
 	float *pvtangent= NULL;
 
-	if(CustomData_get_layer_index(&dm->faceData, CD_TANGENT) == -1)
+	if (CustomData_get_layer_index(&dm->faceData, CD_TANGENT) == -1)
 		DM_add_tangent_layer(dm);
 
-	pvtangent= DM_get_face_data_layer(dm, CD_TANGENT);
+	pvtangent= DM_get_tessface_data_layer(dm, CD_TANGENT);
 
-	if(tot_face > 0) {  /* sanity check */
+	if (tot_face > 0) {  /* sanity check */
 		int f= 0;
 		MBakeRast bake_rast;
 		MResolvePixelData data={NULL};
@@ -387,7 +386,7 @@ static void do_multires_bake(MultiresBakeRender *bkr, Image* ima, MPassKnownData
 		data.mvert= mvert;
 		data.mtface= mtface;
 		data.pvtangent= pvtangent;
-		data.precomputed_normals= dm->getFaceDataArray(dm, CD_NORMAL);	/* don't strictly need this */
+		data.precomputed_normals= dm->getTessFaceDataArray(dm, CD_NORMAL);	/* don't strictly need this */
 		data.w= ibuf->x;
 		data.h= ibuf->y;
 		data.lores_dm= dm;
@@ -395,25 +394,25 @@ static void do_multires_bake(MultiresBakeRender *bkr, Image* ima, MPassKnownData
 		data.lvl= lvl;
 		data.pass_data= passKnownData;
 
-		if(initBakeData)
+		if (initBakeData)
 			data.bake_data= initBakeData(bkr, ima);
 
 		init_bake_rast(&bake_rast, ibuf, &data, flush_pixel);
 
-		for(f= 0; f<tot_face; f++) {
+		for (f= 0; f<tot_face; f++) {
 			MTFace *mtfate= &mtface[f];
 			int verts[3][2], nr_tris, t;
 
-			if(multiresbake_test_break(bkr))
+			if (multiresbake_test_break(bkr))
 				break;
 
-			if(mtfate->tpage!=ima)
+			if (mtfate->tpage!=ima)
 				continue;
 
 			data.face_index= f;
 
 			/* might support other forms of diagonal splits later on such as
-			   split by shortest diagonal.*/
+			 * split by shortest diagonal.*/
 			verts[0][0]=0;
 			verts[1][0]=1;
 			verts[2][0]=2;
@@ -423,27 +422,27 @@ static void do_multires_bake(MultiresBakeRender *bkr, Image* ima, MPassKnownData
 			verts[2][1]=3;
 
 			nr_tris= mface[f].v4!=0 ? 2 : 1;
-			for(t= 0; t<nr_tris; t++) {
-				data.i0= verts[0][t];
-				data.i1= verts[1][t];
-				data.i2 =verts[2][t];
+			for (t= 0; t<nr_tris; t++) {
+				data.i0 = verts[0][t];
+				data.i1 = verts[1][t];
+				data.i2 = verts[2][t];
 
 				bake_rasterize(&bake_rast, mtfate->uv[data.i0], mtfate->uv[data.i1], mtfate->uv[data.i2]);
 			}
 
 			bkr->baked_faces++;
 
-			if(bkr->do_update)
+			if (bkr->do_update)
 				*bkr->do_update= 1;
 
-			if(bkr->progress)
+			if (bkr->progress)
 				*bkr->progress= ((float)bkr->baked_objects + (float)bkr->baked_faces / tot_face) / bkr->tot_obj;
 		}
 
-		if(applyBakeData)
+		if (applyBakeData)
 			applyBakeData(data.bake_data);
 
-		if(freeBakeData)
+		if (freeBakeData)
 			freeBakeData(data.bake_data);
 	}
 }
@@ -475,7 +474,7 @@ static void interp_barycentric_tri_data(float data[3][3], float u, float v, floa
 }
 
 /* mode = 0: interpolate normals,
-   mode = 1: interpolate coord */
+ * mode = 1: interpolate coord */
 static void interp_bilinear_grid(DMGridData *grid, int grid_size, float crn_x, float crn_y, int mode, float res[3])
 {
 	int x0, x1, y0, y1;
@@ -491,12 +490,13 @@ static void interp_bilinear_grid(DMGridData *grid, int grid_size, float crn_x, f
 	u= crn_x-x0;
 	v= crn_y-y0;
 
-	if(mode == 0) {
+	if (mode == 0) {
 		copy_v3_v3(data[0], grid[y0 * grid_size + x0].no);
 		copy_v3_v3(data[1], grid[y0 * grid_size + x1].no);
 		copy_v3_v3(data[2], grid[y1 * grid_size + x1].no);
 		copy_v3_v3(data[3], grid[y1 * grid_size + x0].no);
-	} else {
+	}
+	else {
 		copy_v3_v3(data[0], grid[y0 * grid_size + x0].co);
 		copy_v3_v3(data[1], grid[y0 * grid_size + x1].co);
 		copy_v3_v3(data[2], grid[y1 * grid_size + x1].co);
@@ -514,7 +514,7 @@ static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm, const int *orig
 	int grid_size, S, face_side;
 	int *grid_offset, g_index;
 
-	lodm->getFace(lodm, face_index, &mface);
+	lodm->getTessFace(lodm, face_index, &mface);
 
 	grid_size= hidm->getGridSize(hidm);
 	grid_data= hidm->getGridData(hidm);
@@ -522,10 +522,11 @@ static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm, const int *orig
 
 	face_side= (grid_size<<1)-1;
 
-	if(lvl==0) {
+	if (lvl==0) {
 		g_index= grid_offset[face_index];
 		S= mdisp_rot_face_to_crn(mface.v4 ? 4 : 3, face_side, u*(face_side-1), v*(face_side-1), &crn_x, &crn_y);
-	} else {
+	}
+	else {
 		int side= (1 << (lvl-1)) + 1;
 		int grid_index= origindex[face_index];
 		int loc_offs= face_index % (1<<(2*lvl));
@@ -544,25 +545,26 @@ static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm, const int *orig
 	CLAMP(crn_x, 0.0f, grid_size);
 	CLAMP(crn_y, 0.0f, grid_size);
 
-	if(n != NULL)
+	if (n != NULL)
 		interp_bilinear_grid(grid_data[g_index + S], grid_size, crn_x, crn_y, 0, n);
 
-	if(co != NULL)
+	if (co != NULL)
 		interp_bilinear_grid(grid_data[g_index + S], grid_size, crn_x, crn_y, 1, co);
 }
 
 /* mode = 0: interpolate normals,
-   mode = 1: interpolate coord */
+ * mode = 1: interpolate coord */
 static void interp_bilinear_mface(DerivedMesh *dm, MFace *mface, const float u, const float v, const int mode, float res[3])
 {
 	float data[4][3];
 
-	if(mode == 0) {
+	if (mode == 0) {
 		dm->getVertNo(dm, mface->v1, data[0]);
 		dm->getVertNo(dm, mface->v2, data[1]);
 		dm->getVertNo(dm, mface->v3, data[2]);
 		dm->getVertNo(dm, mface->v4, data[3]);
-	} else {
+	}
+	else {
 		dm->getVertCo(dm, mface->v1, data[0]);
 		dm->getVertCo(dm, mface->v2, data[1]);
 		dm->getVertCo(dm, mface->v3, data[2]);
@@ -573,16 +575,17 @@ static void interp_bilinear_mface(DerivedMesh *dm, MFace *mface, const float u,
 }
 
 /* mode = 0: interpolate normals,
-   mode = 1: interpolate coord */
+ * mode = 1: interpolate coord */
 static void interp_barycentric_mface(DerivedMesh *dm, MFace *mface, const float u, const float v, const int mode, float res[3])
 {
 	float data[3][3];
 
-	if(mode == 0) {
+	if (mode == 0) {
 		dm->getVertNo(dm, mface->v1, data[0]);
 		dm->getVertNo(dm, mface->v2, data[1]);
 		dm->getVertNo(dm, mface->v3, data[2]);
-	} else {
+	}
+	else {
 		dm->getVertCo(dm, mface->v1, data[0]);
 		dm->getVertCo(dm, mface->v2, data[1]);
 		dm->getVertCo(dm, mface->v3, data[2]);
@@ -604,7 +607,7 @@ static void *init_heights_data(MultiresBakeRender *bkr, Image *ima)
 	height_data->height_max= -FLT_MAX;
 	height_data->height_min= FLT_MAX;
 
-	if(!bkr->use_lores_mesh) {
+	if (!bkr->use_lores_mesh) {
 		SubsurfModifierData smd= {{NULL}};
 		int ss_lvl= bkr->tot_lvl - bkr->lvl;
 
@@ -613,13 +616,13 @@ static void *init_heights_data(MultiresBakeRender *bkr, Image *ima)
 		smd.levels= smd.renderLevels= ss_lvl;
 		smd.flags|= eSubsurfModifierFlag_SubsurfUv;
 
-		if(bkr->simple)
+		if (bkr->simple)
 			smd.subdivType= ME_SIMPLE_SUBSURF;
 
 		height_data->ssdm= subsurf_make_derived_from_derived(bkr->lores_dm, &smd, 0, NULL, 0, 0, 0);
 	}
 
-	height_data->origindex= lodm->getFaceDataArray(lodm, CD_ORIGINDEX);
+	height_data->origindex= lodm->getTessFaceDataArray(lodm, CD_ORIGINDEX);
 
 	return (void*)height_data;
 }
@@ -631,7 +634,7 @@ static void *init_normal_data(MultiresBakeRender *bkr, Image *UNUSED(ima))
 
 	normal_data= MEM_callocN(sizeof(MNormalBakeData), "MultiresBake normalData");
 
-	normal_data->origindex= lodm->getFaceDataArray(lodm, CD_ORIGINDEX);
+	normal_data->origindex= lodm->getTessFaceDataArray(lodm, CD_ORIGINDEX);
 
 	return (void*)normal_data;
 }
@@ -651,24 +654,25 @@ static void apply_heights_data(void *bake_data)
 	float height, *heights= height_data->heights;
 	float min= height_data->height_min, max= height_data->height_max;
 
-	for(x= 0; x<ibuf->x; x++) {
-		for(y =0; y<ibuf->y; y++) {
+	for (x= 0; x<ibuf->x; x++) {
+		for (y =0; y<ibuf->y; y++) {
 			i= ibuf->x*y + x;
 
-			if(((char*)ibuf->userdata)[i] != FILTER_MASK_USED)
+			if (((char*)ibuf->userdata)[i] != FILTER_MASK_USED)
 				continue;
 
-			if(ibuf->rect_float) {
+			if (ibuf->rect_float) {
 				float *rrgbf= ibuf->rect_float + i*4;
 
-				if(max-min > 1e-5f) height= (heights[i]-min)/(max-min);
+				if (max-min > 1e-5f) height= (heights[i]-min)/(max-min);
 				else height= 0;
 
 				rrgbf[0]=rrgbf[1]=rrgbf[2]= height;
-			} else {
+			}
+			else {
 				char *rrgb= (char*)ibuf->rect + i*4;
 
-				if(max-min > 1e-5f) height= (heights[i]-min)/(max-min);
+				if (max-min > 1e-5f) height= (heights[i]-min)/(max-min);
 				else height= 0;
 
 				rrgb[0]=rrgb[1]=rrgb[2]= FTOCHAR(height);
@@ -683,7 +687,7 @@ static void free_heights_data(void *bake_data)
 {
 	MHeightBakeData *height_data= (MHeightBakeData*)bake_data;
 
-	if(height_data->ssdm)
+	if (height_data->ssdm)
 		height_data->ssdm->release(height_data->ssdm);
 
 	MEM_freeN(height_data->heights);
@@ -691,11 +695,11 @@ static void free_heights_data(void *bake_data)
 }
 
 /* MultiresBake callback for heights baking
-   general idea:
-     - find coord of point with specified UV in hi-res mesh (let's call it p1)
-     - find coord of point and normal with specified UV in lo-res mesh (or subdivided lo-res
-       mesh to make texture smoother) let's call this point p0 and n.
-     - height wound be dot(n, p1-p0) */
+ * general idea:
+ *   - find coord of point with specified UV in hi-res mesh (let's call it p1)
+ *   - find coord of point and normal with specified UV in lo-res mesh (or subdivided lo-res
+ *     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],
                                    float UNUSED(tangmat[3][3]), const int x, const int y)
@@ -709,16 +713,17 @@ static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
 	int pixel= ibuf->x*y + x;
 	float vec[3], p0[3], p1[3], n[3], len;
 
-	lores_dm->getFace(lores_dm, face_index, &mface);
+	lores_dm->getTessFace(lores_dm, face_index, &mface);
 
 	st0= mtface[face_index].uv[0];
 	st1= mtface[face_index].uv[1];
 	st2= mtface[face_index].uv[2];
 
-	if(mface.v4) {
+	if (mface.v4) {
 		st3= mtface[face_index].uv[3];
 		resolve_quad_uv(uv, st, st0, st1, st2, st3);
-	} else
+	}
+	else
 		resolve_tri_uv(uv, st, st0, st1, st2);
 
 	CLAMP(uv[0], 0.0f, 1.0f);
@@ -726,15 +731,17 @@ static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
 
 	get_ccgdm_data(lores_dm, hires_dm, height_data->origindex, lvl, face_index, uv[0], uv[1], p1, 0);
 
-	if(height_data->ssdm) {
+	if (height_data->ssdm) {
 		get_ccgdm_data(lores_dm, height_data->ssdm, height_data->origindex, 0, face_index, uv[0], uv[1], p0, n);
-	} else {
-		lores_dm->getFace(lores_dm, face_index, &mface);
+	}
+	else {
+		lores_dm->getTessFace(lores_dm, face_index, &mface);
 
-		if(mface.v4) {
+		if (mface.v4) {
 			interp_bilinear_mface(lores_dm, &mface, uv[0], uv[1], 1, p0);
 			interp_bilinear_mface(lores_dm, &mface, uv[0], uv[1], 0, n);
-		} else {
+		}
+		else {
 			interp_barycentric_mface(lores_dm, &mface, uv[0], uv[1], 1, p0);
 			interp_barycentric_mface(lores_dm, &mface, uv[0], uv[1], 0, n);
 		}
@@ -744,25 +751,26 @@ static void apply_heights_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
 	len= dot_v3v3(n, vec);
 
 	height_data->heights[pixel]= len;
-	if(len<height_data->height_min) height_data->height_min= len;
-	if(len>height_data->height_max) height_data->height_max= len;
+	if (len<height_data->height_min) height_data->height_min= len;
+	if (len>height_data->height_max) height_data->height_max= len;
 
-	if(ibuf->rect_float) {
+	if (ibuf->rect_float) {
 		float *rrgbf= ibuf->rect_float + pixel*4;
 		rrgbf[3]= 1.0f;
 
 		ibuf->userflags= IB_RECT_INVALID;
-	} else {
+	}
+	else {
 		char *rrgb= (char*)ibuf->rect + pixel*4;
 		rrgb[3]= 255;
 	}
 }
 
 /* MultiresBake callback for normals' baking
-   general idea:
-     - find coord and normal of point with specified UV in hi-res mesh
-     - multiply it by tangmat
-     - vector in color space would be norm(vec) /2 + (0.5, 0.5, 0.5) */
+ * general idea:
+ *   - find coord and normal of point with specified UV in hi-res mesh
+ *   - 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],
                                    float tangmat[3][3], const int x, const int y)
@@ -776,16 +784,17 @@ static void apply_tangmat_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
 	int pixel= ibuf->x*y + x;
 	float n[3], vec[3], tmp[3]= {0.5, 0.5, 0.5};
 
-	lores_dm->getFace(lores_dm, face_index, &mface);
+	lores_dm->getTessFace(lores_dm, face_index, &mface);
 
 	st0= mtface[face_index].uv[0];
 	st1= mtface[face_index].uv[1];
 	st2= mtface[face_index].uv[2];
 
-	if(mface.v4) {
+	if (mface.v4) {
 		st3= mtface[face_index].uv[3];
 		resolve_quad_uv(uv, st, st0, st1, st2, st3);
-	} else
+	}
+	else
 		resolve_tri_uv(uv, st, st0, st1, st2);
 
 	CLAMP(uv[0], 0.0f, 1.0f);
@@ -798,7 +807,7 @@ static void apply_tangmat_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
 	mul_v3_fl(vec, 0.5);
 	add_v3_v3(vec, tmp);
 
-	if(ibuf->rect_float) {
+	if (ibuf->rect_float) {
 		float *rrgbf= ibuf->rect_float + pixel*4;
 		rrgbf[0]= vec[0];
 		rrgbf[1]= vec[1];
@@ -806,7 +815,8 @@ static void apply_tangmat_callback(DerivedMesh *lores_dm, DerivedMesh *hires_dm,
 		rrgbf[3]= 1.0f;
 
 		ibuf->userflags= IB_RECT_INVALID;
-	} else {
+	}
+	else {
 		unsigned char *rrgb= (unsigned char *)ibuf->rect + pixel*4;
 		rgb_float_to_uchar(rrgb, vec);
 		rrgb[3]= 255;
@@ -822,14 +832,14 @@ static void count_images(MultiresBakeRender *bkr)
 	bkr->image.first= bkr->image.last= NULL;
 	bkr->tot_image= 0;
 
-	totface= dm->getNumFaces(dm);
+	totface= dm->getNumTessFaces(dm);
 
-	for(a= 0; a<totface; a++)
+	for (a= 0; a<totface; a++)
 		mtface[a].tpage->id.flag&= ~LIB_DOIT;
 
-	for(a= 0; a<totface; a++) {
+	for (a= 0; a<totface; a++) {
 		Image *ima= mtface[a].tpage;
-		if((ima->id.flag&LIB_DOIT)==0) {
+		if ((ima->id.flag&LIB_DOIT)==0) {
 			LinkData *data= BLI_genericNodeN(ima);
 			BLI_addtail(&bkr->image, data);
 			bkr->tot_image++;
@@ -837,7 +847,7 @@ static void count_images(MultiresBakeRender *bkr)
 		}
 	}
 
-	for(a= 0; a<totface; a++)
+	for (a= 0; a<totface; a++)
 		mtface[a].tpage->id.flag&= ~LIB_DOIT;
 }
 
@@ -845,11 +855,11 @@ static void bake_images(MultiresBakeRender *bkr)
 {
 	LinkData *link;
 
-	for(link= bkr->image.first; link; link= link->next) {
+	for (link= bkr->image.first; link; link= link->next) {
 		Image *ima= (Image*)link->data;
 		ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
 
-		if(ibuf->x>0 && ibuf->y>0) {
+		if (ibuf->x>0 && ibuf->y>0) {
 			ibuf->userdata= MEM_callocN(ibuf->y*ibuf->x, "MultiresBake imbuf mask");
 
 			switch(bkr->mode) {
@@ -871,26 +881,26 @@ static void finish_images(MultiresBakeRender *bkr)
 {
 	LinkData *link;
 
-	for(link= bkr->image.first; link; link= link->next) {
+	for (link= bkr->image.first; link; link= link->next) {
 		Image *ima= (Image*)link->data;
 		ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
 
-		if(ibuf->x<=0 || ibuf->y<=0)
+		if (ibuf->x<=0 || ibuf->y<=0)
 			continue;
 
 		RE_bake_ibuf_filter(ibuf, (char *)ibuf->userdata, bkr->bake_filter);
 
 		ibuf->userflags|= IB_BITMAPDIRTY;
 
-		if(ibuf->rect_float)
+		if (ibuf->rect_float)
 			ibuf->userflags|= IB_RECT_INVALID;
 
-		if(ibuf->mipmap[0]) {
+		if (ibuf->mipmap[0]) {
 			ibuf->userflags|= IB_MIPMAP_INVALID;
 			imb_freemipmapImBuf(ibuf);
 		}
 
-		if(ibuf->userdata) {
+		if (ibuf->userdata) {
 			MEM_freeN(ibuf->userdata);
 			ibuf->userdata= NULL;
 		}
@@ -915,7 +925,7 @@ static int multiresbake_check(bContext *C, wmOperator *op)
 	CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
 		ob= base->object;
 
-		if(ob->type != OB_MESH) {
+		if (ob->type != OB_MESH) {
 			BKE_report(op->reports, RPT_ERROR, "Basking of multires data only works with active object which is a mesh");
 
 			ok= 0;
@@ -926,59 +936,63 @@ static int multiresbake_check(bContext *C, wmOperator *op)
 		mmd= get_multires_modifier(scene, ob, 0);
 
 		/* Multi-resolution should be and be last in the stack */
-		if(ok && mmd) {
+		if (ok && mmd) {
 			ModifierData *md;
 
 			ok= mmd->totlvl>0;
 
-			for(md = (ModifierData*)mmd->modifier.next; md && ok; md = md->next) {
+			for (md = (ModifierData*)mmd->modifier.next; md && ok; md = md->next) {
 				if (modifier_isEnabled(scene, md, eModifierMode_Realtime)) {
 					ok= 0;
 				}
 			}
-		} else ok= 0;
+		}
+		else ok= 0;
 
-		if(!ok) {
+		if (!ok) {
 			BKE_report(op->reports, RPT_ERROR, "Multires data baking requires multi-resolution object");
 
 			break;
 		}
 
-		if(!me->mtface) {
+		if (!me->mtpoly) {
 			BKE_report(op->reports, RPT_ERROR, "Mesh should be unwrapped before multires data baking");
 
 			ok= 0;
-		} else {
-			a= me->totface;
+		}
+		else {
+			a = me->totpoly;
 			while (ok && a--) {
-				Image *ima= me->mtface[a].tpage;
+				Image *ima = me->mtpoly[a].tpage;
 
-				if(!ima) {
+				if (!ima) {
 					BKE_report(op->reports, RPT_ERROR, "You should have active texture to use multires baker");
 
 					ok= 0;
-				} else {
+				}
+				else {
 					ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
 
-					if(!ibuf) {
+					if (!ibuf) {
 						BKE_report(op->reports, RPT_ERROR, "Baking should happend to image with image buffer");
 
 						ok= 0;
-					} else {
-						if(ibuf->rect==NULL && ibuf->rect_float==NULL)
+					}
+					else {
+						if (ibuf->rect==NULL && ibuf->rect_float==NULL)
 							ok= 0;
 
-						if(ibuf->rect_float && !(ibuf->channels==0 || ibuf->channels==4))
+						if (ibuf->rect_float && !(ibuf->channels==0 || ibuf->channels==4))
 							ok= 0;
 
-						if(!ok)
+						if (!ok)
 							BKE_report(op->reports, RPT_ERROR, "Baking to unsupported image type");
 					}
 				}
 			}
 		}
 
-		if(!ok)
+		if (!ok)
 			break;
 	}
 	CTX_DATA_END;
@@ -994,15 +1008,18 @@ static DerivedMesh *multiresbake_create_loresdm(Scene *scene, Object *ob, int *l
 
 	*lvl= mmd->lvl;
 
-	if(*lvl==0) {
-		return NULL;
-	} else {
+	if (*lvl==0) {
+		DerivedMesh *tmp_dm= CDDM_from_mesh(me, ob);
+		dm= CDDM_copy(tmp_dm);
+		tmp_dm->release(tmp_dm);
+	}
+	else {
 		MultiresModifierData tmp_mmd= *mmd;
 		DerivedMesh *cddm= CDDM_from_mesh(me, ob);
 
 		tmp_mmd.lvl= *lvl;
 		tmp_mmd.sculptlvl= *lvl;
-		dm= multires_dm_create_from_derived(&tmp_mmd, 1, cddm, ob, 0, 0);
+		dm= multires_dm_create_from_derived(&tmp_mmd, 1, cddm, ob, 0);
 		cddm->release(cddm);
 	}
 
@@ -1022,7 +1039,7 @@ static DerivedMesh *multiresbake_create_hiresdm(Scene *scene, Object *ob, int *l
 
 	tmp_mmd.lvl= mmd->totlvl;
 	tmp_mmd.sculptlvl= mmd->totlvl;
-	dm= multires_dm_create_from_derived(&tmp_mmd, 1, cddm, ob, 0, 0);
+	dm= multires_dm_create_from_derived(&tmp_mmd, 1, cddm, ob, 0);
 	cddm->release(cddm);
 
 	return dm;
@@ -1034,13 +1051,13 @@ static void clear_images(MTFace *mtface, int totface)
 	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};
 
-	for(a= 0; a<totface; a++)
+	for (a= 0; a<totface; a++)
 		mtface[a].tpage->id.flag&= ~LIB_DOIT;
 
-	for(a= 0; a<totface; a++) {
+	for (a= 0; a<totface; a++) {
 		Image *ima= mtface[a].tpage;
 
-		if((ima->id.flag&LIB_DOIT)==0) {
+		if ((ima->id.flag&LIB_DOIT)==0) {
 			ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
 
 			IMB_rectfill(ibuf, (ibuf->planes == R_IMF_PLANES_RGBA) ? vec_alpha : vec_solid);
@@ -1048,7 +1065,7 @@ static void clear_images(MTFace *mtface, int totface)
 		}
 	}
 
-	for(a= 0; a<totface; a++)
+	for (a= 0; a<totface; a++)
 		mtface[a].tpage->id.flag&= ~LIB_DOIT;
 }
 
@@ -1058,10 +1075,10 @@ static int multiresbake_image_exec_locked(bContext *C, wmOperator *op)
 	Scene *scene= CTX_data_scene(C);
 	int objects_baked= 0;
 
-	if(!multiresbake_check(C, op))
+	if (!multiresbake_check(C, op))
 		return OPERATOR_CANCELLED;
 
-	if(scene->r.bake_flag&R_BAKE_CLEAR) {  /* clear images */
+	if (scene->r.bake_flag&R_BAKE_CLEAR) {  /* clear images */
 		CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
 			Mesh *me;
 
@@ -1088,7 +1105,7 @@ static int multiresbake_image_exec_locked(bContext *C, wmOperator *op)
 		/* create low-resolution DM (to bake to) and hi-resolution DM (to bake from) */
 		bkr.lores_dm= multiresbake_create_loresdm(scene, ob, &bkr.lvl);
 
-		if(!bkr.lores_dm)
+		if (!bkr.lores_dm)
 			continue;
 
 		bkr.hires_dm= multiresbake_create_hiresdm(scene, ob, &bkr.tot_lvl, &bkr.simple);
@@ -1104,7 +1121,7 @@ static int multiresbake_image_exec_locked(bContext *C, wmOperator *op)
 	}
 	CTX_DATA_END;
 
-	if(!objects_baked)
+	if (!objects_baked)
 		BKE_report(op->reports, RPT_ERROR, "No objects found to bake from");
 
 	return OPERATOR_FINISHED;
@@ -1131,7 +1148,7 @@ static void init_multiresbake_job(bContext *C, MultiresBakeJob *bkj)
 		multires_force_update(ob);
 
 		lores_dm = multiresbake_create_loresdm(scene, ob, &lvl);
-		if(!lores_dm)
+		if (!lores_dm)
 			continue;
 
 		data= MEM_callocN(sizeof(MultiresBakerJobData), "multiresBaker derivedMesh_data");
@@ -1152,16 +1169,16 @@ static void multiresbake_startjob(void *bkv, short *stop, short *do_update, floa
 
 	tot_obj= BLI_countlist(&bkj->data);
 
-	if(bkj->bake_clear) {  /* clear images */
-		for(data= bkj->data.first; data; data= data->next) {
+	if (bkj->bake_clear) {  /* clear images */
+		for (data= bkj->data.first; data; data= data->next) {
 			DerivedMesh *dm= data->lores_dm;
 			MTFace *mtface= CustomData_get_layer(&dm->faceData, CD_MTFACE);
 
-			clear_images(mtface, dm->getNumFaces(dm));
+			clear_images(mtface, dm->getNumTessFaces(dm));
 		}
 	}
 
-	for(data= bkj->data.first; data; data= data->next) {
+	for (data= bkj->data.first; data; data= data->next) {
 		MultiresBakeRender bkr= {0};
 
 		/* copy data stored in job descriptor */
@@ -1215,13 +1232,13 @@ static int multiresbake_image_exec(bContext *C, wmOperator *op)
 	MultiresBakeJob *bkr;
 	wmJob *steve;
 
-	if(!multiresbake_check(C, op))
+	if (!multiresbake_check(C, op))
 		return OPERATOR_CANCELLED;
 
 	bkr= MEM_callocN(sizeof(MultiresBakeJob), "MultiresBakeJob data");
 	init_multiresbake_job(C, bkr);
 
-	if(!bkr->data.first) {
+	if (!bkr->data.first) {
 		BKE_report(op->reports, RPT_ERROR, "No objects found to bake from");
 		return OPERATOR_CANCELLED;
 	}
@@ -1279,10 +1296,10 @@ static int test_bake_internal(bContext *C, ReportList *reports)
 {
 	Scene *scene= CTX_data_scene(C);
 
-	if((scene->r.bake_flag & R_BAKE_TO_ACTIVE) && CTX_data_active_object(C)==NULL) {
+	if ((scene->r.bake_flag & R_BAKE_TO_ACTIVE) && CTX_data_active_object(C)==NULL) {
 		BKE_report(reports, RPT_ERROR, "No active object");
 	}
-	else if(scene->r.bake_mode==RE_BAKE_AO && scene->world==NULL) {
+	else if (scene->r.bake_mode==RE_BAKE_AO && scene->world==NULL) {
 		BKE_report(reports, RPT_ERROR, "No world set up");
 	}
 	else {
@@ -1305,12 +1322,12 @@ static void init_bake_internal(BakeRender *bkr, bContext *C)
 	bkr->actob= (scene->r.bake_flag & R_BAKE_TO_ACTIVE) ? OBACT : NULL;
 	bkr->re= RE_NewRender("_Bake View_");
 
-	if(scene->r.bake_mode==RE_BAKE_AO) {
+	if (scene->r.bake_mode==RE_BAKE_AO) {
 		/* If raytracing or AO is disabled, switch it on temporarily for baking. */
 		bkr->prev_wo_amb_occ = (scene->world->mode & WO_AMB_OCC) != 0;
 		scene->world->mode |= WO_AMB_OCC;
 	}
-	if(scene->r.bake_mode==RE_BAKE_AO || bkr->actob) {
+	if (scene->r.bake_mode==RE_BAKE_AO || bkr->actob) {
 		bkr->prev_r_raytrace = (scene->r.mode & R_RAYTRACE) != 0;
 		scene->r.mode |= R_RAYTRACE;
 	}
@@ -1321,22 +1338,22 @@ static void finish_bake_internal(BakeRender *bkr)
 	RE_Database_Free(bkr->re);
 
 	/* restore raytrace and AO */
-	if(bkr->scene->r.bake_mode==RE_BAKE_AO)
-		if(bkr->prev_wo_amb_occ == 0)
+	if (bkr->scene->r.bake_mode==RE_BAKE_AO)
+		if (bkr->prev_wo_amb_occ == 0)
 			bkr->scene->world->mode &= ~WO_AMB_OCC;
 
-	if(bkr->scene->r.bake_mode==RE_BAKE_AO || bkr->actob)
-		if(bkr->prev_r_raytrace == 0)
+	if (bkr->scene->r.bake_mode==RE_BAKE_AO || bkr->actob)
+		if (bkr->prev_r_raytrace == 0)
 			bkr->scene->r.mode &= ~R_RAYTRACE;
 
-	if(bkr->result==BAKE_RESULT_OK) {
+	if (bkr->result==BAKE_RESULT_OK) {
 		Image *ima;
 		/* force OpenGL reload and mipmap recalc */
-		for(ima= G.main->image.first; ima; ima= ima->id.next) {
-			if(ima->ok==IMA_OK_LOADED) {
+		for (ima= G.main->image.first; ima; ima= ima->id.next) {
+			if (ima->ok==IMA_OK_LOADED) {
 				ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
-				if(ibuf) {
-					if(ibuf->userflags & IB_BITMAPDIRTY) {
+				if (ibuf) {
+					if (ibuf->userflags & IB_BITMAPDIRTY) {
 						GPU_free_image(ima);
 						imb_freemipmapImBuf(ibuf);
 					}
@@ -1385,9 +1402,9 @@ static void bake_update(void *bkv)
 {
 	BakeRender *bkr= bkv;
 
-	if(bkr->sa && bkr->sa->spacetype==SPACE_IMAGE) { /* incase the user changed while baking */
+	if (bkr->sa && bkr->sa->spacetype==SPACE_IMAGE) { /* in case the user changed while baking */
 		SpaceImage *sima= bkr->sa->spacedata.first;
-		if(sima)
+		if (sima)
 			sima->image= RE_bake_shade_get_image();
 	}
 }
@@ -1397,9 +1414,9 @@ static void bake_freejob(void *bkv)
 	BakeRender *bkr= bkv;
 	finish_bake_internal(bkr);
 
-	if(bkr->result==BAKE_RESULT_NO_OBJECTS)
+	if (bkr->result==BAKE_RESULT_NO_OBJECTS)
 		BKE_report(bkr->reports, RPT_ERROR, "No objects or images found to bake to");
-	else if(bkr->result==BAKE_RESULT_FEEDBACK_LOOP)
+	else if (bkr->result==BAKE_RESULT_FEEDBACK_LOOP)
 		BKE_report(bkr->reports, RPT_WARNING, "Feedback loop detected");
 
 	MEM_freeN(bkr);
@@ -1410,7 +1427,7 @@ static void bake_freejob(void *bkv)
 static int objects_bake_render_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
 {
 	/* no running blender, remove handler and pass through */
-	if(0==WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C)))
+	if (0==WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C)))
 		return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
 
 	/* running render */
@@ -1435,14 +1452,15 @@ static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
 	Scene *scene= CTX_data_scene(C);
 	int result= OPERATOR_CANCELLED;
 
-	if(is_multires_bake(scene)) {
+	if (is_multires_bake(scene)) {
 		result= multiresbake_image_exec(C, op);
-	} else {
+	}
+	else {
 		/* only one render job at a time */
-		if(WM_jobs_test(CTX_wm_manager(C), scene))
+		if (WM_jobs_test(CTX_wm_manager(C), scene))
 			return OPERATOR_CANCELLED;
 
-		if(test_bake_internal(C, op->reports)==0) {
+		if (test_bake_internal(C, op->reports)==0) {
 			return OPERATOR_CANCELLED;
 		}
 		else {
@@ -1484,10 +1502,11 @@ static int bake_image_exec(bContext *C, wmOperator *op)
 	Scene *scene= CTX_data_scene(C);
 	int result= OPERATOR_CANCELLED;
 
-	if(is_multires_bake(scene)) {
+	if (is_multires_bake(scene)) {
 		result= multiresbake_image_exec_locked(C, op);
-	} else  {
-		if(test_bake_internal(C, op->reports)==0) {
+	}
+	else {
+		if (test_bake_internal(C, op->reports)==0) {
 			return OPERATOR_CANCELLED;
 		}
 		else {
@@ -1507,9 +1526,9 @@ static int bake_image_exec(bContext *C, wmOperator *op)
 			bkr.ready= 0;
 			BLI_insert_thread(&threads, &bkr);
 
-			while(bkr.ready==0) {
+			while (bkr.ready==0) {
 				PIL_sleep_ms(50);
-				if(bkr.ready)
+				if (bkr.ready)
 					break;
 
 				/* used to redraw in 2.4x but this is just for exec in 2.5 */
@@ -1518,9 +1537,9 @@ static int bake_image_exec(bContext *C, wmOperator *op)
 			}
 			BLI_end_threads(&threads);
 
-			if(bkr.result==BAKE_RESULT_NO_OBJECTS)
+			if (bkr.result==BAKE_RESULT_NO_OBJECTS)
 				BKE_report(op->reports, RPT_ERROR, "No valid images found to bake to");
-			else if(bkr.result==BAKE_RESULT_FEEDBACK_LOOP)
+			else if (bkr.result==BAKE_RESULT_FEEDBACK_LOOP)
 				BKE_report(op->reports, RPT_ERROR, "Feedback loop detected");
 
 			finish_bake_internal(&bkr);
@@ -1537,12 +1556,12 @@ static int bake_image_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_bake_image(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Bake";
-	ot->description= "Bake image textures of selected objects";
-	ot->idname= "OBJECT_OT_bake_image";
+	ot->name = "Bake";
+	ot->description = "Bake image textures of selected objects";
+	ot->idname = "OBJECT_OT_bake_image";
 
 	/* api callbacks */
-	ot->exec= bake_image_exec;
-	ot->invoke= objects_bake_render_invoke;
-	ot->modal= objects_bake_render_modal;
+	ot->exec = bake_image_exec;
+	ot->invoke = objects_bake_render_invoke;
+	ot->modal = objects_bake_render_modal;
 }
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index a90edb2..ec35674 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -142,6 +142,7 @@ bConstraint *get_active_constraint (Object *ob)
 }
 
 /* -------------- Constraint Management (Add New, Remove, Rename) -------------------- */
+#ifdef WITH_PYTHON
 /* ------------- PyConstraints ------------------ */
 
 /* this callback sets the text-file to be used for selected menu item */
@@ -160,7 +161,6 @@ static void validate_pyconstraint_cb (void *arg1, void *arg2)
 	data->text = text;
 }
 
-#ifdef WITH_PYTHON
 /* this returns a string for the list of usable pyconstraint script names */
 static char *buildmenu_pyconstraints (Text *con_text, int *pyconindex)
 {
@@ -391,8 +391,7 @@ static void test_constraints (Object *owner, bPoseChannel *pchan)
 				/* if the number of points does not match the amount required by the chain length,
 				 * free the points array and request a rebind...
 				 */
-				if ((data->points == NULL) || (data->numpoints != data->chainlen+1))
-				{
+				if ((data->points == NULL) || (data->numpoints != data->chainlen+1)) {
 					/* free the points array */
 					if (data->points) {
 						MEM_freeN(data->points);
@@ -406,17 +405,17 @@ static void test_constraints (Object *owner, bPoseChannel *pchan)
 			else if (curcon->type == CONSTRAINT_TYPE_FOLLOWTRACK) {
 				bFollowTrackConstraint *data = curcon->data;
 
-				if((data->flag&CAMERASOLVER_ACTIVECLIP)==0) {
-					if(data->clip != NULL && data->track[0]) {
+				if ((data->flag&CAMERASOLVER_ACTIVECLIP)==0) {
+					if (data->clip != NULL && data->track[0]) {
 						MovieTracking *tracking= &data->clip->tracking;
 						MovieTrackingObject *tracking_object;
 
-						if(data->object[0])
+						if (data->object[0])
 							tracking_object= BKE_tracking_named_object(tracking, data->object);
 						else
 							tracking_object= BKE_tracking_get_camera_object(tracking);
 
-						if(!tracking_object) {
+						if (!tracking_object) {
 							curcon->flag |= CONSTRAINT_DISABLE;
 						}
 						else {
@@ -430,13 +429,13 @@ static void test_constraints (Object *owner, bPoseChannel *pchan)
 			else if (curcon->type == CONSTRAINT_TYPE_CAMERASOLVER) {
 				bCameraSolverConstraint *data = curcon->data;
 
-				if((data->flag&CAMERASOLVER_ACTIVECLIP)==0 && data->clip == NULL)
+				if ((data->flag&CAMERASOLVER_ACTIVECLIP)==0 && data->clip == NULL)
 					curcon->flag |= CONSTRAINT_DISABLE;
 			}
 			else if (curcon->type == CONSTRAINT_TYPE_OBJECTSOLVER) {
 				bObjectSolverConstraint *data = curcon->data;
 
-				if((data->flag&CAMERASOLVER_ACTIVECLIP)==0 && data->clip == NULL)
+				if ((data->flag&CAMERASOLVER_ACTIVECLIP)==0 && data->clip == NULL)
 					curcon->flag |= CONSTRAINT_DISABLE;
 			}
 			
@@ -590,19 +589,19 @@ static bConstraint *edit_constraint_property_get(wmOperator *op, Object *ob, int
 		if (pchan)
 			list = &pchan->constraints;
 		else {
-			//if (G.f & G_DEBUG)
+			//if (G.debug & G_DEBUG)
 			//printf("edit_constraint_property_get: No active bone for object '%s'\n", (ob)? ob->id.name+2 : "<None>");
 			return NULL;
 		}
 	}
 	else {
-		//if (G.f & G_DEBUG)
+		//if (G.debug & G_DEBUG)
 		//printf("edit_constraint_property_get: defaulting to getting list in the standard way\n");
 		list = get_active_constraints(ob);
 	}
 	
 	con = constraints_findByName(list, constraint_name);
-	//if (G.f & G_DEBUG)
+	//if (G.debug & G_DEBUG)
 	//printf("constraint found = %p, %s\n", (void *)con, (con)?con->name:"<Not found>");
 
 	if (con && (type != 0) && (con->type != type))
@@ -645,16 +644,16 @@ static int stretchto_reset_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e
 void CONSTRAINT_OT_stretchto_reset (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Reset Original Length";
-	ot->idname= "CONSTRAINT_OT_stretchto_reset";
-	ot->description= "Reset original length of bone for Stretch To Constraint";
+	ot->name = "Reset Original Length";
+	ot->idname = "CONSTRAINT_OT_stretchto_reset";
+	ot->description = "Reset original length of bone for Stretch To Constraint";
 	
-	ot->exec= stretchto_reset_exec;
-	ot->invoke= stretchto_reset_invoke;
-	ot->poll= edit_constraint_poll;
+	ot->exec = stretchto_reset_exec;
+	ot->invoke = stretchto_reset_invoke;
+	ot->poll = edit_constraint_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	edit_constraint_properties(ot);
 }
 
@@ -688,16 +687,16 @@ static int limitdistance_reset_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
 void CONSTRAINT_OT_limitdistance_reset (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Reset Distance";
-	ot->idname= "CONSTRAINT_OT_limitdistance_reset";
-	ot->description= "Reset limiting distance for Limit Distance Constraint";
+	ot->name = "Reset Distance";
+	ot->idname = "CONSTRAINT_OT_limitdistance_reset";
+	ot->description = "Reset limiting distance for Limit Distance Constraint";
 	
-	ot->exec= limitdistance_reset_exec;
-	ot->invoke= limitdistance_reset_invoke;
-	ot->poll= edit_constraint_poll;
+	ot->exec = limitdistance_reset_exec;
+	ot->invoke = limitdistance_reset_invoke;
+	ot->poll = edit_constraint_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	edit_constraint_properties(ot);
 }
 
@@ -814,16 +813,16 @@ static int childof_set_inverse_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
 void CONSTRAINT_OT_childof_set_inverse (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Inverse";
-	ot->idname= "CONSTRAINT_OT_childof_set_inverse";
-	ot->description= "Set inverse correction for ChildOf constraint";
+	ot->name = "Set Inverse";
+	ot->idname = "CONSTRAINT_OT_childof_set_inverse";
+	ot->description = "Set inverse correction for ChildOf constraint";
 	
-	ot->exec= childof_set_inverse_exec;
-	ot->invoke= childof_set_inverse_invoke;
-	ot->poll= edit_constraint_poll;
+	ot->exec = childof_set_inverse_exec;
+	ot->invoke = childof_set_inverse_invoke;
+	ot->poll = edit_constraint_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	edit_constraint_properties(ot);
 }
 
@@ -834,7 +833,7 @@ static int childof_clear_inverse_exec (bContext *C, wmOperator *op)
 	bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_CHILDOF);
 	bChildOfConstraint *data= (con) ? (bChildOfConstraint *)con->data : NULL;
 	
-	if(data==NULL) {
+	if (data==NULL) {
 		BKE_report(op->reports, RPT_ERROR, "Childof constraint not found");
 		return OPERATOR_CANCELLED;
 	}
@@ -858,16 +857,16 @@ static int childof_clear_inverse_invoke(bContext *C, wmOperator *op, wmEvent *UN
 void CONSTRAINT_OT_childof_clear_inverse (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear Inverse";
-	ot->idname= "CONSTRAINT_OT_childof_clear_inverse";
-	ot->description= "Clear inverse correction for ChildOf constraint";
+	ot->name = "Clear Inverse";
+	ot->idname = "CONSTRAINT_OT_childof_clear_inverse";
+	ot->description = "Clear inverse correction for ChildOf constraint";
 	
-	ot->exec= childof_clear_inverse_exec;
-	ot->invoke= childof_clear_inverse_invoke;
-	ot->poll= edit_constraint_poll;
+	ot->exec = childof_clear_inverse_exec;
+	ot->invoke = childof_clear_inverse_invoke;
+	ot->poll = edit_constraint_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	edit_constraint_properties(ot);
 }
 
@@ -905,16 +904,16 @@ static int objectsolver_set_inverse_invoke(bContext *C, wmOperator *op, wmEvent
 void CONSTRAINT_OT_objectsolver_set_inverse (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Inverse";
-	ot->idname= "CONSTRAINT_OT_objectsolver_set_inverse";
-	ot->description= "Set inverse correction for ObjectSolver constraint";
+	ot->name = "Set Inverse";
+	ot->idname = "CONSTRAINT_OT_objectsolver_set_inverse";
+	ot->description = "Set inverse correction for ObjectSolver constraint";
 
-	ot->exec= objectsolver_set_inverse_exec;
-	ot->invoke= objectsolver_set_inverse_invoke;
-	ot->poll= edit_constraint_poll;
+	ot->exec = objectsolver_set_inverse_exec;
+	ot->invoke = objectsolver_set_inverse_invoke;
+	ot->poll = edit_constraint_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	edit_constraint_properties(ot);
 }
 
@@ -924,7 +923,7 @@ static int objectsolver_clear_inverse_exec (bContext *C, wmOperator *op)
 	bConstraint *con = edit_constraint_property_get(op, ob, CONSTRAINT_TYPE_OBJECTSOLVER);
 	bObjectSolverConstraint *data= (con) ? (bObjectSolverConstraint *)con->data : NULL;
 
-	if(data==NULL) {
+	if (data==NULL) {
 		BKE_report(op->reports, RPT_ERROR, "Childof constraint not found");
 		return OPERATOR_CANCELLED;
 	}
@@ -948,16 +947,16 @@ static int objectsolver_clear_inverse_invoke(bContext *C, wmOperator *op, wmEven
 void CONSTRAINT_OT_objectsolver_clear_inverse (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear Inverse";
-	ot->idname= "CONSTRAINT_OT_objectsolver_clear_inverse";
-	ot->description= "Clear inverse correction for ObjectSolver constraint";
+	ot->name = "Clear Inverse";
+	ot->idname = "CONSTRAINT_OT_objectsolver_clear_inverse";
+	ot->description = "Clear inverse correction for ObjectSolver constraint";
 
-	ot->exec= objectsolver_clear_inverse_exec;
-	ot->invoke= objectsolver_clear_inverse_invoke;
-	ot->poll= edit_constraint_poll;
+	ot->exec = objectsolver_clear_inverse_exec;
+	ot->invoke = objectsolver_clear_inverse_invoke;
+	ot->poll = edit_constraint_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	edit_constraint_properties(ot);
 }
 
@@ -978,11 +977,11 @@ void ED_object_constraint_set_active(Object *ob, bConstraint *con)
 void ED_object_constraint_update(Object *ob)
 {
 
-	if(ob->pose) update_pose_constraint_flags(ob->pose);
+	if (ob->pose) update_pose_constraint_flags(ob->pose);
 
 	object_test_constraints(ob);
 
-	if(ob->type==OB_ARMATURE) DAG_id_tag_update(&ob->id, OB_RECALC_DATA|OB_RECALC_OB);
+	if (ob->type==OB_ARMATURE) DAG_id_tag_update(&ob->id, OB_RECALC_DATA|OB_RECALC_OB);
 	else DAG_id_tag_update(&ob->id, OB_RECALC_OB);
 }
 
@@ -990,7 +989,7 @@ void ED_object_constraint_dependency_update(Main *bmain, Scene *scene, Object *o
 {
 	ED_object_constraint_update(ob);
 
-	if(ob->pose) ob->pose->flag |= POSE_RECALC;	// checks & sorts pose channels
+	if (ob->pose) ob->pose->flag |= POSE_RECALC;	// checks & sorts pose channels
 	DAG_scene_sort(bmain, scene);
 }
 
@@ -1016,7 +1015,7 @@ static int constraint_delete_exec (bContext *C, wmOperator *UNUSED(op))
 		ED_object_constraint_update(ob); /* needed to set the flags on posebones correctly */
 
 		/* ITASC needs to be rebuilt once a constraint is removed [#26920] */
-		if(is_ik) {
+		if (is_ik) {
 			BIK_clear_data(ob->pose);
 		}
 
@@ -1034,16 +1033,16 @@ static int constraint_delete_exec (bContext *C, wmOperator *UNUSED(op))
 void CONSTRAINT_OT_delete (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete Constraint";
-	ot->idname= "CONSTRAINT_OT_delete";
-	ot->description= "Remove constraint from constraint stack";
+	ot->name = "Delete Constraint";
+	ot->idname = "CONSTRAINT_OT_delete";
+	ot->description = "Remove constraint from constraint stack";
 	
 	/* callbacks */
-	ot->exec= constraint_delete_exec;
-	ot->poll= constraint_poll;
+	ot->exec = constraint_delete_exec;
+	ot->poll = constraint_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; 
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; 
 }
 
 static int constraint_move_down_exec (bContext *C, wmOperator *op)
@@ -1079,17 +1078,17 @@ static int constraint_move_down_invoke(bContext *C, wmOperator *op, wmEvent *UNU
 void CONSTRAINT_OT_move_down (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Move Constraint Down";
-	ot->idname= "CONSTRAINT_OT_move_down";
-	ot->description= "Move constraint down in constraint stack";
+	ot->name = "Move Constraint Down";
+	ot->idname = "CONSTRAINT_OT_move_down";
+	ot->description = "Move constraint down in constraint stack";
 	
 	/* callbacks */
-	ot->exec= constraint_move_down_exec;
-	ot->invoke= constraint_move_down_invoke;
-	ot->poll= edit_constraint_poll;
+	ot->exec = constraint_move_down_exec;
+	ot->invoke = constraint_move_down_invoke;
+	ot->poll = edit_constraint_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; 
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; 
 	edit_constraint_properties(ot);
 }
 
@@ -1126,17 +1125,17 @@ static int constraint_move_up_invoke(bContext *C, wmOperator *op, wmEvent *UNUSE
 void CONSTRAINT_OT_move_up (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Move Constraint Up";
-	ot->idname= "CONSTRAINT_OT_move_up";
-	ot->description= "Move constraint up in constraint stack";
+	ot->name = "Move Constraint Up";
+	ot->idname = "CONSTRAINT_OT_move_up";
+	ot->description = "Move constraint up in constraint stack";
 	
 	/* callbacks */
-	ot->exec= constraint_move_up_exec;
-	ot->invoke= constraint_move_up_invoke;
-	ot->poll= edit_constraint_poll;
+	ot->exec = constraint_move_up_exec;
+	ot->invoke = constraint_move_up_invoke;
+	ot->poll = edit_constraint_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; 
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; 
 	edit_constraint_properties(ot);
 }
 
@@ -1161,7 +1160,7 @@ static int pose_constraints_clear_exec(bContext *C, wmOperator *UNUSED(op))
 	/* force depsgraph to get recalculated since relationships removed */
 	DAG_scene_sort(bmain, scene);		/* sort order of objects */	
 	
-	/* note, calling BIK_clear_data() isnt needed here */
+	/* note, calling BIK_clear_data() isn't needed here */
 
 	/* do updates */
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
@@ -1174,12 +1173,12 @@ void POSE_OT_constraints_clear(wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name = "Clear Pose Constraints";
-	ot->idname= "POSE_OT_constraints_clear";
-	ot->description= "Clear all the constraints for the selected bones";
+	ot->idname = "POSE_OT_constraints_clear";
+	ot->description = "Clear all the constraints for the selected bones";
 	
 	/* callbacks */
-	ot->exec= pose_constraints_clear_exec;
-	ot->poll= ED_operator_posemode; // XXX - do we want to ensure there are selected bones too?
+	ot->exec = pose_constraints_clear_exec;
+	ot->poll = ED_operator_posemode; // XXX - do we want to ensure there are selected bones too?
 }
 
 
@@ -1209,12 +1208,12 @@ void OBJECT_OT_constraints_clear(wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name = "Clear Object Constraints";
-	ot->idname= "OBJECT_OT_constraints_clear";
-	ot->description= "Clear all the constraints for the active Object only";
+	ot->idname = "OBJECT_OT_constraints_clear";
+	ot->description = "Clear all the constraints for the active Object only";
 	
 	/* callbacks */
-	ot->exec= object_constraints_clear_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->exec = object_constraints_clear_exec;
+	ot->poll = ED_operator_object_active_editable;
 }
 
 /************************ copy all constraints operators *********************/
@@ -1254,16 +1253,16 @@ static int pose_constraint_copy_exec(bContext *C, wmOperator *op)
 void POSE_OT_constraints_copy(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Copy Constraints to Selected";
-	ot->idname= "POSE_OT_constraints_copy";
+	ot->name = "Copy Constraints to Selected";
+	ot->idname = "POSE_OT_constraints_copy";
 	ot->description = "Copy constraints to other selected bones";
 	
 	/* api callbacks */
-	ot->exec= pose_constraint_copy_exec;
-	ot->poll= ED_operator_posemode;
+	ot->exec = pose_constraint_copy_exec;
+	ot->poll = ED_operator_posemode;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int object_constraint_copy_exec(bContext *C, wmOperator *UNUSED(op))
@@ -1295,16 +1294,16 @@ static int object_constraint_copy_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_constraints_copy(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Copy Constraints to Selected";
-	ot->idname= "OBJECT_OT_constraints_copy";
+	ot->name = "Copy Constraints to Selected";
+	ot->idname = "OBJECT_OT_constraints_copy";
 	ot->description = "Copy constraints to other selected objects";
 	
 	/* api callbacks */
-	ot->exec= object_constraint_copy_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->exec = object_constraint_copy_exec;
+	ot->poll = ED_operator_object_active_editable;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /************************ add constraint operators *********************/
@@ -1501,7 +1500,7 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase
 		/* get the target objects, adding them as need be */
 		if (get_new_constraint_target(C, type, &tar_ob, &tar_pchan, 1)) {
 			/* method of setting target depends on the type of target we've got 
-			 *	- by default, just set the first target (distinction here is only for multiple-targetted constraints)
+			 *	- by default, just set the first target (distinction here is only for multiple-targeted constraints)
 			 */
 			if (tar_pchan)
 				set_constraint_nth_target(con, tar_ob, tar_pchan->name, 0);
@@ -1610,77 +1609,77 @@ static int pose_constraint_add_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_constraint_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Constraint";
+	ot->name = "Add Constraint";
 	ot->description = "Add a constraint to the active object";
-	ot->idname= "OBJECT_OT_constraint_add";
+	ot->idname = "OBJECT_OT_constraint_add";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= object_constraint_add_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = object_constraint_add_exec;
+	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, "type", constraint_type_items, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", "");
 }
 
 void OBJECT_OT_constraint_add_with_targets(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Constraint (with Targets)";
+	ot->name = "Add Constraint (with Targets)";
 	ot->description = "Add a constraint to the active object, with target (where applicable) set to the selected Objects/Bones";
-	ot->idname= "OBJECT_OT_constraint_add_with_targets";
+	ot->idname = "OBJECT_OT_constraint_add_with_targets";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= object_constraint_add_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = object_constraint_add_exec;
+	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, "type", constraint_type_items, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", "");
 }
 
 void POSE_OT_constraint_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Constraint";
+	ot->name = "Add Constraint";
 	ot->description = "Add a constraint to the active bone";
-	ot->idname= "POSE_OT_constraint_add";
+	ot->idname = "POSE_OT_constraint_add";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= pose_constraint_add_exec;
-	ot->poll= ED_operator_posemode;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = pose_constraint_add_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
-	ot->prop= RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", "");
 }
 
 void POSE_OT_constraint_add_with_targets(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Constraint (with Targets)";
+	ot->name = "Add Constraint (with Targets)";
 	ot->description = "Add a constraint to the active bone, with target (where applicable) set to the selected Objects/Bones";
-	ot->idname= "POSE_OT_constraint_add_with_targets";
+	ot->idname = "POSE_OT_constraint_add_with_targets";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= pose_constraint_add_exec;
-	ot->poll= ED_operator_posemode;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = pose_constraint_add_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
-	ot->prop= RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", constraint_type_items, 0, "Type", "");
 }
 
 /************************ IK Constraint operators *********************/
@@ -1753,17 +1752,17 @@ static int pose_ik_add_exec(bContext *C, wmOperator *op)
 void POSE_OT_ik_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add IK to Bone";
-	ot->description= "Add IK Constraint to the active Bone";
-	ot->idname= "POSE_OT_ik_add";
+	ot->name = "Add IK to Bone";
+	ot->description = "Add IK Constraint to the active Bone";
+	ot->idname = "POSE_OT_ik_add";
 	
 	/* api callbacks */
-	ot->invoke= pose_ik_add_invoke;
-	ot->exec= pose_ik_add_exec;
-	ot->poll= ED_operator_posemode;
+	ot->invoke = pose_ik_add_invoke;
+	ot->exec = pose_ik_add_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_boolean(ot->srna, "with_targets", 1, "With Targets", "Assign IK Constraint with targets derived from the select bones/objects");
@@ -1804,15 +1803,15 @@ static int pose_ik_clear_exec(bContext *C, wmOperator *UNUSED(op))
 void POSE_OT_ik_clear(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove IK";
-	ot->description= "Remove all IK Constraints from selected bones";
-	ot->idname= "POSE_OT_ik_clear";
+	ot->name = "Remove IK";
+	ot->description = "Remove all IK Constraints from selected bones";
+	ot->idname = "POSE_OT_ik_clear";
 	
 	/* api callbacks */
-	ot->exec= pose_ik_clear_exec;
-	ot->poll= ED_operator_posemode;
+	ot->exec = pose_ik_clear_exec;
+	ot->poll = ED_operator_posemode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 1286ac8..2fbc296 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -40,7 +40,6 @@
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
-#include "BLI_editVert.h"
 #include "BLI_ghash.h"
 #include "BLI_rand.h"
 
@@ -56,6 +55,7 @@
 #include "DNA_object_force.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_vfont_types.h"
+#include "DNA_mesh_types.h"
 
 #include "IMB_imbuf_types.h"
 
@@ -79,6 +79,7 @@
 #include "BKE_sca.h"
 #include "BKE_softbody.h"
 #include "BKE_modifier.h"
+#include "BKE_tessmesh.h"
 
 #include "ED_armature.h"
 #include "ED_curve.h"
@@ -120,7 +121,7 @@ Object *ED_object_context(bContext *C)
 Object *ED_object_active_context(bContext *C)
 {
 	Object *ob= NULL;
-	if(C) {
+	if (C) {
 		ob= ED_object_context(C);
 		if (!ob) ob= CTX_data_active_object(C);
 	}
@@ -139,8 +140,8 @@ static int object_hide_view_clear_exec(bContext *C, wmOperator *UNUSED(op))
 	int changed = 0;
 	
 	/* XXX need a context loop to handle such cases */
-	for(base = FIRSTBASE; base; base=base->next){
-		if((base->lay & v3d->lay) && base->object->restrictflag & OB_RESTRICT_VIEW) {
+	for (base = FIRSTBASE; base; base=base->next) {
+		if ((base->lay & v3d->lay) && base->object->restrictflag & OB_RESTRICT_VIEW) {
 			base->flag |= SELECT;
 			base->object->flag = base->flag;
 			base->object->restrictflag &= ~OB_RESTRICT_VIEW; 
@@ -160,16 +161,16 @@ void OBJECT_OT_hide_view_clear(wmOperatorType *ot)
 {
 	
 	/* identifiers */
-	ot->name= "Clear Restrict View";
+	ot->name = "Clear Restrict View";
 	ot->description = "Reveal the object by setting the hide flag";
-	ot->idname= "OBJECT_OT_hide_view_clear";
+	ot->idname = "OBJECT_OT_hide_view_clear";
 	
 	/* api callbacks */
-	ot->exec= object_hide_view_clear_exec;
-	ot->poll= ED_operator_view3d_active;
+	ot->exec = object_hide_view_clear_exec;
+	ot->poll = ED_operator_view3d_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int object_hide_view_set_exec(bContext *C, wmOperator *op)
@@ -180,8 +181,8 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op)
 	const int unselected= RNA_boolean_get(op->ptr, "unselected");
 	
 	CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
-		if(!unselected) {
-			if (base->flag & SELECT){
+		if (!unselected) {
+			if (base->flag & SELECT) {
 				base->flag &= ~SELECT;
 				base->object->flag = base->flag;
 				base->object->restrictflag |= OB_RESTRICT_VIEW;
@@ -192,7 +193,7 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op)
 			}
 		}
 		else {
-			if (!(base->flag & SELECT)){
+			if (!(base->flag & SELECT)) {
 				base->object->restrictflag |= OB_RESTRICT_VIEW;
 				changed = 1;
 			}
@@ -214,16 +215,16 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_hide_view_set(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Restrict View";
+	ot->name = "Set Restrict View";
 	ot->description = "Hide the object by setting the hide flag";
-	ot->idname= "OBJECT_OT_hide_view_set";
+	ot->idname = "OBJECT_OT_hide_view_set";
 	
 	/* api callbacks */
-	ot->exec= object_hide_view_set_exec;
-	ot->poll= ED_operator_view3d_active;
+	ot->exec = object_hide_view_set_exec;
+	ot->poll = ED_operator_view3d_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected objects");
 	
@@ -236,14 +237,14 @@ static int object_hide_render_clear_exec(bContext *C, wmOperator *UNUSED(op))
 
 	/* XXX need a context loop to handle such cases */
 	CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
-		if(ob->restrictflag & OB_RESTRICT_RENDER) {
+		if (ob->restrictflag & OB_RESTRICT_RENDER) {
 			ob->restrictflag &= ~OB_RESTRICT_RENDER;
 			changed= 1;
 		}
 	}
 	CTX_DATA_END;
 
-	if(changed)
+	if (changed)
 		WM_event_add_notifier(C, NC_SPACE|ND_SPACE_OUTLINER, NULL);
 
 	return OPERATOR_FINISHED;
@@ -253,16 +254,16 @@ void OBJECT_OT_hide_render_clear(wmOperatorType *ot)
 {
 
 	/* identifiers */
-	ot->name= "Clear Restrict Render";
+	ot->name = "Clear Restrict Render";
 	ot->description = "Reveal the render object by setting the hide render flag";
-	ot->idname= "OBJECT_OT_hide_render_clear";
+	ot->idname = "OBJECT_OT_hide_render_clear";
 
 	/* api callbacks */
-	ot->exec= object_hide_render_clear_exec;
-	ot->poll= ED_operator_view3d_active;
+	ot->exec = object_hide_render_clear_exec;
+	ot->poll = ED_operator_view3d_active;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int object_hide_render_set_exec(bContext *C, wmOperator *op)
@@ -270,13 +271,13 @@ static int object_hide_render_set_exec(bContext *C, wmOperator *op)
 	const int unselected= RNA_boolean_get(op->ptr, "unselected");
 
 	CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
-		if(!unselected) {
-			if (base->flag & SELECT){
+		if (!unselected) {
+			if (base->flag & SELECT) {
 				base->object->restrictflag |= OB_RESTRICT_RENDER;
 			}
 		}
 		else {
-			if (!(base->flag & SELECT)){
+			if (!(base->flag & SELECT)) {
 				base->object->restrictflag |= OB_RESTRICT_RENDER;
 			}
 		}
@@ -289,16 +290,16 @@ static int object_hide_render_set_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_hide_render_set(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Restrict Render";
+	ot->name = "Set Restrict Render";
 	ot->description = "Hide the render object by setting the hide render flag";
-	ot->idname= "OBJECT_OT_hide_render_set";
+	ot->idname = "OBJECT_OT_hide_render_set";
 
 	/* api callbacks */
-	ot->exec= object_hide_render_set_exec;
-	ot->poll= ED_operator_view3d_active;
+	ot->exec = object_hide_render_set_exec;
+	ot->poll = ED_operator_view3d_active;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected objects");
 }
@@ -313,55 +314,55 @@ void ED_object_exit_editmode(bContext *C, int flag)
 	Object *obedit= CTX_data_edit_object(C);
 	int freedata = flag & EM_FREEDATA;
 	
-	if(obedit==NULL) return;
+	if (obedit==NULL) return;
 	
-	if(flag & EM_WAITCURSOR) waitcursor(1);
-	if(obedit->type==OB_MESH) {
+	if (flag & EM_WAITCURSOR) waitcursor(1);
+	if (obedit->type==OB_MESH) {
 		Mesh *me= obedit->data;
 		
-//		if(EM_texFaceCheck())
+//		if (EM_texFaceCheck())
 		
-		if(me->edit_mesh->totvert>MESH_MAX_VERTS) {
+		if (me->edit_btmesh->bm->totvert>MESH_MAX_VERTS) {
 			error("Too many vertices");
 			return;
 		}
-		load_editMesh(scene, obedit);
 		
-		if(freedata) {
-			free_editMesh(me->edit_mesh);
-			MEM_freeN(me->edit_mesh);
-			me->edit_mesh= NULL;
-		}
+		EDBM_mesh_load(obedit);
 		
-		if(obedit->restore_mode & OB_MODE_WEIGHT_PAINT) {
+		if (freedata) {
+			EDBM_mesh_free(me->edit_btmesh);
+			MEM_freeN(me->edit_btmesh);
+			me->edit_btmesh= NULL;
+		}
+		if (obedit->restore_mode & OB_MODE_WEIGHT_PAINT) {
 			mesh_octree_table(NULL, NULL, NULL, 'e');
 			mesh_mirrtopo_table(NULL, 'e');
 		}
 	}
 	else if (obedit->type==OB_ARMATURE) {	
 		ED_armature_from_edit(obedit);
-		if(freedata)
+		if (freedata)
 			ED_armature_edit_free(obedit);
 	}
-	else if(ELEM(obedit->type, OB_CURVE, OB_SURF)) {
+	else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
 		load_editNurb(obedit);
-		if(freedata) free_editNurb(obedit);
+		if (freedata) free_editNurb(obedit);
 	}
-	else if(obedit->type==OB_FONT && freedata) {
+	else if (obedit->type==OB_FONT && freedata) {
 		load_editText(obedit);
-		if(freedata) free_editText(obedit);
+		if (freedata) free_editText(obedit);
 	}
-	else if(obedit->type==OB_LATTICE) {
+	else if (obedit->type==OB_LATTICE) {
 		load_editLatt(obedit);
-		if(freedata) free_editLatt(obedit);
+		if (freedata) free_editLatt(obedit);
 	}
-	else if(obedit->type==OB_MBALL) {
+	else if (obedit->type==OB_MBALL) {
 		load_editMball(obedit);
-		if(freedata) free_editMball(obedit);
+		if (freedata) free_editMball(obedit);
 	}
 
 	/* freedata only 0 now on file saves and render */
-	if(freedata) {
+	if (freedata) {
 		ListBase pidlist;
 		PTCacheID *pid;
 
@@ -370,8 +371,8 @@ void ED_object_exit_editmode(bContext *C, int flag)
 
 		/* flag object caches as outdated */
 		BKE_ptcache_ids_from_object(&pidlist, obedit, NULL, 0);
-		for(pid=pidlist.first; pid; pid=pid->next) {
-			if(pid->type != PTCACHE_TYPE_PARTICLES) /* particles don't need reset on geometry change */
+		for (pid=pidlist.first; pid; pid=pid->next) {
+			if (pid->type != PTCACHE_TYPE_PARTICLES) /* particles don't need reset on geometry change */
 				pid->cache->flag |= PTCACHE_OUTDATED;
 		}
 		BLI_freelistN(&pidlist);
@@ -381,10 +382,10 @@ void ED_object_exit_editmode(bContext *C, int flag)
 		/* also flush ob recalc, doesn't take much overhead, but used for particles */
 		DAG_id_tag_update(&obedit->id, OB_RECALC_OB|OB_RECALC_DATA);
 	
-		if(flag & EM_DO_UNDO)
+		if (flag & EM_DO_UNDO)
 			ED_undo_push(C, "Editmode");
 	
-		if(flag & EM_WAITCURSOR) waitcursor(0);
+		if (flag & EM_WAITCURSOR) waitcursor(0);
 	
 		WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, scene);
 
@@ -402,17 +403,17 @@ void ED_object_enter_editmode(bContext *C, int flag)
 	View3D *v3d= NULL;
 	int ok= 0;
 	
-	if(scene->id.lib) return;
+	if (scene->id.lib) return;
 	
-	if(sa && sa->spacetype==SPACE_VIEW3D)
+	if (sa && sa->spacetype==SPACE_VIEW3D)
 		v3d= sa->spacedata.first;
 	
-	if((flag & EM_IGNORE_LAYER)==0) {
+	if ((flag & EM_IGNORE_LAYER)==0) {
 		base= CTX_data_active_base(C); /* active layer checked here for view3d */
 
-		if(base==NULL) return;
-		else if(v3d && (base->lay & v3d->lay)==0) return;
-		else if(!v3d && (base->lay & scene->lay)==0) return;
+		if (base==NULL) return;
+		else if (v3d && (base->lay & v3d->lay)==0) return;
+		else if (!v3d && (base->lay & scene->lay)==0) return;
 	}
 	else {
 		base= scene->basact;
@@ -427,37 +428,47 @@ void ED_object_enter_editmode(bContext *C, int flag)
 		return;
 	}
 	
-	if(flag & EM_WAITCURSOR) waitcursor(1);
+	if (flag & EM_WAITCURSOR) waitcursor(1);
 
 	ob->restore_mode = ob->mode;
 
 	/* note, when switching scenes the object can have editmode data but
 	 * not be scene->obedit: bug 22954, this avoids calling self eternally */
-	if((ob->restore_mode & OB_MODE_EDIT)==0)
+	if ((ob->restore_mode & OB_MODE_EDIT)==0)
 		ED_object_toggle_modes(C, ob->mode);
 
 	ob->mode= OB_MODE_EDIT;
 	
-	if(ob->type==OB_MESH) {
+	if (ob->type==OB_MESH) {
+		BMEditMesh *em;
 		ok= 1;
-		scene->obedit= ob;	// context sees this
-		
-		make_editMesh(scene, ob);
+		scene->obedit = ob;  /* context sees this */
+
+		EDBM_mesh_make(CTX_data_tool_settings(C), scene, ob);
+
+		em = BMEdit_FromObject(ob);
+		if (LIKELY(em)) {
+			/* order doesn't matter */
+			EDBM_mesh_normals_update(em);
+			BMEdit_RecalcTessellation(em);
+			
+			BM_mesh_select_mode_flush(em->bm);
+		}
 
 		WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_MESH, scene);
 	}
-	else if (ob->type==OB_ARMATURE){
+	else if (ob->type==OB_ARMATURE) {
 		bArmature *arm= base->object->data;
 		if (!arm) return;
 		/*
 		 * The function object_data_is_libdata make a problem here, the
 		 * check for ob->proxy return 0 and let blender enter to edit mode
-		 * this causa a crash when you try leave the edit mode.
+		 * this causes a crash when you try leave the edit mode.
 		 * The problem is that i can't remove the ob->proxy check from
 		 * object_data_is_libdata that prevent the bugfix #6614, so
 		 * i add this little hack here.
 		 */
-		if(arm->id.lib) {
+		if (arm->id.lib) {
 			error_libdata();
 			return;
 		}
@@ -469,28 +480,28 @@ void ED_object_enter_editmode(bContext *C, int flag)
 
 		WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_ARMATURE, scene);
 	}
-	else if(ob->type==OB_FONT) {
+	else if (ob->type==OB_FONT) {
 		scene->obedit= ob; // XXX for context
 		ok= 1;
 		make_editText(ob);
 
 		WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_TEXT, scene);
 	}
-	else if(ob->type==OB_MBALL) {
+	else if (ob->type==OB_MBALL) {
 		scene->obedit= ob; // XXX for context
 		ok= 1;
 		make_editMball(ob);
 
 		WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_MBALL, scene);
 	}
-	else if(ob->type==OB_LATTICE) {
+	else if (ob->type==OB_LATTICE) {
 		scene->obedit= ob; // XXX for context
 		ok= 1;
 		make_editLatt(ob);
 		
 		WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_LATTICE, scene);
 	}
-	else if(ob->type==OB_SURF || ob->type==OB_CURVE) {
+	else if (ob->type==OB_SURF || ob->type==OB_CURVE) {
 		ok= 1;
 		scene->obedit= ob; // XXX for context
 		make_editNurb(ob);
@@ -498,7 +509,7 @@ void ED_object_enter_editmode(bContext *C, int flag)
 		WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_EDITMODE_CURVE, scene);
 	}
 	
-	if(ok) {
+	if (ok) {
 		DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 	}
 	else {
@@ -507,15 +518,15 @@ void ED_object_enter_editmode(bContext *C, int flag)
 		WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, scene);
 	}
 	
-	if(flag & EM_DO_UNDO) ED_undo_push(C, "Enter Editmode");
-	if(flag & EM_WAITCURSOR) waitcursor(0);
+	if (flag & EM_DO_UNDO) ED_undo_push(C, "Enter Editmode");
+	if (flag & EM_WAITCURSOR) waitcursor(0);
 }
 
 static int editmode_toggle_exec(bContext *C, wmOperator *UNUSED(op))
 {
 	ToolSettings *toolsettings =  CTX_data_tool_settings(C);
 
-	if(!CTX_data_edit_object(C))
+	if (!CTX_data_edit_object(C))
 		ED_object_enter_editmode(C, EM_WAITCURSOR);
 	else
 		ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR); /* had EM_DO_UNDO but op flag calls undo too [#24685] */
@@ -530,7 +541,7 @@ static int editmode_toggle_poll(bContext *C)
 	Object *ob = CTX_data_active_object(C);
 
 	/* covers proxies too */
-	if(ELEM(NULL, ob, ob->data) || ((ID *)ob->data)->lib)
+	if (ELEM(NULL, ob, ob->data) || ((ID *)ob->data)->lib)
 		return 0;
 
 	if (ob->restrictflag & OB_RESTRICT_VIEW)
@@ -546,17 +557,17 @@ void OBJECT_OT_editmode_toggle(wmOperatorType *ot)
 {
 	
 	/* identifiers */
-	ot->name= "Toggle Editmode";
+	ot->name = "Toggle Editmode";
 	ot->description = "Toggle object's editmode";
-	ot->idname= "OBJECT_OT_editmode_toggle";
+	ot->idname = "OBJECT_OT_editmode_toggle";
 	
 	/* api callbacks */
-	ot->exec= editmode_toggle_exec;
+	ot->exec = editmode_toggle_exec;
 	
-	ot->poll= editmode_toggle_poll;
+	ot->poll = editmode_toggle_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* *************************** */
@@ -565,12 +576,12 @@ static int posemode_exec(bContext *C, wmOperator *UNUSED(op))
 {
 	Base *base= CTX_data_active_base(C);
 	
-	if(base->object->type==OB_ARMATURE) {
-		if(base->object==CTX_data_edit_object(C)) {
+	if (base->object->type==OB_ARMATURE) {
+		if (base->object==CTX_data_edit_object(C)) {
 			ED_object_exit_editmode(C, EM_FREEDATA|EM_DO_UNDO);
 			ED_armature_enter_posemode(C, base);
 		}
-		else if(base->object->mode & OB_MODE_POSE)
+		else if (base->object->mode & OB_MODE_POSE)
 			ED_armature_exit_posemode(C, base);
 		else
 			ED_armature_enter_posemode(C, base);
@@ -584,16 +595,16 @@ static int posemode_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_posemode_toggle(wmOperatorType *ot) 
 {
 	/* identifiers */
-	ot->name= "Toggle Pose Mode";
-	ot->idname= "OBJECT_OT_posemode_toggle";
-	ot->description= "Enable or disable posing/selecting bones";
+	ot->name = "Toggle Pose Mode";
+	ot->idname = "OBJECT_OT_posemode_toggle";
+	ot->description = "Enable or disable posing/selecting bones";
 	
 	/* api callbacks */
-	ot->exec= posemode_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->exec = posemode_exec;
+	ot->poll = ED_operator_object_active_editable;
 	
 	/* flag */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static void copymenu_properties(Scene *scene, View3D *v3d, Object *ob)
@@ -605,7 +616,7 @@ static void copymenu_properties(Scene *scene, View3D *v3d, Object *ob)
 	char *str;
 	
 	prop= ob->prop.first;
-	while(prop) {
+	while (prop) {
 		tot++;
 		prop= prop->next;
 	}
@@ -619,7 +630,7 @@ static void copymenu_properties(Scene *scene, View3D *v3d, Object *ob)
 	
 	tot= 0;	
 	prop= ob->prop.first;
-	while(prop) {
+	while (prop) {
 		tot++;
 		strcat(str, "|");
 		strcat(str, prop->name);
@@ -629,23 +640,25 @@ static void copymenu_properties(Scene *scene, View3D *v3d, Object *ob)
 	nr= pupmenu(str);
 	
 	if ( nr==1 || nr==2 ) {
-		for(base= FIRSTBASE; base; base= base->next) {
-			if((base != BASACT) &&(TESTBASELIB(v3d, base))) {
+		for (base= FIRSTBASE; base; base= base->next) {
+			if ((base != BASACT) &&(TESTBASELIB(v3d, base))) {
 				if (nr==1) { /* replace */
 					copy_properties( &base->object->prop, &ob->prop );
-				} else {
-					for(prop = ob->prop.first; prop; prop= prop->next ) {
+				}
+				else {
+					for (prop = ob->prop.first; prop; prop= prop->next ) {
 						set_ob_property(base->object, prop);
 					}
 				}
 			}
 		}
-	} else if(nr>0) {
+	}
+	else if (nr>0) {
 		prop = BLI_findlink(&ob->prop, nr-4); /* account for first 3 menu items & menu index starting at 1*/
 		
-		if(prop) {
-			for(base= FIRSTBASE; base; base= base->next) {
-				if((base != BASACT) &&(TESTBASELIB(v3d, base))) {
+		if (prop) {
+			for (base= FIRSTBASE; base; base= base->next) {
+				if ((base != BASACT) &&(TESTBASELIB(v3d, base))) {
 					set_ob_property(base->object, prop);
 				}
 			}
@@ -660,9 +673,9 @@ static void copymenu_logicbricks(Scene *scene, View3D *v3d, Object *ob)
 //XXX no longer used - to be removed - replaced by logicbricks_copy_exec
 	Base *base;
 	
-	for(base= FIRSTBASE; base; base= base->next) {
-		if(base->object != ob) {
-			if(TESTBASELIB(v3d, base)) {
+	for (base= FIRSTBASE; base; base= base->next) {
+		if (base->object != ob) {
+			if (TESTBASELIB(v3d, base)) {
 				
 				/* first: free all logic */
 				free_sensors(&base->object->sensors);				
@@ -696,7 +709,7 @@ static void copy_texture_space(Object *to, Object *ob)
 	float *poin1= NULL, *poin2= NULL;
 	short texflag= 0;
 	
-	if(ob->type==OB_MESH) {
+	if (ob->type==OB_MESH) {
 		texflag= ((Mesh *)ob->data)->texflag;
 		poin2= ((Mesh *)ob->data)->loc;
 	}
@@ -704,14 +717,14 @@ static void copy_texture_space(Object *to, Object *ob)
 		texflag= ((Curve *)ob->data)->texflag;
 		poin2= ((Curve *)ob->data)->loc;
 	}
-	else if(ob->type==OB_MBALL) {
+	else if (ob->type==OB_MBALL) {
 		texflag= ((MetaBall *)ob->data)->texflag;
 		poin2= ((MetaBall *)ob->data)->loc;
 	}
 	else
 		return;
 		
-	if(to->type==OB_MESH) {
+	if (to->type==OB_MESH) {
 		((Mesh *)to->data)->texflag= texflag;
 		poin1= ((Mesh *)to->data)->loc;
 	}
@@ -719,7 +732,7 @@ static void copy_texture_space(Object *to, Object *ob)
 		((Curve *)to->data)->texflag= texflag;
 		poin1= ((Curve *)to->data)->loc;
 	}
-	else if(to->type==OB_MBALL) {
+	else if (to->type==OB_MBALL) {
 		((MetaBall *)to->data)->texflag= texflag;
 		poin1= ((MetaBall *)to->data)->loc;
 	}
@@ -728,13 +741,19 @@ static void copy_texture_space(Object *to, Object *ob)
 	
 	memcpy(poin1, poin2, 9*sizeof(float));	/* this was noted in DNA_mesh, curve, mball */
 	
-	if(to->type==OB_MESH) ;
-	else if(to->type==OB_MBALL) tex_space_mball(to);
-	else tex_space_curve(to->data);
+	if (to->type==OB_MESH) {
+		/* pass */
+	}
+	else if (to->type == OB_MBALL) {
+		tex_space_mball(to);
+	}
+	else {
+		tex_space_curve(to->data);
+	}
 	
 }
 
-/* UNUSED, keep incase we want to copy functionality for use elsewhere */
+/* UNUSED, keep in case we want to copy functionality for use elsewhere */
 static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
 {
 	Object *ob;
@@ -743,58 +762,58 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
 	Nurb *nu;
 	int do_scene_sort= 0;
 	
-	if(scene->id.lib) return;
+	if (scene->id.lib) return;
 
-	if(!(ob=OBACT)) return;
+	if (!(ob=OBACT)) return;
 	
-	if(scene->obedit) { // XXX get from context
+	if (scene->obedit) { // XXX get from context
 		/* obedit_copymenu(); */
 		return;
 	}
-	if(event==9) {
+	if (event==9) {
 		copymenu_properties(scene, v3d, ob);
 		return;
 	}
-	else if(event==10) {
+	else if (event==10) {
 		copymenu_logicbricks(scene, v3d, ob);
 		return;
 	}
-	else if(event==24) {
+	else if (event==24) {
 		/* moved to object_link_modifiers */
 		/* copymenu_modifiers(bmain, scene, v3d, ob); */
 		return;
 	}
 
-	for(base= FIRSTBASE; base; base= base->next) {
-		if(base != BASACT) {
-			if(TESTBASELIB(v3d, base)) {
+	for (base= FIRSTBASE; base; base= base->next) {
+		if (base != BASACT) {
+			if (TESTBASELIB(v3d, base)) {
 				base->object->recalc |= OB_RECALC_OB;
 				
-				if(event==1) {  /* loc */
+				if (event==1) {  /* loc */
 					copy_v3_v3(base->object->loc, ob->loc);
 					copy_v3_v3(base->object->dloc, ob->dloc);
 				}
-				else if(event==2) {  /* rot */
+				else if (event==2) {  /* rot */
 					copy_v3_v3(base->object->rot, ob->rot);
 					copy_v3_v3(base->object->drot, ob->drot);
 
 					copy_qt_qt(base->object->quat, ob->quat);
 					copy_qt_qt(base->object->dquat, ob->dquat);
 				}
-				else if(event==3) {  /* size */
+				else if (event==3) {  /* size */
 					copy_v3_v3(base->object->size, ob->size);
 					copy_v3_v3(base->object->dscale, ob->dscale);
 				}
-				else if(event==4) {  /* drawtype */
+				else if (event==4) {  /* drawtype */
 					base->object->dt= ob->dt;
 					base->object->dtx= ob->dtx;
 					base->object->empty_drawtype= ob->empty_drawtype;
 					base->object->empty_drawsize= ob->empty_drawsize;
 				}
-				else if(event==5) {  /* time offs */
+				else if (event==5) {  /* time offs */
 					base->object->sf= ob->sf;
 				}
-				else if(event==6) {  /* dupli */
+				else if (event==6) {  /* dupli */
 					base->object->dupon= ob->dupon;
 					base->object->dupoff= ob->dupoff;
 					base->object->dupsta= ob->dupsta;
@@ -804,17 +823,17 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
 					base->object->transflag |= (ob->transflag & OB_DUPLI);
 
 					base->object->dup_group= ob->dup_group;
-					if(ob->dup_group)
+					if (ob->dup_group)
 						id_lib_extern(&ob->dup_group->id);
 				}
-				else if(event==7) {	/* mass */
+				else if (event==7) {	/* mass */
 					base->object->mass= ob->mass;
 				}
-				else if(event==8) {	/* damping */
+				else if (event==8) {	/* damping */
 					base->object->damping= ob->damping;
 					base->object->rdamping= ob->rdamping;
 				}
-				else if(event==11) {	/* all physical attributes */
+				else if (event==11) {	/* all physical attributes */
 					base->object->gameflag = ob->gameflag;
 					base->object->inertia = ob->inertia;
 					base->object->formfactor = ob->formfactor;
@@ -829,12 +848,12 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
 					base->object->bsoft= copy_bulletsoftbody(ob->bsoft);
 
 				}
-				else if(event==17) {	/* tex space */
+				else if (event==17) {	/* tex space */
 					copy_texture_space(base->object, ob);
 				}
-				else if(event==18) {	/* font settings */
+				else if (event==18) {	/* font settings */
 					
-					if(base->object->type==ob->type) {
+					if (base->object->type==ob->type) {
 						cu= ob->data;
 						cu1= base->object->data;
 						
@@ -849,16 +868,16 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
 						cu1->wordspace= cu->wordspace;
 						cu1->ulpos= cu->ulpos;
 						cu1->ulheight= cu->ulheight;
-						if(cu1->vfont) cu1->vfont->id.us--;
+						if (cu1->vfont) cu1->vfont->id.us--;
 						cu1->vfont= cu->vfont;
 						id_us_plus((ID *)cu1->vfont);
-						if(cu1->vfontb) cu1->vfontb->id.us--;
+						if (cu1->vfontb) cu1->vfontb->id.us--;
 						cu1->vfontb= cu->vfontb;
 						id_us_plus((ID *)cu1->vfontb);
-						if(cu1->vfonti) cu1->vfonti->id.us--;
+						if (cu1->vfonti) cu1->vfonti->id.us--;
 						cu1->vfonti= cu->vfonti;
 						id_us_plus((ID *)cu1->vfonti);
-						if(cu1->vfontbi) cu1->vfontbi->id.us--;
+						if (cu1->vfontbi) cu1->vfontbi->id.us--;
 						cu1->vfontbi= cu->vfontbi;
 						id_us_plus((ID *)cu1->vfontbi);						
 
@@ -870,9 +889,9 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
 						base->object->recalc |= OB_RECALC_DATA;
 					}
 				}
-				else if(event==19) {	/* bevel settings */
+				else if (event==19) {	/* bevel settings */
 					
-					if(ELEM(base->object->type, OB_CURVE, OB_FONT)) {
+					if (ELEM(base->object->type, OB_CURVE, OB_FONT)) {
 						cu= ob->data;
 						cu1= base->object->data;
 						
@@ -886,9 +905,9 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
 						base->object->recalc |= OB_RECALC_DATA;
 					}
 				}
-				else if(event==25) {	/* curve resolution */
+				else if (event==25) {	/* curve resolution */
 
-					if(ELEM(base->object->type, OB_CURVE, OB_FONT)) {
+					if (ELEM(base->object->type, OB_CURVE, OB_FONT)) {
 						cu= ob->data;
 						cu1= base->object->data;
 						
@@ -897,7 +916,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
 						
 						nu= cu1->nurb.first;
 						
-						while(nu) {
+						while (nu) {
 							nu->resolu= cu1->resolu;
 							nu= nu->next;
 						}
@@ -905,7 +924,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
 						base->object->recalc |= OB_RECALC_DATA;
 					}
 				}
-				else if(event==21){
+				else if (event==21) {
 					if (base->object->type==OB_MESH) {
 						ModifierData *md = modifiers_findByType(ob, eModifierType_Subsurf);
 
@@ -922,15 +941,15 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
 						}
 					}
 				}
-				else if(event==22) {
+				else if (event==22) {
 					/* Copy the constraint channels over */
 					copy_constraints(&base->object->constraints, &ob->constraints, TRUE);
 					
 					do_scene_sort= 1;
 				}
-				else if(event==23) {
+				else if (event==23) {
 					base->object->softflag= ob->softflag;
-					if(base->object->soft) sbFree(base->object->soft);
+					if (base->object->soft) sbFree(base->object->soft);
 					
 					base->object->soft= copy_softbody(ob->soft);
 
@@ -938,47 +957,47 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
 						BLI_addhead(&base->object->modifiers, modifier_new(eModifierType_Softbody));
 					}
 				}
-				else if(event==26) {
+				else if (event==26) {
 #if 0 // XXX old animation system
 					copy_nlastrips(&base->object->nlastrips, &ob->nlastrips);
 #endif // XXX old animation system
 				}
-				else if(event==27) {	/* autosmooth */
+				else if (event==27) {	/* autosmooth */
 					if (base->object->type==OB_MESH) {
 						Mesh *me= ob->data;
 						Mesh *cme= base->object->data;
 						cme->smoothresh= me->smoothresh;
-						if(me->flag & ME_AUTOSMOOTH)
+						if (me->flag & ME_AUTOSMOOTH)
 							cme->flag |= ME_AUTOSMOOTH;
 						else
 							cme->flag &= ~ME_AUTOSMOOTH;
 					}
 				}
-				else if(event==28) { /* UV orco */
-					if(ELEM(base->object->type, OB_CURVE, OB_SURF)) {
+				else if (event==28) { /* UV orco */
+					if (ELEM(base->object->type, OB_CURVE, OB_SURF)) {
 						cu= ob->data;
 						cu1= base->object->data;
 						
-						if(cu->flag & CU_UV_ORCO)
+						if (cu->flag & CU_UV_ORCO)
 							cu1->flag |= CU_UV_ORCO;
 						else
 							cu1->flag &= ~CU_UV_ORCO;
 					}		
 				}
-				else if(event==29) { /* protected bits */
+				else if (event==29) { /* protected bits */
 					base->object->protectflag= ob->protectflag;
 				}
-				else if(event==30) { /* index object */
+				else if (event==30) { /* index object */
 					base->object->index= ob->index;
 				}
-				else if(event==31) { /* object color */
+				else if (event==31) { /* object color */
 					copy_v4_v4(base->object->col, ob->col);
 				}
 			}
 		}
 	}
 	
-	if(do_scene_sort)
+	if (do_scene_sort)
 		DAG_scene_sort(bmain, scene);
 
 	DAG_ids_flush_update(bmain, 0);
@@ -990,7 +1009,7 @@ static void UNUSED_FUNCTION(copy_attr_menu)(Main *bmain, Scene *scene, View3D *v
 	short event;
 	char str[512];
 	
-	if(!(ob=OBACT)) return;
+	if (!(ob=OBACT)) return;
 	
 	if (scene->obedit) { // XXX get from context
 //		if (ob->type == OB_MESH)
@@ -1004,7 +1023,10 @@ static void UNUSED_FUNCTION(copy_attr_menu)(Main *bmain, Scene *scene, View3D *v
 	 * view3d_edit_object_copyattrmenu() and in toolbox.c
 	 */
 	
-	strcpy(str, "Copy Attributes %t|Location%x1|Rotation%x2|Size%x3|Draw Options%x4|Time Offset%x5|Dupli%x6|Object Color%x31|%l|Mass%x7|Damping%x8|All Physical Attributes%x11|Properties%x9|Logic Bricks%x10|Protected Transform%x29|%l");
+	strcpy(str,
+	       "Copy Attributes %t|Location%x1|Rotation%x2|Size%x3|Draw Options%x4|"
+	       "Time Offset%x5|Dupli%x6|Object Color%x31|%l|Mass%x7|Damping%x8|All Physical Attributes%x11|Properties%x9|"
+	       "Logic Bricks%x10|Protected Transform%x29|%l");
 	
 	strcat (str, "|Object Constraints%x22");
 	strcat (str, "|NLA Strips%x26");
@@ -1013,27 +1035,27 @@ static void UNUSED_FUNCTION(copy_attr_menu)(Main *bmain, Scene *scene, View3D *v
 //		strcat(str, "|Texture Space%x17");
 //	}	
 	
-	if(ob->type == OB_FONT) strcat(str, "|Font Settings%x18|Bevel Settings%x19");
-	if(ob->type == OB_CURVE) strcat(str, "|Bevel Settings%x19|UV Orco%x28");
+	if (ob->type == OB_FONT) strcat(str, "|Font Settings%x18|Bevel Settings%x19");
+	if (ob->type == OB_CURVE) strcat(str, "|Bevel Settings%x19|UV Orco%x28");
 	
-	if((ob->type == OB_FONT) || (ob->type == OB_CURVE)) {
+	if ((ob->type == OB_FONT) || (ob->type == OB_CURVE)) {
 			strcat(str, "|Curve Resolution%x25");
 	}
 
-	if(ob->type==OB_MESH){
+	if (ob->type==OB_MESH) {
 		strcat(str, "|Subsurf Settings%x21|AutoSmooth%x27");
 	}
 
-	if(ob->soft) strcat(str, "|Soft Body Settings%x23");
+	if (ob->soft) strcat(str, "|Soft Body Settings%x23");
 	
 	strcat(str, "|Pass Index%x30");
 	
-	if(ob->type==OB_MESH || ob->type==OB_CURVE || ob->type==OB_LATTICE || ob->type==OB_SURF){
+	if (ob->type==OB_MESH || ob->type==OB_CURVE || ob->type==OB_LATTICE || ob->type==OB_SURF) {
 		strcat(str, "|Modifiers ...%x24");
 	}
 
 	event= pupmenu(str);
-	if(event<= 0) return;
+	if (event<= 0) return;
 	
 	copy_attr(bmain, scene, v3d, event);
 }
@@ -1044,10 +1066,10 @@ static int forcefield_toggle_exec(bContext *C, wmOperator *UNUSED(op))
 {
 	Object *ob = CTX_data_active_object(C);
 
-	if(ob->pd == NULL)
+	if (ob->pd == NULL)
 		ob->pd = object_add_collision_fields(PFIELD_FORCE);
 
-	if(ob->pd->forcefield == 0)
+	if (ob->pd->forcefield == 0)
 		ob->pd->forcefield = PFIELD_FORCE;
 	else
 		ob->pd->forcefield = 0;
@@ -1061,16 +1083,16 @@ void OBJECT_OT_forcefield_toggle(wmOperatorType *ot)
 {
 	
 	/* identifiers */
-	ot->name= "Toggle Force Field";
+	ot->name = "Toggle Force Field";
 	ot->description = "Toggle object's force field";
-	ot->idname= "OBJECT_OT_forcefield_toggle";
+	ot->idname = "OBJECT_OT_forcefield_toggle";
 	
 	/* api callbacks */
-	ot->exec= forcefield_toggle_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->exec = forcefield_toggle_exec;
+	ot->poll = ED_operator_object_active_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ********************************************** */
@@ -1127,16 +1149,16 @@ static int object_calculate_paths_exec (bContext *C, wmOperator *op)
 void OBJECT_OT_paths_calculate (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Calculate Object Paths";
-	ot->idname= "OBJECT_OT_paths_calculate";
-	ot->description= "Calculate paths for the selected bones";
+	ot->name = "Calculate Object Paths";
+	ot->idname = "OBJECT_OT_paths_calculate";
+	ot->description = "Calculate paths for the selected bones";
 	
 	/* api callbacks */
-	ot->exec= object_calculate_paths_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->exec = object_calculate_paths_exec;
+	ot->poll = ED_operator_object_active_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* --------- */
@@ -1171,13 +1193,13 @@ static int object_clear_paths_exec (bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_paths_clear (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear Object Paths";
-	ot->idname= "OBJECT_OT_paths_clear";
-	ot->description= "Clear path caches for selected bones";
+	ot->name = "Clear Object Paths";
+	ot->idname = "OBJECT_OT_paths_clear";
+	ot->description = "Clear path caches for selected bones";
 	
 	/* api callbacks */
-	ot->exec= object_clear_paths_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->exec = object_clear_paths_exec;
+	ot->poll = ED_operator_object_active_editable;
 	
 	/* flags */
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1195,7 +1217,7 @@ static int shade_smooth_exec(bContext *C, wmOperator *op)
 
 	CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
 
-		if(ob->type==OB_MESH) {
+		if (ob->type==OB_MESH) {
 			mesh_set_smooth_flag(ob, !clear);
 
 			DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
@@ -1203,11 +1225,11 @@ static int shade_smooth_exec(bContext *C, wmOperator *op)
 
 			done= 1;
 		}
-		else if ELEM(ob->type, OB_SURF, OB_CURVE) {
+		else if (ELEM(ob->type, OB_SURF, OB_CURVE)) {
 			cu= ob->data;
 
-			for(nu=cu->nurb.first; nu; nu=nu->next) {
-				if(!clear) nu->flag |= ME_SMOOTH;
+			for (nu=cu->nurb.first; nu; nu=nu->next) {
+				if (!clear) nu->flag |= ME_SMOOTH;
 				else nu->flag &= ~ME_SMOOTH;
 			}
 
@@ -1230,31 +1252,31 @@ static int shade_poll(bContext *C)
 void OBJECT_OT_shade_flat(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Shade Flat";
-	ot->description= "Display faces 'flat'";
-	ot->idname= "OBJECT_OT_shade_flat";
+	ot->name = "Shade Flat";
+	ot->description = "Display faces 'flat'";
+	ot->idname = "OBJECT_OT_shade_flat";
 	
 	/* api callbacks */
-	ot->poll= shade_poll;
-	ot->exec= shade_smooth_exec;
+	ot->poll = shade_poll;
+	ot->exec = shade_smooth_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 void OBJECT_OT_shade_smooth(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Shade Smooth";
-	ot->description= "Display faces 'smooth' (using vertex normals)";
-	ot->idname= "OBJECT_OT_shade_smooth";
+	ot->name = "Shade Smooth";
+	ot->description = "Display faces 'smooth' (using vertex normals)";
+	ot->idname = "OBJECT_OT_shade_smooth";
 	
 	/* api callbacks */
-	ot->poll= shade_poll;
-	ot->exec= shade_smooth_exec;
+	ot->poll = shade_poll;
+	ot->exec = shade_smooth_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ********************** */
@@ -1269,31 +1291,31 @@ static void UNUSED_FUNCTION(image_aspect)(Scene *scene, View3D *v3d)
 	float x, y, space;
 	int a, b, done;
 	
-	if(scene->obedit) return; // XXX get from context
-	if(scene->id.lib) return;
+	if (scene->obedit) return; // XXX get from context
+	if (scene->id.lib) return;
 	
-	for(base= FIRSTBASE; base; base= base->next) {
-		if(TESTBASELIB(v3d, base)) {
+	for (base= FIRSTBASE; base; base= base->next) {
+		if (TESTBASELIB(v3d, base)) {
 			ob= base->object;
 			done= 0;
 			
-			for(a=1; a<=ob->totcol; a++) {
+			for (a=1; a<=ob->totcol; a++) {
 				ma= give_current_material(ob, a);
-				if(ma) {
-					for(b=0; b<MAX_MTEX; b++) {
-						if(ma->mtex[b] && ma->mtex[b]->tex) {
+				if (ma) {
+					for (b=0; b<MAX_MTEX; b++) {
+						if (ma->mtex[b] && ma->mtex[b]->tex) {
 							tex= ma->mtex[b]->tex;
-							if(tex->type==TEX_IMAGE && tex->ima) {
+							if (tex->type==TEX_IMAGE && tex->ima) {
 								ImBuf *ibuf= BKE_image_get_ibuf(tex->ima, NULL);
 								
 								/* texturespace */
 								space= 1.0;
-								if(ob->type==OB_MESH) {
+								if (ob->type==OB_MESH) {
 									float size[3];
 									mesh_get_texspace(ob->data, NULL, NULL, size);
 									space= size[0]/size[1];
 								}
-								else if(ELEM3(ob->type, OB_CURVE, OB_FONT, OB_SURF)) {
+								else if (ELEM3(ob->type, OB_CURVE, OB_FONT, OB_SURF)) {
 									Curve *cu= ob->data;
 									space= cu->size[0]/cu->size[1];
 								}
@@ -1301,17 +1323,17 @@ static void UNUSED_FUNCTION(image_aspect)(Scene *scene, View3D *v3d)
 								x= ibuf->x/space;
 								y= ibuf->y;
 								
-								if(x>y) ob->size[0]= ob->size[1]*x/y;
+								if (x>y) ob->size[0]= ob->size[1]*x/y;
 								else ob->size[1]= ob->size[0]*y/x;
 								
 								done= 1;
 								DAG_id_tag_update(&ob->id, OB_RECALC_OB);								
 							}
 						}
-						if(done) break;
+						if (done) break;
 					}
 				}
-				if(done) break;
+				if (done) break;
 			}
 		}
 	}
@@ -1326,12 +1348,12 @@ static EnumPropertyItem *object_mode_set_itemsf(bContext *C, PointerRNA *UNUSED(
 	Object *ob;
 	int totitem= 0;
 	
-	if(!C) /* needed for docs */
+	if (!C) /* needed for docs */
 		return object_mode_items;
 
 	ob = CTX_data_active_object(C);
-	while(ob && input->identifier) {
-		if((input->value == OB_MODE_EDIT && ((ob->type == OB_MESH) || (ob->type == OB_ARMATURE) ||
+	while (ob && input->identifier) {
+		if ((input->value == OB_MODE_EDIT && ((ob->type == OB_MESH) || (ob->type == OB_ARMATURE) ||
 							(ob->type == OB_CURVE) || (ob->type == OB_SURF) ||
 							 (ob->type == OB_FONT) || (ob->type == OB_MBALL) || (ob->type == OB_LATTICE))) ||
 		   (input->value == OB_MODE_POSE && (ob->type == OB_ARMATURE)) ||
@@ -1352,19 +1374,19 @@ static EnumPropertyItem *object_mode_set_itemsf(bContext *C, PointerRNA *UNUSED(
 
 static const char *object_mode_op_string(int mode)
 {
-	if(mode & OB_MODE_EDIT)
+	if (mode & OB_MODE_EDIT)
 		return "OBJECT_OT_editmode_toggle";
-	if(mode == OB_MODE_SCULPT)
+	if (mode == OB_MODE_SCULPT)
 		return "SCULPT_OT_sculptmode_toggle";
-	if(mode == OB_MODE_VERTEX_PAINT)
+	if (mode == OB_MODE_VERTEX_PAINT)
 		return "PAINT_OT_vertex_paint_toggle";
-	if(mode == OB_MODE_WEIGHT_PAINT)
+	if (mode == OB_MODE_WEIGHT_PAINT)
 		return "PAINT_OT_weight_paint_toggle";
-	if(mode == OB_MODE_TEXTURE_PAINT)
+	if (mode == OB_MODE_TEXTURE_PAINT)
 		return "PAINT_OT_texture_paint_toggle";
-	if(mode == OB_MODE_PARTICLE_EDIT)
+	if (mode == OB_MODE_PARTICLE_EDIT)
 		return "PARTICLE_OT_particle_edit_toggle";
-	if(mode == OB_MODE_POSE)
+	if (mode == OB_MODE_POSE)
 		return "OBJECT_OT_posemode_toggle";
 	return NULL;
 }
@@ -1375,27 +1397,27 @@ static int object_mode_set_compat(bContext *UNUSED(C), wmOperator *op, Object *o
 {
 	ObjectMode mode = RNA_enum_get(op->ptr, "mode");
 
-	if(ob) {
-		if(mode == OB_MODE_OBJECT)
+	if (ob) {
+		if (mode == OB_MODE_OBJECT)
 			return 1;
 
 		switch(ob->type) {
 		case OB_MESH:
-			if(mode & (OB_MODE_EDIT|OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT|OB_MODE_PARTICLE_EDIT))
+			if (mode & (OB_MODE_EDIT|OB_MODE_SCULPT|OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT|OB_MODE_PARTICLE_EDIT))
 				return 1;
 			return 0;
 		case OB_CURVE:
 		case OB_SURF:
 		case OB_FONT:
 		case OB_MBALL:
-			if(mode & (OB_MODE_EDIT))
+			if (mode & (OB_MODE_EDIT))
 				return 1;
 			return 0;
 		case OB_LATTICE:
-			if(mode & (OB_MODE_EDIT|OB_MODE_WEIGHT_PAINT))
+			if (mode & (OB_MODE_EDIT|OB_MODE_WEIGHT_PAINT))
 				return 1;
 		case OB_ARMATURE:
-			if(mode & (OB_MODE_EDIT|OB_MODE_POSE))
+			if (mode & (OB_MODE_EDIT|OB_MODE_POSE))
 				return 1;
 		}
 	}
@@ -1410,23 +1432,23 @@ static int object_mode_set_exec(bContext *C, wmOperator *op)
 	ObjectMode restore_mode = (ob) ? ob->mode : OB_MODE_OBJECT;
 	int toggle = RNA_boolean_get(op->ptr, "toggle");
 
-	if(!ob || !object_mode_set_compat(C, op, ob))
+	if (!ob || !object_mode_set_compat(C, op, ob))
 		return OPERATOR_PASS_THROUGH;
 
 	/* Exit current mode if it's not the mode we're setting */
-	if(ob->mode != OB_MODE_OBJECT && ob->mode != mode)
+	if (ob->mode != OB_MODE_OBJECT && ob->mode != mode)
 		WM_operator_name_call(C, object_mode_op_string(ob->mode), WM_OP_EXEC_REGION_WIN, NULL);
 
-	if(mode != OB_MODE_OBJECT) {
+	if (mode != OB_MODE_OBJECT) {
 		/* Enter new mode */
-		if(ob->mode != mode || toggle)
+		if (ob->mode != mode || toggle)
 			WM_operator_name_call(C, object_mode_op_string(mode), WM_OP_EXEC_REGION_WIN, NULL);
 
-		if(toggle) {
-			if(ob->mode == mode)
+		if (toggle) {
+			if (ob->mode == mode)
 				/* For toggling, store old mode so we know what to go back to */
 				ob->restore_mode = restore_mode;
-			else if(ob->restore_mode != OB_MODE_OBJECT && ob->restore_mode != mode) {
+			else if (ob->restore_mode != OB_MODE_OBJECT && ob->restore_mode != mode) {
 				WM_operator_name_call(C, object_mode_op_string(ob->restore_mode), WM_OP_EXEC_REGION_WIN, NULL);
 			}
 		}
@@ -1440,17 +1462,17 @@ void OBJECT_OT_mode_set(wmOperatorType *ot)
 	PropertyRNA *prop;
 
 	/* identifiers */
-	ot->name= "Set Object Mode";
+	ot->name = "Set Object Mode";
 	ot->description = "Sets the object interaction mode";
-	ot->idname= "OBJECT_OT_mode_set";
+	ot->idname = "OBJECT_OT_mode_set";
 	
 	/* api callbacks */
-	ot->exec= object_mode_set_exec;
+	ot->exec = object_mode_set_exec;
 	
-	ot->poll= ED_operator_object_active_editable;
+	ot->poll = ED_operator_object_active_editable;
 	
 	/* flags */
-	ot->flag= 0; /* no register/undo here, leave it to operators being called */
+	ot->flag = 0; /* no register/undo here, leave it to operators being called */
 	
 	prop= RNA_def_enum(ot->srna, "mode", object_mode_items, OB_MODE_OBJECT, "Mode", "");
 	RNA_def_enum_funcs(prop, object_mode_set_itemsf);
@@ -1462,19 +1484,19 @@ void OBJECT_OT_mode_set(wmOperatorType *ot)
 
 void ED_object_toggle_modes(bContext *C, int mode)
 {
-	if(mode & OB_MODE_SCULPT)
+	if (mode & OB_MODE_SCULPT)
 		WM_operator_name_call(C, "SCULPT_OT_sculptmode_toggle", WM_OP_EXEC_REGION_WIN, NULL);
-	if(mode & OB_MODE_VERTEX_PAINT)
+	if (mode & OB_MODE_VERTEX_PAINT)
 		WM_operator_name_call(C, "PAINT_OT_vertex_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
-	if(mode & OB_MODE_WEIGHT_PAINT)
+	if (mode & OB_MODE_WEIGHT_PAINT)
 		WM_operator_name_call(C, "PAINT_OT_weight_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
-	if(mode & OB_MODE_TEXTURE_PAINT)
+	if (mode & OB_MODE_TEXTURE_PAINT)
 		WM_operator_name_call(C, "PAINT_OT_texture_paint_toggle", WM_OP_EXEC_REGION_WIN, NULL);
-	if(mode & OB_MODE_PARTICLE_EDIT)
+	if (mode & OB_MODE_PARTICLE_EDIT)
 		WM_operator_name_call(C, "PARTICLE_OT_particle_edit_toggle", WM_OP_EXEC_REGION_WIN, NULL);
-	if(mode & OB_MODE_POSE)
+	if (mode & OB_MODE_POSE)
 		WM_operator_name_call(C, "OBJECT_OT_posemode_toggle", WM_OP_EXEC_REGION_WIN, NULL);
-	if(mode & OB_MODE_EDIT)
+	if (mode & OB_MODE_EDIT)
 		WM_operator_name_call(C, "OBJECT_OT_editmode_toggle", WM_OP_EXEC_REGION_WIN, NULL);
 }
 
@@ -1505,16 +1527,16 @@ static int game_property_new(bContext *C, wmOperator *op)
 void OBJECT_OT_game_property_new(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "New Game Property";
-	ot->description= "Create a new property available to the game engine";
-	ot->idname= "OBJECT_OT_game_property_new";
+	ot->name = "New Game Property";
+	ot->description = "Create a new property available to the game engine";
+	ot->idname = "OBJECT_OT_game_property_new";
 
 	/* api callbacks */
-	ot->exec= game_property_new;
-	ot->poll= ED_operator_object_active_editable;
+	ot->exec = game_property_new;
+	ot->poll = ED_operator_object_active_editable;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	RNA_def_enum(ot->srna, "type", gameproperty_type_items, GPROP_FLOAT, "Type", "Type of game property to add");
 	RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the game property to add");
@@ -1526,12 +1548,12 @@ static int game_property_remove(bContext *C, wmOperator *op)
 	bProperty *prop;
 	int index= RNA_int_get(op->ptr, "index");
 
-	if(!ob)
+	if (!ob)
 		return OPERATOR_CANCELLED;
 
 	prop= BLI_findlink(&ob->prop, index);
 
-	if(prop) {
+	if (prop) {
 		BLI_remlink(&ob->prop, prop);
 		free_property(prop);
 
@@ -1546,16 +1568,16 @@ static int game_property_remove(bContext *C, wmOperator *op)
 void OBJECT_OT_game_property_remove(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove Game Property";
-	ot->description= "Remove game property";
-	ot->idname= "OBJECT_OT_game_property_remove";
+	ot->name = "Remove Game Property";
+	ot->description = "Remove game property";
+	ot->idname = "OBJECT_OT_game_property_remove";
 
 	/* api callbacks */
-	ot->exec= game_property_remove;
-	ot->poll= ED_operator_object_active_editable;
+	ot->exec = game_property_remove;
+	ot->poll = ED_operator_object_active_editable;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "Property index to remove ", 0, INT_MAX);
 }
@@ -1581,10 +1603,10 @@ static EnumPropertyItem *gameprops_itemf(bContext *C, PointerRNA *UNUSED(ptr), P
 	bProperty *prop;
 	int a, totitem= 0;
 	
-	if(!ob)
+	if (!ob)
 		return gameprops_items;
 
-	for(a=1, prop= ob->prop.first; prop; prop=prop->next, a++) {
+	for (a=1, prop= ob->prop.first; prop; prop=prop->next, a++) {
 		tmp.value= a;
 		tmp.identifier= prop->name;
 		tmp.name= prop->name;
@@ -1604,10 +1626,10 @@ static int game_property_copy_exec(bContext *C, wmOperator *op)
 	int type = RNA_enum_get(op->ptr, "operation");
 	int propid= RNA_enum_get(op->ptr, "property");
 
-	if(propid > 0) { /* copy */
+	if (propid > 0) { /* copy */
 		prop = BLI_findlink(&ob->prop, propid-1);
 		
-		if(prop) {
+		if (prop) {
 			CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
 				if (ob != ob_iter)
 					set_ob_property(ob_iter, prop);
@@ -1623,7 +1645,7 @@ static int game_property_copy_exec(bContext *C, wmOperator *op)
 
 				/* merge - the default when calling with no argument */
 				else
-					for(prop = ob->prop.first; prop; prop= prop->next)
+					for (prop = ob->prop.first; prop; prop= prop->next)
 						set_ob_property(ob_iter, prop);
 			}
 		}
@@ -1637,20 +1659,20 @@ void OBJECT_OT_game_property_copy(wmOperatorType *ot)
 {
 	PropertyRNA *prop;
 	/* identifiers */
-	ot->name= "Copy Game Property";
-	ot->idname= "OBJECT_OT_game_property_copy";
+	ot->name = "Copy Game Property";
+	ot->idname = "OBJECT_OT_game_property_copy";
 
 	/* api callbacks */
-	ot->exec= game_property_copy_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->exec = game_property_copy_exec;
+	ot->poll = ED_operator_object_active_editable;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	RNA_def_enum(ot->srna, "operation", game_properties_copy_operations, 3, "Operation", "");
 	prop=RNA_def_enum(ot->srna, "property", gameprops_items, 0, "Property", "Properties to copy");
 	RNA_def_enum_funcs(prop, gameprops_itemf);
-	ot->prop=prop;
+	ot->prop = prop;
 }
 
 static int game_property_clear_exec(bContext *C, wmOperator *UNUSED(op))
@@ -1666,15 +1688,15 @@ static int game_property_clear_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_game_property_clear(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear Game Property";
-	ot->idname= "OBJECT_OT_game_property_clear";
+	ot->name = "Clear Game Property";
+	ot->idname = "OBJECT_OT_game_property_clear";
 
 	/* api callbacks */
-	ot->exec= game_property_clear_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->exec = game_property_clear_exec;
+	ot->poll = ED_operator_object_active_editable;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /************************ Copy Logic Bricks ***********************/
@@ -1684,7 +1706,7 @@ static int logicbricks_copy_exec(bContext *C, wmOperator *UNUSED(op))
 	Object *ob=ED_object_active_context(C);
 
 	CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
-		if(ob != ob_iter) {
+		if (ob != ob_iter) {
 			/* first: free all logic */
 			free_sensors(&ob_iter->sensors);				
 			unlink_controllers(&ob_iter->controllers);
@@ -1707,7 +1729,7 @@ static int logicbricks_copy_exec(bContext *C, wmOperator *UNUSED(op))
 			ob_iter->state= ob->state;
 			ob_iter->init_state= ob->init_state;
 
-			if(ob_iter->totcol==ob->totcol) {
+			if (ob_iter->totcol==ob->totcol) {
 				ob_iter->actcol= ob->actcol;
 				WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob_iter);
 			}
@@ -1723,16 +1745,16 @@ static int logicbricks_copy_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_logic_bricks_copy(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Copy Logic Bricks to Selected";
+	ot->name = "Copy Logic Bricks to Selected";
 	ot->description = "Copy logic bricks to other selected objects";
-	ot->idname= "OBJECT_OT_logic_bricks_copy";
+	ot->idname = "OBJECT_OT_logic_bricks_copy";
 
 	/* api callbacks */
-	ot->exec= logicbricks_copy_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->exec = logicbricks_copy_exec;
+	ot->poll = ED_operator_object_active_editable;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int game_physics_copy_exec(bContext *C, wmOperator *UNUSED(op))
@@ -1740,11 +1762,11 @@ static int game_physics_copy_exec(bContext *C, wmOperator *UNUSED(op))
 	Object *ob=ED_object_active_context(C);
 	
 	CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
-		if(ob != ob_iter) {
+		if (ob != ob_iter) {
 			ob_iter->gameflag = ob->gameflag;
 			ob_iter->gameflag2 = ob->gameflag2;
 			ob_iter->inertia = ob->inertia;
-			ob_iter->formfactor = ob->formfactor;;
+			ob_iter->formfactor = ob->formfactor;
 			ob_iter->damping = ob->damping;
 			ob_iter->rdamping = ob->rdamping;
 			ob_iter->min_vel = ob->min_vel;
@@ -1757,7 +1779,7 @@ static int game_physics_copy_exec(bContext *C, wmOperator *UNUSED(op))
 			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) 
+			if (ob->restrictflag & OB_RESTRICT_RENDER) 
 				ob_iter->restrictflag |= OB_RESTRICT_RENDER;
 			 else
 				ob_iter->restrictflag &= ~OB_RESTRICT_RENDER;
@@ -1771,14 +1793,14 @@ static int game_physics_copy_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_game_physics_copy(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Copy Game Physics Properties to Selected";
+	ot->name = "Copy Game Physics Properties to Selected";
 	ot->description = "Copy game physics properties to other selected objects";
-	ot->idname= "OBJECT_OT_game_physics_copy";
+	ot->idname = "OBJECT_OT_game_physics_copy";
 	
 	/* api callbacks */
-	ot->exec= game_physics_copy_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->exec = game_physics_copy_exec;
+	ot->poll = ED_operator_object_active_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c
index 1b8c0fd..3867b1e 100644
--- a/source/blender/editors/object/object_group.c
+++ b/source/blender/editors/object/object_group.c
@@ -65,25 +65,30 @@ static int objects_add_active_exec(bContext *C, wmOperator *op)
 	Scene *scene= CTX_data_scene(C);
 	Object *ob= OBACT;
 	Group *group;
-	int ok = 0;
+	int ok = 0, cycle = 0;
 	
-	if(!ob) return OPERATOR_CANCELLED;
+	if (!ob) return OPERATOR_CANCELLED;
 	
 	/* linking to same group requires its own loop so we can avoid
-	   looking up the active objects groups each time */
+	 * looking up the active objects groups each time */
 
-	for(group= bmain->group.first; group; group=group->id.next) {
-		if(object_in_group(ob, group)) {
+	for (group= bmain->group.first; group; group=group->id.next) {
+		if (object_in_group(ob, group)) {
 			/* Assign groups to selected objects */
 			CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
-				add_to_group(group, base->object, scene, base);
+				if (base->object->dup_group != group)
+					add_to_group(group, base->object, scene, base);
+				else
+					cycle = 1;
 				ok = 1;
 			}
 			CTX_DATA_END;
 		}
 	}
 	
-	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");
+	if (cycle)
+		BKE_report(op->reports, RPT_WARNING, "Skipped some groups because of cycle detected");
 	
 	DAG_scene_sort(bmain, scene);
 	WM_event_add_notifier(C, NC_GROUP|NA_EDITED, NULL);
@@ -94,16 +99,16 @@ static int objects_add_active_exec(bContext *C, wmOperator *op)
 void GROUP_OT_objects_add_active(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Selected To Active Group";
+	ot->name = "Add Selected To Active Group";
 	ot->description = "Add the object to an object group that contains the active object";
-	ot->idname= "GROUP_OT_objects_add_active";
+	ot->idname = "GROUP_OT_objects_add_active";
 	
 	/* api callbacks */
-	ot->exec= objects_add_active_exec;	
-	ot->poll= ED_operator_objectmode;
+	ot->exec = objects_add_active_exec;	
+	ot->poll = ED_operator_objectmode;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int objects_remove_active_exec(bContext *C, wmOperator *op)
@@ -114,13 +119,13 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op)
 	Group *group;
 	int ok = 0;
 	
-	if(!ob) return OPERATOR_CANCELLED;
+	if (!ob) return OPERATOR_CANCELLED;
 	
 	/* linking to same group requires its own loop so we can avoid
-	   looking up the active objects groups each time */
+	 * looking up the active objects groups each time */
 
-	for(group= bmain->group.first; group; group=group->id.next) {
-		if(object_in_group(ob, group)) {
+	for (group= bmain->group.first; group; group=group->id.next) {
+		if (object_in_group(ob, group)) {
 			/* Assign groups to selected objects */
 			CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
 				rem_from_group(group, base->object, scene, base);
@@ -130,7 +135,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);
@@ -141,16 +146,16 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op)
 void GROUP_OT_objects_remove_active(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove Selected From Active Group";
+	ot->name = "Remove Selected From Active Group";
 	ot->description = "Remove the object from an object group that contains the active object";
-	ot->idname= "GROUP_OT_objects_remove_active";
+	ot->idname = "GROUP_OT_objects_remove_active";
 	
 	/* api callbacks */
-	ot->exec= objects_remove_active_exec;	
-	ot->poll= ED_operator_objectmode;
+	ot->exec = objects_remove_active_exec;	
+	ot->poll = ED_operator_objectmode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int group_objects_remove_exec(bContext *C, wmOperator *UNUSED(op))
@@ -161,7 +166,7 @@ static int group_objects_remove_exec(bContext *C, wmOperator *UNUSED(op))
 
 	CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
 		group = NULL;
-		while((group = find_group(base->object, group)))
+		while ((group = find_group(base->object, group)))
 			rem_from_group(group, base->object, scene, base);
 	}
 	CTX_DATA_END;
@@ -175,16 +180,16 @@ static int group_objects_remove_exec(bContext *C, wmOperator *UNUSED(op))
 void GROUP_OT_objects_remove(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove From Groups";
+	ot->name = "Remove From Groups";
 	ot->description = "Remove selected objects from all groups";
-	ot->idname= "GROUP_OT_objects_remove";
+	ot->idname = "GROUP_OT_objects_remove";
 	
 	/* api callbacks */
-	ot->exec= group_objects_remove_exec;	
-	ot->poll= ED_operator_objectmode;
+	ot->exec = group_objects_remove_exec;	
+	ot->poll = ED_operator_objectmode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int group_create_exec(bContext *C, wmOperator *op)
@@ -212,16 +217,16 @@ static int group_create_exec(bContext *C, wmOperator *op)
 void GROUP_OT_create(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Create New Group";
+	ot->name = "Create New Group";
 	ot->description = "Create an object group from selected objects";
-	ot->idname= "GROUP_OT_create";
+	ot->idname = "GROUP_OT_create";
 	
 	/* api callbacks */
-	ot->exec= group_create_exec;	
-	ot->poll= ED_operator_objectmode;
+	ot->exec = group_create_exec;	
+	ot->poll = ED_operator_objectmode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	RNA_def_string(ot->srna, "name", "Group", MAX_ID_NAME-2, "Name", "Name of the new group");
 }
@@ -234,7 +239,7 @@ static int group_add_exec(bContext *C, wmOperator *UNUSED(op))
 	Object *ob= ED_object_context(C);
 	Group *group;
 
-	if(ob == NULL)
+	if (ob == NULL)
 		return OPERATOR_CANCELLED;
 
 	group= add_group("Group");
@@ -248,15 +253,15 @@ static int group_add_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_group_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add to Group";
-	ot->idname= "OBJECT_OT_group_add";
+	ot->name = "Add to Group";
+	ot->idname = "OBJECT_OT_group_add";
 	ot->description = "Add an object to a new group";
 	
 	/* api callbacks */
-	ot->exec= group_add_exec;
+	ot->exec = group_add_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int group_link_exec(bContext *C, wmOperator *op)
@@ -265,7 +270,7 @@ static int group_link_exec(bContext *C, wmOperator *op)
 	Object *ob= ED_object_context(C);
 	Group *group= BLI_findlink(&CTX_data_main(C)->group, RNA_enum_get(op->ptr, "group"));
 
-	if(ELEM(NULL, ob, group))
+	if (ELEM(NULL, ob, group))
 		return OPERATOR_CANCELLED;
 
 	add_to_group(group, ob, scene, NULL);
@@ -280,21 +285,21 @@ void OBJECT_OT_group_link(wmOperatorType *ot)
 	PropertyRNA *prop;
 
 	/* identifiers */
-	ot->name= "Link to Group";
-	ot->idname= "OBJECT_OT_group_link";
+	ot->name = "Link to Group";
+	ot->idname = "OBJECT_OT_group_link";
 	ot->description = "Add an object to an existing group";
 	
 	/* api callbacks */
-	ot->exec= group_link_exec;
-	ot->invoke= WM_enum_search_invoke;
+	ot->exec = group_link_exec;
+	ot->invoke = WM_enum_search_invoke;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	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_local_itemf);
-	ot->prop= prop;
+	ot->prop = prop;
 }
 
 static int group_remove_exec(bContext *C, wmOperator *UNUSED(op))
@@ -303,7 +308,7 @@ static int group_remove_exec(bContext *C, wmOperator *UNUSED(op))
 	Object *ob= ED_object_context(C);
 	Group *group= CTX_data_pointer_get_type(C, "group", &RNA_Group).data;
 
-	if(!ob || !group)
+	if (!ob || !group)
 		return OPERATOR_CANCELLED;
 
 	rem_from_group(group, ob, scene, NULL); /* base will be used if found */
@@ -316,13 +321,13 @@ static int group_remove_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_group_remove(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove Group";
-	ot->idname= "OBJECT_OT_group_remove";
+	ot->name = "Remove Group";
+	ot->idname = "OBJECT_OT_group_remove";
 	
 	/* api callbacks */
-	ot->exec= group_remove_exec;
+	ot->exec = group_remove_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index de991f2..ef428b5 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -34,13 +34,13 @@
 #include "MEM_guardedalloc.h"
 
 #include "BLI_math.h"
-#include "BLI_editVert.h"
 #include "BLI_listbase.h"
 #include "BLI_string.h"
 #include "BLI_utildefines.h"
 
 #include "DNA_curve_types.h"
 #include "DNA_lattice_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
@@ -55,6 +55,7 @@
 #include "BKE_report.h"
 #include "BKE_scene.h"
 #include "BKE_deform.h"
+#include "BKE_tessmesh.h"
 
 #include "RNA_define.h"
 #include "RNA_access.h"
@@ -71,23 +72,24 @@
 
 #include "object_intern.h"
 
-static int return_editmesh_indexar(EditMesh *em, int *tot, int **indexar, float *cent)
+static int return_editmesh_indexar(BMEditMesh *em, int *tot, int **indexar, float *cent)
 {
-	EditVert *eve;
+	BMVert *eve;
+	BMIter iter;
 	int *index, nr, totvert=0;
 	
-	for(eve= em->verts.first; eve; eve= eve->next) {
-		if(eve->f & SELECT) totvert++;
+	BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+		if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) totvert++;
 	}
-	if(totvert==0) return 0;
+	if (totvert==0) return 0;
 	
 	*indexar= index= MEM_mallocN(4*totvert, "hook indexar");
 	*tot= totvert;
 	nr= 0;
 	zero_v3(cent);
 	
-	for(eve= em->verts.first; eve; eve= eve->next) {
-		if(eve->f & SELECT) {
+	BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+		if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
 			*index= nr; index++;
 			add_v3_v3(cent, eve->co);
 		}
@@ -99,29 +101,30 @@ static int return_editmesh_indexar(EditMesh *em, int *tot, int **indexar, float
 	return totvert;
 }
 
-static int return_editmesh_vgroup(Object *obedit, EditMesh *em, char *name, float *cent)
+static int return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *name, float *cent)
 {
 	zero_v3(cent);
 
-	if(obedit->actdef) {
+	if (obedit->actdef) {
 		const int defgrp_index= obedit->actdef-1;
 		int totvert=0;
 
 		MDeformVert *dvert;
-		EditVert *eve;
+		BMVert *eve;
+		BMIter iter;
 
 		/* find the vertices */
-		for(eve= em->verts.first; eve; eve= eve->next) {
-			dvert= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
+		BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+			dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
 
-			if(dvert) {
-				if(defvert_find_weight(dvert, defgrp_index) > 0.0f) {
+			if (dvert) {
+				if (defvert_find_weight(dvert, defgrp_index) > 0.0f) {
 					add_v3_v3(cent, eve->co);
 					totvert++;
 				}
 			}
 		}
-		if(totvert) {
+		if (totvert) {
 			bDeformGroup *dg = BLI_findlink(&obedit->defbase, defgrp_index);
 			BLI_strncpy(name, dg->name, sizeof(dg->name));
 			mul_v3_fl(cent, 1.0f/(float)totvert);
@@ -132,25 +135,27 @@ static int return_editmesh_vgroup(Object *obedit, EditMesh *em, char *name, floa
 	return 0;
 }	
 
-static void select_editmesh_hook(Object *ob, HookModifierData *hmd)
+static void select_editbmesh_hook(Object *ob, HookModifierData *hmd)
 {
 	Mesh *me= ob->data;
-	EditMesh *em= BKE_mesh_get_editmesh(me);
-	EditVert *eve;
+	BMEditMesh *em= me->edit_btmesh;
+	BMVert *eve;
+	BMIter iter;
 	int index=0, nr=0;
 	
 	if (hmd->indexar == NULL)
 		return;
 	
-	for(eve= em->verts.first; eve; eve= eve->next, nr++) {
-		if(nr==hmd->indexar[index]) {
-			eve->f |= SELECT;
-			if(index < hmd->totindex-1) index++;
+	BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+		if (nr==hmd->indexar[index]) {
+			BM_vert_select_set(em->bm, eve, TRUE);
+			if (index < hmd->totindex-1) index++;
 		}
+
+		nr++;
 	}
-	EM_select_flush(em);
 
-	BKE_mesh_end_editmesh(me, em);
+	EDBM_select_flush(em);
 }
 
 static int return_editlattice_indexar(Lattice *editlatt, int *tot, int **indexar, float *cent)
@@ -161,25 +166,25 @@ static int return_editlattice_indexar(Lattice *editlatt, int *tot, int **indexar
 	/* count */
 	a= editlatt->pntsu*editlatt->pntsv*editlatt->pntsw;
 	bp= editlatt->def;
-	while(a--) {
-		if(bp->f1 & SELECT) {
-			if(bp->hide==0) totvert++;
+	while (a--) {
+		if (bp->f1 & SELECT) {
+			if (bp->hide==0) totvert++;
 		}
 		bp++;
 	}
 
-	if(totvert==0) return 0;
+	if (totvert==0) return 0;
 	
 	*indexar= index= MEM_mallocN(4*totvert, "hook indexar");
 	*tot= totvert;
 	nr= 0;
-	cent[0]= cent[1]= cent[2]= 0.0;
+	zero_v3(cent);
 	
 	a= editlatt->pntsu*editlatt->pntsv*editlatt->pntsw;
 	bp= editlatt->def;
-	while(a--) {
-		if(bp->f1 & SELECT) {
-			if(bp->hide==0) {
+	while (a--) {
+		if (bp->f1 & SELECT) {
+			if (bp->hide==0) {
 				*index= nr; index++;
 				add_v3_v3(cent, bp->vec);
 			}
@@ -203,10 +208,10 @@ static void select_editlattice_hook(Object *obedit, HookModifierData *hmd)
 	/* count */
 	a= editlt->pntsu*editlt->pntsv*editlt->pntsw;
 	bp= editlt->def;
-	while(a--) {
-		if(hmd->indexar[index]==nr) {
+	while (a--) {
+		if (hmd->indexar[index]==nr) {
 			bp->f1 |= SELECT;
-			if(index < hmd->totindex-1) index++;
+			if (index < hmd->totindex-1) index++;
 		}
 		nr++;
 		bp++;
@@ -221,49 +226,49 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo
 	BezTriple *bezt;
 	int *index, a, nr, totvert=0;
 	
-	for(nu= editnurb->first; nu; nu= nu->next) {
-		if(nu->type == CU_BEZIER) {
+	for (nu= editnurb->first; nu; nu= nu->next) {
+		if (nu->type == CU_BEZIER) {
 			bezt= nu->bezt;
 			a= nu->pntsu;
-			while(a--) {
-				if(bezt->f1 & SELECT) totvert++;
-				if(bezt->f2 & SELECT) totvert++;
-				if(bezt->f3 & SELECT) totvert++;
+			while (a--) {
+				if (bezt->f1 & SELECT) totvert++;
+				if (bezt->f2 & SELECT) totvert++;
+				if (bezt->f3 & SELECT) totvert++;
 				bezt++;
 			}
 		}
 		else {
 			bp= nu->bp;
 			a= nu->pntsu*nu->pntsv;
-			while(a--) {
-				if(bp->f1 & SELECT) totvert++;
+			while (a--) {
+				if (bp->f1 & SELECT) totvert++;
 				bp++;
 			}
 		}
 	}
-	if(totvert==0) return 0;
+	if (totvert==0) return 0;
 	
 	*indexar= index= MEM_mallocN(4*totvert, "hook indexar");
 	*tot= totvert;
 	nr= 0;
-	cent[0]= cent[1]= cent[2]= 0.0;
+	zero_v3(cent);
 	
-	for(nu= editnurb->first; nu; nu= nu->next) {
-		if(nu->type == CU_BEZIER) {
+	for (nu= editnurb->first; nu; nu= nu->next) {
+		if (nu->type == CU_BEZIER) {
 			bezt= nu->bezt;
 			a= nu->pntsu;
-			while(a--) {
-				if(bezt->f1 & SELECT) {
+			while (a--) {
+				if (bezt->f1 & SELECT) {
 					*index= nr; index++;
 					add_v3_v3(cent, bezt->vec[0]);
 				}
 				nr++;
-				if(bezt->f2 & SELECT) {
+				if (bezt->f2 & SELECT) {
 					*index= nr; index++;
 					add_v3_v3(cent, bezt->vec[1]);
 				}
 				nr++;
-				if(bezt->f3 & SELECT) {
+				if (bezt->f3 & SELECT) {
 					*index= nr; index++;
 					add_v3_v3(cent, bezt->vec[2]);
 				}
@@ -274,8 +279,8 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo
 		else {
 			bp= nu->bp;
 			a= nu->pntsu*nu->pntsv;
-			while(a--) {
-				if(bp->f1 & SELECT) {
+			while (a--) {
+				if (bp->f1 & SELECT) {
 					*index= nr; index++;
 					add_v3_v3(cent, bp->vec);
 				}
@@ -300,20 +305,20 @@ static int object_hook_index_array(Scene *scene, Object *obedit, int *tot, int *
 		case OB_MESH:
 		{
 			Mesh *me= obedit->data;
-			EditMesh *em;
 
-			load_editMesh(scene, obedit);
-			make_editMesh(scene, obedit);
+			BMEditMesh *em;
 
-			em = BKE_mesh_get_editmesh(me);
+			EDBM_mesh_load(obedit);
+			EDBM_mesh_make(scene->toolsettings, scene, obedit);
+
+			em = me->edit_btmesh;
 
 			/* check selected vertices first */
-			if( return_editmesh_indexar(em, tot, indexar, cent_r)) {
-				BKE_mesh_end_editmesh(me, em);
+			if ( return_editmesh_indexar(em, tot, indexar, cent_r)) {
 				return 1;
-			} else {
+			}
+			else {
 				int ret = return_editmesh_vgroup(obedit, em, name, cent_r);
-				BKE_mesh_end_editmesh(me, em);
 				return ret;
 			}
 		}
@@ -338,24 +343,24 @@ static void select_editcurve_hook(Object *obedit, HookModifierData *hmd)
 	BezTriple *bezt;
 	int index=0, a, nr=0;
 	
-	for(nu= editnurb->first; nu; nu= nu->next) {
-		if(nu->type == CU_BEZIER) {
+	for (nu= editnurb->first; nu; nu= nu->next) {
+		if (nu->type == CU_BEZIER) {
 			bezt= nu->bezt;
 			a= nu->pntsu;
-			while(a--) {
-				if(nr == hmd->indexar[index]) {
+			while (a--) {
+				if (nr == hmd->indexar[index]) {
 					bezt->f1 |= SELECT;
-					if(index<hmd->totindex-1) index++;
+					if (index<hmd->totindex-1) index++;
 				}
 				nr++;
-				if(nr == hmd->indexar[index]) {
+				if (nr == hmd->indexar[index]) {
 					bezt->f2 |= SELECT;
-					if(index<hmd->totindex-1) index++;
+					if (index<hmd->totindex-1) index++;
 				}
 				nr++;
-				if(nr == hmd->indexar[index]) {
+				if (nr == hmd->indexar[index]) {
 					bezt->f3 |= SELECT;
-					if(index<hmd->totindex-1) index++;
+					if (index<hmd->totindex-1) index++;
 				}
 				nr++;
 				
@@ -365,10 +370,10 @@ static void select_editcurve_hook(Object *obedit, HookModifierData *hmd)
 		else {
 			bp= nu->bp;
 			a= nu->pntsu*nu->pntsv;
-			while(a--) {
-				if(nr == hmd->indexar[index]) {
+			while (a--) {
+				if (nr == hmd->indexar[index]) {
 					bp->f1 |= SELECT;
-					if(index<hmd->totindex-1) index++;
+					if (index<hmd->totindex-1) index++;
 				}
 				nr++;
 				bp++;
@@ -382,10 +387,10 @@ static void object_hook_select(Object *ob, HookModifierData *hmd)
 	if (hmd->indexar == NULL)
 		return;
 	
-	if(ob->type==OB_MESH) select_editmesh_hook(ob, hmd);
-	else if(ob->type==OB_LATTICE) select_editlattice_hook(ob, hmd);
-	else if(ob->type==OB_CURVE) select_editcurve_hook(ob, hmd);
-	else if(ob->type==OB_SURF) select_editcurve_hook(ob, hmd);
+	if (ob->type==OB_MESH) select_editbmesh_hook(ob, hmd);
+	else if (ob->type==OB_LATTICE) select_editlattice_hook(ob, hmd);
+	else if (ob->type==OB_CURVE) select_editcurve_hook(ob, hmd);
+	else if (ob->type==OB_SURF) select_editcurve_hook(ob, hmd);
 }
 
 /* special poll operators for hook operators */
@@ -501,16 +506,16 @@ static int object_add_hook_selob_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_hook_add_selobj(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Hook to Selected Object";
-	ot->description= "Hook selected vertices to the first selected Object";
-	ot->idname= "OBJECT_OT_hook_add_selob";
+	ot->name = "Hook to Selected Object";
+	ot->description = "Hook selected vertices to the first selected Object";
+	ot->idname = "OBJECT_OT_hook_add_selob";
 	
 	/* api callbacks */
-	ot->exec= object_add_hook_selob_exec;
-	ot->poll= hook_op_edit_poll;
+	ot->exec = object_add_hook_selob_exec;
+	ot->poll = hook_op_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int object_add_hook_newob_exec(bContext *C, wmOperator *UNUSED(op))
@@ -529,16 +534,16 @@ static int object_add_hook_newob_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_hook_add_newobj(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Hook to New Object";
-	ot->description= "Hook selected vertices to the first selected Object";
-	ot->idname= "OBJECT_OT_hook_add_newob";
+	ot->name = "Hook to New Object";
+	ot->description = "Hook selected vertices to the first selected Object";
+	ot->idname = "OBJECT_OT_hook_add_newob";
 	
 	/* api callbacks */
-	ot->exec= object_add_hook_newob_exec;
-	ot->poll= hook_op_edit_poll;
+	ot->exec = object_add_hook_newob_exec;
+	ot->poll = hook_op_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int object_hook_remove_exec(bContext *C, wmOperator *op)
@@ -574,10 +579,10 @@ static EnumPropertyItem *hook_mod_itemf(bContext *C, PointerRNA *UNUSED(ptr), Pr
 	ModifierData *md = NULL;
 	int a, totitem= 0;
 	
-	if(!ob)
+	if (!ob)
 		return DummyRNA_NULL_items;
 	
-	for(a=0, md=ob->modifiers.first; md; md= md->next, a++) {
+	for (a=0, md=ob->modifiers.first; md; md= md->next, a++) {
 		if (md->type==eModifierType_Hook) {
 			tmp.value= a;
 			tmp.icon = ICON_HOOK;
@@ -598,24 +603,24 @@ void OBJECT_OT_hook_remove(wmOperatorType *ot)
 	PropertyRNA *prop;
 	
 	/* identifiers */
-	ot->name= "Remove Hook";
-	ot->idname= "OBJECT_OT_hook_remove";
-	ot->description= "Remove a hook from the active object";
+	ot->name = "Remove Hook";
+	ot->idname = "OBJECT_OT_hook_remove";
+	ot->description = "Remove a hook from the active object";
 	
 	/* api callbacks */
-	ot->exec= object_hook_remove_exec;
-	ot->invoke= WM_menu_invoke;
-	ot->poll= hook_op_edit_poll;
+	ot->exec = object_hook_remove_exec;
+	ot->invoke = WM_menu_invoke;
+	ot->poll = hook_op_edit_poll;
 	
 	/* flags */
 	/* this operator removes modifier which isn't stored in local undo stack,
-	   so redoing it from redo panel gives totally weird results  */
-	ot->flag= /*OPTYPE_REGISTER|*/OPTYPE_UNDO;
+	 * so redoing it from redo panel gives totally weird results  */
+	ot->flag = /*OPTYPE_REGISTER|*/OPTYPE_UNDO;
 	
 	/* properties */
 	prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to remove");
 	RNA_def_enum_funcs(prop, hook_mod_itemf);
-	ot->prop= prop;
+	ot->prop = prop;
 }
 
 static int object_hook_reset_exec(bContext *C, wmOperator *op)
@@ -639,10 +644,10 @@ static int object_hook_reset_exec(bContext *C, wmOperator *op)
 	}
 	
 	/* reset functionality */
-	if(hmd->object) {
+	if (hmd->object) {
 		bPoseChannel *pchan= get_pose_channel(hmd->object->pose, hmd->subtarget);
 		
-		if(hmd->subtarget[0] && pchan) {
+		if (hmd->subtarget[0] && pchan) {
 			float imat[4][4], mat[4][4];
 			
 			/* calculate the world-space matrix for the pose-channel target first, then carry on as usual */
@@ -668,16 +673,16 @@ void OBJECT_OT_hook_reset(wmOperatorType *ot)
 	PropertyRNA *prop;
 	
 	/* identifiers */
-	ot->name= "Reset Hook";
-	ot->description= "Recalculate and clear offset transformation";
-	ot->idname= "OBJECT_OT_hook_reset";
+	ot->name = "Reset Hook";
+	ot->description = "Recalculate and clear offset transformation";
+	ot->idname = "OBJECT_OT_hook_reset";
 	
 	/* callbacks */
-	ot->exec= object_hook_reset_exec;
-	ot->poll= hook_op_edit_poll;
+	ot->exec = object_hook_reset_exec;
+	ot->poll = hook_op_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to");
@@ -724,16 +729,16 @@ void OBJECT_OT_hook_recenter(wmOperatorType *ot)
 	PropertyRNA *prop;
 	
 	/* identifiers */
-	ot->name= "Recenter Hook";
-	ot->description= "Set hook center to cursor position";
-	ot->idname= "OBJECT_OT_hook_recenter";
+	ot->name = "Recenter Hook";
+	ot->description = "Set hook center to cursor position";
+	ot->idname = "OBJECT_OT_hook_recenter";
 	
 	/* callbacks */
-	ot->exec= object_hook_recenter_exec;
-	ot->poll= hook_op_edit_poll;
+	ot->exec = object_hook_recenter_exec;
+	ot->poll = hook_op_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to");
@@ -742,6 +747,7 @@ void OBJECT_OT_hook_recenter(wmOperatorType *ot)
 
 static int object_hook_assign_exec(bContext *C, wmOperator *op)
 {
+	Scene *scene= CTX_data_scene(C);
 	PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_HookModifier);
 	int num= RNA_enum_get(op->ptr, "modifier");
 	Object *ob=NULL;
@@ -765,11 +771,11 @@ static int object_hook_assign_exec(bContext *C, wmOperator *op)
 	
 	/* assign functionality */
 	
-	if(!object_hook_index_array(CTX_data_scene(C), ob, &tot, &indexar, name, cent)) {
+	if (!object_hook_index_array(scene, ob, &tot, &indexar, name, cent)) {
 		BKE_report(op->reports, RPT_WARNING, "Requires selected vertices or active vertex group");
 		return OPERATOR_CANCELLED;
 	}
-	if(hmd->indexar)
+	if (hmd->indexar)
 		MEM_freeN(hmd->indexar);
 	
 	copy_v3_v3(hmd->cent, cent);
@@ -787,18 +793,18 @@ void OBJECT_OT_hook_assign(wmOperatorType *ot)
 	PropertyRNA *prop;
 	
 	/* identifiers */
-	ot->name= "Assign to Hook";
-	ot->description= "Assign the selected vertices to a hook";
-	ot->idname= "OBJECT_OT_hook_assign";
+	ot->name = "Assign to Hook";
+	ot->description = "Assign the selected vertices to a hook";
+	ot->idname = "OBJECT_OT_hook_assign";
 	
 	/* callbacks */
-	ot->exec= object_hook_assign_exec;
-	ot->poll= hook_op_edit_poll;
+	ot->exec = object_hook_assign_exec;
+	ot->poll = hook_op_edit_poll;
 	
 	/* flags */
 	/* this operator changes data stored in modifier which doesn't get pushed to undo stack,
-	   so redoing it from redo panel gives totally weird results  */
-	ot->flag= /*OPTYPE_REGISTER|*/OPTYPE_UNDO;
+	 * so redoing it from redo panel gives totally weird results  */
+	ot->flag = /*OPTYPE_REGISTER|*/OPTYPE_UNDO;
 	
 	/* properties */
 	prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to");
@@ -838,16 +844,16 @@ void OBJECT_OT_hook_select(wmOperatorType *ot)
 	PropertyRNA *prop;
 	
 	/* identifiers */
-	ot->name= "Select Hook";
-	ot->description= "Select affected vertices on mesh";
-	ot->idname= "OBJECT_OT_hook_select";
+	ot->name = "Select Hook";
+	ot->description = "Select affected vertices on mesh";
+	ot->idname = "OBJECT_OT_hook_select";
 	
 	/* callbacks */
-	ot->exec= object_hook_select_exec;
-	ot->poll= hook_op_edit_poll;
+	ot->exec = object_hook_select_exec;
+	ot->poll = hook_op_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to remove");
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index 7f416fe..b1738a9 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -28,8 +28,8 @@
  *  \ingroup edobj
  */
 
-#ifndef ED_OBJECT_INTERN_H
-#define ED_OBJECT_INTERN_H
+#ifndef __OBJECT_INTERN_H__
+#define __OBJECT_INTERN_H__
 
 struct wmOperatorType;
 struct KeyBlock;
@@ -214,6 +214,7 @@ void OBJECT_OT_vertex_group_move(struct wmOperatorType *ot);
 void OBJECT_OT_shape_key_add(struct wmOperatorType *ot);
 void OBJECT_OT_shape_key_remove(struct wmOperatorType *ot);
 void OBJECT_OT_shape_key_clear(struct wmOperatorType *ot);
+void OBJECT_OT_shape_key_retime(struct wmOperatorType *ot);
 void OBJECT_OT_shape_key_mirror(struct wmOperatorType *ot);
 void OBJECT_OT_shape_key_move(struct wmOperatorType *ot);
 
@@ -225,5 +226,5 @@ void OBJECT_OT_group_remove(struct wmOperatorType *ot);
 /* object_bake.c */
 void OBJECT_OT_bake_image(wmOperatorType *ot);
 
-#endif /* ED_OBJECT_INTERN_H */
+#endif /* __OBJECT_INTERN_H__ */
 
diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c
index cac167a..4ba6254 100644
--- a/source/blender/editors/object/object_lattice.c
+++ b/source/blender/editors/object/object_lattice.c
@@ -70,12 +70,12 @@ void free_editLatt(Object *ob)
 {
 	Lattice *lt= ob->data;
 	
-	if(lt->editlatt) {
+	if (lt->editlatt) {
 		Lattice *editlt= lt->editlatt->latt;
 
-		if(editlt->def)
+		if (editlt->def)
 			MEM_freeN(editlt->def);
-		if(editlt->dvert)
+		if (editlt->dvert)
 			free_dverts(editlt->dvert, editlt->pntsu*editlt->pntsv*editlt->pntsw);
 
 		MEM_freeN(editlt);
@@ -93,20 +93,20 @@ void make_editLatt(Object *obedit)
 	free_editLatt(obedit);
 
 	actkey= ob_get_keyblock(obedit);
-	if(actkey)
+	if (actkey)
 		key_to_latt(actkey, lt);
 
 	lt->editlatt= MEM_callocN(sizeof(EditLatt), "editlatt");
 	lt->editlatt->latt= MEM_dupallocN(lt);
 	lt->editlatt->latt->def= MEM_dupallocN(lt->def);
 
-	if(lt->dvert) {
+	if (lt->dvert) {
 		int tot= lt->pntsu*lt->pntsv*lt->pntsw;
 		lt->editlatt->latt->dvert = MEM_mallocN (sizeof (MDeformVert)*tot, "Lattice MDeformVert");
 		copy_dverts(lt->editlatt->latt->dvert, lt->dvert, tot);
 	}
 
-	if(lt->key) lt->editlatt->shapenr= obedit->shapenr;
+	if (lt->key) lt->editlatt->shapenr= obedit->shapenr;
 }
 
 void load_editLatt(Object *obedit)
@@ -120,19 +120,19 @@ void load_editLatt(Object *obedit)
 	lt= obedit->data;
 	editlt= lt->editlatt->latt;
 
-	if(lt->editlatt->shapenr) {
+	if (lt->editlatt->shapenr) {
 		actkey= BLI_findlink(&lt->key->block, lt->editlatt->shapenr-1);
 
 		/* active key: vertices */
 		tot= editlt->pntsu*editlt->pntsv*editlt->pntsw;
 		
-		if(actkey->data) MEM_freeN(actkey->data);
+		if (actkey->data) MEM_freeN(actkey->data);
 		
 		fp=actkey->data= MEM_callocN(lt->key->elemsize*tot, "actkey->data");
 		actkey->totelem= tot;
 
 		bp= editlt->def;
-		while(tot--) {
+		while (tot--) {
 			copy_v3_v3(fp, bp->vec);
 			fp+= 3;
 			bp++;
@@ -154,12 +154,12 @@ void load_editLatt(Object *obedit)
 		lt->typew= editlt->typew;
 	}
 
-	if(lt->dvert) {
+	if (lt->dvert) {
 		free_dverts(lt->dvert, lt->pntsu*lt->pntsv*lt->pntsw);
 		lt->dvert= NULL;
 	}
 
-	if(editlt->dvert) {
+	if (editlt->dvert) {
 		tot= lt->pntsu*lt->pntsv*lt->pntsw;
 
 		lt->dvert = MEM_mallocN (sizeof (MDeformVert)*tot, "Lattice MDeformVert");
@@ -179,8 +179,8 @@ void ED_setflagsLatt(Object *obedit, int flag)
 	
 	a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
 	
-	while(a--) {
-		if(bp->hide==0) {
+	while (a--) {
+		if (bp->hide==0) {
 			bp->f1= flag;
 		}
 		bp++;
@@ -201,9 +201,9 @@ static int lattice_select_all_exec(bContext *C, wmOperator *op)
 		bp= lt->editlatt->latt->def;
 		a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
 
-		while(a--) {
-			if(bp->hide==0) {
-				if(bp->f1) {
+		while (a--) {
+			if (bp->hide==0) {
+				if (bp->f1) {
 					action = SEL_DESELECT;
 					break;
 				}
@@ -223,8 +223,8 @@ static int lattice_select_all_exec(bContext *C, wmOperator *op)
 		bp= lt->editlatt->latt->def;
 		a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
 
-		while(a--) {
-			if(bp->hide==0) {
+		while (a--) {
+			if (bp->hide==0) {
 				bp->f1 ^= 1;
 			}
 			bp++;
@@ -240,16 +240,16 @@ static int lattice_select_all_exec(bContext *C, wmOperator *op)
 void LATTICE_OT_select_all(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select or Deselect All";
-	ot->description= "Change selection of all UVW control points";
-	ot->idname= "LATTICE_OT_select_all";
+	ot->name = "(De)select All";
+	ot->description = "Change selection of all UVW control points";
+	ot->idname = "LATTICE_OT_select_all";
 	
 	/* api callbacks */
-	ot->exec= lattice_select_all_exec;
-	ot->poll= ED_operator_editlattice;
+	ot->exec = lattice_select_all_exec;
+	ot->poll = ED_operator_editlattice;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	WM_operator_properties_select_all(ot);
 }
@@ -258,7 +258,7 @@ static int make_regular_poll(bContext *C)
 {
 	Object *ob;
 
-	if(ED_operator_editlattice(C)) return 1;
+	if (ED_operator_editlattice(C)) return 1;
 
 	ob= CTX_data_active_object(C);
 	return (ob && ob->type==OB_LATTICE);
@@ -269,7 +269,7 @@ static int make_regular_exec(bContext *C, wmOperator *UNUSED(op))
 	Object *ob= CTX_data_edit_object(C);
 	Lattice *lt;
 	
-	if(ob) {
+	if (ob) {
 		lt= ob->data;
 		resizelattice(lt->editlatt->latt, lt->pntsu, lt->pntsv, lt->pntsw, NULL);
 	}
@@ -288,16 +288,16 @@ static int make_regular_exec(bContext *C, wmOperator *UNUSED(op))
 void LATTICE_OT_make_regular(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Make Regular";
-	ot->description= "Set UVW control points a uniform distance apart";
-	ot->idname= "LATTICE_OT_make_regular";
+	ot->name = "Make Regular";
+	ot->description = "Set UVW control points a uniform distance apart";
+	ot->idname = "LATTICE_OT_make_regular";
 	
 	/* api callbacks */
-	ot->exec= make_regular_exec;
-	ot->poll= make_regular_poll;
+	ot->exec = make_regular_exec;
+	ot->poll = make_regular_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /****************************** Mouse Selection *************************/
@@ -307,10 +307,10 @@ static void findnearestLattvert__doClosest(void *userData, BPoint *bp, int x, in
 	struct { BPoint *bp; short dist, select; int mval[2]; } *data = userData;
 	float temp = abs(data->mval[0]-x) + abs(data->mval[1]-y);
 	
-	if((bp->f1 & SELECT)==data->select)
+	if ((bp->f1 & SELECT)==data->select)
 		temp += 5;
 
-	if(temp<data->dist) {
+	if (temp<data->dist) {
 		data->dist = temp;
 
 		data->bp = bp;
@@ -343,8 +343,8 @@ int mouse_lattice(bContext *C, const int mval[2], int extend)
 	view3d_set_viewcontext(C, &vc);
 	bp= findnearestLattvert(&vc, mval, 1);
 
-	if(bp) {
-		if(extend==0) {
+	if (bp) {
+		if (extend==0) {
 			ED_setflagsLatt(vc.obedit, 0);
 			bp->f1 |= SELECT;
 		}
@@ -366,7 +366,7 @@ typedef struct UndoLattice {
 	int pntsu, pntsv, pntsw;
 } UndoLattice;
 
-static void undoLatt_to_editLatt(void *data, void *edata)
+static void undoLatt_to_editLatt(void *data, void *edata, void *UNUSED(obdata))
 {
 	UndoLattice *ult= (UndoLattice*)data;
 	EditLatt *editlatt= (EditLatt *)edata;
@@ -375,7 +375,7 @@ static void undoLatt_to_editLatt(void *data, void *edata)
 	memcpy(editlatt->latt->def, ult->def, a*sizeof(BPoint));
 }
 
-static void *editLatt_to_undoLatt(void *edata)
+static void *editLatt_to_undoLatt(void *edata, void *UNUSED(obdata))
 {
 	UndoLattice *ult= MEM_callocN(sizeof(UndoLattice), "UndoLattice");
 	EditLatt *editlatt= (EditLatt *)edata;
@@ -392,7 +392,7 @@ static void free_undoLatt(void *data)
 {
 	UndoLattice *ult= (UndoLattice*)data;
 
-	if(ult->def) MEM_freeN(ult->def);
+	if (ult->def) MEM_freeN(ult->def);
 	MEM_freeN(ult);
 }
 
@@ -410,7 +410,7 @@ static void *get_editlatt(bContext *C)
 {
 	Object *obedit= CTX_data_edit_object(C);
 
-	if(obedit && obedit->type==OB_LATTICE) {
+	if (obedit && obedit->type==OB_LATTICE) {
 		Lattice *lt= obedit->data;
 		return lt->editlatt;
 	}
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index ed5899d..cd2fa4f 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -46,7 +46,6 @@
 #include "BLI_listbase.h"
 #include "BLI_string.h"
 #include "BLI_path_util.h"
-#include "BLI_editVert.h"
 #include "BLI_utildefines.h"
 
 #include "BKE_animsys.h"
@@ -68,6 +67,7 @@
 #include "BKE_ocean.h"
 #include "BKE_particle.h"
 #include "BKE_softbody.h"
+#include "BKE_tessmesh.h"
 
 #include "RNA_access.h"
 #include "RNA_define.h"
@@ -91,19 +91,19 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc
 	ModifierTypeInfo *mti = modifierType_getInfo(type);
 	
 	/* only geometry objects should be able to get modifiers [#25291] */
-	if(!ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_LATTICE)) {
+	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);
 		return NULL;
 	}
 	
-	if(mti->flags&eModifierTypeFlag_Single) {
-		if(modifiers_findByType(ob, type)) {
+	if (mti->flags&eModifierTypeFlag_Single) {
+		if (modifiers_findByType(ob, type)) {
 			BKE_report(reports, RPT_WARNING, "Only one modifier of this type allowed");
 			return NULL;
 		}
 	}
 	
-	if(type == eModifierType_ParticleSystem) {
+	if (type == eModifierType_ParticleSystem) {
 		/* don't need to worry about the new modifier's name, since that is set to the number
 		 * of particle systems which shouldn't have too many duplicates 
 		 */
@@ -113,10 +113,10 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc
 		/* get new modifier data to add */
 		new_md= modifier_new(type);
 		
-		if(mti->flags&eModifierTypeFlag_RequiresOriginalData) {
+		if (mti->flags&eModifierTypeFlag_RequiresOriginalData) {
 			md = ob->modifiers.first;
 			
-			while(md && modifierType_getInfo(md->type)->type==eModifierTypeType_OnlyDeform)
+			while (md && modifierType_getInfo(md->type)->type==eModifierTypeType_OnlyDeform)
 				md = md->next;
 			
 			BLI_insertlinkbefore(&ob->modifiers, md, new_md);
@@ -124,7 +124,7 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc
 		else
 			BLI_addtail(&ob->modifiers, new_md);
 
-		if(name)
+		if (name)
 			BLI_strncpy(new_md->name, name, sizeof(new_md->name));
 
 		/* make sure modifier data has unique name */
@@ -132,22 +132,22 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc
 		modifier_unique_name(&ob->modifiers, new_md);
 		
 		/* special cases */
-		if(type == eModifierType_Softbody) {
-			if(!ob->soft) {
+		if (type == eModifierType_Softbody) {
+			if (!ob->soft) {
 				ob->soft= sbNew(scene);
 				ob->softflag |= OB_SB_GOAL|OB_SB_EDGES;
 			}
 		}
-		else if(type == eModifierType_Collision) {
-			if(!ob->pd)
+		else if (type == eModifierType_Collision) {
+			if (!ob->pd)
 				ob->pd= object_add_collision_fields(0);
 			
 			ob->pd->deflect= 1;
 			DAG_scene_sort(bmain, scene);
 		}
-		else if(type == eModifierType_Surface)
+		else if (type == eModifierType_Surface)
 			DAG_scene_sort(bmain, scene);
-		else if(type == eModifierType_Multires)
+		else if (type == eModifierType_Multires)
 			/* set totlvl from existing MDISPS layer if object already had it */
 			multiresModifier_set_levels_from_disps((MultiresModifierData *)new_md, ob);
 	}
@@ -164,70 +164,60 @@ static int object_modifier_remove(Object *ob, ModifierData *md, int *sort_depsgr
 	/* It seems on rapid delete it is possible to
 	 * get called twice on same modifier, so make
 	 * sure it is in list. */
-	for(obmd=ob->modifiers.first; obmd; obmd=obmd->next)
-		if(obmd==md)
+	for (obmd=ob->modifiers.first; obmd; obmd=obmd->next)
+		if (obmd==md)
 			break;
 
-	if(!obmd)
+	if (!obmd)
 		return 0;
 
 	/* special cases */
-	if(md->type == eModifierType_ParticleSystem) {
+	if (md->type == eModifierType_ParticleSystem) {
 		ParticleSystemModifierData *psmd=(ParticleSystemModifierData*)md;
 
 		BLI_remlink(&ob->particlesystem, psmd->psys);
 		psys_free(ob, psmd->psys);
 		psmd->psys= NULL;
 	}
-	else if(md->type == eModifierType_Softbody) {
-		if(ob->soft) {
+	else if (md->type == eModifierType_Softbody) {
+		if (ob->soft) {
 			sbFree(ob->soft);
 			ob->soft= NULL;
 			ob->softflag= 0;
 		}
 	}
-	else if(md->type == eModifierType_Collision) {
-		if(ob->pd)
+	else if (md->type == eModifierType_Collision) {
+		if (ob->pd)
 			ob->pd->deflect= 0;
 
 		*sort_depsgraph = 1;
 	}
-	else if(md->type == eModifierType_Surface) {
-		if(ob->pd && ob->pd->shape == PFIELD_SHAPE_SURFACE)
+	else if (md->type == eModifierType_Surface) {
+		if (ob->pd && ob->pd->shape == PFIELD_SHAPE_SURFACE)
 			ob->pd->shape = PFIELD_SHAPE_PLANE;
 
 		*sort_depsgraph = 1;
 	}
-	else if(md->type == eModifierType_Smoke) {
+	else if (md->type == eModifierType_Smoke) {
 		ob->dt = OB_TEXTURE;
 	}
-	else if(md->type == eModifierType_Multires) {
+	else if (md->type == eModifierType_Multires) {
 		int ok= 1;
-		Mesh *me= ob->data;
 		ModifierData *tmpmd;
 
-		/* ensure MDISPS CustomData layer is't used by another multires modifiers */
-		for(tmpmd= ob->modifiers.first; tmpmd; tmpmd= tmpmd->next)
-			if(tmpmd!=md && tmpmd->type == eModifierType_Multires) {
+		/* ensure MDISPS CustomData layer isn't used by another multires modifiers */
+		for (tmpmd= ob->modifiers.first; tmpmd; tmpmd= tmpmd->next)
+			if (tmpmd!=md && tmpmd->type == eModifierType_Multires) {
 				ok= 0;
 				break;
 			}
 
-		if(ok) {
-			if(me->edit_mesh) {
-				EditMesh *em= me->edit_mesh;
-				/* CustomData_external_remove is used here only to mark layer as non-external
-				   for further free-ing, so zero element count looks safer than em->totface */
-				CustomData_external_remove(&em->fdata, &me->id, CD_MDISPS, 0);
-				EM_free_data_layer(em, &em->fdata, CD_MDISPS);
-			} else {
-				CustomData_external_remove(&me->fdata, &me->id, CD_MDISPS, me->totface);
-				CustomData_free_layer_active(&me->fdata, CD_MDISPS, me->totface);
-			}
+		if (ok) {
+			multires_customdata_delete(ob->data);
 		}
 	}
 
-	if(ELEM(md->type, eModifierType_Softbody, eModifierType_Cloth) &&
+	if (ELEM(md->type, eModifierType_Softbody, eModifierType_Cloth) &&
 		ob->particlesystem.first == NULL) {
 		ob->mode &= ~OB_MODE_PARTICLE_EDIT;
 	}
@@ -245,7 +235,7 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob
 
 	ok= object_modifier_remove(ob, md, &sort_depsgraph);
 
-	if(!ok) {
+	if (!ok) {
 		BKE_reportf(reports, RPT_ERROR, "Modifier '%s' not in object '%s'", ob->id.name, md->name);
 		return 0;
 	}
@@ -253,7 +243,7 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 
 	/* sorting has to be done after the update so that dynamic systems can react properly */
-	if(sort_depsgraph)
+	if (sort_depsgraph)
 		DAG_scene_sort(bmain, scene);
 
 	return 1;
@@ -261,13 +251,13 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob
 
 void ED_object_modifier_clear(Main *bmain, Scene *scene, Object *ob)
 {
-	ModifierData *md =ob->modifiers.first;
+	ModifierData *md = ob->modifiers.first;
 	int sort_depsgraph = 0;
 
-	if(!md)
+	if (!md)
 		return;
 
-	while(md) {
+	while (md) {
 		ModifierData *next_md;
 
 		next_md= md->next;
@@ -280,19 +270,19 @@ void ED_object_modifier_clear(Main *bmain, Scene *scene, Object *ob)
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 
 	/* sorting has to be done after the update so that dynamic systems can react properly */
-	if(sort_depsgraph)
+	if (sort_depsgraph)
 		DAG_scene_sort(bmain, scene);
 }
 
 int ED_object_modifier_move_up(ReportList *reports, Object *ob, ModifierData *md)
 {
-	if(md->prev) {
+	if (md->prev) {
 		ModifierTypeInfo *mti = modifierType_getInfo(md->type);
 
-		if(mti->type!=eModifierTypeType_OnlyDeform) {
+		if (mti->type!=eModifierTypeType_OnlyDeform) {
 			ModifierTypeInfo *nmti = modifierType_getInfo(md->prev->type);
 
-			if(nmti->flags&eModifierTypeFlag_RequiresOriginalData) {
+			if (nmti->flags&eModifierTypeFlag_RequiresOriginalData) {
 				BKE_report(reports, RPT_WARNING, "Cannot move above a modifier requiring original data");
 				return 0;
 			}
@@ -307,13 +297,13 @@ int ED_object_modifier_move_up(ReportList *reports, Object *ob, ModifierData *md
 
 int ED_object_modifier_move_down(ReportList *reports, Object *ob, ModifierData *md)
 {
-	if(md->next) {
+	if (md->next) {
 		ModifierTypeInfo *mti = modifierType_getInfo(md->type);
 
-		if(mti->flags&eModifierTypeFlag_RequiresOriginalData) {
+		if (mti->flags&eModifierTypeFlag_RequiresOriginalData) {
 			ModifierTypeInfo *nmti = modifierType_getInfo(md->next->type);
 
-			if(nmti->type!=eModifierTypeType_OnlyDeform) {
+			if (nmti->type!=eModifierTypeType_OnlyDeform) {
 				BKE_report(reports, RPT_WARNING, "Cannot move beyond a non-deforming modifier");
 				return 0;
 			}
@@ -339,43 +329,43 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *
 	int totvert=0, totedge=0, cvert=0;
 	int totpart=0, totchild=0;
 
-	if(md->type != eModifierType_ParticleSystem) return 0;
-	if(ob && ob->mode & OB_MODE_PARTICLE_EDIT) return 0;
+	if (md->type != eModifierType_ParticleSystem) return 0;
+	if (ob && ob->mode & OB_MODE_PARTICLE_EDIT) return 0;
 
 	psys=((ParticleSystemModifierData *)md)->psys;
 	part= psys->part;
 
-	if(part->ren_as != PART_DRAW_PATH || psys->pathcache == NULL)
+	if (part->ren_as != PART_DRAW_PATH || psys->pathcache == NULL)
 		return 0;
 
 	totpart= psys->totcached;
 	totchild= psys->totchildcache;
 
-	if(totchild && (part->draw&PART_DRAW_PARENT)==0)
+	if (totchild && (part->draw&PART_DRAW_PARENT)==0)
 		totpart= 0;
 
 	/* count */
 	cache= psys->pathcache;
-	for(a=0; a<totpart; a++) {
+	for (a=0; a<totpart; a++) {
 		key= cache[a];
 
-		if(key->steps > 0) {
+		if (key->steps > 0) {
 			totvert+= key->steps+1;
 			totedge+= key->steps;
 		}
 	}
 
 	cache= psys->childcache;
-	for(a=0; a<totchild; a++) {
+	for (a=0; a<totchild; a++) {
 		key= cache[a];
 
-		if(key->steps > 0) {
+		if (key->steps > 0) {
 			totvert+= key->steps+1;
 			totedge+= key->steps;
 		}
 	}
 
-	if(totvert==0) return 0;
+	if (totvert==0) return 0;
 
 	/* add new mesh */
 	obn= add_object(scene, OB_MESH);
@@ -393,12 +383,12 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *
 
 	/* copy coordinates */
 	cache= psys->pathcache;
-	for(a=0; a<totpart; a++) {
+	for (a=0; a<totpart; a++) {
 		key= cache[a];
 		kmax= key->steps;
-		for(k=0; k<=kmax; k++,key++,cvert++,mvert++) {
+		for (k=0; k<=kmax; k++,key++,cvert++,mvert++) {
 			copy_v3_v3(mvert->co,key->co);
-			if(k) {
+			if (k) {
 				medge->v1= cvert-1;
 				medge->v2= cvert;
 				medge->flag= ME_EDGEDRAW|ME_EDGERENDER|ME_LOOSEEDGE;
@@ -412,12 +402,12 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *
 	}
 
 	cache=psys->childcache;
-	for(a=0; a<totchild; a++) {
+	for (a=0; a<totchild; a++) {
 		key=cache[a];
 		kmax=key->steps;
-		for(k=0; k<=kmax; k++,key++,cvert++,mvert++) {
+		for (k=0; k<=kmax; k++,key++,cvert++,mvert++) {
 			copy_v3_v3(mvert->co,key->co);
-			if(k) {
+			if (k) {
 				medge->v1=cvert-1;
 				medge->v2=cvert;
 				medge->flag= ME_EDGEDRAW|ME_EDGERENDER|ME_LOOSEEDGE;
@@ -446,28 +436,39 @@ static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, M
 		return 0;
 	}
 
+	/*
+	 * It should be ridiculously easy to extract the original verts that we want
+	 * and form the shape data.  We can probably use the CD KEYINDEX layer (or
+	 * whatever I ended up calling it, too tired to check now), though this would
+	 * by necessity have to make some potentially ugly assumptions about the order
+	 * of the mesh data :-/  you can probably assume in 99% of cases that the first
+	 * element of a given index is the original, and any subsequent duplicates are
+	 * copies/interpolates, but that's an assumption that would need to be tested
+	 * and then predominantly stated in comments in a half dozen headers.
+	 */
+
 	if (ob->type==OB_MESH) {
 		DerivedMesh *dm;
 		Mesh *me= ob->data;
 		Key *key=me->key;
 		KeyBlock *kb;
 		
-		if(!modifier_sameTopology(md) || mti->type == eModifierTypeType_NonGeometrical) {
+		if (!modifier_sameTopology(md) || mti->type == eModifierTypeType_NonGeometrical) {
 			BKE_report(reports, RPT_ERROR, "Only deforming modifiers can be applied to Shapes");
 			return 0;
 		}
 		
-		dm = mesh_create_derived_for_modifier(scene, ob, md);
+		dm = mesh_create_derived_for_modifier(scene, ob, md, 0);
 		if (!dm) {
 			BKE_report(reports, RPT_ERROR, "Modifier is disabled or returned error, skipping apply");
 			return 0;
 		}
 		
-		if(key == NULL) {
+		if (key == NULL) {
 			key= me->key= add_key((ID *)me);
 			key->type= KEY_RELATIVE;
 			/* if that was the first key block added, then it was the basis.
-			 * Initialise it with the mesh, and add another for the modifier */
+			 * Initialize it with the mesh, and add another for the modifier */
 			kb= add_keyblock(key, NULL);
 			mesh_to_key(me, kb);
 		}
@@ -500,35 +501,34 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
 		Mesh *me = ob->data;
 		MultiresModifierData *mmd= find_multires_modifier_before(scene, md);
 
-		if(me->key && mti->type != eModifierTypeType_NonGeometrical) {
+		if (me->key && mti->type != eModifierTypeType_NonGeometrical) {
 			BKE_report(reports, RPT_ERROR, "Modifier cannot be applied to Mesh with Shape Keys");
 			return 0;
 		}
 
 		/* Multires: ensure that recent sculpting is applied */
-		if(md->type == eModifierType_Multires)
+		if (md->type == eModifierType_Multires)
 			multires_force_update(ob);
 
 		if (mmd && mmd->totlvl && mti->type==eModifierTypeType_OnlyDeform) {
-			if(!multiresModifier_reshapeFromDeformMod (scene, mmd, ob, md)) {
+			if (!multiresModifier_reshapeFromDeformMod (scene, mmd, ob, md)) {
 				BKE_report(reports, RPT_ERROR, "Multires modifier returned error, skipping apply");
 				return 0;
 			}
-		} else {
-			dm = mesh_create_derived_for_modifier(scene, ob, md);
+		}
+		else {
+			dm = mesh_create_derived_for_modifier(scene, ob, md, 1);
 			if (!dm) {
 				BKE_report(reports, RPT_ERROR, "Modifier returned error, skipping apply");
 				return 0;
 			}
 
-			DM_to_mesh(dm, me);
+			DM_to_mesh(dm, me, ob);
 
 			dm->release(dm);
 
-			if(md->type == eModifierType_Multires) {
-				CustomData_external_remove(&me->fdata, &me->id, CD_MDISPS, me->totface);
-				CustomData_free_layer_active(&me->fdata, CD_MDISPS, me->totface);
-			}
+			if (md->type == eModifierType_Multires)
+				multires_customdata_delete(me);
 		}
 	}
 	else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
@@ -542,7 +542,7 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
 		}
 
 		cu = ob->data;
-		BKE_report(reports, RPT_INFO, "Applied modifier only changed CV points, not tesselated/bevel vertices");
+		BKE_report(reports, RPT_INFO, "Applied modifier only changed CV points, not tessellated/bevel vertices");
 
 		vertexCos = curve_getVertexCos(cu, &cu->nurb, &numVerts);
 		mti->deformVerts(md, ob, NULL, vertexCos, numVerts, 0, 0);
@@ -558,13 +558,13 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
 	}
 
 	/* lattice modifier can be applied to particle system too */
-	if(ob->particlesystem.first) {
+	if (ob->particlesystem.first) {
 
 		ParticleSystem *psys = ob->particlesystem.first;
 
-		for(; psys; psys=psys->next) {
+		for (; psys; psys=psys->next) {
 			
-			if(psys->part->type != PART_HAIR)
+			if (psys->part->type != PART_HAIR)
 				continue;
 
 			psys_apply_hair_lattice(scene, ob, psys);
@@ -581,7 +581,8 @@ int ED_object_modifier_apply(ReportList *reports, Scene *scene, Object *ob, Modi
 	if (scene->obedit) {
 		BKE_report(reports, RPT_ERROR, "Modifiers cannot be applied in editmode");
 		return 0;
-	} else if (((ID*) ob->data)->us>1) {
+	}
+	else if (((ID*) ob->data)->us>1) {
 		BKE_report(reports, RPT_ERROR, "Modifiers cannot be applied to multi-user data");
 		return 0;
 	}
@@ -598,7 +599,8 @@ int ED_object_modifier_apply(ReportList *reports, Scene *scene, Object *ob, Modi
 			md->mode= prev_mode;
 			return 0;
 		}
-	} else {
+	}
+	else {
 		if (!modifier_apply_obdata(reports, scene, ob, md)) {
 			md->mode= prev_mode;
 			return 0;
@@ -632,7 +634,7 @@ static int modifier_add_exec(bContext *C, wmOperator *op)
 	Object *ob = ED_object_active_context(C);
 	int type= RNA_enum_get(op->ptr, "type");
 
-	if(!ED_object_modifier_add(op->reports, bmain, scene, ob, NULL, type))
+	if (!ED_object_modifier_add(op->reports, bmain, scene, ob, NULL, type))
 		return OPERATOR_CANCELLED;
 
 	WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
@@ -647,20 +649,19 @@ static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *UNUSED(ptr)
 	ModifierTypeInfo *mti;
 	int totitem= 0, a;
 	
-	if(!ob)
+	if (!ob)
 		return modifier_type_items;
 
-	for(a=0; modifier_type_items[a].identifier; a++) {
+	for (a=0; modifier_type_items[a].identifier; a++) {
 		md_item= &modifier_type_items[a];
 
-		if(md_item->identifier[0]) {
+		if (md_item->identifier[0]) {
 			mti= modifierType_getInfo(md_item->value);
 
-			if(mti->flags & eModifierTypeFlag_NoUserAdd)
+			if (mti->flags & eModifierTypeFlag_NoUserAdd)
 				continue;
 
-			if(!((mti->flags & eModifierTypeFlag_AcceptsCVs) ||
-			   (ob->type==OB_MESH && (mti->flags & eModifierTypeFlag_AcceptsMesh))))
+			if (!object_support_modifier_type(ob, md_item->value))
 				continue;
 		}
 		else {
@@ -670,7 +671,7 @@ static EnumPropertyItem *modifier_add_itemf(bContext *C, PointerRNA *UNUSED(ptr)
 			continue;
 		}
 
-		if(group_item) {
+		if (group_item) {
 			RNA_enum_item_add(&item, &totitem, group_item);
 			group_item= NULL;
 		}
@@ -689,22 +690,22 @@ void OBJECT_OT_modifier_add(wmOperatorType *ot)
 	PropertyRNA *prop;
 
 	/* identifiers */
-	ot->name= "Add Modifier";
+	ot->name = "Add Modifier";
 	ot->description = "Add a modifier to the active object";
-	ot->idname= "OBJECT_OT_modifier_add";
+	ot->idname = "OBJECT_OT_modifier_add";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= modifier_add_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = modifier_add_exec;
+	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", modifier_type_items, eModifierType_Subsurf, "Type", "");
 	RNA_def_enum_funcs(prop, modifier_add_itemf);
-	ot->prop= prop;
+	ot->prop = prop;
 }
 
 /************************ generic functions for operators using mod names and data context *********************/
@@ -772,15 +773,15 @@ static int modifier_remove_exec(bContext *C, wmOperator *op)
 	ModifierData *md = edit_modifier_property_get(op, ob, 0);
 	int mode_orig = ob ? ob->mode : 0;
 	
-	if(!ob || !md || !ED_object_modifier_remove(op->reports, bmain, scene, ob, md))
+	if (!ob || !md || !ED_object_modifier_remove(op->reports, bmain, scene, ob, md))
 		return OPERATOR_CANCELLED;
 
 	WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
 
 	/* if cloth/softbody was removed, particle mode could be cleared */
-	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);
 	
 	return OPERATOR_FINISHED;
@@ -796,16 +797,16 @@ static int modifier_remove_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e
 
 void OBJECT_OT_modifier_remove(wmOperatorType *ot)
 {
-	ot->name= "Remove Modifier";
-	ot->description= "Remove a modifier from the active object";
-	ot->idname= "OBJECT_OT_modifier_remove";
+	ot->name = "Remove Modifier";
+	ot->description = "Remove a modifier from the active object";
+	ot->idname = "OBJECT_OT_modifier_remove";
 
-	ot->invoke= modifier_remove_invoke;
-	ot->exec= modifier_remove_exec;
-	ot->poll= edit_modifier_poll;
+	ot->invoke = modifier_remove_invoke;
+	ot->exec = modifier_remove_exec;
+	ot->poll = edit_modifier_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	edit_modifier_properties(ot);
 }
 
@@ -816,7 +817,7 @@ static int modifier_move_up_exec(bContext *C, wmOperator *op)
 	Object *ob = ED_object_active_context(C);
 	ModifierData *md = edit_modifier_property_get(op, ob, 0);
 
-	if(!ob || !md || !ED_object_modifier_move_up(op->reports, ob, md))
+	if (!ob || !md || !ED_object_modifier_move_up(op->reports, ob, md))
 		return OPERATOR_CANCELLED;
 
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
@@ -835,16 +836,16 @@ static int modifier_move_up_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(
 
 void OBJECT_OT_modifier_move_up(wmOperatorType *ot)
 {
-	ot->name= "Move Up Modifier";
-	ot->description= "Move modifier up in the stack";
-	ot->idname= "OBJECT_OT_modifier_move_up";
+	ot->name = "Move Up Modifier";
+	ot->description = "Move modifier up in the stack";
+	ot->idname = "OBJECT_OT_modifier_move_up";
 
-	ot->invoke= modifier_move_up_invoke;
-	ot->exec= modifier_move_up_exec;
-	ot->poll= edit_modifier_poll;
+	ot->invoke = modifier_move_up_invoke;
+	ot->exec = modifier_move_up_exec;
+	ot->poll = edit_modifier_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	edit_modifier_properties(ot);
 }
 
@@ -855,7 +856,7 @@ static int modifier_move_down_exec(bContext *C, wmOperator *op)
 	Object *ob = ED_object_active_context(C);
 	ModifierData *md = edit_modifier_property_get(op, ob, 0);
 
-	if(!ob || !md || !ED_object_modifier_move_down(op->reports, ob, md))
+	if (!ob || !md || !ED_object_modifier_move_down(op->reports, ob, md))
 		return OPERATOR_CANCELLED;
 
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
@@ -874,16 +875,16 @@ static int modifier_move_down_invoke(bContext *C, wmOperator *op, wmEvent *UNUSE
 
 void OBJECT_OT_modifier_move_down(wmOperatorType *ot)
 {
-	ot->name= "Move Down Modifier";
-	ot->description= "Move modifier down in the stack";
-	ot->idname= "OBJECT_OT_modifier_move_down";
+	ot->name = "Move Down Modifier";
+	ot->description = "Move modifier down in the stack";
+	ot->idname = "OBJECT_OT_modifier_move_down";
 
-	ot->invoke= modifier_move_down_invoke;
-	ot->exec= modifier_move_down_exec;
-	ot->poll= edit_modifier_poll;
+	ot->invoke = modifier_move_down_invoke;
+	ot->exec = modifier_move_down_exec;
+	ot->poll = edit_modifier_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	edit_modifier_properties(ot);
 }
 
@@ -896,7 +897,7 @@ static int modifier_apply_exec(bContext *C, wmOperator *op)
 	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)) {
+	if (!ob || !md || !ED_object_modifier_apply(op->reports, scene, ob, md, apply_as)) {
 		return OPERATOR_CANCELLED;
 	}
 
@@ -921,16 +922,16 @@ static EnumPropertyItem modifier_apply_as_items[] = {
 
 void OBJECT_OT_modifier_apply(wmOperatorType *ot)
 {
-	ot->name= "Apply Modifier";
-	ot->description= "Apply modifier and remove from the stack";
-	ot->idname= "OBJECT_OT_modifier_apply";
+	ot->name = "Apply Modifier";
+	ot->description = "Apply modifier and remove from the stack";
+	ot->idname = "OBJECT_OT_modifier_apply";
 
-	ot->invoke= modifier_apply_invoke;
-	ot->exec= modifier_apply_exec;
-	ot->poll= edit_modifier_poll;
+	ot->invoke = modifier_apply_invoke;
+	ot->exec = modifier_apply_exec;
+	ot->poll = edit_modifier_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	RNA_def_enum(ot->srna, "apply_as", modifier_apply_as_items, MODIFIER_APPLY_DATA, "Apply as", "How to apply the modifier to the geometry");
 	edit_modifier_properties(ot);
@@ -945,7 +946,7 @@ static int modifier_convert_exec(bContext *C, wmOperator *op)
 	Object *ob = ED_object_active_context(C);
 	ModifierData *md = edit_modifier_property_get(op, ob, 0);
 	
-	if(!ob || !md || !ED_object_modifier_convert(op->reports, bmain, scene, ob, md))
+	if (!ob || !md || !ED_object_modifier_convert(op->reports, bmain, scene, ob, md))
 		return OPERATOR_CANCELLED;
 
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
@@ -964,16 +965,16 @@ static int modifier_convert_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(
 
 void OBJECT_OT_modifier_convert(wmOperatorType *ot)
 {
-	ot->name= "Convert Modifier";
-	ot->description= "Convert particles to a mesh object";
-	ot->idname= "OBJECT_OT_modifier_convert";
+	ot->name = "Convert Modifier";
+	ot->description = "Convert particles to a mesh object";
+	ot->idname = "OBJECT_OT_modifier_convert";
 
-	ot->invoke= modifier_convert_invoke;
-	ot->exec= modifier_convert_exec;
-	ot->poll= edit_modifier_poll;
+	ot->invoke = modifier_convert_invoke;
+	ot->exec = modifier_convert_exec;
+	ot->poll = edit_modifier_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	edit_modifier_properties(ot);
 }
 
@@ -984,7 +985,7 @@ static int modifier_copy_exec(bContext *C, wmOperator *op)
 	Object *ob = ED_object_active_context(C);
 	ModifierData *md = edit_modifier_property_get(op, ob, 0);
 
-	if(!ob || !md || !ED_object_modifier_copy(op->reports, ob, md))
+	if (!ob || !md || !ED_object_modifier_copy(op->reports, ob, md))
 		return OPERATOR_CANCELLED;
 
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
@@ -1003,16 +1004,16 @@ static int modifier_copy_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
 
 void OBJECT_OT_modifier_copy(wmOperatorType *ot)
 {
-	ot->name= "Copy Modifier";
-	ot->description= "Duplicate modifier at the same position in the stack";
-	ot->idname= "OBJECT_OT_modifier_copy";
+	ot->name = "Copy Modifier";
+	ot->description = "Duplicate modifier at the same position in the stack";
+	ot->idname = "OBJECT_OT_modifier_copy";
 
-	ot->invoke= modifier_copy_invoke;
-	ot->exec= modifier_copy_exec;
-	ot->poll= edit_modifier_poll;
+	ot->invoke = modifier_copy_invoke;
+	ot->exec = modifier_copy_exec;
+	ot->poll = edit_modifier_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	edit_modifier_properties(ot);
 }
 
@@ -1048,16 +1049,16 @@ static int multires_higher_levels_delete_invoke(bContext *C, wmOperator *op, wmE
 
 void OBJECT_OT_multires_higher_levels_delete(wmOperatorType *ot)
 {
-	ot->name= "Delete Higher Levels";
-	ot->description= "Deletes the higher resolution mesh, potential loss of detail";
-	ot->idname= "OBJECT_OT_multires_higher_levels_delete";
+	ot->name = "Delete Higher Levels";
+	ot->description = "Deletes the higher resolution mesh, potential loss of detail";
+	ot->idname = "OBJECT_OT_multires_higher_levels_delete";
 
-	ot->poll= multires_poll;
-	ot->invoke= multires_higher_levels_delete_invoke;
-	ot->exec= multires_higher_levels_delete_exec;
+	ot->poll = multires_poll;
+	ot->invoke = multires_higher_levels_delete_invoke;
+	ot->exec = multires_higher_levels_delete_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	edit_modifier_properties(ot);
 }
 
@@ -1089,16 +1090,16 @@ static int multires_subdivide_invoke(bContext *C, wmOperator *op, wmEvent *UNUSE
 
 void OBJECT_OT_multires_subdivide(wmOperatorType *ot)
 {
-	ot->name= "Multires Subdivide";
-	ot->description= "Add a new level of subdivision";
-	ot->idname= "OBJECT_OT_multires_subdivide";
+	ot->name = "Multires Subdivide";
+	ot->description = "Add a new level of subdivision";
+	ot->idname = "OBJECT_OT_multires_subdivide";
 
-	ot->poll= multires_poll;
-	ot->invoke= multires_subdivide_invoke;
-	ot->exec= multires_subdivide_exec;
+	ot->poll = multires_poll;
+	ot->invoke = multires_subdivide_invoke;
+	ot->exec = multires_subdivide_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	edit_modifier_properties(ot);
 }
 
@@ -1113,25 +1114,25 @@ static int multires_reshape_exec(bContext *C, wmOperator *op)
 	if (!mmd)
 		return OPERATOR_CANCELLED;
 
-	if(mmd->lvl==0) {
+	if (mmd->lvl==0) {
 		BKE_report(op->reports, RPT_ERROR, "Reshape can work only with higher levels of subdivisions");
 		return OPERATOR_CANCELLED;
 	}
 
 	CTX_DATA_BEGIN(C, Object*, selob, selected_editable_objects) {
-		if(selob->type == OB_MESH && selob != ob) {
+		if (selob->type == OB_MESH && selob != ob) {
 			secondob= selob;
 			break;
 		}
 	}
 	CTX_DATA_END;
 
-	if(!secondob) {
+	if (!secondob) {
 		BKE_report(op->reports, RPT_ERROR, "Second selected mesh object require to copy shape from");
 		return OPERATOR_CANCELLED;
 	}
 
-	if(!multiresModifier_reshape(scene, mmd, ob, secondob)) {
+	if (!multiresModifier_reshape(scene, mmd, ob, secondob)) {
 		BKE_report(op->reports, RPT_ERROR, "Objects do not have the same number of vertices");
 		return OPERATOR_CANCELLED;
 	}
@@ -1152,19 +1153,21 @@ static int multires_reshape_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(
 
 void OBJECT_OT_multires_reshape(wmOperatorType *ot)
 {
-	ot->name= "Multires Reshape";
-	ot->description= "Copy vertex coordinates from other object";
-	ot->idname= "OBJECT_OT_multires_reshape";
+	ot->name = "Multires Reshape";
+	ot->description = "Copy vertex coordinates from other object";
+	ot->idname = "OBJECT_OT_multires_reshape";
 
-	ot->poll= multires_poll;
-	ot->invoke= multires_reshape_invoke;
-	ot->exec= multires_reshape_exec;
+	ot->poll = multires_poll;
+	ot->invoke = multires_reshape_invoke;
+	ot->exec = multires_reshape_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	edit_modifier_properties(ot);
 }
 
+
+		
 /****************** multires save external operator *********************/
 
 static int multires_external_save_exec(bContext *C, wmOperator *op)
@@ -1174,19 +1177,19 @@ static int multires_external_save_exec(bContext *C, wmOperator *op)
 	char path[FILE_MAX];
 	int relative= RNA_boolean_get(op->ptr, "relative_path");
 
-	if(!me)
+	if (!me)
 		return OPERATOR_CANCELLED;
 
-	if(CustomData_external_test(&me->fdata, CD_MDISPS))
+	if (CustomData_external_test(&me->ldata, CD_MDISPS))
 		return OPERATOR_CANCELLED;
 	
 	RNA_string_get(op->ptr, "filepath", path);
 
-	if(relative)
+	if (relative)
 		BLI_path_rel(path, G.main->name);
 
-	CustomData_external_add(&me->fdata, &me->id, CD_MDISPS, me->totface, path);
-	CustomData_external_write(&me->fdata, &me->id, CD_MASK_MESH, me->totface, 0);
+	CustomData_external_add(&me->ldata, &me->id, CD_MDISPS, me->totloop, path);
+	CustomData_external_write(&me->ldata, &me->id, CD_MASK_MESH, me->totloop, 0);
 	
 	return OPERATOR_FINISHED;
 }
@@ -1206,10 +1209,10 @@ static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *U
 	if (!mmd)
 		return OPERATOR_CANCELLED;
 	
-	if(CustomData_external_test(&me->fdata, CD_MDISPS))
+	if (CustomData_external_test(&me->ldata, CD_MDISPS))
 		return OPERATOR_CANCELLED;
 
-	if(RNA_struct_property_is_set(op->ptr, "filepath"))
+	if (RNA_struct_property_is_set(op->ptr, "filepath"))
 		return multires_external_save_exec(C, op);
 	
 	op->customdata= me;
@@ -1224,17 +1227,17 @@ static int multires_external_save_invoke(bContext *C, wmOperator *op, wmEvent *U
 
 void OBJECT_OT_multires_external_save(wmOperatorType *ot)
 {
-	ot->name= "Multires Save External";
-	ot->description= "Save displacements to an external file";
-	ot->idname= "OBJECT_OT_multires_external_save";
+	ot->name = "Multires Save External";
+	ot->description = "Save displacements to an external file";
+	ot->idname = "OBJECT_OT_multires_external_save";
 
-	// XXX modifier no longer in context after file browser .. ot->poll= multires_poll;
-	ot->exec= multires_external_save_exec;
-	ot->invoke= multires_external_save_invoke;
-	ot->poll= multires_poll;
+	// XXX modifier no longer in context after file browser .. ot->poll = multires_poll;
+	ot->exec = multires_external_save_exec;
+	ot->invoke = multires_external_save_invoke;
+	ot->poll = multires_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	WM_operator_properties_filesel(ot, FOLDERFILE|BTXFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
 	edit_modifier_properties(ot);
@@ -1247,26 +1250,26 @@ static int multires_external_pack_exec(bContext *C, wmOperator *UNUSED(op))
 	Object *ob = ED_object_active_context(C);
 	Mesh *me= ob->data;
 
-	if(!CustomData_external_test(&me->fdata, CD_MDISPS))
+	if (!CustomData_external_test(&me->ldata, CD_MDISPS))
 		return OPERATOR_CANCELLED;
 
 	// XXX don't remove..
-	CustomData_external_remove(&me->fdata, &me->id, CD_MDISPS, me->totface);
+	CustomData_external_remove(&me->ldata, &me->id, CD_MDISPS, me->totloop);
 	
 	return OPERATOR_FINISHED;
 }
 
 void OBJECT_OT_multires_external_pack(wmOperatorType *ot)
 {
-	ot->name= "Multires Pack External";
-	ot->description= "Pack displacements from an external file";
-	ot->idname= "OBJECT_OT_multires_external_pack";
+	ot->name = "Multires Pack External";
+	ot->description = "Pack displacements from an external file";
+	ot->idname = "OBJECT_OT_multires_external_pack";
 
-	ot->poll= multires_poll;
-	ot->exec= multires_external_pack_exec;
+	ot->poll = multires_poll;
+	ot->exec = multires_external_pack_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************* multires apply base ***********************/
@@ -1297,16 +1300,16 @@ static int multires_base_apply_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
 
 void OBJECT_OT_multires_base_apply(wmOperatorType *ot)
 {
-	ot->name= "Multires Apply Base";
-	ot->description= "Modify the base mesh to conform to the displaced mesh";
-	ot->idname= "OBJECT_OT_multires_base_apply";
+	ot->name = "Multires Apply Base";
+	ot->description = "Modify the base mesh to conform to the displaced mesh";
+	ot->idname = "OBJECT_OT_multires_base_apply";
 
-	ot->poll= multires_poll;
-	ot->invoke= multires_base_apply_invoke;
-	ot->exec= multires_base_apply_exec;
+	ot->poll = multires_poll;
+	ot->invoke = multires_base_apply_invoke;
+	ot->exec = multires_base_apply_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	edit_modifier_properties(ot);
 }
 
@@ -1327,15 +1330,15 @@ static int meshdeform_bind_exec(bContext *C, wmOperator *op)
 	if (!mmd)
 		return OPERATOR_CANCELLED;
 
-	if(mmd->bindcagecos) {
+	if (mmd->bindcagecos) {
 		MEM_freeN(mmd->bindcagecos);
-		if(mmd->dyngrid) MEM_freeN(mmd->dyngrid);
-		if(mmd->dyninfluences) MEM_freeN(mmd->dyninfluences);
-		if(mmd->bindinfluences) MEM_freeN(mmd->bindinfluences);
-		if(mmd->bindoffsets) MEM_freeN(mmd->bindoffsets);
-		if(mmd->dynverts) MEM_freeN(mmd->dynverts);
-		if(mmd->bindweights) MEM_freeN(mmd->bindweights); /* deprecated */
-		if(mmd->bindcos) MEM_freeN(mmd->bindcos); /* deprecated */
+		if (mmd->dyngrid) MEM_freeN(mmd->dyngrid);
+		if (mmd->dyninfluences) MEM_freeN(mmd->dyninfluences);
+		if (mmd->bindinfluences) MEM_freeN(mmd->bindinfluences);
+		if (mmd->bindoffsets) MEM_freeN(mmd->bindoffsets);
+		if (mmd->dynverts) MEM_freeN(mmd->dynverts);
+		if (mmd->bindweights) MEM_freeN(mmd->bindweights); /* deprecated */
+		if (mmd->bindcos) MEM_freeN(mmd->bindcos); /* deprecated */
 
 		mmd->bindcagecos= NULL;
 		mmd->dyngrid= NULL;
@@ -1359,17 +1362,17 @@ static int meshdeform_bind_exec(bContext *C, wmOperator *op)
 		mmd->bindfunc= mesh_deform_bind;
 		mmd->modifier.mode |= eModifierMode_Realtime;
 
-		if(ob->type == OB_MESH) {
+		if (ob->type == OB_MESH) {
 			dm= mesh_create_derived_view(scene, ob, 0);
 			dm->release(dm);
 		}
-		else if(ob->type == OB_LATTICE) {
+		else if (ob->type == OB_LATTICE) {
 			lattice_calc_modifiers(scene, ob);
 		}
-		else if(ob->type==OB_MBALL) {
+		else if (ob->type==OB_MBALL) {
 			makeDispListMBall(scene, ob);
 		}
-		else if(ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
+		else if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
 			makeDispListCurveTypes(scene, ob, 0);
 		}
 
@@ -1391,17 +1394,17 @@ static int meshdeform_bind_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e
 void OBJECT_OT_meshdeform_bind(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Mesh Deform Bind";
+	ot->name = "Mesh Deform Bind";
 	ot->description = "Bind mesh to cage in mesh deform modifier";
-	ot->idname= "OBJECT_OT_meshdeform_bind";
+	ot->idname = "OBJECT_OT_meshdeform_bind";
 	
 	/* api callbacks */
-	ot->poll= meshdeform_poll;
-	ot->invoke= meshdeform_bind_invoke;
-	ot->exec= meshdeform_bind_exec;
+	ot->poll = meshdeform_poll;
+	ot->invoke = meshdeform_bind_invoke;
+	ot->exec = meshdeform_bind_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	edit_modifier_properties(ot);
 }
 
@@ -1439,16 +1442,16 @@ static int explode_refresh_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e
 
 void OBJECT_OT_explode_refresh(wmOperatorType *ot)
 {
-	ot->name= "Explode Refresh";
-	ot->description= "Refresh data in the Explode modifier";
-	ot->idname= "OBJECT_OT_explode_refresh";
+	ot->name = "Explode Refresh";
+	ot->description = "Refresh data in the Explode modifier";
+	ot->idname = "OBJECT_OT_explode_refresh";
 
-	ot->poll= explode_poll;
-	ot->invoke= explode_refresh_invoke;
-	ot->exec= explode_refresh_exec;
+	ot->poll = explode_poll;
+	ot->invoke = explode_refresh_invoke;
+	ot->exec = explode_refresh_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	edit_modifier_properties(ot);
 }
 
@@ -1583,8 +1586,8 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
 	/* precalculate time variable before baking */
 	for (f=omd->bakestart; f<=omd->bakeend; f++) {
 		/* from physics_fluid.c:
-		 
-		 * XXX: This can't be used due to an anim sys optimisation that ignores recalc object animation,
+		 *
+		 * XXX: This can't be used due to an anim sys optimization that ignores recalc object animation,
 		 * leaving it for the depgraph (this ignores object animation such as modifier properties though... :/ )
 		 * --> BKE_animsys_evaluate_all_animation(G.main, eval_time);
 		 * This doesn't work with drivers:
@@ -1609,7 +1612,7 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
 	ocean = BKE_add_ocean();
 	init_ocean_modifier_bake(ocean, omd);
 	
-	/*
+#if 0
 	 BKE_bake_ocean(ocean, och);
 	
 	omd->oceancache = och;
@@ -1619,7 +1622,7 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
 	
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 	WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
-	*/
+#endif
 	
 	/* job stuff */
 	
@@ -1654,16 +1657,16 @@ static int ocean_bake_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
 
 void OBJECT_OT_ocean_bake(wmOperatorType *ot)
 {
-	ot->name= "Bake Ocean";
-	ot->description= "Bake an image sequence of ocean data";
-	ot->idname= "OBJECT_OT_ocean_bake";
+	ot->name = "Bake Ocean";
+	ot->description = "Bake an image sequence of ocean data";
+	ot->idname = "OBJECT_OT_ocean_bake";
 	
-	ot->poll= ocean_bake_poll;
-	ot->invoke= ocean_bake_invoke;
-	ot->exec= ocean_bake_exec;
+	ot->poll = ocean_bake_poll;
+	ot->invoke = ocean_bake_invoke;
+	ot->exec = ocean_bake_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	edit_modifier_properties(ot);
 	
 	RNA_def_boolean(ot->srna, "free", FALSE, "Free", "Free the bake, rather than generating it");
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 09ae636..138cbad 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -194,6 +194,7 @@ void ED_operatortypes_object(void)
 	WM_operatortype_append(OBJECT_OT_shape_key_add);
 	WM_operatortype_append(OBJECT_OT_shape_key_remove);
 	WM_operatortype_append(OBJECT_OT_shape_key_clear);
+	WM_operatortype_append(OBJECT_OT_shape_key_retime);
 	WM_operatortype_append(OBJECT_OT_shape_key_mirror);
 	WM_operatortype_append(OBJECT_OT_shape_key_move);
 
@@ -216,33 +217,32 @@ void ED_operatortypes_object(void)
 	WM_operatortype_append(OBJECT_OT_drop_named_material);
 }
 
-
 void ED_operatormacros_object(void)
 {
 	wmOperatorType *ot;
 	wmOperatorTypeMacro *otmacro;
 	
-	ot= WM_operatortype_append_macro("OBJECT_OT_duplicate_move", "Duplicate Objects", OPTYPE_UNDO|OPTYPE_REGISTER);
-	if(ot) {
+	ot = WM_operatortype_append_macro("OBJECT_OT_duplicate_move", "Duplicate Objects", OPTYPE_UNDO|OPTYPE_REGISTER);
+	if (ot) {
 		ot->description = "Duplicate selected objects and move them";
 		WM_operatortype_macro_define(ot, "OBJECT_OT_duplicate");
-		otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+		otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
 		RNA_enum_set(otmacro->ptr, "proportional", PROP_EDIT_OFF);
 	}
 
 	/* grr, should be able to pass options on... */
-	ot= WM_operatortype_append_macro("OBJECT_OT_duplicate_move_linked", "Duplicate Linked", OPTYPE_UNDO|OPTYPE_REGISTER);
-	if(ot) {
+	ot = WM_operatortype_append_macro("OBJECT_OT_duplicate_move_linked", "Duplicate Linked", OPTYPE_UNDO|OPTYPE_REGISTER);
+	if (ot) {
 		ot->description = "Duplicate selected objects and move them";
-		otmacro= WM_operatortype_macro_define(ot, "OBJECT_OT_duplicate");
+		otmacro = WM_operatortype_macro_define(ot, "OBJECT_OT_duplicate");
 		RNA_boolean_set(otmacro->ptr, "linked", TRUE);
-		otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+		otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
 		RNA_enum_set(otmacro->ptr, "proportional", PROP_EDIT_OFF);
 	}
 	
 	/* XXX */
-	ot= WM_operatortype_append_macro("OBJECT_OT_add_named_cursor", "Add named object at cursor", OPTYPE_UNDO|OPTYPE_REGISTER);
-	if(ot) {
+	ot = WM_operatortype_append_macro("OBJECT_OT_add_named_cursor", "Add named object at cursor", OPTYPE_UNDO|OPTYPE_REGISTER);
+	if (ot) {
 		ot->description = "Add named object at cursor";
 		RNA_def_string(ot->srna, "name", "Cube", MAX_ID_NAME-2, "Name", "Object name to add");
 
@@ -264,7 +264,7 @@ void ED_keymap_object(wmKeyConfig *keyconf)
 	int i;
 	
 	/* Objects, Regardless of Mode -------------------------------------------------- */
-	keymap= WM_keymap_find(keyconf, "Object Non-modal", 0, 0);
+	keymap = WM_keymap_find(keyconf, "Object Non-modal", 0, 0);
 	
 	/* Note: this keymap works disregarding mode */
 	kmi = WM_keymap_add_item(keymap, "OBJECT_OT_mode_set", TABKEY, KM_PRESS, 0, 0);
@@ -287,8 +287,8 @@ void ED_keymap_object(wmKeyConfig *keyconf)
 
 	/* Object Mode ---------------------------------------------------------------- */
 	/* Note: this keymap gets disabled in non-objectmode,  */
-	keymap= WM_keymap_find(keyconf, "Object Mode", 0, 0);
-	keymap->poll= object_mode_poll;
+	keymap = WM_keymap_find(keyconf, "Object Mode", 0, 0);
+	keymap->poll = object_mode_poll;
 	
 	/* object mode supports PET now */
 	ED_object_generic_keymap(keyconf, keymap, 1);
@@ -392,7 +392,7 @@ void ED_keymap_object(wmKeyConfig *keyconf)
 
 	WM_keymap_add_menu(keymap, "VIEW3D_MT_object_specials", WKEY, KM_PRESS, 0, 0);
 
-	for(i=0; i<=5; i++) {
+	for (i=0; i<=5; i++) {
 		kmi = WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", ZEROKEY+i, KM_PRESS, KM_CTRL, 0);
 		RNA_int_set(kmi->ptr, "level", i);
 	}
@@ -401,11 +401,14 @@ void ED_keymap_object(wmKeyConfig *keyconf)
 	/* ################################ LATTICE ################################### */
 	/* ############################################################################ */
 
-	keymap= WM_keymap_find(keyconf, "Lattice", 0, 0);
-	keymap->poll= ED_operator_editlattice;
+	keymap = WM_keymap_find(keyconf, "Lattice", 0, 0);
+	keymap->poll = ED_operator_editlattice;
+
+	kmi = WM_keymap_add_item(keymap, "LATTICE_OT_select_all", AKEY, KM_PRESS, 0, 0);
+	RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
+	kmi = WM_keymap_add_item(keymap, "LATTICE_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
+	RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
 
-	WM_keymap_add_item(keymap, "LATTICE_OT_select_all", AKEY, KM_PRESS, 0, 0);
-	
 	WM_keymap_add_item(keymap, "OBJECT_OT_vertex_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
 	
 	/* menus */
@@ -419,7 +422,7 @@ void ED_object_generic_keymap(struct wmKeyConfig *UNUSED(keyconf), struct wmKeyM
 	wmKeyMapItem *kmi;
 
 	/* used by mesh, curve & lattice only */
-	if(do_pet) {
+	if (do_pet) {
 		/* context ops */
 		kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_enum", OKEY, KM_PRESS, KM_SHIFT, 0);
 		RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_edit_falloff");
@@ -430,7 +433,8 @@ void ED_object_generic_keymap(struct wmKeyConfig *UNUSED(keyconf), struct wmKeyM
 			kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", OKEY, KM_PRESS, 0, 0);
 			RNA_string_set(kmi->ptr, "data_path", "tool_settings.use_proportional_edit_objects");
 
-		} else { // Edit mode
+		}
+		else { // Edit mode
 
 			kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", OKEY, KM_PRESS, 0, 0);
 			RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_edit");
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 3746137..a666f04 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -35,6 +35,7 @@
 #include "MEM_guardedalloc.h"
 
 #include "DNA_anim_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_constraint_types.h"
 #include "DNA_group_types.h"
 #include "DNA_lamp_types.h"
@@ -48,7 +49,6 @@
 #include "DNA_object_types.h"
 
 #include "BLI_math.h"
-#include "BLI_editVert.h"
 #include "BLI_listbase.h"
 #include "BLI_string.h"
 #include "BLI_utildefines.h"
@@ -79,6 +79,7 @@
 #include "BKE_scene.h"
 #include "BKE_speaker.h"
 #include "BKE_texture.h"
+#include "BKE_tessmesh.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
@@ -94,9 +95,9 @@
 #include "ED_curve.h"
 #include "ED_keyframing.h"
 #include "ED_object.h"
+#include "ED_mesh.h"
 #include "ED_screen.h"
 #include "ED_view3d.h"
-#include "ED_mesh.h"
 
 #include "object_intern.h"
 
@@ -112,7 +113,8 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
 	Main *bmain= CTX_data_main(C);
 	Scene *scene= CTX_data_scene(C);
 	Object *obedit= CTX_data_edit_object(C);
-	EditVert *eve;
+	BMVert *eve;
+	BMIter iter;
 	Curve *cu;
 	Nurb *nu;
 	BezTriple *bezt;
@@ -122,50 +124,46 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
 	
 	/* we need 1 to 3 selected vertices */
 	
-	if(obedit->type==OB_MESH) {
+	if (obedit->type==OB_MESH) {
 		Mesh *me= obedit->data;
-		EditMesh *em;
+		BMEditMesh *em;
 
-		load_editMesh(scene, obedit);
-		make_editMesh(scene, obedit);
+		EDBM_mesh_load(obedit);
+		EDBM_mesh_make(scene->toolsettings, scene, obedit);
 
-		em= BKE_mesh_get_editmesh(me);
+		em= me->edit_btmesh;
 
 		/* derivedMesh might be needed for solving parenting,
-		   so re-create it here */
-		makeDerivedMesh(scene, obedit, em, CD_MASK_BAREMESH);
-
-		eve= em->verts.first;
-		while(eve) {
-			if(eve->f & 1) {
-				if(v1==0) v1= nr;
-				else if(v2==0) v2= nr;
-				else if(v3==0) v3= nr;
-				else if(v4==0) v4= nr;
+		 * so re-create it here */
+		makeDerivedMesh(scene, obedit, em, CD_MASK_BAREMESH, 0);
+
+		BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+			if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
+				if (v1==0) v1= nr;
+				else if (v2==0) v2= nr;
+				else if (v3==0) v3= nr;
+				else if (v4==0) v4= nr;
 				else break;
 			}
 			nr++;
-			eve= eve->next;
 		}
-
-		BKE_mesh_end_editmesh(me, em);
 	}
-	else if(ELEM(obedit->type, OB_SURF, OB_CURVE)) {
+	else if (ELEM(obedit->type, OB_SURF, OB_CURVE)) {
 		ListBase *editnurb= object_editcurve_get(obedit);
 		
 		cu= obedit->data;
 
 		nu= editnurb->first;
-		while(nu) {
-			if(nu->type == CU_BEZIER) {
+		while (nu) {
+			if (nu->type == CU_BEZIER) {
 				bezt= nu->bezt;
 				a= nu->pntsu;
-				while(a--) {
-					if(BEZSELECTED_HIDDENHANDLES(cu, bezt)) {
-						if(v1==0) v1= nr;
-						else if(v2==0) v2= nr;
-						else if(v3==0) v3= nr;
-						else if(v4==0) v4= nr;
+				while (a--) {
+					if (BEZSELECTED_HIDDENHANDLES(cu, bezt)) {
+						if (v1==0) v1= nr;
+						else if (v2==0) v2= nr;
+						else if (v3==0) v3= nr;
+						else if (v4==0) v4= nr;
 						else break;
 					}
 					nr++;
@@ -175,12 +173,12 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
 			else {
 				bp= nu->bp;
 				a= nu->pntsu*nu->pntsv;
-				while(a--) {
-					if(bp->f1 & SELECT) {
-						if(v1==0) v1= nr;
-						else if(v2==0) v2= nr;
-						else if(v3==0) v3= nr;
-						else if(v4==0) v4= nr;
+				while (a--) {
+					if (bp->f1 & SELECT) {
+						if (v1==0) v1= nr;
+						else if (v2==0) v2= nr;
+						else if (v3==0) v3= nr;
+						else if (v4==0) v4= nr;
 						else break;
 					}
 					nr++;
@@ -190,17 +188,17 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
 			nu= nu->next;
 		}
 	}
-	else if(obedit->type==OB_LATTICE) {
+	else if (obedit->type==OB_LATTICE) {
 		Lattice *lt= obedit->data;
 		
 		a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
 		bp= lt->editlatt->latt->def;
-		while(a--) {
-			if(bp->f1 & SELECT) {
-				if(v1==0) v1= nr;
-				else if(v2==0) v2= nr;
-				else if(v3==0) v3= nr;
-				else if(v4==0) v4= nr;
+		while (a--) {
+			if (bp->f1 & SELECT) {
+				if (v1==0) v1= nr;
+				else if (v2==0) v2= nr;
+				else if (v3==0) v3= nr;
+				else if (v4==0) v4= nr;
 				else break;
 			}
 			nr++;
@@ -208,28 +206,28 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
 		}
 	}
 	
-	if(v4 || !((v1 && v2==0 && v3==0) || (v1 && v2 && v3)) ) {
+	if (v4 || !((v1 && v2==0 && v3==0) || (v1 && v2 && v3)) ) {
 		BKE_report(op->reports, RPT_ERROR, "Select either 1 or 3 vertices to parent to");
 		return OPERATOR_CANCELLED;
 	}
 	
 	CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
-		if(ob != obedit) {
+		if (ob != obedit) {
 			ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
 			par= obedit->parent;
 			
-			while(par) {
-				if(par==ob) break;
+			while (par) {
+				if (par==ob) break;
 				par= par->parent;
 			}
-			if(par) {
+			if (par) {
 				BKE_report(op->reports, RPT_ERROR, "Loop in parents");
 			}
 			else {
 				Object workob;
 				
 				ob->parent= BASACT->object;
-				if(v3) {
+				if (v3) {
 					ob->partype= PARVERT3;
 					ob->par1= v1-1;
 					ob->par2= v2-1;
@@ -262,17 +260,17 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_vertex_parent_set(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Make Vertex Parent";
+	ot->name = "Make Vertex Parent";
 	ot->description = "Parent selected objects to the selected vertices";
-	ot->idname= "OBJECT_OT_vertex_parent_set";
+	ot->idname = "OBJECT_OT_vertex_parent_set";
 	
 	/* api callbacks */
-	ot->invoke= WM_operator_confirm;
-	ot->poll= vertex_parent_set_poll;
-	ot->exec= vertex_parent_set_exec;
+	ot->invoke = WM_operator_confirm;
+	ot->poll = vertex_parent_set_poll;
+	ot->exec = vertex_parent_set_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************** Make Proxy Operator *************************/
@@ -321,13 +319,11 @@ static int make_proxy_exec (bContext *C, wmOperator *op)
 	GroupObject *go;
 	Scene *scene= CTX_data_scene(C);
 
-	if (gob->dup_group != NULL)
-	{
-		go= BLI_findlink(&gob->dup_group->gobject, RNA_enum_get(op->ptr, "type"));
+	if (gob->dup_group != NULL) {
+		go= BLI_findlink(&gob->dup_group->gobject, RNA_enum_get(op->ptr, "object"));
 		ob= go->ob;
 	}
-	else
-	{
+	else {
 		ob= gob;
 		gob = NULL;
 	}
@@ -379,7 +375,7 @@ static EnumPropertyItem *proxy_group_object_itemf(bContext *C, PointerRNA *UNUSE
 	Object *ob= ED_object_active_context(C);
 	GroupObject *go;
 
-	if(!ob || !ob->dup_group)
+	if (!ob || !ob->dup_group)
 		return DummyRNA_DEFAULT_items;
 
 	/* find the object to affect */
@@ -400,23 +396,22 @@ void OBJECT_OT_proxy_make (wmOperatorType *ot)
 	PropertyRNA *prop;
 
 	/* identifiers */
-	ot->name= "Make Proxy";
-	ot->idname= "OBJECT_OT_proxy_make";
-	ot->description= "Add empty object to become local replacement data of a library-linked object";
+	ot->name = "Make Proxy";
+	ot->idname = "OBJECT_OT_proxy_make";
+	ot->description = "Add empty object to become local replacement data of a library-linked object";
 	
 	/* callbacks */
-	ot->invoke= make_proxy_invoke;
-	ot->exec= make_proxy_exec;
-	ot->poll= ED_operator_object_active;
+	ot->invoke = make_proxy_invoke;
+	ot->exec = make_proxy_exec;
+	ot->poll = ED_operator_object_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
-	RNA_def_string(ot->srna, "object", "", MAX_ID_NAME-2, "Proxy Object", "Name of lib-linked/grouped object to make a proxy for");
-	prop= RNA_def_enum(ot->srna, "type", DummyRNA_DEFAULT_items, 0, "Type", "Group object"); /* XXX, relies on hard coded ID at the moment */
+	prop= RNA_def_enum(ot->srna, "object", DummyRNA_DEFAULT_items, 0, "Proxy Object", "Name of lib-linked/grouped object to make a proxy for"); /* XXX, relies on hard coded ID at the moment */
 	RNA_def_enum_funcs(prop, proxy_group_object_itemf);
-	ot->prop= prop;
+	ot->prop = prop;
 }
 
 /********************** Clear Parent Operator ******************* */
@@ -435,17 +430,17 @@ void ED_object_parent_clear(bContext *C, int type)
 
 	CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) 
 	{
-		if(ob->parent == NULL)
+		if (ob->parent == NULL)
 			continue;
 		
-		if(type == 0) {
+		if (type == 0) {
 			ob->parent= NULL;
 		}
-		else if(type == 1) {
+		else if (type == 1) {
 			ob->parent= NULL;
 			object_apply_mat4(ob, ob->obmat, TRUE, FALSE);
 		}
-		else if(type == 2)
+		else if (type == 2)
 			unit_m4(ob->parentinv);
 		
 		ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
@@ -469,20 +464,20 @@ static int parent_clear_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_parent_clear(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear Parent";
+	ot->name = "Clear Parent";
 	ot->description = "Clear the object's parenting";
-	ot->idname= "OBJECT_OT_parent_clear";
+	ot->idname = "OBJECT_OT_parent_clear";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= parent_clear_exec;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = parent_clear_exec;
 	
-	ot->poll= ED_operator_object_active_editable;
+	ot->poll = ED_operator_object_active_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_clear_parent_types, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_clear_parent_types, 0, "Type", "");
 }
 
 /* ******************** Make Parent Operator *********************** */
@@ -521,178 +516,182 @@ EnumPropertyItem prop_make_parent_types[] = {
 	{0, NULL, 0, NULL, NULL}
 };
 
-int ED_object_parent_set(bContext *C, wmOperator *op, Object *par, int partype)
+int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object *ob, Object *par, int partype)
 {
-	Main *bmain= CTX_data_main(C);
-	Scene *scene= CTX_data_scene(C);
 	bPoseChannel *pchan= NULL;
 	int pararm= ELEM4(partype, PAR_ARMATURE, PAR_ARMATURE_NAME, PAR_ARMATURE_ENVELOPE, PAR_ARMATURE_AUTO);
 	
 	par->recalc |= OB_RECALC_OB;
 	
 	/* preconditions */
-	if(partype==PAR_FOLLOW || partype==PAR_PATH_CONST) {
-		if(par->type!=OB_CURVE)
+	if (partype==PAR_FOLLOW || partype==PAR_PATH_CONST) {
+		if (par->type!=OB_CURVE)
 			return 0;
 		else {
 			Curve *cu= par->data;
 			
-			if((cu->flag & CU_PATH)==0) {
+			if ((cu->flag & CU_PATH)==0) {
 				cu->flag |= CU_PATH|CU_FOLLOW;
 				makeDispListCurveTypes(scene, par, 0);  /* force creation of path data */
 			}
 			else cu->flag |= CU_FOLLOW;
 			
 			/* if follow, add F-Curve for ctime (i.e. "eval_time") so that path-follow works */
-			if(partype == PAR_FOLLOW) {
+			if (partype == PAR_FOLLOW) {
 				/* get or create F-Curve */
 				bAction *act = verify_adt_action(&cu->id, 1);
 				FCurve *fcu = verify_fcurve(act, NULL, "eval_time", 0, 1);
 				
-				/* setup dummy 'generator' modifier here to get 1-1 correspondance still working */
+				/* setup dummy 'generator' modifier here to get 1-1 correspondence still working */
 				if (!fcu->bezt && !fcu->fpt && !fcu->modifiers.first)
 					add_fmodifier(&fcu->modifiers, FMODIFIER_TYPE_GENERATOR);
 			}
 			
 			/* fall back on regular parenting now (for follow only) */
-			if(partype == PAR_FOLLOW)
+			if (partype == PAR_FOLLOW)
 				partype= PAR_OBJECT;
 		}		
 	}
-	else if(partype==PAR_BONE) {
+	else if (partype==PAR_BONE) {
 		pchan= get_active_posechannel(par);
 		
-		if(pchan==NULL) {
-			BKE_report(op->reports, RPT_ERROR, "No active Bone");
+		if (pchan==NULL) {
+			BKE_report(reports, RPT_ERROR, "No active Bone");
 			return 0;
 		}
 	}
 	
-	/* context iterator */
-	CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) 
-	{
-		if (ob!=par) {
-			if (BKE_object_parent_loop_check(par, ob)) {
-				BKE_report(op->reports, RPT_ERROR, "Loop in parents");
+	if (ob!=par) {
+		if (BKE_object_parent_loop_check(par, ob)) {
+			BKE_report(reports, RPT_ERROR, "Loop in parents");
+			return 0;
+		}
+		else {
+			Object workob;
+			
+			/* apply transformation of previous parenting */
+			/* object_apply_mat4(ob, ob->obmat); */ /* removed because of bug [#23577] */
+			
+			/* set the parent (except for follow-path constraint option) */
+			if (partype != PAR_PATH_CONST) {
+				ob->parent= par;
 			}
-			else {
-				Object workob;
-				
-				/* apply transformation of previous parenting */
-				/* object_apply_mat4(ob, ob->obmat); */ /* removed because of bug [#23577] */
+			
+			/* handle types */
+			if (pchan)
+				BLI_strncpy(ob->parsubstr, pchan->name, sizeof(ob->parsubstr));
+			else
+				ob->parsubstr[0]= 0;
 				
-				/* set the parent (except for follow-path constraint option) */
-				if (partype != PAR_PATH_CONST) {
-					ob->parent= par;
-				}
+			if (partype == PAR_PATH_CONST) {
+				/* don't do anything here, since this is not technically "parenting" */
+			}
+			else if (ELEM(partype, PAR_CURVE, PAR_LATTICE) || (pararm)) {
+				/* partype is now set to PAROBJECT so that invisible 'virtual' modifiers don't need to be created
+				 * 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 */
 				
-				/* handle types */
-				if (pchan)
-					BLI_strncpy(ob->parsubstr, pchan->name, sizeof(ob->parsubstr));
-				else
-					ob->parsubstr[0]= 0;
-					
-				if (partype == PAR_PATH_CONST) {
-					/* don't do anything here, since this is not technically "parenting" */
-				}
-				else if (ELEM(partype, PAR_CURVE, PAR_LATTICE) || (pararm))
-				{
-					/* partype is now set to PAROBJECT so that invisible 'virtual' modifiers don't need to be created
-					 * 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 */
+				/* BUT, to keep the deforms, we need a modifier, and then we need to set the object that it uses */
+				// 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;
 					
-					/* BUT, to keep the deforms, we need a modifier, and then we need to set the object that it uses */
-					// 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(op->reports, bmain, scene, ob, NULL, eModifierType_Curve);
-							((CurveModifierData *)md)->object= par;
-							break;
-						case PAR_LATTICE: /* lattice deform */
-							md= ED_object_modifier_add(op->reports, bmain, scene, ob, NULL, eModifierType_Lattice);
-							((LatticeModifierData *)md)->object= par;
-							break;
-						default: /* armature deform */
-							md= ED_object_modifier_add(op->reports, bmain, scene, ob, NULL, eModifierType_Armature);
-							((ArmatureModifierData *)md)->object= par;
-							break;
-						}
+					switch (partype) {
+					case PAR_CURVE: /* curve deform */
+						md= ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Curve);
+						((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;
+						break;
+					default: /* armature deform */
+						md= ED_object_modifier_add(reports, bmain, scene, ob, NULL, eModifierType_Armature);
+						((ArmatureModifierData *)md)->object= par;
+						break;
 					}
 				}
-				else if (partype == PAR_BONE)
-					ob->partype= PARBONE; /* note, dna define, not operator property */
-				else
-					ob->partype= PAROBJECT;	/* note, dna define, not operator property */
+			}
+			else if (partype == PAR_BONE)
+				ob->partype= PARBONE; /* note, dna define, not operator property */
+			else
+				ob->partype= PAROBJECT;	/* note, dna define, not operator property */
+			
+			/* constraint */
+			if (partype == PAR_PATH_CONST) {
+				bConstraint *con;
+				bFollowPathConstraint *data;
+				float cmat[4][4], vec[3];
 				
-				/* constraint */
-				if(partype == PAR_PATH_CONST) {
-					bConstraint *con;
-					bFollowPathConstraint *data;
-					float cmat[4][4], vec[3];
-					
-					con = add_ob_constraint(ob, "AutoPath", CONSTRAINT_TYPE_FOLLOWPATH);
-					
-					data = con->data;
-					data->tar = par;
-					
-					get_constraint_target_matrix(scene, con, 0, CONSTRAINT_OBTYPE_OBJECT, NULL, cmat, scene->r.cfra);
-					sub_v3_v3v3(vec, ob->obmat[3], cmat[3]);
-					
-					ob->loc[0] = vec[0];
-					ob->loc[1] = vec[1];
-					ob->loc[2] = vec[2];
-				}
-				else if(pararm && ob->type==OB_MESH && par->type == OB_ARMATURE) {
-					if(partype == PAR_ARMATURE_NAME)
-						create_vgroups_from_armature(op->reports, scene, ob, par, ARM_GROUPS_NAME, 0);
-					else if(partype == PAR_ARMATURE_ENVELOPE)
-						create_vgroups_from_armature(op->reports, scene, ob, par, ARM_GROUPS_ENVELOPE, 0);
-					else if(partype == PAR_ARMATURE_AUTO) {
-						WM_cursor_wait(1);
-						create_vgroups_from_armature(op->reports, scene, ob, par, ARM_GROUPS_AUTO, 0);
-						WM_cursor_wait(0);
-					}
-					/* get corrected inverse */
-					ob->partype= PAROBJECT;
-					what_does_parent(scene, ob, &workob);
-					
-					invert_m4_m4(ob->parentinv, workob.obmat);
-				}
-				else {
-					/* calculate inverse parent matrix */
-					what_does_parent(scene, ob, &workob);
-					invert_m4_m4(ob->parentinv, workob.obmat);
+				con = add_ob_constraint(ob, "AutoPath", CONSTRAINT_TYPE_FOLLOWPATH);
+				
+				data = con->data;
+				data->tar = par;
+				
+				get_constraint_target_matrix(scene, con, 0, CONSTRAINT_OBTYPE_OBJECT, NULL, cmat, scene->r.cfra);
+				sub_v3_v3v3(vec, ob->obmat[3], cmat[3]);
+				
+				ob->loc[0] = vec[0];
+				ob->loc[1] = vec[1];
+				ob->loc[2] = vec[2];
+			}
+			else if (pararm && ob->type==OB_MESH && par->type == OB_ARMATURE) {
+				if (partype == PAR_ARMATURE_NAME)
+					create_vgroups_from_armature(reports, scene, ob, par, ARM_GROUPS_NAME, 0);
+				else if (partype == PAR_ARMATURE_ENVELOPE)
+					create_vgroups_from_armature(reports, scene, ob, par, ARM_GROUPS_ENVELOPE, 0);
+				else if (partype == PAR_ARMATURE_AUTO) {
+					WM_cursor_wait(1);
+					create_vgroups_from_armature(reports, scene, ob, par, ARM_GROUPS_AUTO, 0);
+					WM_cursor_wait(0);
 				}
+				/* get corrected inverse */
+				ob->partype= PAROBJECT;
+				what_does_parent(scene, ob, &workob);
 				
-				ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA;
+				invert_m4_m4(ob->parentinv, workob.obmat);
+			}
+			else {
+				/* calculate inverse parent matrix */
+				what_does_parent(scene, ob, &workob);
+				invert_m4_m4(ob->parentinv, workob.obmat);
 			}
+			
+			ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA;
 		}
 	}
-	CTX_DATA_END;
-
-	DAG_scene_sort(bmain, scene);
-	DAG_ids_flush_update(bmain, 0);
-	WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
-	WM_event_add_notifier(C, NC_OBJECT|ND_PARENT, NULL);
 
 	return 1;
 }
 
 static int parent_set_exec(bContext *C, wmOperator *op)
 {
+	Main *bmain= CTX_data_main(C);
+	Scene *scene= CTX_data_scene(C);
 	Object *par= ED_object_active_context(C);
 	int partype= RNA_enum_get(op->ptr, "type");
+	int ok = 1;
 
-	if(ED_object_parent_set(C, op, par, partype))
-		return OPERATOR_FINISHED;
-	else
+	CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
+	{
+		if (!ED_object_parent_set(op->reports, bmain, scene, ob, par, partype)) {
+			ok = 0;
+			break;
+		}
+	}
+	CTX_DATA_END;
+
+	if (!ok)
 		return OPERATOR_CANCELLED;
+
+	DAG_scene_sort(bmain, scene);
+	DAG_ids_flush_update(bmain, 0);
+	WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+	WM_event_add_notifier(C, NC_OBJECT|ND_PARENT, NULL);
+
+	return OPERATOR_FINISHED;
 }
 
 
@@ -706,19 +705,19 @@ static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSE
 	uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_OBJECT);
 	
 	/* ob becomes parent, make the associated menus */
-	if(ob->type==OB_ARMATURE) {
+	if (ob->type==OB_ARMATURE) {
 		uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_ARMATURE);
 		uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_ARMATURE_NAME);
 		uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_ARMATURE_ENVELOPE);
 		uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_ARMATURE_AUTO);
 		uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_BONE);
 	}
-	else if(ob->type==OB_CURVE) {
+	else if (ob->type==OB_CURVE) {
 		uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_CURVE);
 		uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_FOLLOW);
 		uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_PATH_CONST);
 	}
-	else if(ob->type == OB_LATTICE) {
+	else if (ob->type == OB_LATTICE) {
 		uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_LATTICE);
 	}
 	
@@ -731,18 +730,18 @@ static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSE
 void OBJECT_OT_parent_set(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Make Parent";
+	ot->name = "Make Parent";
 	ot->description = "Set the object's parenting";
-	ot->idname= "OBJECT_OT_parent_set";
+	ot->idname = "OBJECT_OT_parent_set";
 	
 	/* api callbacks */
-	ot->invoke= parent_set_invoke;
-	ot->exec= parent_set_exec;
+	ot->invoke = parent_set_invoke;
+	ot->exec = parent_set_exec;
 	
-	ot->poll= ED_operator_object_active;
+	ot->poll = ED_operator_object_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	RNA_def_enum(ot->srna, "type", prop_make_parent_types, 0, "Type", "");
 }
@@ -788,17 +787,17 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_parent_no_inverse_set(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Make Parent without Inverse";
+	ot->name = "Make Parent without Inverse";
 	ot->description = "Set the object's parenting without setting the inverse parent correction";
-	ot->idname= "OBJECT_OT_parent_no_inverse_set";
+	ot->idname = "OBJECT_OT_parent_no_inverse_set";
 	
 	/* api callbacks */
-	ot->invoke= WM_operator_confirm;
-	ot->exec= parent_noinv_set_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->invoke = WM_operator_confirm;
+	ot->exec = parent_noinv_set_exec;
+	ot->poll = ED_operator_object_active_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /************************ Clear Slow Parent Operator *********************/
@@ -809,8 +808,8 @@ static int object_slow_parent_clear_exec(bContext *C, wmOperator *UNUSED(op))
 	Scene *scene= CTX_data_scene(C);
 
 	CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
-		if(ob->parent) {
-			if(ob->partype & PARSLOW) {
+		if (ob->parent) {
+			if (ob->partype & PARSLOW) {
 				ob->partype -= PARSLOW;
 				where_is_object(scene, ob);
 				ob->partype |= PARSLOW;
@@ -830,17 +829,17 @@ void OBJECT_OT_slow_parent_clear(wmOperatorType *ot)
 {
 	
 	/* identifiers */
-	ot->name= "Clear Slow Parent";
+	ot->name = "Clear Slow Parent";
 	ot->description = "Clear the object's slow parent";
-	ot->idname= "OBJECT_OT_slow_parent_clear";
+	ot->idname = "OBJECT_OT_slow_parent_clear";
 	
 	/* api callbacks */
-	ot->invoke= WM_operator_confirm;
-	ot->exec= object_slow_parent_clear_exec;
-	ot->poll= ED_operator_view3d_active;
+	ot->invoke = WM_operator_confirm;
+	ot->exec = object_slow_parent_clear_exec;
+	ot->poll = ED_operator_view3d_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************** Make Slow Parent Operator *********************/
@@ -851,7 +850,7 @@ static int object_slow_parent_set_exec(bContext *C, wmOperator *UNUSED(op))
 	Scene *scene= CTX_data_scene(C);
 
 	CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
-		if(ob->parent)
+		if (ob->parent)
 			ob->partype |= PARSLOW;
 
 		ob->recalc |= OB_RECALC_OB;
@@ -869,17 +868,17 @@ void OBJECT_OT_slow_parent_set(wmOperatorType *ot)
 {
 	
 	/* identifiers */
-	ot->name= "Set Slow Parent";
+	ot->name = "Set Slow Parent";
 	ot->description = "Set the object's slow parent";
-	ot->idname= "OBJECT_OT_slow_parent_set";
+	ot->idname = "OBJECT_OT_slow_parent_set";
 	
 	/* api callbacks */
-	ot->invoke= WM_operator_confirm;
-	ot->exec= object_slow_parent_set_exec;
-	ot->poll= ED_operator_view3d_active;
+	ot->invoke = WM_operator_confirm;
+	ot->exec = object_slow_parent_set_exec;
+	ot->poll = ED_operator_view3d_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ******************** Clear Track Operator ******************* */
@@ -897,7 +896,7 @@ static int object_track_clear_exec(bContext *C, wmOperator *op)
 	Scene *scene= CTX_data_scene(C);
 	int type= RNA_enum_get(op->ptr, "type");
 
-	if(CTX_data_edit_object(C)) {
+	if (CTX_data_edit_object(C)) {
 		BKE_report(op->reports, RPT_ERROR, "Operation cannot be performed in EditMode");
 		return OPERATOR_CANCELLED;
 	}
@@ -915,7 +914,7 @@ static int object_track_clear_exec(bContext *C, wmOperator *op)
 				remove_constraint(&ob->constraints, con);
 		}
 		
-		if(type == 1)
+		if (type == 1)
 			object_apply_mat4(ob, ob->obmat, TRUE, TRUE);
 	}
 	CTX_DATA_END;
@@ -930,20 +929,20 @@ static int object_track_clear_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_track_clear(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear track";
+	ot->name = "Clear track";
 	ot->description = "Clear tracking constraint or flag from object";
-	ot->idname= "OBJECT_OT_track_clear";
+	ot->idname = "OBJECT_OT_track_clear";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= object_track_clear_exec;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = object_track_clear_exec;
 	
-	ot->poll= ED_operator_objectmode;
+	ot->poll = ED_operator_objectmode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_clear_track_types, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_clear_track_types, 0, "Type", "");
 }
 
 /************************** Make Track Operator *****************************/
@@ -963,12 +962,12 @@ static int track_set_exec(bContext *C, wmOperator *op)
 	
 	int type= RNA_enum_get(op->ptr, "type");
 	
-	if(type == 1) {
+	if (type == 1) {
 		bConstraint *con;
 		bDampTrackConstraint *data;
 
 		CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
-			if(ob!=obact) {
+			if (ob!=obact) {
 				con = add_ob_constraint(ob, "AutoTrack", CONSTRAINT_TYPE_DAMPTRACK);
 
 				data = con->data;
@@ -982,12 +981,12 @@ static int track_set_exec(bContext *C, wmOperator *op)
 		}
 		CTX_DATA_END;
 	}
-	else if(type == 2) {
+	else if (type == 2) {
 		bConstraint *con;
 		bTrackToConstraint *data;
 
 		CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
-			if(ob!=obact) {
+			if (ob!=obact) {
 				con = add_ob_constraint(ob, "AutoTrack", CONSTRAINT_TYPE_TRACKTO);
 
 				data = con->data;
@@ -1003,12 +1002,12 @@ static int track_set_exec(bContext *C, wmOperator *op)
 		}
 		CTX_DATA_END;
 	}
-	else if(type == 3) {
+	else if (type == 3) {
 		bConstraint *con;
 		bLockTrackConstraint *data;
 
 		CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
-			if(ob!=obact) {
+			if (ob!=obact) {
 				con = add_ob_constraint(ob, "AutoTrack", CONSTRAINT_TYPE_LOCKTRACK);
 
 				data = con->data;
@@ -1035,21 +1034,21 @@ static int track_set_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_track_set(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Make Track";
+	ot->name = "Make Track";
 	ot->description = "Make the object track another object, either by constraint or old way or locked track";
-	ot->idname= "OBJECT_OT_track_set";
+	ot->idname = "OBJECT_OT_track_set";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= track_set_exec;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = track_set_exec;
 	
-	ot->poll= ED_operator_objectmode;
+	ot->poll = ED_operator_objectmode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_make_track_types, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_make_track_types, 0, "Type", "");
 }
 
 /************************** Move to Layer Operator *****************************/
@@ -1059,14 +1058,14 @@ static unsigned int move_to_layer_init(bContext *C, wmOperator *op)
 	int values[20], a;
 	unsigned int lay= 0;
 
-	if(!RNA_struct_property_is_set(op->ptr, "layers")) {
+	if (!RNA_struct_property_is_set(op->ptr, "layers")) {
 		/* note: layers are set in bases, library objects work for this */
 		CTX_DATA_BEGIN(C, Base*, base, selected_bases) {
 			lay |= base->lay;
 		}
 		CTX_DATA_END;
 
-		for(a=0; a<20; a++)
+		for (a=0; a<20; a++)
 			values[a]= (lay & (1<<a));
 		
 		RNA_boolean_set_array(op->ptr, "layers", values);
@@ -1074,8 +1073,8 @@ static unsigned int move_to_layer_init(bContext *C, wmOperator *op)
 	else {
 		RNA_boolean_get_array(op->ptr, "layers", values);
 
-		for(a=0; a<20; a++)
-			if(values[a])
+		for (a=0; a<20; a++)
+			if (values[a])
 				lay |= (1 << a);
 	}
 
@@ -1085,7 +1084,7 @@ static unsigned int move_to_layer_init(bContext *C, wmOperator *op)
 static int move_to_layer_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 	View3D *v3d= CTX_wm_view3d(C);
-	if(v3d && v3d->localvd) {
+	if (v3d && v3d->localvd) {
 		return WM_operator_confirm_message(C, op, "Move from localview");
 	}
 	else {
@@ -1105,9 +1104,9 @@ static int move_to_layer_exec(bContext *C, wmOperator *op)
 	lay= move_to_layer_init(C, op);
 	lay &= 0xFFFFFF;
 
-	if(lay==0) return OPERATOR_CANCELLED;
+	if (lay==0) return OPERATOR_CANCELLED;
 	
-	if(v3d && v3d->localvd) {
+	if (v3d && v3d->localvd) {
 		/* now we can move out of localview. */
 		/* note: layers are set in bases, library objects work for this */
 		CTX_DATA_BEGIN(C, Base*, base, selected_bases) {
@@ -1116,7 +1115,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) islamp= 1; */
+			/* if (base->object->type==OB_LAMP) islamp= 1; */
 		}
 		CTX_DATA_END;
 	}
@@ -1128,7 +1127,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) islamp= 1; */
+			/* if (base->object->type==OB_LAMP) islamp= 1; */
 		}
 		CTX_DATA_END;
 	}
@@ -1146,17 +1145,17 @@ static int move_to_layer_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_move_to_layer(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Move to Layer";
+	ot->name = "Move to Layer";
 	ot->description = "Move the object to different layers";
-	ot->idname= "OBJECT_OT_move_to_layer";
+	ot->idname = "OBJECT_OT_move_to_layer";
 	
 	/* api callbacks */
-	ot->invoke= move_to_layer_invoke;
-	ot->exec= move_to_layer_exec;
-	ot->poll= ED_operator_objectmode;
+	ot->invoke = move_to_layer_invoke;
+	ot->exec = move_to_layer_exec;
+	ot->poll = ED_operator_objectmode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_boolean_layer_member(ot->srna, "layers", 20, NULL, "Layer", "");
@@ -1170,11 +1169,11 @@ static void link_to_scene(Main *UNUSED(bmain), unsigned short UNUSED(nr))
 	Scene *sce= (Scene*) BLI_findlink(&bmain->scene, G.curscreen->scenenr-1);
 	Base *base, *nbase;
 	
-	if(sce==0) return;
-	if(sce->id.lib) return;
+	if (sce==0) return;
+	if (sce->id.lib) return;
 	
-	for(base= FIRSTBASE; base; base= base->next) {
-		if(TESTBASE(v3d, base)) {
+	for (base= FIRSTBASE; base; base= base->next) {
+		if (TESTBASE(v3d, base)) {
 			
 			nbase= MEM_mallocN( sizeof(Base), "newbase");
 			*nbase= *base;
@@ -1190,24 +1189,24 @@ static int make_links_scene_exec(bContext *C, wmOperator *op)
 	Main *bmain= CTX_data_main(C);
 	Scene *scene_to= BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene"));
 
-	if(scene_to==NULL) {
+	if (scene_to==NULL) {
 		BKE_report(op->reports, RPT_ERROR, "Scene not found");
 		return OPERATOR_CANCELLED;
 	}
 
-	if(scene_to == CTX_data_scene(C)) {
+	if (scene_to == CTX_data_scene(C)) {
 		BKE_report(op->reports, RPT_ERROR, "Can't link objects into the same scene");
 		return OPERATOR_CANCELLED;
 	}
 
-	if(scene_to->id.lib) {
+	if (scene_to->id.lib) {
 		BKE_report(op->reports, RPT_ERROR, "Can't link objects into a linked scene");
 		return OPERATOR_CANCELLED;
 	}
 
 	CTX_DATA_BEGIN(C, Base*, base, selected_bases)
 	{
-		if(!object_in_scene(base->object, scene_to)) {
+		if (!object_in_scene(base->object, scene_to)) {
 			Base *nbase= MEM_mallocN( sizeof(Base), "newbase");
 			*nbase= *base;
 			BLI_addhead( &(scene_to->base), nbase);
@@ -1267,7 +1266,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
 	ob= ED_object_active_context(C);
 
 	CTX_DATA_BEGIN(C, Object*, obt, selected_editable_objects) {
-		if(ob != obt) {
+		if (ob != obt) {
 			if (allow_make_links_data(event, ob, obt)) {
 				switch(event) {
 				case MAKE_LINKS_OBDATA: /* obdata */
@@ -1285,7 +1284,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
 					break;
 				case MAKE_LINKS_MATERIALS:
 					/* new approach, using functions from kernel */
-					for(a=0; a<ob->totcol; a++) {
+					for (a=0; a<ob->totcol; a++) {
 						Material *ma= give_current_material(ob, a+1);
 						assign_material(obt, ma, a+1);	/* also works with ma==NULL */
 					}
@@ -1296,7 +1295,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op)
 					break;
 				case MAKE_LINKS_DUPLIGROUP:
 					obt->dup_group= ob->dup_group;
-					if(obt->dup_group) {
+					if (obt->dup_group) {
 						id_lib_extern(&obt->dup_group->id);
 						obt->transflag |= OB_DUPLIGROUP;
 					}
@@ -1324,22 +1323,22 @@ void OBJECT_OT_make_links_scene(wmOperatorType *ot)
 	PropertyRNA *prop;
 
 	/* identifiers */
-	ot->name= "Link Objects to Scene";
+	ot->name = "Link Objects to Scene";
 	ot->description = "Link selection to another scene";
-	ot->idname= "OBJECT_OT_make_links_scene";
+	ot->idname = "OBJECT_OT_make_links_scene";
 
 	/* api callbacks */
-	ot->invoke= WM_enum_search_invoke;
-	ot->exec= make_links_scene_exec;
+	ot->invoke = WM_enum_search_invoke;
+	ot->exec = make_links_scene_exec;
 	/* better not run the poll check */
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	prop= RNA_def_enum(ot->srna, "scene", DummyRNA_NULL_items, 0, "Scene", "");
 	RNA_def_enum_funcs(prop, RNA_scene_local_itemf);
-	ot->prop= prop;
+	ot->prop = prop;
 }
 
 void OBJECT_OT_make_links_data(wmOperatorType *ot)
@@ -1353,19 +1352,19 @@ void OBJECT_OT_make_links_data(wmOperatorType *ot)
 		{0, NULL, 0, NULL, NULL}};
 
 	/* identifiers */
-	ot->name= "Link Data";
+	ot->name = "Link Data";
 	ot->description = "Make links from the active object to other selected objects";
-	ot->idname= "OBJECT_OT_make_links_data";
+	ot->idname = "OBJECT_OT_make_links_data";
 
 	/* api callbacks */
-	ot->exec= make_links_data_exec;
-	ot->poll= ED_operator_object_active;
+	ot->exec = make_links_data_exec;
+	ot->poll = ED_operator_object_active;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
-	ot->prop= RNA_def_enum(ot->srna, "type", make_links_items, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", make_links_items, 0, "Type", "");
 }
 
 
@@ -1379,7 +1378,7 @@ static void single_object_users(Scene *scene, View3D *v3d, int flag)
 	clear_sca_new_poins();	/* sensor/contr/act */
 
 	/* duplicate (must set newid) */
-	for(base= FIRSTBASE; base; base= base->next) {
+	for (base= FIRSTBASE; base; base= base->next) {
 		ob= base->object;
 		
 		/* newid may still have some trash from Outliner tree building,
@@ -1387,8 +1386,8 @@ static void single_object_users(Scene *scene, View3D *v3d, int flag)
 		 */
 		ob->id.newid = NULL;
 		
-		if( (base->flag & flag)==flag ) {
-			if(ob->id.lib==NULL && ob->id.us>1) {
+		if ( (base->flag & flag)==flag ) {
+			if (ob->id.lib==NULL && ob->id.us>1) {
 				/* base gets copy of object */
 				obn= copy_object(ob);
 				base->object= obn;
@@ -1398,10 +1397,10 @@ static void single_object_users(Scene *scene, View3D *v3d, int flag)
 	}
 	
 	ID_NEW(scene->camera);
-	if(v3d) ID_NEW(v3d->camera);
+	if (v3d) ID_NEW(v3d->camera);
 	
 	/* object pointers */
-	for(base= FIRSTBASE; base; base= base->next) {
+	for (base= FIRSTBASE; base; base= base->next) {
 		object_relink(base->object);
 	}
 
@@ -1414,8 +1413,8 @@ void ED_object_single_user(Scene *scene, Object *ob)
 {
 	Base *base;
 
-	for(base= FIRSTBASE; base; base= base->next) {
-		if(base->object == ob)  base->flag |=  OB_DONE;
+	for (base= FIRSTBASE; base; base= base->next) {
+		if (base->object == ob)  base->flag |=  OB_DONE;
 		else					base->flag &= ~OB_DONE;
 	}
 
@@ -1427,15 +1426,15 @@ static void new_id_matar(Material **matar, int totcol)
 	ID *id;
 	int a;
 	
-	for(a=0; a<totcol; a++) {
+	for (a=0; a<totcol; a++) {
 		id= (ID *)matar[a];
-		if(id && id->lib == NULL) {
-			if(id->newid) {
+		if (id && id->lib == NULL) {
+			if (id->newid) {
 				matar[a]= (Material *)id->newid;
 				id_us_plus(id->newid);
 				id->us--;
 			}
-			else if(id->us>1) {
+			else if (id->us>1) {
 				matar[a]= copy_material(matar[a]);
 				id->us--;
 				id->newid= (ID *)matar[a];
@@ -1455,12 +1454,12 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag)
 	ID *id;
 	int a;
 
-	for(base= FIRSTBASE; base; base= base->next) {
+	for (base= FIRSTBASE; base; base= base->next) {
 		ob= base->object;
-		if(ob->id.lib==NULL && (base->flag & flag)==flag ) {
+		if (ob->id.lib==NULL && (base->flag & flag)==flag ) {
 			id= ob->data;
 			
-			if(id && id->us>1 && id->lib==NULL) {
+			if (id && id->us>1 && id->lib==NULL) {
 				ob->recalc= OB_RECALC_DATA;
 				
 				BKE_copy_animdata_id_action(id);
@@ -1468,8 +1467,8 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag)
 				switch(ob->type) {
 				case OB_LAMP:
 					ob->data= la= copy_lamp(ob->data);
-					for(a=0; a<MAX_MTEX; a++) {
-						if(la->mtex[a]) {
+					for (a=0; a<MAX_MTEX; a++) {
+						if (la->mtex[a]) {
 							ID_NEW(la->mtex[a]->object);
 						}
 					}
@@ -1480,7 +1479,7 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag)
 				case OB_MESH:
 					ob->data= copy_mesh(ob->data);
 					//me= ob->data;
-					//if(me && me->key)
+					//if (me && me->key)
 					//	ipo_idnew(me->key->ipo);	/* drivers */
 					break;
 				case OB_MBALL:
@@ -1505,8 +1504,8 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag)
 					ob->data= copy_speaker(ob->data);
 					break;
 				default:
-					if (G.f & G_DEBUG)
-						printf("ERROR single_obdata_users: can't copy %s\n", id->name);
+					if (G.debug & G_DEBUG)
+						printf("ERROR %s: can't copy %s\n", __func__, id->name);
 					return;
 				}
 				
@@ -1519,7 +1518,7 @@ static void single_obdata_users(Main *bmain, Scene *scene, int flag)
 	}
 	
 	me= bmain->mesh.first;
-	while(me) {
+	while (me) {
 		ID_NEW(me->texcomesh);
 		me= me->id.next;
 	}
@@ -1530,9 +1529,9 @@ static void single_object_action_users(Scene *scene, int flag)
 	Object *ob;
 	Base *base;
 	
-	for(base= FIRSTBASE; base; base= base->next) {
+	for (base= FIRSTBASE; base; base= base->next) {
 		ob= base->object;
-		if(ob->id.lib==NULL && (flag==0 || (base->flag & SELECT)) ) {
+		if (ob->id.lib==NULL && (flag==0 || (base->flag & SELECT)) ) {
 			ob->recalc= OB_RECALC_DATA;
 			BKE_copy_animdata_id_action(&ob->id);
 		}
@@ -1547,30 +1546,30 @@ static void single_mat_users(Scene *scene, int flag, int do_textures)
 	Tex *tex;
 	int a, b;
 	
-	for(base= FIRSTBASE; base; base= base->next) {
+	for (base= FIRSTBASE; base; base= base->next) {
 		ob= base->object;
-		if(ob->id.lib==NULL && (flag==0 || (base->flag & SELECT)) ) {
+		if (ob->id.lib==NULL && (flag==0 || (base->flag & SELECT)) ) {
 	
-			for(a=1; a<=ob->totcol; a++) {
+			for (a=1; a<=ob->totcol; a++) {
 				ma= give_current_material(ob, a);
-				if(ma) {
+				if (ma) {
 					/* do not test for LIB_NEW: this functions guaranteed delivers single_users! */
 					
-					if(ma->id.us>1) {
+					if (ma->id.us>1) {
 						man= copy_material(ma);
 						BKE_copy_animdata_id_action(&man->id);
 						
 						man->id.us= 0;
 						assign_material(ob, man, a);
 
-						if(do_textures) {
-							for(b=0; b<MAX_MTEX; b++) {
-								if(ma->mtex[b] && (tex= ma->mtex[b]->tex)) {
-									if(tex->id.us>1) {
+						if (do_textures) {
+							for (b=0; b<MAX_MTEX; b++) {
+								if (ma->mtex[b] && (tex= ma->mtex[b]->tex)) {
+									if (tex->id.us>1) {
 										tex->id.us--;
 										tex= copy_texture(tex);
 										BKE_copy_animdata_id_action(&tex->id);
-										ma->mtex[b]->tex= tex;
+										man->mtex[b]->tex= tex;
 									}
 								}
 							}
@@ -1587,14 +1586,14 @@ static void do_single_tex_user(Tex **from)
 	Tex *tex, *texn;
 	
 	tex= *from;
-	if(tex==NULL) return;
+	if (tex==NULL) return;
 	
-	if(tex->id.newid) {
+	if (tex->id.newid) {
 		*from= (Tex *)tex->id.newid;
 		id_us_plus(tex->id.newid);
 		tex->id.us--;
 	}
-	else if(tex->id.us>1) {
+	else if (tex->id.us>1) {
 		texn= copy_texture(tex);
 		BKE_copy_animdata_id_action(&texn->id);
 		tex->id.newid= (ID *)texn;
@@ -1611,30 +1610,30 @@ static void single_tex_users_expand(Main *bmain)
 	World *wo;
 	int b;
 		
-	for(ma= bmain->mat.first; ma; ma=ma->id.next) {
-		if(ma->id.flag & LIB_NEW) {
-			for(b=0; b<MAX_MTEX; b++) {
-				if(ma->mtex[b] && ma->mtex[b]->tex) {
+	for (ma= bmain->mat.first; ma; ma=ma->id.next) {
+		if (ma->id.flag & LIB_NEW) {
+			for (b=0; b<MAX_MTEX; b++) {
+				if (ma->mtex[b] && ma->mtex[b]->tex) {
 					do_single_tex_user( &(ma->mtex[b]->tex) );
 				}
 			}
 		}
 	}
 
-	for(la= bmain->lamp.first; la; la=la->id.next) {
-		if(la->id.flag & LIB_NEW) {
-			for(b=0; b<MAX_MTEX; b++) {
-				if(la->mtex[b] && la->mtex[b]->tex) {
+	for (la= bmain->lamp.first; la; la=la->id.next) {
+		if (la->id.flag & LIB_NEW) {
+			for (b=0; b<MAX_MTEX; b++) {
+				if (la->mtex[b] && la->mtex[b]->tex) {
 					do_single_tex_user( &(la->mtex[b]->tex) );
 				}
 			}
 		}
 	}
 
-	for(wo= bmain->world.first; wo; wo=wo->id.next) {
-		if(wo->id.flag & LIB_NEW) {
-			for(b=0; b<MAX_MTEX; b++) {
-				if(wo->mtex[b] && wo->mtex[b]->tex) {
+	for (wo= bmain->world.first; wo; wo=wo->id.next) {
+		if (wo->id.flag & LIB_NEW) {
+			for (b=0; b<MAX_MTEX; b++) {
+				if (wo->mtex[b] && wo->mtex[b]->tex) {
 					do_single_tex_user( &(wo->mtex[b]->tex) );
 				}
 			}
@@ -1652,27 +1651,27 @@ static void single_mat_users_expand(Main *bmain)
 	Material *ma;
 	int a;
 	
-	for(ob=bmain->object.first; ob; ob=ob->id.next)
-		if(ob->id.flag & LIB_NEW)
+	for (ob=bmain->object.first; ob; ob=ob->id.next)
+		if (ob->id.flag & LIB_NEW)
 			new_id_matar(ob->mat, ob->totcol);
 
-	for(me=bmain->mesh.first; me; me=me->id.next)
-		if(me->id.flag & LIB_NEW)
+	for (me=bmain->mesh.first; me; me=me->id.next)
+		if (me->id.flag & LIB_NEW)
 			new_id_matar(me->mat, me->totcol);
 
-	for(cu=bmain->curve.first; cu; cu=cu->id.next)
-		if(cu->id.flag & LIB_NEW)
+	for (cu=bmain->curve.first; cu; cu=cu->id.next)
+		if (cu->id.flag & LIB_NEW)
 			new_id_matar(cu->mat, cu->totcol);
 
-	for(mb=bmain->mball.first; mb; mb=mb->id.next)
-		if(mb->id.flag & LIB_NEW)
+	for (mb=bmain->mball.first; mb; mb=mb->id.next)
+		if (mb->id.flag & LIB_NEW)
 			new_id_matar(mb->mat, mb->totcol);
 
 	/* material imats  */
-	for(ma=bmain->mat.first; ma; ma=ma->id.next)
-		if(ma->id.flag & LIB_NEW)
-			for(a=0; a<MAX_MTEX; a++)
-				if(ma->mtex[a])
+	for (ma=bmain->mat.first; ma; ma=ma->id.next)
+		if (ma->id.flag & LIB_NEW)
+			for (a=0; a<MAX_MTEX; a++)
+				if (ma->mtex[a])
 					ID_NEW(ma->mtex[a]->object);
 }
 
@@ -1681,7 +1680,7 @@ void ED_object_single_users(Main *bmain, Scene *scene, int full)
 {
 	single_object_users(scene, NULL, 0);
 
-	if(full) {
+	if (full) {
 		single_obdata_users(bmain, scene, 0);
 		single_object_action_users(scene, 0);
 		single_mat_users_expand(bmain);
@@ -1701,12 +1700,12 @@ static void make_local_makelocalmaterial(Material *ma)
 	
 	id_make_local(&ma->id, 0);
 	
-	for(b=0; b<MAX_MTEX; b++)
-		if(ma->mtex[b] && ma->mtex[b]->tex)
+	for (b=0; b<MAX_MTEX; b++)
+		if (ma->mtex[b] && ma->mtex[b]->tex)
 			id_make_local(&ma->mtex[b]->tex->id, 0);
 	
 	adt= BKE_animdata_from_id(&ma->id);
-	if(adt) BKE_animdata_make_local(adt);
+	if (adt) BKE_animdata_make_local(adt);
 
 	/* nodetree? XXX */
 }
@@ -1721,7 +1720,7 @@ static int make_local_exec(bContext *C, wmOperator *op)
 	ID *id;
 	int a, b, mode= RNA_enum_get(op->ptr, "type");
 	
-	if(mode==3) {
+	if (mode==3) {
 		BKE_library_make_local(bmain, NULL, 0);	/* NULL is all libs */
 		WM_event_add_notifier(C, NC_WINDOW, NULL);
 		return OPERATOR_FINISHED;
@@ -1730,14 +1729,14 @@ static int make_local_exec(bContext *C, wmOperator *op)
 	clear_id_newpoins();
 	
 	CTX_DATA_BEGIN(C, Object*, ob, selected_objects) {
-		if(ob->id.lib)
+		if (ob->id.lib)
 			id_make_local(&ob->id, 0);
 	}
 	CTX_DATA_END;
 	
 	/* maybe object pointers */
 	CTX_DATA_BEGIN(C, Object*, ob, selected_objects) {
-		if(ob->id.lib==NULL) {
+		if (ob->id.lib==NULL) {
 			ID_NEW(ob->parent);
 		}
 	}
@@ -1746,51 +1745,51 @@ static int make_local_exec(bContext *C, wmOperator *op)
 	CTX_DATA_BEGIN(C, Object*, ob, selected_objects) {
 		id= ob->data;
 			
-		if(id && mode>1) {
+		if (id && mode>1) {
 			id_make_local(id, 0);
 			adt= BKE_animdata_from_id(id);
-			if(adt) BKE_animdata_make_local(adt);
+			if (adt) BKE_animdata_make_local(adt);
 			
 			/* tag indirect data direct */
 			matarar= (Material ***)give_matarar(ob);
-			if(matarar) {
-				for(a=0; a<ob->totcol; a++) {
+			if (matarar) {
+				for (a=0; a<ob->totcol; a++) {
 					ma= (*matarar)[a];
-					if(ma)
+					if (ma)
 						id_lib_extern(&ma->id);
 				}
 			}
 		}
 
-		for(psys=ob->particlesystem.first; psys; psys=psys->next)
+		for (psys=ob->particlesystem.first; psys; psys=psys->next)
 			id_make_local(&psys->part->id, 0);
 
 		adt= BKE_animdata_from_id(&ob->id);
-		if(adt) BKE_animdata_make_local(adt);
+		if (adt) BKE_animdata_make_local(adt);
 	}
 	CTX_DATA_END;
 
-	if(mode>1) {
+	if (mode>1) {
 		CTX_DATA_BEGIN(C, Object*, ob, selected_objects) {
-			if(ob->type==OB_LAMP) {
+			if (ob->type==OB_LAMP) {
 				la= ob->data;
 
-				for(b=0; b<MAX_MTEX; b++)
-					if(la->mtex[b] && la->mtex[b]->tex)
+				for (b=0; b<MAX_MTEX; b++)
+					if (la->mtex[b] && la->mtex[b]->tex)
 						id_make_local(&la->mtex[b]->tex->id, 0);
 			}
 			else {
-				for(a=0; a<ob->totcol; a++) {
+				for (a=0; a<ob->totcol; a++) {
 					ma= ob->mat[a];
-					if(ma)
+					if (ma)
 						make_local_makelocalmaterial(ma);
 				}
 				
 				matarar= (Material ***)give_matarar(ob);
-				if(matarar) {
-					for(a=0; a<ob->totcol; a++) {
+				if (matarar) {
+					for (a=0; a<ob->totcol; a++) {
 						ma= (*matarar)[a];
-						if(ma)
+						if (ma)
 							make_local_makelocalmaterial(ma);
 					}
 				}
@@ -1813,20 +1812,20 @@ void OBJECT_OT_make_local(wmOperatorType *ot)
 		{0, NULL, 0, NULL, NULL}};
 
 	/* identifiers */
-	ot->name= "Make Local";
+	ot->name = "Make Local";
 	ot->description = "Make library linked datablocks local to this file";
-	ot->idname= "OBJECT_OT_make_local";
+	ot->idname = "OBJECT_OT_make_local";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= make_local_exec;
-	ot->poll= ED_operator_objectmode;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = make_local_exec;
+	ot->poll = ED_operator_objectmode;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
-	ot->prop= RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "");
 }
 
 static int make_single_user_exec(bContext *C, wmOperator *op)
@@ -1836,20 +1835,20 @@ static int make_single_user_exec(bContext *C, wmOperator *op)
 	View3D *v3d= CTX_wm_view3d(C); /* ok if this is NULL */
 	int flag= RNA_enum_get(op->ptr, "type"); /* 0==ALL, SELECTED==selected objecs */
 
-	if(RNA_boolean_get(op->ptr, "object"))
+	if (RNA_boolean_get(op->ptr, "object"))
 		single_object_users(scene, v3d, flag);
 
-	if(RNA_boolean_get(op->ptr, "obdata"))
+	if (RNA_boolean_get(op->ptr, "obdata"))
 		single_obdata_users(bmain, scene, flag);
 
-	if(RNA_boolean_get(op->ptr, "material"))
+	if (RNA_boolean_get(op->ptr, "material"))
 		single_mat_users(scene, flag, RNA_boolean_get(op->ptr, "texture"));
 
 #if 0 /* can't do this separate from materials */
-	if(RNA_boolean_get(op->ptr, "texture"))
+	if (RNA_boolean_get(op->ptr, "texture"))
 		single_mat_users(scene, flag, TRUE);
 #endif
-	if(RNA_boolean_get(op->ptr, "animation"))
+	if (RNA_boolean_get(op->ptr, "animation"))
 		single_object_action_users(scene, flag);
 
 	clear_id_newpoins();
@@ -1866,20 +1865,20 @@ void OBJECT_OT_make_single_user(wmOperatorType *ot)
 		{0, NULL, 0, NULL, NULL}};
 
 	/* identifiers */
-	ot->name= "Make Single User";
+	ot->name = "Make Single User";
 	ot->description = "Make linked data local to each object";
-	ot->idname= "OBJECT_OT_make_single_user";
+	ot->idname = "OBJECT_OT_make_single_user";
 
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= make_single_user_exec;
-	ot->poll= ED_operator_objectmode;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = make_single_user_exec;
+	ot->poll = ED_operator_objectmode;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
-	ot->prop= RNA_def_enum(ot->srna, "type", type_items, SELECT, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", type_items, SELECT, "Type", "");
 
 	RNA_def_boolean(ot->srna, "object", 0, "Object", "Make single user objects");
 	RNA_def_boolean(ot->srna, "obdata", 0, "Object Data", "Make single user object data");
@@ -1897,7 +1896,7 @@ static int drop_named_material_invoke(bContext *C, wmOperator *op, wmEvent *even
 	
 	RNA_string_get(op->ptr, "name", name);
 	ma= (Material *)find_id("MA", name);
-	if(base==NULL || ma==NULL) 
+	if (base==NULL || ma==NULL) 
 		return OPERATOR_CANCELLED;
 	
 	assign_material(base->object, ma, 1);
@@ -1914,16 +1913,16 @@ void OBJECT_OT_drop_named_material(wmOperatorType *ot)
 {
 
 	/* identifiers */
-	ot->name= "Drop Named Material on Object";
+	ot->name = "Drop Named Material on Object";
 	ot->description = "";
-	ot->idname= "OBJECT_OT_drop_named_material";
+	ot->idname = "OBJECT_OT_drop_named_material";
 	
 	/* api callbacks */
-	ot->invoke= drop_named_material_invoke;
-	ot->poll= ED_operator_objectmode;
+	ot->invoke = drop_named_material_invoke;
+	ot->poll = ED_operator_objectmode;
 	
 	/* flags */
-	ot->flag= OPTYPE_UNDO;
+	ot->flag = OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_string(ot->srna, "name", "Material", MAX_ID_NAME-2, "Name", "Material name to assign");
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index 69372ac..388766f 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -107,7 +107,7 @@ void ED_base_object_activate(bContext *C, Base *base)
 	/* sets scene->basact */
 	BASACT= base;
 	
-	if(base) {
+	if (base) {
 		
 		/* XXX old signals, remember to handle notifiers now! */
 		//		select_actionchannel_by_name(base->object->action, "Object", 1);
@@ -123,12 +123,12 @@ void ED_base_object_activate(bContext *C, Base *base)
 static int objects_selectable_poll(bContext *C)
 {
 	/* we don't check for linked scenes here, selection is
-	   still allowed then for inspection of scene */
+	 * still allowed then for inspection of scene */
 	Object *obact= CTX_data_active_object(C);
 
-	if(CTX_data_edit_object(C))
+	if (CTX_data_edit_object(C))
 		return 0;
-	if(obact && obact->mode)
+	if (obact && obact->mode)
 		return 0;
 	
 	return 1;
@@ -151,7 +151,7 @@ static int object_select_by_type_exec(bContext *C, wmOperator *op)
 	}
 	
 	CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
-		if(base->object->type==obtype) {
+		if (base->object->type==obtype) {
 			ED_base_object_select(base, BA_SELECT);
 		}
 	}
@@ -165,21 +165,21 @@ static int object_select_by_type_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_select_by_type(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select By Type";
+	ot->name = "Select By Type";
 	ot->description = "Select all visible objects that are of a type";
-	ot->idname= "OBJECT_OT_select_by_type";
+	ot->idname = "OBJECT_OT_select_by_type";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= object_select_by_type_exec;
-	ot->poll= objects_selectable_poll;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = object_select_by_type_exec;
+	ot->poll = objects_selectable_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first");
-	ot->prop= RNA_def_enum(ot->srna, "type", object_type_items, 1, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", object_type_items, 1, "Type", "");
 }
 
 /*********************** Selection by Links *********************/
@@ -225,67 +225,67 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
 	}
 	
 	ob= OBACT;
-	if(ob==NULL){ 
+	if (ob==NULL) { 
 		BKE_report(op->reports, RPT_ERROR, "No Active Object");
 		return OPERATOR_CANCELLED;
 	}
 	
-	if(nr==1) {	
+	if (nr==1) {	
 			// XXX old animation system
 		//ipo= ob->ipo;
-		//if(ipo==0) return OPERATOR_CANCELLED;
+		//if (ipo==0) return OPERATOR_CANCELLED;
 		return OPERATOR_CANCELLED;
 	}
-	else if(nr==2) {
-		if(ob->data==NULL) return OPERATOR_CANCELLED;
+	else if (nr==2) {
+		if (ob->data==NULL) return OPERATOR_CANCELLED;
 		obdata= ob->data;
 	}
-	else if(nr==3 || nr==4) {
+	else if (nr==3 || nr==4) {
 		mat= give_current_material(ob, ob->actcol);
-		if(mat==NULL) return OPERATOR_CANCELLED;
-		if(nr==4) {
-			if(mat->mtex[ (int)mat->texact ]) tex= mat->mtex[ (int)mat->texact ]->tex;
-			if(tex==NULL) return OPERATOR_CANCELLED;
+		if (mat==NULL) return OPERATOR_CANCELLED;
+		if (nr==4) {
+			if (mat->mtex[ (int)mat->texact ]) tex= mat->mtex[ (int)mat->texact ]->tex;
+			if (tex==NULL) return OPERATOR_CANCELLED;
 		}
 	}
-	else if(nr==5) {
-		if(ob->dup_group==NULL) return OPERATOR_CANCELLED;
+	else if (nr==5) {
+		if (ob->dup_group==NULL) return OPERATOR_CANCELLED;
 	}
-	else if(nr==6) {
-		if(ob->particlesystem.first==NULL) return OPERATOR_CANCELLED;
+	else if (nr==6) {
+		if (ob->particlesystem.first==NULL) return OPERATOR_CANCELLED;
 	}
-	else if(nr==7) {
+	else if (nr==7) {
 		/* do nothing */
 	}
-	else if(nr==8) {
-		if(ob->data==NULL) return OPERATOR_CANCELLED;
+	else if (nr==8) {
+		if (ob->data==NULL) return OPERATOR_CANCELLED;
 	}
 	else
 		return OPERATOR_CANCELLED;
 	
 	CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
-		if(nr==1) {
+		if (nr==1) {
 				// XXX old animation system
-			//if(base->object->ipo==ipo) base->flag |= SELECT;
+			//if (base->object->ipo==ipo) base->flag |= SELECT;
 			//changed = 1;
 		}
-		else if(nr==2) {
-			if(base->object->data==obdata) base->flag |= SELECT;
+		else if (nr==2) {
+			if (base->object->data==obdata) base->flag |= SELECT;
 			changed = 1;
 		}
-		else if(nr==3 || nr==4) {
+		else if (nr==3 || nr==4) {
 			ob= base->object;
 			
-			for(a=1; a<=ob->totcol; a++) {
+			for (a=1; a<=ob->totcol; a++) {
 				mat1= give_current_material(ob, a);
-				if(nr==3) {
-					if(mat1==mat) base->flag |= SELECT;
+				if (nr==3) {
+					if (mat1==mat) base->flag |= SELECT;
 					changed = 1;
 				}
-				else if(mat1 && nr==4) {
-					for(b=0; b<MAX_MTEX; b++) {
-						if(mat1->mtex[b]) {
-							if(tex==mat1->mtex[b]->tex) {
+				else if (mat1 && nr==4) {
+					for (b=0; b<MAX_MTEX; b++) {
+						if (mat1->mtex[b]) {
+							if (tex==mat1->mtex[b]->tex) {
 								base->flag |= SELECT;
 								changed = 1;
 								break;
@@ -295,19 +295,19 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
 				}
 			}
 		}
-		else if(nr==5) {
-			if(base->object->dup_group==ob->dup_group) {
+		else if (nr==5) {
+			if (base->object->dup_group==ob->dup_group) {
 				base->flag |= SELECT;
 				changed = 1;
 			}
 		}
-		else if(nr==6) {
+		else if (nr==6) {
 			/* loop through other, then actives particles*/
 			ParticleSystem *psys;
 			ParticleSystem *psys_act;
 			
-			for(psys=base->object->particlesystem.first; psys; psys=psys->next) {
-				for(psys_act=ob->particlesystem.first; psys_act; psys_act=psys_act->next) {
+			for (psys=base->object->particlesystem.first; psys; psys=psys->next) {
+				for (psys_act=ob->particlesystem.first; psys_act; psys_act=psys_act->next) {
 					if (psys->part == psys_act->part) {
 						base->flag |= SELECT;
 						changed = 1;
@@ -320,14 +320,14 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
 				}
 			}
 		}
-		else if(nr==7) {
-			if(ob->id.lib == base->object->id.lib) {
+		else if (nr==7) {
+			if (ob->id.lib == base->object->id.lib) {
 				base->flag |= SELECT;
 				changed= 1;
 			}
 		}
-		else if(nr==8) {
-			if(base->object->data && ((ID *)ob->data)->lib == ((ID *)base->object->data)->lib) {
+		else if (nr==8) {
+			if (base->object->data && ((ID *)ob->data)->lib == ((ID *)base->object->data)->lib) {
 				base->flag |= SELECT;
 				changed= 1;
 			}
@@ -347,21 +347,21 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_select_linked(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Linked";
+	ot->name = "Select Linked";
 	ot->description = "Select all visible objects that are linked";
-	ot->idname= "OBJECT_OT_select_linked";
+	ot->idname = "OBJECT_OT_select_linked";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= object_select_linked_exec;
-	ot->poll= objects_selectable_poll;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = object_select_linked_exec;
+	ot->poll = objects_selectable_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first");
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_select_linked_types, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_select_linked_types, 0, "Type", "");
 }
 
 /*********************** Selected Grouped ********************/
@@ -414,7 +414,7 @@ static short select_grouped_parent(bContext *C)	/* Makes parent active and de-se
 	baspar= object_in_scene(basact->object->parent, scene);
 
 	/* can be NULL if parent in other scene */
-	if(baspar && BASE_SELECTABLE(v3d, baspar)) {
+	if (baspar && BASE_SELECTABLE(v3d, baspar)) {
 		ED_base_object_select(basact, BA_DESELECT);
 		ED_base_object_select(baspar, BA_SELECT);
 		ED_base_object_activate(C, baspar);
@@ -492,7 +492,7 @@ static short select_grouped_object_hooks(bContext *C, Object *ob)
 	return changed;
 }
 
-/* Select objects woth the same parent as the active (siblings),
+/* Select objects with the same parent as the active (siblings),
  * parent can be NULL also */
 static short select_grouped_siblings(bContext *C, Object *ob)
 {
@@ -569,7 +569,7 @@ static short objects_share_gameprop(Object *a, Object *b)
 	bProperty *prop;
 	/*make a copy of all its properties*/
 
-	for( prop= a->prop.first; prop; prop = prop->next ) {
+	for ( prop= a->prop.first; prop; prop = prop->next ) {
 		if ( get_ob_property(b, prop->name) )
 			return 1;
 	}
@@ -644,23 +644,23 @@ static int object_select_grouped_exec(bContext *C, wmOperator *op)
 	}
 	
 	ob= OBACT;
-	if(ob==NULL) { 
+	if (ob==NULL) { 
 		BKE_report(op->reports, RPT_ERROR, "No Active Object");
 		return OPERATOR_CANCELLED;
 	}
 	
-	if(nr==1)		changed |= select_grouped_children(C, ob, 1);
-	else if(nr==2)	changed |= select_grouped_children(C, ob, 0);
-	else if(nr==3)	changed |= select_grouped_parent(C);
-	else if(nr==4)	changed |= select_grouped_siblings(C, ob);
-	else if(nr==5)	changed |= select_grouped_type(C, ob);
-	else if(nr==6)	changed |= select_grouped_layer(C, ob);
-	else if(nr==7)	changed |= select_grouped_group(C, ob);
-	else if(nr==8)	changed |= select_grouped_object_hooks(C, ob);
-	else if(nr==9)	changed |= select_grouped_index_object(C, ob);
-	else if(nr==10)	changed |= select_grouped_color(C, ob);
-	else if(nr==11)	changed |= select_grouped_gameprops(C, ob);
-	else if(nr==12) changed |= select_grouped_keyingset(C, ob);
+	if (nr==1)		changed |= select_grouped_children(C, ob, 1);
+	else if (nr==2)	changed |= select_grouped_children(C, ob, 0);
+	else if (nr==3)	changed |= select_grouped_parent(C);
+	else if (nr==4)	changed |= select_grouped_siblings(C, ob);
+	else if (nr==5)	changed |= select_grouped_type(C, ob);
+	else if (nr==6)	changed |= select_grouped_layer(C, ob);
+	else if (nr==7)	changed |= select_grouped_group(C, ob);
+	else if (nr==8)	changed |= select_grouped_object_hooks(C, ob);
+	else if (nr==9)	changed |= select_grouped_index_object(C, ob);
+	else if (nr==10)	changed |= select_grouped_color(C, ob);
+	else if (nr==11)	changed |= select_grouped_gameprops(C, ob);
+	else if (nr==12) changed |= select_grouped_keyingset(C, ob);
 	
 	if (changed) {
 		WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
@@ -673,21 +673,21 @@ static int object_select_grouped_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_select_grouped(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Grouped";
+	ot->name = "Select Grouped";
 	ot->description = "Select all visible objects grouped by various properties";
-	ot->idname= "OBJECT_OT_select_grouped";
+	ot->idname = "OBJECT_OT_select_grouped";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= object_select_grouped_exec;
-	ot->poll= objects_selectable_poll;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = object_select_grouped_exec;
+	ot->poll = objects_selectable_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first");
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_select_grouped_types, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_select_grouped_types, 0, "Type", "");
 }
 
 /************************* Select by Layer **********************/
@@ -708,7 +708,7 @@ static int object_select_by_layer_exec(bContext *C, wmOperator *op)
 	}
 		
 	CTX_DATA_BEGIN(C, Base*, base, visible_bases) {
-		if(base->lay == (1<< (layernum -1)))
+		if (base->lay == (1<< (layernum -1)))
 			ED_base_object_select(base, BA_SELECT);
 	}
 	CTX_DATA_END;
@@ -722,17 +722,17 @@ static int object_select_by_layer_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_select_by_layer(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select by Layer";
+	ot->name = "Select by Layer";
 	ot->description = "Select all visible objects on a layer";
-	ot->idname= "OBJECT_OT_select_by_layer";
+	ot->idname = "OBJECT_OT_select_by_layer";
 	
 	/* api callbacks */
 	/*ot->invoke = XXX - need a int grid popup*/
-	ot->exec= object_select_by_layer_exec;
-	ot->poll= objects_selectable_poll;
+	ot->exec = object_select_by_layer_exec;
+	ot->poll = objects_selectable_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first");
@@ -770,7 +770,8 @@ static int object_select_all_exec(bContext *C, wmOperator *op)
 		case SEL_INVERT:
 			if (base->flag & SELECT) {
 				ED_base_object_select(base, BA_DESELECT);
-			} else {
+			}
+			else {
 				ED_base_object_select(base, BA_SELECT);
 			}
 			break;
@@ -787,16 +788,16 @@ void OBJECT_OT_select_all(wmOperatorType *ot)
 {
 	
 	/* identifiers */
-	ot->name= "Select or Deselect All";
+	ot->name = "(De)select All";
 	ot->description = "Change selection of all visible objects in scene";
-	ot->idname= "OBJECT_OT_select_all";
+	ot->idname = "OBJECT_OT_select_all";
 	
 	/* api callbacks */
-	ot->exec= object_select_all_exec;
-	ot->poll= objects_selectable_poll;
+	ot->exec = object_select_all_exec;
+	ot->poll = objects_selectable_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	WM_operator_properties_select_all(ot);
 }
@@ -836,16 +837,16 @@ void OBJECT_OT_select_same_group(wmOperatorType *ot)
 {
 	
 	/* identifiers */
-	ot->name= "Select Same Group";
+	ot->name = "Select Same Group";
 	ot->description = "Select object in the same group";
-	ot->idname= "OBJECT_OT_select_same_group";
+	ot->idname = "OBJECT_OT_select_same_group";
 	
 	/* api callbacks */
-	ot->exec= object_select_same_group_exec;
-	ot->poll= objects_selectable_poll;
+	ot->exec = object_select_same_group_exec;
+	ot->poll = objects_selectable_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	RNA_def_string(ot->srna, "group", "", MAX_ID_NAME, "Group", "Name of the group to select");
 }
@@ -863,12 +864,12 @@ static int object_select_mirror_exec(bContext *C, wmOperator *op)
 
 		flip_side_name(tmpname, primbase->object->id.name+2, TRUE);
 		
-		if(strcmp(tmpname, primbase->object->id.name+2)!=0) { /* names differ */
+		if (strcmp(tmpname, primbase->object->id.name+2)!=0) { /* names differ */
 			Object *ob= (Object *)find_id("OB", tmpname);
-			if(ob) {
+			if (ob) {
 				Base *secbase= object_in_scene(ob, scene);
 
-				if(secbase) {
+				if (secbase) {
 					ED_base_object_select(secbase, BA_SELECT);
 				}
 			}
@@ -889,16 +890,16 @@ void OBJECT_OT_select_mirror(wmOperatorType *ot)
 {
 	
 	/* identifiers */
-	ot->name= "Select Mirror";
+	ot->name = "Select Mirror";
 	ot->description = "Select the Mirror objects of the selected object eg. L.sword -> R.sword";
-	ot->idname= "OBJECT_OT_select_mirror";
+	ot->idname = "OBJECT_OT_select_mirror";
 	
 	/* api callbacks */
-	ot->exec= object_select_mirror_exec;
-	ot->poll= objects_selectable_poll;
+	ot->exec = object_select_mirror_exec;
+	ot->poll = objects_selectable_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first");
 }
@@ -936,17 +937,17 @@ static int object_select_random_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_select_random(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Random";
+	ot->name = "Select Random";
 	ot->description = "Set select on random visible objects";
-	ot->idname= "OBJECT_OT_select_random";
+	ot->idname = "OBJECT_OT_select_random";
 	
 	/* api callbacks */
-	/*ot->invoke= object_select_random_invoke XXX - need a number popup ;*/
+	/*ot->invoke = object_select_random_invoke XXX - need a number popup ;*/
 	ot->exec = object_select_random_exec;
-	ot->poll= objects_selectable_poll;
+	ot->poll = objects_selectable_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_float_percentage(ot->srna, "percent", 50.f, 0.0f, 100.0f, "Percent", "Percentage of objects to select randomly", 0.f, 100.0f);
diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c
index 956ec86..79b1ca1 100644
--- a/source/blender/editors/object/object_shapekey.c
+++ b/source/blender/editors/object/object_shapekey.c
@@ -76,9 +76,11 @@
 
 static void ED_object_shape_key_add(bContext *C, Scene *scene, Object *ob, int from_mix)
 {
-	if(object_insert_shape_key(scene, ob, NULL, from_mix)) {
+	KeyBlock *kb;
+	if ((kb = object_insert_shape_key(scene, ob, NULL, from_mix))) {
 		Key *key= ob_get_key(ob);
-		ob->shapenr= BLI_countlist(&key->block);
+		/* for absolute shape keys, new keys may not be added last */
+		ob->shapenr = BLI_findindex(&key->block, kb) + 1;
 
 		WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
 	}
@@ -94,22 +96,22 @@ static int ED_object_shape_key_remove(bContext *C, Object *ob)
 	//IpoCurve *icu;
 
 	key= ob_get_key(ob);
-	if(key==NULL)
+	if (key==NULL)
 		return 0;
 	
 	kb= BLI_findlink(&key->block, ob->shapenr-1);
 
-	if(kb) {
-		for(rkb= key->block.first; rkb; rkb= rkb->next)
-			if(rkb->relative == ob->shapenr-1)
+	if (kb) {
+		for (rkb= key->block.first; rkb; rkb= rkb->next)
+			if (rkb->relative == ob->shapenr-1)
 				rkb->relative= 0;
 
 		BLI_remlink(&key->block, kb);
 		key->totkey--;
-		if(key->refkey== kb) {
+		if (key->refkey== kb) {
 			key->refkey= key->block.first;
 
-			if(key->refkey) {
+			if (key->refkey) {
 				/* apply new basis key on original data */
 				switch(ob->type) {
 					case OB_MESH:
@@ -126,36 +128,18 @@ static int ED_object_shape_key_remove(bContext *C, Object *ob)
 			}
 		}
 			
-		if(kb->data) MEM_freeN(kb->data);
+		if (kb->data) MEM_freeN(kb->data);
 		MEM_freeN(kb);
-		
-		for(kb= key->block.first; kb; kb= kb->next)
-			if(kb->adrcode>=ob->shapenr)
-				kb->adrcode--;
-		
-#if 0 // XXX old animation system
-		if(key->ipo) {
-			
-			for(icu= key->ipo->curve.first; icu; icu= icu->next) {
-				if(icu->adrcode==ob->shapenr-1) {
-					BLI_remlink(&key->ipo->curve, icu);
-					free_ipo_curve(icu);
-					break;
-				}
-			}
-			for(icu= key->ipo->curve.first; icu; icu= icu->next) 
-				if(icu->adrcode>=ob->shapenr)
-					icu->adrcode--;
+
+		if (ob->shapenr > 1) {
+			ob->shapenr--;
 		}
-#endif // XXX old animation system		
-		
-		if(ob->shapenr>1) ob->shapenr--;
 	}
 	
-	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;
+	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;
 
 		free_libblock_us(&(bmain->key), key);
 	}
@@ -172,33 +156,33 @@ static int object_shape_key_mirror(bContext *C, Object *ob)
 	Key *key;
 
 	key= ob_get_key(ob);
-	if(key==NULL)
+	if (key==NULL)
 		return 0;
 	
 	kb= BLI_findlink(&key->block, ob->shapenr-1);
 
-	if(kb) {
+	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) {
+		if (ob->type==OB_MESH) {
 			Mesh *me= ob->data;
 			MVert *mv;
 
 			mesh_octree_table(ob, NULL, NULL, 's');
 
-			for(i1=0, mv=me->mvert; i1<me->totvert; i1++, mv++) {
+			for (i1=0, mv=me->mvert; i1<me->totvert; i1++, mv++) {
 				i2= mesh_get_x_mirror_vert(ob, i1);
-				if(i2==i1) {
+				if (i2==i1) {
 					fp1= ((float *)kb->data) + i1*3;
 					fp1[0] = -fp1[0];
 					tag_elem[i1]= 1;
 				}
-				else if(i2 != -1) {
-					if(tag_elem[i1]==0 && tag_elem[i2]==0) {
+				else if (i2 != -1) {
+					if (tag_elem[i1]==0 && tag_elem[i2]==0) {
 						fp1= ((float *)kb->data) + i1*3;
 						fp2= ((float *)kb->data) + i2*3;
 
@@ -222,19 +206,19 @@ static int object_shape_key_mirror(bContext *C, Object *ob)
 			float *fp1, *fp2;
 			int u, v, w;
 			/* half but found up odd value */
-			const int pntsu_half = (((lt->pntsu / 2) + (lt->pntsu % 2))) ;
+			const int pntsu_half = (lt->pntsu / 2) + (lt->pntsu % 2);
 
-			/* currently editmode isnt supported by mesh so
+			/* 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++) {
-					for(u=0; u<pntsu_half; u++) {
+			for (w=0; w<lt->pntsw; w++) {
+				for (v=0; v<lt->pntsv; v++) {
+					for (u=0; u<pntsu_half; u++) {
 						int u_inv= (lt->pntsu - 1) - u;
 						float tvec[3];
-						if(u == u_inv) {
+						if (u == u_inv) {
 							i1= LT_INDEX(lt, u, v, w);
 							fp1= ((float *)kb->data) + i1*3;
 							fp1[0]= -fp1[0];
@@ -296,16 +280,16 @@ static int shape_key_add_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_shape_key_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Shape Key";
-	ot->idname= "OBJECT_OT_shape_key_add";
-	ot->description= "Add shape key to the object";
+	ot->name = "Add Shape Key";
+	ot->idname = "OBJECT_OT_shape_key_add";
+	ot->description = "Add shape key to the object";
 	
 	/* api callbacks */
-	ot->poll= shape_key_mode_poll;
-	ot->exec= shape_key_add_exec;
+	ot->poll = shape_key_mode_poll;
+	ot->exec = shape_key_add_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "from_mix", 1, "From Mix", "Create the new shape key from the existing mix of keys");
@@ -315,7 +299,7 @@ static int shape_key_remove_exec(bContext *C, wmOperator *UNUSED(op))
 {
 	Object *ob= ED_object_context(C);
 
-	if(!ED_object_shape_key_remove(C, ob))
+	if (!ED_object_shape_key_remove(C, ob))
 		return OPERATOR_CANCELLED;
 	
 	return OPERATOR_FINISHED;
@@ -324,16 +308,16 @@ static int shape_key_remove_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_shape_key_remove(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove Shape Key";
-	ot->idname= "OBJECT_OT_shape_key_remove";
-	ot->description= "Remove shape key from the object";
+	ot->name = "Remove Shape Key";
+	ot->idname = "OBJECT_OT_shape_key_remove";
+	ot->description = "Remove shape key from the object";
 	
 	/* api callbacks */
-	ot->poll= shape_key_mode_poll;
-	ot->exec= shape_key_remove_exec;
+	ot->poll = shape_key_mode_poll;
+	ot->exec = shape_key_remove_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int shape_key_clear_exec(bContext *C, wmOperator *UNUSED(op))
@@ -342,10 +326,10 @@ static int shape_key_clear_exec(bContext *C, wmOperator *UNUSED(op))
 	Key *key= ob_get_key(ob);
 	KeyBlock *kb= ob_get_keyblock(ob);
 
-	if(!key || !kb)
+	if (!key || !kb)
 		return OPERATOR_CANCELLED;
 	
-	for(kb=key->block.first; kb; kb=kb->next)
+	for (kb=key->block.first; kb; kb=kb->next)
 		kb->curval= 0.0f;
 
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
@@ -357,23 +341,58 @@ static int shape_key_clear_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_shape_key_clear(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear Shape Keys";
-	ot->description= "Clear weights for all shape keys";
-	ot->idname= "OBJECT_OT_shape_key_clear";
+	ot->name = "Clear Shape Keys";
+	ot->description = "Clear weights for all shape keys";
+	ot->idname = "OBJECT_OT_shape_key_clear";
 	
 	/* api callbacks */
-	ot->poll= shape_key_poll;
-	ot->exec= shape_key_clear_exec;
+	ot->poll = shape_key_poll;
+	ot->exec = shape_key_clear_exec;
+
+	/* flags */
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
+/* starting point and step size could be optional */
+static int shape_key_retime_exec(bContext *C, wmOperator *UNUSED(op))
+{
+	Object *ob = ED_object_context(C);
+	Key *key = ob_get_key(ob);
+	KeyBlock *kb = ob_get_keyblock(ob);
+	float cfra = 0.0f;
+
+	if (!key || !kb)
+		return OPERATOR_CANCELLED;
+
+	for (kb=key->block.first; kb; kb=kb->next)
+		kb->pos = (cfra += 0.1f);
+
+	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+	WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+
+	return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_shape_key_retime(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Re-Time Shape Keys";
+	ot->description = "Resets the timing for absolute shape keys";
+	ot->idname = "OBJECT_OT_shape_key_retime";
+
+	/* api callbacks */
+	ot->poll = shape_key_poll;
+	ot->exec = shape_key_retime_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int shape_key_mirror_exec(bContext *C, wmOperator *UNUSED(op))
 {
 	Object *ob= ED_object_context(C);
 
-	if(!object_shape_key_mirror(C, ob))
+	if (!object_shape_key_mirror(C, ob))
 		return OPERATOR_CANCELLED;
 
 	return OPERATOR_FINISHED;
@@ -382,15 +401,15 @@ static int shape_key_mirror_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_shape_key_mirror(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Mirror Shape Key";
-	ot->idname= "OBJECT_OT_shape_key_mirror";
+	ot->name = "Mirror Shape Key";
+	ot->idname = "OBJECT_OT_shape_key_mirror";
 
 	/* api callbacks */
-	ot->poll= shape_key_mode_poll;
-	ot->exec= shape_key_mirror_exec;
+	ot->poll = shape_key_mode_poll;
+	ot->exec = shape_key_mirror_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 
@@ -401,26 +420,26 @@ static int shape_key_move_exec(bContext *C, wmOperator *op)
 	int type= RNA_enum_get(op->ptr, "type");
 	Key *key= ob_get_key(ob);
 
-	if(key) {
+	if (key) {
 		KeyBlock *kb, *kb_other;
 		int shapenr_act= ob->shapenr-1;
 		int shapenr_swap= shapenr_act + type;
 		kb= BLI_findlink(&key->block, shapenr_act);
 
-		if((type==-1 && kb->prev==NULL) || (type==1 && kb->next==NULL)) {
+		if ((type==-1 && kb->prev==NULL) || (type==1 && kb->next==NULL)) {
 			return OPERATOR_CANCELLED;
 		}
 
-		for(kb_other= key->block.first; kb_other; kb_other= kb_other->next) {
-			if(kb_other->relative == shapenr_act) {
+		for (kb_other= key->block.first; kb_other; kb_other= kb_other->next) {
+			if (kb_other->relative == shapenr_act) {
 				kb_other->relative += type;
 			}
-			else if(kb_other->relative == shapenr_swap) {
+			else if (kb_other->relative == shapenr_swap) {
 				kb_other->relative -= type;
 			}
 		}
 
-		if(type==-1) {
+		if (type==-1) {
 			/* move back */
 			kb_other= kb->prev;
 			BLI_remlink(&key->block, kb);
@@ -434,6 +453,8 @@ static int shape_key_move_exec(bContext *C, wmOperator *op)
 			BLI_insertlinkafter(&key->block, kb_other, kb);
 			ob->shapenr++;
 		}
+
+		SWAP(float, kb_other->pos, kb->pos) /* for absolute shape keys */
 	}
 
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
@@ -451,15 +472,15 @@ void OBJECT_OT_shape_key_move(wmOperatorType *ot)
 	};
 
 	/* identifiers */
-	ot->name= "Move Shape Key";
-	ot->idname= "OBJECT_OT_shape_key_move";
+	ot->name = "Move Shape Key";
+	ot->idname = "OBJECT_OT_shape_key_move";
 
 	/* api callbacks */
-	ot->poll= shape_key_mode_poll;
-	ot->exec= shape_key_move_exec;
+	ot->poll = shape_key_mode_poll;
+	ot->exec = shape_key_move_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	RNA_def_enum(ot->srna, "type", slot_move, 0, "Type", "");
 }
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index e57574a..5595479 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -34,13 +34,15 @@
 #include "DNA_anim_types.h"
 #include "DNA_armature_types.h"
 #include "DNA_key_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
+#include "DNA_meta_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_group_types.h"
+#include "DNA_lattice_types.h"
 
 #include "BLI_math.h"
-#include "BLI_editVert.h"
 #include "BLI_listbase.h"
 #include "BLI_utildefines.h"
 
@@ -48,9 +50,11 @@
 #include "BKE_curve.h"
 #include "BKE_depsgraph.h"
 #include "BKE_main.h"
+#include "BKE_mball.h"
 #include "BKE_mesh.h"
 #include "BKE_object.h"
 #include "BKE_report.h"
+#include "BKE_tessmesh.h"
 #include "BKE_multires.h"
 #include "BKE_armature.h"
 
@@ -115,7 +119,7 @@ static void object_clear_rot(Object *ob)
 				if ((ob->protectflag & OB_LOCK_ROTZ) == 0)
 					ob->quat[3]= ob->dquat[3]= 0.0f;
 					
-				// TODO: does this quat need normalising now?
+				// TODO: does this quat need normalizing now?
 			}
 			else {
 				/* the flag may have been set for the other modes, so just ignore the extra flag... */
@@ -212,7 +216,7 @@ static int object_clear_transform_generic_exec(bContext *C, wmOperator *op,
 	KeyingSet *ks;
 	
 	/* sanity checks */
-	if ELEM(NULL, clear_func, default_ksName) {
+	if (ELEM(NULL, clear_func, default_ksName)) {
 		BKE_report(op->reports, RPT_ERROR, "Programming error: missing clear transform func or Keying Set Name");
 		return OPERATOR_CANCELLED;
 	}
@@ -256,16 +260,16 @@ static int object_location_clear_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_location_clear(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear Location";
+	ot->name = "Clear Location";
 	ot->description = "Clear the object's location";
-	ot->idname= "OBJECT_OT_location_clear";
+	ot->idname = "OBJECT_OT_location_clear";
 	
 	/* api callbacks */
-	ot->exec= object_location_clear_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->exec = object_location_clear_exec;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int object_rotation_clear_exec(bContext *C, wmOperator *op)
@@ -276,16 +280,16 @@ static int object_rotation_clear_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_rotation_clear(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear Rotation";
+	ot->name = "Clear Rotation";
 	ot->description = "Clear the object's rotation";
-	ot->idname= "OBJECT_OT_rotation_clear";
+	ot->idname = "OBJECT_OT_rotation_clear";
 	
 	/* api callbacks */
-	ot->exec= object_rotation_clear_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->exec = object_rotation_clear_exec;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int object_scale_clear_exec(bContext *C, wmOperator *op)
@@ -296,16 +300,16 @@ static int object_scale_clear_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_scale_clear(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear Scale";
+	ot->name = "Clear Scale";
 	ot->description = "Clear the object's scale";
-	ot->idname= "OBJECT_OT_scale_clear";
+	ot->idname = "OBJECT_OT_scale_clear";
 	
 	/* api callbacks */
-	ot->exec= object_scale_clear_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->exec = object_scale_clear_exec;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* --------------- */
@@ -342,16 +346,16 @@ static int object_origin_clear_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_origin_clear(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear Origin";
+	ot->name = "Clear Origin";
 	ot->description = "Clear the object's origin";
-	ot->idname= "OBJECT_OT_origin_clear";
+	ot->idname = "OBJECT_OT_origin_clear";
 	
 	/* api callbacks */
-	ot->exec= object_origin_clear_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->exec = object_origin_clear_exec;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /*************************** Apply Transformation ****************************/
@@ -364,8 +368,8 @@ static void ignore_parent_tx(Main *bmain, Scene *scene, Object *ob )
 	Object *ob_child;
 	
 	/* a change was made, adjust the children to compensate */
-	for(ob_child=bmain->object.first; ob_child; ob_child=ob_child->id.next) {
-		if(ob_child->parent == ob) {
+	for (ob_child=bmain->object.first; ob_child; ob_child=ob_child->id.next) {
+		if (ob_child->parent == ob) {
 			object_apply_mat4(ob_child, ob_child->obmat, TRUE, FALSE);
 			what_does_parent(scene, ob_child, &workob);
 			invert_m4_m4(ob_child->parentinv, workob.obmat);
@@ -383,33 +387,39 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
 	/* first check if we can execute */
 	CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
 
-		if(ob->type==OB_MESH) {
-			if(ID_REAL_USERS(ob->data) > 1) {
+		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");
 				return OPERATOR_CANCELLED;
 			}
 		}
-		else if(ob->type==OB_ARMATURE) {
-			if(ID_REAL_USERS(ob->data) > 1) {
+		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");
 				return OPERATOR_CANCELLED;
 			}
 		}
-		else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
+		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");
+				return OPERATOR_CANCELLED;
+			}
+		}
+		else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
 			Curve *cu;
 
-			if(ID_REAL_USERS(ob->data) > 1) {
+			if (ID_REAL_USERS(ob->data) > 1) {
 				BKE_report(reports, RPT_ERROR, "Can't apply to a multi user curve, doing nothing");
 				return OPERATOR_CANCELLED;
 			}
 
 			cu= ob->data;
 
-			if(!(cu->flag & CU_3D) && (apply_rot || apply_loc)) {
+			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");
 				return OPERATOR_CANCELLED;
 			}
-			if(cu->key) {
+			if (cu->key) {
 				BKE_report(reports, RPT_ERROR, "Can't apply to a curve with vertex keys, doing nothing");
 				return OPERATOR_CANCELLED;
 			}
@@ -421,11 +431,11 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
 	CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
 
 		/* calculate rotation/scale matrix */
-		if(apply_scale && apply_rot)
+		if (apply_scale && apply_rot)
 			object_to_mat3(ob, rsmat);
-		else if(apply_scale)
+		else if (apply_scale)
 			object_scale_to_mat3(ob, rsmat);
-		else if(apply_rot) {
+		else if (apply_rot) {
 			float tmat[3][3], timat[3][3];
 
 			/* simple rotation matrix */
@@ -443,10 +453,10 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
 		copy_m4_m3(mat, rsmat);
 
 		/* calculate translation */
-		if(apply_loc) {
+		if (apply_loc) {
 			copy_v3_v3(mat[3], ob->loc);
 
-			if(!(apply_scale && apply_rot)) {
+			if (!(apply_scale && apply_rot)) {
 				/* correct for scale and rotation that is still applied */
 				object_to_mat3(ob, obmat);
 				invert_m3_m3(iobmat, obmat);
@@ -456,7 +466,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
 		}
 
 		/* apply to object data */
-		if(ob->type==OB_MESH) {
+		if (ob->type==OB_MESH) {
 			Mesh *me= ob->data;
 			MVert *mvert;
 
@@ -464,27 +474,37 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
 			
 			/* adjust data */
 			mvert= me->mvert;
-			for(a=0; a<me->totvert; a++, mvert++)
+			for (a=0; a<me->totvert; a++, mvert++)
 				mul_m4_v3(mat, mvert->co);
 			
-			if(me->key) {
+			if (me->key) {
 				KeyBlock *kb;
 				
-				for(kb=me->key->block.first; kb; kb=kb->next) {
+				for (kb=me->key->block.first; kb; kb=kb->next) {
 					float *fp= kb->data;
 					
-					for(a=0; a<kb->totelem; a++, fp+=3)
+					for (a=0; a<kb->totelem; a++, fp+=3)
 						mul_m4_v3(mat, fp);
 				}
 			}
 			
 			/* update normals */
-			mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
+			mesh_calc_normals_mapping(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL);
 		}
 		else if (ob->type==OB_ARMATURE) {
 			ED_armature_apply_transform(ob, mat);
 		}
-		else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
+		else if (ob->type == OB_LATTICE) {
+			Lattice *lt = ob->data;
+			BPoint *bp = lt->def;
+			int a = lt->pntsu * lt->pntsv * lt->pntsw;
+			
+			while (a--) {
+				mul_m4_v3(mat, bp->vec);
+				bp++;
+			}
+		}
+		else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
 			Curve *cu= ob->data;
 
 			Nurb *nu;
@@ -493,10 +513,10 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
 
 			scale = mat3_to_scale(rsmat);
 
-			for(nu=cu->nurb.first; nu; nu=nu->next) {
-				if(nu->type == CU_BEZIER) {
+			for (nu=cu->nurb.first; nu; nu=nu->next) {
+				if (nu->type == CU_BEZIER) {
 					a= nu->pntsu;
-					for(bezt= nu->bezt; a--; bezt++) {
+					for (bezt= nu->bezt; a--; bezt++) {
 						mul_m4_v3(mat, bezt->vec[0]);
 						mul_m4_v3(mat, bezt->vec[1]);
 						mul_m4_v3(mat, bezt->vec[2]);
@@ -506,7 +526,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
 				}
 				else {
 					a= nu->pntsu*nu->pntsv;
-					for(bp= nu->bp; a--; bp++)
+					for (bp= nu->bp; a--; bp++)
 						mul_m4_v3(mat, bp->vec);
 				}
 			}
@@ -514,18 +534,18 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
 		else
 			continue;
 
-		if(apply_loc)
+		if (apply_loc)
 			zero_v3(ob->loc);
-		if(apply_scale)
+		if (apply_scale)
 			ob->size[0]= ob->size[1]= ob->size[2]= 1.0f;
-		if(apply_rot) {
+		if (apply_rot) {
 			zero_v3(ob->rot);
 			unit_qt(ob->quat);
 			unit_axis_angle(ob->rotAxis, &ob->rotAngle);
 		}
 
 		where_is_object(scene, ob);
-		if(ob->type==OB_ARMATURE) {
+		if (ob->type==OB_ARMATURE) {
 			where_is_pose(scene, ob); /* needed for bone parents */
 		}
 
@@ -537,7 +557,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
 	}
 	CTX_DATA_END;
 
-	if(!change)
+	if (!change)
 		return OPERATOR_CANCELLED;
 
 	WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
@@ -561,7 +581,7 @@ static int visual_transform_apply_exec(bContext *C, wmOperator *UNUSED(op))
 	}
 	CTX_DATA_END;
 
-	if(!change)
+	if (!change)
 		return OPERATOR_CANCELLED;
 
 	WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
@@ -571,16 +591,16 @@ static int visual_transform_apply_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_visual_transform_apply(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Apply Visual Transform";
+	ot->name = "Apply Visual Transform";
 	ot->description = "Apply the object's visual transformation to its data";
-	ot->idname= "OBJECT_OT_visual_transform_apply";
+	ot->idname = "OBJECT_OT_visual_transform_apply";
 	
 	/* api callbacks */
-	ot->exec= visual_transform_apply_exec;
-	ot->poll= ED_operator_scene_editable;
+	ot->exec = visual_transform_apply_exec;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int object_transform_apply_exec(bContext *C, wmOperator *op)
@@ -589,7 +609,7 @@ static int object_transform_apply_exec(bContext *C, wmOperator *op)
 	const int rot= RNA_boolean_get(op->ptr, "rotation");
 	const int sca= RNA_boolean_get(op->ptr, "scale");
 
-	if(loc || rot || sca) {
+	if (loc || rot || sca) {
 		return apply_objects_internal(C, op->reports, loc, rot, sca);
 	}
 	else {
@@ -600,16 +620,16 @@ static int object_transform_apply_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_transform_apply(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Apply Object Transform";
+	ot->name = "Apply Object Transform";
 	ot->description = "Apply the object's transformation to its data";
-	ot->idname= "OBJECT_OT_transform_apply";
+	ot->idname = "OBJECT_OT_transform_apply";
 
 	/* api callbacks */
-	ot->exec= object_transform_apply_exec;
-	ot->poll= ED_operator_objectmode;
+	ot->exec = object_transform_apply_exec;
+	ot->poll = ED_operator_objectmode;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	RNA_def_boolean(ot->srna, "location", 0, "Location", "");
 	RNA_def_boolean(ot->srna, "rotation", 0, "Rotation", "");
@@ -642,51 +662,52 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
 		return OPERATOR_CANCELLED;
 	}
 	else {
-		/* get the view settings if 'around' isnt set and the view is available */
+		/* get the view settings if 'around' isn't set and the view is available */
 		View3D *v3d= CTX_wm_view3d(C);
 		copy_v3_v3(cursor, give_cursor(scene, v3d));
-		if(v3d && !RNA_struct_property_is_set(op->ptr, "center"))
+		if (v3d && !RNA_struct_property_is_set(op->ptr, "center"))
 			around= v3d->around;
 	}
 
 	zero_v3(cent);
 
-	if(obedit) {
+	if (obedit) {
 		INIT_MINMAX(min, max);
 
-		if(obedit->type==OB_MESH) {
+		if (obedit->type==OB_MESH) {
 			Mesh *me= obedit->data;
-			EditMesh *em = BKE_mesh_get_editmesh(me);
-			EditVert *eve;
-
-			if(around==V3D_CENTROID) {
-				int total= 0;
-				for(eve= em->verts.first; eve; eve= eve->next) {
-					total++;
-					add_v3_v3(cent, eve->co);
-				}
-				if(total) {
-					mul_v3_fl(cent, 1.0f/(float)total);
-				}
+			BMEditMesh *em = me->edit_btmesh;
+			BMVert *eve;
+			BMIter iter;
+			int total = 0;
+			
+			if (centermode == ORIGIN_TO_CURSOR) {
+				copy_v3_v3(cent, cursor);
+				invert_m4_m4(obedit->imat, obedit->obmat);
+				mul_m4_v3(obedit->imat, cent);
 			}
 			else {
-				for(eve= em->verts.first; eve; eve= eve->next) {
-					DO_MINMAX(eve->co, min, max);
+				BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+					if (around==V3D_CENTROID) {
+						total++;
+						add_v3_v3(cent, eve->co);
+						mul_v3_fl(cent, 1.0f/(float)total);
+					}
+					else {
+						DO_MINMAX(eve->co, min, max);
+						mid_v3_v3v3(cent, min, max);
+					}
 				}
-				mid_v3_v3v3(cent, min, max);
 			}
-
-			if(!is_zero_v3(cent)) {
-				for(eve= em->verts.first; eve; eve= eve->next) {
-					sub_v3_v3(eve->co, cent);
-				}
-
-				recalc_editnormals(em);
-				tot_change++;
-				DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
+			
+			BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+				sub_v3_v3(eve->co, cent);
 			}
-			BKE_mesh_end_editmesh(me, em);
-		}
+
+			EDBM_mesh_normals_update(em);
+			tot_change++;
+			DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
+	    }
 	}
 
 	/* reset flags */
@@ -696,31 +717,31 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
 	CTX_DATA_END;
 
 	for (tob= bmain->object.first; tob; tob= tob->id.next) {
-		if(tob->data)
+		if (tob->data)
 			((ID *)tob->data)->flag &= ~LIB_DOIT;
-		if(tob->dup_group)
+		if (tob->dup_group)
 			((ID *)tob->dup_group)->flag &= ~LIB_DOIT;
 	}
 
 	CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
-		if((ob->flag & OB_DONE)==0) {
+		if ((ob->flag & OB_DONE)==0) {
 			int do_inverse_offset = FALSE;
 			ob->flag |= OB_DONE;
 
-			if(centermode == ORIGIN_TO_CURSOR) {
+			if (centermode == ORIGIN_TO_CURSOR) {
 				copy_v3_v3(cent, cursor);
 				invert_m4_m4(ob->imat, ob->obmat);
 				mul_m4_v3(ob->imat, cent);
 			}
 			
-			if(ob->data == NULL) {
+			if (ob->data == NULL) {
 				/* special support for dupligroups */
-				if((ob->transflag & OB_DUPLIGROUP) && ob->dup_group && (ob->dup_group->id.flag & LIB_DOIT)==0) {
-					if(ob->dup_group->id.lib) {
+				if ((ob->transflag & OB_DUPLIGROUP) && ob->dup_group && (ob->dup_group->id.flag & LIB_DOIT)==0) {
+					if (ob->dup_group->id.lib) {
 						tot_lib_error++;
 					}
 					else {
-						if(centermode == ORIGIN_TO_CURSOR) { /* done */ }
+						if (centermode == ORIGIN_TO_CURSOR) { /* done */ }
 						else {
 							/* only bounds support */
 							INIT_MINMAX(min, max);
@@ -742,11 +763,11 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
 				tot_lib_error++;
 			}
 
-			if(obedit==NULL && ob->type==OB_MESH) {
+			if (obedit==NULL && ob->type==OB_MESH) {
 				Mesh *me= ob->data;
 
-				if(centermode == ORIGIN_TO_CURSOR) { /* done */ }
-				else if(around==V3D_CENTROID) { mesh_center_median(me, cent); }
+				if (centermode == ORIGIN_TO_CURSOR) { /* done */ }
+				else if (around==V3D_CENTROID) { mesh_center_median(me, cent); }
 				else { mesh_center_bounds(me, cent); }
 
 				negate_v3_v3(cent_neg, cent);
@@ -759,12 +780,12 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
 			else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
 				Curve *cu= ob->data;
 
-				if(centermode == ORIGIN_TO_CURSOR) { /* done */ }
-				else if(around==V3D_CENTROID) { curve_center_median(cu, cent); }
+				if (centermode == ORIGIN_TO_CURSOR) { /* done */ }
+				else if (around==V3D_CENTROID) { curve_center_median(cu, cent); }
 				else { curve_center_bounds(cu, cent);	}
 
 				/* don't allow Z change if curve is 2D */
-				if((ob->type == OB_CURVE) && !(cu->flag & CU_3D))
+				if ((ob->type == OB_CURVE) && !(cu->flag & CU_3D))
 					cent[2] = 0.0;
 
 				negate_v3_v3(cent_neg, cent);
@@ -774,23 +795,23 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
 				cu->id.flag |= LIB_DOIT;
 				do_inverse_offset= TRUE;
 
-				if(obedit) {
+				if (obedit) {
 					if (centermode == GEOMETRY_TO_ORIGIN) {
 						DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
 					}
 					break;
 				}
 			}
-			else if(ob->type==OB_FONT) {
+			else if (ob->type==OB_FONT) {
 				/* get from bb */
 
 				Curve *cu= ob->data;
 
-				if(cu->bb==NULL && (centermode != ORIGIN_TO_CURSOR)) {
+				if (cu->bb==NULL && (centermode != ORIGIN_TO_CURSOR)) {
 					/* do nothing*/
 				}
 				else {
-					if(centermode == ORIGIN_TO_CURSOR) {
+					if (centermode == ORIGIN_TO_CURSOR) {
 						/* done */
 					}
 					else {
@@ -808,12 +829,14 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
 					do_inverse_offset= TRUE;
 				}
 			}
-			else if(ob->type==OB_ARMATURE) {
+			else if (ob->type==OB_ARMATURE) {
 				bArmature *arm = ob->data;
 
-				if(ID_REAL_USERS(arm) > 1) {
-					/*BKE_report(op->reports, RPT_ERROR, "Can't apply to a multi user armature");
-					return;*/
+				if (ID_REAL_USERS(arm) > 1) {
+#if 0
+					BKE_report(op->reports, RPT_ERROR, "Can't apply to a multi user armature");
+					return;
+#endif
 					tot_multiuser_arm_error++;
 				}
 				else {
@@ -831,13 +854,34 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
 
 					ignore_parent_tx(bmain, scene, ob);
 
-					if(obedit)
+					if (obedit)
 						break;
 				}
 			}
+			else if (ob->type == OB_MBALL) {
+				MetaBall *mb = ob->data;
+
+				if (centermode == ORIGIN_TO_CURSOR) { /* done */ }
+				else if (around==V3D_CENTROID) { BKE_metaball_center_median(mb, cent); }
+				else { BKE_metaball_center_bounds(mb, cent);	}
+
+				negate_v3_v3(cent_neg, cent);
+				BKE_metaball_translate(mb, cent_neg);
+
+				tot_change++;
+				mb->id.flag |= LIB_DOIT;
+				do_inverse_offset= TRUE;
+
+				if (obedit) {
+					if (centermode == GEOMETRY_TO_ORIGIN) {
+						DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
+					}
+					break;
+				}
+			}
 
 			/* offset other selected objects */
-			if(do_inverse_offset && (centermode != GEOMETRY_TO_ORIGIN)) {
+			if (do_inverse_offset && (centermode != GEOMETRY_TO_ORIGIN)) {
 				/* was the object data modified
 				 * note: the functions above must set 'cent' */
 				copy_v3_v3(centn, cent);
@@ -845,7 +889,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
 				add_v3_v3(ob->loc, centn);
 
 				where_is_object(scene, ob);
-				if(ob->type==OB_ARMATURE) {
+				if (ob->type==OB_ARMATURE) {
 					where_is_pose(scene, ob); /* needed for bone parents */
 				}
 
@@ -853,7 +897,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
 				
 				/* other users? */
 				CTX_DATA_BEGIN(C, Object*, ob_other, selected_editable_objects) {
-					if(		(ob_other->flag & OB_DONE)==0 &&
+					if (		(ob_other->flag & OB_DONE)==0 &&
 							(	(ob->data && (ob->data == ob_other->data)) ||
 								(ob->dup_group==ob_other->dup_group && (ob->transflag|ob_other->transflag) & OB_DUPLIGROUP) )
 					) {
@@ -865,7 +909,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
 						add_v3_v3(ob_other->loc, centn);
 
 						where_is_object(scene, ob_other);
-						if(ob_other->type==OB_ARMATURE) {
+						if (ob_other->type==OB_ARMATURE) {
 							where_is_pose(scene, ob_other); /* needed for bone parents */
 						}
 						ignore_parent_tx(bmain, scene, ob_other);
@@ -878,7 +922,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
 	CTX_DATA_END;
 
 	for (tob= bmain->object.first; tob; tob= tob->id.next)
-		if(tob->data && (((ID *)tob->data)->flag & LIB_DOIT))
+		if (tob->data && (((ID *)tob->data)->flag & LIB_DOIT))
 			DAG_id_tag_update(&tob->id, OB_RECALC_OB|OB_RECALC_DATA);
 
 	if (tot_change) {
@@ -914,20 +958,20 @@ void OBJECT_OT_origin_set(wmOperatorType *ot)
 	};
 	
 	/* identifiers */
-	ot->name= "Set Origin";
+	ot->name = "Set Origin";
 	ot->description = "Set the object's origin, by either moving the data, or set to center of data, or use 3d cursor";
-	ot->idname= "OBJECT_OT_origin_set";
+	ot->idname = "OBJECT_OT_origin_set";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= object_origin_set_exec;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = object_origin_set_exec;
 	
-	ot->poll= ED_operator_scene_editable;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_set_center_types, 0, "Type", "");
+	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 7fe98a6..b5c34f1 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -41,15 +41,16 @@
 #include "DNA_curve_types.h"
 #include "DNA_lattice_types.h"
 #include "DNA_meshdata_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_modifier_types.h"
 #include "DNA_object_types.h"
 #include "DNA_object_force.h"
 #include "DNA_scene_types.h"
 #include "DNA_particle_types.h"
 
+#include "BLI_array.h"
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
-#include "BLI_editVert.h"
 #include "BLI_utildefines.h"
 
 #include "BKE_context.h"
@@ -58,6 +59,7 @@
 #include "BKE_depsgraph.h"
 #include "BKE_global.h"
 #include "BKE_mesh.h"
+#include "BKE_tessmesh.h"
 #include "BKE_report.h"
 #include "BKE_DerivedMesh.h"
 
@@ -89,9 +91,9 @@ static Lattice *vgroup_edit_lattice(Object *ob)
 
 int ED_vgroup_object_is_edit_mode(Object *ob)
 {
-	if(ob->type == OB_MESH)
-		return (((Mesh*)ob->data)->edit_mesh != NULL);
-	else if(ob->type == OB_LATTICE)
+	if (ob->type == OB_MESH)
+		return (BMEdit_FromObject(ob) != NULL);
+	else if (ob->type == OB_LATTICE)
 		return (((Lattice*)ob->data)->editlatt != NULL);
 
 	return 0;
@@ -101,7 +103,7 @@ bDeformGroup *ED_vgroup_add_name(Object *ob, const char *name)
 {
 	bDeformGroup *defgroup;
 
-	if(!ob || !OB_TYPE_SUPPORT_VGROUP(ob->type))
+	if (!ob || !OB_TYPE_SUPPORT_VGROUP(ob->type))
 		return NULL;
 	
 	defgroup = MEM_callocN(sizeof(bDeformGroup), "add deformGroup");
@@ -134,7 +136,7 @@ void ED_vgroup_delete(Object *ob, bDeformGroup *defgroup)
 	if (dg == NULL)
 		return;
 
-	if(ED_vgroup_object_is_edit_mode(ob))
+	if (ED_vgroup_object_is_edit_mode(ob))
 		vgroup_delete_edit_mode(ob, dg);
 	else
 		vgroup_delete_object_mode(ob, dg);
@@ -148,7 +150,7 @@ void ED_vgroup_clear(Object *ob)
 	while (dg) {
 		bDeformGroup *next_dg= dg->next;
 
-		if(edit_mode)
+		if (edit_mode)
 			vgroup_delete_edit_mode(ob, dg);
 		else
 			vgroup_delete_object_mode(ob, dg);
@@ -161,12 +163,12 @@ int ED_vgroup_data_create(ID *id)
 {
 	/* create deform verts */
 
-	if(GS(id->name)==ID_ME) {
+	if (GS(id->name)==ID_ME) {
 		Mesh *me= (Mesh *)id;
 		me->dvert= CustomData_add_layer(&me->vdata, CD_MDEFORMVERT, CD_CALLOC, NULL, me->totvert);
 		return TRUE;
 	}
-	else if(GS(id->name)==ID_LT) {
+	else if (GS(id->name)==ID_LT) {
 		Lattice *lt= (Lattice *)id;
 		lt->dvert= MEM_callocN(sizeof(MDeformVert)*lt->pntsu*lt->pntsv*lt->pntsw, "lattice deformVert");
 		return TRUE;
@@ -181,43 +183,45 @@ static int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_to
 	*dvert_tot = 0;
 	*dvert_arr = NULL;
 
-	if(id) {
+	if (id) {
 		switch(GS(id->name)) {
 			case ID_ME:
 			{
 				Mesh *me = (Mesh *)id;
 
-				if(me->edit_mesh) {
-					EditMesh *em = me->edit_mesh;
-					EditVert *eve;
+				if (me->edit_btmesh) {
+					BMEditMesh *em = me->edit_btmesh;
+					BMIter iter;
+					BMVert *eve;
 					int i;
 
-					if (!CustomData_has_layer(&em->vdata, CD_MDEFORMVERT)) {
+					if (!CustomData_has_layer(&em->bm->vdata, CD_MDEFORMVERT)) {
 						return 0;
 					}
 
-					i= BLI_countlist(&em->verts);
+					i = em->bm->totvert;
 
 					*dvert_arr= MEM_mallocN(sizeof(void*)*i, "vgroup parray from me");
 					*dvert_tot = i;
 
 					i = 0;
-
 					if (use_vert_sel) {
-						for (eve=em->verts.first; eve; eve=eve->next, i++) {
-							(*dvert_arr)[i] = (eve->f & SELECT) ?
-											   CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT) : NULL;
+						BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+							(*dvert_arr)[i] = BM_elem_flag_test(eve, BM_ELEM_SELECT) ?
+							                  CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT) : NULL;
+							i++;
 						}
 					}
 					else {
-						for (eve=em->verts.first; eve; eve=eve->next, i++) {
-							(*dvert_arr)[i] = CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
+						BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+							(*dvert_arr)[i] = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
+							i++;
 						}
 					}
 
 					return 1;
 				}
-				else if(me->dvert) {
+				else if (me->dvert) {
 					MVert *mvert= me->mvert;
 					MDeformVert *dvert= me->dvert;
 					int i;
@@ -250,7 +254,7 @@ static int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_to
 				Lattice *lt= (Lattice *)id;
 				lt= (lt->editlatt)? lt->editlatt->latt: lt;
 
-				if(lt->dvert) {
+				if (lt->dvert) {
 					BPoint *def= lt->def;
 					*dvert_tot= lt->pntsu*lt->pntsv*lt->pntsw;
 					*dvert_arr= MEM_mallocN(sizeof(void*)*(*dvert_tot), "vgroup parray from me");
@@ -282,7 +286,7 @@ static int ED_vgroup_give_parray(ID *id, MDeformVert ***dvert_arr, int *dvert_to
 /* returns true if the id type supports weights */
 int ED_vgroup_give_array(ID *id, MDeformVert **dvert_arr, int *dvert_tot)
 {
-	if(id) {
+	if (id) {
 		switch(GS(id->name)) {
 			case ID_ME:
 			{
@@ -322,16 +326,16 @@ int ED_vgroup_copy_array(Object *ob, Object *ob_from)
 	ED_vgroup_give_parray(ob_from->data, &dvert_array_from, &dvert_tot_from, FALSE);
 	ED_vgroup_give_parray(ob->data, &dvert_array, &dvert_tot, FALSE);
 
-	if((dvert_array == NULL) && (dvert_array_from != NULL) && ED_vgroup_data_create(ob->data)) {
+	if ((dvert_array == NULL) && (dvert_array_from != NULL) && ED_vgroup_data_create(ob->data)) {
 		ED_vgroup_give_parray(ob->data, &dvert_array, &dvert_tot, FALSE);
 		new_vgroup= TRUE;
 	}
 
-	if(ob==ob_from || dvert_tot==0 || (dvert_tot != dvert_tot_from) || dvert_array_from==NULL || dvert_array==NULL) {
+	if (ob==ob_from || dvert_tot==0 || (dvert_tot != dvert_tot_from) || dvert_array_from==NULL || dvert_array==NULL) {
 		if (dvert_array) MEM_freeN(dvert_array);
 		if (dvert_array_from) MEM_freeN(dvert_array_from);
 
-		if(new_vgroup == TRUE) {
+		if (new_vgroup == TRUE) {
 			/* free the newly added vgroup since it wasn't compatible */
 			vgroup_delete_all(ob);
 		}
@@ -343,11 +347,11 @@ int ED_vgroup_copy_array(Object *ob, Object *ob_from)
 	BLI_duplicatelist(&ob->defbase, &ob_from->defbase);
 	ob->actdef= ob_from->actdef;
 
-	if(defbase_tot_from < defbase_tot) {
+	if (defbase_tot_from < defbase_tot) {
 		/* correct vgroup indices because the number of vgroups is being reduced. */
 		int *remap= MEM_mallocN(sizeof(int) * (defbase_tot + 1), __func__);
-		for(i=0; i<=defbase_tot_from; i++) remap[i]= i;
-		for(; i<=defbase_tot; i++) remap[i]= 0; /* can't use these, so disable */
+		for (i=0; i<=defbase_tot_from; i++) remap[i]= i;
+		for (; i<=defbase_tot; i++) remap[i]= 0; /* can't use these, so disable */
 
 		vgroup_remap_update_users(ob, remap);
 		MEM_freeN(remap);
@@ -356,13 +360,13 @@ int ED_vgroup_copy_array(Object *ob, Object *ob_from)
 	dvf= dvert_array_from;
 	dv= dvert_array;
 
-	for(i=0; i<dvert_tot; i++, dvf++, dv++) {
-		if((*dv)->dw)
+	for (i=0; i<dvert_tot; i++, dvf++, dv++) {
+		if ((*dv)->dw)
 			MEM_freeN((*dv)->dw);
 
 		*(*dv)= *(*dvf);
 
-		if((*dv)->dw)
+		if ((*dv)->dw)
 			(*dv)->dw= MEM_dupallocN((*dv)->dw);
 	}
 
@@ -388,7 +392,7 @@ static void ED_vgroup_nr_vert_add(Object *ob,
 	/* get the vert */
 	ED_vgroup_give_array(ob->data, &dvert, &tot);
 	
-	if(dvert==NULL)
+	if (dvert==NULL)
 		return;
 
 	/* check that vertnum is valid before trying to get the relevant dvert */
@@ -414,7 +418,7 @@ static void ED_vgroup_nr_vert_add(Object *ob,
 				break;
 			case WEIGHT_ADD:
 				dw->weight += weight;
-				if(dw->weight >= 1.0f)
+				if (dw->weight >= 1.0f)
 					dw->weight = 1.0f;
 				break;
 			case WEIGHT_SUBTRACT:
@@ -422,7 +426,7 @@ static void ED_vgroup_nr_vert_add(Object *ob,
 				/* if the weight is zero or less then
 				 * remove the vert from the deform group
 				 */
-				if(dw->weight <= 0.0f) {
+				if (dw->weight <= 0.0f) {
 					defvert_remove_group(dv, dw);
 				}
 				break;
@@ -467,11 +471,11 @@ void ED_vgroup_vert_add(Object *ob, bDeformGroup *dg, int vertnum, float weight,
 	/* get the deform group number, exit if
 	 * it can't be found
 	 */
-	if(def_nr < 0) return;
+	if (def_nr < 0) return;
 
 	/* if there's no deform verts then create some,
 	 */
-	if(ED_vgroup_give_array(ob->data, &dv, &tot) && dv==NULL)
+	if (ED_vgroup_give_array(ob->data, &dv, &tot) && dv==NULL)
 		ED_vgroup_data_create(ob->data);
 
 	/* call another function to do the work
@@ -489,7 +493,7 @@ void ED_vgroup_vert_remove(Object *ob, bDeformGroup	*dg, int vertnum)
 	/* TODO, this is slow in a loop, better pass def_nr directly, but leave for later... - campbell */
 	const int def_nr= BLI_findindex(&ob->defbase, dg);
 
-	if(def_nr != -1) {
+	if (def_nr != -1) {
 		MDeformVert *dvert= NULL;
 		int tot;
 
@@ -498,7 +502,7 @@ void ED_vgroup_vert_remove(Object *ob, bDeformGroup	*dg, int vertnum)
 		 */
 		ED_vgroup_give_array(ob->data, &dvert, &tot);
 
-		if(dvert) {
+		if (dvert) {
 			MDeformVert *dv= &dvert[vertnum];
 			MDeformWeight *dw;
 
@@ -511,32 +515,32 @@ 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;
-	EditVert *eve;
+	BMVert *eve;
 	Mesh *me;
 
 	/* get the deform vertices corresponding to the vertnum */
-	if(ob->type==OB_MESH) {
+	if (ob->type==OB_MESH) {
 		me= ob->data;
 
-		if(me->edit_mesh) {
-			eve= BLI_findlink(&me->edit_mesh->verts, vertnum);
-			if(!eve) {
+		if (me->edit_btmesh) {
+			eve= BM_vert_at_index(me->edit_btmesh->bm, vertnum);
+			if (!eve) {
 				return 0.0f;
 			}
-			dv= CustomData_em_get(&me->edit_mesh->vdata, eve->data, CD_MDEFORMVERT);
+			dv= CustomData_bmesh_get(&me->edit_btmesh->bm->vdata, eve->head.data, CD_MDEFORMVERT);
 		}
 		else {
-			if(vertnum >= me->totvert) {
+			if (vertnum >= me->totvert) {
 				return 0.0f;
 			}
 			dv = &me->dvert[vertnum];
 		}
 	}
-	else if(ob->type==OB_LATTICE) {
+	else if (ob->type==OB_LATTICE) {
 		Lattice *lt= vgroup_edit_lattice(ob);
 
-		if(lt->dvert) {
-			if(vertnum >= lt->pntsu*lt->pntsv*lt->pntsw) {
+		if (lt->dvert) {
+			if (vertnum >= lt->pntsu*lt->pntsv*lt->pntsw) {
 				return 0.0f;
 			}
 			dv = &lt->dvert[vertnum];
@@ -557,7 +561,7 @@ float ED_vgroup_vert_weight(Object *ob, bDeformGroup *dg, int vertnum)
 {
 	const int def_nr= BLI_findindex(&ob->defbase, dg);
 
-	if(def_nr == -1) {
+	if (def_nr == -1) {
 		return -1;
 	}
 
@@ -581,27 +585,26 @@ static void vgroup_select_verts(Object *ob, int select)
 		return;
 	}
 
-	if(ob->type == OB_MESH) {
+	if (ob->type == OB_MESH) {
 		Mesh *me= ob->data;
 
-		if (me->edit_mesh) {
-			EditMesh *em = BKE_mesh_get_editmesh(me);
-			EditVert *eve;
+		if (me->edit_btmesh) {
+			BMEditMesh *em = me->edit_btmesh;
+			BMIter iter;
+			BMVert *eve;
 
-			for (eve=em->verts.first; eve; eve=eve->next) {
-				if (!eve->h) {
-					dv= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
+			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);
 					if (defvert_find_index(dv, def_nr)) {
-						if (select)  eve->f |=  SELECT;
-						else         eve->f &= ~SELECT;
+						BM_vert_select_set(em->bm, eve, select);
 					}
 				}
 			}
-			/* this has to be called, because this function operates on vertices only */
-			if(select) EM_select_flush(em);	// vertices to edges/faces
-			else EM_deselect_flush(em);
 
-			BKE_mesh_end_editmesh(me, em);
+			/* this has to be called, because this function operates on vertices only */
+			if (select) EDBM_select_flush(em);	// vertices to edges/faces
+			else EDBM_deselect_flush(em);
 		}
 		else {
 			if (me->dvert) {
@@ -625,17 +628,17 @@ static void vgroup_select_verts(Object *ob, int select)
 			}
 		}
 	}
-	else if(ob->type == OB_LATTICE) {
+	else if (ob->type == OB_LATTICE) {
 		Lattice *lt= vgroup_edit_lattice(ob);
 		
-		if(lt->dvert) {
+		if (lt->dvert) {
 			BPoint *bp;
 			int a, tot;
 			
 			dv= lt->dvert;
 
 			tot= lt->pntsu*lt->pntsv*lt->pntsw;
-			for(a=0, bp= lt->def; a<tot; a++, bp++, dv++) {
+			for (a=0, bp= lt->def; a<tot; a++, bp++, dv++) {
 				if (defvert_find_index(dv, def_nr)) {
 					if (select)  bp->f1 |=  SELECT;
 					else         bp->f1 &= ~SELECT;
@@ -654,10 +657,10 @@ static void vgroup_duplicate(Object *ob)
 	int i, idg, icdg, dvert_tot=0;
 
 	dg = BLI_findlink(&ob->defbase, (ob->actdef-1));
-	if(!dg)
+	if (!dg)
 		return;
 	
-	if(!strstr(dg->name, "_copy")) {
+	if (!strstr(dg->name, "_copy")) {
 		BLI_snprintf(name, sizeof(name), "%s_copy", dg->name);
 	}
 	else {
@@ -678,10 +681,10 @@ static void vgroup_duplicate(Object *ob)
 	ED_vgroup_give_parray(ob->data, &dvert_array, &dvert_tot, FALSE);
 
 	if (dvert_array) {
-		for(i = 0; i < dvert_tot; i++) {
+		for (i = 0; i < dvert_tot; i++) {
 			MDeformVert *dv= dvert_array[i];
 			dw_org = defvert_find_index(dv, idg);
-			if(dw_org) {
+			if (dw_org) {
 				/* defvert_verify_index re-allocs org so need to store the weight first */
 				dw_cpy = defvert_verify_index(dv, icdg);
 				dw_cpy->weight = dw_org->weight;
@@ -699,8 +702,7 @@ static void vgroup_normalize(Object *ob)
 	int i, dvert_tot=0;
 	const int def_nr= ob->actdef-1;
 
-	Mesh *me = ob->data;
-	const int use_vert_sel= (me->editflag & ME_EDIT_VERT_SEL) != 0;
+	const int use_vert_sel = (ob->type == OB_MESH && ((Mesh *)ob->data)->editflag & ME_EDIT_VERT_SEL) != 0;
 
 	if (!BLI_findlink(&ob->defbase, def_nr)) {
 		return;
@@ -711,32 +713,32 @@ static void vgroup_normalize(Object *ob)
 	if (dvert_array) {
 		float weight_max = 0.0f;
 
-		for(i = 0; i < dvert_tot; i++) {
+		for (i = 0; i < dvert_tot; i++) {
 
-			/* incase its not selected */
+			/* in case its not selected */
 			if (!(dv = dvert_array[i])) {
 				continue;
 			}
 
 			dw = defvert_find_index(dv, def_nr);
-			if(dw) {
+			if (dw) {
 				weight_max = MAX2(dw->weight, weight_max);
 			}
 		}
 
-		if(weight_max > 0.0f) {
-			for(i = 0; i < dvert_tot; i++) {
+		if (weight_max > 0.0f) {
+			for (i = 0; i < dvert_tot; i++) {
 				
-				/* incase its not selected */
+				/* in case its not selected */
 				if (!(dv = dvert_array[i])) {
 					continue;
 				}
 
 				dw = defvert_find_index(dv, def_nr);
-				if(dw) {
+				if (dw) {
 					dw->weight /= weight_max;
 					
-					/* incase of division errors with very low weights */
+					/* in case of division errors with very low weights */
 					CLAMP(dw->weight, 0.0f, 1.0f);
 				}
 			}
@@ -746,118 +748,88 @@ static void vgroup_normalize(Object *ob)
 	}
 }
 
-/* This adds the indices of vertices to a list if they are not already present
-It returns the number that it added (0-2)
-It relies on verts having -1 for unassigned indices
-*/
-static int tryToAddVerts(int *verts, int length, int a, int b)
-{
-	char containsA = FALSE;
-	char containsB = FALSE;
-	int added = 0;
-	int i;
-	for(i = 0; i < length && (!containsA || !containsB); i++) {
-		if(verts[i] == a) {
-			containsA = TRUE;
-		} else if(verts[i] == b) {
-			containsB = TRUE;
-		} else if(verts[i] == -1) {
-			if(!containsA) {
-				verts[i] = a;
-				containsA = TRUE;
-				added++;
-			} else if(!containsB){
-				verts[i] = b;
-				containsB = TRUE;
-				added++;
-			}
-		}
-	}
-	return added;
-}
-
-/* This finds all of the vertices connected to vert by an edge
-and returns an array of indices of size count
-
-count is an int passed by reference so it can be assigned the value of the length here.
-*/
+/* This finds all of the vertices face-connected to vert by an edge and returns a
+ * MEM_allocated array of indices of size count.
+ * count is an int passed by reference so it can be assigned the value of the length here. */
 static int* getSurroundingVerts(Mesh *me, int vert, int *count)
 {
-	int length = 0;
-	int *tverts;
+	MPoly *mp = me->mpoly;
+	int i = me->totpoly;
+	/* Instead of looping twice on all polys and loops, and use a temp array, let's rather
+	 * use a BLI_array, with a reasonable starting/reserved size (typically, there are not
+	 * many vertices face-linked to another one, even 8 might be too high...). */
 	int *verts = NULL;
-	MFace *mf = me->mface;
-	int totface = me->totface;
-	int found = 0;
-	int i;
-	for(i = 0; i < totface; i++, mf++) {
-		if(vert == mf->v1 || vert == mf->v2 || vert == mf->v3 || (mf->v4 &&vert == mf->v4)) {
-			length+=2;
+	BLI_array_declare(verts);
+
+	BLI_array_reserve(verts, 8);
+	while (i--) {
+		int j = mp->totloop;
+		int first_l = mp->totloop - 1;
+		MLoop *ml = &me->mloop[mp->loopstart];
+		while (j--) {
+			/* XXX This assume a vert can only be once in a poly, even though
+			 *     it seems logical to me, not totally sure of that. */
+			if (ml->v == vert) {
+				int a, b, k;
+				if (j == first_l) {
+					/* We are on the first corner. */
+					a = ml[1].v;
+					b = ml[j].v;
+				}
+				else if (!j) {
+					/* We are on the last corner. */
+					a = (ml-1)->v;
+					b = me->mloop[mp->loopstart].v;
+				}
+				else {
+					a = (ml-1)->v;
+					b = (ml+1)->v;
+				}
+
+				/* Append a and b verts to array, if not yet present. */
+				k = BLI_array_count(verts);
+				/* XXX Maybe a == b is enough? */
+				while (k-- && !(a == b && a == -1)) {
+					if (verts[k] == a)
+						a = -1;
+					else if (verts[k] == b)
+						b = -1;
+				}
+				if (a != -1)
+					BLI_array_append(verts, a);
+				if (b != -1)
+					BLI_array_append(verts, b);
+
+				/* Vert found in this poly, we can go to next one! */
+				break;
+			}
+			ml++;
 		}
+		mp++;
 	}
-	if(!length) {
-		return NULL;
-	}
-	tverts = MEM_mallocN(sizeof(int)*length, "tempSurroundingVerts");
-	mf = me->mface;
-	for(i = 0; i < length; i++) {
-		tverts[i] = -1;
-	}
-	for(i = 0; i < totface; i++, mf++) {
-		int a=-1, b=-1;
-		if(mf->v1 == vert) {
-			a = mf->v2;
-			if(mf->v4) {
-				b = mf->v4;
-			} else {
-				b = mf->v3;
-			}
-		} else if(mf->v2 == vert) {
-			a = mf->v1;
-			b = mf->v3;
-		} else if(mf->v3 == vert) {
-			a = mf->v2;
-			if(mf->v4) {
-				b = mf->v4;
-			} else {
-				b = mf->v1;
-			}
-		} else if (mf->v4 && mf->v4 == vert){
-			a = mf->v1;
-			b = mf->v3;
-		} else {
-			continue;
-		}
-		found += tryToAddVerts(tverts, length, a, b);
-	}
-	if(found) {
-		verts = MEM_mallocN(sizeof(int)* found, "surroundingVerts");
-		for(i = 0; i < found; i++) {
-			verts[i] = tverts[i];
-		}
-		*count = found;
-	}
-	MEM_freeN(tverts);
+
+	/* Do not free the array! */
+	*count = BLI_array_count(verts);
 	return verts;
 }
 
 /* get a single point in space by averaging a point cloud (vectors of size 3)
-coord is the place the average is stored, points is the point cloud, count is the number of points in the cloud
-*/
+ * coord is the place the average is stored, points is the point cloud, count is the number of points in the cloud
+ */
 static void getSingleCoordinate(MVert *points, int count, float coord[3])
 {
 	int i;
 	zero_v3(coord);
-	for(i = 0; i < count; i++) {
+	for (i = 0; i < count; i++) {
 		add_v3_v3(coord, points[i].co);
 	}
 	mul_v3_fl(coord, 1.0f/count);
 }
 
 /* given a plane and a start and end position,
-compute the amount of vertical distance relative to the plane and store it in dists,
-then get the horizontal and vertical change and store them in changes
-*/
+ * compute the amount of vertical distance relative to the plane and store it in dists,
+ * then get the horizontal and vertical change and store them in changes
+ */
 static void getVerticalAndHorizontalChange(const float norm[3], float d, const float coord[3],
                                            const float start[3], float distToStart,
                                            float *end, float (*changes)[2], float *dists, int index)
@@ -881,32 +853,32 @@ static void getVerticalAndHorizontalChange(const float norm[3], float d, const f
 // 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) {
+	if (ob->derivedDeform && (ob->derivedDeform)==dm) {
 		ob->derivedDeform->needsFree = 1;
 		ob->derivedDeform->release(ob->derivedDeform);
 		ob->derivedDeform = NULL;
 	}
-	else if(dm) {
+	else if (dm) {
 		dm->needsFree = 1;
 		dm->release(dm);
 	}
 }
 
-// recalculate the deformation
+/* recalculate the deformation */
 static DerivedMesh* dm_deform_recalc(Scene *scene, Object *ob)
 {
 	return mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH);
 }
 
 /* by changing nonzero weights, try to move a vertex in me->mverts with index 'index' to
-distToBe distance away from the provided plane strength can change distToBe so that it moves
-towards distToBe by that percentage cp changes how much the weights are adjusted
-to check the distance
-
-index is the index of the vertex being moved
-norm and d are the plane's properties for the equation: ax + by + cz + d = 0
-coord is a point on the plane
-*/
+ * distToBe distance away from the provided plane strength can change distToBe so that it moves
+ * towards distToBe by that percentage cp changes how much the weights are adjusted
+ * to check the distance
+ *
+ * index is the index of the vertex being moved
+ * norm and d are the plane's properties for the equation: ax + by + cz + d = 0
+ * coord is a point on the plane
+ */
 static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, int index, float norm[3],
                                           float coord[3], float d, float distToBe, float strength, float cp)
 {
@@ -939,56 +911,59 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
 		copy_v3_v3(oldPos, m.co);
 		distToStart = dot_v3v3(norm, oldPos) + d;
 
-		if(distToBe == originalDistToBe) {
+		if (distToBe == originalDistToBe) {
 			distToBe += distToStart - distToStart*strength;
 		}
-		for(i = 0; i < totweight; i++) {
+		for (i = 0; i < totweight; i++) {
 			dwIndices[i] = i;
 			dw = (dvert->dw+i);
 			vc = hc = 0;
-			if(!dw->weight) {
+			if (!dw->weight) {
 				changes[i][0] = 0;
 				changes[i][1] = 0;
 				dists[i] = distToStart;
 				continue;
 			}
-			for(k = 0; k < 2; k++) {
-				if(dm) {
+			for (k = 0; k < 2; k++) {
+				if (dm) {
 					dm_deform_clear(dm, ob); dm = NULL;
 				}
 				oldw = dw->weight;
-				if(k) {
+				if (k) {
 					dw->weight *= 1+cp;
-				} else {
+				}
+				else {
 					dw->weight /= 1+cp;
 				}
-				if(dw->weight == oldw) {
+				if (dw->weight == oldw) {
 					changes[i][0] = 0;
 					changes[i][1] = 0;
 					dists[i] = distToStart;
 					break;
 				}
-				if(dw->weight > 1) {
+				if (dw->weight > 1) {
 					dw->weight = 1;
 				}
 				dm = dm_deform_recalc(scene, ob);
 				dm->getVert(dm, index, &m);
 				getVerticalAndHorizontalChange(norm, d, coord, oldPos, distToStart, m.co, changes, dists, i);
 				dw->weight = oldw;
-				if(!k) {
+				if (!k) {
 					vc = changes[i][0];
 					hc = changes[i][1];
 					dist = dists[i];
-				} else {
-					if(fabs(dist - distToBe) < fabs(dists[i] - distToBe)) {
+				}
+				else {
+					if (fabs(dist - distToBe) < fabs(dists[i] - distToBe)) {
 						upDown[i] = 0;
 						changes[i][0] = vc;
 						changes[i][1] = hc;
 						dists[i] = dist;
-					} else {
+					}
+					else {
 						upDown[i] = 1;
 					}
-					if(fabs(dists[i] - distToBe) > fabs(distToStart - distToBe)) {
+					if (fabs(dists[i] - distToBe) > fabs(distToStart - distToBe)) {
 						changes[i][0] = 0;
 						changes[i][1] = 0;
 						dists[i] = distToStart;
@@ -997,19 +972,19 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
 			}
 		}
 		// sort the changes by the vertical change
-		for(k = 0; k < totweight; k++) {
+		for (k = 0; k < totweight; k++) {
 			float tf;
 			int ti;
 			bestIndex = k;
-			for(i = k+1; i < totweight; i++) {
+			for (i = k+1; i < totweight; i++) {
 				dist = dists[i];
 
-				if(fabs(dist) > fabs(dists[i])) {
+				if (fabs(dist) > fabs(dists[i])) {
 					bestIndex = i;
 				}
 			}
 			// switch with k
-			if(bestIndex != k) {
+			if (bestIndex != k) {
 				ti = upDown[k];
 				upDown[k] = upDown[bestIndex];
 				upDown[bestIndex] = ti;
@@ -1033,18 +1008,18 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
 		}
 		bestIndex = -1;
 		// find the best change with an acceptable horizontal change
-		for(i = 0; i < totweight; i++) {
-			if(fabs(changes[i][0]) > fabs(changes[i][1]*2.0f)) {
+		for (i = 0; i < totweight; i++) {
+			if (fabs(changes[i][0]) > fabs(changes[i][1]*2.0f)) {
 				bestIndex = i;
 				break;
 			}
 		}
-		if(bestIndex != -1) {
+		if (bestIndex != -1) {
 			wasChange = TRUE;
 			// it is a good place to stop if it tries to move the opposite direction
 			// (relative to the plane) of last time
-			if(lastIndex != -1) {
-				if(wasUp != upDown[bestIndex]) {
+			if (lastIndex != -1) {
+				if (wasUp != upDown[bestIndex]) {
 					wasChange = FALSE;
 				}
 			}
@@ -1052,22 +1027,23 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
 			wasUp = upDown[bestIndex];
 			dw = (dvert->dw+dwIndices[bestIndex]);
 			oldw = dw->weight;
-			if(upDown[bestIndex]) {
+			if (upDown[bestIndex]) {
 				dw->weight *= 1+cp;
-			} else {
+			}
+			else {
 				dw->weight /= 1+cp;
 			}
-			if(dw->weight > 1) {
+			if (dw->weight > 1) {
 				dw->weight = 1;
 			}
-			if(oldw == dw->weight) {
+			if (oldw == dw->weight) {
 				wasChange = FALSE;
 			}
-			if(dm) {
+			if (dm) {
 				dm_deform_clear(dm, ob); dm = NULL;
 			}
 		}
-	} while(wasChange && (distToStart-distToBe)/fabsf(distToStart-distToBe) ==
+	} while (wasChange && (distToStart-distToBe)/fabsf(distToStart-distToBe) ==
 	                     (dists[bestIndex]-distToBe)/fabsf(dists[bestIndex]-distToBe));
 	MEM_freeN(upDown);
 	MEM_freeN(changes);
@@ -1076,32 +1052,32 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
 }
 
 /* this is used to try to smooth a surface by only adjusting the nonzero weights of a vertex 
-but it could be used to raise or lower an existing 'bump.' */
+ * but it could be used to raise or lower an existing 'bump.' */
 static void vgroup_fix(Scene *scene, Object *ob, float distToBe, float strength, float cp)
 {
 	int i;
 
 	Mesh *me = ob->data;
 	MVert *mvert = me->mvert;
-	const int use_vert_sel= (me->editflag & ME_EDIT_VERT_SEL) != 0;
 	int *verts = NULL;
-	for(i = 0; i < me->totvert && mvert; i++, mvert++) {
-		
-		if(use_vert_sel && (mvert->flag & SELECT)) {
-			
+	if (!(me->editflag & ME_EDIT_VERT_SEL))
+		return;
+	for (i = 0; i < me->totvert && mvert; i++, mvert++) {
+		if (mvert->flag & SELECT) {
 			int count=0;
-			if((verts = getSurroundingVerts(me, i, &count))) {
+			if ((verts = getSurroundingVerts(me, i, &count))) {
 				MVert m;
 				MVert *p = MEM_callocN(sizeof(MVert)*(count), "deformedPoints");
 				int k;
 
 				DerivedMesh *dm = mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH);
-				for(k = 0; k < count; k++) {
+				k = count;
+				while (k--) {
 					dm->getVert(dm, verts[k], &m);
 					p[k] = m;
 				}
 				
-				if(count >= 3) {
+				if (count >= 3) {
 					float d /*, dist */ /* UNUSED */, mag;
 					float coord[3];
 					float norm[3];
@@ -1109,7 +1085,7 @@ static void vgroup_fix(Scene *scene, Object *ob, float distToBe, float strength,
 					dm->getVert(dm, i, &m);
 					sub_v3_v3v3(norm, m.co, coord);
 					mag= normalize_v3(norm);
-					if(mag) { /* zeros fix */
+					if (mag) { /* zeros fix */
 						d = -dot_v3v3(norm, coord);
 						/* dist = (dot_v3v3(norm, m.co) + d); */ /* UNUSED */
 						moveCloserToDistanceFromPlane(scene, ob, me, i, norm, coord, d, distToBe, strength, cp);
@@ -1130,8 +1106,7 @@ static void vgroup_levels(Object *ob, float offset, float gain)
 	int i, dvert_tot=0;
 	const int def_nr= ob->actdef-1;
 
-	Mesh *me = ob->data;
-	const int use_vert_sel= (me->editflag & ME_EDIT_VERT_SEL) != 0;
+	const int use_vert_sel = (ob->type == OB_MESH && ((Mesh *)ob->data)->editflag & ME_EDIT_VERT_SEL) != 0;
 
 	if (!BLI_findlink(&ob->defbase, def_nr)) {
 		return;
@@ -1140,15 +1115,15 @@ static void vgroup_levels(Object *ob, float offset, float gain)
 	ED_vgroup_give_parray(ob->data, &dvert_array, &dvert_tot, use_vert_sel);
 
 	if (dvert_array) {
-		for(i = 0; i < dvert_tot; i++) {
+		for (i = 0; i < dvert_tot; i++) {
 
-			/* incase its not selected */
+			/* in case its not selected */
 			if (!(dv = dvert_array[i])) {
 				continue;
 			}
 
 			dw = defvert_find_index(dv, def_nr);
-			if(dw) {
+			if (dw) {
 				dw->weight = gain * (dw->weight + offset);
 
 				CLAMP(dw->weight, 0.0f, 1.0f);
@@ -1166,8 +1141,7 @@ static void vgroup_normalize_all(Object *ob, int lock_active)
 	int i, dvert_tot=0;
 	const int def_nr= ob->actdef-1;
 
-	Mesh *me = ob->data;
-	const int use_vert_sel= (me->editflag & ME_EDIT_VERT_SEL) != 0;
+	const int use_vert_sel = (ob->type == OB_MESH && ((Mesh *)ob->data)->editflag & ME_EDIT_VERT_SEL) != 0;
 
 	if (lock_active && !BLI_findlink(&ob->defbase, def_nr)) {
 		return;
@@ -1176,10 +1150,10 @@ static void vgroup_normalize_all(Object *ob, int lock_active)
 	ED_vgroup_give_parray(ob->data, &dvert_array, &dvert_tot, use_vert_sel);
 
 	if (dvert_array) {
-		if(lock_active) {
+		if (lock_active) {
 
-			for(i = 0; i < dvert_tot; i++) {
-				/* incase its not selected */
+			for (i = 0; i < dvert_tot; i++) {
+				/* in case its not selected */
 				if (!(dv = dvert_array[i])) {
 					continue;
 				}
@@ -1188,9 +1162,9 @@ static void vgroup_normalize_all(Object *ob, int lock_active)
 			}
 		}
 		else {
-			for(i = 0; i < dvert_tot; i++) {
+			for (i = 0; i < dvert_tot; i++) {
 
-				/* incase its not selected */
+				/* in case its not selected */
 				if (!(dv = dvert_array[i])) {
 					continue;
 				}
@@ -1208,17 +1182,17 @@ static void vgroup_lock_all(Object *ob, int action)
 {
 	bDeformGroup *dg;
 
-	if(action == SEL_TOGGLE) {
+	if (action == SEL_TOGGLE) {
 		action= SEL_SELECT;
-		for(dg= ob->defbase.first; dg; dg= dg->next) {
-			if(dg->flag & DG_LOCK_WEIGHT) {
+		for (dg= ob->defbase.first; dg; dg= dg->next) {
+			if (dg->flag & DG_LOCK_WEIGHT) {
 				action= SEL_DESELECT;
 				break;
 			}
 		}
 	}
 
-	for(dg= ob->defbase.first; dg; dg= dg->next) {
+	for (dg= ob->defbase.first; dg; dg= dg->next) {
 		switch(action) {
 			case SEL_SELECT:
 				dg->flag |= DG_LOCK_WEIGHT;
@@ -1239,9 +1213,7 @@ static void vgroup_invert(Object *ob, const short auto_assign, const short auto_
 	MDeformVert *dv, **dvert_array=NULL;
 	int i, dvert_tot=0;
 	const int def_nr= ob->actdef-1;
-	
-	Mesh *me = ob->data;
-	const int use_vert_sel= (me->editflag & ME_EDIT_VERT_SEL) != 0;
+	const int use_vert_sel = (ob->type == OB_MESH && ((Mesh *)ob->data)->editflag & ME_EDIT_VERT_SEL) != 0;
 
 	if (!BLI_findlink(&ob->defbase, def_nr)) {
 		return;
@@ -1250,9 +1222,9 @@ static void vgroup_invert(Object *ob, const short auto_assign, const short auto_
 	ED_vgroup_give_parray(ob->data, &dvert_array, &dvert_tot, use_vert_sel);
 
 	if (dvert_array) {
-		for(i = 0; i < dvert_tot; i++) {
+		for (i = 0; i < dvert_tot; i++) {
 
-			/* incase its not selected */
+			/* in case its not selected */
 			if (!(dv = dvert_array[i])) {
 				continue;
 			}
@@ -1264,10 +1236,10 @@ static void vgroup_invert(Object *ob, const short auto_assign, const short auto_
 				dw= defvert_find_index(dv, def_nr);
 			}
 
-			if(dw) {
+			if (dw) {
 				dw->weight = 1.0f - dw->weight;
 
-				if(auto_remove && dw->weight <= 0.0f) {
+				if (auto_remove && dw->weight <= 0.0f) {
 					defvert_remove_group(dv, dw);
 				}
 			}
@@ -1277,84 +1249,133 @@ static void vgroup_invert(Object *ob, const short auto_assign, const short auto_
 	}
 }
 
-static void vgroup_blend(Object *ob)
+static void vgroup_blend(Object *ob, const float fac)
 {
+	MDeformVert *dv;
 	MDeformWeight *dw;
-	MDeformVert *dvert_array=NULL, *dvert;
 	int i, dvert_tot=0;
-	const int def_nr= ob->actdef-1;
+	const int def_nr= ob->actdef - 1;
 
-	EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)ob->data));
-	// ED_vgroup_give_array(ob->data, &dvert_array, &dvert_tot);
+	BLI_assert(fac >= 0.0 && fac <= 1.0f);
 
-	if (em==NULL)
+	if (ob->type != OB_MESH) {
 		return;
+	}
 
 	if (BLI_findlink(&ob->defbase, def_nr)) {
-		int sel1, sel2;
-		int i1, i2;
+		const float ifac = 1.0f - fac;
+
+		BMEditMesh *em = BMEdit_FromObject(ob);
+		BMesh *bm = em ? em->bm : NULL;
+		Mesh  *me = em ? NULL   : ob->data;
+
+		/* bmesh only*/
+		BMEdge *eed;
+		BMVert *eve;
+		BMIter iter;
+
+		/* mesh only */
+		MDeformVert *dvert_array = NULL;
+
 
-		EditEdge *eed;
-		EditVert *eve;
 		float *vg_weights;
 		float *vg_users;
+		int sel1, sel2;
 
-		i= 0;
-		for(eve= em->verts.first; eve; eve= eve->next)
-			eve->tmp.l= i++;
+		if (bm) {
+			BM_mesh_elem_index_ensure(bm, BM_VERT);
+			dvert_tot = bm->totvert;
+		}
+		else {
+			dvert_tot = me->totvert;
+			dvert_array = me->dvert;
+		}
 
-		dvert_tot= i;
+		vg_weights = MEM_callocN(sizeof(float) * dvert_tot, "vgroup_blend_f");
+		vg_users = MEM_callocN(sizeof(int) * dvert_tot, "vgroup_blend_i");
 
-		vg_weights= MEM_callocN(sizeof(float)*dvert_tot, "vgroup_blend_f");
-		vg_users= MEM_callocN(sizeof(int)*dvert_tot, "vgroup_blend_i");
+		if (bm) {
+			BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
+				sel1 = BM_elem_flag_test(eed->v1, BM_ELEM_SELECT);
+				sel2 = BM_elem_flag_test(eed->v2, BM_ELEM_SELECT);
 
-		for(eed= em->edges.first; eed; eed= eed->next) {
-			sel1= eed->v1->f & SELECT;
-			sel2= eed->v2->f & SELECT;
+				if (sel1 != sel2) {
+					int i1 /* , i2 */;
+					/* i1 is always the selected one */
+					if (sel1) {
+						i1= BM_elem_index_get(eed->v1);
+						/* i2= BM_elem_index_get(eed->v2); */ /* UNUSED */
+						eve= eed->v2;
+					}
+					else {
+						/* i2= BM_elem_index_get(eed->v1); */ /* UNUSED */
+						i1= BM_elem_index_get(eed->v2);
+						eve= eed->v1;
+					}
 
-			if(sel1 != sel2) {
-				/* i1 is always the selected one */
-				if(sel1==TRUE && sel2==FALSE) {
-					i1= eed->v1->tmp.l;
-					i2= eed->v2->tmp.l;
-					eve= eed->v2;
-				}
-				else {
-					i2= eed->v1->tmp.l;
-					i1= eed->v2->tmp.l;
-					eve= eed->v1;
+					dv = CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_MDEFORMVERT);
+					dw = defvert_find_index(dv, def_nr);
+					if (dw) {
+						vg_weights[i1] += dw->weight;
+					}
+					vg_users[i1]++;
 				}
+			}
 
-				vg_users[i1]++;
-
-				/* TODO, we may want object mode blending */
-				if(em)	dvert= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
-				else	dvert= dvert_array+i2;
-
-				dw= defvert_find_index(dvert, def_nr);
+			BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, i) {
+				if (BM_elem_flag_test(eve, BM_ELEM_SELECT) && vg_users[i] > 0) {
+					dv = CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_MDEFORMVERT);
 
-				if(dw) {
-					vg_weights[i1] += dw->weight;
+					dw = defvert_verify_index(dv, def_nr);
+					dw->weight = (fac * (vg_weights[i] / (float)vg_users[i])) + (ifac * dw->weight);
+					/* in case of division errors */
+					CLAMP(dw->weight, 0.0f, 1.0f);
 				}
 			}
 		}
+		else {
+			MEdge *ed = me->medge;
+			MVert *mv;
 
-		i= 0;
-		for(eve= em->verts.first; eve; eve= eve->next) {
-			if(eve->f & SELECT && vg_users[i] > 0) {
-				/* TODO, we may want object mode blending */
-				if(em)	dvert= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
-				else	dvert= dvert_array+i;
+			for (i = 0; i < me->totedge; i++, ed++) {
+				sel1 = me->mvert[ed->v1].flag & SELECT;
+				sel2 = me->mvert[ed->v2].flag & SELECT;
 
-				dw= defvert_verify_index(dvert, def_nr);
-				dw->weight= vg_weights[i] / (float)vg_users[i];
+				if (sel1 != sel2) {
+					int i1, i2;
+					/* i1 is always the selected one */
+					if (sel1) {
+						i1 = ed->v1;
+						i2 = ed->v2;
+					}
+					else {
+						i2 = ed->v1;
+						i1 = ed->v2;
+					}
 
-				/* incase of division errors */
-				CLAMP(dw->weight, 0.0f, 1.0f);
+					dv = &dvert_array[i2];
+					dw = defvert_find_index(dv, def_nr);
+					if (dw) {
+						vg_weights[i1] += dw->weight;
+					}
+					vg_users[i1]++;
+				}
 			}
 
-			i++;
+			mv = me->mvert;
+			dv = dvert_array;
+
+			for (i = 0; i < dvert_tot; i++, mv++, dv++) {
+				if ((mv->flag & SELECT) && (vg_users[i] > 0)) {
+					dw = defvert_verify_index(dv, def_nr);
+					dw->weight = (fac * (vg_weights[i] / (float)vg_users[i])) + (ifac * dw->weight);
+
+					/* in case of division errors */
+					CLAMP(dw->weight, 0.0f, 1.0f);
+				}
+			}
 		}
+
 		MEM_freeN(vg_weights);
 		MEM_freeN(vg_users);
 	}
@@ -1366,9 +1387,7 @@ static void vgroup_clean(Object *ob, const float epsilon, int keep_single)
 	MDeformVert *dv, **dvert_array=NULL;
 	int i, dvert_tot=0;
 	const int def_nr= ob->actdef-1;
-	
-	Mesh *me = ob->data;
-	const int use_vert_sel= (me->editflag & ME_EDIT_VERT_SEL) != 0;
+	const int use_vert_sel = (ob->type == OB_MESH && ((Mesh *)ob->data)->editflag & ME_EDIT_VERT_SEL) != 0;
 
 	if (!BLI_findlink(&ob->defbase, def_nr)) {
 		return;
@@ -1378,9 +1397,9 @@ static void vgroup_clean(Object *ob, const float epsilon, int keep_single)
 
 	if (dvert_array) {
 		/* only the active group */
-		for(i = 0; i < dvert_tot; i++) {
+		for (i = 0; i < dvert_tot; i++) {
 
-			/* incase its not selected */
+			/* in case its not selected */
 			if (!(dv = dvert_array[i])) {
 				continue;
 			}
@@ -1389,7 +1408,7 @@ static void vgroup_clean(Object *ob, const float epsilon, int keep_single)
 
 			if (dw) {
 				if (dw->weight <= epsilon) {
-					if(keep_single==FALSE || dv->totweight > 1) {
+					if (keep_single==FALSE || dv->totweight > 1) {
 						defvert_remove_group(dv, dw); /* dw can be NULL */
 					}
 				}
@@ -1403,10 +1422,8 @@ static void vgroup_clean(Object *ob, const float epsilon, int keep_single)
 static void vgroup_clean_all(Object *ob, const float epsilon, const int keep_single)
 {
 	MDeformVert **dvert_array=NULL;
-	int i, dvert_tot=0;
-	
-	Mesh *me = ob->data;
-	const int use_vert_sel= (me->editflag & ME_EDIT_VERT_SEL) != 0;
+	int i, dvert_tot = 0;
+	const int use_vert_sel = (ob->type == OB_MESH && ((Mesh *)ob->data)->editflag & ME_EDIT_VERT_SEL) != 0;
 
 	ED_vgroup_give_parray(ob->data, &dvert_array, &dvert_tot, use_vert_sel);
 
@@ -1414,24 +1431,24 @@ static void vgroup_clean_all(Object *ob, const float epsilon, const int keep_sin
 		MDeformVert *dv;
 		MDeformWeight *dw;
 
-		for(i = 0; i < dvert_tot; i++) {
+		for (i = 0; i < dvert_tot; i++) {
 			int j;
 
-			/* incase its not selected */
+			/* in case its not selected */
 			if (!(dv = dvert_array[i])) {
 				continue;
 			}
 
 			j= dv->totweight;
 
-			while(j--) {
+			while (j--) {
 
-				if(keep_single && dv->totweight == 1)
+				if (keep_single && dv->totweight == 1)
 					break;
 
 				dw= dv->dw + j;
 
-				if(dw->weight <= epsilon) {
+				if (dw->weight <= epsilon) {
 					defvert_remove_group(dv, dw);
 				}
 			}
@@ -1450,9 +1467,9 @@ static void dvert_mirror_op(MDeformVert *dvert, MDeformVert *dvert_mirr,
 {
 	BLI_assert(sel || sel_mirr);
 
-	if(sel_mirr && sel) {
+	if (sel_mirr && sel) {
 		/* swap */
-		if(mirror_weights) {
+		if (mirror_weights) {
 			if (all_vgroups) {
 				SWAP(MDeformVert, *dvert, *dvert_mirr);
 			}
@@ -1471,18 +1488,18 @@ static void dvert_mirror_op(MDeformVert *dvert, MDeformVert *dvert_mirr,
 			}
 		}
 
-		if(flip_vgroups) {
+		if (flip_vgroups) {
 			defvert_flip(dvert, flip_map, flip_map_len);
 			defvert_flip(dvert_mirr, flip_map, flip_map_len);
 		}
 	}
 	else {
 		/* dvert should always be the target, only swaps pointer */
-		if(sel_mirr) {
+		if (sel_mirr) {
 			SWAP(MDeformVert *, dvert, dvert_mirr);
 		}
 
-		if(mirror_weights) {
+		if (mirror_weights) {
 			if (all_vgroups) {
 				defvert_copy(dvert, dvert_mirr);
 			}
@@ -1492,7 +1509,7 @@ static void dvert_mirror_op(MDeformVert *dvert, MDeformVert *dvert_mirr,
 		}
 
 		/* flip map already modified for 'all_vgroups' */
-		if(flip_vgroups) {
+		if (flip_vgroups) {
 			defvert_flip(dvert, flip_map, flip_map_len);
 		}
 	}
@@ -1511,7 +1528,7 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
                         all_vgroups, def_nr                                   \
                         )
 
-	EditVert *eve, *eve_mirr;
+	BMVert *eve, *eve_mirr;
 	MDeformVert *dvert, *dvert_mirr;
 	short sel, sel_mirr;
 	int	*flip_map, flip_map_len;
@@ -1541,41 +1558,45 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
 	}
 
 	/* only the active group */
-	if(ob->type == OB_MESH) {
+	if (ob->type == OB_MESH) {
 		Mesh *me= ob->data;
-		EditMesh *em = BKE_mesh_get_editmesh(me);
+		BMEditMesh *em = me->edit_btmesh;
 
 		if (em) {
-			if(!CustomData_has_layer(&em->vdata, CD_MDEFORMVERT)) {
+			BMIter iter;
+
+			if (!CustomData_has_layer(&em->bm->vdata, CD_MDEFORMVERT)) {
 				goto cleanup;
 			}
 
-			EM_cache_x_mirror_vert(ob, em);
+			EDBM_verts_mirror_cache_begin(em, FALSE);
 
 			/* Go through the list of editverts and assign them */
-			for(eve=em->verts.first; eve; eve=eve->next){
-				if((eve_mirr=eve->tmp.v)) {
-					sel= eve->f & SELECT;
-					sel_mirr= eve_mirr->f & SELECT;
-
-					if((sel || sel_mirr) && (eve != eve_mirr)) {
-						dvert= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
-						dvert_mirr= CustomData_em_get(&em->vdata, eve_mirr->data, CD_MDEFORMVERT);
-						if(dvert && dvert_mirr) {
+			BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+				if ((eve_mirr= EDBM_verts_mirror_get(em, eve))) {
+					sel= BM_elem_flag_test(eve, BM_ELEM_SELECT);
+					sel_mirr= BM_elem_flag_test(eve_mirr, BM_ELEM_SELECT);
+
+					if ((sel || sel_mirr) && (eve != eve_mirr)) {
+						dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
+						dvert_mirr= CustomData_bmesh_get(&em->bm->vdata, eve_mirr->head.data, CD_MDEFORMVERT);
+						if (dvert && dvert_mirr) {
 							VGROUP_MIRR_OP;
 						}
 					}
 
-					eve->tmp.v= eve_mirr->tmp.v= NULL;
+					/* don't use these again */
+					EDBM_verts_mirror_cache_clear(em, eve);
+					EDBM_verts_mirror_cache_clear(em, eve_mirr);
 				}
 			}
-			BKE_mesh_end_editmesh(me, em);
+			EDBM_verts_mirror_cache_end(em);
 		}
 		else {
 			/* object mode / weight paint */
 			MVert *mv, *mv_mirr;
 			int vidx, vidx_mirr;
-			const int use_vert_sel= (me->editflag & ME_EDIT_VERT_SEL) != 0;
+			const int use_vert_sel = (me->editflag & ME_EDIT_VERT_SEL) != 0;
 
 			if (me->dvert == NULL) {
 				goto cleanup;
@@ -1586,11 +1607,11 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
 			}
 
 			/* tag verts we have used */
-			for(vidx= 0, mv= me->mvert; vidx < me->totvert; vidx++, mv++) {
+			for (vidx= 0, mv= me->mvert; vidx < me->totvert; vidx++, mv++) {
 				mv->flag &= ~ME_VERT_TMP_TAG;
 			}
 
-			for(vidx= 0, mv= me->mvert; vidx < me->totvert; vidx++, mv++) {
+			for (vidx= 0, mv= me->mvert; vidx < me->totvert; vidx++, mv++) {
 				if (    ((mv->flag & ME_VERT_TMP_TAG) == 0) &&
 				        ((vidx_mirr= mesh_get_x_mirror_vert(ob, vidx)) != -1) &&
 				        (vidx != vidx_mirr) &&
@@ -1622,20 +1643,20 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
 		int pntsu_half;
 		/* half but found up odd value */
 
-		if(lt->pntsu == 1 || lt->dvert == NULL) {
+		if (lt->pntsu == 1 || lt->dvert == NULL) {
 			goto cleanup;
 		}
 
-		/* unlike editmesh we know that by only looping over the first hald of
-		 * the 'u' indicies it will cover all points except the middle which is
+		/* unlike editmesh we know that by only looping over the first half of
+		 * the 'u' indices it will cover all points except the middle which is
 		 * ok in this case */
 		pntsu_half= lt->pntsu / 2;
 
-		for(w=0; w<lt->pntsw; w++) {
-			for(v=0; v<lt->pntsv; v++) {
-				for(u=0; u<pntsu_half; u++) {
+		for (w=0; w<lt->pntsw; w++) {
+			for (v=0; v<lt->pntsv; v++) {
+				for (u=0; u<pntsu_half; u++) {
 					int u_inv= (lt->pntsu - 1) - u;
-					if(u != u_inv) {
+					if (u != u_inv) {
 						BPoint *bp, *bp_mirr;
 
 						i1= LT_INDEX(lt, u, v, w);
@@ -1647,7 +1668,7 @@ void ED_vgroup_mirror(Object *ob, const short mirror_weights, const short flip_v
 						sel= bp->f1 & SELECT;
 						sel_mirr= bp_mirr->f1 & SELECT;
 
-						if(sel || sel_mirr) {
+						if (sel || sel_mirr) {
 							dvert= &lt->dvert[i1];
 							dvert_mirr= &lt->dvert[i2];
 
@@ -1678,19 +1699,19 @@ static void vgroup_remap_update_users(Object *ob, int *map)
 	/* these cases don't use names to refer to vertex groups, so when
 	 * they get deleted the numbers get out of sync, this corrects that */
 
-	if(ob->soft)
+	if (ob->soft)
 		ob->soft->vertgroup= map[ob->soft->vertgroup];
 
-	for(md=ob->modifiers.first; md; md=md->next) {
-		if(md->type == eModifierType_Explode) {
+	for (md=ob->modifiers.first; md; md=md->next) {
+		if (md->type == eModifierType_Explode) {
 			emd= (ExplodeModifierData*)md;
 			emd->vgroup= map[emd->vgroup];
 		}
-		else if(md->type == eModifierType_Cloth) {
+		else if (md->type == eModifierType_Cloth) {
 			clmd= (ClothModifierData*)md;
 			clsim= clmd->sim_parms;
 
-			if(clsim) {
+			if (clsim) {
 				clsim->vgroup_mass= map[clsim->vgroup_mass];
 				clsim->vgroup_bend= map[clsim->vgroup_bend];
 				clsim->vgroup_struct= map[clsim->vgroup_struct];
@@ -1698,8 +1719,8 @@ static void vgroup_remap_update_users(Object *ob, int *map)
 		}
 	}
 
-	for(psys=ob->particlesystem.first; psys; psys=psys->next) {
-		for(a=0; a<PSYS_TOT_VG; a++)
+	for (psys=ob->particlesystem.first; psys; psys=psys->next) {
+		for (a=0; a<PSYS_TOT_VG; a++)
 			psys->vgroup[a]= map[psys->vgroup[a]];
 	}
 }
@@ -1711,8 +1732,8 @@ static void vgroup_delete_update_users(Object *ob, int id)
 	int *map= MEM_mallocN(sizeof(int) * defbase_tot, "vgroup del");
 
 	map[id]= map[0]= 0;
-	for(i=1; i<id; i++) map[i]=i;
-	for(i=id+1; i<defbase_tot; i++) map[i]=i-1;
+	for (i=1; i<id; i++) map[i]=i;
+	for (i=id+1; i<defbase_tot; i++) map[i]=i-1;
 
 	vgroup_remap_update_users(ob, map);
 	MEM_freeN(map);
@@ -1729,18 +1750,18 @@ static void vgroup_delete_object_mode(Object *ob, bDeformGroup *dg)
 
 	ED_vgroup_give_array(ob->data, &dvert_array, &dvert_tot);
 
-	if(dvert_array) {
+	if (dvert_array) {
 		int i, j;
 		MDeformVert *dv;
-		for(i= 0, dv= dvert_array; i < dvert_tot; i++, dv++) {
+		for (i= 0, dv= dvert_array; i < dvert_tot; i++, dv++) {
 			MDeformWeight *dw;
 
 			dw= defvert_find_index(dv, def_nr);
 			defvert_remove_group(dv, dw); /* dw can be NULL */
 
 			/* inline, make into a function if anything else needs to do this */
-			for(j = 0; j < dv->totweight; j++) {
-				if(dv->dw[j].def_nr > def_nr) {
+			for (j = 0; j < dv->totweight; j++) {
+				if (dv->dw[j].def_nr > def_nr) {
 					dv->dw[j].def_nr--;
 				}
 			}
@@ -1754,9 +1775,9 @@ static void vgroup_delete_object_mode(Object *ob, bDeformGroup *dg)
 	BLI_freelinkN(&ob->defbase, dg);
 
 	/* Update the active deform index if necessary */
-	if(ob->actdef > def_nr)
+	if (ob->actdef > def_nr)
 		ob->actdef--;
-	if(ob->actdef < 1 && ob->defbase.first)
+	if (ob->actdef < 1 && ob->defbase.first)
 		ob->actdef= 1;
 
 }
@@ -1768,22 +1789,22 @@ static void vgroup_active_remove_verts(Object *ob, const int allverts, bDeformGr
 	MDeformVert *dv;
 	const int def_nr= BLI_findindex(&ob->defbase, dg);
 
-	if(ob->type == OB_MESH) {
+	if (ob->type == OB_MESH) {
 		Mesh *me= ob->data;
 
-		if (me->edit_mesh) {
-			EditVert *eve;
-			EditMesh *em = BKE_mesh_get_editmesh(me);
+		if (me->edit_btmesh) {
+			BMEditMesh *em = me->edit_btmesh;
+			BMVert *eve;
+			BMIter iter;
 
-			for (eve=em->verts.first; eve; eve=eve->next) {
-				dv= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
+			BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+				dv= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
 
-				if (dv && dv->dw && (allverts || (eve->f & SELECT))) {
+				if (dv && dv->dw && (allverts || BM_elem_flag_test(eve, BM_ELEM_SELECT))) {
 					MDeformWeight *dw = defvert_find_index(dv, def_nr);
 					defvert_remove_group(dv, dw); /* dw can be NULL */
 				}
 			}
-			BKE_mesh_end_editmesh(me, em);
 		}
 		else {
 			MVert *mv;
@@ -1807,15 +1828,15 @@ static void vgroup_active_remove_verts(Object *ob, const int allverts, bDeformGr
 			}
 		}
 	}
-	else if(ob->type == OB_LATTICE) {
+	else if (ob->type == OB_LATTICE) {
 		Lattice *lt= vgroup_edit_lattice(ob);
 		
-		if(lt->dvert) {
+		if (lt->dvert) {
 			BPoint *bp;
 			int i, tot= lt->pntsu*lt->pntsv*lt->pntsw;
 				
-			for(i=0, bp= lt->def; i<tot; i++, bp++) {
-				if(allverts || (bp->f1 & SELECT)) {
+			for (i=0, bp= lt->def; i<tot; i++, bp++) {
+				if (allverts || (bp->f1 & SELECT)) {
 					MDeformWeight *dw;
 
 					dv= &lt->dvert[i];
@@ -1839,33 +1860,33 @@ static void vgroup_delete_edit_mode(Object *ob, bDeformGroup *dg)
 	vgroup_active_remove_verts(ob, TRUE, dg);
 
 	/* Make sure that any verts with higher indices are adjusted accordingly */
-	if(ob->type==OB_MESH) {
+	if (ob->type==OB_MESH) {
 		Mesh *me= ob->data;
-		EditMesh *em = BKE_mesh_get_editmesh(me);
-		EditVert *eve;
+		BMEditMesh *em = me->edit_btmesh;
+		BMIter iter;
+		BMVert *eve;
 		MDeformVert *dvert;
 		
-		for(eve=em->verts.first; eve; eve=eve->next){
-			dvert= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
+		BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+			dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
 
-			if(dvert)
-				for(i=0; i<dvert->totweight; i++)
-					if(dvert->dw[i].def_nr > dg_index)
+			if (dvert)
+				for (i=0; i<dvert->totweight; i++)
+					if (dvert->dw[i].def_nr > dg_index)
 						dvert->dw[i].def_nr--;
 		}
-		BKE_mesh_end_editmesh(me, em);
 	}
-	else if(ob->type==OB_LATTICE) {
+	else if (ob->type==OB_LATTICE) {
 		Lattice *lt= vgroup_edit_lattice(ob);
 		BPoint *bp;
 		MDeformVert *dvert= lt->dvert;
 		int a, tot;
 		
-		if(dvert) {
+		if (dvert) {
 			tot= lt->pntsu*lt->pntsv*lt->pntsw;
-			for(a=0, bp= lt->def; a<tot; a++, bp++, dvert++) {
-				for(i=0; i<dvert->totweight; i++){
-					if(dvert->dw[i].def_nr > dg_index)
+			for (a=0, bp= lt->def; a<tot; a++, bp++, dvert++) {
+				for (i=0; i<dvert->totweight; i++) {
+					if (dvert->dw[i].def_nr > dg_index)
 						dvert->dw[i].def_nr--;
 				}
 			}
@@ -1878,21 +1899,21 @@ static void vgroup_delete_edit_mode(Object *ob, bDeformGroup *dg)
 	BLI_freelinkN (&ob->defbase, dg);
 
 	/* Update the active deform index if necessary */
-	if(ob->actdef > dg_index)
+	if (ob->actdef > dg_index)
 		ob->actdef--;
-	if(ob->actdef < 1 && ob->defbase.first)
+	if (ob->actdef < 1 && ob->defbase.first)
 		ob->actdef= 1;
 
 	/* remove all dverts */
-	if(ob->defbase.first == NULL) {
-		if(ob->type==OB_MESH) {
+	if (ob->defbase.first == NULL) {
+		if (ob->type==OB_MESH) {
 			Mesh *me= ob->data;
 			CustomData_free_layer_active(&me->vdata, CD_MDEFORMVERT, me->totvert);
 			me->dvert= NULL;
 		}
-		else if(ob->type==OB_LATTICE) {
+		else if (ob->type==OB_LATTICE) {
 			Lattice *lt= vgroup_edit_lattice(ob);
-			if(lt->dvert) {
+			if (lt->dvert) {
 				MEM_freeN(lt->dvert);
 				lt->dvert= NULL;
 			}
@@ -1902,9 +1923,9 @@ static void vgroup_delete_edit_mode(Object *ob, bDeformGroup *dg)
 
 static int vgroup_object_in_edit_mode(Object *ob)
 {
-	if(ob->type == OB_MESH)
-		return (((Mesh*)ob->data)->edit_mesh != NULL);
-	else if(ob->type == OB_LATTICE)
+	if (ob->type == OB_MESH)
+		return (BMEdit_FromObject(ob) != NULL);
+	else if (ob->type == OB_LATTICE)
 		return (((Lattice*)ob->data)->editlatt != NULL);
 	
 	return 0;
@@ -1915,7 +1936,7 @@ static int vgroup_object_in_wpaint_vert_select(Object *ob)
 	if (ob->type == OB_MESH) {
 		Mesh *me = ob->data;
 		return ( (ob->mode & OB_MODE_WEIGHT_PAINT) &&
-		         (me->edit_mesh == NULL) &&
+		         (me->edit_btmesh == NULL) &&
 		         (ME_EDIT_PAINT_SEL_MODE(me) == SCE_SELECT_VERTEX) );
 	}
 
@@ -1925,10 +1946,10 @@ static int vgroup_object_in_wpaint_vert_select(Object *ob)
 static void vgroup_delete(Object *ob)
 {
 	bDeformGroup *dg = BLI_findlink(&ob->defbase, ob->actdef-1);
-	if(!dg)
+	if (!dg)
 		return;
 
-	if(vgroup_object_in_edit_mode(ob))
+	if (vgroup_object_in_edit_mode(ob))
 		vgroup_delete_edit_mode(ob, dg);
 	else
 		vgroup_delete_object_mode(ob, dg);
@@ -1937,14 +1958,14 @@ static void vgroup_delete(Object *ob)
 static void vgroup_delete_all(Object *ob)
 {
 	/* Remove all DVerts */
-	if(ob->type==OB_MESH) {
+	if (ob->type==OB_MESH) {
 		Mesh *me= ob->data;
 		CustomData_free_layer_active(&me->vdata, CD_MDEFORMVERT, me->totvert);
 		me->dvert= NULL;
 	}
-	else if(ob->type==OB_LATTICE) {
+	else if (ob->type==OB_LATTICE) {
 		Lattice *lt= vgroup_edit_lattice(ob);
-		if(lt->dvert) {
+		if (lt->dvert) {
 			MEM_freeN(lt->dvert);
 			lt->dvert= NULL;
 		}
@@ -1963,30 +1984,31 @@ 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))
+	if (!BLI_findlink(&ob->defbase, def_nr))
 		return;
 
-	if(ob->type == OB_MESH) {
+	if (ob->type == OB_MESH) {
 		Mesh *me= ob->data;
-		if (me->edit_mesh) {
-			EditMesh *em = BKE_mesh_get_editmesh(me);
-			EditVert *eve;
 
-			if(!CustomData_has_layer(&em->vdata, CD_MDEFORMVERT))
-				EM_add_data_layer(em, &em->vdata, CD_MDEFORMVERT, NULL);
+		if (me->edit_btmesh) {
+			BMEditMesh *em = me->edit_btmesh;
+			BMIter iter;
+			BMVert *eve;
+
+			if (!CustomData_has_layer(&em->bm->vdata, CD_MDEFORMVERT))
+				BM_data_layer_add(em->bm, &em->bm->vdata, CD_MDEFORMVERT);
 
 			/* Go through the list of editverts and assign them */
-			for (eve=em->verts.first; eve; eve=eve->next) {
-				if (eve->f & SELECT) {
+			BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+				if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
 					MDeformWeight *dw;
-					dv= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT); /* can be NULL */
+					dv= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT); /* can be NULL */
 					dw= defvert_verify_index(dv, def_nr);
 					if (dw) {
 						dw->weight= weight;
 					}
 				}
 			}
-			BKE_mesh_end_editmesh(me, em);
 		}
 		else {
 			MVert *mv;
@@ -2011,19 +2033,19 @@ static void vgroup_assign_verts(Object *ob, const float weight)
 			}
 		}
 	}
-	else if(ob->type == OB_LATTICE) {
+	else if (ob->type == OB_LATTICE) {
 		Lattice *lt= vgroup_edit_lattice(ob);
 		BPoint *bp;
 		int a, tot;
 
-		if(lt->dvert==NULL)
+		if (lt->dvert==NULL)
 			ED_vgroup_data_create(&lt->id);
 
 		dv= lt->dvert;
 
 		tot= lt->pntsu*lt->pntsv*lt->pntsw;
-		for(a=0, bp= lt->def; a<tot; a++, bp++, dv++) {
-			if(bp->f1 & SELECT) {
+		for (a=0, bp= lt->def; a<tot; a++, bp++, dv++) {
+			if (bp->f1 & SELECT) {
 				MDeformWeight *dw;
 
 				dw= defvert_verify_index(dv, def_nr);
@@ -2044,7 +2066,7 @@ static void vgroup_remove_verts(Object *ob, int allverts)
 	 * active group index
 	 */
 	bDeformGroup *dg;
-	for(dg= ob->defbase.first; dg; dg= dg->next) {
+	for (dg= ob->defbase.first; dg; dg= dg->next) {
 		vgroup_active_remove_verts(ob, allverts, dg);
 	}
 }
@@ -2063,7 +2085,7 @@ static int UNUSED_FUNCTION(vertex_group_poll_edit)(bContext *C)
 	Object *ob= ED_object_context(C);
 	ID *data= (ob)? ob->data: NULL;
 
-	if(!(ob && !ob->id.lib && data && !data->lib))
+	if (!(ob && !ob->id.lib && data && !data->lib))
 		return 0;
 
 	return vgroup_object_in_edit_mode(ob);
@@ -2075,7 +2097,7 @@ static int vertex_group_poll_edit_or_wpaint_vert_select(bContext *C)
 	Object *ob= ED_object_context(C);
 	ID *data= (ob)? ob->data: NULL;
 
-	if(!(ob && !ob->id.lib && data && !data->lib))
+	if (!(ob && !ob->id.lib && data && !data->lib))
 		return 0;
 
 	return ( vgroup_object_in_edit_mode(ob) ||
@@ -2097,22 +2119,22 @@ static int vertex_group_add_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_vertex_group_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Vertex Group";
-	ot->idname= "OBJECT_OT_vertex_group_add";
+	ot->name = "Add Vertex Group";
+	ot->idname = "OBJECT_OT_vertex_group_add";
 	
 	/* api callbacks */
-	ot->poll= vertex_group_poll;
-	ot->exec= vertex_group_add_exec;
+	ot->poll = vertex_group_poll;
+	ot->exec = vertex_group_add_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int vertex_group_remove_exec(bContext *C, wmOperator *op)
 {
 	Object *ob= ED_object_context(C);
 
-	if(RNA_boolean_get(op->ptr, "all"))
+	if (RNA_boolean_get(op->ptr, "all"))
 		vgroup_delete_all(ob);
 	else
 		vgroup_delete(ob);
@@ -2127,18 +2149,18 @@ static int vertex_group_remove_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_vertex_group_remove(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove Vertex Group";
-	ot->idname= "OBJECT_OT_vertex_group_remove";
+	ot->name = "Remove Vertex Group";
+	ot->idname = "OBJECT_OT_vertex_group_remove";
 	
 	/* api callbacks */
-	ot->poll= vertex_group_poll;
-	ot->exec= vertex_group_remove_exec;
+	ot->poll = vertex_group_poll;
+	ot->exec = vertex_group_remove_exec;
 
 	/* flags */
 	/* redo operator will fail in this case because vertex groups aren't stored
-	   in local edit mode stack and toggling "all" property will lead to
-	   all groups deleted without way to restore them (see [#29527], sergey) */
-	ot->flag= /*OPTYPE_REGISTER|*/OPTYPE_UNDO;
+	 * in local edit mode stack and toggling "all" property will lead to
+	 * all groups deleted without way to restore them (see [#29527], sergey) */
+	ot->flag = /*OPTYPE_REGISTER|*/OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "all", 0, "All", "Remove from all vertex groups");
@@ -2149,7 +2171,7 @@ static int vertex_group_assign_exec(bContext *C, wmOperator *op)
 	ToolSettings *ts= CTX_data_tool_settings(C);
 	Object *ob= ED_object_context(C);
 
-	if(RNA_boolean_get(op->ptr, "new"))
+	if (RNA_boolean_get(op->ptr, "new"))
 		ED_vgroup_add(ob);
 
 	vgroup_assign_verts(ob, ts->vgroup_weight);
@@ -2162,18 +2184,18 @@ static int vertex_group_assign_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_vertex_group_assign(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Assign Vertex Group";
-	ot->idname= "OBJECT_OT_vertex_group_assign";
+	ot->name = "Assign Vertex Group";
+	ot->idname = "OBJECT_OT_vertex_group_assign";
 	
 	/* api callbacks */
-	ot->poll= vertex_group_poll_edit_or_wpaint_vert_select;
-	ot->exec= vertex_group_assign_exec;
+	ot->poll = vertex_group_poll_edit_or_wpaint_vert_select;
+	ot->exec = vertex_group_assign_exec;
 
 	/* flags */
 	/* redo operator will fail in this case because vertex group assignment
-	   isn't stored in local edit mode stack and toggling "new" property will
-	   lead to creating plenty of new veretx groups (see [#29527], sergey) */
-	ot->flag= /*OPTYPE_REGISTER|*/OPTYPE_UNDO;
+	 * isn't stored in local edit mode stack and toggling "new" property will
+	 * lead to creating plenty of new vertex groups (see [#29527], sergey) */
+	ot->flag = /*OPTYPE_REGISTER|*/OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "new", 0, "New", "Assign vertex to new vertex group");
@@ -2183,12 +2205,12 @@ static int vertex_group_remove_from_exec(bContext *C, wmOperator *op)
 {
 	Object *ob= ED_object_context(C);
 
-	if(RNA_boolean_get(op->ptr, "all"))
+	if (RNA_boolean_get(op->ptr, "all"))
 		vgroup_remove_verts(ob, 0);
 	else {
 		bDeformGroup *dg= BLI_findlink(&ob->defbase, ob->actdef - 1);
 
-		if(dg == NULL) {
+		if (dg == NULL) {
 			return OPERATOR_CANCELLED;
 		}
 
@@ -2204,18 +2226,18 @@ static int vertex_group_remove_from_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_vertex_group_remove_from(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove from Vertex Group";
-	ot->idname= "OBJECT_OT_vertex_group_remove_from";
+	ot->name = "Remove from Vertex Group";
+	ot->idname = "OBJECT_OT_vertex_group_remove_from";
 
 	/* api callbacks */
-	ot->poll= vertex_group_poll_edit_or_wpaint_vert_select;
-	ot->exec= vertex_group_remove_from_exec;
+	ot->poll = vertex_group_poll_edit_or_wpaint_vert_select;
+	ot->exec = vertex_group_remove_from_exec;
 
 	/* flags */
-	/* redo operator will fail in this case because vertex groups ssignment
-	   isn't stored in local edit mode stack and toggling "all" property will lead to
-	   removing vertices from all groups (see [#29527], sergey) */
-	ot->flag= /*OPTYPE_REGISTER|*/OPTYPE_UNDO;
+	/* redo operator will fail in this case because vertex groups assignment
+	 * isn't stored in local edit mode stack and toggling "all" property will lead to
+	 * removing vertices from all groups (see [#29527], sergey) */
+	ot->flag = /*OPTYPE_REGISTER|*/OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "all", 0, "All", "Remove from all vertex groups");
@@ -2225,7 +2247,7 @@ static int vertex_group_select_exec(bContext *C, wmOperator *UNUSED(op))
 {
 	Object *ob= ED_object_context(C);
 
-	if(!ob || ob->id.lib)
+	if (!ob || ob->id.lib)
 		return OPERATOR_CANCELLED;
 
 	vgroup_select_verts(ob, 1);
@@ -2237,15 +2259,15 @@ static int vertex_group_select_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_vertex_group_select(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Vertex Group";
-	ot->idname= "OBJECT_OT_vertex_group_select";
+	ot->name = "Select Vertex Group";
+	ot->idname = "OBJECT_OT_vertex_group_select";
 
 	/* api callbacks */
-	ot->poll= vertex_group_poll_edit_or_wpaint_vert_select;
-	ot->exec= vertex_group_select_exec;
+	ot->poll = vertex_group_poll_edit_or_wpaint_vert_select;
+	ot->exec = vertex_group_select_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int vertex_group_deselect_exec(bContext *C, wmOperator *UNUSED(op))
@@ -2261,15 +2283,15 @@ static int vertex_group_deselect_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_vertex_group_deselect(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Deselect Vertex Group";
-	ot->idname= "OBJECT_OT_vertex_group_deselect";
+	ot->name = "Deselect Vertex Group";
+	ot->idname = "OBJECT_OT_vertex_group_deselect";
 
 	/* api callbacks */
-	ot->poll= vertex_group_poll_edit_or_wpaint_vert_select;
-	ot->exec= vertex_group_deselect_exec;
+	ot->poll = vertex_group_poll_edit_or_wpaint_vert_select;
+	ot->exec = vertex_group_deselect_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int vertex_group_copy_exec(bContext *C, wmOperator *UNUSED(op))
@@ -2287,15 +2309,15 @@ static int vertex_group_copy_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_vertex_group_copy(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Copy Vertex Group";
-	ot->idname= "OBJECT_OT_vertex_group_copy";
+	ot->name = "Copy Vertex Group";
+	ot->idname = "OBJECT_OT_vertex_group_copy";
 
 	/* api callbacks */
-	ot->poll= vertex_group_poll;
-	ot->exec= vertex_group_copy_exec;
+	ot->poll = vertex_group_poll;
+	ot->exec = vertex_group_copy_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int vertex_group_levels_exec(bContext *C, wmOperator *op)
@@ -2317,15 +2339,15 @@ static int vertex_group_levels_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_vertex_group_levels(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Vertex Group Levels";
-	ot->idname= "OBJECT_OT_vertex_group_levels";
+	ot->name = "Vertex Group Levels";
+	ot->idname = "OBJECT_OT_vertex_group_levels";
 	
 	/* api callbacks */
-	ot->poll= vertex_group_poll;
-	ot->exec= vertex_group_levels_exec;
+	ot->poll = vertex_group_poll;
+	ot->exec = vertex_group_levels_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	RNA_def_float(ot->srna, "offset", 0.f, -1.0, 1.0, "Offset", "Value to add to weights", -1.0f, 1.f);
 	RNA_def_float(ot->srna, "gain", 1.f, 0.f, FLT_MAX, "Gain", "Value to multiply weights by", 0.0f, 10.f);
@@ -2347,15 +2369,15 @@ static int vertex_group_normalize_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_vertex_group_normalize(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Normalize Vertex Group";
-	ot->idname= "OBJECT_OT_vertex_group_normalize";
+	ot->name = "Normalize Vertex Group";
+	ot->idname = "OBJECT_OT_vertex_group_normalize";
 
 	/* api callbacks */
-	ot->poll= vertex_group_poll;
-	ot->exec= vertex_group_normalize_exec;
+	ot->poll = vertex_group_poll;
+	ot->exec = vertex_group_normalize_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int vertex_group_normalize_all_exec(bContext *C, wmOperator *op)
@@ -2375,15 +2397,15 @@ static int vertex_group_normalize_all_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_vertex_group_normalize_all(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Normalize All Vertex Groups";
-	ot->idname= "OBJECT_OT_vertex_group_normalize_all";
+	ot->name = "Normalize All Vertex Groups";
+	ot->idname = "OBJECT_OT_vertex_group_normalize_all";
 
 	/* api callbacks */
-	ot->poll= vertex_group_poll;
-	ot->exec= vertex_group_normalize_all_exec;
+	ot->poll = vertex_group_poll;
+	ot->exec = vertex_group_normalize_all_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	RNA_def_boolean(ot->srna, "lock_active", TRUE, "Lock Active",
 	                "Keep the values of the active group while normalizing others");
@@ -2399,14 +2421,14 @@ static int vertex_group_fix_exec(bContext *C, wmOperator *op)
 	float cp= RNA_float_get(op->ptr, "accuracy");
 	ModifierData *md= ob->modifiers.first;
 
-	while(md) {
-		if(md->type == eModifierType_Mirror && (md->mode&eModifierMode_Realtime)) {
+	while (md) {
+		if (md->type == eModifierType_Mirror && (md->mode&eModifierMode_Realtime)) {
 			break;
 		}
 		md = md->next;
 	}
 	
-	if(md && md->type == eModifierType_Mirror) {
+	if (md && md->type == eModifierType_Mirror) {
 		BKE_report(op->reports, RPT_ERROR_INVALID_CONTEXT, "This operator does not support an active mirror modifier");
 		return OPERATOR_CANCELLED;
 	}
@@ -2422,17 +2444,17 @@ static int vertex_group_fix_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_vertex_group_fix(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Fix Vertex Group Deform";
-	ot->idname= "OBJECT_OT_vertex_group_fix";
-	ot->description= "Modify the position of selected vertices by changing only their respective "
+	ot->name = "Fix Vertex Group Deform";
+	ot->idname = "OBJECT_OT_vertex_group_fix";
+	ot->description = "Modify the position of selected vertices by changing only their respective "
 	                 "groups' weights (this tool may be slow for many vertices)";
 	
 	/* api callbacks */
-	ot->poll= vertex_group_poll;
-	ot->exec= vertex_group_fix_exec;
+	ot->poll = vertex_group_poll;
+	ot->exec = vertex_group_fix_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	RNA_def_float(ot->srna, "dist", 0.0f, -FLT_MAX, FLT_MAX, "Distance", "The distance to move to", -10.0f, 10.0f);
 	RNA_def_float(ot->srna, "strength", 1.f, -2.0f, FLT_MAX, "Strength",
 	              "The distance moved can be changed by this multiplier", -2.0f, 2.0f);
@@ -2455,15 +2477,15 @@ static int vertex_group_lock_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_vertex_group_lock(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Change the Lock On Vertex Groups";
-	ot->idname= "OBJECT_OT_vertex_group_lock";
+	ot->name = "Change the Lock On Vertex Groups";
+	ot->idname = "OBJECT_OT_vertex_group_lock";
 
 	/* api callbacks */
-	ot->poll= vertex_group_poll;
-	ot->exec= vertex_group_lock_exec;
+	ot->poll = vertex_group_poll;
+	ot->exec = vertex_group_lock_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	WM_operator_properties_select_all(ot);
 }
@@ -2485,15 +2507,15 @@ static int vertex_group_invert_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_vertex_group_invert(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Invert Vertex Group";
-	ot->idname= "OBJECT_OT_vertex_group_invert";
+	ot->name = "Invert Vertex Group";
+	ot->idname = "OBJECT_OT_vertex_group_invert";
 
 	/* api callbacks */
-	ot->poll= vertex_group_poll;
-	ot->exec= vertex_group_invert_exec;
+	ot->poll = vertex_group_poll;
+	ot->exec = vertex_group_invert_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	RNA_def_boolean(ot->srna, "auto_assign", TRUE, "Add Weights",
 	                "Add verts from groups that have zero weight before inverting");
@@ -2502,11 +2524,12 @@ void OBJECT_OT_vertex_group_invert(wmOperatorType *ot)
 }
 
 
-static int vertex_group_blend_exec(bContext *C, wmOperator *UNUSED(op))
+static int vertex_group_blend_exec(bContext *C, wmOperator *op)
 {
-	Object *ob= ED_object_context(C);
+	Object *ob = ED_object_context(C);
+	float fac = RNA_float_get(op->ptr, "factor");
 
-	vgroup_blend(ob);
+	vgroup_blend(ob, fac);
 
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 	WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
@@ -2515,19 +2538,53 @@ static int vertex_group_blend_exec(bContext *C, wmOperator *UNUSED(op))
 	return OPERATOR_FINISHED;
 }
 
+/* check we have a vertex selection, either in weight paint or editmode */
+static int vertex_group_blend_poll(bContext *C)
+{
+	Object *ob = ED_object_context(C);
+	ID *data = (ob) ? ob->data: NULL;
+
+	if (!(ob && !ob->id.lib && data && !data->lib))
+		return FALSE;
+
+	if (vgroup_object_in_edit_mode(ob)) {
+		return TRUE;
+	}
+	else if ((ob->type == OB_MESH) && (ob->mode & OB_MODE_WEIGHT_PAINT)) {
+		if (ME_EDIT_PAINT_SEL_MODE(((Mesh *)data)) == SCE_SELECT_VERTEX) {
+			return TRUE;
+		}
+		else {
+			CTX_wm_operator_poll_msg_set(C, "Vertex select needs to be enabled in weight paint mode");
+			return FALSE;
+		}
+
+	}
+	else {
+		return FALSE;
+	}
+}
+
 void OBJECT_OT_vertex_group_blend(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+
 	/* identifiers */
-	ot->name= "Blend Vertex Group";
-	ot->idname= "OBJECT_OT_vertex_group_blend";
-	ot->description= "";
+	ot->name = "Blend Vertex Group";
+	ot->idname = "OBJECT_OT_vertex_group_blend";
+	ot->description = "Blend selected vertex weights with unselected for the active group";
 
 	/* api callbacks */
-	ot->poll= vertex_group_poll;
-	ot->exec= vertex_group_blend_exec;
+	ot->poll = vertex_group_blend_poll;
+	ot->exec = vertex_group_blend_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+
+	prop = RNA_def_property(ot->srna, "factor", PROP_FLOAT, PROP_FACTOR);
+	RNA_def_property_ui_text(prop, "Factor", "");
+	RNA_def_property_range(prop, 0.0f, 1.0f);
+	RNA_def_property_float_default(prop, 1.0f);
 }
 
 
@@ -2539,7 +2596,7 @@ static int vertex_group_clean_exec(bContext *C, wmOperator *op)
 	int all_groups= RNA_boolean_get(op->ptr,"all_groups");
 	int keep_single= RNA_boolean_get(op->ptr,"keep_single");
 
-	if(all_groups)	vgroup_clean_all(ob, limit, keep_single);
+	if (all_groups)	vgroup_clean_all(ob, limit, keep_single);
 	else			vgroup_clean(ob, limit, keep_single);
 
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
@@ -2552,16 +2609,16 @@ static int vertex_group_clean_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_vertex_group_clean(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clean Vertex Group";
-	ot->idname= "OBJECT_OT_vertex_group_clean";
-	ot->description= "Remove Vertex Group assignments which aren't required";
+	ot->name = "Clean Vertex Group";
+	ot->idname = "OBJECT_OT_vertex_group_clean";
+	ot->description = "Remove Vertex Group assignments which aren't required";
 
 	/* api callbacks */
-	ot->poll= vertex_group_poll;
-	ot->exec= vertex_group_clean_exec;
+	ot->poll = vertex_group_poll;
+	ot->exec = vertex_group_clean_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	RNA_def_float(ot->srna, "limit", 0.01f, 0.0f, 1.0, "Limit", "Remove weights under this limit", 0.001f, 0.99f);
 	RNA_def_boolean(ot->srna, "all_groups", FALSE, "All Groups", "Clean all vertex groups");
@@ -2589,17 +2646,17 @@ static int vertex_group_mirror_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_vertex_group_mirror(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Mirror Vertex Group";
-	ot->idname= "OBJECT_OT_vertex_group_mirror";
-	ot->description= "Mirror all vertex groups, flip weights and/or names, editing only selected vertices, "
+	ot->name = "Mirror Vertex Group";
+	ot->idname = "OBJECT_OT_vertex_group_mirror";
+	ot->description = "Mirror all vertex groups, flip weights and/or names, editing only selected vertices, "
 	                 "flipping when both sides are selected otherwise copy from unselected";
 
 	/* api callbacks */
-	ot->poll= vertex_group_poll;
-	ot->exec= vertex_group_mirror_exec;
+	ot->poll = vertex_group_poll;
+	ot->exec = vertex_group_mirror_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "mirror_weights", TRUE, "Mirror Weights", "Mirror weights");
@@ -2615,9 +2672,9 @@ static int vertex_group_copy_to_linked_exec(bContext *C, wmOperator *UNUSED(op))
 	Base *base;
 	int retval= OPERATOR_CANCELLED;
 
-	for(base=scene->base.first; base; base= base->next) {
-		if(base->object->type==ob->type) {
-			if(base->object!=ob && base->object->data==ob->data) {
+	for (base=scene->base.first; base; base= base->next) {
+		if (base->object->type==ob->type) {
+			if (base->object!=ob && base->object->data==ob->data) {
 				BLI_freelistN(&base->object->defbase);
 				BLI_duplicatelist(&base->object->defbase, &ob->defbase);
 				base->object->actdef= ob->actdef;
@@ -2637,16 +2694,16 @@ static int vertex_group_copy_to_linked_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_vertex_group_copy_to_linked(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Copy Vertex Groups to Linked";
-	ot->idname= "OBJECT_OT_vertex_group_copy_to_linked";
-	ot->description= "Copy Vertex Groups to all users of the same Geometry data";
+	ot->name = "Copy Vertex Groups to Linked";
+	ot->idname = "OBJECT_OT_vertex_group_copy_to_linked";
+	ot->description = "Copy Vertex Groups to all users of the same Geometry data";
 
 	/* api callbacks */
-	ot->poll= vertex_group_poll;
-	ot->exec= vertex_group_copy_to_linked_exec;
+	ot->poll = vertex_group_poll;
+	ot->exec = vertex_group_copy_to_linked_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *op)
@@ -2657,16 +2714,16 @@ static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *op)
 
 	CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects)
 	{
-		if(obact != ob) {
-			if(ED_vgroup_copy_array(ob, obact)) change++;
+		if (obact != ob) {
+			if (ED_vgroup_copy_array(ob, obact)) change++;
 			else                                fail++;
 		}
 	}
 	CTX_DATA_END;
 
-	if((change == 0 && fail == 0) || fail) {
+	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 indicies",
+		            "Copy to VGroups to Selected warning done %d, failed %d, object data must have matching indices",
 		            change, fail);
 	}
 
@@ -2677,16 +2734,16 @@ static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_vertex_group_copy_to_selected(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Copy Vertex Group to Selected";
-	ot->idname= "OBJECT_OT_vertex_group_copy_to_selected";
-	ot->description= "Copy Vertex Groups to other selected objects with matching indices";
+	ot->name = "Copy Vertex Group to Selected";
+	ot->idname = "OBJECT_OT_vertex_group_copy_to_selected";
+	ot->description = "Copy Vertex Groups to other selected objects with matching indices";
 
 	/* api callbacks */
-	ot->poll= vertex_group_poll;
-	ot->exec= vertex_group_copy_to_selected_exec;
+	ot->poll = vertex_group_poll;
+	ot->exec = vertex_group_copy_to_selected_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static EnumPropertyItem vgroup_items[]= {
@@ -2714,10 +2771,10 @@ static EnumPropertyItem *vgroup_itemf(bContext *C, PointerRNA *UNUSED(ptr), Prop
 	bDeformGroup *def;
 	int a, totitem= 0;
 	
-	if(!ob)
+	if (!ob)
 		return vgroup_items;
 	
-	for(a=0, def=ob->defbase.first; def; def=def->next, a++) {
+	for (a=0, def=ob->defbase.first; def; def=def->next, a++) {
 		tmp.value= a;
 		tmp.icon= ICON_GROUP_VERTEX;
 		tmp.identifier= def->name;
@@ -2736,26 +2793,26 @@ void OBJECT_OT_vertex_group_set_active(wmOperatorType *ot)
 	PropertyRNA *prop;
 
 	/* identifiers */
-	ot->name= "Set Active Vertex Group";
-	ot->idname= "OBJECT_OT_vertex_group_set_active";
-	ot->description= "Set the active vertex group";
+	ot->name = "Set Active Vertex Group";
+	ot->idname = "OBJECT_OT_vertex_group_set_active";
+	ot->description = "Set the active vertex group";
 
 	/* api callbacks */
-	ot->poll= vertex_group_poll;
-	ot->exec= set_active_group_exec;
-	ot->invoke= WM_menu_invoke;
+	ot->poll = vertex_group_poll;
+	ot->exec = set_active_group_exec;
+	ot->invoke = WM_menu_invoke;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	prop= RNA_def_enum(ot->srna, "group", vgroup_items, 0, "Group", "Vertex group to set as active");
 	RNA_def_enum_funcs(prop, vgroup_itemf);
-	ot->prop= prop;
+	ot->prop = prop;
 }
 
-/*creates the name_array parameter for vgroup_do_remap, call this before fiddling
-  with the order of vgroups then call vgroup_do_remap after*/
+/* creates the name_array parameter for vgroup_do_remap, call this before fiddling
+ * with the order of vgroups then call vgroup_do_remap after*/
 static char *vgroup_init_remap(Object *ob)
 {
 	bDeformGroup *def;
@@ -2764,7 +2821,7 @@ static char *vgroup_init_remap(Object *ob)
 	char *name;
 
 	name= name_array;
-	for(def = ob->defbase.first; def; def=def->next) {
+	for (def = ob->defbase.first; def; def=def->next) {
 		BLI_strncpy(name, def->name, MAX_VGROUP_NAME);
 		name += MAX_VGROUP_NAME;
 	}
@@ -2786,27 +2843,28 @@ static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op)
 	int i;
 
 	name= name_array;
-	for(def= ob->defbase.first, i=0; def; def=def->next, i++){
+	for (def= ob->defbase.first, i=0; def; def=def->next, i++) {
 		sort_map[i]= BLI_findstringindex(&ob->defbase, name, offsetof(bDeformGroup, name));
 		name += MAX_VGROUP_NAME;
 
 		BLI_assert(sort_map[i] != -1);
 	}
 
-	if(ob->mode == OB_MODE_EDIT) {
-		if(ob->type==OB_MESH) {
-			EditMesh *em = BKE_mesh_get_editmesh(ob->data);
-			EditVert *eve;
+	if (ob->mode == OB_MODE_EDIT) {
+		if (ob->type==OB_MESH) {
+			BMEditMesh *em = BMEdit_FromObject(ob);
+			BMIter iter;
+			BMVert *eve;
 
-			for(eve=em->verts.first; eve; eve=eve->next){
-				dvert= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
-				if(dvert && dvert->totweight){
+			BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+				dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
+				if (dvert && dvert->totweight) {
 					defvert_remap(dvert, sort_map, defbase_tot);
 				}
 			}
 		}
 		else {
-			BKE_report(op->reports, RPT_ERROR, "Editmode lattice isnt supported yet");
+			BKE_report(op->reports, RPT_ERROR, "Editmode lattice isn't supported yet");
 			MEM_freeN(sort_map_update);
 			return OPERATOR_CANCELLED;
 		}
@@ -2816,16 +2874,16 @@ static int vgroup_do_remap(Object *ob, char *name_array, wmOperator *op)
 
 		ED_vgroup_give_array(ob->data, &dvert, &dvert_tot);
 
-		/*create as necassary*/
-		while(dvert && dvert_tot--) {
-			if(dvert->totweight)
+		/*create as necessary*/
+		while (dvert && dvert_tot--) {
+			if (dvert->totweight)
 				defvert_remap(dvert, sort_map, defbase_tot);
 			dvert++;
 		}
 	}
 
 	/* update users */
-	for(i=0; i<defbase_tot; i++)
+	for (i=0; i<defbase_tot; i++)
 		sort_map[i]++;
 
 	sort_map_update[0]= 0;
@@ -2874,16 +2932,16 @@ static int vertex_group_sort_exec(bContext *C, wmOperator *op)
 
 void OBJECT_OT_vertex_group_sort(wmOperatorType *ot)
 {
-	ot->name= "Sort Vertex Groups";
-	ot->idname= "OBJECT_OT_vertex_group_sort";
-	ot->description= "Sorts vertex groups alphabetically";
+	ot->name = "Sort Vertex Groups";
+	ot->idname = "OBJECT_OT_vertex_group_sort";
+	ot->description = "Sorts vertex groups alphabetically";
 
 	/* api callbacks */
-	ot->poll= vertex_group_poll;
-	ot->exec= vertex_group_sort_exec;
+	ot->poll = vertex_group_poll;
+	ot->exec = vertex_group_sort_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int vgroup_move_exec(bContext *C, wmOperator *op)
@@ -2905,7 +2963,8 @@ static int vgroup_move_exec(bContext *C, wmOperator *op)
 
 		BLI_remlink(&ob->defbase, def);
 		BLI_insertlinkbefore(&ob->defbase, prev, def);
-	} else { /*down*/
+	}
+	else { /*down*/
 		void *next = def->next;
 
 		BLI_remlink(&ob->defbase, def);
@@ -2933,15 +2992,15 @@ void OBJECT_OT_vertex_group_move(wmOperatorType *ot)
 	};
 
 	/* identifiers */
-	ot->name= "Move Vertex Group";
-	ot->idname= "OBJECT_OT_vertex_group_move";
+	ot->name = "Move Vertex Group";
+	ot->idname = "OBJECT_OT_vertex_group_move";
 
 	/* api callbacks */
-	ot->poll= vertex_group_poll;
-	ot->exec= vgroup_move_exec;
+	ot->poll = vertex_group_poll;
+	ot->exec = vgroup_move_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	RNA_def_enum(ot->srna, "direction", vgroup_slot_move, 0, "Direction", "Direction to move, UP or DOWN");
 }
diff --git a/source/blender/editors/physics/SConscript b/source/blender/editors/physics/SConscript
index 188416e..9fe6cff 100644
--- a/source/blender/editors/physics/SConscript
+++ b/source/blender/editors/physics/SConscript
@@ -5,7 +5,7 @@ sources = env.Glob('*.c')
 
 incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
 incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
-incs += ' ../../gpu ../../blenloader'
+incs += ' ../../gpu ../../blenloader ../../bmesh'
 incs += ' ../../makesrna ../../render/extern/include  #/intern/elbeem/extern'
 
 defs = ''
@@ -14,7 +14,7 @@ if env['OURPLATFORM'] == 'linux':
     cflags='-pthread'
     incs += ' ../../../extern/binreloc/include'
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
 
 
diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c
index cdcaae9..417cddb 100644
--- a/source/blender/editors/physics/dynamicpaint_ops.c
+++ b/source/blender/editors/physics/dynamicpaint_ops.c
@@ -48,7 +48,6 @@
 #include "RNA_define.h"
 #include "RNA_enum_types.h"
 
-/* Platform independend time	*/
 #include "PIL_time.h"
 
 #include "WM_types.h"
@@ -74,7 +73,7 @@ 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) {
+	for (surface=surface->prev; surface; surface=surface->prev) {
 				surface->flags &= ~MOD_DPAINT_PREVIEW;
 				canvas->active_sur++;
 	}
@@ -86,16 +85,16 @@ static int surface_slot_add_exec(bContext *C, wmOperator *UNUSED(op))
 void DPAINT_OT_surface_slot_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Surface Slot";
-	ot->idname= "DPAINT_OT_surface_slot_add";
-	ot->description="Add a new Dynamic Paint surface slot";
+	ot->name = "Add Surface Slot";
+	ot->idname = "DPAINT_OT_surface_slot_add";
+	ot->description = "Add a new Dynamic Paint surface slot";
 	
 	/* api callbacks */
-	ot->exec= surface_slot_add_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->exec = surface_slot_add_exec;
+	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))
@@ -114,8 +113,8 @@ static int surface_slot_remove_exec(bContext *C, wmOperator *UNUSED(op))
 	surface = canvas->surfaces.first;
 
 	/* find active surface and remove it */
-	for(; surface; surface=surface->next) {
-		if(id == canvas->active_sur) {
+	for (; surface; surface=surface->next) {
+		if (id == canvas->active_sur) {
 				canvas->active_sur -= 1;
 				dynamicPaint_freeSurface(surface);
 				break;
@@ -134,16 +133,16 @@ static int surface_slot_remove_exec(bContext *C, wmOperator *UNUSED(op))
 void DPAINT_OT_surface_slot_remove(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove Surface Slot";
-	ot->idname= "DPAINT_OT_surface_slot_remove";
-	ot->description="Remove the selected surface slot";
+	ot->name = "Remove Surface Slot";
+	ot->idname = "DPAINT_OT_surface_slot_remove";
+	ot->description = "Remove the selected surface slot";
 	
 	/* api callbacks */
-	ot->exec= surface_slot_remove_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->exec = surface_slot_remove_exec;
+	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)
@@ -169,7 +168,7 @@ static int type_toggle_exec(bContext *C, wmOperator *op)
 			return OPERATOR_CANCELLED;
 	}
 	
-	/* update dependancy */
+	/* update dependency */
 	DAG_id_tag_update(&cObject->id, OB_RECALC_DATA);
 	WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, cObject);
 	DAG_scene_sort(CTX_data_main(C), scene);
@@ -182,20 +181,20 @@ void DPAINT_OT_type_toggle(wmOperatorType *ot)
 	PropertyRNA *prop;
 
 	/* identifiers */
-	ot->name= "Toggle Type Active";
-	ot->idname= "DPAINT_OT_type_toggle";
+	ot->name = "Toggle Type Active";
+	ot->idname = "DPAINT_OT_type_toggle";
 	ot->description = "Toggle whether given type is active or not";
 	
 	/* api callbacks */
-	ot->exec= type_toggle_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->exec = type_toggle_exec;
+	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", "");
-	ot->prop= prop;
+	ot->prop = prop;
 }
 
 static int output_toggle_exec(bContext *C, wmOperator *op)
@@ -250,28 +249,28 @@ void DPAINT_OT_output_toggle(wmOperatorType *ot)
 	};
 
 	/* identifiers */
-	ot->name= "Toggle Output Layer";
-	ot->idname= "DPAINT_OT_output_toggle";
+	ot->name = "Toggle Output Layer";
+	ot->idname = "DPAINT_OT_output_toggle";
 	ot->description = "Add or remove Dynamic Paint output data layer";
 	
 	/* api callbacks */
-	ot->exec= output_toggle_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->exec = output_toggle_exec;
+	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", "");
+	ot->prop = RNA_def_enum(ot->srna, "output", prop_output_toggle_types, 0, "Output Toggle", "");
 }
 
 
 /***************************** Image Sequence Baking ******************************/
 
 /*
-*	Do actual bake operation. Loop through to-be-baked frames.
-*	Returns 0 on failture.
-*/
+ * Do actual bake operation. Loop through to-be-baked frames.
+ * Returns 0 on failure.
+ */
 static int dynamicPaint_bakeImageSequence(bContext *C, DynamicPaintSurface *surface, Object *cObject)
 {
 	DynamicPaintCanvasSettings *canvas = surface->canvas;
@@ -309,8 +308,8 @@ static int dynamicPaint_bakeImageSequence(bContext *C, DynamicPaintSurface *surf
 		if (!dynamicPaint_calculateFrame(surface, scene, cObject, frame)) return 0;
 
 		/*
-		*	Save output images
-		*/
+		 * Save output images
+		 */
 		{
 			char filename[FILE_MAX];
 
@@ -352,8 +351,8 @@ static int dynamicPaint_initBake(struct bContext *C, struct wmOperator *op)
 	DynamicPaintSurface *surface;
 
 	/*
-	*	Get modifier data
-	*/
+	 * Get modifier data
+	 */
 	pmd = (DynamicPaintModifierData *)modifiers_findByType(ob, eModifierType_DynamicPaint);
 	if (!pmd) {
 		BKE_report(op->reports, RPT_ERROR, "Bake Failed: No Dynamic Paint modifier found.");
@@ -381,7 +380,7 @@ static int dynamicPaint_initBake(struct bContext *C, struct wmOperator *op)
 	dynamicPaint_freeSurfaceData(surface);
 
 	/* Bake was successful:
-	*  Report for ended bake and how long it took */
+	 *  Report for ended bake and how long it took */
 	if (status) {
 		/* Format time string	*/
 		char time_str[30];
@@ -397,7 +396,7 @@ static int dynamicPaint_initBake(struct bContext *C, struct wmOperator *op)
 			BLI_snprintf(result_str, sizeof(result_str), "Bake Failed: %s", canvas->error);
 			BKE_report(op->reports, RPT_ERROR, result_str);
 		}
-		else {	/* User cancelled the bake */
+		else {	/* User canceled the bake */
 			BLI_strncpy(result_str, "Baking Cancelled!", sizeof(result_str));
 			BKE_report(op->reports, RPT_WARNING, result_str);
 		}
@@ -409,7 +408,7 @@ static int dynamicPaint_initBake(struct bContext *C, struct wmOperator *op)
 static int dynamicpaint_bake_exec(bContext *C, wmOperator *op)
 {
 	/* Bake dynamic paint */
-	if(!dynamicPaint_initBake(C, op)) {
+	if (!dynamicPaint_initBake(C, op)) {
 		return OPERATOR_CANCELLED;}
 
 	return OPERATOR_FINISHED;
@@ -418,11 +417,11 @@ static int dynamicpaint_bake_exec(bContext *C, wmOperator *op)
 void DPAINT_OT_bake(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Dynamic Paint Bake";
-	ot->description= "Bake dynamic paint image sequence surface";
-	ot->idname= "DPAINT_OT_bake";
+	ot->name = "Dynamic Paint Bake";
+	ot->description = "Bake dynamic paint image sequence surface";
+	ot->idname = "DPAINT_OT_bake";
 	
 	/* api callbacks */
-	ot->exec= dynamicpaint_bake_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->exec = dynamicpaint_bake_exec;
+	ot->poll = ED_operator_object_active_editable;
 }
diff --git a/source/blender/editors/physics/particle_boids.c b/source/blender/editors/physics/particle_boids.c
index 54bd191..7a7c16b 100644
--- a/source/blender/editors/physics/particle_boids.c
+++ b/source/blender/editors/physics/particle_boids.c
@@ -65,7 +65,7 @@ static int rule_add_exec(bContext *C, wmOperator *op)
 	BoidRule *rule;
 	BoidState *state;
 
-	if(!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
+	if (!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
 		return OPERATOR_CANCELLED;
 
 	part = psys->part;
@@ -73,7 +73,7 @@ static int rule_add_exec(bContext *C, wmOperator *op)
 	state = boid_get_current_state(part->boids);
 
 
-	for(rule=state->rules.first; rule; rule=rule->next)
+	for (rule=state->rules.first; rule; rule=rule->next)
 		rule->flag &= ~BOIDRULE_CURRENT;
 
 	rule = boid_new_rule(type);
@@ -90,18 +90,18 @@ static int rule_add_exec(bContext *C, wmOperator *op)
 void BOID_OT_rule_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Boid Rule";
+	ot->name = "Add Boid Rule";
 	ot->description = "Add a boid rule to the current boid state";
-	ot->idname= "BOID_OT_rule_add";
+	ot->idname = "BOID_OT_rule_add";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= rule_add_exec;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = rule_add_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
-	ot->prop= RNA_def_enum(ot->srna, "type", boidrule_type_items, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", boidrule_type_items, 0, "Type", "");
 }
 static int rule_del_exec(bContext *C, wmOperator *UNUSED(op))
 {
@@ -113,14 +113,14 @@ static int rule_del_exec(bContext *C, wmOperator *UNUSED(op))
 	BoidRule *rule;
 	BoidState *state;
 
-	if(!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
+	if (!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
 		return OPERATOR_CANCELLED;
 
 	state = boid_get_current_state(psys->part->boids);
 
 	
-	for(rule=state->rules.first; rule; rule=rule->next) {
-		if(rule->flag & BOIDRULE_CURRENT) {
+	for (rule=state->rules.first; rule; rule=rule->next) {
+		if (rule->flag & BOIDRULE_CURRENT) {
 			BLI_remlink(&state->rules, rule);
 			MEM_freeN(rule);
 			break;
@@ -129,7 +129,7 @@ static int rule_del_exec(bContext *C, wmOperator *UNUSED(op))
 	}
 	rule = state->rules.first;
 
-	if(rule)
+	if (rule)
 		rule->flag |= BOIDRULE_CURRENT;
 
 	DAG_scene_sort(bmain, scene);
@@ -143,14 +143,14 @@ static int rule_del_exec(bContext *C, wmOperator *UNUSED(op))
 void BOID_OT_rule_del(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove Boid Rule";
-	ot->idname= "BOID_OT_rule_del";
+	ot->name = "Remove Boid Rule";
+	ot->idname = "BOID_OT_rule_del";
 	
 	/* api callbacks */
-	ot->exec= rule_del_exec;
+	ot->exec = rule_del_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /************************ move up/down boid rule operators *********************/
@@ -162,12 +162,12 @@ static int rule_move_up_exec(bContext *C, wmOperator *UNUSED(op))
 	BoidRule *rule;
 	BoidState *state;
 
-	if(!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
+	if (!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
 		return OPERATOR_CANCELLED;
 	
 	state = boid_get_current_state(psys->part->boids);
-	for(rule = state->rules.first; rule; rule=rule->next) {
-		if(rule->flag & BOIDRULE_CURRENT && rule->prev) {
+	for (rule = state->rules.first; rule; rule=rule->next) {
+		if (rule->flag & BOIDRULE_CURRENT && rule->prev) {
 			BLI_remlink(&state->rules, rule);
 			BLI_insertlink(&state->rules, rule->prev->prev, rule);
 
@@ -182,14 +182,14 @@ static int rule_move_up_exec(bContext *C, wmOperator *UNUSED(op))
 
 void BOID_OT_rule_move_up(wmOperatorType *ot)
 {
-	ot->name= "Move Up Boid Rule";
-	ot->description= "Move boid rule up in the list";
-	ot->idname= "BOID_OT_rule_move_up";
+	ot->name = "Move Up Boid Rule";
+	ot->description = "Move boid rule up in the list";
+	ot->idname = "BOID_OT_rule_move_up";
 
-	ot->exec= rule_move_up_exec;
+	ot->exec = rule_move_up_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int rule_move_down_exec(bContext *C, wmOperator *UNUSED(op))
@@ -200,12 +200,12 @@ static int rule_move_down_exec(bContext *C, wmOperator *UNUSED(op))
 	BoidRule *rule;
 	BoidState *state;
 
-	if(!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
+	if (!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
 		return OPERATOR_CANCELLED;
 	
 	state = boid_get_current_state(psys->part->boids);
-	for(rule = state->rules.first; rule; rule=rule->next) {
-		if(rule->flag & BOIDRULE_CURRENT && rule->next) {
+	for (rule = state->rules.first; rule; rule=rule->next) {
+		if (rule->flag & BOIDRULE_CURRENT && rule->next) {
 			BLI_remlink(&state->rules, rule);
 			BLI_insertlink(&state->rules, rule->next, rule);
 
@@ -220,14 +220,14 @@ static int rule_move_down_exec(bContext *C, wmOperator *UNUSED(op))
 
 void BOID_OT_rule_move_down(wmOperatorType *ot)
 {
-	ot->name= "Move Down Boid Rule";
-	ot->description= "Move boid rule down in the list";
-	ot->idname= "BOID_OT_rule_move_down";
+	ot->name = "Move Down Boid Rule";
+	ot->description = "Move boid rule down in the list";
+	ot->idname = "BOID_OT_rule_move_down";
 
-	ot->exec= rule_move_down_exec;
+	ot->exec = rule_move_down_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 
@@ -240,12 +240,12 @@ static int state_add_exec(bContext *C, wmOperator *UNUSED(op))
 	ParticleSettings *part;
 	BoidState *state;
 
-	if(!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
+	if (!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
 		return OPERATOR_CANCELLED;
 
 	part = psys->part;
 
-	for(state=part->boids->states.first; state; state=state->next)
+	for (state=part->boids->states.first; state; state=state->next)
 		state->flag &= ~BOIDSTATE_CURRENT;
 
 	state = boid_new_state(part->boids);
@@ -261,15 +261,15 @@ static int state_add_exec(bContext *C, wmOperator *UNUSED(op))
 void BOID_OT_state_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Boid State";
+	ot->name = "Add Boid State";
 	ot->description = "Add a boid state to the particle system";
-	ot->idname= "BOID_OT_state_add";
+	ot->idname = "BOID_OT_state_add";
 	
 	/* api callbacks */
-	ot->exec= state_add_exec;
+	ot->exec = state_add_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 static int state_del_exec(bContext *C, wmOperator *UNUSED(op))
 {
@@ -281,13 +281,13 @@ static int state_del_exec(bContext *C, wmOperator *UNUSED(op))
 	ParticleSettings *part;
 	BoidState *state;
 
-	if(!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
+	if (!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
 		return OPERATOR_CANCELLED;
 
 	part = psys->part;
 	
-	for(state=part->boids->states.first; state; state=state->next) {
-		if(state->flag & BOIDSTATE_CURRENT) {
+	for (state=part->boids->states.first; state; state=state->next) {
+		if (state->flag & BOIDSTATE_CURRENT) {
 			BLI_remlink(&part->boids->states, state);
 			MEM_freeN(state);
 			break;
@@ -296,7 +296,7 @@ static int state_del_exec(bContext *C, wmOperator *UNUSED(op))
 	}
 
 	/* there must be at least one state */
-	if(!part->boids->states.first) {
+	if (!part->boids->states.first) {
 		state = boid_new_state(part->boids);
 		BLI_addtail(&part->boids->states, state);	
 	}
@@ -316,14 +316,14 @@ static int state_del_exec(bContext *C, wmOperator *UNUSED(op))
 void BOID_OT_state_del(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove Boid State";
-	ot->idname= "BOID_OT_state_del";
+	ot->name = "Remove Boid State";
+	ot->idname = "BOID_OT_state_del";
 	
 	/* api callbacks */
-	ot->exec= state_del_exec;
+	ot->exec = state_del_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /************************ move up/down boid state operators *********************/
@@ -335,13 +335,13 @@ static int state_move_up_exec(bContext *C, wmOperator *UNUSED(op))
 	BoidSettings *boids;
 	BoidState *state;
 
-	if(!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
+	if (!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
 		return OPERATOR_CANCELLED;
 
 	boids = psys->part->boids;
 	
-	for(state = boids->states.first; state; state=state->next) {
-		if(state->flag & BOIDSTATE_CURRENT && state->prev) {
+	for (state = boids->states.first; state; state=state->next) {
+		if (state->flag & BOIDSTATE_CURRENT && state->prev) {
 			BLI_remlink(&boids->states, state);
 			BLI_insertlink(&boids->states, state->prev->prev, state);
 			WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
@@ -354,14 +354,14 @@ static int state_move_up_exec(bContext *C, wmOperator *UNUSED(op))
 
 void BOID_OT_state_move_up(wmOperatorType *ot)
 {
-	ot->name= "Move Up Boid State";
-	ot->description= "Move boid state up in the list";
-	ot->idname= "BOID_OT_state_move_up";
+	ot->name = "Move Up Boid State";
+	ot->description = "Move boid state up in the list";
+	ot->idname = "BOID_OT_state_move_up";
 
-	ot->exec= state_move_up_exec;
+	ot->exec = state_move_up_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int state_move_down_exec(bContext *C, wmOperator *UNUSED(op))
@@ -371,13 +371,13 @@ static int state_move_down_exec(bContext *C, wmOperator *UNUSED(op))
 	BoidSettings *boids;
 	BoidState *state;
 
-	if(!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
+	if (!psys || !psys->part || psys->part->phystype != PART_PHYS_BOIDS)
 		return OPERATOR_CANCELLED;
 
 	boids = psys->part->boids;
 	
-	for(state = boids->states.first; state; state=state->next) {
-		if(state->flag & BOIDSTATE_CURRENT && state->next) {
+	for (state = boids->states.first; state; state=state->next) {
+		if (state->flag & BOIDSTATE_CURRENT && state->next) {
 			BLI_remlink(&boids->states, state);
 			BLI_insertlink(&boids->states, state->next, state);
 			DAG_id_tag_update(&psys->part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
@@ -390,13 +390,13 @@ static int state_move_down_exec(bContext *C, wmOperator *UNUSED(op))
 
 void BOID_OT_state_move_down(wmOperatorType *ot)
 {
-	ot->name= "Move Down Boid State";
-	ot->description= "Move boid state down in the list";
-	ot->idname= "BOID_OT_state_move_down";
+	ot->name = "Move Down Boid State";
+	ot->description = "Move boid state down in the list";
+	ot->idname = "BOID_OT_state_move_down";
 
-	ot->exec= state_move_down_exec;
+	ot->exec = state_move_down_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index dbf03e3..5f22165 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -89,16 +89,16 @@ static void recalc_emitter_field(Object *ob, ParticleSystem *psys);
 
 #define KEY_K					PTCacheEditKey *key; int k
 #define POINT_P					PTCacheEditPoint *point; int p
-#define LOOP_POINTS				for(p=0, point=edit->points; p<edit->totpoint; p++, point++)
-#define LOOP_VISIBLE_POINTS		for(p=0, point=edit->points; p<edit->totpoint; p++, point++) if(!(point->flag & PEP_HIDE))
-#define LOOP_SELECTED_POINTS	for(p=0, point=edit->points; p<edit->totpoint; p++, point++) if(point_is_selected(point))
-#define LOOP_UNSELECTED_POINTS	for(p=0, point=edit->points; p<edit->totpoint; p++, point++) if(!point_is_selected(point))
-#define LOOP_EDITED_POINTS		for(p=0, point=edit->points; p<edit->totpoint; p++, point++) if(point->flag & PEP_EDIT_RECALC)
-#define LOOP_TAGGED_POINTS		for(p=0, point=edit->points; p<edit->totpoint; p++, point++) if(point->flag & PEP_TAG)
-#define LOOP_KEYS				for(k=0, key=point->keys; k<point->totkey; k++, key++)
-#define LOOP_VISIBLE_KEYS		for(k=0, key=point->keys; k<point->totkey; k++, key++) if(!(key->flag & PEK_HIDE))
-#define LOOP_SELECTED_KEYS		for(k=0, key=point->keys; k<point->totkey; k++, key++) if((key->flag & PEK_SELECT) && !(key->flag & PEK_HIDE))
-#define LOOP_TAGGED_KEYS		for(k=0, key=point->keys; k<point->totkey; k++, key++) if(key->flag & PEK_TAG)
+#define LOOP_POINTS				for (p=0, point=edit->points; p<edit->totpoint; p++, point++)
+#define LOOP_VISIBLE_POINTS		for (p=0, point=edit->points; p<edit->totpoint; p++, point++) if (!(point->flag & PEP_HIDE))
+#define LOOP_SELECTED_POINTS	for (p=0, point=edit->points; p<edit->totpoint; p++, point++) if (point_is_selected(point))
+#define LOOP_UNSELECTED_POINTS	for (p=0, point=edit->points; p<edit->totpoint; p++, point++) if (!point_is_selected(point))
+#define LOOP_EDITED_POINTS		for (p=0, point=edit->points; p<edit->totpoint; p++, point++) if (point->flag & PEP_EDIT_RECALC)
+#define LOOP_TAGGED_POINTS		for (p=0, point=edit->points; p<edit->totpoint; p++, point++) if (point->flag & PEP_TAG)
+#define LOOP_KEYS				for (k=0, key=point->keys; k<point->totkey; k++, key++)
+#define LOOP_VISIBLE_KEYS		for (k=0, key=point->keys; k<point->totkey; k++, key++) if (!(key->flag & PEK_HIDE))
+#define LOOP_SELECTED_KEYS		for (k=0, key=point->keys; k<point->totkey; k++, key++) if ((key->flag & PEK_SELECT) && !(key->flag & PEK_HIDE))
+#define LOOP_TAGGED_KEYS		for (k=0, key=point->keys; k<point->totkey; k++, key++) if (key->flag & PEK_TAG)
 
 #define KEY_WCO					(key->flag & PEK_USE_WCO ? key->world_co : key->co)
 
@@ -109,7 +109,7 @@ int PE_poll(bContext *C)
 	Scene *scene= CTX_data_scene(C);
 	Object *ob= CTX_data_active_object(C);
 
-	if(!scene || !ob || !(ob->mode & OB_MODE_PARTICLE_EDIT))
+	if (!scene || !ob || !(ob->mode & OB_MODE_PARTICLE_EDIT))
 		return 0;
 	
 	return (PE_get_current(scene, ob) != NULL);
@@ -121,7 +121,7 @@ int PE_hair_poll(bContext *C)
 	Object *ob= CTX_data_active_object(C);
 	PTCacheEdit *edit;
 
-	if(!scene || !ob || !(ob->mode & OB_MODE_PARTICLE_EDIT))
+	if (!scene || !ob || !(ob->mode & OB_MODE_PARTICLE_EDIT))
 		return 0;
 	
 	edit= PE_get_current(scene, ob);
@@ -139,28 +139,28 @@ void PE_free_ptcache_edit(PTCacheEdit *edit)
 {
 	POINT_P;
 
-	if(edit==0) return;
+	if (edit==0) return;
 
 	PTCacheUndo_clear(edit);
 
-	if(edit->points) {
+	if (edit->points) {
 		LOOP_POINTS {
-			if(point->keys) 
+			if (point->keys)
 				MEM_freeN(point->keys);
 		}
 
 		MEM_freeN(edit->points);
 	}
 
-	if(edit->mirror_cache)
+	if (edit->mirror_cache)
 		MEM_freeN(edit->mirror_cache);
 
-	if(edit->emitter_cosnos) {
+	if (edit->emitter_cosnos) {
 		MEM_freeN(edit->emitter_cosnos);
 		edit->emitter_cosnos= 0;
 	}
 
-	if(edit->emitter_field) {
+	if (edit->emitter_field) {
 		BLI_kdtree_free(edit->emitter_field);
 		edit->emitter_field= 0;
 	}
@@ -176,9 +176,9 @@ void PE_free_ptcache_edit(PTCacheEdit *edit)
 
 int PE_start_edit(PTCacheEdit *edit)
 {
-	if(edit) {
+	if (edit) {
 		edit->edited = 1;
-		if(edit->psys)
+		if (edit->psys)
 			edit->psys->flag |= PSYS_EDITED;
 		return 1;
 	}
@@ -191,7 +191,7 @@ ParticleEditSettings *PE_settings(Scene *scene)
 	return scene->toolsettings ? &scene->toolsettings->particle : NULL;
 }
 
-/* always gets atleast the first particlesystem even if PSYS_CURRENT flag is not set
+/* always gets at least the first particlesystem even if PSYS_CURRENT flag is not set
  *
  * note: this function runs on poll, therefor it can runs many times a second
  * keep it fast! */
@@ -202,7 +202,7 @@ static PTCacheEdit *pe_get_current(Scene *scene, Object *ob, int create)
 	ListBase pidlist;
 	PTCacheID *pid;
 
-	if(pset==NULL || ob==NULL)
+	if (pset==NULL || ob==NULL)
 		return NULL;
 
 	pset->scene = scene;
@@ -211,7 +211,7 @@ static PTCacheEdit *pe_get_current(Scene *scene, Object *ob, int create)
 	BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
 
 	/* in the case of only one editable thing, set pset->edittype accordingly */
-	if(pidlist.first && pidlist.first == pidlist.last) {
+	if (pidlist.first && pidlist.first == pidlist.last) {
 		pid = pidlist.first;
 		switch(pid->type) {
 			case PTCACHE_TYPE_PARTICLES:
@@ -226,25 +226,25 @@ static PTCacheEdit *pe_get_current(Scene *scene, Object *ob, int create)
 		}
 	}
 
-	for(pid=pidlist.first; pid; pid=pid->next) {
-		if(pset->edittype == PE_TYPE_PARTICLES && pid->type == PTCACHE_TYPE_PARTICLES) {
+	for (pid=pidlist.first; pid; pid=pid->next) {
+		if (pset->edittype == PE_TYPE_PARTICLES && pid->type == PTCACHE_TYPE_PARTICLES) {
 			ParticleSystem *psys = pid->calldata;
 
-			if(psys->flag & PSYS_CURRENT) {
-				if(psys->part && psys->part->type == PART_HAIR) {
-					if(psys->flag & PSYS_HAIR_DYNAMICS && psys->pointcache->flag & PTCACHE_BAKED) {
-						if(create && !psys->pointcache->edit)
+			if (psys->flag & PSYS_CURRENT) {
+				if (psys->part && psys->part->type == PART_HAIR) {
+					if (psys->flag & PSYS_HAIR_DYNAMICS && psys->pointcache->flag & PTCACHE_BAKED) {
+						if (create && !psys->pointcache->edit)
 							PE_create_particle_edit(scene, ob, pid->cache, NULL);
 						edit = pid->cache->edit;
 					}
 					else {
-						if(create && !psys->edit && psys->flag & PSYS_HAIR_DONE)
+						if (create && !psys->edit && psys->flag & PSYS_HAIR_DONE)
 							PE_create_particle_edit(scene, ob, NULL, psys);
 						edit = psys->edit;
 					}
 				}
 				else {
-					if(create && pid->cache->flag & PTCACHE_BAKED && !pid->cache->edit)
+					if (create && pid->cache->flag & PTCACHE_BAKED && !pid->cache->edit)
 						PE_create_particle_edit(scene, ob, pid->cache, psys);
 					edit = pid->cache->edit;
 				}
@@ -252,9 +252,8 @@ static PTCacheEdit *pe_get_current(Scene *scene, Object *ob, int create)
 				break;
 			}
 		}
-		else if(pset->edittype == PE_TYPE_SOFTBODY && pid->type == PTCACHE_TYPE_SOFTBODY) {
-			if(create && pid->cache->flag & PTCACHE_BAKED && !pid->cache->edit)
-			{
+		else if (pset->edittype == PE_TYPE_SOFTBODY && pid->type == PTCACHE_TYPE_SOFTBODY) {
+			if (create && pid->cache->flag & PTCACHE_BAKED && !pid->cache->edit) {
 				pset->flag |= PE_FADE_TIME;
 				// NICE TO HAVE but doesn't work: pset->brushtype = PE_BRUSH_COMB;
 				PE_create_particle_edit(scene, ob, pid->cache, NULL);
@@ -262,9 +261,8 @@ static PTCacheEdit *pe_get_current(Scene *scene, Object *ob, int create)
 			edit = pid->cache->edit;
 			break;
 		}
-		else if(pset->edittype == PE_TYPE_CLOTH && pid->type == PTCACHE_TYPE_CLOTH) {
-			if(create && pid->cache->flag & PTCACHE_BAKED && !pid->cache->edit)
-			{
+		else if (pset->edittype == PE_TYPE_CLOTH && pid->type == PTCACHE_TYPE_CLOTH) {
+			if (create && pid->cache->flag & PTCACHE_BAKED && !pid->cache->edit) {
 				pset->flag |= PE_FADE_TIME;
 				// NICE TO HAVE but doesn't work: pset->brushtype = PE_BRUSH_COMB;
 				PE_create_particle_edit(scene, ob, pid->cache, NULL);
@@ -274,7 +272,7 @@ static PTCacheEdit *pe_get_current(Scene *scene, Object *ob, int create)
 		}
 	}
 
-	if(edit)
+	if (edit)
 		edit->pid = *pid;
 
 	BLI_freelistN(&pidlist);
@@ -294,7 +292,7 @@ PTCacheEdit *PE_create_current(Scene *scene, Object *ob)
 
 void PE_current_changed(Scene *scene, Object *ob)
 {
-	if(ob->mode == OB_MODE_PARTICLE_EDIT)
+	if (ob->mode == OB_MODE_PARTICLE_EDIT)
 		PE_create_current(scene, ob);
 }
 
@@ -304,10 +302,10 @@ void PE_hide_keys_time(Scene *scene, PTCacheEdit *edit, float cfra)
 	POINT_P; KEY_K;
 
 
-	if(pset->flag & PE_FADE_TIME && pset->selectmode==SCE_SELECT_POINT) {
+	if (pset->flag & PE_FADE_TIME && pset->selectmode==SCE_SELECT_POINT) {
 		LOOP_POINTS {
 			LOOP_KEYS {
-				if(fabs(cfra-*key->time) < pset->fade_frames)
+				if (fabs(cfra-*key->time) < pset->fade_frames)
 					key->flag &= ~PEK_HIDE;
 				else {
 					key->flag |= PEK_HIDE;
@@ -327,7 +325,7 @@ void PE_hide_keys_time(Scene *scene, PTCacheEdit *edit, float cfra)
 
 static int pe_x_mirror(Object *ob)
 {
-	if(ob->type == OB_MESH)
+	if (ob->type == OB_MESH)
 		return (((Mesh*)ob->data)->editflag & ME_EDIT_MIRROR_X);
 	
 	return 0;
@@ -382,8 +380,8 @@ static void PE_set_view3d_data(bContext *C, PEData *data)
 	/* note, the object argument means the modelview matrix does not account for the objects matrix, use viewmat rather than (obmat * viewmat) */
 	view3d_get_transformation(data->vc.ar, data->vc.rv3d, NULL, &data->mats);
 
-	if((data->vc.v3d->drawtype>OB_WIRE) && (data->vc.v3d->flag & V3D_ZBUF_SELECT)) {
-		if(data->vc.v3d->flag & V3D_INVALID_BACKBUF) {
+	if ((data->vc.v3d->drawtype>OB_WIRE) && (data->vc.v3d->flag & V3D_ZBUF_SELECT)) {
+		if (data->vc.v3d->flag & V3D_INVALID_BACKBUF) {
 			/* needed or else the draw matrix can be incorrect */
 			view3d_operator_needs_opengl(C);
 
@@ -406,12 +404,12 @@ static int key_test_depth(PEData *data, const float co[3])
 	short wco[3], x,y;
 
 	/* nothing to do */
-	if((v3d->drawtype<=OB_WIRE) || (v3d->flag & V3D_ZBUF_SELECT)==0)
+	if ((v3d->drawtype<=OB_WIRE) || (v3d->flag & V3D_ZBUF_SELECT)==0)
 		return 1;
 
 	project_short(data->vc.ar, co, wco);
 	
-	if(wco[0] == IS_CLIPPED)
+	if (wco[0] == IS_CLIPPED)
 		return 0;
 
 	gluProject(co[0],co[1],co[2], data->mats.modelview, data->mats.projection,
@@ -436,7 +434,7 @@ static int key_test_depth(PEData *data, const float co[3])
 	}
 #endif
 
-	if((float)uz - 0.00001f > depth)
+	if ((float)uz - 0.00001f > depth)
 		return 0;
 	else
 		return 1;
@@ -449,18 +447,18 @@ static int key_inside_circle(PEData *data, float rad, const float co[3], float *
 
 	project_int(data->vc.ar, co, sco);
 	
-	if(sco[0] == IS_CLIPPED)
+	if (sco[0] == IS_CLIPPED)
 		return 0;
 	
 	dx= data->mval[0] - sco[0];
 	dy= data->mval[1] - sco[1];
 	dist= sqrt(dx*dx + dy*dy);
 
-	if(dist > rad)
+	if (dist > rad)
 		return 0;
 
-	if(key_test_depth(data, co)) {
-		if(distance)
+	if (key_test_depth(data, co)) {
+		if (distance)
 			*distance=dist;
 
 		return 1;
@@ -475,10 +473,10 @@ static int key_inside_rect(PEData *data, const float co[3])
 
 	project_int(data->vc.ar, co,sco);
 
-	if(sco[0] == IS_CLIPPED)
+	if (sco[0] == IS_CLIPPED)
 		return 0;
 	
-	if(sco[0] > data->rect->xmin && sco[0] < data->rect->xmax &&
+	if (sco[0] > data->rect->xmin && sco[0] < data->rect->xmax &&
 	   sco[1] > data->rect->ymin && sco[1] < data->rect->ymax)
 		return key_test_depth(data, co);
 
@@ -487,7 +485,7 @@ static int key_inside_rect(PEData *data, const float co[3])
 
 static int key_inside_test(PEData *data, const float co[3])
 {
-	if(data->mval)
+	if (data->mval)
 		return key_inside_circle(data, data->rad, co, NULL);
 	else
 		return key_inside_rect(data, co);
@@ -497,7 +495,7 @@ static int point_is_selected(PTCacheEditPoint *point)
 {
 	KEY_K;
 
-	if(point->flag & PEP_HIDE)
+	if (point->flag & PEP_HIDE)
 		return 0;
 
 	LOOP_SELECTED_KEYS {
@@ -522,43 +520,43 @@ static void for_mouse_hit_keys(PEData *data, ForKeyFunc func, int nearest)
 	float dist= data->rad;
 
 	/* in path select mode we have no keys */
-	if(pset->selectmode==SCE_SELECT_PATH)
+	if (pset->selectmode==SCE_SELECT_PATH)
 		return;
 
 	nearest_point= -1;
 	nearest_key= -1;
 
 	LOOP_VISIBLE_POINTS {
-		if(pset->selectmode == SCE_SELECT_END) {
+		if (pset->selectmode == SCE_SELECT_END) {
 			/* only do end keys */
 			key= point->keys + point->totkey-1;
 
-			if(nearest) {
-				if(key_inside_circle(data, dist, KEY_WCO, &dist)) {
+			if (nearest) {
+				if (key_inside_circle(data, dist, KEY_WCO, &dist)) {
 					nearest_point= p;
 					nearest_key= point->totkey-1;
 				}
 			}
-			else if(key_inside_test(data, KEY_WCO))
+			else if (key_inside_test(data, KEY_WCO))
 				func(data, p, point->totkey-1);
 		}
 		else {
 			/* do all keys */
 			LOOP_VISIBLE_KEYS {
-				if(nearest) {
-					if(key_inside_circle(data, dist, KEY_WCO, &dist)) {
+				if (nearest) {
+					if (key_inside_circle(data, dist, KEY_WCO, &dist)) {
 						nearest_point= p;
 						nearest_key= k;
 					}
 				}
-				else if(key_inside_test(data, KEY_WCO))
+				else if (key_inside_test(data, KEY_WCO))
 					func(data, p, k);
 			}
 		}
 	}
 
 	/* do nearest only */
-	if(nearest && nearest_point > -1)
+	if (nearest && nearest_point > -1)
 		func(data, nearest_point, nearest_key);
 }
 
@@ -569,23 +567,23 @@ static void foreach_mouse_hit_point(PEData *data, ForPointFunc func, int selecte
 	POINT_P; KEY_K;
 
 	/* all is selected in path mode */
-	if(pset->selectmode==SCE_SELECT_PATH)
+	if (pset->selectmode==SCE_SELECT_PATH)
 		selected=0;
 
 	LOOP_VISIBLE_POINTS {
-		if(pset->selectmode==SCE_SELECT_END) {
+		if (pset->selectmode==SCE_SELECT_END) {
 			/* only do end keys */
 			key= point->keys + point->totkey - 1;
 
-			if(selected==0 || key->flag & PEK_SELECT)
-				if(key_inside_circle(data, data->rad, KEY_WCO, &data->dist))
+			if (selected==0 || key->flag & PEK_SELECT)
+				if (key_inside_circle(data, data->rad, KEY_WCO, &data->dist))
 					func(data, p);
 		}
 		else {
 			/* do all keys */
 			LOOP_VISIBLE_KEYS {
-				if(selected==0 || key->flag & PEK_SELECT) {
-					if(key_inside_circle(data, data->rad, KEY_WCO, &data->dist)) {
+				if (selected==0 || key->flag & PEK_SELECT) {
+					if (key_inside_circle(data, data->rad, KEY_WCO, &data->dist)) {
 						func(data, p);
 						break;
 					}
@@ -604,21 +602,21 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected
 	POINT_P; KEY_K;
 	float mat[4][4]= MAT4_UNITY, imat[4][4]= MAT4_UNITY;
 
-	if(edit->psys)
+	if (edit->psys)
 		psmd= psys_get_modifier(data->ob, edit->psys);
 
 	/* all is selected in path mode */
-	if(pset->selectmode==SCE_SELECT_PATH)
+	if (pset->selectmode==SCE_SELECT_PATH)
 		selected= 0;
 
 	LOOP_VISIBLE_POINTS {
-		if(pset->selectmode==SCE_SELECT_END) {
+		if (pset->selectmode==SCE_SELECT_END) {
 			/* only do end keys */
 			key= point->keys + point->totkey-1;
 
-			if(selected==0 || key->flag & PEK_SELECT) {
-				if(key_inside_circle(data, data->rad, KEY_WCO, &data->dist)) {
-					if(edit->psys && !(edit->psys->flag & PSYS_GLOBAL_HAIR)) {
+			if (selected==0 || key->flag & PEK_SELECT) {
+				if (key_inside_circle(data, data->rad, KEY_WCO, &data->dist)) {
+					if (edit->psys && !(edit->psys->flag & PSYS_GLOBAL_HAIR)) {
 						psys_mat_hair_to_global(data->ob, psmd->dm, psys->part->from, psys->particles + p, mat);
 						invert_m4_m4(imat,mat);
 					}
@@ -630,9 +628,9 @@ static void foreach_mouse_hit_key(PEData *data, ForKeyMatFunc func, int selected
 		else {
 			/* do all keys */
 			LOOP_VISIBLE_KEYS {
-				if(selected==0 || key->flag & PEK_SELECT) {
-					if(key_inside_circle(data, data->rad, KEY_WCO, &data->dist)) {
-						if(edit->psys && !(edit->psys->flag & PSYS_GLOBAL_HAIR)) {
+				if (selected==0 || key->flag & PEK_SELECT) {
+					if (key_inside_circle(data, data->rad, KEY_WCO, &data->dist)) {
+						if (edit->psys && !(edit->psys->flag & PSYS_GLOBAL_HAIR)) {
 							psys_mat_hair_to_global(data->ob, psmd->dm, psys->part->from, psys->particles + p, mat);
 							invert_m4_m4(imat,mat);
 						}
@@ -684,14 +682,14 @@ static int count_selected_keys(Scene *scene, PTCacheEdit *edit)
 	int sel= 0;
 
 	LOOP_VISIBLE_POINTS {
-		if(pset->selectmode==SCE_SELECT_POINT) {
+		if (pset->selectmode==SCE_SELECT_POINT) {
 			LOOP_SELECTED_KEYS {
 				sel++;
 			}
 		}
-		else if(pset->selectmode==SCE_SELECT_END) {
+		else if (pset->selectmode==SCE_SELECT_END) {
 			key = point->keys + point->totkey - 1;
-			if(key->flag & PEK_SELECT)
+			if (key->flag & PEK_SELECT)
 				sel++;
 		}
 	}
@@ -718,7 +716,7 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys)
 	psmd= psys_get_modifier(ob, psys);
 	totpart= psys->totpart;
 
-	if(!psmd->dm)
+	if (!psmd->dm)
 		return;
 
 	tree= BLI_kdtree_new(totpart);
@@ -735,7 +733,7 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys)
 	BLI_kdtree_balance(tree);
 
 	/* lookup particles and set in mirror cache */
-	if(!edit->mirror_cache)
+	if (!edit->mirror_cache)
 		edit->mirror_cache= MEM_callocN(sizeof(int)*totpart, "PE mirror cache");
 	
 	LOOP_PARTICLES {
@@ -748,7 +746,7 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys)
 		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))
+		if (index != -1 && index != p && (nearest.dist <= 0.0002f))
 			edit->mirror_cache[p]= index;
 		else
 			edit->mirror_cache[p]= -1;
@@ -756,9 +754,9 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys)
 
 	/* make sure mirrors are in two directions */
 	LOOP_PARTICLES {
-		if(edit->mirror_cache[p]) {
+		if (edit->mirror_cache[p]) {
 			index= edit->mirror_cache[p];
-			if(edit->mirror_cache[index] != p)
+			if (edit->mirror_cache[index] != p)
 				edit->mirror_cache[p]= -1;
 		}
 	}
@@ -779,15 +777,15 @@ static void PE_mirror_particle(Object *ob, DerivedMesh *dm, ParticleSystem *psys
 	i= pa - psys->particles;
 
 	/* find mirrored particle if needed */
-	if(!mpa) {
-		if(!edit->mirror_cache)
+	if (!mpa) {
+		if (!edit->mirror_cache)
 			PE_update_mirror_cache(ob, psys);
 		
-		if(!edit->mirror_cache)
+		if (!edit->mirror_cache)
 			return; /* something went wrong! */
 
 		mi= edit->mirror_cache[i];
-		if(mi == -1)
+		if (mi == -1)
 			return;
 		mpa= psys->particles + mi;
 	}
@@ -798,9 +796,9 @@ static void PE_mirror_particle(Object *ob, DerivedMesh *dm, ParticleSystem *psys
 	mpoint = edit->points + mi;
 
 	/* make sure they have the same amount of keys */
-	if(pa->totkey != mpa->totkey) {
-		if(mpa->hair) MEM_freeN(mpa->hair);
-		if(mpoint->keys) MEM_freeN(mpoint->keys);
+	if (pa->totkey != mpa->totkey) {
+		if (mpa->hair) MEM_freeN(mpa->hair);
+		if (mpoint->keys) MEM_freeN(mpoint->keys);
 
 		mpa->hair= MEM_dupallocN(pa->hair);
 		mpa->totkey= pa->totkey;
@@ -809,7 +807,7 @@ static void PE_mirror_particle(Object *ob, DerivedMesh *dm, ParticleSystem *psys
 
 		mhkey= mpa->hair;
 		mkey= mpoint->keys;
-		for(k=0; k<mpa->totkey; k++, mkey++, mhkey++) {
+		for (k=0; k<mpa->totkey; k++, mkey++, mhkey++) {
 			mkey->co= mhkey->co;
 			mkey->time= &mhkey->time;
 			mkey->flag &= ~PEK_SELECT;
@@ -825,21 +823,21 @@ static void PE_mirror_particle(Object *ob, DerivedMesh *dm, ParticleSystem *psys
 	mhkey=mpa->hair;
 	key= point->keys;
 	mkey= mpoint->keys;
-	for(k=0; k<pa->totkey; k++, hkey++, mhkey++, key++, mkey++) {
+	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];
 		mul_m4_v3(immat, mhkey->co);
 
-		if(key->flag & PEK_TAG)
+		if (key->flag & PEK_TAG)
 			mkey->flag |= PEK_TAG;
 
 		mkey->length = key->length;
 	}
 
-	if(point->flag & PEP_TAG)
+	if (point->flag & PEP_TAG)
 		mpoint->flag |= PEP_TAG;
-	if(point->flag & PEP_EDIT_RECALC)
+	if (point->flag & PEP_EDIT_RECALC)
 		mpoint->flag |= PEP_EDIT_RECALC;
 }
 
@@ -849,35 +847,35 @@ static void PE_apply_mirror(Object *ob, ParticleSystem *psys)
 	ParticleSystemModifierData *psmd;
 	POINT_P;
 
-	if(!psys)
+	if (!psys)
 		return;
 
 	edit= psys->edit;
 	psmd= psys_get_modifier(ob, psys);
 
-	if(!psmd->dm)
+	if (!psmd->dm)
 		return;
 
-	if(!edit->mirror_cache)
+	if (!edit->mirror_cache)
 		PE_update_mirror_cache(ob, psys);
 
-	if(!edit->mirror_cache)
+	if (!edit->mirror_cache)
 		return; /* something went wrong */
 
 	/* we delay settings the PARS_EDIT_RECALC for mirrored particles
 	 * to avoid doing mirror twice */
 	LOOP_POINTS {
-		if(point->flag & PEP_EDIT_RECALC) {
+		if (point->flag & PEP_EDIT_RECALC) {
 			PE_mirror_particle(ob, psmd->dm, psys, psys->particles + p, NULL);
 
-			if(edit->mirror_cache[p] != -1)
+			if (edit->mirror_cache[p] != -1)
 				edit->points[edit->mirror_cache[p]].flag &= ~PEP_EDIT_RECALC;
 		}
 	}
 
 	LOOP_POINTS {
-		if(point->flag & PEP_EDIT_RECALC)
-			if(edit->mirror_cache[p] != -1)
+		if (point->flag & PEP_EDIT_RECALC)
+			if (edit->mirror_cache[p] != -1)
 				edit->points[edit->mirror_cache[p]].flag |= PEP_EDIT_RECALC;
 	}
 }
@@ -896,13 +894,13 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
 	float *vec, *nor, dvec[3], dot, dist_1st=0.0f;
 	float hairimat[4][4], hairmat[4][4];
 
-	if(edit==NULL || edit->psys==NULL || (pset->flag & PE_DEFLECT_EMITTER)==0 || (edit->psys->flag & PSYS_GLOBAL_HAIR))
+	if (edit==NULL || edit->psys==NULL || (pset->flag & PE_DEFLECT_EMITTER)==0 || (edit->psys->flag & PSYS_GLOBAL_HAIR))
 		return;
 
 	psys = edit->psys;
 	psmd = psys_get_modifier(ob,psys);
 
-	if(!psmd->dm)
+	if (!psmd->dm)
 		return;
 
 	LOOP_EDITED_POINTS {
@@ -913,7 +911,7 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
 		}
 
 		LOOP_KEYS {
-			if(k==0) {
+			if (k==0) {
 				dist_1st = len_v3v3((key+1)->co, key->co);
 				dist_1st *= 0.75f * pset->emitterdist;
 			}
@@ -928,8 +926,8 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
 				dot=dot_v3v3(dvec,nor);
 				copy_v3_v3(dvec,nor);
 
-				if(dot>0.0f) {
-					if(dot<dist_1st) {
+				if (dot>0.0f) {
+					if (dot<dist_1st) {
 						normalize_v3(dvec);
 						mul_v3_fl(dvec,dist_1st-dot);
 						add_v3_v3(key->co, dvec);
@@ -940,7 +938,7 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
 					mul_v3_fl(dvec,dist_1st-dot);
 					add_v3_v3(key->co, dvec);
 				}
-				if(k==1)
+				if (k==1)
 					dist_1st*=1.3333f;
 			}
 		}
@@ -952,7 +950,7 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
 		}
 	}
 }
-/* force set distances between neighbouring keys */
+/* force set distances between neighboring keys */
 static void PE_apply_lengths(Scene *scene, PTCacheEdit *edit)
 {
 	
@@ -960,15 +958,15 @@ static void PE_apply_lengths(Scene *scene, PTCacheEdit *edit)
 	POINT_P; KEY_K;
 	float dv1[3];
 
-	if(edit==0 || (pset->flag & PE_KEEP_LENGTHS)==0)
+	if (edit==0 || (pset->flag & PE_KEEP_LENGTHS)==0)
 		return;
 
-	if(edit->psys && edit->psys->flag & PSYS_GLOBAL_HAIR)
+	if (edit->psys && edit->psys->flag & PSYS_GLOBAL_HAIR)
 		return;
 
 	LOOP_EDITED_POINTS {
 		LOOP_KEYS {
-			if(k) {
+			if (k) {
 				sub_v3_v3v3(dv1, key->co, (key - 1)->co);
 				normalize_v3(dv1);
 				mul_v3_fl(dv1, (key - 1)->length);
@@ -977,7 +975,7 @@ static void PE_apply_lengths(Scene *scene, PTCacheEdit *edit)
 		}
 	}
 }
-/* try to find a nice solution to keep distances between neighbouring keys */
+/* try to find a nice solution to keep distances between neighboring keys */
 static void pe_iterate_lengths(Scene *scene, PTCacheEdit *edit)
 {
 	ParticleEditSettings *pset=PE_settings(scene);
@@ -989,17 +987,17 @@ static void pe_iterate_lengths(Scene *scene, PTCacheEdit *edit)
 	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)
+	if (edit==0 || (pset->flag & PE_KEEP_LENGTHS)==0)
 		return;
 
-	if(edit->psys && edit->psys->flag & PSYS_GLOBAL_HAIR)
+	if (edit->psys && edit->psys->flag & PSYS_GLOBAL_HAIR)
 		return;
 
 	LOOP_EDITED_POINTS {
-		for(j=1; j<point->totkey; j++) {
+		for (j=1; j<point->totkey; j++) {
 			float mul= 1.0f / (float)point->totkey;
 
-			if(pset->flag & PE_LOCK_FIRST) {
+			if (pset->flag & PE_LOCK_FIRST) {
 				key= point->keys + 1;
 				k= 1;
 				dv1[0]= dv1[1]= dv1[2]= 0.0;
@@ -1010,20 +1008,20 @@ static void pe_iterate_lengths(Scene *scene, PTCacheEdit *edit)
 				dv0[0]= dv0[1]= dv0[2]= 0.0;
 			}
 
-			for(; k<point->totkey; k++, key++) {
-				if(k) {
+			for (; k<point->totkey; k++, key++) {
+				if (k) {
 					sub_v3_v3v3(dv0, (key - 1)->co, key->co);
 					tlen= normalize_v3(dv0);
 					mul_v3_fl(dv0, (mul * (tlen - (key - 1)->length)));
 				}
 
-				if(k < point->totkey - 1) {
+				if (k < point->totkey - 1) {
 					sub_v3_v3v3(dv2, (key + 1)->co, key->co);
 					tlen= normalize_v3(dv2);
 					mul_v3_fl(dv2, mul * (tlen - key->length));
 				}
 
-				if(k) {
+				if (k) {
 					add_v3_v3((key-1)->co, dv1);
 				}
 
@@ -1037,12 +1035,12 @@ static void recalc_lengths(PTCacheEdit *edit)
 {
 	POINT_P; KEY_K;
 
-	if(edit==0)
+	if (edit==0)
 		return;
 
 	LOOP_EDITED_POINTS {
 		key= point->keys;
-		for(k=0; k<point->totkey-1; k++, key++) {
+		for (k=0; k<point->totkey-1; k++, key++) {
 			key->length= len_v3v3(key->co, (key + 1)->co);
 		}
 	}
@@ -1056,15 +1054,15 @@ static void recalc_emitter_field(Object *ob, ParticleSystem *psys)
 	float *vec, *nor;
 	int i, totface /*, totvert*/;
 
-	if(!dm)
+	if (!dm)
 		return;
 
-	if(edit->emitter_cosnos)
+	if (edit->emitter_cosnos)
 		MEM_freeN(edit->emitter_cosnos);
 
 	BLI_kdtree_free(edit->emitter_field);
 
-	totface=dm->getNumFaces(dm);
+	totface=dm->getNumTessFaces(dm);
 	/*totvert=dm->getNumVerts(dm);*/ /*UNSUED*/
 
 	edit->emitter_cosnos=MEM_callocN(totface*6*sizeof(float),"emitter cosnos");
@@ -1074,8 +1072,8 @@ static void recalc_emitter_field(Object *ob, ParticleSystem *psys)
 	vec=edit->emitter_cosnos;
 	nor=vec+3;
 
-	for(i=0; i<totface; i++, vec+=6, nor+=6) {
-		MFace *mface=dm->getFaceData(dm,i,CD_MFACE);
+	for (i=0; i<totface; i++, vec+=6, nor+=6) {
+		MFace *mface=dm->getTessFaceData(dm,i,CD_MFACE);
 		MVert *mvert;
 
 		mvert=dm->getVertData(dm,mface->v1,CD_MVERT);
@@ -1090,7 +1088,7 @@ static void recalc_emitter_field(Object *ob, ParticleSystem *psys)
 		add_v3_v3v3(vec,vec,mvert->co);
 		VECADD(nor,nor,mvert->no);
 
-		if(mface->v4) {
+		if (mface->v4) {
 			mvert=dm->getVertData(dm,mface->v4,CD_MVERT);
 			add_v3_v3v3(vec,vec,mvert->co);
 			VECADD(nor,nor,mvert->no);
@@ -1115,13 +1113,13 @@ static void PE_update_selection(Scene *scene, Object *ob, int useflag)
 	POINT_P; KEY_K;
 
 	/* flag all particles to be updated if not using flag */
-	if(!useflag)
+	if (!useflag)
 		LOOP_POINTS
 			point->flag |= PEP_EDIT_RECALC;
 
 	/* flush edit key flag to hair key flag to preserve selection 
 	 * on save */
-	if(edit->psys) LOOP_POINTS {
+	if (edit->psys) LOOP_POINTS {
 		hkey = edit->psys->particles[p].hair;
 		LOOP_KEYS {
 			hkey->editflag= key->flag;
@@ -1144,16 +1142,16 @@ static void update_world_cos(Object *ob, PTCacheEdit *edit)
 	POINT_P; KEY_K;
 	float hairmat[4][4];
 
-	if(psys==0 || psys->edit==0 || psmd->dm==NULL)
+	if (psys==0 || psys->edit==0 || psmd->dm==NULL)
 		return;
 
 	LOOP_POINTS {
-		if(!(psys->flag & PSYS_GLOBAL_HAIR))
+		if (!(psys->flag & PSYS_GLOBAL_HAIR))
 			psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles+p, hairmat);
 
 		LOOP_KEYS {
 			copy_v3_v3(key->world_co,key->co);
-			if(!(psys->flag & PSYS_GLOBAL_HAIR))
+			if (!(psys->flag & PSYS_GLOBAL_HAIR))
 				mul_m4_v3(hairmat, key->world_co);
 		}
 	}
@@ -1165,37 +1163,37 @@ static void update_velocities(PTCacheEdit *edit)
 	POINT_P; KEY_K;
 
 	/* hair doesn't use velocities */
-	if(edit->psys || !edit->points || !edit->points->keys->vel)
+	if (edit->psys || !edit->points || !edit->points->keys->vel)
 		return;
 
 	frs_sec = edit->pid.flag & PTCACHE_VEL_PER_SEC ? 25.0f : 1.0f;
 
 	LOOP_EDITED_POINTS {
 		LOOP_KEYS {
-			if(k==0) {
+			if (k==0) {
 				dfra = *(key+1)->time - *key->time;
 
-				if(dfra <= 0.0f)
+				if (dfra <= 0.0f)
 					continue;
 
 				sub_v3_v3v3(key->vel, (key+1)->co, key->co);
 
-				if(point->totkey>2) {
+				if (point->totkey>2) {
 					sub_v3_v3v3(vec1, (key+1)->co, (key+2)->co);
 					project_v3_v3v3(vec2, vec1, key->vel);
 					sub_v3_v3v3(vec2, vec1, vec2);
 					madd_v3_v3fl(key->vel, vec2, 0.5f);
 				}
 			}
-			else if(k==point->totkey-1) {
+			else if (k==point->totkey-1) {
 				dfra = *key->time - *(key-1)->time;
 
-				if(dfra <= 0.0f)
+				if (dfra <= 0.0f)
 					continue;
 
 				sub_v3_v3v3(key->vel, key->co, (key-1)->co);
 
-				if(point->totkey>2) {
+				if (point->totkey>2) {
 					sub_v3_v3v3(vec1, (key-2)->co, (key-1)->co);
 					project_v3_v3v3(vec2, vec1, key->vel);
 					sub_v3_v3v3(vec2, vec1, vec2);
@@ -1205,7 +1203,7 @@ static void update_velocities(PTCacheEdit *edit)
 			else {
 				dfra = *(key+1)->time - *(key-1)->time;
 				
-				if(dfra <= 0.0f)
+				if (dfra <= 0.0f)
 					continue;
 
 				sub_v3_v3v3(key->vel, (key+1)->co, (key-1)->co);
@@ -1218,16 +1216,16 @@ static void update_velocities(PTCacheEdit *edit)
 void PE_update_object(Scene *scene, Object *ob, int useflag)
 {
 	/* use this to do partial particle updates, not usable when adding or
-	   removing, then a full redo is necessary and calling this may crash */
+	 * removing, then a full redo is necessary and calling this may crash */
 	ParticleEditSettings *pset= PE_settings(scene);
 	PTCacheEdit *edit = PE_get_current(scene, ob);
 	POINT_P;
 
-	if(!edit)
+	if (!edit)
 		return;
 
 	/* flag all particles to be updated if not using flag */
-	if(!useflag)
+	if (!useflag)
 		LOOP_POINTS {
 			point->flag |= PEP_EDIT_RECALC;
 		}
@@ -1236,11 +1234,11 @@ void PE_update_object(Scene *scene, Object *ob, int useflag)
 	pe_iterate_lengths(scene, edit);
 	pe_deflect_emitter(scene, ob, edit);
 	PE_apply_lengths(scene, edit);
-	if(pe_x_mirror(ob))
+	if (pe_x_mirror(ob))
 		PE_apply_mirror(ob,edit->psys);
-	if(edit->psys)
+	if (edit->psys)
 		update_world_cos(ob, edit);
-	if(pset->flag & PE_AUTO_VELOCITY)
+	if (pset->flag & PE_AUTO_VELOCITY)
 		update_velocities(edit);
 	PE_hide_keys_time(scene, edit, CFRA);
 
@@ -1252,7 +1250,7 @@ void PE_update_object(Scene *scene, Object *ob, int useflag)
 		point->flag &= ~PEP_EDIT_RECALC;
 	}
 
-	if(edit->psys)
+	if (edit->psys)
 		edit->psys->flag &= ~PSYS_HAIR_UPDATED;
 }
 
@@ -1268,7 +1266,7 @@ static void select_key(PEData *data, int point_index, int key_index)
 	PTCacheEditPoint *point = edit->points + point_index;
 	PTCacheEditKey *key = point->keys + key_index;
 
-	if(data->select)
+	if (data->select)
 		key->flag |= PEK_SELECT;
 	else
 		key->flag &= ~PEK_SELECT;
@@ -1283,7 +1281,7 @@ static void select_keys(PEData *data, int point_index, int UNUSED(key_index))
 	KEY_K;
 
 	LOOP_KEYS {
-		if(data->select)
+		if (data->select)
 			key->flag |= PEK_SELECT;
 		else
 			key->flag &= ~PEK_SELECT;
@@ -1344,7 +1342,8 @@ static int pe_select_all_exec(bContext *C, wmOperator *op)
 				if ((key->flag & PEK_SELECT) == 0) {
 					key->flag |= PEK_SELECT;
 					point->flag |= PEP_EDIT_RECALC;
-				} else {
+				}
+				else {
 					key->flag &= ~PEK_SELECT;
 					point->flag |= PEP_EDIT_RECALC;
 				}
@@ -1362,15 +1361,15 @@ static int pe_select_all_exec(bContext *C, wmOperator *op)
 void PARTICLE_OT_select_all(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Selection of all particles";
-	ot->idname= "PARTICLE_OT_select_all";
+	ot->name = "(De)select All";
+	ot->idname = "PARTICLE_OT_select_all";
 	
 	/* api callbacks */
-	ot->exec= pe_select_all_exec;
-	ot->poll= PE_poll;
+	ot->exec = pe_select_all_exec;
+	ot->poll = PE_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	WM_operator_properties_select_all(ot);
 }
@@ -1385,10 +1384,10 @@ int PE_mouse_particles(bContext *C, const int mval[2], int extend)
 	PTCacheEdit *edit= PE_get_current(scene, ob);
 	POINT_P; KEY_K;
 	
-	if(!PE_start_edit(edit))
+	if (!PE_start_edit(edit))
 		return OPERATOR_CANCELLED;
 
-	if(!extend) {
+	if (!extend) {
 		LOOP_VISIBLE_POINTS {
 			LOOP_SELECTED_KEYS {
 				key->flag &= ~PEK_SELECT;
@@ -1436,15 +1435,15 @@ static int select_roots_exec(bContext *C, wmOperator *UNUSED(op))
 void PARTICLE_OT_select_roots(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Roots";
-	ot->idname= "PARTICLE_OT_select_roots";
+	ot->name = "Select Roots";
+	ot->idname = "PARTICLE_OT_select_roots";
 	
 	/* api callbacks */
-	ot->exec= select_roots_exec;
-	ot->poll= PE_poll;
+	ot->exec = select_roots_exec;
+	ot->poll = PE_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /************************ select last operator ************************/
@@ -1476,15 +1475,15 @@ static int select_tips_exec(bContext *C, wmOperator *UNUSED(op))
 void PARTICLE_OT_select_tips(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Tips";
-	ot->idname= "PARTICLE_OT_select_tips";
+	ot->name = "Select Tips";
+	ot->idname = "PARTICLE_OT_select_tips";
 	
 	/* api callbacks */
-	ot->exec= select_tips_exec;
-	ot->poll= PE_poll;
+	ot->exec = select_tips_exec;
+	ot->poll = PE_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /************************ select linked operator ************************/
@@ -1520,16 +1519,16 @@ static int select_linked_invoke(bContext *C, wmOperator *op, wmEvent *event)
 void PARTICLE_OT_select_linked(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Linked";
-	ot->idname= "PARTICLE_OT_select_linked";
+	ot->name = "Select Linked";
+	ot->idname = "PARTICLE_OT_select_linked";
 	
 	/* api callbacks */
-	ot->exec= select_linked_exec;
-	ot->invoke= select_linked_invoke;
-	ot->poll= PE_poll_view3d;
+	ot->exec = select_linked_exec;
+	ot->invoke = select_linked_invoke;
+	ot->poll = PE_poll_view3d;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Deselect linked keys rather than selecting them");
@@ -1556,7 +1555,7 @@ int PE_border_select(bContext *C, rcti *rect, int select, int extend)
 	PTCacheEdit *edit= PE_get_current(scene, ob);
 	PEData data;
 
-	if(!PE_start_edit(edit))
+	if (!PE_start_edit(edit))
 		return OPERATOR_CANCELLED;
 
 	if (extend == 0 && select)
@@ -1583,7 +1582,7 @@ int PE_circle_select(bContext *C, int selecting, const int mval[2], float rad)
 	PTCacheEdit *edit= PE_get_current(scene, ob);
 	PEData data;
 
-	if(!PE_start_edit(edit))
+	if (!PE_start_edit(edit))
 		return OPERATOR_FINISHED;
 
 	PE_set_view3d_data(C, &data);
@@ -1616,7 +1615,7 @@ int PE_lasso_select(bContext *C, int mcords[][2], short moves, short extend, sho
 
 	PEData data;
 
-	if(!PE_start_edit(edit))
+	if (!PE_start_edit(edit))
 		return OPERATOR_CANCELLED;
 
 	if (extend == 0 && select)
@@ -1626,38 +1625,38 @@ int PE_lasso_select(bContext *C, int mcords[][2], short moves, short extend, sho
 	PE_set_view3d_data(C, &data);
 
 	LOOP_VISIBLE_POINTS {
-		if(edit->psys && !(psys->flag & PSYS_GLOBAL_HAIR))
+		if (edit->psys && !(psys->flag & PSYS_GLOBAL_HAIR))
 			psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles + p, mat);
 
-		if(pset->selectmode==SCE_SELECT_POINT) {
+		if (pset->selectmode==SCE_SELECT_POINT) {
 			LOOP_KEYS {
 				copy_v3_v3(co, key->co);
 				mul_m4_v3(mat, co);
 				project_int(ar, co, vertco);
-				if((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1]) && key_test_depth(&data, co)) {
-					if(select && !(key->flag & PEK_SELECT)) {
+				if ((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1]) && key_test_depth(&data, co)) {
+					if (select && !(key->flag & PEK_SELECT)) {
 						key->flag |= PEK_SELECT;
 						point->flag |= PEP_EDIT_RECALC;
 					}
-					else if(key->flag & PEK_SELECT) {
+					else if (key->flag & PEK_SELECT) {
 						key->flag &= ~PEK_SELECT;
 						point->flag |= PEP_EDIT_RECALC;
 					}
 				}
 			}
 		}
-		else if(pset->selectmode==SCE_SELECT_END) {
+		else if (pset->selectmode==SCE_SELECT_END) {
 			key= point->keys + point->totkey - 1;
 
 			copy_v3_v3(co, key->co);
 			mul_m4_v3(mat, co);
 			project_int(ar, co,vertco);
-			if((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1]) && key_test_depth(&data, co)) {
-				if(select && !(key->flag & PEK_SELECT)) {
+			if ((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1]) && key_test_depth(&data, co)) {
+				if (select && !(key->flag & PEK_SELECT)) {
 					key->flag |= PEK_SELECT;
 					point->flag |= PEP_EDIT_RECALC;
 				}
-				else if(key->flag & PEK_SELECT) {
+				else if (key->flag & PEK_SELECT) {
 					key->flag &= ~PEK_SELECT;
 					point->flag |= PEP_EDIT_RECALC;
 				}
@@ -1680,7 +1679,7 @@ static int hide_exec(bContext *C, wmOperator *op)
 	PTCacheEdit *edit= PE_get_current(scene, ob);
 	POINT_P; KEY_K;
 	
-	if(RNA_enum_get(op->ptr, "unselected")) {
+	if (RNA_enum_get(op->ptr, "unselected")) {
 		LOOP_UNSELECTED_POINTS {
 			point->flag |= PEP_HIDE;
 			point->flag |= PEP_EDIT_RECALC;
@@ -1708,15 +1707,15 @@ static int hide_exec(bContext *C, wmOperator *op)
 void PARTICLE_OT_hide(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Hide Selected";
-	ot->idname= "PARTICLE_OT_hide";
+	ot->name = "Hide Selected";
+	ot->idname = "PARTICLE_OT_hide";
 	
 	/* api callbacks */
-	ot->exec= hide_exec;
-	ot->poll= PE_poll;
+	ot->exec = hide_exec;
+	ot->poll = PE_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* props */
 	RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected");
@@ -1732,7 +1731,7 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
 	POINT_P; KEY_K;
 
 	LOOP_POINTS {
-		if(point->flag & PEP_HIDE) {
+		if (point->flag & PEP_HIDE) {
 			point->flag &= ~PEP_HIDE;
 			point->flag |= PEP_EDIT_RECALC;
 
@@ -1750,15 +1749,15 @@ static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
 void PARTICLE_OT_reveal(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Reveal";
-	ot->idname= "PARTICLE_OT_reveal";
+	ot->name = "Reveal";
+	ot->idname = "PARTICLE_OT_reveal";
 	
 	/* api callbacks */
-	ot->exec= reveal_exec;
-	ot->poll= PE_poll;
+	ot->exec = reveal_exec;
+	ot->poll = PE_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /************************ select less operator ************************/
@@ -1770,22 +1769,22 @@ static void select_less_keys(PEData *data, int point_index)
 	KEY_K;
 
 	LOOP_SELECTED_KEYS {
-		if(k==0) {
-			if(((key+1)->flag&PEK_SELECT)==0)
+		if (k==0) {
+			if (((key+1)->flag&PEK_SELECT)==0)
 				key->flag |= PEK_TAG;
 		}
-		else if(k==point->totkey-1) {
-			if(((key-1)->flag&PEK_SELECT)==0)
+		else if (k==point->totkey-1) {
+			if (((key-1)->flag&PEK_SELECT)==0)
 				key->flag |= PEK_TAG;
 		}
 		else {
-			if((((key-1)->flag & (key+1)->flag) & PEK_SELECT)==0)
+			if ((((key-1)->flag & (key+1)->flag) & PEK_SELECT)==0)
 				key->flag |= PEK_TAG;
 		}
 	}
 
 	LOOP_KEYS {
-		if(key->flag&PEK_TAG) {
+		if (key->flag&PEK_TAG) {
 			key->flag &= ~(PEK_TAG|PEK_SELECT);
 			point->flag |= PEP_EDIT_RECALC; /* redraw selection only */
 		}
@@ -1808,15 +1807,15 @@ static int select_less_exec(bContext *C, wmOperator *UNUSED(op))
 void PARTICLE_OT_select_less(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Less";
-	ot->idname= "PARTICLE_OT_select_less";
+	ot->name = "Select Less";
+	ot->idname = "PARTICLE_OT_select_less";
 	
 	/* api callbacks */
-	ot->exec= select_less_exec;
-	ot->poll= PE_poll;
+	ot->exec = select_less_exec;
+	ot->poll = PE_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /************************ select more operator ************************/
@@ -1828,24 +1827,24 @@ static void select_more_keys(PEData *data, int point_index)
 	KEY_K;
 
 	LOOP_KEYS {
-		if(key->flag & PEK_SELECT) continue;
+		if (key->flag & PEK_SELECT) continue;
 
-		if(k==0) {
-			if((key+1)->flag&PEK_SELECT)
+		if (k==0) {
+			if ((key+1)->flag&PEK_SELECT)
 				key->flag |= PEK_TAG;
 		}
-		else if(k==point->totkey-1) {
-			if((key-1)->flag&PEK_SELECT)
+		else if (k==point->totkey-1) {
+			if ((key-1)->flag&PEK_SELECT)
 				key->flag |= PEK_TAG;
 		}
 		else {
-			if(((key-1)->flag | (key+1)->flag) & PEK_SELECT)
+			if (((key-1)->flag | (key+1)->flag) & PEK_SELECT)
 				key->flag |= PEK_TAG;
 		}
 	}
 
 	LOOP_KEYS {
-		if(key->flag&PEK_TAG) {
+		if (key->flag&PEK_TAG) {
 			key->flag &= ~PEK_TAG;
 			key->flag |= PEK_SELECT;
 			point->flag |= PEP_EDIT_RECALC; /* redraw selection only */
@@ -1869,15 +1868,15 @@ static int select_more_exec(bContext *C, wmOperator *UNUSED(op))
 void PARTICLE_OT_select_more(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select More";
-	ot->idname= "PARTICLE_OT_select_more";
+	ot->name = "Select More";
+	ot->idname = "PARTICLE_OT_select_more";
 	
 	/* api callbacks */
-	ot->exec= select_more_exec;
-	ot->poll= PE_poll;
+	ot->exec = select_more_exec;
+	ot->poll = PE_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /************************ rekey operator ************************/
@@ -1913,7 +1912,7 @@ static void rekey_particle(PEData *data, int pa_index)
 	dval= (end - sta) / (float)(data->totrekey - 1);
 
 	/* interpolate new keys from old ones */
-	for(k=1,key++; k<data->totrekey-1; k++,key++) {
+	for (k=1,key++; k<data->totrekey-1; k++,key++) {
 		state.time= (float)k / (float)(data->totrekey-1);
 		psys_get_particle_on_path(&sim, pa_index, &state, 0);
 		copy_v3_v3(key->co, state.co);
@@ -1921,22 +1920,22 @@ static void rekey_particle(PEData *data, int pa_index)
 	}
 
 	/* replace keys */
-	if(pa->hair)
+	if (pa->hair)
 		MEM_freeN(pa->hair);
 	pa->hair= new_keys;
 
 	point->totkey=pa->totkey=data->totrekey;
 
 
-	if(point->keys)
+	if (point->keys)
 		MEM_freeN(point->keys);
 	ekey= point->keys= MEM_callocN(pa->totkey * sizeof(PTCacheEditKey),"Hair re-key edit keys");
 		
-	for(k=0, key=pa->hair; k<pa->totkey; k++, key++, ekey++) {
+	for (k=0, key=pa->hair; k<pa->totkey; k++, key++, ekey++) {
 		ekey->co= key->co;
 		ekey->time= &key->time;
 		ekey->flag |= PEK_SELECT;
-		if(!(psys->flag & PSYS_GLOBAL_HAIR))
+		if (!(psys->flag & PSYS_GLOBAL_HAIR))
 			ekey->flag |= PEK_USE_WCO;
 	}
 
@@ -1965,16 +1964,16 @@ static int rekey_exec(bContext *C, wmOperator *op)
 void PARTICLE_OT_rekey(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Rekey";
-	ot->idname= "PARTICLE_OT_rekey";
+	ot->name = "Rekey";
+	ot->idname = "PARTICLE_OT_rekey";
 	
 	/* api callbacks */
-	ot->exec= rekey_exec;
-	ot->invoke= WM_operator_props_popup;
-	ot->poll= PE_poll;
+	ot->exec = rekey_exec;
+	ot->invoke = WM_operator_props_popup;
+	ot->poll = PE_hair_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_int(ot->srna, "keys", 2, 2, INT_MAX, "Number of Keys", "", 2, 100);
@@ -1991,7 +1990,7 @@ static void rekey_particle_to_time(Scene *scene, Object *ob, int pa_index, float
 	PTCacheEditKey *ekey;
 	int k;
 
-	if(!edit || !edit->psys) return;
+	if (!edit || !edit->psys) return;
 
 	psys = edit->psys;
 
@@ -2006,19 +2005,19 @@ static void rekey_particle_to_time(Scene *scene, Object *ob, int pa_index, float
 	key= new_keys= MEM_dupallocN(pa->hair);
 	
 	/* interpolate new keys from old ones (roots stay the same) */
-	for(k=1, key++; k < pa->totkey; k++, key++) {
+	for (k=1, key++; k < pa->totkey; k++, key++) {
 		state.time= path_time * (float)k / (float)(pa->totkey-1);
 		psys_get_particle_on_path(&sim, pa_index, &state, 0);
 		copy_v3_v3(key->co, state.co);
 	}
 
 	/* replace hair keys */
-	if(pa->hair)
+	if (pa->hair)
 		MEM_freeN(pa->hair);
 	pa->hair= new_keys;
 
 	/* update edit pointers */
-	for(k=0, key=pa->hair, ekey=edit->points[pa_index].keys; k<pa->totkey; k++, key++, ekey++) {
+	for (k=0, key=pa->hair, ekey=edit->points[pa_index].keys; k<pa->totkey; k++, key++, ekey++) {
 		ekey->co= key->co;
 		ekey->time= &key->time;
 	}
@@ -2037,7 +2036,7 @@ static int remove_tagged_particles(Object *ob, ParticleSystem *psys, int mirror)
 	ParticleSystemModifierData *psmd;
 	int i, new_totpart= psys->totpart, removed= 0;
 
-	if(mirror) {
+	if (mirror) {
 		/* mirror tags */
 		psmd= psys_get_modifier(ob, psys);
 
@@ -2051,16 +2050,16 @@ static int remove_tagged_particles(Object *ob, ParticleSystem *psys, int mirror)
 		removed++;
 	}
 
-	if(new_totpart != psys->totpart) {
-		if(new_totpart) {
+	if (new_totpart != psys->totpart) {
+		if (new_totpart) {
 			npa= new_pars= MEM_callocN(new_totpart * sizeof(ParticleData), "ParticleData array");
 			npoint= new_points= MEM_callocN(new_totpart * sizeof(PTCacheEditPoint), "PTCacheEditKey array");
 
-			if(ELEM(NULL, new_pars, new_points)) {
+			if (ELEM(NULL, new_pars, new_points)) {
 				 /* allocation error! */
-				if(new_pars)
+				if (new_pars)
 					MEM_freeN(new_pars);
-				if(new_points)
+				if (new_points)
 					MEM_freeN(new_points);
 				return 0;
 			}
@@ -2068,11 +2067,11 @@ static int remove_tagged_particles(Object *ob, ParticleSystem *psys, int mirror)
 
 		pa= psys->particles;
 		point= edit->points;
-		for(i=0; i<psys->totpart; i++, pa++, point++) {
-			if(point->flag & PEP_TAG) {
-				if(point->keys)
+		for (i=0; i<psys->totpart; i++, pa++, point++) {
+			if (point->flag & PEP_TAG) {
+				if (point->keys)
 					MEM_freeN(point->keys);
-				if(pa->hair)
+				if (pa->hair)
 					MEM_freeN(pa->hair);
 			}
 			else {
@@ -2083,18 +2082,18 @@ static int remove_tagged_particles(Object *ob, ParticleSystem *psys, int mirror)
 			}
 		}
 
-		if(psys->particles) MEM_freeN(psys->particles);
+		if (psys->particles) MEM_freeN(psys->particles);
 		psys->particles= new_pars;
 
-		if(edit->points) MEM_freeN(edit->points);
+		if (edit->points) MEM_freeN(edit->points);
 		edit->points= new_points;
 
-		if(edit->mirror_cache) {
+		if (edit->mirror_cache) {
 			MEM_freeN(edit->mirror_cache);
 			edit->mirror_cache= NULL;
 		}
 
-		if(psys->child) {
+		if (psys->child) {
 			MEM_freeN(psys->child);
 			psys->child= NULL;
 			psys->totchild=0;
@@ -2116,7 +2115,7 @@ static void remove_tagged_keys(Object *ob, ParticleSystem *psys)
 	ParticleSystemModifierData *psmd;
 	short new_totkey;
 
-	if(pe_x_mirror(ob)) {
+	if (pe_x_mirror(ob)) {
 		/* mirror key tags */
 		psmd= psys_get_modifier(ob, psys);
 
@@ -2134,7 +2133,7 @@ static void remove_tagged_keys(Object *ob, ParticleSystem *psys)
 			new_totkey--;
 		}
 		/* we can't have elements with less than two keys*/
-		if(new_totkey < 2)
+		if (new_totkey < 2)
 			point->flag |= PEP_TAG;
 	}
 	remove_tagged_particles(ob, psys, pe_x_mirror(ob));
@@ -2147,18 +2146,18 @@ static void remove_tagged_keys(Object *ob, ParticleSystem *psys)
 			new_totkey--;
 		}
 
-		if(new_totkey != pa->totkey) {
+		if (new_totkey != pa->totkey) {
 			nhkey= new_hkeys= MEM_callocN(new_totkey*sizeof(HairKey), "HairKeys");
 			nkey= new_keys= MEM_callocN(new_totkey*sizeof(PTCacheEditKey), "particle edit keys");
 
 			hkey= pa->hair;
 			LOOP_KEYS {
-				while(key->flag & PEK_TAG && hkey < pa->hair + pa->totkey) {
+				while (key->flag & PEK_TAG && hkey < pa->hair + pa->totkey) {
 					key++;
 					hkey++;
 				}
 
-				if(hkey < pa->hair + pa->totkey) {
+				if (hkey < pa->hair + pa->totkey) {
 					copy_v3_v3(nhkey->co, hkey->co);
 					nhkey->editflag = hkey->editflag;
 					nhkey->time= hkey->time;
@@ -2177,10 +2176,10 @@ static void remove_tagged_keys(Object *ob, ParticleSystem *psys)
 				hkey++;
 			}
 
-			if(pa->hair)
+			if (pa->hair)
 				MEM_freeN(pa->hair);
 
-			if(point->keys)
+			if (point->keys)
 				MEM_freeN(point->keys);
 			
 			pa->hair= new_hkeys;
@@ -2196,7 +2195,7 @@ static void remove_tagged_keys(Object *ob, ParticleSystem *psys)
 
 /************************ subdivide opertor *********************/
 
-/* works like normal edit mode subdivide, inserts keys between neighbouring selected keys */
+/* works like normal edit mode subdivide, inserts keys between neighboring selected keys */
 static void subdivide_particle(PEData *data, int pa_index)
 {
 	PTCacheEdit *edit= data->edit;
@@ -2216,12 +2215,12 @@ static void subdivide_particle(PEData *data, int pa_index)
 	sim.ob= data->ob;
 	sim.psys= edit->psys;
 
-	for(k=0, ekey=point->keys; k<pa->totkey-1; k++,ekey++) {
-		if(ekey->flag&PEK_SELECT && (ekey+1)->flag&PEK_SELECT)
+	for (k=0, ekey=point->keys; k<pa->totkey-1; k++,ekey++) {
+		if (ekey->flag&PEK_SELECT && (ekey+1)->flag&PEK_SELECT)
 			totnewkey++;
 	}
 
-	if(totnewkey==0) return;
+	if (totnewkey==0) return;
 
 	pa->flag |= PARS_REKEY;
 
@@ -2231,7 +2230,7 @@ static void subdivide_particle(PEData *data, int pa_index)
 	key = pa->hair;
 	endtime= key[pa->totkey-1].time;
 
-	for(k=0, ekey=point->keys; k<pa->totkey-1; k++, key++, ekey++) {
+	for (k=0, ekey=point->keys; k<pa->totkey-1; k++, key++, ekey++) {
 
 		memcpy(nkey,key,sizeof(HairKey));
 		memcpy(nekey,ekey,sizeof(PTCacheEditKey));
@@ -2242,7 +2241,7 @@ static void subdivide_particle(PEData *data, int pa_index)
 		nkey++;
 		nekey++;
 
-		if(ekey->flag & PEK_SELECT && (ekey+1)->flag & PEK_SELECT) {
+		if (ekey->flag & PEK_SELECT && (ekey+1)->flag & PEK_SELECT) {
 			nkey->time= (key->time + (key+1)->time)*0.5f;
 			state.time= (endtime != 0.0f)? nkey->time/endtime: 0.0f;
 			psys_get_particle_on_path(&sim, pa_index, &state, 0);
@@ -2251,7 +2250,7 @@ static void subdivide_particle(PEData *data, int pa_index)
 			nekey->co= nkey->co;
 			nekey->time= &nkey->time;
 			nekey->flag |= PEK_SELECT;
-			if(!(psys->flag & PSYS_GLOBAL_HAIR))
+			if (!(psys->flag & PSYS_GLOBAL_HAIR))
 				nekey->flag |= PEK_USE_WCO;
 
 			nekey++;
@@ -2265,11 +2264,11 @@ static void subdivide_particle(PEData *data, int pa_index)
 	nekey->co= nkey->co;
 	nekey->time= &nkey->time;
 
-	if(pa->hair)
+	if (pa->hair)
 		MEM_freeN(pa->hair);
 	pa->hair= new_keys;
 
-	if(point->keys)
+	if (point->keys)
 		MEM_freeN(point->keys);
 	point->keys= new_ekeys;
 
@@ -2295,15 +2294,15 @@ static int subdivide_exec(bContext *C, wmOperator *UNUSED(op))
 void PARTICLE_OT_subdivide(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Subdivide";
-	ot->idname= "PARTICLE_OT_subdivide";
+	ot->name = "Subdivide";
+	ot->idname = "PARTICLE_OT_subdivide";
 	
 	/* api callbacks */
-	ot->exec= subdivide_exec;
-	ot->poll= PE_poll;
+	ot->exec = subdivide_exec;
+	ot->poll = PE_hair_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /************************ remove doubles opertor *********************/
@@ -2321,7 +2320,7 @@ static int remove_doubles_exec(bContext *C, wmOperator *op)
 	float mat[4][4], co[3], threshold= RNA_float_get(op->ptr, "threshold");
 	int n, totn, removed, totremoved;
 
-	if(psys->flag & PSYS_GLOBAL_HAIR)
+	if (psys->flag & PSYS_GLOBAL_HAIR)
 		return OPERATOR_CANCELLED;
 
 	edit= psys->edit;
@@ -2351,10 +2350,10 @@ static int remove_doubles_exec(bContext *C, wmOperator *op)
 
 			totn= BLI_kdtree_find_n_nearest(tree,10,co,NULL,nearest);
 
-			for(n=0; n<totn; n++) {
+			for (n=0; n<totn; n++) {
 				/* this needs a custom threshold still */
-				if(nearest[n].index > p && nearest[n].dist < threshold) {
-					if(!(point->flag & PEP_TAG)) {
+				if (nearest[n].index > p && nearest[n].dist < threshold) {
+					if (!(point->flag & PEP_TAG)) {
 						point->flag |= PEP_TAG;
 						removed++;
 					}
@@ -2367,9 +2366,9 @@ static int remove_doubles_exec(bContext *C, wmOperator *op)
 		/* remove tagged particles - don't do mirror here! */
 		remove_tagged_particles(ob, psys, 0);
 		totremoved += removed;
-	} while(removed);
+	} while (removed);
 
-	if(totremoved == 0)
+	if (totremoved == 0)
 		return OPERATOR_CANCELLED;
 
 	BKE_reportf(op->reports, RPT_INFO, "Remove %d double particles", totremoved);
@@ -2383,15 +2382,15 @@ static int remove_doubles_exec(bContext *C, wmOperator *op)
 void PARTICLE_OT_remove_doubles(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove Doubles";
-	ot->idname= "PARTICLE_OT_remove_doubles";
+	ot->name = "Remove Doubles";
+	ot->idname = "PARTICLE_OT_remove_doubles";
 	
 	/* api callbacks */
-	ot->exec= remove_doubles_exec;
-	ot->poll= PE_poll;
+	ot->exec = remove_doubles_exec;
+	ot->poll = PE_hair_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	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);
@@ -2433,15 +2432,15 @@ static int weight_set_exec(bContext *C, wmOperator *op)
 void PARTICLE_OT_weight_set(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Weight Set";
-	ot->idname= "PARTICLE_OT_weight_set";
+	ot->name = "Weight Set";
+	ot->idname = "PARTICLE_OT_weight_set";
 
 	/* api callbacks */
-	ot->exec= weight_set_exec;
-	ot->poll= PE_poll;
+	ot->exec = weight_set_exec;
+	ot->poll = PE_hair_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	RNA_def_float(ot->srna, "factor", 1, 0, 1, "Factor", "", 0, 1);
 }
@@ -2453,12 +2452,12 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)
 	ParticleEditSettings *pset= PE_settings(CTX_data_scene(C));
 	ParticleBrushData *brush;
 
-	if(pset->brushtype < 0)
+	if (pset->brushtype < 0)
 		return;
 
 	brush= &pset->brush[pset->brushtype];
 
-	if(brush) {
+	if (brush) {
 		glPushMatrix();
 
 		glTranslatef((float)x, (float)y, 0.0f);
@@ -2478,11 +2477,11 @@ static void toggle_particle_cursor(bContext *C, int enable)
 {
 	ParticleEditSettings *pset= PE_settings(CTX_data_scene(C));
 
-	if(pset->paintcursor && !enable) {
+	if (pset->paintcursor && !enable) {
 		WM_paint_cursor_end(CTX_wm_manager(C), pset->paintcursor);
 		pset->paintcursor = NULL;
 	}
-	else if(enable)
+	else if (enable)
 		pset->paintcursor= WM_paint_cursor_activate(CTX_wm_manager(C), PE_poll_view3d, brush_drawcursor, NULL);
 }
 
@@ -2516,12 +2515,12 @@ static int delete_exec(bContext *C, wmOperator *op)
 
 	PE_set_data(C, &data);
 
-	if(type == DEL_KEY) {
+	if (type == DEL_KEY) {
 		foreach_selected_key(&data, set_delete_particle_key);
 		remove_tagged_keys(data.ob, data.edit->psys);
 		recalc_lengths(data.edit);
 	}
-	else if(type == DEL_PARTICLE) {
+	else if (type == DEL_PARTICLE) {
 		foreach_selected_point(&data, set_delete_particle);
 		remove_tagged_particles(data.ob, data.edit->psys, pe_x_mirror(data.ob));
 		recalc_lengths(data.edit);
@@ -2536,19 +2535,19 @@ static int delete_exec(bContext *C, wmOperator *op)
 void PARTICLE_OT_delete(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete";
-	ot->idname= "PARTICLE_OT_delete";
+	ot->name = "Delete";
+	ot->idname = "PARTICLE_OT_delete";
 	
 	/* api callbacks */
-	ot->exec= delete_exec;
-	ot->invoke= WM_menu_invoke;
-	ot->poll= PE_hair_poll;
+	ot->exec = delete_exec;
+	ot->invoke = WM_menu_invoke;
+	ot->poll = PE_hair_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
-	ot->prop= RNA_def_enum(ot->srna, "type", delete_type_items, DEL_PARTICLE, "Type", "Delete a full particle or only keys");
+	ot->prop = RNA_def_enum(ot->srna, "type", delete_type_items, DEL_PARTICLE, "Type", "Delete a full particle or only keys");
 }
 
 /*************************** mirror operator **************************/
@@ -2563,28 +2562,31 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
 	PTCacheEditPoint *newpoint, *new_points;
 	POINT_P; KEY_K;
 	HairKey *hkey;
-	int *mirrorfaces;
+	int *mirrorfaces = NULL;
 	int rotation, totpart, newtotpart;
 
-	if(psys->flag & PSYS_GLOBAL_HAIR)
+	if (psys->flag & PSYS_GLOBAL_HAIR)
 		return;
 
 	psmd= psys_get_modifier(ob, psys);
-	if(!psmd->dm)
+	if (!psmd->dm)
 		return;
 
+	/* NOTE: this is not nice to use tessfaces but hard to avoid since pa->num uses tessfaces */
+	BKE_mesh_tessface_ensure(me);
+
 	mirrorfaces= mesh_get_x_mirror_faces(ob, NULL);
 
-	if(!edit->mirror_cache)
+	if (!edit->mirror_cache)
 		PE_update_mirror_cache(ob, psys);
 
 	totpart= psys->totpart;
 	newtotpart= psys->totpart;
 	LOOP_VISIBLE_POINTS {
 		pa = psys->particles + p;
-		if(!tagged) {
-			if(point_is_selected(point)) {
-				if(edit->mirror_cache[p] != -1) {
+		if (!tagged) {
+			if (point_is_selected(point)) {
+				if (edit->mirror_cache[p] != -1) {
 					/* already has a mirror, don't need to duplicate */
 					PE_mirror_particle(ob, psmd->dm, psys, pa, NULL);
 					continue;
@@ -2594,28 +2596,28 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
 			}
 		}
 
-		if((point->flag & PEP_TAG) && mirrorfaces[pa->num*2] != -1)
+		if ((point->flag & PEP_TAG) && mirrorfaces[pa->num*2] != -1)
 			newtotpart++;
 	}
 
-	if(newtotpart != psys->totpart) {
+	if (newtotpart != psys->totpart) {
 		/* allocate new arrays and copy existing */
 		new_pars= MEM_callocN(newtotpart*sizeof(ParticleData), "ParticleData new");
 		new_points= MEM_callocN(newtotpart*sizeof(PTCacheEditPoint), "PTCacheEditPoint new");
 
-		if(psys->particles) {
+		if (psys->particles) {
 			memcpy(new_pars, psys->particles, totpart*sizeof(ParticleData));
 			MEM_freeN(psys->particles);
 		}
 		psys->particles= new_pars;
 
-		if(edit->points) {
+		if (edit->points) {
 			memcpy(new_points, edit->points, totpart*sizeof(PTCacheEditPoint));
 			MEM_freeN(edit->points);
 		}
 		edit->points= new_points;
 
-		if(edit->mirror_cache) {
+		if (edit->mirror_cache) {
 			MEM_freeN(edit->mirror_cache);
 			edit->mirror_cache= NULL;
 		}
@@ -2626,19 +2628,19 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
 		newpa= psys->particles + totpart;
 		newpoint= edit->points + totpart;
 
-		for(p=0, point=edit->points; p<totpart; p++, point++) {
+		for (p=0, point=edit->points; p<totpart; p++, point++) {
 			pa = psys->particles + p;
 
-			if(point->flag & PEP_HIDE)
+			if (point->flag & PEP_HIDE)
 				continue;
-			if(!(point->flag & PEP_TAG) || mirrorfaces[pa->num*2] == -1)
+			if (!(point->flag & PEP_TAG) || mirrorfaces[pa->num*2] == -1)
 				continue;
 
 			/* duplicate */
 			*newpa= *pa;
 			*newpoint= *point;
-			if(pa->hair) newpa->hair= MEM_dupallocN(pa->hair);
-			if(point->keys) newpoint->keys= MEM_dupallocN(point->keys);
+			if (pa->hair) newpa->hair= MEM_dupallocN(pa->hair);
+			if (point->keys) newpoint->keys= MEM_dupallocN(point->keys);
 
 			/* rotate weights according to vertex index rotation */
 			rotation= mirrorfaces[pa->num*2+1];
@@ -2646,11 +2648,13 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
 			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])
-				else
-					SHIFT3(float, newpa->fuv[0], newpa->fuv[1], newpa->fuv[2])
+			while (rotation-- > 0)
+				if (me->mface[pa->num].v4) {
+					SHIFT4(float, newpa->fuv[0], newpa->fuv[1], newpa->fuv[2], newpa->fuv[3]);
+				}
+				else {
+					SHIFT3(float, newpa->fuv[0], newpa->fuv[1], newpa->fuv[2]);
+				}
 
 			/* assign face inddex */
 			newpa->num= mirrorfaces[pa->num*2];
@@ -2658,7 +2662,7 @@ static void PE_mirror_x(Scene *scene, Object *ob, int tagged)
 
 			/* update edit key pointers */
 			key= newpoint->keys;
-			for(k=0, hkey=newpa->hair; k<newpa->totkey; k++, hkey++, key++) {
+			for (k=0, hkey=newpa->hair; k<newpa->totkey; k++, hkey++, key++) {
 				key->co= hkey->co;
 				key->time= &hkey->time;
 			}
@@ -2696,15 +2700,15 @@ static int mirror_exec(bContext *C, wmOperator *UNUSED(op))
 void PARTICLE_OT_mirror(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Mirror";
-	ot->idname= "PARTICLE_OT_mirror";
+	ot->name = "Mirror";
+	ot->idname = "PARTICLE_OT_mirror";
 	
 	/* api callbacks */
-	ot->exec= mirror_exec;
-	ot->poll= PE_poll;
+	ot->exec = mirror_exec;
+	ot->poll = PE_hair_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /************************* brush edit callbacks ********************/
@@ -2714,7 +2718,7 @@ static void brush_comb(PEData *data, float UNUSED(mat[][4]), float imat[][4], in
 	ParticleEditSettings *pset= PE_settings(data->scene);
 	float cvec[3], fac;
 
-	if(pset->flag & PE_LOCK_FIRST && key_index == 0) return;
+	if (pset->flag & PE_LOCK_FIRST && key_index == 0) return;
 
 	fac= (float)pow((double)(1.0f - data->dist / data->rad), (double)data->combfac);
 
@@ -2739,10 +2743,10 @@ static void brush_cut(PEData *data, int pa_index)
 	int vertco[2];
 
 	/* blunt scissors */
-	if(BLI_frand() > data->cutfac) return;
+	if (BLI_frand() > data->cutfac) return;
 
 	/* don't cut hidden */
-	if(edit->points[pa_index].flag & PEP_HIDE)
+	if (edit->points[pa_index].flag & PEP_HIDE)
 		return;
 
 	rad2= data->rad * data->rad;
@@ -2760,16 +2764,16 @@ static void brush_cut(PEData *data, int pa_index)
 	xo1= x1 - o1;
 
 	/* check if root is inside circle */
-	if(xo0*xo0 + xo1*xo1 < rad2 && key_test_depth(data, key->co)) {
+	if (xo0*xo0 + xo1*xo1 < rad2 && key_test_depth(data, key->co)) {
 		cut_time= -1.0f;
 		cut= 1;
 	}
 	else {
 		/* calculate path time closest to root that was inside the circle */
-		for(k=1, key++; k<=keys; k++, key++) {
+		for (k=1, key++; k<=keys; k++, key++) {
 			project_int_noclip(ar, key->co, vertco);
 
-			if(key_test_depth(data, key->co) == 0) {
+			if (key_test_depth(data, key->co) == 0) {
 				x0= (float)vertco[0];
 				x1= (float)vertco[1];
 
@@ -2787,15 +2791,15 @@ static void brush_cut(PEData *data, int pa_index)
 			
 			d= dv * rad2 - d*d;
 
-			if(d > 0.0f) {
+			if (d > 0.0f) {
 				d= sqrt(d);
 
 				cut_time= -(v0*xo0 + v1*xo1 + d);
 
-				if(cut_time > 0.0f) {
+				if (cut_time > 0.0f) {
 					cut_time /= dv;
 
-					if(cut_time < 1.0f) {
+					if (cut_time < 1.0f) {
 						cut_time += (float)(k-1);
 						cut_time /= (float)keys;
 						cut= 1;
@@ -2812,8 +2816,8 @@ static void brush_cut(PEData *data, int pa_index)
 		}
 	}
 
-	if(cut) {
-		if(cut_time < 0.0f) {
+	if (cut) {
+		if (cut_time < 0.0f) {
 			edit->points[pa_index].flag |= PEP_TAG;
 		}
 		else {
@@ -2831,7 +2835,7 @@ static void brush_length(PEData *data, int point_index)
 	float dvec[3],pvec[3] = {0.0f, 0.0f, 0.0f};
 
 	LOOP_KEYS {
-		if(k==0) {
+		if (k==0) {
 			copy_v3_v3(pvec,key->co);
 		}
 		else {
@@ -2863,7 +2867,7 @@ static void brush_puff(PEData *data, int point_index)
 		puff_volume = brush->flag & PE_BRUSH_DATA_PUFF_VOLUME;
 	}
 
-	if(psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
+	if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
 		psys_mat_hair_to_global(data->ob, data->dm, psys->part->from, psys->particles + point_index, mat);
 		invert_m4_m4(imat,mat);
 	}
@@ -2873,14 +2877,14 @@ static void brush_puff(PEData *data, int point_index)
 	}
 
 	LOOP_KEYS {
-		if(k==0) {
+		if (k==0) {
 			/* find root coordinate and normal on emitter */
 			copy_v3_v3(co, key->co);
 			mul_m4_v3(mat, co);
 			mul_v3_m4v3(kco, data->ob->imat, co); /* use 'kco' as the object space version of worldspace 'co', ob->imat is set before calling */
 
 			point_index= BLI_kdtree_find_nearest(edit->emitter_field, kco, NULL, NULL);
-			if(point_index == -1) return;
+			if (point_index == -1) return;
 
 			copy_v3_v3(rootco, co);
 			copy_v3_v3(nor, &edit->emitter_cosnos[point_index*6+3]);
@@ -2891,7 +2895,7 @@ static void brush_puff(PEData *data, int point_index)
 
 			fac= (float)pow((double)(1.0f - data->dist / data->rad), (double)data->pufffac);
 			fac *= 0.025f;
-			if(data->invert)
+			if (data->invert)
 				fac= -fac;
 		}
 		else {
@@ -2901,7 +2905,7 @@ static void brush_puff(PEData *data, int point_index)
 			copy_v3_v3(co, key->co);
 			mul_m4_v3(mat, co);
 			length += len_v3v3(lastco, co);
-			if((data->select==0 || (key->flag & PEK_SELECT)) && !(key->flag & PEK_HIDE)) {
+			if ((data->select==0 || (key->flag & PEK_SELECT)) && !(key->flag & PEK_HIDE)) {
 				madd_v3_v3v3fl(kco, rootco, nor, length);
 
 				/* blend between the current and straight position */
@@ -2913,7 +2917,7 @@ static void brush_puff(PEData *data, int point_index)
 
 				mul_v3_m4v3(key->co, imat, co);
 
-				if(puff_volume) {
+				if (puff_volume) {
 					/* accumulate the total distance moved to apply to unselected
 					 * keys that come after */
 					ofs[0] += key->co[0] - dco[0];
@@ -2924,13 +2928,13 @@ static void brush_puff(PEData *data, int point_index)
 			}
 			else {
 
-				if(puff_volume) {
+				if (puff_volume) {
 #if 0
 					/* this is simple but looks bad, adds annoying kinks */
 					add_v3_v3(key->co, ofs);
 #else
 					/* translate (not rotate) the rest of the hair if its not selected  */
-					if(ofs[0] || ofs[1] || ofs[2]) {
+					if (ofs[0] || ofs[1] || ofs[2]) {
 #if 0					/* kindof works but looks worse then whats below */
 
 						/* Move the unselected point on a vector based on the
@@ -2955,7 +2959,7 @@ static void brush_puff(PEData *data, int point_index)
 						mul_v3_m4v3(kco, data->ob->imat, oco); /* use 'kco' as the object space version of worldspace 'co', ob->imat is set before calling */
 
 						point_index= BLI_kdtree_find_nearest(edit->emitter_field, kco, NULL, NULL);
-						if(point_index != -1) {
+						if (point_index != -1) {
 							copy_v3_v3(onor, &edit->emitter_cosnos[point_index*6+3]);
 							mul_mat3_m4_v3(data->ob->obmat, onor); /* normal into worldspace */
 							mul_mat3_m4_v3(imat, onor); /* worldspace into particle space */
@@ -2973,7 +2977,7 @@ static void brush_puff(PEData *data, int point_index)
 		}
 	}
 
-	if(change)
+	if (change)
 		point->flag |= PEP_EDIT_RECALC;
 }
 
@@ -2981,7 +2985,7 @@ static void brush_puff(PEData *data, int point_index)
 static void brush_weight(PEData *data, float UNUSED(mat[][4]), float UNUSED(imat[][4]), int point_index, int key_index, PTCacheEditKey *UNUSED(key))
 {
 	/* roots have full weight allways */
-	if(key_index) {
+	if (key_index) {
 		PTCacheEdit *edit = data->edit;
 		ParticleSystem *psys = edit->psys;
 
@@ -2994,7 +2998,7 @@ static void brush_weight(PEData *data, float UNUSED(mat[][4]), float UNUSED(imat
 
 static void brush_smooth_get(PEData *data, float mat[][4], float UNUSED(imat[][4]), int UNUSED(point_index), int key_index, PTCacheEditKey *key)
 {	
-	if(key_index) {
+	if (key_index) {
 		float dvec[3];
 
 		sub_v3_v3v3(dvec,key->co,(key-1)->co);
@@ -3008,7 +3012,7 @@ static void brush_smooth_do(PEData *data, float UNUSED(mat[][4]), float imat[][4
 {
 	float vec[3], dvec[3];
 	
-	if(key_index) {
+	if (key_index) {
 		copy_v3_v3(vec, data->vec);
 		mul_mat3_m4_v3(imat,vec);
 
@@ -3054,81 +3058,83 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm,
 	float cur_d, cur_uv[2], v1[3], v2[3], v3[3], v4[3], min[3], max[3], p_min[3],p_max[3];
 	float cur_ipoint[3];
 	
-	if(dm == NULL){
+	if (dm == NULL) {
 		psys_disable_all(ob);
 
 		dm=mesh_get_derived_final(scene, ob, 0);
-		if(dm == NULL)
+		if (dm == NULL)
 			dm=mesh_get_derived_deform(scene, ob, 0);
 
 		psys_enable_all(ob);
 
-		if(dm == NULL)
+		if (dm == NULL)
 			return 0;
 	}
 
+	/* BMESH_ONLY, deform dm may not have tessface */
+	DM_ensure_tessface(dm);
 	
 
-	if(pa_minmax==0){
+	if (pa_minmax==0) {
 		INIT_MINMAX(p_min,p_max);
 		DO_MINMAX(co1,p_min,p_max);
 		DO_MINMAX(co2,p_min,p_max);
 	}
-	else{
+	else {
 		copy_v3_v3(p_min,pa_minmax);
 		copy_v3_v3(p_max,pa_minmax+3);
 	}
 
-	totface=dm->getNumFaces(dm);
-	mface=dm->getFaceDataArray(dm,CD_MFACE);
+	totface=dm->getNumTessFaces(dm);
+	mface=dm->getTessFaceDataArray(dm,CD_MFACE);
 	mvert=dm->getVertDataArray(dm,CD_MVERT);
 	
 	/* lets intersect the faces */
-	for(i=0; i<totface; i++,mface++){
-		if(vert_cos){
+	for (i=0; i<totface; i++,mface++) {
+		if (vert_cos) {
 			copy_v3_v3(v1,vert_cos+3*mface->v1);
 			copy_v3_v3(v2,vert_cos+3*mface->v2);
 			copy_v3_v3(v3,vert_cos+3*mface->v3);
-			if(mface->v4)
+			if (mface->v4)
 				copy_v3_v3(v4,vert_cos+3*mface->v4);
 		}
-		else{
+		else {
 			copy_v3_v3(v1,mvert[mface->v1].co);
 			copy_v3_v3(v2,mvert[mface->v2].co);
 			copy_v3_v3(v3,mvert[mface->v3].co);
-			if(mface->v4)
+			if (mface->v4)
 				copy_v3_v3(v4,mvert[mface->v4].co);
 		}
 
-		if(face_minmax==0){
+		if (face_minmax==0) {
 			INIT_MINMAX(min,max);
 			DO_MINMAX(v1,min,max);
 			DO_MINMAX(v2,min,max);
 			DO_MINMAX(v3,min,max);
-			if(mface->v4)
-				DO_MINMAX(v4,min,max)
-			if(isect_aabb_aabb_v3(min,max,p_min,p_max)==0)
+			if (mface->v4)
+				DO_MINMAX(v4, min, max);
+			if (isect_aabb_aabb_v3(min,max,p_min,p_max)==0)
 				continue;
 		}
-		else{
+		else {
 			copy_v3_v3(min, face_minmax+6*i);
 			copy_v3_v3(max, face_minmax+6*i+3);
-			if(isect_aabb_aabb_v3(min,max,p_min,p_max)==0)
+			if (isect_aabb_aabb_v3(min,max,p_min,p_max)==0)
 				continue;
 		}
 
-		if(radius>0.0f){
-			if(isect_sweeping_sphere_tri_v3(co1, co2, radius, v2, v3, v1, &cur_d, cur_ipoint)){
-				if(cur_d<*min_d){
+		if (radius>0.0f) {
+			if (isect_sweeping_sphere_tri_v3(co1, co2, radius, v2, v3, v1, &cur_d, cur_ipoint)) {
+				if (cur_d<*min_d) {
 					*min_d=cur_d;
 					copy_v3_v3(ipoint,cur_ipoint);
 					*min_face=i;
 					intersect=1;
 				}
 			}
-			if(mface->v4){
-				if(isect_sweeping_sphere_tri_v3(co1, co2, radius, v4, v1, v3, &cur_d, cur_ipoint)){
-					if(cur_d<*min_d){
+			if (mface->v4) {
+				if (isect_sweeping_sphere_tri_v3(co1, co2, radius, v4, v1, v3, &cur_d, cur_ipoint)) {
+					if (cur_d<*min_d) {
 						*min_d=cur_d;
 						copy_v3_v3(ipoint,cur_ipoint);
 						*min_face=i;
@@ -3137,23 +3143,23 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm,
 				}
 			}
 		}
-		else{
-			if(isect_line_tri_v3(co1, co2, v1, v2, v3, &cur_d, cur_uv)){
-				if(cur_d<*min_d){
+		else {
+			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;
-					if(mface->v4)
+					if (mface->v4)
 						intersect_dm_quad_weights(v1, v2, v3, v4, min_w);
 					*min_face=i;
 					intersect=1;
 				}
 			}
-			if(mface->v4){
-				if(isect_line_tri_v3(co1, co2, v1, v3, v4, &cur_d, cur_uv)){
-					if(cur_d<*min_d){
+			if (mface->v4) {
+				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;
@@ -3190,7 +3196,7 @@ static int brush_add(PEData *data, short number)
 	DerivedMesh *dm=0;
 	invert_m4_m4(imat,ob->obmat);
 
-	if(psys->flag & PSYS_GLOBAL_HAIR)
+	if (psys->flag & PSYS_GLOBAL_HAIR)
 		return 0;
 
 	BLI_srandom(psys->seed+data->mval[0]+data->mval[1]);
@@ -3203,15 +3209,15 @@ static int brush_add(PEData *data, short number)
 	timestep= psys_get_timestep(&sim);
 
 	/* painting onto the deformed mesh, could be an option? */
-	if(psmd->dm->deformedOnly)
+	if (psmd->dm->deformedOnly)
 		dm= psmd->dm;
 	else
 		dm= mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH);
 
-	for(i=0; i<number; i++) {
-		if(number>1) {
+	for (i=0; i<number; i++) {
+		if (number>1) {
 			dmx=dmy=size;
-			while(dmx*dmx+dmy*dmy>size2) {
+			while (dmx*dmx+dmy*dmy>size2) {
 				dmx=(short)((2.0f*BLI_frand()-1.0f)*size);
 				dmy=(short)((2.0f*BLI_frand()-1.0f)*size);
 			}
@@ -3226,12 +3232,12 @@ static int brush_add(PEData *data, short number)
 		min_d=2.0;
 		
 		/* warning, returns the derived mesh face */
-		if(particle_intersect_dm(scene, ob,dm,0,co1,co2,&min_d,&add_pars[n].num,add_pars[n].fuv,0,0,0,0)) {
+		if (particle_intersect_dm(scene, ob,dm,0,co1,co2,&min_d,&add_pars[n].num,add_pars[n].fuv,0,0,0,0)) {
 			add_pars[n].num_dmcache= psys_particle_dm_face_lookup(ob,psmd->dm,add_pars[n].num,add_pars[n].fuv,NULL);
 			n++;
 		}
 	}
-	if(n) {
+	if (n) {
 		int newtotpart=totpart+n;
 		float hairmat[4][4], cur_co[3];
 		KDTree *tree=0;
@@ -3245,22 +3251,22 @@ static int brush_add(PEData *data, short number)
 		memcpy(new_points, edit->points, totpart * sizeof(PTCacheEditPoint));
 
 		/* change old arrays to new ones */
-		if(psys->particles) MEM_freeN(psys->particles);
+		if (psys->particles) MEM_freeN(psys->particles);
 		psys->particles= new_pars;
 
-		if(edit->points) MEM_freeN(edit->points);
+		if (edit->points) MEM_freeN(edit->points);
 		edit->points= new_points;
 
-		if(edit->mirror_cache) {
+		if (edit->mirror_cache) {
 			MEM_freeN(edit->mirror_cache);
 			edit->mirror_cache= NULL;
 		}
 
 		/* create tree for interpolation */
-		if(pset->flag & PE_INTERPOLATE_ADDED && psys->totpart) {
+		if (pset->flag & PE_INTERPOLATE_ADDED && psys->totpart) {
 			tree=BLI_kdtree_new(psys->totpart);
 			
-			for(i=0, pa=psys->particles; i<totpart; i++, pa++) {
+			for (i=0, pa=psys->particles; i<totpart; i++, pa++) {
 				psys_particle_on_dm(psmd->dm,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,cur_co,0,0,0,0,0);
 				BLI_kdtree_insert(tree, i, cur_co, NULL);
 			}
@@ -3274,17 +3280,17 @@ static int brush_add(PEData *data, short number)
 		pa= psys->particles + totpart;
 		point= edit->points + totpart;
 
-		for(i=totpart; i<newtotpart; i++, pa++, point++) {
+		for (i=totpart; i<newtotpart; i++, pa++, point++) {
 			memcpy(pa, add_pars + i - totpart, sizeof(ParticleData));
 			pa->hair= MEM_callocN(pset->totaddkey * sizeof(HairKey), "BakeKey key add");
 			key= point->keys= MEM_callocN(pset->totaddkey * sizeof(PTCacheEditKey), "PTCacheEditKey add");
 			point->totkey= pa->totkey= pset->totaddkey;
 
-			for(k=0, hkey=pa->hair; k<pa->totkey; k++, hkey++, key++) {
+			for (k=0, hkey=pa->hair; k<pa->totkey; k++, hkey++, key++) {
 				key->co= hkey->co;
 				key->time= &hkey->time;
 
-				if(!(psys->flag & PSYS_GLOBAL_HAIR))
+				if (!(psys->flag & PSYS_GLOBAL_HAIR))
 					key->flag |= PEK_USE_WCO;
 			}
 			
@@ -3292,12 +3298,12 @@ static int brush_add(PEData *data, short number)
 			initialize_particle(&sim, pa,i);
 			reset_particle(&sim, pa, 0.0, 1.0);
 			point->flag |= PEP_EDIT_RECALC;
-			if(pe_x_mirror(ob))
+			if (pe_x_mirror(ob))
 				point->flag |= PEP_TAG; /* signal for duplicate */
 			
 			framestep= pa->lifetime/(float)(pset->totaddkey-1);
 
-			if(tree) {
+			if (tree) {
 				ParticleData *ppa;
 				HairKey *thkey;
 				ParticleKey key3[3];
@@ -3310,20 +3316,20 @@ static int brush_add(PEData *data, short number)
 
 				maxd= ptn[maxw-1].dist;
 				
-				for(w=0; w<maxw; w++) {
+				for (w=0; w<maxw; w++) {
 					weight[w]= (float)pow(2.0, (double)(-6.0f * ptn[w].dist / maxd));
 					totw += weight[w];
 				}
-				for(;w<3; w++) {
+				for (;w<3; w++) {
 					weight[w]= 0.0f;
 				}
 
-				for(w=0; w<maxw; w++)
+				for (w=0; w<maxw; w++)
 					weight[w] /= totw;
 
 				ppa= psys->particles+ptn[0].index;
 
-				for(k=0; k<pset->totaddkey; k++) {
+				for (k=0; k<pset->totaddkey; k++) {
 					thkey= (HairKey*)pa->hair + k;
 					thkey->time= pa->time + k * framestep;
 
@@ -3334,13 +3340,13 @@ static int brush_add(PEData *data, short number)
 					/* TODO: interpolatint the weight would be nicer */
 					thkey->weight= (ppa->hair+MIN2(k, ppa->totkey-1))->weight;
 					
-					if(maxw>1) {
+					if (maxw>1) {
 						key3[1].time= key3[0].time;
 						psys_get_particle_on_path(&sim, ptn[1].index, &key3[1], 0);
 						mul_v3_fl(key3[1].co, weight[1]);
 						add_v3_v3(key3[0].co, key3[1].co);
 
-						if(maxw>2) {						
+						if (maxw>2) {
 							key3[2].time= key3[0].time;
 							psys_get_particle_on_path(&sim, ptn[2].index, &key3[2], 0);
 							mul_v3_fl(key3[2].co, weight[2]);
@@ -3348,7 +3354,7 @@ static int brush_add(PEData *data, short number)
 						}
 					}
 
-					if(k==0)
+					if (k==0)
 						sub_v3_v3v3(co1, pa->state.co, key3[0].co);
 
 					add_v3_v3v3(thkey->co, key3[0].co, co1);
@@ -3357,26 +3363,26 @@ static int brush_add(PEData *data, short number)
 				}
 			}
 			else {
-				for(k=0, hkey=pa->hair; k<pset->totaddkey; k++, hkey++) {
+				for (k=0, hkey=pa->hair; k<pset->totaddkey; k++, hkey++) {
 					madd_v3_v3v3fl(hkey->co, pa->state.co, pa->state.vel, k * framestep * timestep);
 					hkey->time += k * framestep;
 					hkey->weight = 1.f - (float)k/(float)(pset->totaddkey-1);
 				}
 			}
-			for(k=0, hkey=pa->hair; k<pset->totaddkey; k++, hkey++) {
+			for (k=0, hkey=pa->hair; k<pset->totaddkey; k++, hkey++) {
 				psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, hairmat);
 				invert_m4_m4(imat,hairmat);
 				mul_m4_v3(imat, hkey->co);
 			}
 		}
 
-		if(tree)
+		if (tree)
 			BLI_kdtree_free(tree);
 	}
-	if(add_pars)
+	if (add_pars)
 		MEM_freeN(add_pars);
 	
-	if(!psmd->dm->deformedOnly)
+	if (!psmd->dm->deformedOnly)
 		dm->release(dm);
 	
 	return n;
@@ -3405,7 +3411,7 @@ static int brush_edit_init(bContext *C, wmOperator *op)
 	ARegion *ar= CTX_wm_region(C);
 	BrushEdit *bedit;
 
-	if(pset->brushtype < 0)
+	if (pset->brushtype < 0)
 		return 0;
 
 	initgrabz(ar->regiondata, ob->obmat[3][0], ob->obmat[3][1], ob->obmat[3][2]);
@@ -3440,7 +3446,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
 	float dx, dy, dmax;
 	int lock_root = pset->flag & PE_LOCK_FIRST;
 
-	if(!PE_start_edit(edit))
+	if (!PE_start_edit(edit))
 		return;
 
 	RNA_float_get_array(itemptr, "mouse", mousef);
@@ -3448,7 +3454,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
 	mouse[1] = mousef[1];
 	flip= RNA_boolean_get(itemptr, "pen_flip");
 
-	if(bedit->first) {
+	if (bedit->first) {
 		bedit->lastmouse[0]= mouse[0];
 		bedit->lastmouse[1]= mouse[1];
 	}
@@ -3461,24 +3467,23 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
 
 
 	/* disable locking temporatily for disconnected hair */
-	if(edit->psys && edit->psys->flag & PSYS_GLOBAL_HAIR)
+	if (edit->psys && edit->psys->flag & PSYS_GLOBAL_HAIR)
 		pset->flag &= ~PE_LOCK_FIRST;
 
-	if(((pset->brushtype == PE_BRUSH_ADD) ?
-		(sqrt(dx * dx + dy * dy) > pset->brush[PE_BRUSH_ADD].step) : (dx != 0 || dy != 0))
-		|| bedit->first) {
+	if (((pset->brushtype == PE_BRUSH_ADD) ?
+		(sqrt(dx * dx + dy * dy) > pset->brush[PE_BRUSH_ADD].step) : (dx != 0 || dy != 0)) || bedit->first) {
 		PEData data= bedit->data;
 
 		view3d_operator_needs_opengl(C);
 		selected= (short)count_selected_keys(scene, edit);
 
-		dmax = MAX2(fabs(dx), fabs(dy));
+		dmax = maxf(fabsf(dx), fabsf(dy));
 		tot_steps = dmax/(0.2f * brush->size) + 1;
 
 		dx /= (float)tot_steps;
 		dy /= (float)tot_steps;
 
-		for(step = 1; step<=tot_steps; step++) {
+		for (step = 1; step<=tot_steps; step++) {
 			mval[0] = bedit->lastmouse[0] + step*dx;
 			mval[1] = bedit->lastmouse[1] + step*dy;
 
@@ -3490,7 +3495,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
 					data.rad= (float)brush->size;
 
 					data.combfac= (brush->strength - 0.5f) * 2.0f;
-					if(data.combfac < 0.0f)
+					if (data.combfac < 0.0f)
 						data.combfac= 1.0f - 9.0f * data.combfac;
 					else
 						data.combfac= 1.0f - data.combfac;
@@ -3507,18 +3512,18 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
 				}
 				case PE_BRUSH_CUT:
 				{
-					if(edit->psys && edit->pathcache) {
+					if (edit->psys && edit->pathcache) {
 						data.mval= mval;
 						data.rad= (float)brush->size;
 						data.cutfac= brush->strength;
 
-						if(selected)
+						if (selected)
 							foreach_selected_point(&data, brush_cut);
 						else
 							foreach_point(&data, brush_cut);
 
 						removed= remove_tagged_particles(ob, edit->psys, pe_x_mirror(ob));
-						if(pset->flag & PE_KEEP_LENGTHS)
+						if (pset->flag & PE_KEEP_LENGTHS)
 							recalc_lengths(edit);
 					}
 					else
@@ -3533,27 +3538,27 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
 					data.rad= (float)brush->size;
 					data.growfac= brush->strength / 50.0f;
 
-					if(brush->invert ^ flip)
+					if (brush->invert ^ flip)
 						data.growfac= 1.0f - data.growfac;
 					else
 						data.growfac= 1.0f + data.growfac;
 
 					foreach_mouse_hit_point(&data, brush_length, selected);
 
-					if(pset->flag & PE_KEEP_LENGTHS)
+					if (pset->flag & PE_KEEP_LENGTHS)
 						recalc_lengths(edit);
 					break;
 				}
 				case PE_BRUSH_PUFF:
 				{
-					if(edit->psys) {
+					if (edit->psys) {
 						data.dm= psmd->dm;
 						data.mval= mval;
 						data.rad= (float)brush->size;
 						data.select= selected;
 
 						data.pufffac= (brush->strength - 0.5f) * 2.0f;
-						if(data.pufffac < 0.0f)
+						if (data.pufffac < 0.0f)
 							data.pufffac= 1.0f - 9.0f * data.pufffac;
 						else
 							data.pufffac= 1.0f - data.pufffac;
@@ -3567,12 +3572,12 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
 				}
 				case PE_BRUSH_ADD:
 				{
-					if(edit->psys && edit->psys->part->from==PART_FROM_FACE) {
+					if (edit->psys && edit->psys->part->from==PART_FROM_FACE) {
 						data.mval= mval;
 
 						added= brush_add(&data, brush->count);
 
-						if(pset->flag & PE_KEEP_LENGTHS)
+						if (pset->flag & PE_KEEP_LENGTHS)
 							recalc_lengths(edit);
 					}
 					else
@@ -3593,7 +3598,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
 
 					foreach_mouse_hit_key(&data, brush_smooth_get, selected);
 
-					if(data.tot) {
+					if (data.tot) {
 						mul_v3_fl(data.vec, 1.0f / (float)data.tot);
 						foreach_mouse_hit_key(&data, brush_smooth_do, selected);
 					}
@@ -3602,7 +3607,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
 				}
 				case PE_BRUSH_WEIGHT:
 				{
-					if(edit->psys) {
+					if (edit->psys) {
 						data.dm= psmd->dm;
 						data.mval= mval;
 						data.rad= (float)brush->size;
@@ -3615,11 +3620,11 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
 					break;
 				}
 			}
-			if((pset->flag & PE_KEEP_LENGTHS)==0)
+			if ((pset->flag & PE_KEEP_LENGTHS)==0)
 				recalc_lengths(edit);
 
-			if(ELEM(pset->brushtype, PE_BRUSH_ADD, PE_BRUSH_CUT) && (added || removed)) {
-				if(pset->brushtype == PE_BRUSH_ADD && pe_x_mirror(ob))
+			if (ELEM(pset->brushtype, PE_BRUSH_ADD, PE_BRUSH_CUT) && (added || removed)) {
+				if (pset->brushtype == PE_BRUSH_ADD && pe_x_mirror(ob))
 					PE_mirror_x(scene, ob, 1);
 
 				update_world_cos(ob,edit);
@@ -3630,10 +3635,10 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
 				PE_update_object(scene, ob, 1);
 		}
 
-		if(edit->psys)
+		if (edit->psys) {
 			WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, ob);
-		else
-		{
+		}
+		else {
 			DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 			WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
 		}
@@ -3655,7 +3660,7 @@ static void brush_edit_exit(wmOperator *op)
 
 static int brush_edit_exec(bContext *C, wmOperator *op)
 {
-	if(!brush_edit_init(C, op))
+	if (!brush_edit_init(C, op))
 		return OPERATOR_CANCELLED;
 
 	RNA_BEGIN(op->ptr, itemptr, "stroke") {
@@ -3687,7 +3692,7 @@ static void brush_edit_apply_event(bContext *C, wmOperator *op, wmEvent *event)
 
 static int brush_edit_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	if(!brush_edit_init(C, op))
+	if (!brush_edit_init(C, op))
 		return OPERATOR_CANCELLED;
 	
 	brush_edit_apply_event(C, op, event);
@@ -3723,18 +3728,18 @@ static int brush_edit_cancel(bContext *UNUSED(C), wmOperator *op)
 void PARTICLE_OT_brush_edit(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Brush Edit";
-	ot->idname= "PARTICLE_OT_brush_edit";
+	ot->name = "Brush Edit";
+	ot->idname = "PARTICLE_OT_brush_edit";
 	
 	/* api callbacks */
-	ot->exec= brush_edit_exec;
-	ot->invoke= brush_edit_invoke;
-	ot->modal= brush_edit_modal;
-	ot->cancel= brush_edit_cancel;
-	ot->poll= PE_poll_view3d;
+	ot->exec = brush_edit_exec;
+	ot->invoke = brush_edit_invoke;
+	ot->modal = brush_edit_modal;
+	ot->cancel = brush_edit_cancel;
+	ot->poll = PE_poll_view3d;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
 
 	/* properties */
 	RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
@@ -3747,16 +3752,16 @@ static void free_PTCacheUndo(PTCacheUndo *undo)
 	PTCacheEditPoint *point;
 	int i;
 
-	for(i=0, point=undo->points; i<undo->totpoint; i++, point++) {
-		if(undo->particles && (undo->particles + i)->hair)
+	for (i=0, point=undo->points; i<undo->totpoint; i++, point++) {
+		if (undo->particles && (undo->particles + i)->hair)
 			MEM_freeN((undo->particles + i)->hair);
-		if(point->keys)
+		if (point->keys)
 			MEM_freeN(point->keys);
 	}
-	if(undo->points)
+	if (undo->points)
 		MEM_freeN(undo->points);
 
-	if(undo->particles)
+	if (undo->particles)
 		MEM_freeN(undo->particles);
 
 	BKE_ptcache_free_mem(&undo->mem_cache);
@@ -3769,12 +3774,12 @@ static void make_PTCacheUndo(PTCacheEdit *edit, PTCacheUndo *undo)
 
 	undo->totpoint= edit->totpoint;
 
-	if(edit->psys) {
+	if (edit->psys) {
 		ParticleData *pa;
 
 		pa= undo->particles= MEM_dupallocN(edit->psys->particles);
 
-		for(i=0; i<edit->totpoint; i++, pa++)
+		for (i=0; i<edit->totpoint; i++, pa++)
 			pa->hair= MEM_dupallocN(pa->hair);
 
 		undo->psys_flag = edit->psys->flag;
@@ -3785,8 +3790,8 @@ static void make_PTCacheUndo(PTCacheEdit *edit, PTCacheUndo *undo)
 		BLI_duplicatelist(&undo->mem_cache, &edit->pid.cache->mem_cache);
 		pm = undo->mem_cache.first;
 
-		for(; pm; pm=pm->next) {
-			for(i=0; i<BPHYS_TOT_DATA; i++)
+		for (; pm; pm=pm->next) {
+			for (i=0; i<BPHYS_TOT_DATA; i++)
 				pm->data[i] = MEM_dupallocN(pm->data[i]);
 		}
 	}
@@ -3794,7 +3799,7 @@ static void make_PTCacheUndo(PTCacheEdit *edit, PTCacheUndo *undo)
 	point= undo->points = MEM_dupallocN(edit->points);
 	undo->totpoint = edit->totpoint;
 
-	for(i=0; i<edit->totpoint; i++, point++) {
+	for (i=0; i<edit->totpoint; i++, point++) {
 		point->keys= MEM_dupallocN(point->keys);
 		/* no need to update edit key->co & key->time pointers here */
 	}
@@ -3808,17 +3813,17 @@ static void get_PTCacheUndo(PTCacheEdit *edit, PTCacheUndo *undo)
 	POINT_P; KEY_K;
 
 	LOOP_POINTS {
-		if(psys && psys->particles[p].hair)
+		if (psys && psys->particles[p].hair)
 			MEM_freeN(psys->particles[p].hair);
 
-		if(point->keys)
+		if (point->keys)
 			MEM_freeN(point->keys);
 	}
-	if(psys && psys->particles)
+	if (psys && psys->particles)
 		MEM_freeN(psys->particles);
-	if(edit->points)
+	if (edit->points)
 		MEM_freeN(edit->points);
-	if(edit->mirror_cache) {
+	if (edit->mirror_cache) {
 		MEM_freeN(edit->mirror_cache);
 		edit->mirror_cache= NULL;
 	}
@@ -3830,7 +3835,7 @@ static void get_PTCacheUndo(PTCacheEdit *edit, PTCacheUndo *undo)
 		point->keys= MEM_dupallocN(point->keys);
 	}
 
-	if(psys) {
+	if (psys) {
 		psys->particles= MEM_dupallocN(undo->particles);
 
 		psys->totpart= undo->totpoint;
@@ -3858,15 +3863,15 @@ static void get_PTCacheUndo(PTCacheEdit *edit, PTCacheUndo *undo)
 
 		pm = edit->pid.cache->mem_cache.first;
 
-		for(; pm; pm=pm->next) {
-			for(i=0; i<BPHYS_TOT_DATA; i++)
+		for (; pm; pm=pm->next) {
+			for (i=0; i<BPHYS_TOT_DATA; i++)
 				pm->data[i] = MEM_dupallocN(pm->data[i]);
 
 			BKE_ptcache_mem_pointers_init(pm);
 
 			LOOP_POINTS {
 				LOOP_KEYS {
-					if((int)key->ftime == (int)pm->frame) {
+					if ((int)key->ftime == (int)pm->frame) {
 						key->co = pm->cur[BPHYS_DATA_LOCATION];
 						key->vel = pm->cur[BPHYS_DATA_VELOCITY];
 						key->rot = pm->cur[BPHYS_DATA_ROTATION];
@@ -3885,10 +3890,10 @@ void PE_undo_push(Scene *scene, const char *str)
 	PTCacheUndo *undo;
 	int nr;
 
-	if(!edit) return;
+	if (!edit) return;
 
 	/* remove all undos after (also when curundo==NULL) */
-	while(edit->undo.last != edit->curundo) {
+	while (edit->undo.last != edit->curundo) {
 		undo= edit->undo.last;
 		BLI_remlink(&edit->undo, undo);
 		free_PTCacheUndo(undo);
@@ -3903,13 +3908,13 @@ void PE_undo_push(Scene *scene, const char *str)
 	/* and limit amount to the maximum */
 	nr= 0;
 	undo= edit->undo.last;
-	while(undo) {
+	while (undo) {
 		nr++;
-		if(nr==U.undosteps) break;
+		if (nr==U.undosteps) break;
 		undo= undo->prev;
 	}
-	if(undo) {
-		while(edit->undo.first!=undo) {
+	if (undo) {
+		while (edit->undo.first!=undo) {
 			PTCacheUndo *first= edit->undo.first;
 			BLI_remlink(&edit->undo, first);
 			free_PTCacheUndo(first);
@@ -3925,16 +3930,16 @@ void PE_undo_step(Scene *scene, int step)
 {	
 	PTCacheEdit *edit= PE_get_current(scene, OBACT);
 
-	if(!edit) return;
+	if (!edit) return;
 
-	if(step==0) {
+	if (step==0) {
 		get_PTCacheUndo(edit,edit->curundo);
 	}
-	else if(step==1) {
+	else if (step==1) {
 		
-		if(edit->curundo==NULL || edit->curundo->prev==NULL);
+		if (edit->curundo==NULL || edit->curundo->prev==NULL);
 		else {
-			if(G.f & G_DEBUG) printf("undo %s\n", edit->curundo->name);
+			if (G.debug & G_DEBUG) printf("undo %s\n", edit->curundo->name);
 			edit->curundo= edit->curundo->prev;
 			get_PTCacheUndo(edit, edit->curundo);
 		}
@@ -3942,11 +3947,11 @@ void PE_undo_step(Scene *scene, int step)
 	else {
 		/* curundo has to remain current situation! */
 		
-		if(edit->curundo==NULL || edit->curundo->next==NULL);
+		if (edit->curundo==NULL || edit->curundo->next==NULL);
 		else {
 			get_PTCacheUndo(edit, edit->curundo->next);
 			edit->curundo= edit->curundo->next;
-			if(G.f & G_DEBUG) printf("redo %s\n", edit->curundo->name);
+			if (G.debug & G_DEBUG) printf("redo %s\n", edit->curundo->name);
 		}
 	}
 
@@ -3957,7 +3962,7 @@ int PE_undo_valid(Scene *scene)
 {
 	PTCacheEdit *edit= PE_get_current(scene, OBACT);
 	
-	if(edit) {
+	if (edit) {
 		return (edit->undo.last != edit->undo.first);
 	}
 	return 0;
@@ -3967,10 +3972,10 @@ static void PTCacheUndo_clear(PTCacheEdit *edit)
 {
 	PTCacheUndo *undo;
 
-	if(edit==NULL) return;
+	if (edit==NULL) return;
 	
 	undo= edit->undo.first;
-	while(undo) {
+	while (undo) {
 		free_PTCacheUndo(undo);
 		undo= undo->next;
 	}
@@ -3994,8 +3999,8 @@ void PE_undo_number(Scene *scene, int nr)
 	PTCacheUndo *undo;
 	int a=0;
 	
-	for(undo= edit->undo.first; undo; undo= undo->next, a++) {
-		if(a==nr) break;
+	for (undo= edit->undo.first; undo; undo= undo->next, a++) {
+		if (a==nr) break;
 	}
 	edit->curundo= undo;
 	PE_undo_step(scene, 0);
@@ -4009,12 +4014,12 @@ const char *PE_undo_get_name(Scene *scene, int nr, int *active)
 	PTCacheEdit *edit= PE_get_current(scene, OBACT);
 	PTCacheUndo *undo;
 	
-	if(active) *active= 0;
+	if (active) *active= 0;
 	
-	if(edit) {
+	if (edit) {
 		undo= BLI_findlink(&edit->undo, nr);
-		if(undo) {
-			if(active && undo==edit->curundo)
+		if (undo) {
+			if (active && undo==edit->curundo)
 				*active= 1;
 			return undo->name;
 		}
@@ -4034,15 +4039,15 @@ int PE_minmax(Scene *scene, float min[3], float max[3])
 	float co[3], mat[4][4];
 	int ok= 0;
 
-	if(!edit) return ok;
+	if (!edit) return ok;
 
-	if((psys = edit->psys))
+	if ((psys = edit->psys))
 		psmd= psys_get_modifier(ob, psys);
 	else
 		unit_m4(mat);
 
 	LOOP_VISIBLE_POINTS {
-		if(psys)
+		if (psys)
 			psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles+p, mat);
 
 		LOOP_SELECTED_KEYS {
@@ -4053,7 +4058,7 @@ int PE_minmax(Scene *scene, float min[3], float max[3])
 		}
 	}
 
-	if(!ok) {
+	if (!ok) {
 		minmax_object(ob, min, max);
 		ok= 1;
 	}
@@ -4074,23 +4079,23 @@ static void PE_create_particle_edit(Scene *scene, Object *ob, PointCache *cache,
 	int totpoint;
 
 	/* no psmd->dm happens in case particle system modifier is not enabled */
-	if(!(psys && psmd && psmd->dm) && !cache)
+	if (!(psys && psmd && psmd->dm) && !cache)
 		return;
 
-	if(cache && cache->flag & PTCACHE_DISK_CACHE)
+	if (cache && cache->flag & PTCACHE_DISK_CACHE)
 		return;
 
-	if(psys == NULL && cache->mem_cache.first == NULL)
+	if (psys == NULL && cache->mem_cache.first == NULL)
 		return;
 
-	if(!edit) {
+	if (!edit) {
 		totpoint = psys ? psys->totpart : (int)((PTCacheMem*)cache->mem_cache.first)->totpoint;
 
 		edit= MEM_callocN(sizeof(PTCacheEdit), "PE_create_particle_edit");
 		edit->points=MEM_callocN(totpoint*sizeof(PTCacheEditPoint),"PTCacheEditPoints");
 		edit->totpoint = totpoint;
 
-		if(psys && !cache) {
+		if (psys && !cache) {
 			psys->edit= edit;
 			edit->psys = psys;
 
@@ -4110,7 +4115,7 @@ static void PE_create_particle_edit(Scene *scene, Object *ob, PointCache *cache,
 					key->co= hkey->co;
 					key->time= &hkey->time;
 					key->flag= hkey->editflag;
-					if(!(psys->flag & PSYS_GLOBAL_HAIR)) {
+					if (!(psys->flag & PSYS_GLOBAL_HAIR)) {
 						key->flag |= PEK_USE_WCO;
 						hkey->editflag |= PEK_USE_WCO;
 					}
@@ -4129,15 +4134,15 @@ static void PE_create_particle_edit(Scene *scene, Object *ob, PointCache *cache,
 			cache->free_edit= PE_free_ptcache_edit;
 			edit->psys = NULL;
 
-			for(pm=cache->mem_cache.first; pm; pm=pm->next)
+			for (pm=cache->mem_cache.first; pm; pm=pm->next)
 				totframe++;
 
-			for(pm=cache->mem_cache.first; pm; pm=pm->next) {
+			for (pm=cache->mem_cache.first; pm; pm=pm->next) {
 				LOOP_POINTS {
-					if(BKE_ptcache_mem_pointers_seek(p, pm) == 0)
+					if (BKE_ptcache_mem_pointers_seek(p, pm) == 0)
 						continue;
 
-					if(!point->totkey) {
+					if (!point->totkey) {
 						key = point->keys = MEM_callocN(totframe*sizeof(PTCacheEditKey),"ParticleEditKeys");
 						point->flag |= PEP_EDIT_RECALC;
 					}
@@ -4161,7 +4166,7 @@ static void PE_create_particle_edit(Scene *scene, Object *ob, PointCache *cache,
 		UI_GetThemeColor3ubv(TH_WIRE, edit->nosel_col);
 
 		recalc_lengths(edit);
-		if(psys && !cache)
+		if (psys && !cache)
 			recalc_emitter_field(ob, psys);
 		PE_update_object(scene, ob, 1);
 
@@ -4175,7 +4180,7 @@ static int particle_edit_toggle_poll(bContext *C)
 	Scene *scene= CTX_data_scene(C);
 	Object *ob= CTX_data_active_object(C);
 
-	if(!scene || !ob || ob->id.lib)
+	if (!scene || !ob || ob->id.lib)
 		return 0;
 	
 	return (ob->particlesystem.first || modifiers_findByType(ob, eModifierType_Cloth) || modifiers_findByType(ob, eModifierType_Softbody));
@@ -4186,14 +4191,14 @@ static int particle_edit_toggle_exec(bContext *C, wmOperator *UNUSED(op))
 	Scene *scene= CTX_data_scene(C);
 	Object *ob= CTX_data_active_object(C);
 
-	if(!(ob->mode & OB_MODE_PARTICLE_EDIT)) {
+	if (!(ob->mode & OB_MODE_PARTICLE_EDIT)) {
 		PTCacheEdit *edit;
 		ob->mode |= OB_MODE_PARTICLE_EDIT;
 		edit= PE_create_current(scene, ob);
 	
 		/* mesh may have changed since last entering editmode.
 		 * note, this may have run before if the edit data was just created, so could avoid this and speed up a little */
-		if(edit && edit->psys)
+		if (edit && edit->psys)
 			recalc_emitter_field(ob, edit->psys);
 		
 		toggle_particle_cursor(C, 1);
@@ -4213,15 +4218,15 @@ static int particle_edit_toggle_exec(bContext *C, wmOperator *UNUSED(op))
 void PARTICLE_OT_particle_edit_toggle(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Particle Edit Toggle";
-	ot->idname= "PARTICLE_OT_particle_edit_toggle";
+	ot->name = "Particle Edit Toggle";
+	ot->idname = "PARTICLE_OT_particle_edit_toggle";
 	
 	/* api callbacks */
-	ot->exec= particle_edit_toggle_exec;
-	ot->poll= particle_edit_toggle_poll;
+	ot->exec = particle_edit_toggle_exec;
+	ot->poll = particle_edit_toggle_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 
@@ -4232,8 +4237,8 @@ static int clear_edited_exec(bContext *C, wmOperator *UNUSED(op))
 	Object *ob= CTX_data_active_object(C);
 	ParticleSystem *psys = psys_get_current(ob);
 	
-	if(psys->edit) {
-		if(psys->edit->edited || 1) { // XXX okee("Lose changes done in particle mode?")) 
+	if (psys->edit) {
+		if (psys->edit->edited || 1) { // XXX okee("Lose changes done in particle mode?"))
 			PE_free_ptcache_edit(psys->edit);
 
 			psys->edit = NULL;
@@ -4262,14 +4267,14 @@ static int clear_edited_exec(bContext *C, wmOperator *UNUSED(op))
 void PARTICLE_OT_edited_clear(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear Edited";
-	ot->idname= "PARTICLE_OT_edited_clear";
+	ot->name = "Clear Edited";
+	ot->idname = "PARTICLE_OT_edited_clear";
 	
 	/* api callbacks */
-	ot->exec= clear_edited_exec;
-	ot->poll= particle_edit_toggle_poll;
+	ot->exec = clear_edited_exec;
+	ot->poll = particle_edit_toggle_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index b26661d..3d50ec2 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -70,7 +70,7 @@ static int particle_system_add_exec(bContext *C, wmOperator *UNUSED(op))
 	Object *ob= ED_object_context(C);
 	Scene *scene = CTX_data_scene(C);
 
-	if(!scene || !ob)
+	if (!scene || !ob)
 		return OPERATOR_CANCELLED;
 
 	object_add_particle_system(scene, ob, NULL);
@@ -84,16 +84,16 @@ static int particle_system_add_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_particle_system_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Particle System Slot";
-	ot->idname= "OBJECT_OT_particle_system_add";
-	ot->description="Add a particle system";
+	ot->name = "Add Particle System Slot";
+	ot->idname = "OBJECT_OT_particle_system_add";
+	ot->description = "Add a particle system";
 	
 	/* api callbacks */
-	ot->poll= ED_operator_object_active_editable;
-	ot->exec= particle_system_add_exec;
+	ot->poll = ED_operator_object_active_editable;
+	ot->exec = particle_system_add_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op))
@@ -101,7 +101,7 @@ static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op))
 	Object *ob= ED_object_context(C);
 	Scene *scene = CTX_data_scene(C);
 	int mode_orig = ob->mode;
-	if(!scene || !ob)
+	if (!scene || !ob)
 		return OPERATOR_CANCELLED;
 
 	object_remove_particle_system(scene, ob);
@@ -109,9 +109,9 @@ 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);
@@ -123,16 +123,16 @@ static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_particle_system_remove(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove Particle System Slot";
-	ot->idname= "OBJECT_OT_particle_system_remove";
-	ot->description="Remove the selected particle system";
+	ot->name = "Remove Particle System Slot";
+	ot->idname = "OBJECT_OT_particle_system_remove";
+	ot->description = "Remove the selected particle system";
 	
 	/* api callbacks */
-	ot->poll= ED_operator_object_active_editable;
-	ot->exec= particle_system_remove_exec;
+	ot->poll = ED_operator_object_active_editable;
+	ot->exec = particle_system_remove_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************** new particle settings operator *********************/
@@ -157,14 +157,14 @@ static int new_particle_settings_exec(bContext *C, wmOperator *UNUSED(op))
 	psys = ptr.data;
 
 	/* add or copy particle setting */
-	if(psys->part)
+	if (psys->part)
 		part= psys_copy_settings(psys->part);
 	else
 		part= psys_new_settings("ParticleSettings", bmain);
 
 	ob= ptr.id.data;
 
-	if(psys->part)
+	if (psys->part)
 		psys->part->id.us--;
 
 	psys->part = part;
@@ -182,16 +182,16 @@ static int new_particle_settings_exec(bContext *C, wmOperator *UNUSED(op))
 void PARTICLE_OT_new(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "New Particle Settings";
-	ot->idname= "PARTICLE_OT_new";
-	ot->description="Add new particle settings";
+	ot->name = "New Particle Settings";
+	ot->idname = "PARTICLE_OT_new";
+	ot->description = "Add new particle settings";
 	
 	/* api callbacks */
-	ot->exec= new_particle_settings_exec;
-	ot->poll= psys_poll;
+	ot->exec = new_particle_settings_exec;
+	ot->poll = psys_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************** keyed particle target operators *********************/
@@ -206,11 +206,11 @@ static int new_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
 
 	ParticleTarget *pt;
 
-	if(!psys)
+	if (!psys)
 		return OPERATOR_CANCELLED;
 
 	pt = psys->targets.first;
-	for(; pt; pt=pt->next)
+	for (; pt; pt=pt->next)
 		pt->flag &= ~PTARGET_CURRENT;
 
 	pt = MEM_callocN(sizeof(ParticleTarget), "keyed particle target");
@@ -231,15 +231,15 @@ static int new_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
 void PARTICLE_OT_new_target(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "New Particle Target";
-	ot->idname= "PARTICLE_OT_new_target";
-	ot->description="Add a new particle target";
+	ot->name = "New Particle Target";
+	ot->idname = "PARTICLE_OT_new_target";
+	ot->description = "Add a new particle target";
 	
 	/* api callbacks */
-	ot->exec= new_particle_target_exec;
+	ot->exec = new_particle_target_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int remove_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
@@ -252,12 +252,12 @@ static int remove_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
 
 	ParticleTarget *pt;
 
-	if(!psys)
+	if (!psys)
 		return OPERATOR_CANCELLED;
 
 	pt = psys->targets.first;
-	for(; pt; pt=pt->next) {
-		if(pt->flag & PTARGET_CURRENT) {
+	for (; pt; pt=pt->next) {
+		if (pt->flag & PTARGET_CURRENT) {
 			BLI_remlink(&psys->targets, pt);
 			MEM_freeN(pt);
 			break;
@@ -266,7 +266,7 @@ static int remove_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
 	}
 	pt = psys->targets.last;
 
-	if(pt)
+	if (pt)
 		pt->flag |= PTARGET_CURRENT;
 
 	DAG_scene_sort(bmain, scene);
@@ -280,15 +280,15 @@ static int remove_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
 void PARTICLE_OT_target_remove(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove Particle Target";
-	ot->idname= "PARTICLE_OT_target_remove";
-	ot->description="Remove the selected particle target";
+	ot->name = "Remove Particle Target";
+	ot->idname = "PARTICLE_OT_target_remove";
+	ot->description = "Remove the selected particle target";
 	
 	/* api callbacks */
-	ot->exec= remove_particle_target_exec;
+	ot->exec = remove_particle_target_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /************************ move up particle target operator *********************/
@@ -300,12 +300,12 @@ static int target_move_up_exec(bContext *C, wmOperator *UNUSED(op))
 	Object *ob = ptr.id.data;
 	ParticleTarget *pt;
 
-	if(!psys)
+	if (!psys)
 		return OPERATOR_CANCELLED;
 	
 	pt = psys->targets.first;
-	for(; pt; pt=pt->next) {
-		if(pt->flag & PTARGET_CURRENT && pt->prev) {
+	for (; pt; pt=pt->next) {
+		if (pt->flag & PTARGET_CURRENT && pt->prev) {
 			BLI_remlink(&psys->targets, pt);
 			BLI_insertlink(&psys->targets, pt->prev->prev, pt);
 
@@ -320,14 +320,14 @@ static int target_move_up_exec(bContext *C, wmOperator *UNUSED(op))
 
 void PARTICLE_OT_target_move_up(wmOperatorType *ot)
 {
-	ot->name= "Move Up Target";
-	ot->idname= "PARTICLE_OT_target_move_up";
-	ot->description= "Move particle target up in the list";
+	ot->name = "Move Up Target";
+	ot->idname = "PARTICLE_OT_target_move_up";
+	ot->description = "Move particle target up in the list";
 	
-	ot->exec= target_move_up_exec;
+	ot->exec = target_move_up_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /************************ move down particle target operator *********************/
@@ -339,11 +339,11 @@ static int target_move_down_exec(bContext *C, wmOperator *UNUSED(op))
 	Object *ob = ptr.id.data;
 	ParticleTarget *pt;
 
-	if(!psys)
+	if (!psys)
 		return OPERATOR_CANCELLED;
 	pt = psys->targets.first;
-	for(; pt; pt=pt->next) {
-		if(pt->flag & PTARGET_CURRENT && pt->next) {
+	for (; pt; pt=pt->next) {
+		if (pt->flag & PTARGET_CURRENT && pt->next) {
 			BLI_remlink(&psys->targets, pt);
 			BLI_insertlink(&psys->targets, pt->next, pt);
 
@@ -358,14 +358,14 @@ static int target_move_down_exec(bContext *C, wmOperator *UNUSED(op))
 
 void PARTICLE_OT_target_move_down(wmOperatorType *ot)
 {
-	ot->name= "Move Down Target";
-	ot->idname= "PARTICLE_OT_target_move_down";
-	ot->description= "Move particle target down in the list";
+	ot->name = "Move Down Target";
+	ot->idname = "PARTICLE_OT_target_move_down";
+	ot->description = "Move particle target down in the list";
 	
-	ot->exec= target_move_down_exec;
+	ot->exec = target_move_down_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /************************ move up particle dupliweight operator *********************/
@@ -377,12 +377,12 @@ static int dupliob_move_up_exec(bContext *C, wmOperator *UNUSED(op))
 	ParticleSettings *part;
 	ParticleDupliWeight *dw;
 
-	if(!psys)
+	if (!psys)
 		return OPERATOR_CANCELLED;
 
 	part = psys->part;
-	for(dw=part->dupliweights.first; dw; dw=dw->next) {
-		if(dw->flag & PART_DUPLIW_CURRENT && dw->prev) {
+	for (dw=part->dupliweights.first; dw; dw=dw->next) {
+		if (dw->flag & PART_DUPLIW_CURRENT && dw->prev) {
 			BLI_remlink(&part->dupliweights, dw);
 			BLI_insertlink(&part->dupliweights, dw->prev->prev, dw);
 
@@ -396,14 +396,14 @@ static int dupliob_move_up_exec(bContext *C, wmOperator *UNUSED(op))
 
 void PARTICLE_OT_dupliob_move_up(wmOperatorType *ot)
 {
-	ot->name= "Move Up Dupli Object";
-	ot->idname= "PARTICLE_OT_dupliob_move_up";
-	ot->description= "Move dupli object up in the list";
+	ot->name = "Move Up Dupli Object";
+	ot->idname = "PARTICLE_OT_dupliob_move_up";
+	ot->description = "Move dupli object up in the list";
 	
-	ot->exec= dupliob_move_up_exec;
+	ot->exec = dupliob_move_up_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************** particle dupliweight operators *********************/
@@ -415,11 +415,11 @@ static int copy_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
 	ParticleSettings *part;
 	ParticleDupliWeight *dw;
 
-	if(!psys)
+	if (!psys)
 		return OPERATOR_CANCELLED;
 	part = psys->part;
-	for(dw=part->dupliweights.first; dw; dw=dw->next) {
-		if(dw->flag & PART_DUPLIW_CURRENT) {
+	for (dw=part->dupliweights.first; dw; dw=dw->next) {
+		if (dw->flag & PART_DUPLIW_CURRENT) {
 			dw->flag &= ~PART_DUPLIW_CURRENT;
 			dw = MEM_dupallocN(dw);
 			dw->flag |= PART_DUPLIW_CURRENT;
@@ -436,15 +436,15 @@ static int copy_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
 void PARTICLE_OT_dupliob_copy(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Copy Particle Dupliob";
-	ot->idname= "PARTICLE_OT_dupliob_copy";
-	ot->description="Duplicate the current dupliobject";
+	ot->name = "Copy Particle Dupliob";
+	ot->idname = "PARTICLE_OT_dupliob_copy";
+	ot->description = "Duplicate the current dupliobject";
 	
 	/* api callbacks */
-	ot->exec= copy_particle_dupliob_exec;
+	ot->exec = copy_particle_dupliob_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int remove_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
@@ -454,12 +454,12 @@ static int remove_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
 	ParticleSettings *part;
 	ParticleDupliWeight *dw;
 
-	if(!psys)
+	if (!psys)
 		return OPERATOR_CANCELLED;
 
 	part = psys->part;
-	for(dw=part->dupliweights.first; dw; dw=dw->next) {
-		if(dw->flag & PART_DUPLIW_CURRENT) {
+	for (dw=part->dupliweights.first; dw; dw=dw->next) {
+		if (dw->flag & PART_DUPLIW_CURRENT) {
 			BLI_remlink(&part->dupliweights, dw);
 			MEM_freeN(dw);
 			break;
@@ -468,7 +468,7 @@ static int remove_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
 	}
 	dw = part->dupliweights.last;
 
-	if(dw)
+	if (dw)
 		dw->flag |= PART_DUPLIW_CURRENT;
 
 	WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
@@ -479,15 +479,15 @@ static int remove_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
 void PARTICLE_OT_dupliob_remove(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove Particle Dupliobject";
-	ot->idname= "PARTICLE_OT_dupliob_remove";
-	ot->description="Remove the selected dupliobject";
+	ot->name = "Remove Particle Dupliobject";
+	ot->idname = "PARTICLE_OT_dupliob_remove";
+	ot->description = "Remove the selected dupliobject";
 	
 	/* api callbacks */
-	ot->exec= remove_particle_dupliob_exec;
+	ot->exec = remove_particle_dupliob_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /************************ move down particle dupliweight operator *********************/
@@ -499,12 +499,12 @@ static int dupliob_move_down_exec(bContext *C, wmOperator *UNUSED(op))
 	ParticleSettings *part;
 	ParticleDupliWeight *dw;
 
-	if(!psys)
+	if (!psys)
 		return OPERATOR_CANCELLED;
 
 	part = psys->part;
-	for(dw=part->dupliweights.first; dw; dw=dw->next) {
-		if(dw->flag & PART_DUPLIW_CURRENT && dw->next) {
+	for (dw=part->dupliweights.first; dw; dw=dw->next) {
+		if (dw->flag & PART_DUPLIW_CURRENT && dw->next) {
 			BLI_remlink(&part->dupliweights, dw);
 			BLI_insertlink(&part->dupliweights, dw->next, dw);
 
@@ -518,14 +518,14 @@ static int dupliob_move_down_exec(bContext *C, wmOperator *UNUSED(op))
 
 void PARTICLE_OT_dupliob_move_down(wmOperatorType *ot)
 {
-	ot->name= "Move Down Dupli Object";
-	ot->idname= "PARTICLE_OT_dupliob_move_down";
-	ot->description= "Move dupli object down in the list";
+	ot->name = "Move Down Dupli Object";
+	ot->idname = "PARTICLE_OT_dupliob_move_down";
+	ot->description = "Move dupli object down in the list";
 	
-	ot->exec= dupliob_move_down_exec;
+	ot->exec = dupliob_move_down_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /************************ connect/disconnect hair operators *********************/
@@ -542,27 +542,27 @@ static void disconnect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
 	int i, k;
 	float hairmat[4][4];
 
-	if(!ob || !psys || psys->flag & PSYS_GLOBAL_HAIR)
+	if (!ob || !psys || psys->flag & PSYS_GLOBAL_HAIR)
 		return;
 
-	if(!psys->part || psys->part->type != PART_HAIR)
+	if (!psys->part || psys->part->type != PART_HAIR)
 		return;
 	
 	edit = psys->edit;
 	point= edit ? edit->points : NULL;
 
-	for(i=0, pa=psys->particles; i<psys->totpart; i++,pa++) {
-		if(point) {
+	for (i=0, pa=psys->particles; i<psys->totpart; i++,pa++) {
+		if (point) {
 			ekey = point->keys;
 			point++;
 		}
 
 		psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, hairmat);
 
-		for(k=0,key=pa->hair; k<pa->totkey; k++,key++) {
+		for (k=0,key=pa->hair; k<pa->totkey; k++,key++) {
 			mul_m4_v3(hairmat,key->co);
 			
-			if(ekey) {
+			if (ekey) {
 				ekey->flag &= ~PEK_USE_WCO;
 				ekey++;
 			}
@@ -573,7 +573,7 @@ static void disconnect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
 
 	psys->flag |= PSYS_GLOBAL_HAIR;
 
-	if(ELEM(pset->brushtype, PE_BRUSH_ADD, PE_BRUSH_PUFF))
+	if (ELEM(pset->brushtype, PE_BRUSH_ADD, PE_BRUSH_PUFF))
 		pset->brushtype = PE_BRUSH_NONE;
 
 	PE_update_object(scene, ob, 0);
@@ -587,11 +587,11 @@ static int disconnect_hair_exec(bContext *C, wmOperator *op)
 	ParticleSystem *psys= NULL;
 	int all = RNA_boolean_get(op->ptr, "all");
 
-	if(!ob)
+	if (!ob)
 		return OPERATOR_CANCELLED;
 
-	if(all) {
-		for(psys=ob->particlesystem.first; psys; psys=psys->next) {
+	if (all) {
+		for (psys=ob->particlesystem.first; psys; psys=psys->next) {
 			disconnect_hair(scene, ob, psys);
 		}
 	}
@@ -608,14 +608,14 @@ static int disconnect_hair_exec(bContext *C, wmOperator *op)
 
 void PARTICLE_OT_disconnect_hair(wmOperatorType *ot)
 {
-	ot->name= "Disconnect Hair";
-	ot->description= "Disconnect hair from the emitter mesh";
-	ot->idname= "PARTICLE_OT_disconnect_hair";
+	ot->name = "Disconnect Hair";
+	ot->description = "Disconnect hair from the emitter mesh";
+	ot->idname = "PARTICLE_OT_disconnect_hair";
 	
-	ot->exec= disconnect_hair_exec;
+	ot->exec = disconnect_hair_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	RNA_def_boolean(ot->srna, "all", 0, "All hair", "Disconnect all hair systems from the emitter mesh");
 }
@@ -637,18 +637,22 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
 	float hairmat[4][4], imat[4][4];
 	float v[4][3], vec[3];
 
-	if(!psys || !psys->part || psys->part->type != PART_HAIR)
+	if (!psys || !psys->part || psys->part->type != PART_HAIR)
 		return;
 	
 	edit= psys->edit;
 	point=  edit ? edit->points : NULL;
 	
-	if(psmd->dm->deformedOnly)
+	if (psmd->dm->deformedOnly)
 		/* we don't want to mess up psmd->dm when converting to global coordinates below */
 		dm= CDDM_copy(psmd->dm);
 	else
 		dm= mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH);
 
+	/* BMESH_ONLY, deform dm may not have tessface */
+	DM_ensure_tessface(dm);
+
+
 	numverts = dm->getNumVerts (dm);
 
 	/* convert to global coordinates */
@@ -657,7 +661,7 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
 
 	bvhtree_from_mesh_faces(&bvhtree, dm, 0.0, 2, 6);
 
-	for(i=0, pa= psys->particles; i<psys->totpart; i++,pa++) {
+	for (i=0, pa= psys->particles; i<psys->totpart; i++,pa++) {
 		key = pa->hair;
 
 		nearest.index = -1;
@@ -665,18 +669,18 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
 
 		BLI_bvhtree_find_nearest(bvhtree.tree, key->co, &nearest, bvhtree.nearest_callback, &bvhtree);
 
-		if(nearest.index == -1) {
-			if (G.f & G_DEBUG)
+		if (nearest.index == -1) {
+			if (G.debug & G_DEBUG)
 				printf("No nearest point found for hair root!");
 			continue;
 		}
 
-		mface = CDDM_get_face(dm,nearest.index);
+		mface = CDDM_get_tessface(dm,nearest.index);
 
 		copy_v3_v3(v[0], CDDM_get_vert(dm,mface->v1)->co);
 		copy_v3_v3(v[1], CDDM_get_vert(dm,mface->v2)->co);
 		copy_v3_v3(v[2], CDDM_get_vert(dm,mface->v3)->co);
-		if(mface->v4) {
+		if (mface->v4) {
 			copy_v3_v3(v[3], CDDM_get_vert(dm,mface->v4)->co);
 			interp_weights_poly_v3( pa->fuv,v, 4, nearest.co);
 		}
@@ -691,16 +695,16 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
 
 		sub_v3_v3v3(vec, nearest.co, key->co);
 
-		if(point) {
+		if (point) {
 			ekey = point->keys;
 			point++;
 		}
 
-		for(k=0,key=pa->hair; k<pa->totkey; k++,key++) {
+		for (k=0,key=pa->hair; k<pa->totkey; k++,key++) {
 			add_v3_v3(key->co, vec);
 			mul_m4_v3(imat,key->co);
 
-			if(ekey) {
+			if (ekey) {
 				ekey->flag |= PEK_USE_WCO;
 				ekey++;
 			}
@@ -725,11 +729,11 @@ static int connect_hair_exec(bContext *C, wmOperator *op)
 	ParticleSystem *psys= NULL;
 	int all = RNA_boolean_get(op->ptr, "all");
 
-	if(!ob)
+	if (!ob)
 		return OPERATOR_CANCELLED;
 
-	if(all) {
-		for(psys=ob->particlesystem.first; psys; psys=psys->next) {
+	if (all) {
+		for (psys=ob->particlesystem.first; psys; psys=psys->next) {
 			connect_hair(scene, ob, psys);
 		}
 	}
@@ -746,14 +750,14 @@ static int connect_hair_exec(bContext *C, wmOperator *op)
 
 void PARTICLE_OT_connect_hair(wmOperatorType *ot)
 {
-	ot->name= "Connect Hair";
-	ot->description= "Connect hair to the emitter mesh";
-	ot->idname= "PARTICLE_OT_connect_hair";
+	ot->name = "Connect Hair";
+	ot->description = "Connect hair to the emitter mesh";
+	ot->idname = "PARTICLE_OT_connect_hair";
 	
-	ot->exec= connect_hair_exec;
+	ot->exec = connect_hair_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	RNA_def_boolean(ot->srna, "all", 0, "All hair", "Connect all hair systems to the emitter mesh");
 }
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index c528d8c..20fa4c5 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -98,19 +98,7 @@
 
 static float get_fluid_viscosity(FluidsimSettings *settings)
 {
-	switch (settings->viscosityMode) {
-		case 0:		/* unused */
-			return -1.0;
-		case 2:		/* water */
-			return 1.0e-6;
-		case 3:		/* some (thick) oil */
-			return 5.0e-5;
-		case 4:		/* ca. honey */
-			return 2.0e-3;
-		case 1:		/* manual */
-		default:
-			return (1.0f/powf(10.0f, settings->viscosityExponent)) * settings->viscosityValue;
-	}
+	return (1.0f/powf(10.0f, settings->viscosityExponent)) * settings->viscosityValue;
 }
 
 static float get_fluid_rate(FluidsimSettings *settings)
@@ -129,7 +117,8 @@ static void get_fluid_gravity(float *gravity, Scene *scene, FluidsimSettings *fs
 {
 	if (scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) {
 		copy_v3_v3(gravity, scene->physics_settings.gravity);
-	} else {
+	}
+	else {
 		copy_v3_v3(gravity, fss->grav);
 	}
 }
@@ -138,7 +127,8 @@ static float get_fluid_size_m(Scene *scene, Object *domainob, FluidsimSettings *
 {
 	if (!scene->unit.system) {
 		return fss->realsize;
-	} else {
+	}
+	else {
 		float dim[3];
 		float longest_axis;
 		
@@ -212,25 +202,27 @@ 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 {
+	}
+	else {
 		// invalid, cant happen?
 	}
 
-	fprintf(file, "      CHANNEL %s = \n", str); 
-	for(i=0; i<channelSize;i++) { 
+	fprintf(file, "      CHANNEL %s =\n", str);
+	for (i=0; i<channelSize;i++) { 
 		fprintf(file,"        ");  
-		for(j=0;j<=entries;j++) {  // also print time value
+		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");
 	} 
 
-	fprintf(file,  "      ; \n" ); 
+	fprintf(file,  "      ;\n" );
 }
 #endif
 
@@ -298,7 +290,7 @@ static void set_vertex_channel(float *channel, float time, struct Scene *scene,
 	}
 	
 	/* fill frame of channel with vertex locations */
-	for(j=0; j < (3*numVerts); j++) {
+	for (j=0; j < (3*numVerts); j++) {
 		channel[i*framesize + j] = verts[j];
 	}
 	channel[i*framesize + framesize-1] = time;
@@ -423,7 +415,7 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
 		
 		eval_time = domainSettings->bakeStart + i;
 		
-		/* XXX: This can't be used due to an anim sys optimisation that ignores recalc object animation,
+		/* XXX: This can't be used due to an anim sys optimization that ignores recalc object animation,
 		 * leaving it for the depgraph (this ignores object animation such as modifier properties though... :/ )
 		 * --> BKE_animsys_evaluate_all_animation(G.main, eval_time);
 		 * This doesn't work with drivers:
@@ -468,7 +460,7 @@ static void fluid_init_all_channels(bContext *C, Object *UNUSED(fsDomain), Fluid
 			
 			/* init euler rotation values and convert to elbeem format */
 			/* get the rotation from ob->obmat rather than ob->rot to account for parent animations */
-			if(i) {
+			if (i) {
 				copy_v3_v3(old_rot, fobj->Rotation + 4*(i-1));
 				mul_v3_fl(old_rot, -M_PI/180.f);
 			}
@@ -538,16 +530,16 @@ static void export_fluid_objects(ListBase *fobjects, Scene *scene, int length)
 		fsmesh.channelScale            = fobj->Scale;
 		fsmesh.channelActive           = fobj->Active;
 		
-		if( ELEM(fsmesh.type, OB_FLUIDSIM_FLUID, OB_FLUIDSIM_INFLOW)) {
+		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)
+		if (fluidmd->fss->typeFlags & OB_FSBND_NOSLIP)
 			fsmesh.obstacleType = FLUIDSIM_OBSTACLE_NOSLIP;
-		else if(fluidmd->fss->typeFlags & OB_FSBND_PARTSLIP)
+		else if (fluidmd->fss->typeFlags & OB_FSBND_PARTSLIP)
 			fsmesh.obstacleType = FLUIDSIM_OBSTACLE_PARTSLIP;
-		else if(fluidmd->fss->typeFlags & OB_FSBND_FREESLIP)
+		else if (fluidmd->fss->typeFlags & OB_FSBND_FREESLIP)
 			fsmesh.obstacleType = FLUIDSIM_OBSTACLE_FREESLIP;
 		
 		fsmesh.obstaclePartslip = fluidmd->fss->partSlipValue;
@@ -578,7 +570,7 @@ static void export_fluid_objects(ListBase *fobjects, Scene *scene, int length)
 		}
 		
 		/* animated meshes */
-		if(deform) {
+		if (deform) {
 			fsmesh.channelSizeVertices = length;
 			fsmesh.channelVertices = fobj->VertexCache;
 				
@@ -590,8 +582,8 @@ static void export_fluid_objects(ListBase *fobjects, Scene *scene, int length)
 		
 		elbeemAddMesh(&fsmesh);
 		
-		if(verts) MEM_freeN(verts);
-		if(tris) MEM_freeN(tris);
+		if (verts) MEM_freeN(verts);
+		if (tris) MEM_freeN(tris);
 	}
 }
 
@@ -602,7 +594,7 @@ static int fluid_validate_scene(ReportList *reports, Scene *scene, Object *fsDom
 	int channelObjCount = 0;
 	int fluidInputCount = 0;
 
-	for(base=scene->base.first; base; base= base->next)
+	for (base=scene->base.first; base; base= base->next)
 	{
 		Object *ob = base->object;
 		FluidsimModifierData *fluidmdtmp = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);			
@@ -610,7 +602,7 @@ static int fluid_validate_scene(ReportList *reports, Scene *scene, Object *fsDom
 		/* only find objects with fluid modifiers */
 		if (!fluidmdtmp || ob->type != OB_MESH) continue;
 			
-		if(fluidmdtmp->fss->type == OB_FLUIDSIM_DOMAIN) {
+		if (fluidmdtmp->fss->type == OB_FLUIDSIM_DOMAIN) {
 			/* if no initial domain object given, find another potential domain */
 			if (!fsDomain) {
 				newdomain = ob;
@@ -654,6 +646,7 @@ static int fluid_validate_scene(ReportList *reports, Scene *scene, Object *fsDom
 
 
 #define FLUID_SUFFIX_CONFIG		"fluidsim.cfg"
+#define FLUID_SUFFIX_CONFIG_TMP	(FLUID_SUFFIX_CONFIG ".tmp")
 #define FLUID_SUFFIX_SURFACE	"fluidsurface"
 
 static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetFile, char *debugStrBuffer)
@@ -663,7 +656,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
 	FILE *fileCfg;
 	int dirExist = 0;
 	char newSurfdataPath[FILE_MAX]; // modified output settings
-	const char *suffixConfig = FLUID_SUFFIX_CONFIG;
+	const char *suffixConfigTmp = FLUID_SUFFIX_CONFIG_TMP;
 	int outStringsChanged = 0;
 
 	// prepare names...
@@ -673,9 +666,8 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
 	BLI_strncpy(newSurfdataPath, domainSettings->surfdataPath, FILE_MAXDIR); /* if 0'd out below, this value is never used! */
 	BLI_path_abs(targetDir, relbase); // fixed #frame-no
 
-	BLI_join_dirfile(targetFile, FILE_MAX, targetDir, suffixConfig);
-	/* .tmp: dont overwrite/delete original file */
-	strncat(targetFile, ".tmp", FILE_MAX);
+	/* .tmp: don't overwrite/delete original file */
+	BLI_join_dirfile(targetFile, FILE_MAX, targetDir, suffixConfigTmp);
 
 	// make sure all directories exist
 	// as the bobjs use the same dir, this only needs to be checked
@@ -684,14 +676,14 @@ 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 = fopen(targetFile, "w");
-	if(fileCfg) { 
+	fileCfg = BLI_fopen(targetFile, "w");
+	if (fileCfg) { 
 		dirExist = 1; fclose(fileCfg); 
 		// remove cfg dummy from  directory test
 		BLI_delete(targetFile, 0,0);
 	}
 	
-	if(targetDir[0] == '\0' || (!dirExist)) {
+	if (targetDir[0] == '\0' || (!dirExist)) {
 		char blendDir[FILE_MAX];
 		char blendFile[FILE_MAX];
 		
@@ -709,7 +701,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
 	
 	// check if modified output dir is ok
 #if 0
-	if(outStringsChanged) {
+	if (outStringsChanged) {
 		char dispmsg[FILE_MAX+256];
 		int  selection=0;
 		BLI_strncpy(dispmsg,"Output settings set to: '", sizeof(dispmsg));
@@ -718,7 +710,7 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF
 		
 		// ask user if thats what he/she wants...
 		selection = pupmenu(dispmsg);
-		if(selection<1) return 0; // 0 from menu, or -1 aborted
+		if (selection<1) return 0; // 0 from menu, or -1 aborted
 		BLI_strncpy(targetDir, newSurfdataPath, sizeof(targetDir));
 		strncpy(domainSettings->surfdataPath, newSurfdataPath, FILE_MAXDIR);
 		BLI_path_abs(targetDir, G.main->name); // fixed #frame-no 
@@ -751,7 +743,7 @@ static int fluidbake_breakjob(void *customdata)
 {
 	FluidBakeJob *fb= (FluidBakeJob *)customdata;
 
-	if(fb->stop && *(fb->stop))
+	if (fb->stop && *(fb->stop))
 		return 1;
 	
 	/* this is not nice yet, need to make the jobs list template better 
@@ -801,10 +793,10 @@ int runSimulationCallback(void *data, int status, int frame)
 	
 	if (status == FLUIDSIM_CBSTATUS_NEWFRAME) {
 		fluidbake_updatejob(fb, frame / (float)settings->noOfFrames);
-		//printf("elbeem blender cb s%d, f%d, domainid:%d noOfFrames: %d \n", status,frame, settings->domainId, settings->noOfFrames ); // DEBUG
+		//printf("elbeem blender cb s%d, f%d, domainid:%d noOfFrames: %d\n", status,frame, settings->domainId, settings->noOfFrames ); // DEBUG
 	}
 	
-	if (fluidbake_breakjob(fb))  {
+	if (fluidbake_breakjob(fb)) {
 		return FLUIDSIM_CBRET_ABORT;
 	}
 	
@@ -860,13 +852,12 @@ static void fluidsim_delete_until_lastframe(FluidsimSettings *fss, const char *r
 
 		curFrame++;
 
-		if((exists = BLI_exists(targetFile)))
-		{
+		if ((exists = BLI_exists(targetFile))) {
 			BLI_delete(targetFile, 0, 0);
 			BLI_delete(targetFileVel, 0, 0);
 			BLI_delete(previewFile, 0, 0);
 		}
-	} while(exists);
+	} while (exists);
 
 	return;
 }
@@ -882,7 +873,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
 	int gridlevels = 0;
 	const char *relbase= modifier_path_relbase(fsDomain);
 	const char *strEnvName = "BLENDER_ELBEEMDEBUG"; // from blendercall.cpp
-	const char *suffixConfig = FLUID_SUFFIX_CONFIG;
+	const char *suffixConfigTmp = FLUID_SUFFIX_CONFIG_TMP;
 	const char *suffixSurface = FLUID_SUFFIX_SURFACE;
 
 	char targetDir[FILE_MAX];  // store & modify output settings
@@ -905,7 +896,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
 
 	fb= MEM_callocN(sizeof(FluidBakeJob), "fluid bake job");
 	
-	if(getenv(strEnvName)) {
+	if (getenv(strEnvName)) {
 		int dlevel = atoi(getenv(strEnvName));
 		elbeemSetDebugLevel(dlevel);
 		BLI_snprintf(debugStrBuffer, sizeof(debugStrBuffer),"fluidsimBake::msg: Debug messages activated due to envvar '%s'\n",strEnvName);
@@ -914,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) {
+	if (noFrames<=0) {
 		BKE_report(reports, RPT_ERROR, "No frames to export - check your animation range settings");
 		fluidbake_free_data(channels, fobjects, fsset, fb);
 		return 0;
@@ -944,7 +935,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
 	fluidsim_delete_until_lastframe(domainSettings, relbase);
 	
 	/* rough check of settings... */
-	if(domainSettings->previewresxyz > domainSettings->resolutionxyz) {
+	if (domainSettings->previewresxyz > domainSettings->resolutionxyz) {
 		BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"fluidsimBake::warning - Preview (%d) >= Resolution (%d)... setting equal.\n", domainSettings->previewresxyz ,  domainSettings->resolutionxyz);
 		elbeemDebugOut(debugStrBuffer);
 		domainSettings->previewresxyz = domainSettings->resolutionxyz;
@@ -953,16 +944,19 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
 	// this should do as an approximation, with in/outflow
 	// doing this more accurate would be overkill
 	// perhaps add manual setting?
-	if(domainSettings->maxRefine <0) {
-		if(domainSettings->resolutionxyz>128) {
+	if (domainSettings->maxRefine <0) {
+		if (domainSettings->resolutionxyz>128) {
 			gridlevels = 2;
-		} else
-		if(domainSettings->resolutionxyz>64) {
+		}
+		else
+		if (domainSettings->resolutionxyz>64) {
 			gridlevels = 1;
-		} else {
+		}
+		else {
 			gridlevels = 0;
 		}
-	} else {
+	}
+	else {
 		gridlevels = domainSettings->maxRefine;
 	}
 	BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"fluidsimBake::msg: Baking %s, refine: %d\n", fsDomain->id.name , gridlevels );
@@ -975,7 +969,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
 	channels->length = scene->r.efra;
 	channels->aniFrameTime = (domainSettings->animEnd - domainSettings->animStart)/(double)noFrames;
 	
-	/* ******** initialise and allocate animation channels ******** */
+	/* ******** initialize and allocate animation channels ******** */
 	fluid_init_all_channels(C, fsDomain, domainSettings, channels, fobjects);
 
 	/* reset to original current frame */
@@ -984,7 +978,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
 		
 	/* ******** init domain object's matrix ******** */
 	copy_m4_m4(domainMat, fsDomain->obmat);
-	if(!invert_m4_m4(invDomMat, domainMat)) {
+	if (!invert_m4_m4(invDomMat, domainMat)) {
 		BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"fluidsimBake::error - Invalid obj matrix?\n");
 		elbeemDebugOut(debugStrBuffer);
 		BKE_report(reports, RPT_ERROR, "Invalid object matrix"); 
@@ -994,12 +988,11 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
 	}
 
 	/* ********  start writing / exporting ******** */
-	// use .tmp, dont overwrite/delete original file
-	BLI_join_dirfile(targetFile, sizeof(targetFile), targetDir, suffixConfig);
-	strncat(targetFile, ".tmp", sizeof(targetFile));
+	// use .tmp, don't overwrite/delete original file
+	BLI_join_dirfile(targetFile, sizeof(targetFile), targetDir, suffixConfigTmp);
 	
 	// make sure these directories exist as well
-	if(outStringsChanged) {
+	if (outStringsChanged) {
 		BLI_make_existing_file(targetFile);
 	}
 
@@ -1053,7 +1046,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
 	fsset->domainobsPartslip = domainSettings->partSlipValue;
 
 	/* use domainobsType also for surface generation flag (bit: >=64) */
-	if(domainSettings->typeFlags & OB_FSSG_NOOBS)
+	if (domainSettings->typeFlags & OB_FSSG_NOOBS)
 		fsset->mFsSurfGenSetting = FLUIDSIM_FSSG_NOOBS;
 	else
 		fsset->mFsSurfGenSetting = 0; // "normal" mode
@@ -1062,8 +1055,8 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
 
 	// init blender domain transform matrix
 	{ int j; 
-	for(i=0; i<4; i++) {
-		for(j=0; j<4; j++) {
+	for (i=0; i<4; i++) {
+		for (j=0; j<4; j++) {
 			fsset->surfaceTrafo[i*4+j] = invDomMat[j][i];
 		}
 	} }
@@ -1078,7 +1071,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
 	/* custom data for fluid bake job */
 	fb->settings = fsset;
 	
-	if(do_job) {
+	if (do_job) {
 		wmJob *steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Fluid Simulation", WM_JOB_PROGRESS);
 
 		/* setup job */
@@ -1141,10 +1134,10 @@ static int fluidsimBake(bContext *UNUSED(C), ReportList *UNUSED(reports), Object
 static int fluid_bake_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
 	/* only one bake job at a time */
-	if(WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C)))
+	if (WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C)))
 		return OPERATOR_CANCELLED;
 
-	if(!fluidsimBake(C, op->reports, CTX_data_active_object(C), TRUE))
+	if (!fluidsimBake(C, op->reports, CTX_data_active_object(C), TRUE))
 		return OPERATOR_CANCELLED;
 
 	return OPERATOR_FINISHED;
@@ -1152,7 +1145,7 @@ static int fluid_bake_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
 
 static int fluid_bake_exec(bContext *C, wmOperator *op)
 {
-	if(!fluidsimBake(C, op->reports, CTX_data_active_object(C), FALSE))
+	if (!fluidsimBake(C, op->reports, CTX_data_active_object(C), FALSE))
 		return OPERATOR_CANCELLED;
 
 	return OPERATOR_FINISHED;
@@ -1161,13 +1154,13 @@ static int fluid_bake_exec(bContext *C, wmOperator *op)
 void FLUID_OT_bake(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Fluid Simulation Bake";
-	ot->description= "Bake fluid simulation";
-	ot->idname= "FLUID_OT_bake";
+	ot->name = "Fluid Simulation Bake";
+	ot->description = "Bake fluid simulation";
+	ot->idname = "FLUID_OT_bake";
 	
 	/* api callbacks */
-	ot->invoke= fluid_bake_invoke;
-	ot->exec= fluid_bake_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->invoke = fluid_bake_invoke;
+	ot->exec = fluid_bake_exec;
+	ot->poll = ED_operator_object_active_editable;
 }
 
diff --git a/source/blender/editors/physics/physics_intern.h b/source/blender/editors/physics/physics_intern.h
index db6d63f..75779cf 100644
--- a/source/blender/editors/physics/physics_intern.h
+++ b/source/blender/editors/physics/physics_intern.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef ED_PHYSICS_INTERN_H
-#define ED_PHYSICS_INTERN_H
+#ifndef __PHYSICS_INTERN_H__
+#define __PHYSICS_INTERN_H__
 
 struct wmOperatorType;
 
@@ -105,5 +105,5 @@ void PTCACHE_OT_bake_from_cache(struct wmOperatorType *ot);
 void PTCACHE_OT_add(struct wmOperatorType *ot);
 void PTCACHE_OT_remove(struct wmOperatorType *ot);
 
-#endif /* ED_PHYSICS_INTERN_H */
+#endif /* __PHYSICS_INTERN_H__ */
 
diff --git a/source/blender/editors/physics/physics_ops.c b/source/blender/editors/physics/physics_ops.c
index 473ed50..272e13e 100644
--- a/source/blender/editors/physics/physics_ops.c
+++ b/source/blender/editors/physics/physics_ops.c
@@ -93,8 +93,8 @@ static void keymap_particle(wmKeyConfig *keyconf)
 	wmKeyMapItem *kmi;
 	wmKeyMap *keymap;
 	
-	keymap= WM_keymap_find(keyconf, "Particle", 0, 0);
-	keymap->poll= PE_poll;
+	keymap = WM_keymap_find(keyconf, "Particle", 0, 0);
+	keymap->poll = PE_poll;
 	
 	kmi = WM_keymap_add_item(keymap, "PARTICLE_OT_select_all", AKEY, KM_PRESS, 0, 0);
 	RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
@@ -187,7 +187,7 @@ static void operatortypes_dynamicpaint(void)
 
 //static void keymap_pointcache(wmWindowManager *wm)
 //{
-//	wmKeyMap *keymap= WM_keymap_find(wm, "Pointcache", 0, 0);
+//	wmKeyMap *keymap = WM_keymap_find(wm, "Pointcache", 0, 0);
 //	
 //	WM_keymap_add_item(keymap, "PHYSICS_OT_bake_all", AKEY, KM_PRESS, 0, 0);
 //	WM_keymap_add_item(keymap, "PHYSICS_OT_free_all", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c
index 62e0e5e..6573647 100644
--- a/source/blender/editors/physics/physics_pointcache.c
+++ b/source/blender/editors/physics/physics_pointcache.c
@@ -67,7 +67,7 @@ static int ptcache_bake_all_poll(bContext *C)
 {
 	Scene *scene= CTX_data_scene(C);
 
-	if(!scene)
+	if (!scene)
 		return 0;
 	
 	return 1;
@@ -114,7 +114,8 @@ static int ptcache_bake_all_exec(bContext *C, wmOperator *op)
 		baker.progressbar = (void (*)(void *, int))WM_timecursor;
 		baker.progressend = (void (*)(void *))WM_cursor_restore;
 		baker.progresscontext = win;
-	} else {
+	}
+	else {
 		baker.progressbar = bake_console_progress;
 		baker.progressend = bake_console_progress_end;
 		baker.progresscontext = NULL;
@@ -134,10 +135,10 @@ static int ptcache_free_bake_all_exec(bContext *C, wmOperator *UNUSED(op))
 	PTCacheID *pid;
 	ListBase pidlist;
 
-	for(base=scene->base.first; base; base= base->next) {
+	for (base=scene->base.first; base; base= base->next) {
 		BKE_ptcache_ids_from_object(&pidlist, base->object, scene, MAX_DUPLI_RECUR);
 
-		for(pid=pidlist.first; pid; pid=pid->next) {
+		for (pid=pidlist.first; pid; pid=pid->next) {
 			pid->cache->flag &= ~PTCACHE_BAKED;
 		}
 		
@@ -154,31 +155,31 @@ static int ptcache_free_bake_all_exec(bContext *C, wmOperator *UNUSED(op))
 void PTCACHE_OT_bake_all(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Bake All Physics";
-	ot->description= "Bake all physics";
-	ot->idname= "PTCACHE_OT_bake_all";
+	ot->name = "Bake All Physics";
+	ot->description = "Bake all physics";
+	ot->idname = "PTCACHE_OT_bake_all";
 	
 	/* api callbacks */
-	ot->exec= ptcache_bake_all_exec;
-	ot->poll= ptcache_bake_all_poll;
+	ot->exec = ptcache_bake_all_exec;
+	ot->poll = ptcache_bake_all_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	RNA_def_boolean(ot->srna, "bake", 1, "Bake", "");
 }
 void PTCACHE_OT_free_bake_all(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Free All Physics Bakes";
-	ot->idname= "PTCACHE_OT_free_bake_all";
+	ot->name = "Free All Physics Bakes";
+	ot->idname = "PTCACHE_OT_free_bake_all";
 	
 	/* api callbacks */
-	ot->exec= ptcache_free_bake_all_exec;
-	ot->poll= ptcache_bake_all_poll;
+	ot->exec = ptcache_free_bake_all_exec;
+	ot->poll = ptcache_bake_all_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 static int ptcache_bake_exec(bContext *C, wmOperator *op)
 {
@@ -194,8 +195,8 @@ static int ptcache_bake_exec(bContext *C, wmOperator *op)
 
 	BKE_ptcache_ids_from_object(&pidlist, ob, scene, MAX_DUPLI_RECUR);
 	
-	for(pid=pidlist.first; pid; pid=pid->next) {
-		if(pid->cache == cache)
+	for (pid=pidlist.first; pid; pid=pid->next) {
+		if (pid->cache == cache)
 			break;
 	}
 
@@ -216,7 +217,8 @@ static int ptcache_bake_exec(bContext *C, wmOperator *op)
 		baker.progressbar = (void (*)(void *, int))WM_timecursor;
 		baker.progressend = (void (*)(void *))WM_cursor_restore;
 		baker.progresscontext = win;
-	} else {
+	}
+	else {
 		printf("\n"); /* empty first line before console reports */
 		baker.progressbar = bake_console_progress;
 		baker.progressend = bake_console_progress_end;
@@ -238,8 +240,8 @@ static int ptcache_free_bake_exec(bContext *C, wmOperator *UNUSED(op))
 	PointCache *cache= ptr.data;
 	Object *ob= ptr.id.data;
 
-	if(cache->edit) {
-		if(!cache->edit->edited || 1) {// XXX okee("Lose changes done in particle mode?")) {
+	if (cache->edit) {
+		if (!cache->edit->edited || 1) {// XXX okee("Lose changes done in particle mode?")) {
 			PE_free_ptcache_edit(cache->edit);
 			cache->edit = NULL;
 			cache->flag &= ~PTCACHE_BAKED;
@@ -267,46 +269,46 @@ static int ptcache_bake_from_cache_exec(bContext *C, wmOperator *UNUSED(op))
 void PTCACHE_OT_bake(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Bake Physics";
-	ot->description= "Bake physics";
-	ot->idname= "PTCACHE_OT_bake";
+	ot->name = "Bake Physics";
+	ot->description = "Bake physics";
+	ot->idname = "PTCACHE_OT_bake";
 	
 	/* api callbacks */
-	ot->exec= ptcache_bake_exec;
-	ot->poll= ptcache_poll;
+	ot->exec = ptcache_bake_exec;
+	ot->poll = ptcache_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	RNA_def_boolean(ot->srna, "bake", 0, "Bake", "");
 }
 void PTCACHE_OT_free_bake(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Free Physics Bake";
-	ot->description= "Free physics bake";
-	ot->idname= "PTCACHE_OT_free_bake";
+	ot->name = "Free Physics Bake";
+	ot->description = "Free physics bake";
+	ot->idname = "PTCACHE_OT_free_bake";
 	
 	/* api callbacks */
-	ot->exec= ptcache_free_bake_exec;
-	ot->poll= ptcache_poll;
+	ot->exec = ptcache_free_bake_exec;
+	ot->poll = ptcache_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 void PTCACHE_OT_bake_from_cache(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Bake From Cache";
-	ot->description= "Bake from cache";
-	ot->idname= "PTCACHE_OT_bake_from_cache";
+	ot->name = "Bake From Cache";
+	ot->description = "Bake from cache";
+	ot->idname = "PTCACHE_OT_bake_from_cache";
 	
 	/* api callbacks */
-	ot->exec= ptcache_bake_from_cache_exec;
-	ot->poll= ptcache_poll;
+	ot->exec = ptcache_bake_from_cache_exec;
+	ot->poll = ptcache_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int ptcache_add_new_exec(bContext *C, wmOperator *UNUSED(op))
@@ -320,8 +322,8 @@ static int ptcache_add_new_exec(bContext *C, wmOperator *UNUSED(op))
 
 	BKE_ptcache_ids_from_object(&pidlist, ob, scene, MAX_DUPLI_RECUR);
 	
-	for(pid=pidlist.first; pid; pid=pid->next) {
-		if(pid->cache == cache) {
+	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;
@@ -347,9 +349,9 @@ static int ptcache_remove_exec(bContext *C, wmOperator *UNUSED(op))
 
 	BKE_ptcache_ids_from_object(&pidlist, ob, scene, MAX_DUPLI_RECUR);
 	
-	for(pid=pidlist.first; pid; pid=pid->next) {
-		if(pid->cache == cache) {
-			if(pid->ptcaches->first == pid->ptcaches->last)
+	for (pid=pidlist.first; pid; pid=pid->next) {
+		if (pid->cache == cache) {
+			if (pid->ptcaches->first == pid->ptcaches->last)
 				continue; /* don't delete last cache */
 
 			BLI_remlink(pid->ptcaches, pid->cache);
@@ -369,29 +371,29 @@ static int ptcache_remove_exec(bContext *C, wmOperator *UNUSED(op))
 void PTCACHE_OT_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add New Cache";
-	ot->description= "Add new cache";
-	ot->idname= "PTCACHE_OT_add";
+	ot->name = "Add New Cache";
+	ot->description = "Add new cache";
+	ot->idname = "PTCACHE_OT_add";
 	
 	/* api callbacks */
-	ot->exec= ptcache_add_new_exec;
-	ot->poll= ptcache_poll; // ptcache_bake_all_poll;
+	ot->exec = ptcache_add_new_exec;
+	ot->poll = ptcache_poll; // ptcache_bake_all_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 void PTCACHE_OT_remove(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete Current Cache";
-	ot->description= "Delete current cache";
-	ot->idname= "PTCACHE_OT_remove";
+	ot->name = "Delete Current Cache";
+	ot->description = "Delete current cache";
+	ot->idname = "PTCACHE_OT_remove";
 	
 	/* api callbacks */
-	ot->exec= ptcache_remove_exec;
-	ot->poll= ptcache_poll;
+	ot->exec = ptcache_remove_exec;
+	ot->poll = ptcache_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
diff --git a/source/blender/editors/render/CMakeLists.txt b/source/blender/editors/render/CMakeLists.txt
index cf6846f..3c5fd0b 100644
--- a/source/blender/editors/render/CMakeLists.txt
+++ b/source/blender/editors/render/CMakeLists.txt
@@ -26,6 +26,7 @@ set(INC
 	../../blenloader
 	../../gpu
 	../../imbuf
+	../../bmesh
 	../../makesdna
 	../../makesrna
 	../../render/extern/include
diff --git a/source/blender/editors/render/SConscript b/source/blender/editors/render/SConscript
index 5341850..0b19ecd 100644
--- a/source/blender/editors/render/SConscript
+++ b/source/blender/editors/render/SConscript
@@ -7,13 +7,13 @@ incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
 incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
 incs += ' ../../gpu'
 incs += ' ../../makesrna ../../render/extern/include  #/intern/elbeem/extern'
-incs += ' ../../blenloader'
+incs += ' ../../blenloader ../../bmesh'
 
 if env['OURPLATFORM'] == 'linux':
     cflags='-pthread'
     incs += ' ../../../extern/binreloc/include'
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
 
 
diff --git a/source/blender/editors/render/render_intern.h b/source/blender/editors/render/render_intern.h
index 0800168..18ba2b5 100644
--- a/source/blender/editors/render/render_intern.h
+++ b/source/blender/editors/render/render_intern.h
@@ -29,8 +29,8 @@
  */
 
 
-#ifndef RENDER_INTERN_H
-#define RENDER_INTERN_H
+#ifndef __RENDER_INTERN_H__
+#define __RENDER_INTERN_H__
 
 struct wmOperatorType;
 struct RenderResult;
@@ -77,5 +77,5 @@ void RENDER_OT_view_cancel(struct wmOperatorType *ot);
 /* render_opengl.c */
 void RENDER_OT_opengl(struct wmOperatorType *ot);
 
-#endif /* RENDER_INTERN_H */
+#endif /* __RENDER_INTERN_H__ */
 
diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c
index e35df21..1a2e42d 100644
--- a/source/blender/editors/render/render_internal.c
+++ b/source/blender/editors/render/render_internal.c
@@ -76,107 +76,107 @@
 /* called inside thread! */
 void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volatile rcti *renrect)
 {
-	float *rectf= NULL;
+	float *rectf = NULL;
 	int ymin, ymax, xmin, xmax;
 	int rymin, rxmin, predivide, profile_from;
 	unsigned char *rectc;
 
 	/* if renrect argument, we only refresh scanlines */
-	if(renrect) {
+	if (renrect) {
 		/* if ymax==recty, rendering of layer is ready, we should not draw, other things happen... */
-		if(rr->renlay==NULL || renrect->ymax>=rr->recty)
+		if (rr->renlay == NULL || renrect->ymax >= rr->recty)
 			return;
 
 		/* xmin here is first subrect x coord, xmax defines subrect width */
 		xmin = renrect->xmin + rr->crop;
 		xmax = renrect->xmax - xmin + rr->crop;
-		if(xmax<2)
+		if (xmax < 2)
 			return;
 
-		ymin= renrect->ymin + rr->crop;
-		ymax= renrect->ymax - ymin + rr->crop;
-		if(ymax<2)
+		ymin = renrect->ymin + rr->crop;
+		ymax = renrect->ymax - ymin + rr->crop;
+		if (ymax < 2)
 			return;
-		renrect->ymin= renrect->ymax;
+		renrect->ymin = renrect->ymax;
 
 	}
 	else {
 		xmin = ymin = rr->crop;
-		xmax = rr->rectx - 2*rr->crop;
-		ymax = rr->recty - 2*rr->crop;
+		xmax = rr->rectx - 2 * rr->crop;
+		ymax = rr->recty - 2 * rr->crop;
 	}
 
 	/* xmin ymin is in tile coords. transform to ibuf */
-	rxmin= rr->tilerect.xmin + xmin;
-	if(rxmin >= ibuf->x) return;
-	rymin= rr->tilerect.ymin + ymin;
-	if(rymin >= ibuf->y) return;
+	rxmin = rr->tilerect.xmin + xmin;
+	if (rxmin >= ibuf->x) return;
+	rymin = rr->tilerect.ymin + ymin;
+	if (rymin >= ibuf->y) return;
 
-	if(rxmin + xmax > ibuf->x)
-		xmax= ibuf->x - rxmin;
-	if(rymin + ymax > ibuf->y)
-		ymax= ibuf->y - rymin;
+	if (rxmin + xmax > ibuf->x)
+		xmax = ibuf->x - rxmin;
+	if (rymin + ymax > ibuf->y)
+		ymax = ibuf->y - rymin;
 
-	if(xmax < 1 || ymax < 1) return;
+	if (xmax < 1 || ymax < 1) return;
 
-	/* find current float rect for display, first case is after composit... still weak */
-	if(rr->rectf)
-		rectf= rr->rectf;
+	/* find current float rect for display, first case is after composite... still weak */
+	if (rr->rectf)
+		rectf = rr->rectf;
 	else {
-		if(rr->rect32)
+		if (rr->rect32)
 			return;
 		else {
-			if(rr->renlay==NULL || rr->renlay->rectf==NULL) return;
-			rectf= rr->renlay->rectf;
+			if (rr->renlay == NULL || rr->renlay->rectf == NULL) return;
+			rectf = rr->renlay->rectf;
 		}
 	}
-	if(rectf==NULL) return;
+	if (rectf == NULL) return;
 
-	if(ibuf->rect==NULL)
+	if (ibuf->rect == NULL)
 		imb_addrectImBuf(ibuf);
 	
-	rectf+= 4*(rr->rectx*ymin + xmin);
-	rectc= (unsigned char*)(ibuf->rect + ibuf->x*rymin + rxmin);
+	rectf += 4 * (rr->rectx * ymin + xmin);
+	rectc = (unsigned char *)(ibuf->rect + ibuf->x * rymin + rxmin);
 
-	if(scene && (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)) {
-		profile_from= IB_PROFILE_LINEAR_RGB;
-		predivide= (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT_PREDIVIDE);
+	if (scene && (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)) {
+		profile_from = IB_PROFILE_LINEAR_RGB;
+		predivide = (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT_PREDIVIDE);
 	}
 	else {
-		profile_from= IB_PROFILE_SRGB;
-		predivide= 0;
+		profile_from = IB_PROFILE_SRGB;
+		predivide = 0;
 	}
 
 	IMB_buffer_byte_from_float(rectc, rectf,
-		4, ibuf->dither, IB_PROFILE_SRGB, profile_from, predivide,
-		xmax, ymax, ibuf->x, rr->rectx);
+	                           4, ibuf->dither, IB_PROFILE_SRGB, profile_from, predivide,
+	                           xmax, ymax, ibuf->x, rr->rectx);
 }
 
 /* ****************************** render invoking ***************** */
 
 /* set callbacks, exported to sequence render too.
- Only call in foreground (UI) renders. */
+ * Only call in foreground (UI) renders. */
 
 static void screen_render_scene_layer_set(wmOperator *op, Main *mainp, Scene **scene, SceneRenderLayer **srl)
 {
 	/* single layer re-render */
-	if(RNA_struct_property_is_set(op->ptr, "scene")) {
+	if (RNA_struct_property_is_set(op->ptr, "scene")) {
 		Scene *scn;
-		char scene_name[MAX_ID_NAME-2];
+		char scene_name[MAX_ID_NAME - 2];
 
 		RNA_string_get(op->ptr, "scene", scene_name);
 		scn = (Scene *)BLI_findstring(&mainp->scene, scene_name, offsetof(ID, name) + 2);
 		
 		if (scn) {
 			/* camera switch wont have updated */
-			scn->r.cfra= (*scene)->r.cfra;
+			scn->r.cfra = (*scene)->r.cfra;
 			scene_camera_switch_update(scn);
 
 			*scene = scn;
 		}
 	}
 
-	if(RNA_struct_property_is_set(op->ptr, "layer")) {
+	if (RNA_struct_property_is_set(op->ptr, "layer")) {
 		SceneRenderLayer *rl;
 		char rl_name[RE_MAXNAME];
 
@@ -191,44 +191,44 @@ static void screen_render_scene_layer_set(wmOperator *op, Main *mainp, Scene **s
 /* executes blocking render */
 static int screen_render_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	SceneRenderLayer *srl= NULL;
+	Scene *scene = CTX_data_scene(C);
+	SceneRenderLayer *srl = NULL;
 	Render *re;
 	Image *ima;
-	View3D *v3d= CTX_wm_view3d(C);
-	Main *mainp= CTX_data_main(C);
+	View3D *v3d = CTX_wm_view3d(C);
+	Main *mainp = CTX_data_main(C);
 	unsigned int lay;
-	const short is_animation= RNA_boolean_get(op->ptr, "animation");
-	const short is_write_still= RNA_boolean_get(op->ptr, "write_still");
-	struct Object *camera_override= v3d ? V3D_CAMERA_LOCAL(v3d) : NULL;
+	const short is_animation = RNA_boolean_get(op->ptr, "animation");
+	const short is_write_still = RNA_boolean_get(op->ptr, "write_still");
+	struct Object *camera_override = v3d ? V3D_CAMERA_LOCAL(v3d) : NULL;
 
 	/* custom scene and single layer re-render */
 	screen_render_scene_layer_set(op, mainp, &scene, &srl);
 
-	if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
+	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");
 		return OPERATOR_CANCELLED;
 	}
 
-	re= RE_NewRender(scene->id.name);
-	lay= (v3d)? v3d->lay: scene->lay;
+	re = RE_NewRender(scene->id.name);
+	lay = (v3d) ? v3d->lay : scene->lay;
 
-	G.afbreek= 0;
-	RE_test_break_cb(re, NULL, (int (*)(void *)) blender_test_break);
+	G.afbreek = 0;
+	RE_test_break_cb(re, NULL, (int (*)(void *))blender_test_break);
 
-	ima= BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
+	ima = BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
 	BKE_image_signal(ima, NULL, IMA_SIGNAL_FREE);
 	BKE_image_backup_render(scene, ima);
 
 	/* cleanup sequencer caches before starting user triggered render.
-	   otherwise, invalidated cache entries can make their way into
-	   the output rendering. We can't put that into RE_BlenderFrame,
-	   since sequence rendering can call that recursively... (peter) */
+	 * otherwise, invalidated cache entries can make their way into
+	 * the output rendering. We can't put that into RE_BlenderFrame,
+	 * since sequence rendering can call that recursively... (peter) */
 	seq_stripelem_cache_cleanup();
 
 	RE_SetReports(re, op->reports);
 
-	if(is_animation)
+	if (is_animation)
 		RE_BlenderAnim(re, mainp, scene, camera_override, lay, scene->r.sfra, scene->r.efra, scene->r.frame_step);
 	else
 		RE_BlenderFrame(re, mainp, scene, srl, camera_override, lay, scene->r.cfra, is_write_still);
@@ -238,7 +238,7 @@ static int screen_render_exec(bContext *C, wmOperator *op)
 	// no redraw needed, we leave state as we entered it
 	ED_update_for_newframe(mainp, scene, CTX_wm_screen(C), 1);
 
-	WM_event_add_notifier(C, NC_SCENE|ND_RENDER_RESULT, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, scene);
 
 	return OPERATOR_FINISHED;
 }
@@ -262,7 +262,7 @@ typedef struct RenderJob {
 
 static void render_freejob(void *rjv)
 {
-	RenderJob *rj= rjv;
+	RenderJob *rj = rjv;
 
 	MEM_freeN(rj);
 }
@@ -270,69 +270,69 @@ static void render_freejob(void *rjv)
 /* str is IMA_MAX_RENDER_TEXT in size */
 static void make_renderinfo_string(RenderStats *rs, Scene *scene, char *str)
 {
-	char info_time_str[32];	// used to be extern to header_info.c
+	char info_time_str[32]; // used to be extern to header_info.c
 	uintptr_t mem_in_use, mmap_in_use, peak_memory;
 	float megs_used_memory, mmap_used_memory, megs_peak_memory;
-	char *spos= str;
+	char *spos = str;
 
-	mem_in_use= MEM_get_memory_in_use();
-	mmap_in_use= MEM_get_mapped_memory_in_use();
+	mem_in_use = MEM_get_memory_in_use();
+	mmap_in_use = MEM_get_mapped_memory_in_use();
 	peak_memory = MEM_get_peak_memory();
 
-	megs_used_memory= (mem_in_use-mmap_in_use)/(1024.0*1024.0);
-	mmap_used_memory= (mmap_in_use)/(1024.0*1024.0);
-	megs_peak_memory = (peak_memory)/(1024.0*1024.0);
+	megs_used_memory = (mem_in_use - mmap_in_use) / (1024.0 * 1024.0);
+	mmap_used_memory = (mmap_in_use) / (1024.0 * 1024.0);
+	megs_peak_memory = (peak_memory) / (1024.0 * 1024.0);
 
-	if(scene->lay & 0xFF000000)
-		spos+= sprintf(spos, "Localview | ");
-	else if(scene->r.scemode & R_SINGLE_LAYER)
-		spos+= sprintf(spos, "Single Layer | ");
+	if (scene->lay & 0xFF000000)
+		spos += sprintf(spos, "Localview | ");
+	else if (scene->r.scemode & R_SINGLE_LAYER)
+		spos += sprintf(spos, "Single Layer | ");
 
-	if(rs->statstr) {
-		spos+= sprintf(spos, "%s ", rs->statstr);
+	if (rs->statstr) {
+		spos += sprintf(spos, "%s ", rs->statstr);
 	}
 	else {
-		spos+= sprintf(spos, "Fra:%d  ", (scene->r.cfra));
-		if(rs->totvert) spos+= sprintf(spos, "Ve:%d ", rs->totvert);
-		if(rs->totface) spos+= sprintf(spos, "Fa:%d ", rs->totface);
-		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->curfield)
-			spos+= sprintf(spos, "Field %d ", rs->curfield);
-		if(rs->curblur)
-			spos+= sprintf(spos, "Blur %d ", rs->curblur);
+		spos += sprintf(spos, "Fra:%d  ", (scene->r.cfra));
+		if (rs->totvert) spos += sprintf(spos, "Ve:%d ", rs->totvert);
+		if (rs->totface) spos += sprintf(spos, "Fa:%d ", rs->totface);
+		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->curfield)
+			spos += sprintf(spos, "Field %d ", rs->curfield);
+		if (rs->curblur)
+			spos += sprintf(spos, "Blur %d ", rs->curblur);
 	}
 
 	BLI_timestr(rs->lastframetime, info_time_str);
-	spos+= sprintf(spos, "Time:%s ", info_time_str);
+	spos += sprintf(spos, "Time:%s ", info_time_str);
 
-	if(rs->curfsa)
-		spos+= sprintf(spos, "| Full Sample %d ", rs->curfsa);
+	if (rs->curfsa)
+		spos += sprintf(spos, "| Full Sample %d ", rs->curfsa);
 	
-	if(rs->infostr && rs->infostr[0])
-		spos+= sprintf(spos, "| %s ", rs->infostr);
+	if (rs->infostr && rs->infostr[0])
+		spos += sprintf(spos, "| %s ", rs->infostr);
 
 	/* very weak... but 512 characters is quite safe */
-	if(spos >= str+IMA_MAX_RENDER_TEXT)
-		if (G.f & G_DEBUG)
-			printf("WARNING! renderwin text beyond limit \n");
+	if (spos >= str + IMA_MAX_RENDER_TEXT)
+		if (G.debug & G_DEBUG)
+			printf("WARNING! renderwin text beyond limit\n");
 
 }
 
 static void image_renderinfo_cb(void *rjv, RenderStats *rs)
 {
-	RenderJob *rj= rjv;
+	RenderJob *rj = rjv;
 	RenderResult *rr;
 
-	rr= RE_AcquireResultRead(rj->re);
+	rr = RE_AcquireResultRead(rj->re);
 
-	if(rr) {
+	if (rr) {
 		/* malloc OK here, stats_draw is not in tile threads */
-		if(rr->text==NULL)
-			rr->text= MEM_callocN(IMA_MAX_RENDER_TEXT, "rendertext");
+		if (rr->text == NULL)
+			rr->text = MEM_callocN(IMA_MAX_RENDER_TEXT, "rendertext");
 
 		make_renderinfo_string(rs, rj->scene, rr->text);
 	}
@@ -340,54 +340,54 @@ static void image_renderinfo_cb(void *rjv, RenderStats *rs)
 	RE_ReleaseResult(rj->re);
 
 	/* make jobs timer to send notifier */
-	*(rj->do_update)= 1;
+	*(rj->do_update) = 1;
 
 }
 
 static void render_progress_update(void *rjv, float progress)
 {
-	RenderJob *rj= rjv;
+	RenderJob *rj = rjv;
 	
-	if(rj->progress && *rj->progress != progress) {
+	if (rj->progress && *rj->progress != progress) {
 		*rj->progress = progress;
 
 		/* make jobs timer to send notifier */
-		*(rj->do_update)= 1;
+		*(rj->do_update) = 1;
 	}
 }
 
 static void image_rect_update(void *rjv, RenderResult *rr, volatile rcti *renrect)
 {
-	RenderJob *rj= rjv;
-	Image *ima= rj->image;
+	RenderJob *rj = rjv;
+	Image *ima = rj->image;
 	ImBuf *ibuf;
 	void *lock;
 
 	/* only update if we are displaying the slot being rendered */
-	if(ima->render_slot != ima->last_render_slot)
+	if (ima->render_slot != ima->last_render_slot)
 		return;
 
-	ibuf= BKE_image_acquire_ibuf(ima, &rj->iuser, &lock);
-	if(ibuf) {
+	ibuf = BKE_image_acquire_ibuf(ima, &rj->iuser, &lock);
+	if (ibuf) {
 		image_buffer_rect_update(rj->scene, rr, ibuf, renrect);
 
 		/* make jobs timer to send notifier */
-		*(rj->do_update)= 1;
+		*(rj->do_update) = 1;
 	}
 	BKE_image_release_ibuf(ima, lock);
 }
 
 static void render_startjob(void *rjv, short *stop, short *do_update, float *progress)
 {
-	RenderJob *rj= rjv;
+	RenderJob *rj = rjv;
 
-	rj->stop= stop;
-	rj->do_update= do_update;
-	rj->progress= progress;
+	rj->stop = stop;
+	rj->do_update = do_update;
+	rj->progress = progress;
 
 	RE_SetReports(rj->re, rj->reports);
 
-	if(rj->anim)
+	if (rj->anim)
 		RE_BlenderAnim(rj->re, rj->main, rj->scene, rj->camera_override, rj->lay, rj->scene->r.sfra, rj->scene->r.efra, rj->scene->r.frame_step);
 	else
 		RE_BlenderFrame(rj->re, rj->main, rj->scene, rj->srl, rj->camera_override, rj->lay, rj->scene->r.cfra, rj->write_still);
@@ -397,17 +397,17 @@ static void render_startjob(void *rjv, short *stop, short *do_update, float *pro
 
 static void render_endjob(void *rjv)
 {
-	RenderJob *rj= rjv;	
+	RenderJob *rj = rjv;
 
 	/* this render may be used again by the sequencer without the active 'Render' where the callbacks
 	 * would be re-assigned. assign dummy callbacks to avoid referencing freed renderjobs bug [#24508] */
 	RE_InitRenderCB(rj->re);
 
-	if(rj->main != G.main)
+	if (rj->main != G.main)
 		free_main(rj->main);
 
 	/* else the frame will not update for the original value */
-	if(!(rj->scene->r.scemode & R_NO_FRAME_UPDATE))
+	if (!(rj->scene->r.scemode & R_NO_FRAME_UPDATE))
 		ED_update_for_newframe(G.main, rj->scene, rj->win->screen, 1);
 	
 	/* XXX above function sets all tags in nodes */
@@ -416,9 +416,9 @@ static void render_endjob(void *rjv)
 	/* potentially set by caller */
 	rj->scene->r.scemode &= ~R_NO_FRAME_UPDATE;
 	
-	if(rj->srl) {
+	if (rj->srl) {
 		nodeUpdateID(rj->scene->nodetree, &rj->scene->id);
-		WM_main_add_notifier(NC_NODE|NA_EDITED, rj->scene);
+		WM_main_add_notifier(NC_NODE | NA_EDITED, rj->scene);
 	}
 	
 	/* XXX render stability hack */
@@ -429,11 +429,11 @@ static void render_endjob(void *rjv)
 /* called by render, check job 'stop' value or the global */
 static int render_breakjob(void *rjv)
 {
-	RenderJob *rj= rjv;
+	RenderJob *rj = rjv;
 
-	if(G.afbreek)
+	if (G.afbreek)
 		return 1;
-	if(rj->stop && *(rj->stop))
+	if (rj->stop && *(rj->stop))
 		return 1;
 	return 0;
 }
@@ -450,8 +450,8 @@ static void render_drawlock(void *UNUSED(rjv), int lock)
 static int screen_render_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
 {
 	/* no running blender, remove handler and pass through */
-	if(0==WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C))) {
-		return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
+	if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C))) {
+		return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
 	}
 
 	/* running render */
@@ -468,29 +468,29 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 	/* new render clears all callbacks */
 	Main *mainp;
-	Scene *scene= CTX_data_scene(C);
-	SceneRenderLayer *srl=NULL;
-	bScreen *screen= CTX_wm_screen(C);
-	View3D *v3d= CTX_wm_view3d(C);
+	Scene *scene = CTX_data_scene(C);
+	SceneRenderLayer *srl = NULL;
+	bScreen *screen = CTX_wm_screen(C);
+	View3D *v3d = CTX_wm_view3d(C);
 	Render *re;
 	wmJob *steve;
 	RenderJob *rj;
 	Image *ima;
 	int jobflag;
-	const short is_animation= RNA_boolean_get(op->ptr, "animation");
-	const short is_write_still= RNA_boolean_get(op->ptr, "write_still");
-	struct Object *camera_override= v3d ? V3D_CAMERA_LOCAL(v3d) : NULL;
+	const short is_animation = RNA_boolean_get(op->ptr, "animation");
+	const short is_write_still = RNA_boolean_get(op->ptr, "write_still");
+	struct Object *camera_override = v3d ? V3D_CAMERA_LOCAL(v3d) : NULL;
 	const char *name;
 	
 	/* only one render job at a time */
-	if(WM_jobs_test(CTX_wm_manager(C), scene))
+	if (WM_jobs_test(CTX_wm_manager(C), scene))
 		return OPERATOR_CANCELLED;
 
-	if(!RE_is_rendering_allowed(scene, camera_override, op->reports)) {
+	if (!RE_is_rendering_allowed(scene, camera_override, op->reports)) {
 		return OPERATOR_CANCELLED;
 	}
 
-	if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
+	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");
 		return OPERATOR_CANCELLED;
 	}	
@@ -499,12 +499,12 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	WM_jobs_stop_all(CTX_wm_manager(C));
 
 	/* get main */
-	if(G.rt == 101) {
+	if (G.rt == 101) {
 		/* thread-safety experiment, copy main from the undo buffer */
-		mainp= BKE_undo_get_main(&scene);
+		mainp = BKE_undo_get_main(&scene);
 	}
 	else
-		mainp= CTX_data_main(C);
+		mainp = CTX_data_main(C);
 
 	/* cancel animation playback */
 	if (screen->animtimer)
@@ -517,13 +517,13 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	multires_force_render_update(CTX_data_active_object(C));
 
 	/* cleanup sequencer caches before starting user triggered render.
-	   otherwise, invalidated cache entries can make their way into
-	   the output rendering. We can't put that into RE_BlenderFrame,
-	   since sequence rendering can call that recursively... (peter) */
+	 * otherwise, invalidated cache entries can make their way into
+	 * the output rendering. We can't put that into RE_BlenderFrame,
+	 * since sequence rendering can call that recursively... (peter) */
 	seq_stripelem_cache_cleanup();
 
 	/* get editmode results */
-	ED_object_exit_editmode(C, 0);	/* 0 = does not exit editmode */
+	ED_object_exit_editmode(C, 0);  /* 0 = does not exit editmode */
 
 	// store spare
 	// get view3d layer, local layer, make this nice api call to render
@@ -532,62 +532,62 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	/* ensure at least 1 area shows result */
 	render_view_open(C, event->x, event->y);
 
-	jobflag= WM_JOB_EXCL_RENDER|WM_JOB_PRIORITY|WM_JOB_PROGRESS;
+	jobflag = WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS;
 	
 	/* custom scene and single layer re-render */
 	screen_render_scene_layer_set(op, mainp, &scene, &srl);
 
-	if(RNA_struct_property_is_set(op->ptr, "layer"))
+	if (RNA_struct_property_is_set(op->ptr, "layer"))
 		jobflag |= WM_JOB_SUSPEND;
 
 	/* job custom data */
-	rj= MEM_callocN(sizeof(RenderJob), "render job");
-	rj->main= mainp;
-	rj->scene= scene;
-	rj->win= CTX_wm_window(C);
+	rj = MEM_callocN(sizeof(RenderJob), "render job");
+	rj->main = mainp;
+	rj->scene = scene;
+	rj->win = CTX_wm_window(C);
 	rj->srl = srl;
 	rj->camera_override = camera_override;
-	rj->lay = (v3d)? v3d->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;
+	rj->lay = (v3d) ? v3d->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;
 
 	/* setup job */
-	if(RE_seq_render_active(scene, &scene->r)) name= "Sequence Render";
-	else name= "Render";
+	if (RE_seq_render_active(scene, &scene->r)) name = "Sequence Render";
+	else name = "Render";
 
-	steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, name, jobflag);
+	steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, name, jobflag);
 	WM_jobs_customdata(steve, rj, render_freejob);
-	WM_jobs_timer(steve, 0.2, NC_SCENE|ND_RENDER_RESULT, 0);
+	WM_jobs_timer(steve, 0.2, NC_SCENE | ND_RENDER_RESULT, 0);
 	WM_jobs_callbacks(steve, render_startjob, NULL, NULL, render_endjob);
 
 	/* get a render result image, and make sure it is empty */
-	ima= BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
+	ima = BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
 	BKE_image_signal(ima, NULL, IMA_SIGNAL_FREE);
 	BKE_image_backup_render(rj->scene, ima);
-	rj->image= ima;
+	rj->image = ima;
 
 	/* setup new render */
-	re= RE_NewRender(scene->id.name);
+	re = RE_NewRender(scene->id.name);
 	RE_test_break_cb(re, rj, render_breakjob);
 	RE_draw_lock_cb(re, rj, render_drawlock);
 	RE_display_draw_cb(re, rj, image_rect_update);
 	RE_stats_draw_cb(re, rj, image_renderinfo_cb);
 	RE_progress_cb(re, rj, render_progress_update);
 
-	rj->re= re;
-	G.afbreek= 0;
+	rj->re = re;
+	G.afbreek = 0;
 
 	WM_jobs_start(CTX_wm_manager(C), steve);
 
 	WM_cursor_wait(0);
-	WM_event_add_notifier(C, NC_SCENE|ND_RENDER_RESULT, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, scene);
 
 	/* we set G.rendering here already instead of only in the job, this ensure
-	   main loop or other scene updates are disabled in time, since they may
-	   have started before the job thread */
+	 * main loop or other scene updates are disabled in time, since they may
+	 * have started before the job thread */
 	G.rendering = 1;
 
 	/* add modal handler for ESC */
@@ -600,20 +600,20 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
 void RENDER_OT_render(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Render";
-	ot->description= "Render active scene";
-	ot->idname= "RENDER_OT_render";
+	ot->name = "Render";
+	ot->description = "Render active scene";
+	ot->idname = "RENDER_OT_render";
 
 	/* api callbacks */
-	ot->invoke= screen_render_invoke;
-	ot->modal= screen_render_modal;
-	ot->exec= screen_render_exec;
+	ot->invoke = screen_render_invoke;
+	ot->modal = screen_render_modal;
+	ot->exec = screen_render_exec;
 
-	/*ot->poll= ED_operator_screenactive;*/ /* this isnt needed, causes failer in background mode */
+	/*ot->poll = ED_operator_screenactive;*/ /* this isn't needed, causes failer in background mode */
 
 	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");
+	RNA_def_string(ot->srna, "scene", "", MAX_ID_NAME - 2, "Scene", "Scene to render, current scene if not specified");
 }
 
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index 1338344..f9737b0 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -37,7 +37,6 @@
 
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
-#include "BLI_editVert.h"
 #include "BLI_dlrbTree.h"
 #include "BLI_utildefines.h"
 #include "BLI_jitter.h"
@@ -51,6 +50,7 @@
 #include "BKE_main.h"
 #include "BKE_report.h"
 #include "BKE_scene.h"
+#include "BKE_sequencer.h"
 #include "BKE_writeavi.h"
 
 #include "WM_api.h"
@@ -88,6 +88,10 @@ typedef struct OGLRender {
 
 	short obcenter_dia_back; /* temp overwrite */
 
+	short is_sequencer;
+	SpaceSeq *sseq;
+
+
 	Image *ima;
 	ImageUser iuser;
 
@@ -105,7 +109,7 @@ typedef struct OGLRender {
 /* added because v3d is not always valid */
 static unsigned int screen_opengl_layers(OGLRender *oglrender)
 {
-	if(oglrender->v3d) {
+	if (oglrender->v3d) {
 		return oglrender->scene->lay | oglrender->v3d->lay;
 	}
 	else {
@@ -115,28 +119,48 @@ static unsigned int screen_opengl_layers(OGLRender *oglrender)
 
 static void screen_opengl_render_apply(OGLRender *oglrender)
 {
-	Scene *scene= oglrender->scene;
-	ARegion *ar= oglrender->ar;
-	View3D *v3d= oglrender->v3d;
-	RegionView3D *rv3d= oglrender->rv3d;
+	Scene *scene = oglrender->scene;
+	ARegion *ar = oglrender->ar;
+	View3D *v3d = oglrender->v3d;
+	RegionView3D *rv3d = oglrender->rv3d;
 	RenderResult *rr;
-	Object *camera= NULL;
+	Object *camera = NULL;
 	ImBuf *ibuf;
 	void *lock;
 	float winmat[4][4];
-	int sizex= oglrender->sizex;
-	int sizey= oglrender->sizey;
-	const short view_context= (v3d != NULL);
+	int sizex = oglrender->sizex;
+	int sizey = oglrender->sizey;
+	const short view_context = (v3d != NULL);
 
-	rr= RE_AcquireResultRead(oglrender->re);
-	
-	if(view_context) {
+	rr = RE_AcquireResultRead(oglrender->re);
+
+	if (oglrender->is_sequencer) {
+		SeqRenderData context;
+		int chanshown = oglrender->sseq ? oglrender->sseq->chanshown : 0;
+
+		context = seq_new_render_data(oglrender->bmain, scene, oglrender->sizex, oglrender->sizey, 100.0f);
+
+		ibuf = give_ibuf_seq(context, CFRA, chanshown);
+
+		if (ibuf) {
+			BLI_assert((oglrender->sizex == ibuf->x) && (oglrender->sizey == ibuf->y));
+
+			if (ibuf->rect_float == NULL) {
+				IMB_float_from_rect(ibuf);
+			}
+
+			memcpy(rr->rectf, ibuf->rect_float, sizeof(float) * 4 * oglrender->sizex * oglrender->sizey);
+
+			IMB_freeImBuf(ibuf);
+		}
+	}
+	else if (view_context) {
 		GPU_offscreen_bind(oglrender->ofs); /* bind */
 
 		/* render 3d view */
-		if(rv3d->persp==RV3D_CAMOB && v3d->camera) {
+		if (rv3d->persp == RV3D_CAMOB && v3d->camera) {
 			/*int is_ortho= scene->r.mode & R_ORTHO;*/
-			camera= v3d->camera;
+			camera = v3d->camera;
 			RE_GetCameraWindow(oglrender->re, camera, scene->r.cfra, winmat);
 			
 		}
@@ -144,42 +168,42 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
 			rctf viewplane;
 			float clipsta, clipend;
 
-			int is_ortho= ED_view3d_viewplane_get(v3d, rv3d, sizex, sizey, &viewplane, &clipsta, &clipend);
-			if(is_ortho) orthographic_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, -clipend, clipend);
-			else  perspective_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend);
+			int is_ortho = ED_view3d_viewplane_get(v3d, rv3d, sizex, sizey, &viewplane, &clipsta, &clipend);
+			if (is_ortho) orthographic_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, -clipend, clipend);
+			else perspective_m4(winmat, viewplane.xmin, viewplane.xmax, viewplane.ymin, viewplane.ymax, clipsta, clipend);
 		}
 
-		if((scene->r.mode & R_OSA) == 0) { 
-			ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat);
+		if ((scene->r.mode & R_OSA) == 0) { 
+			ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat, TRUE);
 			GPU_offscreen_read_pixels(oglrender->ofs, GL_FLOAT, rr->rectf);
 		}
 		else {
 			/* simple accumulation, less hassle then FSAA FBO's */
 			static float jit_ofs[32][2];
 			float winmat_jitter[4][4];
-			float *accum_buffer= MEM_mallocN(sizex * sizey * sizeof(float) * 4, "accum1");
-			float *accum_tmp= MEM_mallocN(sizex * sizey * sizeof(float) * 4, "accum2");
+			float *accum_buffer = MEM_mallocN(sizex * sizey * sizeof(float) * 4, "accum1");
+			float *accum_tmp = MEM_mallocN(sizex * sizey * sizeof(float) * 4, "accum2");
 			int j;
 
 			BLI_initjit(jit_ofs[0], scene->r.osa);
 
 			/* first sample buffer, also initializes 'rv3d->persmat' */
-			ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat);
+			ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat, TRUE);
 			GPU_offscreen_read_pixels(oglrender->ofs, GL_FLOAT, accum_buffer);
 
 			/* skip the first sample */
-			for(j=1; j < scene->r.osa; j++) {
+			for (j = 1; j < scene->r.osa; j++) {
 				copy_m4_m4(winmat_jitter, winmat);
 				window_translate_m4(winmat_jitter, rv3d->persmat,
 				                    (jit_ofs[j][0] * 2.0f) / sizex,
 				                    (jit_ofs[j][1] * 2.0f) / sizey);
 
-				ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat_jitter);
+				ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat_jitter, TRUE);
 				GPU_offscreen_read_pixels(oglrender->ofs, GL_FLOAT, accum_tmp);
-				add_vn_vn(accum_buffer, accum_tmp, sizex*sizey*sizeof(float));
+				add_vn_vn(accum_buffer, accum_tmp, sizex * sizey * sizeof(float));
 			}
 
-			mul_vn_vn_fl(rr->rectf, accum_buffer, sizex*sizey*sizeof(float), 1.0f / scene->r.osa);
+			mul_vn_vn_fl(rr->rectf, accum_buffer, sizex * sizey * sizeof(float), 1.0f / scene->r.osa);
 
 			MEM_freeN(accum_buffer);
 			MEM_freeN(accum_tmp);
@@ -189,22 +213,22 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
 	}
 	else {
 		/* shouldnt suddenly give errors mid-render but possible */
-		char err_out[256]= "unknown";
-		ImBuf *ibuf_view= ED_view3d_draw_offscreen_imbuf_simple(scene, scene->camera, oglrender->sizex, oglrender->sizey, IB_rectfloat, OB_SOLID, err_out);
-		camera= scene->camera;
+		char err_out[256] = "unknown";
+		ImBuf *ibuf_view = ED_view3d_draw_offscreen_imbuf_simple(scene, scene->camera, oglrender->sizex, oglrender->sizey, IB_rectfloat, OB_SOLID, TRUE, err_out);
+		camera = scene->camera;
 
-		if(ibuf_view) {
+		if (ibuf_view) {
 			memcpy(rr->rectf, ibuf_view->rect_float, sizeof(float) * 4 * oglrender->sizex * oglrender->sizey);
 			IMB_freeImBuf(ibuf_view);
 		}
 		else {
-			fprintf(stderr, "screen_opengl_render_apply: failed to get buffer, %s\n", err_out);
+			fprintf(stderr, "%s: failed to get buffer, %s\n", __func__, err_out);
 		}
 	}
 	
 	/* rr->rectf is now filled with image data */
 
-	if((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW))
+	if ((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW))
 		BKE_stamp_buf(scene, camera, NULL, rr->rectf, rr->rectx, rr->recty, 4);
 
 	/* note on color management:
@@ -215,34 +239,34 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
 	 * sRGB again, and so that e.g. openexr saving also saves the correct linear
 	 * float buffer. */
 
-	if(oglrender->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) {
-		int predivide= 0; /* no alpha */
+	if (oglrender->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) {
+		int predivide = 0; /* no alpha */
 
 		IMB_buffer_float_from_float(rr->rectf, rr->rectf,
-			4, IB_PROFILE_LINEAR_RGB, IB_PROFILE_SRGB, predivide,
-			oglrender->sizex, oglrender->sizey, oglrender->sizex, oglrender->sizex);
+		                            4, IB_PROFILE_LINEAR_RGB, IB_PROFILE_SRGB, predivide,
+		                            oglrender->sizex, oglrender->sizey, oglrender->sizex, oglrender->sizex);
 	}
 
 	RE_ReleaseResult(oglrender->re);
 
 	/* update byte from float buffer */
-	ibuf= BKE_image_acquire_ibuf(oglrender->ima, &oglrender->iuser, &lock);
+	ibuf = BKE_image_acquire_ibuf(oglrender->ima, &oglrender->iuser, &lock);
 
-	if(ibuf) {
+	if (ibuf) {
 		image_buffer_rect_update(scene, rr, ibuf, NULL);
 
-		if(oglrender->write_still) {
+		if (oglrender->write_still) {
 			char name[FILE_MAX];
 			int ok;
 
-			if(scene->r.im_format.planes == R_IMF_CHAN_DEPTH_8) {
+			if (scene->r.im_format.planes == R_IMF_CHAN_DEPTH_8) {
 				IMB_color_to_bw(ibuf);
 			}
 
 			BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, scene->r.im_format.imtype, scene->r.scemode & R_EXTENSION, FALSE);
-			ok= BKE_write_ibuf_as(ibuf, name, &scene->r.im_format, TRUE); /* no need to stamp here */
-			if(ok)	printf("OpenGL Render written to '%s'\n", name);
-			else	printf("OpenGL Render failed to write '%s'\n", name);
+			ok = BKE_write_ibuf_as(ibuf, name, &scene->r.im_format, TRUE); /* no need to stamp here */
+			if (ok) printf("OpenGL Render written to '%s'\n", name);
+			else printf("OpenGL Render failed to write '%s'\n", name);
 		}
 	}
 	
@@ -252,40 +276,41 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
 static int screen_opengl_render_init(bContext *C, wmOperator *op)
 {
 	/* new render clears all callbacks */
-	Scene *scene= CTX_data_scene(C);
-	ScrArea *prevsa= CTX_wm_area(C);
-	ARegion *prevar= CTX_wm_region(C);
+	Scene *scene = CTX_data_scene(C);
+	ScrArea *prevsa = CTX_wm_area(C);
+	ARegion *prevar = CTX_wm_region(C);
 	RenderResult *rr;
 	GPUOffScreen *ofs;
 	OGLRender *oglrender;
 	int sizex, sizey;
-	short is_view_context= RNA_boolean_get(op->ptr, "view_context");
-	const short is_animation= RNA_boolean_get(op->ptr, "animation");
-	const short is_write_still= RNA_boolean_get(op->ptr, "write_still");
-	char err_out[256]= "unknown";
+	short is_view_context = RNA_boolean_get(op->ptr, "view_context");
+	const short is_animation = RNA_boolean_get(op->ptr, "animation");
+	const short is_sequencer = RNA_boolean_get(op->ptr, "sequencer");
+	const short is_write_still = RNA_boolean_get(op->ptr, "write_still");
+	char err_out[256] = "unknown";
 
-	if(G.background) {
+	if (G.background) {
 		BKE_report(op->reports, RPT_ERROR, "Can't use OpenGL render in background mode (no opengl context)");
 		return 0;
 	}
 
 	/* ensure we have a 3d view */
 
-	if(!ED_view3d_context_activate(C)) {
+	if (!ED_view3d_context_activate(C)) {
 		RNA_boolean_set(op->ptr, "view_context", FALSE);
 		is_view_context = 0;
 	}
 
 	/* only one render job at a time */
-	if(WM_jobs_test(CTX_wm_manager(C), scene))
+	if (WM_jobs_test(CTX_wm_manager(C), scene))
 		return 0;
 	
-	if(!is_view_context && scene->camera==NULL) {
+	if (!is_view_context && scene->camera == NULL) {
 		BKE_report(op->reports, RPT_ERROR, "Scene has no camera");
 		return 0;
 	}
 
-	if(!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
+	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");
 		return 0;
 	}
@@ -293,70 +318,77 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
 	/* stop all running jobs, currently previews frustrate Render */
 	WM_jobs_stop_all(CTX_wm_manager(C));
 
-	/* handle UI stuff */
-	WM_cursor_wait(1);
-
 	/* create offscreen buffer */
-	sizex= (scene->r.size*scene->r.xsch)/100;
-	sizey= (scene->r.size*scene->r.ysch)/100;
+	sizex = (scene->r.size * scene->r.xsch) / 100;
+	sizey = (scene->r.size * scene->r.ysch) / 100;
 
 	/* corrects render size with actual size, not every card supports non-power-of-two dimensions */
-	ofs= GPU_offscreen_create(sizex, sizey, err_out);
+	ofs = GPU_offscreen_create(sizex, sizey, err_out);
 
-	if(!ofs) {
+	if (!ofs) {
 		BKE_reportf(op->reports, RPT_ERROR, "Failed to create OpenGL offscreen buffer, %s", err_out);
 		return 0;
 	}
 
+	/* handle UI stuff */
+	WM_cursor_wait(1);
+
 	/* allocate opengl render */
-	oglrender= MEM_callocN(sizeof(OGLRender), "OGLRender");
-	op->customdata= oglrender;
+	oglrender = MEM_callocN(sizeof(OGLRender), "OGLRender");
+	op->customdata = oglrender;
+
+	oglrender->ofs = ofs;
+	oglrender->sizex = sizex;
+	oglrender->sizey = sizey;
+	oglrender->bmain = CTX_data_main(C);
+	oglrender->scene = scene;
+	oglrender->cfrao = scene->r.cfra;
+
+	oglrender->write_still = is_write_still && !is_animation;
 
-	oglrender->ofs= ofs;
-	oglrender->sizex= sizex;
-	oglrender->sizey= sizey;
-	oglrender->bmain= CTX_data_main(C);
-	oglrender->scene= scene;
+	oglrender->is_sequencer = is_sequencer;
+	if (is_sequencer) {
+		oglrender->sseq = CTX_wm_space_seq(C);;
+	}
 
-	oglrender->write_still= is_write_still && !is_animation;
 
 	oglrender->obcenter_dia_back = U.obcenter_dia;
 	U.obcenter_dia = 0;
 
-	oglrender->prevsa= prevsa;
-	oglrender->prevar= prevar;
+	oglrender->prevsa = prevsa;
+	oglrender->prevar = prevar;
 
-	if(is_view_context) {
+	if (is_view_context) {
 		ED_view3d_context_user_region(C, &oglrender->v3d, &oglrender->ar); /* so quad view renders camera */
-		oglrender->rv3d= oglrender->ar->regiondata;
+		oglrender->rv3d = oglrender->ar->regiondata;
 
 		/* MUST be cleared on exit */
 		oglrender->scene->customdata_mask_modal = (ED_view3d_datamask(oglrender->scene, oglrender->v3d) |
 		                                           ED_view3d_object_datamask(oglrender->scene) );
 
-		/* apply immediately incase we're rendeing from a script,
+		/* apply immediately in case we're rendering from a script,
 		 * running notifiers again will overwrite */
 		oglrender->scene->customdata_mask |= oglrender->scene->customdata_mask_modal;
 
 	}
 
 	/* create render */
-	oglrender->re= RE_NewRender(scene->id.name);
+	oglrender->re = RE_NewRender(scene->id.name);
 
 	/* create image and image user */
-	oglrender->ima= BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
+	oglrender->ima = BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
 	BKE_image_signal(oglrender->ima, NULL, IMA_SIGNAL_FREE);
 	BKE_image_backup_render(oglrender->scene, oglrender->ima);
 
-	oglrender->iuser.scene= scene;
-	oglrender->iuser.ok= 1;
+	oglrender->iuser.scene = scene;
+	oglrender->iuser.ok = 1;
 
 	/* create render result */
 	RE_InitState(oglrender->re, NULL, &scene->r, NULL, sizex, sizey, NULL);
 
-	rr= RE_AcquireResultWrite(oglrender->re);
-	if(rr->rectf==NULL)
-		rr->rectf= MEM_callocN(sizeof(float)*4*sizex*sizey, "screen_opengl_render_init rect");
+	rr = RE_AcquireResultWrite(oglrender->re);
+	if (rr->rectf == NULL)
+		rr->rectf = MEM_callocN(sizeof(float) * 4 * sizex * sizey, "screen_opengl_render_init rect");
 	RE_ReleaseResult(oglrender->re);
 
 	return 1;
@@ -364,29 +396,29 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
 
 static void screen_opengl_render_end(bContext *C, OGLRender *oglrender)
 {
-	Main *bmain= CTX_data_main(C);
-	Scene *scene= oglrender->scene;
+	Main *bmain = CTX_data_main(C);
+	Scene *scene = oglrender->scene;
 
-	if(oglrender->mh) {
-		if(BKE_imtype_is_movie(scene->r.im_format.imtype))
+	if (oglrender->mh) {
+		if (BKE_imtype_is_movie(scene->r.im_format.imtype))
 			oglrender->mh->end_movie();
 	}
 
-	if(oglrender->timer) { /* exec will not have a timer */
-		scene->r.cfra= oglrender->cfrao;
+	if (oglrender->timer) { /* exec will not have a timer */
+		scene->r.cfra = oglrender->cfrao;
 		scene_update_for_newframe(bmain, scene, screen_opengl_layers(oglrender));
 
 		WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), oglrender->timer);
 	}
 
 	WM_cursor_wait(0);
-	WM_event_add_notifier(C, NC_SCENE|ND_RENDER_RESULT, oglrender->scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, oglrender->scene);
 
 	U.obcenter_dia = oglrender->obcenter_dia_back;
 
 	GPU_offscreen_free(oglrender->ofs);
 
-	oglrender->scene->customdata_mask_modal= 0;
+	oglrender->scene->customdata_mask_modal = 0;
 
 	CTX_wm_area_set(C, oglrender->prevsa);
 	CTX_wm_region_set(C, oglrender->prevar);
@@ -408,45 +440,45 @@ static int screen_opengl_render_anim_initialize(bContext *C, wmOperator *op)
 	OGLRender *oglrender;
 	Scene *scene;
 
-	oglrender= op->customdata;
-	scene= oglrender->scene;
+	oglrender = op->customdata;
+	scene = oglrender->scene;
 
-	oglrender->reports= op->reports;
-	oglrender->mh= BKE_get_movie_handle(scene->r.im_format.imtype);
-	if(BKE_imtype_is_movie(scene->r.im_format.imtype)) {
-		if(!oglrender->mh->start_movie(scene, &scene->r, oglrender->sizex, oglrender->sizey, oglrender->reports)) {
+	oglrender->reports = op->reports;
+	oglrender->mh = BKE_get_movie_handle(scene->r.im_format.imtype);
+	if (BKE_imtype_is_movie(scene->r.im_format.imtype)) {
+		if (!oglrender->mh->start_movie(scene, &scene->r, oglrender->sizex, oglrender->sizey, oglrender->reports)) {
 			screen_opengl_render_end(C, oglrender);
 			return 0;
 		}
 	}
 
-	oglrender->cfrao= scene->r.cfra;
-	oglrender->nfra= PSFRA;
-	scene->r.cfra= PSFRA;
+	oglrender->cfrao = scene->r.cfra;
+	oglrender->nfra = PSFRA;
+	scene->r.cfra = PSFRA;
 
 	return 1;
 }
 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;
+	Main *bmain = CTX_data_main(C);
+	OGLRender *oglrender = op->customdata;
+	Scene *scene = oglrender->scene;
 	ImBuf *ibuf;
 	void *lock;
 	char name[FILE_MAX];
-	int ok= 0;
-	const short  view_context= (oglrender->v3d != NULL);
-	Object *camera= NULL;
+	int ok = 0;
+	const short view_context = (oglrender->v3d != NULL);
+	Object *camera = NULL;
 
 	/* update animated image textures for gpu, etc,
-	 * call before scene_update_for_newframe so modifiers with textuers dont lag 1 frame */
+	 * call before scene_update_for_newframe so modifiers with textures don't lag 1 frame */
 	ED_image_update_frame(bmain, scene->r.cfra);
 
 	/* go to next frame */
-	while(CFRA<oglrender->nfra) {
-		unsigned int lay= screen_opengl_layers(oglrender);
+	while (CFRA < oglrender->nfra) {
+		unsigned int lay = screen_opengl_layers(oglrender);
 
-		if(lay & 0xFF000000)
+		if (lay & 0xFF000000)
 			lay &= 0xFF000000;
 
 		scene_update_for_newframe(bmain, scene, lay);
@@ -455,61 +487,61 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
 
 	scene_update_for_newframe(bmain, scene, screen_opengl_layers(oglrender));
 
-	if(view_context) {
-		if(oglrender->rv3d->persp==RV3D_CAMOB && oglrender->v3d->camera && oglrender->v3d->scenelock) {
+	if (view_context) {
+		if (oglrender->rv3d->persp == RV3D_CAMOB && oglrender->v3d->camera && oglrender->v3d->scenelock) {
 			/* since scene_update_for_newframe() is used rather
 			 * then ED_update_for_newframe() the camera needs to be set */
-			if(scene_camera_switch_update(scene)) {
-				oglrender->v3d->camera= scene->camera;
+			if (scene_camera_switch_update(scene)) {
+				oglrender->v3d->camera = scene->camera;
 			}
 
-			camera= oglrender->v3d->camera;
+			camera = oglrender->v3d->camera;
 		}
 	}
 	else {
 		scene_camera_switch_update(scene);
 
-		camera= scene->camera;
+		camera = scene->camera;
 	}
 
 	/* render into offscreen buffer */
 	screen_opengl_render_apply(oglrender);
 
 	/* save to disk */
-	ibuf= BKE_image_acquire_ibuf(oglrender->ima, &oglrender->iuser, &lock);
+	ibuf = BKE_image_acquire_ibuf(oglrender->ima, &oglrender->iuser, &lock);
 
-	if(ibuf) {
+	if (ibuf) {
 		/* color -> greyscale */
 		/* editing directly would alter the render view */
-		if(scene->r.im_format.planes == R_IMF_PLANES_BW) {
-			ImBuf *ibuf_bw= IMB_dupImBuf(ibuf);
+		if (scene->r.im_format.planes == R_IMF_PLANES_BW) {
+			ImBuf *ibuf_bw = IMB_dupImBuf(ibuf);
 			IMB_color_to_bw(ibuf_bw);
 			// IMB_freeImBuf(ibuf); /* owned by the image */
-			ibuf= ibuf_bw;
+			ibuf = 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;
-			ibuf= ibuf_cpy;
+			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;
+			ibuf = ibuf_cpy;
 		}
 
-		if(BKE_imtype_is_movie(scene->r.im_format.imtype)) {
-			ok= oglrender->mh->append_movie(&scene->r, SFRA, CFRA, (int*)ibuf->rect,
-			                                oglrender->sizex, oglrender->sizey, oglrender->reports);
-			if(ok) {
+		if (BKE_imtype_is_movie(scene->r.im_format.imtype)) {
+			ok = oglrender->mh->append_movie(&scene->r, SFRA, CFRA, (int *)ibuf->rect,
+			                                 oglrender->sizex, oglrender->sizey, oglrender->reports);
+			if (ok) {
 				printf("Append frame %d", scene->r.cfra);
 				BKE_reportf(op->reports, RPT_INFO, "Appended frame: %d", scene->r.cfra);
 			}
 		}
 		else {
 			BKE_makepicstring(name, scene->r.pic, oglrender->bmain->name, scene->r.cfra, scene->r.im_format.imtype, scene->r.scemode & R_EXTENSION, TRUE);
-			ok= BKE_write_ibuf_stamp(scene, camera, ibuf, name, &scene->r.im_format);
+			ok = BKE_write_ibuf_stamp(scene, camera, ibuf, name, &scene->r.im_format);
 
-			if(ok==0) {
+			if (ok == 0) {
 				printf("Write error: cannot save %s\n", name);
 				BKE_reportf(op->reports, RPT_ERROR, "Write error: cannot save %s", name);
 			}
@@ -533,7 +565,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
 	scene->r.cfra++;
 
 	/* stop at the end or on error */
-	if(scene->r.cfra > PEFRA || !ok) {
+	if (scene->r.cfra > PEFRA || !ok) {
 		screen_opengl_render_end(C, op->customdata);
 		return 0;
 	}
@@ -544,18 +576,18 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
 
 static int screen_opengl_render_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
-	OGLRender *oglrender= op->customdata;
-	int anim= RNA_boolean_get(op->ptr, "animation");
+	OGLRender *oglrender = op->customdata;
+	int anim = RNA_boolean_get(op->ptr, "animation");
 	int ret;
 
-	switch(event->type) {
+	switch (event->type) {
 		case ESCKEY:
 			/* cancel */
 			screen_opengl_render_end(C, op->customdata);
 			return OPERATOR_FINISHED;
 		case TIMER:
 			/* render frame? */
-			if(oglrender->timer == event->customdata)
+			if (oglrender->timer == event->customdata)
 				break;
 		default:
 			/* nothing to do */
@@ -563,18 +595,18 @@ static int screen_opengl_render_modal(bContext *C, wmOperator *op, wmEvent *even
 	}
 
 	/* run first because screen_opengl_render_anim_step can free oglrender */
-	WM_event_add_notifier(C, NC_SCENE|ND_RENDER_RESULT, oglrender->scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, oglrender->scene);
 	
-	if(anim == 0) {
+	if (anim == 0) {
 		screen_opengl_render_apply(op->customdata);
 		screen_opengl_render_end(C, op->customdata);
 		return OPERATOR_FINISHED;
 	}
 	else
-		ret= screen_opengl_render_anim_step(C, op);
+		ret = screen_opengl_render_anim_step(C, op);
 
 	/* stop at the end or on error */
-	if(ret == 0) {
+	if (ret == 0) {
 		return OPERATOR_FINISHED;
 	}
 
@@ -584,21 +616,21 @@ static int screen_opengl_render_modal(bContext *C, wmOperator *op, wmEvent *even
 static int screen_opengl_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 	OGLRender *oglrender;
-	int anim= RNA_boolean_get(op->ptr, "animation");
+	int anim = RNA_boolean_get(op->ptr, "animation");
 
-	if(!screen_opengl_render_init(C, op))
+	if (!screen_opengl_render_init(C, op))
 		return OPERATOR_CANCELLED;
 
-	if(anim) {
-		if(!screen_opengl_render_anim_initialize(C, op))
+	if (anim) {
+		if (!screen_opengl_render_anim_initialize(C, op))
 			return OPERATOR_CANCELLED;
 	}
 	
-	oglrender= op->customdata;
+	oglrender = op->customdata;
 	render_view_open(C, event->x, event->y);
 	
 	WM_event_add_modal_handler(C, op);
-	oglrender->timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
+	oglrender->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
 	
 	return OPERATOR_RUNNING_MODAL;
 }
@@ -606,12 +638,12 @@ static int screen_opengl_render_invoke(bContext *C, wmOperator *op, wmEvent *eve
 /* executes blocking render */
 static int screen_opengl_render_exec(bContext *C, wmOperator *op)
 {
-	const short is_animation= RNA_boolean_get(op->ptr, "animation");
+	const short is_animation = RNA_boolean_get(op->ptr, "animation");
 
-	if(!screen_opengl_render_init(C, op))
+	if (!screen_opengl_render_init(C, op))
 		return OPERATOR_CANCELLED;
 
-	if(!is_animation) { /* same as invoke */
+	if (!is_animation) { /* same as invoke */
 		/* render image */
 		screen_opengl_render_apply(op->customdata);
 		screen_opengl_render_end(C, op->customdata);
@@ -619,41 +651,49 @@ static int screen_opengl_render_exec(bContext *C, wmOperator *op)
 		return OPERATOR_FINISHED;
 	}
 	else {
-		int ret= 1;
+		int ret = 1;
 
-		if(!screen_opengl_render_anim_initialize(C, op))
+		if (!screen_opengl_render_anim_initialize(C, op))
 			return OPERATOR_CANCELLED;
 
-		while(ret) {
-			ret= screen_opengl_render_anim_step(C, op);
+		while (ret) {
+			ret = screen_opengl_render_anim_step(C, op);
 		}
 	}
 
 	// 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));
+	WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, CTX_data_scene(C));
 
 	return OPERATOR_FINISHED;
 }
 
 void RENDER_OT_opengl(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+
 	/* identifiers */
-	ot->name= "OpenGL Render";
-	ot->description= "OpenGL render active viewport";
-	ot->idname= "RENDER_OT_opengl";
+	ot->name = "OpenGL Render";
+	ot->description = "OpenGL render active viewport";
+	ot->idname = "RENDER_OT_opengl";
 
 	/* api callbacks */
-	ot->invoke= screen_opengl_render_invoke;
-	ot->exec= screen_opengl_render_exec; /* blocking */
-	ot->modal= screen_opengl_render_modal;
-	ot->cancel= screen_opengl_render_cancel;
-
-	ot->poll= ED_operator_screenactive;
+	ot->invoke = screen_opengl_render_invoke;
+	ot->exec = screen_opengl_render_exec; /* blocking */
+	ot->modal = screen_opengl_render_modal;
+	ot->cancel = screen_opengl_render_cancel;
+
+	ot->poll = ED_operator_screenactive;
+
+	prop = RNA_def_boolean(ot->srna, "animation", 0, "Animation", "Render files from the animation range of this scene");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+	prop = RNA_def_boolean(ot->srna, "sequencer", 0, "Sequencer", "Render using the sequencer's OpenGL display");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+	prop = 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_property_flag(prop, PROP_SKIP_SAVE);
+	prop = RNA_def_boolean(ot->srna, "view_context", 1, "View Context", "Use the current 3D view for rendering, else use scene settings");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 
-	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_boolean(ot->srna, "view_context", 1, "View Context", "Use the current 3D view for rendering, else use scene settings");
 }
 
 /* function for getting an opengl buffer from a View3D, used by sequencer */
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 3e34a55..9899f39 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -100,9 +100,9 @@
 
 #include "render_intern.h"
 
-ImBuf* get_brush_icon(Brush *brush)
+ImBuf *get_brush_icon(Brush *brush)
 {
-	static const int flags = IB_rect|IB_multilayer|IB_metadata;
+	static const int flags = IB_rect | IB_multilayer | IB_metadata;
 
 	char path[FILE_MAX];
 	char *folder;
@@ -116,16 +116,16 @@ ImBuf* get_brush_icon(Brush *brush)
 				BLI_strncpy(path, brush->icon_filepath, sizeof(brush->icon_filepath));
 				BLI_path_abs(path, G.main->name);
 
-				brush->icon_imbuf= IMB_loadiffname(path, flags);
+				brush->icon_imbuf = IMB_loadiffname(path, flags);
 
 				// otherwise lets try to find it in other directories
 				if (!(brush->icon_imbuf)) {
-					folder= BLI_get_folder(BLENDER_DATAFILES, "brushicons");
+					folder = BLI_get_folder(BLENDER_DATAFILES, "brushicons");
 
 					BLI_make_file_string(G.main->name, path, folder, brush->icon_filepath);
 
 					if (path[0])
-						brush->icon_imbuf= IMB_loadiffname(path, flags);
+						brush->icon_imbuf = IMB_loadiffname(path, flags);
 				}
 
 				if (brush->icon_imbuf)
@@ -156,7 +156,7 @@ typedef struct ShaderPreview {
 	Lamp *lampcopy;
 	World *worldcopy;
 	
-	float col[4];		/* active object color */
+	float col[4];       /* active object color */
 	
 	int sizex, sizey;
 	unsigned int *pr_rect;
@@ -164,9 +164,22 @@ typedef struct ShaderPreview {
 	
 } ShaderPreview;
 
+typedef struct IconPreviewSize {
+	struct IconPreviewSize *next, *prev;
+	int sizex, sizey;
+	unsigned int *rect;
+} IconPreviewSize;
+
+typedef struct IconPreview {
+	Scene *scene;
+	void *owner;
+	ID *id;
+	ListBase sizes;
+} IconPreview;
+
 /* *************************** Preview for buttons *********************** */
 
-static Main *pr_main= NULL;
+static Main *pr_main = NULL;
 
 void ED_preview_init_dbase(void)
 {
@@ -174,44 +187,44 @@ void ED_preview_init_dbase(void)
 	BlendFileData *bfd;
 	extern int datatoc_preview_blend_size;
 	extern char datatoc_preview_blend[];
-	const int fileflags= G.fileflags;
+	const int fileflags = G.fileflags;
 	
 	G.fileflags |= G_FILE_NO_UI;
-	bfd= BLO_read_from_memory(datatoc_preview_blend, datatoc_preview_blend_size, NULL);
+	bfd = BLO_read_from_memory(datatoc_preview_blend, datatoc_preview_blend_size, NULL);
 	if (bfd) {
-		pr_main= bfd->main;
+		pr_main = bfd->main;
 		
 		MEM_freeN(bfd);
 	}
-	G.fileflags= fileflags;
+	G.fileflags = fileflags;
 #endif
 }
 
 void ED_preview_free_dbase(void)
 {
-	if(pr_main)
+	if (pr_main)
 		free_main(pr_main);
 }
 
 static int preview_mat_has_sss(Material *mat, bNodeTree *ntree)
 {
-	if(mat) {
-		if(mat->sss_flag & MA_DIFF_SSS)
+	if (mat) {
+		if (mat->sss_flag & MA_DIFF_SSS)
 			return 1;
-		if(mat->nodetree)
-			if( preview_mat_has_sss(NULL, mat->nodetree))
+		if (mat->nodetree)
+			if (preview_mat_has_sss(NULL, mat->nodetree))
 				return 1;
 	}
-	else if(ntree) {
+	else if (ntree) {
 		bNode *node;
-		for(node= ntree->nodes.first; node; node= node->next) {
-			if(node->type==NODE_GROUP && node->id) {
-				if( preview_mat_has_sss(NULL, (bNodeTree *)node->id))
+		for (node = ntree->nodes.first; node; node = node->next) {
+			if (node->type == NODE_GROUP && node->id) {
+				if (preview_mat_has_sss(NULL, (bNodeTree *)node->id))
 					return 1;
 			}
-			else if(node->id && ELEM(node->type, SH_NODE_MATERIAL, SH_NODE_MATERIAL_EXT)) {
-				mat= (Material *)node->id;
-				if(mat->sss_flag & MA_DIFF_SSS)
+			else if (node->id && ELEM(node->type, SH_NODE_MATERIAL, SH_NODE_MATERIAL_EXT)) {
+				mat = (Material *)node->id;
+				if (mat->sss_flag & MA_DIFF_SSS)
 					return 1;
 			}
 		}
@@ -226,75 +239,75 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
 	Scene *sce;
 	Base *base;
 	
-	if(pr_main==NULL) return NULL;
+	if (pr_main == NULL) return NULL;
 	
-	sce= pr_main->scene.first;
-	if(sce) {
+	sce = pr_main->scene.first;
+	if (sce) {
 		
 		/* this flag tells render to not execute depsgraph or ipos etc */
 		sce->r.scemode |= R_PREVIEWBUTS;
 		/* set world always back, is used now */
-		sce->world= pr_main->world.first;
+		sce->world = pr_main->world.first;
 		/* now: exposure copy */
-		if(scene->world) {
-			sce->world->exp= scene->world->exp;
-			sce->world->range= scene->world->range;
+		if (scene->world) {
+			sce->world->exp = scene->world->exp;
+			sce->world->range = scene->world->range;
 		}
 		
 		sce->r.color_mgt_flag = scene->r.color_mgt_flag;
 		
 		/* prevent overhead for small renders and icons (32) */
-		if(id && sp->sizex < 40)
-			sce->r.xparts= sce->r.yparts= 1;
+		if (id && sp->sizex < 40)
+			sce->r.xparts = sce->r.yparts = 1;
 		else
-			sce->r.xparts= sce->r.yparts= 4;
+			sce->r.xparts = sce->r.yparts = 4;
 		
 		/* exception: don't color manage texture previews or icons */
-		if((id && sp->pr_method==PR_ICON_RENDER) || id_type == ID_TE)
+		if ((id && sp->pr_method == PR_ICON_RENDER) || id_type == ID_TE)
 			sce->r.color_mgt_flag &= ~R_COLOR_MANAGEMENT;
 		
-		if((id && sp->pr_method==PR_ICON_RENDER) && id_type != ID_WO)
-			sce->r.alphamode= R_ALPHAPREMUL;
+		if ((id && sp->pr_method == PR_ICON_RENDER) && id_type != ID_WO)
+			sce->r.alphamode = R_ALPHAPREMUL;
 		else
-			sce->r.alphamode= R_ADDSKY;
+			sce->r.alphamode = R_ADDSKY;
 
-		sce->r.cfra= scene->r.cfra;
+		sce->r.cfra = scene->r.cfra;
 		BLI_strncpy(sce->r.engine, scene->r.engine, sizeof(sce->r.engine));
 		
-		if(id_type==ID_MA) {
-			Material *mat= NULL, *origmat= (Material *)id;
+		if (id_type == ID_MA) {
+			Material *mat = NULL, *origmat = (Material *)id;
 			
-			if(origmat) {
+			if (origmat) {
 				/* work on a copy */
-				mat= localize_material(origmat);
-				sp->matcopy= mat;
+				mat = localize_material(origmat);
+				sp->matcopy = mat;
 				BLI_addtail(&pr_main->mat, mat);
 				
-				init_render_material(mat, 0, NULL);		/* call that retrieves mode_l */
+				init_render_material(mat, 0, NULL);     /* call that retrieves mode_l */
 				end_render_material(mat);
 				
 				/* un-useful option */
-				if(sp->pr_method==PR_ICON_RENDER)
+				if (sp->pr_method == PR_ICON_RENDER)
 					mat->shade_flag &= ~MA_OBCOLOR;
 
 				/* turn on raytracing if needed */
-				if(mat->mode_l & MA_RAYMIRROR)
+				if (mat->mode_l & MA_RAYMIRROR)
 					sce->r.mode |= R_RAYTRACE;
-				if(mat->material_type == MA_TYPE_VOLUME)
+				if (mat->material_type == MA_TYPE_VOLUME)
 					sce->r.mode |= R_RAYTRACE;
-				if((mat->mode_l & MA_RAYTRANSP) && (mat->mode_l & MA_TRANSP))
+				if ((mat->mode_l & MA_RAYTRANSP) && (mat->mode_l & MA_TRANSP))
 					sce->r.mode |= R_RAYTRACE;
-				if(preview_mat_has_sss(mat, NULL))
+				if (preview_mat_has_sss(mat, NULL))
 					sce->r.mode |= R_SSS;
 				
 				/* turn off fake shadows if needed */
 				/* this only works in a specific case where the preview.blend contains
 				 * an object starting with 'c' which has a material linked to it (not the obdata)
 				 * and that material has a fake shadow texture in the active texture slot */
-				for(base= sce->base.first; base; base= base->next) {
-					if(base->object->id.name[2]=='c') {
-						Material *shadmat= give_current_material(base->object, base->object->actcol);
-						if(shadmat) {
+				for (base = sce->base.first; base; base = base->next) {
+					if (base->object->id.name[2] == 'c') {
+						Material *shadmat = give_current_material(base->object, base->object->actcol);
+						if (shadmat) {
 							if (mat->mode & MA_SHADBUF) shadmat->septex = 0;
 							else shadmat->septex |= 1;
 						}
@@ -303,11 +316,11 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
 				
 				/* turn off bounce lights for volume, 
 				 * doesn't make much visual difference and slows it down too */
-				if(mat->material_type == MA_TYPE_VOLUME) {
-					for(base= sce->base.first; base; base= base->next) {
-						if(base->object->type == OB_LAMP) {
+				if (mat->material_type == MA_TYPE_VOLUME) {
+					for (base = sce->base.first; base; base = base->next) {
+						if (base->object->type == OB_LAMP) {
 							/* if doesn't match 'Lamp.002' --> main key light */
-							if( strcmp(base->object->id.name+2, "Lamp.002") != 0 ) {
+							if (strcmp(base->object->id.name + 2, "Lamp.002") != 0) {
 								base->object->restrictflag |= OB_RESTRICT_RENDER;
 							}
 						}
@@ -315,17 +328,17 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
 				}
 
 				
-				if(sp->pr_method==PR_ICON_RENDER) {
+				if (sp->pr_method == PR_ICON_RENDER) {
 					if (mat->material_type == MA_TYPE_HALO) {
-						sce->lay= 1<<MA_FLAT;
+						sce->lay = 1 << MA_FLAT;
 					} 
 					else {
-						sce->lay= 1<<MA_SPHERE_A;
+						sce->lay = 1 << MA_SPHERE_A;
 					}
 				}
 				else {
-					sce->lay= 1<<mat->pr_type;
-					if(mat->nodetree && sp->pr_method==PR_NODE_RENDER) {
+					sce->lay = 1 << mat->pr_type;
+					if (mat->nodetree && sp->pr_method == PR_NODE_RENDER) {
 						/* two previews, they get copied by wmJob */
 						ntreeInitPreview(mat->nodetree, sp->sizex, sp->sizey);
 						ntreeInitPreview(origmat->nodetree, sp->sizex, sp->sizey);
@@ -333,114 +346,115 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
 				}
 			}
 			else {
-				sce->r.mode &= ~(R_OSA|R_RAYTRACE|R_SSS);
+				sce->r.mode &= ~(R_OSA | R_RAYTRACE | R_SSS);
 				
 			}
 			
-			for(base= sce->base.first; base; base= base->next) {
-				if(base->object->id.name[2]=='p') {
+			for (base = sce->base.first; base; base = base->next) {
+				if (base->object->id.name[2] == 'p') {
 					/* copy over object color, in case material uses it */
 					copy_v4_v4(base->object->col, sp->col);
 					
-					if(OB_TYPE_SUPPORT_MATERIAL(base->object->type)) {
+					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 > 0, 1) - 1;
+						Material ***matar = give_matarar(base->object);
+						int actcol = MAX2(base->object->actcol - 1, 0);
 
-						if(matar && actcol < base->object->totcol)
-							(*matar)[actcol]= mat;
-					} else if (base->object->type == OB_LAMP) {
+						if (matar && actcol < base->object->totcol)
+							(*matar)[actcol] = mat;
+					}
+					else if (base->object->type == OB_LAMP) {
 						base->object->restrictflag &= ~OB_RESTRICT_RENDER;
 					}
 				}
 			}
 		}
-		else if(id_type==ID_TE) {
-			Tex *tex= NULL, *origtex= (Tex *)id;
+		else if (id_type == ID_TE) {
+			Tex *tex = NULL, *origtex = (Tex *)id;
 			
-			if(origtex) {
-				tex= localize_texture(origtex);
-				sp->texcopy= tex;
+			if (origtex) {
+				tex = localize_texture(origtex);
+				sp->texcopy = tex;
 				BLI_addtail(&pr_main->tex, tex);
 			}			
-			sce->lay= 1<<MA_TEXTURE;
+			sce->lay = 1 << MA_TEXTURE;
 			
-			for(base= sce->base.first; base; base= base->next) {
-				if(base->object->id.name[2]=='t') {
-					Material *mat= give_current_material(base->object, base->object->actcol);
-					if(mat && mat->mtex[0]) {
-						mat->mtex[0]->tex= tex;
+			for (base = sce->base.first; base; base = base->next) {
+				if (base->object->id.name[2] == 't') {
+					Material *mat = give_current_material(base->object, base->object->actcol);
+					if (mat && mat->mtex[0]) {
+						mat->mtex[0]->tex = tex;
 						
-						if(tex && sp->slot)
+						if (tex && sp->slot)
 							mat->mtex[0]->which_output = sp->slot->which_output;
 						
 						/* show alpha in this case */
-						if(tex==NULL || (tex->flag & TEX_PRV_ALPHA)) {
+						if (tex == NULL || (tex->flag & TEX_PRV_ALPHA)) {
 							mat->mtex[0]->mapto |= MAP_ALPHA;
-							mat->alpha= 0.0f;
+							mat->alpha = 0.0f;
 						}
 						else {
 							mat->mtex[0]->mapto &= ~MAP_ALPHA;
-							mat->alpha= 1.0f;
+							mat->alpha = 1.0f;
 						}
 					}
 				}
 			}
 
-			if(tex && tex->nodetree && sp->pr_method==PR_NODE_RENDER) {
+			if (tex && tex->nodetree && sp->pr_method == PR_NODE_RENDER) {
 				/* two previews, they get copied by wmJob */
 				ntreeInitPreview(origtex->nodetree, sp->sizex, sp->sizey);
 				ntreeInitPreview(tex->nodetree, sp->sizex, sp->sizey);
 			}
 		}
-		else if(id_type==ID_LA) {
-			Lamp *la= NULL, *origla= (Lamp *)id;
+		else if (id_type == ID_LA) {
+			Lamp *la = NULL, *origla = (Lamp *)id;
 
 			/* work on a copy */
-			if(origla) {
-				la= localize_lamp(origla);
-				sp->lampcopy= la;
+			if (origla) {
+				la = localize_lamp(origla);
+				sp->lampcopy = la;
 				BLI_addtail(&pr_main->lamp, la);
 			}
 			
-			if(la && la->type==LA_SUN && (la->sun_effect_type & LA_SUN_EFFECT_SKY)) {
-				sce->lay= 1<<MA_ATMOS;
-				sce->world= scene->world;
-				sce->camera= (Object *)BLI_findstring(&pr_main->object, "CameraAtmo", offsetof(ID, name)+2);
+			if (la && la->type == LA_SUN && (la->sun_effect_type & LA_SUN_EFFECT_SKY)) {
+				sce->lay = 1 << MA_ATMOS;
+				sce->world = scene->world;
+				sce->camera = (Object *)BLI_findstring(&pr_main->object, "CameraAtmo", offsetof(ID, name) + 2);
 			}
 			else {
-				sce->lay= 1<<MA_LAMP;
-				sce->world= NULL;
-				sce->camera= (Object *)BLI_findstring(&pr_main->object, "Camera", offsetof(ID, name)+2);
+				sce->lay = 1 << MA_LAMP;
+				sce->world = NULL;
+				sce->camera = (Object *)BLI_findstring(&pr_main->object, "Camera", offsetof(ID, name) + 2);
 			}
 			sce->r.mode &= ~R_SHADOW;
 			
-			for(base= sce->base.first; base; base= base->next) {
-				if(base->object->id.name[2]=='p') {
-					if(base->object->type==OB_LAMP)
-						base->object->data= la;
+			for (base = sce->base.first; base; base = base->next) {
+				if (base->object->id.name[2] == 'p') {
+					if (base->object->type == OB_LAMP)
+						base->object->data = la;
 				}
 			}
 
-			if(la && la->nodetree && sp->pr_method==PR_NODE_RENDER) {
+			if (la && la->nodetree && sp->pr_method == PR_NODE_RENDER) {
 				/* two previews, they get copied by wmJob */
 				ntreeInitPreview(origla->nodetree, sp->sizex, sp->sizey);
 				ntreeInitPreview(la->nodetree, sp->sizex, sp->sizey);
 			}
 		}
-		else if(id_type==ID_WO) {
-			World *wrld= NULL, *origwrld= (World *)id;
+		else if (id_type == ID_WO) {
+			World *wrld = NULL, *origwrld = (World *)id;
 
-			if(origwrld) {
-				wrld= localize_world(origwrld);
-				sp->worldcopy= wrld;
+			if (origwrld) {
+				wrld = localize_world(origwrld);
+				sp->worldcopy = wrld;
 				BLI_addtail(&pr_main->world, wrld);
 			}
 
-			sce->lay= 1<<MA_SKY;
-			sce->world= wrld;
+			sce->lay = 1 << MA_SKY;
+			sce->world = wrld;
 
-			if(wrld && wrld->nodetree && sp->pr_method==PR_NODE_RENDER) {
+			if (wrld && wrld->nodetree && sp->pr_method == PR_NODE_RENDER) {
 				/* two previews, they get copied by wmJob */
 				ntreeInitPreview(wrld->nodetree, sp->sizex, sp->sizey);
 				ntreeInitPreview(origwrld->nodetree, sp->sizex, sp->sizey);
@@ -460,8 +474,8 @@ static int ed_preview_draw_rect(ScrArea *sa, Scene *sce, ID *id, int split, int
 	Render *re;
 	RenderResult rres;
 	char name[32];
-	int do_gamma_correct=0, do_predivide=0;
-	int offx=0, newx= rect->xmax-rect->xmin, newy= rect->ymax-rect->ymin;
+	int do_gamma_correct = 0, do_predivide = 0;
+	int offx = 0, newx = rect->xmax - rect->xmin, newy = rect->ymax - rect->ymin;
 
 	if (id && GS(id->name) != ID_TE) {
 		/* exception: don't color manage texture previews - show the raw values */
@@ -471,43 +485,43 @@ static int ed_preview_draw_rect(ScrArea *sa, Scene *sce, ID *id, int split, int
 		}
 	}
 
-	if(!split || first) sprintf(name, "Preview %p", (void *)sa);
+	if (!split || first) sprintf(name, "Preview %p", (void *)sa);
 	else sprintf(name, "SecondPreview %p", (void *)sa);
 
-	if(split) {
-		if(first) {
-			offx= 0;
-			newx= newx/2;
+	if (split) {
+		if (first) {
+			offx = 0;
+			newx = newx / 2;
 		}
 		else {
-			offx= newx/2;
-			newx= newx - newx/2;
+			offx = newx / 2;
+			newx = newx - newx / 2;
 		}
 	}
 
-	re= RE_GetRender(name);
+	re = RE_GetRender(name);
 	RE_AcquireResultImage(re, &rres);
 
-	if(rres.rectf) {
+	if (rres.rectf) {
 		
-		if(ABS(rres.rectx-newx)<2 && ABS(rres.recty-newy)<2) {
+		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 = MAX2(newrect->xmax, rect->xmin + rres.rectx + offx);
+			newrect->ymax = MAX2(newrect->ymax, rect->ymin + rres.recty);
 
-			if(rres.rectx && rres.recty) {
+			if (rres.rectx && rres.recty) {
 				/* temporary conversion to byte for drawing */
-				float fx= rect->xmin + offx;
-				float fy= rect->ymin;
-				int profile_from= (do_gamma_correct)? IB_PROFILE_LINEAR_RGB: IB_PROFILE_SRGB;
-				int dither= 0;
+				float fx = rect->xmin + offx;
+				float fy = rect->ymin;
+				int profile_from = (do_gamma_correct) ? IB_PROFILE_LINEAR_RGB : IB_PROFILE_SRGB;
+				int dither = 0;
 				unsigned char *rect_byte;
 
-				rect_byte= MEM_mallocN(rres.rectx*rres.recty*sizeof(int), "ed_preview_draw_rect");
+				rect_byte = MEM_mallocN(rres.rectx * rres.recty * sizeof(int), "ed_preview_draw_rect");
 
 				IMB_buffer_byte_from_float(rect_byte, rres.rectf,
-					4, dither, IB_PROFILE_SRGB, profile_from, do_predivide, 
-					rres.rectx, rres.recty, rres.rectx, rres.rectx);
+				                           4, dither, IB_PROFILE_SRGB, profile_from, do_predivide,
+				                           rres.rectx, rres.recty, rres.rectx, rres.rectx);
 
 				glaDrawPixelsSafe(fx, fy, rres.rectx, rres.recty, rres.rectx, GL_RGBA, GL_UNSIGNED_BYTE, rect_byte);
 
@@ -525,39 +539,39 @@ static int ed_preview_draw_rect(ScrArea *sa, Scene *sce, ID *id, int split, int
 
 void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, rcti *rect)
 {
-	if(idp) {
-		ScrArea *sa= CTX_wm_area(C);
+	if (idp) {
+		ScrArea *sa = CTX_wm_area(C);
 		Scene *sce = CTX_data_scene(C);
 		ID *id = (ID *)idp;
-		ID *parent= (ID *)parentp;
-		MTex *slot= (MTex *)slotp;
-		SpaceButs *sbuts= sa->spacedata.first;
+		ID *parent = (ID *)parentp;
+		MTex *slot = (MTex *)slotp;
+		SpaceButs *sbuts = sa->spacedata.first;
 		rcti newrect;
 		int ok;
-		int newx= rect->xmax-rect->xmin, newy= rect->ymax-rect->ymin;
+		int newx = rect->xmax - rect->xmin, newy = rect->ymax - rect->ymin;
 
-		newrect.xmin= rect->xmin;
-		newrect.xmax= rect->xmin;
-		newrect.ymin= rect->ymin;
-		newrect.ymax= rect->ymin;
+		newrect.xmin = rect->xmin;
+		newrect.xmax = rect->xmin;
+		newrect.ymin = rect->ymin;
+		newrect.ymax = rect->ymin;
 
-		if(parent) {
+		if (parent) {
 			ok = ed_preview_draw_rect(sa, sce, id, 1, 1, rect, &newrect);
 			ok &= ed_preview_draw_rect(sa, sce, parent, 1, 0, rect, &newrect);
 		}
 		else
 			ok = ed_preview_draw_rect(sa, sce, id, 0, 0, rect, &newrect);
 
-		if(ok)
-			*rect= newrect;
+		if (ok)
+			*rect = newrect;
 
 		/* check for spacetype... */
-		if(sbuts->spacetype==SPACE_BUTS && sbuts->preview) {
-			sbuts->preview= 0;
-			ok= 0;
+		if (sbuts->spacetype == SPACE_BUTS && sbuts->preview) {
+			sbuts->preview = 0;
+			ok = 0;
 		}
 	
-		if(ok==0) {
+		if (ok == 0) {
 			ED_preview_shader_job(C, sa, id, parent, slot, newx, newy, PR_BUTS_RENDER);
 		}
 	}	
@@ -568,15 +582,15 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r
 /* inside thread, called by renderer, sets job update value */
 static void shader_preview_draw(void *spv, RenderResult *UNUSED(rr), volatile struct rcti *UNUSED(rect))
 {
-	ShaderPreview *sp= spv;
+	ShaderPreview *sp = spv;
 	
-	*(sp->do_update)= 1;
+	*(sp->do_update) = 1;
 }
 
 /* called by renderer, checks job value */
 static int shader_preview_break(void *spv)
 {
-	ShaderPreview *sp= spv;
+	ShaderPreview *sp = spv;
 
 	return *(sp->stop);
 }
@@ -584,32 +598,32 @@ static int shader_preview_break(void *spv)
 /* outside thread, called before redraw notifiers, it moves finished preview over */
 static void shader_preview_updatejob(void *spv)
 {
-	ShaderPreview *sp= spv;
+	ShaderPreview *sp = spv;
 	
-	if(sp->id) {
-		if(sp->pr_method==PR_NODE_RENDER) {
-			if( GS(sp->id->name) == ID_MA) {
-				Material *mat= (Material *)sp->id;
+	if (sp->id) {
+		if (sp->pr_method == PR_NODE_RENDER) {
+			if (GS(sp->id->name) == ID_MA) {
+				Material *mat = (Material *)sp->id;
 				
-				if(sp->matcopy && mat->nodetree && sp->matcopy->nodetree)
+				if (sp->matcopy && mat->nodetree && sp->matcopy->nodetree)
 					ntreeLocalSync(sp->matcopy->nodetree, mat->nodetree);
 			}
-			else if( GS(sp->id->name) == ID_TE) {
-				Tex *tex= (Tex *)sp->id;
+			else if (GS(sp->id->name) == ID_TE) {
+				Tex *tex = (Tex *)sp->id;
 				
-				if(sp->texcopy && tex->nodetree && sp->texcopy->nodetree)
+				if (sp->texcopy && tex->nodetree && sp->texcopy->nodetree)
 					ntreeLocalSync(sp->texcopy->nodetree, tex->nodetree);
 			}
-			else if( GS(sp->id->name) == ID_WO) {
-				World *wrld= (World *)sp->id;
+			else if (GS(sp->id->name) == ID_WO) {
+				World *wrld = (World *)sp->id;
 				
-				if(sp->worldcopy && wrld->nodetree && sp->worldcopy->nodetree)
+				if (sp->worldcopy && wrld->nodetree && sp->worldcopy->nodetree)
 					ntreeLocalSync(sp->worldcopy->nodetree, wrld->nodetree);
 			}
-			else if( GS(sp->id->name) == ID_LA) {
-				Lamp *la= (Lamp *)sp->id;
+			else if (GS(sp->id->name) == ID_LA) {
+				Lamp *la = (Lamp *)sp->id;
 				
-				if(sp->lampcopy && la->nodetree && sp->lampcopy->nodetree)
+				if (sp->lampcopy && la->nodetree && sp->lampcopy->nodetree)
 					ntreeLocalSync(sp->lampcopy->nodetree, la->nodetree);
 			}
 		}		
@@ -621,78 +635,78 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
 	Render *re;
 	Scene *sce;
 	float oldlens;
-	short idtype= GS(id->name);
+	short idtype = GS(id->name);
 	char name[32];
 	int sizex;
 	
 	/* get the stuff from the builtin preview dbase */
-	sce= preview_prepare_scene(sp->scene, id, idtype, sp); // XXX sizex
-	if(sce==NULL) return;
+	sce = preview_prepare_scene(sp->scene, id, idtype, sp); // XXX sizex
+	if (sce == NULL) return;
 	
-	if(!split || first) sprintf(name, "Preview %p", sp->owner);
+	if (!split || first) sprintf(name, "Preview %p", sp->owner);
 	else sprintf(name, "SecondPreview %p", sp->owner);
-	re= RE_GetRender(name);
+	re = RE_GetRender(name);
 	
 	/* full refreshed render from first tile */
-	if(re==NULL)
-		re= RE_NewRender(name);
+	if (re == NULL)
+		re = RE_NewRender(name);
 		
 	/* sce->r gets copied in RE_InitState! */
-	sce->r.scemode &= ~(R_MATNODE_PREVIEW|R_TEXNODE_PREVIEW);
+	sce->r.scemode &= ~(R_MATNODE_PREVIEW | R_TEXNODE_PREVIEW);
 	sce->r.scemode &= ~R_NO_IMAGE_LOAD;
 
-	if(sp->pr_method==PR_ICON_RENDER) {
+	if (sp->pr_method == PR_ICON_RENDER) {
 		sce->r.scemode |= R_NO_IMAGE_LOAD;
 		sce->r.mode |= R_OSA;
 	}
-	else if(sp->pr_method==PR_NODE_RENDER) {
-		if(idtype == ID_MA) sce->r.scemode |= R_MATNODE_PREVIEW;
-		else if(idtype == ID_TE) sce->r.scemode |= R_TEXNODE_PREVIEW;
+	else if (sp->pr_method == PR_NODE_RENDER) {
+		if (idtype == ID_MA) sce->r.scemode |= R_MATNODE_PREVIEW;
+		else if (idtype == ID_TE) sce->r.scemode |= R_TEXNODE_PREVIEW;
 		sce->r.mode &= ~R_OSA;
 	}
-	else {	/* PR_BUTS_RENDER */
+	else {  /* PR_BUTS_RENDER */
 		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;
+	if (split) {
+		if (first) sizex = sp->sizex / 2;
+		else sizex = sp->sizex - sp->sizex / 2;
 	}
-	else sizex= sp->sizex;
+	else sizex = sp->sizex;
 
 	/* allocates or re-uses render result */
-	sce->r.xsch= sizex;
-	sce->r.ysch= sp->sizey;
-	sce->r.size= 100;
+	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)) {
+	if (ELEM(sp->pr_method, PR_BUTS_RENDER, PR_NODE_RENDER)) {
 		RE_display_draw_cb(re, sp, shader_preview_draw);
 	}
 	/* set this for all previews, default is react to G.afbreek still */
 	RE_test_break_cb(re, sp, shader_preview_break);
 	
 	/* lens adjust */
-	oldlens= ((Camera *)sce->camera->data)->lens;
-	if(sizex > sp->sizey)
-		((Camera *)sce->camera->data)->lens *= (float)sp->sizey/(float)sizex;
+	oldlens = ((Camera *)sce->camera->data)->lens;
+	if (sizex > sp->sizey)
+		((Camera *)sce->camera->data)->lens *= (float)sp->sizey / (float)sizex;
 
 	/* entire cycle for render engine */
 	RE_PreviewRender(re, pr_main, sce);
 
-	((Camera *)sce->camera->data)->lens= oldlens;
+	((Camera *)sce->camera->data)->lens = oldlens;
 
 	/* handle results */
-	if(sp->pr_method==PR_ICON_RENDER) {
+	if (sp->pr_method == PR_ICON_RENDER) {
 		// char *rct= (char *)(sp->pr_rect + 32*16 + 16);
 		
-		if(sp->pr_rect)
+		if (sp->pr_rect)
 			RE_ResultGet32(re, sp->pr_rect);
 	}
 	else {
 		/* validate owner */
-		//if(ri->rect==NULL)
+		//if (ri->rect==NULL)
 		//	ri->rect= MEM_mallocN(sizeof(int)*ri->pr_rectx*ri->pr_recty, "BIF_previewrender");
 		//RE_ResultGet32(re, ri->rect);
 	}
@@ -701,9 +715,9 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
 	preview_prepare_scene(sp->scene, NULL, GS(id->name), sp);
 	
 	/* XXX bad exception, end-exec is not being called in render, because it uses local main */
-//	if(idtype == ID_TE) {
+//	if (idtype == ID_TE) {
 //		Tex *tex= (Tex *)id;
-//		if(tex->use_nodes && tex->nodetree)
+//		if (tex->use_nodes && tex->nodetree)
 //			ntreeEndExecTree(tex->nodetree);
 //	}
 
@@ -712,26 +726,26 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs
 /* runs inside thread for material and icons */
 static void shader_preview_startjob(void *customdata, short *stop, short *do_update)
 {
-	ShaderPreview *sp= customdata;
+	ShaderPreview *sp = customdata;
 
-	sp->stop= stop;
-	sp->do_update= do_update;
+	sp->stop = stop;
+	sp->do_update = do_update;
 
-	if(sp->parent) {
+	if (sp->parent) {
 		shader_preview_render(sp, sp->id, 1, 1);
 		shader_preview_render(sp, sp->parent, 1, 0);
 	}
 	else
 		shader_preview_render(sp, sp->id, 0, 0);
 
-	*do_update= 1;
+	*do_update = 1;
 }
 
 static void shader_preview_free(void *customdata)
 {
-	ShaderPreview *sp= customdata;
+	ShaderPreview *sp = customdata;
 	
-	if(sp->matcopy) {
+	if (sp->matcopy) {
 		struct IDProperty *properties;
 		int a;
 		
@@ -742,21 +756,21 @@ static void shader_preview_free(void *customdata)
 		BLI_remlink(&pr_main->mat, sp->matcopy);
 		
 		/* free_material decrements texture, prevent this. hack alert! */
-		for(a=0; a<MAX_MTEX; a++) {
-			MTex *mtex= sp->matcopy->mtex[a];
-			if(mtex && mtex->tex) mtex->tex= NULL;
+		for (a = 0; a < MAX_MTEX; a++) {
+			MTex *mtex = sp->matcopy->mtex[a];
+			if (mtex && mtex->tex) mtex->tex = NULL;
 		}
 		
 		free_material(sp->matcopy);
 
-		properties= IDP_GetProperties((ID *)sp->matcopy, FALSE);
+		properties = IDP_GetProperties((ID *)sp->matcopy, FALSE);
 		if (properties) {
 			IDP_FreeProperty(properties);
 			MEM_freeN(properties);
 		}
 		MEM_freeN(sp->matcopy);
 	}
-	if(sp->texcopy) {
+	if (sp->texcopy) {
 		struct IDProperty *properties;
 		/* node previews */
 		shader_preview_updatejob(sp);
@@ -765,14 +779,14 @@ static void shader_preview_free(void *customdata)
 		BLI_remlink(&pr_main->tex, sp->texcopy);
 		free_texture(sp->texcopy);
 		
-		properties= IDP_GetProperties((ID *)sp->texcopy, FALSE);
+		properties = IDP_GetProperties((ID *)sp->texcopy, FALSE);
 		if (properties) {
 			IDP_FreeProperty(properties);
 			MEM_freeN(properties);
 		}
 		MEM_freeN(sp->texcopy);
 	}
-	if(sp->worldcopy) {
+	if (sp->worldcopy) {
 		struct IDProperty *properties;
 		/* node previews */
 		shader_preview_updatejob(sp);
@@ -781,14 +795,14 @@ static void shader_preview_free(void *customdata)
 		BLI_remlink(&pr_main->world, sp->worldcopy);
 		free_world(sp->worldcopy);
 		
-		properties= IDP_GetProperties((ID *)sp->worldcopy, FALSE);
+		properties = IDP_GetProperties((ID *)sp->worldcopy, FALSE);
 		if (properties) {
 			IDP_FreeProperty(properties);
 			MEM_freeN(properties);
 		}
 		MEM_freeN(sp->worldcopy);
 	}
-	if(sp->lampcopy) {
+	if (sp->lampcopy) {
 		struct IDProperty *properties;
 		/* node previews */
 		shader_preview_updatejob(sp);
@@ -797,7 +811,7 @@ static void shader_preview_free(void *customdata)
 		BLI_remlink(&pr_main->lamp, sp->lampcopy);
 		free_lamp(sp->lampcopy);
 		
-		properties= IDP_GetProperties((ID *)sp->lampcopy, FALSE);
+		properties = IDP_GetProperties((ID *)sp->lampcopy, FALSE);
 		if (properties) {
 			IDP_FreeProperty(properties);
 			MEM_freeN(properties);
@@ -818,7 +832,7 @@ static void icon_copy_rect(ImBuf *ibuf, unsigned int w, unsigned int h, unsigned
 	short ex, ey, dx, dy;
 
 	/* paranoia test */
-	if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL))
+	if (ibuf == NULL || (ibuf->rect == NULL && ibuf->rect_float == NULL))
 		return;
 	
 	/* waste of cpu cyles... but the imbuf API has no other way to scale fast (ton) */
@@ -829,10 +843,10 @@ static void icon_copy_rect(ImBuf *ibuf, unsigned int w, unsigned int h, unsigned
 	
 	if (ima->x > ima->y) {
 		scaledx = (float)w;
-		scaledy =  ( (float)ima->y/(float)ima->x )*(float)w;
+		scaledy =  ( (float)ima->y / (float)ima->x) * (float)w;
 	}
 	else {			
-		scaledx =  ( (float)ima->x/(float)ima->y )*(float)h;
+		scaledx =  ( (float)ima->x / (float)ima->y) * (float)h;
 		scaledy = (float)h;
 	}
 	
@@ -845,15 +859,15 @@ static void icon_copy_rect(ImBuf *ibuf, unsigned int w, unsigned int h, unsigned
 	IMB_scalefastImBuf(ima, ex, ey);
 	
 	/* if needed, convert to 32 bits */
-	if(ima->rect==NULL)
+	if (ima->rect == NULL)
 		IMB_rect_from_float(ima);
 
 	srect = ima->rect;
 	drect = rect;
 
-	drect+= dy*w+dx;
-	for (;ey > 0; ey--){		
-		memcpy(drect,srect, ex * sizeof(int));
+	drect += dy * w + dx;
+	for (; ey > 0; ey--) {
+		memcpy(drect, srect, ex * sizeof(int));
 		drect += w;
 		srect += ima->x;
 	}
@@ -863,143 +877,200 @@ static void icon_copy_rect(ImBuf *ibuf, unsigned int w, unsigned int h, unsigned
 
 static void set_alpha(char *cp, int sizex, int sizey, char alpha) 
 {
-	int a, size= sizex*sizey;
+	int a, size = sizex * sizey;
 
-	for(a=0; a<size; a++, cp+=4)
-		cp[3]= alpha;
+	for (a = 0; a < size; a++, cp += 4)
+		cp[3] = alpha;
 }
 
 static void icon_preview_startjob(void *customdata, short *stop, short *do_update)
 {
-	ShaderPreview *sp= customdata;
-	ID *id= sp->id;
-	short idtype= GS(id->name);
+	ShaderPreview *sp = customdata;
+	ID *id = sp->id;
+	short idtype = GS(id->name);
 
-	if(idtype == ID_IM) {
-		Image *ima= (Image*)id;
-		ImBuf *ibuf= NULL;
-		ImageUser iuser= {NULL};
+	if (idtype == ID_IM) {
+		Image *ima = (Image *)id;
+		ImBuf *ibuf = NULL;
+		ImageUser iuser = {NULL};
 
 		/* ima->ok is zero when Image cannot load */
-		if(ima==NULL || ima->ok==0)
+		if (ima == NULL || ima->ok == 0)
 			return;
 
 		/* setup dummy image user */
-		iuser.ok= iuser.framenr= 1;
-		iuser.scene= sp->scene;
+		iuser.ok = iuser.framenr = 1;
+		iuser.scene = sp->scene;
 		
 		/* 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 */
+		 * already there. Very expensive for large images. Need to find a way to 
+		 * only get existing ibuf */
 		ibuf = BKE_image_get_ibuf(ima, &iuser);
-		if(ibuf==NULL || ibuf->rect==NULL)
+		if (ibuf == NULL || ibuf->rect == NULL)
 			return;
 		
 		icon_copy_rect(ibuf, sp->sizex, sp->sizey, sp->pr_rect);
 
-		*do_update= 1;
+		*do_update = 1;
 	}
-	else if(idtype == ID_BR) {
-		Brush *br= (Brush*)id;
+	else if (idtype == ID_BR) {
+		Brush *br = (Brush *)id;
 
-		br->icon_imbuf= get_brush_icon(br);
+		br->icon_imbuf = get_brush_icon(br);
 
-		memset(sp->pr_rect, 0x888888, sp->sizex*sp->sizey*sizeof(unsigned int));
+		memset(sp->pr_rect, 0x888888, sp->sizex * sp->sizey * sizeof(unsigned int));
 
-		if(!(br->icon_imbuf) || !(br->icon_imbuf->rect))
+		if (!(br->icon_imbuf) || !(br->icon_imbuf->rect))
 			return;
 
 		icon_copy_rect(br->icon_imbuf, sp->sizex, sp->sizey, sp->pr_rect);
 
-		*do_update= 1;
+		*do_update = 1;
 	}
 	else {
 		/* re-use shader job */
 		shader_preview_startjob(customdata, stop, do_update);
 
 		/* world is rendered with alpha=0, so it wasn't displayed 
-		   this could be render option for sky to, for later */
-		if(idtype == ID_WO) {
-			set_alpha((char*)sp->pr_rect, sp->sizex, sp->sizey, 255);
+		 * this could be render option for sky to, for later */
+		if (idtype == ID_WO) {
+			set_alpha((char *)sp->pr_rect, sp->sizex, sp->sizey, 255);
 		}
-		else if(idtype == ID_MA) {
-			Material* ma = (Material*)id;
+		else if (idtype == ID_MA) {
+			Material *ma = (Material *)id;
 
-			if(ma->material_type == MA_TYPE_HALO)
-				set_alpha((char*)sp->pr_rect, sp->sizex, sp->sizey, 255);
+			if (ma->material_type == MA_TYPE_HALO)
+				set_alpha((char *)sp->pr_rect, sp->sizex, sp->sizey, 255);
 		}
 	}
 }
 
 /* use same function for icon & shader, so the job manager
-   does not run two of them at the same time. */
+ * does not run two of them at the same time. */
 
 static void common_preview_startjob(void *customdata, short *stop, short *do_update, float *UNUSED(progress))
 {
-	ShaderPreview *sp= customdata;
+	ShaderPreview *sp = customdata;
 
-	if(sp->pr_method == PR_ICON_RENDER)
+	if (sp->pr_method == PR_ICON_RENDER)
 		icon_preview_startjob(customdata, stop, do_update);
 	else
 		shader_preview_startjob(customdata, stop, do_update);
 }
 
-static void common_preview_endjob(void *customdata)
+/* exported functions */
+
+static void icon_preview_add_size(IconPreview *ip, unsigned int *rect, int sizex, int sizey)
 {
-	ShaderPreview *sp= customdata;
+	IconPreviewSize *cur_size = ip->sizes.first, *new_size;
 
-	if(sp->id && GS(sp->id->name) == ID_BR)
-		WM_main_add_notifier(NC_BRUSH|NA_EDITED, sp->id);
+	while (cur_size) {
+		if (cur_size->sizex == sizex && cur_size->sizey == sizey) {
+			/* requested size is already in list, no need to add it again */
+			return;
+		}
+
+		cur_size = cur_size->next;
+	}
+
+	new_size = MEM_callocN(sizeof(IconPreviewSize), "IconPreviewSize");
+	new_size->sizex = sizex;
+	new_size->sizey = sizey;
+	new_size->rect = rect;
+
+	BLI_addtail(&ip->sizes, new_size);
 }
 
-/* exported functions */
+static void icon_preview_startjob_all_sizes(void *customdata, short *stop, short *do_update, float *progress)
+{
+	IconPreview *ip = (IconPreview *)customdata;
+	IconPreviewSize *cur_size = ip->sizes.first;
+
+	while (cur_size) {
+		ShaderPreview *sp = MEM_callocN(sizeof(ShaderPreview), "Icon ShaderPreview");
+
+		/* construct shader preview from image size and previewcustomdata */
+		sp->scene = ip->scene;
+		sp->owner = ip->owner;
+		sp->sizex = cur_size->sizex;
+		sp->sizey = cur_size->sizey;
+		sp->pr_method = PR_ICON_RENDER;
+		sp->pr_rect = cur_size->rect;
+		sp->id = ip->id;
+
+		common_preview_startjob(sp, stop, do_update, progress);
+		shader_preview_free(sp);
+
+		cur_size = cur_size->next;
+	}
+}
+
+static void icon_preview_endjob(void *customdata)
+{
+	IconPreview *ip = customdata;
+
+	if (ip->id && GS(ip->id->name) == ID_BR)
+		WM_main_add_notifier(NC_BRUSH | NA_EDITED, ip->id);
+}
+
+static void icon_preview_free(void *customdata)
+{
+	IconPreview *ip = (IconPreview *)customdata;
+
+	BLI_freelistN(&ip->sizes);
+	MEM_freeN(ip);
+}
 
 void ED_preview_icon_job(const bContext *C, void *owner, ID *id, unsigned int *rect, int sizex, int sizey)
 {
 	wmJob *steve;
-	ShaderPreview *sp;
+	IconPreview *ip, *old_ip;
 	
 	/* suspended start means it starts after 1 timer step, see WM_jobs_timer below */
-	steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Icon Preview", WM_JOB_EXCL_RENDER|WM_JOB_SUSPEND);
-	sp= MEM_callocN(sizeof(ShaderPreview), "shader preview");
+	steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Icon Preview", WM_JOB_EXCL_RENDER | WM_JOB_SUSPEND);
+
+	ip = MEM_callocN(sizeof(IconPreview), "icon preview");
+
+	/* render all resolutions from suspended job too */
+	old_ip = WM_jobs_get_customdata(steve);
+	if (old_ip)
+		BLI_movelisttolist(&ip->sizes, &old_ip->sizes);
 
 	/* customdata for preview thread */
-	sp->scene= CTX_data_scene(C);
-	sp->owner= id;
-	sp->sizex= sizex;
-	sp->sizey= sizey;
-	sp->pr_method= PR_ICON_RENDER;
-	sp->pr_rect= rect;
-	sp->id = id;
+	ip->scene = CTX_data_scene(C);
+	ip->owner = id;
+	ip->id = id;
+
+	icon_preview_add_size(ip, rect, sizex, sizey);
 
 	/* setup job */
-	WM_jobs_customdata(steve, sp, shader_preview_free);
+	WM_jobs_customdata(steve, ip, icon_preview_free);
 	WM_jobs_timer(steve, 0.25, NC_MATERIAL, NC_MATERIAL);
-	WM_jobs_callbacks(steve, common_preview_startjob, NULL, NULL, common_preview_endjob);
+	WM_jobs_callbacks(steve, icon_preview_startjob_all_sizes, NULL, NULL, icon_preview_endjob);
 
 	WM_jobs_start(CTX_wm_manager(C), steve);
 }
 
 void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, MTex *slot, int sizex, int sizey, int method)
 {
-	Object *ob= CTX_data_active_object(C);
+	Object *ob = CTX_data_active_object(C);
 	wmJob *steve;
 	ShaderPreview *sp;
 
-	steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Shader Preview", WM_JOB_EXCL_RENDER);
-	sp= MEM_callocN(sizeof(ShaderPreview), "shader preview");
+	steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Shader Preview", WM_JOB_EXCL_RENDER);
+	sp = MEM_callocN(sizeof(ShaderPreview), "shader preview");
 
 	/* customdata for preview thread */
-	sp->scene= CTX_data_scene(C);
-	sp->owner= owner;
-	sp->sizex= sizex;
-	sp->sizey= sizey;
-	sp->pr_method= method;
+	sp->scene = CTX_data_scene(C);
+	sp->owner = owner;
+	sp->sizex = sizex;
+	sp->sizey = sizey;
+	sp->pr_method = method;
 	sp->id = id;
-	sp->parent= parent;
-	sp->slot= slot;
-	if(ob && ob->totcol) copy_v4_v4(sp->col, ob->col);
-	else sp->col[0]= sp->col[1]= sp->col[2]= sp->col[3]= 1.0f;
+	sp->parent = parent;
+	sp->slot = slot;
+	if (ob && ob->totcol) copy_v4_v4(sp->col, ob->col);
+	else sp->col[0] = sp->col[1] = sp->col[2] = sp->col[3] = 1.0f;
 	
 	/* setup job */
 	WM_jobs_customdata(steve, sp, shader_preview_free);
@@ -1011,8 +1082,8 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
 
 void ED_preview_kill_jobs(const struct bContext *C)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
-	if(wm)
+	wmWindowManager *wm = CTX_wm_manager(C);
+	if (wm)
 		WM_jobs_kill(wm, NULL, common_preview_startjob);
 }
 
diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c
index 87b7791..6722ac5 100644
--- a/source/blender/editors/render/render_shading.c
+++ b/source/blender/editors/render/render_shading.c
@@ -31,6 +31,7 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "DNA_mesh_types.h"
 #include "DNA_curve_types.h"
 #include "DNA_lamp_types.h"
 #include "DNA_material_types.h"
@@ -43,7 +44,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
-#include "BLI_editVert.h"
 #include "BLI_utildefines.h"
 
 #include "BKE_animsys.h"
@@ -62,6 +62,7 @@
 #include "BKE_scene.h"
 #include "BKE_texture.h"
 #include "BKE_world.h"
+#include "BKE_tessmesh.h"
 
 #include "IMB_imbuf.h"
 #include "IMB_imbuf_types.h"
@@ -86,20 +87,20 @@
 
 #include "RE_pipeline.h"
 
-#include "render_intern.h"	// own include
+#include "render_intern.h"  // own include
 
 /********************** material slot operators *********************/
 
 static int material_slot_add_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Object *ob= ED_object_context(C);
+	Object *ob = ED_object_context(C);
 
-	if(!ob)
+	if (!ob)
 		return OPERATOR_CANCELLED;
 
 	object_add_material_slot(ob);
-	WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
-	WM_event_add_notifier(C, NC_OBJECT|ND_OB_SHADING, ob);
+	WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+	WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, ob);
 	
 	return OPERATOR_FINISHED;
 }
@@ -107,35 +108,35 @@ static int material_slot_add_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_material_slot_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Material Slot";
-	ot->idname= "OBJECT_OT_material_slot_add";
-	ot->description="Add a new material slot";
+	ot->name = "Add Material Slot";
+	ot->idname = "OBJECT_OT_material_slot_add";
+	ot->description = "Add a new material slot";
 	
 	/* api callbacks */
-	ot->exec= material_slot_add_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->exec = material_slot_add_exec;
+	ot->poll = ED_operator_object_active_editable;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 static int material_slot_remove_exec(bContext *C, wmOperator *op)
 {
-	Object *ob= ED_object_context(C);
+	Object *ob = ED_object_context(C);
 
-	if(!ob)
+	if (!ob)
 		return OPERATOR_CANCELLED;
 
 	/* Removing material slots in edit mode screws things up, see bug #21822.*/
-	if(ob == CTX_data_edit_object(C)) {
+	if (ob == CTX_data_edit_object(C)) {
 		BKE_report(op->reports, RPT_ERROR, "Unable to remove material slot in edit mode");
 		return OPERATOR_CANCELLED;
 	}
 
 	object_remove_material_slot(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_OBJECT|ND_OB_SHADING, ob);
+	WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+	WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, ob);
 	
 	return OPERATOR_FINISHED;
 }
@@ -143,59 +144,61 @@ static int material_slot_remove_exec(bContext *C, wmOperator *op)
 void OBJECT_OT_material_slot_remove(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove Material Slot";
-	ot->idname= "OBJECT_OT_material_slot_remove";
-	ot->description="Remove the selected material slot";
+	ot->name = "Remove Material Slot";
+	ot->idname = "OBJECT_OT_material_slot_remove";
+	ot->description = "Remove the selected material slot";
 	
 	/* api callbacks */
-	ot->exec= material_slot_remove_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->exec = material_slot_remove_exec;
+	ot->poll = ED_operator_object_active_editable;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 static int material_slot_assign_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Object *ob= ED_object_context(C);
+	Object *ob = ED_object_context(C);
 
-	if(!ob)
+	if (!ob)
 		return OPERATOR_CANCELLED;
 
-	if(ob && ob->actcol>0) {
-		if(ob->type == OB_MESH) {
-			EditMesh *em= ((Mesh*)ob->data)->edit_mesh;
-			EditFace *efa;
+	if (ob && ob->actcol > 0) {
+		if (ob->type == OB_MESH) {
+			BMEditMesh *em = BMEdit_FromObject(ob);
+			BMFace *efa;
+			BMIter iter;
 
-			if(em) {
-				for(efa= em->faces.first; efa; efa=efa->next)
-					if(efa->f & SELECT)
-						efa->mat_nr= ob->actcol-1;
+			if (em) {
+				BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+					if (BM_elem_flag_test(efa, BM_ELEM_SELECT))
+						efa->mat_nr = ob->actcol - 1;
+				}
 			}
 		}
-		else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
+		else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
 			Nurb *nu;
-			ListBase *nurbs= curve_editnurbs((Curve*)ob->data);
+			ListBase *nurbs = curve_editnurbs((Curve *)ob->data);
 
-			if(nurbs) {
-				for(nu= nurbs->first; nu; nu= nu->next)
-					if(isNurbsel(nu))
-						nu->mat_nr= nu->charidx= ob->actcol-1;
+			if (nurbs) {
+				for (nu = nurbs->first; nu; nu = nu->next)
+					if (isNurbsel(nu))
+						nu->mat_nr = nu->charidx = ob->actcol - 1;
 			}
 		}
-		else if(ob->type == OB_FONT) {
-			EditFont *ef= ((Curve*)ob->data)->editfont;
+		else if (ob->type == OB_FONT) {
+			EditFont *ef = ((Curve *)ob->data)->editfont;
 			int i, selstart, selend;
 
-			if(ef && BKE_font_getselection(ob, &selstart, &selend)) {
-				for(i=selstart; i<=selend; i++)
+			if (ef && BKE_font_getselection(ob, &selstart, &selend)) {
+				for (i = selstart; i <= selend; i++)
 					ef->textbufinfo[i].mat_nr = ob->actcol;
 			}
 		}
 	}
 
 	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_DATA, ob->data);
 	
 	return OPERATOR_FINISHED;
 }
@@ -203,51 +206,48 @@ static int material_slot_assign_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_material_slot_assign(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Assign Material Slot";
-	ot->idname= "OBJECT_OT_material_slot_assign";
-	ot->description="Assign the material in the selected material slot to the selected vertices";
+	ot->name = "Assign Material Slot";
+	ot->idname = "OBJECT_OT_material_slot_assign";
+	ot->description = "Assign the material in the selected material slot to the selected vertices";
 	
 	/* api callbacks */
-	ot->exec= material_slot_assign_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->exec = material_slot_assign_exec;
+	ot->poll = ED_operator_object_active_editable;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 static int material_slot_de_select(bContext *C, int select)
 {
-	Object *ob= ED_object_context(C);
+	Object *ob = ED_object_context(C);
 
-	if(!ob)
+	if (!ob)
 		return OPERATOR_CANCELLED;
 
-	if(ob->type == OB_MESH) {
-		EditMesh *em= ((Mesh*)ob->data)->edit_mesh;
+	if (ob->type == OB_MESH) {
+		BMEditMesh *em = BMEdit_FromObject(ob);
 
-		if(em) {
-			if(select)
-				EM_select_by_material(em, ob->actcol-1);
-			else
-				EM_deselect_by_material(em, ob->actcol-1);
+		if (em) {
+			EDBM_deselect_by_material(em, ob->actcol - 1, select);
 		}
 	}
-	else if ELEM(ob->type, OB_CURVE, OB_SURF) {
-		ListBase *nurbs= curve_editnurbs((Curve*)ob->data);
+	else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
+		ListBase *nurbs = curve_editnurbs((Curve *)ob->data);
 		Nurb *nu;
 		BPoint *bp;
 		BezTriple *bezt;
 		int a;
 
-		if(nurbs) {
-			for(nu= nurbs->first; nu; nu=nu->next) {
-				if(nu->mat_nr==ob->actcol-1) {
-					if(nu->bezt) {
-						a= nu->pntsu;
-						bezt= nu->bezt;
-						while(a--) {
-							if(bezt->hide==0) {
-								if(select) {
+		if (nurbs) {
+			for (nu = nurbs->first; nu; nu = nu->next) {
+				if (nu->mat_nr == ob->actcol - 1) {
+					if (nu->bezt) {
+						a = nu->pntsu;
+						bezt = nu->bezt;
+						while (a--) {
+							if (bezt->hide == 0) {
+								if (select) {
 									bezt->f1 |= SELECT;
 									bezt->f2 |= SELECT;
 									bezt->f3 |= SELECT;
@@ -261,12 +261,12 @@ static int material_slot_de_select(bContext *C, int select)
 							bezt++;
 						}
 					}
-					else if(nu->bp) {
-						a= nu->pntsu*nu->pntsv;
-						bp= nu->bp;
-						while(a--) {
-							if(bp->hide==0) {
-								if(select) bp->f1 |= SELECT;
+					else if (nu->bp) {
+						a = nu->pntsu * nu->pntsv;
+						bp = nu->bp;
+						while (a--) {
+							if (bp->hide == 0) {
+								if (select) bp->f1 |= SELECT;
 								else bp->f1 &= ~SELECT;
 							}
 							bp++;
@@ -277,7 +277,7 @@ static int material_slot_de_select(bContext *C, int select)
 		}
 	}
 
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, ob->data);
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, ob->data);
 
 	return OPERATOR_FINISHED;
 }
@@ -290,15 +290,15 @@ static int material_slot_select_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_material_slot_select(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Material Slot";
-	ot->idname= "OBJECT_OT_material_slot_select";
-	ot->description="Select vertices assigned to the selected material slot";
+	ot->name = "Select Material Slot";
+	ot->idname = "OBJECT_OT_material_slot_select";
+	ot->description = "Select vertices assigned to the selected material slot";
 	
 	/* api callbacks */
-	ot->exec= material_slot_select_exec;
+	ot->exec = material_slot_select_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 static int material_slot_deselect_exec(bContext *C, wmOperator *UNUSED(op))
@@ -309,34 +309,34 @@ static int material_slot_deselect_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_material_slot_deselect(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Deselect Material Slot";
-	ot->idname= "OBJECT_OT_material_slot_deselect";
-	ot->description="Deselect vertices assigned to the selected material slot";
+	ot->name = "Deselect Material Slot";
+	ot->idname = "OBJECT_OT_material_slot_deselect";
+	ot->description = "Deselect vertices assigned to the selected material slot";
 	
 	/* api callbacks */
-	ot->exec= material_slot_deselect_exec;
+	ot->exec = material_slot_deselect_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 
 static int material_slot_copy_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Object *ob= ED_object_context(C);
+	Object *ob = ED_object_context(C);
 	Material ***matar;
 
-	if(!ob || !(matar= give_matarar(ob)))
+	if (!ob || !(matar = give_matarar(ob)))
 		return OPERATOR_CANCELLED;
 
-	CTX_DATA_BEGIN(C, Object*, ob_iter, selected_editable_objects) {
-		if(ob != ob_iter && give_matarar(ob_iter)) {
+	CTX_DATA_BEGIN(C, Object *, ob_iter, selected_editable_objects) {
+		if (ob != ob_iter && give_matarar(ob_iter)) {
 			if (ob->data != ob_iter->data)
 				assign_matarar(ob_iter, matar, ob->totcol);
 			
-			if(ob_iter->totcol==ob->totcol) {
-				ob_iter->actcol= ob->actcol;
-				WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob_iter);
+			if (ob_iter->totcol == ob->totcol) {
+				ob_iter->actcol = ob->actcol;
+				WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob_iter);
 			}
 		}
 	}
@@ -349,43 +349,43 @@ static int material_slot_copy_exec(bContext *C, wmOperator *UNUSED(op))
 void OBJECT_OT_material_slot_copy(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Copy Material to Others";
-	ot->idname= "OBJECT_OT_material_slot_copy";
-	ot->description="Copies materials to other selected objects";
+	ot->name = "Copy Material to Others";
+	ot->idname = "OBJECT_OT_material_slot_copy";
+	ot->description = "Copies materials to other selected objects";
 
 	/* api callbacks */
-	ot->exec= material_slot_copy_exec;
+	ot->exec = material_slot_copy_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /********************** new material operator *********************/
 
 static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
-	Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
+	Scene *scene = CTX_data_scene(C);
+	Material *ma = CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
 	PointerRNA ptr, idptr;
 	PropertyRNA *prop;
 
 	/* add or copy material */
-	if(ma) {
-		ma= copy_material(ma);
+	if (ma) {
+		ma = copy_material(ma);
 	}
 	else {
-		ma= add_material("Material");
+		ma = add_material("Material");
 
-		if(scene_use_new_shading_nodes(scene)) {
+		if (scene_use_new_shading_nodes(scene)) {
 			ED_node_shader_default(scene, &ma->id);
-			ma->use_nodes= 1;
+			ma->use_nodes = 1;
 		}
 	}
 
 	/* hook into UI */
 	uiIDContextProperty(C, &ptr, &prop);
 
-	if(prop) {
+	if (prop) {
 		/* when creating new ID blocks, use is already 1, but RNA
 		 * pointer se also increases user, so this compensates it */
 		ma->id.us--;
@@ -395,7 +395,7 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
 		RNA_property_update(C, &ptr, prop);
 	}
 
-	WM_event_add_notifier(C, NC_MATERIAL|NA_ADDED, ma);
+	WM_event_add_notifier(C, NC_MATERIAL | NA_ADDED, ma);
 	
 	return OPERATOR_FINISHED;
 }
@@ -403,35 +403,35 @@ static int new_material_exec(bContext *C, wmOperator *UNUSED(op))
 void MATERIAL_OT_new(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "New Material";
-	ot->idname= "MATERIAL_OT_new";
-	ot->description="Add a new material";
+	ot->name = "New Material";
+	ot->idname = "MATERIAL_OT_new";
+	ot->description = "Add a new material";
 	
 	/* api callbacks */
-	ot->exec= new_material_exec;
+	ot->exec = new_material_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /********************** new texture operator *********************/
 
 static int new_texture_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
+	Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
 	PointerRNA ptr, idptr;
 	PropertyRNA *prop;
 
 	/* add or copy texture */
-	if(tex)
-		tex= copy_texture(tex);
+	if (tex)
+		tex = copy_texture(tex);
 	else
-		tex= add_texture("Texture");
+		tex = add_texture("Texture");
 
 	/* hook into UI */
 	uiIDContextProperty(C, &ptr, &prop);
 
-	if(prop) {
+	if (prop) {
 		/* when creating new ID blocks, use is already 1, but RNA
 		 * pointer se also increases user, so this compensates it */
 		tex->id.us--;
@@ -441,7 +441,7 @@ static int new_texture_exec(bContext *C, wmOperator *UNUSED(op))
 		RNA_property_update(C, &ptr, prop);
 	}
 
-	WM_event_add_notifier(C, NC_TEXTURE|NA_ADDED, tex);
+	WM_event_add_notifier(C, NC_TEXTURE | NA_ADDED, tex);
 	
 	return OPERATOR_FINISHED;
 }
@@ -449,43 +449,43 @@ static int new_texture_exec(bContext *C, wmOperator *UNUSED(op))
 void TEXTURE_OT_new(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "New Texture";
-	ot->idname= "TEXTURE_OT_new";
-	ot->description="Add a new texture";
+	ot->name = "New Texture";
+	ot->idname = "TEXTURE_OT_new";
+	ot->description = "Add a new texture";
 	
 	/* api callbacks */
-	ot->exec= new_texture_exec;
+	ot->exec = new_texture_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /********************** new world operator *********************/
 
 static int new_world_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
-	World *wo= CTX_data_pointer_get_type(C, "world", &RNA_World).data;
+	Scene *scene = CTX_data_scene(C);
+	World *wo = CTX_data_pointer_get_type(C, "world", &RNA_World).data;
 	PointerRNA ptr, idptr;
 	PropertyRNA *prop;
 
 	/* add or copy world */
-	if(wo) {
-		wo= copy_world(wo);
+	if (wo) {
+		wo = copy_world(wo);
 	}
 	else {
-		wo= add_world("World");
+		wo = add_world("World");
 
-		if(scene_use_new_shading_nodes(scene)) {
+		if (scene_use_new_shading_nodes(scene)) {
 			ED_node_shader_default(scene, &wo->id);
-			wo->use_nodes= 1;
+			wo->use_nodes = 1;
 		}
 	}
 
 	/* hook into UI */
 	uiIDContextProperty(C, &ptr, &prop);
 
-	if(prop) {
+	if (prop) {
 		/* when creating new ID blocks, use is already 1, but RNA
 		 * pointer se also increases user, so this compensates it */
 		wo->id.us--;
@@ -495,7 +495,7 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op))
 		RNA_property_update(C, &ptr, prop);
 	}
 
-	WM_event_add_notifier(C, NC_WORLD|NA_ADDED, wo);
+	WM_event_add_notifier(C, NC_WORLD | NA_ADDED, wo);
 	
 	return OPERATOR_FINISHED;
 }
@@ -503,27 +503,27 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op))
 void WORLD_OT_new(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "New World";
-	ot->idname= "WORLD_OT_new";
-	ot->description= "Add a new world";
+	ot->name = "New World";
+	ot->idname = "WORLD_OT_new";
+	ot->description = "Add a new world";
 	
 	/* api callbacks */
-	ot->exec= new_world_exec;
+	ot->exec = new_world_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /********************** render layer operators *********************/
 
 static int render_layer_add_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 
 	scene_add_render_layer(scene, NULL);
-	scene->r.actlay= BLI_countlist(&scene->r.layers) - 1;
+	scene->r.actlay = BLI_countlist(&scene->r.layers) - 1;
 
-	WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene);
 	
 	return OPERATOR_FINISHED;
 }
@@ -531,15 +531,15 @@ static int render_layer_add_exec(bContext *C, wmOperator *UNUSED(op))
 void SCENE_OT_render_layer_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Render Layer";
-	ot->idname= "SCENE_OT_render_layer_add";
-	ot->description="Add a render layer";
+	ot->name = "Add Render Layer";
+	ot->idname = "SCENE_OT_render_layer_add";
+	ot->description = "Add a render layer";
 	
 	/* api callbacks */
-	ot->exec= render_layer_add_exec;
+	ot->exec = render_layer_add_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 static int render_layer_remove_exec(bContext *C, wmOperator *UNUSED(op))
@@ -547,10 +547,10 @@ static int render_layer_remove_exec(bContext *C, wmOperator *UNUSED(op))
 	Scene *scene = CTX_data_scene(C);
 	SceneRenderLayer *rl = BLI_findlink(&scene->r.layers, scene->r.actlay);
 
-	if(!scene_remove_render_layer(CTX_data_main(C), scene, rl))
+	if (!scene_remove_render_layer(CTX_data_main(C), scene, rl))
 		return OPERATOR_CANCELLED;
 
-	WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene);
 	
 	return OPERATOR_FINISHED;
 }
@@ -558,71 +558,71 @@ static int render_layer_remove_exec(bContext *C, wmOperator *UNUSED(op))
 void SCENE_OT_render_layer_remove(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove Render Layer";
-	ot->idname= "SCENE_OT_render_layer_remove";
-	ot->description="Remove the selected render layer";
+	ot->name = "Remove Render Layer";
+	ot->idname = "SCENE_OT_render_layer_remove";
+	ot->description = "Remove the selected render layer";
 	
 	/* api callbacks */
-	ot->exec= render_layer_remove_exec;
+	ot->exec = render_layer_remove_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 static int texture_slot_move(bContext *C, wmOperator *op)
 {
-	ID *id= CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data;
+	ID *id = CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data;
 
-	if(id) {
+	if (id) {
 		MTex **mtex_ar, *mtexswap;
 		short act;
-		int type= RNA_enum_get(op->ptr, "type");
-		struct AnimData *adt= BKE_animdata_from_id(id);
+		int type = RNA_enum_get(op->ptr, "type");
+		struct AnimData *adt = BKE_animdata_from_id(id);
 
 		give_active_mtex(id, &mtex_ar, &act);
 
-		if(type == -1) { /* Up */
-			if(act > 0) {
+		if (type == -1) { /* Up */
+			if (act > 0) {
 				mtexswap = mtex_ar[act];
-				mtex_ar[act] = mtex_ar[act-1];
-				mtex_ar[act-1] = mtexswap;
+				mtex_ar[act] = mtex_ar[act - 1];
+				mtex_ar[act - 1] = mtexswap;
 				
-				BKE_animdata_fix_paths_rename(id, adt, "texture_slots", NULL, NULL, act-1, -1, 0);
-				BKE_animdata_fix_paths_rename(id, adt, "texture_slots", NULL, NULL, act, act-1, 0);
-				BKE_animdata_fix_paths_rename(id, adt, "texture_slots", NULL, NULL, -1, act, 0);
-
-				if(GS(id->name)==ID_MA) {
-					Material *ma= (Material *)id;
-					int mtexuse = ma->septex & (1<<act);
-					ma->septex &= ~(1<<act);
-					ma->septex |= (ma->septex & (1<<(act-1))) << 1;
-					ma->septex &= ~(1<<(act-1));
+				BKE_animdata_fix_paths_rename(id, adt, NULL, "texture_slots", NULL, NULL, act - 1, -1, 0);
+				BKE_animdata_fix_paths_rename(id, adt, NULL, "texture_slots", NULL, NULL, act, act - 1, 0);
+				BKE_animdata_fix_paths_rename(id, adt, NULL, "texture_slots", NULL, NULL, -1, act, 0);
+
+				if (GS(id->name) == ID_MA) {
+					Material *ma = (Material *)id;
+					int mtexuse = ma->septex & (1 << act);
+					ma->septex &= ~(1 << act);
+					ma->septex |= (ma->septex & (1 << (act - 1))) << 1;
+					ma->septex &= ~(1 << (act - 1));
 					ma->septex |= mtexuse >> 1;
 				}
 				
-				set_active_mtex(id, act-1);
+				set_active_mtex(id, act - 1);
 			}
 		}
 		else { /* Down */
-			if(act < MAX_MTEX-1) {
+			if (act < MAX_MTEX - 1) {
 				mtexswap = mtex_ar[act];
-				mtex_ar[act] = mtex_ar[act+1];
-				mtex_ar[act+1] = mtexswap;
+				mtex_ar[act] = mtex_ar[act + 1];
+				mtex_ar[act + 1] = mtexswap;
 				
-				BKE_animdata_fix_paths_rename(id, adt, "texture_slots", NULL, NULL, act+1, -1, 0);
-				BKE_animdata_fix_paths_rename(id, adt, "texture_slots", NULL, NULL, act, act+1, 0);
-				BKE_animdata_fix_paths_rename(id, adt, "texture_slots", NULL, NULL, -1, act, 0);
-
-				if(GS(id->name)==ID_MA) {
-					Material *ma= (Material *)id;
-					int mtexuse = ma->septex & (1<<act);
-					ma->septex &= ~(1<<act);
-					ma->septex |= (ma->septex & (1<<(act+1))) >> 1;
-					ma->septex &= ~(1<<(act+1));
+				BKE_animdata_fix_paths_rename(id, adt, NULL, "texture_slots", NULL, NULL, act + 1, -1, 0);
+				BKE_animdata_fix_paths_rename(id, adt, NULL, "texture_slots", NULL, NULL, act, act + 1, 0);
+				BKE_animdata_fix_paths_rename(id, adt, NULL, "texture_slots", NULL, NULL, -1, act, 0);
+
+				if (GS(id->name) == ID_MA) {
+					Material *ma = (Material *)id;
+					int mtexuse = ma->septex & (1 << act);
+					ma->septex &= ~(1 << act);
+					ma->septex |= (ma->septex & (1 << (act + 1))) >> 1;
+					ma->septex &= ~(1 << (act + 1));
 					ma->septex |= mtexuse << 1;
 				}
 				
-				set_active_mtex(id, act+1);
+				set_active_mtex(id, act + 1);
 			}
 		}
 
@@ -642,15 +642,15 @@ void TEXTURE_OT_slot_move(wmOperatorType *ot)
 	};
 
 	/* identifiers */
-	ot->name= "Move Texture Slot";
-	ot->idname= "TEXTURE_OT_slot_move";
-	ot->description="Move texture slots up and down";
+	ot->name = "Move Texture Slot";
+	ot->idname = "TEXTURE_OT_slot_move";
+	ot->description = "Move texture slots up and down";
 
 	/* api callbacks */
-	ot->exec= texture_slot_move;
+	ot->exec = texture_slot_move;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	RNA_def_enum(ot->srna, "type", slot_move, 0, "Type", "");
 }
@@ -662,8 +662,8 @@ void TEXTURE_OT_slot_move(wmOperatorType *ot)
 static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *path, const char imtype)
 {
 	float layout[12];
-	if ( RNA_struct_find_property(op->ptr, "layout") )
-		RNA_float_get_array(op->ptr, "layout",layout);
+	if (RNA_struct_find_property(op->ptr, "layout") )
+		RNA_float_get_array(op->ptr, "layout", layout);
 	else
 		memcpy(layout, default_envmap_layout, sizeof(layout));
 
@@ -678,7 +678,7 @@ static int save_envmap(wmOperator *op, Scene *scene, EnvMap *env, char *path, co
 
 static int envmap_save_exec(bContext *C, wmOperator *op)
 {
-	Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
+	Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
 	Scene *scene = CTX_data_scene(C);
 	//int imtype = RNA_enum_get(op->ptr, "file_type");
 	char imtype = scene->r.im_format.imtype;
@@ -686,7 +686,7 @@ static int envmap_save_exec(bContext *C, wmOperator *op)
 	
 	RNA_string_get(op->ptr, "filepath", path);
 	
-	if(scene->r.scemode & R_EXTENSION)  {
+	if (scene->r.scemode & R_EXTENSION) {
 		BKE_add_image_extension(path, imtype);
 	}
 	
@@ -705,7 +705,7 @@ static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event
 {
 	//Scene *scene= CTX_data_scene(C);
 	
-	if(RNA_struct_property_is_set(op->ptr, "filepath"))
+	if (RNA_struct_property_is_set(op->ptr, "filepath"))
 		return envmap_save_exec(C, op);
 
 	//RNA_enum_set(op->ptr, "file_type", scene->r.im_format.imtype);
@@ -717,13 +717,13 @@ static int envmap_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event
 
 static int envmap_save_poll(bContext *C)
 {
-	Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
+	Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
 
 	if (!tex) 
 		return 0;
 	if (!tex->env || !tex->env->ok)
 		return 0;
-	if (tex->env->cube[1]==NULL)
+	if (tex->env->cube[1] == NULL)
 		return 0;
 	
 	return 1;
@@ -733,45 +733,45 @@ void TEXTURE_OT_envmap_save(wmOperatorType *ot)
 {
 	PropertyRNA *prop;
 	/* identifiers */
-	ot->name= "Save Environment Map";
-	ot->idname= "TEXTURE_OT_envmap_save";
-	ot->description="Save the current generated Environment map to an image file";
+	ot->name = "Save Environment Map";
+	ot->idname = "TEXTURE_OT_envmap_save";
+	ot->description = "Save the current generated Environment map to an image file";
 	
 	/* api callbacks */
-	ot->exec= envmap_save_exec;
-	ot->invoke= envmap_save_invoke;
-	ot->poll= envmap_save_poll;
+	ot->exec = envmap_save_exec;
+	ot->invoke = envmap_save_invoke;
+	ot->poll = envmap_save_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER; /* no undo since this doesnt modify the env-map */
+	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, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
+	WM_operator_properties_filesel(ot, FOLDERFILE | IMAGEFILE | MOVIEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
 }
 
 static int envmap_clear_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
+	Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
 	
 	BKE_free_envmapdata(tex->env);
 	
-	WM_event_add_notifier(C, NC_TEXTURE|NA_EDITED, tex);
+	WM_event_add_notifier(C, NC_TEXTURE | NA_EDITED, tex);
 	
 	return OPERATOR_FINISHED;
 }
 
 static int envmap_clear_poll(bContext *C)
 {
-	Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
+	Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
 	
 	if (!tex) 
 		return 0;
 	if (!tex->env || !tex->env->ok)
 		return 0;
-	if (tex->env->cube[1]==NULL)
+	if (tex->env->cube[1] == NULL)
 		return 0;
 	
 	return 1;
@@ -780,16 +780,16 @@ static int envmap_clear_poll(bContext *C)
 void TEXTURE_OT_envmap_clear(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear Environment Map";
-	ot->idname= "TEXTURE_OT_envmap_clear";
-	ot->description="Discard the environment map and free it from memory";
+	ot->name = "Clear Environment Map";
+	ot->idname = "TEXTURE_OT_envmap_clear";
+	ot->description = "Discard the environment map and free it from memory";
 	
 	/* api callbacks */
-	ot->exec= envmap_clear_exec;
-	ot->poll= envmap_clear_poll;
+	ot->exec = envmap_clear_exec;
+	ot->poll = envmap_clear_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 static int envmap_clear_all_exec(bContext *C, wmOperator *UNUSED(op))
@@ -797,11 +797,11 @@ static int envmap_clear_all_exec(bContext *C, wmOperator *UNUSED(op))
 	Main *bmain = CTX_data_main(C);
 	Tex *tex;
 	
-	for (tex=bmain->tex.first; tex; tex=tex->id.next)
+	for (tex = bmain->tex.first; tex; tex = tex->id.next)
 		if (tex->env)
 			BKE_free_envmapdata(tex->env);
 	
-	WM_event_add_notifier(C, NC_TEXTURE|NA_EDITED, tex);
+	WM_event_add_notifier(C, NC_TEXTURE | NA_EDITED, tex);
 	
 	return OPERATOR_FINISHED;
 }
@@ -809,16 +809,16 @@ static int envmap_clear_all_exec(bContext *C, wmOperator *UNUSED(op))
 void TEXTURE_OT_envmap_clear_all(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear All Environment Maps";
-	ot->idname= "TEXTURE_OT_envmap_clear_all";
-	ot->description="Discard all environment maps in the .blend file and free them from memory";
+	ot->name = "Clear All Environment Maps";
+	ot->idname = "TEXTURE_OT_envmap_clear_all";
+	ot->description = "Discard all environment maps in the .blend file and free them from memory";
 	
 	/* api callbacks */
-	ot->exec= envmap_clear_all_exec;
-	ot->poll= envmap_clear_poll;
+	ot->exec = envmap_clear_all_exec;
+	ot->poll = envmap_clear_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /********************** material operators *********************/
@@ -826,9 +826,9 @@ void TEXTURE_OT_envmap_clear_all(wmOperatorType *ot)
 /* material copy/paste */
 static int copy_material_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
+	Material *ma = CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
 
-	if(ma==NULL)
+	if (ma == NULL)
 		return OPERATOR_CANCELLED;
 
 	copy_matcopybuf(ma);
@@ -839,27 +839,27 @@ static int copy_material_exec(bContext *C, wmOperator *UNUSED(op))
 void MATERIAL_OT_copy(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Copy Material";
-	ot->idname= "MATERIAL_OT_copy";
-	ot->description="Copy the material settings and nodes";
+	ot->name = "Copy Material";
+	ot->idname = "MATERIAL_OT_copy";
+	ot->description = "Copy the material settings and nodes";
 
 	/* api callbacks */
-	ot->exec= copy_material_exec;
+	ot->exec = copy_material_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER; /* no undo needed since no changes are made to the material */
+	ot->flag = OPTYPE_REGISTER; /* no undo needed since no changes are made to the material */
 }
 
 static int paste_material_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
+	Material *ma = CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
 
-	if(ma==NULL)
+	if (ma == NULL)
 		return OPERATOR_CANCELLED;
 
 	paste_matcopybuf(ma);
 
-	WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING_DRAW, ma);
+	WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_DRAW, ma);
 
 	return OPERATOR_FINISHED;
 }
@@ -867,88 +867,88 @@ static int paste_material_exec(bContext *C, wmOperator *UNUSED(op))
 void MATERIAL_OT_paste(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Paste Material";
-	ot->idname= "MATERIAL_OT_paste";
-	ot->description="Paste the material settings and nodes";
+	ot->name = "Paste Material";
+	ot->idname = "MATERIAL_OT_paste";
+	ot->description = "Paste the material settings and nodes";
 
 	/* api callbacks */
-	ot->exec= paste_material_exec;
+	ot->exec = paste_material_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 
-static short mtexcopied=0; /* must be reset on file load */
+static short mtexcopied = 0; /* must be reset on file load */
 static MTex mtexcopybuf;
 
 void ED_render_clear_mtex_copybuf(void)
-{	/* use for file reload */
-	mtexcopied= 0;
+{   /* use for file reload */
+	mtexcopied = 0;
 }
 
 static void copy_mtex_copybuf(ID *id)
 {
-	MTex **mtex= NULL;
+	MTex **mtex = NULL;
 	
-	switch(GS(id->name)) {
+	switch (GS(id->name)) {
 		case ID_MA:
-			mtex= &(((Material *)id)->mtex[(int)((Material *)id)->texact]);
+			mtex = &(((Material *)id)->mtex[(int)((Material *)id)->texact]);
 			break;
 		case ID_LA:
-			mtex= &(((Lamp *)id)->mtex[(int)((Lamp *)id)->texact]);
+			mtex = &(((Lamp *)id)->mtex[(int)((Lamp *)id)->texact]);
 			// la->mtex[(int)la->texact] // TODO
 			break;
 		case ID_WO:
-			mtex= &(((World *)id)->mtex[(int)((World *)id)->texact]);
+			mtex = &(((World *)id)->mtex[(int)((World *)id)->texact]);
 			// mtex= wrld->mtex[(int)wrld->texact]; // TODO
 			break;
 		case ID_PA:
-			mtex= &(((ParticleSettings *)id)->mtex[(int)((ParticleSettings *)id)->texact]);
+			mtex = &(((ParticleSettings *)id)->mtex[(int)((ParticleSettings *)id)->texact]);
 			break;
 	}
 	
-	if(mtex && *mtex) {
+	if (mtex && *mtex) {
 		memcpy(&mtexcopybuf, *mtex, sizeof(MTex));
-		mtexcopied= 1;
+		mtexcopied = 1;
 	}
 	else {
-		mtexcopied= 0;
+		mtexcopied = 0;
 	}
 }
 
 static void paste_mtex_copybuf(ID *id)
 {
-	MTex **mtex= NULL;
+	MTex **mtex = NULL;
 	
-	if(mtexcopied == 0 || mtexcopybuf.tex==NULL)
+	if (mtexcopied == 0 || mtexcopybuf.tex == NULL)
 		return;
 	
-	switch(GS(id->name)) {
+	switch (GS(id->name)) {
 		case ID_MA:
-			mtex= &(((Material *)id)->mtex[(int)((Material *)id)->texact]);
+			mtex = &(((Material *)id)->mtex[(int)((Material *)id)->texact]);
 			break;
 		case ID_LA:
-			mtex= &(((Lamp *)id)->mtex[(int)((Lamp *)id)->texact]);
+			mtex = &(((Lamp *)id)->mtex[(int)((Lamp *)id)->texact]);
 			// la->mtex[(int)la->texact] // TODO
 			break;
 		case ID_WO:
-			mtex= &(((World *)id)->mtex[(int)((World *)id)->texact]);
+			mtex = &(((World *)id)->mtex[(int)((World *)id)->texact]);
 			// mtex= wrld->mtex[(int)wrld->texact]; // TODO
 			break;
 		case ID_PA:
-			mtex= &(((ParticleSettings *)id)->mtex[(int)((ParticleSettings *)id)->texact]);
+			mtex = &(((ParticleSettings *)id)->mtex[(int)((ParticleSettings *)id)->texact]);
 			break;
 		default:
 			BLI_assert("invalid id type");
 			return;
 	}
 	
-	if(mtex) {
-		if(*mtex==NULL) {
-			*mtex= MEM_mallocN(sizeof(MTex), "mtex copy");
+	if (mtex) {
+		if (*mtex == NULL) {
+			*mtex = MEM_mallocN(sizeof(MTex), "mtex copy");
 		}
-		else if((*mtex)->tex) {
+		else if ((*mtex)->tex) {
 			(*mtex)->tex->id.us--;
 		}
 		
@@ -961,9 +961,9 @@ static void paste_mtex_copybuf(ID *id)
 
 static int copy_mtex_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	ID *id= CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data;
+	ID *id = CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data;
 
-	if(id==NULL) {
+	if (id == NULL) {
 		/* copying empty slot */
 		ED_render_clear_mtex_copybuf();
 		return OPERATOR_CANCELLED;
@@ -976,7 +976,7 @@ static int copy_mtex_exec(bContext *C, wmOperator *UNUSED(op))
 
 static int copy_mtex_poll(bContext *C)
 {
-	ID *id= CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data;
+	ID *id = CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data;
 	
 	return (id != NULL);
 }
@@ -984,27 +984,27 @@ static int copy_mtex_poll(bContext *C)
 void TEXTURE_OT_slot_copy(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Copy Texture Slot Settings";
-	ot->idname= "TEXTURE_OT_slot_copy";
-	ot->description="Copy the material texture settings and nodes";
+	ot->name = "Copy Texture Slot Settings";
+	ot->idname = "TEXTURE_OT_slot_copy";
+	ot->description = "Copy the material texture settings and nodes";
 
 	/* api callbacks */
-	ot->exec= copy_mtex_exec;
-	ot->poll= copy_mtex_poll;
+	ot->exec = copy_mtex_exec;
+	ot->poll = copy_mtex_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER; /* no undo needed since no changes are made to the mtex */
+	ot->flag = OPTYPE_REGISTER; /* no undo needed since no changes are made to the mtex */
 }
 
 static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	ID *id= CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data;
+	ID *id = CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data;
 
-	if(id==NULL) {
-		Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
-		Lamp *la= CTX_data_pointer_get_type(C, "lamp", &RNA_Lamp).data;
-		World *wo= CTX_data_pointer_get_type(C, "world", &RNA_World).data;
-		ParticleSystem *psys= CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem).data;
+	if (id == NULL) {
+		Material *ma = CTX_data_pointer_get_type(C, "material", &RNA_Material).data;
+		Lamp *la = CTX_data_pointer_get_type(C, "lamp", &RNA_Lamp).data;
+		World *wo = CTX_data_pointer_get_type(C, "world", &RNA_World).data;
+		ParticleSystem *psys = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem).data;
 		
 		if (ma)
 			id = &ma->id;
@@ -1015,13 +1015,13 @@ static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op))
 		else if (psys)
 			id = &psys->part->id;
 		
-		if (id==NULL)
+		if (id == NULL)
 			return OPERATOR_CANCELLED;
 	}
 
 	paste_mtex_copybuf(id);
 
-	WM_event_add_notifier(C, NC_TEXTURE|ND_SHADING_DRAW, NULL);
+	WM_event_add_notifier(C, NC_TEXTURE | ND_SHADING_DRAW, NULL);
 
 	return OPERATOR_FINISHED;
 }
@@ -1029,14 +1029,14 @@ static int paste_mtex_exec(bContext *C, wmOperator *UNUSED(op))
 void TEXTURE_OT_slot_paste(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Paste Texture Slot Settings";
-	ot->idname= "TEXTURE_OT_slot_paste";
-	ot->description="Copy the texture settings and nodes";
+	ot->name = "Paste Texture Slot Settings";
+	ot->idname = "TEXTURE_OT_slot_paste";
+	ot->description = "Copy the texture settings and nodes";
 
 	/* api callbacks */
-	ot->exec= paste_mtex_exec;
+	ot->exec = paste_mtex_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c
index d921308..48c3587 100644
--- a/source/blender/editors/render/render_update.c
+++ b/source/blender/editors/render/render_update.c
@@ -62,7 +62,7 @@
 #include "ED_node.h"
 #include "ED_render.h"
 
-#include "render_intern.h"	// own include
+#include "render_intern.h"  // own include
 
 /***************************** Render Engines ********************************/
 
@@ -76,32 +76,32 @@ void ED_render_scene_update(Main *bmain, Scene *scene, int updated)
 	ARegion *ar;
 
 	/* 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())
+	 * other threads doing e.g. rendering or baking jobs */
+	if (!BLI_thread_is_main())
 		return;
 
-	C= CTX_create();
+	C = CTX_create();
 	CTX_data_main_set(C, bmain);
 	CTX_data_scene_set(C, scene);
 
 	CTX_wm_manager_set(C, bmain->wm.first);
 
-	for(sc=bmain->screen.first; sc; sc=sc->id.next) {
-		for(sa=sc->areabase.first; sa; sa=sa->next) {
-			if(sa->spacetype != SPACE_VIEW3D)
+	for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+		for (sa = sc->areabase.first; sa; sa = sa->next) {
+			if (sa->spacetype != SPACE_VIEW3D)
 				continue;
 
-			for(ar=sa->regionbase.first; ar; ar=ar->next) {
+			for (ar = sa->regionbase.first; ar; ar = ar->next) {
 				RegionView3D *rv3d;
 				RenderEngine *engine;
 
-				if(ar->regiontype != RGN_TYPE_WINDOW)
+				if (ar->regiontype != RGN_TYPE_WINDOW)
 					continue;
 
-				rv3d= ar->regiondata;
-				engine= rv3d->render_engine;
+				rv3d = ar->regiondata;
+				engine = rv3d->render_engine;
 
-				if(engine && (updated || (engine->flag & RE_ENGINE_DO_UPDATE))) {
+				if (engine && (updated || (engine->flag & RE_ENGINE_DO_UPDATE))) {
 					CTX_wm_screen_set(C, sc);
 					CTX_wm_area_set(C, sa);
 					CTX_wm_region_set(C, ar);
@@ -116,37 +116,42 @@ void ED_render_scene_update(Main *bmain, Scene *scene, int updated)
 	CTX_free(C);
 }
 
-void ED_render_engine_changed(Main *bmain)
+void ED_render_engine_area_exit(ScrArea *sa)
 {
-	/* on changing the render engine type, clear all running render engines */
-	bScreen *sc;
-	ScrArea *sa;
+	/* clear all render engines in this area */
 	ARegion *ar;
 
-	for(sc=bmain->screen.first; sc; sc=sc->id.next) {
-		for(sa=sc->areabase.first; sa; sa=sa->next) {
-			if(sa->spacetype != SPACE_VIEW3D)
-				continue;
+	if (sa->spacetype != SPACE_VIEW3D)
+		return;
 
-			for(ar=sa->regionbase.first; ar; ar=ar->next) {
-				RegionView3D *rv3d;
+	for (ar = sa->regionbase.first; ar; ar = ar->next) {
+		RegionView3D *rv3d;
 
-				if(ar->regiontype != RGN_TYPE_WINDOW)
-					continue;
-				
-				rv3d= ar->regiondata;
+		if (ar->regiontype != RGN_TYPE_WINDOW)
+			continue;
+		
+		rv3d = ar->regiondata;
 
-				if(rv3d->render_engine) {
-					RE_engine_free(rv3d->render_engine);
-					rv3d->render_engine= NULL;
-				}
-			}
+		if (rv3d->render_engine) {
+			RE_engine_free(rv3d->render_engine);
+			rv3d->render_engine = NULL;
 		}
 	}
 }
 
+void ED_render_engine_changed(Main *bmain)
+{
+	/* on changing the render engine type, clear all running render engines */
+	bScreen *sc;
+	ScrArea *sa;
+
+	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);
+}
+
 /***************************** Updates ***********************************
- * ED_render_id_flush_update gets called from DAG_id_tag_update, to do *
+ * ED_render_id_flush_update gets called from DAG_id_tag_update, to do   *
  * editor level updates when the ID changes. when these ID blocks are in *
  * the dependency graph, we can get rid of the manual dependency checks  */
 
@@ -154,11 +159,11 @@ static int mtex_use_tex(MTex **mtex, int tot, Tex *tex)
 {
 	int a;
 
-	if(!mtex)
+	if (!mtex)
 		return 0;
 
-	for(a=0; a<tot; a++)
-		if(mtex[a] && mtex[a]->tex == tex)
+	for (a = 0; a < tot; a++)
+		if (mtex[a] && mtex[a]->tex == tex)
 			return 1;
 	
 	return 0;
@@ -168,17 +173,17 @@ static int nodes_use_tex(bNodeTree *ntree, Tex *tex)
 {
 	bNode *node;
 
-	for(node=ntree->nodes.first; node; node= node->next) {
-		if(node->id) {
-			if(node->id == (ID*)tex) {
+	for (node = ntree->nodes.first; node; node = node->next) {
+		if (node->id) {
+			if (node->id == (ID *)tex) {
 				return 1;
 			}
-			else if(GS(node->id->name) == ID_MA) {
-				if(mtex_use_tex(((Material*)node->id)->mtex, MAX_MTEX, tex))
+			else if (GS(node->id->name) == ID_MA) {
+				if (mtex_use_tex(((Material *)node->id)->mtex, MAX_MTEX, tex))
 					return 1;
 			}
-			else if(node->type==NODE_GROUP) {
-				if(nodes_use_tex((bNodeTree *)node->id, tex))
+			else if (node->type == NODE_GROUP) {
+				if (nodes_use_tex((bNodeTree *)node->id, tex))
 					return 1;
 			}
 		}
@@ -191,13 +196,13 @@ static int nodes_use_material(bNodeTree *ntree, Material *ma)
 {
 	bNode *node;
 
-	for(node=ntree->nodes.first; node; node= node->next) {
-		if(node->id) {
-			if(node->id == (ID*)ma) {
+	for (node = ntree->nodes.first; node; node = node->next) {
+		if (node->id) {
+			if (node->id == (ID *)ma) {
 				return 1;
 			}
-			else if(node->type==NODE_GROUP) {
-				if(nodes_use_material((bNodeTree *)node->id, ma))
+			else if (node->type == NODE_GROUP) {
+				if (nodes_use_material((bNodeTree *)node->id, ma))
 					return 1;
 			}
 		}
@@ -214,17 +219,17 @@ static void material_changed(Main *bmain, Material *ma)
 	BKE_icon_changed(BKE_icon_getid(&ma->id));
 
 	/* glsl */
-	if(ma->gpumaterial.first)
+	if (ma->gpumaterial.first)
 		GPU_material_free(ma);
 
 	/* find node materials using this */
-	for(parent=bmain->mat.first; parent; parent=parent->id.next) {
-		if(parent->use_nodes && parent->nodetree && nodes_use_material(parent->nodetree, ma));
+	for (parent = bmain->mat.first; parent; parent = parent->id.next) {
+		if (parent->use_nodes && parent->nodetree && nodes_use_material(parent->nodetree, ma)) ;
 		else continue;
 
 		BKE_icon_changed(BKE_icon_getid(&parent->id));
 
-		if(parent->gpumaterial.first)
+		if (parent->gpumaterial.first)
 			GPU_material_free(parent);
 	}
 }
@@ -241,40 +246,40 @@ static void texture_changed(Main *bmain, Tex *tex)
 	BKE_icon_changed(BKE_icon_getid(&tex->id));
 
 	/* find materials */
-	for(ma=bmain->mat.first; ma; ma=ma->id.next) {
-		if(mtex_use_tex(ma->mtex, MAX_MTEX, tex));
-		else if(ma->use_nodes && ma->nodetree && nodes_use_tex(ma->nodetree, tex));
+	for (ma = bmain->mat.first; ma; ma = ma->id.next) {
+		if (mtex_use_tex(ma->mtex, MAX_MTEX, tex)) ;
+		else if (ma->use_nodes && ma->nodetree && nodes_use_tex(ma->nodetree, tex)) ;
 		else continue;
 
 		BKE_icon_changed(BKE_icon_getid(&ma->id));
 
-		if(ma->gpumaterial.first)
+		if (ma->gpumaterial.first)
 			GPU_material_free(ma);
 	}
 
 	/* find lamps */
-	for(la=bmain->lamp.first; la; la=la->id.next) {
-		if(mtex_use_tex(la->mtex, MAX_MTEX, tex));
-		else if(la->nodetree && nodes_use_tex(la->nodetree, tex));
+	for (la = bmain->lamp.first; la; la = la->id.next) {
+		if (mtex_use_tex(la->mtex, MAX_MTEX, tex)) ;
+		else if (la->nodetree && nodes_use_tex(la->nodetree, tex)) ;
 		else continue;
 
 		BKE_icon_changed(BKE_icon_getid(&la->id));
 	}
 
 	/* find worlds */
-	for(wo=bmain->world.first; wo; wo=wo->id.next) {
-		if(mtex_use_tex(wo->mtex, MAX_MTEX, tex));
-		else if(wo->nodetree && nodes_use_tex(wo->nodetree, tex));
+	for (wo = bmain->world.first; wo; wo = wo->id.next) {
+		if (mtex_use_tex(wo->mtex, MAX_MTEX, tex)) ;
+		else if (wo->nodetree && nodes_use_tex(wo->nodetree, tex)) ;
 		else continue;
 
 		BKE_icon_changed(BKE_icon_getid(&wo->id));
 	}
 
 	/* find compositing nodes */
-	for(scene=bmain->scene.first; scene; scene=scene->id.next) {
-		if(scene->use_nodes && scene->nodetree) {
-			for(node=scene->nodetree->nodes.first; node; node=node->next) {
-				if(node->id == &tex->id)
+	for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+		if (scene->use_nodes && scene->nodetree) {
+			for (node = scene->nodetree->nodes.first; node; node = node->next) {
+				if (node->id == &tex->id)
 					ED_node_changed_update(&scene->id, node);
 			}
 		}
@@ -290,12 +295,12 @@ static void lamp_changed(Main *bmain, Lamp *la)
 	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)
+	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)
+	for (ma = bmain->mat.first; ma; ma = ma->id.next)
+		if (ma->gpumaterial.first)
 			GPU_material_free(ma);
 }
 
@@ -307,8 +312,8 @@ static void world_changed(Main *bmain, World *wo)
 	BKE_icon_changed(BKE_icon_getid(&wo->id));
 
 	/* glsl */
-	for(ma=bmain->mat.first; ma; ma=ma->id.next)
-		if(ma->gpumaterial.first)
+	for (ma = bmain->mat.first; ma; ma = ma->id.next)
+		if (ma->gpumaterial.first)
 			GPU_material_free(ma);
 }
 
@@ -320,8 +325,8 @@ static void image_changed(Main *bmain, Image *ima)
 	BKE_icon_changed(BKE_icon_getid(&ima->id));
 
 	/* textures */
-	for(tex=bmain->tex.first; tex; tex=tex->id.next)
-		if(tex->ima == ima)
+	for (tex = bmain->tex.first; tex; tex = tex->id.next)
+		if (tex->ima == ima)
 			texture_changed(bmain, tex);
 }
 
@@ -331,35 +336,35 @@ static void scene_changed(Main *bmain, Scene *UNUSED(scene))
 	Material *ma;
 
 	/* glsl */
-	for(ob=bmain->object.first; ob; ob=ob->id.next)
-		if(ob->gpulamp.first)
+	for (ob = bmain->object.first; ob; ob = ob->id.next)
+		if (ob->gpulamp.first)
 			GPU_lamp_free(ob);
 
-	for(ma=bmain->mat.first; ma; ma=ma->id.next)
-		if(ma->gpumaterial.first)
+	for (ma = bmain->mat.first; ma; ma = ma->id.next)
+		if (ma->gpumaterial.first)
 			GPU_material_free(ma);
 }
 
 void ED_render_id_flush_update(Main *bmain, ID *id)
 {
-	switch(GS(id->name)) {
+	switch (GS(id->name)) {
 		case ID_MA:
-			material_changed(bmain, (Material*)id);
+			material_changed(bmain, (Material *)id);
 			break;
 		case ID_TE:
-			texture_changed(bmain, (Tex*)id);
+			texture_changed(bmain, (Tex *)id);
 			break;
 		case ID_WO:
-			world_changed(bmain, (World*)id);
+			world_changed(bmain, (World *)id);
 			break;
 		case ID_LA:
-			lamp_changed(bmain, (Lamp*)id);
+			lamp_changed(bmain, (Lamp *)id);
 			break;
 		case ID_IM:
-			image_changed(bmain, (Image*)id);
+			image_changed(bmain, (Image *)id);
 			break;
 		case ID_SCE:
-			scene_changed(bmain, (Scene*)id);
+			scene_changed(bmain, (Scene *)id);
 			break;
 		default:
 			break;
diff --git a/source/blender/editors/render/render_view.c b/source/blender/editors/render/render_view.c
index d8719c7..0d90272 100644
--- a/source/blender/editors/render/render_view.c
+++ b/source/blender/editors/render/render_view.c
@@ -61,24 +61,24 @@
 /* would use BKE_screen_find_big_area(...) but this is too specific            */
 static ScrArea *biggest_non_image_area(bContext *C)
 {
-	bScreen *sc= CTX_wm_screen(C);
-	ScrArea *sa, *big= NULL;
-	int size, maxsize= 0, bwmaxsize= 0;
-	short foundwin= 0;
-
-	for(sa= sc->areabase.first; sa; sa= sa->next) {
-		if(sa->winx > 30 && sa->winy > 30) {
-			size= sa->winx*sa->winy;
-			if(sa->spacetype == SPACE_BUTS) {
-				if(foundwin == 0 && size > bwmaxsize) {
-					bwmaxsize= size;
-					big= sa;
+	bScreen *sc = CTX_wm_screen(C);
+	ScrArea *sa, *big = NULL;
+	int size, maxsize = 0, bwmaxsize = 0;
+	short foundwin = 0;
+
+	for (sa = sc->areabase.first; sa; sa = sa->next) {
+		if (sa->winx > 30 && sa->winy > 30) {
+			size = sa->winx * sa->winy;
+			if (sa->spacetype == SPACE_BUTS) {
+				if (foundwin == 0 && size > bwmaxsize) {
+					bwmaxsize = size;
+					big = sa;
 				}
 			}
-			else if(sa->spacetype != SPACE_IMAGE && size > maxsize) {
-				maxsize= size;
-				big= sa;
-				foundwin= 1;
+			else if (sa->spacetype != SPACE_IMAGE && size > maxsize) {
+				maxsize = size;
+				big = sa;
+				foundwin = 1;
 			}
 		}
 	}
@@ -88,20 +88,20 @@ static ScrArea *biggest_non_image_area(bContext *C)
 
 static ScrArea *find_area_showing_r_result(bContext *C, wmWindow **win)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 	ScrArea *sa = NULL;
 	SpaceImage *sima;
 
 	/* find an imagewindow showing render result */
-	for(*win=wm->windows.first; *win; *win= (*win)->next) {
-		for(sa= (*win)->screen->areabase.first; sa; sa= sa->next) {
-			if(sa->spacetype==SPACE_IMAGE) {
-				sima= sa->spacedata.first;
-				if(sima->image && sima->image->type==IMA_TYPE_R_RESULT)
+	for (*win = wm->windows.first; *win; *win = (*win)->next) {
+		for (sa = (*win)->screen->areabase.first; sa; sa = sa->next) {
+			if (sa->spacetype == SPACE_IMAGE) {
+				sima = sa->spacedata.first;
+				if (sima->image && sima->image->type == IMA_TYPE_R_RESULT)
 					break;
 			}
 		}
-		if(sa)
+		if (sa)
 			break;
 	}
 	
@@ -110,15 +110,15 @@ static ScrArea *find_area_showing_r_result(bContext *C, wmWindow **win)
 
 static ScrArea *find_area_image_empty(bContext *C)
 {
-	bScreen *sc= CTX_wm_screen(C);
+	bScreen *sc = CTX_wm_screen(C);
 	ScrArea *sa;
 	SpaceImage *sima;
 
 	/* find an imagewindow showing render result */
-	for(sa=sc->areabase.first; sa; sa= sa->next) {
-		if(sa->spacetype==SPACE_IMAGE) {
-			sima= sa->spacedata.first;
-			if(!sima->image)
+	for (sa = sc->areabase.first; sa; sa = sa->next) {
+		if (sa->spacetype == SPACE_IMAGE) {
+			sima = sa->spacedata.first;
+			if (!sima->image)
 				break;
 		}
 	}
@@ -131,70 +131,70 @@ static ScrArea *find_area_image_empty(bContext *C)
 /* new window uses x,y to set position */
 void render_view_open(bContext *C, int mx, int my)
 {
-	wmWindow *win= CTX_wm_window(C);
-	Scene *scene= CTX_data_scene(C);
-	ScrArea *sa= NULL;
+	wmWindow *win = CTX_wm_window(C);
+	Scene *scene = CTX_data_scene(C);
+	ScrArea *sa = NULL;
 	SpaceImage *sima;
-	int area_was_image=0;
+	int area_was_image = 0;
 
-	if(scene->r.displaymode==R_OUTPUT_NONE)
+	if (scene->r.displaymode == R_OUTPUT_NONE)
 		return;
 	
-	if(scene->r.displaymode==R_OUTPUT_WINDOW) {
+	if (scene->r.displaymode == R_OUTPUT_WINDOW) {
 		rcti rect;
 		int sizex, sizey;
 
-		sizex= 10 + (scene->r.xsch*scene->r.size)/100;
-		sizey= 40 + (scene->r.ysch*scene->r.size)/100;
+		sizex = 10 + (scene->r.xsch * scene->r.size) / 100;
+		sizey = 40 + (scene->r.ysch * scene->r.size) / 100;
 
 		/* arbitrary... miniature image window views don't make much sense */
-		if(sizex < 320) sizex= 320;
-		if(sizey < 256) sizey= 256;
+		if (sizex < 320) sizex = 320;
+		if (sizey < 256) sizey = 256;
 
 		/* XXX some magic to calculate postition */
-		rect.xmin= mx + win->posx - sizex/2;
-		rect.ymin= my + win->posy - sizey/2;
-		rect.xmax= rect.xmin + sizex;
-		rect.ymax= rect.ymin + sizey;
+		rect.xmin = mx + win->posx - sizex / 2;
+		rect.ymin = my + win->posy - sizey / 2;
+		rect.xmax = rect.xmin + sizex;
+		rect.ymax = rect.ymin + sizey;
 
 		/* changes context! */
 		WM_window_open_temp(C, &rect, WM_WINDOW_RENDER);
 
-		sa= CTX_wm_area(C);
+		sa = CTX_wm_area(C);
 	}
-	else if(scene->r.displaymode==R_OUTPUT_SCREEN) {
+	else if (scene->r.displaymode == R_OUTPUT_SCREEN) {
 		if (CTX_wm_area(C) && CTX_wm_area(C)->spacetype == SPACE_IMAGE)
 			area_was_image = 1;
 
 		/* this function returns with changed context */
-		sa= ED_screen_full_newspace(C, CTX_wm_area(C), SPACE_IMAGE);
+		sa = ED_screen_full_newspace(C, CTX_wm_area(C), SPACE_IMAGE);
 	}
 
-	if(!sa) {
-		sa= find_area_showing_r_result(C, &win); 
-		if(sa==NULL)
-			sa= find_area_image_empty(C);
+	if (!sa) {
+		sa = find_area_showing_r_result(C, &win);
+		if (sa == NULL)
+			sa = find_area_image_empty(C);
 		
 		/* if area found in other window, we make that one show in front */
-		if(win && win!=CTX_wm_window(C))
+		if (win && win != CTX_wm_window(C))
 			wm_window_raise(win);
 
-		if(sa==NULL) {
+		if (sa == NULL) {
 			/* find largest open non-image area */
-			sa= biggest_non_image_area(C);
-			if(sa) {
+			sa = biggest_non_image_area(C);
+			if (sa) {
 				ED_area_newspace(C, sa, SPACE_IMAGE);
-				sima= sa->spacedata.first;
+				sima = sa->spacedata.first;
 
 				/* makes ESC go back to prev space */
 				sima->flag |= SI_PREVSPACE;
 			}
 			else {
 				/* use any area of decent size */
-				sa= BKE_screen_find_big_area(CTX_wm_screen(C), -1, 0);
-				if(sa->spacetype!=SPACE_IMAGE) {
+				sa = BKE_screen_find_big_area(CTX_wm_screen(C), -1, 0);
+				if (sa->spacetype != SPACE_IMAGE) {
 					// XXX newspace(sa, SPACE_IMAGE);
-					sima= sa->spacedata.first;
+					sima = sa->spacedata.first;
 
 					/* makes ESC go back to prev space */
 					sima->flag |= SI_PREVSPACE;
@@ -202,15 +202,15 @@ void render_view_open(bContext *C, int mx, int my)
 			}
 		}
 	}
-	sima= sa->spacedata.first;
+	sima = sa->spacedata.first;
 
 	/* get the correct image, and scale it */
-	sima->image= BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
+	sima->image = BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
 
 
 	/* if we're rendering to full screen, set appropriate hints on image editor
 	 * so it can restore properly on pressing esc */
-	if(sa->full) {
+	if (sa->full) {
 		sima->flag |= SI_FULLWINDOW;
 
 		/* Tell the image editor to revert to previous space in space list on close
@@ -229,20 +229,20 @@ void render_view_open(bContext *C, int mx, int my)
 
 static int render_view_cancel_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	wmWindow *win= CTX_wm_window(C);
-	ScrArea *sa= CTX_wm_area(C);
-	SpaceImage *sima= sa->spacedata.first;
+	wmWindow *win = CTX_wm_window(C);
+	ScrArea *sa = CTX_wm_area(C);
+	SpaceImage *sima = sa->spacedata.first;
 
 	/* test if we have a temp screen in front */
-	if(CTX_wm_window(C)->screen->temp) {
+	if (CTX_wm_window(C)->screen->temp) {
 		wm_window_lower(CTX_wm_window(C));
 		return OPERATOR_FINISHED;
 	}
 	/* determine if render already shows */
-	else if(sima->flag & SI_PREVSPACE) {
+	else if (sima->flag & SI_PREVSPACE) {
 		sima->flag &= ~SI_PREVSPACE;
 
-		if(sima->flag & SI_FULLWINDOW) {
+		if (sima->flag & SI_FULLWINDOW) {
 			sima->flag &= ~SI_FULLWINDOW;
 			ED_screen_full_prevspace(C, sa);
 		}
@@ -251,7 +251,7 @@ static int render_view_cancel_exec(bContext *C, wmOperator *UNUSED(op))
 
 		return OPERATOR_FINISHED;
 	}
-	else if(sima->flag & SI_FULLWINDOW) {
+	else if (sima->flag & SI_FULLWINDOW) {
 		sima->flag &= ~SI_FULLWINDOW;
 		ED_screen_full_toggle(C, win, sa);
 		return OPERATOR_FINISHED;
@@ -263,13 +263,13 @@ static int render_view_cancel_exec(bContext *C, wmOperator *UNUSED(op))
 void RENDER_OT_view_cancel(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Cancel Render View";
-	ot->description= "Cancel show render view";
-	ot->idname= "RENDER_OT_view_cancel";
+	ot->name = "Cancel Render View";
+	ot->description = "Cancel show render view";
+	ot->idname = "RENDER_OT_view_cancel";
 
 	/* api callbacks */
-	ot->exec= render_view_cancel_exec;
-	ot->poll= ED_operator_image_active;
+	ot->exec = render_view_cancel_exec;
+	ot->poll = ED_operator_image_active;
 }
 
 /************************* show render viewer *****************/
@@ -279,38 +279,38 @@ static int render_view_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
 	wmWindow *wincur = CTX_wm_window(C);
 	
 	/* test if we have currently a temp screen active */
-	if(wincur->screen->temp) {
+	if (wincur->screen->temp) {
 		wm_window_lower(wincur);
 	}
 	else { 
 		wmWindow *win, *winshow;
-		ScrArea *sa= find_area_showing_r_result(C, &winshow);
+		ScrArea *sa = find_area_showing_r_result(C, &winshow);
 		
 		/* is there another window showing result? */
-		for(win= CTX_wm_manager(C)->windows.first; win; win= win->next) {
-			if(win->screen->temp || (win==winshow && winshow!=wincur)) {
+		for (win = CTX_wm_manager(C)->windows.first; win; win = win->next) {
+			if (win->screen->temp || (win == winshow && winshow != wincur)) {
 				wm_window_raise(win);
 				return OPERATOR_FINISHED;
 			}
 		}
 		
 		/* determine if render already shows */
-		if(sa) {
+		if (sa) {
 			/* but don't close it when rendering */
-			if(!G.rendering) {
-				SpaceImage *sima= sa->spacedata.first;
+			if (!G.rendering) {
+				SpaceImage *sima = sa->spacedata.first;
 
-				if(sima->flag & SI_PREVSPACE) {
+				if (sima->flag & SI_PREVSPACE) {
 					sima->flag &= ~SI_PREVSPACE;
 
-					if(sima->flag & SI_FULLWINDOW) {
+					if (sima->flag & SI_FULLWINDOW) {
 						sima->flag &= ~SI_FULLWINDOW;
 						ED_screen_full_prevspace(C, sa);
 					}
-					else if(sima->next) {
+					else if (sima->next) {
 						/* workaround for case of double prevspace, render window
-						   with a file browser on top of it (same as in ED_area_prevspace) */
-						if(sima->next->spacetype == SPACE_FILE && sima->next->next)
+						 * with a file browser on top of it (same as in ED_area_prevspace) */
+						if (sima->next->spacetype == SPACE_FILE && sima->next->next)
 							ED_area_newspace(C, sa, sima->next->next->spacetype);
 						else
 							ED_area_newspace(C, sa, sima->next->spacetype);
@@ -330,12 +330,12 @@ static int render_view_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
 void RENDER_OT_view_show(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Show/Hide Render View";
-	ot->description= "Toggle show render view";
-	ot->idname= "RENDER_OT_view_show";
+	ot->name = "Show/Hide Render View";
+	ot->description = "Toggle show render view";
+	ot->idname = "RENDER_OT_view_show";
 
 	/* api callbacks */
-	ot->invoke= render_view_show_invoke;
-	ot->poll= ED_operator_screenactive;
+	ot->invoke = render_view_show_invoke;
+	ot->poll = ED_operator_screenactive;
 }
 
diff --git a/source/blender/editors/screen/CMakeLists.txt b/source/blender/editors/screen/CMakeLists.txt
index 3614052..3337335 100644
--- a/source/blender/editors/screen/CMakeLists.txt
+++ b/source/blender/editors/screen/CMakeLists.txt
@@ -24,6 +24,7 @@ set(INC
 	../../blenkernel
 	../../blenlib
 	../../blenloader
+	../../bmesh
 	../../imbuf
 	../../makesdna
 	../../makesrna
@@ -46,4 +47,8 @@ set(SRC
 	screen_intern.h
 )
 
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
 blender_add_lib(bf_editor_screen "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/screen/SConscript b/source/blender/editors/screen/SConscript
index 1381c82..0e894a1 100644
--- a/source/blender/editors/screen/SConscript
+++ b/source/blender/editors/screen/SConscript
@@ -5,16 +5,19 @@ sources = env.Glob('*.c')
 
 incs = '../include ../../blenlib ../../blenkernel ../../blenfont ../../makesdna ../../imbuf'
 incs += ' ../../blenloader ../../windowmanager ../../makesrna ../../gpu'
-incs += ' ../../render/extern/include'
+incs += ' ../../render/extern/include ../../bmesh'
 incs += ' #/intern/guardedalloc #/extern/glew/include'
 
-defs = ''
+defs = []
 
 if env['OURPLATFORM'] == 'linux':
     cflags='-pthread'
     incs += ' ../../../extern/binreloc/include'
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
 
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
+
 env.BlenderLib ( 'bf_editors_screen', sources, Split(incs), Split(defs), libtype=['core'], priority=[105] )
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index e4088fe..bed1704 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -74,10 +74,10 @@ static void region_draw_emboss(ARegion *ar, rcti *scirct)
 	rcti rect;
 	
 	/* translate scissor rect to region space */
-	rect.xmin= scirct->xmin - ar->winrct.xmin;
-	rect.ymin= scirct->ymin - ar->winrct.ymin;
-	rect.xmax= scirct->xmax - ar->winrct.xmin;
-	rect.ymax= scirct->ymax - ar->winrct.ymin;
+	rect.xmin = scirct->xmin - ar->winrct.xmin;
+	rect.ymin = scirct->ymin - ar->winrct.ymin;
+	rect.xmax = scirct->xmax - ar->winrct.xmin;
+	rect.ymax = scirct->ymax - ar->winrct.ymin;
 	
 	/* set transp line */
 	glEnable( GL_BLEND );
@@ -117,7 +117,7 @@ void ED_region_do_listen(ARegion *ar, wmNotifier *note)
 	/* generic notes first */
 	switch(note->category) {
 		case NC_WM:
-			if(note->data==ND_FILEREAD)
+			if (note->data==ND_FILEREAD)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_WINDOW:
@@ -125,7 +125,7 @@ void ED_region_do_listen(ARegion *ar, wmNotifier *note)
 			break;
 	}
 
-	if(ar->type && ar->type->listener)
+	if (ar->type && ar->type->listener)
 		ar->type->listener(ar, note);
 }
 
@@ -133,7 +133,7 @@ void ED_region_do_listen(ARegion *ar, wmNotifier *note)
 void ED_area_do_listen(ScrArea *sa, wmNotifier *note)
 {
 	/* no generic notes? */
-	if(sa->type && sa->type->listener) {
+	if (sa->type && sa->type->listener) {
 		sa->type->listener(sa, note);
 	}
 }
@@ -142,7 +142,7 @@ void ED_area_do_listen(ScrArea *sa, wmNotifier *note)
 void ED_area_do_refresh(bContext *C, ScrArea *sa)
 {
 	/* no generic notes? */
-	if(sa->type && sa->type->refresh) {
+	if (sa->type && sa->type->refresh) {
 		sa->type->refresh(C, sa);
 	}
 	sa->do_refresh= 0;
@@ -154,14 +154,14 @@ void ED_area_overdraw_flush(ScrArea *sa, ARegion *ar)
 {
 	AZone *az;
 	
-	for(az= sa->actionzones.first; az; az= az->next) {
+	for (az= sa->actionzones.first; az; az= az->next) {
 		int xs, ys;
 		
 		xs= (az->x1+az->x2)/2;
 		ys= (az->y1+az->y2)/2;
 
 		/* test if inside */
-		if(BLI_in_rcti(&ar->winrct, xs, ys)) {
+		if (BLI_in_rcti(&ar->winrct, xs, ys)) {
 			az->do_draw= 1;
 		}
 	}
@@ -204,8 +204,8 @@ static void region_draw_azone_icon(AZone *az)
 		
 	qobj = gluNewQuadric();
 	
-	glPushMatrix(); 	
-	glTranslatef(midx, midy, 0.); 
+	glPushMatrix();
+	glTranslatef(midx, midy, 0.0);
 	
 	/* outlined circle */
 	glEnable(GL_LINE_SMOOTH);
@@ -360,22 +360,23 @@ void ED_area_overdraw(bContext *C)
 	glEnable( GL_BLEND );
 	glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
 	
-	for(sa= screen->areabase.first; sa; sa= sa->next) {
+	for (sa= screen->areabase.first; sa; sa= sa->next) {
 		AZone *az;
-		for(az= sa->actionzones.first; az; az= az->next) {
-			if(az->do_draw) {
-				if(az->type==AZONE_AREA) {
+		for (az= sa->actionzones.first; az; az= az->next) {
+			if (az->do_draw) {
+				if (az->type==AZONE_AREA) {
 					area_draw_azone(az->x1, az->y1, az->x2, az->y2);
-				} else if(az->type==AZONE_REGION) {
+				}
+				else if (az->type==AZONE_REGION) {
 					
-					if(az->ar) {
+					if (az->ar) {
 						/* only display tab or icons when the region is hidden */
 						if (az->ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
-							if(G.rt==3)
+							if (G.rt==3)
 								region_draw_azone_icon(az);
-							else if(G.rt==2)
+							else if (G.rt==2)
 								region_draw_azone_tria(az);
-							else if(G.rt==1)
+							else if (G.rt==1)
 								region_draw_azone_tab(az);
 							else
 								region_draw_azone_tab_plus(az);
@@ -396,20 +397,20 @@ void region_scissor_winrct(ARegion *ar, rcti *winrct)
 {
 	*winrct= ar->winrct;
 	
-	if(ELEM(ar->alignment, RGN_OVERLAP_LEFT, RGN_OVERLAP_RIGHT))
+	if (ELEM(ar->alignment, RGN_OVERLAP_LEFT, RGN_OVERLAP_RIGHT))
 		return;
 
-	while(ar->prev) {
+	while (ar->prev) {
 		ar= ar->prev;
 		
-		if(BLI_isect_rcti(winrct, &ar->winrct, NULL)) {
-			if(ar->flag & RGN_FLAG_HIDDEN);
-			else if(ar->alignment & RGN_SPLIT_PREV);
-			else if(ar->alignment==RGN_OVERLAP_LEFT) {
-				winrct->xmin= ar->winrct.xmax + 1;
+		if (BLI_isect_rcti(winrct, &ar->winrct, NULL)) {
+			if (ar->flag & RGN_FLAG_HIDDEN);
+			else if (ar->alignment & RGN_SPLIT_PREV);
+			else if (ar->alignment==RGN_OVERLAP_LEFT) {
+				winrct->xmin = ar->winrct.xmax + 1;
 			}
-			else if(ar->alignment==RGN_OVERLAP_RIGHT) {
-				winrct->xmax= ar->winrct.xmin - 1;
+			else if (ar->alignment==RGN_OVERLAP_RIGHT) {
+				winrct->xmax = ar->winrct.xmin - 1;
 			}
 			else break;
 		}
@@ -447,40 +448,37 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
 	rcti winrct;
 	
 	/* see BKE_spacedata_draw_locks() */
-	if(at->do_lock)
+	if (at->do_lock)
 		return;
 	
 	/* checks other overlapping regions */
 	region_scissor_winrct(ar, &winrct);
 	
 	/* if no partial draw rect set, full rect */
-	if(ar->drawrct.xmin == ar->drawrct.xmax)
+	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);
+		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);
 	}
 	
 	/* note; this sets state, so we can use wmOrtho and friends */
 	wmSubWindowScissorSet(win, ar->swinid, &ar->drawrct);
-
-	ar->do_draw= 0;
-	memset(&ar->drawrct, 0, sizeof(ar->drawrct));
 	
 	UI_SetTheme(sa?sa->spacetype:0, ar->type?ar->type->regionid:0);
 	
 	/* optional header info instead? */
-	if(ar->headerstr) {
+	if (ar->headerstr) {
 		UI_ThemeClearColor(TH_HEADER);
 		glClear(GL_COLOR_BUFFER_BIT);
 		
 		UI_ThemeColor(TH_TEXT);
 		BLF_draw_default(20, 8, 0.0f, ar->headerstr, BLF_DRAW_STR_DUMMY_MAX);
 	}
-	else if(at->draw) {
+	else if (at->draw) {
 		at->draw(C, ar);
 	}
 
@@ -488,21 +486,24 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
 	ED_region_pixelspace(ar);
 
 	ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_PIXEL);
+
+	ar->do_draw= 0;
+	memset(&ar->drawrct, 0, sizeof(ar->drawrct));
 	
 	uiFreeInactiveBlocks(C, &ar->uiblocks);
 
-	if(sa)
+	if (sa)
 		region_draw_emboss(ar, &winrct);
 }
 
 /* **********************************
-   maybe silly, but let's try for now
-   to keep these tags protected
-   ********************************** */
+ * maybe silly, but let's try for now
+ * to keep these tags protected
+ * ********************************** */
 
 void ED_region_tag_redraw(ARegion *ar)
 {
-	if(ar) {
+	if (ar) {
 		/* zero region means full region redraw */
 		ar->do_draw= RGN_DRAW;
 		memset(&ar->drawrct, 0, sizeof(ar->drawrct));
@@ -511,24 +512,24 @@ void ED_region_tag_redraw(ARegion *ar)
 
 void ED_region_tag_redraw_overlay(ARegion *ar)
 {
-	if(ar)
+	if (ar)
 		ar->do_draw_overlay= RGN_DRAW;
 }
 
 void ED_region_tag_redraw_partial(ARegion *ar, rcti *rct)
 {
-	if(ar) {
-		if(!ar->do_draw) {
+	if (ar) {
+		if (!ar->do_draw) {
 			/* no redraw set yet, set partial region */
 			ar->do_draw= RGN_DRAW_PARTIAL;
 			ar->drawrct= *rct;
 		}
-		else if(ar->drawrct.xmin != ar->drawrct.xmax) {
+		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);
+			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);
 		}
 	}
 }
@@ -537,8 +538,8 @@ void ED_area_tag_redraw(ScrArea *sa)
 {
 	ARegion *ar;
 	
-	if(sa)
-		for(ar= sa->regionbase.first; ar; ar= ar->next)
+	if (sa)
+		for (ar= sa->regionbase.first; ar; ar= ar->next)
 			ED_region_tag_redraw(ar);
 }
 
@@ -546,9 +547,9 @@ void ED_area_tag_redraw_regiontype(ScrArea *sa, int regiontype)
 {
 	ARegion *ar;
 	
-	if(sa) {
-		for(ar= sa->regionbase.first; ar; ar= ar->next) {
-			if(ar->regiontype == regiontype) {
+	if (sa) {
+		for (ar= sa->regionbase.first; ar; ar= ar->next) {
+			if (ar->regiontype == regiontype) {
 				ED_region_tag_redraw(ar);
 			}
 		}
@@ -557,7 +558,7 @@ void ED_area_tag_redraw_regiontype(ScrArea *sa, int regiontype)
 
 void ED_area_tag_refresh(ScrArea *sa)
 {
-	if(sa)
+	if (sa)
 		sa->do_refresh= 1;
 }
 
@@ -569,17 +570,17 @@ void ED_area_headerprint(ScrArea *sa, const char *str)
 	ARegion *ar;
 
 	/* happens when running transform operators in backround mode */
-	if(sa == NULL)
+	if (sa == NULL)
 		return;
 
-	for(ar= sa->regionbase.first; ar; ar= ar->next) {
-		if(ar->regiontype==RGN_TYPE_HEADER) {
-			if(str) {
-				if(ar->headerstr==NULL)
+	for (ar= sa->regionbase.first; ar; ar= ar->next) {
+		if (ar->regiontype==RGN_TYPE_HEADER) {
+			if (str) {
+				if (ar->headerstr==NULL)
 					ar->headerstr= MEM_mallocN(256, "headerprint");
 				BLI_strncpy(ar->headerstr, str, 256);
 			}
-			else if(ar->headerstr) {
+			else if (ar->headerstr) {
 				MEM_freeN(ar->headerstr);
 				ar->headerstr= NULL;
 			}
@@ -658,10 +659,10 @@ static void region_azone_icon(ScrArea *sa, AZone *az, ARegion *ar)
 	int tot=0;
 	
 	/* count how many actionzones with along same edge are available.
-	   This allows for adding more action zones in the future without
-	   having to worry about correct offset */
-	for(azt= sa->actionzones.first; azt; azt= azt->next) {
-		if(azt->edge == az->edge) tot++;
+	 * This allows for adding more action zones in the future without
+	 * having to worry about correct offset */
+	for (azt= sa->actionzones.first; azt; azt= azt->next) {
+		if (azt->edge == az->edge) tot++;
 	}
 	
 	switch(az->edge) {
@@ -694,14 +695,14 @@ static void region_azone_icon(ScrArea *sa, AZone *az, ARegion *ar)
 	BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
 	
 	/* if more azones on 1 spot, set offset */
-	for(azt= sa->actionzones.first; azt; azt= azt->next) {
-		if(az!=azt) {
-			if( ABS(az->x1-azt->x1) < 2 && ABS(az->y1-azt->y1) < 2) {
-				if(az->edge==AE_TOP_TO_BOTTOMRIGHT || az->edge==AE_BOTTOM_TO_TOPLEFT) {
+	for (azt= sa->actionzones.first; azt; azt= azt->next) {
+		if (az!=azt) {
+			if ( ABS(az->x1-azt->x1) < 2 && ABS(az->y1-azt->y1) < 2) {
+				if (az->edge==AE_TOP_TO_BOTTOMRIGHT || az->edge==AE_BOTTOM_TO_TOPLEFT) {
 					az->x1+= AZONESPOT;
 					az->x2+= AZONESPOT;
 				}
-				else{
+				else {
 					az->y1-= AZONESPOT;
 					az->y2-= AZONESPOT;
 				}
@@ -720,13 +721,13 @@ static void region_azone_tab_plus(ScrArea *sa, AZone *az, ARegion *ar)
 	AZone *azt;
 	int tot= 0, add;
 	
-	for(azt= sa->actionzones.first; azt; azt= azt->next) {
-		if(azt->edge == az->edge) tot++;
+	for (azt= sa->actionzones.first; azt; azt= azt->next) {
+		if (azt->edge == az->edge) tot++;
 	}
 	
 	switch(az->edge) {
 		case AE_TOP_TO_BOTTOMRIGHT:
-			if(ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
+			if (ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
 			az->x1= ar->winrct.xmax - 2.5*AZONEPAD_TAB_PLUSW;
 			az->y1= ar->winrct.ymax - add;
 			az->x2= ar->winrct.xmax - 1.5*AZONEPAD_TAB_PLUSW;
@@ -765,13 +766,13 @@ static void region_azone_tab(ScrArea *sa, AZone *az, ARegion *ar)
 	AZone *azt;
 	int tot= 0, add;
 	
-	for(azt= sa->actionzones.first; azt; azt= azt->next) {
-		if(azt->edge == az->edge) tot++;
+	for (azt= sa->actionzones.first; azt; azt= azt->next) {
+		if (azt->edge == az->edge) tot++;
 	}
 	
 	switch(az->edge) {
 		case AE_TOP_TO_BOTTOMRIGHT:
-			if(ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
+			if (ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
 			az->x1= ar->winrct.xmax - 2*AZONEPAD_TABW;
 			az->y1= ar->winrct.ymax - add;
 			az->x2= ar->winrct.xmax - AZONEPAD_TABW;
@@ -810,13 +811,13 @@ static void region_azone_tria(ScrArea *sa, AZone *az, ARegion *ar)
 	AZone *azt;
 	int tot= 0, add;
 	
-	for(azt= sa->actionzones.first; azt; azt= azt->next) {
-		if(azt->edge == az->edge) tot++;
+	for (azt= sa->actionzones.first; azt; azt= azt->next) {
+		if (azt->edge == az->edge) tot++;
 	}
 	
 	switch(az->edge) {
 		case AE_TOP_TO_BOTTOMRIGHT:
-			if(ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
+			if (ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
 			az->x1= ar->winrct.xmax - 2*AZONEPAD_TRIAW;
 			az->y1= ar->winrct.ymax - add;
 			az->x2= ar->winrct.xmax - AZONEPAD_TRIAW;
@@ -857,15 +858,16 @@ static void region_azone_initialize(ScrArea *sa, ARegion *ar, AZEdge edge)
 	az->edge= edge;
 	
 	if (ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
-		if(G.rt==3)
+		if (G.rt==3)
 			region_azone_icon(sa, az, ar);
-		else if(G.rt==2)
+		else if (G.rt==2)
 			region_azone_tria(sa, az, ar);
-		else if(G.rt==1)
+		else if (G.rt==1)
 			region_azone_tab(sa, az, ar);
 		else
 			region_azone_tab_plus(sa, az, ar);
-	} else {
+	}
+	else {
 		region_azone_edge(az, ar);
 	}
 	
@@ -878,20 +880,20 @@ static void region_azone_add(ScrArea *sa, ARegion *ar, int alignment)
 {
 	 /* edge code (t b l r) is along which area edge azone will be drawn */
 	
-	if(alignment==RGN_ALIGN_TOP)
+	if (alignment==RGN_ALIGN_TOP)
 		region_azone_initialize(sa, ar, AE_BOTTOM_TO_TOPLEFT);
-	else if(alignment==RGN_ALIGN_BOTTOM)
+	else if (alignment==RGN_ALIGN_BOTTOM)
 		region_azone_initialize(sa, ar, AE_TOP_TO_BOTTOMRIGHT);
-	else if(ELEM(alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT))
+	else if (ELEM(alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT))
 		region_azone_initialize(sa, ar, AE_LEFT_TO_TOPRIGHT);
-	else if(ELEM(alignment, RGN_ALIGN_LEFT, RGN_OVERLAP_LEFT))
+	else if (ELEM(alignment, RGN_ALIGN_LEFT, RGN_OVERLAP_LEFT))
 		region_azone_initialize(sa, ar, AE_RIGHT_TO_TOPLEFT);
 }
 
 /* dir is direction to check, not the splitting edge direction! */
 static int rct_fits(rcti *rect, char dir, int size)
 {
-	if(dir=='h') {
+	if (dir=='h') {
 		return rect->xmax-rect->xmin - size;
 	}
 	else { // 'v'
@@ -905,15 +907,15 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
 	int prefsizex, prefsizey;
 	int alignment;
 	
-	if(ar==NULL)
+	if (ar==NULL)
 		return;
 	
 	/* no returns in function, winrct gets set in the end again */
 	BLI_init_rcti(&ar->winrct, 0, 0, 0, 0);
 	
 	/* for test; allow split of previously defined region */
-	if(ar->alignment & RGN_SPLIT_PREV)
-		if(ar->prev)
+	if (ar->alignment & RGN_SPLIT_PREV)
+		if (ar->prev)
 			remainder= &ar->prev->winrct;
 	
 	alignment = ar->alignment & ~RGN_SPLIT_PREV;
@@ -921,135 +923,135 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
 	/* clear state flags first */
 	ar->flag &= ~RGN_FLAG_TOO_SMALL;
 	/* user errors */
-	if(ar->next==NULL && alignment!=RGN_ALIGN_QSPLIT)
+	if (ar->next==NULL && alignment!=RGN_ALIGN_QSPLIT)
 		alignment= RGN_ALIGN_NONE;
 	
 	/* prefsize, for header we stick to exception */
 	prefsizex= ar->sizex?ar->sizex:ar->type->prefsizex;
-	if(ar->regiontype==RGN_TYPE_HEADER)
+	if (ar->regiontype==RGN_TYPE_HEADER)
 		prefsizey= ar->type->prefsizey;
-	else if(ar->regiontype==RGN_TYPE_UI && sa->spacetype == SPACE_FILE) {
+	else if (ar->regiontype==RGN_TYPE_UI && sa->spacetype == SPACE_FILE) {
 		prefsizey= UI_UNIT_Y * 2 + (UI_UNIT_Y/2);
 	}
 	else
 		prefsizey= ar->sizey?ar->sizey:ar->type->prefsizey;
 	
 	/* hidden is user flag */
-	if(ar->flag & RGN_FLAG_HIDDEN);
+	if (ar->flag & RGN_FLAG_HIDDEN);
 	/* XXX floating area region, not handled yet here */
-	else if(alignment == RGN_ALIGN_FLOAT);
+	else if (alignment == RGN_ALIGN_FLOAT);
 	/* remainder is too small for any usage */
-	else if( rct_fits(remainder, 'v', 1)<0 || rct_fits(remainder, 'h', 1) < 0 ) {
+	else if ( rct_fits(remainder, 'v', 1)<0 || rct_fits(remainder, 'h', 1) < 0 ) {
 		ar->flag |= RGN_FLAG_TOO_SMALL;
 	}
-	else if(alignment==RGN_ALIGN_NONE) {
+	else if (alignment==RGN_ALIGN_NONE) {
 		/* typically last region */
 		ar->winrct= *remainder;
 		BLI_init_rcti(remainder, 0, 0, 0, 0);
 	}
-	else if(alignment==RGN_ALIGN_TOP || alignment==RGN_ALIGN_BOTTOM) {
+	else if (alignment==RGN_ALIGN_TOP || alignment==RGN_ALIGN_BOTTOM) {
 		
-		if( rct_fits(remainder, 'v', prefsizey) < 0 ) {
+		if ( rct_fits(remainder, 'v', prefsizey) < 0 ) {
 			ar->flag |= RGN_FLAG_TOO_SMALL;
 		}
 		else {
 			int fac= rct_fits(remainder, 'v', prefsizey);
 
-			if(fac < 0 )
+			if (fac < 0 )
 				prefsizey += fac;
 			
 			ar->winrct= *remainder;
 			
-			if(alignment==RGN_ALIGN_TOP) {
-				ar->winrct.ymin= ar->winrct.ymax - prefsizey + 1;
-				remainder->ymax= ar->winrct.ymin - 1;
+			if (alignment==RGN_ALIGN_TOP) {
+				ar->winrct.ymin = ar->winrct.ymax - prefsizey + 1;
+				remainder->ymax = ar->winrct.ymin - 1;
 			}
 			else {
-				ar->winrct.ymax= ar->winrct.ymin + prefsizey - 1;
-				remainder->ymin= ar->winrct.ymax + 1;
+				ar->winrct.ymax = ar->winrct.ymin + prefsizey - 1;
+				remainder->ymin = ar->winrct.ymax + 1;
 			}
 		}
 	}
-	else if( ELEM4(alignment, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT, RGN_OVERLAP_LEFT, RGN_OVERLAP_RIGHT)) {
+	else if ( ELEM4(alignment, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT, RGN_OVERLAP_LEFT, RGN_OVERLAP_RIGHT)) {
 		
-		if( rct_fits(remainder, 'h', prefsizex) < 0 ) {
+		if ( rct_fits(remainder, 'h', prefsizex) < 0 ) {
 			ar->flag |= RGN_FLAG_TOO_SMALL;
 		}
 		else {
 			int fac= rct_fits(remainder, 'h', prefsizex);
 			
-			if(fac < 0 )
+			if (fac < 0 )
 				prefsizex += fac;
 			
 			ar->winrct= *remainder;
 			
-			if(ELEM(alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT)) {
-				ar->winrct.xmin= ar->winrct.xmax - prefsizex + 1;
-				if(alignment==RGN_ALIGN_RIGHT)
-					remainder->xmax= ar->winrct.xmin - 1;
+			if (ELEM(alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT)) {
+				ar->winrct.xmin = ar->winrct.xmax - prefsizex + 1;
+				if (alignment==RGN_ALIGN_RIGHT)
+					remainder->xmax = ar->winrct.xmin - 1;
 			}
 			else {
-				ar->winrct.xmax= ar->winrct.xmin + prefsizex - 1;
-				if(alignment==RGN_ALIGN_LEFT)
-					remainder->xmin= ar->winrct.xmax + 1;
+				ar->winrct.xmax = ar->winrct.xmin + prefsizex - 1;
+				if (alignment==RGN_ALIGN_LEFT)
+					remainder->xmin = ar->winrct.xmax + 1;
 			}
 		}
 	}
-	else if(alignment==RGN_ALIGN_VSPLIT || alignment==RGN_ALIGN_HSPLIT) {
+	else if (alignment==RGN_ALIGN_VSPLIT || alignment==RGN_ALIGN_HSPLIT) {
 		/* percentage subdiv*/
 		ar->winrct= *remainder;
 		
-		if(alignment==RGN_ALIGN_HSPLIT) {
-			if( rct_fits(remainder, 'h', prefsizex) > 4) {
-				ar->winrct.xmax= (remainder->xmin+remainder->xmax)/2;
-				remainder->xmin= ar->winrct.xmax+1;
+		if (alignment==RGN_ALIGN_HSPLIT) {
+			if ( rct_fits(remainder, 'h', prefsizex) > 4) {
+				ar->winrct.xmax = (remainder->xmin+remainder->xmax)/2;
+				remainder->xmin = ar->winrct.xmax+1;
 			}
 			else {
 				BLI_init_rcti(remainder, 0, 0, 0, 0);
 			}
 		}
 		else {
-			if( rct_fits(remainder, 'v', prefsizey) > 4) {
-				ar->winrct.ymax= (remainder->ymin+remainder->ymax)/2;
-				remainder->ymin= ar->winrct.ymax+1;
+			if ( rct_fits(remainder, 'v', prefsizey) > 4) {
+				ar->winrct.ymax = (remainder->ymin+remainder->ymax)/2;
+				remainder->ymin = ar->winrct.ymax+1;
 			}
 			else {
 				BLI_init_rcti(remainder, 0, 0, 0, 0);
 			}
 		}
 	}
-	else if(alignment==RGN_ALIGN_QSPLIT) {
+	else if (alignment==RGN_ALIGN_QSPLIT) {
 		ar->winrct= *remainder;
 		
 		/* test if there's still 4 regions left */
-		if(quad==0) {
+		if (quad==0) {
 			ARegion *artest= ar->next;
 			int count= 1;
 			
-			while(artest) {
+			while (artest) {
 				artest->alignment= RGN_ALIGN_QSPLIT;
 				artest= artest->next;
 				count++;
 			}
 			
-			if(count!=4) {
+			if (count!=4) {
 				/* let's stop adding regions */
 				BLI_init_rcti(remainder, 0, 0, 0, 0);
-				if (G.f & G_DEBUG)
+				if (G.debug & G_DEBUG)
 					printf("region quadsplit failed\n");
 			}
 			else quad= 1;
 		}
-		if(quad) {
-			if(quad==1) { /* left bottom */
+		if (quad) {
+			if (quad==1) { /* left bottom */
 				ar->winrct.xmax = (remainder->xmin + remainder->xmax)/2;
 				ar->winrct.ymax = (remainder->ymin + remainder->ymax)/2;
 			}
-			else if(quad==2) { /* left top */
+			else if (quad==2) { /* left top */
 				ar->winrct.xmax = (remainder->xmin + remainder->xmax)/2;
 				ar->winrct.ymin = 1 + (remainder->ymin + remainder->ymax)/2;
 			}
-			else if(quad==3) { /* right bottom */
+			else if (quad==3) { /* right bottom */
 				ar->winrct.xmin = 1 + (remainder->xmin + remainder->xmax)/2;
 				ar->winrct.ymax = (remainder->ymin + remainder->ymax)/2;
 			}
@@ -1068,24 +1070,24 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
 	ar->winy= ar->winrct.ymax - ar->winrct.ymin + 1;
 	
 	/* set winrect for azones */
-	if(ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
+	if (ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
 		ar->winrct= *remainder;
 		
-		if(alignment==RGN_ALIGN_TOP)
-			ar->winrct.ymin= ar->winrct.ymax;
-		else if(alignment==RGN_ALIGN_BOTTOM)
-			ar->winrct.ymax= ar->winrct.ymin;
-		else if(ELEM(alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT))
-			ar->winrct.xmin= ar->winrct.xmax;
-		else if(ELEM(alignment, RGN_ALIGN_LEFT, RGN_OVERLAP_LEFT))
-			ar->winrct.xmax= ar->winrct.xmin;
+		if (alignment==RGN_ALIGN_TOP)
+			ar->winrct.ymin = ar->winrct.ymax;
+		else if (alignment==RGN_ALIGN_BOTTOM)
+			ar->winrct.ymax = ar->winrct.ymin;
+		else if (ELEM(alignment, RGN_ALIGN_RIGHT, RGN_OVERLAP_RIGHT))
+			ar->winrct.xmin = ar->winrct.xmax;
+		else if (ELEM(alignment, RGN_ALIGN_LEFT, RGN_OVERLAP_LEFT))
+			ar->winrct.xmax = ar->winrct.xmin;
 		else /* prevent winrct to be valid */
-			ar->winrct.xmax= ar->winrct.xmin;
+			ar->winrct.xmax = ar->winrct.xmin;
 	}
 
 	/* restore prev-split exception */
-	if(ar->alignment & RGN_SPLIT_PREV) {
-		if(ar->prev) {
+	if (ar->alignment & RGN_SPLIT_PREV) {
+		if (ar->prev) {
 			remainder= remainder_prev;
 			ar->prev->winx= ar->prev->winrct.xmax - ar->prev->winrct.xmin + 1;
 			ar->prev->winy= ar->prev->winrct.ymax - ar->prev->winrct.ymin + 1;
@@ -1093,7 +1095,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
 	}
 	
 	/* in end, add azones, where appropriate */
-	if(ar->regiontype == RGN_TYPE_HEADER && ar->winy + 6 > sa->winy) {
+	if (ar->regiontype == RGN_TYPE_HEADER && ar->winy + 6 > sa->winy) {
 		/* The logic for this is: when the header takes up the full area,
 		 * disallow hiding it to view the main window.
 		 *
@@ -1113,15 +1115,15 @@ static void area_calc_totrct(ScrArea *sa, int sizex, int sizey)
 {
 	short rt= 0; // CLAMPIS(G.rt, 0, 16);
 
-	if(sa->v1->vec.x>0) sa->totrct.xmin= sa->v1->vec.x+1+rt;
-	else sa->totrct.xmin= sa->v1->vec.x;
-	if(sa->v4->vec.x<sizex-1) sa->totrct.xmax= sa->v4->vec.x-1-rt;
-	else sa->totrct.xmax= sa->v4->vec.x;
+	if (sa->v1->vec.x>0) sa->totrct.xmin = sa->v1->vec.x+1+rt;
+	else sa->totrct.xmin = sa->v1->vec.x;
+	if (sa->v4->vec.x<sizex-1) sa->totrct.xmax = sa->v4->vec.x-1-rt;
+	else sa->totrct.xmax = sa->v4->vec.x;
 	
-	if(sa->v1->vec.y>0) sa->totrct.ymin= sa->v1->vec.y+1+rt;
-	else sa->totrct.ymin= sa->v1->vec.y;
-	if(sa->v2->vec.y<sizey-1) sa->totrct.ymax= sa->v2->vec.y-1-rt;
-	else sa->totrct.ymax= sa->v2->vec.y;
+	if (sa->v1->vec.y>0) sa->totrct.ymin = sa->v1->vec.y+1+rt;
+	else sa->totrct.ymin = sa->v1->vec.y;
+	if (sa->v2->vec.y<sizey-1) sa->totrct.ymax = sa->v2->vec.y-1-rt;
+	else sa->totrct.ymax = sa->v2->vec.y;
 	
 	/* for speedup */
 	sa->winx= sa->totrct.xmax-sa->totrct.xmin+1;
@@ -1132,12 +1134,12 @@ static void area_calc_totrct(ScrArea *sa, int sizex, int sizey)
 /* used for area initialize below */
 static void region_subwindow(wmWindow *win, ARegion *ar)
 {
-	if(ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
-		if(ar->swinid)
+	if (ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
+		if (ar->swinid)
 			wm_subwindow_close(win, ar->swinid);
 		ar->swinid= 0;
 	}
-	else if(ar->swinid==0)
+	else if (ar->swinid==0)
 		ar->swinid= wm_subwindow_open(win, &ar->winrct);
 	else 
 		wm_subwindow_position(win, ar->swinid, &ar->winrct);
@@ -1148,49 +1150,49 @@ static void ed_default_handlers(wmWindowManager *wm, ScrArea *sa, ListBase *hand
 	/* note, add-handler checks if it already exists */
 	
 	// XXX it would be good to have boundbox checks for some of these...
-	if(flag & ED_KEYMAP_UI) {
+	if (flag & ED_KEYMAP_UI) {
 		/* user interface widgets */
 		UI_add_region_handlers(handlers);
 	}
-	if(flag & ED_KEYMAP_VIEW2D) {
+	if (flag & ED_KEYMAP_VIEW2D) {
 		/* 2d-viewport handling+manipulation */
-		wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "View2D", 0, 0);
+		wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "View2D", 0, 0);
 		WM_event_add_keymap_handler(handlers, keymap);
 	}
-	if(flag & ED_KEYMAP_MARKERS) {
+	if (flag & ED_KEYMAP_MARKERS) {
 		/* time-markers */
-		wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Markers", 0, 0);
+		wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "Markers", 0, 0);
 		
 		/* time space only has this keymap, the others get a boundbox restricted map */
-		if(sa->spacetype!=SPACE_TIME) {
+		if (sa->spacetype!=SPACE_TIME) {
 			ARegion *ar;
 			static rcti rect= {0, 10000, 0, 30};	/* same local check for all areas */
 			ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
-			if(ar) {
+			if (ar) {
 				WM_event_add_keymap_handler_bb(handlers, keymap, &rect, &ar->winrct);
 			}
 		}
 		else
 			WM_event_add_keymap_handler(handlers, keymap);
 	}
-	if(flag & ED_KEYMAP_ANIMATION) {
+	if (flag & ED_KEYMAP_ANIMATION) {
 		/* frame changing and timeline operators (for time spaces) */
-		wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Animation", 0, 0);
+		wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "Animation", 0, 0);
 		WM_event_add_keymap_handler(handlers, keymap);
 	}
-	if(flag & ED_KEYMAP_FRAMES) {
+	if (flag & ED_KEYMAP_FRAMES) {
 		/* frame changing/jumping (for all spaces) */
-		wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Frames", 0, 0);
+		wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "Frames", 0, 0);
 		WM_event_add_keymap_handler(handlers, keymap);
 	}
-	if(flag & ED_KEYMAP_GPENCIL) {
+	if (flag & ED_KEYMAP_GPENCIL) {
 		/* grease pencil */
-		wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Grease Pencil", 0, 0);
+		wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "Grease Pencil", 0, 0);
 		WM_event_add_keymap_handler(handlers, keymap);
 	}
-	if(flag & ED_KEYMAP_HEADER) {
+	if (flag & ED_KEYMAP_HEADER) {
 		/* standard keymap for headers regions */
-		wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "Header", 0, 0);
+		wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "Header", 0, 0);
 		WM_event_add_keymap_handler(handlers, keymap);
 	}
 }
@@ -1205,12 +1207,12 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
 	/* set typedefinitions */
 	sa->type= BKE_spacetype_from_id(sa->spacetype);
 	
-	if(sa->type==NULL) {
+	if (sa->type==NULL) {
 		sa->butspacetype= sa->spacetype= SPACE_VIEW3D;
 		sa->type= BKE_spacetype_from_id(sa->spacetype);
 	}
 	
-	for(ar= sa->regionbase.first; ar; ar= ar->next)
+	for (ar= sa->regionbase.first; ar; ar= ar->next)
 		ar->type= BKE_regiontype_from_id(sa->type, ar->regiontype);
 	
 	/* area sizes */
@@ -1226,18 +1228,18 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
 	/* default area handlers */
 	ed_default_handlers(wm, sa, &sa->handlers, sa->type->keymapflag);
 	/* checks spacedata, adds own handlers */
-	if(sa->type->init)
+	if (sa->type->init)
 		sa->type->init(wm, sa);
 	
 	/* region windows, default and own handlers */
-	for(ar= sa->regionbase.first; ar; ar= ar->next) {
+	for (ar= sa->regionbase.first; ar; ar= ar->next) {
 		region_subwindow(win, ar);
 		
-		if(ar->swinid) {
+		if (ar->swinid) {
 			/* default region handlers */
 			ed_default_handlers(wm, sa, &ar->handlers, ar->type->keymapflag);
 			/* own handlers */
-			if(ar->type->init)
+			if (ar->type->init)
 				ar->type->init(wm, ar);
 		}
 		else {
@@ -1246,7 +1248,7 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa)
 		}
 		
 		/* 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)
+		if (ar->regiontype==RGN_TYPE_HEADER)
 			ar->v2d.flag &= ~V2D_IS_INITIALISED;
 	}
 }
@@ -1273,7 +1275,7 @@ void ED_region_toggle_hidden(bContext *C, ARegion *ar)
 
 	ar->flag ^= RGN_FLAG_HIDDEN;
 
-	if(ar->flag & RGN_FLAG_HIDDEN)
+	if (ar->flag & RGN_FLAG_HIDDEN)
 		WM_event_remove_handlers(C, &ar->handlers);
 
 	ED_area_initialize(CTX_wm_manager(C), CTX_wm_window(C), sa);
@@ -1292,10 +1294,10 @@ void area_copy_data(ScrArea *sa1, ScrArea *sa2, int swap_space)
 	sa1->spacetype= sa2->spacetype;
 	sa1->butspacetype= sa2->butspacetype;
 	
-	if(swap_space == 1) {
+	if (swap_space == 1) {
 		SWAP(ListBase, sa1->spacedata, sa2->spacedata);
 		/* exception: ensure preview is reset */
-//		if(sa1->spacetype==SPACE_VIEW3D)
+//		if (sa1->spacetype==SPACE_VIEW3D)
 // XXX			BIF_view3d_previewrender_free(sa1->spacedata.first);
 	}
 	else if (swap_space == 2) {
@@ -1309,19 +1311,19 @@ void area_copy_data(ScrArea *sa1, ScrArea *sa2, int swap_space)
 	/* Note; SPACE_EMPTY is possible on new screens */
 	
 	/* regions */
-	if(swap_space == 1) {
+	if (swap_space == 1) {
 		SWAP(ListBase, sa1->regionbase, sa2->regionbase);
 	}
 	else {
-		if(swap_space<2) {
+		if (swap_space<2) {
 			st= BKE_spacetype_from_id(spacetype);
-			for(ar= sa1->regionbase.first; ar; ar= ar->next)
+			for (ar= sa1->regionbase.first; ar; ar= ar->next)
 				BKE_area_region_free(st, ar);
 			BLI_freelistN(&sa1->regionbase);
 		}
 		
 		st= BKE_spacetype_from_id(sa2->spacetype);
-		for(ar= sa2->regionbase.first; ar; ar= ar->next) {
+		for (ar= sa2->regionbase.first; ar; ar= ar->next) {
 			ARegion *newar= BKE_area_region_copy(st, ar);
 			BLI_addtail(&sa1->regionbase, newar);
 		}
@@ -1357,7 +1359,7 @@ void ED_area_swapspace(bContext *C, ScrArea *sa1, ScrArea *sa2)
 
 void ED_area_newspace(bContext *C, ScrArea *sa, int type)
 {
-	if(sa->spacetype != type) {
+	if (sa->spacetype != type) {
 		SpaceType *st;
 		SpaceLink *slold;
 		SpaceLink *sl;
@@ -1373,14 +1375,14 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type)
 		
 		/* check previously stored space */
 		for (sl= sa->spacedata.first; sl; sl= sl->next)
-			if(sl->spacetype==type)
+			if (sl->spacetype==type)
 				break;
 		
 		/* old spacedata... happened during work on 2.50, remove */
-		if(sl && sl->regionbase.first==NULL) {
+		if (sl && sl->regionbase.first==NULL) {
 			st->free(sl);
 			BLI_freelinkN(&sa->spacedata, sl);
-			if(slold == sl) {
+			if (slold == sl) {
 				slold= NULL;
 			}
 			sl= NULL;
@@ -1399,12 +1401,12 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type)
 		} 
 		else {
 			/* new space */
-			if(st) {
+			if (st) {
 				sl= st->new(C);
 				BLI_addhead(&sa->spacedata, sl);
 				
 				/* swap regions */
-				if(slold)
+				if (slold)
 					slold->regionbase= sa->regionbase;
 				sa->regionbase= sl->regionbase;
 				sl->regionbase.first= sl->regionbase.last= NULL;
@@ -1430,10 +1432,10 @@ void ED_area_prevspace(bContext *C, ScrArea *sa)
 {
 	SpaceLink *sl = (sa) ? sa->spacedata.first : CTX_wm_space_data(C);
 
-	if(sl->next) {
+	if (sl->next) {
 		/* workaround for case of double prevspace, render window
-		   with a file browser on top of it */
-		if(sl->next->spacetype == SPACE_FILE && sl->next->next)
+		 * with a file browser on top of it */
+		if (sl->next->spacetype == SPACE_FILE && sl->next->next)
 			ED_area_newspace(C, sa, sl->next->next->spacetype);
 		else
 			ED_area_newspace(C, sa, sl->next->spacetype);
@@ -1505,7 +1507,7 @@ int ED_area_header_switchbutton(const bContext *C, uiBlock *block, int yco)
 	uiBut *but;
 	int xco= 8;
 	
-	but= uiDefIconTextButC(block, ICONTEXTROW, 0, ICON_VIEW3D, 
+	but = uiDefIconTextButC(block, ICONTEXTROW, 0, ICON_VIEW3D, 
 						   editortype_pup(), xco, yco, UI_UNIT_X+10, UI_UNIT_Y, 
 						   &(sa->butspacetype), 1.0, SPACEICONMAX, 0, 0, 
 						   TIP_("Displays current editor type. Click for menu of available types"));
@@ -1527,14 +1529,14 @@ int ED_area_header_standardbuttons(const bContext *C, uiBlock *block, int yco)
 	uiBlockSetEmboss(block, UI_EMBOSSN);
 
 	if (sa->flag & HEADER_NO_PULLDOWN) {
-		but= uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
+		but = uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
 						 ICON_DISCLOSURE_TRI_RIGHT,
 						 xco,yco,UI_UNIT_X,UI_UNIT_Y-2,
 						 &(sa->flag), 0, 0, 0, 0, 
 						 "Show pulldown menus");
 	}
 	else {
-		but= uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
+		but = uiDefIconButBitS(block, TOG, HEADER_NO_PULLDOWN, 0,
 						 ICON_DISCLOSURE_TRI_DOWN,
 						 xco,yco,UI_UNIT_X,UI_UNIT_Y-2,
 						 &(sa->flag), 0, 0, 0, 0, 
@@ -1561,10 +1563,10 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
 	View2DScrollers *scrollers;
 	int x, y, xco, yco, w, em, triangle, open, newcontext= 0;
 
-	if(contextnr >= 0)
+	if (contextnr >= 0)
 		newcontext= UI_view2d_tab_set(v2d, contextnr);
 
-	if(vertical) {
+	if (vertical) {
 		w= v2d->cur.xmax - v2d->cur.xmin;
 		em= (ar->type->prefsizex)? UI_UNIT_Y/2: UI_UNIT_Y;
 	}
@@ -1579,21 +1581,21 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
 	/* set view2d view matrix for scrolling (without scrollers) */
 	UI_view2d_view_ortho(v2d);
 
-	for(pt= ar->type->paneltypes.first; pt; pt= pt->next) {
+	for (pt= ar->type->paneltypes.first; pt; pt= pt->next) {
 		/* verify context */
-		if(context)
-			if(pt->context[0] && strcmp(context, pt->context) != 0)
+		if (context)
+			if (pt->context[0] && strcmp(context, pt->context) != 0)
 				continue;
 
 		/* draw panel */
-		if(pt->draw && (!pt->poll || pt->poll(C, pt))) {
+		if (pt->draw && (!pt->poll || pt->poll(C, pt))) {
 			block= uiBeginBlock(C, ar, pt->idname, UI_EMBOSS);
 			panel= uiBeginPanel(sa, ar, block, pt, &open);
 
 			/* bad fixed values */
 			triangle= (int)(UI_UNIT_Y * 1.1f);
 
-			if(pt->draw_header && !(pt->flag & PNL_NO_HEADER) && (open || vertical)) {
+			if (pt->draw_header && !(pt->flag & PNL_NO_HEADER) && (open || vertical)) {
 				/* for enabled buttons */
 				panel->layout= uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER,
 					triangle, UI_UNIT_Y+style->panelspace+2, UI_UNIT_Y, 1, style);
@@ -1608,7 +1610,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
 				panel->labelofs= 0;
 			}
 
-			if(open) {
+			if (open) {
 				short panelContext;
 				
 				/* panel context can either be toolbar region or normal panels region */
@@ -1645,7 +1647,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
 	glClear(GL_COLOR_BUFFER_BIT);
 	
 	/* before setting the view */
-	if(vertical) {
+	if (vertical) {
 		/* only allow scrolling in vertical direction */
 		v2d->keepofs |= V2D_LOCKOFS_X|V2D_KEEPOFS_Y;
 		v2d->keepofs &= ~(V2D_LOCKOFS_Y|V2D_KEEPOFS_X);
@@ -1653,13 +1655,13 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
 		v2d->scroll &= ~V2D_SCROLL_VERTICAL_HIDE;
 		
 		// don't jump back when panels close or hide
-		if(!newcontext)
+		if (!newcontext)
 			y= MAX2(-y, -v2d->cur.ymin);
 		else
 			y= -y;
 	}
 	else {
-		/* for now, allow scrolling in both directions (since layouts are optimised for vertical,
+		/* for now, allow scrolling in both directions (since layouts are optimized for vertical,
 		 * they often don't fit in horizontal layout)
 		 */
 		v2d->keepofs &= ~(V2D_LOCKOFS_X|V2D_LOCKOFS_Y|V2D_KEEPOFS_X|V2D_KEEPOFS_Y);
@@ -1669,7 +1671,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char *
 		v2d->scroll &= ~V2D_SCROLL_HORIZONTAL_HIDE;
 		
 		// don't jump back when panels close or hide
-		if(!newcontext)
+		if (!newcontext)
 			x= MAX2(x, v2d->cur.xmax);
 		y= -y;
 	}
@@ -1703,13 +1705,13 @@ void ED_region_panels_init(wmWindowManager *wm, ARegion *ar)
 	ar->v2d.scroll &= ~V2D_SCROLL_VERTICAL_HIDE;
 	ar->v2d.keepzoom |= V2D_KEEPZOOM;
 
-		// correctly initialised User-Prefs?
-	if(!(ar->v2d.align & V2D_ALIGN_NO_POS_Y))
+		// correctly initialized User-Prefs?
+	if (!(ar->v2d.align & V2D_ALIGN_NO_POS_Y))
 		ar->v2d.flag &= ~V2D_IS_INITIALISED;
 	
 	UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_PANELS_UI, ar->winx, ar->winy);
 
-	keymap= WM_keymap_find(wm->defaultconf, "View2D Buttons List", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "View2D Buttons List", 0, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
@@ -1734,25 +1736,25 @@ void ED_region_header(const bContext *C, ARegion *ar)
 	yco= headery-4;
 
 	/* draw all headers types */
-	for(ht= ar->type->headertypes.first; ht; ht= ht->next) {
+	for (ht= ar->type->headertypes.first; ht; ht= ht->next) {
 		block= uiBeginBlock(C, ar, ht->idname, UI_EMBOSS);
 		layout= uiBlockLayout(block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, yco, UI_UNIT_Y, 1, style);
 
-		if(ht->draw) {
+		if (ht->draw) {
 			header.type= ht;
 			header.layout= layout;
 			ht->draw(C, &header);
 			
 			/* for view2d */
 			xco= uiLayoutGetWidth(layout);
-			if(xco > maxco)
+			if (xco > maxco)
 				maxco= xco;
 		}
 
 		uiBlockLayoutResolve(block, &xco, &yco);
 		
 		/* for view2d */
-		if(xco > maxco)
+		if (xco > maxco)
 			maxco= xco;
 		
 		uiEndBlock(C, block);
@@ -1788,17 +1790,17 @@ void ED_region_info_draw(ARegion *ar, const char *text, int block, float alpha)
 
 	/* background box */
 	rect= ar->winrct;
-	rect.xmin= 0;
-	rect.ymin= ar->winrct.ymax - ar->winrct.ymin - header_height;
+	rect.xmin = 0;
+	rect.ymin = ar->winrct.ymax - ar->winrct.ymin - header_height;
 
-	if(block) {
-		rect.xmax= ar->winrct.xmax - ar->winrct.xmin;
+	if (block) {
+		rect.xmax = ar->winrct.xmax - ar->winrct.xmin;
 	}
 	else {
-		rect.xmax= rect.xmin + BLF_width(fontid, text) + 24;
+		rect.xmax = rect.xmin + BLF_width(fontid, text) + 24;
 	}
 
-	rect.ymax= ar->winrct.ymax - ar->winrct.ymin;
+	rect.ymax = ar->winrct.ymax - ar->winrct.ymin;
 
 	glEnable(GL_BLEND);
 	glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 0b231ee..5ba0e86 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -73,10 +73,11 @@ GLubyte stipple_halftone[128] = {
 
 
 /*  repeat this pattern
-	X000X000
-	00000000
-	00X000X0
-	00000000 */
+ *
+ *     X000X000
+ *     00000000
+ *     00X000X0
+ *     00000000 */
 
 
 GLubyte stipple_quarttone[128] = { 
@@ -148,8 +149,10 @@ void fdrawbezier(float vec[4][3])
 	glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4, vec[0]);
 	glBegin(GL_LINE_STRIP);
 	while (spline_step < 1.000001f) {
-		/*if(do_shaded)
-			UI_ThemeColorBlend(th_col1, th_col2, spline_step);*/
+#if 0
+		if (do_shaded)
+			UI_ThemeColorBlend(th_col1, th_col2, spline_step);
+#endif
 		glEvalCoord1f(spline_step);
 		spline_step += dist;
 	}
@@ -188,6 +191,31 @@ void fdrawbox(float x1, float y1, float x2, float y2)
 	glEnd();
 }
 
+void fdrawcheckerboard(float x1, float y1, float x2, float y2)
+{
+	unsigned char col1[4]= {40, 40, 40}, col2[4]= {50, 50, 50};
+
+	GLubyte checker_stipple[32*32/8] = {
+		255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,
+		255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,
+		0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,
+		0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,
+		255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,
+		255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,
+		0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,
+		0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,
+	};
+	
+	glColor3ubv(col1);
+	glRectf(x1, y1, x2, y2);
+	glColor3ubv(col2);
+
+	glEnable(GL_POLYGON_STIPPLE);
+	glPolygonStipple(checker_stipple);
+	glRectf(x1, y1, x2, y2);
+	glDisable(GL_POLYGON_STIPPLE);
+}
+
 void sdrawline(short x1, short y1, short x2, short y2)
 {
 	short v[2];
@@ -201,14 +229,12 @@ void sdrawline(short x1, short y1, short x2, short y2)
 }
 
 /*
-
-	x1,y2
-	|  \
-	|   \
-	|    \
-	x1,y1-- x2,y1
-
-*/
+ *     x1,y2
+ *     |  \
+ *     |   \
+ *     |    \
+ *     x1,y1-- x2,y1
+ */
 
 static void sdrawtripoints(short x1, short y1, short x2, short y2)
 {
@@ -260,7 +286,7 @@ void sdrawbox(short x1, short y1, short x2, short y2)
 
 void setlinestyle(int nr)
 {
-	if(nr==0) {
+	if (nr==0) {
 		glDisable(GL_LINE_STIPPLE);
 	}
 	else {
@@ -283,7 +309,7 @@ void set_inverted_drawing(int enable)
 
 void sdrawXORline(int x0, int y0, int x1, int y1)
 {
-	if(x0==x1 && y0==y1) return;
+	if (x0==x1 && y0==y1) return;
 
 	set_inverted_drawing(1);
 	
@@ -305,7 +331,7 @@ void sdrawXORline4(int nr, int x0, int y0, int x1, int y1)
 	set_inverted_drawing(1);
 		
 	glBegin(GL_LINES);
-	if(nr== -1) { /* flush */
+	if (nr== -1) { /* flush */
 		for (nr=0; nr<4; nr++) {
 			if (flags[nr]) {
 				glVertex2sv(old[nr][0]);
@@ -313,9 +339,10 @@ void sdrawXORline4(int nr, int x0, int y0, int x1, int y1)
 				flags[nr]= 0;
 			}
 		}
-	} else {
-		if(nr>=0 && nr<4) {
-			if(flags[nr]) {
+	}
+	else {
+		if (nr>=0 && nr<4) {
+			if (flags[nr]) {
 				glVertex2sv(old[nr][0]);
 				glVertex2sv(old[nr][1]);
 			}
@@ -338,7 +365,7 @@ void sdrawXORline4(int nr, int x0, int y0, int x1, int y1)
 
 void fdrawXORellipse(float xofs, float yofs, float hw, float hh)
 {
-	if(hw==0) return;
+	if (hw==0) return;
 
 	set_inverted_drawing(1);
 
@@ -410,7 +437,7 @@ void glaRasterPosSafe2f(float x, float y, float known_good_x, float known_good_y
 	GLubyte dummy= 0;
 
 		/* As long as known good coordinates are correct
-		 * this is guarenteed to generate an ok raster
+		 * this is guaranteed to generate an ok raster
 		 * position (ignoring potential (real) overflow
 		 * issues).
 		 */
@@ -501,28 +528,28 @@ void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format,
 			float rast_y= y+subpart_y*offset_y*yzoom;
 			
 			/* check if we already got these because we always get 2 more when doing seamless*/
-			if(subpart_w<=seamless || subpart_h<=seamless)
+			if (subpart_w<=seamless || subpart_h<=seamless)
 				continue;
 			
-			if(format==GL_FLOAT) {
+			if (format==GL_FLOAT) {
 				glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, subpart_w, subpart_h, GL_RGBA, GL_FLOAT, &f_rect[subpart_y*offset_y*img_w*4 + subpart_x*offset_x*4]);
 				
 				/* add an extra border of pixels so linear looks ok at edges of full image. */
-				if(subpart_w<tex_w)
+				if (subpart_w<tex_w)
 					glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, 0, 1, subpart_h, GL_RGBA, GL_FLOAT, &f_rect[subpart_y*offset_y*img_w*4 + (subpart_x*offset_x+subpart_w-1)*4]);
-				if(subpart_h<tex_h)
+				if (subpart_h<tex_h)
 					glTexSubImage2D(GL_TEXTURE_2D, 0, 0, subpart_h, subpart_w, 1, GL_RGBA, GL_FLOAT, &f_rect[(subpart_y*offset_y+subpart_h-1)*img_w*4 + subpart_x*offset_x*4]);
-				if(subpart_w<tex_w && subpart_h<tex_h)
+				if (subpart_w<tex_w && subpart_h<tex_h)
 					glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, subpart_h, 1, 1, GL_RGBA, GL_FLOAT, &f_rect[(subpart_y*offset_y+subpart_h-1)*img_w*4 + (subpart_x*offset_x+subpart_w-1)*4]);
 			}
 			else {
 				glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, subpart_w, subpart_h, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[subpart_y*offset_y*img_w*4 + subpart_x*offset_x*4]);
 				
-				if(subpart_w<tex_w)
+				if (subpart_w<tex_w)
 					glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, 0, 1, subpart_h, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[subpart_y*offset_y*img_w*4 + (subpart_x*offset_x+subpart_w-1)*4]);
-				if(subpart_h<tex_h)
+				if (subpart_h<tex_h)
 					glTexSubImage2D(GL_TEXTURE_2D, 0, 0, subpart_h, subpart_w, 1, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[(subpart_y*offset_y+subpart_h-1)*img_w*4 + subpart_x*offset_x*4]);
-				if(subpart_w<tex_w && subpart_h<tex_h)
+				if (subpart_w<tex_w && subpart_h<tex_h)
 					glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, subpart_h, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &uc_rect[(subpart_y*offset_y+subpart_h-1)*img_w*4 + (subpart_x*offset_x+subpart_w-1)*4]);
 			}
 
@@ -607,27 +634,28 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo
 			/* Don't use safe RasterPos (slower) if we can avoid it. */
 		if (rast_x>=0 && rast_y>=0) {
 			glRasterPos2f(rast_x, rast_y);
-		} else {
+		}
+		else {
 			glaRasterPosSafe2f(rast_x, rast_y, 0, 0);
 		}
 
 		glPixelStorei(GL_UNPACK_ROW_LENGTH, row_w);
-		if(format==GL_LUMINANCE || format==GL_RED) {
-			if(type==GL_FLOAT) {
+		if (format==GL_LUMINANCE || format==GL_RED) {
+			if (type==GL_FLOAT) {
 				float *f_rect= (float *)rect;
 				glDrawPixels(draw_w, draw_h, format, type, f_rect + (off_y*row_w + off_x));
 			}
-			else if(type==GL_INT || type==GL_UNSIGNED_INT) {
+			else if (type==GL_INT || type==GL_UNSIGNED_INT) {
 				int *i_rect= (int *)rect;
 				glDrawPixels(draw_w, draw_h, format, type, i_rect + (off_y*row_w + off_x));
 			}
 		}
 		else { /* RGBA */
-			if(type==GL_FLOAT) {
+			if (type==GL_FLOAT) {
 				float *f_rect= (float *)rect;
 				glDrawPixels(draw_w, draw_h, format, type, f_rect + (off_y*row_w + off_x)*4);
 			}
-			else if(type==GL_UNSIGNED_BYTE) {
+			else if (type==GL_UNSIGNED_BYTE) {
 				unsigned char *uc_rect= (unsigned char *) rect;
 				glDrawPixels(draw_w, draw_h, format, type, uc_rect + (off_y*row_w + off_x)*4);
 			}
@@ -662,6 +690,8 @@ void glaDefine2DArea(rcti *screen_rect)
 	glLoadIdentity();
 }
 
+#if 0 /* UNUSED */
+
 struct gla2DDrawInfo {
 	int orig_vp[4], orig_sc[4];
 	float orig_projmat[16], orig_viewmat[16];
@@ -693,7 +723,6 @@ void gla2DSetMap(gla2DDrawInfo *di, rctf *rect)
 	di->wo_to_sc[1]= sc_h/wo_h;
 }
 
-
 gla2DDrawInfo *glaBegin2DDraw(rcti *screen_rect, rctf *world_rect) 
 {
 	gla2DDrawInfo *di= MEM_mallocN(sizeof(*di), "gla2DDrawInfo");
@@ -708,11 +737,12 @@ gla2DDrawInfo *glaBegin2DDraw(rcti *screen_rect, rctf *world_rect)
 	di->screen_rect= *screen_rect;
 	if (world_rect) {
 		di->world_rect= *world_rect;
-	} else {
-		di->world_rect.xmin= di->screen_rect.xmin;
-		di->world_rect.ymin= di->screen_rect.ymin;
-		di->world_rect.xmax= di->screen_rect.xmax;
-		di->world_rect.ymax= di->screen_rect.ymax;
+	}
+	else {
+		di->world_rect.xmin = di->screen_rect.xmin;
+		di->world_rect.ymin = di->screen_rect.ymin;
+		di->world_rect.xmax = di->screen_rect.xmax;
+		di->world_rect.ymax = di->screen_rect.ymax;
 	}
 
 	sc_w= (di->screen_rect.xmax-di->screen_rect.xmin);
@@ -750,6 +780,7 @@ void glaEnd2DDraw(gla2DDrawInfo *di)
 
 	MEM_freeN(di);
 }
+#endif
 
 /* **************** glPoint hack ************************ */
 
@@ -764,37 +795,39 @@ void bglBegin(int mode)
 {
 	curmode= mode;
 	
-	if(mode==GL_POINTS) {
+	if (mode==GL_POINTS) {
 		float value[4];
 		glGetFloatv(GL_POINT_SIZE_RANGE, value);
-		if(value[1] < 2.0f) {
+		if (value[1] < 2.0f) {
 			glGetFloatv(GL_POINT_SIZE, value);
 			pointhack= floor(value[0] + 0.5f);
-			if(pointhack>4) pointhack= 4;
+			if (pointhack>4) pointhack= 4;
 		}
 		else glBegin(mode);
 	}
 }
 
+#if 0 /* UNUSED */
 int bglPointHack(void)
 {
 	float value[4];
 	int pointhack_px;
 	glGetFloatv(GL_POINT_SIZE_RANGE, value);
-	if(value[1] < 2.0f) {
+	if (value[1] < 2.0f) {
 		glGetFloatv(GL_POINT_SIZE, value);
 		pointhack_px= floorf(value[0]+0.5f);
-		if(pointhack_px>4) pointhack_px= 4;
+		if (pointhack_px>4) pointhack_px= 4;
 		return pointhack_px;
 	}
 	return 0;
 }
+#endif
 
-void bglVertex3fv(float *vec)
+void bglVertex3fv(const float vec[3])
 {
 	switch(curmode) {
 	case GL_POINTS:
-		if(pointhack) {
+		if (pointhack) {
 			glRasterPos3fv(vec);
 			glBitmap(pointhack, pointhack, (float)pointhack/2.0f, (float)pointhack/2.0f, 0.0, 0.0, Squaredot);
 		}
@@ -807,7 +840,7 @@ void bglVertex3f(float x, float y, float z)
 {
 	switch(curmode) {
 	case GL_POINTS:
-		if(pointhack) {
+		if (pointhack) {
 			glRasterPos3f(x, y, z);
 			glBitmap(pointhack, pointhack, (float)pointhack/2.0f, (float)pointhack/2.0f, 0.0, 0.0, Squaredot);
 		}
@@ -816,11 +849,11 @@ void bglVertex3f(float x, float y, float z)
 	}
 }
 
-void bglVertex2fv(float *vec)
+void bglVertex2fv(const float vec[2])
 {
 	switch(curmode) {
 	case GL_POINTS:
-		if(pointhack) {
+		if (pointhack) {
 			glRasterPos2fv(vec);
 			glBitmap(pointhack, pointhack, (float)pointhack/2, pointhack/2, 0.0, 0.0, Squaredot);
 		}
@@ -832,7 +865,7 @@ void bglVertex2fv(float *vec)
 
 void bglEnd(void)
 {
-	if(pointhack) pointhack= 0;
+	if (pointhack) pointhack= 0;
 	else glEnd();
 	
 }
@@ -847,11 +880,11 @@ void bgl_get_mats(bglMats *mats)
 	glGetIntegerv(GL_VIEWPORT, (GLint *)mats->viewport);
 	
 	/* Very strange code here - it seems that certain bad values in the
-	   modelview matrix can cause gluUnProject to give bad results. */
-	if(mats->modelview[0] < badvalue &&
+	 * modelview matrix can cause gluUnProject to give bad results. */
+	if (mats->modelview[0] < badvalue &&
 	   mats->modelview[0] > -badvalue)
 		mats->modelview[0]= 0;
-	if(mats->modelview[5] < badvalue &&
+	if (mats->modelview[5] < badvalue &&
 	   mats->modelview[5] > -badvalue)
 		mats->modelview[5]= 0;
 	
@@ -867,7 +900,7 @@ void bglPolygonOffset(float viewdist, float dist)
 {
 	static float winmat[16], offset=0.0;	
 	
-	if(dist != 0.0f) {
+	if (dist != 0.0f) {
 		float offs;
 		
 		// glEnable(GL_POLYGON_OFFSET_FILL);
@@ -879,7 +912,7 @@ void bglPolygonOffset(float viewdist, float dist)
 		
 		/* dist is from camera to center point */
 		
-		if(winmat[15]>0.5f) offs= 0.00001f*dist*viewdist;  // ortho tweaking
+		if (winmat[15]>0.5f) offs= 0.00001f*dist*viewdist;  // ortho tweaking
 		else offs= 0.0005f*dist;  // should be clipping value or so...
 		
 		winmat[14]-= offs;
@@ -898,12 +931,13 @@ void bglPolygonOffset(float viewdist, float dist)
 	}
 }
 
+#if 0 /* UNUSED */
 void bglFlush(void) 
 {
 	glFlush();
 #ifdef __APPLE__
-//	if(GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_MAC, GPU_DRIVER_OFFICIAL))
+//	if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_MAC, GPU_DRIVER_OFFICIAL))
 // XXX		myswapbuffers(); //hack to get mac intel graphics to show frontbuffer
 #endif
 }
-
+#endif
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c
index 9e2a2f5..9e04406 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@@ -87,20 +87,20 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
 	base= BASACT;
 #endif
 
-	if(CTX_data_dir(member)) {
+	if (CTX_data_dir(member)) {
 		CTX_data_dir_set(result, screen_context_dir);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "scene")) {
+	else if (CTX_data_equals(member, "scene")) {
 		CTX_data_id_pointer_set(result, &scene->id);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "visible_objects") || CTX_data_equals(member, "visible_bases")) {
+	else if (CTX_data_equals(member, "visible_objects") || CTX_data_equals(member, "visible_bases")) {
 		int visible_objects= CTX_data_equals(member, "visible_objects");
 
-		for(base=scene->base.first; base; base=base->next) {
-			if(((base->object->restrictflag & OB_RESTRICT_VIEW) == 0) && (base->lay & scene->lay)) {
-				if(visible_objects)
+		for (base=scene->base.first; base; base=base->next) {
+			if (((base->object->restrictflag & OB_RESTRICT_VIEW) == 0) && (base->lay & scene->lay)) {
+				if (visible_objects)
 					CTX_data_id_list_add(result, &base->object->id);
 				else
 					CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
@@ -109,13 +109,13 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
 		CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "selectable_objects") || CTX_data_equals(member, "selectable_bases")) {
+	else if (CTX_data_equals(member, "selectable_objects") || CTX_data_equals(member, "selectable_bases")) {
 		int selectable_objects= CTX_data_equals(member, "selectable_objects");
 
-		for(base=scene->base.first; base; base=base->next) {
-			if(base->lay & lay) {
-				if((base->object->restrictflag & OB_RESTRICT_VIEW)==0 && (base->object->restrictflag & OB_RESTRICT_SELECT)==0) {
-					if(selectable_objects)
+		for (base=scene->base.first; base; base=base->next) {
+			if (base->lay & lay) {
+				if ((base->object->restrictflag & OB_RESTRICT_VIEW)==0 && (base->object->restrictflag & OB_RESTRICT_SELECT)==0) {
+					if (selectable_objects)
 						CTX_data_id_list_add(result, &base->object->id);
 					else
 						CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
@@ -125,12 +125,12 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
 		CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "selected_objects") || CTX_data_equals(member, "selected_bases")) {
+	else if (CTX_data_equals(member, "selected_objects") || CTX_data_equals(member, "selected_bases")) {
 		int selected_objects= CTX_data_equals(member, "selected_objects");
 
-		for(base=scene->base.first; base; base=base->next) {
-			if((base->flag & SELECT) && (base->lay & scene->lay)) {
-				if(selected_objects)
+		for (base=scene->base.first; base; base=base->next) {
+			if ((base->flag & SELECT) && (base->lay & scene->lay)) {
+				if (selected_objects)
 					CTX_data_id_list_add(result, &base->object->id);
 				else
 					CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
@@ -139,14 +139,14 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
 		CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "selected_editable_objects") || CTX_data_equals(member, "selected_editable_bases")) {
+	else if (CTX_data_equals(member, "selected_editable_objects") || CTX_data_equals(member, "selected_editable_bases")) {
 		int selected_editable_objects= CTX_data_equals(member, "selected_editable_objects");
 
-		for(base=scene->base.first; base; base=base->next) {
-			if((base->flag & SELECT) && (base->lay & scene->lay)) {
-				if((base->object->restrictflag & OB_RESTRICT_VIEW)==0) {
-					if(0==object_is_libdata(base->object)) {
-						if(selected_editable_objects)
+		for (base=scene->base.first; base; base=base->next) {
+			if ((base->flag & SELECT) && (base->lay & scene->lay)) {
+				if ((base->object->restrictflag & OB_RESTRICT_VIEW)==0) {
+					if (0==object_is_libdata(base->object)) {
+						if (selected_editable_objects)
 							CTX_data_id_list_add(result, &base->object->id);
 						else
 							CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
@@ -157,7 +157,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
 		CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "visible_bones") || CTX_data_equals(member, "editable_bones")) {
+	else if (CTX_data_equals(member, "visible_bones") || CTX_data_equals(member, "editable_bones")) {
 		bArmature *arm= (obedit && obedit->type == OB_ARMATURE) ? obedit->data : NULL;
 		EditBone *ebone, *flipbone=NULL;
 		int editable_bones= CTX_data_equals(member, "editable_bones");
@@ -199,7 +199,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
 			return 1;
 		}
 	}
-	else if(CTX_data_equals(member, "selected_bones") || CTX_data_equals(member, "selected_editable_bones")) {
+	else if (CTX_data_equals(member, "selected_bones") || CTX_data_equals(member, "selected_editable_bones")) {
 		bArmature *arm= (obedit && obedit->type == OB_ARMATURE) ? obedit->data : NULL;
 		EditBone *ebone, *flipbone=NULL;
 		int selected_editable_bones= CTX_data_equals(member, "selected_editable_bones");
@@ -241,7 +241,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
 			return 1;
 		}
 	}
-	else if(CTX_data_equals(member, "visible_pose_bones")) {
+	else if (CTX_data_equals(member, "visible_pose_bones")) {
 		Object *obpose= object_pose_armature_get(obact);
 		bArmature *arm= (obpose) ? obpose->data : NULL;
 		bPoseChannel *pchan;
@@ -257,7 +257,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
 			return 1;
 		}
 	}
-	else if(CTX_data_equals(member, "selected_pose_bones")) {
+	else if (CTX_data_equals(member, "selected_pose_bones")) {
 		Object *obpose= object_pose_armature_get(obact);
 		bArmature *arm= (obpose) ? obpose->data : NULL;
 		bPoseChannel *pchan;
@@ -274,24 +274,24 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
 			return 1;
 		}
 	}
-	else if(CTX_data_equals(member, "active_bone")) {
-		if(obact && obact->type == OB_ARMATURE) {
+	else if (CTX_data_equals(member, "active_bone")) {
+		if (obact && obact->type == OB_ARMATURE) {
 			bArmature *arm= obact->data;
-			if(arm->edbo) {
-				if(arm->act_edbone) {
+			if (arm->edbo) {
+				if (arm->act_edbone) {
 					CTX_data_pointer_set(result, &arm->id, &RNA_EditBone, arm->act_edbone);
 					return 1;
 				}
 			}
 			else {
-				if(arm->act_bone) {
+				if (arm->act_bone) {
 					CTX_data_pointer_set(result, &arm->id, &RNA_Bone, arm->act_bone);
 					return 1;
 				}
 			}
 		}
 	}
-	else if(CTX_data_equals(member, "active_pose_bone")) {
+	else if (CTX_data_equals(member, "active_pose_bone")) {
 		bPoseChannel *pchan;
 		Object *obpose= object_pose_armature_get(obact);
 		
@@ -301,64 +301,64 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
 			return 1;
 		}
 	}
-	else if(CTX_data_equals(member, "active_base")) {
-		if(base)
+	else if (CTX_data_equals(member, "active_base")) {
+		if (base)
 			CTX_data_pointer_set(result, &scene->id, &RNA_ObjectBase, base);
 
 		return 1;
 	}
-	else if(CTX_data_equals(member, "active_object")) {
-		if(obact)
+	else if (CTX_data_equals(member, "active_object")) {
+		if (obact)
 			CTX_data_id_pointer_set(result, &obact->id);
 
 		return 1;
 	}
-	else if(CTX_data_equals(member, "object")) {
-		if(obact)
+	else if (CTX_data_equals(member, "object")) {
+		if (obact)
 			CTX_data_id_pointer_set(result, &obact->id);
 
 		return 1;
 	}
-	else if(CTX_data_equals(member, "edit_object")) {
+	else if (CTX_data_equals(member, "edit_object")) {
 		/* convenience for now, 1 object per scene in editmode */
-		if(obedit)
+		if (obedit)
 			CTX_data_id_pointer_set(result, &obedit->id);
 		
 		return 1;
 	}
-	else if(CTX_data_equals(member, "sculpt_object")) {
-		if(obact && (obact->mode & OB_MODE_SCULPT))
+	else if (CTX_data_equals(member, "sculpt_object")) {
+		if (obact && (obact->mode & OB_MODE_SCULPT))
 			CTX_data_id_pointer_set(result, &obact->id);
 
 		return 1;
 	}
-	else if(CTX_data_equals(member, "vertex_paint_object")) {
-		if(obact && (obact->mode & OB_MODE_VERTEX_PAINT))
+	else if (CTX_data_equals(member, "vertex_paint_object")) {
+		if (obact && (obact->mode & OB_MODE_VERTEX_PAINT))
 			CTX_data_id_pointer_set(result, &obact->id);
 
 		return 1;
 	}
-	else if(CTX_data_equals(member, "weight_paint_object")) {
-		if(obact && (obact->mode & OB_MODE_WEIGHT_PAINT))
+	else if (CTX_data_equals(member, "weight_paint_object")) {
+		if (obact && (obact->mode & OB_MODE_WEIGHT_PAINT))
 			CTX_data_id_pointer_set(result, &obact->id);
 
 		return 1;
 	}
-	else if(CTX_data_equals(member, "image_paint_object")) {
-		if(obact && (obact->mode & OB_MODE_TEXTURE_PAINT))
+	else if (CTX_data_equals(member, "image_paint_object")) {
+		if (obact && (obact->mode & OB_MODE_TEXTURE_PAINT))
 			CTX_data_id_pointer_set(result, &obact->id);
 
 		return 1;
 	}
-	else if(CTX_data_equals(member, "particle_edit_object")) {
-		if(obact && (obact->mode & OB_MODE_PARTICLE_EDIT))
+	else if (CTX_data_equals(member, "particle_edit_object")) {
+		if (obact && (obact->mode & OB_MODE_PARTICLE_EDIT))
 			CTX_data_id_pointer_set(result, &obact->id);
 
 		return 1;
 	}
-	else if(CTX_data_equals(member, "sequences")) {
+	else if (CTX_data_equals(member, "sequences")) {
 		Editing *ed= seq_give_editing(scene, FALSE);
-		if(ed) {
+		if (ed) {
 			Sequence *seq;
 			for (seq= ed->seqbasep->first; seq; seq= seq->next) {
 				CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq);
@@ -367,9 +367,9 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
 			return 1;
 		}
 	}
-	else if(CTX_data_equals(member, "selected_sequences")) {
+	else if (CTX_data_equals(member, "selected_sequences")) {
 		Editing *ed= seq_give_editing(scene, FALSE);
-		if(ed) {
+		if (ed) {
 			Sequence *seq;
 			for (seq= ed->seqbasep->first; seq; seq= seq->next) {
 				if (seq->flag & SELECT) {
@@ -380,9 +380,9 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
 			return 1;
 		}
 	}
-	else if(CTX_data_equals(member, "selected_editable_sequences")) {
+	else if (CTX_data_equals(member, "selected_editable_sequences")) {
 		Editing *ed= seq_give_editing(scene, FALSE);
-		if(ed) {
+		if (ed) {
 			Sequence *seq;
 			for (seq= ed->seqbasep->first; seq; seq= seq->next) {
 				if (seq->flag & SELECT && !(seq->flag & SEQ_LOCK)) {
@@ -393,11 +393,11 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
 			return 1;
 		}
 	}
-	else if(CTX_data_equals(member, "active_operator")) {
+	else if (CTX_data_equals(member, "active_operator")) {
 		wmOperator *op= NULL;
 
 		SpaceFile *sfile= CTX_wm_space_file(C);
-		if(sfile) {
+		if (sfile) {
 			op= sfile->op;
 		}
 		else if ((op= uiContextActiveOperator(C))) {
diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c
index 25b8b84..cafa452 100644
--- a/source/blender/editors/screen/screen_edit.c
+++ b/source/blender/editors/screen/screen_edit.c
@@ -111,7 +111,7 @@ ScrEdge *screen_findedge(bScreen *sc, ScrVert *v1, ScrVert *v2)
 	
 	sortscrvert(&v1, &v2);
 	for (se= sc->edgebase.first; se; se= se->next)
-		if(se->v1==v1 && se->v2==v2)
+		if (se->v1==v1 && se->v2==v2)
 			return se;
 	
 	return NULL;
@@ -124,12 +124,12 @@ void removedouble_scrverts(bScreen *sc)
 	ScrArea *sa;
 	
 	verg= sc->vertbase.first;
-	while(verg) {
-		if(verg->newv==NULL) {	/* !!! */
+	while (verg) {
+		if (verg->newv==NULL) {	/* !!! */
 			v1= verg->next;
-			while(v1) {
-				if(v1->newv==NULL) {	/* !?! */
-					if(v1->vec.x==verg->vec.x && v1->vec.y==verg->vec.y) {
+			while (v1) {
+				if (v1->newv==NULL) {	/* !?! */
+					if (v1->vec.x==verg->vec.x && v1->vec.y==verg->vec.y) {
 						/* printf("doublevert\n"); */
 						v1->newv= verg;
 					}
@@ -142,27 +142,27 @@ void removedouble_scrverts(bScreen *sc)
 
 	/* replace pointers in edges and faces */
 	se= sc->edgebase.first;
-	while(se) {
-		if(se->v1->newv) se->v1= se->v1->newv;
-		if(se->v2->newv) se->v2= se->v2->newv;
+	while (se) {
+		if (se->v1->newv) se->v1= se->v1->newv;
+		if (se->v2->newv) se->v2= se->v2->newv;
 		/* edges changed: so.... */
 		sortscrvert(&(se->v1), &(se->v2));
 		se= se->next;
 	}
 	sa= sc->areabase.first;
-	while(sa) {
-		if(sa->v1->newv) sa->v1= sa->v1->newv;
-		if(sa->v2->newv) sa->v2= sa->v2->newv;
-		if(sa->v3->newv) sa->v3= sa->v3->newv;
-		if(sa->v4->newv) sa->v4= sa->v4->newv;
+	while (sa) {
+		if (sa->v1->newv) sa->v1= sa->v1->newv;
+		if (sa->v2->newv) sa->v2= sa->v2->newv;
+		if (sa->v3->newv) sa->v3= sa->v3->newv;
+		if (sa->v4->newv) sa->v4= sa->v4->newv;
 		sa= sa->next;
 	}
 
 	/* remove */
 	verg= sc->vertbase.first;
-	while(verg) {
+	while (verg) {
 		v1= verg->next;
-		if(verg->newv) {
+		if (verg->newv) {
 			BLI_remlink(&sc->vertbase, verg);
 			MEM_freeN(verg);
 		}
@@ -179,16 +179,16 @@ void removenotused_scrverts(bScreen *sc)
 	/* we assume edges are ok */
 	
 	se= sc->edgebase.first;
-	while(se) {
+	while (se) {
 		se->v1->flag= 1;
 		se->v2->flag= 1;
 		se= se->next;
 	}
 	
 	sv= sc->vertbase.first;
-	while(sv) {
+	while (sv) {
 		svn= sv->next;
-		if(sv->flag==0) {
+		if (sv->flag==0) {
 			BLI_remlink(&sc->vertbase, sv);
 			MEM_freeN(sv);
 		}
@@ -203,11 +203,11 @@ void removedouble_scredges(bScreen *sc)
 	
 	/* compare */
 	verg= sc->edgebase.first;
-	while(verg) {
+	while (verg) {
 		se= verg->next;
-		while(se) {
+		while (se) {
 			sn= se->next;
-			if(verg->v1==se->v1 && verg->v2==se->v2) {
+			if (verg->v1==se->v1 && verg->v2==se->v2) {
 				BLI_remlink(&sc->edgebase, se);
 				MEM_freeN(se);
 			}
@@ -225,26 +225,26 @@ void removenotused_scredges(bScreen *sc)
 	
 	/* sets flags when edge is used in area */
 	sa= sc->areabase.first;
-	while(sa) {
+	while (sa) {
 		se= screen_findedge(sc, sa->v1, sa->v2);
-		if(se==NULL) printf("error: area %d edge 1 doesn't exist\n", a);
+		if (se==NULL) printf("error: area %d edge 1 doesn't exist\n", a);
 		else se->flag= 1;
 		se= screen_findedge(sc, sa->v2, sa->v3);
-		if(se==NULL) printf("error: area %d edge 2 doesn't exist\n", a);
+		if (se==NULL) printf("error: area %d edge 2 doesn't exist\n", a);
 		else se->flag= 1;
 		se= screen_findedge(sc, sa->v3, sa->v4);
-		if(se==NULL) printf("error: area %d edge 3 doesn't exist\n", a);
+		if (se==NULL) printf("error: area %d edge 3 doesn't exist\n", a);
 		else se->flag= 1;
 		se= screen_findedge(sc, sa->v4, sa->v1);
-		if(se==NULL) printf("error: area %d edge 4 doesn't exist\n", a);
+		if (se==NULL) printf("error: area %d edge 4 doesn't exist\n", a);
 		else se->flag= 1;
 		sa= sa->next;
 		a++;
 	}
 	se= sc->edgebase.first;
-	while(se) {
+	while (se) {
 		sen= se->next;
-		if(se->flag==0) {
+		if (se->flag==0) {
 			BLI_remlink(&sc->edgebase, se);
 			MEM_freeN(se);
 		}
@@ -320,18 +320,18 @@ static short testsplitpoint(ScrArea *sa, char dir, float fac)
 	short x, y;
 	
 	// area big enough?
-	if(dir=='v' && (sa->v4->vec.x- sa->v1->vec.x <= 2*AREAMINX)) return 0;
-	if(dir=='h' && (sa->v2->vec.y- sa->v1->vec.y <= 2*AREAMINY)) return 0;
+	if (dir=='v' && (sa->v4->vec.x- sa->v1->vec.x <= 2*AREAMINX)) return 0;
+	if (dir=='h' && (sa->v2->vec.y- sa->v1->vec.y <= 2*AREAMINY)) return 0;
 	
 	// to be sure
 	CLAMP(fac, 0.0f, 1.0f);
 	
-	if(dir=='h') {
+	if (dir=='h') {
 		y= sa->v1->vec.y+ fac*(sa->v2->vec.y- sa->v1->vec.y);
 		
-		if(y- sa->v1->vec.y < AREAMINY) 
+		if (y- sa->v1->vec.y < AREAMINY) 
 			y= sa->v1->vec.y+ AREAMINY;
-		else if(sa->v2->vec.y- y < AREAMINY) 
+		else if (sa->v2->vec.y- y < AREAMINY) 
 			y= sa->v2->vec.y- AREAMINY;
 		else y-= (y % AREAGRID);
 		
@@ -340,9 +340,9 @@ static short testsplitpoint(ScrArea *sa, char dir, float fac)
 	else {
 		x= sa->v1->vec.x+ fac*(sa->v4->vec.x- sa->v1->vec.x);
 		
-		if(x- sa->v1->vec.x < AREAMINX) 
+		if (x- sa->v1->vec.x < AREAMINX) 
 			x= sa->v1->vec.x+ AREAMINX;
-		else if(sa->v4->vec.x- x < AREAMINX) 
+		else if (sa->v4->vec.x- x < AREAMINX) 
 			x= sa->v4->vec.x- AREAMINX;
 		else x-= (x % AREAGRID);
 		
@@ -356,12 +356,12 @@ ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge)
 	ScrVert *sv1, *sv2;
 	short split;
 	
-	if(sa==NULL) return NULL;
+	if (sa==NULL) return NULL;
 	
 	split= testsplitpoint(sa, dir, fac);
-	if(split==0) return NULL;
+	if (split==0) return NULL;
 	
-	if(dir=='h') {
+	if (dir=='h') {
 		/* new vertices */
 		sv1= screen_addvert(sc, sa->v1->vec.x, split);
 		sv2= screen_addvert(sc, sa->v4->vec.x, split);
@@ -404,7 +404,7 @@ ScrArea *area_split(bScreen *sc, ScrArea *sa, char dir, float fac, int merge)
 	}
 	
 	/* remove double vertices en edges */
-	if(merge)
+	if (merge)
 		removedouble_scrverts(sc);
 	removedouble_scredges(sc);
 	removenotused_scredges(sc);
@@ -456,18 +456,18 @@ static void screen_copy(bScreen *to, bScreen *from)
 	to->regionbase.first= to->regionbase.last= NULL;
 	
 	s2= to->vertbase.first;
-	for(s1= from->vertbase.first; s1; s1= s1->next, s2= s2->next) {
+	for (s1= from->vertbase.first; s1; s1= s1->next, s2= s2->next) {
 		s1->newv= s2;
 	}
 	
-	for(se= to->edgebase.first; se; se= se->next) {
+	for (se= to->edgebase.first; se; se= se->next) {
 		se->v1= se->v1->newv;
 		se->v2= se->v2->newv;
 		sortscrvert(&(se->v1), &(se->v2));
 	}
 	
 	saf= from->areabase.first;
-	for(sa= to->areabase.first; sa; sa= sa->next, saf= saf->next) {
+	for (sa= to->areabase.first; sa; sa= sa->next, saf= saf->next) {
 		sa->v1= sa->v1->newv;
 		sa->v2= sa->v2->newv;
 		sa->v3= sa->v3->newv;
@@ -482,7 +482,7 @@ static void screen_copy(bScreen *to, bScreen *from)
 	}
 	
 	/* put at zero (needed?) */
-	for(s1= from->vertbase.first; s1; s1= s1->next)
+	for (s1= from->vertbase.first; s1; s1= s1->next)
 		s1->newv= NULL;
 
 }
@@ -496,7 +496,7 @@ int area_getorientation(ScrArea *sa, ScrArea *sb)
 	ScrVert *sav1, *sav2, *sav3, *sav4;
 	ScrVert *sbv1, *sbv2, *sbv3, *sbv4;
 
-	if(sa==NULL || sb==NULL) return -1;
+	if (sa==NULL || sb==NULL) return -1;
 
 	sav1= sa->v1;
 	sav2= sa->v2;
@@ -507,16 +507,16 @@ int area_getorientation(ScrArea *sa, ScrArea *sb)
 	sbv3= sb->v3;
 	sbv4= sb->v4;
 	
-	if(sav1==sbv4 && sav2==sbv3) { /* sa to right of sb = W */
+	if (sav1==sbv4 && sav2==sbv3) { /* sa to right of sb = W */
 		return 0;
 	}
-	else if(sav2==sbv1 && sav3==sbv4) { /* sa to bottom of sb = N */
+	else if (sav2==sbv1 && sav3==sbv4) { /* sa to bottom of sb = N */
 		return 1;
 	}
-	else if(sav3==sbv2 && sav4==sbv1) { /* sa to left of sb = E */
+	else if (sav3==sbv2 && sav4==sbv1) { /* sa to left of sb = E */
 		return 2;
 	}
-	else if(sav1==sbv2 && sav4==sbv3) { /* sa on top of sb = S*/
+	else if (sav1==sbv2 && sav4==sbv3) { /* sa on top of sb = S*/
 		return 3;
 	}
 	
@@ -524,14 +524,14 @@ int area_getorientation(ScrArea *sa, ScrArea *sb)
 }
 
 /* Helper function to join 2 areas, it has a return value, 0=failed 1=success
-* 	used by the split, join operators
-*/
+ * 	used by the split, join operators
+ */
 int screen_area_join(bContext *C, bScreen* scr, ScrArea *sa1, ScrArea *sa2) 
 {
 	int dir;
 	
 	dir = area_getorientation(sa1, sa2);
-	/*printf("dir is : %i \n", dir);*/
+	/*printf("dir is : %i\n", dir);*/
 	
 	if (dir < 0) {
 		if (sa1 ) sa1->flag &= ~AREA_FLAG_DRAWJOINFROM;
@@ -539,25 +539,25 @@ int screen_area_join(bContext *C, bScreen* scr, ScrArea *sa1, ScrArea *sa2)
 		return 0;
 	}
 	
-	if(dir == 0) {
+	if (dir == 0) {
 		sa1->v1= sa2->v1;
 		sa1->v2= sa2->v2;
 		screen_addedge(scr, sa1->v2, sa1->v3);
 		screen_addedge(scr, sa1->v1, sa1->v4);
 	}
-	else if(dir == 1) {
+	else if (dir == 1) {
 		sa1->v2= sa2->v2;
 		sa1->v3= sa2->v3;
 		screen_addedge(scr, sa1->v1, sa1->v2);
 		screen_addedge(scr, sa1->v3, sa1->v4);
 	}
-	else if(dir == 2) {
+	else if (dir == 2) {
 		sa1->v3= sa2->v3;
 		sa1->v4= sa2->v4;
 		screen_addedge(scr, sa1->v2, sa1->v3);
 		screen_addedge(scr, sa1->v1, sa1->v4);
 	}
-	else if(dir == 3) {
+	else if (dir == 3) {
 		sa1->v1= sa2->v1;
 		sa1->v4= sa2->v4;
 		screen_addedge(scr, sa1->v1, sa1->v2);
@@ -581,11 +581,11 @@ void select_connected_scredge(bScreen *sc, ScrEdge *edge)
 	/* select connected, only in the right direction */
 	/* 'dir' is the direction of EDGE */
 	
-	if(edge->v1->vec.x==edge->v2->vec.x) dir= 'v';
+	if (edge->v1->vec.x==edge->v2->vec.x) dir= 'v';
 	else dir= 'h';
 	
 	sv= sc->vertbase.first;
-	while(sv) {
+	while (sv) {
 		sv->flag = 0;
 		sv= sv->next;
 	}
@@ -594,16 +594,16 @@ void select_connected_scredge(bScreen *sc, ScrEdge *edge)
 	edge->v2->flag= 1;
 	
 	oneselected= 1;
-	while(oneselected) {
+	while (oneselected) {
 		se= sc->edgebase.first;
 		oneselected= 0;
-		while(se) {
-			if(se->v1->flag + se->v2->flag==1) {
-				if(dir=='h') if(se->v1->vec.y==se->v2->vec.y) {
+		while (se) {
+			if (se->v1->flag + se->v2->flag==1) {
+				if (dir=='h') if (se->v1->vec.y==se->v2->vec.y) {
 					se->v1->flag= se->v2->flag= 1;
 					oneselected= 1;
 				}
-					if(dir=='v') if(se->v1->vec.x==se->v2->vec.x) {
+					if (dir=='v') if (se->v1->vec.x==se->v2->vec.x) {
 						se->v1->flag= se->v2->flag= 1;
 						oneselected= 1;
 					}
@@ -625,7 +625,7 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey)
 	min[0]= min[1]= 10000.0f;
 	max[0]= max[1]= 0.0f;
 	
-	for(sv= sc->vertbase.first; sv; sv= sv->next) {
+	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);
@@ -633,7 +633,7 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey)
 	}
 	
 	/* always make 0.0 left under */
-	for(sv= sc->vertbase.first; sv; sv= sv->next) {
+	for (sv= sc->vertbase.first; sv; sv= sv->next) {
 		sv->vec.x -= min[0];
 		sv->vec.y -= min[1];
 	}
@@ -641,15 +641,15 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey)
 	sizex= max[0]-min[0];
 	sizey= max[1]-min[1];
 	
-	if(sizex!= winsizex || sizey!= winsizey) {
+	if (sizex!= winsizex || sizey!= winsizey) {
 		facx= winsizex;
 		facx/= (float)sizex;
 		facy= winsizey;
 		facy/= (float)sizey;
 		
 		/* make sure it fits! */
-		for(sv= sc->vertbase.first; sv; sv= sv->next) {
-			/* FIXME, this resizing logic is no good when resizing the window + redrawing [#24428]
+		for (sv= sc->vertbase.first; sv; sv= sv->next) {
+			/* FIXME, this re-sizing logic is no good when re-sizing the window + redrawing [#24428]
 			 * need some way to store these as floats internally and re-apply from there. */
 			tempf= ((float)sv->vec.x)*facx;
 			sv->vec.x= (short)(tempf+0.5f);
@@ -671,13 +671,13 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey)
 	/* ton: removed option now, it needs Context... */
 	
 	/* make each window at least ED_area_headersize() high */
-	for(sa= sc->areabase.first; sa; sa= sa->next) {
+	for (sa= sc->areabase.first; sa; sa= sa->next) {
 		int headery= ED_area_headersize()+1;
 		
-		if(sa->v1->vec.y+headery > sa->v2->vec.y) {
+		if (sa->v1->vec.y+headery > sa->v2->vec.y) {
 			/* lower edge */
 			ScrEdge *se= screen_findedge(sc, sa->v4, sa->v1);
-			if(se && sa->v1!=sa->v2 ) {
+			if (se && sa->v1!=sa->v2 ) {
 				int yval;
 				
 				select_connected_scredge(sc, se);
@@ -685,10 +685,10 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey)
 				/* all selected vertices get the right offset */
 				yval= sa->v2->vec.y-headery;
 				sv= sc->vertbase.first;
-				while(sv) {
+				while (sv) {
 					/* if is a collapsed area */
-					if(sv!=sa->v2 && sv!=sa->v3) {
-						if(sv->flag) sv->vec.y= yval;
+					if (sv!=sa->v2 && sv!=sa->v3) {
+						if (sv->flag) sv->vec.y= yval;
 					}
 					sv= sv->next;
 				}
@@ -704,7 +704,7 @@ static void screen_test_scale(bScreen *sc, int winsizex, int winsizey)
 #define SCR_BACK 0.55
 #define SCR_ROUND 12
 
-/* draw vertical shape visualising future joining (left as well
+/* draw vertical shape visualizing future joining (left as well
  * right direction of future joining) */
 static void draw_horizontal_join_shape(ScrArea *sa, char dir)
 {
@@ -714,7 +714,7 @@ static void draw_horizontal_join_shape(ScrArea *sa, char dir)
 	float width = sa->v3->vec.x - sa->v1->vec.x;
 	float height = sa->v3->vec.y - sa->v1->vec.y;
 
-	if(height<width) {
+	if (height<width) {
 		h = height/8;
 		w = height/4;
 	}
@@ -753,10 +753,10 @@ static void draw_horizontal_join_shape(ScrArea *sa, char dir)
 	points[9].x = sa->v4->vec.x;
 	points[9].y = sa->v4->vec.y + height/2 + h;
 
-	if(dir=='l') {
+	if (dir=='l') {
 		/* when direction is left, then we flip direction of arrow */
 		float cx = sa->v1->vec.x + width;
-		for(i=0;i<10;i++) {
+		for (i=0;i<10;i++) {
 			points[i].x -= cx;
 			points[i].x = -points[i].x;
 			points[i].x += sa->v1->vec.x;
@@ -764,11 +764,11 @@ static void draw_horizontal_join_shape(ScrArea *sa, char dir)
 	}
 
 	glBegin(GL_POLYGON);
-	for(i=0;i<5;i++)
+	for (i=0;i<5;i++)
 		glVertex2f(points[i].x, points[i].y);
 	glEnd();
 	glBegin(GL_POLYGON);
-	for(i=4;i<8;i++)
+	for (i=4;i<8;i++)
 		glVertex2f(points[i].x, points[i].y);
 	glVertex2f(points[0].x, points[0].y);
 	glEnd();
@@ -777,7 +777,7 @@ static void draw_horizontal_join_shape(ScrArea *sa, char dir)
 	glRectf(points[6].x, points[6].y, points[9].x, points[9].y);
 }
 
-/* draw vertical shape visualising future joining (up/down direction) */
+/* draw vertical shape visualizing future joining (up/down direction) */
 static void draw_vertical_join_shape(ScrArea *sa, char dir)
 {
 	vec2f points[10];
@@ -786,7 +786,7 @@ static void draw_vertical_join_shape(ScrArea *sa, char dir)
 	float width = sa->v3->vec.x - sa->v1->vec.x;
 	float height = sa->v3->vec.y - sa->v1->vec.y;
 
-	if(height<width) {
+	if (height<width) {
 		h = height/4;
 		w = height/8;
 	}
@@ -825,10 +825,10 @@ static void draw_vertical_join_shape(ScrArea *sa, char dir)
 	points[9].x = sa->v1->vec.x + width/2 + w;
 	points[9].y = sa->v1->vec.y;
 
-	if(dir=='u') {
+	if (dir=='u') {
 		/* when direction is up, then we flip direction of arrow */
 		float cy = sa->v1->vec.y + height;
-		for(i=0;i<10;i++) {
+		for (i=0;i<10;i++) {
 			points[i].y -= cy;
 			points[i].y = -points[i].y;
 			points[i].y += sa->v1->vec.y;
@@ -836,11 +836,11 @@ static void draw_vertical_join_shape(ScrArea *sa, char dir)
 	}
 
 	glBegin(GL_POLYGON);
-	for(i=0;i<5;i++)
+	for (i=0;i<5;i++)
 		glVertex2f(points[i].x, points[i].y);
 	glEnd();
 	glBegin(GL_POLYGON);
-	for(i=4;i<8;i++)
+	for (i=4;i<8;i++)
 		glVertex2f(points[i].x, points[i].y);
 	glVertex2f(points[0].x, points[0].y);
 	glEnd();
@@ -852,7 +852,7 @@ static void draw_vertical_join_shape(ScrArea *sa, char dir)
 /* draw join shape due to direction of joining */
 static void draw_join_shape(ScrArea *sa, char dir)
 {
-	if(dir=='u' || dir=='d')
+	if (dir=='u' || dir=='d')
 		draw_vertical_join_shape(sa, dir);
 	else
 		draw_horizontal_join_shape(sa, dir);
@@ -883,19 +883,19 @@ static void scrarea_draw_shape_light(ScrArea *sa, char UNUSED(dir))
 static void drawscredge_area_draw(int sizex, int sizey, short x1, short y1, short x2, short y2, short a) 
 {
 	/* right border area */
-	if(x2<sizex-1)
+	if (x2<sizex-1)
 		sdrawline(x2+a, y1, x2+a, y2);
 	
 	/* left border area */
-	if(x1>0)  /* otherwise it draws the emboss of window over */
+	if (x1>0)  /* otherwise it draws the emboss of window over */
 		sdrawline(x1+a, y1, x1+a, y2);
 	
 	/* top border area */
-	if(y2<sizey-1)
+	if (y2<sizey-1)
 		sdrawline(x1, y2+a, x2, y2+a);
 	
 	/* bottom border area */
-	if(y1>0)
+	if (y1>0)
 		sdrawline(x1, y1+a, x2, y1+a);
 	
 }
@@ -911,10 +911,10 @@ static void drawscredge_area(ScrArea *sa, int sizex, int sizey, int center)
 	
 	rt= 0; // CLAMPIS(G.rt, 0, 16);
 	
-	if(center==0) {
+	if (center==0) {
 		cpack(0x505050);
-		for(a=-rt; a<=rt; a++)
-			if(a!=0)
+		for (a=-rt; a<=rt; a++)
+			if (a!=0)
 				drawscredge_area_draw(sizex, sizey, x1, y1, x2, y2, a);
 	}
 	else {
@@ -929,7 +929,7 @@ bScreen *ED_screen_duplicate(wmWindow *win, bScreen *sc)
 {
 	bScreen *newsc;
 	
-	if(sc->full != SCREENNORMAL) return NULL; /* XXX handle this case! */
+	if (sc->full != SCREENNORMAL) return NULL; /* XXX handle this case! */
 	
 	/* make new empty screen: */
 	newsc= ED_screen_add(win, sc->scene, sc->id.name+2);
@@ -944,11 +944,11 @@ static void region_cursor_set(wmWindow *win, int swinid)
 {
 	ScrArea *sa= win->screen->areabase.first;
 	
-	for(;sa; sa= sa->next) {
+	for (;sa; sa= sa->next) {
 		ARegion *ar= sa->regionbase.first;
-		for(;ar; ar= ar->next) {
-			if(ar->swinid == swinid) {
-				if(ar->type && ar->type->cursor)
+		for (;ar; ar= ar->next) {
+			if (ar->swinid == swinid) {
+				if (ar->type && ar->type->cursor)
 					ar->type->cursor(win, sa, ar);
 				else
 					WM_cursor_set(win, CURSOR_STD);
@@ -965,20 +965,20 @@ void ED_screen_do_listen(bContext *C, wmNotifier *note)
 	/* generic notes */
 	switch(note->category) {
 		case NC_WM:
-			if(note->data==ND_FILEREAD)
+			if (note->data==ND_FILEREAD)
 				win->screen->do_draw= 1;
 			break;
 		case NC_WINDOW:
 			win->screen->do_draw= 1;
 			break;
 		case NC_SCREEN:
-			if(note->data==ND_SUBWINACTIVE)
+			if (note->data==ND_SUBWINACTIVE)
 				uiFreeActiveButtons(C, win->screen);
-			if(note->action==NA_EDITED)
+			if (note->action==NA_EDITED)
 				win->screen->do_draw= win->screen->do_refresh= 1;
 			break;
 		case NC_SCENE:
-			if(note->data==ND_MODE)
+			if (note->data==ND_MODE)
 				region_cursor_set(win, note->swinid);				
 			break;
 	}
@@ -996,13 +996,13 @@ void ED_screen_draw(wmWindow *win)
 
 	wmSubWindowSet(win, win->screen->mainwin);
 	
-	for(sa= win->screen->areabase.first; sa; sa= sa->next) {
+	for (sa= win->screen->areabase.first; sa; sa= sa->next) {
 		if (sa->flag & AREA_FLAG_DRAWJOINFROM) sa1 = sa;
 		if (sa->flag & AREA_FLAG_DRAWJOINTO) sa2 = sa;
 		if (sa->flag & (AREA_FLAG_DRAWSPLIT_H|AREA_FLAG_DRAWSPLIT_V)) sa3 = sa;
 		drawscredge_area(sa, win->sizex, win->sizey, 0);
 	}
-	for(sa= win->screen->areabase.first; sa; sa= sa->next)
+	for (sa= win->screen->areabase.first; sa; sa= sa->next)
 		drawscredge_area(sa, win->sizex, win->sizey, 1);
 	
 	/* blended join arrow */
@@ -1033,11 +1033,11 @@ void ED_screen_draw(wmWindow *win)
 	}
 	
 	/* splitpoint */
-	if(sa3) {
+	if (sa3) {
 		glEnable(GL_BLEND);
 		glColor4ub(255, 255, 255, 100);
 		
-		if(sa3->flag & AREA_FLAG_DRAWSPLIT_H) {
+		if (sa3->flag & AREA_FLAG_DRAWSPLIT_H) {
 			sdrawline(sa3->totrct.xmin, win->eventstate->y, sa3->totrct.xmax, win->eventstate->y);
 			glColor4ub(0, 0, 0, 100);
 			sdrawline(sa3->totrct.xmin, win->eventstate->y+1, sa3->totrct.xmax, win->eventstate->y+1);
@@ -1060,9 +1060,9 @@ static void screen_refresh_headersizes(void)
 	const ListBase *lb= BKE_spacetypes_list();
 	SpaceType *st;
 	
-	for(st= lb->first; st; st= st->next) {
+	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();
+		if (art) art->prefsizey= ED_area_headersize();
 	}		
 }
 
@@ -1075,14 +1075,14 @@ void ED_screen_refresh(wmWindowManager *wm, wmWindow *win)
 		ScrArea *sa;
 		rcti winrct;
 	
-		winrct.xmin= 0;
-		winrct.xmax= win->sizex-1;
-		winrct.ymin= 0;
-		winrct.ymax= win->sizey-1;
+		winrct.xmin = 0;
+		winrct.xmax = win->sizex-1;
+		winrct.ymin = 0;
+		winrct.ymax = win->sizey-1;
 		
 		screen_test_scale(win->screen, win->sizex, win->sizey);
 		
-		if(win->screen->mainwin==0)
+		if (win->screen->mainwin==0)
 			win->screen->mainwin= wm_subwindow_open(win, &winrct);
 		else
 			wm_subwindow_position(win, win->screen->mainwin, &winrct);
@@ -1090,18 +1090,20 @@ void ED_screen_refresh(wmWindowManager *wm, wmWindow *win)
 		/* header size depends on DPI, let's verify */
 		screen_refresh_headersizes();
 		
-		for(sa= win->screen->areabase.first; sa; sa= sa->next) {
+		for (sa= win->screen->areabase.first; sa; sa= sa->next) {
 			/* set spacetype and region callbacks, calls init() */
 			/* sets subwindows for regions, adds handlers */
 			ED_area_initialize(wm, win, sa);
 		}
 	
 		/* wake up animtimer */
-		if(win->screen->animtimer)
+		if (win->screen->animtimer)
 			WM_event_timer_sleep(wm, win, win->screen->animtimer, 0);
 	}
 
-	if(G.f & G_DEBUG) printf("set screen\n");
+	if (G.debug & G_DEBUG_EVENTS) {
+		printf("%s: set screen\n", __func__);
+	}
 	win->screen->do_refresh= 0;
 
 	win->screen->context= ed_screen_context;
@@ -1112,9 +1114,9 @@ void ED_screens_initialize(wmWindowManager *wm)
 {
 	wmWindow *win;
 	
-	for(win= wm->windows.first; win; win= win->next) {
+	for (win= wm->windows.first; win; win= win->next) {
 		
-		if(win->screen==NULL)
+		if (win->screen==NULL)
 			win->screen= G.main->screen.first;
 		
 		ED_screen_refresh(wm, win);
@@ -1130,11 +1132,11 @@ void ED_region_exit(bContext *C, ARegion *ar)
 
 	CTX_wm_region_set(C, ar);
 	WM_event_remove_handlers(C, &ar->handlers);
-	if(ar->swinid)
+	if (ar->swinid)
 		wm_subwindow_close(CTX_wm_window(C), ar->swinid);
 	ar->swinid= 0;
 	
-	if(ar->headerstr)
+	if (ar->headerstr)
 		MEM_freeN(ar->headerstr);
 	ar->headerstr= NULL;
 	
@@ -1148,13 +1150,16 @@ void ED_area_exit(bContext *C, ScrArea *sa)
 
 	if (sa->spacetype == SPACE_FILE) {
 		SpaceLink *sl= sa->spacedata.first;
-		if(sl && sl->spacetype == SPACE_FILE) {
+		if (sl && sl->spacetype == SPACE_FILE) {
 			ED_fileselect_exit(C, (SpaceFile *)sl);
 		}
 	}
+	else if (sa->spacetype == SPACE_VIEW3D) {
+		ED_render_engine_area_exit(sa);
+	}
 
 	CTX_wm_area_set(C, sa);
-	for(ar= sa->regionbase.first; ar; ar= ar->next)
+	for (ar= sa->regionbase.first; ar; ar= ar->next)
 		ED_region_exit(C, ar);
 
 	WM_event_remove_handlers(C, &sa->handlers);
@@ -1170,19 +1175,19 @@ void ED_screen_exit(bContext *C, wmWindow *window, bScreen *screen)
 
 	CTX_wm_window_set(C, window);
 	
-	if(screen->animtimer)
+	if (screen->animtimer)
 		WM_event_remove_timer(wm, window, screen->animtimer);
 	screen->animtimer= NULL;
 	
-	if(screen->mainwin)
+	if (screen->mainwin)
 		wm_subwindow_close(window, screen->mainwin);
 	screen->mainwin= 0;
 	screen->subwinactive= 0;
 	
-	for(ar= screen->regionbase.first; ar; ar= ar->next)
+	for (ar= screen->regionbase.first; ar; ar= ar->next)
 		ED_region_exit(C, ar);
 
-	for(sa= screen->areabase.first; sa; sa= sa->next)
+	for (sa= screen->areabase.first; sa; sa= sa->next)
 		ED_area_exit(C, sa);
 
 	/* mark it available for use for other windows */
@@ -1191,7 +1196,8 @@ void ED_screen_exit(bContext *C, wmWindow *window, bScreen *screen)
 	if (prevwin->screen->temp == 0) {
 		/* use previous window if possible */
 		CTX_wm_window_set(C, prevwin);
-	} else {
+	}
+	else {
 		/* none otherwise */
 		CTX_wm_window_set(C, NULL);
 	}
@@ -1206,15 +1212,15 @@ static void screen_cursor_set(wmWindow *win, wmEvent *event)
 	AZone *az= NULL;
 	ScrArea *sa;
 	
-	for(sa= win->screen->areabase.first; sa; sa= sa->next)
-		if((az=is_in_area_actionzone(sa, event->x, event->y)))
+	for (sa= win->screen->areabase.first; sa; sa= sa->next)
+		if ((az=is_in_area_actionzone(sa, event->x, event->y)))
 			break;
 	
-	if(sa) {
-		if(az->type==AZONE_AREA)
+	if (sa) {
+		if (az->type==AZONE_AREA)
 			WM_cursor_set(win, CURSOR_EDIT);
-		else if(az->type==AZONE_REGION) {
-			if(az->edge == AE_LEFT_TO_TOPRIGHT || az->edge == AE_RIGHT_TO_TOPLEFT)
+		else if (az->type==AZONE_REGION) {
+			if (az->edge == AE_LEFT_TO_TOPRIGHT || az->edge == AE_RIGHT_TO_TOPLEFT)
 				WM_cursor_set(win, CURSOR_X_MOVE);
 			else
 				WM_cursor_set(win, CURSOR_Y_MOVE);
@@ -1224,7 +1230,7 @@ static void screen_cursor_set(wmWindow *win, wmEvent *event)
 		ScrEdge *actedge= screen_find_active_scredge(win->screen, event->x, event->y);
 		
 		if (actedge) {
-			if(scredge_is_horizontal(actedge))
+			if (scredge_is_horizontal(actedge))
 				WM_cursor_set(win, CURSOR_Y_MOVE);
 			else
 				WM_cursor_set(win, CURSOR_X_MOVE);
@@ -1241,21 +1247,21 @@ void ED_screen_set_subwinactive(bContext *C, wmEvent *event)
 {
 	wmWindow *win= CTX_wm_window(C);
 	
-	if(win->screen) {
+	if (win->screen) {
 		bScreen *scr= win->screen;
 		ScrArea *sa;
 		ARegion *ar;
 		int oldswin= scr->subwinactive;
 
-		for(sa= scr->areabase.first; sa; sa= sa->next) {
-			if(event->x > sa->totrct.xmin && event->x < sa->totrct.xmax)
-				if(event->y > sa->totrct.ymin && event->y < sa->totrct.ymax)
-					if(NULL==is_in_area_actionzone(sa, event->x, event->y))
+		for (sa= scr->areabase.first; sa; sa= sa->next) {
+			if (event->x > sa->totrct.xmin && event->x < sa->totrct.xmax)
+				if (event->y > sa->totrct.ymin && event->y < sa->totrct.ymax)
+					if (NULL==is_in_area_actionzone(sa, event->x, event->y))
 						break;
 		}
-		if(sa) {
-			for(ar= sa->regionbase.first; ar; ar= ar->next) {
-				if(BLI_in_rcti(&ar->winrct, event->x, event->y))
+		if (sa) {
+			for (ar= sa->regionbase.first; ar; ar= ar->next) {
+				if (BLI_in_rcti(&ar->winrct, event->x, event->y))
 					scr->subwinactive= ar->swinid;
 			}
 		}
@@ -1263,28 +1269,28 @@ void ED_screen_set_subwinactive(bContext *C, wmEvent *event)
 			scr->subwinactive= scr->mainwin;
 		
 		/* check for redraw headers */
-		if(oldswin!=scr->subwinactive) {
+		if (oldswin!=scr->subwinactive) {
 
-			for(sa= scr->areabase.first; sa; sa= sa->next) {
+			for (sa= scr->areabase.first; sa; sa= sa->next) {
 				int do_draw= 0;
 				
-				for(ar= sa->regionbase.first; ar; ar= ar->next)
-					if(ar->swinid==oldswin || ar->swinid==scr->subwinactive)
+				for (ar= sa->regionbase.first; ar; ar= ar->next)
+					if (ar->swinid==oldswin || ar->swinid==scr->subwinactive)
 						do_draw= 1;
 				
-				if(do_draw) {
-					for(ar= sa->regionbase.first; ar; ar= ar->next)
-						if(ar->regiontype==RGN_TYPE_HEADER)
+				if (do_draw) {
+					for (ar= sa->regionbase.first; ar; ar= ar->next)
+						if (ar->regiontype==RGN_TYPE_HEADER)
 							ED_region_tag_redraw(ar);
 				}
 			}
 		}
 		
 		/* cursors, for time being set always on edges, otherwise aregion doesnt switch */
-		if(scr->subwinactive==scr->mainwin) {
+		if (scr->subwinactive==scr->mainwin) {
 			screen_cursor_set(win, event);
 		}
-		else if(oldswin!=scr->subwinactive) {
+		else if (oldswin!=scr->subwinactive) {
 			region_cursor_set(win, scr->subwinactive);
 			WM_event_add_notifier(C, NC_SCREEN|ND_SUBWINACTIVE, scr);
 		}
@@ -1297,15 +1303,15 @@ int ED_screen_area_active(const bContext *C)
 	bScreen *sc= CTX_wm_screen(C);
 	ScrArea *sa= CTX_wm_area(C);
 
-	if(win && sc && sa) {
+	if (win && sc && sa) {
 		AZone *az= is_in_area_actionzone(sa, win->eventstate->x, win->eventstate->y);
 		ARegion *ar;
 		
 		if (az && az->type == AZONE_REGION)
 			return 1;
 		
-		for(ar= sa->regionbase.first; ar; ar= ar->next)
-			if(ar->swinid == sc->subwinactive)
+		for (ar= sa->regionbase.first; ar; ar= ar->next)
+			if (ar->swinid == sc->subwinactive)
 				return 1;
 	}	
 	return 0;
@@ -1321,21 +1327,21 @@ void ED_screen_set(bContext *C, bScreen *sc)
 	ID *id;
 	
 	/* validate screen, it's called with notifier reference */
-	for(id= CTX_data_main(C)->screen.first; id; id= id->next)
-		if(sc == (bScreen *)id)
+	for (id= CTX_data_main(C)->screen.first; id; id= id->next)
+		if (sc == (bScreen *)id)
 			break;
-	if(id==NULL) 
+	if (id==NULL) 
 		return;
 	
 	/* check for valid winid */
-	if(sc->winid!=0 && sc->winid!=win->winid)
+	if (sc->winid!=0 && sc->winid!=win->winid)
 		return;
 	
-	if(sc->full) {				/* find associated full */
+	if (sc->full) {				/* find associated full */
 		bScreen *sc1;
-		for(sc1= CTX_data_main(C)->screen.first; sc1; sc1= sc1->id.next) {
+		for (sc1= CTX_data_main(C)->screen.first; sc1; sc1= sc1->id.next) {
 			ScrArea *sa= sc1->areabase.first;
-			if(sa->full==sc) {
+			if (sa->full==sc) {
 				sc= sc1;
 				break;
 			}
@@ -1347,13 +1353,13 @@ void ED_screen_set(bContext *C, bScreen *sc)
 		ScrArea *sa;
 
 		/* remove handlers referencing areas in old screen */
-		for(sa = oldscreen->areabase.first; sa; sa = sa->next) {
+		for (sa = oldscreen->areabase.first; sa; sa = sa->next) {
 			WM_event_remove_area_handler(&win->modalhandlers, sa);
 		}
 
 		/* we put timer to sleep, so screen_exit has to think there's no timer */
 		oldscreen->animtimer= NULL;
-		if(wt)
+		if (wt)
 			WM_event_timer_sleep(wm, win, wt, 1);
 		
 		ED_screen_exit(C, win, oldscreen);
@@ -1378,8 +1384,8 @@ static int ed_screen_used(wmWindowManager *wm, bScreen *sc)
 {
 	wmWindow *win;
 
-	for(win=wm->windows.first; win; win=win->next)
-		if(win->screen == sc)
+	for (win=wm->windows.first; win; win=win->next)
+		if (win->screen == sc)
 			return 1;
 	
 	return 0;
@@ -1401,44 +1407,47 @@ void ED_screen_delete(bContext *C, bScreen *sc)
 	
 		
 	/* screen can only be in use by one window at a time, so as
-	   long as we are able to find a screen that is unused, we
-	   can safely assume ours is not in use anywhere an delete it */
+	 * long as we are able to find a screen that is unused, we
+	 * can safely assume ours is not in use anywhere an delete it */
 
-	for(newsc= sc->id.prev; newsc; newsc=newsc->id.prev)
-		if(!ed_screen_used(wm, newsc))
+	for (newsc= sc->id.prev; newsc; newsc=newsc->id.prev)
+		if (!ed_screen_used(wm, newsc))
 			break;
 	
-	if(!newsc) {
-		for(newsc= sc->id.next; newsc; newsc=newsc->id.next)
-			if(!ed_screen_used(wm, newsc))
+	if (!newsc) {
+		for (newsc= sc->id.next; newsc; newsc=newsc->id.next)
+			if (!ed_screen_used(wm, newsc))
 				break;
 	}
 
-	if(!newsc)
+	if (!newsc)
 		return;
 
 	ED_screen_set(C, newsc);
 
-	if(delete && win->screen != sc)
+	if (delete && win->screen != sc)
 		free_libblock(&bmain->screen, sc);
 }
 
 /* only call outside of area/region loops */
-void ED_screen_set_scene(bContext *C, Scene *scene)
+void ED_screen_set_scene(bContext *C, bScreen *screen, Scene *scene)
 {
 	Main *bmain= CTX_data_main(C);
 	bScreen *sc;
-	bScreen *curscreen= CTX_wm_screen(C);
+
+	if (screen == NULL)
+		return;
 	
-	ED_object_exit_editmode(C, EM_FREEDATA|EM_DO_UNDO);
+	if (ed_screen_used(CTX_wm_manager(C), screen))
+		ED_object_exit_editmode(C, EM_FREEDATA|EM_DO_UNDO);
 
-	for(sc= CTX_data_main(C)->screen.first; sc; sc= sc->id.next) {
-		if((U.flag & USER_SCENEGLOBAL) || sc==curscreen) {
+	for (sc= CTX_data_main(C)->screen.first; sc; sc= sc->id.next) {
+		if ((U.flag & USER_SCENEGLOBAL) || sc==screen) {
 			
-			if(scene != sc->scene) {
+			if (scene != sc->scene) {
 				/* all areas endlocalview */
 			// XXX	ScrArea *sa= sc->areabase.first;
-			//	while(sa) {
+			//	while (sa) {
 			//		endlocalview(sa);
 			//		sa= sa->next;
 			//	}		
@@ -1451,13 +1460,13 @@ void ED_screen_set_scene(bContext *C, Scene *scene)
 	//  copy_view3d_lock(0);	/* space.c */
 	
 	/* are there cameras in the views that are not in the scene? */
-	for(sc= CTX_data_main(C)->screen.first; sc; sc= sc->id.next) {
-		if( (U.flag & USER_SCENEGLOBAL) || sc==curscreen) {
+	for (sc= CTX_data_main(C)->screen.first; sc; sc= sc->id.next) {
+		if ( (U.flag & USER_SCENEGLOBAL) || sc==screen) {
 			ScrArea *sa= sc->areabase.first;
-			while(sa) {
+			while (sa) {
 				SpaceLink *sl= sa->spacedata.first;
-				while(sl) {
-					if(sl->spacetype==SPACE_VIEW3D) {
+				while (sl) {
+					if (sl->spacetype==SPACE_VIEW3D) {
 						View3D *v3d= (View3D*) sl;
 
 						BKE_screen_view3d_sync(v3d, scene);
@@ -1467,11 +1476,11 @@ void ED_screen_set_scene(bContext *C, Scene *scene)
 							// XXX if (sc==curscreen) handle_view3d_lock();
 							if (!v3d->camera) {
 								ARegion *ar;
-								for(ar=v3d->regionbase.first; ar; ar= ar->next) {
-									if(ar->regiontype == RGN_TYPE_WINDOW) {
+								for (ar=v3d->regionbase.first; ar; ar= ar->next) {
+									if (ar->regiontype == RGN_TYPE_WINDOW) {
 										RegionView3D *rv3d= ar->regiondata;
 
-										if(rv3d->persp==RV3D_CAMOB)
+										if (rv3d->persp==RV3D_CAMOB)
 											rv3d->persp= RV3D_PERSP;
 									}
 								}
@@ -1489,7 +1498,7 @@ void ED_screen_set_scene(bContext *C, Scene *scene)
 	set_scene_bg(bmain, scene);
 	
 	ED_render_engine_changed(bmain);
-	ED_update_for_newframe(bmain, scene, curscreen, 1);
+	ED_update_for_newframe(bmain, scene, screen, 1);
 	
 	/* complete redraw */
 	WM_event_add_notifier(C, NC_WINDOW, NULL);
@@ -1502,14 +1511,14 @@ void ED_screen_delete_scene(bContext *C, Scene *scene)
 	Main *bmain= CTX_data_main(C);
 	Scene *newscene;
 
-	if(scene->id.prev)
+	if (scene->id.prev)
 		newscene= scene->id.prev;
-	else if(scene->id.next)
+	else if (scene->id.next)
 		newscene= scene->id.next;
 	else
 		return;
 
-	ED_screen_set_scene(C, newscene);
+	ED_screen_set_scene(C, CTX_wm_screen(C), newscene);
 
 	unlink_scene(bmain, scene, newscene);
 }
@@ -1520,11 +1529,11 @@ ScrArea *ED_screen_full_newspace(bContext *C, ScrArea *sa, int type)
 	bScreen *screen= CTX_wm_screen(C);
 	ScrArea *newsa= NULL;
 
-	if(!sa || sa->full==NULL) {
+	if (!sa || sa->full==NULL) {
 		newsa= ED_screen_full_toggle(C, win, sa);
 	}
 	
-	if(!newsa) {
+	if (!newsa) {
 		if (sa->full) {
 			/* if this has been called from the temporary info header generated in
 			 * temp fullscreen layouts, find the correct fullscreen area to change
@@ -1533,8 +1542,10 @@ ScrArea *ED_screen_full_newspace(bContext *C, ScrArea *sa, int type)
 				if (!(sa->flag & AREA_TEMP_INFO))
 					break;
 			}
-		} else
-			newsa= sa;
+		}
+		else {
+			newsa = sa;
+		}
 	}
 	
 	ED_area_newspace(C, newsa, type);
@@ -1548,7 +1559,7 @@ void ED_screen_full_prevspace(bContext *C, ScrArea *sa)
 
 	ED_area_prevspace(C, sa);
 	
-	if(sa->full)
+	if (sa->full)
 		ED_screen_full_toggle(C, win, sa);
 }
 
@@ -1581,10 +1592,13 @@ void ED_screen_full_restore(bContext *C, ScrArea *sa)
 				sima->flag &= ~SI_FULLWINDOW;
 				ED_screen_full_prevspace(C, sa);
 			}
-		} else if (sl->spacetype == SPACE_FILE) {
+		}
+		else if (sl->spacetype == SPACE_FILE) {
 			ED_screen_full_prevspace(C, sa);
-		} else
+		}
+		else {
 			ED_screen_full_toggle(C, win, sa);
+		}
 	}
 	/* otherwise just tile the area again */
 	else {
@@ -1598,18 +1612,18 @@ ScrArea *ED_screen_full_toggle(bContext *C, wmWindow *win, ScrArea *sa)
 	bScreen *sc, *oldscreen;
 	ARegion *ar;
 
-	if(sa) {
+	if (sa) {
 		/* ensure we don't have a button active anymore, can crash when
-		   switching screens with tooltip open because region and tooltip
-		   are no longer in the same screen */
-		for(ar=sa->regionbase.first; ar; ar=ar->next)
+		 * switching screens with tooltip open because region and tooltip
+		 * are no longer in the same screen */
+		for (ar=sa->regionbase.first; ar; ar=ar->next)
 			uiFreeBlocks(C, &ar->uiblocks);
 		
 		/* prevent hanging header prints */
 		ED_area_headerprint(sa, NULL);
 	}
 
-	if(sa && sa->full) {
+	if (sa && sa->full) {
 		ScrArea *old;
 		/*short fulltype;*/ /*UNUSED*/
 
@@ -1622,11 +1636,11 @@ ScrArea *ED_screen_full_toggle(bContext *C, wmWindow *win, ScrArea *sa)
 		/* removed: SCREENAUTOPLAY exception here */
 	
 		/* find old area */
-		for(old= sc->areabase.first; old; old= old->next)
-			if(old->full) break;
-		if(old==NULL) {
-			if (G.f & G_DEBUG)
-				printf("something wrong in areafullscreen\n");
+		for (old= sc->areabase.first; old; old= old->next)
+			if (old->full) break;
+		if (old==NULL) {
+			if (G.debug & G_DEBUG)
+				printf("%s: something wrong in areafullscreen\n", __func__);
 			return NULL;
 		}
 
@@ -1651,10 +1665,11 @@ ScrArea *ED_screen_full_toggle(bContext *C, wmWindow *win, ScrArea *sa)
 		oldscreen= win->screen;
 
 		/* nothing wrong with having only 1 area, as far as I can see...
-		// is there only 1 area?
-		if(oldscreen->areabase.first==oldscreen->areabase.last)
+		 * is there only 1 area? */
+#if 0
+		if (oldscreen->areabase.first==oldscreen->areabase.last)
 			return NULL;
-		*/
+#endif
 
 		oldscreen->full = SCREENFULL;
 		BLI_snprintf(newname, sizeof(newname), "%s-%s", oldscreen->id.name+2, "full");
@@ -1670,8 +1685,8 @@ ScrArea *ED_screen_full_toggle(bContext *C, wmWindow *win, ScrArea *sa)
 		ED_area_newspace(C, newa, SPACE_INFO);
 
 		/* use random area when we have no active one, e.g. when the
-		   mouse is outside of the window and we open a file browser */
-		if(!sa)
+		 * mouse is outside of the window and we open a file browser */
+		if (!sa)
 			sa= oldscreen->areabase.first;
 
 		/* copy area */
@@ -1728,17 +1743,24 @@ void ED_screen_animation_timer(bContext *C, int redraws, int refresh, int sync,
 	wmWindow *win= CTX_wm_window(C);
 	Scene *scene= CTX_data_scene(C);
 	
-	if(screen->animtimer)
+	if (screen->animtimer)
 		WM_event_remove_timer(wm, win, screen->animtimer);
 	screen->animtimer= NULL;
 	
-	if(enable) {
+	if (enable) {
 		ScreenAnimData *sad= MEM_callocN(sizeof(ScreenAnimData), "ScreenAnimData");
 		
 		screen->animtimer= WM_event_add_timer(wm, win, TIMER0, (1.0/FPS));
 		
 		sad->ar= CTX_wm_region(C);
-		sad->sfra = scene->r.cfra;
+		/* if startframe is larger than current frame, we put currentframe on startframe.
+		 * note: first frame then is not drawn! (ton) */
+		if (scene->r.sfra > scene->r.cfra) {
+			sad->sfra= scene->r.cfra;
+			scene->r.cfra= scene->r.sfra;
+		}
+		else
+			sad->sfra = scene->r.cfra;
 		sad->redraws= redraws;
 		sad->refresh= refresh;
 		sad->flag |= (enable < 0)? ANIMPLAY_FLAG_REVERSE: 0;
@@ -1758,12 +1780,12 @@ static ARegion *time_top_left_3dwindow(bScreen *screen)
 	ScrArea *sa;
 	int min= 10000;
 	
-	for(sa= screen->areabase.first; sa; sa= sa->next) {
-		if(sa->spacetype==SPACE_VIEW3D) {
+	for (sa= screen->areabase.first; sa; sa= sa->next) {
+		if (sa->spacetype==SPACE_VIEW3D) {
 			ARegion *ar;
-			for(ar= sa->regionbase.first; ar; ar= ar->next) {
-				if(ar->regiontype==RGN_TYPE_WINDOW) {
-					if(ar->winrct.xmin - ar->winrct.ymin < min) {
+			for (ar= sa->regionbase.first; ar; ar= ar->next) {
+				if (ar->regiontype==RGN_TYPE_WINDOW) {
+					if (ar->winrct.xmin - ar->winrct.ymin < min) {
 						aret= ar;
 						min= ar->winrct.xmin - ar->winrct.ymin;
 					}
@@ -1777,14 +1799,14 @@ static ARegion *time_top_left_3dwindow(bScreen *screen)
 
 void ED_screen_animation_timer_update(bScreen *screen, int redraws, int refresh)
 {
-	if(screen && screen->animtimer) {
+	if (screen && screen->animtimer) {
 		wmTimer *wt= screen->animtimer;
 		ScreenAnimData *sad= wt->customdata;
 		
 		sad->redraws= redraws;
 		sad->refresh= refresh;
 		sad->ar= NULL;
-		if(redraws & TIME_REGION)
+		if (redraws & TIME_REGION)
 			sad->ar= time_top_left_3dwindow(screen);
 	}
 }
@@ -1795,11 +1817,11 @@ void ED_update_for_newframe(Main *bmain, Scene *scene, bScreen *screen, int UNUS
 {	
 #ifdef DURIAN_CAMERA_SWITCH
 	void *camera= scene_camera_switch_find(scene);
-	if(camera && scene->camera != camera) {
+	if (camera && scene->camera != camera) {
 		bScreen *sc;
 		scene->camera= camera;
 		/* are there cameras in the views that are not in the scene? */
-		for(sc= bmain->screen.first; sc; sc= sc->id.next) {
+		for (sc= bmain->screen.first; sc; sc= sc->id.next) {
 			BKE_screen_view3d_scene_sync(sc);
 		}
 	}
@@ -1808,7 +1830,7 @@ void ED_update_for_newframe(Main *bmain, Scene *scene, bScreen *screen, int UNUS
 	//extern void audiostream_scrub(unsigned int frame);	/* seqaudio.c */
 	
 	/* update animated image textures for gpu, etc,
-	 * call before scene_update_for_newframe so modifiers with textuers dont lag 1 frame */
+	 * call before scene_update_for_newframe so modifiers with textures don't lag 1 frame */
 	ED_image_update_frame(bmain, scene->r.cfra);
 
 	ED_clip_update_frame(bmain, scene->r.cfra);
@@ -1827,15 +1849,15 @@ void ED_update_for_newframe(Main *bmain, Scene *scene, bScreen *screen, int UNUS
 	//BIF_image_update_frame();
 	
 	/* composite */
-	if(scene->use_nodes && scene->nodetree)
+	if (scene->use_nodes && scene->nodetree)
 		ntreeCompositTagAnimated(scene->nodetree);
 	
 	/* update animated texture nodes */
 	{
 		Tex *tex;
-		for(tex= bmain->tex.first; tex; tex= tex->id.next)
-			if( tex->use_nodes && tex->nodetree ) {
-				ntreeTexTagAnimated( tex->nodetree );
+		for (tex= bmain->tex.first; tex; tex= tex->id.next)
+			if (tex->use_nodes && tex->nodetree) {
+				ntreeTexTagAnimated(tex->nodetree);
 			}
 	}
 	
diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h
index b882a08..90533fd 100644
--- a/source/blender/editors/screen/screen_intern.h
+++ b/source/blender/editors/screen/screen_intern.h
@@ -28,8 +28,8 @@
  *  \ingroup edscr
  */
 
-#ifndef ED_SCREEN_INTERN_H
-#define ED_SCREEN_INTERN_H
+#ifndef __SCREEN_INTERN_H__
+#define __SCREEN_INTERN_H__
 
 /* internal exports only */
 struct wmWindow;
@@ -65,7 +65,7 @@ extern const char *screen_context_dir[]; /* doc access */
 void SCREEN_OT_screenshot(struct wmOperatorType *ot);
 void SCREEN_OT_screencast(struct wmOperatorType *ot);
 
-#endif /* ED_SCREEN_INTERN_H */
+#endif /* __SCREEN_INTERN_H__ */
 
 
 
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 2c652df..e427e1e 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -34,7 +34,6 @@
 
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
-#include "BLI_editVert.h"
 #include "BLI_dlrbTree.h"
 #include "BLI_utildefines.h"
 
@@ -44,6 +43,7 @@
 #include "DNA_curve_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_meta_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_userdef_types.h"
 
 #include "BKE_context.h"
@@ -55,6 +55,7 @@
 #include "BKE_report.h"
 #include "BKE_scene.h"
 #include "BKE_screen.h"
+#include "BKE_tessmesh.h"
 #include "BKE_sound.h"
 
 #include "WM_api.h"
@@ -88,42 +89,42 @@
 
 int ED_operator_regionactive(bContext *C)
 {
-	if(CTX_wm_window(C)==NULL) return 0;
-	if(CTX_wm_screen(C)==NULL) return 0;
-	if(CTX_wm_region(C)==NULL) return 0;
+	if (CTX_wm_window(C)==NULL) return 0;
+	if (CTX_wm_screen(C)==NULL) return 0;
+	if (CTX_wm_region(C)==NULL) return 0;
 	return 1;
 }
 
 int ED_operator_areaactive(bContext *C)
 {
-	if(CTX_wm_window(C)==NULL) return 0;
-	if(CTX_wm_screen(C)==NULL) return 0;
-	if(CTX_wm_area(C)==NULL) return 0;
+	if (CTX_wm_window(C)==NULL) return 0;
+	if (CTX_wm_screen(C)==NULL) return 0;
+	if (CTX_wm_area(C)==NULL) return 0;
 	return 1;
 }
 
 int ED_operator_screenactive(bContext *C)
 {
-	if(CTX_wm_window(C)==NULL) return 0;
-	if(CTX_wm_screen(C)==NULL) return 0;
+	if (CTX_wm_window(C)==NULL) return 0;
+	if (CTX_wm_screen(C)==NULL) return 0;
 	return 1;
 }
 
 /* XXX added this to prevent anim state to change during renders */
 static int ED_operator_screenactive_norender(bContext *C)
 {
-	if(G.rendering) return 0;
-	if(CTX_wm_window(C)==NULL) return 0;
-	if(CTX_wm_screen(C)==NULL) return 0;
+	if (G.rendering) return 0;
+	if (CTX_wm_window(C)==NULL) return 0;
+	if (CTX_wm_screen(C)==NULL) return 0;
 	return 1;
 }
 
 
 static int screen_active_editable(bContext *C)
 {
-	if(ED_operator_screenactive(C)) {
+	if (ED_operator_screenactive(C)) {
 		/* no full window splitting allowed */
-		if(CTX_wm_screen(C)->full != SCREENNORMAL)
+		if (CTX_wm_screen(C)->full != SCREENNORMAL)
 			return 0;
 		return 1;
 	}
@@ -133,8 +134,8 @@ static int screen_active_editable(bContext *C)
 /* when mouse is over area-edge */
 int ED_operator_screen_mainwinactive(bContext *C)
 {
-	if(CTX_wm_window(C)==NULL) return 0;
-	if(CTX_wm_screen(C)==NULL) return 0;
+	if (CTX_wm_window(C)==NULL) return 0;
+	if (CTX_wm_screen(C)==NULL) return 0;
 	if (CTX_wm_screen(C)->subwinactive!=CTX_wm_screen(C)->mainwin) return 0;
 	return 1;
 }
@@ -142,7 +143,7 @@ int ED_operator_screen_mainwinactive(bContext *C)
 int ED_operator_scene_editable(bContext *C)
 {
 	Scene *scene= CTX_data_scene(C);
-	if(scene && scene->id.lib==NULL)
+	if (scene && scene->id.lib==NULL)
 		return 1;
 	return 0;
 }
@@ -152,13 +153,13 @@ int ED_operator_objectmode(bContext *C)
 	Scene *scene= CTX_data_scene(C);
 	Object *obact= CTX_data_active_object(C);
 
-	if(scene==NULL || scene->id.lib)
+	if (scene==NULL || scene->id.lib)
 		return 0;
-	if( CTX_data_edit_object(C) )
+	if ( CTX_data_edit_object(C) )
 		return 0;
 	
 	/* add a check for ob->mode too? */
-	if(obact && obact->mode)
+	if (obact && obact->mode)
 		return 0;
 	
 	return 1;
@@ -167,7 +168,7 @@ int ED_operator_objectmode(bContext *C)
 
 static int ed_spacetype_test(bContext *C, int type)
 {
-	if(ED_operator_areaactive(C)) {
+	if (ED_operator_areaactive(C)) {
 		SpaceLink *sl= (SpaceLink *)CTX_wm_space_data(C);
 		return sl && (sl->spacetype == type);
 	}
@@ -181,7 +182,7 @@ int ED_operator_view3d_active(bContext *C)
 
 int ED_operator_region_view3d_active(bContext *C)
 {
-	if(CTX_wm_region_view3d(C))
+	if (CTX_wm_region_view3d(C))
 		return TRUE;
 
 	CTX_wm_operator_poll_msg_set(C, "expected a view3d region");
@@ -191,7 +192,7 @@ int ED_operator_region_view3d_active(bContext *C)
 /* generic for any view2d which uses anim_ops */
 int ED_operator_animview_active(bContext *C)
 {
-	if(ED_operator_areaactive(C)) {
+	if (ED_operator_areaactive(C)) {
 		SpaceLink *sl= (SpaceLink *)CTX_wm_space_data(C);
 		if (sl && (ELEM5(sl->spacetype, SPACE_SEQ, SPACE_ACTION, SPACE_NLA, SPACE_IPO, SPACE_TIME)))
 			return TRUE;
@@ -213,10 +214,10 @@ int ED_operator_outliner_active(bContext *C)
 
 int ED_operator_outliner_active_no_editobject(bContext *C)
 {
-	if(ed_spacetype_test(C, SPACE_OUTLINER)) {
+	if (ed_spacetype_test(C, SPACE_OUTLINER)) {
 		Object *ob = ED_object_active_context(C);
 		Object *obedit= CTX_data_edit_object(C);
-		if(ob && ob == obedit)
+		if (ob && ob == obedit)
 			return 0;
 		else
 			return 1;
@@ -243,7 +244,7 @@ int ED_operator_node_active(bContext *C)
 {
 	SpaceNode *snode= CTX_wm_space_node(C);
 	
-	if(snode && snode->edittree)
+	if (snode && snode->edittree)
 		return 1;
 	
 	return 0;
@@ -313,8 +314,8 @@ int ED_operator_object_active_editable_font(bContext *C)
 int ED_operator_editmesh(bContext *C)
 {
 	Object *obedit= CTX_data_edit_object(C);
-	if(obedit && obedit->type==OB_MESH)
-		return NULL != ((Mesh *)obedit->data)->edit_mesh;
+	if (obedit && obedit->type==OB_MESH)
+		return NULL != BMEdit_FromObject(obedit);
 	return 0;
 }
 
@@ -325,7 +326,7 @@ int ED_operator_editmesh_view3d(bContext *C)
 
 int ED_operator_editmesh_region_view3d(bContext *C)
 {
-	if(ED_operator_editmesh(C) && CTX_wm_region_view3d(C))
+	if (ED_operator_editmesh(C) && CTX_wm_region_view3d(C))
 		return 1;
 
 	CTX_wm_operator_poll_msg_set(C, "expected a view3d region & editmesh");
@@ -335,7 +336,7 @@ int ED_operator_editmesh_region_view3d(bContext *C)
 int ED_operator_editarmature(bContext *C)
 {
 	Object *obedit= CTX_data_edit_object(C);
-	if(obedit && obedit->type==OB_ARMATURE)
+	if (obedit && obedit->type==OB_ARMATURE)
 		return NULL != ((bArmature *)obedit->data)->edbo;
 	return 0;
 }
@@ -346,8 +347,8 @@ int ED_operator_posemode(bContext *C)
 
 	if (obact && !(obact->mode & OB_MODE_EDIT)) {
 		Object *obpose;
-		if((obpose= object_pose_armature_get(obact))) {
-			if((obact == obpose) || (obact->mode & OB_MODE_WEIGHT_PAINT)) {
+		if ((obpose= object_pose_armature_get(obact))) {
+			if ((obact == obpose) || (obact->mode & OB_MODE_WEIGHT_PAINT)) {
 				return 1;
 			}
 		}
@@ -366,33 +367,31 @@ int ED_operator_uvedit(bContext *C)
 
 int ED_operator_uvmap(bContext *C)
 {
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= NULL;
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = NULL;
 	
-	if(obedit && obedit->type==OB_MESH)
-		em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
+	if (obedit && obedit->type == OB_MESH) {
+		em = BMEdit_FromObject(obedit);
+	}
 	
-	if(em && (em->faces.first)) {
-		BKE_mesh_end_editmesh(obedit->data, em);
-		return 1;
+	if (em && (em->bm->totface)) {
+		return TRUE;
 	}
 	
-	if(obedit)
-		BKE_mesh_end_editmesh(obedit->data, em);
-	return 0;
+	return FALSE;
 }
 
 int ED_operator_editsurfcurve(bContext *C)
 {
 	Object *obedit= CTX_data_edit_object(C);
-	if(obedit && ELEM(obedit->type, OB_CURVE, OB_SURF))
+	if (obedit && ELEM(obedit->type, OB_CURVE, OB_SURF))
 		return NULL != ((Curve *)obedit->data)->editnurb;
 	return 0;
 }
 
 int ED_operator_editsurfcurve_region_view3d(bContext *C)
 {
-	if(ED_operator_editsurfcurve(C) && CTX_wm_region_view3d(C))
+	if (ED_operator_editsurfcurve(C) && CTX_wm_region_view3d(C))
 		return 1;
 
 	CTX_wm_operator_poll_msg_set(C, "expected a view3d region & editcurve");
@@ -402,7 +401,7 @@ int ED_operator_editsurfcurve_region_view3d(bContext *C)
 int ED_operator_editcurve(bContext *C)
 {
 	Object *obedit= CTX_data_edit_object(C);
-	if(obedit && obedit->type==OB_CURVE)
+	if (obedit && obedit->type==OB_CURVE)
 		return NULL != ((Curve *)obedit->data)->editnurb;
 	return 0;
 }
@@ -410,7 +409,7 @@ int ED_operator_editcurve(bContext *C)
 int ED_operator_editcurve_3d(bContext *C)
 {
 	Object *obedit= CTX_data_edit_object(C);
-	if(obedit && obedit->type==OB_CURVE) {
+	if (obedit && obedit->type==OB_CURVE) {
 		Curve *cu= (Curve *)obedit->data;
 
 		return (cu->flag&CU_3D) && (NULL != cu->editnurb);
@@ -421,7 +420,7 @@ int ED_operator_editcurve_3d(bContext *C)
 int ED_operator_editsurf(bContext *C)
 {
 	Object *obedit= CTX_data_edit_object(C);
-	if(obedit && obedit->type==OB_SURF)
+	if (obedit && obedit->type==OB_SURF)
 		return NULL != ((Curve *)obedit->data)->editnurb;
 	return 0;
 }
@@ -429,7 +428,7 @@ int ED_operator_editsurf(bContext *C)
 int ED_operator_editfont(bContext *C)
 {
 	Object *obedit= CTX_data_edit_object(C);
-	if(obedit && obedit->type==OB_FONT)
+	if (obedit && obedit->type==OB_FONT)
 		return NULL != ((Curve *)obedit->data)->editfont;
 	return 0;
 }
@@ -437,7 +436,7 @@ int ED_operator_editfont(bContext *C)
 int ED_operator_editlattice(bContext *C)
 {
 	Object *obedit= CTX_data_edit_object(C);
-	if(obedit && obedit->type==OB_LATTICE)
+	if (obedit && obedit->type==OB_LATTICE)
 		return NULL != ((Lattice *)obedit->data)->editlatt;
 	return 0;
 }
@@ -445,7 +444,7 @@ int ED_operator_editlattice(bContext *C)
 int ED_operator_editmball(bContext *C)
 {
 	Object *obedit= CTX_data_edit_object(C);
-	if(obedit && obedit->type==OB_MBALL)
+	if (obedit && obedit->type==OB_MBALL)
 		return NULL != ((MetaBall *)obedit->data)->editelems;
 	return 0;
 }
@@ -453,26 +452,25 @@ int ED_operator_editmball(bContext *C)
 /* *************************** action zone operator ************************** */
 
 /* operator state vars used:  
- none
- 
- functions:
- 
- apply() set actionzone event
- 
- exit()	free customdata
- 
- callbacks:
- 
- exec()	never used
- 
- invoke() check if in zone  
- add customdata, put mouseco and area in it
- add modal handler
- 
- modal()	accept modal events while doing it
- call apply() with gesture info, active window, nonactive window
- call exit() and remove handler when LMB confirm
- 
+ * none
+ * 
+ * functions:
+ * 
+ * apply() set actionzone event
+ * 
+ * exit()	free customdata
+ * 
+ * callbacks:
+ * 
+ * exec()	never used
+ * 
+ * invoke() check if in zone  
+ * add customdata, put mouseco and area in it
+ * add modal handler
+ * 
+ * modal()	accept modal events while doing it
+ * call apply() with gesture info, active window, nonactive window
+ * call exit() and remove handler when LMB confirm
  */
 
 typedef struct sActionzoneData {
@@ -486,8 +484,8 @@ static ScrArea *screen_areahascursor(bScreen *scr, int x, int y)
 {
 	ScrArea *sa= NULL;
 	sa= scr->areabase.first;
-	while(sa) {
-		if(BLI_in_rcti(&sa->totrct, x, y)) break;
+	while (sa) {
+		if (BLI_in_rcti(&sa->totrct, x, y)) break;
 		sa= sa->next;
 	}
 	
@@ -500,13 +498,13 @@ static int actionzone_area_poll(bContext *C)
 	wmWindow *win= CTX_wm_window(C);
 	ScrArea *sa= CTX_wm_area(C);
 	
-	if(sa && win) {
+	if (sa && win) {
 		AZone *az;
 		int x= win->eventstate->x;
 		int y= win->eventstate->y;
 		
-		for(az= sa->actionzones.first; az; az= az->next)
-			if(BLI_in_rcti(&az->rect, x, y))
+		for (az= sa->actionzones.first; az; az= az->next)
+			if (BLI_in_rcti(&az->rect, x, y))
 				return 1;
 	}	
 	return 0;
@@ -516,16 +514,16 @@ AZone *is_in_area_actionzone(ScrArea *sa, int x, int y)
 {
 	AZone *az= NULL;
 	
-	for(az= sa->actionzones.first; az; az= az->next) {
-		if(BLI_in_rcti(&az->rect, x, y)) {
-			if(az->type == AZONE_AREA) {
+	for (az= sa->actionzones.first; az; az= az->next) {
+		if (BLI_in_rcti(&az->rect, x, y)) {
+			if (az->type == AZONE_AREA) {
 				/* no triangle intersect but a hotspot circle based on corner */
 				int radius= (x-az->x1)*(x-az->x1) + (y-az->y1)*(y-az->y1);
 				
-				if(radius <= AZONESPOT*AZONESPOT)
+				if (radius <= AZONESPOT*AZONESPOT)
 					break;
 			}
-			else if(az->type == AZONE_REGION) {
+			else if (az->type == AZONE_REGION) {
 				break;
 			}
 		}
@@ -537,7 +535,7 @@ AZone *is_in_area_actionzone(ScrArea *sa, int x, int y)
 
 static void actionzone_exit(wmOperator *op)
 {
-	if(op->customdata)
+	if (op->customdata)
 		MEM_freeN(op->customdata);
 	op->customdata= NULL;
 }
@@ -552,7 +550,7 @@ static void actionzone_apply(bContext *C, wmOperator *op, int type)
 	sad->modifier= RNA_int_get(op->ptr, "modifier");
 	
 	event= *(win->eventstate);	/* XXX huh huh? make api call */
-	if(type==AZONE_AREA)
+	if (type==AZONE_AREA)
 		event.type= EVT_ACTIONZONE_AREA;
 	else
 		event.type= EVT_ACTIONZONE_REGION;
@@ -569,7 +567,7 @@ static int actionzone_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	sActionzoneData *sad;
 	
 	/* quick escape */
-	if(az==NULL)
+	if (az==NULL)
 		return OPERATOR_PASS_THROUGH;
 	
 	/* ok we do the actionzone */
@@ -579,7 +577,7 @@ static int actionzone_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	sad->x= event->x; sad->y= event->y;
 	
 	/* region azone directly reacts on mouse clicks */
-	if(sad->az->type==AZONE_REGION) {
+	if (sad->az->type==AZONE_REGION) {
 		actionzone_apply(C, op, AZONE_REGION);
 		actionzone_exit(op);
 		return OPERATOR_FINISHED;
@@ -605,17 +603,17 @@ static int actionzone_modal(bContext *C, wmOperator *op, wmEvent *event)
 			deltax= (event->x - sad->x);
 			deltay= (event->y - sad->y);
 			
-			if(deltay > ABS(deltax))
+			if (deltay > ABS(deltax))
 				sad->gesture_dir= 'n';
-			else if(deltax > ABS(deltay))
+			else if (deltax > ABS(deltay))
 				sad->gesture_dir= 'e';
-			else if(deltay < -ABS(deltax))
+			else if (deltay < -ABS(deltax))
 				sad->gesture_dir= 's';
 			else
 				sad->gesture_dir= 'w';
 			
 			/* gesture is large enough? */
-			if(ABS(deltax) > mindelta || ABS(deltay) > mindelta) {
+			if (ABS(deltax) > mindelta || ABS(deltay) > mindelta) {
 				
 				/* second area, for join */
 				sad->sa2= screen_areahascursor(CTX_wm_screen(C), event->x, event->y);
@@ -648,16 +646,16 @@ static int actionzone_cancel(bContext *UNUSED(C), wmOperator *op)
 static void SCREEN_OT_actionzone(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Handle area action zones";
-	ot->description= "Handle area action zones for mouse actions/gestures";
-	ot->idname= "SCREEN_OT_actionzone";
+	ot->name = "Handle area action zones";
+	ot->description = "Handle area action zones for mouse actions/gestures";
+	ot->idname = "SCREEN_OT_actionzone";
 	
-	ot->invoke= actionzone_invoke;
-	ot->modal= actionzone_modal;
-	ot->poll= actionzone_area_poll;
-	ot->cancel= actionzone_cancel;
+	ot->invoke = actionzone_invoke;
+	ot->modal = actionzone_modal;
+	ot->poll = actionzone_area_poll;
+	ot->cancel = actionzone_cancel;
 	
-	ot->flag= OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_BLOCKING;
 	
 	RNA_def_int(ot->srna, "modifier", 0, 0, 2, "Modifier", "Modifier state", 0, 2);
 }
@@ -665,24 +663,23 @@ static void SCREEN_OT_actionzone(wmOperatorType *ot)
 /* ************** swap area operator *********************************** */
 
 /* operator state vars used:  
- sa1		start area
- sa2		area to swap with
- 
- functions:
- 
- init()   set custom data for operator, based on actionzone event custom data
- 
- cancel()	cancel the operator
- 
- exit()	cleanup, send notifier
- 
- callbacks:
- 
- invoke() gets called on shift+lmb drag in actionzone
- call init(), add handler
- 
- modal()  accept modal events while doing it
- 
+ * sa1		start area
+ * sa2		area to swap with
+ * 
+ * functions:
+ * 
+ * init()   set custom data for operator, based on actionzone event custom data
+ * 
+ * cancel()	cancel the operator
+ * 
+ * exit()	cleanup, send notifier
+ * 
+ * callbacks:
+ * 
+ * invoke() gets called on shift+lmb drag in actionzone
+ * call init(), add handler
+ * 
+ * modal()  accept modal events while doing it
  */
 
 typedef struct sAreaSwapData {
@@ -694,7 +691,7 @@ static int area_swap_init(wmOperator *op, wmEvent *event)
 	sAreaSwapData *sd= NULL;
 	sActionzoneData *sad= event->customdata;
 	
-	if(sad==NULL || sad->sa1==NULL)
+	if (sad==NULL || sad->sa1==NULL)
 		return 0;
 	
 	sd= MEM_callocN(sizeof(sAreaSwapData), "sAreaSwapData");
@@ -709,7 +706,7 @@ static int area_swap_init(wmOperator *op, wmEvent *event)
 static void area_swap_exit(bContext *C, wmOperator *op)
 {
 	WM_cursor_restore(CTX_wm_window(C));
-	if(op->customdata)
+	if (op->customdata)
 		MEM_freeN(op->customdata);
 	op->customdata= NULL;
 }
@@ -723,7 +720,7 @@ static int area_swap_cancel(bContext *C, wmOperator *op)
 static int area_swap_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 	
-	if(!area_swap_init(op, event))
+	if (!area_swap_init(op, event))
 		return OPERATOR_PASS_THROUGH;
 	
 	/* add modal handler */
@@ -744,8 +741,8 @@ static int area_swap_modal(bContext *C, wmOperator *op, wmEvent *event)
 			sad->sa2= screen_areahascursor(CTX_wm_screen(C), event->x, event->y);
 			break;
 		case LEFTMOUSE: /* release LMB */
-			if(event->val==KM_RELEASE) {
-				if(!sad->sa2 || sad->sa1 == sad->sa2) {
+			if (event->val==KM_RELEASE) {
+				if (!sad->sa2 || sad->sa1 == sad->sa2) {
 					
 					return area_swap_cancel(C, op);
 				}
@@ -771,16 +768,16 @@ static int area_swap_modal(bContext *C, wmOperator *op, wmEvent *event)
 
 static void SCREEN_OT_area_swap(wmOperatorType *ot)
 {
-	ot->name= "Swap areas";
-	ot->description= "Swap selected areas screen positions";
-	ot->idname= "SCREEN_OT_area_swap";
+	ot->name = "Swap areas";
+	ot->description = "Swap selected areas screen positions";
+	ot->idname = "SCREEN_OT_area_swap";
 	
-	ot->invoke= area_swap_invoke;
-	ot->modal= area_swap_modal;
-	ot->poll= ED_operator_areaactive;
-	ot->cancel= area_swap_cancel;
+	ot->invoke = area_swap_invoke;
+	ot->modal = area_swap_modal;
+	ot->poll = ED_operator_areaactive;
+	ot->cancel = area_swap_cancel;
 	
-	ot->flag= OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_BLOCKING;
 }
 
 /* *********** Duplicate area as new window operator ****************** */
@@ -798,18 +795,18 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	sa= CTX_wm_area(C);
 	
 	/* XXX hrmf! */
-	if(event->type==EVT_ACTIONZONE_AREA) {
+	if (event->type==EVT_ACTIONZONE_AREA) {
 		sActionzoneData *sad= event->customdata;
 		
-		if(sad==NULL)
+		if (sad==NULL)
 			return OPERATOR_PASS_THROUGH;
 		
 		sa= sad->sa1;
 	}
 	
 	/*  poll() checks area context, but we don't accept full-area windows */
-	if(sc->full != SCREENNORMAL) {
-		if(event->type==EVT_ACTIONZONE_AREA)
+	if (sc->full != SCREENNORMAL) {
+		if (event->type==EVT_ACTIONZONE_AREA)
 			actionzone_exit(op);
 		return OPERATOR_CANCELLED;
 	}
@@ -831,7 +828,7 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	/* screen, areas init */
 	WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
 	
-	if(event->type==EVT_ACTIONZONE_AREA)
+	if (event->type==EVT_ACTIONZONE_AREA)
 		actionzone_exit(op);
 	
 	return OPERATOR_FINISHED;
@@ -839,44 +836,43 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 static void SCREEN_OT_area_dupli(wmOperatorType *ot)
 {
-	ot->name= "Duplicate Area into New Window";
-	ot->description= "Duplicate selected area into new window";
-	ot->idname= "SCREEN_OT_area_dupli";
+	ot->name = "Duplicate Area into New Window";
+	ot->description = "Duplicate selected area into new window";
+	ot->idname = "SCREEN_OT_area_dupli";
 	
-	ot->invoke= area_dupli_invoke;
-	ot->poll= ED_operator_areaactive;
+	ot->invoke = area_dupli_invoke;
+	ot->poll = ED_operator_areaactive;
 }
 
 
 /* ************** move area edge operator *********************************** */
 
 /* operator state vars used:  
- x, y   			mouse coord near edge
- delta            movement of edge
- 
- functions:
- 
- init()   set default property values, find edge based on mouse coords, test
- if the edge can be moved, select edges, calculate min and max movement
- 
- apply()	apply delta on selection
- 
- exit()	cleanup, send notifier
- 
- cancel() cancel moving
- 
- callbacks:
- 
- exec()   execute without any user interaction, based on properties
- call init(), apply(), exit()
- 
- invoke() gets called on mouse click near edge
- call init(), add handler
- 
- modal()  accept modal events while doing it
- call apply() with delta motion
- call exit() and remove handler
- 
+ * x, y   			mouse coord near edge
+ * delta            movement of edge
+ * 
+ * functions:
+ * 
+ * init()   set default property values, find edge based on mouse coords, test
+ * if the edge can be moved, select edges, calculate min and max movement
+ * 
+ * apply()	apply delta on selection
+ * 
+ * exit()	cleanup, send notifier
+ * 
+ * cancel() cancel moving
+ * 
+ * callbacks:
+ * 
+ * exec()   execute without any user interaction, based on properties
+ * call init(), apply(), exit()
+ * 
+ * invoke() gets called on mouse click near edge
+ * call init(), add handler
+ * 
+ * modal()  accept modal events while doing it
+ * call apply() with delta motion
+ * call exit() and remove handler
  */
 
 typedef struct sAreaMoveData {
@@ -893,23 +889,23 @@ static void area_move_set_limits(bScreen *sc, int dir, int *bigger, int *smaller
 	/* we check all areas and test for free space with MINSIZE */
 	*bigger= *smaller= 100000;
 	
-	for(sa= sc->areabase.first; sa; sa= sa->next) {
-		if(dir=='h') {
+	for (sa= sc->areabase.first; sa; sa= sa->next) {
+		if (dir=='h') {
 			int y1= sa->v2->vec.y - sa->v1->vec.y-areaminy;
 			
 			/* if top or down edge selected, test height */
-			if(sa->v1->flag && sa->v4->flag)
+			if (sa->v1->flag && sa->v4->flag)
 				*bigger= MIN2(*bigger, y1);
-			else if(sa->v2->flag && sa->v3->flag)
+			else if (sa->v2->flag && sa->v3->flag)
 				*smaller= MIN2(*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)
+			if (sa->v1->flag && sa->v2->flag)
 				*bigger= MIN2(*bigger, x1);
-			else if(sa->v3->flag && sa->v4->flag)
+			else if (sa->v3->flag && sa->v4->flag)
 				*smaller= MIN2(*smaller, x1);
 		}
 	}
@@ -930,13 +926,13 @@ static int area_move_init (bContext *C, wmOperator *op)
 	
 	/* setup */
 	actedge= screen_find_active_scredge(sc, x, y);
-	if(actedge==NULL) return 0;
+	if (actedge==NULL) return 0;
 	
 	md= MEM_callocN(sizeof(sAreaMoveData), "sAreaMoveData");
 	op->customdata= md;
 	
 	md->dir= scredge_is_horizontal(actedge)?'h':'v';
-	if(md->dir=='h') md->origval= actedge->v1->vec.y;
+	if (md->dir=='h') md->origval= actedge->v1->vec.y;
 	else md->origval= actedge->v1->vec.x;
 	
 	select_connected_scredge(sc, actedge);
@@ -961,25 +957,25 @@ static void area_move_apply_do(bContext *C, int origval, int delta, int dir, int
 	for (v1= sc->vertbase.first; v1; v1= v1->next) {
 		if (v1->flag) {
 			/* that way a nice AREAGRID  */
-			if((dir=='v') && v1->vec.x>0 && v1->vec.x<win->sizex-1) {
+			if ((dir=='v') && v1->vec.x>0 && v1->vec.x<win->sizex-1) {
 				v1->vec.x= origval + delta;
-				if(delta != bigger && delta != -smaller) v1->vec.x-= (v1->vec.x % AREAGRID);
+				if (delta != bigger && delta != -smaller) v1->vec.x-= (v1->vec.x % AREAGRID);
 			}
-			if((dir=='h') && v1->vec.y>0 && v1->vec.y<win->sizey-1) {
+			if ((dir=='h') && v1->vec.y>0 && v1->vec.y<win->sizey-1) {
 				v1->vec.y= origval + delta;
 				
 				v1->vec.y+= AREAGRID-1;
 				v1->vec.y-= (v1->vec.y % AREAGRID);
 				
 				/* prevent too small top header */
-				if(v1->vec.y > win->sizey-areaminy)
+				if (v1->vec.y > win->sizey-areaminy)
 					v1->vec.y= win->sizey-areaminy;
 			}
 		}
 	}
 
-	for(sa= sc->areabase.first; sa; sa= sa->next) {
-		if(sa->v1->flag || sa->v2->flag || sa->v3->flag || sa->v4->flag)
+	for (sa= sc->areabase.first; sa; sa= sa->next) {
+		if (sa->v1->flag || sa->v2->flag || sa->v3->flag || sa->v4->flag)
 			ED_area_tag_redraw(sa);
 	}
 
@@ -997,7 +993,7 @@ static void area_move_apply(bContext *C, wmOperator *op)
 
 static void area_move_exit(bContext *C, wmOperator *op)
 {
-	if(op->customdata)
+	if (op->customdata)
 		MEM_freeN(op->customdata);
 	op->customdata= NULL;
 	
@@ -1008,7 +1004,7 @@ static void area_move_exit(bContext *C, wmOperator *op)
 
 static int area_move_exec(bContext *C, wmOperator *op)
 {
-	if(!area_move_init(C, op))
+	if (!area_move_init(C, op))
 		return OPERATOR_CANCELLED;
 	
 	area_move_apply(C, op);
@@ -1023,7 +1019,7 @@ static int area_move_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	RNA_int_set(op->ptr, "x", event->x);
 	RNA_int_set(op->ptr, "y", event->y);
 	
-	if(!area_move_init(C, op)) 
+	if (!area_move_init(C, op)) 
 		return OPERATOR_PASS_THROUGH;
 	
 	/* add temp handler */
@@ -1056,7 +1052,7 @@ static int area_move_modal(bContext *C, wmOperator *op, wmEvent *event)
 			y= RNA_int_get(op->ptr, "y");
 			
 			delta= (md->dir == 'v')? event->x - x: event->y - y;
-			if(md->step) delta= delta - (delta % md->step);
+			if (md->step) delta= delta - (delta % md->step);
 			RNA_int_set(op->ptr, "delta", delta);
 			
 			area_move_apply(C, op);
@@ -1087,17 +1083,17 @@ static int area_move_modal(bContext *C, wmOperator *op, wmEvent *event)
 static void SCREEN_OT_area_move(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Move area edges";
-	ot->description= "Move selected area edges";
-	ot->idname= "SCREEN_OT_area_move";
+	ot->name = "Move area edges";
+	ot->description = "Move selected area edges";
+	ot->idname = "SCREEN_OT_area_move";
 	
-	ot->exec= area_move_exec;
-	ot->invoke= area_move_invoke;
-	ot->cancel= area_move_cancel;
-	ot->modal= area_move_modal;
-	ot->poll= ED_operator_screen_mainwinactive; /* when mouse is over area-edge */
+	ot->exec = area_move_exec;
+	ot->invoke = area_move_invoke;
+	ot->cancel = area_move_cancel;
+	ot->modal = area_move_modal;
+	ot->poll = ED_operator_screen_mainwinactive; /* when mouse is over area-edge */
 	
-	ot->flag= OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_BLOCKING;
 	
 	/* rna */
 	RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX);
@@ -1108,38 +1104,37 @@ static void SCREEN_OT_area_move(wmOperatorType *ot)
 /* ************** split area operator *********************************** */
 
 /* 
- operator state vars:  
- fac              spit point
- dir              direction 'v' or 'h'
- 
- operator customdata:
- area   			pointer to (active) area
- x, y			last used mouse pos
- (more, see below)
- 
- functions:
- 
- init()   set default property values, find area based on context
- 
- apply()	split area based on state vars
- 
- exit()	cleanup, send notifier
- 
- cancel() remove duplicated area
- 
- callbacks:
- 
- exec()   execute without any user interaction, based on state vars
- call init(), apply(), exit()
- 
- invoke() gets called on mouse click in action-widget
- call init(), add modal handler
- call apply() with initial motion
- 
- modal()  accept modal events while doing it
- call move-areas code with delta motion
- call exit() or cancel() and remove handler
- 
+ * operator state vars:  
+ * fac              spit point
+ * dir              direction 'v' or 'h'
+ * 
+ * operator customdata:
+ * area   			pointer to (active) area
+ * x, y			last used mouse pos
+ * (more, see below)
+ * 
+ * functions:
+ * 
+ * init()   set default property values, find area based on context
+ * 
+ * apply()	split area based on state vars
+ * 
+ * exit()	cleanup, send notifier
+ * 
+ * cancel() remove duplicated area
+ * 
+ * callbacks:
+ * 
+ * exec()   execute without any user interaction, based on state vars
+ * call init(), apply(), exit()
+ * 
+ * invoke() gets called on mouse click in action-widget
+ * call init(), add modal handler
+ * call apply() with initial motion
+ * 
+ * modal()  accept modal events while doing it
+ * call move-areas code with delta motion
+ * call exit() or cancel() and remove handler
  */
 
 #define SPLIT_STARTED	1
@@ -1171,10 +1166,10 @@ static int area_split_menu_init(bContext *C, wmOperator *op)
 	
 	sd->sarea= CTX_wm_area(C);
 	
-	if(sd->sarea) {
+	if (sd->sarea) {
 		int dir= RNA_enum_get(op->ptr, "direction");
 
-		if(dir=='h')
+		if (dir=='h')
 			sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_H;
 		else
 			sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_V;
@@ -1191,14 +1186,14 @@ static int area_split_init(bContext *C, wmOperator *op)
 	int dir;
 	
 	/* required context */
-	if(sa==NULL) return 0;
+	if (sa==NULL) return 0;
 	
 	/* required properties */
 	dir= RNA_enum_get(op->ptr, "direction");
 	
 	/* minimal size */
-	if(dir=='v' && sa->winx < 2*AREAMINX) return 0;
-	if(dir=='h' && sa->winy < 2*areaminy) return 0;
+	if (dir=='v' && sa->winx < 2*AREAMINX) return 0;
+	if (dir=='h' && sa->winy < 2*areaminy) return 0;
 	
 	/* custom data */
 	sd= (sAreaSplitData*)MEM_callocN(sizeof (sAreaSplitData), "op_area_split");
@@ -1224,16 +1219,16 @@ static ScrEdge *area_findsharededge(bScreen *screen, ScrArea *sa, ScrArea *sb)
 	ScrVert *sbv3= sb->v3;
 	ScrVert *sbv4= sb->v4;
 	
-	if(sav1==sbv4 && sav2==sbv3) { /* sa to right of sb = W */
+	if (sav1==sbv4 && sav2==sbv3) { /* sa to right of sb = W */
 		return screen_findedge(screen, sav1, sav2);
 	}
-	else if(sav2==sbv1 && sav3==sbv4) { /* sa to bottom of sb = N */
+	else if (sav2==sbv1 && sav3==sbv4) { /* sa to bottom of sb = N */
 		return screen_findedge(screen, sav2, sav3);
 	}
-	else if(sav3==sbv2 && sav4==sbv1) { /* sa to left of sb = E */
+	else if (sav3==sbv2 && sav4==sbv1) { /* sa to left of sb = E */
 		return screen_findedge(screen, sav3, sav4);
 	}
-	else if(sav1==sbv2 && sav4==sbv3) { /* sa on top of sb = S*/
+	else if (sav1==sbv2 && sav4==sbv3) { /* sa on top of sb = S*/
 		return screen_findedge(screen, sav1, sav4);
 	}
 	
@@ -1254,19 +1249,19 @@ static int area_split_apply(bContext *C, wmOperator *op)
 	
 	sd->narea= area_split(sc, sd->sarea, dir, fac, 0); /* 0 = no merge */
 	
-	if(sd->narea) {
+	if (sd->narea) {
 		ScrVert *sv;
 		
 		sd->nedge= area_findsharededge(sc, sd->sarea, sd->narea);
 		
 		/* select newly created edge, prepare for moving edge */
-		for(sv= sc->vertbase.first; sv; sv= sv->next)
+		for (sv= sc->vertbase.first; sv; sv= sv->next)
 			sv->flag = 0;
 		
 		sd->nedge->v1->flag= 1;
 		sd->nedge->v2->flag= 1;
 		
-		if(dir=='h') sd->origval= sd->nedge->v1->vec.y;
+		if (dir=='h') sd->origval= sd->nedge->v1->vec.y;
 		else sd->origval= sd->nedge->v1->vec.x;
 
 		ED_area_tag_redraw(sd->sarea);
@@ -1284,10 +1279,10 @@ static void area_split_exit(bContext *C, wmOperator *op)
 {
 	if (op->customdata) {
 		sAreaSplitData *sd= (sAreaSplitData *)op->customdata;
-		if(sd->sarea) ED_area_tag_redraw(sd->sarea);
-		if(sd->narea) ED_area_tag_redraw(sd->narea);
+		if (sd->sarea) ED_area_tag_redraw(sd->sarea);
+		if (sd->narea) ED_area_tag_redraw(sd->narea);
 
-		if(sd->sarea)
+		if (sd->sarea)
 			sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H|AREA_FLAG_DRAWSPLIT_V);
 		
 		MEM_freeN(op->customdata);
@@ -1310,26 +1305,26 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	int dir;
 	
 	/* no full window splitting allowed */
-	if(CTX_wm_screen(C)->full != SCREENNORMAL)
+	if (CTX_wm_screen(C)->full != SCREENNORMAL)
 		return OPERATOR_CANCELLED;
 	
-	if(event->type==EVT_ACTIONZONE_AREA) {
+	if (event->type==EVT_ACTIONZONE_AREA) {
 		sActionzoneData *sad= event->customdata;
 		
-		if(sad->modifier>0) {
+		if (sad->modifier>0) {
 			return OPERATOR_PASS_THROUGH;
 		}
 		
 		/* verify *sad itself */
-		if(sad==NULL || sad->sa1==NULL || sad->az==NULL)
+		if (sad==NULL || sad->sa1==NULL || sad->az==NULL)
 			return OPERATOR_PASS_THROUGH;
 		
 		/* is this our *sad? if areas not equal it should be passed on */
-		if(CTX_wm_area(C)!=sad->sa1 || sad->sa1!=sad->sa2)
+		if (CTX_wm_area(C)!=sad->sa1 || sad->sa1!=sad->sa2)
 			return OPERATOR_PASS_THROUGH;
 		
 		/* prepare operator state vars */
-		if(sad->gesture_dir=='n' || sad->gesture_dir=='s') {
+		if (sad->gesture_dir=='n' || sad->gesture_dir=='s') {
 			dir= 'h';
 			RNA_float_set(op->ptr, "factor", ((float)(event->x - sad->sa1->v1->vec.x)) / (float)sad->sa1->winx);
 		}
@@ -1340,7 +1335,7 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event)
 		RNA_enum_set(op->ptr, "direction", dir);
 		
 		/* general init, also non-UI case, adds customdata, sets area and defaults */
-		if(!area_split_init(C, op))
+		if (!area_split_init(C, op))
 			return OPERATOR_PASS_THROUGH;
 		
 	}
@@ -1349,18 +1344,18 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event)
 		int x, y;
 		
 		/* retrieve initial mouse coord, so we can find the active edge */
-		if(RNA_struct_property_is_set(op->ptr, "mouse_x"))
+		if (RNA_struct_property_is_set(op->ptr, "mouse_x"))
 			x= RNA_int_get(op->ptr, "mouse_x");
 		else
 			x= event->x;
 		
-		if(RNA_struct_property_is_set(op->ptr, "mouse_y"))
+		if (RNA_struct_property_is_set(op->ptr, "mouse_y"))
 			y= RNA_int_get(op->ptr, "mouse_y");
 		else
 			y= event->x;
 		
 		actedge= screen_find_active_scredge(CTX_wm_screen(C), x, y);
-		if(actedge==NULL) 
+		if (actedge==NULL) 
 			return OPERATOR_CANCELLED;
 		
 		dir= scredge_is_horizontal(actedge)?'v':'h';
@@ -1368,7 +1363,7 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event)
 		RNA_enum_set(op->ptr, "direction", dir);
 		
 		/* special case, adds customdata, sets defaults */
-		if(!area_split_menu_init(C, op))
+		if (!area_split_menu_init(C, op))
 			return OPERATOR_CANCELLED;
 		
 	}
@@ -1378,10 +1373,10 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	sd->x= event->x;
 	sd->y= event->y;
 	
-	if(event->type==EVT_ACTIONZONE_AREA) {
+	if (event->type==EVT_ACTIONZONE_AREA) {
 		
 		/* do the split */
-		if(area_split_apply(C, op)) {
+		if (area_split_apply(C, op)) {
 			area_move_set_limits(CTX_wm_screen(C), dir, &sd->bigger, &sd->smaller);
 			
 			/* add temp handler for edge move or cancel */
@@ -1406,7 +1401,7 @@ static int area_split_invoke(bContext *C, wmOperator *op, wmEvent *event)
 static int area_split_exec(bContext *C, wmOperator *op)
 {
 	
-	if(!area_split_init(C, op))
+	if (!area_split_init(C, op))
 		return OPERATOR_CANCELLED;
 	
 	area_split_apply(C, op);
@@ -1420,7 +1415,7 @@ static int area_split_cancel(bContext *C, wmOperator *op)
 {
 	sAreaSplitData *sd= (sAreaSplitData *)op->customdata;
 	
-	if(sd->previewmode) {
+	if (sd->previewmode) {
 	}
 	else {
 		if (screen_area_join(C, CTX_wm_screen(C), sd->sarea, sd->narea)) {
@@ -1448,16 +1443,16 @@ static int area_split_modal(bContext *C, wmOperator *op, wmEvent *event)
 			dir= RNA_enum_get(op->ptr, "direction");
 			
 			sd->delta= (dir == 'v')? event->x - sd->origval: event->y - sd->origval;
-			if(sd->previewmode==0) 
+			if (sd->previewmode==0) 
 				area_move_apply_do(C, sd->origval, sd->delta, dir, sd->bigger, sd->smaller);
 			else {
-				if(sd->sarea) {
+				if (sd->sarea) {
 					sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H|AREA_FLAG_DRAWSPLIT_V);
 					ED_area_tag_redraw(sd->sarea);
 				}
 				sd->sarea= screen_areahascursor(CTX_wm_screen(C), event->x, event->y);	/* area context not set */
 				
-				if(sd->sarea) {
+				if (sd->sarea) {
 					ED_area_tag_redraw(sd->sarea);
 					if (dir=='v') {
 						sd->origsize= sd->sarea->winx;
@@ -1481,13 +1476,13 @@ static int area_split_modal(bContext *C, wmOperator *op, wmEvent *event)
 			break;
 			
 		case LEFTMOUSE:
-			if(sd->previewmode) {
+			if (sd->previewmode) {
 				area_split_apply(C, op);
 				area_split_exit(C, op);
 				return OPERATOR_FINISHED;
 			}
 			else {
-				if(event->val==KM_RELEASE) { /* mouse up */
+				if (event->val==KM_RELEASE) { /* mouse up */
 					area_split_exit(C, op);
 					return OPERATOR_FINISHED;
 				}
@@ -1496,23 +1491,23 @@ static int area_split_modal(bContext *C, wmOperator *op, wmEvent *event)
 			
 		case MIDDLEMOUSE:
 		case TABKEY:
-			if (sd->previewmode==0){
+			if (sd->previewmode==0) {
 			}
-			else{
+			else {
 				dir = RNA_enum_get(op->ptr, "direction");
 				
-				if(event->val==KM_PRESS){
-					if (sd->sarea){
+				if (event->val==KM_PRESS) {
+					if (sd->sarea) {
 						sd->sarea->flag &= ~(AREA_FLAG_DRAWSPLIT_H|AREA_FLAG_DRAWSPLIT_V);
 						ED_area_tag_redraw(sd->sarea);
 						
-						if (dir=='v'){
+						if (dir=='v') {
 							RNA_enum_set(op->ptr, "direction", 'h');
 							sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_H;
 							
 							WM_cursor_set(CTX_wm_window(C),CURSOR_X_MOVE);
 						}
-						else{
+						else {
 							RNA_enum_set(op->ptr, "direction", 'v');
 							sd->sarea->flag |= AREA_FLAG_DRAWSPLIT_V;
 							
@@ -1540,16 +1535,16 @@ static EnumPropertyItem prop_direction_items[] = {
 static void SCREEN_OT_area_split(wmOperatorType *ot)
 {
 	ot->name = "Split area";
-	ot->description= "Split selected area into new windows";
+	ot->description = "Split selected area into new windows";
 	ot->idname = "SCREEN_OT_area_split";
 	
-	ot->exec= area_split_exec;
-	ot->invoke= area_split_invoke;
-	ot->modal= area_split_modal;
-	ot->cancel= area_split_cancel;
+	ot->exec = area_split_exec;
+	ot->invoke = area_split_invoke;
+	ot->modal = area_split_modal;
+	ot->cancel = area_split_cancel;
 	
-	ot->poll= screen_active_editable;
-	ot->flag= OPTYPE_BLOCKING;
+	ot->poll = screen_active_editable;
+	ot->flag = OPTYPE_BLOCKING;
 	
 	/* rna */
 	RNA_def_enum(ot->srna, "direction", prop_direction_items, 'h', "Direction", "");
@@ -1579,9 +1574,10 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge)
 	ARegion *ar;
 	int dist;
 	
-	if(edge==AE_RIGHT_TO_TOPLEFT || edge==AE_LEFT_TO_TOPRIGHT) {
+	if (edge==AE_RIGHT_TO_TOPLEFT || edge==AE_LEFT_TO_TOPRIGHT) {
 		dist = sa->totrct.xmax - sa->totrct.xmin;
-	} else {	/* AE_BOTTOM_TO_TOPLEFT, AE_TOP_TO_BOTTOMRIGHT */
+	}
+	else {	/* AE_BOTTOM_TO_TOPLEFT, AE_TOP_TO_BOTTOMRIGHT */
 		dist = sa->totrct.ymax - sa->totrct.ymin;
 	}
 	
@@ -1616,14 +1612,14 @@ static int region_scale_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	sActionzoneData *sad= event->customdata;
 	AZone *az;
 	
-	if(event->type!=EVT_ACTIONZONE_REGION) {
+	if (event->type!=EVT_ACTIONZONE_REGION) {
 		BKE_report(op->reports, RPT_ERROR, "Can only scale region size from an action zone");	
 		return OPERATOR_CANCELLED;
 	}
 	
 	az = sad->az;
 	
-	if(az->ar) {
+	if (az->ar) {
 		RegionMoveData *rmd= MEM_callocN(sizeof(RegionMoveData), "RegionMoveData");
 		int maxsize;
 		
@@ -1638,15 +1634,16 @@ static int region_scale_invoke(bContext *C, wmOperator *op, wmEvent *event)
 		rmd->maxsize = area_max_regionsize(rmd->sa, rmd->ar, rmd->edge);
 		
 		/* if not set we do now, otherwise it uses type */
-		if(rmd->ar->sizex==0) 
+		if (rmd->ar->sizex==0) 
 			rmd->ar->sizex= rmd->ar->type->prefsizex;
-		if(rmd->ar->sizey==0) 
+		if (rmd->ar->sizey==0) 
 			rmd->ar->sizey= rmd->ar->type->prefsizey;
 		
 		/* now copy to regionmovedata */
-		if(rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT) {
+		if (rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT) {
 			rmd->origval= rmd->ar->sizex;
-		} else {
+		}
+		else {
 			rmd->origval= rmd->ar->sizey;
 		}
 		
@@ -1671,11 +1668,11 @@ static int region_scale_get_maxsize(RegionMoveData *rmd)
 {
 	int maxsize= 0;
 
-	if(rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT) {
+	if (rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT) {
 		return rmd->sa->winx - UI_UNIT_X;
 	}
 
-	if(rmd->ar->regiontype == RGN_TYPE_TOOL_PROPS) {
+	if (rmd->ar->regiontype == RGN_TYPE_TOOL_PROPS) {
 		/* this calculation seems overly verbose
 		 * can someone explain why this method is necessary? - campbell */
 		maxsize = rmd->maxsize - ((rmd->sa->headertype==HEADERTOP)?UI_UNIT_Y*2:UI_UNIT_Y) - (UI_UNIT_Y/4);
@@ -1686,18 +1683,18 @@ static int region_scale_get_maxsize(RegionMoveData *rmd)
 
 static void region_scale_validate_size(RegionMoveData *rmd)
 {
-	if((rmd->ar->flag & RGN_FLAG_HIDDEN)==0) {
+	if ((rmd->ar->flag & RGN_FLAG_HIDDEN)==0) {
 		short *size, maxsize= -1;
 
 
-		if(rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT)
+		if (rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT)
 			size= &rmd->ar->sizex;
 		else
 			size= &rmd->ar->sizey;
 
 		maxsize= region_scale_get_maxsize(rmd);
 
-		if(*size > maxsize && maxsize > 0)
+		if (*size > maxsize && maxsize > 0)
 			*size= maxsize;
 	}
 }
@@ -1717,25 +1714,25 @@ static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event)
 	switch(event->type) {
 		case MOUSEMOVE:
 			
-			if(rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT) {
+			if (rmd->edge==AE_LEFT_TO_TOPRIGHT || rmd->edge==AE_RIGHT_TO_TOPLEFT) {
 				delta= event->x - rmd->origx;
-				if(rmd->edge==AE_LEFT_TO_TOPRIGHT) delta= -delta;
+				if (rmd->edge==AE_LEFT_TO_TOPRIGHT) delta= -delta;
 				
 				rmd->ar->sizex= rmd->origval + delta;
 				CLAMP(rmd->ar->sizex, 0, rmd->maxsize);
 				
-				if(rmd->ar->sizex < UI_UNIT_X) {
+				if (rmd->ar->sizex < UI_UNIT_X) {
 					rmd->ar->sizex= rmd->origval;
-					if(!(rmd->ar->flag & RGN_FLAG_HIDDEN))
+					if (!(rmd->ar->flag & RGN_FLAG_HIDDEN))
 						region_scale_toggle_hidden(C, rmd);
 				}
-				else if(rmd->ar->flag & RGN_FLAG_HIDDEN)
+				else if (rmd->ar->flag & RGN_FLAG_HIDDEN)
 					region_scale_toggle_hidden(C, rmd);
 			}
 			else {
 				int maxsize= region_scale_get_maxsize(rmd);
 				delta= event->y - rmd->origy;
-				if(rmd->edge==AE_BOTTOM_TO_TOPLEFT) delta= -delta;
+				if (rmd->edge==AE_BOTTOM_TO_TOPLEFT) delta= -delta;
 				
 				rmd->ar->sizey= rmd->origval + delta;
 				CLAMP(rmd->ar->sizey, 0, rmd->maxsize);
@@ -1743,14 +1740,14 @@ static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event)
 				/* note, 'UI_UNIT_Y/4' means you need to drag the header almost
 				 * all the way down for it to become hidden, this is done
 				 * otherwise its too easy to do this by accident */
-				if(rmd->ar->sizey < UI_UNIT_Y/4) {
+				if (rmd->ar->sizey < UI_UNIT_Y/4) {
 					rmd->ar->sizey= rmd->origval;
-					if(!(rmd->ar->flag & RGN_FLAG_HIDDEN))
+					if (!(rmd->ar->flag & RGN_FLAG_HIDDEN))
 						region_scale_toggle_hidden(C, rmd);
 				}
-				else if(maxsize > 0 && (rmd->ar->sizey > maxsize)) 
+				else if (maxsize > 0 && (rmd->ar->sizey > maxsize)) 
 					rmd->ar->sizey= maxsize;
-				else if(rmd->ar->flag & RGN_FLAG_HIDDEN)
+				else if (rmd->ar->flag & RGN_FLAG_HIDDEN)
 					region_scale_toggle_hidden(C, rmd);
 			}
 			ED_area_tag_redraw(rmd->sa);
@@ -1759,13 +1756,13 @@ static int region_scale_modal(bContext *C, wmOperator *op, wmEvent *event)
 			break;
 			
 		case LEFTMOUSE:
-			if(event->val==KM_RELEASE) {
+			if (event->val==KM_RELEASE) {
 				
-				if(ABS(event->x - rmd->origx) < 2 && ABS(event->y - rmd->origy) < 2) {
-					if(rmd->ar->flag & RGN_FLAG_HIDDEN) {
+				if (ABS(event->x - rmd->origx) < 2 && ABS(event->y - rmd->origy) < 2) {
+					if (rmd->ar->flag & RGN_FLAG_HIDDEN) {
 						region_scale_toggle_hidden(C, rmd);
 					}
-					else if(rmd->ar->flag & RGN_FLAG_TOO_SMALL) {
+					else if (rmd->ar->flag & RGN_FLAG_TOO_SMALL) {
 						region_scale_validate_size(rmd);
 					}
 
@@ -1797,17 +1794,17 @@ static int region_scale_cancel(bContext *UNUSED(C), wmOperator *op)
 static void SCREEN_OT_region_scale(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Scale Region Size";
-	ot->description= "Scale selected area";
-	ot->idname= "SCREEN_OT_region_scale";
+	ot->name = "Scale Region Size";
+	ot->description = "Scale selected area";
+	ot->idname = "SCREEN_OT_region_scale";
 	
-	ot->invoke= region_scale_invoke;
-	ot->modal= region_scale_modal;
-	ot->cancel= region_scale_cancel;
+	ot->invoke = region_scale_invoke;
+	ot->modal = region_scale_modal;
+	ot->cancel = region_scale_cancel;
 	
-	ot->poll= ED_operator_areaactive;
+	ot->poll = ED_operator_areaactive;
 	
-	ot->flag= OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_BLOCKING;
 }
 
 
@@ -1838,10 +1835,10 @@ static void SCREEN_OT_frame_offset(wmOperatorType *ot)
 	ot->name = "Frame Offset";
 	ot->idname = "SCREEN_OT_frame_offset";
 	
-	ot->exec= frame_offset_exec;
+	ot->exec = frame_offset_exec;
 	
-	ot->poll= ED_operator_screenactive_norender;
-	ot->flag= 0;
+	ot->poll = ED_operator_screenactive_norender;
+	ot->flag = 0;
 	
 	/* rna */
 	RNA_def_int(ot->srna, "delta", 0, INT_MIN, INT_MAX, "Delta", "", INT_MIN, INT_MAX);
@@ -1859,7 +1856,7 @@ static int frame_jump_exec(bContext *C, wmOperator *op)
 	 * first/last frame not to be actually shown (bad since for example physics
 	 * simulations aren't reset properly).
 	 */
-	if(animtimer) {
+	if (animtimer) {
 		ScreenAnimData *sad = animtimer->customdata;
 		
 		sad->flag |= ANIMPLAY_FLAG_USE_NEXT_FRAME;
@@ -1886,13 +1883,13 @@ static int frame_jump_exec(bContext *C, wmOperator *op)
 static void SCREEN_OT_frame_jump(wmOperatorType *ot)
 {
 	ot->name = "Jump to Endpoint";
-	ot->description= "Jump to first/last frame in frame range";
+	ot->description = "Jump to first/last frame in frame range";
 	ot->idname = "SCREEN_OT_frame_jump";
 	
-	ot->exec= frame_jump_exec;
+	ot->exec = frame_jump_exec;
 	
-	ot->poll= ED_operator_screenactive_norender;
-	ot->flag= OPTYPE_UNDO;
+	ot->poll = ED_operator_screenactive_norender;
+	ot->flag = OPTYPE_UNDO;
 	
 	/* rna */
 	RNA_def_boolean(ot->srna, "end", 0, "Last Frame", "Jump to the last frame of the frame range");
@@ -1969,13 +1966,13 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op)
 static void SCREEN_OT_keyframe_jump(wmOperatorType *ot)
 {
 	ot->name = "Jump to Keyframe";
-	ot->description= "Jump to previous/next keyframe";
+	ot->description = "Jump to previous/next keyframe";
 	ot->idname = "SCREEN_OT_keyframe_jump";
 	
-	ot->exec= keyframe_jump_exec;
+	ot->exec = keyframe_jump_exec;
 	
-	ot->poll= ED_operator_screenactive_norender;
-	ot->flag= OPTYPE_UNDO;
+	ot->poll = ED_operator_screenactive_norender;
+	ot->flag = OPTYPE_UNDO;
 	
 	/* rna */
 	RNA_def_boolean(ot->srna, "next", 1, "Next Keyframe", "");
@@ -1995,22 +1992,22 @@ static int screen_set_exec(bContext *C, wmOperator *op)
 	int delta= RNA_int_get(op->ptr, "delta");
 	
 	/* temp screens are for userpref or render display */
-	if(screen->temp)
+	if (screen->temp)
 		return OPERATOR_CANCELLED;
 	
-	if(delta==1) {
-		while(tot--) {
+	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= CTX_data_main(C)->screen.first;
+			if (screen->winid==0 && screen->full==0 && screen != screen_prev)
 				break;
 		}
 	}
-	else if(delta== -1) {
-		while(tot--) {
+	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= CTX_data_main(C)->screen.last;
+			if (screen->winid==0 && screen->full==0 && screen != screen_prev)
 				break;
 		}
 	}
@@ -2018,9 +2015,9 @@ static int screen_set_exec(bContext *C, wmOperator *op)
 		screen= NULL;
 	}
 	
-	if(screen && screen_prev != screen) {
+	if (screen && screen_prev != screen) {
 		/* return to previous state before switching screens */
-		if(sa && sa->full) {
+		if (sa && sa->full) {
 			ED_screen_full_restore(C, sa); /* may free 'screen_prev' */
 		}
 		
@@ -2033,11 +2030,11 @@ static int screen_set_exec(bContext *C, wmOperator *op)
 static void SCREEN_OT_screen_set(wmOperatorType *ot)
 {
 	ot->name = "Set Screen";
-	ot->description= "Cycle through available screens";
+	ot->description = "Cycle through available screens";
 	ot->idname = "SCREEN_OT_screen_set";
 	
-	ot->exec= screen_set_exec;
-	ot->poll= ED_operator_screenactive;
+	ot->exec = screen_set_exec;
+	ot->poll = ED_operator_screenactive;
 	
 	/* rna */
 	RNA_def_int(ot->srna, "delta", 0, INT_MIN, INT_MAX, "Delta", "", INT_MIN, INT_MAX);
@@ -2058,7 +2055,7 @@ static int screen_full_area_exec(bContext *C, wmOperator *UNUSED(op))
 		if (sa->full) break;
 	}
 	
-	if(sa==NULL) sa= CTX_wm_area(C);
+	if (sa==NULL) sa= CTX_wm_area(C);
 	
 	ED_screen_full_toggle(C, CTX_wm_window(C), sa);
 	return OPERATOR_FINISHED;
@@ -2067,12 +2064,12 @@ static int screen_full_area_exec(bContext *C, wmOperator *UNUSED(op))
 static void SCREEN_OT_screen_full_area(wmOperatorType *ot)
 {
 	ot->name = "Toggle Full Screen";
-	ot->description= "Toggle display selected area as fullscreen";
+	ot->description = "Toggle display selected area as fullscreen";
 	ot->idname = "SCREEN_OT_screen_full_area";
 	
-	ot->exec= screen_full_area_exec;
-	ot->poll= ED_operator_areaactive;
-	ot->flag= 0;
+	ot->exec = screen_full_area_exec;
+	ot->poll = ED_operator_areaactive;
+	ot->flag = 0;
 	
 }
 
@@ -2081,31 +2078,30 @@ static void SCREEN_OT_screen_full_area(wmOperatorType *ot)
 /* ************** join area operator ********************************************** */
 
 /* operator state vars used:  
- x1, y1     mouse coord in first area, which will disappear
- x2, y2     mouse coord in 2nd area, which will become joined
- 
- functions:
- 
- init()   find edge based on state vars 
- test if the edge divides two areas, 
- store active and nonactive area,
- 
- apply()  do the actual join
- 
- exit()	cleanup, send notifier
- 
- callbacks:
- 
- exec()	calls init, apply, exit 
- 
- invoke() sets mouse coords in x,y
- call init()
- add modal handler
- 
- modal()	accept modal events while doing it
- call apply() with active window and nonactive window
- call exit() and remove handler when LMB confirm
- 
+ * x1, y1     mouse coord in first area, which will disappear
+ * x2, y2     mouse coord in 2nd area, which will become joined
+ * 
+ * functions:
+ * 
+ * init()   find edge based on state vars 
+ * test if the edge divides two areas, 
+ * store active and nonactive area,
+ * 
+ * apply()  do the actual join
+ * 
+ * exit()	cleanup, send notifier
+ * 
+ * callbacks:
+ * 
+ * exec()	calls init, apply, exit 
+ * 
+ * invoke() sets mouse coords in x,y
+ * call init()
+ * add modal handler
+ * 
+ * modal()	accept modal events while doing it
+ * call apply() with active window and nonactive window
+ * call exit() and remove handler when LMB confirm
  */
 
 typedef struct sAreaJoinData
@@ -2136,15 +2132,15 @@ static int area_join_init(bContext *C, wmOperator *op)
 	
 	sa1 = screen_areahascursor(CTX_wm_screen(C), x1, y1);
 	sa2 = screen_areahascursor(CTX_wm_screen(C), x2, y2);
-	if(sa1==NULL || sa2==NULL || sa1==sa2)
+	if (sa1==NULL || sa2==NULL || sa1==sa2)
 		return 0;
 	
 	/* do areas share an edge? */
-	if(sa1->v1==sa2->v1 || sa1->v1==sa2->v2 || sa1->v1==sa2->v3 || sa1->v1==sa2->v4) shared++; 
-	if(sa1->v2==sa2->v1 || sa1->v2==sa2->v2 || sa1->v2==sa2->v3 || sa1->v2==sa2->v4) shared++; 
-	if(sa1->v3==sa2->v1 || sa1->v3==sa2->v2 || sa1->v3==sa2->v3 || sa1->v3==sa2->v4) shared++; 
-	if(sa1->v4==sa2->v1 || sa1->v4==sa2->v2 || sa1->v4==sa2->v3 || sa1->v4==sa2->v4) shared++; 
-	if(shared!=2) {
+	if (sa1->v1==sa2->v1 || sa1->v1==sa2->v2 || sa1->v1==sa2->v3 || sa1->v1==sa2->v4) shared++; 
+	if (sa1->v2==sa2->v1 || sa1->v2==sa2->v2 || sa1->v2==sa2->v3 || sa1->v2==sa2->v4) shared++; 
+	if (sa1->v3==sa2->v1 || sa1->v3==sa2->v2 || sa1->v3==sa2->v3 || sa1->v3==sa2->v4) shared++; 
+	if (sa1->v4==sa2->v1 || sa1->v4==sa2->v2 || sa1->v4==sa2->v3 || sa1->v4==sa2->v4) shared++; 
+	if (shared!=2) {
 		printf("areas don't share edge\n");
 		return 0;
 	}
@@ -2167,7 +2163,7 @@ static int area_join_apply(bContext *C, wmOperator *op)
 	sAreaJoinData *jd = (sAreaJoinData *)op->customdata;
 	if (!jd) return 0;
 	
-	if(!screen_area_join(C, CTX_wm_screen(C), jd->sa1, jd->sa2)){
+	if (!screen_area_join(C, CTX_wm_screen(C), jd->sa1, jd->sa2)) {
 		return 0;
 	}
 	if (CTX_wm_area(C) == jd->sa2) {
@@ -2194,7 +2190,7 @@ static void area_join_exit(bContext *C, wmOperator *op)
 
 static int area_join_exec(bContext *C, wmOperator *op)
 {
-	if(!area_join_init(C, op)) 
+	if (!area_join_init(C, op)) 
 		return OPERATOR_CANCELLED;
 	
 	area_join_apply(C, op);
@@ -2207,19 +2203,19 @@ static int area_join_exec(bContext *C, wmOperator *op)
 static int area_join_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 	
-	if(event->type==EVT_ACTIONZONE_AREA) {
+	if (event->type==EVT_ACTIONZONE_AREA) {
 		sActionzoneData *sad= event->customdata;
 		
-		if(sad->modifier>0) {
+		if (sad->modifier>0) {
 			return OPERATOR_PASS_THROUGH;
 		}
 		
 		/* verify *sad itself */
-		if(sad==NULL || sad->sa1==NULL || sad->sa2==NULL)
+		if (sad==NULL || sad->sa1==NULL || sad->sa2==NULL)
 			return OPERATOR_PASS_THROUGH;
 		
 		/* is this our *sad? if areas equal it should be passed on */
-		if(sad->sa1==sad->sa2)
+		if (sad->sa1==sad->sa2)
 			return OPERATOR_PASS_THROUGH;
 		
 		/* prepare operator state vars */
@@ -2230,7 +2226,7 @@ static int area_join_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	}
 	
 	
-	if(!area_join_init(C, op)) 
+	if (!area_join_init(C, op)) 
 		return OPERATOR_PASS_THROUGH;
 	
 	/* add temp handler */
@@ -2283,8 +2279,8 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
 					} 
 					else {
 						/* we are not bordering on the previously selected area 
-						 we check if area has common border with the one marked for removal
-						 in this case we can swap areas.
+						 * we check if area has common border with the one marked for removal
+						 * in this case we can swap areas.
 						 */
 						dir = area_getorientation(sa, jd->sa2);
 						if (dir >= 0) {
@@ -2331,7 +2327,7 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
 		}
 			break;
 		case LEFTMOUSE:
-			if(event->val==KM_RELEASE) {
+			if (event->val==KM_RELEASE) {
 				ED_area_tag_redraw(jd->sa1);
 				ED_area_tag_redraw(jd->sa2);
 
@@ -2354,18 +2350,18 @@ static int area_join_modal(bContext *C, wmOperator *op, wmEvent *event)
 static void SCREEN_OT_area_join(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Join area";
-	ot->description= "Join selected areas into new window";
-	ot->idname= "SCREEN_OT_area_join";
+	ot->name = "Join area";
+	ot->description = "Join selected areas into new window";
+	ot->idname = "SCREEN_OT_area_join";
 	
 	/* api callbacks */
-	ot->exec= area_join_exec;
-	ot->invoke= area_join_invoke;
-	ot->modal= area_join_modal;
-	ot->poll= screen_active_editable;
-	ot->cancel= area_join_cancel;
+	ot->exec = area_join_exec;
+	ot->invoke = area_join_invoke;
+	ot->modal = area_join_modal;
+	ot->poll = screen_active_editable;
+	ot->cancel = area_join_cancel;
 	
-	ot->flag= OPTYPE_BLOCKING|OPTYPE_INTERNAL;
+	ot->flag = OPTYPE_BLOCKING|OPTYPE_INTERNAL;
 	
 	/* rna */
 	RNA_def_int(ot->srna, "min_x", -100, INT_MIN, INT_MAX, "X 1", "", INT_MIN, INT_MAX);
@@ -2383,7 +2379,7 @@ static int screen_area_options_invoke(bContext *C, wmOperator *op, wmEvent *even
 	PointerRNA ptr1, ptr2;
 	ScrEdge *actedge= screen_find_active_scredge(CTX_wm_screen(C), event->x, event->y);
 	
-	if(actedge==NULL) return OPERATOR_CANCELLED;
+	if (actedge==NULL) return OPERATOR_CANCELLED;
 	
 	pup= uiPupMenuBegin(C, op->type->name, ICON_NONE);
 	layout= uiPupMenuLayout(pup);
@@ -2413,14 +2409,14 @@ static int screen_area_options_invoke(bContext *C, wmOperator *op, wmEvent *even
 static void SCREEN_OT_area_options(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Area Options";
-	ot->description= "Operations for splitting and merging";
-	ot->idname= "SCREEN_OT_area_options";
+	ot->name = "Area Options";
+	ot->description = "Operations for splitting and merging";
+	ot->idname = "SCREEN_OT_area_options";
 	
 	/* api callbacks */
-	ot->invoke= screen_area_options_invoke;
+	ot->invoke = screen_area_options_invoke;
 	
-	ot->poll= ED_operator_screen_mainwinactive;
+	ot->poll = ED_operator_screen_mainwinactive;
 }
 
 
@@ -2434,9 +2430,9 @@ static int spacedata_cleanup(bContext *C, wmOperator *op)
 	ScrArea *sa;
 	int tot= 0;
 	
-	for(screen= bmain->screen.first; screen; screen= screen->id.next) {
-		for(sa= screen->areabase.first; sa; sa= sa->next) {
-			if(sa->spacedata.first != sa->spacedata.last) {
+	for (screen= bmain->screen.first; screen; screen= screen->id.next) {
+		for (sa= screen->areabase.first; sa; sa= sa->next) {
+			if (sa->spacedata.first != sa->spacedata.last) {
 				SpaceLink *sl= sa->spacedata.first;
 
 				BLI_remlink(&sa->spacedata, sl);
@@ -2454,13 +2450,13 @@ static int spacedata_cleanup(bContext *C, wmOperator *op)
 static void SCREEN_OT_spacedata_cleanup(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clean-up space-data";
-	ot->description= "Remove unused settings for invisible editors";
-	ot->idname= "SCREEN_OT_spacedata_cleanup";
+	ot->name = "Clean-up space-data";
+	ot->description = "Remove unused settings for invisible editors";
+	ot->idname = "SCREEN_OT_spacedata_cleanup";
 	
 	/* api callbacks */
-	ot->exec= spacedata_cleanup;
-	ot->poll= WM_operator_winactive;
+	ot->exec = spacedata_cleanup;
+	ot->poll = WM_operator_winactive;
 	
 }
 
@@ -2470,7 +2466,7 @@ static int repeat_last_exec(bContext *C, wmOperator *UNUSED(op))
 {
 	wmOperator *lastop= CTX_wm_manager(C)->operators.last;
 	
-	if(lastop)
+	if (lastop)
 		WM_operator_repeat(C, lastop);
 	
 	return OPERATOR_CANCELLED;
@@ -2479,14 +2475,14 @@ static int repeat_last_exec(bContext *C, wmOperator *UNUSED(op))
 static void SCREEN_OT_repeat_last(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Repeat Last";
-	ot->description= "Repeat last action";
-	ot->idname= "SCREEN_OT_repeat_last";
+	ot->name = "Repeat Last";
+	ot->description = "Repeat last action";
+	ot->idname = "SCREEN_OT_repeat_last";
 	
 	/* api callbacks */
-	ot->exec= repeat_last_exec;
+	ot->exec = repeat_last_exec;
 	
-	ot->poll= ED_operator_screenactive;
+	ot->poll = ED_operator_screenactive;
 	
 }
 
@@ -2499,7 +2495,7 @@ static int repeat_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev
 	int items, i;
 	
 	items= BLI_countlist(&wm->operators);
-	if(items==0)
+	if (items==0)
 		return OPERATOR_CANCELLED;
 	
 	pup= uiPupMenuBegin(C, op->type->name, ICON_NONE);
@@ -2518,7 +2514,7 @@ static int repeat_history_exec(bContext *C, wmOperator *op)
 	wmWindowManager *wm= CTX_wm_manager(C);
 	
 	op= BLI_findlink(&wm->operators, RNA_int_get(op->ptr, "index"));
-	if(op) {
+	if (op) {
 		/* let's put it as last operator in list */
 		BLI_remlink(&wm->operators, op);
 		BLI_addtail(&wm->operators, op);
@@ -2532,15 +2528,15 @@ static int repeat_history_exec(bContext *C, wmOperator *op)
 static void SCREEN_OT_repeat_history(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Repeat History";
-	ot->description= "Display menu for previous actions performed";
-	ot->idname= "SCREEN_OT_repeat_history";
+	ot->name = "Repeat History";
+	ot->description = "Display menu for previous actions performed";
+	ot->idname = "SCREEN_OT_repeat_history";
 	
 	/* api callbacks */
-	ot->invoke= repeat_history_invoke;
-	ot->exec= repeat_history_exec;
+	ot->invoke = repeat_history_invoke;
+	ot->exec = repeat_history_exec;
 	
-	ot->poll= ED_operator_screenactive;
+	ot->poll = ED_operator_screenactive;
 	
 	RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "", 0, 1000);
 }
@@ -2551,7 +2547,7 @@ static int redo_last_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED
 {
 	wmOperator *lastop= WM_operator_last_redo(C);
 	
-	if(lastop)
+	if (lastop)
 		WM_operator_redo_popup(C, lastop);
 	
 	return OPERATOR_CANCELLED;
@@ -2560,14 +2556,14 @@ static int redo_last_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED
 static void SCREEN_OT_redo_last(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Redo Last";
-	ot->description= "Display menu for last action performed";
-	ot->idname= "SCREEN_OT_redo_last";
+	ot->name = "Redo Last";
+	ot->description = "Display menu for last action performed";
+	ot->idname = "SCREEN_OT_redo_last";
 	
 	/* api callbacks */
-	ot->invoke= redo_last_invoke;
+	ot->invoke = redo_last_invoke;
 	
-	ot->poll= ED_operator_screenactive;
+	ot->poll = ED_operator_screenactive;
 }
 
 /* ************** region four-split operator ***************************** */
@@ -2578,24 +2574,24 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
 	ARegion *ar= CTX_wm_region(C);
 	
 	/* some rules... */
-	if(ar->regiontype!=RGN_TYPE_WINDOW)
+	if (ar->regiontype!=RGN_TYPE_WINDOW)
 		BKE_report(op->reports, RPT_ERROR, "Only window region can be 4-splitted");
-	else if(ar->alignment==RGN_ALIGN_QSPLIT) {
+	else if (ar->alignment==RGN_ALIGN_QSPLIT) {
 		ScrArea *sa= CTX_wm_area(C);
 		ARegion *arn;
 		
 		/* keep current region */
 		ar->alignment= 0;
 		
-		if(sa->spacetype==SPACE_VIEW3D) {
+		if (sa->spacetype==SPACE_VIEW3D) {
 			RegionView3D *rv3d= ar->regiondata;
 			rv3d->viewlock= 0;
 			rv3d->rflag &= ~RV3D_CLIPPING;
 		}
 		
-		for(ar= sa->regionbase.first; ar; ar= arn) {
+		for (ar= sa->regionbase.first; ar; ar= arn) {
 			arn= ar->next;
-			if(ar->alignment==RGN_ALIGN_QSPLIT) {
+			if (ar->alignment==RGN_ALIGN_QSPLIT) {
 				ED_region_exit(C, ar);
 				BKE_area_region_free(sa->type, ar);
 				BLI_remlink(&sa->regionbase, ar);
@@ -2605,7 +2601,7 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
 		ED_area_tag_redraw(sa);
 		WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
 	}
-	else if(ar->next)
+	else if (ar->next)
 		BKE_report(op->reports, RPT_ERROR, "Only last region can be 4-splitted");
 	else {
 		ScrArea *sa= CTX_wm_area(C);
@@ -2614,13 +2610,13 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
 		
 		ar->alignment= RGN_ALIGN_QSPLIT;
 		
-		for(count=0; count<3; count++) {
+		for (count=0; count<3; count++) {
 			newar= BKE_area_region_copy(sa->type, ar);
 			BLI_addtail(&sa->regionbase, newar);
 		}
 		
 		/* lock views and set them */
-		if(sa->spacetype==SPACE_VIEW3D) {
+		if (sa->spacetype==SPACE_VIEW3D) {
 			/* 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],
@@ -2663,15 +2659,15 @@ static int region_quadview_exec(bContext *C, wmOperator *op)
 static void SCREEN_OT_region_quadview(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Toggle Quad View";
-	ot->description= "Split selected area into camera, front, right & top views";
-	ot->idname= "SCREEN_OT_region_quadview";
+	ot->name = "Toggle Quad View";
+	ot->description = "Split selected area into camera, front, right & top views";
+	ot->idname = "SCREEN_OT_region_quadview";
 	
 	/* api callbacks */
-	//	ot->invoke= WM_operator_confirm;
-	ot->exec= region_quadview_exec;
-	ot->poll= ED_operator_region_view3d_active;
-	ot->flag= 0;
+	//	ot->invoke = WM_operator_confirm;
+	ot->exec = region_quadview_exec;
+	ot->poll = ED_operator_region_view3d_active;
+	ot->flag = 0;
 }
 
 
@@ -2686,13 +2682,13 @@ static int region_flip_exec(bContext *C, wmOperator *UNUSED(op))
 	if (!ar)
 		return OPERATOR_CANCELLED;
 	
-	if(ar->alignment==RGN_ALIGN_TOP)
+	if (ar->alignment==RGN_ALIGN_TOP)
 		ar->alignment= RGN_ALIGN_BOTTOM;
-	else if(ar->alignment==RGN_ALIGN_BOTTOM)
+	else if (ar->alignment==RGN_ALIGN_BOTTOM)
 		ar->alignment= RGN_ALIGN_TOP;
-	else if(ar->alignment==RGN_ALIGN_LEFT)
+	else if (ar->alignment==RGN_ALIGN_LEFT)
 		ar->alignment= RGN_ALIGN_RIGHT;
-	else if(ar->alignment==RGN_ALIGN_RIGHT)
+	else if (ar->alignment==RGN_ALIGN_RIGHT)
 		ar->alignment= RGN_ALIGN_LEFT;
 
 	ED_area_tag_redraw(CTX_wm_area(C));
@@ -2705,13 +2701,13 @@ static int region_flip_exec(bContext *C, wmOperator *UNUSED(op))
 static void SCREEN_OT_region_flip(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Flip Region";
-	ot->idname= "SCREEN_OT_region_flip";
+	ot->name = "Flip Region";
+	ot->idname = "SCREEN_OT_region_flip";
 	
 	/* api callbacks */
-	ot->exec= region_flip_exec;
-	ot->poll= ED_operator_areaactive;
-	ot->flag= 0;
+	ot->exec = region_flip_exec;
+	ot->poll = ED_operator_areaactive;
+	ot->flag = 0;
 }
 
 /* ************** header flip operator ***************************** */
@@ -2724,23 +2720,23 @@ static int header_flip_exec(bContext *C, wmOperator *UNUSED(op))
 	/* find the header region 
 	 *	- try context first, but upon failing, search all regions in area...
 	 */
-	if((ar == NULL) || (ar->regiontype != RGN_TYPE_HEADER)) {
+	if ((ar == NULL) || (ar->regiontype != RGN_TYPE_HEADER)) {
 		ScrArea *sa= CTX_wm_area(C);
 		ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
 
 		/* don't do anything if no region */
-		if(ar == NULL)
+		if (ar == NULL)
 			return OPERATOR_CANCELLED;
 	}	
 	
 	/* copied from SCREEN_OT_region_flip */
-	if(ar->alignment==RGN_ALIGN_TOP)
+	if (ar->alignment==RGN_ALIGN_TOP)
 		ar->alignment= RGN_ALIGN_BOTTOM;
-	else if(ar->alignment==RGN_ALIGN_BOTTOM)
+	else if (ar->alignment==RGN_ALIGN_BOTTOM)
 		ar->alignment= RGN_ALIGN_TOP;
-	else if(ar->alignment==RGN_ALIGN_LEFT)
+	else if (ar->alignment==RGN_ALIGN_LEFT)
 		ar->alignment= RGN_ALIGN_RIGHT;
-	else if(ar->alignment==RGN_ALIGN_RIGHT)
+	else if (ar->alignment==RGN_ALIGN_RIGHT)
 		ar->alignment= RGN_ALIGN_LEFT;
 
 	ED_area_tag_redraw(CTX_wm_area(C));
@@ -2754,14 +2750,14 @@ static int header_flip_exec(bContext *C, wmOperator *UNUSED(op))
 static void SCREEN_OT_header_flip(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Flip Header Region";
-	ot->idname= "SCREEN_OT_header_flip";
+	ot->name = "Flip Header Region";
+	ot->idname = "SCREEN_OT_header_flip";
 	
 	/* api callbacks */
-	ot->exec= header_flip_exec;
+	ot->exec = header_flip_exec;
 	
-	ot->poll= ED_operator_areaactive;
-	ot->flag= 0;
+	ot->poll = ED_operator_areaactive;
+	ot->flag = 0;
 }
 
 /* ************** header tools operator ***************************** */
@@ -2800,12 +2796,12 @@ static int header_toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *U
 static void SCREEN_OT_header_toolbox(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Header Toolbox";
-	ot->description="Display header region toolbox";
-	ot->idname= "SCREEN_OT_header_toolbox";
+	ot->name = "Header Toolbox";
+	ot->description = "Display header region toolbox";
+	ot->idname = "SCREEN_OT_header_toolbox";
 	
 	/* api callbacks */
-	ot->invoke= header_toolbox_invoke;
+	ot->invoke = header_toolbox_invoke;
 }
 
 /* ****************** anim player, with timer ***************** */
@@ -2824,68 +2820,68 @@ static int match_area_with_refresh(int spacetype, int refresh)
 
 static int match_region_with_redraws(int spacetype, int regiontype, int redraws)
 {
-	if(regiontype==RGN_TYPE_WINDOW) {
+	if (regiontype==RGN_TYPE_WINDOW) {
 		
 		switch (spacetype) {
 			case SPACE_VIEW3D:
-				if(redraws & TIME_ALL_3D_WIN)
+				if (redraws & TIME_ALL_3D_WIN)
 					return 1;
 				break;
 			case SPACE_IPO:
 			case SPACE_ACTION:
 			case SPACE_NLA:
-				if(redraws & TIME_ALL_ANIM_WIN)
+				if (redraws & TIME_ALL_ANIM_WIN)
 					return 1;
 				break;
 			case SPACE_TIME:
 				/* if only 1 window or 3d windows, we do timeline too */
-				if(redraws & (TIME_ALL_ANIM_WIN|TIME_REGION|TIME_ALL_3D_WIN))
+				if (redraws & (TIME_ALL_ANIM_WIN|TIME_REGION|TIME_ALL_3D_WIN))
 					return 1;
 				break;
 			case SPACE_BUTS:
-				if(redraws & TIME_ALL_BUTS_WIN)
+				if (redraws & TIME_ALL_BUTS_WIN)
 					return 1;
 				break;
 			case SPACE_SEQ:
-				if(redraws & (TIME_SEQ|TIME_ALL_ANIM_WIN))
+				if (redraws & (TIME_SEQ|TIME_ALL_ANIM_WIN))
 					return 1;
 				break;
 			case SPACE_NODE:
-				if(redraws & (TIME_NODES))
+				if (redraws & (TIME_NODES))
 					return 1;
 				break;
 			case SPACE_IMAGE:
-				if(redraws & TIME_ALL_IMAGE_WIN)
+				if (redraws & TIME_ALL_IMAGE_WIN)
 					return 1;
 				break;
 			case SPACE_CLIP:
-				if(redraws & TIME_CLIPS)
+				if (redraws & TIME_CLIPS)
 					return 1;
 				break;
 				
 		}
 	}
-	else if(regiontype==RGN_TYPE_UI) {
-		if(spacetype==SPACE_CLIP) {
+	else if (regiontype==RGN_TYPE_UI) {
+		if (spacetype==SPACE_CLIP) {
 			/* Track Preview button is on Properties Editor in SpaceClip,
-			   and it's very common case when users want it be refreshing
-			   during playback, so asking people to enable special option
-			   for this is a bit ticky, so add exception here for refreshing
-			   Properties Editor for SpaceClip always */
+			 * and it's very common case when users want it be refreshing
+			 * during playback, so asking people to enable special option
+			 * for this is a bit tricky, so add exception here for refreshing
+			 * Properties Editor for SpaceClip always */
 			return 1;
 		}
 
-		if(redraws & TIME_ALL_BUTS_WIN)
+		if (redraws & TIME_ALL_BUTS_WIN)
 			return 1;
 	}
-	else if(regiontype==RGN_TYPE_HEADER) {
-		if(spacetype==SPACE_TIME)
+	else if (regiontype==RGN_TYPE_HEADER) {
+		if (spacetype==SPACE_TIME)
 			return 1;
 	}
 	else if (regiontype==RGN_TYPE_PREVIEW) {
 		switch (spacetype) {
 			case SPACE_SEQ:
-				if(redraws & (TIME_SEQ|TIME_ALL_ANIM_WIN))
+				if (redraws & (TIME_SEQ|TIME_ALL_ANIM_WIN))
 					return 1;
 				break;
 			case SPACE_CLIP:
@@ -2899,7 +2895,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
 {
 	bScreen *screen= CTX_wm_screen(C);
 
-	if(screen->animtimer && screen->animtimer==event->customdata) {
+	if (screen->animtimer && screen->animtimer==event->customdata) {
 		Main *bmain= CTX_data_main(C);
 		Scene *scene= CTX_data_scene(C);
 		wmTimer *wt= screen->animtimer;
@@ -2913,18 +2909,20 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
 		else if (sad->flag & ANIMPLAY_FLAG_NO_SYNC) sync= 0;
 		else sync= (scene->flag & SCE_FRAME_DROP);
 		
-		if((scene->audio.flag & AUDIO_SYNC) && !(sad->flag & ANIMPLAY_FLAG_REVERSE) && finite(time = sound_sync_scene(scene)))
-			scene->r.cfra = (double)time * FPS + 0.5;
-		else
+		if ((scene->audio.flag & AUDIO_SYNC) &&
+		    (sad->flag & ANIMPLAY_FLAG_REVERSE) == FALSE &&
+		    finite(time = sound_sync_scene(scene)))
 		{
+			scene->r.cfra = (double)time * FPS + 0.5;
+		}
+		else {
 			if (sync) {
-				int step = floor(wt->duration * FPS);
+				int step = floor((wt->duration - sad->last_duration) * FPS);
 				/* skip frames */
 				if (sad->flag & ANIMPLAY_FLAG_REVERSE)
 					scene->r.cfra -= step;
 				else
 					scene->r.cfra += step;
-				wt->duration -= ((double)step)/FPS;
 			}
 			else {
 				/* one frame +/- */
@@ -2935,6 +2933,8 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
 			}
 		}
 		
+		sad->last_duration = wt->duration;
+
 		/* reset 'jumped' flag before checking if we need to jump... */
 		sad->flag &= ~ANIMPLAY_FLAG_JUMPED;
 		
@@ -2970,7 +2970,7 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
 		}
 
 		/* next frame overriden by user action (pressed jump to first/last frame) */
-		if(sad->flag & ANIMPLAY_FLAG_USE_NEXT_FRAME) {
+		if (sad->flag & ANIMPLAY_FLAG_USE_NEXT_FRAME) {
 			scene->r.cfra = sad->nextfra;
 			sad->flag &= ~ANIMPLAY_FLAG_USE_NEXT_FRAME;
 			sad->flag |= ANIMPLAY_FLAG_JUMPED;
@@ -3016,14 +3016,14 @@ static int screen_animation_step(bContext *C, wmOperator *UNUSED(op), wmEvent *e
 static void SCREEN_OT_animation_step(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Animation Step";
-	ot->description= "Step through animation by position";
-	ot->idname= "SCREEN_OT_animation_step";
+	ot->name = "Animation Step";
+	ot->description = "Step through animation by position";
+	ot->idname = "SCREEN_OT_animation_step";
 	
 	/* api callbacks */
-	ot->invoke= screen_animation_step;
+	ot->invoke = screen_animation_step;
 	
-	ot->poll= ED_operator_screenactive_norender;
+	ot->poll = ED_operator_screenactive_norender;
 	
 }
 
@@ -3072,18 +3072,22 @@ static int screen_animation_play_exec(bContext *C, wmOperator *op)
 
 static void SCREEN_OT_animation_play(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+
 	/* identifiers */
-	ot->name= "Play Animation";
-	ot->description= "Play animation";
-	ot->idname= "SCREEN_OT_animation_play";
+	ot->name = "Play Animation";
+	ot->description = "Play animation";
+	ot->idname = "SCREEN_OT_animation_play";
 	
 	/* api callbacks */
-	ot->exec= screen_animation_play_exec;
+	ot->exec = screen_animation_play_exec;
 	
-	ot->poll= ED_operator_screenactive_norender;
+	ot->poll = ED_operator_screenactive_norender;
 	
-	RNA_def_boolean(ot->srna, "reverse", 0, "Play in Reverse", "Animation is played backwards");
-	RNA_def_boolean(ot->srna, "sync", 0, "Sync", "Drop frames to maintain framerate");
+	prop = RNA_def_boolean(ot->srna, "reverse", 0, "Play in Reverse", "Animation is played backwards");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+	prop = RNA_def_boolean(ot->srna, "sync", 0, "Sync", "Drop frames to maintain framerate");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 }
 
 static int screen_animation_cancel_exec(bContext *C, wmOperator *op)
@@ -3091,7 +3095,7 @@ static int screen_animation_cancel_exec(bContext *C, wmOperator *op)
 	bScreen *screen= CTX_wm_screen(C);
 
 	if (screen->animtimer) {
-		if(RNA_boolean_get(op->ptr, "restore_frame")) {
+		if (RNA_boolean_get(op->ptr, "restore_frame")) {
 			ScreenAnimData *sad= screen->animtimer->customdata;
 			Scene *scene= CTX_data_scene(C);
 
@@ -3113,14 +3117,14 @@ static int screen_animation_cancel_exec(bContext *C, wmOperator *op)
 static void SCREEN_OT_animation_cancel(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Cancel Animation";
-	ot->description= "Cancel animation, returning to the original frame";
-	ot->idname= "SCREEN_OT_animation_cancel";
+	ot->name = "Cancel Animation";
+	ot->description = "Cancel animation, returning to the original frame";
+	ot->idname = "SCREEN_OT_animation_cancel";
 	
 	/* api callbacks */
-	ot->exec= screen_animation_cancel_exec;
+	ot->exec = screen_animation_cancel_exec;
 	
-	ot->poll= ED_operator_screenactive;
+	ot->poll = ED_operator_screenactive;
 
 	RNA_def_boolean(ot->srna, "restore_frame", TRUE, "Restore Frame", "Restore the frame when animation was initialized");
 }
@@ -3128,31 +3132,31 @@ static void SCREEN_OT_animation_cancel(wmOperatorType *ot)
 /* ************** border select operator (template) ***************************** */
 
 /* operator state vars used: (added by default WM callbacks)   
- xmin, ymin     
- xmax, ymax     
- 
- customdata: the wmGesture pointer
- 
- callbacks:
- 
- exec()	has to be filled in by user
- 
- invoke() default WM function
- adds modal handler
- 
- modal()	default WM function 
- accept modal events while doing it, calls exec(), handles ESC and border drawing
- 
- poll()	has to be filled in by user for context
+ * xmin, ymin     
+ * xmax, ymax     
+ * 
+ * customdata: the wmGesture pointer
+ * 
+ * callbacks:
+ * 
+ * exec()	has to be filled in by user
+ * 
+ * invoke() default WM function
+ * adds modal handler
+ * 
+ * modal()	default WM function 
+ * accept modal events while doing it, calls exec(), handles ESC and border drawing
+ * 
+ * poll()	has to be filled in by user for context
  */
 #if 0
 static int border_select_do(bContext *C, wmOperator *op)
 {
 	int event_type= RNA_int_get(op->ptr, "event_type");
 	
-	if(event_type==LEFTMOUSE)
+	if (event_type==LEFTMOUSE)
 		printf("border select do select\n");
-	else if(event_type==RIGHTMOUSE)
+	else if (event_type==RIGHTMOUSE)
 		printf("border select deselect\n");
 	else 
 		printf("border select do something\n");
@@ -3163,16 +3167,16 @@ static int border_select_do(bContext *C, wmOperator *op)
 static void SCREEN_OT_border_select(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Border select";
-	ot->idname= "SCREEN_OT_border_select";
+	ot->name = "Border select";
+	ot->idname = "SCREEN_OT_border_select";
 	
 	/* api callbacks */
-	ot->exec= border_select_do;
-	ot->invoke= WM_border_select_invoke;
-	ot->modal= WM_border_select_modal;
-	ot->cancel= WM_border_select_cancel;
+	ot->exec = border_select_do;
+	ot->invoke = WM_border_select_invoke;
+	ot->modal = WM_border_select_modal;
+	ot->cancel = WM_border_select_cancel;
 	
-	ot->poll= ED_operator_areaactive;
+	ot->poll = ED_operator_areaactive;
 	
 	/* rna */
 	RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX);
@@ -3209,13 +3213,13 @@ static int fullscreen_back_exec(bContext *C, wmOperator *op)
 static void SCREEN_OT_back_to_previous(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Back to Previous Screen";
-	ot->description= "Revert back to the original screen layout, before fullscreen area overlay";
-	ot->idname= "SCREEN_OT_back_to_previous";
+	ot->name = "Back to Previous Screen";
+	ot->description = "Revert back to the original screen layout, before fullscreen area overlay";
+	ot->idname = "SCREEN_OT_back_to_previous";
 	
 	/* api callbacks */
-	ot->exec= fullscreen_back_exec;
-	ot->poll= ED_operator_screenactive;
+	ot->exec = fullscreen_back_exec;
+	ot->poll = ED_operator_screenactive;
 }
 
 /* *********** show user pref window ****** */
@@ -3229,10 +3233,10 @@ static int userpref_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *ev
 	sizey= 480;
 	
 	/* some magic to calculate postition */
-	rect.xmin= event->x + CTX_wm_window(C)->posx - sizex/2;
-	rect.ymin= event->y + CTX_wm_window(C)->posy - sizey/2;
-	rect.xmax= rect.xmin + sizex;
-	rect.ymax= rect.ymin + sizey;
+	rect.xmin = event->x + CTX_wm_window(C)->posx - sizex/2;
+	rect.ymin = event->y + CTX_wm_window(C)->posy - sizey/2;
+	rect.xmax = rect.xmin + sizex;
+	rect.ymax = rect.ymin + sizey;
 	
 	/* changes context! */
 	WM_window_open_temp(C, &rect, WM_WINDOW_USERPREFS);
@@ -3244,13 +3248,13 @@ static int userpref_show_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *ev
 static void SCREEN_OT_userpref_show(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Show/Hide User Preferences";
-	ot->description= "Show/hide user preferences";
-	ot->idname= "SCREEN_OT_userpref_show";
+	ot->name = "Show/Hide User Preferences";
+	ot->description = "Show/hide user preferences";
+	ot->idname = "SCREEN_OT_userpref_show";
 	
 	/* api callbacks */
-	ot->invoke= userpref_show_invoke;
-	ot->poll= ED_operator_screenactive;
+	ot->invoke = userpref_show_invoke;
+	ot->poll = ED_operator_screenactive;
 }
 
 /********************* new screen operator *********************/
@@ -3269,16 +3273,16 @@ static int screen_new_exec(bContext *C, wmOperator *UNUSED(op))
 static void SCREEN_OT_new(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "New Screen";
-	ot->description= "Add a new screen";
-	ot->idname= "SCREEN_OT_new";
+	ot->name = "New Screen";
+	ot->description = "Add a new screen";
+	ot->idname = "SCREEN_OT_new";
 	
 	/* api callbacks */
-	ot->exec= screen_new_exec;
-	ot->poll= WM_operator_winactive;
+	ot->exec = screen_new_exec;
+	ot->poll = WM_operator_winactive;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************* delete screen operator *********************/
@@ -3295,15 +3299,15 @@ 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->description= "Delete active screen";
-	ot->idname= "SCREEN_OT_delete";
+	ot->name = "Delete Screen"; //was scene
+	ot->description = "Delete active screen";
+	ot->idname = "SCREEN_OT_delete";
 	
 	/* api callbacks */
-	ot->exec= screen_delete_exec;
+	ot->exec = screen_delete_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************* new scene operator *********************/
@@ -3314,22 +3318,22 @@ static int scene_new_exec(bContext *C, wmOperator *op)
 	Main *bmain= CTX_data_main(C);
 	int type= RNA_enum_get(op->ptr, "type");
 
-	if(type == SCE_COPY_NEW) {
+	if (type == SCE_COPY_NEW) {
 		newscene= add_scene("Scene");
 	}
 	else { /* different kinds of copying */
 		newscene= copy_scene(scene, type);
 
 		/* these can't be handled in blenkernel curently, so do them here */
-		if(type == SCE_COPY_LINK_DATA) {
+		if (type == SCE_COPY_LINK_DATA) {
 			ED_object_single_users(bmain, newscene, 0);
 		}
-		else if(type == SCE_COPY_FULL) {
+		else if (type == SCE_COPY_FULL) {
 			ED_object_single_users(bmain, newscene, 1);
 		}
 	}
 	
-	ED_screen_set_scene(C, newscene);
+	ED_screen_set_scene(C, CTX_wm_screen(C), newscene);
 	
 	WM_event_add_notifier(C, NC_SCENE|ND_SCENEBROWSE, newscene);
 	
@@ -3347,19 +3351,19 @@ static void SCENE_OT_new(wmOperatorType *ot)
 		{0, NULL, 0, NULL, NULL}};
 	
 	/* identifiers */
-	ot->name= "New Scene";
-	ot->description= "Add new scene by type";
-	ot->idname= "SCENE_OT_new";
+	ot->name = "New Scene";
+	ot->description = "Add new scene by type";
+	ot->idname = "SCENE_OT_new";
 	
 	/* api callbacks */
-	ot->exec= scene_new_exec;
-	ot->invoke= WM_menu_invoke;
+	ot->exec = scene_new_exec;
+	ot->invoke = WM_menu_invoke;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
-	ot->prop= RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "");
 }
 
 /********************* delete scene operator *********************/
@@ -3370,7 +3374,7 @@ static int scene_delete_exec(bContext *C, wmOperator *UNUSED(op))
 
 	ED_screen_delete_scene(C, scene);
 
-	if(G.f & G_DEBUG)
+	if (G.debug & G_DEBUG)
 		printf("scene delete %p\n", scene);
 
 	WM_event_add_notifier(C, NC_SCENE|NA_REMOVED, scene);
@@ -3381,15 +3385,15 @@ static int scene_delete_exec(bContext *C, wmOperator *UNUSED(op))
 static void SCENE_OT_delete(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete Scene";
-	ot->description= "Delete active scene";
-	ot->idname= "SCENE_OT_delete";
+	ot->name = "Delete Scene";
+	ot->description = "Delete active scene";
+	ot->idname = "SCENE_OT_delete";
 	
 	/* api callbacks */
-	ot->exec= scene_delete_exec;
+	ot->exec = scene_delete_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ****************  Assigning operatortypes to global list, adding handlers **************** */
@@ -3474,8 +3478,8 @@ static void keymap_modal_set(wmKeyConfig *keyconf)
 
 static int open_file_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
 {
-	if(drag->type==WM_DRAG_PATH) {
-		if(drag->icon==ICON_FILE_BLEND)
+	if (drag->type==WM_DRAG_PATH) {
+		if (drag->icon==ICON_FILE_BLEND)
 			return 1;
 	}
 	return 0;
@@ -3497,7 +3501,7 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
 	wmKeyMapItem *kmi;
 	
 	/* Screen Editing ------------------------------------------------ */
-	keymap= WM_keymap_find(keyconf, "Screen Editing", 0, 0);
+	keymap = WM_keymap_find(keyconf, "Screen Editing", 0, 0);
 	
 	RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_actionzone", LEFTMOUSE, KM_PRESS, 0, 0)->ptr, "modifier", 0);
 	RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_actionzone", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "modifier", 1);
@@ -3516,12 +3520,12 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
 	
 	
 	/* Header Editing ------------------------------------------------ */
-	keymap= WM_keymap_find(keyconf, "Header", 0, 0);
+	keymap = WM_keymap_find(keyconf, "Header", 0, 0);
 	
 	WM_keymap_add_item(keymap, "SCREEN_OT_header_toolbox", RIGHTMOUSE, KM_PRESS, 0, 0);
 	
 	/* Screen General ------------------------------------------------ */
-	keymap= WM_keymap_find(keyconf, "Screen", 0, 0);
+	keymap = WM_keymap_find(keyconf, "Screen", 0, 0);
 	
 	/* standard timers */
 	WM_keymap_add_item(keymap, "SCREEN_OT_animation_step", TIMER0, KM_ANY, KM_ANY, 0);
@@ -3575,7 +3579,7 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
 	
 	
 	/* Anim Playback ------------------------------------------------ */
-	keymap= WM_keymap_find(keyconf, "Frames", 0, 0);
+	keymap = WM_keymap_find(keyconf, "Frames", 0, 0);
 	
 	/* frame offsets */
 	RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", UPARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "delta", 10);
@@ -3591,10 +3595,15 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
 	RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", TRUE);
 	RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", FALSE);
 	
-	WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", UPARROWKEY, KM_PRESS, 0, 0);
-	RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", DOWNARROWKEY, KM_PRESS, 0, 0)->ptr, "next", FALSE);
+	kmi = WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", UPARROWKEY, KM_PRESS, 0, 0);
+	RNA_boolean_set(kmi->ptr, "next", TRUE);
+
+	kmi = WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", DOWNARROWKEY, KM_PRESS, 0, 0);
+	RNA_boolean_set(kmi->ptr, "next", FALSE);
 	
-	WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", MEDIALAST, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", MEDIALAST, KM_PRESS, 0, 0);
+	RNA_boolean_set(kmi->ptr, "next", TRUE);
+
 	kmi = WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", MEDIAFIRST, KM_PRESS, 0, 0);
 	RNA_boolean_set(kmi->ptr, "next", FALSE);
 	
@@ -3608,7 +3617,7 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
 	
 	/* Alternative keys for animation and sequencer playing */
 #if 0 // XXX: disabled for restoring later... bad implementation
-	keymap= WM_keymap_find(keyconf, "Frames", 0, 0);
+	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 deeb306..22a1770 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -56,6 +56,8 @@
 #include "RNA_access.h"
 #include "RNA_define.h"
 
+#include "UI_interface.h"
+
 #include "WM_types.h"
 #include "WM_api.h"
 
@@ -69,6 +71,8 @@ typedef struct ScreenshotData {
 	unsigned int *dumprect;
 	int dumpsx, dumpsy;
 	rcti crop;
+
+	ImageFormatData im_format;
 } ScreenshotData;
 
 /* get shot from frontbuffer */
@@ -106,16 +110,20 @@ static int screenshot_data_create(bContext *C, wmOperator *op)
 	
 	dumprect= screenshot(C, &dumpsx, &dumpsy);
 
-	if(dumprect) {
+	if (dumprect) {
 		ScreenshotData *scd= MEM_callocN(sizeof(ScreenshotData), "screenshot");
 		ScrArea *sa= CTX_wm_area(C);
 		
 		scd->dumpsx= dumpsx;
 		scd->dumpsy= dumpsy;
 		scd->dumprect= dumprect;
-		if(sa)
+		if (sa) {
 			scd->crop= sa->totrct;
-		op->customdata= scd;
+		}
+
+		BKE_imformat_defaults(&scd->im_format);
+
+		op->customdata = scd;
 
 		return TRUE;
 	}
@@ -129,8 +137,8 @@ static void screenshot_data_free(wmOperator *op)
 {
 	ScreenshotData *scd= op->customdata;
 
-	if(scd) {
-		if(scd->dumprect)
+	if (scd) {
+		if (scd->dumprect)
 			MEM_freeN(scd->dumprect);
 		MEM_freeN(scd);
 		op->customdata= NULL;
@@ -143,8 +151,8 @@ static void screenshot_crop(ImBuf *ibuf, rcti crop)
 	unsigned int *from= ibuf->rect + crop.ymin*ibuf->x + crop.xmin;
 	int y, cropw= crop.xmax - crop.xmin, croph = crop.ymax - crop.ymin;
 
-	if(cropw > 0 && croph > 0) {
-		for(y=0; y<croph; y++, to+=cropw, from+=ibuf->x)
+	if (cropw > 0 && croph > 0) {
+		for (y=0; y<croph; y++, to+=cropw, from+=ibuf->x)
 			memmove(to, from, sizeof(unsigned int)*cropw);
 
 		ibuf->x= cropw;
@@ -156,36 +164,33 @@ static int screenshot_exec(bContext *C, wmOperator *op)
 {
 	ScreenshotData *scd= op->customdata;
 
-	if(scd == NULL) {
+	if (scd == NULL) {
 		/* when running exec directly */
 		screenshot_data_create(C, op);
 		scd= op->customdata;
 	}
 
-	if(scd) {
-		if(scd->dumprect) {
-			Scene *scene= CTX_data_scene(C);
+	if (scd) {
+		if (scd->dumprect) {
 			ImBuf *ibuf;
 			char path[FILE_MAX];
 
 			RNA_string_get(op->ptr, "filepath", path);
-
-			BLI_strncpy(G.ima, path, sizeof(G.ima));
 			BLI_path_abs(path, G.main->name);
 
-			/* BKE_add_image_extension() checks for if extension was already set */
-			if(scene->r.scemode & R_EXTENSION)
-				if(strlen(path)<FILE_MAX-5)
-					BKE_add_image_extension(path, scene->r.im_format.imtype);
-
+			/* operator ensures the extension */
 			ibuf= IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0);
 			ibuf->rect= scd->dumprect;
 
 			/* crop to show only single editor */
-			if(!RNA_boolean_get(op->ptr, "full"))
+			if (!RNA_boolean_get(op->ptr, "full"))
 				screenshot_crop(ibuf, scd->crop);
 
-			BKE_write_ibuf(ibuf, path, &scene->r.im_format);
+			if (scd->im_format.planes == R_IMF_PLANES_BW) {
+				/* bw screenshot? - users will notice if it fails! */
+				IMB_color_to_bw(ibuf);
+			}
+			BKE_write_ibuf(ibuf, path, &scd->im_format);
 
 			IMB_freeImBuf(ibuf);
 		}
@@ -197,11 +202,12 @@ static int screenshot_exec(bContext *C, wmOperator *op)
 
 static int screenshot_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	if(screenshot_data_create(C, op)) {
-		if(RNA_struct_property_is_set(op->ptr, "filepath"))
+	if (screenshot_data_create(C, op)) {
+		if (RNA_struct_property_is_set(op->ptr, "filepath"))
 			return screenshot_exec(C, op);
-		
-		RNA_string_set(op->ptr, "filepath", G.ima);
+
+		/* extension is added by 'screenshot_check' after */
+		RNA_string_set(op->ptr, "filepath", G.relbase_valid ? G.main->name : "//screen");
 		
 		WM_event_add_fileselect(C, op);
 	
@@ -210,23 +216,54 @@ static int screenshot_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
 	return OPERATOR_CANCELLED;
 }
 
+static int screenshot_check(bContext *UNUSED(C), wmOperator *op)
+{
+	ScreenshotData *scd = op->customdata;
+	return WM_operator_filesel_ensure_ext_imtype(op, scd->im_format.imtype);
+}
+
 static int screenshot_cancel(bContext *UNUSED(C), wmOperator *op)
 {
 	screenshot_data_free(op);
 	return OPERATOR_CANCELLED;
 }
 
+static int screenshot_draw_check_prop(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
+{
+	const char *prop_id = RNA_property_identifier(prop);
+
+	return !(strcmp(prop_id, "filepath") == 0);
+}
+
+static void screenshot_draw(bContext *UNUSED(C), wmOperator *op)
+{
+	uiLayout *layout = op->layout;
+	ScreenshotData *scd = op->customdata;
+	PointerRNA ptr;
+
+	/* image template */
+	RNA_pointer_create(NULL, &RNA_ImageFormatSettings, &scd->im_format, &ptr);
+	uiTemplateImageSettings(layout, &ptr);
+
+	/* main draw call */
+	RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
+	uiDefAutoButsRNA(layout, &ptr, screenshot_draw_check_prop, '\0');
+}
+
+
 void SCREEN_OT_screenshot(wmOperatorType *ot)
 {
-	ot->name= "Save Screenshot"; /* weak: opname starting with 'save' makes filewindow give save-over */
-	ot->idname= "SCREEN_OT_screenshot";
+	ot->name = "Save Screenshot"; /* weak: opname starting with 'save' makes filewindow give save-over */
+	ot->idname = "SCREEN_OT_screenshot";
 	
-	ot->invoke= screenshot_invoke;
-	ot->exec= screenshot_exec;
-	ot->poll= WM_operator_winactive;
-	ot->cancel= screenshot_cancel;
+	ot->invoke = screenshot_invoke;
+	ot->check = screenshot_check;
+	ot->exec = screenshot_exec;
+	ot->cancel = screenshot_cancel;
+	ot->ui = screenshot_draw;
+	ot->poll = WM_operator_winactive;
 	
-	ot->flag= 0;
+	ot->flag = 0;
 	
 	WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
 	RNA_def_boolean(ot->srna, "full", 1, "Full Screen", "");
@@ -249,7 +286,7 @@ static void screenshot_freejob(void *sjv)
 {
 	ScreenshotJob *sj= sjv;
 	
-	if(sj->dumprect)
+	if (sj->dumprect)
 		MEM_freeN(sj->dumprect);
 	
 	MEM_freeN(sj);
@@ -262,7 +299,7 @@ static void screenshot_updatejob(void *sjv)
 	ScreenshotJob *sj= sjv;
 	unsigned int *dumprect;
 	
-	if(sj->dumprect==NULL) {
+	if (sj->dumprect==NULL) {
 		dumprect= MEM_mallocN(sizeof(int) * sj->dumpsx * sj->dumpsy, "dumprect");
 		glReadPixels(sj->x, sj->y, sj->dumpsx, sj->dumpsy, GL_RGBA, GL_UNSIGNED_BYTE, dumprect);
 		glFinish();
@@ -283,8 +320,8 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
 	rd.frs_sec= U.scrcastfps;
 	rd.frs_sec_base= 1.0f;
 	
-	if(BKE_imtype_is_movie(rd.im_format.imtype)) {
-		if(!mh->start_movie(sj->scene, &rd, sj->dumpsx, sj->dumpsy, &sj->reports)) {
+	if (BKE_imtype_is_movie(rd.im_format.imtype)) {
+		if (!mh->start_movie(sj->scene, &rd, sj->dumpsx, sj->dumpsy, &sj->reports)) {
 			printf("screencast job stopped\n");
 			return;
 		}
@@ -297,18 +334,20 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
 	
 	*do_update= 1; // wait for opengl rect
 	
-	while(*stop==0) {
+	while (*stop==0) {
 		
-		if(sj->dumprect) {
+		if (sj->dumprect) {
 			
-			if(mh) {
-				if(mh->append_movie(&rd, rd.sfra, rd.cfra, (int *)sj->dumprect,
+			if (mh) {
+				if (mh->append_movie(&rd, rd.sfra, rd.cfra, (int *)sj->dumprect,
 				                    sj->dumpsx, sj->dumpsy, &sj->reports))
 				{
 					BKE_reportf(&sj->reports, RPT_INFO, "Appended frame: %d", rd.cfra);
 					printf("Appended frame %d\n", rd.cfra);
-				} else
+				}
+				else {
 					break;
+				}
 			}
 			else {
 				ImBuf *ibuf= IMB_allocImBuf(sj->dumpsx, sj->dumpsy, rd.im_format.planes, 0);
@@ -320,7 +359,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
 				ibuf->rect= sj->dumprect;
 				ok= BKE_write_ibuf(ibuf, name, &rd.im_format);
 				
-				if(ok==0) {
+				if (ok==0) {
 					printf("Write error: cannot save %s\n", name);
 					BKE_reportf(&sj->reports, RPT_INFO, "Write error: cannot save %s\n", name);
 					break;
@@ -346,7 +385,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
 			PIL_sleep_ms(U.scrcastwait);
 	}
 	
-	if(mh)
+	if (mh)
 		mh->end_movie();
 
 	BKE_report(&sj->reports, RPT_INFO, "Screencast job stopped");
@@ -359,7 +398,7 @@ static int screencast_exec(bContext *C, wmOperator *op)
 	ScreenshotJob *sj= MEM_callocN(sizeof(ScreenshotJob), "screenshot job");
 
 	/* setup sj */
-	if(RNA_boolean_get(op->ptr, "full")) {
+	if (RNA_boolean_get(op->ptr, "full")) {
 		wmWindow *win= CTX_wm_window(C);
 		sj->x= 0;
 		sj->y= 0;
@@ -392,14 +431,14 @@ static int screencast_exec(bContext *C, wmOperator *op)
 
 void SCREEN_OT_screencast(wmOperatorType *ot)
 {
-	ot->name= "Make Screencast";
-	ot->idname= "SCREEN_OT_screencast";
+	ot->name = "Make Screencast";
+	ot->idname = "SCREEN_OT_screencast";
 	
-	ot->invoke= WM_operator_confirm;
-	ot->exec= screencast_exec;
-	ot->poll= WM_operator_winactive;
+	ot->invoke = WM_operator_confirm;
+	ot->exec = screencast_exec;
+	ot->poll = WM_operator_winactive;
 	
-	ot->flag= 0;
+	ot->flag = 0;
 	
 	RNA_def_property(ot->srna, "filepath", PROP_STRING, PROP_FILEPATH);
 	RNA_def_boolean(ot->srna, "full", 1, "Full Screen", "");
diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt
index 9fa91af..cf8179b 100644
--- a/source/blender/editors/sculpt_paint/CMakeLists.txt
+++ b/source/blender/editors/sculpt_paint/CMakeLists.txt
@@ -23,6 +23,7 @@ set(INC
 	../../blenkernel
 	../../blenlib
 	../../blenloader
+	../../bmesh
 	../../gpu
 	../../imbuf
 	../../makesdna
@@ -39,6 +40,7 @@ set(INC_SYS
 
 set(SRC
 	paint_cursor.c
+	paint_hide.c
 	paint_image.c
 	paint_ops.c
 	paint_stroke.c
diff --git a/source/blender/editors/sculpt_paint/SConscript b/source/blender/editors/sculpt_paint/SConscript
index dd82e01..21439e6 100644
--- a/source/blender/editors/sculpt_paint/SConscript
+++ b/source/blender/editors/sculpt_paint/SConscript
@@ -8,7 +8,7 @@ defs = []
 incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
 incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
 incs += ' ../../render/extern/include'
-incs += ' ../../gpu ../../makesrna ../../blenloader ../uvedit'
+incs += ' ../../gpu ../../makesrna ../../blenloader ../../bmesh ../uvedit'
 
 if env['OURPLATFORM'] == 'linux':
     cflags='-pthread'
@@ -18,7 +18,7 @@ if env['OURPLATFORM'] == 'linuxcross':
     if env['WITH_BF_OPENMP']:
         incs += ' ' + env['BF_OPENMP_INC']
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
 
 env.BlenderLib ( 'bf_editors_sculpt_paint', sources, Split(incs), defines=defs, libtype=['core'], priority=[40] )
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index 0148f11..5d4710a 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -53,16 +53,16 @@
 
 #include "paint_intern.h"
 /* still needed for sculpt_stroke_get_location, should be
-   removed eventually (TODO) */
+ * removed eventually (TODO) */
 #include "sculpt_intern.h"
 
 /* TODOs:
-
-   Some of the cursor drawing code is doing non-draw stuff
-   (e.g. updating the brush rake angle). This should be cleaned up
-   still.
-
-   There is also some ugliness with sculpt-specific code.
+ *
+ * Some of the cursor drawing code is doing non-draw stuff
+ * (e.g. updating the brush rake angle). This should be cleaned up
+ * still.
+ *
+ * There is also some ugliness with sculpt-specific code.
  */
 
 typedef struct Snapshot {
@@ -76,26 +76,26 @@ typedef struct Snapshot {
 	int curve_changed_timestamp;
 } Snapshot;
 
-static int same_snap(Snapshot* snap, Brush* brush, ViewContext* vc)
+static int same_snap(Snapshot *snap, Brush *brush, ViewContext *vc)
 {
-	MTex* mtex = &brush->mtex;
+	MTex *mtex = &brush->mtex;
 
 	return (((mtex->tex) &&
-			 equals_v3v3(mtex->ofs, snap->ofs) &&
-			 equals_v3v3(mtex->size, snap->size) &&
-			 mtex->rot == snap->rot) &&
-
-			/* make brush smaller shouldn't cause a resample */
-			((mtex->brush_map_mode == MTEX_MAP_MODE_FIXED &&
-			  (brush_size(vc->scene, brush) <= snap->brush_size)) ||
-			 (brush_size(vc->scene, brush) == snap->brush_size)) &&
-
-			(mtex->brush_map_mode == snap->brush_map_mode) &&
-			(vc->ar->winx == snap->winx) &&
-			(vc->ar->winy == snap->winy));
+	         equals_v3v3(mtex->ofs, snap->ofs) &&
+	         equals_v3v3(mtex->size, snap->size) &&
+	         mtex->rot == snap->rot) &&
+
+	        /* make brush smaller shouldn't cause a resample */
+	        ((mtex->brush_map_mode == MTEX_MAP_MODE_FIXED &&
+	          (brush_size(vc->scene, brush) <= snap->brush_size)) ||
+	         (brush_size(vc->scene, brush) == snap->brush_size)) &&
+
+	        (mtex->brush_map_mode == snap->brush_map_mode) &&
+	        (vc->ar->winx == snap->winx) &&
+	        (vc->ar->winy == snap->winy));
 }
 
-static void make_snap(Snapshot* snap, Brush* brush, ViewContext* vc)
+static void make_snap(Snapshot *snap, Brush *brush, ViewContext *vc)
 {
 	if (brush->mtex.tex) {
 		snap->brush_map_mode = brush->mtex.brush_map_mode;
@@ -105,8 +105,8 @@ static void make_snap(Snapshot* snap, Brush* brush, ViewContext* vc)
 	}
 	else {
 		snap->brush_map_mode = -1;
-		snap->ofs[0]= snap->ofs[1]= snap->ofs[2]= -1;
-		snap->size[0]= snap->size[1]= snap->size[2]= -1;
+		snap->ofs[0] = snap->ofs[1] = snap->ofs[2] = -1;
+		snap->size[0] = snap->size[1] = snap->size[2] = -1;
 		snap->rot = -1;
 	}
 
@@ -115,7 +115,7 @@ static void make_snap(Snapshot* snap, Brush* brush, ViewContext* vc)
 	snap->winy = vc->ar->winy;
 }
 
-static int load_tex(Sculpt *sd, Brush* br, ViewContext* vc)
+static int load_tex(Sculpt *sd, Brush *br, ViewContext *vc)
 {
 	static GLuint overlay_texture = 0;
 	static int init = 0;
@@ -124,7 +124,7 @@ static int load_tex(Sculpt *sd, Brush* br, ViewContext* vc)
 	static Snapshot snap;
 	static int old_size = -1;
 
-	GLubyte* buffer = NULL;
+	GLubyte *buffer = NULL;
 
 	int size;
 	int j;
@@ -137,13 +137,13 @@ static int load_tex(Sculpt *sd, Brush* br, ViewContext* vc)
 	if (br->mtex.brush_map_mode == MTEX_MAP_MODE_TILED && !br->mtex.tex) return 0;
 	
 	refresh = 
-		!overlay_texture ||
-		(br->mtex.tex && 
-		    (!br->mtex.tex->preview ||
-		      br->mtex.tex->preview->changed_timestamp[0] != tex_changed_timestamp)) ||
-		!br->curve ||
-		br->curve->changed_timestamp != curve_changed_timestamp ||
-		!same_snap(&snap, br, vc);
+	    !overlay_texture ||
+	    (br->mtex.tex &&
+	     (!br->mtex.tex->preview ||
+	      br->mtex.tex->preview->changed_timestamp[0] != tex_changed_timestamp)) ||
+	    !br->curve ||
+	    br->curve->changed_timestamp != curve_changed_timestamp ||
+	    !same_snap(&snap, br, vc);
 
 	if (refresh) {
 		if (br->mtex.tex && br->mtex.tex->preview)
@@ -161,7 +161,7 @@ static int load_tex(Sculpt *sd, Brush* br, ViewContext* vc)
 			for (s >>= 1; s > 0; s >>= 1)
 				r++;
 
-			size = (1<<r);
+			size = (1 << r);
 
 			if (size < 256)
 				size = 256;
@@ -183,26 +183,26 @@ static int load_tex(Sculpt *sd, Brush* br, ViewContext* vc)
 			old_size = size;
 		}
 
-		buffer = MEM_mallocN(sizeof(GLubyte)*size*size, "load_tex");
+		buffer = MEM_mallocN(sizeof(GLubyte) * size * size, "load_tex");
 
 		#pragma omp parallel for schedule(static) if (sd->flags & SCULPT_USE_OPENMP)
-		for (j= 0; j < size; j++) {
+		for (j = 0; j < size; j++) {
 			int i;
 			float y;
 			float len;
 
-			for (i= 0; i < size; i++) {
+			for (i = 0; i < size; i++) {
 
 				// largely duplicated from tex_strength
 
 				const float rotation = -br->mtex.rot;
 				float radius = brush_size(vc->scene, br);
-				int index = j*size + i;
+				int index = j * size + i;
 				float x;
 				float avg;
 
-				x = (float)i/size;
-				y = (float)j/size;
+				x = (float)i / size;
+				y = (float)j / size;
 
 				x -= 0.5f;
 				y -= 0.5f;
@@ -216,12 +216,12 @@ static int load_tex(Sculpt *sd, Brush* br, ViewContext* vc)
 					y *= 2;
 				}
 
-				len = sqrtf(x*x + y*y);
+				len = sqrtf(x * x + y * y);
 
 				if ((br->mtex.brush_map_mode == MTEX_MAP_MODE_TILED) || len <= 1) {
 					/* it is probably worth optimizing for those cases where 
-					   the texture is not rotated by skipping the calls to
-					   atan2, sqrtf, sin, and cos. */
+					 * the texture is not rotated by skipping the calls to
+					 * atan2, sqrtf, sin, and cos. */
 					if (br->mtex.tex && (rotation > 0.001f || rotation < -0.001f)) {
 						const float angle    = atan2f(y, x) + rotation;
 
@@ -240,9 +240,9 @@ static int load_tex(Sculpt *sd, Brush* br, ViewContext* vc)
 					avg += br->texture_sample_bias;
 
 					if (br->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED)
-						avg *= brush_curve_strength(br, len, 1); /* Falloff curve */
+						avg *= brush_curve_strength(br, len, 1);  /* Falloff curve */
 
-					buffer[index] = 255 - (GLubyte)(255*avg);
+					buffer[index] = 255 - (GLubyte)(255 * avg);
 				}
 				else {
 					buffer[index] = 0;
@@ -254,7 +254,7 @@ static int load_tex(Sculpt *sd, Brush* br, ViewContext* vc)
 			glGenTextures(1, &overlay_texture);
 	}
 	else {
-		size= old_size;
+		size = old_size;
 	}
 
 	glBindTexture(GL_TEXTURE_2D, overlay_texture);
@@ -287,8 +287,8 @@ static int load_tex(Sculpt *sd, Brush* br, ViewContext* vc)
 }
 
 static int project_brush_radius(ViewContext *vc,
-								float radius,
-								const float location[3])
+                                float radius,
+                                const float location[3])
 {
 	float view[3], nonortho[3], ortho[3], offset[3], p1[2], p2[2];
 
@@ -328,9 +328,9 @@ static int project_brush_radius(ViewContext *vc,
 	return len_v2v2(p1, p2);
 }
 
-static int sculpt_get_brush_geometry(bContext* C, ViewContext *vc,
-									 int x, int y, int* pixel_radius,
-									 float location[3])
+static int sculpt_get_brush_geometry(bContext *C, ViewContext *vc,
+                                     int x, int y, int *pixel_radius,
+                                     float location[3])
 {
 	Scene *scene = CTX_data_scene(C);
 	Paint *paint = paint_get_active(scene);
@@ -341,12 +341,12 @@ static int sculpt_get_brush_geometry(bContext* C, ViewContext *vc,
 	window[0] = x + vc->ar->winrct.xmin;
 	window[1] = y + vc->ar->winrct.ymin;
 
-	if(vc->obact->sculpt && vc->obact->sculpt->pbvh &&
-	   sculpt_stroke_get_location(C, location, window)) {
+	if (vc->obact->sculpt && vc->obact->sculpt->pbvh &&
+	    sculpt_stroke_get_location(C, location, window)) {
 		*pixel_radius =
-			project_brush_radius(vc,
-								 brush_unprojected_radius(scene, brush),
-								 location);
+		    project_brush_radius(vc,
+		                         brush_unprojected_radius(scene, brush),
+		                         location);
 
 		if (*pixel_radius == 0)
 			*pixel_radius = brush_size(scene, brush);
@@ -356,8 +356,8 @@ static int sculpt_get_brush_geometry(bContext* C, ViewContext *vc,
 		hit = 1;
 	}
 	else {
-		Sculpt* sd    = CTX_data_tool_settings(C)->sculpt;
-		Brush*  brush = paint_brush(&sd->paint);
+		Sculpt *sd    = CTX_data_tool_settings(C)->sculpt;
+		Brush *brush = paint_brush(&sd->paint);
 
 		*pixel_radius = brush_size(scene, brush);
 		hit = 0;
@@ -367,32 +367,32 @@ static int sculpt_get_brush_geometry(bContext* C, ViewContext *vc,
 }
 
 /* Draw an overlay that shows what effect the brush's texture will
-   have on brush strength */
+ * have on brush strength */
 /* TODO: sculpt only for now */
 static void paint_draw_alpha_overlay(Sculpt *sd, Brush *brush,
-				     ViewContext *vc, int x, int y)
+                                     ViewContext *vc, int x, int y)
 {
 	rctf quad;
 
 	/* check for overlay mode */
-	if(!(brush->flag & BRUSH_TEXTURE_OVERLAY) ||
-	   !(ELEM(brush->mtex.brush_map_mode, MTEX_MAP_MODE_FIXED, MTEX_MAP_MODE_TILED)))
+	if (!(brush->flag & BRUSH_TEXTURE_OVERLAY) ||
+	    !(ELEM(brush->mtex.brush_map_mode, MTEX_MAP_MODE_FIXED, MTEX_MAP_MODE_TILED)))
 		return;
 
 	/* save lots of GL state
-	   TODO: check on whether all of these are needed? */
-	glPushAttrib(GL_COLOR_BUFFER_BIT|
-	             GL_CURRENT_BIT|
-	             GL_DEPTH_BUFFER_BIT|
-	             GL_ENABLE_BIT|
-	             GL_LINE_BIT|
-	             GL_POLYGON_BIT|
-	             GL_STENCIL_BUFFER_BIT|
-	             GL_TRANSFORM_BIT|
-	             GL_VIEWPORT_BIT|
+	 * TODO: check on whether all of these are needed? */
+	glPushAttrib(GL_COLOR_BUFFER_BIT |
+	             GL_CURRENT_BIT |
+	             GL_DEPTH_BUFFER_BIT |
+	             GL_ENABLE_BIT |
+	             GL_LINE_BIT |
+	             GL_POLYGON_BIT |
+	             GL_STENCIL_BUFFER_BIT |
+	             GL_TRANSFORM_BIT |
+	             GL_VIEWPORT_BIT |
 	             GL_TEXTURE_BIT);
 
-	if(load_tex(sd, brush, vc)) {
+	if (load_tex(sd, brush, vc)) {
 		glEnable(GL_BLEND);
 
 		glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
@@ -403,31 +403,31 @@ static void paint_draw_alpha_overlay(Sculpt *sd, Brush *brush,
 		glPushMatrix();
 		glLoadIdentity();
 
-		if(brush->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) {
+		if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) {
 			/* brush rotation */
 			glTranslatef(0.5, 0.5, 0);
 			glRotatef((double)RAD2DEGF((brush->flag & BRUSH_RAKE) ?
 			                           sd->last_angle : sd->special_rotation),
-			                           0.0, 0.0, 1.0);
+			          0.0, 0.0, 1.0);
 			glTranslatef(-0.5f, -0.5f, 0);
 
 			/* scale based on tablet pressure */
-			if(sd->draw_pressure && brush_use_size_pressure(vc->scene, brush)) {
+			if (sd->draw_pressure && brush_use_size_pressure(vc->scene, brush)) {
 				glTranslatef(0.5f, 0.5f, 0);
-				glScalef(1.0f/sd->pressure_value, 1.0f/sd->pressure_value, 1);
+				glScalef(1.0f / sd->pressure_value, 1.0f / sd->pressure_value, 1);
 				glTranslatef(-0.5f, -0.5f, 0);
 			}
 
-			if(sd->draw_anchored) {
+			if (sd->draw_anchored) {
 				const float *aim = sd->anchored_initial_mouse;
 				const rcti *win = &vc->ar->winrct;
-				quad.xmin = aim[0]-sd->anchored_size - win->xmin;
-				quad.ymin = aim[1]-sd->anchored_size - win->ymin;
-				quad.xmax = aim[0]+sd->anchored_size - win->xmin;
-				quad.ymax = aim[1]+sd->anchored_size - win->ymin;
+				quad.xmin = aim[0] - sd->anchored_size - win->xmin;
+				quad.ymin = aim[1] - sd->anchored_size - win->ymin;
+				quad.xmax = aim[0] + sd->anchored_size - win->xmin;
+				quad.ymax = aim[1] + sd->anchored_size - win->ymin;
 			}
 			else {
-				const int radius= brush_size(vc->scene, brush);
+				const int radius = brush_size(vc->scene, brush);
 				quad.xmin = x - radius;
 				quad.ymin = y - radius;
 				quad.xmax = x + radius;
@@ -468,17 +468,17 @@ static void paint_draw_alpha_overlay(Sculpt *sd, Brush *brush,
 /* Special actions taken when paint cursor goes over mesh */
 /* TODO: sculpt only for now */
 static void paint_cursor_on_hit(Sculpt *sd, Brush *brush, ViewContext *vc,
-								const float location[3])
+                                const float location[3])
 {
 	float unprojected_radius, projected_radius;
 
 	/* update the brush's cached 3D radius */
-	if(!brush_use_locked_size(vc->scene, brush)) {
+	if (!brush_use_locked_size(vc->scene, brush)) {
 		/* get 2D brush radius */
-		if(sd->draw_anchored)
+		if (sd->draw_anchored)
 			projected_radius = sd->anchored_size;
 		else {
-			if(brush->flag & BRUSH_ANCHORED)
+			if (brush->flag & BRUSH_ANCHORED)
 				projected_radius = 8;
 			else
 				projected_radius = brush_size(vc->scene, brush);
@@ -486,10 +486,10 @@ static void paint_cursor_on_hit(Sculpt *sd, Brush *brush, ViewContext *vc,
 	
 		/* convert brush radius from 2D to 3D */
 		unprojected_radius = paint_calc_object_space_radius(vc, location,
-															projected_radius);
+		                                                    projected_radius);
 
 		/* scale 3D brush radius by pressure */
-		if(sd->draw_pressure && brush_use_size_pressure(vc->scene, brush))
+		if (sd->draw_pressure && brush_use_size_pressure(vc->scene, brush))
 			unprojected_radius *= sd->pressure_value;
 
 		/* set cached value in either Brush or UnifiedPaintSettings */
@@ -515,24 +515,24 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
 	final_radius = brush_size(scene, brush);
 
 	/* check that brush drawing is enabled */
-	if(!(paint->flags & PAINT_SHOW_BRUSH))
+	if (!(paint->flags & PAINT_SHOW_BRUSH))
 		return;
 
 	/* can't use stroke vc here because this will be called during
-	   mouse over too, not just during a stroke */	   
+	 * mouse over too, not just during a stroke */
 	view3d_set_viewcontext(C, &vc);
 
 	/* TODO: as sculpt and other paint modes are unified, this
-	   special mode of drawing will go away */
-	if(vc.obact->sculpt) {
+	 * special mode of drawing will go away */
+	if (vc.obact->sculpt) {
 		Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
 		float location[3];
 		int pixel_radius, hit;
 
 		/* this is probably here so that rake takes into
-		   account the brush movements before the stroke
-		   starts, but this doesn't really belong in draw code
-		   (TODO) */
+		 * account the brush movements before the stroke
+		 * starts, but this doesn't really belong in draw code
+		 *  TODO) */
 		{
 			const float u = 0.5f;
 			const float v = 1 - u;
@@ -541,11 +541,11 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
 			const float dx = sd->last_x - x;
 			const float dy = sd->last_y - y;
 
-			if(dx*dx + dy*dy >= r*r) {
+			if (dx * dx + dy * dy >= r * r) {
 				sd->last_angle = atan2(dx, dy);
 
-				sd->last_x = u*sd->last_x + v*x;
-				sd->last_y = u*sd->last_y + v*y;
+				sd->last_x = u * sd->last_x + v * x;
+				sd->last_y = u * sd->last_y + v * y;
 			}
 		}
 
@@ -555,24 +555,24 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
 		/* draw overlay */
 		paint_draw_alpha_overlay(sd, brush, &vc, x, y);
 
-		if(brush_use_locked_size(scene, brush))
+		if (brush_use_locked_size(scene, brush))
 			brush_set_size(scene, brush, pixel_radius);
 
 		/* check if brush is subtracting, use different color then */
 		/* TODO: no way currently to know state of pen flip or
-		   invert key modifier without starting a stroke */
-		if((!(brush->flag & BRUSH_INVERTED) ^
-		    !(brush->flag & BRUSH_DIR_IN)) &&
-		   ELEM5(brush->sculpt_tool, SCULPT_TOOL_DRAW,
-			 SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY,
-			 SCULPT_TOOL_PINCH, SCULPT_TOOL_CREASE))
+		 * invert key modifier without starting a stroke */
+		if ((!(brush->flag & BRUSH_INVERTED) ^
+		     !(brush->flag & BRUSH_DIR_IN)) &&
+		    ELEM5(brush->sculpt_tool, SCULPT_TOOL_DRAW,
+		          SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY,
+		          SCULPT_TOOL_PINCH, SCULPT_TOOL_CREASE))
 			outline_col = brush->sub_col;
 
 		/* only do if brush is over the mesh */
-		if(hit)
+		if (hit)
 			paint_cursor_on_hit(sd, brush, &vc, location);
 
-		if(sd->draw_anchored) {
+		if (sd->draw_anchored) {
 			final_radius = sd->anchored_size;
 			translation[0] = sd->anchored_initial_mouse[0] - vc.ar->winrct.xmin;
 			translation[1] = sd->anchored_initial_mouse[1] - vc.ar->winrct.ymin;
@@ -588,7 +588,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
 
 	/* draw brush outline */
 	glTranslatef(translation[0], translation[1], 0);
-	glutil_draw_lined_arc(0.0, M_PI*2.0, final_radius, 40);
+	glutil_draw_lined_arc(0.0, M_PI * 2.0, final_radius, 40);
 	glTranslatef(-translation[0], -translation[1], 0);
 
 	/* restore GL state */
@@ -602,6 +602,6 @@ void paint_cursor_start(bContext *C, int (*poll)(bContext *C))
 {
 	Paint *p = paint_get_active(CTX_data_scene(C));
 
-	if(p && !p->paint_cursor)
+	if (p && !p->paint_cursor)
 		p->paint_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), poll, paint_draw_cursor, NULL);
 }
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c
new file mode 100644
index 0000000..c75c1be
--- /dev/null
+++ b/source/blender/editors/sculpt_paint/paint_hide.c
@@ -0,0 +1,389 @@
+/*
+ * $Id$
+ *
+ * ***** 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) 2010 by Nicholas Bishop
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s):
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ *
+ * Implements the PBVH node hiding operator
+ *
+ */
+
+/** \file blender/editors/sculpt_paint/paint_hide.c
+ *  \ingroup edsculpt
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_bitmap.h"
+#include "BLI_listbase.h"
+#include "BLI_math_vector.h"
+#include "BLI_pbvh.h"
+#include "BLI_utildefines.h"
+
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+
+#include "BKE_context.h"
+#include "BKE_DerivedMesh.h"
+#include "BKE_mesh.h"
+#include "BKE_multires.h"
+#include "BKE_paint.h"
+#include "BKE_subsurf.h"
+
+#include "BIF_glutil.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "ED_screen.h"
+#include "ED_view3d.h"
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+
+#include "paint_intern.h"
+#include "sculpt_intern.h" /* for undo push */
+
+#include <assert.h>
+
+static int planes_contain_v3(float (*planes)[4], int totplane, const float p[3])
+{
+	int i;
+
+	for (i = 0; i < totplane; i++) {
+		if (dot_v3v3(planes[i], p) + planes[i][3] > 0)
+			return 0;
+	}
+
+	return 1;
+}
+
+/* return true if the element should be hidden/shown */
+static int is_effected(PartialVisArea area,
+                       float planes[4][4],
+                       const float co[3])
+{
+	if (area == PARTIALVIS_ALL)
+		return 1;
+	else {
+		int inside = planes_contain_v3(planes, 4, co);
+		return ((inside && area == PARTIALVIS_INSIDE) ||
+		        (!inside && area == PARTIALVIS_OUTSIDE));
+	}
+}
+
+static void partialvis_update_mesh(Object *ob,
+                                   PBVH *pbvh,
+                                   PBVHNode *node,
+                                   PartialVisAction action,
+                                   PartialVisArea area,
+                                   float planes[4][4])
+{
+	MVert *mvert;
+	int *vert_indices;
+	int any_changed = 0, any_visible = 0, totvert, i;
+			
+	BLI_pbvh_node_num_verts(pbvh, node, NULL, &totvert);
+	BLI_pbvh_node_get_verts(pbvh, node, &vert_indices, &mvert);
+
+	sculpt_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN);
+
+	for (i = 0; i < totvert; i++) {
+		MVert *v = &mvert[vert_indices[i]];
+
+		/* hide vertex if in the hide volume */
+		if (is_effected(area, planes, v->co)) {
+			if (action == PARTIALVIS_HIDE)
+				v->flag |= ME_HIDE;
+			else
+				v->flag &= ~ME_HIDE;
+			any_changed = 1;
+		}
+
+		if (!(v->flag & ME_HIDE))
+			any_visible = 1;
+	}
+
+	if (any_changed) {
+		BLI_pbvh_node_mark_rebuild_draw(node);
+		BLI_pbvh_node_fully_hidden_set(node, !any_visible);
+	}
+}
+
+/* Hide or show elements in multires grids with a special GridFlags
+ * customdata layer. */
+static void partialvis_update_grids(Object *ob,
+                                    PBVH *pbvh,
+                                    PBVHNode *node,
+                                    PartialVisAction action,
+                                    PartialVisArea area,
+                                    float planes[4][4])
+{
+	DMGridData **grids;
+	BLI_bitmap *grid_hidden;
+	int any_visible = 0;
+	int *grid_indices, gridsize, totgrid, any_changed, i;
+
+	/* get PBVH data */
+	BLI_pbvh_node_get_grids(pbvh, node,
+	                        &grid_indices, &totgrid, NULL, &gridsize,
+	                        &grids, NULL);
+	grid_hidden = BLI_pbvh_grid_hidden(pbvh);
+	
+	sculpt_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN);
+	
+	any_changed = 0;
+	for (i = 0; i < totgrid; i++) {
+		int any_hidden = 0;
+		int g = grid_indices[i], x, y;
+		BLI_bitmap gh = grid_hidden[g];
+
+		if (!gh) {
+			switch (action) {
+				case PARTIALVIS_HIDE:
+					/* create grid flags data */
+					gh = grid_hidden[g] = BLI_BITMAP_NEW(gridsize * gridsize,
+					                                     "partialvis_update_grids");
+					break;
+				case PARTIALVIS_SHOW:
+					/* entire grid is visible, nothing to show */
+					continue;
+			}
+		}
+		else if (action == PARTIALVIS_SHOW && area == PARTIALVIS_ALL) {
+			/* special case if we're showing all, just free the
+			 * grid */
+			MEM_freeN(gh);
+			grid_hidden[g] = NULL;
+			any_changed = 1;
+			any_visible = 1;
+			continue;
+		}
+
+		for (y = 0; y < gridsize; y++) {
+			for (x = 0; x < gridsize; x++) {
+				const float *co = grids[g][y * gridsize + x].co;
+
+				/* skip grid element if not in the effected area */
+				if (is_effected(area, planes, co)) {
+					/* set or clear the hide flag */
+					BLI_BITMAP_MODIFY(gh, y * gridsize + x,
+					                  action == PARTIALVIS_HIDE);
+
+					any_changed = 1;
+				}
+
+				/* keep track of whether any elements are still hidden */
+				if (BLI_BITMAP_GET(gh, y * gridsize + x))
+					any_hidden = 1;
+				else
+					any_visible = 1;
+			}
+		}
+
+		/* if everything in the grid is now visible, free the grid
+		 * flags */
+		if (!any_hidden) {
+			MEM_freeN(gh);
+			grid_hidden[g] = NULL;
+		}
+	}
+
+	/* mark updates if anything was hidden/shown */
+	if (any_changed) {
+		BLI_pbvh_node_mark_rebuild_draw(node);
+		BLI_pbvh_node_fully_hidden_set(node, !any_visible);
+		multires_mark_as_modified(ob, MULTIRES_HIDDEN_MODIFIED);
+	}
+}
+
+static void rect_from_props(rcti *rect, PointerRNA *ptr)
+{
+	rect->xmin = RNA_int_get(ptr, "xmin");
+	rect->ymin = RNA_int_get(ptr, "ymin");
+	rect->xmax = RNA_int_get(ptr, "xmax");
+	rect->ymax = RNA_int_get(ptr, "ymax");
+}
+
+static void clip_planes_from_rect(bContext *C,
+                                  float clip_planes[4][4],
+                                  const rcti *rect)
+{
+	ViewContext vc;
+	BoundBox bb;
+	bglMats mats = {{0}};
+	
+	view3d_operator_needs_opengl(C);
+	view3d_set_viewcontext(C, &vc);
+	view3d_get_transformation(vc.ar, vc.rv3d, vc.obact, &mats);
+	ED_view3d_calc_clipping(&bb, clip_planes, &mats, rect);
+	mul_m4_fl(clip_planes, -1.0f);
+}
+
+/* If mode is inside, get all PBVH nodes that lie at least partially
+ * inside the clip_planes volume. If mode is outside, get all nodes
+ * that lie at least partially outside the volume. If showing all, get
+ * all nodes. */
+static void get_pbvh_nodes(PBVH *pbvh,
+                           PBVHNode ***nodes,
+                           int *totnode,
+                           float clip_planes[4][4],
+                           PartialVisArea mode)
+{
+	BLI_pbvh_SearchCallback cb;
+
+	/* select search callback */
+	switch (mode) {
+		case PARTIALVIS_INSIDE:
+			cb = BLI_pbvh_node_planes_contain_AABB;
+			break;
+		case PARTIALVIS_OUTSIDE:
+			cb = BLI_pbvh_node_planes_exclude_AABB;
+			break;
+		case PARTIALVIS_ALL:
+			cb = NULL;
+	}
+	
+	BLI_pbvh_search_gather(pbvh, cb, clip_planes, nodes, totnode);
+}
+
+static int hide_show_exec(bContext *C, wmOperator *op)
+{
+	ARegion *ar = CTX_wm_region(C);
+	Object *ob = CTX_data_active_object(C);
+	Mesh *me = ob->data;
+	PartialVisAction action;
+	PartialVisArea area;
+	PBVH *pbvh;
+	PBVHNode **nodes;
+	DerivedMesh *dm;
+	PBVHType pbvh_type;
+	float clip_planes[4][4];
+	rcti rect;
+	int totnode, i;
+
+	/* read operator properties */
+	action = RNA_enum_get(op->ptr, "action");
+	area = RNA_enum_get(op->ptr, "area");
+	rect_from_props(&rect, op->ptr);
+
+	clip_planes_from_rect(C, clip_planes, &rect);
+
+	dm = mesh_get_derived_final(CTX_data_scene(C), ob, CD_MASK_BAREMESH);
+	pbvh = dm->getPBVH(ob, dm);
+	ob->sculpt->pbvh = pbvh;
+
+	get_pbvh_nodes(pbvh, &nodes, &totnode, clip_planes, area);
+	pbvh_type = BLI_pbvh_type(pbvh);
+
+	/* start undo */
+	switch (action) {
+		case PARTIALVIS_HIDE:
+			sculpt_undo_push_begin("Hide area");
+			break;
+		case PARTIALVIS_SHOW:
+			sculpt_undo_push_begin("Show area");
+			break;
+	}
+
+	for (i = 0; i < totnode; i++) {
+		switch (pbvh_type) {
+			case PBVH_FACES:
+				partialvis_update_mesh(ob, pbvh, nodes[i], action, area, clip_planes);
+				break;
+			case PBVH_GRIDS:
+				partialvis_update_grids(ob, pbvh, nodes[i], action, area, clip_planes);
+				break;
+		}
+	}
+
+	if (nodes)
+		MEM_freeN(nodes);
+	
+	/* end undo */
+	sculpt_undo_push_end();
+
+	/* ensure that edges and faces get hidden as well (not used by
+	 * sculpt but it looks wrong when entering editmode otherwise) */
+	if (pbvh_type == PBVH_FACES) {
+		mesh_flush_hidden_from_verts(me->mvert, me->mloop,
+		                             me->medge, me->totedge,
+		                             me->mpoly, me->totpoly);
+	}
+
+	ED_region_tag_redraw(ar);
+	
+	return OPERATOR_FINISHED;
+}
+
+static int hide_show_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+	PartialVisArea area = RNA_enum_get(op->ptr, "area");
+
+	if (area != PARTIALVIS_ALL)
+		return WM_border_select_invoke(C, op, event);
+	else
+		return op->type->exec(C, op);
+}
+
+void PAINT_OT_hide_show(struct wmOperatorType *ot)
+{
+	static EnumPropertyItem action_items[] = {
+		{PARTIALVIS_HIDE, "HIDE", 0, "Hide", "Hide vertices"},
+		{PARTIALVIS_SHOW, "SHOW", 0, "Show", "Show vertices"},
+		{0, NULL, 0, NULL, NULL}};
+
+	static EnumPropertyItem area_items[] = {
+		{PARTIALVIS_OUTSIDE, "OUTSIDE", 0, "Outside", "Hide or show vertices outside the selection"},
+		{PARTIALVIS_INSIDE, "INSIDE", 0, "Inside", "Hide or show vertices inside the selection"},
+		{PARTIALVIS_ALL, "ALL", 0, "All", "Hide or show all vertices"},
+		{0, NULL, 0, NULL, NULL}};
+	
+	/* identifiers */
+	ot->name = "Hide/Show";
+	ot->idname = "PAINT_OT_hide_show";
+
+	/* api callbacks */
+	ot->invoke = hide_show_invoke;
+	ot->modal = WM_border_select_modal;
+	ot->exec = hide_show_exec;
+	/* sculpt-only for now */
+	ot->poll = sculpt_mode_poll;
+
+	ot->flag = OPTYPE_REGISTER;
+
+	/* rna */
+	RNA_def_enum(ot->srna, "action", action_items, PARTIALVIS_HIDE,
+	             "Action", "Whether to hide or show vertices");
+	RNA_def_enum(ot->srna, "area", area_items, PARTIALVIS_INSIDE,
+	             "Area", "Which vertices to hide or show");
+	
+	RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX);
+	RNA_def_int(ot->srna, "xmax", 0, INT_MIN, INT_MAX, "X Max", "", INT_MIN, INT_MAX);
+	RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX);
+	RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX);
+}
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index b8b3695..55cf827 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -41,8 +41,9 @@
 #include "MEM_guardedalloc.h"
 
 #ifdef WIN32
-#include "BLI_winstuff.h"
+#  include "BLI_winstuff.h"
 #endif
+
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
 #include "BLI_dynstr.h"
@@ -50,7 +51,6 @@
 #include "BLI_memarena.h"
 #include "BLI_threads.h"
 #include "BLI_utildefines.h"
-#include "BLI_editVert.h"
 
 #include "PIL_time.h"
 
@@ -84,6 +84,8 @@
 #include "BKE_global.h"
 #include "BKE_deform.h"
 
+#include "BKE_tessmesh.h"
+
 #include "BIF_gl.h"
 #include "BIF_glutil.h"
 
@@ -110,7 +112,7 @@
 
 /* Defines and Structs */
 
-#define IMAPAINT_CHAR_TO_FLOAT(c) ((c)/255.0f)
+#define IMAPAINT_CHAR_TO_FLOAT(c) ((c) / 255.0f)
 
 #define IMAPAINT_FLOAT_RGB_TO_CHAR(c, f)  {                                   \
 	(c)[0]= FTOCHAR((f)[0]);                                                  \
@@ -137,9 +139,9 @@
 
 #define IMAPAINT_FLOAT_RGB_COPY(a, b) copy_v3_v3(a, b)
 
-#define IMAPAINT_TILE_BITS			6
-#define IMAPAINT_TILE_SIZE			(1 << IMAPAINT_TILE_BITS)
-#define IMAPAINT_TILE_NUMBER(size)	(((size)+IMAPAINT_TILE_SIZE-1) >> IMAPAINT_TILE_BITS)
+#define IMAPAINT_TILE_BITS          6
+#define IMAPAINT_TILE_SIZE          (1 << IMAPAINT_TILE_BITS)
+#define IMAPAINT_TILE_NUMBER(size)  (((size) + IMAPAINT_TILE_SIZE - 1) >> IMAPAINT_TILE_BITS)
 
 static void imapaint_image_update(SpaceImage *sima, Image *image, ImBuf *ibuf, short texpaint);
 
@@ -159,11 +161,18 @@ typedef struct ImagePaintState {
 	char *warnpackedfile;
 	char *warnmultifile;
 
-	/* texture paint only */
+	/* viewport texture paint only, but _not_ project paint */
 	Object *ob;
-	Mesh *me;
 	int faceindex;
 	float uv[2];
+	int do_facesel;
+
+	DerivedMesh    *dm;
+	int             dm_totface;
+	int             dm_release;
+
+	MFace          *dm_mface;
+	MTFace         *dm_mtface;
 } ImagePaintState;
 
 typedef struct ImagePaintPartialRedraw {
@@ -201,31 +210,31 @@ typedef struct ImagePaintRegion {
 /* projectFaceSeamFlags options */
 //#define PROJ_FACE_IGNORE	(1<<0)	/* When the face is hidden, backfacing or occluded */
 //#define PROJ_FACE_INIT	(1<<1)	/* When we have initialized the faces data */
-#define PROJ_FACE_SEAM1	(1<<0)	/* If this face has a seam on any of its edges */
-#define PROJ_FACE_SEAM2	(1<<1)
-#define PROJ_FACE_SEAM3	(1<<2)
-#define PROJ_FACE_SEAM4	(1<<3)
+#define PROJ_FACE_SEAM1 (1 << 0)  /* If this face has a seam on any of its edges */
+#define PROJ_FACE_SEAM2 (1 << 1)
+#define PROJ_FACE_SEAM3 (1 << 2)
+#define PROJ_FACE_SEAM4 (1 << 3)
 
-#define PROJ_FACE_NOSEAM1	(1<<4)
-#define PROJ_FACE_NOSEAM2	(1<<5)
-#define PROJ_FACE_NOSEAM3	(1<<6)
-#define PROJ_FACE_NOSEAM4	(1<<7)
+#define PROJ_FACE_NOSEAM1   (1 << 4)
+#define PROJ_FACE_NOSEAM2   (1 << 5)
+#define PROJ_FACE_NOSEAM3   (1 << 6)
+#define PROJ_FACE_NOSEAM4   (1 << 7)
 
-#define PROJ_SRC_VIEW		1
-#define PROJ_SRC_IMAGE_CAM	2
-#define PROJ_SRC_IMAGE_VIEW	3
+#define PROJ_SRC_VIEW       1
+#define PROJ_SRC_IMAGE_CAM  2
+#define PROJ_SRC_IMAGE_VIEW 3
 
 #define PROJ_VIEW_DATA_ID "view_data"
-#define PROJ_VIEW_DATA_SIZE (4*4 + 4*4 + 3) /* viewmat + winmat + clipsta + clipend + is_ortho */
+#define PROJ_VIEW_DATA_SIZE (4 * 4 + 4 * 4 + 3) /* viewmat + winmat + clipsta + clipend + is_ortho */
 
 
 /* a slightly scaled down face is used to get fake 3D location for edge pixels in the seams
  * as this number approaches  1.0f the likelihood increases of float precision errors where
  * it is occluded by an adjacent face */
-#define PROJ_FACE_SCALE_SEAM	0.99f
+#define PROJ_FACE_SCALE_SEAM    0.99f
 
-#define PROJ_BUCKET_NULL		0
-#define PROJ_BUCKET_INIT		(1<<0)
+#define PROJ_BUCKET_NULL        0
+#define PROJ_BUCKET_INIT        (1 << 0)
 // #define PROJ_BUCKET_CLONE_INIT	(1<<1)
 
 /* used for testing doubles, if a point is on a line etc */
@@ -261,67 +270,67 @@ typedef struct ProjPaintState {
 	/* end similarities with ImagePaintState */
 	
 	DerivedMesh    *dm;
-	int 			dm_totface;
-	int 			dm_totvert;
-	int				dm_release;
-	
-	MVert 		   *dm_mvert;
-	MFace 		   *dm_mface;
-	MTFace 		   *dm_mtface;
-	MTFace 		   *dm_mtface_clone;	/* other UV map, use for cloning between layers */
-	MTFace 		   *dm_mtface_stencil;
+	int dm_totface;
+	int dm_totvert;
+	int dm_release;
+
+	MVert          *dm_mvert;
+	MFace          *dm_mface;
+	MTFace         *dm_mtface;
+	MTFace         *dm_mtface_clone;    /* other UV map, use for cloning between layers */
+	MTFace         *dm_mtface_stencil;
 	
 	/* projection painting only */
-	MemArena *arena_mt[BLENDER_MAX_THREADS];/* for multithreading, the first item is sometimes used for non threaded cases too */
-	LinkNode **bucketRect;				/* screen sized 2D array, each pixel has a linked list of ProjPixel's */
-	LinkNode **bucketFaces;				/* bucketRect aligned array linkList of faces overlapping each bucket */
-	unsigned char *bucketFlags;					/* store if the bucks have been initialized  */
+	MemArena *arena_mt[BLENDER_MAX_THREADS]; /* for multithreading, the first item is sometimes used for non threaded cases too */
+	LinkNode **bucketRect;              /* screen sized 2D array, each pixel has a linked list of ProjPixel's */
+	LinkNode **bucketFaces;             /* bucketRect aligned array linkList of faces overlapping each bucket */
+	unsigned char *bucketFlags;         /* store if the bucks have been initialized  */
 #ifndef PROJ_DEBUG_NOSEAMBLEED
-	char *faceSeamFlags;				/* store info about faces, if they are initialized etc*/
-	float (*faceSeamUVs)[4][2];			/* expanded UVs for faces to use as seams */
-	LinkNode **vertFaces;				/* Only needed for when seam_bleed_px is enabled, use to find UV seams */
+	char *faceSeamFlags;                /* store info about faces, if they are initialized etc*/
+	float (*faceSeamUVs)[4][2];         /* expanded UVs for faces to use as seams */
+	LinkNode **vertFaces;               /* Only needed for when seam_bleed_px is enabled, use to find UV seams */
 #endif
-	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 */
+	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 image_tot;				/* size of projectImages array */
+	int image_tot;              /* size of projectImages array */
 	
-	float (*screenCoords)[4];	/* verts projected into floating point screen space */
+	float (*screenCoords)[4];   /* verts projected into floating point screen space */
 	
-	float screenMin[2];			/* 2D bounds for mesh verts on the screen's plane (screenspace) */
+	float screenMin[2];         /* 2D bounds for mesh verts on the screen's plane (screenspace) */
 	float screenMax[2]; 
-	float screen_width;			/* Calculated from screenMin & screenMax */
+	float screen_width;         /* Calculated from screenMin & screenMax */
 	float screen_height;
-	int winx, winy;				/* from the carea or from the projection render */
+	int winx, winy;             /* from the carea or from the projection render */
 	
 	/* options for projection painting */
 	int do_layer_clone;
 	int do_layer_stencil;
 	int do_layer_stencil_inv;
 	
-	short do_occlude;			/* Use raytraced occlusion? - ortherwise will paint right through to the back*/
-	short do_backfacecull;	/* ignore faces with normals pointing away, skips a lot of raycasts if your normals are correctly flipped */
-	short do_mask_normal;			/* mask out pixels based on their normals */
+	short do_occlude;               /* Use raytraced occlusion? - ortherwise will paint right through to the back*/
+	short do_backfacecull;          /* ignore faces with normals pointing away, skips a lot of raycasts if your normals are correctly flipped */
+	short do_mask_normal;           /* mask out pixels based on their normals */
 	short do_new_shading_nodes;     /* cache scene_use_new_shading_nodes value */
-	float normal_angle;				/* what angle to mask at*/
+	float normal_angle;             /* what angle to mask at*/
 	float normal_angle_inner;
-	float normal_angle_range;		/* difference between normal_angle and normal_angle_inner, for easy access */
+	float normal_angle_range;       /* difference between normal_angle and normal_angle_inner, for easy access */
 	
 	short is_ortho;
-	short is_airbrush;					/* only to avoid using (ps.brush->flag & BRUSH_AIRBRUSH) */
-	short is_texbrush;					/* only to avoid running  */
+	short is_airbrush;              /* only to avoid using (ps.brush->flag & BRUSH_AIRBRUSH) */
+	short is_texbrush;              /* only to avoid running  */
 #ifndef PROJ_DEBUG_NOSEAMBLEED
 	float seam_bleed_px;
 #endif
 	/* clone vars */
 	float cloneOffset[2];
 	
-	float projectMat[4][4];		/* Projection matrix, use for getting screen coords */
-	float viewDir[3];			/* View vector, use for do_backfacecull and for ray casting with an ortho viewport  */
-	float viewPos[3];			/* View location in object relative 3D space, so can compare to verts  */
+	float projectMat[4][4];     /* Projection matrix, use for getting screen coords */
+	float viewDir[3];           /* View vector, use for do_backfacecull and for ray casting with an ortho viewport  */
+	float viewPos[3];           /* View location in object relative 3D space, so can compare to verts  */
 	float clipsta, clipend;
 	
 	/* reproject vars */
@@ -336,15 +345,13 @@ typedef struct ProjPaintState {
 	int context_bucket_x, context_bucket_y; /* must lock threads while accessing these */
 } ProjPaintState;
 
-typedef union pixelPointer
-{
-	float *f_pt;			/* float buffer */
+typedef union pixelPointer {
+	float *f_pt;            /* float buffer */
 	unsigned int *uint_pt; /* 2 ways to access a char buffer */
 	unsigned char *ch_pt;
 } PixelPointer;
 
-typedef union pixelStore
-{
+typedef union pixelStore {
 	unsigned char ch[4];
 	unsigned int uint;
 	float f[4];
@@ -382,7 +389,7 @@ typedef struct ProjPixelClone {
 typedef struct UndoImageTile {
 	struct UndoImageTile *next, *prev;
 
-	char idname[MAX_ID_NAME];	/* name instead of pointer*/
+	char idname[MAX_ID_NAME];  /* name instead of pointer*/
 	char ibufname[IB_FILENAME_SIZE];
 
 	void *rect;
@@ -399,50 +406,51 @@ static ImagePaintPartialRedraw imapaintpartial = {0, 0, 0, 0, 0};
 static void undo_copy_tile(UndoImageTile *tile, ImBuf *tmpibuf, ImBuf *ibuf, int restore)
 {
 	/* copy or swap contents of tile->rect and region in ibuf->rect */
-	IMB_rectcpy(tmpibuf, ibuf, 0, 0, tile->x*IMAPAINT_TILE_SIZE,
-		tile->y*IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
+	IMB_rectcpy(tmpibuf, ibuf, 0, 0, tile->x * IMAPAINT_TILE_SIZE,
+	            tile->y * IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
 
-	if(ibuf->rect_float) {
-		SWAP(void*, tmpibuf->rect_float, tile->rect);
-	} else {
-		SWAP(void*, tmpibuf->rect, tile->rect);
+	if (ibuf->rect_float) {
+		SWAP(void *, tmpibuf->rect_float, tile->rect);
+	}
+	else {
+		SWAP(void *, tmpibuf->rect, tile->rect);
 	}
 	
-	if(restore)
-		IMB_rectcpy(ibuf, tmpibuf, tile->x*IMAPAINT_TILE_SIZE,
-			tile->y*IMAPAINT_TILE_SIZE, 0, 0, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
+	if (restore)
+		IMB_rectcpy(ibuf, tmpibuf, tile->x * IMAPAINT_TILE_SIZE,
+		            tile->y * IMAPAINT_TILE_SIZE, 0, 0, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
 }
 
 static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int x_tile, int y_tile)
 {
-	ListBase *lb= undo_paint_push_get_list(UNDO_PAINT_IMAGE);
+	ListBase *lb = undo_paint_push_get_list(UNDO_PAINT_IMAGE);
 	UndoImageTile *tile;
 	int allocsize;
 	short use_float = ibuf->rect_float ? 1 : 0;
 
-	for(tile=lb->first; tile; tile=tile->next)
-		if(tile->x == x_tile && tile->y == y_tile && ima->gen_type == tile->gen_type && ima->source == tile->source)
-			if(tile->use_float == use_float)
-				if(strcmp(tile->idname, ima->id.name)==0 && strcmp(tile->ibufname, ibuf->name)==0)
+	for (tile = lb->first; tile; tile = tile->next)
+		if (tile->x == x_tile && tile->y == y_tile && ima->gen_type == tile->gen_type && ima->source == tile->source)
+			if (tile->use_float == use_float)
+				if (strcmp(tile->idname, ima->id.name) == 0 && strcmp(tile->ibufname, ibuf->name) == 0)
 					return tile->rect;
 	
-	if (*tmpibuf==NULL)
-		*tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, IB_rectfloat|IB_rect);
+	if (*tmpibuf == NULL)
+		*tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, IB_rectfloat | IB_rect);
 	
-	tile= MEM_callocN(sizeof(UndoImageTile), "UndoImageTile");
+	tile = MEM_callocN(sizeof(UndoImageTile), "UndoImageTile");
 	BLI_strncpy(tile->idname, ima->id.name, sizeof(tile->idname));
-	tile->x= x_tile;
-	tile->y= y_tile;
+	tile->x = x_tile;
+	tile->y = y_tile;
 
-	allocsize= IMAPAINT_TILE_SIZE*IMAPAINT_TILE_SIZE*4;
-	allocsize *= (ibuf->rect_float)? sizeof(float): sizeof(char);
-	tile->rect= MEM_mapallocN(allocsize, "UndeImageTile.rect");
+	allocsize = IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE * 4;
+	allocsize *= (ibuf->rect_float) ? sizeof(float) : sizeof(char);
+	tile->rect = MEM_mapallocN(allocsize, "UndeImageTile.rect");
 
 	BLI_strncpy(tile->ibufname, ibuf->name, sizeof(tile->ibufname));
 
-	tile->gen_type= ima->gen_type;
-	tile->source= ima->source;
-	tile->use_float= use_float;
+	tile->gen_type = ima->gen_type;
+	tile->source = ima->source;
+	tile->use_float = use_float;
 
 	undo_copy_tile(tile, *tmpibuf, ibuf, 0);
 	undo_paint_push_count_alloc(UNDO_PAINT_IMAGE, allocsize);
@@ -454,34 +462,34 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int
 
 static void image_undo_restore(bContext *C, ListBase *lb)
 {
-	Main *bmain= CTX_data_main(C);
+	Main *bmain = CTX_data_main(C);
 	Image *ima = NULL;
 	ImBuf *ibuf, *tmpibuf;
 	UndoImageTile *tile;
 
-	tmpibuf= IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32,
-							IB_rectfloat|IB_rect);
+	tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32,
+	                         IB_rectfloat | IB_rect);
 	
-	for(tile=lb->first; tile; tile=tile->next) {
+	for (tile = lb->first; tile; tile = tile->next) {
 		short use_float;
 
 		/* find image based on name, pointer becomes invalid with global undo */
-		if(ima && strcmp(tile->idname, ima->id.name)==0) {
+		if (ima && strcmp(tile->idname, ima->id.name) == 0) {
 			/* ima is valid */
 		}
 		else {
-			ima= BLI_findstring(&bmain->image, tile->idname, offsetof(ID, name));
+			ima = BLI_findstring(&bmain->image, tile->idname, offsetof(ID, name));
 		}
 
-		ibuf= BKE_image_get_ibuf(ima, NULL);
+		ibuf = BKE_image_get_ibuf(ima, NULL);
 
-		if(ima && ibuf && strcmp(tile->ibufname, ibuf->name)!=0) {
+		if (ima && ibuf && strcmp(tile->ibufname, ibuf->name) != 0) {
 			/* current ImBuf filename was changed, probably current frame
-			   was changed when paiting on image sequence, rather than storing
-			   full image user (which isn't so obvious, btw) try to find ImBuf with
-			   matched file name in list of already loaded images */
+			 * was changed when paiting on image sequence, rather than storing
+			 * full image user (which isn't so obvious, btw) try to find ImBuf with
+			 * matched file name in list of already loaded images */
 
-			ibuf= BLI_findstring(&ima->ibufs, tile->ibufname, offsetof(ImBuf, name));
+			ibuf = BLI_findstring(&ima->ibufs, tile->ibufname, offsetof(ImBuf, name));
 		}
 
 		if (!ima || !ibuf || !(ibuf->rect || ibuf->rect_float))
@@ -498,10 +506,10 @@ static void image_undo_restore(bContext *C, ListBase *lb)
 		undo_copy_tile(tile, tmpibuf, ibuf, 1);
 
 		GPU_free_image(ima); /* force OpenGL reload */
-		if(ibuf->rect_float)
+		if (ibuf->rect_float)
 			ibuf->userflags |= IB_RECT_INVALID; /* force recreate of char rect */
-		if(ibuf->mipmap[0])
-			ibuf->userflags |= IB_MIPMAP_INVALID; /* force mipmap recreatiom */
+		if (ibuf->mipmap[0])
+			ibuf->userflags |= IB_MIPMAP_INVALID;  /* force mipmap recreatiom */
 
 	}
 
@@ -512,7 +520,7 @@ static void image_undo_free(ListBase *lb)
 {
 	UndoImageTile *tile;
 
-	for(tile=lb->first; tile; tile=tile->next)
+	for (tile = lb->first; tile; tile = tile->next)
 		MEM_freeN(tile->rect);
 }
 
@@ -522,12 +530,12 @@ static Image *imapaint_face_image(const ImagePaintState *s, int face_index)
 {
 	Image *ima;
 
-	if(scene_use_new_shading_nodes(s->scene)) {
-		MFace *mf = s->me->mface+face_index;
-		ED_object_get_active_image(s->ob, mf->mat_nr, &ima, NULL, NULL);
+	if (scene_use_new_shading_nodes(s->scene)) {
+		MFace *mf = &s->dm_mface[face_index];
+		ED_object_get_active_image(s->ob, mf->mat_nr + 1, &ima, NULL, NULL);
 	}
 	else {
-		MTFace *tf = s->me->mtface+face_index;
+		MTFace *tf = &s->dm_mtface[face_index];
 		ima = tf->tpage;
 	}
 
@@ -538,9 +546,9 @@ static Image *project_paint_face_image(const ProjPaintState *ps, MTFace *dm_mtfa
 {
 	Image *ima;
 
-	if(ps->do_new_shading_nodes) { /* cached scene_use_new_shading_nodes result */
-		MFace *mf = ps->dm_mface+face_index;
-		ED_object_get_active_image(ps->ob, mf->mat_nr, &ima, NULL, NULL);
+	if (ps->do_new_shading_nodes) { /* cached scene_use_new_shading_nodes result */
+		MFace *mf = ps->dm_mface + face_index;
+		ED_object_get_active_image(ps->ob, mf->mat_nr + 1, &ima, NULL, NULL);
 	}
 	else {
 		ima = dm_mtface[face_index].tpage;
@@ -562,15 +570,15 @@ static int project_bucket_offset(const ProjPaintState *ps, const float projCoSS[
 	 *
 	 * Second multiplication does similar but for vertical offset
 	 */
-	return	(	(int)(((projCoSS[0] - ps->screenMin[0]) / ps->screen_width)  * ps->buckets_x)) + 
-		(	(	(int)(((projCoSS[1] - ps->screenMin[1])  / ps->screen_height) * ps->buckets_y)) * ps->buckets_x);
+	return (   (int)(((projCoSS[0] - ps->screenMin[0]) / ps->screen_width)  * ps->buckets_x)) +
+	       (   (   (int)(((projCoSS[1] - ps->screenMin[1])  / ps->screen_height) * ps->buckets_y)) * ps->buckets_x);
 }
 
 static int project_bucket_offset_safe(const ProjPaintState *ps, const float projCoSS[2])
 {
 	int bucket_index = project_bucket_offset(ps, projCoSS);
 	
-	if (bucket_index < 0 || bucket_index >= ps->buckets_x*ps->buckets_y) {	
+	if (bucket_index < 0 || bucket_index >= ps->buckets_x * ps->buckets_y) {
 		return -1;
 	}
 	else {
@@ -586,23 +594,23 @@ static void barycentric_weights_v2_persp(float v1[4], float v2[4], float v3[4],
 	w[0] = area_tri_signed_v2(v2, v3, co) / v1[3];
 	w[1] = area_tri_signed_v2(v3, v1, co) / v2[3];
 	w[2] = area_tri_signed_v2(v1, v2, co) / v3[3];
-	wtot = w[0]+w[1]+w[2];
+	wtot = w[0] + w[1] + w[2];
 
 	if (wtot != 0.0f) {
-		wtot_inv = 1.0f/wtot;
+		wtot_inv = 1.0f / wtot;
 
-		w[0] = w[0]*wtot_inv;
-		w[1] = w[1]*wtot_inv;
-		w[2] = w[2]*wtot_inv;
+		w[0] = w[0] * wtot_inv;
+		w[1] = w[1] * wtot_inv;
+		w[2] = w[2] * wtot_inv;
 	}
 	else /* dummy values for zero area face */
-		w[0] = w[1] = w[2] = 1.0f/3.0f;
+		w[0] = w[1] = w[2] = 1.0f / 3.0f;
 }
 
 static float VecZDepthOrtho(float pt[2], float v1[3], float v2[3], float v3[3], float w[3])
 {
 	barycentric_weights_v2(v1, v2, v3, pt, w);
-	return (v1[2]*w[0]) + (v2[2]*w[1]) + (v3[2]*w[2]);
+	return (v1[2] * w[0]) + (v2[2] * w[1]) + (v3[2] * w[2]);
 }
 
 static float VecZDepthPersp(float pt[2], float v1[4], float v2[4], float v3[4], float w[3])
@@ -617,24 +625,24 @@ static float VecZDepthPersp(float pt[2], float v1[4], float v2[4], float v3[4],
 	 *
 	 * don't call barycentric_weights_v2() becaue our callers expect 'w'
 	 * to be weighted from the perspective */
-	w_tmp[0]= w[0] * v1[3];
-	w_tmp[1]= w[1] * v2[3];
-	w_tmp[2]= w[2] * v3[3];
+	w_tmp[0] = w[0] * v1[3];
+	w_tmp[1] = w[1] * v2[3];
+	w_tmp[2] = w[2] * v3[3];
 
-	wtot = w_tmp[0]+w_tmp[1]+w_tmp[2];
+	wtot = w_tmp[0] + w_tmp[1] + w_tmp[2];
 
 	if (wtot != 0.0f) {
-		wtot_inv = 1.0f/wtot;
+		wtot_inv = 1.0f / wtot;
 
-		w_tmp[0] = w_tmp[0]*wtot_inv;
-		w_tmp[1] = w_tmp[1]*wtot_inv;
-		w_tmp[2] = w_tmp[2]*wtot_inv;
+		w_tmp[0] = w_tmp[0] * wtot_inv;
+		w_tmp[1] = w_tmp[1] * wtot_inv;
+		w_tmp[2] = w_tmp[2] * wtot_inv;
 	}
 	else /* dummy values for zero area face */
-		w_tmp[0] = w_tmp[1] = w_tmp[2] = 1.0f/3.0f;
+		w_tmp[0] = w_tmp[1] = w_tmp[2] = 1.0f / 3.0f;
 	/* done mimicing barycentric_weights_v2() */
 
-	return (v1[2]*w_tmp[0]) + (v2[2]*w_tmp[1]) + (v3[2]*w_tmp[2]);
+	return (v1[2] * w_tmp[0]) + (v2[2] * w_tmp[1]) + (v3[2] * w_tmp[2]);
 }
 
 
@@ -652,7 +660,7 @@ static int project_paint_PickFace(const ProjPaintState *ps, float pt[2], float w
 	MFace *mf;
 	
 	bucket_index = project_bucket_offset_safe(ps, pt);
-	if (bucket_index==-1)
+	if (bucket_index == -1)
 		return -1;
 	
 	
@@ -660,17 +668,17 @@ static int project_paint_PickFace(const ProjPaintState *ps, float pt[2], float w
 	/* we could return 0 for 1 face buckets, as long as this function assumes
 	 * that the point its testing is only every originated from an existing face */
 	
-	for (node= ps->bucketFaces[bucket_index]; node; node= node->next) {
+	for (node = ps->bucketFaces[bucket_index]; node; node = node->next) {
 		face_index = GET_INT_FROM_POINTER(node->link);
-		mf= ps->dm_mface + face_index;
+		mf = ps->dm_mface + face_index;
 		
-		v1= ps->screenCoords[mf->v1];
-		v2= ps->screenCoords[mf->v2];
-		v3= ps->screenCoords[mf->v3];
+		v1 = ps->screenCoords[mf->v1];
+		v2 = ps->screenCoords[mf->v2];
+		v3 = ps->screenCoords[mf->v3];
 		
 		if (isect_point_tri_v2(pt, v1, v2, v3)) {
-			if (ps->is_ortho)	z_depth= VecZDepthOrtho(pt, v1, v2, v3, w_tmp);
-			else				z_depth= VecZDepthPersp(pt, v1, v2, v3, w_tmp);
+			if (ps->is_ortho) z_depth = VecZDepthOrtho(pt, v1, v2, v3, w_tmp);
+			else z_depth = VecZDepthPersp(pt, v1, v2, v3, w_tmp);
 			
 			if (z_depth < z_depth_best) {
 				best_face_index = face_index;
@@ -680,15 +688,15 @@ static int project_paint_PickFace(const ProjPaintState *ps, float pt[2], float w
 			}
 		}
 		else if (mf->v4) {
-			v4= ps->screenCoords[mf->v4];
+			v4 = ps->screenCoords[mf->v4];
 			
 			if (isect_point_tri_v2(pt, v1, v3, v4)) {
-				if (ps->is_ortho)	z_depth= VecZDepthOrtho(pt, v1, v3, v4, w_tmp);
-				else				z_depth= VecZDepthPersp(pt, v1, v3, v4, w_tmp);
+				if (ps->is_ortho) z_depth = VecZDepthOrtho(pt, v1, v3, v4, w_tmp);
+				else z_depth = VecZDepthPersp(pt, v1, v3, v4, w_tmp);
 
 				if (z_depth < z_depth_best) {
 					best_face_index = face_index;
-					best_side= 1;
+					best_side = 1;
 					z_depth_best = z_depth;
 					copy_v3_v3(w, w_tmp);
 				}
@@ -775,10 +783,10 @@ static int project_paint_PickColor(const ProjPaintState *ps, float pt[2], float
 		//if (xi<0 || xi>=ibuf->x  ||  yi<0 || yi>=ibuf->y) return 0;
 		
 		/* wrap */
-		xi = ((int)(uv[0]*ibuf->x)) % ibuf->x;
-		if (xi<0) xi += ibuf->x;
-		yi = ((int)(uv[1]*ibuf->y)) % ibuf->y;
-		if (yi<0) yi += ibuf->y;
+		xi = ((int)(uv[0] * ibuf->x)) % ibuf->x;
+		if (xi < 0) xi += ibuf->x;
+		yi = ((int)(uv[1] * ibuf->y)) % ibuf->y;
+		if (yi < 0) yi += ibuf->y;
 		
 		
 		if (rgba) {
@@ -796,7 +804,7 @@ static int project_paint_PickColor(const ProjPaintState *ps, float pt[2], float
 				copy_v4_v4(rgba_fp, ((float *)ibuf->rect_float + ((xi + yi * ibuf->x) * 4)));
 			}
 			else {
-				char *tmp_ch= ((char *)ibuf->rect) + ((xi + yi * ibuf->x) * 4);
+				char *tmp_ch = ((char *)ibuf->rect) + ((xi + yi * ibuf->x) * 4);
 				IMAPAINT_CHAR_RGBA_TO_FLOAT(rgba_fp, tmp_ch);
 			}
 		}
@@ -809,22 +817,22 @@ static int project_paint_PickColor(const ProjPaintState *ps, float pt[2], float
  *  0	: no occlusion
  * -1	: no occlusion but 2D intersection is true (avoid testing the other half of a quad)
  *  1	: occluded
-	2	: occluded with w[3] weights set (need to know in some cases) */
+ *  2	: occluded with w[3] weights set (need to know in some cases) */
 
 static int project_paint_occlude_ptv(float pt[3], float v1[4], float v2[4], float v3[4], float w[3], int is_ortho)
 {
 	/* if all are behind us, return false */
-	if(v1[2] > pt[2] && v2[2] > pt[2] && v3[2] > pt[2])
+	if (v1[2] > pt[2] && v2[2] > pt[2] && v3[2] > pt[2])
 		return 0;
 		
 	/* do a 2D point in try intersection */
 	if (!isect_point_tri_v2(pt, v1, v2, v3))
-		return 0; /* we know there is  */
+		return 0;  /* we know there is  */
 	
 
 	/* From here on we know there IS an intersection */
 	/* if ALL of the verts are infront of us then we know it intersects ? */
-	if(v1[2] < pt[2] && v2[2] < pt[2] && v3[2] < pt[2]) {
+	if (v1[2] < pt[2] && v2[2] < pt[2] && v3[2] < pt[2]) {
 		return 1;
 	}
 	else {
@@ -841,10 +849,9 @@ static int project_paint_occlude_ptv(float pt[3], float v1[4], float v2[4], floa
 }
 
 
-static int project_paint_occlude_ptv_clip(
-		const ProjPaintState *ps, const MFace *mf,
-		float pt[3], float v1[4], float v2[4], float v3[4],
-		const int side )
+static int project_paint_occlude_ptv_clip(const ProjPaintState *ps, const MFace *mf,
+                                          float pt[3], float v1[4], float v2[4], float v3[4],
+                                          const int side)
 {
 	float w[3], wco[3];
 	int ret = project_paint_occlude_ptv(pt, v1, v2, v3, w, ps->is_ortho);
@@ -852,16 +859,16 @@ static int project_paint_occlude_ptv_clip(
 	if (ret <= 0)
 		return ret;
 
-	if (ret==1) { /* weights not calculated */
-		if (ps->is_ortho)	barycentric_weights_v2(v1, v2, v3, pt, w);
-		else				barycentric_weights_v2_persp(v1, v2, v3, pt, w);
+	if (ret == 1) { /* weights not calculated */
+		if (ps->is_ortho) barycentric_weights_v2(v1, v2, v3, pt, w);
+		else barycentric_weights_v2_persp(v1, v2, v3, pt, w);
 	}
 
 	/* Test if we're in the clipped area, */
-	if (side)	interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v3].co, ps->dm_mvert[mf->v4].co, w);
-	else		interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v2].co, ps->dm_mvert[mf->v3].co, w);
+	if (side) interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v3].co, ps->dm_mvert[mf->v4].co, w);
+	else interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v2].co, ps->dm_mvert[mf->v3].co, w);
 	
-	if(!ED_view3d_test_clipping(ps->rv3d, wco, 1)) {
+	if (!ED_view3d_clipping_test(ps->rv3d, wco, TRUE)) {
 		return 1;
 	}
 	
@@ -878,7 +885,7 @@ static int project_bucket_point_occluded(const ProjPaintState *ps, LinkNode *buc
 	int face_index;
 	int isect_ret;
 	float w[3]; /* not needed when clipping */
-	const short do_clip= ps->rv3d ? ps->rv3d->rflag & RV3D_CLIPPING : 0;
+	const short do_clip = ps->rv3d ? ps->rv3d->rflag & RV3D_CLIPPING : 0;
 	
 	/* we could return 0 for 1 face buckets, as long as this function assumes
 	 * that the point its testing is only every originated from an existing face */
@@ -888,19 +895,19 @@ static int project_bucket_point_occluded(const ProjPaintState *ps, LinkNode *buc
 
 		if (orig_face != face_index) {
 			mf = ps->dm_mface + face_index;
-			if(do_clip)
+			if (do_clip)
 				isect_ret = project_paint_occlude_ptv_clip(ps, mf, pixelScreenCo, ps->screenCoords[mf->v1], ps->screenCoords[mf->v2], ps->screenCoords[mf->v3], 0);
 			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 dont want to test the other side of the quad */
-			if (isect_ret==0 && mf->v4) {
-				if(do_clip)
+			/* 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);
 				else
 					isect_ret = project_paint_occlude_ptv(pixelScreenCo, ps->screenCoords[mf->v1], ps->screenCoords[mf->v3], ps->screenCoords[mf->v4], w, ps->is_ortho);
 			}
-			if (isect_ret>=1) {
+			if (isect_ret >= 1) {
 				/* TODO - we may want to cache the first hit,
 				 * it is not possible to swap the face order in the list anymore */
 				return 1;
@@ -919,28 +926,28 @@ static int line_isect_y(const float p1[2], const float p2[2], const float y_leve
 {
 	float y_diff;
 	
-	if (y_level==p1[1]) { /* are we touching the first point? - no interpolation needed */
+	if (y_level == p1[1]) { /* are we touching the first point? - no interpolation needed */
 		*x_isect = p1[0];
 		return ISECT_TRUE_P1;
 	}
-	if (y_level==p2[1]) { /* are we touching the second point? - no interpolation needed */
+	if (y_level == p2[1]) { /* are we touching the second point? - no interpolation needed */
 		*x_isect = p2[0];
 		return ISECT_TRUE_P2;
 	}
 	
-	y_diff= fabsf(p1[1]-p2[1]); /* yuck, horizontal line, we cant do much here */
+	y_diff = fabsf(p1[1] - p2[1]); /* yuck, horizontal line, we cant do much here */
 	
 	if (y_diff < 0.000001f) {
-		*x_isect = (p1[0]+p2[0]) * 0.5f;
+		*x_isect = (p1[0] + p2[0]) * 0.5f;
 		return ISECT_TRUE;		
 	}
 	
 	if (p1[1] > y_level && p2[1] < y_level) {
-		*x_isect = (p2[0]*(p1[1]-y_level) + p1[0]*(y_level-p2[1])) / y_diff;  /*(p1[1]-p2[1]);*/
+		*x_isect = (p2[0] * (p1[1] - y_level) + p1[0] * (y_level - p2[1])) / y_diff;  /*(p1[1]-p2[1]);*/
 		return ISECT_TRUE;
 	}
 	else if (p1[1] < y_level && p2[1] > y_level) {
-		*x_isect = (p2[0]*(y_level-p1[1]) + p1[0]*(p2[1]-y_level)) / y_diff;  /*(p2[1]-p1[1]);*/
+		*x_isect = (p2[0] * (y_level - p1[1]) + p1[0] * (p2[1] - y_level)) / y_diff;  /*(p2[1]-p1[1]);*/
 		return ISECT_TRUE;
 	}
 	else {
@@ -952,28 +959,28 @@ static int line_isect_x(const float p1[2], const float p2[2], const float x_leve
 {
 	float x_diff;
 	
-	if (x_level==p1[0]) { /* are we touching the first point? - no interpolation needed */
+	if (x_level == p1[0]) { /* are we touching the first point? - no interpolation needed */
 		*y_isect = p1[1];
 		return ISECT_TRUE_P1;
 	}
-	if (x_level==p2[0]) { /* are we touching the second point? - no interpolation needed */
+	if (x_level == p2[0]) { /* are we touching the second point? - no interpolation needed */
 		*y_isect = p2[1];
 		return ISECT_TRUE_P2;
 	}
 	
-	x_diff= fabsf(p1[0]-p2[0]); /* yuck, horizontal line, we cant do much here */
+	x_diff = fabsf(p1[0] - p2[0]); /* yuck, horizontal line, we cant do much here */
 	
 	if (x_diff < 0.000001f) { /* yuck, vertical line, we cant do much here */
-		*y_isect = (p1[0]+p2[0]) * 0.5f;
+		*y_isect = (p1[0] + p2[0]) * 0.5f;
 		return ISECT_TRUE;		
 	}
 	
 	if (p1[0] > x_level && p2[0] < x_level) {
-		*y_isect = (p2[1]*(p1[0]-x_level) + p1[1]*(x_level-p2[0])) / x_diff; /*(p1[0]-p2[0]);*/
+		*y_isect = (p2[1] * (p1[0] - x_level) + p1[1] * (x_level - p2[0])) / x_diff; /*(p1[0]-p2[0]);*/
 		return ISECT_TRUE;
 	}
 	else if (p1[0] < x_level && p2[0] > x_level) {
-		*y_isect = (p2[1]*(x_level-p1[0]) + p1[1]*(p2[0]-x_level)) / x_diff; /*(p2[0]-p1[0]);*/
+		*y_isect = (p2[1] * (x_level - p1[0]) + p1[1] * (p2[0] - x_level)) / x_diff; /*(p2[0]-p1[0]);*/
 		return ISECT_TRUE;
 	}
 	else {
@@ -1001,7 +1008,7 @@ static int cmp_uv(const float vec2a[2], const float vec2b[2])
 	if (xb < 0.0f) xb += 1.0f;
 	if (yb < 0.0f) yb += 1.0f;
 	
-	return ((fabsf(xa-xb) < PROJ_GEOM_TOLERANCE) && (fabsf(ya-yb) < PROJ_GEOM_TOLERANCE)) ? 1:0;
+	return ((fabsf(xa - xb) < PROJ_GEOM_TOLERANCE) && (fabsf(ya - yb) < PROJ_GEOM_TOLERANCE)) ? 1 : 0;
 }
 #endif
 
@@ -1009,11 +1016,12 @@ static int cmp_uv(const float vec2a[2], const float vec2b[2])
  * return zero if there is no area in the returned rectangle */
 #ifndef PROJ_DEBUG_NOSEAMBLEED
 static int pixel_bounds_uv(
-		const float uv1[2], const float uv2[2], const float uv3[2], const float uv4[2],
-		rcti *bounds_px,
-		const int ibuf_x, const int ibuf_y,
-		int is_quad
-) {
+        const float uv1[2], const float uv2[2], const float uv3[2], const float uv4[2],
+        rcti *bounds_px,
+        const int ibuf_x, const int ibuf_y,
+        int is_quad
+        )
+{
 	float min_uv[2], max_uv[2]; /* UV bounds */
 	
 	INIT_MINMAX2(min_uv, max_uv);
@@ -1027,21 +1035,21 @@ static int pixel_bounds_uv(
 	bounds_px->xmin = (int)(ibuf_x * min_uv[0]);
 	bounds_px->ymin = (int)(ibuf_y * min_uv[1]);
 	
-	bounds_px->xmax = (int)(ibuf_x * max_uv[0]) +1;
-	bounds_px->ymax = (int)(ibuf_y * max_uv[1]) +1;
+	bounds_px->xmax = (int)(ibuf_x * max_uv[0]) + 1;
+	bounds_px->ymax = (int)(ibuf_y * max_uv[1]) + 1;
 	
-	/*printf("%d %d %d %d \n", min_px[0], min_px[1], max_px[0], max_px[1]);*/
+	/*printf("%d %d %d %d\n", min_px[0], min_px[1], max_px[0], max_px[1]);*/
 	
 	/* face uses no UV area when quantized to pixels? */
 	return (bounds_px->xmin == bounds_px->xmax || bounds_px->ymin == bounds_px->ymax) ? 0 : 1;
 }
 #endif
 
-static int pixel_bounds_array(float (* uv)[2], rcti *bounds_px, const int ibuf_x, const int ibuf_y, int tot)
+static int pixel_bounds_array(float (*uv)[2], rcti *bounds_px, const int ibuf_x, const int ibuf_y, int tot)
 {
 	float min_uv[2], max_uv[2]; /* UV bounds */
 	
-	if (tot==0) {
+	if (tot == 0) {
 		return 0;
 	}
 	
@@ -1055,10 +1063,10 @@ static int pixel_bounds_array(float (* uv)[2], rcti *bounds_px, const int ibuf_x
 	bounds_px->xmin = (int)(ibuf_x * min_uv[0]);
 	bounds_px->ymin = (int)(ibuf_y * min_uv[1]);
 	
-	bounds_px->xmax = (int)(ibuf_x * max_uv[0]) +1;
-	bounds_px->ymax = (int)(ibuf_y * max_uv[1]) +1;
+	bounds_px->xmax = (int)(ibuf_x * max_uv[0]) + 1;
+	bounds_px->ymax = (int)(ibuf_y * max_uv[1]) + 1;
 	
-	/*printf("%d %d %d %d \n", min_px[0], min_px[1], max_px[0], max_px[1]);*/
+	/*printf("%d %d %d %d\n", min_px[0], min_px[1], max_px[0], max_px[1]);*/
 	
 	/* face uses no UV area when quantized to pixels? */
 	return (bounds_px->xmin == bounds_px->xmax || bounds_px->ymin == bounds_px->ymax) ? 0 : 1;
@@ -1094,15 +1102,15 @@ static int check_seam(const ProjPaintState *ps, const int orig_face, const int o
 			
 			/* We need to know the order of the verts in the adjacent face 
 			 * set the i1_fidx and i2_fidx to (0,1,2,3) */
-			if		(mf->v1==i1)			i1_fidx = 0;
-			else if	(mf->v2==i1)			i1_fidx = 1;
-			else if	(mf->v3==i1)			i1_fidx = 2;
-			else if	(mf->v4 && mf->v4==i1)	i1_fidx = 3;
-			
-			if		(mf->v1==i2)			i2_fidx = 0;
-			else if	(mf->v2==i2)			i2_fidx = 1;
-			else if	(mf->v3==i2)			i2_fidx = 2;
-			else if	(mf->v4 && mf->v4==i2)	i2_fidx = 3;
+			if      (mf->v1 == i1) i1_fidx = 0;
+			else if (mf->v2 == i1) i1_fidx = 1;
+			else if (mf->v3 == i1) i1_fidx = 2;
+			else if (mf->v4 && mf->v4 == i1) i1_fidx = 3;
+
+			if      (mf->v1 == i2) i2_fidx = 0;
+			else if (mf->v2 == i2) i2_fidx = 1;
+			else if (mf->v3 == i2) i2_fidx = 2;
+			else if (mf->v4 && mf->v4 == i2) i2_fidx = 3;
 			
 			/* Only need to check if 'i2_fidx' is valid because we know i1_fidx is the same vert on both faces */
 			if (i2_fidx != -1) {
@@ -1117,9 +1125,9 @@ static int check_seam(const ProjPaintState *ps, const int orig_face, const int o
 				*orig_fidx = (i1_fidx < i2_fidx) ? i1_fidx : i2_fidx;
 				
 				/* first test if they have the same image */
-				if (	(orig_tpage == tpage) &&
-						cmp_uv(orig_tf->uv[orig_i1_fidx], tf->uv[i1_fidx]) &&
-						cmp_uv(orig_tf->uv[orig_i2_fidx], tf->uv[i2_fidx]) )
+				if ((orig_tpage == tpage) &&
+				    cmp_uv(orig_tf->uv[orig_i1_fidx], tf->uv[i1_fidx]) &&
+				    cmp_uv(orig_tf->uv[orig_i2_fidx], tf->uv[i2_fidx]) )
 				{
 					// printf("SEAM (NONE)\n");
 					return 0;
@@ -1142,14 +1150,14 @@ static int check_seam(const ProjPaintState *ps, const int orig_face, const int o
  * note that the image aspect is taken into account */
 static void uv_image_outset(float (*orig_uv)[2], float (*outset_uv)[2], const float scaler, const int ibuf_x, const int ibuf_y, const int is_quad)
 {
-	float a1, a2, a3, a4=0.0f;
+	float a1, a2, a3, a4 = 0.0f;
 	float puv[4][2]; /* pixelspace uv's */
 	float no1[2], no2[2], no3[2], no4[2]; /* normals */
 	float dir1[2], dir2[2], dir3[2], dir4[2];
 	float ibuf_inv[2];
 
-	ibuf_inv[0]= 1.0f / (float)ibuf_x;
-	ibuf_inv[1]= 1.0f / (float)ibuf_y;
+	ibuf_inv[0] = 1.0f / (float)ibuf_x;
+	ibuf_inv[1] = 1.0f / (float)ibuf_y;
 
 	/* make UV's in pixel space so we can */
 	puv[0][0] = orig_uv[0][0] * ibuf_x;
@@ -1187,15 +1195,15 @@ static void uv_image_outset(float (*orig_uv)[2], float (*outset_uv)[2], const fl
 	 * This is incorrect. Its already given radians but without it wont work.
 	 * need to look into a fix - campbell */
 	if (is_quad) {
-		a1 = shell_angle_to_dist(angle_normalized_v2v2(dir4, dir1) * ((float)M_PI/180.0f));
-		a2 = shell_angle_to_dist(angle_normalized_v2v2(dir1, dir2) * ((float)M_PI/180.0f));
-		a3 = shell_angle_to_dist(angle_normalized_v2v2(dir2, dir3) * ((float)M_PI/180.0f));
-		a4 = shell_angle_to_dist(angle_normalized_v2v2(dir3, dir4) * ((float)M_PI/180.0f));
+		a1 = shell_angle_to_dist(angle_normalized_v2v2(dir4, dir1) * ((float)M_PI / 180.0f));
+		a2 = shell_angle_to_dist(angle_normalized_v2v2(dir1, dir2) * ((float)M_PI / 180.0f));
+		a3 = shell_angle_to_dist(angle_normalized_v2v2(dir2, dir3) * ((float)M_PI / 180.0f));
+		a4 = shell_angle_to_dist(angle_normalized_v2v2(dir3, dir4) * ((float)M_PI / 180.0f));
 	}
 	else {
-		a1 = shell_angle_to_dist(angle_normalized_v2v2(dir3, dir1) * ((float)M_PI/180.0f));
-		a2 = shell_angle_to_dist(angle_normalized_v2v2(dir1, dir2) * ((float)M_PI/180.0f));
-		a3 = shell_angle_to_dist(angle_normalized_v2v2(dir2, dir3) * ((float)M_PI/180.0f));
+		a1 = shell_angle_to_dist(angle_normalized_v2v2(dir3, dir1) * ((float)M_PI / 180.0f));
+		a2 = shell_angle_to_dist(angle_normalized_v2v2(dir1, dir2) * ((float)M_PI / 180.0f));
+		a3 = shell_angle_to_dist(angle_normalized_v2v2(dir2, dir3) * ((float)M_PI / 180.0f));
 	}
 	
 	if (is_quad) {
@@ -1207,10 +1215,10 @@ static void uv_image_outset(float (*orig_uv)[2], float (*outset_uv)[2], const fl
 		normalize_v2(no2);
 		normalize_v2(no3);
 		normalize_v2(no4);
-		mul_v2_fl(no1, a1*scaler);
-		mul_v2_fl(no2, a2*scaler);
-		mul_v2_fl(no3, a3*scaler);
-		mul_v2_fl(no4, a4*scaler);
+		mul_v2_fl(no1, a1 * scaler);
+		mul_v2_fl(no2, a2 * scaler);
+		mul_v2_fl(no3, a3 * scaler);
+		mul_v2_fl(no4, a4 * scaler);
 		add_v2_v2v2(outset_uv[0], puv[0], no1);
 		add_v2_v2v2(outset_uv[1], puv[1], no2);
 		add_v2_v2v2(outset_uv[2], puv[2], no3);
@@ -1227,9 +1235,9 @@ static void uv_image_outset(float (*orig_uv)[2], float (*outset_uv)[2], const fl
 		normalize_v2(no1);
 		normalize_v2(no2);
 		normalize_v2(no3);
-		mul_v2_fl(no1, a1*scaler);
-		mul_v2_fl(no2, a2*scaler);
-		mul_v2_fl(no3, a3*scaler);
+		mul_v2_fl(no1, a1 * scaler);
+		mul_v2_fl(no2, a2 * scaler);
+		mul_v2_fl(no3, a3 * scaler);
 		add_v2_v2v2(outset_uv[0], puv[0], no1);
 		add_v2_v2v2(outset_uv[1], puv[1], no2);
 		add_v2_v2v2(outset_uv[2], puv[2], no3);
@@ -1253,16 +1261,16 @@ static void project_face_seams_init(const ProjPaintState *ps, const int face_ind
 	int fidx2 = 0; /* next fidx in the face (0,1,2,3) -> (1,2,3,0) or (0,1,2) -> (1,2,0) for a tri */
 	
 	do {
-		if ((ps->faceSeamFlags[face_index] & (1<<fidx1|16<<fidx1)) == 0) {
+		if ((ps->faceSeamFlags[face_index] & (1 << fidx1 | 16 << fidx1)) == 0) {
 			if (check_seam(ps, face_index, fidx1, fidx2, &other_face, &other_fidx)) {
-				ps->faceSeamFlags[face_index] |= 1<<fidx1;
+				ps->faceSeamFlags[face_index] |= 1 << fidx1;
 				if (other_face != -1)
-					ps->faceSeamFlags[other_face] |= 1<<other_fidx;
+					ps->faceSeamFlags[other_face] |= 1 << other_fidx;
 			}
 			else {
-				ps->faceSeamFlags[face_index] |= 16<<fidx1;
+				ps->faceSeamFlags[face_index] |= 16 << fidx1;
 				if (other_face != -1)
-					ps->faceSeamFlags[other_face] |= 16<<other_fidx; /* second 4 bits for disabled */
+					ps->faceSeamFlags[other_face] |= 16 << other_fidx;  /* second 4 bits for disabled */
 			}
 		}
 		
@@ -1277,11 +1285,11 @@ static void project_face_seams_init(const ProjPaintState *ps, const int face_ind
  * 
  * This is used for finding a pixels location in screenspace for painting */
 static void screen_px_from_ortho(
-		float uv[2],
-		float v1co[3], float v2co[3], float v3co[3], /* Screenspace coords */
-		float uv1co[2], float uv2co[2], float uv3co[2],
-		float pixelScreenCo[4],
-		float w[3])
+        float uv[2],
+        float v1co[3], float v2co[3], float v3co[3],  /* Screenspace coords */
+        float uv1co[2], float uv2co[2], float uv3co[2],
+        float pixelScreenCo[4],
+        float w[3])
 {
 	barycentric_weights_v2(uv1co, uv2co, uv3co, uv, w);
 	interp_v3_v3v3v3(pixelScreenCo, v1co, v2co, v3co, w);
@@ -1290,11 +1298,11 @@ static void screen_px_from_ortho(
 /* same as screen_px_from_ortho except we need to take into account
  * the perspective W coord for each vert */
 static void screen_px_from_persp(
-		float uv[2],
-		float v1co[4], float v2co[4], float v3co[4], /* screenspace coords */
-		float uv1co[2], float uv2co[2], float uv3co[2],
-		float pixelScreenCo[4],
-		float w[3])
+        float uv[2],
+        float v1co[4], float v2co[4], float v3co[4],  /* screenspace coords */
+        float uv1co[2], float uv2co[2], float uv3co[2],
+        float pixelScreenCo[4],
+        float w[3])
 {
 
 	float wtot_inv, wtot;
@@ -1305,7 +1313,7 @@ static void screen_px_from_persp(
 	w[1] *= v2co[3];
 	w[2] *= v3co[3];
 	
-	wtot = w[0]+w[1]+w[2];
+	wtot = w[0] + w[1] + w[2];
 	
 	if (wtot > 0.0f) {
 		wtot_inv = 1.0f / wtot;
@@ -1314,7 +1322,7 @@ static void screen_px_from_persp(
 		w[2] *= wtot_inv;
 	}
 	else {
-		w[0] = w[1] = w[2] = 1.0f/3.0f; /* dummy values for zero area face */
+		w[0] = w[1] = w[2] = 1.0f / 3.0f;  /* dummy values for zero area face */
 	}
 	/* done re-weighting */
 	
@@ -1327,7 +1335,7 @@ static void project_face_pixel(const MTFace *tf_other, ImBuf *ibuf_other, const
 	float uv_other[2], x, y;
 	
 	uvCo1 =  (float *)tf_other->uv[0];
-	if (side==1) {
+	if (side == 1) {
 		uvCo2 =  (float *)tf_other->uv[2];
 		uvCo3 =  (float *)tf_other->uv[3];
 	}
@@ -1336,7 +1344,7 @@ static void project_face_pixel(const MTFace *tf_other, ImBuf *ibuf_other, const
 		uvCo3 =  (float *)tf_other->uv[2];
 	}
 	
-	interp_v2_v2v2v2(uv_other, uvCo1, uvCo2, uvCo3, (float*)w);
+	interp_v2_v2v2v2(uv_other, uvCo1, uvCo2, uvCo3, (float *)w);
 	
 	/* use */
 	uvco_to_wrapped_pxco(uv_other, ibuf_other->x, ibuf_other->y, &x, &y);
@@ -1351,12 +1359,12 @@ static void project_face_pixel(const MTFace *tf_other, ImBuf *ibuf_other, const
 		
 }
 
-/* run this outside project_paint_uvpixel_init since pixels with mask 0 dont need init */
+/* run this outside project_paint_uvpixel_init since pixels with mask 0 don't need init */
 static float project_paint_uvpixel_mask(
-		const ProjPaintState *ps,
-		const int face_index,
-		const int side,
-		const float w[3])
+        const ProjPaintState *ps,
+        const int face_index,
+        const int side,
+        const float w[3])
 {
 	float mask;
 	
@@ -1375,10 +1383,10 @@ static float project_paint_uvpixel_mask(
 			project_face_pixel(tf_other, ibuf_other, w, side, rgba_ub, rgba_f);
 			
 			if (ibuf_other->rect_float) { /* from float to float */
-				mask = ((rgba_f[0]+rgba_f[1]+rgba_f[2])/3.0f) * rgba_f[3];
+				mask = ((rgba_f[0] + rgba_f[1] + rgba_f[2]) / 3.0f) * rgba_f[3];
 			}
 			else { /* from char to float */
-				mask = ((rgba_ub[0]+rgba_ub[1]+rgba_ub[2])/(256*3.0f)) * (rgba_ub[3]/256.0f);
+				mask = ((rgba_ub[0] + rgba_ub[1] + rgba_ub[2]) / (256 * 3.0f)) * (rgba_ub[3] / 256.0f);
 			}
 			
 			if (!ps->do_layer_stencil_inv) /* matching the gimps layer mask black/white rules, white==full opacity */
@@ -1391,7 +1399,8 @@ static float project_paint_uvpixel_mask(
 		else {
 			return 0.0f;
 		}
-	} else {
+	}
+	else {
 		mask = 1.0f;
 	}
 	
@@ -1401,7 +1410,7 @@ static float project_paint_uvpixel_mask(
 		short *no1, *no2, *no3;
 		float no[3], angle;
 		no1 = ps->dm_mvert[mf->v1].no;
-		if (side==1) {
+		if (side == 1) {
 			no2 = ps->dm_mvert[mf->v3].no;
 			no3 = ps->dm_mvert[mf->v4].no;
 		}
@@ -1410,9 +1419,9 @@ static float project_paint_uvpixel_mask(
 			no3 = ps->dm_mvert[mf->v3].no;
 		}
 		
-		no[0] = w[0]*no1[0] + w[1]*no2[0] + w[2]*no3[0];
-		no[1] = w[0]*no1[1] + w[1]*no2[1] + w[2]*no3[1];
-		no[2] = w[0]*no1[2] + w[1]*no2[2] + w[2]*no3[2];
+		no[0] = w[0] * no1[0] + w[1] * no2[0] + w[2] * no3[0];
+		no[1] = w[0] * no1[1] + w[1] * no2[1] + w[2] * no3[1];
+		no[2] = w[0] * no1[2] + w[1] * no2[2] + w[2] * no3[2];
 		normalize_v3(no);
 		
 		/* now we can use the normal as a mask */
@@ -1424,7 +1433,7 @@ static float project_paint_uvpixel_mask(
 			float viewDirPersp[3];
 			float *co1, *co2, *co3;
 			co1 = ps->dm_mvert[mf->v1].co;
-			if (side==1) {
+			if (side == 1) {
 				co2 = ps->dm_mvert[mf->v3].co;
 				co3 = ps->dm_mvert[mf->v4].co;
 			}
@@ -1434,9 +1443,9 @@ static float project_paint_uvpixel_mask(
 			}
 
 			/* Get the direction from the viewPoint to the pixel and normalize */
-			viewDirPersp[0] = (ps->viewPos[0] - (w[0]*co1[0] + w[1]*co2[0] + w[2]*co3[0]));
-			viewDirPersp[1] = (ps->viewPos[1] - (w[0]*co1[1] + w[1]*co2[1] + w[2]*co3[1]));
-			viewDirPersp[2] = (ps->viewPos[2] - (w[0]*co1[2] + w[1]*co2[2] + w[2]*co3[2]));
+			viewDirPersp[0] = (ps->viewPos[0] - (w[0] * co1[0] + w[1] * co2[0] + w[2] * co3[0]));
+			viewDirPersp[1] = (ps->viewPos[1] - (w[0] * co1[1] + w[1] * co2[1] + w[2] * co3[1]));
+			viewDirPersp[2] = (ps->viewPos[2] - (w[0] * co1[2] + w[1] * co2[2] + w[2] * co3[2]));
 			normalize_v3(viewDirPersp);
 			
 			angle = angle_normalized_v3v3(viewDirPersp, no);
@@ -1451,7 +1460,7 @@ static float project_paint_uvpixel_mask(
 	}
 	
 	// This only works when the opacity dosnt change while painting, stylus pressure messes with this
-	// so dont use it.
+	// so don't use it.
 	// if (ps->is_airbrush==0) mask *= brush_alpha(ps->brush);
 	
 	return mask;
@@ -1460,30 +1469,30 @@ static float project_paint_uvpixel_mask(
 /* 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(
-		const ProjPaintState *ps,
-		MemArena *arena,
-		const ImBuf *ibuf,
-		short x_px, short y_px,
-		const float mask,
-		const int face_index,
-		const int image_index,
-		const float pixelScreenCo[4],
-		const int side,
-		const float w[3])
+        const ProjPaintState *ps,
+        MemArena *arena,
+        const ImBuf *ibuf,
+        short x_px, short y_px,
+        const float mask,
+        const int face_index,
+        const int image_index,
+        const float pixelScreenCo[4],
+        const int side,
+        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;
+	if (x_px < 0) x_px += ibuf->x;
 	y_px = y_px % ibuf->y;
-	if (y_px<0) y_px += ibuf->y;
+	if (y_px < 0) y_px += ibuf->y;
 	
-	if (ps->tool==PAINT_TOOL_CLONE) {
+	if (ps->tool == PAINT_TOOL_CLONE) {
 		size = sizeof(ProjPixelClone);
 	}
-	else if (ps->tool==PAINT_TOOL_SMEAR) {
+	else if (ps->tool == PAINT_TOOL_SMEAR) {
 		size = sizeof(ProjPixelClone);
 	}
 	else {
@@ -1505,7 +1514,7 @@ static ProjPixel *project_paint_uvpixel_init(
 		projPixel->origColor.uint = projPixel->newColor.uint = *projPixel->pixel.uint_pt;
 	}
 	
-	/* screenspace unclamped, we could keep its z and w values but dont need them at the moment */
+	/* screenspace unclamped, we could keep its z and w values but don't need them at the moment */
 	copy_v2_v2(projPixel->projCoSS, pixelScreenCo);
 	
 	projPixel->x_px = x_px;
@@ -1515,10 +1524,11 @@ static ProjPixel *project_paint_uvpixel_init(
 	projPixel->mask_max = 0;
 	
 	/* which bounding box cell are we in?, needed for undo */
-	projPixel->bb_cell_index = ((int)(((float)x_px/(float)ibuf->x) * PROJ_BOUNDBOX_DIV)) + ((int)(((float)y_px/(float)ibuf->y) * PROJ_BOUNDBOX_DIV)) * PROJ_BOUNDBOX_DIV ;
+	projPixel->bb_cell_index = ((int)(((float)x_px / (float)ibuf->x) * PROJ_BOUNDBOX_DIV)) +
+	                           ((int)(((float)y_px / (float)ibuf->y) * PROJ_BOUNDBOX_DIV)) * PROJ_BOUNDBOX_DIV;
 	
 	/* done with view3d_project_float inline */
-	if (ps->tool==PAINT_TOOL_CLONE) {
+	if (ps->tool == PAINT_TOOL_CLONE) {
 		if (ps->dm_mtface_clone) {
 			ImBuf *ibuf_other;
 			Image *other_tpage = project_paint_face_image(ps, ps->dm_mtface_clone, face_index);
@@ -1578,8 +1588,8 @@ static ProjPixel *project_paint_uvpixel_init(
 	}
 	
 #ifdef PROJ_DEBUG_PAINT
-	if (ibuf->rect_float)	projPixel->pixel.f_pt[0] = 0;
-	else					projPixel->pixel.ch_pt[0] = 0;
+	if (ibuf->rect_float) projPixel->pixel.f_pt[0] = 0;
+	else                  projPixel->pixel.ch_pt[0] = 0;
 #endif
 	projPixel->image_index = image_index;
 	
@@ -1587,13 +1597,13 @@ static ProjPixel *project_paint_uvpixel_init(
 }
 
 static int line_clip_rect2f(
-		rctf *rect,
-		const float l1[2], const float l2[2],
-		float l1_clip[2], float l2_clip[2])
+        rctf *rect,
+        const float l1[2], const float l2[2],
+        float l1_clip[2], float l2_clip[2])
 {
 	/* first account for horizontal, then vertical lines */
 	/* horiz */
-	if (fabsf(l1[1]-l2[1]) < PROJ_GEOM_TOLERANCE) {
+	if (fabsf(l1[1] - l2[1]) < PROJ_GEOM_TOLERANCE) {
 		/* is the line out of range on its Y axis? */
 		if (l1[1] < rect->ymin || l1[1] > rect->ymax) {
 			return 0;
@@ -1604,7 +1614,7 @@ static int line_clip_rect2f(
 		}
 		
 		
-		if (fabsf(l1[0]-l2[0]) < PROJ_GEOM_TOLERANCE) { /* this is a single point  (or close to)*/
+		if (fabsf(l1[0] - l2[0]) < PROJ_GEOM_TOLERANCE) { /* this is a single point  (or close to)*/
 			if (BLI_in_rctf(rect, l1[0], l1[1])) {
 				copy_v2_v2(l1_clip, l1);
 				copy_v2_v2(l2_clip, l2);
@@ -1621,7 +1631,7 @@ static int line_clip_rect2f(
 		CLAMP(l2_clip[0], rect->xmin, rect->xmax);
 		return 1;
 	}
-	else if (fabsf(l1[0]-l2[0]) < PROJ_GEOM_TOLERANCE) {
+	else if (fabsf(l1[0] - l2[0]) < PROJ_GEOM_TOLERANCE) {
 		/* is the line out of range on its X axis? */
 		if (l1[0] < rect->xmin || l1[0] > rect->xmax) {
 			return 0;
@@ -1632,7 +1642,7 @@ static int line_clip_rect2f(
 			return 0;
 		}
 		
-		if (fabsf(l1[1]-l2[1]) < PROJ_GEOM_TOLERANCE) { /* this is a single point  (or close to)*/
+		if (fabsf(l1[1] - l2[1]) < PROJ_GEOM_TOLERANCE) { /* this is a single point  (or close to)*/
 			if (BLI_in_rctf(rect, l1[0], l1[1])) {
 				copy_v2_v2(l1_clip, l1);
 				copy_v2_v2(l2_clip, l2);
@@ -1743,7 +1753,7 @@ static int line_clip_rect2f(
 
 /* scale the quad & tri about its center
  * scaling by PROJ_FACE_SCALE_SEAM (0.99x) is used for getting fake UV pixel coords that are on the
- * edge of the face but slightly inside it occlusion tests dont return hits on adjacent faces */
+ * edge of the face but slightly inside it occlusion tests don't return hits on adjacent faces */
 #ifndef PROJ_DEBUG_NOSEAMBLEED
 static void scale_quad(float insetCos[4][3], float *origCos[4], const float inset)
 {
@@ -1794,9 +1804,9 @@ static float len_squared_v2v2_alt(const float *v1, const float v2_1, const float
 {
 	float x, y;
 
-	x = v1[0]-v2_1;
-	y = v1[1]-v2_2;
-	return x*x+y*y;
+	x = v1[0] - v2_1;
+	y = v1[1] - v2_2;
+	return x * x + y * y;
 }
 
 /* note, use a squared value so we can use len_squared_v2v2
@@ -1808,13 +1818,14 @@ static int project_bucket_isect_circle(const float cent[2], const float radius_s
 	/* Would normally to a simple intersection test, however we know the bounds of these 2 already intersect 
 	 * so we only need to test if the center is inside the vertical or horizontal bounds on either axis,
 	 * this is even less work then an intersection test
-	 * 
+	 */
+#if 0
 	if (BLI_in_rctf(bucket_bounds, cent[0], cent[1]))
 		return 1;
-	 */
+#endif
 	
-	if ( (bucket_bounds->xmin <= cent[0] && bucket_bounds->xmax >= cent[0]) ||
-	     (bucket_bounds->ymin <= cent[1] && bucket_bounds->ymax >= cent[1]) )
+	if ((bucket_bounds->xmin <= cent[0] && bucket_bounds->xmax >= cent[0]) ||
+	    (bucket_bounds->ymin <= cent[1] && bucket_bounds->ymax >= cent[1]))
 	{
 		return 1;
 	}
@@ -1848,17 +1859,19 @@ static int project_bucket_isect_circle(const float cent[2], const float radius_s
 
 /* Note for rect_to_uvspace_ortho() and rect_to_uvspace_persp()
  * in ortho view this function gives good results when bucket_bounds are outside the triangle
- * however in some cases, perspective view will mess up with faces that have minimal screenspace area (viewed from the side)
+ * however in some cases, perspective view will mess up with faces that have minimal screenspace area
+ * (viewed from the side)
  * 
- * for this reason its not relyable in this case so we'll use the Simple Barycentric' funcs that only account for points inside the triangle.
+ * for this reason its not reliable in this case so we'll use the Simple Barycentric'
+ * funcs that only account for points inside the triangle.
  * however switching back to this for ortho is always an option */
 
 static void rect_to_uvspace_ortho(
-		rctf *bucket_bounds,
-		float *v1coSS, float *v2coSS, float *v3coSS,
-		float *uv1co, float *uv2co, float *uv3co,
-		float bucket_bounds_uv[4][2],
-		const int flip)
+        rctf *bucket_bounds,
+        float *v1coSS, float *v2coSS, float *v3coSS,
+        float *uv1co, float *uv2co, float *uv3co,
+        float bucket_bounds_uv[4][2],
+        const int flip)
 {
 	float uv[2];
 	float w[3];
@@ -1867,32 +1880,32 @@ static void rect_to_uvspace_ortho(
 	uv[0] = bucket_bounds->xmax;
 	uv[1] = bucket_bounds->ymin;
 	barycentric_weights_v2(v1coSS, v2coSS, v3coSS, uv, w);
-	interp_v2_v2v2v2(bucket_bounds_uv[flip?3:0], uv1co, uv2co, uv3co, w);
+	interp_v2_v2v2v2(bucket_bounds_uv[flip ? 3 : 0], uv1co, uv2co, uv3co, w);
 
 	//uv[0] = bucket_bounds->xmax; // set above
 	uv[1] = bucket_bounds->ymax;
 	barycentric_weights_v2(v1coSS, v2coSS, v3coSS, uv, w);
-	interp_v2_v2v2v2(bucket_bounds_uv[flip?2:1], uv1co, uv2co, uv3co, w);
+	interp_v2_v2v2v2(bucket_bounds_uv[flip ? 2 : 1], uv1co, uv2co, uv3co, w);
 
 	uv[0] = bucket_bounds->xmin;
 	//uv[1] = bucket_bounds->ymax; // set above
 	barycentric_weights_v2(v1coSS, v2coSS, v3coSS, uv, w);
-	interp_v2_v2v2v2(bucket_bounds_uv[flip?1:2], uv1co, uv2co, uv3co, w);
+	interp_v2_v2v2v2(bucket_bounds_uv[flip ? 1 : 2], uv1co, uv2co, uv3co, w);
 
 	//uv[0] = bucket_bounds->xmin; // set above
 	uv[1] = bucket_bounds->ymin;
 	barycentric_weights_v2(v1coSS, v2coSS, v3coSS, uv, w);
-	interp_v2_v2v2v2(bucket_bounds_uv[flip?0:3], uv1co, uv2co, uv3co, w);
+	interp_v2_v2v2v2(bucket_bounds_uv[flip ? 0 : 3], uv1co, uv2co, uv3co, w);
 }
 
 /* same as above but use barycentric_weights_v2_persp */
 static void rect_to_uvspace_persp(
-		rctf *bucket_bounds,
-		float *v1coSS, float *v2coSS, float *v3coSS,
-		float *uv1co, float *uv2co, float *uv3co,
-		float bucket_bounds_uv[4][2],
-		const int flip
-	)
+        rctf *bucket_bounds,
+        float *v1coSS, float *v2coSS, float *v3coSS,
+        float *uv1co, float *uv2co, float *uv3co,
+        float bucket_bounds_uv[4][2],
+        const int flip
+        )
 {
 	float uv[2];
 	float w[3];
@@ -1901,22 +1914,22 @@ static void rect_to_uvspace_persp(
 	uv[0] = bucket_bounds->xmax;
 	uv[1] = bucket_bounds->ymin;
 	barycentric_weights_v2_persp(v1coSS, v2coSS, v3coSS, uv, w);
-	interp_v2_v2v2v2(bucket_bounds_uv[flip?3:0], uv1co, uv2co, uv3co, w);
+	interp_v2_v2v2v2(bucket_bounds_uv[flip ? 3 : 0], uv1co, uv2co, uv3co, w);
 
 	//uv[0] = bucket_bounds->xmax; // set above
 	uv[1] = bucket_bounds->ymax;
 	barycentric_weights_v2_persp(v1coSS, v2coSS, v3coSS, uv, w);
-	interp_v2_v2v2v2(bucket_bounds_uv[flip?2:1], uv1co, uv2co, uv3co, w);
+	interp_v2_v2v2v2(bucket_bounds_uv[flip ? 2 : 1], uv1co, uv2co, uv3co, w);
 
 	uv[0] = bucket_bounds->xmin;
 	//uv[1] = bucket_bounds->ymax; // set above
 	barycentric_weights_v2_persp(v1coSS, v2coSS, v3coSS, uv, w);
-	interp_v2_v2v2v2(bucket_bounds_uv[flip?1:2], uv1co, uv2co, uv3co, w);
+	interp_v2_v2v2v2(bucket_bounds_uv[flip ? 1 : 2], uv1co, uv2co, uv3co, w);
 
 	//uv[0] = bucket_bounds->xmin; // set above
 	uv[1] = bucket_bounds->ymin;
 	barycentric_weights_v2_persp(v1coSS, v2coSS, v3coSS, uv, w);
-	interp_v2_v2v2v2(bucket_bounds_uv[flip?0:3], uv1co, uv2co, uv3co, w);
+	interp_v2_v2v2v2(bucket_bounds_uv[flip ? 0 : 3], uv1co, uv2co, uv3co, w);
 }
 
 /* This works as we need it to but we can save a few steps and not use it */
@@ -1926,24 +1939,24 @@ static float angle_2d_clockwise(const float p1[2], const float p2[2], const floa
 {
 	float v1[2], v2[2];
 	
-	v1[0] = p1[0]-p2[0];	v1[1] = p1[1]-p2[1];
-	v2[0] = p3[0]-p2[0];	v2[1] = p3[1]-p2[1];
+	v1[0] = p1[0] - p2[0];    v1[1] = p1[1] - p2[1];
+	v2[0] = p3[0] - p2[0];    v2[1] = p3[1] - p2[1];
 	
-	return -atan2(v1[0]*v2[1] - v1[1]*v2[0], v1[0]*v2[0]+v1[1]*v2[1]);
+	return -atan2(v1[0] * v2[1] - v1[1] * v2[0], v1[0] * v2[0] + v1[1] * v2[1]);
 }
 #endif
 
 #define ISECT_1 (1)
-#define ISECT_2 (1<<1)
-#define ISECT_3 (1<<2)
-#define ISECT_4 (1<<3)
-#define ISECT_ALL3 ((1<<3)-1)
-#define ISECT_ALL4 ((1<<4)-1)
+#define ISECT_2 (1 << 1)
+#define ISECT_3 (1 << 2)
+#define ISECT_4 (1 << 3)
+#define ISECT_ALL3 ((1 << 3) - 1)
+#define ISECT_ALL4 ((1 << 4) - 1)
 
 /* limit must be a fraction over 1.0f */
 static int IsectPT2Df_limit(float pt[2], float v1[2], float v2[2], float v3[2], float limit)
 {
-	return ((area_tri_v2(pt,v1,v2) + area_tri_v2(pt,v2,v3) + area_tri_v2(pt,v3,v1)) / (area_tri_v2(v1,v2,v3))) < limit;
+	return ((area_tri_v2(pt, v1, v2) + area_tri_v2(pt, v2, v3) + area_tri_v2(pt, v3, v1)) / (area_tri_v2(v1, v2, v3))) < limit;
 }
 
 /* Clip the face by a bucket and set the uv-space bucket_bounds_uv
@@ -1951,21 +1964,21 @@ static int IsectPT2Df_limit(float pt[2], float v1[2], float v2[2], float v3[2],
  * */
 static int float_z_sort_flip(const void *p1, const void *p2)
 {
-	return (((float *)p1)[2] < ((float *)p2)[2] ? 1:-1);
+	return (((float *)p1)[2] < ((float *)p2)[2] ? 1 : -1);
 }
 
 static int float_z_sort(const void *p1, const void *p2)
 {
-	return (((float *)p1)[2] < ((float *)p2)[2] ?-1:1);
+	return (((float *)p1)[2] < ((float *)p2)[2] ? -1 : 1);
 }
 
 static void project_bucket_clip_face(
-		const int is_ortho,
-		rctf *bucket_bounds,
-		float *v1coSS, float *v2coSS, float *v3coSS,
-		float *uv1co, float *uv2co, float *uv3co,
-		float bucket_bounds_uv[8][2],
-		int *tot)
+        const int is_ortho,
+        rctf *bucket_bounds,
+        float *v1coSS, float *v2coSS, float *v3coSS,
+        float *uv1co, float *uv2co, float *uv3co,
+        float bucket_bounds_uv[8][2],
+        int *tot)
 {
 	int inside_bucket_flag = 0;
 	int inside_face_flag = 0;
@@ -1975,11 +1988,11 @@ static void project_bucket_clip_face(
 
 	/* get the UV space bounding box */
 	inside_bucket_flag |= BLI_in_rctf(bucket_bounds, v1coSS[0], v1coSS[1]);
-	inside_bucket_flag |= BLI_in_rctf(bucket_bounds, v2coSS[0], v2coSS[1])		<< 1;
-	inside_bucket_flag |= BLI_in_rctf(bucket_bounds, v3coSS[0], v3coSS[1])		<< 2;
+	inside_bucket_flag |= BLI_in_rctf(bucket_bounds, v2coSS[0], v2coSS[1]) << 1;
+	inside_bucket_flag |= BLI_in_rctf(bucket_bounds, v3coSS[0], v3coSS[1]) << 2;
 	
 	if (inside_bucket_flag == ISECT_ALL3) {
-		/* all screenspace points are inside the bucket bounding box, this means we dont need to clip and can simply return the UVs */
+		/* all screenspace points are inside the bucket bounding box, this means we don't need to clip and can simply return the UVs */
 		if (flip) { /* facing the back? */
 			copy_v2_v2(bucket_bounds_uv[0], uv3co);
 			copy_v2_v2(bucket_bounds_uv[1], uv2co);
@@ -1999,25 +2012,25 @@ static void project_bucket_clip_face(
 	/* use IsectPT2Df_limit here so we catch points are are touching the tri edge (or a small fraction over) */
 	bucket_bounds_ss[0][0] = bucket_bounds->xmax;
 	bucket_bounds_ss[0][1] = bucket_bounds->ymin;
-	inside_face_flag |= (IsectPT2Df_limit(bucket_bounds_ss[0], v1coSS, v2coSS, v3coSS, 1+PROJ_GEOM_TOLERANCE) ? ISECT_1 : 0);
+	inside_face_flag |= (IsectPT2Df_limit(bucket_bounds_ss[0], v1coSS, v2coSS, v3coSS, 1 + PROJ_GEOM_TOLERANCE) ? ISECT_1 : 0);
 	
 	bucket_bounds_ss[1][0] = bucket_bounds->xmax;
 	bucket_bounds_ss[1][1] = bucket_bounds->ymax;
-	inside_face_flag |= (IsectPT2Df_limit(bucket_bounds_ss[1], v1coSS, v2coSS, v3coSS, 1+PROJ_GEOM_TOLERANCE) ? ISECT_2 : 0);
+	inside_face_flag |= (IsectPT2Df_limit(bucket_bounds_ss[1], v1coSS, v2coSS, v3coSS, 1 + PROJ_GEOM_TOLERANCE) ? ISECT_2 : 0);
 
 	bucket_bounds_ss[2][0] = bucket_bounds->xmin;
 	bucket_bounds_ss[2][1] = bucket_bounds->ymax;
-	inside_face_flag |= (IsectPT2Df_limit(bucket_bounds_ss[2], v1coSS, v2coSS, v3coSS, 1+PROJ_GEOM_TOLERANCE) ? ISECT_3 : 0);
+	inside_face_flag |= (IsectPT2Df_limit(bucket_bounds_ss[2], v1coSS, v2coSS, v3coSS, 1 + PROJ_GEOM_TOLERANCE) ? ISECT_3 : 0);
 
 	bucket_bounds_ss[3][0] = bucket_bounds->xmin;
 	bucket_bounds_ss[3][1] = bucket_bounds->ymin;
-	inside_face_flag |= (IsectPT2Df_limit(bucket_bounds_ss[3], v1coSS, v2coSS, v3coSS, 1+PROJ_GEOM_TOLERANCE) ? ISECT_4 : 0);
+	inside_face_flag |= (IsectPT2Df_limit(bucket_bounds_ss[3], v1coSS, v2coSS, v3coSS, 1 + PROJ_GEOM_TOLERANCE) ? ISECT_4 : 0);
 	
 	if (inside_face_flag == ISECT_ALL4) {
 		/* bucket is totally inside the screenspace face, we can safely use weights */
 		
-		if (is_ortho)	rect_to_uvspace_ortho(bucket_bounds, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, bucket_bounds_uv, flip);
-		else			rect_to_uvspace_persp(bucket_bounds, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, bucket_bounds_uv, flip);
+		if (is_ortho) rect_to_uvspace_ortho(bucket_bounds, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, bucket_bounds_uv, flip);
+		else rect_to_uvspace_persp(bucket_bounds, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, bucket_bounds_uv, flip);
 		
 		*tot = 4;
 		return;
@@ -2052,33 +2065,33 @@ static void project_bucket_clip_face(
 		
 		(*tot) = 0;
 		
-		if (inside_face_flag & ISECT_1)	{ copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[0]); (*tot)++; }
-		if (inside_face_flag & ISECT_2)	{ copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[1]); (*tot)++; }
-		if (inside_face_flag & ISECT_3)	{ copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[2]); (*tot)++; }
-		if (inside_face_flag & ISECT_4)	{ copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[3]); (*tot)++; }
+		if (inside_face_flag & ISECT_1) { copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[0]); (*tot)++; }
+		if (inside_face_flag & ISECT_2) { copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[1]); (*tot)++; }
+		if (inside_face_flag & ISECT_3) { copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[2]); (*tot)++; }
+		if (inside_face_flag & ISECT_4) { copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[3]); (*tot)++; }
+
+		if (inside_bucket_flag & ISECT_1) { copy_v2_v2(isectVCosSS[*tot], v1coSS); (*tot)++; }
+		if (inside_bucket_flag & ISECT_2) { copy_v2_v2(isectVCosSS[*tot], v2coSS); (*tot)++; }
+		if (inside_bucket_flag & ISECT_3) { copy_v2_v2(isectVCosSS[*tot], v3coSS); (*tot)++; }
 		
-		if (inside_bucket_flag & ISECT_1) {	copy_v2_v2(isectVCosSS[*tot], v1coSS); (*tot)++; }
-		if (inside_bucket_flag & ISECT_2) {	copy_v2_v2(isectVCosSS[*tot], v2coSS); (*tot)++; }
-		if (inside_bucket_flag & ISECT_3) {	copy_v2_v2(isectVCosSS[*tot], v3coSS); (*tot)++; }
-		
-		if ((inside_bucket_flag & (ISECT_1|ISECT_2)) != (ISECT_1|ISECT_2)) {
+		if ((inside_bucket_flag & (ISECT_1 | ISECT_2)) != (ISECT_1 | ISECT_2)) {
 			if (line_clip_rect2f(bucket_bounds, v1coSS, v2coSS, v1_clipSS, v2_clipSS)) {
-				if ((inside_bucket_flag & ISECT_1)==0) { copy_v2_v2(isectVCosSS[*tot], v1_clipSS); (*tot)++; }
-				if ((inside_bucket_flag & ISECT_2)==0) { copy_v2_v2(isectVCosSS[*tot], v2_clipSS); (*tot)++; }
+				if ((inside_bucket_flag & ISECT_1) == 0) { copy_v2_v2(isectVCosSS[*tot], v1_clipSS); (*tot)++; }
+				if ((inside_bucket_flag & ISECT_2) == 0) { copy_v2_v2(isectVCosSS[*tot], v2_clipSS); (*tot)++; }
 			}
 		}
 		
-		if ((inside_bucket_flag & (ISECT_2|ISECT_3)) != (ISECT_2|ISECT_3)) {
+		if ((inside_bucket_flag & (ISECT_2 | ISECT_3)) != (ISECT_2 | ISECT_3)) {
 			if (line_clip_rect2f(bucket_bounds, v2coSS, v3coSS, v1_clipSS, v2_clipSS)) {
-				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_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 ((inside_bucket_flag & (ISECT_3 | ISECT_1)) != (ISECT_3 | ISECT_1)) {
 			if (line_clip_rect2f(bucket_bounds, v3coSS, v1coSS, v1_clipSS, v2_clipSS)) {
-				if ((inside_bucket_flag & ISECT_3)==0) { copy_v2_v2(isectVCosSS[*tot], v1_clipSS); (*tot)++; }
-				if ((inside_bucket_flag & ISECT_1)==0) { copy_v2_v2(isectVCosSS[*tot], v2_clipSS); (*tot)++; }
+				if ((inside_bucket_flag & ISECT_3) == 0) { copy_v2_v2(isectVCosSS[*tot], v1_clipSS); (*tot)++; }
+				if ((inside_bucket_flag & ISECT_1) == 0) { copy_v2_v2(isectVCosSS[*tot], v2_clipSS); (*tot)++; }
 			}
 		}
 		
@@ -2090,7 +2103,7 @@ static void project_bucket_clip_face(
 	
 		/* now we have all points we need, collect their angles and sort them clockwise */
 		
-		for(i=0; i<(*tot); i++) {
+		for (i = 0; i < (*tot); i++) {
 			cent[0] += isectVCosSS[i][0];
 			cent[1] += isectVCosSS[i][1];
 		}
@@ -2102,8 +2115,8 @@ static void project_bucket_clip_face(
 		/* Collect angles for every point around the center point */
 
 		
-#if 0	/* uses a few more cycles then the above loop */
-		for(i=0; i<(*tot); i++) {
+#if 0   /* uses a few more cycles then the above loop */
+		for (i = 0; i < (*tot); i++) {
 			isectVCosSS[i][2] = angle_2d_clockwise(up, cent, isectVCosSS[i]);
 		}
 #endif
@@ -2111,18 +2124,18 @@ static void project_bucket_clip_face(
 		v1_clipSS[0] = cent[0]; /* Abuse this var for the loop below */
 		v1_clipSS[1] = cent[1] + 1.0f;
 		
-		for(i=0; i<(*tot); i++) {
+		for (i = 0; i < (*tot); i++) {
 			v2_clipSS[0] = isectVCosSS[i][0] - cent[0];
 			v2_clipSS[1] = isectVCosSS[i][1] - cent[1];
-			isectVCosSS[i][2] = atan2f(v1_clipSS[0]*v2_clipSS[1] - v1_clipSS[1]*v2_clipSS[0], v1_clipSS[0]*v2_clipSS[0]+v1_clipSS[1]*v2_clipSS[1]); 
+			isectVCosSS[i][2] = atan2f(v1_clipSS[0] * v2_clipSS[1] - v1_clipSS[1] * v2_clipSS[0], v1_clipSS[0] * v2_clipSS[0] + v1_clipSS[1] * v2_clipSS[1]);
 		}
 		
-		if (flip)	qsort(isectVCosSS, *tot, sizeof(float)*3, float_z_sort_flip);
-		else		qsort(isectVCosSS, *tot, sizeof(float)*3, float_z_sort);
+		if (flip) qsort(isectVCosSS, *tot, sizeof(float) * 3, float_z_sort_flip);
+		else      qsort(isectVCosSS, *tot, sizeof(float) * 3, float_z_sort);
 		
 		/* remove doubles */
 		/* first/last check */
-		if (fabsf(isectVCosSS[0][0]-isectVCosSS[(*tot)-1][0]) < PROJ_GEOM_TOLERANCE &&  fabsf(isectVCosSS[0][1]-isectVCosSS[(*tot)-1][1]) < PROJ_GEOM_TOLERANCE) {
+		if (fabsf(isectVCosSS[0][0] - isectVCosSS[(*tot) - 1][0]) < PROJ_GEOM_TOLERANCE &&  fabsf(isectVCosSS[0][1] - isectVCosSS[(*tot) - 1][1]) < PROJ_GEOM_TOLERANCE) {
 			(*tot)--;
 		}
 		
@@ -2134,16 +2147,16 @@ static void project_bucket_clip_face(
 		}
 		
 		doubles = TRUE;
-		while (doubles==TRUE) {
+		while (doubles == TRUE) {
 			doubles = FALSE;
-			for(i=1; i<(*tot); i++) {
-				if (fabsf(isectVCosSS[i-1][0]-isectVCosSS[i][0]) < PROJ_GEOM_TOLERANCE &&
-					fabsf(isectVCosSS[i-1][1]-isectVCosSS[i][1]) < PROJ_GEOM_TOLERANCE)
+			for (i = 1; i < (*tot); i++) {
+				if (fabsf(isectVCosSS[i - 1][0] - isectVCosSS[i][0]) < PROJ_GEOM_TOLERANCE &&
+				    fabsf(isectVCosSS[i - 1][1] - isectVCosSS[i][1]) < PROJ_GEOM_TOLERANCE)
 				{
 					int j;
-					for(j=i+1; j<(*tot); j++) {
-						isectVCosSS[j-1][0] = isectVCosSS[j][0]; 
-						isectVCosSS[j-1][1] = isectVCosSS[j][1]; 
+					for (j = i + 1; j < (*tot); j++) {
+						isectVCosSS[j - 1][0] = isectVCosSS[j][0];
+						isectVCosSS[j - 1][1] = isectVCosSS[j][1];
 					}
 					doubles = TRUE; /* keep looking for more doubles */
 					(*tot)--;
@@ -2160,13 +2173,13 @@ static void project_bucket_clip_face(
 		
 		
 		if (is_ortho) {
-			for(i=0; i<(*tot); i++) {
+			for (i = 0; i < (*tot); i++) {
 				barycentric_weights_v2(v1coSS, v2coSS, v3coSS, isectVCosSS[i], w);
 				interp_v2_v2v2v2(bucket_bounds_uv[i], uv1co, uv2co, uv3co, w);
 			}
 		}
 		else {
-			for(i=0; i<(*tot); i++) {
+			for (i = 0; i < (*tot); i++) {
 				barycentric_weights_v2_persp(v1coSS, v2coSS, v3coSS, isectVCosSS[i], w);
 				interp_v2_v2v2v2(bucket_bounds_uv[i], uv1co, uv2co, uv3co, w);
 			}
@@ -2180,14 +2193,14 @@ static void project_bucket_clip_face(
 		/* If there are ever any problems, */
 		float test_uv[4][2];
 		int i;
-		if (is_ortho)	rect_to_uvspace_ortho(bucket_bounds, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, test_uv, flip);
-		else				rect_to_uvspace_persp(bucket_bounds, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, test_uv, flip);
+		if (is_ortho) rect_to_uvspace_ortho(bucket_bounds, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, test_uv, flip);
+		else          rect_to_uvspace_persp(bucket_bounds, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, test_uv, flip);
 		printf("(  [(%f,%f), (%f,%f), (%f,%f), (%f,%f)], ", test_uv[0][0], test_uv[0][1],   test_uv[1][0], test_uv[1][1],    test_uv[2][0], test_uv[2][1],    test_uv[3][0], test_uv[3][1]);
 		
 		printf("  [(%f,%f), (%f,%f), (%f,%f)], ", uv1co[0], uv1co[1],   uv2co[0], uv2co[1],    uv3co[0], uv3co[1]);
 		
 		printf("[");
-		for (i=0; i < (*tot); i++) {
+		for (i = 0; i < (*tot); i++) {
 			printf("(%f, %f),", bucket_bounds_uv[i][0], bucket_bounds_uv[i][1]);
 		}
 		printf("]),\\\n");
@@ -2195,51 +2208,51 @@ static void project_bucket_clip_face(
 #endif
 }
 
-	/*
-# This script creates faces in a blender scene from printed data above.
-
-project_ls = [
-...(output from above block)...
-]
- 
-from Blender import Scene, Mesh, Window, sys, Mathutils
-
-import bpy
-
-V = Mathutils.Vector
-
-def main():
-	sce = bpy.data.scenes.active
-	
-	for item in project_ls:
-		bb = item[0]
-		uv = item[1]
-		poly = item[2]
-		
-		me = bpy.data.meshes.new()
-		ob = sce.objects.new(me)
-		
-		me.verts.extend([V(bb[0]).resize3D(), V(bb[1]).resize3D(), V(bb[2]).resize3D(), V(bb[3]).resize3D()])
-		me.faces.extend([(0,1,2,3),])
-		me.verts.extend([V(uv[0]).resize3D(), V(uv[1]).resize3D(), V(uv[2]).resize3D()])
-		me.faces.extend([(4,5,6),])
-		
-		vs = [V(p).resize3D() for p in poly]
-		print len(vs)
-		l = len(me.verts)
-		me.verts.extend(vs)
-		
-		i = l
-		while i < len(me.verts):
-			ii = i+1
-			if ii==len(me.verts):
-				ii = l
-			me.edges.extend([i, ii])
-			i+=1
-
-if __name__ == '__main__':
-	main()
- */	
+/*
+ * # This script creates faces in a blender scene from printed data above.
+ *
+ * project_ls = [
+ * ...(output from above block)...
+ * ]
+ *
+ * from Blender import Scene, Mesh, Window, sys, Mathutils
+ *
+ * import bpy
+ *
+ * V = Mathutils.Vector
+ *
+ * def main():
+ *     sce = bpy.data.scenes.active
+ *     
+ *     for item in project_ls:
+ *         bb = item[0]
+ *         uv = item[1]
+ *         poly = item[2]
+ *         
+ *         me = bpy.data.meshes.new()
+ *         ob = sce.objects.new(me)
+ *         
+ *         me.verts.extend([V(bb[0]).xyz, V(bb[1]).xyz, V(bb[2]).xyz, V(bb[3]).xyz])
+ *         me.faces.extend([(0,1,2,3),])
+ *         me.verts.extend([V(uv[0]).xyz, V(uv[1]).xyz, V(uv[2]).xyz])
+ *         me.faces.extend([(4,5,6),])
+ *         
+ *         vs = [V(p).xyz for p in poly]
+ *         print len(vs)
+ *         l = len(me.verts)
+ *         me.verts.extend(vs)
+ *         
+ *         i = l
+ *         while i < len(me.verts):
+ *             ii = i+1
+ *             if ii==len(me.verts):
+ *                 ii = l
+ *             me.edges.extend([i, ii])
+ *             i+=1
+ * 
+ * if __name__ == '__main__':
+ *     main()
+ */
 
 
 #undef ISECT_1
@@ -2255,11 +2268,11 @@ if __name__ == '__main__':
 static int IsectPoly2Df(const float pt[2], float uv[][2], const int tot)
 {
 	int i;
-	if (line_point_side_v2(uv[tot-1], uv[0], pt) < 0.0f)
+	if (line_point_side_v2(uv[tot - 1], uv[0], pt) < 0.0f)
 		return 0;
 	
-	for (i=1; i<tot; i++) {
-		if (line_point_side_v2(uv[i-1], uv[i], pt) < 0.0f)
+	for (i = 1; i < tot; i++) {
+		if (line_point_side_v2(uv[i - 1], uv[i], pt) < 0.0f)
 			return 0;
 		
 	}
@@ -2269,10 +2282,10 @@ static int IsectPoly2Df(const float pt[2], float uv[][2], const int tot)
 static int IsectPoly2Df_twoside(const float pt[2], float uv[][2], const int tot)
 {
 	int i;
-	int side = (line_point_side_v2(uv[tot-1], uv[0], pt) > 0.0f);
+	int side = (line_point_side_v2(uv[tot - 1], uv[0], pt) > 0.0f);
 	
-	for (i=1; i<tot; i++) {
-		if ((line_point_side_v2(uv[i-1], uv[i], pt) > 0.0f) != side)
+	for (i = 1; i < tot; i++) {
+		if ((line_point_side_v2(uv[i - 1], uv[i], pt) > 0.0f) != side)
 			return 0;
 		
 	}
@@ -2294,7 +2307,7 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
 	
 	/* UV/pixel seeking data */
 	int x; /* Image X-Pixel */
-	int y;/* Image Y-Pixel */
+	int y; /* Image Y-Pixel */
 	float mask;
 	float uv[2]; /* Image floating point UV - same as x, y but from 0.0-1.0 */
 	
@@ -2323,7 +2336,7 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
 	int uv_clip_tot;
 	const short is_ortho = ps->is_ortho;
 	const short do_backfacecull = ps->do_backfacecull;
-	const short do_clip= ps->rv3d ? ps->rv3d->rflag & RV3D_CLIPPING : 0;
+	const short do_clip = ps->rv3d ? ps->rv3d->rflag & RV3D_CLIPPING : 0;
 	
 	vCo[0] = ps->dm_mvert[mf->v1].co;
 	vCo[1] = ps->dm_mvert[mf->v2].co;
@@ -2333,16 +2346,16 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
 	/* Use tf_uv_pxoffset instead of tf->uv so we can offset the UV half a pixel
 	 * this is done so we can avoid offseting all the pixels by 0.5 which causes
 	 * problems when wrapping negative coords */
-	xhalfpx = (0.5f+   (PROJ_GEOM_TOLERANCE/3.0f)   ) / ibuf_xf;
-	yhalfpx = (0.5f+   (PROJ_GEOM_TOLERANCE/4.0f)   ) / ibuf_yf;
+	xhalfpx = (0.5f +   (PROJ_GEOM_TOLERANCE / 3.0f)   ) / ibuf_xf;
+	yhalfpx = (0.5f +   (PROJ_GEOM_TOLERANCE / 4.0f)   ) / ibuf_yf;
 	
 	/* Note about (PROJ_GEOM_TOLERANCE/x) above...
-	  Needed to add this offset since UV coords are often quads aligned to pixels.
-	  In this case pixels can be exactly between 2 triangles causing nasty
-	  artifacts.
-	  
-	  This workaround can be removed and painting will still work on most cases
-	  but since the first thing most people try is painting onto a quad- better make it work.
+	 * Needed to add this offset since UV coords are often quads aligned to pixels.
+	 * In this case pixels can be exactly between 2 triangles causing nasty
+	 * artifacts.
+	 * 
+	 * This workaround can be removed and painting will still work on most cases
+	 * but since the first thing most people try is painting onto a quad- better make it work.
 	 */
 
 
@@ -2357,7 +2370,7 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
 	tf_uv_pxoffset[2][1] = tf->uv[2][1] - yhalfpx;	
 	
 	if (mf->v4) {
-		vCo[3] = ps->dm_mvert[ mf->v4 ].co;
+		vCo[3] = ps->dm_mvert[mf->v4].co;
 		
 		tf_uv_pxoffset[3][0] = tf->uv[3][0] - xhalfpx;
 		tf_uv_pxoffset[3][1] = tf->uv[3][1] - yhalfpx;
@@ -2368,44 +2381,44 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
 	}
 	
 	do {
-		if (side==1) {
-			i1=0; i2=2; i3=3;
+		if (side == 1) {
+			i1 = 0; i2 = 2; i3 = 3;
 		}
 		else {
-			i1=0; i2=1; i3=2;
+			i1 = 0; i2 = 1; i3 = 2;
 		}
 		
 		uv1co = tf_uv_pxoffset[i1]; // was tf->uv[i1];
 		uv2co = tf_uv_pxoffset[i2]; // was tf->uv[i2];
 		uv3co = tf_uv_pxoffset[i3]; // was tf->uv[i3];
 
-		v1coSS = ps->screenCoords[ (*(&mf->v1 + i1)) ];
-		v2coSS = ps->screenCoords[ (*(&mf->v1 + i2)) ];
-		v3coSS = ps->screenCoords[ (*(&mf->v1 + i3)) ];
+		v1coSS = ps->screenCoords[(*(&mf->v1 + i1))];
+		v2coSS = ps->screenCoords[(*(&mf->v1 + i2))];
+		v3coSS = ps->screenCoords[(*(&mf->v1 + i3))];
 		
 		/* This funtion gives is a concave polyline in UV space from the clipped quad and tri*/
 		project_bucket_clip_face(
-				is_ortho, bucket_bounds,
-				v1coSS, v2coSS, v3coSS,
-				uv1co, uv2co, uv3co,
-				uv_clip, &uv_clip_tot
-		);
+		        is_ortho, bucket_bounds,
+		        v1coSS, v2coSS, v3coSS,
+		        uv1co, uv2co, uv3co,
+		        uv_clip, &uv_clip_tot
+		        );
 
 		/* sometimes this happens, better just allow for 8 intersectiosn even though there should be max 6 */
-		/*
-		if (uv_clip_tot>6) {
+#if 0
+		if (uv_clip_tot > 6) {
 			printf("this should never happen! %d\n", uv_clip_tot);
-		}*/
-		
+		}
+#endif
 
 		if (pixel_bounds_array(uv_clip, &bounds_px, ibuf->x, ibuf->y, uv_clip_tot)) {
 
-			if(clamp_u) {
+			if (clamp_u) {
 				CLAMP(bounds_px.xmin, 0, ibuf->x);
 				CLAMP(bounds_px.xmax, 0, ibuf->x);
 			}
 
-			if(clamp_v) {
+			if (clamp_v) {
 				CLAMP(bounds_px.ymin, 0, ibuf->y);
 				CLAMP(bounds_px.ymax, 0, ibuf->y);
 			}
@@ -2424,18 +2437,19 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
 					
 					/* Note about IsectPoly2Df_twoside, checking the face or uv flipping doesnt work,
 					 * could check the poly direction but better to do this */
-					if(	(do_backfacecull		&& IsectPoly2Df(uv, uv_clip, uv_clip_tot)) ||
-						(do_backfacecull==0		&& IsectPoly2Df_twoside(uv, uv_clip, uv_clip_tot))) {
+					if ((do_backfacecull          && IsectPoly2Df(uv, uv_clip, uv_clip_tot)) ||
+					    (do_backfacecull == 0     && IsectPoly2Df_twoside(uv, uv_clip, uv_clip_tot)))
+					{
 						
 						has_x_isect = has_isect = 1;
 						
-						if (is_ortho)	screen_px_from_ortho(uv, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, pixelScreenCo, w);
-						else			screen_px_from_persp(uv, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, pixelScreenCo, w);
+						if (is_ortho) screen_px_from_ortho(uv, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, pixelScreenCo, w);
+						else          screen_px_from_persp(uv, v1coSS, v2coSS, v3coSS, uv1co, uv2co, uv3co, pixelScreenCo, w);
 						
-						/* a pitty we need to get the worldspace pixel location here */
-						if(do_clip) {
-							interp_v3_v3v3v3(wco, ps->dm_mvert[ (*(&mf->v1 + i1)) ].co, ps->dm_mvert[ (*(&mf->v1 + i2)) ].co, ps->dm_mvert[ (*(&mf->v1 + i3)) ].co, w);
-							if(ED_view3d_test_clipping(ps->rv3d, wco, 1)) {
+						/* a pity we need to get the worldspace pixel location here */
+						if (do_clip) {
+							interp_v3_v3v3v3(wco, ps->dm_mvert[(*(&mf->v1 + i1))].co, ps->dm_mvert[(*(&mf->v1 + i2))].co, ps->dm_mvert[(*(&mf->v1 + i3))].co, w);
+							if (ED_view3d_clipping_test(ps->rv3d, wco, TRUE)) {
 								continue; /* Watch out that no code below this needs to run */
 							}
 						}
@@ -2443,16 +2457,16 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
 						/* Is this UV visible from the view? - raytrace */
 						/* project_paint_PickFace is less complex, use for testing */
 						//if (project_paint_PickFace(ps, pixelScreenCo, w, &side) == face_index) {
-						if (ps->do_occlude==0 || !project_bucket_point_occluded(ps, bucketFaceNodes, face_index, pixelScreenCo)) {
+						if (ps->do_occlude == 0 || !project_bucket_point_occluded(ps, bucketFaceNodes, face_index, pixelScreenCo)) {
 							
 							mask = project_paint_uvpixel_mask(ps, face_index, side, w);
 							
 							if (mask > 0.0f) {
 								BLI_linklist_prepend_arena(
-									bucketPixelNodes,
-									project_paint_uvpixel_init(ps, arena, ibuf, x, y, mask, face_index, image_index, pixelScreenCo, side, w),
-									arena
-								);
+								        bucketPixelNodes,
+								        project_paint_uvpixel_init(ps, arena, ibuf, x, y, mask, face_index, image_index, pixelScreenCo, side, w),
+								        arena
+								        );
 							}
 						}
 						
@@ -2466,15 +2480,15 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
 				}
 				
 				
-#if 0			/* TODO - investigate why this dosnt work sometimes! it should! */
+#if 0           /* TODO - investigate why this dosnt work sometimes! it should! */
 				/* no intersection for this entire row, after some intersection above means we can quit now */
-				if (has_x_isect==0 && has_isect) { 
+				if (has_x_isect == 0 && has_isect) {
 					break;
 				}
 #endif
 			}
 		}
-	} while(side--);
+	} while (side--);
 
 	
 	
@@ -2483,25 +2497,25 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
 		int face_seam_flag;
 		
 		if (ps->thread_tot > 1)
-			BLI_lock_thread(LOCK_CUSTOM1); /* Other threads could be modifying these vars */
+			BLI_lock_thread(LOCK_CUSTOM1);  /* Other threads could be modifying these vars */
 		
 		face_seam_flag = ps->faceSeamFlags[face_index];
 		
 		/* are any of our edges un-initialized? */
-		if ((face_seam_flag & (PROJ_FACE_SEAM1|PROJ_FACE_NOSEAM1))==0 || 
-			(face_seam_flag & (PROJ_FACE_SEAM2|PROJ_FACE_NOSEAM2))==0 || 
-			(face_seam_flag & (PROJ_FACE_SEAM3|PROJ_FACE_NOSEAM3))==0 || 
-			(face_seam_flag & (PROJ_FACE_SEAM4|PROJ_FACE_NOSEAM4))==0
-		) {
+		if ((face_seam_flag & (PROJ_FACE_SEAM1 | PROJ_FACE_NOSEAM1)) == 0 ||
+		    (face_seam_flag & (PROJ_FACE_SEAM2 | PROJ_FACE_NOSEAM2)) == 0 ||
+		    (face_seam_flag & (PROJ_FACE_SEAM3 | PROJ_FACE_NOSEAM3)) == 0 ||
+		    (face_seam_flag & (PROJ_FACE_SEAM4 | PROJ_FACE_NOSEAM4)) == 0)
+		{
 			project_face_seams_init(ps, face_index, mf->v4);
 			face_seam_flag = ps->faceSeamFlags[face_index];
 			//printf("seams - %d %d %d %d\n", flag&PROJ_FACE_SEAM1, flag&PROJ_FACE_SEAM2, flag&PROJ_FACE_SEAM3, flag&PROJ_FACE_SEAM4);
 		}
 		
-		if ((face_seam_flag & (PROJ_FACE_SEAM1|PROJ_FACE_SEAM2|PROJ_FACE_SEAM3|PROJ_FACE_SEAM4))==0) {
+		if ((face_seam_flag & (PROJ_FACE_SEAM1 | PROJ_FACE_SEAM2 | PROJ_FACE_SEAM3 | PROJ_FACE_SEAM4)) == 0) {
 			
 			if (ps->thread_tot > 1)
-				BLI_unlock_thread(LOCK_CUSTOM1); /* Other threads could be modifying these vars */
+				BLI_unlock_thread(LOCK_CUSTOM1);  /* Other threads could be modifying these vars */
 			
 		}
 		else {
@@ -2522,45 +2536,45 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
 			float fac1, fac2, ftot;
 			
 			
-			if (outset_uv[0][0]==FLT_MAX) /* first time initialize */
+			if (outset_uv[0][0] == FLT_MAX) /* first time initialize */
 				uv_image_outset(tf_uv_pxoffset, outset_uv, ps->seam_bleed_px, ibuf->x, ibuf->y, mf->v4);
 			
 			/* ps->faceSeamUVs cant be modified when threading, now this is done we can unlock */
 			if (ps->thread_tot > 1)
-				BLI_unlock_thread(LOCK_CUSTOM1); /* Other threads could be modifying these vars */
+				BLI_unlock_thread(LOCK_CUSTOM1);  /* Other threads could be modifying these vars */
 			
 			vCoSS[0] = ps->screenCoords[mf->v1];
 			vCoSS[1] = ps->screenCoords[mf->v2];
 			vCoSS[2] = ps->screenCoords[mf->v3];
 			if (mf->v4)
-				vCoSS[3] = ps->screenCoords[ mf->v4 ];
+				vCoSS[3] = ps->screenCoords[mf->v4];
 			
 			/* PROJ_FACE_SCALE_SEAM must be slightly less then 1.0f */
 			if (is_ortho) {
-				if (mf->v4)	scale_quad(insetCos, vCoSS, PROJ_FACE_SCALE_SEAM);
-				else		scale_tri(insetCos, vCoSS, PROJ_FACE_SCALE_SEAM);
+				if (mf->v4) scale_quad(insetCos, vCoSS, PROJ_FACE_SCALE_SEAM);
+				else        scale_tri(insetCos, vCoSS, PROJ_FACE_SCALE_SEAM);
 			}
 			else {
-				if (mf->v4)	scale_quad(insetCos, vCo, PROJ_FACE_SCALE_SEAM);
-				else		scale_tri(insetCos, vCo, PROJ_FACE_SCALE_SEAM);
+				if (mf->v4) scale_quad(insetCos, vCo, PROJ_FACE_SCALE_SEAM);
+				else        scale_tri(insetCos, vCo, PROJ_FACE_SCALE_SEAM);
 			}
 			
 			side = 0; /* for triangles this wont need to change */
 			
 			for (fidx1 = 0; fidx1 < (mf->v4 ? 4 : 3); fidx1++) {
-				if (mf->v4)		fidx2 = (fidx1==3) ? 0 : fidx1+1; /* next fidx in the face (0,1,2,3) -> (1,2,3,0) */
-				else			fidx2 = (fidx1==2) ? 0 : fidx1+1; /* next fidx in the face (0,1,2) -> (1,2,0) */
+				if (mf->v4) fidx2 = (fidx1 == 3) ? 0 : fidx1 + 1;  /* next fidx in the face (0,1,2,3) -> (1,2,3,0) */
+				else        fidx2 = (fidx1 == 2) ? 0 : fidx1 + 1;  /* next fidx in the face (0,1,2) -> (1,2,0) */
 				
-				if (	(face_seam_flag & (1<<fidx1)) && /* 1<<fidx1 -> PROJ_FACE_SEAM# */
-						line_clip_rect2f(bucket_bounds, vCoSS[fidx1], vCoSS[fidx2], bucket_clip_edges[0], bucket_clip_edges[1])
-				) {
+				if ((face_seam_flag & (1 << fidx1)) && /* 1<<fidx1 -> PROJ_FACE_SEAM# */
+				    line_clip_rect2f(bucket_bounds, vCoSS[fidx1], vCoSS[fidx2], bucket_clip_edges[0], bucket_clip_edges[1]))
+				{
 
 					ftot = len_v2v2(vCoSS[fidx1], vCoSS[fidx2]); /* screenspace edge length */
 					
 					if (ftot > 0.0f) { /* avoid div by zero */
 						if (mf->v4) {
-							if (fidx1==2 || fidx2==2)	side= 1;
-							else						side= 0;
+							if (fidx1 == 2 || fidx2 == 2) side = 1;
+							else side = 0;
 						}
 						
 						fac1 = len_v2v2(vCoSS[fidx1], bucket_clip_edges[0]) / ftot;
@@ -2596,39 +2610,39 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
 										
 										/* We need to find the closest point along the face edge,
 										 * getting the screen_px_from_*** wont work because our actual location
-										 * is not relevent, since we are outside the face, Use VecLerpf to find
+										 * is not relevant, since we are outside the face, Use VecLerpf to find
 										 * our location on the side of the face's UV */
-										/*
-										if (is_ortho)	screen_px_from_ortho(ps, uv, v1co, v2co, v3co, uv1co, uv2co, uv3co, pixelScreenCo);
-										else					screen_px_from_persp(ps, uv, v1co, v2co, v3co, uv1co, uv2co, uv3co, pixelScreenCo);
-										*/
+#if 0
+										if (is_ortho) screen_px_from_ortho(ps, uv, v1co, v2co, v3co, uv1co, uv2co, uv3co, pixelScreenCo);
+										else          screen_px_from_persp(ps, uv, v1co, v2co, v3co, uv1co, uv2co, uv3co, pixelScreenCo);
+#endif
 										
 										/* Since this is a seam we need to work out where on the line this pixel is */
 										//fac = line_point_factor_v2(uv, uv_seam_quad[0], uv_seam_quad[1]);
 										
 										fac = line_point_factor_v2(uv, seam_subsection[0], seam_subsection[1]);
-										if (fac < 0.0f)		{ copy_v3_v3(pixelScreenCo, edge_verts_inset_clip[0]); }
-										else if (fac > 1.0f)	{ copy_v3_v3(pixelScreenCo, edge_verts_inset_clip[1]); }
-										else				{ interp_v3_v3v3(pixelScreenCo, edge_verts_inset_clip[0], edge_verts_inset_clip[1], fac); }
+										if      (fac < 0.0f) { copy_v3_v3(pixelScreenCo, edge_verts_inset_clip[0]); }
+										else if (fac > 1.0f) { copy_v3_v3(pixelScreenCo, edge_verts_inset_clip[1]); }
+										else                 { interp_v3_v3v3(pixelScreenCo, edge_verts_inset_clip[0], edge_verts_inset_clip[1], fac); }
 										
 										if (!is_ortho) {
 											pixelScreenCo[3] = 1.0f;
 											mul_m4_v4((float(*)[4])ps->projectMat, pixelScreenCo); /* cast because of const */
-											pixelScreenCo[0] = (float)(ps->winx/2.0f)+(ps->winx/2.0f)*pixelScreenCo[0]/pixelScreenCo[3];
-											pixelScreenCo[1] = (float)(ps->winy/2.0f)+(ps->winy/2.0f)*pixelScreenCo[1]/pixelScreenCo[3];
-											pixelScreenCo[2] = pixelScreenCo[2]/pixelScreenCo[3]; /* Use the depth for bucket point occlusion */
+											pixelScreenCo[0] = (float)(ps->winx / 2.0f) + (ps->winx / 2.0f) * pixelScreenCo[0] / pixelScreenCo[3];
+											pixelScreenCo[1] = (float)(ps->winy / 2.0f) + (ps->winy / 2.0f) * pixelScreenCo[1] / pixelScreenCo[3];
+											pixelScreenCo[2] = pixelScreenCo[2] / pixelScreenCo[3]; /* Use the depth for bucket point occlusion */
 										}
 										
-										if (ps->do_occlude==0 || !project_bucket_point_occluded(ps, bucketFaceNodes, face_index, pixelScreenCo)) {
+										if (ps->do_occlude == 0 || !project_bucket_point_occluded(ps, bucketFaceNodes, face_index, pixelScreenCo)) {
 											
 											/* Only bother calculating the weights if we intersect */
 											if (ps->do_mask_normal || ps->dm_mtface_clone) {
 #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 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]);
 
 												if (side) {
 													barycentric_weights_v2(tf_uv_pxoffset[0], tf_uv_pxoffset[2], tf_uv_pxoffset[3], uv_close, w);
@@ -2636,29 +2650,29 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
 												else {
 													barycentric_weights_v2(tf_uv_pxoffset[0], tf_uv_pxoffset[1], tf_uv_pxoffset[2], uv_close, w);
 												}
-#else											/* this is buggy with quads, dont use for now */
+#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));
+												fac = fac1 + (fac * (fac2 - fac1));
 
-												w[0]=w[1]=w[2]= 0.0;
+												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 - fac;
+													w[fidx2 ? fidx2 - 1 : 0] = fac;
 												}
 												else {
-													w[fidx1] = 1.0f-fac;
+													w[fidx1] = 1.0f - fac;
 													w[fidx2] = fac;
 												}
 #endif
 											}
 											
-											/* a pitty we need to get the worldspace pixel location here */
-											if(do_clip) {
-												if (side)	interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v3].co, ps->dm_mvert[mf->v4].co, w);
-												else		interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v2].co, ps->dm_mvert[mf->v3].co, w);
+											/* a pity we need to get the worldspace pixel location here */
+											if (do_clip) {
+												if (side) interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v3].co, ps->dm_mvert[mf->v4].co, w);
+												else      interp_v3_v3v3v3(wco, ps->dm_mvert[mf->v1].co, ps->dm_mvert[mf->v2].co, ps->dm_mvert[mf->v3].co, w);
 
-												if(ED_view3d_test_clipping(ps->rv3d, wco, 1)) {
+												if (ED_view3d_clipping_test(ps->rv3d, wco, TRUE)) {
 													continue; /* Watch out that no code below this needs to run */
 												}
 											}
@@ -2667,10 +2681,10 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
 											
 											if (mask > 0.0f) {
 												BLI_linklist_prepend_arena(
-													bucketPixelNodes,
-													project_paint_uvpixel_init(ps, arena, ibuf, x, y, mask, face_index, image_index, pixelScreenCo, side, w),
-													arena
-												);
+												        bucketPixelNodes,
+												        project_paint_uvpixel_init(ps, arena, ibuf, x, y, mask, face_index, image_index, pixelScreenCo, side, w),
+												        arena
+												        );
 											}
 											
 										}
@@ -2681,9 +2695,9 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
 									}
 								}
 								
-#if 0							/* TODO - investigate why this dosnt work sometimes! it should! */
+#if 0                           /* TODO - investigate why this dosnt work sometimes! it should! */
 								/* no intersection for this entire row, after some intersection above means we can quit now */
-								if (has_x_isect==0 && has_isect) { 
+								if (has_x_isect == 0 && has_isect) {
 									break;
 								}
 #endif
@@ -2709,7 +2723,7 @@ static void project_paint_bucket_bounds(const ProjPaintState *ps, const float mi
 	bucketMax[0] = (int)((int)(((float)(max[0] - ps->screenMin[0]) / ps->screen_width) * ps->buckets_x) + 1.5f);
 	bucketMax[1] = (int)((int)(((float)(max[1] - ps->screenMin[1]) / ps->screen_height) * ps->buckets_y) + 1.5f);
 	
-	/* incase the rect is outside the mesh 2d bounds */
+	/* in case the rect is outside the mesh 2d bounds */
 	CLAMP(bucketMin[0], 0, ps->buckets_x);
 	CLAMP(bucketMin[1], 0, ps->buckets_y);
 	
@@ -2720,37 +2734,37 @@ static void project_paint_bucket_bounds(const ProjPaintState *ps, const float mi
 /* set bucket_bounds to a screen space-aligned floating point bound-box */
 static void project_bucket_bounds(const ProjPaintState *ps, const int bucket_x, const int bucket_y, rctf *bucket_bounds)
 {
-	bucket_bounds->xmin =	ps->screenMin[0]+((bucket_x)*(ps->screen_width / ps->buckets_x));		/* left */
-	bucket_bounds->xmax =	ps->screenMin[0]+((bucket_x+1)*(ps->screen_width / ps->buckets_x));	/* right */
+	bucket_bounds->xmin = ps->screenMin[0] + ((bucket_x) * (ps->screen_width / ps->buckets_x));     /* left */
+	bucket_bounds->xmax = ps->screenMin[0] + ((bucket_x + 1) * (ps->screen_width / ps->buckets_x)); /* right */
 	
-	bucket_bounds->ymin =	ps->screenMin[1]+((bucket_y)*(ps->screen_height / ps->buckets_y));		/* bottom */
-	bucket_bounds->ymax =	ps->screenMin[1]+((bucket_y+1)*(ps->screen_height  / ps->buckets_y));	/* top */
+	bucket_bounds->ymin = ps->screenMin[1] + ((bucket_y) * (ps->screen_height / ps->buckets_y));      /* bottom */
+	bucket_bounds->ymax = ps->screenMin[1] + ((bucket_y + 1) * (ps->screen_height  / ps->buckets_y)); /* top */
 }
 
 /* Fill this bucket with pixels from the faces that intersect it.
  * 
- * have bucket_bounds as an argument so we don;t need to give bucket_x/y the rect function needs */
+ * have bucket_bounds as an argument so we don't need to give bucket_x/y the rect function needs */
 static void project_bucket_init(const ProjPaintState *ps, const int thread_index, const int bucket_index, rctf *bucket_bounds)
 {
 	LinkNode *node;
-	int face_index, image_index=0;
+	int face_index, image_index = 0;
 	ImBuf *ibuf = NULL;
 	Image *tpage_last = NULL, *tpage;
 	Image *ima = NULL;
 
-	if (ps->image_tot==1) {
+	if (ps->image_tot == 1) {
 		/* Simple loop, no context switching */
 		ibuf = ps->projImages[0].ibuf;
 		ima = ps->projImages[0].ima;
 
-		for (node = ps->bucketFaces[bucket_index]; node; node= node->next) { 
+		for (node = ps->bucketFaces[bucket_index]; node; node = node->next) {
 			project_paint_face_init(ps, thread_index, bucket_index, GET_INT_FROM_POINTER(node->link), 0, bucket_bounds, ibuf, ima->tpageflag & IMA_CLAMP_U, ima->tpageflag & IMA_CLAMP_V);
 		}
 	}
 	else {
 		
 		/* More complicated loop, switch between images */
-		for (node = ps->bucketFaces[bucket_index]; node; node= node->next) {
+		for (node = ps->bucketFaces[bucket_index]; node; node = node->next) {
 			face_index = GET_INT_FROM_POINTER(node->link);
 				
 			/* Image context switching */
@@ -2758,7 +2772,7 @@ static void project_bucket_init(const ProjPaintState *ps, const int thread_index
 			if (tpage_last != tpage) {
 				tpage_last = tpage;
 
-				for (image_index=0; image_index < ps->image_tot; image_index++) {
+				for (image_index = 0; image_index < ps->image_tot; image_index++) {
 					if (ps->projImages[image_index].ima == tpage_last) {
 						ibuf = ps->projImages[image_index].ibuf;
 						ima = ps->projImages[image_index].ima;
@@ -2787,16 +2801,16 @@ static int project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int bucke
 	/* TODO - replace this with a tricker method that uses sideofline for all screenCoords's edges against the closest bucket corner */
 	rctf bucket_bounds;
 	float p1[2], p2[2], p3[2], p4[2];
-	float *v, *v1,*v2,*v3,*v4=NULL;
+	float *v, *v1, *v2, *v3, *v4 = NULL;
 	int fidx;
 	
 	project_bucket_bounds(ps, bucket_x, bucket_y, &bucket_bounds);
 	
 	/* Is one of the faces verts in the bucket bounds? */
 	
-	fidx = mf->v4 ? 3:2;
+	fidx = mf->v4 ? 3 : 2;
 	do {
-		v = ps->screenCoords[ (*(&mf->v1 + fidx)) ];
+		v = ps->screenCoords[(*(&mf->v1 + fidx))];
 		if (BLI_in_rctf(&bucket_bounds, v[0], v[1])) {
 			return 1;
 		}
@@ -2810,36 +2824,36 @@ static int project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int bucke
 	}
 	
 	p1[0] = bucket_bounds.xmin; p1[1] = bucket_bounds.ymin;
-	p2[0] = bucket_bounds.xmin;	p2[1] = bucket_bounds.ymax;
-	p3[0] = bucket_bounds.xmax;	p3[1] = bucket_bounds.ymax;
-	p4[0] = bucket_bounds.xmax;	p4[1] = bucket_bounds.ymin;
+	p2[0] = bucket_bounds.xmin; p2[1] = bucket_bounds.ymax;
+	p3[0] = bucket_bounds.xmax; p3[1] = bucket_bounds.ymax;
+	p4[0] = bucket_bounds.xmax; p4[1] = bucket_bounds.ymin;
 		
 	if (mf->v4) {
-		if ( isect_point_quad_v2(p1, v1, v2, v3, v4) ||
-		     isect_point_quad_v2(p2, v1, v2, v3, v4) ||
-		     isect_point_quad_v2(p3, v1, v2, v3, v4) ||
-		     isect_point_quad_v2(p4, v1, v2, v3, v4) ||
-
-			/* we can avoid testing v3,v1 because another intersection MUST exist if this intersects */
-			(isect_line_line_v2(p1, p2, v1, v2) || isect_line_line_v2(p1, p2, v2, v3) || isect_line_line_v2(p1, p2, v3, v4)) ||
-			(isect_line_line_v2(p2, p3, v1, v2) || isect_line_line_v2(p2, p3, v2, v3) || isect_line_line_v2(p2, p3, v3, v4)) ||
-			(isect_line_line_v2(p3, p4, v1, v2) || isect_line_line_v2(p3, p4, v2, v3) || isect_line_line_v2(p3, p4, v3, v4)) ||
-			(isect_line_line_v2(p4, p1, v1, v2) || isect_line_line_v2(p4, p1, v2, v3) || isect_line_line_v2(p4, p1, v3, v4))
-		) {
+		if (isect_point_quad_v2(p1, v1, v2, v3, v4) ||
+		    isect_point_quad_v2(p2, v1, v2, v3, v4) ||
+		    isect_point_quad_v2(p3, v1, v2, v3, v4) ||
+		    isect_point_quad_v2(p4, v1, v2, v3, v4) ||
+
+		    /* we can avoid testing v3,v1 because another intersection MUST exist if this intersects */
+		    (isect_line_line_v2(p1, p2, v1, v2) || isect_line_line_v2(p1, p2, v2, v3) || isect_line_line_v2(p1, p2, v3, v4)) ||
+		    (isect_line_line_v2(p2, p3, v1, v2) || isect_line_line_v2(p2, p3, v2, v3) || isect_line_line_v2(p2, p3, v3, v4)) ||
+		    (isect_line_line_v2(p3, p4, v1, v2) || isect_line_line_v2(p3, p4, v2, v3) || isect_line_line_v2(p3, p4, v3, v4)) ||
+		    (isect_line_line_v2(p4, p1, v1, v2) || isect_line_line_v2(p4, p1, v2, v3) || isect_line_line_v2(p4, p1, v3, v4)))
+		{
 			return 1;
 		}
 	}
 	else {
-		if ( isect_point_tri_v2(p1, v1, v2, v3) ||
-		     isect_point_tri_v2(p2, v1, v2, v3) ||
-		     isect_point_tri_v2(p3, v1, v2, v3) ||
-		     isect_point_tri_v2(p4, v1, v2, v3) ||
-			/* we can avoid testing v3,v1 because another intersection MUST exist if this intersects */
-			(isect_line_line_v2(p1, p2, v1, v2) || isect_line_line_v2(p1, p2, v2, v3)) ||
-			(isect_line_line_v2(p2, p3, v1, v2) || isect_line_line_v2(p2, p3, v2, v3)) ||
-			(isect_line_line_v2(p3, p4, v1, v2) || isect_line_line_v2(p3, p4, v2, v3)) ||
-			(isect_line_line_v2(p4, p1, v1, v2) || isect_line_line_v2(p4, p1, v2, v3))
-		) {
+		if (isect_point_tri_v2(p1, v1, v2, v3) ||
+		    isect_point_tri_v2(p2, v1, v2, v3) ||
+		    isect_point_tri_v2(p3, v1, v2, v3) ||
+		    isect_point_tri_v2(p4, v1, v2, v3) ||
+		    /* we can avoid testing v3,v1 because another intersection MUST exist if this intersects */
+		    (isect_line_line_v2(p1, p2, v1, v2) || isect_line_line_v2(p1, p2, v2, v3)) ||
+		    (isect_line_line_v2(p2, p3, v1, v2) || isect_line_line_v2(p2, p3, v2, v3)) ||
+		    (isect_line_line_v2(p3, p4, v1, v2) || isect_line_line_v2(p3, p4, v2, v3)) ||
+		    (isect_line_line_v2(p4, p1, v1, v2) || isect_line_line_v2(p4, p1, v2, v3)))
+		{
 			return 1;
 		}
 	}
@@ -2847,7 +2861,7 @@ static int project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int bucke
 	return 0;
 }
 
-/* Add faces to the bucket but dont initialize its pixels
+/* Add faces to the bucket but don't initialize its pixels
  * TODO - when painting occluded, sort the faces on their min-Z and only add faces that faces that are not occluded */
 static void project_paint_delayed_face_init(ProjPaintState *ps, const MFace *mf, const int face_index)
 {
@@ -2859,9 +2873,9 @@ static void project_paint_delayed_face_init(ProjPaintState *ps, const MFace *mf,
 	
 	INIT_MINMAX2(min, max);
 	
-	fidx = mf->v4 ? 3:2;
+	fidx = mf->v4 ? 3 : 2;
 	do {
-		vCoSS = ps->screenCoords[ *(&mf->v1 + fidx) ];
+		vCoSS = ps->screenCoords[*(&mf->v1 + fidx)];
 		DO_MINMAX2(vCoSS, min, max);
 	} while (fidx--);
 	
@@ -2871,12 +2885,12 @@ static void project_paint_delayed_face_init(ProjPaintState *ps, const MFace *mf,
 		has_x_isect = 0;
 		for (bucket_x = bucketMin[0]; bucket_x < bucketMax[0]; bucket_x++) {
 			if (project_bucket_face_isect(ps, bucket_x, bucket_y, mf)) {
-				int bucket_index= bucket_x + (bucket_y * ps->buckets_x);
+				int bucket_index = bucket_x + (bucket_y * ps->buckets_x);
 				BLI_linklist_prepend_arena(
-					&ps->bucketFaces[ bucket_index ],
-					SET_INT_IN_POINTER(face_index), /* cast to a pointer to shut up the compiler */
-					arena
-				);
+				        &ps->bucketFaces[bucket_index],
+				        SET_INT_IN_POINTER(face_index), /* cast to a pointer to shut up the compiler */
+				        arena
+				        );
 				
 				has_x_isect = has_isect = 1;
 			}
@@ -2887,7 +2901,7 @@ static void project_paint_delayed_face_init(ProjPaintState *ps, const MFace *mf,
 		}
 		
 		/* no intersection for this entire row, after some intersection above means we can quit now */
-		if (has_x_isect==0 && has_isect) { 
+		if (has_x_isect == 0 && has_isect) {
 			break;
 		}
 	}
@@ -2904,7 +2918,7 @@ static void project_paint_delayed_face_init(ProjPaintState *ps, const MFace *mf,
 
 static int project_paint_view_clip(View3D *v3d, RegionView3D *rv3d, float *clipsta, float *clipend)
 {
-	int orth= ED_view3d_clip_range_get(v3d, rv3d, clipsta, clipend);
+	int orth = ED_view3d_clip_range_get(v3d, rv3d, clipsta, clipend);
 
 	if (orth) { /* only needed for ortho */
 		float fac = 2.0f / ((*clipend) - (*clipsta));
@@ -2943,33 +2957,33 @@ static void project_paint_begin(ProjPaintState *ps)
 	
 	MemArena *arena; /* at the moment this is just ps->arena_mt[0], but use this to show were not multithreading */
 
-	const int diameter= 2*brush_size(ps->scene, ps->brush);
+	const int diameter = 2 * brush_size(ps->scene, ps->brush);
 	
 	/* ---- end defines ---- */
 	
-	if(ps->source==PROJ_SRC_VIEW)
-		ED_view3d_local_clipping(ps->rv3d, ps->ob->obmat); /* faster clipping lookups */
+	if (ps->source == PROJ_SRC_VIEW)
+		ED_view3d_clipping_local(ps->rv3d, ps->ob->obmat);  /* faster clipping lookups */
 
 	/* paint onto the derived mesh */
 	
 	/* Workaround for subsurf selection, try the display mesh first */
-	if (ps->source==PROJ_SRC_IMAGE_CAM) {
+	if (ps->source == PROJ_SRC_IMAGE_CAM) {
 		/* using render mesh, assume only camera was rendered from */
 		ps->dm = mesh_create_derived_render(ps->scene, ps->ob, ps->scene->customdata_mask | CD_MASK_MTFACE);
-		ps->dm_release= TRUE;
+		ps->dm_release = TRUE;
 	}
-	else if(ps->ob->derivedFinal && CustomData_has_layer( &ps->ob->derivedFinal->faceData, CD_MTFACE)) {
+	else if (ps->ob->derivedFinal && CustomData_has_layer(&ps->ob->derivedFinal->faceData, CD_MTFACE)) {
 		ps->dm = ps->ob->derivedFinal;
-		ps->dm_release= FALSE;
+		ps->dm_release = FALSE;
 	}
 	else {
 		ps->dm = mesh_get_derived_final(ps->scene, ps->ob, ps->scene->customdata_mask | CD_MASK_MTFACE);
-		ps->dm_release= TRUE;
+		ps->dm_release = TRUE;
 	}
 	
-	if ( !CustomData_has_layer( &ps->dm->faceData, CD_MTFACE) ) {
+	if (!CustomData_has_layer(&ps->dm->faceData, CD_MTFACE) ) {
 		
-		if(ps->dm_release)
+		if (ps->dm_release)
 			ps->dm->release(ps->dm);
 		
 		ps->dm = NULL;
@@ -2977,11 +2991,11 @@ static void project_paint_begin(ProjPaintState *ps)
 	}
 	
 	ps->dm_mvert = ps->dm->getVertArray(ps->dm);
-	ps->dm_mface = ps->dm->getFaceArray(ps->dm);
-	ps->dm_mtface= ps->dm->getFaceDataArray(ps->dm, CD_MTFACE);
+	ps->dm_mface = ps->dm->getTessFaceArray(ps->dm);
+	ps->dm_mtface = ps->dm->getTessFaceDataArray(ps->dm, CD_MTFACE);
 	
 	ps->dm_totvert = ps->dm->getNumVerts(ps->dm);
-	ps->dm_totface = ps->dm->getNumFaces(ps->dm);
+	ps->dm_totface = ps->dm->getNumTessFaces(ps->dm);
 	
 	/* use clone mtface? */
 	
@@ -2994,9 +3008,9 @@ static void project_paint_begin(ProjPaintState *ps)
 		if (layer_num != -1)
 			ps->dm_mtface_clone = CustomData_get_layer_n(&ps->dm->faceData, CD_MTFACE, layer_num);
 		
-		if (ps->dm_mtface_clone==NULL || ps->dm_mtface_clone==ps->dm_mtface) {
+		if (ps->dm_mtface_clone == NULL || ps->dm_mtface_clone == ps->dm_mtface) {
 			ps->do_layer_clone = 0;
-			ps->dm_mtface_clone= NULL;
+			ps->dm_mtface_clone = NULL;
 			printf("ACK!\n");
 		}
 	}
@@ -3007,22 +3021,22 @@ static void project_paint_begin(ProjPaintState *ps)
 		if (layer_num != -1)
 			ps->dm_mtface_stencil = CustomData_get_layer_n(&ps->dm->faceData, CD_MTFACE, layer_num);
 		
-		if (ps->dm_mtface_stencil==NULL || ps->dm_mtface_stencil==ps->dm_mtface) {
+		if (ps->dm_mtface_stencil == NULL || ps->dm_mtface_stencil == ps->dm_mtface) {
 			ps->do_layer_stencil = 0;
 			ps->dm_mtface_stencil = NULL;
 		}
 	}
 	
 	/* when using subsurf or multires, mface arrays are thrown away, we need to keep a copy */
-	if(ps->dm->type != DM_TYPE_CDDM) {
-		ps->dm_mvert= MEM_dupallocN(ps->dm_mvert);
-		ps->dm_mface= MEM_dupallocN(ps->dm_mface);
+	if (ps->dm->type != DM_TYPE_CDDM) {
+		ps->dm_mvert = MEM_dupallocN(ps->dm_mvert);
+		ps->dm_mface = MEM_dupallocN(ps->dm_mface);
 		/* looks like these are ok for now.*/
-		/*
-		ps->dm_mtface= MEM_dupallocN(ps->dm_mtface);
-		ps->dm_mtface_clone= MEM_dupallocN(ps->dm_mtface_clone);
-		ps->dm_mtface_stencil= MEM_dupallocN(ps->dm_mtface_stencil);
-		 */
+#if 0
+		ps->dm_mtface = MEM_dupallocN(ps->dm_mtface);
+		ps->dm_mtface_clone = MEM_dupallocN(ps->dm_mtface_clone);
+		ps->dm_mtface_stencil = MEM_dupallocN(ps->dm_mtface_stencil);
+#endif
 	}
 	
 	ps->viewDir[0] = 0.0f;
@@ -3035,44 +3049,44 @@ static void project_paint_begin(ProjPaintState *ps)
 
 		invert_m4_m4(ps->ob->imat, ps->ob->obmat);
 
-		if(ps->source==PROJ_SRC_VIEW) {
+		if (ps->source == PROJ_SRC_VIEW) {
 			/* normal drawing */
-			ps->winx= ps->ar->winx;
-			ps->winy= ps->ar->winy;
+			ps->winx = ps->ar->winx;
+			ps->winy = ps->ar->winy;
 
 			copy_m4_m4(viewmat, ps->rv3d->viewmat);
 			copy_m4_m4(viewinv, ps->rv3d->viewinv);
 
 			ED_view3d_ob_project_mat_get(ps->rv3d, ps->ob, ps->projectMat);
 
-			ps->is_ortho= project_paint_view_clip(ps->v3d, ps->rv3d, &ps->clipsta, &ps->clipend);
+			ps->is_ortho = project_paint_view_clip(ps->v3d, ps->rv3d, &ps->clipsta, &ps->clipend);
 		}
 		else {
-			/* reprojection */
+			/* re-projection */
 			float winmat[4][4];
 			float vmat[4][4];
 
-			ps->winx= ps->reproject_ibuf->x;
-			ps->winy= ps->reproject_ibuf->y;
+			ps->winx = ps->reproject_ibuf->x;
+			ps->winy = ps->reproject_ibuf->y;
 
-			if (ps->source==PROJ_SRC_IMAGE_VIEW) {
+			if (ps->source == PROJ_SRC_IMAGE_VIEW) {
 				/* image stores camera data, tricky */
-				IDProperty *idgroup= IDP_GetProperties(&ps->reproject_image->id, 0);
-				IDProperty *view_data= IDP_GetPropertyFromGroup(idgroup, PROJ_VIEW_DATA_ID);
+				IDProperty *idgroup = IDP_GetProperties(&ps->reproject_image->id, 0);
+				IDProperty *view_data = IDP_GetPropertyFromGroup(idgroup, PROJ_VIEW_DATA_ID);
 
-				float *array= (float *)IDP_Array(view_data);
+				float *array = (float *)IDP_Array(view_data);
 
 				/* use image array, written when creating image */
-				memcpy(winmat, array, sizeof(winmat)); array += sizeof(winmat)/sizeof(float);
-				memcpy(viewmat, array, sizeof(viewmat)); array += sizeof(viewmat)/sizeof(float);
-				ps->clipsta= array[0];
-				ps->clipend= array[1];
-				ps->is_ortho= array[2] ? 1:0;
+				memcpy(winmat, array, sizeof(winmat)); array += sizeof(winmat) / sizeof(float);
+				memcpy(viewmat, array, sizeof(viewmat)); array += sizeof(viewmat) / sizeof(float);
+				ps->clipsta = array[0];
+				ps->clipend = array[1];
+				ps->is_ortho = array[2] ? 1 : 0;
 
 				invert_m4_m4(viewinv, viewmat);
 			}
-			else if (ps->source==PROJ_SRC_IMAGE_CAM) {
-				Object *cam_ob= ps->scene->camera;
+			else if (ps->source == PROJ_SRC_IMAGE_CAM) {
+				Object *cam_ob = ps->scene->camera;
 				CameraParams params;
 
 				/* viewmat & viewinv */
@@ -3087,9 +3101,9 @@ static void project_paint_begin(ProjPaintState *ps)
 				camera_params_compute_matrix(&params);
 
 				copy_m4_m4(winmat, params.winmat);
-				ps->clipsta= params.clipsta;
-				ps->clipend= params.clipend;
-				ps->is_ortho= params.is_ortho;
+				ps->clipsta = params.clipsta;
+				ps->clipend = params.clipend;
+				ps->is_ortho = params.is_ortho;
 			}
 
 			/* same as view3d_get_object_project_mat */
@@ -3118,20 +3132,20 @@ static void project_paint_begin(ProjPaintState *ps)
 	INIT_MINMAX2(ps->screenMin, ps->screenMax);
 	
 	ps->screenCoords = MEM_mallocN(sizeof(float) * ps->dm_totvert * 4, "ProjectPaint ScreenVerts");
-	projScreenCo= *ps->screenCoords;
+	projScreenCo = *ps->screenCoords;
 	
 	if (ps->is_ortho) {
-		for(a=0, mv=ps->dm_mvert; a < ps->dm_totvert; a++, mv++, projScreenCo+=4) {
+		for (a = 0, mv = ps->dm_mvert; a < ps->dm_totvert; a++, mv++, projScreenCo += 4) {
 			mul_v3_m4v3(projScreenCo, ps->projectMat, mv->co);
 			
 			/* 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];
+			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);
 		}
 	}
 	else {
-		for(a=0, mv=ps->dm_mvert; a < ps->dm_totvert; a++, mv++, projScreenCo+=4) {
+		for (a = 0, mv = ps->dm_mvert; a < ps->dm_totvert; a++, mv++, projScreenCo += 4) {
 			copy_v3_v3(projScreenCo, mv->co);
 			projScreenCo[3] = 1.0f;
 
@@ -3139,9 +3153,9 @@ static void project_paint_begin(ProjPaintState *ps)
 
 			if (projScreenCo[3] > ps->clipsta) {
 				/* screen space, not clamped */
-				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 */
+				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);
 			}
 			else {
@@ -3164,7 +3178,7 @@ static void project_paint_begin(ProjPaintState *ps)
 	ps->screenMax[1] += projMargin;
 	ps->screenMin[1] -= projMargin;
 	
-	if(ps->source==PROJ_SRC_VIEW) {
+	if (ps->source == PROJ_SRC_VIEW) {
 #ifdef PROJ_DEBUG_WINCLIP
 		CLAMP(ps->screenMin[0], (float)(-diameter), (float)(ps->winx + diameter));
 		CLAMP(ps->screenMax[0], (float)(-diameter), (float)(ps->winx + diameter));
@@ -3173,12 +3187,12 @@ static void project_paint_begin(ProjPaintState *ps)
 		CLAMP(ps->screenMax[1], (float)(-diameter), (float)(ps->winy + diameter));
 #endif
 	}
-	else { /* reprojection, use bounds */
-		ps->screenMin[0]= 0;
-		ps->screenMax[0]= (float)(ps->winx);
+	else { /* re-projection, use bounds */
+		ps->screenMin[0] = 0;
+		ps->screenMax[0] = (float)(ps->winx);
 
-		ps->screenMin[1]= 0;
-		ps->screenMax[1]= (float)(ps->winy);
+		ps->screenMin[1] = 0;
+		ps->screenMax[1] = (float)(ps->winy);
 	}
 
 	/* only for convenience */
@@ -3196,14 +3210,14 @@ static void project_paint_begin(ProjPaintState *ps)
 	CLAMP(ps->buckets_y, PROJ_BUCKET_RECT_MIN, PROJ_BUCKET_RECT_MAX);
 	
 	ps->bucketRect = (LinkNode **)MEM_callocN(sizeof(LinkNode *) * ps->buckets_x * ps->buckets_y, "paint-bucketRect");
-	ps->bucketFaces= (LinkNode **)MEM_callocN(sizeof(LinkNode *) * ps->buckets_x * ps->buckets_y, "paint-bucketFaces");
+	ps->bucketFaces = (LinkNode **)MEM_callocN(sizeof(LinkNode *) * ps->buckets_x * ps->buckets_y, "paint-bucketFaces");
 	
-	ps->bucketFlags= (unsigned char *)MEM_callocN(sizeof(char) * ps->buckets_x * ps->buckets_y, "paint-bucketFaces");
+	ps->bucketFlags = (unsigned char *)MEM_callocN(sizeof(char) * ps->buckets_x * ps->buckets_y, "paint-bucketFaces");
 #ifndef PROJ_DEBUG_NOSEAMBLEED
 	if (ps->seam_bleed_px > 0.0f) {
-		ps->vertFaces= (LinkNode **)MEM_callocN(sizeof(LinkNode *) * ps->dm_totvert, "paint-vertFaces");
+		ps->vertFaces = (LinkNode **)MEM_callocN(sizeof(LinkNode *) * ps->dm_totvert, "paint-vertFaces");
 		ps->faceSeamFlags = (char *)MEM_callocN(sizeof(char) * ps->dm_totface, "paint-faceSeamFlags");
-		ps->faceSeamUVs= MEM_mallocN(sizeof(float) * ps->dm_totface * 8, "paint-faceSeamUVs");
+		ps->faceSeamUVs = MEM_mallocN(sizeof(float) * ps->dm_totface * 8, "paint-faceSeamUVs");
 	}
 #endif
 	
@@ -3219,8 +3233,8 @@ static void project_paint_begin(ProjPaintState *ps)
 	else {
 		ps->thread_tot = BLI_system_thread_count();
 	}
-	for (a=0; a<ps->thread_tot; a++) {
-		ps->arena_mt[a] = BLI_memarena_new(1<<16, "project paint arena");
+	for (a = 0; a < ps->thread_tot; a++) {
+		ps->arena_mt[a] = BLI_memarena_new(1 << 16, "project paint arena");
 	}
 	
 	arena = ps->arena_mt[0]; 
@@ -3230,7 +3244,7 @@ static void project_paint_begin(ProjPaintState *ps)
 		
 		ps->vertFlags = MEM_callocN(sizeof(char) * ps->dm_totvert, "paint-vertFlags");
 		
-		for(a=0, mv=ps->dm_mvert; a < ps->dm_totvert; a++, mv++) {
+		for (a = 0, mv = ps->dm_mvert; a < ps->dm_totvert; a++, mv++) {
 			normal_short_to_float_v3(no, mv->no);
 			
 			if (ps->is_ortho) {
@@ -3249,7 +3263,7 @@ static void project_paint_begin(ProjPaintState *ps)
 	}
 	
 
-	for(face_index = 0, tf = ps->dm_mtface, mf = ps->dm_mface; face_index < ps->dm_totface; mf++, tf++, face_index++) {
+	for (face_index = 0, tf = ps->dm_mtface, mf = ps->dm_mface; face_index < ps->dm_totface; mf++, tf++, face_index++) {
 		
 #ifndef PROJ_DEBUG_NOSEAMBLEED
 		/* add face user if we have bleed enabled, set the UV seam flags later */
@@ -3266,9 +3280,9 @@ static void project_paint_begin(ProjPaintState *ps)
 		
 		tpage = project_paint_face_image(ps, ps->dm_mtface, face_index);
 
-		if (tpage && ((((Mesh *)ps->ob->data)->editflag & ME_EDIT_PAINT_MASK)==0 || mf->flag & ME_FACE_SEL)) {
+		if (tpage && ((((Mesh *)ps->ob->data)->editflag & ME_EDIT_PAINT_MASK) == 0 || mf->flag & ME_FACE_SEL)) {
 			
-			float *v1coSS, *v2coSS, *v3coSS, *v4coSS=NULL;
+			float *v1coSS, *v2coSS, *v3coSS, *v4coSS = NULL;
 			
 			v1coSS = ps->screenCoords[mf->v1]; 
 			v2coSS = ps->screenCoords[mf->v2]; 
@@ -3279,11 +3293,11 @@ static void project_paint_begin(ProjPaintState *ps)
 			
 			
 			if (!ps->is_ortho) {
-				if (	v1coSS[0]==FLT_MAX ||
-						v2coSS[0]==FLT_MAX ||
-						v3coSS[0]==FLT_MAX ||
-						(mf->v4 && v4coSS[0]==FLT_MAX)
-				) {
+				if (v1coSS[0] == FLT_MAX ||
+				    v2coSS[0] == FLT_MAX ||
+				    v3coSS[0] == FLT_MAX ||
+				    (mf->v4 && v4coSS[0] == FLT_MAX))
+				{
 					continue;
 				}
 			}
@@ -3291,26 +3305,27 @@ static void project_paint_begin(ProjPaintState *ps)
 #ifdef PROJ_DEBUG_WINCLIP
 			/* ignore faces outside the view */
 			if (
-				   (v1coSS[0] < ps->screenMin[0] &&
-					v2coSS[0] < ps->screenMin[0] &&
-					v3coSS[0] < ps->screenMin[0] &&
-					(mf->v4 && v4coSS[0] < ps->screenMin[0])) ||
-					
-				   (v1coSS[0] > ps->screenMax[0] &&
-					v2coSS[0] > ps->screenMax[0] &&
-					v3coSS[0] > ps->screenMax[0] &&
-					(mf->v4 && v4coSS[0] > ps->screenMax[0])) ||
-					
-				   (v1coSS[1] < ps->screenMin[1] &&
-					v2coSS[1] < ps->screenMin[1] &&
-					v3coSS[1] < ps->screenMin[1] &&
-					(mf->v4 && v4coSS[1] < ps->screenMin[1])) ||
-					
-				   (v1coSS[1] > ps->screenMax[1] &&
-					v2coSS[1] > ps->screenMax[1] &&
-					v3coSS[1] > ps->screenMax[1] &&
-					(mf->v4 && v4coSS[1] > ps->screenMax[1]))
-			) {
+			    (v1coSS[0] < ps->screenMin[0] &&
+			     v2coSS[0] < ps->screenMin[0] &&
+			     v3coSS[0] < ps->screenMin[0] &&
+			     (mf->v4 && v4coSS[0] < ps->screenMin[0])) ||
+
+			    (v1coSS[0] > ps->screenMax[0] &&
+			     v2coSS[0] > ps->screenMax[0] &&
+			     v3coSS[0] > ps->screenMax[0] &&
+			     (mf->v4 && v4coSS[0] > ps->screenMax[0])) ||
+
+			    (v1coSS[1] < ps->screenMin[1] &&
+			     v2coSS[1] < ps->screenMin[1] &&
+			     v3coSS[1] < ps->screenMin[1] &&
+			     (mf->v4 && v4coSS[1] < ps->screenMin[1])) ||
+
+			    (v1coSS[1] > ps->screenMax[1] &&
+			     v2coSS[1] > ps->screenMax[1] &&
+			     v3coSS[1] > ps->screenMax[1] &&
+			     (mf->v4 && v4coSS[1] > ps->screenMax[1]))
+			    )
+			{
 				continue;
 			}
 			
@@ -3322,12 +3337,12 @@ static void project_paint_begin(ProjPaintState *ps)
 					/* Since we are interpolating the normals of faces, we want to make 
 					 * sure all the verts are pointing away from the view,
 					 * not just the face */
-					if (	(ps->vertFlags[mf->v1] & PROJ_VERT_CULL) &&
-							(ps->vertFlags[mf->v2] & PROJ_VERT_CULL) &&
-							(ps->vertFlags[mf->v3] & PROJ_VERT_CULL) &&
-							(mf->v4==0 || ps->vertFlags[mf->v4] & PROJ_VERT_CULL)
-							
-					) {
+					if ((ps->vertFlags[mf->v1] & PROJ_VERT_CULL) &&
+					    (ps->vertFlags[mf->v2] & PROJ_VERT_CULL) &&
+					    (ps->vertFlags[mf->v3] & PROJ_VERT_CULL) &&
+					    (mf->v4 == 0 || ps->vertFlags[mf->v4] & PROJ_VERT_CULL)
+					    )
+					{
 						continue;
 					}
 				}
@@ -3343,7 +3358,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_get_ibuf(tpage, NULL)) { /* MemArena dosnt have an append func */
 					BLI_linklist_append(&image_LinkList, tpage);
 					image_index = ps->image_tot;
 					ps->image_tot++;
@@ -3363,7 +3378,7 @@ static void project_paint_begin(ProjPaintState *ps)
 	/* build an array of images we use*/
 	projIma = ps->projImages = (ProjPaintImage *)BLI_memarena_alloc(arena, sizeof(ProjPaintImage) * ps->image_tot);
 	
-	for (node= image_LinkList, i=0; node; node= node->next, i++, projIma++) {
+	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);
@@ -3385,8 +3400,8 @@ static void project_paint_begin_clone(ProjPaintState *ps, int mouse[2])
 		
 		projCo[3] = 1.0f;
 		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]);
+		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]);
 	}	
 }	
 
@@ -3395,7 +3410,7 @@ static void project_paint_end(ProjPaintState *ps)
 	int a;
 	
 	/* build undo data from original pixel colors */
-	if(U.uiflag & USER_GLOBALUNDO) {
+	if (U.uiflag & USER_GLOBALUNDO) {
 		ProjPixel *projPixel;
 		ImBuf *tmpibuf = NULL, *tmpibuf_float = NULL;
 		LinkNode *pixel_node;
@@ -3412,9 +3427,9 @@ static void project_paint_end(ProjPaintState *ps)
 		/* context */
 		ProjPaintImage *last_projIma;
 		int last_image_index = -1;
-		int last_tile_width=0;
+		int last_tile_width = 0;
 		
-		for(a=0, last_projIma=ps->projImages; a < ps->image_tot; a++, last_projIma++) {
+		for (a = 0, last_projIma = ps->projImages; a < ps->image_tot; a++, last_projIma++) {
 			int size = sizeof(void **) * IMAPAINT_TILE_NUMBER(last_projIma->ibuf->x) * IMAPAINT_TILE_NUMBER(last_projIma->ibuf->y);
 			last_projIma->undoRect = (void **) BLI_memarena_alloc(arena, size);
 			memset(last_projIma->undoRect, 0, size);
@@ -3423,28 +3438,28 @@ static void project_paint_end(ProjPaintState *ps)
 		
 		for (bucket_index = 0; bucket_index < bucket_tot; bucket_index++) {
 			/* loop through all pixels */
-			for(pixel_node= ps->bucketRect[bucket_index]; pixel_node; pixel_node= pixel_node->next) {
+			for (pixel_node = ps->bucketRect[bucket_index]; pixel_node; pixel_node = pixel_node->next) {
 			
 				/* ok we have a pixel, was it modified? */
 				projPixel = (ProjPixel *)pixel_node->link;
 				
 				if (last_image_index != projPixel->image_index) {
 					/* set the context */
-					last_image_index =	projPixel->image_index;
-					last_projIma =		ps->projImages + last_image_index;
-					last_tile_width =	IMAPAINT_TILE_NUMBER(last_projIma->ibuf->x);
-					is_float =			last_projIma->ibuf->rect_float ? 1 : 0;
+					last_image_index = projPixel->image_index;
+					last_projIma =     ps->projImages + last_image_index;
+					last_tile_width =  IMAPAINT_TILE_NUMBER(last_projIma->ibuf->x);
+					is_float =         last_projIma->ibuf->rect_float ? 1 : 0;
 				}
 				
 				
-				if (	(is_float == 0 && projPixel->origColor.uint != *projPixel->pixel.uint_pt) || 
-								
-						(is_float == 1 && 
-						(	projPixel->origColor.f[0] != projPixel->pixel.f_pt[0] || 
-							projPixel->origColor.f[1] != projPixel->pixel.f_pt[1] ||
-							projPixel->origColor.f[2] != projPixel->pixel.f_pt[2] ||
-							projPixel->origColor.f[3] != projPixel->pixel.f_pt[3] ))
-				) {
+				if ((is_float == 0 && projPixel->origColor.uint != *projPixel->pixel.uint_pt) ||
+				    (is_float == 1 &&
+				     (projPixel->origColor.f[0] != projPixel->pixel.f_pt[0] ||
+				      projPixel->origColor.f[1] != projPixel->pixel.f_pt[1] ||
+				      projPixel->origColor.f[2] != projPixel->pixel.f_pt[2] ||
+				      projPixel->origColor.f[3] != projPixel->pixel.f_pt[3]))
+				    )
+				{
 					
 					x_tile =  projPixel->x_px >> IMAPAINT_TILE_BITS;
 					y_tile =  projPixel->y_px >> IMAPAINT_TILE_BITS;
@@ -3454,9 +3469,9 @@ static void project_paint_end(ProjPaintState *ps)
 					
 					tile_index = x_tile + y_tile * last_tile_width;
 					
-					if (last_projIma->undoRect[tile_index]==NULL) {
+					if (last_projIma->undoRect[tile_index] == NULL) {
 						/* add the undo tile from the modified image, then write the original colors back into it */
-						tilerect = last_projIma->undoRect[tile_index] = image_undo_push_tile(last_projIma->ima, last_projIma->ibuf, is_float ? (&tmpibuf_float):(&tmpibuf) , x_tile, y_tile);
+						tilerect = last_projIma->undoRect[tile_index] = image_undo_push_tile(last_projIma->ima, last_projIma->ibuf, is_float ? (&tmpibuf_float) : (&tmpibuf), x_tile, y_tile);
 					}
 					else {
 						tilerect = last_projIma->undoRect[tile_index];
@@ -3470,14 +3485,14 @@ static void project_paint_end(ProjPaintState *ps)
 						copy_v4_v4(rgba_fp, projPixel->origColor.f);
 					}
 					else {
-						((unsigned int *)tilerect)[ (projPixel->x_px - x_round) + (projPixel->y_px - y_round) * IMAPAINT_TILE_SIZE ] = projPixel->origColor.uint;
+						((unsigned int *)tilerect)[(projPixel->x_px - x_round) + (projPixel->y_px - y_round) * IMAPAINT_TILE_SIZE] = projPixel->origColor.uint;
 					}
 				}
 			}
 		}
 		
-		if (tmpibuf)		IMB_freeImBuf(tmpibuf);
-		if (tmpibuf_float)	IMB_freeImBuf(tmpibuf_float);
+		if (tmpibuf) IMB_freeImBuf(tmpibuf);
+		if (tmpibuf_float) IMB_freeImBuf(tmpibuf_float);
 	}
 	/* done calculating undo data */
 	
@@ -3496,23 +3511,23 @@ static void project_paint_end(ProjPaintState *ps)
 	
 	if (ps->vertFlags) MEM_freeN(ps->vertFlags);
 	
-	for (a=0; a<ps->thread_tot; a++) {
+	for (a = 0; a < ps->thread_tot; a++) {
 		BLI_memarena_free(ps->arena_mt[a]);
 	}
 	
 	/* copy for subsurf/multires, so throw away */
-	if(ps->dm->type != DM_TYPE_CDDM) {
-		if(ps->dm_mvert) MEM_freeN(ps->dm_mvert);
-		if(ps->dm_mface) MEM_freeN(ps->dm_mface);
-		/* looks like these dont need copying */
-		/*
-		if(ps->dm_mtface) MEM_freeN(ps->dm_mtface);
-		if(ps->dm_mtface_clone) MEM_freeN(ps->dm_mtface_clone);
-		if(ps->dm_mtface_stencil) MEM_freeN(ps->dm_mtface_stencil);
-		*/
-	}
-
-	if(ps->dm_release)
+	if (ps->dm->type != DM_TYPE_CDDM) {
+		if (ps->dm_mvert) MEM_freeN(ps->dm_mvert);
+		if (ps->dm_mface) MEM_freeN(ps->dm_mface);
+		/* looks like these don't need copying */
+#if 0
+		if (ps->dm_mtface) MEM_freeN(ps->dm_mtface);
+		if (ps->dm_mtface_clone) MEM_freeN(ps->dm_mtface_clone);
+		if (ps->dm_mtface_stencil) MEM_freeN(ps->dm_mtface_stencil);
+#endif
+	}
+
+	if (ps->dm_release)
 		ps->dm->release(ps->dm);
 }
 
@@ -3536,7 +3551,7 @@ static void partial_redraw_array_init(ImagePaintPartialRedraw *pr)
 
 static int partial_redraw_array_merge(ImagePaintPartialRedraw *pr, ImagePaintPartialRedraw *pr_other, int tot)
 {
-	int touch= 0;
+	int touch = 0;
 	while (tot--) {
 		pr->x1 = MIN2(pr->x1, pr_other->x1);
 		pr->y1 = MIN2(pr->y1, pr_other->y1);
@@ -3558,14 +3573,14 @@ static int project_image_refresh_tagged(ProjPaintState *ps)
 {
 	ImagePaintPartialRedraw *pr;
 	ProjPaintImage *projIma;
-	int a,i;
+	int a, i;
 	int redraw = 0;
 	
 	
-	for (a=0, projIma=ps->projImages; a < ps->image_tot; a++, projIma++) {
+	for (a = 0, projIma = ps->projImages; a < ps->image_tot; a++, projIma++) {
 		if (projIma->touch) {
 			/* look over each bound cell */
-			for (i=0; i<PROJ_BOUNDBOX_SQUARED; i++) {
+			for (i = 0; i < PROJ_BOUNDBOX_SQUARED; i++) {
 				pr = &(projIma->partRedrawRect[i]);
 				if (pr->x2 != -1) { /* TODO - use 'enabled' ? */
 					imapaintpartial = *pr;
@@ -3584,11 +3599,11 @@ static int project_image_refresh_tagged(ProjPaintState *ps)
 /* run this per painting onto each mouse location */
 static int project_bucket_iter_init(ProjPaintState *ps, const float mval_f[2])
 {
-	if(ps->source==PROJ_SRC_VIEW) {
+	if (ps->source == PROJ_SRC_VIEW) {
 		float min_brush[2], max_brush[2];
 		const float radius = (float)brush_size(ps->scene, ps->brush);
 
-		/* so we dont have a bucket bounds that is way too small to paint into */
+		/* so we don't have a bucket bounds that is way too small to paint into */
 		// if (radius < 1.0f) radius = 1.0f; // this doesn't work yet :/
 
 		min_brush[0] = mval_f[0] - radius;
@@ -3601,7 +3616,7 @@ static int project_bucket_iter_init(ProjPaintState *ps, const float mval_f[2])
 		project_paint_bucket_bounds(ps, min_brush, max_brush, ps->bucketMin, ps->bucketMax);
 
 		/* mouse outside the model areas? */
-		if (ps->bucketMin[0]==ps->bucketMax[0] || ps->bucketMin[1]==ps->bucketMax[1]) {
+		if (ps->bucketMin[0] == ps->bucketMax[0] || ps->bucketMin[1] == ps->bucketMax[1]) {
 			return 0;
 		}
 
@@ -3609,11 +3624,11 @@ static int project_bucket_iter_init(ProjPaintState *ps, const float mval_f[2])
 		ps->context_bucket_y = ps->bucketMin[1];
 	}
 	else { /* reproject: PROJ_SRC_* */
-		ps->bucketMin[0]= 0;
-		ps->bucketMin[1]= 0;
+		ps->bucketMin[0] = 0;
+		ps->bucketMin[1] = 0;
 
-		ps->bucketMax[0]= ps->buckets_x;
-		ps->bucketMax[1]= ps->buckets_y;
+		ps->bucketMax[0] = ps->buckets_x;
+		ps->bucketMax[1] = ps->buckets_y;
 
 		ps->context_bucket_x = 0;
 		ps->context_bucket_y = 0;
@@ -3624,22 +3639,22 @@ static int project_bucket_iter_init(ProjPaintState *ps, const float mval_f[2])
 
 static int project_bucket_iter_next(ProjPaintState *ps, int *bucket_index, rctf *bucket_bounds, const float mval[2])
 {
-	const int diameter= 2*brush_size(ps->scene, ps->brush);
+	const int diameter = 2 * brush_size(ps->scene, ps->brush);
 
 	if (ps->thread_tot > 1)
 		BLI_lock_thread(LOCK_CUSTOM1);
 	
-	//printf("%d %d \n", ps->context_bucket_x, ps->context_bucket_y);
+	//printf("%d %d\n", ps->context_bucket_x, ps->context_bucket_y);
 	
-	for ( ; ps->context_bucket_y < ps->bucketMax[1]; ps->context_bucket_y++) {
-		for ( ; ps->context_bucket_x < ps->bucketMax[0]; ps->context_bucket_x++) {
+	for (; ps->context_bucket_y < ps->bucketMax[1]; ps->context_bucket_y++) {
+		for (; ps->context_bucket_x < ps->bucketMax[0]; ps->context_bucket_x++) {
 			
 			/* use bucket_bounds for project_bucket_isect_circle and project_bucket_init*/
 			project_bucket_bounds(ps, ps->context_bucket_x, ps->context_bucket_y, bucket_bounds);
 			
-			if (	(ps->source != PROJ_SRC_VIEW) ||
-					project_bucket_isect_circle(mval, (float)(diameter*diameter), bucket_bounds)
-			) {
+			if ((ps->source != PROJ_SRC_VIEW) ||
+			    project_bucket_isect_circle(mval, (float)(diameter * diameter), bucket_bounds))
+			{
 				*bucket_index = ps->context_bucket_x + (ps->context_bucket_y * ps->buckets_x);
 				ps->context_bucket_x++;
 				
@@ -3665,7 +3680,7 @@ typedef struct ProjectHandle {
 	float mval[2];
 	
 	/* annoying but we need to have image bounds per thread, then merge into ps->projectPartialRedraws */
-	ProjPaintImage *projImages;	/* array of partial redraws */
+	ProjPaintImage *projImages; /* array of partial redraws */
 	
 	/* thread settings */
 	int thread_index;
@@ -3674,58 +3689,58 @@ typedef struct ProjectHandle {
 static void blend_color_mix(unsigned char *cp, const unsigned char *cp1, const unsigned char *cp2, const int fac)
 {
 	/* this and other blending modes previously used >>8 instead of /255. both
-	   are not equivalent (>>8 is /256), and the former results in rounding
-	   errors that can turn colors black fast after repeated blending */
-	const int mfac= 255-fac;
+	 * are not equivalent (>>8 is /256), and the former results in rounding
+	 * errors that can turn colors black fast after repeated blending */
+	const int mfac = 255 - fac;
 
-	cp[0]= (mfac*cp1[0]+fac*cp2[0])/255;
-	cp[1]= (mfac*cp1[1]+fac*cp2[1])/255;
-	cp[2]= (mfac*cp1[2]+fac*cp2[2])/255;
-	cp[3]= (mfac*cp1[3]+fac*cp2[3])/255;
+	cp[0] = (mfac * cp1[0] + fac * cp2[0]) / 255;
+	cp[1] = (mfac * cp1[1] + fac * cp2[1]) / 255;
+	cp[2] = (mfac * cp1[2] + fac * cp2[2]) / 255;
+	cp[3] = (mfac * cp1[3] + fac * cp2[3]) / 255;
 }
 
 static void blend_color_mix_float(float *cp, const float *cp1, const float *cp2, const float fac)
 {
-	const float mfac= 1.0f-fac;
-	cp[0]= mfac*cp1[0] + fac*cp2[0];
-	cp[1]= mfac*cp1[1] + fac*cp2[1];
-	cp[2]= mfac*cp1[2] + fac*cp2[2];
-	cp[3]= mfac*cp1[3] + fac*cp2[3];
+	const float mfac = 1.0f - fac;
+	cp[0] = mfac * cp1[0] + fac * cp2[0];
+	cp[1] = mfac * cp1[1] + fac * cp2[1];
+	cp[2] = mfac * cp1[2] + fac * cp2[2];
+	cp[3] = mfac * cp1[3] + fac * cp2[3];
 }
 
 static void blend_color_mix_accum(unsigned char *cp, const unsigned char *cp1, const unsigned char *cp2, const int fac)
 {
 	/* this and other blending modes previously used >>8 instead of /255. both
-	   are not equivalent (>>8 is /256), and the former results in rounding
-	   errors that can turn colors black fast after repeated blending */
-	const int mfac= 255-fac;
-	const int alpha= cp1[3] + ((fac * cp2[3]) / 255);
+	 * are not equivalent (>>8 is /256), and the former results in rounding
+	 * errors that can turn colors black fast after repeated blending */
+	const int mfac = 255 - fac;
+	const int alpha = cp1[3] + ((fac * cp2[3]) / 255);
 
-	cp[0]= (mfac*cp1[0]+fac*cp2[0])/255;
-	cp[1]= (mfac*cp1[1]+fac*cp2[1])/255;
-	cp[2]= (mfac*cp1[2]+fac*cp2[2])/255;
-	cp[3]= alpha > 255 ? 255 : alpha;
+	cp[0] = (mfac * cp1[0] + fac * cp2[0]) / 255;
+	cp[1] = (mfac * cp1[1] + fac * cp2[1]) / 255;
+	cp[2] = (mfac * cp1[2] + fac * cp2[2]) / 255;
+	cp[3] = alpha > 255 ? 255 : alpha;
 }
 
 static void do_projectpaint_clone(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask)
 {
-	if (ps->is_airbrush==0 && mask < 1.0f) {
-		projPixel->newColor.uint = IMB_blend_color(projPixel->newColor.uint, ((ProjPixelClone*)projPixel)->clonepx.uint, (int)(alpha*255), ps->blend);
-		blend_color_mix(projPixel->pixel.ch_pt,  projPixel->origColor.ch, projPixel->newColor.ch, (int)(mask*255));
+	if (ps->is_airbrush == 0 && mask < 1.0f) {
+		projPixel->newColor.uint = IMB_blend_color(projPixel->newColor.uint, ((ProjPixelClone *)projPixel)->clonepx.uint, (int)(alpha * 255), ps->blend);
+		blend_color_mix(projPixel->pixel.ch_pt,  projPixel->origColor.ch, projPixel->newColor.ch, (int)(mask * 255));
 	}
 	else {
-		*projPixel->pixel.uint_pt = IMB_blend_color(*projPixel->pixel.uint_pt, ((ProjPixelClone*)projPixel)->clonepx.uint, (int)(alpha*mask*255), ps->blend);
+		*projPixel->pixel.uint_pt = IMB_blend_color(*projPixel->pixel.uint_pt, ((ProjPixelClone *)projPixel)->clonepx.uint, (int)(alpha * mask * 255), ps->blend);
 	}
 }
 
 static void do_projectpaint_clone_f(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask)
 {
-	if (ps->is_airbrush==0 && mask < 1.0f) {
+	if (ps->is_airbrush == 0 && mask < 1.0f) {
 		IMB_blend_color_float(projPixel->newColor.f, projPixel->newColor.f, ((ProjPixelClone *)projPixel)->clonepx.f, alpha, ps->blend);
 		blend_color_mix_float(projPixel->pixel.f_pt,  projPixel->origColor.f, projPixel->newColor.f, mask);
 	}
 	else {
-		IMB_blend_color_float(projPixel->pixel.f_pt, projPixel->pixel.f_pt, ((ProjPixelClone *)projPixel)->clonepx.f, alpha*mask, ps->blend);
+		IMB_blend_color_float(projPixel->pixel.f_pt, projPixel->pixel.f_pt, ((ProjPixelClone *)projPixel)->clonepx.f, alpha * mask, ps->blend);
 	}
 }
 
@@ -3739,10 +3754,10 @@ static void do_projectpaint_smear(ProjPaintState *ps, ProjPixel *projPixel, floa
 {
 	unsigned char rgba_ub[4];
 	
-	if (project_paint_PickColor(ps, co, NULL, rgba_ub, 1)==0)
+	if (project_paint_PickColor(ps, co, NULL, rgba_ub, 1) == 0)
 		return; 
 	/* ((ProjPixelClone *)projPixel)->clonepx.uint = IMB_blend_color(*projPixel->pixel.uint_pt, *((unsigned int *)rgba_ub), (int)(alpha*mask*255), ps->blend); */
-	blend_color_mix(((ProjPixelClone *)projPixel)->clonepx.ch, projPixel->pixel.ch_pt, rgba_ub, (int)(alpha*mask*255));
+	blend_color_mix(((ProjPixelClone *)projPixel)->clonepx.ch, projPixel->pixel.ch_pt, rgba_ub, (int)(alpha * mask * 255));
 	BLI_linklist_prepend_arena(smearPixels, (void *)projPixel, smearArena);
 } 
 
@@ -3750,11 +3765,11 @@ static void do_projectpaint_smear_f(ProjPaintState *ps, ProjPixel *projPixel, fl
 {
 	float rgba[4];
 	
-	if (project_paint_PickColor(ps, co, rgba, NULL, 1)==0)
+	if (project_paint_PickColor(ps, co, rgba, NULL, 1) == 0)
 		return;
 	
 	/* (ProjPixelClone *)projPixel)->clonepx.uint = IMB_blend_color(*((unsigned int *)rgba_smear), *((unsigned int *)rgba_ub), (int)(alpha*mask*255), ps->blend); */
-	blend_color_mix_float(((ProjPixelClone *)projPixel)->clonepx.f, projPixel->pixel.f_pt, rgba, alpha*mask); 
+	blend_color_mix_float(((ProjPixelClone *)projPixel)->clonepx.f, projPixel->pixel.f_pt, rgba, alpha * mask);
 	BLI_linklist_prepend_arena(smearPixels_f, (void *)projPixel, smearArena);
 }
 
@@ -3773,12 +3788,12 @@ static void do_projectpaint_draw(ProjPaintState *ps, ProjPixel *projPixel, float
 		rgba_ub[3] = 255;
 	}
 	
-	if (ps->is_airbrush==0 && mask < 1.0f) {
-		projPixel->newColor.uint = IMB_blend_color(projPixel->newColor.uint, *((unsigned int *)rgba_ub), (int)(alpha*255), ps->blend);
-		blend_color_mix(projPixel->pixel.ch_pt,  projPixel->origColor.ch, projPixel->newColor.ch, (int)(mask*255));
+	if (ps->is_airbrush == 0 && mask < 1.0f) {
+		projPixel->newColor.uint = IMB_blend_color(projPixel->newColor.uint, *((unsigned int *)rgba_ub), (int)(alpha * 255), ps->blend);
+		blend_color_mix(projPixel->pixel.ch_pt,  projPixel->origColor.ch, projPixel->newColor.ch, (int)(mask * 255));
 	}
 	else {
-		*projPixel->pixel.uint_pt = IMB_blend_color(*projPixel->pixel.uint_pt, *((unsigned int *)rgba_ub), (int)(alpha*mask*255), ps->blend);
+		*projPixel->pixel.uint_pt = IMB_blend_color(*projPixel->pixel.uint_pt, *((unsigned int *)rgba_ub), (int)(alpha * mask * 255), ps->blend);
 	}
 }
 
@@ -3786,17 +3801,17 @@ static void do_projectpaint_draw_f(ProjPaintState *ps, ProjPixel *projPixel, flo
 {
 	if (ps->is_texbrush) {
 		/* rgba already holds a texture result here from higher level function */
-		if(use_color_correction){
+		if (use_color_correction) {
 			float rgba_br[3];
 			srgb_to_linearrgb_v3_v3(rgba_br, ps->brush->rgb);
 			mul_v3_v3(rgba, rgba_br);
 		}
-		else{
+		else {
 			mul_v3_v3(rgba, ps->brush->rgb);
 		}
 	}
 	else {
-		if(use_color_correction){
+		if (use_color_correction) {
 			srgb_to_linearrgb_v3_v3(rgba, ps->brush->rgb);
 		}
 		else {
@@ -3805,12 +3820,12 @@ static void do_projectpaint_draw_f(ProjPaintState *ps, ProjPixel *projPixel, flo
 		rgba[3] = 1.0;
 	}
 	
-	if (ps->is_airbrush==0 && mask < 1.0f) {
+	if (ps->is_airbrush == 0 && mask < 1.0f) {
 		IMB_blend_color_float(projPixel->newColor.f, projPixel->newColor.f, rgba, alpha, ps->blend);
 		blend_color_mix_float(projPixel->pixel.f_pt,  projPixel->origColor.f, projPixel->newColor.f, mask);
 	}
 	else {
-		IMB_blend_color_float(projPixel->pixel.f_pt, projPixel->pixel.f_pt, rgba, alpha*mask, ps->blend);
+		IMB_blend_color_float(projPixel->pixel.f_pt, projPixel->pixel.f_pt, rgba, alpha * mask, ps->blend);
 	}
 }
 
@@ -3820,18 +3835,18 @@ static void do_projectpaint_draw_f(ProjPaintState *ps, ProjPixel *projPixel, flo
 static void *do_projectpaint_thread(void *ph_v)
 {
 	/* First unpack args from the struct */
-	ProjPaintState *ps =			((ProjectHandle *)ph_v)->ps;
-	ProjPaintImage *projImages =	((ProjectHandle *)ph_v)->projImages;
-	const float *lastpos =			((ProjectHandle *)ph_v)->prevmval;
-	const float *pos =				((ProjectHandle *)ph_v)->mval;
-	const int thread_index =		((ProjectHandle *)ph_v)->thread_index;
+	ProjPaintState *ps =         ((ProjectHandle *)ph_v)->ps;
+	ProjPaintImage *projImages = ((ProjectHandle *)ph_v)->projImages;
+	const float *lastpos =       ((ProjectHandle *)ph_v)->prevmval;
+	const float *pos =           ((ProjectHandle *)ph_v)->mval;
+	const int thread_index =     ((ProjectHandle *)ph_v)->thread_index;
 	/* Done with args from ProjectHandle */
 
 	LinkNode *node;
 	ProjPixel *projPixel;
 	
 	int last_index = -1;
-	ProjPaintImage *last_projIma= NULL;
+	ProjPaintImage *last_projIma = NULL;
 	ImagePaintPartialRedraw *last_partial_redraw_cell;
 	
 	float rgba[4], alpha, dist_nosqrt, dist;
@@ -3848,20 +3863,20 @@ static void *do_projectpaint_thread(void *ph_v)
 	float co[2];
 	float mask = 1.0f; /* airbrush wont use mask */
 	unsigned short mask_short;
-	const float radius= (float)brush_size(ps->scene, ps->brush);
-	const float radius_squared= radius*radius; /* avoid a square root with every dist comparison */
+	const float radius = (float)brush_size(ps->scene, ps->brush);
+	const float radius_squared = radius * radius; /* avoid a square root with every dist comparison */
 	
-	short lock_alpha= ELEM(ps->brush->blend, IMB_BLEND_ERASE_ALPHA, IMB_BLEND_ADD_ALPHA) ? 0 : ps->brush->flag & BRUSH_LOCK_ALPHA;
+	short lock_alpha = ELEM(ps->brush->blend, IMB_BLEND_ERASE_ALPHA, IMB_BLEND_ADD_ALPHA) ? 0 : ps->brush->flag & BRUSH_LOCK_ALPHA;
 	
 	LinkNode *smearPixels = NULL;
 	LinkNode *smearPixels_f = NULL;
 	MemArena *smearArena = NULL; /* mem arena for this brush projection only */
 	
-	if (tool==PAINT_TOOL_SMEAR) {
+	if (tool == PAINT_TOOL_SMEAR) {
 		pos_ofs[0] = pos[0] - lastpos[0];
 		pos_ofs[1] = pos[1] - lastpos[1];
 		
-		smearArena = BLI_memarena_new(1<<16, "paint smear arena");
+		smearArena = BLI_memarena_new(1 << 16, "paint smear arena");
 	}
 	
 	/* printf("brush bounds %d %d %d %d\n", bucketMin[0], bucketMin[1], bucketMax[0], bucketMax[1]); */
@@ -3874,7 +3889,7 @@ static void *do_projectpaint_thread(void *ph_v)
 			project_bucket_init(ps, thread_index, bucket_index, &bucket_bounds);
 		}
 
-		if(ps->source != PROJ_SRC_VIEW) {
+		if (ps->source != PROJ_SRC_VIEW) {
 
 			/* Re-Projection, simple, no brushes! */
 			
@@ -3882,9 +3897,9 @@ static void *do_projectpaint_thread(void *ph_v)
 				projPixel = (ProjPixel *)node->link;
 
 				bicubic_interpolation_color(ps->reproject_ibuf, projPixel->newColor.ch, NULL, projPixel->projCoSS[0], projPixel->projCoSS[1]);
-				if(projPixel->newColor.ch[3]) {
-					mask = ((float)projPixel->mask)/65535.0f;
-					blend_color_mix_accum(projPixel->pixel.ch_pt,  projPixel->origColor.ch, projPixel->newColor.ch, (int)(mask*projPixel->newColor.ch[3]));
+				if (projPixel->newColor.ch[3]) {
+					mask = ((float)projPixel->mask) / 65535.0f;
+					blend_color_mix_accum(projPixel->pixel.ch_pt,  projPixel->origColor.ch, projPixel->newColor.ch, (int)(mask * projPixel->newColor.ch[3]));
 
 				}
 			}
@@ -3900,7 +3915,7 @@ static void *do_projectpaint_thread(void *ph_v)
 
 				/*if (dist < radius) {*/ /* correct but uses a sqrtf */
 				if (dist_nosqrt <= radius_squared) {
-					dist=sqrtf(dist_nosqrt);
+					dist = sqrtf(dist_nosqrt);
 
 					falloff = brush_curve_strength_clamp(ps->brush, dist, radius);
 
@@ -3909,14 +3924,15 @@ static void *do_projectpaint_thread(void *ph_v)
 							/* note, for clone and smear, we only use the alpha, could be a special function */
 							brush_sample_tex(ps->scene, ps->brush, projPixel->projCoSS, rgba, thread_index);
 							alpha = rgba[3];
-						} else {
+						}
+						else {
 							alpha = 1.0f;
 						}
 						
 						if (ps->is_airbrush) {
 							/* for an aurbrush there is no real mask, so just multiply the alpha by it */
 							alpha *= falloff * brush_alpha(ps->scene, ps->brush);
-							mask = ((float)projPixel->mask)/65535.0f;
+							mask = ((float)projPixel->mask) / 65535.0f;
 						}
 						else {
 							/* This brush dosnt accumulate so add some curve to the brushes falloff */
@@ -3925,7 +3941,7 @@ static void *do_projectpaint_thread(void *ph_v)
 							
 							mask_short = (unsigned short)(projPixel->mask * (brush_alpha(ps->scene, ps->brush) * falloff));
 							if (mask_short > projPixel->mask_max) {
-								mask = ((float)mask_short)/65535.0f;
+								mask = ((float)mask_short) / 65535.0f;
 								projPixel->mask_max = mask_short;
 							}
 							else {
@@ -3951,39 +3967,39 @@ static void *do_projectpaint_thread(void *ph_v)
 							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->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 = 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);
 
 							
-							switch(tool) {
-							case PAINT_TOOL_CLONE:
-								if (is_floatbuf) {
-									if (((ProjPixelClone *)projPixel)->clonepx.f[3]) {
-										do_projectpaint_clone_f(ps, projPixel, alpha, mask); /* rgba isnt used for cloning, only alpha */
+							switch (tool) {
+								case PAINT_TOOL_CLONE:
+									if (is_floatbuf) {
+										if (((ProjPixelClone *)projPixel)->clonepx.f[3]) {
+											do_projectpaint_clone_f(ps, projPixel, alpha, mask); /* rgba isn't used for cloning, only alpha */
+										}
 									}
-								}
-								else {
-									if (((ProjPixelClone*)projPixel)->clonepx.ch[3]) {
-										do_projectpaint_clone(ps, projPixel, alpha, mask); /* rgba isnt used for cloning, only alpha */
+									else {
+										if (((ProjPixelClone *)projPixel)->clonepx.ch[3]) {
+											do_projectpaint_clone(ps, projPixel, alpha, mask); /* rgba isn't used for cloning, only alpha */
+										}
 									}
-								}
-								break;
-							case PAINT_TOOL_SMEAR:
-								sub_v2_v2v2(co, projPixel->projCoSS, pos_ofs);
-
-								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;
-							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);
-								break;
+									break;
+								case PAINT_TOOL_SMEAR:
+									sub_v2_v2v2(co, projPixel->projCoSS, pos_ofs);
+
+									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;
+								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);
+									break;
 							}
 						}
 
-						if(lock_alpha) {
-							if (is_floatbuf)	projPixel->pixel.f_pt[3]= projPixel->origColor.f[3];
-							else				projPixel->pixel.ch_pt[3]= projPixel->origColor.ch[3];
+						if (lock_alpha) {
+							if (is_floatbuf) projPixel->pixel.f_pt[3] = projPixel->origColor.f[3];
+							else projPixel->pixel.ch_pt[3] = projPixel->origColor.ch[3];
 						}
 
 						/* done painting */
@@ -3994,14 +4010,14 @@ static void *do_projectpaint_thread(void *ph_v)
 	}
 
 	
-	if (tool==PAINT_TOOL_SMEAR) {
+	if (tool == PAINT_TOOL_SMEAR) {
 		
-		for (node= smearPixels; node; node= node->next) { /* this wont run for a float image */
+		for (node = smearPixels; node; node = node->next) { /* this wont run for a float image */
 			projPixel = node->link;
 			*projPixel->pixel.uint_pt = ((ProjPixelClone *)projPixel)->clonepx.uint;
 		}
 		
-		for (node= smearPixels_f; node; node= node->next) {
+		for (node = smearPixels_f; node; node = node->next) {
 			projPixel = node->link;
 			copy_v4_v4(projPixel->pixel.f_pt, ((ProjPixelClone *)projPixel)->clonepx.f);
 		}
@@ -4012,7 +4028,7 @@ static void *do_projectpaint_thread(void *ph_v)
 	return NULL;
 }
 
-static int project_paint_op(void *state, ImBuf *UNUSED(ibufb), float *lastpos, float *pos)
+static int project_paint_op(void *state, ImBuf *UNUSED(ibufb), const float lastpos[2], const float pos[2])
 {
 	/* First unpack args from the struct */
 	ProjPaintState *ps = (ProjPaintState *)state;
@@ -4020,7 +4036,7 @@ static int project_paint_op(void *state, ImBuf *UNUSED(ibufb), float *lastpos, f
 	
 	ProjectHandle handles[BLENDER_MAX_THREADS];
 	ListBase threads;
-	int a,i;
+	int a, i;
 	
 	if (!project_bucket_iter_init(ps, pos)) {
 		return 0;
@@ -4030,7 +4046,7 @@ static int project_paint_op(void *state, ImBuf *UNUSED(ibufb), float *lastpos, f
 		BLI_init_threads(&threads, do_projectpaint_thread, ps->thread_tot);
 	
 	/* get the threads running */
-	for(a=0; a < ps->thread_tot; a++) {
+	for (a = 0; a < ps->thread_tot; a++) {
 		
 		/* set defaults in handles */
 		//memset(&handles[a], 0, sizeof(BakeShade));
@@ -4047,7 +4063,7 @@ static int project_paint_op(void *state, ImBuf *UNUSED(ibufb), float *lastpos, f
 		memcpy(handles[a].projImages, ps->projImages, ps->image_tot * sizeof(ProjPaintImage));
 		
 		/* image bounds */
-		for (i=0; i< ps->image_tot; i++) {
+		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);			
 		}
@@ -4063,9 +4079,9 @@ static int project_paint_op(void *state, ImBuf *UNUSED(ibufb), float *lastpos, f
 		
 	
 	/* move threaded bounds back into ps->projectPartialRedraws */
-	for(i=0; i < ps->image_tot; i++) {
+	for (i = 0; i < ps->image_tot; i++) {
 		int touch = 0;
-		for(a=0; a < ps->thread_tot; a++) {
+		for (a = 0; a < ps->thread_tot; a++) {
 			touch |= partial_redraw_array_merge(ps->projImages[i].partRedrawRect, handles[a].projImages[i].partRedrawRect, PROJ_BOUNDBOX_SQUARED);
 		}
 		
@@ -4102,12 +4118,12 @@ static int project_paint_stroke(ProjPaintState *ps, BrushPainter *painter, const
 {
 	int a, redraw;
 	
-	for (a=0; a < ps->image_tot; a++)
+	for (a = 0; a < ps->image_tot; a++)
 		partial_redraw_array_init(ps->projImages[a].partRedrawRect);
 	
-	redraw= project_paint_sub_stroke(ps, painter, prevmval_i, mval_i, time, pressure);
+	redraw = project_paint_sub_stroke(ps, painter, prevmval_i, mval_i, time, pressure);
 	
-	if(project_image_refresh_tagged(ps))
+	if (project_image_refresh_tagged(ps))
 		return redraw;
 	
 	return 0;
@@ -4123,7 +4139,7 @@ static void imapaint_clear_partial_redraw(void)
 static void imapaint_dirty_region(Image *ima, ImBuf *ibuf, int x, int y, int w, int h)
 {
 	ImBuf *tmpibuf = NULL;
-	int srcx= 0, srcy= 0, origx;
+	int srcx = 0, srcy = 0, origx;
 
 	IMB_rectclip(ibuf, NULL, &x, &y, &srcx, &srcy, &w, &h);
 
@@ -4133,15 +4149,15 @@ static void imapaint_dirty_region(Image *ima, ImBuf *ibuf, int x, int y, int w,
 	if (!imapaintpartial.enabled) {
 		imapaintpartial.x1 = x;
 		imapaintpartial.y1 = y;
-		imapaintpartial.x2 = x+w;
-		imapaintpartial.y2 = y+h;
+		imapaintpartial.x2 = x + w;
+		imapaintpartial.y2 = y + h;
 		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.x2 = MAX2(imapaintpartial.x2, x + w);
+		imapaintpartial.y2 = MAX2(imapaintpartial.y2, y + h);
 	}
 
 	w = ((x + w - 1) >> IMAPAINT_TILE_BITS);
@@ -4150,7 +4166,7 @@ static void imapaint_dirty_region(Image *ima, ImBuf *ibuf, int x, int y, int w,
 	y = (y >> IMAPAINT_TILE_BITS);
 	
 	for (; y <= h; y++)
-		for (x=origx; x <= w; x++)
+		for (x = origx; x <= w; x++)
 			image_undo_push_tile(ima, ibuf, &tmpibuf, x, y);
 
 	ibuf->userflags |= IB_BITMAPDIRTY;
@@ -4161,18 +4177,18 @@ static void imapaint_dirty_region(Image *ima, ImBuf *ibuf, int x, int y, int w,
 
 static void imapaint_image_update(SpaceImage *sima, Image *image, ImBuf *ibuf, short texpaint)
 {
-	if(ibuf->rect_float)
-		ibuf->userflags |= IB_RECT_INVALID; /* force recreate of char rect */
+	if (ibuf->rect_float)
+		ibuf->userflags |= IB_RECT_INVALID;  /* force recreate of char rect */
 	
-	if(ibuf->mipmap[0])
+	if (ibuf->mipmap[0])
 		ibuf->userflags |= IB_MIPMAP_INVALID;
 
 	/* todo: should set_tpage create ->rect? */
-	if(texpaint || (sima && sima->lock)) {
+	if (texpaint || (sima && sima->lock)) {
 		int w = imapaintpartial.x2 - imapaintpartial.x1;
 		int h = imapaintpartial.y2 - imapaintpartial.y1;
 		/* Testing with partial update in uv editor too */
-		GPU_paint_update_image(image, imapaintpartial.x1, imapaintpartial.y1, w, h, 0);//!texpaint);
+		GPU_paint_update_image(image, imapaintpartial.x1, imapaintpartial.y1, w, h, 0); //!texpaint);
 	}
 }
 
@@ -4188,20 +4204,22 @@ static void imapaint_ibuf_get_set_rgb(ImBuf *ibuf, int x, int y, short torus, sh
 	}
 
 	if (ibuf->rect_float) {
-		float *rrgbf = ibuf->rect_float + (ibuf->x*y + x)*4;
+		float *rrgbf = ibuf->rect_float + (ibuf->x * y + x) * 4;
 
 		if (set) {
 			IMAPAINT_FLOAT_RGB_COPY(rrgbf, rgb);
-		} else {
+		}
+		else {
 			IMAPAINT_FLOAT_RGB_COPY(rgb, rrgbf);
 		}
 	}
 	else {
-		char *rrgb = (char*)ibuf->rect + (ibuf->x*y + x)*4;
+		char *rrgb = (char *)ibuf->rect + (ibuf->x * y + x) * 4;
 
 		if (set) {
 			IMAPAINT_FLOAT_RGB_TO_CHAR(rrgb, rgb)
-		} else {
+		}
+		else {
 			IMAPAINT_CHAR_RGB_TO_FLOAT(rgb, rrgb)
 		}
 	}
@@ -4239,14 +4257,14 @@ static void imapaint_lift_soften(ImBuf *ibuf, ImBuf *ibufb, int *pos, short toru
 
 	if (!torus) {
 		IMB_rectclip(ibuf, ibufb, &in_off[0], &in_off[1], &out_off[0],
-			&out_off[1], &dim[0], &dim[1]);
+		             &out_off[1], &dim[0], &dim[1]);
 
 		if ((dim[0] == 0) || (dim[1] == 0))
 			return;
 	}
 
-	for (y=0; y < dim[1]; y++) {
-		for (x=0; x < dim[0]; x++) {
+	for (y = 0; y < dim[1]; y++) {
+		for (x = 0; x < dim[0]; x++) {
 			/* get input pixel */
 			xi = in_off[0] + x;
 			yi = in_off[1] + y;
@@ -4254,16 +4272,16 @@ static void imapaint_lift_soften(ImBuf *ibuf, ImBuf *ibufb, int *pos, short toru
 			count = 1;
 			imapaint_ibuf_get_set_rgb(ibuf, xi, yi, torus, 0, outrgb);
 
-			count += imapaint_ibuf_add_if(ibuf, xi-1, yi-1, outrgb, torus);
-			count += imapaint_ibuf_add_if(ibuf, xi-1, yi  , outrgb, torus);
-			count += imapaint_ibuf_add_if(ibuf, xi-1, yi+1, outrgb, torus);
+			count += imapaint_ibuf_add_if(ibuf, xi - 1, yi - 1, outrgb, torus);
+			count += imapaint_ibuf_add_if(ibuf, xi - 1, yi, outrgb, torus);
+			count += imapaint_ibuf_add_if(ibuf, xi - 1, yi + 1, outrgb, torus);
 
-			count += imapaint_ibuf_add_if(ibuf, xi  , yi-1, outrgb, torus);
-			count += imapaint_ibuf_add_if(ibuf, xi  , yi+1, outrgb, torus);
+			count += imapaint_ibuf_add_if(ibuf, xi, yi - 1, outrgb, torus);
+			count += imapaint_ibuf_add_if(ibuf, xi, yi + 1, outrgb, torus);
 
-			count += imapaint_ibuf_add_if(ibuf, xi+1, yi-1, outrgb, torus);
-			count += imapaint_ibuf_add_if(ibuf, xi+1, yi  , outrgb, torus);
-			count += imapaint_ibuf_add_if(ibuf, xi+1, yi+1, outrgb, torus);
+			count += imapaint_ibuf_add_if(ibuf, xi + 1, yi - 1, outrgb, torus);
+			count += imapaint_ibuf_add_if(ibuf, xi + 1, yi, outrgb, torus);
+			count += imapaint_ibuf_add_if(ibuf, xi + 1, yi + 1, outrgb, torus);
 
 			outrgb[0] /= count;
 			outrgb[1] /= count;
@@ -4279,23 +4297,23 @@ static void imapaint_lift_soften(ImBuf *ibuf, ImBuf *ibufb, int *pos, short toru
 
 static void imapaint_set_region(ImagePaintRegion *region, int destx, int desty, int srcx, int srcy, int width, int height)
 {
-	region->destx= destx;
-	region->desty= desty;
-	region->srcx= srcx;
-	region->srcy= srcy;
-	region->width= width;
-	region->height= height;
+	region->destx = destx;
+	region->desty = desty;
+	region->srcx = srcx;
+	region->srcy = srcy;
+	region->width = width;
+	region->height = height;
 }
 
 static int imapaint_torus_split_region(ImagePaintRegion region[4], ImBuf *dbuf, ImBuf *sbuf)
 {
-	int destx= region->destx;
-	int desty= region->desty;
-	int srcx= region->srcx;
-	int srcy= region->srcy;
-	int width= region->width;
-	int height= region->height;
-	int origw, origh, w, h, tot= 0;
+	int destx = region->destx;
+	int desty = region->desty;
+	int srcx = region->srcx;
+	int srcy = region->srcy;
+	int width = region->width;
+	int height = region->height;
+	int origw, origh, w, h, tot = 0;
 
 	/* convert destination and source coordinates to be within image */
 	destx = destx % dbuf->x;
@@ -4308,9 +4326,9 @@ static int imapaint_torus_split_region(ImagePaintRegion region[4], ImBuf *dbuf,
 	if (srcy < 0) srcy += sbuf->y;
 
 	/* clip width of blending area to destination imbuf, to avoid writing the
-	   same pixel twice */
-	origw = w = (width > dbuf->x)? dbuf->x: width;
-	origh = h = (height > dbuf->y)? dbuf->y: height;
+	 * same pixel twice */
+	origw = w = (width > dbuf->x) ? dbuf->x : width;
+	origh = h = (height > dbuf->y) ? dbuf->y : height;
 
 	/* clip within image */
 	IMB_rectclip(dbuf, sbuf, &destx, &desty, &srcx, &srcy, &w, &h);
@@ -4318,11 +4336,11 @@ static int imapaint_torus_split_region(ImagePaintRegion region[4], ImBuf *dbuf,
 
 	/* do 3 other rects if needed */
 	if (w < origw)
-		imapaint_set_region(&region[tot++], (destx+w)%dbuf->x, desty, (srcx+w)%sbuf->x, srcy, origw-w, h);
+		imapaint_set_region(&region[tot++], (destx + w) % dbuf->x, desty, (srcx + w) % sbuf->x, srcy, origw - w, h);
 	if (h < origh)
-		imapaint_set_region(&region[tot++], destx, (desty+h)%dbuf->y, srcx, (srcy+h)%sbuf->y, w, origh-h);
+		imapaint_set_region(&region[tot++], destx, (desty + h) % dbuf->y, srcx, (srcy + h) % sbuf->y, w, origh - h);
 	if ((w < origw) && (h < origh))
-		imapaint_set_region(&region[tot++], (destx+w)%dbuf->x, (desty+h)%dbuf->y, (srcx+w)%sbuf->x, (srcy+h)%sbuf->y, origw-w, origh-h);
+		imapaint_set_region(&region[tot++], (destx + w) % dbuf->x, (desty + h) % dbuf->y, (srcx + w) % sbuf->x, (srcy + h) % sbuf->y, origw - w, origh - h);
 	
 	return tot;
 }
@@ -4333,46 +4351,46 @@ static void imapaint_lift_smear(ImBuf *ibuf, ImBuf *ibufb, int *pos)
 	int a, tot;
 
 	imapaint_set_region(region, 0, 0, pos[0], pos[1], ibufb->x, ibufb->y);
-	tot= imapaint_torus_split_region(region, ibufb, ibuf);
+	tot = imapaint_torus_split_region(region, ibufb, ibuf);
 
-	for(a=0; a<tot; a++)
+	for (a = 0; a < tot; a++)
 		IMB_rectblend(ibufb, ibuf, region[a].destx, region[a].desty,
-			region[a].srcx, region[a].srcy,
-			region[a].width, region[a].height, IMB_BLEND_COPY_RGB);
+		              region[a].srcx, region[a].srcy,
+		              region[a].width, region[a].height, IMB_BLEND_COPY_RGB);
 }
 
 static ImBuf *imapaint_lift_clone(ImBuf *ibuf, ImBuf *ibufb, int *pos)
 {
 	/* note: allocImbuf returns zero'd memory, so regions outside image will
-	   have zero alpha, and hence not be blended onto the image */
-	int w=ibufb->x, h=ibufb->y, destx=0, desty=0, srcx=pos[0], srcy=pos[1];
-	ImBuf *clonebuf= IMB_allocImBuf(w, h, ibufb->planes, ibufb->flags);
+	 * have zero alpha, and hence not be blended onto the image */
+	int w = ibufb->x, h = ibufb->y, destx = 0, desty = 0, srcx = pos[0], srcy = pos[1];
+	ImBuf *clonebuf = IMB_allocImBuf(w, h, ibufb->planes, ibufb->flags);
 
 	IMB_rectclip(clonebuf, ibuf, &destx, &desty, &srcx, &srcy, &w, &h);
 	IMB_rectblend(clonebuf, ibuf, destx, desty, srcx, srcy, w, h,
-		IMB_BLEND_COPY_RGB);
+	              IMB_BLEND_COPY_RGB);
 	IMB_rectblend(clonebuf, ibufb, destx, desty, destx, desty, w, h,
-		IMB_BLEND_COPY_ALPHA);
+	              IMB_BLEND_COPY_ALPHA);
 
 	return clonebuf;
 }
 
-static void imapaint_convert_brushco(ImBuf *ibufb, float *pos, int *ipos)
+static void imapaint_convert_brushco(ImBuf *ibufb, const float pos[2], int ipos[2])
 {
-	ipos[0]= (int)floorf((pos[0] - ibufb->x/2) + 1.0f);
-	ipos[1]= (int)floorf((pos[1] - ibufb->y/2) + 1.0f);
+	ipos[0] = (int)floorf((pos[0] - ibufb->x / 2) + 1.0f);
+	ipos[1] = (int)floorf((pos[1] - ibufb->y / 2) + 1.0f);
 }
 
 /* dosnt run for projection painting
  * only the old style painting in the 3d view */
-static int imapaint_paint_op(void *state, ImBuf *ibufb, float *lastpos, float *pos)
+static int imapaint_paint_op(void *state, ImBuf *ibufb, const float lastpos[2], const float pos[2])
 {
-	ImagePaintState *s= ((ImagePaintState*)state);
-	ImBuf *clonebuf= NULL, *frombuf;
+	ImagePaintState *s = ((ImagePaintState *)state);
+	ImBuf *clonebuf = NULL, *frombuf;
 	ImagePaintRegion region[4];
-	short torus= s->brush->flag & BRUSH_TORUS;
-	short blend= s->blend;
-	float *offset= s->brush->clone.offset;
+	short torus = s->brush->flag & BRUSH_TORUS;
+	short blend = s->blend;
+	float *offset = s->brush->clone.offset;
 	float liftpos[2];
 	int bpos[2], blastpos[2], bliftpos[2];
 	int a, tot;
@@ -4380,48 +4398,48 @@ static int imapaint_paint_op(void *state, ImBuf *ibufb, float *lastpos, float *p
 	imapaint_convert_brushco(ibufb, pos, bpos);
 
 	/* lift from canvas */
-	if(s->tool == PAINT_TOOL_SOFTEN) {
+	if (s->tool == PAINT_TOOL_SOFTEN) {
 		imapaint_lift_soften(s->canvas, ibufb, bpos, torus);
 	}
-	else if(s->tool == PAINT_TOOL_SMEAR) {
-		if (lastpos[0]==pos[0] && lastpos[1]==pos[1])
+	else if (s->tool == PAINT_TOOL_SMEAR) {
+		if (lastpos[0] == pos[0] && lastpos[1] == pos[1])
 			return 0;
 
 		imapaint_convert_brushco(ibufb, lastpos, blastpos);
 		imapaint_lift_smear(s->canvas, ibufb, blastpos);
 	}
-	else if(s->tool == PAINT_TOOL_CLONE && s->clonecanvas) {
-		liftpos[0]= pos[0] - offset[0]*s->canvas->x;
-		liftpos[1]= pos[1] - offset[1]*s->canvas->y;
+	else if (s->tool == PAINT_TOOL_CLONE && s->clonecanvas) {
+		liftpos[0] = pos[0] - offset[0] * s->canvas->x;
+		liftpos[1] = pos[1] - offset[1] * s->canvas->y;
 
 		imapaint_convert_brushco(ibufb, liftpos, bliftpos);
-		clonebuf= imapaint_lift_clone(s->clonecanvas, ibufb, bliftpos);
+		clonebuf = imapaint_lift_clone(s->clonecanvas, ibufb, bliftpos);
 	}
 
-	frombuf= (clonebuf)? clonebuf: ibufb;
+	frombuf = (clonebuf) ? clonebuf : ibufb;
 
-	if(torus) {
+	if (torus) {
 		imapaint_set_region(region, bpos[0], bpos[1], 0, 0, frombuf->x, frombuf->y);
-		tot= imapaint_torus_split_region(region, s->canvas, frombuf);
+		tot = imapaint_torus_split_region(region, s->canvas, frombuf);
 	}
 	else {
 		imapaint_set_region(region, bpos[0], bpos[1], 0, 0, frombuf->x, frombuf->y);
-		tot= 1;
+		tot = 1;
 	}
 
 	/* blend into canvas */
-	for(a=0; a<tot; a++) {
+	for (a = 0; a < tot; a++) {
 		imapaint_dirty_region(s->image, s->canvas,
-			region[a].destx, region[a].desty,
-			region[a].width, region[a].height);
+		                      region[a].destx, region[a].desty,
+		                      region[a].width, region[a].height);
 		
 		IMB_rectblend(s->canvas, frombuf,
-			region[a].destx, region[a].desty,
-			region[a].srcx, region[a].srcy,
-			region[a].width, region[a].height, blend);
+		              region[a].destx, region[a].desty,
+		              region[a].srcx, region[a].srcy,
+		              region[a].width, region[a].height, blend);
 	}
 
-	if(clonebuf) IMB_freeImBuf(clonebuf);
+	if (clonebuf) IMB_freeImBuf(clonebuf);
 
 	return 1;
 }
@@ -4438,56 +4456,56 @@ static int texpaint_break_stroke(float *prevuv, float *fwuv, float *bkuv, float
 	sub_v2_v2v2(d1, fwuv, prevuv);
 	sub_v2_v2v2(d2, uv, bkuv);
 
-	return ((dot_v2v2(d1, d2) < 0.0f) || (mismatch > MAX2(len1, len2)*2));
+	return ((dot_v2v2(d1, d2) < 0.0f) || (mismatch > MAX2(len1, len2) * 2));
 }
 
 /* ImagePaint Common */
 
 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_get_ibuf(ima, s->sima ? &s->sima->iuser : NULL);
 	
 	/* verify that we can paint and set canvas */
-	if(ima==NULL) {
+	if (ima == NULL) {
 		return 0;
 	}
-	else if(ima->packedfile && ima->rr) {
+	else if (ima->packedfile && ima->rr) {
 		s->warnpackedfile = ima->id.name + 2;
 		return 0;
 	}	
-	else if(ibuf && ibuf->channels!=4) {
+	else if (ibuf && ibuf->channels != 4) {
 		s->warnmultifile = ima->id.name + 2;
 		return 0;
 	}
-	else if(!ibuf || !(ibuf->rect || ibuf->rect_float))
+	else if (!ibuf || !(ibuf->rect || ibuf->rect_float))
 		return 0;
 
-	s->image= ima;
-	s->canvas= ibuf;
+	s->image = ima;
+	s->canvas = ibuf;
 
 	/* 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);
+	if (s->tool == PAINT_TOOL_CLONE) {
+		ima = s->brush->clone.image;
+		ibuf = BKE_image_get_ibuf(ima, s->sima ? &s->sima->iuser : NULL);
 		
-		if(!ima || !ibuf || !(ibuf->rect || ibuf->rect_float))
+		if (!ima || !ibuf || !(ibuf->rect || ibuf->rect_float))
 			return 0;
 
-		s->clonecanvas= ibuf;
+		s->clonecanvas = ibuf;
 
 		/* temporarily add float rect for cloning */
-		if(s->canvas->rect_float && !s->clonecanvas->rect_float) {
+		if (s->canvas->rect_float && !s->clonecanvas->rect_float) {
 			int profile = IB_PROFILE_NONE;
 			
 			/* Don't want to color manage, but don't disturb existing profiles */
 			SWAP(int, s->clonecanvas->profile, profile);
 
 			IMB_float_from_rect(s->clonecanvas);
-			s->clonefreefloat= 1;
+			s->clonefreefloat = 1;
 			
 			SWAP(int, s->clonecanvas->profile, profile);
 		}
-		else if(!s->canvas->rect_float && !s->clonecanvas->rect)
+		else if (!s->canvas->rect_float && !s->clonecanvas->rect)
 			IMB_rect_from_float(s->clonecanvas);
 	}
 
@@ -4502,16 +4520,16 @@ static void imapaint_canvas_free(ImagePaintState *s)
 
 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_get_ibuf(image, s->sima ? &s->sima->iuser : NULL);
 	float pos[2];
 
-	if(!ibuf)
+	if (!ibuf)
 		return 0;
 
-	pos[0] = uv[0]*ibuf->x;
-	pos[1] = uv[1]*ibuf->y;
+	pos[0] = uv[0] * ibuf->x;
+	pos[1] = uv[1] * ibuf->y;
 
-	brush_painter_require_imbuf(painter, ((ibuf->rect_float)? 1: 0), 0, 0);
+	brush_painter_require_imbuf(painter, ((ibuf->rect_float) ? 1 : 0), 0, 0);
 
 	if (brush_painter_paint(painter, imapaint_paint_op, pos, time, pressure, s, ibuf->profile == IB_PROFILE_LINEAR_RGB)) {
 		if (update)
@@ -4530,15 +4548,15 @@ static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPaint
 
 	if (texpaint) {
 		/* pick new face and image */
-		if (	imapaint_pick_face(vc, s->me, mval, &newfaceindex) &&
-				((s->me->editflag & ME_EDIT_PAINT_MASK)==0 || (s->me->mface+newfaceindex)->flag & ME_FACE_SEL)
-		) {
+		if (imapaint_pick_face(vc, mval, &newfaceindex, s->dm_totface) &&
+		    ((s->do_facesel == FALSE) || (s->dm_mface[newfaceindex].flag & ME_FACE_SEL)))
+		{
 			ImBuf *ibuf;
 			
 			newimage = imapaint_face_image(s, newfaceindex);
-			ibuf= BKE_image_get_ibuf(newimage, s->sima? &s->sima->iuser: NULL);
+			ibuf = BKE_image_get_ibuf(newimage, s->sima ? &s->sima->iuser : NULL);
 
-			if(ibuf && ibuf->rect)
+			if (ibuf && ibuf->rect)
 				imapaint_pick_uv(s->scene, s->ob, newfaceindex, mval, newuv);
 			else {
 				newimage = NULL;
@@ -4554,17 +4572,17 @@ static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPaint
 			imapaint_pick_uv(s->scene, s->ob, newfaceindex, prevmval, bkuv);
 
 			if (newimage == s->image)
-				breakstroke= texpaint_break_stroke(s->uv, fwuv, bkuv, newuv);
+				breakstroke = texpaint_break_stroke(s->uv, fwuv, bkuv, newuv);
 			else
-				breakstroke= 1;
+				breakstroke = 1;
 		}
 		else
-			fwuv[0]= fwuv[1]= 0.0f;
+			fwuv[0] = fwuv[1] = 0.0f;
 
 		if (breakstroke) {
 			imapaint_pick_uv(s->scene, s->ob, s->faceindex, mval, fwuv);
 			redraw |= imapaint_paint_sub_stroke(s, painter, s->image, texpaint,
-				fwuv, time, 1, pressure);
+			                                    fwuv, time, 1, pressure);
 			imapaint_clear_partial_redraw();
 			brush_painter_break_stroke(painter);
 		}
@@ -4577,10 +4595,10 @@ static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPaint
 		/* paint in new image */
 		if (newimage) {
 			if (breakstroke)
-				redraw|= imapaint_paint_sub_stroke(s, painter, newimage,
-					texpaint, bkuv, time, 0, pressure);
-			redraw|= imapaint_paint_sub_stroke(s, painter, newimage, texpaint,
-				newuv, time, 1, pressure);
+				redraw |= imapaint_paint_sub_stroke(s, painter, newimage,
+				                                    texpaint, bkuv, time, 0, pressure);
+			redraw |= imapaint_paint_sub_stroke(s, painter, newimage, texpaint,
+			                                    newuv, time, 1, pressure);
 		}
 
 		/* update state */
@@ -4592,7 +4610,7 @@ static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPaint
 	else {
 		UI_view2d_region_to_view(s->v2d, mval[0], mval[1], &newuv[0], &newuv[1]);
 		redraw |= imapaint_paint_sub_stroke(s, painter, s->image, texpaint, newuv,
-			time, 1, pressure);
+		                                    time, 1, pressure);
 	}
 
 	if (redraw)
@@ -4605,18 +4623,18 @@ static int imapaint_paint_stroke(ViewContext *vc, ImagePaintState *s, BrushPaint
 
 static Brush *image_paint_brush(bContext *C)
 {
-	Scene *scene= CTX_data_scene(C);
-	ToolSettings *settings= scene->toolsettings;
+	Scene *scene = CTX_data_scene(C);
+	ToolSettings *settings = scene->toolsettings;
 
 	return paint_brush(&settings->imapaint.paint);
 }
 
 static Brush *uv_sculpt_brush(bContext *C)
 {
-	Scene *scene= CTX_data_scene(C);
-	ToolSettings *settings= scene->toolsettings;
+	Scene *scene = CTX_data_scene(C);
+	ToolSettings *settings = scene->toolsettings;
 
-	if(!settings->uvsculpt)
+	if (!settings->uvsculpt)
 		return NULL;
 	return paint_brush(&settings->uvsculpt->paint);
 }
@@ -4625,19 +4643,19 @@ static int image_paint_poll(bContext *C)
 {
 	Object *obact = CTX_data_active_object(C);
 
-	if(!image_paint_brush(C))
+	if (!image_paint_brush(C))
 		return 0;
 
-	if((obact && obact->mode & OB_MODE_TEXTURE_PAINT) && CTX_wm_region_view3d(C)) {
+	if ((obact && obact->mode & OB_MODE_TEXTURE_PAINT) && CTX_wm_region_view3d(C)) {
 		return 1;
 	}
 	else {
-		SpaceImage *sima= CTX_wm_space_image(C);
+		SpaceImage *sima = CTX_wm_space_image(C);
 
-		if(sima) {
-			ARegion *ar= CTX_wm_region(C);
+		if (sima) {
+			ARegion *ar = CTX_wm_region(C);
 
-			if((sima->flag & SI_DRAWTOOL) && ar->regiontype==RGN_TYPE_WINDOW)
+			if ((sima->flag & SI_DRAWTOOL) && ar->regiontype == RGN_TYPE_WINDOW)
 				return 1;
 		}
 	}
@@ -4647,23 +4665,22 @@ static int image_paint_poll(bContext *C)
 
 static int uv_sculpt_brush_poll(bContext *C)
 {
-	EditMesh *em;
+	BMEditMesh *em;
 	int ret;
 	Object *obedit = CTX_data_edit_object(C);
-	SpaceImage *sima= CTX_wm_space_image(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
 	Scene *scene = CTX_data_scene(C);
 	ToolSettings *toolsettings = scene->toolsettings;
 
-	if(!uv_sculpt_brush(C) || !obedit || obedit->type != OB_MESH)
+	if (!uv_sculpt_brush(C) || !obedit || obedit->type != OB_MESH)
 		return 0;
 
-	em = BKE_mesh_get_editmesh(obedit->data);
-	ret = EM_texFaceCheck(em);
-	BKE_mesh_end_editmesh(obedit->data, em);
+	em = BMEdit_FromObject(obedit);
+	ret = EDBM_mtexpoly_check(em);
 
-	if(ret && sima) {
-		ARegion *ar= CTX_wm_region(C);
-		if((toolsettings->use_uv_sculpt) && ar->regiontype==RGN_TYPE_WINDOW)
+	if (ret && sima) {
+		ARegion *ar = CTX_wm_region(C);
+		if ((toolsettings->use_uv_sculpt) && ar->regiontype == RGN_TYPE_WINDOW)
 			return 1;
 	}
 
@@ -4672,7 +4689,7 @@ static int uv_sculpt_brush_poll(bContext *C)
 
 static int image_paint_3d_poll(bContext *C)
 {
-	if(CTX_wm_region_view3d(C))
+	if (CTX_wm_region_view3d(C))
 		return image_paint_poll(C);
 	
 	return 0;
@@ -4680,11 +4697,11 @@ static int image_paint_3d_poll(bContext *C)
 
 static int image_paint_2d_clone_poll(bContext *C)
 {
-	Brush *brush= image_paint_brush(C);
+	Brush *brush = image_paint_brush(C);
 
-	if(!CTX_wm_region_view3d(C) && image_paint_poll(C))
-		if(brush && (brush->imagepaint_tool == PAINT_TOOL_CLONE))
-			if(brush->clone.image)
+	if (!CTX_wm_region_view3d(C) && image_paint_poll(C))
+		if (brush && (brush->imagepaint_tool == PAINT_TOOL_CLONE))
+			if (brush->clone.image)
 				return 1;
 	
 	return 0;
@@ -4707,7 +4724,7 @@ typedef struct PaintOperation {
 
 	int first;
 	int prevmouse[2];
-	float prev_pressure; /* need this since we dont get tablet events for pressure change */
+	float prev_pressure; /* need this since we don't get tablet events for pressure change */
 	int orig_brush_size;
 	double starttime;
 
@@ -4717,29 +4734,29 @@ typedef struct PaintOperation {
 	short restore_projection;
 } PaintOperation;
 
-static void paint_redraw(bContext *C, ImagePaintState *s, int final)
+static void paint_redraw(bContext *C, ImagePaintState *s, int texpaint, int final)
 {
-	if(final) {
-		if(s->image)
+	if (final) {
+		if (s->image && !(texpaint || (s->sima && s->sima->lock)))
 			GPU_free_image(s->image);
 
 		/* compositor listener deals with updating */
-		WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, s->image);
+		WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, s->image);
 	}
 	else {
-		if(!s->sima || !s->sima->lock)
+		if (!s->sima || !s->sima->lock)
 			ED_region_tag_redraw(CTX_wm_region(C));
 		else
-			WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, s->image);
+			WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, s->image);
 	}
 }
 
 /* initialize project paint settings from context */
 static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps)
 {
-	Scene *scene= CTX_data_scene(C);
-	ToolSettings *settings= scene->toolsettings;
-	Brush *brush= paint_brush(&settings->imapaint.paint);
+	Scene *scene = CTX_data_scene(C);
+	ToolSettings *settings = scene->toolsettings;
+	Brush *brush = paint_brush(&settings->imapaint.paint);
 
 	/* brush */
 	ps->brush = brush;
@@ -4751,12 +4768,12 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps)
 
 
 	/* these can be NULL */
-	ps->v3d= CTX_wm_view3d(C);
-	ps->rv3d= CTX_wm_region_view3d(C);
-	ps->ar= CTX_wm_region(C);
+	ps->v3d = CTX_wm_view3d(C);
+	ps->rv3d = CTX_wm_region_view3d(C);
+	ps->ar = CTX_wm_region(C);
 
-	ps->scene= scene;
-	ps->ob= ob; /* allow override of active object */
+	ps->scene = scene;
+	ps->ob = ob; /* allow override of active object */
 
 	/* setup projection painting data */
 	ps->do_backfacecull = (settings->imapaint.flag & IMAGEPAINT_PROJECT_BACKFACE) ? 0 : 1;
@@ -4775,86 +4792,116 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps)
 	ps->seam_bleed_px = settings->imapaint.seam_bleed; /* pixel num to bleed */
 #endif
 
-	if(ps->do_mask_normal) {
+	if (ps->do_mask_normal) {
 		ps->normal_angle_inner = settings->imapaint.normal_angle;
 		ps->normal_angle = (ps->normal_angle_inner + 90.0f) * 0.5f;
 	}
 	else {
-		ps->normal_angle_inner= ps->normal_angle= settings->imapaint.normal_angle;
+		ps->normal_angle_inner = ps->normal_angle = settings->imapaint.normal_angle;
 	}
 
-	ps->normal_angle_inner *=	(float)(M_PI_2 / 90);
-	ps->normal_angle *=			(float)(M_PI_2 / 90);
+	ps->normal_angle_inner *=   (float)(M_PI_2 / 90);
+	ps->normal_angle *=         (float)(M_PI_2 / 90);
 	ps->normal_angle_range = ps->normal_angle - ps->normal_angle_inner;
 
-	if(ps->normal_angle_range <= 0.0f)
-		ps->do_mask_normal = 0; /* no need to do blending */
+	if (ps->normal_angle_range <= 0.0f)
+		ps->do_mask_normal = 0;  /* no need to do blending */
 }
 
 static void paint_brush_init_tex(Brush *brush)
 {
 	/* init mtex nodes */ 
-	if(brush) {
-		MTex *mtex= &brush->mtex;
-		if(mtex->tex && mtex->tex->nodetree)
-			ntreeTexBeginExecTree(mtex->tex->nodetree, 1); /* has internal flag to detect it only does it once */
+	if (brush) {
+		MTex *mtex = &brush->mtex;
+		if (mtex->tex && mtex->tex->nodetree)
+			ntreeTexBeginExecTree(mtex->tex->nodetree, 1);  /* has internal flag to detect it only does it once */
 	}
 	
 }
 
 static int texture_paint_init(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	ToolSettings *settings= scene->toolsettings;
-	Brush *brush= paint_brush(&settings->imapaint.paint);
-	PaintOperation *pop= MEM_callocN(sizeof(PaintOperation), "PaintOperation"); /* caller frees */
+	Scene *scene = CTX_data_scene(C);
+	ToolSettings *settings = scene->toolsettings;
+	Brush *brush = paint_brush(&settings->imapaint.paint);
+	PaintOperation *pop = MEM_callocN(sizeof(PaintOperation), "PaintOperation"); /* caller frees */
 
-	pop->first= 1;
-	op->customdata= pop;
+	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) {
+	 *      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)) {
-		pop->mode= PAINT_MODE_3D;
+	if (CTX_wm_region_view3d(C)) {
+		pop->mode = PAINT_MODE_3D;
 
-		if(!(settings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE))
-			pop->mode= PAINT_MODE_3D_PROJECT;
+		if (!(settings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE))
+			pop->mode = PAINT_MODE_3D_PROJECT;
 		else
 			view3d_set_viewcontext(C, &pop->vc);
 	}
 	else {
-		pop->s.sima= CTX_wm_space_image(C);
-		pop->s.v2d= &CTX_wm_region(C)->v2d;
+		pop->s.sima = CTX_wm_space_image(C);
+		pop->s.v2d = &CTX_wm_region(C)->v2d;
 	}
 
-	pop->s.scene= scene;
-	pop->s.screen= CTX_wm_screen(C);
+	pop->s.scene = scene;
+	pop->s.screen = CTX_wm_screen(C);
 
 	pop->s.brush = brush;
 	pop->s.tool = brush->imagepaint_tool;
-	if(pop->mode == PAINT_MODE_3D && (pop->s.tool == PAINT_TOOL_CLONE))
+	if (pop->mode == PAINT_MODE_3D && (pop->s.tool == PAINT_TOOL_CLONE))
 		pop->s.tool = PAINT_TOOL_DRAW;
 	pop->s.blend = brush->blend;
-	pop->orig_brush_size= brush_size(scene, brush);
+	pop->orig_brush_size = brush_size(scene, brush);
+
+	if (pop->mode != PAINT_MODE_2D) {
+		Object *ob = OBACT;
+		Mesh *me = get_mesh(ob);
+
+		if (!me) {
+			return 0;
+		}
+
+		pop->s.ob = ob;
+		pop->s.do_facesel = (me->editflag & ME_EDIT_PAINT_MASK) != 0;
+
+		/* for non prohect paint we need */
+		/* fill in derived mesh */
+		if (ob->derivedFinal && CustomData_has_layer(&ob->derivedFinal->faceData, CD_MTFACE)) {
+			pop->s.dm = ob->derivedFinal;
+			pop->s.dm_release = FALSE;
+		}
+		else {
+			pop->s.dm = mesh_get_derived_final(pop->s.scene, ob, pop->s.scene->customdata_mask | CD_MASK_MTFACE);
+			pop->s.dm_release = TRUE;
+		}
+
+		if (!CustomData_has_layer(&pop->s.dm->faceData, CD_MTFACE)) {
+
+			if (pop->s.dm_release)
+				pop->s.dm->release(pop->s.dm);
+
+			pop->s.dm = NULL;
+			return 0;
+		}
 
-	if(pop->mode != PAINT_MODE_2D) {
-		pop->s.ob = OBACT;
-		pop->s.me = get_mesh(pop->s.ob);
-		if (!pop->s.me) return 0;
+		pop->s.dm_mface = pop->s.dm->getTessFaceArray(pop->s.dm);
+		pop->s.dm_mtface = pop->s.dm->getTessFaceDataArray(pop->s.dm, CD_MTFACE);
+		pop->s.dm_totface = pop->s.dm->getNumTessFaces(pop->s.dm);
 	}
 	else {
 		pop->s.image = pop->s.sima->image;
 
-		if(!imapaint_canvas_set(&pop->s, pop->s.image)) {
-			if(pop->s.warnmultifile)
+		if (!imapaint_canvas_set(&pop->s, pop->s.image)) {
+			if (pop->s.warnmultifile)
 				BKE_report(op->reports, RPT_WARNING, "Image requires 4 color channels to paint");
-			if(pop->s.warnpackedfile)
+			if (pop->s.warnpackedfile)
 				BKE_report(op->reports, RPT_WARNING, "Packed MultiLayer files cannot be painted");
 
 			return 0;
@@ -4864,42 +4911,42 @@ static int texture_paint_init(bContext *C, wmOperator *op)
 	paint_brush_init_tex(pop->s.brush);
 	
 	/* note, if we have no UVs on the derived mesh, then we must return here */
-	if(pop->mode == PAINT_MODE_3D_PROJECT) {
+	if (pop->mode == PAINT_MODE_3D_PROJECT) {
 
 		/* initialize all data from the context */
 		project_state_init(C, OBACT, &pop->ps);
 		
 		paint_brush_init_tex(pop->ps.brush);
 
-		pop->ps.source= PROJ_SRC_VIEW;
+		pop->ps.source = PROJ_SRC_VIEW;
 
-		if (pop->ps.ob==NULL || !(pop->ps.ob->lay & pop->ps.v3d->lay))
+		if (pop->ps.ob == NULL || !(pop->ps.ob->lay & pop->ps.v3d->lay))
 			return 0;
 
-		/* Dont allow brush size below 2 */
+		/* Don't allow brush size below 2 */
 		if (brush_size(scene, brush) < 2)
 			brush_set_size(scene, brush, 2);
 
 		/* allocate and initialize spacial data structures */
 		project_paint_begin(&pop->ps);
 		
-		if(pop->ps.dm==NULL)
+		if (pop->ps.dm == NULL)
 			return 0;
 	}
 	
 	settings->imapaint.flag |= IMAGEPAINT_DRAWING;
 	undo_paint_push_begin(UNDO_PAINT_IMAGE, op->type->name,
-		image_undo_restore, image_undo_free);
+	                      image_undo_restore, image_undo_free);
 
 	/* create painter */
-	pop->painter= brush_painter_new(scene, pop->s.brush);
+	pop->painter = brush_painter_new(scene, pop->s.brush);
 
 	return 1;
 }
 
 static void paint_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
 {
-	PaintOperation *pop= op->customdata;
+	PaintOperation *pop = op->customdata;
 	float time, mousef[2];
 	float pressure;
 	int mouse[2], redraw;
@@ -4907,52 +4954,52 @@ static void paint_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
 	RNA_float_get_array(itemptr, "mouse", mousef);
 	mouse[0] = (int)(mousef[0]);
 	mouse[1] = (int)(mousef[1]);
-	time= RNA_float_get(itemptr, "time");
-	pressure= RNA_float_get(itemptr, "pressure");
+	time = RNA_float_get(itemptr, "time");
+	pressure = RNA_float_get(itemptr, "pressure");
 
-	if(pop->first)
+	if (pop->first)
 		project_paint_begin_clone(&pop->ps, mouse);
 
-	if(pop->mode == PAINT_MODE_3D)
+	if (pop->mode == PAINT_MODE_3D)
 		view3d_operator_needs_opengl(C);
 
-	if(pop->mode == PAINT_MODE_3D_PROJECT) {
-		redraw= project_paint_stroke(&pop->ps, pop->painter, pop->prevmouse, mouse, time, pressure);
-		pop->prevmouse[0]= mouse[0];
-		pop->prevmouse[1]= mouse[1];
+	if (pop->mode == PAINT_MODE_3D_PROJECT) {
+		redraw = project_paint_stroke(&pop->ps, pop->painter, pop->prevmouse, mouse, time, pressure);
+		pop->prevmouse[0] = mouse[0];
+		pop->prevmouse[1] = mouse[1];
 
 	}
 	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];
+		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];
 	}
 
-	if(redraw)
-		paint_redraw(C, &pop->s, 0);
+	if (redraw)
+		paint_redraw(C, &pop->s, pop->mode == PAINT_MODE_3D, 0);
 
-	pop->first= 0;
+	pop->first = 0;
 }
 
 static void paint_brush_exit_tex(Brush *brush)
 {
-	if(brush) {
-		MTex *mtex= &brush->mtex;
-		if(mtex->tex && mtex->tex->nodetree)
+	if (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)
 {
-	Scene *scene= CTX_data_scene(C);
-	ToolSettings *settings= scene->toolsettings;
-	PaintOperation *pop= op->customdata;
+	Scene *scene = CTX_data_scene(C);
+	ToolSettings *settings = scene->toolsettings;
+	PaintOperation *pop = op->customdata;
 
-	if(pop->timer)
+	if (pop->timer)
 		WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), pop->timer);
 
-	if(pop->restore_projection)
+	if (pop->restore_projection)
 		settings->imapaint.flag &= ~IMAGEPAINT_PROJECT_DISABLE;
 
 	paint_brush_exit_tex(pop->s.brush);
@@ -4961,19 +5008,24 @@ static void paint_exit(bContext *C, wmOperator *op)
 	imapaint_canvas_free(&pop->s);
 	brush_painter_free(pop->painter);
 
-	if(pop->mode == PAINT_MODE_3D_PROJECT) {
+	if (pop->mode == PAINT_MODE_3D_PROJECT) {
 		brush_set_size(scene, pop->ps.brush, pop->orig_brush_size);
 		paint_brush_exit_tex(pop->ps.brush);
 		
 		project_paint_end(&pop->ps);
 	}
+	else {
+		/* non projection 3d paint, could move into own function of more needs adding */
+		if (pop->s.dm_release)
+			pop->s.dm->release(pop->s.dm);
+	}
 	
-	paint_redraw(C, &pop->s, 1);
+	paint_redraw(C, &pop->s, pop->mode == PAINT_MODE_3D, 1);
 	undo_paint_push_end(UNDO_PAINT_IMAGE);
 	
-	if(pop->s.warnmultifile)
+	if (pop->s.warnmultifile)
 		BKE_reportf(op->reports, RPT_WARNING, "Image requires 4 color channels to paint: %s", pop->s.warnmultifile);
-	if(pop->s.warnpackedfile)
+	if (pop->s.warnpackedfile)
 		BKE_reportf(op->reports, RPT_WARNING, "Packed MultiLayer files cannot be painted: %s", pop->s.warnpackedfile);
 
 	MEM_freeN(pop);
@@ -4981,7 +5033,7 @@ static void paint_exit(bContext *C, wmOperator *op)
 
 static int paint_exec(bContext *C, wmOperator *op)
 {
-	if(!texture_paint_init(C, op)) {
+	if (!texture_paint_init(C, op)) {
 		MEM_freeN(op->customdata);
 		return OPERATOR_CANCELLED;
 	}
@@ -4999,43 +5051,43 @@ static int paint_exec(bContext *C, wmOperator *op)
 static void paint_apply_event(bContext *C, wmOperator *op, wmEvent *event)
 {
 	const Scene *scene = CTX_data_scene(C);
-	PaintOperation *pop= op->customdata;
+	PaintOperation *pop = op->customdata;
 	wmTabletData *wmtab;
 	PointerRNA itemptr;
 	float pressure, mousef[2];
 	double time;
 	int tablet;
 
-	time= PIL_check_seconds_timer();
+	time = PIL_check_seconds_timer();
 
-	tablet= 0;
-	pop->s.blend= pop->s.brush->blend;
+	tablet = 0;
+	pop->s.blend = pop->s.brush->blend;
 
-	if(event->custom == EVT_DATA_TABLET) {
-		wmtab= event->customdata;
+	if (event->custom == EVT_DATA_TABLET) {
+		wmtab = event->customdata;
 
-		tablet= (wmtab->Active != EVT_TABLET_NONE);
-		pressure= wmtab->Pressure;
-		if(wmtab->Active == EVT_TABLET_ERASER)
-			pop->s.blend= IMB_BLEND_ERASE_ALPHA;
+		tablet = (wmtab->Active != EVT_TABLET_NONE);
+		pressure = wmtab->Pressure;
+		if (wmtab->Active == EVT_TABLET_ERASER)
+			pop->s.blend = IMB_BLEND_ERASE_ALPHA;
 	}
 	else { /* otherwise airbrush becomes 1.0 pressure instantly */
-		pressure= pop->prev_pressure ? pop->prev_pressure : 1.0f;
+		pressure = pop->prev_pressure ? pop->prev_pressure : 1.0f;
 	}
 
-	if(pop->first) {
-		pop->prevmouse[0]= event->mval[0];
-		pop->prevmouse[1]= event->mval[1];
-		pop->starttime= time;
+	if (pop->first) {
+		pop->prevmouse[0] = event->mval[0];
+		pop->prevmouse[1] = event->mval[1];
+		pop->starttime = time;
 
 		/* 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 && (pressure >= 0.99f) && ((pop->s.brush->flag & BRUSH_SPACING_PRESSURE) || brush_use_alpha_pressure(scene, pop->s.brush) || brush_use_size_pressure(scene, pop->s.brush)))
 			return;
 
 		/* This can be removed once fixed properly in
-		 brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, double time, float pressure, void *user) 
-		 at zero pressure we should do nothing 1/2^12 is .0002 which is the sensitivity of the most sensitive pen tablet available*/
+		 * brush_painter_paint(BrushPainter *painter, BrushFunc func, float *pos, double time, float pressure, void *user) 
+		 * at zero pressure we should do nothing 1/2^12 is .0002 which is the sensitivity of the most sensitive pen tablet available */
 		if (tablet && (pressure < .0002f) && ((pop->s.brush->flag & BRUSH_SPACING_PRESSURE) || brush_use_alpha_pressure(scene, pop->s.brush) || brush_use_size_pressure(scene, pop->s.brush)))
 			return;
 	
@@ -5053,34 +5105,34 @@ static void paint_apply_event(bContext *C, wmOperator *op, wmEvent *event)
 	/* apply */
 	paint_apply(C, op, &itemptr);
 
-	pop->prev_pressure= pressure;
+	pop->prev_pressure = pressure;
 }
 
 static int paint_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 	PaintOperation *pop;
 
-	if(!texture_paint_init(C, op)) {
+	if (!texture_paint_init(C, op)) {
 		MEM_freeN(op->customdata);
 		return OPERATOR_CANCELLED;
 	}
 	
 	paint_apply_event(C, op, event);
 
-	pop= op->customdata;
+	pop = op->customdata;
 	WM_event_add_modal_handler(C, op);
 
-	if(pop->s.brush->flag & BRUSH_AIRBRUSH)
-		pop->timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
+	if (pop->s.brush->flag & BRUSH_AIRBRUSH)
+		pop->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
 
 	return OPERATOR_RUNNING_MODAL;
 }
 
 static int paint_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
-	PaintOperation *pop= op->customdata;
+	PaintOperation *pop = op->customdata;
 
-	switch(event->type) {
+	switch (event->type) {
 		case LEFTMOUSE:
 		case MIDDLEMOUSE:
 		case RIGHTMOUSE: // XXX hardcoded
@@ -5091,7 +5143,7 @@ static int paint_modal(bContext *C, wmOperator *op, wmEvent *event)
 			paint_apply_event(C, op, event);
 			break;
 		case TIMER:
-			if(event->customdata == pop->timer)
+			if (event->customdata == pop->timer)
 				paint_apply_event(C, op, event);
 			break;
 	}
@@ -5109,18 +5161,18 @@ static int paint_cancel(bContext *C, wmOperator *op)
 void PAINT_OT_image_paint(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Image Paint";
-	ot->idname= "PAINT_OT_image_paint";
+	ot->name = "Image Paint";
+	ot->idname = "PAINT_OT_image_paint";
 	
 	/* api callbacks */
-	ot->exec= paint_exec;
-	ot->invoke= paint_invoke;
-	ot->modal= paint_modal;
-	ot->cancel= paint_cancel;
-	ot->poll= image_paint_poll;
+	ot->exec = paint_exec;
+	ot->invoke = paint_invoke;
+	ot->modal = paint_modal;
+	ot->cancel = paint_cancel;
+	ot->poll = image_paint_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_BLOCKING;
 
 	/* properties */
 	RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
@@ -5128,11 +5180,11 @@ void PAINT_OT_image_paint(wmOperatorType *ot)
 
 int get_imapaint_zoom(bContext *C, float *zoomx, float *zoomy)
 {
-	RegionView3D *rv3d= CTX_wm_region_view3d(C);
+	RegionView3D *rv3d = CTX_wm_region_view3d(C);
 
-	if(!rv3d) {
-		SpaceImage *sima= CTX_wm_space_image(C);
-		ARegion *ar= CTX_wm_region(C);
+	if (!rv3d) {
+		SpaceImage *sima = CTX_wm_space_image(C);
+		ARegion *ar = CTX_wm_region(C);
 		
 		ED_space_image_zoom(sima, ar, zoomx, zoomy);
 
@@ -5151,22 +5203,24 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)
 #define PX_SIZE_FADE_MAX 12.0f
 #define PX_SIZE_FADE_MIN 4.0f
 
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	//Brush *brush= image_paint_brush(C);
-	Paint *paint= paint_get_active(scene);
-	Brush *brush= paint_brush(paint);
+	Paint *paint = paint_get_active(scene);
+	Brush *brush = paint_brush(paint);
 
-	if(paint && brush && paint->flags & PAINT_SHOW_BRUSH) {
+	if (paint && brush && paint->flags & PAINT_SHOW_BRUSH) {
 		ToolSettings *ts;
 		float zoomx, zoomy;
-		const float size= (float)brush_size(scene, brush);
-		const short use_zoom= get_imapaint_zoom(C, &zoomx, &zoomy);
+		const float size = (float)brush_size(scene, brush);
+		short use_zoom;
 		float pixel_size;
-		float alpha= 0.5f;
+		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));
 
-		if(use_zoom && !ts->use_uv_sculpt){
+		if (use_zoom) {
 			pixel_size = MAX2(size * zoomx, size * zoomy);
 		}
 		else {
@@ -5174,7 +5228,7 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)
 		}
 
 		/* fade out the brush (cheap trick to work around brush interfearing with sampling [#])*/
-		if(pixel_size < PX_SIZE_FADE_MIN) {
+		if (pixel_size < PX_SIZE_FADE_MIN) {
 			return;
 		}
 		else if (pixel_size < PX_SIZE_FADE_MAX) {
@@ -5186,15 +5240,15 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)
 		glTranslatef((float)x, (float)y, 0.0f);
 
 		/* No need to scale for uv sculpting, on the contrary it might be useful to keep unscaled */
-		if(use_zoom && !ts->use_uv_sculpt)
+		if (use_zoom)
 			glScalef(zoomx, zoomy, 1.0f);
 
 		glColor4f(brush->add_col[0], brush->add_col[1], brush->add_col[2], alpha);
-		glEnable( GL_LINE_SMOOTH );
+		glEnable(GL_LINE_SMOOTH);
 		glEnable(GL_BLEND);
-		glutil_draw_lined_arc(0, (float)(M_PI*2.0), size, 40);
+		glutil_draw_lined_arc(0, (float)(M_PI * 2.0), size, 40);
 		glDisable(GL_BLEND);
-		glDisable( GL_LINE_SMOOTH );
+		glDisable(GL_LINE_SMOOTH);
 
 		glPopMatrix();
 	}
@@ -5204,39 +5258,39 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)
 
 static void toggle_paint_cursor(bContext *C, int enable)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 	Scene *scene = CTX_data_scene(C);
-	ToolSettings *settings= scene->toolsettings;
+	ToolSettings *settings = scene->toolsettings;
 
-	if(settings->imapaint.paintcursor && !enable) {
+	if (settings->imapaint.paintcursor && !enable) {
 		WM_paint_cursor_end(wm, settings->imapaint.paintcursor);
 		settings->imapaint.paintcursor = NULL;
 	}
-	else if(enable)
-		settings->imapaint.paintcursor= WM_paint_cursor_activate(wm, image_paint_poll, brush_drawcursor, NULL);
+	else if (enable)
+		settings->imapaint.paintcursor = WM_paint_cursor_activate(wm, image_paint_poll, brush_drawcursor, NULL);
 }
 
 /* enable the paint cursor if it isn't already.
-
-   purpose is to make sure the paint cursor is shown if paint
-   mode is enabled in the image editor. the paint poll will
-   ensure that the cursor is hidden when not in paint mode */
+ *
+ * purpose is to make sure the paint cursor is shown if paint
+ * mode is enabled in the image editor. the paint poll will
+ * ensure that the cursor is hidden when not in paint mode */
 void ED_space_image_paint_update(wmWindowManager *wm, ToolSettings *settings)
 {
 	ImagePaintSettings *imapaint = &settings->imapaint;
 
-	if(!imapaint->paintcursor) {
+	if (!imapaint->paintcursor) {
 		imapaint->paintcursor =
-			WM_paint_cursor_activate(wm, image_paint_poll,
-						 brush_drawcursor, NULL);
+		    WM_paint_cursor_activate(wm, image_paint_poll,
+		                             brush_drawcursor, NULL);
 	}
 }
 
 
 void ED_space_image_uv_sculpt_update(wmWindowManager *wm, ToolSettings *settings)
 {
-	if(settings->use_uv_sculpt) {
-		if(!settings->uvsculpt) {
+	if (settings->use_uv_sculpt) {
+		if (!settings->uvsculpt) {
 			settings->uvsculpt = MEM_callocN(sizeof(*settings->uvsculpt), "UV Smooth paint");
 			settings->uv_sculpt_tool = UV_SCULPT_TOOL_GRAB;
 			settings->uv_sculpt_settings = UV_SCULPT_LOCK_BORDERS | UV_SCULPT_ALL_ISLANDS;
@@ -5246,10 +5300,10 @@ void ED_space_image_uv_sculpt_update(wmWindowManager *wm, ToolSettings *settings
 		paint_init(&settings->uvsculpt->paint, PAINT_CURSOR_SCULPT);
 
 		WM_paint_cursor_activate(wm, uv_sculpt_brush_poll,
-			brush_drawcursor, NULL);
+		                         brush_drawcursor, NULL);
 	}
 	else {
-		if(settings->uvsculpt)
+		if (settings->uvsculpt)
 			settings->uvsculpt->paint.flags &= ~PAINT_SHOW_BRUSH;
 	}
 }
@@ -5262,7 +5316,7 @@ typedef struct GrabClone {
 
 static void grab_clone_apply(bContext *C, wmOperator *op)
 {
-	Brush *brush= image_paint_brush(C);
+	Brush *brush = image_paint_brush(C);
 	float delta[2];
 
 	RNA_float_get_array(op->ptr, "delta", delta);
@@ -5279,14 +5333,14 @@ static int grab_clone_exec(bContext *C, wmOperator *op)
 
 static int grab_clone_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	Brush *brush= image_paint_brush(C);
+	Brush *brush = image_paint_brush(C);
 	GrabClone *cmv;
 
-	cmv= MEM_callocN(sizeof(GrabClone), "GrabClone");
+	cmv = MEM_callocN(sizeof(GrabClone), "GrabClone");
 	copy_v2_v2(cmv->startoffset, brush->clone.offset);
-	cmv->startx= event->x;
-	cmv->starty= event->y;
-	op->customdata= cmv;
+	cmv->startx = event->x;
+	cmv->starty = event->y;
+	op->customdata = cmv;
 
 	WM_event_add_modal_handler(C, op);
 
@@ -5295,13 +5349,13 @@ static int grab_clone_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 static int grab_clone_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
-	Brush *brush= image_paint_brush(C);
-	ARegion *ar= CTX_wm_region(C);
-	GrabClone *cmv= op->customdata;
+	Brush *brush = image_paint_brush(C);
+	ARegion *ar = CTX_wm_region(C);
+	GrabClone *cmv = op->customdata;
 	float startfx, startfy, fx, fy, delta[2];
-	int xmin= ar->winrct.xmin, ymin= ar->winrct.ymin;
+	int xmin = ar->winrct.xmin, ymin = ar->winrct.ymin;
 
-	switch(event->type) {
+	switch (event->type) {
 		case LEFTMOUSE:
 		case MIDDLEMOUSE:
 		case RIGHTMOUSE: // XXX hardcoded
@@ -5312,8 +5366,8 @@ static int grab_clone_modal(bContext *C, wmOperator *op, wmEvent *event)
 			UI_view2d_region_to_view(&ar->v2d, cmv->startx - xmin, cmv->starty - ymin, &startfx, &startfy);
 			UI_view2d_region_to_view(&ar->v2d, event->x - xmin, event->y - ymin, &fx, &fy);
 
-			delta[0]= fx - startfx;
-			delta[1]= fy - startfy;
+			delta[0] = fx - startfx;
+			delta[1] = fy - startfy;
 			RNA_float_set_array(op->ptr, "delta", delta);
 
 			copy_v2_v2(brush->clone.offset, cmv->startoffset);
@@ -5334,18 +5388,18 @@ static int grab_clone_cancel(bContext *UNUSED(C), wmOperator *op)
 void PAINT_OT_grab_clone(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Grab Clone";
-	ot->idname= "PAINT_OT_grab_clone";
+	ot->name = "Grab Clone";
+	ot->idname = "PAINT_OT_grab_clone";
 	
 	/* api callbacks */
-	ot->exec= grab_clone_exec;
-	ot->invoke= grab_clone_invoke;
-	ot->modal= grab_clone_modal;
-	ot->cancel= grab_clone_cancel;
-	ot->poll= image_paint_2d_clone_poll;
+	ot->exec = grab_clone_exec;
+	ot->invoke = grab_clone_invoke;
+	ot->modal = grab_clone_modal;
+	ot->cancel = grab_clone_cancel;
+	ot->poll = image_paint_2d_clone_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
 
 	/* properties */
 	RNA_def_float_vector(ot->srna, "delta", 2, NULL, -FLT_MAX, FLT_MAX, "Delta", "Delta offset of clone image in 0.0..1.0 coordinates", -1.0f, 1.0f);
@@ -5355,15 +5409,15 @@ void PAINT_OT_grab_clone(wmOperatorType *ot)
 
 static int sample_color_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Brush *brush= image_paint_brush(C);
-	ARegion *ar= CTX_wm_region(C);
+	Scene *scene = CTX_data_scene(C);
+	Brush *brush = image_paint_brush(C);
+	ARegion *ar = CTX_wm_region(C);
 	int location[2];
 
 	RNA_int_get_array(op->ptr, "location", location);
 	paint_sample_color(scene, ar, location[0], location[1]);
 
-	WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush);
+	WM_event_add_notifier(C, NC_BRUSH | NA_EDITED, brush);
 	
 	return OPERATOR_FINISHED;
 }
@@ -5380,7 +5434,7 @@ static int sample_color_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 static int sample_color_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
-	switch(event->type) {
+	switch (event->type) {
 		case LEFTMOUSE:
 		case RIGHTMOUSE: // XXX hardcoded
 			return OPERATOR_FINISHED;
@@ -5396,12 +5450,12 @@ static int sample_color_modal(bContext *C, wmOperator *op, wmEvent *event)
 /* same as image_paint_poll but fail when face mask mode is enabled */
 static int image_paint_sample_color_poll(bContext *C)
 {
-	if(image_paint_poll(C)) {
-		if(CTX_wm_view3d(C)) {
+	if (image_paint_poll(C)) {
+		if (CTX_wm_view3d(C)) {
 			Object *obact = CTX_data_active_object(C);
 			if (obact && obact->mode & OB_MODE_TEXTURE_PAINT) {
-				Mesh *me= get_mesh(obact);
-				if(me) {
+				Mesh *me = get_mesh(obact);
+				if (me) {
 					return !(me->editflag & ME_EDIT_PAINT_MASK);
 				}
 			}
@@ -5416,17 +5470,17 @@ static int image_paint_sample_color_poll(bContext *C)
 void PAINT_OT_sample_color(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Sample Color";
-	ot->idname= "PAINT_OT_sample_color";
+	ot->name = "Sample Color";
+	ot->idname = "PAINT_OT_sample_color";
 	
 	/* api callbacks */
-	ot->exec= sample_color_exec;
-	ot->invoke= sample_color_invoke;
-	ot->modal= sample_color_modal;
-	ot->poll= image_paint_sample_color_poll;
+	ot->exec = sample_color_exec;
+	ot->invoke = sample_color_invoke;
+	ot->modal = sample_color_modal;
+	ot->poll = image_paint_sample_color_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_int_vector(ot->srna, "location", 2, NULL, 0, INT_MAX, "Location", "Cursor location in region coordinates", 0, 16384);
@@ -5436,9 +5490,9 @@ void PAINT_OT_sample_color(wmOperatorType *ot)
 
 static int set_clone_cursor_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	View3D *v3d= CTX_wm_view3d(C);
-	float *cursor= give_cursor(scene, v3d);
+	Scene *scene = CTX_data_scene(C);
+	View3D *v3d = CTX_wm_view3d(C);
+	float *cursor = give_cursor(scene, v3d);
 
 	RNA_float_get_array(op->ptr, "location", cursor);
 	
@@ -5449,14 +5503,14 @@ static int set_clone_cursor_exec(bContext *C, wmOperator *op)
 
 static int set_clone_cursor_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	Scene *scene= CTX_data_scene(C);
-	View3D *v3d= CTX_wm_view3d(C);
-	ARegion *ar= CTX_wm_region(C);
+	Scene *scene = CTX_data_scene(C);
+	View3D *v3d = CTX_wm_view3d(C);
+	ARegion *ar = CTX_wm_region(C);
 	float location[3];
 
 	view3d_operator_needs_opengl(C);
 
-	if(!ED_view3d_autodist(scene, ar, v3d, event->mval, location))
+	if (!ED_view3d_autodist(scene, ar, v3d, event->mval, location))
 		return OPERATOR_CANCELLED;
 
 	RNA_float_set_array(op->ptr, "location", location);
@@ -5467,16 +5521,16 @@ static int set_clone_cursor_invoke(bContext *C, wmOperator *op, wmEvent *event)
 void PAINT_OT_clone_cursor_set(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Clone Cursor";
-	ot->idname= "PAINT_OT_clone_cursor_set";
+	ot->name = "Set Clone Cursor";
+	ot->idname = "PAINT_OT_clone_cursor_set";
 	
 	/* api callbacks */
-	ot->exec= set_clone_cursor_exec;
-	ot->invoke= set_clone_cursor_invoke;
-	ot->poll= image_paint_3d_poll;
+	ot->exec = set_clone_cursor_exec;
+	ot->invoke = set_clone_cursor_invoke;
+	ot->poll = image_paint_3d_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_float_vector(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in world space coordinates", -10000.0f, 10000.0f);
@@ -5486,9 +5540,9 @@ void PAINT_OT_clone_cursor_set(wmOperatorType *ot)
 
 static int texture_paint_toggle_poll(bContext *C)
 {
-	if(CTX_data_edit_object(C))
+	if (CTX_data_edit_object(C))
 		return 0;
-	if(CTX_data_active_object(C)==NULL)
+	if (CTX_data_active_object(C) == NULL)
 		return 0;
 
 	return 1;
@@ -5496,11 +5550,11 @@ static int texture_paint_toggle_poll(bContext *C)
 
 static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Object *ob= CTX_data_active_object(C);
-	Mesh *me= NULL;
+	Scene *scene = CTX_data_scene(C);
+	Object *ob = CTX_data_active_object(C);
+	Mesh *me = NULL;
 	
-	if(ob==NULL)
+	if (ob == NULL)
 		return OPERATOR_CANCELLED;
 	
 	if (object_data_is_libdata(ob)) {
@@ -5508,17 +5562,17 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
 		return OPERATOR_CANCELLED;
 	}
 
-	me= get_mesh(ob);
+	me = get_mesh(ob);
 
-	if(!(ob->mode & OB_MODE_TEXTURE_PAINT) && !me) {
+	if (!(ob->mode & OB_MODE_TEXTURE_PAINT) && !me) {
 		BKE_report(op->reports, RPT_ERROR, "Can only enter texture paint mode for mesh objects");
 		return OPERATOR_CANCELLED;
 	}
 
-	if(ob->mode & OB_MODE_TEXTURE_PAINT) {
+	if (ob->mode & OB_MODE_TEXTURE_PAINT) {
 		ob->mode &= ~OB_MODE_TEXTURE_PAINT;
 
-		if(U.glreslimit != 0)
+		if (U.glreslimit != 0)
 			GPU_free_images();
 		GPU_paint_set_mipmap(1);
 
@@ -5527,13 +5581,13 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
 	else {
 		ob->mode |= OB_MODE_TEXTURE_PAINT;
 
-		if(me->mtface==NULL)
-			me->mtface= CustomData_add_layer(&me->fdata, CD_MTFACE, CD_DEFAULT,
-							 NULL, me->totface);
+		if (me->mtface == NULL)
+			me->mtface = CustomData_add_layer(&me->fdata, CD_MTFACE, CD_DEFAULT,
+			                                  NULL, me->totface);
 
 		paint_init(&scene->toolsettings->imapaint.paint, PAINT_CURSOR_TEXTURE_PAINT);
 
-		if(U.glreslimit != 0)
+		if (U.glreslimit != 0)
 			GPU_free_images();
 		GPU_paint_set_mipmap(0);
 
@@ -5541,7 +5595,7 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
 	}
 
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
-	WM_event_add_notifier(C, NC_SCENE|ND_MODE, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene);
 
 	return OPERATOR_FINISHED;
 }
@@ -5549,21 +5603,21 @@ static int texture_paint_toggle_exec(bContext *C, wmOperator *op)
 void PAINT_OT_texture_paint_toggle(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Texture Paint Toggle";
-	ot->idname= "PAINT_OT_texture_paint_toggle";
+	ot->name = "Texture Paint Toggle";
+	ot->idname = "PAINT_OT_texture_paint_toggle";
 	
 	/* api callbacks */
-	ot->exec= texture_paint_toggle_exec;
-	ot->poll= texture_paint_toggle_poll;
+	ot->exec = texture_paint_toggle_exec;
+	ot->poll = texture_paint_toggle_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 static int texture_paint_poll(bContext *C)
 {
-	if(texture_paint_toggle_poll(C))
-		if(CTX_data_active_object(C)->mode & OB_MODE_TEXTURE_PAINT)
+	if (texture_paint_toggle_poll(C))
+		if (CTX_data_active_object(C)->mode & OB_MODE_TEXTURE_PAINT)
 			return 1;
 	
 	return 0;
@@ -5596,93 +5650,93 @@ int mask_paint_poll(bContext *C)
 /* use project paint to re-apply an image */
 static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
 {
-	Image *image= BLI_findlink(&CTX_data_main(C)->image, RNA_enum_get(op->ptr, "image"));
-	Scene *scene= CTX_data_scene(C);
-	ProjPaintState ps= {NULL};
+	Image *image = BLI_findlink(&CTX_data_main(C)->image, RNA_enum_get(op->ptr, "image"));
+	Scene *scene = CTX_data_scene(C);
+	ProjPaintState ps = {NULL};
 	int orig_brush_size;
 	IDProperty *idgroup;
-	IDProperty *view_data= NULL;
+	IDProperty *view_data = NULL;
 
 	project_state_init(C, OBACT, &ps);
 
-	if(ps.ob==NULL || ps.ob->type != OB_MESH) {
+	if (ps.ob == NULL || ps.ob->type != OB_MESH) {
 		BKE_report(op->reports, RPT_ERROR, "No active mesh object");
 		return OPERATOR_CANCELLED;
 	}
 
-	if(image==NULL) {
+	if (image == NULL) {
 		BKE_report(op->reports, RPT_ERROR, "Image could not be found");
 		return OPERATOR_CANCELLED;
 	}
 
-	ps.reproject_image= image;
-	ps.reproject_ibuf= BKE_image_get_ibuf(image, NULL);
+	ps.reproject_image = image;
+	ps.reproject_ibuf = BKE_image_get_ibuf(image, NULL);
 
-	if(ps.reproject_ibuf==NULL || ps.reproject_ibuf->rect==NULL) {
+	if (ps.reproject_ibuf == NULL || ps.reproject_ibuf->rect == NULL) {
 		BKE_report(op->reports, RPT_ERROR, "Image data could not be found");
 		return OPERATOR_CANCELLED;
 	}
 
-	idgroup= IDP_GetProperties(&image->id, 0);
+	idgroup = IDP_GetProperties(&image->id, 0);
 
-	if(idgroup) {
-		view_data= IDP_GetPropertyTypeFromGroup(idgroup, PROJ_VIEW_DATA_ID, IDP_ARRAY);
+	if (idgroup) {
+		view_data = IDP_GetPropertyTypeFromGroup(idgroup, PROJ_VIEW_DATA_ID, IDP_ARRAY);
 
 		/* type check to make sure its ok */
-		if(view_data->len != PROJ_VIEW_DATA_SIZE || view_data->subtype != IDP_FLOAT) {
+		if (view_data->len != PROJ_VIEW_DATA_SIZE || view_data->subtype != IDP_FLOAT) {
 			BKE_report(op->reports, RPT_ERROR, "Image project data invalid");
 			return OPERATOR_CANCELLED;
 		}
 	}
 
-	if(view_data) {
+	if (view_data) {
 		/* image has stored view projection info */
-		ps.source= PROJ_SRC_IMAGE_VIEW;
+		ps.source = PROJ_SRC_IMAGE_VIEW;
 	}
 	else {
-		ps.source= PROJ_SRC_IMAGE_CAM;
+		ps.source = PROJ_SRC_IMAGE_CAM;
 
-		if(scene->camera==NULL) {
+		if (scene->camera == NULL) {
 			BKE_report(op->reports, RPT_ERROR, "No active camera set");
 			return OPERATOR_CANCELLED;
 		}
 	}
 
 	/* override */
-	ps.is_texbrush= 0;
-	ps.is_airbrush= 1;
-	orig_brush_size= brush_size(scene, ps.brush);
+	ps.is_texbrush = 0;
+	ps.is_airbrush = 1;
+	orig_brush_size = brush_size(scene, ps.brush);
 	brush_set_size(scene, ps.brush, 32); /* cover the whole image */
 
-	ps.tool= PAINT_TOOL_DRAW; /* so pixels are initialized with minimal info */
+	ps.tool = PAINT_TOOL_DRAW; /* so pixels are initialized with minimal info */
 
 	scene->toolsettings->imapaint.flag |= IMAGEPAINT_DRAWING;
 
 	undo_paint_push_begin(UNDO_PAINT_IMAGE, op->type->name,
-		image_undo_restore, image_undo_free);
+	                      image_undo_restore, image_undo_free);
 
 	/* allocate and initialize spacial data structures */
 	project_paint_begin(&ps);
 
-	if(ps.dm==NULL) {
+	if (ps.dm == NULL) {
 		brush_set_size(scene, ps.brush, orig_brush_size);
 		return OPERATOR_CANCELLED;
 	}
 	else {
-		float pos[2]= {0.0, 0.0};
-		float lastpos[2]= {0.0, 0.0};
+		float pos[2] = {0.0, 0.0};
+		float lastpos[2] = {0.0, 0.0};
 		int a;
 
-		for (a=0; a < ps.image_tot; a++)
+		for (a = 0; a < ps.image_tot; a++)
 			partial_redraw_array_init(ps.projImages[a].partRedrawRect);
 
 		project_paint_op(&ps, NULL, lastpos, pos);
 
 		project_image_refresh_tagged(&ps);
 
-		for (a=0; a < ps.image_tot; a++) {
+		for (a = 0; a < ps.image_tot; a++) {
 			GPU_free_image(ps.projImages[a].ima);
-			WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, ps.projImages[a].ima);
+			WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ps.projImages[a].ima);
 		}
 	}
 
@@ -5699,20 +5753,20 @@ void PAINT_OT_project_image(wmOperatorType *ot)
 	PropertyRNA *prop;
 
 	/* identifiers */
-	ot->name= "Project Image";
-	ot->idname= "PAINT_OT_project_image";
-	ot->description= "Project an edited render from the active camera back onto the object";
+	ot->name = "Project Image";
+	ot->idname = "PAINT_OT_project_image";
+	ot->description = "Project an edited render from the active camera back onto the object";
 
 	/* api callbacks */
-	ot->invoke= WM_enum_search_invoke;
-	ot->exec= texture_paint_camera_project_exec;
+	ot->invoke = WM_enum_search_invoke;
+	ot->exec = texture_paint_camera_project_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-	prop= RNA_def_enum(ot->srna, "image", DummyRNA_NULL_items, 0, "Image", "");
+	prop = RNA_def_enum(ot->srna, "image", DummyRNA_NULL_items, 0, "Image", "");
 	RNA_def_enum_funcs(prop, RNA_image_itemf);
-	ot->prop= prop;
+	ot->prop = prop;
 }
 
 static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
@@ -5721,38 +5775,38 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
 	ImBuf *ibuf;
 	char filename[FILE_MAX];
 
-	Scene *scene= CTX_data_scene(C);
-	ToolSettings *settings= scene->toolsettings;
-	int w= settings->imapaint.screen_grab_size[0];
-	int h= settings->imapaint.screen_grab_size[1];
+	Scene *scene = CTX_data_scene(C);
+	ToolSettings *settings = scene->toolsettings;
+	int w = settings->imapaint.screen_grab_size[0];
+	int h = settings->imapaint.screen_grab_size[1];
 	int maxsize;
-	char err_out[256]= "unknown";
+	char err_out[256] = "unknown";
 
 	RNA_string_get(op->ptr, "filepath", filename);
 
 	glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxsize);
 
-	if(w > maxsize) w= maxsize;
-	if(h > maxsize) h= maxsize;
+	if (w > maxsize) w = maxsize;
+	if (h > maxsize) h = maxsize;
 
-	ibuf= ED_view3d_draw_offscreen_imbuf(CTX_data_scene(C), CTX_wm_view3d(C), CTX_wm_region(C), w, h, IB_rect, err_out);
-	if(!ibuf) {
+	ibuf = ED_view3d_draw_offscreen_imbuf(CTX_data_scene(C), CTX_wm_view3d(C), CTX_wm_region(C), w, h, IB_rect, FALSE, err_out);
+	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);
 		return OPERATOR_CANCELLED;
 	}
 
-	image= BKE_add_image_imbuf(ibuf);
+	image = BKE_add_image_imbuf(ibuf);
 
-	if(image) {
+	if (image) {
 		/* now for the trickyness. store the view projection here!
-		 * reprojection will reuse this */
-		View3D *v3d= CTX_wm_view3d(C);
-		RegionView3D *rv3d= CTX_wm_region_view3d(C);
+		 * re-projection will reuse this */
+		View3D *v3d = CTX_wm_view3d(C);
+		RegionView3D *rv3d = CTX_wm_region_view3d(C);
 
 		IDPropertyTemplate val;
-		IDProperty *idgroup= IDP_GetProperties(&image->id, 1);
+		IDProperty *idgroup = IDP_GetProperties(&image->id, 1);
 		IDProperty *view_data;
 		int orth;
 		float *array;
@@ -5761,11 +5815,11 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
 		val.array.type = IDP_FLOAT;
 		view_data = IDP_New(IDP_ARRAY, &val, PROJ_VIEW_DATA_ID);
 
-		array= (float *)IDP_Array(view_data);
-		memcpy(array, rv3d->winmat, sizeof(rv3d->winmat)); array += sizeof(rv3d->winmat)/sizeof(float);
-		memcpy(array, rv3d->viewmat, sizeof(rv3d->viewmat)); array += sizeof(rv3d->viewmat)/sizeof(float);
-		orth= project_paint_view_clip(v3d, rv3d, &array[0], &array[1]);
-		array[2]= orth ? 1.0f : 0.0f; /* using float for a bool is dodgy but since its an extra member in the array... easier then adding a single bool prop */
+		array = (float *)IDP_Array(view_data);
+		memcpy(array, rv3d->winmat, sizeof(rv3d->winmat)); array += sizeof(rv3d->winmat) / sizeof(float);
+		memcpy(array, rv3d->viewmat, sizeof(rv3d->viewmat)); array += sizeof(rv3d->viewmat) / sizeof(float);
+		orth = project_paint_view_clip(v3d, rv3d, &array[0], &array[1]);
+		array[2] = orth ? 1.0f : 0.0f; /* using float for a bool is dodgy but since its an extra member in the array... easier then adding a single bool prop */
 
 		IDP_AddToGroup(idgroup, view_data);
 
@@ -5778,16 +5832,16 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
 void PAINT_OT_image_from_view(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Image from View";
-	ot->idname= "PAINT_OT_image_from_view";
-	ot->description= "Make an image from the current 3D view for re-projection";
+	ot->name = "Image from View";
+	ot->idname = "PAINT_OT_image_from_view";
+	ot->description = "Make an image from the current 3D view for re-projection";
 
 	/* api callbacks */
-	ot->exec= texture_paint_image_from_view_exec;
-	ot->poll= ED_operator_region_view3d_active;
+	ot->exec = texture_paint_image_from_view_exec;
+	ot->poll = ED_operator_region_view3d_active;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER;
+	ot->flag = OPTYPE_REGISTER;
 
 	RNA_def_string_file_name(ot->srna, "filepath", "", FILE_MAX, "File Path", "Name of the file");
 }
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h
index 73dc1e2..200fd8e 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -29,8 +29,8 @@
  */
 
 
-#ifndef ED_PAINT_INTERN_H
-#define ED_PAINT_INTERN_H
+#ifndef __PAINT_INTERN_H__
+#define __PAINT_INTERN_H__
 
 struct ARegion;
 struct bContext;
@@ -111,8 +111,8 @@ void SCULPT_OT_uv_sculpt_stroke(struct wmOperatorType *ot);
 /* paint_utils.c */
 
 /* Convert the object-space axis-aligned bounding box (expressed as
-   its minimum and maximum corners) into a screen-space rectangle,
-   returns zero if the result is empty */
+ * its minimum and maximum corners) into a screen-space rectangle,
+ * returns zero if the result is empty */
 int paint_convert_bb_to_rect(struct rcti *rect,
 							 const float bb_min[3],
 							 const float bb_max[3],
@@ -121,8 +121,8 @@ int paint_convert_bb_to_rect(struct rcti *rect,
 							 struct Object *ob);
 
 /* Get four planes in object-space that describe the projection of
-   screen_rect from screen into object-space (essentially converting a
-   2D screens-space bounding box into four 3D planes) */
+ * screen_rect from screen into object-space (essentially converting a
+ * 2D screens-space bounding box into four 3D planes) */
 void paint_calc_redraw_planes(float planes[4][4],
 							  const struct ARegion *ar,
 							  struct RegionView3D *rv3d,
@@ -132,7 +132,7 @@ void paint_calc_redraw_planes(float planes[4][4],
 void projectf(struct bglMats *mats, const float v[3], float p[2]);
 float paint_calc_object_space_radius(struct ViewContext *vc, const float center[3], float pixel_radius);
 float paint_get_tex_pixel(struct Brush* br, float u, float v);
-int imapaint_pick_face(struct ViewContext *vc, struct Mesh *me, const int mval[2], unsigned int *index);
+int imapaint_pick_face(struct ViewContext *vc, const int mval[2], unsigned int *index, unsigned int totface);
 void imapaint_pick_uv(struct Scene *scene, struct Object *ob, unsigned int faceindex, const int xy[2], float uv[2]);
 
 void paint_sample_color(struct Scene *scene, struct ARegion *ar, int x, int y);
@@ -168,5 +168,19 @@ struct ListBase *undo_paint_push_get_list(int type);
 void undo_paint_push_count_alloc(int type, int size);
 void undo_paint_push_end(int type);
 
-#endif /* ED_PAINT_INTERN_H */
+/* paint_hide.c */
 
+typedef enum {
+	PARTIALVIS_HIDE,
+	PARTIALVIS_SHOW
+} PartialVisAction;
+
+typedef enum {
+	PARTIALVIS_INSIDE,
+	PARTIALVIS_OUTSIDE,
+	PARTIALVIS_ALL
+} PartialVisArea;
+
+void PAINT_OT_hide_show(struct wmOperatorType *ot);
+
+#endif /* __PAINT_INTERN_H__ */
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 757f501..b5d6f20 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -75,31 +75,31 @@ static int brush_add_exec(bContext *C, wmOperator *UNUSED(op))
 static void BRUSH_OT_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Brush";
-	ot->description= "Add brush by mode type";
-	ot->idname= "BRUSH_OT_add";
+	ot->name = "Add Brush";
+	ot->description = "Add brush by mode type";
+	ot->idname = "BRUSH_OT_add";
 	
 	/* api callbacks */
-	ot->exec= brush_add_exec;
+	ot->exec = brush_add_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 
 static int brush_scale_size_exec(bContext *C, wmOperator *op)
 {
 	Scene *scene = CTX_data_scene(C);
-	Paint  *paint=  paint_get_active(scene);
-	struct Brush  *brush=  paint_brush(paint);
+	Paint  *paint =  paint_get_active(scene);
+	struct Brush  *brush =  paint_brush(paint);
 	// Object *ob=     CTX_data_active_object(C);
-	float   scalar= RNA_float_get(op->ptr, "scalar");
+	float scalar = RNA_float_get(op->ptr, "scalar");
 
 	if (brush) {
 		// pixel radius
 		{
-			const int old_size= brush_size(scene, brush);
-			int size= (int)(scalar*old_size);
+			const int old_size = brush_size(scene, brush);
+			int size = (int)(scalar * old_size);
 
 			if (old_size == size) {
 				if (scalar > 1) {
@@ -116,10 +116,10 @@ static int brush_scale_size_exec(bContext *C, wmOperator *op)
 
 		// unprojected radius
 		{
-			float unprojected_radius= scalar*brush_unprojected_radius(scene, brush);
+			float unprojected_radius = scalar * brush_unprojected_radius(scene, brush);
 
 			if (unprojected_radius < 0.001f) // XXX magic number
-				unprojected_radius= 0.001f;
+				unprojected_radius = 0.001f;
 
 			brush_set_unprojected_radius(scene, brush, unprojected_radius);
 		}
@@ -131,15 +131,15 @@ static int brush_scale_size_exec(bContext *C, wmOperator *op)
 static void BRUSH_OT_scale_size(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Scale Sculpt/Paint Brush Size";
-	ot->description= "Change brush size by a scalar";
-	ot->idname= "BRUSH_OT_scale_size";
+	ot->name = "Scale Sculpt/Paint Brush Size";
+	ot->description = "Change brush size by a scalar";
+	ot->idname = "BRUSH_OT_scale_size";
 	
 	/* api callbacks */
-	ot->exec= brush_scale_size_exec;
+	ot->exec = brush_scale_size_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	RNA_def_float(ot->srna, "scalar", 1, 0, 2, "Scalar", "Factor to scale brush size by", 0, 2);
 }
@@ -158,15 +158,15 @@ static int vertex_color_set_exec(bContext *C, wmOperator *UNUSED(op))
 static void PAINT_OT_vertex_color_set(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Vertex Colors";
-	ot->idname= "PAINT_OT_vertex_color_set";
+	ot->name = "Set Vertex Colors";
+	ot->idname = "PAINT_OT_vertex_color_set";
 	
 	/* api callbacks */
-	ot->exec= vertex_color_set_exec;
-	ot->poll= vertex_paint_mode_poll;
+	ot->exec = vertex_color_set_exec;
+	ot->poll = vertex_paint_mode_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 static int brush_reset_exec(bContext *C, wmOperator *UNUSED(op))
@@ -175,9 +175,9 @@ static int brush_reset_exec(bContext *C, wmOperator *UNUSED(op))
 	struct Brush *brush = paint_brush(paint);
 	Object *ob = CTX_data_active_object(C);
 
-	if(!ob) return OPERATOR_CANCELLED;
+	if (!ob) return OPERATOR_CANCELLED;
 
-	if(ob->mode & OB_MODE_SCULPT)
+	if (ob->mode & OB_MODE_SCULPT)
 		brush_reset_sculpt(brush);
 	/* TODO: other modes */
 
@@ -187,15 +187,20 @@ static int brush_reset_exec(bContext *C, wmOperator *UNUSED(op))
 static void BRUSH_OT_reset(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Reset Brush";
-	ot->description= "Return brush to defaults based on current tool";
-	ot->idname= "BRUSH_OT_reset";
+	ot->name = "Reset Brush";
+	ot->description = "Return brush to defaults based on current tool";
+	ot->idname = "BRUSH_OT_reset";
 	
 	/* api callbacks */
-	ot->exec= brush_reset_exec;
+	ot->exec = brush_reset_exec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+static int brush_tool(const Brush *brush, size_t tool_offset)
+{
+	return *(((char *)brush) + tool_offset);
 }
 
 /* generic functions for setting the active brush based on the tool */
@@ -203,35 +208,33 @@ static Brush *brush_tool_cycle(Main *bmain, Brush *brush_orig, const int tool, c
 {
 	struct Brush *brush;
 
-	if(!brush_orig && !(brush_orig= bmain->brush.first)) {
+	if (!brush_orig && !(brush_orig = bmain->brush.first)) {
 		return NULL;
 	}
 
 	/* get the next brush with the active tool */
-	for(	brush= brush_orig->id.next ? brush_orig->id.next : bmain->brush.first;
-			brush != brush_orig;
-			brush= brush->id.next ? brush->id.next : bmain->brush.first)
+	for (brush = brush_orig->id.next ? brush_orig->id.next : bmain->brush.first;
+	     brush != brush_orig;
+	     brush = brush->id.next ? brush->id.next : bmain->brush.first)
 	{
-		if(	(brush->ob_mode & ob_mode) &&
-			(*(((char *)brush) + tool_offset) == tool)
-		) {
+		if ((brush->ob_mode & ob_mode) &&
+		    (brush_tool(brush, tool_offset) == tool)) {
 			return brush;
 		}
 	}
 
 	return NULL;
-
 }
 
 static int brush_generic_tool_set(Main *bmain, Paint *paint, const int tool, const size_t tool_offset, const int ob_mode)
 {
-	struct Brush *brush, *brush_orig= paint_brush(paint);
+	struct Brush *brush, *brush_orig = paint_brush(paint);
 
-	brush= brush_tool_cycle(bmain, brush_orig, tool, tool_offset, ob_mode);
+	brush = brush_tool_cycle(bmain, brush_orig, tool, tool_offset, ob_mode);
 
-	if(brush) {
+	if (brush) {
 		paint_brush_set(paint, brush);
-		WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
+		WM_main_add_notifier(NC_BRUSH | NA_EDITED, brush);
 		return OPERATOR_FINISHED;
 	}
 	else {
@@ -239,116 +242,129 @@ static int brush_generic_tool_set(Main *bmain, Paint *paint, const int tool, con
 	}
 }
 
-static int brush_sculpt_tool_set_exec(bContext *C, wmOperator *op)
-{
-	Main *bmain= CTX_data_main(C);
-	Scene *scene= CTX_data_scene(C);
-
-	return brush_generic_tool_set(bmain, &scene->toolsettings->sculpt->paint, RNA_enum_get(op->ptr, "tool"), offsetof(Brush, sculpt_tool), OB_MODE_SCULPT);
-}
+/* used in the PAINT_OT_brush_select operator */
+#define OB_MODE_ACTIVE 0
 
-static void BRUSH_OT_sculpt_tool_set(wmOperatorType *ot)
+static int brush_select_exec(bContext *C, wmOperator *op)
 {
-	/* identifiers */
-	ot->name= "Sculpt Tool Set";
-	ot->description= "Set the sculpt tool";
-	ot->idname= "BRUSH_OT_sculpt_tool_set";
-
-	/* api callbacks */
-	ot->exec= brush_sculpt_tool_set_exec;
-
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
-	/* props */
-	ot->prop= RNA_def_enum(ot->srna, "tool", brush_sculpt_tool_items, 0, "Tool", "");
-}
-
-static int brush_vertex_tool_set_exec(bContext *C, wmOperator *op)
-{
-	Main *bmain= CTX_data_main(C);
-	Scene *scene= CTX_data_scene(C);
-
-	return brush_generic_tool_set(bmain, &scene->toolsettings->vpaint->paint, RNA_enum_get(op->ptr, "tool"), offsetof(Brush, vertexpaint_tool), OB_MODE_VERTEX_PAINT);
-}
-
-static void BRUSH_OT_vertex_tool_set(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Vertex Paint Tool Set";
-	ot->description= "Set the vertex paint tool";
-	ot->idname= "BRUSH_OT_vertex_tool_set";
-
-	/* api callbacks */
-	ot->exec= brush_vertex_tool_set_exec;
+	Main *bmain = CTX_data_main(C);
+	ToolSettings *toolsettings = CTX_data_tool_settings(C);
+	Paint *paint = NULL;
+	int tool, paint_mode = RNA_enum_get(op->ptr, "paint_mode");
+	size_t tool_offset;
+
+	if (paint_mode == OB_MODE_ACTIVE) {
+		Object *ob = CTX_data_active_object(C);
+		if (ob) {
+			/* select current paint mode */
+			paint_mode = ob->mode &
+			             (OB_MODE_SCULPT |
+			              OB_MODE_VERTEX_PAINT |
+			              OB_MODE_WEIGHT_PAINT |
+			              OB_MODE_TEXTURE_PAINT);
+		}
+		else {
+			return OPERATOR_CANCELLED;
+		}
+	}
 
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	switch (paint_mode) {
+		case OB_MODE_SCULPT:
+			paint = &toolsettings->sculpt->paint;
+			tool_offset = offsetof(Brush, sculpt_tool);
+			tool = RNA_enum_get(op->ptr, "sculpt_tool");
+			break;
+		case OB_MODE_VERTEX_PAINT:
+			paint = &toolsettings->vpaint->paint;
+			tool_offset = offsetof(Brush, vertexpaint_tool);
+			tool = RNA_enum_get(op->ptr, "vertex_paint_tool");
+			break;
+		case OB_MODE_WEIGHT_PAINT:
+			paint = &toolsettings->wpaint->paint;
+			/* vertexpaint_tool is used for weight paint mode */
+			tool_offset = offsetof(Brush, vertexpaint_tool);
+			tool = RNA_enum_get(op->ptr, "weight_paint_tool");
+			break;
+		case OB_MODE_TEXTURE_PAINT:
+			paint = &toolsettings->imapaint.paint;
+			tool_offset = offsetof(Brush, imagepaint_tool);
+			tool = RNA_enum_get(op->ptr, "texture_paint_tool");
+			break;
+		default:
+			/* invalid paint mode */
+			return OPERATOR_CANCELLED;
+	}
 
-	/* props */
-	ot->prop= RNA_def_enum(ot->srna, "tool", brush_vertex_tool_items, 0, "Tool", "");
+	return brush_generic_tool_set(bmain, paint, tool, tool_offset, paint_mode);
 }
 
-static int brush_weight_tool_set_exec(bContext *C, wmOperator *op)
+static void PAINT_OT_brush_select(wmOperatorType *ot)
 {
-	Main *bmain= CTX_data_main(C);
-	Scene *scene= CTX_data_scene(C);
-	/* vertexpaint_tool is used for weight paint mode */
-	return brush_generic_tool_set(bmain, &scene->toolsettings->wpaint->paint, RNA_enum_get(op->ptr, "tool"), offsetof(Brush, vertexpaint_tool), OB_MODE_WEIGHT_PAINT);
-}
+	static EnumPropertyItem paint_mode_items[] = {
+		{OB_MODE_ACTIVE, "ACTIVE", 0, "Current", "Set brush for active paint mode"},
+		{OB_MODE_SCULPT, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt", ""},
+		{OB_MODE_VERTEX_PAINT, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""},
+		{OB_MODE_WEIGHT_PAINT, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""},
+		{OB_MODE_TEXTURE_PAINT, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""},
+		{0, NULL, 0, NULL, NULL}
+	};
 
-static void BRUSH_OT_weight_tool_set(wmOperatorType *ot)
-{
 	/* identifiers */
-	ot->name= "Weight Paint Tool Set";
-	ot->description= "Set the weight paint tool";
-	ot->idname= "BRUSH_OT_weight_tool_set";
+	ot->name = "Brush Select";
+	ot->description = "Select a paint mode's brush by tool type";
+	ot->idname = "PAINT_OT_brush_select";
 
 	/* api callbacks */
-	ot->exec= brush_weight_tool_set_exec;
+	ot->exec = brush_select_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* props */
-	ot->prop= RNA_def_enum(ot->srna, "tool", brush_vertex_tool_items, 0, "Tool", "");
-}
-
-static int brush_image_tool_set_exec(bContext *C, wmOperator *op)
-{
-	Main *bmain= CTX_data_main(C);
-	Scene *scene= CTX_data_scene(C);
-
-	return brush_generic_tool_set(bmain, &scene->toolsettings->imapaint.paint, RNA_enum_get(op->ptr, "tool"), offsetof(Brush, imagepaint_tool), OB_MODE_TEXTURE_PAINT);
+	RNA_def_enum(ot->srna, "paint_mode", paint_mode_items, OB_MODE_ACTIVE, "Paint Mode", "");
+	RNA_def_enum(ot->srna, "sculpt_tool", brush_sculpt_tool_items, 0, "Sculpt Tool", "");
+	RNA_def_enum(ot->srna, "vertex_paint_tool", brush_vertex_tool_items, 0, "Vertex Paint Tool", "");
+	RNA_def_enum(ot->srna, "weight_paint_tool", brush_vertex_tool_items, 0, "Weight Paint Tool", "");
+	RNA_def_enum(ot->srna, "texture_paint_tool", brush_image_tool_items, 0, "Texture Paint Tool", "");
 }
 
-static void BRUSH_OT_image_tool_set(wmOperatorType *ot)
+static wmKeyMapItem *keymap_brush_select(wmKeyMap *keymap, int paint_mode,
+                                         int tool, int keymap_type,
+                                         int keymap_modifier)
 {
-	/* identifiers */
-	ot->name= "Image Paint Tool Set";
-	ot->description= "Set the image tool";
-	ot->idname= "BRUSH_OT_image_tool_set";
-
-	/* api callbacks */
-	ot->exec= brush_image_tool_set_exec;
+	wmKeyMapItem *kmi;
+	kmi = WM_keymap_add_item(keymap, "PAINT_OT_brush_select",
+	                         keymap_type, KM_PRESS, keymap_modifier, 0);
 
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	RNA_enum_set(kmi->ptr, "paint_mode", paint_mode);
+	
+	switch (paint_mode) {
+		case OB_MODE_SCULPT:
+			RNA_enum_set(kmi->ptr, "sculpt_tool", tool);
+			break;
+		case OB_MODE_VERTEX_PAINT:
+			RNA_enum_set(kmi->ptr, "vertex_paint_tool", tool);
+			break;
+		case OB_MODE_WEIGHT_PAINT:
+			RNA_enum_set(kmi->ptr, "weight_paint_tool", tool);
+			break;
+		case OB_MODE_TEXTURE_PAINT:
+			RNA_enum_set(kmi->ptr, "texture_paint_tool", tool);
+			break;
+	}
 
-	/* props */
-	ot->prop= RNA_def_enum(ot->srna, "tool", brush_image_tool_items, 0, "Tool", "");
+	return kmi;
 }
 
-
 static int brush_uv_sculpt_tool_set_exec(bContext *C, wmOperator *op)
 {
 	Brush *brush;
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	ToolSettings *ts = scene->toolsettings;
 	ts->uv_sculpt_tool = RNA_enum_get(op->ptr, "tool");
 	brush = ts->uvsculpt->paint.brush;
 	/* To update toolshelf */
-	WM_event_add_notifier(C, NC_BRUSH|NA_EDITED, brush);
+	WM_event_add_notifier(C, NC_BRUSH | NA_EDITED, brush);
 
 	return OPERATOR_FINISHED;
 }
@@ -384,10 +400,7 @@ void ED_operatortypes_paint(void)
 	WM_operatortype_append(BRUSH_OT_reset);
 
 	/* note, particle uses a different system, can be added with existing operators in wm.py */
-	WM_operatortype_append(BRUSH_OT_sculpt_tool_set);
-	WM_operatortype_append(BRUSH_OT_vertex_tool_set);
-	WM_operatortype_append(BRUSH_OT_weight_tool_set);
-	WM_operatortype_append(BRUSH_OT_image_tool_set);
+	WM_operatortype_append(PAINT_OT_brush_select);
 	WM_operatortype_append(BRUSH_OT_uv_sculpt_tool_set);
 
 	/* image */
@@ -426,6 +439,9 @@ void ED_operatortypes_paint(void)
 	WM_operatortype_append(PAINT_OT_face_select_inverse);
 	WM_operatortype_append(PAINT_OT_face_select_hide);
 	WM_operatortype_append(PAINT_OT_face_select_reveal);
+
+	/* partial visibility */
+	WM_operatortype_append(PAINT_OT_hide_show);
 }
 
 
@@ -435,8 +451,8 @@ static void ed_keymap_paint_brush_switch(wmKeyMap *keymap, const char *mode)
 	int i;
 	/* index 0-9 (zero key is tenth), shift key for index 10-19 */
 	for (i = 0; i < 20; i++) {
-		kmi= WM_keymap_add_item(keymap, "BRUSH_OT_active_index_set",
-		                        ZEROKEY + ((i + 1) % 10), KM_PRESS, i < 10 ? 0 : KM_SHIFT, 0);
+		kmi = WM_keymap_add_item(keymap, "BRUSH_OT_active_index_set",
+		                         ZEROKEY + ((i + 1) % 10), KM_PRESS, i < 10 ? 0 : KM_SHIFT, 0);
 		RNA_string_set(kmi->ptr, "mode", mode);
 		RNA_int_set(kmi->ptr, "index", i);
 	}
@@ -446,11 +462,11 @@ static void ed_keymap_paint_brush_size(wmKeyMap *keymap, const char *UNUSED(path
 {
 	wmKeyMapItem *kmi;
 
-	kmi= WM_keymap_add_item(keymap, "BRUSH_OT_scale_size", LEFTBRACKETKEY, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "BRUSH_OT_scale_size", LEFTBRACKETKEY, KM_PRESS, 0, 0);
 	RNA_float_set(kmi->ptr, "scalar", 0.9);
 
-	kmi= WM_keymap_add_item(keymap, "BRUSH_OT_scale_size", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
-	RNA_float_set(kmi->ptr, "scalar", 10.0/9.0); // 1.1111....
+	kmi = WM_keymap_add_item(keymap, "BRUSH_OT_scale_size", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
+	RNA_float_set(kmi->ptr, "scalar", 10.0 / 9.0); // 1.1111....
 }
 
 typedef enum {
@@ -460,7 +476,7 @@ typedef enum {
 } RCFlags;
 
 static void set_brush_rc_path(PointerRNA *ptr, const char *brush_path,
-							  const char *output_name, const char *input_name)
+                              const char *output_name, const char *input_name)
 {
 	char *path;
 
@@ -470,8 +486,8 @@ static void set_brush_rc_path(PointerRNA *ptr, const char *brush_path,
 }
 
 static void set_brush_rc_props(PointerRNA *ptr, const char *paint,
-							   const char *prop, const char *secondary_prop,
-							   RCFlags flags)
+                               const char *prop, const char *secondary_prop,
+                               RCFlags flags)
 {
 	const char *ups_path = "tool_settings.unified_paint_settings";
 	char *brush_path;
@@ -479,7 +495,7 @@ static void set_brush_rc_props(PointerRNA *ptr, const char *paint,
 	brush_path = BLI_sprintfN("tool_settings.%s.brush", paint);
 
 	set_brush_rc_path(ptr, brush_path, "data_path_primary", prop);
-	if(secondary_prop) {
+	if (secondary_prop) {
 		set_brush_rc_path(ptr, ups_path, "use_secondary", secondary_prop);
 		set_brush_rc_path(ptr, ups_path, "data_path_secondary", prop);
 	}
@@ -491,11 +507,11 @@ static void set_brush_rc_props(PointerRNA *ptr, const char *paint,
 	set_brush_rc_path(ptr, brush_path, "rotation_path", "texture_slot.angle");
 	RNA_string_set(ptr, "image_id", brush_path);
 
-	if(flags & RC_COLOR)
+	if (flags & RC_COLOR)
 		set_brush_rc_path(ptr, brush_path, "fill_color_path", "color");
 	else
 		RNA_string_set(ptr, "fill_color_path", "");
-	if(flags & RC_ZOOM)
+	if (flags & RC_ZOOM)
 		RNA_string_set(ptr, "zoom_path", "space_data.zoom");
 	else
 		RNA_string_set(ptr, "zoom_path", "");
@@ -504,7 +520,7 @@ static void set_brush_rc_props(PointerRNA *ptr, const char *paint,
 }
 
 static void ed_keymap_paint_brush_radial_control(wmKeyMap *keymap, const char *paint,
-						 RCFlags flags)
+                                                 RCFlags flags)
 {
 	wmKeyMapItem *kmi;
 
@@ -514,12 +530,28 @@ static void ed_keymap_paint_brush_radial_control(wmKeyMap *keymap, const char *p
 	kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, KM_SHIFT, 0);
 	set_brush_rc_props(kmi->ptr, paint, "strength", "use_unified_strength", flags);
 
-	if(flags & RC_ROTATION) {
+	if (flags & RC_ROTATION) {
 		kmi = WM_keymap_add_item(keymap, "WM_OT_radial_control", FKEY, KM_PRESS, KM_CTRL, 0);
 		set_brush_rc_props(kmi->ptr, paint, "texture_slot.angle", NULL, flags);
 	}
 }
 
+void paint_partial_visibility_keys(wmKeyMap *keymap)
+{
+	wmKeyMapItem *kmi;
+	
+	/* Partial visiblity */
+	kmi = WM_keymap_add_item(keymap, "PAINT_OT_hide_show", HKEY, KM_PRESS, KM_SHIFT, 0);
+	RNA_enum_set(kmi->ptr, "action", PARTIALVIS_SHOW);
+	RNA_enum_set(kmi->ptr, "area", PARTIALVIS_INSIDE);
+	kmi = WM_keymap_add_item(keymap, "PAINT_OT_hide_show", HKEY, KM_PRESS, 0, 0);
+	RNA_enum_set(kmi->ptr, "action", PARTIALVIS_HIDE);
+	RNA_enum_set(kmi->ptr, "area", PARTIALVIS_INSIDE);
+	kmi = WM_keymap_add_item(keymap, "PAINT_OT_hide_show", HKEY, KM_PRESS, KM_ALT, 0);
+	RNA_enum_set(kmi->ptr, "action", PARTIALVIS_SHOW);
+	RNA_enum_set(kmi->ptr, "area", PARTIALVIS_ALL);
+}
+
 void ED_keymap_paint(wmKeyConfig *keyconf)
 {
 	wmKeyMap *keymap;
@@ -527,22 +559,25 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
 	int i;
 	
 	/* Sculpt mode */
-	keymap= WM_keymap_find(keyconf, "Sculpt", 0, 0);
-	keymap->poll= sculpt_poll;
+	keymap = WM_keymap_find(keyconf, "Sculpt", 0, 0);
+	keymap->poll = sculpt_poll;
 
 	RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, 0,        0)->ptr, "mode", BRUSH_STROKE_NORMAL);
 	RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, KM_CTRL,  0)->ptr, "mode", BRUSH_STROKE_INVERT);
 	RNA_enum_set(WM_keymap_add_item(keymap, "SCULPT_OT_brush_stroke", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "mode", BRUSH_STROKE_SMOOTH);
 
-	for(i=0; i<=5; i++)
-		RNA_int_set(WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", ZEROKEY+i, KM_PRESS, KM_CTRL, 0)->ptr, "level", i);
+	/* Partial visibility, sculpt-only for now */
+	paint_partial_visibility_keys(keymap);
+
+	for (i = 0; i <= 5; i++)
+		RNA_int_set(WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", ZEROKEY + i, KM_PRESS, KM_CTRL, 0)->ptr, "level", i);
 
 	/* multires switch */
-	kmi= WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", PAGEUPKEY, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", PAGEUPKEY, KM_PRESS, 0, 0);
 	RNA_int_set(kmi->ptr, "level", 1);
 	RNA_boolean_set(kmi->ptr, "relative", TRUE);
 
-	kmi= WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", PAGEDOWNKEY, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "OBJECT_OT_subdivision_set", PAGEDOWNKEY, KM_PRESS, 0, 0);
 	RNA_int_set(kmi->ptr, "level", -1);
 	RNA_boolean_set(kmi->ptr, "relative", TRUE);
 
@@ -550,15 +585,15 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
 	ed_keymap_paint_brush_size(keymap, "tool_settings.sculpt.brush.size");
 	ed_keymap_paint_brush_radial_control(keymap, "sculpt", RC_ROTATION);
 
-	RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_sculpt_tool_set", DKEY, KM_PRESS, 0, 0)->ptr, "tool", SCULPT_TOOL_DRAW);
-	RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_sculpt_tool_set", SKEY, KM_PRESS, 0, 0)->ptr, "tool", SCULPT_TOOL_SMOOTH);
-	RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_sculpt_tool_set", PKEY, KM_PRESS, 0, 0)->ptr, "tool", SCULPT_TOOL_PINCH);
-	RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_sculpt_tool_set", IKEY, KM_PRESS, 0, 0)->ptr, "tool", SCULPT_TOOL_INFLATE);
-	RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_sculpt_tool_set", GKEY, KM_PRESS, 0, 0)->ptr, "tool", SCULPT_TOOL_GRAB);
-	RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_sculpt_tool_set", LKEY, KM_PRESS, 0, 0)->ptr, "tool", SCULPT_TOOL_LAYER);
-	RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_sculpt_tool_set", TKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "tool", SCULPT_TOOL_FLATTEN); /* was just TKEY in 2.4x */
-	RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_sculpt_tool_set", CKEY, KM_PRESS, 0, 0)->ptr, "tool", SCULPT_TOOL_CLAY);
-	RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_sculpt_tool_set", CKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "tool", SCULPT_TOOL_CREASE);
+	keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_DRAW, DKEY, 0);
+	keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_SMOOTH, SKEY, 0);
+	keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_PINCH, PKEY, 0);
+	keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_INFLATE, IKEY, 0);
+	keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_GRAB, GKEY, 0);
+	keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_LAYER, LKEY, 0);
+	keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_FLATTEN, TKEY, KM_SHIFT);
+	keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_CLAY, CKEY, 0);
+	keymap_brush_select(keymap, OB_MODE_SCULPT, SCULPT_TOOL_CREASE, CKEY, KM_SHIFT);
 
 	/* */
 	kmi = WM_keymap_add_item(keymap, "WM_OT_context_menu_enum", AKEY, KM_PRESS, 0, 0);
@@ -571,14 +606,14 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
 	RNA_string_set(kmi->ptr, "data_path", "tool_settings.sculpt.brush.texture_angle_source_random");
 
 	/* Vertex Paint mode */
-	keymap= WM_keymap_find(keyconf, "Vertex Paint", 0, 0);
-	keymap->poll= vertex_paint_mode_poll;
+	keymap = WM_keymap_find(keyconf, "Vertex Paint", 0, 0);
+	keymap->poll = vertex_paint_mode_poll;
 
 	WM_keymap_verify_item(keymap, "PAINT_OT_vertex_paint", LEFTMOUSE, KM_PRESS, 0, 0);
 	WM_keymap_add_item(keymap, "PAINT_OT_sample_color", RIGHTMOUSE, KM_PRESS, 0, 0);
 
 	WM_keymap_add_item(keymap,
-			"PAINT_OT_vertex_color_set",KKEY, KM_PRESS, KM_SHIFT, 0);
+	                   "PAINT_OT_vertex_color_set", KKEY, KM_PRESS, KM_SHIFT, 0);
 
 	ed_keymap_paint_brush_switch(keymap, "vertex_paint");
 	ed_keymap_paint_brush_size(keymap, "tool_settings.vertex_paint.brush.size");
@@ -588,8 +623,8 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
 	RNA_string_set(kmi->ptr, "data_path", "vertex_paint_object.data.use_paint_mask");
 
 	/* Weight Paint mode */
-	keymap= WM_keymap_find(keyconf, "Weight Paint", 0, 0);
-	keymap->poll= weight_paint_mode_poll;
+	keymap = WM_keymap_find(keyconf, "Weight Paint", 0, 0);
+	keymap->poll = weight_paint_mode_poll;
 
 	WM_keymap_verify_item(keymap, "PAINT_OT_weight_paint", LEFTMOUSE, KM_PRESS, 0, 0);
 
@@ -598,7 +633,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
 	WM_keymap_verify_item(keymap, "PAINT_OT_weight_sample_group", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0);
 
 	WM_keymap_add_item(keymap,
-			"PAINT_OT_weight_set", KKEY, KM_PRESS, KM_SHIFT, 0);
+	                   "PAINT_OT_weight_set", KKEY, KM_PRESS, KM_SHIFT, 0);
 
 	ed_keymap_paint_brush_switch(keymap, "weight_paint");
 	ed_keymap_paint_brush_size(keymap, "tool_settings.weight_paint.brush.size");
@@ -615,20 +650,20 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
 
 	
 	/*Weight paint's Vertex Selection Mode */
-	keymap= WM_keymap_find(keyconf, "Weight Paint Vertex Selection", 0, 0);
-	keymap->poll= vert_paint_poll;
+	keymap = WM_keymap_find(keyconf, "Weight Paint Vertex Selection", 0, 0);
+	keymap->poll = vert_paint_poll;
 	WM_keymap_add_item(keymap, "PAINT_OT_vert_select_all", AKEY, KM_PRESS, 0, 0);
 	WM_keymap_add_item(keymap, "PAINT_OT_vert_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0);
 	WM_keymap_add_item(keymap, "VIEW3D_OT_select_border", BKEY, KM_PRESS, 0, 0);
 	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL, 0);
 	RNA_boolean_set(kmi->ptr, "deselect", FALSE);
-	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_SHIFT|KM_CTRL, 0);
+	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_SHIFT | KM_CTRL, 0);
 	RNA_boolean_set(kmi->ptr, "deselect", TRUE);
 	WM_keymap_add_item(keymap, "VIEW3D_OT_select_circle", CKEY, KM_PRESS, 0, 0);
 
 	/* Image/Texture Paint mode */
-	keymap= WM_keymap_find(keyconf, "Image Paint", 0, 0);
-	keymap->poll= image_texture_paint_poll;
+	keymap = WM_keymap_find(keyconf, "Image Paint", 0, 0);
+	keymap->poll = image_texture_paint_poll;
 
 	WM_keymap_add_item(keymap, "PAINT_OT_image_paint", LEFTMOUSE, KM_PRESS, 0, 0);
 	WM_keymap_add_item(keymap, "PAINT_OT_grab_clone", RIGHTMOUSE, KM_PRESS, 0, 0);
@@ -637,14 +672,14 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
 
 	ed_keymap_paint_brush_switch(keymap, "image_paint");
 	ed_keymap_paint_brush_size(keymap, "tool_settings.image_paint.brush.size");
-	ed_keymap_paint_brush_radial_control(keymap, "image_paint", RC_COLOR|RC_ZOOM);
+	ed_keymap_paint_brush_radial_control(keymap, "image_paint", RC_COLOR | RC_ZOOM);
 
 	kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", MKEY, KM_PRESS, 0, 0); /* mask toggle */
 	RNA_string_set(kmi->ptr, "data_path", "image_paint_object.data.use_paint_mask");
 
 	/* face-mask mode */
-	keymap= WM_keymap_find(keyconf, "Face Mask", 0, 0);
-	keymap->poll= facemask_paint_poll;
+	keymap = WM_keymap_find(keyconf, "Face Mask", 0, 0);
+	keymap->poll = facemask_paint_poll;
 
 	WM_keymap_add_item(keymap, "PAINT_OT_face_select_all", AKEY, KM_PRESS, 0, 0);
 	WM_keymap_add_item(keymap, "PAINT_OT_face_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0);
@@ -657,8 +692,8 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
 	WM_keymap_add_item(keymap, "PAINT_OT_face_select_linked", LKEY, KM_PRESS, KM_CTRL, 0);
 	WM_keymap_add_item(keymap, "PAINT_OT_face_select_linked_pick", LKEY, KM_PRESS, 0, 0);
 
-	keymap= WM_keymap_find(keyconf, "UV Sculpt", 0, 0);
-	keymap->poll= uv_sculpt_poll;
+	keymap = WM_keymap_find(keyconf, "UV Sculpt", 0, 0);
+	keymap->poll = uv_sculpt_poll;
 
 	kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", QKEY, KM_PRESS, 0, 0);
 	RNA_string_set(kmi->ptr, "data_path", "tool_settings.use_uv_sculpt");
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index cd8262f..fb64034 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -73,8 +73,8 @@ typedef struct PaintStroke {
 	float last_mouse_position[2];
 
 	/* Set whether any stroke step has yet occurred
-	   e.g. in sculpt mode, stroke doesn't start until cursor
-	   passes over the mesh */
+	 * e.g. in sculpt mode, stroke doesn't start until cursor
+	 * passes over the mesh */
 	int stroke_started;
 	/* event that started stroke, for modal() return */
 	int event_type;
@@ -95,10 +95,10 @@ static void paint_draw_smooth_stroke(bContext *C, int x, int y, void *customdata
 	glEnable(GL_LINE_SMOOTH);
 	glEnable(GL_BLEND);
 
-	if(stroke && brush && (brush->flag & BRUSH_SMOOTH_STROKE)) {
+	if (stroke && brush && (brush->flag & BRUSH_SMOOTH_STROKE)) {
 		ARegion *ar = CTX_wm_region(C);
 		sdrawline(x, y, (int)stroke->last_mouse_position[0] - ar->winrct.xmin,
-			  (int)stroke->last_mouse_position[1] - ar->winrct.ymin);
+		          (int)stroke->last_mouse_position[1] - ar->winrct.ymin);
 	}
 
 	glDisable(GL_BLEND);
@@ -106,20 +106,20 @@ static void paint_draw_smooth_stroke(bContext *C, int x, int y, void *customdata
 }
 
 /* if this is a tablet event, return tablet pressure and set *pen_flip
-   to 1 if the eraser tool is being used, 0 otherwise */
+ * to 1 if the eraser tool is being used, 0 otherwise */
 static float event_tablet_data(wmEvent *event, int *pen_flip)
 {
 	int erasor = 0;
 	float pressure = 1;
 
-	if(event->custom == EVT_DATA_TABLET) {
-		wmTabletData *wmtab= event->customdata;
+	if (event->custom == EVT_DATA_TABLET) {
+		wmTabletData *wmtab = event->customdata;
 
 		erasor = (wmtab->Active == EVT_TABLET_ERASER);
 		pressure = (wmtab->Active != EVT_TABLET_NONE) ? wmtab->Pressure : 1;
 	}
 
-	if(pen_flip)
+	if (pen_flip)
 		(*pen_flip) = erasor;
 
 	return pressure;
@@ -142,16 +142,16 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *ev
 	pressure = event_tablet_data(event, &pen_flip);
 
 	/* TODO: as sculpt and other paint modes are unified, this
-	   separation will go away */
-	if(stroke->vc.obact->sculpt) {
+	 * separation will go away */
+	if (stroke->vc.obact->sculpt) {
 		float delta[2];
 
 		brush_jitter_pos(scene, brush, mouse_in, mouse);
 
 		/* XXX: meh, this is round about because
-		   brush_jitter_pos isn't written in the best way to
-		   be reused here */
-		if(brush->flag & BRUSH_JITTER_PRESSURE) {
+		 * brush_jitter_pos isn't written in the best way to
+		 * be reused here */
+		if (brush->flag & BRUSH_JITTER_PRESSURE) {
 			sub_v2_v2v2(delta, mouse, mouse_in);
 			mul_v2_fl(delta, pressure);
 			add_v2_v2v2(mouse, mouse_in, delta);
@@ -162,7 +162,7 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *ev
 	}
 
 	/* TODO: can remove the if statement once all modes have this */
-	if(stroke->get_location)
+	if (stroke->get_location)
 		stroke->get_location(C, location, mouse);
 	else
 		zero_v3(location);
@@ -196,8 +196,8 @@ static int paint_smooth_stroke(PaintStroke *stroke, float output[2], wmEvent *ev
 		float dx = stroke->last_mouse_position[0] - event->x, dy = stroke->last_mouse_position[1] - event->y;
 
 		/* If the mouse is moving within the radius of the last move,
-		   don't update the mouse position. This allows sharp turns. */
-		if(dx*dx + dy*dy < stroke->brush->smooth_stroke_radius * stroke->brush->smooth_stroke_radius)
+		 * don't update the mouse position. This allows sharp turns. */
+		if (dx * dx + dy * dy < stroke->brush->smooth_stroke_radius * stroke->brush->smooth_stroke_radius)
 			return 0;
 
 		output[0] = event->x * v + stroke->last_mouse_position[0] * u;
@@ -208,13 +208,13 @@ static int paint_smooth_stroke(PaintStroke *stroke, float output[2], wmEvent *ev
 }
 
 /* For brushes with stroke spacing enabled, moves mouse in steps
-   towards the final mouse location. */
+ * towards the final mouse location. */
 static int paint_space_stroke(bContext *C, wmOperator *op, wmEvent *event, const float final_mouse[2])
 {
 	PaintStroke *stroke = op->customdata;
 	int cnt = 0;
 
-	if(paint_space_stroke_enabled(stroke->brush)) {
+	if (paint_space_stroke_enabled(stroke->brush)) {
 		float mouse[2];
 		float vec[2];
 		float length, scale;
@@ -224,24 +224,24 @@ static int paint_space_stroke(bContext *C, wmOperator *op, wmEvent *event, const
 
 		length = len_v2(vec);
 
-		if(length > FLT_EPSILON) {
+		if (length > FLT_EPSILON) {
 			const Scene *scene = CTX_data_scene(C);
 			int steps;
 			int i;
-			float pressure= 1.0f;
+			float pressure = 1.0f;
 
 			/* XXX mysterious :) what has 'use size' do with this here... if you don't check for it, pressure fails */
-			if(brush_use_size_pressure(scene, stroke->brush))
+			if (brush_use_size_pressure(scene, stroke->brush))
 				pressure = event_tablet_data(event, NULL);
 			
-			if(pressure > FLT_EPSILON) {
-				scale = (brush_size(scene, stroke->brush)*pressure*stroke->brush->spacing/50.0f) / length;
-				if(scale > FLT_EPSILON) {
+			if (pressure > FLT_EPSILON) {
+				scale = (brush_size(scene, stroke->brush) * pressure * stroke->brush->spacing / 50.0f) / length;
+				if (scale > FLT_EPSILON) {
 					mul_v2_fl(vec, scale);
 
 					steps = (int)(1.0f / scale);
 
-					for(i = 0; i < steps; ++i, ++cnt) {
+					for (i = 0; i < steps; ++i, ++cnt) {
 						add_v2_v2(mouse, vec);
 						paint_brush_stroke_add_step(C, op, event, mouse);
 					}
@@ -256,10 +256,10 @@ static int paint_space_stroke(bContext *C, wmOperator *op, wmEvent *event, const
 /**** Public API ****/
 
 PaintStroke *paint_stroke_new(bContext *C,
-				  StrokeGetLocation get_location,
-				  StrokeTestStart test_start,
-				  StrokeUpdateStep update_step,
-				  StrokeDone done, int event_type)
+                              StrokeGetLocation get_location,
+                              StrokeTestStart test_start,
+                              StrokeUpdateStep update_step,
+                              StrokeDone done, int event_type)
 {
 	PaintStroke *stroke = MEM_callocN(sizeof(PaintStroke), "PaintStroke");
 
@@ -271,7 +271,7 @@ PaintStroke *paint_stroke_new(bContext *C,
 	stroke->test_start = test_start;
 	stroke->update_step = update_step;
 	stroke->done = done;
-	stroke->event_type= event_type;	/* for modal, return event */
+	stroke->event_type = event_type; /* for modal, return event */
 	
 	return stroke;
 }
@@ -293,7 +293,7 @@ int paint_stroke_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
 	PaintStroke *stroke = op->customdata;
 	float mouse[2];
-	int first= 0;
+	int first = 0;
 
 	// 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
@@ -302,43 +302,43 @@ int paint_stroke_modal(bContext *C, wmOperator *op, wmEvent *event)
 	if (event->type == NDOF_MOTION)
 		return OPERATOR_PASS_THROUGH;
 
-	if(!stroke->stroke_started) {
+	if (!stroke->stroke_started) {
 		stroke->last_mouse_position[0] = event->x;
 		stroke->last_mouse_position[1] = event->y;
 		stroke->stroke_started = stroke->test_start(C, op, event);
 
-		if(stroke->stroke_started) {
+		if (stroke->stroke_started) {
 			stroke->smooth_stroke_cursor =
-				WM_paint_cursor_activate(CTX_wm_manager(C), paint_poll, paint_draw_smooth_stroke, stroke);
+			    WM_paint_cursor_activate(CTX_wm_manager(C), paint_poll, paint_draw_smooth_stroke, stroke);
 
-			if(stroke->brush->flag & BRUSH_AIRBRUSH)
+			if (stroke->brush->flag & BRUSH_AIRBRUSH)
 				stroke->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, stroke->brush->rate);
 		}
 
-		first= 1;
+		first = 1;
 		//ED_region_tag_redraw(ar);
 	}
 
-	if(event->type == stroke->event_type && event->val == KM_RELEASE) {
+	if (event->type == stroke->event_type && event->val == KM_RELEASE) {
 		/* exit stroke, free data */
-		if(stroke->smooth_stroke_cursor)
+		if (stroke->smooth_stroke_cursor)
 			WM_paint_cursor_end(CTX_wm_manager(C), stroke->smooth_stroke_cursor);
 
-		if(stroke->timer)
+		if (stroke->timer)
 			WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), stroke->timer);
 
 		stroke->done(C, stroke);
 		MEM_freeN(stroke);
 		return OPERATOR_FINISHED;
 	}
-	else if( (first) ||
+	else if ((first) ||
 	         (ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) ||
 	         (event->type == TIMER && (event->customdata == stroke->timer)) )
 	{
-		if(stroke->stroke_started) {
-			if(paint_smooth_stroke(stroke, mouse, event)) {
-				if(paint_space_stroke_enabled(stroke->brush)) {
-					if(!paint_space_stroke(C, op, event, mouse)) {
+		if (stroke->stroke_started) {
+			if (paint_smooth_stroke(stroke, mouse, event)) {
+				if (paint_space_stroke_enabled(stroke->brush)) {
+					if (!paint_space_stroke(C, op, event, mouse)) {
 						//ED_region_tag_redraw(ar);
 					}
 				}
@@ -347,18 +347,18 @@ int paint_stroke_modal(bContext *C, wmOperator *op, wmEvent *event)
 				}
 			}
 			else {
-				;//ED_region_tag_redraw(ar);
+				; //ED_region_tag_redraw(ar);
 			}
 		}
 	}
 
 	/* we want the stroke to have the first daub at the start location
 	 * instead of waiting till we have moved the space distance */
-	if(first &&
-	   stroke->stroke_started &&
-	   paint_space_stroke_enabled(stroke->brush) &&
-	   !(stroke->brush->flag & BRUSH_ANCHORED) &&
-	   !(stroke->brush->flag & BRUSH_SMOOTH_STROKE))
+	if (first &&
+	    stroke->stroke_started &&
+	    paint_space_stroke_enabled(stroke->brush) &&
+	    !(stroke->brush->flag & BRUSH_ANCHORED) &&
+	    !(stroke->brush->flag & BRUSH_SMOOTH_STROKE))
 	{
 		paint_brush_stroke_add_step(C, op, event, mouse);
 	}
@@ -371,10 +371,10 @@ int paint_stroke_exec(bContext *C, wmOperator *op)
 	PaintStroke *stroke = op->customdata;
 
 	/* only when executed for the first time */
-	if(stroke->stroke_started == 0) {
+	if (stroke->stroke_started == 0) {
 		/* XXX stroke->last_mouse_position is unset, this may cause problems */
 		stroke->test_start(C, op, NULL);
-		stroke->stroke_started= 1;
+		stroke->stroke_started = 1;
 	}
 
 	RNA_BEGIN(op->ptr, itemptr, "stroke") {
@@ -394,7 +394,7 @@ int paint_stroke_cancel(bContext *C, wmOperator *op)
 {
 	PaintStroke *stroke = op->customdata;
 
-	if(stroke->done)
+	if (stroke->done)
 		stroke->done(C, stroke);
 
 	MEM_freeN(stroke);
@@ -424,6 +424,6 @@ int paint_poll(bContext *C)
 	Object *ob = CTX_data_active_object(C);
 
 	return p && ob && paint_brush(p) &&
-		CTX_wm_area(C)->spacetype == SPACE_VIEW3D &&
-		CTX_wm_region(C)->regiontype == RGN_TYPE_WINDOW;
+	       CTX_wm_area(C)->spacetype == SPACE_VIEW3D &&
+	       CTX_wm_region(C)->regiontype == RGN_TYPE_WINDOW;
 }
diff --git a/source/blender/editors/sculpt_paint/paint_undo.c b/source/blender/editors/sculpt_paint/paint_undo.c
index b009101..65bcfcb 100644
--- a/source/blender/editors/sculpt_paint/paint_undo.c
+++ b/source/blender/editors/sculpt_paint/paint_undo.c
@@ -45,7 +45,7 @@
 
 #include "paint_intern.h"
 
-#define MAXUNDONAME	64
+#define MAXUNDONAME 64
 
 typedef struct UndoElem {
 	struct UndoElem *next, *prev;
@@ -71,13 +71,13 @@ static UndoStack MeshUndoStack = {UNDO_PAINT_MESH, {NULL, NULL}, NULL};
 
 static void undo_restore(bContext *C, UndoStack *UNUSED(stack), UndoElem *uel)
 {
-	if(uel && uel->restore)
+	if (uel && uel->restore)
 		uel->restore(C, &uel->elems);
 }
 
 static void undo_elem_free(UndoStack *UNUSED(stack), UndoElem *uel)
 {
-	if(uel && uel->free) {
+	if (uel && uel->free) {
 		uel->free(&uel->elems);
 		BLI_freelistN(&uel->elems);
 	}
@@ -93,32 +93,32 @@ static void undo_stack_push_begin(UndoStack *stack, const char *name, UndoRestor
 	 * know how much memory the undo used to remove old undo elements */
 
 	/* remove all undos after (also when stack->current==NULL) */
-	while(stack->elems.last != stack->current) {
-		uel= stack->elems.last;
+	while (stack->elems.last != stack->current) {
+		uel = stack->elems.last;
 		undo_elem_free(stack, uel);
 		BLI_freelinkN(&stack->elems, uel);
 	}
 	
 	/* make new */
-	stack->current= uel= MEM_callocN(sizeof(UndoElem), "undo file");
-	uel->restore= restore;
-	uel->free= free;
+	stack->current = uel = MEM_callocN(sizeof(UndoElem), "undo file");
+	uel->restore = restore;
+	uel->free = free;
 	BLI_addtail(&stack->elems, uel);
 
 	/* name can be a dynamic string */
 	BLI_strncpy(uel->name, name, sizeof(uel->name));
 	
 	/* limit amount to the maximum amount*/
-	nr= 0;
-	uel= stack->elems.last;
-	while(uel) {
+	nr = 0;
+	uel = stack->elems.last;
+	while (uel) {
 		nr++;
-		if(nr==U.undosteps) break;
-		uel= uel->prev;
+		if (nr == U.undosteps) break;
+		uel = uel->prev;
 	}
-	if(uel) {
-		while(stack->elems.first!=uel) {
-			UndoElem *first= stack->elems.first;
+	if (uel) {
+		while (stack->elems.first != uel) {
+			UndoElem *first = stack->elems.first;
 			undo_elem_free(stack, first);
 			BLI_freelinkN(&stack->elems, first);
 		}
@@ -130,21 +130,21 @@ static void undo_stack_push_end(UndoStack *stack)
 	UndoElem *uel;
 	uintptr_t totmem, maxmem;
 
-	if(U.undomemory != 0) {
+	if (U.undomemory != 0) {
 		/* limit to maximum memory (afterwards, we can't know in advance) */
-		totmem= 0;
-		maxmem= ((uintptr_t)U.undomemory)*1024*1024;
-
-		uel= stack->elems.last;
-		while(uel) {
-			totmem+= uel->undosize;
-			if(totmem>maxmem) break;
-			uel= uel->prev;
+		totmem = 0;
+		maxmem = ((uintptr_t)U.undomemory) * 1024 * 1024;
+
+		uel = stack->elems.last;
+		while (uel) {
+			totmem += uel->undosize;
+			if (totmem > maxmem) break;
+			uel = uel->prev;
 		}
 
-		if(uel) {
-			while(stack->elems.first!=uel) {
-				UndoElem *first= stack->elems.first;
+		if (uel) {
+			while (stack->elems.first != uel) {
+				UndoElem *first = stack->elems.first;
 				undo_elem_free(stack, first);
 				BLI_freelinkN(&stack->elems, first);
 			}
@@ -156,25 +156,29 @@ static int undo_stack_step(bContext *C, UndoStack *stack, int step, const char *
 {
 	UndoElem *undo;
 
-	if(step==1) {
-		if(stack->current==NULL);
+	if (step == 1) {
+		if (stack->current == NULL) ;
 		else {
-			if(!name || strcmp(stack->current->name, name) == 0) {
-				if(G.f & G_DEBUG) printf("undo %s\n", stack->current->name);
+			if (!name || strcmp(stack->current->name, name) == 0) {
+				if (G.debug & G_DEBUG_WM) {
+					printf("%s: undo '%s'\n", __func__, stack->current->name);
+				}
 				undo_restore(C, stack, stack->current);
-				stack->current= stack->current->prev;
+				stack->current = stack->current->prev;
 				return 1;
 			}
 		}
 	}
-	else if(step==-1) {
-		if((stack->current!=NULL && stack->current->next==NULL) || stack->elems.first==NULL);
+	else if (step == -1) {
+		if ((stack->current != NULL && stack->current->next == NULL) || stack->elems.first == NULL) ;
 		else {
-			if(!name || strcmp(stack->current->name, name) == 0) {
-				undo= (stack->current && stack->current->next)? stack->current->next: stack->elems.first;
+			if (!name || strcmp(stack->current->name, name) == 0) {
+				undo = (stack->current && stack->current->next) ? stack->current->next : stack->elems.first;
 				undo_restore(C, stack, undo);
-				stack->current= undo;
-				if(G.f & G_DEBUG) printf("redo %s\n", undo->name);
+				stack->current = undo;
+				if (G.debug & G_DEBUG_WM) {
+					printf("%s: redo %s\n", __func__, undo->name);
+				}
 				return 1;
 			}
 		}
@@ -187,31 +191,31 @@ static void undo_stack_free(UndoStack *stack)
 {
 	UndoElem *uel;
 	
-	for(uel=stack->elems.first; uel; uel=uel->next)
+	for (uel = stack->elems.first; uel; uel = uel->next)
 		undo_elem_free(stack, uel);
 
 	BLI_freelistN(&stack->elems);
-	stack->current= NULL;
+	stack->current = NULL;
 }
 
 /* Exported Functions */
 
 void undo_paint_push_begin(int type, const char *name, UndoRestoreCb restore, UndoFreeCb free)
 {
-	if(type == UNDO_PAINT_IMAGE)
+	if (type == UNDO_PAINT_IMAGE)
 		undo_stack_push_begin(&ImageUndoStack, name, restore, free);
-	else if(type == UNDO_PAINT_MESH)
+	else if (type == UNDO_PAINT_MESH)
 		undo_stack_push_begin(&MeshUndoStack, name, restore, free);
 }
 
 ListBase *undo_paint_push_get_list(int type)
 {
-	if(type == UNDO_PAINT_IMAGE) {
-		if(ImageUndoStack.current)
+	if (type == UNDO_PAINT_IMAGE) {
+		if (ImageUndoStack.current)
 			return &ImageUndoStack.current->elems;
 	}
-	else if(type == UNDO_PAINT_MESH) {
-		if(MeshUndoStack.current)
+	else if (type == UNDO_PAINT_MESH) {
+		if (MeshUndoStack.current)
 			return &MeshUndoStack.current->elems;
 	}
 	
@@ -220,25 +224,25 @@ ListBase *undo_paint_push_get_list(int type)
 
 void undo_paint_push_count_alloc(int type, int size)
 {
-	if(type == UNDO_PAINT_IMAGE)
+	if (type == UNDO_PAINT_IMAGE)
 		ImageUndoStack.current->undosize += size;
-	else if(type == UNDO_PAINT_MESH)
+	else if (type == UNDO_PAINT_MESH)
 		MeshUndoStack.current->undosize += size;
 }
 
 void undo_paint_push_end(int type)
 {
-	if(type == UNDO_PAINT_IMAGE)
+	if (type == UNDO_PAINT_IMAGE)
 		undo_stack_push_end(&ImageUndoStack);
-	else if(type == UNDO_PAINT_MESH)
+	else if (type == UNDO_PAINT_MESH)
 		undo_stack_push_end(&MeshUndoStack);
 }
 
 int ED_undo_paint_step(bContext *C, int type, int step, const char *name)
 {
-	if(type == UNDO_PAINT_IMAGE)
+	if (type == UNDO_PAINT_IMAGE)
 		return undo_stack_step(C, &ImageUndoStack, step, name);
-	else if(type == UNDO_PAINT_MESH)
+	else if (type == UNDO_PAINT_MESH)
 		return undo_stack_step(C, &MeshUndoStack, step, name);
 	
 	return 0;
@@ -248,16 +252,16 @@ int ED_undo_paint_valid(int type, const char *name)
 {
 	UndoStack *stack;
 	
-	if(type == UNDO_PAINT_IMAGE)
-		stack= &ImageUndoStack;
-	else if(type == UNDO_PAINT_MESH)
-		stack= &MeshUndoStack;
+	if (type == UNDO_PAINT_IMAGE)
+		stack = &ImageUndoStack;
+	else if (type == UNDO_PAINT_MESH)
+		stack = &MeshUndoStack;
 	else 
 		return 0;
 	
-	if(stack->current==NULL);
+	if (stack->current == NULL) ;
 	else {
-		if(name && strcmp(stack->current->name, name) == 0)
+		if (name && strcmp(stack->current->name, name) == 0)
 			return 1;
 		else
 			return stack->elems.first != stack->elems.last;
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index 0705ea2..89a4627 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -68,14 +68,14 @@
 #include "paint_intern.h"
 
 /* Convert the object-space axis-aligned bounding box (expressed as
-   its minimum and maximum corners) into a screen-space rectangle,
-   returns zero if the result is empty */
+ * its minimum and maximum corners) into a screen-space rectangle,
+ * returns zero if the result is empty */
 int paint_convert_bb_to_rect(rcti *rect,
-							 const float bb_min[3],
-							 const float bb_max[3],
-							 const ARegion *ar,
-							 RegionView3D *rv3d,
-							 Object *ob)
+                             const float bb_min[3],
+                             const float bb_max[3],
+                             const ARegion *ar,
+                             RegionView3D *rv3d,
+                             Object *ob)
 {
 	float projection_mat[4][4];
 	int i, j, k;
@@ -84,21 +84,20 @@ int paint_convert_bb_to_rect(rcti *rect,
 	rect->xmax = rect->ymax = INT_MIN;
 
 	/* return zero if the bounding box has non-positive volume */
-	if(bb_min[0] > bb_max[0] || bb_min[1] > bb_max[1] || bb_min[2] > bb_max[2])
+	if (bb_min[0] > bb_max[0] || bb_min[1] > bb_max[1] || bb_min[2] > bb_max[2])
 		return 0;
 
 	ED_view3d_ob_project_mat_get(rv3d, ob, projection_mat);
 
-	for(i = 0; i < 2; ++i) {
-		for(j = 0; j < 2; ++j) {
-			for(k = 0; k < 2; ++k) {
+	for (i = 0; i < 2; ++i) {
+		for (j = 0; j < 2; ++j) {
+			for (k = 0; k < 2; ++k) {
 				float vec[3], proj[2];
 				vec[0] = i ? bb_min[0] : bb_max[0];
 				vec[1] = j ? bb_min[1] : bb_max[1];
 				vec[2] = k ? bb_min[2] : bb_max[2];
 				/* convert corner to screen space */
-				ED_view3d_project_float(ar, vec, proj,
-										projection_mat);
+				ED_view3d_project_float_v2(ar, vec, proj, projection_mat);
 				/* expand 2D rectangle */
 				rect->xmin = MIN2(rect->xmin, proj[0]);
 				rect->xmax = MAX2(rect->xmax, proj[0]);
@@ -113,13 +112,13 @@ int paint_convert_bb_to_rect(rcti *rect,
 }
 
 /* Get four planes in object-space that describe the projection of
-   screen_rect from screen into object-space (essentially converting a
-   2D screens-space bounding box into four 3D planes) */
+ * screen_rect from screen into object-space (essentially converting a
+ * 2D screens-space bounding box into four 3D planes) */
 void paint_calc_redraw_planes(float planes[4][4],
-							  const ARegion *ar,
-							  RegionView3D *rv3d,
-							  Object *ob,
-							  const rcti *screen_rect)
+                              const ARegion *ar,
+                              RegionView3D *rv3d,
+                              Object *ob,
+                              const rcti *screen_rect)
 {
 	BoundBox bb;
 	bglMats mats;
@@ -141,19 +140,19 @@ void paint_calc_redraw_planes(float planes[4][4],
 
 /* convert a point in model coordinates to 2D screen coordinates */
 /* TODO: can be deleted once all calls are replaced with
-   view3d_project_float() */
+ * view3d_project_float() */
 void projectf(bglMats *mats, const float v[3], float p[2])
 {
 	double ux, uy, uz;
 
-	gluProject(v[0],v[1],v[2], mats->modelview, mats->projection,
-		   (GLint *)mats->viewport, &ux, &uy, &uz);
-	p[0]= ux;
-	p[1]= uy;
+	gluProject(v[0], v[1], v[2], mats->modelview, mats->projection,
+	           (GLint *)mats->viewport, &ux, &uy, &uz);
+	p[0] = ux;
+	p[1] = uy;
 }
 
 float paint_calc_object_space_radius(ViewContext *vc, const float center[3],
-				     float pixel_radius)
+                                     float pixel_radius)
 {
 	Object *ob = vc->obact;
 	float delta[3], scale, loc[3];
@@ -163,17 +162,17 @@ float paint_calc_object_space_radius(ViewContext *vc, const float center[3],
 
 	initgrabz(vc->rv3d, loc[0], loc[1], loc[2]);
 
-	mval_f[0]= pixel_radius;
-	mval_f[1]= 0.0f;
+	mval_f[0] = pixel_radius;
+	mval_f[1] = 0.0f;
 	ED_view3d_win_to_delta(vc->ar, mval_f, delta);
 
-	scale= fabsf(mat4_to_scale(ob->obmat));
-	scale= (scale == 0.0f)? 1.0f: scale;
+	scale = fabsf(mat4_to_scale(ob->obmat));
+	scale = (scale == 0.0f) ? 1.0f : scale;
 
-	return len_v3(delta)/scale;
+	return len_v3(delta) / scale;
 }
 
-float paint_get_tex_pixel(Brush* br, float u, float v)
+float paint_get_tex_pixel(Brush *br, float u, float v)
 {
 	TexResult texres;
 	float co[3];
@@ -187,35 +186,37 @@ float paint_get_tex_pixel(Brush* br, float u, float v)
 	hasrgb = multitex_ext(br->mtex.tex, co, NULL, NULL, 0, &texres);
 
 	if (hasrgb & TEX_RGB)
-		texres.tin = (0.35f*texres.tr + 0.45f*texres.tg + 0.2f*texres.tb)*texres.ta;
+		texres.tin = (0.35f * texres.tr + 0.45f * texres.tg + 0.2f * texres.tb) * texres.ta;
 
 	return texres.tin;
 }
 
 /* 3D Paint */
 
-static void imapaint_project(Object *ob, float *model, float *proj, float *co, float *pco)
+static void imapaint_project(Object *ob, float model[][4], float proj[][4], const float co[3], float pco[4])
 {
 	copy_v3_v3(pco, co);
-	pco[3]= 1.0f;
+	pco[3] = 1.0f;
 
 	mul_m4_v3(ob->obmat, pco);
-	mul_m4_v3((float(*)[4])model, pco);
-	mul_m4_v4((float(*)[4])proj, pco);
+	mul_m4_v3(model, pco);
+	mul_m4_v4(proj, pco);
 }
 
-static void imapaint_tri_weights(Object *ob, float *v1, float *v2, float *v3, float *co, float *w)
+static void imapaint_tri_weights(Object *ob,
+                                 const float v1[3], const float v2[3], const float v3[3],
+                                 const float co[3], float w[3])
 {
 	float pv1[4], pv2[4], pv3[4], h[3], divw;
-	float model[16], proj[16], wmat[3][3], invwmat[3][3];
+	float model[4][4], proj[4][4], wmat[3][3], invwmat[3][3];
 	GLint view[4];
 
 	/* compute barycentric coordinates */
 
 	/* get the needed opengl matrices */
 	glGetIntegerv(GL_VIEWPORT, view);
-	glGetFloatv(GL_MODELVIEW_MATRIX, model);
-	glGetFloatv(GL_PROJECTION_MATRIX, proj);
+	glGetFloatv(GL_MODELVIEW_MATRIX,  (float *)model);
+	glGetFloatv(GL_PROJECTION_MATRIX, (float *)proj);
 	view[0] = view[1] = 0;
 
 	/* project the verts */
@@ -224,16 +225,16 @@ static void imapaint_tri_weights(Object *ob, float *v1, float *v2, float *v3, fl
 	imapaint_project(ob, model, proj, v3, pv3);
 
 	/* do inverse view mapping, see gluProject man page */
-	h[0]= (co[0] - view[0])*2.0f/view[2] - 1;
-	h[1]= (co[1] - view[1])*2.0f/view[3] - 1;
-	h[2]= 1.0f;
+	h[0] = (co[0] - view[0]) * 2.0f / view[2] - 1;
+	h[1] = (co[1] - view[1]) * 2.0f / view[3] - 1;
+	h[2] = 1.0f;
 
-	/* solve for(w1,w2,w3)/perspdiv in:
-	   h*perspdiv = Project*Model*(w1*v1 + w2*v2 + w3*v3) */
+	/* solve for (w1,w2,w3)/perspdiv in:
+	 * h * perspdiv = Project * Model * (w1 * v1 + w2 * v2 + w3 * v3) */
 
-	wmat[0][0]= pv1[0];  wmat[1][0]= pv2[0];  wmat[2][0]= pv3[0];
-	wmat[0][1]= pv1[1];  wmat[1][1]= pv2[1];  wmat[2][1]= pv3[1];
-	wmat[0][2]= pv1[3];  wmat[1][2]= pv2[3];  wmat[2][2]= pv3[3];
+	wmat[0][0] = pv1[0];  wmat[1][0] = pv2[0];  wmat[2][0] = pv3[0];
+	wmat[0][1] = pv1[1];  wmat[1][1] = pv2[1];  wmat[2][1] = pv3[1];
+	wmat[0][2] = pv1[3];  wmat[1][2] = pv2[3];  wmat[2][2] = pv3[3];
 
 	invert_m3_m3(invwmat, wmat);
 	mul_m3_v3(invwmat, h);
@@ -241,18 +242,19 @@ static void imapaint_tri_weights(Object *ob, float *v1, float *v2, float *v3, fl
 	copy_v3_v3(w, h);
 
 	/* w is still divided by perspdiv, make it sum to one */
-	divw= w[0] + w[1] + w[2];
-	if(divw != 0.0f)
-		mul_v3_fl(w, 1.0f/divw);
+	divw = w[0] + w[1] + w[2];
+	if (divw != 0.0f) {
+		mul_v3_fl(w, 1.0f / divw);
+	}
 }
 
 /* compute uv coordinates of mouse in face */
 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->getFaceDataArray(dm, CD_ORIGINDEX);
-	MTFace *tface = dm->getFaceDataArray(dm, CD_MTFACE), *tf;
-	int numfaces = dm->getNumFaces(dm), a, findex;
+	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];
@@ -261,48 +263,48 @@ void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, const in
 	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;
+	for (a = 0; a < numfaces; a++) {
+		findex = index ? index[a] : a;
 
-		if(findex == faceindex) {
-			dm->getFace(dm, a, &mf);
+		if (findex == faceindex) {
+			dm->getTessFace(dm, a, &mf);
 
 			dm->getVert(dm, mf.v1, &mv[0]);
 			dm->getVert(dm, mf.v2, &mv[1]);
 			dm->getVert(dm, mf.v3, &mv[2]);
-			if(mf.v4)
+			if (mf.v4)
 				dm->getVert(dm, mf.v4, &mv[3]);
 
-			tf= &tface[a];
+			tf = &tface[a];
 
-			p[0]= xy[0];
-			p[1]= xy[1];
+			p[0] = xy[0];
+			p[1] = xy[1];
 
-			if(mf.v4) {
+			if (mf.v4) {
 				/* the triangle with the largest absolute values is the one
-				   with the most negative weights */
+				 * with the most negative weights */
 				imapaint_tri_weights(ob, mv[0].co, mv[1].co, mv[3].co, p, w);
-				absw= fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
-				if(absw < minabsw) {
-					uv[0]= tf->uv[0][0]*w[0] + tf->uv[1][0]*w[1] + tf->uv[3][0]*w[2];
-					uv[1]= tf->uv[0][1]*w[0] + tf->uv[1][1]*w[1] + tf->uv[3][1]*w[2];
+				absw = fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
+				if (absw < minabsw) {
+					uv[0] = tf->uv[0][0] * w[0] + tf->uv[1][0] * w[1] + tf->uv[3][0] * w[2];
+					uv[1] = tf->uv[0][1] * w[0] + tf->uv[1][1] * w[1] + tf->uv[3][1] * w[2];
 					minabsw = absw;
 				}
 
 				imapaint_tri_weights(ob, mv[1].co, mv[2].co, mv[3].co, p, w);
-				absw= fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
-				if(absw < minabsw) {
-					uv[0]= tf->uv[1][0]*w[0] + tf->uv[2][0]*w[1] + tf->uv[3][0]*w[2];
-					uv[1]= tf->uv[1][1]*w[0] + tf->uv[2][1]*w[1] + tf->uv[3][1]*w[2];
+				absw = fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
+				if (absw < minabsw) {
+					uv[0] = tf->uv[1][0] * w[0] + tf->uv[2][0] * w[1] + tf->uv[3][0] * w[2];
+					uv[1] = tf->uv[1][1] * w[0] + tf->uv[2][1] * w[1] + tf->uv[3][1] * w[2];
 					minabsw = absw;
 				}
 			}
 			else {
 				imapaint_tri_weights(ob, mv[0].co, mv[1].co, mv[2].co, p, w);
-				absw= fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
-				if(absw < minabsw) {
-					uv[0]= tf->uv[0][0]*w[0] + tf->uv[1][0]*w[1] + tf->uv[2][0]*w[2];
-					uv[1]= tf->uv[0][1]*w[0] + tf->uv[1][1]*w[1] + tf->uv[2][1]*w[2];
+				absw = fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
+				if (absw < minabsw) {
+					uv[0] = tf->uv[0][0] * w[0] + tf->uv[1][0] * w[1] + tf->uv[2][0] * w[2];
+					uv[1] = tf->uv[0][1] * w[0] + tf->uv[1][1] * w[1] + tf->uv[2][1] * w[2];
 					minabsw = absw;
 				}
 			}
@@ -312,17 +314,18 @@ void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, const in
 	dm->release(dm);
 }
 
-///* returns 0 if not found, otherwise 1 */
-int imapaint_pick_face(ViewContext *vc, Mesh *me, const int mval[2], unsigned int *index)
+/* returns 0 if not found, otherwise 1 */
+int imapaint_pick_face(ViewContext *vc, const int mval[2], unsigned int *index, unsigned int totface)
 {
-	if(!me || me->totface==0)
+	if (totface == 0)
 		return 0;
 
 	/* sample only on the exact position */
 	*index = view3d_sample_backbuf(vc, mval[0], mval[1]);
 
-	if((*index)<=0 || (*index)>(unsigned int)me->totface)
+	if ((*index) <= 0 || (*index) > (unsigned int)totface) {
 		return 0;
+	}
 
 	(*index)--;
 	
@@ -330,7 +333,7 @@ int imapaint_pick_face(ViewContext *vc, Mesh *me, const int mval[2], unsigned in
 }
 
 /* used for both 3d view and image window */
-void paint_sample_color(Scene *scene, ARegion *ar, int x, int y)	/* frontbuf */
+void paint_sample_color(Scene *scene, ARegion *ar, int x, int y)    /* frontbuf */
 {
 	Brush *br = paint_brush(paint_get_active(scene));
 	unsigned int col;
@@ -340,15 +343,15 @@ void paint_sample_color(Scene *scene, ARegion *ar, int x, int y)	/* frontbuf */
 	CLAMP(y, 0, ar->winy);
 	
 	glReadBuffer(GL_FRONT);
-	glReadPixels(x+ar->winrct.xmin, y+ar->winrct.ymin, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col);
+	glReadPixels(x + ar->winrct.xmin, y + ar->winrct.ymin, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col);
 	glReadBuffer(GL_BACK);
 
 	cp = (char *)&col;
 	
-	if(br) {
-		br->rgb[0]= cp[0]/255.0f;
-		br->rgb[1]= cp[1]/255.0f;
-		br->rgb[2]= cp[2]/255.0f;
+	if (br) {
+		br->rgb[0] = cp[0] / 255.0f;
+		br->rgb[1] = cp[1] / 255.0f;
+		br->rgb[2] = cp[2] / 255.0f;
 	}
 }
 
@@ -378,14 +381,12 @@ void BRUSH_OT_curve_preset(wmOperatorType *ot)
 		{CURVE_PRESET_ROOT, "ROOT", 0, "Root", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	ot->name= "Preset";
-	ot->description= "Set brush shape";
-	ot->idname= "BRUSH_OT_curve_preset";
-
-	ot->exec= brush_curve_preset_exec;
-	ot->poll= brush_curve_preset_poll;
+	ot->name = "Preset";
+	ot->description = "Set brush shape";
+	ot->idname = "BRUSH_OT_curve_preset";
 
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->exec = brush_curve_preset_exec;
+	ot->poll = brush_curve_preset_poll;
 
 	RNA_def_enum(ot->srna, "shape", prop_shape_items, CURVE_PRESET_SMOOTH, "Mode", "");
 }
@@ -401,19 +402,19 @@ static int paint_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
 
 void PAINT_OT_face_select_linked(wmOperatorType *ot)
 {
-	ot->name= "Select Linked";
-	ot->description= "Select linked faces";
-	ot->idname= "PAINT_OT_face_select_linked";
+	ot->name = "Select Linked";
+	ot->description = "Select linked faces";
+	ot->idname = "PAINT_OT_face_select_linked";
 
-	ot->exec= paint_select_linked_exec;
-	ot->poll= facemask_paint_poll;
+	ot->exec = paint_select_linked_exec;
+	ot->poll = facemask_paint_poll;
 
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 static int paint_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	int mode= RNA_boolean_get(op->ptr, "extend") ? 1:0;
+	int mode = RNA_boolean_get(op->ptr, "extend") ? 1 : 0;
 	paintface_select_linked(C, CTX_data_active_object(C), event->mval, mode);
 	ED_region_tag_redraw(CTX_wm_region(C));
 	return OPERATOR_FINISHED;
@@ -421,14 +422,14 @@ static int paint_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent
 
 void PAINT_OT_face_select_linked_pick(wmOperatorType *ot)
 {
-	ot->name= "Select Linked Pick";
-	ot->description= "Select linked faces";
-	ot->idname= "PAINT_OT_face_select_linked_pick";
+	ot->name = "Select Linked Pick";
+	ot->description = "Select linked faces";
+	ot->idname = "PAINT_OT_face_select_linked_pick";
 
-	ot->invoke= paint_select_linked_pick_invoke;
-	ot->poll= facemask_paint_poll;
+	ot->invoke = paint_select_linked_pick_invoke;
+	ot->poll = facemask_paint_poll;
 
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the existing selection");
 }
@@ -436,7 +437,7 @@ void PAINT_OT_face_select_linked_pick(wmOperatorType *ot)
 
 static int face_select_all_exec(bContext *C, wmOperator *op)
 {
-	Object *ob= CTX_data_active_object(C);
+	Object *ob = CTX_data_active_object(C);
 	paintface_deselect_all_visible(ob, RNA_enum_get(op->ptr, "action"), TRUE);
 	ED_region_tag_redraw(CTX_wm_region(C));
 	return OPERATOR_FINISHED;
@@ -445,14 +446,14 @@ static int face_select_all_exec(bContext *C, wmOperator *op)
 
 void PAINT_OT_face_select_all(wmOperatorType *ot)
 {
-	ot->name= "Face Selection";
-	ot->description= "Change selection for all faces";
-	ot->idname= "PAINT_OT_face_select_all";
+	ot->name = "Face Selection";
+	ot->description = "Change selection for all faces";
+	ot->idname = "PAINT_OT_face_select_all";
 
-	ot->exec= face_select_all_exec;
-	ot->poll= facemask_paint_poll;
+	ot->exec = face_select_all_exec;
+	ot->poll = facemask_paint_poll;
 
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	WM_operator_properties_select_all(ot);
 }
@@ -460,7 +461,7 @@ void PAINT_OT_face_select_all(wmOperatorType *ot)
 
 static int vert_select_all_exec(bContext *C, wmOperator *op)
 {
-	Object *ob= CTX_data_active_object(C);
+	Object *ob = CTX_data_active_object(C);
 	paintvert_deselect_all_visible(ob, RNA_enum_get(op->ptr, "action"), TRUE);
 	ED_region_tag_redraw(CTX_wm_region(C));
 	return OPERATOR_FINISHED;
@@ -469,21 +470,21 @@ static int vert_select_all_exec(bContext *C, wmOperator *op)
 
 void PAINT_OT_vert_select_all(wmOperatorType *ot)
 {
-	ot->name= "Vertex Selection";
-	ot->description= "Change selection for all vertices";
-	ot->idname= "PAINT_OT_vert_select_all";
+	ot->name = "Vertex Selection";
+	ot->description = "Change selection for all vertices";
+	ot->idname = "PAINT_OT_vert_select_all";
 
-	ot->exec= vert_select_all_exec;
-	ot->poll= vert_paint_poll;
+	ot->exec = vert_select_all_exec;
+	ot->poll = vert_paint_poll;
 
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	WM_operator_properties_select_all(ot);
 }
 
 static int vert_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Object *ob= CTX_data_active_object(C);
+	Object *ob = CTX_data_active_object(C);
 	paintvert_deselect_all_visible(ob, SEL_INVERT, TRUE);
 	ED_region_tag_redraw(CTX_wm_region(C));
 	return OPERATOR_FINISHED;
@@ -491,18 +492,18 @@ static int vert_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
 
 void PAINT_OT_vert_select_inverse(wmOperatorType *ot)
 {
-	ot->name= "Vertex Select Invert";
-	ot->description= "Invert selection of vertices";
-	ot->idname= "PAINT_OT_vert_select_inverse";
+	ot->name = "Vertex Select Invert";
+	ot->description = "Invert selection of vertices";
+	ot->idname = "PAINT_OT_vert_select_inverse";
 
-	ot->exec= vert_select_inverse_exec;
-	ot->poll= vert_paint_poll;
+	ot->exec = vert_select_inverse_exec;
+	ot->poll = vert_paint_poll;
 
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 static int face_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Object *ob= CTX_data_active_object(C);
+	Object *ob = CTX_data_active_object(C);
 	paintface_deselect_all_visible(ob, SEL_INVERT, TRUE);
 	ED_region_tag_redraw(CTX_wm_region(C));
 	return OPERATOR_FINISHED;
@@ -511,20 +512,20 @@ static int face_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
 
 void PAINT_OT_face_select_inverse(wmOperatorType *ot)
 {
-	ot->name= "Face Select Invert";
-	ot->description= "Invert selection of faces";
-	ot->idname= "PAINT_OT_face_select_inverse";
+	ot->name = "Face Select Invert";
+	ot->description = "Invert selection of faces";
+	ot->idname = "PAINT_OT_face_select_inverse";
 
-	ot->exec= face_select_inverse_exec;
-	ot->poll= facemask_paint_poll;
+	ot->exec = face_select_inverse_exec;
+	ot->poll = facemask_paint_poll;
 
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 static int face_select_hide_exec(bContext *C, wmOperator *op)
 {
-	const int unselected= RNA_boolean_get(op->ptr, "unselected");
-	Object *ob= CTX_data_active_object(C);
+	const int unselected = RNA_boolean_get(op->ptr, "unselected");
+	Object *ob = CTX_data_active_object(C);
 	paintface_hide(ob, unselected);
 	ED_region_tag_redraw(CTX_wm_region(C));
 	return OPERATOR_FINISHED;
@@ -532,21 +533,21 @@ static int face_select_hide_exec(bContext *C, wmOperator *op)
 
 void PAINT_OT_face_select_hide(wmOperatorType *ot)
 {
-	ot->name= "Face Select Hide";
-	ot->description= "Hide selected faces";
-	ot->idname= "PAINT_OT_face_select_hide";
+	ot->name = "Face Select Hide";
+	ot->description = "Hide selected faces";
+	ot->idname = "PAINT_OT_face_select_hide";
 
-	ot->exec= face_select_hide_exec;
-	ot->poll= facemask_paint_poll;
+	ot->exec = face_select_hide_exec;
+	ot->poll = facemask_paint_poll;
 
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected objects");
 }
 
 static int face_select_reveal_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Object *ob= CTX_data_active_object(C);
+	Object *ob = CTX_data_active_object(C);
 	paintface_reveal(ob);
 	ED_region_tag_redraw(CTX_wm_region(C));
 	return OPERATOR_FINISHED;
@@ -554,14 +555,14 @@ static int face_select_reveal_exec(bContext *C, wmOperator *UNUSED(op))
 
 void PAINT_OT_face_select_reveal(wmOperatorType *ot)
 {
-	ot->name= "Face Select Reveal";
-	ot->description= "Reveal hidden faces";
-	ot->idname= "PAINT_OT_face_select_reveal";
+	ot->name = "Face Select Reveal";
+	ot->description = "Reveal hidden faces";
+	ot->idname = "PAINT_OT_face_select_reveal";
 
-	ot->exec= face_select_reveal_exec;
-	ot->poll= facemask_paint_poll;
+	ot->exec = face_select_reveal_exec;
+	ot->poll = facemask_paint_poll;
 
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected objects");
 }
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 941e885..bd448cc 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -43,6 +43,7 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
+#include "BLI_memarena.h"
 #include "BLI_utildefines.h"
 #include "BLI_ghash.h"
 
@@ -85,28 +86,59 @@
 
 #include "paint_intern.h"
 
-/* polling - retrieve whether cursor should be set or operator should be done */
+/* check if we can do partial updates and have them draw realtime
+ * (without rebuilding the 'derivedFinal') */
+static int vertex_paint_use_fast_update_check(Object *ob)
+{
+	DerivedMesh *dm = ob->derivedFinal;
+
+	if (dm) {
+		Mesh *me = get_mesh(ob);
+		if (me && me->mcol) {
+			return (me->mcol == CustomData_get_layer(&dm->faceData, CD_MCOL));
+		}
+	}
+
+	return FALSE;
+}
+
+/* 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)
+{
+	DerivedMesh *dm = ob->derivedFinal;
+
+	if (dm) {
+		Mesh *me = get_mesh(ob);
+		return (me->mpoly == CustomData_get_layer(&dm->faceData, CD_MPOLY));
+	}
 
+	return FALSE;
+}
+
+/* polling - retrieve whether cursor should be set or operator should be done */
 
 /* Returns true if vertex paint mode is active */
 int vertex_paint_mode_poll(bContext *C)
 {
 	Object *ob = CTX_data_active_object(C);
 
-	return ob && ob->mode == OB_MODE_VERTEX_PAINT && ((Mesh *)ob->data)->totface;
+	return ob && ob->mode == OB_MODE_VERTEX_PAINT && ((Mesh *)ob->data)->totpoly;
 }
 
 int vertex_paint_poll(bContext *C)
 {
-	if(vertex_paint_mode_poll(C) && 
-	   paint_brush(&CTX_data_tool_settings(C)->vpaint->paint)) {
-		ScrArea *sa= CTX_wm_area(C);
-		if(sa->spacetype==SPACE_VIEW3D) {
-			ARegion *ar= CTX_wm_region(C);
-			if(ar->regiontype==RGN_TYPE_WINDOW)
+	if (vertex_paint_mode_poll(C) && 
+	    paint_brush(&CTX_data_tool_settings(C)->vpaint->paint))
+	{
+		ScrArea *sa = CTX_wm_area(C);
+		if (sa->spacetype == SPACE_VIEW3D) {
+			ARegion *ar = CTX_wm_region(C);
+			if (ar->regiontype == RGN_TYPE_WINDOW)
 				return 1;
-			}
 		}
+	}
 	return 0;
 }
 
@@ -114,22 +146,22 @@ int weight_paint_mode_poll(bContext *C)
 {
 	Object *ob = CTX_data_active_object(C);
 
-	return ob && ob->mode == OB_MODE_WEIGHT_PAINT && ((Mesh *)ob->data)->totface;
+	return ob && ob->mode == OB_MODE_WEIGHT_PAINT && ((Mesh *)ob->data)->totpoly;
 }
 
 int weight_paint_poll(bContext *C)
 {
-	Object *ob= CTX_data_active_object(C);
+	Object *ob = CTX_data_active_object(C);
 	ScrArea *sa;
 
-	if(	(ob != NULL) &&
-		(ob->mode & OB_MODE_WEIGHT_PAINT) &&
-		(paint_brush(&CTX_data_tool_settings(C)->wpaint->paint) != NULL) &&
-		(sa= CTX_wm_area(C)) &&
-		(sa->spacetype == SPACE_VIEW3D)
-	) {
-		ARegion *ar= CTX_wm_region(C);
-		if(ar->regiontype==RGN_TYPE_WINDOW) {
+	if ((ob != NULL) &&
+	    (ob->mode & OB_MODE_WEIGHT_PAINT) &&
+	    (paint_brush(&CTX_data_tool_settings(C)->wpaint->paint) != NULL) &&
+	    (sa = CTX_wm_area(C)) &&
+	    (sa->spacetype == SPACE_VIEW3D))
+	{
+		ARegion *ar = CTX_wm_region(C);
+		if (ar->regiontype == RGN_TYPE_WINDOW) {
 			return 1;
 		}
 	}
@@ -138,57 +170,31 @@ int weight_paint_poll(bContext *C)
 
 static VPaint *new_vpaint(int wpaint)
 {
-	VPaint *vp= MEM_callocN(sizeof(VPaint), "VPaint");
+	VPaint *vp = MEM_callocN(sizeof(VPaint), "VPaint");
 	
-	vp->flag= VP_AREA+VP_SPRAY;
+	vp->flag = VP_AREA + VP_SPRAY;
 	
-	if(wpaint)
-		vp->flag= VP_AREA;
+	if (wpaint)
+		vp->flag = VP_AREA;
 
 	return vp;
 }
 
 static int *get_indexarray(Mesh *me)
 {
-	return MEM_mallocN(sizeof(int)*(me->totface+1), "vertexpaint");
-}
-
-
-/* in contradiction to cpack drawing colors, the MCOL colors (vpaint colors) are per byte! 
-   so not endian sensitive. Mcol = ABGR!!! so be cautious with cpack calls */
-
-static unsigned int rgba_to_mcol(float r, float g, float b, float a)
-{
-	int ir, ig, ib, ia;
-	unsigned int col;
-	char *cp;
-	
-	ir= floor(255.0f * r);
-	if(ir<0) ir= 0; else if(ir>255) ir= 255;
-	ig= floor(255.0f * g);
-	if(ig<0) ig= 0; else if(ig>255) ig= 255;
-	ib= floor(255.0f * b);
-	if(ib<0) ib= 0; else if(ib>255) ib= 255;
-	ia= floor(255.0f * a);
-	if(ia<0) ia= 0; else if(ia>255) ia= 255;
-	
-	cp= (char *)&col;
-	cp[0]= ia;
-	cp[1]= ib;
-	cp[2]= ig;
-	cp[3]= ir;
-	
-	return col;
-	
+	return MEM_mallocN(sizeof(int) * (me->totpoly + 1), "vertexpaint");
 }
 
 unsigned int vpaint_get_current_col(VPaint *vp)
 {
 	Brush *brush = paint_brush(&vp->paint);
-	return rgba_to_mcol(brush->rgb[0], brush->rgb[1], brush->rgb[2], 1.0f);
+	unsigned char col[4];
+	rgb_float_to_uchar(col, brush->rgb);
+	col[3] = 255; /* alpha isn't used, could even be removed to speedup paint a little */
+	return *(unsigned int *)col;
 }
 
-static void do_shared_vertexcol(Mesh *me)
+static void do_shared_vertex_tesscol(Mesh *me)
 {
 	/* if no mcol: do not do */
 	/* if tface: only the involved faces, otherwise all */
@@ -198,81 +204,165 @@ static void do_shared_vertexcol(Mesh *me)
 	short *scolmain, *scol;
 	char *mcol;
 	
-	if(me->mcol==NULL || me->totvert==0 || me->totface==0) return;
-	
-	scolmain= MEM_callocN(4*sizeof(short)*me->totvert, "colmain");
-	
-	tface= me->mtface;
-	mface= me->mface;
-	mcol= (char *)me->mcol;
-	for(a=me->totface; a>0; a--, mface++, mcol+=16) {
-		if((tface && tface->mode & TF_SHAREDCOL) || (me->editflag & ME_EDIT_PAINT_MASK)==0) {
-			scol= scolmain+4*mface->v1;
-			scol[0]++; scol[1]+= mcol[1]; scol[2]+= mcol[2]; scol[3]+= mcol[3];
-			scol= scolmain+4*mface->v2;
-			scol[0]++; scol[1]+= mcol[5]; scol[2]+= mcol[6]; scol[3]+= mcol[7];
-			scol= scolmain+4*mface->v3;
-			scol[0]++; scol[1]+= mcol[9]; scol[2]+= mcol[10]; scol[3]+= mcol[11];
-			if(mface->v4) {
-				scol= scolmain+4*mface->v4;
-				scol[0]++; scol[1]+= mcol[13]; scol[2]+= mcol[14]; scol[3]+= mcol[15];
+	if (me->mcol == NULL || me->totvert == 0 || me->totface == 0) return;
+	
+	scolmain = MEM_callocN(4 * sizeof(short) * me->totvert, "colmain");
+	
+	tface = me->mtface;
+	mface = me->mface;
+	mcol = (char *)me->mcol;
+	for (a = me->totface; a > 0; a--, mface++, mcol += 16) {
+		if ((tface && tface->mode & TF_SHAREDCOL) || (me->editflag & ME_EDIT_PAINT_MASK) == 0) {
+			scol = scolmain + 4 * mface->v1;
+			scol[0]++; scol[1] += mcol[1]; scol[2] += mcol[2]; scol[3] += mcol[3];
+			scol = scolmain + 4 * mface->v2;
+			scol[0]++; scol[1] += mcol[5]; scol[2] += mcol[6]; scol[3] += mcol[7];
+			scol = scolmain + 4 * mface->v3;
+			scol[0]++; scol[1] += mcol[9]; scol[2] += mcol[10]; scol[3] += mcol[11];
+			if (mface->v4) {
+				scol = scolmain + 4 * mface->v4;
+				scol[0]++; scol[1] += mcol[13]; scol[2] += mcol[14]; scol[3] += mcol[15];
 			}
 		}
-		if(tface) tface++;
-	}
-	
-	a= me->totvert;
-	scol= scolmain;
-	while(a--) {
-		if(scol[0]>1) {
-			scol[1]/= scol[0];
-			scol[2]/= scol[0];
-			scol[3]/= scol[0];
-		}
-		scol+= 4;
-	}
-	
-	tface= me->mtface;
-	mface= me->mface;
-	mcol= (char *)me->mcol;
-	for(a=me->totface; a>0; a--, mface++, mcol+=16) {
-		if((tface && tface->mode & TF_SHAREDCOL) || (me->editflag & ME_EDIT_PAINT_MASK)==0) {
-			scol= scolmain+4*mface->v1;
-			mcol[1]= scol[1]; mcol[2]= scol[2]; mcol[3]= scol[3];
-			scol= scolmain+4*mface->v2;
-			mcol[5]= scol[1]; mcol[6]= scol[2]; mcol[7]= scol[3];
-			scol= scolmain+4*mface->v3;
-			mcol[9]= scol[1]; mcol[10]= scol[2]; mcol[11]= scol[3];
-			if(mface->v4) {
-				scol= scolmain+4*mface->v4;
-				mcol[13]= scol[1]; mcol[14]= scol[2]; mcol[15]= scol[3];
+		if (tface) tface++;
+	}
+	
+	a = me->totvert;
+	scol = scolmain;
+	while (a--) {
+		if (scol[0] > 1) {
+			scol[1] /= scol[0];
+			scol[2] /= scol[0];
+			scol[3] /= scol[0];
+		}
+		scol += 4;
+	}
+	
+	tface = me->mtface;
+	mface = me->mface;
+	mcol = (char *)me->mcol;
+	for (a = me->totface; a > 0; a--, mface++, mcol += 16) {
+		if ((tface && tface->mode & TF_SHAREDCOL) || (me->editflag & ME_EDIT_PAINT_MASK) == 0) {
+			scol = scolmain + 4 * mface->v1;
+			mcol[1] = scol[1]; mcol[2] = scol[2]; mcol[3] = scol[3];
+			scol = scolmain + 4 * mface->v2;
+			mcol[5] = scol[1]; mcol[6] = scol[2]; mcol[7] = scol[3];
+			scol = scolmain + 4 * mface->v3;
+			mcol[9] = scol[1]; mcol[10] = scol[2]; mcol[11] = scol[3];
+			if (mface->v4) {
+				scol = scolmain + 4 * mface->v4;
+				mcol[13] = scol[1]; mcol[14] = scol[2]; mcol[15] = scol[3];
 			}
 		}
-		if(tface) tface++;
+		if (tface) tface++;
 	}
 
 	MEM_freeN(scolmain);
 }
 
-static void make_vertexcol(Object *ob)	/* single ob */
+void do_shared_vertexcol(Mesh *me, int do_tessface)
+{
+	MLoop *ml = me->mloop;
+	MLoopCol *lcol = me->mloopcol;
+	MTexPoly *mtp = me->mtpoly;
+	MPoly *mp = me->mpoly;
+	float (*scol)[5];
+	int i, has_shared = 0;
+
+	/* if no mloopcol: do not do */
+	/* if mtexpoly: only the involved faces, otherwise all */
+
+	if (me->mloopcol == 0 || me->totvert == 0 || me->totpoly == 0) return;
+
+	scol = MEM_callocN(sizeof(float) * me->totvert * 5, "scol");
+
+	for (i = 0; i < me->totloop; i++, ml++, lcol++) {
+		if (i >= mp->loopstart + mp->totloop) {
+			mp++;
+			if (mtp) mtp++;
+		}
+
+		if (!(mtp && (mtp->mode & TF_SHAREDCOL)) && (me->editflag & ME_EDIT_PAINT_MASK) != 0)
+			continue;
+
+		scol[ml->v][0] += lcol->r;
+		scol[ml->v][1] += lcol->g;
+		scol[ml->v][2] += lcol->b;
+		scol[ml->v][3] += lcol->a;
+		scol[ml->v][4] += 1.0;
+		has_shared = 1;
+	}
+	
+	if (has_shared) {
+		for (i = 0; i < me->totvert; i++) {
+			if (!scol[i][4]) continue;
+
+			scol[i][0] /= scol[i][4];
+			scol[i][1] /= scol[i][4];
+			scol[i][2] /= scol[i][4];
+			scol[i][3] /= scol[i][4];
+		}
+	
+		ml = me->mloop;
+		lcol = me->mloopcol;
+		for (i = 0; i < me->totloop; i++, ml++, lcol++) {
+			if (!scol[ml->v][4]) continue;
+
+			lcol->r = scol[ml->v][0];
+			lcol->g = scol[ml->v][1];
+			lcol->b = scol[ml->v][2];
+			lcol->a = scol[ml->v][3];
+		}
+	}
+
+	MEM_freeN(scol);
+
+	if (has_shared && do_tessface) {
+		do_shared_vertex_tesscol(me);
+	}
+}
+
+static void make_vertexcol(Object *ob)  /* single ob */
 {
 	Mesh *me;
-	if(!ob || ob->id.lib) return;
-	me= get_mesh(ob);
-	if(me==NULL) return;
-	if(me->edit_mesh) return;
+	if (!ob || ob->id.lib) return;
+	me = get_mesh(ob);
+	if (me == NULL) return;
+	if (me->edit_btmesh) return;
 
 	/* copies from shadedisplist to mcol */
-	if(!me->mcol) {
-		CustomData_add_layer(&me->fdata, CD_MCOL, CD_CALLOC, NULL, me->totface);
-		mesh_update_customdata_pointers(me);
+	if (!me->mloopcol) {
+		if (!me->mcol) {
+			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);	
+		}
+		mesh_update_customdata_pointers(me, TRUE);
 	}
 
-	//if(shade)
+	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);
+		}
+	}
+
+	//if (shade)
 	//	shadeMeshMCol(scene, ob, me);
 	//else
-
-	memset(me->mcol, 255, 4*sizeof(MCol)*me->totface);
 	
 	DAG_id_tag_update(&me->id, 0);
 	
@@ -281,31 +371,31 @@ static void make_vertexcol(Object *ob)	/* single ob */
 /* mirror_vgroup is set to -1 when invalid */
 static int wpaint_mirror_vgroup_ensure(Object *ob, const int vgroup_active)
 {
-	bDeformGroup *defgroup= BLI_findlink(&ob->defbase, vgroup_active);
+	bDeformGroup *defgroup = BLI_findlink(&ob->defbase, vgroup_active);
 
-	if(defgroup) {
+	if (defgroup) {
 		bDeformGroup *curdef;
 		int mirrdef;
 		char name[MAXBONENAME];
 
 		flip_side_name(name, defgroup->name, FALSE);
 
-		if(strcmp(name, defgroup->name) != 0) {
-			for (curdef= ob->defbase.first, mirrdef= 0; curdef; curdef=curdef->next, mirrdef++) {
+		if (strcmp(name, defgroup->name) != 0) {
+			for (curdef = ob->defbase.first, mirrdef = 0; curdef; curdef = curdef->next, mirrdef++) {
 				if (!strcmp(curdef->name, name)) {
 					break;
 				}
 			}
 
-			if(curdef==NULL) {
-				int olddef= ob->actdef;	/* tsk, ED_vgroup_add sets the active defgroup */
-				curdef= ED_vgroup_add_name(ob, name);
-				ob->actdef= olddef;
+			if (curdef == NULL) {
+				int olddef = ob->actdef;  /* tsk, ED_vgroup_add sets the active defgroup */
+				curdef = ED_vgroup_add_name(ob, name);
+				ob->actdef = olddef;
 			}
 
 			/* curdef should never be NULL unless this is
 			 * a  lamp and ED_vgroup_add_name fails */
-			if(curdef) {
+			if (curdef) {
 				return mirrdef;
 			}
 		}
@@ -314,33 +404,33 @@ static int wpaint_mirror_vgroup_ensure(Object *ob, const int vgroup_active)
 	return -1;
 }
 
-static void copy_vpaint_prev(VPaint *vp, unsigned int *mcol, int tot)
+static void copy_vpaint_prev(VPaint *vp, unsigned int *lcol, int tot)
 {
-	if(vp->vpaint_prev) {
+	if (vp->vpaint_prev) {
 		MEM_freeN(vp->vpaint_prev);
-		vp->vpaint_prev= NULL;
+		vp->vpaint_prev = NULL;
 	}
-	vp->tot= tot;	
+	vp->tot = tot;
 	
-	if(mcol==NULL || tot==0) return;
+	if (lcol == NULL || tot == 0) return;
 	
-	vp->vpaint_prev= MEM_mallocN(4*sizeof(int)*tot, "vpaint_prev");
-	memcpy(vp->vpaint_prev, mcol, 4*sizeof(int)*tot);
+	vp->vpaint_prev = MEM_mallocN(sizeof(int) * tot, "vpaint_prev");
+	memcpy(vp->vpaint_prev, lcol, sizeof(int) * tot);
 	
 }
 
-static void copy_wpaint_prev (VPaint *wp, MDeformVert *dverts, int dcount)
+static void copy_wpaint_prev(VPaint *wp, MDeformVert *dverts, int dcount)
 {
 	if (wp->wpaint_prev) {
 		free_dverts(wp->wpaint_prev, wp->tot);
-		wp->wpaint_prev= NULL;
+		wp->wpaint_prev = NULL;
 	}
 	
-	if(dverts && dcount) {
+	if (dverts && dcount) {
 		
-		wp->wpaint_prev = MEM_mallocN (sizeof(MDeformVert)*dcount, "wpaint prev");
+		wp->wpaint_prev = MEM_mallocN(sizeof(MDeformVert) * dcount, "wpaint prev");
 		wp->tot = dcount;
-		copy_dverts (wp->wpaint_prev, dverts, dcount);
+		copy_dverts(wp->wpaint_prev, dverts, dcount);
 	}
 }
 
@@ -348,30 +438,33 @@ static void copy_wpaint_prev (VPaint *wp, MDeformVert *dverts, int dcount)
 void vpaint_fill(Object *ob, unsigned int paintcol)
 {
 	Mesh *me;
-	MFace *mf;
-	unsigned int *mcol;
-	int i, selected;
+	MPoly *mp;
+	MLoopCol *lcol;
+	int i, j, selected;
 
-	me= get_mesh(ob);
-	if(me==NULL || me->totface==0) return;
+	me = get_mesh(ob);
+	if (me == NULL || me->totpoly == 0) return;
 
-	if(!me->mcol) make_vertexcol(ob);
-	if(!me->mcol) return; /* possible we can't make mcol's */
+	if (!me->mloopcol) make_vertexcol(ob);
+	if (!me->mloopcol) return;  /* possible we can't make mcol's */
 
 
-	selected= (me->editflag & ME_EDIT_PAINT_MASK);
+	selected = (me->editflag & ME_EDIT_PAINT_MASK);
 
-	mf = me->mface;
-	mcol = (unsigned int*)me->mcol;
-	for (i = 0; i < me->totface; i++, mf++, mcol+=4) {
-		if (!selected || mf->flag & ME_FACE_SEL) {
-			mcol[0] = paintcol;
-			mcol[1] = paintcol;
-			mcol[2] = paintcol;
-			mcol[3] = paintcol;
+	mp = me->mpoly;
+	for (i = 0; i < me->totpoly; i++, mp++) {
+		if (!(!selected || mp->flag & ME_FACE_SEL))
+			continue;
+
+		lcol = me->mloopcol + mp->loopstart;
+		for (j = 0; j < mp->totloop; j++, lcol++) {
+			*(int *)lcol = paintcol;
 		}
 	}
 	
+	/* remove stale me->mcol, will be added later */
+	BKE_mesh_tessface_clear(me);
+
 	DAG_id_tag_update(&me->id, 0);
 }
 
@@ -379,73 +472,74 @@ void vpaint_fill(Object *ob, unsigned int paintcol)
 /* fills in the selected faces with the current weight and vertex group */
 void wpaint_fill(VPaint *wp, Object *ob, float paintweight)
 {
-	Mesh *me= ob->data;
-	MFace *mf;
+	Mesh *me = ob->data;
+	MPoly *mp;
 	MDeformWeight *dw, *dw_prev;
-	int vgroup_active, vgroup_mirror= -1;
+	int vgroup_active, vgroup_mirror = -1;
 	unsigned int index;
 
 	/* mutually exclusive, could be made into a */
-	const short paint_selmode= ME_EDIT_PAINT_SEL_MODE(me);
+	const short paint_selmode = ME_EDIT_PAINT_SEL_MODE(me);
 
-	if(me->totface==0 || me->dvert==NULL || !me->mface) return;
+	if (me->totpoly == 0 || me->dvert == NULL || !me->mpoly) return;
 	
 	vgroup_active = ob->actdef - 1;
 
 	/* if mirror painting, find the other group */
-	if(me->editflag & ME_EDIT_MIRROR_X) {
-		vgroup_mirror= wpaint_mirror_vgroup_ensure(ob, vgroup_active);
+	if (me->editflag & ME_EDIT_MIRROR_X) {
+		vgroup_mirror = wpaint_mirror_vgroup_ensure(ob, vgroup_active);
 	}
 	
 	copy_wpaint_prev(wp, me->dvert, me->totvert);
 	
-	for(index=0, mf= me->mface; index < me->totface; index++, mf++) {
-		unsigned int fidx= mf->v4 ? 3:2;
+	for (index = 0, mp = me->mpoly; index < me->totpoly; index++, mp++) {
+		unsigned int fidx = mp->totloop - 1;
 
-		if ((paint_selmode == SCE_SELECT_FACE) && !(mf->flag & ME_FACE_SEL)) {
+		if ((paint_selmode == SCE_SELECT_FACE) && !(mp->flag & ME_FACE_SEL)) {
 			continue;
 		}
 
 		do {
-			unsigned int vidx= *(&mf->v1 + fidx);
+			unsigned int vidx = me->mloop[mp->loopstart + fidx].v;
 
-			if(!me->dvert[vidx].flag) {
-				if((paint_selmode == SCE_SELECT_VERTEX) && !(me->mvert[vidx].flag & SELECT)) {
+			if (!me->dvert[vidx].flag) {
+				if ((paint_selmode == SCE_SELECT_VERTEX) && !(me->mvert[vidx].flag & SELECT)) {
 					continue;
 				}
 
-				dw= defvert_verify_index(&me->dvert[vidx], vgroup_active);
-				if(dw) {
-					dw_prev= defvert_verify_index(wp->wpaint_prev+vidx, vgroup_active);
-					dw_prev->weight= dw->weight; /* set the undo weight */
-					dw->weight= paintweight;
+				dw = defvert_verify_index(&me->dvert[vidx], vgroup_active);
+				if (dw) {
+					dw_prev = defvert_verify_index(wp->wpaint_prev + vidx, vgroup_active);
+					dw_prev->weight = dw->weight; /* set the undo weight */
+					dw->weight = paintweight;
 
-					if(me->editflag & ME_EDIT_MIRROR_X) {	/* x mirror painting */
-						int j= mesh_get_x_mirror_vert(ob, vidx);
-						if(j>=0) {
+					if (me->editflag & ME_EDIT_MIRROR_X) {  /* x mirror painting */
+						int j = mesh_get_x_mirror_vert(ob, vidx);
+						if (j >= 0) {
 							/* copy, not paint again */
-							if(vgroup_mirror != -1) {
-								dw= defvert_verify_index(me->dvert+j, vgroup_mirror);
-								dw_prev= defvert_verify_index(wp->wpaint_prev+j, vgroup_mirror);
-							} else {
-								dw= defvert_verify_index(me->dvert+j, vgroup_active);
-								dw_prev= defvert_verify_index(wp->wpaint_prev+j, vgroup_active);
+							if (vgroup_mirror != -1) {
+								dw = defvert_verify_index(me->dvert + j, vgroup_mirror);
+								dw_prev = defvert_verify_index(wp->wpaint_prev + j, vgroup_mirror);
 							}
-							dw_prev->weight= dw->weight; /* set the undo weight */
-							dw->weight= paintweight;
+							else {
+								dw = defvert_verify_index(me->dvert + j, vgroup_active);
+								dw_prev = defvert_verify_index(wp->wpaint_prev + j, vgroup_active);
+							}
+							dw_prev->weight = dw->weight; /* set the undo weight */
+							dw->weight = paintweight;
 						}
 					}
 				}
-				me->dvert[vidx].flag= 1;
+				me->dvert[vidx].flag = 1;
 			}
 
 		} while (fidx--);
 	}
 
 	{
-		MDeformVert *dv= me->dvert;
-		for(index= me->totvert; index != 0; index--, dv++) {
-			dv->flag= 0;
+		MDeformVert *dv = me->dvert;
+		for (index = me->totvert; index != 0; index--, dv++) {
+			dv->flag = 0;
 		}
 	}
 
@@ -454,194 +548,214 @@ void wpaint_fill(VPaint *wp, Object *ob, float paintweight)
 	DAG_id_tag_update(&me->id, 0);
 }
 
-/* XXX: should be re-implemented as a vertex/weight paint 'color correct' operator
- 
+/* XXX: should be re-implemented as a vertex/weight paint 'color correct' operator */
+#if 0
 void vpaint_dogamma(Scene *scene)
 {
-	VPaint *vp= scene->toolsettings->vpaint;
+	VPaint *vp = scene->toolsettings->vpaint;
 	Mesh *me;
 	Object *ob;
 	float igam, fac;
 	int a, temp;
 	unsigned char *cp, gamtab[256];
 
-	ob= OBACT;
-	me= get_mesh(ob);
+	ob = OBACT;
+	me = get_mesh(ob);
 
-	if(!(ob->mode & OB_MODE_VERTEX_PAINT)) return;
-	if(me==0 || me->mcol==0 || me->totface==0) return;
+	if (!(ob->mode & OB_MODE_VERTEX_PAINT)) return;
+	if (me == 0 || me->mcol == 0 || me->totface == 0) return;
 
-	igam= 1.0/vp->gamma;
-	for(a=0; a<256; a++) {
-		
-		fac= ((float)a)/255.0;
-		fac= vp->mul*pow( fac, igam);
-		
-		temp= 255.9*fac;
-		
-		if(temp<=0) gamtab[a]= 0;
-		else if(temp>=255) gamtab[a]= 255;
-		else gamtab[a]= temp;
+	igam = 1.0 / vp->gamma;
+	for (a = 0; a < 256; a++) {
+
+		fac = ((float)a) / 255.0;
+		fac = vp->mul * pow(fac, igam);
+
+		temp = 255.9 * fac;
+
+		if (temp <= 0) gamtab[a] = 0;
+		else if (temp >= 255) gamtab[a] = 255;
+		else gamtab[a] = temp;
 	}
 
-	a= 4*me->totface;
-	cp= (unsigned char *)me->mcol;
-	while(a--) {
-		
-		cp[1]= gamtab[ cp[1] ];
-		cp[2]= gamtab[ cp[2] ];
-		cp[3]= gamtab[ cp[3] ];
-		
-		cp+= 4;
+	a = 4 * me->totface;
+	cp = (unsigned char *)me->mcol;
+	while (a--) {
+
+		cp[1] = gamtab[cp[1]];
+		cp[2] = gamtab[cp[2]];
+		cp[3] = gamtab[cp[3]];
+
+		cp += 4;
 	}
 }
- */
+#endif
 
-BM_INLINE unsigned int mcol_blend(unsigned int col1, unsigned int col2, int fac)
+BLI_INLINE unsigned int mcol_blend(unsigned int col1, unsigned int col2, int fac)
 {
-	char *cp1, *cp2, *cp;
+	unsigned char *cp1, *cp2, *cp;
 	int mfac;
-	unsigned int col=0;
-	
-	if(fac==0) return col1;
-	if(fac>=255) return col2;
+	unsigned int col = 0;
+
+	if (fac == 0) {
+		return col1;
+	}
+
+	if (fac >= 255) {
+		return col2;
+	}
+
+	mfac = 255 - fac;
+
+	cp1 = (unsigned char *)&col1;
+	cp2 = (unsigned char *)&col2;
+	cp  = (unsigned char *)&col;
+
+	cp[0] = (mfac * cp1[0] + fac * cp2[0]) / 255;
+	cp[1] = (mfac * cp1[1] + fac * cp2[1]) / 255;
+	cp[2] = (mfac * cp1[2] + fac * cp2[2]) / 255;
+	cp[3] = 255;
 
-	mfac= 255-fac;
-	
-	cp1= (char *)&col1;
-	cp2= (char *)&col2;
-	cp=  (char *)&col;
-	
-	cp[0]= 255;
-	cp[1]= (mfac*cp1[1]+fac*cp2[1])/255;
-	cp[2]= (mfac*cp1[2]+fac*cp2[2])/255;
-	cp[3]= (mfac*cp1[3]+fac*cp2[3])/255;
-	
 	return col;
 }
 
-BM_INLINE unsigned int mcol_add(unsigned int col1, unsigned int col2, int fac)
+BLI_INLINE unsigned int mcol_add(unsigned int col1, unsigned int col2, int fac)
 {
-	char *cp1, *cp2, *cp;
+	unsigned char *cp1, *cp2, *cp;
 	int temp;
-	unsigned int col=0;
-	
-	if(fac==0) return col1;
-	
-	cp1= (char *)&col1;
-	cp2= (char *)&col2;
-	cp=  (char *)&col;
-	
-	cp[0]= 255;
-	temp= cp1[1] + ((fac*cp2[1])/255);
-	if(temp>254) cp[1]= 255; else cp[1]= temp;
-	temp= cp1[2] + ((fac*cp2[2])/255);
-	if(temp>254) cp[2]= 255; else cp[2]= temp;
-	temp= cp1[3] + ((fac*cp2[3])/255);
-	if(temp>254) cp[3]= 255; else cp[3]= temp;
+	unsigned int col = 0;
+
+	if (fac == 0) {
+		return col1;
+	}
+
+	cp1 = (unsigned char *)&col1;
+	cp2 = (unsigned char *)&col2;
+	cp  = (unsigned char *)&col;
+
+	temp = cp1[0] + ((fac * cp2[0]) / 255);
+	cp[0] = (temp > 254) ? 255 : temp;
+	temp = cp1[1] + ((fac * cp2[1]) / 255);
+	cp[1] = (temp > 254) ? 255 : temp;
+	temp = cp1[2] + ((fac * cp2[2]) / 255);
+	cp[2] = (temp > 254) ? 255 : temp;
+	cp[3] = 255;
 	
 	return col;
 }
 
-BM_INLINE unsigned int mcol_sub(unsigned int col1, unsigned int col2, int fac)
+BLI_INLINE unsigned int mcol_sub(unsigned int col1, unsigned int col2, int fac)
 {
-	char *cp1, *cp2, *cp;
+	unsigned char *cp1, *cp2, *cp;
 	int temp;
-	unsigned int col=0;
-	
-	if(fac==0) return col1;
-	
-	cp1= (char *)&col1;
-	cp2= (char *)&col2;
-	cp=  (char *)&col;
-	
-	cp[0]= 255;
-	temp= cp1[1] - ((fac*cp2[1])/255);
-	if(temp<0) cp[1]= 0; else cp[1]= temp;
-	temp= cp1[2] - ((fac*cp2[2])/255);
-	if(temp<0) cp[2]= 0; else cp[2]= temp;
-	temp= cp1[3] - ((fac*cp2[3])/255);
-	if(temp<0) cp[3]= 0; else cp[3]= temp;
-	
+	unsigned int col = 0;
+
+	if (fac == 0) {
+		return col1;
+	}
+
+	cp1 = (unsigned char *)&col1;
+	cp2 = (unsigned char *)&col2;
+	cp  = (unsigned char *)&col;
+
+	temp = cp1[0] - ((fac * cp2[0]) / 255);
+	cp1[0] = (temp < 0) ? 0 : temp;
+	temp = cp1[1] - ((fac * cp2[1]) / 255);
+	cp1[1] = (temp < 0) ? 0 : temp;
+	temp = cp1[2] - ((fac * cp2[2]) / 255);
+	cp1[2] = (temp < 0) ? 0 : temp;
+	cp[3] = 255;
+
 	return col;
 }
 
-BM_INLINE unsigned int mcol_mul(unsigned int col1, unsigned int col2, int fac)
+BLI_INLINE unsigned int mcol_mul(unsigned int col1, unsigned int col2, int fac)
 {
-	char *cp1, *cp2, *cp;
+	unsigned char *cp1, *cp2, *cp;
 	int mfac;
-	unsigned int col=0;
-	
-	if(fac==0) return col1;
+	unsigned int col = 0;
+
+	if (fac == 0) {
+		return col1;
+	}
+
+	mfac = 255 - fac;
+
+	cp1 = (unsigned char *)&col1;
+	cp2 = (unsigned char *)&col2;
+	cp  = (unsigned char *)&col;
 
-	mfac= 255-fac;
-	
-	cp1= (char *)&col1;
-	cp2= (char *)&col2;
-	cp=  (char *)&col;
-	
 	/* first mul, then blend the fac */
-	cp[0]= 255;
-	cp[1]= (mfac*cp1[1] + fac*((cp2[1]*cp1[1])/255)  )/255;
-	cp[2]= (mfac*cp1[2] + fac*((cp2[2]*cp1[2])/255)  )/255;
-	cp[3]= (mfac*cp1[3] + fac*((cp2[3]*cp1[3])/255)  )/255;
+	cp[0] = (mfac * cp1[0] + fac * ((cp2[0] * cp1[0]) / 255)) / 255;
+	cp[1] = (mfac * cp1[1] + fac * ((cp2[1] * cp1[1]) / 255)) / 255;
+	cp[2] = (mfac * cp1[2] + fac * ((cp2[2] * cp1[2]) / 255)) / 255;
+	cp[3] = 255;
 
-	
 	return col;
 }
 
-BM_INLINE unsigned int mcol_lighten(unsigned int col1, unsigned int col2, int fac)
+BLI_INLINE unsigned int mcol_lighten(unsigned int col1, unsigned int col2, int fac)
 {
-	char *cp1, *cp2, *cp;
+	unsigned char *cp1, *cp2, *cp;
 	int mfac;
-	unsigned int col=0;
-	
-	if(fac==0) return col1;
-	if(fac>=255) return col2;
+	unsigned int col = 0;
 
-	mfac= 255-fac;
-	
-	cp1= (char *)&col1;
-	cp2= (char *)&col2;
-	cp=  (char *)&col;
-	
-	/* See if are lighter, if so mix, else dont do anything.
-	if the paint col is darker then the original, then ignore */
-	if (cp1[1]+cp1[2]+cp1[3] > cp2[1]+cp2[2]+cp2[3])
+	if (fac == 0) {
 		return col1;
-	
-	cp[0]= 255;
-	cp[1]= (mfac*cp1[1]+fac*cp2[1])/255;
-	cp[2]= (mfac*cp1[2]+fac*cp2[2])/255;
-	cp[3]= (mfac*cp1[3]+fac*cp2[3])/255;
-	
+	}
+	else if (fac >= 255) {
+		return col2;
+	}
+
+	mfac = 255 - fac;
+
+	cp1 = (unsigned char *)&col1;
+	cp2 = (unsigned char *)&col2;
+	cp  = (unsigned char *)&col;
+
+	/* See if are lighter, if so mix, else don't do anything.
+	 * if the paint col is darker then the original, then ignore */
+	if (rgb_to_grayscale_byte(cp1) > rgb_to_grayscale_byte(cp2)) {
+		return col1;
+	}
+
+	cp[0] = (mfac * cp1[0] + fac * cp2[0]) / 255;
+	cp[1] = (mfac * cp1[1] + fac * cp2[1]) / 255;
+	cp[2] = (mfac * cp1[2] + fac * cp2[2]) / 255;
+	cp[3] = 255;
+
 	return col;
 }
 
-BM_INLINE unsigned int mcol_darken(unsigned int col1, unsigned int col2, int fac)
+BLI_INLINE unsigned int mcol_darken(unsigned int col1, unsigned int col2, int fac)
 {
-	char *cp1, *cp2, *cp;
+	unsigned char *cp1, *cp2, *cp;
 	int mfac;
-	unsigned int col=0;
-	
-	if(fac==0) return col1;
-	if(fac>=255) return col2;
+	unsigned int col = 0;
 
-	mfac= 255-fac;
-	
-	cp1= (char *)&col1;
-	cp2= (char *)&col2;
-	cp=  (char *)&col;
-	
-	/* See if were darker, if so mix, else dont do anything.
-	if the paint col is brighter then the original, then ignore */
-	if (cp1[1]+cp1[2]+cp1[3] < cp2[1]+cp2[2]+cp2[3])
+	if (fac == 0) {
 		return col1;
-	
-	cp[0]= 255;
-	cp[1]= (mfac*cp1[1]+fac*cp2[1])/255;
-	cp[2]= (mfac*cp1[2]+fac*cp2[2])/255;
-	cp[3]= (mfac*cp1[3]+fac*cp2[3])/255;
+	}
+	else if (fac >= 255) {
+		return col2;
+	}
+
+	mfac = 255 - fac;
+
+	cp1 = (unsigned char *)&col1;
+	cp2 = (unsigned char *)&col2;
+	cp  = (unsigned char *)&col;
+
+	/* See if were darker, if so mix, else don't do anything.
+	 * if the paint col is brighter then the original, then ignore */
+	if (rgb_to_grayscale_byte(cp1) < rgb_to_grayscale_byte(cp2)) {
+		return col1;
+	}
+
+	cp[0] = (mfac * cp1[0] + fac * cp2[0]) / 255;
+	cp[1] = (mfac * cp1[1] + fac * cp2[1]) / 255;
+	cp[2] = (mfac * cp1[2] + fac * cp2[2]) / 255;
+	cp[3] = 255;
 	return col;
 }
 
@@ -675,24 +789,24 @@ static unsigned int vpaint_blend(VPaint *vp, unsigned int col, unsigned int colo
 	col = vpaint_blend_tool(tool, col, paintcol, alpha_i);
 
 	/* if no spray, clip color adding with colorig & orig alpha */
-	if((vp->flag & VP_SPRAY)==0) {
+	if ((vp->flag & VP_SPRAY) == 0) {
 		unsigned int testcol, a;
 		char *cp, *ct, *co;
 		
 		testcol = vpaint_blend_tool(tool, colorig, paintcol, brush_alpha_value_i);
 		
-		cp= (char *)&col;
-		ct= (char *)&testcol;
-		co= (char *)&colorig;
+		cp = (char *)&col;
+		ct = (char *)&testcol;
+		co = (char *)&colorig;
 		
-		for(a=0; a<4; a++) {
-			if( ct[a]<co[a] ) {
-				if( cp[a]<ct[a] ) cp[a]= ct[a];
-				else if( cp[a]>co[a] ) cp[a]= co[a];
+		for (a = 0; a < 4; a++) {
+			if (ct[a] < co[a]) {
+				if (cp[a] < ct[a]) cp[a] = ct[a];
+				else if (cp[a] > co[a]) cp[a] = co[a];
 			}
 			else {
-				if( cp[a]<co[a] ) cp[a]= co[a];
-				else if( cp[a]>ct[a] ) cp[a]= ct[a];
+				if (cp[a] < co[a]) cp[a] = co[a];
+				else if (cp[a] > ct[a]) cp[a] = ct[a];
 			}
 		}
 	}
@@ -704,32 +818,32 @@ static unsigned int vpaint_blend(VPaint *vp, unsigned int col, unsigned int colo
 static int sample_backbuf_area(ViewContext *vc, int *indexar, int totface, int x, int y, float size)
 {
 	struct ImBuf *ibuf;
-	int a, tot=0, index;
+	int a, tot = 0, index;
 	
-	/* brecht: disabled this because it obviously failes for
-	   brushes with size > 64, why is this here? */
-	/*if(size>64.0) size= 64.0;*/
+	/* brecht: disabled this because it obviously fails for
+	 * brushes with size > 64, why is this here? */
+	/*if (size > 64.0) size = 64.0;*/
 	
-	ibuf= view3d_read_backbuf(vc, x-size, y-size, x+size, y+size);
-	if(ibuf) {
-		unsigned int *rt= ibuf->rect;
+	ibuf = view3d_read_backbuf(vc, x - size, y - size, x + size, y + size);
+	if (ibuf) {
+		unsigned int *rt = ibuf->rect;
 
-		memset(indexar, 0, sizeof(int)*(totface+1));
+		memset(indexar, 0, sizeof(int) * (totface + 1));
 		
-		size= ibuf->x*ibuf->y;
-		while(size--) {
+		size = ibuf->x * ibuf->y;
+		while (size--) {
 				
-			if(*rt) {
-				index= WM_framebuffer_to_index(*rt);
-				if(index>0 && index<=totface)
+			if (*rt) {
+				index = WM_framebuffer_to_index(*rt);
+				if (index > 0 && index <= totface)
 					indexar[index] = 1;
 			}
 		
 			rt++;
 		}
 		
-		for(a=1; a<=totface; a++) {
-			if(indexar[a]) indexar[tot++]= a;
+		for (a = 1; a <= totface; a++) {
+			if (indexar[a]) indexar[tot++] = a;
 		}
 
 		IMB_freeImBuf(ibuf);
@@ -740,7 +854,7 @@ static int sample_backbuf_area(ViewContext *vc, int *indexar, int totface, int x
 
 /* whats _dl mean? */
 static float calc_vp_strength_dl(VPaint *vp, ViewContext *vc, const float *vert_nor,
-                              const float mval[2], const float brush_size_pressure)
+                                 const float mval[2], const float brush_size_pressure)
 {
 	Brush *brush = paint_brush(&vp->paint);
 	float dist_squared;
@@ -748,7 +862,7 @@ static float calc_vp_strength_dl(VPaint *vp, ViewContext *vc, const float *vert_
 
 	project_float_noclip(vc->ar, vert_nor, vertco);
 	sub_v2_v2v2(delta, mval, vertco);
-	dist_squared= dot_v2v2(delta, delta); /* len squared */
+	dist_squared = dot_v2v2(delta, delta); /* len squared */
 	if (dist_squared > brush_size_pressure * brush_size_pressure) {
 		return 0.0f;
 	}
@@ -766,11 +880,11 @@ static float calc_vp_alpha_dl(VPaint *vp, ViewContext *vc,
 	float strength = calc_vp_strength_dl(vp, vc, vert_nor, mval, brush_size_pressure);
 
 	if (strength > 0.0f) {
-		float alpha= brush_alpha_pressure * strength;
+		float alpha = brush_alpha_pressure * strength;
 
-		if(vp->flag & VP_NORMALS) {
+		if (vp->flag & VP_NORMALS) {
 			float dvec[3];
-			const float *no= vert_nor + 3;
+			const float *no = vert_nor + 3;
 
 			/* transpose ! */
 			dvec[2] = dot_v3v3(vpimat[2], no);
@@ -792,27 +906,27 @@ static float calc_vp_alpha_dl(VPaint *vp, ViewContext *vc,
 }
 
 
-BM_INLINE float wval_blend(const float weight, const float paintval, const float alpha)
+BLI_INLINE float wval_blend(const float weight, const float paintval, const float alpha)
 {
 	return (paintval * alpha) + (weight * (1.0f - alpha));
 }
-BM_INLINE float wval_add(const float weight, const float paintval, const float alpha)
+BLI_INLINE float wval_add(const float weight, const float paintval, const float alpha)
 {
 	return weight + (paintval * alpha);
 }
-BM_INLINE float wval_sub(const float weight, const float paintval, const float alpha)
+BLI_INLINE float wval_sub(const float weight, const float paintval, const float alpha)
 {
 	return weight - (paintval * alpha);
 }
-BM_INLINE float wval_mul(const float weight, const float paintval, const float alpha)
-{	/* first mul, then blend the fac */
+BLI_INLINE float wval_mul(const float weight, const float paintval, const float alpha)
+{   /* first mul, then blend the fac */
 	return ((1.0f - alpha) + (alpha * paintval)) * weight;
 }
-BM_INLINE float wval_lighten(const float weight, const float paintval, const float alpha)
+BLI_INLINE float wval_lighten(const float weight, const float paintval, const float alpha)
 {
 	return (weight < paintval) ? wval_blend(weight, paintval, alpha) : weight;
 }
-BM_INLINE float wval_darken(const float weight, const float paintval, const float alpha)
+BLI_INLINE float wval_darken(const float weight, const float paintval, const float alpha)
 {
 	return (weight > paintval) ? wval_blend(weight, paintval, alpha) : weight;
 }
@@ -849,36 +963,36 @@ static float wpaint_blend(VPaint *wp, float weight, float weight_prev,
 	int tool = brush->vertexpaint_tool;
 
 	if (do_flip) {
-		switch(tool) {
+		switch (tool) {
 			case PAINT_BLEND_MIX:
 				paintval = 1.f - paintval; break;
 			case PAINT_BLEND_ADD:
-				tool= PAINT_BLEND_SUB; break;
+				tool = PAINT_BLEND_SUB; break;
 			case PAINT_BLEND_SUB:
-				tool= PAINT_BLEND_ADD; break;
+				tool = PAINT_BLEND_ADD; break;
 			case PAINT_BLEND_LIGHTEN:
-				tool= PAINT_BLEND_DARKEN; break;
+				tool = PAINT_BLEND_DARKEN; break;
 			case PAINT_BLEND_DARKEN:
-				tool= PAINT_BLEND_LIGHTEN; break;
+				tool = PAINT_BLEND_LIGHTEN; break;
 		}
 	}
 	
 	weight = wpaint_blend_tool(tool, weight, paintval, alpha);
 
 	/* delay clamping until the end so multi-paint can function when the active group is at the limits */
-	if(do_multipaint_totsel == FALSE) {
+	if (do_multipaint_totsel == FALSE) {
 		CLAMP(weight, 0.0f, 1.0f);
 	}
 	
 	/* if no spray, clip result with orig weight & orig alpha */
 	if ((wp->flag & VP_SPRAY) == 0) {
-		if(do_multipaint_totsel == FALSE) {
+		if (do_multipaint_totsel == FALSE) {
 			float testw = wpaint_blend_tool(tool, weight_prev, paintval, brush_alpha_value);
 
 			CLAMP(testw, 0.0f, 1.0f);
 			if (testw < weight_prev) {
-				if(weight < testw) weight = testw;
-				else if(weight > weight_prev) weight = weight_prev;
+				if (weight < testw) weight = testw;
+				else if (weight > weight_prev) weight = weight_prev;
 			}
 			else {
 				if (weight > testw) weight = testw;
@@ -899,61 +1013,61 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 	ViewContext vc;
 	Mesh *me;
-	short change= FALSE;
+	short change = FALSE;
 
 	view3d_set_viewcontext(C, &vc);
-	me= get_mesh(vc.obact);
+	me = get_mesh(vc.obact);
 
 	if (me && me->dvert && vc.v3d && vc.rv3d) {
 		int index;
 
 		view3d_operator_needs_opengl(C);
 
-		index= view3d_sample_backbuf(&vc, event->mval[0], event->mval[1]);
+		index = view3d_sample_backbuf(&vc, event->mval[0], event->mval[1]);
 
-		if(index && index<=me->totface) {
-			DerivedMesh *dm= mesh_get_derived_final(vc.scene, vc.obact, CD_MASK_BAREMESH);
+		if (index && index <= me->totpoly) {
+			DerivedMesh *dm = mesh_get_derived_final(vc.scene, vc.obact, CD_MASK_BAREMESH);
 
-			if(dm->getVertCo==NULL) {
+			if (dm->getVertCo == NULL) {
 				BKE_report(op->reports, RPT_WARNING, "The modifier used does not support deformed locations");
 			}
 			else {
-				MFace *mf= ((MFace *)me->mface) + index-1;
-				const int vgroup_active= vc.obact->actdef - 1;
-				ToolSettings *ts= vc.scene->toolsettings;
+				MPoly *mp = ((MPoly *)me->mpoly) + (index - 1);
+				const int vgroup_active = vc.obact->actdef - 1;
+				ToolSettings *ts = vc.scene->toolsettings;
 				float mval_f[2];
-				int v_idx_best= -1;
+				int v_idx_best = -1;
 				int fidx;
-				float len_best= FLT_MAX;
+				float len_best = FLT_MAX;
 
-				mval_f[0]= (float)event->mval[0];
-				mval_f[1]= (float)event->mval[1];
+				mval_f[0] = (float)event->mval[0];
+				mval_f[1] = (float)event->mval[1];
 
-				fidx= mf->v4 ? 3:2;
+				fidx = mp->totloop - 1;
 				do {
 					float co[3], sco[3], len;
-					const int v_idx= (*(&mf->v1 + fidx));
+					const int v_idx = me->mloop[mp->loopstart + fidx].v;
 					dm->getVertCo(dm, v_idx, co);
 					project_float_noclip(vc.ar, co, sco);
-					len= len_squared_v2v2(mval_f, sco);
-					if(len < len_best) {
-						len_best= len;
-						v_idx_best= v_idx;
+					len = len_squared_v2v2(mval_f, sco);
+					if (len < len_best) {
+						len_best = len;
+						v_idx_best = v_idx;
 					}
 				} while (fidx--);
 
-				if(v_idx_best != -1) { /* should always be valid */
-					ts->vgroup_weight= defvert_find_weight(&me->dvert[v_idx_best], vgroup_active);
-					change= TRUE;
+				if (v_idx_best != -1) { /* should always be valid */
+					ts->vgroup_weight = defvert_find_weight(&me->dvert[v_idx_best], vgroup_active);
+					change = TRUE;
 				}
 			}
 			dm->release(dm);
 		}
 	}
 
-	if(change) {
+	if (change) {
 		/* not really correct since the brush didnt change, but redraws the toolbar */
-		WM_main_add_notifier(NC_BRUSH|NA_EDITED, NULL); /* ts->wpaint->paint.brush */
+		WM_main_add_notifier(NC_BRUSH | NA_EDITED, NULL); /* ts->wpaint->paint.brush */
 
 		return OPERATOR_FINISHED;
 	}
@@ -965,74 +1079,74 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, wmEvent *event)
 void PAINT_OT_weight_sample(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Weight Paint Sample Weight";
-	ot->idname= "PAINT_OT_weight_sample";
+	ot->name = "Weight Paint Sample Weight";
+	ot->idname = "PAINT_OT_weight_sample";
 
 	/* api callbacks */
-	ot->invoke= weight_sample_invoke;
-	ot->poll= weight_paint_mode_poll;
+	ot->invoke = weight_sample_invoke;
+	ot->poll = weight_paint_mode_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_UNDO;
+	ot->flag = OPTYPE_UNDO;
 }
 
 /* samples cursor location, and gives menu with vertex groups to activate */
 static EnumPropertyItem *weight_paint_sample_enum_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
 {
 	if (C) {
-		wmWindow *win= CTX_wm_window(C);
-		if(win && win->eventstate) {
+		wmWindow *win = CTX_wm_window(C);
+		if (win && win->eventstate) {
 			ViewContext vc;
 			Mesh *me;
 
 			view3d_set_viewcontext(C, &vc);
-			me= get_mesh(vc.obact);
+			me = get_mesh(vc.obact);
 
 			if (me && me->dvert && vc.v3d && vc.rv3d) {
 				int index;
 
 				view3d_operator_needs_opengl(C);
 
-				index= view3d_sample_backbuf(&vc, win->eventstate->x - vc.ar->winrct.xmin, win->eventstate->y - vc.ar->winrct.ymin);
+				index = view3d_sample_backbuf(&vc, win->eventstate->x - vc.ar->winrct.xmin, win->eventstate->y - vc.ar->winrct.ymin);
 
-				if(index && index<=me->totface) {
-					const int defbase_tot= BLI_countlist(&vc.obact->defbase);
-					if(defbase_tot) {
-						MFace *mf= ((MFace *)me->mface) + index-1;
-						unsigned int fidx= mf->v4 ? 3:2;
-						int *groups= MEM_callocN(defbase_tot*sizeof(int), "groups");
-						int found= FALSE;
+				if (index && index <= me->totpoly) {
+					const int defbase_tot = BLI_countlist(&vc.obact->defbase);
+					if (defbase_tot) {
+						MPoly *mp = ((MPoly *)me->mpoly) + (index - 1);
+						unsigned int fidx = mp->totloop - 1;
+						int *groups = MEM_callocN(defbase_tot * sizeof(int), "groups");
+						int found = FALSE;
 
 						do {
-							MDeformVert *dvert= me->dvert + (*(&mf->v1 + fidx));
-							int i= dvert->totweight;
+							MDeformVert *dvert = me->dvert + me->mloop[mp->loopstart + fidx].v;
+							int i = dvert->totweight;
 							MDeformWeight *dw;
-							for(dw= dvert->dw; i > 0; dw++, i--) {
+							for (dw = dvert->dw; i > 0; dw++, i--) {
 								if (dw->def_nr < defbase_tot) {
-									groups[dw->def_nr]= TRUE;
-									found= TRUE;
+									groups[dw->def_nr] = TRUE;
+									found = TRUE;
 								}
 							}
 						} while (fidx--);
 
-						if(found==FALSE) {
+						if (found == FALSE) {
 							MEM_freeN(groups);
 						}
 						else {
-							EnumPropertyItem *item= NULL, item_tmp= {0};
-							int totitem= 0;
-							int i= 0;
+							EnumPropertyItem *item = NULL, item_tmp = {0};
+							int totitem = 0;
+							int i = 0;
 							bDeformGroup *dg;
-							for(dg= vc.obact->defbase.first; dg && i<defbase_tot; i++, dg= dg->next) {
-								if(groups[i]) {
-									item_tmp.identifier= item_tmp.name= dg->name;
-									item_tmp.value= i;
+							for (dg = vc.obact->defbase.first; dg && i < defbase_tot; i++, dg = dg->next) {
+								if (groups[i]) {
+									item_tmp.identifier = item_tmp.name = dg->name;
+									item_tmp.value = i;
 									RNA_enum_item_add(&item, &totitem, &item_tmp);
 								}
 							}
 
 							RNA_enum_item_end(&item, &totitem);
-							*free= 1;
+							*free = 1;
 
 							MEM_freeN(groups);
 							return item;
@@ -1048,48 +1162,48 @@ static EnumPropertyItem *weight_paint_sample_enum_itemf(bContext *C, PointerRNA
 
 static int weight_sample_group_exec(bContext *C, wmOperator *op)
 {
-	int type= RNA_enum_get(op->ptr, "group");
+	int type = RNA_enum_get(op->ptr, "group");
 	ViewContext vc;
 	view3d_set_viewcontext(C, &vc);
 
 	BLI_assert(type + 1 >= 0);
-	vc.obact->actdef= type + 1;
+	vc.obact->actdef = type + 1;
 
 	DAG_id_tag_update(&vc.obact->id, OB_RECALC_DATA);
-	WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, vc.obact);
+	WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, vc.obact);
 	return OPERATOR_FINISHED;
 }
 
 /* TODO, we could make this a menu into OBJECT_OT_vertex_group_set_active rather than its own operator */
 void PAINT_OT_weight_sample_group(wmOperatorType *ot)
 {
-	PropertyRNA *prop= NULL;
+	PropertyRNA *prop = NULL;
 
 	/* identifiers */
-	ot->name= "Weight Paint Sample Group";
-	ot->idname= "PAINT_OT_weight_sample_group";
+	ot->name = "Weight Paint Sample Group";
+	ot->idname = "PAINT_OT_weight_sample_group";
 
 	/* api callbacks */
-	ot->exec= weight_sample_group_exec;
-	ot->invoke= WM_menu_invoke;
-	ot->poll= weight_paint_mode_poll;
+	ot->exec = weight_sample_group_exec;
+	ot->invoke = WM_menu_invoke;
+	ot->poll = weight_paint_mode_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_UNDO;
+	ot->flag = OPTYPE_UNDO;
 
 	/* keyingset to use (dynamic enum) */
-	prop= RNA_def_enum(ot->srna, "group", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
+	prop = RNA_def_enum(ot->srna, "group", DummyRNA_DEFAULT_items, 0, "Keying Set", "The Keying Set to use");
 	RNA_def_enum_funcs(prop, weight_paint_sample_enum_itemf);
-	ot->prop= prop;
+	ot->prop = prop;
 }
 
 static void do_weight_paint_normalize_all(MDeformVert *dvert, const int defbase_tot, const char *vgroup_validmap)
 {
-	float sum= 0.0f, fac;
-	unsigned int i, tot=0;
+	float sum = 0.0f, fac;
+	unsigned int i, tot = 0;
 	MDeformWeight *dw;
 
-	for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
+	for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
 		if (dw->def_nr < defbase_tot && vgroup_validmap[dw->def_nr]) {
 			tot++;
 			sum += dw->weight;
@@ -1101,11 +1215,11 @@ static void do_weight_paint_normalize_all(MDeformVert *dvert, const int defbase_
 	}
 
 	if (sum != 0.0f) {
-		fac= 1.0f / sum;
+		fac = 1.0f / sum;
 
-		for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
+		for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
 			if (dw->def_nr < defbase_tot && vgroup_validmap[dw->def_nr]) {
-					dw->weight *= fac;
+				dw->weight *= fac;
 			}
 		}
 	}
@@ -1113,7 +1227,7 @@ static void do_weight_paint_normalize_all(MDeformVert *dvert, const int defbase_
 		/* hrmf, not a factor in this case */
 		fac = 1.0f / tot;
 
-		for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
+		for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
 			if (dw->def_nr < defbase_tot && vgroup_validmap[dw->def_nr]) {
 				dw->weight = fac;
 			}
@@ -1128,12 +1242,12 @@ static void do_weight_paint_normalize_all(MDeformVert *dvert, const int defbase_
 static void do_weight_paint_normalize_all_active(MDeformVert *dvert, const int defbase_tot, const char *vgroup_validmap,
                                                  const int vgroup_active)
 {
-	float sum= 0.0f, fac;
-	unsigned int i, tot=0;
+	float sum = 0.0f, fac;
+	unsigned int i, tot = 0;
 	MDeformWeight *dw;
 	float act_weight = 0.0f;
 
-	for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
+	for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
 		if (dw->def_nr < defbase_tot && vgroup_validmap[dw->def_nr]) {
 			if (dw->def_nr != vgroup_active) {
 				sum += dw->weight;
@@ -1152,7 +1266,7 @@ static void do_weight_paint_normalize_all_active(MDeformVert *dvert, const int d
 	if (sum != 0.0f) {
 		fac = (1.0f / sum) * (1.0f - act_weight);
 
-		for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
+		for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
 			if (dw->def_nr < defbase_tot && vgroup_validmap[dw->def_nr]) {
 				if (dw->def_nr != vgroup_active) {
 					dw->weight *= fac;
@@ -1172,7 +1286,7 @@ static void do_weight_paint_normalize_all_active(MDeformVert *dvert, const int d
 		/* paranoid but possibly with float error */
 		CLAMP(fac, 0.0f, 1.0f);
 
-		for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
+		for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
 			if (dw->def_nr < defbase_tot && vgroup_validmap[dw->def_nr]) {
 				if (dw->def_nr != vgroup_active) {
 					dw->weight = fac;
@@ -1183,15 +1297,15 @@ static void do_weight_paint_normalize_all_active(MDeformVert *dvert, const int d
 }
 
 /*
-See if the current deform vertex has a locked group
-*/
+ * See if the current deform vertex has a locked group
+ */
 static char has_locked_group(MDeformVert *dvert, const int defbase_tot,
                              const char *bone_groups, const char *lock_flags)
 {
 	int i;
 	MDeformWeight *dw;
 
-	for (i= dvert->totweight, dw= dvert->dw; i != 0; i--, dw++) {
+	for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
 		if (dw->def_nr < defbase_tot) {
 			if (bone_groups[dw->def_nr] && lock_flags[dw->def_nr] && dw->weight > 0.0f) {
 				return TRUE;
@@ -1202,17 +1316,17 @@ static char has_locked_group(MDeformVert *dvert, const int defbase_tot,
 }
 /* 
  * gen_lck_flags gets the status of "flag" for each bDeformGroup
- *in ob->defbase and returns an array containing them
+ * in ob->defbase and returns an array containing them
  */
-static char *gen_lock_flags(Object* ob, int defbase_tot)
+static char *gen_lock_flags(Object *ob, int defbase_tot)
 {
 	char is_locked = FALSE;
 	int i;
 	//int defbase_tot = BLI_countlist(&ob->defbase);
-	char *lock_flags = MEM_mallocN(defbase_tot*sizeof(char), "defflags");
+	char *lock_flags = MEM_mallocN(defbase_tot * sizeof(char), "defflags");
 	bDeformGroup *defgroup;
 
-	for(i = 0, defgroup = ob->defbase.first; i < defbase_tot && defgroup; defgroup = defgroup->next, i++) {
+	for (i = 0, defgroup = ob->defbase.first; i < defbase_tot && defgroup; defgroup = defgroup->next, i++) {
 		lock_flags[i] = ((defgroup->flag & DG_LOCK_WEIGHT) != 0);
 		is_locked |= lock_flags[i];
 	}
@@ -1227,8 +1341,8 @@ static char *gen_lock_flags(Object* ob, int defbase_tot)
 static int has_locked_group_selected(int defbase_tot, const char *defbase_sel, const char *lock_flags)
 {
 	int i;
-	for(i = 0; i < defbase_tot; i++) {
-		if(defbase_sel[i] && lock_flags[i]) {
+	for (i = 0; i < defbase_tot; i++) {
+		if (defbase_sel[i] && lock_flags[i]) {
 			return TRUE;
 		}
 	}
@@ -1240,11 +1354,11 @@ static int has_locked_group_selected(int defbase_tot, const char *defbase_sel, c
 static int has_unselected_unlocked_bone_group(int defbase_tot, char *defbase_sel, int selected, char *lock_flags, char *vgroup_validmap)
 {
 	int i;
-	if(defbase_tot == selected) {
+	if (defbase_tot == selected) {
 		return FALSE;
 	}
-	for(i = 0; i < defbase_tot; i++) {
-		if(vgroup_validmap[i] && !defbase_sel[i] && !lock_flags[i]) {
+	for (i = 0; i < defbase_tot; i++) {
+		if (vgroup_validmap[i] && !defbase_sel[i] && !lock_flags[i]) {
 			return TRUE;
 		}
 	}
@@ -1259,30 +1373,30 @@ static void multipaint_selection(MDeformVert *dvert, const int defbase_tot, floa
 	MDeformWeight *dw;
 	float val;
 	/* make sure they are all at most 1 after the change */
-	for(i = 0; i < defbase_tot; i++) {
-		if(defbase_sel[i]) {
+	for (i = 0; i < defbase_tot; i++) {
+		if (defbase_sel[i]) {
 			dw = defvert_find_index(dvert, i);
-			if(dw && dw->weight) {
+			if (dw && dw->weight) {
 				val = dw->weight * change;
-				if(val > 1) {
+				if (val > 1) {
 					/* TODO: when the change is reduced, you need to recheck
 					 * the earlier values to make sure they are not 0
 					 * (precision error) */
-					change = 1.0f/dw->weight;
+					change = 1.0f / dw->weight;
 				}
 				/* the value should never reach zero while multi-painting if it
 				 * was nonzero beforehand */
-				if(val <= 0) {
+				if (val <= 0) {
 					return;
 				}
 			}
 		}
 	}
 	/* apply the valid change */
-	for(i = 0; i < defbase_tot; i++) {
-		if(defbase_sel[i]) {
+	for (i = 0; i < defbase_tot; i++) {
+		if (defbase_sel[i]) {
 			dw = defvert_find_index(dvert, i);
-			if(dw && dw->weight) {
+			if (dw && dw->weight) {
 				dw->weight = dw->weight * change;
 			}
 		}
@@ -1306,36 +1420,36 @@ static float redistribute_change(MDeformVert *ndv, const int defbase_tot,
 		/* assume there is no change until you see one */
 		was_change = FALSE;
 		/* change each group by the same amount each time */
-		change = totchange/total_valid;
-		for(i = 0; i < ndv->totweight && total_valid && totchange; i++) {
-			ndw = (ndv->dw+i);
+		change = totchange / total_valid;
+		for (i = 0; i < ndv->totweight && total_valid && totchange; i++) {
+			ndw = (ndv->dw + i);
 
 			/* ignore anything outside the value range */
 			if (ndw->def_nr < defbase_tot) {
 
 				/* change only the groups with a valid status */
-				if(change_status[ndw->def_nr] == change_me) {
+				if (change_status[ndw->def_nr] == change_me) {
 					oldval = ndw->weight;
 					/* if auto normalize is active, don't worry about upper bounds */
-					if(do_auto_normalize == FALSE && ndw->weight + change > 1) {
-						totchange -= 1-ndw->weight;
-						ndw->weight = 1;
+					if (do_auto_normalize == FALSE && ndw->weight + change > 1) {
+						totchange -= 1.0f - ndw->weight;
+						ndw->weight = 1.0f;
 						/* stop the changes to this group */
 						change_status[ndw->def_nr] = changeto;
 						total_valid--;
 					}
-					else if(ndw->weight + change < 0) { /* check the lower bound */
+					else if (ndw->weight + change < 0) { /* check the lower bound */
 						totchange -= ndw->weight;
 						ndw->weight = 0;
 						change_status[ndw->def_nr] = changeto;
 						total_valid--;
 					}
-					else {/* a perfectly valid change occurred to ndw->weight */
+					else { /* a perfectly valid change occurred to ndw->weight */
 						totchange -= change;
 						ndw->weight += change;
 					}
 					/* see if there was a change */
-					if(oldval != ndw->weight) {
+					if (oldval != ndw->weight) {
 						was_change = TRUE;
 					}
 				}
@@ -1343,7 +1457,7 @@ static float redistribute_change(MDeformVert *ndv, const int defbase_tot,
 		}
 		/* don't go again if there was no change, if there is no valid group,
 		 * or there is no change left */
-	} while(was_change && total_valid && totchange);
+	} while (was_change && total_valid && totchange);
 	/* left overs */
 	return totchange;
 }
@@ -1370,17 +1484,17 @@ static void enforce_locks(MDeformVert *odv, MDeformVert *ndv,
 
 	char *change_status;
 
-	if(!lock_flags || !has_locked_group(ndv, defbase_tot, vgroup_validmap, lock_flags)) {
+	if (!lock_flags || !has_locked_group(ndv, defbase_tot, vgroup_validmap, lock_flags)) {
 		return;
 	}
 	/* record if a group was changed, unlocked and not changed, or locked */
-	change_status = MEM_callocN(sizeof(char)*defbase_tot, "unlocked_unchanged");
+	change_status = MEM_callocN(sizeof(char) * defbase_tot, "unlocked_unchanged");
 
-	for(i = 0; i < defbase_tot; i++) {
+	for (i = 0; i < defbase_tot; i++) {
 		ndw = defvert_find_index(ndv, i);
 		odw = defvert_find_index(odv, i);
 		/* the weights are zero, so we can assume a lot */
-		if(!ndw || !odw) {
+		if (!ndw || !odw) {
 			if (!lock_flags[i] && vgroup_validmap[i]) {
 				defvert_verify_index(odv, i);
 				defvert_verify_index(ndv, i);
@@ -1390,10 +1504,10 @@ static void enforce_locks(MDeformVert *odv, MDeformVert *ndv,
 			continue;
 		}
 		/* locked groups should not be changed */
-		if(lock_flags[i]) {
+		if (lock_flags[i]) {
 			ndw->weight = odw->weight;
 		}
-		else if(ndw->weight != odw->weight) { /* changed groups are handled here */
+		else if (ndw->weight != odw->weight) { /* changed groups are handled here */
 			totchange += ndw->weight - odw->weight;
 			changed_sum += ndw->weight;
 			change_status[i] = 2; /* was altered already */
@@ -1406,26 +1520,26 @@ static void enforce_locks(MDeformVert *odv, MDeformVert *ndv,
 		}
 	}
 	/* if there was any change, redistribute it */
-	if(total_changed) {
+	if (total_changed) {
 		/* auto normalize will allow weights to temporarily go above 1 in redistribution */
-		if(vgroup_validmap && total_changed < 0 && total_valid) {
+		if (vgroup_validmap && total_changed < 0 && total_valid) {
 			totchange_allowed = total_valid;
 		}
-		/* the way you modify the unlocked+unchanged groups is different depending
+		/* the way you modify the unlocked + unchanged groups is different depending
 		 * on whether or not you are painting the weight(s) up or down */
-		if(totchange < 0) {
+		if (totchange < 0) {
 			totchange_allowed = total_valid - totchange_allowed;
 		}
 		else {
 			totchange_allowed *= -1;
 		}
 		/* there needs to be change allowed, or you should not bother */
-		if(totchange_allowed) {
+		if (totchange_allowed) {
 			left_over = 0;
-			if(fabsf(totchange_allowed) < fabsf(totchange)) {
+			if (fabsf(totchange_allowed) < fabsf(totchange)) {
 				/* this amount goes back onto the changed, unlocked weights */
 				left_over = fabsf(fabsf(totchange) - fabsf(totchange_allowed));
-				if(totchange > 0) {
+				if (totchange > 0) {
 					left_over *= -1;
 				}
 			}
@@ -1436,9 +1550,9 @@ static void enforce_locks(MDeformVert *odv, MDeformVert *ndv,
 			/* move the weight evenly between the allowed groups, move excess back onto the used groups based on the change */
 			totchange_allowed = redistribute_change(ndv, defbase_tot, change_status, 1, -1, totchange_allowed, total_valid, do_auto_normalize);
 			left_over += totchange_allowed;
-			if(left_over) {
+			if (left_over) {
 				/* more than one nonzero weights were changed with the same ratio with multipaint, so keep them changed that way! */
-				if(total_changed > 1 && do_multipaint) {
+				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);
 				}	
@@ -1451,11 +1565,11 @@ 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;
+			MDeformWeight *dw_old = odv->dw;
+			MDeformWeight *dw_new = ndv->dw;
 
-			for (i= odv->totweight; i != 0; i--, dw_old++, dw_new++) {
-				dw_new->weight= dw_old->weight;
+			for (i = odv->totweight; i != 0; i--, dw_old++, dw_new++) {
+				dw_new->weight = dw_old->weight;
 			}
 		}
 	}
@@ -1468,17 +1582,17 @@ static float get_mp_change(MDeformVert *odv, const int defbase_tot, const char *
 {
 	float selwsum = 0.0f;
 	unsigned int i;
-	MDeformWeight *dw= odv->dw;
+	MDeformWeight *dw = odv->dw;
 
-	for (i= odv->totweight; i != 0; i--, dw++) {
+	for (i = odv->totweight; i != 0; i--, dw++) {
 		if (dw->def_nr < defbase_tot) {
-			if(defbase_sel[dw->def_nr]) {
+			if (defbase_sel[dw->def_nr]) {
 				selwsum += dw->weight;
 			}
 		}
 	}
-	if(selwsum && selwsum+brush_change > 0) {
-		return (selwsum+brush_change)/selwsum;
+	if (selwsum && selwsum + brush_change > 0) {
+		return (selwsum + brush_change) / selwsum;
 	}
 	return 0.0f;
 }
@@ -1487,11 +1601,11 @@ static float get_mp_change(MDeformVert *odv, const int defbase_tot, const char *
  * it assumes you already have the correct pointer index */
 static void defvert_reset_to_prev(MDeformVert *dv_prev, MDeformVert *dv)
 {
-	MDeformWeight *dw= dv->dw;
+	MDeformWeight *dw = dv->dw;
 	MDeformWeight *dw_prev;
 	unsigned int i;
-	for (i= dv->totweight; i != 0; i--, dw++) {
-		dw_prev= defvert_find_index(dv_prev, dw->def_nr);
+	for (i = dv->totweight; i != 0; i--, dw++) {
+		dw_prev = defvert_find_index(dv_prev, dw->def_nr);
 		/* if there was no w when there is a d, then the old weight was 0 */
 		dw->weight = dw_prev ? dw_prev->weight : 0.0f;
 	}
@@ -1499,9 +1613,9 @@ static void defvert_reset_to_prev(MDeformVert *dv_prev, MDeformVert *dv)
 
 static void clamp_weights(MDeformVert *dvert)
 {
-	MDeformWeight *dw= dvert->dw;
+	MDeformWeight *dw = dvert->dw;
 	unsigned int i;
-	for (i= dvert->totweight; i != 0; i--, dw++) {
+	for (i = dvert->totweight; i != 0; i--, dw++) {
 		CLAMP(dw->weight, 0.0f, 1.0f);
 	}
 }
@@ -1548,10 +1662,10 @@ static int apply_mp_locks_normalize(Mesh *me, const WeightPaintInfo *wpi,
                                     float change, float oldChange,
                                     float oldw, float neww)
 {
-	MDeformVert *dv= &me->dvert[index];
-	MDeformVert dv_test= {NULL};
+	MDeformVert *dv = &me->dvert[index];
+	MDeformVert dv_test = {NULL};
 
-	dv_test.dw= MEM_dupallocN(dv->dw);
+	dv_test.dw = MEM_dupallocN(dv->dw);
 	dv_test.flag = dv->flag;
 	dv_test.totweight = dv->totweight;
 	/* do not multi-paint if a locked group is selected or the active group is locked
@@ -1560,8 +1674,8 @@ static int apply_mp_locks_normalize(Mesh *me, const WeightPaintInfo *wpi,
 	     ((wpi->lock_flags[dw->def_nr] == FALSE) && /* def_nr range has to be checked for by caller */
 	      has_locked_group_selected(wpi->defbase_tot, wpi->defbase_sel, wpi->lock_flags) == FALSE))
 	{
-		if(wpi->do_multipaint && wpi->defbase_tot_sel > 1) {
-			if(change && change!=1) {
+		if (wpi->do_multipaint && wpi->defbase_tot_sel > 1) {
+			if (change && change != 1) {
 				multipaint_selection(dv, wpi->defbase_tot, change, wpi->defbase_sel);
 			}
 		}
@@ -1578,16 +1692,16 @@ static int apply_mp_locks_normalize(Mesh *me, const WeightPaintInfo *wpi,
 		do_weight_paint_normalize_all(dv, wpi->defbase_tot, wpi->vgroup_validmap);
 	}
 
-	if(oldChange && wpi->do_multipaint && wpi->defbase_tot_sel > 1) {
-		if(tdw->weight != oldw) {
-			if(neww > oldw) {
-				if(tdw->weight <= oldw) {
+	if (oldChange && wpi->do_multipaint && wpi->defbase_tot_sel > 1) {
+		if (tdw->weight != oldw) {
+			if (neww > oldw) {
+				if (tdw->weight <= oldw) {
 					MEM_freeN(dv_test.dw);
 					return TRUE;
 				}
 			}
 			else {
-				if(tdw->weight >= oldw) {
+				if (tdw->weight >= oldw) {
 					MEM_freeN(dv_test.dw);
 					return TRUE;
 				}
@@ -1603,8 +1717,8 @@ static int apply_mp_locks_normalize(Mesh *me, const WeightPaintInfo *wpi,
 static int get_first_selected_nonzero_weight(MDeformVert *dvert, const int defbase_tot, const char *defbase_sel)
 {
 	int i;
-	MDeformWeight *dw= dvert->dw;
-	for(i=0; i< dvert->totweight; i++, dw++) {
+	MDeformWeight *dw = dvert->dw;
+	for (i = 0; i < dvert->totweight; i++, dw++) {
 		if (dw->def_nr < defbase_tot) {
 			if (defbase_sel[dw->def_nr] && dw->weight > 0.0f) {
 				return i;
@@ -1618,14 +1732,15 @@ static int get_first_selected_nonzero_weight(MDeformVert *dvert, const int defba
 static char *wpaint_make_validmap(Object *ob);
 
 
-static void do_weight_paint_vertex(/* vars which remain the same for every vert */
-                                   VPaint *wp, Object *ob, const WeightPaintInfo *wpi,
-                                   /* vars which change on each stroke */
-                                   const unsigned int index, float alpha, float paintweight
-                                   )
+static void do_weight_paint_vertex(
+        /* vars which remain the same for every vert */
+        VPaint *wp, Object *ob, const WeightPaintInfo *wpi,
+        /* vars which change on each stroke */
+        const unsigned int index, float alpha, float paintweight
+        )
 {
-	Mesh *me= ob->data;
-	MDeformVert *dv= &me->dvert[index];
+	Mesh *me = ob->data;
+	MDeformVert *dv = &me->dvert[index];
 	
 	MDeformWeight *dw, *dw_prev;
 
@@ -1638,16 +1753,16 @@ static void do_weight_paint_vertex(/* vars which remain the same for every vert
 
 	const short do_multipaint_totsel = (wpi->do_multipaint && wpi->defbase_tot_sel > 1);
 
-	if(wp->flag & VP_ONLYVGROUP) {
-		dw= defvert_find_index(dv, wpi->vgroup_active);
-		dw_prev= defvert_find_index(wp->wpaint_prev+index, wpi->vgroup_active);
+	if (wp->flag & VP_ONLYVGROUP) {
+		dw = defvert_find_index(dv, wpi->vgroup_active);
+		dw_prev = defvert_find_index(wp->wpaint_prev + index, wpi->vgroup_active);
 	}
 	else {
-		dw= defvert_verify_index(dv, wpi->vgroup_active);
-		dw_prev= defvert_verify_index(wp->wpaint_prev+index, wpi->vgroup_active);
+		dw = defvert_verify_index(dv, wpi->vgroup_active);
+		dw_prev = defvert_verify_index(wp->wpaint_prev + index, wpi->vgroup_active);
 	}
 
-	if(dw==NULL || dw_prev==NULL) {
+	if (dw == NULL || dw_prev == NULL) {
 		return;
 	}
 
@@ -1717,7 +1832,7 @@ static void do_weight_paint_vertex(/* vars which remain the same for every vert
 		 * can give wrong results [#26193], least confusing if normalize is done last */
 
 		/* apply mirror */
-		if(index_mirr != -1) {
+		if (index_mirr != -1) {
 			/* copy, not paint again */
 			dw_mirr->weight = dw->weight;
 		}
@@ -1726,7 +1841,7 @@ static void do_weight_paint_vertex(/* vars which remain the same for every vert
 		if (wpi->do_auto_normalize) {
 			/* note on normalize - this used to be applied after painting and normalize all weights,
 			 * in some ways this is good because there is feedback where the more weights involved would
-			 * 'risist' so you couldn't instantly zero out other weights by painting 1.0 on the active.
+			 * 'resist' so you couldn't instantly zero out other weights by painting 1.0 on the active.
 			 *
 			 * However this gave a problem since applying mirror, then normalize both verts
 			 * the resulting weight wont match on both sides.
@@ -1750,7 +1865,7 @@ static void do_weight_paint_vertex(/* vars which remain the same for every vert
 					 * - auto normalize is enabled
 					 * - the group you are painting onto has a L / R version
 					 *
-					 * We wan't L/R vgroups to have the same weight but this cant be if both are over 0.5,
+					 * We want L/R vgroups to have the same weight but this cant be if both are over 0.5,
 					 * We _could_ have special check for that, but this would need its own normalize function which
 					 * holds 2 groups from changing at once.
 					 *
@@ -1768,12 +1883,12 @@ static void do_weight_paint_vertex(/* vars which remain the same for every vert
 		/* use locks and/or multipaint */
 		float oldw;
 		float neww;
-		float testw=0;
+		float testw = 0;
 		float change = 0;
 		float oldChange = 0;
 		int i;
 		MDeformWeight *tdw = NULL, *tdw_prev;
-		MDeformVert dv_copy= {NULL};
+		MDeformVert dv_copy = {NULL};
 
 		oldw = dw->weight;
 		neww = wpaint_blend(wp, dw->weight, dw_prev->weight, alpha, paintweight,
@@ -1781,16 +1896,16 @@ static void do_weight_paint_vertex(/* vars which remain the same for every vert
 		
 		/* setup multi-paint */
 		if (do_multipaint_totsel) {
-			dv_copy.dw= MEM_dupallocN(dv->dw);
+			dv_copy.dw = MEM_dupallocN(dv->dw);
 			dv_copy.flag = dv->flag;
 			dv_copy.totweight = dv->totweight;
 			tdw = dw;
 			tdw_prev = dw_prev;
 			change = get_mp_change(&wp->wpaint_prev[index], wpi->defbase_tot, wpi->defbase_sel, neww - oldw);
-			if(change) {
-				if(!tdw->weight) {
+			if (change) {
+				if (!tdw->weight) {
 					i = get_first_selected_nonzero_weight(dv, wpi->defbase_tot, wpi->defbase_sel);
-					if(i>=0) {
+					if (i >= 0) {
 						tdw = &(dv->dw[i]);
 						tdw_prev = defvert_verify_index(&wp->wpaint_prev[index], tdw->def_nr);
 					}
@@ -1798,14 +1913,14 @@ static void do_weight_paint_vertex(/* vars which remain the same for every vert
 						change = 0;
 					}
 				}
-				if(change && tdw_prev->weight && tdw_prev->weight * change) {
-					if(tdw->weight != tdw_prev->weight) {
-						oldChange = tdw->weight/tdw_prev->weight;
-						testw = tdw_prev->weight*change;
-						if( testw > tdw_prev->weight ) {
-							if(change > oldChange) {
+				if (change && tdw_prev->weight && tdw_prev->weight * change) {
+					if (tdw->weight != tdw_prev->weight) {
+						oldChange = tdw->weight / tdw_prev->weight;
+						testw = tdw_prev->weight * change;
+						if (testw > tdw_prev->weight) {
+							if (change > oldChange) {
 								/* reset the weights and use the new change */
-								defvert_reset_to_prev(wp->wpaint_prev+index, dv);
+								defvert_reset_to_prev(wp->wpaint_prev + index, dv);
 							}
 							else {
 								/* the old change was more significant, so set
@@ -1814,8 +1929,8 @@ static void do_weight_paint_vertex(/* vars which remain the same for every vert
 							}
 						}
 						else {
-							if(change < oldChange) {
-								defvert_reset_to_prev(wp->wpaint_prev+index, dv);
+							if (change < oldChange) {
+								defvert_reset_to_prev(wp->wpaint_prev + index, dv);
 							}
 							else {
 								change = 0;
@@ -1829,12 +1944,12 @@ static void do_weight_paint_vertex(/* vars which remain the same for every vert
 			}
 		}
 		
-		if(apply_mp_locks_normalize(me, wpi, index, dw, tdw, change, oldChange, oldw, neww)) {
+		if (apply_mp_locks_normalize(me, wpi, index, dw, tdw, change, oldChange, oldw, neww)) {
 			defvert_reset_to_prev(&dv_copy, dv);
 			change = 0;
 			oldChange = 0;
 		}
-		if(dv_copy.dw) {
+		if (dv_copy.dw) {
 			MEM_freeN(dv_copy.dw);
 		}
 #if 0
@@ -1842,12 +1957,12 @@ static void do_weight_paint_vertex(/* vars which remain the same for every vert
 		dw = defvert_find_index(dv, vgroup);
 #else
 		dw = NULL; /* UNUSED after assignment, set to NULL to ensuyre we don't
-			        * use again, we thats needed un-ifdef the line above */
+		            * use again, we thats needed un-ifdef the line above */
 		(void)dw;  /* quiet warnigns */
 #endif
 
 		/* x mirror painting */
-		if(index_mirr != -1) {
+		if (index_mirr != -1) {
 			/* copy, not paint again */
 
 			/* dw_mirr->weight = dw->weight; */  /* TODO, explain the logic in not assigning weight! - campbell */
@@ -1859,32 +1974,32 @@ static void do_weight_paint_vertex(/* vars which remain the same for every vert
 
 /* *************** set wpaint operator ****************** */
 
-static int set_wpaint(bContext *C, wmOperator *UNUSED(op))		/* toggle */
+static int set_wpaint(bContext *C, wmOperator *UNUSED(op))  /* toggle */
 {		
-	Object *ob= CTX_data_active_object(C);
-	Scene *scene= CTX_data_scene(C);
-	VPaint *wp= scene->toolsettings->wpaint;
+	Object *ob = CTX_data_active_object(C);
+	Scene *scene = CTX_data_scene(C);
+	VPaint *wp = scene->toolsettings->wpaint;
 	Mesh *me;
 	
-	me= get_mesh(ob);
-	if(ob->id.lib || me==NULL) return OPERATOR_PASS_THROUGH;
+	me = get_mesh(ob);
+	if (ob->id.lib || me == NULL) return OPERATOR_PASS_THROUGH;
 	
-	if(ob->mode & OB_MODE_WEIGHT_PAINT) ob->mode &= ~OB_MODE_WEIGHT_PAINT;
+	if (ob->mode & OB_MODE_WEIGHT_PAINT) ob->mode &= ~OB_MODE_WEIGHT_PAINT;
 	else ob->mode |= OB_MODE_WEIGHT_PAINT;
 	
 	
 	/* Weightpaint works by overriding colors in mesh,
-		* so need to make sure we recalc on enter and
-		* exit (exit needs doing regardless because we
-				* should redeform).
-		*/
+	 * so need to make sure we recalc on enter and
+	 * exit (exit needs doing regardless because we
+	 * should redeform).
+	 */
 	DAG_id_tag_update(&me->id, 0);
 	
-	if(ob->mode & OB_MODE_WEIGHT_PAINT) {
+	if (ob->mode & OB_MODE_WEIGHT_PAINT) {
 		Object *par;
 		
-		if(wp==NULL)
-			wp= scene->toolsettings->wpaint= new_vpaint(1);
+		if (wp == NULL)
+			wp = scene->toolsettings->wpaint = new_vpaint(1);
 
 		paint_init(&wp->paint, PAINT_CURSOR_WEIGHT_PAINT);
 		paint_cursor_start(C, weight_paint_poll);
@@ -1892,11 +2007,11 @@ static int set_wpaint(bContext *C, wmOperator *UNUSED(op))		/* toggle */
 		mesh_octree_table(ob, NULL, NULL, 's');
 		
 		/* verify if active weight group is also active bone */
-		par= modifiers_isDeformedByArmature(ob);
-		if(par && (par->mode & OB_MODE_POSE)) {
-			bArmature *arm= par->data;
+		par = modifiers_isDeformedByArmature(ob);
+		if (par && (par->mode & OB_MODE_POSE)) {
+			bArmature *arm = par->data;
 
-			if(arm->act_bone)
+			if (arm->act_bone)
 				ED_vgroup_select_by_name(ob, arm->act_bone->name);
 		}
 	}
@@ -1905,7 +2020,7 @@ static int set_wpaint(bContext *C, wmOperator *UNUSED(op))		/* toggle */
 		mesh_mirrtopo_table(NULL, 'e');
 	}
 	
-	WM_event_add_notifier(C, NC_SCENE|ND_MODE, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene);
 	
 	return OPERATOR_FINISHED;
 }
@@ -1913,12 +2028,12 @@ static int set_wpaint(bContext *C, wmOperator *UNUSED(op))		/* toggle */
 /* for switching to/from mode */
 static int paint_poll_test(bContext *C)
 {
-	Object *ob= CTX_data_active_object(C);
-	if(CTX_data_edit_object(C))
+	Object *ob = CTX_data_active_object(C);
+	if (CTX_data_edit_object(C))
 		return 0;
-	if(CTX_data_active_object(C)==NULL)
+	if (CTX_data_active_object(C) == NULL)
 		return 0;
-	if(!ob->data || ((ID *)ob->data)->lib)
+	if (!ob->data || ((ID *)ob->data)->lib)
 		return 0;
 	return 1;
 }
@@ -1927,15 +2042,15 @@ void PAINT_OT_weight_paint_toggle(wmOperatorType *ot)
 {
 	
 	/* identifiers */
-	ot->name= "Weight Paint Mode";
-	ot->idname= "PAINT_OT_weight_paint_toggle";
+	ot->name = "Weight Paint Mode";
+	ot->idname = "PAINT_OT_weight_paint_toggle";
 	
 	/* api callbacks */
-	ot->exec= set_wpaint;
-	ot->poll= paint_poll_test;
+	ot->exec = set_wpaint;
+	ot->poll = paint_poll_test;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 }
 
@@ -1949,8 +2064,8 @@ struct WPaintData {
 	float *vertexcosnos;
 	float wpimat[3][3];
 	
-	/*variables for auto normalize*/
-	const char *vgroup_validmap; /*stores if vgroups tie to deforming bones or not*/
+	/* variables for auto normalize */
+	const char *vgroup_validmap; /* stores if vgroups tie to deforming bones or not */
 	const char *lock_flags;
 	int defbase_tot;
 };
@@ -1961,32 +2076,32 @@ static char *wpaint_make_validmap(Object *ob)
 	ModifierData *md;
 	char *vgroup_validmap;
 	GHash *gh;
-	int i, step1=1;
+	int i, step1 = 1;
 
-	if(ob->defbase.first == NULL) {
+	if (ob->defbase.first == NULL) {
 		return NULL;
 	}
 
-	gh= BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "wpaint_make_validmap gh");
+	gh = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "wpaint_make_validmap gh");
 
-	/*add all names to a hash table*/
-	for (dg=ob->defbase.first; dg; dg=dg->next) {
+	/* add all names to a hash table */
+	for (dg = ob->defbase.first; dg; dg = dg->next) {
 		BLI_ghash_insert(gh, dg->name, NULL);
 	}
 
-	/*now loop through the armature modifiers and identify deform bones*/
-	for (md = ob->modifiers.first; md; md= !md->next && step1 ? (step1=0), modifiers_getVirtualModifierList(ob) : md->next) {
-		if (!(md->mode & (eModifierMode_Realtime|eModifierMode_Virtual)))
+	/* now loop through the armature modifiers and identify deform bones */
+	for (md = ob->modifiers.first; md; md = !md->next && step1 ? (step1 = 0), modifiers_getVirtualModifierList(ob) : md->next) {
+		if (!(md->mode & (eModifierMode_Realtime | eModifierMode_Virtual)))
 			continue;
 
 		if (md->type == eModifierType_Armature) {
-			ArmatureModifierData *amd= (ArmatureModifierData*) md;
+			ArmatureModifierData *amd = (ArmatureModifierData *) md;
 
-			if(amd->object && amd->object->pose) {
-				bPose *pose= amd->object->pose;
+			if (amd->object && amd->object->pose) {
+				bPose *pose = amd->object->pose;
 				bPoseChannel *chan;
 				
-				for (chan=pose->chanbase.first; chan; chan=chan->next) {
+				for (chan = pose->chanbase.first; chan; chan = chan->next) {
 					if (chan->bone->flag & BONE_NO_DEFORM)
 						continue;
 
@@ -1999,11 +2114,11 @@ static char *wpaint_make_validmap(Object *ob)
 		}
 	}
 
-	vgroup_validmap= MEM_mallocN(BLI_ghash_size(gh), "wpaint valid map");
+	vgroup_validmap = MEM_mallocN(BLI_ghash_size(gh), "wpaint valid map");
 
-	/*add all names to a hash table*/
-	for (dg=ob->defbase.first, i=0; dg; dg=dg->next, i++) {
-		vgroup_validmap[i]= (BLI_ghash_lookup(gh, dg->name) != NULL);
+	/* add all names to a hash table */
+	for (dg = ob->defbase.first, i = 0; dg; dg = dg->next, i++) {
+		vgroup_validmap[i] = (BLI_ghash_lookup(gh, dg->name) != NULL);
 	}
 
 	BLI_assert(i == BLI_ghash_size(gh));
@@ -2015,57 +2130,57 @@ static char *wpaint_make_validmap(Object *ob)
 
 static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	struct PaintStroke *stroke = op->customdata;
-	ToolSettings *ts= scene->toolsettings;
-	VPaint *wp= ts->wpaint;
-	Object *ob= CTX_data_active_object(C);
+	ToolSettings *ts = scene->toolsettings;
+	VPaint *wp = ts->wpaint;
+	Object *ob = CTX_data_active_object(C);
 	struct WPaintData *wpd;
 	Mesh *me;
 	bDeformGroup *dg;
 
 	float mat[4][4], imat[4][4];
 	
-	if(scene->obedit) {
+	if (scene->obedit) {
 		return FALSE;
 	}
 	
-	me= get_mesh(ob);
-	if(me==NULL || me->totface==0) return OPERATOR_PASS_THROUGH;
+	me = get_mesh(ob);
+	if (me == NULL || me->totpoly == 0) return OPERATOR_PASS_THROUGH;
 	
 	/* if nothing was added yet, we make dverts and a vertex deform group */
 	if (!me->dvert) {
 		ED_vgroup_data_create(&me->id);
-		WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
+		WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
 	}
 
 	/* this happens on a Bone select, when no vgroup existed yet */
 	if (ob->actdef <= 0) {
 		Object *modob;
-		if((modob = modifiers_isDeformedByArmature(ob))) {
-			Bone *actbone= ((bArmature *)modob->data)->act_bone;
-			if(actbone) {
-				bPoseChannel *pchan= get_pose_channel(modob->pose, actbone->name);
-
-				if(pchan) {
-					bDeformGroup *dg= defgroup_find_name(ob, pchan->name);
-					if(dg==NULL) {
-						dg= ED_vgroup_add_name(ob, pchan->name);	/* sets actdef */
+		if ((modob = modifiers_isDeformedByArmature(ob))) {
+			Bone *actbone = ((bArmature *)modob->data)->act_bone;
+			if (actbone) {
+				bPoseChannel *pchan = get_pose_channel(modob->pose, actbone->name);
+
+				if (pchan) {
+					bDeformGroup *dg = defgroup_find_name(ob, pchan->name);
+					if (dg == NULL) {
+						dg = ED_vgroup_add_name(ob, pchan->name);  /* sets actdef */
 					}
 					else {
 						int actdef = 1 + BLI_findindex(&ob->defbase, dg);
 						BLI_assert(actdef >= 0);
-						ob->actdef= actdef;
+						ob->actdef = actdef;
 					}
 				}
 			}
 		}
 	}
-	if(ob->defbase.first==NULL) {
+	if (ob->defbase.first == NULL) {
 		ED_vgroup_add(ob);
 	}
 
-	/* ensure we dont try paint onto an invalid group */
+	/* ensure we don't try paint onto an invalid group */
 	if (ob->actdef <= 0) {
 		BKE_report(op->reports, RPT_WARNING, "No active vertex group for painting, aborting");
 		return FALSE;
@@ -2073,7 +2188,7 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED
 
 	/* 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));
+	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;
@@ -2081,7 +2196,7 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED
 
 	/* ALLOCATIONS! no return after this line */
 	/* make mode data storage */
-	wpd= MEM_callocN(sizeof(struct WPaintData), "WPaintData");
+	wpd = MEM_callocN(sizeof(struct WPaintData), "WPaintData");
 	paint_stroke_set_mode_data(stroke, wpd);
 	view3d_set_viewcontext(C, &wpd->vc);
 
@@ -2089,7 +2204,7 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED
 	wpd->vgroup_mirror = -1;
 
 	/* set up auto-normalize, and generate map for detecting which
-	 * vgroups affect deform bones*/
+	 * vgroups affect deform bones */
 	wpd->defbase_tot = BLI_countlist(&ob->defbase);
 	wpd->lock_flags = gen_lock_flags(ob, wpd->defbase_tot);
 	if (ts->auto_normalize || ts->multipaint || wpd->lock_flags) {
@@ -2097,8 +2212,8 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED
 	}
 
 	/* painting on subsurfs should give correct points too, this returns me->totvert amount */
-	wpd->vertexcosnos= mesh_get_mapped_verts_nors(scene, ob);
-	wpd->indexar= get_indexarray(me);
+	wpd->vertexcosnos = mesh_get_mapped_verts_nors(scene, ob);
+	wpd->indexar = get_indexarray(me);
 	copy_wpaint_prev(wp, me->dvert, me->totvert);
 
 	/* imat for normals */
@@ -2107,7 +2222,7 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED
 	copy_m3_m4(wpd->wpimat, imat);
 
 	/* if mirror painting, find the other group */
-	if(me->editflag & ME_EDIT_MIRROR_X) {
+	if (me->editflag & ME_EDIT_MIRROR_X) {
 		wpd->vgroup_mirror = wpaint_mirror_vgroup_ensure(ob, wpd->vgroup_active);
 	}
 	
@@ -2116,11 +2231,11 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *UNUSED
 
 static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, PointerRNA *itemptr)
 {
-	Scene *scene= CTX_data_scene(C);
-	ToolSettings *ts= CTX_data_tool_settings(C);
-	VPaint *wp= ts->wpaint;
+	Scene *scene = CTX_data_scene(C);
+	ToolSettings *ts = CTX_data_tool_settings(C);
+	VPaint *wp = ts->wpaint;
 	Brush *brush = paint_brush(&wp->paint);
-	struct WPaintData *wpd= paint_stroke_mode_data(stroke);
+	struct WPaintData *wpd = paint_stroke_mode_data(stroke);
 	ViewContext *vc;
 	Object *ob;
 	Mesh *me;
@@ -2139,7 +2254,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
 	const float brush_alpha_value = brush_alpha(scene, brush);
 	const float brush_alpha_pressure = brush_alpha_value * (brush_use_alpha_pressure(scene, brush) ? pressure : 1.0f);
 
-	/* intentionally dont initialize as NULL, make sure we initialize all members below */
+	/* intentionally don't initialize as NULL, make sure we initialize all members below */
 	WeightPaintInfo wpi;
 
 	/* cannot paint if there is no stroke data */
@@ -2150,10 +2265,10 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
 		return;
 	}
 		
-	vc= &wpd->vc;
-	ob= vc->obact;
-	me= ob->data;
-	indexar= wpd->indexar;
+	vc = &wpd->vc;
+	ob = vc->obact;
+	me = ob->data;
+	indexar = wpd->indexar;
 	
 	view3d_operator_needs_opengl(C);
 		
@@ -2161,117 +2276,115 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
 	mult_m4_m4m4(mat, vc->rv3d->persmat, ob->obmat);
 
 	RNA_float_get_array(itemptr, "mouse", mval);
-	mval[0]-= vc->ar->winrct.xmin;
-	mval[1]-= vc->ar->winrct.ymin;
+	mval[0] -= vc->ar->winrct.xmin;
+	mval[1] -= vc->ar->winrct.ymin;
 
 
 
 	/* *** setup WeightPaintInfo - pass onto do_weight_paint_vertex *** */
-	wpi.defbase_tot=        wpd->defbase_tot;
-	defbase_sel=            MEM_mallocN(wpi.defbase_tot*sizeof(char), "wpi.defbase_sel");
-	wpi.defbase_tot_sel=    get_selected_defgroups(ob, defbase_sel, wpi.defbase_tot);
-	wpi.defbase_sel=        defbase_sel; /* so we can stay const */
-	if(wpi.defbase_tot_sel == 0 && ob->actdef > 0) wpi.defbase_tot_sel = 1;
-
-	wpi.defbase_tot_unsel=  wpi.defbase_tot - wpi.defbase_tot_sel;
-	wpi.vgroup_active=      wpd->vgroup_active;
-	wpi.vgroup_mirror=      wpd->vgroup_mirror;
-	wpi.lock_flags=         wpd->lock_flags;
-	wpi.vgroup_validmap=    wpd->vgroup_validmap;
-	wpi.do_flip=            RNA_boolean_get(itemptr, "pen_flip");
-	wpi.do_multipaint=      (ts->multipaint != 0);
-	wpi.do_auto_normalize=	((ts->auto_normalize != 0) && (wpi.vgroup_validmap != NULL));
-	wpi.brush_alpha_value=  brush_alpha_value;
+	wpi.defbase_tot =        wpd->defbase_tot;
+	defbase_sel =            MEM_mallocN(wpi.defbase_tot * sizeof(char), "wpi.defbase_sel");
+	wpi.defbase_tot_sel =    get_selected_defgroups(ob, defbase_sel, wpi.defbase_tot);
+	wpi.defbase_sel =        defbase_sel; /* so we can stay const */
+	if (wpi.defbase_tot_sel == 0 && ob->actdef > 0) wpi.defbase_tot_sel = 1;
+
+	wpi.defbase_tot_unsel =  wpi.defbase_tot - wpi.defbase_tot_sel;
+	wpi.vgroup_active =      wpd->vgroup_active;
+	wpi.vgroup_mirror =      wpd->vgroup_mirror;
+	wpi.lock_flags =         wpd->lock_flags;
+	wpi.vgroup_validmap =    wpd->vgroup_validmap;
+	wpi.do_flip =            RNA_boolean_get(itemptr, "pen_flip");
+	wpi.do_multipaint =      (ts->multipaint != 0);
+	wpi.do_auto_normalize =  ((ts->auto_normalize != 0) && (wpi.vgroup_validmap != NULL));
+	wpi.brush_alpha_value =  brush_alpha_value;
 	/* *** done setting up WeightPaintInfo *** */
 
 
 
 	swap_m4m4(wpd->vc.rv3d->persmat, mat);
 
-	use_vert_sel= (me->editflag & ME_EDIT_VERT_SEL) != 0;
+	use_vert_sel = (me->editflag & ME_EDIT_VERT_SEL) != 0;
 
 	/* which faces are involved */
-	if(wp->flag & VP_AREA) {
+	if (wp->flag & VP_AREA) {
 		/* Ugly hack, to avoid drawing vertex index when getting the face index buffer - campbell */
 		me->editflag &= ~ME_EDIT_VERT_SEL;
-		totindex= sample_backbuf_area(vc, indexar, me->totface, mval[0], mval[1], brush_size_pressure);
+		totindex = sample_backbuf_area(vc, indexar, me->totpoly, mval[0], mval[1], brush_size_pressure);
 		me->editflag |= use_vert_sel ? ME_EDIT_VERT_SEL : 0;
 	}
 	else {
-		indexar[0]= view3d_sample_backbuf(vc, mval[0], mval[1]);
-		if(indexar[0]) totindex= 1;
-		else totindex= 0;
+		indexar[0] = view3d_sample_backbuf(vc, mval[0], mval[1]);
+		if (indexar[0]) totindex = 1;
+		else totindex = 0;
 	}
 			
-	if(wp->flag & VP_COLINDEX) {
-		for(index=0; index<totindex; index++) {
-			if(indexar[index] && indexar[index]<=me->totface) {
-				MFace *mface= ((MFace *)me->mface) + (indexar[index]-1);
+	if (wp->flag & VP_COLINDEX) {
+		for (index = 0; index < totindex; index++) {
+			if (indexar[index] && indexar[index] <= me->totpoly) {
+				MPoly *mpoly = ((MPoly *)me->mpoly) + (indexar[index] - 1);
 						
-				if(mface->mat_nr!=ob->actcol-1) {
-					indexar[index]= 0;
+				if (mpoly->mat_nr != ob->actcol - 1) {
+					indexar[index] = 0;
 				}
 			}
 		}
 	}
 			
-	if((me->editflag & ME_EDIT_PAINT_MASK) && me->mface) {
-		for(index=0; index<totindex; index++) {
-			if(indexar[index] && indexar[index]<=me->totface) {
-				MFace *mface= ((MFace *)me->mface) + (indexar[index]-1);
+	if ((me->editflag & ME_EDIT_PAINT_MASK) && me->mpoly) {
+		for (index = 0; index < totindex; index++) {
+			if (indexar[index] && indexar[index] <= me->totpoly) {
+				MPoly *mpoly = ((MPoly *)me->mpoly) + (indexar[index] - 1);
 						
-				if((mface->flag & ME_FACE_SEL)==0) {
-					indexar[index]= 0;
+				if ((mpoly->flag & ME_FACE_SEL) == 0) {
+					indexar[index] = 0;
 				}
-			}					
+			}
 		}
 	}
-			
+
 	/* make sure each vertex gets treated only once */
 	/* and calculate filter weight */
-	totw= 0.0f;
+	totw = 0.0f;
 	if (brush->vertexpaint_tool == PAINT_BLEND_BLUR)
-		paintweight= 0.0f;
+		paintweight = 0.0f;
 	else
-		paintweight= ts->vgroup_weight;
+		paintweight = ts->vgroup_weight;
 			
-	for(index=0; index<totindex; index++) {
-		if(indexar[index] && indexar[index]<=me->totface) {
-			MFace *mface= me->mface + (indexar[index]-1);
-
-			if(use_vert_sel) {
-				me->dvert[mface->v1].flag = (me->mvert[mface->v1].flag & SELECT);
-				me->dvert[mface->v2].flag = (me->mvert[mface->v2].flag & SELECT);
-				me->dvert[mface->v3].flag = (me->mvert[mface->v3].flag & SELECT);
-				if(mface->v4) me->dvert[mface->v4].flag = (me->mvert[mface->v4].flag & SELECT);
+	for (index = 0; index < totindex; index++) {
+		if (indexar[index] && indexar[index] <= me->totpoly) {
+			MPoly *mpoly = me->mpoly + (indexar[index] - 1);
+			MLoop *ml = me->mloop + mpoly->loopstart;
+			int i;
+
+			if (use_vert_sel) {
+				for (i = 0; i < mpoly->totloop; i++, ml++) {
+					me->dvert[ml->v].flag = (me->mvert[ml->v].flag & SELECT);
+				}
 			}
 			else {
-				me->dvert[mface->v1].flag= 1;
-				me->dvert[mface->v2].flag= 1;
-				me->dvert[mface->v3].flag= 1;
-				if(mface->v4) me->dvert[mface->v4].flag= 1;
+				for (i = 0; i < mpoly->totloop; i++, ml++) {
+					me->dvert[ml->v].flag = 1;
+				}
 			}
 					
 			if (brush->vertexpaint_tool == PAINT_BLEND_BLUR) {
 				MDeformWeight *dw, *(*dw_func)(MDeformVert *, const int);
-				unsigned int fidx= mface->v4 ? 3:2;
 						
-				if(wp->flag & VP_ONLYVGROUP)
-					dw_func= (MDeformWeight *(*)(MDeformVert *, const int))defvert_find_index;
+				if (wp->flag & VP_ONLYVGROUP)
+					dw_func = (MDeformWeight *(*)(MDeformVert *, const int))defvert_find_index;
 				else
-					dw_func= defvert_verify_index;
-
-				do {
-					unsigned int vidx= *(&mface->v1 + fidx);
-					const float fac = calc_vp_strength_dl(wp, vc, wpd->vertexcosnos+6*vidx, mval, brush_size_pressure);
+					dw_func = defvert_verify_index;
+						
+				ml = me->mloop + mpoly->loopstart;
+				for (i = 0; i < mpoly->totloop; i++, ml++) {
+					unsigned int vidx = ml->v;
+					const float fac = calc_vp_strength_dl(wp, vc, wpd->vertexcosnos + 6 * vidx, mval, brush_size_pressure);
 					if (fac > 0.0f) {
 						dw = dw_func(&me->dvert[vidx], wpi.vgroup_active);
 						paintweight += dw ? (dw->weight * fac) : 0.0f;
 						totw += fac;
 					}
-
-				} while (fidx--);
-
+				}
 			}
 		}
 	}
@@ -2280,30 +2393,32 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
 		paintweight /= totw;
 	}
 
-	for(index=0; index<totindex; index++) {
-				
-		if(indexar[index] && indexar[index]<=me->totface) {
-			MFace *mf= me->mface + (indexar[index]-1);
-			unsigned int fidx= mf->v4 ? 3:2;
-			do {
-				unsigned int vidx= *(&mf->v1 + fidx);
-
-				if(me->dvert[vidx].flag) {
-					alpha= calc_vp_alpha_dl(wp, vc, wpd->wpimat, wpd->vertexcosnos+6*vidx,
-					                        mval, brush_size_pressure, brush_alpha_pressure);
-					if(alpha) {
+	for (index = 0; index < totindex; index++) {
+
+		if (indexar[index] && indexar[index] <= me->totpoly) {
+			MPoly *mpoly = me->mpoly + (indexar[index] - 1);
+			MLoop *ml = me->mloop + mpoly->loopstart;
+			int i;
+
+			for (i = 0; i < mpoly->totloop; i++, ml++) {
+				unsigned int vidx = ml->v;
+
+				if (me->dvert[vidx].flag) {
+					alpha = calc_vp_alpha_dl(wp, vc, wpd->wpimat, wpd->vertexcosnos + 6 * vidx,
+					                         mval, brush_size_pressure, brush_alpha_pressure);
+					if (alpha) {
 						do_weight_paint_vertex(wp, ob, &wpi, vidx, alpha, paintweight);
 					}
-					me->dvert[vidx].flag= 0;
+					me->dvert[vidx].flag = 0;
 				}
-			} while (fidx--);
+			}
 		}
 	}
 
 
 	/* *** free wpi members */
 	MEM_freeN((void *)wpi.defbase_sel);
-	/* *** dont freeing wpi members */
+	/* *** don't freeing wpi members */
 
 
 	swap_m4m4(vc->rv3d->persmat, mat);
@@ -2314,18 +2429,18 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
 
 static void wpaint_stroke_done(bContext *C, struct PaintStroke *stroke)
 {
-	ToolSettings *ts= CTX_data_tool_settings(C);
-	Object *ob= CTX_data_active_object(C);
-	struct WPaintData *wpd= paint_stroke_mode_data(stroke);
+	ToolSettings *ts = CTX_data_tool_settings(C);
+	Object *ob = CTX_data_active_object(C);
+	struct WPaintData *wpd = paint_stroke_mode_data(stroke);
 	
-	if(wpd) {
-		if(wpd->vertexcosnos)
+	if (wpd) {
+		if (wpd->vertexcosnos)
 			MEM_freeN(wpd->vertexcosnos);
 		MEM_freeN(wpd->indexar);
 		
 		if (wpd->vgroup_validmap)
 			MEM_freeN((void *)wpd->vgroup_validmap);
-		if(wpd->lock_flags)
+		if (wpd->lock_flags)
 			MEM_freeN((void *)wpd->lock_flags);
 
 		MEM_freeN(wpd);
@@ -2335,13 +2450,13 @@ static void wpaint_stroke_done(bContext *C, struct PaintStroke *stroke)
 	copy_wpaint_prev(ts->wpaint, NULL, 0);
 	
 	/* and particles too */
-	if(ob->particlesystem.first) {
+	if (ob->particlesystem.first) {
 		ParticleSystem *psys;
 		int i;
 		
-		for(psys= ob->particlesystem.first; psys; psys= psys->next) {
-			for(i=0; i<PSYS_TOT_VG; i++) {
-				if(psys->vgroup[i]==ob->actdef) {
+		for (psys = ob->particlesystem.first; psys; psys = psys->next) {
+			for (i = 0; i < PSYS_TOT_VG; i++) {
+				if (psys->vgroup[i] == ob->actdef) {
 					psys->recalc |= PSYS_RECALC_RESET;
 					break;
 				}
@@ -2379,25 +2494,25 @@ void PAINT_OT_weight_paint(wmOperatorType *ot)
 {
 	
 	/* identifiers */
-	ot->name= "Weight Paint";
-	ot->idname= "PAINT_OT_weight_paint";
+	ot->name = "Weight Paint";
+	ot->idname = "PAINT_OT_weight_paint";
 	
 	/* api callbacks */
-	ot->invoke= wpaint_invoke;
-	ot->modal= paint_stroke_modal;
-	/* ot->exec= vpaint_exec; <-- needs stroke property */
-	ot->poll= weight_paint_poll;
-	ot->cancel= wpaint_cancel;
+	ot->invoke = wpaint_invoke;
+	ot->modal = paint_stroke_modal;
+	/* ot->exec = vpaint_exec; <-- needs stroke property */
+	ot->poll = weight_paint_poll;
+	ot->cancel = wpaint_cancel;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
 
 	RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
 }
 
 static int weight_paint_set_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	struct Scene *scene= CTX_data_scene(C);
+	struct Scene *scene = CTX_data_scene(C);
 	Object *obact = CTX_data_active_object(C);
 
 	wpaint_fill(scene->toolsettings->wpaint, obact, scene->toolsettings->vgroup_weight);
@@ -2408,38 +2523,40 @@ static int weight_paint_set_exec(bContext *C, wmOperator *UNUSED(op))
 void PAINT_OT_weight_set(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Weight";
-	ot->idname= "PAINT_OT_weight_set";
+	ot->name = "Set Weight";
+	ot->idname = "PAINT_OT_weight_set";
 
 	/* api callbacks */
-	ot->exec= weight_paint_set_exec;
-	ot->poll= mask_paint_poll; /* it was facemask_paint_poll */
+	ot->exec = weight_paint_set_exec;
+	ot->poll = mask_paint_poll; /* it was facemask_paint_poll */
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /* ************ set / clear vertex paint mode ********** */
 
 
-static int set_vpaint(bContext *C, wmOperator *op)		/* toggle */
+static int set_vpaint(bContext *C, wmOperator *op)  /* toggle */
 {	
-	Object *ob= CTX_data_active_object(C);
-	Scene *scene= CTX_data_scene(C);
-	VPaint *vp= scene->toolsettings->vpaint;
+	Object *ob = CTX_data_active_object(C);
+	Scene *scene = CTX_data_scene(C);
+	VPaint *vp = scene->toolsettings->vpaint;
 	Mesh *me;
 	
-	me= get_mesh(ob);
+	me = get_mesh(ob);
 	
-	if(me==NULL || object_data_is_libdata(ob)) {
+	if (me == NULL || object_data_is_libdata(ob)) {
 		ob->mode &= ~OB_MODE_VERTEX_PAINT;
 		return OPERATOR_PASS_THROUGH;
 	}
 	
-	if(me && me->mcol==NULL) make_vertexcol(ob);
+	if (me && me->mloopcol == NULL) {
+		make_vertexcol(ob);
+	}
 	
 	/* toggle: end vpaint */
-	if(ob->mode & OB_MODE_VERTEX_PAINT) {
+	if (ob->mode & OB_MODE_VERTEX_PAINT) {
 		
 		ob->mode &= ~OB_MODE_VERTEX_PAINT;
 	}
@@ -2449,8 +2566,8 @@ static int set_vpaint(bContext *C, wmOperator *op)		/* toggle */
 		if (ob->mode & OB_MODE_WEIGHT_PAINT)
 			set_wpaint(C, op);
 		
-		if(vp==NULL)
-			vp= scene->toolsettings->vpaint= new_vpaint(0);
+		if (vp == NULL)
+			vp = scene->toolsettings->vpaint = new_vpaint(0);
 		
 		paint_cursor_start(C, vertex_paint_poll);
 
@@ -2461,7 +2578,7 @@ static int set_vpaint(bContext *C, wmOperator *op)		/* toggle */
 		/* update modifier stack for mapping requirements */
 		DAG_id_tag_update(&me->id, 0);
 	
-	WM_event_add_notifier(C, NC_SCENE|ND_MODE, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene);
 	
 	return OPERATOR_FINISHED;
 }
@@ -2470,15 +2587,15 @@ void PAINT_OT_vertex_paint_toggle(wmOperatorType *ot)
 {
 	
 	/* identifiers */
-	ot->name= "Vertex Paint Mode";
-	ot->idname= "PAINT_OT_vertex_paint_toggle";
+	ot->name = "Vertex Paint Mode";
+	ot->idname = "PAINT_OT_vertex_paint_toggle";
 	
 	/* api callbacks */
-	ot->exec= set_vpaint;
-	ot->poll= paint_poll_test;
+	ot->exec = set_vpaint;
+	ot->poll = paint_poll_test;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 
@@ -2486,23 +2603,27 @@ void PAINT_OT_vertex_paint_toggle(wmOperatorType *ot)
 /* ********************** vertex paint operator ******************* */
 
 /* Implementation notes:
+ *
+ * Operator->invoke()
+ * - validate context (add mcol)
+ * - create customdata storage
+ * - call paint once (mouse click)
+ * - add modal handler 
+ *
+ * Operator->modal()
+ * - for every mousemove, apply vertex paint
+ * - exit on mouse release, free customdata
+ *   (return OPERATOR_FINISHED also removes handler and operator)
+ *
+ * For future:
+ * - implement a stroke event (or mousemove with past positons)
+ * - revise whether op->customdata should be added in object, in set_vpaint
+ */
 
-Operator->invoke()
-  - validate context (add mcol)
-  - create customdata storage
-  - call paint once (mouse click)
-  - add modal handler 
-
-Operator->modal()
-  - for every mousemove, apply vertex paint
-  - exit on mouse release, free customdata
-	(return OPERATOR_FINISHED also removes handler and operator)
-
-For future:
-  - implement a stroke event (or mousemove with past positons)
-  - revise whether op->customdata should be added in object, in set_vpaint
-
-*/
+typedef struct polyfacemap_e {
+	struct polyfacemap_e *next, *prev;
+	int facenr;
+} polyfacemap_e;
 
 typedef struct VPaintData {
 	ViewContext vc;
@@ -2510,36 +2631,87 @@ typedef struct VPaintData {
 	int *indexar;
 	float *vertexcosnos;
 	float vpimat[3][3];
+
+	/* modify 'me->mcol' directly, since the derived mesh is drawing from this array,
+	 * otherwise we need to refresh the modifier stack */
+	int use_fast_update;
+
+	/* mpoly -> mface mapping */
+	MemArena *polyfacemap_arena;
+	ListBase *polyfacemap;
 } VPaintData;
 
+static void vpaint_build_poly_facemap(struct VPaintData *vd, Mesh *me)
+{
+	MFace *mf;
+	polyfacemap_e *e;
+	int *origIndex;
+	int i;
+
+	vd->polyfacemap_arena = BLI_memarena_new(1 << 13, "vpaint tmp");
+	BLI_memarena_use_calloc(vd->polyfacemap_arena);
+
+	vd->polyfacemap = BLI_memarena_alloc(vd->polyfacemap_arena, sizeof(ListBase) * me->totpoly);
+
+	origIndex = CustomData_get_layer(&me->fdata, CD_POLYINDEX);
+	mf = me->mface;
+
+	if (!origIndex)
+		return;
+
+	for (i = 0; i < me->totface; i++, mf++, origIndex++) {
+		if (*origIndex == ORIGINDEX_NONE)
+			continue;
+
+		e = BLI_memarena_alloc(vd->polyfacemap_arena, sizeof(polyfacemap_e));
+		e->facenr = i;
+		
+		BLI_addtail(&vd->polyfacemap[*origIndex], e);
+	}
+}
+
 static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, wmEvent *UNUSED(event))
 {
-	ToolSettings *ts= CTX_data_tool_settings(C);
+	ToolSettings *ts = CTX_data_tool_settings(C);
 	struct PaintStroke *stroke = op->customdata;
-	VPaint *vp= ts->vpaint;
+	VPaint *vp = ts->vpaint;
 	struct VPaintData *vpd;
-	Object *ob= CTX_data_active_object(C);
+	Object *ob = CTX_data_active_object(C);
 	Mesh *me;
 	float mat[4][4], imat[4][4];
 
 	/* context checks could be a poll() */
-	me= get_mesh(ob);
-	if(me==NULL || me->totface==0) return OPERATOR_PASS_THROUGH;
+	me = get_mesh(ob);
+	if (me == NULL || me->totpoly == 0)
+		return OPERATOR_PASS_THROUGH;
 	
-	if(me->mcol==NULL) make_vertexcol(ob);
-	if(me->mcol==NULL) return OPERATOR_CANCELLED;
+	if (me->mloopcol == NULL)
+		make_vertexcol(ob);
+	if (me->mloopcol == NULL)
+		return OPERATOR_CANCELLED;
 	
 	/* make mode data storage */
-	vpd= MEM_callocN(sizeof(struct VPaintData), "VPaintData");
+	vpd = MEM_callocN(sizeof(struct VPaintData), "VPaintData");
 	paint_stroke_set_mode_data(stroke, vpd);
 	view3d_set_viewcontext(C, &vpd->vc);
 	
-	vpd->vertexcosnos= mesh_get_mapped_verts_nors(vpd->vc.scene, ob);
-	vpd->indexar= get_indexarray(me);
-	vpd->paintcol= vpaint_get_current_col(vp);
-	
+	vpd->vertexcosnos = mesh_get_mapped_verts_nors(vpd->vc.scene, ob);
+	vpd->indexar = get_indexarray(me);
+	vpd->paintcol = vpaint_get_current_col(vp);
+
+
+	/* are we painting onto a modified mesh?,
+	 * if not we can skip face map trickyness */
+	if (vertex_paint_use_fast_update_check(ob)) {
+		vpaint_build_poly_facemap(vpd, me);
+		vpd->use_fast_update = TRUE;
+	}
+	else {
+		vpd->use_fast_update = FALSE;
+	}
+
 	/* for filtering */
-	copy_vpaint_prev(vp, (unsigned int *)me->mcol, me->totface);
+	copy_vpaint_prev(vp, (unsigned int *)me->mloopcol, me->totloop);
 	
 	/* some old cruft to sort out later */
 	mult_m4_m4m4(mat, vpd->vc.rv3d->viewmat, ob->obmat);
@@ -2549,6 +2721,7 @@ static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, wmEvent
 	return 1;
 }
 
+#if 0
 static void vpaint_paint_face(VPaint *vp, VPaintData *vpd, Object *ob,
                               const unsigned int index, const float mval[2],
                               const float brush_size_pressure, const float brush_alpha_pressure,
@@ -2557,54 +2730,146 @@ static void vpaint_paint_face(VPaint *vp, VPaintData *vpd, Object *ob,
 	ViewContext *vc = &vpd->vc;
 	Brush *brush = paint_brush(&vp->paint);
 	Mesh *me = get_mesh(ob);
-	MFace *mface= &me->mface[index];
-	unsigned int *mcol= ((unsigned int*)me->mcol) + 4*index;
-	unsigned int *mcolorig= ((unsigned int*)vp->vpaint_prev) + 4*index;
+	MFace *mface = &me->mface[index];
+	unsigned int *mcol = ((unsigned int *)me->mcol) + 4 * index;
+	unsigned int *mcolorig = ((unsigned int *)vp->vpaint_prev) + 4 * index;
 	float alpha;
 	int i;
 
 	int brush_alpha_pressure_i;
 	
-	if((vp->flag & VP_COLINDEX && mface->mat_nr!=ob->actcol-1) ||
-	   ((me->editflag & ME_EDIT_PAINT_MASK) && !(mface->flag & ME_FACE_SEL)))
+	if ((vp->flag & VP_COLINDEX && mface->mat_nr != ob->actcol - 1) ||
+	    ((me->editflag & ME_EDIT_PAINT_MASK) && !(mface->flag & ME_FACE_SEL)))
 		return;
 
 	if (brush->vertexpaint_tool == PAINT_BLEND_BLUR) {
-		unsigned int fcol1= mcol_blend( mcol[0], mcol[1], 128);
-		if(mface->v4) {
-			unsigned int fcol2= mcol_blend( mcol[2], mcol[3], 128);
-			vpd->paintcol= mcol_blend( fcol1, fcol2, 128);
+		unsigned int fcol1 = mcol_blend(mcol[0], mcol[1], 128);
+		if (mface->v4) {
+			unsigned int fcol2 = mcol_blend(mcol[2], mcol[3], 128);
+			vpd->paintcol = mcol_blend(fcol1, fcol2, 128);
 		}
 		else {
-			vpd->paintcol= mcol_blend( mcol[2], fcol1, 170);
+			vpd->paintcol = mcol_blend(mcol[2], fcol1, 170);
 		}
 	}
 
-	brush_alpha_pressure_i = (int)(brush_alpha_pressure*255.0f);
+	brush_alpha_pressure_i = (int)(brush_alpha_pressure * 255.0f);
 
-	for(i = 0; i < (mface->v4 ? 4 : 3); ++i) {
-		alpha = calc_vp_alpha_dl(vp, vc, vpd->vpimat, vpd->vertexcosnos+6*(&mface->v1)[i],
+	for (i = 0; i < (mface->v4 ? 4 : 3); ++i) {
+		alpha = calc_vp_alpha_dl(vp, vc, vpd->vpimat, vpd->vertexcosnos + 6 * (&mface->v1)[i],
 		                         mval, brush_size_pressure, brush_alpha_pressure);
 		if (alpha) {
-			const int alpha_i = (int)(alpha*255.0f);
+			const int alpha_i = (int)(alpha * 255.0f);
 			mcol[i] = vpaint_blend(vp, mcol[i], mcolorig[i], vpd->paintcol, alpha_i, brush_alpha_pressure_i);
 		}
 	}
 }
+#endif
+
+/* BMESH version of vpaint_paint_face (commented above) */
+
+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)
+{
+	ViewContext *vc = &vpd->vc;
+	Brush *brush = paint_brush(&vp->paint);
+	Mesh *me = get_mesh(ob);
+	MPoly *mpoly = &me->mpoly[index];
+	MFace *mf;
+	MCol *mc;
+	MLoop *ml;
+	MLoopCol *mlc;
+	polyfacemap_e *e;
+	unsigned int *lcol = ((unsigned int *)me->mloopcol) + mpoly->loopstart;
+	unsigned int *lcolorig = ((unsigned int *)vp->vpaint_prev) + mpoly->loopstart;
+	float alpha;
+	int i, j;
+
+	int brush_alpha_pressure_i = (int)(brush_alpha_pressure * 255.0f);
+
+	if (brush->vertexpaint_tool == PAINT_BLEND_BLUR) {
+		unsigned int blend[4] = {0};
+		unsigned int tcol;
+		char *col;
+
+		for (j = 0; j < mpoly->totloop; j++) {
+			col = (char *)(lcol + j);
+			blend[0] += col[0];
+			blend[1] += col[1];
+			blend[2] += col[2];
+			blend[3] += col[3];
+		}
+
+		blend[0] /= mpoly->totloop;
+		blend[1] /= mpoly->totloop;
+		blend[2] /= mpoly->totloop;
+		blend[3] /= mpoly->totloop;
+		col = (char *)&tcol;
+		col[0] = blend[0];
+		col[1] = blend[1];
+		col[2] = blend[2];
+		col[3] = blend[3];
+
+		vpd->paintcol = *((unsigned int *)col);
+	}
+
+	ml = me->mloop + mpoly->loopstart;
+	for (i = 0; i < mpoly->totloop; i++, ml++) {
+		alpha = calc_vp_alpha_dl(vp, vc, vpd->vpimat,
+		                         vpd->vertexcosnos + 6 * ml->v, mval,
+		                         brush_size_pressure, brush_alpha_pressure);
+		if (alpha > 0.0f) {
+			const int alpha_i = (int)(alpha * 255.0f);
+			lcol[i] = vpaint_blend(vp, lcol[i], lcolorig[i], vpd->paintcol, alpha_i, brush_alpha_pressure_i);
+		}
+	}
+
+	if (vpd->use_fast_update) {
+
+#ifdef CPYCOL
+#  undef CPYCOL
+#endif
+#define CPYCOL(c, l) (c)->a = (l)->a, (c)->r = (l)->r, (c)->g = (l)->g, (c)->b = (l)->b
+
+		/* update vertex colors for tessellations incrementally,
+		 * rather then regenerating the tessellation altogether */
+		for (e = vpd->polyfacemap[index].first; e; e = e->next) {
+			mf = me->mface + e->facenr;
+			mc = me->mcol + e->facenr * 4;
+
+			ml = me->mloop + mpoly->loopstart;
+			mlc = me->mloopcol + mpoly->loopstart;
+			for (j = 0; j < mpoly->totloop; j++, ml++, mlc++) {
+				if (ml->v == mf->v1)
+					CPYCOL(mc, mlc);
+				else if (ml->v == mf->v2)
+					CPYCOL(mc + 1, mlc);
+				else if (ml->v == mf->v3)
+					CPYCOL(mc + 2, mlc);
+				else if (mf->v4 && ml->v == mf->v4)
+					CPYCOL(mc + 3, mlc);
+
+			}
+		}
+#undef CPYCOL
+	}
+
+}
 
 static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, PointerRNA *itemptr)
 {
-	Scene *scene= CTX_data_scene(C);
-	ToolSettings *ts= CTX_data_tool_settings(C);
+	Scene *scene = CTX_data_scene(C);
+	ToolSettings *ts = CTX_data_tool_settings(C);
 	struct VPaintData *vpd = paint_stroke_mode_data(stroke);
-	VPaint *vp= ts->vpaint;
+	VPaint *vp = ts->vpaint;
 	Brush *brush = paint_brush(&vp->paint);
-	ViewContext *vc= &vpd->vc;
-	Object *ob= vc->obact;
-	Mesh *me= ob->data;
+	ViewContext *vc = &vpd->vc;
+	Object *ob = vc->obact;
+	Mesh *me = ob->data;
 	float mat[4][4];
-	int *indexar= vpd->indexar;
-	int totindex, index, flip;
+	int *indexar = vpd->indexar;
+	int totindex, index;
 	float mval[2];
 
 	const float pressure = RNA_float_get(itemptr, "pressure");
@@ -2612,58 +2877,93 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
 	const float brush_alpha_pressure = brush_alpha(scene, brush) * (brush_use_alpha_pressure(scene, brush) ? pressure : 1.0f);
 
 	RNA_float_get_array(itemptr, "mouse", mval);
-	flip = RNA_boolean_get(itemptr, "pen_flip");
-			
+
 	view3d_operator_needs_opengl(C);
 			
 	/* load projection matrix */
 	mult_m4_m4m4(mat, vc->rv3d->persmat, ob->obmat);
 
-	mval[0]-= vc->ar->winrct.xmin;
-	mval[1]-= vc->ar->winrct.ymin;
+	mval[0] -= vc->ar->winrct.xmin;
+	mval[1] -= vc->ar->winrct.ymin;
 
 			
 	/* which faces are involved */
-	if(vp->flag & VP_AREA) {
-		totindex= sample_backbuf_area(vc, indexar, me->totface, mval[0], mval[1], brush_size_pressure);
+	if (vp->flag & VP_AREA) {
+		totindex = sample_backbuf_area(vc, indexar, me->totpoly, mval[0], mval[1], brush_size_pressure);
 	}
 	else {
-		indexar[0]= view3d_sample_backbuf(vc, mval[0], mval[1]);
-		if(indexar[0]) totindex= 1;
-		else totindex= 0;
+		indexar[0] = view3d_sample_backbuf(vc, mval[0], mval[1]);
+		if (indexar[0]) totindex = 1;
+		else totindex = 0;
 	}
 			
-	swap_m4m4(vc->rv3d->persmat, mat);
 			
-	for(index=0; index<totindex; index++) {				
-		if (indexar[index] && indexar[index]<=me->totface) {
-			vpaint_paint_face(vp, vpd, ob, indexar[index]-1, mval, brush_size_pressure, brush_alpha_pressure, flip);
+	if (vp->flag & VP_COLINDEX) {
+		for (index = 0; index < totindex; index++) {
+			if (indexar[index] && indexar[index] <= me->totpoly) {
+				MPoly *mpoly = ((MPoly *)me->mpoly) + (indexar[index] - 1);
+						
+				if (mpoly->mat_nr != ob->actcol - 1) {
+					indexar[index] = 0;
+				}
+			}
 		}
 	}
+
+	if ((me->editflag & ME_EDIT_PAINT_MASK) && me->mpoly) {
+		for (index = 0; index < totindex; index++) {
+			if (indexar[index] && indexar[index] <= me->totpoly) {
+				MPoly *mpoly = ((MPoly *)me->mpoly) + (indexar[index] - 1);
 						
+				if ((mpoly->flag & ME_FACE_SEL) == 0)
+					indexar[index] = 0;
+			}					
+		}
+	}
+	
 	swap_m4m4(vc->rv3d->persmat, mat);
 
-	/* was disabled because it is slow, but necessary for blur */
-	if (brush->vertexpaint_tool == PAINT_BLEND_BLUR)
-		do_shared_vertexcol(me);
 			
+	for (index = 0; index < totindex; index++) {
+				
+		if (indexar[index] && indexar[index] <= me->totpoly) {
+			vpaint_paint_poly(vp, vpd, ob, indexar[index] - 1, mval, brush_size_pressure, brush_alpha_pressure);
+		}
+	}
+		
+	swap_m4m4(vc->rv3d->persmat, mat);
+
+	/* was disabled because it is slow, but necessary for blur */
+	if (brush->vertexpaint_tool == PAINT_BLEND_BLUR) {
+		int do_tessface = vpd->use_fast_update;
+		do_shared_vertexcol(me, do_tessface);
+	}
+
 	ED_region_tag_redraw(vc->ar);
-			
-	DAG_id_tag_update(ob->data, 0);
+
+	if (vpd->use_fast_update == FALSE) {
+		/* recalculate modifier stack to get new colors, slow,
+		 * avoid this if we can! */
+		DAG_id_tag_update(ob->data, 0);
+	}
 }
 
 static void vpaint_stroke_done(bContext *C, struct PaintStroke *stroke)
 {
-	ToolSettings *ts= CTX_data_tool_settings(C);
-	struct VPaintData *vpd= paint_stroke_mode_data(stroke);
+	ToolSettings *ts = CTX_data_tool_settings(C);
+	struct VPaintData *vpd = paint_stroke_mode_data(stroke);
 	
-	if(vpd->vertexcosnos)
+	if (vpd->vertexcosnos)
 		MEM_freeN(vpd->vertexcosnos);
 	MEM_freeN(vpd->indexar);
 	
 	/* frees prev buffer */
 	copy_vpaint_prev(ts->vpaint, NULL, 0);
-	
+
+	if (vpd->polyfacemap_arena) {
+		BLI_memarena_free(vpd->polyfacemap_arena);
+	}
+
 	MEM_freeN(vpd);
 }
 
@@ -2671,8 +2971,8 @@ static int vpaint_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 	
 	op->customdata = paint_stroke_new(C, NULL, vpaint_stroke_test_start,
-					  vpaint_stroke_update_step,
-					  vpaint_stroke_done, event->type);
+	                                  vpaint_stroke_update_step,
+	                                  vpaint_stroke_done, event->type);
 	
 	/* add modal handler */
 	WM_event_add_modal_handler(C, op);
@@ -2692,18 +2992,18 @@ static int vpaint_cancel(bContext *C, wmOperator *op)
 void PAINT_OT_vertex_paint(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Vertex Paint";
-	ot->idname= "PAINT_OT_vertex_paint";
+	ot->name = "Vertex Paint";
+	ot->idname = "PAINT_OT_vertex_paint";
 	
 	/* api callbacks */
-	ot->invoke= vpaint_invoke;
-	ot->modal= paint_stroke_modal;
-	/* ot->exec= vpaint_exec; <-- needs stroke property */
-	ot->poll= vertex_paint_poll;
-	ot->cancel= vpaint_cancel;
+	ot->invoke = vpaint_invoke;
+	ot->modal = paint_stroke_modal;
+	/* ot->exec = vpaint_exec; <-- needs stroke property */
+	ot->poll = vertex_paint_poll;
+	ot->cancel = vpaint_cancel;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
 
 	RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement, "Stroke", "");
 }
@@ -2712,47 +3012,46 @@ void PAINT_OT_vertex_paint(wmOperatorType *ot)
 
 static int weight_from_bones_poll(bContext *C)
 {
-	Object *ob= CTX_data_active_object(C);
+	Object *ob = CTX_data_active_object(C);
 
 	return (ob && (ob->mode & OB_MODE_WEIGHT_PAINT) && modifiers_isDeformedByArmature(ob));
 }
 
 static int weight_from_bones_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Object *ob= CTX_data_active_object(C);
-	Object *armob= modifiers_isDeformedByArmature(ob);
-	Mesh *me= ob->data;
-	int type= RNA_enum_get(op->ptr, "type");
+	Scene *scene = CTX_data_scene(C);
+	Object *ob = CTX_data_active_object(C);
+	Object *armob = modifiers_isDeformedByArmature(ob);
+	Mesh *me = ob->data;
+	int type = RNA_enum_get(op->ptr, "type");
 
 	create_vgroups_from_armature(op->reports, scene, ob, armob, type, (me->editflag & ME_EDIT_MIRROR_X));
 
 	DAG_id_tag_update(&me->id, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
 
 	return OPERATOR_FINISHED;
 }
 
 void PAINT_OT_weight_from_bones(wmOperatorType *ot)
 {
-	static EnumPropertyItem type_items[]= {
+	static EnumPropertyItem type_items[] = {
 		{ARM_GROUPS_AUTO, "AUTOMATIC", 0, "Automatic", "Automatic weights froms bones"},
 		{ARM_GROUPS_ENVELOPE, "ENVELOPES", 0, "From Envelopes", "Weights from envelopes with user defined radius"},
 		{0, NULL, 0, NULL, NULL}};
 
 	/* identifiers */
-	ot->name= "Weight from Bones";
-	ot->idname= "PAINT_OT_weight_from_bones";
+	ot->name = "Weight from Bones";
+	ot->idname = "PAINT_OT_weight_from_bones";
 	
 	/* api callbacks */
-	ot->exec= weight_from_bones_exec;
-	ot->invoke= WM_menu_invoke;
-	ot->poll= weight_from_bones_poll;
+	ot->exec = weight_from_bones_exec;
+	ot->invoke = WM_menu_invoke;
+	ot->poll = weight_from_bones_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* properties */
-	ot->prop= RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "Method to use for assigning weights");
+	ot->prop = RNA_def_enum(ot->srna, "type", type_items, 0, "Type", "Method to use for assigning weights");
 }
-
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index d055825..157be33 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -42,9 +42,9 @@
 #include "BLI_ghash.h"
 #include "BLI_pbvh.h"
 #include "BLI_threads.h"
-#include "BLI_editVert.h"
 #include "BLI_rand.h"
 
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_node_types.h"
 #include "DNA_object_types.h"
@@ -64,6 +64,7 @@
 #include "BKE_report.h"
 #include "BKE_lattice.h" /* for armature_deform_verts */
 #include "BKE_node.h"
+#include "BKE_subsurf.h"
 
 #include "BIF_glutil.h"
 
@@ -94,32 +95,32 @@
 
 void ED_sculpt_force_update(bContext *C)
 {
-	Object *ob= CTX_data_active_object(C);
+	Object *ob = CTX_data_active_object(C);
 
-	if(ob && (ob->mode & OB_MODE_SCULPT))
+	if (ob && (ob->mode & OB_MODE_SCULPT))
 		multires_force_update(ob);
 }
 
 /* Sculpt mode handles multires differently from regular meshes, but only if
-   it's the last modifier on the stack and it is not on the first level */
+ * it's the last modifier on the stack and it is not on the first level */
 struct MultiresModifierData *sculpt_multires_active(Scene *scene, Object *ob)
 {
-	Mesh *me= (Mesh*)ob->data;
+	Mesh *me = (Mesh *)ob->data;
 	ModifierData *md;
 
-	if(!CustomData_get_layer(&me->fdata, CD_MDISPS)) {
+	if (!CustomData_get_layer(&me->ldata, CD_MDISPS)) {
 		/* multires can't work without displacement layer */
 		return NULL;
 	}
 
-	for(md= modifiers_getVirtualModifierList(ob); md; md= md->next) {
-		if(md->type == eModifierType_Multires) {
-			MultiresModifierData *mmd= (MultiresModifierData*)md;
+	for (md = modifiers_getVirtualModifierList(ob); md; md = md->next) {
+		if (md->type == eModifierType_Multires) {
+			MultiresModifierData *mmd = (MultiresModifierData *)md;
 
-			if(!modifier_isEnabled(scene, md, eModifierMode_Realtime))
+			if (!modifier_isEnabled(scene, md, eModifierMode_Realtime))
 				continue;
 
-			if(mmd->sculptlvl > 0) return mmd;
+			if (mmd->sculptlvl > 0) return mmd;
 			else return NULL;
 		}
 	}
@@ -132,11 +133,11 @@ static int sculpt_has_active_modifiers(Scene *scene, Object *ob)
 {
 	ModifierData *md;
 
-	md= modifiers_getVirtualModifierList(ob);
+	md = modifiers_getVirtualModifierList(ob);
 
 	/* exception for shape keys because we can edit those */
-	for(; md; md= md->next) {
-		if(modifier_isEnabled(scene, md, eModifierMode_Realtime))
+	for (; md; md = md->next) {
+		if (modifier_isEnabled(scene, md, eModifierMode_Realtime))
 			return 1;
 	}
 
@@ -147,25 +148,25 @@ static int sculpt_has_active_modifiers(Scene *scene, Object *ob)
 static int sculpt_modifiers_active(Scene *scene, Sculpt *sd, Object *ob)
 {
 	ModifierData *md;
-	Mesh *me= (Mesh*)ob->data;
-	MultiresModifierData *mmd= sculpt_multires_active(scene, ob);
+	Mesh *me = (Mesh *)ob->data;
+	MultiresModifierData *mmd = sculpt_multires_active(scene, ob);
 
-	if(mmd) return 0;
+	if (mmd) return 0;
 
 	/* non-locked shape keys could be handled in the same way as deformed mesh */
-	if((ob->shapeflag&OB_SHAPE_LOCK)==0 && me->key && ob->shapenr)
+	if ((ob->shapeflag & OB_SHAPE_LOCK) == 0 && me->key && ob->shapenr)
 		return 1;
 
-	md= modifiers_getVirtualModifierList(ob);
+	md = modifiers_getVirtualModifierList(ob);
 
 	/* exception for shape keys because we can edit those */
-	for(; md; md= md->next) {
+	for (; md; md = md->next) {
 		ModifierTypeInfo *mti = modifierType_getInfo(md->type);
-		if(!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
-		if(md->type==eModifierType_ShapeKey) continue;
+		if (!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
+		if (md->type == eModifierType_ShapeKey) continue;
 
-		if(mti->type==eModifierTypeType_OnlyDeform) return 1;
-		else if((sd->flags & SCULPT_ONLY_DEFORM)==0) return 1;
+		if (mti->type == eModifierTypeType_OnlyDeform) return 1;
+		else if ((sd->flags & SCULPT_ONLY_DEFORM) == 0) return 1;
 	}
 
 	return 0;
@@ -178,10 +179,10 @@ typedef enum StrokeFlags {
 } StrokeFlags;
 
 /* Cache stroke properties. Used because
-   RNA property lookup isn't particularly fast.
-
-   For descriptions of these settings, check the operator properties.
-*/
+ * RNA property lookup isn't particularly fast.
+ *
+ * For descriptions of these settings, check the operator properties.
+ */
 typedef struct StrokeCache {
 	/* Invariants */
 	float initial_radius;
@@ -193,7 +194,6 @@ typedef struct StrokeCache {
 	/* Variants */
 	float radius;
 	float radius_squared;
-	//float traced_location[3];
 	float true_location[3];
 	float location[3];
 
@@ -222,7 +222,7 @@ typedef struct StrokeCache {
 	float old_grab_location[3], orig_grab_location[3];
 
 	int symmetry; /* Symmetry index between 0 and 7 bit combo 0 is Brush only;
-		1 is X mirror; 2 is Y mirror; 3 is XY; 4 is Z; 5 is XZ; 6 is YZ; 7 is XYZ */
+	               * 1 is X mirror; 2 is Y mirror; 3 is XY; 4 is Z; 5 is XZ; 6 is YZ; 7 is XYZ */
 	int mirror_symmetry_pass; /* the symmetry pass we are currently on between 0 and 7*/
 	float true_view_normal[3];
 	float view_normal[3];
@@ -248,36 +248,36 @@ typedef struct StrokeCache {
 
 /* Get a screen-space rectangle of the modified area */
 static int sculpt_get_redraw_rect(ARegion *ar, RegionView3D *rv3d,
-								  Object *ob, rcti *rect)
+                                  Object *ob, rcti *rect)
 {
 	SculptSession *ss;
-	PBVH *pbvh= ob->sculpt->pbvh;
+	PBVH *pbvh = ob->sculpt->pbvh;
 	float bb_min[3], bb_max[3];
 
-	if(!pbvh)
+	if (!pbvh)
 		return 0;
 
 	BLI_pbvh_redraw_BB(pbvh, bb_min, bb_max);
 
 	/* convert 3D bounding box to screen space */
-	if(!paint_convert_bb_to_rect(rect,
-								 bb_min,
-								 bb_max,
-								 ar,
-								 rv3d,
-								 ob)) {
+	if (!paint_convert_bb_to_rect(rect,
+	                              bb_min,
+	                              bb_max,
+	                              ar,
+	                              rv3d,
+	                              ob)) {
 		return 0;
 	}
 
 	/* expand redraw rect with redraw rect from previous step to
-	   prevent partial-redraw issues caused by fast strokes. This is
-	   needed here (not in sculpt_flush_update) as it was before
-	   because redraw rectangle should be the same in both of
-	   optimized PBVH draw function and 3d view redraw (if not -- some
-	   mesh parts could disapper from screen (sergey) */
+	 * prevent partial-redraw issues caused by fast strokes. This is
+	 * needed here (not in sculpt_flush_update) as it was before
+	 * because redraw rectangle should be the same in both of
+	 * optimized PBVH draw function and 3d view redraw (if not -- some
+	 * mesh parts could disappear from screen (sergey) */
 	ss = ob->sculpt;
-	if(ss->cache) {
-		if(!BLI_rcti_is_empty(&ss->cache->previous_r))
+	if (ss->cache) {
+		if (!BLI_rcti_is_empty(&ss->cache->previous_r))
 			BLI_union_rcti(rect, &ss->cache->previous_r);
 	}
 
@@ -285,9 +285,9 @@ static int sculpt_get_redraw_rect(ARegion *ar, RegionView3D *rv3d,
 }
 
 void sculpt_get_redraw_planes(float planes[4][4], ARegion *ar,
-				  RegionView3D *rv3d, Object *ob)
+                              RegionView3D *rv3d, Object *ob)
 {
-	PBVH *pbvh= ob->sculpt->pbvh;
+	PBVH *pbvh = ob->sculpt->pbvh;
 	rcti rect;
 
 	sculpt_get_redraw_rect(ar, rv3d, ob, &rect);
@@ -295,7 +295,7 @@ void sculpt_get_redraw_planes(float planes[4][4], ARegion *ar,
 	paint_calc_redraw_planes(planes, ar, rv3d, ob, &rect);
 
 	/* clear redraw flag from nodes */
-	if(pbvh)
+	if (pbvh)
 		BLI_pbvh_update(pbvh, PBVH_UpdateRedraw, NULL);
 }
 
@@ -309,16 +309,16 @@ typedef struct SculptBrushTest {
 
 static void sculpt_brush_test_init(SculptSession *ss, SculptBrushTest *test)
 {
-	test->radius_squared= ss->cache->radius_squared;
+	test->radius_squared = ss->cache->radius_squared;
 	copy_v3_v3(test->location, ss->cache->location);
-	test->dist= 0.0f;	/* just for initialize */
+	test->dist = 0.0f;   /* just for initialize */
 }
 
 static int sculpt_brush_test(SculptBrushTest *test, float co[3])
 {
 	float distsq = len_squared_v3v3(co, test->location);
 
-	if(distsq <= test->radius_squared) {
+	if (distsq <= test->radius_squared) {
 		test->dist = sqrt(distsq);
 		return 1;
 	}
@@ -331,7 +331,7 @@ static int sculpt_brush_test_sq(SculptBrushTest *test, float co[3])
 {
 	float distsq = len_squared_v3v3(co, test->location);
 
-	if(distsq <= test->radius_squared) {
+	if (distsq <= test->radius_squared) {
 		test->dist = distsq;
 		return 1;
 	}
@@ -347,8 +347,7 @@ static int sculpt_brush_test_fast(SculptBrushTest *test, float co[3])
 
 static int sculpt_brush_test_cube(SculptBrushTest *test, float co[3], float local[4][4])
 {
-	static const float side = 0.70710678118654752440084436210485; // sqrt(.5);
-
+	float side = M_SQRT1_2;
 	float local_co[3];
 
 	mul_v3_m4v3(local_co, local, co);
@@ -358,7 +357,11 @@ static int sculpt_brush_test_cube(SculptBrushTest *test, float co[3], float loca
 	local_co[2] = fabs(local_co[2]);
 
 	if (local_co[0] <= side && local_co[1] <= side && local_co[2] <= side) {
-		test->dist = MAX3(local_co[0], local_co[1], local_co[2]) / side;
+		float p = 4;
+		
+		test->dist = ((powf(local_co[0], p) +
+		               powf(local_co[1], p) +
+		               powf(local_co[2], p)) / pow(side, p));
 
 		return 1;
 	}
@@ -368,7 +371,7 @@ static int sculpt_brush_test_cube(SculptBrushTest *test, float co[3], float loca
 }
 
 static float frontface(Brush *brush, const float sculpt_normal[3],
-		       const short no[3], const float fno[3])
+                       const short no[3], const float fno[3])
 {
 	if (brush->flag & BRUSH_FRONTFACE) {
 		float dot;
@@ -377,10 +380,10 @@ static float frontface(Brush *brush, const float sculpt_normal[3],
 			float tmp[3];
 
 			normal_short_to_float_v3(tmp, no);
-			dot= dot_v3v3(tmp, sculpt_normal);
+			dot = dot_v3v3(tmp, sculpt_normal);
 		}
 		else {
-			dot= dot_v3v3(fno, sculpt_normal);
+			dot = dot_v3v3(fno, sculpt_normal);
 		}
 		return dot > 0 ? dot : 0;
 	}
@@ -401,7 +404,7 @@ static int sculpt_brush_test_cyl(SculptBrushTest *test, float co[3], float locat
 
 		cross_v3_v3v3(t3, an, t1);
 
-		dist = len_v3(t3)/len_v3(t2);
+		dist = len_v3(t3) / len_v3(t2);
 
 		test->dist = dist;
 
@@ -418,20 +421,20 @@ static int sculpt_brush_test_cyl(SculptBrushTest *test, float co[3], float locat
  */
   
 
-static float overlapped_curve(Brush* br, float x)
+static float overlapped_curve(Brush *br, float x)
 {
 	int i;
 	const int n = 100 / br->spacing;
 	const float h = br->spacing / 50.0f;
-	const float x0 = x-1;
+	const float x0 = x - 1;
 
 	float sum;
 
 	sum = 0;
-	for (i= 0; i < n; i++) {
+	for (i = 0; i < n; i++) {
 		float xx;
 
-		xx = fabs(x0 + i*h);
+		xx = fabs(x0 + i * h);
 
 		if (xx < 1.0f)
 			sum += brush_curve_strength(br, xx, 1);
@@ -440,16 +443,16 @@ static float overlapped_curve(Brush* br, float x)
 	return sum;
 }
 
-static float integrate_overlap(Brush* br)
+static float integrate_overlap(Brush *br)
 {
 	int i;
-	int m= 10;
-	float g = 1.0f/m;
+	int m = 10;
+	float g = 1.0f / m;
 	float max;
 
-	max= 0;
-	for(i= 0; i < m; i++) {
-		float overlap= overlapped_curve(br, i*g);
+	max = 0;
+	for (i = 0; i < m; i++) {
+		float overlap = overlapped_curve(br, i * g);
 
 		if (overlap > max)
 			max = overlap;
@@ -461,18 +464,18 @@ static float integrate_overlap(Brush* br)
 /* Uses symm to selectively flip any axis of a coordinate. */
 static void flip_coord(float out[3], float in[3], const char symm)
 {
-	if(symm & SCULPT_SYMM_X)
-		out[0]= -in[0];
+	if (symm & SCULPT_SYMM_X)
+		out[0] = -in[0];
 	else
-		out[0]= in[0];
-	if(symm & SCULPT_SYMM_Y)
-		out[1]= -in[1];
+		out[0] = in[0];
+	if (symm & SCULPT_SYMM_Y)
+		out[1] = -in[1];
 	else
-		out[1]= in[1];
-	if(symm & SCULPT_SYMM_Z)
-		out[2]= -in[2];
+		out[1] = in[1];
+	if (symm & SCULPT_SYMM_Z)
+		out[2] = -in[2];
 	else
-		out[2]= in[2];
+		out[2] = in[2];
 }
 
 static float calc_overlap(StrokeCache *cache, const char symm, const char axis, const float angle)
@@ -480,20 +483,20 @@ static float calc_overlap(StrokeCache *cache, const char symm, const char axis,
 	float mirror[3];
 	float distsq;
 	
-	//flip_coord(mirror, cache->traced_location, symm);
+	/* flip_coord(mirror, cache->traced_location, symm); */
 	flip_coord(mirror, cache->true_location, symm);
 
-	if(axis != 0) {
-		float mat[4][4]= MAT4_UNITY;
+	if (axis != 0) {
+		float mat[4][4] = MAT4_UNITY;
 		rotate_m4(mat, axis, angle);
 		mul_m4_v3(mat, mirror);
 	}
 
-	//distsq = len_squared_v3v3(mirror, cache->traced_location);
+	/* distsq = len_squared_v3v3(mirror, cache->traced_location); */
 	distsq = len_squared_v3v3(mirror, cache->true_location);
 
-	if (distsq <= 4.0f*(cache->radius_squared))
-		return (2.0f*(cache->radius) - sqrtf(distsq))  /  (2.0f*(cache->radius));
+	if (distsq <= 4.0f * (cache->radius_squared))
+		return (2.0f * (cache->radius) - sqrtf(distsq))  /  (2.0f * (cache->radius));
 	else
 		return 0;
 }
@@ -504,15 +507,15 @@ static float calc_radial_symmetry_feather(Sculpt *sd, StrokeCache *cache, const
 	float overlap;
 
 	overlap = 0;
-	for(i = 1; i < sd->radial_symm[axis-'X']; ++i) {
-		const float angle = 2*M_PI*i/sd->radial_symm[axis-'X'];
+	for (i = 1; i < sd->radial_symm[axis - 'X']; ++i) {
+		const float angle = 2 * M_PI * i / sd->radial_symm[axis - 'X'];
 		overlap += calc_overlap(cache, symm, axis, angle);
 	}
 
 	return overlap;
 }
 
-static float calc_symmetry_feather(Sculpt *sd, StrokeCache* cache)
+static float calc_symmetry_feather(Sculpt *sd, StrokeCache *cache)
 {
 	if (sd->flags & SCULPT_SYMMETRY_FEATHER) {
 		float overlap;
@@ -521,7 +524,7 @@ static float calc_symmetry_feather(Sculpt *sd, StrokeCache* cache)
 
 		overlap = 0;
 		for (i = 0; i <= symm; i++) {
-			if(i == 0 || (symm & i && (symm != 5 || i != 3) && (symm != 6 || (i != 3 && i != 5)))) {
+			if (i == 0 || (symm & i && (symm != 5 || i != 3) && (symm != 6 || (i != 3 && i != 5)))) {
 
 				overlap += calc_overlap(cache, i, 0, 0);
 
@@ -531,7 +534,7 @@ static float calc_symmetry_feather(Sculpt *sd, StrokeCache* cache)
 			}
 		}
 
-		return 1/overlap;
+		return 1 / overlap;
 	}
 	else {
 		return 1;
@@ -539,8 +542,8 @@ static float calc_symmetry_feather(Sculpt *sd, StrokeCache* cache)
 }
 
 /* Return modified brush strength. Includes the direction of the brush, positive
-   values pull vertices, negative values push. Uses tablet pressure and a
-   special multiplier found experimentally to scale the strength factor. */
+ * values pull vertices, negative values push. Uses tablet pressure and a
+ * special multiplier found experimentally to scale the strength factor. */
 static float brush_strength(Sculpt *sd, StrokeCache *cache, float feather)
 {
 	const Scene *scene = cache->vc->scene;
@@ -548,23 +551,23 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache, float feather)
 
 	/* Primary strength input; square it to make lower values more sensitive */
 	const float root_alpha = brush_alpha(scene, brush);
-	float alpha        = root_alpha*root_alpha;
+	float alpha        = root_alpha * root_alpha;
 	float dir          = brush->flag & BRUSH_DIR_IN ? -1 : 1;
 	float pressure     = brush_use_alpha_pressure(scene, brush) ? cache->pressure : 1;
 	float pen_flip     = cache->pen_flip ? -1 : 1;
 	float invert       = cache->invert ? -1 : 1;
 	float accum        = integrate_overlap(brush);
 	/* spacing is integer percentage of radius, divide by 50 to get
-	   normalized diameter */
+	 * normalized diameter */
 	float overlap      = (brush->flag & BRUSH_SPACE_ATTEN &&
-						  brush->flag & BRUSH_SPACE &&
-						  !(brush->flag & BRUSH_ANCHORED) &&
-						  (brush->spacing < 100)) ? 1.0f/accum : 1;
+	                      brush->flag & BRUSH_SPACE &&
+	                      !(brush->flag & BRUSH_ANCHORED) &&
+	                      (brush->spacing < 100)) ? 1.0f / accum : 1;
 	float flip         = dir * invert * pen_flip;
 
-	switch(brush->sculpt_tool){
+	switch (brush->sculpt_tool) {
 		case SCULPT_TOOL_CLAY:
-		case SCULPT_TOOL_CLAY_TUBES:
+		case SCULPT_TOOL_CLAY_STRIPS:
 		case SCULPT_TOOL_DRAW:
 		case SCULPT_TOOL_LAYER:
 			return alpha * flip * pressure * overlap * feather;
@@ -585,7 +588,7 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache, float feather)
 		case SCULPT_TOOL_SCRAPE:
 		case SCULPT_TOOL_FLATTEN:
 			if (flip > 0) {
-				overlap = (1+overlap) / 2;
+				overlap = (1 + overlap) / 2;
 				return alpha * flip * pressure * overlap * feather;
 			}
 			else {
@@ -605,11 +608,11 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache, float feather)
 			}
 
 		case SCULPT_TOOL_NUDGE:
-			overlap = (1+overlap) / 2;
+			overlap = (1 + overlap) / 2;
 			return alpha * pressure * overlap * feather;
 
 		case SCULPT_TOOL_THUMB:
-			return alpha*pressure*feather;
+			return alpha * pressure * feather;
 
 		case SCULPT_TOOL_SNAKE_HOOK:
 			return feather;
@@ -618,7 +621,7 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache, float feather)
 			return feather;
 
 		case SCULPT_TOOL_ROTATE:
-			return alpha*pressure*feather;
+			return alpha * pressure * feather;
 
 		default:
 			return 0;
@@ -627,60 +630,61 @@ static float brush_strength(Sculpt *sd, StrokeCache *cache, float feather)
 
 /* Return a multiplier for brush strength on a particular vertex. */
 static float tex_strength(SculptSession *ss, Brush *br, float point[3],
-			  const float len,
-			  const float sculpt_normal[3],
-			  const short vno[3],
-			  const float fno[3])
+                          const float len,
+                          const float sculpt_normal[3],
+                          const short vno[3],
+                          const float fno[3])
 {
 	MTex *mtex = &br->mtex;
-	float avg= 1;
+	float avg = 1;
 
-	if(!mtex->tex) {
-		avg= 1;
+	if (!mtex->tex) {
+		avg = 1;
 	}
-	else if(mtex->brush_map_mode == MTEX_MAP_MODE_3D) {
+	else if (mtex->brush_map_mode == MTEX_MAP_MODE_3D) {
 		float jnk;
 
 		/* Get strength by feeding the vertex 
-		   location directly into a texture */
+		 * location directly into a texture */
 		externtex(mtex, point, &avg,
-			  &jnk, &jnk, &jnk, &jnk, 0);
+		          &jnk, &jnk, &jnk, &jnk, 0);
 	}
-	else if(ss->texcache) {
+	else if (ss->texcache) {
 		float rotation = -mtex->rot;
 		float symm_point[3], point_2d[2];
 		float x, y;
 		float radius;
 
 		/* if the active area is being applied for symmetry, flip it
-		   across the symmetry axis and rotate it back to the orignal
-		   position in order to project it. This insures that the 
-		   brush texture will be oriented correctly. */
+		 * across the symmetry axis and rotate it back to the original
+		 * position in order to project it. This insures that the 
+		 * brush texture will be oriented correctly. */
 
 		flip_coord(symm_point, point, ss->cache->mirror_symmetry_pass);
 
 		if (ss->cache->radial_symmetry_pass)
 			mul_m4_v3(ss->cache->symm_rot_mat_inv, symm_point);
 
-		ED_view3d_project_float(ss->cache->vc->ar, symm_point, point_2d,
-					ss->cache->projection_mat);
+		ED_view3d_project_float_v2(ss->cache->vc->ar, symm_point, point_2d, ss->cache->projection_mat);
 
 		/* if fixed mode, keep coordinates relative to mouse */
-		if(mtex->brush_map_mode == MTEX_MAP_MODE_FIXED) {
+		if (mtex->brush_map_mode == MTEX_MAP_MODE_FIXED) {
 			rotation += ss->cache->special_rotation;
 
 			point_2d[0] -= ss->cache->tex_mouse[0];
 			point_2d[1] -= ss->cache->tex_mouse[1];
 
-			radius = ss->cache->pixel_radius; // use pressure adjusted size for fixed mode
+			/* use pressure adjusted size for fixed mode */
+			radius = ss->cache->pixel_radius;
 
 			x = point_2d[0] + ss->cache->vc->ar->winrct.xmin;
 			y = point_2d[1] + ss->cache->vc->ar->winrct.ymin;
 		}
-		else /* else (mtex->brush_map_mode == MTEX_MAP_MODE_TILED),
-		        leave the coordinates relative to the screen */
-		{
-			radius = brush_size(ss->cache->vc->scene, br); // use unadjusted size for tiled mode
+		else { /* else (mtex->brush_map_mode == MTEX_MAP_MODE_TILED) */
+			   /* leave the coordinates relative to the screen */
+
+			/* use unadjusted size for tiled mode */
+			radius = brush_size(ss->cache->vc->scene, br);
 		
 			x = point_2d[0];
 			y = point_2d[1];
@@ -698,11 +702,11 @@ static float tex_strength(SculptSession *ss, Brush *br, float point[3],
 		y *= ss->cache->vc->ar->winy / radius;
 
 		/* it is probably worth optimizing for those cases where 
-		   the texture is not rotated by skipping the calls to
-		   atan2, sqrtf, sin, and cos. */
+		 * the texture is not rotated by skipping the calls to
+		 * atan2, sqrtf, sin, and cos. */
 		if (rotation > 0.001f || rotation < -0.001f) {
 			const float angle    = atan2f(y, x) + rotation;
-			const float flen     = sqrtf(x*x + y*y);
+			const float flen     = sqrtf(x * x + y * y);
 
 			x = flen * cosf(angle);
 			y = flen * sinf(angle);
@@ -742,15 +746,15 @@ static int sculpt_search_sphere_cb(PBVHNode *node, void *data_v)
 	float t[3], bb_min[3], bb_max[3];
 	int i;
 
-	if(data->original)
+	if (data->original)
 		BLI_pbvh_node_get_original_BB(node, bb_min, bb_max);
 	else
 		BLI_pbvh_node_get_BB(node, bb_min, bb_max);
 	
-	for(i = 0; i < 3; ++i) {
-		if(bb_min[i] > center[i])
+	for (i = 0; i < 3; ++i) {
+		if (bb_min[i] > center[i])
 			nearest[i] = bb_min[i];
-		else if(bb_max[i] < center[i])
+		else if (bb_max[i] < center[i])
 			nearest[i] = bb_max[i];
 		else
 			nearest[i] = center[i]; 
@@ -766,22 +770,23 @@ static void sculpt_clip(Sculpt *sd, SculptSession *ss, float *co, const float va
 {
 	int i;
 
-	for(i=0; i<3; ++i) {
-		if(sd->flags & (SCULPT_LOCK_X << i))
+	for (i = 0; i < 3; ++i) {
+		if (sd->flags & (SCULPT_LOCK_X << i))
 			continue;
 
-		if((ss->cache->flag & (CLIP_X << i)) && (fabsf(co[i]) <= ss->cache->clip_tolerance[i]))
-			co[i]= 0.0f;
+		if ((ss->cache->flag & (CLIP_X << i)) && (fabsf(co[i]) <= ss->cache->clip_tolerance[i]))
+			co[i] = 0.0f;
 		else
-			co[i]= val[i];
+			co[i] = val[i];
 	}
 }
 
 static void add_norm_if(float view_vec[3], float out[3], float out_flip[3], float fno[3])
 {
-	if((dot_v3v3(view_vec, fno)) > 0) {
+	if ((dot_v3v3(view_vec, fno)) > 0) {
 		add_v3_v3(out, fno);
-	} else {
+	}
+	else {
 		add_v3_v3(out_flip, fno); /* out_flip is used when out is {0,0,0} */
 	}
 }
@@ -798,19 +803,19 @@ static void calc_area_normal(Sculpt *sd, Object *ob, float an[3], PBVHNode **nod
 	zero_v3(an);
 
 	#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
-	for(n=0; n<totnode; n++) {
+	for (n = 0; n < totnode; n++) {
 		PBVHVertexIter vd;
 		SculptBrushTest test;
 		SculptUndoNode *unode;
 		float private_an[3] = {0.0f, 0.0f, 0.0f};
 		float private_out_flip[3] = {0.0f, 0.0f, 0.0f};
 
-		unode = sculpt_undo_push_node(ob, nodes[n]);
+		unode = sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS);
 		sculpt_brush_test_init(ss, &test);
 
-		if(ss->cache->original) {
+		if (ss->cache->original) {
 			BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
-				if(sculpt_brush_test_fast(&test, unode->co[vd.i])) {
+				if (sculpt_brush_test_fast(&test, unode->co[vd.i])) {
 					float fno[3];
 
 					normal_short_to_float_v3(fno, unode->no[vd.i]);
@@ -821,8 +826,8 @@ static void calc_area_normal(Sculpt *sd, Object *ob, float an[3], PBVHNode **nod
 		}
 		else {
 			BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
-				if(sculpt_brush_test_fast(&test, vd.co)) {
-					if(vd.no) {
+				if (sculpt_brush_test_fast(&test, vd.co)) {
+					if (vd.no) {
 						float fno[3];
 
 						normal_short_to_float_v3(fno, vd.no);
@@ -850,7 +855,7 @@ static void calc_area_normal(Sculpt *sd, Object *ob, float an[3], PBVHNode **nod
 }
 
 /* This initializes the faces to be moved for this sculpt for draw/layer/flatten; then it
- finds average normal for all active vertices - note that this is called once for each mirroring direction */
+ * finds average normal for all active vertices - note that this is called once for each mirroring direction */
 static void calc_sculpt_normal(Sculpt *sd, Object *ob, float an[3], PBVHNode **nodes, int totnode)
 {
 	SculptSession *ss = ob->sculpt;
@@ -858,7 +863,7 @@ static void calc_sculpt_normal(Sculpt *sd, Object *ob, float an[3], PBVHNode **n
 
 	if (ss->cache->mirror_symmetry_pass == 0 &&
 	    ss->cache->radial_symmetry_pass == 0 &&
-	   (ss->cache->first_time || !(brush->flag & BRUSH_ORIGINAL_NORMAL)))
+	    (ss->cache->first_time || !(brush->flag & BRUSH_ORIGINAL_NORMAL)))
 	{
 		switch (brush->sculpt_plane) {
 			case SCULPT_DISP_DIR_VIEW:
@@ -900,52 +905,45 @@ static void calc_sculpt_normal(Sculpt *sd, Object *ob, float an[3], PBVHNode **n
 }
 
 /* For the smooth brush, uses the neighboring vertices around vert to calculate
-   a smoothed location for vert. Skips corner vertices (used by only one
-   polygon.) */
-static void neighbor_average(SculptSession *ss, float avg[3], const unsigned vert)
+ * a smoothed location for vert. Skips corner vertices (used by only one
+ * polygon.) */
+static void neighbor_average(SculptSession *ss, float avg[3], unsigned vert)
 {
-	int i, skip= -1, total=0;
-	IndexNode *node= ss->fmap[vert].first;
-	char ncount= BLI_countlist(&ss->fmap[vert]);
-	MFace *f;
+	const MeshElemMap *vert_map = &ss->pmap[vert];
+	const MVert *mvert = ss->mvert;
+	float (*deform_co)[3] = ss->deform_cos;
 
-	avg[0] = avg[1] = avg[2] = 0;
+	zero_v3(avg);
 		
 	/* Don't modify corner vertices */
-	if(ncount==1) {
-		if(ss->deform_cos) copy_v3_v3(avg, ss->deform_cos[vert]);
-		else copy_v3_v3(avg, ss->mvert[vert].co);
+	if (vert_map->count > 1) {
+		int i, total = 0;
 
-		return;
-	}
+		for (i = 0; i < vert_map->count; i++) {
+			const MPoly *p = &ss->mpoly[vert_map->indices[i]];
+			unsigned f_adj_v[3];
 
-	while(node){
-		f= &ss->mface[node->index];
-		
-		if(f->v4) {
-			skip= (f->v1==vert?2:
-				   f->v2==vert?3:
-				   f->v3==vert?0:
-				   f->v4==vert?1:-1);
-		}
-
-		for(i=0; i<(f->v4?4:3); ++i) {
-			if(i != skip && (ncount!=2 || BLI_countlist(&ss->fmap[(&f->v1)[i]]) <= 2)) {
-				if(ss->deform_cos) add_v3_v3(avg, ss->deform_cos[(&f->v1)[i]]);
-				else add_v3_v3(avg, ss->mvert[(&f->v1)[i]].co);
-				++total;
+			if (poly_get_adj_loops_from_vert(f_adj_v, p, ss->mloop, vert) != -1) {
+				int j;
+			
+				for (j = 0; j < 3; j++) {
+					if (vert_map->count != 2 || ss->pmap[f_adj_v[j]].count <= 2) {
+						add_v3_v3(avg, deform_co ? deform_co[f_adj_v[j]] :
+						          mvert[f_adj_v[j]].co);
+
+						total++;
+					}
+				}
 			}
 		}
 
-		node= node->next;
+		if (total > 0) {
+			mul_v3_fl(avg, 1.0f / total);
+			return;
+		}
 	}
 
-	if(total>0)
-		mul_v3_fl(avg, 1.0f / total);
-	else {
-		if(ss->deform_cos) copy_v3_v3(avg, ss->deform_cos[vert]);
-		else copy_v3_v3(avg, ss->mvert[vert].co);
-	}
+	copy_v3_v3(avg, deform_co ? deform_co[vert] : mvert[vert].co);
 }
 
 static void do_mesh_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *node, float bstrength)
@@ -959,9 +957,9 @@ static void do_mesh_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *node,
 	sculpt_brush_test_init(ss, &test);
 
 	BLI_pbvh_vertex_iter_begin(ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
-		if(sculpt_brush_test(&test, vd.co)) {
-			const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist,
-								  ss->cache->view_normal, vd.no, vd.fno);
+		if (sculpt_brush_test(&test, vd.co)) {
+			const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
+			                                            ss->cache->view_normal, vd.no, vd.fno);
 			float avg[3], val[3];
 
 			neighbor_average(ss, avg, vd.vert_indices[vd.i]);
@@ -972,8 +970,8 @@ static void do_mesh_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *node,
 
 			sculpt_clip(sd, ss, vd.co, val);
 
-			if(vd.mvert)
-					vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+			if (vd.mvert)
+				vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
 		}
 	}
 	BLI_pbvh_vertex_iter_end;
@@ -994,34 +992,34 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no
 	CLAMP(bstrength, 0.0f, 1.0f);
 
 	BLI_pbvh_node_get_grids(ss->pbvh, node, &grid_indices, &totgrid,
-		NULL, &gridsize, &griddata, &gridadj);
+	                        NULL, &gridsize, &griddata, &gridadj);
 
 	#pragma omp critical
 	{
-		tmpgrid= MEM_mallocN(sizeof(float)*3*gridsize*gridsize, "tmpgrid");
-		tmprow=  MEM_mallocN(sizeof(float)*3*gridsize, "tmprow");
+		tmpgrid = MEM_mallocN(sizeof(float) * 3 * gridsize * gridsize, "tmpgrid");
+		tmprow =  MEM_mallocN(sizeof(float) * 3 * gridsize, "tmprow");
 	}
 
-	for(i = 0; i < totgrid; ++i) {
+	for (i = 0; i < totgrid; ++i) {
 		data = griddata[grid_indices[i]];
 		adj = &gridadj[grid_indices[i]];
 
-		memset(tmpgrid, 0, sizeof(float)*3*gridsize*gridsize);
+		memset(tmpgrid, 0, sizeof(float) * 3 * gridsize * gridsize);
 
-		for (y= 0; y < gridsize-1; y++) {
+		for (y = 0; y < gridsize - 1; y++) {
 			float tmp[3];
 
-			v1 = y*gridsize;
-			add_v3_v3v3(tmprow[0], data[v1].co, data[v1+gridsize].co);
+			v1 = y * gridsize;
+			add_v3_v3v3(tmprow[0], data[v1].co, data[v1 + gridsize].co);
 
-			for (x= 0; x < gridsize-1; x++) {
-				v1 = x + y*gridsize;
+			for (x = 0; x < gridsize - 1; x++) {
+				v1 = x + y * gridsize;
 				v2 = v1 + 1;
 				v3 = v1 + gridsize;
 				v4 = v3 + 1;
 
-				add_v3_v3v3(tmprow[x+1], data[v2].co, data[v4].co);
-				add_v3_v3v3(tmp, tmprow[x+1], tmprow[x]);
+				add_v3_v3v3(tmprow[x + 1], data[v2].co, data[v4].co);
+				add_v3_v3v3(tmp, tmprow[x + 1], tmprow[x]);
 
 				add_v3_v3(tmpgrid[v1], tmp);
 				add_v3_v3(tmpgrid[v2], tmp);
@@ -1031,42 +1029,42 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no
 		}
 
 		/* blend with existing coordinates */
-		for(y = 0; y < gridsize; ++y)  {
-			for(x = 0; x < gridsize; ++x)  {
+		for (y = 0; y < gridsize; ++y) {
+			for (x = 0; x < gridsize; ++x) {
 				float *co;
 				float *fno;
 				int index;
 
-				if(x == 0 && adj->index[0] == -1)
+				if (x == 0 && adj->index[0] == -1)
 					continue;
 
-				if(x == gridsize - 1 && adj->index[2] == -1)
+				if (x == gridsize - 1 && adj->index[2] == -1)
 					continue;
 
-				if(y == 0 && adj->index[3] == -1)
+				if (y == 0 && adj->index[3] == -1)
 					continue;
 
-				if(y == gridsize - 1 && adj->index[1] == -1)
+				if (y == gridsize - 1 && adj->index[1] == -1)
 					continue;
 
-				index = x + y*gridsize;
-				co=  data[index].co;
-				fno= data[index].no;
+				index = x + y * gridsize;
+				co =  data[index].co;
+				fno = data[index].no;
 
-				if(sculpt_brush_test(&test, co)) {
-					const float fade = bstrength*tex_strength(ss, brush, co, test.dist,
-										  ss->cache->view_normal, NULL, fno);
+				if (sculpt_brush_test(&test, co)) {
+					const float fade = bstrength * tex_strength(ss, brush, co, test.dist,
+					                                            ss->cache->view_normal, NULL, fno);
 					float *avg, val[3];
 					float n;
 
-					avg = tmpgrid[x + y*gridsize];
+					avg = tmpgrid[x + y * gridsize];
 
-					n = 1/16.0f;
+					n = 1 / 16.0f;
 
-					if(x == 0 || x == gridsize - 1)
+					if (x == 0 || x == gridsize - 1)
 						n *= 2;
 
-					if(y == 0 || y == gridsize - 1)
+					if (y == 0 || y == gridsize - 1)
 						n *= 2;
 
 					mul_v3_fl(avg, n);
@@ -1093,26 +1091,26 @@ static void smooth(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float
 {
 	SculptSession *ss = ob->sculpt;
 	const int max_iterations = 4;
-	const float fract = 1.0f/max_iterations;
+	const float fract = 1.0f / max_iterations;
 	int iteration, n, count;
 	float last;
 
 	CLAMP(bstrength, 0, 1);
 
-	count = (int)(bstrength*max_iterations);
-	last  = max_iterations*(bstrength - count*fract);
+	count = (int)(bstrength * max_iterations);
+	last  = max_iterations * (bstrength - count * fract);
 
-	for(iteration = 0; iteration <= count; ++iteration) {
+	for (iteration = 0; iteration <= count; ++iteration) {
 		#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
-		for(n=0; n<totnode; n++) {
-			if(ss->multires) {
+		for (n = 0; n < totnode; n++) {
+			if (ss->multires) {
 				do_multires_smooth_brush(sd, ss, nodes[n], iteration != count ? 1.0f : last);
 			}
-			else if(ss->fmap)
+			else if (ss->pmap)
 				do_mesh_smooth_brush(sd, ss, nodes[n], iteration != count ? 1.0f : last);
 		}
 
-		if(ss->multires)
+		if (ss->multires)
 			multires_stitch_grids(ob);
 	}
 }
@@ -1128,7 +1126,7 @@ static void do_draw_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
 	SculptSession *ss = ob->sculpt;
 	Brush *brush = paint_brush(&sd->paint);
 	float offset[3], area_normal[3];
-	float bstrength= ss->cache->bstrength;
+	float bstrength = ss->cache->bstrength;
 	int n;
 
 	calc_sculpt_normal(sd, ob, area_normal, nodes, totnode);
@@ -1140,12 +1138,12 @@ static void do_draw_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
 
 	/* threaded loop over nodes */
 	#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
-	for(n=0; n<totnode; n++) {
+	for (n = 0; n < totnode; n++) {
 		PBVHVertexIter vd;
 		SculptBrushTest test;
 		float (*proxy)[3];
 
-		proxy= BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
+		proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
 
 		sculpt_brush_test_init(ss, &test);
 
@@ -1153,11 +1151,11 @@ static void do_draw_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
 			if (sculpt_brush_test(&test, vd.co)) {
 				/* offset vertex */
 				float fade = tex_strength(ss, brush, vd.co, test.dist,
-							  area_normal, vd.no, vd.fno);
+				                          area_normal, vd.no, vd.fno);
 
 				mul_v3_v3fl(proxy[vd.i], offset, fade);
 
-				if(vd.mvert)
+				if (vd.mvert)
 					vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
 			}
 		}
@@ -1171,7 +1169,7 @@ static void do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
 	const Scene *scene = ss->cache->vc->scene;
 	Brush *brush = paint_brush(&sd->paint);
 	float offset[3], area_normal[3];
-	float bstrength= ss->cache->bstrength;
+	float bstrength = ss->cache->bstrength;
 	float flippedbstrength, crease_correction;
 	int n;
 
@@ -1184,29 +1182,29 @@ static void do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
 	
 	/* we divide out the squared alpha and multiply by the squared crease to give us the pinch strength */
 	
-	if(brush_alpha(scene, brush) > 0.0f)
-		crease_correction = brush->crease_pinch_factor*brush->crease_pinch_factor/(brush_alpha(scene, brush)*brush_alpha(scene, brush));
+	if (brush_alpha(scene, brush) > 0.0f)
+		crease_correction = brush->crease_pinch_factor * brush->crease_pinch_factor / (brush_alpha(scene, brush) * brush_alpha(scene, brush));
 	else
-		crease_correction = brush->crease_pinch_factor*brush->crease_pinch_factor;
+		crease_correction = brush->crease_pinch_factor * brush->crease_pinch_factor;
 
 	/* we always want crease to pinch or blob to relax even when draw is negative */
-	flippedbstrength = (bstrength < 0) ? -crease_correction*bstrength : crease_correction*bstrength;
+	flippedbstrength = (bstrength < 0) ? -crease_correction * bstrength : crease_correction * bstrength;
 
-	if(brush->sculpt_tool == SCULPT_TOOL_BLOB) flippedbstrength *= -1.0f;
+	if (brush->sculpt_tool == SCULPT_TOOL_BLOB) flippedbstrength *= -1.0f;
 
 	/* threaded loop over nodes */
 	#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
-	for(n=0; n<totnode; n++) {
+	for (n = 0; n < totnode; n++) {
 		PBVHVertexIter vd;
 		SculptBrushTest test;
 		float (*proxy)[3];
 
-		proxy= BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
+		proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
 
 		sculpt_brush_test_init(ss, &test);
 
 		BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
-			if(sculpt_brush_test(&test, vd.co)) {
+			if (sculpt_brush_test(&test, vd.co)) {
 				/* offset vertex */
 				const float fade = tex_strength(ss, brush, vd.co, test.dist,
 				                                area_normal, vd.no, vd.fno);
@@ -1215,15 +1213,14 @@ static void do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
 
 				/* first we pinch */
 				sub_v3_v3v3(val1, test.location, vd.co);
-				//mul_v3_v3(val1, ss->cache->scale);
-				mul_v3_fl(val1, fade*flippedbstrength);
+				mul_v3_fl(val1, fade * flippedbstrength);
 
 				/* then we draw */
 				mul_v3_v3fl(val2, offset, fade);
 
 				add_v3_v3v3(proxy[vd.i], val1, val2);
 
-				if(vd.mvert)
+				if (vd.mvert)
 					vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
 			}
 		}
@@ -1235,29 +1232,29 @@ static void do_pinch_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
 {
 	SculptSession *ss = ob->sculpt;
 	Brush *brush = paint_brush(&sd->paint);
-	float bstrength= ss->cache->bstrength;
+	float bstrength = ss->cache->bstrength;
 	int n;
 
 	#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
-	for(n=0; n<totnode; n++) {
+	for (n = 0; n < totnode; n++) {
 		PBVHVertexIter vd;
 		SculptBrushTest test;
 		float (*proxy)[3];
 
-		proxy= BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
+		proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
 
 		sculpt_brush_test_init(ss, &test);
 
 		BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
-			if(sculpt_brush_test(&test, vd.co)) {
-				float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist,
-								    ss->cache->view_normal, vd.no, vd.fno);
+			if (sculpt_brush_test(&test, vd.co)) {
+				float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
+				                                      ss->cache->view_normal, vd.no, vd.fno);
 				float val[3];
 
 				sub_v3_v3v3(val, test.location, vd.co);
 				mul_v3_v3fl(proxy[vd.i], val, fade);
 
-				if(vd.mvert)
+				if (vd.mvert)
 					vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
 			}
 		}
@@ -1268,14 +1265,14 @@ static void do_pinch_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
 static void do_grab_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
 {
 	SculptSession *ss = ob->sculpt;
-	Brush *brush= paint_brush(&sd->paint);
-	float bstrength= ss->cache->bstrength;
+	Brush *brush = paint_brush(&sd->paint);
+	float bstrength = ss->cache->bstrength;
 	float grab_delta[3], an[3];
 	int n;
 	float len;
 
 	if (brush->normal_weight > 0 || brush->flag & BRUSH_FRONTFACE) {
-		int cache= 1;
+		int cache = 1;
 		/* grab brush requires to test on original data */
 		SWAP(int, ss->cache->original, cache);
 		calc_sculpt_normal(sd, ob, an, nodes, totnode);
@@ -1287,36 +1284,37 @@ static void do_grab_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
 	len = len_v3(grab_delta);
 
 	if (brush->normal_weight > 0) {
-		mul_v3_fl(an, len*brush->normal_weight);
+		mul_v3_fl(an, len * brush->normal_weight);
 		mul_v3_fl(grab_delta, 1.0f - brush->normal_weight);
 		add_v3_v3(grab_delta, an);
 	}
 
 	#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
-	for(n=0; n<totnode; n++) {
+	for (n = 0; n < totnode; n++) {
 		PBVHVertexIter vd;
-		SculptUndoNode* unode;
+		SculptUndoNode *unode;
 		SculptBrushTest test;
 		float (*origco)[3];
 		short (*origno)[3];
 		float (*proxy)[3];
 
-		unode=  sculpt_undo_push_node(ob, nodes[n]);
-		origco= unode->co;
-		origno= unode->no;
+		unode =  sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS);
+		origco = unode->co;
+		origno = unode->no;
 
-		proxy= BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
+		proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
 
 		sculpt_brush_test_init(ss, &test);
 
-		BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
-			if(sculpt_brush_test(&test, origco[vd.i])) {
-				const float fade = bstrength*tex_strength(ss, brush, origco[vd.i], test.dist,
-				                                          an, origno[vd.i], NULL);
+		BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE)
+		{
+			if (sculpt_brush_test(&test, origco[vd.i])) {
+				const float fade = bstrength * tex_strength(ss, brush, origco[vd.i], test.dist,
+				                                            an, origno[vd.i], NULL);
 
 				mul_v3_v3fl(proxy[vd.i], grab_delta, fade);
 
-				if(vd.mvert)
+				if (vd.mvert)
 					vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
 			}
 		}
@@ -1342,23 +1340,23 @@ static void do_nudge_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
 	cross_v3_v3v3(cono, tmp, an);
 
 	#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
-	for(n = 0; n < totnode; n++) {
+	for (n = 0; n < totnode; n++) {
 		PBVHVertexIter vd;
 		SculptBrushTest test;
 		float (*proxy)[3];
 
-		proxy= BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
+		proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
 
 		sculpt_brush_test_init(ss, &test);
 
 		BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
-			if(sculpt_brush_test(&test, vd.co)) {
-				const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist,
-									  an, vd.no, vd.fno);
+			if (sculpt_brush_test(&test, vd.co)) {
+				const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
+				                                            an, vd.no, vd.fno);
 
 				mul_v3_v3fl(proxy[vd.i], cono, fade);
 
-				if(vd.mvert)
+				if (vd.mvert)
 					vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
 			}
 		}
@@ -1386,29 +1384,29 @@ static void do_snake_hook_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
 		negate_v3(grab_delta);
 
 	if (brush->normal_weight > 0) {
-		mul_v3_fl(an, len*brush->normal_weight);
+		mul_v3_fl(an, len * brush->normal_weight);
 		mul_v3_fl(grab_delta, 1.0f - brush->normal_weight);
 		add_v3_v3(grab_delta, an);
 	}
 
 	#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
-	for(n = 0; n < totnode; n++) {
+	for (n = 0; n < totnode; n++) {
 		PBVHVertexIter vd;
 		SculptBrushTest test;
 		float (*proxy)[3];
 
-		proxy= BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
+		proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
 
 		sculpt_brush_test_init(ss, &test);
 
 		BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
-			if(sculpt_brush_test(&test, vd.co)) {
-				const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist,
-				                                          an, vd.no, vd.fno);
+			if (sculpt_brush_test(&test, vd.co)) {
+				const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
+				                                            an, vd.no, vd.fno);
 
 				mul_v3_v3fl(proxy[vd.i], grab_delta, fade);
 
-				if(vd.mvert)
+				if (vd.mvert)
 					vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
 			}
 		}
@@ -1434,30 +1432,30 @@ static void do_thumb_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
 	cross_v3_v3v3(cono, tmp, an);
 
 	#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
-	for(n = 0; n < totnode; n++) {
+	for (n = 0; n < totnode; n++) {
 		PBVHVertexIter vd;
-		SculptUndoNode* unode;
+		SculptUndoNode *unode;
 		SculptBrushTest test;
 		float (*origco)[3];
 		short (*origno)[3];
 		float (*proxy)[3];
 
-		unode=  sculpt_undo_push_node(ob, nodes[n]);
-		origco= unode->co;
-		origno= unode->no;
+		unode =  sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS);
+		origco = unode->co;
+		origno = unode->no;
 
-		proxy= BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
+		proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
 
 		sculpt_brush_test_init(ss, &test);
 
 		BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
-			if(sculpt_brush_test(&test, origco[vd.i])) {
-				const float fade = bstrength*tex_strength(ss, brush, origco[vd.i], test.dist,
-									  an, origno[vd.i], NULL);
+			if (sculpt_brush_test(&test, origco[vd.i])) {
+				const float fade = bstrength * tex_strength(ss, brush, origco[vd.i], test.dist,
+				                                            an, origno[vd.i], NULL);
 
 				mul_v3_v3fl(proxy[vd.i], cono, fade);
 
-				if(vd.mvert)
+				if (vd.mvert)
 					vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
 			}
 		}
@@ -1468,8 +1466,8 @@ static void do_thumb_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
 static void do_rotate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
 {
 	SculptSession *ss = ob->sculpt;
-	Brush *brush= paint_brush(&sd->paint);
-	float bstrength= ss->cache->bstrength;
+	Brush *brush = paint_brush(&sd->paint);
+	float bstrength = ss->cache->bstrength;
 	float an[3];
 	int n;
 	float m[4][4], rot[4][4], lmat[4][4], ilmat[4][4];
@@ -1488,32 +1486,32 @@ static void do_rotate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
 	mul_serie_m4(m, lmat, rot, ilmat, NULL, NULL, NULL, NULL, NULL);
 
 	#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
-	for(n=0; n<totnode; n++) {
+	for (n = 0; n < totnode; n++) {
 		PBVHVertexIter vd;
-		SculptUndoNode* unode;
+		SculptUndoNode *unode;
 		SculptBrushTest test;
 		float (*origco)[3];
 		short (*origno)[3];
 		float (*proxy)[3];
 
-		unode=  sculpt_undo_push_node(ob, nodes[n]);
-		origco= unode->co;
-		origno= unode->no;
+		unode =  sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS);
+		origco = unode->co;
+		origno = unode->no;
 
-		proxy= BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
+		proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
 
 		sculpt_brush_test_init(ss, &test);
 
 		BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
-			if(sculpt_brush_test(&test, origco[vd.i])) {
-				const float fade = bstrength*tex_strength(ss, brush, origco[vd.i], test.dist,
-				                                          an, origno[vd.i], NULL);
+			if (sculpt_brush_test(&test, origco[vd.i])) {
+				const float fade = bstrength * tex_strength(ss, brush, origco[vd.i], test.dist,
+				                                            an, origno[vd.i], NULL);
 
 				mul_v3_m4v3(proxy[vd.i], m, origco[vd.i]);
 				sub_v3_v3(proxy[vd.i], origco[vd.i]);
 				mul_v3_fl(proxy[vd.i], fade);
 
-				if(vd.mvert)
+				if (vd.mvert)
 					vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
 			}
 		}
@@ -1525,12 +1523,12 @@ static void do_layer_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
 {
 	SculptSession *ss = ob->sculpt;
 	Brush *brush = paint_brush(&sd->paint);
-	float bstrength= ss->cache->bstrength;
+	float bstrength = ss->cache->bstrength;
 	float area_normal[3], offset[3];
-	float lim= brush->height;
+	float lim = brush->height;
 	int n;
 
-	if(bstrength < 0)
+	if (bstrength < 0)
 		lim = -lim;
 
 	calc_sculpt_normal(sd, ob, area_normal, nodes, totnode);
@@ -1538,44 +1536,42 @@ static void do_layer_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
 	mul_v3_v3v3(offset, ss->cache->scale, area_normal);
 
 	#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
-	for(n=0; n<totnode; n++) {
+	for (n = 0; n < totnode; n++) {
 		PBVHVertexIter vd;
 		SculptBrushTest test;
 		SculptUndoNode *unode;
 		float (*origco)[3], *layer_disp;
-		//float (*proxy)[3]; // XXX layer brush needs conversion to proxy but its more complicated
-
-		//proxy= BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
+		/* XXX: layer brush needs conversion to proxy but its more complicated */
+		/* proxy= BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co; */
 		
-		unode= sculpt_undo_push_node(ob, nodes[n]);
-		origco=unode->co;
-		if(!unode->layer_disp)
-			{
-				#pragma omp critical 
-				unode->layer_disp= MEM_callocN(sizeof(float)*unode->totvert, "layer disp");
-			}
+		unode = sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS);
+		origco = unode->co;
+		if (!unode->layer_disp) {
+			#pragma omp critical 
+			unode->layer_disp = MEM_callocN(sizeof(float) * unode->totvert, "layer disp");
+		}
 
-		layer_disp= unode->layer_disp;
+		layer_disp = unode->layer_disp;
 
 		sculpt_brush_test_init(ss, &test);
 
 		BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
-			if(sculpt_brush_test(&test, origco[vd.i])) {
-				const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist,
-									  area_normal, vd.no, vd.fno);
-				float *disp= &layer_disp[vd.i];
+			if (sculpt_brush_test(&test, origco[vd.i])) {
+				const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
+				                                            area_normal, vd.no, vd.fno);
+				float *disp = &layer_disp[vd.i];
 				float val[3];
 
-				*disp+= fade;
+				*disp += fade;
 
 				/* Don't let the displacement go past the limit */
-				if((lim < 0 && *disp < lim) || (lim >= 0 && *disp > lim))
+				if ((lim < 0 && *disp < lim) || (lim >= 0 && *disp > lim))
 					*disp = lim;
 
 				mul_v3_v3fl(val, offset, *disp);
 
-				if(ss->layer_co && (brush->flag & BRUSH_PERSISTENT)) {
-					int index= vd.vert_indices[vd.i];
+				if (ss->layer_co && (brush->flag & BRUSH_PERSISTENT)) {
+					int index = vd.vert_indices[vd.i];
 
 					/* persistent base */
 					add_v3_v3(val, ss->layer_co[index]);
@@ -1586,7 +1582,7 @@ static void do_layer_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
 
 				sculpt_clip(sd, ss, vd.co, val);
 
-				if(vd.mvert)
+				if (vd.mvert)
 					vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
 			}
 		}
@@ -1598,32 +1594,32 @@ static void do_inflate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
 {
 	SculptSession *ss = ob->sculpt;
 	Brush *brush = paint_brush(&sd->paint);
-	float bstrength= ss->cache->bstrength;
+	float bstrength = ss->cache->bstrength;
 	int n;
 
 	#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
-	for(n=0; n<totnode; n++) {
+	for (n = 0; n < totnode; n++) {
 		PBVHVertexIter vd;
 		SculptBrushTest test;
 		float (*proxy)[3];
 
-		proxy= BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
+		proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
 
 		sculpt_brush_test_init(ss, &test);
 
 		BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
-			if(sculpt_brush_test(&test, vd.co)) {
-				const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist,
-				                                          ss->cache->view_normal, vd.no, vd.fno);
+			if (sculpt_brush_test(&test, vd.co)) {
+				const float fade = bstrength * tex_strength(ss, brush, vd.co, test.dist,
+				                                            ss->cache->view_normal, vd.no, vd.fno);
 				float val[3];
 
-				if(vd.fno) copy_v3_v3(val, vd.fno);
+				if (vd.fno) copy_v3_v3(val, vd.fno);
 				else normal_short_to_float_v3(val, vd.no);
 				
 				mul_v3_fl(val, fade * ss->cache->radius);
 				mul_v3_v3v3(proxy[vd.i], val, ss->cache->scale);
 
-				if(vd.mvert)
+				if (vd.mvert)
 					vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
 			}
 		}
@@ -1643,19 +1639,19 @@ static void calc_flatten_center(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
 	zero_v3(fc);
 
 	#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
-	for(n=0; n<totnode; n++) {
+	for (n = 0; n < totnode; n++) {
 		PBVHVertexIter vd;
 		SculptBrushTest test;
 		SculptUndoNode *unode;
 		float private_fc[3] = {0.0f, 0.0f, 0.0f};
 		int private_count = 0;
 
-		unode = sculpt_undo_push_node(ob, nodes[n]);
+		unode = sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS);
 		sculpt_brush_test_init(ss, &test);
 
-		if(ss->cache->original) {
+		if (ss->cache->original) {
 			BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
-				if(sculpt_brush_test_fast(&test, unode->co[vd.i])) {
+				if (sculpt_brush_test_fast(&test, unode->co[vd.i])) {
 					add_v3_v3(private_fc, unode->co[vd.i]);
 					private_count++;
 				}
@@ -1664,7 +1660,7 @@ static void calc_flatten_center(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
 		}
 		else {
 			BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
-				if(sculpt_brush_test_fast(&test, vd.co)) {
+				if (sculpt_brush_test_fast(&test, vd.co)) {
 					add_v3_v3(private_fc, vd.co);
 					private_count++;
 				}
@@ -1683,30 +1679,30 @@ static void calc_flatten_center(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
 }
 
 /* this calculates flatten center and area normal together, 
-amortizing the memory bandwidth and loop overhead to calculate both at the same time */
+ * amortizing the memory bandwidth and loop overhead to calculate both at the same time */
 static void calc_area_normal_and_flatten_center(Sculpt *sd, Object *ob,
-												PBVHNode **nodes, int totnode,
-												float an[3], float fc[3])
+                                                PBVHNode **nodes, int totnode,
+                                                float an[3], float fc[3])
 {
 	SculptSession *ss = ob->sculpt;
 	int n;
 
-	// an
+	/* for area normal */
 	float out_flip[3] = {0.0f, 0.0f, 0.0f};
 
-	// fc
+	/* for flatten center */
 	float count = 0;
 
 	(void)sd; /* unused w/o openmp */
 	
-	// an
+	/* for area normal */
 	zero_v3(an);
 
-	// fc
+	/* for flatten center */
 	zero_v3(fc);
 
 	#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
-	for(n=0; n<totnode; n++) {
+	for (n = 0; n < totnode; n++) {
 		PBVHVertexIter vd;
 		SculptBrushTest test;
 		SculptUndoNode *unode;
@@ -1715,19 +1711,19 @@ static void calc_area_normal_and_flatten_center(Sculpt *sd, Object *ob,
 		float private_fc[3] = {0.0f, 0.0f, 0.0f};
 		int private_count = 0;
 
-		unode = sculpt_undo_push_node(ob, nodes[n]);
+		unode = sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS);
 		sculpt_brush_test_init(ss, &test);
 
-		if(ss->cache->original) {
+		if (ss->cache->original) {
 			BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
-				if(sculpt_brush_test_fast(&test, unode->co[vd.i])) {
-					// an
+				if (sculpt_brush_test_fast(&test, unode->co[vd.i])) {
+					/* for area normal */
 					float fno[3];
 
 					normal_short_to_float_v3(fno, unode->no[vd.i]);
 					add_norm_if(ss->cache->view_normal, private_an, private_out_flip, fno);
 
-					// fc
+					/* for flatten center */
 					add_v3_v3(private_fc, unode->co[vd.i]);
 					private_count++;
 				}
@@ -1736,9 +1732,9 @@ static void calc_area_normal_and_flatten_center(Sculpt *sd, Object *ob,
 		}
 		else {
 			BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
-				if(sculpt_brush_test_fast(&test, vd.co)) {
-					// an
-					if(vd.no) {
+				if (sculpt_brush_test_fast(&test, vd.co)) {
+					/* for area normal */
+					if (vd.no) {
 						float fno[3];
 
 						normal_short_to_float_v3(fno, vd.no);
@@ -1748,7 +1744,7 @@ static void calc_area_normal_and_flatten_center(Sculpt *sd, Object *ob,
 						add_norm_if(ss->cache->view_normal, private_an, private_out_flip, vd.fno);
 					}
 
-					// fc
+					/* for flatten center */
 					add_v3_v3(private_fc, vd.co);
 					private_count++;
 				}
@@ -1758,23 +1754,23 @@ static void calc_area_normal_and_flatten_center(Sculpt *sd, Object *ob,
 
 		#pragma omp critical
 		{
-			// an
+			/* for area normal */
 			add_v3_v3(an, private_an);
 			add_v3_v3(out_flip, private_out_flip);
 
-			// fc
+			/* for flatten center */
 			add_v3_v3(fc, private_fc);
 			count += private_count;
 		}
 	}
 
-	// an
+	/* for area normal */
 	if (is_zero_v3(an))
 		copy_v3_v3(an, out_flip);
 
 	normalize_v3(an);
 
-	// fc
+	/* for flatten center */
 	if (count != 0) {
 		mul_v3_fl(fc, 1.0f / count);
 	}
@@ -1790,7 +1786,7 @@ static void calc_sculpt_plane(Sculpt *sd, Object *ob, PBVHNode **nodes, int totn
 
 	if (ss->cache->mirror_symmetry_pass == 0 &&
 	    ss->cache->radial_symmetry_pass == 0 &&
-	   (ss->cache->first_time || !(brush->flag & BRUSH_ORIGINAL_NORMAL)))
+	    (ss->cache->first_time || !(brush->flag & BRUSH_ORIGINAL_NORMAL)))
 	{
 		switch (brush->sculpt_plane) {
 			case SCULPT_DISP_DIR_VIEW:
@@ -1822,34 +1818,34 @@ static void calc_sculpt_plane(Sculpt *sd, Object *ob, PBVHNode **nodes, int totn
 				break;
 		}
 
-		// fc
+		/* for flatten center */
 		/* flatten center has not been calculated yet if we are not using the area normal */
 		if (brush->sculpt_plane != SCULPT_DISP_DIR_AREA)
 			calc_flatten_center(sd, ob, nodes, totnode, fc);
 
-		// an
+		/* for area normal */
 		copy_v3_v3(ss->cache->last_area_normal, an);
 
-		// fc
+		/* for flatten center */
 		copy_v3_v3(ss->cache->last_center, fc);
 	}
 	else {
-		// an
+		/* for area normal */
 		copy_v3_v3(an, ss->cache->last_area_normal);
 
-		// fc
+		/* for flatten center */
 		copy_v3_v3(fc, ss->cache->last_center);
 
-		// an
+		/* for area normal */
 		flip_coord(an, an, ss->cache->mirror_symmetry_pass);
 
-		// fc
+		/* for flatten center */
 		flip_coord(fc, fc, ss->cache->mirror_symmetry_pass);
 
-		// an
+		/* for area normal */
 		mul_m4_v3(ss->cache->symm_rot_mat, an);
 
-		// fc
+		/* for flatten center */
 		mul_m4_v3(ss->cache->symm_rot_mat, fc);
 	}
 }
@@ -1864,7 +1860,7 @@ static void point_plane_project(float intr[3], float co[3], float plane_normal[3
 
 static int plane_trim(StrokeCache *cache, Brush *brush, float val[3])
 {
-	return !(brush->flag & BRUSH_PLANE_TRIM) || (dot_v3v3(val, val) <= cache->radius_squared*cache->plane_trim_squared);
+	return !(brush->flag & BRUSH_PLANE_TRIM) || (dot_v3v3(val, val) <= cache->radius_squared * cache->plane_trim_squared);
 }
 
 static int plane_point_side_flip(float co[3], float plane_normal[3], float plane_center[3], int flip)
@@ -1885,12 +1881,12 @@ static int plane_point_side(float co[3], float plane_normal[3], float plane_cent
 	float delta[3];
 
 	sub_v3_v3v3(delta, co, plane_center);
-	return  dot_v3v3(plane_normal, delta) <= 0.0f;
+	return dot_v3v3(plane_normal, delta) <= 0.0f;
 }
 
 static float get_offset(Sculpt *sd, SculptSession *ss)
 {
-	Brush* brush = paint_brush(&sd->paint);
+	Brush *brush = paint_brush(&sd->paint);
 
 	float rv = brush->plane_offset;
 
@@ -1922,19 +1918,19 @@ static void do_flatten_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
 
 	calc_sculpt_plane(sd, ob, nodes, totnode, an, fc);
 
-	displace = radius*offset;
+	displace = radius * offset;
 
 	mul_v3_v3v3(temp, an, ss->cache->scale);
 	mul_v3_fl(temp, displace);
 	add_v3_v3(fc, temp);
 
 	#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
-	for(n = 0; n < totnode; n++) {
-		PBVHVertexIter  vd;
+	for (n = 0; n < totnode; n++) {
+		PBVHVertexIter vd;
 		SculptBrushTest test;
 		float (*proxy)[3];
 
-		proxy= BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
+		proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
 
 		sculpt_brush_test_init(ss, &test);
 
@@ -1948,12 +1944,12 @@ static void do_flatten_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno
 				sub_v3_v3v3(val, intr, vd.co);
 
 				if (plane_trim(ss->cache, brush, val)) {
-					const float fade = bstrength*tex_strength(ss, brush, vd.co, sqrt(test.dist),
-					                                          an, vd.no, vd.fno);
+					const float fade = bstrength * tex_strength(ss, brush, vd.co, sqrt(test.dist),
+					                                            an, vd.no, vd.fno);
 
 					mul_v3_v3fl(proxy[vd.i], val, fade);
 
-					if(vd.mvert)
+					if (vd.mvert)
 						vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
 				}
 			}
@@ -1973,13 +1969,12 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
 	
 	float displace;
 
-	float an[3]; // area normal
-	float fc[3]; // flatten center
+	float an[3];
+	float fc[3];
 
 	int n;
 
 	float temp[3];
-	//float p[3];
 
 	int flip;
 
@@ -1992,13 +1987,13 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
 		radius    = -radius;
 	}
 
-	displace = radius * (0.25f+offset);
+	displace = radius * (0.25f + offset);
 
 	mul_v3_v3v3(temp, an, ss->cache->scale);
 	mul_v3_fl(temp, displace);
 	add_v3_v3(fc, temp);
 
-	//add_v3_v3v3(p, ss->cache->location, an);
+	/* add_v3_v3v3(p, ss->cache->location, an); */
 
 	#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
 	for (n = 0; n < totnode; n++) {
@@ -2006,14 +2001,13 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
 		SculptBrushTest test;
 		float (*proxy)[3];
 
-		proxy= BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
+		proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
 
 		sculpt_brush_test_init(ss, &test);
 
 		BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
 			if (sculpt_brush_test_sq(&test, vd.co)) {
 				if (plane_point_side_flip(vd.co, an, fc, flip)) {
-				//if (sculpt_brush_test_cyl(&test, vd.co, ss->cache->location, p)) {
 					float intr[3];
 					float val[3];
 
@@ -2022,13 +2016,13 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
 					sub_v3_v3v3(val, intr, vd.co);
 
 					if (plane_trim(ss->cache, brush, val)) {
-						const float fade = bstrength*tex_strength(ss, brush, vd.co,
-											  sqrt(test.dist),
-											  an, vd.no, vd.fno);
+						const float fade = bstrength * tex_strength(ss, brush, vd.co,
+						                                            sqrt(test.dist),
+						                                            an, vd.no, vd.fno);
 
 						mul_v3_v3fl(proxy[vd.i], val, fade);
 
-						if(vd.mvert)
+						if (vd.mvert)
 							vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
 					}
 				}
@@ -2038,7 +2032,7 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
 	}
 }
 
-static void do_clay_tubes_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
+static void do_clay_strips_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
 {
 	SculptSession *ss = ob->sculpt;
 	Brush *brush = paint_brush(&sd->paint);
@@ -2049,9 +2043,9 @@ static void do_clay_tubes_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
 	
 	float displace;
 
-	float sn[3]; // sculpt normal
-	float an[3]; // area normal
-	float fc[3]; // flatten center
+	float sn[3];
+	float an[3];
+	float fc[3];
 
 	int n;
 
@@ -2069,8 +2063,9 @@ static void do_clay_tubes_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
 	else
 		copy_v3_v3(an, sn);
 
+	/* delay the first daub because grab delta is not setup */
 	if (ss->cache->first_time)
-		return; // delay the first daub because grab delta is not setup
+		return;
 
 	flip = bstrength < 0;
 
@@ -2079,17 +2074,24 @@ static void do_clay_tubes_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
 		radius    = -radius;
 	}
 
-	displace = radius * (0.25f+offset);
+	displace = radius * (0.25f + offset);
 
 	mul_v3_v3v3(temp, sn, ss->cache->scale);
 	mul_v3_fl(temp, displace);
 	add_v3_v3(fc, temp);
 
-	cross_v3_v3v3(mat[0], an, ss->cache->grab_delta_symmetry); mat[0][3] = 0;
-	cross_v3_v3v3(mat[1], an, mat[0]); mat[1][3] = 0;
-	copy_v3_v3(mat[2], an); mat[2][3] = 0;
-	copy_v3_v3(mat[3], ss->cache->location);  mat[3][3] = 1;
+	/* init mat */
+	cross_v3_v3v3(mat[0], an, ss->cache->grab_delta_symmetry);
+	mat[0][3] = 0;
+	cross_v3_v3v3(mat[1], an, mat[0]);
+	mat[1][3] = 0;
+	copy_v3_v3(mat[2], an);
+	mat[2][3] = 0;
+	copy_v3_v3(mat[3], ss->cache->location);
+	mat[3][3] = 1;
 	normalize_m4(mat);
+
+	/* scale mat */
 	scale_m4_fl(scale, ss->cache->radius);
 	mult_m4_m4m4(tmat, mat, scale);
 	invert_m4_m4(mat, tmat);
@@ -2100,7 +2102,7 @@ static void do_clay_tubes_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
 		SculptBrushTest test;
 		float (*proxy)[3];
 
-		proxy= BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
+		proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
 
 		sculpt_brush_test_init(ss, &test);
 
@@ -2115,13 +2117,13 @@ static void do_clay_tubes_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
 					sub_v3_v3v3(val, intr, vd.co);
 
 					if (plane_trim(ss->cache, brush, val)) {
-						const float fade = bstrength*tex_strength(ss, brush, vd.co,
-						                                          ss->cache->radius*test.dist,
-						                                          an, vd.no, vd.fno);
+						const float fade = bstrength * tex_strength(ss, brush, vd.co,
+						                                            ss->cache->radius * test.dist,
+						                                            an, vd.no, vd.fno);
 
 						mul_v3_v3fl(proxy[vd.i], val, fade);
 
-						if(vd.mvert)
+						if (vd.mvert)
 							vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
 					}
 				}
@@ -2151,7 +2153,7 @@ static void do_fill_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
 
 	calc_sculpt_plane(sd, ob, nodes, totnode, an, fc);
 
-	displace = radius*offset;
+	displace = radius * offset;
 
 	mul_v3_v3v3(temp, an, ss->cache->scale);
 	mul_v3_fl(temp, displace);
@@ -2163,7 +2165,7 @@ static void do_fill_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
 		SculptBrushTest test;
 		float (*proxy)[3];
 
-		proxy= BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
+		proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
 
 		sculpt_brush_test_init(ss, &test);
 
@@ -2178,13 +2180,13 @@ static void do_fill_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
 					sub_v3_v3v3(val, intr, vd.co);
 
 					if (plane_trim(ss->cache, brush, val)) {
-						const float fade = bstrength*tex_strength(ss, brush, vd.co,
-											  sqrt(test.dist),
-											  an, vd.no, vd.fno);
+						const float fade = bstrength * tex_strength(ss, brush, vd.co,
+						                                            sqrt(test.dist),
+						                                            an, vd.no, vd.fno);
 
 						mul_v3_v3fl(proxy[vd.i], val, fade);
 
-						if(vd.mvert)
+						if (vd.mvert)
 							vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
 					}
 				}
@@ -2214,7 +2216,7 @@ static void do_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
 
 	calc_sculpt_plane(sd, ob, nodes, totnode, an, fc);
 
-	displace = -radius*offset;
+	displace = -radius * offset;
 
 	mul_v3_v3v3(temp, an, ss->cache->scale);
 	mul_v3_fl(temp, displace);
@@ -2226,7 +2228,7 @@ static void do_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
 		SculptBrushTest test;
 		float (*proxy)[3];
 
-		proxy= BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
+		proxy = BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co;
 
 		sculpt_brush_test_init(ss, &test);
 
@@ -2241,13 +2243,13 @@ static void do_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
 					sub_v3_v3v3(val, intr, vd.co);
 
 					if (plane_trim(ss->cache, brush, val)) {
-						const float fade = bstrength*tex_strength(ss, brush, vd.co,
-						                                          sqrt(test.dist),
-						                                          an, vd.no, vd.fno);
+						const float fade = bstrength * tex_strength(ss, brush, vd.co,
+						                                            sqrt(test.dist),
+						                                            an, vd.no, vd.fno);
 
 						mul_v3_v3fl(proxy[vd.i], val, fade);
 
-						if(vd.mvert)
+						if (vd.mvert)
 							vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
 					}
 				}
@@ -2259,36 +2261,36 @@ static void do_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod
 
 void sculpt_vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
 {
-	Mesh *me= (Mesh*)ob->data;
-	float (*ofs)[3]= NULL;
-	int a, is_basis= 0;
+	Mesh *me = (Mesh *)ob->data;
+	float (*ofs)[3] = NULL;
+	int a, is_basis = 0;
 	KeyBlock *currkey;
 
 	/* for relative keys editing of base should update other keys */
 	if (me->key->type == KEY_RELATIVE)
-		for (currkey = me->key->block.first; currkey; currkey= currkey->next)
-			if(ob->shapenr-1 == currkey->relative) {
-				is_basis= 1;
+		for (currkey = me->key->block.first; currkey; currkey = currkey->next)
+			if (ob->shapenr - 1 == currkey->relative) {
+				is_basis = 1;
 				break;
 			}
 
 	if (is_basis) {
-		ofs= key_to_vertcos(ob, kb);
+		ofs = key_to_vertcos(ob, kb);
 
 		/* calculate key coord offsets (from previous location) */
-		for (a= 0; a < me->totvert; a++) {
+		for (a = 0; a < me->totvert; a++) {
 			sub_v3_v3v3(ofs[a], vertCos[a], ofs[a]);
 		}
 
 		/* apply offsets on other keys */
 		currkey = me->key->block.first;
 		while (currkey) {
-			int apply_offset = ((currkey != kb) && (ob->shapenr-1 == currkey->relative));
+			int apply_offset = ((currkey != kb) && (ob->shapenr - 1 == currkey->relative));
 
 			if (apply_offset)
 				offset_to_key(ob, currkey, ofs);
 
-			currkey= currkey->next;
+			currkey = currkey->next;
 		}
 
 		MEM_freeN(ofs);
@@ -2296,12 +2298,12 @@ void sculpt_vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
 
 	/* modifying of basis key should update mesh */
 	if (kb == me->key->refkey) {
-		MVert *mvert= me->mvert;
+		MVert *mvert = me->mvert;
 
-		for (a= 0; a < me->totvert; a++, mvert++)
+		for (a = 0; a < me->totvert; a++, mvert++)
 			copy_v3_v3(mvert->co, vertCos[a]);
 
-		mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
+		mesh_calc_normals_mapping(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL);
 	}
 
 	/* apply new coords on active key block */
@@ -2325,69 +2327,69 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush)
 	/* Only act if some verts are inside the brush area */
 	if (totnode) {
 		#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
-		for (n= 0; n < totnode; n++) {
-			sculpt_undo_push_node(ob, nodes[n]);
+		for (n = 0; n < totnode; n++) {
+			sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS);
 			BLI_pbvh_node_mark_update(nodes[n]);
 		}
 
 		/* Apply one type of brush action */
-		switch(brush->sculpt_tool){
-		case SCULPT_TOOL_DRAW:
-			do_draw_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_SMOOTH:
-			do_smooth_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_CREASE:
-			do_crease_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_BLOB:
-			do_crease_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_PINCH:
-			do_pinch_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_INFLATE:
-			do_inflate_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_GRAB:
-			do_grab_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_ROTATE:
-			do_rotate_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_SNAKE_HOOK:
-			do_snake_hook_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_NUDGE:
-			do_nudge_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_THUMB:
-			do_thumb_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_LAYER:
-			do_layer_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_FLATTEN:
-			do_flatten_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_CLAY:
-			do_clay_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_CLAY_TUBES:
-			do_clay_tubes_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_FILL:
-			do_fill_brush(sd, ob, nodes, totnode);
-			break;
-		case SCULPT_TOOL_SCRAPE:
-			do_scrape_brush(sd, ob, nodes, totnode);
-			break;
+		switch (brush->sculpt_tool) {
+			case SCULPT_TOOL_DRAW:
+				do_draw_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_SMOOTH:
+				do_smooth_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_CREASE:
+				do_crease_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_BLOB:
+				do_crease_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_PINCH:
+				do_pinch_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_INFLATE:
+				do_inflate_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_GRAB:
+				do_grab_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_ROTATE:
+				do_rotate_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_SNAKE_HOOK:
+				do_snake_hook_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_NUDGE:
+				do_nudge_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_THUMB:
+				do_thumb_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_LAYER:
+				do_layer_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_FLATTEN:
+				do_flatten_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_CLAY:
+				do_clay_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_CLAY_STRIPS:
+				do_clay_strips_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_FILL:
+				do_fill_brush(sd, ob, nodes, totnode);
+				break;
+			case SCULPT_TOOL_SCRAPE:
+				do_scrape_brush(sd, ob, nodes, totnode);
+				break;
 		}
 
 		if (brush->sculpt_tool != SCULPT_TOOL_SMOOTH && brush->autosmooth_factor > 0) {
 			if (brush->flag & BRUSH_INVERSE_SMOOTH_PRESSURE) {
-				smooth(sd, ob, nodes, totnode, brush->autosmooth_factor*(1-ss->cache->pressure));
+				smooth(sd, ob, nodes, totnode, brush->autosmooth_factor * (1 - ss->cache->pressure));
 			}
 			else {
 				smooth(sd, ob, nodes, totnode, brush->autosmooth_factor);
@@ -2402,9 +2404,9 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush)
 static void sculpt_flush_pbvhvert_deform(Object *ob, PBVHVertexIter *vd)
 {
 	SculptSession *ss = ob->sculpt;
-	Mesh *me= ob->data;
+	Mesh *me = ob->data;
 	float disp[3], newco[3];
-	int index= vd->vert_indices[vd->i];
+	int index = vd->vert_indices[vd->i];
 
 	sub_v3_v3v3(disp, vd->co, ss->deform_cos[index]);
 	mul_m3_v3(ss->deform_imats[index], disp);
@@ -2413,33 +2415,33 @@ static void sculpt_flush_pbvhvert_deform(Object *ob, PBVHVertexIter *vd)
 	copy_v3_v3(ss->deform_cos[index], vd->co);
 	copy_v3_v3(ss->orig_cos[index], newco);
 
-	if(!ss->kb)
+	if (!ss->kb)
 		copy_v3_v3(me->mvert[index].co, newco);
 }
 
 static void sculpt_combine_proxies(Sculpt *sd, Object *ob)
 {
 	SculptSession *ss = ob->sculpt;
-	Brush *brush= paint_brush(&sd->paint);
-	PBVHNode** nodes;
+	Brush *brush = paint_brush(&sd->paint);
+	PBVHNode **nodes;
 	int totnode, n;
 
 	BLI_pbvh_gather_proxies(ss->pbvh, &nodes, &totnode);
 
-	if(!ELEM(brush->sculpt_tool, SCULPT_TOOL_SMOOTH, SCULPT_TOOL_LAYER)) {
+	if (!ELEM(brush->sculpt_tool, SCULPT_TOOL_SMOOTH, SCULPT_TOOL_LAYER)) {
 		/* these brushes start from original coordinates */
 		const int use_orco = (ELEM3(brush->sculpt_tool, SCULPT_TOOL_GRAB,
 		                            SCULPT_TOOL_ROTATE, SCULPT_TOOL_THUMB));
 
 		#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
-		for (n= 0; n < totnode; n++) {
+		for (n = 0; n < totnode; n++) {
 			PBVHVertexIter vd;
-			PBVHProxyNode* proxies;
+			PBVHProxyNode *proxies;
 			int proxy_count;
 			float (*orco)[3];
 
-			if(use_orco)
-				orco= sculpt_undo_push_node(ob, nodes[n])->co;
+			if (use_orco)
+				orco = sculpt_undo_push_node(ob, nodes[n], SCULPT_UNDO_COORDS)->co;
 
 			BLI_pbvh_node_get_proxies(nodes[n], &proxies, &proxy_count);
 
@@ -2447,17 +2449,17 @@ static void sculpt_combine_proxies(Sculpt *sd, Object *ob)
 				float val[3];
 				int p;
 
-				if(use_orco)
+				if (use_orco)
 					copy_v3_v3(val, orco[vd.i]);
 				else
 					copy_v3_v3(val, vd.co);
 
-				for (p= 0; p < proxy_count; p++)
+				for (p = 0; p < proxy_count; p++)
 					add_v3_v3(val, proxies[p].co[vd.i]);
 
 				sculpt_clip(sd, ss, vd.co, val);
 
-				if(ss->modifiers_active)
+				if (ss->modifiers_active)
 					sculpt_flush_pbvhvert_deform(ob, &vd);
 			}
 			BLI_pbvh_vertex_iter_end;
@@ -2477,14 +2479,14 @@ static void sculpt_update_keyblock(Object *ob)
 	float (*vertCos)[3];
 
 	/* Keyblock update happens after hadning deformation caused by modifiers,
-	   so ss->orig_cos would be updated with new stroke */
-	if(ss->orig_cos) vertCos = ss->orig_cos;
+	 * so ss->orig_cos would be updated with new stroke */
+	if (ss->orig_cos) vertCos = ss->orig_cos;
 	else vertCos = BLI_pbvh_get_vertCos(ss->pbvh);
 
 	if (vertCos) {
 		sculpt_vertcos_to_key(ob, ss->kb, vertCos);
 
-		if(vertCos != ss->orig_cos)
+		if (vertCos != ss->orig_cos)
 			MEM_freeN(vertCos);
 	}
 }
@@ -2493,38 +2495,38 @@ static void sculpt_update_keyblock(Object *ob)
 static void sculpt_flush_stroke_deform(Sculpt *sd, Object *ob)
 {
 	SculptSession *ss = ob->sculpt;
-	Brush *brush= paint_brush(&sd->paint);
+	Brush *brush = paint_brush(&sd->paint);
 
-	if(ELEM(brush->sculpt_tool, SCULPT_TOOL_SMOOTH, SCULPT_TOOL_LAYER)) {
+	if (ELEM(brush->sculpt_tool, SCULPT_TOOL_SMOOTH, SCULPT_TOOL_LAYER)) {
 		/* this brushes aren't using proxies, so sculpt_combine_proxies() wouldn't
-		   propagate needed deformation to original base */
+		 * propagate needed deformation to original base */
 
 		int n, totnode;
-		Mesh *me= (Mesh*)ob->data;
-		PBVHNode** nodes;
-		float (*vertCos)[3]= NULL;
+		Mesh *me = (Mesh *)ob->data;
+		PBVHNode **nodes;
+		float (*vertCos)[3] = NULL;
 
-		if(ss->kb)
-			vertCos= MEM_callocN(sizeof(*vertCos)*me->totvert, "flushStrokeDeofrm keyVerts");
+		if (ss->kb)
+			vertCos = MEM_callocN(sizeof(*vertCos) * me->totvert, "flushStrokeDeofrm keyVerts");
 
 		BLI_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
 
 		#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
-		for (n= 0; n < totnode; n++) {
+		for (n = 0; n < totnode; n++) {
 			PBVHVertexIter vd;
 
 			BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
 				sculpt_flush_pbvhvert_deform(ob, &vd);
 
-				if(vertCos) {
-					int index= vd.vert_indices[vd.i];
+				if (vertCos) {
+					int index = vd.vert_indices[vd.i];
 					copy_v3_v3(vertCos[index], ss->orig_cos[index]);
 				}
 			}
 			BLI_pbvh_vertex_iter_end;
 		}
 
-		if(vertCos) {
+		if (vertCos) {
 			sculpt_vertcos_to_key(ob, ss->kb, vertCos);
 			MEM_freeN(vertCos);
 		}
@@ -2532,35 +2534,20 @@ static void sculpt_flush_stroke_deform(Sculpt *sd, Object *ob)
 		MEM_freeN(nodes);
 
 		/* Modifiers could depend on mesh normals, so we should update them/
-		   Note, then if sculpting happens on locked key, normals should be re-calculated
-		   after applying coords from keyblock on base mesh */
-		mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
-	} else if (ss->kb)
+		 * Note, then if sculpting happens on locked key, normals should be re-calculated
+		 * after applying coords from keyblock on base mesh */
+		mesh_calc_normals(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL);
+	}
+	else if (ss->kb) {
 		sculpt_update_keyblock(ob);
+	}
 }
 
-//static int max_overlap_count(Sculpt *sd)
-//{
-//	int count[3];
-//	int i, j;
-//
-//	for (i= 0; i < 3; i++) {
-//		count[i] = sd->radial_symm[i];
-//
-//		for (j= 0; j < 3; j++) {
-//			if (i != j && sd->flags & (SCULPT_SYMM_X<<i))
-//				count[i] *= 2;
-//		}
-//	}
-//
-//	return MAX3(count[0], count[1], count[2]);
-//}
-
 /* Flip all the editdata across the axis/axes specified by symm. Used to
-   calculate multiple modifications to the mesh when symmetry is enabled. */
+ * calculate multiple modifications to the mesh when symmetry is enabled. */
 static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm,
-								const char axis, const float angle,
-								const float UNUSED(feather))
+                                const char axis, const float angle,
+                                const float UNUSED(feather))
 {
 	(void)sd; /* unused */
 
@@ -2568,22 +2555,24 @@ static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm,
 	flip_coord(cache->grab_delta_symmetry, cache->grab_delta, symm);
 	flip_coord(cache->view_normal, cache->true_view_normal, symm);
 
-	// XXX This reduces the length of the grab delta if it approaches the line of symmetry
-	// XXX However, a different approach appears to be needed
-	//if (sd->flags & SCULPT_SYMMETRY_FEATHER) {
-	//	float frac = 1.0f/max_overlap_count(sd);
-	//	float reduce = (feather-frac)/(1-frac);
+	/* XXX This reduces the length of the grab delta if it approaches the line of symmetry
+	 * XXX However, a different approach appears to be needed */
+#if 0
+	if (sd->flags & SCULPT_SYMMETRY_FEATHER) {
+		float frac = 1.0f/max_overlap_count(sd);
+		float reduce = (feather-frac)/(1-frac);
 
-	//	printf("feather: %f frac: %f reduce: %f\n", feather, frac, reduce);
+		printf("feather: %f frac: %f reduce: %f\n", feather, frac, reduce);
 
-	//	if (frac < 1)
-	//		mul_v3_fl(cache->grab_delta_symmetry, reduce);
-	//}
+		if (frac < 1)
+			mul_v3_fl(cache->grab_delta_symmetry, reduce);
+	}
+#endif
 
 	unit_m4(cache->symm_rot_mat);
 	unit_m4(cache->symm_rot_mat_inv);
 
-	if(axis) { /* expects XYZ */
+	if (axis) { /* expects XYZ */
 		rotate_m4(cache->symm_rot_mat, axis, angle);
 		rotate_m4(cache->symm_rot_mat_inv, axis, -angle);
 	}
@@ -2593,30 +2582,30 @@ static void calc_brushdata_symm(Sculpt *sd, StrokeCache *cache, const char symm,
 }
 
 static void do_radial_symmetry(Sculpt *sd, Object *ob, Brush *brush,
-							   const char symm, const int axis,
-							   const float feather)
+                               const char symm, const int axis,
+                               const float feather)
 {
 	SculptSession *ss = ob->sculpt;
 	int i;
 
-	for(i = 1; i < sd->radial_symm[axis-'X']; ++i) {
-		const float angle = 2*M_PI*i/sd->radial_symm[axis-'X'];
-		ss->cache->radial_symmetry_pass= i;
+	for (i = 1; i < sd->radial_symm[axis - 'X']; ++i) {
+		const float angle = 2 * M_PI * i / sd->radial_symm[axis - 'X'];
+		ss->cache->radial_symmetry_pass = i;
 		calc_brushdata_symm(sd, ss->cache, symm, axis, angle, feather);
 		do_brush_action(sd, ob, brush);
 	}
 }
 
 /* noise texture gives different values for the same input coord; this
-   can tear a multires mesh during sculpting so do a stitch in this
-   case */
+ * can tear a multires mesh during sculpting so do a stitch in this
+ * case */
 static void sculpt_fix_noise_tear(Sculpt *sd, Object *ob)
 {
 	SculptSession *ss = ob->sculpt;
 	Brush *brush = paint_brush(&sd->paint);
 	MTex *mtex = &brush->mtex;
 
-	if(ss->multires && mtex->tex && mtex->tex->type == TEX_NOISE)
+	if (ss->multires && mtex->tex && mtex->tex->type == TEX_NOISE)
 		multires_stitch_grids(ob);
 }
 
@@ -2630,15 +2619,15 @@ static void do_symmetrical_brush_actions(Sculpt *sd, Object *ob)
 
 	float feather = calc_symmetry_feather(sd, ss->cache);
 
-	cache->bstrength= brush_strength(sd, cache, feather);
+	cache->bstrength = brush_strength(sd, cache, feather);
 
-	cache->symmetry= symm;
+	cache->symmetry = symm;
 
 	/* symm is a bit combination of XYZ - 1 is mirror X; 2 is Y; 3 is XY; 4 is Z; 5 is XZ; 6 is YZ; 7 is XYZ */ 
-	for(i = 0; i <= symm; ++i) {
-		if(i == 0 || (symm & i && (symm != 5 || i != 3) && (symm != 6 || (i != 3 && i != 5)))) {
-			cache->mirror_symmetry_pass= i;
-			cache->radial_symmetry_pass= 0;
+	for (i = 0; i <= symm; ++i) {
+		if (i == 0 || (symm & i && (symm != 5 || i != 3) && (symm != 6 || (i != 3 && i != 5)))) {
+			cache->mirror_symmetry_pass = i;
+			cache->radial_symmetry_pass = 0;
 
 			calc_brushdata_symm(sd, cache, i, 0, 0, feather);
 			do_brush_action(sd, ob, brush);
@@ -2657,79 +2646,85 @@ static void do_symmetrical_brush_actions(Sculpt *sd, Object *ob)
 	if (ss->modifiers_active)
 		sculpt_flush_stroke_deform(sd, ob);
 
-	cache->first_time= 0;
+	cache->first_time = 0;
 }
 
 static void sculpt_update_tex(const Scene *scene, Sculpt *sd, SculptSession *ss)
 {
 	Brush *brush = paint_brush(&sd->paint);
-	const int radius= brush_size(scene, brush);
+	const int radius = brush_size(scene, brush);
 
-	if(ss->texcache) {
+	if (ss->texcache) {
 		MEM_freeN(ss->texcache);
-		ss->texcache= NULL;
+		ss->texcache = NULL;
 	}
 
 	/* Need to allocate a bigger buffer for bigger brush size */
-	ss->texcache_side = 2*radius;
-	if(!ss->texcache || ss->texcache_side > ss->texcache_actual) {
+	ss->texcache_side = 2 * radius;
+	if (!ss->texcache || ss->texcache_side > ss->texcache_actual) {
 		ss->texcache = brush_gen_texture_cache(brush, radius);
 		ss->texcache_actual = ss->texcache_side;
 	}
 }
 
-void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, int need_fmap)
+void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, int need_pmap)
 {
 	DerivedMesh *dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
 	SculptSession *ss = ob->sculpt;
-	MultiresModifierData *mmd= sculpt_multires_active(scene, ob);
+	MultiresModifierData *mmd = sculpt_multires_active(scene, ob);
 
-	ss->modifiers_active= sculpt_modifiers_active(scene, sd, ob);
+	ss->modifiers_active = sculpt_modifiers_active(scene, sd, ob);
 
-	if(!mmd) ss->kb= ob_get_keyblock(ob);
-	else ss->kb= NULL;
+	if (!mmd) ss->kb = ob_get_keyblock(ob);
+	else ss->kb = NULL;
 
-	if(mmd) {
+	if (mmd) {
 		ss->multires = mmd;
 		ss->totvert = dm->getNumVerts(dm);
-		ss->totface = dm->getNumFaces(dm);
-		ss->mvert= NULL;
-		ss->mface= NULL;
-		ss->face_normals= NULL;
+		ss->totpoly = dm->getNumPolys(dm);
+		ss->mvert = NULL;
+		ss->mpoly = NULL;
+		ss->mloop = NULL;
+		ss->face_normals = NULL;
 	}
 	else {
 		Mesh *me = get_mesh(ob);
 		ss->totvert = me->totvert;
-		ss->totface = me->totface;
+		ss->totpoly = me->totpoly;
 		ss->mvert = me->mvert;
-		ss->mface = me->mface;
+		ss->mpoly = me->mpoly;
+		ss->mloop = me->mloop;
 		ss->face_normals = NULL;
 		ss->multires = NULL;
 	}
 
+	/* BMESH ONLY --- at some point we should move sculpt code to use polygons only - but for now it needs tessfaces */
+	BKE_mesh_tessface_ensure(ob->data);
+
 	ss->pbvh = dm->getPBVH(ob, dm);
-	ss->fmap = (need_fmap && dm->getFaceMap)? dm->getFaceMap(ob, dm): NULL;
+	ss->pmap = (need_pmap && dm->getPolyMap) ? dm->getPolyMap(ob, dm) : NULL;
 
-	if(ss->modifiers_active) {
-		if(!ss->orig_cos) {
+	if (ss->modifiers_active) {
+		if (!ss->orig_cos) {
 			int a;
 
 			free_sculptsession_deformMats(ss);
 
-			if(ss->kb) ss->orig_cos = key_to_vertcos(ob, ss->kb);
+			if (ss->kb) ss->orig_cos = key_to_vertcos(ob, ss->kb);
 			else ss->orig_cos = mesh_getVertexCos(ob->data, NULL);
 
 			crazyspace_build_sculpt(scene, ob, &ss->deform_imats, &ss->deform_cos);
 			BLI_pbvh_apply_vertCos(ss->pbvh, ss->deform_cos);
 
-			for(a = 0; a < ((Mesh*)ob->data)->totvert; ++a)
+			for (a = 0; a < ((Mesh *)ob->data)->totvert; ++a)
 				invert_m3(ss->deform_imats[a]);
 		}
-	} else free_sculptsession_deformMats(ss);
+	}
+	else free_sculptsession_deformMats(ss);
 
 	/* if pbvh is deformed, key block is already applied to it */
 	if (ss->kb && !BLI_pbvh_isDeformed(ss->pbvh)) {
-		float (*vertCos)[3]= key_to_vertcos(ob, ss->kb);
+		float (*vertCos)[3] = key_to_vertcos(ob, ss->kb);
 
 		if (vertCos) {
 			/* apply shape keys coordinates to PBVH */
@@ -2739,7 +2734,7 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, int need_
 	}
 }
 
-static int sculpt_mode_poll(bContext *C)
+int sculpt_mode_poll(bContext *C)
 {
 	Object *ob = CTX_data_active_object(C);
 	return ob && ob->mode & OB_MODE_SCULPT;
@@ -2754,48 +2749,49 @@ static const char *sculpt_tool_name(Sculpt *sd)
 {
 	Brush *brush = paint_brush(&sd->paint);
 
-	switch(brush->sculpt_tool) {
-	case SCULPT_TOOL_DRAW:
-		return "Draw Brush"; break;
-	case SCULPT_TOOL_SMOOTH:
-		return "Smooth Brush"; break;
-	case SCULPT_TOOL_CREASE:
-		return "Crease Brush"; break;
-	case SCULPT_TOOL_BLOB:
-		return "Blob Brush"; break;
-	case SCULPT_TOOL_PINCH:
-		return "Pinch Brush"; break;
-	case SCULPT_TOOL_INFLATE:
-		return "Inflate Brush"; break;
-	case SCULPT_TOOL_GRAB:
-		return "Grab Brush"; break;
-	case SCULPT_TOOL_NUDGE:
-		return "Nudge Brush"; break;
-	case SCULPT_TOOL_THUMB:
-		return "Thumb Brush"; break;
-	case SCULPT_TOOL_LAYER:
-		return "Layer Brush"; break;
-	case SCULPT_TOOL_FLATTEN:
-		return "Flatten Brush"; break;
-	case SCULPT_TOOL_CLAY:
-		return "Clay Brush"; break;
-	case SCULPT_TOOL_CLAY_TUBES:
-		return "Clay Tubes Brush"; break;
-	case SCULPT_TOOL_FILL:
-		return "Fill Brush"; break;
-	case SCULPT_TOOL_SCRAPE:
-		return "Scrape Brush"; break;
-	default:
-		return "Sculpting"; break;
-	}
-}
-
-/**** Operator for applying a stroke (various attributes including mouse path)
-	  using the current brush. ****/
+	switch (brush->sculpt_tool) {
+		case SCULPT_TOOL_DRAW:
+			return "Draw Brush"; break;
+		case SCULPT_TOOL_SMOOTH:
+			return "Smooth Brush"; break;
+		case SCULPT_TOOL_CREASE:
+			return "Crease Brush"; break;
+		case SCULPT_TOOL_BLOB:
+			return "Blob Brush"; break;
+		case SCULPT_TOOL_PINCH:
+			return "Pinch Brush"; break;
+		case SCULPT_TOOL_INFLATE:
+			return "Inflate Brush"; break;
+		case SCULPT_TOOL_GRAB:
+			return "Grab Brush"; break;
+		case SCULPT_TOOL_NUDGE:
+			return "Nudge Brush"; break;
+		case SCULPT_TOOL_THUMB:
+			return "Thumb Brush"; break;
+		case SCULPT_TOOL_LAYER:
+			return "Layer Brush"; break;
+		case SCULPT_TOOL_FLATTEN:
+			return "Flatten Brush"; break;
+		case SCULPT_TOOL_CLAY:
+			return "Clay Brush"; break;
+		case SCULPT_TOOL_CLAY_STRIPS:
+			return "Clay Strips Brush"; break;
+		case SCULPT_TOOL_FILL:
+			return "Fill Brush"; break;
+		case SCULPT_TOOL_SCRAPE:
+			return "Scrape Brush"; break;
+		default:
+			return "Sculpting"; break;
+	}
+}
+
+/**
+ * Operator for applying a stroke (various attributes including mouse path)
+ * using the current brush. */
 
 static void sculpt_cache_free(StrokeCache *cache)
 {
-	if(cache->face_norms)
+	if (cache->face_norms)
 		MEM_freeN(cache->face_norms);
 	MEM_freeN(cache);
 }
@@ -2806,23 +2802,23 @@ static void sculpt_init_mirror_clipping(Object *ob, SculptSession *ss)
 	ModifierData *md;
 	int i;
 
-	for(md= ob->modifiers.first; md; md= md->next) {
-		if(md->type==eModifierType_Mirror &&
-		   (md->mode & eModifierMode_Realtime)) {
-			MirrorModifierData *mmd = (MirrorModifierData*)md;
+	for (md = ob->modifiers.first; md; md = md->next) {
+		if (md->type == eModifierType_Mirror &&
+		    (md->mode & eModifierMode_Realtime)) {
+			MirrorModifierData *mmd = (MirrorModifierData *)md;
 			
-			if(mmd->flag & MOD_MIR_CLIPPING) {
+			if (mmd->flag & MOD_MIR_CLIPPING) {
 				/* check each axis for mirroring */
-				for(i = 0; i < 3; ++i) {
-					if(mmd->flag & (MOD_MIR_AXIS_X << i)) {
+				for (i = 0; i < 3; ++i) {
+					if (mmd->flag & (MOD_MIR_AXIS_X << i)) {
 						/* enable sculpt clipping */
 						ss->cache->flag |= CLIP_X << i;
 						
 						/* update the clip tolerance */
-						if(mmd->tolerance >
-						   ss->cache->clip_tolerance[i])
+						if (mmd->tolerance >
+						    ss->cache->clip_tolerance[i])
 							ss->cache->clip_tolerance[i] =
-								mmd->tolerance;
+							    mmd->tolerance;
 					}
 				}
 			}
@@ -2831,12 +2827,12 @@ static void sculpt_init_mirror_clipping(Object *ob, SculptSession *ss)
 }
 
 /* Initialize the stroke cache invariants from operator properties */
-static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSession *ss, wmOperator *op, wmEvent *event)
+static void sculpt_update_cache_invariants(bContext *C, Sculpt *sd, SculptSession *ss, wmOperator *op, wmEvent *event)
 {
 	StrokeCache *cache = MEM_callocN(sizeof(StrokeCache), "stroke cache");
 	Brush *brush = paint_brush(&sd->paint);
 	ViewContext *vc = paint_stroke_view_context(op->customdata);
-	Object *ob= CTX_data_active_object(C);
+	Object *ob = CTX_data_active_object(C);
 	int i;
 	int mode;
 
@@ -2868,19 +2864,19 @@ static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSessio
 	cache->alt_smooth = mode == BRUSH_STROKE_SMOOTH;
 
 	/* not very nice, but with current events system implementation
-	   we can't handle brush appearance inversion hotkey separately (sergey) */
-	if(cache->invert) brush->flag |= BRUSH_INVERTED;
+	 * we can't handle brush appearance inversion hotkey separately (sergey) */
+	if (cache->invert) brush->flag |= BRUSH_INVERTED;
 	else brush->flag &= ~BRUSH_INVERTED;
 
 	/* Alt-Smooth */
 	if (ss->cache->alt_smooth) {
-		Paint *p= &sd->paint;
+		Paint *p = &sd->paint;
 		Brush *br;
 		
-		BLI_strncpy(cache->saved_active_brush_name, brush->id.name+2, sizeof(cache->saved_active_brush_name));
+		BLI_strncpy(cache->saved_active_brush_name, brush->id.name + 2, sizeof(cache->saved_active_brush_name));
 
-		br= (Brush *)find_id("BR", "Smooth");
-		if(br) {
+		br = (Brush *)find_id("BR", "Smooth");
+		if (br) {
 			paint_brush_set(p, br);
 			brush = br;
 		}
@@ -2900,16 +2896,16 @@ static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSessio
 
 	ED_view3d_global_to_vector(cache->vc->rv3d, cache->vc->rv3d->twmat[3], cache->true_view_normal);
 	/* Initialize layer brush displacements and persistent coords */
-	if(brush->sculpt_tool == SCULPT_TOOL_LAYER) {
+	if (brush->sculpt_tool == SCULPT_TOOL_LAYER) {
 		/* not supported yet for multires */
-		if(!ss->multires && !ss->layer_co && (brush->flag & BRUSH_PERSISTENT)) {
-			if(!ss->layer_co)
-				ss->layer_co= MEM_mallocN(sizeof(float) * 3 * ss->totvert,
-									   "sculpt mesh vertices copy");
+		if (!ss->multires && !ss->layer_co && (brush->flag & BRUSH_PERSISTENT)) {
+			if (!ss->layer_co)
+				ss->layer_co = MEM_mallocN(sizeof(float) * 3 * ss->totvert,
+				                           "sculpt mesh vertices copy");
 
-			if(ss->deform_cos) memcpy(ss->layer_co, ss->deform_cos, ss->totvert);
+			if (ss->deform_cos) memcpy(ss->layer_co, ss->deform_cos, ss->totvert);
 			else {
-				for(i = 0; i < ss->totvert; ++i) {
+				for (i = 0; i < ss->totvert; ++i) {
 					copy_v3_v3(ss->layer_co[i], ss->mvert[i].co);
 				}
 			}
@@ -2917,79 +2913,86 @@ static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSessio
 	}
 
 	/* Make copies of the mesh vertex locations and normals for some tools */
-	if(brush->flag & BRUSH_ANCHORED) {
-		if(ss->face_normals) {
+	if (brush->flag & BRUSH_ANCHORED) {
+		if (ss->face_normals) {
 			float *fn = ss->face_normals;
-			cache->face_norms= MEM_mallocN(sizeof(float) * 3 * ss->totface, "Sculpt face norms");
-			for(i = 0; i < ss->totface; ++i, fn += 3)
+			cache->face_norms = MEM_mallocN(sizeof(float) * 3 * ss->totpoly, "Sculpt face norms");
+			for (i = 0; i < ss->totpoly; ++i, fn += 3)
 				copy_v3_v3(cache->face_norms[i], fn);
 		}
 
 		cache->original = 1;
 	}
 
-	if(ELEM8(brush->sculpt_tool,
-			 SCULPT_TOOL_DRAW, SCULPT_TOOL_CREASE, SCULPT_TOOL_BLOB,
-			 SCULPT_TOOL_LAYER, SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY,
-			 SCULPT_TOOL_CLAY_TUBES, SCULPT_TOOL_ROTATE))
-		if(!(brush->flag & BRUSH_ACCUMULATE))
+	if (ELEM8(brush->sculpt_tool,
+	          SCULPT_TOOL_DRAW, SCULPT_TOOL_CREASE, SCULPT_TOOL_BLOB,
+	          SCULPT_TOOL_LAYER, SCULPT_TOOL_INFLATE, SCULPT_TOOL_CLAY,
+	          SCULPT_TOOL_CLAY_STRIPS, SCULPT_TOOL_ROTATE))
+		if (!(brush->flag & BRUSH_ACCUMULATE))
 			cache->original = 1;
 
 	cache->special_rotation = (brush->flag & BRUSH_RAKE) ? sd->last_angle : 0;
-	//cache->last_rake[0] = sd->last_x;
-	//cache->last_rake[1] = sd->last_y;
 
-	cache->first_time= 1;
+	cache->first_time = 1;
 
-	cache->vertex_rotation= 0;
+	cache->vertex_rotation = 0;
 }
 
 static void sculpt_update_brush_delta(Sculpt *sd, Object *ob, Brush *brush)
 {
 	SculptSession *ss = ob->sculpt;
 	StrokeCache *cache = ss->cache;
+	float mouse[2] = {
+		cache->mouse[0] - cache->vc->ar->winrct.xmin,
+		cache->mouse[1] - cache->vc->ar->winrct.ymin
+	};
 	int tool = brush->sculpt_tool;
 
-	if(ELEM5(tool,
-		 SCULPT_TOOL_GRAB, SCULPT_TOOL_NUDGE,
-		 SCULPT_TOOL_CLAY_TUBES, SCULPT_TOOL_SNAKE_HOOK,
-		 SCULPT_TOOL_THUMB)) {
+	if (ELEM5(tool,
+	          SCULPT_TOOL_GRAB, SCULPT_TOOL_NUDGE,
+	          SCULPT_TOOL_CLAY_STRIPS, SCULPT_TOOL_SNAKE_HOOK,
+	          SCULPT_TOOL_THUMB)) {
 		float grab_location[3], imat[4][4], delta[3], loc[3];
 
-		if(cache->first_time) {
+		if (cache->first_time) {
 			copy_v3_v3(cache->orig_grab_location,
 			           cache->true_location);
 		}
-		else if(tool == SCULPT_TOOL_SNAKE_HOOK)
+		else if (tool == SCULPT_TOOL_SNAKE_HOOK)
 			add_v3_v3(cache->true_location, cache->grab_delta);
 
 		/* compute 3d coordinate at same z from original location + mouse */
 		mul_v3_m4v3(loc, ob->obmat, cache->orig_grab_location);
 		initgrabz(cache->vc->rv3d, loc[0], loc[1], loc[2]);
 
-		ED_view3d_win_to_delta(cache->vc->ar, cache->mouse, grab_location);
+		ED_view3d_win_to_3d(cache->vc->ar, loc, mouse, grab_location);
 
 		/* compute delta to move verts by */
-		if(!cache->first_time) {
-			switch(tool) {
-			case SCULPT_TOOL_GRAB:
-			case SCULPT_TOOL_THUMB:
-				sub_v3_v3v3(delta, grab_location, cache->old_grab_location);
-				invert_m4_m4(imat, ob->obmat);
-				mul_mat3_m4_v3(imat, delta);
-				add_v3_v3(cache->grab_delta, delta);
-				break;
-			case SCULPT_TOOL_CLAY_TUBES:
-			case SCULPT_TOOL_NUDGE:
-				sub_v3_v3v3(cache->grab_delta, grab_location, cache->old_grab_location);
-				invert_m4_m4(imat, ob->obmat);
-				mul_mat3_m4_v3(imat, cache->grab_delta);
-				break;
-			case SCULPT_TOOL_SNAKE_HOOK:
-				sub_v3_v3v3(cache->grab_delta, grab_location, cache->old_grab_location);
-				invert_m4_m4(imat, ob->obmat);
-				mul_mat3_m4_v3(imat, cache->grab_delta);
-				break;
+		if (!cache->first_time) {
+			switch (tool) {
+				case SCULPT_TOOL_GRAB:
+				case SCULPT_TOOL_THUMB:
+					sub_v3_v3v3(delta, grab_location, cache->old_grab_location);
+					invert_m4_m4(imat, ob->obmat);
+					mul_mat3_m4_v3(imat, delta);
+					add_v3_v3(cache->grab_delta, delta);
+					break;
+				case SCULPT_TOOL_CLAY_STRIPS:
+				case SCULPT_TOOL_NUDGE:
+				case SCULPT_TOOL_SNAKE_HOOK:
+					if (brush->flag & BRUSH_ANCHORED) {
+						float orig[3];
+						mul_v3_m4v3(orig, ob->obmat, cache->orig_grab_location);
+						sub_v3_v3v3(cache->grab_delta, grab_location, orig);
+					}
+					else {
+						sub_v3_v3v3(cache->grab_delta, grab_location,
+						            cache->old_grab_location);
+					}
+				
+					invert_m4_m4(imat, ob->obmat);
+					mul_mat3_m4_v3(imat, cache->grab_delta);
+					break;
 			}
 		}
 		else {
@@ -2998,12 +3001,12 @@ static void sculpt_update_brush_delta(Sculpt *sd, Object *ob, Brush *brush)
 
 		copy_v3_v3(cache->old_grab_location, grab_location);
 
-		if(tool == SCULPT_TOOL_GRAB)
+		if (tool == SCULPT_TOOL_GRAB)
 			copy_v3_v3(sd->anchored_location, cache->true_location);
-		else if(tool == SCULPT_TOOL_THUMB)
+		else if (tool == SCULPT_TOOL_THUMB)
 			copy_v3_v3(sd->anchored_location, cache->orig_grab_location);			
 
-		if(ELEM(tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_THUMB)) {
+		if (ELEM(tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_THUMB)) {
 			/* location stays the same for finding vertices in brush radius */
 			copy_v3_v3(cache->true_location, cache->orig_grab_location);
 
@@ -3016,8 +3019,8 @@ static void sculpt_update_brush_delta(Sculpt *sd, Object *ob, Brush *brush)
 
 /* Initialize the stroke cache variants from operator properties */
 static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
-										 struct PaintStroke *stroke,
-										 PointerRNA *ptr)
+                                         struct PaintStroke *stroke,
+                                         PointerRNA *ptr)
 {
 	Scene *scene = CTX_data_scene(C);
 	SculptSession *ss = ob->sculpt;
@@ -3026,13 +3029,13 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
 
 	int dx, dy;
 
-	//RNA_float_get_array(ptr, "location", cache->traced_location);
+	/* RNA_float_get_array(ptr, "location", cache->traced_location); */
 
 	if (cache->first_time ||
-	    !((brush->flag & BRUSH_ANCHORED)||
-	      (brush->sculpt_tool == SCULPT_TOOL_SNAKE_HOOK)||
+	    !((brush->flag & BRUSH_ANCHORED) ||
+	      (brush->sculpt_tool == SCULPT_TOOL_SNAKE_HOOK) ||
 	      (brush->sculpt_tool == SCULPT_TOOL_ROTATE))
-		 )
+	    )
 	{
 		RNA_float_get_array(ptr, "location", cache->true_location);
 	}
@@ -3040,61 +3043,62 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
 	cache->pen_flip = RNA_boolean_get(ptr, "pen_flip");
 	RNA_float_get_array(ptr, "mouse", cache->mouse);
 
-	/* XXX: Use preassure value from first brush step for brushes which don't
-	        support strokes (grab, thumb). They depends on initial state and
-	        brush coord/pressure/etc.
-	        It's more an events design issue, which doesn't split coordinate/pressure/angle
-	        changing events. We should avoid this after events system re-design */
-	if(paint_space_stroke_enabled(brush) || cache->first_time)
+	/* XXX: Use pressure value from first brush step for brushes which don't
+	 *      support strokes (grab, thumb). They depends on initial state and
+	 *      brush coord/pressure/etc.
+	 *      It's more an events design issue, which doesn't split coordinate/pressure/angle
+	 *      changing events. We should avoid this after events system re-design */
+	if (paint_space_stroke_enabled(brush) || cache->first_time)
 		cache->pressure = RNA_float_get(ptr, "pressure");
 
 	/* Truly temporary data that isn't stored in properties */
 
-	sd->draw_pressure=  1;
-	sd->pressure_value= cache->pressure;
+	sd->draw_pressure =  1;
+	sd->pressure_value = cache->pressure;
 
 	cache->previous_pixel_radius = cache->pixel_radius;
 	cache->pixel_radius = brush_size(scene, brush);
 
-	if(cache->first_time) {
+	if (cache->first_time) {
 		if (!brush_use_locked_size(scene, brush)) {
-			cache->initial_radius= paint_calc_object_space_radius(cache->vc, cache->true_location, brush_size(scene, brush));
+			cache->initial_radius = paint_calc_object_space_radius(cache->vc, cache->true_location, brush_size(scene, brush));
 			brush_set_unprojected_radius(scene, brush, cache->initial_radius);
 		}
 		else {
-			cache->initial_radius= brush_unprojected_radius(scene, brush);
+			cache->initial_radius = brush_unprojected_radius(scene, brush);
 		}
 	}
 
-	if(brush_use_size_pressure(scene, brush)) {
+	if (brush_use_size_pressure(scene, brush)) {
 		cache->pixel_radius *= cache->pressure;
-		cache->radius= cache->initial_radius * cache->pressure;
+		cache->radius = cache->initial_radius * cache->pressure;
 	}
 	else
-		cache->radius= cache->initial_radius;
+		cache->radius = cache->initial_radius;
 
-	cache->radius_squared = cache->radius*cache->radius;
+	cache->radius_squared = cache->radius * cache->radius;
 
-	if(!(brush->flag & BRUSH_ANCHORED ||
-		 ELEM4(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK,
-			   SCULPT_TOOL_THUMB, SCULPT_TOOL_ROTATE))) {
+	if (!(brush->flag & BRUSH_ANCHORED ||
+	      ELEM4(brush->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK,
+	            SCULPT_TOOL_THUMB, SCULPT_TOOL_ROTATE)))
+	{
 		copy_v2_v2(cache->tex_mouse, cache->mouse);
 
-		if  ( (brush->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) &&
-			  (brush->flag & BRUSH_RANDOM_ROTATION) &&
-			 !(brush->flag & BRUSH_RAKE))
+		if ((brush->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) &&
+		    (brush->flag & BRUSH_RANDOM_ROTATION) &&
+		    !(brush->flag & BRUSH_RAKE))
 		{
-			cache->special_rotation = 2.0f*(float)M_PI*BLI_frand();
+			cache->special_rotation = 2.0f * (float)M_PI * BLI_frand();
 		}
 	}
 
-	if(brush->flag & BRUSH_ANCHORED) {
+	if (brush->flag & BRUSH_ANCHORED) {
 		int hit = 0;
 
 		dx = cache->mouse[0] - cache->initial_mouse[0];
 		dy = cache->mouse[1] - cache->initial_mouse[1];
 
-		sd->anchored_size = cache->pixel_radius = sqrt(dx*dx + dy*dy);
+		sd->anchored_size = cache->pixel_radius = sqrt(dx * dx + dy * dy);
 
 		cache->special_rotation = atan2(dx, dy) + M_PI;
 
@@ -3119,16 +3123,16 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
 		if (!hit)
 			copy_v2_v2(sd->anchored_initial_mouse, cache->initial_mouse);
 
-		cache->radius= paint_calc_object_space_radius(paint_stroke_view_context(stroke),
-													  cache->true_location,
-													  cache->pixel_radius);
-		cache->radius_squared = cache->radius*cache->radius;
+		cache->radius = paint_calc_object_space_radius(paint_stroke_view_context(stroke),
+		                                               cache->true_location,
+		                                               cache->pixel_radius);
+		cache->radius_squared = cache->radius * cache->radius;
 
 		copy_v3_v3(sd->anchored_location, cache->true_location);
 
 		sd->draw_anchored = 1;
 	}
-	else if(brush->flag & BRUSH_RAKE) {
+	else if (brush->flag & BRUSH_RAKE) {
 		const float u = 0.5f;
 		const float v = 1 - u;
 		const float r = 20;
@@ -3139,17 +3143,17 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
 		if (cache->first_time) {
 			copy_v2_v2(cache->last_rake, cache->mouse);
 		}
-		else if (dx*dx + dy*dy >= r*r) {
+		else if (dx * dx + dy * dy >= r * r) {
 			cache->special_rotation = atan2(dx, dy);
 
-			cache->last_rake[0] = u*cache->last_rake[0] + v*cache->mouse[0];
-			cache->last_rake[1] = u*cache->last_rake[1] + v*cache->mouse[1];
+			cache->last_rake[0] = u * cache->last_rake[0] + v * cache->mouse[0];
+			cache->last_rake[1] = u * cache->last_rake[1] + v * cache->mouse[1];
 		}
 	}
 
 	sculpt_update_brush_delta(sd, ob, brush);
 
-	if(brush->sculpt_tool == SCULPT_TOOL_ROTATE) {
+	if (brush->sculpt_tool == SCULPT_TOOL_ROTATE) {
 		dx = cache->mouse[0] - cache->initial_mouse[0];
 		dy = cache->mouse[1] - cache->initial_mouse[1];
 
@@ -3168,7 +3172,7 @@ static void sculpt_stroke_modifiers_check(bContext *C, Object *ob)
 {
 	SculptSession *ss = ob->sculpt;
 
-	if(ss->modifiers_active) {
+	if (ss->modifiers_active) {
 		Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
 		Brush *brush = paint_brush(&sd->paint);
 
@@ -3184,16 +3188,16 @@ typedef struct {
 	int original;
 } SculptRaycastData;
 
-static void sculpt_raycast_cb(PBVHNode *node, void *data_v, float* tmin)
+static void sculpt_raycast_cb(PBVHNode *node, void *data_v, float *tmin)
 {
 	if (BLI_pbvh_node_get_tmin(node) < *tmin) {
 		SculptRaycastData *srd = data_v;
-		float (*origco)[3]= NULL;
+		float (*origco)[3] = NULL;
 
-		if(srd->original && srd->ss->cache) {
+		if (srd->original && srd->ss->cache) {
 			/* intersect with coordinates from before we started stroke */
-			SculptUndoNode *unode= sculpt_undo_get_node(node);
-			origco= (unode)? unode->co: NULL;
+			SculptUndoNode *unode = sculpt_undo_get_node(node);
+			origco = (unode) ? unode->co : NULL;
 		}
 
 		if (BLI_pbvh_node_raycast(srd->ss->pbvh, node, origco, srd->ray_start, srd->ray_normal, &srd->dist)) {
@@ -3204,8 +3208,8 @@ static void sculpt_raycast_cb(PBVHNode *node, void *data_v, float* tmin)
 }
 
 /* Do a raycast in the tree to find the 3d brush location
-   (This allows us to ignore the GL depth buffer)
-   Returns 0 if the ray doesn't hit the mesh, non-zero otherwise
+ * (This allows us to ignore the GL depth buffer)
+ * Returns 0 if the ray doesn't hit the mesh, non-zero otherwise
  */
 int sculpt_stroke_get_location(bContext *C, float out[3], float mouse[2])
 {
@@ -3236,14 +3240,14 @@ int sculpt_stroke_get_location(bContext *C, float out[3], float mouse[2])
 	mul_m4_v3(obimat, ray_end);
 
 	sub_v3_v3v3(ray_normal, ray_end, ray_start);
-	dist= normalize_v3(ray_normal);
+	dist = normalize_v3(ray_normal);
 
 	srd.ss = vc.obact->sculpt;
 	srd.ray_start = ray_start;
 	srd.ray_normal = ray_normal;
 	srd.dist = dist;
 	srd.hit = 0;
-	srd.original = (cache)? cache->original: 0;
+	srd.original = (cache) ? cache->original : 0;
 	BLI_pbvh_raycast(ss->pbvh, sculpt_raycast_cb, &srd,
 	                 ray_start, ray_normal, srd.original);
 	
@@ -3257,33 +3261,33 @@ int sculpt_stroke_get_location(bContext *C, float out[3], float mouse[2])
 static void sculpt_brush_init_tex(const Scene *scene, Sculpt *sd, SculptSession *ss)
 {
 	Brush *brush = paint_brush(&sd->paint);
-	MTex *mtex= &brush->mtex;
+	MTex *mtex = &brush->mtex;
 
 	/* init mtex nodes */
-	if(mtex->tex && mtex->tex->nodetree)
-		ntreeTexBeginExecTree(mtex->tex->nodetree, 1); /* has internal flag to detect it only does it once */
+	if (mtex->tex && mtex->tex->nodetree)
+		ntreeTexBeginExecTree(mtex->tex->nodetree, 1);  /* has internal flag to detect it only does it once */
 
 	/* TODO: Shouldn't really have to do this at the start of every
-	   stroke, but sculpt would need some sort of notification when
-	   changes are made to the texture. */
+	 * stroke, but sculpt would need some sort of notification when
+	 * changes are made to the texture. */
 	sculpt_update_tex(scene, sd, ss);
 }
 
 static int sculpt_brush_stroke_init(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Object *ob= CTX_data_active_object(C);
+	Scene *scene = CTX_data_scene(C);
+	Object *ob = CTX_data_active_object(C);
 	Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
 	SculptSession *ss = CTX_data_active_object(C)->sculpt;
 	Brush *brush = paint_brush(&sd->paint);
-	int mode= RNA_enum_get(op->ptr, "mode");
-	int is_smooth= 0;
+	int mode = RNA_enum_get(op->ptr, "mode");
+	int is_smooth = 0;
 
 	view3d_operator_needs_opengl(C);
 	sculpt_brush_init_tex(scene, sd, ss);
 
-	is_smooth|= mode == BRUSH_STROKE_SMOOTH;
-	is_smooth|= brush->sculpt_tool == SCULPT_TOOL_SMOOTH;
+	is_smooth |= mode == BRUSH_STROKE_SMOOTH;
+	is_smooth |= brush->sculpt_tool == SCULPT_TOOL_SMOOTH;
 
 	sculpt_update_mesh_elements(scene, sd, ob, is_smooth);
 
@@ -3295,10 +3299,10 @@ static void sculpt_restore_mesh(Sculpt *sd, SculptSession *ss)
 	Brush *brush = paint_brush(&sd->paint);
 
 	/* Restore the mesh before continuing with anchored stroke */
-	if((brush->flag & BRUSH_ANCHORED) ||
-	   (brush->sculpt_tool == SCULPT_TOOL_GRAB &&
-		brush_use_size_pressure(ss->cache->vc->scene, brush)) ||
-	   (brush->flag & BRUSH_RESTORE_MESH))
+	if ((brush->flag & BRUSH_ANCHORED) ||
+	    (brush->sculpt_tool == SCULPT_TOOL_GRAB &&
+	     brush_use_size_pressure(ss->cache->vc->scene, brush)) ||
+	    (brush->flag & BRUSH_RESTORE_MESH))
 	{
 		StrokeCache *cache = ss->cache;
 		int i;
@@ -3309,19 +3313,19 @@ static void sculpt_restore_mesh(Sculpt *sd, SculptSession *ss)
 		BLI_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
 
 		#pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
-		for(n=0; n<totnode; n++) {
+		for (n = 0; n < totnode; n++) {
 			SculptUndoNode *unode;
 			
-			unode= sculpt_undo_get_node(nodes[n]);
-			if(unode) {
+			unode = sculpt_undo_get_node(nodes[n]);
+			if (unode) {
 				PBVHVertexIter vd;
 
 				BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
 					copy_v3_v3(vd.co, unode->co[vd.i]);
-					if(vd.no) copy_v3_v3_short(vd.no, unode->no[vd.i]);
+					if (vd.no) copy_v3_v3_short(vd.no, unode->no[vd.i]);
 					else normal_short_to_float_v3(vd.fno, unode->no[vd.i]);
 
-					if(vd.mvert) vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+					if (vd.mvert) vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
 				}
 				BLI_pbvh_vertex_iter_end;
 
@@ -3329,13 +3333,13 @@ static void sculpt_restore_mesh(Sculpt *sd, SculptSession *ss)
 			}
 		}
 
-		if(ss->face_normals) {
+		if (ss->face_normals) {
 			float *fn = ss->face_normals;
-			for(i = 0; i < ss->totface; ++i, fn += 3)
+			for (i = 0; i < ss->totpoly; ++i, fn += 3)
 				copy_v3_v3(fn, cache->face_norms[i]);
 		}
 
-		if(nodes)
+		if (nodes)
 			MEM_freeN(nodes);
 	}
 }
@@ -3347,12 +3351,12 @@ static void sculpt_flush_update(bContext *C)
 	ARegion *ar = CTX_wm_region(C);
 	MultiresModifierData *mmd = ss->multires;
 
-	if(mmd)
-		multires_mark_as_modified(ob);
-	if(ob->derivedFinal) /* VBO no longer valid */
+	if (mmd)
+		multires_mark_as_modified(ob, MULTIRES_COORDS_MODIFIED);
+	if (ob->derivedFinal) /* VBO no longer valid */
 		GPU_drawobject_free(ob->derivedFinal);
 
-	if(ss->modifiers_active) {
+	if (ss->modifiers_active) {
 		DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 		ED_region_tag_redraw(ar);
 	}
@@ -3362,7 +3366,7 @@ static void sculpt_flush_update(bContext *C)
 		BLI_pbvh_update(ss->pbvh, PBVH_UpdateBB, NULL);
 		if (sculpt_get_redraw_rect(ar, CTX_wm_region_view3d(C), ob, &r)) {
 			if (ss->cache)
-				ss->cache->previous_r= r;
+				ss->cache->previous_r = r;
 
 			r.xmin += ar->winrct.xmin + 1;
 			r.xmax += ar->winrct.xmin - 1;
@@ -3376,7 +3380,7 @@ static void sculpt_flush_update(bContext *C)
 }
 
 /* Returns whether the mouse/stylus is over the mesh (1)
-   or over the background (0) */
+ * or over the background (0) */
 static int over_mesh(bContext *C, struct wmOperator *UNUSED(op), float x, float y)
 {
 	float mouse[2], co[3];
@@ -3388,11 +3392,11 @@ static int over_mesh(bContext *C, struct wmOperator *UNUSED(op), float x, float
 }
 
 static int sculpt_stroke_test_start(bContext *C, struct wmOperator *op,
-					wmEvent *event)
+                                    wmEvent *event)
 {
 	/* Don't start the stroke until mouse goes over the mesh.
 	 * note: event will only be null when re-executing the saved stroke. */
-	if(event==NULL || over_mesh(C, op, event->x, event->y)) {
+	if (event == NULL || over_mesh(C, op, event->x, event->y)) {
 		Object *ob = CTX_data_active_object(C);
 		SculptSession *ss = ob->sculpt;
 		Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
@@ -3405,14 +3409,14 @@ static int sculpt_stroke_test_start(bContext *C, struct wmOperator *op,
 
 #ifdef _OPENMP
 		/* If using OpenMP then create a number of threads two times the
-		   number of processor cores.
-		   Justification: Empirically I've found that two threads per
-		   processor gives higher throughput. */
+		 * number of processor cores.
+		 * Justification: Empirically I've found that two threads per
+		 * processor gives higher throughput. */
 		if (sd->flags & SCULPT_USE_OPENMP) {
 			int num_procs;
 
 			num_procs = omp_get_num_procs();
-			omp_set_num_threads(2*num_procs);
+			omp_set_num_threads(2 * num_procs);
 		}
 #endif
 
@@ -3439,36 +3443,36 @@ static void sculpt_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
 
 static void sculpt_brush_exit_tex(Sculpt *sd)
 {
-	Brush *brush= paint_brush(&sd->paint);
-	MTex *mtex= &brush->mtex;
+	Brush *brush = paint_brush(&sd->paint);
+	MTex *mtex = &brush->mtex;
 
-	if(mtex->tex && mtex->tex->nodetree)
+	if (mtex->tex && mtex->tex->nodetree)
 		ntreeTexEndExecTree(mtex->tex->nodetree->execdata, 1);
 }
 
 static void sculpt_stroke_done(bContext *C, struct PaintStroke *UNUSED(stroke))
 {
-	Object *ob= CTX_data_active_object(C);
+	Object *ob = CTX_data_active_object(C);
 	SculptSession *ss = ob->sculpt;
 	Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
 
-	// reset values used to draw brush after completing the stroke
-	sd->draw_anchored= 0;
-	sd->draw_pressure= 0;
-	sd->special_rotation= 0;
+	/* reset values used to draw brush after completing the stroke */
+	sd->draw_anchored = 0;
+	sd->draw_pressure = 0;
+	sd->special_rotation = 0;
 
 	/* Finished */
-	if(ss->cache) {
-		Brush *brush= paint_brush(&sd->paint);
+	if (ss->cache) {
+		Brush *brush = paint_brush(&sd->paint);
 		brush->flag &= ~BRUSH_INVERTED;
 
 		sculpt_stroke_modifiers_check(C, ob);
 
 		/* Alt-Smooth */
 		if (ss->cache->alt_smooth) {
-			Paint *p= &sd->paint;
-			brush= (Brush *)find_id("BR", ss->cache->saved_active_brush_name);
-			if(brush) {
+			Paint *p = &sd->paint;
+			brush = (Brush *)find_id("BR", ss->cache->saved_active_brush_name);
+			if (brush) {
 				paint_brush_set(p, brush);
 			}
 		}
@@ -3483,15 +3487,15 @@ static void sculpt_stroke_done(bContext *C, struct PaintStroke *UNUSED(stroke))
 		/* optimization: if there is locked key and active modifiers present in */
 		/* the stack, keyblock is updating at each step. otherwise we could update */
 		/* keyblock only when stroke is finished */
-		if(ss->kb && !ss->modifiers_active) sculpt_update_keyblock(ob);
+		if (ss->kb && !ss->modifiers_active) sculpt_update_keyblock(ob);
 
 		ss->partial_redraw = 0;
 
 		/* try to avoid calling this, only for e.g. linked duplicates now */
-		if(((Mesh*)ob->data)->id.us > 1)
+		if (((Mesh *)ob->data)->id.us > 1)
 			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_OBJECT | ND_DRAW, ob);
 	}
 
 	sculpt_brush_exit_tex(sd);
@@ -3502,7 +3506,7 @@ static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, wmEvent *even
 	struct PaintStroke *stroke;
 	int ignore_background_click;
 
-	if(!sculpt_brush_stroke_init(C, op))
+	if (!sculpt_brush_stroke_init(C, op))
 		return OPERATOR_CANCELLED;
 
 	stroke = paint_stroke_new(C, sculpt_stroke_get_location,
@@ -3514,9 +3518,9 @@ static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, wmEvent *even
 
 	/* For tablet rotation */
 	ignore_background_click = RNA_boolean_get(op->ptr,
-						  "ignore_background_click"); 
+	                                          "ignore_background_click");
 
-	if(ignore_background_click && !over_mesh(C, op, event->x, event->y)) {
+	if (ignore_background_click && !over_mesh(C, op, event->x, event->y)) {
 		paint_stroke_free(stroke);
 		return OPERATOR_PASS_THROUGH;
 	}
@@ -3531,11 +3535,11 @@ static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, wmEvent *even
 
 static int sculpt_brush_stroke_exec(bContext *C, wmOperator *op)
 {
-	if(!sculpt_brush_stroke_init(C, op))
+	if (!sculpt_brush_stroke_init(C, op))
 		return OPERATOR_CANCELLED;
 
 	op->customdata = paint_stroke_new(C, sculpt_stroke_get_location, sculpt_stroke_test_start,
-					  sculpt_stroke_update_step, sculpt_stroke_done, 0);
+	                                  sculpt_stroke_update_step, sculpt_stroke_done, 0);
 
 	/* frees op->customdata */
 	paint_stroke_exec(C, op);
@@ -3545,13 +3549,13 @@ static int sculpt_brush_stroke_exec(bContext *C, wmOperator *op)
 
 static int sculpt_brush_stroke_cancel(bContext *C, wmOperator *op)
 {
-	Object *ob= CTX_data_active_object(C);
+	Object *ob = CTX_data_active_object(C);
 	SculptSession *ss = ob->sculpt;
 	Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
 
 	paint_stroke_cancel(C, op);
 
-	if(ss->cache) {
+	if (ss->cache) {
 		sculpt_cache_free(ss->cache);
 		ss->cache = NULL;
 	}
@@ -3571,31 +3575,31 @@ static void SCULPT_OT_brush_stroke(wmOperatorType *ot)
 	};
 
 	/* identifiers */
-	ot->name= "Sculpt Mode";
-	ot->idname= "SCULPT_OT_brush_stroke";
+	ot->name = "Sculpt Mode";
+	ot->idname = "SCULPT_OT_brush_stroke";
 	
 	/* api callbacks */
-	ot->invoke= sculpt_brush_stroke_invoke;
-	ot->modal= paint_stroke_modal;
-	ot->exec= sculpt_brush_stroke_exec;
-	ot->poll= sculpt_poll;
-	ot->cancel= sculpt_brush_stroke_cancel;
+	ot->invoke = sculpt_brush_stroke_invoke;
+	ot->modal = paint_stroke_modal;
+	ot->exec = sculpt_brush_stroke_exec;
+	ot->poll = sculpt_poll;
+	ot->cancel = sculpt_brush_stroke_cancel;
 
 	/* flags (sculpt does own undo? (ton) */
-	ot->flag= OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_BLOCKING;
 
 	/* properties */
 
 	RNA_def_collection_runtime(ot->srna, "stroke", &RNA_OperatorStrokeElement,
-			"Stroke", "");
+	                           "Stroke", "");
 
 	RNA_def_enum(ot->srna, "mode", stroke_mode_items, BRUSH_STROKE_NORMAL, 
-			"Sculpt Stroke Mode",
-			"Action taken when a sculpt stroke is made");
+	             "Sculpt Stroke Mode",
+	             "Action taken when a sculpt stroke is made");
 
 	RNA_def_boolean(ot->srna, "ignore_background_click", 0,
-			"Ignore Background Click",
-			"Clicks on the background do not start the stroke");
+	                "Ignore Background Click",
+	                "Clicks on the background do not start the stroke");
 }
 
 /**** Reset the copy of the mesh that is being sculpted on (currently just for the layer brush) ****/
@@ -3604,8 +3608,8 @@ static int sculpt_set_persistent_base(bContext *C, wmOperator *UNUSED(op))
 {
 	SculptSession *ss = CTX_data_active_object(C)->sculpt;
 
-	if(ss) {
-		if(ss->layer_co)
+	if (ss) {
+		if (ss->layer_co)
 			MEM_freeN(ss->layer_co);
 		ss->layer_co = NULL;
 	}
@@ -3616,14 +3620,14 @@ static int sculpt_set_persistent_base(bContext *C, wmOperator *UNUSED(op))
 static void SCULPT_OT_set_persistent_base(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Persistent Base";
-	ot->idname= "SCULPT_OT_set_persistent_base";
+	ot->name = "Set Persistent Base";
+	ot->idname = "SCULPT_OT_set_persistent_base";
 	
 	/* api callbacks */
-	ot->exec= sculpt_set_persistent_base;
-	ot->poll= sculpt_mode_poll;
+	ot->exec = sculpt_set_persistent_base;
+	ot->poll = sculpt_mode_poll;
 	
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /**** Toggle operator for turning sculpt mode on or off ****/
@@ -3640,19 +3644,19 @@ static int sculpt_toggle_mode(bContext *C, wmOperator *UNUSED(op))
 	Scene *scene = CTX_data_scene(C);
 	ToolSettings *ts = CTX_data_tool_settings(C);
 	Object *ob = CTX_data_active_object(C);
-	MultiresModifierData *mmd= sculpt_multires_active(scene, ob);
-	int flush_recalc= 0;
+	MultiresModifierData *mmd = sculpt_multires_active(scene, ob);
+	int flush_recalc = 0;
 
 	/* multires in sculpt mode could have different from object mode subdivision level */
 	flush_recalc |= mmd && mmd->sculptlvl != mmd->lvl;
 	/* if object has got active modifiers, it's dm could be different in sculpt mode  */
 	flush_recalc |= sculpt_has_active_modifiers(scene, ob);
 
-	if(ob->mode & OB_MODE_SCULPT) {
-		if(mmd)
+	if (ob->mode & OB_MODE_SCULPT) {
+		if (mmd)
 			multires_force_update(ob);
 
-		if(flush_recalc)
+		if (flush_recalc)
 			DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 
 		/* Leave sculptmode */
@@ -3664,11 +3668,11 @@ static int sculpt_toggle_mode(bContext *C, wmOperator *UNUSED(op))
 		/* Enter sculptmode */
 		ob->mode |= OB_MODE_SCULPT;
 
-		if(flush_recalc)
+		if (flush_recalc)
 			DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 		
 		/* Create persistent sculpt mode data */
-		if(!ts->sculpt) {
+		if (!ts->sculpt) {
 			ts->sculpt = MEM_callocN(sizeof(Sculpt), "sculpt mode data");
 
 			/* Turn on X plane mirror symmetry by default */
@@ -3676,7 +3680,7 @@ static int sculpt_toggle_mode(bContext *C, wmOperator *UNUSED(op))
 		}
 
 		/* Create sculpt mode session data */
-		if(ob->sculpt)
+		if (ob->sculpt)
 			free_sculptsession(ob);
 
 		sculpt_init_session(scene, ob);
@@ -3686,7 +3690,7 @@ static int sculpt_toggle_mode(bContext *C, wmOperator *UNUSED(op))
 		paint_cursor_start(C, sculpt_poll);
 	}
 
-	WM_event_add_notifier(C, NC_SCENE|ND_MODE, CTX_data_scene(C));
+	WM_event_add_notifier(C, NC_SCENE | ND_MODE, CTX_data_scene(C));
 
 	return OPERATOR_FINISHED;
 }
@@ -3694,14 +3698,14 @@ static int sculpt_toggle_mode(bContext *C, wmOperator *UNUSED(op))
 static void SCULPT_OT_sculptmode_toggle(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Sculpt Mode";
-	ot->idname= "SCULPT_OT_sculptmode_toggle";
+	ot->name = "Sculpt Mode";
+	ot->idname = "SCULPT_OT_sculptmode_toggle";
 	
 	/* api callbacks */
-	ot->exec= sculpt_toggle_mode;
-	ot->poll= ED_operator_object_active_editable_mesh;
+	ot->exec = sculpt_toggle_mode;
+	ot->poll = ED_operator_object_active_editable_mesh;
 	
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 void ED_operatortypes_sculpt(void)
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index 275d1d5..8ccf55e 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -30,13 +30,14 @@
  */
  
 
-#ifndef BDR_SCULPTMODE_H
-#define BDR_SCULPTMODE_H
+#ifndef __SCULPT_INTERN_H__
+#define __SCULPT_INTERN_H__
 
 #include "DNA_listBase.h"
 #include "DNA_vec_types.h"
 #include "DNA_key_types.h"
 
+#include "BLI_bitmap.h"
 #include "BLI_pbvh.h"
 
 struct bContext;
@@ -50,36 +51,32 @@ struct Sculpt;
 struct SculptStroke;
 
 /* Interface */
-void sculptmode_selectbrush_menu(void);
-void sculptmode_draw_mesh(int);
-void sculpt_paint_brush(char clear);
-void sculpt_stroke_draw(struct SculptStroke *);
-void sculpt_radialcontrol_start(int mode);
 struct MultiresModifierData *sculpt_multires_active(struct Scene *scene, struct Object *ob);
 
-struct Brush *sculptmode_brush(void);
-
 void sculpt(Sculpt *sd);
 
+int sculpt_mode_poll(struct bContext *C);
 int sculpt_poll(struct bContext *C);
-void sculpt_update_mesh_elements(struct Scene *scene, struct Sculpt *sd, struct Object *ob, int need_fmap);
+void sculpt_update_mesh_elements(struct Scene *scene, struct Sculpt *sd, struct Object *ob, int need_pmap);
 
 /* Deformed mesh sculpt */
 void free_sculptsession_deformMats(struct SculptSession *ss);
 
 /* Stroke */
-struct SculptStroke *sculpt_stroke_new(const int max);
-void sculpt_stroke_free(struct SculptStroke *);
-void sculpt_stroke_add_point(struct SculptStroke *, const short x, const short y);
-void sculpt_stroke_apply(struct Sculpt *sd, struct SculptStroke *);
-void sculpt_stroke_apply_all(struct Sculpt *sd, struct SculptStroke *);
 int sculpt_stroke_get_location(bContext *C, float out[3], float mouse[2]);
 
 /* Undo */
 
+typedef enum {
+	SCULPT_UNDO_COORDS,
+	SCULPT_UNDO_HIDDEN
+} SculptUndoType;
+
 typedef struct SculptUndoNode {
 	struct SculptUndoNode *next, *prev;
 
+	SculptUndoType type;
+
 	char idname[MAX_ID_NAME];	/* name instead of pointer*/
 	void *node;					/* only during push, not valid afterwards! */
 
@@ -91,12 +88,14 @@ typedef struct SculptUndoNode {
 	/* non-multires */
 	int maxvert;				/* to verify if totvert it still the same */
 	int *index;					/* to restore into right location */
+	BLI_bitmap vert_hidden;
 
 	/* multires */
 	int maxgrid;				/* same for grid */
 	int gridsize;				/* same for grid */
 	int totgrid;				/* to restore into right location */
 	int *grids;					/* to restore into right location */
+	BLI_bitmap *grid_hidden;
 
 	/* layer brush */
 	float *layer_disp;
@@ -105,7 +104,7 @@ typedef struct SculptUndoNode {
 	char shapeName[sizeof(((KeyBlock *)0))->name];
 } SculptUndoNode;
 
-SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node);
+SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node, SculptUndoType type);
 SculptUndoNode *sculpt_undo_get_node(PBVHNode *node);
 void sculpt_undo_push_begin(const char *name);
 void sculpt_undo_push_end(void);
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 4c54a58..89a786d 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -55,6 +55,7 @@
 #include "BKE_paint.h"
 #include "BKE_key.h"
 #include "BKE_mesh.h"
+#include "BKE_subsurf.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
@@ -67,143 +68,220 @@
 
 /************************** Undo *************************/
 
-static void update_cb(PBVHNode *node, void *unused)
+static void update_cb(PBVHNode *node, void *rebuild)
 {
-	(void)unused;
 	BLI_pbvh_node_mark_update(node);
+	if (*((int *)rebuild))
+		BLI_pbvh_node_mark_rebuild_draw(node);
+	BLI_pbvh_node_fully_hidden_set(node, 0);
 }
 
-static void sculpt_restore_deformed(SculptSession *ss, SculptUndoNode *unode, int uindex, int oindex, float coord[3])
+static void sculpt_undo_restore_deformed(SculptSession *ss, SculptUndoNode *unode, int uindex, int oindex, float coord[3])
 {
-	if(unode->orig_co) {
+	if (unode->orig_co) {
 		swap_v3_v3(coord, unode->orig_co[uindex]);
 		copy_v3_v3(unode->co[uindex], ss->deform_cos[oindex]);
-	} else swap_v3_v3(coord, unode->co[uindex]);
+	}
+	else {
+		swap_v3_v3(coord, unode->co[uindex]);
+	}
 }
 
-static void sculpt_undo_restore(bContext *C, ListBase *lb)
+static int sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoNode *unode)
 {
 	Scene *scene = CTX_data_scene(C);
 	Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
 	Object *ob = CTX_data_active_object(C);
-	DerivedMesh *dm = mesh_get_derived_final(scene, ob, 0);
 	SculptSession *ss = ob->sculpt;
-	SculptUndoNode *unode;
 	MVert *mvert;
-	MultiresModifierData *mmd;
-	int *index;
-	int i, j, update= 0;
+	int *index, i, j;	
+	
+	if (unode->maxvert) {
+		/* regular mesh restore */
 
-	sculpt_update_mesh_elements(scene, sd, ob, 0);
+		if (ss->kb && strcmp(ss->kb->name, unode->shapeName)) {
+			/* shape key has been changed before calling undo operator */
 
-	for(unode=lb->first; unode; unode=unode->next) {
-		if(!(strcmp(unode->idname, ob->id.name)==0))
-			continue;
+			Key *key = ob_get_key(ob);
+			KeyBlock *kb = key_get_named_keyblock(key, unode->shapeName);
 
-		if(unode->maxvert) {
-			/* regular mesh restore */
-			if(ss->totvert != unode->maxvert)
-				continue;
+			if (kb) {
+				ob->shapenr = BLI_findindex(&key->block, kb) + 1;
 
-			if (ss->kb && strcmp(ss->kb->name, unode->shapeName)) {
-				/* shape key has been changed before calling undo operator */
+				sculpt_update_mesh_elements(scene, sd, ob, 0);
+				WM_event_add_notifier(C, NC_OBJECT | ND_DATA, ob);
+			}
+			else {
+				/* key has been removed -- skip this undo node */
+				return 0;
+			}
+		}
 
-				Key *key= ob_get_key(ob);
-				KeyBlock *kb= key_get_named_keyblock(key, unode->shapeName);
+		index = unode->index;
+		mvert = ss->mvert;
 
-				if (kb) {
-					ob->shapenr= BLI_findindex(&key->block, kb) + 1;
+		if (ss->kb) {
+			float (*vertCos)[3];
+			vertCos = key_to_vertcos(ob, ss->kb);
 
-					sculpt_update_mesh_elements(scene, sd, ob, 0);
-					WM_event_add_notifier(C, NC_OBJECT|ND_DATA, ob);
-				} else {
-					/* key has been removed -- skip this undo node */
-					continue;
+			for (i = 0; i < unode->totvert; i++) {
+				if (ss->modifiers_active) sculpt_undo_restore_deformed(ss, unode, i, index[i], vertCos[index[i]]);
+				else {
+					if (unode->orig_co) swap_v3_v3(vertCos[index[i]], unode->orig_co[i]);
+					else swap_v3_v3(vertCos[index[i]], unode->co[i]);
 				}
 			}
 
-			index= unode->index;
-			mvert= ss->mvert;
+			/* propagate new coords to keyblock */
+			sculpt_vertcos_to_key(ob, ss->kb, vertCos);
 
-			if (ss->kb) {
-				float (*vertCos)[3];
-				vertCos= key_to_vertcos(ob, ss->kb);
+			/* pbvh uses it's own mvert array, so coords should be */
+			/* propagated to pbvh here */
+			BLI_pbvh_apply_vertCos(ss->pbvh, vertCos);
 
-				for(i=0; i<unode->totvert; i++) {
-					if(ss->modifiers_active) sculpt_restore_deformed(ss, unode, i, index[i], vertCos[index[i]]);
-					else {
-						if(unode->orig_co) swap_v3_v3(vertCos[index[i]], unode->orig_co[i]);
-						else swap_v3_v3(vertCos[index[i]], unode->co[i]);
-					}
-				}
-
-				/* propagate new coords to keyblock */
-				sculpt_vertcos_to_key(ob, ss->kb, vertCos);
-
-				/* pbvh uses it's own mvert array, so coords should be */
-				/* propagated to pbvh here */
-				BLI_pbvh_apply_vertCos(ss->pbvh, vertCos);
-
-				MEM_freeN(vertCos);
-			} else {
-				for(i=0; i<unode->totvert; i++) {
-					if(ss->modifiers_active) sculpt_restore_deformed(ss, unode, i, index[i], mvert[index[i]].co);
-					else {
-						if(unode->orig_co) swap_v3_v3(mvert[index[i]].co, unode->orig_co[i]);
-						else swap_v3_v3(mvert[index[i]].co, unode->co[i]);
-					}
-					mvert[index[i]].flag |= ME_VERT_PBVH_UPDATE;
+			MEM_freeN(vertCos);
+		}
+		else {
+			for (i = 0; i < unode->totvert; i++) {
+				if (ss->modifiers_active) sculpt_undo_restore_deformed(ss, unode, i, index[i], mvert[index[i]].co);
+				else {
+					if (unode->orig_co) swap_v3_v3(mvert[index[i]].co, unode->orig_co[i]);
+					else swap_v3_v3(mvert[index[i]].co, unode->co[i]);
 				}
+				mvert[index[i]].flag |= ME_VERT_PBVH_UPDATE;
 			}
 		}
-		else if(unode->maxgrid && dm->getGridData) {
-			/* multires restore */
-			DMGridData **grids, *grid;
-			float (*co)[3];
-			int gridsize;
+	}
+	else if (unode->maxgrid && dm->getGridData) {
+		/* multires restore */
+		DMGridData **grids, *grid;
+		float (*co)[3];
+		int gridsize;
 
-			if(dm->getNumGrids(dm) != unode->maxgrid)
-				continue;
-			if(dm->getGridSize(dm) != unode->gridsize)
-				continue;
+		grids = dm->getGridData(dm);
+		gridsize = dm->getGridSize(dm);
 
-			grids= dm->getGridData(dm);
-			gridsize= dm->getGridSize(dm);
+		co = unode->co;
+		for (j = 0; j < unode->totgrid; j++) {
+			grid = grids[unode->grids[j]];
 
-			co = unode->co;
-			for(j=0; j<unode->totgrid; j++) {
-				grid= grids[unode->grids[j]];
+			for (i = 0; i < gridsize * gridsize; i++, co++)
+				swap_v3_v3(grid[i].co, co[0]);
+		}
+	}
 
-				for(i=0; i<gridsize*gridsize; i++, co++)
-					swap_v3_v3(grid[i].co, co[0]);
-			}
+	return 1;
+}
+
+static int sculpt_undo_restore_hidden(bContext *C, DerivedMesh *dm,
+                                      SculptUndoNode *unode)
+{
+	Object *ob = CTX_data_active_object(C);
+	SculptSession *ss = ob->sculpt;
+	int i;
+
+	if (unode->maxvert) {
+		MVert *mvert = ss->mvert;
+		
+		for (i = 0; i < unode->totvert; i++) {
+			MVert *v = &mvert[unode->index[i]];
+			int uval = BLI_BITMAP_GET(unode->vert_hidden, i);
+
+			BLI_BITMAP_MODIFY(unode->vert_hidden, i,
+			                  v->flag & ME_HIDE);
+			if (uval)
+				v->flag |= ME_HIDE;
+			else
+				v->flag &= ~ME_HIDE;
+			
+			v->flag |= ME_VERT_PBVH_UPDATE;
 		}
+	}
+	else if (unode->maxgrid && dm->getGridData) {
+		BLI_bitmap *grid_hidden = dm->getGridHidden(dm);
+		
+		for (i = 0; i < unode->totgrid; i++) {
+			SWAP(BLI_bitmap,
+			     unode->grid_hidden[i],
+			     grid_hidden[unode->grids[i]]);
+			
+		}
+	}
 
-		update= 1;
+	return 1;
+}
+
+static void sculpt_undo_restore(bContext *C, ListBase *lb)
+{
+	Scene *scene = CTX_data_scene(C);
+	Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
+	Object *ob = CTX_data_active_object(C);
+	DerivedMesh *dm = mesh_get_derived_final(scene, ob, 0);
+	SculptSession *ss = ob->sculpt;
+	SculptUndoNode *unode;
+	MultiresModifierData *mmd;
+	int update = 0, rebuild = 1;
+
+	sculpt_update_mesh_elements(scene, sd, ob, 0);
+
+	for (unode = lb->first; unode; unode = unode->next) {
+		if (!(strcmp(unode->idname, ob->id.name) == 0))
+			continue;
+
+		/* check if undo data matches current data well enough to
+		 * continue */
+		if (unode->maxvert) {
+			if (ss->totvert != unode->maxvert)
+				continue;
+		}
+		else if (unode->maxgrid && dm->getGridData) {
+			if ((dm->getNumGrids(dm) != unode->maxgrid) ||
+			    (dm->getGridSize(dm) != unode->gridsize))
+				continue;
+		}
+		else {
+			continue;
+		}
+
+		switch (unode->type) {
+			case SCULPT_UNDO_COORDS:
+				if (sculpt_undo_restore_coords(C, dm, unode))
+					update = 1;
+				break;
+			case SCULPT_UNDO_HIDDEN:
+				if (sculpt_undo_restore_hidden(C, dm, unode))
+					rebuild = 1;
+				break;
+		}
 	}
 
-	if(update) {
-		int tag_update= 0;
+	if (update || rebuild) {
+		int tag_update = 0;
 		/* we update all nodes still, should be more clever, but also
-		   needs to work correct when exiting/entering sculpt mode and
-		   the nodes get recreated, though in that case it could do all */
-		BLI_pbvh_search_callback(ss->pbvh, NULL, NULL, update_cb, NULL);
-		BLI_pbvh_update(ss->pbvh, PBVH_UpdateBB|PBVH_UpdateOriginalBB|PBVH_UpdateRedraw, NULL);
-
-		if((mmd=sculpt_multires_active(scene, ob)))
-			multires_mark_as_modified(ob);
+		 * needs to work correct when exiting/entering sculpt mode and
+		 * the nodes get recreated, though in that case it could do all */
+		BLI_pbvh_search_callback(ss->pbvh, NULL, NULL, update_cb, &rebuild);
+		BLI_pbvh_update(ss->pbvh, PBVH_UpdateBB | PBVH_UpdateOriginalBB | PBVH_UpdateRedraw, NULL);
+
+		if ((mmd = sculpt_multires_active(scene, ob))) {
+			if (rebuild)
+				multires_mark_as_modified(ob, MULTIRES_HIDDEN_MODIFIED);
+			else
+				multires_mark_as_modified(ob, MULTIRES_COORDS_MODIFIED);
+		}
 
-		tag_update= ((Mesh*)ob->data)->id.us > 1;
+		tag_update = ((Mesh *)ob->data)->id.us > 1;
 
-		if(ss->modifiers_active) {
-			Mesh *me= ob->data;
-			mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
+		if (ss->modifiers_active) {
+			Mesh *mesh = ob->data;
+			mesh_calc_normals_tessface(mesh->mvert, mesh->totvert,
+									   mesh->mface, mesh->totface, NULL);
 
 			free_sculptsession_deformMats(ss);
-			tag_update|= 1;
+			tag_update |= 1;
 		}
 
-		if(tag_update)
+		if (tag_update)
 			DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 
 		/* for non-PBVH drawing, need to recreate VBOs */
@@ -214,108 +292,212 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb)
 static void sculpt_undo_free(ListBase *lb)
 {
 	SculptUndoNode *unode;
+	int i;
 
-	for(unode=lb->first; unode; unode=unode->next) {
-		if(unode->co)
+	for (unode = lb->first; unode; unode = unode->next) {
+		if (unode->co)
 			MEM_freeN(unode->co);
-		if(unode->no)
+		if (unode->no)
 			MEM_freeN(unode->no);
-		if(unode->index)
+		if (unode->index)
 			MEM_freeN(unode->index);
-		if(unode->grids)
+		if (unode->grids)
 			MEM_freeN(unode->grids);
-		if(unode->layer_disp)
+		if (unode->layer_disp)
 			MEM_freeN(unode->layer_disp);
-		if(unode->orig_co)
+		if (unode->orig_co)
 			MEM_freeN(unode->orig_co);
+		if (unode->vert_hidden)
+			MEM_freeN(unode->vert_hidden);
+		if (unode->grid_hidden) {
+			for (i = 0; i < unode->totgrid; i++) {
+				if (unode->grid_hidden[i])
+					MEM_freeN(unode->grid_hidden[i]);
+			}
+			MEM_freeN(unode->grid_hidden);
+		}
 	}
 }
 
 SculptUndoNode *sculpt_undo_get_node(PBVHNode *node)
 {
-	ListBase *lb= undo_paint_push_get_list(UNDO_PAINT_MESH);
+	ListBase *lb = undo_paint_push_get_list(UNDO_PAINT_MESH);
 	SculptUndoNode *unode;
 
-	if(!lb)
+	if (!lb)
 		return NULL;
 
-	for(unode=lb->first; unode; unode=unode->next)
-		if(unode->node == node)
+	for (unode = lb->first; unode; unode = unode->next)
+		if (unode->node == node)
 			return unode;
 
 	return NULL;
 }
 
-SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node)
+static void sculpt_undo_alloc_and_store_hidden(PBVH *pbvh,
+                                               SculptUndoNode *unode)
 {
-	ListBase *lb= undo_paint_push_get_list(UNDO_PAINT_MESH);
-	SculptSession *ss = ob->sculpt;
-	SculptUndoNode *unode;
-	int totvert, allvert, totgrid, maxgrid, gridsize, *grids;
-
-	/* list is manipulated by multiple threads, so we lock */
-	BLI_lock_thread(LOCK_CUSTOM1);
-
-	if((unode= sculpt_undo_get_node(node))) {
-		BLI_unlock_thread(LOCK_CUSTOM1);
-		return unode;
+	PBVHNode *node = unode->node;
+	BLI_bitmap *grid_hidden;
+	int i, *grid_indices, totgrid;
+
+	grid_hidden = BLI_pbvh_grid_hidden(pbvh);
+
+	BLI_pbvh_node_get_grids(pbvh, node, &grid_indices, &totgrid,
+	                        NULL, NULL, NULL, NULL);
+			
+	unode->grid_hidden = MEM_mapallocN(sizeof(BLI_bitmap) * totgrid,
+	                                   "unode->grid_hidden");
+		
+	for (i = 0; i < totgrid; i++) {
+		if (grid_hidden[grid_indices[i]])
+			unode->grid_hidden[i] = MEM_dupallocN(grid_hidden[grid_indices[i]]);
+		else
+			unode->grid_hidden[i] = NULL;
 	}
+}
 
-	unode= MEM_callocN(sizeof(SculptUndoNode), "SculptUndoNode");
+static SculptUndoNode *sculpt_undo_alloc_node(Object *ob, PBVHNode *node,
+                                              SculptUndoType type)
+{
+	ListBase *lb = undo_paint_push_get_list(UNDO_PAINT_MESH);
+	SculptUndoNode *unode;
+	SculptSession *ss = ob->sculpt;
+	int totvert, allvert, totgrid, maxgrid, gridsize, *grids;
+	
+	unode = MEM_callocN(sizeof(SculptUndoNode), "SculptUndoNode");
 	BLI_strncpy(unode->idname, ob->id.name, sizeof(unode->idname));
-	unode->node= node;
+	unode->type = type;
+	unode->node = node;
 
 	BLI_pbvh_node_num_verts(ss->pbvh, node, &totvert, &allvert);
 	BLI_pbvh_node_get_grids(ss->pbvh, node, &grids, &totgrid,
-		&maxgrid, &gridsize, NULL, NULL);
+	                        &maxgrid, &gridsize, NULL, NULL);
 
-	unode->totvert= totvert;
+	unode->totvert = totvert;
+	
 	/* we will use this while sculpting, is mapalloc slow to access then? */
-	unode->co= MEM_mapallocN(sizeof(float)*3*allvert, "SculptUndoNode.co");
-	unode->no= MEM_mapallocN(sizeof(short)*3*allvert, "SculptUndoNode.no");
-	undo_paint_push_count_alloc(UNDO_PAINT_MESH, (sizeof(float)*3 + sizeof(short)*3 + sizeof(int))*allvert);
+
+	/* general TODO, fix count_alloc */
+	switch (type) {
+		case SCULPT_UNDO_COORDS:
+			unode->co = MEM_mapallocN(sizeof(float) * 3 * allvert, "SculptUndoNode.co");
+			unode->no = MEM_mapallocN(sizeof(short) * 3 * allvert, "SculptUndoNode.no");
+			undo_paint_push_count_alloc(UNDO_PAINT_MESH, (sizeof(float) * 3 + sizeof(short) * 3 + sizeof(int)) * allvert);
+			break;
+		case SCULPT_UNDO_HIDDEN:
+			if (maxgrid)
+				sculpt_undo_alloc_and_store_hidden(ss->pbvh, unode);
+			else
+				unode->vert_hidden = BLI_BITMAP_NEW(allvert, "SculptUndoNode.vert_hidden");
+		
+			break;
+	}
+	
 	BLI_addtail(lb, unode);
 
-	if(maxgrid) {
+	if (maxgrid) {
 		/* multires */
-		unode->maxgrid= maxgrid;
-		unode->totgrid= totgrid;
-		unode->gridsize= gridsize;
-		unode->grids= MEM_mapallocN(sizeof(int)*totgrid, "SculptUndoNode.grids");
+		unode->maxgrid = maxgrid;
+		unode->totgrid = totgrid;
+		unode->gridsize = gridsize;
+		unode->grids = MEM_mapallocN(sizeof(int) * totgrid, "SculptUndoNode.grids");
 	}
 	else {
 		/* regular mesh */
-		unode->maxvert= ss->totvert;
-		unode->index= MEM_mapallocN(sizeof(int)*allvert, "SculptUndoNode.index");
+		unode->maxvert = ss->totvert;
+		unode->index = MEM_mapallocN(sizeof(int) * allvert, "SculptUndoNode.index");
 	}
 
-	if(ss->modifiers_active)
-		unode->orig_co= MEM_callocN(allvert*sizeof(*unode->orig_co), "undoSculpt orig_cos");
+	if (ss->modifiers_active)
+		unode->orig_co = MEM_callocN(allvert * sizeof(*unode->orig_co), "undoSculpt orig_cos");
 
-	BLI_unlock_thread(LOCK_CUSTOM1);
+	return unode;
+}
 
-	/* copy threaded, hopefully this is the performance critical part */
-	{
-		PBVHVertexIter vd;
+static void sculpt_undo_store_coords(Object *ob, SculptUndoNode *unode)
+{
+	SculptSession *ss = ob->sculpt;
+	PBVHVertexIter vd;
+
+	BLI_pbvh_vertex_iter_begin(ss->pbvh, unode->node, vd, PBVH_ITER_ALL) {
+		copy_v3_v3(unode->co[vd.i], vd.co);
+		if (vd.no) copy_v3_v3_short(unode->no[vd.i], vd.no);
+		else normal_float_to_short_v3(unode->no[vd.i], vd.fno);
 
-		BLI_pbvh_vertex_iter_begin(ss->pbvh, node, vd, PBVH_ITER_ALL) {
-			copy_v3_v3(unode->co[vd.i], vd.co);
-			if(vd.no) copy_v3_v3_short(unode->no[vd.i], vd.no);
-			else normal_float_to_short_v3(unode->no[vd.i], vd.fno);
-			if(vd.vert_indices) unode->index[vd.i]= vd.vert_indices[vd.i];
+		if (ss->modifiers_active)
+			copy_v3_v3(unode->orig_co[vd.i], ss->orig_cos[unode->index[vd.i]]);
+	}
+	BLI_pbvh_vertex_iter_end;
+}
+
+static void sculpt_undo_store_hidden(Object *ob, SculptUndoNode *unode)
+{
+	PBVH *pbvh = ob->sculpt->pbvh;
+	PBVHNode *node = unode->node;
 
-			if(ss->modifiers_active)
-				copy_v3_v3(unode->orig_co[vd.i], ss->orig_cos[unode->index[vd.i]]);
+	if (unode->grids) {
+		/* already stored during allocation */
+	}
+	else {
+		MVert *mvert;
+		int *vert_indices, allvert;
+		int i;
+		
+		BLI_pbvh_node_num_verts(pbvh, node, NULL, &allvert);
+		BLI_pbvh_node_get_verts(pbvh, node, &vert_indices, &mvert);
+		for (i = 0; i < allvert; i++) {
+			BLI_BITMAP_MODIFY(unode->vert_hidden, i,
+			                  mvert[vert_indices[i]].flag & ME_HIDE);
 		}
-		BLI_pbvh_vertex_iter_end;
 	}
+}
+
+SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node,
+                                      SculptUndoType type)
+{
+	SculptSession *ss = ob->sculpt;
+	SculptUndoNode *unode;
+
+	/* list is manipulated by multiple threads, so we lock */
+	BLI_lock_thread(LOCK_CUSTOM1);
 
-	if(unode->grids)
-		memcpy(unode->grids, grids, sizeof(int)*totgrid);
+	if ((unode = sculpt_undo_get_node(node))) {
+		BLI_unlock_thread(LOCK_CUSTOM1);
+		return unode;
+	}
+
+	unode = sculpt_undo_alloc_node(ob, node, type);
+	
+	BLI_unlock_thread(LOCK_CUSTOM1);
+
+	/* copy threaded, hopefully this is the performance critical part */
+
+	if (unode->grids) {
+		int totgrid, *grids;
+		BLI_pbvh_node_get_grids(ss->pbvh, node, &grids, &totgrid,
+		                        NULL, NULL, NULL, NULL);
+		memcpy(unode->grids, grids, sizeof(int) * totgrid);
+	}
+	else {
+		int *vert_indices, allvert;
+		BLI_pbvh_node_num_verts(ss->pbvh, node, NULL, &allvert);
+		BLI_pbvh_node_get_verts(ss->pbvh, node, &vert_indices, NULL);
+		memcpy(unode->index, vert_indices, sizeof(int) * unode->totvert);
+	}
+
+	switch (type) {
+		case SCULPT_UNDO_COORDS:
+			sculpt_undo_store_coords(ob, unode);
+			break;
+		case SCULPT_UNDO_HIDDEN:
+			sculpt_undo_store_hidden(ob, unode);
+			break;
+	}
 
 	/* store active shape key */
-	if(ss->kb) BLI_strncpy(unode->shapeName, ss->kb->name, sizeof(ss->kb->name));
-	else unode->shapeName[0]= '\0';
+	if (ss->kb) BLI_strncpy(unode->shapeName, ss->kb->name, sizeof(ss->kb->name));
+	else unode->shapeName[0] = '\0';
 
 	return unode;
 }
@@ -323,24 +505,24 @@ SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node)
 void sculpt_undo_push_begin(const char *name)
 {
 	undo_paint_push_begin(UNDO_PAINT_MESH, name,
-		sculpt_undo_restore, sculpt_undo_free);
+	                      sculpt_undo_restore, sculpt_undo_free);
 }
 
 void sculpt_undo_push_end(void)
 {
-	ListBase *lb= undo_paint_push_get_list(UNDO_PAINT_MESH);
+	ListBase *lb = undo_paint_push_get_list(UNDO_PAINT_MESH);
 	SculptUndoNode *unode;
 
 	/* we don't need normals in the undo stack */
-	for(unode=lb->first; unode; unode=unode->next) {
-		if(unode->no) {
+	for (unode = lb->first; unode; unode = unode->next) {
+		if (unode->no) {
 			MEM_freeN(unode->no);
-			unode->no= NULL;
+			unode->no = NULL;
 		}
 
-		if(unode->layer_disp) {
+		if (unode->layer_disp) {
 			MEM_freeN(unode->layer_disp);
-			unode->layer_disp= NULL;
+			unode->layer_disp = NULL;
 		}
 	}
 
diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c
index bf8cb58..4545c49 100644
--- a/source/blender/editors/sculpt_paint/sculpt_uv.c
+++ b/source/blender/editors/sculpt_paint/sculpt_uv.c
@@ -34,13 +34,13 @@
 #include "MEM_guardedalloc.h"
 
 #include "BLI_utildefines.h"
-#include "BLI_editVert.h"
 #include "BLI_math.h"
 #include "BLI_ghash.h"
 
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_brush_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 
 #include "BKE_brush.h"
@@ -50,6 +50,7 @@
 #include "BKE_depsgraph.h"
 #include "BKE_mesh.h"
 #include "BKE_customdata.h"
+#include "BKE_tessmesh.h"
 
 #include "ED_screen.h"
 #include "ED_image.h"
@@ -67,7 +68,7 @@
 
 #include "UI_view2d.h"
 
-#define MARK_BOUNDARY	1
+#define MARK_BOUNDARY   1
 
 typedef struct UvAdjacencyElement {
 	/* pointer to original uvelement */
@@ -83,9 +84,9 @@ typedef struct UvEdge {
 	unsigned int uv2;
 	/* general use flag (Used to check if edge is boundary here, and propagates to adjacency elements) */
 	char flag;
-}UvEdge;
+} UvEdge;
 
-typedef struct UVInitialStrokeElement{
+typedef struct UVInitialStrokeElement {
 	/* index to unique uv */
 	int uv;
 
@@ -94,9 +95,9 @@ typedef struct UVInitialStrokeElement{
 
 	/* initial uv position */
 	float initial_uv[2];
-}UVInitialStrokeElement;
+} UVInitialStrokeElement;
 
-typedef struct UVInitialStroke{
+typedef struct UVInitialStroke {
 	/* Initial Selection,for grab brushes for instance */
 	UVInitialStrokeElement *initialSelection;
 
@@ -105,11 +106,11 @@ typedef struct UVInitialStroke{
 
 	/* initial mouse coordinates */
 	float init_coord[2];
-}UVInitialStroke;
+} UVInitialStroke;
 
 
 /* custom data for uv smoothing brush */
-typedef struct UvSculptData{
+typedef struct UvSculptData {
 	/* Contains the first of each set of coincident uvs.
 	 * These will be used to perform smoothing on and propagate the changes
 	 * to their coincident uvs */
@@ -141,21 +142,23 @@ typedef struct UvSculptData{
 
 	/* store invert flag here */
 	char invert;
-}UvSculptData;
+} UvSculptData;
 
 /*********** Improved Laplacian Relaxation Operator ************************/
 /* original code by Raul Fernandez Hernandez "farsthary"                   *
  * adapted to uv smoothing by Antony Riakiatakis                           *
  ***************************************************************************/
 
-typedef struct Temp_UvData{
+typedef struct Temp_UvData {
 	float sum_co[2], p[2], b[2], sum_b[2];
 	int ncounter;
-}Temp_UVData;
+} Temp_UVData;
 
 
 
-void HC_relaxation_iteration_uv(EditMesh *em, UvSculptData *sculptdata, float mouse_coord[2], float alpha, float radius, float aspectRatio){
+void HC_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *sculptdata, float mouse_coord[2],
+                                float alpha, float radius, float aspectRatio)
+{
 	Temp_UVData *tmp_uvdata;
 	float diff[2];
 	int i;
@@ -165,8 +168,8 @@ void HC_relaxation_iteration_uv(EditMesh *em, UvSculptData *sculptdata, float mo
 	tmp_uvdata = (Temp_UVData *)MEM_callocN(sculptdata->totalUniqueUvs * sizeof(Temp_UVData), "Temporal data");
 
 	/* counting neighbors */
-	for (i = 0; i < sculptdata->totalUvEdges; i++){
-		UvEdge *tmpedge = sculptdata->uvedges+i;
+	for (i = 0; i < sculptdata->totalUvEdges; i++) {
+		UvEdge *tmpedge = sculptdata->uvedges + i;
 		tmp_uvdata[tmpedge->uv1].ncounter++;
 		tmp_uvdata[tmpedge->uv2].ncounter++;
 
@@ -174,45 +177,49 @@ void HC_relaxation_iteration_uv(EditMesh *em, UvSculptData *sculptdata, float mo
 		add_v2_v2(tmp_uvdata[tmpedge->uv1].sum_co, sculptdata->uv[tmpedge->uv2].uv);
 	}
 
-	for (i = 0; i < sculptdata->totalUniqueUvs; i++){
-		copy_v2_v2(diff,tmp_uvdata[i].sum_co);
-		mul_v2_fl(diff,1.f/tmp_uvdata[i].ncounter);
-		copy_v2_v2(tmp_uvdata[i].p,diff);
+	for (i = 0; i < sculptdata->totalUniqueUvs; i++) {
+		copy_v2_v2(diff, tmp_uvdata[i].sum_co);
+		mul_v2_fl(diff, 1.f / tmp_uvdata[i].ncounter);
+		copy_v2_v2(tmp_uvdata[i].p, diff);
 
 		tmp_uvdata[i].b[0] = diff[0] - sculptdata->uv[i].uv[0];
 		tmp_uvdata[i].b[1] = diff[1] - sculptdata->uv[i].uv[1];
 	}
 
-	for (i = 0; i < sculptdata->totalUvEdges; i++){
-		UvEdge *tmpedge = sculptdata->uvedges+i;
+	for (i = 0; i < sculptdata->totalUvEdges; i++) {
+		UvEdge *tmpedge = sculptdata->uvedges + i;
 		add_v2_v2(tmp_uvdata[tmpedge->uv1].sum_b, tmp_uvdata[tmpedge->uv2].b);
 		add_v2_v2(tmp_uvdata[tmpedge->uv2].sum_b, tmp_uvdata[tmpedge->uv1].b);
 	}
 
-	for (i = 0; i < sculptdata->totalUniqueUvs; i++){
+	for (i = 0; i < sculptdata->totalUniqueUvs; i++) {
 		float dist;
 		/* This is supposed to happen only if "Pin Edges" is on, since we have initialization on stroke start
 		 * If ever uv brushes get their own mode we should check for toolsettings option too */
-		if((sculptdata->uv[i].flag & MARK_BOUNDARY)){
+		if ((sculptdata->uv[i].flag & MARK_BOUNDARY)) {
 			continue;
 		}
 
 		sub_v2_v2v2(diff, sculptdata->uv[i].uv, mouse_coord);
 		diff[1] /= aspectRatio;
-		if((dist = dot_v2v2(diff, diff)) <= radius){
+		if ((dist = dot_v2v2(diff, diff)) <= radius) {
 			UvElement *element;
 			float strength;
-			strength = alpha*brush_curve_strength(brush, sqrt(dist), radius_root);
+			strength = alpha * brush_curve_strength(brush, sqrt(dist), radius_root);
+
+			sculptdata->uv[i].uv[0] = (1.0 - strength) * sculptdata->uv[i].uv[0] + strength * (tmp_uvdata[i].p[0] - 0.5f * (tmp_uvdata[i].b[0] + tmp_uvdata[i].sum_b[0] / tmp_uvdata[i].ncounter));
+			sculptdata->uv[i].uv[1] = (1.0 - strength) * sculptdata->uv[i].uv[1] + strength * (tmp_uvdata[i].p[1] - 0.5f * (tmp_uvdata[i].b[1] + tmp_uvdata[i].sum_b[1] / tmp_uvdata[i].ncounter));
 
-			sculptdata->uv[i].uv[0] = (1.0-strength)*sculptdata->uv[i].uv[0] + strength*(tmp_uvdata[i].p[0] - 0.5f*(tmp_uvdata[i].b[0] + tmp_uvdata[i].sum_b[0]/tmp_uvdata[i].ncounter));
-			sculptdata->uv[i].uv[1] = (1.0-strength)*sculptdata->uv[i].uv[1] + strength*(tmp_uvdata[i].p[1] - 0.5f*(tmp_uvdata[i].b[1] + tmp_uvdata[i].sum_b[1]/tmp_uvdata[i].ncounter));
+			for (element = sculptdata->uv[i].element; element; element = element->next) {
+				MLoopUV *luv;
+				BMLoop *l;
 
-			for(element = sculptdata->uv[i].element; element; element = element->next){
-				MTFace *mt;
-				if(element->separate && element != sculptdata->uv[i].element)
+				if (element->separate && element != sculptdata->uv[i].element)
 					break;
-				mt = CustomData_em_get(&em->fdata, element->face->data, CD_MTFACE);
-				copy_v2_v2(mt->uv[element->tfindex], sculptdata->uv[i].uv);
+
+				l = element->l;
+				luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+				copy_v2_v2(luv->uv, sculptdata->uv[i].uv);
 			}
 		}
 	}
@@ -222,7 +229,7 @@ void HC_relaxation_iteration_uv(EditMesh *em, UvSculptData *sculptdata, float mo
 	return;
 }
 
-static void laplacian_relaxation_iteration_uv(EditMesh *em, UvSculptData *sculptdata, float mouse_coord[2], float alpha, float radius, float aspectRatio)
+static void laplacian_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *sculptdata, float mouse_coord[2], float alpha, float radius, float aspectRatio)
 {
 	Temp_UVData *tmp_uvdata;
 	float diff[2];
@@ -233,8 +240,8 @@ static void laplacian_relaxation_iteration_uv(EditMesh *em, UvSculptData *sculpt
 	tmp_uvdata = (Temp_UVData *)MEM_callocN(sculptdata->totalUniqueUvs * sizeof(Temp_UVData), "Temporal data");
 
 	/* counting neighbors */
-	for (i = 0; i < sculptdata->totalUvEdges; i++){
-		UvEdge *tmpedge = sculptdata->uvedges+i;
+	for (i = 0; i < sculptdata->totalUvEdges; i++) {
+		UvEdge *tmpedge = sculptdata->uvedges + i;
 		tmp_uvdata[tmpedge->uv1].ncounter++;
 		tmp_uvdata[tmpedge->uv2].ncounter++;
 
@@ -244,35 +251,39 @@ static void laplacian_relaxation_iteration_uv(EditMesh *em, UvSculptData *sculpt
 
 	/* Original Lacplacian algorithm included removal of normal component of translation. here it is not
 	 * needed since we translate along the UV plane always.*/
-	for (i = 0; i < sculptdata->totalUniqueUvs; i++){
+	for (i = 0; i < sculptdata->totalUniqueUvs; i++) {
 		copy_v2_v2(tmp_uvdata[i].p, tmp_uvdata[i].sum_co);
-		mul_v2_fl(tmp_uvdata[i].p, 1.f/tmp_uvdata[i].ncounter);
+		mul_v2_fl(tmp_uvdata[i].p, 1.f / tmp_uvdata[i].ncounter);
 	}
 
-	for (i = 0; i < sculptdata->totalUniqueUvs; i++){
+	for (i = 0; i < sculptdata->totalUniqueUvs; i++) {
 		float dist;
 		/* This is supposed to happen only if "Pin Edges" is on, since we have initialization on stroke start
 		 * If ever uv brushes get their own mode we should check for toolsettings option too */
-		if((sculptdata->uv[i].flag & MARK_BOUNDARY)){
+		if ((sculptdata->uv[i].flag & MARK_BOUNDARY)) {
 			continue;
 		}
 
 		sub_v2_v2v2(diff, sculptdata->uv[i].uv, mouse_coord);
 		diff[1] /= aspectRatio;
-		if((dist = dot_v2v2(diff, diff)) <= radius){
+		if ((dist = dot_v2v2(diff, diff)) <= radius) {
 			UvElement *element;
 			float strength;
-			strength = alpha*brush_curve_strength(brush, sqrt(dist), radius_root);
+			strength = alpha * brush_curve_strength(brush, sqrt(dist), radius_root);
 
-			sculptdata->uv[i].uv[0] = (1.0-strength)*sculptdata->uv[i].uv[0] + strength*tmp_uvdata[i].p[0];
-			sculptdata->uv[i].uv[1] = (1.0-strength)*sculptdata->uv[i].uv[1] + strength*tmp_uvdata[i].p[1];
+			sculptdata->uv[i].uv[0] = (1.0 - strength) * sculptdata->uv[i].uv[0] + strength * tmp_uvdata[i].p[0];
+			sculptdata->uv[i].uv[1] = (1.0 - strength) * sculptdata->uv[i].uv[1] + strength * tmp_uvdata[i].p[1];
 
-			for(element = sculptdata->uv[i].element; element; element = element->next){
-				MTFace *mt;
-				if(element->separate && element != sculptdata->uv[i].element)
+			for (element = sculptdata->uv[i].element; element; element = element->next) {
+				MLoopUV *luv;
+				BMLoop *l;
+
+				if (element->separate && element != sculptdata->uv[i].element)
 					break;
-				mt = CustomData_em_get(&em->fdata, element->face->data, CD_MTFACE);
-				copy_v2_v2(mt->uv[element->tfindex], sculptdata->uv[i].uv);
+
+				l = element->l;
+				luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+				copy_v2_v2(luv->uv, sculptdata->uv[i].uv);
 			}
 		}
 	}
@@ -288,7 +299,7 @@ static void uv_sculpt_stroke_apply(bContext *C, wmOperator *op, wmEvent *event,
 	float co[2], radius, radius_root;
 	Scene *scene = CTX_data_scene(C);
 	ARegion *ar = CTX_wm_region(C);
-	EditMesh *em = BKE_mesh_get_editmesh(obedit->data);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
 	unsigned int tool;
 	UvSculptData *sculptdata = (UvSculptData *)op->customdata;
 	SpaceImage *sima;
@@ -299,7 +310,7 @@ static void uv_sculpt_stroke_apply(bContext *C, wmOperator *op, wmEvent *event,
 	Brush *brush = paint_brush(sculptdata->uvsculpt);
 	ToolSettings *toolsettings = CTX_data_tool_settings(C);
 	tool = sculptdata->tool;
-	invert = sculptdata->invert? -1 : 1;
+	invert = sculptdata->invert ? -1 : 1;
 	alpha = brush_alpha(scene, brush);
 	UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
 
@@ -307,44 +318,48 @@ static void uv_sculpt_stroke_apply(bContext *C, wmOperator *op, wmEvent *event,
 	ED_space_image_size(sima, &width, &height);
 	ED_space_image_zoom(sima, ar, &zoomx, &zoomy);
 
-	radius = brush_size(scene, brush)/(width*zoomx);
-	aspectRatio = width/(float)height;
+	radius = brush_size(scene, brush) / (width * zoomx);
+	aspectRatio = width / (float)height;
 
 	/* We will compare squares to save some computation */
-	radius = radius*radius;
+	radius = radius * radius;
 	radius_root = sqrt(radius);
 
 	/*
 	 * Pinch Tool
 	 */
-	if(tool == UV_SCULPT_TOOL_PINCH){
+	if (tool == UV_SCULPT_TOOL_PINCH) {
 		int i;
 		alpha *= invert;
-		for (i = 0; i < sculptdata->totalUniqueUvs; i++){
+		for (i = 0; i < sculptdata->totalUniqueUvs; i++) {
 			float dist, diff[2];
 			/* This is supposed to happen only if "Lock Borders" is on, since we have initialization on stroke start
 			 * If ever uv brushes get their own mode we should check for toolsettings option too */
-			if(sculptdata->uv[i].flag & MARK_BOUNDARY){
+			if (sculptdata->uv[i].flag & MARK_BOUNDARY) {
 				continue;
 			}
 
 			sub_v2_v2v2(diff, sculptdata->uv[i].uv, co);
 			diff[1] /= aspectRatio;
-			if((dist = dot_v2v2(diff, diff)) <= radius){
+			if ((dist = dot_v2v2(diff, diff)) <= radius) {
 				UvElement *element;
 				float strength;
-				strength = alpha*brush_curve_strength(brush, sqrt(dist), radius_root);
+				strength = alpha * brush_curve_strength(brush, sqrt(dist), radius_root);
 				normalize_v2(diff);
 
-				sculptdata->uv[i].uv[0] -= strength*diff[0]*0.001;
-				sculptdata->uv[i].uv[1] -= strength*diff[1]*0.001;
+				sculptdata->uv[i].uv[0] -= strength * diff[0] * 0.001;
+				sculptdata->uv[i].uv[1] -= strength * diff[1] * 0.001;
+
+				for (element = sculptdata->uv[i].element; element; element = element->next) {
+					MLoopUV *luv;
+					BMLoop *l;
 
-				for(element = sculptdata->uv[i].element; element; element = element->next){
-					MTFace *mt;
-					if(element->separate && element != sculptdata->uv[i].element)
+					if (element->separate && element != sculptdata->uv[i].element)
 						break;
-					mt = CustomData_em_get(&em->fdata, element->face->data, CD_MTFACE);
-					copy_v2_v2(mt->uv[element->tfindex], sculptdata->uv[i].uv);
+
+					l = element->l;
+					luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+					copy_v2_v2(luv->uv, sculptdata->uv[i].uv);
 				}
 			}
 		}
@@ -353,11 +368,12 @@ static void uv_sculpt_stroke_apply(bContext *C, wmOperator *op, wmEvent *event,
 	/*
 	 * Smooth Tool
 	 */
-	else if(tool == UV_SCULPT_TOOL_RELAX){
+	else if (tool == UV_SCULPT_TOOL_RELAX) {
 		unsigned int method = toolsettings->uv_relax_method;
-		if(method == UV_SCULPT_TOOL_RELAX_HC){
+		if (method == UV_SCULPT_TOOL_RELAX_HC) {
 			HC_relaxation_iteration_uv(em, sculptdata, co, alpha, radius, aspectRatio);
-		}else{
+		}
+		else {
 			laplacian_relaxation_iteration_uv(em, sculptdata, co, alpha, radius, aspectRatio);
 		}
 	}
@@ -365,50 +381,51 @@ static void uv_sculpt_stroke_apply(bContext *C, wmOperator *op, wmEvent *event,
 	/*
 	 * Grab Tool
 	 */
-	else if(tool == UV_SCULPT_TOOL_GRAB){
+	else if (tool == UV_SCULPT_TOOL_GRAB) {
 		int i;
 		float diff[2];
 		sub_v2_v2v2(diff, co, sculptdata->initial_stroke->init_coord);
 
-		for(i = 0; i < sculptdata->initial_stroke->totalInitialSelected; i++ ){
+		for (i = 0; i < sculptdata->initial_stroke->totalInitialSelected; i++) {
 			UvElement *element;
 			int uvindex = sculptdata->initial_stroke->initialSelection[i].uv;
 			float strength = sculptdata->initial_stroke->initialSelection[i].strength;
-			sculptdata->uv[uvindex].uv[0] = sculptdata->initial_stroke->initialSelection[i].initial_uv[0] + strength*diff[0];
-			sculptdata->uv[uvindex].uv[1] = sculptdata->initial_stroke->initialSelection[i].initial_uv[1] + strength*diff[1];
+			sculptdata->uv[uvindex].uv[0] = sculptdata->initial_stroke->initialSelection[i].initial_uv[0] + strength * diff[0];
+			sculptdata->uv[uvindex].uv[1] = sculptdata->initial_stroke->initialSelection[i].initial_uv[1] + strength * diff[1];
+
+			for (element = sculptdata->uv[uvindex].element; element; element = element->next) {
+				MLoopUV *luv;
+				BMLoop *l;
 
-			for(element = sculptdata->uv[uvindex].element; element; element = element->next){
-				MTFace *mt;
-				if(element->separate && element != sculptdata->uv[uvindex].element)
+				if (element->separate && element != sculptdata->uv[uvindex].element)
 					break;
-				mt = CustomData_em_get(&em->fdata, element->face->data, CD_MTFACE);
-				copy_v2_v2(mt->uv[element->tfindex], sculptdata->uv[uvindex].uv);
+
+				l = element->l;
+				luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+				copy_v2_v2(luv->uv, sculptdata->uv[uvindex].uv);
 			}
 		}
 	}
-
-	BKE_mesh_end_editmesh(obedit->data, em);
 }
 
 
 static void uv_sculpt_stroke_exit(bContext *C, wmOperator *op)
 {
 	UvSculptData *data = op->customdata;
-	if(data->timer){
+	if (data->timer) {
 		WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), data->timer);
 	}
-	if(data->elementMap)
-	{
-		EM_free_uv_element_map(data->elementMap);
+	if (data->elementMap) {
+		EDBM_uv_element_map_free(data->elementMap);
 	}
-	if(data->uv){
+	if (data->uv) {
 		MEM_freeN(data->uv);
 	}
-	if(data->uvedges){
+	if (data->uvedges) {
 		MEM_freeN(data->uvedges);
 	}
-	if(data->initial_stroke){
-		if(data->initial_stroke->initialSelection){
+	if (data->initial_stroke) {
+		if (data->initial_stroke->initialSelection) {
 			MEM_freeN(data->initial_stroke->initialSelection);
 		}
 		MEM_freeN(data->initial_stroke);
@@ -418,27 +435,29 @@ static void uv_sculpt_stroke_exit(bContext *C, wmOperator *op)
 	op->customdata = NULL;
 }
 
-static int get_uv_element_offset_from_face(UvElementMap *map, EditFace *efa, int index, int island_index, int doIslands){
-	UvElement *element = ED_get_uv_element(map, efa, index);
-	if(!element || (doIslands && element->island != island_index)){
+static int uv_element_offset_from_face_get(UvElementMap *map, BMFace *efa, BMLoop *l, int island_index, int doIslands)
+{
+	UvElement *element = ED_uv_element_get(map, efa, l);
+	if (!element || (doIslands && element->island != island_index)) {
 		return -1;
 	}
 	return element - map->buf;
 }
 
 
-static unsigned int	uv_edge_hash(const void *key){
+static unsigned int uv_edge_hash(const void *key)
+{
 	UvEdge *edge = (UvEdge *)key;
-	return 
-		BLI_ghashutil_inthash(SET_INT_IN_POINTER(edge->uv2)) +
-		BLI_ghashutil_inthash(SET_INT_IN_POINTER(edge->uv1));
+	return (BLI_ghashutil_inthash(SET_INT_IN_POINTER(edge->uv2)) +
+	        BLI_ghashutil_inthash(SET_INT_IN_POINTER(edge->uv1)));
 }
 
-static int uv_edge_compare(const void *a, const void *b){
+static int uv_edge_compare(const void *a, const void *b)
+{
 	UvEdge *edge1 = (UvEdge *)a;
 	UvEdge *edge2 = (UvEdge *)b;
 
-	if((edge1->uv1 == edge2->uv1) && (edge1->uv2 == edge2->uv2)){
+	if ((edge1->uv1 == edge2->uv1) && (edge1->uv2 == edge2->uv2)) {
 		return 0;
 	}
 	return 1;
@@ -451,44 +470,52 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, wmEvent
 	Object *obedit = CTX_data_edit_object(C);
 	ToolSettings *ts = scene->toolsettings;
 	UvSculptData *data = MEM_callocN(sizeof(*data), "UV Smooth Brush Data");
-	EditMesh *em = BKE_mesh_get_editmesh(obedit->data);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMesh *bm = em->bm;
 
 	op->customdata = data;
 
-	if(data){
+	if (data) {
 		int counter = 0, i;
-		ARegion *ar= CTX_wm_region(C);
+		ARegion *ar = CTX_wm_region(C);
 		float co[2];
-		EditFace *efa;
+		BMFace *efa;
+		MLoopUV *luv;
+		BMLoop *l;
+		BMIter iter, liter;
+
 		UvEdge *edges;
 		GHash *edgeHash;
-		GHashIterator* ghi;
-		MTFace *mt;
+		GHashIterator *ghi;
+
 		int do_island_optimization = !(ts->uv_sculpt_settings & UV_SCULPT_ALL_ISLANDS);
 		int island_index = 0;
 		/* Holds, for each UvElement in elementMap, a pointer to its unique uv.*/
 		int *uniqueUv;
-		data->tool = (RNA_enum_get(op->ptr, "mode") == BRUSH_STROKE_SMOOTH)? UV_SCULPT_TOOL_RELAX : ts->uv_sculpt_tool;
-		data->invert = (RNA_enum_get(op->ptr, "mode") == BRUSH_STROKE_INVERT)? 1 : 0;
+		data->tool = (RNA_enum_get(op->ptr, "mode") == BRUSH_STROKE_SMOOTH) ? UV_SCULPT_TOOL_RELAX : ts->uv_sculpt_tool;
+		data->invert = (RNA_enum_get(op->ptr, "mode") == BRUSH_STROKE_INVERT) ? 1 : 0;
 
 		data->uvsculpt = &ts->uvsculpt->paint;
 
-		if(do_island_optimization){
+		if (do_island_optimization) {
 			/* We will need island information */
-			if(ts->uv_flag & UV_SYNC_SELECTION){
-				data->elementMap = EM_make_uv_element_map(em, 0, 1);
-			}else{
-				data->elementMap = EM_make_uv_element_map(em, 1, 1);
+			if (ts->uv_flag & UV_SYNC_SELECTION) {
+				data->elementMap = EDBM_uv_element_map_create(em, 0, 1);
 			}
-		}else {
-			if(ts->uv_flag & UV_SYNC_SELECTION){
-				data->elementMap = EM_make_uv_element_map(em, 0, 0);
-			}else{
-				data->elementMap = EM_make_uv_element_map(em, 1, 0);
+			else {
+				data->elementMap = EDBM_uv_element_map_create(em, 1, 1);
+			}
+		}
+		else {
+			if (ts->uv_flag & UV_SYNC_SELECTION) {
+				data->elementMap = EDBM_uv_element_map_create(em, 0, 0);
+			}
+			else {
+				data->elementMap = EDBM_uv_element_map_create(em, 1, 0);
 			}
 		}
 
-		if(!data->elementMap){
+		if (!data->elementMap) {
 			uv_sculpt_stroke_exit(C, op);
 			return NULL;
 		}
@@ -497,39 +524,40 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, wmEvent
 		UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
 
 		/* we need to find the active island here */
-		if(do_island_optimization){
+		if (do_island_optimization) {
 			UvElement *element;
 			NearestHit hit;
-			Image *ima= CTX_data_edit_image(C);
+			Image *ima = CTX_data_edit_image(C);
 			uv_find_nearest_vert(scene, ima, em, co, NULL, &hit);
 
-			element = ED_get_uv_element(data->elementMap, hit.efa, hit.uv);
+			element = ED_uv_element_get(data->elementMap, hit.efa, hit.l);
 			island_index = element->island;
 		}
 
 
 		/* Count 'unique' uvs */
-		for(i = 0; i < data->elementMap->totalUVs; i++){
-			if(data->elementMap->buf[i].separate
-			&& (!do_island_optimization || data->elementMap->buf[i].island == island_index)){
+		for (i = 0; i < data->elementMap->totalUVs; i++) {
+			if (data->elementMap->buf[i].separate &&
+			    (!do_island_optimization || data->elementMap->buf[i].island == island_index))
+			{
 				counter++;
 			}
 		}
 
 		/* Allocate the unique uv buffers */
-		data->uv = MEM_mallocN(sizeof(*data->uv)*counter, "uv_brush_unique_uvs");
-		uniqueUv = MEM_mallocN(sizeof(*uniqueUv)*data->elementMap->totalUVs, "uv_brush_unique_uv_map");
+		data->uv = MEM_mallocN(sizeof(*data->uv) * counter, "uv_brush_unique_uvs");
+		uniqueUv = MEM_mallocN(sizeof(*uniqueUv) * data->elementMap->totalUVs, "uv_brush_unique_uv_map");
 		edgeHash = BLI_ghash_new(uv_edge_hash, uv_edge_compare, "uv_brush_edge_hash");
 		/* we have at most totalUVs edges */
-		edges = MEM_mallocN(sizeof(*edges)*data->elementMap->totalUVs, "uv_brush_all_edges");
-		if(!data->uv || !uniqueUv || !edgeHash || !edges){
-			if(edges){
+		edges = MEM_mallocN(sizeof(*edges) * data->elementMap->totalUVs, "uv_brush_all_edges");
+		if (!data->uv || !uniqueUv || !edgeHash || !edges) {
+			if (edges) {
 				MEM_freeN(edges);
 			}
-			if(uniqueUv){
+			if (uniqueUv) {
 				MEM_freeN(uniqueUv);
 			}
-			if(edgeHash){
+			if (edgeHash) {
 				MEM_freeN(edgeHash);
 			}
 			uv_sculpt_stroke_exit(C, op);
@@ -540,38 +568,40 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, wmEvent
 		/* So that we can use this as index for the UvElements */
 		counter = -1;
 		/* initialize the unique UVs */
-		for(i = 0; i < em->totvert; i++){
+		for (i = 0; i < bm->totvert; i++) {
 			UvElement *element = data->elementMap->vert[i];
-			for(; element; element = element->next){
-				if(element->separate){
-					if(do_island_optimization && (element->island != island_index)){
+			for (; element; element = element->next) {
+				if (element->separate) {
+					if (do_island_optimization && (element->island != island_index)) {
 						/* skip this uv if not on the active island */
-						for(; element->next && !(element->next->separate); element = element->next)
+						for (; element->next && !(element->next->separate); element = element->next)
 							;
 						continue;
 					}
-					efa = element->face;
-					mt = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+
+					l = element->l;
+					luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
 
 					counter++;
 					data->uv[counter].element = element;
 					data->uv[counter].flag = 0;
-					data->uv[counter].uv = mt->uv[element->tfindex];
+					data->uv[counter].uv = luv->uv;
 				}
 				/* pointer arithmetic to the rescue, as always :)*/
 				uniqueUv[element - data->elementMap->buf] = counter;
 			}
 		}
 
+
 		/* Now, on to generate our uv connectivity data */
-		for(efa = em->faces.first, counter = 0; efa; efa = efa->next){
-			int nverts = efa->v4 ? 4 : 3;
-			for(i = 0; i < nverts; i++){
-				int offset1, itmp1 = get_uv_element_offset_from_face(data->elementMap, efa, i, island_index, do_island_optimization);
-				int offset2, itmp2 = get_uv_element_offset_from_face(data->elementMap, efa, (i+1)%nverts, island_index, do_island_optimization);
+		counter = 0;
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+				int offset1, itmp1 = uv_element_offset_from_face_get(data->elementMap, efa, l, island_index, do_island_optimization);
+				int offset2, itmp2 = uv_element_offset_from_face_get(data->elementMap, efa, l->next, island_index, do_island_optimization);
 
 				/* Skip edge if not found(unlikely) or not on valid island */
-				if(itmp1 == -1 || itmp2 == -1)
+				if (itmp1 == -1 || itmp2 == -1)
 					continue;
 
 				offset1 = uniqueUv[itmp1];
@@ -580,45 +610,46 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, wmEvent
 				edges[counter].flag = 0;
 				/* using an order policy, sort uvs according to address space. This avoids
 				 * Having two different UvEdges with the same uvs on different positions  */
-				if(offset1 < offset2){
+				if (offset1 < offset2) {
 					edges[counter].uv1 = offset1;
 					edges[counter].uv2 = offset2;
 				}
-				else{
+				else {
 					edges[counter].uv1 = offset2;
 					edges[counter].uv2 = offset1;
 				}
 				/* Hack! Set the value of the key to its flag. Now we can set the flag when an edge exists twice :) */
-				if(BLI_ghash_haskey(edgeHash, &edges[counter])){
+				if (BLI_ghash_haskey(edgeHash, &edges[counter])) {
 					char *flag = BLI_ghash_lookup(edgeHash, &edges[counter]);
 					*flag = 1;
 				}
-				else{
+				else {
 					/* Hack mentioned */
 					BLI_ghash_insert(edgeHash, &edges[counter], &edges[counter].flag);
 				}
 				counter++;
 			}
 		}
+
 		MEM_freeN(uniqueUv);
 
 		/* Allocate connectivity data, we allocate edges once */
-		data->uvedges = MEM_mallocN(sizeof(*data->uvedges)*BLI_ghash_size(edgeHash), "uv_brush_edge_connectivity_data");
-		if(!data->uvedges){
+		data->uvedges = MEM_mallocN(sizeof(*data->uvedges) * BLI_ghash_size(edgeHash), "uv_brush_edge_connectivity_data");
+		if (!data->uvedges) {
 			BLI_ghash_free(edgeHash, NULL, NULL);
 			MEM_freeN(edges);
 			uv_sculpt_stroke_exit(C, op);
 			return NULL;
 		}
 		ghi = BLI_ghashIterator_new(edgeHash);
-		if(!ghi){
+		if (!ghi) {
 			BLI_ghash_free(edgeHash, NULL, NULL);
 			MEM_freeN(edges);
 			uv_sculpt_stroke_exit(C, op);
 			return NULL;
 		}
 		/* fill the edges with data */
-		for(i = 0; !BLI_ghashIterator_isDone(ghi); BLI_ghashIterator_step(ghi)){
+		for (i = 0; !BLI_ghashIterator_isDone(ghi); BLI_ghashIterator_step(ghi)) {
 			data->uvedges[i++] = *((UvEdge *)BLI_ghashIterator_getKey(ghi));
 		}
 		data->totalUvEdges = BLI_ghash_size(edgeHash);
@@ -629,9 +660,9 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, wmEvent
 		MEM_freeN(edges);
 
 		/* transfer boundary edge property to uvs */
-		if(ts->uv_sculpt_settings & UV_SCULPT_LOCK_BORDERS){
-			for(i = 0; i < data->totalUvEdges; i++){
-				if(!data->uvedges[i].flag){
+		if (ts->uv_sculpt_settings & UV_SCULPT_LOCK_BORDERS) {
+			for (i = 0; i < data->totalUvEdges; i++) {
+				if (!data->uvedges[i].flag) {
 					data->uv[data->uvedges[i].uv1].flag |= MARK_BOUNDARY;
 					data->uv[data->uvedges[i].uv2].flag |= MARK_BOUNDARY;
 				}
@@ -639,7 +670,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, wmEvent
 		}
 
 		/* Allocate initial selection for grab tool */
-		if(data->tool){
+		if (data->tool == UV_SCULPT_TOOL_GRAB) {
 			float radius, radius_root;
 			UvSculptData *sculptdata = (UvSculptData *)op->customdata;
 			SpaceImage *sima;
@@ -655,18 +686,18 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, wmEvent
 			ED_space_image_size(sima, &width, &height);
 			ED_space_image_zoom(sima, ar, &zoomx, &zoomy);
 
-			aspectRatio = width/(float)height;
-			radius /= (width*zoomx);
-			radius = radius*radius;
+			aspectRatio = width / (float)height;
+			radius /= (width * zoomx);
+			radius = radius * radius;
 			radius_root = sqrt(radius);
 
 			/* Allocate selection stack */
 			data->initial_stroke = MEM_mallocN(sizeof(*data->initial_stroke), "uv_sculpt_initial_stroke");
-			if(!data->initial_stroke){
+			if (!data->initial_stroke) {
 				uv_sculpt_stroke_exit(C, op);
 			}
-			data->initial_stroke->initialSelection = MEM_mallocN(sizeof(*data->initial_stroke->initialSelection)*data->totalUniqueUvs, "uv_sculpt_initial_selection");
-			if(!data->initial_stroke->initialSelection){
+			data->initial_stroke->initialSelection = MEM_mallocN(sizeof(*data->initial_stroke->initialSelection) * data->totalUniqueUvs, "uv_sculpt_initial_selection");
+			if (!data->initial_stroke->initialSelection) {
 				uv_sculpt_stroke_exit(C, op);
 			}
 
@@ -674,17 +705,17 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, wmEvent
 
 			counter = 0;
 
-			for(i = 0; i < data->totalUniqueUvs; i++){
+			for (i = 0; i < data->totalUniqueUvs; i++) {
 				float dist, diff[2];
-				if(data->uv[i].flag & MARK_BOUNDARY){
+				if (data->uv[i].flag & MARK_BOUNDARY) {
 					continue;
 				}
 
 				sub_v2_v2v2(diff, data->uv[i].uv, co);
 				diff[1] /= aspectRatio;
-				if((dist = dot_v2v2(diff, diff)) <= radius){
+				if ((dist = dot_v2v2(diff, diff)) <= radius) {
 					float strength;
-					strength = alpha*brush_curve_strength(brush, sqrt(dist), radius_root);
+					strength = alpha * brush_curve_strength(brush, sqrt(dist), radius_root);
 
 					data->initial_stroke->initialSelection[counter].uv = i;
 					data->initial_stroke->initialSelection[counter].strength = strength;
@@ -705,15 +736,15 @@ static int uv_sculpt_stroke_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	UvSculptData *data;
 	Object *obedit = CTX_data_edit_object(C);
 
-	if(!(data = uv_sculpt_stroke_init(C, op, event))) {
+	if (!(data = uv_sculpt_stroke_init(C, op, event))) {
 		return OPERATOR_CANCELLED;
 	}
 
 	uv_sculpt_stroke_apply(C, op, event, obedit);
 
-	data->timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.001f);
+	data->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.001f);
 
-	if(!data->timer){
+	if (!data->timer) {
 		uv_sculpt_stroke_exit(C, op);
 		return OPERATOR_CANCELLED;
 	}
@@ -728,7 +759,7 @@ static int uv_sculpt_stroke_modal(bContext *C, wmOperator *op, wmEvent *event)
 	UvSculptData *data = (UvSculptData *)op->customdata;
 	Object *obedit = CTX_data_edit_object(C);
 
-	switch(event->type) {
+	switch (event->type) {
 		case LEFTMOUSE:
 		case MIDDLEMOUSE:
 		case RIGHTMOUSE:
@@ -740,7 +771,7 @@ static int uv_sculpt_stroke_modal(bContext *C, wmOperator *op, wmEvent *event)
 			uv_sculpt_stroke_apply(C, op, event, obedit);
 			break;
 		case TIMER:
-			if(event->customdata == data->timer)
+			if (event->customdata == data->timer)
 				uv_sculpt_stroke_apply(C, op, event, obedit);
 			break;
 		default:
@@ -748,7 +779,7 @@ static int uv_sculpt_stroke_modal(bContext *C, wmOperator *op, wmEvent *event)
 	}
 
 	ED_region_tag_redraw(CTX_wm_region(C));
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 	DAG_id_tag_update(obedit->data, 0);
 	return OPERATOR_RUNNING_MODAL;
 }
@@ -773,7 +804,7 @@ void SCULPT_OT_uv_sculpt_stroke(wmOperatorType *ot)
 	ot->poll = uv_sculpt_poll;
 
 	/* flags */
-	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* props */
 	RNA_def_enum(ot->srna, "mode", stroke_mode_items, BRUSH_STROKE_NORMAL, "Mode", "Stroke Mode");
diff --git a/source/blender/editors/sound/sound_intern.h b/source/blender/editors/sound/sound_intern.h
index 91c1b5d..e8a8ec5 100644
--- a/source/blender/editors/sound/sound_intern.h
+++ b/source/blender/editors/sound/sound_intern.h
@@ -29,10 +29,10 @@
  */
 
 
-#ifndef ED_SOUND_INTERN_H
-#define ED_SOUND_INTERN_H
+#ifndef __SOUND_INTERN_H__
+#define __SOUND_INTERN_H__
 
 struct wmOperatorType;
 
-#endif /* ED_SOUND_INTERN_H */
+#endif /* __SOUND_INTERN_H__ */
 
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index 3f3369a..b50c3f1 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -105,11 +105,11 @@ static int sound_open_exec(bContext *C, wmOperator *op)
 	RNA_string_get(op->ptr, "filepath", path);
 	sound = sound_new_file(bmain, path);
 
-	if(!op->customdata)
+	if (!op->customdata)
 		sound_open_init(C, op);
 
 	if (sound==NULL || sound->playback_handle == NULL) {
-		if(op->customdata) MEM_freeN(op->customdata);
+		if (op->customdata) MEM_freeN(op->customdata);
 		BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
 		return OPERATOR_CANCELLED;
 	}
@@ -118,12 +118,12 @@ static int sound_open_exec(bContext *C, wmOperator *op)
 
 	if (info.specs.channels == AUD_CHANNELS_INVALID) {
 		sound_delete(bmain, sound);
-		if(op->customdata) MEM_freeN(op->customdata);
+		if (op->customdata) MEM_freeN(op->customdata);
 		BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
 		return OPERATOR_CANCELLED;
 	}
 
-	if(RNA_boolean_get(op->ptr, "mono")) {
+	if (RNA_boolean_get(op->ptr, "mono")) {
 		sound->flags |= SOUND_FLAGS_MONO;
 		sound_load(bmain, sound);
 	}
@@ -135,7 +135,7 @@ static int sound_open_exec(bContext *C, wmOperator *op)
 	/* hook into UI */
 	pprop= op->customdata;
 
-	if(pprop->prop) {
+	if (pprop->prop) {
 		/* when creating new ID blocks, use is already 1, but RNA
 		 * pointer se also increases user, so this compensates it */
 		sound->id.us--;
@@ -145,7 +145,7 @@ static int sound_open_exec(bContext *C, wmOperator *op)
 		RNA_property_update(C, &pprop->ptr, pprop->prop);
 	}
 
-	if(op->customdata) MEM_freeN(op->customdata);
+	if (op->customdata) MEM_freeN(op->customdata);
 	return OPERATOR_FINISHED;
 }
 
@@ -162,7 +162,7 @@ static int sound_open_exec(bContext *UNUSED(C), wmOperator *op)
 
 static int sound_open_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	if(RNA_struct_property_is_set(op->ptr, "filepath"))
+	if (RNA_struct_property_is_set(op->ptr, "filepath"))
 		return sound_open_exec(C, op);
 
 	sound_open_init(C, op);
@@ -173,17 +173,17 @@ static int sound_open_invoke(bContext *C, wmOperator *op, wmEvent *event)
 static void SOUND_OT_open(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Open Sound";
-	ot->description= "Load a sound file";
-	ot->idname= "SOUND_OT_open";
+	ot->name = "Open Sound";
+	ot->description = "Load a sound file";
+	ot->idname = "SOUND_OT_open";
 
 	/* api callbacks */
-	ot->exec= sound_open_exec;
-	ot->invoke= sound_open_invoke;
-	ot->cancel= sound_open_cancel;
+	ot->exec = sound_open_exec;
+	ot->invoke = sound_open_invoke;
+	ot->cancel = sound_open_cancel;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
@@ -194,17 +194,17 @@ static void SOUND_OT_open(wmOperatorType *ot)
 static void SOUND_OT_open_mono(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Open Sound Mono";
-	ot->description= "Load a sound file as mono";
-	ot->idname= "SOUND_OT_open_mono";
+	ot->name = "Open Sound Mono";
+	ot->description = "Load a sound file as mono";
+	ot->idname = "SOUND_OT_open_mono";
 
 	/* api callbacks */
-	ot->exec= sound_open_exec;
-	ot->invoke= sound_open_invoke;
-	ot->cancel= sound_open_cancel;
+	ot->exec = sound_open_exec;
+	ot->invoke = sound_open_invoke;
+	ot->cancel = sound_open_cancel;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
@@ -223,19 +223,19 @@ static int sound_update_animation_flags_exec(bContext *C, wmOperator *UNUSED(op)
 
 	SEQ_BEGIN(scene->ed, seq) {
 		fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "volume", 0, &driven);
-		if(fcu || driven)
+		if (fcu || driven)
 			seq->flag |= SEQ_AUDIO_VOLUME_ANIMATED;
 		else
 			seq->flag &= ~SEQ_AUDIO_VOLUME_ANIMATED;
 
 		fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "pitch", 0, &driven);
-		if(fcu || driven)
+		if (fcu || driven)
 			seq->flag |= SEQ_AUDIO_PITCH_ANIMATED;
 		else
 			seq->flag &= ~SEQ_AUDIO_PITCH_ANIMATED;
 
 		fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "pan", 0, &driven);
-		if(fcu || driven)
+		if (fcu || driven)
 			seq->flag |= SEQ_AUDIO_PAN_ANIMATED;
 		else
 			seq->flag &= ~SEQ_AUDIO_PAN_ANIMATED;
@@ -243,7 +243,7 @@ static int sound_update_animation_flags_exec(bContext *C, wmOperator *UNUSED(op)
 	SEQ_END
 
 	fcu = id_data_find_fcurve(&scene->id, scene, &RNA_Scene, "audio_volume", 0, &driven);
-	if(fcu || driven)
+	if (fcu || driven)
 		scene->audio.flag |= AUDIO_VOLUME_ANIMATED;
 	else
 		scene->audio.flag &= ~AUDIO_VOLUME_ANIMATED;
@@ -254,22 +254,22 @@ static int sound_update_animation_flags_exec(bContext *C, wmOperator *UNUSED(op)
 static void SOUND_OT_update_animation_flags(wmOperatorType *ot)
 {
 	/*
-	  This operator is needed to set a correct state of the sound animation
-	  System. Unfortunately there's no really correct place to call the exec
-	  function, that's why I made it an operator that's only visible in the
-	  search menu. Apart from that the bake animation operator calls it too.
-	*/
+	 * This operator is needed to set a correct state of the sound animation
+	 * System. Unfortunately there's no really correct place to call the exec
+	 * function, that's why I made it an operator that's only visible in the
+	 * search menu. Apart from that the bake animation operator calls it too.
+	 */
 
 	/* identifiers */
-	ot->name= "Update animation";
-	ot->description= "Update animation flags";
-	ot->idname= "SOUND_OT_update_animation_flags";
+	ot->name = "Update animation";
+	ot->description = "Update animation flags";
+	ot->idname = "SOUND_OT_update_animation_flags";
 
 	/* api callbacks */
-	ot->exec= sound_update_animation_flags_exec;
+	ot->exec = sound_update_animation_flags_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER;
+	ot->flag = OPTYPE_REGISTER;
 }
 
 /* ******************************************************* */
@@ -283,8 +283,7 @@ static int sound_bake_animation_exec(bContext *C, wmOperator *UNUSED(op))
 
 	sound_update_animation_flags_exec(C, NULL);
 
-	for(cfra = scene->r.sfra > 0 ? scene->r.sfra - 1 : 0; cfra <= scene->r.efra + 1; cfra++)
-	{
+	for (cfra = (scene->r.sfra > 0) ? (scene->r.sfra - 1) : 0; cfra <= scene->r.efra + 1; cfra++) {
 		scene->r.cfra = cfra;
 		scene_update_for_newframe(bmain, scene, scene->lay);
 	}
@@ -298,15 +297,15 @@ static int sound_bake_animation_exec(bContext *C, wmOperator *UNUSED(op))
 static void SOUND_OT_bake_animation(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Update animation cache";
-	ot->description= "Updates the audio animation cache so that it's up to date";
-	ot->idname= "SOUND_OT_bake_animation";
+	ot->name = "Update animation cache";
+	ot->description = "Update the audio animation cache";
+	ot->idname = "SOUND_OT_bake_animation";
 
 	/* api callbacks */
-	ot->exec= sound_bake_animation_exec;
+	ot->exec = sound_bake_animation_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER;
+	ot->flag = OPTYPE_REGISTER;
 }
 
 
@@ -345,8 +344,7 @@ static int sound_mixdown_exec(bContext *C, wmOperator *op)
 	result = AUD_mixdown(scene->sound_scene, SFRA * specs.rate / FPS, (EFRA - SFRA) * specs.rate / FPS,
 						 accuracy, filename, specs, container, codec, bitrate);
 
-	if(result)
-	{
+	if (result) {
 		BKE_report(op->reports, RPT_ERROR, result);
 		return OPERATOR_CANCELLED;
 	}
@@ -359,7 +357,7 @@ static int sound_mixdown_exec(bContext *C, wmOperator *op)
 
 static int sound_mixdown_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	if(RNA_struct_property_is_set(op->ptr, "filepath"))
+	if (RNA_struct_property_is_set(op->ptr, "filepath"))
 		return sound_mixdown_exec(C, op);
 
 	return WM_operator_filesel(C, op, event);
@@ -572,19 +570,19 @@ static void SOUND_OT_mixdown(wmOperatorType *ot)
 #endif // WITH_AUDASPACE
 
 	/* identifiers */
-	ot->name= "Mixdown";
-	ot->description= "Mixes the scene's audio to a sound file";
-	ot->idname= "SOUND_OT_mixdown";
+	ot->name = "Mixdown";
+	ot->description = "Mixes the scene's audio to a sound file";
+	ot->idname = "SOUND_OT_mixdown";
 
 	/* api callbacks */
-	ot->exec= sound_mixdown_exec;
-	ot->invoke= sound_mixdown_invoke;
+	ot->exec = sound_mixdown_exec;
+	ot->invoke = sound_mixdown_invoke;
 
 #ifdef WITH_AUDASPACE
-	ot->ui= sound_mixdown_draw;
+	ot->ui = sound_mixdown_draw;
 #endif
 	/* flags */
-	ot->flag= OPTYPE_REGISTER;
+	ot->flag = OPTYPE_REGISTER;
 
 	/* properties */
 	WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
@@ -603,7 +601,7 @@ static int sound_poll(bContext *C)
 {
 	Editing* ed = CTX_data_scene(C)->ed;
 
-	if(!ed || !ed->act_seq || ed->act_seq->type != SEQ_SOUND)
+	if (!ed || !ed->act_seq || ed->act_seq->type != SEQ_SOUND)
 		return 0;
 
 	return 1;
@@ -616,12 +614,12 @@ static int sound_pack_exec(bContext *C, wmOperator *op)
 	Editing* ed = CTX_data_scene(C)->ed;
 	bSound* sound;
 
-	if(!ed || !ed->act_seq || ed->act_seq->type != SEQ_SOUND)
+	if (!ed || !ed->act_seq || ed->act_seq->type != SEQ_SOUND)
 		return OPERATOR_CANCELLED;
 
 	sound = ed->act_seq->sound;
 
-	if(!sound || sound->packedfile)
+	if (!sound || sound->packedfile)
 		return OPERATOR_CANCELLED;
 
 	sound->packedfile= newPackedFile(op->reports, sound->name, ID_BLEND_PATH(bmain, &sound->id));
@@ -633,16 +631,16 @@ static int sound_pack_exec(bContext *C, wmOperator *op)
 static void SOUND_OT_pack(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Pack Sound";
-	ot->description= "Pack the sound into the current blend file";
-	ot->idname= "SOUND_OT_pack";
+	ot->name = "Pack Sound";
+	ot->description = "Pack the sound into the current blend file";
+	ot->idname = "SOUND_OT_pack";
 
 	/* api callbacks */
-	ot->exec= sound_pack_exec;
-	ot->poll= sound_poll;
+	ot->exec = sound_pack_exec;
+	ot->poll = sound_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************* unpack operator *********************/
@@ -659,10 +657,10 @@ static int sound_unpack_exec(bContext *C, wmOperator *op)
 		sound = BLI_findstring(&CTX_data_main(C)->sound, sndname, offsetof(ID, name) + 2);
 	}
 
-	if(!sound || !sound->packedfile)
+	if (!sound || !sound->packedfile)
 		return OPERATOR_CANCELLED;
 
-	if(G.fileflags & G_AUTOPACK)
+	if (G.fileflags & G_AUTOPACK)
 		BKE_report(op->reports, RPT_WARNING, "AutoPack is enabled, so image will be packed again on file save");
 
 	unpackSound(CTX_data_main(C), op->reports, sound, method);
@@ -675,18 +673,18 @@ static int sound_unpack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
 	Editing* ed = CTX_data_scene(C)->ed;
 	bSound* sound;
 
-	if(RNA_struct_property_is_set(op->ptr, "id"))
+	if (RNA_struct_property_is_set(op->ptr, "id"))
 		return sound_unpack_exec(C, op);
 
-	if(!ed || !ed->act_seq || ed->act_seq->type != SEQ_SOUND)
+	if (!ed || !ed->act_seq || ed->act_seq->type != SEQ_SOUND)
 		return OPERATOR_CANCELLED;
 
 	sound = ed->act_seq->sound;
 
-	if(!sound || !sound->packedfile)
+	if (!sound || !sound->packedfile)
 		return OPERATOR_CANCELLED;
 
-	if(G.fileflags & G_AUTOPACK)
+	if (G.fileflags & G_AUTOPACK)
 		BKE_report(op->reports, RPT_WARNING, "AutoPack is enabled, so image will be packed again on file save");
 
 	unpack_menu(C, "SOUND_OT_unpack", sound->id.name+2, sound->name, "sounds", sound->packedfile);
@@ -697,17 +695,17 @@ static int sound_unpack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
 static void SOUND_OT_unpack(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Unpack Sound";
-	ot->description= "Unpack the sound to the samples filename";
-	ot->idname= "SOUND_OT_unpack";
+	ot->name = "Unpack Sound";
+	ot->description = "Unpack the sound to the samples filename";
+	ot->idname = "SOUND_OT_unpack";
 
 	/* api callbacks */
-	ot->exec= sound_unpack_exec;
-	ot->invoke= sound_unpack_invoke;
-	ot->poll= sound_poll;
+	ot->exec = sound_unpack_exec;
+	ot->invoke = sound_unpack_invoke;
+	ot->poll = sound_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "method", unpack_method_items, PF_USE_LOCAL, "Method", "How to unpack");
diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c
index 309b455..024a9ff 100644
--- a/source/blender/editors/space_action/action_draw.c
+++ b/source/blender/editors/space_action/action_draw.c
@@ -93,7 +93,7 @@ void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar)
 		/* don't use totrect set, as the width stays the same 
 		 * (NOTE: this is ok here, the configuration is pretty straightforward) 
 		 */
-		v2d->tot.ymin= (float)(-height);
+		v2d->tot.ymin = (float)(-height);
 	}
 	/* 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);
@@ -209,7 +209,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
 	/* don't use totrect set, as the width stays the same 
 	 * (NOTE: this is ok here, the configuration is pretty straightforward) 
 	 */
-	v2d->tot.ymin= (float)(-height);
+	v2d->tot.ymin = (float)(-height);
 	
 	/* first backdrop strips */
 	y= (float)(-ACHANNEL_HEIGHT);
@@ -300,7 +300,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
 	
 	/* Draw keyframes 
 	 *	1) Only channels that are visible in the Action Editor get drawn/evaluated.
-	 *	   This is to try to optimise this for heavier data sets
+	 *	   This is to try to optimize this for heavier data sets
 	 *	2) Keyframes which are out of view horizontally are disregarded 
 	 */
 	y= (float)(-ACHANNEL_HEIGHT);
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index a044651..b8c310f 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -124,17 +124,17 @@ static int act_new_exec(bContext *C, wmOperator *UNUSED(op))
 void ACTION_OT_new (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "New Action";
-	ot->idname= "ACTION_OT_new";
-	ot->description= "Create new action";
+	ot->name = "New Action";
+	ot->idname = "ACTION_OT_new";
+	ot->description = "Create new action";
 	
 	/* api callbacks */
-	ot->exec= act_new_exec;
+	ot->exec = act_new_exec;
 		// NOTE: this is used in the NLA too...
-	//ot->poll= ED_operator_action_active;
+	//ot->poll = ED_operator_action_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ************************************************************************** */
@@ -207,16 +207,16 @@ static int act_markers_make_local_exec (bContext *C, wmOperator *UNUSED(op))
 void ACTION_OT_markers_make_local (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Make Markers Local";
-	ot->idname= "ACTION_OT_markers_make_local";
-	ot->description= "Move selected scene markers to the active Action as local 'pose' markers";
+	ot->name = "Make Markers Local";
+	ot->idname = "ACTION_OT_markers_make_local";
+	ot->description = "Move selected scene markers to the active Action as local 'pose' markers";
 	
 	/* callbacks */
 	ot->exec = act_markers_make_local_exec;
 	ot->poll = act_markers_make_local_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ************************************************************************** */
@@ -322,16 +322,16 @@ static int actkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
 void ACTION_OT_previewrange_set (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Auto-Set Preview Range";
-	ot->idname= "ACTION_OT_previewrange_set";
-	ot->description= "Set Preview Range based on extents of selected Keyframes";
+	ot->name = "Auto-Set Preview Range";
+	ot->idname = "ACTION_OT_previewrange_set";
+	ot->description = "Set Preview Range based on extents of selected Keyframes";
 	
 	/* api callbacks */
-	ot->exec= actkeys_previewrange_exec;
-	ot->poll= ED_operator_action_active;
+	ot->exec = actkeys_previewrange_exec;
+	ot->poll = ED_operator_action_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ****************** View-All Operator ****************** */
@@ -355,8 +355,8 @@ static int actkeys_viewall(bContext *C, const short onlySel)
 	v2d->cur.xmax += extra;
 	
 	/* set vertical range */
-	v2d->cur.ymax= 0.0f;
-	v2d->cur.ymin= (float)-(v2d->mask.ymax - v2d->mask.ymin);
+	v2d->cur.ymax = 0.0f;
+	v2d->cur.ymin = (float)-(v2d->mask.ymax - v2d->mask.ymin);
 	
 	/* do View2D syncing */
 	UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
@@ -384,31 +384,31 @@ static int actkeys_viewsel_exec(bContext *C, wmOperator *UNUSED(op))
 void ACTION_OT_view_all (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View All";
-	ot->idname= "ACTION_OT_view_all";
-	ot->description= "Reset viewable area to show full keyframe range";
+	ot->name = "View All";
+	ot->idname = "ACTION_OT_view_all";
+	ot->description = "Reset viewable area to show full keyframe range";
 	
 	/* api callbacks */
-	ot->exec= actkeys_viewall_exec;
-	ot->poll= ED_operator_action_active;
+	ot->exec = actkeys_viewall_exec;
+	ot->poll = ED_operator_action_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 void ACTION_OT_view_selected (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View Selected";
-	ot->idname= "ACTION_OT_view_selected";
-	ot->description= "Reset viewable area to show selected keyframes range";
+	ot->name = "View Selected";
+	ot->idname = "ACTION_OT_view_selected";
+	ot->description = "Reset viewable area to show selected keyframes range";
 	
 	/* api callbacks */
-	ot->exec= actkeys_viewsel_exec;
-	ot->poll= ED_operator_action_active;
+	ot->exec = actkeys_viewsel_exec;
+	ot->poll = ED_operator_action_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ************************************************************************** */
@@ -487,16 +487,16 @@ static int actkeys_copy_exec(bContext *C, wmOperator *op)
 void ACTION_OT_copy (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Copy Keyframes";
-	ot->idname= "ACTION_OT_copy";
-	ot->description= "Copy selected keyframes to the copy/paste buffer";
+	ot->name = "Copy Keyframes";
+	ot->idname = "ACTION_OT_copy";
+	ot->description = "Copy selected keyframes to the copy/paste buffer";
 	
 	/* api callbacks */
-	ot->exec= actkeys_copy_exec;
-	ot->poll= ED_operator_action_active;
+	ot->exec = actkeys_copy_exec;
+	ot->poll = ED_operator_action_active;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int actkeys_paste_exec(bContext *C, wmOperator *op)
@@ -538,17 +538,17 @@ static int actkeys_paste_exec(bContext *C, wmOperator *op)
 void ACTION_OT_paste (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Paste Keyframes";
-	ot->idname= "ACTION_OT_paste";
-	ot->description= "Paste keyframes from copy/paste buffer for the selected channels, starting on the current frame";
+	ot->name = "Paste Keyframes";
+	ot->idname = "ACTION_OT_paste";
+	ot->description = "Paste keyframes from copy/paste buffer for the selected channels, starting on the current frame";
 	
 	/* api callbacks */
-//	ot->invoke= WM_operator_props_popup; // better wait for action redo panel
-	ot->exec= actkeys_paste_exec;
-	ot->poll= ED_operator_action_active;
+//	ot->invoke = WM_operator_props_popup; // better wait for action redo panel
+	ot->exec = actkeys_paste_exec;
+	ot->poll = ED_operator_action_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* props */
 	RNA_def_enum(ot->srna, "offset", keyframe_paste_offset_items, KEYFRAME_PASTE_OFFSET_CFRA_START, "Offset", "Paste time offset of keys");
@@ -639,20 +639,20 @@ static int actkeys_insertkey_exec(bContext *C, wmOperator *op)
 void ACTION_OT_keyframe_insert (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Insert Keyframes";
-	ot->idname= "ACTION_OT_keyframe_insert";
-	ot->description= "Insert keyframes for the specified channels";
+	ot->name = "Insert Keyframes";
+	ot->idname = "ACTION_OT_keyframe_insert";
+	ot->description = "Insert keyframes for the specified channels";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= actkeys_insertkey_exec;
-	ot->poll= ED_operator_action_active;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = actkeys_insertkey_exec;
+	ot->poll = ED_operator_action_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* id-props */
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_actkeys_insertkey_types, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_actkeys_insertkey_types, 0, "Type", "");
 }
 
 /* ******************** Duplicate Keyframes Operator ************************* */
@@ -715,17 +715,17 @@ static int actkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED
 void ACTION_OT_duplicate (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Duplicate Keyframes";
-	ot->idname= "ACTION_OT_duplicate";
-	ot->description= "Make a copy of all selected keyframes";
+	ot->name = "Duplicate Keyframes";
+	ot->idname = "ACTION_OT_duplicate";
+	ot->description = "Make a copy of all selected keyframes";
 	
 	/* api callbacks */
-	ot->invoke= actkeys_duplicate_invoke;
-	ot->exec= actkeys_duplicate_exec;
-	ot->poll= ED_operator_action_active;
+	ot->invoke = actkeys_duplicate_invoke;
+	ot->exec = actkeys_duplicate_exec;
+	ot->poll = ED_operator_action_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ******************** Delete Keyframes Operator ************************* */
@@ -790,17 +790,17 @@ static int actkeys_delete_exec(bContext *C, wmOperator *UNUSED(op))
 void ACTION_OT_delete (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete Keyframes";
-	ot->idname= "ACTION_OT_delete";
-	ot->description= "Remove all selected keyframes";
+	ot->name = "Delete Keyframes";
+	ot->idname = "ACTION_OT_delete";
+	ot->description = "Remove all selected keyframes";
 	
 	/* api callbacks */
-	ot->invoke= WM_operator_confirm;
-	ot->exec= actkeys_delete_exec;
-	ot->poll= ED_operator_action_active;
+	ot->invoke = WM_operator_confirm;
+	ot->exec = actkeys_delete_exec;
+	ot->poll = ED_operator_action_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ******************** Clean Keyframes Operator ************************* */
@@ -854,20 +854,20 @@ static int actkeys_clean_exec(bContext *C, wmOperator *op)
 void ACTION_OT_clean (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clean Keyframes";
-	ot->idname= "ACTION_OT_clean";
-	ot->description= "Simplify F-Curves by removing closely spaced keyframes";
+	ot->name = "Clean Keyframes";
+	ot->idname = "ACTION_OT_clean";
+	ot->description = "Simplify F-Curves by removing closely spaced keyframes";
 	
 	/* api callbacks */
-	//ot->invoke=  // XXX we need that number popup for this! 
-	ot->exec= actkeys_clean_exec;
-	ot->poll= ED_operator_action_active;
+	//ot->invoke =  // XXX we need that number popup for this! 
+	ot->exec = actkeys_clean_exec;
+	ot->poll = ED_operator_action_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
-	ot->prop= RNA_def_float(ot->srna, "threshold", 0.001f, 0.0f, FLT_MAX, "Threshold", "", 0.0f, 1000.0f);
+	ot->prop = RNA_def_float(ot->srna, "threshold", 0.001f, 0.0f, FLT_MAX, "Threshold", "", 0.0f, 1000.0f);
 }
 
 /* ******************** Sample Keyframes Operator *********************** */
@@ -918,16 +918,16 @@ static int actkeys_sample_exec(bContext *C, wmOperator *UNUSED(op))
 void ACTION_OT_sample (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Sample Keyframes";
-	ot->idname= "ACTION_OT_sample";
-	ot->description= "Add keyframes on every frame between the selected keyframes";
+	ot->name = "Sample Keyframes";
+	ot->idname = "ACTION_OT_sample";
+	ot->description = "Add keyframes on every frame between the selected keyframes";
 	
 	/* api callbacks */
-	ot->exec= actkeys_sample_exec;
-	ot->poll= ED_operator_action_active;
+	ot->exec = actkeys_sample_exec;
+	ot->poll = ED_operator_action_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ************************************************************************** */
@@ -1028,20 +1028,20 @@ static int actkeys_expo_exec(bContext *C, wmOperator *op)
 void ACTION_OT_extrapolation_type (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Keyframe Extrapolation";
-	ot->idname= "ACTION_OT_extrapolation_type";
-	ot->description= "Set extrapolation mode for selected F-Curves";
+	ot->name = "Set Keyframe Extrapolation";
+	ot->idname = "ACTION_OT_extrapolation_type";
+	ot->description = "Set extrapolation mode for selected F-Curves";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= actkeys_expo_exec;
-	ot->poll= ED_operator_action_active;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = actkeys_expo_exec;
+	ot->poll = ED_operator_action_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* id-props */
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_actkeys_expo_types, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_actkeys_expo_types, 0, "Type", "");
 }
 
 /* ******************** Set Interpolation-Type Operator *********************** */
@@ -1099,20 +1099,20 @@ static int actkeys_ipo_exec(bContext *C, wmOperator *op)
 void ACTION_OT_interpolation_type (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Keyframe Interpolation";
-	ot->idname= "ACTION_OT_interpolation_type";
-	ot->description= "Set interpolation mode for the F-Curve segments starting from the selected keyframes";
+	ot->name = "Set Keyframe Interpolation";
+	ot->idname = "ACTION_OT_interpolation_type";
+	ot->description = "Set interpolation mode for the F-Curve segments starting from the selected keyframes";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= actkeys_ipo_exec;
-	ot->poll= ED_operator_action_active;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = actkeys_ipo_exec;
+	ot->poll = ED_operator_action_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* id-props */
-	ot->prop= RNA_def_enum(ot->srna, "type", beztriple_interpolation_mode_items, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", beztriple_interpolation_mode_items, 0, "Type", "");
 }
 
 /* ******************** Set Handle-Type Operator *********************** */
@@ -1179,20 +1179,20 @@ static int actkeys_handletype_exec(bContext *C, wmOperator *op)
 void ACTION_OT_handle_type (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Keyframe Handle Type";
-	ot->idname= "ACTION_OT_handle_type";
-	ot->description= "Set type of handle for selected keyframes";
+	ot->name = "Set Keyframe Handle Type";
+	ot->idname = "ACTION_OT_handle_type";
+	ot->description = "Set type of handle for selected keyframes";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= actkeys_handletype_exec;
-	ot->poll= ED_operator_action_active;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = actkeys_handletype_exec;
+	ot->poll = ED_operator_action_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* id-props */
-	ot->prop= RNA_def_enum(ot->srna, "type", keyframe_handle_type_items, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", keyframe_handle_type_items, 0, "Type", "");
 }
 
 /* ******************** Set Keyframe-Type Operator *********************** */
@@ -1250,20 +1250,20 @@ static int actkeys_keytype_exec(bContext *C, wmOperator *op)
 void ACTION_OT_keyframe_type (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Keyframe Type";
-	ot->idname= "ACTION_OT_keyframe_type";
-	ot->description= "Set type of keyframe for the selected keyframes";
+	ot->name = "Set Keyframe Type";
+	ot->idname = "ACTION_OT_keyframe_type";
+	ot->description = "Set type of keyframe for the selected keyframes";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= actkeys_keytype_exec;
-	ot->poll= ED_operator_action_active;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = actkeys_keytype_exec;
+	ot->poll = ED_operator_action_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* id-props */
-	ot->prop= RNA_def_enum(ot->srna, "type", beztriple_keyframe_type_items, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", beztriple_keyframe_type_items, 0, "Type", "");
 }
 
 /* ************************************************************************** */
@@ -1318,16 +1318,16 @@ static int actkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
 void ACTION_OT_frame_jump (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Jump to Frame";
-	ot->idname= "ACTION_OT_frame_jump";
-	ot->description= "Set the current frame to the average frame of the selected keyframes";
+	ot->name = "Jump to Frame";
+	ot->idname = "ACTION_OT_frame_jump";
+	ot->description = "Set the current frame to the average frame of the selected keyframes";
 	
 	/* api callbacks */
-	ot->exec= actkeys_framejump_exec;
-	ot->poll= ED_operator_action_active;
+	ot->exec = actkeys_framejump_exec;
+	ot->poll = ED_operator_action_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ******************** Snap Keyframes Operator *********************** */
@@ -1418,20 +1418,20 @@ static int actkeys_snap_exec(bContext *C, wmOperator *op)
 void ACTION_OT_snap (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Snap Keys";
-	ot->idname= "ACTION_OT_snap";
-	ot->description= "Snap selected keyframes to the times specified";
+	ot->name = "Snap Keys";
+	ot->idname = "ACTION_OT_snap";
+	ot->description = "Snap selected keyframes to the times specified";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= actkeys_snap_exec;
-	ot->poll= ED_operator_action_active;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = actkeys_snap_exec;
+	ot->poll = ED_operator_action_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* id-props */
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_actkeys_snap_types, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_actkeys_snap_types, 0, "Type", "");
 }
 
 /* ******************** Mirror Keyframes Operator *********************** */
@@ -1532,20 +1532,20 @@ static int actkeys_mirror_exec(bContext *C, wmOperator *op)
 void ACTION_OT_mirror (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Mirror Keys";
-	ot->idname= "ACTION_OT_mirror";
-	ot->description= "Flip selected keyframes over the selected mirror line";
+	ot->name = "Mirror Keys";
+	ot->idname = "ACTION_OT_mirror";
+	ot->description = "Flip selected keyframes over the selected mirror line";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= actkeys_mirror_exec;
-	ot->poll= ED_operator_action_active;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = actkeys_mirror_exec;
+	ot->poll = ED_operator_action_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* id-props */
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_actkeys_mirror_types, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_actkeys_mirror_types, 0, "Type", "");
 }
 
 /* ************************************************************************** */
diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h
index 2a23f10..7074a10 100644
--- a/source/blender/editors/space_action/action_intern.h
+++ b/source/blender/editors/space_action/action_intern.h
@@ -28,8 +28,8 @@
  *  \ingroup spaction
  */
 
-#ifndef ED_ACTION_INTERN_H
-#define ED_ACTION_INTERN_H
+#ifndef __ACTION_INTERN_H__
+#define __ACTION_INTERN_H__
 
 struct bContext;
 struct bAnimContext;
@@ -47,12 +47,6 @@ struct bAnimListElem;
 void draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct ARegion *ar); 
 void draw_channel_strips(struct bAnimContext *ac, struct SpaceAction *saction, struct ARegion *ar);
 
-struct ActKeysInc *init_aki_data(struct bAnimContext *ac, struct bAnimListElem *ale);
-
-/* ***************************************** */
-/* action_header.c */
-void action_header_buttons(const struct bContext *C, struct ARegion *ar);
-
 /* ***************************************** */
 /* action_select.c */
 
@@ -135,5 +129,5 @@ enum {
 void action_operatortypes(void);
 void action_keymap(struct wmKeyConfig *keyconf);
 
-#endif /* ED_ACTION_INTERN_H */
+#endif /* __ACTION_INTERN_H__ */
 
diff --git a/source/blender/editors/space_action/action_ops.c b/source/blender/editors/space_action/action_ops.c
index d4e44de..f502a97 100644
--- a/source/blender/editors/space_action/action_ops.c
+++ b/source/blender/editors/space_action/action_ops.c
@@ -93,11 +93,11 @@ void ED_operatormacros_action(void)
 	wmOperatorType *ot;
 	wmOperatorTypeMacro *otmacro;
 	
-	ot= WM_operatortype_append_macro("ACTION_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
+	ot = WM_operatortype_append_macro("ACTION_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
 	if (ot) {
-		ot->description= "Make a copy of all selected keyframes and move them";
+		ot->description = "Make a copy of all selected keyframes and move them";
 		WM_operatortype_macro_define(ot, "ACTION_OT_duplicate");
-		otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform");
+		otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform");
 		RNA_enum_set(otmacro->ptr, "mode", TFM_TIME_DUPLICATE);
 	}
 	
@@ -114,13 +114,13 @@ static void action_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap)
 	kmi = WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, 0, 0);
 		RNA_boolean_set(kmi->ptr, "extend", FALSE);
 		RNA_boolean_set(kmi->ptr, "column", FALSE);
-	kmi= WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
+	kmi = WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
 		RNA_boolean_set(kmi->ptr, "extend", FALSE);
 		RNA_boolean_set(kmi->ptr, "column", TRUE);
-	kmi= WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
 		RNA_boolean_set(kmi->ptr, "extend", TRUE);
 		RNA_boolean_set(kmi->ptr, "column", FALSE);
-	kmi= WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT|KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "ACTION_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT|KM_SHIFT, 0);
 		RNA_boolean_set(kmi->ptr, "extend", TRUE);
 		RNA_boolean_set(kmi->ptr, "column", TRUE);
 		
@@ -128,14 +128,14 @@ static void action_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap)
 	kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
 		RNA_boolean_set(kmi->ptr, "extend", FALSE);
 		RNA_enum_set(kmi->ptr, "mode", ACTKEYS_LRSEL_TEST);
-	kmi= WM_keymap_add_item(keymap, "ACTION_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
 		RNA_boolean_set(kmi->ptr, "extend", TRUE);
 		RNA_enum_set(kmi->ptr, "mode", ACTKEYS_LRSEL_TEST);
 	
-	kmi= WM_keymap_add_item(keymap, "ACTION_OT_select_leftright", LEFTBRACKETKEY, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_leftright", LEFTBRACKETKEY, KM_PRESS, 0, 0);
 		RNA_boolean_set(kmi->ptr, "extend", FALSE);
 		RNA_enum_set(kmi->ptr, "mode", ACTKEYS_LRSEL_LEFT);
-	kmi= WM_keymap_add_item(keymap, "ACTION_OT_select_leftright", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "ACTION_OT_select_leftright", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
 		RNA_boolean_set(kmi->ptr, "extend", FALSE);
 		RNA_enum_set(kmi->ptr, "mode", ACTKEYS_LRSEL_RIGHT);
 	
@@ -225,7 +225,7 @@ void action_keymap(wmKeyConfig *keyconf)
 	 */
 	
 	/* keyframes */
-	keymap= WM_keymap_find(keyconf, "Dopesheet", SPACE_ACTION, 0);
+	keymap = WM_keymap_find(keyconf, "Dopesheet", SPACE_ACTION, 0);
 	action_keymap_keyframes(keyconf, keymap);
 }
 
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index 414999b..f76f5f6 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -146,7 +146,7 @@ static int actkeys_deselectall_exec(bContext *C, wmOperator *op)
 	if (ANIM_animdata_get_context(C, &ac) == 0)
 		return OPERATOR_CANCELLED;
 		
-	/* 'standard' behaviour - check if selected, then apply relevant selection */
+	/* 'standard' behavior - check if selected, then apply relevant selection */
 	if (RNA_boolean_get(op->ptr, "invert"))
 		deselect_action_keys(&ac, 0, SELECT_INVERT);
 	else
@@ -161,19 +161,19 @@ static int actkeys_deselectall_exec(bContext *C, wmOperator *op)
 void ACTION_OT_select_all_toggle (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select All";
-	ot->idname= "ACTION_OT_select_all_toggle";
-	ot->description= "Toggle selection of all keyframes";
+	ot->name = "Select All";
+	ot->idname = "ACTION_OT_select_all_toggle";
+	ot->description = "Toggle selection of all keyframes";
 	
 	/* api callbacks */
-	ot->exec= actkeys_deselectall_exec;
-	ot->poll= ED_operator_action_active;
+	ot->exec = actkeys_deselectall_exec;
+	ot->poll = ED_operator_action_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* props */
-	ot->prop= RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
+	ot->prop = RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
 }
 
 /* ******************** Border Select Operator **************************** */
@@ -281,10 +281,10 @@ static int actkeys_borderselect_exec(bContext *C, wmOperator *op)
 		deselect_action_keys(&ac, 1, SELECT_SUBTRACT);
 	
 	/* get settings from operator */
-	rect.xmin= RNA_int_get(op->ptr, "xmin");
-	rect.ymin= RNA_int_get(op->ptr, "ymin");
-	rect.xmax= RNA_int_get(op->ptr, "xmax");
-	rect.ymax= RNA_int_get(op->ptr, "ymax");
+	rect.xmin = RNA_int_get(op->ptr, "xmin");
+	rect.ymin = RNA_int_get(op->ptr, "ymin");
+	rect.xmax = RNA_int_get(op->ptr, "xmax");
+	rect.ymax = RNA_int_get(op->ptr, "ymax");
 		
 	gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
 	if (gesture_mode == GESTURE_MODAL_SELECT)
@@ -296,7 +296,7 @@ static int actkeys_borderselect_exec(bContext *C, wmOperator *op)
 	if (RNA_boolean_get(op->ptr, "axis_range")) {
 		/* mode depends on which axis of the range is larger to determine which axis to use 
 		 *	- checking this in region-space is fine, as it's fundamentally still going to be a different rect size
-		 *	- the frame-range select option is favoured over the channel one (x over y), as frame-range one is often
+		 *	- the frame-range select option is favored over the channel one (x over y), as frame-range one is often
 		 *	  used for tweaking timing when "blocking", while channels is not that useful...
 		 */
 		if ((rect.xmax - rect.xmin) >= (rect.ymax - rect.ymin))
@@ -319,25 +319,25 @@ static int actkeys_borderselect_exec(bContext *C, wmOperator *op)
 void ACTION_OT_select_border(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Border Select";
-	ot->idname= "ACTION_OT_select_border";
-	ot->description= "Select all keyframes within the specified region";
+	ot->name = "Border Select";
+	ot->idname = "ACTION_OT_select_border";
+	ot->description = "Select all keyframes within the specified region";
 	
 	/* api callbacks */
-	ot->invoke= WM_border_select_invoke;
-	ot->exec= actkeys_borderselect_exec;
-	ot->modal= WM_border_select_modal;
-	ot->cancel= WM_border_select_cancel;
+	ot->invoke = WM_border_select_invoke;
+	ot->exec = actkeys_borderselect_exec;
+	ot->modal = WM_border_select_modal;
+	ot->cancel = WM_border_select_cancel;
 	
-	ot->poll= ED_operator_action_active;
+	ot->poll = ED_operator_action_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* rna */
 	WM_operator_properties_gesture_border(ot, TRUE);
 	
-	ot->prop= RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
+	ot->prop = RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
 }
 
 /* ******************** Column Select Operator **************************** */
@@ -422,7 +422,7 @@ static void columnselect_action_keys (bAnimContext *ac, short mode)
 	KeyframeEditFunc select_cb, ok_cb;
 	KeyframeEditData ked= {{NULL}};
 	
-	/* initialise keyframe editing data */
+	/* initialize keyframe editing data */
 	
 	/* build list of columns */
 	switch (mode) {
@@ -527,19 +527,19 @@ static int actkeys_columnselect_exec(bContext *C, wmOperator *op)
 void ACTION_OT_select_column (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select All";
-	ot->idname= "ACTION_OT_select_column";
-	ot->description= "Select all keyframes on the specified frame(s)";
+	ot->name = "Select All";
+	ot->idname = "ACTION_OT_select_column";
+	ot->description = "Select all keyframes on the specified frame(s)";
 	
 	/* api callbacks */
-	ot->exec= actkeys_columnselect_exec;
-	ot->poll= ED_operator_action_active;
+	ot->exec = actkeys_columnselect_exec;
+	ot->poll = ED_operator_action_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* props */
-	ot->prop= RNA_def_enum(ot->srna, "mode", prop_column_select_types, 0, "Mode", "");
+	ot->prop = RNA_def_enum(ot->srna, "mode", prop_column_select_types, 0, "Mode", "");
 }
 
 /* ******************** Select Linked Operator *********************** */
@@ -586,15 +586,15 @@ void ACTION_OT_select_linked (wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name = "Select Linked";
-	ot->idname= "ACTION_OT_select_linked";
+	ot->idname = "ACTION_OT_select_linked";
 	ot->description = "Select keyframes occurring in the same F-Curves as selected ones";
 	
 	/* api callbacks */
-	ot->exec= actkeys_select_linked_exec;
-	ot->poll= ED_operator_action_active;
+	ot->exec = actkeys_select_linked_exec;
+	ot->poll = ED_operator_action_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+	ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
 }
 
 /* ******************** Select More/Less Operators *********************** */
@@ -663,15 +663,15 @@ void ACTION_OT_select_more (wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name = "Select More";
-	ot->idname= "ACTION_OT_select_more";
+	ot->idname = "ACTION_OT_select_more";
 	ot->description = "Select keyframes beside already selected ones";
 	
 	/* api callbacks */
-	ot->exec= actkeys_select_more_exec;
-	ot->poll= ED_operator_action_active;
+	ot->exec = actkeys_select_more_exec;
+	ot->poll = ED_operator_action_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+	ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
 }
 
 /* ----------------- */
@@ -697,15 +697,15 @@ void ACTION_OT_select_less (wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name = "Select Less";
-	ot->idname= "ACTION_OT_select_less";
+	ot->idname = "ACTION_OT_select_less";
 	ot->description = "Deselect keyframes on ends of selection islands";
 	
 	/* api callbacks */
-	ot->exec= actkeys_select_less_exec;
-	ot->poll= ED_operator_action_active;
+	ot->exec = actkeys_select_less_exec;
+	ot->poll = ED_operator_action_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+	ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
 }
 
 /* ******************** Select Left/Right Operator ************************* */
@@ -785,7 +785,7 @@ static void actkeys_select_leftright (bAnimContext *ac, short leftright, short s
 			TimeMarker *marker;
 			
 			for (marker= markers->first; marker; marker= marker->next) {
-				if(	((leftright == ACTKEYS_LRSEL_LEFT) && (marker->frame < CFRA)) ||
+				if (	((leftright == ACTKEYS_LRSEL_LEFT) && (marker->frame < CFRA)) ||
 					((leftright == ACTKEYS_LRSEL_RIGHT) && (marker->frame >= CFRA)) ) 
 				{
 					marker->flag |= SELECT;
@@ -863,20 +863,20 @@ static int actkeys_select_leftright_invoke (bContext *C, wmOperator *op, wmEvent
 void ACTION_OT_select_leftright (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Left/Right";
-	ot->idname= "ACTION_OT_select_leftright";
-	ot->description= "Select keyframes to the left or the right of the current frame";
+	ot->name = "Select Left/Right";
+	ot->idname = "ACTION_OT_select_leftright";
+	ot->description = "Select keyframes to the left or the right of the current frame";
 	
 	/* api callbacks  */
-	ot->invoke= actkeys_select_leftright_invoke;
-	ot->exec= actkeys_select_leftright_exec;
-	ot->poll= ED_operator_action_active;
+	ot->invoke = actkeys_select_leftright_invoke;
+	ot->exec = actkeys_select_leftright_exec;
+	ot->poll = ED_operator_action_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* id-props */
-	ot->prop= RNA_def_enum(ot->srna, "mode", prop_actkeys_leftright_select_types, ACTKEYS_LRSEL_TEST, "Mode", "");
+	ot->prop = RNA_def_enum(ot->srna, "mode", prop_actkeys_leftright_select_types, ACTKEYS_LRSEL_TEST, "Mode", "");
 	RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", "");
 }
 
@@ -997,7 +997,7 @@ static void mouse_action_keys (bAnimContext *ac, const int mval[2], short select
 	ale= BLI_findlink(&anim_data, channel_index);
 	if (ale == NULL) {
 		/* channel not found */
-		printf("Error: animation channel (index = %d) not found in mouse_action_keys() \n", channel_index);
+		printf("Error: animation channel (index = %d) not found in mouse_action_keys()\n", channel_index);
 		BLI_freelistN(&anim_data);
 		return;
 	}
@@ -1177,16 +1177,16 @@ static int actkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
 void ACTION_OT_clickselect (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Mouse Select Keys";
-	ot->idname= "ACTION_OT_clickselect";
-	ot->description= "Select keyframes by clicking on them";
+	ot->name = "Mouse Select Keys";
+	ot->idname = "ACTION_OT_clickselect";
+	ot->description = "Select keyframes by clicking on them";
 	
 	/* api callbacks - absolutely no exec() this yet... */
-	ot->invoke= actkeys_clickselect_invoke;
-	ot->poll= ED_operator_action_active;
+	ot->invoke = actkeys_clickselect_invoke;
+	ot->poll = ED_operator_action_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* id-props */
 	RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", ""); // SHIFTKEY
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index 4baaa46..9d0dab7 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -101,10 +101,10 @@ static SpaceLink *action_new(const bContext *C)
 	BLI_addtail(&saction->regionbase, ar);
 	ar->regiontype= RGN_TYPE_WINDOW;
 	
-	ar->v2d.tot.xmin= -10.0f;
-	ar->v2d.tot.ymin= (float)(-sa->winy)/3.0f;
-	ar->v2d.tot.xmax= (float)(sa->winx);
-	ar->v2d.tot.ymax= 0.0f;
+	ar->v2d.tot.xmin = -10.0f;
+	ar->v2d.tot.ymin = (float)(-sa->winy)/3.0f;
+	ar->v2d.tot.xmax = (float)(sa->winx);
+	ar->v2d.tot.ymax = 0.0f;
 	
 	ar->v2d.cur = ar->v2d.tot;
 	
@@ -160,7 +160,7 @@ static void action_main_area_init(wmWindowManager *wm, ARegion *ar)
 	UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
 	
 	/* own keymap */
-	keymap= WM_keymap_find(wm->defaultconf, "Dopesheet", SPACE_ACTION, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Dopesheet", SPACE_ACTION, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
@@ -223,7 +223,7 @@ static void action_channel_area_init(wmWindowManager *wm, ARegion *ar)
 	UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
 	
 	/* own keymap */
-	keymap= WM_keymap_find(wm->defaultconf, "Animation Channels", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Animation Channels", 0, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
@@ -289,17 +289,17 @@ static void action_channel_area_listener(ARegion *ar, wmNotifier *wmn)
 					ED_region_tag_redraw(ar);
 					break;
 				case ND_MODIFIER:
-					if(wmn->action == NA_RENAME)
+					if (wmn->action == NA_RENAME)
 						ED_region_tag_redraw(ar);
 					break;
 			}
 			break;
 		case NC_ID:
-			if(wmn->action == NA_RENAME)
+			if (wmn->action == NA_RENAME)
 				ED_region_tag_redraw(ar);
 			break;
 		default:
-			if(wmn->data==ND_KEYS)
+			if (wmn->data==ND_KEYS)
 				ED_region_tag_redraw(ar);
 	}
 }
@@ -341,12 +341,12 @@ static void action_main_area_listener(ARegion *ar, wmNotifier *wmn)
 			}
 			break;
 		case NC_ID:
-			if(wmn->action == NA_RENAME)
+			if (wmn->action == NA_RENAME)
 				ED_region_tag_redraw(ar);
 			break;
 				
 		default:
-			if(wmn->data==ND_KEYS)
+			if (wmn->data==ND_KEYS)
 				ED_region_tag_redraw(ar);
 	}
 }
@@ -438,7 +438,7 @@ static void action_header_area_listener(ARegion *ar, wmNotifier *wmn)
 			}
 			break;
 		case NC_ID:
-			if(wmn->action == NA_RENAME)
+			if (wmn->action == NA_RENAME)
 				ED_region_tag_redraw(ar);
 			break;
 	}
@@ -458,7 +458,7 @@ static void action_refresh(const bContext *C, ScrArea *sa)
 	}
 	
 	/* region updates? */
-	// XXX resizing y-extents of tot should go here?
+	// XXX re-sizing y-extents of tot should go here?
 }
 
 /* only called once, from space/spacetypes.c */
diff --git a/source/blender/editors/space_api/CMakeLists.txt b/source/blender/editors/space_api/CMakeLists.txt
index 6f2a038..611322f 100644
--- a/source/blender/editors/space_api/CMakeLists.txt
+++ b/source/blender/editors/space_api/CMakeLists.txt
@@ -23,6 +23,7 @@ set(INC
 	../../blenkernel
 	../../blenlib
 	../../blenloader
+	../../bmesh
 	../../makesdna
 	../../makesrna
 	../../windowmanager
diff --git a/source/blender/editors/space_api/SConscript b/source/blender/editors/space_api/SConscript
index d6a763a..6bf901c 100644
--- a/source/blender/editors/space_api/SConscript
+++ b/source/blender/editors/space_api/SConscript
@@ -4,7 +4,7 @@ Import ('env')
 sources = env.Glob('*.c')
 
 incs = '../include ../../blenlib ../../blenkernel ../../blenloader ../../makesdna'
-incs += ' ../../windowmanager ../../python ../../makesrna'
+incs += ' ../../windowmanager ../../python ../../makesrna ../../bmesh'
 incs += ' #/intern/guardedalloc #/extern/glew/include'
 
 defs = ''
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index 7c5361c..3124318 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -117,8 +117,8 @@ void ED_spacetypes_init(void)
 	
 	/* register operators */
 	spacetypes = BKE_spacetypes_list();
-	for(type=spacetypes->first; type; type=type->next) {
-		if(type->operatortypes)
+	for (type=spacetypes->first; type; type=type->next) {
+		if (type->operatortypes)
 			type->operatortypes();
 	}
 
@@ -136,8 +136,8 @@ void ED_spacetypes_init(void)
 	
 	/* register dropboxes (can use macros) */
 	spacetypes = BKE_spacetypes_list();
-	for(type=spacetypes->first; type; type=type->next) {
-		if(type->dropboxes)
+	for (type=spacetypes->first; type; type=type->next) {
+		if (type->dropboxes)
 			type->dropboxes();
 	}
 	
@@ -145,7 +145,7 @@ void ED_spacetypes_init(void)
 
 /* called in wm.c */
 /* keymap definitions are registered only once per WM initialize, usually on file read,
-   using the keymap the actual areas/regions add the handlers */
+ * using the keymap the actual areas/regions add the handlers */
 void ED_spacetypes_keymap(wmKeyConfig *keyconf)
 {
 	const ListBase *spacetypes;
@@ -169,11 +169,11 @@ void ED_spacetypes_keymap(wmKeyConfig *keyconf)
 	UI_view2d_keymap(keyconf);
 
 	spacetypes = BKE_spacetypes_list();
-	for(stype=spacetypes->first; stype; stype=stype->next) {
-		if(stype->keymap)
+	for (stype=spacetypes->first; stype; stype=stype->next) {
+		if (stype->keymap)
 			stype->keymap(keyconf);
-		for(atype=stype->regiontypes.first; atype; atype=atype->next) {
-			if(atype->keymap)
+		for (atype=stype->regiontypes.first; atype; atype=atype->next) {
+			if (atype->keymap)
 				atype->keymap(keyconf);
 		}
 	}
@@ -209,8 +209,8 @@ void ED_region_draw_cb_exit(ARegionType *art, void *handle)
 {
 	RegionDrawCB *rdc;
 	
-	for(rdc= art->drawcalls.first; rdc; rdc= rdc->next) {
-		if(rdc==(RegionDrawCB *)handle) {
+	for (rdc= art->drawcalls.first; rdc; rdc= rdc->next) {
+		if (rdc==(RegionDrawCB *)handle) {
 			BLI_remlink(&art->drawcalls, rdc);
 			MEM_freeN(rdc);
 			return;
@@ -227,8 +227,8 @@ void ED_region_draw_cb_draw(const bContext *C, ARegion *ar, int type)
 {
 	RegionDrawCB *rdc;
 	
-	for(rdc= ar->type->drawcalls.first; rdc; rdc= rdc->next) {
-		if(rdc->type==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/CMakeLists.txt b/source/blender/editors/space_buttons/CMakeLists.txt
index ee118f1..7233d46 100644
--- a/source/blender/editors/space_buttons/CMakeLists.txt
+++ b/source/blender/editors/space_buttons/CMakeLists.txt
@@ -44,4 +44,8 @@ set(SRC
 	buttons_intern.h
 )
 
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
 blender_add_lib(bf_editor_space_buttons "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_buttons/SConscript b/source/blender/editors/space_buttons/SConscript
index 740353b..92579b6 100644
--- a/source/blender/editors/space_buttons/SConscript
+++ b/source/blender/editors/space_buttons/SConscript
@@ -5,8 +5,11 @@ sources = env.Glob('*.c')
 
 incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
 incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
-incs += ' ../../makesrna ../../render/extern/include ../../blenloader'
+incs += ' ../../bmesh ../../makesrna ../../render/extern/include ../../blenloader'
 
 defs = []
 
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
+
 env.BlenderLib ( 'bf_editors_space_buttons', sources, Split(incs), defs, libtype=['core'], priority=[120] )
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index 5798143..b698ec0 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -70,10 +70,10 @@ static int set_pointer_type(ButsContextPath *path, bContextDataResult *result, S
 	PointerRNA *ptr;
 	int a;
 
-	for(a=0; a<path->len; a++) {
+	for (a=0; a<path->len; a++) {
 		ptr= &path->ptr[a];
 
-		if(RNA_struct_is_a(ptr->type, type)) {
+		if (RNA_struct_is_a(ptr->type, type)) {
 			CTX_data_pointer_set(result, ptr->id.data, ptr->type, ptr->data);
 			return 1;
 		}
@@ -87,10 +87,10 @@ static PointerRNA *get_pointer_type(ButsContextPath *path, StructRNA *type)
 	PointerRNA *ptr;
 	int a;
 
-	for(a=0; a<path->len; a++) {
+	for (a=0; a<path->len; a++) {
 		ptr= &path->ptr[a];
 
-		if(RNA_struct_is_a(ptr->type, type))
+		if (RNA_struct_is_a(ptr->type, type))
 			return ptr;
 	}
 
@@ -116,15 +116,15 @@ static int buttons_context_path_world(ButsContextPath *path)
 	PointerRNA *ptr= &path->ptr[path->len-1];
 
 	/* if we already have a (pinned) world, we're done */
-	if(RNA_struct_is_a(ptr->type, &RNA_World)) {
+	if (RNA_struct_is_a(ptr->type, &RNA_World)) {
 		return 1;
 	}
 	/* if we have a scene, use the scene's world */
-	else if(buttons_context_path_scene(path)) {
+	else if (buttons_context_path_scene(path)) {
 		scene= path->ptr[path->len-1].data;
 		world= scene->world;
 		
-		if(world) {
+		if (world) {
 			RNA_id_pointer_create(&scene->world->id, &path->ptr[path->len]);
 			path->len++;
 			return 1;
@@ -146,15 +146,15 @@ static int buttons_context_path_object(ButsContextPath *path)
 	PointerRNA *ptr= &path->ptr[path->len-1];
 
 	/* if we already have a (pinned) object, we're done */
-	if(RNA_struct_is_a(ptr->type, &RNA_Object)) {
+	if (RNA_struct_is_a(ptr->type, &RNA_Object)) {
 		return 1;
 	}
 	/* if we have a scene, use the scene's active object */
-	else if(buttons_context_path_scene(path)) {
+	else if (buttons_context_path_scene(path)) {
 		scene= path->ptr[path->len-1].data;
 		ob= (scene->basact)? scene->basact->object: NULL;
 
-		if(ob) {
+		if (ob) {
 			RNA_id_pointer_create(&ob->id, &path->ptr[path->len]);
 			path->len++;
 
@@ -172,19 +172,19 @@ static int buttons_context_path_data(ButsContextPath *path, int type)
 	PointerRNA *ptr= &path->ptr[path->len-1];
 
 	/* if we already have a data, we're done */
-	if(RNA_struct_is_a(ptr->type, &RNA_Mesh) && (type == -1 || type == OB_MESH)) return 1;
-	else if(RNA_struct_is_a(ptr->type, &RNA_Curve) && (type == -1 || ELEM3(type, OB_CURVE, OB_SURF, OB_FONT))) return 1;
-	else if(RNA_struct_is_a(ptr->type, &RNA_Armature) && (type == -1 || type == OB_ARMATURE)) return 1;
-	else if(RNA_struct_is_a(ptr->type, &RNA_MetaBall) && (type == -1 || type == OB_MBALL)) return 1;
-	else if(RNA_struct_is_a(ptr->type, &RNA_Lattice) && (type == -1 || type == OB_LATTICE)) return 1;
-	else if(RNA_struct_is_a(ptr->type, &RNA_Camera) && (type == -1 || type == OB_CAMERA)) return 1;
-	else if(RNA_struct_is_a(ptr->type, &RNA_Lamp) && (type == -1 || type == OB_LAMP)) return 1;
-	else if(RNA_struct_is_a(ptr->type, &RNA_Speaker) && (type == -1 || type == OB_SPEAKER)) return 1;
+	if (RNA_struct_is_a(ptr->type, &RNA_Mesh) && (type == -1 || type == OB_MESH)) return 1;
+	else if (RNA_struct_is_a(ptr->type, &RNA_Curve) && (type == -1 || ELEM3(type, OB_CURVE, OB_SURF, OB_FONT))) return 1;
+	else if (RNA_struct_is_a(ptr->type, &RNA_Armature) && (type == -1 || type == OB_ARMATURE)) return 1;
+	else if (RNA_struct_is_a(ptr->type, &RNA_MetaBall) && (type == -1 || type == OB_MBALL)) return 1;
+	else if (RNA_struct_is_a(ptr->type, &RNA_Lattice) && (type == -1 || type == OB_LATTICE)) return 1;
+	else if (RNA_struct_is_a(ptr->type, &RNA_Camera) && (type == -1 || type == OB_CAMERA)) return 1;
+	else if (RNA_struct_is_a(ptr->type, &RNA_Lamp) && (type == -1 || type == OB_LAMP)) return 1;
+	else if (RNA_struct_is_a(ptr->type, &RNA_Speaker) && (type == -1 || type == OB_SPEAKER)) return 1;
 	/* try to get an object in the path, no pinning supported here */
-	else if(buttons_context_path_object(path)) {
+	else if (buttons_context_path_object(path)) {
 		ob= path->ptr[path->len-1].data;
 
-		if(ob && (type == -1 || type == ob->type)) {
+		if (ob && (type == -1 || type == ob->type)) {
 			RNA_id_pointer_create(ob->data, &path->ptr[path->len]);
 			path->len++;
 
@@ -200,10 +200,10 @@ static int buttons_context_path_modifier(ButsContextPath *path)
 {
 	Object *ob;
 
-	if(buttons_context_path_object(path)) {
+	if (buttons_context_path_object(path)) {
 		ob= path->ptr[path->len-1].data;
 
-		if(ob && ELEM5(ob->type, OB_MESH, OB_CURVE, OB_FONT, OB_SURF, OB_LATTICE))
+		if (ob && ELEM5(ob->type, OB_MESH, OB_CURVE, OB_FONT, OB_SURF, OB_LATTICE))
 			return 1;
 	}
 
@@ -217,23 +217,23 @@ static int buttons_context_path_material(ButsContextPath *path, int for_texture)
 	Material *ma;
 
 	/* if we already have a (pinned) material, we're done */
-	if(RNA_struct_is_a(ptr->type, &RNA_Material)) {
+	if (RNA_struct_is_a(ptr->type, &RNA_Material)) {
 		return 1;
 	}
 	/* if we have an object, use the object material slot */
-	else if(buttons_context_path_object(path)) {
+	else if (buttons_context_path_object(path)) {
 		ob= path->ptr[path->len-1].data;
 
-		if(ob && OB_TYPE_SUPPORT_MATERIAL(ob->type)) {
+		if (ob && OB_TYPE_SUPPORT_MATERIAL(ob->type)) {
 			ma= give_current_material(ob, ob->actcol);
 			RNA_id_pointer_create(&ma->id, &path->ptr[path->len]);
 			path->len++;
 
-			if(for_texture && give_current_material_texture_node(ma))
+			if (for_texture && give_current_material_texture_node(ma))
 				return 1;
 			
 			ma= give_node_material(ma);
-			if(ma) {
+			if (ma) {
 				RNA_id_pointer_create(&ma->id, &path->ptr[path->len]);
 				path->len++;
 			}			
@@ -251,11 +251,11 @@ static int buttons_context_path_bone(ButsContextPath *path)
 	EditBone *edbo;
 
 	/* if we have an armature, get the active bone */
-	if(buttons_context_path_data(path, OB_ARMATURE)) {
+	if (buttons_context_path_data(path, OB_ARMATURE)) {
 		arm= path->ptr[path->len-1].data;
 
-		if(arm->edbo) {
-			if(arm->act_edbone) {
+		if (arm->edbo) {
+			if (arm->act_edbone) {
 				edbo= arm->act_edbone;
 				RNA_pointer_create(&arm->id, &RNA_EditBone, edbo, &path->ptr[path->len]);
 				path->len++;
@@ -263,7 +263,7 @@ static int buttons_context_path_bone(ButsContextPath *path)
 			}
 		}
 		else {
-			if(arm->act_bone) {
+			if (arm->act_bone) {
 				RNA_pointer_create(&arm->id, &RNA_Bone, arm->act_bone, &path->ptr[path->len]);
 				path->len++;
 				return 1;
@@ -280,22 +280,22 @@ static int buttons_context_path_pose_bone(ButsContextPath *path)
 	PointerRNA *ptr= &path->ptr[path->len-1];
 
 	/* if we already have a (pinned) PoseBone, we're done */
-	if(RNA_struct_is_a(ptr->type, &RNA_PoseBone)) {
+	if (RNA_struct_is_a(ptr->type, &RNA_PoseBone)) {
 		return 1;
 	}
 
 	/* if we have an armature, get the active bone */
-	if(buttons_context_path_object(path)) {
+	if (buttons_context_path_object(path)) {
 		Object *ob= path->ptr[path->len-1].data;
 		bArmature *arm= ob->data; /* path->ptr[path->len-1].data - works too */
 
-		if(ob->type != OB_ARMATURE || arm->edbo) {
+		if (ob->type != OB_ARMATURE || arm->edbo) {
 			return 0;
 		}
 		else {
-			if(arm->act_bone) {
+			if (arm->act_bone) {
 				bPoseChannel *pchan= get_pose_channel(ob->pose, arm->act_bone->name);
-				if(pchan) {
+				if (pchan) {
 					RNA_pointer_create(&ob->id, &RNA_PoseBone, pchan, &path->ptr[path->len]);
 					path->len++;
 					return 1;
@@ -316,14 +316,14 @@ static int buttons_context_path_particle(ButsContextPath *path)
 	PointerRNA *ptr= &path->ptr[path->len-1];
 
 	/* if we already have (pinned) particle settings, we're done */
-	if(RNA_struct_is_a(ptr->type, &RNA_ParticleSettings)) {
+	if (RNA_struct_is_a(ptr->type, &RNA_ParticleSettings)) {
 		return 1;
 	}
 	/* if we have an object, get the active particle system */
-	if(buttons_context_path_object(path)) {
+	if (buttons_context_path_object(path)) {
 		ob= path->ptr[path->len-1].data;
 
-		if(ob && ob->type == OB_MESH) {
+		if (ob && ob->type == OB_MESH) {
 			psys= psys_get_current(ob);
 
 			RNA_pointer_create(&ob->id, &RNA_ParticleSystem, psys, &path->ptr[path->len]);
@@ -343,17 +343,17 @@ static int buttons_context_path_brush(ButsContextPath *path)
 	PointerRNA *ptr= &path->ptr[path->len-1];
 
 	/* if we already have a (pinned) brush, we're done */
-	if(RNA_struct_is_a(ptr->type, &RNA_Brush)) {
+	if (RNA_struct_is_a(ptr->type, &RNA_Brush)) {
 		return 1;
 	}
 	/* if we have a scene, use the toolsettings brushes */
-	else if(buttons_context_path_scene(path)) {
+	else if (buttons_context_path_scene(path)) {
 		scene= path->ptr[path->len-1].data;
 
-		if(scene)
+		if (scene)
 			br= paint_brush(paint_get_active(scene));
 
-		if(br) {
+		if (br) {
 			RNA_id_pointer_create((ID *)br, &path->ptr[path->len]);
 			path->len++;
 
@@ -367,36 +367,36 @@ static int buttons_context_path_brush(ButsContextPath *path)
 
 static int buttons_context_path_texture(ButsContextPath *path, ButsContextTexture *ct)
 {
-	if(ct) {
+	if (ct) {
 		/* new shading system */
 		PointerRNA *ptr= &path->ptr[path->len-1];
 		ID *id;
 
 		/* if we already have a (pinned) texture, we're done */
-		if(RNA_struct_is_a(ptr->type, &RNA_Texture))
+		if (RNA_struct_is_a(ptr->type, &RNA_Texture))
 			return 1;
 
-		if(!ct->user)
+		if (!ct->user)
 			return 0;
 		
 		id= ct->user->id;
 
-		if(id) {
-			if(GS(id->name) == ID_BR)
+		if (id) {
+			if (GS(id->name) == ID_BR)
 				buttons_context_path_brush(path);
-			else if(GS(id->name) == ID_MA)
+			else if (GS(id->name) == ID_MA)
 				buttons_context_path_material(path, 0);
-			else if(GS(id->name) == ID_WO)
+			else if (GS(id->name) == ID_WO)
 				buttons_context_path_world(path);
-			else if(GS(id->name) == ID_LA)
+			else if (GS(id->name) == ID_LA)
 				buttons_context_path_data(path, OB_LAMP);
-			else if(GS(id->name) == ID_PA)
+			else if (GS(id->name) == ID_PA)
 				buttons_context_path_particle(path);
-			else if(GS(id->name) == ID_OB)
+			else if (GS(id->name) == ID_OB)
 				buttons_context_path_object(path);
 		}
 		
-		if(ct->texture) {
+		if (ct->texture) {
 			RNA_id_pointer_create(&ct->texture->id, &path->ptr[path->len]);
 			path->len++;
 		}
@@ -415,14 +415,14 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur
 		int orig_len = path->len;
 
 		/* if we already have a (pinned) texture, we're done */
-		if(RNA_struct_is_a(ptr->type, &RNA_Texture)) {
+		if (RNA_struct_is_a(ptr->type, &RNA_Texture)) {
 			return 1;
 		}
 		/* try brush */
-		if((path->tex_ctx == SB_TEXC_BRUSH) && buttons_context_path_brush(path)) {
+		if ((path->tex_ctx == SB_TEXC_BRUSH) && buttons_context_path_brush(path)) {
 			br= path->ptr[path->len-1].data;
 			
-			if(br) {
+			if (br) {
 				tex= give_current_brush_texture(br);
 
 				RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
@@ -431,10 +431,10 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur
 			}
 		}
 		/* try world */
-		if((path->tex_ctx == SB_TEXC_WORLD) && buttons_context_path_world(path)) {
+		if ((path->tex_ctx == SB_TEXC_WORLD) && buttons_context_path_world(path)) {
 			wo= path->ptr[path->len-1].data;
 
-			if(wo && GS(wo->id.name)==ID_WO) {
+			if (wo && GS(wo->id.name)==ID_WO) {
 				tex= give_current_world_texture(wo);
 
 				RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
@@ -443,8 +443,8 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur
 			}
 		}
 		/* try particles */
-		if((path->tex_ctx == SB_TEXC_PARTICLES) && buttons_context_path_particle(path)) {
-			if(path->ptr[path->len-1].type == &RNA_ParticleSettings) {
+		if ((path->tex_ctx == SB_TEXC_PARTICLES) && buttons_context_path_particle(path)) {
+			if (path->ptr[path->len-1].type == &RNA_ParticleSettings) {
 				ParticleSettings *part = path->ptr[path->len-1].data;
 
 				tex= give_current_particle_texture(part);
@@ -455,7 +455,7 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur
 			else {
 				psys= path->ptr[path->len-1].data;
 
-				if(psys && psys->part && GS(psys->part->id.name)==ID_PA) {
+				if (psys && psys->part && GS(psys->part->id.name)==ID_PA) {
 					tex= give_current_particle_texture(psys->part);
 
 					RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
@@ -465,10 +465,10 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur
 			}
 		}
 		/* try material */
-		if(buttons_context_path_material(path, 1)) {
+		if (buttons_context_path_material(path, 1)) {
 			ma= path->ptr[path->len-1].data;
 
-			if(ma) {
+			if (ma) {
 				tex= give_current_material_texture(ma);
 
 				RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
@@ -477,10 +477,10 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur
 			}
 		}
 		/* try lamp */
-		if(buttons_context_path_data(path, OB_LAMP)) {
+		if (buttons_context_path_data(path, OB_LAMP)) {
 			la= path->ptr[path->len-1].data;
 
-			if(la) {
+			if (la) {
 				tex= give_current_lamp_texture(la);
 
 				RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
@@ -490,10 +490,10 @@ static int buttons_context_path_texture(ButsContextPath *path, ButsContextTextur
 		}
 		/* try brushes again in case of no material, lamp, etc */
 		path->len = orig_len;
-		if(buttons_context_path_brush(path)) {
+		if (buttons_context_path_brush(path)) {
 			br= path->ptr[path->len-1].data;
 			
-			if(br) {
+			if (br) {
 				tex= give_current_brush_texture(br);
 				
 				RNA_id_pointer_create(&tex->id, &path->ptr[path->len]);
@@ -519,7 +519,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
 	path->tex_ctx = sbuts->texture_context;
 
 	/* if some ID datablock is pinned, set the root pointer */
-	if(sbuts->pinid) {
+	if (sbuts->pinid) {
 		id= sbuts->pinid;
 
 		RNA_id_pointer_create(id, &path->ptr[0]);
@@ -527,7 +527,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
 	}
 
 	/* no pinned root, use scene as root */
-	if(path->len == 0) {
+	if (path->len == 0) {
 		id= (ID*)CTX_data_scene(C);
 		RNA_id_pointer_create(id, &path->ptr[0]);
 		path->len++;
@@ -565,7 +565,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
 			break;
 		case BCONTEXT_BONE:
 			found= buttons_context_path_bone(path);
-			if(!found)
+			if (!found)
 				found= buttons_context_path_data(path, OB_ARMATURE);
 			break;
 		case BCONTEXT_BONE_CONSTRAINT:
@@ -583,9 +583,9 @@ static int buttons_shading_context(const bContext *C, int mainb)
 {
 	Object *ob= CTX_data_active_object(C);
 
-	if(ELEM3(mainb, BCONTEXT_MATERIAL, BCONTEXT_WORLD, BCONTEXT_TEXTURE))
+	if (ELEM3(mainb, BCONTEXT_MATERIAL, BCONTEXT_WORLD, BCONTEXT_TEXTURE))
 		return 1;
-	if(mainb == BCONTEXT_DATA && ob && ELEM(ob->type, OB_LAMP, OB_CAMERA))
+	if (mainb == BCONTEXT_DATA && ob && ELEM(ob->type, OB_LAMP, OB_CAMERA))
 		return 1;
 	
 	return 0;
@@ -595,11 +595,11 @@ static int buttons_shading_new_context(const bContext *C, int flag)
 {
 	Object *ob= CTX_data_active_object(C);
 
-	if(flag & (1 << BCONTEXT_MATERIAL))
+	if (flag & (1 << BCONTEXT_MATERIAL))
 		return BCONTEXT_MATERIAL;
-	else if(ob && ELEM(ob->type, OB_LAMP, OB_CAMERA) && (flag & (1 << BCONTEXT_DATA)))
+	else if (ob && ELEM(ob->type, OB_LAMP, OB_CAMERA) && (flag & (1 << BCONTEXT_DATA)))
 		return BCONTEXT_DATA;
-	else if(flag & (1 << BCONTEXT_WORLD))
+	else if (flag & (1 << BCONTEXT_WORLD))
 		return BCONTEXT_WORLD;
 	
 	return BCONTEXT_RENDER;
@@ -613,22 +613,22 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts)
 
 	buttons_texture_context_compute(C, sbuts);
 
-	if(!sbuts->path)
+	if (!sbuts->path)
 		sbuts->path= MEM_callocN(sizeof(ButsContextPath), "ButsContextPath");
 	
 	path= sbuts->path;
 	
 	/* for each context, see if we can compute a valid path to it, if
 	 * this is the case, we know we have to display the button */
-	for(a=0; a<BCONTEXT_TOT; a++) {
-		if(buttons_context_path(C, path, a, pflag)) {
+	for (a=0; a<BCONTEXT_TOT; a++) {
+		if (buttons_context_path(C, path, a, pflag)) {
 			flag |= (1<<a);
 
 			/* setting icon for data context */
-			if(a == BCONTEXT_DATA) {
+			if (a == BCONTEXT_DATA) {
 				ptr= &path->ptr[path->len-1];
 
-				if(ptr->type)
+				if (ptr->type)
 					sbuts->dataicon= RNA_struct_ui_icon(ptr->type);
 				else
 					sbuts->dataicon= ICON_EMPTY_DATA;
@@ -642,17 +642,17 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts)
 	sbuts->mainb= sbuts->mainbuser;
 
 	/* in case something becomes invalid, change */
-	if((flag & (1 << sbuts->mainb)) == 0) {
-		if(sbuts->flag & SB_SHADING_CONTEXT) {
+	if ((flag & (1 << sbuts->mainb)) == 0) {
+		if (sbuts->flag & SB_SHADING_CONTEXT) {
 			/* try to keep showing shading related buttons */
 			sbuts->mainb= buttons_shading_new_context(C, flag);
 		}
-		else if(flag & BCONTEXT_OBJECT) {
+		else if (flag & BCONTEXT_OBJECT) {
 			sbuts->mainb= BCONTEXT_OBJECT;
 		}
 		else {
-			for(a=0; a<BCONTEXT_TOT; a++) {
-				if(flag & (1 << a)) {
+			for (a=0; a<BCONTEXT_TOT; a++) {
+				if (flag & (1 << a)) {
 					sbuts->mainb= a;
 					break;
 				}
@@ -662,14 +662,14 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts)
 
 	buttons_context_path(C, path, sbuts->mainb, pflag);
 
-	if(!(flag & (1 << sbuts->mainb))) {
-		if(flag & (1 << BCONTEXT_OBJECT))
+	if (!(flag & (1 << sbuts->mainb))) {
+		if (flag & (1 << BCONTEXT_OBJECT))
 			sbuts->mainb= BCONTEXT_OBJECT;
 		else
 			sbuts->mainb= BCONTEXT_SCENE;
 	}
 
-	if(buttons_shading_context(C, sbuts->mainb))
+	if (buttons_shading_context(C, sbuts->mainb))
 		sbuts->flag |= SB_SHADING_CONTEXT;
 	else
 		sbuts->flag &= ~SB_SHADING_CONTEXT;
@@ -691,62 +691,62 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
 	SpaceButs *sbuts= CTX_wm_space_buts(C);
 	ButsContextPath *path= sbuts?sbuts->path:NULL;
 
-	if(!path)
+	if (!path)
 		return 0;
 
 	/* here we handle context, getting data from precomputed path */
-	if(CTX_data_dir(member)) {
+	if (CTX_data_dir(member)) {
 		CTX_data_dir_set(result, buttons_context_dir);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "world")) {
+	else if (CTX_data_equals(member, "world")) {
 		set_pointer_type(path, result, &RNA_World);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "object")) {
+	else if (CTX_data_equals(member, "object")) {
 		set_pointer_type(path, result, &RNA_Object);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "mesh")) {
+	else if (CTX_data_equals(member, "mesh")) {
 		set_pointer_type(path, result, &RNA_Mesh);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "armature")) {
+	else if (CTX_data_equals(member, "armature")) {
 		set_pointer_type(path, result, &RNA_Armature);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "lattice")) {
+	else if (CTX_data_equals(member, "lattice")) {
 		set_pointer_type(path, result, &RNA_Lattice);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "curve")) {
+	else if (CTX_data_equals(member, "curve")) {
 		set_pointer_type(path, result, &RNA_Curve);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "meta_ball")) {
+	else if (CTX_data_equals(member, "meta_ball")) {
 		set_pointer_type(path, result, &RNA_MetaBall);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "lamp")) {
+	else if (CTX_data_equals(member, "lamp")) {
 		set_pointer_type(path, result, &RNA_Lamp);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "camera")) {
+	else if (CTX_data_equals(member, "camera")) {
 		set_pointer_type(path, result, &RNA_Camera);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "speaker")) {
+	else if (CTX_data_equals(member, "speaker")) {
 		set_pointer_type(path, result, &RNA_Speaker);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "material")) {
+	else if (CTX_data_equals(member, "material")) {
 		set_pointer_type(path, result, &RNA_Material);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "texture")) {
+	else if (CTX_data_equals(member, "texture")) {
 		ButsContextTexture *ct= sbuts->texuser;
 
-		if(ct) {
+		if (ct) {
 			/* new shading system */
 			CTX_data_pointer_set(result, &ct->texture->id, &RNA_Texture, ct->texture);
 		}
@@ -757,41 +757,41 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
 
 		return 1;
 	}
-	else if(CTX_data_equals(member, "material_slot")) {
+	else if (CTX_data_equals(member, "material_slot")) {
 		PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
 
-		if(ptr) {
+		if (ptr) {
 			Object *ob= ptr->data;
 
-			if(ob && OB_TYPE_SUPPORT_MATERIAL(ob->type) && ob->totcol) {
+			if (ob && OB_TYPE_SUPPORT_MATERIAL(ob->type) && ob->totcol) {
 				/* a valid actcol isn't ensured [#27526] */
 				int matnr= ob->actcol-1;
-				if(matnr < 0) matnr= 0;
+				if (matnr < 0) matnr= 0;
 				CTX_data_pointer_set(result, &ob->id, &RNA_MaterialSlot, &ob->mat[matnr]);
 			}
 		}
 
 		return 1;
 	}
-	else if(CTX_data_equals(member, "texture_user")) {
+	else if (CTX_data_equals(member, "texture_user")) {
 		ButsContextTexture *ct= sbuts->texuser;
 
-		if(!ct)
-			return 0; /* old shading system */
+		if (!ct)
+			return -1; /* old shading system (found but not available) */
 
-		if(ct->user && ct->user->ptr.data) {
+		if (ct->user && ct->user->ptr.data) {
 			ButsTextureUser *user= ct->user; 
 			CTX_data_pointer_set(result, user->ptr.id.data, user->ptr.type, user->ptr.data);
 		}
 
 		return 1;
 	}
-	else if(CTX_data_equals(member, "texture_node")) {
+	else if (CTX_data_equals(member, "texture_node")) {
 		ButsContextTexture *ct= sbuts->texuser;
 
-		if(ct) {
+		if (ct) {
 			/* new shading system */
-			if(ct->user && ct->user->node)
+			if (ct->user && ct->user->node)
 				CTX_data_pointer_set(result, &ct->user->ntree->id, &RNA_Node, ct->user->node);
 
 			return 1;
@@ -800,10 +800,10 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
 			/* old shading system */
 			PointerRNA *ptr;
 
-			if((ptr=get_pointer_type(path, &RNA_Material))) {
+			if ((ptr=get_pointer_type(path, &RNA_Material))) {
 				Material *ma= ptr->data;
 
-				if(ma) {
+				if (ma) {
 					bNode *node= give_current_material_texture_node(ma);
 					CTX_data_pointer_set(result, &ma->nodetree->id, &RNA_Node, node);
 				}
@@ -812,18 +812,18 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
 			return 1;
 		}
 	}
-	else if(CTX_data_equals(member, "texture_slot")) {
+	else if (CTX_data_equals(member, "texture_slot")) {
 		ButsContextTexture *ct= sbuts->texuser;
 		PointerRNA *ptr;
 
-		if(ct)
+		if (ct)
 			return 0; /* new shading system */
 
-		if((ptr=get_pointer_type(path, &RNA_Material))) {
+		if ((ptr=get_pointer_type(path, &RNA_Material))) {
 			Material *ma= ptr->data;
 
 			/* if we have a node material, get slot from material in material node */
-			if(ma && ma->use_nodes && ma->nodetree) {
+			if (ma && ma->use_nodes && ma->nodetree) {
 				/* if there's an active texture node in the node tree,
 				 * then that texture is in context directly, without a texture slot */
 				if (give_current_material_texture_node(ma))
@@ -834,84 +834,85 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
 					CTX_data_pointer_set(result, &ma->id, &RNA_MaterialTextureSlot, ma->mtex[(int)ma->texact]);
 				else
 					return 0;
-			} else if(ma) {
+			}
+			else if (ma) {
 				CTX_data_pointer_set(result, &ma->id, &RNA_MaterialTextureSlot, ma->mtex[(int)ma->texact]);
 			}
 		}
-		else if((ptr=get_pointer_type(path, &RNA_Lamp))) {
+		else if ((ptr=get_pointer_type(path, &RNA_Lamp))) {
 			Lamp *la= ptr->data;
 
-			if(la)
+			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))) {
+		else if ((ptr=get_pointer_type(path, &RNA_World))) {
 			World *wo= ptr->data;
 
-			if(wo)
+			if (wo)
 				CTX_data_pointer_set(result, &wo->id, &RNA_WorldTextureSlot, wo->mtex[(int)wo->texact]);
 		}
-		else if((ptr=get_pointer_type(path, &RNA_Brush))) { /* how to get this into context? */
+		else if ((ptr=get_pointer_type(path, &RNA_Brush))) { /* how to get this into context? */
 			Brush *br= ptr->data;
 
-			if(br)
+			if (br)
 				CTX_data_pointer_set(result, &br->id, &RNA_BrushTextureSlot, &br->mtex);
 		}
-		else if((ptr=get_pointer_type(path, &RNA_ParticleSystem))) {
+		else if ((ptr=get_pointer_type(path, &RNA_ParticleSystem))) {
 			ParticleSettings *part= ((ParticleSystem *)ptr->data)->part;
 
-			if(part)
+			if (part)
 				CTX_data_pointer_set(result, &part->id, &RNA_ParticleSettingsTextureSlot, part->mtex[(int)part->texact]);
 		}
 
 		return 1;
 	}
-	else if(CTX_data_equals(member, "bone")) {
+	else if (CTX_data_equals(member, "bone")) {
 		set_pointer_type(path, result, &RNA_Bone);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "edit_bone")) {
+	else if (CTX_data_equals(member, "edit_bone")) {
 		set_pointer_type(path, result, &RNA_EditBone);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "pose_bone")) {
+	else if (CTX_data_equals(member, "pose_bone")) {
 		set_pointer_type(path, result, &RNA_PoseBone);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "particle_system")) {
+	else if (CTX_data_equals(member, "particle_system")) {
 		set_pointer_type(path, result, &RNA_ParticleSystem);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "particle_system_editable")) {
-		if(PE_poll((bContext*)C))
+	else if (CTX_data_equals(member, "particle_system_editable")) {
+		if (PE_poll((bContext*)C))
 			set_pointer_type(path, result, &RNA_ParticleSystem);
 		else
 			CTX_data_pointer_set(result, NULL, &RNA_ParticleSystem, NULL);
 		return 1;
 	}	
-	else if(CTX_data_equals(member, "cloth")) {
+	else if (CTX_data_equals(member, "cloth")) {
 		PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
 
-		if(ptr && ptr->data) {
+		if (ptr && ptr->data) {
 			Object *ob= ptr->data;
 			ModifierData *md= modifiers_findByType(ob, eModifierType_Cloth);
 			CTX_data_pointer_set(result, &ob->id, &RNA_ClothModifier, md);
 			return 1;
 		}
 	}
-	else if(CTX_data_equals(member, "soft_body")) {
+	else if (CTX_data_equals(member, "soft_body")) {
 		PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
 
-		if(ptr && ptr->data) {
+		if (ptr && ptr->data) {
 			Object *ob= ptr->data;
 			ModifierData *md= modifiers_findByType(ob, eModifierType_Softbody);
 			CTX_data_pointer_set(result, &ob->id, &RNA_SoftBodyModifier, md);
 			return 1;
 		}
 	}
-	else if(CTX_data_equals(member, "fluid")) {
+	else if (CTX_data_equals(member, "fluid")) {
 		PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
 
-		if(ptr && ptr->data) {
+		if (ptr && ptr->data) {
 			Object *ob= ptr->data;
 			ModifierData *md= modifiers_findByType(ob, eModifierType_Fluidsim);
 			CTX_data_pointer_set(result, &ob->id, &RNA_FluidSimulationModifier, md);
@@ -919,34 +920,34 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
 		}
 	}
 	
-	else if(CTX_data_equals(member, "smoke")) {
+	else if (CTX_data_equals(member, "smoke")) {
 		PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
 
-		if(ptr && ptr->data) {
+		if (ptr && ptr->data) {
 			Object *ob= ptr->data;
 			ModifierData *md= modifiers_findByType(ob, eModifierType_Smoke);
 			CTX_data_pointer_set(result, &ob->id, &RNA_SmokeModifier, md);
 			return 1;
 		}
 	}
-	else if(CTX_data_equals(member, "collision")) {
+	else if (CTX_data_equals(member, "collision")) {
 		PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
 
-		if(ptr && ptr->data) {
+		if (ptr && ptr->data) {
 			Object *ob= ptr->data;
 			ModifierData *md= modifiers_findByType(ob, eModifierType_Collision);
 			CTX_data_pointer_set(result, &ob->id, &RNA_CollisionModifier, md);
 			return 1;
 		}
 	}
-	else if(CTX_data_equals(member, "brush")) {
+	else if (CTX_data_equals(member, "brush")) {
 		set_pointer_type(path, result, &RNA_Brush);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "dynamic_paint")) {
+	else if (CTX_data_equals(member, "dynamic_paint")) {
 		PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
 
-		if(ptr && ptr->data) {
+		if (ptr && ptr->data) {
 			Object *ob= ptr->data;
 			ModifierData *md= modifiers_findByType(ob, eModifierType_DynamicPaint);
 			CTX_data_pointer_set(result, &ob->id, &RNA_DynamicPaintModifier, md);
@@ -966,7 +967,7 @@ static void pin_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2))
 {
 	SpaceButs *sbuts= CTX_wm_space_buts(C);
 
-	if(sbuts->flag & SB_PIN_CONTEXT) {
+	if (sbuts->flag & SB_PIN_CONTEXT) {
 		sbuts->pinid= buttons_context_id_path(C);
 	}
 	else
@@ -986,7 +987,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout)
 	char namebuf[128], *name;
 	int a, icon;
 
-	if(!path)
+	if (!path)
 		return;
 
 	row= uiLayoutRow(layout, 1);
@@ -994,27 +995,27 @@ void buttons_context_draw(const bContext *C, uiLayout *layout)
 
 	block= uiLayoutGetBlock(row);
 	uiBlockSetEmboss(block, UI_EMBOSSN);
-	but= uiDefIconButBitC(block, ICONTOG, SB_PIN_CONTEXT, 0, ICON_UNPINNED, 0, 0, UI_UNIT_X, UI_UNIT_Y, &sbuts->flag, 0, 0, 0, 0, "Follow context or keep fixed datablock displayed");
+	but = uiDefIconButBitC(block, ICONTOG, SB_PIN_CONTEXT, 0, ICON_UNPINNED, 0, 0, UI_UNIT_X, UI_UNIT_Y, &sbuts->flag, 0, 0, 0, 0, "Follow context or keep fixed datablock displayed");
 	uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
 	uiButSetFunc(but, pin_cb, NULL, NULL);
 
-	for(a=0; a<path->len; a++) {
+	for (a=0; a<path->len; a++) {
 		ptr= &path->ptr[a];
 
-		if(a != 0)
+		if (a != 0)
 			uiItemL(row, "", VICO_SMALL_TRI_RIGHT_VEC);
 
-		if(ptr->data) {
+		if (ptr->data) {
 			icon= RNA_struct_ui_icon(ptr->type);
 			name= RNA_struct_name_get_alloc(ptr, namebuf, sizeof(namebuf), NULL);
 
-			if(name) {
-				if(!ELEM(sbuts->mainb, BCONTEXT_RENDER, BCONTEXT_SCENE) && ptr->type == &RNA_Scene)
+			if (name) {
+				if (!ELEM(sbuts->mainb, BCONTEXT_RENDER, BCONTEXT_SCENE) && ptr->type == &RNA_Scene)
 					uiItemLDrag(row, ptr, "", icon); /* save some space */
 				else
 					uiItemLDrag(row, ptr, name, icon);
 								 
-				if(name != namebuf)
+				if (name != namebuf)
 					MEM_freeN(name);
 			}
 			else
@@ -1047,19 +1048,19 @@ ID *buttons_context_id_path(const bContext *C)
 	PointerRNA *ptr;
 	int a;
 
-	if(path->len) {
-		for(a=path->len-1; a>=0; a--) {
+	if (path->len) {
+		for (a=path->len-1; a>=0; a--) {
 			ptr= &path->ptr[a];
 
 			/* pin particle settings instead of system, since only settings are an idblock*/
-			if(sbuts->mainb == BCONTEXT_PARTICLE && sbuts->flag & SB_PIN_CONTEXT) {
-				if(ptr->type == &RNA_ParticleSystem && ptr->data) {
+			if (sbuts->mainb == BCONTEXT_PARTICLE && sbuts->flag & SB_PIN_CONTEXT) {
+				if (ptr->type == &RNA_ParticleSystem && ptr->data) {
 					ParticleSystem *psys = (ParticleSystem *)ptr->data;
 					return &psys->part->id;
 				}
 			}
 
-			if(ptr->id.data) {
+			if (ptr->id.data) {
 				return ptr->id.data;
 			}
 		}
diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c
index 6777e2c..fcc5b48 100644
--- a/source/blender/editors/space_buttons/buttons_header.c
+++ b/source/blender/editors/space_buttons/buttons_header.c
@@ -63,7 +63,7 @@ static void set_texture_context(bContext *C, SpaceButs *sbuts)
 		case BCONTEXT_DATA:
 		{
 			Object *ob = CTX_data_active_object(C);
-			if(ob && ob->type==OB_LAMP)
+			if (ob && ob->type==OB_LAMP)
 				sbuts->texture_context = SB_TEXC_MAT_OR_LAMP;
 			break;
 		}
@@ -80,7 +80,7 @@ static void do_buttons_buttons(bContext *C, void *UNUSED(arg), int event)
 {
 	SpaceButs *sbuts= CTX_wm_space_buts(C);
 
-	if(!sbuts) /* editor type switch */
+	if (!sbuts) /* editor type switch */
 		return;
 
 	switch(event) {
@@ -122,8 +122,8 @@ void buttons_header_buttons(const bContext *C, ARegion *ar)
 	uiBlockBeginAlign(block);
 
 #define BUTTON_HEADER_CTX(_ctx, _icon, _tip) \
-	if(sbuts->pathflag & (1<<_ctx)) { \
-		but= uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, _icon, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)_ctx, 0, 0, TIP_(_tip)); \
+	if (sbuts->pathflag & (1<<_ctx)) { \
+		but = uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, _icon, xco+=BUT_UNIT_X, yco, BUT_UNIT_X, UI_UNIT_Y, &(sbuts->mainb), 0.0, (float)_ctx, 0, 0, TIP_(_tip)); \
 		uiButClearFlag(but, UI_BUT_UNDO); \
 	} \
 
diff --git a/source/blender/editors/space_buttons/buttons_intern.h b/source/blender/editors/space_buttons/buttons_intern.h
index aa692a9..8d0f84c 100644
--- a/source/blender/editors/space_buttons/buttons_intern.h
+++ b/source/blender/editors/space_buttons/buttons_intern.h
@@ -28,8 +28,8 @@
  *  \ingroup spbuttons
  */
 
-#ifndef ED_BUTTONS_INTERN_H
-#define ED_BUTTONS_INTERN_H
+#ifndef __BUTTONS_INTERN_H__
+#define __BUTTONS_INTERN_H__
 
 #include "DNA_listBase.h"
 #include "RNA_types.h"
@@ -117,5 +117,5 @@ void BUTTONS_OT_file_browse(struct wmOperatorType *ot);
 void BUTTONS_OT_directory_browse(struct wmOperatorType *ot);
 void BUTTONS_OT_toolbox(struct wmOperatorType *ot);
 
-#endif /* ED_BUTTONS_INTERN_H */
+#endif /* __BUTTONS_INTERN_H__ */
 
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index 26516bc..ec1c740 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -81,13 +81,13 @@ static int toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(e
 void BUTTONS_OT_toolbox(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Toolbox";
-	ot->description="Display button panel toolbox";
-	ot->idname= "BUTTONS_OT_toolbox";
+	ot->name = "Toolbox";
+	ot->description = "Display button panel toolbox";
+	ot->idname = "BUTTONS_OT_toolbox";
 	
 	/* api callbacks */
-	ot->invoke= toolbox_invoke;
-	ot->poll= ED_operator_buttons_active;
+	ot->invoke = toolbox_invoke;
+	ot->poll = ED_operator_buttons_active;
 }
 
 /********************** filebrowse operator *********************/
@@ -110,7 +110,7 @@ static int file_browse_exec(bContext *C, wmOperator *op)
 	str= RNA_string_get_alloc(op->ptr, path_prop, NULL, 0);
 
 	/* add slash for directories, important for some properties */
-	if(RNA_property_subtype(fbo->prop) == PROP_DIRPATH) {
+	if (RNA_property_subtype(fbo->prop) == PROP_DIRPATH) {
 		char name[FILE_MAX];
 		
 		id = fbo->ptr.id.data;
@@ -118,7 +118,7 @@ static int file_browse_exec(bContext *C, wmOperator *op)
 		BLI_strncpy(path, str, FILE_MAX);
 		BLI_path_abs(path, id ? ID_BLEND_PATH(G.main, id) : G.main->name);
 		
-		if(BLI_is_dir(path)) {
+		if (BLI_is_dir(path)) {
 			str = MEM_reallocN(str, strlen(str)+2);
 			BLI_add_slash(str);
 		}
@@ -134,8 +134,8 @@ static int file_browse_exec(bContext *C, wmOperator *op)
 	/* special, annoying exception, filesel on redo panel [#26618] */
 	{
 		wmOperator *redo_op= WM_operator_last_redo(C);
-		if(redo_op) {
-			if(fbo->ptr.data == redo_op->ptr->data) {
+		if (redo_op) {
+			if (fbo->ptr.data == redo_op->ptr->data) {
 				ED_undo_operator_repeat(C, redo_op);
 			}
 		}
@@ -168,19 +168,19 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 	uiFileBrowseContextProperty(C, &ptr, &prop);
 
-	if(!prop)
+	if (!prop)
 		return OPERATOR_CANCELLED;
 
 	str= RNA_property_string_get_alloc(&ptr, prop, NULL, 0, NULL);
 
 	/* useful yet irritating feature, Shift+Click to open the file
 	 * Alt+Click to browse a folder in the OS's browser */
-	if(event->shift || event->alt) {
+	if (event->shift || event->alt) {
 		PointerRNA props_ptr;
 
-		if(event->alt) {
+		if (event->alt) {
 			char *lslash= BLI_last_slash(str);
-			if(lslash)
+			if (lslash)
 				*lslash= '\0';
 		}
 
@@ -205,8 +205,8 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 		/* normally ED_fileselect_get_params would handle this but we need to because of stupid
 		 * user-prefs exception - campbell */
-		if(RNA_struct_find_property(op->ptr, "relative_path")) {
-			if(!RNA_struct_property_is_set(op->ptr, "relative_path")) {
+		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 */
 				RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS && (ptr.data != &U));
 			}
@@ -220,14 +220,14 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event)
 void BUTTONS_OT_file_browse(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Accept";
-	ot->description="Open a file browser, Hold Shift to open the file, Alt to browse containing directory";
-	ot->idname= "BUTTONS_OT_file_browse";
+	ot->name = "Accept";
+	ot->description = "Open a file browser, Hold Shift to open the file, Alt to browse containing directory";
+	ot->idname = "BUTTONS_OT_file_browse";
 	
 	/* api callbacks */
-	ot->invoke= file_browse_invoke;
-	ot->exec= file_browse_exec;
-	ot->cancel= file_browse_cancel;
+	ot->invoke = file_browse_invoke;
+	ot->exec = file_browse_exec;
+	ot->cancel = file_browse_cancel;
 
 	/* properties */
 	WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
@@ -237,14 +237,14 @@ void BUTTONS_OT_file_browse(wmOperatorType *ot)
 void BUTTONS_OT_directory_browse(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Accept";
-	ot->description="Open a directory browser, Hold Shift to open the file, Alt to browse containing directory";
-	ot->idname= "BUTTONS_OT_directory_browse";
+	ot->name = "Accept";
+	ot->description = "Open a directory browser, Hold Shift to open the file, Alt to browse containing directory";
+	ot->idname = "BUTTONS_OT_directory_browse";
 
 	/* api callbacks */
-	ot->invoke= file_browse_invoke;
-	ot->exec= file_browse_exec;
-	ot->cancel= file_browse_cancel;
+	ot->invoke = file_browse_invoke;
+	ot->exec = file_browse_exec;
+	ot->cancel = file_browse_cancel;
 
 	/* properties */
 	WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c
index 6927a78..ba37cb8 100644
--- a/source/blender/editors/space_buttons/buttons_texture.c
+++ b/source/blender/editors/space_buttons/buttons_texture.c
@@ -111,9 +111,9 @@ static void buttons_texture_users_find_nodetree(ListBase *users, ID *id,
 {
 	bNode *node;
 
-	if(ntree) {
-		for(node=ntree->nodes.first; node; node=node->next) {
-			if(node->typeinfo->nclass == NODE_CLASS_TEXTURE) {
+	if (ntree) {
+		for (node=ntree->nodes.first; node; node=node->next) {
+			if (node->typeinfo->nclass == NODE_CLASS_TEXTURE) {
 				PointerRNA ptr;
 				/* PropertyRNA *prop; */ /* UNUSED */
 
@@ -123,7 +123,7 @@ static void buttons_texture_users_find_nodetree(ListBase *users, ID *id,
 				buttons_texture_user_node_add(users, id, ntree, node,
 					category, RNA_struct_ui_icon(ptr.type), node->name);
 			}
-			else if(node->type == NODE_GROUP && node->id) {
+			else if (node->type == NODE_GROUP && node->id) {
 				buttons_texture_users_find_nodetree(users, id, (bNodeTree*)node->id, category);
 			}
 		}
@@ -154,46 +154,46 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext *
 	ID *pinid = sbuts->pinid;
 
 	/* get data from context */
-	if(pinid) {
-		if(GS(pinid->name) == ID_SCE)
+	if (pinid) {
+		if (GS(pinid->name) == ID_SCE)
 			scene= (Scene*)pinid;
-		else if(GS(pinid->name) == ID_OB)
+		else if (GS(pinid->name) == ID_OB)
 			ob= (Object*)pinid;
-		else if(GS(pinid->name) == ID_LA)
+		else if (GS(pinid->name) == ID_LA)
 			la= (Lamp*)pinid;
-		else if(GS(pinid->name) == ID_WO)
+		else if (GS(pinid->name) == ID_WO)
 			wrld= (World*)pinid;
-		else if(GS(pinid->name) == ID_MA)
+		else if (GS(pinid->name) == ID_MA)
 			ma= (Material*)pinid;
-		else if(GS(pinid->name) == ID_BR)
+		else if (GS(pinid->name) == ID_BR)
 			brush= (Brush*)pinid;
 	}
 
-	if(!scene)
+	if (!scene)
 		scene= CTX_data_scene(C);
 	
-	if(!(pinid || pinid == &scene->id)) {
+	if (!(pinid || pinid == &scene->id)) {
 		ob= (scene->basact)? scene->basact->object: NULL;
 		wrld= scene->world;
 		brush= paint_brush(paint_get_active(scene));
 	}
 
-	if(ob && ob->type == OB_LAMP && !la)
+	if (ob && ob->type == OB_LAMP && !la)
 		la= ob->data;
-	if(ob && !ma)
+	if (ob && !ma)
 		ma= give_current_material(ob, ob->actcol);
 
 	/* fill users */
 	users->first = users->last = NULL;
 
-	if(ma)
+	if (ma)
 		buttons_texture_users_find_nodetree(users, &ma->id, ma->nodetree, "Material");
-	if(la)
+	if (la)
 		buttons_texture_users_find_nodetree(users, &la->id, la->nodetree, "Lamp");
-	if(wrld)
+	if (wrld)
 		buttons_texture_users_find_nodetree(users, &wrld->id, wrld->nodetree, "World");
 
-	if(ob) {
+	if (ob) {
 		ParticleSystem *psys= psys_get_current(ob);
 		MTex *mtex;
 		int a;
@@ -202,12 +202,12 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext *
 		modifiers_foreachTexLink(ob, buttons_texture_modifier_foreach, users);
 
 		/* particle systems */
-		if(psys) {
+		if (psys) {
 			/* todo: these slots are not in the UI */
-			for(a=0; a<MAX_MTEX; a++) {
+			for (a=0; a<MAX_MTEX; a++) {
 				mtex = psys->part->mtex[a];
 
-				if(mtex) {
+				if (mtex) {
 					PointerRNA ptr;
 					PropertyRNA *prop;
 
@@ -221,7 +221,7 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext *
 		}
 
 		/* field */
-		if(ob->pd && ob->pd->forcefield == PFIELD_TEXTURE) {
+		if (ob->pd && ob->pd->forcefield == PFIELD_TEXTURE) {
 			PointerRNA ptr;
 			PropertyRNA *prop;
 
@@ -234,7 +234,7 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext *
 	}
 
 	/* brush */
-	if(brush) {
+	if (brush) {
 		PointerRNA ptr;
 		PropertyRNA *prop;
 
@@ -249,12 +249,12 @@ 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
-	   properties editor, before the buttons are created. */
+	 * properties editor, before the buttons are created. */
 	ButsContextTexture *ct= sbuts->texuser;
 	Scene *scene= CTX_data_scene(C);
 
-	if(!scene_use_new_shading_nodes(scene)) {
-		if(ct) {
+	if (!scene_use_new_shading_nodes(scene)) {
+		if (ct) {
 			BLI_freelistN(&ct->users);
 			MEM_freeN(ct);
 			sbuts->texuser= NULL;
@@ -263,7 +263,7 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts)
 		return;
 	}
 
-	if(!ct) {
+	if (!ct) {
 		ct= MEM_callocN(sizeof(ButsContextTexture), "ButsContextTexture");
 		sbuts->texuser= ct;
 	}
@@ -274,14 +274,14 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts)
 	buttons_texture_users_from_context(&ct->users, C, sbuts);
 
 	/* set one user as active based on active index */
-	if(ct->index >= BLI_countlist(&ct->users))
+	if (ct->index >= BLI_countlist(&ct->users))
 		ct->index= 0;
 
 	ct->user = BLI_findlink(&ct->users, ct->index);
 	ct->texture = NULL;
 
-	if(ct->user) {
-		if(ct->user->ptr.data) {
+	if (ct->user) {
+		if (ct->user->ptr.data) {
 			PointerRNA texptr;
 			Tex *tex;
 
@@ -291,14 +291,14 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts)
 
 			ct->texture = tex;
 		}
-		else if(ct->user->node && !(ct->user->node->flag & NODE_ACTIVE_TEXTURE)) {
+		else if (ct->user->node && !(ct->user->node->flag & NODE_ACTIVE_TEXTURE)) {
 			ButsTextureUser *user;
 
 			/* detect change of active texture node in same node tree, in that
-			   case we also automatically switch to the other node */
-			for(user=ct->users.first; user; user=user->next) {
-				if(user->ntree == ct->user->ntree && user->node != ct->user->node) {
-					if(user->node->flag & NODE_ACTIVE_TEXTURE) {
+			 * case we also automatically switch to the other node */
+			for (user=ct->users.first; user; user=user->next) {
+				if (user->ntree == ct->user->ntree && user->node != ct->user->node) {
+					if (user->node->flag & NODE_ACTIVE_TEXTURE) {
 						ct->user = user;
 						ct->index = BLI_findindex(&ct->users, user);
 						break;
@@ -318,11 +318,11 @@ static void template_texture_select(bContext *C, void *user_p, void *UNUSED(arg)
 	PointerRNA texptr;
 	Tex *tex;
 
-	if(!ct)
+	if (!ct)
 		return;
 
 	/* set user as active */
-	if(user->node) {
+	if (user->node) {
 		ED_node_set_active(CTX_data_main(C), user->ntree, user->node);
 		ct->texture = NULL;
 	}
@@ -346,12 +346,12 @@ static void template_texture_user_menu(bContext *C, uiLayout *layout, void *UNUS
 	uiBlock *block = uiLayoutGetBlock(layout);
 	const char *last_category = NULL;
 
-	for(user=ct->users.first; user; user=user->next) {
+	for (user=ct->users.first; user; user=user->next) {
 		uiBut *but;
 		char name[UI_MAX_NAME_STR];
 
 		/* add label per category */
-		if(!last_category || strcmp(last_category, user->category) != 0) {
+		if (!last_category || strcmp(last_category, user->category) != 0) {
 			uiItemL(layout, user->category, ICON_NONE);
 			but= block->buttons.last;
 			but->flag= UI_TEXT_LEFT;
@@ -371,8 +371,8 @@ static void template_texture_user_menu(bContext *C, uiLayout *layout, void *UNUS
 void uiTemplateTextureUser(uiLayout *layout, bContext *C)
 {
 	/* texture user selection dropdown menu. the available users have been
-	   gathered before drawing in ButsContextTexture, we merely need to
-	   display the current item. */
+	 * gathered before drawing in ButsContextTexture, we merely need to
+	 * display the current item. */
 	SpaceButs *sbuts = CTX_wm_space_buts(C);
 	ButsContextTexture *ct= (sbuts)? sbuts->texuser: NULL;
 	uiBlock *block = uiLayoutGetBlock(layout);
@@ -380,13 +380,13 @@ void uiTemplateTextureUser(uiLayout *layout, bContext *C)
 	ButsTextureUser *user;
 	char name[UI_MAX_NAME_STR];
 
-	if(!ct)
+	if (!ct)
 		return;
 
 	/* get current user */
 	user= ct->user;
 
-	if(!user) {
+	if (!user) {
 		uiItemL(layout, "No textures in context.", ICON_NONE);
 		return;
 	}
@@ -394,12 +394,12 @@ void uiTemplateTextureUser(uiLayout *layout, bContext *C)
 	/* create button */
 	BLI_snprintf(name, UI_MAX_NAME_STR, "%s", user->name);
 
-	if(user->icon) {
-		but= uiDefIconTextMenuBut(block, template_texture_user_menu, NULL,
+	if (user->icon) {
+		but = uiDefIconTextMenuBut(block, template_texture_user_menu, NULL,
 			user->icon, name, 0, 0, UI_UNIT_X*4, UI_UNIT_Y, "");
 	}
 	else {
-		but= uiDefMenuBut(block, template_texture_user_menu, NULL,
+		but = uiDefMenuBut(block, template_texture_user_menu, NULL,
 			name, 0, 0, UI_UNIT_X*4, UI_UNIT_Y, "");
 	}
 
@@ -417,14 +417,14 @@ static void template_texture_show(bContext *C, void *data_p, void *prop_p)
 	ButsContextTexture *ct= (sbuts)? sbuts->texuser: NULL;
 	ButsTextureUser *user;
 
-	if(!ct)
+	if (!ct)
 		return;
 
-	for(user=ct->users.first; user; user=user->next)
-		if(user->ptr.data == data_p && user->prop == prop_p)
+	for (user=ct->users.first; user; user=user->next)
+		if (user->ptr.data == data_p && user->prop == prop_p)
 			break;
 	
-	if(user) {
+	if (user) {
 		/* select texture */
 		template_texture_select(C, user, NULL);
 
@@ -446,20 +446,20 @@ void uiTemplateTextureShow(uiLayout *layout, bContext *C, PointerRNA *ptr, Prope
 	ButsTextureUser *user;
 
 	/* only show button in other tabs in properties editor */
-	if(!ct || sbuts->mainb == BCONTEXT_TEXTURE)
+	if (!ct || sbuts->mainb == BCONTEXT_TEXTURE)
 		return;
 
 	/* find corresponding texture user */
-	for(user=ct->users.first; user; user=user->next)
-		if(user->ptr.data == ptr->data && user->prop == prop)
+	for (user=ct->users.first; user; user=user->next)
+		if (user->ptr.data == ptr->data && user->prop == prop)
 			break;
 	
 	/* draw button */
-	if(user) {
+	if (user) {
 		uiBlock *block = uiLayoutGetBlock(layout);
 		uiBut *but;
 		
-		but= uiDefIconBut(block, BUT, 0, ICON_BUTS, 0, 0, UI_UNIT_X, UI_UNIT_Y,
+		but = uiDefIconBut(block, BUT, 0, ICON_BUTS, 0, 0, UI_UNIT_X, UI_UNIT_Y,
 			NULL, 0.0, 0.0, 0.0, 0.0, "Show texture in texture tab");
 		uiButSetFunc(but, template_texture_show, user->ptr.data, user->prop);
 	}
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index e6928e3..f1f4fb3 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -97,10 +97,10 @@ static void buttons_free(SpaceLink *sl)
 {	
 	SpaceButs *sbuts= (SpaceButs*) sl;
 
-	if(sbuts->path)
+	if (sbuts->path)
 		MEM_freeN(sbuts->path);
 	
-	if(sbuts->texuser) {
+	if (sbuts->texuser) {
 		ButsContextTexture *ct= sbuts->texuser;
 		BLI_freelistN(&ct->users);
 		MEM_freeN(ct);
@@ -113,8 +113,8 @@ static void buttons_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
 	SpaceButs *sbuts= sa->spacedata.first;
 
 	/* auto-align based on size */
-	if(sbuts->align == BUT_AUTO || !sbuts->align) {
-		if(sa->winx > sa->winy)
+	if (sbuts->align == BUT_AUTO || !sbuts->align) {
+		if (sa->winx > sa->winy)
 			sbuts->align= BUT_HORIZONTAL;
 		else
 			sbuts->align= BUT_VERTICAL;
@@ -139,7 +139,7 @@ static void buttons_main_area_init(wmWindowManager *wm, ARegion *ar)
 
 	ED_region_panels_init(wm, ar);
 
-	keymap= WM_keymap_find(wm->defaultconf, "Property Editor", SPACE_BUTS, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Property Editor", SPACE_BUTS, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
@@ -151,31 +151,31 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar)
 
 	buttons_context_compute(C, sbuts);
 
-	if(sbuts->mainb == BCONTEXT_SCENE)
+	if (sbuts->mainb == BCONTEXT_SCENE)
 		ED_region_panels(C, ar, vertical, "scene", sbuts->mainb);
-	else if(sbuts->mainb == BCONTEXT_RENDER)
+	else if (sbuts->mainb == BCONTEXT_RENDER)
 		ED_region_panels(C, ar, vertical, "render", sbuts->mainb);
-	else if(sbuts->mainb == BCONTEXT_WORLD)
+	else if (sbuts->mainb == BCONTEXT_WORLD)
 		ED_region_panels(C, ar, vertical, "world", sbuts->mainb);
-	else if(sbuts->mainb == BCONTEXT_OBJECT)
+	else if (sbuts->mainb == BCONTEXT_OBJECT)
 		ED_region_panels(C, ar, vertical, "object", sbuts->mainb);
-	else if(sbuts->mainb == BCONTEXT_DATA)
+	else if (sbuts->mainb == BCONTEXT_DATA)
 		ED_region_panels(C, ar, vertical, "data", sbuts->mainb);
-	else if(sbuts->mainb == BCONTEXT_MATERIAL)
+	else if (sbuts->mainb == BCONTEXT_MATERIAL)
 		ED_region_panels(C, ar, vertical, "material", sbuts->mainb);
-	else if(sbuts->mainb == BCONTEXT_TEXTURE)
+	else if (sbuts->mainb == BCONTEXT_TEXTURE)
 		ED_region_panels(C, ar, vertical, "texture", sbuts->mainb);
-	else if(sbuts->mainb == BCONTEXT_PARTICLE)
+	else if (sbuts->mainb == BCONTEXT_PARTICLE)
 		ED_region_panels(C, ar, vertical, "particle", sbuts->mainb);
-	else if(sbuts->mainb == BCONTEXT_PHYSICS)
+	else if (sbuts->mainb == BCONTEXT_PHYSICS)
 		ED_region_panels(C, ar, vertical, "physics", sbuts->mainb);
-	else if(sbuts->mainb == BCONTEXT_BONE)
+	else if (sbuts->mainb == BCONTEXT_BONE)
 		ED_region_panels(C, ar, vertical, "bone", sbuts->mainb);
-	else if(sbuts->mainb == BCONTEXT_MODIFIER)
+	else if (sbuts->mainb == BCONTEXT_MODIFIER)
 		ED_region_panels(C, ar, vertical, "modifier", sbuts->mainb);
 	else if (sbuts->mainb == BCONTEXT_CONSTRAINT)
 		ED_region_panels(C, ar, vertical, "constraint", sbuts->mainb);
-	else if(sbuts->mainb == BCONTEXT_BONE_CONSTRAINT)
+	else if (sbuts->mainb == BCONTEXT_BONE_CONSTRAINT)
 		ED_region_panels(C, ar, vertical, "bone_constraint", sbuts->mainb);
 
 	sbuts->re_align= 0;
@@ -191,7 +191,7 @@ static void buttons_operatortypes(void)
 
 static void buttons_keymap(struct wmKeyConfig *keyconf)
 {
-	wmKeyMap *keymap= WM_keymap_find(keyconf, "Property Editor", SPACE_BUTS, 0);
+	wmKeyMap *keymap = WM_keymap_find(keyconf, "Property Editor", SPACE_BUTS, 0);
 	
 	WM_keymap_add_item(keymap, "BUTTONS_OT_toolbox", RIGHTMOUSE, KM_PRESS, 0, 0);
 }
@@ -224,7 +224,7 @@ static void buttons_area_redraw(ScrArea *sa, short buttons)
 	SpaceButs *sbuts= sa->spacedata.first;
 	
 	/* if the area's current button set is equal to the one to redraw */
-	if(sbuts->mainb == buttons)
+	if (sbuts->mainb == buttons)
 		ED_area_tag_redraw(sa);
 }
 
@@ -273,9 +273,10 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
 				case ND_BONE_SELECT:
 					buttons_area_redraw(sa, BCONTEXT_BONE);
 					buttons_area_redraw(sa, BCONTEXT_BONE_CONSTRAINT);
+					buttons_area_redraw(sa, BCONTEXT_DATA);
 					break;
 				case ND_MODIFIER:
-					if(wmn->action == NA_RENAME)
+					if (wmn->action == NA_RENAME)
 						ED_area_tag_redraw(sa);
 					else
 						buttons_area_redraw(sa, BCONTEXT_MODIFIER);
@@ -341,11 +342,11 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
 			sbuts->preview= 1;
 			break;
 		case NC_SPACE:
-			if(wmn->data == ND_SPACE_PROPERTIES)
+			if (wmn->data == ND_SPACE_PROPERTIES)
 				ED_area_tag_redraw(sa);
 			break;
 		case NC_ID:
-			if(wmn->action == NA_RENAME)
+			if (wmn->action == NA_RENAME)
 				ED_area_tag_redraw(sa);
 			break;
 		case NC_ANIMATION:
@@ -357,10 +358,10 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
 			}
 			break;
 		case NC_NODE:
-			if(wmn->action==NA_SELECTED) {
+			if (wmn->action==NA_SELECTED) {
 				ED_area_tag_redraw(sa);
 				/* new active node, update texture preview */
-				if(sbuts->mainb == BCONTEXT_TEXTURE)
+				if (sbuts->mainb == BCONTEXT_TEXTURE)
 					sbuts->preview= 1;
 			}
 			break;
@@ -371,7 +372,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
 			break;
 	}
 
-	if(wmn->data == ND_KEYS)
+	if (wmn->data == ND_KEYS)
 		ED_area_tag_redraw(sa);
 }
 
diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c
index ddfd403..eabd64b 100644
--- a/source/blender/editors/space_clip/clip_buttons.c
+++ b/source/blender/editors/space_clip/clip_buttons.c
@@ -67,11 +67,11 @@ void ED_clip_buttons_register(ARegionType *art)
 {
 	PanelType *pt;
 
-	pt= MEM_callocN(sizeof(PanelType), "spacetype clip panel gpencil");
+	pt = MEM_callocN(sizeof(PanelType), "spacetype clip panel gpencil");
 	strcpy(pt->idname, "CLIP_PT_gpencil");
 	strcpy(pt->label, "Grease Pencil");
-	pt->draw= gpencil_panel_standard;
-	pt->flag|= PNL_DEFAULT_CLOSED;
+	pt->draw = gpencil_panel_standard;
+	pt->flag |= PNL_DEFAULT_CLOSED;
 	BLI_addtail(&art->paneltypes, pt);
 }
 
@@ -85,38 +85,38 @@ void uiTemplateMovieClip(uiLayout *layout, bContext *C, PointerRNA *ptr, const c
 	uiLayout *row, *split;
 	uiBlock *block;
 
-	if(!ptr->data)
+	if (!ptr->data)
 		return;
 
-	prop= RNA_struct_find_property(ptr, propname);
-	if(!prop) {
+	prop = RNA_struct_find_property(ptr, propname);
+	if (!prop) {
 		printf("%s: property not found: %s.%s\n",
 		       __func__, RNA_struct_identifier(ptr->type), propname);
 		return;
 	}
 
-	if(RNA_property_type(prop) != PROP_POINTER) {
+	if (RNA_property_type(prop) != PROP_POINTER) {
 		printf("%s: expected pointer property for %s.%s\n",
 		       __func__, RNA_struct_identifier(ptr->type), propname);
 		return;
 	}
 
-	clipptr= RNA_property_pointer_get(ptr, prop);
-	clip= clipptr.data;
+	clipptr = RNA_property_pointer_get(ptr, prop);
+	clip = clipptr.data;
 
 	uiLayoutSetContextPointer(layout, "edit_movieclip", &clipptr);
 
-	if(!compact)
+	if (!compact)
 		uiTemplateID(layout, C, ptr, propname, NULL, "CLIP_OT_open", NULL);
 
-	if(clip) {
-		row= uiLayoutRow(layout, 0);
-		block= uiLayoutGetBlock(row);
+	if (clip) {
+		row = uiLayoutRow(layout, 0);
+		block = uiLayoutGetBlock(row);
 		uiDefBut(block, LABEL, 0, "File Path:", 0, 19, 145, 19, NULL, 0, 0, 0, 0, "");
 
-		row= uiLayoutRow(layout, 0);
+		row = uiLayoutRow(layout, 0);
 		split = uiLayoutSplit(row, 0.0, 0);
-		row= uiLayoutRow(split, 1);
+		row = uiLayoutRow(split, 1);
 
 		uiItemR(row, &clipptr, "filepath", 0, "", ICON_NONE);
 		uiItemO(row, "", ICON_FILE_REFRESH, "clip.reload");
@@ -133,31 +133,31 @@ void uiTemplateTrack(uiLayout *layout, PointerRNA *ptr, const char *propname)
 	rctf rect;
 	MovieClipScopes *scopes;
 
-	if(!ptr->data)
+	if (!ptr->data)
 		return;
 
-	prop= RNA_struct_find_property(ptr, propname);
-	if(!prop) {
+	prop = RNA_struct_find_property(ptr, propname);
+	if (!prop) {
 		printf("%s: property not found: %s.%s\n",
 		       __func__, RNA_struct_identifier(ptr->type), propname);
 		return;
 	}
 
-	if(RNA_property_type(prop) != PROP_POINTER) {
+	if (RNA_property_type(prop) != PROP_POINTER) {
 		printf("%s: expected pointer property for %s.%s\n",
 		       __func__, RNA_struct_identifier(ptr->type), propname);
 		return;
 	}
 
-	scopesptr= RNA_property_pointer_get(ptr, prop);
-	scopes= (MovieClipScopes *)scopesptr.data;
+	scopesptr = RNA_property_pointer_get(ptr, prop);
+	scopes = (MovieClipScopes *)scopesptr.data;
 
-	rect.xmin= 0; rect.xmax= 200;
-	rect.ymin= 0; rect.ymax= 120;
+	rect.xmin = 0; rect.xmax = 200;
+	rect.ymin = 0; rect.ymax = 120;
 
-	block= uiLayoutAbsoluteBlock(layout);
+	block = uiLayoutAbsoluteBlock(layout);
 
-	scopes->track_preview_height= (scopes->track_preview_height<=UI_UNIT_Y)?UI_UNIT_Y:scopes->track_preview_height;
+	scopes->track_preview_height = (scopes->track_preview_height<=UI_UNIT_Y)?UI_UNIT_Y:scopes->track_preview_height;
 
 	uiDefBut(block, TRACKPREVIEW, 0, "", rect.xmin, rect.ymin, rect.xmax-rect.xmin, scopes->track_preview_height, scopes, 0, 0, 0, 0, "");
 }
@@ -189,89 +189,89 @@ typedef struct {
 static void to_pixel_space(float r[2], float a[2], int width, int height)
 {
 	copy_v2_v2(r, a);
-	r[0]*= width;
-	r[1]*= height;
+	r[0] *= width;
+	r[1] *= height;
 }
 
 static void marker_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg))
 {
-	MarkerUpdateCb *cb= (MarkerUpdateCb*) arg_cb;
+	MarkerUpdateCb *cb = (MarkerUpdateCb*) arg_cb;
 	MovieTrackingMarker *marker;
 
-	if(!cb->compact)
+	if (!cb->compact)
 		return;
 
-	marker= BKE_tracking_ensure_marker(cb->track, cb->framenr);
+	marker = BKE_tracking_ensure_marker(cb->track, cb->framenr);
 
-	marker->flag= cb->marker_flag;
+	marker->flag = cb->marker_flag;
 
 	WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, NULL);
 }
 
 static void marker_block_handler(bContext *C, void *arg_cb, int event)
 {
-	MarkerUpdateCb *cb= (MarkerUpdateCb*) arg_cb;
+	MarkerUpdateCb *cb = (MarkerUpdateCb*) arg_cb;
 	MovieTrackingMarker *marker;
-	int width, height, ok= 0;
+	int width, height, ok = FALSE;
 
 	BKE_movieclip_get_size(cb->clip, cb->user, &width, &height);
 
-	marker= BKE_tracking_ensure_marker(cb->track, cb->framenr);
+	marker = BKE_tracking_ensure_marker(cb->track, cb->framenr);
 
-	if(event==B_MARKER_POS) {
-		marker->pos[0]= cb->marker_pos[0]/width;
-		marker->pos[1]= cb->marker_pos[1]/height;
+	if (event == B_MARKER_POS) {
+		marker->pos[0] = cb->marker_pos[0]/width;
+		marker->pos[1] = cb->marker_pos[1]/height;
 
 		/* to update position of "parented" objects */
 		DAG_id_tag_update(&cb->clip->id, 0);
 		WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-		ok= 1;
+		ok = TRUE;
 	}
-	else if(event==B_MARKER_PAT_DIM) {
+	else if (event == B_MARKER_PAT_DIM) {
 		float dim[2], pat_dim[2];
 
 		sub_v2_v2v2(pat_dim, cb->track->pat_max, cb->track->pat_min);
 
-		dim[0]= cb->track_pat[0]/width;
-		dim[1]= cb->track_pat[1]/height;
+		dim[0] = cb->track_pat[0] / width;
+		dim[1] = cb->track_pat[1] / height;
 
 		sub_v2_v2(dim, pat_dim);
 		mul_v2_fl(dim, 0.5f);
 
-		cb->track->pat_min[0]-= dim[0];
-		cb->track->pat_min[1]-= dim[1];
+		cb->track->pat_min[0] -= dim[0];
+		cb->track->pat_min[1] -= dim[1];
 
-		cb->track->pat_max[0]+= dim[0];
-		cb->track->pat_max[1]+= dim[1];
+		cb->track->pat_max[0] += dim[0];
+		cb->track->pat_max[1] += dim[1];
 
 		BKE_tracking_clamp_track(cb->track, CLAMP_PAT_DIM);
 
-		ok= 1;
+		ok = TRUE;
 	}
-	else if(event==B_MARKER_SEARCH_POS) {
+	else if (event == B_MARKER_SEARCH_POS) {
 		float delta[2], side[2];
 
 		sub_v2_v2v2(side, cb->track->search_max, cb->track->search_min);
 		mul_v2_fl(side, 0.5f);
 
-		delta[0]= cb->track_search_pos[0]/width;
-		delta[1]= cb->track_search_pos[1]/height;
+		delta[0] = cb->track_search_pos[0] / width;
+		delta[1] = cb->track_search_pos[1] / height;
 
 		sub_v2_v2v2(cb->track->search_min, delta, side);
 		add_v2_v2v2(cb->track->search_max, delta, side);
 
 		BKE_tracking_clamp_track(cb->track, CLAMP_SEARCH_POS);
 
-		ok= 1;
+		ok = TRUE;
 	}
-	else if(event==B_MARKER_SEARCH_DIM) {
+	else if (event == B_MARKER_SEARCH_DIM) {
 		float dim[2], search_dim[2];
 
 		sub_v2_v2v2(search_dim, cb->track->search_max, cb->track->search_min);
 
-		dim[0]= cb->track_search[0]/width;
-		dim[1]= cb->track_search[1]/height;
+		dim[0] = cb->track_search[0]/width;
+		dim[1] = cb->track_search[1]/height;
 
 		sub_v2_v2(dim, search_dim);
 		mul_v2_fl(dim, 0.5f);
@@ -284,32 +284,34 @@ static void marker_block_handler(bContext *C, void *arg_cb, int event)
 
 		BKE_tracking_clamp_track(cb->track, CLAMP_SEARCH_DIM);
 
-		ok= 1;
-	} else if(event==B_MARKER_FLAG) {
-		marker->flag= cb->marker_flag;
+		ok = TRUE;
+	}
+	else if (event == B_MARKER_FLAG) {
+		marker->flag = cb->marker_flag;
 
-		ok= 1;
-	} else if(event==B_MARKER_OFFSET) {
+		ok = TRUE;
+	}
+	else if (event == B_MARKER_OFFSET) {
 		float offset[2], delta[2];
 		int i;
 
-		offset[0]= cb->track_offset[0]/width;
-		offset[1]= cb->track_offset[1]/height;
+		offset[0] = cb->track_offset[0] / width;
+		offset[1] = cb->track_offset[1] / height;
 
 		sub_v2_v2v2(delta, offset, cb->track->offset);
 		copy_v2_v2(cb->track->offset, offset);
 
-		for(i=0; i<cb->track->markersnr; i++)
+		for (i = 0; i < cb->track->markersnr; i++)
 			sub_v2_v2(cb->track->markers[i].pos, delta);
 
 		/* to update position of "parented" objects */
 		DAG_id_tag_update(&cb->clip->id, 0);
 		WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-		ok= 1;
+		ok = TRUE;
 	}
 
-	if(ok)
+	if (ok)
 		WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, cb->clip);
 }
 
@@ -326,64 +328,65 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P
 	MarkerUpdateCb *cb;
 	const char *tip;
 
-	if(!ptr->data)
+	if (!ptr->data)
 		return;
 
-	prop= RNA_struct_find_property(ptr, propname);
-	if(!prop) {
+	prop = RNA_struct_find_property(ptr, propname);
+	if (!prop) {
 		printf("%s: property not found: %s.%s\n",
 		       __func__, RNA_struct_identifier(ptr->type), propname);
 		return;
 	}
 
-	if(RNA_property_type(prop) != PROP_POINTER) {
+	if (RNA_property_type(prop) != PROP_POINTER) {
 		printf("%s: expected pointer property for %s.%s\n",
 		       __func__, RNA_struct_identifier(ptr->type), propname);
 		return;
 	}
 
-	clipptr= RNA_property_pointer_get(ptr, prop);
-	clip= (MovieClip *)clipptr.data;
-	user= userptr->data;
-	track= trackptr->data;
+	clipptr = RNA_property_pointer_get(ptr, prop);
+	clip = (MovieClip *)clipptr.data;
+	user = userptr->data;
+	track = trackptr->data;
 
-	marker= BKE_tracking_get_marker(track, user->framenr);
+	marker = BKE_tracking_get_marker(track, user->framenr);
 
-	cb= MEM_callocN(sizeof(MarkerUpdateCb), "uiTemplateMarker update_cb");
-	cb->compact= compact;
-	cb->clip= clip;
-	cb->user= user;
-	cb->track= track;
-	cb->marker_flag= marker->flag;
-	cb->framenr= user->framenr;
+	cb = MEM_callocN(sizeof(MarkerUpdateCb), "uiTemplateMarker update_cb");
+	cb->compact = compact;
+	cb->clip = clip;
+	cb->user = user;
+	cb->track = track;
+	cb->marker_flag = marker->flag;
+	cb->framenr = user->framenr;
 
-	if(compact) {
-		block= uiLayoutGetBlock(layout);
+	if (compact) {
+		block = uiLayoutGetBlock(layout);
 
-		if(cb->marker_flag&MARKER_DISABLED)
+		if (cb->marker_flag & MARKER_DISABLED)
 			tip= "Marker is disabled at current frame";
 		else
 			tip= "Marker is enabled at current frame";
 
-		bt= uiDefIconButBitI(block, TOGN, MARKER_DISABLED, 0, ICON_RESTRICT_VIEW_OFF, 0, 0, 20, 20, &cb->marker_flag, 0, 0, 1, 0, tip);
+		bt = uiDefIconButBitI(block, TOGN, MARKER_DISABLED, 0, ICON_RESTRICT_VIEW_OFF, 0, 0, 20, 20, &cb->marker_flag, 0, 0, 1, 0, tip);
 		uiButSetNFunc(bt, marker_update_cb, cb, NULL);
-	} else {
+	}
+	else {
 		int width, height, step, digits;
 		float pat_dim[2], pat_pos[2], search_dim[2], search_pos[2];
 		uiLayout *col;
 
 		BKE_movieclip_get_size(clip, user, &width, &height);
 
-		if(track->flag&TRACK_LOCKED) {
+		if (track->flag & TRACK_LOCKED) {
 			uiLayoutSetActive(layout, 0);
-			block= uiLayoutAbsoluteBlock(layout);
+			block = uiLayoutAbsoluteBlock(layout);
 			uiDefBut(block, LABEL, 0, "Track is locked", 0, 0, 300, 19, NULL, 0, 0, 0, 0, "");
 
 			return;
 		}
 
 		step= 100;
-		digits= 2;
+		digits = 2;
 
 		sub_v2_v2v2(pat_dim, track->pat_max, track->pat_min);
 		sub_v2_v2v2(search_dim, track->search_max, track->search_min);
@@ -400,13 +403,13 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P
 		to_pixel_space(cb->track_search_pos, search_pos, width, height);
 		to_pixel_space(cb->track_offset, track->offset, width, height);
 
-		cb->marker_flag= marker->flag;
+		cb->marker_flag = marker->flag;
 
 		block= uiLayoutAbsoluteBlock(layout);
 		uiBlockSetHandleFunc(block, marker_block_handler, cb);
 		uiBlockSetNFunc(block, marker_update_cb, cb, NULL);
 
-		if(cb->marker_flag&MARKER_DISABLED)
+		if (cb->marker_flag & MARKER_DISABLED)
 			tip= "Marker is disabled at current frame";
 		else
 			tip= "Marker is enabled at current frame";
@@ -414,10 +417,10 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P
 		uiDefButBitI(block, OPTIONN, MARKER_DISABLED, B_MARKER_FLAG,  "Enabled", 10, 190, 145, 19, &cb->marker_flag,
 			0, 0, 0, 0, tip);
 
-		col= uiLayoutColumn(layout, 1);
+		col = uiLayoutColumn(layout, 1);
 		uiLayoutSetActive(col, (cb->marker_flag&MARKER_DISABLED)==0);
 
-		block= uiLayoutAbsoluteBlock(col);
+		block = uiLayoutAbsoluteBlock(col);
 		uiBlockBeginAlign(block);
 
 		uiDefBut(block, LABEL, 0, "Position:", 0, 190, 300, 19, NULL, 0, 0, 0, 0, "");
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index 49fa783..bf89760 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -73,8 +73,8 @@
 
 void clip_draw_curfra_label(SpaceClip *sc, float x, float y)
 {
-	uiStyle *style= UI_GetStyle();
-	int fontid= style->widget.uifont_id;
+	uiStyle *style = UI_GetStyle();
+	int fontid = style->widget.uifont_id;
 	char numstr[32];
 	float font_dims[2] = {0.0f, 0.0f};
 
@@ -95,9 +95,9 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
 {
 	float x;
 	int *points, totseg, i, a;
-	float sfra= SFRA, efra= EFRA, framelen= ar->winx/(efra-sfra+1);
-	MovieTrackingTrack *act_track= BKE_tracking_active_track(&clip->tracking);
-	MovieTrackingReconstruction *reconstruction= BKE_tracking_get_reconstruction(&clip->tracking);
+	float sfra = SFRA, efra = EFRA, framelen = ar->winx / (efra - sfra + 1);
+	MovieTrackingTrack *act_track = BKE_tracking_active_track(&clip->tracking);
+	MovieTrackingReconstruction *reconstruction = BKE_tracking_get_reconstruction(&clip->tracking);
 
 	glEnable(GL_BLEND);
 
@@ -107,83 +107,88 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
 
 	/* cached segments -- could be usefu lto debug caching strategies */
 	BKE_movieclip_get_cache_segments(clip, &sc->user, &totseg, &points);
-	if(totseg) {
+	if (totseg) {
 		glColor4ub(128, 128, 255, 128);
 
-		for(a= 0; a<totseg; a++) {
+		for (a = 0; a < totseg; a++) {
 			float x1, x2;
 
-			x1= (points[a*2]-sfra)/(efra-sfra+1)*ar->winx;
-			x2= (points[a*2+1]-sfra+1)/(efra-sfra+1)*ar->winx;
+			x1 = (points[a * 2] - sfra) / (efra - sfra + 1) * ar->winx;
+			x2 = (points[a * 2 + 1] - sfra + 1) / (efra - sfra + 1) * ar->winx;
 
 			glRecti(x1, 0, x2, 8);
 		}
 	}
 
 	/* track */
-	if(act_track) {
-		MovieTrackingTrack *track= act_track;
+	if (act_track) {
+		MovieTrackingTrack *track = act_track;
 
-		for(i= sfra, a= 0; i <= efra; i++) {
+		for (i = sfra, a = 0; i <= efra; i++) {
 			int framenr;
 			MovieTrackingMarker *marker;
 
-			while(a<track->markersnr) {
-				if(track->markers[a].framenr>=i)
+			while (a<track->markersnr) {
+				if (track->markers[a].framenr >= i)
 					break;
 
-				if(a<track->markersnr-1 && track->markers[a+1].framenr>i)
+				if (a < track->markersnr - 1 && track->markers[a + 1].framenr > i)
 					break;
 
 				a++;
 			}
 
-			if(a<track->markersnr) marker= &track->markers[a];
-			else marker= &track->markers[track->markersnr-1];
+			if (a < track->markersnr)
+				marker = &track->markers[a];
+			else
+				marker = &track->markers[track->markersnr - 1];
 
-			if((marker->flag&MARKER_DISABLED)==0) {
-				framenr= marker->framenr;
+			if ((marker->flag & MARKER_DISABLED) == 0) {
+				framenr = marker->framenr;
 
-				if(framenr!=i) glColor4ub(128, 128, 0, 96);
-				else if((marker->flag&MARKER_TRACKED)==0) glColor4ub(255, 255, 0, 196);
-				else glColor4ub(255, 255, 0, 96);
+				if (framenr != i)
+					glColor4ub(128, 128, 0, 96);
+				else if ((marker->flag & MARKER_TRACKED) == 0)
+					glColor4ub(255, 255, 0, 196);
+				else
+					glColor4ub(255, 255, 0, 96);
 
-				glRecti((i-sfra)*framelen, 0, (i-sfra+1)*framelen, 4);
+				glRecti((i - sfra) * framelen, 0, (i - sfra + 1)*framelen, 4);
 			}
 		}
 	}
 
 	/* failed frames */
-	if(reconstruction->flag&TRACKING_RECONSTRUCTED) {
-		int n= reconstruction->camnr;
-		MovieReconstructedCamera *cameras= reconstruction->cameras;
+	if (reconstruction->flag & TRACKING_RECONSTRUCTED) {
+		int n = reconstruction->camnr;
+		MovieReconstructedCamera *cameras = reconstruction->cameras;
 
 		glColor4ub(255, 0, 0, 96);
 
-		for(i= sfra, a= 0; i <= efra; i++) {
-			int ok= 0;
+		for (i = sfra, a = 0; i <= efra; i++) {
+			int ok = FALSE;
 
-			while(a<n) {
-				if(cameras[a].framenr==i) {
-					ok= 1;
+			while (a < n) {
+				if (cameras[a].framenr == i) {
+					ok = TRUE;
 					break;
 				}
-				else if(cameras[a].framenr>i) {
+				else if (cameras[a].framenr > i) {
 					break;
 				}
 
 				a++;
 			}
 
-			if(!ok)
-				glRecti((i-sfra)*framelen, 0, (i-sfra+1)*framelen, 8);
+			if (!ok)
+				glRecti((i - sfra) * framelen, 0, (i - sfra + 1) * framelen, 8);
 		}
 	}
 
 	glDisable(GL_BLEND);
 
 	/* current frame */
-	x= (sc->user.framenr-sfra)/(efra-sfra+1)*ar->winx;
+	x = (sc->user.framenr - sfra) / (efra - sfra + 1) * ar->winx;
 
 	UI_ThemeColor(TH_CFRAME);
 	glRecti(x, 0, x+framelen, 8);
@@ -193,28 +198,36 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
 
 static void draw_movieclip_notes(SpaceClip *sc, ARegion *ar)
 {
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
-	char str[256]= {0};
-	int block= 0;
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	char str[256] = {0};
+	int block = FALSE;
 
-	if(tracking->stats) {
+	if (tracking->stats) {
 		BLI_strncpy(str, tracking->stats->message, sizeof(str));
-		block= 1;
-	} else {
-		if(sc->flag&SC_LOCK_SELECTION)
+		block = TRUE;
+	}
+	else {
+		if (sc->flag & SC_LOCK_SELECTION)
 			strcpy(str, "Locked");
 	}
 
-	if(str[0])
+	if (str[0])
 		ED_region_info_draw(ar, str, block, 0.6f);
 }
 
+static void verify_buffer_float(ImBuf *ibuf)
+{
+	if (ibuf->rect_float && (ibuf->rect == NULL || (ibuf->userflags & IB_RECT_INVALID))) {
+		IMB_rect_from_float(ibuf);
+	}
+}
+
 static void draw_movieclip_buffer(SpaceClip *sc, ARegion *ar, ImBuf *ibuf,
-			int width, int height, float zoomx, float zoomy)
+                                  int width, int height, float zoomx, float zoomy)
 {
 	int x, y;
-	MovieClip *clip= ED_space_clip(sc);
+	MovieClip *clip = ED_space_clip(sc);
 
 	/* set zoom */
 	glPixelZoom(zoomx*width/ibuf->x, zoomy*height/ibuf->y);
@@ -222,20 +235,19 @@ static void draw_movieclip_buffer(SpaceClip *sc, ARegion *ar, ImBuf *ibuf,
 	/* find window pixel coordinates of origin */
 	UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &x, &y);
 
-	if(sc->flag&SC_MUTE_FOOTAGE) {
+	if (sc->flag & SC_MUTE_FOOTAGE) {
 		glColor3f(0.0f, 0.0f, 0.0f);
-		glRectf(x, y, x+zoomx*width, y+zoomy*height);
-	} else {
-		if(ibuf->rect_float && !ibuf->rect) {
-			IMB_rect_from_float(ibuf);
-		}
+		glRectf(x, y, x + zoomx * width, y + zoomy * height);
+	}
+	else {
+		verify_buffer_float(ibuf);
 
-		if(ibuf->rect)
+		if (ibuf->rect)
 			glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
 	}
 
 	/* draw boundary border for frame if stabilization is enabled */
-	if(sc->flag&SC_SHOW_STABLE && clip->tracking.stabilization.flag&TRACKING_2D_STABILIZATION) {
+	if (sc->flag & SC_SHOW_STABLE && clip->tracking.stabilization.flag & TRACKING_2D_STABILIZATION) {
 		glColor3f(0.0f, 0.0f, 0.0f);
 		glLineStipple(3, 0xaaaa);
 		glEnable(GL_LINE_STIPPLE);
@@ -268,69 +280,72 @@ static void draw_movieclip_buffer(SpaceClip *sc, ARegion *ar, ImBuf *ibuf,
 
 static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackingTrack *track)
 {
-	int count= sc->path_length;
-	int i, a, b, curindex= -1;
+	int count = sc->path_length;
+	int i, a, b, curindex = -1;
 	float path[102][2];
-	int tiny= sc->flag&SC_SHOW_TINY_MARKER, framenr;
+	int tiny = sc->flag&SC_SHOW_TINY_MARKER, framenr;
 	MovieTrackingMarker *marker;
 
-	if(count==0)
+	if (count == 0)
 		return;
 
-	marker= BKE_tracking_get_marker(track, sc->user.framenr);
-	if(marker->framenr!=sc->user.framenr || marker->flag&MARKER_DISABLED)
+	marker = BKE_tracking_get_marker(track, sc->user.framenr);
+	if (marker->framenr != sc->user.framenr || marker->flag & MARKER_DISABLED)
 		return;
 
-	framenr= marker->framenr;
+	framenr = marker->framenr;
 
-	a= count;
-	i= framenr-1;
-	while(i>=framenr-count) {
-		marker= BKE_tracking_get_marker(track, i);
+	a = count;
+	i = framenr - 1;
+	while (i >= framenr - count) {
+		marker = BKE_tracking_get_marker(track, i);
 
-		if(!marker || marker->flag&MARKER_DISABLED)
+		if (!marker || marker->flag & MARKER_DISABLED)
 			break;
 
-		if(marker->framenr==i) {
+		if (marker->framenr == i) {
 			add_v2_v2v2(path[--a], marker->pos, track->offset);
 			ED_clip_point_undistorted_pos(sc, path[a], path[a]);
 
-			if(marker->framenr==sc->user.framenr)
-				curindex= a;
-		} else
+			if (marker->framenr == sc->user.framenr)
+				curindex = a;
+		}
+		else {
 			break;
+		}
 
 		i--;
 	}
 
-	b= count;
-	i= framenr;
-	while(i<=framenr+count) {
-		marker= BKE_tracking_get_marker(track, i);
+	b = count;
+	i = framenr;
+	while (i <= framenr+count) {
+		marker = BKE_tracking_get_marker(track, i);
 
-		if(!marker || marker->flag&MARKER_DISABLED)
+		if (!marker || marker->flag & MARKER_DISABLED)
 			break;
 
-		if(marker->framenr==i) {
-			if(marker->framenr==sc->user.framenr)
+		if (marker->framenr == i) {
+			if (marker->framenr == sc->user.framenr)
 				curindex= b;
 
 			add_v2_v2v2(path[b++], marker->pos, track->offset);
 			ED_clip_point_undistorted_pos(sc, path[b-1], path[b-1]);
-		} else
+		}
+		else
 			break;
 
 		i++;
 	}
 
-	if(!tiny) {
+	if (!tiny) {
 		UI_ThemeColor(TH_MARKER_OUTLINE);
 
-		if(TRACK_VIEW_SELECTED(sc, track)) {
+		if (TRACK_VIEW_SELECTED(sc, track)) {
 			glPointSize(5.0f);
 			glBegin(GL_POINTS);
-				for(i= a; i<b; i++) {
-					if(i!=curindex)
+				for (i = a; i < b; i++) {
+					if (i != curindex)
 						glVertex2f(path[i][0], path[i][1]);
 				}
 			glEnd();
@@ -338,7 +353,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
 
 		glLineWidth(3.0f);
 		glBegin(GL_LINE_STRIP);
-			for(i= a; i<b; i++)
+			for (i = a; i < b; i++)
 				glVertex2f(path[i][0], path[i][1]);
 		glEnd();
 		glLineWidth(1.0f);
@@ -346,14 +361,14 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
 
 	UI_ThemeColor(TH_PATH_BEFORE);
 
-	if(TRACK_VIEW_SELECTED(sc, track)) {
+	if (TRACK_VIEW_SELECTED(sc, track)) {
 		glPointSize(3.0f);
 		glBegin(GL_POINTS);
-			for(i= a; i<b; i++) {
-				if(i==count+1)
+			for (i = a; i < b; i++) {
+				if (i == count + 1)
 					UI_ThemeColor(TH_PATH_AFTER);
 
-				if(i!=curindex)
+				if (i != curindex)
 					glVertex2f(path[i][0], path[i][1]);
 			}
 		glEnd();
@@ -362,8 +377,8 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
 	UI_ThemeColor(TH_PATH_BEFORE);
 
 	glBegin(GL_LINE_STRIP);
-		for(i= a; i<b; i++) {
-			if(i==count+1)
+		for (i = a; i < b; i++) {
+			if (i == count + 1)
 				UI_ThemeColor(TH_PATH_AFTER);
 
 			glVertex2f(path[i][0], path[i][1]);
@@ -374,16 +389,16 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
 
 static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker, float marker_pos[2], int width, int height)
 {
-	int tiny= sc->flag&SC_SHOW_TINY_MARKER;
-	int show_search= 0;
+	int tiny = sc->flag&SC_SHOW_TINY_MARKER;
+	int show_search = FALSE;
 	float px[2];
 
 	UI_ThemeColor(TH_MARKER_OUTLINE);
 
-	px[0]= 1.0f/width/sc->zoom;
-	px[1]= 1.0f/height/sc->zoom;
+	px[0] = 1.0f / width / sc->zoom;
+	px[1] = 1.0f / height / sc->zoom;
 
-	if((marker->flag&MARKER_DISABLED)==0) {
+	if ((marker->flag & MARKER_DISABLED) == 0) {
 		float pos[2];
 		rctf r;
 
@@ -392,15 +407,16 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT
 
 		ED_clip_point_undistorted_pos(sc, pos, pos);
 
-		if(BLI_in_rctf(&r, pos[0]-marker_pos[0], pos[1]-marker_pos[1])) {
-			if(tiny) glPointSize(3.0f);
+		if (BLI_in_rctf(&r, pos[0]-marker_pos[0], pos[1]-marker_pos[1])) {
+			if (tiny) glPointSize(3.0f);
 			else glPointSize(4.0f);
 			glBegin(GL_POINTS);
 				glVertex2f(pos[0], pos[1]);
 			glEnd();
 			glPointSize(1.0f);
-		} else {
-			if(!tiny) glLineWidth(3.0f);
+		}
+		else {
+			if (!tiny) glLineWidth(3.0f);
 			glBegin(GL_LINES);
 				glVertex2f(pos[0] + px[0]*2, pos[1]);
 				glVertex2f(pos[0] + px[0]*8, pos[1]);
@@ -414,7 +430,7 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT
 				glVertex2f(pos[0], pos[1] + px[1]*2);
 				glVertex2f(pos[0], pos[1] + px[1]*8);
 			glEnd();
-			if(!tiny) glLineWidth(1.0f);
+			if (!tiny) glLineWidth(1.0f);
 		}
 	}
 
@@ -422,9 +438,10 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT
 	glPushMatrix();
 	glTranslatef(marker_pos[0], marker_pos[1], 0);
 
-	if(!tiny) glLineWidth(3.0f);
+	if (!tiny)
+		glLineWidth(3.0f);
 
-	if(sc->flag&SC_SHOW_MARKER_PATTERN) {
+	if (sc->flag & SC_SHOW_MARKER_PATTERN) {
 		glBegin(GL_LINE_LOOP);
 			glVertex2f(track->pat_min[0], track->pat_min[1]);
 			glVertex2f(track->pat_max[0], track->pat_min[1]);
@@ -433,8 +450,9 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT
 		glEnd();
 	}
 
-	show_search= TRACK_VIEW_SELECTED(sc, track) && ((marker->flag&MARKER_DISABLED)==0 || (sc->flag&SC_SHOW_MARKER_PATTERN)==0);
-	if(sc->flag&SC_SHOW_MARKER_SEARCH && show_search) {
+	show_search = TRACK_VIEW_SELECTED(sc, track) &&
+	              ((marker->flag & MARKER_DISABLED) == 0 || (sc->flag & SC_SHOW_MARKER_PATTERN) == 0);
+	if (sc->flag & SC_SHOW_MARKER_SEARCH && show_search) {
 		glBegin(GL_LINE_LOOP);
 			glVertex2f(track->search_min[0], track->search_min[1]);
 			glVertex2f(track->search_max[0], track->search_min[1]);
@@ -444,21 +462,27 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT
 	}
 	glPopMatrix();
 
-	if(!tiny) glLineWidth(1.0f);
+	if (!tiny)
+		glLineWidth(1.0f);
 }
 
 static void track_colors(MovieTrackingTrack *track, int act, float col[3], float scol[3])
 {
-	if(track->flag&TRACK_CUSTOMCOLOR) {
-		if(act) UI_GetThemeColor3fv(TH_ACT_MARKER, scol);
-		else copy_v3_v3(scol, track->color);
+	if (track->flag & TRACK_CUSTOMCOLOR) {
+		if (act)
+			UI_GetThemeColor3fv(TH_ACT_MARKER, scol);
+		else
+			copy_v3_v3(scol, track->color);
 
 		mul_v3_v3fl(col, track->color, 0.5f);
-	} else {
+	}
+	else {
 		UI_GetThemeColor3fv(TH_MARKER, col);
 
-		if(act) UI_GetThemeColor3fv(TH_ACT_MARKER, scol);
-		else UI_GetThemeColor3fv(TH_SEL_MARKER, scol);
+		if (act)
+			UI_GetThemeColor3fv(TH_ACT_MARKER, scol);
+		else
+			UI_GetThemeColor3fv(TH_SEL_MARKER, scol);
 	}
 }
 
@@ -470,34 +494,45 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
 
 	track_colors(track, act, col, scol);
 
-	px[0]= 1.0f/width/sc->zoom;
-	px[1]= 1.0f/height/sc->zoom;
+	px[0]= 1.0f / width / sc->zoom;
+	px[1]= 1.0f / height / sc->zoom;
 
 	/* marker position and offset position */
-	if((track->flag&SELECT)==sel && (marker->flag&MARKER_DISABLED)==0) {
+	if ((track->flag&SELECT) == sel && (marker->flag & MARKER_DISABLED) == 0) {
 		float pos[2];
 		rctf r;
 
-		if(track->flag&TRACK_LOCKED) {
-			if(act) UI_ThemeColor(TH_ACT_MARKER);
-			else if(track->flag&SELECT) UI_ThemeColorShade(TH_LOCK_MARKER, 64);
-			else UI_ThemeColor(TH_LOCK_MARKER);
-		} else {
-			if(track->flag&SELECT) glColor3fv(scol);
-			else glColor3fv(col);
+		if (track->flag & TRACK_LOCKED) {
+			if (act)
+				UI_ThemeColor(TH_ACT_MARKER);
+			else if (track->flag & SELECT)
+				UI_ThemeColorShade(TH_LOCK_MARKER, 64);
+			else
+				UI_ThemeColor(TH_LOCK_MARKER);
+		}
+		else {
+			if (track->flag & SELECT)
+				glColor3fv(scol);
+			else
+				glColor3fv(col);
 		}
 
 		BLI_init_rctf(&r, track->pat_min[0], track->pat_max[0], track->pat_min[1], track->pat_max[1]);
 		add_v2_v2v2(pos, marker->pos, track->offset);
 		ED_clip_point_undistorted_pos(sc, pos, pos);
 
-		if(BLI_in_rctf(&r, pos[0]-marker_pos[0], pos[1]-marker_pos[1])) {
-			if(!tiny) glPointSize(2.0f);
+		if (BLI_in_rctf(&r, pos[0]-marker_pos[0], pos[1]-marker_pos[1])) {
+			if (!tiny)
+				glPointSize(2.0f);
+
 			glBegin(GL_POINTS);
 				glVertex2f(pos[0], pos[1]);
 			glEnd();
-			if(!tiny) glPointSize(1.0f);
-		} else {
+
+			if (!tiny)
+				glPointSize(1.0f);
+		}
+		else {
 			glBegin(GL_LINES);
 				glVertex2f(pos[0] + px[0]*3, pos[1]);
 				glVertex2f(pos[0] + px[0]*7, pos[1]);
@@ -532,23 +567,29 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
 	glPushMatrix();
 	glTranslatef(marker_pos[0], marker_pos[1], 0);
 
-	if(tiny) {
+	if (tiny) {
 		glLineStipple(3, 0xaaaa);
 		glEnable(GL_LINE_STIPPLE);
 	}
 
-	if((track->pat_flag&SELECT)==sel && (sc->flag&SC_SHOW_MARKER_PATTERN)) {
-		if(track->flag&TRACK_LOCKED) {
-			if(act) UI_ThemeColor(TH_ACT_MARKER);
-			else if(track->pat_flag&SELECT) UI_ThemeColorShade(TH_LOCK_MARKER, 64);
+	if ((track->pat_flag & SELECT) == sel && (sc->flag & SC_SHOW_MARKER_PATTERN)) {
+		if (track->flag & TRACK_LOCKED) {
+			if (act)
+				UI_ThemeColor(TH_ACT_MARKER);
+			else if (track->pat_flag & SELECT)
+				UI_ThemeColorShade(TH_LOCK_MARKER, 64);
 			else UI_ThemeColor(TH_LOCK_MARKER);
 		}
-		else if(marker->flag&MARKER_DISABLED) {
-			if(act) UI_ThemeColor(TH_ACT_MARKER);
-			else if(track->pat_flag&SELECT) UI_ThemeColorShade(TH_DIS_MARKER, 128);
+		else if (marker->flag & MARKER_DISABLED) {
+			if (act)
+				UI_ThemeColor(TH_ACT_MARKER);
+			else if (track->pat_flag & SELECT)
+				UI_ThemeColorShade(TH_DIS_MARKER, 128);
 			else UI_ThemeColor(TH_DIS_MARKER);
-		} else {
-			if(track->pat_flag&SELECT) glColor3fv(scol);
+		}
+		else {
+			if (track->pat_flag & SELECT)
+				glColor3fv(scol);
 			else glColor3fv(col);
 		}
 
@@ -561,20 +602,28 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
 	}
 
 	/* search */
-	show_search= TRACK_VIEW_SELECTED(sc, track) && ((marker->flag&MARKER_DISABLED)==0 || (sc->flag&SC_SHOW_MARKER_PATTERN)==0);
-	if((track->search_flag&SELECT)==sel && (sc->flag&SC_SHOW_MARKER_SEARCH) && show_search) {
-		if(track->flag&TRACK_LOCKED) {
-			if(act) UI_ThemeColor(TH_ACT_MARKER);
-			else if(track->search_flag&SELECT) UI_ThemeColorShade(TH_LOCK_MARKER, 64);
+	show_search = TRACK_VIEW_SELECTED(sc, track) &&
+	             ((marker->flag & MARKER_DISABLED) == 0 || (sc->flag & SC_SHOW_MARKER_PATTERN) == 0);
+	if ((track->search_flag & SELECT) == sel && (sc->flag & SC_SHOW_MARKER_SEARCH) && show_search) {
+		if (track->flag & TRACK_LOCKED) {
+			if (act)
+				UI_ThemeColor(TH_ACT_MARKER);
+			else if (track->search_flag & SELECT)
+				UI_ThemeColorShade(TH_LOCK_MARKER, 64);
 			else UI_ThemeColor(TH_LOCK_MARKER);
 		}
-		else if(marker->flag&MARKER_DISABLED) {
-			if(act) UI_ThemeColor(TH_ACT_MARKER);
-			else if(track->search_flag&SELECT) UI_ThemeColorShade(TH_DIS_MARKER, 128);
+		else if (marker->flag & MARKER_DISABLED) {
+			if (act)
+				UI_ThemeColor(TH_ACT_MARKER);
+			else if (track->search_flag & SELECT)
+				UI_ThemeColorShade(TH_DIS_MARKER, 128);
 			else UI_ThemeColor(TH_DIS_MARKER);
-		} else {
-			if(track->search_flag&SELECT) glColor3fv(scol);
-			else glColor3fv(col);
+		}
+		else {
+			if (track->search_flag & SELECT)
+				glColor3fv(scol);
+			else
+				glColor3fv(col);
 		}
 
 		glBegin(GL_LINE_LOOP);
@@ -586,19 +635,29 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
 	}
 
 	/* pyramid */
-	if(sel && TRACK_SELECTED(track) && (track->tracker==TRACKER_KLT) && (marker->flag&MARKER_DISABLED)==0) {
-		if(track->flag&TRACK_LOCKED) {
-			if(act) UI_ThemeColor(TH_ACT_MARKER);
-			else if(track->pat_flag&SELECT) UI_ThemeColorShade(TH_LOCK_MARKER, 64);
+	if (sel && TRACK_VIEW_SELECTED(sc, track) &&
+	    (track->tracker == TRACKER_KLT) &&
+		(marker->flag & MARKER_DISABLED) == 0)
+	{
+		if (track->flag & TRACK_LOCKED) {
+			if (act)
+				UI_ThemeColor(TH_ACT_MARKER);
+			else if (track->pat_flag & SELECT)
+				UI_ThemeColorShade(TH_LOCK_MARKER, 64);
 			else UI_ThemeColor(TH_LOCK_MARKER);
 		}
-		else if(marker->flag&MARKER_DISABLED) {
-			if(act) UI_ThemeColor(TH_ACT_MARKER);
-			else if(track->pat_flag&SELECT) UI_ThemeColorShade(TH_DIS_MARKER, 128);
+		else if (marker->flag & MARKER_DISABLED) {
+			if (act)
+				UI_ThemeColor(TH_ACT_MARKER);
+			else if (track->pat_flag & SELECT)
+				UI_ThemeColorShade(TH_DIS_MARKER, 128);
 			else UI_ThemeColor(TH_DIS_MARKER);
-		} else {
-			if(track->pat_flag&SELECT) glColor3fv(scol);
-			else glColor3fv(col);
+		}
+		else {
+			if (track->pat_flag & SELECT)
+				glColor3fv(scol);
+			else
+				glColor3fv(col);
 		}
 
 		{
@@ -620,28 +679,28 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
 		}
 	}
 
-	if(tiny)
+	if (tiny)
 		glDisable(GL_LINE_STIPPLE);
 
 	glPopMatrix();
 }
 
 static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker,
-			float marker_pos[2], int outline, int sel, int act, int width, int height)
+                                    float marker_pos[2], int outline, int sel, int act, int width, int height)
 {
 	float x, y, dx, dy, patdx, patdy, searchdx, searchdy, tdx, tdy;
-	int tiny= sc->flag&SC_SHOW_TINY_MARKER;
+	int tiny = sc->flag&SC_SHOW_TINY_MARKER;
 	float col[3], scol[3], px[2];
 
-	if((tiny && outline) || (marker->flag&MARKER_DISABLED))
+	if ((tiny && outline) || (marker->flag & MARKER_DISABLED))
 		return;
 
-	if(!TRACK_VIEW_SELECTED(sc, track) || track->flag&TRACK_LOCKED)
+	if (!TRACK_VIEW_SELECTED(sc, track) || track->flag & TRACK_LOCKED)
 		return;
 
 	track_colors(track, act, col, scol);
 
-	if(outline) {
+	if (outline) {
 		glLineWidth(3.0f);
 		UI_ThemeColor(TH_MARKER_OUTLINE);
 	}
@@ -649,34 +708,36 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
 	glPushMatrix();
 	glTranslatef(marker_pos[0], marker_pos[1], 0);
 
-	dx= 6.0f/width/sc->zoom;
-	dy= 6.0f/height/sc->zoom;
+	dx = 6.0f / width / sc->zoom;
+	dy = 6.0f / height / sc->zoom;
 
-	patdx= MIN2(dx*2.0f/3.0f, (track->pat_max[0]-track->pat_min[0])/6.0f);
-	patdy= MIN2(dy*2.0f/3.0f, (track->pat_max[1]-track->pat_min[1])/6.0f);
+	patdx = MIN2(dx * 2.0f / 3.0f, (track->pat_max[0] - track->pat_min[0]) / 6.0f);
+	patdy = MIN2(dy * 2.0f / 3.0f, (track->pat_max[1] - track->pat_min[1]) / 6.0f);
 
-	searchdx= MIN2(dx, (track->search_max[0]-track->search_min[0])/6.0f);
-	searchdy= MIN2(dy, (track->search_max[1]-track->search_min[1])/6.0f);
+	searchdx = MIN2(dx, (track->search_max[0] - track->search_min[0]) / 6.0f);
+	searchdy = MIN2(dy, (track->search_max[1] - track->search_min[1]) / 6.0f);
 
-	px[0]= 1.0f/sc->zoom/width/sc->scale;
-	px[1]= 1.0f/sc->zoom/height/sc->scale;
+	px[0] = 1.0f / sc->zoom / width / sc->scale;
+	px[1] = 1.0f / sc->zoom / height / sc->scale;
 
-	if((sc->flag&SC_SHOW_MARKER_SEARCH) && ((track->search_flag&SELECT)==sel || outline)) {
-		if(!outline) {
-			if(track->search_flag&SELECT) glColor3fv(scol);
-			else glColor3fv(col);
+	if ((sc->flag & SC_SHOW_MARKER_SEARCH) && ((track->search_flag & SELECT) == sel || outline)) {
+		if (!outline) {
+			if (track->search_flag & SELECT)
+				glColor3fv(scol);
+			else
+				glColor3fv(col);
 		}
 
 		/* search offset square */
-		x= track->search_min[0];
-		y= track->search_max[1];
+		x = track->search_min[0];
+		y = track->search_max[1];
 
-		tdx= searchdx;
-		tdy= searchdy;
+		tdx = searchdx;
+		tdy = searchdy;
 
-		if(outline) {
-			tdx+= px[0];
-			tdy+= px[1];
+		if (outline) {
+			tdx += px[0];
+			tdy += px[1];
 		}
 
 		glBegin(GL_QUADS);
@@ -686,16 +747,16 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
 			glVertex3f(x-tdx, y-tdy, 0);
 		glEnd();
 
-		/* search resizing triangle */
-		x= track->search_max[0];
-		y= track->search_min[1];
+		/* search re-sizing triangle */
+		x = track->search_max[0];
+		y = track->search_min[1];
 
-		tdx= searchdx*2.0f;
-		tdy= searchdy*2.0f;
+		tdx = searchdx*2.0f;
+		tdy = searchdy*2.0f;
 
-		if(outline) {
-			tdx+= px[0];
-			tdy+= px[1];
+		if (outline) {
+			tdx += px[0];
+			tdy += px[1];
 		}
 
 		glBegin(GL_TRIANGLES);
@@ -705,22 +766,24 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
 		glEnd();
 	}
 
-	if((sc->flag&SC_SHOW_MARKER_PATTERN) && ((track->pat_flag&SELECT)==sel || outline)) {
-		if(!outline) {
-			if(track->pat_flag&SELECT) glColor3fv(scol);
-			else glColor3fv(col);
+	if ((sc->flag & SC_SHOW_MARKER_PATTERN) && ((track->pat_flag & SELECT)==sel || outline)) {
+		if (!outline) {
+			if (track->pat_flag & SELECT)
+				glColor3fv(scol);
+			else
+				glColor3fv(col);
 		}
 
 		/* pattern offset square */
-		x= track->pat_min[0];
-		y= track->pat_max[1];
+		x = track->pat_min[0];
+		y = track->pat_max[1];
 
-		tdx= patdx;
-		tdy= patdy;
+		tdx = patdx;
+		tdy = patdy;
 
-		if(outline) {
-			tdx+= px[0];
-			tdy+= px[1];
+		if (outline) {
+			tdx += px[0];
+			tdy += px[1];
 		}
 
 		glBegin(GL_QUADS);
@@ -730,16 +793,16 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
 			glVertex3f(x-tdx, y-tdy, 0);
 		glEnd();
 
-		/* pattern resizing triangle */
-		x= track->pat_max[0];
-		y= track->pat_min[1];
+		/* pattern re-sizing triangle */
+		x = track->pat_max[0];
+		y = track->pat_min[1];
 
-		tdx= patdx*2.0f;
-		tdy= patdy*2.0f;
+		tdx = patdx*2.0f;
+		tdy = patdy*2.0f;
 
-		if(outline) {
-			tdx+= px[0];
-			tdy+= px[1];
+		if (outline) {
+			tdx += px[0];
+			tdy += px[1];
 		}
 
 		glBegin(GL_TRIANGLES);
@@ -751,73 +814,83 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
 
 	glPopMatrix();
 
-	if(outline)
+	if (outline)
 		glLineWidth(1.0f);
 }
 
 static void draw_marker_texts(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker, float marker_pos[2], int act,
-			int width, int height, float zoomx, float zoomy)
+                              int width, int height, float zoomx, float zoomy)
 {
-	char str[128]= {0}, state[64]= {0};
-	float dx= 0.0f, dy= 0.0f, fontsize, pos[3];
-	uiStyle *style= U.uistyles.first;
-	int fontid= style->widget.uifont_id;
+	char str[128] = {0}, state[64] = {0};
+	float dx= 0.0f, dy = 0.0f, fontsize, pos[3];
+	uiStyle *style = U.uistyles.first;
+	int fontid = style->widget.uifont_id;
 
-	if(!TRACK_VIEW_SELECTED(sc, track))
+	if (!TRACK_VIEW_SELECTED(sc, track))
 		return;
 
 	BLF_size(fontid, 11.0f, U.dpi);
-	fontsize= BLF_height_max(fontid);
-
-	if(marker->flag&MARKER_DISABLED) {
-		if(act) UI_ThemeColor(TH_ACT_MARKER);
-		else UI_ThemeColorShade(TH_DIS_MARKER, 128);
-	} else {
-		if(act) UI_ThemeColor(TH_ACT_MARKER);
-		else UI_ThemeColor(TH_SEL_MARKER);
+	fontsize = BLF_height_max(fontid);
+
+	if (marker->flag & MARKER_DISABLED) {
+		if (act)
+			UI_ThemeColor(TH_ACT_MARKER);
+		else
+			UI_ThemeColorShade(TH_DIS_MARKER, 128);
+	}
+	else {
+		if (act)
+			UI_ThemeColor(TH_ACT_MARKER);
+		else
+			UI_ThemeColor(TH_SEL_MARKER);
 	}
 
-	if((sc->flag&SC_SHOW_MARKER_SEARCH) &&
-	   ((marker->flag&MARKER_DISABLED)==0 || (sc->flag&SC_SHOW_MARKER_PATTERN)==0))
+	if ((sc->flag & SC_SHOW_MARKER_SEARCH) &&
+	   ((marker->flag & MARKER_DISABLED) == 0 || (sc->flag & SC_SHOW_MARKER_PATTERN) == 0))
 	{
-		dx= track->search_min[0];
-		dy= track->search_min[1];
-	} else if(sc->flag&SC_SHOW_MARKER_PATTERN) {
-		dx= track->pat_min[0];
-		dy= track->pat_min[1];
+		dx = track->search_min[0];
+		dy = track->search_min[1];
+	}
+	else if (sc->flag & SC_SHOW_MARKER_PATTERN) {
+		dx = track->pat_min[0];
+		dy = track->pat_min[1];
 	}
 
-	pos[0]= (marker_pos[0]+dx)*width;
-	pos[1]= (marker_pos[1]+dy)*height;
-	pos[2]= 0.0f;
+	pos[0] = (marker_pos[0] + dx) * width;
+	pos[1] = (marker_pos[1] + dy) * height;
+	pos[2] = 0.0f;
 
 	mul_m4_v3(sc->stabmat, pos);
 
-	pos[0]= pos[0]*zoomx;
-	pos[1]= pos[1]*zoomy - fontsize;
+	pos[0] = pos[0]*zoomx;
+	pos[1] = pos[1]*zoomy - fontsize;
 
-	if(marker->flag&MARKER_DISABLED) strcpy(state, "disabled");
-	else if(marker->framenr!=sc->user.framenr) strcpy(state, "estimated");
-	else if(marker->flag&MARKER_TRACKED) strcpy(state, "tracked");
-	else strcpy(state, "keyframed");
+	if (marker->flag & MARKER_DISABLED)
+		strcpy(state, "disabled");
+	else if (marker->framenr != sc->user.framenr)
+		strcpy(state, "estimated");
+	else if (marker->flag & MARKER_TRACKED)
+		strcpy(state, "tracked");
+	else
+		strcpy(state, "keyframed");
 
-	if(state[0])
+	if (state[0])
 		BLI_snprintf(str, sizeof(str), "%s: %s", track->name, state);
 	else
 		BLI_snprintf(str, sizeof(str), "%s", track->name);
 
 	BLF_position(fontid, pos[0], pos[1], 0.0f);
 	BLF_draw(fontid, str, sizeof(str));
-	pos[1]-= fontsize;
+	pos[1] -= fontsize;
 
-	if(track->flag&TRACK_HAS_BUNDLE) {
+	if (track->flag & TRACK_HAS_BUNDLE) {
 		BLI_snprintf(str, sizeof(str), "Average error: %.3f", track->error);
 		BLF_position(fontid, pos[0], pos[1], 0.0f);
 		BLF_draw(fontid, str, sizeof(str));
-		pos[1]-= fontsize;
+		pos[1] -= fontsize;
 	}
 
-	if(track->flag&TRACK_LOCKED) {
+	if (track->flag & TRACK_LOCKED) {
 		BLF_position(fontid, pos[0], pos[1], 0.0f);
 		BLF_draw(fontid, "locked", 6);
 	}
@@ -826,32 +899,32 @@ static void draw_marker_texts(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
 static void view2d_to_region_float(View2D *v2d, float x, float y, float *regionx, float *regiony)
 {
 	/* express given coordinates as proportional values */
-	x= -v2d->cur.xmin / (v2d->cur.xmax-v2d->cur.xmin);
-	y= -v2d->cur.ymin / (v2d->cur.ymax-v2d->cur.ymin);
+	x = -v2d->cur.xmin / (v2d->cur.xmax - v2d->cur.xmin);
+	y = -v2d->cur.ymin / (v2d->cur.ymax - v2d->cur.ymin);
 
 	/* convert proportional distances to screen coordinates */
-	*regionx= v2d->mask.xmin + x*(v2d->mask.xmax-v2d->mask.xmin);
-	*regiony= v2d->mask.ymin + y*(v2d->mask.ymax-v2d->mask.ymin);
+	*regionx = v2d->mask.xmin + x*(v2d->mask.xmax - v2d->mask.xmin);
+	*regiony = v2d->mask.ymin + y*(v2d->mask.ymax - v2d->mask.ymin);
 }
 
 static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
-			int width, int height, float zoomx, float zoomy)
+                                 int width, int height, float zoomx, float zoomy)
 {
 	float x, y;
-	MovieTracking* tracking= &clip->tracking;
-	ListBase *tracksbase= BKE_tracking_get_tracks(tracking);
+	MovieTracking *tracking = &clip->tracking;
+	ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
 	MovieTrackingTrack *track, *act_track;
 	MovieTrackingMarker *marker;
-	int framenr= sc->user.framenr;
-	int undistort= sc->user.render_flag&MCLIP_PROXY_RENDER_UNDISTORT;
-	float *marker_pos= NULL, *fp, *active_pos= NULL, cur_pos[2];
+	int framenr = sc->user.framenr;
+	int undistort = sc->user.render_flag & MCLIP_PROXY_RENDER_UNDISTORT;
+	float *marker_pos = NULL, *fp, *active_pos = NULL, cur_pos[2];
 
 	/* ** find window pixel coordinates of origin ** */
 
 	/* UI_view2d_to_region_no_clip return integer values, this could
-	   lead to 1px flickering when view is locked to selection during playbeck.
-	   to avoid this flickering, calclate base point in the same way as it happens
-	   in UI_view2d_to_region_no_clip, but do it in floats here */
+	 * lead to 1px flickering when view is locked to selection during playbeck.
+	 * to avoid this flickering, calculate base point in the same way as it happens
+	 * in UI_view2d_to_region_no_clip, but do it in floats here */
 
 	view2d_to_region_float(&ar->v2d, 0.0f, 0.0f, &x, &y);
 
@@ -863,67 +936,67 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
 	glMultMatrixf(sc->stabmat);
 	glScalef(width, height, 0);
 
-	act_track= BKE_tracking_active_track(tracking);
+	act_track = BKE_tracking_active_track(tracking);
 
-	if(sc->user.render_flag&MCLIP_PROXY_RENDER_UNDISTORT) {
-		int count= 0;
+	if (sc->user.render_flag & MCLIP_PROXY_RENDER_UNDISTORT) {
+		int count = 0;
 
 		/* count */
-		track= tracksbase->first;
-		while(track) {
-			if((track->flag&TRACK_HIDDEN)==0) {
-				marker= BKE_tracking_get_marker(track, framenr);
+		track = tracksbase->first;
+		while (track) {
+			if ((track->flag & TRACK_HIDDEN)==0) {
+				marker = BKE_tracking_get_marker(track, framenr);
 
-				if(MARKER_VISIBLE(sc, marker))
+				if (MARKER_VISIBLE(sc, marker))
 					count++;
 			}
 
-			track= track->next;
+			track = track->next;
 		}
 
 		/* undistort */
-		if(count) {
-			marker_pos= MEM_callocN(2*sizeof(float)*count, "draw_tracking_tracks marker_pos");
+		if (count) {
+			marker_pos = MEM_callocN(2*sizeof(float)*count, "draw_tracking_tracks marker_pos");
 
-			track= tracksbase->first;
-			fp= marker_pos;
-			while(track) {
-				if((track->flag&TRACK_HIDDEN)==0) {
-					marker= BKE_tracking_get_marker(track, framenr);
+			track = tracksbase->first;
+			fp = marker_pos;
+			while (track) {
+				if ((track->flag & TRACK_HIDDEN)==0) {
+					marker = BKE_tracking_get_marker(track, framenr);
 
-					if(MARKER_VISIBLE(sc, marker)) {
+					if (MARKER_VISIBLE(sc, marker)) {
 						ED_clip_point_undistorted_pos(sc, marker->pos, fp);
 
-						if(track==act_track)
-							active_pos= fp;
+						if (track == act_track)
+							active_pos = fp;
 
-						fp+= 2;
+						fp += 2;
 					}
 				}
 
-				track= track->next;
+				track = track->next;
 			}
 		}
 	}
 
-	if(sc->flag&SC_SHOW_TRACK_PATH) {
-		track= tracksbase->first;
-		while(track) {
-			if((track->flag&TRACK_HIDDEN)==0)
+	if (sc->flag & SC_SHOW_TRACK_PATH) {
+		track = tracksbase->first;
+		while (track) {
+			if ((track->flag & TRACK_HIDDEN)==0)
 				draw_track_path(sc, clip, track);
 
-			track= track->next;
+			track = track->next;
 		}
 	}
 
 	/* markers outline and non-selected areas */
-	track= tracksbase->first;
-	fp= marker_pos;
-	while(track) {
-		if((track->flag&TRACK_HIDDEN)==0) {
-			marker= BKE_tracking_get_marker(track, framenr);
+	track = tracksbase->first;
+	fp = marker_pos;
+	while (track) {
+		if ((track->flag & TRACK_HIDDEN)==0) {
+			marker = BKE_tracking_get_marker(track, framenr);
 
-			if(MARKER_VISIBLE(sc, marker)) {
+			if (MARKER_VISIBLE(sc, marker)) {
 				copy_v2_v2(cur_pos, fp ? fp : marker->pos);
 
 				draw_marker_outline(sc, track, marker, cur_pos, width, height);
@@ -931,45 +1004,45 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
 				draw_marker_slide_zones(sc, track, marker, cur_pos, 1, 0, 0, width, height);
 				draw_marker_slide_zones(sc, track, marker, cur_pos, 0, 0, 0, width, height);
 
-				if(fp)
-					fp+= 2;
+				if (fp)
+					fp += 2;
 			}
 		}
 
-		track= track->next;
+		track = track->next;
 	}
 
 	/* selected areas only, so selection wouldn't be overlapped by
-	   non-selected areas */
-	track= tracksbase->first;
-	fp= marker_pos;
-	while(track) {
-		if((track->flag&TRACK_HIDDEN)==0) {
-			int act= track==act_track;
-			marker= BKE_tracking_get_marker(track, framenr);
-
-			if(MARKER_VISIBLE(sc, marker)) {
-				if(!act) {
+	 * non-selected areas */
+	track = tracksbase->first;
+	fp = marker_pos;
+	while (track) {
+		if ((track->flag & TRACK_HIDDEN)==0) {
+			int act = track == act_track;
+			marker = BKE_tracking_get_marker(track, framenr);
+
+			if (MARKER_VISIBLE(sc, marker)) {
+				if (!act) {
 					copy_v2_v2(cur_pos, fp ? fp : marker->pos);
 
 					draw_marker_areas(sc, track, marker, cur_pos, width, height, 0, 1);
 					draw_marker_slide_zones(sc, track, marker, cur_pos, 0, 1, 0, width, height);
 				}
 
-				if(fp)
-					fp+= 2;
+				if (fp)
+					fp += 2;
 			}
 		}
 
-		track= track->next;
+		track = track->next;
 	}
 
 	/* active marker would be displayed on top of everything else */
-	if(act_track) {
-		if((act_track->flag&TRACK_HIDDEN)==0) {
-			marker= BKE_tracking_get_marker(act_track, framenr);
+	if (act_track) {
+		if ((act_track->flag & TRACK_HIDDEN)==0) {
+			marker = BKE_tracking_get_marker(act_track, framenr);
 
-			if(MARKER_VISIBLE(sc, marker)) {
+			if (MARKER_VISIBLE(sc, marker)) {
 				copy_v2_v2(cur_pos, active_pos ? active_pos : marker->pos);
 
 				draw_marker_areas(sc, act_track, marker, cur_pos, width, height, 1, 1);
@@ -978,51 +1051,55 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
 		}
 	}
 
-	if(sc->flag&SC_SHOW_BUNDLES) {
-		MovieTrackingObject *object= BKE_tracking_active_object(tracking);
+	if (sc->flag & SC_SHOW_BUNDLES) {
+		MovieTrackingObject *object = BKE_tracking_active_object(tracking);
 		float pos[4], vec[4], mat[4][4], aspy;
 
 		glEnable(GL_POINT_SMOOTH);
 		glPointSize(3.0f);
 
-		aspy= 1.0f/clip->tracking.camera.pixel_aspect;
+		aspy = 1.0f / clip->tracking.camera.pixel_aspect;
 		BKE_tracking_projection_matrix(tracking, object, framenr, width, height, mat);
 
-		track= tracksbase->first;
-		while(track) {
-			if((track->flag&TRACK_HIDDEN)==0 && track->flag&TRACK_HAS_BUNDLE) {
+		track = tracksbase->first;
+		while (track) {
+			if ((track->flag & TRACK_HIDDEN) == 0 && track->flag & TRACK_HAS_BUNDLE) {
 				marker= BKE_tracking_get_marker(track, framenr);
 
-				if(MARKER_VISIBLE(sc, marker)) {
+				if (MARKER_VISIBLE(sc, marker)) {
 					float npos[2];
 					copy_v4_v4(vec, track->bundle_pos);
 					vec[3]=1;
 
 					mul_v4_m4v4(pos, mat, vec);
 
-					pos[0]= (pos[0]/(pos[3]*2.0f)+0.5f)*width;
-					pos[1]= (pos[1]/(pos[3]*2.0f)+0.5f)*height*aspy;
+					pos[0] = (pos[0] / (pos[3] * 2.0f) + 0.5f) * width;
+					pos[1] = (pos[1] / (pos[3] * 2.0f) + 0.5f) * height * aspy;
 
 					BKE_tracking_apply_intrinsics(tracking, pos, npos);
 
-					if(npos[0]>=0.0f && npos[1]>=0.0f && npos[0]<=width && npos[1]<=height*aspy) {
-						vec[0]= (marker->pos[0]+track->offset[0])*width;
-						vec[1]= (marker->pos[1]+track->offset[1])*height*aspy;
+					if (npos[0] >= 0.0f && npos[1] >= 0.0f && npos[0] <= width && npos[1] <= height * aspy) {
+						vec[0] = (marker->pos[0] + track->offset[0]) * width;
+						vec[1] = (marker->pos[1] + track->offset[1]) * height * aspy;
 
 						sub_v2_v2(vec, npos);
 
-						if(len_v2(vec)<3) glColor3f(0.0f, 1.0f, 0.0f);
-						else glColor3f(1.0f, 0.0f, 0.0f);
+						if (len_v2(vec)< 3.0f)
+							glColor3f(0.0f, 1.0f, 0.0f);
+						else
+							glColor3f(1.0f, 0.0f, 0.0f);
 
 						glBegin(GL_POINTS);
-							if(undistort) glVertex3f(pos[0]/width, pos[1]/(height*aspy), 0);
-							else glVertex3f(npos[0]/width, npos[1]/(height*aspy), 0);
+							if (undistort)
+								glVertex3f(pos[0] / width, pos[1] / (height * aspy), 0);
+							else
+								glVertex3f(npos[0] / width, npos[1] / (height * aspy), 0);
 						glEnd();
 					}
 				}
 			}
 
-			track= track->next;
+			track = track->next;
 		}
 
 		glPointSize(1.0f);
@@ -1031,52 +1108,53 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
 
 	glPopMatrix();
 
-	if(sc->flag&SC_SHOW_NAMES) {
+	if (sc->flag & SC_SHOW_NAMES) {
 		/* scaling should be cleared before drawing texts, otherwise font would also be scaled */
-		track= tracksbase->first;
-		fp= marker_pos;
-		while(track) {
-			if((track->flag&TRACK_HIDDEN)==0) {
-				marker= BKE_tracking_get_marker(track, framenr);
+		track = tracksbase->first;
+		fp = marker_pos;
+		while (track) {
+			if ((track->flag & TRACK_HIDDEN) == 0) {
+				marker = BKE_tracking_get_marker(track, framenr);
 
-				if(MARKER_VISIBLE(sc, marker)) {
-					int act= track==act_track;
+				if (MARKER_VISIBLE(sc, marker)) {
+					int act = track == act_track;
 
 					copy_v2_v2(cur_pos, fp ? fp : marker->pos);
 
 					draw_marker_texts(sc, track, marker, cur_pos, act, width, height, zoomx, zoomy);
 
-					if(fp) fp+= 2;
+					if (fp)
+						fp += 2;
 				}
 			}
 
-			track= track->next;
+			track = track->next;
 		}
 	}
 
 	glPopMatrix();
 
-	if(marker_pos)
+	if (marker_pos)
 		MEM_freeN(marker_pos);
 }
 
 static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int width, int height, float zoomx, float zoomy)
 {
 	float x, y;
-	const int n= 10;
+	const int n = 10;
 	int i, j, a;
 	float pos[2], tpos[2], grid[11][11][2];
-	MovieTracking *tracking= &clip->tracking;
-	float aspy= 1.0f/tracking->camera.pixel_aspect;
-	float dx= (float)width/n, dy= (float)height/n*aspy;
+	MovieTracking *tracking = &clip->tracking;
+	float aspy = 1.0f / tracking->camera.pixel_aspect;
+	float dx = (float)width / n, dy = (float)height / n * aspy;
 
-	if(sc->mode!=SC_MODE_DISTORTION)
+	if (sc->mode != SC_MODE_DISTORTION)
 		return;
 
-	if(!tracking->camera.focal)
+	if (!tracking->camera.focal)
 		return;
 
-	if((sc->flag&SC_SHOW_GRID)==0 && (sc->flag&SC_MANUAL_CALIBRATION)==0)
+	if ((sc->flag & SC_SHOW_GRID) == 0 && (sc->flag & SC_MANUAL_CALIBRATION) == 0)
 		return;
 
 	view2d_to_region_float(&ar->v2d, 0.0f, 0.0f, &x, &y);
@@ -1088,47 +1166,51 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid
 	glScalef(width, height, 0);
 
 	/* grid */
-	if(sc->flag&SC_SHOW_GRID) {
+	if (sc->flag & SC_SHOW_GRID) {
 		float val[4][2], idx[4][2];
 		float min[2], max[2];
 
-		for(a=0; a<4; a++) {
-			if(a<2) val[a][a%2]= FLT_MAX;
-			else val[a][a%2]= -FLT_MAX;
+		for (a = 0; a < 4; a++) {
+			if (a < 2)
+				val[a][a%2] = FLT_MAX;
+			else
+				val[a][a%2] = -FLT_MAX;
 		}
 
 		zero_v2(pos);
-		for(i= 0; i<=n; i++) {
-			for(j= 0; j<=n; j++) {
-				if(i==0 || j==0 || i==n || j==n) {
+		for (i = 0; i <= n; i++) {
+			for (j = 0; j <= n; j++) {
+				if (i == 0 || j == 0 || i == n || j == n) {
 					BKE_tracking_apply_intrinsics(tracking, pos, tpos);
 
-					for(a=0; a<4; a++) {
+					for (a = 0; a < 4; a++) {
 						int ok;
 
-						if(a<2) ok= tpos[a%2] < val[a][a%2];
-						else ok= tpos[a%2] > val[a][a%2];
+						if (a<2)
+							ok = tpos[a%2] < val[a][a%2];
+						else
+							ok= tpos[a%2] > val[a][a%2];
 
-						if(ok) {
+						if (ok) {
 							copy_v2_v2(val[a], tpos);
-							idx[a][0]= j;
-							idx[a][1]= i;
+							idx[a][0] = j;
+							idx[a][1] = i;
 						}
 					}
 				}
 
-				pos[0]+= dx;
+				pos[0] += dx;
 			}
 
-			pos[0]= 0.0f;
-			pos[1]+= dy;
+			pos[0] = 0.0f;
+			pos[1] += dy;
 		}
 
 		INIT_MINMAX2(min, max);
 
-		for(a= 0; a<4; a++) {
-			pos[0]= idx[a][0]*dx;
-			pos[1]= idx[a][1]*dy;
+		for (a = 0; a < 4; a++) {
+			pos[0] = idx[a][0] * dx;
+			pos[1] = idx[a][1] * dy;
 
 			BKE_tracking_invert_intrinsics(tracking, pos, tpos);
 
@@ -1136,50 +1218,50 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid
 		}
 
 		copy_v2_v2(pos, min);
-		dx= (max[0]-min[0])/n;
-		dy= (max[1]-min[1])/n;
+		dx = (max[0] - min[0]) / n;
+		dy = (max[1] - min[1]) / n;
 
-		for(i= 0; i<=n; i++) {
-			for(j= 0; j<=n; j++) {
+		for (i = 0; i <= n; i++) {
+			for (j = 0; j <= n; j++) {
 				BKE_tracking_apply_intrinsics(tracking, pos, grid[i][j]);
 
-				grid[i][j][0]/= width;
-				grid[i][j][1]/= height*aspy;
+				grid[i][j][0] /= width;
+				grid[i][j][1] /= height*aspy;
 
-				pos[0]+= dx;
+				pos[0] += dx;
 			}
 
-			pos[0]= min[0];
-			pos[1]+= dy;
+			pos[0] = min[0];
+			pos[1] += dy;
 		}
 
 		glColor3f(1.0f, 0.0f, 0.0f);
 
-		for(i= 0; i<=n; i++) {
+		for (i = 0; i <= n; i++) {
 			glBegin(GL_LINE_STRIP);
-				for(j= 0; j<=n; j++) {
+				for (j = 0; j <= n; j++) {
 					glVertex2fv(grid[i][j]);
 				}
 			glEnd();
 		}
 
-		for(j= 0; j<=n; j++) {
+		for (j = 0; j <= n; j++) {
 			glBegin(GL_LINE_STRIP);
-				for(i= 0; i<=n; i++) {
+				for (i = 0; i <= n; i++) {
 					glVertex2fv(grid[i][j]);
 				}
 			glEnd();
 		}
 	}
 
-	if(sc->flag&SC_MANUAL_CALIBRATION && clip->gpd) {
+	if (sc->flag & SC_MANUAL_CALIBRATION && clip->gpd) {
 		bGPDlayer *layer= clip->gpd->layers.first;
 
-		while(layer) {
-			bGPDframe *frame= layer->frames.first;
+		while (layer) {
+			bGPDframe *frame = layer->frames.first;
 
-			if(layer->flag & GP_LAYER_HIDE) {
-				layer= layer->next;
+			if (layer->flag & GP_LAYER_HIDE) {
+				layer = layer->next;
 				continue;
 			}
 
@@ -1187,28 +1269,28 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid
 			glLineWidth(layer->thickness);
 			glPointSize((float)(layer->thickness + 2));
 
-			while(frame) {
-				bGPDstroke *stroke= frame->strokes.first;
+			while (frame) {
+				bGPDstroke *stroke = frame->strokes.first;
 
-				while(stroke) {
-					if(stroke->flag&GP_STROKE_2DSPACE) {
-						if(stroke->totpoints>1) {
+				while (stroke) {
+					if (stroke->flag & GP_STROKE_2DSPACE) {
+						if (stroke->totpoints > 1) {
 							glBegin(GL_LINE_STRIP);
-								for(i= 0; i<stroke->totpoints-1; i++) {
+								for (i = 0; i < stroke->totpoints - 1; i++) {
 									float npos[2], dpos[2], len;
 									int steps;
 
-									pos[0]= stroke->points[i].x*width;
-									pos[1]= stroke->points[i].y*height*aspy;
+									pos[0] = stroke->points[i].x * width;
+									pos[1] = stroke->points[i].y * height * aspy;
 
-									npos[0]= stroke->points[i+1].x*width;
-									npos[1]= stroke->points[i+1].y*height*aspy;
+									npos[0] = stroke->points[i+1].x * width;
+									npos[1] = stroke->points[i+1].y * height * aspy;
 
-									len= len_v2v2(pos, npos);
+									len = len_v2v2(pos, npos);
 									steps= ceil(len/5.0f);
 
 									/* we want to distort only long straight lines */
-									if(stroke->totpoints==2) {
+									if (stroke->totpoints == 2) {
 										BKE_tracking_invert_intrinsics(tracking, pos, pos);
 										BKE_tracking_invert_intrinsics(tracking, npos, npos);
 									}
@@ -1216,7 +1298,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid
 									sub_v2_v2v2(dpos, npos, pos);
 									mul_v2_fl(dpos, 1.0f/steps);
 
-									for(j= 0; j<=steps; j++) {
+									for (j = 0; j <= steps; j++) {
 										BKE_tracking_apply_intrinsics(tracking, pos, tpos);
 										glVertex2f(tpos[0]/width, tpos[1]/(height*aspy));
 
@@ -1225,20 +1307,20 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid
 								}
 							glEnd();
 						}
-						else if(stroke->totpoints==1) {
+						else if (stroke->totpoints == 1) {
 							glBegin(GL_POINTS);
 								glVertex2f(stroke->points[0].x, stroke->points[0].y);
 							glEnd();
 						}
 					}
 
-					stroke= stroke->next;
+					stroke = stroke->next;
 				}
 
-				frame= frame->next;
+				frame = frame->next;
 			}
 
-			layer= layer->next;
+			layer = layer->next;
 		}
 
 		glLineWidth(1.0f);
@@ -1256,44 +1338,46 @@ void clip_draw_main(SpaceClip *sc, ARegion *ar, Scene *scene)
 	float zoomx, zoomy;
 
 	/* if no clip, nothing to do */
-	if(!clip)
+	if (!clip)
 		return;
 
 	ED_space_clip_size(sc, &width, &height);
 	ED_space_clip_zoom(sc, ar, &zoomx, &zoomy);
 
-	if(sc->flag&SC_SHOW_STABLE) {
+	if (sc->flag & SC_SHOW_STABLE) {
 		float smat[4][4], ismat[4][4];
 
-		ibuf= ED_space_clip_get_stable_buffer(sc, sc->loc, &sc->scale, &sc->angle);
+		ibuf = ED_space_clip_get_stable_buffer(sc, sc->loc, &sc->scale, &sc->angle);
 
-		if(ibuf) {
+		if (ibuf) {
 			float loc[2];
+			float aspect = clip->tracking.camera.pixel_aspect;
 
-			if(width != ibuf->x)
+			if (width != ibuf->x)
 				mul_v2_v2fl(loc, sc->loc, (float)width / ibuf->x);
 			else
 				copy_v2_v2(loc, sc->loc);
 
-			BKE_tracking_stabdata_to_mat4(width, height, loc, sc->scale, sc->angle, sc->stabmat);
+			BKE_tracking_stabdata_to_mat4(width, height, aspect, loc, sc->scale, sc->angle, sc->stabmat);
 
 			unit_m4(smat);
-			smat[0][0]= 1.0f/width;
-			smat[1][1]= 1.0f/height;
+			smat[0][0] = 1.0f / width;
+			smat[1][1] = 1.0f / height;
 			invert_m4_m4(ismat, smat);
 
 			mul_serie_m4(sc->unistabmat, smat, sc->stabmat, ismat, NULL, NULL, NULL, NULL, NULL);
 		}
-	} else {
-		ibuf= ED_space_clip_get_buffer(sc);
+	}
+	else {
+		ibuf = ED_space_clip_get_buffer(sc);
 
 		zero_v2(sc->loc);
-		sc->scale= 1.0f;
+		sc->scale = 1.0f;
 		unit_m4(sc->stabmat);
 		unit_m4(sc->unistabmat);
 	}
 
-	if(ibuf) {
+	if (ibuf) {
 		draw_movieclip_buffer(sc, ar, ibuf, width, height, zoomx, zoomy);
 		IMB_freeImBuf(ibuf);
 
@@ -1308,20 +1392,20 @@ void clip_draw_main(SpaceClip *sc, ARegion *ar, Scene *scene)
 /* draw grease pencil */
 void clip_draw_grease_pencil(bContext *C, int onlyv2d)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
 	ImBuf *ibuf;
 
-	if(!clip)
+	if (!clip)
 		return;
 
-	if(onlyv2d) {
-		/* if manual calibration is used then grase pencil data is already
-		    drawed in draw_distortion */
-		if((sc->flag&SC_MANUAL_CALIBRATION)==0 || sc->mode!=SC_MODE_DISTORTION) {
-			ibuf= ED_space_clip_get_buffer(sc);
+	if (onlyv2d) {
+		/* if manual calibration is used then grease pencil data is already
+		 * drawed in draw_distortion */
+		if ((sc->flag & SC_MANUAL_CALIBRATION)==0 || sc->mode != SC_MODE_DISTORTION) {
+			ibuf = ED_space_clip_get_buffer(sc);
 
-			if(ibuf) {
+			if (ibuf) {
 				glPushMatrix();
 				glMultMatrixf(sc->unistabmat);
 				draw_gpencil_2dimage(C, ibuf);
@@ -1330,7 +1414,8 @@ void clip_draw_grease_pencil(bContext *C, int onlyv2d)
 				glPopMatrix();
 			}
 		}
-	} else {
+	}
+	else {
 		draw_gpencil_view2d(C, 0);
 	}
 }
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 35d8700..3946d4c 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -57,22 +57,22 @@
 
 int ED_space_clip_poll(bContext *C)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
+	SpaceClip *sc = CTX_wm_space_clip(C);
 
-	if(sc && sc->clip)
-		return 1;
+	if (sc && sc->clip)
+		return TRUE;
 
-	return 0;
+	return FALSE;
 }
 
 void ED_space_clip_set(bContext *C, SpaceClip *sc, MovieClip *clip)
 {
-	sc->clip= clip;
+	sc->clip = clip;
 
-	if(sc->clip && sc->clip->id.us==0)
-		sc->clip->id.us= 1;
+	if (sc->clip && sc->clip->id.us==0)
+		sc->clip->id.us = 1;
 
-	if(C)
+	if (C)
 		WM_event_add_notifier(C, NC_MOVIECLIP|NA_SELECTED, sc->clip);
 }
 
@@ -83,15 +83,15 @@ MovieClip *ED_space_clip(SpaceClip *sc)
 
 ImBuf *ED_space_clip_get_buffer(SpaceClip *sc)
 {
-	if(sc->clip) {
+	if (sc->clip) {
 		ImBuf *ibuf;
 
-		ibuf= BKE_movieclip_get_postprocessed_ibuf(sc->clip, &sc->user, sc->postproc_flag);
+		ibuf = BKE_movieclip_get_postprocessed_ibuf(sc->clip, &sc->user, sc->postproc_flag);
 
-		if(ibuf && (ibuf->rect || ibuf->rect_float))
+		if (ibuf && (ibuf->rect || ibuf->rect_float))
 			return ibuf;
 
-		if(ibuf)
+		if (ibuf)
 			IMB_freeImBuf(ibuf);
 	}
 
@@ -100,15 +100,15 @@ ImBuf *ED_space_clip_get_buffer(SpaceClip *sc)
 
 ImBuf *ED_space_clip_get_stable_buffer(SpaceClip *sc, float loc[2], float *scale, float *angle)
 {
-	if(sc->clip) {
+	if (sc->clip) {
 		ImBuf *ibuf;
 
-		ibuf= BKE_movieclip_get_stable_ibuf(sc->clip, &sc->user, loc, scale, angle, sc->postproc_flag);
+		ibuf = BKE_movieclip_get_stable_ibuf(sc->clip, &sc->user, loc, scale, angle, sc->postproc_flag);
 
-		if(ibuf && (ibuf->rect || ibuf->rect_float))
+		if (ibuf && (ibuf->rect || ibuf->rect_float))
 			return ibuf;
 
-		if(ibuf)
+		if (ibuf)
 			IMB_freeImBuf(ibuf);
 	}
 
@@ -117,11 +117,12 @@ ImBuf *ED_space_clip_get_stable_buffer(SpaceClip *sc, float loc[2], float *scale
 
 void ED_space_clip_size(SpaceClip *sc, int *width, int *height)
 {
-	if(!sc->clip) {
-		*width= 0;
-		*height= 0;
-	} else
+	if (!sc->clip) {
+		*width = *height = 0;
+	}
+	else {
 		BKE_movieclip_get_size(sc->clip, &sc->user, width, height);
+	}
 }
 
 void ED_space_clip_zoom(SpaceClip *sc, ARegion *ar, float *zoomx, float *zoomy)
@@ -130,18 +131,18 @@ void ED_space_clip_zoom(SpaceClip *sc, ARegion *ar, float *zoomx, float *zoomy)
 
 	ED_space_clip_size(sc, &width, &height);
 
-	*zoomx= (float)(ar->winrct.xmax - ar->winrct.xmin + 1)/(float)((ar->v2d.cur.xmax - ar->v2d.cur.xmin)*width);
-	*zoomy= (float)(ar->winrct.ymax - ar->winrct.ymin + 1)/(float)((ar->v2d.cur.ymax - ar->v2d.cur.ymin)*height);
+	*zoomx = (float)(ar->winrct.xmax - ar->winrct.xmin + 1)/(float)((ar->v2d.cur.xmax - ar->v2d.cur.xmin)*width);
+	*zoomy = (float)(ar->winrct.ymax - ar->winrct.ymin + 1)/(float)((ar->v2d.cur.ymax - ar->v2d.cur.ymin)*height);
 }
 
 void ED_space_clip_aspect(SpaceClip *sc, float *aspx, float *aspy)
 {
-	MovieClip *clip= ED_space_clip(sc);
+	MovieClip *clip = ED_space_clip(sc);
 
-	if(clip)
+	if (clip)
 		BKE_movieclip_aspect(clip, aspx, aspy);
 	else
-		*aspx= *aspy= 1.0f;
+		*aspx = *aspy = 1.0f;
 }
 
 void ED_clip_update_frame(const Main *mainp, int cfra)
@@ -150,14 +151,15 @@ void ED_clip_update_frame(const Main *mainp, int cfra)
 	wmWindow *win;
 
 	/* image window, compo node users */
-	for(wm=mainp->wm.first; wm; wm= wm->id.next) { /* only 1 wm */
-		for(win= wm->windows.first; win; win= win->next) {
+	for (wm = mainp->wm.first; wm; wm = wm->id.next) { /* only 1 wm */
+		for (win = wm->windows.first; win; win = win->next) {
 			ScrArea *sa;
-			for(sa= win->screen->areabase.first; sa; sa= sa->next) {
-				if(sa->spacetype==SPACE_CLIP) {
-					SpaceClip *sc= sa->spacedata.first;
 
-					sc->scopes.ok= 0;
+			for (sa = win->screen->areabase.first; sa; sa = sa->next) {
+				if (sa->spacetype == SPACE_CLIP) {
+					SpaceClip *sc = sa->spacedata.first;
+
+					sc->scopes.ok = FALSE;
 
 					BKE_movieclip_user_set_frame(&sc->user, cfra);
 				}
@@ -168,44 +170,45 @@ void ED_clip_update_frame(const Main *mainp, int cfra)
 
 static int selected_boundbox(SpaceClip *sc, float min[2], float max[2])
 {
-	MovieClip *clip= ED_space_clip(sc);
+	MovieClip *clip = ED_space_clip(sc);
 	MovieTrackingTrack *track;
-	int width, height, ok= 0;
+	int width, height, ok = FALSE;
 	ListBase *tracksbase= BKE_tracking_get_tracks(&clip->tracking);
 
 	INIT_MINMAX2(min, max);
 
 	ED_space_clip_size(sc, &width, &height);
 
-	track= tracksbase->first;
-	while(track) {
-		if(TRACK_VIEW_SELECTED(sc, track)) {
-			MovieTrackingMarker *marker= BKE_tracking_get_marker(track, sc->user.framenr);
+	track = tracksbase->first;
+	while (track) {
+		if (TRACK_VIEW_SELECTED(sc, track)) {
+			MovieTrackingMarker *marker = BKE_tracking_get_marker(track, sc->user.framenr);
 
-			if(marker) {
+			if (marker) {
 				float pos[3];
 
-				pos[0]= marker->pos[0]+track->offset[0];
-				pos[1]= marker->pos[1]+track->offset[1];
-				pos[2]= 0.0f;
+				pos[0] = marker->pos[0] + track->offset[0];
+				pos[1] = marker->pos[1] + track->offset[1];
+				pos[2] = 0.0f;
 
 				/* undistortion happens for normalized coords */
-				if(sc->user.render_flag&MCLIP_PROXY_RENDER_UNDISTORT)
+				if (sc->user.render_flag & MCLIP_PROXY_RENDER_UNDISTORT) {
 					/* undistortion happens for normalized coords */
 					ED_clip_point_undistorted_pos(sc, pos, pos);
+				}
 
-				pos[0]*= width;
-				pos[1]*= height;
+				pos[0] *= width;
+				pos[1] *= height;
 
 				mul_v3_m4v3(pos, sc->stabmat, pos);
 
 				DO_MINMAX2(pos, min, max);
 
-				ok= 1;
+				ok = TRUE;
 			}
 		}
 
-		track= track->next;
+		track = track->next;
 	}
 
 	return ok;
@@ -218,90 +221,92 @@ int ED_clip_view_selection(SpaceClip *sc, ARegion *ar, int fit)
 
 	ED_space_clip_size(sc, &frame_width, &frame_height);
 
-	if(frame_width==0 || frame_height==0) return 0;
+	if (frame_width == 0 || frame_height == 0)
+		return FALSE;
 
-	if(!selected_boundbox(sc, min, max))
-		return 0;
+	if (!selected_boundbox(sc, min, max))
+		return FALSE;
 
 	/* center view */
 	clip_view_center_to_point(sc, (max[0]+min[0])/(2*frame_width), (max[1]+min[1])/(2*frame_height));
 
-	w= max[0]-min[0];
-	h= max[1]-min[1];
+	w = max[0] - min[0];
+	h = max[1] - min[1];
 
 	/* set zoom to see all selection */
-	if(w>0 && h>0) {
+	if (w > 0 && h > 0) {
 		int width, height;
 		float zoomx, zoomy, newzoom, aspx, aspy;
 
 		ED_space_clip_aspect(sc, &aspx, &aspy);
 
-		width= ar->winrct.xmax - ar->winrct.xmin + 1;
-		height= ar->winrct.ymax - ar->winrct.ymin + 1;
+		width = ar->winrct.xmax - ar->winrct.xmin + 1;
+		height = ar->winrct.ymax - ar->winrct.ymin + 1;
 
-		zoomx= (float)width/w/aspx;
-		zoomy= (float)height/h/aspy;
+		zoomx = (float)width / w / aspx;
+		zoomy = (float)height / h / aspy;
 
-		newzoom= 1.0f/power_of_2(1/MIN2(zoomx, zoomy));
+		newzoom = 1.0f / power_of_2(1.0f / MIN2(zoomx, zoomy));
 
-		if(fit || sc->zoom>newzoom)
-			sc->zoom= newzoom;
+		if (fit || sc->zoom>newzoom)
+			sc->zoom = newzoom;
 	}
 
-	return 1;
+	return TRUE;
 }
 
 void ED_clip_point_undistorted_pos(SpaceClip *sc, float co[2], float nco[2])
 {
 	copy_v2_v2(nco, co);
 
-	if(sc->user.render_flag&MCLIP_PROXY_RENDER_UNDISTORT) {
-		MovieClip *clip= ED_space_clip(sc);
-		float aspy= 1.0f/clip->tracking.camera.pixel_aspect;
+	if (sc->user.render_flag & MCLIP_PROXY_RENDER_UNDISTORT) {
+		MovieClip *clip = ED_space_clip(sc);
+		float aspy = 1.0f / clip->tracking.camera.pixel_aspect;
 		int width, height;
 
 		ED_space_clip_size(sc, &width, &height);
 
-		nco[0]*= width;
-		nco[1]*= height*aspy;
+		nco[0] *= width;
+		nco[1] *= height * aspy;
 
 		BKE_tracking_invert_intrinsics(&clip->tracking, nco, nco);
-		nco[0]/= width;
-		nco[1]/= height*aspy;
+
+		nco[0] /= width;
+		nco[1] /= height * aspy;
 	}
 }
 
 void ED_clip_point_stable_pos(bContext *C, float x, float y, float *xr, float *yr)
 {
-	ARegion *ar= CTX_wm_region(C);
-	SpaceClip *sc= CTX_wm_space_clip(C);
+	ARegion *ar = CTX_wm_region(C);
+	SpaceClip *sc = CTX_wm_space_clip(C);
 	int sx, sy, width, height;
-	float zoomx, zoomy, pos[3]={0.0f, 0.0f, 0.0f}, imat[4][4];
+	float zoomx, zoomy, pos[3] = {0.0f, 0.0f, 0.0f}, imat[4][4];
 
 	ED_space_clip_zoom(sc, ar, &zoomx, &zoomy);
 	ED_space_clip_size(sc, &width, &height);
 
 	UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &sx, &sy);
 
-	pos[0]= (x-sx)/zoomx;
-	pos[1]= (y-sy)/zoomy;
+	pos[0] = (x - sx) / zoomx;
+	pos[1] = (y - sy) / zoomy;
 
 	invert_m4_m4(imat, sc->stabmat);
 	mul_v3_m4v3(pos, imat, pos);
 
-	*xr= pos[0]/width;
-	*yr= pos[1]/height;
+	*xr = pos[0] / width;
+	*yr = pos[1] / height;
 
-	if(sc->user.render_flag&MCLIP_PROXY_RENDER_UNDISTORT) {
-		MovieClip *clip= ED_space_clip(sc);
-		MovieTracking *tracking= &clip->tracking;
-		float aspy= 1.0f/tracking->camera.pixel_aspect;
-		float tmp[2]= {*xr*width, *yr*height*aspy};
+	if (sc->user.render_flag & MCLIP_PROXY_RENDER_UNDISTORT) {
+		MovieClip *clip = ED_space_clip(sc);
+		MovieTracking *tracking = &clip->tracking;
+		float aspy = 1.0f / tracking->camera.pixel_aspect;
+		float tmp[2] = {*xr * width, *yr * height * aspy};
 
 		BKE_tracking_apply_intrinsics(tracking, tmp, tmp);
 
-		*xr= tmp[0]/width;
-		*yr= tmp[1]/(height*aspy);
+		*xr = tmp[0] / width;
+		*yr = tmp[1] / (height * aspy);
 	}
 }
 
diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c
index 6fabe80..df14491 100644
--- a/source/blender/editors/space_clip/clip_graph_draw.c
+++ b/source/blender/editors/space_clip/clip_graph_draw.c
@@ -63,14 +63,14 @@ static void draw_curve_knot(float x, float y, float xscale, float yscale, float
 {
 	static GLuint displist=0;
 
-	/* initialise round circle shape */
+	/* initialize round circle shape */
 	if (displist == 0) {
 		GLUquadricObj *qobj;
 
-		displist= glGenLists(1);
+		displist = glGenLists(1);
 		glNewList(displist, GL_COMPILE);
 
-		qobj= gluNewQuadric();
+		qobj = gluNewQuadric();
 		gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
 		gluDisk(qobj, 0,  0.7, 8, 1);
 		gluDeleteQuadric(qobj);
@@ -89,21 +89,21 @@ static void draw_curve_knot(float x, float y, float xscale, float yscale, float
 
 static void draw_graph_cfra(SpaceClip *sc, ARegion *ar, Scene *scene)
 {
-	View2D *v2d= &ar->v2d;
+	View2D *v2d = &ar->v2d;
 	float xscale, yscale;
 	float vec[2];
 
 	/* Draw a light green line to indicate current frame */
-	vec[0]= (float)(sc->user.framenr * scene->r.framelen);
+	vec[0] = (float)(sc->user.framenr * scene->r.framelen);
 
 	UI_ThemeColor(TH_CFRAME);
 	glLineWidth(2.0);
 
 	glBegin(GL_LINE_STRIP);
-		vec[1]= v2d->cur.ymin;
+		vec[1] = v2d->cur.ymin;
 		glVertex2fv(vec);
 
-		vec[1]= v2d->cur.ymax;
+		vec[1] = v2d->cur.ymax;
 		glVertex2fv(vec);
 	glEnd();
 
@@ -155,11 +155,12 @@ void tracking_segment_start_cb(void *userdata, MovieTrackingTrack *track, int co
 
 	copy_v3_v3(col, colors[coord]);
 
-	if(track==userdata) {
-		col[3]= 1.0f;
+	if (track==userdata) {
+		col[3] = 1.0f;
 		glLineWidth(2.0f);
-	} else {
-		col[3]= 0.5f;
+	}
+	else {
+		col[3] = 0.5f;
 		glLineWidth(1.0f);
 	}
 
@@ -181,15 +182,17 @@ static void tracking_segment_knot_cb(void *userdata, MovieTrackingTrack *track,
 	struct { MovieTrackingTrack *act_track; int sel; float xscale, yscale, hsize; } *data = userdata;
 	int sel= 0, sel_flag;
 
-	if(track!=data->act_track)
+	if (track != data->act_track)
 		return;
 
-	sel_flag= coord == 0 ? MARKER_GRAPH_SEL_X : MARKER_GRAPH_SEL_Y;
-	sel= (marker->flag & sel_flag) ? 1 : 0;
+	sel_flag = coord == 0 ? MARKER_GRAPH_SEL_X : MARKER_GRAPH_SEL_Y;
+	sel = (marker->flag & sel_flag) ? 1 : 0;
 
-	if(sel == data->sel) {
-		if(sel) UI_ThemeColor(TH_HANDLE_VERTEX_SELECT);
-		else UI_ThemeColor(TH_HANDLE_VERTEX);
+	if (sel == data->sel) {
+		if (sel)
+			UI_ThemeColor(TH_HANDLE_VERTEX_SELECT);
+		else
+			UI_ThemeColor(TH_HANDLE_VERTEX);
 
 		draw_curve_knot(marker->framenr, val, data->xscale, data->yscale, data->hsize);
 	}
@@ -197,21 +200,21 @@ static void tracking_segment_knot_cb(void *userdata, MovieTrackingTrack *track,
 
 static void draw_tracks_curves(View2D *v2d, SpaceClip *sc)
 {
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
-	MovieTrackingTrack *act_track= BKE_tracking_active_track(tracking);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	MovieTrackingTrack *act_track = BKE_tracking_active_track(tracking);
 	int width, height;
 	struct { MovieTrackingTrack *act_track; int sel; float xscale, yscale, hsize; } userdata;
 
 	BKE_movieclip_get_size(clip, &sc->user, &width, &height);
 
-	if(!width || !height)
+	if (!width || !height)
 		return;
 
 	/* non-selected knot handles */
-	userdata.hsize= UI_GetThemeValuef(TH_HANDLE_VERTEX_SIZE);
-	userdata.sel= 0;
-	userdata.act_track= act_track;
+	userdata.hsize = UI_GetThemeValuef(TH_HANDLE_VERTEX_SIZE);
+	userdata.sel = FALSE;
+	userdata.act_track = act_track;
 	UI_view2d_getscale(v2d, &userdata.xscale, &userdata.yscale);
 	clip_graph_tracking_values_iterate(sc, &userdata, tracking_segment_knot_cb, NULL, NULL);
 
@@ -221,58 +224,58 @@ static void draw_tracks_curves(View2D *v2d, SpaceClip *sc)
 	glDisable(GL_BLEND);
 
 	/* selected knot handles on top of curves */
-	userdata.sel= 1;
+	userdata.sel= TRUE;
 	clip_graph_tracking_values_iterate(sc, &userdata, tracking_segment_knot_cb, NULL, NULL);
 }
 
 static void draw_frame_curves(SpaceClip *sc)
 {
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
-	MovieTrackingReconstruction *reconstruction= BKE_tracking_get_reconstruction(tracking);
-	int i, lines= 0, prevfra= 0;
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	MovieTrackingReconstruction *reconstruction = BKE_tracking_get_reconstruction(tracking);
+	int i, lines = 0, prevfra = 0;
 
 	glColor3f(0.0f, 0.0f, 1.0f);
 
-	for(i= 0; i<reconstruction->camnr; i++) {
-		MovieReconstructedCamera *camera= &reconstruction->cameras[i];
+	for (i = 0; i<reconstruction->camnr; i++) {
+		MovieReconstructedCamera *camera = &reconstruction->cameras[i];
 
-		if(lines && camera->framenr!=prevfra+1) {
+		if (lines && camera->framenr!=prevfra+1) {
 			glEnd();
-			lines= 0;
+			lines = 0;
 		}
 
-		if(!lines) {
+		if (!lines) {
 			glBegin(GL_LINE_STRIP);
-			lines= 1;
+			lines = 1;
 		}
 
 		glVertex2f(camera->framenr, camera->error);
 
-		prevfra= camera->framenr;
+		prevfra = camera->framenr;
 	}
 
-	if(lines)
+	if (lines)
 		glEnd();
 }
 
 void clip_draw_graph(SpaceClip *sc, ARegion *ar, Scene *scene)
 {
-	MovieClip *clip= ED_space_clip(sc);
-	View2D *v2d= &ar->v2d;
+	MovieClip *clip = ED_space_clip(sc);
+	View2D *v2d = &ar->v2d;
 	View2DGrid *grid;
-	short unitx= V2D_UNIT_FRAMESCALE, unity= V2D_UNIT_VALUES;
+	short unitx = V2D_UNIT_FRAMESCALE, unity = V2D_UNIT_VALUES;
 
 	/* grid */
-	grid= UI_view2d_grid_calc(scene, v2d, unitx, V2D_GRID_NOCLAMP, unity, V2D_GRID_NOCLAMP, ar->winx, ar->winy);
+	grid = UI_view2d_grid_calc(scene, v2d, unitx, V2D_GRID_NOCLAMP, unity, V2D_GRID_NOCLAMP, ar->winx, ar->winy);
 	UI_view2d_grid_draw(v2d, grid, V2D_GRIDLINES_ALL);
 	UI_view2d_grid_free(grid);
 
-	if(clip) {
-		if(sc->flag&SC_SHOW_GRAPH_TRACKS)
+	if (clip) {
+		if (sc->flag & SC_SHOW_GRAPH_TRACKS)
 			draw_tracks_curves(v2d, sc);
 
-		if(sc->flag&SC_SHOW_GRAPH_FRAMES)
+		if (sc->flag & SC_SHOW_GRAPH_FRAMES)
 			draw_frame_curves(sc);
 	}
 
diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c
index f902422..f8c81c2 100644
--- a/source/blender/editors/space_clip/clip_graph_ops.c
+++ b/source/blender/editors/space_clip/clip_graph_ops.c
@@ -37,10 +37,12 @@
 #include "BLI_utildefines.h"
 #include "BLI_math.h"
 #include "BLI_listbase.h"
+#include "BLI_rect.h"
 
 #include "BKE_context.h"
 #include "BKE_movieclip.h"
 #include "BKE_tracking.h"
+#include "BKE_depsgraph.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
@@ -63,7 +65,7 @@ static int ED_space_clip_graph_poll(bContext *C)
 {
 	SpaceClip *sc = CTX_wm_space_clip(C);
 
-	if(sc && sc->clip) {
+	if (sc && sc->clip) {
 		ARegion *ar = CTX_wm_region(C);
 
 		return ar->regiontype == RGN_TYPE_PREVIEW;
@@ -78,17 +80,17 @@ typedef struct {
 
 static void toggle_selection_cb(void *userdata, MovieTrackingMarker *marker)
 {
-	SelectUserData *data= (SelectUserData *)userdata;
+	SelectUserData *data = (SelectUserData *)userdata;
 
 	switch(data->action) {
 		case SEL_SELECT:
-			marker->flag|= (MARKER_GRAPH_SEL_X|MARKER_GRAPH_SEL_Y);
+			marker->flag |= MARKER_GRAPH_SEL;
 			break;
 		case SEL_DESELECT:
-			marker->flag&= ~(MARKER_GRAPH_SEL_X|MARKER_GRAPH_SEL_Y);
+			marker->flag &= ~MARKER_GRAPH_SEL;
 			break;
 		case SEL_INVERT:
-			marker->flag^= (MARKER_GRAPH_SEL_X|MARKER_GRAPH_SEL_Y);
+			marker->flag ^= MARKER_GRAPH_SEL;
 			break;
 	}
 }
@@ -109,47 +111,47 @@ typedef struct {
 } MouseSelectUserData;
 
 static void find_nearest_tracking_segment_cb(void *userdata, MovieTrackingTrack *track,
-			MovieTrackingMarker *marker, int coord, float val)
+                                             MovieTrackingMarker *marker, int coord, float val)
 {
-	MouseSelectUserData *data= userdata;
-	float co[2]= {marker->framenr, val};
+	MouseSelectUserData *data = userdata;
+	float co[2] = {marker->framenr, val};
 
-	if(data->has_prev) {
-		float d= dist_to_line_segment_v2(data->mouse_co, data->prev_co, co);
+	if (data->has_prev) {
+		float d = dist_to_line_segment_v2(data->mouse_co, data->prev_co, co);
 
-		if(data->track==NULL || d<data->min_dist) {
-			data->track= track;
-			data->min_dist= d;
-			data->coord= coord;
+		if (data->track == NULL || d < data->min_dist) {
+			data->track = track;
+			data->min_dist = d;
+			data->coord = coord;
 			copy_v2_v2(data->min_co, co);
 		}
 	}
 
-	data->has_prev= 1;
+	data->has_prev = TRUE;
 	copy_v2_v2(data->prev_co, co);
 }
 
 void find_nearest_tracking_segment_end_cb(void *userdata)
 {
-	MouseSelectUserData *data= userdata;
+	MouseSelectUserData *data = userdata;
 
-	data->has_prev= 0;
+	data->has_prev = FALSE;
 }
 
 static void find_nearest_tracking_knot_cb(void *userdata, MovieTrackingTrack *track,
-			MovieTrackingMarker *marker, int coord, float val)
+                                          MovieTrackingMarker *marker, int coord, float val)
 {
-	MouseSelectUserData *data= userdata;
-	float dx= marker->framenr-data->mouse_co[0], dy= val-data->mouse_co[1];
-	float d= dx*dx+dy*dy;
+	MouseSelectUserData *data = userdata;
+	float dx = marker->framenr - data->mouse_co[0], dy = val - data->mouse_co[1];
+	float d = dx * dx + dy * dy;
 
-	if(data->marker==NULL || d<data->min_dist) {
+	if (data->marker == NULL || d < data->min_dist) {
 		float co[2]= {marker->framenr, val};
 
-		data->track= track;
-		data->marker= marker;
-		data->min_dist= d;
-		data->coord= coord;
+		data->track = track;
+		data->marker = marker;
+		data->min_dist = d;
+		data->coord = coord;
 		copy_v2_v2(data->min_co, co);
 	}
 
@@ -158,78 +160,80 @@ static void find_nearest_tracking_knot_cb(void *userdata, MovieTrackingTrack *tr
 static void mouse_select_init_data(MouseSelectUserData *userdata, float *co)
 {
 	memset(userdata, 0, sizeof(MouseSelectUserData));
-	userdata->min_dist= FLT_MAX;
+	userdata->min_dist = FLT_MAX;
 	copy_v2_v2(userdata->mouse_co, co);
 }
 
 static int mouse_select_knot(bContext *C, float co[2], int extend)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
+	SpaceClip *sc = CTX_wm_space_clip(C);
 	MovieClip *clip= ED_space_clip(sc);
-	ARegion *ar= CTX_wm_region(C);
-	View2D *v2d= &ar->v2d;
-	MovieTracking *tracking= &clip->tracking;
-	MovieTrackingTrack *act_track= BKE_tracking_active_track(tracking);
-	static const int delta= 6;
+	ARegion *ar = CTX_wm_region(C);
+	View2D *v2d = &ar->v2d;
+	MovieTracking *tracking = &clip->tracking;
+	MovieTrackingTrack *act_track = BKE_tracking_active_track(tracking);
+	static const int delta = 6;
 
-	if(act_track) {
+	if (act_track) {
 		MouseSelectUserData userdata;
 
 		mouse_select_init_data(&userdata, co);
-		clip_graph_tracking_values_iterate_track(sc, act_track,
-					&userdata, find_nearest_tracking_knot_cb, NULL, NULL);
+		clip_graph_tracking_values_iterate_track(sc, act_track, &userdata,
+		                                         find_nearest_tracking_knot_cb, NULL, NULL);
 
-		if(userdata.marker) {
+		if (userdata.marker) {
 			int x1, y1, x2, y2;
 
 			UI_view2d_view_to_region(v2d, co[0], co[1], &x1, &y1);
 			UI_view2d_view_to_region(v2d, userdata.min_co[0], userdata.min_co[1], &x2, &y2);
 
-			if(abs(x2-x1)<=delta && abs(y2-y1)<=delta) {
-				if(!extend) {
+			if (abs(x2 - x1) <= delta && abs(y2 - y1) <= delta) {
+				if (!extend) {
 					SelectUserData selectdata = {SEL_DESELECT};
+
 					clip_graph_tracking_iterate(sc, &selectdata, toggle_selection_cb);
 				}
 
-				if(userdata.coord==0)
-					userdata.marker->flag|= MARKER_GRAPH_SEL_X;
+				if (userdata.coord == 0)
+					userdata.marker->flag |= MARKER_GRAPH_SEL_X;
 				else
-					userdata.marker->flag|= MARKER_GRAPH_SEL_Y;
+					userdata.marker->flag |= MARKER_GRAPH_SEL_Y;
 
-				return 1;
+				return TRUE;
 			}
 		}
 	}
 
-	return 0;
+	return FALSE;
 }
 
 static int mouse_select_curve(bContext *C, float co[2], int extend)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
-	MovieTrackingTrack *act_track= BKE_tracking_active_track(tracking);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	MovieTrackingTrack *act_track = BKE_tracking_active_track(tracking);
 	MouseSelectUserData userdata;
 
 	mouse_select_init_data(&userdata, co);
-	clip_graph_tracking_values_iterate(sc, &userdata, find_nearest_tracking_segment_cb, NULL, find_nearest_tracking_segment_end_cb);
+	clip_graph_tracking_values_iterate(sc, &userdata, find_nearest_tracking_segment_cb,
+	                                   NULL, find_nearest_tracking_segment_end_cb);
 
-	if(userdata.track) {
-		if(extend) {
-			if(act_track==userdata.track) {
+	if (userdata.track) {
+		if (extend) {
+			if (act_track == userdata.track) {
 				/* currently only single curve can be selected (selected curve represents active track) */
-				act_track= NULL;
+				act_track = NULL;
 			}
 		}
-		else if(act_track!=userdata.track) {
+		else if (act_track != userdata.track) {
 			MovieTrackingMarker *marker;
 			SelectUserData selectdata = {SEL_DESELECT};
 
-			tracking->act_track= userdata.track;
+			tracking->act_track = userdata.track;
 
 			/* make active track be centered to screen */
-			marker= BKE_tracking_get_marker(userdata.track, sc->user.framenr);
+			marker = BKE_tracking_get_marker(userdata.track, sc->user.framenr);
 
 			clip_view_center_to_point(sc, marker->pos[0], marker->pos[1]);
 
@@ -237,25 +241,25 @@ static int mouse_select_curve(bContext *C, float co[2], int extend)
 			clip_graph_tracking_iterate(sc, &selectdata, toggle_selection_cb);
 		}
 
-		return 1;
+		return TRUE;
 	}
 
-	return 0;
+	return FALSE;
 }
 
 static int mouse_select(bContext *C, float co[2], int extend)
 {
-	int sel= 0;
+	int sel = FALSE;
 
 	/* first try to select knot on selected curves */
-	sel= mouse_select_knot(C, co, extend);
+	sel = mouse_select_knot(C, co, extend);
 
-	if(!sel) {
+	if (!sel) {
 		/* if there's no close enough knot to mouse osition, select nearest curve */
-		sel= mouse_select_curve(C, co, extend);
+		sel = mouse_select_curve(C, co, extend);
 	}
 
-	if(sel)
+	if (sel)
 		WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
 
 	return OPERATOR_FINISHED;
@@ -264,7 +268,7 @@ static int mouse_select(bContext *C, float co[2], int extend)
 static int select_exec(bContext *C, wmOperator *op)
 {
 	float co[2];
-	int  extend= RNA_boolean_get(op->ptr, "extend");
+	int  extend = RNA_boolean_get(op->ptr, "extend");
 
 	RNA_float_get_array(op->ptr, "location", co);
 
@@ -273,7 +277,7 @@ static int select_exec(bContext *C, wmOperator *op)
 
 static int select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	ARegion *ar= CTX_wm_region(C);
+	ARegion *ar = CTX_wm_region(C);
 	float co[2];
 
 	UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
@@ -285,17 +289,17 @@ static int select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 void CLIP_OT_graph_select(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select";
-	ot->description= "Select graph curves";
-	ot->idname= "CLIP_OT_graph_select";
+	ot->name = "Select";
+	ot->description = "Select graph curves";
+	ot->idname = "CLIP_OT_graph_select";
 
 	/* api callbacks */
-	ot->exec= select_exec;
-	ot->invoke= select_invoke;
-	ot->poll= ED_space_clip_graph_poll;
+	ot->exec = select_exec;
+	ot->invoke = select_invoke;
+	ot->poll = ED_space_clip_graph_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_UNDO;
+	ot->flag = OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX,
@@ -304,17 +308,169 @@ void CLIP_OT_graph_select(wmOperatorType *ot)
 		"Extend", "Extend selection rather than clearing the existing selection");
 }
 
+/********************** border select operator *********************/
+
+typedef struct BorderSelectuserData {
+	rctf rect;
+	int change, mode, extend;
+} BorderSelectuserData;
+
+static void border_select_cb(void *userdata, MovieTrackingTrack *UNUSED(track),
+                             MovieTrackingMarker *marker, int coord, float val)
+{
+	BorderSelectuserData *data = (BorderSelectuserData *) userdata;
+
+	if (BLI_in_rctf(&data->rect, marker->framenr, val)) {
+		int flag = 0;
+
+		if (coord == 0)
+			flag = MARKER_GRAPH_SEL_X;
+		else
+			flag = MARKER_GRAPH_SEL_Y;
+
+		if (data->mode == GESTURE_MODAL_SELECT)
+			marker->flag |= flag;
+		else
+			marker->flag &= ~flag;
+
+		data->change = TRUE;
+	}
+	else if (!data->extend) {
+		marker->flag&= ~MARKER_GRAPH_SEL;
+	}
+}
+
+static int border_select_graph_exec(bContext *C, wmOperator *op)
+{
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	ARegion *ar = CTX_wm_region(C);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	MovieTrackingTrack *act_track = BKE_tracking_active_track(tracking);
+	BorderSelectuserData userdata;
+	rcti rect;
+
+	/* get rectangle from operator */
+	rect.xmin = RNA_int_get(op->ptr, "xmin");
+	rect.ymin = RNA_int_get(op->ptr, "ymin");
+	rect.xmax = RNA_int_get(op->ptr, "xmax");
+	rect.ymax = RNA_int_get(op->ptr, "ymax");
+
+	UI_view2d_region_to_view(&ar->v2d, rect.xmin, rect.ymin, &userdata.rect.xmin, &userdata.rect.ymin);
+	UI_view2d_region_to_view(&ar->v2d, rect.xmax, rect.ymax, &userdata.rect.xmax, &userdata.rect.ymax);
+
+	userdata.change = FALSE;
+	userdata.mode = RNA_int_get(op->ptr, "gesture_mode");
+	userdata.extend = RNA_boolean_get(op->ptr, "extend");
+
+	clip_graph_tracking_values_iterate_track(sc, act_track, &userdata, border_select_cb, NULL, NULL);
+
+	if (userdata.change) {
+		WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
+
+		return OPERATOR_FINISHED;
+	}
+
+	return OPERATOR_CANCELLED;
+}
+
+void CLIP_OT_graph_select_border(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Border Select";
+	ot->description = "Select curve points using border selection";
+	ot->idname = "CLIP_OT_graph_select_border";
+
+	/* api callbacks */
+	ot->invoke = WM_border_select_invoke;
+	ot->exec = border_select_graph_exec;
+	ot->modal = WM_border_select_modal;
+	ot->poll = ED_space_clip_graph_poll;
+
+	/* flags */
+	ot->flag = OPTYPE_UNDO;
+
+	/* properties */
+	WM_operator_properties_gesture_border(ot, TRUE);
+}
+
+/********************** select all operator *********************/
+
+static int graph_select_all_markers_exec(bContext *C, wmOperator *op)
+{
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	MovieTrackingTrack *act_track = BKE_tracking_active_track(tracking);
+	MovieTrackingMarker *marker;
+	int action = RNA_enum_get(op->ptr, "action");
+	int a;
+
+	if (!act_track)
+		return OPERATOR_CANCELLED;
+
+	if (action == SEL_TOGGLE) {
+		action = SEL_SELECT;
+
+		for (a = 0; a < act_track->markersnr; a++) {
+			marker = &act_track->markers[a];
+
+			if (marker->flag & MARKER_GRAPH_SEL) {
+				action = SEL_DESELECT;
+				break;
+			}
+		}
+	}
+
+	for (a = 0; a < act_track->markersnr; a++) {
+		marker = &act_track->markers[a];
+
+		switch (action) {
+			case SEL_SELECT:
+				marker->flag |= MARKER_GRAPH_SEL;
+				break;
+			case SEL_DESELECT:
+				marker->flag &= ~MARKER_GRAPH_SEL;
+				break;
+			case SEL_INVERT:
+				marker->flag ^= MARKER_GRAPH_SEL;
+				break;
+		}
+	}
+
+	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
+
+	return OPERATOR_FINISHED;
+}
+
+void CLIP_OT_graph_select_all_markers(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "(De)select All Markers";
+	ot->description = "Change selection of all markers of active track";
+	ot->idname = "CLIP_OT_graph_select_all_markers";
+
+	/* api callbacks */
+	ot->exec = graph_select_all_markers_exec;
+	ot->poll = ED_space_clip_graph_poll;
+
+	/* flags */
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+
+	WM_operator_properties_select_all(ot);
+}
+
 /******************** delete curve operator ********************/
 
 static int delete_curve_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
-	ListBase *tracksbase= BKE_tracking_get_tracks(tracking);
-	MovieTrackingTrack *act_track= BKE_tracking_active_track(tracking);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
+	MovieTrackingTrack *act_track = BKE_tracking_active_track(tracking);
 
-	if(act_track)
+	if (act_track)
 		clip_delete_track(C, clip, tracksbase, act_track);
 
 	return OPERATOR_FINISHED;
@@ -323,36 +479,36 @@ static int delete_curve_exec(bContext *C, wmOperator *UNUSED(op))
 void CLIP_OT_graph_delete_curve(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete Curve";
-	ot->description= "Delete selected curves";
-	ot->idname= "CLIP_OT_graph_delete_curve";
+	ot->name = "Delete Curve";
+	ot->description = "Delete selected curves";
+	ot->idname = "CLIP_OT_graph_delete_curve";
 
 	/* api callbacks */
-	ot->invoke= WM_operator_confirm;
-	ot->exec= delete_curve_exec;
-	ot->poll= ED_space_clip_poll;
+	ot->invoke = WM_operator_confirm;
+	ot->exec = delete_curve_exec;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /******************** delete knot operator ********************/
 
 static int delete_knot_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
+	SpaceClip *sc = CTX_wm_space_clip(C);
 	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
-	ListBase *tracksbase= BKE_tracking_get_tracks(tracking);
-	MovieTrackingTrack *act_track= BKE_tracking_active_track(tracking);
+	MovieTracking *tracking = &clip->tracking;
+	ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
+	MovieTrackingTrack *act_track = BKE_tracking_active_track(tracking);
 
-	if(act_track) {
-		int a= 0;
+	if (act_track) {
+		int a = 0;
 
-		while(a<act_track->markersnr) {
-			MovieTrackingMarker *marker= &act_track->markers[a];
+		while (a < act_track->markersnr) {
+			MovieTrackingMarker *marker = &act_track->markers[a];
 
-			if(marker->flag & (MARKER_GRAPH_SEL_X|MARKER_GRAPH_SEL_Y))
+			if (marker->flag & MARKER_GRAPH_SEL)
 				clip_delete_marker(C, clip, tracksbase, act_track, marker);
 			else
 				a++;
@@ -365,16 +521,16 @@ static int delete_knot_exec(bContext *C, wmOperator *UNUSED(op))
 void CLIP_OT_graph_delete_knot(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete Knot";
-	ot->description= "Delete curve knots";
-	ot->idname= "CLIP_OT_graph_delete_knot";
+	ot->name = "Delete Knot";
+	ot->description = "Delete curve knots";
+	ot->idname = "CLIP_OT_graph_delete_knot";
 
 	/* api callbacks */
-	ot->exec= delete_knot_exec;
-	ot->poll= ED_space_clip_graph_poll;
+	ot->exec = delete_knot_exec;
+	ot->poll = ED_space_clip_graph_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /******************** view all operator ********************/
@@ -386,10 +542,13 @@ typedef struct {
 static void view_all_cb(void *userdata, MovieTrackingTrack *UNUSED(track), MovieTrackingMarker *UNUSED(marker),
                         int UNUSED(coord), float val)
 {
-	ViewAllUserData *data = (ViewAllUserData *)userdata;
+	ViewAllUserData *data = (ViewAllUserData *) userdata;
 
-	if(val < data->min) data->min = val;
-	if(val > data->max) data->max = val;
+	if (val < data->min)
+		data->min = val;
+
+	if (val > data->max)
+		data->max = val;
 }
 
 static int view_all_exec(bContext *C, wmOperator *UNUSED(op))
@@ -407,8 +566,8 @@ static int view_all_exec(bContext *C, wmOperator *UNUSED(op))
 	clip_graph_tracking_values_iterate(sc, &userdata, view_all_cb, NULL, NULL);
 
 	/* set extents of view to start/end frames */
-	v2d->cur.xmin = (float)SFRA;
-	v2d->cur.xmax = (float)EFRA;
+	v2d->cur.xmin = (float) SFRA;
+	v2d->cur.xmax = (float) EFRA;
 
 	if (userdata.min < userdata.max) {
 		v2d->cur.ymin = userdata.min;
@@ -420,11 +579,11 @@ static int view_all_exec(bContext *C, wmOperator *UNUSED(op))
 	}
 
 	/* we need an extra "buffer" factor on either side so that the endpoints are visible */
-	extra= 0.01f * (v2d->cur.xmax - v2d->cur.xmin);
+	extra = 0.01f * (v2d->cur.xmax - v2d->cur.xmin);
 	v2d->cur.xmin -= extra;
 	v2d->cur.xmax += extra;
 
-	extra= 0.01f * (v2d->cur.ymax - v2d->cur.ymin);
+	extra = 0.01f * (v2d->cur.ymax - v2d->cur.ymin);
 	v2d->cur.ymin -= extra;
 	v2d->cur.ymax += extra;
 
@@ -480,3 +639,63 @@ void CLIP_OT_graph_center_current_frame(wmOperatorType *ot)
 	ot->exec = center_current_frame_exec;
 	ot->poll = ED_space_clip_graph_poll;
 }
+
+/********************** disable markers operator *********************/
+
+static int graph_disable_markers_exec(bContext *C, wmOperator *op)
+{
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	MovieTrackingTrack *act_track = BKE_tracking_active_track(tracking);
+	MovieTrackingMarker *marker;
+	int action = RNA_enum_get(op->ptr, "action");
+	int a;
+
+	if (!act_track || (act_track->flag & TRACK_LOCKED))
+		return OPERATOR_CANCELLED;
+
+	for (a = 0; a < act_track->markersnr; a++) {
+		marker = &act_track->markers[a];
+
+		if (marker->flag & MARKER_GRAPH_SEL) {
+			if (action==0)
+				marker->flag |= MARKER_DISABLED;
+			else if (action==1)
+				marker->flag &= ~MARKER_DISABLED;
+			else
+				marker->flag ^= MARKER_DISABLED;
+		}
+	}
+
+	DAG_id_tag_update(&clip->id, 0);
+
+	WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip);
+
+	return OPERATOR_FINISHED;
+}
+
+void CLIP_OT_graph_disable_markers(wmOperatorType *ot)
+{
+	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 = "Disable Markers";
+	ot->description = "Disable/enable selected markers";
+	ot->idname = "CLIP_OT_graph_disable_markers";
+
+	/* api callbacks */
+	ot->exec = graph_disable_markers_exec;
+	ot->poll = ED_space_clip_graph_poll;
+
+	/* flags */
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+
+	/* properties */
+	RNA_def_enum(ot->srna, "action", actions_items, 0, "Action", "Disable action to execute");
+}
diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h
index 9ff58a7..425a1da 100644
--- a/source/blender/editors/space_clip/clip_intern.h
+++ b/source/blender/editors/space_clip/clip_intern.h
@@ -29,8 +29,8 @@
  *  \ingroup spclip
  */
 
-#ifndef ED_CLIP_INTERN_H
-#define ED_CLIP_INTERN_H
+#ifndef __CLIP_INTERN_H__
+#define __CLIP_INTERN_H__
 
 struct bContext;
 struct ARegion;
@@ -58,10 +58,13 @@ void clip_draw_graph(struct SpaceClip *sc, struct ARegion *ar, struct Scene *sce
 void ED_clip_graph_center_current_frame(struct Scene *scene, struct ARegion *ar);
 
 void CLIP_OT_graph_select(struct wmOperatorType *ot);
+void CLIP_OT_graph_select_border(struct wmOperatorType *ot);
+void CLIP_OT_graph_select_all_markers(struct wmOperatorType *ot);
 void CLIP_OT_graph_delete_curve(struct wmOperatorType *ot);
 void CLIP_OT_graph_delete_knot(struct wmOperatorType *ot);
 void CLIP_OT_graph_view_all(struct wmOperatorType *ot);
 void CLIP_OT_graph_center_current_frame(struct wmOperatorType *ot);
+void CLIP_OT_graph_disable_markers(struct wmOperatorType *ot);
 
 /* clip_ops.c */
 void CLIP_OT_open(struct wmOperatorType *ot);
@@ -94,7 +97,7 @@ void clip_graph_tracking_values_iterate(struct SpaceClip *sc, void *userdata,
 			void (*segment_end) (void *userdata));
 
 void clip_graph_tracking_iterate(struct SpaceClip *sc, void *userdata,
-			void (*func) (void *userdata, struct MovieTrackingMarker *marker));
+                                 void (*func) (void *userdata, struct MovieTrackingMarker *marker));
 
 void clip_delete_track(struct bContext *C, struct MovieClip *clip, struct ListBase *tracksbase, struct MovieTrackingTrack *track);
 void clip_delete_marker(struct bContext *C, struct MovieClip *clip, struct ListBase *tracksbase, struct MovieTrackingTrack *track, struct MovieTrackingMarker *marker);
@@ -125,7 +128,7 @@ void CLIP_OT_hide_tracks_clear(struct wmOperatorType *ot);
 void CLIP_OT_lock_tracks(struct wmOperatorType *ot);
 
 void CLIP_OT_set_origin(struct wmOperatorType *ot);
-void CLIP_OT_set_floor(struct wmOperatorType *ot);
+void CLIP_OT_set_plane(struct wmOperatorType *ot);
 void CLIP_OT_set_axis(struct wmOperatorType *ot);
 void CLIP_OT_set_scale(struct wmOperatorType *ot);
 void CLIP_OT_set_solution_scale(struct wmOperatorType *ot);
@@ -152,4 +155,4 @@ void CLIP_OT_tracking_object_remove(struct wmOperatorType *ot);
 void CLIP_OT_copy_tracks(struct wmOperatorType *ot);
 void CLIP_OT_paste_tracks(struct wmOperatorType *ot);
 
-#endif /* ED_CLIP_INTERN_H */
+#endif /* __CLIP_INTERN_H__ */
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 5d0f294..7e1bbc2 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.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
@@ -68,41 +68,63 @@
 
 /******************** view navigation utilities *********************/
 
-static void sclip_zoom_set(SpaceClip *sc, ARegion *ar, float zoom)
+static void sclip_zoom_set(SpaceClip *sc, ARegion *ar, float zoom, float location[2])
 {
-	float oldzoom= sc->zoom;
+	float oldzoom = sc->zoom;
 	int width, height;
 
-	sc->zoom= zoom;
+	sc->zoom = zoom;
 
-	if (sc->zoom > 0.1f && sc->zoom < 4.0f)
-		return;
+	if (sc->zoom < 0.1f || sc->zoom > 4.0f) {
+		/* check zoom limits */
+		ED_space_clip_size(sc, &width, &height);
+
+		width *= sc->zoom;
+		height *= sc->zoom;
 
-	/* check zoom limits */
-	ED_space_clip_size(sc, &width, &height);
+		if ((width < 4) && (height < 4))
+			sc->zoom = oldzoom;
+		else if ((ar->winrct.xmax - ar->winrct.xmin) <= sc->zoom)
+			sc->zoom = oldzoom;
+		else if ((ar->winrct.ymax - ar->winrct.ymin) <= sc->zoom)
+			sc->zoom = oldzoom;
+	}
 
-	width*= sc->zoom;
-	height*= sc->zoom;
+	if ((U.uiflag & USER_ZOOM_TO_MOUSEPOS) && location) {
+		ED_space_clip_size(sc, &width, &height);
 
-	if((width < 4) && (height < 4))
-		sc->zoom= oldzoom;
-	else if((ar->winrct.xmax - ar->winrct.xmin) <= sc->zoom)
-		sc->zoom= oldzoom;
-	else if((ar->winrct.ymax - ar->winrct.ymin) <= sc->zoom)
-		sc->zoom= oldzoom;
+		sc->xof += ((location[0] - 0.5f) * width-sc->xof) * (sc->zoom-oldzoom) / sc->zoom;
+		sc->yof += ((location[1] - 0.5f) * height-sc->yof) * (sc->zoom-oldzoom) / sc->zoom;
+	}
 }
 
-static void sclip_zoom_set_factor(SpaceClip *sc, ARegion *ar, float zoomfac)
+static void sclip_zoom_set_factor(SpaceClip *sc, ARegion *ar, float zoomfac, float location[2])
 {
-	sclip_zoom_set(sc, ar, sc->zoom*zoomfac);
+	sclip_zoom_set(sc, ar, sc->zoom*zoomfac, location);
 }
 
+static void sclip_zoom_set_factor_exec(bContext *C, wmEvent *event, float factor)
+{
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	ARegion *ar = CTX_wm_region(C);
+	float location[2], *mpos = NULL;
+
+	if (event) {
+		ED_clip_mouse_pos(C, event, location);
+		mpos = location;
+	}
+
+	sclip_zoom_set_factor(sc, ar, factor, mpos);
+
+	ED_region_tag_redraw(CTX_wm_region(C));
+}
 
 /******************** open clip operator ********************/
 
 static void clip_filesel(bContext *C, wmOperator *op, const char *path)
 {
 	RNA_string_set(op->ptr, "filepath", path);
+
 	WM_event_add_fileselect(C, op);
 }
 
@@ -110,35 +132,35 @@ static void open_init(bContext *C, wmOperator *op)
 {
 	PropertyPointerRNA *pprop;
 
-	op->customdata= pprop= MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA");
+	op->customdata = pprop = MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA");
 	uiIDContextProperty(C, &pprop->ptr, &pprop->prop);
 }
 
 static int open_cancel(bContext *UNUSED(C), wmOperator *op)
 {
 	MEM_freeN(op->customdata);
-	op->customdata= NULL;
+	op->customdata = NULL;
 
 	return OPERATOR_CANCELLED;
 }
 
 static int open_exec(bContext *C, wmOperator *op)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
+	SpaceClip *sc = CTX_wm_space_clip(C);
 	PropertyPointerRNA *pprop;
 	PointerRNA idptr;
-	MovieClip *clip= NULL;
+	MovieClip *clip = NULL;
 	char str[FILE_MAX];
 
 	RNA_string_get(op->ptr, "filepath", str);
 	/* default to frame 1 if there's no scene in context */
 
-	errno= 0;
+	errno = 0;
 
-	clip= BKE_add_movieclip_file(str);
+	clip = BKE_add_movieclip_file(str);
 
-	if(!clip) {
-		if(op->customdata)
+	if (!clip) {
+		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");
@@ -146,13 +168,13 @@ static int open_exec(bContext *C, wmOperator *op)
 		return OPERATOR_CANCELLED;
 	}
 
-	if(!op->customdata)
+	if (!op->customdata)
 		open_init(C, op);
 
 	/* hook into UI */
-	pprop= op->customdata;
+	pprop = op->customdata;
 
-	if(pprop->prop) {
+	if (pprop->prop) {
 		/* when creating new ID blocks, use is already 1, but RNA
 		 * pointer se also increases user, so this compensates it */
 		clip->id.us--;
@@ -161,7 +183,7 @@ static int open_exec(bContext *C, wmOperator *op)
 		RNA_property_pointer_set(&pprop->ptr, pprop->prop, idptr);
 		RNA_property_update(C, &pprop->ptr, pprop->prop);
 	}
-	else if(sc) {
+	else if (sc) {
 		ED_space_clip_set(C, sc, clip);
 	}
 
@@ -174,20 +196,20 @@ static int open_exec(bContext *C, wmOperator *op)
 
 static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	char *path= U.textudir;
-	MovieClip *clip= NULL;
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	char *path = U.textudir;
+	MovieClip *clip = NULL;
 
-	if(sc)
-		clip= ED_space_clip(sc);
+	if (sc)
+		clip = ED_space_clip(sc);
 
-	if(clip)
-		path= clip->name;
+	if (clip)
+		path = clip->name;
 
-	if(!RNA_struct_property_is_set(op->ptr, "relative_path"))
+	if (!RNA_struct_property_is_set(op->ptr, "relative_path"))
 		RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
 
-	if(RNA_struct_property_is_set(op->ptr, "filepath"))
+	if (RNA_struct_property_is_set(op->ptr, "filepath"))
 		return open_exec(C, op);
 
 	open_init(C, op);
@@ -200,17 +222,17 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 void CLIP_OT_open(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Open Clip";
-	ot->description= "Load a sequence of frames or a movie file";
-	ot->idname= "CLIP_OT_open";
+	ot->name = "Open Clip";
+	ot->description = "Load a sequence of frames or a movie file";
+	ot->idname = "CLIP_OT_open";
 
 	/* api callbacks */
-	ot->exec= open_exec;
-	ot->invoke= open_invoke;
-	ot->cancel= open_cancel;
+	ot->exec = open_exec;
+	ot->invoke = open_invoke;
+	ot->cancel = open_cancel;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
@@ -220,9 +242,9 @@ void CLIP_OT_open(wmOperatorType *ot)
 
 static int reload_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	MovieClip *clip= CTX_data_edit_movieclip(C);
+	MovieClip *clip = CTX_data_edit_movieclip(C);
 
-	if(!clip)
+	if (!clip)
 		return OPERATOR_CANCELLED;
 
 	BKE_movieclip_reload(clip);
@@ -235,12 +257,12 @@ static int reload_exec(bContext *C, wmOperator *UNUSED(op))
 void CLIP_OT_reload(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Reload Clip";
-	ot->description= "Reload clip";
-	ot->idname= "CLIP_OT_reload";
+	ot->name = "Reload Clip";
+	ot->description = "Reload clip";
+	ot->idname = "CLIP_OT_reload";
 
 	/* api callbacks */
-	ot->exec= reload_exec;
+	ot->exec = reload_exec;
 }
 
 /********************** view pan operator *********************/
@@ -254,17 +276,19 @@ typedef struct ViewPanData {
 
 static void view_pan_init(bContext *C, wmOperator *op, wmEvent *event)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
+	SpaceClip *sc = CTX_wm_space_clip(C);
 	ViewPanData *vpd;
 
-	op->customdata= vpd= MEM_callocN(sizeof(ViewPanData), "ClipViewPanData");
+	op->customdata = vpd = MEM_callocN(sizeof(ViewPanData), "ClipViewPanData");
 	WM_cursor_modal(CTX_wm_window(C), BC_NSEW_SCROLLCURSOR);
 
-	vpd->x= event->x;
-	vpd->y= event->y;
+	vpd->x = event->x;
+	vpd->y = event->y;
 
-	if(sc->flag&SC_LOCK_SELECTION) vpd->vec= &sc->xlockof;
-	else vpd->vec= &sc->xof;
+	if (sc->flag & SC_LOCK_SELECTION)
+		vpd->vec= &sc->xlockof;
+	else
+		vpd->vec= &sc->xof;
 
 	copy_v2_v2(&vpd->xof, vpd->vec);
 	copy_v2_v2(&vpd->xorig, &vpd->xof);
@@ -276,9 +300,9 @@ static void view_pan_init(bContext *C, wmOperator *op, wmEvent *event)
 
 static void view_pan_exit(bContext *C, wmOperator *op, int cancel)
 {
-	ViewPanData *vpd= op->customdata;
+	ViewPanData *vpd = op->customdata;
 
-	if(cancel) {
+	if (cancel) {
 		copy_v2_v2(vpd->vec, &vpd->xorig);
 
 		ED_region_tag_redraw(CTX_wm_region(C));
@@ -290,17 +314,18 @@ static void view_pan_exit(bContext *C, wmOperator *op, int cancel)
 
 static int view_pan_exec(bContext *C, wmOperator *op)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
+	SpaceClip *sc = CTX_wm_space_clip(C);
 	float offset[2];
 
 	RNA_float_get_array(op->ptr, "offset", offset);
 
-	if(sc->flag&SC_LOCK_SELECTION) {
-		sc->xlockof+= offset[0];
-		sc->ylockof+= offset[1];
-	} else {
-		sc->xof+= offset[0];
-		sc->yof+= offset[1];
+	if (sc->flag & SC_LOCK_SELECTION) {
+		sc->xlockof += offset[0];
+		sc->ylockof += offset[1];
+	}
+	else {
+		sc->xof += offset[0];
+		sc->yof += offset[1];
 	}
 
 	ED_region_tag_redraw(CTX_wm_region(C));
@@ -310,47 +335,52 @@ static int view_pan_exec(bContext *C, wmOperator *op)
 
 static int view_pan_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	if (event->type==MOUSEPAN) {
-		SpaceClip *sc= CTX_wm_space_clip(C);
+	if (event->type == MOUSEPAN) {
+		SpaceClip *sc = CTX_wm_space_clip(C);
 		float offset[2];
 
-		offset[0]= (event->x - event->prevx)/sc->zoom;
-		offset[1]= (event->y - event->prevy)/sc->zoom;
+		offset[0] = (event->x - event->prevx) / sc->zoom;
+		offset[1] = (event->y - event->prevy) / sc->zoom;
 
 		RNA_float_set_array(op->ptr, "offset", offset);
 
 		view_pan_exec(C, op);
+
 		return OPERATOR_FINISHED;
 	}
 	else {
 		view_pan_init(C, op, event);
+
 		return OPERATOR_RUNNING_MODAL;
 	}
 }
 
 static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	ViewPanData *vpd= op->customdata;
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	ViewPanData *vpd = op->customdata;
 	float offset[2];
 
 	switch(event->type) {
 		case MOUSEMOVE:
 			copy_v2_v2(vpd->vec, &vpd->xorig);
-			offset[0]= (vpd->x - event->x)/sc->zoom;
-			offset[1]= (vpd->y - event->y)/sc->zoom;
+			offset[0] = (vpd->x - event->x) / sc->zoom;
+			offset[1] = (vpd->y - event->y) / sc->zoom;
 			RNA_float_set_array(op->ptr, "offset", offset);
 			view_pan_exec(C, op);
 			break;
 		case ESCKEY:
 			view_pan_exit(C, op, 1);
+
 			return OPERATOR_CANCELLED;
 		case SPACEKEY:
 			view_pan_exit(C, op, 0);
+
 			return OPERATOR_FINISHED;
 		default:
-			if(event->type==vpd->event_type &&  event->val==KM_RELEASE) {
+			if (event->type == vpd->event_type &&  event->val == KM_RELEASE) {
 				view_pan_exit(C, op, 0);
+
 				return OPERATOR_FINISHED;
 			}
 			break;
@@ -369,18 +399,18 @@ static int view_pan_cancel(bContext *C, wmOperator *op)
 void CLIP_OT_view_pan(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View Pan";
-	ot->idname= "CLIP_OT_view_pan";
+	ot->name = "View Pan";
+	ot->idname = "CLIP_OT_view_pan";
 
 	/* api callbacks */
-	ot->exec= view_pan_exec;
-	ot->invoke= view_pan_invoke;
-	ot->modal= view_pan_modal;
-	ot->cancel= view_pan_cancel;
-	ot->poll= ED_space_clip_poll;
+	ot->exec = view_pan_exec;
+	ot->invoke = view_pan_invoke;
+	ot->modal = view_pan_modal;
+	ot->cancel = view_pan_cancel;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_BLOCKING;
 
 	/* properties */
 	RNA_def_float_vector(ot->srna, "offset", 2, NULL, -FLT_MAX, FLT_MAX,
@@ -393,31 +423,34 @@ typedef struct ViewZoomData {
 	float x, y;
 	float zoom;
 	int event_type;
+	float location[2];
 } ViewZoomData;
 
 static void view_zoom_init(bContext *C, wmOperator *op, wmEvent *event)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
+	SpaceClip *sc = CTX_wm_space_clip(C);
 	ViewZoomData *vpd;
 
 	op->customdata= vpd= MEM_callocN(sizeof(ViewZoomData), "ClipViewZoomData");
 	WM_cursor_modal(CTX_wm_window(C), BC_NSEW_SCROLLCURSOR);
 
-	vpd->x= event->x;
-	vpd->y= event->y;
-	vpd->zoom= sc->zoom;
-	vpd->event_type= event->type;
+	vpd->x = event->x;
+	vpd->y = event->y;
+	vpd->zoom = sc->zoom;
+	vpd->event_type = event->type;
+
+	ED_clip_mouse_pos(C, event, vpd->location);
 
 	WM_event_add_modal_handler(C, op);
 }
 
 static void view_zoom_exit(bContext *C, wmOperator *op, int cancel)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	ViewZoomData *vpd= op->customdata;
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	ViewZoomData *vpd = op->customdata;
 
-	if(cancel) {
-		sc->zoom= vpd->zoom;
+	if (cancel) {
+		sc->zoom = vpd->zoom;
 		ED_region_tag_redraw(CTX_wm_region(C));
 	}
 
@@ -427,10 +460,10 @@ static void view_zoom_exit(bContext *C, wmOperator *op, int cancel)
 
 static int view_zoom_exec(bContext *C, wmOperator *op)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	ARegion *ar= CTX_wm_region(C);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	ARegion *ar = CTX_wm_region(C);
 
-	sclip_zoom_set_factor(sc, ar, RNA_float_get(op->ptr, "factor"));
+	sclip_zoom_set_factor(sc, ar, RNA_float_get(op->ptr, "factor"), NULL);
 
 	ED_region_tag_redraw(CTX_wm_region(C));
 
@@ -439,41 +472,41 @@ static int view_zoom_exec(bContext *C, wmOperator *op)
 
 static int view_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	if (event->type==MOUSEZOOM) {
-		SpaceClip *sc= CTX_wm_space_clip(C);
-		ARegion *ar= CTX_wm_region(C);
+	if (event->type == MOUSEZOOM) {
 		float factor;
 
-		factor= 1.0f + (event->x-event->prevx+event->y-event->prevy)/300.0f;
+		factor = 1.0f + (event->x - event->prevx + event->y - event->prevy) / 300.0f;
 		RNA_float_set(op->ptr, "factor", factor);
-		sclip_zoom_set(sc, ar, sc->zoom*factor);
-		ED_region_tag_redraw(CTX_wm_region(C));
+
+		sclip_zoom_set_factor_exec(C, event, factor);
 
 		return OPERATOR_FINISHED;
 	}
 	else {
 		view_zoom_init(C, op, event);
+
 		return OPERATOR_RUNNING_MODAL;
 	}
 }
 
 static int view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	ARegion *ar= CTX_wm_region(C);
-	ViewZoomData *vpd= op->customdata;
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	ARegion *ar = CTX_wm_region(C);
+	ViewZoomData *vpd = op->customdata;
 	float factor;
 
 	switch(event->type) {
 		case MOUSEMOVE:
-			factor= 1.0f + (vpd->x-event->x+vpd->y-event->y)/300.0f;
+			factor = 1.0f + (vpd->x-event->x + vpd->y - event->y) / 300.0f;
 			RNA_float_set(op->ptr, "factor", factor);
-			sclip_zoom_set(sc, ar, vpd->zoom*factor);
+			sclip_zoom_set(sc, 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) {
+			if (event->type == vpd->event_type && event->val == KM_RELEASE) {
 				view_zoom_exit(C, op, 0);
+
 				return OPERATOR_FINISHED;
 			}
 			break;
@@ -485,24 +518,25 @@ static int view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event)
 static int view_zoom_cancel(bContext *C, wmOperator *op)
 {
 	view_zoom_exit(C, op, 1);
+
 	return OPERATOR_CANCELLED;
 }
 
 void CLIP_OT_view_zoom(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View Zoom";
-	ot->idname= "CLIP_OT_view_zoom";
+	ot->name = "View Zoom";
+	ot->idname = "CLIP_OT_view_zoom";
 
 	/* api callbacks */
-	ot->exec= view_zoom_exec;
-	ot->invoke= view_zoom_invoke;
-	ot->modal= view_zoom_modal;
-	ot->cancel= view_zoom_cancel;
-	ot->poll= ED_space_clip_poll;
+	ot->exec = view_zoom_exec;
+	ot->invoke = view_zoom_invoke;
+	ot->modal = view_zoom_modal;
+	ot->cancel = view_zoom_cancel;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
+	ot->flag = OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
 
 	/* properties */
 	RNA_def_float(ot->srna, "factor", 0.0f, 0.0f, FLT_MAX,
@@ -511,100 +545,98 @@ void CLIP_OT_view_zoom(wmOperatorType *ot)
 
 /********************** view zoom in/out operator *********************/
 
-static int view_zoom_in_exec(bContext *C, wmOperator *UNUSED(op))
+static int view_zoom_in_exec(bContext *C, wmOperator *op)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	ARegion *ar= CTX_wm_region(C);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	ARegion *ar = CTX_wm_region(C);
+	float location[2];
 
-	sclip_zoom_set_factor(sc, ar, 1.25f);
+	RNA_float_get_array(op->ptr, "location", location);
+
+	sclip_zoom_set_factor(sc, ar, 1.25f, location);
 
 	ED_region_tag_redraw(CTX_wm_region(C));
 
 	return OPERATOR_FINISHED;
 }
 
-static int view_zoom_out_exec(bContext *C, wmOperator *UNUSED(op))
+static int view_zoom_in_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	ARegion *ar= CTX_wm_region(C);
+	float location[2];
 
-	sclip_zoom_set_factor(sc, ar, 0.8f);
+	ED_clip_mouse_pos(C, event, location);
+	RNA_float_set_array(op->ptr, "location", location);
 
-	ED_region_tag_redraw(CTX_wm_region(C));
-
-	return OPERATOR_FINISHED;
+	return view_zoom_in_exec(C, op);
 }
 
-static int view_zoom_inout_invoke(bContext *C, wmOperator *op, wmEvent *event, int out)
+void CLIP_OT_view_zoom_in(wmOperatorType *ot)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	float co[2], oldzoom= sc->zoom;
+	/* identifiers */
+	ot->name = "View Zoom In";
+	ot->idname = "CLIP_OT_view_zoom_in";
 
-	ED_clip_mouse_pos(C, event, co);
+	/* api callbacks */
+	ot->exec = view_zoom_in_exec;
+	ot->invoke = view_zoom_in_invoke;
+	ot->poll = ED_space_clip_poll;
 
-	if(out)
-		view_zoom_out_exec(C, op);
-	else
-		view_zoom_in_exec(C, op);
+	/* properties */
+	RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in screen coordinates", -10.0f, 10.0f);
+}
 
-	if(U.uiflag&USER_ZOOM_TO_MOUSEPOS) {
-		int width, height;
+static int view_zoom_out_exec(bContext *C, wmOperator *op)
+{
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	ARegion *ar = CTX_wm_region(C);
+	float location[2];
 
-		ED_space_clip_size(sc, &width, &height);
+	RNA_float_get_array(op->ptr, "location", location);
 
-		sc->xof+= ((co[0]-0.5f)*width-sc->xof)*(sc->zoom-oldzoom)/sc->zoom;
-		sc->yof+= ((co[1]-0.5f)*height-sc->yof)*(sc->zoom-oldzoom)/sc->zoom;
-	}
+	sclip_zoom_set_factor(sc, ar, 0.8f, location);
 
-	return OPERATOR_FINISHED;
-}
+	ED_region_tag_redraw(CTX_wm_region(C));
 
-static int view_zoom_in_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
-	return view_zoom_inout_invoke(C, op, event, 0);
+	return OPERATOR_FINISHED;
 }
 
-void CLIP_OT_view_zoom_in(wmOperatorType *ot)
+static int view_zoom_out_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	/* identifiers */
-	ot->name= "View Zoom In";
-	ot->idname= "CLIP_OT_view_zoom_in";
+	float location[2];
 
-	/* api callbacks */
-	ot->exec= view_zoom_in_exec;
-	ot->invoke= view_zoom_in_invoke;
-	ot->poll= ED_space_clip_poll;
-}
+	ED_clip_mouse_pos(C, event, location);
+	RNA_float_set_array(op->ptr, "location", location);
 
-static int view_zoom_out_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
-	return view_zoom_inout_invoke(C, op, event, 1);
+	return view_zoom_out_exec(C, op);
 }
 
 void CLIP_OT_view_zoom_out(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View Zoom Out";
-	ot->idname= "CLIP_OT_view_zoom_out";
+	ot->name = "View Zoom Out";
+	ot->idname = "CLIP_OT_view_zoom_out";
 
 	/* api callbacks */
-	ot->exec= view_zoom_out_exec;
-	ot->invoke= view_zoom_out_invoke;
-	ot->poll= ED_space_clip_poll;
+	ot->exec = view_zoom_out_exec;
+	ot->invoke = view_zoom_out_invoke;
+	ot->poll = ED_space_clip_poll;
+
+	/* properties */
+	RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in normalised (0.0-1.0) coordinates", -10.0f, 10.0f);
 }
 
 /********************** view zoom ratio operator *********************/
 
 static int view_zoom_ratio_exec(bContext *C, wmOperator *op)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	ARegion *ar= CTX_wm_region(C);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	ARegion *ar = CTX_wm_region(C);
 
-	sclip_zoom_set(sc, ar, RNA_float_get(op->ptr, "ratio"));
+	sclip_zoom_set(sc, ar, RNA_float_get(op->ptr, "ratio"), NULL);
 
 	/* ensure pixel exact locations for draw */
-	sc->xof= (int)sc->xof;
-	sc->yof= (int)sc->yof;
+	sc->xof= (int) sc->xof;
+	sc->yof= (int) sc->yof;
 
 	ED_region_tag_redraw(CTX_wm_region(C));
 
@@ -614,12 +646,12 @@ static int view_zoom_ratio_exec(bContext *C, wmOperator *op)
 void CLIP_OT_view_zoom_ratio(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View Zoom Ratio";
-	ot->idname= "CLIP_OT_view_zoom_ratio";
+	ot->name = "View Zoom Ratio";
+	ot->idname = "CLIP_OT_view_zoom_ratio";
 
 	/* api callbacks */
-	ot->exec= view_zoom_ratio_exec;
-	ot->poll= ED_space_clip_poll;
+	ot->exec = view_zoom_ratio_exec;
+	ot->poll = ED_space_clip_poll;
 
 	/* properties */
 	RNA_def_float(ot->srna, "ratio", 0.0f, 0.0f, FLT_MAX,
@@ -628,39 +660,50 @@ void CLIP_OT_view_zoom_ratio(wmOperatorType *ot)
 
 /********************** view all operator *********************/
 
-static int view_all_exec(bContext *C, wmOperator *UNUSED(op))
+static int view_all_exec(bContext *C, wmOperator *op)
 {
 	SpaceClip *sc;
 	ARegion *ar;
 	int w, h, width, height;
 	float aspx, aspy;
+	int fit_view= RNA_boolean_get(op->ptr, "fit_view");
+	float zoomx, zoomy;
 
 	/* retrieve state */
-	sc= CTX_wm_space_clip(C);
-	ar= CTX_wm_region(C);
+	sc = CTX_wm_space_clip(C);
+	ar = CTX_wm_region(C);
 
 	ED_space_clip_size(sc, &w, &h);
 	ED_space_clip_aspect(sc, &aspx, &aspy);
 
-	w= w*aspx;
-	h= h*aspy;
+	w = w * aspx;
+	h = h * aspy;
 
 	/* check if the image will fit in the image with zoom==1 */
-	width= ar->winrct.xmax - ar->winrct.xmin + 1;
-	height= ar->winrct.ymax - ar->winrct.ymin + 1;
+	width = ar->winrct.xmax - ar->winrct.xmin + 1;
+	height = ar->winrct.ymax - ar->winrct.ymin + 1;
+
+	if (fit_view) {
+		const int margin = 5; /* margin from border */
 
-	if((w >= width || h >= height) && (width > 0 && height > 0)) {
-		float zoomx, zoomy;
+		zoomx= (float) width / (w + 2 * margin);
+		zoomy= (float) height / (h + 2 * margin);
 
-		/* find the zoom value that will fit the image in the image space */
-		zoomx= (float)width/w;
-		zoomy= (float)height/h;
-		sclip_zoom_set(sc, ar, 1.0f/power_of_2(1/MIN2(zoomx, zoomy)));
+		sclip_zoom_set(sc, ar, MIN2(zoomx, zoomy), NULL);
 	}
-	else
-		sclip_zoom_set(sc, ar, 1.0f);
+	else {
+		if ((w >= width || h >= height) && (width > 0 && height > 0)) {
+			zoomx= (float) width / w;
+			zoomy= (float) height / h;
 
-	sc->xof= sc->yof= 0.0f;
+			/* find the zoom value that will fit the image in the image space */
+			sclip_zoom_set(sc, ar, 1.0f/power_of_2(1/MIN2(zoomx, zoomy)), NULL);
+		}
+		else
+			sclip_zoom_set(sc, ar, 1.0f, NULL);
+	}
+
+	sc->xof = sc->yof = 0.0f;
 
 	ED_region_tag_redraw(CTX_wm_region(C));
 
@@ -670,23 +713,26 @@ static int view_all_exec(bContext *C, wmOperator *UNUSED(op))
 void CLIP_OT_view_all(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View All";
-	ot->idname= "CLIP_OT_view_all";
+	ot->name = "View All";
+	ot->idname = "CLIP_OT_view_all";
 
 	/* api callbacks */
-	ot->exec= view_all_exec;
-	ot->poll= ED_space_clip_poll;
+	ot->exec = view_all_exec;
+	ot->poll = ED_space_clip_poll;
+
+	/* properties */
+	RNA_def_boolean(ot->srna, "fit_view", 0, "Fit View", "Fit frame to the viewport");
 }
 
 /********************** view selected operator *********************/
 
 static int view_selected_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	ARegion *ar= CTX_wm_region(C);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	ARegion *ar = CTX_wm_region(C);
 
-	sc->xlockof= 0.0f;
-	sc->ylockof= 0.0f;
+	sc->xlockof = 0.0f;
+	sc->ylockof = 0.0f;
 
 	ED_clip_view_selection(sc, ar, 1);
 	ED_region_tag_redraw(CTX_wm_region(C));
@@ -697,12 +743,12 @@ static int view_selected_exec(bContext *C, wmOperator *UNUSED(op))
 void CLIP_OT_view_selected(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View Selected";
-	ot->idname= "CLIP_OT_view_selected";
+	ot->name = "View Selected";
+	ot->idname = "CLIP_OT_view_selected";
 
 	/* api callbacks */
-	ot->exec= view_selected_exec;
-	ot->poll= ED_space_clip_poll;
+	ot->exec = view_selected_exec;
+	ot->poll = ED_space_clip_poll;
 }
 
 /********************** change frame operator *********************/
@@ -710,7 +756,7 @@ void CLIP_OT_view_selected(wmOperatorType *ot)
 static int change_frame_poll(bContext *C)
 {
 	/* prevent changes during render */
-	if(G.rendering)
+	if (G.rendering)
 		return 0;
 
 	return ED_space_clip_poll(C);
@@ -718,10 +764,10 @@ static int change_frame_poll(bContext *C)
 
 static void change_frame_apply(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 
 	/* set the new frame number */
-	CFRA= RNA_int_get(op->ptr, "frame");
+	CFRA = RNA_int_get(op->ptr, "frame");
 	FRAMENUMBER_MIN_CLAMP(CFRA);
 	SUBFRA = 0.0f;
 
@@ -739,20 +785,21 @@ static int change_frame_exec(bContext *C, wmOperator *op)
 
 static int frame_from_event(bContext *C, wmEvent *event)
 {
-	ARegion *ar= CTX_wm_region(C);
-	Scene *scene= CTX_data_scene(C);
-	int framenr= 0;
+	ARegion *ar = CTX_wm_region(C);
+	Scene *scene = CTX_data_scene(C);
+	int framenr = 0;
 
-	if(ar->regiontype == RGN_TYPE_WINDOW) {
-		float sfra= SFRA, efra= EFRA, framelen= ar->winx/(efra-sfra+1);
+	if (ar->regiontype == RGN_TYPE_WINDOW) {
+		float sfra = SFRA, efra = EFRA, framelen = ar->winx / (efra - sfra + 1);
 
-		framenr= sfra+event->mval[0]/framelen;
-	} else {
+		framenr = sfra + event->mval[0] / framelen;
+	}
+	else {
 		float viewx, viewy;
 
 		UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &viewx, &viewy);
 
-		framenr= (int)floor(viewx+0.5f);
+		framenr= (int) floor(viewx + 0.5f);
 	}
 
 	return framenr;
@@ -760,10 +807,10 @@ static int frame_from_event(bContext *C, wmEvent *event)
 
 static int change_frame_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	ARegion *ar= CTX_wm_region(C);
+	ARegion *ar = CTX_wm_region(C);
 
-	if(ar->regiontype == RGN_TYPE_WINDOW) {
-		if(event->mval[1]>16)
+	if (ar->regiontype == RGN_TYPE_WINDOW) {
+		if (event->mval[1] > 16)
 			return OPERATOR_PASS_THROUGH;
 	}
 
@@ -790,7 +837,7 @@ static int change_frame_modal(bContext *C, wmOperator *op, wmEvent *event)
 
 		case LEFTMOUSE:
 		case RIGHTMOUSE:
-			if (event->val==KM_RELEASE)
+			if (event->val == KM_RELEASE)
 				return OPERATOR_FINISHED;
 			break;
 	}
@@ -801,18 +848,18 @@ static int change_frame_modal(bContext *C, wmOperator *op, wmEvent *event)
 void CLIP_OT_change_frame(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Change frame";
-	ot->idname= "CLIP_OT_change_frame";
-	ot->description= "Interactively change the current frame number";
+	ot->name = "Change frame";
+	ot->idname = "CLIP_OT_change_frame";
+	ot->description = "Interactively change the current frame number";
 
 	/* api callbacks */
-	ot->exec= change_frame_exec;
-	ot->invoke= change_frame_invoke;
-	ot->modal= change_frame_modal;
-	ot->poll= change_frame_poll;
+	ot->exec = change_frame_exec;
+	ot->invoke = change_frame_invoke;
+	ot->modal = change_frame_modal;
+	ot->poll = change_frame_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_BLOCKING|OPTYPE_UNDO;
+	ot->flag = OPTYPE_BLOCKING|OPTYPE_UNDO;
 
 	/* rna */
 	RNA_def_int(ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME);
@@ -824,7 +871,8 @@ typedef struct ProxyBuildJob {
 	Scene *scene;
 	struct Main *main;
 	MovieClip *clip;
-	int clip_flag;
+	int clip_flag, stop;
+	struct IndexBuildContext *index_context;
 } ProxyJob;
 
 static void proxy_freejob(void *pjv)
@@ -839,18 +887,25 @@ static int proxy_bitflag_to_array(int size_flag, int build_sizes[4], int undisto
 	int build_count = 0;
 	int size_flags[2][4] = {{MCLIP_PROXY_SIZE_25,
 	                         MCLIP_PROXY_SIZE_50,
-                             MCLIP_PROXY_SIZE_75,
-                             MCLIP_PROXY_SIZE_100},
-                            {MCLIP_PROXY_UNDISTORTED_SIZE_25,
-                             MCLIP_PROXY_UNDISTORTED_SIZE_50,
-                             MCLIP_PROXY_UNDISTORTED_SIZE_75,
-                             MCLIP_PROXY_UNDISTORTED_SIZE_100}};
+	                         MCLIP_PROXY_SIZE_75,
+	                         MCLIP_PROXY_SIZE_100},
+	                        {MCLIP_PROXY_UNDISTORTED_SIZE_25,
+	                         MCLIP_PROXY_UNDISTORTED_SIZE_50,
+	                         MCLIP_PROXY_UNDISTORTED_SIZE_75,
+	                         MCLIP_PROXY_UNDISTORTED_SIZE_100}};
 	int size_nr = undistort ? 1 : 0;
 
-	if(size_flag & size_flags[size_nr][0]) build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_25;
-	if(size_flag & size_flags[size_nr][1]) build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_50;
-	if(size_flag & size_flags[size_nr][2]) build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_75;
-	if(size_flag & size_flags[size_nr][3]) build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_100;
+	if (size_flag & size_flags[size_nr][0])
+		build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_25;
+
+	if (size_flag & size_flags[size_nr][1])
+		build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_50;
+
+	if (size_flag & size_flags[size_nr][2])
+		build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_75;
+
+	if (size_flag & size_flags[size_nr][3])
+		build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_100;
 
 	return build_count;
 }
@@ -858,80 +913,104 @@ static int proxy_bitflag_to_array(int size_flag, int build_sizes[4], int undisto
 /* only this runs inside thread */
 static void proxy_startjob(void *pjv, short *stop, short *do_update, float *progress)
 {
-	ProxyJob *pj= pjv;
-	Scene *scene=pj->scene;
-	MovieClip *clip= pj->clip;
-	struct MovieDistortion *distortion= NULL;
-	short tc_flag, size_flag, quality;
-	int cfra, sfra= SFRA, efra= EFRA;
-	int build_sizes[4], build_count= 0;
-	int build_undistort_sizes[4], build_undistort_count= 0;
-
-	tc_flag= clip->proxy.build_tc_flag;
-	size_flag= clip->proxy.build_size_flag;
-	quality= clip->proxy.quality;
-
-	build_count= proxy_bitflag_to_array(size_flag, build_sizes, 0);
-	build_undistort_count= proxy_bitflag_to_array(size_flag, build_undistort_sizes, 1);
-
-	if(clip->source == MCLIP_SRC_MOVIE) {
-		if(clip->anim)
-			IMB_anim_index_rebuild(clip->anim, tc_flag, size_flag, quality, stop, do_update, progress);
-
-		if(!build_undistort_count) {
+	ProxyJob *pj = pjv;
+	Scene *scene = pj->scene;
+	MovieClip *clip = pj->clip;
+	struct MovieDistortion *distortion = NULL;
+	short size_flag;
+	int cfra, sfra = SFRA, efra = EFRA;
+	int build_sizes[4], build_count = 0;
+	int build_undistort_sizes[4], build_undistort_count = 0;
+
+	size_flag = clip->proxy.build_size_flag;
+
+	build_count = proxy_bitflag_to_array(size_flag, build_sizes, 0);
+	build_undistort_count = proxy_bitflag_to_array(size_flag, build_undistort_sizes, 1);
+
+	if (clip->source == MCLIP_SRC_MOVIE) {
+		if (pj->index_context)
+			IMB_anim_index_rebuild(pj->index_context, stop, do_update, progress);
+
+		if (!build_undistort_count) {
+			if (*stop)
+				pj->stop = 1;
+
 			return;
 		}
 		else {
-			sfra= 1;
-			efra= IMB_anim_get_duration(clip->anim, IMB_TC_NONE);
+			sfra = 1;
+			efra = IMB_anim_get_duration(clip->anim, IMB_TC_NONE);
 		}
 	}
 
-	if(build_undistort_count)
-		distortion= BKE_tracking_distortion_create();
+	if (build_undistort_count)
+		distortion = BKE_tracking_distortion_create();
 
-	for(cfra= sfra; cfra<=efra; cfra++) {
-		if(clip->source != MCLIP_SRC_MOVIE)
+	for (cfra = sfra; cfra <= efra; cfra++) {
+		if (clip->source != MCLIP_SRC_MOVIE)
 			BKE_movieclip_build_proxy_frame(clip, pj->clip_flag, NULL, cfra, build_sizes, build_count, 0);
 
 		BKE_movieclip_build_proxy_frame(clip, pj->clip_flag, distortion, cfra, build_undistort_sizes, build_undistort_count, 1);
 
-		if(*stop || G.afbreek)
+		if (*stop || G.afbreek)
 			break;
 
-		*do_update= 1;
-		*progress= ((float)cfra)/(efra-sfra);
+		*do_update = TRUE;
+		*progress= ((float) cfra) / (efra - sfra);
 	}
 
-	if(distortion)
+	if (distortion)
 		BKE_tracking_distortion_destroy(distortion);
+
+	if (*stop)
+		pj->stop = 1;
+}
+
+static void proxy_endjob(void *pjv)
+{
+	ProxyJob *pj = pjv;
+
+	if (pj->clip->anim)
+		IMB_close_anim_proxies(pj->clip->anim);
+
+	if (pj->index_context)
+		IMB_anim_index_rebuild_finish(pj->index_context, pj->stop);
+
+	BKE_movieclip_reload(pj->clip);
+
+	WM_main_add_notifier(NC_MOVIECLIP|ND_DISPLAY, pj->clip);
 }
 
 static int clip_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
 {
 	wmJob * steve;
 	ProxyJob *pj;
-	Scene *scene= CTX_data_scene(C);
-	ScrArea *sa= CTX_wm_area(C);
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
+	Scene *scene = CTX_data_scene(C);
+	ScrArea *sa = CTX_wm_area(C);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
 
-	if((clip->flag&MCLIP_USE_PROXY)==0)
+	if ((clip->flag & MCLIP_USE_PROXY) == 0)
 		return OPERATOR_CANCELLED;
 
-	steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Building Proxies", WM_JOB_PROGRESS);
+	steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Building Proxies", WM_JOB_PROGRESS);
+
+	pj = MEM_callocN(sizeof(ProxyJob), "proxy rebuild job");
+	pj->scene = scene;
+	pj->main = CTX_data_main(C);
+	pj->clip = clip;
+	pj->clip_flag = clip->flag & MCLIP_TIMECODE_FLAGS;
 
-	pj= MEM_callocN(sizeof(ProxyJob), "proxy rebuild job");
-	pj->scene= scene;
-	pj->main= CTX_data_main(C);
-	pj->clip= clip;
-	pj->clip_flag= clip->flag&MCLIP_TIMECODE_FLAGS;
+	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);
+	}
 
 	WM_jobs_customdata(steve, pj, proxy_freejob);
 	WM_jobs_timer(steve, 0.2, NC_MOVIECLIP|ND_DISPLAY, 0);
-	WM_jobs_callbacks(steve, proxy_startjob, NULL, NULL, NULL);
+	WM_jobs_callbacks(steve, proxy_startjob, NULL, NULL, proxy_endjob);
 
-	G.afbreek= 0;
+	G.afbreek = 0;
 	WM_jobs_start(CTX_wm_manager(C), steve);
 
 	ED_area_tag_redraw(CTX_wm_area(C));
@@ -942,31 +1021,32 @@ static int clip_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
 void CLIP_OT_rebuild_proxy(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Rebuild Proxy and Timecode Indices";
-	ot->idname= "CLIP_OT_rebuild_proxy";
-	ot->description= "Rebuild all selected proxies and timecode indices in the background";
+	ot->name = "Rebuild Proxy and Timecode Indices";
+	ot->idname = "CLIP_OT_rebuild_proxy";
+	ot->description = "Rebuild all selected proxies and timecode indices in the background";
 
 	/* api callbacks */
-	ot->exec= clip_rebuild_proxy_exec;
-	ot->poll= ED_space_clip_poll;
+	ot->exec = clip_rebuild_proxy_exec;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER;
+	ot->flag = OPTYPE_REGISTER;
 }
 
 /********************** mode set operator *********************/
 
 static int mode_set_exec(bContext *C, wmOperator *op)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	int mode= RNA_enum_get(op->ptr, "mode");
-	int toggle= RNA_boolean_get(op->ptr, "toggle");
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	int mode = RNA_enum_get(op->ptr, "mode");
+	int toggle = RNA_boolean_get(op->ptr, "toggle");
 
-	if(sc->mode==mode) {
-		if(toggle)
-			sc->mode= SC_MODE_TRACKING;
-	} else {
-		sc->mode= mode;
+	if (sc->mode == mode) {
+		if (toggle)
+			sc->mode = SC_MODE_TRACKING;
+	}
+	else {
+		sc->mode = mode;
 	}
 
 	WM_event_add_notifier(C, NC_SPACE|ND_SPACE_CLIP, NULL);
@@ -984,14 +1064,14 @@ void CLIP_OT_mode_set(wmOperatorType *ot)
 
 
 	/* identifiers */
-	ot->name= "Set Clip Mode";
+	ot->name = "Set Clip Mode";
 	ot->description = "Set the clip interaction mode";
-	ot->idname= "CLIP_OT_mode_set";
+	ot->idname = "CLIP_OT_mode_set";
 
 	/* api callbacks */
-	ot->exec= mode_set_exec;
+	ot->exec = mode_set_exec;
 
-	ot->poll= ED_space_clip_poll;
+	ot->poll = ED_space_clip_poll;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "mode", mode_items, SC_MODE_TRACKING, "Mode", "");
@@ -1005,15 +1085,15 @@ void ED_operatormacros_clip(void)
 	wmOperatorType *ot;
 	wmOperatorTypeMacro *otmacro;
 
-	ot= WM_operatortype_append_macro("CLIP_OT_add_marker_move", "Add Marker and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
+	ot = WM_operatortype_append_macro("CLIP_OT_add_marker_move", "Add Marker and Move", OPTYPE_UNDO|OPTYPE_REGISTER);
 	ot->description = "Add new marker and move it on movie";
 	WM_operatortype_macro_define(ot, "CLIP_OT_add_marker");
-	otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+	otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
 	RNA_struct_idprops_unset(otmacro->ptr, "release_confirm");
 
-	ot= WM_operatortype_append_macro("CLIP_OT_add_marker_slide", "Add Marker and Slide", OPTYPE_UNDO|OPTYPE_REGISTER);
+	ot = WM_operatortype_append_macro("CLIP_OT_add_marker_slide", "Add Marker and Slide", OPTYPE_UNDO|OPTYPE_REGISTER);
 	ot->description = "Add new marker and slide it with mouse until mouse button release";
 	WM_operatortype_macro_define(ot, "CLIP_OT_add_marker");
-	otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+	otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
 	RNA_boolean_set(otmacro->ptr, "release_confirm", TRUE);
 }
diff --git a/source/blender/editors/space_clip/clip_toolbar.c b/source/blender/editors/space_clip/clip_toolbar.c
index 941c12d..b80deb8 100644
--- a/source/blender/editors/space_clip/clip_toolbar.c
+++ b/source/blender/editors/space_clip/clip_toolbar.c
@@ -25,7 +25,7 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-/** \file blender/editors/space_clip/clip_header.c
+/** \file blender/editors/space_clip/clip_toolbar.c
  *  \ingroup spclip
  */
 
@@ -60,24 +60,24 @@ static ARegion *clip_has_properties_region(ScrArea *sa)
 {
 	ARegion *ar, *arnew;
 
-	ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
-	if(ar)
+	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)
+	if (ar == NULL)
 		return NULL;
 
-	arnew= MEM_callocN(sizeof(ARegion), "clip properties region");
+	arnew = MEM_callocN(sizeof(ARegion), "clip properties region");
 
 	BLI_insertlinkafter(&sa->regionbase, ar, arnew);
-	arnew->regiontype= RGN_TYPE_UI;
-	arnew->alignment= RGN_ALIGN_RIGHT;
+	arnew->regiontype = RGN_TYPE_UI;
+	arnew->alignment = RGN_ALIGN_RIGHT;
 
-	arnew->flag= RGN_FLAG_HIDDEN;
+	arnew->flag = RGN_FLAG_HIDDEN;
 
 	return arnew;
 }
@@ -89,10 +89,10 @@ static int properties_poll(bContext *C)
 
 static int properties_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	ScrArea *sa= CTX_wm_area(C);
-	ARegion *ar= clip_has_properties_region(sa);
+	ScrArea *sa = CTX_wm_area(C);
+	ARegion *ar = clip_has_properties_region(sa);
 
-	if(ar)
+	if (ar)
 		ED_region_toggle_hidden(C, ar);
 
 	return OPERATOR_FINISHED;
@@ -101,56 +101,57 @@ static int properties_exec(bContext *C, wmOperator *UNUSED(op))
 void CLIP_OT_properties(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Properties";
-	ot->description= "Toggle clip properties panel";
-	ot->idname= "CLIP_OT_properties";
+	ot->name = "Properties";
+	ot->description = "Toggle clip properties panel";
+	ot->idname = "CLIP_OT_properties";
 
 	/* api callbacks */
-	ot->exec= properties_exec;
-	ot->poll= properties_poll;
+	ot->exec = properties_exec;
+	ot->poll = properties_poll;
 }
 
 /************************** tools ******************************/
 
 static ARegion *clip_has_tools_region(ScrArea *sa)
 {
-	ARegion *ar, *artool=NULL, *arprops=NULL, *arhead;
+	ARegion *ar, *artool = NULL, *arprops = NULL, *arhead;
 
-	for(ar= sa->regionbase.first; ar; ar= ar->next) {
-		if(ar->regiontype==RGN_TYPE_TOOLS)
-			artool= ar;
-		if(ar->regiontype==RGN_TYPE_TOOL_PROPS)
-			arprops= ar;
+	for (ar = sa->regionbase.first; ar; ar = ar->next) {
+		if (ar->regiontype == RGN_TYPE_TOOLS)
+			artool = ar;
+
+		if (ar->regiontype == RGN_TYPE_TOOL_PROPS)
+			arprops = ar;
 	}
 
 	/* tool region hide/unhide also hides props */
-	if(arprops && artool)
+	if (arprops && artool)
 		return artool;
 
-	if(artool==NULL) {
+	if (artool == NULL) {
 		/* add subdiv level; after header */
-		arhead= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
+		arhead = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
 
 		/* is error! */
-		if(arhead==NULL)
+		if (arhead == NULL)
 			return NULL;
 
-		artool= MEM_callocN(sizeof(ARegion), "clip tools region");
+		artool = MEM_callocN(sizeof(ARegion), "clip tools region");
 
 		BLI_insertlinkafter(&sa->regionbase, arhead, artool);
-		artool->regiontype= RGN_TYPE_TOOLS;
-		artool->alignment= RGN_ALIGN_LEFT;
+		artool->regiontype = RGN_TYPE_TOOLS;
+		artool->alignment = RGN_ALIGN_LEFT;
 
-		artool->flag= RGN_FLAG_HIDDEN;
+		artool->flag = RGN_FLAG_HIDDEN;
 	}
 
-	if(arprops==NULL) {
+	if (arprops == NULL) {
 		/* add extra subdivided region for tool properties */
-		arprops= MEM_callocN(sizeof(ARegion), "tool props for clip");
+		arprops = MEM_callocN(sizeof(ARegion), "tool props for clip");
 
 		BLI_insertlinkafter(&sa->regionbase, artool, arprops);
-		arprops->regiontype= RGN_TYPE_TOOL_PROPS;
-		arprops->alignment= RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV;
+		arprops->regiontype = RGN_TYPE_TOOL_PROPS;
+		arprops->alignment = RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV;
 	}
 
 	return artool;
@@ -163,10 +164,10 @@ static int tools_poll(bContext *C)
 
 static int tools_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	ScrArea *sa= CTX_wm_area(C);
-	ARegion *ar= clip_has_tools_region(sa);
+	ScrArea *sa = CTX_wm_area(C);
+	ARegion *ar = clip_has_tools_region(sa);
 
-	if(ar)
+	if (ar)
 		ED_region_toggle_hidden(C, ar);
 
 	return OPERATOR_FINISHED;
@@ -175,13 +176,13 @@ static int tools_exec(bContext *C, wmOperator *UNUSED(op))
 void CLIP_OT_tools(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Tools";
-	ot->description= "Toggle clip tools panel";
-	ot->idname= "CLIP_OT_tools";
+	ot->name = "Tools";
+	ot->description = "Toggle clip tools panel";
+	ot->idname = "CLIP_OT_tools";
 
 	/* api callbacks */
-	ot->exec= tools_exec;
-	ot->poll= tools_poll;
+	ot->exec = tools_exec;
+	ot->poll = tools_poll;
 }
 
 /************************** redo panel ******************************/
@@ -193,16 +194,18 @@ static void clip_panel_operator_redo_buts(const bContext *C, Panel *pa, wmOperat
 
 static void clip_panel_operator_redo_header(const bContext *C, Panel *pa)
 {
-	wmOperator *op= WM_operator_last_redo(C);
+	wmOperator *op = WM_operator_last_redo(C);
 
-	if(op) BLI_strncpy(pa->drawname, op->type->name, sizeof(pa->drawname));
-	else BLI_strncpy(pa->drawname, "Operator", sizeof(pa->drawname));
+	if (op)
+		BLI_strncpy(pa->drawname, op->type->name, sizeof(pa->drawname));
+	else
+		BLI_strncpy(pa->drawname, "Operator", sizeof(pa->drawname));
 }
 
 static void clip_panel_operator_redo_operator(const bContext *C, Panel *pa, wmOperator *op)
 {
-	if(op->type->flag & OPTYPE_MACRO) {
-		for(op= op->macro.first; op; op= op->next) {
+	if (op->type->flag & OPTYPE_MACRO) {
+		for (op = op->macro.first; op; op = op->next) {
 			uiItemL(pa->layout, op->type->name, ICON_NONE);
 			clip_panel_operator_redo_operator(C, pa, op);
 		}
@@ -215,15 +218,16 @@ static void clip_panel_operator_redo_operator(const bContext *C, Panel *pa, wmOp
 /* TODO de-duplicate redo panel functions - campbell */
 static void clip_panel_operator_redo(const bContext *C, Panel *pa)
 {
-	wmOperator *op= WM_operator_last_redo(C);
+	wmOperator *op = WM_operator_last_redo(C);
 	uiBlock *block;
 
-	if(op==NULL)
+	if (op == NULL)
 		return;
-	if(WM_operator_poll((bContext*)C, op->type) == 0)
+
+	if (WM_operator_poll((bContext*)C, op->type) == 0)
 		return;
 
-	block= uiLayoutGetBlock(pa->layout);
+	block = uiLayoutGetBlock(pa->layout);
 
 	if (!WM_operator_check_ui_enabled(C, op->type->name))
 		uiLayoutSetEnabled(pa->layout, 0);
@@ -238,10 +242,10 @@ void ED_clip_tool_props_register(ARegionType *art)
 {
 	PanelType *pt;
 
-	pt= MEM_callocN(sizeof(PanelType), "spacetype clip panel last operator");
+	pt = MEM_callocN(sizeof(PanelType), "spacetype clip panel last operator");
 	strcpy(pt->idname, "CLIP_PT_last_operator");
 	strcpy(pt->label, "Operator");
-	pt->draw_header= clip_panel_operator_redo_header;
-	pt->draw= clip_panel_operator_redo;
+	pt->draw_header = clip_panel_operator_redo_header;
+	pt->draw = clip_panel_operator_redo;
 	BLI_addtail(&art->paneltypes, pt);
 }
diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c
index 46442d3..443a1d0 100644
--- a/source/blender/editors/space_clip/clip_utils.c
+++ b/source/blender/editors/space_clip/clip_utils.c
@@ -62,51 +62,51 @@ void clip_graph_tracking_values_iterate_track(SpaceClip *sc, MovieTrackingTrack
 			void (*segment_start) (void *userdata, MovieTrackingTrack *track, int coord),
 			void (*segment_end) (void *userdata))
 {
-	MovieClip *clip= ED_space_clip(sc);
+	MovieClip *clip = ED_space_clip(sc);
 	int width, height, coord;
 
 	BKE_movieclip_get_size(clip, &sc->user, &width, &height);
 
-	for(coord= 0; coord<2; coord++) {
-		int i, open= 0, prevfra= 0;
-		float prevval= 0.0f;
+	for (coord = 0; coord < 2; coord++) {
+		int i, open = FALSE, prevfra = 0;
+		float prevval = 0.0f;
 
-		for(i= 0; i<track->markersnr; i++) {
-			MovieTrackingMarker *marker= &track->markers[i];
+		for (i = 0; i < track->markersnr; i++) {
+			MovieTrackingMarker *marker = &track->markers[i];
 			float val;
 
-			if(marker->flag&MARKER_DISABLED) {
-				if(open) {
-					if(segment_end)
+			if (marker->flag & MARKER_DISABLED) {
+				if (open) {
+					if (segment_end)
 						segment_end(userdata);
 
-					open= 0;
+					open = FALSE;
 				}
 
 				continue;
 			}
 
-			if(!open) {
-				if(segment_start)
+			if (!open) {
+				if (segment_start)
 					segment_start(userdata, track, coord);
 
-				open= 1;
-				prevval= marker->pos[coord];
+				open = TRUE;
+				prevval = marker->pos[coord];
 			}
 
 			/* value is a pixels per frame speed */
-			val= (marker->pos[coord] - prevval) * ((coord==0) ? (width) : (height));
-			val/= marker->framenr-prevfra;
+			val = (marker->pos[coord] - prevval) * ((coord == 0) ? (width) : (height));
+			val /= marker->framenr - prevfra;
 
-			if(func)
+			if (func)
 				func(userdata, track, marker, coord, val);
 
-			prevval= marker->pos[coord];
-			prevfra= marker->framenr;
+			prevval = marker->pos[coord];
+			prevfra = marker->framenr;
 		}
 
-		if(open) {
-			if(segment_end)
+		if (open) {
+			if (segment_end)
 				segment_end(userdata);
 		}
 	}
@@ -117,89 +117,89 @@ void clip_graph_tracking_values_iterate(SpaceClip *sc, void *userdata,
 			void (*segment_start) (void *userdata, MovieTrackingTrack *track, int coord),
 			void (*segment_end) (void *userdata))
 {
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
-	ListBase *tracksbase= BKE_tracking_get_tracks(tracking);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
 	MovieTrackingTrack *track;
 
-	track= tracksbase->first;
-	while(track) {
-		if(TRACK_VIEW_SELECTED(sc, track)) {
+	track = tracksbase->first;
+	while (track) {
+		if (TRACK_VIEW_SELECTED(sc, track)) {
 			clip_graph_tracking_values_iterate_track(sc, track, userdata, func, segment_start, segment_end);
 		}
 
-		track= track->next;
+		track = track->next;
 	}
 }
 
 void clip_graph_tracking_iterate(SpaceClip *sc, void *userdata,
 			void (*func) (void *userdata, MovieTrackingMarker *marker))
 {
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
-	ListBase *tracksbase= BKE_tracking_get_tracks(tracking);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
 	MovieTrackingTrack *track;
 
-	track= tracksbase->first;
-	while(track) {
-		if(TRACK_VIEW_SELECTED(sc, track)) {
+	track = tracksbase->first;
+	while (track) {
+		if (TRACK_VIEW_SELECTED(sc, track)) {
 			int i;
 
-			for(i= 0; i<track->markersnr; i++) {
-				MovieTrackingMarker *marker= &track->markers[i];
+			for (i = 0; i < track->markersnr; i++) {
+				MovieTrackingMarker *marker = &track->markers[i];
 
-				if(marker->flag&MARKER_DISABLED)
+				if (marker->flag & MARKER_DISABLED)
 					continue;
 
-				if(func)
+				if (func)
 					func(userdata, marker);
 			}
 		}
 
-		track= track->next;
+		track = track->next;
 	}
 }
 
 void clip_delete_track(bContext *C, MovieClip *clip, ListBase *tracksbase, MovieTrackingTrack *track)
 {
-	MovieTracking *tracking= &clip->tracking;
-	MovieTrackingStabilization *stab= &tracking->stabilization;
-	MovieTrackingTrack *act_track= BKE_tracking_active_track(tracking);
+	MovieTracking *tracking = &clip->tracking;
+	MovieTrackingStabilization *stab = &tracking->stabilization;
+	MovieTrackingTrack *act_track = BKE_tracking_active_track(tracking);
 
-	int has_bundle= 0, update_stab= 0;
+	int has_bundle = FALSE, update_stab = FALSE;
 
-	if(track==act_track)
-		tracking->act_track= NULL;
+	if (track==act_track)
+		tracking->act_track = NULL;
 
-	if(track==stab->rot_track) {
-		stab->rot_track= NULL;
+	if (track == stab->rot_track) {
+		stab->rot_track = NULL;
 
-		update_stab= 1;
+		update_stab = TRUE;
 	}
 
 	/* handle reconstruction display in 3d viewport */
-	if(track->flag&TRACK_HAS_BUNDLE)
-		has_bundle= 1;
+	if (track->flag & TRACK_HAS_BUNDLE)
+		has_bundle = TRUE;
 
 	BKE_tracking_free_track(track);
 	BLI_freelinkN(tracksbase, track);
 
 	WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip);
 
-	if(update_stab) {
-		tracking->stabilization.ok= 0;
+	if (update_stab) {
+		tracking->stabilization.ok = FALSE;
 
 		DAG_id_tag_update(&clip->id, 0);
 		WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, clip);
 	}
 
-	if(has_bundle)
+	if (has_bundle)
 		WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 }
 
 void clip_delete_marker(bContext *C, MovieClip *clip, ListBase *tracksbase, MovieTrackingTrack *track, MovieTrackingMarker *marker)
 {
-	if(track->markersnr==1) {
+	if (track->markersnr == 1) {
 		clip_delete_track(C, clip, tracksbase, track);
 	}
 	else {
@@ -217,6 +217,6 @@ void clip_view_center_to_point(SpaceClip *sc, float x, float y)
 	ED_space_clip_size(sc, &width, &height);
 	ED_space_clip_aspect(sc, &aspx, &aspy);
 
-	sc->xof= (x-0.5f)*width*aspx;
-	sc->yof= (y-0.5f)*height*aspy;
+	sc->xof = (x - 0.5f) * width * aspx;
+	sc->yof = (y - 0.5f) * height * aspy;
 }
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index 97da05e..228c716 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -71,47 +71,47 @@
 
 static void init_preview_region(const bContext *C, ARegion *ar)
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 
-	ar->regiontype= RGN_TYPE_PREVIEW;
-	ar->alignment= RGN_ALIGN_TOP;
-	ar->flag|= RGN_FLAG_HIDDEN;
+	ar->regiontype = RGN_TYPE_PREVIEW;
+	ar->alignment = RGN_ALIGN_TOP;
+	ar->flag |= RGN_FLAG_HIDDEN;
 
-	ar->v2d.tot.xmin= 0.0f;
-	ar->v2d.tot.ymin= -10.0f;
-	ar->v2d.tot.xmax= (float)scene->r.efra;
-	ar->v2d.tot.ymax= 10.0f;
+	ar->v2d.tot.xmin = 0.0f;
+	ar->v2d.tot.ymin = -10.0f;
+	ar->v2d.tot.xmax = (float)scene->r.efra;
+	ar->v2d.tot.ymax = 10.0f;
 
-	ar->v2d.cur= ar->v2d.tot;
+	ar->v2d.cur = ar->v2d.tot;
 
-	ar->v2d.min[0]= FLT_MIN;
-	ar->v2d.min[1]= FLT_MIN;
+	ar->v2d.min[0] = FLT_MIN;
+	ar->v2d.min[1] = FLT_MIN;
 
-	ar->v2d.max[0]= MAXFRAMEF;
-	ar->v2d.max[1]= FLT_MAX;
+	ar->v2d.max[0] = MAXFRAMEF;
+	ar->v2d.max[1] = FLT_MAX;
 
-	ar->v2d.scroll= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
+	ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
 	ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL);
 
-	ar->v2d.keeptot= 0;
+	ar->v2d.keeptot = 0;
 }
 
 static ARegion *clip_has_preview_region(const bContext *C, ScrArea *sa)
 {
 	ARegion *ar, *arnew;
 
-	ar= BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW);
-	if(ar)
+	ar = BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW);
+	if (ar)
 		return ar;
 
 	/* add subdiv level; after header */
-	ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+	ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
 
 	/* is error! */
-	if(ar==NULL)
+	if (ar == NULL)
 		return NULL;
 
-	arnew= MEM_callocN(sizeof(ARegion), "clip preview region");
+	arnew = MEM_callocN(sizeof(ARegion), "clip preview region");
 
 	BLI_insertlinkbefore(&sa->regionbase, ar, arnew);
 	init_preview_region(C, arnew);
@@ -121,30 +121,30 @@ static ARegion *clip_has_preview_region(const bContext *C, ScrArea *sa)
 
 static void clip_scopes_tag_refresh(ScrArea *sa)
 {
-	SpaceClip *sc= (SpaceClip *)sa->spacedata.first;
+	SpaceClip *sc = (SpaceClip *)sa->spacedata.first;
 	ARegion *ar;
 
-	if(sc->mode!=SC_MODE_TRACKING)
+	if (sc->mode != SC_MODE_TRACKING)
 		return;
 
 	/* only while proeprties are visible */
-	for (ar=sa->regionbase.first; ar; ar=ar->next) {
+	for (ar = sa->regionbase.first; ar; ar = ar->next) {
 		if (ar->regiontype == RGN_TYPE_UI && ar->flag & RGN_FLAG_HIDDEN)
 			return;
 	}
 
-	sc->scopes.ok= 0;
+	sc->scopes.ok = FALSE;
 }
 
 static void clip_stabilization_tag_refresh(ScrArea *sa)
 {
-	SpaceClip *sc= (SpaceClip *)sa->spacedata.first;
-	MovieClip *clip= ED_space_clip(sc);
+	SpaceClip *sc = (SpaceClip *) sa->spacedata.first;
+	MovieClip *clip = ED_space_clip(sc);
 
-	if(clip) {
-		MovieTrackingStabilization *stab= &clip->tracking.stabilization;
+	if (clip) {
+		MovieTrackingStabilization *stab = &clip->tracking.stabilization;
 
-		stab->ok= 0;
+		stab->ok = FALSE;
 	}
 }
 
@@ -155,64 +155,64 @@ static SpaceLink *clip_new(const bContext *C)
 	ARegion *ar;
 	SpaceClip *sc;
 
-	sc= MEM_callocN(sizeof(SpaceClip), "initclip");
-	sc->spacetype= SPACE_CLIP;
-	sc->flag= SC_SHOW_MARKER_PATTERN|SC_SHOW_TRACK_PATH|SC_MANUAL_CALIBRATION|SC_SHOW_GRAPH_TRACKS|SC_SHOW_GRAPH_FRAMES;
-	sc->zoom= 1.0f;
-	sc->path_length= 20;
-	sc->scopes.track_preview_height= 120;
+	sc = MEM_callocN(sizeof(SpaceClip), "initclip");
+	sc->spacetype = SPACE_CLIP;
+	sc->flag = SC_SHOW_MARKER_PATTERN|SC_SHOW_TRACK_PATH|SC_MANUAL_CALIBRATION|SC_SHOW_GRAPH_TRACKS|SC_SHOW_GRAPH_FRAMES;
+	sc->zoom = 1.0f;
+	sc->path_length = 20;
+	sc->scopes.track_preview_height = 120;
 
 	/* header */
-	ar= MEM_callocN(sizeof(ARegion), "header for clip");
+	ar = MEM_callocN(sizeof(ARegion), "header for clip");
 
 	BLI_addtail(&sc->regionbase, ar);
-	ar->regiontype= RGN_TYPE_HEADER;
-	ar->alignment= RGN_ALIGN_BOTTOM;
+	ar->regiontype = RGN_TYPE_HEADER;
+	ar->alignment = RGN_ALIGN_BOTTOM;
 
 	/* tools view */
-	ar= MEM_callocN(sizeof(ARegion), "tools for clip");
+	ar = MEM_callocN(sizeof(ARegion), "tools for clip");
 
 	BLI_addtail(&sc->regionbase, ar);
-	ar->regiontype= RGN_TYPE_TOOLS;
-	ar->alignment= RGN_ALIGN_LEFT;
+	ar->regiontype = RGN_TYPE_TOOLS;
+	ar->alignment = RGN_ALIGN_LEFT;
 
 	/* tool properties */
-	ar= MEM_callocN(sizeof(ARegion), "tool properties for clip");
+	ar = MEM_callocN(sizeof(ARegion), "tool properties for clip");
 
 	BLI_addtail(&sc->regionbase, ar);
-	ar->regiontype= RGN_TYPE_TOOL_PROPS;
-	ar->alignment= RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV;
+	ar->regiontype = RGN_TYPE_TOOL_PROPS;
+	ar->alignment = RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV;
 
 	/* properties view */
-	ar= MEM_callocN(sizeof(ARegion), "properties for clip");
+	ar = MEM_callocN(sizeof(ARegion), "properties for clip");
 
 	BLI_addtail(&sc->regionbase, ar);
-	ar->regiontype= RGN_TYPE_UI;
-	ar->alignment= RGN_ALIGN_RIGHT;
+	ar->regiontype = RGN_TYPE_UI;
+	ar->alignment = RGN_ALIGN_RIGHT;
 
 	/* preview view */
-	ar= MEM_callocN(sizeof(ARegion), "preview for clip");
+	ar = MEM_callocN(sizeof(ARegion), "preview for clip");
 
 	BLI_addtail(&sc->regionbase, ar);
 	init_preview_region(C, ar);
 
 	/* main area */
-	ar= MEM_callocN(sizeof(ARegion), "main area for clip");
+	ar = MEM_callocN(sizeof(ARegion), "main area for clip");
 
 	BLI_addtail(&sc->regionbase, ar);
-	ar->regiontype= RGN_TYPE_WINDOW;
+	ar->regiontype = RGN_TYPE_WINDOW;
 
-	return (SpaceLink *)sc;
+	return (SpaceLink *) sc;
 }
 
 /* not spacelink itself */
 static void clip_free(SpaceLink *sl)
 {
-	SpaceClip *sc= (SpaceClip*) sl;
+	SpaceClip *sc = (SpaceClip*) sl;
 
-	sc->clip= NULL;
+	sc->clip = NULL;
 
-	if(sc->scopes.track_preview)
+	if (sc->scopes.track_preview)
 		IMB_freeImBuf(sc->scopes.track_preview);
 }
 
@@ -224,11 +224,11 @@ static void clip_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
 
 static SpaceLink *clip_duplicate(SpaceLink *sl)
 {
-	SpaceClip *scn= MEM_dupallocN(sl);
+	SpaceClip *scn = MEM_dupallocN(sl);
 
 	/* clear or remove stuff from old */
-	scn->scopes.track_preview= NULL;
-	scn->scopes.ok= 0;
+	scn->scopes.track_preview = NULL;
+	scn->scopes.ok = FALSE;
 
 	return (SpaceLink *)scn;
 }
@@ -244,7 +244,6 @@ static void clip_listener(ScrArea *sa, wmNotifier *wmn)
 					/* no break! */
 
 				case ND_FRAME_RANGE:
-					ED_area_tag_refresh(sa);
 					ED_area_tag_redraw(sa);
 					break;
 			}
@@ -279,12 +278,12 @@ static void clip_listener(ScrArea *sa, wmNotifier *wmn)
 			}
 			break;
 		 case NC_SCREEN:
-			if(wmn->data==ND_ANIMPLAY) {
+			if (wmn->data ==ND_ANIMPLAY) {
 				ED_area_tag_redraw(sa);
 			}
 			break;
 		case NC_SPACE:
-			if(wmn->data==ND_SPACE_CLIP) {
+			if (wmn->data ==ND_SPACE_CLIP) {
 				clip_scopes_tag_refresh(sa);
 				clip_stabilization_tag_refresh(sa);
 				ED_area_tag_redraw(sa);
@@ -348,7 +347,7 @@ static void clip_operatortypes(void)
 
 	/* orientation */
 	WM_operatortype_append(CLIP_OT_set_origin);
-	WM_operatortype_append(CLIP_OT_set_floor);
+	WM_operatortype_append(CLIP_OT_set_plane);
 	WM_operatortype_append(CLIP_OT_set_axis);
 	WM_operatortype_append(CLIP_OT_set_scale);
 	WM_operatortype_append(CLIP_OT_set_solution_scale);
@@ -369,13 +368,6 @@ static void clip_operatortypes(void)
 
 	WM_operatortype_append(CLIP_OT_clean_tracks);
 
-	/* graph editing */
-	WM_operatortype_append(CLIP_OT_graph_select);
-	WM_operatortype_append(CLIP_OT_graph_delete_curve);
-	WM_operatortype_append(CLIP_OT_graph_delete_knot);
-	WM_operatortype_append(CLIP_OT_graph_view_all);
-	WM_operatortype_append(CLIP_OT_graph_center_current_frame);
-
 	/* object tracking */
 	WM_operatortype_append(CLIP_OT_tracking_object_new);
 	WM_operatortype_append(CLIP_OT_tracking_object_remove);
@@ -383,6 +375,22 @@ static void clip_operatortypes(void)
 	/* clipboard */
 	WM_operatortype_append(CLIP_OT_copy_tracks);
 	WM_operatortype_append(CLIP_OT_paste_tracks);
+
+	/* ** clip_graph_ops.c  ** */
+
+	/* graph editing */
+
+	/* selection */
+	WM_operatortype_append(CLIP_OT_graph_select);
+	WM_operatortype_append(CLIP_OT_graph_select_border);
+	WM_operatortype_append(CLIP_OT_graph_select_all_markers);
+
+	WM_operatortype_append(CLIP_OT_graph_delete_curve);
+	WM_operatortype_append(CLIP_OT_graph_delete_knot);
+	WM_operatortype_append(CLIP_OT_graph_view_all);
+	WM_operatortype_append(CLIP_OT_graph_center_current_frame);
+
+	WM_operatortype_append(CLIP_OT_graph_disable_markers);
 }
 
 static void clip_keymap(struct wmKeyConfig *keyconf)
@@ -392,7 +400,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
 
 	/* ******** Global hotkeys avalaible for all regions ******** */
 
-	keymap= WM_keymap_find(keyconf, "Clip", SPACE_CLIP, 0);
+	keymap = WM_keymap_find(keyconf, "Clip", SPACE_CLIP, 0);
 
 	WM_keymap_add_item(keymap, "CLIP_OT_open", OKEY, KM_PRESS, KM_ALT, 0);
 
@@ -400,23 +408,25 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
 	WM_keymap_add_item(keymap, "CLIP_OT_properties", NKEY, KM_PRESS, 0, 0);
 
 	/* 2d tracking */
-	kmi= WM_keymap_add_item(keymap, "CLIP_OT_track_markers", LEFTARROWKEY, KM_PRESS, KM_ALT, 0);
+	kmi = WM_keymap_add_item(keymap, "CLIP_OT_track_markers", LEFTARROWKEY, KM_PRESS, KM_ALT, 0);
 	RNA_boolean_set(kmi->ptr, "backwards", TRUE);
 	RNA_boolean_set(kmi->ptr, "sequence", FALSE);
-	WM_keymap_add_item(keymap, "CLIP_OT_track_markers", RIGHTARROWKEY, KM_PRESS, KM_ALT, 0);
-	kmi= WM_keymap_add_item(keymap, "CLIP_OT_track_markers", TKEY, KM_PRESS, KM_CTRL, 0);
+	kmi = WM_keymap_add_item(keymap, "CLIP_OT_track_markers", RIGHTARROWKEY, KM_PRESS, KM_ALT, 0);
+	RNA_boolean_set(kmi->ptr, "backwards", FALSE);
+	RNA_boolean_set(kmi->ptr, "sequence", FALSE);
+	kmi = WM_keymap_add_item(keymap, "CLIP_OT_track_markers", TKEY, KM_PRESS, KM_CTRL, 0);
 	RNA_boolean_set(kmi->ptr, "backwards", FALSE);
 	RNA_boolean_set(kmi->ptr, "sequence", TRUE);
-	kmi= WM_keymap_add_item(keymap, "CLIP_OT_track_markers", TKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+	kmi = WM_keymap_add_item(keymap, "CLIP_OT_track_markers", TKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
 	RNA_boolean_set(kmi->ptr, "backwards", TRUE);
 	RNA_boolean_set(kmi->ptr, "sequence", TRUE);
 
 	/* mode */
-	kmi= WM_keymap_add_item(keymap, "CLIP_OT_mode_set", TABKEY, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "CLIP_OT_mode_set", TABKEY, KM_PRESS, 0, 0);
 	RNA_enum_set(kmi->ptr, "mode", SC_MODE_RECONSTRUCTION);
 	RNA_boolean_set(kmi->ptr, "toggle", TRUE);
 
-	kmi= WM_keymap_add_item(keymap, "CLIP_OT_mode_set", TABKEY, KM_PRESS, KM_CTRL, 0);
+	kmi = WM_keymap_add_item(keymap, "CLIP_OT_mode_set", TABKEY, KM_PRESS, KM_CTRL, 0);
 	RNA_enum_set(kmi->ptr, "mode", SC_MODE_DISTORTION);
 	RNA_boolean_set(kmi->ptr, "toggle", TRUE);
 
@@ -429,7 +439,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
 
 	/* ******** Hotkeys avalaible for main region only ******** */
 
-	keymap= WM_keymap_find(keyconf, "Clip Editor", SPACE_CLIP, 0);
+	keymap = WM_keymap_find(keyconf, "Clip Editor", SPACE_CLIP, 0);
 
 	/* ** View/navigation ** */
 
@@ -453,19 +463,23 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
 	RNA_float_set(WM_keymap_add_item(keymap, "CLIP_OT_view_zoom_ratio", PAD8, KM_PRESS, 0, 0)->ptr, "ratio", 0.125f);
 
 	WM_keymap_add_item(keymap, "CLIP_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
+
+	kmi = WM_keymap_add_item(keymap, "CLIP_OT_view_all", FKEY, KM_PRESS, 0, 0);
+	RNA_boolean_set(kmi->ptr, "fit_view", TRUE);
+
 	WM_keymap_add_item(keymap, "CLIP_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
 
 	/* jump to special frame */
-	kmi= WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
 	RNA_enum_set(kmi->ptr, "position", 0);
 
-	kmi= WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
 	RNA_enum_set(kmi->ptr, "position", 1);
 
-	kmi= WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", LEFTARROWKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
 	RNA_enum_set(kmi->ptr, "position", 2);
 
-	kmi= WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "CLIP_OT_frame_jump", RIGHTARROWKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
 	RNA_enum_set(kmi->ptr, "position", 3);
 
 	/* "timeline" */
@@ -492,58 +506,62 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
 
 	WM_keymap_add_item(keymap, "CLIP_OT_slide_marker", LEFTMOUSE, KM_PRESS, 0, 0);
 
-	kmi= WM_keymap_add_item(keymap, "CLIP_OT_disable_markers", DKEY, KM_PRESS, KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "CLIP_OT_disable_markers", DKEY, KM_PRESS, KM_SHIFT, 0);
 	RNA_enum_set(kmi->ptr, "action", 2);	/* toggle */
 
 	/* tracks */
 	WM_keymap_add_item(keymap, "CLIP_OT_delete_track", DELKEY, KM_PRESS, 0, 0);
 	WM_keymap_add_item(keymap, "CLIP_OT_delete_track", XKEY, KM_PRESS, 0, 0);
 
-	kmi= WM_keymap_add_item(keymap, "CLIP_OT_lock_tracks", LKEY, KM_PRESS, KM_CTRL, 0);
+	kmi = WM_keymap_add_item(keymap, "CLIP_OT_lock_tracks", LKEY, KM_PRESS, KM_CTRL, 0);
 	RNA_enum_set(kmi->ptr, "action", 0);	/* lock */
 
-	kmi= WM_keymap_add_item(keymap, "CLIP_OT_lock_tracks", LKEY, KM_PRESS, KM_ALT, 0);
+	kmi = WM_keymap_add_item(keymap, "CLIP_OT_lock_tracks", LKEY, KM_PRESS, KM_ALT, 0);
 	RNA_enum_set(kmi->ptr, "action", 1);	/* unlock */
 
-	kmi= WM_keymap_add_item(keymap, "CLIP_OT_hide_tracks", HKEY, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "CLIP_OT_hide_tracks", HKEY, KM_PRESS, 0, 0);
 	RNA_boolean_set(kmi->ptr, "unselected", FALSE);
 
-	kmi= WM_keymap_add_item(keymap, "CLIP_OT_hide_tracks", HKEY, KM_PRESS, KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "CLIP_OT_hide_tracks", HKEY, KM_PRESS, KM_SHIFT, 0);
 	RNA_boolean_set(kmi->ptr, "unselected", TRUE);
 
 	WM_keymap_add_item(keymap, "CLIP_OT_hide_tracks_clear", HKEY, KM_PRESS, KM_ALT, 0);
 
 	/* clean-up */
-	kmi= WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_ALT, 0);
-	RNA_enum_set(kmi->ptr, "action", TRACK_CLEAR_REMAINED);
-	kmi= WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_SHIFT, 0);
-	RNA_enum_set(kmi->ptr, "action", TRACK_CLEAR_UPTO);
-	kmi= WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
-	RNA_enum_set(kmi->ptr, "action", TRACK_CLEAR_ALL);
-
 	WM_keymap_add_item(keymap, "CLIP_OT_join_tracks", JKEY, KM_PRESS, KM_CTRL, 0);
 
 	/* menus */
 	WM_keymap_add_menu(keymap, "CLIP_MT_tracking_specials", WKEY, KM_PRESS, 0, 0);
 
 	/* display */
-	kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", LKEY, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", LKEY, KM_PRESS, 0, 0);
 	RNA_string_set(kmi->ptr, "data_path", "space_data.lock_selection");
 
-	kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", DKEY, KM_PRESS, KM_ALT, 0);
+	kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", DKEY, KM_PRESS, KM_ALT, 0);
 	RNA_string_set(kmi->ptr, "data_path", "space_data.show_disabled");
 
-	kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", SKEY, KM_PRESS, KM_ALT, 0);
+	kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", SKEY, KM_PRESS, KM_ALT, 0);
 	RNA_string_set(kmi->ptr, "data_path", "space_data.show_marker_search");
 
-	kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", MKEY, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", MKEY, KM_PRESS, 0, 0);
 	RNA_string_set(kmi->ptr, "data_path", "space_data.use_mute_footage");
 
 	transform_keymap_for_space(keyconf, keymap, SPACE_CLIP);
 
+	/* clean-up */
+	kmi = WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_ALT, 0);
+	RNA_enum_set(kmi->ptr, "action", TRACK_CLEAR_REMAINED);
+	RNA_boolean_set(kmi->ptr, "clear_active", FALSE);
+	kmi = WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_SHIFT, 0);
+	RNA_enum_set(kmi->ptr, "action", TRACK_CLEAR_UPTO);
+	RNA_boolean_set(kmi->ptr, "clear_active", FALSE);
+	kmi = WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
+	RNA_enum_set(kmi->ptr, "action", TRACK_CLEAR_ALL);
+	RNA_boolean_set(kmi->ptr, "clear_active", FALSE);
+
 	/* ******** Hotkeys avalaible for preview region only ******** */
 
-	keymap= WM_keymap_find(keyconf, "Clip Graph Editor", SPACE_CLIP, 0);
+	keymap = WM_keymap_find(keyconf, "Clip Graph Editor", SPACE_CLIP, 0);
 
 	/* "timeline" */
 	WM_keymap_add_item(keymap, "CLIP_OT_change_frame", ACTIONMOUSE, KM_PRESS, 0, 0);
@@ -554,6 +572,13 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
 	kmi = WM_keymap_add_item(keymap, "CLIP_OT_graph_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
 	RNA_boolean_set(kmi->ptr, "extend", TRUE);
 
+	kmi = WM_keymap_add_item(keymap, "CLIP_OT_graph_select_all_markers", AKEY, KM_PRESS, 0, 0);
+	RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
+	kmi = WM_keymap_add_item(keymap, "CLIP_OT_graph_select_all_markers", IKEY, KM_PRESS, KM_CTRL, 0);
+	RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+
+	WM_keymap_add_item(keymap, "CLIP_OT_graph_select_border", BKEY, KM_PRESS, 0, 0);
+
 	/* delete */
 	WM_keymap_add_item(keymap, "CLIP_OT_graph_delete_curve", DELKEY, KM_PRESS, 0, 0);
 	WM_keymap_add_item(keymap, "CLIP_OT_graph_delete_curve", XKEY, KM_PRESS, 0, 0);
@@ -565,9 +590,24 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
 	WM_keymap_add_item(keymap, "CLIP_OT_graph_view_all", HOMEKEY, KM_PRESS, 0, 0);
 	WM_keymap_add_item(keymap, "CLIP_OT_graph_center_current_frame", PADPERIOD, KM_PRESS, 0, 0);
 
-	kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", LKEY, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", LKEY, KM_PRESS, 0, 0);
 	RNA_string_set(kmi->ptr, "data_path", "space_data.lock_time_cursor");
 
+	/* clean-up */
+	kmi = WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_ALT, 0);
+	RNA_enum_set(kmi->ptr, "action", TRACK_CLEAR_REMAINED);
+	RNA_boolean_set(kmi->ptr, "clear_active", TRUE);
+	kmi = WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_SHIFT, 0);
+	RNA_enum_set(kmi->ptr, "action", TRACK_CLEAR_UPTO);
+	RNA_boolean_set(kmi->ptr, "clear_active", TRUE);
+	kmi = WM_keymap_add_item(keymap, "CLIP_OT_clear_track_path", TKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
+	RNA_enum_set(kmi->ptr, "action", TRACK_CLEAR_ALL);
+	RNA_boolean_set(kmi->ptr, "clear_active", TRUE);
+
+	/* tracks */
+	kmi = WM_keymap_add_item(keymap, "CLIP_OT_graph_disable_markers", DKEY, KM_PRESS, KM_SHIFT, 0);
+	RNA_enum_set(kmi->ptr, "action", 2);	/* toggle */
+
 	transform_keymap_for_space(keyconf, keymap, SPACE_CLIP);
 }
 
@@ -575,29 +615,29 @@ const char *clip_context_dir[]= {"edit_movieclip", NULL};
 
 static int clip_context(const bContext *C, const char *member, bContextDataResult *result)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
+	SpaceClip *sc = CTX_wm_space_clip(C);
 
-	if(CTX_data_dir(member)) {
+	if (CTX_data_dir(member)) {
 		CTX_data_dir_set(result, clip_context_dir);
-		return 1;
+		return TRUE;
 	}
-	else if(CTX_data_equals(member, "edit_movieclip")) {
+	else if (CTX_data_equals(member, "edit_movieclip")) {
 		CTX_data_id_pointer_set(result, &sc->clip->id);
-		return 1;
+		return TRUE;
 	}
 
-	return 0;
+	return FALSE;
 }
 
 static void clip_refresh(const bContext *C, ScrArea *sa)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
-	wmWindow *window= CTX_wm_window(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
+	wmWindow *window = CTX_wm_window(C);
 	Scene *scene = CTX_data_scene(C);
-	SpaceClip *sc= (SpaceClip *)sa->spacedata.first;
-	ARegion *ar_main= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
-	ARegion *ar_preview= clip_has_preview_region(C, sa);
-	int view_changed= 0;
+	SpaceClip *sc = (SpaceClip *)sa->spacedata.first;
+	ARegion *ar_main = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+	ARegion *ar_preview = clip_has_preview_region(C, sa);
+	int view_changed = FALSE;
 
 	switch (sc->view) {
 		case SC_VIEW_CLIP:
@@ -605,11 +645,21 @@ static void clip_refresh(const bContext *C, ScrArea *sa)
 				ar_preview->flag |= RGN_FLAG_HIDDEN;
 				ar_preview->v2d.flag &= ~V2D_IS_INITIALISED;
 				WM_event_remove_handlers((bContext*)C, &ar_preview->handlers);
-				view_changed= 1;
+				view_changed = TRUE;
 			}
 			if (ar_main && ar_main->alignment != RGN_ALIGN_NONE) {
-				ar_main->alignment= RGN_ALIGN_NONE;
-				view_changed= 1;
+				ar_main->alignment = RGN_ALIGN_NONE;
+				view_changed = TRUE;
+			}
+			if (ar_preview && ar_preview->alignment != RGN_ALIGN_NONE) {
+				/* store graph region align */
+				if (ar_preview->alignment == RGN_ALIGN_TOP)
+					sc->runtime_flag &= ~SC_GRAPH_BOTTOM;
+				else
+					sc->runtime_flag |= SC_GRAPH_BOTTOM;
+
+				ar_preview->alignment = RGN_ALIGN_NONE;
+				view_changed = TRUE;
 			}
 			break;
 		case SC_VIEW_GRAPH:
@@ -617,20 +667,24 @@ static void clip_refresh(const bContext *C, ScrArea *sa)
 				ar_preview->flag &= ~RGN_FLAG_HIDDEN;
 				ar_preview->v2d.flag &= ~V2D_IS_INITIALISED;
 				ar_preview->v2d.cur = ar_preview->v2d.tot;
-				view_changed= 1;
+				view_changed = TRUE;
 			}
 			if (ar_main && ar_main->alignment != RGN_ALIGN_NONE) {
-				ar_main->alignment= RGN_ALIGN_NONE;
-				view_changed= 1;
+				ar_main->alignment = RGN_ALIGN_NONE;
+				view_changed = TRUE;
 			}
 			if (ar_preview && !ELEM(ar_preview->alignment, RGN_ALIGN_TOP,  RGN_ALIGN_BOTTOM)) {
-				ar_preview->alignment= RGN_ALIGN_TOP;
-				view_changed= 1;
+				if (sc->runtime_flag & SC_GRAPH_BOTTOM)
+					ar_preview->alignment = RGN_ALIGN_BOTTOM;
+				else
+					ar_preview->alignment = RGN_ALIGN_TOP;
+
+				view_changed = TRUE;
 			}
 			break;
 	}
 
-	if(view_changed) {
+	if (view_changed) {
 		ED_area_initialize(wm, window, sa);
 		ED_area_tag_redraw(sa);
 	}
@@ -643,44 +697,44 @@ static void clip_refresh(const bContext *C, ScrArea *sa)
 /* sets up the fields of the View2D from zoom and offset */
 static void movieclip_main_area_set_view2d(SpaceClip *sc, ARegion *ar)
 {
-	MovieClip *clip= ED_space_clip(sc);
+	MovieClip *clip = ED_space_clip(sc);
 	float x1, y1, w, h;
 	int width, height, winx, winy;
 
 	ED_space_clip_size(sc, &width, &height);
 
-	w= width;
-	h= height;
+	w = width;
+	h = height;
 
-	if(clip)
-		h*= clip->aspy/clip->aspx/clip->tracking.camera.pixel_aspect;
+	if (clip)
+		h *= clip->aspy / clip->aspx / clip->tracking.camera.pixel_aspect;
 
-	winx= ar->winrct.xmax - ar->winrct.xmin + 1;
-	winy= ar->winrct.ymax - ar->winrct.ymin + 1;
+	winx = ar->winrct.xmax - ar->winrct.xmin + 1;
+	winy = ar->winrct.ymax - ar->winrct.ymin + 1;
 
-	ar->v2d.tot.xmin= 0;
-	ar->v2d.tot.ymin= 0;
-	ar->v2d.tot.xmax= w;
-	ar->v2d.tot.ymax= h;
+	ar->v2d.tot.xmin = 0;
+	ar->v2d.tot.ymin = 0;
+	ar->v2d.tot.xmax = w;
+	ar->v2d.tot.ymax = h;
 
-	ar->v2d.mask.xmin= ar->v2d.mask.ymin= 0;
-	ar->v2d.mask.xmax= winx;
-	ar->v2d.mask.ymax= winy;
+	ar->v2d.mask.xmin = ar->v2d.mask.ymin = 0;
+	ar->v2d.mask.xmax = winx;
+	ar->v2d.mask.ymax = winy;
 
 	/* which part of the image space do we see? */
-	x1= ar->winrct.xmin+(winx-sc->zoom*w)/2.0f;
-	y1= ar->winrct.ymin+(winy-sc->zoom*h)/2.0f;
+	x1= ar->winrct.xmin + (winx-sc->zoom * w) / 2.0f;
+	y1= ar->winrct.ymin + (winy-sc->zoom * h) / 2.0f;
 
-	x1-= sc->zoom*sc->xof;
-	y1-= sc->zoom*sc->yof;
+	x1-= sc->zoom * sc->xof;
+	y1-= sc->zoom * sc->yof;
 
 	/* relative display right */
-	ar->v2d.cur.xmin= ((ar->winrct.xmin - (float)x1)/sc->zoom);
-	ar->v2d.cur.xmax= ar->v2d.cur.xmin + ((float)winx/sc->zoom);
+	ar->v2d.cur.xmin = (ar->winrct.xmin - (float)x1) / sc->zoom;
+	ar->v2d.cur.xmax = ar->v2d.cur.xmin + ((float)winx / sc->zoom);
 
 	/* relative display left */
-	ar->v2d.cur.ymin= ((ar->winrct.ymin-(float)y1)/sc->zoom);
-	ar->v2d.cur.ymax= ar->v2d.cur.ymin + ((float)winy/sc->zoom);
+	ar->v2d.cur.ymin = (ar->winrct.ymin - (float)y1) / sc->zoom;
+	ar->v2d.cur.ymax = ar->v2d.cur.ymin + ((float)winy / sc->zoom);
 
 	/* normalize 0.0..1.0 */
 	ar->v2d.cur.xmin /= w;
@@ -697,38 +751,38 @@ static void clip_main_area_init(wmWindowManager *wm, ARegion *ar)
 	UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
 
 	/* own keymap */
-	keymap= WM_keymap_find(wm->defaultconf, "Clip", SPACE_CLIP, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Clip", SPACE_CLIP, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 
-	keymap= WM_keymap_find(wm->defaultconf, "Clip Editor", SPACE_CLIP, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Clip Editor", SPACE_CLIP, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
 static void clip_main_area_draw(const bContext *C, ARegion *ar)
 {
 	/* draw entirely, view changes should be handled here */
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	Scene *scene= CTX_data_scene(C);
-	MovieClip *clip= ED_space_clip(sc);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	Scene *scene = CTX_data_scene(C);
+	MovieClip *clip = ED_space_clip(sc);
 
-	/* if trcking is in progress, we should sunchronize framenr from clipuser
-	   so latest tracked frame would be shown */
-	if(clip && clip->tracking_context)
+	/* if tracking is in progress, we should synchronize framenr from clipuser
+	 * so latest tracked frame would be shown */
+	if (clip && clip->tracking_context)
 		BKE_tracking_sync_user(&sc->user, clip->tracking_context);
 
-	if(sc->flag&SC_LOCK_SELECTION) {
-		ImBuf *tmpibuf= NULL;
+	if (sc->flag & SC_LOCK_SELECTION) {
+		ImBuf *tmpibuf = NULL;
 
-		if(clip && clip->tracking.stabilization.flag&TRACKING_2D_STABILIZATION) {
-			tmpibuf= ED_space_clip_get_stable_buffer(sc, NULL, NULL, NULL);
+		if (clip && clip->tracking.stabilization.flag & TRACKING_2D_STABILIZATION) {
+			tmpibuf = ED_space_clip_get_stable_buffer(sc, NULL, NULL, NULL);
 		}
 
-		if(ED_clip_view_selection(sc, ar, 0)) {
-			sc->xof+= sc->xlockof;
-			sc->yof+= sc->ylockof;
+		if (ED_clip_view_selection(sc, ar, 0)) {
+			sc->xof += sc->xlockof;
+			sc->yof += sc->ylockof;
 		}
 
-		if(tmpibuf)
+		if (tmpibuf)
 			IMB_freeImBuf(tmpibuf);
 	}
 
@@ -756,7 +810,7 @@ static void clip_main_area_listener(ARegion *ar, wmNotifier *wmn)
 	/* context changes */
 	switch(wmn->category) {
 		case NC_SCREEN:
-			if (wmn->data==ND_GPENCIL)
+			if (wmn->data == ND_GPENCIL)
 				ED_region_tag_redraw(ar);
 		break;
 	}
@@ -771,22 +825,22 @@ static void clip_preview_area_init(wmWindowManager *wm, ARegion *ar)
 	UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
 
 	/* own keymap */
-	keymap= WM_keymap_find(wm->defaultconf, "Clip", SPACE_CLIP, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Clip", SPACE_CLIP, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 
-	keymap= WM_keymap_find(wm->defaultconf, "Clip Graph Editor", SPACE_CLIP, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Clip Graph Editor", SPACE_CLIP, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
 static void clip_preview_area_draw(const bContext *C, ARegion *ar)
 {
-	View2D *v2d= &ar->v2d;
+	View2D *v2d = &ar->v2d;
 	View2DScrollers *scrollers;
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	Scene *scene= CTX_data_scene(C);
-	short unitx= V2D_UNIT_FRAMESCALE, unity= V2D_UNIT_VALUES;
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	Scene *scene = CTX_data_scene(C);
+	short unitx = V2D_UNIT_FRAMESCALE, unity = V2D_UNIT_VALUES;
 
-	if(sc->flag & SC_LOCK_TIMECURSOR)
+	if (sc->flag & SC_LOCK_TIMECURSOR)
 		ED_clip_graph_center_current_frame(scene, ar);
 
 	/* clear and setup matrix */
@@ -802,7 +856,7 @@ static void clip_preview_area_draw(const bContext *C, ARegion *ar)
 	UI_view2d_view_restore(C);
 
 	/* scrollers */
-	scrollers= UI_view2d_scrollers_calc(C, v2d, unitx, V2D_GRID_NOCLAMP, unity, V2D_GRID_NOCLAMP);
+	scrollers = UI_view2d_scrollers_calc(C, v2d, unitx, V2D_GRID_NOCLAMP, unity, V2D_GRID_NOCLAMP);
 	UI_view2d_scrollers_draw(C, v2d, scrollers);
 	UI_view2d_scrollers_free(scrollers);
 }
@@ -844,19 +898,19 @@ static void clip_props_area_listener(ARegion *ar, wmNotifier *wmn)
 	/* context changes */
 	switch(wmn->category) {
 		case NC_WM:
-			if(wmn->data == ND_HISTORY)
+			if (wmn->data == ND_HISTORY)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_SCENE:
-			if(wmn->data == ND_MODE)
+			if (wmn->data == ND_MODE)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_SPACE:
-			if(wmn->data == ND_SPACE_CLIP)
+			if (wmn->data == ND_SPACE_CLIP)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_SCREEN:
-			if(wmn->data == ND_GPENCIL)
+			if (wmn->data == ND_GPENCIL)
 				ED_region_tag_redraw(ar);
 			break;
 	}
@@ -871,13 +925,13 @@ static void clip_properties_area_init(wmWindowManager *wm, ARegion *ar)
 
 	ED_region_panels_init(wm, ar);
 
-	keymap= WM_keymap_find(wm->defaultconf, "Clip", SPACE_CLIP, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Clip", SPACE_CLIP, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
 static void clip_properties_area_draw(const bContext *C, ARegion *ar)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
+	SpaceClip *sc = CTX_wm_space_clip(C);
 
 	BKE_movieclip_update_scopes(sc->clip, &sc->user, &sc->scopes);
 
@@ -889,11 +943,11 @@ static void clip_properties_area_listener(ARegion *ar, wmNotifier *wmn)
 	/* context changes */
 	switch(wmn->category) {
 		case NC_SCREEN:
-			if (wmn->data==ND_GPENCIL)
+			if (wmn->data ==ND_GPENCIL)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_BRUSH:
-			if(wmn->action==NA_EDITED)
+			if (wmn->action ==NA_EDITED)
 				ED_region_tag_redraw(ar);
 			break;
 	}
@@ -904,86 +958,86 @@ static void clip_properties_area_listener(ARegion *ar, wmNotifier *wmn)
 /* only called once, from space/spacetypes.c */
 void ED_spacetype_clip(void)
 {
-	SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype clip");
+	SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype clip");
 	ARegionType *art;
 
-	st->spaceid= SPACE_CLIP;
+	st->spaceid = SPACE_CLIP;
 	strncpy(st->name, "Clip", BKE_ST_MAXNAME);
 
-	st->new= clip_new;
-	st->free= clip_free;
-	st->init= clip_init;
-	st->duplicate= clip_duplicate;
-	st->operatortypes= clip_operatortypes;
-	st->keymap= clip_keymap;
-	st->listener= clip_listener;
-	st->context= clip_context;
-	st->refresh= clip_refresh;
+	st->new = clip_new;
+	st->free = clip_free;
+	st->init = clip_init;
+	st->duplicate = clip_duplicate;
+	st->operatortypes = clip_operatortypes;
+	st->keymap = clip_keymap;
+	st->listener = clip_listener;
+	st->context = clip_context;
+	st->refresh = clip_refresh;
 
 	/* regions: main window */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype clip region");
-	art->regionid= RGN_TYPE_WINDOW;
-	art->init= clip_main_area_init;
-	art->draw= clip_main_area_draw;
-	art->listener= clip_main_area_listener;
-	art->keymapflag= ED_KEYMAP_FRAMES|ED_KEYMAP_UI|ED_KEYMAP_GPENCIL;
+	art = MEM_callocN(sizeof(ARegionType), "spacetype clip region");
+	art->regionid = RGN_TYPE_WINDOW;
+	art->init = clip_main_area_init;
+	art->draw = clip_main_area_draw;
+	art->listener = clip_main_area_listener;
+	art->keymapflag = ED_KEYMAP_FRAMES|ED_KEYMAP_UI|ED_KEYMAP_GPENCIL;
 
 	BLI_addhead(&st->regiontypes, art);
 
 	/* preview */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype clip region preview");
+	art = MEM_callocN(sizeof(ARegionType), "spacetype clip region preview");
 	art->regionid = RGN_TYPE_PREVIEW;
 	art->prefsizey = 240;
-	art->init= clip_preview_area_init;
-	art->draw= clip_preview_area_draw;
-	art->listener= clip_preview_area_listener;
-	art->keymapflag= ED_KEYMAP_FRAMES|ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
+	art->init = clip_preview_area_init;
+	art->draw = clip_preview_area_draw;
+	art->listener = clip_preview_area_listener;
+	art->keymapflag = ED_KEYMAP_FRAMES|ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
 
 	BLI_addhead(&st->regiontypes, art);
 
 	/* regions: properties */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype clip region properties");
-	art->regionid= RGN_TYPE_UI;
-	art->prefsizex= UI_COMPACT_PANEL_WIDTH;
-	art->keymapflag= ED_KEYMAP_FRAMES|ED_KEYMAP_UI;
-	art->init= clip_properties_area_init;
-	art->draw= clip_properties_area_draw;
-	art->listener= clip_properties_area_listener;
+	art = MEM_callocN(sizeof(ARegionType), "spacetype clip region properties");
+	art->regionid = RGN_TYPE_UI;
+	art->prefsizex = UI_COMPACT_PANEL_WIDTH;
+	art->keymapflag = ED_KEYMAP_FRAMES|ED_KEYMAP_UI;
+	art->init = clip_properties_area_init;
+	art->draw = clip_properties_area_draw;
+	art->listener = clip_properties_area_listener;
 	BLI_addhead(&st->regiontypes, art);
 	ED_clip_buttons_register(art);
 
 	/* regions: tools */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype clip region tools");
-	art->regionid= RGN_TYPE_TOOLS;
-	art->prefsizex= UI_COMPACT_PANEL_WIDTH;
-	art->keymapflag= ED_KEYMAP_FRAMES|ED_KEYMAP_UI;
-	art->listener= clip_props_area_listener;
-	art->init= clip_tools_area_init;
-	art->draw= clip_tools_area_draw;
+	art = MEM_callocN(sizeof(ARegionType), "spacetype clip region tools");
+	art->regionid = RGN_TYPE_TOOLS;
+	art->prefsizex = UI_COMPACT_PANEL_WIDTH;
+	art->keymapflag = ED_KEYMAP_FRAMES|ED_KEYMAP_UI;
+	art->listener = clip_props_area_listener;
+	art->init = clip_tools_area_init;
+	art->draw = clip_tools_area_draw;
 
 	BLI_addhead(&st->regiontypes, art);
 
 	/* tool properties */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype clip tool properties region");
+	art = MEM_callocN(sizeof(ARegionType), "spacetype clip tool properties region");
 	art->regionid = RGN_TYPE_TOOL_PROPS;
-	art->prefsizex= 0;
-	art->prefsizey= 120;
-	art->keymapflag= ED_KEYMAP_FRAMES|ED_KEYMAP_UI;
-	art->listener= clip_props_area_listener;
-	art->init= clip_tools_area_init;
-	art->draw= clip_tools_area_draw;
+	art->prefsizex = 0;
+	art->prefsizey = 120;
+	art->keymapflag = ED_KEYMAP_FRAMES|ED_KEYMAP_UI;
+	art->listener = clip_props_area_listener;
+	art->init = clip_tools_area_init;
+	art->draw = clip_tools_area_draw;
 	ED_clip_tool_props_register(art);
 
 	BLI_addhead(&st->regiontypes, art);
 
 	/* regions: header */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype clip region");
-	art->regionid= RGN_TYPE_HEADER;
-	art->prefsizey= HEADERY;
-	art->keymapflag= ED_KEYMAP_FRAMES|ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_HEADER;
+	art = MEM_callocN(sizeof(ARegionType), "spacetype clip region");
+	art->regionid = RGN_TYPE_HEADER;
+	art->prefsizey = HEADERY;
+	art->keymapflag = ED_KEYMAP_FRAMES|ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_HEADER;
 
-	art->init= clip_header_area_init;
-	art->draw= clip_header_area_draw;
+	art->init = clip_header_area_init;
+	art->draw = clip_header_area_draw;
 
 	BLI_addhead(&st->regiontypes, art);
 
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index 6a9c275..35986fa 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -80,46 +80,46 @@
 
 static int space_clip_frame_poll(bContext *C)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
+	SpaceClip *sc = CTX_wm_space_clip(C);
 
-	if(sc) {
-		MovieClip *clip= ED_space_clip(sc);
+	if (sc) {
+		MovieClip *clip = ED_space_clip(sc);
 
-		if(clip)
+		if (clip)
 			return BKE_movieclip_has_frame(clip, &sc->user);
 	}
 
-	return 0;
+	return FALSE;
 }
 
 /********************** add marker operator *********************/
 
 static void add_marker(SpaceClip *sc, float x, float y)
 {
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
-	ListBase *tracksbase= BKE_tracking_get_tracks(tracking);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
 	MovieTrackingTrack *track;
 	int width, height;
-	
+
 	ED_space_clip_size(sc, &width, &height);
 
-	track= BKE_tracking_add_track(tracking, tracksbase, x, y, sc->user.framenr, width, height);
+	track = BKE_tracking_add_track(tracking, tracksbase, x, y, sc->user.framenr, width, height);
 
 	BKE_tracking_select_track(tracksbase, track, TRACK_AREA_ALL, 0);
 
-	clip->tracking.act_track= track;
+	clip->tracking.act_track = track;
 }
 
 static int add_marker_exec(bContext *C, wmOperator *op)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
 	float pos[2];
 	int width, height;
 
 	ED_space_clip_size(sc, &width, &height);
-	if(!width || !height)
+	if (!width || !height)
 		return OPERATOR_CANCELLED;
 
 	RNA_float_get_array(op->ptr, "location", pos);
@@ -127,8 +127,8 @@ static int add_marker_exec(bContext *C, wmOperator *op)
 	add_marker(sc, pos[0], pos[1]);
 
 	/* reset offset from locked position, so frame jumping wouldn't be so confusing */
-	sc->xlockof= 0;
-	sc->ylockof= 0;
+	sc->xlockof = 0;
+	sc->ylockof = 0;
 
 	WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip);
 
@@ -149,17 +149,17 @@ static int add_marker_invoke(bContext *C, wmOperator *op, wmEvent *event)
 void CLIP_OT_add_marker(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Marker";
-	ot->idname= "CLIP_OT_add_marker";
-	ot->description= "Place new marker at specified location";
+	ot->name = "Add Marker";
+	ot->idname = "CLIP_OT_add_marker";
+	ot->description = "Place new marker at specified location";
 
 	/* api callbacks */
-	ot->invoke= add_marker_invoke;
-	ot->exec= add_marker_exec;
-	ot->poll= space_clip_frame_poll;
+	ot->invoke = add_marker_invoke;
+	ot->exec = add_marker_exec;
+	ot->poll = space_clip_frame_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MIN, FLT_MAX,
@@ -170,23 +170,23 @@ void CLIP_OT_add_marker(wmOperatorType *ot)
 
 static int delete_track_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
-	ListBase *tracksbase= BKE_tracking_get_tracks(tracking);
-	MovieTrackingTrack *track= tracksbase->first, *next;
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
+	MovieTrackingTrack *track = tracksbase->first, *next;
 
-	while(track) {
-		next= track->next;
+	while (track) {
+		next = track->next;
 
-		if(TRACK_VIEW_SELECTED(sc, track))
+		if (TRACK_VIEW_SELECTED(sc, track))
 			clip_delete_track(C, clip, tracksbase, track);
 
-		track= next;
+		track = next;
 	}
 
 	/* nothing selected now, unlock view so it can be scrolled nice again */
-	sc->flag&= ~SC_LOCK_SELECTION;
+	sc->flag &= ~SC_LOCK_SELECTION;
 
 	return OPERATOR_FINISHED;
 }
@@ -194,49 +194,49 @@ static int delete_track_exec(bContext *C, wmOperator *UNUSED(op))
 void CLIP_OT_delete_track(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete Track";
-	ot->idname= "CLIP_OT_delete_track";
-	ot->description= "Delete selected tracks";
+	ot->name = "Delete Track";
+	ot->idname = "CLIP_OT_delete_track";
+	ot->description = "Delete selected tracks";
 
 	/* api callbacks */
-	ot->invoke= WM_operator_confirm;
-	ot->exec= delete_track_exec;
-	ot->poll= ED_space_clip_poll;
+	ot->invoke = WM_operator_confirm;
+	ot->exec = delete_track_exec;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************** delete marker operator *********************/
 
 static int delete_marker_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	ListBase *tracksbase= BKE_tracking_get_tracks(&clip->tracking);
-	MovieTrackingTrack *track= tracksbase->first, *next;
-	int framenr= sc->user.framenr;
-	int has_selection= 0;
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
+	MovieTrackingTrack *track = tracksbase->first, *next;
+	int framenr = sc->user.framenr;
+	int has_selection = 0;
 
-	while(track) {
-		next= track->next;
+	while (track) {
+		next = track->next;
 
-		if(TRACK_VIEW_SELECTED(sc, track)) {
-			MovieTrackingMarker *marker= BKE_tracking_exact_marker(track, framenr);
+		if (TRACK_VIEW_SELECTED(sc, track)) {
+			MovieTrackingMarker *marker = BKE_tracking_exact_marker(track, framenr);
 
-			if(marker) {
-				has_selection|= track->markersnr>1;
+			if (marker) {
+				has_selection |= track->markersnr>1;
 
 				clip_delete_marker(C, clip, tracksbase, track, marker);
 			}
 		}
 
-		track= next;
+		track = next;
 	}
 
-	if(!has_selection) {
+	if (!has_selection) {
 		/* nothing selected now, unlock view so it can be scrolled nice again */
-		sc->flag&= ~SC_LOCK_SELECTION;
+		sc->flag &= ~SC_LOCK_SELECTION;
 	}
 
 	return OPERATOR_FINISHED;
@@ -245,17 +245,17 @@ static int delete_marker_exec(bContext *C, wmOperator *UNUSED(op))
 void CLIP_OT_delete_marker(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete Marker";
-	ot->idname= "CLIP_OT_delete_marker";
-	ot->description= "Delete marker for current frame from selected tracks";
+	ot->name = "Delete Marker";
+	ot->idname = "CLIP_OT_delete_marker";
+	ot->description = "Delete marker for current frame from selected tracks";
 
 	/* api callbacks */
-	ot->invoke= WM_operator_confirm;
-	ot->exec= delete_marker_exec;
-	ot->poll= ED_space_clip_poll;
+	ot->invoke = WM_operator_confirm;
+	ot->exec = delete_marker_exec;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************** slide marker operator *********************/
@@ -281,95 +281,100 @@ typedef struct {
 static SlideMarkerData *create_slide_marker_data(SpaceClip *sc, MovieTrackingTrack *track,
 			MovieTrackingMarker *marker, wmEvent *event, int area, int action, int width, int height)
 {
-	SlideMarkerData *data= MEM_callocN(sizeof(SlideMarkerData), "slide marker data");
+	SlideMarkerData *data = MEM_callocN(sizeof(SlideMarkerData), "slide marker data");
 
-	marker= BKE_tracking_ensure_marker(track, sc->user.framenr);
+	marker = BKE_tracking_ensure_marker(track, sc->user.framenr);
 
-	data->area= area;
-	data->action= action;
-	data->track= track;
-	data->marker= marker;
+	data->area = area;
+	data->action = action;
+	data->track = track;
+	data->marker = marker;
 
-	if(area==TRACK_AREA_POINT) {
-		data->pos= marker->pos;
-		data->offset= track->offset;
+	if (area == TRACK_AREA_POINT) {
+		data->pos = marker->pos;
+		data->offset = track->offset;
 		copy_v2_v2(data->spos, marker->pos);
 		copy_v2_v2(data->soff, track->offset);
-	} else if(area==TRACK_AREA_PAT) {
-		if(action==SLIDE_ACTION_SIZE) {
-			data->min= track->pat_min;
-			data->max= track->pat_max;
-		} else {
+	}
+	else if (area == TRACK_AREA_PAT) {
+		if (action == SLIDE_ACTION_SIZE) {
+			data->min = track->pat_min;
+			data->max = track->pat_max;
+		}
+		else {
 			int a;
 
-			data->pos= marker->pos;
-			data->offset= track->offset;
+			data->pos = marker->pos;
+			data->offset = track->offset;
 
 			copy_v2_v2(data->soff, track->offset);
 
-			data->smarkers= MEM_callocN(sizeof(*data->smarkers)*track->markersnr, "slide marekrs");
-			for(a= 0; a<track->markersnr; a++)
+			data->smarkers = MEM_callocN(sizeof(*data->smarkers)*track->markersnr, "slide marekrs");
+			for (a = 0; a < track->markersnr; a++)
 				copy_v2_v2(data->smarkers[a], track->markers[a].pos);
 		}
-	} else if(area==TRACK_AREA_SEARCH) {
-		data->min= track->search_min;
-		data->max= track->search_max;
+	}
+	else if (area == TRACK_AREA_SEARCH) {
+		data->min = track->search_min;
+		data->max = track->search_max;
 	}
 
-	if(area==TRACK_AREA_SEARCH || (area==TRACK_AREA_PAT && action!=SLIDE_ACTION_OFFSET)) {
+	if (area == TRACK_AREA_SEARCH || (area == TRACK_AREA_PAT && action != SLIDE_ACTION_OFFSET)) {
 		copy_v2_v2(data->smin, data->min);
 		copy_v2_v2(data->smax, data->max);
 	}
 
-	data->mval[0]= event->mval[0];
-	data->mval[1]= event->mval[1];
+	data->mval[0] = event->mval[0];
+	data->mval[1] = event->mval[1];
 
-	data->width= width;
-	data->height= height;
+	data->width = width;
+	data->height = height;
 
-	if(action==SLIDE_ACTION_SIZE)
-		data->lock= 1;
+	if (action == SLIDE_ACTION_SIZE)
+		data->lock = 1;
 
 	return data;
 }
 
 /* corner = 0: right-bottom corner,
-   corner = 1: left-top corner */
+ * corner = 1: left-top corner */
 static int mouse_on_corner(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker,
-			int area, float co[2], int corner, int width, int height)
+                           int area, float co[2], int corner, int width, int height)
 {
-	int inside= 0;
-	float size= 12.0f;
+	int inside = 0;
+	float size = 12.0f;
 	float min[2], max[2];
 	float crn[2], dx, dy, tdx, tdy;
 
-	if(area==TRACK_AREA_SEARCH) {
+	if (area == TRACK_AREA_SEARCH) {
 		copy_v2_v2(min, track->search_min);
 		copy_v2_v2(max, track->search_max);
-	} else {
+	}
+	else {
 		copy_v2_v2(min, track->pat_min);
 		copy_v2_v2(max, track->pat_max);
 	}
 
-	dx= size/width/sc->zoom;
-	dy= size/height/sc->zoom;
+	dx = size / width / sc->zoom;
+	dy = size / height / sc->zoom;
 
-	tdx= 5.0f/width/sc->zoom;
-	tdy= 5.0f/height/sc->zoom;
+	tdx = 5.0f / width / sc->zoom;
+	tdy = 5.0f / height / sc->zoom;
 
-	dx= MIN2(dx, (max[0]-min[0])/6.0f) + tdx;
-	dy= MIN2(dy, (max[1]-min[1])/6.0f) + tdy;
+	dx = MIN2(dx, (max[0] - min[0]) / 6.0f) + tdx;
+	dy = MIN2(dy, (max[1] - min[1]) / 6.0f) + tdy;
 
-	if(corner==0) {
-		crn[0]= marker->pos[0]+max[0];
-		crn[1]= marker->pos[1]+min[1];
+	if (corner == 0) {
+		crn[0] = marker->pos[0] + max[0];
+		crn[1] = marker->pos[1] + min[1];
 
-		inside= co[0]>=crn[0]-dx && co[0]<=crn[0]+tdx && co[1]>=crn[1]-tdy && co[1]<=crn[1]+dy;
-	} else {
-		crn[0]= marker->pos[0]+min[0];
-		crn[1]= marker->pos[1]+max[1];
+		inside = co[0] >= crn[0] - dx && co[0] <= crn[0] + tdx && co[1] >= crn[1] - tdy && co[1] <= crn[1] + dy;
+	}
+	else {
+		crn[0] = marker->pos[0]+min[0];
+		crn[1] = marker->pos[1]+max[1];
 
-		inside= co[0]>=crn[0]-dx && co[0]<=crn[0]+dx && co[1]>=crn[1]-dy && co[1]<=crn[1]+dy;
+		inside = co[0] >= crn[0] - dx && co[0] <= crn[0] + dx && co[1] >= crn[1] - dy && co[1] <= crn[1] + dy;
 	}
 
 	return inside;
@@ -382,77 +387,77 @@ static int mouse_on_offset(SpaceClip *sc, MovieTrackingTrack *track, MovieTracki
 
 	add_v2_v2v2(pos, marker->pos, track->offset);
 
-	dx= 12.0f/width/sc->zoom;
-	dy= 12.0f/height/sc->zoom;
+	dx = 12.0f / width / sc->zoom;
+	dy = 12.0f / height /sc->zoom;
 
-	dx=MIN2(dx, (track->pat_max[0]-track->pat_min[0])/2.0f);
-	dy=MIN2(dy, (track->pat_max[1]-track->pat_min[1])/2.0f);
+	dx = MIN2(dx, (track->pat_max[0] - track->pat_min[0]) / 2.0f);
+	dy = MIN2(dy, (track->pat_max[1] - track->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;
+	return co[0] >= pos[0] - dx && co[0] <= pos[0] + dx && co[1] >= pos[1] - dy && co[1] <= pos[1] + dy;
 }
 
 static void hide_cursor(bContext *C)
 {
-	wmWindow *win= CTX_wm_window(C);
+	wmWindow *win = CTX_wm_window(C);
 
 	WM_cursor_set(win, CURSOR_NONE);
 }
 
 static void show_cursor(bContext *C)
 {
-	wmWindow *win= CTX_wm_window(C);
+	wmWindow *win = CTX_wm_window(C);
 
 	WM_cursor_set(win, CURSOR_STD);
 }
 
 static void *slide_marker_customdata(bContext *C, wmEvent *event)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
 	MovieTrackingTrack *track;
 	int width, height;
 	float co[2];
-	void *customdata= NULL;
-	ListBase *tracksbase= BKE_tracking_get_tracks(&clip->tracking);
+	void *customdata = NULL;
+	ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
 
 	ED_space_clip_size(sc, &width, &height);
 
-	if(width==0 || height==0)
+	if (width == 0 || height == 0)
 		return NULL;
 
 	ED_clip_mouse_pos(C, event, co);
 
-	track= tracksbase->first;
-	while(track) {
-		if(TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_LOCKED)==0) {
-			MovieTrackingMarker *marker= BKE_tracking_get_marker(track, sc->user.framenr);
-
-			if((marker->flag&MARKER_DISABLED)==0) {
-				if(!customdata)
-					if(mouse_on_offset(sc, track, marker, co, width, height))
-						customdata= create_slide_marker_data(sc, track, marker, event, TRACK_AREA_POINT, SLIDE_ACTION_POS, width, height);
-
-				if(sc->flag&SC_SHOW_MARKER_SEARCH) {
-					if(mouse_on_corner(sc, track, marker, TRACK_AREA_SEARCH, co, 1, width, height))
-						customdata= create_slide_marker_data(sc, track, marker, event, TRACK_AREA_SEARCH, SLIDE_ACTION_OFFSET, width, height);
-					else if(mouse_on_corner(sc, track, marker, TRACK_AREA_SEARCH, co, 0, width, height))
-						customdata= create_slide_marker_data(sc, track, marker, event, TRACK_AREA_SEARCH, SLIDE_ACTION_SIZE, width, height);
+	track = tracksbase->first;
+	while (track) {
+		if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED) == 0) {
+			MovieTrackingMarker *marker = BKE_tracking_get_marker(track, sc->user.framenr);
+
+			if ((marker->flag & MARKER_DISABLED) == 0) {
+				if (!customdata)
+					if (mouse_on_offset(sc, track, marker, co, width, height))
+						customdata = create_slide_marker_data(sc, track, marker, event, TRACK_AREA_POINT, SLIDE_ACTION_POS, width, height);
+
+				if (sc->flag & SC_SHOW_MARKER_SEARCH) {
+					if (mouse_on_corner(sc, track, marker, TRACK_AREA_SEARCH, co, 1, width, height))
+						customdata = create_slide_marker_data(sc, track, marker, event, TRACK_AREA_SEARCH, SLIDE_ACTION_OFFSET, width, height);
+					else if (mouse_on_corner(sc, track, marker, TRACK_AREA_SEARCH, co, 0, width, height))
+						customdata = create_slide_marker_data(sc, track, marker, event, TRACK_AREA_SEARCH, SLIDE_ACTION_SIZE, width, height);
 				}
 
-				if(!customdata && sc->flag&SC_SHOW_MARKER_PATTERN) {
-					if(mouse_on_corner(sc, track, marker, TRACK_AREA_PAT, co, 1,  width, height))
-						customdata= create_slide_marker_data(sc, track, marker, event, TRACK_AREA_PAT, SLIDE_ACTION_OFFSET, width, height);
+				if (!customdata && (sc->flag & SC_SHOW_MARKER_PATTERN)) {
+					if (mouse_on_corner(sc, track, marker, TRACK_AREA_PAT, co, 1,  width, height))
+						customdata = create_slide_marker_data(sc, track, marker, event, TRACK_AREA_PAT, SLIDE_ACTION_OFFSET, width, height);
 
-					if(!customdata && mouse_on_corner(sc, track, marker, TRACK_AREA_PAT, co, 0, width, height))
-						customdata= create_slide_marker_data(sc, track, marker, event, TRACK_AREA_PAT, SLIDE_ACTION_SIZE, width, height);
+					if (!customdata && mouse_on_corner(sc, track, marker, TRACK_AREA_PAT, co, 0, width, height))
+						customdata = create_slide_marker_data(sc, track, marker, event, TRACK_AREA_PAT, SLIDE_ACTION_SIZE, width, height);
 				}
 
-				if(customdata)
+				if (customdata)
 					break;
 			}
 		}
 
-		track= track->next;
+		track = track->next;
 	}
 
 	return customdata;
@@ -460,16 +465,16 @@ static void *slide_marker_customdata(bContext *C, wmEvent *event)
 
 static int slide_marker_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	SlideMarkerData *slidedata= slide_marker_customdata(C, event);
+	SlideMarkerData *slidedata = slide_marker_customdata(C, event);
 
-	if(slidedata) {
-		SpaceClip *sc= CTX_wm_space_clip(C);
-		MovieClip *clip= ED_space_clip(sc);
-		MovieTracking *tracking= &clip->tracking;
+	if (slidedata) {
+		SpaceClip *sc = CTX_wm_space_clip(C);
+		MovieClip *clip = ED_space_clip(sc);
+		MovieTracking *tracking = &clip->tracking;
 
-		tracking->act_track= slidedata->track;
+		tracking->act_track = slidedata->track;
 
-		op->customdata= slidedata;
+		op->customdata = slidedata;
 
 		hide_cursor(C);
 		WM_event_add_modal_handler(C, op);
@@ -485,19 +490,21 @@ static int slide_marker_invoke(bContext *C, wmOperator *op, wmEvent *event)
 static void cancel_mouse_slide(SlideMarkerData *data)
 {
 	/* cancel sliding */
-	if(data->area == TRACK_AREA_POINT) {
-		if(data->action==SLIDE_ACTION_OFFSET)
+	if (data->area == TRACK_AREA_POINT) {
+		if (data->action == SLIDE_ACTION_OFFSET)
 			copy_v2_v2(data->offset, data->soff);
 		else
 			copy_v2_v2(data->pos, data->spos);
-	} else {
-		if(data->action==SLIDE_ACTION_SIZE) {
+	}
+	else {
+		if (data->action == SLIDE_ACTION_SIZE) {
 			copy_v2_v2(data->min, data->smin);
 			copy_v2_v2(data->max, data->smax);
-		} else {
+		}
+		else {
 			int a;
 
-			for(a= 0; a<data->track->markersnr; a++)
+			for (a = 0; a<data->track->markersnr; a++)
 				copy_v2_v2(data->track->markers[a].pos, data->smarkers[a]);
 
 			copy_v2_v2(data->offset, data->soff);
@@ -507,14 +514,16 @@ static void cancel_mouse_slide(SlideMarkerData *data)
 
 static void free_slide_data(SlideMarkerData *data)
 {
-	if(data->smarkers) MEM_freeN(data->smarkers);
+	if (data->smarkers)
+		MEM_freeN(data->smarkers);
+
 	MEM_freeN(data);
 }
 
 static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	SlideMarkerData *data= (SlideMarkerData *)op->customdata;
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	SlideMarkerData *data = (SlideMarkerData *)op->customdata;
 	float dx, dy, mdelta[2];
 
 	switch(event->type) {
@@ -522,68 +531,76 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event)
 		case RIGHTCTRLKEY:
 		case LEFTSHIFTKEY:
 		case RIGHTSHIFTKEY:
-			if(data->action==SLIDE_ACTION_SIZE)
-				if(ELEM(event->type, LEFTCTRLKEY, RIGHTCTRLKEY))
-					data->lock= event->val==KM_RELEASE;
+			if (data->action == SLIDE_ACTION_SIZE)
+				if (ELEM(event->type, LEFTCTRLKEY, RIGHTCTRLKEY))
+					data->lock = event->val == KM_RELEASE;
 
-			if(ELEM(event->type, LEFTSHIFTKEY, RIGHTSHIFTKEY))
-				data->accurate= event->val==KM_PRESS;
+			if (ELEM(event->type, LEFTSHIFTKEY, RIGHTSHIFTKEY))
+				data->accurate = event->val == KM_PRESS;
 
 			/* no break! update area size */
 
 		case MOUSEMOVE:
-			mdelta[0]= event->mval[0]-data->mval[0];
-			mdelta[1]= event->mval[1]-data->mval[1];
+			mdelta[0] = event->mval[0]-data->mval[0];
+			mdelta[1] = event->mval[1]-data->mval[1];
 
-			dx= mdelta[0]/data->width/sc->zoom;
+			dx = mdelta[0] / data->width / sc->zoom;
 
-			if(data->lock) dy= -dx/data->height*data->width;
-			else dy= mdelta[1]/data->height/sc->zoom;
+			if (data->lock)
+				dy = -dx / data->height * data->width;
+			else
+				dy = mdelta[1] / data->height / sc->zoom;
 
-			if(data->accurate) {
-				dx/= 5;
-				dy/= 5;
+			if (data->accurate) {
+				dx /= 5;
+				dy /= 5;
 			}
 
-			if(data->area==TRACK_AREA_POINT) {
-				if(data->action==SLIDE_ACTION_OFFSET) {
-					data->offset[0]= data->soff[0]+dx;
-					data->offset[1]= data->soff[1]+dy;
-				} else {
-					data->pos[0]= data->spos[0]+dx;
-					data->pos[1]= data->spos[1]+dy;
+			if (data->area == TRACK_AREA_POINT) {
+				if (data->action == SLIDE_ACTION_OFFSET) {
+					data->offset[0] = data->soff[0] + dx;
+					data->offset[1] = data->soff[1] + dy;
+				}
+				else {
+					data->pos[0] = data->spos[0] + dx;
+					data->pos[1] = data->spos[1] + dy;
 
-					data->marker->flag&= ~MARKER_TRACKED;
+					data->marker->flag &= ~MARKER_TRACKED;
 				}
 
 				WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
 				DAG_id_tag_update(&sc->clip->id, 0);
-			} else {
-				if(data->action==SLIDE_ACTION_SIZE) {
-					data->min[0]= data->smin[0]-dx;
-					data->max[0]= data->smax[0]+dx;
+			}
+			else {
+				if (data->action == SLIDE_ACTION_SIZE) {
+					data->min[0] = data->smin[0] - dx;
+					data->max[0] = data->smax[0] + dx;
 
-					data->min[1]= data->smin[1]+dy;
-					data->max[1]= data->smax[1]-dy;
+					data->min[1] = data->smin[1] + dy;
+					data->max[1] = data->smax[1] - dy;
 
-					if(data->area==TRACK_AREA_SEARCH) BKE_tracking_clamp_track(data->track, CLAMP_SEARCH_DIM);
-					else BKE_tracking_clamp_track(data->track, CLAMP_PAT_DIM);
-				} else {
-					float d[2]={dx, dy};
+					if (data->area == TRACK_AREA_SEARCH)
+						BKE_tracking_clamp_track(data->track, CLAMP_SEARCH_DIM);
+					else
+						BKE_tracking_clamp_track(data->track, CLAMP_PAT_DIM);
+				}
+				else {
+					float d[2] = {dx, dy};
 
-					if(data->area==TRACK_AREA_SEARCH) {
+					if (data->area == TRACK_AREA_SEARCH) {
 						add_v2_v2v2(data->min, data->smin, d);
 						add_v2_v2v2(data->max, data->smax, d);
-					} else {
+					}
+					else {
 						int a;
 
-						for(a= 0; a<data->track->markersnr; a++)
+						for (a = 0; a<data->track->markersnr; a++)
 							add_v2_v2v2(data->track->markers[a].pos, data->smarkers[a], d);
 
 						sub_v2_v2v2(data->offset, data->soff, d);
 					}
 
-					if(data->area==TRACK_AREA_SEARCH)
+					if (data->area == TRACK_AREA_SEARCH)
 						BKE_tracking_clamp_track(data->track, CLAMP_SEARCH_POS);
 				}
 			}
@@ -593,7 +610,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event)
 			break;
 
 		case LEFTMOUSE:
-			if(event->val==KM_RELEASE) {
+			if (event->val == KM_RELEASE) {
 				free_slide_data(op->customdata);
 
 				show_cursor(C);
@@ -621,17 +638,17 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event)
 void CLIP_OT_slide_marker(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Slide Marker";
-	ot->description= "Slide marker areas";
-	ot->idname= "CLIP_OT_slide_marker";
+	ot->name = "Slide Marker";
+	ot->description = "Slide marker areas";
+	ot->idname = "CLIP_OT_slide_marker";
 
 	/* api callbacks */
-	ot->poll= space_clip_frame_poll;
-	ot->invoke= slide_marker_invoke;
-	ot->modal= slide_marker_modal;
+	ot->poll = space_clip_frame_poll;
+	ot->invoke = slide_marker_invoke;
+	ot->modal = slide_marker_modal;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_GRAB_POINTER|OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_GRAB_POINTER|OPTYPE_BLOCKING;
 
 	/* properties */
 	RNA_def_float_vector(ot->srna, "offset", 2, NULL, -FLT_MAX, FLT_MAX,
@@ -642,10 +659,14 @@ void CLIP_OT_slide_marker(wmOperatorType *ot)
 
 static int mouse_on_side(float co[2], float x1, float y1, float x2, float y2, float epsx, float epsy)
 {
-	if(x1>x2) SWAP(float, x1, x2);
-	if(y1>y2) SWAP(float, y1, y2);
+	if (x1 > x2)
+
+		SWAP(float, x1, x2);
 
-	return (co[0]>=x1-epsx && co[0]<=x2+epsx) && (co[1]>=y1-epsy && co[1]<=y2+epsy);
+	if (y1 > y2)
+		SWAP(float, y1, y2);
+
+	return (co[0] >= x1 - epsx && co[0] <= x2 + epsx) && (co[1] >= y1 - epsy && co[1] <= y2 + epsy);
 }
 
 static int mouse_on_rect(float co[2], float pos[2], float min[2], float max[2], float epsx, float epsy)
@@ -658,33 +679,34 @@ static int mouse_on_rect(float co[2], float pos[2], float min[2], float max[2],
 
 static int track_mouse_area(SpaceClip *sc, float co[2], MovieTrackingTrack *track)
 {
-	MovieTrackingMarker *marker= BKE_tracking_get_marker(track, sc->user.framenr);
+	MovieTrackingMarker *marker = BKE_tracking_get_marker(track, sc->user.framenr);
 	float epsx, epsy;
 	int width, height;
 
 	ED_space_clip_size(sc, &width, &height);
 
-	epsx= MIN4(track->pat_min[0]-track->search_min[0], track->search_max[0]-track->pat_max[0],
+	epsx = MIN4(track->pat_min[0]-track->search_min[0], track->search_max[0]-track->pat_max[0],
 	           fabsf(track->pat_min[0]), fabsf(track->pat_max[0])) / 2;
-	epsy= MIN4(track->pat_min[1]-track->search_min[1], track->search_max[1]-track->pat_max[1],
+	epsy = MIN4(track->pat_min[1]-track->search_min[1], track->search_max[1]-track->pat_max[1],
 	           fabsf(track->pat_min[1]), fabsf(track->pat_max[1])) / 2;
 
-	epsx= MAX2(epsx, 2.0f / width);
-	epsy= MAX2(epsy, 2.0f / height);
+	epsx = MAX2(epsx, 2.0f / width);
+	epsy = MAX2(epsy, 2.0f / height);
 
-	if(sc->flag&SC_SHOW_MARKER_SEARCH)
-		if(mouse_on_rect(co, marker->pos, track->search_min, track->search_max, epsx, epsy))
+	if (sc->flag & SC_SHOW_MARKER_SEARCH) {
+		if (mouse_on_rect(co, marker->pos, track->search_min, track->search_max, epsx, epsy))
 			return TRACK_AREA_SEARCH;
+	}
 
-	if((marker->flag&MARKER_DISABLED)==0) {
-		if(sc->flag&SC_SHOW_MARKER_PATTERN)
-			if(mouse_on_rect(co, marker->pos, track->pat_min, track->pat_max, epsx, epsy))
+	if ((marker->flag & MARKER_DISABLED)== 0) {
+		if (sc->flag & SC_SHOW_MARKER_PATTERN)
+			if (mouse_on_rect(co, marker->pos, track->pat_min, track->pat_max, epsx, epsy))
 				return TRACK_AREA_PAT;
 
-		epsx= 12.0f/width;
-		epsy= 12.0f/height;
+		epsx = 12.0f / width;
+		epsy = 12.0f / height;
 
-		if(fabsf(co[0]-marker->pos[0]-track->offset[0])< epsx && fabsf(co[1]-marker->pos[1]-track->offset[1])<=epsy)
+		if (fabsf(co[0]-marker->pos[0]-track->offset[0])< epsx && fabsf(co[1]-marker->pos[1]-track->offset[1])<=epsy)
 			return TRACK_AREA_POINT;
 	}
 
@@ -694,51 +716,51 @@ static int track_mouse_area(SpaceClip *sc, float co[2], MovieTrackingTrack *trac
 static float dist_to_rect(float co[2], float pos[2], float min[2], float max[2])
 {
 	float d1, d2, d3, d4;
-	float p[2]= {co[0]-pos[0], co[1]-pos[1]};
-	float v1[2]= {min[0], min[1]}, v2[2]= {max[0], min[1]},
-	      v3[2]= {max[0], max[1]}, v4[2]= {min[0], max[1]};
+	float p[2] = {co[0]-pos[0], co[1]-pos[1]};
+	float v1[2] = {min[0], min[1]}, v2[2] = {max[0], min[1]},
+	      v3[2] = {max[0], max[1]}, v4[2] = {min[0], max[1]};
 
-	d1= dist_to_line_segment_v2(p, v1, v2);
-	d2= dist_to_line_segment_v2(p, v2, v3);
-	d3= dist_to_line_segment_v2(p, v3, v4);
-	d4= dist_to_line_segment_v2(p, v4, v1);
+	d1 = dist_to_line_segment_v2(p, v1, v2);
+	d2 = dist_to_line_segment_v2(p, v2, v3);
+	d3 = dist_to_line_segment_v2(p, v3, v4);
+	d4 = dist_to_line_segment_v2(p, v4, v1);
 
 	return MIN4(d1, d2, d3, d4);
 }
 
 static MovieTrackingTrack *find_nearest_track(SpaceClip *sc, ListBase *tracksbase, float co[2])
 {
-	MovieTrackingTrack *track= NULL, *cur;
-	float mindist= 0.0f;
+	MovieTrackingTrack *track = NULL, *cur;
+	float mindist = 0.0f;
 
-	cur= tracksbase->first;
-	while(cur) {
-		MovieTrackingMarker *marker= BKE_tracking_get_marker(cur, sc->user.framenr);
+	cur = tracksbase->first;
+	while (cur) {
+		MovieTrackingMarker *marker = BKE_tracking_get_marker(cur, sc->user.framenr);
 
-		if(((cur->flag&TRACK_HIDDEN)==0) && MARKER_VISIBLE(sc, marker)) {
-			float dist, d1, d2=FLT_MAX, d3=FLT_MAX;
+		if (((cur->flag & TRACK_HIDDEN) == 0) && MARKER_VISIBLE(sc, marker)) {
+			float dist, d1, d2 = FLT_MAX, d3 = FLT_MAX;
 
 			d1= sqrtf((co[0]-marker->pos[0]-cur->offset[0])*(co[0]-marker->pos[0]-cur->offset[0])+
 					  (co[1]-marker->pos[1]-cur->offset[1])*(co[1]-marker->pos[1]-cur->offset[1])); /* distance to marker point */
 
 			/* distance to pattern boundbox */
-			if(sc->flag&SC_SHOW_MARKER_PATTERN)
+			if (sc->flag & SC_SHOW_MARKER_PATTERN)
 				d2= dist_to_rect(co, marker->pos, cur->pat_min, cur->pat_max);
 
 			/* distance to search boundbox */
-			if(sc->flag&SC_SHOW_MARKER_SEARCH && TRACK_VIEW_SELECTED(sc, cur))
+			if (sc->flag & SC_SHOW_MARKER_SEARCH && TRACK_VIEW_SELECTED(sc, cur))
 				d3= dist_to_rect(co, marker->pos, cur->search_min, cur->search_max);
 
 			/* choose minimal distance. useful for cases of overlapped markers. */
-			dist= MIN3(d1, d2, d3);
+			dist = MIN3(d1, d2, d3);
 
-			if(track==NULL || dist<mindist) {
-				track= cur;
-				mindist= dist;
+			if (track == NULL || dist<mindist) {
+				track = cur;
+				mindist = dist;
 			}
 		}
 
-		cur= cur->next;
+		cur = cur->next;
 	}
 
 	return track;
@@ -746,38 +768,39 @@ static MovieTrackingTrack *find_nearest_track(SpaceClip *sc, ListBase *tracksbas
 
 static int mouse_select(bContext *C, float co[2], int extend)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
-	ListBase *tracksbase= BKE_tracking_get_tracks(tracking);
-	MovieTrackingTrack *act_track= BKE_tracking_active_track(tracking);
-	MovieTrackingTrack *track= NULL;	/* selected marker */
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
+	MovieTrackingTrack *act_track = BKE_tracking_active_track(tracking);
+	MovieTrackingTrack *track = NULL;	/* selected marker */
 
-	track= find_nearest_track(sc, tracksbase, co);
+	track = find_nearest_track(sc, tracksbase, co);
 
-	if(track) {
-		int area= track_mouse_area(sc, co, track);
+	if (track) {
+		int area = track_mouse_area(sc, co, track);
 
-		if(!extend || !TRACK_VIEW_SELECTED(sc, track))
-			area= TRACK_AREA_ALL;
+		if (!extend || !TRACK_VIEW_SELECTED(sc, track))
+			area = TRACK_AREA_ALL;
 
-		if(extend && TRACK_AREA_SELECTED(track, area)) {
-			if(track==act_track)
+		if (extend && TRACK_AREA_SELECTED(track, area)) {
+			if (track == act_track)
 				BKE_tracking_deselect_track(track, area);
 			else
-				clip->tracking.act_track= track;
-		} else {
-			if(area==TRACK_AREA_POINT)
-				area= TRACK_AREA_ALL;
+				clip->tracking.act_track = track;
+		}
+		else {
+			if (area == TRACK_AREA_POINT)
+				area = TRACK_AREA_ALL;
 
 			BKE_tracking_select_track(tracksbase, track, area, extend);
-			clip->tracking.act_track= track;
+			clip->tracking.act_track = track;
 		}
 	}
 
-	if(!extend) {
-		sc->xlockof= 0.0f;
-		sc->ylockof= 0.0f;
+	if (!extend) {
+		sc->xlockof = 0.0f;
+		sc->ylockof = 0.0f;
 	}
 
 	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
@@ -791,7 +814,7 @@ static int select_exec(bContext *C, wmOperator *op)
 	int extend;
 
 	RNA_float_get_array(op->ptr, "location", co);
-	extend= RNA_boolean_get(op->ptr, "extend");
+	extend = RNA_boolean_get(op->ptr, "extend");
 
 	return mouse_select(C, co, extend);
 }
@@ -799,16 +822,16 @@ static int select_exec(bContext *C, wmOperator *op)
 static int select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 	float co[2];
-	int extend= RNA_boolean_get(op->ptr, "extend");
+	int extend = RNA_boolean_get(op->ptr, "extend");
 
-	if(!extend) {
-		SlideMarkerData *slidedata= slide_marker_customdata(C, event);
+	if (!extend) {
+		SlideMarkerData *slidedata = slide_marker_customdata(C, event);
 
-		if(slidedata) {
-			SpaceClip *sc= CTX_wm_space_clip(C);
-			MovieClip *clip= ED_space_clip(sc);
+		if (slidedata) {
+			SpaceClip *sc = CTX_wm_space_clip(C);
+			MovieClip *clip = ED_space_clip(sc);
 
-			clip->tracking.act_track= slidedata->track;
+			clip->tracking.act_track = slidedata->track;
 
 			WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
 
@@ -827,17 +850,17 @@ static int select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 void CLIP_OT_select(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select";
-	ot->description= "Select tracking markers";
-	ot->idname= "CLIP_OT_select";
+	ot->name = "Select";
+	ot->description = "Select tracking markers";
+	ot->idname = "CLIP_OT_select";
 
 	/* api callbacks */
-	ot->exec= select_exec;
-	ot->invoke= select_invoke;
-	ot->poll= ED_space_clip_poll;
+	ot->exec = select_exec;
+	ot->invoke = select_invoke;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_UNDO;
+	ot->flag = OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "extend", 0,
@@ -850,48 +873,48 @@ void CLIP_OT_select(wmOperatorType *ot)
 
 static int border_select_exec(bContext *C, wmOperator *op)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
 	MovieTrackingTrack *track;
-	ListBase *tracksbase= BKE_tracking_get_tracks(&clip->tracking);
+	ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
 	rcti rect;
 	rctf rectf;
-	int change= 0, mode, extend;
+	int change = FALSE, mode, extend;
 
 	/* get rectangle from operator */
-	rect.xmin= RNA_int_get(op->ptr, "xmin");
-	rect.ymin= RNA_int_get(op->ptr, "ymin");
-	rect.xmax= RNA_int_get(op->ptr, "xmax");
-	rect.ymax= RNA_int_get(op->ptr, "ymax");
+	rect.xmin = RNA_int_get(op->ptr, "xmin");
+	rect.ymin = RNA_int_get(op->ptr, "ymin");
+	rect.xmax = RNA_int_get(op->ptr, "xmax");
+	rect.ymax = RNA_int_get(op->ptr, "ymax");
 
 	ED_clip_point_stable_pos(C, rect.xmin, rect.ymin, &rectf.xmin, &rectf.ymin);
 	ED_clip_point_stable_pos(C, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
 
-	mode= RNA_int_get(op->ptr, "gesture_mode");
-	extend= RNA_boolean_get(op->ptr, "extend");
+	mode = RNA_int_get(op->ptr, "gesture_mode");
+	extend = RNA_boolean_get(op->ptr, "extend");
 
 	/* do actual selection */
-	track= tracksbase->first;
-	while(track) {
-		if((track->flag&TRACK_HIDDEN)==0) {
-			MovieTrackingMarker *marker= BKE_tracking_get_marker(track, sc->user.framenr);
+	track = tracksbase->first;
+	while (track) {
+		if ((track->flag & TRACK_HIDDEN) == 0) {
+			MovieTrackingMarker *marker = BKE_tracking_get_marker(track, sc->user.framenr);
 
-			if(MARKER_VISIBLE(sc, marker)) {
-				if(BLI_in_rctf(&rectf, marker->pos[0], marker->pos[1])) {
+			if (MARKER_VISIBLE(sc, marker)) {
+				if (BLI_in_rctf(&rectf, marker->pos[0], marker->pos[1])) {
 					BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, mode!=GESTURE_MODAL_SELECT);
 				}
-				else if(!extend) {
+				else if (!extend) {
 					BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, 1);
 				}
 
-				change= 1;
+				change = TRUE;
 			}
 		}
 
-		track= track->next;
+		track = track->next;
 	}
 
-	if(change) {
+	if (change) {
 		WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
 
 		return OPERATOR_FINISHED;
@@ -903,18 +926,18 @@ static int border_select_exec(bContext *C, wmOperator *op)
 void CLIP_OT_select_border(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Border Select";
-	ot->description= "Select markers using border selection";
-	ot->idname= "CLIP_OT_select_border";
+	ot->name = "Border Select";
+	ot->description = "Select markers using border selection";
+	ot->idname = "CLIP_OT_select_border";
 
 	/* api callbacks */
-	ot->invoke= WM_border_select_invoke;
-	ot->exec= border_select_exec;
-	ot->modal= WM_border_select_modal;
-	ot->poll= ED_space_clip_poll;
+	ot->invoke = WM_border_select_invoke;
+	ot->exec = border_select_exec;
+	ot->modal = WM_border_select_modal;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_UNDO;
+	ot->flag = OPTYPE_UNDO;
 
 	/* properties */
 	WM_operator_properties_gesture_border(ot, TRUE);
@@ -927,55 +950,55 @@ static int marker_inside_ellipse(MovieTrackingMarker *marker, float offset[2], f
 	/* normalized ellipse: ell[0] = scaleX, ell[1] = scaleY */
 	float x, y;
 
-	x= (marker->pos[0] - offset[0])*ellipse[0];
-	y= (marker->pos[1] - offset[1])*ellipse[1];
+	x = (marker->pos[0] - offset[0])*ellipse[0];
+	y = (marker->pos[1] - offset[1])*ellipse[1];
 
 	return x*x + y*y < 1.0f;
 }
 
 static int circle_select_exec(bContext *C, wmOperator *op)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	ARegion *ar= CTX_wm_region(C);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	ARegion *ar = CTX_wm_region(C);
 	MovieTrackingTrack *track;
-	ListBase *tracksbase= BKE_tracking_get_tracks(&clip->tracking);
-	int x, y, radius, width, height, mode, change= 0;
+	ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
+	int x, y, radius, width, height, mode, change = FALSE;
 	float zoomx, zoomy, offset[2], ellipse[2];
 
 	/* get operator properties */
-	x= RNA_int_get(op->ptr, "x");
-	y= RNA_int_get(op->ptr, "y");
-	radius= RNA_int_get(op->ptr, "radius");
+	x = RNA_int_get(op->ptr, "x");
+	y = RNA_int_get(op->ptr, "y");
+	radius = RNA_int_get(op->ptr, "radius");
 
-	mode= RNA_int_get(op->ptr, "gesture_mode");
+	mode = RNA_int_get(op->ptr, "gesture_mode");
 
 	/* compute ellipse and position in unified coordinates */
 	ED_space_clip_size(sc, &width, &height);
 	ED_space_clip_zoom(sc, ar, &zoomx, &zoomy);
 
-	ellipse[0]= width*zoomx/radius;
-	ellipse[1]= height*zoomy/radius;
+	ellipse[0] = width * zoomx / radius;
+	ellipse[1] = height * zoomy / radius;
 
 	ED_clip_point_stable_pos(C, x, y, &offset[0], &offset[1]);
 
 	/* do selection */
-	track= tracksbase->first;
-	while(track) {
-		if((track->flag&TRACK_HIDDEN)==0) {
-			MovieTrackingMarker *marker= BKE_tracking_get_marker(track, sc->user.framenr);
+	track = tracksbase->first;
+	while (track) {
+		if ((track->flag & TRACK_HIDDEN) == 0) {
+			MovieTrackingMarker *marker = BKE_tracking_get_marker(track, sc->user.framenr);
 
-			if(MARKER_VISIBLE(sc, marker) && marker_inside_ellipse(marker, offset, ellipse)) {
+			if (MARKER_VISIBLE(sc, marker) && marker_inside_ellipse(marker, offset, ellipse)) {
 				BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, mode!=GESTURE_MODAL_SELECT);
 
-				change= 1;
+				change = TRUE;
 			}
 		}
 
-		track= track->next;
+		track = track->next;
 	}
 
-	if(change) {
+	if (change) {
 		WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
 
 		return OPERATOR_FINISHED;
@@ -987,18 +1010,18 @@ static int circle_select_exec(bContext *C, wmOperator *op)
 void CLIP_OT_select_circle(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Circle Select";
-	ot->description= "Select markers using circle selection";
-	ot->idname= "CLIP_OT_select_circle";
+	ot->name = "Circle Select";
+	ot->description = "Select markers using circle selection";
+	ot->idname = "CLIP_OT_select_circle";
 
 	/* api callbacks */
-	ot->invoke= WM_gesture_circle_invoke;
-	ot->modal= WM_gesture_circle_modal;
-	ot->exec= circle_select_exec;
-	ot->poll= ED_space_clip_poll;
+	ot->invoke = WM_gesture_circle_invoke;
+	ot->modal = WM_gesture_circle_modal;
+	ot->exec = circle_select_exec;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX);
@@ -1011,66 +1034,66 @@ void CLIP_OT_select_circle(wmOperatorType *ot)
 
 static int select_all_exec(bContext *C, wmOperator *op)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTrackingTrack *track= NULL;	/* selected track */
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTrackingTrack *track = NULL;	/* selected track */
 	MovieTrackingMarker *marker;
-	ListBase *tracksbase= BKE_tracking_get_tracks(&clip->tracking);
-	int action= RNA_enum_get(op->ptr, "action");
-	int framenr= sc->user.framenr;
-	int has_selection= 0;
-
-	if(action == SEL_TOGGLE){
-		action= SEL_SELECT;
-		track= tracksbase->first;
-		while(track) {
-			if(TRACK_VIEW_SELECTED(sc, track)) {
-				marker= BKE_tracking_get_marker(track, framenr);
-
-				if(MARKER_VISIBLE(sc, marker)) {
-					action= SEL_DESELECT;
+	ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
+	int action = RNA_enum_get(op->ptr, "action");
+	int framenr = sc->user.framenr;
+	int has_selection = FALSE;
+
+	if (action == SEL_TOGGLE) {
+		action = SEL_SELECT;
+		track = tracksbase->first;
+		while (track) {
+			if (TRACK_VIEW_SELECTED(sc, track)) {
+				marker = BKE_tracking_get_marker(track, framenr);
+
+				if (MARKER_VISIBLE(sc, marker)) {
+					action = SEL_DESELECT;
 					break;
 				}
 			}
 
-			track= track->next;
+			track = track->next;
 		}
 	}
 
-	track= tracksbase->first;
-	while(track) {
-		if((track->flag&TRACK_HIDDEN)==0) {
-			marker= BKE_tracking_get_marker(track, framenr);
+	track = tracksbase->first;
+	while (track) {
+		if ((track->flag & TRACK_HIDDEN)==0) {
+			marker = BKE_tracking_get_marker(track, framenr);
 
-			if(MARKER_VISIBLE(sc, marker)) {
+			if (MARKER_VISIBLE(sc, marker)) {
 				switch (action) {
 					case SEL_SELECT:
-						track->flag|= SELECT;
-						track->pat_flag|= SELECT;
-						track->search_flag|= SELECT;
+						track->flag |= SELECT;
+						track->pat_flag |= SELECT;
+						track->search_flag |= SELECT;
 						break;
 					case SEL_DESELECT:
-						track->flag&= ~SELECT;
-						track->pat_flag&= ~SELECT;
-						track->search_flag&= ~SELECT;
+						track->flag &= ~SELECT;
+						track->pat_flag &= ~SELECT;
+						track->search_flag &= ~SELECT;
 						break;
 					case SEL_INVERT:
-						track->flag^= SELECT;
-						track->pat_flag^= SELECT;
-						track->search_flag^= SELECT;
+						track->flag ^= SELECT;
+						track->pat_flag ^= SELECT;
+						track->search_flag ^= SELECT;
 						break;
 				}
 			}
 		}
 
-		if(TRACK_VIEW_SELECTED(sc, track))
-			has_selection= 1;
+		if (TRACK_VIEW_SELECTED(sc, track))
+			has_selection = TRUE;
 
-		track= track->next;
+		track = track->next;
 	}
 
-	if(!has_selection)
-		sc->flag&= ~SC_LOCK_SELECTION;
+	if (!has_selection)
+		sc->flag &= ~SC_LOCK_SELECTION;
 
 	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
 
@@ -1080,16 +1103,16 @@ static int select_all_exec(bContext *C, wmOperator *op)
 void CLIP_OT_select_all(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select or Deselect All";
-	ot->description= "Change selection of all tracking markers";
-	ot->idname= "CLIP_OT_select_all";
+	ot->name = "(De)select All";
+	ot->description = "Change selection of all tracking markers";
+	ot->idname = "CLIP_OT_select_all";
 
 	/* api callbacks */
-	ot->exec= select_all_exec;
-	ot->poll= ED_space_clip_poll;
+	ot->exec = select_all_exec;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	WM_operator_properties_select_all(ot);
 }
@@ -1098,56 +1121,58 @@ void CLIP_OT_select_all(wmOperatorType *ot)
 
 static int select_groped_exec(bContext *C, wmOperator *op)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
 	MovieTrackingTrack *track;
 	MovieTrackingMarker *marker;
-	MovieTracking *tracking= &clip->tracking;
-	ListBase *tracksbase= BKE_tracking_get_tracks(tracking);
-	int group= RNA_enum_get(op->ptr, "group");
+	MovieTracking *tracking = &clip->tracking;
+	ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
+	int group = RNA_enum_get(op->ptr, "group");
 
-	track= tracksbase->first;
-	while(track) {
-		int ok= 0;
+	track = tracksbase->first;
+	while (track) {
+		int ok = FALSE;
 
-		marker= BKE_tracking_get_marker(track, sc->user.framenr);
+		marker = BKE_tracking_get_marker(track, sc->user.framenr);
 
-		if(group==0) { /* Keyframed */
-			ok= marker->framenr==sc->user.framenr && (marker->flag&MARKER_TRACKED)==0;
+		if (group == 0) { /* Keyframed */
+			ok = marker->framenr == sc->user.framenr && (marker->flag & MARKER_TRACKED)==0;
 		}
-		else if(group==1) { /* Estimated */
-			ok= marker->framenr!=sc->user.framenr;
+		else if (group == 1) { /* Estimated */
+			ok = marker->framenr != sc->user.framenr;
 		}
-		else if(group==2) { /* tracked */
-			ok= marker->framenr==sc->user.framenr && (marker->flag&MARKER_TRACKED);
+		else if (group == 2) { /* tracked */
+			ok = marker->framenr == sc->user.framenr && (marker->flag & MARKER_TRACKED);
 		}
-		else if(group==3) { /* locked */
-			ok= track->flag&TRACK_LOCKED;
+		else if (group == 3) { /* locked */
+			ok = track->flag & TRACK_LOCKED;
 		}
-		else if(group==4) { /* disabled */
-			ok= marker->flag&MARKER_DISABLED;
+		else if (group == 4) { /* disabled */
+			ok = marker->flag & MARKER_DISABLED;
 		}
-		else if(group==5) { /* color */
-			MovieTrackingTrack *act_track= BKE_tracking_active_track(tracking);
+		else if (group == 5) { /* color */
+			MovieTrackingTrack *act_track = BKE_tracking_active_track(tracking);
 
-			if(act_track) {
-				ok= (track->flag&TRACK_CUSTOMCOLOR) == (act_track->flag&TRACK_CUSTOMCOLOR);
+			if (act_track) {
+				ok = (track->flag & TRACK_CUSTOMCOLOR) == (act_track->flag & TRACK_CUSTOMCOLOR);
 
-				if(ok && track->flag&TRACK_CUSTOMCOLOR)
-					ok= equals_v3v3(track->color, act_track->color);
+				if (ok && track->flag & TRACK_CUSTOMCOLOR)
+					ok = equals_v3v3(track->color, act_track->color);
 			}
 		}
-		else if(group==6) { /* failed */
-			ok= (track->flag&TRACK_HAS_BUNDLE) == 0;
+		else if (group == 6) { /* failed */
+			ok = (track->flag & TRACK_HAS_BUNDLE) == 0;
 		}
 
-		if(ok) {
-			track->flag|= SELECT;
-			if(sc->flag&SC_SHOW_MARKER_PATTERN) track->pat_flag|= SELECT;;
-			if(sc->flag&SC_SHOW_MARKER_SEARCH) track->search_flag|= SELECT;;
+		if (ok) {
+			track->flag |= SELECT;
+			if (sc->flag & SC_SHOW_MARKER_PATTERN)
+				track->pat_flag |= SELECT;
+			if (sc->flag & SC_SHOW_MARKER_SEARCH)
+				track->search_flag |= SELECT;
 		}
 
-		track= track->next;
+		track = track->next;
 	}
 
 	WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, clip);
@@ -1169,16 +1194,16 @@ void CLIP_OT_select_grouped(wmOperatorType *ot)
 	};
 
 	/* identifiers */
-	ot->name= "Select Grouped";
-	ot->description= "Joint Selected Tracks";
-	ot->idname= "CLIP_OT_select_grouped";
+	ot->name = "Select Grouped";
+	ot->description = "Select all tracks from specified group";
+	ot->idname = "CLIP_OT_select_grouped";
 
 	/* api callbacks */
-	ot->exec= select_groped_exec;
-	ot->poll= space_clip_frame_poll;
+	ot->exec = select_groped_exec;
+	ot->poll = space_clip_frame_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* proeprties */
 	RNA_def_enum(ot->srna, "group", select_group_items, TRACK_CLEAR_REMAINED, "Action", "Clear action to execute");
@@ -1205,21 +1230,21 @@ static int track_markers_testbreak(void)
 
 static int track_count_markers(SpaceClip *sc, MovieClip *clip)
 {
-	int tot= 0;
-	ListBase *tracksbase= BKE_tracking_get_tracks(&clip->tracking);
+	int tot = 0;
+	ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
 	MovieTrackingTrack *track;
-	int framenr= sc->user.framenr;
+	int framenr = sc->user.framenr;
 
-	track= tracksbase->first;
-	while(track) {
-		if(TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_LOCKED)==0) {
-			MovieTrackingMarker *marker= BKE_tracking_get_marker(track, framenr);
+	track = tracksbase->first;
+	while (track) {
+		if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED) == 0) {
+			MovieTrackingMarker *marker = BKE_tracking_get_marker(track, framenr);
 
-			if (!marker || (marker->flag&MARKER_DISABLED) == 0)
+			if (!marker || (marker->flag & MARKER_DISABLED) == 0)
 				tot++;
 		}
 
-		track= track->next;
+		track = track->next;
 	}
 
 	return tot;
@@ -1227,20 +1252,21 @@ static int track_count_markers(SpaceClip *sc, MovieClip *clip)
 
 static void clear_invisible_track_selection(SpaceClip *sc, MovieClip *clip)
 {
-	ListBase *tracksbase= BKE_tracking_get_tracks(&clip->tracking);
+	ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
 	int hidden = 0;
 
-	if ((sc->flag&SC_SHOW_MARKER_PATTERN)==0)
+	if ((sc->flag & SC_SHOW_MARKER_PATTERN)==0)
 		hidden |= TRACK_AREA_PAT;
 
-	if ((sc->flag&SC_SHOW_MARKER_SEARCH)==0)
+	if ((sc->flag & SC_SHOW_MARKER_SEARCH)==0)
 		hidden |= TRACK_AREA_SEARCH;
 
 	if (hidden) {
 		MovieTrackingTrack *track = tracksbase->first;
 
-		while(track) {
-			BKE_tracking_track_flag(track, hidden, SELECT, 1);
+		while (track) {
+			if ((track->flag & TRACK_HIDDEN) == 0)
+				BKE_tracking_track_flag(track, hidden, SELECT, 1);
 
 			track = track->next;
 		}
@@ -1249,129 +1275,141 @@ static void clear_invisible_track_selection(SpaceClip *sc, MovieClip *clip)
 
 static void track_init_markers(SpaceClip *sc, MovieClip *clip, int *frames_limit_r)
 {
-	ListBase *tracksbase= BKE_tracking_get_tracks(&clip->tracking);
+	ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
 	MovieTrackingTrack *track;
-	int framenr= sc->user.framenr;
-	int frames_limit= 0;
+	int framenr = sc->user.framenr;
+	int frames_limit = 0;
 
 	clear_invisible_track_selection(sc, clip);
 
-	track= tracksbase->first;
-	while(track) {
-		if(TRACK_SELECTED(track)) {
-			if((track->flag&TRACK_HIDDEN)==0 && (track->flag&TRACK_LOCKED)==0) {
+	track = tracksbase->first;
+	while (track) {
+		if (TRACK_VIEW_SELECTED(sc, track)) {
+			if ((track->flag & TRACK_HIDDEN)==0 && (track->flag & TRACK_LOCKED)==0) {
 				BKE_tracking_ensure_marker(track, framenr);
 
-				if(track->frames_limit) {
-					if(frames_limit==0)
-						frames_limit= track->frames_limit;
+				if (track->frames_limit) {
+					if (frames_limit == 0)
+						frames_limit = track->frames_limit;
 					else
-						frames_limit= MIN2(frames_limit, track->frames_limit);
+						frames_limit = MIN2(frames_limit, track->frames_limit);
 				}
 			}
 		}
 
-		track= track->next;
+		track = track->next;
 	}
 
-	*frames_limit_r= frames_limit;
+	*frames_limit_r = frames_limit;
 }
 
 static int track_markers_check_direction(int backwards, int curfra, int efra)
 {
-	if(backwards) {
-		if(curfra<efra) return 0;
+	if (backwards) {
+		if (curfra < efra)
+			return FALSE;
 	}
 	else {
-		if(curfra>efra) return 0;
+		if (curfra > efra)
+			return FALSE;
 	}
 
-	return 1;
+	return TRUE;
 }
 
 static int track_markers_initjob(bContext *C, TrackMarkersJob *tmj, int backwards)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	Scene *scene= CTX_data_scene(C);
-	MovieTrackingSettings *settings= &clip->tracking.settings;
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	Scene *scene = CTX_data_scene(C);
+	MovieTrackingSettings *settings = &clip->tracking.settings;
 	int frames_limit;
 
 	track_init_markers(sc, clip, &frames_limit);
 
-	tmj->sfra= sc->user.framenr;
-	tmj->clip= clip;
-	tmj->backwards= backwards;
+	tmj->sfra = sc->user.framenr;
+	tmj->clip = clip;
+	tmj->backwards = backwards;
 
-	if(backwards) tmj->efra= SFRA;
-	else tmj->efra= EFRA;
+	if (backwards)
+		tmj->efra = SFRA;
+	else
+		tmj->efra = EFRA;
 
 	/* limit frames to be tracked by user setting */
-	if(frames_limit) {
-		if(backwards) tmj->efra= MAX2(tmj->efra, tmj->sfra-frames_limit);
-		else tmj->efra= MIN2(tmj->efra, tmj->sfra+frames_limit);
+	if (frames_limit) {
+		if (backwards)
+			tmj->efra = MAX2(tmj->efra, tmj->sfra - frames_limit);
+		else
+			tmj->efra = MIN2(tmj->efra, tmj->sfra + frames_limit);
 	}
 
-	if(settings->speed!=TRACKING_SPEED_FASTEST) {
-		tmj->delay= 1.0f/scene->r.frs_sec*1000.0f;
+	if (settings->speed != TRACKING_SPEED_FASTEST) {
+		tmj->delay = 1.0f / scene->r.frs_sec * 1000.0f;
 
-		if(settings->speed==TRACKING_SPEED_HALF) tmj->delay*= 2;
-		else if(settings->speed==TRACKING_SPEED_QUARTER) tmj->delay*= 4;
-		else if(settings->speed==TRACKING_SPEED_DOUBLE) tmj->delay/= 2;
+		if (settings->speed == TRACKING_SPEED_HALF)
+			tmj->delay *= 2;
+		else if (settings->speed == TRACKING_SPEED_QUARTER)
+			tmj->delay *= 4;
+		else if (settings->speed == TRACKING_SPEED_DOUBLE)
+			tmj->delay /= 2;
 	}
 
-	tmj->context= BKE_tracking_context_new(clip, &sc->user, backwards, 1);
+	tmj->context = BKE_tracking_context_new(clip, &sc->user, backwards, 1);
 
-	clip->tracking_context= tmj->context;
+	clip->tracking_context = tmj->context;
 
-	tmj->lastfra= tmj->sfra;
+	tmj->lastfra = tmj->sfra;
 
-	/* XXX: silly to store this, but this data is needed to update scene and movieclip
-	        frame numbers when tracking is finished. This introduces better feedback for artists.
-	        Maybe there's another way to solve this problem, but can't think better way atm.
-	        Anyway, this way isn't more unstable as animation rendering animation
-	        which uses the same approach (except storing screen). */
-	tmj->scene= scene;
-	tmj->main= CTX_data_main(C);
-	tmj->screen= CTX_wm_screen(C);
+	/* XXX: silly to store this, but this data is needed to update scene and movie-clip
+	 *      frame numbers when tracking is finished. This introduces better feedback for artists.
+	 *      Maybe there's another way to solve this problem, but can't think better way atm.
+	 *      Anyway, this way isn't more unstable as animation rendering animation
+	 *      which uses the same approach (except storing screen). */
+	tmj->scene = scene;
+	tmj->main = CTX_data_main(C);
+	tmj->screen = CTX_wm_screen(C);
 
 	return track_markers_check_direction(backwards, tmj->sfra, tmj->efra);
 }
 
 static void track_markers_startjob(void *tmv, short *stop, short *do_update, float *progress)
 {
-	TrackMarkersJob *tmj= (TrackMarkersJob *)tmv;
-	int framenr= tmj->sfra;
-	//double t= PIL_check_seconds_timer();
+	TrackMarkersJob *tmj = (TrackMarkersJob *)tmv;
+	int framenr = tmj->sfra;
+	//double t = PIL_check_seconds_timer();
 
-	while(framenr != tmj->efra) {
-		if(tmj->delay>0) {
+	while (framenr != tmj->efra) {
+		if (tmj->delay > 0) {
 			/* tracking should happen with fixed fps. Calculate time
-			   using current timer value before tracking frame and after.
-
-			   Small (and maybe unneeded optimization): do not calculate exec_time
-			   for "Fastest" tracking */
+			 * using current timer value before tracking frame and after.
+			 *
+			 * Small (and maybe unneeded optimization): do not calculate exec_time
+			 * for "Fastest" tracking */
 
-			double start_time= PIL_check_seconds_timer(), exec_time;
+			double start_time = PIL_check_seconds_timer(), exec_time;
 
-			if(!BKE_tracking_next(tmj->context))
+			if (!BKE_tracking_next(tmj->context))
 				break;
 
-			exec_time= PIL_check_seconds_timer()-start_time;
-			if(tmj->delay > (float)exec_time)
+			exec_time = PIL_check_seconds_timer()-start_time;
+			if (tmj->delay > (float)exec_time)
 				PIL_sleep_ms(tmj->delay-(float)exec_time);
-		} else if(!BKE_tracking_next(tmj->context))
+		}
+		else if (!BKE_tracking_next(tmj->context))
 				break;
 
-		*do_update= 1;
-		*progress=(float)(framenr-tmj->sfra) / (tmj->efra-tmj->sfra);
+		*do_update = TRUE;
+		*progress = (float)(framenr-tmj->sfra) / (tmj->efra-tmj->sfra);
 
-		if(tmj->backwards) framenr--;
-		else framenr++;
+		if (tmj->backwards)
+			framenr--;
+		else
+			framenr++;
 
-		tmj->lastfra= framenr;
+		tmj->lastfra = framenr;
 
-		if(*stop || track_markers_testbreak())
+		if (*stop || track_markers_testbreak())
 			break;
 	}
 
@@ -1380,17 +1418,17 @@ static void track_markers_startjob(void *tmv, short *stop, short *do_update, flo
 
 static void track_markers_updatejob(void *tmv)
 {
-	TrackMarkersJob *tmj= (TrackMarkersJob *)tmv;
+	TrackMarkersJob *tmj = (TrackMarkersJob *)tmv;
 
 	BKE_tracking_sync(tmj->context);
 }
 
 static void track_markers_freejob(void *tmv)
 {
-	TrackMarkersJob *tmj= (TrackMarkersJob *)tmv;
+	TrackMarkersJob *tmj = (TrackMarkersJob *)tmv;
 
-	tmj->clip->tracking_context= NULL;
-	tmj->scene->r.cfra= tmj->lastfra;
+	tmj->clip->tracking_context = NULL;
+	tmj->scene->r.cfra = tmj->lastfra;
 	ED_update_for_newframe(tmj->main, tmj->scene, tmj->screen, 0);
 
 	BKE_tracking_sync(tmj->context);
@@ -1403,44 +1441,46 @@ static void track_markers_freejob(void *tmv)
 
 static int track_markers_exec(bContext *C, wmOperator *op)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	Scene *scene= CTX_data_scene(C);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	Scene *scene = CTX_data_scene(C);
 	struct MovieTrackingContext *context;
-	int framenr= sc->user.framenr;
-	int sfra= framenr, efra;
-	int backwards= RNA_boolean_get(op->ptr, "backwards");
-	int sequence= RNA_boolean_get(op->ptr, "sequence");
+	int framenr = sc->user.framenr;
+	int sfra = framenr, efra;
+	int backwards = RNA_boolean_get(op->ptr, "backwards");
+	int sequence = RNA_boolean_get(op->ptr, "sequence");
 	int frames_limit;
 
-	if(track_count_markers(sc, clip)==0)
+	if (track_count_markers(sc, clip)==0)
 		return OPERATOR_CANCELLED;
 
 	track_init_markers(sc, clip, &frames_limit);
 
-	if(backwards) efra= SFRA;
-	else efra= EFRA;
+	if (backwards)
+		efra = SFRA;
+	else
+		efra = EFRA;
 
 	/* limit frames to be tracked by user setting */
-	if(frames_limit) {
-		if(backwards) efra= MAX2(efra, sfra-frames_limit);
-		else efra= MIN2(efra, sfra+frames_limit);
+	if (frames_limit) {
+		if (backwards) efra = MAX2(efra, sfra-frames_limit);
+		else efra = MIN2(efra, sfra+frames_limit);
 	}
 
-	if(!track_markers_check_direction(backwards, framenr, efra))
+	if (!track_markers_check_direction(backwards, framenr, efra))
 		return OPERATOR_CANCELLED;
 
 	/* do not disable tracks due to threshold when tracking frame-by-frame */
-	context= BKE_tracking_context_new(clip, &sc->user, backwards, sequence);
+	context = BKE_tracking_context_new(clip, &sc->user, backwards, sequence);
 
-	while(framenr != efra) {
-		if(!BKE_tracking_next(context))
+	while (framenr != efra) {
+		if (!BKE_tracking_next(context))
 			break;
 
-		if(backwards) framenr--;
+		if (backwards) framenr--;
 		else framenr++;
 
-		if(!sequence)
+		if (!sequence)
 			break;
 	}
 
@@ -1448,7 +1488,7 @@ static int track_markers_exec(bContext *C, wmOperator *op)
 	BKE_tracking_context_free(context);
 
 	/* update scene current frame to the lastes tracked frame */
-	scene->r.cfra= framenr;
+	scene->r.cfra = framenr;
 
 	WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip);
 	WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
@@ -1459,48 +1499,48 @@ static int track_markers_exec(bContext *C, wmOperator *op)
 static int track_markers_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
 	TrackMarkersJob *tmj;
-	ScrArea *sa= CTX_wm_area(C);
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
+	ScrArea *sa = CTX_wm_area(C);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
 	wmJob *steve;
-	int backwards= RNA_boolean_get(op->ptr, "backwards");
-	int sequence= RNA_boolean_get(op->ptr, "sequence");
+	int backwards = RNA_boolean_get(op->ptr, "backwards");
+	int sequence = RNA_boolean_get(op->ptr, "sequence");
 
-	if(WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C))) {
+	if (WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C))) {
 		/* only one tracking is allowed at a time */
 		return OPERATOR_CANCELLED;
 	}
 
-	if(clip->tracking_context)
+	if (clip->tracking_context)
 		return OPERATOR_CANCELLED;
 
-	if(track_count_markers(sc, clip)==0)
+	if (track_count_markers(sc, clip)==0)
 		return OPERATOR_CANCELLED;
 
-	if(!sequence)
+	if (!sequence)
 		return track_markers_exec(C, op);
 
-	tmj= MEM_callocN(sizeof(TrackMarkersJob), "TrackMarkersJob data");
-	if(!track_markers_initjob(C, tmj, backwards)) {
+	tmj = MEM_callocN(sizeof(TrackMarkersJob), "TrackMarkersJob data");
+	if (!track_markers_initjob(C, tmj, backwards)) {
 		track_markers_freejob(tmj);
 
 		return OPERATOR_CANCELLED;
 	}
 
 	/* setup job */
-	steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Track Markers", WM_JOB_PROGRESS);
+	steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Track Markers", WM_JOB_PROGRESS);
 	WM_jobs_customdata(steve, tmj, track_markers_freejob);
 
 	/* if there's delay set in tracking job, tracking should happen
-	   with fixed FPS. To deal with editor refresh we have to syncronize
-	   tracks from job and tracks in clip. Do this in timer callback
-	   to prevent threading conflicts. */
-	if(tmj->delay>0) WM_jobs_timer(steve, tmj->delay/1000.0f, NC_MOVIECLIP|NA_EVALUATED, 0);
+	 * with fixed FPS. To deal with editor refresh we have to synchronize
+	 * tracks from job and tracks in clip. Do this in timer callback
+	 * to prevent threading conflicts. */
+	if (tmj->delay>0) WM_jobs_timer(steve, tmj->delay/1000.0f, NC_MOVIECLIP|NA_EVALUATED, 0);
 	else WM_jobs_timer(steve, 0.2, NC_MOVIECLIP|NA_EVALUATED, 0);
 
 	WM_jobs_callbacks(steve, track_markers_startjob, NULL, track_markers_updatejob, NULL);
 
-	G.afbreek= 0;
+	G.afbreek = 0;
 
 	WM_jobs_start(CTX_wm_manager(C), steve);
 	WM_cursor_wait(0);
@@ -1514,7 +1554,7 @@ static int track_markers_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
 static int track_markers_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
 {
 	/* no running tracking, remove handler and pass through */
-	if(0==WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C)))
+	if (0==WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C)))
 		return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
 
 	/* running tracking */
@@ -1530,18 +1570,18 @@ static int track_markers_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *eve
 void CLIP_OT_track_markers(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Track Markers";
-	ot->description= "Track selected markers";
-	ot->idname= "CLIP_OT_track_markers";
+	ot->name = "Track Markers";
+	ot->description = "Track selected markers";
+	ot->idname = "CLIP_OT_track_markers";
 
 	/* api callbacks */
-	ot->exec= track_markers_exec;
-	ot->invoke= track_markers_invoke;
-	ot->poll= space_clip_frame_poll;
-	ot->modal= track_markers_modal;
+	ot->exec = track_markers_exec;
+	ot->invoke = track_markers_invoke;
+	ot->poll = space_clip_frame_poll;
+	ot->modal = track_markers_modal;
 
 	/* flags */
-	ot->flag= OPTYPE_UNDO;
+	ot->flag = OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "backwards", 0, "Backwards", "Do backwards tracking");
@@ -1564,44 +1604,44 @@ typedef struct {
 
 static int solve_camera_initjob(bContext *C, SolveCameraJob *scj, wmOperator *op, char *error_msg, int max_error)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	Scene *scene= CTX_data_scene(C);
-	MovieTracking *tracking= &clip->tracking;
-	MovieTrackingSettings *settings= &clip->tracking.settings;
-	MovieTrackingObject *object= BKE_tracking_active_object(tracking);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	Scene *scene = CTX_data_scene(C);
+	MovieTracking *tracking = &clip->tracking;
+	MovieTrackingSettings *settings = &clip->tracking.settings;
+	MovieTrackingObject *object = BKE_tracking_active_object(tracking);
 	int width, height;
 
-	if(!BKE_tracking_can_reconstruct(tracking, object, error_msg, max_error))
+	if (!BKE_tracking_can_reconstruct(tracking, object, error_msg, max_error))
 		return 0;
 
 	/* could fail if footage uses images with different sizes */
 	BKE_movieclip_get_size(clip, &sc->user, &width, &height);
 
-	scj->clip= clip;
-	scj->scene= scene;
-	scj->reports= op->reports;
-	scj->user= sc->user;
+	scj->clip = clip;
+	scj->scene = scene;
+	scj->reports = op->reports;
+	scj->user = sc->user;
 
-	scj->context= BKE_tracking_reconstruction_context_new(tracking, object,
+	scj->context = BKE_tracking_reconstruction_context_new(tracking, object,
 			settings->keyframe1, settings->keyframe2, width, height);
 
-	tracking->stats= MEM_callocN(sizeof(MovieTrackingStats), "solve camera stats");
+	tracking->stats = MEM_callocN(sizeof(MovieTrackingStats), "solve camera stats");
 
 	return 1;
 }
 
 static void solve_camera_updatejob(void *scv)
 {
-	SolveCameraJob *scj= (SolveCameraJob *)scv;
-	MovieTracking *tracking= &scj->clip->tracking;
+	SolveCameraJob *scj = (SolveCameraJob *)scv;
+	MovieTracking *tracking = &scj->clip->tracking;
 
 	BLI_strncpy(tracking->stats->message, scj->stats_message, sizeof(tracking->stats->message));
 }
 
 static void solve_camera_startjob(void *scv, short *stop, short *do_update, float *progress)
 {
-	SolveCameraJob *scj= (SolveCameraJob *)scv;
+	SolveCameraJob *scj = (SolveCameraJob *)scv;
 
 	BKE_tracking_solve_reconstruction(scj->context, stop, do_update, progress,
 			scj->stats_message, sizeof(scj->stats_message));
@@ -1609,35 +1649,35 @@ static void solve_camera_startjob(void *scv, short *stop, short *do_update, floa
 
 static void solve_camera_freejob(void *scv)
 {
-	SolveCameraJob *scj= (SolveCameraJob *)scv;
-	MovieTracking *tracking= &scj->clip->tracking;
-	Scene *scene= scj->scene;
-	MovieClip *clip= scj->clip;
+	SolveCameraJob *scj = (SolveCameraJob *)scv;
+	MovieTracking *tracking = &scj->clip->tracking;
+	Scene *scene = scj->scene;
+	MovieClip *clip = scj->clip;
 	int solved;
 
-	if(!scj->context) {
+	if (!scj->context) {
 		/* job weren't fully initialized due to some error */
 		MEM_freeN(scj);
 		return;
 	}
 
-	solved= BKE_tracking_finish_reconstruction(scj->context, tracking);
+	solved = BKE_tracking_finish_reconstruction(scj->context, tracking);
 
-	if(!solved)
+	if (!solved)
 		BKE_report(scj->reports, RPT_WARNING, "Some data failed to reconstruct, see console for details");
 	else
-		BKE_reportf(scj->reports, RPT_INFO, "Average reprojection 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)
+	if (scene->clip)
 		id_us_min(&clip->id);
 
-	scene->clip= clip;
+	scene->clip = clip;
 	id_us_plus(&clip->id);
 
 	/* set blender camera focal length so result would look fine there */
-	if(scene->camera) {
-		Camera *camera= (Camera*)scene->camera->data;
+	if (scene->camera) {
+		Camera *camera = (Camera*)scene->camera->data;
 		int width, height;
 
 		BKE_movieclip_get_size(clip, &scj->user, &width, &height);
@@ -1648,7 +1688,7 @@ static void solve_camera_freejob(void *scv)
 	}
 
 	MEM_freeN(tracking->stats);
-	tracking->stats= NULL;
+	tracking->stats = NULL;
 
 	DAG_id_tag_update(&clip->id, 0);
 
@@ -1665,11 +1705,11 @@ static void solve_camera_freejob(void *scv)
 static int solve_camera_exec(bContext *C, wmOperator *op)
 {
 	SolveCameraJob *scj;
-	char error_msg[256]= "\0";
+	char error_msg[256] = "\0";
 
-	scj= MEM_callocN(sizeof(SolveCameraJob), "SolveCameraJob data");
-	if(!solve_camera_initjob(C, scj, op, error_msg, sizeof(error_msg))) {
-		if(error_msg[0])
+	scj = MEM_callocN(sizeof(SolveCameraJob), "SolveCameraJob data");
+	if (!solve_camera_initjob(C, scj, op, error_msg, sizeof(error_msg))) {
+		if (error_msg[0])
 			BKE_report(op->reports, RPT_ERROR, error_msg);
 
 		solve_camera_freejob(scj);
@@ -1687,22 +1727,22 @@ static int solve_camera_exec(bContext *C, wmOperator *op)
 static int solve_camera_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
 	SolveCameraJob *scj;
-	ScrArea *sa= CTX_wm_area(C);
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
-	MovieTrackingReconstruction *reconstruction= BKE_tracking_get_reconstruction(tracking);
+	ScrArea *sa = CTX_wm_area(C);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	MovieTrackingReconstruction *reconstruction = BKE_tracking_get_reconstruction(tracking);
 	wmJob *steve;
-	char error_msg[256]= "\0";
+	char error_msg[256] = "\0";
 
-	if(WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C))) {
+	if (WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C))) {
 		/* only one solve is allowed at a time */
 		return OPERATOR_CANCELLED;
 	}
 
-	scj= MEM_callocN(sizeof(SolveCameraJob), "SolveCameraJob data");
-	if(!solve_camera_initjob(C, scj, op, error_msg, sizeof(error_msg))) {
-		if(error_msg[0])
+	scj = MEM_callocN(sizeof(SolveCameraJob), "SolveCameraJob data");
+	if (!solve_camera_initjob(C, scj, op, error_msg, sizeof(error_msg))) {
+		if (error_msg[0])
 			BKE_report(op->reports, RPT_ERROR, error_msg);
 
 		solve_camera_freejob(scj);
@@ -1713,16 +1753,16 @@ static int solve_camera_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
 	BLI_strncpy(tracking->stats->message, "Solving camera | Preparing solve", sizeof(tracking->stats->message));
 
 	/* hide reconstruction statistics from previous solve */
-	reconstruction->flag&= ~TRACKING_RECONSTRUCTED;
+	reconstruction->flag &= ~TRACKING_RECONSTRUCTED;
 	WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip);
 
 	/* setup job */
-	steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Solve Camera", WM_JOB_PROGRESS);
+	steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Solve Camera", WM_JOB_PROGRESS);
 	WM_jobs_customdata(steve, scj, solve_camera_freejob);
 	WM_jobs_timer(steve, 0.1, NC_MOVIECLIP|NA_EVALUATED, 0);
 	WM_jobs_callbacks(steve, solve_camera_startjob, NULL, solve_camera_updatejob, NULL);
 
-	G.afbreek= 0;
+	G.afbreek = 0;
 
 	WM_jobs_start(CTX_wm_manager(C), steve);
 	WM_cursor_wait(0);
@@ -1736,7 +1776,7 @@ static int solve_camera_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
 static int solve_camera_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
 {
 	/* no running solver, remove handler and pass through */
-	if(0==WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C)))
+	if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C)))
 		return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
 
 	/* running tracking */
@@ -1752,44 +1792,44 @@ static int solve_camera_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *even
 void CLIP_OT_solve_camera(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Solve Camera";
-	ot->description= "Solve camera motion from tracks";
-	ot->idname= "CLIP_OT_solve_camera";
+	ot->name = "Solve Camera";
+	ot->description = "Solve camera motion from tracks";
+	ot->idname = "CLIP_OT_solve_camera";
 
 	/* api callbacks */
-	ot->exec= solve_camera_exec;
-	ot->invoke= solve_camera_invoke;
-	ot->modal= solve_camera_modal;
-	ot->poll= ED_space_clip_poll;
+	ot->exec = solve_camera_exec;
+	ot->invoke = solve_camera_invoke;
+	ot->modal = solve_camera_modal;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************** clear solution operator *********************/
 
 static int clear_solution_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
-	ListBase *tracksbase= BKE_tracking_get_tracks(&clip->tracking);
-	MovieTrackingReconstruction *reconstruction= BKE_tracking_get_reconstruction(tracking);
-	MovieTrackingTrack *track= tracksbase->first;
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
+	MovieTrackingReconstruction *reconstruction = BKE_tracking_get_reconstruction(tracking);
+	MovieTrackingTrack *track = tracksbase->first;
 
-	while(track) {
-		track->flag&= ~TRACK_HAS_BUNDLE;
+	while (track) {
+		track->flag &= ~TRACK_HAS_BUNDLE;
 
-		track= track->next;
+		track = track->next;
 	}
 
-	if(reconstruction->cameras)
+	if (reconstruction->cameras)
 		MEM_freeN(reconstruction->cameras);
 
-	reconstruction->cameras= NULL;
-	reconstruction->camnr= 0;
+	reconstruction->cameras = NULL;
+	reconstruction->camnr = 0;
 
-	reconstruction->flag&= ~TRACKING_RECONSTRUCTED;
+	reconstruction->flag &= ~TRACKING_RECONSTRUCTED;
 
 	DAG_id_tag_update(&clip->id, 0);
 
@@ -1802,34 +1842,41 @@ static int clear_solution_exec(bContext *C, wmOperator *UNUSED(op))
 void CLIP_OT_clear_solution(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear Solution";
-	ot->description= "Clear all calculated data";
-	ot->idname= "CLIP_OT_clear_solution";
+	ot->name = "Clear Solution";
+	ot->description = "Clear all calculated data";
+	ot->idname = "CLIP_OT_clear_solution";
 
 	/* api callbacks */
-	ot->exec= clear_solution_exec;
-	ot->poll= ED_space_clip_poll;
+	ot->exec = clear_solution_exec;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************** clear track operator *********************/
 
 static int clear_track_path_exec(bContext *C, wmOperator *op)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
 	MovieTrackingTrack *track;
-	ListBase *tracksbase= BKE_tracking_get_tracks(&clip->tracking);
-	int action= RNA_enum_get(op->ptr, "action");
+	ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
+	int action = RNA_enum_get(op->ptr, "action");
+	int clear_active = RNA_boolean_get(op->ptr, "clear_active");
 
-	track= tracksbase->first;
-	while(track) {
-		if(TRACK_VIEW_SELECTED(sc, track))
-			BKE_tracking_clear_path(track, sc->user.framenr, action);
+	if (clear_active) {
+		track = BKE_tracking_active_track(&clip->tracking);
+		BKE_tracking_clear_path(track, sc->user.framenr, action);
+	}
+	else {
+		track = tracksbase->first;
+		while (track) {
+			if (TRACK_VIEW_SELECTED(sc, track))
+				BKE_tracking_clear_path(track, sc->user.framenr, action);
 
-		track= track->next;
+			track = track->next;
+		}
 	}
 
 	WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip);
@@ -1847,42 +1894,45 @@ void CLIP_OT_clear_track_path(wmOperatorType *ot)
 	};
 
 	/* identifiers */
-	ot->name= "Clear Track Path";
-	ot->description= "Clear tracks after/before current position or clear the whole track";
-	ot->idname= "CLIP_OT_clear_track_path";
+	ot->name = "Clear Track Path";
+	ot->description = "Clear tracks after/before current position or clear the whole track";
+	ot->idname = "CLIP_OT_clear_track_path";
 
 	/* api callbacks */
-	ot->exec= clear_track_path_exec;
-	ot->poll= ED_space_clip_poll;
+	ot->exec = clear_track_path_exec;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* proeprties */
 	RNA_def_enum(ot->srna, "action", clear_path_actions, TRACK_CLEAR_REMAINED, "Action", "Clear action to execute");
+	RNA_def_boolean(ot->srna, "clear_active", 0, "Clear Active", "Clear active track only instead of all selected tracks");
 }
 
 /********************** disable markers operator *********************/
 
 static int disable_markers_exec(bContext *C, wmOperator *op)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
-	ListBase *tracksbase= BKE_tracking_get_tracks(tracking);
-	MovieTrackingTrack *track= tracksbase->first;
-	int action= RNA_enum_get(op->ptr, "action");
-
-	while(track) {
-		if(TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_LOCKED)==0) {
-			MovieTrackingMarker *marker= BKE_tracking_ensure_marker(track, sc->user.framenr);
-
-			if(action==0) marker->flag|= MARKER_DISABLED;
-			else if(action==1) marker->flag&= ~MARKER_DISABLED;
-			else marker->flag^= MARKER_DISABLED;
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
+	MovieTrackingTrack *track = tracksbase->first;
+	int action = RNA_enum_get(op->ptr, "action");
+
+	while (track) {
+		if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
+			MovieTrackingMarker *marker = BKE_tracking_ensure_marker(track, sc->user.framenr);
+
+			if (action == 0)
+				marker->flag |= MARKER_DISABLED;
+			else if (action == 1)
+				marker->flag &= ~MARKER_DISABLED;
+			else marker->flag ^= MARKER_DISABLED;
 		}
 
-		track= track->next;
+		track = track->next;
 	}
 
 	DAG_id_tag_update(&clip->id, 0);
@@ -1902,16 +1952,16 @@ void CLIP_OT_disable_markers(wmOperatorType *ot)
 	};
 
 	/* identifiers */
-	ot->name= "Disable Markers";
-	ot->description= "Disable/enable selected markers";
-	ot->idname= "CLIP_OT_disable_markers";
+	ot->name = "Disable Markers";
+	ot->description = "Disable/enable selected markers";
+	ot->idname = "CLIP_OT_disable_markers";
 
 	/* api callbacks */
-	ot->exec= disable_markers_exec;
-	ot->poll= ED_space_clip_poll;
+	ot->exec = disable_markers_exec;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "action", actions_items, 0, "Action", "Disable action to execute");
@@ -1921,22 +1971,22 @@ void CLIP_OT_disable_markers(wmOperatorType *ot)
 
 static Object *get_camera_with_movieclip(Scene *scene, MovieClip *clip)
 {
-	Object *camera= scene->camera;
+	Object *camera = scene->camera;
 	Base *base;
 
-	if(camera && object_get_movieclip(scene, camera, 0)==clip)
+	if (camera && object_get_movieclip(scene, camera, 0)==clip)
 		return camera;
 
-	base= scene->base.first;
-	while(base) {
-		if(base->object->type == OB_CAMERA) {
-			if(object_get_movieclip(scene, base->object, 0)==clip) {
-				camera= base->object;
+	base = scene->base.first;
+	while (base) {
+		if (base->object->type == OB_CAMERA) {
+			if (object_get_movieclip(scene, base->object, 0)==clip) {
+				camera = base->object;
 				break;
 			}
 		}
 
-		base= base->next;
+		base = base->next;
 	}
 
 	return camera;
@@ -1944,60 +1994,60 @@ static Object *get_camera_with_movieclip(Scene *scene, MovieClip *clip)
 
 static Object *get_orientation_object(bContext *C)
 {
-	Scene *scene= CTX_data_scene(C);
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
-	MovieTrackingObject *tracking_object= BKE_tracking_active_object(tracking);
-	Object *object= NULL;
+	Scene *scene = CTX_data_scene(C);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	MovieTrackingObject *tracking_object = BKE_tracking_active_object(tracking);
+	Object *object = NULL;
 
-	if(tracking_object->flag&TRACKING_OBJECT_CAMERA) {
-		object= get_camera_with_movieclip(scene, clip);
+	if (tracking_object->flag & TRACKING_OBJECT_CAMERA) {
+		object = get_camera_with_movieclip(scene, clip);
 	}
 	else {
-		object= OBACT;
+		object = OBACT;
 	}
 
-	if(object && object->parent)
-		object= object->parent;
+	if (object && object->parent)
+		object = object->parent;
 
 	return object;
 }
 
 static int set_orientation_poll(bContext *C)
 {
-	if(space_clip_frame_poll(C)) {
-		Scene *scene= CTX_data_scene(C);
-		SpaceClip *sc= CTX_wm_space_clip(C);
-		MovieClip *clip= ED_space_clip(sc);
-		MovieTracking *tracking= &clip->tracking;
-		MovieTrackingObject *tracking_object= BKE_tracking_active_object(tracking);
+	if (space_clip_frame_poll(C)) {
+		Scene *scene = CTX_data_scene(C);
+		SpaceClip *sc = CTX_wm_space_clip(C);
+		MovieClip *clip = ED_space_clip(sc);
+		MovieTracking *tracking = &clip->tracking;
+		MovieTrackingObject *tracking_object = BKE_tracking_active_object(tracking);
 
-		if(tracking_object->flag&TRACKING_OBJECT_CAMERA) {
-			return 1;
+		if (tracking_object->flag & TRACKING_OBJECT_CAMERA) {
+			return TRUE;
 		}
 		else {
 			return OBACT != NULL;
 		}
 	}
 
-	return 0;
+	return FALSE;
 }
 
 static int count_selected_bundles(bContext *C)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	ListBase *tracksbase= BKE_tracking_get_tracks(&clip->tracking);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
 	MovieTrackingTrack *track;
-	int tot= 0;
+	int tot = 0;
 
-	track= tracksbase->first;
-	while(track) {
-		if(TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_HAS_BUNDLE))
+	track = tracksbase->first;
+	while (track) {
+		if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_HAS_BUNDLE))
 			tot++;
 
-		track= track->next;
+		track = track->next;
 	}
 
 	return tot;
@@ -2006,30 +2056,30 @@ static int count_selected_bundles(bContext *C)
 static void object_solver_inverted_matrix(Scene *scene, Object *ob, float invmat[4][4])
 {
 	bConstraint *con;
-	int found= 0;
+	int found = FALSE;
 
-	for (con= ob->constraints.first; con; con=con->next) {
-		bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
+	for (con = ob->constraints.first; con; con = con->next) {
+		bConstraintTypeInfo *cti = constraint_get_typeinfo(con);
 
-		if(!cti)
+		if (!cti)
 			continue;
 
-		if(cti->type==CONSTRAINT_TYPE_OBJECTSOLVER) {
-			bObjectSolverConstraint *data= (bObjectSolverConstraint *)con->data;
+		if (cti->type == CONSTRAINT_TYPE_OBJECTSOLVER) {
+			bObjectSolverConstraint *data = (bObjectSolverConstraint *)con->data;
 
-			if(!found) {
-				Object *cam= data->camera ? data->camera : scene->camera;
+			if (!found) {
+				Object *cam = data->camera ? data->camera : scene->camera;
 
 				where_is_object_mat(scene, cam, invmat);
 			}
 
 			mult_m4_m4m4(invmat, invmat, data->invmat);
 
-			found= 1;
+			found = TRUE;
 		}
 	}
 
-	if(found)
+	if (found)
 		invert_m4(invmat);
 	else
 		unit_m4(invmat);
@@ -2039,14 +2089,14 @@ static Object *object_solver_camera(Scene *scene, Object *ob)
 {
 	bConstraint *con;
 
-	for (con= ob->constraints.first; con; con=con->next) {
-		bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
+	for (con = ob->constraints.first; con; con = con->next) {
+		bConstraintTypeInfo *cti = constraint_get_typeinfo(con);
 
-		if(!cti)
+		if (!cti)
 			continue;
 
-		if(cti->type==CONSTRAINT_TYPE_OBJECTSOLVER) {
-			bObjectSolverConstraint *data= (bObjectSolverConstraint *)con->data;
+		if (cti->type == CONSTRAINT_TYPE_OBJECTSOLVER) {
+			bObjectSolverConstraint *data = (bObjectSolverConstraint *)con->data;
 
 			return data->camera ? data->camera : scene->camera;
 		}
@@ -2057,43 +2107,43 @@ static Object *object_solver_camera(Scene *scene, Object *ob)
 
 static int set_origin_exec(bContext *C, wmOperator *op)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
 	MovieTrackingTrack *track;
 	MovieTrackingObject *tracking_object;
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	Object *object;
-	Object *camera= get_camera_with_movieclip(scene, clip);
+	Object *camera = get_camera_with_movieclip(scene, clip);
 	ListBase *tracksbase;
 	float mat[4][4], vec[3], median[3];
-	int selected_count= count_selected_bundles(C);
+	int selected_count = count_selected_bundles(C);
 
-	if(selected_count==0) {
+	if (selected_count == 0) {
 		BKE_report(op->reports, RPT_ERROR, "At least one track with bundle should be selected to define origin position");
 
 		return OPERATOR_CANCELLED;
 	}
 
-	object= get_orientation_object(C);
-	if(!object) {
+	object = get_orientation_object(C);
+	if (!object) {
 		BKE_report(op->reports, RPT_ERROR, "No object to apply orientation on");
 
 		return OPERATOR_CANCELLED;
 	}
 
-	tracking_object= BKE_tracking_active_object(tracking);
+	tracking_object = BKE_tracking_active_object(tracking);
 
-	tracksbase= BKE_tracking_object_tracks(tracking, tracking_object);
+	tracksbase = BKE_tracking_object_tracks(tracking, tracking_object);
 
-	track= tracksbase->first;
+	track = tracksbase->first;
 	zero_v3(median);
-	while(track) {
-		if(TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_HAS_BUNDLE)) {
+	while (track) {
+		if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_HAS_BUNDLE)) {
 			add_v3_v3(median, track->bundle_pos);
 		}
 
-		track= track->next;
+		track = track->next;
 	}
 	mul_v3_fl(median, 1.0f/selected_count);
 
@@ -2101,7 +2151,7 @@ static int set_origin_exec(bContext *C, wmOperator *op)
 
 	mul_v3_m4v3(vec, mat, median);
 
-	if(tracking_object->flag&TRACKING_OBJECT_CAMERA) {
+	if (tracking_object->flag & TRACKING_OBJECT_CAMERA) {
 		sub_v3_v3(object->loc, vec);
 	}
 	else {
@@ -2122,16 +2172,16 @@ static int set_origin_exec(bContext *C, wmOperator *op)
 void CLIP_OT_set_origin(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Origin";
-	ot->description= "Set active marker as origin by moving camera (or it's parent if present) in 3D space";
-	ot->idname= "CLIP_OT_set_origin";
+	ot->name = "Set Origin";
+	ot->description = "Set active marker as origin by moving camera (or it's parent if present) in 3D space";
+	ot->idname = "CLIP_OT_set_origin";
 
 	/* api callbacks */
-	ot->exec= set_origin_exec;
-	ot->poll= set_orientation_poll;
+	ot->exec = set_origin_exec;
+	ot->poll = set_orientation_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "use_median", 0, "Use Median", "Set origin to median point of selected bundles");
@@ -2142,9 +2192,9 @@ void CLIP_OT_set_origin(wmOperatorType *ot)
 static void set_axis(Scene *scene,  Object *ob, MovieClip *clip, MovieTrackingObject *tracking_object,
 			MovieTrackingTrack *track, char axis)
 {
-	Object *camera= get_camera_with_movieclip(scene, clip);
-	int is_camera= tracking_object->flag&TRACKING_OBJECT_CAMERA;
-	int  flip= 0;
+	Object *camera = get_camera_with_movieclip(scene, clip);
+	int is_camera = tracking_object->flag & TRACKING_OBJECT_CAMERA;
+	int  flip = FALSE;
 	float mat[4][4], vec[3], obmat[4][4], dvec[3];
 
 	object_to_mat4(ob, obmat);
@@ -2153,7 +2203,7 @@ static void set_axis(Scene *scene,  Object *ob, MovieClip *clip, MovieTrackingOb
 	mul_v3_m4v3(vec, mat, track->bundle_pos);
 	copy_v3_v3(dvec, vec);
 
-	if(!is_camera) {
+	if (!is_camera) {
 		float imat[4][4];
 
 		object_solver_inverted_matrix(scene, ob, imat);
@@ -2165,50 +2215,53 @@ static void set_axis(Scene *scene,  Object *ob, MovieClip *clip, MovieTrackingOb
 		sub_v3_v3(vec, obmat[3]);
 	}
 
-	if(len_v2(vec) < 1e-3f)
+	if (len_v2(vec) < 1e-3f)
 		return;
 
 	unit_m4(mat);
 
-	if(axis=='X') {
-		if(fabsf(dvec[1])<1e-3f) {
-			flip= 1;
+	if (axis == 'X') {
+		if (fabsf(dvec[1]) < 1e-3f) {
+			flip = TRUE;
 
-			mat[0][0]= -1.0f; mat[0][1]= 0.0f; mat[0][2]= 0.0f;
-			mat[1][0]= 0.0f; mat[1][1]= -1.0f; mat[1][2]= 0.0f;
-			mat[2][0]= 0.0f; mat[2][1]= 0.0f; mat[2][2]= 1.0f;
-		} else {
+			mat[0][0] = -1.0f; mat[0][1] = 0.0f; mat[0][2] = 0.0f;
+			mat[1][0] = 0.0f; mat[1][1] = -1.0f; mat[1][2] = 0.0f;
+			mat[2][0] = 0.0f; mat[2][1] = 0.0f; mat[2][2] = 1.0f;
+		}
+		else {
 			copy_v3_v3(mat[0], vec);
 
-			if(is_camera || fabsf(vec[2])<1e-3f) {
-				mat[0][2]= 0.0f;
-				mat[2][0]= 0.0f; mat[2][1]= 0.0f; mat[2][2]= 1.0f;
+			if (is_camera || fabsf(vec[2]) < 1e-3f) {
+				mat[0][2] = 0.0f;
+				mat[2][0] = 0.0f; mat[2][1] = 0.0f; mat[2][2] = 1.0f;
 				cross_v3_v3v3(mat[1], mat[2], mat[0]);
 			}
 			else {
-				vec[2]= 0.0f;
+				vec[2] = 0.0f;
 
 				cross_v3_v3v3(mat[1], mat[0], vec);
 				cross_v3_v3v3(mat[2], mat[0], mat[1]);
 			}
 		}
-	} else {
-		if(fabsf(dvec[0])<1e-3f) {
-			flip= 1;
-
-			mat[0][0]= -1.0f; mat[0][1]= 0.0f; mat[0][2]= 0.0f;
-			mat[1][0]= 0.0f; mat[1][1]= -1.0f; mat[1][2]= 0.0f;
-			mat[2][0]= 0.0f; mat[2][1]= 0.0f; mat[2][2]= 1.0f;
-		} else {
+	}
+	else {
+		if (fabsf(dvec[0]) < 1e-3f) {
+			flip = TRUE;
+
+			mat[0][0] = -1.0f; mat[0][1] = 0.0f; mat[0][2] = 0.0f;
+			mat[1][0] = 0.0f; mat[1][1] = -1.0f; mat[1][2] = 0.0f;
+			mat[2][0] = 0.0f; mat[2][1] = 0.0f; mat[2][2] = 1.0f;
+		}
+		else {
 			copy_v3_v3(mat[1], vec);
 
-			if(is_camera || fabsf(vec[2])<1e-3f) {
-				mat[1][2]= 0.0f;
-				mat[2][0]= 0.0f; mat[2][1]= 0.0f; mat[2][2]= 1.0f;
+			if (is_camera || fabsf(vec[2])<1e-3f) {
+				mat[1][2] = 0.0f;
+				mat[2][0] = 0.0f; mat[2][1] = 0.0f; mat[2][2] = 1.0f;
 				cross_v3_v3v3(mat[0], mat[1], mat[2]);
 			}
 			else {
-				vec[2]= 0.0f;
+				vec[2] = 0.0f;
 
 				cross_v3_v3v3(mat[0], vec, mat[1]);
 				cross_v3_v3v3(mat[2], mat[0], mat[1]);
@@ -2220,13 +2273,13 @@ static void set_axis(Scene *scene,  Object *ob, MovieClip *clip, MovieTrackingOb
 	normalize_v3(mat[1]);
 	normalize_v3(mat[2]);
 
-	if(is_camera) {
+	if (is_camera) {
 		invert_m4(mat);
 
 		mult_m4_m4m4(mat, mat, obmat);
 	}
 	else {
-		if(!flip) {
+		if (!flip) {
 			float lmat[4][4], ilmat[4][4], rmat[3][3];
 
 			object_rot_to_mat3(ob, rmat);
@@ -2247,36 +2300,37 @@ static void set_axis(Scene *scene,  Object *ob, MovieClip *clip, MovieTrackingOb
 	object_apply_mat4(ob, mat, 0, 0);
 }
 
-static int set_floor_exec(bContext *C, wmOperator *op)
+static int set_plane_exec(bContext *C, wmOperator *op)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	Scene *scene= CTX_data_scene(C);
-	MovieTracking *tracking= &clip->tracking;
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	Scene *scene = CTX_data_scene(C);
+	MovieTracking *tracking = &clip->tracking;
 	MovieTrackingObject *tracking_object;
-	MovieTrackingTrack *track, *axis_track= NULL, *act_track;
+	MovieTrackingTrack *track, *axis_track = NULL, *act_track;
 	ListBase *tracksbase;
 	Object *object;
-	Object *camera= get_camera_with_movieclip(scene, clip);
-	int tot= 0;
-	float vec[3][3], mat[4][4], obmat[4][4], newmat[4][4], orig[3]= {0.0f, 0.0f, 0.0f};
-	float rot[4][4]={{0.0f, 0.0f, -1.0f, 0.0f},
-	                 {0.0f, 1.0f, 0.0f, 0.0f},
-	                 {1.0f, 0.0f, 0.0f, 0.0f},
-	                 {0.0f, 0.0f, 0.0f, 1.0f}};	/* 90 degrees Y-axis rotation matrix */
-
-	if(count_selected_bundles(C)!=3) {
+	Object *camera = get_camera_with_movieclip(scene, clip);
+	int tot = 0;
+	float vec[3][3], mat[4][4], obmat[4][4], newmat[4][4], orig[3] = {0.0f, 0.0f, 0.0f};
+	int plane = RNA_enum_get(op->ptr, "plane");
+	float rot[4][4] = {{0.0f, 0.0f, -1.0f, 0.0f},
+	                   {0.0f, 1.0f, 0.0f, 0.0f},
+	                   {1.0f, 0.0f, 0.0f, 0.0f},
+	                   {0.0f, 0.0f, 0.0f, 1.0f}};	/* 90 degrees Y-axis rotation matrix */
+
+	if (count_selected_bundles(C)!=3) {
 		BKE_report(op->reports, RPT_ERROR, "Three tracks with bundles are needed to orient the floor");
 
 		return OPERATOR_CANCELLED;
 	}
 
-	tracking_object= BKE_tracking_active_object(tracking);
-	tracksbase= BKE_tracking_object_tracks(tracking, tracking_object);
-	act_track= BKE_tracking_active_track(tracking);
+	tracking_object = BKE_tracking_active_object(tracking);
+	tracksbase = BKE_tracking_object_tracks(tracking, tracking_object);
+	act_track = BKE_tracking_active_track(tracking);
 
-	object= get_orientation_object(C);
-	if(!object) {
+	object = get_orientation_object(C);
+	if (!object) {
 		BKE_report(op->reports, RPT_ERROR, "No object to apply orientation on");
 
 		return OPERATOR_CANCELLED;
@@ -2285,20 +2339,20 @@ static int set_floor_exec(bContext *C, wmOperator *op)
 	BKE_get_tracking_mat(scene, camera, mat);
 
 	/* get 3 bundles to use as reference */
-	track= tracksbase->first;
-	while(track && tot<3) {
-		if(track->flag&TRACK_HAS_BUNDLE && TRACK_VIEW_SELECTED(sc, track)) {
+	track = tracksbase->first;
+	while (track && tot<3) {
+		if (track->flag & TRACK_HAS_BUNDLE && TRACK_VIEW_SELECTED(sc, track)) {
 			mul_v3_m4v3(vec[tot], mat, track->bundle_pos);
 
-			if(tot==0 || track==act_track)
+			if (tot == 0 || track == act_track)
 				copy_v3_v3(orig, vec[tot]);
 			else
-				axis_track= track;
+				axis_track = track;
 
 			tot++;
 		}
 
-		track= track->next;
+		track = track->next;
 	}
 
 	sub_v3_v3(vec[1], vec[0]);
@@ -2307,20 +2361,27 @@ static int set_floor_exec(bContext *C, wmOperator *op)
 	/* construct ortho-normal basis */
 	unit_m4(mat);
 
-	cross_v3_v3v3(mat[0], vec[1], vec[2]);
-	copy_v3_v3(mat[1], vec[1]);
-	cross_v3_v3v3(mat[2], mat[0], mat[1]);
+	if (plane == 0) { /* floor */
+		cross_v3_v3v3(mat[0], vec[1], vec[2]);
+		copy_v3_v3(mat[1], vec[1]);
+		cross_v3_v3v3(mat[2], mat[0], mat[1]);
+	}
+	else if (plane == 1) { /* wall */
+		cross_v3_v3v3(mat[2], vec[1], vec[2]);
+		copy_v3_v3(mat[1], vec[1]);
+		cross_v3_v3v3(mat[0], mat[1], mat[2]);
+	}
 
 	normalize_v3(mat[0]);
 	normalize_v3(mat[1]);
 	normalize_v3(mat[2]);
 
 	/* move to origin point */
-	mat[3][0]= orig[0];
-	mat[3][1]= orig[1];
-	mat[3][2]= orig[2];
+	mat[3][0] = orig[0];
+	mat[3][1] = orig[1];
+	mat[3][2] = orig[2];
 
-	if(tracking_object->flag&TRACKING_OBJECT_CAMERA) {
+	if (tracking_object->flag & TRACKING_OBJECT_CAMERA) {
 		invert_m4(mat);
 
 		object_to_mat4(object, obmat);
@@ -2329,7 +2390,7 @@ static int set_floor_exec(bContext *C, wmOperator *op)
 		object_apply_mat4(object, newmat, 0, 0);
 
 		/* make camera have positive z-coordinate */
-		if(object->loc[2]<0) {
+		if (object->loc[2]<0) {
 			invert_m4(rot);
 			mult_m4_m4m4(newmat, rot, mat);
 			object_apply_mat4(object, newmat, 0, 0);
@@ -2351,59 +2412,68 @@ static int set_floor_exec(bContext *C, wmOperator *op)
 	return OPERATOR_FINISHED;
 }
 
-void CLIP_OT_set_floor(wmOperatorType *ot)
+void CLIP_OT_set_plane(wmOperatorType *ot)
 {
+	static EnumPropertyItem plane_items[] = {
+			{0, "FLOOR", 0, "Floor", "Set floor plane"},
+			{1, "WALL", 0, "Wall", "Set wall plane"},
+			{0, NULL, 0, NULL, NULL}
+	};
+
 	/* identifiers */
-	ot->name= "Set Floor";
-	ot->description= "Set floor based on 3 selected bundles by moving camera (or it's parent if present) in 3D space";
-	ot->idname= "CLIP_OT_set_floor";
+	ot->name = "Set Plane";
+	ot->description = "Set plane based on 3 selected bundles by moving camera (or it's parent if present) in 3D space";
+	ot->idname = "CLIP_OT_set_plane";
 
 	/* api callbacks */
-	ot->exec= set_floor_exec;
-	ot->poll= set_orientation_poll;
+	ot->exec = set_plane_exec;
+	ot->poll = set_orientation_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+
+	/* properties */
+	RNA_def_enum(ot->srna, "plane", plane_items, 0, "Plane", "Plane to be used for orientation");
 }
 
 /********************** set axis operator *********************/
 
 static int set_axis_exec(bContext *C, wmOperator *op)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
-	MovieTrackingObject *tracking_object= BKE_tracking_active_object(tracking);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	MovieTrackingObject *tracking_object = BKE_tracking_active_object(tracking);
 	MovieTrackingTrack *track;
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	Object *object;
 	ListBase *tracksbase;
-	int axis= RNA_enum_get(op->ptr, "axis");
+	int axis = RNA_enum_get(op->ptr, "axis");
 
-	if(count_selected_bundles(C)!=1) {
+	if (count_selected_bundles(C)!=1) {
 		BKE_report(op->reports, RPT_ERROR, "Single track with bundle should be selected to define axis");
 
 		return OPERATOR_CANCELLED;
 	}
 
-	object= get_orientation_object(C);
-	if(!object) {
+	object = get_orientation_object(C);
+	if (!object) {
 		BKE_report(op->reports, RPT_ERROR, "No object to apply orientation on");
 
 		return OPERATOR_CANCELLED;
 	}
 
-	tracksbase= BKE_tracking_object_tracks(tracking, tracking_object);
+	tracksbase = BKE_tracking_object_tracks(tracking, tracking_object);
 
-	track=tracksbase->first;
-	while(track) {
-		if(TRACK_VIEW_SELECTED(sc, track))
+	track = tracksbase->first;
+	while (track) {
+		if (TRACK_VIEW_SELECTED(sc, track))
 			break;
 
-		track= track->next;
+		track = track->next;
 	}
 
-	set_axis(scene, object, clip, tracking_object, track, axis==0?'X':'Y');
+	set_axis(scene, object, clip, tracking_object, track, axis == 0 ? 'X' : 'Y');
 
 	DAG_id_tag_update(&clip->id, 0);
 	DAG_id_tag_update(&object->id, OB_RECALC_OB);
@@ -2423,16 +2493,16 @@ void CLIP_OT_set_axis(wmOperatorType *ot)
 	};
 
 	/* identifiers */
-	ot->name= "Set Axis";
-	ot->description= "Set direction of scene axis rotating camera (or it's parent if present) and assuming selected track lies on real axis joining it with the origin";
-	ot->idname= "CLIP_OT_set_axis";
+	ot->name = "Set Axis";
+	ot->description = "Set direction of scene axis rotating camera (or it's parent if present) and assuming selected track lies on real axis joining it with the origin";
+	ot->idname = "CLIP_OT_set_axis";
 
 	/* api callbacks */
-	ot->exec= set_axis_exec;
-	ot->poll= set_orientation_poll;
+	ot->exec = set_axis_exec;
+	ot->poll = set_orientation_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "axis", axis_actions, 0, "Axis", "Axis to use to align bundle along");
@@ -2442,27 +2512,27 @@ void CLIP_OT_set_axis(wmOperatorType *ot)
 
 static int do_set_scale(bContext *C, wmOperator *op, int scale_solution)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
-	MovieTrackingObject *tracking_object= BKE_tracking_active_object(tracking);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	MovieTrackingObject *tracking_object = BKE_tracking_active_object(tracking);
 	MovieTrackingTrack *track;
-	Scene *scene= CTX_data_scene(C);
-	Object *object= NULL;
-	Object *camera= get_camera_with_movieclip(scene, clip);
-	ListBase *tracksbase= BKE_tracking_get_tracks(tracking);
-	int tot= 0;
+	Scene *scene = CTX_data_scene(C);
+	Object *object = NULL;
+	Object *camera = get_camera_with_movieclip(scene, clip);
+	ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
+	int tot = 0;
 	float vec[2][3], mat[4][4], scale;
-	float dist= RNA_float_get(op->ptr, "distance");
+	float dist = RNA_float_get(op->ptr, "distance");
 
-	if(count_selected_bundles(C)!=2) {
+	if (count_selected_bundles(C) != 2) {
 		BKE_report(op->reports, RPT_ERROR, "Two tracks with bundles should be selected to set scale");
 
 		return OPERATOR_CANCELLED;
 	}
 
-	object= get_orientation_object(C);
-	if(!object) {
+	object = get_orientation_object(C);
+	if (!object) {
 		BKE_report(op->reports, RPT_ERROR, "No object to apply orientation on");
 
 		return OPERATOR_CANCELLED;
@@ -2470,43 +2540,43 @@ static int do_set_scale(bContext *C, wmOperator *op, int scale_solution)
 
 	BKE_get_tracking_mat(scene, camera, mat);
 
-	track= tracksbase->first;
-	while(track) {
-		if(TRACK_VIEW_SELECTED(sc, track)) {
+	track = tracksbase->first;
+	while (track) {
+		if (TRACK_VIEW_SELECTED(sc, track)) {
 			mul_v3_m4v3(vec[tot], mat, track->bundle_pos);
 			tot++;
 		}
 
-		track= track->next;
+		track = track->next;
 	}
 
 	sub_v3_v3(vec[0], vec[1]);
 
-	if(len_v3(vec[0])>1e-5f) {
-		scale= dist / len_v3(vec[0]);
+	if (len_v3(vec[0])>1e-5f) {
+		scale = dist / len_v3(vec[0]);
 
-		if(tracking_object->flag&TRACKING_OBJECT_CAMERA) {
+		if (tracking_object->flag & TRACKING_OBJECT_CAMERA) {
 			mul_v3_fl(object->size, scale);
 			mul_v3_fl(object->loc, scale);
 		}
-		else if(!scale_solution){
-			Object *solver_camera= object_solver_camera(scene, object);
+		else if (!scale_solution) {
+			Object *solver_camera = object_solver_camera(scene, object);
 
-			object->size[0]= object->size[1]= object->size[2]= 1.0f/scale;
+			object->size[0] = object->size[1] = object->size[2] = 1.0f/scale;
 
-			if(solver_camera) {
-				object->size[0]/= solver_camera->size[0];
-				object->size[1]/= solver_camera->size[1];
-				object->size[2]/= solver_camera->size[2];
+			if (solver_camera) {
+				object->size[0] /= solver_camera->size[0];
+				object->size[1] /= solver_camera->size[1];
+				object->size[2] /= solver_camera->size[2];
 			}
 		}
 		else {
-			tracking_object->scale= scale;
+			tracking_object->scale = scale;
 		}
 
 		DAG_id_tag_update(&clip->id, 0);
 
-		if(object)
+		if (object)
 			DAG_id_tag_update(&object->id, OB_RECALC_OB);
 
 		WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip);
@@ -2523,10 +2593,10 @@ static int set_scale_exec(bContext *C, wmOperator *op)
 
 static int set_scale_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
 
-	if(!RNA_struct_property_is_set(op->ptr, "distance"))
+	if (!RNA_struct_property_is_set(op->ptr, "distance"))
 		RNA_float_set(op->ptr, "distance", clip->tracking.settings.dist);
 
 	return set_scale_exec(C, op);
@@ -2535,17 +2605,17 @@ static int set_scale_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 void CLIP_OT_set_scale(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Scale";
-	ot->description= "Set scale of scene by scaling camera (or it's parent if present)";
-	ot->idname= "CLIP_OT_set_scale";
+	ot->name = "Set Scale";
+	ot->description = "Set scale of scene by scaling camera (or it's parent if present)";
+	ot->idname = "CLIP_OT_set_scale";
 
 	/* api callbacks */
-	ot->exec= set_scale_exec;
-	ot->invoke= set_scale_invoke;
-	ot->poll= set_orientation_poll;
+	ot->exec = set_scale_exec;
+	ot->invoke = set_scale_invoke;
+	ot->poll = set_orientation_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_float(ot->srna, "distance", 0.0f, -FLT_MAX, FLT_MAX,
@@ -2556,13 +2626,13 @@ void CLIP_OT_set_scale(wmOperatorType *ot)
 
 static int set_solution_scale_poll(bContext *C)
 {
-	if(space_clip_frame_poll(C)) {
-		SpaceClip *sc= CTX_wm_space_clip(C);
-		MovieClip *clip= ED_space_clip(sc);
-		MovieTracking *tracking= &clip->tracking;
-		MovieTrackingObject *tracking_object= BKE_tracking_active_object(tracking);
+	if (space_clip_frame_poll(C)) {
+		SpaceClip *sc = CTX_wm_space_clip(C);
+		MovieClip *clip = ED_space_clip(sc);
+		MovieTracking *tracking = &clip->tracking;
+		MovieTrackingObject *tracking_object = BKE_tracking_active_object(tracking);
 
-		return (tracking_object->flag&TRACKING_OBJECT_CAMERA) == 0;
+		return (tracking_object->flag & TRACKING_OBJECT_CAMERA) == 0;
 	}
 
 	return 0;
@@ -2575,10 +2645,10 @@ static int set_solution_scale_exec(bContext *C, wmOperator *op)
 
 static int set_solution_scale_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
 
-	if(!RNA_struct_property_is_set(op->ptr, "distance"))
+	if (!RNA_struct_property_is_set(op->ptr, "distance"))
 		RNA_float_set(op->ptr, "distance", clip->tracking.settings.object_distance);
 
 	return set_solution_scale_exec(C, op);
@@ -2587,17 +2657,17 @@ static int set_solution_scale_invoke(bContext *C, wmOperator *op, wmEvent *UNUSE
 void CLIP_OT_set_solution_scale(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Solution Scale";
-	ot->description= "Set object solution scale using distance between two selected tracks";
-	ot->idname= "CLIP_OT_set_solution_scale";
+	ot->name = "Set Solution Scale";
+	ot->description = "Set object solution scale using distance between two selected tracks";
+	ot->idname = "CLIP_OT_set_solution_scale";
 
 	/* api callbacks */
-	ot->exec= set_solution_scale_exec;
-	ot->invoke= set_solution_scale_invoke;
-	ot->poll= set_solution_scale_poll;
+	ot->exec = set_solution_scale_exec;
+	ot->invoke = set_solution_scale_invoke;
+	ot->poll = set_solution_scale_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_float(ot->srna, "distance", 0.0f, -FLT_MAX, FLT_MAX,
@@ -2608,17 +2678,17 @@ void CLIP_OT_set_solution_scale(wmOperatorType *ot)
 
 static int set_center_principal_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
 	int width, height;
 
 	BKE_movieclip_get_size(clip, &sc->user, &width, &height);
 
-	if(width==0 || height==0)
+	if (width == 0 || height == 0)
 		return OPERATOR_CANCELLED;
 
-	clip->tracking.camera.principal[0]= ((float)width)/2.0f;
-	clip->tracking.camera.principal[1]= ((float)height)/2.0f;
+	clip->tracking.camera.principal[0] = ((float)width)/2.0f;
+	clip->tracking.camera.principal[1] = ((float)height)/2.0f;
 
 	WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip);
 
@@ -2628,49 +2698,50 @@ static int set_center_principal_exec(bContext *C, wmOperator *UNUSED(op))
 void CLIP_OT_set_center_principal(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Principal to Center";
-	ot->description= "Set optical center to center of footage";
-	ot->idname= "CLIP_OT_set_center_principal";
+	ot->name = "Set Principal to Center";
+	ot->description = "Set optical center to center of footage";
+	ot->idname = "CLIP_OT_set_center_principal";
 
 	/* api callbacks */
-	ot->exec= set_center_principal_exec;
-	ot->poll= ED_space_clip_poll;
+	ot->exec = set_center_principal_exec;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************** hide tracks operator *********************/
 
 static int hide_tracks_exec(bContext *C, wmOperator *op)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
 	MovieTrackingTrack *track;
-	MovieTracking *tracking= &clip->tracking;
-	ListBase *tracksbase= BKE_tracking_get_tracks(tracking);
-	MovieTrackingTrack *act_track= BKE_tracking_active_track(tracking);
+	MovieTracking *tracking = &clip->tracking;
+	ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
+	MovieTrackingTrack *act_track = BKE_tracking_active_track(tracking);
 	int unselected;
 
-	unselected= RNA_boolean_get(op->ptr, "unselected");
+	unselected = RNA_boolean_get(op->ptr, "unselected");
 
-	track= tracksbase->first;
-	while(track) {
-		if(unselected==0 && TRACK_VIEW_SELECTED(sc, track)) {
-			track->flag|= TRACK_HIDDEN;
-		} else if(unselected==1 && !TRACK_VIEW_SELECTED(sc, track)) {
-			track->flag|= TRACK_HIDDEN;
+	track = tracksbase->first;
+	while (track) {
+		if (unselected == 0 && TRACK_VIEW_SELECTED(sc, track)) {
+			track->flag |= TRACK_HIDDEN;
+		}
+		else if (unselected == 1 && !TRACK_VIEW_SELECTED(sc, track)) {
+			track->flag |= TRACK_HIDDEN;
 		}
 
-		track= track->next;
+		track = track->next;
 	}
 
-	if(act_track && act_track->flag&TRACK_HIDDEN)
-		clip->tracking.act_track= NULL;
+	if (act_track && act_track->flag & TRACK_HIDDEN)
+		clip->tracking.act_track = NULL;
 
-	if(unselected==0) {
+	if (unselected == 0) {
 		/* no selection on screen now, unlock view so it can be scrolled nice again */
-		sc->flag&= ~SC_LOCK_SELECTION;
+		sc->flag &= ~SC_LOCK_SELECTION;
 	}
 
 	WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, NULL);
@@ -2681,16 +2752,16 @@ static int hide_tracks_exec(bContext *C, wmOperator *op)
 void CLIP_OT_hide_tracks(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Hide Tracks";
-	ot->description= "Hide selected tracks";
-	ot->idname= "CLIP_OT_hide_tracks";
+	ot->name = "Hide Tracks";
+	ot->description = "Hide selected tracks";
+	ot->idname = "CLIP_OT_hide_tracks";
 
 	/* api callbacks */
-	ot->exec= hide_tracks_exec;
-	ot->poll= ED_space_clip_poll;
+	ot->exec = hide_tracks_exec;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected tracks");
@@ -2700,16 +2771,16 @@ void CLIP_OT_hide_tracks(wmOperatorType *ot)
 
 static int hide_tracks_clear_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	ListBase *tracksbase= BKE_tracking_get_tracks(&clip->tracking);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
 	MovieTrackingTrack *track;
 
-	track= tracksbase->first;
-	while(track) {
-		track->flag&= ~TRACK_HIDDEN;
+	track = tracksbase->first;
+	while (track) {
+		track->flag &= ~TRACK_HIDDEN;
 
-		track= track->next;
+		track = track->next;
 	}
 
 	WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, NULL);
@@ -2720,16 +2791,16 @@ static int hide_tracks_clear_exec(bContext *C, wmOperator *UNUSED(op))
 void CLIP_OT_hide_tracks_clear(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Hide Tracks Clear";
-	ot->description= "Clear hide selected tracks";
-	ot->idname= "CLIP_OT_hide_tracks_clear";
+	ot->name = "Hide Tracks Clear";
+	ot->description = "Clear hide selected tracks";
+	ot->idname = "CLIP_OT_hide_tracks_clear";
 
 	/* api callbacks */
-	ot->exec= hide_tracks_clear_exec;
-	ot->poll= ED_space_clip_poll;
+	ot->exec = hide_tracks_clear_exec;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************** detect features operator *********************/
@@ -2738,15 +2809,15 @@ static bGPDlayer *detect_get_layer(MovieClip *clip)
 {
 	bGPDlayer *layer;
 
-	if(!clip->gpd)
+	if (!clip->gpd)
 		return NULL;
 
-	layer= clip->gpd->layers.first;
-	while(layer) {
-		if(layer->flag&GP_LAYER_ACTIVE)
+	layer = clip->gpd->layers.first;
+	while (layer) {
+		if (layer->flag & GP_LAYER_ACTIVE)
 			return layer;
 
-		layer= layer->next;
+		layer = layer->next;
 	}
 
 	return NULL;
@@ -2754,32 +2825,32 @@ static bGPDlayer *detect_get_layer(MovieClip *clip)
 
 static int detect_features_exec(bContext *C, wmOperator *op)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	int clip_flag= clip->flag&MCLIP_TIMECODE_FLAGS;
-	ImBuf *ibuf= BKE_movieclip_get_ibuf_flag(clip, &sc->user, clip_flag, MOVIECLIP_CACHE_SKIP);
-	MovieTracking *tracking= &clip->tracking;
-	ListBase *tracksbase= BKE_tracking_get_tracks(tracking);
-	MovieTrackingTrack *track= tracksbase->first;
-	int placement= RNA_enum_get(op->ptr, "placement");
-	int margin= RNA_int_get(op->ptr, "margin");
-	int min_trackability= RNA_int_get(op->ptr, "min_trackability");
-	int min_distance= RNA_int_get(op->ptr, "min_distance");
-	int place_outside_layer= 0;
-	bGPDlayer *layer= NULL;
-
-	if(placement!=0) {
-		layer= detect_get_layer(clip);
-		place_outside_layer= placement==2;
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	int clip_flag = clip->flag & MCLIP_TIMECODE_FLAGS;
+	ImBuf *ibuf = BKE_movieclip_get_ibuf_flag(clip, &sc->user, clip_flag, MOVIECLIP_CACHE_SKIP);
+	MovieTracking *tracking = &clip->tracking;
+	ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
+	MovieTrackingTrack *track = tracksbase->first;
+	int placement = RNA_enum_get(op->ptr, "placement");
+	int margin = RNA_int_get(op->ptr, "margin");
+	int min_trackability = RNA_int_get(op->ptr, "min_trackability");
+	int min_distance = RNA_int_get(op->ptr, "min_distance");
+	int place_outside_layer = 0;
+	bGPDlayer *layer = NULL;
+
+	if (placement != 0) {
+		layer = detect_get_layer(clip);
+		place_outside_layer = placement == 2;
 	}
 
 	/* deselect existing tracks */
-	while(track) {
-		track->flag&= ~SELECT;
-		track->pat_flag&= ~SELECT;
-		track->search_flag&= ~SELECT;
+	while (track) {
+		track->flag &= ~SELECT;
+		track->pat_flag &= ~SELECT;
+		track->search_flag &= ~SELECT;
 
-		track= track->next;
+		track = track->next;
 	}
 
 	BKE_tracking_detect_fast(tracking, tracksbase, ibuf, sc->user.framenr, margin,
@@ -2802,16 +2873,16 @@ void CLIP_OT_detect_features(wmOperatorType *ot)
 	};
 
 	/* identifiers */
-	ot->name= "Detect Features";
-	ot->description= "Automatically detect features and place markers to track";
-	ot->idname= "CLIP_OT_detect_features";
+	ot->name = "Detect Features";
+	ot->description = "Automatically detect features and place markers to track";
+	ot->idname = "CLIP_OT_detect_features";
 
 	/* api callbacks */
-	ot->exec= detect_features_exec;
-	ot->poll= space_clip_frame_poll;
+	ot->exec = detect_features_exec;
+	ot->poll = space_clip_frame_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "placement", placement_items, 0, "Placement", "Placement for detected features");
@@ -2824,58 +2895,58 @@ void CLIP_OT_detect_features(wmOperatorType *ot)
 
 static int frame_jump_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
+	Scene *scene = CTX_data_scene(C);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
 	MovieTrackingTrack *track;
-	int pos= RNA_enum_get(op->ptr, "position");
+	int pos = RNA_enum_get(op->ptr, "position");
 	int delta;
 
-	if(pos<=1) {	/* jump to path */
-		track= BKE_tracking_active_track(&clip->tracking);
+	if (pos <= 1) {	/* jump to path */
+		track = BKE_tracking_active_track(&clip->tracking);
 
-		if(!track)
+		if (!track)
 			return OPERATOR_CANCELLED;
 
-		delta= pos == 1 ? 1 : -1;
+		delta = pos == 1 ? 1 : -1;
 
-		while(sc->user.framenr+delta >= SFRA && sc->user.framenr+delta <= EFRA) {
-			MovieTrackingMarker *marker= BKE_tracking_exact_marker(track, sc->user.framenr+delta);
+		while (sc->user.framenr+delta >= SFRA && sc->user.framenr+delta <= EFRA) {
+			MovieTrackingMarker *marker = BKE_tracking_exact_marker(track, sc->user.framenr+delta);
 
-			if(!marker || marker->flag&MARKER_DISABLED)
+			if (!marker || marker->flag & MARKER_DISABLED)
 				break;
 
-			sc->user.framenr+= delta;
+			sc->user.framenr += delta;
 		}
 	}
 	else {	/* to to failed frame */
-		if(clip->tracking.reconstruction.flag&TRACKING_RECONSTRUCTED) {
-			int a= sc->user.framenr;
-			MovieTracking *tracking= &clip->tracking;
-			MovieTrackingObject *object= BKE_tracking_active_object(tracking);
+		if (clip->tracking.reconstruction.flag & TRACKING_RECONSTRUCTED) {
+			int a = sc->user.framenr;
+			MovieTracking *tracking = &clip->tracking;
+			MovieTrackingObject *object = BKE_tracking_active_object(tracking);
 
-			delta= pos == 3 ? 1 : -1;
+			delta = pos == 3 ? 1 : -1;
 
-			a+= delta;
+			a += delta;
 
-			while(a+delta >= SFRA && a+delta <= EFRA) {
+			while (a+delta >= SFRA && a+delta <= EFRA) {
 				MovieReconstructedCamera *cam;
 
-				cam= BKE_tracking_get_reconstructed_camera(tracking, object, a);
+				cam = BKE_tracking_get_reconstructed_camera(tracking, object, a);
 
-				if(!cam) {
-					sc->user.framenr= a;
+				if (!cam) {
+					sc->user.framenr = a;
 
 					break;
 				}
 
-				a+= delta;
+				a += delta;
 			}
 		}
 	}
 
-	if(CFRA!=sc->user.framenr) {
-		CFRA= sc->user.framenr;
+	if (CFRA != sc->user.framenr) {
+		CFRA = sc->user.framenr;
 		sound_seek_scene(CTX_data_main(C), CTX_data_scene(C));
 
 		WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
@@ -2897,62 +2968,53 @@ void CLIP_OT_frame_jump(wmOperatorType *ot)
 	};
 
 	/* identifiers */
-	ot->name= "Jump to Frame";
-	ot->description= "Jump to special frame";
-	ot->idname= "CLIP_OT_frame_jump";
+	ot->name = "Jump to Frame";
+	ot->description = "Jump to special frame";
+	ot->idname = "CLIP_OT_frame_jump";
 
 	/* api callbacks */
-	ot->exec= frame_jump_exec;
-	ot->poll= space_clip_frame_poll;
+	ot->exec = frame_jump_exec;
+	ot->poll = space_clip_frame_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
-	RNA_def_enum(ot->srna, "position", position_items, 0, "Position", "Position to jumo to");
+	RNA_def_enum(ot->srna, "position", position_items, 0, "Position", "Position to jump to");
 }
 
 /********************** join tracks operator *********************/
 
 static int join_tracks_exec(bContext *C, wmOperator *op)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
-	ListBase *tracksbase= BKE_tracking_get_tracks(tracking);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
 	MovieTrackingTrack *act_track, *track, *next;
 
-	act_track= BKE_tracking_active_track(tracking);
+	act_track = BKE_tracking_active_track(tracking);
 
-	if(!act_track) {
+	if (!act_track) {
 		BKE_report(op->reports, RPT_ERROR, "No active track to join to");
 		return OPERATOR_CANCELLED;
 	}
 
-	track= tracksbase->first;
-	while(track) {
-		if(TRACK_VIEW_SELECTED(sc, track) && track!=act_track) {
-			if(!BKE_tracking_test_join_tracks(act_track, track)) {
-				BKE_report(op->reports, RPT_ERROR, "Some selected tracks have got keyframed markers to the same frame");
-				return OPERATOR_CANCELLED;
-			}
-		}
+	track = tracksbase->first;
+	while (track) {
+		next = track->next;
 
-		track= track->next;
-	}
-
-	track= tracksbase->first;
-	while(track) {
-		next= track->next;
-
-		if(TRACK_VIEW_SELECTED(sc, track) && track!=act_track) {
+		if (TRACK_VIEW_SELECTED(sc, track) && track != act_track) {
 			BKE_tracking_join_tracks(act_track, track);
 
+			if (tracking->stabilization.rot_track == track)
+				tracking->stabilization.rot_track = act_track;
+
 			BKE_tracking_free_track(track);
 			BLI_freelinkN(tracksbase, track);
 		}
 
-		track= next;
+		track = next;
 	}
 
 	WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip);
@@ -2963,37 +3025,39 @@ static int join_tracks_exec(bContext *C, wmOperator *op)
 void CLIP_OT_join_tracks(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Join Tracks";
-	ot->description= "Join selected tracks";
-	ot->idname= "CLIP_OT_join_tracks";
+	ot->name = "Join Tracks";
+	ot->description = "Join selected tracks";
+	ot->idname = "CLIP_OT_join_tracks";
 
 	/* api callbacks */
-	ot->exec= join_tracks_exec;
-	ot->poll= space_clip_frame_poll;
+	ot->exec = join_tracks_exec;
+	ot->poll = space_clip_frame_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************** lock tracks operator *********************/
 
 static int lock_tracks_exec(bContext *C, wmOperator *op)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
-	ListBase *tracksbase= BKE_tracking_get_tracks(tracking);
-	MovieTrackingTrack *track= tracksbase->first;
-	int action= RNA_enum_get(op->ptr, "action");
-
-	while(track) {
-		if(TRACK_VIEW_SELECTED(sc, track)) {
-			if(action==0) track->flag|= TRACK_LOCKED;
-			else if(action==1) track->flag&= ~TRACK_LOCKED;
-			else track->flag^= TRACK_LOCKED;
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
+	MovieTrackingTrack *track = tracksbase->first;
+	int action = RNA_enum_get(op->ptr, "action");
+
+	while (track) {
+		if (TRACK_VIEW_SELECTED(sc, track)) {
+			if (action == 0)
+				track->flag |= TRACK_LOCKED;
+			else if (action == 1)
+				track->flag &= ~TRACK_LOCKED;
+			else track->flag ^= TRACK_LOCKED;
 		}
 
-		track= track->next;
+		track = track->next;
 	}
 
 	WM_event_add_notifier(C, NC_MOVIECLIP|NA_EVALUATED, clip);
@@ -3011,16 +3075,16 @@ void CLIP_OT_lock_tracks(wmOperatorType *ot)
 	};
 
 	/* identifiers */
-	ot->name= "Lock Tracks";
-	ot->description= "Lock/unlock selected tracks";
-	ot->idname= "CLIP_OT_lock_tracks";
+	ot->name = "Lock Tracks";
+	ot->description = "Lock/unlock selected tracks";
+	ot->idname = "CLIP_OT_lock_tracks";
 
 	/* api callbacks */
-	ot->exec= lock_tracks_exec;
-	ot->poll= ED_space_clip_poll;
+	ot->exec = lock_tracks_exec;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "action", actions_items, 0, "Action", "Lock action to execute");
@@ -3030,27 +3094,27 @@ void CLIP_OT_lock_tracks(wmOperatorType *ot)
 
 static int track_copy_color_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
-	ListBase *tracksbase= BKE_tracking_get_tracks(tracking);
-	MovieTrackingTrack *track, *act_track= BKE_tracking_active_track(tracking);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
+	MovieTrackingTrack *track, *act_track = BKE_tracking_active_track(tracking);
 
-	if(!act_track)
+	if (!act_track)
 		return OPERATOR_CANCELLED;
 
-	track= tracksbase->first;
-	while(track) {
-		if(TRACK_VIEW_SELECTED(sc, track) && track!=act_track) {
-			track->flag&= ~TRACK_CUSTOMCOLOR;
+	track = tracksbase->first;
+	while (track) {
+		if (TRACK_VIEW_SELECTED(sc, track) && track != act_track) {
+			track->flag &= ~TRACK_CUSTOMCOLOR;
 
-			if(act_track->flag&TRACK_CUSTOMCOLOR) {
+			if (act_track->flag & TRACK_CUSTOMCOLOR) {
 				copy_v3_v3(track->color, act_track->color);
-				track->flag|= TRACK_CUSTOMCOLOR;
+				track->flag |= TRACK_CUSTOMCOLOR;
 			}
 		}
 
-		track= track->next;
+		track = track->next;
 	}
 
 	WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, clip);
@@ -3061,44 +3125,44 @@ static int track_copy_color_exec(bContext *C, wmOperator *UNUSED(op))
 void CLIP_OT_track_copy_color(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Copy Color";
-	ot->description= "Copy color to all selected tracks";
-	ot->idname= "CLIP_OT_track_copy_color";
+	ot->name = "Copy Color";
+	ot->description = "Copy color to all selected tracks";
+	ot->idname = "CLIP_OT_track_copy_color";
 
 	/* api callbacks */
-	ot->exec= track_copy_color_exec;
-	ot->poll= ED_space_clip_poll;
+	ot->exec = track_copy_color_exec;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************** add 2d stabilization tracks operator *********************/
 
 static int stabilize_2d_add_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
-	ListBase *tracksbase= BKE_tracking_get_tracks(tracking);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
 	MovieTrackingTrack *track;
-	MovieTrackingStabilization *stab= &tracking->stabilization;
-	int update= 0;
+	MovieTrackingStabilization *stab = &tracking->stabilization;
+	int update = 0;
 
-	track= tracksbase->first;
-	while(track) {
-		if(TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_USE_2D_STAB)==0) {
-			track->flag|= TRACK_USE_2D_STAB;
+	track = tracksbase->first;
+	while (track) {
+		if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_USE_2D_STAB)==0) {
+			track->flag |= TRACK_USE_2D_STAB;
 			stab->tot_track++;
 
-			update= 1;
+			update = 1;
 		}
 
-		track= track->next;
+		track = track->next;
 	}
 
-	if(update) {
-		stab->ok= 0;
+	if (update) {
+		stab->ok = 0;
 
 		DAG_id_tag_update(&clip->id, 0);
 		WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, clip);
@@ -3110,43 +3174,43 @@ static int stabilize_2d_add_exec(bContext *C, wmOperator *UNUSED(op))
 void CLIP_OT_stabilize_2d_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Stabilization Tracks";
-	ot->description= "Add selected tracks to 2D stabilization tool";
-	ot->idname= "CLIP_OT_stabilize_2d_add";
+	ot->name = "Add Stabilization Tracks";
+	ot->description = "Add selected tracks to 2D stabilization tool";
+	ot->idname = "CLIP_OT_stabilize_2d_add";
 
 	/* api callbacks */
-	ot->exec= stabilize_2d_add_exec;
-	ot->poll= ED_space_clip_poll;
+	ot->exec = stabilize_2d_add_exec;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************** remove 2d stabilization tracks operator *********************/
 
 static int stabilize_2d_remove_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
-	MovieTrackingStabilization *stab= &tracking->stabilization;
-	ListBase *tracksbase= BKE_tracking_get_tracks(tracking);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	MovieTrackingStabilization *stab = &tracking->stabilization;
+	ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
 	MovieTrackingTrack *track;
-	int a= 0, update= 0;
+	int a = 0, update = 0;
 
-	track= tracksbase->first;
-	while(track) {
-		if(track->flag&TRACK_USE_2D_STAB) {
-			if(a==stab->act_track) {
-				track->flag&= ~TRACK_USE_2D_STAB;
+	track = tracksbase->first;
+	while (track) {
+		if (track->flag & TRACK_USE_2D_STAB) {
+			if (a == stab->act_track) {
+				track->flag &= ~TRACK_USE_2D_STAB;
 
 				stab->act_track--;
 				stab->tot_track--;
 
-				if(stab->act_track<0)
-					stab->act_track= 0;
+				if (stab->act_track<0)
+					stab->act_track = 0;
 
-				update= 1;
+				update = 1;
 
 				break;
 			}
@@ -3154,11 +3218,11 @@ static int stabilize_2d_remove_exec(bContext *C, wmOperator *UNUSED(op))
 			a++;
 		}
 
-		track= track->next;
+		track = track->next;
 	}
 
-	if(update) {
-		stab->ok= 0;
+	if (update) {
+		stab->ok = 0;
 
 		DAG_id_tag_update(&clip->id, 0);
 		WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, clip);
@@ -3170,41 +3234,41 @@ static int stabilize_2d_remove_exec(bContext *C, wmOperator *UNUSED(op))
 void CLIP_OT_stabilize_2d_remove(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove Stabilization Track";
-	ot->description= "Remove selected track from stabilization";
-	ot->idname= "CLIP_OT_stabilize_2d_remove";
+	ot->name = "Remove Stabilization Track";
+	ot->description = "Remove selected track from stabilization";
+	ot->idname = "CLIP_OT_stabilize_2d_remove";
 
 	/* api callbacks */
-	ot->exec= stabilize_2d_remove_exec;
-	ot->poll= ED_space_clip_poll;
+	ot->exec = stabilize_2d_remove_exec;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************** select 2d stabilization tracks operator *********************/
 
 static int stabilize_2d_select_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
-	ListBase *tracksbase= BKE_tracking_get_tracks(tracking);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
 	MovieTrackingTrack *track;
-	int update= 0;
+	int update = 0;
 
-	track= tracksbase->first;
-	while(track) {
-		if(track->flag&TRACK_USE_2D_STAB) {
+	track = tracksbase->first;
+	while (track) {
+		if (track->flag & TRACK_USE_2D_STAB) {
 			BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, 0);
 
-			update= 1;
+			update = 1;
 		}
 
-		track= track->next;
+		track = track->next;
 	}
 
-	if(update)
+	if (update)
 		WM_event_add_notifier(C, NC_MOVIECLIP|ND_SELECT, clip);
 
 	return OPERATOR_FINISHED;
@@ -3213,32 +3277,32 @@ static int stabilize_2d_select_exec(bContext *C, wmOperator *UNUSED(op))
 void CLIP_OT_stabilize_2d_select(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Stabilization Tracks";
-	ot->description= "Select track which are used for stabilization";
-	ot->idname= "CLIP_OT_stabilize_2d_select";
+	ot->name = "Select Stabilization Tracks";
+	ot->description = "Select track which are used for stabilization";
+	ot->idname = "CLIP_OT_stabilize_2d_select";
 
 	/* api callbacks */
-	ot->exec= stabilize_2d_select_exec;
-	ot->poll= ED_space_clip_poll;
+	ot->exec = stabilize_2d_select_exec;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************** set 2d stabilization rotation track operator *********************/
 
 static int stabilize_2d_set_rotation_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
-	MovieTrackingTrack *act_track= BKE_tracking_active_track(tracking);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	MovieTrackingTrack *act_track = BKE_tracking_active_track(tracking);
 
-	if(act_track) {
-		MovieTrackingStabilization *stab= &tracking->stabilization;
+	if (act_track) {
+		MovieTrackingStabilization *stab = &tracking->stabilization;
 
-		stab->rot_track= act_track;
-		stab->ok= 0;
+		stab->rot_track = act_track;
+		stab->ok = 0;
 
 		DAG_id_tag_update(&clip->id, 0);
 		WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, clip);
@@ -3250,108 +3314,108 @@ static int stabilize_2d_set_rotation_exec(bContext *C, wmOperator *UNUSED(op))
 void CLIP_OT_stabilize_2d_set_rotation(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Rotation Track";
-	ot->description= "Use active track to compensate rotation when doing 2D stabilization";
-	ot->idname= "CLIP_OT_stabilize_2d_set_rotation";
+	ot->name = "Set Rotation Track";
+	ot->description = "Use active track to compensate rotation when doing 2D stabilization";
+	ot->idname = "CLIP_OT_stabilize_2d_set_rotation";
 
 	/* api callbacks */
-	ot->exec= stabilize_2d_set_rotation_exec;
-	ot->poll= ED_space_clip_poll;
+	ot->exec = stabilize_2d_set_rotation_exec;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************** clean tracks operator *********************/
 
 static int is_track_clean(MovieTrackingTrack *track, int frames, int del)
 {
-	int ok= 1, a, prev= -1, count= 0;
-	MovieTrackingMarker *markers= track->markers, *new_markers= NULL;
-	int start_disabled= 0;
-	int markersnr= track->markersnr;
+	int ok = 1, a, prev = -1, count = 0;
+	MovieTrackingMarker *markers = track->markers, *new_markers = NULL;
+	int start_disabled = 0;
+	int markersnr = track->markersnr;
 
-	if(del)
-		new_markers= MEM_callocN(markersnr*sizeof(MovieTrackingMarker), "track cleaned markers");
+	if (del)
+		new_markers = MEM_callocN(markersnr*sizeof(MovieTrackingMarker), "track cleaned markers");
 
-	for(a= 0; a<markersnr; a++) {
-		int end= 0;
+	for (a = 0; a<markersnr; a++) {
+		int end = 0;
 
-		if(prev==-1) {
-			if((markers[a].flag&MARKER_DISABLED)==0)
-				prev= a;
+		if (prev == -1) {
+			if ((markers[a].flag & MARKER_DISABLED)==0)
+				prev = a;
 			else
-				start_disabled= 1;
+				start_disabled = 1;
 		}
 
-		if(prev >= 0) {
-			end=  a == markersnr-1;
-			end|= (a < markersnr-1) && (markers[a].framenr != markers[a+1].framenr-1 ||
-			                            markers[a].flag&MARKER_DISABLED);
+		if (prev >= 0) {
+			end =  a == markersnr-1;
+			end |= (a < markersnr-1) && (markers[a].framenr != markers[a+1].framenr-1 ||
+			                             markers[a].flag & MARKER_DISABLED);
 		}
 
-		if(end) {
-			int segok= 1, len= 0;
+		if (end) {
+			int segok = 1, len = 0;
 
-			if(a != prev && markers[a].framenr != markers[a-1].framenr+1)
-				len= a-prev;
-			else if(markers[a].flag&MARKER_DISABLED)
-				len= a-prev;
-			else len= a-prev+1;
+			if (a != prev && markers[a].framenr != markers[a-1].framenr+1)
+				len = a-prev;
+			else if (markers[a].flag & MARKER_DISABLED)
+				len = a-prev;
+			else len = a-prev+1;
 
-			if(frames) {
-				if(len < frames) {
-					segok= 0;
-					ok= 0;
+			if (frames) {
+				if (len < frames) {
+					segok = 0;
+					ok = 0;
 
-					if(!del)
+					if (!del)
 						break;
 				}
 			}
 
-			if(del) {
-				if(segok) {
-					int t= len;
+			if (del) {
+				if (segok) {
+					int t = len;
 
-					if(markers[a].flag&MARKER_DISABLED)
+					if (markers[a].flag & MARKER_DISABLED)
 						t++;
 
 					/* place disabled marker in front of current segment */
-					if(start_disabled) {
+					if (start_disabled) {
 						memcpy(new_markers+count, markers+prev, sizeof(MovieTrackingMarker));
 						new_markers[count].framenr--;
-						new_markers[count].flag|= MARKER_DISABLED;
+						new_markers[count].flag |= MARKER_DISABLED;
 
 						count++;
-						start_disabled= 0;
+						start_disabled = 0;
 					}
 
 					memcpy(new_markers+count, markers+prev, t*sizeof(MovieTrackingMarker));
-					count+= t;
+					count += t;
 				}
-				else if(markers[a].flag&MARKER_DISABLED) {
+				else if (markers[a].flag & MARKER_DISABLED) {
 					/* current segment which would be deleted was finished by disabled marker,
-					   so next segment should be started from disabled marker */
-					start_disabled= 1;
+					 * so next segment should be started from disabled marker */
+					start_disabled = 1;
 				}
 			}
 
-			prev= -1;
+			prev = -1;
 		}
 	}
 
-	if(del) {
+	if (del) {
 		MEM_freeN(track->markers);
 
-		if(count) {
-			track->markers= new_markers;
+		if (count) {
+			track->markers = new_markers;
 		}
 		else {
-			track->markers= NULL;
+			track->markers = NULL;
 			MEM_freeN(new_markers);
 		}
 
-		track->markersnr= count;
+		track->markersnr = count;
 	}
 
 	return ok;
@@ -3359,45 +3423,45 @@ static int is_track_clean(MovieTrackingTrack *track, int frames, int del)
 
 static int clean_tracks_exec(bContext *C, wmOperator *op)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
-	ListBase *tracksbase= BKE_tracking_get_tracks(tracking);
-	MovieTrackingTrack *track, *next, *act_track= BKE_tracking_active_track(tracking);
-	int frames= RNA_int_get(op->ptr, "frames");
-	int action= RNA_enum_get(op->ptr, "action");
-	float error= RNA_float_get(op->ptr, "error");
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
+	ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
+	MovieTrackingTrack *track, *next, *act_track = BKE_tracking_active_track(tracking);
+	int frames = RNA_int_get(op->ptr, "frames");
+	int action = RNA_enum_get(op->ptr, "action");
+	float error = RNA_float_get(op->ptr, "error");
 
-	if(error && action==TRACKING_CLEAN_DELETE_SEGMENT)
-		action= TRACKING_CLEAN_DELETE_TRACK;
+	if (error && action == TRACKING_CLEAN_DELETE_SEGMENT)
+		action = TRACKING_CLEAN_DELETE_TRACK;
 
-	track= tracksbase->first;
-	while(track) {
-		next= track->next;
+	track = tracksbase->first;
+	while (track) {
+		next = track->next;
 
-		if((track->flag&TRACK_HIDDEN)==0 && (track->flag&TRACK_LOCKED)==0) {
-			int ok= 1;
+		if ((track->flag & TRACK_HIDDEN)==0 && (track->flag & TRACK_LOCKED)==0) {
+			int ok = 1;
 
-			ok= (is_track_clean(track, frames, action==TRACKING_CLEAN_DELETE_SEGMENT)) &&
-			    (error == 0.0f || (track->flag&TRACK_HAS_BUNDLE)==0  || track->error < error);
+			ok = (is_track_clean(track, frames, action == TRACKING_CLEAN_DELETE_SEGMENT)) &&
+			    (error == 0.0f || (track->flag & TRACK_HAS_BUNDLE)==0  || track->error < error);
 
-			if(!ok) {
-				if(action==TRACKING_CLEAN_SELECT) {
+			if (!ok) {
+				if (action == TRACKING_CLEAN_SELECT) {
 					BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, 0);
 				}
-				else if(action==TRACKING_CLEAN_DELETE_TRACK) {
-					if(track==act_track)
-						clip->tracking.act_track= NULL;
+				else if (action == TRACKING_CLEAN_DELETE_TRACK) {
+					if (track == act_track)
+						clip->tracking.act_track = NULL;
 
 					BKE_tracking_free_track(track);
 					BLI_freelinkN(tracksbase, track);
-					track= NULL;
+					track = NULL;
 				}
 
 				/* happens when all tracking segments are not long enough */
-				if(track && track->markersnr==0) {
-					if(track==act_track)
-						clip->tracking.act_track= NULL;
+				if (track && track->markersnr == 0) {
+					if (track == act_track)
+						clip->tracking.act_track = NULL;
 
 					BKE_tracking_free_track(track);
 					BLI_freelinkN(tracksbase, track);
@@ -3405,7 +3469,7 @@ static int clean_tracks_exec(bContext *C, wmOperator *op)
 			}
 		}
 
-		track= next;
+		track = next;
 	}
 
 	WM_event_add_notifier(C, NC_MOVIECLIP|ND_SELECT, clip);
@@ -3415,16 +3479,16 @@ static int clean_tracks_exec(bContext *C, wmOperator *op)
 
 static int clean_tracks_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
 
-	if(!RNA_struct_property_is_set(op->ptr, "frames"))
+	if (!RNA_struct_property_is_set(op->ptr, "frames"))
 		RNA_int_set(op->ptr, "frames", clip->tracking.settings.clean_frames);
 
-	if(!RNA_struct_property_is_set(op->ptr, "error"))
+	if (!RNA_struct_property_is_set(op->ptr, "error"))
 		RNA_float_set(op->ptr, "error", clip->tracking.settings.clean_error);
 
-	if(!RNA_struct_property_is_set(op->ptr, "action"))
+	if (!RNA_struct_property_is_set(op->ptr, "action"))
 		RNA_enum_set(op->ptr, "action", clip->tracking.settings.clean_action);
 
 	return clean_tracks_exec(C, op);
@@ -3440,21 +3504,23 @@ void CLIP_OT_clean_tracks(wmOperatorType *ot)
 	};
 
 	/* identifiers */
-	ot->name= "Clean Tracks";
-	ot->description= "Clean tracks with high error values or few frames";
-	ot->idname= "CLIP_OT_clean_tracks";
+	ot->name = "Clean Tracks";
+	ot->description = "Clean tracks with high error values or few frames";
+	ot->idname = "CLIP_OT_clean_tracks";
 
 	/* api callbacks */
-	ot->exec= clean_tracks_exec;
-	ot->invoke= clean_tracks_invoke;
-	ot->poll= ED_space_clip_poll;
+	ot->exec = clean_tracks_exec;
+	ot->invoke = clean_tracks_invoke;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
-	RNA_def_int(ot->srna, "frames", 0, 0, INT_MAX, "Tracked Frames", "Effect on tracks which are tracked less than specified amount of frames", 0, INT_MAX);
-	RNA_def_float(ot->srna, "error", 0.0f, 0.0f, FLT_MAX, "Reprojection Error", "Effect on tracks with have got larger reprojection error", 0.0f, 100.0f);
+	RNA_def_int(ot->srna, "frames", 0, 0, INT_MAX, "Tracked Frames",
+	            "Effect on tracks which are tracked less than specified amount of frames", 0, INT_MAX);
+	RNA_def_float(ot->srna, "error", 0.0f, 0.0f, FLT_MAX, "Reprojection Error",
+	              "Effect on tracks which have got larger re-projection error", 0.0f, 100.0f);
 	RNA_def_enum(ot->srna, "action", actions_items, 0, "Action", "Cleanup action to execute");
 }
 
@@ -3462,9 +3528,9 @@ void CLIP_OT_clean_tracks(wmOperatorType *ot)
 
 static int tracking_object_new_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
 
 	BKE_tracking_new_object(tracking, "Object");
 
@@ -3476,30 +3542,30 @@ static int tracking_object_new_exec(bContext *C, wmOperator *UNUSED(op))
 void CLIP_OT_tracking_object_new(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Tracking Object";
-	ot->description= "Add new object for tracking";
-	ot->idname= "CLIP_OT_tracking_object_new";
+	ot->name = "Add Tracking Object";
+	ot->description = "Add new object for tracking";
+	ot->idname = "CLIP_OT_tracking_object_new";
 
 	/* api callbacks */
-	ot->exec= tracking_object_new_exec;
-	ot->poll= ED_space_clip_poll;
+	ot->exec = tracking_object_new_exec;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************** remove tracking object *********************/
 
 static int tracking_object_remove_exec(bContext *C, wmOperator *op)
 {
-	SpaceClip *sc= CTX_wm_space_clip(C);
-	MovieClip *clip= ED_space_clip(sc);
-	MovieTracking *tracking= &clip->tracking;
+	SpaceClip *sc = CTX_wm_space_clip(C);
+	MovieClip *clip = ED_space_clip(sc);
+	MovieTracking *tracking = &clip->tracking;
 	MovieTrackingObject *object;
 
-	object= BKE_tracking_active_object(tracking);
+	object = BKE_tracking_active_object(tracking);
 
-	if(object->flag&TRACKING_OBJECT_CAMERA) {
+	if (object->flag & TRACKING_OBJECT_CAMERA) {
 		BKE_report(op->reports, RPT_WARNING, "Object used for camera tracking can't be deleted");
 		return OPERATOR_CANCELLED;
 	}
@@ -3514,16 +3580,16 @@ static int tracking_object_remove_exec(bContext *C, wmOperator *op)
 void CLIP_OT_tracking_object_remove(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Movie Tracking Object";
-	ot->description= "Remove object for tracking";
-	ot->idname= "CLIP_OT_tracking_object_remove";
+	ot->name = "Movie Tracking Object";
+	ot->description = "Remove object for tracking";
+	ot->idname = "CLIP_OT_tracking_object_remove";
 
 	/* api callbacks */
-	ot->exec= tracking_object_remove_exec;
-	ot->poll= ED_space_clip_poll;
+	ot->exec = tracking_object_remove_exec;
+	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /********************** copy tracks to clipboard operator *********************/
@@ -3554,7 +3620,7 @@ void CLIP_OT_copy_tracks(wmOperatorType *ot)
 	ot->poll = ED_space_clip_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER;
+	ot->flag = OPTYPE_REGISTER;
 }
 
 /********************** paste tracks from clipboard operator *********************/
@@ -3594,5 +3660,5 @@ void CLIP_OT_paste_tracks(wmOperatorType *ot)
 	ot->poll = paste_tracks_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c
index 4855121..2897c5d 100644
--- a/source/blender/editors/space_console/console_draw.c
+++ b/source/blender/editors/space_console/console_draw.c
@@ -59,19 +59,19 @@
 
 static void console_line_color(unsigned char fg[3], int type)
 {
-	switch(type) {
-	case CONSOLE_LINE_OUTPUT:
-		UI_GetThemeColor3ubv(TH_CONSOLE_OUTPUT, fg);
-		break;
-	case CONSOLE_LINE_INPUT:
-		UI_GetThemeColor3ubv(TH_CONSOLE_INPUT, fg);
-		break;
-	case CONSOLE_LINE_INFO:
-		UI_GetThemeColor3ubv(TH_CONSOLE_INFO, fg);
-		break;
-	case CONSOLE_LINE_ERROR:
-		UI_GetThemeColor3ubv(TH_CONSOLE_ERROR, fg);
-		break;
+	switch (type) {
+		case CONSOLE_LINE_OUTPUT:
+			UI_GetThemeColor3ubv(TH_CONSOLE_OUTPUT, fg);
+			break;
+		case CONSOLE_LINE_INPUT:
+			UI_GetThemeColor3ubv(TH_CONSOLE_INPUT, fg);
+			break;
+		case CONSOLE_LINE_INFO:
+			UI_GetThemeColor3ubv(TH_CONSOLE_INFO, fg);
+			break;
+		case CONSOLE_LINE_ERROR:
+			UI_GetThemeColor3ubv(TH_CONSOLE_ERROR, fg);
+			break;
 	}
 }
 
@@ -93,11 +93,11 @@ typedef struct ConsoleDrawContext {
 void console_scrollback_prompt_begin(struct SpaceConsole *sc, ConsoleLine *cl_dummy)
 {
 	/* fake the edit line being in the scroll buffer */
-	ConsoleLine *cl= sc->history.last;
-	cl_dummy->type= CONSOLE_LINE_INPUT;
-	cl_dummy->len= cl_dummy->len_alloc= strlen(sc->prompt) + cl->len;
-	cl_dummy->len_alloc= cl_dummy->len + 1;
-	cl_dummy->line= MEM_mallocN(cl_dummy->len_alloc, "cl_dummy");
+	ConsoleLine *cl = sc->history.last;
+	cl_dummy->type = CONSOLE_LINE_INPUT;
+	cl_dummy->len = cl_dummy->len_alloc = strlen(sc->prompt) + 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);
 	BLI_addtail(&sc->scrollback, cl_dummy);
@@ -116,73 +116,73 @@ void console_scrollback_prompt_end(struct SpaceConsole *sc, ConsoleLine *cl_dumm
 /* console textview callbacks */
 static int console_textview_begin(TextViewContext *tvc)
 {
-	SpaceConsole *sc= (SpaceConsole *)tvc->arg1;
-	tvc->lheight= sc->lheight;
-	tvc->sel_start= sc->sel_start;
-	tvc->sel_end= sc->sel_end;
+	SpaceConsole *sc = (SpaceConsole *)tvc->arg1;
+	tvc->lheight = sc->lheight;
+	tvc->sel_start = sc->sel_start;
+	tvc->sel_end = sc->sel_end;
 	
 	/* iterator */
-	tvc->iter= sc->scrollback.last;
+	tvc->iter = sc->scrollback.last;
 	
 	return (tvc->iter != NULL);
 }
 
 static void console_textview_end(TextViewContext *tvc)
 {
-	SpaceConsole *sc= (SpaceConsole *)tvc->arg1;
+	SpaceConsole *sc = (SpaceConsole *)tvc->arg1;
 	(void)sc;
 	
 }
 
 static int console_textview_step(TextViewContext *tvc)
 {
-	return ((tvc->iter= (void *)((Link *)tvc->iter)->prev) != NULL);
+	return ((tvc->iter = (void *)((Link *)tvc->iter)->prev) != NULL);
 }
 
 static int console_textview_line_get(struct TextViewContext *tvc, const char **line, int *len)
 {
-	ConsoleLine *cl= (ConsoleLine *)tvc->iter;
-	*line= cl->line;
-	*len= cl->len;
+	ConsoleLine *cl = (ConsoleLine *)tvc->iter;
+	*line = cl->line;
+	*len = cl->len;
 
 	return 1;
 }
 
 static int console_textview_line_color(struct TextViewContext *tvc, unsigned char fg[3], unsigned char UNUSED(bg[3]))
 {
-	ConsoleLine *cl_iter= (ConsoleLine *)tvc->iter;
+	ConsoleLine *cl_iter = (ConsoleLine *)tvc->iter;
 
 	/* annoying hack, to draw the prompt */
-	if(tvc->iter_index == 0) {
-		const SpaceConsole *sc= (SpaceConsole *)tvc->arg1;
-		const ConsoleLine *cl= (ConsoleLine *)sc->history.last;
-		const int prompt_len= strlen(sc->prompt);
-		const int cursor_loc= cl->cursor + prompt_len;
+	if (tvc->iter_index == 0) {
+		const SpaceConsole *sc = (SpaceConsole *)tvc->arg1;
+		const ConsoleLine *cl = (ConsoleLine *)sc->history.last;
+		const int prompt_len = strlen(sc->prompt);
+		const int cursor_loc = cl->cursor + prompt_len;
 		int xy[2] = {CONSOLE_DRAW_MARGIN, CONSOLE_DRAW_MARGIN};
 		int pen[2];
-		xy[1] += tvc->lheight/6;
+		xy[1] += tvc->lheight / 6;
 
 		/* account for wrapping */
-		if(cl->len < tvc->console_width) {
+		if (cl->len < tvc->console_width) {
 			/* simple case, no wrapping */
-			pen[0]= tvc->cwidth * cursor_loc;
-			pen[1]= -2;
+			pen[0] = tvc->cwidth * cursor_loc;
+			pen[1] = -2;
 		}
 		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[0] = tvc->cwidth * (cursor_loc % tvc->console_width);
+			pen[1] = -2 + (((cl->len / tvc->console_width) - (cursor_loc / tvc->console_width)) * tvc->lheight);
 		}
 
 		/* cursor */
 		UI_GetThemeColor3ubv(TH_CONSOLE_CURSOR, fg);
 		glColor3ubv(fg);
 
-		glRecti(	(xy[0] + pen[0]) - 1,
-					(xy[1] + pen[1]),
-					(xy[0] + pen[0]) + 1,
-					(xy[1] + pen[1] + tvc->lheight)
-		);
+		glRecti((xy[0] + pen[0]) - 1,
+		        (xy[1] + pen[1]),
+		        (xy[0] + pen[0]) + 1,
+		        (xy[1] + pen[1] + tvc->lheight)
+		        );
 	}
 
 	console_line_color(fg, cl_iter->type);
@@ -193,33 +193,33 @@ static int console_textview_line_color(struct TextViewContext *tvc, unsigned cha
 
 static int console_textview_main__internal(struct SpaceConsole *sc, struct ARegion *ar, int draw, int mval[2], void **mouse_pick, int *pos_pick)
 {
-	ConsoleLine cl_dummy= {NULL};
-	int ret= 0;
+	ConsoleLine cl_dummy = {NULL};
+	int ret = 0;
 	
-	View2D *v2d= &ar->v2d;
+	View2D *v2d = &ar->v2d;
 
-	TextViewContext tvc= {0};
+	TextViewContext tvc = {0};
 
-	tvc.begin= console_textview_begin;
-	tvc.end= console_textview_end;
+	tvc.begin = console_textview_begin;
+	tvc.end = console_textview_end;
 
-	tvc.step= console_textview_step;
-	tvc.line_get= console_textview_line_get;
-	tvc.line_color= console_textview_line_color;
+	tvc.step = console_textview_step;
+	tvc.line_get = console_textview_line_get;
+	tvc.line_color = console_textview_line_color;
 
-	tvc.arg1= sc;
-	tvc.arg2= NULL;
+	tvc.arg1 = sc;
+	tvc.arg2 = NULL;
 
 	/* view */
-	tvc.sel_start= sc->sel_start;
-	tvc.sel_end= sc->sel_end;
-	tvc.lheight= sc->lheight;
-	tvc.ymin= v2d->cur.ymin;
-	tvc.ymax= v2d->cur.ymax;
-	tvc.winx= ar->winx;
+	tvc.sel_start = sc->sel_start;
+	tvc.sel_end = sc->sel_end;
+	tvc.lheight = sc->lheight;
+	tvc.ymin = v2d->cur.ymin;
+	tvc.ymax = v2d->cur.ymax;
+	tvc.winx = ar->winx;
 
 	console_scrollback_prompt_begin(sc, &cl_dummy);
-	ret= textview_draw(&tvc, draw, mval, mouse_pick, pos_pick);
+	ret = textview_draw(&tvc, draw, mval, mouse_pick, pos_pick);
 	console_scrollback_prompt_end(sc, &cl_dummy);
 
 	return ret;
@@ -240,12 +240,12 @@ int console_textview_height(struct SpaceConsole *sc, struct ARegion *ar)
 
 int console_char_pick(struct SpaceConsole *sc, struct ARegion *ar, int mval[2])
 {
-	int pos_pick= 0;
-	void *mouse_pick= NULL;
+	int pos_pick = 0;
+	void *mouse_pick = NULL;
 	int mval_clamp[2];
 
-	mval_clamp[0]= CLAMPIS(mval[0], CONSOLE_DRAW_MARGIN, ar->winx-(CONSOLE_DRAW_SCROLL + CONSOLE_DRAW_MARGIN));
-	mval_clamp[1]= CLAMPIS(mval[1], CONSOLE_DRAW_MARGIN, ar->winy-CONSOLE_DRAW_MARGIN);
+	mval_clamp[0] = CLAMPIS(mval[0], CONSOLE_DRAW_MARGIN, ar->winx - (CONSOLE_DRAW_SCROLL + CONSOLE_DRAW_MARGIN));
+	mval_clamp[1] = CLAMPIS(mval[1], CONSOLE_DRAW_MARGIN, ar->winy - CONSOLE_DRAW_MARGIN);
 
 	console_textview_main__internal(sc, ar, 0, mval_clamp, &mouse_pick, &pos_pick);
 	return pos_pick;
diff --git a/source/blender/editors/space_console/console_intern.h b/source/blender/editors/space_console/console_intern.h
index 1c7aef0..33588cc 100644
--- a/source/blender/editors/space_console/console_intern.h
+++ b/source/blender/editors/space_console/console_intern.h
@@ -24,8 +24,8 @@
  *  \ingroup spconsole
  */
 
-#ifndef ED_CONSOLE_INTERN_H
-#define ED_CONSOLE_INTERN_H
+#ifndef __CONSOLE_INTERN_H__
+#define __CONSOLE_INTERN_H__
 
 /* internal exports only */
 
@@ -50,9 +50,6 @@ ConsoleLine *console_scrollback_add_str(struct SpaceConsole *sc, char *str, int
 
 ConsoleLine *console_history_verify(const struct bContext *C);
 
-int console_report_mask(SpaceConsole *sc);
-
-
 void CONSOLE_OT_move(struct wmOperatorType *ot);
 void CONSOLE_OT_delete(struct wmOperatorType *ot);
 void CONSOLE_OT_insert(struct wmOperatorType *ot);
@@ -67,6 +64,6 @@ void CONSOLE_OT_paste(struct wmOperatorType *ot);
 void CONSOLE_OT_select_set(struct wmOperatorType *ot);
 
 enum { LINE_BEGIN, LINE_END, PREV_CHAR, NEXT_CHAR, PREV_WORD, NEXT_WORD };
-enum { DEL_ALL, DEL_NEXT_CHAR, DEL_PREV_CHAR, DEL_SELECTION, DEL_NEXT_SEL, DEL_PREV_SEL };
+enum { DEL_ALL, DEL_NEXT_CHAR, DEL_PREV_CHAR, DEL_NEXT_WORD, DEL_PREV_WORD, DEL_SELECTION, DEL_NEXT_SEL, DEL_PREV_SEL };
 
-#endif /* ED_CONSOLE_INTERN_H */
+#endif /* __CONSOLE_INTERN_H__ */
diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c
index 9640701..ef036b0 100644
--- a/source/blender/editors/space_console/console_ops.c
+++ b/source/blender/editors/space_console/console_ops.c
@@ -34,7 +34,9 @@
 
 #include "DNA_userdef_types.h"
 
-#include "BLI_blenlib.h"
+#include "BLI_listbase.h"
+#include "BLI_string_cursor_utf8.h"
+#include "BLI_string.h"
 #include "BLI_dynstr.h"
 #include "BLI_utildefines.h"
 
@@ -55,16 +57,16 @@
 /* so when we type - the view scrolls to the bottom */
 static void console_scroll_bottom(ARegion *ar)
 {
-	View2D *v2d= &ar->v2d;
+	View2D *v2d = &ar->v2d;
 	v2d->cur.ymin = 0.0;
-	v2d->cur.ymax =(float)v2d->winy;
+	v2d->cur.ymax = (float)v2d->winy;
 }
 
 static void console_textview_update_rect(SpaceConsole *sc, ARegion *ar)
 {
-	View2D *v2d= &ar->v2d;
+	View2D *v2d = &ar->v2d;
 
-	UI_view2d_totRect_set(v2d, ar->winx-1, console_textview_height(sc, ar));
+	UI_view2d_totRect_set(v2d, ar->winx - 1, console_textview_height(sc, ar));
 }
 
 static void console_select_offset(SpaceConsole *sc, const int offset)
@@ -90,21 +92,21 @@ static void console_scrollback_limit(SpaceConsole *sc)
 {
 	int tot;
 	
-	if (U.scrollback < 32) U.scrollback= 256; // XXX - save in user defaults
+	if (U.scrollback < 32) U.scrollback = 256;  // XXX - save in user defaults
 	
-	for(tot= BLI_countlist(&sc->scrollback); tot > U.scrollback; tot--)
+	for (tot = BLI_countlist(&sc->scrollback); tot > U.scrollback; tot--)
 		console_scrollback_free(sc, sc->scrollback.first);
 }
 
-static ConsoleLine * console_history_find(SpaceConsole *sc, const char *str, ConsoleLine *cl_ignore)
+static ConsoleLine *console_history_find(SpaceConsole *sc, const char *str, ConsoleLine *cl_ignore)
 {
 	ConsoleLine *cl;
 
-	for(cl= sc->history.last; cl; cl= cl->prev) {
-		if (cl==cl_ignore)
+	for (cl = sc->history.last; cl; cl = cl->prev) {
+		if (cl == cl_ignore)
 			continue;
 
-		if(strcmp(str, cl->line)==0)
+		if (strcmp(str, cl->line) == 0)
 			return cl;
 	}
 
@@ -115,49 +117,26 @@ static ConsoleLine * console_history_find(SpaceConsole *sc, const char *str, Con
 static int console_line_cursor_set(ConsoleLine *cl, int cursor)
 {
 	int cursor_new;
+
+	if      (cursor < 0) cursor_new = 0;
+	else if (cursor > cl->len) cursor_new = cl->len;
+	else cursor_new = cursor;
 	
-	if(cursor < 0)				cursor_new= 0;
-	else if(cursor > cl->len)	cursor_new= cl->len;
-	else						cursor_new= cursor;
-	
-	if(cursor_new == cl->cursor)
-		return 0;
+	if (cursor_new == cl->cursor) {
+		return FALSE;
+	}
 	
-	cl->cursor= cursor_new;
-	return 1;
-}
-
-static char cursor_char(ConsoleLine *cl)
-{
-	/* assume cursor is clamped */
-	return cl->line[cl->cursor];
-}
-
-static char cursor_char_prev(ConsoleLine *cl)
-{
-	/* assume cursor is clamped */
-	if(cl->cursor <= 0)
-		return '\0';
-
-	return cl->line[cl->cursor-1];
+	cl->cursor = cursor_new;
+	return TRUE;
 }
 
 #if 0 // XXX unused 
-static char cursor_char_next(ConsoleLine *cl)
-{
-	/* assume cursor is clamped */
-	if(cl->cursor + 1 >= cl->len)
-		return '\0';
-
-	return cl->line[cl->cursor+1];
-}
-
 static void console_lb_debug__internal(ListBase *lb)
 {
 	ConsoleLine *cl;
 
 	printf("%d: ", BLI_countlist(lb));
-	for(cl= lb->first; cl; cl= cl->next)
+	for (cl = lb->first; cl; cl = cl->next)
 		printf("<%s> ", cl->line);
 	printf("\n");
 
@@ -165,7 +144,7 @@ static void console_lb_debug__internal(ListBase *lb)
 
 static void console_history_debug(const bContext *C)
 {
-	SpaceConsole *sc= CTX_wm_space_console(C);
+	SpaceConsole *sc = CTX_wm_space_console(C);
 
 	
 	console_lb_debug__internal(&sc->history);
@@ -174,19 +153,20 @@ static void console_history_debug(const bContext *C)
 
 static ConsoleLine *console_lb_add__internal(ListBase *lb, ConsoleLine *from)
 {
-	ConsoleLine *ci= MEM_callocN(sizeof(ConsoleLine), "ConsoleLine Add");
+	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;
+	if (from) {
+		ci->line = BLI_strdup(from->line);
+		ci->len = strlen(ci->line);
+		ci->len_alloc = ci->len;
 		
-		ci->cursor= from->cursor;
-		ci->type= from->type;
-	} else {
-		ci->line= MEM_callocN(64, "console-in-line");
-		ci->len_alloc= 64;
-		ci->len= 0;
+		ci->cursor = from->cursor;
+		ci->type = from->type;
+	}
+	else {
+		ci->line = MEM_callocN(64, "console-in-line");
+		ci->len_alloc = 64;
+		ci->len = 0;
 	}
 	
 	BLI_addtail(lb, ci);
@@ -195,7 +175,7 @@ static ConsoleLine *console_lb_add__internal(ListBase *lb, ConsoleLine *from)
 
 static ConsoleLine *console_history_add(const bContext *C, ConsoleLine *from)
 {
-	SpaceConsole *sc= CTX_wm_space_console(C);
+	SpaceConsole *sc = CTX_wm_space_console(C);
 	
 	return console_lb_add__internal(&sc->history, from);
 }
@@ -203,7 +183,7 @@ static ConsoleLine *console_history_add(const bContext *C, ConsoleLine *from)
 #if 0 /* may use later ? */
 static ConsoleLine *console_scrollback_add(const bContext *C, ConsoleLine *from)
 {
-	SpaceConsole *sc= CTX_wm_space_console(C);
+	SpaceConsole *sc = CTX_wm_space_console(C);
 	
 	return console_lb_add__internal(&sc->scrollback, from);
 }
@@ -211,9 +191,9 @@ static ConsoleLine *console_scrollback_add(const bContext *C, ConsoleLine *from)
 
 static ConsoleLine *console_lb_add_str__internal(ListBase *lb, char *str, int own)
 {
-	ConsoleLine *ci= MEM_callocN(sizeof(ConsoleLine), "ConsoleLine Add");
-	if(own)		ci->line= str;
-	else		ci->line= BLI_strdup(str);
+	ConsoleLine *ci = MEM_callocN(sizeof(ConsoleLine), "ConsoleLine Add");
+	if (own) ci->line = str;
+	else ci->line = BLI_strdup(str);
 	
 	ci->len = ci->len_alloc = strlen(str);
 	
@@ -226,17 +206,17 @@ ConsoleLine *console_history_add_str(SpaceConsole *sc, char *str, int own)
 }
 ConsoleLine *console_scrollback_add_str(SpaceConsole *sc, char *str, int own)
 {
-	ConsoleLine *ci= console_lb_add_str__internal(&sc->scrollback, str, own);
+	ConsoleLine *ci = console_lb_add_str__internal(&sc->scrollback, str, own);
 	console_select_offset(sc, ci->len + 1);
 	return ci;
 }
 
 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);
+	SpaceConsole *sc = CTX_wm_space_console(C);
+	ConsoleLine *ci = sc->history.last;
+	if (ci == NULL)
+		ci = console_history_add(C, NULL);
 	
 	return ci;
 }
@@ -245,14 +225,14 @@ ConsoleLine *console_history_verify(const bContext *C)
 static void console_line_verify_length(ConsoleLine *ci, int len)
 {
 	/* resize the buffer if needed */
-	if(len >= ci->len_alloc) {
-		int new_len= len * 2; /* new length */
-		char *new_line= MEM_callocN(new_len, "console line");
+	if (len >= ci->len_alloc) {
+		int new_len = len * 2; /* new length */
+		char *new_line = MEM_callocN(new_len, "console line");
 		memcpy(new_line, ci->line, ci->len);
 		MEM_freeN(ci->line);
 		
-		ci->line= new_line;
-		ci->len_alloc= new_len;
+		ci->line = new_line;
+		ci->len_alloc = new_len;
 	}
 }
 
@@ -260,18 +240,18 @@ static int console_line_insert(ConsoleLine *ci, char *str)
 {
 	int len = strlen(str);
 	
-	if(len>0 && str[len-1]=='\n') {/* stop new lines being pasted at the end of lines */
-		str[len-1]= '\0';
+	if (len > 0 && str[len - 1] == '\n') { /* stop new lines being pasted at the end of lines */
+		str[len - 1] = '\0';
 		len--;
 	}
 
-	if(len==0)
+	if (len == 0)
 		return 0;
 	
 	console_line_verify_length(ci, len + ci->len);
 	
-	memmove(ci->line+ci->cursor+len, ci->line+ci->cursor, (ci->len - ci->cursor)+1);
-	memcpy(ci->line+ci->cursor, str, len);
+	memmove(ci->line + ci->cursor + len, ci->line + ci->cursor, (ci->len - ci->cursor) + 1);
+	memcpy(ci->line + ci->cursor, str, len);
 	
 	ci->len += len;
 	ci->cursor += len;
@@ -282,71 +262,75 @@ static int console_line_insert(ConsoleLine *ci, char *str)
 /* static funcs for text editing */
 
 /* similar to the text editor, with some not used. keep compatible */
-static EnumPropertyItem console_move_type_items[]= {
+static EnumPropertyItem console_move_type_items[] = {
 	{LINE_BEGIN, "LINE_BEGIN", 0, "Line Begin", ""},
 	{LINE_END, "LINE_END", 0, "Line End", ""},
 	{PREV_CHAR, "PREVIOUS_CHARACTER", 0, "Previous Character", ""},
 	{NEXT_CHAR, "NEXT_CHARACTER", 0, "Next Character", ""},
 	{PREV_WORD, "PREVIOUS_WORD", 0, "Previous Word", ""},
 	{NEXT_WORD, "NEXT_WORD", 0, "Next Word", ""},
-	{0, NULL, 0, NULL, NULL}};
+	{0, NULL, 0, NULL, NULL}
+};
 
 static int console_move_exec(bContext *C, wmOperator *op)
 {
-	ConsoleLine *ci= console_history_verify(C);
-	
-	int type= RNA_enum_get(op->ptr, "type");
-	int done= 0;
-	
-	switch(type) {
-	case LINE_BEGIN:
-		done= console_line_cursor_set(ci, 0);
-		break;
-	case LINE_END:
-		done= console_line_cursor_set(ci, INT_MAX);
-		break;
-	case PREV_CHAR:
-		done= console_line_cursor_set(ci, ci->cursor-1);
-		break;
-	case NEXT_CHAR:
-		done= console_line_cursor_set(ci, ci->cursor+1);
-		break;
-
-	/* - if the character is a delimiter then skip delimiters (including white space)
-	 * - when jump over the word */
-	case PREV_WORD:
-		while(text_check_delim(cursor_char_prev(ci)))
-			if(console_line_cursor_set(ci, ci->cursor-1)==FALSE)
-				break;
-
-		while(text_check_delim(cursor_char_prev(ci))==FALSE)
-			if(console_line_cursor_set(ci, ci->cursor-1)==FALSE)
-				break;
-
-		/* This isnt used for NEXT_WORD because when going back
-		 * its more useful to have the cursor directly after a word then whitespace */
-		while(text_check_whitespace(cursor_char_prev(ci))==TRUE)
-			if(console_line_cursor_set(ci, ci->cursor-1)==FALSE)
-				break;
-
-		done= 1; /* assume changed */
-		break;
-	case NEXT_WORD:
-		while(text_check_delim(cursor_char(ci))==TRUE)
-			if (console_line_cursor_set(ci, ci->cursor+1)==FALSE)
-				break;
-
-		while(text_check_delim(cursor_char(ci))==FALSE)
-			if (console_line_cursor_set(ci, ci->cursor+1)==FALSE)
-				break;
-
-		done= 1; /* assume changed */
-		break;
-	}
-	
-	if(done) {
-		ScrArea *sa= CTX_wm_area(C);
-		ARegion *ar= CTX_wm_region(C);
+	ConsoleLine *ci = console_history_verify(C);
+	
+	int type = RNA_enum_get(op->ptr, "type");
+	int done = 0;
+	int pos;
+	
+	switch (type) {
+		case LINE_BEGIN:
+			pos = ci->cursor;
+			BLI_str_cursor_step_utf8(ci->line, ci->len,
+			                         &pos, STRCUR_DIR_PREV,
+			                         STRCUR_JUMP_ALL);
+			done = console_line_cursor_set(ci, pos);
+			break;
+		case LINE_END:
+			pos = ci->cursor;
+			BLI_str_cursor_step_utf8(ci->line, ci->len,
+			                         &pos, STRCUR_DIR_NEXT,
+			                         STRCUR_JUMP_ALL);
+			done = console_line_cursor_set(ci, pos);
+			break;
+		case PREV_CHAR:
+			pos = ci->cursor;
+			BLI_str_cursor_step_utf8(ci->line, ci->len,
+			                         &pos, STRCUR_DIR_PREV,
+			                         STRCUR_JUMP_NONE);
+			done = console_line_cursor_set(ci, pos);
+			break;
+		case NEXT_CHAR:
+			pos = ci->cursor;
+			BLI_str_cursor_step_utf8(ci->line, ci->len,
+			                         &pos, STRCUR_DIR_NEXT,
+			                         STRCUR_JUMP_NONE);
+			done = console_line_cursor_set(ci, pos);
+			break;
+
+		/* - if the character is a delimiter then skip delimiters (including white space)
+		 * - when jump over the word */
+		case PREV_WORD:
+			pos = ci->cursor;
+			BLI_str_cursor_step_utf8(ci->line, ci->len,
+			                         &pos, STRCUR_DIR_PREV,
+			                         STRCUR_JUMP_DELIM);
+			done = console_line_cursor_set(ci, pos);
+			break;
+		case NEXT_WORD:
+			pos = ci->cursor;
+			BLI_str_cursor_step_utf8(ci->line, ci->len,
+			                         &pos, STRCUR_DIR_NEXT,
+			                         STRCUR_JUMP_DELIM);
+			done = console_line_cursor_set(ci, pos);
+			break;
+	}
+	
+	if (done) {
+		ScrArea *sa = CTX_wm_area(C);
+		ARegion *ar = CTX_wm_region(C);
 
 		ED_area_tag_redraw(sa);
 		console_scroll_bottom(ar);
@@ -359,13 +343,13 @@ static int console_move_exec(bContext *C, wmOperator *op)
 void CONSOLE_OT_move(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Move Cursor";
-	ot->description= "Move cursor position";
-	ot->idname= "CONSOLE_OT_move";
+	ot->name = "Move Cursor";
+	ot->description = "Move cursor position";
+	ot->idname = "CONSOLE_OT_move";
 	
 	/* api callbacks */
-	ot->exec= console_move_exec;
-	ot->poll= ED_operator_console_active;
+	ot->exec = console_move_exec;
+	ot->poll = ED_operator_console_active;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "type", console_move_type_items, LINE_BEGIN, "Type", "Where to move cursor to");
@@ -374,26 +358,26 @@ void CONSOLE_OT_move(wmOperatorType *ot)
 #define TAB_LENGTH 4
 static int console_insert_exec(bContext *C, wmOperator *op)
 {
-	SpaceConsole *sc= CTX_wm_space_console(C);
-	ARegion *ar= CTX_wm_region(C);
-	ConsoleLine *ci= console_history_verify(C);
-	char *str= RNA_string_get_alloc(op->ptr, "text", NULL, 0);
+	SpaceConsole *sc = CTX_wm_space_console(C);
+	ARegion *ar = CTX_wm_region(C);
+	ConsoleLine *ci = console_history_verify(C);
+	char *str = RNA_string_get_alloc(op->ptr, "text", NULL, 0);
 	int len;
 
 	// XXX, alligned tab key hack
-	if(str[0]=='\t' && str[1]=='\0') {
-		len= TAB_LENGTH - (ci->cursor % TAB_LENGTH);
+	if (str[0] == '\t' && str[1] == '\0') {
+		len = TAB_LENGTH - (ci->cursor % TAB_LENGTH);
 		MEM_freeN(str);
-		str= MEM_mallocN(len + 1, "insert_exec");
+		str = MEM_mallocN(len + 1, "insert_exec");
 		memset(str, ' ', len);
-		str[len]= '\0';
+		str[len] = '\0';
 	}
 
-	len= console_line_insert(ci, str);
+	len = console_line_insert(ci, str);
 	
 	MEM_freeN(str);
 	
-	if(len==0) {
+	if (len == 0) {
 		return OPERATOR_CANCELLED;
 	}
 	else {
@@ -410,16 +394,16 @@ static int console_insert_exec(bContext *C, wmOperator *op)
 
 static int console_insert_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	// if(!RNA_struct_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */
-	if(!RNA_string_length(op->ptr, "text")) {
+	// if (!RNA_struct_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */
+	if (!RNA_string_length(op->ptr, "text")) {
 		/* if alt/ctrl/super are pressed pass through */
-		if(event->ctrl || event->oskey) {
+		if (event->ctrl || event->oskey) {
 			return OPERATOR_PASS_THROUGH;
 		}
 		else {
 			char str[2];
-			str[0]= event->ascii;
-			str[1]= '\0';
+			str[0] = event->ascii;
+			str[1] = '\0';
 
 			RNA_string_set(op->ptr, "text", str);
 		}
@@ -429,60 +413,82 @@ static int console_insert_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 void CONSOLE_OT_insert(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+
 	/* identifiers */
-	ot->name= "Insert";
-	ot->description= "Insert text at cursor position";
-	ot->idname= "CONSOLE_OT_insert";
+	ot->name = "Insert";
+	ot->description = "Insert text at cursor position";
+	ot->idname = "CONSOLE_OT_insert";
 	
 	/* api callbacks */
-	ot->exec= console_insert_exec;
-	ot->invoke= console_insert_invoke;
-	ot->poll= ED_operator_console_active;
+	ot->exec = console_insert_exec;
+	ot->invoke = console_insert_invoke;
+	ot->poll = ED_operator_console_active;
 
 	/* properties */
-	RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position");
+	prop = RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 }
 
 
-static EnumPropertyItem console_delete_type_items[]= {
+static EnumPropertyItem console_delete_type_items[] = {
 	{DEL_NEXT_CHAR, "NEXT_CHARACTER", 0, "Next Character", ""},
 	{DEL_PREV_CHAR, "PREVIOUS_CHARACTER", 0, "Previous Character", ""},
-//	{DEL_NEXT_WORD, "NEXT_WORD", 0, "Next Word", ""},
-//	{DEL_PREV_WORD, "PREVIOUS_WORD", 0, "Previous Word", ""},
-	{0, NULL, 0, NULL, NULL}};
+	{DEL_NEXT_WORD, "NEXT_WORD", 0, "Next Word", ""},
+	{DEL_PREV_WORD, "PREVIOUS_WORD", 0, "Previous Word", ""},
+	{0, NULL, 0, NULL, NULL}
+};
 
 static int console_delete_exec(bContext *C, wmOperator *op)
 {
-	SpaceConsole *sc= CTX_wm_space_console(C);
-	ARegion *ar= CTX_wm_region(C);
-	ConsoleLine *ci= console_history_verify(C);
+	SpaceConsole *sc = CTX_wm_space_console(C);
+	ARegion *ar = CTX_wm_region(C);
+	ConsoleLine *ci = console_history_verify(C);
+	int pos;
+	int stride;
 
-	const short type= RNA_enum_get(op->ptr, "type");
+	const short type = RNA_enum_get(op->ptr, "type");
 	int done = 0;
 	
-	if(ci->len==0) {
+	if (ci->len == 0) {
 		return OPERATOR_CANCELLED;
 	}
 	
-	switch(type) {
-	case DEL_NEXT_CHAR:
-		if(ci->cursor < ci->len) {
-			memmove(ci->line + ci->cursor, ci->line + ci->cursor+1, (ci->len - ci->cursor)+1);
-			ci->len--;
-			done= 1;
-		}
-		break;
-	case DEL_PREV_CHAR:
-		if(ci->cursor > 0) {
-			ci->cursor--; /* same as above */
-			memmove(ci->line + ci->cursor, ci->line + ci->cursor+1, (ci->len - ci->cursor)+1);
-			ci->len--;
-			done= 1;
-		}
-		break;
+	switch (type) {
+		case DEL_NEXT_CHAR:
+		case DEL_NEXT_WORD:
+			if (ci->cursor < ci->len) {
+				pos = ci->cursor;
+				BLI_str_cursor_step_utf8(ci->line, ci->len,
+				                         &pos, STRCUR_DIR_NEXT,
+				                         (type == DEL_NEXT_CHAR) ? STRCUR_JUMP_NONE : STRCUR_JUMP_DELIM);
+				stride = pos - ci->cursor;
+				if (stride) {
+					memmove(ci->line + ci->cursor, ci->line + ci->cursor + stride, (ci->len - ci->cursor) + 1);
+					ci->len -= stride;
+					done = 1;
+				}
+			}
+			break;
+		case DEL_PREV_CHAR:
+		case DEL_PREV_WORD:
+			if (ci->cursor > 0) {
+				pos = ci->cursor;
+				BLI_str_cursor_step_utf8(ci->line, ci->len,
+				                         &pos, STRCUR_DIR_PREV,
+				                         (type == DEL_PREV_CHAR) ? STRCUR_JUMP_NONE : STRCUR_JUMP_DELIM);
+				stride = ci->cursor - pos;
+				if (stride) {
+					ci->cursor -= stride; /* same as above */
+					memmove(ci->line + ci->cursor, ci->line + ci->cursor + stride, (ci->len - ci->cursor) + 1);
+					ci->len -= stride;
+					done = 1;
+				}
+			}
+			break;
 	}
-	
-	if(!done) {
+
+	if (!done) {
 		return OPERATOR_CANCELLED;
 	}
 	else {
@@ -501,13 +507,13 @@ static int console_delete_exec(bContext *C, wmOperator *op)
 void CONSOLE_OT_delete(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete";
-	ot->description= "Delete text by cursor position";
-	ot->idname= "CONSOLE_OT_delete";
+	ot->name = "Delete";
+	ot->description = "Delete text by cursor position";
+	ot->idname = "CONSOLE_OT_delete";
 	
 	/* api callbacks */
-	ot->exec= console_delete_exec;
-	ot->poll= ED_operator_console_active;
+	ot->exec = console_delete_exec;
+	ot->poll = ED_operator_console_active;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "type", console_delete_type_items, DEL_NEXT_CHAR, "Type", "Which part of the text to delete");
@@ -517,21 +523,21 @@ void CONSOLE_OT_delete(wmOperatorType *ot)
 /* the python exec operator uses this */
 static int console_clear_exec(bContext *C, wmOperator *op)
 {
-	SpaceConsole *sc= CTX_wm_space_console(C);
-	ARegion *ar= CTX_wm_region(C);
+	SpaceConsole *sc = CTX_wm_space_console(C);
+	ARegion *ar = CTX_wm_region(C);
 	
-	short scrollback= RNA_boolean_get(op->ptr, "scrollback");
-	short history= RNA_boolean_get(op->ptr, "history");
+	short scrollback = RNA_boolean_get(op->ptr, "scrollback");
+	short history = RNA_boolean_get(op->ptr, "history");
 	
 	/*ConsoleLine *ci= */ console_history_verify(C);
 	
-	if(scrollback) { /* last item in mistory */
-		while(sc->scrollback.first)
+	if (scrollback) { /* last item in mistory */
+		while (sc->scrollback.first)
 			console_scrollback_free(sc, sc->scrollback.first);
 	}
 	
-	if(history) {
-		while(sc->history.first)
+	if (history) {
+		while (sc->history.first)
 			console_history_free(sc, sc->history.first);
 	}
 
@@ -544,13 +550,13 @@ static int console_clear_exec(bContext *C, wmOperator *op)
 void CONSOLE_OT_clear(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear";
-	ot->description= "Clear text by type";
-	ot->idname= "CONSOLE_OT_clear";
+	ot->name = "Clear";
+	ot->description = "Clear text by type";
+	ot->idname = "CONSOLE_OT_clear";
 	
 	/* api callbacks */
-	ot->exec= console_clear_exec;
-	ot->poll= ED_operator_console_active;
+	ot->exec = console_clear_exec;
+	ot->poll = ED_operator_console_active;
 	
 	/* properties */
 	RNA_def_boolean(ot->srna, "scrollback", 1, "Scrollback", "Clear the scrollback history");
@@ -562,42 +568,42 @@ void CONSOLE_OT_clear(wmOperatorType *ot)
 /* the python exec operator uses this */
 static int console_history_cycle_exec(bContext *C, wmOperator *op)
 {
-	SpaceConsole *sc= CTX_wm_space_console(C);
-	ARegion *ar= CTX_wm_region(C);
+	SpaceConsole *sc = CTX_wm_space_console(C);
+	ARegion *ar = CTX_wm_region(C);
 
-	ConsoleLine *ci= console_history_verify(C); /* TODO - stupid, just prevernts crashes when no command line */
-	short reverse= RNA_boolean_get(op->ptr, "reverse"); /* assumes down, reverse is up */
-	int prev_len= ci->len;
+	ConsoleLine *ci = console_history_verify(C); /* TODO - stupid, just prevernts crashes when no command line */
+	short reverse = RNA_boolean_get(op->ptr, "reverse"); /* assumes down, reverse is up */
+	int prev_len = ci->len;
 
 	/* keep a copy of the line above so when history is cycled
 	 * this is the only function that needs to know about the double-up */
-	if(ci->prev) {
-		ConsoleLine *ci_prev= (ConsoleLine *)ci->prev;
+	if (ci->prev) {
+		ConsoleLine *ci_prev = (ConsoleLine *)ci->prev;
 
-		if(strcmp(ci->line, ci_prev->line)==0)
+		if (strcmp(ci->line, ci_prev->line) == 0)
 			console_history_free(sc, ci_prev);
 	}
 
-	if(reverse) { /* last item in mistory */
-		ci= sc->history.last;
+	if (reverse) { /* last item in mistory */
+		ci = sc->history.last;
 		BLI_remlink(&sc->history, ci);
 		BLI_addhead(&sc->history, ci);
 	}
 	else {
-		ci= sc->history.first;
+		ci = sc->history.first;
 		BLI_remlink(&sc->history, ci);
 		BLI_addtail(&sc->history, ci);
 	}
 
-	{	/* add a duplicate of the new arg and remove all other instances */
+	{   /* add a duplicate of the new arg and remove all other instances */
 		ConsoleLine *cl;
-		while((cl= console_history_find(sc, ci->line, ci)))
+		while ((cl = console_history_find(sc, ci->line, ci)))
 			console_history_free(sc, cl);
 
 		console_history_add(C, (ConsoleLine *)sc->history.last);
 	}
 	
-	ci= sc->history.last;
+	ci = sc->history.last;
 	console_select_offset(sc, ci->len - prev_len);
 
 	/* could be wrapped so update scroll rect */
@@ -612,13 +618,13 @@ static int console_history_cycle_exec(bContext *C, wmOperator *op)
 void CONSOLE_OT_history_cycle(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "History Cycle";
-	ot->description= "Cycle through history";
-	ot->idname= "CONSOLE_OT_history_cycle";
+	ot->name = "History Cycle";
+	ot->description = "Cycle through history";
+	ot->idname = "CONSOLE_OT_history_cycle";
 	
 	/* api callbacks */
-	ot->exec= console_history_cycle_exec;
-	ot->poll= ED_operator_console_active;
+	ot->exec = console_history_cycle_exec;
+	ot->poll = ED_operator_console_active;
 	
 	/* properties */
 	RNA_def_boolean(ot->srna, "reverse", 0, "Reverse", "Reverse cycle history");
@@ -628,28 +634,28 @@ void CONSOLE_OT_history_cycle(wmOperatorType *ot)
 /* the python exec operator uses this */
 static int console_history_append_exec(bContext *C, wmOperator *op)
 {
-	SpaceConsole *sc= CTX_wm_space_console(C);
-	ARegion *ar= CTX_wm_region(C);
-	ScrArea *sa= CTX_wm_area(C);
-	ConsoleLine *ci= console_history_verify(C);
-	char *str= RNA_string_get_alloc(op->ptr, "text", NULL, 0); /* own this text in the new line, dont free */
-	int cursor= RNA_int_get(op->ptr, "current_character");
-	short rem_dupes= RNA_boolean_get(op->ptr, "remove_duplicates");
-	int prev_len= ci->len;
+	SpaceConsole *sc = CTX_wm_space_console(C);
+	ARegion *ar = CTX_wm_region(C);
+	ScrArea *sa = CTX_wm_area(C);
+	ConsoleLine *ci = console_history_verify(C);
+	char *str = RNA_string_get_alloc(op->ptr, "text", NULL, 0); /* own this text in the new line, don't free */
+	int cursor = RNA_int_get(op->ptr, "current_character");
+	short rem_dupes = RNA_boolean_get(op->ptr, "remove_duplicates");
+	int prev_len = ci->len;
 
-	if(rem_dupes) {
+	if (rem_dupes) {
 		ConsoleLine *cl;
 
-		while((cl= console_history_find(sc, ci->line, ci)))
+		while ((cl = console_history_find(sc, ci->line, ci)))
 			console_history_free(sc, cl);
 
-		if(strcmp(str, ci->line)==0) {
+		if (strcmp(str, ci->line) == 0) {
 			MEM_freeN(str);
 			return OPERATOR_FINISHED;
 		}
 	}
 
-	ci= console_history_add_str(sc, str, 1); /* own the string */
+	ci = console_history_add_str(sc, str, 1); /* own the string */
 	console_select_offset(sc, ci->len - prev_len);
 	console_line_cursor_set(ci, cursor);
 
@@ -667,13 +673,13 @@ static int console_history_append_exec(bContext *C, wmOperator *op)
 void CONSOLE_OT_history_append(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "History Append";
-	ot->description= "Append history at cursor position";
-	ot->idname= "CONSOLE_OT_history_append";
+	ot->name = "History Append";
+	ot->description = "Append history at cursor position";
+	ot->idname = "CONSOLE_OT_history_append";
 	
 	/* api callbacks */
-	ot->exec= console_history_append_exec;
-	ot->poll= ED_operator_console_active;
+	ot->exec = console_history_append_exec;
+	ot->poll = ED_operator_console_active;
 	
 	/* properties */
 	RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position");	
@@ -685,23 +691,23 @@ void CONSOLE_OT_history_append(wmOperatorType *ot)
 /* the python exec operator uses this */
 static int console_scrollback_append_exec(bContext *C, wmOperator *op)
 {
-	SpaceConsole *sc= CTX_wm_space_console(C);
-	ARegion *ar= CTX_wm_region(C);
+	SpaceConsole *sc = CTX_wm_space_console(C);
+	ARegion *ar = CTX_wm_region(C);
 	ConsoleLine *ci;
 	
-	char *str= RNA_string_get_alloc(op->ptr, "text", NULL, 0); /* own this text in the new line, dont free */
-	int type= RNA_enum_get(op->ptr, "type");
+	char *str = RNA_string_get_alloc(op->ptr, "text", NULL, 0); /* own this text in the new line, don't free */
+	int type = RNA_enum_get(op->ptr, "type");
 
 	console_history_verify(C);
 	
-	ci= console_scrollback_add_str(sc, str, 1); /* own the string */
-	ci->type= type;
+	ci = console_scrollback_add_str(sc, str, 1); /* own the string */
+	ci->type = type;
 	
 	console_scrollback_limit(sc);
 
 	/* 'ar' can be null depending on the operator that runs
 	 * rendering with invoke default for eg causes this */
-	if(ar) {
+	if (ar) {
 		console_textview_update_rect(sc, ar);
 	}
 
@@ -714,20 +720,20 @@ void CONSOLE_OT_scrollback_append(wmOperatorType *ot)
 {
 	/* defined in DNA_space_types.h */
 	static EnumPropertyItem console_line_type_items[] = {
-		{CONSOLE_LINE_OUTPUT,	"OUTPUT", 0, "Output", ""},
-		{CONSOLE_LINE_INPUT,	"INPUT", 0, "Input", ""},
-		{CONSOLE_LINE_INFO,		"INFO", 0, "Information", ""},
-		{CONSOLE_LINE_ERROR,	"ERROR", 0, "Error", ""},
+		{CONSOLE_LINE_OUTPUT,   "OUTPUT", 0, "Output", ""},
+		{CONSOLE_LINE_INPUT,    "INPUT", 0, "Input", ""},
+		{CONSOLE_LINE_INFO,     "INFO", 0, "Information", ""},
+		{CONSOLE_LINE_ERROR,    "ERROR", 0, "Error", ""},
 		{0, NULL, 0, NULL, NULL}};
 
 	/* identifiers */
-	ot->name= "Scrollback Append";
-	ot->description= "Append scrollback text by type";
-	ot->idname= "CONSOLE_OT_scrollback_append";
+	ot->name = "Scrollback Append";
+	ot->description = "Append scrollback text by type";
+	ot->idname = "CONSOLE_OT_scrollback_append";
 	
 	/* api callbacks */
-	ot->exec= console_scrollback_append_exec;
-	ot->poll= ED_operator_console_active;
+	ot->exec = console_scrollback_append_exec;
+	ot->poll = ED_operator_console_active;
 	
 	/* properties */
 	RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position");
@@ -737,49 +743,49 @@ void CONSOLE_OT_scrollback_append(wmOperatorType *ot)
 
 static int console_copy_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	SpaceConsole *sc= CTX_wm_space_console(C);
+	SpaceConsole *sc = CTX_wm_space_console(C);
 
-	DynStr *buf_dyn= BLI_dynstr_new();
+	DynStr *buf_dyn = BLI_dynstr_new();
 	char *buf_str;
 	
 	ConsoleLine *cl;
 	int sel[2];
-	int offset= 0;
+	int offset = 0;
 
-	ConsoleLine cl_dummy= {NULL};
+	ConsoleLine cl_dummy = {NULL};
 
 #if 0
 	/* copy whole file */
-	for(cl= sc->scrollback.first; cl; cl= cl->next) {
+	for (cl = sc->scrollback.first; cl; cl = cl->next) {
 		BLI_dynstr_append(buf_dyn, cl->line);
 		BLI_dynstr_append(buf_dyn, "\n");
 	}
 #endif
 
-	if(sc->sel_start == sc->sel_end)
+	if (sc->sel_start == sc->sel_end)
 		return OPERATOR_CANCELLED;
 
 	console_scrollback_prompt_begin(sc, &cl_dummy);
 
-	for(cl= sc->scrollback.first; cl; cl= cl->next) {
+	for (cl = sc->scrollback.first; cl; cl = cl->next) {
 		offset += cl->len + 1;
 	}
 
-	if(offset==0) {
+	if (offset == 0) {
 		console_scrollback_prompt_end(sc, &cl_dummy);
 		return OPERATOR_CANCELLED;
 	}
 
 	offset -= 1;
-	sel[0]= offset - sc->sel_end;
-	sel[1]= offset - sc->sel_start;
+	sel[0] = offset - sc->sel_end;
+	sel[1] = offset - sc->sel_start;
 
-	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);
+	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);
 
-			if(BLI_dynstr_get_len(buf_dyn))
+			if (BLI_dynstr_get_len(buf_dyn))
 				BLI_dynstr_append(buf_dyn, "\n");
 
 			BLI_dynstr_nappend(buf_dyn, cl->line + sta, end - sta);
@@ -789,7 +795,7 @@ static int console_copy_exec(bContext *C, wmOperator *UNUSED(op))
 		sel[1] -= cl->len + 1;
 	}
 
-	buf_str= BLI_dynstr_get_cstring(buf_dyn);
+	buf_str = BLI_dynstr_get_cstring(buf_dyn);
 
 	BLI_dynstr_free(buf_dyn);
 	WM_clipboard_text_set(buf_str, 0);
@@ -804,41 +810,41 @@ static int console_copy_exec(bContext *C, wmOperator *UNUSED(op))
 void CONSOLE_OT_copy(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Copy to Clipboard";
-	ot->description= "Copy selected text to clipboard";
-	ot->idname= "CONSOLE_OT_copy";
+	ot->name = "Copy to Clipboard";
+	ot->description = "Copy selected text to clipboard";
+	ot->idname = "CONSOLE_OT_copy";
 
 	/* api callbacks */
-	ot->poll= ED_operator_console_active;
-	ot->exec= console_copy_exec;
+	ot->poll = ED_operator_console_active;
+	ot->exec = console_copy_exec;
 
 	/* properties */
 }
 
 static int console_paste_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	SpaceConsole *sc= CTX_wm_space_console(C);
-	ARegion *ar= CTX_wm_region(C);
-	ConsoleLine *ci= console_history_verify(C);
+	SpaceConsole *sc = CTX_wm_space_console(C);
+	ARegion *ar = CTX_wm_region(C);
+	ConsoleLine *ci = console_history_verify(C);
 
-	char *buf_str= WM_clipboard_text_get(0);
+	char *buf_str = WM_clipboard_text_get(0);
 	char *buf_step, *buf_next;
 
-	if(buf_str==NULL)
+	if (buf_str == NULL)
 		return OPERATOR_CANCELLED;
 
-	buf_step= buf_str;
+	buf_step = buf_str;
 
-	while((buf_next=buf_step) && buf_next[0] != '\0') {
-		buf_step= strchr(buf_next, '\n');
-		if(buf_step) {
-			*buf_step= '\0';
+	while ((buf_next = buf_step) && buf_next[0] != '\0') {
+		buf_step = strchr(buf_next, '\n');
+		if (buf_step) {
+			*buf_step = '\0';
 			buf_step++;
 		}
 
-		if(buf_next != buf_str) {
+		if (buf_next != buf_str) {
 			WM_operator_name_call(C, "CONSOLE_OT_execute", WM_OP_EXEC_DEFAULT, NULL);
-			ci= console_history_verify(C);
+			ci = console_history_verify(C);
 		}
 
 		console_select_offset(sc, console_line_insert(ci, buf_next));
@@ -857,13 +863,13 @@ static int console_paste_exec(bContext *C, wmOperator *UNUSED(op))
 void CONSOLE_OT_paste(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Paste from Clipboard";
-	ot->description= "Paste text from clipboard";
-	ot->idname= "CONSOLE_OT_paste";
+	ot->name = "Paste from Clipboard";
+	ot->description = "Paste text from clipboard";
+	ot->idname = "CONSOLE_OT_paste";
 
 	/* api callbacks */
-	ot->poll= ED_operator_console_active;
-	ot->exec= console_paste_exec;
+	ot->poll = ED_operator_console_active;
+	ot->exec = console_paste_exec;
 
 	/* properties */
 }
@@ -877,10 +883,10 @@ typedef struct SetConsoleCursor {
 static void console_cursor_set_to_pos(SpaceConsole *sc, ARegion *ar, SetConsoleCursor *scu, int mval[2], int UNUSED(sel))
 {
 	int pos;
-	pos= console_char_pick(sc, ar, mval);
+	pos = console_char_pick(sc, ar, mval);
 
-	if(scu->sel_init == INT_MAX) {
-		scu->sel_init= pos;
+	if (scu->sel_init == INT_MAX) {
+		scu->sel_init = pos;
 		sc->sel_start = sc->sel_end = pos;
 		return;
 	}
@@ -900,22 +906,22 @@ static void console_cursor_set_to_pos(SpaceConsole *sc, ARegion *ar, SetConsoleC
 
 static void console_modal_select_apply(bContext *C, wmOperator *op, wmEvent *event)
 {
-	SpaceConsole *sc= CTX_wm_space_console(C);
-	ARegion *ar= CTX_wm_region(C);
-	SetConsoleCursor *scu= op->customdata;
+	SpaceConsole *sc = CTX_wm_space_console(C);
+	ARegion *ar = CTX_wm_region(C);
+	SetConsoleCursor *scu = op->customdata;
 	int mval[2];
 	int sel_prev[2];
 
-	mval[0]= event->mval[0];
-	mval[1]= event->mval[1];
+	mval[0] = event->mval[0];
+	mval[1] = event->mval[1];
 
-	sel_prev[0]= sc->sel_start;
-	sel_prev[1]= sc->sel_end;
+	sel_prev[0] = sc->sel_start;
+	sel_prev[1] = sc->sel_end;
 	
 	console_cursor_set_to_pos(sc, ar, scu, mval, TRUE);
 
 	/* only redraw if the selection changed */
-	if(sel_prev[0] != sc->sel_start || sel_prev[1] != sc->sel_end) {
+	if (sel_prev[0] != sc->sel_start || sel_prev[1] != sc->sel_end) {
 		ED_area_tag_redraw(CTX_wm_area(C));
 	}
 }
@@ -923,29 +929,30 @@ 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);
-	SetConsoleCursor *scu= op->customdata;
+	SetConsoleCursor *scu = op->customdata;
 
-	/*
-	if(txt_has_sel(text)) {
+#if 0
+	if (txt_has_sel(text)) {
 		buffer = txt_sel_to_buf(text);
 		WM_clipboard_text_set(buffer, 1);
 		MEM_freeN(buffer);
-	}*/
+	}
+#endif
 
 	MEM_freeN(scu);
 }
 
 static int console_modal_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	SpaceConsole *sc= CTX_wm_space_console(C);
+	SpaceConsole *sc = CTX_wm_space_console(C);
 //	ARegion *ar= CTX_wm_region(C);
 	SetConsoleCursor *scu;
 
-	op->customdata= MEM_callocN(sizeof(SetConsoleCursor), "SetConsoleCursor");
-	scu= op->customdata;
+	op->customdata = MEM_callocN(sizeof(SetConsoleCursor), "SetConsoleCursor");
+	scu = op->customdata;
 
-	scu->sel_old[0]= sc->sel_start;
-	scu->sel_old[1]= sc->sel_end;
+	scu->sel_old[0] = sc->sel_start;
+	scu->sel_old[1] = sc->sel_end;
 
 	scu->sel_init = INT_MAX;
 
@@ -958,7 +965,7 @@ static int console_modal_select_invoke(bContext *C, wmOperator *op, wmEvent *eve
 
 static int console_modal_select(bContext *C, wmOperator *op, wmEvent *event)
 {
-	switch(event->type) {
+	switch (event->type) {
 		case LEFTMOUSE:
 		case MIDDLEMOUSE:
 		case RIGHTMOUSE:
@@ -981,13 +988,13 @@ static int console_modal_select_cancel(bContext *C, wmOperator *op)
 void CONSOLE_OT_select_set(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Selection";
-	ot->idname= "CONSOLE_OT_select_set";
-	ot->description= "Set the console selection";
+	ot->name = "Set Selection";
+	ot->idname = "CONSOLE_OT_select_set";
+	ot->description = "Set the console selection";
 
 	/* api callbacks */
-	ot->invoke= console_modal_select_invoke;
-	ot->modal= console_modal_select;
-	ot->cancel= console_modal_select_cancel;
-	ot->poll= ED_operator_console_active;
+	ot->invoke = console_modal_select_invoke;
+	ot->modal = console_modal_select;
+	ot->cancel = console_modal_select_cancel;
+	ot->poll = ED_operator_console_active;
 }
diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c
index 3df8e98..39757aa 100644
--- a/source/blender/editors/space_console/space_console.c
+++ b/source/blender/editors/space_console/space_console.c
@@ -28,7 +28,7 @@
 #include <stdio.h>
 
 #ifdef WIN32
-#include "BLI_winstuff.h"
+#  include "BLI_winstuff.h"
 #endif
 
 #include "MEM_guardedalloc.h"
@@ -54,7 +54,7 @@
 #include "UI_resources.h"
 #include "UI_view2d.h"
 
-#include "console_intern.h"	// own include
+#include "console_intern.h" // own include
 
 /* ******************** default callbacks for console space ***************** */
 
@@ -63,32 +63,32 @@ static SpaceLink *console_new(const bContext *UNUSED(C))
 	ARegion *ar;
 	SpaceConsole *sconsole;
 	
-	sconsole= MEM_callocN(sizeof(SpaceConsole), "initconsole");
-	sconsole->spacetype= SPACE_CONSOLE;
+	sconsole = MEM_callocN(sizeof(SpaceConsole), "initconsole");
+	sconsole->spacetype = SPACE_CONSOLE;
 	
-	sconsole->lheight=	14;
+	sconsole->lheight =  14;
 	
 	/* header */
-	ar= MEM_callocN(sizeof(ARegion), "header for console");
+	ar = MEM_callocN(sizeof(ARegion), "header for console");
 	
 	BLI_addtail(&sconsole->regionbase, ar);
-	ar->regiontype= RGN_TYPE_HEADER;
-	ar->alignment= RGN_ALIGN_BOTTOM;
+	ar->regiontype = RGN_TYPE_HEADER;
+	ar->alignment = RGN_ALIGN_BOTTOM;
 	
 	
 	/* main area */
-	ar= MEM_callocN(sizeof(ARegion), "main area for text");
+	ar = MEM_callocN(sizeof(ARegion), "main area for text");
 	
 	BLI_addtail(&sconsole->regionbase, ar);
-	ar->regiontype= RGN_TYPE_WINDOW;
+	ar->regiontype = RGN_TYPE_WINDOW;
 	
 	/* keep in sync with info */
 	ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
-	ar->v2d.align |= V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y; /* align bottom left */
+	ar->v2d.align |= V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y; /* align bottom left */
 	ar->v2d.keepofs |= V2D_LOCKOFS_X;
-	ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_LIMITZOOM|V2D_KEEPASPECT);
-	ar->v2d.keeptot= V2D_KEEPTOT_BOUNDS;
-	ar->v2d.minzoom= ar->v2d.maxzoom= 1.0f;
+	ar->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
+	ar->v2d.keeptot = V2D_KEEPTOT_BOUNDS;
+	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);
@@ -99,12 +99,12 @@ static SpaceLink *console_new(const bContext *UNUSED(C))
 /* not spacelink itself */
 static void console_free(SpaceLink *sl)
 {
-	SpaceConsole *sc= (SpaceConsole*) sl;
+	SpaceConsole *sc = (SpaceConsole *) sl;
 	
-	while(sc->scrollback.first)
+	while (sc->scrollback.first)
 		console_scrollback_free(sc, sc->scrollback.first);
 	
-	while(sc->history.first)
+	while (sc->history.first)
 		console_history_free(sc, sc->history.first);
 }
 
@@ -117,13 +117,13 @@ static void console_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa)
 
 static SpaceLink *console_duplicate(SpaceLink *sl)
 {
-	SpaceConsole *sconsolen= MEM_dupallocN(sl);
+	SpaceConsole *sconsolen = MEM_dupallocN(sl);
 	
 	/* clear or remove stuff from old */
 	
 	/* TODO - duplicate?, then we also need to duplicate the py namespace */
-	sconsolen->scrollback.first= sconsolen->scrollback.last= NULL;
-	sconsolen->history.first= sconsolen->history.last= NULL;
+	sconsolen->scrollback.first = sconsolen->scrollback.last = NULL;
+	sconsolen->history.first = sconsolen->history.last = NULL;
 	
 	return (SpaceLink *)sconsolen;
 }
@@ -136,23 +136,23 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar)
 	wmKeyMap *keymap;
 	ListBase *lb;
 
-	const float prev_y_min= ar->v2d.cur.ymin; /* so resizing keeps the cursor visible */
+	const float prev_y_min = ar->v2d.cur.ymin; /* so re-sizing keeps the cursor visible */
 
 	UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
 
 	/* always keep the bottom part of the view aligned, less annoying */
-	if(prev_y_min != ar->v2d.cur.ymin) {
-		const float cur_y_range= ar->v2d.cur.ymax - ar->v2d.cur.ymin;
-		ar->v2d.cur.ymin= prev_y_min;
-		ar->v2d.cur.ymax= prev_y_min + cur_y_range;
+	if (prev_y_min != ar->v2d.cur.ymin) {
+		const float cur_y_range = ar->v2d.cur.ymax - ar->v2d.cur.ymin;
+		ar->v2d.cur.ymin = prev_y_min;
+		ar->v2d.cur.ymax = prev_y_min + cur_y_range;
 	}
 
 	/* own keymap */
-	keymap= WM_keymap_find(wm->defaultconf, "Console", SPACE_CONSOLE, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Console", SPACE_CONSOLE, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 	
 	/* add drop boxes */
-	lb= WM_dropboxmap_find("Console", SPACE_CONSOLE, RGN_TYPE_WINDOW);
+	lb = WM_dropboxmap_find("Console", SPACE_CONSOLE, RGN_TYPE_WINDOW);
 	
 	WM_event_add_dropbox_handler(&ar->handlers, lb);
 }
@@ -163,7 +163,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);
-	if(drag->type==WM_DRAG_ID)
+	if (drag->type == WM_DRAG_ID)
 		return 1;
 	return 0;
 }
@@ -171,10 +171,10 @@ 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];
-	ID *id= drag->poin;
+	ID *id = drag->poin;
 	char id_esc[(sizeof(id->name) - 2) * 2];
 
-	BLI_strescape(id_esc, id->name+2, sizeof(id_esc));
+	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);
 
@@ -185,14 +185,14 @@ static void id_drop_copy(wmDrag *drag, wmDropBox *drop)
 static int path_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
 {
 //    SpaceConsole *sc= CTX_wm_space_console(C);
-	if(drag->type==WM_DRAG_PATH)
+	if (drag->type == WM_DRAG_PATH)
 		return 1;
 	return 0;
 }
 
 static void path_drop_copy(wmDrag *drag, wmDropBox *drop)
 {
-	char pathname[FILE_MAX+2];
+	char pathname[FILE_MAX + 2];
 	BLI_snprintf(pathname, sizeof(pathname), "\"%s\"", drag->path);
 	RNA_string_set(drop->ptr, "text", pathname);
 }
@@ -201,7 +201,7 @@ static void path_drop_copy(wmDrag *drag, wmDropBox *drop)
 /* this region dropbox definition */
 static void console_dropboxes(void)
 {
-	ListBase *lb= WM_dropboxmap_find("Console", SPACE_CONSOLE, RGN_TYPE_WINDOW);
+	ListBase *lb = WM_dropboxmap_find("Console", SPACE_CONSOLE, RGN_TYPE_WINDOW);
 	
 	WM_dropbox_add(lb, "CONSOLE_OT_insert", id_drop_poll, id_drop_copy);
 	WM_dropbox_add(lb, "CONSOLE_OT_insert", path_drop_poll, path_drop_copy);
@@ -212,11 +212,11 @@ static void console_dropboxes(void)
 static void console_main_area_draw(const bContext *C, ARegion *ar)
 {
 	/* draw entirely, view changes should be handled here */
-	SpaceConsole *sc= CTX_wm_space_console(C);
-	View2D *v2d= &ar->v2d;
+	SpaceConsole *sc = CTX_wm_space_console(C);
+	View2D *v2d = &ar->v2d;
 	View2DScrollers *scrollers;
 
-	if(sc->scrollback.first==NULL)
+	if (sc->scrollback.first == NULL)
 		WM_operator_name_call((bContext *)C, "CONSOLE_OT_banner", WM_OP_EXEC_DEFAULT, NULL);
 
 	/* clear and setup matrix */
@@ -235,7 +235,7 @@ static void console_main_area_draw(const bContext *C, ARegion *ar)
 	UI_view2d_view_restore(C);
 	
 	/* scrollers */
-	scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_GRID_CLAMP);
+	scrollers = UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_GRID_CLAMP);
 	UI_view2d_scrollers_draw(C, v2d, scrollers);
 	UI_view2d_scrollers_free(scrollers);
 }
@@ -260,7 +260,7 @@ static void console_operatortypes(void)
 
 static void console_keymap(struct wmKeyConfig *keyconf)
 {
-	wmKeyMap *keymap= WM_keymap_find(keyconf, "Console", SPACE_CONSOLE, 0);
+	wmKeyMap *keymap = WM_keymap_find(keyconf, "Console", SPACE_CONSOLE, 0);
 	wmKeyMapItem *kmi;
 	
 #ifdef __APPLE__
@@ -293,30 +293,25 @@ static void console_keymap(struct wmKeyConfig *keyconf)
 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", LEFTARROWKEY, KM_PRESS, 0, 0)->ptr, "type", PREV_CHAR);
 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", RIGHTARROWKEY, KM_PRESS, 0, 0)->ptr, "type", NEXT_CHAR);
 	
-	kmi = WM_keymap_add_item(keymap, "CONSOLE_OT_history_cycle", UPARROWKEY, KM_PRESS, 0, 0);
-	RNA_boolean_set(kmi->ptr, "reverse", TRUE);
-	WM_keymap_add_item(keymap, "CONSOLE_OT_history_cycle", DOWNARROWKEY, KM_PRESS, 0, 0);
+	RNA_boolean_set(WM_keymap_add_item(keymap, "CONSOLE_OT_history_cycle", UPARROWKEY, KM_PRESS, 0, 0)->ptr, "reverse", TRUE);
+	RNA_boolean_set(WM_keymap_add_item(keymap, "CONSOLE_OT_history_cycle", DOWNARROWKEY, KM_PRESS, 0, 0)->ptr, "reverse", FALSE);
 	
-	/*
+#if 0
 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", LEFTARROWKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", PREV_WORD);
 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", RIGHTARROWKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", NEXT_WORD);
 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", UPARROWKEY, KM_PRESS, 0, 0)->ptr, "type", PREV_LINE);
 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", DOWNARROWKEY, KM_PRESS, 0, 0)->ptr, "type", NEXT_LINE);
 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", PAGEUPKEY, KM_PRESS, 0, 0)->ptr, "type", PREV_PAGE);
 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_move", PAGEDOWNKEY, KM_PRESS, 0, 0)->ptr, "type", NEXT_PAGE);
-
-
-	//RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_delete", DELKEY, KM_PRESS, 0, 0)->ptr, "type", DEL_NEXT_CHAR);
-	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_delete", DKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", DEL_NEXT_CHAR);
-	//RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_delete", BACKSPACEKEY, KM_PRESS, 0, 0)->ptr, "type", DEL_PREV_CHAR);
-	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_delete", DELKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", DEL_NEXT_WORD);
-	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_delete", BACKSPACEKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", DEL_PREV_WORD);
-	*/
+#endif
 	
 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_delete", DELKEY, KM_PRESS, 0, 0)->ptr, "type", DEL_NEXT_CHAR);
 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_delete", BACKSPACEKEY, KM_PRESS, 0, 0)->ptr, "type", DEL_PREV_CHAR);
 	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_delete", BACKSPACEKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", DEL_PREV_CHAR);  /* same as above [#26623] */
 
+	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_delete", DELKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", DEL_NEXT_WORD);
+	RNA_enum_set(WM_keymap_add_item(keymap, "CONSOLE_OT_delete", BACKSPACEKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", DEL_PREV_WORD);
+
 #ifdef WITH_PYTHON
 	WM_keymap_add_item(keymap, "CONSOLE_OT_execute", RETKEY, KM_PRESS, 0, 0); /* python operator - space_text.py */
 	WM_keymap_add_item(keymap, "CONSOLE_OT_execute", PADENTER, KM_PRESS, 0, 0);
@@ -356,9 +351,9 @@ static void console_main_area_listener(ARegion *ar, wmNotifier *wmn)
 	// SpaceInfo *sinfo= sa->spacedata.first;
 
 	/* context changes */
-	switch(wmn->category) {
+	switch (wmn->category) {
 		case NC_SPACE:
-			if(wmn->data == ND_SPACE_CONSOLE) { /* generic redraw request */
+			if (wmn->data == ND_SPACE_CONSOLE) { /* generic redraw request */
 				ED_region_tag_redraw(ar);
 			}
 			break;
@@ -368,41 +363,41 @@ static void console_main_area_listener(ARegion *ar, wmNotifier *wmn)
 /* only called once, from space/spacetypes.c */
 void ED_spacetype_console(void)
 {
-	SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype console");
+	SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype console");
 	ARegionType *art;
 	
-	st->spaceid= SPACE_CONSOLE;
+	st->spaceid = SPACE_CONSOLE;
 	strncpy(st->name, "Console", BKE_ST_MAXNAME);
 	
-	st->new= console_new;
-	st->free= console_free;
-	st->init= console_init;
-	st->duplicate= console_duplicate;
-	st->operatortypes= console_operatortypes;
-	st->keymap= console_keymap;
-	st->dropboxes= console_dropboxes;
+	st->new = console_new;
+	st->free = console_free;
+	st->init = console_init;
+	st->duplicate = console_duplicate;
+	st->operatortypes = console_operatortypes;
+	st->keymap = console_keymap;
+	st->dropboxes = console_dropboxes;
 	
 	/* regions: main window */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype console region");
+	art = MEM_callocN(sizeof(ARegionType), "spacetype console region");
 	art->regionid = RGN_TYPE_WINDOW;
-	art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
+	art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D;
 
-	art->init= console_main_area_init;
-	art->draw= console_main_area_draw;
-	art->listener= console_main_area_listener;
+	art->init = console_main_area_init;
+	art->draw = console_main_area_draw;
+	art->listener = console_main_area_listener;
 	
 	
 
 	BLI_addhead(&st->regiontypes, art);
 	
 	/* regions: header */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype console region");
+	art = MEM_callocN(sizeof(ARegionType), "spacetype console region");
 	art->regionid = RGN_TYPE_HEADER;
-	art->prefsizey= HEADERY;
-	art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_HEADER;
+	art->prefsizey = HEADERY;
+	art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER;
 	
-	art->init= console_header_area_init;
-	art->draw= console_header_area_draw;
+	art->init = console_header_area_init;
+	art->draw = console_header_area_draw;
 	
 	BLI_addhead(&st->regiontypes, art);
 
diff --git a/source/blender/editors/space_file/CMakeLists.txt b/source/blender/editors/space_file/CMakeLists.txt
index 6d959d0..98e1474 100644
--- a/source/blender/editors/space_file/CMakeLists.txt
+++ b/source/blender/editors/space_file/CMakeLists.txt
@@ -78,4 +78,8 @@ if(WITH_IMAGE_HDR)
 	add_definitions(-DWITH_HDR)
 endif()
 
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
 blender_add_lib(bf_editor_space_file "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_file/SConscript b/source/blender/editors/space_file/SConscript
index ad96840..b387d48 100644
--- a/source/blender/editors/space_file/SConscript
+++ b/source/blender/editors/space_file/SConscript
@@ -19,11 +19,14 @@ if env['WITH_BF_OPENEXR']:
 if env['WITH_BF_TIFF']:
     defs.append('WITH_TIFF')
 
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
+
 if env['OURPLATFORM'] == 'linux':
     cflags='-pthread'
     incs += ' ../../../extern/binreloc/include'
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
     
 env.BlenderLib ( 'bf_editors_space_file', sources, Split(incs), defs, libtype=['core'], priority=[115] )
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index c84a9d1..193fa2d 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -35,8 +35,9 @@
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
 #include "BLI_dynstr.h"
+
 #ifdef WIN32
-#include "BLI_winstuff.h"
+#  include "BLI_winstuff.h"
 #endif
 
 #include "BIF_gl.h"
@@ -154,10 +155,10 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
 						  btn_margin + UI_GetStringWidth(params->title));
 	}
 	
-	if (available_w <= loadbutton + separator + input_minw 
-	 || params->title[0] == 0) {
+	if (available_w <= loadbutton + separator + input_minw || params->title[0] == 0) {
 		loadbutton = 0;
-	} else {
+	}
+	else {
 		line1_w -= (loadbutton + separator);
 		line2_w  = line1_w;
 	}
@@ -166,7 +167,8 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
 	fnumbuttons = 2 * btn_fn_w;
 	if (!loadbutton || line2_w <= fnumbuttons + separator + input_minw) {
 		fnumbuttons = 0;
-	} else {
+	}
+	else {
 		line2_w -= (fnumbuttons + separator);
 	}
 	
@@ -183,16 +185,17 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
 		uiButSetCompleteFunc(but, autocomplete_directory, NULL);
 		uiButSetFlag(but, UI_BUT_NO_UTF8);
 
-		if((params->flag & FILE_DIRSEL_ONLY) == 0) {
+		if ((params->flag & FILE_DIRSEL_ONLY) == 0) {
 			but = uiDefBut(block, TEX, B_FS_FILENAME, "",
 			               min_x, line2_y, line2_w-chan_offs, btn_h,
 			               params->file, 0.0, (float)FILE_MAXFILE, 0, 0,
 			               TIP_(overwrite_alert ?N_("File name, overwrite existing") : N_("File name")));
 			uiButSetCompleteFunc(but, autocomplete_file, NULL);
 			uiButSetFlag(but, UI_BUT_NO_UTF8);
+			uiButClearFlag(but, UI_BUT_UNDO); /* operator button above does this automatic */
 
 			/* check if this overrides a file and if the operator option is used */
-			if(overwrite_alert) {
+			if (overwrite_alert) {
 				uiButSetFlag(but, UI_BUT_REDALERT);
 			}
 		}
@@ -219,14 +222,12 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
 	}
 	
 	/* Execute / cancel buttons. */
-	if(loadbutton) {
-		
+	if (loadbutton) {
+		/* params->title is already translated! */
 		uiDefButO(block, BUT, "FILE_OT_execute", WM_OP_EXEC_REGION_WIN, params->title,
-			max_x - loadbutton, line1_y, loadbutton, btn_h, 
-			params->title);
+		          max_x - loadbutton, line1_y, loadbutton, btn_h, "");
 		uiDefButO(block, BUT, "FILE_OT_cancel", WM_OP_EXEC_REGION_WIN, IFACE_("Cancel"),
-			max_x - loadbutton, line2_y, loadbutton, btn_h, 
-			TIP_("Cancel"));
+		          max_x - loadbutton, line2_y, loadbutton, btn_h, "");
 	}
 	
 	uiEndBlock(C, block);
@@ -248,7 +249,7 @@ static int get_file_icon(struct direntry *file)
 		if ( strcmp(file->relname, "..") == 0) {
 				return  ICON_FILE_PARENT;
 		}
-		if(file->flags & BLENDERFILE) {
+		if (file->flags & BLENDERFILE) {
 			return ICON_FILE_BLEND;
 		}
 		return ICON_FILE_FOLDER;
@@ -286,7 +287,7 @@ static void file_draw_icon(uiBlock *block, char *path, int sx, int sy, int icon,
 	
 	/*if (icon == ICON_FILE_BLANK) alpha = 0.375f;*/
 
-	but= uiDefIconBut(block, LABEL, 0, icon, x, y, width, height, NULL, 0.0f, 0.0f, 0.0f, 0.0f, "");
+	but = uiDefIconBut(block, LABEL, 0, icon, x, y, width, height, NULL, 0.0f, 0.0f, 0.0f, 0.0f, "");
 	uiButSetDragPath(but, path);
 }
 
@@ -344,7 +345,8 @@ static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int
 				scaledx =  ( (float)imb->x/(float)imb->y )*layout->prv_h;
 				scale = scaledy/imb->y;
 			}
-		} else {
+		}
+		else {
 			scaledx = (float)imb->x;
 			scaledy = (float)imb->y;
 			scale = 1.0;
@@ -377,7 +379,7 @@ static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int
 		}
 		
 		/* dragregion */
-		but= uiDefBut(block, LABEL, 0, "", xco, yco, ex, ey, NULL, 0.0, 0.0, 0, 0, "");
+		but = uiDefBut(block, LABEL, 0, "", xco, yco, ex, ey, NULL, 0.0, 0.0, 0, 0, "");
 		uiButSetDragImage(but, file->path, get_file_icon(file), imb, scale);
 		
 		glDisable(GL_BLEND);
@@ -397,7 +399,7 @@ static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname)
 	BLI_strncpy(filename, sfile->params->renameedit, sizeof(filename));
 	BLI_make_file_string(G.main->name, newname, sfile->params->dir, filename);
 
-	if( strcmp(orgname, newname) != 0 ) {
+	if ( strcmp(orgname, newname) != 0 ) {
 		if (!BLI_exists(newname)) {
 			BLI_rename(orgname, newname);
 			/* to make sure we show what is on disk */
@@ -478,7 +480,8 @@ void file_draw_list(const bContext *C, ARegion *ar)
 	/* adjust, so the next row is already drawn when scrolling */
 	if (layout->flag & FILE_LAYOUT_HOR) {
 		numfiles_layout += layout->rows;
-	} else {
+	}
+	else {
 		numfiles_layout += layout->columns;
 	}
 
@@ -499,7 +502,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
 
 
 		if (!(file->selflag & EDITING_FILE)) {
-			if  ((params->active_file == i) || (file->selflag & HILITED_FILE) || (file->selflag & SELECTED_FILE) ) {
+			if ((params->active_file == i) || (file->selflag & HILITED_FILE) || (file->selflag & SELECTED_FILE)) {
 				int colorid = (file->selflag & SELECTED_FILE) ? TH_HILITE : TH_BACK;
 				int shade = (params->active_file == i) || (file->selflag & HILITED_FILE) ? 20 : 0;
 				draw_tile(sx, sy-1, layout->tile_w+4, sfile->layout->tile_h+layout->tile_border_y, colorid, shade);
@@ -516,7 +519,8 @@ void file_draw_list(const bContext *C, ARegion *ar)
 			}
 			
 			file_draw_preview(block, file, sx, sy, imb, layout, !is_icon && (file->flags & IMAGEFILE));
-		} else {
+		}
+		else {
 			file_draw_icon(block, file->path, sx, sy-(UI_UNIT_Y / 6), get_file_icon(file), ICON_DEFAULT_WIDTH_SCALE, ICON_DEFAULT_HEIGHT_SCALE);
 			sx += ICON_DEFAULT_WIDTH_SCALE + 4;
 		}
@@ -528,12 +532,13 @@ void file_draw_list(const bContext *C, ARegion *ar)
 				textwidth, textheight, sfile->params->renameedit, 1.0f, (float)sizeof(sfile->params->renameedit),0,0,"");
 			uiButSetRenameFunc(but, renamebutton_cb, file);
 			uiButSetFlag(but, UI_BUT_NO_UTF8); /* allow non utf8 names */
+			uiButClearFlag(but, UI_BUT_UNDO);
 			if ( 0 == uiButActiveOnly(C, block, but)) {
 				file->selflag &= ~EDITING_FILE;
 			}
 		}
 
-		if (!(file->selflag & EDITING_FILE))  {
+		if (!(file->selflag & EDITING_FILE)) {
 			int tpos = (FILE_IMGDISPLAY == params->display) ? sy - layout->tile_h + layout->textheight : sy;
 			file_draw_string(sx+1, tpos, file->relname, (float)textwidth, textheight, align);
 		}
@@ -544,7 +549,8 @@ void file_draw_list(const bContext *C, ARegion *ar)
 				file_draw_string(sx, sy, file->size, layout->column_widths[COLUMN_SIZE], layout->tile_h, align);	
 				sx += (int)layout->column_widths[COLUMN_SIZE] + 12;
 			}
-		} else if (params->display == FILE_LONGDISPLAY) {
+		}
+		else if (params->display == FILE_LONGDISPLAY) {
 			sx += (int)layout->column_widths[COLUMN_NAME] + 12;
 
 #ifndef WIN32
diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h
index d9de804..9455f63 100644
--- a/source/blender/editors/space_file/file_intern.h
+++ b/source/blender/editors/space_file/file_intern.h
@@ -28,8 +28,8 @@
  *  \ingroup spfile
  */
 
-#ifndef ED_FILE_INTERN_H
-#define ED_FILE_INTERN_H
+#ifndef __FILE_INTERN_H__
+#define __FILE_INTERN_H__
 
 /* internal exports only */
 
@@ -50,7 +50,6 @@ struct ARegion *file_buttons_region(struct ScrArea *sa);
 
 void file_draw_buttons(const bContext *C, ARegion *ar);
 void file_calc_previews(const bContext *C, ARegion *ar);
-void file_draw_previews(const bContext *C, ARegion *ar);
 void file_draw_list(const bContext *C, ARegion *ar);
 
 void file_draw_check_cb(bContext *C, void *arg1, void *arg2);
@@ -72,7 +71,6 @@ void FILE_OT_execute(struct wmOperatorType *ot);
 void FILE_OT_cancel(struct wmOperatorType *ot);
 void FILE_OT_parent(struct wmOperatorType *ot);
 void FILE_OT_directory_new(struct wmOperatorType *ot);
-void FILE_OT_filename(struct wmOperatorType *ot);
 void FILE_OT_directory(struct wmOperatorType *ot);
 void FILE_OT_previous(struct wmOperatorType *ot);
 void FILE_OT_next(struct wmOperatorType *ot);
@@ -112,5 +110,5 @@ void autocomplete_file(struct bContext *C, char *str, void *arg_v);
 /* file_panels.c */
 void file_panels_register(struct ARegionType *art);
 
-#endif /* ED_FILE_INTERN_H */
+#endif /* __FILE_INTERN_H__ */
 
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 8a5f5c1..7d1981a 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -37,8 +37,9 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
+
 #ifdef WIN32
-#include "BLI_winstuff.h"
+#  include "BLI_winstuff.h"
 #endif
 
 #include "ED_screen.h"
@@ -170,9 +171,9 @@ static FileSelect file_select_do(bContext* C, int selected_idx)
 	{
 		params->active_file = selected_idx;
 
-		if(S_ISDIR(file->type)) {
+		if (S_ISDIR(file->type)) {
 			/* the path is too long and we are not going up! */
-			if (strcmp(file->relname, "..") && strlen(params->dir) + strlen(file->relname) >= FILE_MAX )  {
+			if (strcmp(file->relname, "..") && strlen(params->dir) + strlen(file->relname) >= FILE_MAX ) {
 				// XXX error("Path too long, cannot enter this directory");
 			}
 			else {
@@ -190,7 +191,7 @@ static FileSelect file_select_do(bContext* C, int selected_idx)
 				retval = FILE_SELECT_DIR;
 			}
 		}
-		else  {
+		else {
 			if (file->relname) {
 				BLI_strncpy(params->file, file->relname, FILE_MAXFILE);
 			}
@@ -215,8 +216,7 @@ static FileSelect file_select(bContext* C, const rcti* rect, FileSelType select,
 	if (sel.first != sel.last) select = 0;
 
 	/* Do we have a valid selection and are we actually selecting */
-	if ( (sel.last >= 0) && ((select == FILE_SEL_ADD) || (select == FILE_SEL_TOGGLE)) )
-	{
+	if ((sel.last >= 0) && ((select == FILE_SEL_ADD) || (select == FILE_SEL_TOGGLE))) {
 		/* Check last selection, if selected, act on the file or dir */
 		if (filelist_is_selected(sfile->files, sel.last, check_type)) {
 			retval = file_select_do(C, sel.last);
@@ -241,12 +241,12 @@ static int file_border_select_modal(bContext *C, wmOperator *op, wmEvent *event)
 
 	result=	WM_border_select_modal(C, op, event);
 
-	if(result==OPERATOR_RUNNING_MODAL)	{
+	if (result==OPERATOR_RUNNING_MODAL)	{
 
-		rect.xmin= RNA_int_get(op->ptr, "xmin");
-		rect.ymin= RNA_int_get(op->ptr, "ymin");
-		rect.xmax= RNA_int_get(op->ptr, "xmax");
-		rect.ymax= RNA_int_get(op->ptr, "ymax");
+		rect.xmin = RNA_int_get(op->ptr, "xmin");
+		rect.ymin = RNA_int_get(op->ptr, "ymin");
+		rect.xmax = RNA_int_get(op->ptr, "xmax");
+		rect.ymax = RNA_int_get(op->ptr, "ymax");
 
 		BLI_isect_rcti(&(ar->v2d.mask), &rect, &rect);
 
@@ -258,7 +258,8 @@ static int file_border_select_modal(bContext *C, wmOperator *op, wmEvent *event)
 		}
 		params->sel_first = sel.first; params->sel_last = sel.last;
 
-	}else {
+	}
+	else {
 		params->active_file = -1;
 		params->sel_first = params->sel_last = -1;
 		file_deselect_all(sfile, HILITED_FILE);
@@ -276,12 +277,12 @@ static int file_border_select_exec(bContext *C, wmOperator *op)
 	int extend= RNA_boolean_get(op->ptr, "extend");
 	short select= (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT);
 
-	rect.xmin= RNA_int_get(op->ptr, "xmin");
-	rect.ymin= RNA_int_get(op->ptr, "ymin");
-	rect.xmax= RNA_int_get(op->ptr, "xmax");
-	rect.ymax= RNA_int_get(op->ptr, "ymax");
+	rect.xmin = RNA_int_get(op->ptr, "xmin");
+	rect.ymin = RNA_int_get(op->ptr, "ymin");
+	rect.xmax = RNA_int_get(op->ptr, "xmax");
+	rect.ymax = RNA_int_get(op->ptr, "ymax");
 
-	if(!extend) {
+	if (!extend) {
 		SpaceFile *sfile= CTX_wm_space_file(C);
 
 		file_deselect_all(sfile, SELECTED_FILE);
@@ -292,7 +293,8 @@ static int file_border_select_exec(bContext *C, wmOperator *op)
 	ret = file_select(C, &rect, select ? FILE_SEL_ADD : FILE_SEL_REMOVE, 0);
 	if (FILE_SELECT_DIR == ret) {
 		WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
-	} else if (FILE_SELECT_FILE == ret) {
+	}
+	else if (FILE_SELECT_FILE == ret) {
 		WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
 	}
 	return OPERATOR_FINISHED;
@@ -301,16 +303,16 @@ static int file_border_select_exec(bContext *C, wmOperator *op)
 void FILE_OT_select_border(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Activate/Select File";
-	ot->description= "Activate/select the file(s) contained in the border";
-	ot->idname= "FILE_OT_select_border";
+	ot->name = "Activate/Select File";
+	ot->description = "Activate/select the file(s) contained in the border";
+	ot->idname = "FILE_OT_select_border";
 	
 	/* api callbacks */
-	ot->invoke= WM_border_select_invoke;
-	ot->exec= file_border_select_exec;
-	ot->modal= file_border_select_modal;
-	ot->poll= ED_operator_file_active;
-	ot->cancel= WM_border_select_cancel;
+	ot->invoke = WM_border_select_invoke;
+	ot->exec = file_border_select_exec;
+	ot->modal = file_border_select_modal;
+	ot->poll = ED_operator_file_active;
+	ot->cancel = WM_border_select_cancel;
 
 	/* rna */
 	WM_operator_properties_gesture_border(ot, 1);
@@ -325,13 +327,13 @@ static int file_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	int extend = RNA_boolean_get(op->ptr, "extend");
 	int fill = RNA_boolean_get(op->ptr, "fill");
 
-	if(ar->regiontype != RGN_TYPE_WINDOW)
+	if (ar->regiontype != RGN_TYPE_WINDOW)
 		return OPERATOR_CANCELLED;
 
 	rect.xmin = rect.xmax = event->mval[0];
 	rect.ymin = rect.ymax = event->mval[1];
 
-	if(!BLI_in_rcti(&ar->v2d.mask, rect.xmin, rect.ymin))
+	if (!BLI_in_rcti(&ar->v2d.mask, rect.xmin, rect.ymin))
 		return OPERATOR_CANCELLED;
 
 	/* single select, deselect all selected first */
@@ -352,13 +354,13 @@ static int file_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 void FILE_OT_select(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Activate/Select File";
-	ot->description= "Activate/select file";
-	ot->idname= "FILE_OT_select";
+	ot->name = "Activate/Select File";
+	ot->description = "Activate/select file";
+	ot->idname = "FILE_OT_select";
 	
 	/* api callbacks */
-	ot->invoke= file_select_invoke;
-	ot->poll= ED_operator_file_active;
+	ot->invoke = file_select_invoke;
+	ot->poll = ED_operator_file_active;
 
 	/* rna */
 	RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first");
@@ -399,13 +401,13 @@ static int file_select_all_exec(bContext *C, wmOperator *UNUSED(op))
 void FILE_OT_select_all_toggle(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select/Deselect All Files";
-	ot->description= "Select/deselect all files";
-	ot->idname= "FILE_OT_select_all_toggle";
+	ot->name = "(De)select All Files";
+	ot->description = "Select or deselect all files";
+	ot->idname = "FILE_OT_select_all_toggle";
 	
 	/* api callbacks */
-	ot->exec= file_select_all_exec;
-	ot->poll= ED_operator_file_active;
+	ot->exec = file_select_all_exec;
+	ot->poll = ED_operator_file_active;
 
 	/* rna */
 
@@ -418,7 +420,7 @@ static int bookmark_select_exec(bContext *C, wmOperator *op)
 {
 	SpaceFile *sfile= CTX_wm_space_file(C);
 
-	if(RNA_struct_find_property(op->ptr, "dir")) {
+	if (RNA_struct_find_property(op->ptr, "dir")) {
 		char entry[256];
 		FileSelectParams* params = sfile->params;
 
@@ -436,13 +438,13 @@ static int bookmark_select_exec(bContext *C, wmOperator *op)
 void FILE_OT_select_bookmark(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Directory";
-	ot->description= "Select a bookmarked directory";
-	ot->idname= "FILE_OT_select_bookmark";
+	ot->name = "Select Directory";
+	ot->description = "Select a bookmarked directory";
+	ot->idname = "FILE_OT_select_bookmark";
 	
 	/* api callbacks */
-	ot->exec= bookmark_select_exec;
-	ot->poll= ED_operator_file_active;
+	ot->exec = bookmark_select_exec;
+	ot->poll = ED_operator_file_active;
 
 	RNA_def_string(ot->srna, "dir", "", 256, "Dir", "");
 }
@@ -469,13 +471,13 @@ static int bookmark_add_exec(bContext *C, wmOperator *UNUSED(op))
 void FILE_OT_bookmark_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Bookmark";
-	ot->description= "Add a bookmark for the selected/active directory";
-	ot->idname= "FILE_OT_bookmark_add";
+	ot->name = "Add Bookmark";
+	ot->description = "Add a bookmark for the selected/active directory";
+	ot->idname = "FILE_OT_bookmark_add";
 	
 	/* api callbacks */
-	ot->exec= bookmark_add_exec;
-	ot->poll= ED_operator_file_active;
+	ot->exec = bookmark_add_exec;
+	ot->poll = ED_operator_file_active;
 }
 
 static int bookmark_delete_exec(bContext *C, wmOperator *op)
@@ -484,7 +486,7 @@ static int bookmark_delete_exec(bContext *C, wmOperator *op)
 	struct FSMenu* fsmenu = fsmenu_get();
 	int nentries = fsmenu_get_nentries(fsmenu, FS_CATEGORY_BOOKMARKS);
 	
-	if(RNA_struct_find_property(op->ptr, "index")) {
+	if (RNA_struct_find_property(op->ptr, "index")) {
 		int index = RNA_int_get(op->ptr, "index");
 		if ( (index >-1) && (index < nentries)) {
 			char name[FILE_MAX];
@@ -502,13 +504,13 @@ static int bookmark_delete_exec(bContext *C, wmOperator *op)
 void FILE_OT_delete_bookmark(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete Bookmark";
-	ot->description= "Delete selected bookmark";
-	ot->idname= "FILE_OT_delete_bookmark";
+	ot->name = "Delete Bookmark";
+	ot->description = "Delete selected bookmark";
+	ot->idname = "FILE_OT_delete_bookmark";
 	
 	/* api callbacks */
-	ot->exec= bookmark_delete_exec;
-	ot->poll= ED_operator_file_active;
+	ot->exec = bookmark_delete_exec;
+	ot->poll = ED_operator_file_active;
 
 	RNA_def_int(ot->srna, "index", -1, -1, 20000, "Index", "", -1, 20000);
 }
@@ -519,7 +521,7 @@ int file_hilight_set(SpaceFile *sfile, ARegion *ar, int mx, int my)
 	FileSelectParams* params;
 	int numfiles, origfile;	
 
-	if(sfile==NULL || sfile->files==NULL) return 0;
+	if (sfile==NULL || sfile->files==NULL) return 0;
 
 	numfiles = filelist_numfiles(sfile->files);
 	params = ED_fileselect_get_params(sfile);
@@ -529,7 +531,7 @@ int file_hilight_set(SpaceFile *sfile, ARegion *ar, int mx, int my)
 	mx -= ar->winrct.xmin;
 	my -= ar->winrct.ymin;
 
-	if(BLI_in_rcti(&ar->v2d.mask, mx, my)) {
+	if (BLI_in_rcti(&ar->v2d.mask, mx, my)) {
 		float fx, fy;
 		int active_file;
 
@@ -537,7 +539,7 @@ int file_hilight_set(SpaceFile *sfile, ARegion *ar, int mx, int my)
 
 		active_file = ED_fileselect_layout_offset(sfile->layout, (int)(v2d->tot.xmin + fx), (int)(v2d->tot.ymax - fy));
 
-		if((active_file >= 0) && (active_file < numfiles))
+		if ((active_file >= 0) && (active_file < numfiles))
 			params->active_file=active_file;
 		else
 			params->active_file= -1;
@@ -553,7 +555,7 @@ static int file_highlight_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *e
 	ARegion *ar= CTX_wm_region(C);
 	SpaceFile *sfile= CTX_wm_space_file(C);
 
-	if(!file_hilight_set(sfile, ar, event->x, event->y))
+	if (!file_hilight_set(sfile, ar, event->x, event->y))
 		return OPERATOR_CANCELLED;
 
 	ED_area_tag_redraw(CTX_wm_area(C));
@@ -564,13 +566,13 @@ static int file_highlight_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *e
 void FILE_OT_highlight(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Highlight File";
-	ot->description= "Highlight selected file(s)";
-	ot->idname= "FILE_OT_highlight";
+	ot->name = "Highlight File";
+	ot->description = "Highlight selected file(s)";
+	ot->idname = "FILE_OT_highlight";
 	
 	/* api callbacks */
-	ot->invoke= file_highlight_invoke;
-	ot->poll= ED_operator_file_active;
+	ot->invoke = file_highlight_invoke;
+	ot->poll = ED_operator_file_active;
 }
 
 int file_cancel_exec(bContext *C, wmOperator *UNUSED(unused))
@@ -598,32 +600,32 @@ static int file_operator_poll(bContext *C)
 void FILE_OT_cancel(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Cancel File Load";
-	ot->description= "Cancel loading of selected file";
-	ot->idname= "FILE_OT_cancel";
+	ot->name = "Cancel File Load";
+	ot->description = "Cancel loading of selected file";
+	ot->idname = "FILE_OT_cancel";
 	
 	/* api callbacks */
-	ot->exec= file_cancel_exec;
-	ot->poll= file_operator_poll;
+	ot->exec = file_cancel_exec;
+	ot->poll = file_operator_poll;
 }
 
 
 void file_sfile_to_operator(wmOperator *op, SpaceFile *sfile, char *filepath)
 {
 	BLI_join_dirfile(filepath, FILE_MAX, sfile->params->dir, sfile->params->file); /* XXX, not real length */
-	if(RNA_struct_find_property(op->ptr, "relative_path")) {
-		if(RNA_boolean_get(op->ptr, "relative_path")) {
+	if (RNA_struct_find_property(op->ptr, "relative_path")) {
+		if (RNA_boolean_get(op->ptr, "relative_path")) {
 			BLI_path_rel(filepath, G.main->name);
 		}
 	}
 
-	if(RNA_struct_find_property(op->ptr, "filename")) {
+	if (RNA_struct_find_property(op->ptr, "filename")) {
 		RNA_string_set(op->ptr, "filename", sfile->params->file);
 	}
-	if(RNA_struct_find_property(op->ptr, "directory")) {
+	if (RNA_struct_find_property(op->ptr, "directory")) {
 		RNA_string_set(op->ptr, "directory", sfile->params->dir);
 	}
-	if(RNA_struct_find_property(op->ptr, "filepath")) {
+	if (RNA_struct_find_property(op->ptr, "filepath")) {
 		RNA_string_set(op->ptr, "filepath", filepath);
 	}
 	
@@ -636,7 +638,7 @@ void file_sfile_to_operator(wmOperator *op, SpaceFile *sfile, char *filepath)
 		PropertyRNA *prop_dirs= RNA_struct_find_property(op->ptr, "dirs");
 		int i, numfiles = filelist_numfiles(sfile->files);
 
-		if(prop_files) {
+		if (prop_files) {
 			RNA_property_collection_clear(op->ptr, prop_files);
 			for (i=0; i<numfiles; i++) {
 				if (filelist_is_selected(sfile->files, i, CHECK_FILES)) {
@@ -647,7 +649,7 @@ void file_sfile_to_operator(wmOperator *op, SpaceFile *sfile, char *filepath)
 			}
 		}
 
-		if(prop_dirs) {
+		if (prop_dirs) {
 			RNA_property_collection_clear(op->ptr, prop_dirs);
 			for (i=0; i<numfiles; i++) {
 				if (filelist_is_selected(sfile->files, i, CHECK_DIRS)) {
@@ -667,16 +669,16 @@ void file_operator_to_sfile(SpaceFile *sfile, wmOperator *op)
 	PropertyRNA *prop;
 
 	/* If neither of the above are set, split the filepath back */
-	if((prop= RNA_struct_find_property(op->ptr, "filepath"))) {
+	if ((prop= RNA_struct_find_property(op->ptr, "filepath"))) {
 		char filepath[FILE_MAX];
 		RNA_property_string_get(op->ptr, prop, filepath);
 		BLI_split_dirfile(filepath, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file));
 	}
 	else {
-		if((prop= RNA_struct_find_property(op->ptr, "filename"))) {
+		if ((prop= RNA_struct_find_property(op->ptr, "filename"))) {
 			RNA_property_string_get(op->ptr, prop, sfile->params->file);
 		}
-		if((prop= RNA_struct_find_property(op->ptr, "directory"))) {
+		if ((prop= RNA_struct_find_property(op->ptr, "directory"))) {
 			RNA_property_string_get(op->ptr, prop, sfile->params->dir);
 		}
 	}
@@ -692,13 +694,13 @@ void file_draw_check_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2))
 {
 	SpaceFile *sfile= CTX_wm_space_file(C);
 	wmOperator *op= sfile->op;
-	if(op) { /* fail on reload */
-		if(op->type->check) {
+	if (op) { /* fail on reload */
+		if (op->type->check) {
 			char filepath[FILE_MAX];
 			file_sfile_to_operator(op, sfile, filepath);
 			
 			/* redraw */
-			if(op->type->check(C, op)) {
+			if (op->type->check(C, op)) {
 				file_operator_to_sfile(sfile, op);
 	
 				/* redraw, else the changed settings wont get updated */
@@ -710,12 +712,12 @@ void file_draw_check_cb(bContext *C, void *UNUSED(arg1), void *UNUSED(arg2))
 
 int file_draw_check_exists(SpaceFile *sfile)
 {
-	if(sfile->op) { /* fails on reload */
-		if(RNA_struct_find_property(sfile->op->ptr, "check_existing")) {
-			if(RNA_boolean_get(sfile->op->ptr, "check_existing")) {
+	if (sfile->op) { /* fails on reload */
+		if (RNA_struct_find_property(sfile->op->ptr, "check_existing")) {
+			if (RNA_boolean_get(sfile->op->ptr, "check_existing")) {
 				char filepath[FILE_MAX];
 				BLI_join_dirfile(filepath, sizeof(filepath), sfile->params->dir, sfile->params->file);
-				if(BLI_is_file(filepath)) {
+				if (BLI_is_file(filepath)) {
 					return TRUE;
 				}
 			}
@@ -731,16 +733,16 @@ int file_exec(bContext *C, wmOperator *exec_op)
 	SpaceFile *sfile= CTX_wm_space_file(C);
 	char filepath[FILE_MAX];
 	
-	if(sfile->op) {
+	if (sfile->op) {
 		wmOperator *op= sfile->op;
 	
 		/* when used as a macro, for doubleclick, 
-		 to prevent closing when doubleclicking on .. item */
+		 * to prevent closing when doubleclicking on .. item */
 		if (RNA_boolean_get(exec_op->ptr, "need_active")) {
 			int i, active=0;
 			
 			for (i=0; i<filelist_numfiles(sfile->files); i++) {
-				if(filelist_is_selected(sfile->files, i, CHECK_ALL)) {
+				if (filelist_is_selected(sfile->files, i, CHECK_ALL)) {
 					active=1;
 					break;
 				}
@@ -767,16 +769,20 @@ int file_exec(bContext *C, wmOperator *exec_op)
 
 void FILE_OT_execute(struct wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+
 	/* identifiers */
-	ot->name= "Execute File Window";
-	ot->description= "Execute selected file";
-	ot->idname= "FILE_OT_execute";
+	ot->name = "Execute File Window";
+	ot->description = "Execute selected file";
+	ot->idname = "FILE_OT_execute";
 	
 	/* api callbacks */
-	ot->exec= file_exec;
-	ot->poll= file_operator_poll; 
+	ot->exec = file_exec;
+	ot->poll = file_operator_poll; 
 	
-	RNA_def_boolean(ot->srna, "need_active", 0, "Need Active", "Only execute if there's an active selected file in the file list");
+	prop = RNA_def_boolean(ot->srna, "need_active", 0, "Need Active",
+	                       "Only execute if there's an active selected file in the file list");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 }
 
 
@@ -784,7 +790,7 @@ int file_parent_exec(bContext *C, wmOperator *UNUSED(unused))
 {
 	SpaceFile *sfile= CTX_wm_space_file(C);
 	
-	if(sfile->params) {
+	if (sfile->params) {
 		if (BLI_has_parent(sfile->params->dir)) {
 			BLI_parent_dir(sfile->params->dir);
 			BLI_cleanup_dir(G.main->name, sfile->params->dir);
@@ -801,13 +807,13 @@ int file_parent_exec(bContext *C, wmOperator *UNUSED(unused))
 void FILE_OT_parent(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Parent File";
-	ot->description= "Move to parent directory";
-	ot->idname= "FILE_OT_parent";
+	ot->name = "Parent File";
+	ot->description = "Move to parent directory";
+	ot->idname = "FILE_OT_parent";
 	
 	/* api callbacks */
-	ot->exec= file_parent_exec;
-	ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
+	ot->exec = file_parent_exec;
+	ot->poll = ED_operator_file_active; /* <- important, handler is on window level */
 }
 
 
@@ -826,20 +832,20 @@ static int file_refresh_exec(bContext *C, wmOperator *UNUSED(unused))
 void FILE_OT_previous(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Previous Folder";
-	ot->description= "Move to previous folder";
-	ot->idname= "FILE_OT_previous";
+	ot->name = "Previous Folder";
+	ot->description = "Move to previous folder";
+	ot->idname = "FILE_OT_previous";
 	
 	/* api callbacks */
-	ot->exec= file_previous_exec;
-	ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
+	ot->exec = file_previous_exec;
+	ot->poll = ED_operator_file_active; /* <- important, handler is on window level */
 }
 
 int file_previous_exec(bContext *C, wmOperator *UNUSED(unused))
 {
 	SpaceFile *sfile= CTX_wm_space_file(C);
 
-	if(sfile->params) {
+	if (sfile->params) {
 		if (!sfile->folders_next)
 			sfile->folders_next = folderlist_new();
 
@@ -857,19 +863,19 @@ int file_previous_exec(bContext *C, wmOperator *UNUSED(unused))
 void FILE_OT_next(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Next Folder";
-	ot->description= "Move to next folder";
-	ot->idname= "FILE_OT_next";
+	ot->name = "Next Folder";
+	ot->description = "Move to next folder";
+	ot->idname = "FILE_OT_next";
 	
 	/* api callbacks */
-	ot->exec= file_next_exec;
-	ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
+	ot->exec = file_next_exec;
+	ot->poll = ED_operator_file_active; /* <- important, handler is on window level */
 }
 
 int file_next_exec(bContext *C, wmOperator *UNUSED(unused))
 {
 	SpaceFile *sfile= CTX_wm_space_file(C);
-	if(sfile->params) {
+	if (sfile->params) {
 		if (!sfile->folders_next)
 			sfile->folders_next = folderlist_new();
 
@@ -899,7 +905,7 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
 	int i;
 
 	/* escape if not our timer */
-	if(sfile->smoothscroll_timer==NULL || sfile->smoothscroll_timer!=event->customdata)
+	if (sfile->smoothscroll_timer==NULL || sfile->smoothscroll_timer!=event->customdata)
 		return OPERATOR_PASS_THROUGH;
 	
 	numfiles = filelist_numfiles(sfile->files);
@@ -936,7 +942,8 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
 		if (sfile->layout->flag & FILE_LAYOUT_HOR) {
 			sfile->scroll_offset = (edit_idx/sfile->layout->rows)*sfile->layout->rows;
 			if (sfile->scroll_offset <= offset) sfile->scroll_offset -= sfile->layout->rows;
-		} else {
+		}
+		else {
 			sfile->scroll_offset = (edit_idx/sfile->layout->columns)*sfile->layout->columns;
 			if (sfile->scroll_offset <= offset) sfile->scroll_offset -= sfile->layout->columns;
 		}
@@ -959,14 +966,17 @@ static int file_smoothscroll_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
 	if (sfile->scroll_offset < offset) {
 		if (sfile->layout->flag & FILE_LAYOUT_HOR) {
 			WM_operator_name_call(C, "VIEW2D_OT_scroll_left", 0, NULL);
-		} else {
+		}
+		else {
 			WM_operator_name_call(C, "VIEW2D_OT_scroll_up", 0, NULL);
 		}
 		
-	} else {
+	}
+	else {
 		if (sfile->layout->flag & FILE_LAYOUT_HOR) {
 			WM_operator_name_call(C, "VIEW2D_OT_scroll_right", 0, NULL);
-		} else {
+		}
+		else {
 			WM_operator_name_call(C, "VIEW2D_OT_scroll_down", 0, NULL);
 		}
 	}
@@ -984,20 +994,20 @@ void FILE_OT_smoothscroll(wmOperatorType *ot)
 {
 	
 	/* identifiers */
-	ot->name= "Smooth Scroll";
-	ot->idname= "FILE_OT_smoothscroll";
-	ot->description="Smooth scroll to make editable file visible";
+	ot->name = "Smooth Scroll";
+	ot->idname = "FILE_OT_smoothscroll";
+	ot->description = "Smooth scroll to make editable file visible";
 	
 	/* api callbacks */
-	ot->invoke= file_smoothscroll_invoke;
+	ot->invoke = file_smoothscroll_invoke;
 	
-	ot->poll= ED_operator_file_active;
+	ot->poll = ED_operator_file_active;
 }
 
 
 /* create a new, non-existing folder name, returns 1 if successful, 0 if name couldn't be created.
-   The actual name is returned in 'name', 'folder' contains the complete path, including the new folder name.
-*/
+ * The actual name is returned in 'name', 'folder' contains the complete path, including the new folder name.
+ */
 static int new_folder_path(const char* parent, char *folder, char *name)
 {
 	int i = 1;
@@ -1006,8 +1016,8 @@ static int new_folder_path(const char* parent, char *folder, char *name)
 	BLI_strncpy(name, "New Folder", FILE_MAXFILE);
 	BLI_join_dirfile(folder, FILE_MAX, parent, name); /* XXX, not real length */
 	/* check whether folder with the name already exists, in this case
-	   add number to the name. Check length of generated name to avoid
-	   crazy case of huge number of folders each named 'New Folder (x)' */
+	 * add number to the name. Check length of generated name to avoid
+	 * crazy case of huge number of folders each named 'New Folder (x)' */
 	while (BLI_exists(folder) && (len<FILE_MAXFILE)) {
 		len = BLI_snprintf(name, FILE_MAXFILE, "New Folder(%d)", i);
 		BLI_join_dirfile(folder, FILE_MAX, parent, name); /* XXX, not real length */
@@ -1025,14 +1035,14 @@ int file_directory_new_exec(bContext *C, wmOperator *op)
 
 	SpaceFile *sfile= CTX_wm_space_file(C);
 	
-	if(!sfile->params) {
+	if (!sfile->params) {
 		BKE_report(op->reports,RPT_WARNING, "No parent directory given");
 		return OPERATOR_CANCELLED;
 	}
 	
 	path[0] = '\0';
 
-	if(RNA_struct_find_property(op->ptr, "directory")) {
+	if (RNA_struct_find_property(op->ptr, "directory")) {
 		RNA_string_get(op->ptr, "directory", path);
 		if (path[0] != '\0') generate_name= 0;
 	}
@@ -1071,14 +1081,14 @@ int file_directory_new_exec(bContext *C, wmOperator *op)
 void FILE_OT_directory_new(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Create New Directory";
-	ot->description= "Create a new directory";
-	ot->idname= "FILE_OT_directory_new";
+	ot->name = "Create New Directory";
+	ot->description = "Create a new directory";
+	ot->idname = "FILE_OT_directory_new";
 	
 	/* api callbacks */
-	ot->invoke= WM_operator_confirm;
-	ot->exec= file_directory_new_exec;
-	ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
+	ot->invoke = WM_operator_confirm;
+	ot->exec = file_directory_new_exec;
+	ot->poll = ED_operator_file_active; /* <- important, handler is on window level */
 
 	RNA_def_string_dir_path(ot->srna, "directory", "", FILE_MAX, "Directory", "Name of new directory");
 
@@ -1089,7 +1099,7 @@ static void file_expand_directory(bContext *C)
 {
 	SpaceFile *sfile= CTX_wm_space_file(C);
 	
-	if(sfile->params) {
+	if (sfile->params) {
 		if ( sfile->params->dir[0] == '~' ) {
 			char tmpstr[sizeof(sfile->params->dir)-1];
 			BLI_strncpy(tmpstr, sfile->params->dir+1, sizeof(tmpstr));
@@ -1123,7 +1133,7 @@ static int file_directory_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev
 {
 	SpaceFile *sfile= CTX_wm_space_file(C);
 
-	if(sfile->params) {
+	if (sfile->params) {
 		file_expand_directory(C);
 		
 		if (!BLI_exists(sfile->params->dir)) {
@@ -1142,7 +1152,7 @@ int file_directory_exec(bContext *C, wmOperator *UNUSED(unused))
 {
 	SpaceFile *sfile= CTX_wm_space_file(C);
 	
-	if(sfile->params) {
+	if (sfile->params) {
 		file_expand_directory(C);
 
 		if (!BLI_exists(sfile->params->dir)) {
@@ -1150,7 +1160,7 @@ int file_directory_exec(bContext *C, wmOperator *UNUSED(unused))
 		}
 
 		/* special case, user may have pasted a filepath into the directory */
-		if(BLI_is_file(sfile->params->dir)) {
+		if (BLI_is_file(sfile->params->dir)) {
 			char path[sizeof(sfile->params->dir)];
 			BLI_strncpy(path, sfile->params->dir, sizeof(path));
 			BLI_split_dirfile(path, sfile->params->dir, sfile->params->file, sizeof(sfile->params->dir), sizeof(sfile->params->file));
@@ -1171,9 +1181,8 @@ int file_filename_exec(bContext *C, wmOperator *UNUSED(unused))
 {
 	SpaceFile *sfile= CTX_wm_space_file(C);
 	
-	if(sfile->params) {
-		if (file_select_match(sfile, sfile->params->file))
-		{
+	if (sfile->params) {
+		if (file_select_match(sfile, sfile->params->file)) {
 			sfile->params->file[0] = '\0';
 			WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
 		}
@@ -1194,33 +1203,33 @@ static int file_directory_poll(bContext *C)
 void FILE_OT_directory(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Enter Directory Name";
-	ot->description= "Enter a directory name";
-	ot->idname= "FILE_OT_directory";
+	ot->name = "Enter Directory Name";
+	ot->description = "Enter a directory name";
+	ot->idname = "FILE_OT_directory";
 	
 	/* api callbacks */
-	ot->invoke= file_directory_invoke;
-	ot->exec= file_directory_exec;
-	ot->poll= file_directory_poll; /* <- important, handler is on window level */
+	ot->invoke = file_directory_invoke;
+	ot->exec = file_directory_exec;
+	ot->poll = file_directory_poll; /* <- important, handler is on window level */
 }
 
 void FILE_OT_refresh(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Refresh Filelist";
-	ot->description= "Refresh the file list";
-	ot->idname= "FILE_OT_refresh";
+	ot->name = "Refresh Filelist";
+	ot->description = "Refresh the file list";
+	ot->idname = "FILE_OT_refresh";
 	
 	/* api callbacks */
-	ot->exec= file_refresh_exec;
-	ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
+	ot->exec = file_refresh_exec;
+	ot->poll = ED_operator_file_active; /* <- important, handler is on window level */
 }
 
 static int file_hidedot_exec(bContext *C, wmOperator *UNUSED(unused))
 {
 	SpaceFile *sfile= CTX_wm_space_file(C);
 	
-	if(sfile->params) {
+	if (sfile->params) {
 		sfile->params->flag ^= FILE_HIDE_DOT;
 		ED_fileselect_clear(C, sfile);
 		WM_event_add_notifier(C, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
@@ -1233,30 +1242,30 @@ static int file_hidedot_exec(bContext *C, wmOperator *UNUSED(unused))
 void FILE_OT_hidedot(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Toggle Hide Dot Files";
-	ot->description= "Toggle hide hidden dot files";
-	ot->idname= "FILE_OT_hidedot";
+	ot->name = "Toggle Hide Dot Files";
+	ot->description = "Toggle hide hidden dot files";
+	ot->idname = "FILE_OT_hidedot";
 	
 	/* api callbacks */
-	ot->exec= file_hidedot_exec;
-	ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
+	ot->exec = file_hidedot_exec;
+	ot->poll = ED_operator_file_active; /* <- important, handler is on window level */
 }
 
 struct ARegion *file_buttons_region(struct ScrArea *sa)
 {
 	ARegion *ar, *arnew;
 	
-	for(ar= sa->regionbase.first; ar; ar= ar->next)
-		if(ar->regiontype==RGN_TYPE_CHANNELS)
+	for (ar= sa->regionbase.first; ar; ar= ar->next)
+		if (ar->regiontype==RGN_TYPE_CHANNELS)
 			return ar;
 
 	/* add subdiv level; after header */
-	for(ar= sa->regionbase.first; ar; ar= ar->next)
-		if(ar->regiontype==RGN_TYPE_HEADER)
+	for (ar= sa->regionbase.first; ar; ar= ar->next)
+		if (ar->regiontype==RGN_TYPE_HEADER)
 			break;
 	
 	/* is error! */
-	if(ar==NULL) return NULL;
+	if (ar==NULL) return NULL;
 	
 	arnew= MEM_callocN(sizeof(ARegion), "buttons for file panels");
 	
@@ -1274,7 +1283,7 @@ static int file_bookmark_toggle_exec(bContext *C, wmOperator *UNUSED(unused))
 	ScrArea *sa= CTX_wm_area(C);
 	ARegion *ar= file_buttons_region(sa);
 	
-	if(ar)
+	if (ar)
 		ED_region_toggle_hidden(C, ar);
 
 	return OPERATOR_FINISHED;
@@ -1283,13 +1292,13 @@ static int file_bookmark_toggle_exec(bContext *C, wmOperator *UNUSED(unused))
 void FILE_OT_bookmark_toggle(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Toggle Bookmarks";
-	ot->description= "Toggle bookmarks display";
-	ot->idname= "FILE_OT_bookmark_toggle";
+	ot->name = "Toggle Bookmarks";
+	ot->description = "Toggle bookmarks display";
+	ot->idname = "FILE_OT_bookmark_toggle";
 	
 	/* api callbacks */
-	ot->exec= file_bookmark_toggle_exec;
-	ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
+	ot->exec = file_bookmark_toggle_exec;
+	ot->poll = ED_operator_file_active; /* <- important, handler is on window level */
 }
 
 
@@ -1299,7 +1308,7 @@ static int file_filenum_exec(bContext *C, wmOperator *op)
 	ScrArea *sa= CTX_wm_area(C);
 	
 	int inc = RNA_int_get(op->ptr, "increment");
-	if(sfile->params && (inc != 0)) {
+	if (sfile->params && (inc != 0)) {
 		BLI_newname(sfile->params->file, inc);
 		ED_area_tag_redraw(sa);
 		file_draw_check_cb(C, NULL, NULL);
@@ -1313,13 +1322,13 @@ static int file_filenum_exec(bContext *C, wmOperator *op)
 void FILE_OT_filenum(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Increment Number in Filename";
-	ot->description= "Increment number in filename";
-	ot->idname= "FILE_OT_filenum";
+	ot->name = "Increment Number in Filename";
+	ot->description = "Increment number in filename";
+	ot->idname = "FILE_OT_filenum";
 	
 	/* api callbacks */
-	ot->exec= file_filenum_exec;
-	ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
+	ot->exec = file_filenum_exec;
+	ot->poll = ED_operator_file_active; /* <- important, handler is on window level */
 
 	/* props */
 	RNA_def_int(ot->srna, "increment", 1, -100, 100, "Increment", "", -100,100);
@@ -1330,7 +1339,7 @@ static int file_rename_exec(bContext *C, wmOperator *UNUSED(op))
 	ScrArea *sa= CTX_wm_area(C);
 	SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
 	
-	if(sfile->params) {
+	if (sfile->params) {
 		int idx = sfile->params->active_file;
 		int numfiles = filelist_numfiles(sfile->files);
 		if ( (0<=idx) && (idx<numfiles) ) {
@@ -1354,7 +1363,8 @@ static int file_rename_poll(bContext *C)
 	if (sfile && sfile->params) {
 		if (sfile->params->active_file < 0) { 
 			poll= 0;
-		} else {
+		}
+		else {
 			char dir[FILE_MAX], group[FILE_MAX];	
 			if (filelist_islibrary(sfile->files, dir, group)) poll= 0;
 		}
@@ -1367,13 +1377,13 @@ static int file_rename_poll(bContext *C)
 void FILE_OT_rename(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Rename File or Directory";
-	ot->description= "Rename file or file directory";
-	ot->idname= "FILE_OT_rename";
+	ot->name = "Rename File or Directory";
+	ot->description = "Rename file or file directory";
+	ot->idname = "FILE_OT_rename";
 	
 	/* api callbacks */
-	ot->exec= file_rename_exec;
-	ot->poll= file_rename_poll; 
+	ot->exec = file_rename_exec;
+	ot->poll = file_rename_poll; 
 
 }
 
@@ -1386,7 +1396,8 @@ static int file_delete_poll(bContext *C)
 	if (sfile && sfile->params) {
 		if (sfile->params->active_file < 0) { 
 			poll= 0;
-		} else {
+		}
+		else {
 			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);
@@ -1419,14 +1430,14 @@ int file_delete_exec(bContext *C, wmOperator *UNUSED(op))
 void FILE_OT_delete(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete File";
-	ot->description= "Delete selected file";
-	ot->idname= "FILE_OT_delete";
+	ot->name = "Delete File";
+	ot->description = "Delete selected file";
+	ot->idname = "FILE_OT_delete";
 	
 	/* api callbacks */
-	ot->invoke= WM_operator_confirm;
-	ot->exec= file_delete_exec;
-	ot->poll= file_delete_poll; /* <- important, handler is on window level */
+	ot->invoke = WM_operator_confirm;
+	ot->exec = file_delete_exec;
+	ot->poll = file_delete_poll; /* <- important, handler is on window level */
 }
 
 
diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c
index 26083cb..596721b 100644
--- a/source/blender/editors/space_file/file_panels.c
+++ b/source/blender/editors/space_file/file_panels.c
@@ -80,7 +80,7 @@ static void file_panel_category(const bContext *C, Panel *pa, FSMenuCategory cat
 	*nr= -1;
 
 	/* hide if no entries */
-	if(nentries == 0)
+	if (nentries == 0)
 		return;
 
 	/* layout */
@@ -100,8 +100,8 @@ static void file_panel_category(const bContext *C, Panel *pa, FSMenuCategory cat
 		entry = fsmenu_get_entry(fsmenu, category, i);
 		
 		/* set this list item as active if we have a match */
-		if(sfile->params) {
-			if(BLI_path_cmp(sfile->params->dir, entry) == 0) {
+		if (sfile->params) {
+			if (BLI_path_cmp(sfile->params->dir, entry) == 0) {
 				*nr= i;
 			}
 		}
@@ -112,16 +112,16 @@ static void file_panel_category(const bContext *C, Panel *pa, FSMenuCategory cat
 		BLI_getlastdir(temp, dir, FILE_MAX);
 		BLI_del_slash(dir);
 
-		if(dir[0] == 0)
+		if (dir[0] == 0)
 			BLI_strncpy(dir, entry, FILE_MAX);
 
 		/* create list item */
-		but= uiDefIconTextButS(block, LISTROW, 0, icon, dir, 0,0,UI_UNIT_X*10,UI_UNIT_Y, nr, 0, i, 0, 0, entry);
+		but = uiDefIconTextButS(block, LISTROW, 0, icon, dir, 0,0,UI_UNIT_X*10,UI_UNIT_Y, nr, 0, i, 0, 0, entry);
 		uiButSetFunc(but, file_panel_cb, entry, NULL);
 		uiButSetFlag(but, UI_ICON_LEFT|UI_TEXT_LEFT);
 
 		/* create delete button */
-		if(allow_delete && fsmenu_can_save(fsmenu, category, i)) {
+		if (allow_delete && fsmenu_can_save(fsmenu, category, i)) {
 			uiBlockSetEmboss(block, UI_EMBOSSN);
 			uiItemIntO(layout, "", ICON_X, "FILE_OT_delete_bookmark", "index", i);
 			uiBlockSetEmboss(block, UI_EMBOSS);
@@ -133,7 +133,7 @@ static void file_panel_system(const bContext *C, Panel *pa)
 {
 	SpaceFile *sfile= CTX_wm_space_file(C);
 
-	if(sfile)
+	if (sfile)
 		file_panel_category(C, pa, FS_CATEGORY_SYSTEM, &sfile->systemnr, ICON_DISK_DRIVE, 0, 0);
 }
 
@@ -142,7 +142,7 @@ static void file_panel_bookmarks(const bContext *C, Panel *pa)
 	SpaceFile *sfile= CTX_wm_space_file(C);
 	uiLayout *row;
 
-	if(sfile) {
+	if (sfile) {
 		row= uiLayoutRow(pa->layout, 0);
 		uiItemO(row, IFACE_("Add"), ICON_ZOOMIN, "file.bookmark_add");
 		uiItemL(row, NULL, ICON_NONE);
@@ -155,7 +155,7 @@ static void file_panel_recent(const bContext *C, Panel *pa)
 {
 	SpaceFile *sfile= CTX_wm_space_file(C);
 
-	if(sfile) {
+	if (sfile) {
 		if ( !(U.uiflag & USER_HIDE_RECENT) ) {
 			file_panel_category(C, pa, FS_CATEGORY_RECENT, &sfile->recentnr, ICON_FILE_FOLDER, 0, 1);
 		}
@@ -205,25 +205,25 @@ void file_panels_register(ARegionType *art)
 
 	pt= MEM_callocN(sizeof(PanelType), "spacetype file system directories");
 	strcpy(pt->idname, "FILE_PT_system");
-	strcpy(pt->label, "System");
+	strcpy(pt->label, N_("System"));
 	pt->draw= file_panel_system;
 	BLI_addtail(&art->paneltypes, pt);
 
 	pt= MEM_callocN(sizeof(PanelType), "spacetype file bookmarks");
 	strcpy(pt->idname, "FILE_PT_bookmarks");
-	strcpy(pt->label, "Bookmarks");
+	strcpy(pt->label, N_("Bookmarks"));
 	pt->draw= file_panel_bookmarks;
 	BLI_addtail(&art->paneltypes, pt);
 
 	pt= MEM_callocN(sizeof(PanelType), "spacetype file recent directories");
 	strcpy(pt->idname, "FILE_PT_recent");
-	strcpy(pt->label, "Recent");
+	strcpy(pt->label, N_("Recent"));
 	pt->draw= file_panel_recent;
 	BLI_addtail(&art->paneltypes, pt);
 
 	pt= MEM_callocN(sizeof(PanelType), "spacetype file operator properties");
 	strcpy(pt->idname, "FILE_PT_operator");
-	strcpy(pt->label, "Operator");
+	strcpy(pt->label, N_("Operator"));
 	pt->poll= file_panel_operator_poll;
 	pt->draw_header= file_panel_operator_header;
 	pt->draw= file_panel_operator;
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index b5059d1..45a271c 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -50,7 +50,7 @@
 #include "BLI_utildefines.h"
 
 #ifdef WIN32
-#include "BLI_winstuff.h"
+#  include "BLI_winstuff.h"
 #endif
 
 #include "BKE_context.h"
@@ -158,24 +158,26 @@ static int compare_name(const void *a1, const void *a2)
 
 	/* type is equal to stat.st_mode */
 
-	if (S_ISDIR(entry1->type)){
+	if (S_ISDIR(entry1->type)) {
 		if (S_ISDIR(entry2->type)==0) return (-1);
-	} else{
+	}
+	else {
 		if (S_ISDIR(entry2->type)) return (1);
 	}
-	if (S_ISREG(entry1->type)){
+	if (S_ISREG(entry1->type)) {
 		if (S_ISREG(entry2->type)==0) return (-1);
-	} else{
+	}
+	else {
 		if (S_ISREG(entry2->type)) return (1);
 	}
 	if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
 	if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
 	
 	/* make sure "." and ".." are always first */
-	if( strcmp(entry1->relname, ".")==0 ) return (-1);
-	if( strcmp(entry2->relname, ".")==0 ) return (1);
-	if( strcmp(entry1->relname, "..")==0 ) return (-1);
-	if( strcmp(entry2->relname, "..")==0 ) return (1);
+	if ( strcmp(entry1->relname, ".")==0 ) return (-1);
+	if ( strcmp(entry2->relname, ".")==0 ) return (1);
+	if ( strcmp(entry1->relname, "..")==0 ) return (-1);
+	if ( strcmp(entry2->relname, "..")==0 ) return (1);
 	
 	return (BLI_natstrcmp(entry1->relname,entry2->relname));
 }
@@ -186,24 +188,26 @@ static int compare_date(const void *a1, const void *a2)
 	
 	/* type is equal to stat.st_mode */
 
-	if (S_ISDIR(entry1->type)){
+	if (S_ISDIR(entry1->type)) {
 		if (S_ISDIR(entry2->type)==0) return (-1);
-	} else{
+	}
+	else {
 		if (S_ISDIR(entry2->type)) return (1);
 	}
-	if (S_ISREG(entry1->type)){
+	if (S_ISREG(entry1->type)) {
 		if (S_ISREG(entry2->type)==0) return (-1);
-	} else{
+	}
+	else {
 		if (S_ISREG(entry2->type)) return (1);
 	}
 	if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
 	if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
 
 	/* make sure "." and ".." are always first */
-	if( strcmp(entry1->relname, ".")==0 ) return (-1);
-	if( strcmp(entry2->relname, ".")==0 ) return (1);
-	if( strcmp(entry1->relname, "..")==0 ) return (-1);
-	if( strcmp(entry2->relname, "..")==0 ) return (1);
+	if ( strcmp(entry1->relname, ".")==0 ) return (-1);
+	if ( strcmp(entry2->relname, ".")==0 ) return (1);
+	if ( strcmp(entry1->relname, "..")==0 ) return (-1);
+	if ( strcmp(entry2->relname, "..")==0 ) return (1);
 	
 	if ( entry1->s.st_mtime < entry2->s.st_mtime) return 1;
 	if ( entry1->s.st_mtime > entry2->s.st_mtime) return -1;
@@ -217,24 +221,26 @@ static int compare_size(const void *a1, const void *a2)
 
 	/* type is equal to stat.st_mode */
 
-	if (S_ISDIR(entry1->type)){
+	if (S_ISDIR(entry1->type)) {
 		if (S_ISDIR(entry2->type)==0) return (-1);
-	} else{
+	}
+	else {
 		if (S_ISDIR(entry2->type)) return (1);
 	}
-	if (S_ISREG(entry1->type)){
+	if (S_ISREG(entry1->type)) {
 		if (S_ISREG(entry2->type)==0) return (-1);
-	} else{
+	}
+	else {
 		if (S_ISREG(entry2->type)) return (1);
 	}
 	if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
 	if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
 
 	/* make sure "." and ".." are always first */
-	if( strcmp(entry1->relname, ".")==0 ) return (-1);
-	if( strcmp(entry2->relname, ".")==0 ) return (1);
-	if( strcmp(entry1->relname, "..")==0 ) return (-1);
-	if( strcmp(entry2->relname, "..")==0 ) return (1);
+	if ( strcmp(entry1->relname, ".")==0 ) return (-1);
+	if ( strcmp(entry2->relname, ".")==0 ) return (1);
+	if ( strcmp(entry1->relname, "..")==0 ) return (-1);
+	if ( strcmp(entry2->relname, "..")==0 ) return (1);
 	
 	if ( entry1->s.st_size < entry2->s.st_size) return 1;
 	if ( entry1->s.st_size > entry2->s.st_size) return -1;
@@ -256,24 +262,26 @@ static int compare_extension(const void *a1, const void *a2)
 
 	/* type is equal to stat.st_mode */
 
-	if (S_ISDIR(entry1->type)){
+	if (S_ISDIR(entry1->type)) {
 		if (S_ISDIR(entry2->type)==0) return (-1);
-	} else{
+	}
+	else {
 		if (S_ISDIR(entry2->type)) return (1);
 	}
-	if (S_ISREG(entry1->type)){
+	if (S_ISREG(entry1->type)) {
 		if (S_ISREG(entry2->type)==0) return (-1);
-	} else{
+	}
+	else {
 		if (S_ISREG(entry2->type)) return (1);
 	}
 	if ((entry1->type & S_IFMT) < (entry2->type & S_IFMT)) return (-1);
 	if ((entry1->type & S_IFMT) > (entry2->type & S_IFMT)) return (1);
 	
 	/* make sure "." and ".." are always first */
-	if( strcmp(entry1->relname, ".")==0 ) return (-1);
-	if( strcmp(entry2->relname, ".")==0 ) return (1);
-	if( strcmp(entry1->relname, "..")==0 ) return (-1);
-	if( strcmp(entry2->relname, "..")==0 ) return (1);
+	if ( strcmp(entry1->relname, ".")==0 ) return (-1);
+	if ( strcmp(entry2->relname, ".")==0 ) return (1);
+	if ( strcmp(entry1->relname, "..")==0 ) return (-1);
+	if ( strcmp(entry2->relname, "..")==0 ) return (1);
 	
 	return (BLI_strcasecmp(sufix1, sufix2));
 }
@@ -283,17 +291,20 @@ static int is_hidden_file(const char* filename, short hide_dot)
 	int is_hidden=0;
 
 	if (hide_dot) {
-		if(filename[0]=='.' && filename[1]!='.' && filename[1]!=0) {
+		if (filename[0]=='.' && filename[1]!='.' && filename[1]!=0) {
 			is_hidden=1; /* ignore .file */
-		} else if (((filename[0] == '.') && (filename[1] == 0) )) {
+		}
+		else if (((filename[0] == '.') && (filename[1] == 0) )) {
 			is_hidden=1; /* ignore . */
-		} else {
+		}
+		else {
 			int len=strlen(filename);
-			if( (len>0) && (filename[len-1]=='~') ) {
+			if ( (len>0) && (filename[len-1]=='~') ) {
 				is_hidden=1;  /* ignore file~ */
 			}
 		} 
-	} else {
+	}
+	else {
 		if (((filename[0] == '.') && (filename[1] == 0) )) {
 			is_hidden=1; /* ignore . */
 		}
@@ -307,12 +318,14 @@ static int is_filtered_file(struct direntry* file, const char* UNUSED(dir), unsi
 	if (filter) {
 		if (file->flags & filter) {
 			is_filtered=1;
-		} else if (file->type & S_IFDIR) {
+		}
+		else if (file->type & S_IFDIR) {
 			if (filter & FOLDERFILE) {
 				is_filtered = 1;
 			}
 		}
-	} else {
+	}
+	else {
 		is_filtered = 1;
 	}
 	return is_filtered && !is_hidden_file(file->relname, hide_dot);
@@ -324,7 +337,8 @@ static int is_filtered_lib(struct direntry* file, const char* dir, unsigned int
 	char tdir[FILE_MAX], tgroup[GROUP_MAX];
 	if (BLO_is_a_library(dir, tdir, tgroup)) {
 		is_filtered = !is_hidden_file(file->relname, hide_dot);
-	} else {
+	}
+	else {
 		is_filtered = is_filtered_file(file, dir, filter, hide_dot);
 	}
 	return is_filtered;
@@ -415,13 +429,13 @@ void folderlist_popdir(struct ListBase* folderlist, char *dir)
 	struct FolderList *folder;
 	folder = folderlist->last;
 
-	if(folder){
+	if (folder) {
 		// remove the current directory
 		MEM_freeN(folder->foldername);
 		BLI_freelinkN(folderlist, folder);
 
 		folder = folderlist->last;
-		if(folder){
+		if (folder) {
 			prev_dir = folder->foldername;
 			BLI_strncpy(dir, prev_dir, FILE_MAXDIR);
 		}
@@ -435,8 +449,8 @@ void folderlist_pushdir(ListBase* folderlist, const char *dir)
 	previous_folder = folderlist->last;
 
 	// check if already exists
-	if(previous_folder && previous_folder->foldername){
-		if(BLI_path_cmp(previous_folder->foldername, dir)==0){
+	if (previous_folder && previous_folder->foldername) {
+		if (BLI_path_cmp(previous_folder->foldername, dir)==0) {
 			return;
 		}
 	}
@@ -472,9 +486,9 @@ int folderlist_clear_next(struct SpaceFile *sfile)
 /* not listbase itself */
 void folderlist_free(ListBase* folderlist)
 {
-	if (folderlist){
+	if (folderlist) {
 		FolderList *folder;
-		for(folder= folderlist->first; folder; folder= folder->next)
+		for (folder= folderlist->first; folder; folder= folder->next)
 			MEM_freeN(folder->foldername);
 		BLI_freelistN(folderlist);
 	}
@@ -489,7 +503,7 @@ ListBase *folderlist_duplicate(ListBase* folderlist)
 		
 		BLI_duplicatelist(folderlistn, folderlist);
 		
-		for(folder= folderlistn->first; folder; folder= folder->next) {
+		for (folder= folderlistn->first; folder; folder= folder->next) {
 			folder->foldername= MEM_dupallocN(folder->foldername);
 		}
 		return folderlistn;
@@ -564,7 +578,7 @@ void filelist_free(struct FileList* filelist)
 
 void filelist_freelib(struct FileList* filelist)
 {
-	if(filelist->libfiledata)	
+	if (filelist->libfiledata)
 		BLO_blendhandle_close(filelist->libfiledata);
 	filelist->libfiledata= NULL;
 }
@@ -626,28 +640,37 @@ struct ImBuf * filelist_geticon(struct FileList* filelist, int index)
 	if (file->type & S_IFDIR) {
 		if ( strcmp(filelist->filelist[fidx].relname, "..") == 0) {
 			ibuf = gSpecialFileImages[SPECIAL_IMG_PARENT];
-		} else if  ( strcmp(filelist->filelist[fidx].relname, ".") == 0) {
+		}
+		else if (strcmp(filelist->filelist[fidx].relname, ".") == 0) {
 			ibuf = gSpecialFileImages[SPECIAL_IMG_REFRESH];
-		} else {
+		}
+		else {
 			ibuf = gSpecialFileImages[SPECIAL_IMG_FOLDER];
 		}
-	} else {
+	}
+	else {
 		ibuf = gSpecialFileImages[SPECIAL_IMG_UNKNOWNFILE];
 	}
 
 	if (file->flags & BLENDERFILE) {
 		ibuf = gSpecialFileImages[SPECIAL_IMG_BLENDFILE];
-	} else if ( (file->flags & MOVIEFILE) || (file->flags & MOVIEFILE_ICON) ) {
+	}
+	else if ( (file->flags & MOVIEFILE) || (file->flags & MOVIEFILE_ICON) ) {
 		ibuf = gSpecialFileImages[SPECIAL_IMG_MOVIEFILE];
-	} else if (file->flags & SOUNDFILE) {
+	}
+	else if (file->flags & SOUNDFILE) {
 		ibuf = gSpecialFileImages[SPECIAL_IMG_SOUNDFILE];
-	} else if (file->flags & PYSCRIPTFILE) {
+	}
+	else if (file->flags & PYSCRIPTFILE) {
 		ibuf = gSpecialFileImages[SPECIAL_IMG_PYTHONFILE];
-	} else if (file->flags & FTFONTFILE) {
+	}
+	else if (file->flags & FTFONTFILE) {
 		ibuf = gSpecialFileImages[SPECIAL_IMG_FONTFILE];
-	} else if (file->flags & TEXTFILE) {
+	}
+	else if (file->flags & TEXTFILE) {
 		ibuf = gSpecialFileImages[SPECIAL_IMG_TEXTFILE];
-	} else if (file->flags & IMAGEFILE) {
+	}
+	else if (file->flags & IMAGEFILE) {
 		ibuf = gSpecialFileImages[SPECIAL_IMG_LOADING];
 	}
 
@@ -677,7 +700,7 @@ int filelist_find(struct FileList* filelist, const char *filename)
 
 	
 	for (i = 0; i < filelist->numfiles; ++i) {
-		if ( strcmp(filelist->filelist[i].relname, filename) == 0) { /* not dealing with user input so dont need BLI_path_cmp */
+		if ( strcmp(filelist->filelist[i].relname, filename) == 0) { /* not dealing with user input so don't need BLI_path_cmp */
 			index = i;
 			break;
 		}
@@ -715,17 +738,17 @@ static int file_is_blend_backup(const char *str)
 	a= strlen(str);
 	b= 7;
 	
-	if(a==0 || b>=a);
+	if (a==0 || b>=a);
 	else {
 		char *loc;
 		
-		if(a > b+1)
+		if (a > b+1)
 			b++;
 		
 		/* allow .blend1 .blend2 .blend32 */
 		loc= BLI_strcasestr(str+a-b, ".blend");
 		
-		if(loc)
+		if (loc)
 			retval= 1;
 	}
 	
@@ -735,32 +758,44 @@ static int file_is_blend_backup(const char *str)
 
 static int file_extension_type(const char *relname)
 {
-	if(BLO_has_bfile_extension(relname)) {
+	if (BLO_has_bfile_extension(relname)) {
 		return BLENDERFILE;
-	} else if(file_is_blend_backup(relname)) {
+	}
+	else if (file_is_blend_backup(relname)) {
 		return BLENDERFILE_BACKUP;
-	} else if(BLI_testextensie(relname, ".py")) {
+	}
+	else if (BLI_testextensie(relname, ".py")) {
 		return PYSCRIPTFILE;
-	} else if(BLI_testextensie(relname, ".txt")
-			  || BLI_testextensie(relname, ".glsl")
-			  || BLI_testextensie(relname, ".data")) {
+	}
+	else if (BLI_testextensie(relname, ".txt")  ||
+	         BLI_testextensie(relname, ".glsl") ||
+	         BLI_testextensie(relname, ".data"))
+	{
 		return TEXTFILE;
-	} else if( BLI_testextensie(relname, ".ttf")
-			  || BLI_testextensie(relname, ".ttc")
-			  || BLI_testextensie(relname, ".pfb")
-			  || BLI_testextensie(relname, ".otf")
-			  || BLI_testextensie(relname, ".otc")) {
+	}
+	else if (BLI_testextensie(relname, ".ttf") ||
+	         BLI_testextensie(relname, ".ttc") ||
+	         BLI_testextensie(relname, ".pfb") ||
+	         BLI_testextensie(relname, ".otf") ||
+	         BLI_testextensie(relname, ".otc"))
+	{
 		return FTFONTFILE;			
-	} else if(BLI_testextensie(relname, ".btx")) {
+	}
+	else if (BLI_testextensie(relname, ".btx")) {
 		return BTXFILE;
-	} else if(BLI_testextensie(relname, ".dae")) {
+	}
+	else if (BLI_testextensie(relname, ".dae")) {
 		return COLLADAFILE;
-	} else if(BLI_testextensie_array(relname, imb_ext_image)
-			  || (G.have_quicktime && BLI_testextensie_array(relname, imb_ext_image_qt))) {
+	}
+	else if (BLI_testextensie_array(relname, imb_ext_image) ||
+	         (G.have_quicktime && BLI_testextensie_array(relname, imb_ext_image_qt)))
+	{
 		return IMAGEFILE;			
-	} else if(BLI_testextensie_array(relname, imb_ext_movie)) {
+	}
+	else if (BLI_testextensie_array(relname, imb_ext_movie)) {
 		return MOVIEFILE;			
-	} else if(BLI_testextensie_array(relname, imb_ext_audio)) {
+	}
+	else if (BLI_testextensie_array(relname, imb_ext_audio)) {
 		return SOUNDFILE;
 	} 
 	return 0;
@@ -797,7 +832,7 @@ static void filelist_setfiletypes(struct FileList* filelist)
 	
 	file= filelist->filelist;
 	
-	for(num=0; num<filelist->numfiles; num++, file++) {
+	for (num=0; num<filelist->numfiles; num++, file++) {
 		file->type= file->s.st_mode;	/* restore the mess below */ 
 		
 		/* Don't check extensions for directories */ 
@@ -806,8 +841,9 @@ static void filelist_setfiletypes(struct FileList* filelist)
 		}
 		file->flags = file_extension_type(file->relname);
 		
-		if(filelist->filter_glob
-		   && BLI_testextensie_glob(file->relname, filelist->filter_glob)) {
+		if (filelist->filter_glob &&
+		    BLI_testextensie_glob(file->relname, filelist->filter_glob))
+		{
 			file->flags= OPERATORFILE;
 		}
 		
@@ -827,7 +863,7 @@ static void filelist_read_dir(struct FileList* filelist)
 	BLI_cleanup_dir(G.main->name, filelist->dir);
 	filelist->numfiles = BLI_dir_contents(filelist->dir, &(filelist->filelist));
 
-	if(!chdir(wdir)) {} /* fix warning about not checking return value */
+	if (!chdir(wdir)) {} /* fix warning about not checking return value */
 	filelist_setfiletypes(filelist);
 	filelist_filter(filelist);
 }
@@ -843,15 +879,15 @@ static void filelist_read_library(struct FileList* filelist)
 	if (!filelist) return;
 	BLI_cleanup_dir(G.main->name, filelist->dir);
 	filelist_from_library(filelist);
-	if(!filelist->libfiledata) {
+	if (!filelist->libfiledata) {
 		int num;
 		struct direntry *file;
 
 		BLI_make_exist(filelist->dir);
 		filelist_read_dir(filelist);
 		file = filelist->filelist;
-		for(num=0; num<filelist->numfiles; num++, file++) {
-			if(BLO_has_bfile_extension(file->relname)) {
+		for (num=0; num<filelist->numfiles; num++, file++) {
+			if (BLO_has_bfile_extension(file->relname)) {
 				char name[FILE_MAX];
 
 				BLI_join_dirfile(name, sizeof(name), filelist->dir, file->relname);
@@ -994,7 +1030,7 @@ void filelist_from_library(struct FileList* filelist)
 	ok= filelist_islibrary(filelist, dir, group);
 	if (!ok) {
 		/* free */
-		if(filelist->libfiledata) BLO_blendhandle_close(filelist->libfiledata);
+		if (filelist->libfiledata) BLO_blendhandle_close(filelist->libfiledata);
 		filelist->libfiledata= NULL;
 		return;
 	}
@@ -1005,13 +1041,13 @@ void filelist_from_library(struct FileList* filelist)
 	/* for the time being only read filedata when libfiledata==0 */
 	if (filelist->libfiledata == NULL) {
 		filelist->libfiledata= BLO_blendhandle_from_file(dir, NULL);
-		if(filelist->libfiledata == NULL) return;
+		if (filelist->libfiledata == NULL) return;
 	}
 	
 	idcode= groupname_to_code(group);
 
 	/* memory for strings is passed into filelist[i].relname
-	 * and free'd in freefilelist */
+	 * and freed in freefilelist */
 	if (idcode) {
 		previews= BLO_blendhandle_get_previews(filelist->libfiledata, idcode, &nprevs);
 		names= BLO_blendhandle_get_datablock_names(filelist->libfiledata, idcode, &nnames);
@@ -1019,7 +1055,8 @@ void filelist_from_library(struct FileList* filelist)
 		BLO_blendhandle_close(filelist->libfiledata);
 		filelist->libfiledata= BLO_blendhandle_from_file(dir, NULL);
 		
-	} else {
+	}
+	else {
 		previews= NULL;
 		nprevs= 0;
 		names= BLO_blendhandle_get_linkable_groups(filelist->libfiledata);
@@ -1039,15 +1076,16 @@ void filelist_from_library(struct FileList* filelist)
 		filelist->filelist[i + 1].relname= BLI_strdup(blockname);
 		if (idcode) {
 			filelist->filelist[i + 1].type |= S_IFREG;
-		} else {
+		}
+		else {
 			filelist->filelist[i + 1].type |= S_IFDIR;
 		}
 	}
 	
-	if(previews && (nnames != nprevs)) {
+	if (previews && (nnames != nprevs)) {
 		printf("filelist_from_library: error, found %d items, %d previews\n", nnames, nprevs);
 	}
-	else if(previews) {
+	else if (previews) {
 		for (i=0, l= previews; i<nnames; i++, l= l->next) {
 			PreviewImage *img= l->link;
 			
@@ -1092,20 +1130,20 @@ void filelist_from_main(struct FileList *filelist)
 	
 	// filelist->type = FILE_MAIN; // XXXXX TODO: add modes to filebrowser
 
-	if(filelist->dir[0]=='/') filelist->dir[0]= 0;
+	if (filelist->dir[0]=='/') filelist->dir[0]= 0;
 	
-	if(filelist->dir[0]) {
+	if (filelist->dir[0]) {
 		idcode= groupname_to_code(filelist->dir);
-		if(idcode==0) filelist->dir[0]= 0;
+		if (idcode==0) filelist->dir[0]= 0;
 	}
 	
-	if( filelist->dir[0]==0) {
+	if ( filelist->dir[0]==0) {
 		
 		/* make directories */
 		filelist->numfiles= 24;
 		filelist->filelist= (struct direntry *)malloc(filelist->numfiles * sizeof(struct direntry));
 		
-		for(a=0; a<filelist->numfiles; a++) {
+		for (a=0; a<filelist->numfiles; a++) {
 			memset( &(filelist->filelist[a]), 0 , sizeof(struct direntry));
 			filelist->filelist[a].type |= S_IFDIR;
 		}
@@ -1141,11 +1179,11 @@ void filelist_from_main(struct FileList *filelist)
 		idcode= groupname_to_code(filelist->dir);
 		
 		lb= which_libbase(G.main, idcode );
-		if(lb == NULL) return;
+		if (lb == NULL) return;
 		
 		id= lb->first;
 		filelist->numfiles= 0;
-		while(id) {
+		while (id) {
 			if (!filelist->hide_dot || id->name[2] != '.') {
 				filelist->numfiles++;
 			}
@@ -1170,12 +1208,12 @@ void filelist_from_main(struct FileList *filelist)
 		id= lb->first;
 		totlib= totbl= 0;
 		
-		while(id) {
+		while (id) {
 			ok = 1;
-			if(ok) {
+			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");
@@ -1183,28 +1221,28 @@ void filelist_from_main(struct FileList *filelist)
 					}
 					files->type |= S_IFREG;
 #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;
+					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;
+						else if (idcode==ID_SCE) {
+							if ( ((Scene *)id)->r.scemode & R_BG_RENDER) files->selflag |= SELECTED_FILE;
 						}					
 					}
 #endif
 					files->nr= totbl+1;
 					files->poin= id;
 					fake= id->flag & LIB_FAKEUSER;
-					if(idcode == ID_MA || idcode == ID_TE || idcode == ID_LA || idcode == ID_WO || idcode == ID_IM) {
+					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);
+					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;
+					if (id->lib) {
+						if (totlib==0) firstlib= files;
 						totlib++;
 					}
 					
@@ -1217,7 +1255,7 @@ void filelist_from_main(struct FileList *filelist)
 		}
 		
 		/* only qsort of library blocks */
-		if(totlib>1) {
+		if (totlib>1) {
 			qsort(firstlib, totlib, sizeof(struct direntry), compare_name);
 		}
 	}
@@ -1230,7 +1268,7 @@ static void thumbnail_joblist_free(ThumbnailJob *tj)
 	FileImage* limg = tj->loadimages.first;
 	
 	/* free the images not yet copied to the filelist -> these will get freed with the filelist */
-	for( ; limg; limg= limg->next) {
+	for ( ; limg; limg= limg->next) {
 		if ((limg->img) && (!limg->done)) {
 			IMB_freeImBuf(limg->img);
 		}
@@ -1249,9 +1287,11 @@ static void thumbnails_startjob(void *tjv, short *stop, short *do_update, float
 	while ( (*stop==0) && (limg) ) {
 		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 ) {
 			limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, THB_SOURCE_BLEND);
-		} else if ( limg->flags & MOVIEFILE ) {
+		}
+		else if ( limg->flags & MOVIEFILE ) {
 			limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, THB_SOURCE_MOVIE);
 			if (!limg->img) {
 					/* remember that file can't be loaded via IMB_open_anim */
diff --git a/source/blender/editors/space_file/filelist.h b/source/blender/editors/space_file/filelist.h
index 0a8824e..fac6a38 100644
--- a/source/blender/editors/space_file/filelist.h
+++ b/source/blender/editors/space_file/filelist.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef FILELIST_H
-#define FILELIST_H
+#ifndef __FILELIST_H__
+#define __FILELIST_H__
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 5b4e133..31695dd 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -36,22 +36,16 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
-#ifdef WIN32
-#include <io.h>
-#include <direct.h>
-#include "BLI_winstuff.h"
-#else
-#include <unistd.h>
-#include <sys/times.h>
-#endif   
-
 /* path/file handeling stuff */
-#ifndef WIN32
-  #include <dirent.h>
-  #include <unistd.h>
+#ifdef WIN32
+#  include <io.h>
+#  include <direct.h>
+#  include "BLI_winstuff.h"
 #else
-  #include <io.h>
-  #include "BLI_winstuff.h"
+#  include <unistd.h>
+#  include <sys/times.h>
+#  include <dirent.h>
+#  include <unistd.h>
 #endif
 
 #include "DNA_space_types.h"
@@ -123,9 +117,9 @@ short ED_fileselect_set_params(SpaceFile *sfile)
 		const short is_directory= (RNA_struct_find_property(op->ptr, "directory") != NULL);
 		const short is_relative_path= (RNA_struct_find_property(op->ptr, "relative_path") != NULL);
 
-		BLI_strncpy(params->title, op->type->name, sizeof(params->title));
+		BLI_strncpy(params->title, RNA_struct_ui_name(op->type->srna), sizeof(params->title));
 
-		if(RNA_struct_find_property(op->ptr, "filemode"))
+		if (RNA_struct_find_property(op->ptr, "filemode"))
 			params->type = RNA_int_get(op->ptr, "filemode");
 		else
 			params->type = FILE_SPECIAL;
@@ -152,12 +146,12 @@ short ED_fileselect_set_params(SpaceFile *sfile)
 			}
 		}
 
-		if(params->dir[0]) {
+		if (params->dir[0]) {
 			BLI_cleanup_dir(G.main->name, params->dir);
 			BLI_path_abs(params->dir, G.main->name);
 		}
 
-		if(is_directory==TRUE && is_filename==FALSE && is_filepath==FALSE && is_files==FALSE) {
+		if (is_directory==TRUE && is_filename==FALSE && is_filepath==FALSE && is_files==FALSE) {
 			params->flag |= FILE_DIRSEL_ONLY;
 		}
 		else {
@@ -165,27 +159,27 @@ short ED_fileselect_set_params(SpaceFile *sfile)
 		}
 
 		params->filter = 0;
-		if(RNA_struct_find_property(op->ptr, "filter_blender"))
+		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_image"))
+		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"))
+		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"))
+		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"))
+		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"))
+		if (RNA_struct_find_property(op->ptr, "filter_font"))
 			params->filter |= RNA_boolean_get(op->ptr, "filter_font") ? FTFONTFILE : 0;
-		if(RNA_struct_find_property(op->ptr, "filter_sound"))
+		if (RNA_struct_find_property(op->ptr, "filter_sound"))
 			params->filter |= RNA_boolean_get(op->ptr, "filter_sound") ? SOUNDFILE : 0;
-		if(RNA_struct_find_property(op->ptr, "filter_text"))
+		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_folder"))
+		if (RNA_struct_find_property(op->ptr, "filter_folder"))
 			params->filter |= RNA_boolean_get(op->ptr, "filter_folder") ? FOLDERFILE : 0;
-		if(RNA_struct_find_property(op->ptr, "filter_btx"))
+		if (RNA_struct_find_property(op->ptr, "filter_btx"))
 			params->filter |= RNA_boolean_get(op->ptr, "filter_btx") ? BTXFILE : 0;
-		if(RNA_struct_find_property(op->ptr, "filter_collada"))
+		if (RNA_struct_find_property(op->ptr, "filter_collada"))
 			params->filter |= RNA_boolean_get(op->ptr, "filter_collada") ? COLLADAFILE : 0;
 		if (RNA_struct_find_property(op->ptr, "filter_glob")) {
 			RNA_string_get(op->ptr, "filter_glob", params->filter_glob);
@@ -198,14 +192,16 @@ short ED_fileselect_set_params(SpaceFile *sfile)
 		if (params->filter != 0) {
 			if (U.uiflag & USER_FILTERFILEEXTS) {
 				params->flag |= FILE_FILTER;
-			} else {
+			}
+			else {
 				params->flag &= ~FILE_FILTER;
 			}
 		}
 
 		if (U.uiflag & USER_HIDE_DOT) {
 			params->flag |= FILE_HIDE_DOT;
-		} else {
+		}
+		else {
 			params->flag &= ~FILE_HIDE_DOT;
 		}
 		
@@ -216,16 +212,17 @@ short ED_fileselect_set_params(SpaceFile *sfile)
 			params->flag |= RNA_boolean_get(op->ptr, "active_layer") ? FILE_ACTIVELAY : 0;
 		}
 
-		if(RNA_struct_find_property(op->ptr, "display_type"))
+		if (RNA_struct_find_property(op->ptr, "display_type"))
 			params->display= RNA_enum_get(op->ptr, "display_type");
 
-		if(params->display==FILE_DEFAULTDISPLAY) {
+		if (params->display==FILE_DEFAULTDISPLAY) {
 			if (U.uiflag & USER_SHOW_THUMBNAILS) {
-				if(params->filter & (IMAGEFILE|MOVIEFILE))
+				if (params->filter & (IMAGEFILE|MOVIEFILE))
 					params->display= FILE_IMGDISPLAY;
 				else
 					params->display= FILE_SHORTDISPLAY;
-			} else {
+			}
+			else {
 				params->display= FILE_SHORTDISPLAY;
 			}
 		}
@@ -276,7 +273,8 @@ int ED_fileselect_layout_numfiles(FileLayout* layout, struct ARegion *ar)
 		int width = (int)(ar->v2d.cur.xmax - ar->v2d.cur.xmin - 2*layout->tile_border_x);
 		numfiles = (int)((float)width / (float)layout->tile_w + 0.5f);
 		return numfiles*layout->rows;
-	} else {
+	}
+	else {
 		int height = (int)(ar->v2d.cur.ymax - ar->v2d.cur.ymin - 2*layout->tile_border_y);
 		numfiles = (int)((float)height/(float)layout->tile_h + 0.5f);
 		return numfiles*layout->columns;
@@ -310,17 +308,19 @@ FileSelection ED_fileselect_layout_offset_rect(FileLayout* layout, const rcti* r
 		CLAMP(rowmax, 0, layout->rows-1);
 	} 
 	
-	if  ( (colmin > layout->columns-1) || (rowmin > layout->rows-1) ) {
+	if ((colmin > layout->columns-1) || (rowmin > layout->rows-1)) {
 		sel.first = -1;
-	} else {
+	}
+	else {
 		if (layout->flag & FILE_LAYOUT_HOR) 
 			sel.first = layout->rows*colmin + rowmin;
 		else
 			sel.first = colmin + layout->columns*rowmin;
 	}
-	if  ( (colmax > layout->columns-1) || (rowmax > layout->rows-1) ) {
+	if ((colmax > layout->columns-1) || (rowmax > layout->rows-1)) {
 		sel.last = -1;
-	} else {
+	}
+	else {
 		if (layout->flag & FILE_LAYOUT_HOR) 
 			sel.last = layout->rows*colmax + rowmax;
 		else
@@ -341,8 +341,8 @@ int ED_fileselect_layout_offset(FileLayout* layout, int x, int y)
 	offsetx = (x)/(layout->tile_w + 2*layout->tile_border_x);
 	offsety = (y)/(layout->tile_h + 2*layout->tile_border_y);
 	
-	if (offsetx > layout->columns-1) return -1 ;
-	if (offsety > layout->rows-1) return -1 ;
+	if (offsetx > layout->columns - 1) return -1;
+	if (offsety > layout->rows - 1) return -1;
 	
 	if (layout->flag & FILE_LAYOUT_HOR) 
 		active_file = layout->rows*offsetx + offsety;
@@ -356,15 +356,16 @@ void ED_fileselect_layout_tilepos(FileLayout* layout, int tile, int *x, int *y)
 	if (layout->flag == FILE_LAYOUT_HOR) {
 		*x = layout->tile_border_x + (tile/layout->rows)*(layout->tile_w+2*layout->tile_border_x);
 		*y = layout->tile_border_y + (tile%layout->rows)*(layout->tile_h+2*layout->tile_border_y);
-	} else {
+	}
+	else {
 		*x = layout->tile_border_x + ((tile)%layout->columns)*(layout->tile_w+2*layout->tile_border_x);
 		*y = layout->tile_border_y + ((tile)/layout->columns)*(layout->tile_h+2*layout->tile_border_y);
 	}
 }
 
 /* Shorten a string to a given width w. 
-   If front is set, shorten from the front,
-   otherwise shorten from the end. */
+ * If front is set, shorten from the front,
+ * otherwise shorten from the end. */
 float file_shorten_string(char* string, float w, int front)
 {	
 	char temp[FILE_MAX];
@@ -393,7 +394,8 @@ float file_shorten_string(char* string, float w, int front)
 			temp[slen+4] = '\0';
 			BLI_strncpy(string, temp, slen+4);
 		}
-	} else {
+	}
+	else {
 		char *s = string;
 		while (sw>w) {
 			int slen = strlen(string);
@@ -482,7 +484,8 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
 	if (sfile->layout == NULL) {
 		sfile->layout = MEM_callocN(sizeof(struct FileLayout), "file_layout");
 		sfile->layout->dirty = TRUE;
-	} else if (sfile->layout->dirty == FALSE) {
+	}
+	else if (sfile->layout->dirty == FALSE) {
 		return;
 	}
 
@@ -502,7 +505,7 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
 		layout->tile_h = layout->prv_h + 2*layout->prv_border_y + textheight;
 		layout->width= (int)(v2d->cur.xmax - v2d->cur.xmin - 2*layout->tile_border_x);
 		layout->columns= layout->width / (layout->tile_w + 2*layout->tile_border_x);
-		if(layout->columns > 0)
+		if (layout->columns > 0)
 			layout->rows= numfiles/layout->columns + 1; // XXX dirty, modulo is zero
 		else {
 			layout->columns = 1;
@@ -510,7 +513,8 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
 		}
 		layout->height= sfile->layout->rows*(layout->tile_h+2*layout->tile_border_y) + layout->tile_border_y*2;
 		layout->flag = FILE_LAYOUT_VER;
-	} else {
+	}
+	else {
 		layout->prv_w = 0;
 		layout->prv_h = 0;
 		layout->tile_border_x = 8;
@@ -527,7 +531,8 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
 			maxlen = ICON_DEFAULT_WIDTH_SCALE + 4 +
 					 (int)layout->column_widths[COLUMN_NAME] + 12 +
 					 (int)layout->column_widths[COLUMN_SIZE] + 12;
-		} else {
+		}
+		else {
 			maxlen = ICON_DEFAULT_WIDTH_SCALE + 4 +
 					 (int)layout->column_widths[COLUMN_NAME] + 12 +
 #ifndef WIN32
@@ -542,7 +547,7 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *ar)
 
 		}
 		layout->tile_w = maxlen;
-		if(layout->rows > 0)
+		if (layout->rows > 0)
 			layout->columns = numfiles/layout->rows + 1; // XXX dirty, modulo is zero
 		else {
 			layout->rows = 1;
@@ -570,13 +575,13 @@ void file_change_dir(bContext *C, int checkdir)
 
 		ED_fileselect_clear(C, sfile);
 
-		if(checkdir && BLI_is_dir(sfile->params->dir)==0) {
+		if (checkdir && BLI_is_dir(sfile->params->dir)==0) {
 			BLI_strncpy(sfile->params->dir, filelist_dir(sfile->files), sizeof(sfile->params->dir));
 			/* could return but just refresh the current dir */
 		}
 		filelist_setdir(sfile->files, sfile->params->dir);
 		
-		if(folderlist_clear_next(sfile))
+		if (folderlist_clear_next(sfile))
 			folderlist_free(sfile->folders_next);
 
 		folderlist_pushdir(sfile->folders_prev, sfile->params->dir);
@@ -608,7 +613,7 @@ void autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v))
 	SpaceFile *sfile= CTX_wm_space_file(C);
 
 	/* search if str matches the beginning of name */
-	if(str[0] && sfile->files) {
+	if (str[0] && sfile->files) {
 		char dirname[FILE_MAX];
 
 		DIR *dir;
@@ -618,7 +623,7 @@ void autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v))
 
 		dir = opendir(dirname);
 
-		if(dir) {
+		if (dir) {
 			AutoComplete *autocpl= autocomplete_begin(str, FILE_MAX);
 
 			while ((de = readdir(dir)) != NULL) {
@@ -643,7 +648,8 @@ void autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v))
 			autocomplete_end(autocpl, str);
 			if (BLI_exists(str)) {
 				BLI_add_slash(str);
-			} else {
+			}
+			else {
 				BLI_strncpy(sfile->params->dir, str, sizeof(sfile->params->dir));
 			}
 		}
@@ -655,12 +661,12 @@ void autocomplete_file(struct bContext *C, char *str, void *UNUSED(arg_v))
 	SpaceFile *sfile= CTX_wm_space_file(C);
 
 	/* search if str matches the beginning of name */
-	if(str[0] && sfile->files) {
+	if (str[0] && sfile->files) {
 		AutoComplete *autocpl= autocomplete_begin(str, FILE_MAX);
 		int nentries = filelist_numfiles(sfile->files);
 		int i;
 
-		for(i= 0; i<nentries; ++i) {
+		for (i= 0; i<nentries; ++i) {
 			struct direntry* file = filelist_file(sfile->files, i);
 			if (file && S_ISREG(file->type)) {
 				autocomplete_do_name(autocpl, file->relname);
@@ -685,8 +691,8 @@ void ED_fileselect_clear(struct bContext *C, struct SpaceFile *sfile)
 
 void ED_fileselect_exit(struct bContext *C, struct SpaceFile *sfile)
 {
-	if(!sfile) return;
-	if(sfile->op) {
+	if (!sfile) return;
+	if (sfile->op) {
 		WM_event_fileselect_event(C, sfile->op, EVT_FILESELECT_EXTERNAL_CANCEL);
 		sfile->op = NULL;
 	}
diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c
index 9a952d2..48449ac 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -44,20 +44,20 @@
 #include "BLI_dynstr.h"
 
 #ifdef WIN32
-#include <windows.h> /* need to include windows.h so _WIN32_IE is defined  */
-#ifndef _WIN32_IE
-#define _WIN32_IE 0x0400 /* minimal requirements for SHGetSpecialFolderPath on MINGW MSVC has this defined already */
-#endif
-#include <shlobj.h> /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff because 'near' is disabled through BLI_windstuff */
-#include "BLI_winstuff.h"
+#  include <windows.h> /* need to include windows.h so _WIN32_IE is defined  */
+#  ifndef _WIN32_IE
+#    define _WIN32_IE 0x0400 /* minimal requirements for SHGetSpecialFolderPath on MINGW MSVC has this defined already */
+#  endif
+#  include <shlobj.h>  /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff
+                        * because 'near' is disabled through BLI_windstuff */
+#  include "BLI_winstuff.h"
 #endif
 
 #ifdef __APPLE__
-/* XXX BIG WARNING: carbon.h can not be included in blender code, it conflicts with struct ID */
-#define ID ID_
-#include <CoreServices/CoreServices.h>
-
-#endif
+   /* XXX BIG WARNING: carbon.h can not be included in blender code, it conflicts with struct ID */
+#  define ID ID_
+#  include <CoreServices/CoreServices.h>
+#endif /* __APPLE__ */
 
 #ifdef __linux__
 #include <mntent.h>
@@ -177,7 +177,8 @@ void fsmenu_insert_entry(struct FSMenu* fsmenu, FSMenuCategory category, const c
 			else if (sorted && cmp_ret < 0) {
 				break;
 			}
-		} else {
+		}
+		else {
 			// if we're bookmarking this, file should come 
 			// before the last separator, only automatically added
 			// current dir go after the last sep.
@@ -194,7 +195,8 @@ void fsmenu_insert_entry(struct FSMenu* fsmenu, FSMenuCategory category, const c
 	if (prev) {
 		fsme->next= prev->next;
 		prev->next= fsme;
-	} else {
+	}
+	else {
 		fsme->next= fsms;
 		fsmenu_set_category(fsmenu, category, fsme);
 	}
@@ -210,14 +212,15 @@ void fsmenu_remove_entry(struct FSMenu* fsmenu, FSMenuCategory category, int idx
 
 	if (fsme) {
 		/* you should only be able to remove entries that were 
-		   not added by default, like windows drives.
-		   also separators (where path == NULL) shouldn't be removed */
+		 * not added by default, like windows drives.
+		 * also separators (where path == NULL) shouldn't be removed */
 		if (fsme->save && fsme->path) {
 
 			/* remove fsme from list */
 			if (prev) {
 				prev->next= fsme->next;
-			} else {
+			}
+			else {
 				fsms= fsme->next;
 				fsmenu_set_category(fsmenu, category, fsms);
 			}
@@ -233,7 +236,7 @@ void fsmenu_write_file(struct FSMenu* fsmenu, const char *filename)
 	FSMenuEntry *fsme= NULL;
 	int nskip= 0;
 
-	FILE *fp = fopen(filename, "w");
+	FILE *fp = BLI_fopen(filename, "w");
 	if (!fp) return;
 	
 	fprintf(fp, "[Bookmarks]\n");
@@ -245,8 +248,9 @@ void fsmenu_write_file(struct FSMenu* fsmenu, const char *filename)
 	fprintf(fp, "[Recent]\n");
 	nskip = fsmenu_get_nentries(fsmenu, FS_CATEGORY_RECENT) - FSMENU_RECENT_MAX;
 	// skip first entries if list too long
-	for (fsme= fsmenu_get_category(fsmenu, FS_CATEGORY_RECENT); fsme && (nskip>0); fsme= fsme->next, --nskip)
-		;
+	for (fsme= fsmenu_get_category(fsmenu, FS_CATEGORY_RECENT); fsme && (nskip>0); fsme= fsme->next, --nskip) {
+		/* pass */
+	}
 	for (; fsme; fsme= fsme->next) {
 		if (fsme->path && fsme->save) {
 			fprintf(fp, "%s\n", fsme->path);
@@ -261,16 +265,18 @@ void fsmenu_read_bookmarks(struct FSMenu* fsmenu, const char *filename)
 	FSMenuCategory category = FS_CATEGORY_BOOKMARKS;
 	FILE *fp;
 
-	fp = fopen(filename, "r");
+	fp = BLI_fopen(filename, "r");
 	if (!fp) return;
 
 	while ( fgets ( line, 256, fp ) != NULL ) /* read a line */
 	{
-		if (strncmp(line, "[Bookmarks]", 11)==0){
+		if (strncmp(line, "[Bookmarks]", 11)==0) {
 			category = FS_CATEGORY_BOOKMARKS;
-		} else if (strncmp(line, "[Recent]", 8)==0){
+		}
+		else if (strncmp(line, "[Recent]", 8)==0) {
 			category = FS_CATEGORY_RECENT;
-		} else {
+		}
+		else {
 			int len = strlen(line);
 			if (len>0) {
 				if (line[len-1] == '\n') {
@@ -333,17 +339,17 @@ void fsmenu_read_system(struct FSMenu* fsmenu)
 				continue;
 			
 			FSRefMakePath(&dir, path, FILE_MAX);
-			if (strcmp((char*)path, "/home") && strcmp((char*)path, "/net"))
-			{ /* /net and /home are meaningless on OSX, home folders are stored in /Users */
+			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, 1, 0);
 			}
 		}
 
 		/* As 10.4 doesn't provide proper API to retrieve the favorite places,
-		 assume they are the standard ones 
-		 TODO : replace hardcoded paths with proper BLI_get_folder calls */
+		 * assume they are the standard ones 
+		 * TODO : replace hardcoded paths with proper BLI_get_folder calls */
 		home = getenv("HOME");
-		if(home) {
+		if (home) {
 			BLI_snprintf(line, 256, "%s/", home);
 			fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, 1, 0);
 			BLI_snprintf(line, 256, "%s/Desktop/", home);
@@ -464,7 +470,7 @@ void fsmenu_read_system(struct FSMenu* fsmenu)
 	{
 		const char *home= getenv("HOME");
 
-		if(home) {
+		if (home) {
 			BLI_snprintf(line, FILE_MAXDIR, "%s/", home);
 			fsmenu_insert_entry(fsmenu, FS_CATEGORY_BOOKMARKS, line, 1, 0);
 			BLI_snprintf(line, FILE_MAXDIR, "%s/Desktop/", home);
@@ -488,11 +494,11 @@ void fsmenu_read_system(struct FSMenu* fsmenu)
 			else {
 				while ((mnt = getmntent (fp))) {
 					/* not sure if this is right, but seems to give the relevant mnts */
-					if(strncmp(mnt->mnt_fsname, "/dev", 4))
+					if (strncmp(mnt->mnt_fsname, "/dev", 4))
 						continue;
 
 					len= strlen(mnt->mnt_dir);
-					if(len && mnt->mnt_dir[len-1] != '/') {
+					if (len && mnt->mnt_dir[len-1] != '/') {
 						BLI_snprintf(line, FILE_MAXDIR, "%s/", mnt->mnt_dir);
 						fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, line, 1, 0);
 					}
@@ -508,7 +514,7 @@ void fsmenu_read_system(struct FSMenu* fsmenu)
 #endif
 
 			/* fallback */
-			if(!found)
+			if (!found)
 				fsmenu_insert_entry(fsmenu, FS_CATEGORY_SYSTEM, "/", 1, 0);
 		}
 	}
diff --git a/source/blender/editors/space_file/fsmenu.h b/source/blender/editors/space_file/fsmenu.h
index 5947db0..c926a4f 100644
--- a/source/blender/editors/space_file/fsmenu.h
+++ b/source/blender/editors/space_file/fsmenu.h
@@ -31,8 +31,8 @@
  */
 
 
-#ifndef BSE_FSMENU_H
-#define BSE_FSMENU_H
+#ifndef __FSMENU_H__
+#define __FSMENU_H__
 
 /* XXX could become UserPref */
 #define FSMENU_RECENT_MAX 10
@@ -50,21 +50,21 @@ struct FSMenu* fsmenu_get		(void);
 	/** Returns the number of entries in the Fileselect Menu */
 int		fsmenu_get_nentries		(struct FSMenu* fsmenu, FSMenuCategory category);
 
-	/** Returns the fsmenu entry at @a index (or NULL if a bad index)
+	/** Returns the fsmenu entry at \a index (or NULL if a bad index)
 	 * or a separator.
 	 */
 char*	fsmenu_get_entry		(struct FSMenu* fsmenu, FSMenuCategory category, int index);
 
-	/** Inserts a new fsmenu entry with the given @a path.
+	/** Inserts a new fsmenu entry with the given \a path.
 	 * Duplicate entries are not added.
-	 * @param sorted Should entry be inserted in sorted order?
+	 * \param sorted Should entry be inserted in sorted order?
 	 */
 void	fsmenu_insert_entry		(struct FSMenu* fsmenu, FSMenuCategory category, const char *path, int sorted, short save);
 
 	/** Return whether the entry was created by the user and can be saved and deleted */
 short   fsmenu_can_save			(struct FSMenu* fsmenu, FSMenuCategory category, int index);
 
-	/** Removes the fsmenu entry at the given @a index. */
+	/** Removes the fsmenu entry at the given \a index. */
 void	fsmenu_remove_entry		(struct FSMenu* fsmenu, FSMenuCategory category, int index);
 
 	/** saves the 'bookmarks' to the specified file */
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 02c9728..0cf15c2 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -113,7 +113,7 @@ static void file_free(SpaceLink *sl)
 {	
 	SpaceFile *sfile= (SpaceFile *) sl;
 	
-	if(sfile->files) {
+	if (sfile->files) {
 		// XXXXX would need to do thumbnails_stop here, but no context available
 		filelist_freelib(sfile->files);
 		filelist_free(sfile->files);
@@ -121,13 +121,13 @@ static void file_free(SpaceLink *sl)
 		sfile->files= NULL;
 	}
 
-	if(sfile->folders_prev) {
+	if (sfile->folders_prev) {
 		folderlist_free(sfile->folders_prev);
 		MEM_freeN(sfile->folders_prev);
 		sfile->folders_prev= NULL;
 	}
 
-	if(sfile->folders_next) {
+	if (sfile->folders_next) {
 		folderlist_free(sfile->folders_next);
 		MEM_freeN(sfile->folders_next);
 		sfile->folders_next= NULL;
@@ -151,7 +151,7 @@ static void file_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
 	SpaceFile *sfile= (SpaceFile*)sa->spacedata.first;
 	//printf("file_init\n");
 
-	if(sfile->layout) sfile->layout->dirty= TRUE;
+	if (sfile->layout) sfile->layout->dirty= TRUE;
 }
 
 
@@ -169,10 +169,10 @@ static SpaceLink *file_duplicate(SpaceLink *sl)
 		filelist_setdir(sfilen->files, sfilen->params->dir);
 	}
 
-	if(sfileo->folders_prev)
+	if (sfileo->folders_prev)
 		sfilen->folders_prev = folderlist_duplicate(sfileo->folders_prev);
 
-	if(sfileo->folders_next)
+	if (sfileo->folders_next)
 		sfilen->folders_next = folderlist_duplicate(sfileo->folders_next);
 	
 	if (sfileo->layout) {
@@ -196,32 +196,35 @@ static void file_refresh(const bContext *C, ScrArea *UNUSED(sa))
 	filelist_hidedot(sfile->files, params->flag & FILE_HIDE_DOT);
 	filelist_setfilter(sfile->files, params->flag & FILE_FILTER ? params->filter : 0);	
 	filelist_setfilter_types(sfile->files, params->filter_glob);
-	if (filelist_empty(sfile->files))
-	{
+
+	if (filelist_empty(sfile->files)) {
 		thumbnails_stop(sfile->files, C);
 		filelist_readdir(sfile->files);
-		if(params->sort!=FILE_SORT_NONE) {
+		if (params->sort!=FILE_SORT_NONE) {
 			filelist_sort(sfile->files, params->sort);
 		}
 		BLI_strncpy(params->dir, filelist_dir(sfile->files), FILE_MAX);
-		if(params->display == FILE_IMGDISPLAY) {
+		if (params->display == FILE_IMGDISPLAY) {
 			thumbnails_start(sfile->files, C);
 		}
-	} else {
-		if(params->sort!=FILE_SORT_NONE) {
+	}
+	else {
+		if (params->sort!=FILE_SORT_NONE) {
 			thumbnails_stop(sfile->files, C);
 			filelist_sort(sfile->files, params->sort);
-			if(params->display == FILE_IMGDISPLAY) {
+			if (params->display == FILE_IMGDISPLAY) {
 				thumbnails_start(sfile->files, C);
 			}
-		} else {
-			if(params->display == FILE_IMGDISPLAY) {
+		}
+		else {
+			if (params->display == FILE_IMGDISPLAY) {
 				if (!thumbnails_running(sfile->files,C)) {
 					thumbnails_start(sfile->files, C);
 				}
-			} else {
+			}
+			else {
 				/* stop any running thumbnail jobs if we're not 
-				 displaying them - speedup for NFS */
+				 * displaying them - speedup for NFS */
 				thumbnails_stop(sfile->files, C);
 			}
 			filelist_filter(sfile->files);
@@ -272,10 +275,10 @@ static void file_main_area_init(wmWindowManager *wm, ARegion *ar)
 	UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
 	
 	/* 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);
 
-	keymap= WM_keymap_find(wm->defaultconf, "File Browser Main", SPACE_FILE, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "File Browser Main", SPACE_FILE, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 							   
 
@@ -333,9 +336,9 @@ static void file_main_area_draw(const bContext *C, ARegion *ar)
 		
 		/* XXX this happens on scaling down Screen (like from startup.blend) */
 		/* view2d has no type specific for filewindow case, which doesnt scroll vertically */
-		if(v2d->cur.ymax < 0) {
+		if (v2d->cur.ymax < 0) {
 			v2d->cur.ymin -= v2d->cur.ymax;
-			v2d->cur.ymax= 0;
+			v2d->cur.ymax = 0;
 		}
 	}
 	/* v2d has initialized flag, so this call will only set the mask correct */
@@ -395,7 +398,7 @@ static void file_keymap(struct wmKeyConfig *keyconf)
 {
 	wmKeyMapItem *kmi;
 	/* keys for all areas */
-	wmKeyMap *keymap= WM_keymap_find(keyconf, "File Browser", SPACE_FILE, 0);
+	wmKeyMap *keymap = WM_keymap_find(keyconf, "File Browser", SPACE_FILE, 0);
 	WM_keymap_add_item(keymap, "FILE_OT_bookmark_toggle", NKEY, KM_PRESS, 0, 0);
 	WM_keymap_add_item(keymap, "FILE_OT_parent", PKEY, KM_PRESS, 0, 0);
 	WM_keymap_add_item(keymap, "FILE_OT_bookmark_add", BKEY, KM_PRESS, KM_CTRL, 0);
@@ -408,8 +411,8 @@ static void file_keymap(struct wmKeyConfig *keyconf)
 	WM_keymap_verify_item(keymap, "FILE_OT_smoothscroll", TIMER1, KM_ANY, KM_ANY, 0);
 
 	/* keys for main area */
-	keymap= WM_keymap_find(keyconf, "File Browser Main", SPACE_FILE, 0);
-	kmi= WM_keymap_add_item(keymap, "FILE_OT_execute", LEFTMOUSE, KM_DBL_CLICK, 0, 0);
+	keymap = WM_keymap_find(keyconf, "File Browser Main", SPACE_FILE, 0);
+	kmi = WM_keymap_add_item(keymap, "FILE_OT_execute", LEFTMOUSE, KM_DBL_CLICK, 0, 0);
 	RNA_boolean_set(kmi->ptr, "need_active", TRUE);
 	WM_keymap_add_item(keymap, "FILE_OT_select", LEFTMOUSE, KM_CLICK, 0, 0);
 	kmi = WM_keymap_add_item(keymap, "FILE_OT_select", LEFTMOUSE, KM_CLICK, KM_SHIFT, 0);
@@ -438,7 +441,7 @@ static void file_keymap(struct wmKeyConfig *keyconf)
 	
 	
 	/* keys for button area (top) */
-	keymap= WM_keymap_find(keyconf, "File Browser Buttons", SPACE_FILE, 0);
+	keymap = WM_keymap_find(keyconf, "File Browser Buttons", SPACE_FILE, 0);
 	kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADPLUSKEY, KM_PRESS, 0, 0);
 	RNA_int_set(kmi->ptr, "increment", 1);
 	kmi = WM_keymap_add_item(keymap, "FILE_OT_filenum", PADPLUSKEY, KM_PRESS, KM_SHIFT, 0);
@@ -461,7 +464,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);
 }
 
@@ -485,7 +488,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);
 }
 
@@ -502,10 +505,10 @@ static void file_ui_area_init(wmWindowManager *wm, ARegion *ar)
 	UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy);
 
 	/* own keymap */
-	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);
 
-	keymap= WM_keymap_find(wm->defaultconf, "File Browser Buttons", SPACE_FILE, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "File Browser Buttons", SPACE_FILE, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
@@ -518,8 +521,8 @@ static void file_ui_area_draw(const bContext *C, ARegion *ar)
 	glClear(GL_COLOR_BUFFER_BIT);
 
 	/* scrolling here is just annoying, disable it */
-	ar->v2d.cur.ymax= ar->v2d.cur.ymax - ar->v2d.cur.ymin;
-	ar->v2d.cur.ymin= 0;
+	ar->v2d.cur.ymax = ar->v2d.cur.ymax - ar->v2d.cur.ymin;
+	ar->v2d.cur.ymin = 0;
 
 	/* set view2d view matrix for scrolling (without scrollers) */
 	UI_view2d_view_ortho(&ar->v2d);
diff --git a/source/blender/editors/space_graph/CMakeLists.txt b/source/blender/editors/space_graph/CMakeLists.txt
index 50ab985..5b39604 100644
--- a/source/blender/editors/space_graph/CMakeLists.txt
+++ b/source/blender/editors/space_graph/CMakeLists.txt
@@ -53,4 +53,8 @@ if(WITH_AUDASPACE)
 	add_definitions(-DWITH_AUDASPACE)
 endif()
 
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
 blender_add_lib(bf_editor_space_graph "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_graph/SConscript b/source/blender/editors/space_graph/SConscript
index fe8846d..83239a5 100644
--- a/source/blender/editors/space_graph/SConscript
+++ b/source/blender/editors/space_graph/SConscript
@@ -7,4 +7,9 @@ incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna
 incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
 incs += ' #/intern/audaspace/intern ../../blenloader'
 
-env.BlenderLib ( 'bf_editors_space_graph', sources, Split(incs), [], libtype=['core'], priority=[50] )
+defs = []
+
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
+
+env.BlenderLib ( 'bf_editors_space_graph', sources, Split(incs), defs, libtype=['core'], priority=[50] )
diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index 9e1ff82..4d2fe2c 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -42,7 +42,6 @@
 
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
-#include "BLI_editVert.h"
 #include "BLI_rand.h"
 #include "BLI_utildefines.h"
 
@@ -109,12 +108,12 @@ static int graph_panel_context(const bContext *C, bAnimListElem **ale, FCurve **
 	
 	/* try to find 'active' F-Curve */
 	elem= get_active_fcurve_channel(&ac);
-	if(elem == NULL) 
+	if (elem == NULL) 
 		return 0;
 	
-	if(fcu)
+	if (fcu)
 		*fcu= (FCurve*)elem->data;
-	if(ale)
+	if (ale)
 		*ale= elem;
 	else
 		MEM_freeN(elem);
@@ -148,16 +147,16 @@ static void graph_panel_view(const bContext *C, Panel *pa)
 		
 		sub= uiLayoutColumn(col, 1);
 		uiLayoutSetActive(sub, RNA_boolean_get(&spaceptr, "show_cursor")); 
-			uiItemO(sub, "Cursor from Selection", ICON_NONE, "GRAPH_OT_frame_jump");
+			uiItemO(sub, IFACE_("Cursor from Selection"), ICON_NONE, "GRAPH_OT_frame_jump");
 		
 		sub= uiLayoutColumn(col, 1);
 		uiLayoutSetActive(sub, RNA_boolean_get(&spaceptr, "show_cursor")); 
 			row= uiLayoutSplit(sub, 0.7, 1);
-				uiItemR(row, &sceneptr, "frame_current", 0, "Cursor X", ICON_NONE);
-				uiItemEnumO(row, "GRAPH_OT_snap", "To Keys", 0, "type", GRAPHKEYS_SNAP_CFRA);
+				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.7, 1);
-				uiItemR(row, &spaceptr, "cursor_position_y", 0, "Cursor Y", ICON_NONE);
-				uiItemEnumO(row, "GRAPH_OT_snap", "To Keys", 0, "type", GRAPHKEYS_SNAP_VALUE);
+				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);
 }
 
 /* ******************* active F-Curve ************** */
@@ -183,7 +182,7 @@ static void graph_panel_properties(const bContext *C, Panel *pa)
 	RNA_pointer_create(ale->id, &RNA_FCurve, fcu, &fcu_ptr);
 	
 	/* user-friendly 'name' for F-Curve */
-	// TODO: only show the path if this is invalid?
+	/* TODO: only show the path if this is invalid? */
 	col= uiLayoutColumn(layout, 0);
 		icon= getname_anim_fcurve(name, ale->id, fcu);
 		uiItemL(col, name, icon);
@@ -196,7 +195,7 @@ static void graph_panel_properties(const bContext *C, Panel *pa)
 		
 	/* color settings */
 	col= uiLayoutColumn(layout, 1);
-		uiItemL(col, "Display Color:", ICON_NONE);
+		uiItemL(col, IFACE_("Display Color:"), ICON_NONE);
 		
 		row= uiLayoutRow(col, 1);
 			uiItemR(row, &fcu_ptr, "color_mode", 0, "", ICON_NONE);
@@ -319,36 +318,42 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa)
 		col= uiLayoutColumn(layout, 1);
 			/* keyframe itself */
 			{
-				uiItemL(col, "Key:", ICON_NONE);
+				uiItemL(col, IFACE_("Key:"), ICON_NONE);
 				
-				but = uiDefButR(block, NUM, B_REDR, "Frame", 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "co", 0, 0, 0, -1, -1, NULL);
+				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, "Value", 0, 0, UI_UNIT_X, UI_UNIT_Y, &bezt_ptr, "co", 1, 0, 0, -1, -1, NULL);
+				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, "Left Handle:", ICON_NONE);
+				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, "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);
+				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, "Right Handle:", ICON_NONE);
+				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);
+				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);
+				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);
 				uiButSetUnitType(but, unit);
 			}
@@ -356,15 +361,16 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa)
 	else {
 		if ((fcu->bezt == NULL) && (fcu->modifiers.first)) {
 			/* modifiers only - so no keyframes to be active */
-			uiItemL(layout, "F-Curve only has F-Modifiers", ICON_NONE);
-			uiItemL(layout, "See Modifiers panel below", ICON_INFO);
+			uiItemL(layout, IFACE_("F-Curve only has F-Modifiers"), ICON_NONE);
+			uiItemL(layout, IFACE_("See Modifiers panel below"), ICON_INFO);
 		}
 		else if (fcu->fpt) {
 			/* samples only */
-			uiItemL(layout, "F-Curve doesn't have any keyframes as it only contains sampled points", ICON_NONE);
+			uiItemL(layout, IFACE_("F-Curve doesn't have any keyframes as it only contains sampled points"),
+			        ICON_NONE);
 		}
 		else
-			uiItemL(layout, "No active keyframe on F-Curve", ICON_NONE);
+			uiItemL(layout, IFACE_("No active keyframe on F-Curve"), ICON_NONE);
 	}
 	
 	MEM_freeN(ale);
@@ -446,7 +452,7 @@ static int graph_panel_drivers_poll(const bContext *C, PanelType *UNUSED(pt))
 {
 	SpaceIpo *sipo= CTX_wm_space_graph(C);
 
-	if(sipo->mode != SIPO_MODE_DRIVERS)
+	if (sipo->mode != SIPO_MODE_DRIVERS)
 		return 0;
 
 	return graph_panel_context(C, NULL, NULL);
@@ -459,12 +465,12 @@ static void graph_panel_driverVar__singleProp(uiLayout *layout, ID *id, DriverVa
 	PointerRNA dtar_ptr;
 	uiLayout *row, *col;
 	
-	/* initialise RNA pointer to the target */
+	/* initialize RNA pointer to the target */
 	RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr); 
 	
 	/* Target ID */
 	row= uiLayoutRow(layout, 0);
-		uiTemplateAnyID(row, &dtar_ptr, "id", "id_type", "Prop:");
+		uiTemplateAnyID(row, &dtar_ptr, "id", "id_type", IFACE_("Prop:"));
 	
 	/* Target Property */
 	// TODO: make this less technical...
@@ -476,7 +482,7 @@ static void graph_panel_driverVar__singleProp(uiLayout *layout, ID *id, DriverVa
 		
 		col= uiLayoutColumn(layout, 1);
 		/* rna path */
-		uiTemplatePathBuilder(col, &dtar_ptr, "data_path", &root_ptr, "Path");
+		uiTemplatePathBuilder(col, &dtar_ptr, "data_path", &root_ptr, IFACE_("Path"));
 	}
 }
 
@@ -490,13 +496,13 @@ static void graph_panel_driverVar__rotDiff(uiLayout *layout, ID *id, DriverVar *
 	PointerRNA dtar_ptr, dtar2_ptr;
 	uiLayout *col;
 	
-	/* initialise RNA pointer to the target */
+	/* initialize RNA pointer to the target */
 	RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr); 
 	RNA_pointer_create(id, &RNA_DriverTarget, dtar2, &dtar2_ptr); 
 	
 	/* Bone 1 */
 	col= uiLayoutColumn(layout, 1);
-		uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", "Bone 1:");
+		uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", IFACE_("Bone 1:"));
 		
 		if (dtar->id && ob1->pose) {
 			PointerRNA tar_ptr;
@@ -506,7 +512,7 @@ static void graph_panel_driverVar__rotDiff(uiLayout *layout, ID *id, DriverVar *
 		}
 	
 	col= uiLayoutColumn(layout, 1);
-		uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", "Bone 2:");
+		uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", IFACE_("Bone 2:"));
 		
 		if (dtar2->id && ob2->pose) {
 			PointerRNA tar_ptr;
@@ -526,13 +532,13 @@ static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar *
 	PointerRNA dtar_ptr, dtar2_ptr;
 	uiLayout *col;
 	
-	/* initialise RNA pointer to the target */
+	/* initialize RNA pointer to the target */
 	RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr); 
 	RNA_pointer_create(id, &RNA_DriverTarget, dtar2, &dtar2_ptr); 
 	
 	/* Bone 1 */
 	col= uiLayoutColumn(layout, 1);
-		uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", "Ob/Bone 1:");
+		uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", IFACE_("Ob/Bone 1:"));
 		
 		if (dtar->id && ob1->pose) {
 			PointerRNA tar_ptr;
@@ -544,7 +550,7 @@ static void graph_panel_driverVar__locDiff(uiLayout *layout, ID *id, DriverVar *
 		uiItemR(col, &dtar_ptr, "transform_space", 0, NULL, ICON_NONE);
 	
 	col= uiLayoutColumn(layout, 1);
-		uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", "Ob/Bone 2:");
+		uiTemplateAnyID(col, &dtar2_ptr, "id", "id_type", IFACE_("Ob/Bone 2:"));
 		
 		if (dtar2->id && ob2->pose) {
 			PointerRNA tar_ptr;
@@ -564,12 +570,12 @@ static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar
 	PointerRNA dtar_ptr;
 	uiLayout *col, *sub;
 	
-	/* initialise RNA pointer to the target */
+	/* initialize RNA pointer to the target */
 	RNA_pointer_create(id, &RNA_DriverTarget, dtar, &dtar_ptr); 
 	
 	/* properties */
 	col= uiLayoutColumn(layout, 1);
-		uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", "Ob/Bone:");
+		uiTemplateAnyID(col, &dtar_ptr, "id", "id_type", IFACE_("Ob/Bone:"));
 		
 		if (dtar->id && ob->pose) {
 			PointerRNA tar_ptr;
@@ -580,7 +586,7 @@ static void graph_panel_driverVar__transChan(uiLayout *layout, ID *id, DriverVar
 		
 		sub= uiLayoutColumn(layout, 1);
 			uiItemR(sub, &dtar_ptr, "transform_type", 0, NULL, ICON_NONE);
-			uiItemR(sub, &dtar_ptr, "transform_space", 0, "Space", ICON_NONE);
+			uiItemR(sub, &dtar_ptr, "transform_space", 0, IFACE_("Space"), ICON_NONE);
 }
 
 /* driver settings for active F-Curve (only for 'Drivers' mode) */
@@ -608,10 +614,12 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
 	/* general actions - management */
 	col= uiLayoutColumn(pa->layout, 0);
 	block= uiLayoutGetBlock(col);
-		but= uiDefBut(block, BUT, B_IPO_DEPCHANGE, "Update Dependencies", 0, 0, 10*UI_UNIT_X, 22, NULL, 0.0, 0.0, 0, 0, "Force updates of dependencies");
+		but = uiDefBut(block, BUT, B_IPO_DEPCHANGE, IFACE_("Update Dependencies"), 0, 0, 10*UI_UNIT_X, 22,
+		              NULL, 0.0, 0.0, 0, 0, TIP_("Force updates of dependencies"));
 		uiButSetFunc(but, driver_update_flags_cb, fcu, NULL);
 		
-		but= uiDefBut(block, BUT, B_IPO_DEPCHANGE, "Remove Driver", 0, 0, 10*UI_UNIT_X, 18, NULL, 0.0, 0.0, 0, 0, "Remove this driver");
+		but = uiDefBut(block, BUT, B_IPO_DEPCHANGE, IFACE_("Remove Driver"), 0, 0, 10*UI_UNIT_X, 18,
+		              NULL, 0.0, 0.0, 0, 0, TIP_("Remove this driver"));
 		uiButSetNFunc(but, driver_remove_cb, MEM_dupallocN(ale), NULL);
 		
 	/* driver-level settings - type, expressions, and errors */
@@ -624,16 +632,16 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
 		/* show expression box if doing scripted drivers, and/or error messages when invalid drivers exist */
 		if (driver->type == DRIVER_TYPE_PYTHON) {
 			/* expression */
-			uiItemR(col, &driver_ptr, "expression", 0, "Expr", ICON_NONE);
+			uiItemR(col, &driver_ptr, "expression", 0, IFACE_("Expr"), ICON_NONE);
 			
 			/* errors? */
 			if (driver->flag & DRIVER_FLAG_INVALID)
-				uiItemL(col, "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, "ERROR: invalid target channel(s)", ICON_ERROR);
+				uiItemL(col, IFACE_("ERROR: invalid target channel(s)"), ICON_ERROR);
 		}
 		
 	col= uiLayoutColumn(pa->layout, 1);
@@ -645,7 +653,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
 			uiLayout *row= uiLayoutRow(col, 1);
 			char valBuf[32];
 			
-			uiItemL(row, "Driver Value:", ICON_NONE);
+			uiItemL(row, IFACE_("Driver Value:"), ICON_NONE);
 			
 			BLI_snprintf(valBuf, sizeof(valBuf), "%.3f", driver->curval);
 			uiItemL(row, valBuf, ICON_NONE);
@@ -654,7 +662,8 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
 	/* add driver variables */
 	col= uiLayoutColumn(pa->layout, 0);
 	block= uiLayoutGetBlock(col);
-		but= uiDefBut(block, BUT, B_IPO_DEPCHANGE, "Add Variable", 0, 0, 10*UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, "Add a new target variable for this Driver");
+		but = uiDefBut(block, BUT, B_IPO_DEPCHANGE, IFACE_("Add Variable"), 0, 0, 10*UI_UNIT_X, UI_UNIT_Y,
+		              NULL, 0.0, 0.0, 0, 0, TIP_("Add a new target variable for this Driver"));
 		uiButSetFunc(but, driver_add_var_cb, driver, NULL);
 	
 	/* loop over targets, drawing them */
@@ -677,7 +686,8 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
 				
 				/* remove button */
 				uiBlockSetEmboss(block, UI_EMBOSSN);
-					but= uiDefIconBut(block, BUT, B_IPO_DEPCHANGE, ICON_X, 290, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Delete target variable");
+					but = uiDefIconBut(block, BUT, B_IPO_DEPCHANGE, ICON_X, 290, 0, UI_UNIT_X, UI_UNIT_Y,
+					                  NULL, 0.0, 0.0, 0.0, 0.0, IFACE_("Delete target variable"));
 					uiButSetFunc(but, driver_delete_var_cb, driver, dvar);
 				uiBlockSetEmboss(block, UI_EMBOSS);
 			
@@ -709,7 +719,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa)
 
 				box= uiLayoutBox(col);
 				row= uiLayoutRow(box, 1);
-				uiItemL(row, "Value:", ICON_NONE);
+				uiItemL(row, IFACE_("Value:"), ICON_NONE);
 				
 				BLI_snprintf(valBuf, sizeof(valBuf), "%.3f", dvar->curval);
 				uiItemL(row, valBuf, ICON_NONE);
@@ -754,8 +764,8 @@ static void graph_panel_modifiers(const bContext *C, Panel *pa)
 		block= uiLayoutGetBlock(row);
 		
 		// XXX for now, this will be a operator button which calls a 'add modifier' operator
-		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"));
+		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"));
 		
 		/* copy/paste (as sub-row)*/
 		row= uiLayoutRow(row, 1);
@@ -781,21 +791,21 @@ void graph_buttons_register(ARegionType *art)
 
 	pt= MEM_callocN(sizeof(PanelType), "spacetype graph panel view");
 	strcpy(pt->idname, "GRAPH_PT_view");
-	strcpy(pt->label, "View Properties");
+	strcpy(pt->label, N_("View Properties"));
 	pt->draw= graph_panel_view;
 	pt->flag |= PNL_DEFAULT_CLOSED;
 	BLI_addtail(&art->paneltypes, pt);
 	
 	pt= MEM_callocN(sizeof(PanelType), "spacetype graph panel properties");
 	strcpy(pt->idname, "GRAPH_PT_properties");
-	strcpy(pt->label, "Active F-Curve");
+	strcpy(pt->label, N_("Active F-Curve"));
 	pt->draw= graph_panel_properties;
 	pt->poll= graph_panel_poll;
 	BLI_addtail(&art->paneltypes, pt);
 	
 	pt= MEM_callocN(sizeof(PanelType), "spacetype graph panel properties");
 	strcpy(pt->idname, "GRAPH_PT_key_properties");
-	strcpy(pt->label, "Active Keyframe");
+	strcpy(pt->label, N_("Active Keyframe"));
 	pt->draw= graph_panel_key_properties;
 	pt->poll= graph_panel_poll;
 	BLI_addtail(&art->paneltypes, pt);
@@ -803,14 +813,14 @@ void graph_buttons_register(ARegionType *art)
 
 	pt= MEM_callocN(sizeof(PanelType), "spacetype graph panel drivers");
 	strcpy(pt->idname, "GRAPH_PT_drivers");
-	strcpy(pt->label, "Drivers");
+	strcpy(pt->label, N_("Drivers"));
 	pt->draw= graph_panel_drivers;
 	pt->poll= graph_panel_drivers_poll;
 	BLI_addtail(&art->paneltypes, pt);
 
 	pt= MEM_callocN(sizeof(PanelType), "spacetype graph panel modifiers");
 	strcpy(pt->idname, "GRAPH_PT_modifiers");
-	strcpy(pt->label, "Modifiers");
+	strcpy(pt->label, N_("Modifiers"));
 	pt->draw= graph_panel_modifiers;
 	pt->poll= graph_panel_poll;
 	BLI_addtail(&art->paneltypes, pt);
@@ -821,7 +831,7 @@ static int graph_properties(bContext *C, wmOperator *UNUSED(op))
 	ScrArea *sa= CTX_wm_area(C);
 	ARegion *ar= graph_has_buttons_region(sa);
 	
-	if(ar)
+	if (ar)
 		ED_region_toggle_hidden(C, ar);
 
 	return OPERATOR_FINISHED;
@@ -829,13 +839,13 @@ static int graph_properties(bContext *C, wmOperator *UNUSED(op))
 
 void GRAPH_OT_properties(wmOperatorType *ot)
 {
-	ot->name= "Properties";
-	ot->idname= "GRAPH_OT_properties";
-	ot->description= "Toggle display properties panel";
+	ot->name = "Properties";
+	ot->idname = "GRAPH_OT_properties";
+	ot->description = "Toggle display properties panel";
 	
-	ot->exec= graph_properties;
-	ot->poll= ED_operator_graphedit_active;
+	ot->exec = graph_properties;
+	ot->poll = ED_operator_graphedit_active;
 
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 }
diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c
index 7bdb37d..fc84cfc 100644
--- a/source/blender/editors/space_graph/graph_draw.c
+++ b/source/blender/editors/space_graph/graph_draw.c
@@ -48,6 +48,7 @@
 #include "DNA_screen_types.h"
 #include "DNA_space_types.h"
 #include "DNA_windowmanager_types.h"
+#include "DNA_userdef_types.h"
 
 #include "BKE_context.h"
 #include "BKE_curve.h"
@@ -72,18 +73,10 @@
  * drawing components for some F-Curve (fcu)
  *	- selected F-Curves should be more visible than partially visible ones
  */
-#define drawFCurveFade(fcu) ( ((fcu)->flag & FCURVE_SELECTED)? 1.0f : 0.25f )
-
-/* set the color for some point from some value given packed into an int 
- *	- intV: integer value containing color info packed into an int
- *	- alpha: float value describing the 
- */
-#define cpackA(intVC, alpha)                                                  \
-	{                                                                         \
-		float _cpackCol[3];                                                   \
-		cpack_to_rgb(intVC, &_cpackCol[0], &_cpackCol[1], &_cpackCol[2]);     \
-		glColor4f(_cpackCol[0], _cpackCol[1], _cpackCol[2], alpha);           \
-	}
+static float fcurve_display_alpha(FCurve *fcu)
+{
+	return (fcu->flag & FCURVE_SELECTED) ? 1.0f : U.fcu_inactive_alpha;
+}
 
 /* *************************** */
 /* F-Curve Modifier Drawing */
@@ -125,7 +118,7 @@ static void draw_fcurve_modifier_controls_envelope (FModifier *fcm, View2D *v2d)
 		/* only draw if visible
 		 *	- min/max here are fixed, not relative
 		 */
-		if IN_RANGE(fed->time, (v2d->cur.xmin - fac), (v2d->cur.xmax + fac)) {
+		if (IN_RANGE(fed->time, (v2d->cur.xmin - fac), (v2d->cur.xmax + fac))) {
 			glVertex2f(fed->time, fed->min);
 			glVertex2f(fed->time, fed->max);
 		}
@@ -153,10 +146,10 @@ static void draw_fcurve_vertices_keyframes (FCurve *fcu, SpaceIpo *UNUSED(sipo),
 	bglBegin(GL_POINTS);
 	
 	for (i = 0; i < fcu->totvert; i++, bezt++) {
-		/* as an optimisation step, only draw those in view 
+		/* as an optimization step, only draw those in view 
 		 *	- we apply a correction factor to ensure that points don't pop in/out due to slight twitches of view size
 		 */
-		if IN_RANGE(bezt->vec[1][0], (v2d->cur.xmin - fac), (v2d->cur.xmax + fac)) {
+		if (IN_RANGE(bezt->vec[1][0], (v2d->cur.xmin - fac), (v2d->cur.xmax + fac))) {
 			if (edit) {
 				/* 'Keyframe' vertex only, as handle lines and handles have already been drawn
 				 *	- only draw those with correct selection state for the current drawing color
@@ -185,7 +178,7 @@ static void draw_fcurve_handle_control (float x, float y, float xscale, float ys
 {
 	static GLuint displist=0;
 	
-	/* initialise round circle shape */
+	/* initialize round circle shape */
 	if (displist == 0) {
 		GLUquadricObj *qobj;
 		
@@ -262,7 +255,7 @@ static void draw_fcurve_vertices_handles (FCurve *fcu, SpaceIpo *sipo, View2D *v
 static void set_fcurve_vertex_color (FCurve *fcu, short sel)
 {
 	/* Fade the 'intensity' of the vertices based on the selection of the curves too */
-	int alphaOffset= (int)((drawFCurveFade(fcu) - 1.0f) * 255);
+	int alphaOffset= (int)((fcurve_display_alpha(fcu) - 1.0f) * 255);
 	
 	/* Set color of curve vertex based on state of curve (i.e. 'Edit' Mode) */
 	if ((fcu->flag & FCURVE_PROTECTED)==0) {
@@ -292,8 +285,7 @@ static void draw_fcurve_vertices (SpaceIpo *sipo, ARegion *ar, FCurve *fcu, shor
 	glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
 	
 	/* draw the two handles first (if they're shown, the curve doesn't have just a single keyframe, and the curve is being edited) */
-	if (do_handles)
-	{
+	if (do_handles) {
 		set_fcurve_vertex_color(fcu, 0);
 		draw_fcurve_vertices_handles(fcu, sipo, v2d, 0, sel_handle_only);
 		
@@ -327,8 +319,7 @@ static int draw_fcurve_handles_check(SpaceIpo *sipo, FCurve *fcu)
 	{
 		return 0;
 	} 
-	else 
-	{
+	else {
 		return 1;
 	}
 }
@@ -368,20 +359,18 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu)
 				fp= bezt->vec[0];
 				
 				/* only draw first handle if previous segment had handles */
-				if ( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) ) 
-				{
+				if ((!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ))) {
 					UI_GetThemeColor3ubv(basecol + bezt->h1, col);
-					col[3]= drawFCurveFade(fcu) * 255;
+					col[3]= fcurve_display_alpha(fcu) * 255;
 					glColor4ubv((GLubyte *)col);
 					
 					glVertex2fv(fp); glVertex2fv(fp+3); 
 				}
 				
 				/* only draw second handle if this segment is bezier */
-				if (bezt->ipo == BEZT_IPO_BEZ) 
-				{
+				if (bezt->ipo == BEZT_IPO_BEZ) {
 					UI_GetThemeColor3ubv(basecol + bezt->h2, col);
-					col[3]= drawFCurveFade(fcu) * 255;
+					col[3]= fcurve_display_alpha(fcu) * 255;
 					glColor4ubv((GLubyte *)col);
 					
 					glVertex2fv(fp+3); glVertex2fv(fp+6); 
@@ -394,7 +383,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu)
 				{
 					fp= bezt->vec[0];
 					UI_GetThemeColor3ubv(basecol + bezt->h1, col);
-					col[3]= drawFCurveFade(fcu) * 255;
+					col[3]= fcurve_display_alpha(fcu) * 255;
 					glColor4ubv((GLubyte *)col);
 					
 					glVertex2fv(fp); glVertex2fv(fp+3); 
@@ -406,7 +395,7 @@ static void draw_fcurve_handles (SpaceIpo *sipo, FCurve *fcu)
 				{
 					fp= bezt->vec[1];
 					UI_GetThemeColor3ubv(basecol + bezt->h2, col);
-					col[3]= drawFCurveFade(fcu) * 255;
+					col[3]= fcurve_display_alpha(fcu) * 255;
 					glColor4ubv((GLubyte *)col);
 					
 					glVertex2fv(fp); glVertex2fv(fp+3); 
@@ -428,7 +417,7 @@ static void draw_fcurve_sample_control (float x, float y, float xscale, float ys
 {
 	static GLuint displist=0;
 	
-	/* initialise X shape */
+	/* initialize X shape */
 	if (displist == 0) {
 		displist= glGenLists(1);
 		glNewList(displist, GL_COMPILE);
@@ -502,7 +491,7 @@ static void draw_fcurve_curve (bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2
 	/* when opening a blend file on a different sized screen or while dragging the toolbar this can happen
 	 * best just bail out in this case */
 	UI_view2d_grid_size(grid, &dx, &dy);
-	if(dx <= 0.0f)
+	if (dx <= 0.0f)
 		return;
 
 
@@ -678,7 +667,7 @@ static void draw_fcurve_curve_bezts (bAnimContext *ac, ID *id, FCurve *fcu, View
 	}
 	
 	/* draw curve between first and last keyframe (if there are enough to do so) */
-	// TODO: optimise 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 */
@@ -850,7 +839,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri
 		/* draw curve:
 		 *	- curve line may be result of one or more destructive modifiers or just the raw data,
 		 *	  so we need to check which method should be used
-		 *	- controls from active modifier take precidence over keyframes
+		 *	- controls from active modifier take precedence over keyframes
 		 *	  (XXX! editing tools need to take this into account!)
 		 */
 		 
@@ -870,7 +859,7 @@ void graph_draw_curves (bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGri
 				/* set whatever color the curve has set 
 				 *	- unselected curves draw less opaque to help distinguish the selected ones
 				 */
-				glColor4f(fcu->color[0], fcu->color[1], fcu->color[2], drawFCurveFade(fcu));
+				glColor4f(fcu->color[0], fcu->color[1], fcu->color[2], fcurve_display_alpha(fcu));
 			}
 			
 			/* draw active F-Curve thicker than the rest to make it stand out */
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index fbcb954..76a2c92 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -53,6 +53,8 @@
 #include "RNA_define.h"
 #include "RNA_enum_types.h"
 
+#include "BLF_translation.h"
+
 #include "BKE_fcurve.h"
 #include "BKE_nla.h"
 #include "BKE_context.h"
@@ -182,16 +184,16 @@ static int graphkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
 void GRAPH_OT_previewrange_set (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Auto-Set Preview Range";
-	ot->idname= "GRAPH_OT_previewrange_set";
-	ot->description= "Automatically set Preview Range based on range of keyframes";
+	ot->name = "Auto-Set Preview Range";
+	ot->idname = "GRAPH_OT_previewrange_set";
+	ot->description = "Automatically set Preview Range based on range of keyframes";
 	
 	/* api callbacks */
-	ot->exec= graphkeys_previewrange_exec;
-	ot->poll= ED_operator_graphedit_active; // XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier...
+	ot->exec = graphkeys_previewrange_exec;
+	ot->poll = ED_operator_graphedit_active; // XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier...
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ****************** View-All Operator ****************** */
@@ -244,31 +246,31 @@ static int graphkeys_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
 void GRAPH_OT_view_all (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View All";
-	ot->idname= "GRAPH_OT_view_all";
-	ot->description= "Reset viewable area to show full keyframe range";
+	ot->name = "View All";
+	ot->idname = "GRAPH_OT_view_all";
+	ot->description = "Reset viewable area to show full keyframe range";
 	
 	/* api callbacks */
-	ot->exec= graphkeys_viewall_exec;
-	ot->poll= ED_operator_graphedit_active; // XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier...
+	ot->exec = graphkeys_viewall_exec;
+	ot->poll = ED_operator_graphedit_active; // XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier...
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 void GRAPH_OT_view_selected (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View Selected";
-	ot->idname= "GRAPH_OT_view_selected";
-	ot->description= "Reset viewable area to show selected keyframe range";
+	ot->name = "View Selected";
+	ot->idname = "GRAPH_OT_view_selected";
+	ot->description = "Reset viewable area to show selected keyframe range";
 
 	/* api callbacks */
-	ot->exec= graphkeys_view_selected_exec;
-	ot->poll= ED_operator_graphedit_active; // XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier...
+	ot->exec = graphkeys_view_selected_exec;
+	ot->poll = ED_operator_graphedit_active; // XXX: unchecked poll to get fsamples working too, but makes modifier damage trickier...
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ******************** Create Ghost-Curves Operator *********************** */
@@ -289,7 +291,7 @@ static void create_ghost_curves (bAnimContext *ac, int start, int end)
 	
 	/* sanity check */
 	if (start >= end) {
-		printf("Error: Frame range for Ghost F-Curve creation is inappropriate \n");
+		printf("Error: Frame range for Ghost F-Curve creation is inappropriate\n");
 		return;
 	}
 	
@@ -374,16 +376,16 @@ static int graphkeys_create_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op)
 void GRAPH_OT_ghost_curves_create (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Create Ghost Curves";
-	ot->idname= "GRAPH_OT_ghost_curves_create";
-	ot->description= "Create snapshot (Ghosts) of selected F-Curves as background aid for active Graph Editor";
+	ot->name = "Create Ghost Curves";
+	ot->idname = "GRAPH_OT_ghost_curves_create";
+	ot->description = "Create snapshot (Ghosts) of selected F-Curves as background aid for active Graph Editor";
 	
 	/* api callbacks */
-	ot->exec= graphkeys_create_ghostcurves_exec;
-	ot->poll= graphop_visible_keyframes_poll;
+	ot->exec = graphkeys_create_ghostcurves_exec;
+	ot->poll = graphop_visible_keyframes_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	// todo: add props for start/end frames
 }
@@ -417,16 +419,16 @@ static int graphkeys_clear_ghostcurves_exec(bContext *C, wmOperator *UNUSED(op))
 void GRAPH_OT_ghost_curves_clear (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear Ghost Curves";
-	ot->idname= "GRAPH_OT_ghost_curves_clear";
-	ot->description= "Clear F-Curve snapshots (Ghosts) for active Graph Editor";
+	ot->name = "Clear Ghost Curves";
+	ot->idname = "GRAPH_OT_ghost_curves_clear";
+	ot->description = "Clear F-Curve snapshots (Ghosts) for active Graph Editor";
 	
 	/* api callbacks */
-	ot->exec= graphkeys_clear_ghostcurves_exec;
-	ot->poll= ED_operator_graphedit_active;
+	ot->exec = graphkeys_clear_ghostcurves_exec;
+	ot->poll = ED_operator_graphedit_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ************************************************************************** */
@@ -512,20 +514,20 @@ static int graphkeys_insertkey_exec(bContext *C, wmOperator *op)
 void GRAPH_OT_keyframe_insert (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Insert Keyframes";
-	ot->idname= "GRAPH_OT_keyframe_insert";
-	ot->description= "Insert keyframes for the specified channels";
+	ot->name = "Insert Keyframes";
+	ot->idname = "GRAPH_OT_keyframe_insert";
+	ot->description = "Insert keyframes for the specified channels";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= graphkeys_insertkey_exec;
-	ot->poll= graphop_editable_keyframes_poll;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = graphkeys_insertkey_exec;
+	ot->poll = graphop_editable_keyframes_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* id-props */
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_graphkeys_insertkey_types, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_graphkeys_insertkey_types, 0, "Type", "");
 }
 
 /* ******************** Click-Insert Keyframes Operator ************************* */
@@ -619,17 +621,17 @@ static int graphkeys_click_insert_invoke (bContext *C, wmOperator *op, wmEvent *
 void GRAPH_OT_click_insert (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Click-Insert Keyframes";
-	ot->idname= "GRAPH_OT_click_insert";
-	ot->description= "Insert new keyframe at the cursor position for the active F-Curve";
+	ot->name = "Click-Insert Keyframes";
+	ot->idname = "GRAPH_OT_click_insert";
+	ot->description = "Insert new keyframe at the cursor position for the active F-Curve";
 	
 	/* api callbacks */
-	ot->invoke= graphkeys_click_insert_invoke;
-	ot->exec= graphkeys_click_insert_exec;
-	ot->poll= graphop_active_fcurve_poll;
+	ot->invoke = graphkeys_click_insert_invoke;
+	ot->exec = graphkeys_click_insert_exec;
+	ot->poll = graphop_active_fcurve_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_float(ot->srna, "frame", 1.0f, -FLT_MAX, FLT_MAX, "Frame Number", "Frame to insert keyframe on", 0, 100);
@@ -702,16 +704,16 @@ static int graphkeys_copy_exec(bContext *C, wmOperator *op)
 void GRAPH_OT_copy (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Copy Keyframes";
-	ot->idname= "GRAPH_OT_copy";
-	ot->description= "Copy selected keyframes to the copy/paste buffer";
+	ot->name = "Copy Keyframes";
+	ot->idname = "GRAPH_OT_copy";
+	ot->description = "Copy selected keyframes to the copy/paste buffer";
 	
 	/* api callbacks */
-	ot->exec= graphkeys_copy_exec;
-	ot->poll= graphop_editable_keyframes_poll;
+	ot->exec = graphkeys_copy_exec;
+	ot->poll = graphop_editable_keyframes_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 
@@ -747,17 +749,17 @@ static int graphkeys_paste_exec(bContext *C, wmOperator *op)
 void GRAPH_OT_paste (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Paste Keyframes";
-	ot->idname= "GRAPH_OT_paste";
-	ot->description= "Paste keyframes from copy/paste buffer for the selected channels, starting on the current frame";
+	ot->name = "Paste Keyframes";
+	ot->idname = "GRAPH_OT_paste";
+	ot->description = "Paste keyframes from copy/paste buffer for the selected channels, starting on the current frame";
 	
 	/* api callbacks */
-//	ot->invoke= WM_operator_props_popup; // better wait for graph redo panel
-	ot->exec= graphkeys_paste_exec;
-	ot->poll= graphop_editable_keyframes_poll;
+//	ot->invoke = WM_operator_props_popup; // better wait for graph redo panel
+	ot->exec = graphkeys_paste_exec;
+	ot->poll = graphop_editable_keyframes_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	RNA_def_enum(ot->srna, "offset", keyframe_paste_offset_items, KEYFRAME_PASTE_OFFSET_CFRA_START, "Offset", "Paste time offset of keys");
 	RNA_def_enum(ot->srna, "merge", keyframe_paste_merge_items, KEYFRAME_PASTE_MERGE_MIX, "Type", "Method of merging pasted keys and existing");
@@ -816,17 +818,17 @@ static int graphkeys_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
 void GRAPH_OT_duplicate (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Duplicate Keyframes";
-	ot->idname= "GRAPH_OT_duplicate";
-	ot->description= "Make a copy of all selected keyframes";
+	ot->name = "Duplicate Keyframes";
+	ot->idname = "GRAPH_OT_duplicate";
+	ot->description = "Make a copy of all selected keyframes";
 	
 	/* api callbacks */
-	ot->invoke= graphkeys_duplicate_invoke;
-	ot->exec= graphkeys_duplicate_exec;
-	ot->poll= graphop_editable_keyframes_poll;
+	ot->invoke = graphkeys_duplicate_invoke;
+	ot->exec = graphkeys_duplicate_exec;
+	ot->poll = graphop_editable_keyframes_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* to give to transform */
 	RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
@@ -886,17 +888,17 @@ static int graphkeys_delete_exec(bContext *C, wmOperator *UNUSED(op))
 void GRAPH_OT_delete (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete Keyframes";
-	ot->idname= "GRAPH_OT_delete";
-	ot->description= "Remove all selected keyframes";
+	ot->name = "Delete Keyframes";
+	ot->idname = "GRAPH_OT_delete";
+	ot->description = "Remove all selected keyframes";
 	
 	/* api callbacks */
-	ot->invoke= WM_operator_confirm;
-	ot->exec= graphkeys_delete_exec;
-	ot->poll= graphop_editable_keyframes_poll;
+	ot->invoke = WM_operator_confirm;
+	ot->exec = graphkeys_delete_exec;
+	ot->poll = graphop_editable_keyframes_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ******************** Clean Keyframes Operator ************************* */
@@ -948,20 +950,20 @@ static int graphkeys_clean_exec(bContext *C, wmOperator *op)
 void GRAPH_OT_clean (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clean Keyframes";
-	ot->idname= "GRAPH_OT_clean";
-	ot->description= "Simplify F-Curves by removing closely spaced keyframes";
+	ot->name = "Clean Keyframes";
+	ot->idname = "GRAPH_OT_clean";
+	ot->description = "Simplify F-Curves by removing closely spaced keyframes";
 	
 	/* api callbacks */
-	//ot->invoke=  // XXX we need that number popup for this! 
-	ot->exec= graphkeys_clean_exec;
-	ot->poll= graphop_editable_keyframes_poll;
+	//ot->invoke =  // XXX we need that number popup for this! 
+	ot->exec = graphkeys_clean_exec;
+	ot->poll = graphop_editable_keyframes_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
-	ot->prop= RNA_def_float(ot->srna, "threshold", 0.001f, 0.0f, FLT_MAX, "Threshold", "", 0.0f, 1000.0f);
+	ot->prop = RNA_def_float(ot->srna, "threshold", 0.001f, 0.0f, FLT_MAX, "Threshold", "", 0.0f, 1000.0f);
 }
 
 /* ******************** Bake F-Curve Operator *********************** */
@@ -1031,17 +1033,17 @@ static int graphkeys_bake_exec(bContext *C, wmOperator *UNUSED(op))
 void GRAPH_OT_bake (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Bake Curve";
-	ot->idname= "GRAPH_OT_bake";
-	ot->description= "Bake selected F-Curves to a set of sampled points defining a similar curve";
+	ot->name = "Bake Curve";
+	ot->idname = "GRAPH_OT_bake";
+	ot->description = "Bake selected F-Curves to a set of sampled points defining a similar curve";
 	
 	/* api callbacks */
-	ot->invoke= WM_operator_confirm; // FIXME...
-	ot->exec= graphkeys_bake_exec;
-	ot->poll= graphop_selected_fcurve_poll; 
+	ot->invoke = WM_operator_confirm; // FIXME...
+	ot->exec = graphkeys_bake_exec;
+	ot->poll = graphop_selected_fcurve_poll; 
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	// todo: add props for start/end frames
 }
@@ -1072,7 +1074,7 @@ static float fcurve_samplingcb_sound (FCurve *UNUSED(fcu), void *data, float eva
 	tSoundBakeInfo *sbi= (tSoundBakeInfo *)data;
 
 	int position = evaltime - sbi->cfra;
-	if((position < 0) || (position >= sbi->length))
+	if ((position < 0) || (position >= sbi->length))
 		return 0.0f;
 
 	return sbi->samples[position];
@@ -1175,17 +1177,17 @@ static int graphkeys_sound_bake_invoke (bContext *C, wmOperator *op, wmEvent *ev
 void GRAPH_OT_sound_bake (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Bake Sound to F-Curves";
-	ot->idname= "GRAPH_OT_sound_bake";
-	ot->description= "Bakes a sound wave to selected F-Curves";
+	ot->name = "Bake Sound to F-Curves";
+	ot->idname = "GRAPH_OT_sound_bake";
+	ot->description = "Bakes a sound wave to selected F-Curves";
 
 	/* api callbacks */
-	ot->invoke= graphkeys_sound_bake_invoke;
-	ot->exec= graphkeys_sound_bake_exec;
-	ot->poll= graphop_selected_fcurve_poll;
+	ot->invoke = graphkeys_sound_bake_invoke;
+	ot->exec = graphkeys_sound_bake_exec;
+	ot->poll = graphop_selected_fcurve_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
@@ -1249,16 +1251,16 @@ static int graphkeys_sample_exec(bContext *C, wmOperator *UNUSED(op))
 void GRAPH_OT_sample (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Sample Keyframes";
-	ot->idname= "GRAPH_OT_sample";
-	ot->description= "Add keyframes on every frame between the selected keyframes";
+	ot->name = "Sample Keyframes";
+	ot->idname = "GRAPH_OT_sample";
+	ot->description = "Add keyframes on every frame between the selected keyframes";
 	
 	/* api callbacks */
-	ot->exec= graphkeys_sample_exec;
-	ot->poll= graphop_editable_keyframes_poll;
+	ot->exec = graphkeys_sample_exec;
+	ot->poll = graphop_editable_keyframes_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 
@@ -1358,20 +1360,20 @@ static int graphkeys_expo_exec(bContext *C, wmOperator *op)
 void GRAPH_OT_extrapolation_type (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Keyframe Extrapolation";
-	ot->idname= "GRAPH_OT_extrapolation_type";
-	ot->description= "Set extrapolation mode for selected F-Curves";
+	ot->name = "Set Keyframe Extrapolation";
+	ot->idname = "GRAPH_OT_extrapolation_type";
+	ot->description = "Set extrapolation mode for selected F-Curves";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= graphkeys_expo_exec;
-	ot->poll= graphop_editable_keyframes_poll;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = graphkeys_expo_exec;
+	ot->poll = graphop_editable_keyframes_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* id-props */
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_graphkeys_expo_types, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_graphkeys_expo_types, 0, "Type", "");
 }
 
 /* ******************** Set Interpolation-Type Operator *********************** */
@@ -1427,20 +1429,20 @@ static int graphkeys_ipo_exec(bContext *C, wmOperator *op)
 void GRAPH_OT_interpolation_type (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Keyframe Interpolation";
-	ot->idname= "GRAPH_OT_interpolation_type";
-	ot->description= "Set interpolation mode for the F-Curve segments starting from the selected keyframes";
+	ot->name = "Set Keyframe Interpolation";
+	ot->idname = "GRAPH_OT_interpolation_type";
+	ot->description = "Set interpolation mode for the F-Curve segments starting from the selected keyframes";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= graphkeys_ipo_exec;
-	ot->poll= graphop_editable_keyframes_poll;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = graphkeys_ipo_exec;
+	ot->poll = graphop_editable_keyframes_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* id-props */
-	ot->prop= RNA_def_enum(ot->srna, "type", beztriple_interpolation_mode_items, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", beztriple_interpolation_mode_items, 0, "Type", "");
 }
 
 /* ******************** Set Handle-Type Operator *********************** */
@@ -1504,20 +1506,20 @@ static int graphkeys_handletype_exec(bContext *C, wmOperator *op)
  void GRAPH_OT_handle_type (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Keyframe Handle Type";
-	ot->idname= "GRAPH_OT_handle_type";
-	ot->description= "Set type of handle for selected keyframes";
+	ot->name = "Set Keyframe Handle Type";
+	ot->idname = "GRAPH_OT_handle_type";
+	ot->description = "Set type of handle for selected keyframes";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= graphkeys_handletype_exec;
-	ot->poll= graphop_editable_keyframes_poll;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = graphkeys_handletype_exec;
+	ot->poll = graphop_editable_keyframes_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* id-props */
-	ot->prop= RNA_def_enum(ot->srna, "type", keyframe_handle_type_items, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", keyframe_handle_type_items, 0, "Type", "");
 }
 
 /* ************************************************************************** */
@@ -1582,7 +1584,7 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op)
 			continue;
 		}
 		
-		/* optimisation: assume that xyz curves will always be stored consecutively,
+		/* optimization: assume that xyz curves will always be stored consecutively,
 		 * so if the paths or the ID's don't match up, then a curve needs to be added 
 		 * to a new group
 		 */
@@ -1698,16 +1700,16 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op)
 void GRAPH_OT_euler_filter (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Euler Discontinuity Filter";
-	ot->idname= "GRAPH_OT_euler_filter";
-	ot->description= "Fixes the most common causes of gimbal lock in the selected Euler Rotation F-Curves";
+	ot->name = "Euler Discontinuity Filter";
+	ot->idname = "GRAPH_OT_euler_filter";
+	ot->description = "Fixes the most common causes of gimbal lock in the selected Euler Rotation F-Curves";
 	
 	/* api callbacks */
-	ot->exec= graphkeys_euler_filter_exec;
-	ot->poll= graphop_editable_keyframes_poll;
+	ot->exec = graphkeys_euler_filter_exec;
+	ot->poll = graphop_editable_keyframes_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ***************** Jump to Selected Frames Operator *********************** */
@@ -1772,16 +1774,16 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
 void GRAPH_OT_frame_jump (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Jump to Frame";
-	ot->idname= "GRAPH_OT_frame_jump";
-	ot->description= "Set the current frame to the average frame of the selected keyframes";
+	ot->name = "Jump to Frame";
+	ot->idname = "GRAPH_OT_frame_jump";
+	ot->description = "Set the current frame to the average frame of the selected keyframes";
 	
 	/* api callbacks */
-	ot->exec= graphkeys_framejump_exec;
-	ot->poll= graphop_visible_keyframes_poll;
+	ot->exec = graphkeys_framejump_exec;
+	ot->poll = graphop_visible_keyframes_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ******************** Snap Keyframes Operator *********************** */
@@ -1876,20 +1878,20 @@ static int graphkeys_snap_exec(bContext *C, wmOperator *op)
 void GRAPH_OT_snap (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Snap Keys";
-	ot->idname= "GRAPH_OT_snap";
-	ot->description= "Snap selected keyframes to the chosen times/values";
+	ot->name = "Snap Keys";
+	ot->idname = "GRAPH_OT_snap";
+	ot->description = "Snap selected keyframes to the chosen times/values";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= graphkeys_snap_exec;
-	ot->poll= graphop_editable_keyframes_poll;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = graphkeys_snap_exec;
+	ot->poll = graphop_editable_keyframes_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* id-props */
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_graphkeys_snap_types, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_graphkeys_snap_types, 0, "Type", "");
 }
 
 /* ******************** Mirror Keyframes Operator *********************** */
@@ -1994,20 +1996,20 @@ static int graphkeys_mirror_exec(bContext *C, wmOperator *op)
 void GRAPH_OT_mirror (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Mirror Keys";
-	ot->idname= "GRAPH_OT_mirror";
-	ot->description= "Flip selected keyframes over the selected mirror line";
+	ot->name = "Mirror Keys";
+	ot->idname = "GRAPH_OT_mirror";
+	ot->description = "Flip selected keyframes over the selected mirror line";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= graphkeys_mirror_exec;
-	ot->poll= graphop_editable_keyframes_poll;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = graphkeys_mirror_exec;
+	ot->poll = graphop_editable_keyframes_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* id-props */
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_graphkeys_mirror_types, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_graphkeys_mirror_types, 0, "Type", "");
 }
 
 /* ******************** Smooth Keyframes Operator *********************** */
@@ -2049,16 +2051,16 @@ static int graphkeys_smooth_exec(bContext *C, wmOperator *UNUSED(op))
 void GRAPH_OT_smooth (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Smooth Keys";
-	ot->idname= "GRAPH_OT_smooth";
-	ot->description= "Apply weighted moving means to make selected F-Curves less bumpy";
+	ot->name = "Smooth Keys";
+	ot->idname = "GRAPH_OT_smooth";
+	ot->description = "Apply weighted moving means to make selected F-Curves less bumpy";
 	
 	/* api callbacks */
-	ot->exec= graphkeys_smooth_exec;
-	ot->poll= graphop_editable_keyframes_poll;
+	ot->exec = graphkeys_smooth_exec;
+	ot->poll = graphop_editable_keyframes_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ************************************************************************** */
@@ -2074,7 +2076,7 @@ static int graph_fmodifier_add_invoke (bContext *C, wmOperator *op, wmEvent *UNU
 	uiLayout *layout;
 	int i;
 	
-	pup= uiPupMenuBegin(C, "Add F-Curve Modifier", ICON_NONE);
+	pup= uiPupMenuBegin(C, IFACE_("Add F-Curve Modifier"), ICON_NONE);
 	layout= uiPupMenuLayout(pup);
 	
 	/* start from 1 to skip the 'Invalid' modifier type */
@@ -2087,7 +2089,8 @@ static int graph_fmodifier_add_invoke (bContext *C, wmOperator *op, wmEvent *UNU
 			continue;
 		
 		/* create operator menu item with relevant properties filled in */
-		props_ptr= uiItemFullO_ptr(layout, ot, fmi->name, ICON_NONE, NULL, WM_OP_EXEC_REGION_WIN, UI_ITEM_O_RETURN_PROPS);
+		props_ptr= uiItemFullO_ptr(layout, ot, IFACE_(fmi->name), ICON_NONE,
+		                           NULL, WM_OP_EXEC_REGION_WIN, UI_ITEM_O_RETURN_PROPS);
 			/* the only thing that gets set from the menu is the type of F-Modifier to add */
 		RNA_enum_set(&props_ptr, "type", i);
 			/* the following properties are just repeats of existing ones... */
@@ -2152,20 +2155,20 @@ static int graph_fmodifier_add_exec(bContext *C, wmOperator *op)
 void GRAPH_OT_fmodifier_add (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add F-Curve Modifier";
-	ot->idname= "GRAPH_OT_fmodifier_add";
-	ot->description= "Add F-Modifiers to the selected F-Curves";
+	ot->name = "Add F-Curve Modifier";
+	ot->idname = "GRAPH_OT_fmodifier_add";
+	ot->description = "Add F-Modifiers to the selected F-Curves";
 	
 	/* api callbacks */
-	ot->invoke= graph_fmodifier_add_invoke;
-	ot->exec= graph_fmodifier_add_exec;
-	ot->poll= graphop_selected_fcurve_poll; 
+	ot->invoke = graph_fmodifier_add_invoke;
+	ot->exec = graph_fmodifier_add_exec;
+	ot->poll = graphop_selected_fcurve_poll; 
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* id-props */
-	ot->prop= RNA_def_enum(ot->srna, "type", fmodifier_type_items, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", fmodifier_type_items, 0, "Type", "");
 	RNA_def_boolean(ot->srna, "only_active", 1, "Only Active", "Only add F-Modifier to active F-Curve");
 }
 
@@ -2210,16 +2213,16 @@ static int graph_fmodifier_copy_exec(bContext *C, wmOperator *op)
 void GRAPH_OT_fmodifier_copy (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Copy F-Modifiers";
-	ot->idname= "GRAPH_OT_fmodifier_copy";
-	ot->description= "Copy the F-Modifier(s) of the active F-Curve";
+	ot->name = "Copy F-Modifiers";
+	ot->idname = "GRAPH_OT_fmodifier_copy";
+	ot->description = "Copy the F-Modifier(s) of the active F-Curve";
 	
 	/* api callbacks */
-	ot->exec= graph_fmodifier_copy_exec;
-	ot->poll= graphop_active_fcurve_poll; 
+	ot->exec = graph_fmodifier_copy_exec;
+	ot->poll = graphop_active_fcurve_poll; 
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* id-props */
 	//ot->prop = RNA_def_boolean(ot->srna, "all", 1, "All F-Modifiers", "Copy all the F-Modifiers, instead of just the active one");
@@ -2272,16 +2275,16 @@ static int graph_fmodifier_paste_exec(bContext *C, wmOperator *op)
 void GRAPH_OT_fmodifier_paste (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Paste F-Modifiers";
-	ot->idname= "GRAPH_OT_fmodifier_paste";
-	ot->description= "Add copied F-Modifiers to the selected F-Curves";
+	ot->name = "Paste F-Modifiers";
+	ot->idname = "GRAPH_OT_fmodifier_paste";
+	ot->description = "Add copied F-Modifiers to the selected F-Curves";
 	
 	/* api callbacks */
-	ot->exec= graph_fmodifier_paste_exec;
-	ot->poll= graphop_active_fcurve_poll;
+	ot->exec = graph_fmodifier_paste_exec;
+	ot->poll = graphop_active_fcurve_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ************************************************************************** */
diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h
index bc4fa39..d7274b0 100644
--- a/source/blender/editors/space_graph/graph_intern.h
+++ b/source/blender/editors/space_graph/graph_intern.h
@@ -28,8 +28,8 @@
  *  \ingroup spgraph
  */
 
-#ifndef ED_GRAPH_INTERN_H
-#define ED_GRAPH_INTERN_H
+#ifndef __GRAPH_INTERN_H__
+#define __GRAPH_INTERN_H__
 
 struct bContext;
 struct wmWindowManager;
@@ -160,8 +160,6 @@ void graph_buttons_register(struct ARegionType *art);
 
 struct bAnimListElem *get_active_fcurve_channel(struct bAnimContext *ac);
 
-short fcurve_needs_draw_fmodifier_controls(struct FCurve *fcu, struct FModifier *fcm);
-
 int graphop_visible_keyframes_poll(struct bContext *C);
 int graphop_editable_keyframes_poll(struct bContext *C);
 int graphop_active_fcurve_poll(struct bContext *C);
@@ -173,5 +171,5 @@ void graphedit_keymap(struct wmKeyConfig *keyconf);
 void graphedit_operatortypes(void);
 
 
-#endif /* ED_GRAPH_INTERN_H */
+#endif /* __GRAPH_INTERN_H__ */
 
diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c
index aba5809..2887fa1 100644
--- a/source/blender/editors/space_graph/graph_ops.c
+++ b/source/blender/editors/space_graph/graph_ops.c
@@ -164,18 +164,18 @@ static int graphview_cursor_modal(bContext *C, wmOperator *op, wmEvent *event)
 static void GRAPH_OT_cursor_set(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Cursor";
-	ot->idname= "GRAPH_OT_cursor_set";
-	ot->description= "Interactively set the current frame number and value cursor";
+	ot->name = "Set Cursor";
+	ot->idname = "GRAPH_OT_cursor_set";
+	ot->description = "Interactively set the current frame number and value cursor";
 	
 	/* api callbacks */
-	ot->exec= graphview_cursor_exec;
-	ot->invoke= graphview_cursor_invoke;
-	ot->modal= graphview_cursor_modal;
-	ot->poll= ED_operator_graphedit_active;
+	ot->exec = graphview_cursor_exec;
+	ot->invoke = graphview_cursor_invoke;
+	ot->modal = graphview_cursor_modal;
+	ot->poll = ED_operator_graphedit_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_BLOCKING|OPTYPE_UNDO;
+	ot->flag = OPTYPE_BLOCKING|OPTYPE_UNDO;
 
 	/* rna */
 	RNA_def_int(ot->srna, "frame", 0, MINAFRAME, MAXFRAME, "Frame", "", MINAFRAME, MAXFRAME);
@@ -241,11 +241,11 @@ void ED_operatormacros_graph(void)
 	wmOperatorType *ot;
 	wmOperatorTypeMacro *otmacro;
 	
-	ot= WM_operatortype_append_macro("GRAPH_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
+	ot = WM_operatortype_append_macro("GRAPH_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
 	if (ot) {
-		ot->description= "Make a copy of all selected keyframes and move them";
+		ot->description = "Make a copy of all selected keyframes and move them";
 		WM_operatortype_macro_define(ot, "GRAPH_OT_duplicate");
-		otmacro= WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform");
+		otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform");
 		RNA_enum_set(otmacro->ptr, "mode", TFM_TIME_DUPLICATE);
 	}
 }
@@ -273,23 +273,23 @@ static void graphedit_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap)
 		RNA_boolean_set(kmi->ptr, "extend", FALSE);
 		RNA_boolean_set(kmi->ptr, "curves", FALSE);
 		RNA_boolean_set(kmi->ptr, "column", FALSE);
-	kmi= WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
+	kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
 		RNA_boolean_set(kmi->ptr, "extend", FALSE);
 		RNA_boolean_set(kmi->ptr, "curves", FALSE);
 		RNA_boolean_set(kmi->ptr, "column", TRUE);
-	kmi= WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
 		RNA_boolean_set(kmi->ptr, "extend", TRUE);
 		RNA_boolean_set(kmi->ptr, "curves", FALSE);
 		RNA_boolean_set(kmi->ptr, "column", FALSE);
-	kmi= WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT|KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_ALT|KM_SHIFT, 0);
 		RNA_boolean_set(kmi->ptr, "extend", TRUE);
 		RNA_boolean_set(kmi->ptr, "curves", FALSE);
 		RNA_boolean_set(kmi->ptr, "column", TRUE);
-	kmi= WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_ALT, 0);
+	kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_ALT, 0);
 		RNA_boolean_set(kmi->ptr, "extend", FALSE);
 		RNA_boolean_set(kmi->ptr, "curves", TRUE);
 		RNA_boolean_set(kmi->ptr, "column", FALSE);
-	kmi= WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_ALT|KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "GRAPH_OT_clickselect", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_ALT|KM_SHIFT, 0);
 		RNA_boolean_set(kmi->ptr, "extend", TRUE);
 		RNA_boolean_set(kmi->ptr, "curves", TRUE);
 		RNA_boolean_set(kmi->ptr, "column", FALSE);
@@ -298,14 +298,14 @@ static void graphedit_keymap_keyframes (wmKeyConfig *keyconf, wmKeyMap *keymap)
 	kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
 		RNA_boolean_set(kmi->ptr, "extend", FALSE);
 		RNA_enum_set(kmi->ptr, "mode", GRAPHKEYS_LRSEL_TEST);
-	kmi= WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
 		RNA_boolean_set(kmi->ptr, "extend", TRUE);
 		RNA_enum_set(kmi->ptr, "mode", GRAPHKEYS_LRSEL_TEST);
 	
-	kmi= WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", LEFTBRACKETKEY, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", LEFTBRACKETKEY, KM_PRESS, 0, 0);
 		RNA_boolean_set(kmi->ptr, "extend", FALSE);
 		RNA_enum_set(kmi->ptr, "mode", GRAPHKEYS_LRSEL_LEFT);
-	kmi= WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "GRAPH_OT_select_leftright", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
 		RNA_boolean_set(kmi->ptr, "extend", FALSE);
 		RNA_enum_set(kmi->ptr, "mode", GRAPHKEYS_LRSEL_RIGHT);
 	
@@ -406,7 +406,7 @@ void graphedit_keymap(wmKeyConfig *keyconf)
 	wmKeyMap *keymap;
 	
 	/* keymap for all regions */
-	keymap= WM_keymap_find(keyconf, "Graph Editor Generic", SPACE_IPO, 0);
+	keymap = WM_keymap_find(keyconf, "Graph Editor Generic", SPACE_IPO, 0);
 	WM_keymap_add_item(keymap, "GRAPH_OT_properties", NKEY, KM_PRESS, 0, 0);
 		/* extrapolation works on channels, not keys */
 	WM_keymap_add_item(keymap, "GRAPH_OT_extrapolation_type", EKEY, KM_PRESS, KM_SHIFT, 0);
@@ -418,7 +418,7 @@ void graphedit_keymap(wmKeyConfig *keyconf)
 	 */
 	
 	/* keyframes */
-	keymap= WM_keymap_find(keyconf, "Graph Editor", SPACE_IPO, 0);
+	keymap = WM_keymap_find(keyconf, "Graph Editor", SPACE_IPO, 0);
 	graphedit_keymap_keyframes(keyconf, keymap);
 }
 
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index 617dd17..864708a 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -154,7 +154,7 @@ static int graphkeys_deselectall_exec(bContext *C, wmOperator *op)
 	if (ANIM_animdata_get_context(C, &ac) == 0)
 		return OPERATOR_CANCELLED;
 		
-	/* 'standard' behaviour - check if selected, then apply relevant selection */
+	/* 'standard' behavior - check if selected, then apply relevant selection */
 	if (RNA_boolean_get(op->ptr, "invert"))
 		deselect_graph_keys(&ac, 0, SELECT_INVERT, TRUE);
 	else
@@ -169,19 +169,19 @@ static int graphkeys_deselectall_exec(bContext *C, wmOperator *op)
 void GRAPH_OT_select_all_toggle (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select All";
-	ot->idname= "GRAPH_OT_select_all_toggle";
-	ot->description= "Toggle selection of all keyframes";
+	ot->name = "Select All";
+	ot->idname = "GRAPH_OT_select_all_toggle";
+	ot->description = "Toggle selection of all keyframes";
 	
 	/* api callbacks */
-	ot->exec= graphkeys_deselectall_exec;
-	ot->poll= graphop_visible_keyframes_poll;
+	ot->exec = graphkeys_deselectall_exec;
+	ot->poll = graphop_visible_keyframes_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+	ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
 	
 	/* props */
-	ot->prop= RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
+	ot->prop = RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
 }
 
 /* ******************** Border Select Operator **************************** */
@@ -193,7 +193,7 @@ void GRAPH_OT_select_all_toggle (wmOperatorType *ot)
  */
 
 /* Borderselect only selects keyframes now, as overshooting handles often get caught too,
- * which means that they may be inadvertantly moved as well. However, incl_handles overrides
+ * which means that they may be inadvertently moved as well. However, incl_handles overrides
  * this, and allow handles to be considered independently too.
  * Also, for convenience, handles should get same status as keyframe (if it was within bounds).
  */
@@ -316,16 +316,16 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op)
 	incl_handles = RNA_boolean_get(op->ptr, "include_handles");
 	
 	/* get settings from operator */
-	rect.xmin= RNA_int_get(op->ptr, "xmin");
-	rect.ymin= RNA_int_get(op->ptr, "ymin");
-	rect.xmax= RNA_int_get(op->ptr, "xmax");
-	rect.ymax= RNA_int_get(op->ptr, "ymax");
+	rect.xmin = RNA_int_get(op->ptr, "xmin");
+	rect.ymin = RNA_int_get(op->ptr, "ymin");
+	rect.xmax = RNA_int_get(op->ptr, "xmax");
+	rect.ymax = RNA_int_get(op->ptr, "ymax");
 	
 	/* selection 'mode' depends on whether borderselect region only matters on one axis */
 	if (RNA_boolean_get(op->ptr, "axis_range")) {
 		/* mode depends on which axis of the range is larger to determine which axis to use 
 		 *	- checking this in region-space is fine, as it's fundamentally still going to be a different rect size
-		 *	- the frame-range select option is favoured over the channel one (x over y), as frame-range one is often
+		 *	- the frame-range select option is favored over the channel one (x over y), as frame-range one is often
 		 *	  used for tweaking timing when "blocking", while channels is not that useful...
 		 */
 		if ((rect.xmax - rect.xmin) >= (rect.ymax - rect.ymin))
@@ -348,25 +348,25 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op)
 void GRAPH_OT_select_border(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Border Select";
-	ot->idname= "GRAPH_OT_select_border";
-	ot->description= "Select all keyframes within the specified region";
+	ot->name = "Border Select";
+	ot->idname = "GRAPH_OT_select_border";
+	ot->description = "Select all keyframes within the specified region";
 	
 	/* api callbacks */
-	ot->invoke= WM_border_select_invoke;
-	ot->exec= graphkeys_borderselect_exec;
-	ot->modal= WM_border_select_modal;
-	ot->cancel= WM_border_select_cancel;
+	ot->invoke = WM_border_select_invoke;
+	ot->exec = graphkeys_borderselect_exec;
+	ot->modal = WM_border_select_modal;
+	ot->cancel = WM_border_select_cancel;
 	
-	ot->poll= graphop_visible_keyframes_poll;
+	ot->poll = graphop_visible_keyframes_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+	ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
 	
 	/* rna */
 	WM_operator_properties_gesture_border(ot, TRUE);
 	
-	ot->prop= RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
+	ot->prop = RNA_def_boolean(ot->srna, "axis_range", 0, "Axis Range", "");
 	RNA_def_boolean(ot->srna, "include_handles", 0, "Include Handles", "Are handles tested individually against the selection criteria");
 }
 
@@ -449,7 +449,7 @@ static void columnselect_graph_keys (bAnimContext *ac, short mode)
 	KeyframeEditFunc select_cb, ok_cb;
 	KeyframeEditData ked;
 	
-	/* initialise keyframe editing data */
+	/* initialize keyframe editing data */
 	memset(&ked, 0, sizeof(KeyframeEditData));
 	
 	/* build list of columns */
@@ -538,19 +538,19 @@ static int graphkeys_columnselect_exec(bContext *C, wmOperator *op)
 void GRAPH_OT_select_column (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select All";
-	ot->idname= "GRAPH_OT_select_column";
-	ot->description= "Select all keyframes on the specified frame(s)";
+	ot->name = "Select All";
+	ot->idname = "GRAPH_OT_select_column";
+	ot->description = "Select all keyframes on the specified frame(s)";
 	
 	/* api callbacks */
-	ot->exec= graphkeys_columnselect_exec;
-	ot->poll= graphop_visible_keyframes_poll;
+	ot->exec = graphkeys_columnselect_exec;
+	ot->poll = graphop_visible_keyframes_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+	ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
 	
 	/* props */
-	ot->prop= RNA_def_enum(ot->srna, "mode", prop_column_select_types, 0, "Mode", "");
+	ot->prop = RNA_def_enum(ot->srna, "mode", prop_column_select_types, 0, "Mode", "");
 }
 
 /* ******************** Select Linked Operator *********************** */
@@ -597,15 +597,15 @@ void GRAPH_OT_select_linked (wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name = "Select Linked";
-	ot->idname= "GRAPH_OT_select_linked";
+	ot->idname = "GRAPH_OT_select_linked";
 	ot->description = "Select keyframes occurring in the same F-Curves as selected ones";
 	
 	/* api callbacks */
-	ot->exec= graphkeys_select_linked_exec;
-	ot->poll= graphop_visible_keyframes_poll;
+	ot->exec = graphkeys_select_linked_exec;
+	ot->poll = graphop_visible_keyframes_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+	ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
 }
 
 /* ******************** Select More/Less Operators *********************** */
@@ -675,15 +675,15 @@ void GRAPH_OT_select_more (wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name = "Select More";
-	ot->idname= "GRAPH_OT_select_more";
+	ot->idname = "GRAPH_OT_select_more";
 	ot->description = "Select keyframes beside already selected ones";
 	
 	/* api callbacks */
-	ot->exec= graphkeys_select_more_exec;
-	ot->poll= graphop_visible_keyframes_poll;
+	ot->exec = graphkeys_select_more_exec;
+	ot->poll = graphop_visible_keyframes_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+	ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
 }
 
 /* ----------------- */
@@ -709,15 +709,15 @@ void GRAPH_OT_select_less (wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name = "Select Less";
-	ot->idname= "GRAPH_OT_select_less";
+	ot->idname = "GRAPH_OT_select_less";
 	ot->description = "Deselect keyframes on ends of selection islands";
 	
 	/* api callbacks */
-	ot->exec= graphkeys_select_less_exec;
-	ot->poll= graphop_visible_keyframes_poll;
+	ot->exec = graphkeys_select_less_exec;
+	ot->poll = graphop_visible_keyframes_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+	ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
 }
 
 /* ******************** Select Left/Right Operator ************************* */
@@ -849,20 +849,20 @@ static int graphkeys_select_leftright_invoke (bContext *C, wmOperator *op, wmEve
 void GRAPH_OT_select_leftright (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Left/Right";
-	ot->idname= "GRAPH_OT_select_leftright";
-	ot->description= "Select keyframes to the left or the right of the current frame";
+	ot->name = "Select Left/Right";
+	ot->idname = "GRAPH_OT_select_leftright";
+	ot->description = "Select keyframes to the left or the right of the current frame";
 	
 	/* api callbacks  */
 	ot->invoke=	graphkeys_select_leftright_invoke;
-	ot->exec= graphkeys_select_leftright_exec;
-	ot->poll= graphop_visible_keyframes_poll;
+	ot->exec = graphkeys_select_leftright_exec;
+	ot->poll = graphop_visible_keyframes_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* id-props */
-	ot->prop= RNA_def_enum(ot->srna, "mode", prop_graphkeys_leftright_select_types, GRAPHKEYS_LRSEL_TEST, "Mode", "");
+	ot->prop = RNA_def_enum(ot->srna, "mode", prop_graphkeys_leftright_select_types, GRAPHKEYS_LRSEL_TEST, "Mode", "");
 	RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", "");
 }
 
@@ -1006,14 +1006,12 @@ static void get_nearest_fcurve_verts_list (bAnimContext *ac, const int mval[2],
 				/* handles - only do them if they're visible */
 				if (fcurve_handle_sel_check(sipo, bezt1) && (fcu->totvert > 1)) {
 					/* first handle only visible if previous segment had handles */
-					if ( (!prevbezt && (bezt1->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) )
-					{
+					if ((!prevbezt && (bezt1->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ))) {
 						nearest_fcurve_vert_store(matches, v2d, fcu, bezt1, NULL, NEAREST_HANDLE_LEFT, mval);
 					}
 					
 					/* second handle only visible if this segment is bezier */
-					if (bezt1->ipo == BEZT_IPO_BEZ) 
-					{
+					if (bezt1->ipo == BEZT_IPO_BEZ) {
 						nearest_fcurve_vert_store(matches, v2d, fcu, bezt1, NULL, NEAREST_HANDLE_RIGHT, mval);
 					}
 				}
@@ -1180,7 +1178,7 @@ static void mouse_graph_keys (bAnimContext *ac, const int mval[2], short select_
 		KeyframeEditFunc select_cb;
 		KeyframeEditData ked;
 		
-		/* initialise keyframe editing data */
+		/* initialize keyframe editing data */
 		memset(&ked, 0, sizeof(KeyframeEditData));
 		
 		/* set up BezTriple edit callbacks */
@@ -1262,7 +1260,7 @@ static void graphkeys_mselect_column (bAnimContext *ac, const int mval[2], short
 		deselect_graph_keys(ac, 0, SELECT_SUBTRACT, FALSE);
 	}
 	
-	/* initialise keyframe editing data */
+	/* initialize keyframe editing data */
 	memset(&ked, 0, sizeof(KeyframeEditData));
 	
 	/* set up BezTriple edit callbacks */
@@ -1336,13 +1334,13 @@ static int graphkeys_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *ev
 void GRAPH_OT_clickselect (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Mouse Select Keys";
-	ot->idname= "GRAPH_OT_clickselect";
-	ot->description= "Select keyframes by clicking on them";
+	ot->name = "Mouse Select Keys";
+	ot->idname = "GRAPH_OT_clickselect";
+	ot->description = "Select keyframes by clicking on them";
 	
 	/* api callbacks */
-	ot->invoke= graphkeys_clickselect_invoke;
-	ot->poll= graphop_visible_keyframes_poll;
+	ot->invoke = graphkeys_clickselect_invoke;
+	ot->poll = graphop_visible_keyframes_poll;
 	
 	/* id-props */
 	RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", ""); // SHIFTKEY
diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c
index e7dc5e8..8c2afe8 100644
--- a/source/blender/editors/space_graph/graph_utils.c
+++ b/source/blender/editors/space_graph/graph_utils.c
@@ -42,7 +42,6 @@
 
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
-#include "BLI_editVert.h"
 #include "BLI_rand.h"
 
 #include "BKE_context.h"
@@ -123,7 +122,7 @@ int graphop_visible_keyframes_poll (bContext *C)
 	for (ale = anim_data.first; ale; ale= ale->next) {
 		FCurve *fcu= (FCurve *)ale->data;
 		
-		/* visible curves for selection must fulfull the following criteria:
+		/* visible curves for selection must fulfill the following criteria:
 		 *	- it has bezier keyframes
 		 *	- F-Curve modifiers do not interfere with the result too much 
 		 *	  (i.e. the modifier-control drawing check returns false)
@@ -172,7 +171,7 @@ int graphop_editable_keyframes_poll (bContext *C)
 	for (ale = anim_data.first; ale; ale= ale->next) {
 		FCurve *fcu= (FCurve *)ale->data;
 		
-		/* editable curves must fulfull the following criteria:
+		/* editable curves must fulfill the following criteria:
 		 *	- it has bezier keyframes
 		 *	- it must not be protected from editing (this is already checked for with the foredit flag
 		 *	- F-Curve modifiers do not interfere with the result too much 
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index 50178f7..37cdbd4 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -70,7 +70,7 @@ ARegion *graph_has_buttons_region(ScrArea *sa)
 	ARegion *ar, *arnew;
 	
 	ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
-	if(ar) return ar;
+	if (ar) return ar;
 
 	/* add subdiv level; after main */
 	ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
@@ -142,10 +142,10 @@ static SpaceLink *graph_new(const bContext *C)
 	BLI_addtail(&sipo->regionbase, ar);
 	ar->regiontype= RGN_TYPE_WINDOW;
 	
-	ar->v2d.tot.xmin= 0.0f;
-	ar->v2d.tot.ymin= (float)scene->r.sfra - 10.0f;
-	ar->v2d.tot.xmax= (float)scene->r.efra;
-	ar->v2d.tot.ymax= 10.0f;
+	ar->v2d.tot.xmin = 0.0f;
+	ar->v2d.tot.ymin = (float)scene->r.sfra - 10.0f;
+	ar->v2d.tot.xmax = (float)scene->r.efra;
+	ar->v2d.tot.ymax = 10.0f;
 	
 	ar->v2d.cur= ar->v2d.tot;
 	
@@ -211,9 +211,9 @@ static void graph_main_area_init(wmWindowManager *wm, ARegion *ar)
 	UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
 	
 	/* own keymap */
-	keymap= WM_keymap_find(wm->defaultconf, "Graph Editor", SPACE_IPO, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Graph Editor", SPACE_IPO, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
-	keymap= WM_keymap_find(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
@@ -310,9 +310,9 @@ static void graph_channel_area_init(wmWindowManager *wm, ARegion *ar)
 	UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
 	
 	/* own keymap */
-	keymap= WM_keymap_find(wm->defaultconf, "Animation Channels", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Animation Channels", 0, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
-	keymap= WM_keymap_find(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
@@ -362,7 +362,7 @@ static void graph_buttons_area_init(wmWindowManager *wm, ARegion *ar)
 	
 	ED_region_panels_init(wm, ar);
 
-	keymap= WM_keymap_find(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Graph Editor Generic", SPACE_IPO, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
@@ -400,7 +400,7 @@ static void graph_region_listener(ARegion *ar, wmNotifier *wmn)
 					ED_region_tag_redraw(ar);
 					break;
 				case ND_MODIFIER:
-					if(wmn->action == NA_RENAME)
+					if (wmn->action == NA_RENAME)
 						ED_region_tag_redraw(ar);
 					break;
 			}
@@ -414,11 +414,11 @@ static void graph_region_listener(ARegion *ar, wmNotifier *wmn)
 			}
 			break;
 		case NC_ID:
-			if(wmn->action == NA_RENAME)
+			if (wmn->action == NA_RENAME)
 				ED_region_tag_redraw(ar);
 			break;
 		default:
-			if(wmn->data==ND_KEYS)
+			if (wmn->data==ND_KEYS)
 				ED_region_tag_redraw(ar);
 				
 	}
@@ -474,13 +474,13 @@ static void graph_listener(ScrArea *sa, wmNotifier *wmn)
 			}
 				break;
 		case NC_SPACE:
-			if(wmn->data == ND_SPACE_GRAPH)
+			if (wmn->data == ND_SPACE_GRAPH)
 				ED_area_tag_redraw(sa);
 			break;
 		
 		// XXX: restore the case below if not enough updates occur...
 		//default:
-		//	if(wmn->data==ND_KEYS)
+		//	if (wmn->data==ND_KEYS)
 		//		ED_area_tag_redraw(sa);
 	}
 }
@@ -508,7 +508,7 @@ static void graph_refresh(const bContext *C, ScrArea *sa)
 	}
 	
 	/* region updates? */
-	// XXX resizing y-extents of tot should go here?
+	// XXX re-sizing y-extents of tot should go here?
 	
 	/* update the state of the animchannels in response to changes from the data they represent 
 	 * NOTE: the temp flag is used to indicate when this needs to be done, and will be cleared once handled
diff --git a/source/blender/editors/space_image/CMakeLists.txt b/source/blender/editors/space_image/CMakeLists.txt
index 15c90fb..3975a5f 100644
--- a/source/blender/editors/space_image/CMakeLists.txt
+++ b/source/blender/editors/space_image/CMakeLists.txt
@@ -25,6 +25,7 @@ set(INC
 	../../blenlib
 	../../blenloader
 	../../imbuf
+	../../bmesh
 	../../makesdna
 	../../makesrna
 	../../render/extern/include
diff --git a/source/blender/editors/space_image/SConscript b/source/blender/editors/space_image/SConscript
index 27696e3..759d459 100644
--- a/source/blender/editors/space_image/SConscript
+++ b/source/blender/editors/space_image/SConscript
@@ -5,7 +5,7 @@ sources = env.Glob('*.c')
 
 incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
 incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
-incs += ' ../../render/extern/include ../../makesrna ../../blenloader'
+incs += ' ../../bmesh ../../render/extern/include ../../makesrna ../../blenloader'
 
 defs = []
 
@@ -18,7 +18,7 @@ if env['WITH_BF_TIFF']:
 if env['WITH_BF_CINEON']:
 	defs.append('WITH_CINEON')
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
 
 env.BlenderLib ( 'bf_editors_space_image', sources, Split(incs), defs, libtype=['core'], priority=[40] )
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index 43bea1c..ecbd9a4 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -41,7 +41,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
-#include "BLI_editVert.h"
 #include "BLI_rand.h"
 #include "BLI_utildefines.h"
 
@@ -72,83 +71,83 @@
 
 #include "image_intern.h"
 
-#define B_REDR				1
-#define B_IMAGECHANGED		2
-#define B_NOP				0
-#define B_TWINANIM			5
-#define B_SIMAGETILE		6
-#define B_IDNAME			10
-#define B_FACESEL_PAINT_TEST	11
-#define B_SIMA_RECORD		12
-#define B_SIMA_PLAY			13
-
-#define B_SIMANOTHING		16
-#define B_SIMABRUSHCHANGE	17	
-#define B_SIMABRUSHBROWSE	18
-#define B_SIMABRUSHLOCAL	19
-#define B_SIMABRUSHDELETE	20
-#define B_KEEPDATA			21
-#define B_SIMABTEXBROWSE	22
-#define B_SIMABTEXDELETE	23
-#define B_VPCOLSLI			24
-#define B_SIMACLONEBROWSE	25
-#define B_SIMACLONEDELETE	26
+#define B_REDR                1
+#define B_IMAGECHANGED        2
+#define B_NOP                 0
+#define B_TWINANIM            5
+#define B_SIMAGETILE          6
+#define B_IDNAME             10
+#define B_FACESEL_PAINT_TEST 11
+#define B_SIMA_RECORD        12
+#define B_SIMA_PLAY          13
+
+#define B_SIMANOTHING        16
+#define B_SIMABRUSHCHANGE    17
+#define B_SIMABRUSHBROWSE    18
+#define B_SIMABRUSHLOCAL     19
+#define B_SIMABRUSHDELETE    20
+#define B_KEEPDATA           21
+#define B_SIMABTEXBROWSE     22
+#define B_SIMABTEXDELETE     23
+#define B_VPCOLSLI           24
+#define B_SIMACLONEBROWSE    25
+#define B_SIMACLONEDELETE    26
 
 /* proto */
 
 static void image_info(Scene *scene, ImageUser *iuser, Image *ima, ImBuf *ibuf, char *str)
 {
-	int ofs= 0;
+	int ofs = 0;
 
-	str[0]= 0;
+	str[0] = 0;
 	
-	if(ima==NULL) return;
+	if (ima == NULL) return;
 
-	if(ibuf==NULL) {
-		ofs+= sprintf(str, "Can't Load Image");
+	if (ibuf == NULL) {
+		ofs += sprintf(str, "Can't Load Image");
 	}
 	else {
-		if(ima->source==IMA_SRC_MOVIE) {
-			ofs+= sprintf(str, "Movie");
-			if(ima->anim)
-				ofs+= sprintf(str+ofs, "%d frs", IMB_anim_get_duration(ima->anim, IMB_TC_RECORD_RUN));
+		if (ima->source == IMA_SRC_MOVIE) {
+			ofs += sprintf(str, "Movie");
+			if (ima->anim)
+				ofs += sprintf(str + ofs, "%d frs", IMB_anim_get_duration(ima->anim, IMB_TC_RECORD_RUN));
 		}
 		else
-			ofs+= sprintf(str, "Image");
+			ofs += sprintf(str, "Image");
 
-		ofs+= sprintf(str+ofs, ": size %d x %d,", ibuf->x, ibuf->y);
+		ofs += sprintf(str + ofs, ": size %d x %d,", ibuf->x, ibuf->y);
 
-		if(ibuf->rect_float) {
-			if(ibuf->channels!=4) {
-				ofs+= sprintf(str+ofs, "%d float channel(s)", ibuf->channels);
+		if (ibuf->rect_float) {
+			if (ibuf->channels != 4) {
+				ofs += sprintf(str + ofs, "%d float channel(s)", ibuf->channels);
 			}
-			else if(ibuf->planes == R_IMF_PLANES_RGBA)
-				ofs+= sprintf(str+ofs, " RGBA float");
+			else if (ibuf->planes == R_IMF_PLANES_RGBA)
+				ofs += sprintf(str + ofs, " RGBA float");
 			else
-				ofs+= sprintf(str+ofs, " RGB float");
+				ofs += sprintf(str + ofs, " RGB float");
 		}
 		else {
-			if(ibuf->planes == R_IMF_PLANES_RGBA)
-				ofs+= sprintf(str+ofs, " RGBA byte");
+			if (ibuf->planes == R_IMF_PLANES_RGBA)
+				ofs += sprintf(str + ofs, " RGBA byte");
 			else
-				ofs+= sprintf(str+ofs, " RGB byte");
+				ofs += sprintf(str + ofs, " RGB byte");
 		}
-		if(ibuf->zbuf || ibuf->zbuf_float)
-			ofs+= sprintf(str+ofs, " + Z");
-
-		if(ima->source==IMA_SRC_SEQUENCE) {
-			char *file= BLI_last_slash(ibuf->name);
-			if(file==NULL)	file= ibuf->name;
-			else			file++;
-			ofs+= sprintf(str+ofs, ", %s", file);
+		if (ibuf->zbuf || ibuf->zbuf_float)
+			ofs += sprintf(str + ofs, " + Z");
+
+		if (ima->source == IMA_SRC_SEQUENCE) {
+			char *file = BLI_last_slash(ibuf->name);
+			if (file == NULL) file = ibuf->name;
+			else file++;
+			ofs += sprintf(str + ofs, ", %s", file);
 		}
 	}
 
 	/* the frame number, even if we cant */
-	if(ima->source==IMA_SRC_SEQUENCE) {
+	if (ima->source == IMA_SRC_SEQUENCE) {
 		/* don't use iuser->framenr directly because it may not be updated if auto-refresh is off */
-		const int framenr= BKE_image_user_get_frame(iuser, CFRA, 0);
-		ofs+= sprintf(str+ofs, ", Frame: %d", framenr);
+		const int framenr = BKE_image_user_get_frame(iuser, CFRA, 0);
+		ofs += sprintf(str + ofs, ", Frame: %d", framenr);
 	}
 
 	(void)ofs;
@@ -159,10 +158,10 @@ struct ImageUser *ntree_get_active_iuser(bNodeTree *ntree)
 {
 	bNode *node;
 	
-	if(ntree)
-		for(node= ntree->nodes.first; node; node= node->next)
-			if( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) 
-				if(node->flag & NODE_DO_OUTPUT)
+	if (ntree)
+		for (node = ntree->nodes.first; node; node = node->next)
+			if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
+				if (node->flag & NODE_DO_OUTPUT)
 					return node->storage;
 	return NULL;
 }
@@ -174,13 +173,13 @@ struct ImageUser *ntree_get_active_iuser(bNodeTree *ntree)
 
 static int image_panel_poll(const bContext *C, PanelType *UNUSED(pt))
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
 	ImBuf *ibuf;
 	void *lock;
 	int result;
 
-	ibuf= ED_space_image_acquire_buffer(sima, &lock);
-	result= ibuf && ibuf->rect_float;
+	ibuf = ED_space_image_acquire_buffer(sima, &lock);
+	result = ibuf && ibuf->rect_float;
 	ED_space_image_release_buffer(sima, lock);
 	
 	return result;
@@ -188,21 +187,21 @@ static int image_panel_poll(const bContext *C, PanelType *UNUSED(pt))
 
 static void image_panel_curves(const bContext *C, Panel *pa)
 {
-	bScreen *sc= CTX_wm_screen(C);
-	SpaceImage *sima= CTX_wm_space_image(C);
+	bScreen *sc = CTX_wm_screen(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
 	ImBuf *ibuf;
 	PointerRNA simaptr;
 	int levels;
 	void *lock;
 	
-	ibuf= ED_space_image_acquire_buffer(sima, &lock);
+	ibuf = ED_space_image_acquire_buffer(sima, &lock);
 	
-	if(ibuf) {
-		if(sima->cumap==NULL)
-			sima->cumap= curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
+	if (ibuf) {
+		if (sima->cumap == NULL)
+			sima->cumap = curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
 
 		/* curvemap black/white levels only works for RGBA */
-		levels= (ibuf->channels==4);
+		levels = (ibuf->channels == 4);
 
 		RNA_pointer_create(&sc->id, &RNA_SpaceImageEditor, sima, &simaptr);
 		uiTemplateCurveMapping(pa->layout, &simaptr, "curve", 'c', levels, 0);
@@ -213,42 +212,42 @@ static void image_panel_curves(const bContext *C, Panel *pa)
 
 #if 0
 /* 0: disable preview 
-   otherwise refresh preview
- 
-   XXX if you put this back, also check XXX in image_main_area_draw() */
-*/
+ * otherwise refresh preview
+ *
+ * XXX if you put this back, also check XXX in image_main_area_draw() */
+ * /
 void image_preview_event(int event)
 {
-	int exec= 0;
+	int exec = 0;
 	
-	if(event==0) {
+	if (event == 0) {
 		G.scene->r.scemode &= ~R_COMP_CROP;
-		exec= 1;
+		exec = 1;
 	}
 	else {
-		if(image_preview_active(curarea, NULL, NULL)) {
+		if (image_preview_active(curarea, NULL, NULL)) {
 			G.scene->r.scemode |= R_COMP_CROP;
-			exec= 1;
+			exec = 1;
 		}
 		else
 			G.scene->r.scemode &= ~R_COMP_CROP;
 	}
 	
-	if(exec && G.scene->nodetree) {
+	if (exec && G.scene->nodetree) {
 		/* should work when no node editor in screen..., so we execute right away */
 		
 		ntreeCompositTagGenerators(G.scene->nodetree);
 
-		G.afbreek= 0;
-		G.scene->nodetree->timecursor= set_timecursor;
-		G.scene->nodetree->test_break= blender_test_break;
+		G.afbreek = 0;
+		G.scene->nodetree->timecursor = set_timecursor;
+		G.scene->nodetree->test_break = blender_test_break;
 		
 		BIF_store_spare();
 		
-		ntreeCompositExecTree(G.scene->nodetree, &G.scene->r, 1);	/* 1 is do_previews */
+		ntreeCompositExecTree(G.scene->nodetree, &G.scene->r, 1);   /* 1 is do_previews */
 		
-		G.scene->nodetree->timecursor= NULL;
-		G.scene->nodetree->test_break= NULL;
+		G.scene->nodetree->timecursor = NULL;
+		G.scene->nodetree->test_break = NULL;
 		
 		scrarea_do_windraw(curarea);
 		waitcursor(0);
@@ -261,21 +260,21 @@ void image_preview_event(int event)
 /* nothing drawn here, we use it to store values */
 static void preview_cb(struct ScrArea *sa, struct uiBlock *block)
 {
-	SpaceImage *sima= sa->spacedata.first;
+	SpaceImage *sima = sa->spacedata.first;
 	rctf dispf;
-	rcti *disprect= &G.scene->r.disprect;
-	int winx= (G.scene->r.size*G.scene->r.xsch)/100;
-	int winy= (G.scene->r.size*G.scene->r.ysch)/100;
+	rcti *disprect = &G.scene->r.disprect;
+	int winx = (G.scene->r.size * G.scene->r.xsch) / 100;
+	int winy = (G.scene->r.size * G.scene->r.ysch) / 100;
 	int mval[2];
 	
-	if(G.scene->r.mode & R_BORDER) {
-		winx*= (G.scene->r.border.xmax - G.scene->r.border.xmin);
-		winy*= (G.scene->r.border.ymax - G.scene->r.border.ymin);
+	if (G.scene->r.mode & R_BORDER) {
+		winx *= (G.scene->r.border.xmax - G.scene->r.border.xmin);
+		winy *= (G.scene->r.border.ymax - G.scene->r.border.ymin);
 	}
 	
 	/* while dragging we need to update the rects, otherwise it doesn't end with correct one */
 
-	BLI_init_rctf(&dispf, 15.0f, (block->maxx - block->minx)-15.0f, 15.0f, (block->maxy - block->miny)-15.0f);
+	BLI_init_rctf(&dispf, 15.0f, (block->maxx - block->minx) - 15.0f, 15.0f, (block->maxy - block->miny) - 15.0f);
 	ui_graphics_to_window_rct(sa->win, &dispf, disprect);
 	
 	/* correction for gla draw */
@@ -284,16 +283,16 @@ static void preview_cb(struct ScrArea *sa, struct uiBlock *block)
 	calc_image_view(sima, 'p');
 //	printf("winrct %d %d %d %d\n", disprect->xmin, disprect->ymin,disprect->xmax, disprect->ymax);
 	/* map to image space coordinates */
-	mval[0]= disprect->xmin; mval[1]= disprect->ymin;
+	mval[0] = disprect->xmin; mval[1] = disprect->ymin;
 	areamouseco_to_ipoco(v2d, mval, &dispf.xmin, &dispf.ymin);
-	mval[0]= disprect->xmax; mval[1]= disprect->ymax;
+	mval[0] = disprect->xmax; mval[1] = disprect->ymax;
 	areamouseco_to_ipoco(v2d, mval, &dispf.xmax, &dispf.ymax);
 	
 	/* map to render coordinates */
-	disprect->xmin= dispf.xmin;
-	disprect->xmax= dispf.xmax;
-	disprect->ymin= dispf.ymin;
-	disprect->ymax= dispf.ymax;
+	disprect->xmin = dispf.xmin;
+	disprect->xmax = dispf.xmax;
+	disprect->ymin = dispf.ymin;
+	disprect->ymax = dispf.ymax;
 	
 	CLAMP(disprect->xmin, 0, winx);
 	CLAMP(disprect->xmax, 0, winx);
@@ -305,43 +304,43 @@ static void preview_cb(struct ScrArea *sa, struct uiBlock *block)
 
 static int is_preview_allowed(ScrArea *cur)
 {
-	SpaceImage *sima= cur->spacedata.first;
+	SpaceImage *sima = cur->spacedata.first;
 	ScrArea *sa;
 
 	/* check if another areawindow has preview set */
-	for(sa=G.curscreen->areabase.first; sa; sa= sa->next) {
-		if(sa!=cur && sa->spacetype==SPACE_IMAGE) {
-			if(image_preview_active(sa, NULL, NULL))
+	for (sa = G.curscreen->areabase.first; sa; sa = sa->next) {
+		if (sa != cur && sa->spacetype == SPACE_IMAGE) {
+			if (image_preview_active(sa, NULL, NULL))
 				return 0;
 		}
 	}
 	/* check image type */
-	if(sima->image==NULL || sima->image->type!=IMA_TYPE_COMPOSITE)
+	if (sima->image == NULL || sima->image->type != IMA_TYPE_COMPOSITE)
 		return 0;
 	
 	return 1;
 }
 
 
-static void image_panel_preview(ScrArea *sa, short cntrl)	// IMAGE_HANDLER_PREVIEW
+static void image_panel_preview(ScrArea *sa, short cntrl)   // IMAGE_HANDLER_PREVIEW
 {
 	uiBlock *block;
-	SpaceImage *sima= sa->spacedata.first;
+	SpaceImage *sima = sa->spacedata.first;
 	int ofsx, ofsy;
 	
-	if(is_preview_allowed(sa)==0) {
+	if (is_preview_allowed(sa) == 0) {
 		rem_blockhandler(sa, IMAGE_HANDLER_PREVIEW);
-		G.scene->r.scemode &= ~R_COMP_CROP;	/* quite weak */
+		G.scene->r.scemode &= ~R_COMP_CROP; /* quite weak */
 		return;
 	}
 	
-	block= uiBeginBlock(C, ar, __func__, UI_EMBOSS);
+	block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
 	uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | UI_PNL_SCALE | cntrl);
 	uiSetPanelHandler(IMAGE_HANDLER_PREVIEW);  // for close and esc
 	
-	ofsx= -150+(sa->winx/2)/sima->blockscale;
-	ofsy= -100+(sa->winy/2)/sima->blockscale;
-	if(uiNewPanel(C, ar, block, "Preview", "Image", ofsx, ofsy, 300, 200)==0) return;
+	ofsx = -150 + (sa->winx / 2) / sima->blockscale;
+	ofsy = -100 + (sa->winy / 2) / sima->blockscale;
+	if (uiNewPanel(C, ar, block, "Preview", "Image", ofsx, ofsy, 300, 200) == 0) return;
 	
 	uiBlockSetDrawExtraFunc(block, preview_cb);
 	
@@ -356,13 +355,13 @@ static char *slot_menu(void)
 	char *str;
 	int a, slot;
 	
-	str= MEM_callocN(IMA_MAX_RENDER_SLOT*32, "menu slots");
+	str = MEM_callocN(IMA_MAX_RENDER_SLOT * 32, "menu slots");
 	
 	strcpy(str, "Slot %t");
-	a= strlen(str);
+	a = strlen(str);
 
-	for(slot=0; slot<IMA_MAX_RENDER_SLOT; slot++)
-		a += sprintf(str+a, "|Slot %d %%x%d", slot+1, slot);
+	for (slot = 0; slot < IMA_MAX_RENDER_SLOT; slot++)
+		a += sprintf(str + a, "|Slot %d %%x%d", slot + 1, slot);
 	
 	return str;
 }
@@ -371,24 +370,24 @@ static char *slot_menu(void)
 static char *layer_menu(RenderResult *rr, short *UNUSED(curlay))
 {
 	RenderLayer *rl;
-	int len= 64 + 32*BLI_countlist(&rr->layers);
-	short a, nr= 0;
-	char *str= MEM_callocN(len, "menu layers");
+	int len = 64 + 32 * BLI_countlist(&rr->layers);
+	short a, nr = 0;
+	char *str = MEM_callocN(len, "menu layers");
 	
 	strcpy(str, "Layer %t");
-	a= strlen(str);
+	a = strlen(str);
 	
 	/* compo result */
-	if(rr->rectf) {
-		a+= sprintf(str+a, "|Composite %%x0");
-		nr= 1;
+	if (rr->rectf) {
+		a += sprintf(str + a, "|Composite %%x0");
+		nr = 1;
 	}
-	else if(rr->rect32) {
-		a+= sprintf(str+a, "|Sequence %%x0");
-		nr= 1;
+	else if (rr->rect32) {
+		a += sprintf(str + a, "|Sequence %%x0");
+		nr = 1;
 	}
-	for(rl= rr->layers.first; rl; rl= rl->next, nr++) {
-		a+= sprintf(str+a, "|%s %%x%d", rl->name, nr);
+	for (rl = rr->layers.first; rl; rl = rl->next, nr++) {
+		a += sprintf(str + a, "|%s %%x%d", rl->name, nr);
 	}
 	
 	/* no curlay clip here, on render (redraws) the amount of layers can be 1 fir single-layer render */
@@ -400,36 +399,36 @@ static char *layer_menu(RenderResult *rr, short *UNUSED(curlay))
 static char *pass_menu(RenderLayer *rl, short *curpass)
 {
 	RenderPass *rpass;
-	int len= 64 + 32*(rl?BLI_countlist(&rl->passes):1);
-	short a, nr= 0;
-	char *str= MEM_callocN(len, "menu layers");
+	int len = 64 + 32 * (rl ? BLI_countlist(&rl->passes) : 1);
+	short a, nr = 0;
+	char *str = MEM_callocN(len, "menu layers");
 	
 	strcpy(str, "Pass %t");
-	a= strlen(str);
+	a = strlen(str);
 	
 	/* rendered results don't have a Combined pass */
-	if(rl==NULL || rl->rectf) {
-		a+= sprintf(str+a, "|Combined %%x0");
-		nr= 1;
+	if (rl == NULL || rl->rectf) {
+		a += sprintf(str + a, "|Combined %%x0");
+		nr = 1;
 	}
 	
-	if(rl)
-		for(rpass= rl->passes.first; rpass; rpass= rpass->next, nr++)
-			a+= sprintf(str+a, "|%s %%x%d", rpass->name, nr);
+	if (rl)
+		for (rpass = rl->passes.first; rpass; rpass = rpass->next, nr++)
+			a += sprintf(str + a, "|%s %%x%d", rpass->name, nr);
 	
-	if(*curpass >= nr)
-		*curpass= 0;
+	if (*curpass >= nr)
+		*curpass = 0;
 	
 	return str;
 }
 
 static void set_frames_cb(bContext *C, void *ima_v, void *iuser_v)
 {
-	Scene *scene= CTX_data_scene(C);
-	Image *ima= ima_v;
-	ImageUser *iuser= iuser_v;
+	Scene *scene = CTX_data_scene(C);
+	Image *ima = ima_v;
+	ImageUser *iuser = iuser_v;
 	
-	if(ima->anim) {
+	if (ima->anim) {
 		iuser->frames = IMB_anim_get_duration(ima->anim, IMB_TC_RECORD_RUN);
 		BKE_image_user_calc_frame(iuser, scene->r.cfra, 0);
 	}
@@ -438,70 +437,70 @@ static void set_frames_cb(bContext *C, void *ima_v, void *iuser_v)
 /* 5 layer button callbacks... */
 static void image_multi_cb(bContext *C, void *rr_v, void *iuser_v) 
 {
-	ImageUser *iuser= iuser_v;
+	ImageUser *iuser = iuser_v;
 
 	BKE_image_multilayer_index(rr_v, iuser); 
-	WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL);
+	WM_event_add_notifier(C, NC_IMAGE | ND_DRAW, NULL);
 }
 static void image_multi_inclay_cb(bContext *C, void *rr_v, void *iuser_v) 
 {
-	RenderResult *rr= rr_v;
-	ImageUser *iuser= iuser_v;
-	int tot= BLI_countlist(&rr->layers);
+	RenderResult *rr = rr_v;
+	ImageUser *iuser = iuser_v;
+	int tot = BLI_countlist(&rr->layers);
 
-	if(rr->rectf || rr->rect32)
-		tot++; /* fake compo/sequencer layer */
+	if (rr->rectf || rr->rect32)
+		tot++;  /* fake compo/sequencer layer */
 
-	if(iuser->layer<tot-1) {
+	if (iuser->layer < tot - 1) {
 		iuser->layer++;
 		BKE_image_multilayer_index(rr, iuser); 
-		WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL);
+		WM_event_add_notifier(C, NC_IMAGE | ND_DRAW, NULL);
 	}
 }
 static void image_multi_declay_cb(bContext *C, void *rr_v, void *iuser_v) 
 {
-	ImageUser *iuser= iuser_v;
+	ImageUser *iuser = iuser_v;
 
-	if(iuser->layer>0) {
+	if (iuser->layer > 0) {
 		iuser->layer--;
 		BKE_image_multilayer_index(rr_v, iuser); 
-		WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL);
+		WM_event_add_notifier(C, NC_IMAGE | ND_DRAW, NULL);
 	}
 }
 static void image_multi_incpass_cb(bContext *C, void *rr_v, void *iuser_v) 
 {
-	RenderResult *rr= rr_v;
-	ImageUser *iuser= iuser_v;
-	RenderLayer *rl= BLI_findlink(&rr->layers, iuser->layer);
+	RenderResult *rr = rr_v;
+	ImageUser *iuser = iuser_v;
+	RenderLayer *rl = BLI_findlink(&rr->layers, iuser->layer);
 
-	if(rl) {
-		int tot= BLI_countlist(&rl->passes);
+	if (rl) {
+		int tot = BLI_countlist(&rl->passes);
 
-		if(rr->rectf || rr->rect32)
-			tot++; /* fake compo/sequencer layer */
+		if (rr->rectf || rr->rect32)
+			tot++;  /* fake compo/sequencer layer */
 
-		if(iuser->pass<tot-1) {
+		if (iuser->pass < tot - 1) {
 			iuser->pass++;
 			BKE_image_multilayer_index(rr, iuser); 
-			WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL);
+			WM_event_add_notifier(C, NC_IMAGE | ND_DRAW, NULL);
 		}
 	}
 }
 static void image_multi_decpass_cb(bContext *C, void *rr_v, void *iuser_v) 
 {
-	ImageUser *iuser= iuser_v;
+	ImageUser *iuser = iuser_v;
 
-	if(iuser->pass>0) {
+	if (iuser->pass > 0) {
 		iuser->pass--;
 		BKE_image_multilayer_index(rr_v, iuser); 
-		WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL);
+		WM_event_add_notifier(C, NC_IMAGE | ND_DRAW, NULL);
 	}
 }
 
 #if 0
 static void image_freecache_cb(bContext *C, void *ima_v, void *unused) 
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	BKE_image_free_anim_ibufs(ima_v, scene->r.cfra);
 	WM_event_add_notifier(C, NC_IMAGE, ima_v);
 }
@@ -510,47 +509,47 @@ static void image_freecache_cb(bContext *C, void *ima_v, void *unused)
 #if 0
 static void image_user_change(bContext *C, void *iuser_v, void *unused)
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	BKE_image_user_calc_imanr(iuser_v, scene->r.cfra, 0);
 }
 #endif
 
 static void uiblock_layer_pass_buttons(uiLayout *layout, RenderResult *rr, ImageUser *iuser, int w, short *render_slot)
 {
-	uiBlock *block= uiLayoutGetBlock(layout);
+	uiBlock *block = uiLayoutGetBlock(layout);
 	uiBut *but;
-	RenderLayer *rl= NULL;
+	RenderLayer *rl = NULL;
 	int wmenu1, wmenu2, wmenu3, layer;
 	char *strp;
 
 	uiLayoutRow(layout, 1);
 
 	/* layer menu is 1/3 larger than pass */
-	wmenu1= (2*w)/5;
-	wmenu2= (3*w)/5;
-	wmenu3= (3*w)/6;
+	wmenu1 = (2 * w) / 5;
+	wmenu2 = (3 * w) / 5;
+	wmenu3 = (3 * w) / 6;
 	
 	/* menu buts */
-	if(render_slot) {
-		strp= slot_menu();
-		but= uiDefButS(block, MENU, 0, strp,					0, 0, wmenu1, UI_UNIT_Y, render_slot, 0,0,0,0, "Select Slot");
+	if (render_slot) {
+		strp = slot_menu();
+		but = uiDefButS(block, MENU, 0, strp,                   0, 0, wmenu1, UI_UNIT_Y, render_slot, 0, 0, 0, 0, "Select Slot");
 		uiButSetFunc(but, image_multi_cb, rr, iuser);
 		MEM_freeN(strp);
 	}
 
-	if(rr) {
-		strp= layer_menu(rr, &iuser->layer);
-		but= uiDefButS(block, MENU, 0, strp,					0, 0, wmenu2, UI_UNIT_Y, &iuser->layer, 0,0,0,0, "Select Layer");
+	if (rr) {
+		strp = layer_menu(rr, &iuser->layer);
+		but = uiDefButS(block, MENU, 0, strp,                   0, 0, wmenu2, UI_UNIT_Y, &iuser->layer, 0, 0, 0, 0, "Select Layer");
 		uiButSetFunc(but, image_multi_cb, rr, iuser);
 		MEM_freeN(strp);
 
 		layer = iuser->layer;
-		if(rr->rectf || rr->rect32)
-			layer--; /* fake compo/sequencer layer */
+		if (rr->rectf || rr->rect32)
+			layer--;  /* fake compo/sequencer layer */
 		
-		rl= BLI_findlink(&rr->layers, layer); /* return NULL is meant to be */
-		strp= pass_menu(rl, &iuser->pass);
-		but= uiDefButS(block, MENU, 0, strp,					0, 0, wmenu3, UI_UNIT_Y, &iuser->pass, 0,0,0,0, "Select Pass");
+		rl = BLI_findlink(&rr->layers, layer); /* return NULL is meant to be */
+		strp = pass_menu(rl, &iuser->pass);
+		but = uiDefButS(block, MENU, 0, strp,                   0, 0, wmenu3, UI_UNIT_Y, &iuser->pass, 0, 0, 0, 0, "Select Pass");
 		uiButSetFunc(but, image_multi_cb, rr, iuser);
 		MEM_freeN(strp);	
 	}
@@ -558,32 +557,32 @@ static void uiblock_layer_pass_buttons(uiLayout *layout, RenderResult *rr, Image
 
 static void uiblock_layer_pass_arrow_buttons(uiLayout *layout, RenderResult *rr, ImageUser *iuser, short *render_slot)
 {
-	uiBlock *block= uiLayoutGetBlock(layout);
+	uiBlock *block = uiLayoutGetBlock(layout);
 	uiLayout *row;
 	uiBut *but;
-	const float dpi_fac= UI_DPI_FAC;
+	const float dpi_fac = UI_DPI_FAC;
 	
-	row= uiLayoutRow(layout, 1);
+	row = uiLayoutRow(layout, 1);
 
-	if(rr==NULL || iuser==NULL)
+	if (rr == NULL || iuser == NULL)
 		return;
-	if(rr->layers.first==NULL) {
+	if (rr->layers.first == NULL) {
 		uiItemL(row, "No Layers in Render Result", ICON_NONE);
 		return;
 	}
 
 	/* decrease, increase arrows */
-	but= uiDefIconBut(block, BUT, 0, ICON_TRIA_LEFT,	0,0,17,20, NULL, 0, 0, 0, 0, "Previous Layer");
+	but = uiDefIconBut(block, BUT, 0, ICON_TRIA_LEFT,   0, 0, 17, 20, NULL, 0, 0, 0, 0, "Previous Layer");
 	uiButSetFunc(but, image_multi_declay_cb, rr, iuser);
-	but= uiDefIconBut(block, BUT, 0, ICON_TRIA_RIGHT,	0,0,18,20, NULL, 0, 0, 0, 0, "Next Layer");
+	but = uiDefIconBut(block, BUT, 0, ICON_TRIA_RIGHT,  0, 0, 18, 20, NULL, 0, 0, 0, 0, "Next Layer");
 	uiButSetFunc(but, image_multi_inclay_cb, rr, iuser);
 
 	uiblock_layer_pass_buttons(row, rr, iuser, 230 * dpi_fac, render_slot);
 
 	/* decrease, increase arrows */
-	but= uiDefIconBut(block, BUT, 0, ICON_TRIA_LEFT,	0,0,17,20, NULL, 0, 0, 0, 0, "Previous Pass");
+	but = uiDefIconBut(block, BUT, 0, ICON_TRIA_LEFT,   0, 0, 17, 20, NULL, 0, 0, 0, 0, "Previous Pass");
 	uiButSetFunc(but, image_multi_decpass_cb, rr, iuser);
-	but= uiDefIconBut(block, BUT, 0, ICON_TRIA_RIGHT,	0,0,18,20, NULL, 0, 0, 0, 0, "Next Pass");
+	but = uiDefIconBut(block, BUT, 0, ICON_TRIA_RIGHT,  0, 0, 18, 20, NULL, 0, 0, 0, 0, "Next Pass");
 	uiButSetFunc(but, image_multi_incpass_cb, rr, iuser);
 
 	uiBlockEndAlign(block);
@@ -600,15 +599,15 @@ typedef struct RNAUpdateCb {
 
 static void rna_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg))
 {
-	RNAUpdateCb *cb= (RNAUpdateCb*)arg_cb;
+	RNAUpdateCb *cb = (RNAUpdateCb *)arg_cb;
 
 	/* ideally this would be done by RNA itself, but there we have
-	   no image user available, so we just update this flag here */
-	cb->iuser->ok= 1;
+	 * no image user available, so we just update this flag here */
+	cb->iuser->ok = 1;
 
 	/* we call update here on the pointer property, this way the
-	   owner of the image pointer can still define it's own update
-	   and notifier */
+	 * owner of the image pointer can still define it's own update
+	 * and notifier */
 	RNA_property_update(C, &cb->ptr, cb->prop);
 }
 
@@ -620,80 +619,80 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
 	Image *ima;
 	ImageUser *iuser;
 	ImBuf *ibuf;
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	uiLayout *row, *split, *col;
 	uiBlock *block;
 	uiBut *but;
 	char str[128];
 	void *lock;
 
-	if(!ptr->data)
+	if (!ptr->data)
 		return;
 
-	prop= RNA_struct_find_property(ptr, propname);
-	if(!prop) {
+	prop = RNA_struct_find_property(ptr, propname);
+	if (!prop) {
 		printf("%s: property not found: %s.%s\n",
 		       __func__, RNA_struct_identifier(ptr->type), propname);
 		return;
 	}
 
-	if(RNA_property_type(prop) != PROP_POINTER) {
+	if (RNA_property_type(prop) != PROP_POINTER) {
 		printf("%s: expected pointer property for %s.%s\n",
 		       __func__, RNA_struct_identifier(ptr->type), propname);
 		return;
 	}
 
-	block= uiLayoutGetBlock(layout);
+	block = uiLayoutGetBlock(layout);
 
-	imaptr= RNA_property_pointer_get(ptr, prop);
-	ima= imaptr.data;
-	iuser= userptr->data;
+	imaptr = RNA_property_pointer_get(ptr, prop);
+	ima = imaptr.data;
+	iuser = userptr->data;
 
-	cb= MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb");
-	cb->ptr= *ptr;
-	cb->prop= prop;
-	cb->iuser= iuser;
+	cb = MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb");
+	cb->ptr = *ptr;
+	cb->prop = prop;
+	cb->iuser = iuser;
 
 	uiLayoutSetContextPointer(layout, "edit_image", &imaptr);
 
-	if(!compact)
+	if (!compact)
 		uiTemplateID(layout, C, ptr, propname, "IMAGE_OT_new", "IMAGE_OT_open", NULL);
 
-	if(ima) {
+	if (ima) {
 		uiBlockSetNFunc(block, rna_update_cb, MEM_dupallocN(cb), NULL);
 
-		if(ima->source == IMA_SRC_VIEWER) {
-			ibuf= BKE_image_acquire_ibuf(ima, iuser, &lock);
+		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);
 
-			uiItemL(layout, ima->id.name+2, ICON_NONE);
+			uiItemL(layout, ima->id.name + 2, ICON_NONE);
 			uiItemL(layout, str, ICON_NONE);
 
-			if(ima->type==IMA_TYPE_COMPOSITE) {
+			if (ima->type == IMA_TYPE_COMPOSITE) {
 				// XXX not working yet
 #if 0
-				iuser= ntree_get_active_iuser(scene->nodetree);
-				if(iuser) {
+				iuser = ntree_get_active_iuser(scene->nodetree);
+				if (iuser) {
 					uiBlockBeginAlign(block);
-					uiDefIconTextBut(block, BUT, B_SIMA_RECORD, ICON_REC, "Record",	10,120,100,20, 0, 0, 0, 0, 0, "");
-					uiDefIconTextBut(block, BUT, B_SIMA_PLAY, ICON_PLAY, "Play",	110,120,100,20, 0, 0, 0, 0, 0, "");
-					but= uiDefBut(block, BUT, B_NOP, "Free Cache",	210,120,100,20, 0, 0, 0, 0, 0, "");
+					uiDefIconTextBut(block, BUT, B_SIMA_RECORD, ICON_REC, "Record", 10, 120, 100, 20, 0, 0, 0, 0, 0, "");
+					uiDefIconTextBut(block, BUT, B_SIMA_PLAY, ICON_PLAY, "Play",    110, 120, 100, 20, 0, 0, 0, 0, 0, "");
+					but = uiDefBut(block, BUT, B_NOP, "Free Cache", 210, 120, 100, 20, 0, 0, 0, 0, 0, "");
 					uiButSetFunc(but, image_freecache_cb, ima, NULL);
 					
-					if(iuser->frames)
+					if (iuser->frames)
 						BLI_snprintf(str, sizeof(str), "(%d) Frames:", iuser->framenr);
 					else strcpy(str, "Frames:");
 					uiBlockBeginAlign(block);
-					uiDefButI(block, NUM, imagechanged, str,		10, 90,150, 20, &iuser->frames, 0.0, MAXFRAMEF, 0, 0, "Number of images of a movie to use");
-					uiDefButI(block, NUM, imagechanged, "StartFr:",	160,90,150,20, &iuser->sfra, 1.0, MAXFRAMEF, 0, 0, "Global starting frame of the movie");
+					uiDefButI(block, NUM, imagechanged, str,        10, 90, 150, 20, &iuser->frames, 0.0, MAXFRAMEF, 0, 0, "Number of images of a movie to use");
+					uiDefButI(block, NUM, imagechanged, "StartFr:", 160, 90, 150, 20, &iuser->sfra, 1.0, MAXFRAMEF, 0, 0, "Global starting frame of the movie");
 				}
 #endif
 			}
-			else if(ima->type==IMA_TYPE_R_RESULT) {
+			else if (ima->type == IMA_TYPE_R_RESULT) {
 				/* browse layer/passes */
-				Render *re= RE_GetRender(scene->id.name);
-				RenderResult *rr= RE_AcquireResultRead(re);
+				Render *re = RE_GetRender(scene->id.name);
+				RenderResult *rr = RE_AcquireResultRead(re);
 				uiblock_layer_pass_arrow_buttons(layout, rr, iuser, &ima->render_slot);
 				RE_ReleaseResult(re);
 			}
@@ -701,24 +700,24 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
 		else {
 			uiItemR(layout, &imaptr, "source", 0, NULL, ICON_NONE);
 
-			if(ima->source != IMA_SRC_GENERATED) {
-				row= uiLayoutRow(layout, 1);
+			if (ima->source != IMA_SRC_GENERATED) {
+				row = uiLayoutRow(layout, 1);
 				if (ima->packedfile)
 					uiItemO(row, "", ICON_PACKAGE, "image.unpack");
 				else
 					uiItemO(row, "", ICON_UGLYPACKAGE, "image.pack");
 				
-				row= uiLayoutRow(row, 0);
-				uiLayoutSetEnabled(row, ima->packedfile==NULL);
+				row = uiLayoutRow(row, 0);
+				uiLayoutSetEnabled(row, ima->packedfile == NULL);
 				uiItemR(row, &imaptr, "filepath", 0, "", ICON_NONE);
 				uiItemO(row, "", ICON_FILE_REFRESH, "image.reload");
 			}
 
 			// XXX what was this for?
 #if 0
-			 /* check for re-render, only buttons */
-			if(imagechanged==B_IMAGECHANGED) {
-				if(iuser->flag & IMA_ANIM_REFRESHED) {
+			/* check for re-render, only buttons */
+			if (imagechanged == B_IMAGECHANGED) {
+				if (iuser->flag & IMA_ANIM_REFRESHED) {
 					iuser->flag &= ~IMA_ANIM_REFRESHED;
 					WM_event_add_notifier(C, NC_IMAGE, ima);
 				}
@@ -726,65 +725,65 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
 #endif
 
 			/* multilayer? */
-			if(ima->type==IMA_TYPE_MULTILAYER && ima->rr) {
+			if (ima->type == IMA_TYPE_MULTILAYER && ima->rr) {
 				uiblock_layer_pass_arrow_buttons(layout, ima->rr, iuser, NULL);
 			}
-			else if(ima->source != IMA_SRC_GENERATED) {
-				if(compact == 0) {
-					ibuf= BKE_image_acquire_ibuf(ima, iuser, &lock);
+			else if (ima->source != IMA_SRC_GENERATED) {
+				if (compact == 0) {
+					ibuf = BKE_image_acquire_ibuf(ima, iuser, &lock);
 					image_info(scene, iuser, ima, ibuf, str);
 					BKE_image_release_ibuf(ima, lock);
 					uiItemL(layout, str, ICON_NONE);
 				}
 			}
 			
-			if(ima->source != IMA_SRC_GENERATED) {
-				if(compact == 0) { /* background image view doesnt need these */
+			if (ima->source != IMA_SRC_GENERATED) {
+				if (compact == 0) { /* background image view doesnt need these */
 					uiItemS(layout);
 
-					split= uiLayoutSplit(layout, 0, 0);
+					split = uiLayoutSplit(layout, 0, 0);
 
-					col= uiLayoutColumn(split, 0);
+					col = uiLayoutColumn(split, 0);
 					uiItemR(col, &imaptr, "use_fields", 0, NULL, ICON_NONE);
-					row= uiLayoutRow(col, 0);
+					row = uiLayoutRow(col, 0);
 					uiLayoutSetActive(row, RNA_boolean_get(&imaptr, "use_fields"));
 					uiItemR(row, &imaptr, "field_order", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
 					
-					row= uiLayoutRow(layout, 0);
+					row = uiLayoutRow(layout, 0);
 					uiItemR(row, &imaptr, "use_premultiply", 0, NULL, ICON_NONE);
 					uiItemR(row, &imaptr, "use_color_unpremultiply", 0, NULL, ICON_NONE);
 				}
 			}
 
-			if(ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
+			if (ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
 				uiItemS(layout);
 				
-				split= uiLayoutSplit(layout, 0, 0);
+				split = uiLayoutSplit(layout, 0, 0);
 
-				col= uiLayoutColumn(split, 0);
+				col = uiLayoutColumn(split, 0);
 				 
 				BLI_snprintf(str, sizeof(str), "(%d) Frames", iuser->framenr);
 				uiItemR(col, userptr, "frame_duration", 0, str, ICON_NONE);
-				if(ima->anim) {
-					block= uiLayoutGetBlock(col);
-					but= uiDefBut(block, BUT, 0, "Match Movie Length", 0, 0, UI_UNIT_X*2, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Set the number of frames to match the movie or sequence");
+				if (ima->anim) {
+					block = uiLayoutGetBlock(col);
+					but = uiDefBut(block, BUT, 0, "Match Movie Length", 0, 0, UI_UNIT_X * 2, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Set the number of frames to match the movie or sequence");
 					uiButSetFunc(but, set_frames_cb, ima, iuser);
 				}
 
 				uiItemR(col, userptr, "frame_start", 0, "Start", ICON_NONE);
 				uiItemR(col, userptr, "frame_offset", 0, NULL, ICON_NONE);
 
-				col= uiLayoutColumn(split, 0);
-				row= uiLayoutRow(col, 0);
+				col = uiLayoutColumn(split, 0);
+				row = uiLayoutRow(col, 0);
 				uiLayoutSetActive(row, RNA_boolean_get(&imaptr, "use_fields"));
 				uiItemR(row, userptr, "fields_per_frame", 0, "Fields", ICON_NONE);
 				uiItemR(col, userptr, "use_auto_refresh", 0, NULL, ICON_NONE);
 				uiItemR(col, userptr, "use_cyclic", 0, NULL, ICON_NONE);
 			}
-			else if(ima->source==IMA_SRC_GENERATED) {
-				split= uiLayoutSplit(layout, 0, 0);
+			else if (ima->source == IMA_SRC_GENERATED) {
+				split = uiLayoutSplit(layout, 0, 0);
 
-				col= uiLayoutColumn(split, 1);
+				col = uiLayoutColumn(split, 1);
 				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);
@@ -792,7 +791,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
 				uiItemR(split, &imaptr, "generated_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
 			}
 
-					}
+		}
 
 		uiBlockSetNFunc(block, NULL, NULL, NULL);
 	}
@@ -802,32 +801,32 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
 
 void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr)
 {
-	ImageFormatData *imf= imfptr->data;
-	ID *id= imfptr->id.data;
-	const int depth_ok= BKE_imtype_valid_depths(imf->imtype);
+	ImageFormatData *imf = imfptr->data;
+	ID *id = imfptr->id.data;
+	const int depth_ok = BKE_imtype_valid_depths(imf->imtype);
 	/* some settings depend on this being a scene thats rendered */
-	const short is_render_out= (id && GS(id->name) == ID_SCE);
+	const short is_render_out = (id && GS(id->name) == ID_SCE);
 
 	uiLayout *col, *row, *split, *sub;
 
-	col= uiLayoutColumn(layout, 0);
+	col = uiLayoutColumn(layout, 0);
 
-	split= uiLayoutSplit(col, 0.5f, 0);
+	split = uiLayoutSplit(col, 0.5f, 0);
 	
 	uiItemR(split, imfptr, "file_format", 0, "", ICON_NONE);
-	sub= uiLayoutRow(split, 0);
+	sub = uiLayoutRow(split, 0);
 	uiItemR(sub, imfptr, "color_mode", UI_ITEM_R_EXPAND, "Color", ICON_NONE);
 
 	/* only display depth setting if multiple depths can be used */
-	if((ELEM6(depth_ok,
-	          R_IMF_CHAN_DEPTH_1,
-	          R_IMF_CHAN_DEPTH_8,
-	          R_IMF_CHAN_DEPTH_12,
-	          R_IMF_CHAN_DEPTH_16,
-	          R_IMF_CHAN_DEPTH_24,
-	          R_IMF_CHAN_DEPTH_32)) == 0)
+	if ((ELEM6(depth_ok,
+	           R_IMF_CHAN_DEPTH_1,
+	           R_IMF_CHAN_DEPTH_8,
+	           R_IMF_CHAN_DEPTH_12,
+	           R_IMF_CHAN_DEPTH_16,
+	           R_IMF_CHAN_DEPTH_24,
+	           R_IMF_CHAN_DEPTH_32)) == 0)
 	{
-		row= uiLayoutRow(col, 0);
+		row = uiLayoutRow(col, 0);
 		uiItemR(row, imfptr, "color_depth", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
 	}
 
@@ -843,7 +842,7 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr)
 		uiItemR(col, imfptr, "exr_codec", 0, NULL, ICON_NONE);
 	}
 	
-	row= uiLayoutRow(col, 0);
+	row = uiLayoutRow(col, 0);
 	if (BKE_imtype_supports_zbuf(imf->imtype)) {
 		uiItemR(row, imfptr, "use_zbuffer", 0, NULL, ICON_NONE);
 	}
@@ -853,7 +852,7 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr)
 	}
 
 	if (imf->imtype == R_IMF_IMTYPE_JP2) {
-		row= uiLayoutRow(col, 0);
+		row = uiLayoutRow(col, 0);
 		uiItemR(row, imfptr, "use_jpeg2k_cinema_preset", 0, NULL, ICON_NONE);
 		uiItemR(row, imfptr, "use_jpeg2k_cinema_48", 0, NULL, ICON_NONE);
 		
@@ -874,15 +873,17 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr)
 
 void uiTemplateImageLayers(uiLayout *layout, bContext *C, Image *ima, ImageUser *iuser)
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
+	Render *re;
 	RenderResult *rr;
 
 	/* render layers and passes */
-	if(ima && iuser) {
-		const float dpi_fac= UI_DPI_FAC;
-		rr= BKE_image_acquire_renderresult(scene, ima);
-		uiblock_layer_pass_buttons(layout, rr, iuser, 160 * dpi_fac, (ima->type==IMA_TYPE_R_RESULT)? &ima->render_slot: NULL);
-		BKE_image_release_renderresult(scene, ima);
+	if (ima && iuser) {
+		const float dpi_fac = UI_DPI_FAC;
+		re = RE_GetRender(scene->id.name);
+		rr = RE_AcquireResultRead(re);
+		uiblock_layer_pass_buttons(layout, rr, iuser, 160 * dpi_fac, (ima->type == IMA_TYPE_R_RESULT) ? &ima->render_slot : NULL);
+		RE_ReleaseResult(re);
 	}
 }
 
@@ -890,27 +891,27 @@ void image_buttons_register(ARegionType *art)
 {
 	PanelType *pt;
 
-	pt= MEM_callocN(sizeof(PanelType), "spacetype image panel curves");
+	pt = MEM_callocN(sizeof(PanelType), "spacetype image panel curves");
 	strcpy(pt->idname, "IMAGE_PT_curves");
 	strcpy(pt->label, "Curves");
-	pt->draw= image_panel_curves;
-	pt->poll= image_panel_poll;
+	pt->draw = image_panel_curves;
+	pt->poll = image_panel_poll;
 	pt->flag |= PNL_DEFAULT_CLOSED;
 	BLI_addtail(&art->paneltypes, pt);
 	
-	pt= MEM_callocN(sizeof(PanelType), "spacetype image panel gpencil");
+	pt = MEM_callocN(sizeof(PanelType), "spacetype image panel gpencil");
 	strcpy(pt->idname, "IMAGE_PT_gpencil");
 	strcpy(pt->label, "Grease Pencil");
-	pt->draw= gpencil_panel_standard;
+	pt->draw = gpencil_panel_standard;
 	BLI_addtail(&art->paneltypes, pt);
 }
 
 static int image_properties(bContext *C, wmOperator *UNUSED(op))
 {
-	ScrArea *sa= CTX_wm_area(C);
-	ARegion *ar= image_has_buttons_region(sa);
+	ScrArea *sa = CTX_wm_area(C);
+	ARegion *ar = image_has_buttons_region(sa);
 	
-	if(ar)
+	if (ar)
 		ED_region_toggle_hidden(C, ar);
 
 	return OPERATOR_FINISHED;
@@ -918,23 +919,23 @@ static int image_properties(bContext *C, wmOperator *UNUSED(op))
 
 void IMAGE_OT_properties(wmOperatorType *ot)
 {
-	ot->name= "Properties";
-	ot->idname= "IMAGE_OT_properties";
-	ot->description= "Toggle display properties panel";
+	ot->name = "Properties";
+	ot->idname = "IMAGE_OT_properties";
+	ot->description = "Toggle display properties panel";
 	
-	ot->exec= image_properties;
-	ot->poll= ED_operator_image_active;
+	ot->exec = image_properties;
+	ot->poll = ED_operator_image_active;
 	
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 }
 
 static int image_scopes(bContext *C, wmOperator *UNUSED(op))
 {
-	ScrArea *sa= CTX_wm_area(C);
-	ARegion *ar= image_has_scope_region(sa);
+	ScrArea *sa = CTX_wm_area(C);
+	ARegion *ar = image_has_scope_region(sa);
 	
-	if(ar)
+	if (ar)
 		ED_region_toggle_hidden(C, ar);
 	
 	return OPERATOR_FINISHED;
@@ -942,14 +943,14 @@ static int image_scopes(bContext *C, wmOperator *UNUSED(op))
 
 void IMAGE_OT_scopes(wmOperatorType *ot)
 {
-	ot->name= "Scopes";
-	ot->idname= "IMAGE_OT_scopes";
-	ot->description= "Toggle display scopes panel";
+	ot->name = "Scopes";
+	ot->idname = "IMAGE_OT_scopes";
+	ot->description = "Toggle display scopes panel";
 	
-	ot->exec= image_scopes;
-	ot->poll= ED_operator_image_active;
+	ot->exec = image_scopes;
+	ot->poll = ED_operator_image_active;
 	
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 }
 
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 9ec9c5e..29bd5f5 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -79,15 +79,15 @@
 static void image_verify_buffer_float(Image *ima, ImBuf *ibuf, int color_manage)
 {
 	/* detect if we need to redo the curve map.
-	   ibuf->rect is zero for compositor and render results after change 
-	   convert to 32 bits always... drawing float rects isnt supported well (atis)
-	
-	   NOTE: if float buffer changes, we have to manually remove the rect
-	*/
-
-	if(ibuf->rect_float && (ibuf->rect==NULL || (ibuf->userflags & IB_RECT_INVALID)) ) {
-		if(color_manage) {
-			if(ima && ima->source == IMA_SRC_VIEWER)
+	 * ibuf->rect is zero for compositor and render results after change 
+	 * convert to 32 bits always... drawing float rects isn't supported well (atis)
+	 *
+	 * NOTE: if float buffer changes, we have to manually remove the rect
+	 */
+
+	if (ibuf->rect_float && (ibuf->rect == NULL || (ibuf->userflags & IB_RECT_INVALID)) ) {
+		if (color_manage) {
+			if (ima && ima->source == IMA_SRC_VIEWER)
 				ibuf->profile = IB_PROFILE_LINEAR_RGB;
 		}
 		else
@@ -101,9 +101,9 @@ static void draw_render_info(Scene *scene, Image *ima, ARegion *ar)
 {
 	RenderResult *rr;
 	
-	rr= BKE_image_acquire_renderresult(scene, ima);
+	rr = BKE_image_acquire_renderresult(scene, ima);
 
-	if(rr && rr->text) {
+	if (rr && rr->text) {
 		ED_region_info_draw(ar, rr->text, 1, 0.25);
 	}
 
@@ -115,7 +115,7 @@ void ED_image_draw_info(ARegion *ar, int color_manage, int channels, int x, int
                         const unsigned char cp[4], const float fp[4], int *zp, float *zpf)
 {
 	char str[256];
-	float dx= 6;
+	float dx = 6;
 	/* text colors */
 	/* XXX colored text not allowed in Blender UI */
 	#if 0
@@ -127,10 +127,10 @@ void ED_image_draw_info(ARegion *ar, int color_manage, int channels, int x, int
 	unsigned char green[3] = {255, 255, 255};
 	unsigned char blue[3] = {255, 255, 255};
 	#endif
-	float hue=0, sat=0, val=0, lum=0, u=0, v=0;
+	float hue = 0, sat = 0, val = 0, lum = 0, u = 0, v = 0;
 	float col[4], finalcol[4];
 
-	glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
+	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 	glEnable(GL_BLEND);
 
 	/* noisy, high contrast make impossible to read if lower alpha is used. */
@@ -147,14 +147,14 @@ void ED_image_draw_info(ARegion *ar, int color_manage, int channels, int x, int
 	BLF_draw_ascii(blf_mono_font, str, sizeof(str));
 	dx += BLF_width(blf_mono_font, str);
 
-	if(zp) {
+	if (zp) {
 		glColor3ub(255, 255, 255);
-		BLI_snprintf(str, sizeof(str), " Z:%-.4f |", 0.5f+0.5f*(((float)*zp)/(float)0x7fffffff));
+		BLI_snprintf(str, sizeof(str), " Z:%-.4f |", 0.5f + 0.5f * (((float)*zp) / (float)0x7fffffff));
 		BLF_position(blf_mono_font, dx, 6, 0);
 		BLF_draw_ascii(blf_mono_font, str, sizeof(str));
 		dx += BLF_width(blf_mono_font, str);
 	}
-	if(zpf) {
+	if (zpf) {
 		glColor3ub(255, 255, 255);
 		BLI_snprintf(str, sizeof(str), " Z:%-.3f |", *zpf);
 		BLF_position(blf_mono_font, dx, 6, 0);
@@ -162,7 +162,7 @@ void ED_image_draw_info(ARegion *ar, int color_manage, int channels, int x, int
 		dx += BLF_width(blf_mono_font, str);
 	}
 
-	if(channels >= 3) {
+	if (channels >= 3) {
 		glColor3ubv(red);
 		if (fp)
 			BLI_snprintf(str, sizeof(str), "  R:%-.4f", fp[0]);
@@ -196,7 +196,7 @@ void ED_image_draw_info(ARegion *ar, int color_manage, int channels, int x, int
 		BLF_draw_ascii(blf_mono_font, str, sizeof(str));
 		dx += BLF_width(blf_mono_font, str);
 		
-		if(channels == 4) {
+		if (channels == 4) {
 			glColor3ub(255, 255, 255);
 			if (fp)
 				BLI_snprintf(str, sizeof(str), "  A:%-.4f", fp[3]);
@@ -211,19 +211,19 @@ void ED_image_draw_info(ARegion *ar, int color_manage, int channels, int x, int
 	}
 	
 	/* color rectangle */
-	if (channels==1) {
+	if (channels == 1) {
 		if (fp) {
 			col[0] = col[1] = col[2] = fp[0];
 		}
 		else if (cp) {
-			col[0] = col[1] = col[2] = (float)cp[0]/255.0f;
+			col[0] = col[1] = col[2] = (float)cp[0] / 255.0f;
 		}
 		else {
 			col[0] = col[1] = col[2] = 0.0f;
 		}
 		col[3] = 1.0f;
 	}
-	else if (channels==3) {
+	else if (channels == 3) {
 		if (fp) {
 			copy_v3_v3(col, fp);
 		}
@@ -235,7 +235,7 @@ void ED_image_draw_info(ARegion *ar, int color_manage, int channels, int x, int
 		}
 		col[3] = 1.0f;
 	}
-	else if (channels==4) {
+	else if (channels == 4) {
 		if (fp)
 			copy_v4_v4(col, fp);
 		else if (cp) {
@@ -262,20 +262,30 @@ void ED_image_draw_info(ARegion *ar, int color_manage, int channels, int x, int
 	glBegin(GL_QUADS);
 	glVertex2f(dx, 3);
 	glVertex2f(dx, 17);
-	glVertex2f(dx+30, 17);
-	glVertex2f(dx+30, 3);
+	glVertex2f(dx + 30, 17);
+	glVertex2f(dx + 30, 3);
 	glEnd();
+
+	/* draw outline */
+	glColor3ub(128, 128, 128);
+	glBegin(GL_LINE_LOOP);
+	glVertex2f(dx, 3);
+	glVertex2f(dx, 17);
+	glVertex2f(dx + 30, 17);
+	glVertex2f(dx + 30, 3);
+	glEnd();
+
 	dx += 35;
 
 	glColor3ub(255, 255, 255);
-	if(channels == 1) {
+	if (channels == 1) {
 		if (fp) {
 			rgb_to_hsv(fp[0], fp[0], fp[0], &hue, &sat, &val);
 			rgb_to_yuv(fp[0], fp[0], fp[0], &lum, &u, &v);
 		}
 		else if (cp) {
-			rgb_to_hsv((float)cp[0]/255.0f, (float)cp[0]/255.0f, (float)cp[0]/255.0f, &hue, &sat, &val);
-			rgb_to_yuv((float)cp[0]/255.0f, (float)cp[0]/255.0f, (float)cp[0]/255.0f, &lum, &u, &v);
+			rgb_to_hsv((float)cp[0] / 255.0f, (float)cp[0] / 255.0f, (float)cp[0] / 255.0f, &hue, &sat, &val);
+			rgb_to_yuv((float)cp[0] / 255.0f, (float)cp[0] / 255.0f, (float)cp[0] / 255.0f, &lum, &u, &v);
 		}
 		
 		BLI_snprintf(str, sizeof(str), "V:%-.4f", val);
@@ -288,14 +298,14 @@ void ED_image_draw_info(ARegion *ar, int color_manage, int channels, int x, int
 		BLF_draw_ascii(blf_mono_font, str, sizeof(str));
 		dx += BLF_width(blf_mono_font, str);
 	}
-	else if(channels >= 3) {
+	else if (channels >= 3) {
 		if (fp) {
 			rgb_to_hsv(fp[0], fp[1], fp[2], &hue, &sat, &val);
 			rgb_to_yuv(fp[0], fp[1], fp[2], &lum, &u, &v);
 		}
 		else if (cp) {
-			rgb_to_hsv((float)cp[0]/255.0f, (float)cp[1]/255.0f, (float)cp[2]/255.0f, &hue, &sat, &val);
-			rgb_to_yuv((float)cp[0]/255.0f, (float)cp[1]/255.0f, (float)cp[2]/255.0f, &lum, &u, &v);
+			rgb_to_hsv((float)cp[0] / 255.0f, (float)cp[1] / 255.0f, (float)cp[2] / 255.0f, &hue, &sat, &val);
+			rgb_to_yuv((float)cp[0] / 255.0f, (float)cp[1] / 255.0f, (float)cp[2] / 255.0f, &lum, &u, &v);
 		}
 
 		BLI_snprintf(str, sizeof(str), "H:%-.4f", hue);
@@ -326,7 +336,7 @@ void ED_image_draw_info(ARegion *ar, int color_manage, int channels, int x, int
 
 static void draw_image_grid(ARegion *ar, float zoomx, float zoomy)
 {
-	float gridsize, gridstep= 1.0f/32.0f;
+	float gridsize, gridstep = 1.0f / 32.0f;
 	float fac, blendfac;
 	int x1, y1, x2, y2;
 	
@@ -338,80 +348,56 @@ static void draw_image_grid(ARegion *ar, float zoomx, float zoomy)
 	glRectf(x1, y1, x2, y2);
 
 	/* gridsize adapted to zoom level */
-	gridsize= 0.5f*(zoomx+zoomy);
-	if(gridsize<=0.0f) return;
+	gridsize = 0.5f * (zoomx + zoomy);
+	if (gridsize <= 0.0f) return;
 	
-	if(gridsize<1.0f) {
-		while(gridsize<1.0f) {
-			gridsize*= 4.0f;
-			gridstep*= 4.0f;
+	if (gridsize < 1.0f) {
+		while (gridsize < 1.0f) {
+			gridsize *= 4.0f;
+			gridstep *= 4.0f;
 		}
 	}
 	else {
-		while(gridsize>=4.0f) {
-			gridsize/= 4.0f;
-			gridstep/= 4.0f;
+		while (gridsize >= 4.0f) {
+			gridsize /= 4.0f;
+			gridstep /= 4.0f;
 		}
 	}
 	
 	/* the fine resolution level */
-	blendfac= 0.25f*gridsize - floorf(0.25f*gridsize);
+	blendfac = 0.25f * gridsize - floorf(0.25f * gridsize);
 	CLAMP(blendfac, 0.0f, 1.0f);
-	UI_ThemeColorShade(TH_BACK, (int)(20.0f*(1.0f-blendfac)));
+	UI_ThemeColorShade(TH_BACK, (int)(20.0f * (1.0f - blendfac)));
 	
-	fac= 0.0f;
+	fac = 0.0f;
 	glBegin(GL_LINES);
-	while(fac<1.0f) {
-		glVertex2f(x1, y1*(1.0f-fac) + y2*fac);
-		glVertex2f(x2, y1*(1.0f-fac) + y2*fac);
-		glVertex2f(x1*(1.0f-fac) + x2*fac, y1);
-		glVertex2f(x1*(1.0f-fac) + x2*fac, y2);
-		fac+= gridstep;
+	while (fac < 1.0f) {
+		glVertex2f(x1, y1 * (1.0f - fac) + y2 * fac);
+		glVertex2f(x2, y1 * (1.0f - fac) + y2 * fac);
+		glVertex2f(x1 * (1.0f - fac) + x2 * fac, y1);
+		glVertex2f(x1 * (1.0f - fac) + x2 * fac, y2);
+		fac += gridstep;
 	}
 	
 	/* the large resolution level */
 	UI_ThemeColor(TH_BACK);
 	
-	fac= 0.0f;
-	while(fac<1.0f) {
-		glVertex2f(x1, y1*(1.0f-fac) + y2*fac);
-		glVertex2f(x2, y1*(1.0f-fac) + y2*fac);
-		glVertex2f(x1*(1.0f-fac) + x2*fac, y1);
-		glVertex2f(x1*(1.0f-fac) + x2*fac, y2);
-		fac+= 4.0f*gridstep;
+	fac = 0.0f;
+	while (fac < 1.0f) {
+		glVertex2f(x1, y1 * (1.0f - fac) + y2 * fac);
+		glVertex2f(x2, y1 * (1.0f - fac) + y2 * fac);
+		glVertex2f(x1 * (1.0f - fac) + x2 * fac, y1);
+		glVertex2f(x1 * (1.0f - fac) + x2 * fac, y2);
+		fac += 4.0f * gridstep;
 	}
 	glEnd();
 }
 
-static void sima_draw_alpha_backdrop(float x1, float y1, float xsize, float ysize, float zoomx, float zoomy, unsigned char col1[3], unsigned char col2[3])
-{
-	GLubyte checker_stipple[32*32/8] =
-	{
-		255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,
-		255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,
-		255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,
-		255,255,0,0,255,255,0,0,255,255,0,0,255,255,0,0,
-		0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,
-		0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,
-		0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,
-		0,0,255,255,0,0,255,255,0,0,255,255,0,0,255,255,
-	};
-	
-	glColor3ubv(col1);
-	glRectf(x1, y1, x1 + zoomx*xsize, y1 + zoomy*ysize);
-	glColor3ubv(col2);
-
-	glEnable(GL_POLYGON_STIPPLE);
-	glPolygonStipple(checker_stipple);
-	glRectf(x1, y1, x1 + zoomx*xsize, y1 + zoomy*ysize);
-	glDisable(GL_POLYGON_STIPPLE);
-}
-
 static void sima_draw_alpha_pixels(float x1, float y1, int rectx, int recty, unsigned int *recti)
 {
 	
 	/* swap bytes, so alpha is most significant one, then just draw it as luminance int */
-	if(ENDIAN_ORDER == B_ENDIAN)
+	if (ENDIAN_ORDER == B_ENDIAN)
 		glPixelStorei(GL_UNPACK_SWAP_BYTES, 1);
 
 	glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_LUMINANCE, GL_UNSIGNED_INT, recti);
@@ -420,11 +406,11 @@ static void sima_draw_alpha_pixels(float x1, float y1, int rectx, int recty, uns
 
 static void sima_draw_alpha_pixelsf(float x1, float y1, int rectx, int recty, float *rectf)
 {
-	float *trectf= MEM_mallocN(rectx*recty*4, "temp");
+	float *trectf = MEM_mallocN(rectx * recty * 4, "temp");
 	int a, b;
 	
-	for(a= rectx*recty -1, b= 4*a+3; a>=0; a--, b-=4)
-		trectf[a]= rectf[b];
+	for (a = rectx * recty - 1, b = 4 * a + 3; a >= 0; a--, b -= 4)
+		trectf[a] = rectf[b];
 	
 	glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_LUMINANCE, GL_FLOAT, trectf);
 	MEM_freeN(trectf);
@@ -463,26 +449,26 @@ static void sima_draw_zbuffloat_pixels(Scene *scene, float x1, float y1, int rec
 	float bias, scale, *rectf, clipend;
 	int a;
 	
-	if(scene->camera && scene->camera->type==OB_CAMERA) {
-		bias= ((Camera *)scene->camera->data)->clipsta;
-		clipend= ((Camera *)scene->camera->data)->clipend;
-		scale= 1.0f/(clipend-bias);
+	if (scene->camera && scene->camera->type == OB_CAMERA) {
+		bias = ((Camera *)scene->camera->data)->clipsta;
+		clipend = ((Camera *)scene->camera->data)->clipend;
+		scale = 1.0f / (clipend - bias);
 	}
 	else {
-		bias= 0.1f;
-		scale= 0.01f;
-		clipend= 100.0f;
+		bias = 0.1f;
+		scale = 0.01f;
+		clipend = 100.0f;
 	}
 	
-	rectf= MEM_mallocN(rectx*recty*4, "temp");
-	for(a= rectx*recty -1; a>=0; a--) {
-		if(rect_float[a]>clipend)
-			rectf[a]= 0.0f;
-		else if(rect_float[a]<bias)
-			rectf[a]= 1.0f;
+	rectf = MEM_mallocN(rectx * recty * 4, "temp");
+	for (a = rectx * recty - 1; a >= 0; a--) {
+		if (rect_float[a] > clipend)
+			rectf[a] = 0.0f;
+		else if (rect_float[a] < bias)
+			rectf[a] = 1.0f;
 		else {
-			rectf[a]= 1.0f - (rect_float[a]-bias)*scale;
-			rectf[a]*= rectf[a];
+			rectf[a] = 1.0f - (rect_float[a] - bias) * scale;
+			rectf[a] *= rectf[a];
 		}
 	}
 	glaDrawPixelsSafe(x1, y1, rectx, recty, rectx, GL_LUMINANCE, GL_FLOAT, rectf);
@@ -502,24 +488,23 @@ static void draw_image_buffer(SpaceImage *sima, ARegion *ar, Scene *scene, Image
 	UI_view2d_to_region_no_clip(&ar->v2d, fx, fy, &x, &y);
 
 	/* this part is generic image display */
-	if(sima->flag & SI_SHOW_ALPHA) {
-		if(ibuf->rect)
+	if (sima->flag & SI_SHOW_ALPHA) {
+		if (ibuf->rect)
 			sima_draw_alpha_pixels(x, y, ibuf->x, ibuf->y, ibuf->rect);
-		else if(ibuf->rect_float && ibuf->channels==4)
+		else if (ibuf->rect_float && ibuf->channels == 4)
 			sima_draw_alpha_pixelsf(x, y, ibuf->x, ibuf->y, ibuf->rect_float);
 	}
-	else if(sima->flag & SI_SHOW_ZBUF && (ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels==1))) {
-		if(ibuf->zbuf)
+	else if (sima->flag & SI_SHOW_ZBUF && (ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels == 1))) {
+		if (ibuf->zbuf)
 			sima_draw_zbuf_pixels(x, y, ibuf->x, ibuf->y, ibuf->zbuf);
-		else if(ibuf->zbuf_float)
+		else if (ibuf->zbuf_float)
 			sima_draw_zbuffloat_pixels(scene, x, y, ibuf->x, ibuf->y, ibuf->zbuf_float);
-		else if(ibuf->channels==1)
+		else if (ibuf->channels == 1)
 			sima_draw_zbuffloat_pixels(scene, x, y, ibuf->x, ibuf->y, ibuf->rect_float);
 	}
 	else {
-		if(sima->flag & SI_USE_ALPHA) {
-			unsigned char col1[3]= {100, 100, 100}, col2[3]= {160, 160, 160};
-			sima_draw_alpha_backdrop(x, y, ibuf->x, ibuf->y, zoomx, zoomy, col1, col2);
+		if (sima->flag & SI_USE_ALPHA) {
+			fdrawcheckerboard(x, y, x + ibuf->x * zoomx, y + ibuf->y * zoomy);
 
 			glEnable(GL_BLEND);
 			glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -529,12 +514,14 @@ static void draw_image_buffer(SpaceImage *sima, ARegion *ar, Scene *scene, Image
 		 * convert them, and optionally apply curves */
 		image_verify_buffer_float(ima, ibuf, color_manage);
 
-		if(ibuf->rect)
+		if (ibuf->rect)
 			glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
-		/*else
-			glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_FLOAT, ibuf->rect_float);*/
+#if 0
+		else
+			glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_FLOAT, ibuf->rect_float);
+#endif
 		
-		if(sima->flag & SI_USE_ALPHA)
+		if (sima->flag & SI_USE_ALPHA)
 			glDisable(GL_BLEND);
 	}
 
@@ -549,17 +536,17 @@ static unsigned int *get_part_from_ibuf(ImBuf *ibuf, short startx, short starty,
 
 	/* the right offset in rectot */
 
-	rt= ibuf->rect+ (starty*ibuf->x+ startx);
+	rt = ibuf->rect + (starty * ibuf->x + startx);
 
-	len= (endx-startx);
-	heigth= (endy-starty);
+	len = (endx - startx);
+	heigth = (endy - starty);
 
-	rp=rectmain= MEM_mallocN(heigth*len*sizeof(int), "rect");
+	rp = rectmain = MEM_mallocN(heigth * len * sizeof(int), "rect");
 	
-	for(y=0; y<heigth; y++) {
-		memcpy(rp, rt, len*4);
-		rt+= ibuf->x;
-		rp+= len;
+	for (y = 0; y < heigth; y++) {
+		memcpy(rp, rt, len * 4);
+		rt += ibuf->x;
+		rp += len;
 	}
 	return rectmain;
 }
@@ -571,28 +558,28 @@ static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Scene *scene,
 	int color_manage = scene->r.color_mgt_flag & R_COLOR_MANAGEMENT;
 
 	/* verify valid values, just leave this a while */
-	if(ima->xrep<1) return;
-	if(ima->yrep<1) return;
+	if (ima->xrep < 1) return;
+	if (ima->yrep < 1) return;
 	
 	glPixelZoom(zoomx, zoomy);
 
-	if(sima->curtile >= ima->xrep*ima->yrep) 
-		sima->curtile = ima->xrep*ima->yrep - 1; 
+	if (sima->curtile >= ima->xrep * ima->yrep)
+		sima->curtile = ima->xrep * ima->yrep - 1;
 	
 	/* create char buffer from float if needed */
 	image_verify_buffer_float(ima, ibuf, color_manage);
 
 	/* retrieve part of image buffer */
-	dx= ibuf->x/ima->xrep;
-	dy= ibuf->y/ima->yrep;
-	sx= (sima->curtile % ima->xrep)*dx;
-	sy= (sima->curtile / ima->xrep)*dy;
-	rect= get_part_from_ibuf(ibuf, sx, sy, sx+dx, sy+dy);
+	dx = ibuf->x / ima->xrep;
+	dy = ibuf->y / ima->yrep;
+	sx = (sima->curtile % ima->xrep) * dx;
+	sy = (sima->curtile / ima->xrep) * dy;
+	rect = get_part_from_ibuf(ibuf, sx, sy, sx + dx, sy + dy);
 	
 	/* draw repeated */
-	for(sy=0; sy+dy<=ibuf->y; sy+= dy) {
-		for(sx=0; sx+dx<=ibuf->x; sx+= dx) {
-			UI_view2d_to_region_no_clip(&ar->v2d, fx + (float)sx/(float)ibuf->x, fy + (float)sy/(float)ibuf->y, &x, &y);
+	for (sy = 0; sy + dy <= ibuf->y; sy += dy) {
+		for (sx = 0; sx + dx <= ibuf->x; sx += dx) {
+			UI_view2d_to_region_no_clip(&ar->v2d, fx + (float)sx / (float)ibuf->x, fy + (float)sy / (float)ibuf->y, &x, &y);
 
 			glaDrawPixelsSafe(x, y, dx, dy, dx, GL_RGBA, GL_UNSIGNED_BYTE, rect);
 		}
@@ -605,25 +592,25 @@ static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Scene *scene,
 
 static void draw_image_buffer_repeated(SpaceImage *sima, ARegion *ar, Scene *scene, Image *ima, ImBuf *ibuf, float zoomx, float zoomy)
 {
-	const double time_current= PIL_check_seconds_timer();
+	const double time_current = PIL_check_seconds_timer();
 
-	const int xmax= ceil(ar->v2d.cur.xmax);
-	const int ymax= ceil(ar->v2d.cur.ymax);
-	const int xmin= floor(ar->v2d.cur.xmin);
-	const int ymin= floor(ar->v2d.cur.ymin);
+	const int xmax = ceil(ar->v2d.cur.xmax);
+	const int ymax = ceil(ar->v2d.cur.ymax);
+	const int xmin = floor(ar->v2d.cur.xmin);
+	const int ymin = floor(ar->v2d.cur.ymin);
 
 	int x;
 
-	for(x=xmin; x<xmax; x++) {
+	for (x = xmin; x < xmax; x++) {
 		int y;
-		for(y=ymin; y<ymax; y++) { 
-			if(ima && (ima->tpageflag & IMA_TILES))
+		for (y = ymin; y < ymax; y++) {
+			if (ima && (ima->tpageflag & IMA_TILES))
 				draw_image_buffer_tiled(sima, ar, scene, ima, ibuf, x, y, zoomx, zoomy);
 			else
 				draw_image_buffer(sima, ar, scene, ima, ibuf, x, y, zoomx, zoomy);
 
 			/* only draw until running out of time */
-			if((PIL_check_seconds_timer() - time_current) > 0.25)
+			if ((PIL_check_seconds_timer() - time_current) > 0.25)
 				return;
 		}
 	}
@@ -637,13 +624,13 @@ void draw_image_grease_pencil(bContext *C, short onlyv2d)
 	/* draw in View2D space? */
 	if (onlyv2d) {
 		/* assume that UI_view2d_ortho(C) has been called... */
-		SpaceImage *sima= (SpaceImage *)CTX_wm_space_data(C);
+		SpaceImage *sima = (SpaceImage *)CTX_wm_space_data(C);
 		void *lock;
-		ImBuf *ibuf= ED_space_image_acquire_buffer(sima, &lock);
+		ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock);
 		
 		/* draw grease-pencil ('image' strokes) */
 		//if (sima->flag & SI_DISPGP)
-			draw_gpencil_2dimage(C, ibuf);
+		draw_gpencil_2dimage(C, ibuf);
 
 		ED_space_image_release_buffer(sima, lock);
 	}
@@ -653,7 +640,7 @@ void draw_image_grease_pencil(bContext *C, short onlyv2d)
 		
 		/* draw grease-pencil ('screen' strokes) */
 		//if (sima->flag & SI_DISPGP)
-			draw_gpencil_view2d(C, 0);
+		draw_gpencil_view2d(C, 0);
 	}
 }
 
@@ -661,24 +648,24 @@ void draw_image_grease_pencil(bContext *C, short onlyv2d)
 #if 0
 static void draw_image_view_tool(Scene *scene)
 {
-	ToolSettings *settings= scene->toolsettings;
-	Brush *brush= settings->imapaint.brush;
+	ToolSettings *settings = scene->toolsettings;
+	Brush *brush = settings->imapaint.brush;
 	int mval[2];
 	float radius;
-	int draw= 0;
+	int draw = 0;
 
-	if(brush) {
-		if(settings->imapaint.flag & IMAGEPAINT_DRAWING) {
-			if(settings->imapaint.flag & IMAGEPAINT_DRAW_TOOL_DRAWING)
-				draw= 1;
+	if (brush) {
+		if (settings->imapaint.flag & IMAGEPAINT_DRAWING) {
+			if (settings->imapaint.flag & IMAGEPAINT_DRAW_TOOL_DRAWING)
+				draw = 1;
 		}
-		else if(settings->imapaint.flag & IMAGEPAINT_DRAW_TOOL)
-			draw= 1;
+		else if (settings->imapaint.flag & IMAGEPAINT_DRAW_TOOL)
+			draw = 1;
 		
-		if(draw) {
+		if (draw) {
 			getmouseco_areawin(mval);
 
-			radius= brush_size(brush)*G.sima->zoom;
+			radius = brush_size(brush) * G.sima->zoom;
 			fdrawXORcirc(mval[0], mval[1], radius);
 
 			if (brush->innerradius != 1.0) {
@@ -697,27 +684,27 @@ static unsigned char *get_alpha_clone_image(Scene *scene, int *width, int *heigh
 	unsigned int size, alpha;
 	unsigned char *rect, *cp;
 
-	if(!brush || !brush->clone.image)
+	if (!brush || !brush->clone.image)
 		return NULL;
 	
-	ibuf= BKE_image_get_ibuf(brush->clone.image, NULL);
+	ibuf = BKE_image_get_ibuf(brush->clone.image, NULL);
 
-	if(!ibuf || !ibuf->rect)
+	if (!ibuf || !ibuf->rect)
 		return NULL;
 
-	rect= MEM_dupallocN(ibuf->rect);
-	if(!rect)
+	rect = MEM_dupallocN(ibuf->rect);
+	if (!rect)
 		return NULL;
 
-	*width= ibuf->x;
-	*height= ibuf->y;
+	*width = ibuf->x;
+	*height = ibuf->y;
 
-	size= (*width)*(*height);
-	alpha= (unsigned char)255*brush->clone.alpha;
-	cp= rect;
+	size = (*width) * (*height);
+	alpha = (unsigned char)255 * brush->clone.alpha;
+	cp = rect;
 
-	while(size-- > 0) {
-		cp[3]= alpha;
+	while (size-- > 0) {
+		cp[3] = alpha;
 		cp += 4;
 	}
 
@@ -730,14 +717,14 @@ static void draw_image_paint_helpers(ARegion *ar, Scene *scene, float zoomx, flo
 	int x, y, w, h;
 	unsigned char *clonerect;
 
-	brush= paint_brush(&scene->toolsettings->imapaint.paint);
+	brush = paint_brush(&scene->toolsettings->imapaint.paint);
 
-	if(brush && (brush->imagepaint_tool == PAINT_TOOL_CLONE)) {
+	if (brush && (brush->imagepaint_tool == PAINT_TOOL_CLONE)) {
 		/* this is not very efficient, but glDrawPixels doesn't allow
-		   drawing with alpha */
-		clonerect= get_alpha_clone_image(scene, &w, &h);
+		 * drawing with alpha */
+		clonerect = get_alpha_clone_image(scene, &w, &h);
 
-		if(clonerect) {
+		if (clonerect) {
 			UI_view2d_to_region_no_clip(&ar->v2d, brush->clone.offset[0], brush->clone.offset[1], &x, &y);
 
 			glPixelZoom(zoomx, zoomy);
@@ -768,54 +755,54 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene)
 #if 0
 	what_image(sima);
 	
-	if(sima->image) {
+	if (sima->image) {
 		ED_image_aspect(sima->image, &xuser_asp, &yuser_asp);
 		
 		/* UGLY hack? until now iusers worked fine... but for flipbook viewer we need this */
-		if(sima->image->type==IMA_TYPE_COMPOSITE) {
-			ImageUser *iuser= ntree_get_active_iuser(scene->nodetree);
-			if(iuser) {
+		if (sima->image->type == IMA_TYPE_COMPOSITE) {
+			ImageUser *iuser = ntree_get_active_iuser(scene->nodetree);
+			if (iuser) {
 				BKE_image_user_calc_imanr(iuser, scene->r.cfra, 0);
-				sima->iuser= *iuser;
+				sima->iuser = *iuser;
 			}
 		}
 		/* and we check for spare */
-		ibuf= ED_space_image_buffer(sima);
+		ibuf = ED_space_image_buffer(sima);
 	}
 #endif
 
 	/* retrieve the image and information about it */
-	ima= ED_space_image(sima);
+	ima = ED_space_image(sima);
 	ED_space_image_zoom(sima, ar, &zoomx, &zoomy);
-	ibuf= ED_space_image_acquire_buffer(sima, &lock);
+	ibuf = ED_space_image_acquire_buffer(sima, &lock);
 
-	show_viewer= (ima && ima->source == IMA_SRC_VIEWER);
-	show_render= (show_viewer && ima->type == IMA_TYPE_R_RESULT);
+	show_viewer = (ima && ima->source == IMA_SRC_VIEWER);
+	show_render = (show_viewer && ima->type == IMA_TYPE_R_RESULT);
 
 	/* draw the image or grid */
-	if(ibuf==NULL)
+	if (ibuf == NULL)
 		draw_image_grid(ar, zoomx, zoomy);
-	else if(sima->flag & SI_DRAW_TILE)
+	else if (sima->flag & SI_DRAW_TILE)
 		draw_image_buffer_repeated(sima, ar, scene, ima, ibuf, zoomx, zoomy);
-	else if(ima && (ima->tpageflag & IMA_TILES))
+	else if (ima && (ima->tpageflag & IMA_TILES))
 		draw_image_buffer_tiled(sima, ar, scene, ima, ibuf, 0.0f, 0.0, zoomx, zoomy);
 	else
 		draw_image_buffer(sima, ar, scene, ima, ibuf, 0.0f, 0.0f, zoomx, zoomy);
 
 	/* paint helpers */
-	if(sima->flag & SI_DRAWTOOL)
+	if (sima->flag & SI_DRAWTOOL)
 		draw_image_paint_helpers(ar, scene, zoomx, zoomy);
 
 
 	/* XXX integrate this code */
 #if 0
-	if(ibuf) {
-		float xoffs=0.0f, yoffs= 0.0f;
+	if (ibuf) {
+		float xoffs = 0.0f, yoffs = 0.0f;
 		
-		if(image_preview_active(sa, &xim, &yim)) {
-			xoffs= scene->r.disprect.xmin;
-			yoffs= scene->r.disprect.ymin;
-			glColor3ub(0,0,0);
+		if (image_preview_active(sa, &xim, &yim)) {
+			xoffs = scene->r.disprect.xmin;
+			yoffs = scene->r.disprect.ymin;
+			glColor3ub(0, 0, 0);
 			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);
@@ -827,7 +814,7 @@ void draw_image_main(SpaceImage *sima, ARegion *ar, Scene *scene)
 	ED_space_image_release_buffer(sima, lock);
 
 	/* render info */
-	if(ima && show_render)
+	if (ima && show_render)
 		draw_render_info(scene, ima, ar);
 }
 
diff --git a/source/blender/editors/space_image/image_intern.h b/source/blender/editors/space_image/image_intern.h
index 29673f7..ca3f543 100644
--- a/source/blender/editors/space_image/image_intern.h
+++ b/source/blender/editors/space_image/image_intern.h
@@ -29,8 +29,8 @@
  */
 
 
-#ifndef ED_IMAGE_INTERN_H
-#define ED_IMAGE_INTERN_H
+#ifndef __IMAGE_INTERN_H__
+#define __IMAGE_INTERN_H__
 
 /* internal exports only */
 struct bContext;
@@ -51,8 +51,6 @@ struct ARegion *image_has_scope_region(struct ScrArea *sa);
 
 extern const char *image_context_dir[]; /* doc access */
 
-void IMAGE_OT_toolbox(struct wmOperatorType *ot);
-
 /* image_draw.c */
 void draw_image_main(struct SpaceImage *sima, struct ARegion *ar, struct Scene *scene);
 void draw_image_grease_pencil(struct bContext *C, short onlyv2d);
@@ -95,5 +93,5 @@ void image_buttons_register(struct ARegionType *art);
 void IMAGE_OT_properties(struct wmOperatorType *ot);
 void IMAGE_OT_scopes(struct wmOperatorType *ot);
 
-#endif /* ED_IMAGE_INTERN_H */
+#endif /* __IMAGE_INTERN_H__ */
 
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index e1fe378..2c68899 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -82,33 +82,45 @@
 
 /******************** view navigation utilities *********************/
 
-static void sima_zoom_set(SpaceImage *sima, ARegion *ar, float zoom)
+static void sima_zoom_set(SpaceImage *sima, ARegion *ar, float zoom, float location[2])
 {
-	float oldzoom= sima->zoom;
+	float oldzoom = sima->zoom;
 	int width, height;
 
-	sima->zoom= zoom;
+	sima->zoom = zoom;
 
-	if (sima->zoom > 0.1f && sima->zoom < 4.0f)
-		return;
+	if (sima->zoom < 0.1f || sima->zoom > 4.0f) {
+		/* check zoom limits */
+		ED_space_image_size(sima, &width, &height);
 
-	/* check zoom limits */
-	ED_space_image_size(sima, &width, &height);
+		width *= sima->zoom;
+		height *= sima->zoom;
+
+		if ((width < 4) && (height < 4))
+			sima->zoom = oldzoom;
+		else if ((ar->winrct.xmax - ar->winrct.xmin) <= sima->zoom)
+			sima->zoom = oldzoom;
+		else if ((ar->winrct.ymax - ar->winrct.ymin) <= sima->zoom)
+			sima->zoom = oldzoom;
+	}
+
+	if ((U.uiflag & USER_ZOOM_TO_MOUSEPOS) && location) {
+		float aspx, aspy, w, h;
+
+		ED_space_image_size(sima, &width, &height);
+		ED_space_image_aspect(sima, &aspx, &aspy);
 
-	width *= sima->zoom;
-	height *= sima->zoom;
+		w = width * aspx;
+		h = height * aspy;
 
-	if((width < 4) && (height < 4))
-		sima->zoom= oldzoom;
-	else if((ar->winrct.xmax - ar->winrct.xmin) <= sima->zoom)
-		sima->zoom= oldzoom;
-	else if((ar->winrct.ymax - ar->winrct.ymin) <= sima->zoom)
-		sima->zoom= oldzoom;
+		sima->xof += ((location[0] - 0.5f) * w - sima->xof) * (sima->zoom - oldzoom) / sima->zoom;
+		sima->yof += ((location[1] - 0.5f) * h - sima->yof) * (sima->zoom - oldzoom) / sima->zoom;
+	}
 }
 
-static void sima_zoom_set_factor(SpaceImage *sima, ARegion *ar, float zoomfac)
+static void sima_zoom_set_factor(SpaceImage *sima, ARegion *ar, float zoomfac, float location[2])
 {
-	sima_zoom_set(sima, ar, sima->zoom*zoomfac);
+	sima_zoom_set(sima, ar, sima->zoom * zoomfac, location);
 }
 
 #if 0 // currently unused
@@ -120,36 +132,36 @@ static int image_poll(bContext *C)
 
 static int space_image_buffer_exists_poll(bContext *C)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	if(sima && sima->spacetype==SPACE_IMAGE)
-		if(ED_space_image_has_buffer(sima))
+	SpaceImage *sima = CTX_wm_space_image(C);
+	if (sima && sima->spacetype == SPACE_IMAGE)
+		if (ED_space_image_has_buffer(sima))
 			return 1;
 	return 0;
 }
 
 static int space_image_file_exists_poll(bContext *C)
 {
-	if(space_image_buffer_exists_poll(C)) {
-		Main *bmain= CTX_data_main(C);
-		SpaceImage *sima= CTX_wm_space_image(C);
+	if (space_image_buffer_exists_poll(C)) {
+		Main *bmain = CTX_data_main(C);
+		SpaceImage *sima = CTX_wm_space_image(C);
 		ImBuf *ibuf;
 		void *lock;
-		int ret= FALSE;
+		int ret = FALSE;
 		char name[FILE_MAX];
 
-		ibuf= ED_space_image_acquire_buffer(sima, &lock);
-		if(ibuf) {
+		ibuf = ED_space_image_acquire_buffer(sima, &lock);
+		if (ibuf) {
 			BLI_strncpy(name, ibuf->name, FILE_MAX);
 			BLI_path_abs(name, bmain->name);
 
-			if(BLI_exists(name) == FALSE) {
+			if (BLI_exists(name) == FALSE) {
 				CTX_wm_operator_poll_msg_set(C, "image file not found");
 			}
 			else if (BLI_file_is_writable(name) == FALSE) {
 				CTX_wm_operator_poll_msg_set(C, "image path can't be written to");
 			}
 			else {
-				ret= TRUE;
+				ret = TRUE;
 			}
 		}
 		ED_space_image_release_buffer(sima, lock);
@@ -161,19 +173,19 @@ static int space_image_file_exists_poll(bContext *C)
 
 static int space_image_poll(bContext *C)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	if(sima && sima->spacetype==SPACE_IMAGE && sima->image)
+	SpaceImage *sima = CTX_wm_space_image(C);
+	if (sima && sima->spacetype == SPACE_IMAGE && sima->image)
 		return 1;
 	return 0;
 }
 
 int space_image_main_area_poll(bContext *C)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
 	// XXX ARegion *ar= CTX_wm_region(C);
 
-	if(sima)
-		return 1; // XXX (ar && ar->type->regionid == RGN_TYPE_WINDOW);
+	if (sima)
+		return 1;  // XXX (ar && ar->type->regionid == RGN_TYPE_WINDOW);
 	
 	return 0;
 }
@@ -181,10 +193,10 @@ int space_image_main_area_poll(bContext *C)
 /* For IMAGE_OT_curves_point_set to avoid sampling when in uv smooth mode */
 int space_image_main_area_not_uv_brush_poll(bContext *C)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
 
 	ToolSettings *toolsettings = CTX_data_scene(C)->toolsettings;
-	if(sima && !toolsettings->uvsculpt)
+	if (sima && !toolsettings->uvsculpt)
 		return 1;
 
 	return 0;
@@ -192,12 +204,12 @@ int space_image_main_area_not_uv_brush_poll(bContext *C)
 
 static int space_image_image_sample_poll(bContext *C)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	Object *obedit= CTX_data_edit_object(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
+	Object *obedit = CTX_data_edit_object(C);
 	ToolSettings *toolsettings = CTX_data_scene(C)->toolsettings;
 
-	if(obedit){
-		if(ED_space_image_show_uvedit(sima, obedit) && (toolsettings->use_uv_sculpt))
+	if (obedit) {
+		if (ED_space_image_show_uvedit(sima, obedit) && (toolsettings->use_uv_sculpt))
 			return 0;
 	}
 	return space_image_main_area_poll(C);
@@ -212,29 +224,29 @@ typedef struct ViewPanData {
 
 static void image_view_pan_init(bContext *C, wmOperator *op, wmEvent *event)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
 	ViewPanData *vpd;
 
-	op->customdata= vpd= MEM_callocN(sizeof(ViewPanData), "ImageViewPanData");
+	op->customdata = vpd = MEM_callocN(sizeof(ViewPanData), "ImageViewPanData");
 	WM_cursor_modal(CTX_wm_window(C), BC_NSEW_SCROLLCURSOR);
 
-	vpd->x= event->x;
-	vpd->y= event->y;
-	vpd->xof= sima->xof;
-	vpd->yof= sima->yof;
-	vpd->event_type= event->type;
+	vpd->x = event->x;
+	vpd->y = event->y;
+	vpd->xof = sima->xof;
+	vpd->yof = sima->yof;
+	vpd->event_type = event->type;
 
 	WM_event_add_modal_handler(C, op);
 }
 
 static void image_view_pan_exit(bContext *C, wmOperator *op, int cancel)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	ViewPanData *vpd= op->customdata;
+	SpaceImage *sima = CTX_wm_space_image(C);
+	ViewPanData *vpd = op->customdata;
 
-	if(cancel) {
-		sima->xof= vpd->xof;
-		sima->yof= vpd->yof;
+	if (cancel) {
+		sima->xof = vpd->xof;
+		sima->yof = vpd->yof;
 		ED_region_tag_redraw(CTX_wm_region(C));
 	}
 
@@ -244,7 +256,7 @@ static void image_view_pan_exit(bContext *C, wmOperator *op, int cancel)
 
 static int image_view_pan_exec(bContext *C, wmOperator *op)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
 	float offset[2];
 
 	RNA_float_get_array(op->ptr, "offset", offset);
@@ -255,7 +267,7 @@ static int image_view_pan_exec(bContext *C, wmOperator *op)
 
 	/* XXX notifier? */
 #if 0
-	if(image_preview_active(curarea, NULL, NULL)) {
+	if (image_preview_active(curarea, NULL, NULL)) {
 		/* recalculates new preview rect */
 		scrarea_do_windraw(curarea);
 		image_preview_event(2);
@@ -268,11 +280,11 @@ static int image_view_pan_exec(bContext *C, wmOperator *op)
 static int image_view_pan_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 	if (event->type == MOUSEPAN) {
-		SpaceImage *sima= CTX_wm_space_image(C);
+		SpaceImage *sima = CTX_wm_space_image(C);
 		float offset[2];
 		
-		offset[0]= (event->x - event->prevx)/sima->zoom;
-		offset[1]= (event->y - event->prevy)/sima->zoom;
+		offset[0] = (event->x - event->prevx) / sima->zoom;
+		offset[1] = (event->y - event->prevy) / sima->zoom;
 		RNA_float_set_array(op->ptr, "offset", offset);
 
 		image_view_pan_exec(C, op);
@@ -286,21 +298,21 @@ static int image_view_pan_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 static int image_view_pan_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	ViewPanData *vpd= op->customdata;
+	SpaceImage *sima = CTX_wm_space_image(C);
+	ViewPanData *vpd = op->customdata;
 	float offset[2];
 
-	switch(event->type) {
+	switch (event->type) {
 		case MOUSEMOVE:
-			sima->xof= vpd->xof;
-			sima->yof= vpd->yof;
-			offset[0]= (vpd->x - event->x)/sima->zoom;
-			offset[1]= (vpd->y - event->y)/sima->zoom;
+			sima->xof = vpd->xof;
+			sima->yof = vpd->yof;
+			offset[0] = (vpd->x - event->x) / sima->zoom;
+			offset[1] = (vpd->y - event->y) / sima->zoom;
 			RNA_float_set_array(op->ptr, "offset", offset);
 			image_view_pan_exec(C, op);
 			break;
 		default:
-			if(event->type==vpd->event_type &&  event->val==KM_RELEASE) {
+			if (event->type == vpd->event_type &&  event->val == KM_RELEASE) {
 				image_view_pan_exit(C, op, 0);
 				return OPERATOR_FINISHED;
 			}
@@ -319,22 +331,22 @@ static int image_view_pan_cancel(bContext *C, wmOperator *op)
 void IMAGE_OT_view_pan(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View Pan";
-	ot->idname= "IMAGE_OT_view_pan";
+	ot->name = "View Pan";
+	ot->idname = "IMAGE_OT_view_pan";
 	
 	/* api callbacks */
-	ot->exec= image_view_pan_exec;
-	ot->invoke= image_view_pan_invoke;
-	ot->modal= image_view_pan_modal;
-	ot->cancel= image_view_pan_cancel;
-	ot->poll= space_image_main_area_poll;
+	ot->exec = image_view_pan_exec;
+	ot->invoke = image_view_pan_invoke;
+	ot->modal = image_view_pan_modal;
+	ot->cancel = image_view_pan_cancel;
+	ot->poll = space_image_main_area_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_POINTER;
 	
 	/* properties */
 	RNA_def_float_vector(ot->srna, "offset", 2, NULL, -FLT_MAX, FLT_MAX,
-		"Offset", "Offset in floating point units, 1.0 is the width and height of the image", -FLT_MAX, FLT_MAX);
+	                     "Offset", "Offset in floating point units, 1.0 is the width and height of the image", -FLT_MAX, FLT_MAX);
 }
 
 /********************** view zoom operator *********************/
@@ -343,31 +355,35 @@ typedef struct ViewZoomData {
 	float x, y;
 	float zoom;
 	int event_type;
+	float location[2];
 } ViewZoomData;
 
 static void image_view_zoom_init(bContext *C, wmOperator *op, wmEvent *event)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
+	ARegion *ar = CTX_wm_region(C);
 	ViewZoomData *vpd;
 
-	op->customdata= vpd= MEM_callocN(sizeof(ViewZoomData), "ImageViewZoomData");
+	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->zoom= sima->zoom;
-	vpd->event_type= event->type;
-	
+	vpd->x = event->x;
+	vpd->y = 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]);
+
 	WM_event_add_modal_handler(C, op);
 }
 
 static void image_view_zoom_exit(bContext *C, wmOperator *op, int cancel)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	ViewZoomData *vpd= op->customdata;
+	SpaceImage *sima = CTX_wm_space_image(C);
+	ViewZoomData *vpd = op->customdata;
 
-	if(cancel) {
-		sima->zoom= vpd->zoom;
+	if (cancel) {
+		sima->zoom = vpd->zoom;
 		ED_region_tag_redraw(CTX_wm_region(C));
 	}
 
@@ -377,16 +393,16 @@ static void image_view_zoom_exit(bContext *C, wmOperator *op, int cancel)
 
 static int image_view_zoom_exec(bContext *C, wmOperator *op)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	ARegion *ar= CTX_wm_region(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
+	ARegion *ar = CTX_wm_region(C);
 
-	sima_zoom_set_factor(sima, ar, RNA_float_get(op->ptr, "factor"));
+	sima_zoom_set_factor(sima, ar, RNA_float_get(op->ptr, "factor"), NULL);
 
 	ED_region_tag_redraw(CTX_wm_region(C));
 
 	/* XXX notifier? */
 #if 0
-	if(image_preview_active(curarea, NULL, NULL)) {
+	if (image_preview_active(curarea, NULL, NULL)) {
 		/* recalculates new preview rect */
 		scrarea_do_windraw(curarea);
 		image_preview_event(2);
@@ -399,13 +415,15 @@ static int image_view_zoom_exec(bContext *C, wmOperator *op)
 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;
-		
-		factor= 1.0f + (event->x-event->prevx+event->y-event->prevy)/300.0f;
+		SpaceImage *sima = CTX_wm_space_image(C);
+		ARegion *ar = CTX_wm_region(C);
+		float 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;
 		RNA_float_set(op->ptr, "factor", factor);
-		sima_zoom_set(sima, ar, sima->zoom*factor);
+		sima_zoom_set(sima, ar, sima->zoom * factor, location);
 		ED_region_tag_redraw(CTX_wm_region(C));
 		
 		return OPERATOR_FINISHED;
@@ -418,20 +436,20 @@ static int image_view_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 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;
+	SpaceImage *sima = CTX_wm_space_image(C);
+	ARegion *ar = CTX_wm_region(C);
+	ViewZoomData *vpd = op->customdata;
 	float factor;
 
-	switch(event->type) {
+	switch (event->type) {
 		case MOUSEMOVE:
-			factor= 1.0f + (vpd->x-event->x+vpd->y-event->y)/300.0f;
+			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);
+			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) {
+			if (event->type == vpd->event_type && event->val == KM_RELEASE) {
 				image_view_zoom_exit(C, op, 0);
 				return OPERATOR_FINISHED;
 			}
@@ -450,22 +468,22 @@ static int image_view_zoom_cancel(bContext *C, wmOperator *op)
 void IMAGE_OT_view_zoom(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View Zoom";
-	ot->idname= "IMAGE_OT_view_zoom";
+	ot->name = "View Zoom";
+	ot->idname = "IMAGE_OT_view_zoom";
 	
 	/* api callbacks */
-	ot->exec= image_view_zoom_exec;
-	ot->invoke= image_view_zoom_invoke;
-	ot->modal= image_view_zoom_modal;
-	ot->cancel= image_view_zoom_cancel;
-	ot->poll= space_image_main_area_poll;
+	ot->exec = image_view_zoom_exec;
+	ot->invoke = image_view_zoom_invoke;
+	ot->modal = image_view_zoom_modal;
+	ot->cancel = image_view_zoom_cancel;
+	ot->poll = space_image_main_area_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_BLOCKING;
 	
 	/* properties */
 	RNA_def_float(ot->srna, "factor", 0.0f, 0.0f, FLT_MAX,
-		"Factor", "Zoom factor, values higher than 1.0 zoom in, lower values zoom out", -FLT_MAX, FLT_MAX);
+	              "Factor", "Zoom factor, values higher than 1.0 zoom in, lower values zoom out", -FLT_MAX, FLT_MAX);
 }
 
 /********************** NDOF operator *********************/
@@ -481,10 +499,10 @@ static int image_view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *
 	if (event->type != NDOF_MOTION)
 		return OPERATOR_CANCELLED;
 	else {
-		SpaceImage *sima= CTX_wm_space_image(C);
-		ARegion *ar= CTX_wm_region(C);
+		SpaceImage *sima = CTX_wm_space_image(C);
+		ARegion *ar = CTX_wm_region(C);
 
-		wmNDOFMotionData* ndof = (wmNDOFMotionData*) event->customdata;
+		wmNDOFMotionData *ndof = (wmNDOFMotionData *) event->customdata;
 
 		float dt = ndof->dt;
 		/* tune these until it feels right */
@@ -505,7 +523,7 @@ static int image_view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *
 		if (U.ndof_flag & NDOF_ZOOM_INVERT)
 			zoom_factor = -zoom_factor;
 
-		sima_zoom_set_factor(sima, ar, zoom_factor);
+		sima_zoom_set_factor(sima, ar, zoom_factor, NULL);
 		sima->xof += pan_x;
 		sima->yof += pan_y;
 
@@ -518,11 +536,11 @@ static int image_view_ndof_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *
 void IMAGE_OT_view_ndof(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "NDOF Pan/Zoom";
-	ot->idname= "IMAGE_OT_view_ndof";
+	ot->name = "NDOF Pan/Zoom";
+	ot->idname = "IMAGE_OT_view_ndof";
 	
 	/* api callbacks */
-	ot->invoke= image_view_ndof_invoke;
+	ot->invoke = image_view_ndof_invoke;
 }
 
 /********************** view all operator *********************/
@@ -539,29 +557,29 @@ static int image_view_all_exec(bContext *C, wmOperator *UNUSED(op))
 	int width, height;
 
 	/* retrieve state */
-	sima= CTX_wm_space_image(C);
-	ar= CTX_wm_region(C);
+	sima = CTX_wm_space_image(C);
+	ar = CTX_wm_region(C);
 
 	ED_space_image_size(sima, &width, &height);
 	ED_space_image_aspect(sima, &aspx, &aspy);
 
-	w= width*aspx;
-	h= height*aspy;
+	w = width * aspx;
+	h = height * aspy;
 	
 	/* check if the image will fit in the image with zoom==1 */
 	width = ar->winrct.xmax - ar->winrct.xmin + 1;
 	height = ar->winrct.ymax - ar->winrct.ymin + 1;
 
-	if((w >= width || h >= height) && (width > 0 && height > 0)) {
+	if ((w >= width || h >= height) && (width > 0 && height > 0)) {
 		/* 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/MIN2(zoomx, zoomy)));
+		zoomx = width / w;
+		zoomy = height / h;
+		sima_zoom_set(sima, ar, 1.0f / power_of_2(1 / MIN2(zoomx, zoomy)), NULL);
 	}
 	else
-		sima_zoom_set(sima, ar, 1.0f);
+		sima_zoom_set(sima, ar, 1.0f, NULL);
 
-	sima->xof= sima->yof= 0.0f;
+	sima->xof = sima->yof = 0.0f;
 
 	ED_region_tag_redraw(CTX_wm_region(C));
 	
@@ -571,12 +589,12 @@ static int image_view_all_exec(bContext *C, wmOperator *UNUSED(op))
 void IMAGE_OT_view_all(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View All";
-	ot->idname= "IMAGE_OT_view_all";
+	ot->name = "View All";
+	ot->idname = "IMAGE_OT_view_all";
 	
 	/* api callbacks */
-	ot->exec= image_view_all_exec;
-	ot->poll= space_image_main_area_poll;
+	ot->exec = image_view_all_exec;
+	ot->poll = space_image_main_area_poll;
 }
 
 /********************** view selected operator *********************/
@@ -592,32 +610,32 @@ static int image_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
 	int width, height;
 
 	/* retrieve state */
-	sima= CTX_wm_space_image(C);
-	ar= CTX_wm_region(C);
-	scene= CTX_data_scene(C);
-	obedit= CTX_data_edit_object(C);
+	sima = CTX_wm_space_image(C);
+	ar = CTX_wm_region(C);
+	scene = CTX_data_scene(C);
+	obedit = CTX_data_edit_object(C);
 
-	ima= ED_space_image(sima);
+	ima = ED_space_image(sima);
 	ED_space_image_size(sima, &width, &height);
 	ED_image_aspect(ima, &aspx, &aspy);
 
-	width= width*aspx;
-	height= height*aspy;
+	width = width * aspx;
+	height = height * aspy;
 
 	/* get bounds */
-	if(!ED_uvedit_minmax(scene, ima, obedit, min, max))
+	if (!ED_uvedit_minmax(scene, ima, obedit, min, max))
 		return OPERATOR_CANCELLED;
 
 	/* adjust offset and zoom */
-	sima->xof= (int)(((min[0] + max[0])*0.5f - 0.5f)*width);
-	sima->yof= (int)(((min[1] + max[1])*0.5f - 0.5f)*height);
+	sima->xof = (int)(((min[0] + max[0]) * 0.5f - 0.5f) * width);
+	sima->yof = (int)(((min[1] + max[1]) * 0.5f - 0.5f) * height);
 
-	d[0]= max[0] - min[0];
-	d[1]= max[1] - min[1];
-	size= 0.5f*MAX2(d[0], d[1])*MAX2(width, height)/256.0f;
+	d[0] = max[0] - min[0];
+	d[1] = max[1] - min[1];
+	size = 0.5f * MAX2(d[0], d[1]) * MAX2(width, height) / 256.0f;
 	
-	if(size<=0.01f) size= 0.01f;
-	sima_zoom_set(sima, ar, 0.7f/size);
+	if (size <= 0.01f) size = 0.01f;
+	sima_zoom_set(sima, ar, 0.7f / size, NULL);
 
 	ED_region_tag_redraw(CTX_wm_region(C));
 	
@@ -632,78 +650,114 @@ static int image_view_selected_poll(bContext *C)
 void IMAGE_OT_view_selected(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View Center";
-	ot->idname= "IMAGE_OT_view_selected";
+	ot->name = "View Center";
+	ot->idname = "IMAGE_OT_view_selected";
 	
 	/* api callbacks */
-	ot->exec= image_view_selected_exec;
-	ot->poll= image_view_selected_poll;
+	ot->exec = image_view_selected_exec;
+	ot->poll = image_view_selected_poll;
 }
 
 /********************** view zoom in/out operator *********************/
 
-static int image_view_zoom_in_exec(bContext *C, wmOperator *UNUSED(op))
+static int image_view_zoom_in_exec(bContext *C, wmOperator *op)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	ARegion *ar= CTX_wm_region(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
+	ARegion *ar = CTX_wm_region(C);
+	float location[2];
+
+	RNA_float_get_array(op->ptr, "location", location);
 
-	sima_zoom_set_factor(sima, ar, 1.25f);
+	sima_zoom_set_factor(sima, ar, 1.25f, location);
 
 	ED_region_tag_redraw(CTX_wm_region(C));
 	
 	return OPERATOR_FINISHED;
 }
 
+static int image_view_zoom_in_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+	ARegion *ar = CTX_wm_region(C);
+	float location[2];
+
+	UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &location[0], &location[1]);
+	RNA_float_set_array(op->ptr, "location", location);
+
+	return image_view_zoom_in_exec(C, op);
+}
+
 void IMAGE_OT_view_zoom_in(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View Zoom In";
-	ot->idname= "IMAGE_OT_view_zoom_in";
+	ot->name = "View Zoom In";
+	ot->idname = "IMAGE_OT_view_zoom_in";
 	
 	/* api callbacks */
-	ot->exec= image_view_zoom_in_exec;
-	ot->poll= space_image_main_area_poll;
+	ot->invoke = image_view_zoom_in_invoke;
+	ot->exec = image_view_zoom_in_exec;
+	ot->poll = space_image_main_area_poll;
+
+	/* properties */
+	RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in screen coordinates", -10.0f, 10.0f);
 }
 
-static int image_view_zoom_out_exec(bContext *C, wmOperator *UNUSED(op))
+static int image_view_zoom_out_exec(bContext *C, wmOperator *op)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	ARegion *ar= CTX_wm_region(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
+	ARegion *ar = CTX_wm_region(C);
+	float location[2];
 
-	sima_zoom_set_factor(sima, ar, 0.8f);
+	RNA_float_get_array(op->ptr, "location", location);
+
+	sima_zoom_set_factor(sima, ar, 0.8f, location);
 
 	ED_region_tag_redraw(CTX_wm_region(C));
 	
 	return OPERATOR_FINISHED;
 }
 
+static int image_view_zoom_out_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+	ARegion *ar = CTX_wm_region(C);
+	float location[2];
+
+	UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &location[0], &location[1]);
+	RNA_float_set_array(op->ptr, "location", location);
+
+	return image_view_zoom_out_exec(C, op);
+}
+
 void IMAGE_OT_view_zoom_out(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View Zoom Out";
-	ot->idname= "IMAGE_OT_view_zoom_out";
+	ot->name = "View Zoom Out";
+	ot->idname = "IMAGE_OT_view_zoom_out";
 	
 	/* api callbacks */
-	ot->exec= image_view_zoom_out_exec;
-	ot->poll= space_image_main_area_poll;
+	ot->invoke = image_view_zoom_out_invoke;
+	ot->exec = image_view_zoom_out_exec;
+	ot->poll = space_image_main_area_poll;
+
+	/* properties */
+	RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in screen coordinates", -10.0f, 10.0f);
 }
 
 /********************** view zoom ratio operator *********************/
 
 static int image_view_zoom_ratio_exec(bContext *C, wmOperator *op)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	ARegion *ar= CTX_wm_region(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
+	ARegion *ar = CTX_wm_region(C);
 
-	sima_zoom_set(sima, ar, RNA_float_get(op->ptr, "ratio"));
+	sima_zoom_set(sima, ar, RNA_float_get(op->ptr, "ratio"), NULL);
 	
 	/* ensure pixel exact locations for draw */
-	sima->xof= (int)sima->xof;
-	sima->yof= (int)sima->yof;
+	sima->xof = (int)sima->xof;
+	sima->yof = (int)sima->yof;
 
 	/* XXX notifier? */
 #if 0
-	if(image_preview_active(curarea, NULL, NULL)) {
+	if (image_preview_active(curarea, NULL, NULL)) {
 		/* recalculates new preview rect */
 		scrarea_do_windraw(curarea);
 		image_preview_event(2);
@@ -718,16 +772,16 @@ static int image_view_zoom_ratio_exec(bContext *C, wmOperator *op)
 void IMAGE_OT_view_zoom_ratio(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View Zoom Ratio";
-	ot->idname= "IMAGE_OT_view_zoom_ratio";
+	ot->name = "View Zoom Ratio";
+	ot->idname = "IMAGE_OT_view_zoom_ratio";
 	
 	/* api callbacks */
-	ot->exec= image_view_zoom_ratio_exec;
-	ot->poll= space_image_main_area_poll;
+	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,
-		"Ratio", "Zoom ratio, 1.0 is 1:1, higher is zoomed in, lower is zoomed out", -FLT_MAX, FLT_MAX);
+	              "Ratio", "Zoom ratio, 1.0 is 1:1, higher is zoomed in, lower is zoomed out", -FLT_MAX, FLT_MAX);
 }
 
 /**************** load/replace/save callbacks ******************/
@@ -743,48 +797,48 @@ static void image_open_init(bContext *C, wmOperator *op)
 {
 	PropertyPointerRNA *pprop;
 
-	op->customdata= pprop= MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA");
+	op->customdata = pprop = MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA");
 	uiIDContextProperty(C, &pprop->ptr, &pprop->prop);
 }
 
 static int image_open_cancel(bContext *UNUSED(C), wmOperator *op)
 {
 	MEM_freeN(op->customdata);
-	op->customdata= NULL;
+	op->customdata = NULL;
 	return OPERATOR_CANCELLED;
 }
 
 static int image_open_exec(bContext *C, wmOperator *op)
 {
-	SpaceImage *sima= CTX_wm_space_image(C); /* XXX other space types can call */
-	Scene *scene= CTX_data_scene(C);
-	Object *obedit= CTX_data_edit_object(C);
-	ImageUser *iuser= NULL;
+	SpaceImage *sima = CTX_wm_space_image(C); /* XXX other space types can call */
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit = CTX_data_edit_object(C);
+	ImageUser *iuser = NULL;
 	PropertyPointerRNA *pprop;
 	PointerRNA idptr;
-	Image *ima= NULL;
+	Image *ima = NULL;
 	char str[FILE_MAX];
 
 	RNA_string_get(op->ptr, "filepath", str);
 	/* default to frame 1 if there's no scene in context */
 
-	errno= 0;
+	errno = 0;
 
-	ima= BKE_add_image_file(str);
+	ima = BKE_add_image_file(str);
 
-	if(!ima) {
-		if(op->customdata) MEM_freeN(op->customdata);
+	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");
 		return OPERATOR_CANCELLED;
 	}
 	
-	if(!op->customdata)
+	if (!op->customdata)
 		image_open_init(C, op);
 
 	/* hook into UI */
-	pprop= op->customdata;
+	pprop = op->customdata;
 
-	if(pprop->prop) {
+	if (pprop->prop) {
 		/* when creating new ID blocks, use is already 1, but RNA
 		 * pointer se also increases user, so this compensates it */
 		ima->id.us--;
@@ -793,29 +847,29 @@ static int image_open_exec(bContext *C, wmOperator *op)
 		RNA_property_pointer_set(&pprop->ptr, pprop->prop, idptr);
 		RNA_property_update(C, &pprop->ptr, pprop->prop);
 	}
-	else if(sima) {
+	else if (sima) {
 		ED_space_image_set(sima, scene, obedit, ima);
-		iuser= &sima->iuser;
+		iuser = &sima->iuser;
 	}
 	else {
-		Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
-		if(tex && tex->type==TEX_IMAGE)
-			iuser= &tex->iuser;
+		Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
+		if (tex && tex->type == TEX_IMAGE)
+			iuser = &tex->iuser;
 		
 	}
 	
 	/* initialize because of new image */
-	if(iuser) {
-		iuser->sfra= 1;
-		iuser->offset= 0;
-		iuser->fie_ima= 2;
+	if (iuser) {
+		iuser->sfra = 1;
+		iuser->offset = 0;
+		iuser->fie_ima = 2;
 	}
 
 	/* XXX unpackImage frees image buffers */
 	ED_preview_kill_jobs(C);
 	
 	BKE_image_signal(ima, iuser, IMA_SIGNAL_RELOAD);
-	WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, ima);
+	WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ima);
 	
 	MEM_freeN(op->customdata);
 
@@ -824,24 +878,24 @@ static int image_open_exec(bContext *C, wmOperator *op)
 
 static int image_open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	SpaceImage *sima= CTX_wm_space_image(C); /* XXX other space types can call */
-	char *path=U.textudir;
-	Image *ima= NULL;
+	SpaceImage *sima = CTX_wm_space_image(C); /* XXX other space types can call */
+	char *path = U.textudir;
+	Image *ima = NULL;
 
-	if(sima) {
-		ima= sima->image;
+	if (sima) {
+		ima = sima->image;
 	}
 
-	if (ima==NULL) {
-		Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
-		if(tex && tex->type==TEX_IMAGE)
-			ima= tex->ima;
+	if (ima == NULL) {
+		Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
+		if (tex && tex->type == TEX_IMAGE)
+			ima = tex->ima;
 	}
 
-	if(ima)
-		path= ima->name;
+	if (ima)
+		path = ima->name;
 
-	if(RNA_struct_property_is_set(op->ptr, "filepath"))
+	if (RNA_struct_property_is_set(op->ptr, "filepath"))
 		return image_open_exec(C, op);
 	
 	image_open_init(C, op);
@@ -855,30 +909,30 @@ static int image_open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
 void IMAGE_OT_open(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Open Image";
-	ot->description= "Open image";
-	ot->idname= "IMAGE_OT_open";
+	ot->name = "Open Image";
+	ot->description = "Open image";
+	ot->idname = "IMAGE_OT_open";
 	
 	/* api callbacks */
-	ot->exec= image_open_exec;
-	ot->invoke= image_open_invoke;
-	ot->cancel= image_open_cancel;
+	ot->exec = image_open_exec;
+	ot->invoke = image_open_invoke;
+	ot->cancel = image_open_cancel;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* properties */
-	WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
+	WM_operator_properties_filesel(ot, FOLDERFILE | IMAGEFILE | MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
 }
 
 /******************** replace image operator ********************/
 
 static int image_replace_exec(bContext *C, wmOperator *op)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
 	char str[FILE_MAX];
 
-	if(!sima->image)
+	if (!sima->image)
 		return OPERATOR_CANCELLED;
 	
 	RNA_string_get(op->ptr, "filepath", str);
@@ -886,27 +940,32 @@ static int image_replace_exec(bContext *C, wmOperator *op)
 	/* we cant do much if the str is longer then FILE_MAX :/ */
 	BLI_strncpy(sima->image->name, str, sizeof(sima->image->name));
 
+	if (BLI_testextensie_array(str, imb_ext_movie))
+		sima->image->source = IMA_SRC_MOVIE;
+	else
+		sima->image->source = IMA_SRC_FILE;
+
 	/* XXX unpackImage frees image buffers */
 	ED_preview_kill_jobs(C);
 	
 	BKE_image_signal(sima->image, &sima->iuser, IMA_SIGNAL_RELOAD);
-	WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, sima->image);
+	WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, sima->image);
 
 	return OPERATOR_FINISHED;
 }
 
 static int image_replace_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
 
-	if(!sima->image)
+	if (!sima->image)
 		return OPERATOR_CANCELLED;
 
-	if(RNA_struct_property_is_set(op->ptr, "filepath"))
+	if (RNA_struct_property_is_set(op->ptr, "filepath"))
 		return image_replace_exec(C, op);
 
-	if(!RNA_struct_property_is_set(op->ptr, "relative_path"))
-		RNA_boolean_set(op->ptr, "relative_path", (strncmp(sima->image->name, "//", 2))==0);
+	if (!RNA_struct_property_is_set(op->ptr, "relative_path"))
+		RNA_boolean_set(op->ptr, "relative_path", (strncmp(sima->image->name, "//", 2)) == 0);
 
 	image_filesel(C, op, sima->image->name);
 
@@ -916,19 +975,19 @@ static int image_replace_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
 void IMAGE_OT_replace(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Replace Image";
-	ot->idname= "IMAGE_OT_replace";
+	ot->name = "Replace Image";
+	ot->idname = "IMAGE_OT_replace";
 	
 	/* api callbacks */
-	ot->exec= image_replace_exec;
-	ot->invoke= image_replace_invoke;
-	ot->poll= space_image_poll;
+	ot->exec = image_replace_exec;
+	ot->invoke = image_replace_invoke;
+	ot->poll = space_image_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* properties */
-	WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
+	WM_operator_properties_filesel(ot, FOLDERFILE | IMAGEFILE | MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
 }
 
 /******************** save image as operator ********************/
@@ -942,17 +1001,13 @@ typedef struct {
 
 static void save_image_options_defaults(SaveImageOptions *simopts)
 {
-	memset(&simopts->im_format, 0, sizeof(simopts->im_format));
-	simopts->im_format.planes= R_IMF_PLANES_RGB;
-	simopts->im_format.imtype= R_IMF_IMTYPE_PNG;
-	simopts->im_format.quality= 90;
-	simopts->im_format.compress= 90;
-	simopts->filepath[0]= '\0';
+	BKE_imformat_defaults(&simopts->im_format);
+	simopts->filepath[0] = '\0';
 }
 
 static char imtype_best_depth(ImBuf *ibuf, const char imtype)
 {
-	const char depth_ok= BKE_imtype_valid_depths(imtype);
+	const char depth_ok = BKE_imtype_valid_depths(imtype);
 
 	if (ibuf->rect_float) {
 		if (depth_ok & R_IMF_CHAN_DEPTH_32) return R_IMF_CHAN_DEPTH_32;
@@ -974,52 +1029,53 @@ static char imtype_best_depth(ImBuf *ibuf, const char imtype)
 static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima, Scene *scene, const short guess_path)
 {
 	void *lock;
-	ImBuf *ibuf= ED_space_image_acquire_buffer(sima, &lock);
+	ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock);
 
-	if(ibuf) {
-		Image *ima= sima->image;
-		short is_depth_set= FALSE;
+	if (ibuf) {
+		Image *ima = sima->image;
+		short is_depth_set = FALSE;
 
-		simopts->im_format.planes= ibuf->planes;
+		simopts->im_format.planes = ibuf->planes;
 
-		if(ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) {
+		if (ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) {
 			/* imtype */
-			simopts->im_format= scene->r.im_format;
-			is_depth_set= TRUE;
+			simopts->im_format = scene->r.im_format;
+			is_depth_set = TRUE;
 		}
 		else if (ima->source == IMA_SRC_GENERATED) {
-			simopts->im_format.imtype= R_IMF_IMTYPE_PNG;
+			simopts->im_format.imtype = R_IMF_IMTYPE_PNG;
 		}
 		else {
-			simopts->im_format.imtype= BKE_ftype_to_imtype(ibuf->ftype);
+			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->im_format.quality= ibuf->ftype & 0xff;
+		simopts->im_format.quality = ibuf->ftype & 0xff;
 
 		BLI_strncpy(simopts->filepath, ibuf->name, sizeof(simopts->filepath));
 
 		/* sanitize all settings */
 
-		/* unlikely but just incase */
+		/* unlikely but just in case */
 		if (ELEM3(simopts->im_format.planes, R_IMF_PLANES_BW, R_IMF_PLANES_RGB, R_IMF_PLANES_RGBA) == 0) {
-			simopts->im_format.planes= R_IMF_PLANES_RGBA;
+			simopts->im_format.planes = R_IMF_PLANES_RGBA;
 		}
 
 		/* depth, account for float buffer and format support */
 		if (is_depth_set == FALSE) {
-			simopts->im_format.depth= imtype_best_depth(ibuf, simopts->im_format.imtype);
+			simopts->im_format.depth = imtype_best_depth(ibuf, simopts->im_format.imtype);
 		}
 
-		/* some formats dont use quality so fallback to scenes quality */
+		/* some formats don't use quality so fallback to scenes quality */
 		if (simopts->im_format.quality == 0) {
-			simopts->im_format.quality= scene->r.im_format.quality;
+			simopts->im_format.quality = scene->r.im_format.quality;
 		}
 
 		/* check for empty path */
-		if(guess_path && simopts->filepath[0]==0) {
+		if (guess_path && simopts->filepath[0] == 0) {
 			if ( (G.ima[0] == '/') && (G.ima[1] == '/') && (G.ima[2] == '\0') ) {
 				BLI_strncpy(simopts->filepath, "//untitled", FILE_MAX);
-			} else {
+			}
+			else {
 				BLI_strncpy(simopts->filepath, G.ima, FILE_MAX);
 			}
 			BLI_path_abs(simopts->filepath, G.main->name);
@@ -1034,7 +1090,7 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
 static void save_image_options_from_op(SaveImageOptions *simopts, wmOperator *op)
 {
 	if (op->customdata) {
-		simopts->im_format= *(ImageFormatData *)op->customdata;
+		simopts->im_format = *(ImageFormatData *)op->customdata;
 	}
 
 	if (RNA_struct_property_is_set(op->ptr, "filepath")) {
@@ -1046,7 +1102,7 @@ static void save_image_options_from_op(SaveImageOptions *simopts, wmOperator *op
 static void save_image_options_to_op(SaveImageOptions *simopts, wmOperator *op)
 {
 	if (op->customdata) {
-		*(ImageFormatData *)op->customdata= simopts->im_format;
+		*(ImageFormatData *)op->customdata = simopts->im_format;
 	}
 
 	RNA_string_set(op->ptr, "filepath", simopts->filepath);
@@ -1056,44 +1112,44 @@ static void save_image_options_to_op(SaveImageOptions *simopts, wmOperator *op)
 /* ima->name and ibuf->name should end up the same */
 static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveImageOptions *simopts, int do_newpath)
 {
-	Image *ima= ED_space_image(sima);
+	Image *ima = ED_space_image(sima);
 	void *lock;
-	ImBuf *ibuf= ED_space_image_acquire_buffer(sima, &lock);
+	ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock);
 
 	if (ibuf) {
-		const char *relbase= ID_BLEND_PATH(CTX_data_main(C), &ima->id);
-		const short relative= (RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path"));
-		const short save_copy= (RNA_struct_find_property(op->ptr, "copy") && RNA_boolean_get(op->ptr, "copy"));
-		short ok= FALSE;
+		const char *relbase = ID_BLEND_PATH(CTX_data_main(C), &ima->id);
+		const short relative = (RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path"));
+		const short save_copy = (RNA_struct_find_property(op->ptr, "copy") && RNA_boolean_get(op->ptr, "copy"));
+		short ok = FALSE;
 
 		/* old global to ensure a 2nd save goes to same dir */
 		BLI_strncpy(G.ima, simopts->filepath, sizeof(G.ima));
 
 		WM_cursor_wait(1);
 
-		if(ima->type == IMA_TYPE_R_RESULT) {
+		if (ima->type == IMA_TYPE_R_RESULT) {
 			/* enforce user setting for RGB or RGBA, but skip BW */
-			if(simopts->im_format.planes==R_IMF_PLANES_RGBA) {
-				ibuf->planes= R_IMF_PLANES_RGBA;
+			if (simopts->im_format.planes == R_IMF_PLANES_RGBA) {
+				ibuf->planes = R_IMF_PLANES_RGBA;
 			}
-			else if(simopts->im_format.planes==R_IMF_PLANES_RGB) {
-				ibuf->planes= R_IMF_PLANES_RGB;
+			else if (simopts->im_format.planes == R_IMF_PLANES_RGB) {
+				ibuf->planes = R_IMF_PLANES_RGB;
 			}
 		}
 		else {
 			/* TODO, better solution, if a 24bit image is painted onto it may contain alpha */
-			if(ibuf->userflags & IB_BITMAPDIRTY) { /* it has been painted onto */
+			if (ibuf->userflags & IB_BITMAPDIRTY) { /* it has been painted onto */
 				/* checks each pixel, not ideal */
-				ibuf->planes= BKE_alphatest_ibuf(ibuf) ? 32 : 24;
+				ibuf->planes = BKE_alphatest_ibuf(ibuf) ? 32 : 24;
 			}
 		}
 		
-		if(simopts->im_format.imtype==R_IMF_IMTYPE_MULTILAYER) {
-			Scene *scene= CTX_data_scene(C);
-			RenderResult *rr= BKE_image_acquire_renderresult(scene, ima);
-			if(rr) {
+		if (simopts->im_format.imtype == R_IMF_IMTYPE_MULTILAYER) {
+			Scene *scene = CTX_data_scene(C);
+			RenderResult *rr = BKE_image_acquire_renderresult(scene, ima);
+			if (rr) {
 				RE_WriteRenderResult(op->reports, rr, simopts->filepath, simopts->im_format.quality);
-				ok= TRUE;
+				ok = TRUE;
 			}
 			else {
 				BKE_report(op->reports, RPT_ERROR, "Did not write, no Multilayer Image");
@@ -1102,13 +1158,13 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI
 		}
 		else {
 			if (BKE_write_ibuf_as(ibuf, simopts->filepath, &simopts->im_format, save_copy)) {
-				ok= TRUE;
+				ok = TRUE;
 			}
 		}
 
-		if (ok)	{
-			if(!save_copy) {
-				if(do_newpath) {
+		if (ok) {
+			if (!save_copy) {
+				if (do_newpath) {
 					BLI_strncpy(ibuf->name, simopts->filepath, sizeof(ibuf->name));
 					BLI_strncpy(ima->name, simopts->filepath, sizeof(ima->name));
 				}
@@ -1116,28 +1172,28 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI
 				ibuf->userflags &= ~IB_BITMAPDIRTY;
 
 				/* change type? */
-				if(ima->type==IMA_TYPE_R_RESULT) {
-					ima->type= IMA_TYPE_IMAGE;
+				if (ima->type == IMA_TYPE_R_RESULT) {
+					ima->type = IMA_TYPE_IMAGE;
 
 					/* workaround to ensure the render result buffer is no longer used
 					 * by this image, otherwise can crash when a new render result is
 					 * created. */
-					if(ibuf->rect && !(ibuf->mall & IB_rect))
+					if (ibuf->rect && !(ibuf->mall & IB_rect))
 						imb_freerectImBuf(ibuf);
-					if(ibuf->rect_float && !(ibuf->mall & IB_rectfloat))
+					if (ibuf->rect_float && !(ibuf->mall & IB_rectfloat))
 						imb_freerectfloatImBuf(ibuf);
-					if(ibuf->zbuf && !(ibuf->mall & IB_zbuf))
+					if (ibuf->zbuf && !(ibuf->mall & IB_zbuf))
 						IMB_freezbufImBuf(ibuf);
-					if(ibuf->zbuf_float && !(ibuf->mall & IB_zbuffloat))
+					if (ibuf->zbuf_float && !(ibuf->mall & IB_zbuffloat))
 						IMB_freezbuffloatImBuf(ibuf);
 				}
-				if( ELEM(ima->source, IMA_SRC_GENERATED, IMA_SRC_VIEWER)) {
-					ima->source= IMA_SRC_FILE;
-					ima->type= IMA_TYPE_IMAGE;
+				if (ELEM(ima->source, IMA_SRC_GENERATED, IMA_SRC_VIEWER)) {
+					ima->source = IMA_SRC_FILE;
+					ima->type = IMA_TYPE_IMAGE;
 				}
 
 				/* only image path, never ibuf */
-				if(relative) {
+				if (relative) {
 					BLI_path_rel(ima->name, relbase); /* only after saving */
 				}
 			}
@@ -1147,7 +1203,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI
 		}
 
 
-		WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, sima->image);
+		WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, sima->image);
 
 		WM_cursor_wait(0);
 	}
@@ -1159,18 +1215,18 @@ static void image_save_as_free(wmOperator *op)
 {
 	if (op->customdata) {
 		MEM_freeN(op->customdata);
-		op->customdata= NULL;
+		op->customdata = NULL;
 	}
 }
 
 static int image_save_as_exec(bContext *C, wmOperator *op)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
 	SaveImageOptions simopts;
 
 	save_image_options_defaults(&simopts);
 
-	/* just incase to initialize values,
+	/* just in case to initialize values,
 	 * these should be set on invoke or by the caller. */
 	save_image_options_init(&simopts, sima, CTX_data_scene(C), 0);
 
@@ -1185,36 +1241,32 @@ static int image_save_as_exec(bContext *C, wmOperator *op)
 
 static int image_save_as_check(bContext *UNUSED(C), wmOperator *op)
 {
-	ImageFormatData *imf= op->customdata;
-	char filepath[FILE_MAX];
-	RNA_string_get(op->ptr, "filepath", filepath);
-	if(BKE_add_image_extension(filepath, imf->imtype)) {
-		RNA_string_set(op->ptr, "filepath", filepath);
-		return TRUE;
-	}
-	return FALSE;
+	ImageFormatData *imf = op->customdata;
+	return WM_operator_filesel_ensure_ext_imtype(op, imf->imtype);
 }
 
 static int image_save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
 	Image *ima = ED_space_image(sima);
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	SaveImageOptions simopts;
 
-	if(RNA_struct_property_is_set(op->ptr, "filepath"))
+	if (RNA_struct_property_is_set(op->ptr, "filepath"))
 		return image_save_as_exec(C, op);
 
+	save_image_options_defaults(&simopts);
+
 	if (save_image_options_init(&simopts, sima, scene, TRUE) == 0)
 		return OPERATOR_CANCELLED;
 	save_image_options_to_op(&simopts, op);
 
 	/* enable save_copy by default for render results */
-	if(ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE) && !RNA_struct_property_is_set(op->ptr, "copy")) {
+	if (ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE) && !RNA_struct_property_is_set(op->ptr, "copy")) {
 		RNA_boolean_set(op->ptr, "copy", TRUE);
 	}
 
-	op->customdata= MEM_mallocN(sizeof(simopts.im_format), __func__);
+	op->customdata = MEM_mallocN(sizeof(simopts.im_format), __func__);
 	memcpy(op->customdata, &simopts.im_format, sizeof(simopts.im_format));
 
 	image_filesel(C, op, simopts.filepath);
@@ -1231,7 +1283,7 @@ static int image_save_as_cancel(bContext *UNUSED(C), wmOperator *op)
 
 static int image_save_as_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop)
 {
-	const char *prop_id= RNA_property_identifier(prop);
+	const char *prop_id = RNA_property_identifier(prop);
 
 	return !(strcmp(prop_id, "filepath") == 0 ||
 	         strcmp(prop_id, "directory") == 0 ||
@@ -1243,8 +1295,8 @@ static int image_save_as_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop)
 
 static void image_save_as_draw(bContext *UNUSED(C), wmOperator *op)
 {
-	uiLayout *layout= op->layout;
-	ImageFormatData *imf= op->customdata;
+	uiLayout *layout = op->layout;
+	ImageFormatData *imf = op->customdata;
 	PointerRNA ptr;
 
 	/* image template */
@@ -1261,32 +1313,32 @@ void IMAGE_OT_save_as(wmOperatorType *ot)
 //	PropertyRNA *prop;
 
 	/* identifiers */
-	ot->name= "Save As Image";
-	ot->idname= "IMAGE_OT_save_as";
+	ot->name = "Save As Image";
+	ot->idname = "IMAGE_OT_save_as";
 	
 	/* api callbacks */
-	ot->exec= image_save_as_exec;
-	ot->check= image_save_as_check;
-	ot->invoke= image_save_as_invoke;
-	ot->cancel= image_save_as_cancel;
-	ot->ui= image_save_as_draw;
-	ot->poll= space_image_buffer_exists_poll;
+	ot->exec = image_save_as_exec;
+	ot->check = image_save_as_check;
+	ot->invoke = image_save_as_invoke;
+	ot->cancel = image_save_as_cancel;
+	ot->ui = image_save_as_draw;
+	ot->poll = space_image_buffer_exists_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "copy", 0, "Copy", "Create a new image file without modifying the current image in blender");
 
-	WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
+	WM_operator_properties_filesel(ot, FOLDERFILE | IMAGEFILE | MOVIEFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
 }
 
 /******************** save image operator ********************/
 
 static int image_save_exec(bContext *C, wmOperator *op)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	Scene *scene= CTX_data_scene(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
+	Scene *scene = CTX_data_scene(C);
 	SaveImageOptions simopts;
 
 	if (save_image_options_init(&simopts, sima, scene, FALSE) == 0)
@@ -1307,53 +1359,53 @@ static int image_save_exec(bContext *C, wmOperator *op)
 void IMAGE_OT_save(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Save Image";
-	ot->idname= "IMAGE_OT_save";
+	ot->name = "Save Image";
+	ot->idname = "IMAGE_OT_save";
 	
 	/* api callbacks */
-	ot->exec= image_save_exec;
-	ot->poll= space_image_file_exists_poll;
+	ot->exec = image_save_exec;
+	ot->poll = space_image_file_exists_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /******************* save sequence operator ********************/
 
 static int image_save_sequence_exec(bContext *C, wmOperator *op)
 {
-	Main *bmain= CTX_data_main(C);
-	SpaceImage *sima= CTX_wm_space_image(C);
+	Main *bmain = CTX_data_main(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
 	ImBuf *ibuf;
-	int tot= 0;
+	int tot = 0;
 	char di[FILE_MAX], fi[FILE_MAX];
 	
-	if(sima->image==NULL)
+	if (sima->image == NULL)
 		return OPERATOR_CANCELLED;
 
-	if(sima->image->source!=IMA_SRC_SEQUENCE) {
+	if (sima->image->source != IMA_SRC_SEQUENCE) {
 		BKE_report(op->reports, RPT_ERROR, "Can only save sequence on image sequences");
 		return OPERATOR_CANCELLED;
 	}
 
-	if(sima->image->type==IMA_TYPE_MULTILAYER) {
+	if (sima->image->type == IMA_TYPE_MULTILAYER) {
 		BKE_report(op->reports, RPT_ERROR, "Can't save multilayer sequences");
 		return OPERATOR_CANCELLED;
 	}
 	
 	/* get total */
-	for(ibuf= sima->image->ibufs.first; ibuf; ibuf= ibuf->next) 
-		if(ibuf->userflags & IB_BITMAPDIRTY)
+	for (ibuf = sima->image->ibufs.first; ibuf; ibuf = ibuf->next)
+		if (ibuf->userflags & IB_BITMAPDIRTY)
 			tot++;
 	
-	if(tot==0) {
+	if (tot == 0) {
 		BKE_report(op->reports, RPT_WARNING, "No images have been changed");
 		return OPERATOR_CANCELLED;
 	}
 
 	/* get a filename for menu */
-	for(ibuf= sima->image->ibufs.first; ibuf; ibuf= ibuf->next) 
-		if(ibuf->userflags & IB_BITMAPDIRTY)
+	for (ibuf = sima->image->ibufs.first; ibuf; ibuf = ibuf->next)
+		if (ibuf->userflags & IB_BITMAPDIRTY)
 			break;
 	
 	BLI_strncpy(di, ibuf->name, FILE_MAX);
@@ -1361,14 +1413,14 @@ static int image_save_sequence_exec(bContext *C, wmOperator *op)
 	
 	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) {
+	for (ibuf = sima->image->ibufs.first; ibuf; ibuf = ibuf->next) {
+		if (ibuf->userflags & IB_BITMAPDIRTY) {
 			char name[FILE_MAX];
 			BLI_strncpy(name, ibuf->name, sizeof(name));
 			
 			BLI_path_abs(name, bmain->name);
 
-			if(0 == IMB_saveiff(ibuf, name, IB_rect | IB_zbuf | IB_zbuffloat)) {
+			if (0 == IMB_saveiff(ibuf, name, IB_rect | IB_zbuf | IB_zbuffloat)) {
 				BKE_reportf(op->reports, RPT_ERROR, "Could not write image %s", name);
 				break;
 			}
@@ -1384,34 +1436,34 @@ static int image_save_sequence_exec(bContext *C, wmOperator *op)
 void IMAGE_OT_save_sequence(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Save Sequence";
-	ot->idname= "IMAGE_OT_save_sequence";
+	ot->name = "Save Sequence";
+	ot->idname = "IMAGE_OT_save_sequence";
 	
 	/* api callbacks */
-	ot->exec= image_save_sequence_exec;
-	ot->poll= space_image_buffer_exists_poll;
+	ot->exec = image_save_sequence_exec;
+	ot->poll = space_image_buffer_exists_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /******************** reload image operator ********************/
 
 static int image_reload_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Image *ima= CTX_data_edit_image(C);
-	SpaceImage *sima= CTX_wm_space_image(C);
+	Image *ima = CTX_data_edit_image(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
 
-	if(!ima)
+	if (!ima)
 		return OPERATOR_CANCELLED;
 
 	/* XXX unpackImage frees image buffers */
 	ED_preview_kill_jobs(C);
 	
 	// XXX other users?
-	BKE_image_signal(ima, (sima)? &sima->iuser: NULL, IMA_SIGNAL_RELOAD);
+	BKE_image_signal(ima, (sima) ? &sima->iuser : NULL, IMA_SIGNAL_RELOAD);
 
-	WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, ima);
+	WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ima);
 	
 	return OPERATOR_FINISHED;
 }
@@ -1419,14 +1471,14 @@ static int image_reload_exec(bContext *C, wmOperator *UNUSED(op))
 void IMAGE_OT_reload(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Reload Image";
-	ot->idname= "IMAGE_OT_reload";
+	ot->name = "Reload Image";
+	ot->idname = "IMAGE_OT_reload";
 	
 	/* api callbacks */
-	ot->exec= image_reload_exec;
+	ot->exec = image_reload_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER; /* no undo, image buffer is not handled by undo */
+	ot->flag = OPTYPE_REGISTER; /* no undo, image buffer is not handled by undo */
 }
 
 /********************** new image operator *********************/
@@ -1439,38 +1491,38 @@ static int image_new_exec(bContext *C, wmOperator *op)
 	Image *ima;
 	PointerRNA ptr, idptr;
 	PropertyRNA *prop;
-	char name[MAX_ID_NAME-2];
+	char name[MAX_ID_NAME - 2];
 	float color[4];
 	int width, height, floatbuf, uvtestgrid, alpha;
 
 	/* retrieve state */
-	sima= CTX_wm_space_image(C);
-	scene= CTX_data_scene(C);
-	obedit= CTX_data_edit_object(C);
+	sima = CTX_wm_space_image(C);
+	scene = CTX_data_scene(C);
+	obedit = CTX_data_edit_object(C);
 
 	RNA_string_get(op->ptr, "name", name);
-	width= RNA_int_get(op->ptr, "width");
-	height= RNA_int_get(op->ptr, "height");
-	floatbuf= RNA_boolean_get(op->ptr, "float");
-	uvtestgrid= RNA_boolean_get(op->ptr, "uv_test_grid");
+	width = RNA_int_get(op->ptr, "width");
+	height = RNA_int_get(op->ptr, "height");
+	floatbuf = RNA_boolean_get(op->ptr, "float");
+	uvtestgrid = RNA_boolean_get(op->ptr, "uv_test_grid");
 	RNA_float_get_array(op->ptr, "color", color);
-	alpha= RNA_boolean_get(op->ptr, "alpha");
+	alpha = RNA_boolean_get(op->ptr, "alpha");
 	
 	if (!floatbuf && scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
 		linearrgb_to_srgb_v3_v3(color, color);
 
-	if(!alpha)
-		color[3]= 1.0f;
+	if (!alpha)
+		color[3] = 1.0f;
 
 	ima = BKE_add_image_size(width, height, name, alpha ? 32 : 24, floatbuf, uvtestgrid, color);
 
-	if(!ima)
+	if (!ima)
 		return OPERATOR_CANCELLED;
 
 	/* hook into UI */
 	uiIDContextProperty(C, &ptr, &prop);
 
-	if(prop) {
+	if (prop) {
 		/* when creating new ID blocks, use is already 1, but RNA
 		 * pointer se also increases user, so this compensates it */
 		ima->id.us--;
@@ -1479,11 +1531,11 @@ 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);
 
 	// XXX other users?
-	BKE_image_signal(ima, (sima)? &sima->iuser: NULL, IMA_SIGNAL_USER_NEW_IMAGE);
+	BKE_image_signal(ima, (sima) ? &sima->iuser : NULL, IMA_SIGNAL_USER_NEW_IMAGE);
 	
 	return OPERATOR_FINISHED;
 }
@@ -1498,25 +1550,25 @@ static int image_new_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 void IMAGE_OT_new(wmOperatorType *ot)
 {
 	PropertyRNA *prop;
-	static float default_color[4]= {0.0f, 0.0f, 0.0f, 1.0f};
+	static float default_color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
 	
 	/* identifiers */
-	ot->name= "New Image";
-	ot->description= "Create a new image";
-	ot->idname= "IMAGE_OT_new";
+	ot->name = "New Image";
+	ot->description = "Create a new image";
+	ot->idname = "IMAGE_OT_new";
 	
 	/* api callbacks */
-	ot->exec= image_new_exec;
-	ot->invoke= image_new_invoke;
+	ot->exec = image_new_exec;
+	ot->invoke = image_new_invoke;
 	
 	/* flags */
-	ot->flag= OPTYPE_UNDO;
+	ot->flag = OPTYPE_UNDO;
 
 	/* properties */
-	RNA_def_string(ot->srna, "name", "untitled", MAX_ID_NAME-2, "Name", "Image datablock name");
+	RNA_def_string(ot->srna, "name", "untitled", MAX_ID_NAME - 2, "Name", "Image datablock name");
 	RNA_def_int(ot->srna, "width", 1024, 1, INT_MAX, "Width", "Image width", 1, 16384);
 	RNA_def_int(ot->srna, "height", 1024, 1, INT_MAX, "Height", "Image height", 1, 16384);
-	prop= RNA_def_float_color(ot->srna, "color", 4, NULL, 0.0f, FLT_MAX, "Color", "Default fill color", 0.0f, 1.0f);
+	prop = RNA_def_float_color(ot->srna, "color", 4, NULL, 0.0f, FLT_MAX, "Color", "Default fill color", 0.0f, 1.0f);
 	RNA_def_property_float_array_default(prop, default_color);
 	RNA_def_boolean(ot->srna, "alpha", 1, "Alpha", "Create an image with an alpha channel");
 	RNA_def_boolean(ot->srna, "uv_test_grid", 0, "UV Test Grid", "Fill the image with a grid for UV map testing");
@@ -1527,53 +1579,53 @@ 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);
+	Image *ima = CTX_data_edit_image(C);
+	ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
 	
-	if( ibuf != NULL )
+	if (ibuf != NULL)
 		return 1;
 	return 0;
 }
 
 static int image_invert_exec(bContext *C, wmOperator *op)
 {
-	Image *ima= CTX_data_edit_image(C);
-	ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
+	Image *ima = CTX_data_edit_image(C);
+	ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
 
 	// flags indicate if this channel should be inverted
-	const short r= RNA_boolean_get(op->ptr, "invert_r");
-	const short g= RNA_boolean_get(op->ptr, "invert_g");
-	const short b= RNA_boolean_get(op->ptr, "invert_b");
-	const short a= RNA_boolean_get(op->ptr, "invert_a");
+	const short r = RNA_boolean_get(op->ptr, "invert_r");
+	const short g = RNA_boolean_get(op->ptr, "invert_g");
+	const short b = RNA_boolean_get(op->ptr, "invert_b");
+	const short a = RNA_boolean_get(op->ptr, "invert_a");
 
 	int i;
 
-	if( ibuf == NULL) // TODO: this should actually never happen, but does for render-results -> cleanup
+	if (ibuf == NULL)  // TODO: this should actually never happen, but does for render-results -> cleanup
 		return OPERATOR_CANCELLED;
 
 	/* TODO: make this into an IMB_invert_channels(ibuf,r,g,b,a) method!? */
 	if (ibuf->rect_float) {
 		
 		float *fp = (float *) ibuf->rect_float;
-		for( i = ibuf->x * ibuf->y; i > 0; i--, fp+=4 ) {
-			if( r ) fp[0] = 1.0f - fp[0];
-			if( g ) fp[1] = 1.0f - fp[1];
-			if( b ) fp[2] = 1.0f - fp[2];
-			if( a ) fp[3] = 1.0f - fp[3];
+		for (i = ibuf->x * ibuf->y; i > 0; i--, fp += 4) {
+			if (r) fp[0] = 1.0f - fp[0];
+			if (g) fp[1] = 1.0f - fp[1];
+			if (b) fp[2] = 1.0f - fp[2];
+			if (a) fp[3] = 1.0f - fp[3];
 		}
 
-		if(ibuf->rect) {
+		if (ibuf->rect) {
 			IMB_rect_from_float(ibuf);
 		}
 	}
-	else if(ibuf->rect) {
+	else if (ibuf->rect) {
 		
 		char *cp = (char *) ibuf->rect;
-		for( i = ibuf->x * ibuf->y; i > 0; i--, cp+=4 ) {
-			if( r ) cp[0] = 255 - cp[0];
-			if( g ) cp[1] = 255 - cp[1];
-			if( b ) cp[2] = 255 - cp[2];
-			if( a ) cp[3] = 255 - cp[3];
+		for (i = ibuf->x * ibuf->y; i > 0; i--, cp += 4) {
+			if (r) cp[0] = 255 - cp[0];
+			if (g) cp[1] = 255 - cp[1];
+			if (b) cp[2] = 255 - cp[2];
+			if (a) cp[3] = 255 - cp[3];
 		}
 	}
 	else {
@@ -1581,22 +1633,22 @@ static int image_invert_exec(bContext *C, wmOperator *op)
 	}
 
 	ibuf->userflags |= IB_BITMAPDIRTY;
-	if(ibuf->mipmap[0])
+	if (ibuf->mipmap[0])
 		ibuf->userflags |= IB_MIPMAP_INVALID;
 
-	WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, ima);
+	WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ima);
 	return OPERATOR_FINISHED;
 }
 
 void IMAGE_OT_invert(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Invert Channels";
-	ot->idname= "IMAGE_OT_invert";
+	ot->name = "Invert Channels";
+	ot->idname = "IMAGE_OT_invert";
 	
 	/* api callbacks */
-	ot->exec= image_invert_exec;
-	ot->poll= image_invert_poll;
+	ot->exec = image_invert_exec;
+	ot->poll = image_invert_poll;
 	
 	/* properties */
 	RNA_def_boolean(ot->srna, "invert_r", 0, "Red", "Invert Red Channel");
@@ -1605,22 +1657,22 @@ void IMAGE_OT_invert(wmOperatorType *ot)
 	RNA_def_boolean(ot->srna, "invert_a", 0, "Alpha", "Invert Alpha Channel");
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /********************* pack operator *********************/
 
 static int image_pack_test(bContext *C, wmOperator *op)
 {
-	Image *ima= CTX_data_edit_image(C);
-	int as_png= RNA_boolean_get(op->ptr, "as_png");
+	Image *ima = CTX_data_edit_image(C);
+	int as_png = RNA_boolean_get(op->ptr, "as_png");
 
-	if(!ima)
+	if (!ima)
 		return 0;
-	if(!as_png && ima->packedfile)
+	if (!as_png && ima->packedfile)
 		return 0;
 
-	if(ima->source==IMA_SRC_SEQUENCE || ima->source==IMA_SRC_MOVIE) {
+	if (ima->source == IMA_SRC_SEQUENCE || ima->source == IMA_SRC_MOVIE) {
 		BKE_report(op->reports, RPT_ERROR, "Packing movies or image sequences not supported");
 		return 0;
 	}
@@ -1630,43 +1682,43 @@ static int image_pack_test(bContext *C, wmOperator *op)
 
 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);
-	int as_png= RNA_boolean_get(op->ptr, "as_png");
+	struct Main *bmain = CTX_data_main(C);
+	Image *ima = CTX_data_edit_image(C);
+	ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
+	int as_png = RNA_boolean_get(op->ptr, "as_png");
 
-	if(!image_pack_test(C, op))
+	if (!image_pack_test(C, op))
 		return OPERATOR_CANCELLED;
 	
-	if(!as_png && (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))) {
+	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");
 		return OPERATOR_CANCELLED;
 	}
 
-	if(as_png)
+	if (as_png)
 		BKE_image_memorypack(ima);
 	else
-		ima->packedfile= newPackedFile(op->reports, ima->name, ID_BLEND_PATH(bmain, &ima->id));
+		ima->packedfile = newPackedFile(op->reports, ima->name, ID_BLEND_PATH(bmain, &ima->id));
 
-	WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, ima);
+	WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ima);
 	
 	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);
+	Image *ima = CTX_data_edit_image(C);
+	ImBuf *ibuf = BKE_image_get_ibuf(ima, NULL);
 	uiPopupMenu *pup;
 	uiLayout *layout;
-	int as_png= RNA_boolean_get(op->ptr, "as_png");
+	int as_png = RNA_boolean_get(op->ptr, "as_png");
 
-	if(!image_pack_test(C, op))
+	if (!image_pack_test(C, op))
 		return OPERATOR_CANCELLED;
 	
-	if(!as_png && (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))) {
-		pup= uiPupMenuBegin(C, "OK", ICON_QUESTION);
-		layout= uiPupMenuLayout(pup);
+	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);
 
@@ -1679,16 +1731,16 @@ static int image_pack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
 void IMAGE_OT_pack(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Pack Image";
-	ot->description= "Pack an image as embedded data into the .blend file"; 
-	ot->idname= "IMAGE_OT_pack";
+	ot->name = "Pack Image";
+	ot->description = "Pack an image as embedded data into the .blend file"; 
+	ot->idname = "IMAGE_OT_pack";
 	
 	/* api callbacks */
-	ot->exec= image_pack_exec;
-	ot->invoke= image_pack_invoke;
+	ot->exec = image_pack_exec;
+	ot->invoke = image_pack_invoke;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "as_png", 0, "Pack As PNG", "Pack image as lossless PNG");
@@ -1698,26 +1750,26 @@ void IMAGE_OT_pack(wmOperatorType *ot)
 
 static int image_unpack_exec(bContext *C, wmOperator *op)
 {
-	Image *ima= CTX_data_edit_image(C);
-	int method= RNA_enum_get(op->ptr, "method");
+	Image *ima = CTX_data_edit_image(C);
+	int method = RNA_enum_get(op->ptr, "method");
 
 	/* find the suppplied image by name */
 	if (RNA_struct_property_is_set(op->ptr, "id")) {
-		char imaname[MAX_ID_NAME-2];
+		char imaname[MAX_ID_NAME - 2];
 		RNA_string_get(op->ptr, "id", imaname);
 		ima = BLI_findstring(&CTX_data_main(C)->image, imaname, offsetof(ID, name) + 2);
 		if (!ima) ima = CTX_data_edit_image(C);
 	}
 	
-	if(!ima || !ima->packedfile)
+	if (!ima || !ima->packedfile)
 		return OPERATOR_CANCELLED;
 
-	if(ima->source==IMA_SRC_SEQUENCE || ima->source==IMA_SRC_MOVIE) {
+	if (ima->source == IMA_SRC_SEQUENCE || ima->source == IMA_SRC_MOVIE) {
 		BKE_report(op->reports, RPT_ERROR, "Unpacking movies or image sequences not supported");
 		return OPERATOR_CANCELLED;
 	}
 
-	if(G.fileflags & G_AUTOPACK)
+	if (G.fileflags & G_AUTOPACK)
 		BKE_report(op->reports, RPT_WARNING, "AutoPack is enabled, so image will be packed again on file save");
 	
 	/* XXX unpackImage frees image buffers */
@@ -1725,30 +1777,30 @@ static int image_unpack_exec(bContext *C, wmOperator *op)
 	
 	unpackImage(op->reports, ima, method);
 	
-	WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, ima);
+	WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ima);
 
 	return OPERATOR_FINISHED;
 }
 
 static int image_unpack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	Image *ima= CTX_data_edit_image(C);
+	Image *ima = CTX_data_edit_image(C);
 
-	if(RNA_struct_property_is_set(op->ptr, "id"))
+	if (RNA_struct_property_is_set(op->ptr, "id"))
 		return image_unpack_exec(C, op);
 		
-	if(!ima || !ima->packedfile)
+	if (!ima || !ima->packedfile)
 		return OPERATOR_CANCELLED;
 
-	if(ima->source==IMA_SRC_SEQUENCE || ima->source==IMA_SRC_MOVIE) {
+	if (ima->source == IMA_SRC_SEQUENCE || ima->source == IMA_SRC_MOVIE) {
 		BKE_report(op->reports, RPT_ERROR, "Unpacking movies or image sequences not supported");
 		return OPERATOR_CANCELLED;
 	}
 
-	if(G.fileflags & G_AUTOPACK)
+	if (G.fileflags & G_AUTOPACK)
 		BKE_report(op->reports, RPT_WARNING, "AutoPack is enabled, so image will be packed again on file save");
 
-	unpack_menu(C, "IMAGE_OT_unpack", ima->id.name+2, ima->name, "textures", ima->packedfile);
+	unpack_menu(C, "IMAGE_OT_unpack", ima->id.name + 2, ima->name, "textures", ima->packedfile);
 
 	return OPERATOR_FINISHED;
 }
@@ -1756,20 +1808,20 @@ static int image_unpack_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
 void IMAGE_OT_unpack(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Unpack Image";
-	ot->description= "Save an image packed in the .blend file to disk"; 
-	ot->idname= "IMAGE_OT_unpack";
+	ot->name = "Unpack Image";
+	ot->description = "Save an image packed in the .blend file to disk"; 
+	ot->idname = "IMAGE_OT_unpack";
 	
 	/* api callbacks */
-	ot->exec= image_unpack_exec;
-	ot->invoke= image_unpack_invoke;
+	ot->exec = image_unpack_exec;
+	ot->invoke = image_unpack_invoke;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_enum(ot->srna, "method", unpack_method_items, PF_USE_LOCAL, "Method", "How to unpack");
-	RNA_def_string(ot->srna, "id", "", MAX_ID_NAME-2, "Image Name", "Image datablock name to unpack"); /* XXX, weark!, will fail with library, name collisions */
+	RNA_def_string(ot->srna, "id", "", MAX_ID_NAME - 2, "Image Name", "Image datablock name to unpack"); /* XXX, weark!, will fail with library, name collisions */
 }
 
 /******************** sample image operator ********************/
@@ -1795,8 +1847,8 @@ typedef struct ImageSampleInfo {
 
 static void image_sample_draw(const bContext *UNUSED(C), ARegion *ar, void *arg_info)
 {
-	ImageSampleInfo *info= arg_info;
-	if(info->draw) {
+	ImageSampleInfo *info = arg_info;
+	if (info->draw) {
 		/* no color management needed for images (color_manage=0) */
 		ED_image_draw_info(ar, 0, info->channels, info->x, info->y, info->colp, info->colfp, info->zp, info->zfp);
 	}
@@ -1804,85 +1856,85 @@ static void image_sample_draw(const bContext *UNUSED(C), ARegion *ar, void *arg_
 
 static void image_sample_apply(bContext *C, wmOperator *op, wmEvent *event)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	ARegion *ar= CTX_wm_region(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
+	ARegion *ar = CTX_wm_region(C);
 	void *lock;
-	ImBuf *ibuf= ED_space_image_acquire_buffer(sima, &lock);
-	ImageSampleInfo *info= op->customdata;
+	ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock);
+	ImageSampleInfo *info = op->customdata;
 	float fx, fy;
 	
-	if(ibuf == NULL) {
+	if (ibuf == NULL) {
 		ED_space_image_release_buffer(sima, lock);
 		return;
 	}
 
 	UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fx, &fy);
 
-	if(fx>=0.0f && fy>=0.0f && fx<1.0f && fy<1.0f) {
+	if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
 		float *fp;
 		unsigned char *cp;
-		int x= (int)(fx*ibuf->x), y= (int)(fy*ibuf->y);
+		int x = (int)(fx * ibuf->x), y = (int)(fy * ibuf->y);
 
-		CLAMP(x, 0, ibuf->x-1);
-		CLAMP(y, 0, ibuf->y-1);
+		CLAMP(x, 0, ibuf->x - 1);
+		CLAMP(y, 0, ibuf->y - 1);
 
-		info->x= x;
-		info->y= y;
-		info->draw= 1;
-		info->channels= ibuf->channels;
+		info->x = x;
+		info->y = y;
+		info->draw = 1;
+		info->channels = ibuf->channels;
 
-		info->colp= NULL;
-		info->colfp= NULL;
-		info->zp= NULL;
-		info->zfp= NULL;
+		info->colp = NULL;
+		info->colfp = NULL;
+		info->zp = NULL;
+		info->zfp = NULL;
 		
-		if(ibuf->rect) {
-			cp= (unsigned char *)(ibuf->rect + y*ibuf->x + x);
-
-			info->col[0]= cp[0];
-			info->col[1]= cp[1];
-			info->col[2]= cp[2];
-			info->col[3]= cp[3];
-			info->colp= info->col;
-
-			info->colf[0]= (float)cp[0]/255.0f;
-			info->colf[1]= (float)cp[1]/255.0f;
-			info->colf[2]= (float)cp[2]/255.0f;
-			info->colf[3]= (float)cp[3]/255.0f;
-			info->colfp= info->colf;
+		if (ibuf->rect) {
+			cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x);
+
+			info->col[0] = cp[0];
+			info->col[1] = cp[1];
+			info->col[2] = cp[2];
+			info->col[3] = cp[3];
+			info->colp = info->col;
+
+			info->colf[0] = (float)cp[0] / 255.0f;
+			info->colf[1] = (float)cp[1] / 255.0f;
+			info->colf[2] = (float)cp[2] / 255.0f;
+			info->colf[3] = (float)cp[3] / 255.0f;
+			info->colfp = info->colf;
 		}
-		if(ibuf->rect_float) {
-			fp= (ibuf->rect_float + (ibuf->channels)*(y*ibuf->x + x));
-
-			info->colf[0]= fp[0];
-			info->colf[1]= fp[1];
-			info->colf[2]= fp[2];
-			info->colf[3]= fp[3];
-			info->colfp= info->colf;
+		if (ibuf->rect_float) {
+			fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x));
+
+			info->colf[0] = fp[0];
+			info->colf[1] = fp[1];
+			info->colf[2] = fp[2];
+			info->colf[3] = fp[3];
+			info->colfp = info->colf;
 		}
 
-		if(ibuf->zbuf) {
-			info->z= ibuf->zbuf[y*ibuf->x + x];
-			info->zp= &info->z;
+		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;
+		if (ibuf->zbuf_float) {
+			info->zf = ibuf->zbuf_float[y * ibuf->x + x];
+			info->zfp = &info->zf;
 		}
 		
-		if(sima->cumap && ibuf->channels==4) {
+		if (sima->cumap && ibuf->channels == 4) {
 			/* we reuse this callback for set curves point operators */
-			if(RNA_struct_find_property(op->ptr, "point")) {
-				int point= RNA_enum_get(op->ptr, "point");
+			if (RNA_struct_find_property(op->ptr, "point")) {
+				int point = RNA_enum_get(op->ptr, "point");
 
-				if(point == 1) {
+				if (point == 1) {
 					curvemapping_set_black_white(sima->cumap, NULL, info->colfp);
-					if(ibuf->rect_float)
+					if (ibuf->rect_float)
 						curvemapping_do_ibuf(sima->cumap, ibuf);
 				}
-				else if(point == 0) {
+				else if (point == 0) {
 					curvemapping_set_black_white(sima->cumap, info->colfp, NULL);
-					if(ibuf->rect_float)
+					if (ibuf->rect_float)
 						curvemapping_do_ibuf(sima->cumap, ibuf);
 				}
 			}
@@ -1891,22 +1943,22 @@ static void image_sample_apply(bContext *C, wmOperator *op, wmEvent *event)
 		// XXX node curve integration ..
 #if 0
 		{
-			ScrArea *sa, *cur= curarea;
+			ScrArea *sa, *cur = curarea;
 			
-			node_curvemap_sample(fp);	/* sends global to node editor */
-			for(sa= G.curscreen->areabase.first; sa; sa= sa->next) {
-				if(sa->spacetype==SPACE_NODE) {
+			node_curvemap_sample(fp);   /* sends global to node editor */
+			for (sa = G.curscreen->areabase.first; sa; sa = sa->next) {
+				if (sa->spacetype == SPACE_NODE) {
 					areawinset(sa->win);
 					scrarea_do_windraw(sa);
 				}
 			}
-			node_curvemap_sample(NULL);		/* clears global in node editor */
-			curarea= cur;
+			node_curvemap_sample(NULL);     /* clears global in node editor */
+			curarea = cur;
 		}
 #endif
 	}
 	else
-		info->draw= 0;
+		info->draw = 0;
 
 	ED_space_image_release_buffer(sima, lock);
 	ED_area_tag_redraw(CTX_wm_area(C));
@@ -1914,7 +1966,7 @@ static void image_sample_apply(bContext *C, wmOperator *op, wmEvent *event)
 
 static void image_sample_exit(bContext *C, wmOperator *op)
 {
-	ImageSampleInfo *info= op->customdata;
+	ImageSampleInfo *info = op->customdata;
 
 	ED_region_draw_cb_exit(info->art, info->draw_handle);
 	ED_area_tag_redraw(CTX_wm_area(C));
@@ -1923,17 +1975,17 @@ static void image_sample_exit(bContext *C, wmOperator *op)
 
 static int image_sample_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	ARegion *ar= CTX_wm_region(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
+	ARegion *ar = CTX_wm_region(C);
 	ImageSampleInfo *info;
 
-	if(!ED_space_image_has_buffer(sima))
+	if (!ED_space_image_has_buffer(sima))
 		return OPERATOR_CANCELLED;
 	
-	info= MEM_callocN(sizeof(ImageSampleInfo), "ImageSampleInfo");
-	info->art= ar->type;
+	info = MEM_callocN(sizeof(ImageSampleInfo), "ImageSampleInfo");
+	info->art = ar->type;
 	info->draw_handle = ED_region_draw_cb_activate(ar->type, image_sample_draw, info, REGION_DRAW_POST_PIXEL);
-	op->customdata= info;
+	op->customdata = info;
 
 	image_sample_apply(C, op, event);
 
@@ -1944,7 +1996,7 @@ static int image_sample_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 static int image_sample_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
-	switch(event->type) {
+	switch (event->type) {
 		case LEFTMOUSE:
 		case RIGHTMOUSE: // XXX hardcoded
 			image_sample_exit(C, op);
@@ -1966,34 +2018,34 @@ static int image_sample_cancel(bContext *C, wmOperator *op)
 void IMAGE_OT_sample(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Sample Color";
-	ot->idname= "IMAGE_OT_sample";
+	ot->name = "Sample Color";
+	ot->idname = "IMAGE_OT_sample";
 	
 	/* api callbacks */
-	ot->invoke= image_sample_invoke;
-	ot->modal= image_sample_modal;
-	ot->cancel= image_sample_cancel;
-	ot->poll= space_image_image_sample_poll;
+	ot->invoke = image_sample_invoke;
+	ot->modal = image_sample_modal;
+	ot->cancel = image_sample_cancel;
+	ot->poll = space_image_image_sample_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_BLOCKING;
 }
 
 /******************** sample line operator ********************/
 static int image_sample_line_exec(bContext *C, wmOperator *op)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	ARegion *ar= CTX_wm_region(C);
-	Scene *scene= CTX_data_scene(C);
-	
-	int x_start= RNA_int_get(op->ptr, "xstart");
-	int y_start= RNA_int_get(op->ptr, "ystart");
-	int x_end= RNA_int_get(op->ptr, "xend");
-	int y_end= RNA_int_get(op->ptr, "yend");
+	SpaceImage *sima = CTX_wm_space_image(C);
+	ARegion *ar = CTX_wm_region(C);
+	Scene *scene = CTX_data_scene(C);
+
+	int x_start = RNA_int_get(op->ptr, "xstart");
+	int y_start = RNA_int_get(op->ptr, "ystart");
+	int x_end = RNA_int_get(op->ptr, "xend");
+	int y_end = RNA_int_get(op->ptr, "yend");
 	
 	void *lock;
-	ImBuf *ibuf= ED_space_image_acquire_buffer(sima, &lock);
-	Histogram *hist= &sima->sample_line_hist;
+	ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock);
+	Histogram *hist = &sima->sample_line_hist;
 	
 	float x1f, y1f, x2f, y2f;
 	int x1, y1, x2, y2;
@@ -2014,25 +2066,26 @@ static int image_sample_line_exec(bContext *C, wmOperator *op)
 	
 	UI_view2d_region_to_view(&ar->v2d, x_start, y_start, &x1f, &y1f);
 	UI_view2d_region_to_view(&ar->v2d, x_end, y_end, &x2f, &y2f);
-	x1= 0.5f+ x1f*ibuf->x;
-	x2= 0.5f+ x2f*ibuf->x;
-	y1= 0.5f+ y1f*ibuf->y;
-	y2= 0.5f+ y2f*ibuf->y;
+	x1 = 0.5f + x1f * ibuf->x;
+	x2 = 0.5f + x2f * ibuf->x;
+	y1 = 0.5f + y1f * ibuf->y;
+	y2 = 0.5f + y2f * ibuf->y;
 	
 	hist->channels = 3;
 	hist->x_resolution = 256;
 	hist->xmax = 1.0f;
 	hist->ymax = 1.0f;
 	
-	for (i=0; i<256; i++) {
-		x= (int)(0.5f + x1 + (float)i*(x2-x1)/255.0f);
-		y= (int)(0.5f + y1 + (float)i*(y2-y1)/255.0f);
+	for (i = 0; i < 256; i++) {
+		x = (int)(0.5f + x1 + (float)i * (x2 - x1) / 255.0f);
+		y = (int)(0.5f + y1 + (float)i * (y2 - y1) / 255.0f);
 		
-		if (x<0 || y<0 || x>=ibuf->x || y>=ibuf->y) {
-			hist->data_luma[i] = hist->data_r[i] = hist->data_g[i]= hist->data_b[i] = 0.0f;
-		} else {
+		if (x < 0 || y < 0 || x >= ibuf->x || y >= ibuf->y) {
+			hist->data_luma[i] = hist->data_r[i] = hist->data_g[i] = hist->data_b[i] = 0.0f;
+		}
+		else {
 			if (ibuf->rect_float) {
-				fp= (ibuf->rect_float + (ibuf->channels)*(y*ibuf->x + x));
+				fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x));
 
 				if (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
 					linearrgb_to_srgb_v3_v3(rgb, fp);
@@ -2045,11 +2098,11 @@ static int image_sample_line_exec(bContext *C, wmOperator *op)
 				hist->data_luma[i] = rgb_to_luma(rgb);
 			}
 			else if (ibuf->rect) {
-				cp= (unsigned char *)(ibuf->rect + y*ibuf->x + x);
-				hist->data_r[i] = (float)cp[0]/255.0f;
-				hist->data_g[i] = (float)cp[1]/255.0f;
-				hist->data_b[i] = (float)cp[2]/255.0f;
-				hist->data_luma[i] = (float)rgb_to_luma_byte(cp)/255.0f;
+				cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x);
+				hist->data_r[i] = (float)cp[0] / 255.0f;
+				hist->data_g[i] = (float)cp[1] / 255.0f;
+				hist->data_b[i] = (float)cp[2] / 255.0f;
+				hist->data_luma[i] = (float)rgb_to_luma_byte(cp) / 255.0f;
 			}
 		}
 	}
@@ -2063,9 +2116,9 @@ static int image_sample_line_exec(bContext *C, wmOperator *op)
 
 static int image_sample_line_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
 	
-	if(!ED_space_image_has_buffer(sima))
+	if (!ED_space_image_has_buffer(sima))
 		return OPERATOR_CANCELLED;
 	
 	return WM_gesture_straightline_invoke(C, op, event);
@@ -2074,18 +2127,18 @@ static int image_sample_line_invoke(bContext *C, wmOperator *op, wmEvent *event)
 void IMAGE_OT_sample_line(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Sample Line";
-	ot->idname= "IMAGE_OT_sample_line";
+	ot->name = "Sample Line";
+	ot->idname = "IMAGE_OT_sample_line";
 	
 	/* api callbacks */
-	ot->invoke= image_sample_line_invoke;
-	ot->modal= WM_gesture_straightline_modal;
-	ot->exec= image_sample_line_exec;
-	ot->poll= space_image_main_area_poll;
-	ot->cancel= WM_gesture_straightline_cancel;
+	ot->invoke = image_sample_line_invoke;
+	ot->modal = WM_gesture_straightline_modal;
+	ot->exec = image_sample_line_exec;
+	ot->poll = space_image_main_area_poll;
+	ot->cancel = WM_gesture_straightline_cancel;
 	
 	/* flags */
-	ot->flag= 0; /* no undo/register since this operates on the space */
+	ot->flag = 0; /* no undo/register since this operates on the space */
 	
 	WM_operator_properties_gesture_straightline(ot, CURSOR_EDIT);
 }
@@ -2094,23 +2147,24 @@ void IMAGE_OT_sample_line(wmOperatorType *ot)
 
 void IMAGE_OT_curves_point_set(wmOperatorType *ot)
 {
-	static EnumPropertyItem point_items[]= {
+	static EnumPropertyItem point_items[] = {
 		{0, "BLACK_POINT", 0, "Black Point", ""},
 		{1, "WHITE_POINT", 0, "White Point", ""},
-		{0, NULL, 0, NULL, NULL}};
+		{0, NULL, 0, NULL, NULL}
+	};
 
 	/* identifiers */
-	ot->name= "Set Curves Point";
-	ot->idname= "IMAGE_OT_curves_point_set";
+	ot->name = "Set Curves Point";
+	ot->idname = "IMAGE_OT_curves_point_set";
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* api callbacks */
-	ot->invoke= image_sample_invoke;
-	ot->modal= image_sample_modal;
-	ot->cancel= image_sample_cancel;
-	ot->poll= space_image_main_area_not_uv_brush_poll;
+	ot->invoke = image_sample_invoke;
+	ot->modal = image_sample_modal;
+	ot->cancel = image_sample_cancel;
+	ot->poll = space_image_main_area_not_uv_brush_poll;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "point", point_items, 0, "Point", "Set black point or white point for curves");
@@ -2126,9 +2180,9 @@ typedef struct RecordCompositeData {
 
 static int image_record_composite_apply(bContext *C, wmOperator *op)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	RecordCompositeData *rcd= op->customdata;
-	Scene *scene= CTX_data_scene(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
+	RecordCompositeData *rcd = op->customdata;
+	Scene *scene = CTX_data_scene(C);
 	ImBuf *ibuf;
 	
 	WM_timecursor(CTX_wm_window(C), scene->r.cfra);
@@ -2138,13 +2192,13 @@ static int image_record_composite_apply(bContext *C, wmOperator *op)
 	
 	BKE_image_all_free_anim_ibufs(scene->r.cfra);
 	ntreeCompositTagAnimated(scene->nodetree);
-	ntreeCompositExecTree(scene->nodetree, &scene->r, scene->r.cfra != rcd->old_cfra);	/* 1 is no previews */
+	ntreeCompositExecTree(scene->nodetree, &scene->r, scene->r.cfra != rcd->old_cfra);  /* 1 is no previews */
 
 	ED_area_tag_redraw(CTX_wm_area(C));
 	
-	ibuf= BKE_image_get_ibuf(sima->image, &sima->iuser);
+	ibuf = BKE_image_get_ibuf(sima->image, &sima->iuser);
 	/* save memory in flipbooks */
-	if(ibuf)
+	if (ibuf)
 		imb_freerectfloatImBuf(ibuf);
 	
 	scene->r.cfra++;
@@ -2154,39 +2208,39 @@ static int image_record_composite_apply(bContext *C, wmOperator *op)
 
 static int image_record_composite_init(bContext *C, wmOperator *op)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	Scene *scene= CTX_data_scene(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
+	Scene *scene = CTX_data_scene(C);
 	RecordCompositeData *rcd;
 
-	if(sima->iuser.frames < 2)
+	if (sima->iuser.frames < 2)
 		return 0;
-	if(scene->nodetree == NULL)
+	if (scene->nodetree == NULL)
 		return 0;
 	
-	op->customdata= rcd= MEM_callocN(sizeof(RecordCompositeData), "ImageRecordCompositeData");
+	op->customdata = rcd = MEM_callocN(sizeof(RecordCompositeData), "ImageRecordCompositeData");
 
-	rcd->old_cfra= scene->r.cfra;
-	rcd->sfra= sima->iuser.sfra;
-	rcd->efra= sima->iuser.sfra + sima->iuser.frames-1;
-	scene->r.cfra= rcd->sfra;
+	rcd->old_cfra = scene->r.cfra;
+	rcd->sfra = sima->iuser.sfra;
+	rcd->efra = sima->iuser.sfra + sima->iuser.frames - 1;
+	scene->r.cfra = rcd->sfra;
 
 	return 1;
 }
 
 static void image_record_composite_exit(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	SpaceImage *sima= CTX_wm_space_image(C);
-	RecordCompositeData *rcd= op->customdata;
+	Scene *scene = CTX_data_scene(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
+	RecordCompositeData *rcd = op->customdata;
 
-	scene->r.cfra= rcd->old_cfra;
+	scene->r.cfra = rcd->old_cfra;
 
 	WM_cursor_restore(CTX_wm_window(C));
 
-	if(rcd->timer)
+	if (rcd->timer)
 		WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), rcd->timer);
 
-	WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, sima->image);
+	WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, sima->image);
 
 	// XXX play_anim(0);
 	// XXX allqueue(REDRAWNODE, 1);
@@ -2196,10 +2250,10 @@ static void image_record_composite_exit(bContext *C, wmOperator *op)
 
 static int image_record_composite_exec(bContext *C, wmOperator *op)
 {
-	if(!image_record_composite_init(C, 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);
@@ -2211,14 +2265,14 @@ static int image_record_composite_invoke(bContext *C, wmOperator *op, wmEvent *U
 {
 	RecordCompositeData *rcd;
 	
-	if(!image_record_composite_init(C, op))
+	if (!image_record_composite_init(C, op))
 		return OPERATOR_CANCELLED;
 
-	rcd= op->customdata;
-	rcd->timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.0f);
+	rcd = op->customdata;
+	rcd->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.0f);
 	WM_event_add_modal_handler(C, op);
 
-	if(!image_record_composite_apply(C, op))
+	if (!image_record_composite_apply(C, op))
 		return OPERATOR_FINISHED;
 
 	return OPERATOR_RUNNING_MODAL;
@@ -2226,12 +2280,12 @@ static int image_record_composite_invoke(bContext *C, wmOperator *op, wmEvent *U
 
 static int image_record_composite_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
-	RecordCompositeData *rcd= op->customdata;
+	RecordCompositeData *rcd = op->customdata;
 
-	switch(event->type) {
+	switch (event->type) {
 		case TIMER:
-			if(rcd->timer == event->customdata) {
-				if(!image_record_composite_apply(C, op)) {
+			if (rcd->timer == event->customdata) {
+				if (!image_record_composite_apply(C, op)) {
 					image_record_composite_exit(C, op);
 					return OPERATOR_FINISHED;
 				}
@@ -2254,53 +2308,49 @@ static int image_record_composite_cancel(bContext *C, wmOperator *op)
 void IMAGE_OT_record_composite(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Record Composite";
-	ot->idname= "IMAGE_OT_record_composite";
+	ot->name = "Record Composite";
+	ot->idname = "IMAGE_OT_record_composite";
 	
 	/* api callbacks */
-	ot->exec= image_record_composite_exec;
-	ot->invoke= image_record_composite_invoke;
-	ot->modal= image_record_composite_modal;
-	ot->cancel= image_record_composite_cancel;
-	ot->poll= space_image_buffer_exists_poll;
+	ot->exec = image_record_composite_exec;
+	ot->invoke = image_record_composite_invoke;
+	ot->modal = image_record_composite_modal;
+	ot->cancel = image_record_composite_cancel;
+	ot->poll = space_image_buffer_exists_poll;
 }
 
 /********************* cycle render slot operator *********************/
 
 static int image_cycle_render_slot_poll(bContext *C)
 {
-	Image *ima= CTX_data_edit_image(C);
+	Image *ima = CTX_data_edit_image(C);
 
 	return (ima && ima->type == IMA_TYPE_R_RESULT);
 }
 
 static int image_cycle_render_slot_exec(bContext *C, wmOperator *op)
 {
-	Image *ima= CTX_data_edit_image(C);
-	int a, slot, cur= ima->render_slot;
-	const short use_reverse= RNA_boolean_get(op->ptr, "reverse");
+	Image *ima = CTX_data_edit_image(C);
+	int a, slot, cur = ima->render_slot;
+	const short use_reverse = RNA_boolean_get(op->ptr, "reverse");
 
-	for(a=1; a<IMA_MAX_RENDER_SLOT; a++) {
-		slot= (cur + (use_reverse ? -a:a))%IMA_MAX_RENDER_SLOT;
-		if(slot<0) slot+=IMA_MAX_RENDER_SLOT;
+	for (a = 1; a < IMA_MAX_RENDER_SLOT; a++) {
+		slot = (cur + (use_reverse ? -a : a)) % IMA_MAX_RENDER_SLOT;
+		if (slot < 0) slot += IMA_MAX_RENDER_SLOT;
 
-		if(ima->renders[slot] || slot == ima->last_render_slot) {
-			ima->render_slot= slot;
-			break;
-		}
-		else if((slot - 1) == ima->last_render_slot && slot < IMA_MAX_RENDER_SLOT) {
-			ima->render_slot= slot;
+		if (ima->renders[slot] || slot == ima->last_render_slot) {
+			ima->render_slot = slot;
 			break;
 		}
 	}
 
-	if(a == IMA_MAX_RENDER_SLOT)
-		ima->render_slot= ((cur == 1)? 0: 1);
+	if (a == IMA_MAX_RENDER_SLOT)
+		ima->render_slot = ((cur == 1) ? 0 : 1);
 	
-	WM_event_add_notifier(C, NC_IMAGE|ND_DRAW, NULL);
+	WM_event_add_notifier(C, NC_IMAGE | ND_DRAW, NULL);
 
 	/* no undo push for browsing existing */
-	if(ima->renders[ima->render_slot] || ima->render_slot==ima->last_render_slot)
+	if (ima->renders[ima->render_slot] || ima->render_slot == ima->last_render_slot)
 		return OPERATOR_CANCELLED;
 	
 	return OPERATOR_FINISHED;
@@ -2309,15 +2359,15 @@ static int image_cycle_render_slot_exec(bContext *C, wmOperator *op)
 void IMAGE_OT_cycle_render_slot(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Cycle Render Slot";
-	ot->idname= "IMAGE_OT_cycle_render_slot";
+	ot->name = "Cycle Render Slot";
+	ot->idname = "IMAGE_OT_cycle_render_slot";
 	
 	/* api callbacks */
-	ot->exec= image_cycle_render_slot_exec;
-	ot->poll= image_cycle_render_slot_poll;
+	ot->exec = image_cycle_render_slot_exec;
+	ot->poll = image_cycle_render_slot_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	RNA_def_boolean(ot->srna, "reverse", 0, "Cycle in Reverse", "");
 }
@@ -2335,42 +2385,42 @@ void ED_image_update_frame(const Main *mainp, int cfra)
 	Tex *tex;
 	
 	/* texture users */
-	for(tex= mainp->tex.first; tex; tex= tex->id.next) {
-		if(tex->type==TEX_IMAGE && tex->ima) {
-			if(ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
-				if(tex->iuser.flag & IMA_ANIM_ALWAYS)
+	for (tex = mainp->tex.first; tex; tex = tex->id.next) {
+		if (tex->type == TEX_IMAGE && tex->ima) {
+			if (ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
+				if (tex->iuser.flag & IMA_ANIM_ALWAYS)
 					BKE_image_user_calc_frame(&tex->iuser, cfra, 0);
 			}
 		}
 	}
 	
 	/* image window, compo node users */
-	for(wm=mainp->wm.first; wm; wm= wm->id.next) { /* only 1 wm */
-		for(win= wm->windows.first; win; win= win->next) {
+	for (wm = mainp->wm.first; wm; wm = wm->id.next) { /* only 1 wm */
+		for (win = wm->windows.first; win; win = win->next) {
 			ScrArea *sa;
-			for(sa= win->screen->areabase.first; sa; sa= sa->next) {
-				if(sa->spacetype==SPACE_VIEW3D) {
-					View3D *v3d= sa->spacedata.first;
+			for (sa = win->screen->areabase.first; sa; sa = sa->next) {
+				if (sa->spacetype == SPACE_VIEW3D) {
+					View3D *v3d = sa->spacedata.first;
 					BGpic *bgpic;
-					for(bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next)
-						if(bgpic->iuser.flag & IMA_ANIM_ALWAYS)
+					for (bgpic = v3d->bgpicbase.first; bgpic; bgpic = bgpic->next)
+						if (bgpic->iuser.flag & IMA_ANIM_ALWAYS)
 							BKE_image_user_calc_frame(&bgpic->iuser, cfra, 0);
 				}
-				else if(sa->spacetype==SPACE_IMAGE) {
-					SpaceImage *sima= sa->spacedata.first;
-					if(sima->iuser.flag & IMA_ANIM_ALWAYS)
+				else if (sa->spacetype == SPACE_IMAGE) {
+					SpaceImage *sima = sa->spacedata.first;
+					if (sima->iuser.flag & IMA_ANIM_ALWAYS)
 						BKE_image_user_calc_frame(&sima->iuser, cfra, 0);
 				}
-				else if(sa->spacetype==SPACE_NODE) {
-					SpaceNode *snode= sa->spacedata.first;
-					if((snode->treetype==NTREE_COMPOSIT) && (snode->nodetree)) {
+				else if (sa->spacetype == SPACE_NODE) {
+					SpaceNode *snode = sa->spacedata.first;
+					if ((snode->treetype == NTREE_COMPOSIT) && (snode->nodetree)) {
 						bNode *node;
-						for(node= snode->nodetree->nodes.first; node; node= node->next) {
-							if(node->id && node->type==CMP_NODE_IMAGE) {
-								Image *ima= (Image *)node->id;
-								ImageUser *iuser= node->storage;
-								if(ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE))
-									if(iuser->flag & IMA_ANIM_ALWAYS)
+						for (node = snode->nodetree->nodes.first; node; node = node->next) {
+							if (node->id && node->type == CMP_NODE_IMAGE) {
+								Image *ima = (Image *)node->id;
+								ImageUser *iuser = node->storage;
+								if (ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE))
+									if (iuser->flag & IMA_ANIM_ALWAYS)
 										BKE_image_user_calc_frame(iuser, cfra, 0);
 							}
 						}
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 3a57934..08aa69f 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -32,6 +32,7 @@
 #include <string.h>
 #include <stdio.h>
 
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
@@ -40,7 +41,6 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
-#include "BLI_editVert.h"
 #include "BLI_rand.h"
 #include "BLI_utildefines.h"
 
@@ -52,6 +52,7 @@
 #include "BKE_mesh.h"
 #include "BKE_scene.h"
 #include "BKE_screen.h"
+#include "BKE_tessmesh.h"
 
 #include "IMB_imbuf_types.h"
 
@@ -87,38 +88,38 @@ void ED_space_image_set(SpaceImage *sima, Scene *scene, Object *obedit, Image *i
 	/* context may be NULL, so use global */
 	ED_uvedit_assign_image(G.main, scene, obedit, ima, sima->image);
 	
-	/* change the space ima after because uvedit_face_visible uses the space ima
+	/* change the space ima after because uvedit_face_visible_test uses the space ima
 	 * to check if the face is displayed in UV-localview */
-	sima->image= ima;
+	sima->image = ima;
 	
-	if(ima == NULL || ima->type==IMA_TYPE_R_RESULT || ima->type==IMA_TYPE_COMPOSITE)
+	if (ima == NULL || ima->type == IMA_TYPE_R_RESULT || ima->type == IMA_TYPE_COMPOSITE)
 		sima->flag &= ~SI_DRAWTOOL;
 	
-	if(sima->image)
+	if (sima->image)
 		BKE_image_signal(sima->image, &sima->iuser, IMA_SIGNAL_USER_NEW_IMAGE);
 	
-	if(sima->image && sima->image->id.us==0)
-		sima->image->id.us= 1;
+	if (sima->image && sima->image->id.us == 0)
+		sima->image->id.us = 1;
 	
-	if(obedit)
-		WM_main_add_notifier(NC_GEOM|ND_DATA, obedit->data);
+	if (obedit)
+		WM_main_add_notifier(NC_GEOM | ND_DATA, obedit->data);
 
-	WM_main_add_notifier(NC_SPACE|ND_SPACE_IMAGE, NULL);
+	WM_main_add_notifier(NC_SPACE | ND_SPACE_IMAGE, NULL);
 }
 
 ImBuf *ED_space_image_acquire_buffer(SpaceImage *sima, void **lock_r)
 {
 	ImBuf *ibuf;
 	
-	if(sima && sima->image) {
+	if (sima && sima->image) {
 #if 0
-		if(sima->image->type==IMA_TYPE_R_RESULT && BIF_show_render_spare())
+		if (sima->image->type == IMA_TYPE_R_RESULT && BIF_show_render_spare())
 			return BIF_render_spare_imbuf();
 		else
 #endif
-			ibuf= BKE_image_acquire_ibuf(sima->image, &sima->iuser, lock_r);
+		ibuf = BKE_image_acquire_ibuf(sima->image, &sima->iuser, lock_r);
 		
-		if(ibuf && (ibuf->rect || ibuf->rect_float))
+		if (ibuf && (ibuf->rect || ibuf->rect_float))
 			return ibuf;
 	}
 	
@@ -127,7 +128,7 @@ ImBuf *ED_space_image_acquire_buffer(SpaceImage *sima, void **lock_r)
 
 void ED_space_image_release_buffer(SpaceImage *sima, void *lock)
 {
-	if(sima && sima->image)
+	if (sima && sima->image)
 		BKE_image_release_ibuf(sima->image, lock);
 }
 
@@ -137,8 +138,8 @@ int ED_space_image_has_buffer(SpaceImage *sima)
 	void *lock;
 	int has_buffer;
 	
-	ibuf= ED_space_image_acquire_buffer(sima, &lock);
-	has_buffer= (ibuf != NULL);
+	ibuf = ED_space_image_acquire_buffer(sima, &lock);
+	has_buffer = (ibuf != NULL);
 	ED_space_image_release_buffer(sima, lock);
 	
 	return has_buffer;
@@ -146,53 +147,53 @@ int ED_space_image_has_buffer(SpaceImage *sima)
 
 void ED_image_size(Image *ima, int *width, int *height)
 {
-	ImBuf *ibuf= NULL;
+	ImBuf *ibuf = NULL;
 	void *lock;
 	
-	if(ima)
-		ibuf= BKE_image_acquire_ibuf(ima, NULL, &lock);
+	if (ima)
+		ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
 	
-	if(ibuf && ibuf->x > 0 && ibuf->y > 0) {
-		*width= ibuf->x;
-		*height= ibuf->y;
+	if (ibuf && ibuf->x > 0 && ibuf->y > 0) {
+		*width = ibuf->x;
+		*height = ibuf->y;
 	}
 	else {
-		*width= 256;
-		*height= 256;
+		*width = 256;
+		*height = 256;
 	}
 	
-	if(ima)
+	if (ima)
 		BKE_image_release_ibuf(ima, lock);
 }
 
 void ED_space_image_size(SpaceImage *sima, int *width, int *height)
 {
-	Scene *scene= sima->iuser.scene;
+	Scene *scene = sima->iuser.scene;
 	ImBuf *ibuf;
 	void *lock;
 	
-	ibuf= ED_space_image_acquire_buffer(sima, &lock);
+	ibuf = ED_space_image_acquire_buffer(sima, &lock);
 	
-	if(ibuf && ibuf->x > 0 && ibuf->y > 0) {
-		*width= ibuf->x;
-		*height= ibuf->y;
+	if (ibuf && ibuf->x > 0 && ibuf->y > 0) {
+		*width = ibuf->x;
+		*height = ibuf->y;
 	}
-	else if(sima->image && sima->image->type==IMA_TYPE_R_RESULT && scene) {
+	else if (sima->image && sima->image->type == IMA_TYPE_R_RESULT && scene) {
 		/* not very important, just nice */
-		*width= (scene->r.xsch*scene->r.size)/100;
-		*height= (scene->r.ysch*scene->r.size)/100;
+		*width = (scene->r.xsch * scene->r.size) / 100;
+		*height = (scene->r.ysch * scene->r.size) / 100;
 
-		if((scene->r.mode & R_BORDER) && (scene->r.mode & R_CROP)) {
+		if ((scene->r.mode & R_BORDER) && (scene->r.mode & R_CROP)) {
 			*width *= (scene->r.border.xmax - scene->r.border.xmin);
 			*height *= (scene->r.border.ymax - scene->r.border.ymin);
 		}
 
 	}
 	/* I know a bit weak... but preview uses not actual image size */
-	// XXX else if(image_preview_active(sima, width, height));
+	// XXX else if (image_preview_active(sima, width, height));
 	else {
-		*width= 256;
-		*height= 256;
+		*width = 256;
+		*height = 256;
 	}
 	
 	ED_space_image_release_buffer(sima, lock);
@@ -200,14 +201,14 @@ void ED_space_image_size(SpaceImage *sima, int *width, int *height)
 
 void ED_image_aspect(Image *ima, float *aspx, float *aspy)
 {
-	*aspx= *aspy= 1.0;
+	*aspx = *aspy = 1.0;
 	
-	if((ima == NULL) || (ima->type == IMA_TYPE_R_RESULT) || (ima->type == IMA_TYPE_COMPOSITE) ||
-	   (ima->aspx==0.0f || ima->aspy==0.0f))
+	if ((ima == NULL) || (ima->type == IMA_TYPE_R_RESULT) || (ima->type == IMA_TYPE_COMPOSITE) ||
+	    (ima->aspx == 0.0f || ima->aspy == 0.0f))
 		return;
 	
 	/* x is always 1 */
-	*aspy = ima->aspy/ima->aspx;
+	*aspy = ima->aspy / ima->aspx;
 }
 
 void ED_space_image_aspect(SpaceImage *sima, float *aspx, float *aspy)
@@ -221,8 +222,8 @@ void ED_space_image_zoom(SpaceImage *sima, ARegion *ar, float *zoomx, float *zoo
 	
 	ED_space_image_size(sima, &width, &height);
 	
-	*zoomx= (float)(ar->winrct.xmax - ar->winrct.xmin + 1)/(float)((ar->v2d.cur.xmax - ar->v2d.cur.xmin)*width);
-	*zoomy= (float)(ar->winrct.ymax - ar->winrct.ymin + 1)/(float)((ar->v2d.cur.ymax - ar->v2d.cur.ymin)*height);
+	*zoomx = (float)(ar->winrct.xmax - ar->winrct.xmin + 1) / (float)((ar->v2d.cur.xmax - ar->v2d.cur.xmin) * width);
+	*zoomy = (float)(ar->winrct.ymax - ar->winrct.ymin + 1) / (float)((ar->v2d.cur.ymax - ar->v2d.cur.ymin) * height);
 }
 
 void ED_space_image_uv_aspect(SpaceImage *sima, float *aspx, float *aspy)
@@ -235,13 +236,13 @@ void ED_space_image_uv_aspect(SpaceImage *sima, float *aspx, float *aspy)
 	*aspx *= (float)w;
 	*aspy *= (float)h;
 	
-	if(*aspx < *aspy) {
-		*aspy= *aspy / *aspx;
-		*aspx= 1.0f;
+	if (*aspx < *aspy) {
+		*aspy = *aspy / *aspx;
+		*aspx = 1.0f;
 	}
 	else {
-		*aspx= *aspx / *aspy;
-		*aspy= 1.0f;		
+		*aspx = *aspx / *aspy;
+		*aspy = 1.0f;
 	}
 }
 
@@ -263,7 +264,7 @@ int ED_space_image_show_render(SpaceImage *sima)
 
 int ED_space_image_show_paint(SpaceImage *sima)
 {
-	if(ED_space_image_show_render(sima))
+	if (ED_space_image_show_render(sima))
 		return 0;
 	
 	return (sima->flag & SI_DRAWTOOL);
@@ -271,16 +272,15 @@ int ED_space_image_show_paint(SpaceImage *sima)
 
 int ED_space_image_show_uvedit(SpaceImage *sima, Object *obedit)
 {
-	if(sima && (ED_space_image_show_render(sima) || ED_space_image_show_paint(sima)))
+	if (sima && (ED_space_image_show_render(sima) || ED_space_image_show_paint(sima)))
 		return 0;
 
-	if(obedit && obedit->type == OB_MESH) {
-		EditMesh *em = BKE_mesh_get_editmesh(obedit->data);
+	if (obedit && obedit->type == OB_MESH) {
+		struct BMEditMesh *em = BMEdit_FromObject(obedit);
 		int ret;
 		
-		ret = EM_texFaceCheck(em);
+		ret = EDBM_mtexpoly_check(em);
 		
-		BKE_mesh_end_editmesh(obedit->data, em);
 		return ret;
 	}
 	
@@ -289,17 +289,16 @@ int ED_space_image_show_uvedit(SpaceImage *sima, Object *obedit)
 
 int ED_space_image_show_uvshadow(SpaceImage *sima, Object *obedit)
 {
-	if(ED_space_image_show_render(sima))
+	if (ED_space_image_show_render(sima))
 		return 0;
 	
-	if(ED_space_image_show_paint(sima))
-		if(obedit && obedit->type == OB_MESH) {
-			EditMesh *em = BKE_mesh_get_editmesh(obedit->data);
+	if (ED_space_image_show_paint(sima))
+		if (obedit && obedit->type == OB_MESH) {
+			struct BMEditMesh *em = BMEdit_FromObject(obedit);
 			int ret;
 			
-			ret = EM_texFaceCheck(em);
+			ret = EDBM_mtexpoly_check(em);
 			
-			BKE_mesh_end_editmesh(obedit->data, em);
 			return ret;
 		}
 	
@@ -309,16 +308,16 @@ int ED_space_image_show_uvshadow(SpaceImage *sima, Object *obedit)
 
 static void image_scopes_tag_refresh(ScrArea *sa)
 {
-	SpaceImage *sima= (SpaceImage *)sa->spacedata.first;
+	SpaceImage *sima = (SpaceImage *)sa->spacedata.first;
 	ARegion *ar;
 
 	/* only while histogram is visible */
-	for (ar=sa->regionbase.first; ar; ar=ar->next) {
+	for (ar = sa->regionbase.first; ar; ar = ar->next) {
 		if (ar->regiontype == RGN_TYPE_PREVIEW && ar->flag & RGN_FLAG_HIDDEN)
 			return;
 	}
 
-	sima->scopes.ok=0;
+	sima->scopes.ok = 0;
 }
 
 
@@ -328,20 +327,20 @@ ARegion *image_has_buttons_region(ScrArea *sa)
 {
 	ARegion *ar, *arnew;
 
-	ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
-	if(ar) return ar;
+	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");
+	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;
 	
@@ -352,20 +351,20 @@ ARegion *image_has_scope_region(ScrArea *sa)
 {
 	ARegion *ar, *arnew;
 
-	ar= BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW);
-	if(ar) return ar;
+	ar = BKE_area_find_region_type(sa, RGN_TYPE_PREVIEW);
+	if (ar) return ar;
 
 	/* add subdiv level; after buttons */
-	ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
+	ar = BKE_area_find_region_type(sa, RGN_TYPE_UI);
 
 	/* is error! */
-	if(ar==NULL) return NULL;
+	if (ar == NULL) return NULL;
 	
-	arnew= MEM_callocN(sizeof(ARegion), "scopes for image");
+	arnew = MEM_callocN(sizeof(ARegion), "scopes for image");
 	
 	BLI_insertlinkafter(&sa->regionbase, ar, arnew);
-	arnew->regiontype= RGN_TYPE_PREVIEW;
-	arnew->alignment= RGN_ALIGN_RIGHT;
+	arnew->regiontype = RGN_TYPE_PREVIEW;
+	arnew->alignment = RGN_ALIGN_RIGHT;
 	
 	arnew->flag = RGN_FLAG_HIDDEN;
 
@@ -381,46 +380,46 @@ static SpaceLink *image_new(const bContext *UNUSED(C))
 	ARegion *ar;
 	SpaceImage *simage;
 	
-	simage= MEM_callocN(sizeof(SpaceImage), "initimage");
-	simage->spacetype= SPACE_IMAGE;
-	simage->zoom= 1;
-	simage->lock= 1;
-	
-	simage->iuser.ok= 1;
-	simage->iuser.fie_ima= 2;
-	simage->iuser.frames= 100;
+	simage = MEM_callocN(sizeof(SpaceImage), "initimage");
+	simage->spacetype = SPACE_IMAGE;
+	simage->zoom = 1;
+	simage->lock = 1;
+
+	simage->iuser.ok = 1;
+	simage->iuser.fie_ima = 2;
+	simage->iuser.frames = 100;
 	
 	scopes_new(&simage->scopes);
-	simage->sample_line_hist.height= 100;
+	simage->sample_line_hist.height = 100;
 
 	/* header */
-	ar= MEM_callocN(sizeof(ARegion), "header for image");
+	ar = MEM_callocN(sizeof(ARegion), "header for image");
 	
 	BLI_addtail(&simage->regionbase, ar);
-	ar->regiontype= RGN_TYPE_HEADER;
-	ar->alignment= RGN_ALIGN_BOTTOM;
+	ar->regiontype = RGN_TYPE_HEADER;
+	ar->alignment = RGN_ALIGN_BOTTOM;
 	
 	/* buttons/list view */
-	ar= MEM_callocN(sizeof(ARegion), "buttons for image");
+	ar = MEM_callocN(sizeof(ARegion), "buttons for image");
 	
 	BLI_addtail(&simage->regionbase, ar);
-	ar->regiontype= RGN_TYPE_UI;
-	ar->alignment= RGN_ALIGN_LEFT;
+	ar->regiontype = RGN_TYPE_UI;
+	ar->alignment = RGN_ALIGN_LEFT;
 	ar->flag = RGN_FLAG_HIDDEN;
 	
 	/* scopes */
-	ar= MEM_callocN(sizeof(ARegion), "buttons for image");
+	ar = MEM_callocN(sizeof(ARegion), "buttons for image");
 	
 	BLI_addtail(&simage->regionbase, ar);
-	ar->regiontype= RGN_TYPE_PREVIEW;
-	ar->alignment= RGN_ALIGN_RIGHT;
+	ar->regiontype = RGN_TYPE_PREVIEW;
+	ar->alignment = RGN_ALIGN_RIGHT;
 	ar->flag = RGN_FLAG_HIDDEN;
 
 	/* main area */
-	ar= MEM_callocN(sizeof(ARegion), "main area for image");
+	ar = MEM_callocN(sizeof(ARegion), "main area for image");
 	
 	BLI_addtail(&simage->regionbase, ar);
-	ar->regiontype= RGN_TYPE_WINDOW;
+	ar->regiontype = RGN_TYPE_WINDOW;
 	
 	return (SpaceLink *)simage;
 }
@@ -428,9 +427,9 @@ static SpaceLink *image_new(const bContext *UNUSED(C))
 /* not spacelink itself */
 static void image_free(SpaceLink *sl)
 {	
-	SpaceImage *simage= (SpaceImage*) sl;
+	SpaceImage *simage = (SpaceImage *) sl;
 	
-	if(simage->cumap)
+	if (simage->cumap)
 		curvemapping_free(simage->cumap);
 	scopes_free(&simage->scopes);
 }
@@ -439,7 +438,7 @@ static void image_free(SpaceLink *sl)
 /* spacetype; init callback, add handlers */
 static void image_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
 {
-	ListBase *lb= WM_dropboxmap_find("Image", SPACE_IMAGE, 0);
+	ListBase *lb = WM_dropboxmap_find("Image", SPACE_IMAGE, 0);
 
 	/* add drop boxes */
 	WM_event_add_dropbox_handler(&sa->handlers, lb);
@@ -448,11 +447,11 @@ static void image_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa)
 
 static SpaceLink *image_duplicate(SpaceLink *sl)
 {
-	SpaceImage *simagen= MEM_dupallocN(sl);
+	SpaceImage *simagen = MEM_dupallocN(sl);
 	
 	/* clear or remove stuff from old */
-	if(simagen->cumap)
-		simagen->cumap= curvemapping_copy(simagen->cumap);
+	if (simagen->cumap)
+		simagen->cumap = curvemapping_copy(simagen->cumap);
 
 	scopes_new(&simagen->scopes);
 
@@ -496,8 +495,9 @@ static void image_operatortypes(void)
 
 static void image_keymap(struct wmKeyConfig *keyconf)
 {
-	wmKeyMap *keymap= WM_keymap_find(keyconf, "Image Generic", SPACE_IMAGE, 0);
+	wmKeyMap *keymap = WM_keymap_find(keyconf, "Image Generic", SPACE_IMAGE, 0);
 	wmKeyMapItem *kmi;
+	int i;
 	
 	WM_keymap_add_item(keymap, "IMAGE_OT_new", NKEY, KM_PRESS, KM_ALT, 0);
 	WM_keymap_add_item(keymap, "IMAGE_OT_open", OKEY, KM_PRESS, KM_ALT, 0);
@@ -510,7 +510,7 @@ static void image_keymap(struct wmKeyConfig *keyconf)
 	WM_keymap_add_item(keymap, "IMAGE_OT_cycle_render_slot", JKEY, KM_PRESS, 0, 0);
 	RNA_boolean_set(WM_keymap_add_item(keymap, "IMAGE_OT_cycle_render_slot", JKEY, KM_PRESS, KM_ALT, 0)->ptr, "reverse", TRUE);
 	
-	keymap= WM_keymap_find(keyconf, "Image", SPACE_IMAGE, 0);
+	keymap = WM_keymap_find(keyconf, "Image", SPACE_IMAGE, 0);
 	
 	WM_keymap_add_item(keymap, "IMAGE_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
 	WM_keymap_add_item(keymap, "IMAGE_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
@@ -541,16 +541,23 @@ static void image_keymap(struct wmKeyConfig *keyconf)
 	RNA_enum_set(WM_keymap_add_item(keymap, "IMAGE_OT_curves_point_set", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "point", 1);
 
 	/* toggle editmode is handy to have while UV unwrapping */
-	kmi= WM_keymap_add_item(keymap, "OBJECT_OT_mode_set", TABKEY, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "OBJECT_OT_mode_set", TABKEY, KM_PRESS, 0, 0);
 	RNA_enum_set(kmi->ptr, "mode", OB_MODE_EDIT);
 	RNA_boolean_set(kmi->ptr, "toggle", TRUE);
+
+	/* fast switch to render slots */
+	for (i = 0; i < MAX2(IMA_MAX_RENDER_SLOT, 9); i++) {
+		kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_int", ONEKEY+i, KM_PRESS, 0, 0);
+		RNA_string_set(kmi->ptr, "data_path", "space_data.image.render_slot");
+		RNA_int_set(kmi->ptr, "value", i);
+	}
 }
 
 /* dropboxes */
 static int image_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
 {
-	if(drag->type==WM_DRAG_PATH)
-		if(ELEM3(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_BLANK))	/* rule might not work? */
+	if (drag->type == WM_DRAG_PATH)
+		if (ELEM3(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_BLANK)) /* rule might not work? */
 			return 1;
 	return 0;
 }
@@ -564,7 +571,7 @@ static void image_drop_copy(wmDrag *drag, wmDropBox *drop)
 /* area+region dropbox definition */
 static void image_dropboxes(void)
 {
-	ListBase *lb= WM_dropboxmap_find("Image", SPACE_IMAGE, 0);
+	ListBase *lb = WM_dropboxmap_find("Image", SPACE_IMAGE, 0);
 	
 	WM_dropbox_add(lb, "IMAGE_OT_open", image_drop_poll, image_drop_copy);
 }
@@ -574,65 +581,63 @@ static void image_dropboxes(void)
 static void image_refresh(const bContext *C, ScrArea *UNUSED(sa))
 {
 	Scene *scene = CTX_data_scene(C);
-	SpaceImage *sima= CTX_wm_space_image(C);
-	Object *obedit= CTX_data_edit_object(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
+	Object *obedit = CTX_data_edit_object(C);
 	Image *ima;
 
-	ima= ED_space_image(sima);
+	ima = ED_space_image(sima);
 
-	if(sima->iuser.flag & IMA_ANIM_ALWAYS)
+	if (sima->iuser.flag & IMA_ANIM_ALWAYS)
 		BKE_image_user_calc_frame(&sima->iuser, scene->r.cfra, 0);
 	
 	/* check if we have to set the image from the editmesh */
-	if(ima && (ima->source==IMA_SRC_VIEWER || sima->pin));
-	else if(obedit && obedit->type == OB_MESH) {
-		Mesh *me= (Mesh*)obedit->data;
-		EditMesh *em= BKE_mesh_get_editmesh(me);
-		int sloppy= 1; /* partially selected face is ok */
+	if (ima && (ima->source == IMA_SRC_VIEWER || sima->pin)) ;
+	else if (obedit && obedit->type == OB_MESH) {
+		Mesh *me = (Mesh *)obedit->data;
+		struct BMEditMesh *em = me->edit_btmesh;
+		int sloppy = 1; /* partially selected face is ok */
 
-		if(scene_use_new_shading_nodes(scene)) {
+		if (scene_use_new_shading_nodes(scene)) {
 			/* new shading system, get image from material */
-			EditFace *efa= EM_get_actFace(em, sloppy);
+			BMFace *efa = BM_active_face_get(em->bm, sloppy);
 
-			if(efa) {
+			if (efa) {
 				Image *node_ima;
-				ED_object_get_active_image(obedit, efa->mat_nr, &node_ima, NULL, NULL);
+				ED_object_get_active_image(obedit, efa->mat_nr + 1, &node_ima, NULL, NULL);
 
-				if(node_ima)
-					sima->image= node_ima;
+				if (node_ima)
+					sima->image = node_ima;
 			}
 		}
 		else {
 			/* old shading system, we set texface */
-			MTFace *tf;
+			MTexPoly *tf;
 			
-			if(em && EM_texFaceCheck(em)) {
-				sima->image= NULL;
+			if (em && EDBM_mtexpoly_check(em)) {
+				sima->image = NULL;
 				
-				tf = EM_get_active_mtface(em, NULL, NULL, sloppy);
+				tf = EDBM_mtexpoly_active_get(em, NULL, TRUE); /* partially selected face is ok */
 				
-				if(tf) {
+				if (tf) {
 					/* don't need to check for pin here, see above */
-					sima->image= tf->tpage;
+					sima->image = tf->tpage;
 					
-					if(sima->flag & SI_EDITTILE);
-					else sima->curtile= tf->tile;
+					if (sima->flag & SI_EDITTILE) ;
+					else sima->curtile = tf->tile;
 				}
 			}
 		}
-
-		BKE_mesh_end_editmesh(obedit->data, em);
 	}
 }
 
 static void image_listener(ScrArea *sa, wmNotifier *wmn)
 {
-	SpaceImage *sima= (SpaceImage *)sa->spacedata.first;
+	SpaceImage *sima = (SpaceImage *)sa->spacedata.first;
 	
 	/* context changes */
-	switch(wmn->category) {
+	switch (wmn->category) {
 		case NC_SCENE:
-			switch(wmn->data) {
+			switch (wmn->data) {
 				case ND_FRAME:
 					image_scopes_tag_refresh(sa);
 					ED_area_tag_refresh(sa);
@@ -656,13 +661,13 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn)
 			}
 			break;
 		case NC_SPACE:	
-			if(wmn->data == ND_SPACE_IMAGE) {
+			if (wmn->data == ND_SPACE_IMAGE) {
 				image_scopes_tag_refresh(sa);
 				ED_area_tag_redraw(sa);
 			}
 			break;
 		case NC_GEOM:
-			switch(wmn->data) {
+			switch (wmn->data) {
 				case ND_DATA:
 				case ND_SELECT:
 					image_scopes_tag_refresh(sa);
@@ -672,11 +677,11 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn)
 			}
 		case NC_OBJECT:
 		{
-			Object *ob= (Object *)wmn->reference;
-			switch(wmn->data) {
+			Object *ob = (Object *)wmn->reference;
+			switch (wmn->data) {
 				case ND_TRANSFORM:
 				case ND_MODIFIER:
-					if(ob && (ob->mode & OB_MODE_EDIT) && sima->lock && (sima->flag & SI_DRAWSHADOW)) {
+					if (ob && (ob->mode & OB_MODE_EDIT) && sima->lock && (sima->flag & SI_DRAWSHADOW)) {
 						ED_area_tag_refresh(sa);
 						ED_area_tag_redraw(sa);
 					}
@@ -690,13 +695,13 @@ const char *image_context_dir[] = {"edit_image", NULL};
 
 static int image_context(const bContext *C, const char *member, bContextDataResult *result)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
 
-	if(CTX_data_dir(member)) {
+	if (CTX_data_dir(member)) {
 		CTX_data_dir_set(result, image_context_dir);
 	}
-	else if(CTX_data_equals(member, "edit_image")) {
-		CTX_data_id_pointer_set(result, (ID*)ED_space_image(sima));
+	else if (CTX_data_equals(member, "edit_image")) {
+		CTX_data_id_pointer_set(result, (ID *)ED_space_image(sima));
 		return 1;
 	}
 
@@ -708,48 +713,48 @@ static int image_context(const bContext *C, const char *member, bContextDataResu
 /* sets up the fields of the View2D from zoom and offset */
 static void image_main_area_set_view2d(SpaceImage *sima, ARegion *ar)
 {
-	Image *ima= ED_space_image(sima);
+	Image *ima = ED_space_image(sima);
 	float x1, y1, w, h;
 	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_size(sima, &width, &height);
 
-	w= width;
-	h= height;
+	w = width;
+	h = height;
 	
-	if(ima)
-		h *= ima->aspy/ima->aspx;
+	if (ima)
+		h *= ima->aspy / ima->aspx;
 
-	winx= ar->winrct.xmax - ar->winrct.xmin + 1;
-	winy= ar->winrct.ymax - ar->winrct.ymin + 1;
+	winx = ar->winrct.xmax - ar->winrct.xmin + 1;
+	winy = ar->winrct.ymax - ar->winrct.ymin + 1;
 		
-	ar->v2d.tot.xmin= 0;
-	ar->v2d.tot.ymin= 0;
-	ar->v2d.tot.xmax= w;
-	ar->v2d.tot.ymax= h;
+	ar->v2d.tot.xmin = 0;
+	ar->v2d.tot.ymin = 0;
+	ar->v2d.tot.xmax = w;
+	ar->v2d.tot.ymax = h;
 	
-	ar->v2d.mask.xmin= ar->v2d.mask.ymin= 0;
-	ar->v2d.mask.xmax= winx;
-	ar->v2d.mask.ymax= winy;
+	ar->v2d.mask.xmin = ar->v2d.mask.ymin = 0;
+	ar->v2d.mask.xmax = winx;
+	ar->v2d.mask.ymax = winy;
 
 	/* which part of the image space do we see? */
-	x1= ar->winrct.xmin+(winx-sima->zoom*w)/2.0f;
-	y1= ar->winrct.ymin+(winy-sima->zoom*h)/2.0f;
+	x1 = ar->winrct.xmin + (winx - sima->zoom * w) / 2.0f;
+	y1 = ar->winrct.ymin + (winy - sima->zoom * h) / 2.0f;
 
-	x1-= sima->zoom*sima->xof;
-	y1-= sima->zoom*sima->yof;
+	x1 -= sima->zoom * sima->xof;
+	y1 -= sima->zoom * sima->yof;
 	
 	/* relative display right */
-	ar->v2d.cur.xmin= ((ar->winrct.xmin - (float)x1)/sima->zoom);
-	ar->v2d.cur.xmax= ar->v2d.cur.xmin + ((float)winx/sima->zoom);
+	ar->v2d.cur.xmin = ((ar->winrct.xmin - (float)x1) / sima->zoom);
+	ar->v2d.cur.xmax = ar->v2d.cur.xmin + ((float)winx / sima->zoom);
 	
 	/* relative display left */
-	ar->v2d.cur.ymin= ((ar->winrct.ymin-(float)y1)/sima->zoom);
-	ar->v2d.cur.ymax= ar->v2d.cur.ymin + ((float)winy/sima->zoom);
+	ar->v2d.cur.ymin = ((ar->winrct.ymin - (float)y1) / sima->zoom);
+	ar->v2d.cur.ymax = ar->v2d.cur.ymin + ((float)winy / sima->zoom);
 	
 	/* normalize 0.0..1.0 */
 	ar->v2d.cur.xmin /= w;
@@ -767,19 +772,19 @@ static void image_main_area_init(wmWindowManager *wm, ARegion *ar)
 	// UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
 
 	/* image paint polls for mode */
-	keymap= WM_keymap_find(wm->defaultconf, "Image Paint", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Image Paint", 0, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 
-	keymap= WM_keymap_find(wm->defaultconf, "UV Editor", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "UV Editor", 0, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 	
-	keymap= WM_keymap_find(wm->defaultconf, "UV Sculpt", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "UV Sculpt", 0, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 
 	/* own keymaps */
-	keymap= WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
-	keymap= WM_keymap_find(wm->defaultconf, "Image", SPACE_IMAGE, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Image", SPACE_IMAGE, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 
 }
@@ -787,11 +792,11 @@ static void image_main_area_init(wmWindowManager *wm, ARegion *ar)
 static void image_main_area_draw(const bContext *C, ARegion *ar)
 {
 	/* draw entirely, view changes should be handled here */
-	SpaceImage *sima= CTX_wm_space_image(C);
-	Object *obact= CTX_data_active_object(C);
-	Object *obedit= CTX_data_edit_object(C);
-	Scene *scene= CTX_data_scene(C);
-	View2D *v2d= &ar->v2d;
+	SpaceImage *sima = CTX_wm_space_image(C);
+	Object *obact = CTX_data_active_object(C);
+	Object *obedit = CTX_data_edit_object(C);
+	Scene *scene = CTX_data_scene(C);
+	View2D *v2d = &ar->v2d;
 	//View2DScrollers *scrollers;
 	float col[3];
 	
@@ -804,7 +809,7 @@ static void image_main_area_draw(const bContext *C, ARegion *ar)
 	glClear(GL_COLOR_BUFFER_BIT);
 
 	/* put scene context variable in iuser */
-	sima->iuser.scene= scene;
+	sima->iuser.scene = scene;
 
 	/* we set view2d from own zoom and offset each time */
 	image_main_area_set_view2d(sima, ar);
@@ -827,19 +832,21 @@ static void image_main_area_draw(const bContext *C, ARegion *ar)
 	draw_image_grease_pencil((bContext *)C, 0);
 	
 	/* scrollers? */
-	/*scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_UNIT_VALUES, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
+#if 0
+	scrollers = UI_view2d_scrollers_calc(C, v2d, V2D_UNIT_VALUES, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
 	UI_view2d_scrollers_draw(C, v2d, scrollers);
-	UI_view2d_scrollers_free(scrollers);*/
+	UI_view2d_scrollers_free(scrollers);
+#endif
 }
 
 static void image_main_area_listener(ARegion *ar, wmNotifier *wmn)
 {
 	/* context changes */
-	switch(wmn->category) {
+	switch (wmn->category) {
 		case NC_SCREEN:
-			if (wmn->data==ND_GPENCIL)
+			if (wmn->data == ND_GPENCIL)
 				ED_region_tag_redraw(ar);
-		break;
+			break;
 	}
 }
 
@@ -852,7 +859,7 @@ static void image_buttons_area_init(wmWindowManager *wm, ARegion *ar)
 
 	ED_region_panels_init(wm, ar);
 	
-	keymap= WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
@@ -864,15 +871,21 @@ static void image_buttons_area_draw(const bContext *C, ARegion *ar)
 static void image_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
 {
 	/* context changes */
-	switch(wmn->category) {
+	switch (wmn->category) {
 		case NC_SCREEN:
-			if (wmn->data==ND_GPENCIL)
+			if (wmn->data == ND_GPENCIL)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_BRUSH:
-			if(wmn->action==NA_EDITED)
+			if (wmn->action == NA_EDITED)
 				ED_region_tag_redraw(ar);
 			break;
+		case NC_TEXTURE:
+		case NC_MATERIAL:
+			/* sending by texture render job and needed to properly update displaying
+			 * brush texture icon */
+			ED_region_tag_redraw(ar);
+			break;
 	}
 }
 
@@ -885,18 +898,18 @@ static void image_scope_area_init(wmWindowManager *wm, ARegion *ar)
 	
 	ED_region_panels_init(wm, ar);
 	
-	keymap= WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Image Generic", SPACE_IMAGE, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
 static void image_scope_area_draw(const bContext *C, ARegion *ar)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	Scene *scene= CTX_data_scene(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
+	Scene *scene = CTX_data_scene(C);
 	void *lock;
-	ImBuf *ibuf= ED_space_image_acquire_buffer(sima, &lock);
-	if(ibuf) {
-		scopes_update(&sima->scopes, ibuf, scene->r.color_mgt_flag & R_COLOR_MANAGEMENT );
+	ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock);
+	if (ibuf) {
+		scopes_update(&sima->scopes, ibuf, scene->r.color_mgt_flag & R_COLOR_MANAGEMENT);
 	}
 	ED_space_image_release_buffer(sima, lock);
 	
@@ -906,9 +919,9 @@ static void image_scope_area_draw(const bContext *C, ARegion *ar)
 static void image_scope_area_listener(ARegion *ar, wmNotifier *wmn)
 {
 	/* context changes */
-	switch(wmn->category) {
+	switch (wmn->category) {
 		case NC_SCENE:
-			switch(wmn->data) {
+			switch (wmn->data) {
 				case ND_MODE:
 				case ND_RENDER_RESULT:
 				case ND_COMPO_RESULT:
@@ -942,9 +955,9 @@ static void image_header_area_draw(const bContext *C, ARegion *ar)
 static void image_header_area_listener(ARegion *ar, wmNotifier *wmn)
 {
 	/* context changes */
-	switch(wmn->category) {
+	switch (wmn->category) {
 		case NC_SCENE:
-			switch(wmn->data) {
+			switch (wmn->data) {
 				case ND_MODE:
 				case ND_TOOLSETTINGS:
 					ED_region_tag_redraw(ar);
@@ -952,7 +965,7 @@ static void image_header_area_listener(ARegion *ar, wmNotifier *wmn)
 			}
 			break;
 		case NC_GEOM:
-			switch(wmn->data) {
+			switch (wmn->data) {
 				case ND_DATA:
 				case ND_SELECT:
 					ED_region_tag_redraw(ar);
@@ -967,64 +980,64 @@ static void image_header_area_listener(ARegion *ar, wmNotifier *wmn)
 /* only called once, from space/spacetypes.c */
 void ED_spacetype_image(void)
 {
-	SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype image");
+	SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype image");
 	ARegionType *art;
 	
-	st->spaceid= SPACE_IMAGE;
+	st->spaceid = SPACE_IMAGE;
 	strncpy(st->name, "Image", BKE_ST_MAXNAME);
 	
-	st->new= image_new;
-	st->free= image_free;
-	st->init= image_init;
-	st->duplicate= image_duplicate;
-	st->operatortypes= image_operatortypes;
-	st->keymap= image_keymap;
-	st->dropboxes= image_dropboxes;
-	st->refresh= image_refresh;
-	st->listener= image_listener;
-	st->context= image_context;
+	st->new = image_new;
+	st->free = image_free;
+	st->init = image_init;
+	st->duplicate = image_duplicate;
+	st->operatortypes = image_operatortypes;
+	st->keymap = image_keymap;
+	st->dropboxes = image_dropboxes;
+	st->refresh = image_refresh;
+	st->listener = image_listener;
+	st->context = image_context;
 	
 	/* regions: main window */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype image region");
+	art = MEM_callocN(sizeof(ARegionType), "spacetype image region");
 	art->regionid = RGN_TYPE_WINDOW;
-	art->keymapflag= ED_KEYMAP_FRAMES|ED_KEYMAP_GPENCIL;
-	art->init= image_main_area_init;
-	art->draw= image_main_area_draw;
-	art->listener= image_main_area_listener;
+	art->keymapflag = ED_KEYMAP_FRAMES | ED_KEYMAP_GPENCIL;
+	art->init = image_main_area_init;
+	art->draw = image_main_area_draw;
+	art->listener = image_main_area_listener;
 
 	BLI_addhead(&st->regiontypes, art);
 	
 	/* regions: listview/buttons */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype image region");
+	art = MEM_callocN(sizeof(ARegionType), "spacetype image region");
 	art->regionid = RGN_TYPE_UI;
-	art->prefsizex= 220; // XXX
-	art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES;
-	art->listener= image_buttons_area_listener;
-	art->init= image_buttons_area_init;
-	art->draw= image_buttons_area_draw;
+	art->prefsizex = 220; // XXX
+	art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES;
+	art->listener = image_buttons_area_listener;
+	art->init = image_buttons_area_init;
+	art->draw = image_buttons_area_draw;
 	BLI_addhead(&st->regiontypes, art);
 
 	image_buttons_register(art);
 	ED_uvedit_buttons_register(art);
 	
 	/* regions: statistics/scope buttons */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype image region");
+	art = MEM_callocN(sizeof(ARegionType), "spacetype image region");
 	art->regionid = RGN_TYPE_PREVIEW;
-	art->prefsizex= 220; // XXX
-	art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES;
-	art->listener= image_scope_area_listener;
-	art->init= image_scope_area_init;
-	art->draw= image_scope_area_draw;
+	art->prefsizex = 220; // XXX
+	art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES;
+	art->listener = image_scope_area_listener;
+	art->init = image_scope_area_init;
+	art->draw = image_scope_area_draw;
 	BLI_addhead(&st->regiontypes, art);
 
 	/* regions: header */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype image region");
+	art = MEM_callocN(sizeof(ARegionType), "spacetype image region");
 	art->regionid = RGN_TYPE_HEADER;
-	art->prefsizey= HEADERY;
-	art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
-	art->listener= image_header_area_listener;
-	art->init= image_header_area_init;
-	art->draw= image_header_area_draw;
+	art->prefsizey = HEADERY;
+	art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER;
+	art->listener = image_header_area_listener;
+	art->init = image_header_area_init;
+	art->draw = image_header_area_draw;
 	
 	BLI_addhead(&st->regiontypes, art);
 	
diff --git a/source/blender/editors/space_info/CMakeLists.txt b/source/blender/editors/space_info/CMakeLists.txt
index 4c1c13c..94b40a9 100644
--- a/source/blender/editors/space_info/CMakeLists.txt
+++ b/source/blender/editors/space_info/CMakeLists.txt
@@ -25,6 +25,7 @@ set(INC
 	../../blenlib
 	../../blenloader
 	../../imbuf
+	../../bmesh
 	../../makesdna
 	../../makesrna
 	../../windowmanager
@@ -47,4 +48,8 @@ set(SRC
 	textview.h
 )
 
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
 blender_add_lib(bf_editor_space_info "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_info/SConscript b/source/blender/editors/space_info/SConscript
index 697ee43..e4746ae 100644
--- a/source/blender/editors/space_info/SConscript
+++ b/source/blender/editors/space_info/SConscript
@@ -4,8 +4,11 @@ Import ('env')
 sources = env.Glob('*.c')
 
 incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../makesrna ../../imbuf ../../blenfont'
-incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include ../../blenloader'
+incs += ' ../../bmesh ../../windowmanager #/intern/guardedalloc #/extern/glew/include ../../blenloader'
 
 defs = []
 
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
+
 env.BlenderLib ( 'bf_editors_space_info', sources, Split(incs), defs, libtype=['core'], priority=[70] )
diff --git a/source/blender/editors/space_info/info_draw.c b/source/blender/editors/space_info/info_draw.c
index d2be3bd..2409ab8 100644
--- a/source/blender/editors/space_info/info_draw.c
+++ b/source/blender/editors/space_info/info_draw.c
@@ -65,43 +65,43 @@
 
 static void info_report_color(unsigned char *fg, unsigned char *bg, Report *report, int bool)
 {
-	if(report->flag & SELECT) {
-		fg[0]=255; fg[1]=255; fg[2]=255;
-		if(bool) {
-			bg[0]=96; bg[1]=128; bg[2]=255;
+	if (report->flag & SELECT) {
+		fg[0] = 255; fg[1] = 255; fg[2] = 255;
+		if (bool) {
+			bg[0] = 96; bg[1] = 128; bg[2] = 255;
 		}
 		else {
-			bg[0]=90; bg[1]=122; bg[2]=249;
+			bg[0] = 90; bg[1] = 122; bg[2] = 249;
 		}
 	}
 	else {
-		fg[0]=0; fg[1]=0; fg[2]=0;
+		fg[0] = 0; fg[1] = 0; fg[2] = 0;
 		
 		if (report->type & RPT_ERROR_ALL) {
-			if (bool) { bg[0]=220; bg[1]=0;   bg[2]=0;   }
-			else      { bg[0]=214; bg[1]=0;   bg[2]=0;   }
+			if (bool) { bg[0] = 220; bg[1] = 0;   bg[2] = 0;   }
+			else      { bg[0] = 214; bg[1] = 0;   bg[2] = 0;   }
 		}
 		else if (report->type & RPT_WARNING_ALL) {
-			if (bool) { bg[0]=220; bg[1]=128; bg[2]=96;  }
-			else      { bg[0]=214; bg[1]=122; bg[2]=90;  }
+			if (bool) { bg[0] = 220; bg[1] = 128; bg[2] = 96;  }
+			else      { bg[0] = 214; bg[1] = 122; bg[2] = 90;  }
 		}
 #if 0 // XXX: this looks like the selected color, so don't use this
 		else if (report->type & RPT_OPERATOR_ALL) {
-			if (bool) { bg[0]=96;  bg[1]=128; bg[2]=255; }
-			else      { bg[0]=90;  bg[1]=122; bg[2]=249; }
+			if (bool) { bg[0] = 96;  bg[1] = 128; bg[2] = 255; }
+			else      { bg[0] = 90;  bg[1] = 122; bg[2] = 249; }
 		}
 #endif
 		else if (report->type & RPT_INFO_ALL) {
-			if (bool) { bg[0]=0;   bg[1]=170; bg[2]=0;   }
-			else      { bg[0]=0;   bg[1]=164; bg[2]=0;   }
+			if (bool) { bg[0] = 0;   bg[1] = 170; bg[2] = 0;   }
+			else      { bg[0] = 0;   bg[1] = 164; bg[2] = 0;   }
 		}
 		else if (report->type & RPT_DEBUG_ALL) {
-			if (bool) { bg[0]=196; bg[1]=196; bg[2]=196; }
-			else      { bg[0]=190; bg[1]=190; bg[2]=190; }
+			if (bool) { bg[0] = 196; bg[1] = 196; bg[2] = 196; }
+			else      { bg[0] = 190; bg[1] = 190; bg[2] = 190; }
 		}
 		else {
-			if (bool) { bg[0]=120; bg[1]=120; bg[2]=120; }
-			else      { bg[0]=114; bg[1]=114; bg[2]=114; }
+			if (bool) { bg[0] = 120; bg[1] = 120; bg[2] = 120; }
+			else      { bg[0] = 114; bg[1] = 114; bg[2] = 114; }
 		}
 	}
 }
@@ -110,24 +110,24 @@ static void info_report_color(unsigned char *fg, unsigned char *bg, Report *repo
 #ifdef USE_INFO_NEWLINE
 static void report_textview_init__internal(TextViewContext *tvc)
 {
-	Report *report= (Report *)tvc->iter;
-	const char *str= report->message;
-	const char *next_str= strchr(str + tvc->iter_char, '\n');
+	Report *report = (Report *)tvc->iter;
+	const char *str = report->message;
+	const char *next_str = strchr(str + tvc->iter_char, '\n');
 
-	if(next_str) {
-		tvc->iter_char_next= (int)(next_str - str);
+	if (next_str) {
+		tvc->iter_char_next = (int)(next_str - str);
 	}
 	else {
-		tvc->iter_char_next= report->len;
+		tvc->iter_char_next = report->len;
 	}
 }
 
 static int report_textview_skip__internal(TextViewContext *tvc)
 {
-	SpaceInfo *sinfo= (SpaceInfo *)tvc->arg1;
-	const int report_mask= info_report_mask(sinfo);
-	while (tvc->iter && (((Report *)tvc->iter)->type & report_mask)==0) {
-		tvc->iter= (void *)((Link *)tvc->iter)->prev;
+	SpaceInfo *sinfo = (SpaceInfo *)tvc->arg1;
+	const int report_mask = info_report_mask(sinfo);
+	while (tvc->iter && (((Report *)tvc->iter)->type & report_mask) == 0) {
+		tvc->iter = (void *)((Link *)tvc->iter)->prev;
 	}
 	return (tvc->iter != NULL);
 }
@@ -137,23 +137,23 @@ static int report_textview_skip__internal(TextViewContext *tvc)
 static int report_textview_begin(TextViewContext *tvc)
 {
 	// SpaceConsole *sc= (SpaceConsole *)tvc->arg1;
-	ReportList *reports= (ReportList *)tvc->arg2;
+	ReportList *reports = (ReportList *)tvc->arg2;
 
-	tvc->lheight= 14; //sc->lheight;
-	tvc->sel_start= 0;
-	tvc->sel_end= 0;
+	tvc->lheight = 14; //sc->lheight;
+	tvc->sel_start = 0;
+	tvc->sel_end = 0;
 
 	/* iterator */
-	tvc->iter= reports->list.last;
+	tvc->iter = reports->list.last;
 
-	glClearColor(120.0/255.0, 120.0/255.0, 120.0/255.0, 1.0);
+	glClearColor(120.0 / 255.0, 120.0 / 255.0, 120.0 / 255.0, 1.0);
 	glClear(GL_COLOR_BUFFER_BIT);
 
 #ifdef USE_INFO_NEWLINE
-	tvc->iter_tmp= 0;
-	if(tvc->iter && report_textview_skip__internal(tvc)) {
+	tvc->iter_tmp = 0;
+	if (tvc->iter && report_textview_skip__internal(tvc)) {
 		/* init the newline iterator */
-		tvc->iter_char= 0;
+		tvc->iter_char = 0;
 		report_textview_init__internal(tvc);
 
 		return TRUE;
@@ -175,14 +175,14 @@ static void report_textview_end(TextViewContext *UNUSED(tvc))
 static int report_textview_step(TextViewContext *tvc)
 {
 	/* simple case, but no newline support */
-	Report *report= (Report *)tvc->iter;
+	Report *report = (Report *)tvc->iter;
 
-	if(report->len <= tvc->iter_char_next) {
-		tvc->iter= (void *)((Link *)tvc->iter)->prev;
-		if(tvc->iter && report_textview_skip__internal(tvc)) {
+	if (report->len <= tvc->iter_char_next) {
+		tvc->iter = (void *)((Link *)tvc->iter)->prev;
+		if (tvc->iter && report_textview_skip__internal(tvc)) {
 			tvc->iter_tmp++;
 
-			tvc->iter_char= 0; /* reset start */
+			tvc->iter_char = 0; /* reset start */
 			report_textview_init__internal(tvc);
 
 			return TRUE;
@@ -193,7 +193,7 @@ static int report_textview_step(TextViewContext *tvc)
 	}
 	else {
 		/* step to the next newline */
-		tvc->iter_char= tvc->iter_char_next + 1;
+		tvc->iter_char = tvc->iter_char_next + 1;
 		report_textview_init__internal(tvc);
 
 		return TRUE;
@@ -202,15 +202,15 @@ static int report_textview_step(TextViewContext *tvc)
 
 static int report_textview_line_get(struct TextViewContext *tvc, const char **line, int *len)
 {
-	Report *report= (Report *)tvc->iter;
-	*line= report->message + tvc->iter_char;
-	*len= tvc->iter_char_next - tvc->iter_char;
+	Report *report = (Report *)tvc->iter;
+	*line = report->message + tvc->iter_char;
+	*len = tvc->iter_char_next - tvc->iter_char;
 	return 1;
 }
 
 static int report_textview_line_color(struct TextViewContext *tvc, unsigned char fg[3], unsigned char bg[3])
 {
-	Report *report= (Report *)tvc->iter;
+	Report *report = (Report *)tvc->iter;
 	info_report_color(fg, bg, report, tvc->iter_tmp % 2);
 	return TVC_LINE_FG | TVC_LINE_BG;
 }
@@ -220,27 +220,27 @@ static int report_textview_line_color(struct TextViewContext *tvc, unsigned char
 
 static int report_textview_step(TextViewContext *tvc)
 {
-	SpaceInfo *sinfo= (SpaceInfo *)tvc->arg1;
-	const int report_mask= info_report_mask(sinfo);
+	SpaceInfo *sinfo = (SpaceInfo *)tvc->arg1;
+	const int report_mask = info_report_mask(sinfo);
 	do {
-		tvc->iter= (void *)((Link *)tvc->iter)->prev;
-	} while (tvc->iter && (((Report *)tvc->iter)->type & report_mask)==0);
+		tvc->iter = (void *)((Link *)tvc->iter)->prev;
+	} while (tvc->iter && (((Report *)tvc->iter)->type & report_mask) == 0);
 
 	return (tvc->iter != NULL);
 }
 
 static int report_textview_line_get(struct TextViewContext *tvc, const char **line, int *len)
 {
-	Report *report= (Report *)tvc->iter;
-	*line= report->message;
-	*len= report->len;
+	Report *report = (Report *)tvc->iter;
+	*line = report->message;
+	*len = report->len;
 
 	return 1;
 }
 
 static int report_textview_line_color(struct TextViewContext *tvc, unsigned char fg[3], unsigned char bg[3])
 {
-	Report *report= (Report *)tvc->iter;
+	Report *report = (Report *)tvc->iter;
 	info_report_color(fg, bg, report, tvc->iter_tmp % 2);
 	return TVC_LINE_FG | TVC_LINE_BG;
 }
@@ -251,41 +251,41 @@ static int report_textview_line_color(struct TextViewContext *tvc, unsigned char
 
 static int info_textview_main__internal(struct SpaceInfo *sinfo, struct ARegion *ar, ReportList *reports, int draw, int mval[2], void **mouse_pick, int *pos_pick)
 {
-	int ret= 0;
+	int ret = 0;
 	
-	View2D *v2d= &ar->v2d;
+	View2D *v2d = &ar->v2d;
 
-	TextViewContext tvc= {0};
-	tvc.begin= report_textview_begin;
-	tvc.end= report_textview_end;
+	TextViewContext tvc = {0};
+	tvc.begin = report_textview_begin;
+	tvc.end = report_textview_end;
 
-	tvc.step= report_textview_step;
-	tvc.line_get= report_textview_line_get;
-	tvc.line_color= report_textview_line_color;
+	tvc.step = report_textview_step;
+	tvc.line_get = report_textview_line_get;
+	tvc.line_color = report_textview_line_color;
 
-	tvc.arg1= sinfo;
-	tvc.arg2= reports;
+	tvc.arg1 = sinfo;
+	tvc.arg2 = reports;
 
 	/* view */
-	tvc.sel_start= 0;
-	tvc.sel_end= 0;
-	tvc.lheight= 14; //sc->lheight;
-	tvc.ymin= v2d->cur.ymin;
-	tvc.ymax= v2d->cur.ymax;
-	tvc.winx= ar->winx;
-
-	ret= textview_draw(&tvc, draw, mval, mouse_pick, pos_pick);
+	tvc.sel_start = 0;
+	tvc.sel_end = 0;
+	tvc.lheight = 14; //sc->lheight;
+	tvc.ymin = v2d->cur.ymin;
+	tvc.ymax = v2d->cur.ymax;
+	tvc.winx = ar->winx;
+
+	ret = textview_draw(&tvc, draw, mval, mouse_pick, pos_pick);
 	
 	return ret;
 }
 
 void *info_text_pick(struct SpaceInfo *sinfo, struct ARegion *ar, ReportList *reports, int mouse_y)
 {
-	void *mouse_pick= NULL;
+	void *mouse_pick = NULL;
 	int mval[2];
 
-	mval[0]= 0;
-	mval[1]= mouse_y;
+	mval[0] = 0;
+	mval[1] = mouse_y;
 
 	info_textview_main__internal(sinfo, ar, reports, 0, mval, &mouse_pick, NULL);
 	return (void *)mouse_pick;
diff --git a/source/blender/editors/space_info/info_intern.h b/source/blender/editors/space_info/info_intern.h
index fc0615a..80018e8 100644
--- a/source/blender/editors/space_info/info_intern.h
+++ b/source/blender/editors/space_info/info_intern.h
@@ -28,8 +28,8 @@
  *  \ingroup spinfo
  */
 
-#ifndef ED_INFO_INTERN_H
-#define ED_INFO_INTERN_H
+#ifndef __INFO_INTERN_H__
+#define __INFO_INTERN_H__
 
 /* internal exports only */
 
@@ -61,4 +61,4 @@ void INFO_OT_report_replay(struct wmOperatorType *ot);
 void INFO_OT_report_delete(struct wmOperatorType *ot);
 void INFO_OT_report_copy(struct wmOperatorType *ot);
 
-#endif /* ED_INFO_INTERN_H */
+#endif /* __INFO_INTERN_H__ */
diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c
index 54e8b1b..5256fc8 100644
--- a/source/blender/editors/space_info/info_ops.c
+++ b/source/blender/editors/space_info/info_ops.c
@@ -70,7 +70,7 @@
 
 static int pack_all_exec(bContext *C, wmOperator *op)
 {
-	Main *bmain= CTX_data_main(C);
+	Main *bmain = CTX_data_main(C);
 
 	packAll(bmain, op->reports);
 	G.fileflags |= G_AUTOPACK;
@@ -80,21 +80,21 @@ static int pack_all_exec(bContext *C, wmOperator *op)
 
 static int pack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	Main *bmain= CTX_data_main(C);
+	Main *bmain = CTX_data_main(C);
 	Image *ima;
 	ImBuf *ibuf;
 
 	// 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);
+	for (ima = bmain->image.first; ima; ima = ima->id.next) {
+		if (ima->ibufs.first) { /* XXX FIX */
+			ibuf = BKE_image_get_ibuf(ima, NULL);
 			
-			if(ibuf && (ibuf->userflags & IB_BITMAPDIRTY))
+			if (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))
 				break;
 		}
 	}
 
-	if(ima) {
+	if (ima) {
 		uiPupMenuOkee(C, "FILE_OT_pack_all", "Some images are painted on. These changes will be lost. Continue?");
 		return OPERATOR_CANCELLED;
 	}
@@ -105,15 +105,15 @@ static int pack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 void FILE_OT_pack_all(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Pack All";
-	ot->idname= "FILE_OT_pack_all";
+	ot->name = "Pack All";
+	ot->idname = "FILE_OT_pack_all";
 	
 	/* api callbacks */
-	ot->exec= pack_all_exec;
-	ot->invoke= pack_all_invoke;
+	ot->exec = pack_all_exec;
+	ot->invoke = pack_all_invoke;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /********************* unpack all operator *********************/
@@ -129,10 +129,10 @@ static const EnumPropertyItem unpack_all_method_items[] = {
 
 static int unpack_all_exec(bContext *C, wmOperator *op)
 {
-	Main *bmain= CTX_data_main(C);
-	int method= RNA_enum_get(op->ptr, "method");
+	Main *bmain = CTX_data_main(C);
+	int method = RNA_enum_get(op->ptr, "method");
 
-	if(method != PF_KEEP) unpackAll(bmain, op->reports, method); /* XXX PF_ASK can't work here */
+	if (method != PF_KEEP) unpackAll(bmain, op->reports, method);  /* XXX PF_ASK can't work here */
 	G.fileflags &= ~G_AUTOPACK;
 
 	return OPERATOR_FINISHED;
@@ -140,7 +140,7 @@ static int unpack_all_exec(bContext *C, wmOperator *op)
 
 static int unpack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	Main *bmain= CTX_data_main(C);
+	Main *bmain = CTX_data_main(C);
 	uiPopupMenu *pup;
 	uiLayout *layout;
 	char title[64];
@@ -148,19 +148,19 @@ static int unpack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
 	
 	count = countPackedFiles(bmain);
 	
-	if(!count) {
+	if (!count) {
 		BKE_report(op->reports, RPT_WARNING, "No packed files. Autopack disabled");
 		G.fileflags &= ~G_AUTOPACK;
 		return OPERATOR_CANCELLED;
 	}
 
-	if(count == 1)
+	if (count == 1)
 		strcpy(title, "Unpack 1 file");
 	else
 		BLI_snprintf(title, sizeof(title), "Unpack %d files", count);
 	
-	pup= uiPupMenuBegin(C, title, ICON_NONE);
-	layout= uiPupMenuLayout(pup);
+	pup = uiPupMenuBegin(C, title, ICON_NONE);
+	layout = uiPupMenuLayout(pup);
 
 	uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
 	uiItemsEnumO(layout, "FILE_OT_unpack_all", "method");
@@ -173,15 +173,15 @@ static int unpack_all_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)
 void FILE_OT_unpack_all(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Unpack All";
-	ot->idname= "FILE_OT_unpack_all";
+	ot->name = "Unpack All";
+	ot->idname = "FILE_OT_unpack_all";
 	
 	/* api callbacks */
-	ot->exec= unpack_all_exec;
-	ot->invoke= unpack_all_invoke;
+	ot->exec = unpack_all_exec;
+	ot->invoke = unpack_all_invoke;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "method", unpack_all_method_items, PF_USE_LOCAL, "Method", "How to unpack");
@@ -191,9 +191,9 @@ void FILE_OT_unpack_all(wmOperatorType *ot)
 
 static int make_paths_relative_exec(bContext *C, wmOperator *op)
 {
-	Main *bmain= CTX_data_main(C);
+	Main *bmain = CTX_data_main(C);
 
-	if(!G.relbase_valid) {
+	if (!G.relbase_valid) {
 		BKE_report(op->reports, RPT_WARNING, "Can't set relative paths with an unsaved blend file");
 		return OPERATOR_CANCELLED;
 	}
@@ -209,23 +209,23 @@ static int make_paths_relative_exec(bContext *C, wmOperator *op)
 void FILE_OT_make_paths_relative(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Make All Paths Relative";
-	ot->idname= "FILE_OT_make_paths_relative";
+	ot->name = "Make All Paths Relative";
+	ot->idname = "FILE_OT_make_paths_relative";
 	
 	/* api callbacks */
-	ot->exec= make_paths_relative_exec;
+	ot->exec = make_paths_relative_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /********************* make paths absolute operator *********************/
 
 static int make_paths_absolute_exec(bContext *C, wmOperator *op)
 {
-	Main *bmain= CTX_data_main(C);
+	Main *bmain = CTX_data_main(C);
 
-	if(!G.relbase_valid) {
+	if (!G.relbase_valid) {
 		BKE_report(op->reports, RPT_WARNING, "Can't set absolute paths with an unsaved blend file");
 		return OPERATOR_CANCELLED;
 	}
@@ -241,21 +241,21 @@ static int make_paths_absolute_exec(bContext *C, wmOperator *op)
 void FILE_OT_make_paths_absolute(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Make All Paths Absolute";
-	ot->idname= "FILE_OT_make_paths_absolute";
+	ot->name = "Make All Paths Absolute";
+	ot->idname = "FILE_OT_make_paths_absolute";
 	
 	/* api callbacks */
-	ot->exec= make_paths_absolute_exec;
+	ot->exec = make_paths_absolute_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /********************* report missing files operator *********************/
 
 static int report_missing_files_exec(bContext *C, wmOperator *op)
 {
-	Main *bmain= CTX_data_main(C);
+	Main *bmain = CTX_data_main(C);
 
 	/* run the missing file check */
 	checkMissingFiles(bmain, op->reports);
@@ -266,22 +266,22 @@ static int report_missing_files_exec(bContext *C, wmOperator *op)
 void FILE_OT_report_missing_files(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Report Missing Files";
-	ot->idname= "FILE_OT_report_missing_files";
+	ot->name = "Report Missing Files";
+	ot->idname = "FILE_OT_report_missing_files";
 	
 	/* api callbacks */
-	ot->exec= report_missing_files_exec;
+	ot->exec = report_missing_files_exec;
 
 	/* flags */
-	ot->flag= 0; /* only reports so no need to undo/register */
+	ot->flag = 0; /* only reports so no need to undo/register */
 }
 
 /********************* find missing files operator *********************/
 
 static int find_missing_files_exec(bContext *C, wmOperator *op)
 {
-	Main *bmain= CTX_data_main(C);
-	const char *searchpath= RNA_string_get_alloc(op->ptr, "filepath", NULL, 0);
+	Main *bmain = CTX_data_main(C);
+	const char *searchpath = RNA_string_get_alloc(op->ptr, "filepath", NULL, 0);
 	findMissingFiles(bmain, searchpath, op->reports);
 	MEM_freeN((void *)searchpath);
 
@@ -298,15 +298,15 @@ static int find_missing_files_invoke(bContext *C, wmOperator *op, wmEvent *UNUSE
 void FILE_OT_find_missing_files(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Find Missing Files";
-	ot->idname= "FILE_OT_find_missing_files";
+	ot->name = "Find Missing Files";
+	ot->idname = "FILE_OT_find_missing_files";
 	
 	/* api callbacks */
-	ot->exec= find_missing_files_exec;
-	ot->invoke= find_missing_files_invoke;
+	ot->exec = find_missing_files_exec;
+	ot->invoke = find_missing_files_invoke;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* properties */
 	WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
@@ -321,71 +321,74 @@ void FILE_OT_find_missing_files(wmOperatorType *ot)
  * inactive regions, so use this for now. --matt
  */
 
-#define INFO_TIMEOUT		5.0f
-#define INFO_COLOR_TIMEOUT	3.0f
-#define ERROR_TIMEOUT		10.0f
-#define ERROR_COLOR_TIMEOUT	6.0f
-#define COLLAPSE_TIMEOUT	0.25f
+#define INFO_TIMEOUT        5.0f
+#define INFO_COLOR_TIMEOUT  3.0f
+#define ERROR_TIMEOUT       10.0f
+#define ERROR_COLOR_TIMEOUT 6.0f
+#define COLLAPSE_TIMEOUT    0.25f
 static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
-	ReportList *reports= CTX_wm_reports(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
+	ReportList *reports = CTX_wm_reports(C);
 	Report *report;
 	ReportTimerInfo *rti;
-	float progress=0.0, color_progress=0.0;
+	float progress = 0.0, color_progress = 0.0;
 	float neutral_col[3] = {0.35, 0.35, 0.35};
-	float neutral_grey= 0.6;
-	float timeout=0.0, color_timeout=0.0;
-	int send_note= 0;
+	float neutral_grey = 0.6;
+	float timeout = 0.0, color_timeout = 0.0;
+	int send_note = 0;
 	
 	/* escape if not our timer */
-	if(		(reports->reporttimer==NULL) ||
-			(reports->reporttimer != event->customdata) ||
-			((report= BKE_reports_last_displayable(reports))==NULL) /* may have been deleted */
-	) {
+	if ((reports->reporttimer == NULL) ||
+	    (reports->reporttimer != event->customdata) ||
+	    ((report = BKE_reports_last_displayable(reports)) == NULL) /* may have been deleted */
+	    )
+	{
 		return OPERATOR_PASS_THROUGH;
 	}
 
 	rti = (ReportTimerInfo *)reports->reporttimer->customdata;
 	
-	timeout = (report->type & RPT_ERROR_ALL)?ERROR_TIMEOUT:INFO_TIMEOUT;
-	color_timeout = (report->type & RPT_ERROR_ALL)?ERROR_COLOR_TIMEOUT:INFO_COLOR_TIMEOUT;
+	timeout = (report->type & RPT_ERROR_ALL) ? ERROR_TIMEOUT : INFO_TIMEOUT;
+	color_timeout = (report->type & RPT_ERROR_ALL) ? ERROR_COLOR_TIMEOUT : INFO_COLOR_TIMEOUT;
 	
 	/* clear the report display after timeout */
 	if ((float)reports->reporttimer->duration > timeout) {
 		WM_event_remove_timer(wm, NULL, reports->reporttimer);
 		reports->reporttimer = NULL;
 		
-		WM_event_add_notifier(C, NC_SPACE|ND_SPACE_INFO, NULL);
+		WM_event_add_notifier(C, NC_SPACE | ND_SPACE_INFO, NULL);
 		
-		return (OPERATOR_FINISHED|OPERATOR_PASS_THROUGH);
+		return (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH);
 	}
 
 	if (rti->widthfac == 0.0f) {
-		/* initialise colors based on report type */
-		if(report->type & RPT_ERROR_ALL) {
+		/* initialize colors based on report type */
+		if (report->type & RPT_ERROR_ALL) {
 			rti->col[0] = 1.0;
 			rti->col[1] = 0.2;
 			rti->col[2] = 0.0;
-		} else if(report->type & RPT_WARNING_ALL) {
+		}
+		else if (report->type & RPT_WARNING_ALL) {
 			rti->col[0] = 1.0;
 			rti->col[1] = 1.0;
 			rti->col[2] = 0.0;
-		} else if(report->type & RPT_INFO_ALL) {
+		}
+		else if (report->type & RPT_INFO_ALL) {
 			rti->col[0] = 0.3;
 			rti->col[1] = 0.45;
 			rti->col[2] = 0.7;
 		}
 		rti->greyscale = 0.75;
-		rti->widthfac=1.0;
+		rti->widthfac = 1.0;
 	}
 	
 	progress = (float)reports->reporttimer->duration / timeout;
 	color_progress = (float)reports->reporttimer->duration / color_timeout;
 	
 	/* save us from too many draws */
-	if(color_progress <= 1.0f) {
-		send_note= 1;
+	if (color_progress <= 1.0f) {
+		send_note = 1;
 		
 		/* fade colors out sharply according to progress through fade-out duration */
 		interp_v3_v3v3(rti->col, rti->col, neutral_col, color_progress);
@@ -393,30 +396,30 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm
 	}
 
 	/* collapse report at end of timeout */
-	if (progress*timeout > timeout - COLLAPSE_TIMEOUT) {
-		rti->widthfac = (progress*timeout - (timeout - COLLAPSE_TIMEOUT)) / COLLAPSE_TIMEOUT;
+	if (progress * timeout > timeout - COLLAPSE_TIMEOUT) {
+		rti->widthfac = (progress * timeout - (timeout - COLLAPSE_TIMEOUT)) / COLLAPSE_TIMEOUT;
 		rti->widthfac = 1.0f - rti->widthfac;
-		send_note= 1;
+		send_note = 1;
 	}
 	
-	if(send_note) {
-		WM_event_add_notifier(C, NC_SPACE|ND_SPACE_INFO, NULL);
+	if (send_note) {
+		WM_event_add_notifier(C, NC_SPACE | ND_SPACE_INFO, NULL);
 	}
 	
-	return (OPERATOR_FINISHED|OPERATOR_PASS_THROUGH);
+	return (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH);
 }
 
 void INFO_OT_reports_display_update(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Update Reports Display";
-	ot->idname= "INFO_OT_reports_display_update";
+	ot->name = "Update Reports Display";
+	ot->idname = "INFO_OT_reports_display_update";
 	
 	/* api callbacks */
-	ot->invoke= update_reports_display_invoke;
+	ot->invoke = update_reports_display_invoke;
 	
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 	
 	/* properties */
 }
diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c
index 206639f..46cd253 100644
--- a/source/blender/editors/space_info/info_report.c
+++ b/source/blender/editors/space_info/info_report.c
@@ -53,16 +53,16 @@ int info_report_mask(SpaceInfo *UNUSED(sinfo))
 #if 0
 	int report_mask = 0;
 
-	if(sinfo->rpt_mask & INFO_RPT_DEBUG)	report_mask |= RPT_DEBUG_ALL;
-	if(sinfo->rpt_mask & INFO_RPT_INFO)		report_mask |= RPT_INFO_ALL;
-	if(sinfo->rpt_mask & INFO_RPT_OP)		report_mask |= RPT_OPERATOR_ALL;
-	if(sinfo->rpt_mask & INFO_RPT_WARN)		report_mask |= RPT_WARNING_ALL;
-	if(sinfo->rpt_mask & INFO_RPT_ERR)		report_mask |= RPT_ERROR_ALL;
+	if (sinfo->rpt_mask & INFO_RPT_DEBUG) report_mask |= RPT_DEBUG_ALL;
+	if (sinfo->rpt_mask & INFO_RPT_INFO)  report_mask |= RPT_INFO_ALL;
+	if (sinfo->rpt_mask & INFO_RPT_OP)    report_mask |= RPT_OPERATOR_ALL;
+	if (sinfo->rpt_mask & INFO_RPT_WARN)  report_mask |= RPT_WARNING_ALL;
+	if (sinfo->rpt_mask & INFO_RPT_ERR)   report_mask |= RPT_ERROR_ALL;
 
 	return report_mask;
 #endif
 
-	return RPT_DEBUG_ALL|RPT_INFO_ALL|RPT_OPERATOR_ALL|RPT_WARNING_ALL|RPT_ERROR_ALL;
+	return RPT_DEBUG_ALL | RPT_INFO_ALL | RPT_OPERATOR_ALL | RPT_WARNING_ALL | RPT_ERROR_ALL;
 }
 
 // TODO, get this working again!
@@ -74,10 +74,10 @@ static int report_replay_exec(bContext *C, wmOperator *UNUSED(op))
 //	Report *report;
 
 #if 0
-	sc->type= CONSOLE_TYPE_PYTHON;
+	sc->type = CONSOLE_TYPE_PYTHON;
 
-	for(report=reports->list.last; report; report=report->prev) {
-		if((report->type & report_mask) && (report->type & RPT_OPERATOR_ALL) && (report->flag & SELECT)) {
+	for (report = reports->list.last; report; report = report->prev) {
+		if ((report->type & report_mask) && (report->type & RPT_OPERATOR_ALL) && (report->flag & SELECT)) {
 			console_history_add_str(sc, report->message, 0);
 			WM_operator_name_call(C, "CONSOLE_OT_execute", WM_OP_EXEC_DEFAULT, NULL);
 
@@ -85,7 +85,7 @@ static int report_replay_exec(bContext *C, wmOperator *UNUSED(op))
 		}
 	}
 
-	sc->type= CONSOLE_TYPE_REPORT;
+	sc->type = CONSOLE_TYPE_REPORT;
 #endif
 	ED_area_tag_redraw(CTX_wm_area(C));
 
@@ -95,26 +95,26 @@ static int report_replay_exec(bContext *C, wmOperator *UNUSED(op))
 void INFO_OT_report_replay(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Replay Operators";
-	ot->description= "Replay selected reports";
-	ot->idname= "INFO_OT_report_replay";
+	ot->name = "Replay Operators";
+	ot->description = "Replay selected reports";
+	ot->idname = "INFO_OT_report_replay";
 
 	/* api callbacks */
-	ot->poll= ED_operator_info_active;
-	ot->exec= report_replay_exec;
+	ot->poll = ED_operator_info_active;
+	ot->exec = report_replay_exec;
 
 	/* flags */
-	/* ot->flag= OPTYPE_REGISTER; */
+	/* ot->flag = OPTYPE_REGISTER; */
 
 	/* properties */
 }
 
 static int select_report_pick_exec(bContext *C, wmOperator *op)
 {
-	int report_index= RNA_int_get(op->ptr, "report_index");
-	Report *report= BLI_findlink(&CTX_wm_reports(C)->list, report_index);
+	int report_index = RNA_int_get(op->ptr, "report_index");
+	Report *report = BLI_findlink(&CTX_wm_reports(C)->list, report_index);
 
-	if(!report)
+	if (!report)
 		return OPERATOR_CANCELLED;
 
 	report->flag ^= SELECT; /* toggle */
@@ -126,15 +126,15 @@ static int select_report_pick_exec(bContext *C, wmOperator *op)
 
 static int select_report_pick_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	SpaceInfo *sinfo= CTX_wm_space_info(C);
-	ARegion *ar= CTX_wm_region(C);
-	ReportList *reports= CTX_wm_reports(C);
+	SpaceInfo *sinfo = CTX_wm_space_info(C);
+	ARegion *ar = CTX_wm_region(C);
+	ReportList *reports = CTX_wm_reports(C);
 	Report *report;
 
 	/* uses opengl */
 	wmSubWindowSet(CTX_wm_window(C), ar->swinid);
 	
-	report= info_text_pick(sinfo, ar, reports, event->mval[1]);
+	report = info_text_pick(sinfo, ar, reports, event->mval[1]);
 
 	RNA_int_set(op->ptr, "report_index", BLI_findindex(&reports->list, report));
 
@@ -145,17 +145,17 @@ static int select_report_pick_invoke(bContext *C, wmOperator *op, wmEvent *event
 void INFO_OT_select_pick(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select report";
-	ot->description= "Select reports by index";
-	ot->idname= "INFO_OT_select_pick";
+	ot->name = "Select report";
+	ot->description = "Select reports by index";
+	ot->idname = "INFO_OT_select_pick";
 
 	/* api callbacks */
-	ot->poll= ED_operator_info_active;
-	ot->invoke= select_report_pick_invoke;
-	ot->exec= select_report_pick_exec;
+	ot->poll = ED_operator_info_active;
+	ot->invoke = select_report_pick_invoke;
+	ot->exec = select_report_pick_exec;
 
 	/* flags */
-	/* ot->flag= OPTYPE_REGISTER; */
+	/* ot->flag = OPTYPE_REGISTER; */
 
 	/* properties */
 	RNA_def_int(ot->srna, "report_index", 0, 0, INT_MAX, "Report", "Index of the report", 0, INT_MAX);
@@ -165,29 +165,29 @@ void INFO_OT_select_pick(wmOperatorType *ot)
 
 static int report_select_all_toggle_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	SpaceInfo *sinfo= CTX_wm_space_info(C);
-	ReportList *reports= CTX_wm_reports(C);
-	int report_mask= info_report_mask(sinfo);
-	int deselect= 0;
+	SpaceInfo *sinfo = CTX_wm_space_info(C);
+	ReportList *reports = CTX_wm_reports(C);
+	int report_mask = info_report_mask(sinfo);
+	int deselect = 0;
 
 	Report *report;
 
-	for(report=reports->list.last; report; report=report->prev) {
-		if((report->type & report_mask) && (report->flag & SELECT)) {
-			deselect= 1;
+	for (report = reports->list.last; report; report = report->prev) {
+		if ((report->type & report_mask) && (report->flag & SELECT)) {
+			deselect = 1;
 			break;
 		}
 	}
 
 
-	if(deselect) {
-		for(report=reports->list.last; report; report=report->prev)
-			if(report->type & report_mask)
+	if (deselect) {
+		for (report = reports->list.last; report; report = report->prev)
+			if (report->type & report_mask)
 				report->flag &= ~SELECT;
 	}
 	else {
-		for(report=reports->list.last; report; report=report->prev)
-			if(report->type & report_mask)
+		for (report = reports->list.last; report; report = report->prev)
+			if (report->type & report_mask)
 				report->flag |= SELECT;
 	}
 
@@ -199,16 +199,16 @@ static int report_select_all_toggle_exec(bContext *C, wmOperator *UNUSED(op))
 void INFO_OT_select_all_toggle(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "(De)Select All";
-	ot->description= "(de)select all reports";
-	ot->idname= "INFO_OT_select_all_toggle";
+	ot->name = "(De)select All";
+	ot->description = "Select or deselect all reports";
+	ot->idname = "INFO_OT_select_all_toggle";
 
 	/* api callbacks */
-	ot->poll= ED_operator_info_active;
-	ot->exec= report_select_all_toggle_exec;
+	ot->poll = ED_operator_info_active;
+	ot->exec = report_select_all_toggle_exec;
 
 	/* flags */
-	/*ot->flag= OPTYPE_REGISTER;*/
+	/*ot->flag = OPTYPE_REGISTER;*/
 
 	/* properties */
 }
@@ -216,11 +216,11 @@ void INFO_OT_select_all_toggle(wmOperatorType *ot)
 /* borderselect operator */
 static int borderselect_exec(bContext *C, wmOperator *op)
 {
-	SpaceInfo *sinfo= CTX_wm_space_info(C);
-	ARegion *ar= CTX_wm_region(C);
-	ReportList *reports= CTX_wm_reports(C);
-	int report_mask= info_report_mask(sinfo);
-	int extend= RNA_boolean_get(op->ptr, "extend");
+	SpaceInfo *sinfo = CTX_wm_space_info(C);
+	ARegion *ar = CTX_wm_region(C);
+	ReportList *reports = CTX_wm_reports(C);
+	int report_mask = info_report_mask(sinfo);
+	int extend = RNA_boolean_get(op->ptr, "extend");
 	Report *report_min, *report_max, *report;
 
 	//View2D *v2d= UI_view2d_fromcontext(C);
@@ -228,66 +228,66 @@ static int borderselect_exec(bContext *C, wmOperator *op)
 
 	rcti rect;
 	//rctf rectf, rq;
-	short selecting= (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT);
+	short selecting = (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT);
 	//int mval[2];
 
-	rect.xmin= RNA_int_get(op->ptr, "xmin");
-	rect.ymin= RNA_int_get(op->ptr, "ymin");
-	rect.xmax= RNA_int_get(op->ptr, "xmax");
-	rect.ymax= RNA_int_get(op->ptr, "ymax");
+	rect.xmin = RNA_int_get(op->ptr, "xmin");
+	rect.ymin = RNA_int_get(op->ptr, "ymin");
+	rect.xmax = RNA_int_get(op->ptr, "xmax");
+	rect.ymax = RNA_int_get(op->ptr, "ymax");
 
-	/*
-	mval[0]= rect.xmin;
-	mval[1]= rect.ymin;
+#if 0
+	mval[0] = rect.xmin;
+	mval[1] = rect.ymin;
 	UI_view2d_region_to_view(v2d, mval[0], mval[1], &rectf.xmin, &rectf.ymin);
-	mval[0]= rect.xmax;
-	mval[1]= rect.ymax;
+	mval[0] = rect.xmax;
+	mval[1] = rect.ymax;
 	UI_view2d_region_to_view(v2d, mval[0], mval[1], &rectf.xmax, &rectf.ymax);
-*/
+#endif
 
-	if(!extend) {
-		for(report= reports->list.first; report; report= report->next) {
+	if (!extend) {
+		for (report = reports->list.first; report; report = report->next) {
 
-			if((report->type & report_mask)==0)
+			if ((report->type & report_mask) == 0)
 				continue;
 
 			report->flag &= ~SELECT;
 		}
 	}
 
-	report_min= info_text_pick(sinfo, ar, reports, rect.ymax);
-	report_max= info_text_pick(sinfo, ar, reports, rect.ymin);
+	report_min = info_text_pick(sinfo, ar, reports, rect.ymax);
+	report_max = info_text_pick(sinfo, ar, reports, rect.ymin);
 
 	/* get the first report if none found */
-	if(report_min==NULL) {
+	if (report_min == NULL) {
 		// printf("find_min\n");
-		for(report=reports->list.first; report; report=report->next) {
-			if(report->type & report_mask) {
-				report_min= report;
+		for (report = reports->list.first; report; report = report->next) {
+			if (report->type & report_mask) {
+				report_min = report;
 				break;
 			}
 		}
 	}
 
-	if(report_max==NULL) {
+	if (report_max == NULL) {
 		// printf("find_max\n");
-		for(report=reports->list.last; report; report=report->prev) {
-			if(report->type & report_mask) {
-				report_max= report;
+		for (report = reports->list.last; report; report = report->prev) {
+			if (report->type & report_mask) {
+				report_max = report;
 				break;
 			}
 		}
 	}
 
-	if(report_min==NULL || report_max==NULL)
+	if (report_min == NULL || report_max == NULL)
 		return OPERATOR_CANCELLED;
 
-	for(report= report_min; (report != report_max->next); report= report->next) {
+	for (report = report_min; (report != report_max->next); report = report->next) {
 
-		if((report->type & report_mask)==0)
+		if ((report->type & report_mask) == 0)
 			continue;
 
-		if(selecting)
+		if (selecting)
 			report->flag |= SELECT;
 		else
 			report->flag &= ~SELECT;
@@ -303,20 +303,20 @@ static int borderselect_exec(bContext *C, wmOperator *op)
 void INFO_OT_select_border(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Border Select";
-	ot->description= "Toggle border selection";
-	ot->idname= "INFO_OT_select_border";
+	ot->name = "Border Select";
+	ot->description = "Toggle border selection";
+	ot->idname = "INFO_OT_select_border";
 
 	/* api callbacks */
-	ot->invoke= WM_border_select_invoke;
-	ot->exec= borderselect_exec;
-	ot->modal= WM_border_select_modal;
-	ot->cancel= WM_border_select_cancel;
+	ot->invoke = WM_border_select_invoke;
+	ot->exec = borderselect_exec;
+	ot->modal = WM_border_select_modal;
+	ot->cancel = WM_border_select_cancel;
 
-	ot->poll= ED_operator_info_active;
+	ot->poll = ED_operator_info_active;
 
 	/* flags */
-	/* ot->flag= OPTYPE_REGISTER; */
+	/* ot->flag = OPTYPE_REGISTER; */
 
 	/* rna */
 	WM_operator_properties_gesture_border(ot, TRUE);
@@ -326,24 +326,24 @@ void INFO_OT_select_border(wmOperatorType *ot)
 
 static int report_delete_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	SpaceInfo *sinfo= CTX_wm_space_info(C);
-	ReportList *reports= CTX_wm_reports(C);
-	int report_mask= info_report_mask(sinfo);
+	SpaceInfo *sinfo = CTX_wm_space_info(C);
+	ReportList *reports = CTX_wm_reports(C);
+	int report_mask = info_report_mask(sinfo);
 
 
 	Report *report, *report_next;
 
-	for(report=reports->list.first; report; ) {
+	for (report = reports->list.first; report; ) {
 
-		report_next=report->next;
+		report_next = report->next;
 
-		if((report->type & report_mask) && (report->flag & SELECT)) {
+		if ((report->type & report_mask) && (report->flag & SELECT)) {
 			BLI_remlink(&reports->list, report);
 			MEM_freeN((void *)report->message);
 			MEM_freeN(report);
 		}
 
-		report= report_next;
+		report = report_next;
 	}
 
 	ED_area_tag_redraw(CTX_wm_area(C));
@@ -354,16 +354,16 @@ static int report_delete_exec(bContext *C, wmOperator *UNUSED(op))
 void INFO_OT_report_delete(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete Reports";
-	ot->description= "Delete selected reports";
-	ot->idname= "INFO_OT_report_delete";
+	ot->name = "Delete Reports";
+	ot->description = "Delete selected reports";
+	ot->idname = "INFO_OT_report_delete";
 
 	/* api callbacks */
-	ot->poll= ED_operator_info_active;
-	ot->exec= report_delete_exec;
+	ot->poll = ED_operator_info_active;
+	ot->exec = report_delete_exec;
 
 	/* flags */
-	/*ot->flag= OPTYPE_REGISTER;*/
+	/*ot->flag = OPTYPE_REGISTER;*/
 
 	/* properties */
 }
@@ -371,23 +371,23 @@ void INFO_OT_report_delete(wmOperatorType *ot)
 
 static int report_copy_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	SpaceInfo *sinfo= CTX_wm_space_info(C);
-	ReportList *reports= CTX_wm_reports(C);
-	int report_mask= info_report_mask(sinfo);
+	SpaceInfo *sinfo = CTX_wm_space_info(C);
+	ReportList *reports = CTX_wm_reports(C);
+	int report_mask = info_report_mask(sinfo);
 
 	Report *report;
 
-	DynStr *buf_dyn= BLI_dynstr_new();
+	DynStr *buf_dyn = BLI_dynstr_new();
 	char *buf_str;
 
-	for(report=reports->list.first; report; report= report->next) {
-		if((report->type & report_mask) && (report->flag & SELECT)) {
+	for (report = reports->list.first; report; report = report->next) {
+		if ((report->type & report_mask) && (report->flag & SELECT)) {
 			BLI_dynstr_append(buf_dyn, report->message);
 			BLI_dynstr_append(buf_dyn, "\n");
 		}
 	}
 
-	buf_str= BLI_dynstr_get_cstring(buf_dyn);
+	buf_str = BLI_dynstr_get_cstring(buf_dyn);
 	BLI_dynstr_free(buf_dyn);
 
 	WM_clipboard_text_set(buf_str, 0);
@@ -399,16 +399,16 @@ static int report_copy_exec(bContext *C, wmOperator *UNUSED(op))
 void INFO_OT_report_copy(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Copy Reports to Clipboard";
-	ot->description= "Copy selected reports to Clipboard";
-	ot->idname= "INFO_OT_report_copy";
+	ot->name = "Copy Reports to Clipboard";
+	ot->description = "Copy selected reports to Clipboard";
+	ot->idname = "INFO_OT_report_copy";
 
 	/* api callbacks */
-	ot->poll= ED_operator_info_active;
-	ot->exec= report_copy_exec;
+	ot->poll = ED_operator_info_active;
+	ot->exec = report_copy_exec;
 
 	/* flags */
-	/*ot->flag= OPTYPE_REGISTER;*/
+	/*ot->flag = OPTYPE_REGISTER;*/
 
 	/* properties */
 }
diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c
index 52e6a88..1c2f43f 100644
--- a/source/blender/editors/space_info/info_stats.c
+++ b/source/blender/editors/space_info/info_stats.c
@@ -34,6 +34,7 @@
 #include "DNA_curve_types.h"
 #include "DNA_group_types.h"
 #include "DNA_lattice_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_meta_types.h"
 #include "DNA_scene_types.h"
 
@@ -47,12 +48,12 @@
 #include "BKE_key.h"
 #include "BKE_mesh.h"
 #include "BKE_particle.h"
+#include "BKE_tessmesh.h"
 
 #include "ED_info.h"
 #include "ED_armature.h"
 #include "ED_mesh.h"
 
-#include "BLI_editVert.h"
 
 typedef struct SceneStats {
 	int totvert, totvertsel;
@@ -67,179 +68,169 @@ typedef struct SceneStats {
 
 static void stats_object(Object *ob, int sel, int totob, SceneStats *stats)
 {
-	switch(ob->type) {
-	case OB_MESH: {
-		/* we assume derivedmesh is already built, this strictly does stats now. */
-		DerivedMesh *dm= ob->derivedFinal;
-		int totvert, totedge, totface;
-
-		stats->totmesh +=totob;
-
-		if(dm) {
-			totvert = dm->getNumVerts(dm);
-			totedge = dm->getNumEdges(dm);
-			totface = dm->getNumFaces(dm);
-
-			stats->totvert += totvert*totob;
-			stats->totedge += totedge*totob;
-			stats->totface += totface*totob;
-
-			if(sel) {
-				stats->totvertsel += totvert;
-				stats->totfacesel += totface;
+	switch (ob->type) {
+		case OB_MESH: {
+			/* we assume derivedmesh is already built, this strictly does stats now. */
+			DerivedMesh *dm = ob->derivedFinal;
+			int totvert, totedge, totface;
+
+			stats->totmesh += totob;
+
+			if (dm) {
+				totvert = dm->getNumVerts(dm);
+				totedge = dm->getNumEdges(dm);
+				totface = dm->getNumPolys(dm);
+
+				stats->totvert += totvert * totob;
+				stats->totedge += totedge * totob;
+				stats->totface += totface * totob;
+
+				if (sel) {
+					stats->totvertsel += totvert;
+					stats->totfacesel += totface;
+				}
 			}
+			break;
 		}
-		break;
-	}
-	case OB_LAMP:
-		stats->totlamp += totob;
-		break;
-	case OB_SURF:
-	case OB_CURVE:
-	case OB_FONT: {
-		int tot= 0, totf= 0;
+		case OB_LAMP:
+			stats->totlamp += totob;
+			break;
+		case OB_SURF:
+		case OB_CURVE:
+		case OB_FONT: {
+			int tot = 0, totf = 0;
 
-		stats->totcurve += totob;
+			stats->totcurve += totob;
 
-		if(ob->disp.first)
-			count_displist(&ob->disp, &tot, &totf);
+			if (ob->disp.first)
+				count_displist(&ob->disp, &tot, &totf);
 
-		tot *= totob;
-		totf *= totob;
+			tot *= totob;
+			totf *= totob;
 
-		stats->totvert+= tot;
-		stats->totface+= totf;
+			stats->totvert += tot;
+			stats->totface += totf;
 
-		if(sel) {
-			stats->totvertsel += tot;
-			stats->totfacesel += totf;
+			if (sel) {
+				stats->totvertsel += tot;
+				stats->totfacesel += totf;
+			}
+			break;
 		}
-		break;
-	}
-	case OB_MBALL: {
-		int tot= 0, totf= 0;
+		case OB_MBALL: {
+			int tot = 0, totf = 0;
 
-		count_displist(&ob->disp, &tot, &totf);
+			count_displist(&ob->disp, &tot, &totf);
 
-		tot *= totob;
-		totf *= totob;
+			tot *= totob;
+			totf *= totob;
 
-		stats->totvert += tot;
-		stats->totface += totf;
+			stats->totvert += tot;
+			stats->totface += totf;
 
-		if(sel) {
-			stats->totvertsel += tot;
-			stats->totfacesel += totf;
+			if (sel) {
+				stats->totvertsel += tot;
+				stats->totfacesel += totf;
+			}
+			break;
 		}
-		break;
-	}
 	}
 }
 
 static void stats_object_edit(Object *obedit, SceneStats *stats)
 {
-	if(obedit->type==OB_MESH) {
-		/* Mesh Edit */
-		EditMesh *em= BKE_mesh_get_editmesh(obedit->data);
-		EditVert *eve;
-		EditEdge *eed;
-		EditFace *efa;
+	if (obedit->type == OB_MESH) {
+		BMEditMesh *em = BMEdit_FromObject(obedit);
+
+		stats->totvert = em->bm->totvert;
+		stats->totvertsel = em->bm->totvertsel;
 		
-		for(eve= em->verts.first; eve; eve=eve->next) {
-			stats->totvert++;
-			if(eve->f & SELECT) stats->totvertsel++;
-		}
-		for(eed= em->edges.first; eed; eed=eed->next) {
-			stats->totedge++;
-			if(eed->f & SELECT) stats->totedgesel++;
-		}
-		for(efa= em->faces.first; efa; efa=efa->next) {
-			stats->totface++;
-			if(efa->f & SELECT) stats->totfacesel++;
-		}
+		stats->totedge = em->bm->totedge;
+		stats->totedgesel = em->bm->totedgesel;
 		
-		EM_validate_selections(em);
+		stats->totface = em->bm->totface;
+		stats->totfacesel = em->bm->totfacesel;
 	}
-	else if(obedit->type==OB_ARMATURE){
+	else if (obedit->type == OB_ARMATURE) {
 		/* Armature Edit */
-		bArmature *arm= obedit->data;
+		bArmature *arm = obedit->data;
 		EditBone *ebo;
 
-		for(ebo=arm->edbo->first; ebo; ebo=ebo->next){
+		for (ebo = arm->edbo->first; ebo; ebo = ebo->next) {
 			stats->totbone++;
 			
-			if((ebo->flag & BONE_CONNECTED) && ebo->parent)
+			if ((ebo->flag & BONE_CONNECTED) && ebo->parent)
 				stats->totvert--;
 			
-			if(ebo->flag & BONE_TIPSEL)
+			if (ebo->flag & BONE_TIPSEL)
 				stats->totvertsel++;
-			if(ebo->flag & BONE_ROOTSEL)
+			if (ebo->flag & BONE_ROOTSEL)
 				stats->totvertsel++;
 			
-			if(ebo->flag & BONE_SELECTED) stats->totbonesel++;
+			if (ebo->flag & BONE_SELECTED) stats->totbonesel++;
 
 			/* if this is a connected child and it's parent is being moved, remove our root */
-			if((ebo->flag & BONE_CONNECTED)&& (ebo->flag & BONE_ROOTSEL) && ebo->parent && (ebo->parent->flag & BONE_TIPSEL))
+			if ((ebo->flag & BONE_CONNECTED) && (ebo->flag & BONE_ROOTSEL) && ebo->parent && (ebo->parent->flag & BONE_TIPSEL))
 				stats->totvertsel--;
 
-			stats->totvert+=2;
+			stats->totvert += 2;
 		}
 	}
-	else if ELEM(obedit->type, OB_CURVE, OB_SURF) { /* OB_FONT has no cu->editnurb */
+	else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) { /* OB_FONT has no cu->editnurb */
 		/* Curve Edit */
-		Curve *cu= obedit->data;
+		Curve *cu = obedit->data;
 		Nurb *nu;
 		BezTriple *bezt;
 		BPoint *bp;
 		int a;
-		ListBase *nurbs= curve_editnurbs(cu);
-
-		for(nu=nurbs->first; nu; nu=nu->next) {
-			if(nu->type == CU_BEZIER) {
-				bezt= nu->bezt;
-				a= nu->pntsu;
-				while(a--) {
-					stats->totvert+=3;
-					if(bezt->f1) stats->totvertsel++;
-					if(bezt->f2) stats->totvertsel++;
-					if(bezt->f3) stats->totvertsel++;
+		ListBase *nurbs = curve_editnurbs(cu);
+
+		for (nu = nurbs->first; nu; nu = nu->next) {
+			if (nu->type == CU_BEZIER) {
+				bezt = nu->bezt;
+				a = nu->pntsu;
+				while (a--) {
+					stats->totvert += 3;
+					if (bezt->f1) stats->totvertsel++;
+					if (bezt->f2) stats->totvertsel++;
+					if (bezt->f3) stats->totvertsel++;
 					bezt++;
 				}
 			}
 			else {
-				bp= nu->bp;
-				a= nu->pntsu*nu->pntsv;
-				while(a--) {
+				bp = nu->bp;
+				a = nu->pntsu * nu->pntsv;
+				while (a--) {
 					stats->totvert++;
-					if(bp->f1 & SELECT) stats->totvertsel++;
+					if (bp->f1 & SELECT) stats->totvertsel++;
 					bp++;
 				}
 			}
 		}
 	}
-	else if(obedit->type==OB_MBALL) {
+	else if (obedit->type == OB_MBALL) {
 		/* MetaBall Edit */
-		MetaBall *mball= obedit->data;
+		MetaBall *mball = obedit->data;
 		MetaElem *ml;
 		
-		for(ml= mball->editelems->first; ml; ml=ml->next) {
+		for (ml = mball->editelems->first; ml; ml = ml->next) {
 			stats->totvert++;
-			if(ml->flag & SELECT) stats->totvertsel++;
+			if (ml->flag & SELECT) stats->totvertsel++;
 		}
 	}
-	else if(obedit->type==OB_LATTICE) {
+	else if (obedit->type == OB_LATTICE) {
 		/* Lattice Edit */
-		Lattice *lt= obedit->data;
-		Lattice *editlatt= lt->editlatt->latt;
+		Lattice *lt = obedit->data;
+		Lattice *editlatt = lt->editlatt->latt;
 		BPoint *bp;
 		int a;
 
-		bp= editlatt->def;
+		bp = editlatt->def;
 		
-		a= editlatt->pntsu*editlatt->pntsv*editlatt->pntsw;
-		while(a--) {
+		a = editlatt->pntsu * editlatt->pntsv * editlatt->pntsw;
+		while (a--) {
 			stats->totvert++;
-			if(bp->f1 & SELECT) stats->totvertsel++;
+			if (bp->f1 & SELECT) stats->totvertsel++;
 			bp++;
 		}
 	}
@@ -247,54 +238,44 @@ static void stats_object_edit(Object *obedit, SceneStats *stats)
 
 static void stats_object_pose(Object *ob, SceneStats *stats)
 {
-	if(ob->pose) {
-		bArmature *arm= ob->data;
+	if (ob->pose) {
+		bArmature *arm = ob->data;
 		bPoseChannel *pchan;
 
-		for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+		for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
 			stats->totbone++;
-			if(pchan->bone && (pchan->bone->flag & BONE_SELECTED))
-				if(pchan->bone->layer & arm->layer)
+			if (pchan->bone && (pchan->bone->flag & BONE_SELECTED))
+				if (pchan->bone->layer & arm->layer)
 					stats->totbonesel++;
 		}
 	}
 }
 
-static void stats_object_paint(Object *ob, SceneStats *stats)
-{
-	if(ob->type == OB_MESH) {
-		Mesh *me= ob->data;
-
-		stats->totface= me->totface;
-		stats->totvert= me->totvert;
-	}
-}
-
 static void stats_dupli_object(Base *base, Object *ob, SceneStats *stats)
 {
-	if(base->flag & SELECT) stats->totobjsel++;
+	if (base->flag & SELECT) stats->totobjsel++;
 
-	if(ob->transflag & OB_DUPLIPARTS) {
+	if (ob->transflag & OB_DUPLIPARTS) {
 		/* Dupli Particles */
 		ParticleSystem *psys;
 		ParticleSettings *part;
 
-		for(psys=ob->particlesystem.first; psys; psys=psys->next){
-			part=psys->part;
+		for (psys = ob->particlesystem.first; psys; psys = psys->next) {
+			part = psys->part;
 
-			if(part->draw_as==PART_DRAW_OB && part->dup_ob){
-				int tot=count_particles(psys);
+			if (part->draw_as == PART_DRAW_OB && part->dup_ob) {
+				int tot = count_particles(psys);
 				stats_object(part->dup_ob, 0, tot, stats);
 			}
-			else if(part->draw_as==PART_DRAW_GR && part->dup_group){
+			else if (part->draw_as == PART_DRAW_GR && part->dup_group) {
 				GroupObject *go;
-				int tot, totgroup=0, cur=0;
+				int tot, totgroup = 0, cur = 0;
 				
-				for(go= part->dup_group->gobject.first; go; go=go->next)
+				for (go = part->dup_group->gobject.first; go; go = go->next)
 					totgroup++;
 
-				for(go= part->dup_group->gobject.first; go; go=go->next) {
-					tot=count_particles_mod(psys,totgroup,cur);
+				for (go = part->dup_group->gobject.first; go; go = go->next) {
+					tot = count_particles_mod(psys, totgroup, cur);
 					stats_object(go->ob, 0, tot, stats);
 					cur++;
 				}
@@ -304,22 +285,22 @@ static void stats_dupli_object(Base *base, Object *ob, SceneStats *stats)
 		stats_object(ob, base->flag & SELECT, 1, stats);
 		stats->totobj++;
 	}
-	else if(ob->parent && (ob->parent->transflag & (OB_DUPLIVERTS|OB_DUPLIFACES))) {
+	else if (ob->parent && (ob->parent->transflag & (OB_DUPLIVERTS | OB_DUPLIFACES))) {
 		/* Dupli Verts/Faces */
-		int tot= count_duplilist(ob->parent);
-		stats->totobj+=tot;
+		int tot = count_duplilist(ob->parent);
+		stats->totobj += tot;
 		stats_object(ob, base->flag & SELECT, tot, stats);
 	}
-	else if(ob->transflag & OB_DUPLIFRAMES) {
+	else if (ob->transflag & OB_DUPLIFRAMES) {
 		/* Dupli Frames */
-		int tot= count_duplilist(ob);
-		stats->totobj+=tot;
+		int tot = count_duplilist(ob);
+		stats->totobj += tot;
 		stats_object(ob, base->flag & SELECT, tot, stats);
 	}
-	else if((ob->transflag & OB_DUPLIGROUP) && ob->dup_group) {
+	else if ((ob->transflag & OB_DUPLIGROUP) && ob->dup_group) {
 		/* Dupli Group */
-		int tot= count_duplilist(ob);
-		stats->totobj+=tot;
+		int tot = count_duplilist(ob);
+		stats->totobj += tot;
 		stats_object(ob, base->flag & SELECT, tot, stats);
 	}
 	else {
@@ -332,102 +313,98 @@ static void stats_dupli_object(Base *base, Object *ob, SceneStats *stats)
 /* Statistics displayed in info header. Called regularly on scene changes. */
 static void stats_update(Scene *scene)
 {
-	SceneStats stats= {0};
-	Object *ob= (scene->basact)? scene->basact->object: NULL;
+	SceneStats stats = {0};
+	Object *ob = (scene->basact) ? scene->basact->object : NULL;
 	Base *base;
 	
-	if(scene->obedit) {
+	if (scene->obedit) {
 		/* Edit Mode */
 		stats_object_edit(scene->obedit, &stats);
 	}
-	else if(ob && (ob->mode & OB_MODE_POSE)) {
+	else if (ob && (ob->mode & OB_MODE_POSE)) {
 		/* Pose Mode */
 		stats_object_pose(ob, &stats);
 	}
-	else if(ob && (ob->flag & OB_MODE_ALL_PAINT)) {
-		/* Sculpt and Paint Mode */
-		stats_object_paint(ob, &stats);
-	}
 	else {
 		/* Objects */
-		for(base= scene->base.first; base; base=base->next)
-			if(scene->lay & base->lay)
+		for (base = scene->base.first; base; base = base->next)
+			if (scene->lay & base->lay)
 				stats_dupli_object(base, base->object, &stats);
 	}
 
-	if(!scene->stats)
-		scene->stats= MEM_callocN(sizeof(SceneStats), "SceneStats");
+	if (!scene->stats)
+		scene->stats = MEM_callocN(sizeof(SceneStats), "SceneStats");
 
-	*(scene->stats)= stats;
+	*(scene->stats) = stats;
 }
 
 static void stats_string(Scene *scene)
 {
-	SceneStats *stats= scene->stats;
-	Object *ob= (scene->basact)? scene->basact->object: NULL;
+	SceneStats *stats = scene->stats;
+	Object *ob = (scene->basact) ? scene->basact->object : NULL;
 	uintptr_t mem_in_use, mmap_in_use;
 	char memstr[64];
 	char *s;
 
-	mem_in_use= MEM_get_memory_in_use();
-	mmap_in_use= MEM_get_mapped_memory_in_use();
+	mem_in_use = MEM_get_memory_in_use();
+	mmap_in_use = MEM_get_mapped_memory_in_use();
 
 	/* get memory statistics */
-	s= memstr + sprintf(memstr, " | Mem:%.2fM", (double)((mem_in_use-mmap_in_use)>>10)/1024.0);
-	if(mmap_in_use)
-		sprintf(s, " (%.2fM)", (double)((mmap_in_use)>>10)/1024.0);
+	s = memstr + sprintf(memstr, " | Mem:%.2fM", (double)((mem_in_use - mmap_in_use) >> 10) / 1024.0);
+	if (mmap_in_use)
+		sprintf(s, " (%.2fM)", (double)((mmap_in_use) >> 10) / 1024.0);
 
-	s= stats->infostr;
+	s = stats->infostr;
 	
-	s+= sprintf(s, "%s | ", versionstr);
-
-	if(scene->obedit) {
-		if(ob_get_keyblock(scene->obedit))
-			s+= sprintf(s, "(Key) ");
-
-		if(scene->obedit->type==OB_MESH) {
-			if(scene->toolsettings->selectmode & SCE_SELECT_VERTEX)
-				s+= sprintf(s, "Ve:%d-%d | Ed:%d-%d | Fa:%d-%d",
-						stats->totvertsel, stats->totvert, stats->totedgesel, stats->totedge, stats->totfacesel, stats->totface);
-			else if(scene->toolsettings->selectmode & SCE_SELECT_EDGE)
-				s+= sprintf(s, "Ed:%d-%d | Fa:%d-%d",
-						stats->totedgesel, stats->totedge, stats->totfacesel, stats->totface);
+	s += sprintf(s, "%s | ", versionstr);
+
+	if (scene->obedit) {
+		if (ob_get_keyblock(scene->obedit))
+			s += sprintf(s, "(Key) ");
+
+		if (scene->obedit->type == OB_MESH) {
+			if (scene->toolsettings->selectmode & SCE_SELECT_VERTEX)
+				s += sprintf(s, "Ve:%d-%d | Ed:%d-%d | Fa:%d-%d",
+				             stats->totvertsel, stats->totvert, stats->totedgesel, stats->totedge, stats->totfacesel, stats->totface);
+			else if (scene->toolsettings->selectmode & SCE_SELECT_EDGE)
+				s += sprintf(s, "Ed:%d-%d | Fa:%d-%d",
+				             stats->totedgesel, stats->totedge, stats->totfacesel, stats->totface);
 			else
-				s+= sprintf(s, "Fa:%d-%d", stats->totfacesel, stats->totface);
+				s += sprintf(s, "Fa:%d-%d", stats->totfacesel, stats->totface);
 		}
-		else if(scene->obedit->type==OB_ARMATURE) {
-			s+= sprintf(s, "Ve:%d-%d | Bo:%d-%d", stats->totvertsel, stats->totvert, stats->totbonesel, stats->totbone);
+		else if (scene->obedit->type == OB_ARMATURE) {
+			s += sprintf(s, "Ve:%d-%d | Bo:%d-%d", stats->totvertsel, stats->totvert, stats->totbonesel, stats->totbone);
 		}
 		else {
-			s+= sprintf(s, "Ve:%d-%d", stats->totvertsel, stats->totvert);
+			s += sprintf(s, "Ve:%d-%d", stats->totvertsel, stats->totvert);
 		}
 
 		strcat(s, memstr);
 	}
-	else if(ob && (ob->mode & OB_MODE_POSE)) {
+	else if (ob && (ob->mode & OB_MODE_POSE)) {
 		s += sprintf(s, "Bo:%d-%d %s",
-					stats->totbonesel, stats->totbone, memstr);
+		             stats->totbonesel, stats->totbone, memstr);
 	}
 	else {
 		s += sprintf(s, "Ve:%d | Fa:%d | Ob:%d-%d | La:%d%s",
-			stats->totvert, stats->totface, stats->totobjsel, stats->totobj, stats->totlamp, memstr);
+		             stats->totvert, stats->totface, stats->totobjsel, stats->totobj, stats->totlamp, memstr);
 	}
 
-	if(ob)
-		sprintf(s, " | %s", ob->id.name+2);
+	if (ob)
+		sprintf(s, " | %s", ob->id.name + 2);
 }
 
 void ED_info_stats_clear(Scene *scene)
 {
-	if(scene->stats) {
+	if (scene->stats) {
 		MEM_freeN(scene->stats);
-		scene->stats= NULL;
+		scene->stats = NULL;
 	}
 }
 
 const char *ED_info_stats_string(Scene *scene)
 {
-	if(!scene->stats)
+	if (!scene->stats)
 		stats_update(scene);
 	stats_string(scene);
 
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index b9ef57e..7cb89b6 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -57,7 +57,7 @@
 #include "UI_interface.h"
 #include "UI_view2d.h"
 
-#include "info_intern.h"	// own include
+#include "info_intern.h"  /* own include */
 
 /* ******************** default callbacks for info space ***************** */
 
@@ -66,31 +66,31 @@ static SpaceLink *info_new(const bContext *UNUSED(C))
 	ARegion *ar;
 	SpaceInfo *sinfo;
 	
-	sinfo= MEM_callocN(sizeof(SpaceInfo), "initinfo");
-	sinfo->spacetype= SPACE_INFO;
+	sinfo = MEM_callocN(sizeof(SpaceInfo), "initinfo");
+	sinfo->spacetype = SPACE_INFO;
 
-	sinfo->rpt_mask= INFO_RPT_OP;
+	sinfo->rpt_mask = INFO_RPT_OP;
 
 	/* header */
-	ar= MEM_callocN(sizeof(ARegion), "header for info");
+	ar = MEM_callocN(sizeof(ARegion), "header for info");
 	
 	BLI_addtail(&sinfo->regionbase, ar);
-	ar->regiontype= RGN_TYPE_HEADER;
-	ar->alignment= RGN_ALIGN_BOTTOM;
+	ar->regiontype = RGN_TYPE_HEADER;
+	ar->alignment = RGN_ALIGN_BOTTOM;
 	
 	/* main area */
-	ar= MEM_callocN(sizeof(ARegion), "main area for info");
+	ar = MEM_callocN(sizeof(ARegion), "main area for info");
 	
 	BLI_addtail(&sinfo->regionbase, ar);
-	ar->regiontype= RGN_TYPE_WINDOW;
+	ar->regiontype = RGN_TYPE_WINDOW;
 	
 	/* keep in sync with console */
 	ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
-	ar->v2d.align |= V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y; /* align bottom left */
+	ar->v2d.align |= V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y; /* align bottom left */
 	ar->v2d.keepofs |= V2D_LOCKOFS_X;
-	ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_LIMITZOOM|V2D_KEEPASPECT);
-	ar->v2d.keeptot= V2D_KEEPTOT_BOUNDS;
-	ar->v2d.minzoom= ar->v2d.maxzoom= 1.0f;
+	ar->v2d.keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT);
+	ar->v2d.keeptot = V2D_KEEPTOT_BOUNDS;
+	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);
@@ -114,7 +114,7 @@ static void info_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
 
 static SpaceLink *info_duplicate(SpaceLink *sl)
 {
-	SpaceInfo *sinfon= MEM_dupallocN(sl);
+	SpaceInfo *sinfon = MEM_dupallocN(sl);
 	
 	/* clear or remove stuff from old */
 	
@@ -131,23 +131,23 @@ static void info_main_area_init(wmWindowManager *wm, ARegion *ar)
 	UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
 
 	/* own keymap */
-	keymap= WM_keymap_find(wm->defaultconf, "Info", SPACE_INFO, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Info", SPACE_INFO, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
 static void info_textview_update_rect(const bContext *C, ARegion *ar)
 {
-	SpaceInfo *sinfo= CTX_wm_space_info(C);
-	View2D *v2d= &ar->v2d;
+	SpaceInfo *sinfo = CTX_wm_space_info(C);
+	View2D *v2d = &ar->v2d;
 
-	UI_view2d_totRect_set(v2d, ar->winx-1, info_textview_height(sinfo, ar, CTX_wm_reports(C)));
+	UI_view2d_totRect_set(v2d, ar->winx - 1, info_textview_height(sinfo, ar, CTX_wm_reports(C)));
 }
 
 static void info_main_area_draw(const bContext *C, ARegion *ar)
 {
 	/* draw entirely, view changes should be handled here */
-	SpaceInfo *sinfo= CTX_wm_space_info(C);
-	View2D *v2d= &ar->v2d;
+	SpaceInfo *sinfo = CTX_wm_space_info(C);
+	View2D *v2d = &ar->v2d;
 	View2DScrollers *scrollers;
 
 	/* clear and setup matrix */
@@ -155,7 +155,7 @@ static void info_main_area_draw(const bContext *C, ARegion *ar)
 	glClear(GL_COLOR_BUFFER_BIT);
 
 	/* quick way to avoid drawing if not bug enough */
-	if(ar->winy < 16)
+	if (ar->winy < 16)
 		return;
 		
 	info_textview_update_rect(C, ar);
@@ -169,7 +169,7 @@ static void info_main_area_draw(const bContext *C, ARegion *ar)
 	UI_view2d_view_restore(C);
 	
 	/* scrollers */
-	scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_GRID_CLAMP);
+	scrollers = UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_GRID_CLAMP);
 	UI_view2d_scrollers_draw(C, v2d, scrollers);
 	UI_view2d_scrollers_free(scrollers);
 }
@@ -196,12 +196,12 @@ static void info_operatortypes(void)
 
 static void info_keymap(struct wmKeyConfig *keyconf)
 {
-	wmKeyMap *keymap= WM_keymap_find(keyconf, "Window", 0, 0);
+	wmKeyMap *keymap = WM_keymap_find(keyconf, "Window", 0, 0);
 	
 	WM_keymap_verify_item(keymap, "INFO_OT_reports_display_update", TIMERREPORT, KM_ANY, KM_ANY, 0);
 
 	/* info space */
-	keymap= WM_keymap_find(keyconf, "Info", SPACE_INFO, 0);
+	keymap = WM_keymap_find(keyconf, "Info", SPACE_INFO, 0);
 	
 	
 	/* report selection */
@@ -231,9 +231,9 @@ static void info_main_area_listener(ARegion *ar, wmNotifier *wmn)
 	// SpaceInfo *sinfo= sa->spacedata.first;
 
 	/* context changes */
-	switch(wmn->category) {
+	switch (wmn->category) {
 		case NC_SPACE:
-			if(wmn->data == ND_SPACE_INFO_REPORT) {
+			if (wmn->data == ND_SPACE_INFO_REPORT) {
 				/* redraw also but only for report view, could do less redraws by checking the type */
 				ED_region_tag_redraw(ar);
 			}
@@ -244,25 +244,25 @@ static void info_main_area_listener(ARegion *ar, wmNotifier *wmn)
 static void info_header_listener(ARegion *ar, wmNotifier *wmn)
 {
 	/* context changes */
-	switch(wmn->category) {
+	switch (wmn->category) {
 		case NC_SCREEN:
-			if(ELEM(wmn->data, ND_SCREENCAST, ND_ANIMPLAY))
+			if (ELEM(wmn->data, ND_SCREENCAST, ND_ANIMPLAY))
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_WM:	
-			if(wmn->data == ND_JOB)
+			if (wmn->data == ND_JOB)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_SCENE:
-			if(wmn->data==ND_RENDER_RESULT)
+			if (wmn->data == ND_RENDER_RESULT)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_SPACE:	
-			if(wmn->data == ND_SPACE_INFO)
+			if (wmn->data == ND_SPACE_INFO)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_ID:
-			if(wmn->action == NA_RENAME)
+			if (wmn->action == NA_RENAME)
 				ED_region_tag_redraw(ar);
 	}
 	
@@ -271,13 +271,14 @@ static void info_header_listener(ARegion *ar, wmNotifier *wmn)
 static void recent_files_menu_draw(const bContext *UNUSED(C), Menu *menu)
 {
 	struct RecentFile *recent;
-	uiLayout *layout= menu->layout;
+	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) {
+		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);
 		}
-	} else {
+	}
+	else {
 		uiItemL(layout, IFACE_("No Recent Files"), ICON_NONE);
 	}
 }
@@ -286,49 +287,49 @@ static void recent_files_menu_register(void)
 {
 	MenuType *mt;
 
-	mt= MEM_callocN(sizeof(MenuType), "spacetype info menu recent files");
+	mt = MEM_callocN(sizeof(MenuType), "spacetype info menu recent files");
 	strcpy(mt->idname, "INFO_MT_file_open_recent");
 	strcpy(mt->label, N_("Open Recent..."));
-	mt->draw= recent_files_menu_draw;
+	mt->draw = recent_files_menu_draw;
 	WM_menutype_add(mt);
 }
 
 /* only called once, from space/spacetypes.c */
 void ED_spacetype_info(void)
 {
-	SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype info");
+	SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype info");
 	ARegionType *art;
 	
-	st->spaceid= SPACE_INFO;
+	st->spaceid = SPACE_INFO;
 	strncpy(st->name, "Info", BKE_ST_MAXNAME);
 	
-	st->new= info_new;
-	st->free= info_free;
-	st->init= info_init;
-	st->duplicate= info_duplicate;
-	st->operatortypes= info_operatortypes;
-	st->keymap= info_keymap;
+	st->new = info_new;
+	st->free = info_free;
+	st->init = info_init;
+	st->duplicate = info_duplicate;
+	st->operatortypes = info_operatortypes;
+	st->keymap = info_keymap;
 	
 	/* regions: main window */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype info region");
+	art = MEM_callocN(sizeof(ARegionType), "spacetype info region");
 	art->regionid = RGN_TYPE_WINDOW;
-	art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
+	art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D;
 
-	art->init= info_main_area_init;
-	art->draw= info_main_area_draw;
-	art->listener= info_main_area_listener;
+	art->init = info_main_area_init;
+	art->draw = info_main_area_draw;
+	art->listener = info_main_area_listener;
 
 	BLI_addhead(&st->regiontypes, art);
 	
 	/* regions: header */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype info region");
+	art = MEM_callocN(sizeof(ARegionType), "spacetype info region");
 	art->regionid = RGN_TYPE_HEADER;
-	art->prefsizey= HEADERY;
+	art->prefsizey = HEADERY;
 	
-	art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
-	art->listener= info_header_listener;
-	art->init= info_header_area_init;
-	art->draw= info_header_area_draw;
+	art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER;
+	art->listener = info_header_listener;
+	art->init = info_header_area_init;
+	art->draw = info_header_area_draw;
 	
 	BLI_addhead(&st->regiontypes, art);
 	
diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c
index 177b725..4ba1962 100644
--- a/source/blender/editors/space_info/textview.c
+++ b/source/blender/editors/space_info/textview.c
@@ -47,7 +47,7 @@
 
 static void console_font_begin(TextViewContext *sc)
 {
-	BLF_size(blf_mono_font, sc->lheight-2, 72);
+	BLF_size(blf_mono_font, sc->lheight - 2, 72);
 }
 
 typedef struct ConsoleDrawContext {
@@ -65,20 +65,20 @@ 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) {
+	if (sel[0] <= str_len_draw && sel[1] >= 0) {
 		int sta = MAX2(sel[0], 0);
 		int end = MIN2(sel[1], str_len_draw);
 
 		glEnable(GL_POLYGON_STIPPLE);
 		glPolygonStipple(stipple_halftone);
-		glEnable( GL_BLEND );
+		glEnable(GL_BLEND);
 		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 		glColor4ub(255, 255, 255, 96);
 
-		glRecti(xy[0]+(cwidth*sta), xy[1]-2 + lheight, xy[0]+(cwidth*end), xy[1]-2);
+		glRecti(xy[0] + (cwidth * sta), xy[1] - 2 + lheight, xy[0] + (cwidth * end), xy[1] - 2);
 
 		glDisable(GL_POLYGON_STIPPLE);
-		glDisable( GL_BLEND );
+		glDisable(GL_BLEND);
 	}
 }
 
@@ -89,47 +89,48 @@ static void console_draw_sel(int sel[2], int xy[2], int str_len_draw, int cwidth
 static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str_len, unsigned char *fg, unsigned char *bg)
 {
 #define STEP_SEL(value) cdc->sel[0] += (value); cdc->sel[1] += (value)
-	int rct_ofs= cdc->lheight/4;
-	int tot_lines = (str_len/cdc->console_width)+1; /* total number of lines for wrapping */
-	int y_next = (str_len > cdc->console_width) ? cdc->xy[1]+cdc->lheight*tot_lines : cdc->xy[1]+cdc->lheight;
-	const int mono= blf_mono_font;
+	int rct_ofs = cdc->lheight / 4;
+	int tot_lines = (str_len / cdc->console_width) + 1; /* total number of lines for wrapping */
+	int y_next = (str_len > cdc->console_width) ? cdc->xy[1] + cdc->lheight * tot_lines : cdc->xy[1] + cdc->lheight;
+	const int mono = blf_mono_font;
 
 	/* just advance the height */
-	if(cdc->draw==0) {
-		if(cdc->pos_pick && (cdc->mval[1] != INT_MAX)) {
-			if(cdc->xy[1] <= cdc->mval[1]) {
-				if((y_next >= cdc->mval[1])) {
+	if (cdc->draw == 0) {
+		if (cdc->pos_pick && (cdc->mval[1] != INT_MAX)) {
+			if (cdc->xy[1] <= cdc->mval[1]) {
+				if ((y_next >= cdc->mval[1])) {
 					int ofs = (int)floor(((float)cdc->mval[0] / (float)cdc->cwidth));
 
 					/* wrap */
-					if(str_len > cdc->console_width)
-						ofs += (cdc->console_width * ((int)((((float)(y_next - cdc->mval[1]) / (float)(y_next-cdc->xy[1])) * tot_lines))));
+					if (str_len > cdc->console_width)
+						ofs += (cdc->console_width * ((int)((((float)(y_next - cdc->mval[1]) / (float)(y_next - cdc->xy[1])) * tot_lines))));
 	
 					CLAMP(ofs, 0, str_len);
 					*cdc->pos_pick += str_len - ofs;
-				} else
+				}
+				else
 					*cdc->pos_pick += str_len + 1;
 			}
 		}
 
-		cdc->xy[1]= y_next;
+		cdc->xy[1] = y_next;
 		return 1;
 	}
-	else if (y_next-cdc->lheight < cdc->ymin) {
+	else if (y_next - cdc->lheight < cdc->ymin) {
 		/* have not reached the drawable area so don't break */
-		cdc->xy[1]= y_next;
+		cdc->xy[1] = y_next;
 
 		/* adjust selection even if not drawing */
-		if(cdc->sel[0] != cdc->sel[1]) {
+		if (cdc->sel[0] != cdc->sel[1]) {
 			STEP_SEL(-(str_len + 1));
 		}
 
 		return 1;
 	}
 
-	if(str_len > cdc->console_width) { /* 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 */
+	if (str_len > cdc->console_width) { /* 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 */
 		
 		int sel_orig[2];
 		copy_v2_v2_int(sel_orig, cdc->sel);
@@ -138,9 +139,9 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str
 		cdc->sel[0] = str_len - sel_orig[1];
 		cdc->sel[1] = str_len - sel_orig[0];
 		
-		if(bg) {
+		if (bg) {
 			glColor3ubv(bg);
-			glRecti(0, cdc->xy[1]-rct_ofs, cdc->winx, (cdc->xy[1]+(cdc->lheight*tot_lines))+rct_ofs);
+			glRecti(0, cdc->xy[1] - rct_ofs, cdc->winx, (cdc->xy[1] + (cdc->lheight * tot_lines)) + rct_ofs);
 		}
 
 		glColor3ubv(fg);
@@ -149,7 +150,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str
 		BLF_position(mono, cdc->xy[0], cdc->xy[1], 0);
 		BLF_draw(mono, line_stride, str_len - initial_offset);
 
-		if(cdc->sel[0] != cdc->sel[1]) {
+		if (cdc->sel[0] != cdc->sel[1]) {
 			STEP_SEL(-initial_offset);
 			// glColor4ub(255, 0, 0, 96); // debug
 			console_draw_sel(cdc->sel, cdc->xy, str_len % cdc->console_width, cdc->cwidth, cdc->lheight);
@@ -161,11 +162,11 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str
 
 		line_stride -= cdc->console_width;
 		
-		for(; line_stride >= str; line_stride -= cdc->console_width) {
+		for (; line_stride >= str; line_stride -= cdc->console_width) {
 			BLF_position(mono, cdc->xy[0], cdc->xy[1], 0);
 			BLF_draw(mono, line_stride, cdc->console_width);
 			
-			if(cdc->sel[0] != cdc->sel[1]) {
+			if (cdc->sel[0] != cdc->sel[1]) {
 				// glColor4ub(0, 255, 0, 96); // debug
 				console_draw_sel(cdc->sel, cdc->xy, cdc->console_width, cdc->cwidth, cdc->lheight);
 				STEP_SEL(cdc->console_width);
@@ -175,7 +176,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str
 			cdc->xy[1] += cdc->lheight;
 			
 			/* check if were out of view bounds */
-			if(cdc->xy[1] > cdc->ymax)
+			if (cdc->xy[1] > cdc->ymax)
 				return 0;
 		}
 
@@ -184,9 +185,9 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str
 	}
 	else { /* simple, no wrap */
 
-		if(bg) {
+		if (bg) {
 			glColor3ubv(bg);
-			glRecti(0, cdc->xy[1]-rct_ofs, cdc->winx, cdc->xy[1]+cdc->lheight-rct_ofs);
+			glRecti(0, cdc->xy[1] - rct_ofs, cdc->winx, cdc->xy[1] + cdc->lheight - rct_ofs);
 		}
 
 		glColor3ubv(fg);
@@ -194,11 +195,11 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str
 		BLF_position(mono, cdc->xy[0], cdc->xy[1], 0);
 		BLF_draw(mono, str, str_len);
 		
-		if(cdc->sel[0] != cdc->sel[1]) {
+		if (cdc->sel[0] != cdc->sel[1]) {
 			int isel[2];
 
-			isel[0]= str_len - cdc->sel[1];
-			isel[1]= str_len - cdc->sel[0];
+			isel[0] = str_len - cdc->sel[1];
+			isel[1] = str_len - cdc->sel[0];
 
 			// glColor4ub(255, 255, 0, 96); // debug
 			console_draw_sel(isel, cdc->xy, str_len, cdc->cwidth, cdc->lheight);
@@ -207,7 +208,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str
 
 		cdc->xy[1] += cdc->lheight;
 
-		if(cdc->xy[1] > cdc->ymax)
+		if (cdc->xy[1] > cdc->ymax)
 			return 0;
 	}
 
@@ -220,78 +221,78 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str
 
 int textview_draw(TextViewContext *tvc, int draw, int mval[2], void **mouse_pick, int *pos_pick)
 {
-	ConsoleDrawContext cdc= {0};
+	ConsoleDrawContext cdc = {0};
 
-	int x_orig=CONSOLE_DRAW_MARGIN, y_orig=CONSOLE_DRAW_MARGIN + tvc->lheight/6;
+	int x_orig = CONSOLE_DRAW_MARGIN, y_orig = CONSOLE_DRAW_MARGIN + tvc->lheight / 6;
 	int xy[2], y_prev;
-	int sel[2]= {-1, -1}; /* defaults disabled */
+	int sel[2] = {-1, -1}; /* defaults disabled */
 	unsigned char fg[3], bg[3];
-	const int mono= blf_mono_font;
+	const int mono = blf_mono_font;
 
 	console_font_begin(tvc);
 
-	xy[0]= x_orig; xy[1]= y_orig;
+	xy[0] = x_orig; xy[1] = y_orig;
 
-	if(mval[1] != INT_MAX)
+	if (mval[1] != INT_MAX)
 		mval[1] += (tvc->ymin + CONSOLE_DRAW_MARGIN);
 
-	if(pos_pick)
+	if (pos_pick)
 		*pos_pick = 0;
 
 	/* constants for the sequencer context */
-	cdc.cwidth= (int)BLF_fixed_width(mono);
+	cdc.cwidth = (int)BLF_fixed_width(mono);
 	assert(cdc.cwidth > 0);
-	cdc.lheight= tvc->lheight;
-	cdc.console_width= (tvc->winx - (CONSOLE_DRAW_SCROLL + CONSOLE_DRAW_MARGIN*2) ) / cdc.cwidth;
+	cdc.lheight = tvc->lheight;
+	cdc.console_width = (tvc->winx - (CONSOLE_DRAW_SCROLL + CONSOLE_DRAW_MARGIN * 2) ) / cdc.cwidth;
 	CLAMP(cdc.console_width, 1, INT_MAX); /* avoid divide by zero on small windows */
-	cdc.winx= tvc->winx-(CONSOLE_DRAW_MARGIN+CONSOLE_DRAW_SCROLL);
-	cdc.ymin= tvc->ymin;
-	cdc.ymax= tvc->ymax;
-	cdc.xy= xy;
-	cdc.sel= sel;
-	cdc.pos_pick= pos_pick;
-	cdc.mval= mval;
-	cdc.draw= draw;
+	cdc.winx = tvc->winx - (CONSOLE_DRAW_MARGIN + CONSOLE_DRAW_SCROLL);
+	cdc.ymin = tvc->ymin;
+	cdc.ymax = tvc->ymax;
+	cdc.xy = xy;
+	cdc.sel = sel;
+	cdc.pos_pick = pos_pick;
+	cdc.mval = mval;
+	cdc.draw = draw;
 
 	/* shouldnt be needed */
-	tvc->cwidth= cdc.cwidth;
-	tvc->console_width= cdc.console_width;
-	tvc->iter_index= 0;
+	tvc->cwidth = cdc.cwidth;
+	tvc->console_width = cdc.console_width;
+	tvc->iter_index = 0;
 
-	if(tvc->sel_start != tvc->sel_end) {
-		sel[0]= tvc->sel_start;
-		sel[1]= tvc->sel_end;
+	if (tvc->sel_start != tvc->sel_end) {
+		sel[0] = tvc->sel_start;
+		sel[1] = tvc->sel_end;
 	}
 
-	if(tvc->begin(tvc)) {
+	if (tvc->begin(tvc)) {
 
 		do {
 			const char *ext_line;
 			int ext_len;
-			int color_flag= 0;
+			int color_flag = 0;
 
-			y_prev= xy[1];
+			y_prev = xy[1];
 
-			if(draw)
-				color_flag= tvc->line_color(tvc, fg, bg);
+			if (draw)
+				color_flag = tvc->line_color(tvc, fg, bg);
 
 			tvc->line_get(tvc, &ext_line, &ext_len);
 
-			if(!console_draw_string(&cdc, ext_line, ext_len, (color_flag & TVC_LINE_FG) ? fg : NULL, (color_flag & TVC_LINE_BG) ? bg : NULL)) {
+			if (!console_draw_string(&cdc, ext_line, ext_len, (color_flag & TVC_LINE_FG) ? fg : NULL, (color_flag & TVC_LINE_BG) ? bg : NULL)) {
 				/* when drawing, if we pass v2d->cur.ymax, then quit */
-				if(draw) {
+				if (draw) {
 					break; /* past the y limits */
 				}
 			}
 
-			if((mval[1] != INT_MAX) && (mval[1] >= y_prev && mval[1] <= xy[1])) {
-				*mouse_pick= (void *)tvc->iter;
+			if ((mval[1] != INT_MAX) && (mval[1] >= y_prev && mval[1] <= xy[1])) {
+				*mouse_pick = (void *)tvc->iter;
 				break;
 			}
 
 			tvc->iter_index++;
 
-		} while(tvc->step(tvc));
+		} while (tvc->step(tvc));
 	}
 
 	tvc->end(tvc);
diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c
index 388f947..dcead6c 100644
--- a/source/blender/editors/space_logic/logic_buttons.c
+++ b/source/blender/editors/space_logic/logic_buttons.c
@@ -50,65 +50,12 @@
 #include "interface_intern.h"
 #include "logic_intern.h"
 
-#if 0
-static void do_logic_panel_events(bContext *C, void *arg, int event)
-{
-	
-	switch(event) {
-		
-	}
-}
-
-
-/* *** */
-
-static void logic_panel_properties(const bContext *C, Panel *pa)
-{
-//	SpaceLogic *slogic= CTX_wm_space_logic(C);
-	uiBlock *block;
-	
-	block= uiLayoutAbsoluteBlock(pa->layout);
-	uiBlockSetHandleFunc(block, do_logic_panel_events, NULL);
-
-}	
-
-static void logic_panel_view_properties(const bContext *C, Panel *pa)
-{
-	//	SpaceLogic *slogic= CTX_wm_space_logic(C);
-	uiBlock *block;
-	
-	block= uiLayoutAbsoluteBlock(pa->layout);
-	uiBlockSetHandleFunc(block, do_logic_panel_events, NULL);
-	
-}	
-#endif
-
-void logic_buttons_register(ARegionType *UNUSED(art))
-{
-#if 0
-	PanelType *pt;
-
-	pt= MEM_callocN(sizeof(PanelType), "spacetype logic panel properties");
-	strcpy(pt->idname, "LOGIC_PT_properties");
-	strcpy(pt->label, "Logic Properties");
-	pt->draw= logic_panel_properties;
-	BLI_addtail(&art->paneltypes, pt);
-
-	pt= MEM_callocN(sizeof(PanelType), "spacetype logic view properties");
-	strcpy(pt->idname, "LOGIC_PT_view_properties");
-	strcpy(pt->label, "View Properties");
-	pt->draw= logic_panel_view_properties;
-	BLI_addtail(&art->paneltypes, pt);
-#endif
-
-}
-
 static int logic_properties(bContext *C, wmOperator *UNUSED(op))
 {
 	ScrArea *sa= CTX_wm_area(C);
 	ARegion *ar= logic_has_buttons_region(sa);
 	
-	if(ar)
+	if (ar)
 		ED_region_toggle_hidden(C, ar);
 
 	return OPERATOR_FINISHED;
@@ -116,15 +63,15 @@ static int logic_properties(bContext *C, wmOperator *UNUSED(op))
 
 void LOGIC_OT_properties(wmOperatorType *ot)
 {
-	ot->name= "Properties";
-	ot->description= "Toggle display properties panel";
-	ot->idname= "LOGIC_OT_properties";
+	ot->name = "Properties";
+	ot->description = "Toggle display properties panel";
+	ot->idname = "LOGIC_OT_properties";
 	
-	ot->exec= logic_properties;
-	ot->poll= ED_operator_logic_active;
+	ot->exec = logic_properties;
+	ot->poll = ED_operator_logic_active;
 	
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 }
 
 /* Remove Logic Bricks Connections */
@@ -137,15 +84,15 @@ static int cut_links_intersect(uiLinkLine *line, float mcoords[][2], int tot)
 	int i, b;
 	rcti rectlink;
 
-	rectlink.xmin= (int) (line->from->x1 + line->from->x2) / 2;
-	rectlink.ymin= (int) (line->from->y1 + line->from->y2) / 2;
-	rectlink.xmax= (int) (line->to->x1 + line->to->x2) / 2;
-	rectlink.ymax= (int) (line->to->y1 + line->to->y2) / 2;
+	rectlink.xmin = (int) (line->from->x1 + line->from->x2) / 2;
+	rectlink.ymin = (int) (line->from->y1 + line->from->y2) / 2;
+	rectlink.xmax = (int) (line->to->x1 + line->to->x2) / 2;
+	rectlink.ymax = (int) (line->to->y1 + line->to->y2) / 2;
 
-	if(ui_link_bezier_points(&rectlink, coord_array, LINK_RESOL)){
-		for(i=0; i<tot-1; i++)
-			for(b=0; b<LINK_RESOL-1; b++)
-				if(isect_line_line_v2(mcoords[i], mcoords[i+1], coord_array[b], coord_array[b+1]) > 0)
+	if (ui_link_bezier_points(&rectlink, coord_array, LINK_RESOL)) {
+		for (i=0; i<tot-1; i++)
+			for (b=0; b<LINK_RESOL-1; b++)
+				if (isect_line_line_v2(mcoords[i], mcoords[i+1], coord_array[b], coord_array[b+1]) > 0)
 					return 1;
 	}
 	return 0;
@@ -164,7 +111,7 @@ static int cut_links_exec(bContext *C, wmOperator *op)
 		UI_view2d_region_to_view(&ar->v2d, (short)loc[0], (short)loc[1], 
 								 &mcoords[i][0], &mcoords[i][1]);
 		i++;
-		if(i>= 256) break;
+		if (i>= 256) break;
 	}
 	RNA_END;
 
@@ -172,15 +119,15 @@ 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)
+		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) {
+			while (but) {
+				if (but->type==LINK && but->link) {
+					for (line= but->link->lines.first; line; line= nline) {
 						nline= line->next;
 
-						if(cut_links_intersect(line, mcoords, i)) {
+						if (cut_links_intersect(line, mcoords, i)) {
 							ui_delete_linkline(line, but);
 						}
 					}
@@ -197,19 +144,19 @@ void LOGIC_OT_links_cut(wmOperatorType *ot)
 {
 	PropertyRNA *prop;
 	
-	ot->name= "Cut links";
-	ot->idname= "LOGIC_OT_links_cut";
-	ot->description= "Remove logic brick connections";
+	ot->name = "Cut links";
+	ot->idname = "LOGIC_OT_links_cut";
+	ot->description = "Remove logic brick connections";
 	
-	ot->invoke= WM_gesture_lines_invoke;
-	ot->modal= WM_gesture_lines_modal;
-	ot->exec= cut_links_exec;
-	ot->cancel= WM_gesture_lines_cancel;
+	ot->invoke = WM_gesture_lines_invoke;
+	ot->modal = WM_gesture_lines_modal;
+	ot->exec = cut_links_exec;
+	ot->cancel = WM_gesture_lines_cancel;
 	
-	ot->poll= ED_operator_logic_active;
+	ot->poll = ED_operator_logic_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
diff --git a/source/blender/editors/space_logic/logic_intern.h b/source/blender/editors/space_logic/logic_intern.h
index 457fe14..38b122f 100644
--- a/source/blender/editors/space_logic/logic_intern.h
+++ b/source/blender/editors/space_logic/logic_intern.h
@@ -29,8 +29,8 @@
  */
 
 
-#ifndef ED_LOGIC_INTERN_H
-#define ED_LOGIC_INTERN_H
+#ifndef __LOGIC_INTERN_H__
+#define __LOGIC_INTERN_H__
 
 /* internal exports only */
 struct bContext;
@@ -48,7 +48,6 @@ struct ARegion *logic_has_buttons_region(struct ScrArea *sa);
 /* logic_ops.c */
 
 /* logic_buttons.c */
-void logic_buttons_register(struct ARegionType *art);
 void LOGIC_OT_properties(struct wmOperatorType *ot);
 void LOGIC_OT_links_cut(struct wmOperatorType *ot);
 
@@ -56,5 +55,5 @@ void LOGIC_OT_links_cut(struct wmOperatorType *ot);
 void logic_buttons(struct bContext *C, struct ARegion *ar);
 void make_unique_prop_names(struct bContext *C, char *str);
 
-#endif /* ED_LOGIC_INTERN_H */
+#endif /* __LOGIC_INTERN_H__ */
 
diff --git a/source/blender/editors/space_logic/logic_ops.c b/source/blender/editors/space_logic/logic_ops.c
index 0dfcafc..cac4fe0 100644
--- a/source/blender/editors/space_logic/logic_ops.c
+++ b/source/blender/editors/space_logic/logic_ops.c
@@ -119,7 +119,7 @@ static Object *edit_object_property_get(bContext *C, wmOperator *op)
 	RNA_string_get(op->ptr, "object", ob_name);
 
 	/* if ob_name is valid try to find the object with this name
-	otherwise gets the active object */
+	 * otherwise gets the active object */
 	if (BLI_strnlen(ob_name, MAX_NAME) > 0)
 		ob = BLI_findstring(&(CTX_data_main(C)->object), ob_name, offsetof(ID, name) + 2);
 	else
@@ -258,16 +258,16 @@ static int sensor_remove_exec(bContext *C, wmOperator *op)
 
 static void LOGIC_OT_sensor_remove(wmOperatorType *ot)
 {
-	ot->name= "Remove Sensor";
-	ot->description= "Remove a sensor from the active object";
-	ot->idname= "LOGIC_OT_sensor_remove";
+	ot->name = "Remove Sensor";
+	ot->description = "Remove a sensor from the active object";
+	ot->idname = "LOGIC_OT_sensor_remove";
 	
-	ot->invoke= sensor_remove_invoke;
-	ot->exec= sensor_remove_exec;
-	ot->poll= edit_sensor_poll;
+	ot->invoke = sensor_remove_invoke;
+	ot->exec = sensor_remove_exec;
+	ot->poll = edit_sensor_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	edit_sensor_properties(ot);
 }
 
@@ -293,7 +293,7 @@ static int sensor_add_exec(bContext *C, wmOperator *op)
 	prop = RNA_struct_find_property(&sens_ptr, "type");
 
 	RNA_string_get(op->ptr, "name", name);
-	if(BLI_strnlen(name, MAX_NAME) < 1){
+	if (BLI_strnlen(name, MAX_NAME) < 1) {
 		RNA_property_enum_name(C, &sens_ptr, prop, RNA_property_enum_get(&sens_ptr, prop), &sens_name);
 		BLI_strncpy(sens->name, sens_name, sizeof(sens->name));
 	}
@@ -313,20 +313,20 @@ static void LOGIC_OT_sensor_add(wmOperatorType *ot)
 	PropertyRNA *prop;
 	
 	/* identifiers */
-	ot->name= "Add Sensor";
+	ot->name = "Add Sensor";
 	ot->description = "Add a sensor to the active object";
-	ot->idname= "LOGIC_OT_sensor_add";
+	ot->idname = "LOGIC_OT_sensor_add";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= sensor_add_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = sensor_add_exec;
+	ot->poll = ED_operator_object_active_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
-	ot->prop= prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, SENS_ALWAYS, "Type", "Type of sensor to add");
+	ot->prop = prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, SENS_ALWAYS, "Type", "Type of sensor to add");
 	RNA_def_enum_funcs(prop, rna_Sensor_type_itemf);
 	RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the Sensor to add");
 	RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the Object to add the Sensor to");
@@ -361,16 +361,16 @@ static int controller_remove_exec(bContext *C, wmOperator *op)
 
 static void LOGIC_OT_controller_remove(wmOperatorType *ot)
 {
-	ot->name= "Remove Controller";
-	ot->description= "Remove a controller from the active object";
-	ot->idname= "LOGIC_OT_controller_remove";
+	ot->name = "Remove Controller";
+	ot->description = "Remove a controller from the active object";
+	ot->idname = "LOGIC_OT_controller_remove";
 	
-	ot->invoke= controller_remove_invoke;
-	ot->exec= controller_remove_exec;
-	ot->poll= edit_controller_poll;
+	ot->invoke = controller_remove_invoke;
+	ot->exec = controller_remove_exec;
+	ot->poll = edit_controller_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	edit_controller_properties(ot);
 }
 
@@ -386,7 +386,7 @@ static int controller_add_exec(bContext *C, wmOperator *op)
 	int type= RNA_enum_get(op->ptr, "type");
 
 	ob= edit_object_property_get(C, op);
-	if(!ob)
+	if (!ob)
 		return OPERATOR_CANCELLED;
 	
 	cont= new_controller(type);
@@ -397,7 +397,7 @@ static int controller_add_exec(bContext *C, wmOperator *op)
 	prop = RNA_struct_find_property(&cont_ptr, "type");
 
 	RNA_string_get(op->ptr, "name", name);
-	if(BLI_strnlen(name, MAX_NAME) < 1){
+	if (BLI_strnlen(name, MAX_NAME) < 1) {
 		RNA_property_enum_name(C, &cont_ptr, prop, RNA_property_enum_get(&cont_ptr, prop), &cont_name);
 		BLI_strncpy(cont->name, cont_name, sizeof(cont->name));
 	}
@@ -406,8 +406,8 @@ static int controller_add_exec(bContext *C, wmOperator *op)
 
 	make_unique_prop_names(C, cont->name);
 	/* set the controller state mask from the current object state.
-	 A controller is always in a single state, so select the lowest bit set
-	 from the object state */
+	 * A controller is always in a single state, so select the lowest bit set
+	 * from the object state */
 	for (bit=0; bit<OB_MAX_STATES; bit++) {
 		if (ob->state & (1<<bit))
 			break;
@@ -428,20 +428,20 @@ static int controller_add_exec(bContext *C, wmOperator *op)
 static void LOGIC_OT_controller_add(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Controller";
+	ot->name = "Add Controller";
 	ot->description = "Add a controller to the active object";
-	ot->idname= "LOGIC_OT_controller_add";
+	ot->idname = "LOGIC_OT_controller_add";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= controller_add_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = controller_add_exec;
+	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, "type", controller_type_items, CONT_LOGIC_AND, "Type", "Type of controller to add");
+	ot->prop = RNA_def_enum(ot->srna, "type", controller_type_items, CONT_LOGIC_AND, "Type", "Type of controller to add");
 	RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the Controller to add");
 	RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the Object to add the Controller to");
 }
@@ -475,16 +475,16 @@ static int actuator_remove_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e
 
 static void LOGIC_OT_actuator_remove(wmOperatorType *ot)
 {
-	ot->name= "Remove Actuator";
-	ot->description= "Remove an actuator from the active object";
-	ot->idname= "LOGIC_OT_actuator_remove";
+	ot->name = "Remove Actuator";
+	ot->description = "Remove an actuator from the active object";
+	ot->idname = "LOGIC_OT_actuator_remove";
 	
-	ot->invoke= actuator_remove_invoke;
-	ot->exec= actuator_remove_exec;
-	ot->poll= edit_actuator_poll;
+	ot->invoke = actuator_remove_invoke;
+	ot->exec = actuator_remove_exec;
+	ot->poll = edit_actuator_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	edit_actuator_properties(ot);
 }
 
@@ -499,7 +499,7 @@ static int actuator_add_exec(bContext *C, wmOperator *op)
 	int type= RNA_enum_get(op->ptr, "type");
 		
 	ob= edit_object_property_get(C, op);
-	if(!ob)
+	if (!ob)
 		return OPERATOR_CANCELLED;
 
 	act= new_actuator(type);
@@ -510,7 +510,7 @@ static int actuator_add_exec(bContext *C, wmOperator *op)
 	prop = RNA_struct_find_property(&act_ptr, "type");
 
 	RNA_string_get(op->ptr, "name", name);
-	if (BLI_strnlen(name, MAX_NAME) < 1){
+	if (BLI_strnlen(name, MAX_NAME) < 1) {
 		RNA_property_enum_name(C, &act_ptr, prop, RNA_property_enum_get(&act_ptr, prop), &act_name);
 		BLI_strncpy(act->name, act_name, sizeof(act->name));
 	}
@@ -530,20 +530,20 @@ static void LOGIC_OT_actuator_add(wmOperatorType *ot)
 	PropertyRNA *prop;
 	
 	/* identifiers */
-	ot->name= "Add Actuator";
+	ot->name = "Add Actuator";
 	ot->description = "Add an actuator to the active object";
-	ot->idname= "LOGIC_OT_actuator_add";
+	ot->idname = "LOGIC_OT_actuator_add";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= actuator_add_exec;
-	ot->poll= ED_operator_object_active_editable;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = actuator_add_exec;
+	ot->poll = ED_operator_object_active_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
-	ot->prop= prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, CONT_LOGIC_AND, "Type", "Type of actuator to add");
+	ot->prop = prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, CONT_LOGIC_AND, "Type", "Type of actuator to add");
 	RNA_def_enum_funcs(prop, rna_Actuator_type_itemf);
 	RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the Actuator to add");
 	RNA_def_string(ot->srna, "object", "", MAX_NAME, "Object", "Name of the Object to add the Actuator to");
@@ -584,17 +584,17 @@ static int sensor_move_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event
 static void LOGIC_OT_sensor_move(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Move Sensor";
+	ot->name = "Move Sensor";
 	ot->description = "Move Sensor";
-	ot->idname= "LOGIC_OT_sensor_move";
+	ot->idname = "LOGIC_OT_sensor_move";
 	
 	/* api callbacks */
-	ot->invoke= sensor_move_invoke;
-	ot->exec= sensor_move_exec;
-	ot->poll= edit_sensor_poll;
+	ot->invoke = sensor_move_invoke;
+	ot->exec = sensor_move_exec;
+	ot->poll = edit_sensor_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	edit_sensor_properties(ot);
@@ -629,17 +629,17 @@ static int controller_move_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e
 static void LOGIC_OT_controller_move(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Move Controller";
+	ot->name = "Move Controller";
 	ot->description = "Move Controller";
-	ot->idname= "LOGIC_OT_controller_move";
+	ot->idname = "LOGIC_OT_controller_move";
 	
 	/* api callbacks */
-	ot->invoke= controller_move_invoke;
-	ot->exec= controller_move_exec;
-	ot->poll= edit_controller_poll;
+	ot->invoke = controller_move_invoke;
+	ot->exec = controller_move_exec;
+	ot->poll = edit_controller_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	edit_controller_properties(ot);
@@ -674,17 +674,17 @@ static int actuator_move_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
 static void LOGIC_OT_actuator_move(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Move Actuator";
+	ot->name = "Move Actuator";
 	ot->description = "Move Actuator";
-	ot->idname= "LOGIC_OT_actuator_move";
+	ot->idname = "LOGIC_OT_actuator_move";
 	
 	/* api callbacks */
-	ot->invoke= actuator_move_invoke;
-	ot->exec= actuator_move_exec;
-	ot->poll= edit_actuator_poll;
+	ot->invoke = actuator_move_invoke;
+	ot->exec = actuator_move_exec;
+	ot->poll = edit_actuator_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	edit_actuator_properties(ot);
@@ -708,17 +708,17 @@ static int texface_convert_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e
  static void LOGIC_OT_texface_convert(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "TexFace to Material Converter";
+	ot->name = "TexFace to Material Converter";
 	ot->description = "Convert old texface settings into material. It may create new materials if needed";
-	ot->idname= "LOGIC_OT_texface_convert";
+	ot->idname = "LOGIC_OT_texface_convert";
 
 	/* api callbacks */
-	ot->invoke= texface_convert_invoke;
-	ot->exec= texface_convert_exec;
-//	ot->poll= texface_convert_poll;
+	ot->invoke = texface_convert_invoke;
+	ot->exec = texface_convert_exec;
+//	ot->poll = texface_convert_poll;
  
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index 2c1e7a0..f7c69c8 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -124,23 +124,23 @@ void make_unique_prop_names(bContext *C, char *str)
 	char **names;
 	
 	/* this function is called by a Button, and gives the current
-		* stringpointer as an argument, this is the one that can change
-		*/
+	 * stringpointer as an argument, this is the one that can change
+	 */
 	
 	idar= get_selected_and_linked_obs(C, &obcount, BUTS_SENS_SEL|BUTS_SENS_ACT|BUTS_ACT_SEL|BUTS_ACT_ACT|BUTS_CONT_SEL|BUTS_CONT_ACT);
 	
 	/* for each object, make properties and sca names unique */
 	
 	/* count total names */
-	for(a=0; a<obcount; a++) {
+	for (a=0; a<obcount; a++) {
 		ob= (Object *)idar[a];
 		propcount+= BLI_countlist(&ob->prop);
 		propcount+= BLI_countlist(&ob->sensors);
 		propcount+= BLI_countlist(&ob->controllers);
 		propcount+= BLI_countlist(&ob->actuators);
 	}	
-	if(propcount==0) {
-		if(idar) MEM_freeN(idar);
+	if (propcount==0) {
+		if (idar) MEM_freeN(idar);
 		return;
 	}
 	
@@ -149,25 +149,25 @@ void make_unique_prop_names(bContext *C, char *str)
 	
 	/* count total names */
 	nr= 0;
-	for(a=0; a<obcount; a++) {
+	for (a=0; a<obcount; a++) {
 		ob= (Object *)idar[a];
 		prop= ob->prop.first;
-		while(prop) {
+		while (prop) {
 			names[nr++]= prop->name;
 			prop= prop->next;
 		}
 		sens= ob->sensors.first;
-		while(sens) {
+		while (sens) {
 			names[nr++]= sens->name;
 			sens= sens->next;
 		}
 		cont= ob->controllers.first;
-		while(cont) {
+		while (cont) {
 			names[nr++]= cont->name;
 			cont= cont->next;
 		}
 		act= ob->actuators.first;
-		while(act) {
+		while (act) {
 			names[nr++]= act->name;
 			act= act->next;
 		}
@@ -177,8 +177,8 @@ void make_unique_prop_names(bContext *C, char *str)
 	
 	/* now we check for double names, and change them */
 	
-	for(nr=0; nr<propcount; nr++) {
-		if(names[nr]!=str && strcmp( names[nr], str )==0 ) {
+	for (nr=0; nr<propcount; nr++) {
+		if (names[nr]!=str && strcmp( names[nr], str )==0 ) {
 			BLI_newname(str, +1);
 		}
 	}
@@ -208,19 +208,19 @@ static void old_sca_move_sensor(bContext *C, void *datav, void *move_up)
 	// val= pupmenu("Move up%x1|Move down %x2");
 	val = move_up ? 1:2;
 	
-	if(val>0) {
+	if (val>0) {
 		/* now find out which object has this ... */
 		base= FIRSTBASE;
-		while(base) {
+		while (base) {
 		
 			sens= base->object->sensors.first;
-			while(sens) {
-				if(sens == sens_to_delete) break;
+			while (sens) {
+				if (sens == sens_to_delete) break;
 				sens= sens->next;
 			}
 			
-			if(sens) {
-				if( val==1 && sens->prev) {
+			if (sens) {
+				if ( val==1 && sens->prev) {
 					for (tmp=sens->prev; tmp; tmp=tmp->prev) {
 						if (tmp->flag & SENS_VISIBLE)
 							break;
@@ -230,7 +230,7 @@ static void old_sca_move_sensor(bContext *C, void *datav, void *move_up)
 						BLI_insertlinkbefore(&base->object->sensors, tmp, sens);
 					}
 				}
-				else if( val==2 && sens->next) {
+				else if ( val==2 && sens->next) {
 					for (tmp=sens->next; tmp; tmp=tmp->next) {
 						if (tmp->flag & SENS_VISIBLE)
 							break;
@@ -261,23 +261,23 @@ static void old_sca_move_controller(bContext *C, void *datav, void *move_up)
 	//val= pupmenu("Move up%x1|Move down %x2");
 	val = move_up ? 1:2;
 	
-	if(val>0) {
+	if (val>0) {
 		/* now find out which object has this ... */
 		base= FIRSTBASE;
-		while(base) {
+		while (base) {
 		
 			cont= base->object->controllers.first;
-			while(cont) {
-				if(cont == controller_to_del) break;
+			while (cont) {
+				if (cont == controller_to_del) break;
 				cont= cont->next;
 			}
 			
-			if(cont) {
-				if( val==1 && cont->prev) {
+			if (cont) {
+				if ( val==1 && cont->prev) {
 					/* locate the controller that has the same state mask but is earlier in the list */
 					tmp = cont->prev;
-					while(tmp) {
-						if(tmp->state_mask & cont->state_mask) 
+					while (tmp) {
+						if (tmp->state_mask & cont->state_mask)
 							break;
 						tmp = tmp->prev;
 					}
@@ -286,10 +286,10 @@ static void old_sca_move_controller(bContext *C, void *datav, void *move_up)
 						BLI_insertlinkbefore(&base->object->controllers, tmp, cont);
 					}
 				}
-				else if( val==2 && cont->next) {
+				else if ( val==2 && cont->next) {
 					tmp = cont->next;
-					while(tmp) {
-						if(tmp->state_mask & cont->state_mask) 
+					while (tmp) {
+						if (tmp->state_mask & cont->state_mask)
 							break;
 						tmp = tmp->next;
 					}
@@ -317,19 +317,19 @@ static void old_sca_move_actuator(bContext *C, void *datav, void *move_up)
 	//val= pupmenu("Move up%x1|Move down %x2");
 	val = move_up ? 1:2;
 	
-	if(val>0) {
+	if (val>0) {
 		/* now find out which object has this ... */
 		base= FIRSTBASE;
-		while(base) {
+		while (base) {
 		
 			act= base->object->actuators.first;
-			while(act) {
-				if(act == actuator_to_move) break;
+			while (act) {
+				if (act == actuator_to_move) break;
 				act= act->next;
 			}
 			
-			if(act) {
-				if( val==1 && act->prev) {
+			if (act) {
+				if ( val==1 && act->prev) {
 					/* locate the first visible actuators before this one */
 					for (tmp = act->prev; tmp; tmp=tmp->prev) {
 						if (tmp->flag & ACT_VISIBLE)
@@ -340,7 +340,7 @@ static void old_sca_move_actuator(bContext *C, void *datav, void *move_up)
 						BLI_insertlinkbefore(&base->object->actuators, tmp, act);
 					}
 				}
-				else if( val==2 && act->next) {
+				else if ( val==2 && act->next) {
 					for (tmp=act->next; tmp; tmp=tmp->next) {
 						if (tmp->flag & ACT_VISIBLE)
 							break;
@@ -369,7 +369,7 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
 	int didit, bit;
 	
 	ob= CTX_data_active_object(C);
-	if(ob==NULL) return;
+	if (ob==NULL) return;
 	
 	switch(event) {
 
@@ -385,8 +385,8 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
 		break;
 	
 	case B_ADD_SENS:
-		for(ob=bmain->object.first; ob; ob=ob->id.next) {
-			if(ob->scaflag & OB_ADDSENS) {
+		for (ob=bmain->object.first; ob; ob=ob->id.next) {
+			if (ob->scaflag & OB_ADDSENS) {
 				ob->scaflag &= ~OB_ADDSENS;
 				sens= new_sensor(SENS_ALWAYS);
 				BLI_addtail(&(ob->sensors), sens);
@@ -399,10 +399,10 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
 		break;
 
 	case B_CHANGE_SENS:
-		for(ob=bmain->object.first; ob; ob=ob->id.next) {
+		for (ob=bmain->object.first; ob; ob=ob->id.next) {
 			sens= ob->sensors.first;
-			while(sens) {
-				if(sens->type != sens->otype) {
+			while (sens) {
+				if (sens->type != sens->otype) {
 					init_sensor(sens);
 					sens->otype= sens->type;
 					break;
@@ -413,10 +413,10 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
 		break;
 	
 	case B_DEL_SENS:
-		for(ob=bmain->object.first; ob; ob=ob->id.next) {
+		for (ob=bmain->object.first; ob; ob=ob->id.next) {
 			sens= ob->sensors.first;
-			while(sens) {
-				if(sens->flag & SENS_DEL) {
+			while (sens) {
+				if (sens->flag & SENS_DEL) {
 					BLI_remlink(&(ob->sensors), sens);
 					free_sensor(sens);
 					break;
@@ -428,16 +428,16 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
 		break;
 	
 	case B_ADD_CONT:
-		for(ob=bmain->object.first; ob; ob=ob->id.next) {
-			if(ob->scaflag & OB_ADDCONT) {
+		for (ob=bmain->object.first; ob; ob=ob->id.next) {
+			if (ob->scaflag & OB_ADDCONT) {
 				ob->scaflag &= ~OB_ADDCONT;
 				cont= new_controller(CONT_LOGIC_AND);
 				make_unique_prop_names(C, cont->name);
 				ob->scaflag |= OB_SHOWCONT;
 				BLI_addtail(&(ob->controllers), cont);
 				/* set the controller state mask from the current object state.
-				   A controller is always in a single state, so select the lowest bit set
-				   from the object state */
+				 * A controller is always in a single state, so select the lowest bit set
+				 * from the object state */
 				for (bit=0; bit<32; bit++) {
 					if (ob->state & (1<<bit))
 						break;
@@ -453,8 +453,8 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
 		break;
 
 	case B_SET_STATE_BIT:
-		for(ob=bmain->object.first; ob; ob=ob->id.next) {
-			if(ob->scaflag & OB_ALLSTATE) {
+		for (ob=bmain->object.first; ob; ob=ob->id.next) {
+			if (ob->scaflag & OB_ALLSTATE) {
 				ob->scaflag &= ~OB_ALLSTATE;
 				ob->state = 0x3FFFFFFF;
 			}
@@ -462,8 +462,8 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
 		break;
 
 	case B_INIT_STATE_BIT:
-		for(ob=bmain->object.first; ob; ob=ob->id.next) {
-			if(ob->scaflag & OB_INITSTBIT) {
+		for (ob=bmain->object.first; ob; ob=ob->id.next) {
+			if (ob->scaflag & OB_INITSTBIT) {
 				ob->scaflag &= ~OB_INITSTBIT;
 				ob->state = ob->init_state;
 				if (!ob->state)
@@ -473,10 +473,10 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
 		break;
 
 	case B_CHANGE_CONT:
-		for(ob=bmain->object.first; ob; ob=ob->id.next) {
+		for (ob=bmain->object.first; ob; ob=ob->id.next) {
 			cont= ob->controllers.first;
-			while(cont) {
-				if(cont->type != cont->otype) {
+			while (cont) {
+				if (cont->type != cont->otype) {
 					init_controller(cont);
 					cont->otype= cont->type;
 					break;
@@ -488,10 +488,10 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
 	
 
 	case B_DEL_CONT:
-		for(ob=bmain->object.first; ob; ob=ob->id.next) {
+		for (ob=bmain->object.first; ob; ob=ob->id.next) {
 			cont= ob->controllers.first;
-			while(cont) {
-				if(cont->flag & CONT_DEL) {
+			while (cont) {
+				if (cont->flag & CONT_DEL) {
 					BLI_remlink(&(ob->controllers), cont);
 					unlink_controller(cont);
 					free_controller(cont);
@@ -504,8 +504,8 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
 		break;
 
 	case B_ADD_ACT:
-		for(ob=bmain->object.first; ob; ob=ob->id.next) {
-			if(ob->scaflag & OB_ADDACT) {
+		for (ob=bmain->object.first; ob; ob=ob->id.next) {
+			if (ob->scaflag & OB_ADDACT) {
 				ob->scaflag &= ~OB_ADDACT;
 				act= new_actuator(ACT_OBJECT);
 				make_unique_prop_names(C, act->name);
@@ -517,10 +517,10 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
 		break;
 
 	case B_CHANGE_ACT:
-		for(ob=bmain->object.first; ob; ob=ob->id.next) {
+		for (ob=bmain->object.first; ob; ob=ob->id.next) {
 			act= ob->actuators.first;
-			while(act) {
-				if(act->type != act->otype) {
+			while (act) {
+				if (act->type != act->otype) {
 					init_actuator(act);
 					act->otype= act->type;
 					break;
@@ -531,10 +531,10 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
 		break;
 
 	case B_DEL_ACT:
-		for(ob=bmain->object.first; ob; ob=ob->id.next) {
+		for (ob=bmain->object.first; ob; ob=ob->id.next) {
 			act= ob->actuators.first;
-			while(act) {
-				if(act->flag & ACT_DEL) {
+			while (act) {
+				if (act->flag & ACT_DEL) {
 					BLI_remlink(&(ob->actuators), act);
 					unlink_actuator(act);
 					free_actuator(act);
@@ -549,38 +549,38 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
 	case B_SOUNDACT_BROWSE:
 		/* since we don't know which... */
 		didit= 0;
-		for(ob=bmain->object.first; ob; ob=ob->id.next) {
+		for (ob=bmain->object.first; ob; ob=ob->id.next) {
 			act= ob->actuators.first;
-			while(act)
+			while (act)
 			{
-				if(act->type==ACT_SOUND)
+				if (act->type==ACT_SOUND)
 				{
 					bSoundActuator *sa= act->data;
-					if(sa->sndnr)
+					if (sa->sndnr)
 					{
 						ID *sound= bmain->sound.first;
 						int nr= 1;
 
-						if(sa->sndnr == -2) {
+						if (sa->sndnr == -2) {
 // XXX							activate_databrowse((ID *)bmain->sound.first, ID_SO, 0, B_SOUNDACT_BROWSE,
 //											&sa->sndnr, do_logic_buts);
 							break;
 						}
 
-						while(sound)
+						while (sound)
 						{
-							if(nr==sa->sndnr)
+							if (nr==sa->sndnr)
 								break;
 							nr++;
 							sound= sound->next;
 						}
 						
-						if(sa->sound)
+						if (sa->sound)
 							((ID *)sa->sound)->us--;
 						
 						sa->sound= (struct bSound *)sound;
 						
-						if(sound)
+						if (sound)
 							sound->us++;
 						
 						sa->sndnr= 0;
@@ -589,7 +589,7 @@ static void do_logic_buts(bContext *C, void *UNUSED(arg), int event)
 				}
 				act= act->next;
 			}
-			if(didit)
+			if (didit)
 				break;
 		}
 
@@ -759,12 +759,12 @@ static void set_sca_ob(Object *ob)
 	bActuator *act;
 
 	cont= ob->controllers.first;
-	while(cont) {
+	while (cont) {
 		cont->mynew= (bController *)ob;
 		cont= cont->next;
 	}
 	act= ob->actuators.first;
-	while(act) {
+	while (act) {
 		act->mynew= (bActuator *)ob;
 		act= act->next;
 	}
@@ -788,10 +788,10 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf
 	
 	*count= 0;
 	
-	if(scene==NULL) return NULL;
+	if (scene==NULL) return NULL;
 	
 	ob= bmain->object.first;
-	while(ob) {
+	while (ob) {
 		ob->scavisflag= 0;
 		set_sca_ob(ob);
 		ob= ob->id.next;
@@ -801,78 +801,78 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf
 	lay= scene->lay;
 	
 	base= FIRSTBASE;
-	while(base) {
-		if(base->lay & lay) {
-			if(base->flag & SELECT) {
-				if(scavisflag & BUTS_SENS_SEL) base->object->scavisflag |= OB_VIS_SENS;
-				if(scavisflag & BUTS_CONT_SEL) base->object->scavisflag |= OB_VIS_CONT;
-				if(scavisflag & BUTS_ACT_SEL) base->object->scavisflag |= OB_VIS_ACT;
+	while (base) {
+		if (base->lay & lay) {
+			if (base->flag & SELECT) {
+				if (scavisflag & BUTS_SENS_SEL) base->object->scavisflag |= OB_VIS_SENS;
+				if (scavisflag & BUTS_CONT_SEL) base->object->scavisflag |= OB_VIS_CONT;
+				if (scavisflag & BUTS_ACT_SEL) base->object->scavisflag |= OB_VIS_ACT;
 			}
 		}
 		base= base->next;
 	}
 
-	if(obact) {
-		if(scavisflag & BUTS_SENS_ACT) obact->scavisflag |= OB_VIS_SENS;
-		if(scavisflag & BUTS_CONT_ACT) obact->scavisflag |= OB_VIS_CONT;
-		if(scavisflag & BUTS_ACT_ACT) obact->scavisflag |= OB_VIS_ACT;
+	if (obact) {
+		if (scavisflag & BUTS_SENS_ACT) obact->scavisflag |= OB_VIS_SENS;
+		if (scavisflag & BUTS_CONT_ACT) obact->scavisflag |= OB_VIS_CONT;
+		if (scavisflag & BUTS_ACT_ACT) obact->scavisflag |= OB_VIS_ACT;
 	}
 	
 	/* BUTS_XXX_STATE are similar to BUTS_XXX_LINK for selecting the object */
-	if(scavisflag & (BUTS_SENS_LINK|BUTS_CONT_LINK|BUTS_ACT_LINK|BUTS_SENS_STATE|BUTS_ACT_STATE)) {
+	if (scavisflag & (BUTS_SENS_LINK|BUTS_CONT_LINK|BUTS_ACT_LINK|BUTS_SENS_STATE|BUTS_ACT_STATE)) {
 		doit= 1;
-		while(doit) {
+		while (doit) {
 			doit= 0;
 			
 			ob= bmain->object.first;
-			while(ob) {
+			while (ob) {
 			
 				/* 1st case: select sensor when controller selected */
-				if((scavisflag & (BUTS_SENS_LINK|BUTS_SENS_STATE)) && (ob->scavisflag & OB_VIS_SENS)==0) {
+				if ((scavisflag & (BUTS_SENS_LINK|BUTS_SENS_STATE)) && (ob->scavisflag & OB_VIS_SENS)==0) {
 					sens= ob->sensors.first;
-					while(sens) {
-						for(a=0; a<sens->totlinks; a++) {
-							if(sens->links[a]) {
+					while (sens) {
+						for (a=0; a<sens->totlinks; a++) {
+							if (sens->links[a]) {
 								obt= (Object *)sens->links[a]->mynew;
-								if(obt && (obt->scavisflag & OB_VIS_CONT)) {
+								if (obt && (obt->scavisflag & OB_VIS_CONT)) {
 									doit= 1;
 									ob->scavisflag |= OB_VIS_SENS;
 									break;
 								}
 							}
 						}
-						if(doit) break;
+						if (doit) break;
 						sens= sens->next;
 					}
 				}
 				
 				/* 2nd case: select cont when act selected */
-				if((scavisflag & BUTS_CONT_LINK)  && (ob->scavisflag & OB_VIS_CONT)==0) {
+				if ((scavisflag & BUTS_CONT_LINK)  && (ob->scavisflag & OB_VIS_CONT)==0) {
 					cont= ob->controllers.first;
-					while(cont) {
-						for(a=0; a<cont->totlinks; a++) {
-							if(cont->links[a]) {
+					while (cont) {
+						for (a=0; a<cont->totlinks; a++) {
+							if (cont->links[a]) {
 								obt= (Object *)cont->links[a]->mynew;
-								if(obt && (obt->scavisflag & OB_VIS_ACT)) {
+								if (obt && (obt->scavisflag & OB_VIS_ACT)) {
 									doit= 1;
 									ob->scavisflag |= OB_VIS_CONT;
 									break;
 								}
 							}
 						}
-						if(doit) break;
+						if (doit) break;
 						cont= cont->next;
 					}
 				}
 				
 				/* 3rd case: select controller when sensor selected */
-				if((scavisflag & BUTS_CONT_LINK) && (ob->scavisflag & OB_VIS_SENS)) {
+				if ((scavisflag & BUTS_CONT_LINK) && (ob->scavisflag & OB_VIS_SENS)) {
 					sens= ob->sensors.first;
-					while(sens) {
-						for(a=0; a<sens->totlinks; a++) {
-							if(sens->links[a]) {
+					while (sens) {
+						for (a=0; a<sens->totlinks; a++) {
+							if (sens->links[a]) {
 								obt= (Object *)sens->links[a]->mynew;
-								if(obt && (obt->scavisflag & OB_VIS_CONT)==0) {
+								if (obt && (obt->scavisflag & OB_VIS_CONT)==0) {
 									doit= 1;
 									obt->scavisflag |= OB_VIS_CONT;
 								}
@@ -883,13 +883,13 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf
 				}
 				
 				/* 4th case: select actuator when controller selected */
-				if( (scavisflag & (BUTS_ACT_LINK|BUTS_ACT_STATE))  && (ob->scavisflag & OB_VIS_CONT)) {
+				if ( (scavisflag & (BUTS_ACT_LINK|BUTS_ACT_STATE))  && (ob->scavisflag & OB_VIS_CONT)) {
 					cont= ob->controllers.first;
-					while(cont) {
-						for(a=0; a<cont->totlinks; a++) {
-							if(cont->links[a]) {
+					while (cont) {
+						for (a=0; a<cont->totlinks; a++) {
+							if (cont->links[a]) {
 								obt= (Object *)cont->links[a]->mynew;
-								if(obt && (obt->scavisflag & OB_VIS_ACT)==0) {
+								if (obt && (obt->scavisflag & OB_VIS_ACT)==0) {
 									doit= 1;
 									obt->scavisflag |= OB_VIS_ACT;
 								}
@@ -906,13 +906,13 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf
 	
 	/* now we count */
 	ob= bmain->object.first;
-	while(ob) {
-		if( ob->scavisflag ) (*count)++;
+	while (ob) {
+		if ( ob->scavisflag ) (*count)++;
 		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");
 	
@@ -925,12 +925,12 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf
 		nr++;
 	}
 
-	while(ob) {
-		if( (ob->scavisflag) && (ob != obact)) {
+	while (ob) {
+		if ( (ob->scavisflag) && (ob != obact)) {
 			idar[nr]= (ID *)ob;
 			nr++;
 		}
-		if(nr>=24) break;
+		if (nr>=24) break;
 		ob= ob->id.next;
 	}
 	
@@ -975,8 +975,8 @@ static void verify_logicbutton_func(bContext *UNUSED(C), void *data1, void *data
 {
 	bSensor *sens= (bSensor*)data1;
 	
-	if(sens->level && sens->tap) {
-		if(data2 == &(sens->level))	
+	if (sens->level && sens->tap) {
+		if (data2 == &(sens->level))
 			sens->tap= 0;
 		else
 			sens->level= 0;
@@ -991,7 +991,7 @@ static void test_scriptpoin_but(struct bContext *C, const char *name, ID **idpp)
 static void test_actionpoin_but(struct bContext *C, const char *name, ID **idpp)
 {
 	*idpp= BLI_findstring(&CTX_data_main(C)->action, name, offsetof(ID, name) + 2);
-	if(*idpp)
+	if (*idpp)
 		id_us_plus(*idpp);
 }
 
@@ -999,28 +999,28 @@ static void test_actionpoin_but(struct bContext *C, const char *name, ID **idpp)
 static void test_obpoin_but(struct bContext *C, const char *name, ID **idpp)
 {
 	*idpp= BLI_findstring(&CTX_data_main(C)->object, name, offsetof(ID, name) + 2);
-	if(*idpp)
+	if (*idpp)
 		id_lib_extern(*idpp);	/* checks lib data, sets correct flag for saving then */
 }
 
 static void test_meshpoin_but(struct bContext *C, const char *name, ID **idpp)
 {
 	*idpp= BLI_findstring(&CTX_data_main(C)->mesh, name, offsetof(ID, name) + 2);
-	if(*idpp)
+	if (*idpp)
 		id_us_plus(*idpp);
 }
 
 static void test_matpoin_but(struct bContext *C, const char *name, ID **idpp)
 {
 	*idpp= BLI_findstring(&CTX_data_main(C)->mat, name, offsetof(ID, name) + 2);
-	if(*idpp)
+	if (*idpp)
 		id_us_plus(*idpp);
 }
 
 static void test_scenepoin_but(struct bContext *C, const char *name, ID **idpp)
 {
 	*idpp= BLI_findstring(&CTX_data_main(C)->scene, name, offsetof(ID, name) + 2);
-	if(*idpp)
+	if (*idpp)
 		id_us_plus(*idpp);
 }
 
@@ -1028,11 +1028,11 @@ static void test_keyboard_event(struct bContext *UNUSED(C), void *arg_ks, void *
 {
 	bKeyboardSensor *ks= (bKeyboardSensor*)arg_ks;
 	
-	if(!ISKEYBOARD(ks->key))
+	if (!ISKEYBOARD(ks->key))
 		ks->key= 0;
-	if(!ISKEYBOARD(ks->qual))
+	if (!ISKEYBOARD(ks->qual))
 		ks->qual= 0;
-	if(!ISKEYBOARD(ks->qual2))
+	if (!ISKEYBOARD(ks->qual2))
 		ks->qual2= 0;
 }
 
@@ -1051,7 +1051,7 @@ static void draw_default_sensor_header(bSensor *sens,
 	/* Pulsing and frequency */
 	uiBlockBeginAlign(block);
 	uiDefIconButBitS(block, TOG, SENS_PULSE_REPEAT, 1, ICON_DOTSUP,
-			 (short)(x + 10 + 0. * (w-20)), (short)(y - 21), (short)(0.1 * (w-20)), 19,
+			 (short)(x + 10 + 0.0 * (w - 20)), (short)(y - 21), (short)(0.1 * (w - 20)), 19,
 			 &sens->pulse, 0.0, 0.0, 0, 0,
 			 "Activate TRUE level triggering (pulse mode)");
 
@@ -1067,12 +1067,12 @@ static void draw_default_sensor_header(bSensor *sens,
 	
 	/* value or shift? */
 	uiBlockBeginAlign(block);
-	but= uiDefButS(block, TOG, 1, "Level",
+	but = uiDefButS(block, TOG, 1, "Level",
 			 (short)(x + 10 + 0.5 * (w-20)), (short)(y - 21), (short)(0.20 * (w-20)), 19,
 			 &sens->level, 0.0, 0.0, 0, 0,
 			 "Level detector, trigger controllers of new states (only applicable upon logic state transition)");
 	uiButSetFunc(but, verify_logicbutton_func, sens, &(sens->level));
-	but= uiDefButS(block, TOG, 1, "Tap",
+	but = uiDefButS(block, TOG, 1, "Tap",
 			 (short)(x + 10 + 0.702 * (w-20)), (short)(y - 21), (short)(0.12 * (w-20)), 19,
 			 &sens->tap, 0.0, 0.0, 0, 0,
 			 "Trigger controllers only for an instant, even while the sensor remains true");
@@ -1090,9 +1090,9 @@ static void get_armature_bone_constraint(Object *ob, const char *posechannel, co
 	/* check that bone exist in the active object */
 	if (ob->type == OB_ARMATURE && ob->pose) {
 		bPoseChannel *pchan= get_pose_channel(ob->pose, posechannel);
-		if(pchan) {
+		if (pchan) {
 			bConstraint *con= BLI_findstring(&pchan->constraints, constraint_name, offsetof(bConstraint, name));
-			if(con) {
+			if (con) {
 				*constraint= con;
 			}
 		}
@@ -1187,9 +1187,9 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
 			
 			ts= sens->data; 
 			
-			/* uiDefBut(block, TEX, 1, "Property:",	xco,yco-22,width, 19, &ts->name, 0, MAX_NAME, 0, 0, "Only look for Objects with this property"); */
+			// uiDefBut(block, TEX, 1, "Property:",	xco,yco-22,width, 19, &ts->name, 0, MAX_NAME, 0, 0, "Only look for Objects with this property");
 			uiDefIDPoinBut(block, test_matpoin_but, ID_MA, 1, "MA:",(short)(xco + 10),(short)(yco-44), (short)(width - 20), 19, &ts->ma,  "Only look for floors with this Material"); 
-			///* uiDefButF(block, NUM, 1, "Margin:",	xco+width/2,yco-44,width/2, 19, &ts->dist, 0.0, 10.0, 100, 0, "Extra margin (distance) for larger sensitivity"); 
+			// uiDefButF(block, NUM, 1, "Margin:",	xco+width/2,yco-44,width/2, 19, &ts->dist, 0.0, 10.0, 100, 0, "Extra margin (distance) for larger sensitivity"); 
 			yco-= ysize; 
 			break; 
 		}
@@ -1218,7 +1218,8 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
 				uiDefBut(block, TEX, 1, "Material:", (short)(xco + 10 + 0.40 * (width-20)),
 					(short)(yco-44), (short)(0.6*(width-20)), 19, &cs->materialName, 0, MAX_NAME, 0, 0,
 					"Only look for Objects with this material");
-			} else {
+			}
+			else {
 				uiDefBut(block, TEX, 1, "Property:", (short)(xco + 10 + 0.40 * (width-20)), (short)(yco-44),
 					(short)(0.6*(width-20)), 19, &cs->name, 0, MAX_NAME, 0, 0,
 					"Only look for Objects with this property");
@@ -1302,14 +1303,14 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
 			
 			if ((ks->type&1)==0) { /* is All Keys option off? */
 				/* line 2: hotkey and allkeys toggle */
-				but= uiDefKeyevtButS(block, 0, "", xco+40, yco-44, (width)/2, 19, &ks->key, "Key code");
+				but = uiDefKeyevtButS(block, 0, "", xco+40, yco-44, (width)/2, 19, &ks->key, "Key code");
 				uiButSetFunc(but, test_keyboard_event, ks, NULL);
 				
 				/* line 3: two key modifyers (qual1, qual2) */
 				uiDefBut(block, LABEL, 0, "Hold",	  xco, yco-68, 40, 19, NULL, 0, 0, 0, 0, "");
-				but= uiDefKeyevtButS(block, 0, "", xco+40, yco-68, (width-50)/2, 19, &ks->qual, "Modifier key code");
+				but = uiDefKeyevtButS(block, 0, "", xco+40, yco-68, (width-50)/2, 19, &ks->qual, "Modifier key code");
 				uiButSetFunc(but, test_keyboard_event, ks, NULL);
-				but= uiDefKeyevtButS(block, 0, "", xco+40+(width-50)/2, yco-68, (width-50)/2, 19, &ks->qual2, "Second Modifier key code");
+				but = uiDefKeyevtButS(block, 0, "", xco+40+(width-50)/2, yco-68, (width-50)/2, 19, &ks->qual2, "Second Modifier key code");
 				uiButSetFunc(but, test_keyboard_event, ks, NULL);
 			}
 			
@@ -1352,18 +1353,19 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
 					ps->name, 0, MAX_NAME, 0, 0,  "Property name");
 			}
 			
-			if(ps->type == SENS_PROP_INTERVAL)
+			if (ps->type == SENS_PROP_INTERVAL)
 			{
 				uiDefBut(block, TEX, 1, "Min: ",		xco,yco-92,width/2, 19,
 					ps->value, 0, MAX_NAME, 0, 0, "check for min value");
 				uiDefBut(block, TEX, 1, "Max: ",		xco+width/2,yco-92,width/2, 19,
 					ps->maxvalue, 0, MAX_NAME, 0, 0, "check for max value");
 			}
-			else if(ps->type == SENS_PROP_CHANGED);
-			else
-			{
+			else if (ps->type == SENS_PROP_CHANGED) {
+				/* pass */
+			}
+			else {
 				uiDefBut(block, TEX, 1, "Value: ",		xco+30,yco-92,width-60, 19,
-					ps->value, 0, MAX_NAME, 0, 0, "check for value");
+				         ps->value, 0, MAX_NAME, 0, 0, "check for value");
 			}
 			
 			yco-= ysize;
@@ -1458,16 +1460,17 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
 			draw_default_sensor_header(sens, block, xco, yco, width);
 			
 			/* Line 2: type selection. The number are a bit mangled to get
-			* proper compatibility with older .blend files. */
+			 * proper compatibility with older .blend files. */
+
 			/* Any sensor type default is 0 but the ms enum starts in 1.
-			 * Therefore the mosue sensor is initialized to 1 in sca.c */
+			 * Therefore the mouse sensor is initialized to 1 in sca.c */
 			str= "Type %t|Left button %x1|Middle button %x2|"
 				"Right button %x4|Wheel Up %x5|Wheel Down %x6|Movement %x8|Mouse over %x16|Mouse over any%x32"; 
 			uiDefButS(block, MENU, B_REDR, str, xco+10, yco-44, (width*0.8f)-20, 19,
 				&ms->type, 0, 31, 0, 0,
 				"Specify the type of event this mouse sensor should trigger on");
 			
-			if(ms->type==32) {
+			if (ms->type==32) {
 				uiDefButBitS(block, TOG, SENS_MOUSE_FOCUS_PULSE, B_REDR, "Pulse",(short)(xco + 10) + (width*0.8f)-20,(short)(yco - 44),
 					(short)(0.20 * (width-20)), 19, &ms->flag, 0.0, 0.0, 0, 0,
 					"Moving the mouse over a different object generates a pulse");	
@@ -1510,14 +1513,12 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
 				&raySens->mode, 0.0, 0.0, 0, 0,
 				"Toggle collision on material or property");
 			
-			if (raySens->mode & SENS_COLLISION_MATERIAL)
-			{
+			if (raySens->mode & SENS_COLLISION_MATERIAL) {
 				uiDefBut(block, TEX, 1, "Material:", xco + 10 + 0.20 * (width-20), yco-44, 0.8*(width-20), 19,
 					&raySens->matname, 0, MAX_NAME, 0, 0,
 					"Only look for Objects with this material");
 			}
-			else
-			{
+			else {
 				uiDefBut(block, TEX, 1, "Property:", xco + 10 + 0.20 * (width-20), yco-44, 0.8*(width-20), 19,
 					&raySens->propname, 0, MAX_NAME, 0, 0,
 					"Only look for Objects with this property");
@@ -1599,7 +1600,8 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
 						str = "All Hat Events";
 						break;
 					}
-				} else {
+				}
+				else {
 					str = "All";
 				}
 				
@@ -1608,7 +1610,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
 					&joy->flag, 0, 0, 0, 0,
 					"Triggered by all events on this joysticks current type (axis/button/hat)");
 			}
-			if(joy->type == SENS_JOY_BUTTON)
+			if (joy->type == SENS_JOY_BUTTON)
 			{
 				if ((joy->flag & SENS_JOY_ANY_EVENT)==0) {
 					uiDefButI(block, NUM, 1, "Number:", xco+10 + 0.6 * (width-20), yco-68, 0.4 * (width-20), 19,
@@ -1616,8 +1618,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
 					"Specify which button to use");
 				}
 			}
-			else if(joy->type == SENS_JOY_AXIS)
-			{
+			else if (joy->type == SENS_JOY_AXIS) {
 				uiDefButS(block, NUM, 1, "Number:", xco+10, yco-68, 0.46 * (width-20), 19,
 				&joy->axis, 1, 8.0, 100, 0,
 				"Specify which axis pair to use, 1 is useually the main direction input");
@@ -1633,8 +1634,7 @@ static short draw_sensorbuttons(Object *ob, bSensor *sens, uiBlock *block, short
 					"The direction of the axis, use 'All Events' to receive events on any direction");
 				}
 			}
-			else if (joy->type == SENS_JOY_HAT)
-			{
+			else if (joy->type == SENS_JOY_HAT) {
 				uiDefButI(block, NUM, 1, "Number:", xco+10, yco-68, 0.46 * (width-20), 19,
 				&joy->hat, 1, 4.0, 100, 0,
 				"Specify which hat to use");
@@ -1691,7 +1691,7 @@ static short draw_controllerbuttons(bController *cont, uiBlock *block, short xco
 	case CONT_PYTHON:
 		ysize= 28;
 		
-		if(cont->data==NULL) init_controller(cont);
+		if (cont->data==NULL) init_controller(cont);
 		pc= cont->data;
 		
 		UI_ThemeColor(TH_PANEL);
@@ -1701,7 +1701,7 @@ static short draw_controllerbuttons(bController *cont, uiBlock *block, short xco
 	
 		uiBlockBeginAlign(block);
 		uiDefButI(block, MENU, B_REDR, "Execution Method%t|Script%x0|Module%x1", xco+4,yco-23, 66, 19, &pc->mode, 0, 0, 0, 0, "Python script type (textblock or module - faster)");
-		if(pc->mode==0)
+		if (pc->mode==0)
 			uiDefIDPoinBut(block, test_scriptpoin_but, ID_TXT, 1, "", xco+70,yco-23,width-74, 19, &pc->text, "Blender textblock to run as a script");
 		else {
 			uiDefBut(block, TEX, 1, "", xco+70,yco-23,(width-70)-25, 19, pc->module, 0, sizeof(pc->module), 0, 0, "Module name and function to run e.g. \"someModule.main\". Internal texts and external python files can be used");
@@ -1877,12 +1877,10 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 			wval = (width-100)/3;
 			if (oa->type == ACT_OBJECT_NORMAL)
 			{
-				if ( ob->gameflag & OB_DYNAMIC )
-				{
+				if (ob->gameflag & OB_DYNAMIC) {
 					ysize= 175;
 				}
-				else
-				{
+				else {
 					ysize= 72;
 				}
 
@@ -1949,7 +1947,8 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 				
 					uiDefButBitS(block, TOG, ACT_ADD_LIN_VEL, 0, "use_additive",xco+45+3*wval+15, yco-129, 35, 19, &oa->flag, 0.0, 0.0, 0, 0, "Toggles between ADD and SET linV");
 				}				
-			} else if (oa->type == ACT_OBJECT_SERVO)
+			}
+			else if (oa->type == ACT_OBJECT_SERVO)
 			{
 				ysize= 195;
 				
@@ -2030,12 +2029,10 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 					 &aa->end_reset, 0.0, 0.0, 0, 0, "Restore last frame when switching on/off, otherwise play from the start each time");
 			
 			
-			if(aa->type == ACT_ACTION_FROM_PROP)
-			{
+			if (aa->type == ACT_ACTION_FROM_PROP) {
 				uiDefBut(block, TEX, 0, "Prop: ",xco+10, yco-44, width-20, 19, aa->name, 0.0, MAX_NAME, 0, 0, "Use this property to define the Action position");
 			}
-			else
-			{
+			else {
 				uiDefButF(block, NUM, 0, "Sta: ",xco+10, yco-44, (width-20)/2, 19, &aa->sta, 1.0, MAXFRAMEF, 0, 0, "Start frame");
 				uiDefButF(block, NUM, 0, "End: ",xco+10+(width-20)/2, yco-44, (width-20)/2, 19, &aa->end, 1.0, MAXFRAMEF, 0, 0, "End frame");
 			}
@@ -2047,8 +2044,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 
 			
 #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
-			if(aa->type == ACT_ACTION_MOTION)
-			{
+			if (aa->type == ACT_ACTION_MOTION) {
 				uiDefButF(block, NUM, 0, "Cycle: ",xco+30, yco-84, (width-60)/2, 19, &aa->stridelength, 0.0, 2500.0, 0, 0, "Distance covered by a single cycle of the action");
 			}
 #endif
@@ -2091,7 +2087,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 					"Let the ipo acts in local coordinates, used in Force and Add mode"); 
 			}
 
-			if(ia->type==ACT_IPO_FROM_PROP) {
+			if (ia->type==ACT_IPO_FROM_PROP) {
 				uiDefBut(block, TEX, 0, 
 					"Prop: ",		xco+10, yco-44, width-80, 19, 
 					ia->name, 0.0, MAX_NAME, 0, 0,
@@ -2134,11 +2130,11 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 			uiDefBut(block, TEX, 1, "Prop: ",		xco+30,yco-44,width-60, 19, pa->name, 0, MAX_NAME, 0, 0, "Property name");
 			
 			
-			if(pa->type==ACT_PROP_TOGGLE) {
+			if (pa->type==ACT_PROP_TOGGLE) {
 				/* no ui */
 				ysize -= 22;
 			}
-			else if(pa->type==ACT_PROP_COPY) {
+			else if (pa->type==ACT_PROP_COPY) {
 				uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:",	xco+10, yco-64, (width-20)/2, 19, &(pa->ob), "Copy from this Object");
 				uiDefBut(block, TEX, 1, "Prop: ",		xco+10+(width-20)/2, yco-64, (width-20)/2, 19, pa->value, 0, MAX_NAME, 0, 0, "Copy this property");
 			}
@@ -2154,7 +2150,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 			sa = act->data;
 			sa->sndnr = 0;
 			
-			if(sa->flag & ACT_SND_3D_SOUND)
+			if (sa->flag & ACT_SND_3D_SOUND)
 				ysize = 180;
 			else
 				ysize = 92;
@@ -2163,7 +2159,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 			glRects(xco, yco-ysize, xco+width, yco);
 			uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
 			
-			if(bmain->sound.first) {
+			if (bmain->sound.first) {
 				IDnames_to_pupstring(&str, "Sound files", NULL, &(bmain->sound), (ID *)sa->sound, &(sa->sndnr));
 				/* reset this value, it is for handling the event */
 				sa->sndnr = 0;
@@ -2171,7 +2167,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 				uiDefButO(block, BUT, "sound.open", 0, "Load Sound", xco+wval+10, yco-22, wval, 19,
 				          "Load a sound file (remember to set caching on for small sounds that are played often)");
 
-				if(sa->sound) {
+				if (sa->sound) {
 					char dummy_str[] = "Sound mode %t|Play Stop %x0|Play End %x1|Loop Stop %x2|"
 					                   "Loop End %x3|Loop Ping Pong Stop %x5|Loop Ping Pong %x4";
 					uiDefBut(block, TEX, B_IDNAME, "SO:",xco+30,yco-22,wval-20,19,
@@ -2184,8 +2180,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 					          12.0, 0, 0, "Sets the pitch of this sound");
 					uiDefButS(block, TOG | BIT, 0, "3D Sound", xco+10, yco-88, width-20, 19,
 					          &sa->flag, 0.0, 1.0, 0.0, 0.0, "Plays the sound positioned in 3D space");
-					if(sa->flag & ACT_SND_3D_SOUND)
-					{
+					if (sa->flag & ACT_SND_3D_SOUND) {
 						uiDefButF(block, NUM, 0, "Minimum Gain: ", xco+10, yco-110, wval, 19,
 						          &sa->sound3D.min_gain, 0.0, 1.0, 0.0, 0.0,
 						          "The minimum gain of the sound, no matter how far it is away");
@@ -2237,7 +2232,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 		
 		uiDefButF(block, NUM, 0, "Min:",	xco+10, yco-44, (width-60)/2, 19, &ca->min, 0.0, 20.0, 0, 0, "");
 		
-		if(ca->axis==0) ca->axis= 'x';
+		if (ca->axis==0) ca->axis= 'x';
 		uiDefButS(block, ROW, 0, "X",	xco+10+(width-60)/2, yco-44, 20, 19, &ca->axis, 4.0, (float)'x', 0, 0, "Camera tries to get behind the X axis");
 		uiDefButS(block, ROW, 0, "Y",	xco+30+(width-60)/2, yco-44, 20, 19, &ca->axis, 4.0, (float)'y', 0, 0, "Camera tries to get behind the Y axis");
 		
@@ -2251,7 +2246,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 		
 		eoa= act->data;
 
-		if(eoa->type==ACT_EDOB_ADD_OBJECT) {
+		if (eoa->type==ACT_EDOB_ADD_OBJECT) {
 			ysize = 92;
 			glRects(xco, yco-ysize, xco+width, yco);
 			uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
@@ -2295,12 +2290,12 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 					 
 
 		}
-		else if(eoa->type==ACT_EDOB_END_OBJECT) {
+		else if (eoa->type==ACT_EDOB_END_OBJECT) {
 			ysize= 28;
 			glRects(xco, yco-ysize, xco+width, yco);
 			uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
 		}
-		else if(eoa->type==ACT_EDOB_REPLACE_MESH) {
+		else if (eoa->type==ACT_EDOB_REPLACE_MESH) {
 			ysize= 48;
 			glRects(xco, yco-ysize, xco+width, yco);
 			uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
@@ -2310,7 +2305,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 			uiDefButBitS(block, TOGN, ACT_EDOB_REPLACE_MESH_NOGFX, 0, "Gfx",	xco+40 + (width-80)/2, yco-44, (width-80)/4, 19, &eoa->flag, 0, 0, 0, 0, "Replace the display mesh");
 			uiDefButBitS(block, TOG, ACT_EDOB_REPLACE_MESH_PHYS, 0, "Phys",	xco+40 + (width-80)/2 +(width-80)/4, yco-44, (width-80)/4, 19, &eoa->flag, 0, 0, 0, 0, "Replace the physics mesh (triangle bounds only. compound shapes not supported)");
 		}
-		else if(eoa->type==ACT_EDOB_TRACK_TO) {
+		else if (eoa->type==ACT_EDOB_TRACK_TO) {
 			ysize= 48;
 			glRects(xco, yco-ysize, xco+width, yco);
 			uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
@@ -2319,14 +2314,14 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 			uiDefButI(block, NUM, 0, "Time:",	xco+10+(width-20)/2, yco-44, (width-20)/2-40, 19, &eoa->time, 0.0, 2000.0, 0, 0, "Duration the tracking takes");
 			uiDefButS(block, TOG, 0, "3D",	xco+width-50, yco-44, 40, 19, &eoa->flag, 0.0, 0.0, 0, 0, "Enable 3D tracking");
 		}
-		else if(eoa->type==ACT_EDOB_DYNAMICS) {
+		else if (eoa->type==ACT_EDOB_DYNAMICS) {
 			ysize= 69;
 			glRects(xco, yco-ysize, xco+width, yco);
 			uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
 			
 			str= "Dynamic Operation %t|Restore Dynamics %x0|Suspend Dynamics %x1|Enable Rigid Body %x2|Disable Rigid Body %x3|Set Mass %x4";
 			uiDefButS(block, MENU, B_REDR, str,		xco+40, yco-44, (width-80), 19,  &(eoa->dyn_operation), 0.0, 0.0, 0, 0, "");
-			if(eoa->dyn_operation==4) {
+			if (eoa->dyn_operation==4) {
 				uiDefButF(block, NUM, 0, "",		xco+40, yco-63, width-80, 19,
 					 &eoa->mass, 0.0, 10000.0, 10, 0,
 					 "Mass for object");
@@ -2359,16 +2354,17 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 			uiDefBut(block, LABEL,			0, "Min",	xco+80, yco-45, (width-90)/2, 19, NULL, 0.0, 0.0, 0, 0, "");
 			uiDefBut(block, LABEL,			0, "Max",	xco+80+(width-90)/2, yco-45, (width-90)/2, 19, NULL, 0.0, 0.0, 0, 0, "");
 
-			if(coa->flag & ACT_CONST_LOCX) fp= coa->minloc;
-			else if(coa->flag & ACT_CONST_LOCY) fp= coa->minloc+1;
-			else if(coa->flag & ACT_CONST_LOCZ) fp= coa->minloc+2;
-			else if(coa->flag & ACT_CONST_ROTX) fp= coa->minrot;
-			else if(coa->flag & ACT_CONST_ROTY) fp= coa->minrot+1;
+			if (coa->flag & ACT_CONST_LOCX) fp= coa->minloc;
+			else if (coa->flag & ACT_CONST_LOCY) fp= coa->minloc+1;
+			else if (coa->flag & ACT_CONST_LOCZ) fp= coa->minloc+2;
+			else if (coa->flag & ACT_CONST_ROTX) fp= coa->minrot;
+			else if (coa->flag & ACT_CONST_ROTY) fp= coa->minrot+1;
 			else fp= coa->minrot+2;
 			
 			uiDefButF(block, NUM, 0, "",		xco+80, yco-65, (width-90)/2, 19, fp, -2000.0, 2000.0, 10, 0, "");
 			uiDefButF(block, NUM, 0, "",		xco+80+(width-90)/2, yco-65, (width-90)/2, 19, fp+3, -2000.0, 2000.0, 10, 0, "");
-		} else if (coa->type == ACT_CONST_TYPE_DIST) {
+		}
+		else if (coa->type == ACT_CONST_TYPE_DIST) {
 			ysize= 106;
 
 			glRects(xco, yco-ysize, xco+width, yco);
@@ -2383,8 +2379,8 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 			uiDefButBitS(block, TOG, ACT_CONST_LOCAL, 0, "L", xco+80+(width-115), yco-45, 25, 19,
 					 &coa->flag, 0.0, 0.0, 0, 0, "Set ray along object's axis or global axis");
 
-			if(coa->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= coa->minloc;
-			else if(coa->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= coa->minloc+1;
+			if (coa->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= coa->minloc;
+			else if (coa->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= coa->minloc+1;
 			else fp= coa->minloc+2;
 
 			uiDefButF(block, NUM, 0, "",		xco+80, yco-65, (width-115)/2, 19, fp+3, 0.0, 2000.0, 10, 0, "Maximum length of ray");
@@ -2394,14 +2390,12 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 					 &coa->flag, 0.0, 0.0, 0, 0, "Set object axis along (local axis) or parallel (global axis) to the normal at hit position");
 			uiDefButBitS(block, TOG, ACT_CONST_MATERIAL, B_REDR, "M/P", xco+10, yco-84, 40, 19,
 					 &coa->flag, 0.0, 0.0, 0, 0, "Detect material instead of property");
-			if (coa->flag & ACT_CONST_MATERIAL)
-			{
+			if (coa->flag & ACT_CONST_MATERIAL) {
 				uiDefBut(block, TEX, 1, "Material:", xco + 50, yco-84, (width-60), 19,
 					coa->matprop, 0, MAX_NAME, 0, 0,
 					"Ray detects only Objects with this material");
 			}
-			else
-			{
+			else {
 				uiDefBut(block, TEX, 1, "Property:", xco + 50, yco-84, (width-60), 19,
 					coa->matprop, 0, MAX_NAME, 0, 0,
 					"Ray detect only Objects with this property");
@@ -2410,7 +2404,8 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 				&coa->flag, 0.0, 0.0, 0, 0, "Persistent actuator: stays active even if ray does not reach target");
 			uiDefButS(block, NUM, 0, "time", xco+50, yco-103, (width-60)/2, 19, &(coa->time), 0.0, 1000.0, 0, 0, "Maximum activation time in frame, 0 for unlimited");
 			uiDefButS(block, NUM, 0, "rotDamp", xco+50+(width-60)/2, yco-103, (width-60)/2, 19, &(coa->rotdamp), 0.0, 100.0, 0, 0, "Use a different damping for orientation");
-		} else if (coa->type == ACT_CONST_TYPE_ORI) {
+		}
+		else if (coa->type == ACT_CONST_TYPE_ORI) {
 			ysize= 87;
 
 			glRects(xco, yco-ysize, xco+width, yco);
@@ -2431,7 +2426,8 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 			uiDefButS(block, NUM, 0, "time", xco+10, yco-84, 70, 19, &(coa->time), 0.0, 1000.0, 0, 0, "Maximum activation time in frame, 0 for unlimited");
 			uiDefButF(block, NUM, 0, "min", xco+80, yco-84, (width-115)/2, 19, &(coa->minloc[0]), 0.0, 180.0, 10, 1, "Minimum angle (in degree) to maintain with target direction. No correction is done if angle with target direction is between min and max");
 			uiDefButF(block, NUM, 0, "max", xco+80+(width-115)/2, yco-84, (width-115)/2, 19, &(coa->maxloc[0]), 0.0, 180.0, 10, 1, "Maximum angle (in degree) allowed with target direction. No correction is done if angle with target direction is between min and max");
-		} else if (coa->type == ACT_CONST_TYPE_FH) {
+		}
+		else if (coa->type == ACT_CONST_TYPE_FH) {
 			ysize= 106;
 
 			glRects(xco, yco-ysize, xco+width, yco);
@@ -2440,8 +2436,8 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 			str= "Direction %t|None %x0|X axis %x1|Y axis %x2|Z axis %x4|-X axis %x8|-Y axis %x16|-Z axis %x32";
 			uiDefButS(block, MENU, B_REDR, str,		xco+10, yco-65, 70, 19, &coa->mode, 0.0, 0.0, 0, 0, "Set the direction of the ray (in world coordinate)");
 
-			if(coa->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= coa->minloc;
-			else if(coa->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= coa->minloc+1;
+			if (coa->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= coa->minloc;
+			else if (coa->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= coa->minloc+1;
 			else fp= coa->minloc+2;
 
 			uiDefButF(block, NUM,		0, "damp",	xco+10, yco-45, (width-70)/2, 19, &coa->maxrot[0], 0.0, 1.0, 1, 0, "Damping factor of the Fh spring force");
@@ -2453,14 +2449,12 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 					 &coa->flag, 0.0, 0.0, 0, 0, "Add a horizontal spring force on slopes");
 			uiDefButBitS(block, TOG, ACT_CONST_MATERIAL, B_REDR, "M/P", xco+10, yco-84, 40, 19,
 					 &coa->flag, 0.0, 0.0, 0, 0, "Detect material instead of property");
-			if (coa->flag & ACT_CONST_MATERIAL)
-			{
+			if (coa->flag & ACT_CONST_MATERIAL) {
 				uiDefBut(block, TEX, 1, "Material:", xco + 50, yco-84, (width-60), 19,
 					coa->matprop, 0, MAX_NAME, 0, 0,
 					"Ray detects only Objects with this material");
 			}
-			else
-			{
+			else {
 				uiDefBut(block, TEX, 1, "Property:", xco + 50, yco-84, (width-60), 19,
 					coa->matprop, 0, MAX_NAME, 0, 0,
 					"Ray detect only Objects with this property");
@@ -2478,12 +2472,12 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 	case ACT_SCENE:
 		sca= act->data;
 		
-		if(sca->type==ACT_SCENE_RESTART) {
+		if (sca->type==ACT_SCENE_RESTART) {
 			ysize= 28;
 			glRects(xco, yco-ysize, xco+width, yco);
 			uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
 		}
-		else if(sca->type==ACT_SCENE_CAMERA) {
+		else if (sca->type==ACT_SCENE_CAMERA) {
 
 			ysize= 48;
 			glRects(xco, yco-ysize, xco+width, yco);
@@ -2491,7 +2485,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 
 			uiDefIDPoinBut(block, test_obpoin_but, ID_OB, 1, "OB:",		xco+40, yco-44, (width-80), 19, &(sca->camera), "Set this Camera. Leave empty to refer to self object");
 		}
-		else if(sca->type==ACT_SCENE_SET) {
+		else if (sca->type==ACT_SCENE_SET) {
 			
 			ysize= 48;
 			glRects(xco, yco-ysize, xco+width, yco);
@@ -2499,7 +2493,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 
 			uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:",		xco+40, yco-44, (width-80), 19, &(sca->scene), "Set this Scene");
 		}
-		else if(sca->type==ACT_SCENE_ADD_FRONT) { 
+		else if (sca->type==ACT_SCENE_ADD_FRONT) {
 			
 			ysize= 48;
 			glRects(xco, yco-ysize, xco+width, yco);
@@ -2507,7 +2501,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 
 			uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:",		xco+40, yco-44, (width-80), 19, &(sca->scene), "Add an Overlay Scene");
 		}
-		else if(sca->type==ACT_SCENE_ADD_BACK) { 
+		else if (sca->type==ACT_SCENE_ADD_BACK) {
 			
 			ysize= 48;
 			glRects(xco, yco-ysize, xco+width, yco);
@@ -2515,7 +2509,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 
 			uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:",		xco+40, yco-44, (width-80), 19, &(sca->scene), "Add a Background Scene");
 		}
-		else if(sca->type==ACT_SCENE_REMOVE) { 
+		else if (sca->type==ACT_SCENE_REMOVE) {
 			
 			ysize= 48;
 			glRects(xco, yco-ysize, xco+width, yco);
@@ -2523,7 +2517,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 
 			uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:",		xco+40, yco-44, (width-80), 19, &(sca->scene), "Remove a Scene");
 		}
-		else if(sca->type==ACT_SCENE_SUSPEND) { 
+		else if (sca->type==ACT_SCENE_SUSPEND) {
 			
 			ysize= 48;
 			glRects(xco, yco-ysize, xco+width, yco);
@@ -2531,7 +2525,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 
 			uiDefIDPoinBut(block, test_scenepoin_but, ID_SCE, 1, "SCE:",		xco+40, yco-44, (width-80), 19, &(sca->scene), "Pause a Scene");
 		}
-		else if(sca->type==ACT_SCENE_RESUME) { 
+		else if (sca->type==ACT_SCENE_RESUME) {
 			
 			ysize= 48;
 			glRects(xco, yco-ysize, xco+width, yco);
@@ -2547,9 +2541,8 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 		  break; 
 	case ACT_GAME:
 		{
-			gma = act->data; 
-			if (gma->type == ACT_GAME_LOAD)
-			{
+			gma = act->data;
+			if (gma->type == ACT_GAME_LOAD) {
 				//ysize = 68;
 				ysize = 48;
 				glRects(xco, yco-ysize, xco+width, yco); 
@@ -2557,8 +2550,8 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 				   uiDefBut(block, TEX, 1, "File: ", xco+10, yco-44,width-20,19, &(gma->filename), 0, sizeof(gma->filename), 0, 0, "Load this blend file, use the \"//\" prefix for a path relative to the current blend file");
 //				uiDefBut(block, TEX, 1, "Anim: ", xco+10, yco-64,width-20,19, &(gma->loadaniname), 0, sizeof(gma->loadaniname), 0, 0, "Use this loadinganimation");
 			}
-/*			else if (gma->type == ACT_GAME_START)
-			{
+#if 0
+			else if (gma->type == ACT_GAME_START) {
 				ysize = 68; 
 				glRects(xco, yco-ysize, xco+width, yco); 
 				uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1);
@@ -2566,8 +2559,8 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 				   uiDefBut(block, TEX, 1, "File: ", xco+10, yco-44,width-20,19, &(gma->filename), 0, sizeof(gma->filename), 0, 0, "Load this file");
 				uiDefBut(block, TEX, 1, "Anim: ", xco+10, yco-64,width-20,19, &(gma->loadaniname), 0, sizeof(gma->loadaniname), 0, 0, "Use this loadinganimation");
 			}
-*/			else if (ELEM4(gma->type, ACT_GAME_RESTART, ACT_GAME_QUIT, ACT_GAME_SAVECFG, ACT_GAME_LOADCFG))
-			{
+#endif
+			else if (ELEM4(gma->type, ACT_GAME_RESTART, ACT_GAME_QUIT, ACT_GAME_SAVECFG, ACT_GAME_LOADCFG)) {
 				ysize = 28; 
 				glRects(xco, yco-ysize, xco+width, yco); 
 				uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1); 
@@ -2591,11 +2584,11 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 		str= "GroupKey types   %t|Set Key %x6|Play %x0|Ping Pong %x1|Flipper %x2|Loop Stop %x3|Loop End %x4|Property %x5";
 
 		uiDefButS(block, MENU, 1, str,			xco+20, yco-24, width-40, 19, &ga->type, 0, 0, 0, 0, "");
-		if(ga->type==ACT_GROUP_SET) {
+		if (ga->type==ACT_GROUP_SET) {
 			uiDefBut(block, TEX, 0, "Key: ",		xco+20, yco-44, (width-10)/2, 19, ga->name, 0.0, MAX_NAME, 0, 0, "This name defines groupkey to be set");
 			uiDefButI(block, NUM, 0, "Frame:",	xco+20+(width-10)/2, yco-44, (width-70)/2, 19, &ga->sta, 0.0, 2500.0, 0, 0, "Set this frame");
 		}
-		else if(ga->type==ACT_GROUP_FROM_PROP) {
+		else if (ga->type==ACT_GROUP_FROM_PROP) {
 			uiDefBut(block, TEX, 0, "Prop: ",		xco+20, yco-44, width-40, 19, ga->name, 0.0, MAX_NAME, 0, 0, "Use this property to define the Group position");
 		}
 		else {
@@ -2804,15 +2797,14 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 			&ma->bodyType, 0.0, 0.0, 0, 0,
 			"Toggle message type: either Text or a PropertyName");
 
-		if (ma->bodyType == ACT_MESG_MESG)
-		{
+		if (ma->bodyType == ACT_MESG_MESG) {
 			/* line 3: Message Body */
 			uiDefBut(block, TEX, 1, "Body: ",
 			(xco+10+(0.20*(width-20))),(yco-(myline++*24)),(0.8*(width-20)),19,
 			&ma->body, 0, MAX_NAME, 0, 0,
 			"Optional message body Text");
-		} else
-		{
+		}
+		else {
 			/* line 3: Property body (set by property) */
 			uiDefBut(block, TEX, 1, "Propname: ",
 			(xco+10+(0.20*(width-20))),(yco-(myline++*24)),(0.8*(width-20)),19,
@@ -2826,8 +2818,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 		tdfa = act->data;
 
 		ysize = 50;
-		if(tdfa->type == ACT_2DFILTER_CUSTOMFILTER)
-		{
+		if (tdfa->type == ACT_2DFILTER_CUSTOMFILTER) {
 			ysize +=20;
 		}
 		glRects( xco, yco-ysize, xco+width, yco ); 
@@ -2836,13 +2827,11 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 		switch(tdfa->type)
 		{
 			case ACT_2DFILTER_MOTIONBLUR:
-				if(!tdfa->flag)
-				{
+				if (!tdfa->flag) {
 					uiDefButS(block, TOG, B_REDR, "D",	xco+30,yco-44,19, 19, &tdfa->flag, 0.0, 0.0, 0.0, 0.0, "Disable Motion Blur");
 					uiDefButF(block, NUM, B_REDR, "Value:", xco+52,yco-44,width-82,19,&tdfa->float_arg,0.0,1.0,0.0,0.0,"Set motion blur value");
 				}
-				else
-				{
+				else {
 					uiDefButS(block, TOG, B_REDR, "Disabled",	xco+30,yco-44,width-60, 19, &tdfa->flag, 0.0, 0.0, 0.0, 0.0, "Enable Motion Blur");
 				}
 				break;
@@ -2877,7 +2866,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 	case ACT_PARENT:
 		parAct = act->data;
 
-		if(parAct->type==ACT_PARENT_SET) {
+		if (parAct->type==ACT_PARENT_SET) {
 			
 			ysize= 48;
 			glRects(xco, yco-ysize, xco+width, yco);
@@ -2896,7 +2885,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
 			"Make this object ghost while parented (only if not compound)");
 			uiBlockEndAlign(block);
 		}
-		else if(parAct->type==ACT_PARENT_REMOVE) {
+		else if (parAct->type==ACT_PARENT_REMOVE) {
 
 			ysize= 28;
 			glRects(xco, yco-ysize, xco+width, yco);
@@ -2975,23 +2964,23 @@ static void do_sensor_menu(bContext *C, void *UNUSED(arg), int event)
 	
 	idar= get_selected_and_linked_obs(C, &count, slogic->scaflag);
 	
-	for(a=0; a<count; a++) {
+	for (a=0; a<count; a++) {
 		ob= (Object *)idar[a];
-		if(event==0 || event==2) ob->scaflag |= OB_SHOWSENS;
-		else if(event==1) ob->scaflag &= ~OB_SHOWSENS;
+		if (event==0 || event==2) ob->scaflag |= OB_SHOWSENS;
+		else if (event==1) ob->scaflag &= ~OB_SHOWSENS;
 	}
 		
-	for(a=0; a<count; a++) {
+	for (a=0; a<count; a++) {
 		ob= (Object *)idar[a];
 		sens= ob->sensors.first;
-		while(sens) {
-			if(event==2) sens->flag |= SENS_SHOW;
-			else if(event==3) sens->flag &= ~SENS_SHOW;
+		while (sens) {
+			if (event==2) sens->flag |= SENS_SHOW;
+			else if (event==3) sens->flag &= ~SENS_SHOW;
 			sens= sens->next;
 		}
 	}
 
-	if(idar) MEM_freeN(idar);
+	if (idar) MEM_freeN(idar);
 }
 
 static uiBlock *sensor_menu(bContext *C, ARegion *ar, void *UNUSED(arg))
@@ -3024,23 +3013,23 @@ static void do_controller_menu(bContext *C, void *UNUSED(arg), int event)
 	
 	idar= get_selected_and_linked_obs(C, &count, slogic->scaflag);
 	
-	for(a=0; a<count; a++) {
+	for (a=0; a<count; a++) {
 		ob= (Object *)idar[a];
-		if(event==0 || event==2) ob->scaflag |= OB_SHOWCONT;
-		else if(event==1) ob->scaflag &= ~OB_SHOWCONT;
+		if (event==0 || event==2) ob->scaflag |= OB_SHOWCONT;
+		else if (event==1) ob->scaflag &= ~OB_SHOWCONT;
 	}
 
-	for(a=0; a<count; a++) {
+	for (a=0; a<count; a++) {
 		ob= (Object *)idar[a];
 		cont= ob->controllers.first;
-		while(cont) {
-			if(event==2) cont->flag |= CONT_SHOW;
-			else if(event==3) cont->flag &= ~CONT_SHOW;
+		while (cont) {
+			if (event==2) cont->flag |= CONT_SHOW;
+			else if (event==3) cont->flag &= ~CONT_SHOW;
 			cont= cont->next;
 		}
 	}
 
-	if(idar) MEM_freeN(idar);
+	if (idar) MEM_freeN(idar);
 }
 
 static uiBlock *controller_menu(bContext *C, ARegion *ar, void *UNUSED(arg))
@@ -3073,23 +3062,23 @@ static void do_actuator_menu(bContext *C, void *UNUSED(arg), int event)
 	
 	idar= get_selected_and_linked_obs(C, &count, slogic->scaflag);
 	
-	for(a=0; a<count; a++) {
+	for (a=0; a<count; a++) {
 		ob= (Object *)idar[a];
-		if(event==0 || event==2) ob->scaflag |= OB_SHOWACT;
-		else if(event==1) ob->scaflag &= ~OB_SHOWACT;
+		if (event==0 || event==2) ob->scaflag |= OB_SHOWACT;
+		else if (event==1) ob->scaflag &= ~OB_SHOWACT;
 	}
 
-	for(a=0; a<count; a++) {
+	for (a=0; a<count; a++) {
 		ob= (Object *)idar[a];
 		act= ob->actuators.first;
-		while(act) {
-			if(event==2) act->flag |= ACT_SHOW;
-			else if(event==3) act->flag &= ~ACT_SHOW;
+		while (act) {
+			if (event==2) act->flag |= ACT_SHOW;
+			else if (event==3) act->flag &= ~ACT_SHOW;
 			act= act->next;
 		}
 	}
 
-	if(idar) MEM_freeN(idar);
+	if (idar) MEM_freeN(idar);
 }
 
 static uiBlock *actuator_menu(bContext *C, ARegion *ar, void *UNUSED(arg))
@@ -3229,20 +3218,21 @@ static void draw_sensor_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *lo
 	row= uiLayoutRow(box, 0);
 	
 	uiItemR(row, ptr, "show_expanded", UI_ITEM_R_NO_BG, "", ICON_NONE);
-	if(RNA_boolean_get(ptr, "show_expanded")) {
+	if (RNA_boolean_get(ptr, "show_expanded")) {
 		uiItemR(row, ptr, "type", 0, "", ICON_NONE);
 		uiItemR(row, ptr, "name", 0, "", ICON_NONE);
-	} else {
+	}
+	else {
 		uiItemL(row, sensor_name(sens->type), ICON_NONE);
 		uiItemL(row, sens->name, ICON_NONE);
 	}
 
 	sub= uiLayoutRow(row, 0);
-	uiLayoutSetActive(sub, ((RNA_boolean_get(logic_ptr, "show_sensors_active_states")
-							&& RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin")));
+	uiLayoutSetActive(sub, ((RNA_boolean_get(logic_ptr, "show_sensors_active_states") &&
+	                         RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin")));
 	uiItemR(sub, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE);
 
-	if(RNA_boolean_get(ptr, "show_expanded")==0) {
+	if (RNA_boolean_get(ptr, "show_expanded")==0) {
 		sub= uiLayoutRow(row, 1);
 		uiItemEnumO(sub, "LOGIC_OT_sensor_move", "", ICON_TRIA_UP, "direction", 1); // up
 		uiItemEnumO(sub, "LOGIC_OT_sensor_move", "", ICON_TRIA_DOWN, "direction", 2); // down
@@ -3263,8 +3253,8 @@ static void draw_sensor_internal_header(uiLayout *layout, PointerRNA *ptr)
 	uiItemR(row, ptr, "use_pulse_false_level", 0, "", ICON_DOTSDOWN);
 
 	sub=uiLayoutRow(row, 0);
-	uiLayoutSetActive(sub, (RNA_boolean_get(ptr, "use_pulse_true_level")
-							|| RNA_boolean_get(ptr, "use_pulse_false_level")));
+	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);
 	
 	row= uiLayoutRow(split, 1);
@@ -3293,7 +3283,7 @@ static void draw_sensor_armature(uiLayout *layout, PointerRNA *ptr)
 	PropertyRNA *bones_prop= NULL;
 	uiLayout *row;
 
-	if(ob->type != OB_ARMATURE){
+	if (ob->type != OB_ARMATURE) {
 		uiItemL(layout, "Sensor only available for armatures", ICON_NONE);
 		return;
 	}
@@ -3586,12 +3576,13 @@ static void draw_controller_header(uiLayout *layout, PointerRNA *ptr, int xco, i
 	row= uiLayoutRow(box, 0);
 	
 	uiItemR(row, ptr, "show_expanded", UI_ITEM_R_NO_BG, "", ICON_NONE);
-	if(RNA_boolean_get(ptr, "show_expanded")) {
+	if (RNA_boolean_get(ptr, "show_expanded")) {
 		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)");
-	} else {
+	}
+	else {
 		uiItemL(row, controller_name(cont->type), ICON_NONE);
 		uiItemL(row, cont->name, ICON_NONE);
 		uiItemL(row, state, ICON_NONE);
@@ -3599,7 +3590,7 @@ static void draw_controller_header(uiLayout *layout, PointerRNA *ptr, int xco, i
 
 	uiItemR(row, ptr, "use_priority", 0, "", ICON_NONE);
 
-	if(RNA_boolean_get(ptr, "show_expanded")==0) {
+	if (RNA_boolean_get(ptr, "show_expanded")==0) {
 		sub= uiLayoutRow(row, 1);
 		uiItemEnumO(sub, "LOGIC_OT_controller_move", "", ICON_TRIA_UP, "direction", 1); // up
 		uiItemEnumO(sub, "LOGIC_OT_controller_move", "", ICON_TRIA_DOWN, "direction", 2); // down
@@ -3676,20 +3667,21 @@ static void draw_actuator_header(uiLayout *layout, PointerRNA *ptr, PointerRNA *
 	row= uiLayoutRow(box, 0);
 	
 	uiItemR(row, ptr, "show_expanded", UI_ITEM_R_NO_BG, "", ICON_NONE);
-	if(RNA_boolean_get(ptr, "show_expanded")) {
+	if (RNA_boolean_get(ptr, "show_expanded")) {
 		uiItemR(row, ptr, "type", 0, "", ICON_NONE);
 		uiItemR(row, ptr, "name", 0, "", ICON_NONE);
-	} else {
+	}
+	else {
 		uiItemL(row, actuator_name(act->type), ICON_NONE);
 		uiItemL(row, act->name, ICON_NONE);
 	}
 
 	sub= uiLayoutRow(row, 0);
-	uiLayoutSetActive(sub, ((RNA_boolean_get(logic_ptr, "show_actuators_active_states")
-							&& RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin")));
+	uiLayoutSetActive(sub, ((RNA_boolean_get(logic_ptr, "show_actuators_active_states") &&
+	                         RNA_boolean_get(ptr, "show_expanded")) || RNA_boolean_get(ptr, "pin")));
 	uiItemR(sub, ptr, "pin", UI_ITEM_R_NO_BG, "", ICON_NONE);
 
-	if(RNA_boolean_get(ptr, "show_expanded")==0) {
+	if (RNA_boolean_get(ptr, "show_expanded")==0) {
 		sub= uiLayoutRow(row, 1);
 		uiItemEnumO(sub, "LOGIC_OT_actuator_move", "", ICON_TRIA_UP, "direction", 1); // up
 		uiItemEnumO(sub, "LOGIC_OT_actuator_move", "", ICON_TRIA_DOWN, "direction", 2); // down
@@ -3721,7 +3713,7 @@ static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr)
 	uiItemR(row, ptr, "use_continue_last_frame", 0, NULL, ICON_NONE);
 
 	row= uiLayoutRow(layout, 0);
-	if((RNA_enum_get(ptr, "play_mode") == ACT_ACTION_FROM_PROP))
+	if ((RNA_enum_get(ptr, "play_mode") == ACT_ACTION_FROM_PROP))
 		uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, ICON_NONE);
 
 	else {
@@ -3755,7 +3747,7 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr)
 	PointerRNA pose_ptr, pchan_ptr;
 	PropertyRNA *bones_prop = NULL;
 
-	if(ob->type != OB_ARMATURE){
+	if (ob->type != OB_ARMATURE) {
 		uiItemL(layout, "Actuator only available for armatures", ICON_NONE);
 		return;
 	}
@@ -3806,6 +3798,16 @@ static void draw_actuator_armature(uiLayout *layout, PointerRNA *ptr)
 
 			uiItemR(layout, ptr, "weight", 0, NULL, ICON_NONE);
 			break;
+		case ACT_ARM_SETINFLUENCE:
+			if (ob->pose) {
+				uiItemPointerR(layout, ptr, "bone", &pose_ptr, "bones", NULL, ICON_BONE_DATA);
+				
+				if (RNA_property_collection_lookup_string(&pose_ptr, bones_prop, aa->posechannel, &pchan_ptr))
+					uiItemPointerR(layout, ptr, "constraint", &pchan_ptr, "constraints", NULL, ICON_CONSTRAINT_BONE);
+			}
+
+			uiItemR(layout, ptr, "influence", 0, NULL, ICON_NONE);
+			break;
 	}
 }
 
@@ -3952,7 +3954,7 @@ static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr)
 		case ACT_EDOB_END_OBJECT:
 			break;
 		case ACT_EDOB_REPLACE_MESH:
-			if(ob->type != OB_MESH) {
+			if (ob->type != OB_MESH) {
 				uiItemL(layout, "Mode only available for mesh objects", ICON_NONE);
 				break;
 			}
@@ -3970,7 +3972,7 @@ static void draw_actuator_edit_object(uiLayout *layout, PointerRNA *ptr)
 			uiItemR(sub, ptr, "use_3d_tracking", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
 			break;
 		case ACT_EDOB_DYNAMICS:
-			if(ob->type != OB_MESH) {
+			if (ob->type != OB_MESH) {
 				uiItemL(layout, "Mode only available for mesh objects", ICON_NONE);
 				break;
 			}
@@ -4029,7 +4031,7 @@ static void draw_actuator_message(uiLayout *layout, PointerRNA *ptr, bContext *C
 	row= uiLayoutRow(layout, 1);
 	uiItemR(row, ptr, "body_type", 0, NULL, ICON_NONE);
 
-	if(RNA_enum_get(ptr, "body_type") == ACT_MESG_MESG)
+	if (RNA_enum_get(ptr, "body_type") == ACT_MESG_MESG)
 		uiItemR(row, ptr, "body_message", 0, "", ICON_NONE);
 	else // mode == ACT_MESG_PROP
 		uiItemPointerR(row, ptr, "body_property", &settings_ptr, "properties", "", ICON_NONE);
@@ -4174,11 +4176,11 @@ static void draw_actuator_property(uiLayout *layout, PointerRNA *ptr)
 		case ACT_PROP_COPY:
 			row = uiLayoutRow(layout, 0);
 			uiItemR(row, ptr, "object", 0, NULL, ICON_NONE);
-			if(ob_from){
+			if (ob_from) {
 				RNA_pointer_create((ID *)ob_from, &RNA_GameObjectSettings, ob_from, &obj_settings_ptr);
 				uiItemPointerR(row, ptr, "object_property", &obj_settings_ptr, "properties", NULL, ICON_NONE);
-			}else
-			{
+			}
+			else {
 				sub= uiLayoutRow(row, 0);
 				uiLayoutSetActive(sub, 0);
 				uiItemR(sub, ptr, "object_property", 0, NULL, ICON_NONE);
@@ -4206,7 +4208,7 @@ static void draw_actuator_random(uiLayout *layout, PointerRNA *ptr)
 
 	row = uiLayoutRow(layout, 0);
 
-	switch (RNA_enum_get(ptr, "distribution")){
+	switch (RNA_enum_get(ptr, "distribution")) {
 		case ACT_RANDOM_BOOL_CONST:
 			uiItemR(row, ptr, "use_always_true", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
 			break;
@@ -4274,7 +4276,7 @@ static void draw_actuator_shape_action(uiLayout *layout, PointerRNA *ptr)
 	PointerRNA settings_ptr;
 	uiLayout *row;
 
-	if(ob->type != OB_MESH){
+	if (ob->type != OB_MESH) {
 		uiItemL(layout, "Actuator only available for mesh objects", ICON_NONE);
 		return;
 	}
@@ -4287,7 +4289,7 @@ static void draw_actuator_shape_action(uiLayout *layout, PointerRNA *ptr)
 	uiItemR(row, ptr, "use_continue_last_frame", 0, NULL, ICON_NONE);
 
 	row= uiLayoutRow(layout, 0);
-	if((RNA_enum_get(ptr, "mode") == ACT_ACTION_FROM_PROP))
+	if ((RNA_enum_get(ptr, "mode") == ACT_ACTION_FROM_PROP))
 		uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, ICON_NONE);
 
 	else {
@@ -4312,8 +4314,7 @@ static void draw_actuator_sound(uiLayout *layout, PointerRNA *ptr, bContext *C)
 	uiLayout *row, *col;
 
 	uiTemplateID(layout, C, ptr, "sound", NULL, "SOUND_OT_open", NULL);
-	if (!RNA_pointer_get(ptr, "sound").data)
-	{
+	if (!RNA_pointer_get(ptr, "sound").data) {
 		uiItemL(layout, "Select a sound from the list or load a new one", ICON_NONE);
 		return;
 	}
@@ -4389,21 +4390,18 @@ static void draw_actuator_steering(uiLayout *layout, PointerRNA *ptr)
 	uiItemR(col, ptr, "facing", 0, NULL, 0);
 	col = uiLayoutColumn(row, 0);
 	uiItemR(col, ptr, "facing_axis", 0, NULL, 0);
-	if (!RNA_boolean_get(ptr, "facing"))
-	{
+	if (!RNA_boolean_get(ptr, "facing")) {
 		uiLayoutSetActive(col, 0);
 	}
 	col = uiLayoutColumn(row, 0);
 	uiItemR(col, ptr, "normal_up", 0, NULL, 0);
-	if (!RNA_pointer_get(ptr, "navmesh").data)
-	{
+	if (!RNA_pointer_get(ptr, "navmesh").data) {
 		uiLayoutSetActive(col, 0);
 	}
 
 	row = uiLayoutRow(layout, 0);
 	uiItemR(row, ptr, "self_terminated", 0, NULL, 0);
-	if (RNA_enum_get(ptr, "mode")==ACT_STEERING_PATHFOLLOWING)
-	{
+	if (RNA_enum_get(ptr, "mode")==ACT_STEERING_PATHFOLLOWING) {
 		uiItemR(row, ptr, "update_period", 0, NULL, 0);	
 		row = uiLayoutRow(layout, 0);
 	}
@@ -4492,7 +4490,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
 	short a, count;
 	int xco, yco, width;
 	
-	if(ob==NULL) return;
+	if (ob==NULL) return;
 	
 	RNA_pointer_create(NULL, &RNA_SpaceLogicEditor, slogic, &logic_ptr);
 	idar= get_selected_and_linked_obs(C, &count, slogic->scaflag);
@@ -4502,7 +4500,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
 	uiBlockSetHandleFunc(block, do_logic_buts, NULL);
 	
 	/* loop over all objects and set visible/linked flags for the logic bricks */
-	for(a=0; a<count; a++) {
+	for (a=0; a<count; a++) {
 		bActuator *act;
 		bSensor *sens;
 		bController *cont;
@@ -4513,20 +4511,20 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
 		
 		/* clean ACT_LINKED and ACT_VISIBLE of all potentially visible actuators so that we can determine which is actually linked/visible */
 		act = ob->actuators.first;
-		while(act) {
+		while (act) {
 			act->flag &= ~(ACT_LINKED|ACT_VISIBLE);
 			act = act->next;
 		}
 		/* same for sensors */
 		sens= ob->sensors.first;
-		while(sens) {
+		while (sens) {
 			sens->flag &= ~(SENS_VISIBLE);
 			sens = sens->next;
 		}
 
 		/* mark the linked and visible actuators */
 		cont= ob->controllers.first;
-		while(cont) {
+		while (cont) {
 			flag = ACT_LINKED;
 
 			/* this controller is visible, mark all its actuator */
@@ -4554,7 +4552,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
 	uiItemR(row, &logic_ptr, "show_controllers_active_object", 0, "Act", ICON_NONE);
 	uiItemR(row, &logic_ptr, "show_controllers_linked_controller", 0, "Link", ICON_NONE);
 
-	for(a=0; a<count; a++) {
+	for (a=0; a<count; a++) {
 		bController *cont;
 		PointerRNA ptr;
 		uiLayout *split, *subsplit, *col;
@@ -4563,7 +4561,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
 		ob= (Object *)idar[a];
 
 		/* only draw the controller common header if "use_visible" */
-		if( (ob->scavisflag & OB_VIS_CONT) == 0) continue;
+		if ( (ob->scavisflag & OB_VIS_CONT) == 0) continue;
 	
 		/* Drawing the Controller Header common to all Selected Objects */
 
@@ -4606,7 +4604,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
 
 		uiItemS(layout);
 		
-		for(cont= ob->controllers.first; cont; cont=cont->next) {
+		for (cont= ob->controllers.first; cont; cont=cont->next) {
 			RNA_pointer_create((ID *)ob, &RNA_Controller, cont, &ptr);
 			
 			if (!(ob->scaflag & OB_ALLSTATE) && !(ob->state & cont->state_mask))
@@ -4638,7 +4636,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
 			/* put link button to the right */
 			col = uiLayoutColumn(subsplit, 0);
 			uiLayoutSetAlignment(col, UI_LAYOUT_ALIGN_LEFT);
-			but= uiDefIconBut(block, LINK, 0, ICON_LINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
+			but = uiDefIconBut(block, LINK, 0, ICON_LINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
 			uiSetButLink(but, NULL, (void ***)&(cont->links), &cont->totlinks, LINK_CONTROLLER, LINK_ACTUATOR);
 		}
 	}
@@ -4658,14 +4656,14 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
 	uiItemR(row, &logic_ptr, "show_sensors_linked_controller", 0, "Link", ICON_NONE);
 	uiItemR(row, &logic_ptr, "show_sensors_active_states", 0, "State", ICON_NONE);
 	
-	for(a=0; a<count; a++) {
+	for (a=0; a<count; a++) {
 		bSensor *sens;
 		PointerRNA ptr;
 		
 		ob= (Object *)idar[a];
 
 		/* only draw the sensor common header if "use_visible" */
-		if((ob->scavisflag & OB_VIS_SENS) == 0) continue;
+		if ((ob->scavisflag & OB_VIS_SENS) == 0) continue;
 
 		row = uiLayoutRow(layout, 1);
 		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");
@@ -4676,7 +4674,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
 		
 		uiItemS(layout);
 		
-		for(sens= ob->sensors.first; sens; sens=sens->next) {
+		for (sens= ob->sensors.first; sens; sens=sens->next) {
 			RNA_pointer_create((ID *)ob, &RNA_Sensor, sens, &ptr);
 			
 			if ((ob->scaflag & OB_ALLSTATE) ||
@@ -4703,8 +4701,8 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
 				
 				/* put link button to the right */
 				col = uiLayoutColumn(split, 0);
-				/* use oldskool uiButtons for links for now */
-				but= uiDefIconBut(block, LINK, 0, ICON_LINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
+				/* use old-school uiButtons for links for now */
+				but = uiDefIconBut(block, LINK, 0, ICON_LINK, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
 				uiSetButLink(but, NULL, (void ***)&(sens->links), &sens->totlinks, LINK_SENSOR, LINK_CONTROLLER);
 			}
 		}
@@ -4724,14 +4722,14 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
 	uiItemR(row, &logic_ptr, "show_actuators_linked_controller", 0, "Link", ICON_NONE);
 	uiItemR(row, &logic_ptr, "show_actuators_active_states", 0, "State", ICON_NONE);
 	
-	for(a=0; a<count; a++) {
+	for (a=0; a<count; a++) {
 		bActuator *act;
 		PointerRNA ptr;
 		
 		ob= (Object *)idar[a];
 
 		/* only draw the actuator common header if "use_visible" */
-		if( (ob->scavisflag & OB_VIS_ACT) == 0) continue;
+		if ( (ob->scavisflag & OB_VIS_ACT) == 0) continue;
 
 		row = uiLayoutRow(layout, 1);
 		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");
@@ -4742,7 +4740,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
 		
 		uiItemS(layout);
 		
-		for(act= ob->actuators.first; act; act=act->next) {
+		for (act= ob->actuators.first; act; act=act->next) {
 			
 			RNA_pointer_create((ID *)ob, &RNA_Actuator, act, &ptr);
 			
@@ -4784,7 +4782,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar)
 	uiEndBlock(C, block);
 	uiDrawBlock(C, block);
 	
-	if(idar) MEM_freeN(idar);
+	if (idar) MEM_freeN(idar);
 }
 
 void logic_buttons(bContext *C, ARegion *ar)
@@ -4812,7 +4810,7 @@ void logic_buttons(bContext *C, ARegion *ar)
 		return;
 	}
 	
-	if(ob==NULL) return;
+	if (ob==NULL) return;
 //	uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
 
 	BLI_snprintf(numstr, sizeof(numstr), "buttonswin %p", (void *)ar);
@@ -4824,17 +4822,17 @@ void logic_buttons(bContext *C, ARegion *ar)
 	idar= get_selected_and_linked_obs(C, &count, slogic->scaflag);
 
 	/* clean ACT_LINKED and ACT_VISIBLE of all potentially visible actuators so that 
-	   we can determine which is actually linked/visible */
-	for(a=0; a<count; a++) {
+	 * we can determine which is actually linked/visible */
+	for (a=0; a<count; a++) {
 		ob= (Object *)idar[a];
 		act= ob->actuators.first;
-		while(act) {
+		while (act) {
 			act->flag &= ~(ACT_LINKED|ACT_VISIBLE);
 			act = act->next;
 		}
 		/* same for sensors */
 		sens= ob->sensors.first;
-		while(sens) {
+		while (sens) {
 			sens->flag &= ~(SENS_VISIBLE);
 			sens = sens->next;
 		}
@@ -4852,28 +4850,28 @@ void logic_buttons(bContext *C, ARegion *ar)
 	uiDefButBitS(block, TOG, BUTS_CONT_LINK, B_REDR, "Link", xco+110+2*(width-100)/3, yco+35, (width-100)/3, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show linked Objects to Sensor/Actuator");
 	uiBlockEndAlign(block);
 	
-	for(a=0; a<count; a++) {
+	for (a=0; a<count; a++) {
 		unsigned int controller_state_mask = 0; /* store a bitmask for states that are used */
 		
 		ob= (Object *)idar[a];
 //		uiClearButLock();
 //		uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
-		if( (ob->scavisflag & OB_VIS_CONT) == 0) continue;
+		if ( (ob->scavisflag & OB_VIS_CONT) == 0) continue;
 
 		/* presume it is only objects for now */
 		uiBlockBeginAlign(block);
-//		if(ob->controllers.first) uiSetCurFont(block, UI_HELVB);
+//		if (ob->controllers.first) uiSetCurFont(block, UI_HELVB);
 		uiDefButBitS(block, TOG, OB_SHOWCONT, B_REDR, ob->id.name+2,(short)(xco-10), yco, (short)(width-30), UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Active Object name");
-//		if(ob->controllers.first) uiSetCurFont(block, UI_HELV);
+//		if (ob->controllers.first) uiSetCurFont(block, UI_HELV);
 		uiDefButBitS(block, TOG, OB_ADDCONT, B_ADD_CONT, "Add",(short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Controller");
 		uiBlockEndAlign(block);
 		yco-=20;
 		
 		/* mark all actuators linked to these controllers */
 		/* note that some of these actuators could be from objects that are not in the display list.
-		   It's ok because those actuators will not be displayed here */
+		 * It's ok because those actuators will not be displayed here */
 		cont= ob->controllers.first;
-		while(cont) {
+		while (cont) {
 			for (iact=0; iact<cont->totlinks; iact++) {
 				act = cont->links[iact];
 				if (act)
@@ -4883,7 +4881,7 @@ void logic_buttons(bContext *C, ARegion *ar)
 			cont = cont->next;
 		}
 
-		if(ob->scaflag & OB_SHOWCONT) {
+		if (ob->scaflag & OB_SHOWCONT) {
 
 			/* first show the state */
 			uiDefBlockBut(block, object_state_mask_menu, ob, "State", (short)(xco-10), (short)(yco-10), 36, UI_UNIT_Y, "Object state menu: store and retrieve initial state");
@@ -4920,7 +4918,7 @@ void logic_buttons(bContext *C, ARegion *ar)
 					yco -= 6;
 				}
 				cont= ob->controllers.first;
-				while(cont) {
+				while (cont) {
 					if (cont->state_mask & (1<<stbit)) {
 						/* this controller is visible, mark all its actuator */
 						for (iact=0; iact<cont->totlinks; iact++) {
@@ -4935,35 +4933,35 @@ void logic_buttons(bContext *C, ARegion *ar)
 						sprintf(numstr, "%d", first_bit(cont->state_mask)+1);
 						uiDefBlockBut(block, controller_state_mask_menu, cont, numstr, (short)(xco+width-44), yco, 22, UI_UNIT_Y, "Set controller state index (from 1 to 30)");
 				
-						if(cont->flag & CONT_SHOW) {
+						if (cont->flag & CONT_SHOW) {
 							cont->otype= cont->type;
 							uiDefButS(block, MENU, B_CHANGE_CONT, controller_pup(),(short)(xco+22), yco, 70, UI_UNIT_Y, &cont->type, 0, 0, 0, 0, "Controller type");
-							but= uiDefBut(block, TEX, 1, "", (short)(xco+92), yco, (short)(width-158), UI_UNIT_Y, cont->name, 0, MAX_NAME, 0, 0, "Controller name");
+							but = uiDefBut(block, TEX, 1, "", (short)(xco+92), yco, (short)(width-158), UI_UNIT_Y, cont->name, 0, MAX_NAME, 0, 0, "Controller name");
 							uiButSetFunc(but, make_unique_prop_names_cb, cont->name, (void*) 0);
 				
 							ycoo= yco;
 							yco= draw_controllerbuttons(cont, block, xco, yco, width);
-							if(yco-6 < ycoo) ycoo= (yco+ycoo-20)/2;
+							if (yco-6 < ycoo) ycoo= (yco+ycoo-20)/2;
 						}
 						else {
 							cpack(0x999999);
 							glRecti(xco+22, yco, xco+width-22,yco+19);
-							but= uiDefBut(block, LABEL, 0, controller_name(cont->type), (short)(xco+22), yco, 70, UI_UNIT_Y, cont, 0, 0, 0, 0, "Controller type");
+							but = uiDefBut(block, LABEL, 0, controller_name(cont->type), (short)(xco+22), yco, 70, UI_UNIT_Y, cont, 0, 0, 0, 0, "Controller type");
 							//uiButSetFunc(but, old_sca_move_controller, cont, NULL);
-							but= uiDefBut(block, LABEL, 0, cont->name,(short)(xco+92), yco,(short)(width-158), UI_UNIT_Y, cont, 0, 0, 0, 0, "Controller name");
+							but = uiDefBut(block, LABEL, 0, cont->name,(short)(xco+92), yco,(short)(width-158), UI_UNIT_Y, cont, 0, 0, 0, 0, "Controller name");
 							//uiButSetFunc(but, old_sca_move_controller, cont, NULL);
 
 							uiBlockBeginAlign(block);
-							but= uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_UP, (short)(xco+width-(110+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick up");
+							but = uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_UP, (short)(xco+width-(110+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick up");
 							uiButSetFunc(but, old_sca_move_controller, cont, (void *)TRUE);
-							but= uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_DOWN, (short)(xco+width-(88+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick down");
+							but = uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_DOWN, (short)(xco+width-(88+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick down");
 							uiButSetFunc(but, old_sca_move_controller, cont, (void *)FALSE);
 							uiBlockEndAlign(block);
 
 							ycoo= yco;
 						}
 				
-						but= uiDefIconBut(block, LINK, 0, ICON_LINK,	(short)(xco+width), ycoo, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
+						but = uiDefIconBut(block, LINK, 0, ICON_LINK,	(short)(xco+width), ycoo, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
 						uiSetButLink(but, NULL, (void ***)&(cont->links), &cont->totlinks, LINK_CONTROLLER, LINK_ACTUATOR);
 				
 						uiDefIconBut(block, INLINK, 0, ICON_INLINK,(short)(xco-19), ycoo, UI_UNIT_X, UI_UNIT_Y, cont, LINK_CONTROLLER, 0, 0, 0, "");
@@ -4991,33 +4989,33 @@ void logic_buttons(bContext *C, ARegion *ar)
 	uiDefButBitS(block, TOG, BUTS_SENS_STATE, B_REDR, "State", xco+80+3*(width-70)/4, yco+35, (width-70)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show only sensors connected to active states");
 	uiBlockEndAlign(block);
 	
-	for(a=0; a<count; a++) {
+	for (a=0; a<count; a++) {
 		ob= (Object *)idar[a];
 //		uiClearButLock();
 //		uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
 		
-		if( (ob->scavisflag & OB_VIS_SENS) == 0) continue;
+		if ( (ob->scavisflag & OB_VIS_SENS) == 0) continue;
 		
 		/* presume it is only objects for now */
 		uiBlockBeginAlign(block);
-//		if(ob->sensors.first) uiSetCurFont(block, UI_HELVB);
+//		if (ob->sensors.first) uiSetCurFont(block, UI_HELVB);
 		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");
-//		if(ob->sensors.first) uiSetCurFont(block, UI_HELV);
+//		if (ob->sensors.first) uiSetCurFont(block, UI_HELV);
 		uiDefButBitS(block, TOG, OB_ADDSENS, B_ADD_SENS, "Add",(short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Sensor");
 		uiBlockEndAlign(block);
 		yco-=20;
 		
-		if(ob->scaflag & OB_SHOWSENS) {
+		if (ob->scaflag & OB_SHOWSENS) {
 			
 			sens= ob->sensors.first;
-			while(sens) {
+			while (sens) {
 				if (!(slogic->scaflag & BUTS_SENS_STATE) ||
 					 (sens->totlinks == 0) ||		/* always display sensor without links so that is can be edited */
 					 (sens->flag & SENS_PIN && slogic->scaflag & BUTS_SENS_STATE) || /* states can hide some sensors, pinned sensors ignore the visible state */
 					 (is_sensor_linked(block, sens))
 				) {
 					/* should we draw the pin? - for now always draw when there is a state */
-					pin = (slogic->scaflag & BUTS_SENS_STATE && (sens->flag & SENS_SHOW || sens->flag & SENS_PIN)) ? 1:0 ;
+					pin = (slogic->scaflag & BUTS_SENS_STATE && (sens->flag & SENS_SHOW || sens->flag & SENS_PIN)) ? 1 : 0;
 					
 					sens->flag |= SENS_VISIBLE;
 					uiDefIconButBitS(block, TOG, SENS_DEL, B_DEL_SENS, ICON_X,	xco, yco, 22, UI_UNIT_Y, &sens->flag, 0, 0, 0, 0, "Delete Sensor");
@@ -5027,33 +5025,32 @@ void logic_buttons(bContext *C, ARegion *ar)
 					uiDefIconButBitS(block, ICONTOG, SENS_SHOW, B_REDR, ICON_RIGHTARROW, (short)(xco+width-22), yco, 22, UI_UNIT_Y, &sens->flag, 0, 0, 0, 0, "Sensor settings");
 
 					ycoo= yco;
-					if(sens->flag & SENS_SHOW)
-					{
+					if (sens->flag & SENS_SHOW) {
 						uiDefButS(block, MENU, B_CHANGE_SENS, sensor_pup(),	(short)(xco+22), yco, 80, UI_UNIT_Y, &sens->type, 0, 0, 0, 0, "Sensor type");
-						but= uiDefBut(block, TEX, 1, "", (short)(xco+102), yco, (short)(width-(pin?146:124)), UI_UNIT_Y, sens->name, 0, MAX_NAME, 0, 0, "Sensor name");
+						but = uiDefBut(block, TEX, 1, "", (short)(xco+102), yco, (short)(width-(pin?146:124)), UI_UNIT_Y, sens->name, 0, MAX_NAME, 0, 0, "Sensor name");
 						uiButSetFunc(but, make_unique_prop_names_cb, sens->name, (void*) 0);
 
 						sens->otype= sens->type;
 						yco= draw_sensorbuttons(ob, sens, block, xco, yco, width);
-						if(yco-6 < ycoo) ycoo= (yco+ycoo-20)/2;
+						if (yco-6 < ycoo) ycoo= (yco+ycoo-20)/2;
 					}
 					else {
 						set_col_sensor(sens->type, 1);
 						glRecti(xco+22, yco, xco+width-22,yco+19);
-						but= uiDefBut(block, LABEL, 0, sensor_name(sens->type),	(short)(xco+22), yco, 80, UI_UNIT_Y, sens, 0, 0, 0, 0, "");
+						but = uiDefBut(block, LABEL, 0, sensor_name(sens->type),	(short)(xco+22), yco, 80, UI_UNIT_Y, sens, 0, 0, 0, 0, "");
 						//uiButSetFunc(but, old_sca_move_sensor, sens, NULL);
-						but= uiDefBut(block, LABEL, 0, sens->name, (short)(xco+102), yco, (short)(width-(pin?146:124)), UI_UNIT_Y, sens, 0, MAX_NAME, 0, 0, "");
+						but = uiDefBut(block, LABEL, 0, sens->name, (short)(xco+102), yco, (short)(width-(pin?146:124)), UI_UNIT_Y, sens, 0, MAX_NAME, 0, 0, "");
 						//uiButSetFunc(but, old_sca_move_sensor, sens, NULL);
 
 						uiBlockBeginAlign(block);
-						but= uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_UP, (short)(xco+width-(66+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick up");
+						but = uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_UP, (short)(xco+width-(66+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick up");
 						uiButSetFunc(but, old_sca_move_sensor, sens, (void *)TRUE);
-						but= uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_DOWN, (short)(xco+width-(44+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick down");
+						but = uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_DOWN, (short)(xco+width-(44+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick down");
 						uiButSetFunc(but, old_sca_move_sensor, sens, (void *)FALSE);
 						uiBlockEndAlign(block);
 					}
 
-					but= uiDefIconBut(block, LINK, 0, ICON_LINK,	(short)(xco+width), ycoo, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
+					but = uiDefIconBut(block, LINK, 0, ICON_LINK,	(short)(xco+width), ycoo, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
 					uiSetButLink(but, NULL, (void ***)&(sens->links), &sens->totlinks, LINK_SENSOR, LINK_CONTROLLER);
 
 					yco-=20;
@@ -5073,31 +5070,31 @@ void logic_buttons(bContext *C, ARegion *ar)
 	uiDefButBitS(block, TOG, BUTS_ACT_LINK, B_REDR, "Link", xco+110+2*(width-100)/4, yco+35, (width-100)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show linked Objects to Controller");
 	uiDefButBitS(block, TOG, BUTS_ACT_STATE, B_REDR, "State", xco+110+3*(width-100)/4, yco+35, (width-100)/4, UI_UNIT_Y, &slogic->scaflag, 0, 0, 0, 0, "Show only actuators connected to active states");
 	uiBlockEndAlign(block);
-	for(a=0; a<count; a++) {
+	for (a=0; a<count; a++) {
 		ob= (Object *)idar[a];
 //		uiClearButLock();
 //		uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
-		if( (ob->scavisflag & OB_VIS_ACT) == 0) continue;
+		if ( (ob->scavisflag & OB_VIS_ACT) == 0) continue;
 
 		/* presume it is only objects for now */
 		uiBlockBeginAlign(block);
-//		if(ob->actuators.first) uiSetCurFont(block, UI_HELVB);
+//		if (ob->actuators.first) uiSetCurFont(block, UI_HELVB);
 		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");
-//		if(ob->actuators.first) uiSetCurFont(block, UI_HELV);
+//		if (ob->actuators.first) uiSetCurFont(block, UI_HELV);
 		uiDefButBitS(block, TOG, OB_ADDACT, B_ADD_ACT, "Add",(short)(xco+width-40), yco, 50, UI_UNIT_Y, &ob->scaflag, 0, 0, 0, 0, "Add a new Actuator");
 		uiBlockEndAlign(block);
 		yco-=20;
 		
-		if(ob->scaflag & OB_SHOWACT) {
+		if (ob->scaflag & OB_SHOWACT) {
 			
 			act= ob->actuators.first;
-			while(act) {
+			while (act) {
 				if (!(slogic->scaflag & BUTS_ACT_STATE) ||
 					!(act->flag & ACT_LINKED) ||		/* always display actuators without links so that is can be edited */
 					 (act->flag & ACT_VISIBLE) ||		/* this actuator has visible connection, display it */
 					 (act->flag & ACT_PIN && slogic->scaflag & BUTS_ACT_STATE)) {
 					
-					pin = (slogic->scaflag & BUTS_ACT_STATE && (act->flag & SENS_SHOW || act->flag & SENS_PIN)) ? 1:0 ;
+					pin = (slogic->scaflag & BUTS_ACT_STATE && (act->flag & SENS_SHOW || act->flag & SENS_PIN)) ? 1 : 0;
 					
 					act->flag |= ACT_VISIBLE;	/* mark the actuator as visible to help implementing the up/down action */
 					uiDefIconButBitS(block, TOG, ACT_DEL, B_DEL_ACT, ICON_X,	xco, yco, 22, UI_UNIT_Y, &act->flag, 0, 0, 0, 0, "Delete Actuator");
@@ -5105,15 +5102,15 @@ void logic_buttons(bContext *C, ARegion *ar)
 						uiDefIconButBitS(block, ICONTOG, ACT_PIN, B_REDR, ICON_PINNED, (short)(xco+width-44), yco, 22, UI_UNIT_Y, &act->flag, 0, 0, 0, 0, "Display when not linked to a visible states controller");
 					uiDefIconButBitS(block, ICONTOG, ACT_SHOW, B_REDR, ICON_RIGHTARROW, (short)(xco+width-22), yco, 22, UI_UNIT_Y, &act->flag, 0, 0, 0, 0, "Display the actuator");
 					
-					if(act->flag & ACT_SHOW) {
+					if (act->flag & ACT_SHOW) {
 						act->otype= act->type;
 						uiDefButS(block, MENU, B_CHANGE_ACT, actuator_pup(ob),	(short)(xco+22), yco, 90, UI_UNIT_Y, &act->type, 0, 0, 0, 0, "Actuator type");
-						but= uiDefBut(block, TEX, 1, "", (short)(xco+112), yco, (short)(width-(pin?156:134)), UI_UNIT_Y, act->name, 0, MAX_NAME, 0, 0, "Actuator name");
+						but = uiDefBut(block, TEX, 1, "", (short)(xco+112), yco, (short)(width-(pin?156:134)), UI_UNIT_Y, act->name, 0, MAX_NAME, 0, 0, "Actuator name");
 						uiButSetFunc(but, make_unique_prop_names_cb, act->name, (void*) 0);
 
 						ycoo= yco;
 						yco= draw_actuatorbuttons(bmain, ob, act, block, xco, yco, width);
-						if(yco-6 < ycoo) ycoo= (yco+ycoo-20)/2;
+						if (yco-6 < ycoo) ycoo= (yco+ycoo-20)/2;
 					}
 					else {
 						set_col_actuator(act->type, 1);
@@ -5124,9 +5121,9 @@ void logic_buttons(bContext *C, ARegion *ar)
 						// uiButSetFunc(but, old_sca_move_actuator, act, NULL);
 
 						uiBlockBeginAlign(block);
-						but= uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_UP, (short)(xco+width-(66+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick up");
+						but = uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_UP, (short)(xco+width-(66+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick up");
 						uiButSetFunc(but, old_sca_move_actuator, act, (void *)TRUE);
-						but= uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_DOWN, (short)(xco+width-(44+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick down");
+						but = uiDefIconBut(block, BUT, B_REDR, ICON_TRIA_DOWN, (short)(xco+width-(44+5)), yco, 22, UI_UNIT_Y, NULL, 0, 0, 0, 0, "Move this logic brick down");
 						uiButSetFunc(but, old_sca_move_actuator, act, (void *)FALSE);
 						uiBlockEndAlign(block);
 
@@ -5148,7 +5145,7 @@ void logic_buttons(bContext *C, ARegion *ar)
 	uiEndBlock(C, block);
 	uiDrawBlock(C, block);
 
-	if(idar) MEM_freeN(idar);
+	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 a9b1acb..82175f8 100644
--- a/source/blender/editors/space_logic/space_logic.c
+++ b/source/blender/editors/space_logic/space_logic.c
@@ -63,13 +63,13 @@ ARegion *logic_has_buttons_region(ScrArea *sa)
 	ARegion *ar, *arnew;
 
 	ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
-	if(ar) return ar;
+	if (ar) return ar;
 	
 	/* add subdiv level; after 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");
 	
@@ -119,15 +119,15 @@ static SpaceLink *logic_new(const bContext *UNUSED(C))
 	BLI_addtail(&slogic->regionbase, ar);
 	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.xmin =  0.0f;
+	ar->v2d.tot.ymin =  0.0f;
+	ar->v2d.tot.xmax = 1280;
+	ar->v2d.tot.ymax = 240.0f;
 	
-	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.xmin =  0.0f;
+	ar->v2d.cur.ymin =  0.0f;
+	ar->v2d.cur.xmax = 1280.0f;
+	ar->v2d.cur.ymax = 240.0f;
 	
 	ar->v2d.min[0]= 1.0f;
 	ar->v2d.min[1]= 1.0f;
@@ -151,7 +151,7 @@ static void logic_free(SpaceLink *UNUSED(sl))
 {	
 //	Spacelogic *slogic= (SpaceLogic*) sl;
 	
-//	if(slogic->gpd)
+//	if (slogic->gpd)
 // XXX		free_gpencil_data(slogic->gpd);
 	
 }
@@ -178,7 +178,7 @@ static void logic_operatortypes(void)
 
 static void logic_keymap(struct wmKeyConfig *keyconf)
 {
-	wmKeyMap *keymap= WM_keymap_find(keyconf, "Logic Editor", SPACE_LOGIC, 0);
+	wmKeyMap *keymap = WM_keymap_find(keyconf, "Logic Editor", SPACE_LOGIC, 0);
 	
 	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);
@@ -213,7 +213,7 @@ static void logic_listener(ARegion *ar, wmNotifier *wmn)
 		case NC_OBJECT:
 			break;
 		case NC_ID:
-			if(wmn->action == NA_RENAME)
+			if (wmn->action == NA_RENAME)
 				ED_region_tag_redraw(ar);
 			break;
 	}
@@ -236,7 +236,7 @@ static void logic_main_area_init(wmWindowManager *wm, ARegion *ar)
 	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);
+	keymap = WM_keymap_find(wm->defaultconf, "Logic Editor", SPACE_LOGIC, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
@@ -275,7 +275,7 @@ static void logic_buttons_area_init(wmWindowManager *wm, ARegion *ar)
 
 	ED_region_panels_init(wm, ar);
 	
-	keymap= WM_keymap_find(wm->defaultconf, "Logic Editor", SPACE_LOGIC, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Logic Editor", SPACE_LOGIC, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
@@ -337,8 +337,6 @@ void ED_spacetype_logic(void)
 	art->draw= logic_buttons_area_draw;
 	BLI_addhead(&st->regiontypes, art);
 
-	logic_buttons_register(art);
-
 	/* regions: header */
 	art= MEM_callocN(sizeof(ARegionType), "spacetype logic region");
 	art->regionid = RGN_TYPE_HEADER;
diff --git a/source/blender/editors/space_nla/CMakeLists.txt b/source/blender/editors/space_nla/CMakeLists.txt
index cae31f8..aa3598e 100644
--- a/source/blender/editors/space_nla/CMakeLists.txt
+++ b/source/blender/editors/space_nla/CMakeLists.txt
@@ -46,4 +46,8 @@ set(SRC
 	nla_intern.h
 )
 
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
 blender_add_lib(bf_editor_space_nla "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_nla/SConscript b/source/blender/editors/space_nla/SConscript
index 6738f33..ee010e6 100644
--- a/source/blender/editors/space_nla/SConscript
+++ b/source/blender/editors/space_nla/SConscript
@@ -6,4 +6,9 @@ sources = env.Glob('*.c')
 incs = '../include ../../blenfont ../../blenlib ../../blenkernel ../../makesdna ../../makesrna ../../imbuf'
 incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include ../../blenloader'
 
-env.BlenderLib ( 'bf_editors_space_nla', sources, Split(incs), [], libtype=['core'], priority=[85] )
+defs = []
+
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
+
+env.BlenderLib ( 'bf_editors_space_nla', sources, Split(incs), defs, libtype=['core'], priority=[85] )
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index 79d11c9..de42e4a 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -42,7 +42,6 @@
 
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
-#include "BLI_editVert.h"
 #include "BLI_rand.h"
 
 #include "BLF_translation.h"
@@ -519,7 +518,7 @@ static int nla_properties(bContext *C, wmOperator *UNUSED(op))
 	ScrArea *sa= CTX_wm_area(C);
 	ARegion *ar= nla_has_buttons_region(sa);
 	
-	if(ar)
+	if (ar)
 		ED_region_toggle_hidden(C, ar);
 
 	return OPERATOR_FINISHED;
@@ -527,13 +526,13 @@ static int nla_properties(bContext *C, wmOperator *UNUSED(op))
 
 void NLA_OT_properties(wmOperatorType *ot)
 {
-	ot->name= "Properties";
-	ot->idname= "NLA_OT_properties";
-	ot->description= "Toggle display properties panel";
+	ot->name = "Properties";
+	ot->idname = "NLA_OT_properties";
+	ot->description = "Toggle display properties panel";
 	
-	ot->exec= nla_properties;
-	ot->poll= ED_operator_nla_active;
+	ot->exec = nla_properties;
+	ot->poll = ED_operator_nla_active;
 
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 }
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index fb23533..1d323cb 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -92,8 +92,8 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
 	ale= BLI_findlink(&anim_data, channel_index);
 	if (ale == NULL) {
 		/* channel not found */
-		if (G.f & G_DEBUG)
-			printf("Error: animation channel (index = %d) not found in mouse_anim_channels() \n", channel_index);
+		if (G.debug & G_DEBUG)
+			printf("Error: animation channel (index = %d) not found in mouse_anim_channels()\n", channel_index);
 		
 		BLI_freelistN(&anim_data);
 		return 0;
@@ -284,8 +284,8 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
 			break;
 			
 		default:
-			if (G.f & G_DEBUG)
-				printf("Error: Invalid channel type in mouse_nla_channels() \n");
+			if (G.debug & G_DEBUG)
+				printf("Error: Invalid channel type in mouse_nla_channels()\n");
 	}
 	
 	/* free channels */
@@ -344,16 +344,16 @@ static int nlachannels_mouseclick_invoke(bContext *C, wmOperator *op, wmEvent *e
 void NLA_OT_channels_click (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Mouse Click on NLA Channels";
-	ot->idname= "NLA_OT_channels_click";
-	ot->description= "Handle clicks to select NLA channels";
+	ot->name = "Mouse Click on NLA Channels";
+	ot->idname = "NLA_OT_channels_click";
+	ot->description = "Handle clicks to select NLA channels";
 	
 	/* api callbacks */
-	ot->invoke= nlachannels_mouseclick_invoke;
-	ot->poll= ED_operator_nla_active;
+	ot->invoke = nlachannels_mouseclick_invoke;
+	ot->poll = ED_operator_nla_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* id-props */
 	RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", ""); // SHIFTKEY
@@ -418,16 +418,16 @@ static int nlaedit_add_tracks_exec (bContext *C, wmOperator *op)
 void NLA_OT_tracks_add (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Track(s)";
-	ot->idname= "NLA_OT_tracks_add";
-	ot->description= "Add NLA-Tracks above/after the selected tracks";
+	ot->name = "Add Track(s)";
+	ot->idname = "NLA_OT_tracks_add";
+	ot->description = "Add NLA-Tracks above/after the selected tracks";
 	
 	/* api callbacks */
-	ot->exec= nlaedit_add_tracks_exec;
-	ot->poll= nlaop_poll_tweakmode_off;
+	ot->exec = nlaedit_add_tracks_exec;
+	ot->poll = nlaop_poll_tweakmode_off;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_boolean(ot->srna, "above_selected", 0, "Above Selected", "Add a new NLA Track above every existing selected one");
@@ -454,7 +454,7 @@ static int nlaedit_delete_tracks_exec (bContext *C, wmOperator *UNUSED(op))
 	
 	/* delete tracks */
 	for (ale= anim_data.first; ale; ale= ale->next) {
-		if(ale->type == ANIMTYPE_NLATRACK) {
+		if (ale->type == ANIMTYPE_NLATRACK) {
 			NlaTrack *nlt= (NlaTrack *)ale->data;
 			AnimData *adt= ale->adt;
 			
@@ -482,16 +482,16 @@ static int nlaedit_delete_tracks_exec (bContext *C, wmOperator *UNUSED(op))
 void NLA_OT_delete_tracks (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete Tracks";
-	ot->idname= "NLA_OT_delete_tracks";
-	ot->description= "Delete selected NLA-Tracks and the strips they contain";
+	ot->name = "Delete Tracks";
+	ot->idname = "NLA_OT_delete_tracks";
+	ot->description = "Delete selected NLA-Tracks and the strips they contain";
 	
 	/* api callbacks */
-	ot->exec= nlaedit_delete_tracks_exec;
-	ot->poll= nlaop_poll_tweakmode_off;
+	ot->exec = nlaedit_delete_tracks_exec;
+	ot->poll = nlaop_poll_tweakmode_off;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* *********************************************** */
diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c
index d7a1053..7ed4902 100644
--- a/source/blender/editors/space_nla/nla_draw.c
+++ b/source/blender/editors/space_nla/nla_draw.c
@@ -121,7 +121,7 @@ static void nla_action_draw_keyframes (AnimData *adt, bAction *act, View2D *v2d,
 	action_to_keylist(adt, act, &keys, NULL);
 	BLI_dlrbTree_linkedlist_sync(&keys);
 	
-	if ELEM(NULL, act, keys.first)
+	if (ELEM(NULL, act, keys.first))
 		return;
 	
 	/* draw a darkened region behind the strips 
@@ -172,7 +172,7 @@ static void nla_strip_get_color_inside (AnimData *adt, NlaStrip *strip, float co
 			color[2]= 0.86f;
 		}
 		else {
-			/* normal, unselected strip - use (hardly noticable) blue tinge */
+			/* normal, unselected strip - use (hardly noticeable) blue tinge */
 			// FIXME: hardcoded temp-hack colors
 			color[0]= 0.11f;
 			color[1]= 0.15f;
@@ -190,7 +190,7 @@ static void nla_strip_get_color_inside (AnimData *adt, NlaStrip *strip, float co
 			color[2]= 0.59f;
 		}
 		else {
-			/* normal, unselected strip - use (hardly noticable) dark purple tinge */
+			/* normal, unselected strip - use (hardly noticeable) dark purple tinge */
 			// FIXME: hardcoded temp-hack colors
 			color[0]= 0.20f;
 			color[1]= 0.15f;
@@ -207,7 +207,7 @@ static void nla_strip_get_color_inside (AnimData *adt, NlaStrip *strip, float co
 			color[2]= 0.48f;
 		}
 		else {
-			/* normal, unselected strip - use (hardly noticable) teal tinge */
+			/* normal, unselected strip - use (hardly noticeable) teal tinge */
 			// FIXME: hardcoded temp-hack colors
 			color[0]= 0.17f;
 			color[1]= 0.24f;
@@ -498,10 +498,10 @@ static void nla_draw_strip_text (AnimData *adt, NlaTrack *nlt, NlaStrip *strip,
 	 *	- padding of 2 'units' on either side
 	 */
 	// TODO: make this centered?
-	rect.xmin= strip->start + xofs;
-	rect.ymin= yminc;
-	rect.xmax= strip->end - xofs;
-	rect.ymax= ymaxc;
+	rect.xmin = strip->start + xofs;
+	rect.ymin = yminc;
+	rect.xmax = strip->end - xofs;
+	rect.ymax = ymaxc;
 	
 	/* add this string to the cache of texts to draw */
 	UI_view2d_text_cache_rectf(v2d, &rect, str, col);
@@ -559,7 +559,7 @@ void draw_nla_main_data (bAnimContext *ac, SpaceNla *snla, ARegion *ar)
 	/* don't use totrect set, as the width stays the same 
 	 * (NOTE: this is ok here, the configuration is pretty straightforward) 
 	 */
-	v2d->tot.ymin= (float)(-height);
+	v2d->tot.ymin = (float)(-height);
 	
 	/* loop through channels, and set up drawing depending on their type  */	
 	y= (float)(-NLACHANNEL_HEIGHT(snla));
@@ -692,8 +692,7 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie
 						
 					/* if this track is active and we're tweaking it, don't draw these toggles */
 					// TODO: need a special macro for this...
-					if ( ((nlt->flag & NLATRACK_ACTIVE) && (nlt->flag & NLATRACK_DISABLED)) == 0 ) 
-					{
+					if (((nlt->flag & NLATRACK_ACTIVE) && (nlt->flag & NLATRACK_DISABLED)) == 0) {
 						if (nlt->flag & NLATRACK_MUTED)
 							mute = ICON_MUTE_IPO_ON;
 						else	
@@ -813,7 +812,7 @@ static void draw_nla_channel_list_gl (bAnimContext *ac, ListBase *anim_data, Vie
 					/* only on top two corners, to show that this channel sits on top of the preceding ones */
 					uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
 					
-					/* draw slightly shifted up vertically to look like it has more separtion from other channels,
+					/* draw slightly shifted up vertically to look like it has more separation from other channels,
 					 * but we then need to slightly shorten it so that it doesn't look like it overlaps
 					 */
 					uiDrawBox(GL_POLYGON, x+offset,  yminc+NLACHANNEL_SKIP, (float)v2d->cur.xmax, ymaxc+NLACHANNEL_SKIP-1, 8);
@@ -947,7 +946,7 @@ void draw_nla_channel_list (bContext *C, bAnimContext *ac, ARegion *ar)
 	/* don't use totrect set, as the width stays the same 
 	 * (NOTE: this is ok here, the configuration is pretty straightforward) 
 	 */
-	v2d->tot.ymin= (float)(-height);
+	v2d->tot.ymin = (float)(-height);
 	/* 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);
 	
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index d7dfea0..1a94b11 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -158,16 +158,16 @@ static int nlaedit_enable_tweakmode_exec (bContext *C, wmOperator *op)
 void NLA_OT_tweakmode_enter (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Enter Tweak Mode";
-	ot->idname= "NLA_OT_tweakmode_enter";
-	ot->description= "Enter tweaking mode for the action referenced by the active strip";
+	ot->name = "Enter Tweak Mode";
+	ot->idname = "NLA_OT_tweakmode_enter";
+	ot->description = "Enter tweaking mode for the action referenced by the active strip";
 	
 	/* api callbacks */
-	ot->exec= nlaedit_enable_tweakmode_exec;
-	ot->poll= nlaop_poll_tweakmode_off;
+	ot->exec = nlaedit_enable_tweakmode_exec;
+	ot->poll = nlaop_poll_tweakmode_off;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ------------- */
@@ -223,16 +223,16 @@ static int nlaedit_disable_tweakmode_exec (bContext *C, wmOperator *op)
 void NLA_OT_tweakmode_exit (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Exit Tweak Mode";
-	ot->idname= "NLA_OT_tweakmode_exit";
-	ot->description= "Exit tweaking mode for the action referenced by the active strip";
+	ot->name = "Exit Tweak Mode";
+	ot->idname = "NLA_OT_tweakmode_exit";
+	ot->description = "Exit tweaking mode for the action referenced by the active strip";
 	
 	/* api callbacks */
-	ot->exec= nlaedit_disable_tweakmode_exec;
-	ot->poll= nlaop_poll_tweakmode_on;
+	ot->exec = nlaedit_disable_tweakmode_exec;
+	ot->poll = nlaop_poll_tweakmode_on;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* *********************************************** */
@@ -309,8 +309,8 @@ static int nlaedit_viewall(bContext *C, const short onlySel)
 	v2d->cur.xmax += extra;
 	
 	/* set vertical range */
-	v2d->cur.ymax= 0.0f;
-	v2d->cur.ymin= (float)-(v2d->mask.ymax - v2d->mask.ymin);
+	v2d->cur.ymax = 0.0f;
+	v2d->cur.ymin = (float)-(v2d->mask.ymax - v2d->mask.ymin);
 	
 	/* do View2D syncing */
 	UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
@@ -338,31 +338,31 @@ static int nlaedit_viewsel_exec(bContext *C, wmOperator *UNUSED(op))
 void NLA_OT_view_all (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View All";
-	ot->idname= "NLA_OT_view_all";
-	ot->description= "Reset viewable area to show full strips range";
+	ot->name = "View All";
+	ot->idname = "NLA_OT_view_all";
+	ot->description = "Reset viewable area to show full strips range";
 	
 	/* api callbacks */
-	ot->exec= nlaedit_viewall_exec;
-	ot->poll= ED_operator_nla_active;
+	ot->exec = nlaedit_viewall_exec;
+	ot->poll = ED_operator_nla_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 void NLA_OT_view_selected (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View Selected";
-	ot->idname= "NLA_OT_view_selected";
-	ot->description= "Reset viewable area to show selected strips range";
+	ot->name = "View Selected";
+	ot->idname = "NLA_OT_view_selected";
+	ot->description = "Reset viewable area to show selected strips range";
 	
 	/* api callbacks */
-	ot->exec= nlaedit_viewsel_exec;
-	ot->poll= ED_operator_nla_active;
+	ot->exec = nlaedit_viewsel_exec;
+	ot->poll = ED_operator_nla_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* *********************************************** */
@@ -399,7 +399,7 @@ static int nlaedit_add_actionclip_exec (bContext *C, wmOperator *op)
 	
 	if (act == NULL) {
 		BKE_report(op->reports, RPT_ERROR, "No valid Action to add");
-		//printf("Add strip - actname = '%s' \n", actname);
+		//printf("Add strip - actname = '%s'\n", actname);
 		return OPERATOR_CANCELLED;
 	}
 	else if (act->idroot == 0) {
@@ -473,23 +473,23 @@ void NLA_OT_actionclip_add (wmOperatorType *ot)
 	PropertyRNA *prop;
 
 	/* identifiers */
-	ot->name= "Add Action Strip";
-	ot->idname= "NLA_OT_actionclip_add";
-	ot->description= "Add an Action-Clip strip (i.e. an NLA Strip referencing an Action) to the active track";
+	ot->name = "Add Action Strip";
+	ot->idname = "NLA_OT_actionclip_add";
+	ot->description = "Add an Action-Clip strip (i.e. an NLA Strip referencing an Action) to the active track";
 	
 	/* api callbacks */
-	ot->invoke= WM_enum_search_invoke;
-	ot->exec= nlaedit_add_actionclip_exec;
-	ot->poll= nlaop_poll_tweakmode_off;
+	ot->invoke = WM_enum_search_invoke;
+	ot->exec = nlaedit_add_actionclip_exec;
+	ot->poll = nlaop_poll_tweakmode_off;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* props */
 		// TODO: this would be nicer as an ID-pointer...
 	prop= RNA_def_enum(ot->srna, "action", DummyRNA_NULL_items, 0, "Action", "");
 	RNA_def_enum_funcs(prop, RNA_action_itemf);
-	ot->prop= prop;
+	ot->prop = prop;
 }
 
 /* ******************** Add Transition Operator ***************************** */
@@ -520,7 +520,7 @@ static int nlaedit_add_transition_exec (bContext *C, wmOperator *op)
 		NlaStrip *s1, *s2;
 		
 		/* get initial pair of strips */
-		if ELEM(nlt->strips.first, NULL, nlt->strips.last)
+		if (ELEM(nlt->strips.first, NULL, nlt->strips.last))
 			continue;
 		s1= nlt->strips.first;
 		s2= s1->next;
@@ -530,7 +530,7 @@ static int nlaedit_add_transition_exec (bContext *C, wmOperator *op)
 			NlaStrip *strip;
 			
 			/* check if both are selected */
-			if ELEM(0, (s1->flag & NLASTRIP_FLAG_SELECT), (s2->flag & NLASTRIP_FLAG_SELECT))
+			if (ELEM(0, (s1->flag & NLASTRIP_FLAG_SELECT), (s2->flag & NLASTRIP_FLAG_SELECT)))
 				continue;
 			/* check if there's space between the two */
 			if (IS_EQF(s1->end, s2->start))
@@ -598,16 +598,16 @@ static int nlaedit_add_transition_exec (bContext *C, wmOperator *op)
 void NLA_OT_transition_add (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Transition";
-	ot->idname= "NLA_OT_transition_add";
-	ot->description= "Add a transition strip between two adjacent selected strips";
+	ot->name = "Add Transition";
+	ot->idname = "NLA_OT_transition_add";
+	ot->description = "Add a transition strip between two adjacent selected strips";
 	
 	/* api callbacks */
-	ot->exec= nlaedit_add_transition_exec;
-	ot->poll= nlaop_poll_tweakmode_off;
+	ot->exec = nlaedit_add_transition_exec;
+	ot->poll = nlaop_poll_tweakmode_off;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ******************** Add Sound Clip Operator ***************************** */
@@ -683,16 +683,16 @@ static int nlaedit_add_sound_exec (bContext *C, wmOperator *UNUSED(op))
 void NLA_OT_soundclip_add (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Sound Clip";
-	ot->idname= "NLA_OT_soundclip_add";
-	ot->description= "Add a strip for controlling when speaker plays its sound clip";
+	ot->name = "Add Sound Clip";
+	ot->idname = "NLA_OT_soundclip_add";
+	ot->description = "Add a strip for controlling when speaker plays its sound clip";
 	
 	/* api callbacks */
-	ot->exec= nlaedit_add_sound_exec;
-	ot->poll= nlaop_poll_tweakmode_off;
+	ot->exec = nlaedit_add_sound_exec;
+	ot->poll = nlaop_poll_tweakmode_off;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ******************** Add Meta-Strip Operator ***************************** */
@@ -745,16 +745,16 @@ static int nlaedit_add_meta_exec (bContext *C, wmOperator *UNUSED(op))
 void NLA_OT_meta_add (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Meta-Strips";
-	ot->idname= "NLA_OT_meta_add";
-	ot->description= "Add new meta-strips incorporating the selected strips";
+	ot->name = "Add Meta-Strips";
+	ot->idname = "NLA_OT_meta_add";
+	ot->description = "Add new meta-strips incorporating the selected strips";
 	
 	/* api callbacks */
-	ot->exec= nlaedit_add_meta_exec;
-	ot->poll= nlaop_poll_tweakmode_off;
+	ot->exec = nlaedit_add_meta_exec;
+	ot->poll = nlaop_poll_tweakmode_off;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ******************** Remove Meta-Strip Operator ***************************** */
@@ -797,16 +797,16 @@ static int nlaedit_remove_meta_exec (bContext *C, wmOperator *UNUSED(op))
 void NLA_OT_meta_remove (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Remove Meta-Strips";
-	ot->idname= "NLA_OT_meta_remove";
-	ot->description= "Separate out the strips held by the selected meta-strips";
+	ot->name = "Remove Meta-Strips";
+	ot->idname = "NLA_OT_meta_remove";
+	ot->description = "Separate out the strips held by the selected meta-strips";
 	
 	/* api callbacks */
-	ot->exec= nlaedit_remove_meta_exec;
-	ot->poll= nlaop_poll_tweakmode_off;
+	ot->exec = nlaedit_remove_meta_exec;
+	ot->poll = nlaop_poll_tweakmode_off;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ******************** Duplicate Strips Operator ************************** */
@@ -900,17 +900,17 @@ static int nlaedit_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED
 void NLA_OT_duplicate (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Duplicate Strips";
-	ot->idname= "NLA_OT_duplicate";
-	ot->description= "Duplicate selected NLA-Strips, adding the new strips in new tracks above the originals";
+	ot->name = "Duplicate Strips";
+	ot->idname = "NLA_OT_duplicate";
+	ot->description = "Duplicate selected NLA-Strips, adding the new strips in new tracks above the originals";
 	
 	/* api callbacks */
-	ot->invoke= nlaedit_duplicate_invoke;
-	ot->exec= nlaedit_duplicate_exec;
-	ot->poll= nlaop_poll_tweakmode_off;
+	ot->invoke = nlaedit_duplicate_invoke;
+	ot->exec = nlaedit_duplicate_exec;
+	ot->poll = nlaop_poll_tweakmode_off;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* to give to transform */
 	RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
@@ -975,16 +975,16 @@ static int nlaedit_delete_exec (bContext *C, wmOperator *UNUSED(op))
 void NLA_OT_delete (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete Strips";
-	ot->idname= "NLA_OT_delete";
-	ot->description= "Delete selected strips";
+	ot->name = "Delete Strips";
+	ot->idname = "NLA_OT_delete";
+	ot->description = "Delete selected strips";
 	
 	/* api callbacks */
-	ot->exec= nlaedit_delete_exec;
-	ot->poll= nlaop_poll_tweakmode_off;
+	ot->exec = nlaedit_delete_exec;
+	ot->poll = nlaop_poll_tweakmode_off;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ******************** Split Strips Operator ***************************** */
@@ -1120,16 +1120,16 @@ static int nlaedit_split_exec (bContext *C, wmOperator *UNUSED(op))
 void NLA_OT_split (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Split Strips";
-	ot->idname= "NLA_OT_split";
-	ot->description= "Split selected strips at their midpoints";
+	ot->name = "Split Strips";
+	ot->idname = "NLA_OT_split";
+	ot->description = "Split selected strips at their midpoints";
 	
 	/* api callbacks */
-	ot->exec= nlaedit_split_exec;
-	ot->poll= nlaop_poll_tweakmode_off;
+	ot->exec = nlaedit_split_exec;
+	ot->poll = nlaop_poll_tweakmode_off;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ******************** Bake Strips Operator ***************************** */
@@ -1173,16 +1173,16 @@ static int nlaedit_bake_exec (bContext *C, wmOperator *UNUSED(op))
 void NLA_OT_bake (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Bake Strips";
-	ot->idname= "NLA_OT_bake";
-	ot->description= "Bake all strips of selected AnimData blocks";
+	ot->name = "Bake Strips";
+	ot->idname = "NLA_OT_bake";
+	ot->description = "Bake all strips of selected AnimData blocks";
 	
 	/* api callbacks */
-	ot->exec= nlaedit_bake_exec;
-	ot->poll= nlaop_poll_tweakmode_off;
+	ot->exec = nlaedit_bake_exec;
+	ot->poll = nlaop_poll_tweakmode_off;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* *********************************************** */
@@ -1235,16 +1235,16 @@ static int nlaedit_toggle_mute_exec (bContext *C, wmOperator *UNUSED(op))
 void NLA_OT_mute_toggle (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Toggle Muting";
-	ot->idname= "NLA_OT_mute_toggle";
-	ot->description= "Mute or un-mute selected strips";
+	ot->name = "Toggle Muting";
+	ot->idname = "NLA_OT_mute_toggle";
+	ot->description = "Mute or un-mute selected strips";
 	
 	/* api callbacks */
-	ot->exec= nlaedit_toggle_mute_exec;
-	ot->poll= nlaop_poll_tweakmode_off;
+	ot->exec = nlaedit_toggle_mute_exec;
+	ot->poll = nlaop_poll_tweakmode_off;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ******************** Swap Strips Operator ************************** */
@@ -1282,8 +1282,7 @@ static int nlaedit_swap_exec (bContext *C, wmOperator *op)
 		if ((nlt->strips.first == nlt->strips.last) && (nlt->strips.first != NULL)) {
 			NlaStrip *mstrip = (NlaStrip *)nlt->strips.first;
 			
-			if ((mstrip->flag & NLASTRIP_FLAG_TEMP_META) && (BLI_countlist(&mstrip->strips) == 2)) 
-			{
+			if ((mstrip->flag & NLASTRIP_FLAG_TEMP_META) && (BLI_countlist(&mstrip->strips) == 2)) {
 				/* remove this temp meta, so that we can see the strips inside */
 				BKE_nlastrips_clear_metas(&nlt->strips, 0, 1);
 			}
@@ -1393,16 +1392,16 @@ static int nlaedit_swap_exec (bContext *C, wmOperator *op)
 void NLA_OT_swap (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Swap Strips";
-	ot->idname= "NLA_OT_swap";
-	ot->description= "Swap order of selected strips within tracks";
+	ot->name = "Swap Strips";
+	ot->idname = "NLA_OT_swap";
+	ot->description = "Swap order of selected strips within tracks";
 	
 	/* api callbacks */
-	ot->exec= nlaedit_swap_exec;
-	ot->poll= nlaop_poll_tweakmode_off;
+	ot->exec = nlaedit_swap_exec;
+	ot->poll = nlaop_poll_tweakmode_off;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ******************** Move Strips Up Operator ************************** */
@@ -1467,16 +1466,16 @@ static int nlaedit_move_up_exec (bContext *C, wmOperator *UNUSED(op))
 void NLA_OT_move_up (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Move Strips Up";
-	ot->idname= "NLA_OT_move_up";
-	ot->description= "Move selected strips up a track if there's room";
+	ot->name = "Move Strips Up";
+	ot->idname = "NLA_OT_move_up";
+	ot->description = "Move selected strips up a track if there's room";
 	
 	/* api callbacks */
-	ot->exec= nlaedit_move_up_exec;
-	ot->poll= nlaop_poll_tweakmode_off;
+	ot->exec = nlaedit_move_up_exec;
+	ot->poll = nlaop_poll_tweakmode_off;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ******************** Move Strips Down Operator ************************** */
@@ -1541,16 +1540,16 @@ static int nlaedit_move_down_exec (bContext *C, wmOperator *UNUSED(op))
 void NLA_OT_move_down (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Move Strips Down";
-	ot->idname= "NLA_OT_move_down";
-	ot->description= "Move selected strips down a track if there's room";
+	ot->name = "Move Strips Down";
+	ot->idname = "NLA_OT_move_down";
+	ot->description = "Move selected strips down a track if there's room";
 	
 	/* api callbacks */
-	ot->exec= nlaedit_move_down_exec;
-	ot->poll= nlaop_poll_tweakmode_off;
+	ot->exec = nlaedit_move_down_exec;
+	ot->poll = nlaop_poll_tweakmode_off;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ******************** Sync Action Length Operator ***************************** */
@@ -1617,19 +1616,19 @@ static int nlaedit_sync_actlen_exec (bContext *C, wmOperator *op)
 void NLA_OT_action_sync_length (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Sync Action Length";
-	ot->idname= "NLA_OT_action_sync_length";
-	ot->description= "Synchronise the length of the referenced Action with the length used in the strip";
+	ot->name = "Sync Action Length";
+	ot->idname = "NLA_OT_action_sync_length";
+	ot->description = "Synchronize the length of the referenced Action with the length used in the strip";
 	
 	/* api callbacks */
-	ot->exec= nlaedit_sync_actlen_exec;
-	ot->poll= ED_operator_nla_active; // XXX: is this satisfactory... probably requires a check for active strip...
+	ot->exec = nlaedit_sync_actlen_exec;
+	ot->poll = ED_operator_nla_active; // XXX: is this satisfactory... probably requires a check for active strip...
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
-	ot->prop= RNA_def_boolean(ot->srna, "active", 1, "Active Strip Only", "Only sync the active length for the active strip");
+	ot->prop = RNA_def_boolean(ot->srna, "active", 1, "Active Strip Only", "Only sync the active length for the active strip");
 }
 
 /* ******************** Apply Scale Operator ***************************** */
@@ -1717,16 +1716,16 @@ static int nlaedit_apply_scale_exec (bContext *C, wmOperator *UNUSED(op))
 void NLA_OT_apply_scale (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Apply Scale";
-	ot->idname= "NLA_OT_apply_scale";
-	ot->description= "Apply scaling of selected strips to their referenced Actions";
+	ot->name = "Apply Scale";
+	ot->idname = "NLA_OT_apply_scale";
+	ot->description = "Apply scaling of selected strips to their referenced Actions";
 	
 	/* api callbacks */
-	ot->exec= nlaedit_apply_scale_exec;
-	ot->poll= nlaop_poll_tweakmode_off;
+	ot->exec = nlaedit_apply_scale_exec;
+	ot->poll = nlaop_poll_tweakmode_off;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ******************** Clear Scale Operator ***************************** */
@@ -1780,16 +1779,16 @@ static int nlaedit_clear_scale_exec (bContext *C, wmOperator *UNUSED(op))
 void NLA_OT_clear_scale (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear Scale";
-	ot->idname= "NLA_OT_clear_scale";
-	ot->description= "Reset scaling of selected strips";
+	ot->name = "Clear Scale";
+	ot->idname = "NLA_OT_clear_scale";
+	ot->description = "Reset scaling of selected strips";
 	
 	/* api callbacks */
-	ot->exec= nlaedit_clear_scale_exec;
-	ot->poll= nlaop_poll_tweakmode_off;
+	ot->exec = nlaedit_clear_scale_exec;
+	ot->poll = nlaop_poll_tweakmode_off;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ******************** Snap Strips Operator ************************** */
@@ -1921,20 +1920,20 @@ static int nlaedit_snap_exec (bContext *C, wmOperator *op)
 void NLA_OT_snap (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Snap Strips";
-	ot->idname= "NLA_OT_snap";
-	ot->description= "Move start of strips to specified time";
+	ot->name = "Snap Strips";
+	ot->idname = "NLA_OT_snap";
+	ot->description = "Move start of strips to specified time";
 	
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= nlaedit_snap_exec;
-	ot->poll= nlaop_poll_tweakmode_off;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = nlaedit_snap_exec;
+	ot->poll = nlaop_poll_tweakmode_off;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_nlaedit_snap_types, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_nlaedit_snap_types, 0, "Type", "");
 }
 
 /* *********************************************** */
@@ -2040,20 +2039,20 @@ static int nla_fmodifier_add_exec(bContext *C, wmOperator *op)
 void NLA_OT_fmodifier_add (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add F-Modifier";
-	ot->idname= "NLA_OT_fmodifier_add";
-	ot->description= "Add a F-Modifier of the specified type to the selected NLA-Strips";
+	ot->name = "Add F-Modifier";
+	ot->idname = "NLA_OT_fmodifier_add";
+	ot->description = "Add a F-Modifier of the specified type to the selected NLA-Strips";
 	
 	/* api callbacks */
-	ot->invoke= nla_fmodifier_add_invoke;
-	ot->exec= nla_fmodifier_add_exec;
-	ot->poll= nlaop_poll_tweakmode_off; 
+	ot->invoke = nla_fmodifier_add_invoke;
+	ot->exec = nla_fmodifier_add_exec;
+	ot->poll = nlaop_poll_tweakmode_off; 
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* id-props */
-	ot->prop= RNA_def_enum(ot->srna, "type", fmodifier_type_items, 0, "Type", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", fmodifier_type_items, 0, "Type", "");
 	RNA_def_boolean(ot->srna, "only_active", 0, "Only Active", "Only add a F-Modifier of the specified type to the active strip");
 }
 
@@ -2104,16 +2103,16 @@ static int nla_fmodifier_copy_exec(bContext *C, wmOperator *op)
 void NLA_OT_fmodifier_copy (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Copy F-Modifiers";
-	ot->idname= "NLA_OT_fmodifier_copy";
-	ot->description= "Copy the F-Modifier(s) of the active NLA-Strip";
+	ot->name = "Copy F-Modifiers";
+	ot->idname = "NLA_OT_fmodifier_copy";
+	ot->description = "Copy the F-Modifier(s) of the active NLA-Strip";
 	
 	/* api callbacks */
-	ot->exec= nla_fmodifier_copy_exec;
-	ot->poll= nlaop_poll_tweakmode_off; 
+	ot->exec = nla_fmodifier_copy_exec;
+	ot->poll = nlaop_poll_tweakmode_off; 
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* id-props */
 	//ot->prop = RNA_def_boolean(ot->srna, "all", 1, "All F-Modifiers", "Copy all the F-Modifiers, instead of just the active one");
@@ -2166,16 +2165,16 @@ static int nla_fmodifier_paste_exec(bContext *C, wmOperator *op)
 void NLA_OT_fmodifier_paste (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Paste F-Modifiers";
-	ot->idname= "NLA_OT_fmodifier_paste";
-	ot->description= "Add copied F-Modifiers to the selected NLA-Strips";
+	ot->name = "Paste F-Modifiers";
+	ot->idname = "NLA_OT_fmodifier_paste";
+	ot->description = "Add copied F-Modifiers to the selected NLA-Strips";
 	
 	/* api callbacks */
-	ot->exec= nla_fmodifier_paste_exec;
-	ot->poll= nlaop_poll_tweakmode_off;
+	ot->exec = nla_fmodifier_paste_exec;
+	ot->poll = nlaop_poll_tweakmode_off;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* *********************************************** */
diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h
index 00c16d6..9d0762c 100644
--- a/source/blender/editors/space_nla/nla_intern.h
+++ b/source/blender/editors/space_nla/nla_intern.h
@@ -28,8 +28,8 @@
  *  \ingroup spnla
  */
 
-#ifndef ED_NLA_INTERN_H
-#define ED_NLA_INTERN_H
+#ifndef __NLA_INTERN_H__
+#define __NLA_INTERN_H__
 
 /* internal exports only */
 
@@ -140,5 +140,5 @@ short nlaedit_is_tweakmode_on(bAnimContext *ac);
 void nla_operatortypes(void);
 void nla_keymap(wmKeyConfig *keyconf);
 
-#endif /* ED_NLA_INTERN_H */
+#endif /* __NLA_INTERN_H__ */
 
diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c
index 55831de..78fb92f 100644
--- a/source/blender/editors/space_nla/nla_ops.c
+++ b/source/blender/editors/space_nla/nla_ops.c
@@ -200,21 +200,21 @@ static void nla_keymap_main (wmKeyConfig *keyconf, wmKeyMap *keymap)
 		/* click select */
 	kmi = WM_keymap_add_item(keymap, "NLA_OT_click_select", SELECTMOUSE, KM_PRESS, 0, 0);
 		RNA_boolean_set(kmi->ptr, "extend", FALSE);
-	kmi= WM_keymap_add_item(keymap, "NLA_OT_click_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "NLA_OT_click_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
 		RNA_boolean_set(kmi->ptr, "extend", TRUE);
 		
 		/* select left/right */
 	kmi = WM_keymap_add_item(keymap, "NLA_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
 		RNA_boolean_set(kmi->ptr, "extend", FALSE);
 		RNA_enum_set(kmi->ptr, "mode", NLAEDIT_LRSEL_TEST);
-	kmi= WM_keymap_add_item(keymap, "NLA_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "NLA_OT_select_leftright", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
 		RNA_boolean_set(kmi->ptr, "extend", TRUE);
 		RNA_enum_set(kmi->ptr, "mode", NLAEDIT_LRSEL_TEST);
 	
-	kmi= WM_keymap_add_item(keymap, "NLA_OT_select_leftright", LEFTBRACKETKEY, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "NLA_OT_select_leftright", LEFTBRACKETKEY, KM_PRESS, 0, 0);
 		RNA_boolean_set(kmi->ptr, "extend", FALSE);
 		RNA_enum_set(kmi->ptr, "mode", NLAEDIT_LRSEL_LEFT);
-	kmi= WM_keymap_add_item(keymap, "NLA_OT_select_leftright", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "NLA_OT_select_leftright", RIGHTBRACKETKEY, KM_PRESS, 0, 0);
 		RNA_boolean_set(kmi->ptr, "extend", FALSE);
 		RNA_enum_set(kmi->ptr, "mode", NLAEDIT_LRSEL_RIGHT);
 		
@@ -301,7 +301,7 @@ void nla_keymap(wmKeyConfig *keyconf)
 	wmKeyMap *keymap;
 	
 	/* keymap for all regions */
-	keymap= WM_keymap_find(keyconf, "NLA Generic", SPACE_NLA, 0);
+	keymap = WM_keymap_find(keyconf, "NLA Generic", SPACE_NLA, 0);
 	WM_keymap_add_item(keymap, "NLA_OT_properties", NKEY, KM_PRESS, 0, 0);
 	
 	/* channels */
@@ -311,11 +311,11 @@ void nla_keymap(wmKeyConfig *keyconf)
 	 *
 	 * However, those operations which involve clicking on channels and/or the placement of them in the view are implemented here instead
 	 */
-	keymap= WM_keymap_find(keyconf, "NLA Channels", SPACE_NLA, 0);
+	keymap = WM_keymap_find(keyconf, "NLA Channels", SPACE_NLA, 0);
 	nla_keymap_channels(keymap);
 	
 	/* data */
-	keymap= WM_keymap_find(keyconf, "NLA Editor", SPACE_NLA, 0);
+	keymap = WM_keymap_find(keyconf, "NLA Editor", SPACE_NLA, 0);
 	nla_keymap_main(keyconf, keymap);
 }
 
diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c
index 0cb4858..b0cd59e 100644
--- a/source/blender/editors/space_nla/nla_select.c
+++ b/source/blender/editors/space_nla/nla_select.c
@@ -171,7 +171,7 @@ static int nlaedit_deselectall_exec(bContext *C, wmOperator *op)
 	if (ANIM_animdata_get_context(C, &ac) == 0)
 		return OPERATOR_CANCELLED;
 		
-	/* 'standard' behaviour - check if selected, then apply relevant selection */
+	/* 'standard' behavior - check if selected, then apply relevant selection */
 	if (RNA_boolean_get(op->ptr, "invert"))
 		deselect_nla_strips(&ac, DESELECT_STRIPS_NOTEST, SELECT_INVERT);
 	else
@@ -186,16 +186,16 @@ static int nlaedit_deselectall_exec(bContext *C, wmOperator *op)
 void NLA_OT_select_all_toggle (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select or Deselect All";
-	ot->idname= "NLA_OT_select_all_toggle";
-	ot->description= "(De)Select all NLA-Strips";
+	ot->name = "(De)select All";
+	ot->idname = "NLA_OT_select_all_toggle";
+	ot->description = "Select or deselect all NLA-Strips";
 	
 	/* api callbacks */
-	ot->exec= nlaedit_deselectall_exec;
-	ot->poll= nlaop_poll_tweakmode_off;
+	ot->exec = nlaedit_deselectall_exec;
+	ot->poll = nlaop_poll_tweakmode_off;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
+	ot->flag = OPTYPE_REGISTER/*|OPTYPE_UNDO*/;
 	
 	/* props */
 	RNA_def_boolean(ot->srna, "invert", 0, "Invert", "");
@@ -294,10 +294,10 @@ static int nlaedit_borderselect_exec(bContext *C, wmOperator *op)
 		deselect_nla_strips(&ac, DESELECT_STRIPS_TEST, SELECT_SUBTRACT);
 
 	/* get settings from operator */
-	rect.xmin= RNA_int_get(op->ptr, "xmin");
-	rect.ymin= RNA_int_get(op->ptr, "ymin");
-	rect.xmax= RNA_int_get(op->ptr, "xmax");
-	rect.ymax= RNA_int_get(op->ptr, "ymax");
+	rect.xmin = RNA_int_get(op->ptr, "xmin");
+	rect.ymin = RNA_int_get(op->ptr, "ymin");
+	rect.xmax = RNA_int_get(op->ptr, "xmax");
+	rect.ymax = RNA_int_get(op->ptr, "ymax");
 		
 	if (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT)
 		selectmode = SELECT_ADD;
@@ -308,7 +308,7 @@ static int nlaedit_borderselect_exec(bContext *C, wmOperator *op)
 	if (RNA_boolean_get(op->ptr, "axis_range")) {
 		/* mode depends on which axis of the range is larger to determine which axis to use 
 		 *	- checking this in region-space is fine, as it's fundamentally still going to be a different rect size
-		 *	- the frame-range select option is favoured over the channel one (x over y), as frame-range one is often
+		 *	- the frame-range select option is favored over the channel one (x over y), as frame-range one is often
 		 *	  used for tweaking timing when "blocking", while channels is not that useful...
 		 */
 		if ((rect.xmax - rect.xmin) >= (rect.ymax - rect.ymin))
@@ -331,20 +331,20 @@ static int nlaedit_borderselect_exec(bContext *C, wmOperator *op)
 void NLA_OT_select_border(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Border Select";
-	ot->idname= "NLA_OT_select_border";
-	ot->description= "Use box selection to grab NLA-Strips";
+	ot->name = "Border Select";
+	ot->idname = "NLA_OT_select_border";
+	ot->description = "Use box selection to grab NLA-Strips";
 	
 	/* api callbacks */
-	ot->invoke= WM_border_select_invoke;
-	ot->exec= nlaedit_borderselect_exec;
-	ot->modal= WM_border_select_modal;
-	ot->cancel= WM_border_select_cancel;
+	ot->invoke = WM_border_select_invoke;
+	ot->exec = nlaedit_borderselect_exec;
+	ot->modal = WM_border_select_modal;
+	ot->cancel = WM_border_select_cancel;
 	
-	ot->poll= nlaop_poll_tweakmode_off;
+	ot->poll = nlaop_poll_tweakmode_off;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* rna */
 	WM_operator_properties_gesture_border(ot, 1);
@@ -484,20 +484,20 @@ static int nlaedit_select_leftright_invoke (bContext *C, wmOperator *op, wmEvent
 void NLA_OT_select_leftright (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Left/Right";
-	ot->idname= "NLA_OT_select_leftright";
-	ot->description= "Select strips to the left or the right of the current frame";
+	ot->name = "Select Left/Right";
+	ot->idname = "NLA_OT_select_leftright";
+	ot->description = "Select strips to the left or the right of the current frame";
 	
 	/* api callbacks  */
-	ot->invoke= nlaedit_select_leftright_invoke;
-	ot->exec= nlaedit_select_leftright_exec;
-	ot->poll= ED_operator_nla_active;
+	ot->invoke = nlaedit_select_leftright_invoke;
+	ot->exec = nlaedit_select_leftright_exec;
+	ot->poll = ED_operator_nla_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* id-props */
-	ot->prop= RNA_def_enum(ot->srna, "mode", prop_nlaedit_leftright_select_types, NLAEDIT_LRSEL_TEST, "Mode", "");
+	ot->prop = RNA_def_enum(ot->srna, "mode", prop_nlaedit_leftright_select_types, NLAEDIT_LRSEL_TEST, "Mode", "");
 	RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", "");
 }
 
@@ -538,7 +538,7 @@ static void mouse_nla_strips (bContext *C, bAnimContext *ac, const int mval[2],
 	ale= BLI_findlink(&anim_data, channel_index);
 	if (ale == NULL) {
 		/* channel not found */
-		printf("Error: animation channel (index = %d) not found in mouse_nla_strips() \n", channel_index);
+		printf("Error: animation channel (index = %d) not found in mouse_nla_strips()\n", channel_index);
 		BLI_freelistN(&anim_data);
 		return;
 	}
@@ -646,16 +646,16 @@ static int nlaedit_clickselect_invoke(bContext *C, wmOperator *op, wmEvent *even
 void NLA_OT_click_select (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Mouse Select";
-	ot->idname= "NLA_OT_click_select";
-	ot->description= "Handle clicks to select NLA Strips";
+	ot->name = "Mouse Select";
+	ot->idname = "NLA_OT_click_select";
+	ot->description = "Handle clicks to select NLA Strips";
 	
 	/* api callbacks - absolutely no exec() this yet... */
-	ot->invoke= nlaedit_clickselect_invoke;
-	ot->poll= ED_operator_nla_active;
+	ot->invoke = nlaedit_clickselect_invoke;
+	ot->poll = ED_operator_nla_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* id-props */
 	RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", ""); // SHIFTKEY
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index 48859ac..4dc3aef 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -69,7 +69,7 @@ ARegion *nla_has_buttons_region(ScrArea *sa)
 	ARegion *ar, *arnew;
 
 	ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
-	if(ar) return ar;
+	if (ar) return ar;
 
 	/* add subdiv level; after main */
 	ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
@@ -140,10 +140,10 @@ static SpaceLink *nla_new(const bContext *C)
 	BLI_addtail(&snla->regionbase, ar);
 	ar->regiontype= RGN_TYPE_WINDOW;
 	
-	ar->v2d.tot.xmin= (float)(SFRA-10);
-	ar->v2d.tot.ymin= (float)(-sa->winy)/3.0f;
-	ar->v2d.tot.xmax= (float)(EFRA+10);
-	ar->v2d.tot.ymax= 0.0f;
+	ar->v2d.tot.xmin = (float)(SFRA-10);
+	ar->v2d.tot.ymin = (float)(-sa->winy)/3.0f;
+	ar->v2d.tot.xmax = (float)(EFRA+10);
+	ar->v2d.tot.ymax = 0.0f;
 	
 	ar->v2d.cur = ar->v2d.tot;
 	
@@ -210,13 +210,13 @@ static void nla_channel_area_init(wmWindowManager *wm, ARegion *ar)
 	
 	/* own keymap */
 		/* own channels map first to override some channel keymaps */
-	keymap= WM_keymap_find(wm->defaultconf, "NLA Channels", SPACE_NLA, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "NLA Channels", SPACE_NLA, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 		/* now generic channels map for everything else that can apply */
-	keymap= WM_keymap_find(wm->defaultconf, "Animation Channels", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Animation Channels", 0, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 	
-	keymap= WM_keymap_find(wm->defaultconf, "NLA Generic", SPACE_NLA, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "NLA Generic", SPACE_NLA, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
@@ -256,9 +256,9 @@ static void nla_main_area_init(wmWindowManager *wm, ARegion *ar)
 	UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
 	
 	/* own keymap */
-	keymap= WM_keymap_find(wm->defaultconf, "NLA Editor", SPACE_NLA, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "NLA Editor", SPACE_NLA, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
-	keymap= WM_keymap_find(wm->defaultconf, "NLA Generic", SPACE_NLA, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "NLA Generic", SPACE_NLA, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
@@ -336,7 +336,7 @@ static void nla_buttons_area_init(wmWindowManager *wm, ARegion *ar)
 	
 	ED_region_panels_init(wm, ar);
 	
-	keymap= WM_keymap_find(wm->defaultconf, "NLA Generic", SPACE_NLA, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "NLA Generic", SPACE_NLA, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
@@ -371,7 +371,7 @@ static void nla_region_listener(ARegion *ar, wmNotifier *wmn)
 			}
 			break;
 		default:
-			if(wmn->data==ND_KEYS)
+			if (wmn->data==ND_KEYS)
 				ED_region_tag_redraw(ar);
 			break;
 	}
@@ -413,11 +413,11 @@ static void nla_main_area_listener(ARegion *ar, wmNotifier *wmn)
 			}
 			break;
 		case NC_ID:
-			if(wmn->action == NA_RENAME)
+			if (wmn->action == NA_RENAME)
 				ED_region_tag_redraw(ar);
 			break;
 		default:
-			if(wmn->data==ND_KEYS)
+			if (wmn->data==ND_KEYS)
 				ED_region_tag_redraw(ar);
 	}
 }
@@ -446,12 +446,12 @@ static void nla_channel_area_listener(ARegion *ar, wmNotifier *wmn)
 			}
 			break;
 		case NC_ID:
-			if(wmn->action == NA_RENAME)
+			if (wmn->action == NA_RENAME)
 				ED_region_tag_redraw(ar);
 			break;
 
 		default:
-			if(wmn->data==ND_KEYS)
+			if (wmn->data==ND_KEYS)
 				ED_region_tag_redraw(ar);
 	}
 }
@@ -466,12 +466,14 @@ static void nla_listener(ScrArea *sa, wmNotifier *wmn)
 			ED_area_tag_refresh(sa);
 			break;
 		case NC_SCENE:
-			/*switch (wmn->data) {
+#if 0
+			switch (wmn->data) {
 				case ND_OB_ACTIVE:
 				case ND_OB_SELECT:
 					ED_area_tag_refresh(sa);
 					break;
-			}*/
+			}
+#endif
 			ED_area_tag_refresh(sa);
 			break;
 		case NC_OBJECT:
@@ -485,7 +487,7 @@ static void nla_listener(ScrArea *sa, wmNotifier *wmn)
 			}
 			break;
 		case NC_SPACE:
-			if(wmn->data == ND_SPACE_NLA)
+			if (wmn->data == ND_SPACE_NLA)
 				ED_area_tag_redraw(sa);
 			break;
 	}
diff --git a/source/blender/editors/space_node/CMakeLists.txt b/source/blender/editors/space_node/CMakeLists.txt
index f33b784..8c3397b 100644
--- a/source/blender/editors/space_node/CMakeLists.txt
+++ b/source/blender/editors/space_node/CMakeLists.txt
@@ -54,4 +54,8 @@ set(SRC
 	node_intern.h
 )
 
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
 blender_add_lib(bf_editor_space_node "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_node/SConscript b/source/blender/editors/space_node/SConscript
index 6b72fd0..2dee750 100644
--- a/source/blender/editors/space_node/SConscript
+++ b/source/blender/editors/space_node/SConscript
@@ -19,7 +19,10 @@ if env['OURPLATFORM'] == 'linux':
     cflags='-pthread'
     incs += ' ../../../extern/binreloc/include'
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
 
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
+
 env.BlenderLib ( 'bf_editors_space_node', sources, Split(incs), defs, libtype=['core'], priority=[55], compileflags=cf )
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 143173d..42aea32 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -79,17 +79,13 @@
 
 #include "node_intern.h"
 
-
-// XXX interface.h
-extern void ui_dropshadow(rctf *rct, float radius, float aspect, int select);
-
 /* ****************** SOCKET BUTTON DRAW FUNCTIONS ***************** */
 
 static void node_sync_cb(bContext *UNUSED(C), void *snode_v, void *node_v)
 {
 	SpaceNode *snode= snode_v;
 	
-	if(snode->treetype==NTREE_SHADER) {
+	if (snode->treetype==NTREE_SHADER) {
 		nodeShaderSynchronizeID(node_v, 1);
 		// allqueue(REDRAWBUTSSHADING, 0);
 	}
@@ -102,21 +98,72 @@ static void node_socket_button_label(const bContext *UNUSED(C), uiBlock *block,
 	uiDefBut(block, LABEL, 0, sock->name, x, y, width, NODE_DY, NULL, 0, 0, 0, 0, "");
 }
 
+/* draw function for file output node sockets.
+ * XXX a bit ugly use atm, called from datatype button functions,
+ * since all node types and callbacks only use data type without struct_type.
+ */
+static void node_socket_button_output_file(const bContext *C, uiBlock *block,
+                                           bNodeTree *ntree, bNode *node, bNodeSocket *sock,
+                                           const char *UNUSED(name), int x, int y, int width)
+{
+	uiLayout *layout, *row;
+	PointerRNA nodeptr, sockptr, imfptr;
+	int imtype;
+	int rx, ry;
+	RNA_pointer_create(&ntree->id, &RNA_Node, node, &nodeptr);
+	RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &sockptr);
+	
+	layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, x, y+NODE_DY, width, 20, UI_GetStyle());
+	row = uiLayoutRow(layout, 0);		
+	
+	uiItemL(row, sock->name, 0);
+	
+	imfptr = RNA_pointer_get(&nodeptr, "format");
+	imtype = RNA_enum_get(&imfptr, "file_format");
+	/* in multilayer format all socket format details are ignored */
+	if (imtype != R_IMF_IMTYPE_MULTILAYER) {
+		PropertyRNA *imtype_prop;
+		const char *imtype_name;
+		
+		if (!RNA_boolean_get(&sockptr, "use_node_format"))
+			imfptr = RNA_pointer_get(&sockptr, "format");
+		
+		imtype_prop = RNA_struct_find_property(&imfptr, "file_format");
+		RNA_property_enum_name((bContext*)C, &imfptr, imtype_prop, RNA_property_enum_get(&imfptr, imtype_prop), &imtype_name);
+		uiBlockSetEmboss(block, UI_EMBOSSP);
+		uiItemL(row, imtype_name, 0);
+		uiBlockSetEmboss(block, UI_EMBOSSN);
+	}
+	
+	uiBlockLayoutResolve(block, &rx, &ry);
+}
 
 static void node_socket_button_default(const bContext *C, uiBlock *block,
 								bNodeTree *ntree, bNode *node, bNodeSocket *sock,
 								const char *name, int x, int y, int width)
 {
-	PointerRNA ptr;
-	uiBut *bt;
-	
-	RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &ptr);
-	
-	bt = uiDefButR(block, NUM, B_NODE_EXEC, name,
-				   x, y+1, width, NODE_DY-2, 
-				   &ptr, "default_value", 0, 0, 0, -1, -1, NULL);
-	if (node)
-		uiButSetFunc(bt, node_sync_cb, CTX_wm_space_node(C), node);
+	switch (sock->struct_type) {
+	case SOCK_STRUCT_NONE: {
+		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;
+			
+			RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &ptr);
+			
+			bt = uiDefButR(block, NUM, B_NODE_EXEC, name,
+						   x, y+1, width, NODE_DY-2, 
+						   &ptr, "default_value", 0, 0, 0, -1, -1, NULL);
+			if (node)
+				uiButSetFunc(bt, node_sync_cb, CTX_wm_space_node(C), node);
+		}
+		break;
+	}
+	case SOCK_STRUCT_OUTPUT_FILE:
+		node_socket_button_output_file(C, block, ntree, node, sock, name, x, y, width);
+		break;
+	}
 }
 
 typedef struct SocketComponentMenuArgs {
@@ -145,42 +192,69 @@ static void node_socket_button_components(const bContext *C, uiBlock *block,
 								   bNodeTree *ntree, bNode *node, bNodeSocket *sock,
 								   const char *name, int x, int y, int width)
 {
-	PointerRNA ptr;
-	SocketComponentMenuArgs *args;
-	
-	RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &ptr);
-	
-	args= MEM_callocN(sizeof(SocketComponentMenuArgs), "SocketComponentMenuArgs");
-	
-	args->ptr = ptr;
-	args->x = x;
-	args->y = y;
-	args->width = width;
-	args->cb = node_sync_cb;
-	args->arg1 = CTX_wm_space_node(C);
-	args->arg2 = node;
-	
-	uiDefBlockButN(block, socket_component_menu, args, name, x, y+1, width, NODE_DY-2, "");
+	switch (sock->struct_type) {
+	case SOCK_STRUCT_NONE: {
+		if (sock->link || (sock->flag & SOCK_HIDE_VALUE))
+			node_socket_button_label(C, block, ntree, node, sock, name, x, y, width);
+		else {
+			PointerRNA ptr;
+			SocketComponentMenuArgs *args;
+			
+			RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &ptr);
+			
+			args= MEM_callocN(sizeof(SocketComponentMenuArgs), "SocketComponentMenuArgs");
+			
+			args->ptr = ptr;
+			args->x = x;
+			args->y = y;
+			args->width = width;
+			args->cb = node_sync_cb;
+			args->arg1 = CTX_wm_space_node(C);
+			args->arg2 = node;
+			
+			uiDefBlockButN(block, socket_component_menu, args, name, x, y+1, width, NODE_DY-2, "");
+		}
+		break;
+	}
+	case SOCK_STRUCT_OUTPUT_FILE:
+		node_socket_button_output_file(C, block, ntree, node, sock, name, x, y, width);
+		break;
+	}
 }
 
 static void node_socket_button_color(const bContext *C, uiBlock *block,
 							  bNodeTree *ntree, bNode *node, bNodeSocket *sock,
 							  const char *name, int x, int y, int width)
 {
-	PointerRNA ptr;
-	uiBut *bt;
-	int labelw= width - 40;
-	
-	RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &ptr);
-	
-	bt=uiDefButR(block, COL, B_NODE_EXEC, "",
-				 x, y+2, (labelw>0 ? 40 : width), NODE_DY-2, 
-				 &ptr, "default_value", 0, 0, 0, -1, -1, NULL);
-	if (node)
-		uiButSetFunc(bt, node_sync_cb, CTX_wm_space_node(C), node);
+	/* XXX would be nicer to have draw function based on sock->struct_type as well,
+	 * but currently socket types are completely identified by data type only.
+	 */
 	
-	if (name[0]!='\0' && labelw>0)
-		uiDefBut(block, LABEL, 0, name, x + 40, y+2, labelw, NODE_DY-2, NULL, 0, 0, 0, 0, "");
+	switch (sock->struct_type) {
+	case SOCK_STRUCT_NONE: {
+		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;
+			int labelw= width - 40;
+			RNA_pointer_create(&ntree->id, &RNA_NodeSocket, sock, &ptr);
+			
+			bt=uiDefButR(block, COL, B_NODE_EXEC, "",
+						 x, y+2, (labelw>0 ? 40 : width), NODE_DY-2, 
+						 &ptr, "default_value", 0, 0, 0, -1, -1, NULL);
+			if (node)
+				uiButSetFunc(bt, node_sync_cb, CTX_wm_space_node(C), node);
+			
+			if (name[0]!='\0' && labelw>0)
+				uiDefBut(block, LABEL, 0, name, x + 40, y+2, labelw, NODE_DY-2, NULL, 0, 0, 0, 0, "");
+		}
+		break;
+	}
+	case SOCK_STRUCT_OUTPUT_FILE:
+		node_socket_button_output_file(C, block, ntree, node, sock, name, x, y, width);
+		break;
+	}
 }
 
 /* ****************** BASE DRAW FUNCTIONS FOR NEW OPERATOR NODES ***************** */
@@ -209,7 +283,7 @@ static void node_draw_socket_new(bNodeSocket *sock, float size)
 	glColor3ub(180, 180, 180);
 	
 	glBegin(GL_POLYGON);
-	for(a=0; a<16; a++)
+	for (a=0; a<16; a++)
 		glVertex2f(x+size*si[a], y+size*co[a]);
 	glEnd();
 	
@@ -217,7 +291,7 @@ static void node_draw_socket_new(bNodeSocket *sock, float size)
 	glEnable(GL_BLEND);
 	glEnable( GL_LINE_SMOOTH );
 	glBegin(GL_LINE_LOOP);
-	for(a=0; a<16; a++)
+	for (a=0; a<16; a++)
 		glVertex2f(x+size*si[a], y+size*co[a]);
 	glEnd();
 	glDisable( GL_LINE_SMOOTH );
@@ -262,7 +336,7 @@ static void node_buts_mix_rgb(uiLayout *layout, bContext *UNUSED(C), PointerRNA
 
 	row= uiLayoutRow(layout, 1);
 	uiItemR(row, ptr, "blend_type", 0, "", ICON_NONE);
-	if(ntree->type == NTREE_COMPOSIT)
+	if (ntree->type == NTREE_COMPOSIT)
 		uiItemR(row, ptr, "use_alpha", 0, "", ICON_IMAGE_RGB_ALPHA);
 }
 
@@ -274,9 +348,9 @@ static void node_buts_time(uiLayout *layout, bContext *UNUSED(C), PointerRNA *pt
 	bNode *node= ptr->data;
 	CurveMapping *cumap= node->storage;
 	
-	if(cumap) {
+	if (cumap) {
 		cumap->flag |= CUMA_DRAW_CFRA;
-		if(node->custom1<node->custom2)
+		if (node->custom1<node->custom2)
 			cumap->sample[0]= (float)(CFRA - node->custom1)/(float)(node->custom2-node->custom1);
 	}
 #endif
@@ -311,7 +385,7 @@ static void node_buts_curvecol(uiLayout *layout, bContext *UNUSED(C), PointerRNA
 	bNode *node= ptr->data;
 	CurveMapping *cumap= node->storage;
 
-	if(_sample_col) {
+	if (_sample_col) {
 		cumap->flag |= CUMA_DRAW_SAMPLE;
 		copy_v3_v3(cumap->sample, _sample_col);
 	}
@@ -353,9 +427,9 @@ static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v)
 	bNode *node= node_v;
 	Tex *tex;
 	
-	if(node->menunr<1) return;
+	if (node->menunr<1) return;
 	
-	if(node->id) {
+	if (node->id) {
 		node->id->us--;
 		node->id= NULL;
 	}
@@ -367,7 +441,7 @@ static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v)
 	
 	nodeSetActive(ntree, node);
 	
-	if( ntree->type == NTREE_TEXTURE )
+	if ( ntree->type == NTREE_TEXTURE )
 		ntreeTexCheckCyclics( ntree );
 	
 	// allqueue(REDRAWBUTSSHADING, 0);
@@ -422,7 +496,7 @@ static void node_buts_texture(uiLayout *layout, bContext *UNUSED(C), PointerRNA
 	
 	uiItemR(layout, ptr, "texture", 0, "", ICON_NONE);
 	
-	if(multi) {
+	if (multi) {
 		/* Number Drawing not optimal here, better have a list*/
 		uiItemR(layout, ptr, "node_output", 0, "", ICON_NONE);
 	}
@@ -438,15 +512,15 @@ static int node_resize_area_default(bNode *node, int x, int y)
 	if (node->flag & NODE_HIDDEN) {
 		rctf totr= node->totr;
 		/* right part of node */
-		totr.xmin= node->totr.xmax-20.0f;
+		totr.xmin = node->totr.xmax-20.0f;
 		return BLI_in_rctf(&totr, x, y);
 	}
 	else {
 		/* rect we're interested in is just the bottom right corner */
 		rctf totr= node->totr;
 		/* bottom right corner */
-		totr.xmin= totr.xmax-10.0f;
-		totr.ymax= totr.ymin+10.0f;
+		totr.xmin = totr.xmax-10.0f;
+		totr.ymax = totr.ymin+10.0f;
 		return BLI_in_rctf(&totr, x, y);
 	}
 }
@@ -485,8 +559,8 @@ static void node_update_group(const bContext *C, bNodeTree *ntree, bNode *gnode)
 		rect->ymin = rect->ymax = locy;
 		
 		counter= 1;
-		for(node= ngroup->nodes.first; node; node= node->next) {
-			if(counter) {
+		for (node= ngroup->nodes.first; node; node= node->next) {
+			if (counter) {
 				*rect= node->totr;
 				counter= 0;
 			}
@@ -878,13 +952,13 @@ static void node_update_frame(const bContext *UNUSED(C), bNodeTree *UNUSED(ntree
 	/* get "global" coords */
 	nodeSpaceCoords(node, &locx, &locy);
 
-	node->prvr.xmin= locx + NODE_DYS;
-	node->prvr.xmax= locx + node->width- NODE_DYS;
+	node->prvr.xmin = locx + NODE_DYS;
+	node->prvr.xmax = locx + node->width- NODE_DYS;
 
-	node->totr.xmin= locx;
-	node->totr.xmax= locx + node->width;
-	node->totr.ymax= locy;
-	node->totr.ymin= locy - node->height;
+	node->totr.xmin = locx;
+	node->totr.xmax = locx + node->width;
+	node->totr.ymax = locy;
+	node->totr.ymin = locy - node->height;
 }
 
 static void node_common_set_butfunc(bNodeType *ntype)
@@ -920,9 +994,9 @@ static void node_browse_text_cb(bContext *C, void *ntree_v, void *node_v)
 	bNode *node= node_v;
 	/* ID *oldid; */ /* UNUSED */
 	
-	if(node->menunr<1) return;
+	if (node->menunr<1) return;
 	
-	if(node->id) {
+	if (node->id) {
 		node->id->us--;
 	}
 	/* oldid= node->id; */ /* UNUSED */
@@ -947,7 +1021,7 @@ static void node_shader_buts_material(uiLayout *layout, bContext *C, PointerRNA
 	
 	uiTemplateID(layout, C, ptr, "material", "MATERIAL_OT_new", NULL, NULL);
 	
-	if(!node->id) return;
+	if (!node->id) return;
 	
 	col= uiLayoutColumn(layout, 0);
 	uiItemR(col, ptr, "use_diffuse", 0, NULL, ICON_NONE);
@@ -961,7 +1035,7 @@ static void node_shader_buts_mapping(uiLayout *layout, bContext *UNUSED(C), Poin
 	
 	uiItemL(layout, "Location:", ICON_NONE);
 	row= uiLayoutRow(layout, 1);
-	uiItemR(row, ptr, "location", 0, "", ICON_NONE);
+	uiItemR(row, ptr, "translation", 0, "", ICON_NONE);
 	
 	uiItemL(layout, "Rotation:", ICON_NONE);
 	row= uiLayoutRow(layout, 1);
@@ -992,7 +1066,7 @@ static void node_shader_buts_geometry(uiLayout *layout, bContext *C, PointerRNA
 
 	col= uiLayoutColumn(layout, 0);
 
-	if(obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
+	if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) {
 		PointerRNA dataptr= RNA_pointer_get(&obptr, "data");
 
 		uiItemPointerR(col, ptr, "uv_layer", &dataptr, "uv_textures", "", ICON_NONE);
@@ -1015,6 +1089,14 @@ static void node_shader_buts_tex_image(uiLayout *layout, bContext *C, PointerRNA
 	uiItemR(layout, ptr, "color_space", 0, "", ICON_NONE);
 }
 
+
+static void node_shader_buts_tex_environment(uiLayout *layout, bContext *C, PointerRNA *ptr)
+{
+	uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL);
+	uiItemR(layout, ptr, "color_space", 0, "", ICON_NONE);
+	uiItemR(layout, ptr, "projection", 0, "", ICON_NONE);
+}
+
 static void node_shader_buts_tex_sky(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
 {
 	uiItemR(layout, ptr, "sun_direction", 0, "", ICON_NONE);
@@ -1064,7 +1146,7 @@ static void node_shader_buts_dynamic(uiLayout *layout, bContext *C, PointerRNA *
 	int xoff=0;
 
 	/* B_NODE_EXEC is handled in butspace.c do_node_buts */
-	if(!node->id) {
+	if (!node->id) {
 			const char *strp;
 			IDnames_to_pupstring(&strp, NULL, "", &(bmain->text), NULL, NULL);
 			node->menunr= 0;
@@ -1073,7 +1155,7 @@ static void node_shader_buts_dynamic(uiLayout *layout, bContext *C, PointerRNA *
 							&node->menunr, 0, 0, 0, 0, "Browses existing choices");
 			uiButSetFunc(bt, node_browse_text_cb, ntree, node);
 			xoff=19;
-			if(strp) MEM_freeN((void *)strp);
+			if (strp) MEM_freeN((void *)strp);
 	}
 	else {
 		bt = uiDefBut(block, BUT, B_NOP, "Update",
@@ -1147,7 +1229,7 @@ static void node_shader_set_butfunc(bNodeType *ntype)
 			ntype->uifunc= node_shader_buts_tex_image;
 			break;
 		case SH_NODE_TEX_ENVIRONMENT:
-			ntype->uifunc= node_shader_buts_tex_image;
+			ntype->uifunc= node_shader_buts_tex_environment;
 			break;
 		case SH_NODE_TEX_GRADIENT:
 			ntype->uifunc= node_shader_buts_tex_gradient;
@@ -1187,7 +1269,7 @@ static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA *
 	
 	uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL);
 	
-	if(!node->id) return;
+	if (!node->id) return;
 	
 	prop = RNA_struct_find_property(ptr, "image");
 	if (!prop || RNA_property_type(prop) != PROP_POINTER) return;
@@ -1199,7 +1281,7 @@ static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA *
 	
 	source= RNA_enum_get(&imaptr, "source");
 
-	if(source == IMA_SRC_SEQUENCE) {
+	if (source == IMA_SRC_SEQUENCE) {
 		/* don't use iuser->framenr directly because it may not be updated if auto-refresh is off */
 		Scene *scene= CTX_data_scene(C);
 		ImageUser *iuser= node->storage;
@@ -1239,7 +1321,7 @@ static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, Point
 
 	uiTemplateID(layout, C, ptr, "scene", NULL, NULL, NULL);
 	
-	if(!node->id) return;
+	if (!node->id) return;
 
 	col= uiLayoutColumn(layout, 0);
 	row = uiLayoutRow(col, 0);
@@ -1452,12 +1534,13 @@ static void node_composit_buts_crop(uiLayout *layout, bContext *UNUSED(C), Point
 	uiItemR(layout, ptr, "relative", 0, NULL, ICON_NONE);
 
 	col= uiLayoutColumn(layout, 1);
-	if (RNA_boolean_get(ptr, "relative")){
+	if (RNA_boolean_get(ptr, "relative")) {
 		uiItemR(col, ptr, "rel_min_x", 0, "Left", ICON_NONE);
 		uiItemR(col, ptr, "rel_max_x", 0, "Right", ICON_NONE);
 		uiItemR(col, ptr, "rel_min_y", 0, "Up", ICON_NONE);
 		uiItemR(col, ptr, "rel_max_y", 0, "Down", ICON_NONE);
-	} else {
+	}
+	else {
 		uiItemR(col, ptr, "min_x", 0, "Left", ICON_NONE);
 		uiItemR(col, ptr, "max_x", 0, "Right", ICON_NONE);
 		uiItemR(col, ptr, "min_y", 0, "Up", ICON_NONE);
@@ -1491,19 +1574,19 @@ static void node_composit_buts_map_value(uiLayout *layout, bContext *UNUSED(C),
 {
 	uiLayout *sub, *col;
 	
-	col =uiLayoutColumn(layout, 1);
+	col = uiLayoutColumn(layout, 1);
 	uiItemR(col, ptr, "offset", 0, NULL, ICON_NONE);
 	uiItemR(col, ptr, "size", 0, NULL, ICON_NONE);
 	
-	col =uiLayoutColumn(layout, 1);
+	col = uiLayoutColumn(layout, 1);
 	uiItemR(col, ptr, "use_min", 0, NULL, ICON_NONE);
-	sub =uiLayoutColumn(col, 0);
+	sub = uiLayoutColumn(col, 0);
 	uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_min"));
 	uiItemR(sub, ptr, "min", 0, "", ICON_NONE);
 	
-	col =uiLayoutColumn(layout, 1);
+	col = uiLayoutColumn(layout, 1);
 	uiItemR(col, ptr, "use_max", 0, NULL, ICON_NONE);
-	sub =uiLayoutColumn(col, 0);
+	sub = uiLayoutColumn(col, 0);
 	uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_max"));
 	uiItemR(sub, ptr, "max", 0, "", ICON_NONE);
 }
@@ -1512,7 +1595,7 @@ static void node_composit_buts_alphaover(uiLayout *layout, bContext *UNUSED(C),
 {	
 	uiLayout *col;
 	
-	col =uiLayoutColumn(layout, 1);
+	col = uiLayoutColumn(layout, 1);
 	uiItemR(col, ptr, "use_premultiply", 0, NULL, ICON_NONE);
 	uiItemR(col, ptr, "premul", 0, NULL, ICON_NONE);
 }
@@ -1521,7 +1604,7 @@ static void node_composit_buts_zcombine(uiLayout *layout, bContext *UNUSED(C), P
 {	
 	uiLayout *col;
 	
-	col =uiLayoutColumn(layout, 1);
+	col = uiLayoutColumn(layout, 1);
 	uiItemR(col, ptr, "use_alpha", 0, NULL, ICON_NONE);
 }
 
@@ -1530,7 +1613,7 @@ static void node_composit_buts_hue_sat(uiLayout *layout, bContext *UNUSED(C), Po
 {
 	uiLayout *col;
 	
-	col =uiLayoutColumn(layout, 0);
+	col = uiLayoutColumn(layout, 0);
 	uiItemR(col, ptr, "color_hue", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
 	uiItemR(col, ptr, "color_saturation", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
 	uiItemR(col, ptr, "color_value", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
@@ -1545,7 +1628,7 @@ static void node_composit_buts_diff_matte(uiLayout *layout, bContext *UNUSED(C),
 {
 	uiLayout *col;
 	
-	col =uiLayoutColumn(layout, 1);
+	col = uiLayoutColumn(layout, 1);
 	uiItemR(col, ptr, "tolerance", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
 	uiItemR(col, ptr, "falloff", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
 }
@@ -1554,7 +1637,7 @@ static void node_composit_buts_distance_matte(uiLayout *layout, bContext *UNUSED
 {
 	uiLayout *col;
 	
-	col =uiLayoutColumn(layout, 1);
+	col = uiLayoutColumn(layout, 1);
 	uiItemR(col, ptr, "tolerance", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
 	uiItemR(col, ptr, "falloff", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
 }
@@ -1564,13 +1647,13 @@ static void node_composit_buts_color_spill(uiLayout *layout, bContext *UNUSED(C)
 	uiLayout *row, *col;
 	
 	uiItemL(layout, "Despill Channel:", ICON_NONE);
-	row =uiLayoutRow(layout,0);
+	row = uiLayoutRow(layout,0);
 	uiItemR(row, ptr, "channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
 
 	col= uiLayoutColumn(layout, 0);
 	uiItemR(col, ptr, "limit_method", 0, NULL, ICON_NONE);
 
-	if(RNA_enum_get(ptr, "limit_method")==0) {
+	if (RNA_enum_get(ptr, "limit_method")==0) {
 		uiItemL(col, "Limiting Channel:", ICON_NONE);
 		row=uiLayoutRow(col,0);
 		uiItemR(row, ptr, "limit_channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
@@ -1622,10 +1705,10 @@ static void node_composit_buts_channel_matte(uiLayout *layout, bContext *UNUSED(
 	row= uiLayoutRow(col, 0);
 	uiItemR(row, ptr, "matte_channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
 
-	col =uiLayoutColumn(layout, 0);
+	col = uiLayoutColumn(layout, 0);
 
 	uiItemR(col, ptr, "limit_method", 0, NULL, ICON_NONE);
-	if(RNA_enum_get(ptr, "limit_method")==0) {
+	if (RNA_enum_get(ptr, "limit_method")==0) {
 		uiItemL(col, "Limiting Channel:", ICON_NONE);
 		row=uiLayoutRow(col,0);
 		uiItemR(row, ptr, "limit_channel", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
@@ -1657,20 +1740,55 @@ static void node_composit_buts_id_mask(uiLayout *layout, bContext *UNUSED(C), Po
 
 static void node_composit_buts_file_output(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
 {
-	bNode *node= ptr->data;
-	NodeImageFile *nif= node->storage;
-	PointerRNA imfptr;
-
-	uiLayout *row;
-
-	uiItemR(layout, ptr, "filepath", 0, "", ICON_NONE);
-
-	RNA_pointer_create(NULL, &RNA_ImageFormatSettings, &nif->im_format, &imfptr);
+	PointerRNA imfptr = RNA_pointer_get(ptr, "format");
+	int multilayer = (RNA_enum_get(&imfptr, "file_format") == R_IMF_IMTYPE_MULTILAYER);
+	
+	if (multilayer)
+		uiItemL(layout, "Path:", 0);
+	else
+		uiItemL(layout, "Base Path:", 0);
+	uiItemR(layout, ptr, "base_path", 0, "", ICON_NONE);
+}
+static void node_composit_buts_file_output_details(uiLayout *layout, bContext *C, PointerRNA *ptr)
+{
+	PointerRNA imfptr = RNA_pointer_get(ptr, "format");
+	PointerRNA active_input_ptr = RNA_pointer_get(ptr, "active_input");
+	int multilayer = (RNA_enum_get(&imfptr, "file_format") == R_IMF_IMTYPE_MULTILAYER);
+	
+	node_composit_buts_file_output(layout, C, ptr);
 	uiTemplateImageSettings(layout, &imfptr);
-
-	row= uiLayoutRow(layout, 1);
-	uiItemR(row, ptr, "frame_start", 0, "Start", ICON_NONE);
-	uiItemR(row, ptr, "frame_end", 0, "End", ICON_NONE);
+	
+	uiItemS(layout);
+	
+	uiItemO(layout, "Add Input", ICON_ZOOMIN, "NODE_OT_output_file_add_socket");
+	
+	uiTemplateList(layout, C, ptr, "inputs", ptr, "active_input_index", NULL, 0, 0, 0);
+	
+	if (active_input_ptr.data) {
+		uiLayout *row, *col;
+		
+		col = uiLayoutColumn(layout, 1);
+		if (multilayer)
+			uiItemL(col, "Layer Name:", 0);
+		else
+			uiItemL(col, "File Path:", 0);
+		row = uiLayoutRow(col, 0);
+		uiItemR(row, &active_input_ptr, "name", 0, "", 0);
+		uiItemFullO(row, "NODE_OT_output_file_remove_active_socket", "", ICON_X, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_R_ICON_ONLY);
+		
+		/* in multilayer format all socket format details are ignored */
+		if (!multilayer) {
+			imfptr = RNA_pointer_get(&active_input_ptr, "format");
+			
+			col = uiLayoutColumn(layout, 1);
+			uiItemL(col, "Format:", 0);
+			uiItemR(col, &active_input_ptr, "use_node_format", 0, NULL, 0);
+			
+			col= uiLayoutColumn(layout, 0);
+			uiLayoutSetActive(col, RNA_boolean_get(&active_input_ptr, "use_node_format")==0);
+			uiTemplateImageSettings(col, &imfptr);
+		}
+	}
 }
 
 static void node_composit_buts_scale(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
@@ -1726,7 +1844,8 @@ static void node_composit_buts_colorbalance(uiLayout *layout, bContext *UNUSED(C
 		row = uiLayoutRow(col, 0);
 		uiItemR(row, ptr, "gain", 0, NULL, ICON_NONE);
 
-	} else {
+	}
+	else {
 		
 		split = uiLayoutSplit(layout, 0, 0);
 		col = uiLayoutColumn(split, 0);
@@ -1760,7 +1879,8 @@ static void node_composit_buts_colorbalance_but(uiLayout *layout, bContext *UNUS
 
 		uiTemplateColorWheel(layout, ptr, "gain", 1, 1, 1, 1);
 		uiItemR(layout, ptr, "gain", 0, NULL, ICON_NONE);
-	} else {
+	}
+	else {
 		uiTemplateColorWheel(layout, ptr, "offset", 1, 1, 0, 1);
 		uiItemR(layout, ptr, "offset", 0, NULL, ICON_NONE);
 
@@ -1794,7 +1914,7 @@ static void node_composit_buts_stabilize2d(uiLayout *layout, bContext *C, Pointe
 
 	uiTemplateID(layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL);
 
-	if(!node->id)
+	if (!node->id)
 		return;
 
 	uiItemR(layout, ptr, "filter_type", 0, "", 0);
@@ -1811,7 +1931,7 @@ static void node_composit_buts_moviedistortion(uiLayout *layout, bContext *C, Po
 
 	uiTemplateID(layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL);
 
-	if(!node->id)
+	if (!node->id)
 		return;
 
 	uiItemR(layout, ptr, "distortion_type", 0, "", 0);
@@ -1907,6 +2027,7 @@ static void node_composit_set_butfunc(bNodeType *ntype)
 			break;
 		case CMP_NODE_OUTPUT_FILE:
 			ntype->uifunc= node_composit_buts_file_output;
+			ntype->uifuncbut= node_composit_buts_file_output_details;
 			break;
 		case CMP_NODE_DIFF_MATTE:
 			ntype->uifunc=node_composit_buts_diff_matte;
@@ -2076,7 +2197,7 @@ static void node_texture_buts_proc(uiLayout *layout, bContext *UNUSED(C), Pointe
 			break;
 		case TEX_VORONOI:
 			uiItemR(col, &tex_ptr, "distance_metric", 0, "", ICON_NONE);
-			if(tex->vn_distm == TEX_MINKOVSKY) {
+			if (tex->vn_distm == TEX_MINKOVSKY) {
 				uiItemR(col, &tex_ptr, "minkovsky_exponent", 0, NULL, ICON_NONE);
 			}
 			uiItemR(col, &tex_ptr, "color_mode", 0, "", ICON_NONE);
@@ -2098,7 +2219,7 @@ static void node_texture_buts_output(uiLayout *layout, bContext *UNUSED(C), Poin
 static void node_texture_set_butfunc(bNodeType *ntype)
 {
 	ntype->uifuncbut = NULL;
-	if( ntype->type >= TEX_NODE_PROC && ntype->type < TEX_NODE_PROC_MAX ) {
+	if ( ntype->type >= TEX_NODE_PROC && ntype->type < TEX_NODE_PROC_MAX ) {
 		ntype->uifunc = node_texture_buts_proc;
 	}
 	else switch(ntype->type) {
@@ -2211,11 +2332,11 @@ void ED_init_node_butfuncs(void)
 void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage)
 {
 	
-	if((snode->flag & SNODE_BACKDRAW) && snode->treetype==NTREE_COMPOSIT) {
+	if ((snode->flag & SNODE_BACKDRAW) && snode->treetype==NTREE_COMPOSIT) {
 		Image *ima= BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
 		void *lock;
 		ImBuf *ibuf= BKE_image_acquire_ibuf(ima, NULL, &lock);
-		if(ibuf) {
+		if (ibuf) {
 			float x, y; 
 			
 			glMatrixMode(GL_PROJECTION);
@@ -2224,7 +2345,7 @@ void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage)
 			glPushMatrix();
 
 			/* keep this, saves us from a version patch */
-			if(snode->zoom==0.0f) snode->zoom= 1.0f;
+			if (snode->zoom==0.0f) snode->zoom= 1.0f;
 			
 			/* somehow the offset has to be calculated inverse */
 			
@@ -2235,26 +2356,27 @@ void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage)
 			x = (ar->winx-snode->zoom*ibuf->x)/2 + snode->xof;
 			y = (ar->winy-snode->zoom*ibuf->y)/2 + snode->yof;
 			
-			if(!ibuf->rect) {
-				if(color_manage)
+			if (!ibuf->rect) {
+				if (color_manage)
 					ibuf->profile = IB_PROFILE_LINEAR_RGB;
 				else
 					ibuf->profile = IB_PROFILE_NONE;
 				IMB_rect_from_float(ibuf);
 			}
 
-			if(ibuf->rect) {
+			if (ibuf->rect) {
 				if (snode->flag & SNODE_SHOW_ALPHA) {
 					glPixelZoom(snode->zoom, snode->zoom);
 					/* swap bytes, so alpha is most significant one, then just draw it as luminance int */
-					if(ENDIAN_ORDER == B_ENDIAN)
+					if (ENDIAN_ORDER == B_ENDIAN)
 						glPixelStorei(GL_UNPACK_SWAP_BYTES, 1);
 					
 					glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_LUMINANCE, GL_UNSIGNED_INT, ibuf->rect);
 					
 					glPixelStorei(GL_UNPACK_SWAP_BYTES, 0);
 					glPixelZoom(1.0f, 1.0f);
-				} else if (snode->flag & SNODE_USE_ALPHA) {
+				}
+				else if (snode->flag & SNODE_USE_ALPHA) {
 					glEnable(GL_BLEND);
 					glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 					glPixelZoom(snode->zoom, snode->zoom);
@@ -2263,7 +2385,8 @@ void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage)
 					
 					glPixelZoom(1.0f, 1.0f);
 					glDisable(GL_BLEND);
-				} else {
+				}
+				else {
 					glPixelZoom(snode->zoom, snode->zoom);
 					
 					glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
@@ -2289,10 +2412,10 @@ static void draw_nodespace_back_tex(ScrArea *sa, SpaceNode *snode)
 
 	draw_nodespace_grid(snode);
 	
-	if(snode->flag & SNODE_BACKDRAW) {
+	if (snode->flag & SNODE_BACKDRAW) {
 		Image *ima= BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
 		ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
-		if(ibuf) {
+		if (ibuf) {
 			int x, y;
 			float zoom = 1.0;
 
@@ -2303,7 +2426,7 @@ static void draw_nodespace_back_tex(ScrArea *sa, SpaceNode *snode)
 			
 			glaDefine2DArea(&sa->winrct);
 
-			if(ibuf->x > sa->winx || ibuf->y > sa->winy) {
+			if (ibuf->x > sa->winx || ibuf->y > sa->winy) {
 				float zoomx, zoomy;
 				zoomx= (float)sa->winx/ibuf->x;
 				zoomy= (float)sa->winy/ibuf->y;
@@ -2316,9 +2439,9 @@ static void draw_nodespace_back_tex(ScrArea *sa, SpaceNode *snode)
 			glPixelZoom(zoom, zoom);
 
 			glColor4f(1.0, 1.0, 1.0, 1.0);
-			if(ibuf->rect)
+			if (ibuf->rect)
 				glaDrawPixelsTex(x, y, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, ibuf->rect);
-			else if(ibuf->channels==4)
+			else if (ibuf->channels==4)
 				glaDrawPixelsTex(x, y, ibuf->x, ibuf->y, GL_FLOAT, ibuf->rect_float);
 
 			glPixelZoom(1.0, 1.0);
@@ -2338,21 +2461,21 @@ int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, floa
 	float dist, vec[4][2];
 	
 	/* in v0 and v3 we put begin/end points */
-	if(link->fromsock) {
+	if (link->fromsock) {
 		vec[0][0]= link->fromsock->locx;
 		vec[0][1]= link->fromsock->locy;
 	}
 	else {
-		if(snode==NULL) return 0;
+		if (snode==NULL) return 0;
 		vec[0][0]= snode->mx;
 		vec[0][1]= snode->my;
 	}
-	if(link->tosock) {
+	if (link->tosock) {
 		vec[3][0]= link->tosock->locx;
 		vec[3][1]= link->tosock->locy;
 	}
 	else {
-		if(snode==NULL) return 0;
+		if (snode==NULL) return 0;
 		vec[3][0]= snode->mx;
 		vec[3][1]= snode->my;
 	}
@@ -2366,7 +2489,7 @@ int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, floa
 	vec[2][0]= vec[3][0]-dist;
 	vec[2][1]= vec[3][1];
 	
-	if(v2d && MIN4(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) > v2d->cur.xmax); /* clipped */	
+	if (v2d && MIN4(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) > v2d->cur.xmax); /* clipped */
 	else if (v2d && MAX4(vec[0][0], vec[1][0], vec[2][0], vec[3][0]) < v2d->cur.xmin); /* clipped */
 	else {
 		
@@ -2384,7 +2507,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int t
 {
 	float coord_array[LINK_RESOL+1][2];
 	
-	if(node_link_bezier_points(v2d, snode, link, coord_array, LINK_RESOL)) {
+	if (node_link_bezier_points(v2d, snode, link, coord_array, LINK_RESOL)) {
 		float dist, spline_step = 0.0f;
 		int i;
 		
@@ -2397,12 +2520,12 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int t
 		
 		glEnable(GL_LINE_SMOOTH);
 		
-		if(do_triple) {
+		if (do_triple) {
 			UI_ThemeColorShadeAlpha(th_col3, -80, -120);
 			glLineWidth(4.0f);
 			
 			glBegin(GL_LINE_STRIP);
-			for(i=0; i<=LINK_RESOL; i++) {
+			for (i=0; i<=LINK_RESOL; i++) {
 				glVertex2fv(coord_array[i]);
 			}
 			glEnd();
@@ -2413,9 +2536,9 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int t
 		 * changing color in begin/end blocks.
 		 */
 		glLineWidth(1.5f);
-		if(do_shaded) {
+		if (do_shaded) {
 			glBegin(GL_LINES);
-			for(i=0; i<LINK_RESOL; i++) {
+			for (i=0; i<LINK_RESOL; i++) {
 				UI_ThemeColorBlend(th_col1, th_col2, spline_step);
 				glVertex2fv(coord_array[i]);
 				
@@ -2429,7 +2552,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int t
 		else {
 			UI_ThemeColor(th_col1);
 			glBegin(GL_LINE_STRIP);
-			for(i=0; i<=LINK_RESOL; i++) {
+			for (i=0; i<=LINK_RESOL; i++) {
 				glVertex2fv(coord_array[i]);
 			}
 			glEnd();
@@ -2444,21 +2567,21 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int t
 
 static void node_link_straight_points(View2D *UNUSED(v2d), SpaceNode *snode, bNodeLink *link, float coord_array[][2])
 {
-	if(link->fromsock) {
+	if (link->fromsock) {
 		coord_array[0][0]= link->fromsock->locx;
 		coord_array[0][1]= link->fromsock->locy;
 	}
 	else {
-		if(snode==NULL) return;
+		if (snode==NULL) return;
 		coord_array[0][0]= snode->mx;
 		coord_array[0][1]= snode->my;
 	}
-	if(link->tosock) {
+	if (link->tosock) {
 		coord_array[1][0]= link->tosock->locx;
 		coord_array[1][1]= link->tosock->locy;
 	}
 	else {
-		if(snode==NULL) return;
+		if (snode==NULL) return;
 		coord_array[1][0]= snode->mx;
 		coord_array[1][1]= snode->my;
 	}
@@ -2477,7 +2600,7 @@ void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link, int
 	
 	glEnable(GL_LINE_SMOOTH);
 	
-	if(do_triple) {
+	if (do_triple) {
 		UI_ThemeColorShadeAlpha(th_col3, -80, -120);
 		glLineWidth(4.0f);
 		
@@ -2494,7 +2617,7 @@ void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link, int
 	 * for Intel hardware, this breaks with GL_LINE_STRIP and
 	 * changing color in begin/end blocks.
 	 */
-	if(do_shaded) {
+	if (do_shaded) {
 		glBegin(GL_LINES);
 		for (i=0; i < LINK_RESOL-1; ++i) {
 			float t= (float)i/(float)(LINK_RESOL-1);
@@ -2528,38 +2651,38 @@ void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link)
 	int do_shaded= 0, th_col1= TH_HEADER, th_col2= TH_HEADER;
 	int do_triple= 0, th_col3= TH_WIRE;
 	
-	if(link->fromsock==NULL && link->tosock==NULL)
+	if (link->fromsock==NULL && link->tosock==NULL)
 		return;
 	
 	/* new connection */
-	if(!link->fromsock || !link->tosock) {
+	if (!link->fromsock || !link->tosock) {
 		th_col1 = TH_ACTIVE;
 		do_triple = 1;
 	}
 	else {
 		/* going to give issues once... */
-		if(link->tosock->flag & SOCK_UNAVAIL)
+		if (link->tosock->flag & SOCK_UNAVAIL)
 			return;
-		if(link->fromsock->flag & SOCK_UNAVAIL)
+		if (link->fromsock->flag & SOCK_UNAVAIL)
 			return;
 		
 		/* a bit ugly... but thats how we detect the internal group links */
-		if(!link->fromnode || !link->tonode) {
+		if (!link->fromnode || !link->tonode) {
 			UI_ThemeColorBlend(TH_BACK, TH_WIRE, 0.5f);
 			do_shaded= 0;
 		}
 		else {
 			/* check cyclic */
-			if((link->fromnode->level >= link->tonode->level && link->tonode->level!=0xFFF) && (link->flag & NODE_LINK_VALID)) {
+			if ((link->fromnode->level >= link->tonode->level && link->tonode->level!=0xFFF) && (link->flag & NODE_LINK_VALID)) {
 				/* special indicated link, on drop-node */
-				if(link->flag & NODE_LINKFLAG_HILITE) {
+				if (link->flag & NODE_LINKFLAG_HILITE) {
 					th_col1= th_col2= TH_ACTIVE;
 				}
 				else {
 					/* regular link */
-					if(link->fromnode->flag & SELECT)
+					if (link->fromnode->flag & SELECT)
 						th_col1= TH_EDGE_SELECT;
-					if(link->tonode->flag & SELECT)
+					if (link->tonode->flag & SELECT)
 						th_col2= TH_EDGE_SELECT;
 				}
 				do_shaded= 1;
diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c
index 1b5f241..f7d5179 100644
--- a/source/blender/editors/space_node/node_buttons.c
+++ b/source/blender/editors/space_node/node_buttons.c
@@ -44,6 +44,8 @@
 #include "BLI_rand.h"
 #include "BLI_utildefines.h"
 
+#include "BLF_translation.h"
+
 #include "BKE_context.h"
 #include "BKE_global.h"
 #include "BKE_node.h"
@@ -64,18 +66,13 @@
 
 
 /* ******************* node space & buttons ************** */
-#define B_NOP		1
-#define B_REDR		2
 
-static void do_node_region_buttons(bContext *C, void *UNUSED(arg), int event)
+/* poll for active nodetree */
+static int active_nodetree_poll(const bContext *C, PanelType *UNUSED(pt))
 {
-	//SpaceNode *snode= CTX_wm_space_node(C);
+	SpaceNode *snode= CTX_wm_space_node(C);
 	
-	switch(event) {
-	case B_REDR:
-		ED_area_tag_redraw(CTX_wm_area(C));
-		return; /* no notifier! */
-	}
+	return (snode && snode->nodetree);
 }
 
 /* poll callback for active node */
@@ -83,8 +80,7 @@ static int active_node_poll(const bContext *C, PanelType *UNUSED(pt))
 {
 	SpaceNode *snode= CTX_wm_space_node(C);
 	
-	// TODO: include check for whether there is an active node...
-	return (snode && snode->nodetree);
+	return (snode && snode->edittree && nodeGetActive(snode->edittree));
 }
 
 /* active node */
@@ -94,22 +90,16 @@ static void active_node_panel(const bContext *C, Panel *pa)
 	bNodeTree *ntree= (snode) ? snode->edittree : NULL;
 	bNode *node = (ntree) ? nodeGetActive(ntree) : NULL; // xxx... for editing group nodes
 	uiLayout *layout= pa->layout;
-	uiBlock *block;
 	PointerRNA ptr;
 	
 	/* verify pointers, and create RNA pointer for the node */
-	if ELEM(NULL, ntree, node)
+	if (ELEM(NULL, ntree, node))
 		return;
 	//if (node->id) /* for group nodes */
 	//	RNA_pointer_create(node->id, &RNA_Node, node, &ptr);
 	//else
 		RNA_pointer_create(&ntree->id, &RNA_Node, node, &ptr); 
 	
-	/* set update callback */
-	// xxx is this really needed
-	block= uiLayoutGetBlock(layout);
-	uiBlockSetHandleFunc(block, do_node_region_buttons, NULL);
-	
 	/* draw this node's name, etc. */
 	uiItemR(layout, &ptr, "label", 0, NULL, ICON_NODE);
 	uiItemS(layout);
@@ -142,10 +132,10 @@ static void node_sockets_panel(const bContext *C, Panel *pa)
 	uiLayout *layout= pa->layout, *split;
 	char name[UI_MAX_NAME_STR];
 	
-	if(ELEM(NULL, ntree, node))
+	if (ELEM(NULL, ntree, node))
 		return;
 	
-	for(sock=node->inputs.first; sock; sock=sock->next) {
+	for (sock=node->inputs.first; sock; sock=sock->next) {
 		BLI_snprintf(name, sizeof(name), "%s:", sock->name);
 
 		split = uiLayoutSplit(layout, 0.35f, 0);
@@ -162,7 +152,7 @@ void node_buttons_register(ARegionType *art)
 	
 	pt= MEM_callocN(sizeof(PanelType), "spacetype node panel active node");
 	strcpy(pt->idname, "NODE_PT_item");
-	strcpy(pt->label, "Active Node");
+	strcpy(pt->label, IFACE_("Active Node"));
 	pt->draw= active_node_panel;
 	pt->poll= active_node_poll;
 	BLI_addtail(&art->paneltypes, pt);
@@ -179,6 +169,7 @@ void node_buttons_register(ARegionType *art)
 	strcpy(pt->idname, "NODE_PT_gpencil");
 	strcpy(pt->label, "Grease Pencil");
 	pt->draw= gpencil_panel_standard;
+	pt->poll= active_nodetree_poll;
 	BLI_addtail(&art->paneltypes, pt);
 }
 
@@ -187,7 +178,7 @@ static int node_properties(bContext *C, wmOperator *UNUSED(op))
 	ScrArea *sa= CTX_wm_area(C);
 	ARegion *ar= node_has_buttons_region(sa);
 	
-	if(ar)
+	if (ar)
 		ED_region_toggle_hidden(C, ar);
 
 	return OPERATOR_FINISHED;
@@ -202,13 +193,13 @@ static int node_properties_poll(bContext *C)
 
 void NODE_OT_properties(wmOperatorType *ot)
 {
-	ot->name= "Properties";
-	ot->description= "Toggles the properties panel display";
-	ot->idname= "NODE_OT_properties";
+	ot->name = "Properties";
+	ot->description = "Toggles the properties panel display";
+	ot->idname = "NODE_OT_properties";
 	
-	ot->exec= node_properties;
-	ot->poll= node_properties_poll;
+	ot->exec = node_properties;
+	ot->poll = node_properties_poll;
 	
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 }
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index a82ea9e..040f921 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -49,6 +49,8 @@
 #include "BLI_threads.h"
 #include "BLI_utildefines.h"
 
+#include "BLF_translation.h"
+
 #include "BKE_context.h"
 #include "BKE_depsgraph.h"
 #include "BKE_main.h"
@@ -88,7 +90,7 @@ void ED_node_tree_update(SpaceNode *snode, Scene *scene)
 {
 	snode_set_context(snode, scene);
 	
-	if(snode->nodetree && snode->nodetree->id.us==0)
+	if (snode->nodetree && snode->nodetree->id.us==0)
 		snode->nodetree->id.us= 1;
 }
 
@@ -99,28 +101,28 @@ void ED_node_changed_update(ID *id, bNode *node)
 
 	node_tree_from_ID(id, &nodetree, &edittree, &treetype);
 
-	if(treetype==NTREE_SHADER) {
+	if (treetype==NTREE_SHADER) {
 		DAG_id_tag_update(id, 0);
 
-		if(GS(id->name) == ID_MA)
+		if (GS(id->name) == ID_MA)
 			WM_main_add_notifier(NC_MATERIAL|ND_SHADING_DRAW, id);
-		else if(GS(id->name) == ID_LA)
+		else if (GS(id->name) == ID_LA)
 			WM_main_add_notifier(NC_LAMP|ND_LIGHTING_DRAW, id);
-		else if(GS(id->name) == ID_WO)
+		else if (GS(id->name) == ID_WO)
 			WM_main_add_notifier(NC_WORLD|ND_WORLD_DRAW, id);
 	}
-	else if(treetype==NTREE_COMPOSIT) {
-		if(node)
+	else if (treetype==NTREE_COMPOSIT) {
+		if (node)
 			nodeUpdate(edittree, node);
 		/* don't use NodeTagIDChanged, it gives far too many recomposites for image, scene layers, ... */
 			
 		node= node_tree_get_editgroup(nodetree);
-		if(node)
+		if (node)
 			nodeUpdateID(nodetree, node->id);
 
 		WM_main_add_notifier(NC_SCENE|ND_NODES, id);
 	}			
-	else if(treetype==NTREE_TEXTURE) {
+	else if (treetype==NTREE_TEXTURE) {
 		DAG_id_tag_update(id, 0);
 		WM_main_add_notifier(NC_TEXTURE|ND_NODES, id);
 	}
@@ -130,12 +132,12 @@ static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup)
 {
 	bNode *node;
 	
-	if(ntree == lookup)
+	if (ntree == lookup)
 		return 1;
 	
-	for(node=ntree->nodes.first; node; node=node->next)
-		if(node->type == NODE_GROUP && node->id)
-			if(has_nodetree((bNodeTree*)node->id, lookup))
+	for (node=ntree->nodes.first; node; node=node->next)
+		if (node->type == NODE_GROUP && node->id)
+			if (has_nodetree((bNodeTree*)node->id, lookup))
 				return 1;
 	
 	return 0;
@@ -161,15 +163,15 @@ void ED_node_generic_update(Main *bmain, bNodeTree *ntree, bNode *node)
 	/* look through all datablocks, to support groups */
 	tti->foreach_nodetree(bmain, &cd, node_generic_update_cb);
 	
-	if(ntree->type == NTREE_TEXTURE)
+	if (ntree->type == NTREE_TEXTURE)
 		ntreeTexCheckCyclics(ntree);
 }
 
 static void do_node_internal_buttons(bContext *C, void *node_v, int event)
 {
-	if(event==B_NODE_EXEC) {
+	if (event==B_NODE_EXEC) {
 		SpaceNode *snode= CTX_wm_space_node(C);
-		if(snode && snode->id)
+		if (snode && snode->id)
 			ED_node_changed_update(snode->id, node_v);
 	}
 }
@@ -228,41 +230,41 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
 	dy-= NODE_DY;
 	
 	/* little bit space in top */
-	if(node->outputs.first)
+	if (node->outputs.first)
 		dy-= NODE_DYS/2;
 
 	/* output sockets */
-	for(nsock= node->outputs.first; nsock; nsock= nsock->next) {
-		if(!nodeSocketIsHidden(nsock)) {
+	for (nsock= node->outputs.first; nsock; nsock= nsock->next) {
+		if (!nodeSocketIsHidden(nsock)) {
 			nsock->locx= locx + node->width;
 			nsock->locy= dy - NODE_DYS;
 			dy-= NODE_DY;
 		}
 	}
 
-	node->prvr.xmin= locx + NODE_DYS;
-	node->prvr.xmax= locx + node->width- NODE_DYS;
+	node->prvr.xmin = locx + NODE_DYS;
+	node->prvr.xmax = locx + node->width- NODE_DYS;
 
 	/* preview rect? */
-	if(node->flag & NODE_PREVIEW) {
+	if (node->flag & NODE_PREVIEW) {
 		/* only recalculate size when there's a preview actually, otherwise we use stored result */
 		BLI_lock_thread(LOCK_PREVIEW);
 
-		if(node->preview && node->preview->rect) {
+		if (node->preview && node->preview->rect) {
 			float aspect= 1.0f;
 			
-			if(node->preview && node->preview->xsize && node->preview->ysize) 
+			if (node->preview && node->preview->xsize && node->preview->ysize) 
 				aspect= (float)node->preview->ysize/(float)node->preview->xsize;
 			
 			dy-= NODE_DYS/2;
-			node->prvr.ymax= dy;
+			node->prvr.ymax = dy;
 			
-			if(aspect <= 1.0f)
-				node->prvr.ymin= dy - aspect*(node->width-NODE_DY);
+			if (aspect <= 1.0f)
+				node->prvr.ymin = dy - aspect*(node->width-NODE_DY);
 			else {
 				float dx= (node->width - NODE_DYS) - (node->width- NODE_DYS)/aspect;	/* width correction of image */
 				
-				node->prvr.ymin= dy - (node->width-NODE_DY);
+				node->prvr.ymin = dy - (node->width-NODE_DY);
 				
 				node->prvr.xmin+= 0.5f*dx;
 				node->prvr.xmax-= 0.5f*dx;
@@ -271,16 +273,16 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
 			dy= node->prvr.ymin - NODE_DYS/2;
 
 			/* make sure that maximums are bigger or equal to minimums */
-			if(node->prvr.xmax < node->prvr.xmin) SWAP(float, node->prvr.xmax, node->prvr.xmin);
-			if(node->prvr.ymax < node->prvr.ymin) SWAP(float, node->prvr.ymax, node->prvr.ymin);
+			if (node->prvr.xmax < node->prvr.xmin) SWAP(float, node->prvr.xmax, node->prvr.xmin);
+			if (node->prvr.ymax < node->prvr.ymin) SWAP(float, node->prvr.ymax, node->prvr.ymin);
 		}
 		else {
 			float oldh= node->prvr.ymax - node->prvr.ymin;
-			if(oldh==0.0f)
+			if (oldh==0.0f)
 				oldh= 0.6f*node->width-NODE_DY;
 			dy-= NODE_DYS/2;
-			node->prvr.ymax= dy;
-			node->prvr.ymin= dy - oldh;
+			node->prvr.ymax = dy;
+			node->prvr.ymin = dy - oldh;
 			dy= node->prvr.ymin - NODE_DYS/2;
 		}
 
@@ -288,14 +290,14 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
 	}
 
 	/* buttons rect? */
-	if((node->flag & NODE_OPTIONS) && node->typeinfo->uifunc) {
+	if ((node->flag & NODE_OPTIONS) && node->typeinfo->uifunc) {
 		dy-= NODE_DYS/2;
 
 		/* set this for uifunc() that don't use layout engine yet */
-		node->butr.xmin= 0;
-		node->butr.xmax= node->width - 2*NODE_DYS;
-		node->butr.ymin= 0;
-		node->butr.ymax= 0;
+		node->butr.xmin = 0;
+		node->butr.xmax = node->width - 2*NODE_DYS;
+		node->butr.ymin = 0;
+		node->butr.ymax = 0;
 		
 		RNA_pointer_create(&ntree->id, &RNA_Node, node, &ptr);
 		
@@ -311,8 +313,8 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
 	}
 
 	/* input sockets */
-	for(nsock= node->inputs.first; nsock; nsock= nsock->next) {
-		if(!nodeSocketIsHidden(nsock)) {
+	for (nsock= node->inputs.first; nsock; nsock= nsock->next) {
+		if (!nodeSocketIsHidden(nsock)) {
 			nsock->locx= locx;
 			nsock->locy= dy - NODE_DYS;
 			dy-= NODE_DY;
@@ -320,13 +322,13 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
 	}
 	
 	/* little bit space in end */
-	if(node->inputs.first || (node->flag & (NODE_OPTIONS|NODE_PREVIEW))==0 )
+	if (node->inputs.first || (node->flag & (NODE_OPTIONS|NODE_PREVIEW))==0 )
 		dy-= NODE_DYS/2;
 
-	node->totr.xmin= locx;
-	node->totr.xmax= locx + node->width;
-	node->totr.ymax= locy;
-	node->totr.ymin= MIN2(dy, locy-2*NODE_DY);
+	node->totr.xmin = locx;
+	node->totr.xmax = locx + node->width;
+	node->totr.ymax = locy;
+	node->totr.ymin = MIN2(dy, locy-2*NODE_DY);
 	
 	/* Set the block bounds to clip mouse events from underlying nodes.
 	 * Add a margin for sockets on each side.
@@ -350,28 +352,28 @@ static void node_update_hidden(bNode *node)
 	nodeSpaceCoords(node, &locx, &locy);
 
 	/* calculate minimal radius */
-	for(nsock= node->inputs.first; nsock; nsock= nsock->next)
-		if(!nodeSocketIsHidden(nsock))
+	for (nsock= node->inputs.first; nsock; nsock= nsock->next)
+		if (!nodeSocketIsHidden(nsock))
 			totin++;
-	for(nsock= node->outputs.first; nsock; nsock= nsock->next)
-		if(!nodeSocketIsHidden(nsock))
+	for (nsock= node->outputs.first; nsock; nsock= nsock->next)
+		if (!nodeSocketIsHidden(nsock))
 			totout++;
 	
 	tot= MAX2(totin, totout);
-	if(tot>4) {
+	if (tot>4) {
 		hiddenrad += 5.0f*(float)(tot-4);
 	}
 	
-	node->totr.xmin= locx;
-	node->totr.xmax= locx + 3*hiddenrad + node->miniwidth;
-	node->totr.ymax= locy + (hiddenrad - 0.5f*NODE_DY);
-	node->totr.ymin= node->totr.ymax - 2*hiddenrad;
+	node->totr.xmin = locx;
+	node->totr.xmax = locx + 3*hiddenrad + node->miniwidth;
+	node->totr.ymax = locy + (hiddenrad - 0.5f*NODE_DY);
+	node->totr.ymin = node->totr.ymax - 2*hiddenrad;
 	
 	/* output sockets */
 	rad=drad= (float)M_PI/(1.0f + (float)totout);
 	
-	for(nsock= node->outputs.first; nsock; nsock= nsock->next) {
-		if(!nodeSocketIsHidden(nsock)) {
+	for (nsock= node->outputs.first; nsock; nsock= nsock->next) {
+		if (!nodeSocketIsHidden(nsock)) {
 			nsock->locx= node->totr.xmax - hiddenrad + (float)sin(rad)*hiddenrad;
 			nsock->locy= node->totr.ymin + hiddenrad + (float)cos(rad)*hiddenrad;
 			rad+= drad;
@@ -381,8 +383,8 @@ static void node_update_hidden(bNode *node)
 	/* input sockets */
 	rad=drad= - (float)M_PI/(1.0f + (float)totin);
 	
-	for(nsock= node->inputs.first; nsock; nsock= nsock->next) {
-		if(!nodeSocketIsHidden(nsock)) {
+	for (nsock= node->inputs.first; nsock; nsock= nsock->next) {
+		if (!nodeSocketIsHidden(nsock)) {
 			nsock->locx= node->totr.xmin + hiddenrad + (float)sin(rad)*hiddenrad;
 			nsock->locy= node->totr.ymin + hiddenrad + (float)cos(rad)*hiddenrad;
 			rad+= drad;
@@ -401,7 +403,7 @@ static void node_update_hidden(bNode *node)
 
 void node_update_default(const bContext *C, bNodeTree *ntree, bNode *node)
 {
-	if(node->flag & NODE_HIDDEN)
+	if (node->flag & NODE_HIDDEN)
 		node_update_hidden(node);
 	else
 		node_update_basis(C, ntree, node);
@@ -409,19 +411,19 @@ void node_update_default(const bContext *C, bNodeTree *ntree, bNode *node)
 
 static int node_get_colorid(bNode *node)
 {
-	if(node->typeinfo->nclass==NODE_CLASS_INPUT)
+	if (node->typeinfo->nclass==NODE_CLASS_INPUT)
 		return TH_NODE_IN_OUT;
-	if(node->typeinfo->nclass==NODE_CLASS_OUTPUT) {
-		if(node->flag & NODE_DO_OUTPUT)
+	if (node->typeinfo->nclass==NODE_CLASS_OUTPUT) {
+		if (node->flag & NODE_DO_OUTPUT)
 			return TH_NODE_IN_OUT;
 		else
 			return TH_NODE;
 	}
-	if(node->typeinfo->nclass==NODE_CLASS_CONVERTOR)
+	if (node->typeinfo->nclass==NODE_CLASS_CONVERTOR)
 		return TH_NODE_CONVERTOR;
-	if(ELEM3(node->typeinfo->nclass, NODE_CLASS_OP_COLOR, NODE_CLASS_OP_VECTOR, NODE_CLASS_OP_FILTER))
+	if (ELEM3(node->typeinfo->nclass, NODE_CLASS_OP_COLOR, NODE_CLASS_OP_VECTOR, NODE_CLASS_OP_FILTER))
 		return TH_NODE_OPERATOR;
-	if(node->typeinfo->nclass==NODE_CLASS_GROUP)
+	if (node->typeinfo->nclass==NODE_CLASS_GROUP)
 		return TH_NODE_GROUP;
 	return TH_NODE;
 }
@@ -432,30 +434,19 @@ static int node_get_colorid(bNode *node)
 static void node_draw_mute_line(View2D *v2d, SpaceNode *snode, bNode *node)
 {
 	ListBase links;
-	LinkInOutsMuteNode *lnk;
-	bNodeLink link= {NULL};
-	int i;
+	bNodeLink *link;
 
-	if(node->typeinfo->mutelinksfunc == NULL)
+	if (node->typeinfo->internal_connect == NULL)
 		return;
 
-	/* Get default muting links (as bNodeSocket pointers). */
-	links = node->typeinfo->mutelinksfunc(snode->edittree, node, NULL, NULL, NULL, NULL);
+	/* Get default muting links. */
+	links = node->typeinfo->internal_connect(snode->edittree, node);
 
 	glEnable(GL_BLEND);
 	glEnable(GL_LINE_SMOOTH);
 
-	link.fromnode = link.tonode = node;
-	for(lnk = links.first; lnk; lnk = lnk->next) {
-		for(i = 0; i < lnk->num_outs; i++) {
-			link.fromsock = (bNodeSocket*)(lnk->in);
-			link.tosock   = (bNodeSocket*)(lnk->outs)+i;
-			node_draw_link_bezier(v2d, snode, &link, TH_REDALERT, 0, TH_WIRE, 0, TH_WIRE);
-		}
-		/* If num_outs > 1, lnk->outs was an allocated table of pointers... */
-		if(i > 1)
-			MEM_freeN(lnk->outs);
-	}
+	for (link = 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);
@@ -464,7 +455,7 @@ static void node_draw_mute_line(View2D *v2d, SpaceNode *snode, bNode *node)
 }
 
 /* this might have some more generic use */
-static void node_circle_draw(float x, float y, float size, char *col)
+static void node_circle_draw(float x, float y, float size, char *col, int highlight)
 {
 	/* 16 values of sin function */
 	static float si[16] = {
@@ -485,25 +476,32 @@ static void node_circle_draw(float x, float y, float size, char *col)
 	glColor3ub(col[0], col[1], col[2]);
 	
 	glBegin(GL_POLYGON);
-	for(a=0; a<16; a++)
+	for (a=0; a<16; a++)
 		glVertex2f(x+size*si[a], y+size*co[a]);
 	glEnd();
 	
-	glColor4ub(0, 0, 0, 150);
+	if (highlight) {
+		UI_ThemeColor(TH_TEXT_HI);
+		glLineWidth(1.5f);
+	}
+	else {
+		glColor4ub(0, 0, 0, 150);
+	}
 	glEnable(GL_BLEND);
 	glEnable( GL_LINE_SMOOTH );
 	glBegin(GL_LINE_LOOP);
-	for(a=0; a<16; a++)
+	for (a=0; a<16; a++)
 		glVertex2f(x+size*si[a], y+size*co[a]);
 	glEnd();
 	glDisable( GL_LINE_SMOOTH );
 	glDisable(GL_BLEND);
+	glLineWidth(1.0f);
 }
 
 void node_socket_circle_draw(bNodeTree *UNUSED(ntree), bNodeSocket *sock, float size)
 {
 	bNodeSocketType *stype = ntreeGetSocketType(sock->type);
-	node_circle_draw(sock->locx, sock->locy, size, stype->ui_color);
+	node_circle_draw(sock->locx, sock->locy, size, stype->ui_color, (sock->flag & SELECT));
 }
 
 /* **************  Socket callbacks *********** */
@@ -521,25 +519,25 @@ static void node_draw_preview(bNodePreview *preview, rctf *prv)
 	glRectf(prv->xmin, prv->ymin, prv->xmax, prv->ymax);
 	glColor3ub(160, 160, 160);
 	
-	for(y=prv->ymin; y<prv->ymax; y+=tile*2) {
-		for(x=prv->xmin; x<prv->xmax; x+=tile*2) {
+	for (y=prv->ymin; y<prv->ymax; y+=tile*2) {
+		for (x=prv->xmin; x<prv->xmax; x+=tile*2) {
 			float tilex= tile, tiley= tile;
 
-			if(x+tile > prv->xmax)
+			if (x+tile > prv->xmax)
 				tilex= prv->xmax-x;
-			if(y+tile > prv->ymax)
+			if (y+tile > prv->ymax)
 				tiley= prv->ymax-y;
 
 			glRectf(x, y, x + tilex, y + tiley);
 		}
 	}
-	for(y=prv->ymin+tile; y<prv->ymax; y+=tile*2) {
-		for(x=prv->xmin+tile; x<prv->xmax; x+=tile*2) {
+	for (y=prv->ymin+tile; y<prv->ymax; y+=tile*2) {
+		for (x=prv->xmin+tile; x<prv->xmax; x+=tile*2) {
 			float tilex= tile, tiley= tile;
 
-			if(x+tile > prv->xmax)
+			if (x+tile > prv->xmax)
 				tilex= prv->xmax-x;
-			if(y+tile > prv->ymax)
+			if (y+tile > prv->ymax)
 				tiley= prv->ymax-y;
 
 			glRectf(x, y, x + tilex, y + tiley);
@@ -586,7 +584,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
 	View2D *v2d = &ar->v2d;
 	
 	/* hurmf... another candidate for callback, have to see how this works first */
-	if(node->id && node->block && snode->treetype==NTREE_SHADER)
+	if (node->id && node->block && snode->treetype==NTREE_SHADER)
 		nodeShaderSynchronizeID(node, 0);
 	
 	/* skip if out of view */
@@ -602,12 +600,12 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
 	ui_dropshadow(rct, BASIS_RAD, snode->aspect, node->flag & SELECT);
 	
 	/* header */
-	if(color_id==TH_NODE)
+	if (color_id==TH_NODE)
 		UI_ThemeColorShade(color_id, -20);
 	else
 		UI_ThemeColor(color_id);
 	
-	if(node->flag & NODE_MUTED)
+	if (node->flag & NODE_MUTED)
 		UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f);
 
 	uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
@@ -617,7 +615,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
 	iconofs= rct->xmax - 7.0f;
 	
 	/* preview */
-	if(node->typeinfo->flag & NODE_PREVIEW) {
+	if (node->typeinfo->flag & NODE_PREVIEW) {
 		uiBut *but;
 		iconofs-=iconbutw;
 		uiBlockSetEmboss(node->block, UI_EMBOSSN);
@@ -633,7 +631,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
 		uiBlockSetEmboss(node->block, UI_EMBOSS);
 	}
 	/* group edit */
-	if(node->type == NODE_GROUP) {
+	if (node->type == NODE_GROUP) {
 		uiBut *but;
 		iconofs-=iconbutw;
 		uiBlockSetEmboss(node->block, UI_EMBOSSN);
@@ -644,7 +642,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
 	}
 	
 	/* title */
-	if(node->flag & SELECT) 
+	if (node->flag & SELECT) 
 		UI_ThemeColor(TH_TEXT_HI);
 	else
 		UI_ThemeColorBlendShade(TH_TEXT, color_id, 0.4f, 10);
@@ -664,16 +662,18 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
 		UI_DrawTriIcon(rct->xmin+10.0f, rct->ymax-NODE_DY/2.0f, 'v');
 	}
 	
-	/* this isn't doing anything for the label, so commenting out
-	if(node->flag & SELECT) 
+	/* this isn't doing anything for the label, so commenting out */
+#if 0
+	if (node->flag & SELECT) 
 		UI_ThemeColor(TH_TEXT_HI);
 	else
-		UI_ThemeColor(TH_TEXT); */
+		UI_ThemeColor(TH_TEXT);
+#endif
 	
 	BLI_strncpy(showname, nodeLabel(node), sizeof(showname));
 	
-	//if(node->flag & NODE_MUTED)
-	//	BLI_snprintf(showname, sizeof(showname), "[%s]", showname); // XXX - dont print into self!
+	//if (node->flag & NODE_MUTED)
+	//	BLI_snprintf(showname, sizeof(showname), "[%s]", showname); // XXX - don't print into self!
 	
 	uiDefBut(node->block, LABEL, 0, showname, (short)(rct->xmin+15), (short)(rct->ymax-NODE_DY), 
 			 (int)(iconofs - rct->xmin-18.0f), NODE_DY,  NULL, 0, 0, 0, 0, "");
@@ -689,11 +689,11 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
 	node_scaling_widget(TH_NODE, snode->aspect, rct->xmax-BASIS_RAD*snode->aspect, rct->ymin, rct->xmax, rct->ymin+BASIS_RAD*snode->aspect);
 
 	/* outline active and selected emphasis */
-	if( node->flag & (NODE_ACTIVE|SELECT) ) {
+	if ( node->flag & (NODE_ACTIVE|SELECT) ) {
 		glEnable(GL_BLEND);
 		glEnable( GL_LINE_SMOOTH );
 			/* using different shades of TH_TEXT_HI for the empasis, like triangle */
-			if( node->flag & NODE_ACTIVE ) 
+			if ( node->flag & NODE_ACTIVE ) 
 				UI_ThemeColorShadeAlpha(TH_TEXT_HI, 0, -40);
 			else
 				UI_ThemeColorShadeAlpha(TH_TEXT_HI, -20, -120);
@@ -705,57 +705,53 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
 	}
 	
 	/* disable lines */
-	if(node->flag & NODE_MUTED)
+	if (node->flag & NODE_MUTED)
 		node_draw_mute_line(v2d, snode, node);
 
 	
 	/* socket inputs, buttons */
-	for(sock= node->inputs.first; sock; sock= sock->next) {
+	for (sock= node->inputs.first; sock; sock= sock->next) {
 		bNodeSocketType *stype= ntreeGetSocketType(sock->type);
 		
-		if(nodeSocketIsHidden(sock))
+		if (nodeSocketIsHidden(sock))
 			continue;
 		
 		node_socket_circle_draw(ntree, sock, NODE_SOCKSIZE);
 		
-		if (sock->link || (sock->flag & SOCK_HIDE_VALUE)) {
-			uiDefBut(node->block, LABEL, 0, sock->name, sock->locx+NODE_DYS, sock->locy-NODE_DYS, node->width-NODE_DY, NODE_DY,
-					 NULL, 0, 0, 0, 0, "");
-		}
-		else {
-			if (stype->buttonfunc)
-				stype->buttonfunc(C, node->block, ntree, node, sock, sock->name, sock->locx+NODE_DYS, sock->locy-NODE_DYS, node->width-NODE_DY);
-		}
+		if (stype->buttonfunc)
+			stype->buttonfunc(C, node->block, ntree, node, sock, IFACE_(sock->name), sock->locx+NODE_DYS, sock->locy-NODE_DYS, node->width-NODE_DY);
 	}
 	
 	/* socket outputs */
-	for(sock= node->outputs.first; sock; sock= sock->next) {
+	for (sock= node->outputs.first; sock; sock= sock->next) {
 		PointerRNA sockptr;
-		float slen;
-		int ofs;
 		
 		RNA_pointer_create((ID*)ntree, &RNA_NodeSocket, sock, &sockptr);
 		
-		if(nodeSocketIsHidden(sock))
+		if (nodeSocketIsHidden(sock))
 			continue;
 		
 		node_socket_circle_draw(ntree, sock, NODE_SOCKSIZE);
 		
-		ofs= 0;
-		UI_ThemeColor(TH_TEXT);
-		slen= snode->aspect*UI_GetStringWidth(sock->name);
-		while(slen > node->width) {
-			ofs++;
-			slen= snode->aspect*UI_GetStringWidth(sock->name+ofs);
+		{
+			const char *name = IFACE_(sock->name);
+			float slen;
+			int ofs = 0;
+			UI_ThemeColor(TH_TEXT);
+			slen= snode->aspect*UI_GetStringWidth(name);
+			while (slen > node->width) {
+				ofs++;
+				slen= snode->aspect*UI_GetStringWidth(name+ofs);
+			}
+			uiDefBut(node->block, LABEL, 0, name+ofs, (short)(sock->locx-15.0f-slen), (short)(sock->locy-9.0f), 
+					 (short)(node->width-NODE_DY), NODE_DY,  NULL, 0, 0, 0, 0, "");
 		}
-		uiDefBut(node->block, LABEL, 0, sock->name+ofs, (short)(sock->locx-15.0f-slen), (short)(sock->locy-9.0f), 
-				 (short)(node->width-NODE_DY), NODE_DY,  NULL, 0, 0, 0, 0, "");
 	}
 	
 	/* preview */
-	if(node->flag & NODE_PREVIEW) {
+	if (node->flag & NODE_PREVIEW) {
 		BLI_lock_thread(LOCK_PREVIEW);
-		if(node->preview && node->preview->rect && !BLI_rctf_is_empty(&node->prvr))
+		if (node->preview && node->preview->rect && !BLI_rctf_is_empty(&node->prvr))
 			node_draw_preview(node->preview, &node->prvr);
 		BLI_unlock_thread(LOCK_PREVIEW);
 	}
@@ -783,16 +779,16 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
 
 	/* body */
 	UI_ThemeColor(color_id);
-	if(node->flag & NODE_MUTED)
+	if (node->flag & NODE_MUTED)
 		UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f);
 	uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad);
 	
 	/* outline active and selected emphasis */
-	if( node->flag & (NODE_ACTIVE|SELECT) ) {
+	if ( node->flag & (NODE_ACTIVE|SELECT) ) {
 		glEnable(GL_BLEND);
 		glEnable( GL_LINE_SMOOTH );
 			/* using different shades of TH_TEXT_HI for the empasis, like triangle */
-			if( node->flag & NODE_ACTIVE ) 
+			if ( node->flag & NODE_ACTIVE ) 
 				UI_ThemeColorShadeAlpha(TH_TEXT_HI, 0, -40);
 			else
 				UI_ThemeColorShadeAlpha(TH_TEXT_HI, -20, -120);
@@ -802,7 +798,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
 	}
 	
 	/* title */
-	if(node->flag & SELECT) 
+	if (node->flag & SELECT) 
 		UI_ThemeColor(TH_TEXT_HI);
 	else
 		UI_ThemeColorBlendShade(TH_TEXT, color_id, 0.4f, 10);
@@ -823,19 +819,19 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
 	}
 	
 	/* disable lines */
-	if(node->flag & NODE_MUTED)
+	if (node->flag & NODE_MUTED)
 		node_draw_mute_line(&ar->v2d, snode, node);	
 	
-	if(node->flag & SELECT) 
+	if (node->flag & SELECT) 
 		UI_ThemeColor(TH_TEXT_HI);
 	else
 		UI_ThemeColor(TH_TEXT);
 	
-	if(node->miniwidth>0.0f) {
+	if (node->miniwidth>0.0f) {
 		BLI_strncpy(showname, nodeLabel(node), sizeof(showname));
 		
-		//if(node->flag & NODE_MUTED)
-		//	BLI_snprintf(showname, sizeof(showname), "[%s]", showname); // XXX - dont print into self!
+		//if (node->flag & NODE_MUTED)
+		//	BLI_snprintf(showname, sizeof(showname), "[%s]", showname); // XXX - don't print into self!
 
 		uiDefBut(node->block, LABEL, 0, showname, (short)(rct->xmin+15), (short)(centy-10), 
 				 (int)(rct->xmax - rct->xmin-18.0f -12.0f), NODE_DY,  NULL, 0, 0, 0, 0, "");
@@ -853,13 +849,13 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
 	fdrawline(rct->xmax-dx-3.0f*snode->aspect, centy-4.0f, rct->xmax-dx-3.0f*snode->aspect, centy+4.0f);
 	
 	/* sockets */
-	for(sock= node->inputs.first; sock; sock= sock->next) {
-		if(!nodeSocketIsHidden(sock))
+	for (sock= node->inputs.first; sock; sock= sock->next) {
+		if (!nodeSocketIsHidden(sock))
 			node_socket_circle_draw(snode->nodetree, sock, socket_size);
 	}
 	
-	for(sock= node->outputs.first; sock; sock= sock->next) {
-		if(!nodeSocketIsHidden(sock))
+	for (sock= node->outputs.first; sock; sock= sock->next) {
+		if (!nodeSocketIsHidden(sock))
 			node_socket_circle_draw(snode->nodetree, sock, socket_size);
 	}
 	
@@ -870,7 +866,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
 
 void node_draw_default(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree, bNode *node)
 {
-	if(node->flag & NODE_HIDDEN)
+	if (node->flag & NODE_HIDDEN)
 		node_draw_hidden(C, ar, snode, node);
 	else
 		node_draw_basis(C, ar, snode, ntree, node);
@@ -886,7 +882,7 @@ void node_update_nodetree(const bContext *C, bNodeTree *ntree, float offsetx, fl
 {
 	bNode *node;
 	
-	for(node= ntree->nodes.first; node; node= node->next) {
+	for (node= ntree->nodes.first; node; node= node->next) {
 		/* XXX little hack */
 		node->locx += offsetx;
 		node->locy += offsety;
@@ -910,18 +906,18 @@ void node_draw_nodetree(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeT
 	bNodeLink *link;
 	int a;
 	
-	if(ntree==NULL) return;		/* groups... */
+	if (ntree==NULL) return;		/* groups... */
 	
 	/* node lines */
 	glEnable(GL_BLEND);
 	glEnable(GL_LINE_SMOOTH);
-	for(link= ntree->links.first; link; link= link->next)
+	for (link= ntree->links.first; link; link= link->next)
 		node_draw_link(&ar->v2d, snode, link);
 	glDisable(GL_LINE_SMOOTH);
 	glDisable(GL_BLEND);
 	
 	/* draw nodes, last nodes in front */
-	for(a=0, node= ntree->nodes.first; node; node=node->next, a++) {
+	for (a=0, node= ntree->nodes.first; node; node=node->next, a++) {
 		node->nr= a;		/* index of node in list, used for exec event code */
 		node_draw(C, ar, snode, ntree, node);
 	}
@@ -957,7 +953,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
 	/* nodes */
 	snode_set_context(snode, CTX_data_scene(C));
 	
-	if(snode->nodetree) {
+	if (snode->nodetree) {
 		bNode *node;
 		
 		node_uiblocks_init(C, snode->nodetree);
@@ -965,8 +961,8 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
 		/* uiBlocks must be initialized in drawing order for correct event clipping.
 		 * Node group internal blocks added after the main group block.
 		 */
-		for(node= snode->nodetree->nodes.first; node; node= node->next) {
-			if(node->flag & NODE_GROUP_EDIT)
+		for (node= snode->nodetree->nodes.first; node; node= node->next) {
+			if (node->flag & NODE_GROUP_EDIT)
 				node_uiblocks_init(C, (bNodeTree *)node->id);
 		}
 		
@@ -975,8 +971,8 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
 		
 		#if 0
 		/* active group */
-		for(node= snode->nodetree->nodes.first; node; node= node->next) {
-			if(node->flag & NODE_GROUP_EDIT)
+		for (node= snode->nodetree->nodes.first; node; node= node->next) {
+			if (node->flag & NODE_GROUP_EDIT)
 				node_draw_group(C, ar, snode, snode->nodetree, node);
 		}
 		#endif
@@ -985,7 +981,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
 	/* temporary links */
 	glEnable(GL_BLEND);
 	glEnable(GL_LINE_SMOOTH);
-	for(nldrag= snode->linkdrag.first; nldrag; nldrag= nldrag->next)
+	for (nldrag= snode->linkdrag.first; nldrag; nldrag= nldrag->next)
 		node_draw_link(&ar->v2d, snode, nldrag->link);
 	glDisable(GL_LINE_SMOOTH);
 	glDisable(GL_BLEND);
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 906b5d0..dda0626 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -132,14 +132,14 @@ static void compo_freejob(void *cjv)
 {
 	CompoJob *cj= cjv;
 
-	if(cj->localtree) {
+	if (cj->localtree) {
 		ntreeLocalMerge(cj->localtree, cj->ntree);
 	}
 	MEM_freeN(cj);
 }
 
 /* only now we copy the nodetree, so adding many jobs while
-   sliding buttons doesn't frustrate */
+ * sliding buttons doesn't frustrate */
 static void compo_initjob(void *cjv)
 {
 	CompoJob *cj= cjv;
@@ -169,7 +169,7 @@ static void compo_startjob(void *cjv, short *stop, short *do_update, float *prog
 	CompoJob *cj= cjv;
 	bNodeTree *ntree= cj->localtree;
 
-	if(cj->scene->use_nodes==0)
+	if (cj->scene->use_nodes==0)
 		return;
 	
 	cj->stop= stop;
@@ -220,9 +220,9 @@ void snode_composite_job(const bContext *C, ScrArea *sa)
 /* operator poll callback */
 static int composite_node_active(bContext *C)
 {
-	if( ED_operator_node_active(C)) {
+	if ( ED_operator_node_active(C)) {
 		SpaceNode *snode= CTX_wm_space_node(C);
-		if(snode->treetype==NTREE_COMPOSIT)
+		if (snode->treetype==NTREE_COMPOSIT)
 			return 1;
 	}
 	return 0;
@@ -234,10 +234,10 @@ static bNode *editnode_get_active(bNodeTree *ntree)
 	bNode *node;
 	
 	/* check for edited group */
-	for(node= ntree->nodes.first; node; node= node->next)
-		if(nodeGroupEditGet(node))
+	for (node= ntree->nodes.first; node; node= node->next)
+		if (nodeGroupEditGet(node))
 			break;
-	if(node)
+	if (node)
 		return nodeGetActive((bNodeTree *)node->id);
 	else
 		return nodeGetActive(ntree);
@@ -252,11 +252,11 @@ void snode_notify(bContext *C, SpaceNode *snode)
 {
 	WM_event_add_notifier(C, NC_NODE|NA_EDITED, NULL);
 
-	if(snode->treetype==NTREE_SHADER)
+	if (snode->treetype==NTREE_SHADER)
 		WM_event_add_notifier(C, NC_MATERIAL|ND_NODES, snode->id);
-	else if(snode->treetype==NTREE_COMPOSIT)
+	else if (snode->treetype==NTREE_COMPOSIT)
 		WM_event_add_notifier(C, NC_SCENE|ND_NODES, snode->id);
-	else if(snode->treetype==NTREE_TEXTURE)
+	else if (snode->treetype==NTREE_TEXTURE)
 		WM_event_add_notifier(C, NC_TEXTURE|ND_NODES, snode->id);
 }
 
@@ -265,8 +265,8 @@ bNode *node_tree_get_editgroup(bNodeTree *nodetree)
 	bNode *gnode;
 	
 	/* get the groupnode */
-	for(gnode= nodetree->nodes.first; gnode; gnode= gnode->next)
-		if(nodeGroupEditGet(gnode))
+	for (gnode= nodetree->nodes.first; gnode; gnode= gnode->next)
+		if (nodeGroupEditGet(gnode))
 			break;
 	return gnode;
 }
@@ -289,7 +289,7 @@ void ED_node_shader_default(Scene *scene, ID *id)
 			Material *ma= (Material*)id;
 			ma->nodetree = ntree;
 
-			if(scene_use_new_shading_nodes(scene)) {
+			if (scene_use_new_shading_nodes(scene)) {
 				output_type = SH_NODE_OUTPUT_MATERIAL;
 				shader_type = SH_NODE_BSDF_DIFFUSE;
 			}
@@ -321,7 +321,7 @@ void ED_node_shader_default(Scene *scene, ID *id)
 			shader_type = SH_NODE_EMISSION;
 
 			copy_v3_v3(color, &la->r);
-			if(la->type == LA_LOCAL || la->type == LA_SPOT || la->type == LA_AREA)
+			if (la->type == LA_LOCAL || la->type == LA_SPOT || la->type == LA_AREA)
 				strength= 100.0f;
 			else
 				strength= 1.0f;
@@ -347,11 +347,11 @@ void ED_node_shader_default(Scene *scene, ID *id)
 	nodeAddLink(ntree, in, fromsock, out, tosock);
 
 	/* default values */
-	if(scene_use_new_shading_nodes(scene)) {
+	if (scene_use_new_shading_nodes(scene)) {
 		sock= in->inputs.first;
 		copy_v3_v3(((bNodeSocketValueRGBA*)sock->default_value)->value, color);
 
-		if(strength != 0.0f) {
+		if (strength != 0.0f) {
 			sock= in->inputs.last;
 			((bNodeSocketValueFloat*)sock->default_value)->value= strength;
 		}
@@ -369,8 +369,8 @@ void ED_node_composit_default(Scene *sce)
 	bNodeTemplate ntemp;
 	
 	/* but lets check it anyway */
-	if(sce->nodetree) {
-		if (G.f & G_DEBUG)
+	if (sce->nodetree) {
+		if (G.debug & G_DEBUG)
 			printf("error in composite initialize\n");
 		return;
 	}
@@ -409,8 +409,8 @@ void ED_node_texture_default(Tex *tx)
 	bNodeTemplate ntemp;
 	
 	/* but lets check it anyway */
-	if(tx->nodetree) {
-		if (G.f & G_DEBUG)
+	if (tx->nodetree) {
+		if (G.debug & G_DEBUG)
 			printf("error in texture initialize\n");
 		return;
 	}
@@ -440,43 +440,43 @@ void node_tree_from_ID(ID *id, bNodeTree **ntree, bNodeTree **edittree, int *tre
 		bNode *node= NULL;
 		short idtype= GS(id->name);
 	
-		if(idtype == ID_NT) {
+		if (idtype == ID_NT) {
 			*ntree= (bNodeTree*)id;
-			if(treetype) *treetype= (*ntree)->type;
+			if (treetype) *treetype= (*ntree)->type;
 		}
-		else if(idtype == ID_MA) {
+		else if (idtype == ID_MA) {
 			*ntree= ((Material*)id)->nodetree;
-			if(treetype) *treetype= NTREE_SHADER;
+			if (treetype) *treetype= NTREE_SHADER;
 		}
-		else if(idtype == ID_LA) {
+		else if (idtype == ID_LA) {
 			*ntree= ((Lamp*)id)->nodetree;
-			if(treetype) *treetype= NTREE_SHADER;
+			if (treetype) *treetype= NTREE_SHADER;
 		}
-		else if(idtype == ID_WO) {
+		else if (idtype == ID_WO) {
 			*ntree= ((World*)id)->nodetree;
-			if(treetype) *treetype= NTREE_SHADER;
+			if (treetype) *treetype= NTREE_SHADER;
 		}
-		else if(idtype == ID_SCE) {
+		else if (idtype == ID_SCE) {
 			*ntree= ((Scene*)id)->nodetree;
-			if(treetype) *treetype= NTREE_COMPOSIT;
+			if (treetype) *treetype= NTREE_COMPOSIT;
 		}
-		else if(idtype == ID_TE) {
+		else if (idtype == ID_TE) {
 			*ntree= ((Tex*)id)->nodetree;
-			if(treetype) *treetype= NTREE_TEXTURE;
+			if (treetype) *treetype= NTREE_TEXTURE;
 		}
 		else {
-			if(treetype) *treetype= 0;
+			if (treetype) *treetype= 0;
 			return;
 		}
 	
 		/* find editable group */
-		if(edittree) {
-			if(*ntree)
-				for(node= (*ntree)->nodes.first; node; node= node->next)
-					if(nodeGroupEditGet(node))
+		if (edittree) {
+			if (*ntree)
+				for (node= (*ntree)->nodes.first; node; node= node->next)
+					if (nodeGroupEditGet(node))
 						break;
 			
-			if(node && node->id)
+			if (node && node->id)
 				*edittree= (bNodeTree *)node->id;
 			else
 				*edittree= *ntree;
@@ -485,7 +485,7 @@ void node_tree_from_ID(ID *id, bNodeTree **ntree, bNodeTree **edittree, int *tre
 	else {
 		*ntree= NULL;
 		*edittree= NULL;
-		if(treetype) *treetype= 0;
+		if (treetype) *treetype= 0;
 	}
 }
 
@@ -496,17 +496,17 @@ void snode_set_context(SpaceNode *snode, Scene *scene)
 	
 	snode->id= snode->from= NULL;
 	
-	if(snode->treetype==NTREE_SHADER) {
+	if (snode->treetype==NTREE_SHADER) {
 		/* need active object, or we allow pinning... */
-		if(snode->shaderfrom == SNODE_SHADER_OBJECT) {
-			if(ob) {
-				if(ob->type == OB_LAMP) {
+		if (snode->shaderfrom == SNODE_SHADER_OBJECT) {
+			if (ob) {
+				if (ob->type == OB_LAMP) {
 					snode->from= &ob->id;
 					snode->id= ob->data;
 				}
 				else {
 					Material *ma= give_current_material(ob, ob->actcol);
-					if(ma) {
+					if (ma) {
 						snode->from= &ob->id;
 						snode->id= &ma->id;
 					}
@@ -514,26 +514,26 @@ void snode_set_context(SpaceNode *snode, Scene *scene)
 			}
 		}
 		else { /* SNODE_SHADER_WORLD */
-			if(scene->world) {
+			if (scene->world) {
 				snode->from= NULL;
 				snode->id= &scene->world->id;
 			}
 		}
 	}
-	else if(snode->treetype==NTREE_COMPOSIT) {
+	else if (snode->treetype==NTREE_COMPOSIT) {
 		snode->id= &scene->id;
 		
 		/* update output sockets based on available layers */
 		ntreeCompositForceHidden(scene->nodetree, scene);
 	}
-	else if(snode->treetype==NTREE_TEXTURE) {
+	else if (snode->treetype==NTREE_TEXTURE) {
 		Tex *tx= NULL;
 
-		if(snode->texfrom==SNODE_TEX_OBJECT) {
-			if(ob) {
+		if (snode->texfrom==SNODE_TEX_OBJECT) {
+			if (ob) {
 				tx= give_current_object_texture(ob);
 
-				if(ob->type == OB_LAMP)
+				if (ob->type == OB_LAMP)
 					snode->from= (ID*)ob->data;
 				else
 					snode->from= (ID*)give_current_material(ob, ob->actcol);
@@ -542,7 +542,7 @@ void snode_set_context(SpaceNode *snode, Scene *scene)
 				snode->id= &tx->id;
 			}
 		}
-		else if(snode->texfrom==SNODE_TEX_WORLD) {
+		else if (snode->texfrom==SNODE_TEX_WORLD) {
 			tx= give_current_world_texture(scene->world);
 			snode->from= (ID *)scene->world;
 			snode->id= &tx->id;
@@ -550,7 +550,7 @@ void snode_set_context(SpaceNode *snode, Scene *scene)
 		else {
 			struct Brush *brush= NULL;
 			
-			if(ob && (ob->mode & OB_MODE_SCULPT))
+			if (ob && (ob->mode & OB_MODE_SCULPT))
 				brush= paint_brush(&scene->toolsettings->sculpt->paint);
 			else
 				brush= paint_brush(&scene->toolsettings->imapaint.paint);
@@ -581,7 +581,7 @@ static void snode_update(SpaceNode *snode, bNode *node)
 	
 	/* if inside group, tag entire group */
 	gnode= node_tree_get_editgroup(snode->nodetree);
-	if(gnode)
+	if (gnode)
 		nodeUpdateID(snode->nodetree, gnode->id);
 }
 
@@ -589,12 +589,12 @@ static int has_nodetree(bNodeTree *ntree, bNodeTree *lookup)
 {
 	bNode *node;
 	
-	if(ntree == lookup)
+	if (ntree == lookup)
 		return 1;
 	
-	for(node=ntree->nodes.first; node; node=node->next)
-		if(node->type == NODE_GROUP && node->id)
-			if(has_nodetree((bNodeTree*)node->id, lookup))
+	for (node=ntree->nodes.first; node; node=node->next)
+		if (node->type == NODE_GROUP && node->id)
+			if (has_nodetree((bNodeTree*)node->id, lookup))
 				return 1;
 	
 	return 0;
@@ -606,72 +606,74 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node)
 
 	nodeSetActive(ntree, node);
 	
-	if(node->type!=NODE_GROUP) {
+	if (node->type!=NODE_GROUP) {
 		int was_output= (node->flag & NODE_DO_OUTPUT);
 		
 		/* tree specific activate calls */
-		if(ntree->type==NTREE_SHADER) {
+		if (ntree->type==NTREE_SHADER) {
 			/* when we select a material, active texture is cleared, for buttons */
-			if(node->id && ELEM3(GS(node->id->name), ID_MA, ID_LA, ID_WO))
+			if (node->id && ELEM3(GS(node->id->name), ID_MA, ID_LA, ID_WO))
 				nodeClearActiveID(ntree, ID_TE);
 			
-			if(node->type==SH_NODE_OUTPUT) {
+			if (node->type==SH_NODE_OUTPUT) {
 				bNode *tnode;
 				
-				for(tnode= ntree->nodes.first; tnode; tnode= tnode->next)
-					if( tnode->type==SH_NODE_OUTPUT)
+				for (tnode= ntree->nodes.first; tnode; tnode= tnode->next)
+					if ( tnode->type==SH_NODE_OUTPUT)
 						tnode->flag &= ~NODE_DO_OUTPUT;
 				
 				node->flag |= NODE_DO_OUTPUT;
-				if(was_output==0)
+				if (was_output==0)
 					ED_node_generic_update(bmain, ntree, node);
 			}
 
 			/* if active texture changed, free glsl materials */
-			if((node->flag & NODE_ACTIVE_TEXTURE) && !was_active_texture) {
+			if ((node->flag & NODE_ACTIVE_TEXTURE) && !was_active_texture) {
 				Material *ma;
 
-				for(ma=bmain->mat.first; ma; ma=ma->id.next)
-					if(ma->nodetree && ma->use_nodes && has_nodetree(ma->nodetree, ntree))
+				for (ma=bmain->mat.first; ma; ma=ma->id.next)
+					if (ma->nodetree && ma->use_nodes && has_nodetree(ma->nodetree, ntree))
 						GPU_material_free(ma);
+
+				WM_main_add_notifier(NC_IMAGE, NULL);
 			}
 
 			WM_main_add_notifier(NC_MATERIAL|ND_NODES, node->id);
 		}
-		else if(ntree->type==NTREE_COMPOSIT) {
+		else if (ntree->type==NTREE_COMPOSIT) {
 			/* make active viewer, currently only 1 supported... */
-			if( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
+			if ( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
 				bNode *tnode;
 				
 
-				for(tnode= ntree->nodes.first; tnode; tnode= tnode->next)
-					if( ELEM(tnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
+				for (tnode= ntree->nodes.first; tnode; tnode= tnode->next)
+					if ( ELEM(tnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
 						tnode->flag &= ~NODE_DO_OUTPUT;
 				
 				node->flag |= NODE_DO_OUTPUT;
-				if(was_output==0)
+				if (was_output==0)
 					ED_node_generic_update(bmain, ntree, node);
 				
 				/* addnode() doesnt link this yet... */
 				node->id= (ID *)BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
 			}
-			else if(node->type==CMP_NODE_R_LAYERS) {
+			else if (node->type==CMP_NODE_R_LAYERS) {
 				Scene *scene;
 
-				for(scene=bmain->scene.first; scene; scene=scene->id.next) {
-					if(scene->nodetree && scene->use_nodes && has_nodetree(scene->nodetree, ntree)) {
-						if(node->id==NULL || node->id==(ID *)scene) {
+				for (scene=bmain->scene.first; scene; scene=scene->id.next) {
+					if (scene->nodetree && scene->use_nodes && has_nodetree(scene->nodetree, ntree)) {
+						if (node->id==NULL || node->id==(ID *)scene) {
 							scene->r.actlay= node->custom1;
 						}
 					}
 				}
 			}
-			else if(node->type==CMP_NODE_COMPOSITE) {
+			else if (node->type==CMP_NODE_COMPOSITE) {
 				if (was_output==0) {
 					bNode *tnode;
 					
-					for(tnode= ntree->nodes.first; tnode; tnode= tnode->next)
-						if( tnode->type==CMP_NODE_COMPOSITE)
+					for (tnode= ntree->nodes.first; tnode; tnode= tnode->next)
+						if ( tnode->type==CMP_NODE_COMPOSITE)
 							tnode->flag &= ~NODE_DO_OUTPUT;
 					
 					node->flag |= NODE_DO_OUTPUT;
@@ -679,10 +681,10 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node)
 				}
 			}
 		}
-		else if(ntree->type==NTREE_TEXTURE) {
+		else if (ntree->type==NTREE_TEXTURE) {
 			// XXX
 #if 0
-			if(node->id)
+			if (node->id)
 				; // XXX BIF_preview_changed(-1);
 			// allqueue(REDRAWBUTSSHADING, 1);
 			// allqueue(REDRAWIPO, 0);
@@ -693,8 +695,10 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node)
 
 static int inside_rctf(rctf *bounds, rctf *rect)
 {
-	return (bounds->xmin <= rect->xmin && bounds->xmax >= rect->xmax
-			&& bounds->ymin <= rect->ymin && bounds->ymax >= rect->ymax);
+	return (bounds->xmin <= rect->xmin &&
+	        bounds->xmax >= rect->xmax &&
+	        bounds->ymin <= rect->ymin &&
+	        bounds->ymax >= rect->ymax);
 }
 
 static void node_frame_attach_nodes(bNodeTree *UNUSED(ntree), bNode *frame)
@@ -811,12 +815,12 @@ void snode_make_group_editable(SpaceNode *snode, bNode *gnode)
 	bNode *node;
 	
 	/* make sure nothing has group editing on */
-	for(node=snode->nodetree->nodes.first; node; node=node->next)
+	for (node=snode->nodetree->nodes.first; node; node=node->next)
 		nodeGroupEditClear(node);
 	
-	if(gnode==NULL) {
+	if (gnode==NULL) {
 		/* with NULL argument we do a toggle */
-		if(snode->edittree==snode->nodetree)
+		if (snode->edittree==snode->nodetree)
 			gnode= nodeGetActive(snode->nodetree);
 	}
 	
@@ -824,9 +828,9 @@ void snode_make_group_editable(SpaceNode *snode, bNode *gnode)
 		snode->edittree = nodeGroupEditSet(gnode, 1);
 		
 		/* deselect all other nodes, so we can also do grabbing of entire subtree */
-		for(node= snode->nodetree->nodes.first; node; node= node->next)
-			node->flag &= ~SELECT;
-		gnode->flag |= SELECT;
+		for (node= snode->nodetree->nodes.first; node; node= node->next)
+			node_deselect(node);
+		node_select(gnode);
 	}
 	else 
 		snode->edittree= snode->nodetree;
@@ -858,7 +862,7 @@ static int node_group_edit_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e
 	/* XXX callback? */
 	if (snode->nodetree==snode->edittree) {
 		gnode = nodeGetActive(snode->edittree);
-		if(gnode && gnode->id && GS(gnode->id->name)==ID_NT && gnode->id->lib) {
+		if (gnode && gnode->id && GS(gnode->id->name)==ID_NT && gnode->id->lib) {
 			uiPupMenuOkee(C, op->type->idname, "Make group local?");
 			return OPERATOR_CANCELLED;
 		}
@@ -1138,18 +1142,18 @@ static int node_group_ungroup_exec(bContext *C, wmOperator *op)
 
 	/* are we inside of a group? */
 	gnode= node_tree_get_editgroup(snode->nodetree);
-	if(gnode)
+	if (gnode)
 		snode_make_group_editable(snode, NULL);
 	
 	gnode= nodeGetActive(snode->edittree);
-	if(gnode==NULL)
+	if (gnode==NULL)
 		return OPERATOR_CANCELLED;
 	
-	if(gnode->type!=NODE_GROUP) {
+	if (gnode->type!=NODE_GROUP) {
 		BKE_report(op->reports, RPT_WARNING, "Not a group");
 		return OPERATOR_CANCELLED;
 	}
-	else if(!node_group_ungroup(snode->edittree, gnode)) {
+	else if (!node_group_ungroup(snode->edittree, gnode)) {
 		BKE_report(op->reports, RPT_WARNING, "Can't ungroup");
 		return OPERATOR_CANCELLED;
 	}
@@ -1182,8 +1186,8 @@ static bNode *visible_node(SpaceNode *snode, rctf *rct)
 {
 	bNode *node;
 	
-	for(node=snode->edittree->nodes.last; node; node=node->prev) {
-		if(BLI_isect_rctf(&node->totr, rct, NULL))
+	for (node=snode->edittree->nodes.last; node; node=node->prev) {
+		if (BLI_isect_rctf(&node->totr, rct, NULL))
 			break;
 	}
 	return node;
@@ -1245,7 +1249,7 @@ static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	ima= BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
 	ibuf= BKE_image_acquire_ibuf(ima, NULL, &lock);
 	
-	if(ibuf == NULL) {
+	if (ibuf == NULL) {
 		BKE_image_release_ibuf(ima, lock);
 		return OPERATOR_CANCELLED;
 	}
@@ -1279,18 +1283,18 @@ static int snode_bg_viewmove_cancel(bContext *UNUSED(C), wmOperator *op)
 void NODE_OT_backimage_move(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Background Image Move";
+	ot->name = "Background Image Move";
 	ot->description = "Move Node backdrop";
-	ot->idname= "NODE_OT_backimage_move";
+	ot->idname = "NODE_OT_backimage_move";
 	
 	/* api callbacks */
-	ot->invoke= snode_bg_viewmove_invoke;
-	ot->modal= snode_bg_viewmove_modal;
-	ot->poll= composite_node_active;
-	ot->cancel= snode_bg_viewmove_cancel;
+	ot->invoke = snode_bg_viewmove_invoke;
+	ot->modal = snode_bg_viewmove_modal;
+	ot->poll = composite_node_active;
+	ot->cancel = snode_bg_viewmove_cancel;
 	
 	/* flags */
-	ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
+	ot->flag = OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
 }
 
 static int backimage_zoom(bContext *C, wmOperator *op)
@@ -1310,15 +1314,15 @@ void NODE_OT_backimage_zoom(wmOperatorType *ot)
 {
 	
 	/* identifiers */
-	ot->name= "Background Image Zoom";
-	ot->idname= "NODE_OT_backimage_zoom";
+	ot->name = "Background Image Zoom";
+	ot->idname = "NODE_OT_backimage_zoom";
 	
 	/* api callbacks */
-	ot->exec= backimage_zoom;
-	ot->poll= composite_node_active;
+	ot->exec = backimage_zoom;
+	ot->poll = composite_node_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_BLOCKING;
 
 	/* internal */
 	RNA_def_float(ot->srna, "factor", 1.2f, 0.0f, 10.0f, "Factor", "", 0.0f, 10.0f);
@@ -1362,11 +1366,11 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
 	
 	ima= BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
 	ibuf= BKE_image_acquire_ibuf(ima, NULL, &lock);
-	if(!ibuf)
+	if (!ibuf)
 		return;
 	
-	if(!ibuf->rect) {
-		if(info->color_manage)
+	if (!ibuf->rect) {
+		if (info->color_manage)
 			ibuf->profile = IB_PROFILE_LINEAR_RGB;
 		else
 			ibuf->profile = IB_PROFILE_NONE;
@@ -1379,7 +1383,7 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
 	fx = (bufx > 0.0f ? ((float)event->mval[0] - 0.5f*ar->winx - snode->xof) / bufx + 0.5f : 0.0f);
 	fy = (bufy > 0.0f ? ((float)event->mval[1] - 0.5f*ar->winy - snode->yof) / bufy + 0.5f : 0.0f);
 
-	if(fx>=0.0f && fy>=0.0f && fx<1.0f && fy<1.0f) {
+	if (fx>=0.0f && fy>=0.0f && fx<1.0f && fy<1.0f) {
 		float *fp;
 		char *cp;
 		int x= (int)(fx*ibuf->x), y= (int)(fy*ibuf->y);
@@ -1392,7 +1396,7 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
 		info->draw= 1;
 		info->channels= ibuf->channels;
 
-		if(ibuf->rect) {
+		if (ibuf->rect) {
 			cp= (char *)(ibuf->rect + y*ibuf->x + x);
 
 			info->col[0]= cp[0];
@@ -1405,7 +1409,7 @@ static void sample_apply(bContext *C, wmOperator *op, wmEvent *event)
 			info->colf[2]= (float)cp[2]/255.0f;
 			info->colf[3]= (float)cp[3]/255.0f;
 		}
-		if(ibuf->rect_float) {
+		if (ibuf->rect_float) {
 			fp= (ibuf->rect_float + (ibuf->channels)*(y*ibuf->x + x));
 
 			info->colf[0]= fp[0];
@@ -1437,7 +1441,7 @@ static int sample_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	ARegion *ar= CTX_wm_region(C);
 	ImageSampleInfo *info;
 
-	if(snode->treetype!=NTREE_COMPOSIT || !(snode->flag & SNODE_BACKDRAW))
+	if (snode->treetype!=NTREE_COMPOSIT || !(snode->flag & SNODE_BACKDRAW))
 		return OPERATOR_CANCELLED;
 	
 	info= MEM_callocN(sizeof(ImageSampleInfo), "ImageSampleInfo");
@@ -1476,17 +1480,17 @@ static int sample_cancel(bContext *C, wmOperator *op)
 void NODE_OT_backimage_sample(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Backimage Sample";
-	ot->idname= "NODE_OT_backimage_sample";
+	ot->name = "Backimage Sample";
+	ot->idname = "NODE_OT_backimage_sample";
 	
 	/* api callbacks */
-	ot->invoke= sample_invoke;
-	ot->modal= sample_modal;
-	ot->cancel= sample_cancel;
-	ot->poll= ED_operator_node_active;
+	ot->invoke = sample_invoke;
+	ot->modal = sample_modal;
+	ot->cancel = sample_cancel;
+	ot->poll = ED_operator_node_active;
 
 	/* flags */
-	ot->flag= OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_BLOCKING;
 }
 
 /* ********************** size widget operator ******************** */
@@ -1512,7 +1516,7 @@ static int node_resize_modal(bContext *C, wmOperator *op, wmEvent *event)
 									 &mx, &my);
 			
 			if (node) {
-				if(node->flag & NODE_HIDDEN) {
+				if (node->flag & NODE_HIDDEN) {
 					node->miniwidth= nsw->oldminiwidth + mx - nsw->mxstart;
 					CLAMP(node->miniwidth, 0.0f, 100.0f);
 				}
@@ -1550,12 +1554,12 @@ static int node_resize_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	ARegion *ar= CTX_wm_region(C);
 	bNode *node= editnode_get_active(snode->edittree);
 	
-	if(node) {
+	if (node) {
 		/* convert mouse coordinates to v2d space */
 		UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1],
 								 &snode->mx, &snode->my);
 		
-		if(node->typeinfo->resize_area_func(node, snode->mx, snode->my)) {
+		if (node->typeinfo->resize_area_func(node, snode->mx, snode->my)) {
 			NodeSizeWidget *nsw= MEM_callocN(sizeof(NodeSizeWidget), "size widget op data");
 			
 			op->customdata= nsw;
@@ -1587,128 +1591,148 @@ static int node_resize_cancel(bContext *UNUSED(C), wmOperator *op)
 void NODE_OT_resize(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Resize Node";
-	ot->idname= "NODE_OT_resize";
+	ot->name = "Resize Node";
+	ot->idname = "NODE_OT_resize";
 	
 	/* api callbacks */
-	ot->invoke= node_resize_invoke;
-	ot->modal= node_resize_modal;
-	ot->poll= ED_operator_node_active;
-	ot->cancel= node_resize_cancel;
+	ot->invoke = node_resize_invoke;
+	ot->modal = node_resize_modal;
+	ot->poll = ED_operator_node_active;
+	ot->cancel = node_resize_cancel;
 	
 	/* flags */
-	ot->flag= OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_BLOCKING;
 }
 
 
 /* ********************** hidden sockets ******************** */
 
-int node_has_hidden_sockets(bNode *node, short flag)
+int node_has_hidden_sockets(bNode *node)
 {
 	bNodeSocket *sock;
 	
-	for(sock= node->inputs.first; sock; sock= sock->next)
-		if(sock->flag & flag)
+	for (sock= node->inputs.first; sock; sock= sock->next)
+		if (sock->flag & SOCK_HIDDEN)
 			return 1;
-	for(sock= node->outputs.first; sock; sock= sock->next)
-		if(sock->flag & flag)
+	for (sock= node->outputs.first; sock; sock= sock->next)
+		if (sock->flag & SOCK_HIDDEN)
 			return 1;
 	return 0;
 }
 
-void node_set_hidden_sockets(SpaceNode *snode, bNode *node, short flag, int set)
+void node_set_hidden_sockets(SpaceNode *snode, bNode *node, int set)
 {	
 	bNodeSocket *sock;
 
-	if(set==0) {
-		for(sock= node->inputs.first; sock; sock= sock->next)
-			sock->flag &= ~flag;
-		for(sock= node->outputs.first; sock; sock= sock->next)
-			sock->flag &= ~flag;
+	if (set==0) {
+		for (sock= node->inputs.first; sock; sock= sock->next)
+			sock->flag &= ~SOCK_HIDDEN;
+		for (sock= node->outputs.first; sock; sock= sock->next)
+			sock->flag &= ~SOCK_HIDDEN;
 	}
 	else {
 		/* hide unused sockets */
-		for(sock= node->inputs.first; sock; sock= sock->next) {
-			if(sock->link==NULL)
-				sock->flag |= flag;
+		for (sock= node->inputs.first; sock; sock= sock->next) {
+			if (sock->link==NULL)
+				sock->flag |= SOCK_HIDDEN;
 		}
-		for(sock= node->outputs.first; sock; sock= sock->next) {
-			if(nodeCountSocketLinks(snode->edittree, sock)==0)
-				sock->flag |= flag;
+		for (sock= node->outputs.first; sock; sock= sock->next) {
+			if (nodeCountSocketLinks(snode->edittree, sock)==0)
+				sock->flag |= SOCK_HIDDEN;
 		}
 	}
 }
 
-static void node_link_viewer(SpaceNode *snode, bNode *tonode)
+static int node_link_viewer(const bContext *C, bNode *tonode)
 {
+	SpaceNode *snode = CTX_wm_space_node(C);
 	bNode *node;
+	bNodeLink *link;
+	bNodeSocket *sock;
 
 	/* context check */
-	if(tonode==NULL || tonode->outputs.first==NULL)
-		return;
-	if( ELEM(tonode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) 
-		return;
+	if (tonode==NULL || tonode->outputs.first==NULL)
+		return OPERATOR_CANCELLED;
+	if ( ELEM(tonode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
+		return OPERATOR_CANCELLED;
 	
 	/* get viewer */
-	for(node= snode->edittree->nodes.first; node; node= node->next)
-		if( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) 
-			if(node->flag & NODE_DO_OUTPUT)
+	for (node= snode->edittree->nodes.first; node; node= node->next)
+		if ( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER))
+			if (node->flag & NODE_DO_OUTPUT)
 				break;
 	/* no viewer, we make one active */
-	if(node==NULL) {
-		for(node= snode->edittree->nodes.first; node; node= node->next) {
-			if( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
+	if (node==NULL) {
+		for (node= snode->edittree->nodes.first; node; node= node->next) {
+			if ( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
 				node->flag |= NODE_DO_OUTPUT;
 				break;
 			}
 		}
 	}
-		
-	if(node) {
-		bNodeLink *link;
-		bNodeSocket *sock= NULL;
-
-		/* try to find an already connected socket to cycle to the next */
-		for(link= snode->edittree->links.first; link; link= link->next)
-			if(link->tonode==node && link->fromnode==tonode)
-				if(link->tosock==node->inputs.first)
+	
+	sock = NULL;
+	
+	/* try to find an already connected socket to cycle to the next */
+	if (node) {
+		link = NULL;
+		for (link= snode->edittree->links.first; link; link= link->next)
+			if (link->tonode==node && link->fromnode==tonode)
+				if (link->tosock==node->inputs.first)
 					break;
-
-		if(link) {
+		if (link) {
 			/* unlink existing connection */
 			sock= link->fromsock;
 			nodeRemLink(snode->edittree, link);
-
+			
 			/* find a socket after the previously connected socket */
-			for(sock=sock->next; sock; sock= sock->next)
-				if(!nodeSocketIsHidden(sock))
+			for (sock=sock->next; sock; sock= sock->next)
+				if (!nodeSocketIsHidden(sock))
 					break;
 		}
-
-		/* find a socket starting from the first socket */
-		if(!sock) {
-			for(sock= tonode->outputs.first; sock; sock= sock->next)
-				if(!nodeSocketIsHidden(sock))
-					break;
+	}
+	
+	/* find a socket starting from the first socket */
+	if (!sock) {
+		for (sock= tonode->outputs.first; sock; sock= sock->next)
+			if (!nodeSocketIsHidden(sock))
+				break;
+	}
+	
+	if (sock) {
+		/* add a new viewer if none exists yet */
+		if (!node) {
+			Main *bmain = CTX_data_main(C);
+			Scene *scene = CTX_data_scene(C);
+			bNodeTemplate ntemp;
+			
+			ntemp.type = CMP_NODE_VIEWER;
+			/* XXX location is a quick hack, just place it next to the linked socket */
+			node = node_add_node(snode, bmain, scene, &ntemp, sock->locx + 100, sock->locy);
+			if (!node)
+				return OPERATOR_CANCELLED;
+			
+			link = NULL;
 		}
-		
-		if(sock) {
+		else {
 			/* get link to viewer */
-			for(link= snode->edittree->links.first; link; link= link->next)
-				if(link->tonode==node && link->tosock==node->inputs.first)
+			for (link= snode->edittree->links.first; link; link= link->next)
+				if (link->tonode==node && link->tosock==node->inputs.first)
 					break;
-			
-			if(link==NULL) {
-				nodeAddLink(snode->edittree, tonode, sock, node, node->inputs.first);
-			}
-			else {
-				link->fromnode= tonode;
-				link->fromsock= sock;
-			}
-			ntreeUpdateTree(snode->edittree);
-			snode_update(snode, node);
 		}
+		
+		if (link==NULL) {
+			nodeAddLink(snode->edittree, tonode, sock, node, node->inputs.first);
+		}
+		else {
+			link->fromnode= tonode;
+			link->fromsock= sock;
+		}
+		ntreeUpdateTree(snode->edittree);
+		snode_update(snode, node);
 	}
+	
+	return OPERATOR_FINISHED;
 }
 
 
@@ -1719,12 +1743,14 @@ static int node_active_link_viewer(bContext *C, wmOperator *UNUSED(op))
 	
 	node= editnode_get_active(snode->edittree);
 	
-	if(!node)
+	if (!node)
 		return OPERATOR_CANCELLED;
 
 	ED_preview_kill_jobs(C);
 
-	node_link_viewer(snode, node);
+	if (node_link_viewer(C, node) == OPERATOR_CANCELLED)
+		return OPERATOR_CANCELLED;
+
 	snode_notify(C, snode);
 
 	return OPERATOR_FINISHED;
@@ -1735,16 +1761,16 @@ static int node_active_link_viewer(bContext *C, wmOperator *UNUSED(op))
 void NODE_OT_link_viewer(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Link to Viewer Node";
+	ot->name = "Link to Viewer Node";
 	ot->description = "Link to viewer node";
-	ot->idname= "NODE_OT_link_viewer";
+	ot->idname = "NODE_OT_link_viewer";
 	
 	/* api callbacks */
-	ot->exec= node_active_link_viewer;
-	ot->poll= ED_operator_node_active;
+	ot->exec = node_active_link_viewer;
+	ot->poll = composite_node_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 
@@ -1757,17 +1783,17 @@ static int UNUSED_FUNCTION(node_mouse_groupheader)(SpaceNode *snode)
 // XXX	int mval[2];
 	
 	gnode= node_tree_get_editgroup(snode->nodetree);
-	if(gnode==NULL) return 0;
+	if (gnode==NULL) return 0;
 	
 // XXX	getmouseco_areawin(mval);
 // XXX	areamouseco_to_ipoco(G.v2d, mval, &mx, &my);
 	
 	/* click in header or outside? */
-	if(BLI_in_rctf(&gnode->totr, mx, my)==0) {
+	if (BLI_in_rctf(&gnode->totr, mx, my)==0) {
 		rctf rect= gnode->totr;
 		
 		rect.ymax += NODE_DY;
-		if(BLI_in_rctf(&rect, mx, my)==0)
+		if (BLI_in_rctf(&rect, mx, my)==0)
 			snode_make_group_editable(snode, NULL);	/* toggles, so exits editmode */
 //		else
 // XXX			transform_nodes(snode->nodetree, 'g', "Move group");
@@ -1779,14 +1805,17 @@ static int UNUSED_FUNCTION(node_mouse_groupheader)(SpaceNode *snode)
 
 /* checks snode->mouse position, and returns found node/socket */
 /* type is SOCK_IN and/or SOCK_OUT */
-static int find_indicated_socket(SpaceNode *snode, bNode **nodep, bNodeSocket **sockp, int in_out)
+int node_find_indicated_socket(SpaceNode *snode, bNode **nodep, bNodeSocket **sockp, int in_out)
 {
 	bNode *node;
 	bNodeSocket *sock;
 	rctf rect;
 	
+	*nodep= NULL;
+	*sockp= NULL;
+	
 	/* check if we click in a socket */
-	for(node= snode->edittree->nodes.first; node; node= node->next) {
+	for (node= snode->edittree->nodes.first; node; node= node->next) {
 		
 		rect.xmin = snode->mx - (NODE_SOCKSIZE+4);
 		rect.ymin = snode->my - (NODE_SOCKSIZE+4);
@@ -1798,17 +1827,18 @@ static int find_indicated_socket(SpaceNode *snode, bNode **nodep, bNodeSocket **
 			if (in_out == SOCK_IN) {
 				rect.xmax += NODE_SOCKSIZE;
 				rect.xmin -= NODE_SOCKSIZE*4;
-			} else if (in_out == SOCK_OUT) {
+			}
+			else if (in_out == SOCK_OUT) {
 				rect.xmax += NODE_SOCKSIZE*4;
 				rect.xmin -= NODE_SOCKSIZE;
 			}
 		}
 		
-		if(in_out & SOCK_IN) {
-			for(sock= node->inputs.first; sock; sock= sock->next) {
-				if(!nodeSocketIsHidden(sock)) {
-					if(BLI_in_rctf(&rect, sock->locx, sock->locy)) {
-						if(node == visible_node(snode, &rect)) {
+		if (in_out & SOCK_IN) {
+			for (sock= node->inputs.first; sock; sock= sock->next) {
+				if (!nodeSocketIsHidden(sock)) {
+					if (BLI_in_rctf(&rect, sock->locx, sock->locy)) {
+						if (node == visible_node(snode, &rect)) {
 							*nodep= node;
 							*sockp= sock;
 							return 1;
@@ -1817,11 +1847,11 @@ static int find_indicated_socket(SpaceNode *snode, bNode **nodep, bNodeSocket **
 				}
 			}
 		}
-		if(in_out & SOCK_OUT) {
-			for(sock= node->outputs.first; sock; sock= sock->next) {
-				if(!nodeSocketIsHidden(sock)) {
-					if(BLI_in_rctf(&rect, sock->locx, sock->locy)) {
-						if(node == visible_node(snode, &rect)) {
+		if (in_out & SOCK_OUT) {
+			for (sock= node->outputs.first; sock; sock= sock->next) {
+				if (!nodeSocketIsHidden(sock)) {
+					if (BLI_in_rctf(&rect, sock->locx, sock->locy)) {
+						if (node == visible_node(snode, &rect)) {
 							*nodep= node;
 							*sockp= sock;
 							return 1;
@@ -1835,10 +1865,10 @@ static int find_indicated_socket(SpaceNode *snode, bNode **nodep, bNodeSocket **
 	/* check group sockets
 	 * NB: using ngroup->outputs as input sockets and vice versa here!
 	 */
-	if(in_out & SOCK_IN) {
-		for(sock= snode->edittree->outputs.first; sock; sock= sock->next) {
-			if(!nodeSocketIsHidden(sock)) {
-				if(BLI_in_rctf(&rect, sock->locx, sock->locy)) {
+	if (in_out & SOCK_IN) {
+		for (sock= snode->edittree->outputs.first; sock; sock= sock->next) {
+			if (!nodeSocketIsHidden(sock)) {
+				if (BLI_in_rctf(&rect, sock->locx, sock->locy)) {
 					*nodep= NULL;	/* NULL node pointer indicates group socket */
 					*sockp= sock;
 					return 1;
@@ -1846,10 +1876,10 @@ static int find_indicated_socket(SpaceNode *snode, bNode **nodep, bNodeSocket **
 			}
 		}
 	}
-	if(in_out & SOCK_OUT) {
-		for(sock= snode->edittree->inputs.first; sock; sock= sock->next) {
-			if(!nodeSocketIsHidden(sock)) {
-				if(BLI_in_rctf(&rect, sock->locx, sock->locy)) {
+	if (in_out & SOCK_OUT) {
+		for (sock= snode->edittree->inputs.first; sock; sock= sock->next) {
+			if (!nodeSocketIsHidden(sock)) {
+				if (BLI_in_rctf(&rect, sock->locx, sock->locy)) {
 					*nodep= NULL;	/* NULL node pointer indicates group socket */
 					*sockp= sock;
 					return 1;
@@ -1861,49 +1891,14 @@ static int find_indicated_socket(SpaceNode *snode, bNode **nodep, bNodeSocket **
 	return 0;
 }
 
-static int node_socket_hilights(SpaceNode *snode, int in_out)
-{
-	bNode *node;
-	bNodeSocket *sock, *tsock, *socksel= NULL;
-	short redraw= 0;
-	
-	if(snode->edittree==NULL) return 0;
-	
-	/* deselect sockets */
-	for(node= snode->edittree->nodes.first; node; node= node->next) {
-		for(sock= node->inputs.first; sock; sock= sock->next) {
-			if(sock->flag & SELECT) {
-				sock->flag &= ~SELECT;
-				redraw++;
-				socksel= sock;
-			}
-		}
-		for(sock= node->outputs.first; sock; sock= sock->next) {
-			if(sock->flag & SELECT) {
-				sock->flag &= ~SELECT;
-				redraw++;
-				socksel= sock;
-			}
-		}
-	}
-	
-	// XXX mousepos should be set here!
-	
-	if(find_indicated_socket(snode, &node, &tsock, in_out)) {
-		tsock->flag |= SELECT;
-		if(redraw==1 && tsock==socksel) redraw= 0;
-		else redraw= 1;
-	}
-	
-	return redraw;
-}
-
 static int outside_group_rect(SpaceNode *snode)
 {
 	bNode *gnode= node_tree_get_editgroup(snode->nodetree);
 	if (gnode) {
-		return (snode->mx < gnode->totr.xmin || snode->mx >= gnode->totr.xmax
-				|| snode->my < gnode->totr.ymin || snode->my >= gnode->totr.ymax);
+		return (snode->mx <  gnode->totr.xmin ||
+		        snode->mx >= gnode->totr.xmax ||
+		        snode->my <  gnode->totr.ymin ||
+		        snode->my >= gnode->totr.ymax);
 	}
 	return 0;
 }
@@ -1944,9 +1939,17 @@ static bNodeSocket *best_socket_output(bNodeTree *ntree, bNode *node, bNodeSocke
 {
 	bNodeSocket *sock;
 	
-	/* first try to find a socket with a matching name */
+	/* first look for selected output */
+	for (sock=node->outputs.first; sock; sock=sock->next) {
+		if (!socket_is_available(ntree, sock, allow_multiple))
+			continue;
+		
+		if (sock->flag & SELECT)
+			return sock;
+	}
+	
+	/* try to find a socket with a matching name */
 	for (sock=node->outputs.first; sock; sock=sock->next) {
-
 		if (!socket_is_available(ntree, sock, allow_multiple))
 			continue;
 
@@ -1972,7 +1975,7 @@ static bNodeSocket *best_socket_output(bNodeTree *ntree, bNode *node, bNodeSocke
 	return NULL;
 }
 
-/* this is a bit complicated, but designed to prioritise finding 
+/* this is a bit complicated, but designed to prioritize finding
  * sockets of higher types, such as image, first */
 static bNodeSocket *best_socket_input(bNodeTree *ntree, bNode *node, int num, int replace)
 {
@@ -2006,16 +2009,37 @@ static bNodeSocket *best_socket_input(bNodeTree *ntree, bNode *node, int num, in
 	return NULL;
 }
 
+static int snode_autoconnect_input(SpaceNode *snode, bNode *node_fr, bNodeSocket *sock_fr, bNode *node_to, bNodeSocket *sock_to, int replace)
+{
+	bNodeTree *ntree = snode->edittree;
+	bNodeLink *link;
+	
+	/* then we can connect */
+	if (replace)
+		nodeRemSocketLinks(ntree, sock_to);
+	
+	link = nodeAddLink(ntree, node_fr, sock_fr, node_to, sock_to);
+	/* validate the new link */
+	ntreeUpdateTree(ntree);
+	if (!(link->flag & NODE_LINK_VALID)) {
+		nodeRemLink(ntree, link);
+		return 0;
+	}
+	
+	snode_update(snode, node_to);
+	return 1;
+}
+
 void snode_autoconnect(SpaceNode *snode, int allow_multiple, int replace)
 {
+	bNodeTree *ntree = snode->edittree;
 	ListBase *nodelist = MEM_callocN(sizeof(ListBase), "items_list");
 	bNodeListItem *nli;
 	bNode *node;
-	bNodeLink *link;
 	int i, numlinks=0;
 	
-	for(node= snode->edittree->nodes.first; node; node= node->next) {
-		if(node->flag & NODE_SELECT) {
+	for (node= ntree->nodes.first; node; node= node->next) {
+		if (node->flag & NODE_SELECT) {
 			nli = MEM_mallocN(sizeof(bNodeListItem), "temporary node list item");
 			nli->node = node;
 			BLI_addtail(nodelist, nli);
@@ -2028,43 +2052,57 @@ void snode_autoconnect(SpaceNode *snode, int allow_multiple, int replace)
 	for (nli=nodelist->first; nli; nli=nli->next) {
 		bNode *node_fr, *node_to;
 		bNodeSocket *sock_fr, *sock_to;
+		int has_selected_inputs = 0;
 		
 		if (nli->next == NULL) break;
 		
 		node_fr = nli->node;
 		node_to = nli->next->node;
 		
-		/* check over input sockets first */
-		for (i=0; i<BLI_countlist(&node_to->inputs); i++) {
-			
-			/* find the best guess input socket */
-			sock_to = best_socket_input(snode->edittree, node_to, i, replace);
-			if (!sock_to) continue;
-			
-			/* check for an appropriate output socket to connect from */
-			sock_fr = best_socket_output(snode->edittree, node_fr, sock_to, allow_multiple);
-			if (!sock_fr) continue;
-			
-			/* then we can connect */
-			if (replace)
-				nodeRemSocketLinks(snode->edittree, sock_to);
-			
-			link = nodeAddLink(snode->edittree, node_fr, sock_fr, node_to, sock_to);
-			/* validate the new link */
-			ntreeUpdateTree(snode->edittree);
-			if (!(link->flag & NODE_LINK_VALID)) {
-				nodeRemLink(snode->edittree, link);
-				continue;
+		/* if there are selected sockets, connect those */
+		for (sock_to = node_to->inputs.first; sock_to; sock_to=sock_to->next) {
+			if (sock_to->flag & SELECT) {
+				has_selected_inputs = 1;
+				
+				if (!socket_is_available(ntree, sock_to, replace))
+					continue;
+				
+				/* check for an appropriate output socket to connect from */
+				sock_fr = best_socket_output(ntree, node_fr, sock_to, allow_multiple);
+				if (!sock_fr)
+					continue;
+	
+				if (snode_autoconnect_input(snode, node_fr, sock_fr, node_to, sock_to, replace))
+					++numlinks;
 			}
+		}
+		
+		if (!has_selected_inputs) {
+			/* no selected inputs, connect by finding suitable match */
+			int num_inputs = BLI_countlist(&node_to->inputs);
 			
-			snode_update(snode, node_to);
-			++numlinks;
-			break;
+			for (i=0; i<num_inputs; i++) {
+				
+				/* find the best guess input socket */
+				sock_to = best_socket_input(ntree, node_to, i, replace);
+				if (!sock_to)
+					continue;
+				
+				/* check for an appropriate output socket to connect from */
+				sock_fr = best_socket_output(ntree, node_fr, sock_to, allow_multiple);
+				if (!sock_fr)
+					continue;
+	
+				if (snode_autoconnect_input(snode, node_fr, sock_fr, node_to, sock_to, replace)) {
+					++numlinks;
+					break;
+				}
+			}
 		}
 	}
 	
 	if (numlinks > 0) {
-		ntreeUpdateTree(snode->edittree);
+		ntreeUpdateTree(ntree);
 	}
 	
 	BLI_freelistN(nodelist);
@@ -2081,13 +2119,13 @@ bNode *node_add_node(SpaceNode *snode, Main *bmain, Scene *scene, bNodeTemplate
 	node = nodeAddNode(snode->edittree, ntemp);
 	
 	/* generics */
-	if(node) {
+	if (node) {
 		node->locx= locx;
 		node->locy= locy + 60.0f;		// arbitrary.. so its visible, (0,0) is top of node
-		node->flag |= SELECT;
+		node_select(node);
 		
 		gnode= node_tree_get_editgroup(snode->nodetree);
-		if(gnode) {
+		if (gnode) {
 			node->locx -= gnode->locx;
 			node->locy -= gnode->locy;
 		}
@@ -2095,24 +2133,24 @@ bNode *node_add_node(SpaceNode *snode, Main *bmain, Scene *scene, bNodeTemplate
 		ntreeUpdateTree(snode->edittree);
 		ED_node_set_active(bmain, snode->edittree, node);
 		
-		if(snode->nodetree->type==NTREE_COMPOSIT) {
-			if(ELEM4(node->type, CMP_NODE_R_LAYERS, CMP_NODE_COMPOSITE, CMP_NODE_DEFOCUS, CMP_NODE_OUTPUT_FILE)) {
+		if (snode->nodetree->type==NTREE_COMPOSIT) {
+			if (ELEM4(node->type, CMP_NODE_R_LAYERS, CMP_NODE_COMPOSITE, CMP_NODE_DEFOCUS, CMP_NODE_OUTPUT_FILE)) {
 				node->id = &scene->id;
 			}
-			else if(ELEM3(node->type, CMP_NODE_MOVIECLIP, CMP_NODE_MOVIEDISTORTION, CMP_NODE_STABILIZE2D)) {
+			else if (ELEM3(node->type, CMP_NODE_MOVIECLIP, CMP_NODE_MOVIEDISTORTION, CMP_NODE_STABILIZE2D)) {
 				node->id = (ID *)scene->clip;
 			}
 			
 			ntreeCompositForceHidden(snode->edittree, scene);
 		}
 			
-		if(node->id)
+		if (node->id)
 			id_us_plus(node->id);
 			
 		snode_update(snode, node);
 	}
 	
-	if(snode->nodetree->type==NTREE_TEXTURE) {
+	if (snode->nodetree->type==NTREE_TEXTURE) {
 		ntreeTexCheckCyclics(snode->edittree);
 	}
 	
@@ -2132,12 +2170,12 @@ static int node_duplicate_exec(bContext *C, wmOperator *op)
 	ED_preview_kill_jobs(C);
 	
 	lastnode = ntree->nodes.last;
-	for(node= ntree->nodes.first; node; node= node->next) {
-		if(node->flag & SELECT) {
+	for (node= ntree->nodes.first; node; node= node->next) {
+		if (node->flag & SELECT) {
 			newnode = nodeCopyNode(ntree, node);
 			
-			if(newnode->id) {
-				/* simple id user adjustment, node internal functions dont touch this
+			if (newnode->id) {
+				/* simple id user adjustment, node internal functions don't touch this
 				 * but operators and readfile.c do. */
 				id_us_plus(newnode->id);
 				/* to ensure redraws or rerenders happen */
@@ -2158,8 +2196,9 @@ static int node_duplicate_exec(bContext *C, wmOperator *op)
 		/* This creates new links between copied nodes.
 		 * If keep_inputs is set, also copies input links from unselected (when fromnode==NULL)!
 		 */
-		if (link->tonode && (link->tonode->flag & NODE_SELECT)
-			&& (keep_inputs || (link->fromnode && (link->fromnode->flag & NODE_SELECT)))) {
+		if (link->tonode && (link->tonode->flag & NODE_SELECT) &&
+		    (keep_inputs || (link->fromnode && (link->fromnode->flag & NODE_SELECT))))
+		{
 			newlink = MEM_callocN(sizeof(bNodeLink), "bNodeLink");
 			newlink->flag = link->flag;
 			newlink->tonode = link->tonode->new_node;
@@ -2183,13 +2222,14 @@ static int node_duplicate_exec(bContext *C, wmOperator *op)
 	}
 	
 	/* deselect old nodes, select the copies instead */
-	for(node= ntree->nodes.first; node; node= node->next) {
-		if(node->flag & SELECT) {
+	for (node= ntree->nodes.first; node; node= node->next) {
+		if (node->flag & SELECT) {
 			/* has been set during copy above */
 			newnode = node->new_node;
 			
-			node->flag &= ~(NODE_SELECT|NODE_ACTIVE);
-			newnode->flag |= NODE_SELECT;
+			node_deselect(node);
+			node->flag &= ~NODE_ACTIVE;
+			node_select(newnode);
 		}
 		
 		/* make sure we don't copy new nodes again! */
@@ -2208,16 +2248,16 @@ static int node_duplicate_exec(bContext *C, wmOperator *op)
 void NODE_OT_duplicate(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Duplicate Nodes";
+	ot->name = "Duplicate Nodes";
 	ot->description = "Duplicate selected nodes";
-	ot->idname= "NODE_OT_duplicate";
+	ot->idname = "NODE_OT_duplicate";
 	
 	/* api callbacks */
-	ot->exec= node_duplicate_exec;
-	ot->poll= ED_operator_node_active;
+	ot->exec = node_duplicate_exec;
+	ot->poll = ED_operator_node_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	RNA_def_boolean(ot->srna, "keep_inputs", 0, "Keep Inputs", "Keep the input links to duplicated nodes");
 }
@@ -2229,24 +2269,24 @@ static void node_remove_extra_links(SpaceNode *snode, bNodeSocket *tsock, bNodeL
 	bNodeLink *tlink;
 	bNodeSocket *sock;
 	
-	if(tsock && nodeCountSocketLinks(snode->edittree, link->tosock) > tsock->limit) {
+	if (tsock && nodeCountSocketLinks(snode->edittree, link->tosock) > tsock->limit) {
 		
-		for(tlink= snode->edittree->links.first; tlink; tlink= tlink->next) {
-			if(link!=tlink && tlink->tosock==link->tosock)
+		for (tlink= snode->edittree->links.first; tlink; tlink= tlink->next) {
+			if (link!=tlink && tlink->tosock==link->tosock)
 				break;
 		}
-		if(tlink) {
+		if (tlink) {
 			/* try to move the existing link to the next available socket */
 			if (tlink->tonode) {
 				/* is there a free input socket with the target type? */
-				for(sock= tlink->tonode->inputs.first; sock; sock= sock->next) {
-					if(sock->type==tlink->tosock->type)
-						if(nodeCountSocketLinks(snode->edittree, sock) < sock->limit)
+				for (sock= tlink->tonode->inputs.first; sock; sock= sock->next) {
+					if (sock->type==tlink->tosock->type)
+						if (nodeCountSocketLinks(snode->edittree, sock) < sock->limit)
 							break;
 				}
-				if(sock) {
+				if (sock) {
 					tlink->tosock= sock;
-					sock->flag &= ~(SOCK_HIDDEN|SOCK_AUTO_HIDDEN);
+					sock->flag &= ~SOCK_HIDDEN;
 				}
 				else {
 					nodeRemLink(snode->edittree, tlink);
@@ -2254,6 +2294,8 @@ static void node_remove_extra_links(SpaceNode *snode, bNodeSocket *tsock, bNodeL
 			}
 			else
 				nodeRemLink(snode->edittree, tlink);
+			
+			snode->edittree->update |= NTREE_UPDATE_LINKS;
 		}
 	}
 }
@@ -2281,10 +2323,13 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
 	switch (event->type) {
 		case MOUSEMOVE:
 			
-			if(in_out==SOCK_OUT) {
-				if(find_indicated_socket(snode, &tnode, &tsock, SOCK_IN)) {
-					if(nodeFindLink(snode->edittree, sock, tsock)==NULL) {
-						if( link->tosock!= tsock && (!tnode || (tnode!=node && link->tonode!=tnode)) ) {
+			if (in_out==SOCK_OUT) {
+				/* only target socket becomes hilighted */
+				node_deselect_all_input_sockets(snode, 0);
+				
+				if (node_find_indicated_socket(snode, &tnode, &tsock, SOCK_IN)) {
+					if (nodeFindLink(snode->edittree, sock, tsock)==NULL) {
+						if ( link->tosock!= tsock && (!tnode || (tnode!=node && link->tonode!=tnode)) ) {
 							link->tonode= tnode;
 							link->tosock= tsock;
 							if (link->prev==NULL && link->next==NULL) {
@@ -2295,6 +2340,9 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
 							ntreeUpdateTree(snode->edittree);
 						}
 					}
+					
+					/* hilight target socket */
+					node_socket_select(tnode, tsock);
 				}
 				else {
 					if (link->tonode || link->tosock) {
@@ -2309,10 +2357,13 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
 				}
 			}
 			else {
-				if(find_indicated_socket(snode, &tnode, &tsock, SOCK_OUT)) {
-					if(nodeFindLink(snode->edittree, sock, tsock)==NULL) {
-						if(nodeCountSocketLinks(snode->edittree, tsock) < tsock->limit) {
-							if( link->fromsock!= tsock && (!tnode || (tnode!=node && link->fromnode!=tnode)) ) {
+				/* only target socket becomes hilighted */
+				node_deselect_all_output_sockets(snode, 0);
+				
+				if (node_find_indicated_socket(snode, &tnode, &tsock, SOCK_OUT)) {
+					if (nodeFindLink(snode->edittree, sock, tsock)==NULL) {
+						if (nodeCountSocketLinks(snode->edittree, tsock) < tsock->limit) {
+							if ( link->fromsock!= tsock && (!tnode || (tnode!=node && link->fromnode!=tnode)) ) {
 								link->fromnode= tnode;
 								link->fromsock= tsock;
 								if (link->prev==NULL && link->next==NULL) {
@@ -2324,6 +2375,9 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
 							}
 						}
 					}
+					
+					/* hilight target socket */
+					node_socket_select(tnode, tsock);
 				}
 				else {
 					if (link->tonode || link->tosock) {
@@ -2336,22 +2390,25 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
 					}
 				}
 			}
-			/* hilight target sockets only */
-			node_socket_hilights(snode, in_out==SOCK_OUT?SOCK_IN:SOCK_OUT);
+			
 			ED_region_tag_redraw(ar);
 			break;
 			
 		case LEFTMOUSE:
 		case RIGHTMOUSE:
 		case MIDDLEMOUSE:
-			if(link->tosock && link->fromsock) {
+			if (link->tosock && link->fromsock) {
 				/* send changed events for original tonode and new */
 				snode_update(snode, link->tonode);
 				
 				/* we might need to remove a link */
-				if(in_out==SOCK_OUT)
+				if (in_out==SOCK_OUT)
 					node_remove_extra_links(snode, link->tosock, link);
 				
+				/* deselect sockets after successful linking */
+				node_deselect_all_input_sockets(snode, 0);
+				node_deselect_all_output_sockets(snode, 0);
+				
 				/* when linking to group outputs, update the socket type */
 				/* XXX this should all be part of a generic update system */
 				if (!link->tonode) {
@@ -2376,6 +2433,10 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
 					}
 					snode->edittree->update |= NTREE_UPDATE_GROUP_OUT | NTREE_UPDATE_LINKS;
 				}
+				
+				/* deselect sockets after successful linking */
+				node_deselect_all_input_sockets(snode, 0);
+				node_deselect_all_output_sockets(snode, 0);
 			}
 			else
 				nodeRemLink(snode->edittree, link);
@@ -2397,49 +2458,58 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
 static int node_link_init(SpaceNode *snode, bNodeLinkDrag *nldrag)
 {
 	bNodeLink *link;
+	int in_out = 0;
 
 	/* output indicated? */
-	if(find_indicated_socket(snode, &nldrag->node, &nldrag->sock, SOCK_OUT)) {
-		if(nodeCountSocketLinks(snode->edittree, nldrag->sock) < nldrag->sock->limit)
-			return SOCK_OUT;
+	if (node_find_indicated_socket(snode, &nldrag->node, &nldrag->sock, SOCK_OUT)) {
+		if (nodeCountSocketLinks(snode->edittree, nldrag->sock) < nldrag->sock->limit)
+			in_out = SOCK_OUT;
 		else {
 			/* find if we break a link */
-			for(link= snode->edittree->links.first; link; link= link->next) {
-				if(link->fromsock==nldrag->sock)
+			for (link= snode->edittree->links.first; link; link= link->next) {
+				if (link->fromsock==nldrag->sock)
 					break;
 			}
-			if(link) {
+			if (link) {
 				nldrag->node= link->tonode;
 				nldrag->sock= link->tosock;
 				nodeRemLink(snode->edittree, link);
-				return SOCK_IN;
+				in_out = SOCK_IN;
 			}
 		}
+		
+		/* hilight source socket only */
+		node_deselect_all_output_sockets(snode, 0);
+		node_socket_select(nldrag->node, nldrag->sock);
 	}
 	/* or an input? */
-	else if(find_indicated_socket(snode, &nldrag->node, &nldrag->sock, SOCK_IN)) {
-		if(nodeCountSocketLinks(snode->edittree, nldrag->sock) < nldrag->sock->limit)
-			return SOCK_IN;
+	else if (node_find_indicated_socket(snode, &nldrag->node, &nldrag->sock, SOCK_IN)) {
+		if (nodeCountSocketLinks(snode->edittree, nldrag->sock) < nldrag->sock->limit)
+			in_out = SOCK_IN;
 		else {
 			/* find if we break a link */
-			for(link= snode->edittree->links.first; link; link= link->next) {
-				if(link->tosock==nldrag->sock)
+			for (link= snode->edittree->links.first; link; link= link->next) {
+				if (link->tosock==nldrag->sock)
 					break;
 			}
-			if(link) {
+			if (link) {
 				/* send changed event to original tonode */
-				if(link->tonode) 
+				if (link->tonode)
 					snode_update(snode, link->tonode);
 				
 				nldrag->node= link->fromnode;
 				nldrag->sock= link->fromsock;
 				nodeRemLink(snode->edittree, link);
-				return SOCK_OUT;
+				in_out = SOCK_OUT;
 			}
 		}
+		
+		/* hilight source socket only */
+		node_deselect_all_input_sockets(snode, 0);
+		node_socket_select(nldrag->node, nldrag->sock);
 	}
 	
-	return 0;
+	return in_out;
 }
 
 static int node_link_invoke(bContext *C, wmOperator *op, wmEvent *event)
@@ -2456,11 +2526,11 @@ static int node_link_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 	nldrag->in_out= node_link_init(snode, nldrag);
 	
-	if(nldrag->in_out) {
+	if (nldrag->in_out) {
 		op->customdata= nldrag;
 		
 		/* we make a temporal link */
-		if(nldrag->in_out==SOCK_OUT) {
+		if (nldrag->in_out==SOCK_OUT) {
 			nldrag->link= MEM_callocN(sizeof(bNodeLink), "link");
 			nldrag->link->fromnode= nldrag->node;
 			nldrag->link->fromsock= nldrag->sock;
@@ -2502,18 +2572,18 @@ static int node_link_cancel(bContext *C, wmOperator *op)
 void NODE_OT_link(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Link Nodes";
-	ot->idname= "NODE_OT_link";
+	ot->name = "Link Nodes";
+	ot->idname = "NODE_OT_link";
 	
 	/* api callbacks */
-	ot->invoke= node_link_invoke;
-	ot->modal= node_link_modal;
-//	ot->exec= node_link_exec;
-	ot->poll= ED_operator_node_active;
-	ot->cancel= node_link_cancel;
+	ot->invoke = node_link_invoke;
+	ot->modal = node_link_modal;
+//	ot->exec = node_link_exec;
+	ot->poll = ED_operator_node_active;
+	ot->cancel = node_link_cancel;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
 }
 
 /* ********************** Make Link operator ***************** */
@@ -2528,6 +2598,10 @@ static int node_make_link_exec(bContext *C, wmOperator *op)
 
 	snode_autoconnect(snode, 1, replace);
 
+	/* deselect sockets after linking */
+	node_deselect_all_input_sockets(snode, 0);
+	node_deselect_all_output_sockets(snode, 0);
+
 	ntreeUpdateTree(snode->edittree);
 	snode_notify(C, snode);
 	snode_dag_update(C, snode);
@@ -2538,16 +2612,16 @@ static int node_make_link_exec(bContext *C, wmOperator *op)
 void NODE_OT_link_make(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Make Links";
-	ot->description= "Makes a link between selected output in input sockets";
-	ot->idname= "NODE_OT_link_make";
+	ot->name = "Make Links";
+	ot->description = "Makes a link between selected output in input sockets";
+	ot->idname = "NODE_OT_link_make";
 	
 	/* callbacks */
-	ot->exec= node_make_link_exec;
-	ot->poll= ED_operator_node_active; // XXX we need a special poll which checks that there are selected input/output sockets
+	ot->exec = node_make_link_exec;
+	ot->poll = ED_operator_node_active; // XXX we need a special poll which checks that there are selected input/output sockets
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	RNA_def_boolean(ot->srna, "replace", 0, "Replace", "Replace socket connections with the new links");
 }
@@ -2560,11 +2634,11 @@ static int cut_links_intersect(bNodeLink *link, float mcoords[][2], int tot)
 	float coord_array[LINK_RESOL+1][2];
 	int i, b;
 	
-	if(node_link_bezier_points(NULL, NULL, link, coord_array, LINK_RESOL)) {
+	if (node_link_bezier_points(NULL, NULL, link, coord_array, LINK_RESOL)) {
 
-		for(i=0; i<tot-1; i++)
-			for(b=0; b<LINK_RESOL; b++)
-				if(isect_line_line_v2(mcoords[i], mcoords[i+1], coord_array[b], coord_array[b+1]) > 0)
+		for (i=0; i<tot-1; i++)
+			for (b=0; b<LINK_RESOL; b++)
+				if (isect_line_line_v2(mcoords[i], mcoords[i+1], coord_array[b], coord_array[b+1]) > 0)
 					return 1;
 	}
 	return 0;
@@ -2584,19 +2658,19 @@ static int cut_links_exec(bContext *C, wmOperator *op)
 		UI_view2d_region_to_view(&ar->v2d, (short)loc[0], (short)loc[1], 
 								 &mcoords[i][0], &mcoords[i][1]);
 		i++;
-		if(i>= 256) break;
+		if (i>= 256) break;
 	}
 	RNA_END;
 	
-	if(i>1) {
+	if (i>1) {
 		bNodeLink *link, *next;
 
 		ED_preview_kill_jobs(C);
 		
-		for(link= snode->edittree->links.first; link; link= next) {
+		for (link= snode->edittree->links.first; link; link= next) {
 			next= link->next;
 			
-			if(cut_links_intersect(link, mcoords, i)) {
+			if (cut_links_intersect(link, mcoords, i)) {
 				snode_update(snode, link->tonode);
 				nodeRemLink(snode->edittree, link);
 			}
@@ -2616,18 +2690,18 @@ void NODE_OT_links_cut(wmOperatorType *ot)
 {
 	PropertyRNA *prop;
 	
-	ot->name= "Cut links";
-	ot->idname= "NODE_OT_links_cut";
+	ot->name = "Cut links";
+	ot->idname = "NODE_OT_links_cut";
 	
-	ot->invoke= WM_gesture_lines_invoke;
-	ot->modal= WM_gesture_lines_modal;
-	ot->exec= cut_links_exec;
-	ot->cancel= WM_gesture_lines_cancel;
+	ot->invoke = WM_gesture_lines_invoke;
+	ot->modal = WM_gesture_lines_modal;
+	ot->exec = cut_links_exec;
+	ot->cancel = WM_gesture_lines_cancel;
 	
-	ot->poll= ED_operator_node_active;
+	ot->poll = ED_operator_node_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	prop= RNA_def_property(ot->srna, "path", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_runtime(prop, &RNA_OperatorMousePath);
@@ -2635,37 +2709,74 @@ void NODE_OT_links_cut(wmOperatorType *ot)
 	RNA_def_int(ot->srna, "cursor", BC_KNIFECURSOR, 0, INT_MAX, "Cursor", "", 0, INT_MAX);
 }
 
+/* ********************** Detach links operator ***************** */
+
+static int detach_links_exec(bContext *C, wmOperator *UNUSED(op))
+{
+	SpaceNode *snode= CTX_wm_space_node(C);
+	bNodeTree *ntree= snode->edittree;
+	bNode *node;
+	
+	ED_preview_kill_jobs(C);
+	
+	for (node= ntree->nodes.first; node; node= node->next) {
+		if (node->flag & SELECT) {
+			nodeInternalRelink(ntree, node);
+		}
+	}
+	
+	ntreeUpdateTree(ntree);
+	
+	snode_notify(C, snode);
+	snode_dag_update(C, snode);
+
+	return OPERATOR_FINISHED;
+}
+
+void NODE_OT_links_detach(wmOperatorType *ot)
+{
+	ot->name = "Detach Links";
+	ot->idname = "NODE_OT_links_detach";
+	
+	ot->exec = detach_links_exec;
+	ot->poll = ED_operator_node_active;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
 /* *********************  automatic node insert on dragging ******************* */
 
 /* assumes sockets in list */
-static bNodeSocket *socket_best_match(ListBase *sockets, int type)
+static bNodeSocket *socket_best_match(ListBase *sockets)
 {
 	bNodeSocket *sock;
+	int type, maxtype=0;
 	
-	/* first, match type */
-	for(sock= sockets->first; sock; sock= sock->next)
-		if(!nodeSocketIsHidden(sock))
-			if(type == sock->type)
-				return sock;
+	/* find type range */
+	for (sock=sockets->first; sock; sock=sock->next)
+		maxtype = MAX2(sock->type, maxtype);
 	
-	/* then just use first unhidden socket */
-	for(sock= sockets->first; sock; sock= sock->next)
-		if(!nodeSocketIsHidden(sock))
-			return sock;
-
-	/* OK, let's unhide proper one */
-	for(sock= sockets->first; sock; sock= sock->next) {
-		if(type == sock->type) {
-			sock->flag &= ~(SOCK_HIDDEN|SOCK_AUTO_HIDDEN);
-			return sock;
+	/* try all types, starting from 'highest' (i.e. colors, vectors, values) */
+	for (type=maxtype; type >= 0; --type) {
+		for (sock= sockets->first; sock; sock= sock->next) {
+			if (!nodeSocketIsHidden(sock) && type==sock->type) {
+				return sock;
+			}
 		}
 	}
 	
-	/* just the first */
-	sock= sockets->first;
-	sock->flag &= ~(SOCK_HIDDEN|SOCK_AUTO_HIDDEN);
+	/* no visible sockets, unhide first of highest type */
+	for (type=maxtype; type >= 0; --type) {
+		for (sock= sockets->first; sock; sock= sock->next) {
+			if (type==sock->type) {
+				sock->flag &= ~SOCK_HIDDEN;
+				return sock;
+			}
+		}
+	}
 	
-	return sockets->first;
+	return NULL;
 }
 
 /* prevent duplicate testing code below */
@@ -2676,27 +2787,27 @@ static SpaceNode *ed_node_link_conditions(ScrArea *sa, bNode **select)
 	bNodeLink *link;
 	
 	/* no unlucky accidents */
-	if(sa==NULL || sa->spacetype!=SPACE_NODE) return NULL;
+	if (sa==NULL || sa->spacetype!=SPACE_NODE) return NULL;
 	
 	*select= NULL;
 	
-	for(node= snode->edittree->nodes.first; node; node= node->next) {
-		if(node->flag & SELECT) {
-			if(*select)
+	for (node= snode->edittree->nodes.first; node; node= node->next) {
+		if (node->flag & SELECT) {
+			if (*select)
 				break;
 			else
 				*select= node;
 		}
 	}
 	/* only one selected */
-	if(node || *select==NULL) return NULL;
+	if (node || *select==NULL) return NULL;
 	
 	/* correct node */
-	if((*select)->inputs.first==NULL || (*select)->outputs.first==NULL) return NULL;
+	if ((*select)->inputs.first==NULL || (*select)->outputs.first==NULL) return NULL;
 	
 	/* test node for links */
-	for(link= snode->edittree->links.first; link; link=link->next) {
-		if(link->tonode == *select || link->fromnode == *select)
+	for (link= snode->edittree->links.first; link; link=link->next) {
+		if (link->tonode == *select || link->fromnode == *select)
 			return NULL;
 	}
 	
@@ -2711,22 +2822,22 @@ void ED_node_link_insert(ScrArea *sa)
 	bNodeLink *link;
 	bNodeSocket *sockto;
 	
-	if(snode==NULL) return;
+	if (snode==NULL) return;
 	
 	/* get the link */
-	for(link= snode->edittree->links.first; link; link=link->next)
-		if(link->flag & NODE_LINKFLAG_HILITE)
+	for (link= snode->edittree->links.first; link; link=link->next)
+		if (link->flag & NODE_LINKFLAG_HILITE)
 			break;
 	
-	if(link) {
+	if (link) {
 		node= link->tonode;
 		sockto= link->tosock;
 		
 		link->tonode= select;
-		link->tosock= socket_best_match(&select->inputs, link->fromsock->type);
+		link->tosock= socket_best_match(&select->inputs);
 		link->flag &= ~NODE_LINKFLAG_HILITE;
 		
-		nodeAddLink(snode->edittree, select, socket_best_match(&select->outputs, sockto->type), node, sockto);
+		nodeAddLink(snode->edittree, select, socket_best_match(&select->outputs), node, sockto);
 		ntreeUpdateTree(snode->edittree);	/* needed for pointers */
 		snode_update(snode, select);
 		ED_node_changed_update(snode->id, select);
@@ -2742,13 +2853,13 @@ void ED_node_link_intersect_test(ScrArea *sa, int test)
 	bNodeLink *link, *selink=NULL;
 	float mcoords[6][2];
 	
-	if(snode==NULL) return;
+	if (snode==NULL) return;
 	
 	/* clear flags */
-	for(link= snode->edittree->links.first; link; link=link->next)
+	for (link= snode->edittree->links.first; link; link=link->next)
 		link->flag &= ~NODE_LINKFLAG_HILITE;
 	
-	if(test==0) return;
+	if (test==0) return;
 	
 	/* okay, there's 1 node, without links, now intersect */
 	mcoords[0][0]= select->totr.xmin;
@@ -2766,16 +2877,16 @@ void ED_node_link_intersect_test(ScrArea *sa, int test)
 	
 	/* we only tag a single link for intersect now */
 	/* idea; use header dist when more? */
-	for(link= snode->edittree->links.first; link; link=link->next) {
+	for (link= snode->edittree->links.first; link; link=link->next) {
 		
-		if(cut_links_intersect(link, mcoords, 5)) { /* intersect code wants edges */
-			if(selink) 
+		if (cut_links_intersect(link, mcoords, 5)) { /* intersect code wants edges */
+			if (selink)
 				break;
 			selink= link;
 		}
 	}
 		
-	if(link==NULL && selink)
+	if (link==NULL && selink)
 		selink->flag |= NODE_LINKFLAG_HILITE;
 }
 
@@ -2795,13 +2906,13 @@ static int node_read_renderlayers_exec(bContext *C, wmOperator *UNUSED(op))
 	ED_preview_kill_jobs(C);
 
 	/* first tag scenes unread */
-	for(scene= bmain->scene.first; scene; scene= scene->id.next) 
+	for (scene= bmain->scene.first; scene; scene= scene->id.next)
 		scene->id.flag |= LIB_DOIT;
 
-	for(node= snode->edittree->nodes.first; node; node= node->next) {
-		if(node->type==CMP_NODE_R_LAYERS) {
+	for (node= snode->edittree->nodes.first; node; node= node->next) {
+		if (node->type==CMP_NODE_R_LAYERS) {
 			ID *id= node->id;
-			if(id->flag & LIB_DOIT) {
+			if (id->flag & LIB_DOIT) {
 				RE_ReadRenderResult(curscene, (Scene *)id);
 				ntreeCompositTagRender((Scene *)id);
 				id->flag &= ~LIB_DOIT;
@@ -2818,15 +2929,15 @@ static int node_read_renderlayers_exec(bContext *C, wmOperator *UNUSED(op))
 void NODE_OT_read_renderlayers(wmOperatorType *ot)
 {
 	
-	ot->name= "Read Render Layers";
-	ot->idname= "NODE_OT_read_renderlayers";
+	ot->name = "Read Render Layers";
+	ot->idname = "NODE_OT_read_renderlayers";
 	
-	ot->exec= node_read_renderlayers_exec;
+	ot->exec = node_read_renderlayers_exec;
 	
-	ot->poll= composite_node_active;
+	ot->poll = composite_node_active;
 	
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 }
 
 static int node_read_fullsamplelayers_exec(bContext *C, wmOperator *UNUSED(op))
@@ -2841,7 +2952,7 @@ static int node_read_fullsamplelayers_exec(bContext *C, wmOperator *UNUSED(op))
 	WM_cursor_wait(0);
 
 	/* note we are careful to send the right notifier, as otherwise the
-	   compositor would reexecute and overwrite the full sample result */
+	 * compositor would reexecute and overwrite the full sample result */
 	WM_event_add_notifier(C, NC_SCENE|ND_COMPO_RESULT, NULL);
 
 	return OPERATOR_FINISHED;
@@ -2851,15 +2962,15 @@ static int node_read_fullsamplelayers_exec(bContext *C, wmOperator *UNUSED(op))
 void NODE_OT_read_fullsamplelayers(wmOperatorType *ot)
 {
 	
-	ot->name= "Read Full Sample Layers";
-	ot->idname= "NODE_OT_read_fullsamplelayers";
+	ot->name = "Read Full Sample Layers";
+	ot->idname = "NODE_OT_read_fullsamplelayers";
 	
-	ot->exec= node_read_fullsamplelayers_exec;
+	ot->exec = node_read_fullsamplelayers_exec;
 	
-	ot->poll= composite_node_active;
+	ot->poll = composite_node_active;
 	
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 }
 
 int node_render_changed_exec(bContext *C, wmOperator *UNUSED(op))
@@ -2867,15 +2978,15 @@ int node_render_changed_exec(bContext *C, wmOperator *UNUSED(op))
 	Scene *sce= CTX_data_scene(C);
 	bNode *node;
 	
-	for(node= sce->nodetree->nodes.first; node; node= node->next) {
-		if(node->id==(ID *)sce && node->need_exec) {
+	for (node= sce->nodetree->nodes.first; node; node= node->next) {
+		if (node->id==(ID *)sce && node->need_exec) {
 			break;
 		}
 	}
-	if(node) {
+	if (node) {
 		SceneRenderLayer *srl= BLI_findlink(&sce->r.layers, node->custom1);
 		
-		if(srl) {
+		if (srl) {
 			PointerRNA op_ptr;
 			
 			WM_operator_properties_create(&op_ptr, "RENDER_OT_render");
@@ -2899,15 +3010,15 @@ int node_render_changed_exec(bContext *C, wmOperator *UNUSED(op))
 void NODE_OT_render_changed(wmOperatorType *ot)
 {
 	
-	ot->name= "Render Changed Layer";
-	ot->idname= "NODE_OT_render_changed";
+	ot->name = "Render Changed Layer";
+	ot->idname = "NODE_OT_render_changed";
 	
-	ot->exec= node_render_changed_exec;
+	ot->exec = node_render_changed_exec;
 	
-	ot->poll= composite_node_active;
+	ot->poll = composite_node_active;
 	
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 }
 
 
@@ -2918,20 +3029,20 @@ static int node_group_make_exec(bContext *C, wmOperator *op)
 	SpaceNode *snode = CTX_wm_space_node(C);
 	bNode *gnode;
 	
-	if(snode->edittree!=snode->nodetree) {
+	if (snode->edittree!=snode->nodetree) {
 		BKE_report(op->reports, RPT_WARNING, "Can not add a new Group in a Group");
 		return OPERATOR_CANCELLED;
 	}
 	
 	/* for time being... is too complex to handle */
-	if(snode->treetype==NTREE_COMPOSIT) {
-		for(gnode=snode->nodetree->nodes.first; gnode; gnode= gnode->next) {
-			if(gnode->flag & SELECT)
-				if(gnode->type==CMP_NODE_R_LAYERS)
+	if (snode->treetype==NTREE_COMPOSIT) {
+		for (gnode=snode->nodetree->nodes.first; gnode; gnode= gnode->next) {
+			if (gnode->flag & SELECT)
+				if (gnode->type==CMP_NODE_R_LAYERS)
 					break;
 		}
 		
-		if(gnode) {
+		if (gnode) {
 			BKE_report(op->reports, RPT_WARNING, "Can not add RenderLayer in a Group");
 			return OPERATOR_CANCELLED;
 		}
@@ -2940,7 +3051,7 @@ static int node_group_make_exec(bContext *C, wmOperator *op)
 	ED_preview_kill_jobs(C);
 	
 	gnode= node_group_make_from_selected(snode->nodetree);
-	if(gnode==NULL) {
+	if (gnode==NULL) {
 		BKE_report(op->reports, RPT_WARNING, "Can not make Group");
 		return OPERATOR_CANCELLED;
 	}
@@ -2981,42 +3092,32 @@ static void node_flag_toggle_exec(SpaceNode *snode, int toggle_flag)
 	 * If the flag is set on all nodes it is unset.
 	 * If the flag is not set on all nodes, it is set.
 	 */
-	for(node= snode->edittree->nodes.first; node; node= node->next) {
-		if(node->flag & SELECT) {
+	for (node= snode->edittree->nodes.first; node; node= node->next) {
+		if (node->flag & SELECT) {
 			
-			if(toggle_flag== NODE_PREVIEW && (node->typeinfo->flag & NODE_PREVIEW)==0)
+			if (toggle_flag== NODE_PREVIEW && (node->typeinfo->flag & NODE_PREVIEW)==0)
 				continue;
-			if(toggle_flag== NODE_OPTIONS && (node->typeinfo->flag & NODE_OPTIONS)==0)
+			if (toggle_flag== NODE_OPTIONS && (node->typeinfo->flag & NODE_OPTIONS)==0)
 				continue;
 			
-			if(node->flag & toggle_flag)
+			if (node->flag & toggle_flag)
 				tot_eq++;
 			else
 				tot_neq++;
 		}
 	}
-	for(node= snode->edittree->nodes.first; node; node= node->next) {
-		if(node->flag & SELECT) {
+	for (node= snode->edittree->nodes.first; node; node= node->next) {
+		if (node->flag & SELECT) {
 			
-			if(toggle_flag== NODE_PREVIEW && (node->typeinfo->flag & NODE_PREVIEW)==0)
+			if (toggle_flag== NODE_PREVIEW && (node->typeinfo->flag & NODE_PREVIEW)==0)
 				continue;
-			if(toggle_flag== NODE_OPTIONS && (node->typeinfo->flag & NODE_OPTIONS)==0)
+			if (toggle_flag== NODE_OPTIONS && (node->typeinfo->flag & NODE_OPTIONS)==0)
 				continue;
 			
-			if( (tot_eq && tot_neq) || tot_eq==0) {
+			if ( (tot_eq && tot_neq) || tot_eq==0)
 				node->flag |= toggle_flag;
-				
-				/* hide/unhide node also toggles unlinked socket display */
-				if (toggle_flag== NODE_HIDDEN)
-					node_set_hidden_sockets(snode, node, SOCK_AUTO_HIDDEN, 1);
-			}
-			else {
+			else
 				node->flag &= ~toggle_flag;
-				
-				/* hide/unhide node also toggles unlinked socket display */
-				if (toggle_flag== NODE_HIDDEN)
-					node_set_hidden_sockets(snode, node, SOCK_AUTO_HIDDEN, 0);
-			}
 		}
 	}
 }
@@ -3026,7 +3127,7 @@ static int node_hide_toggle_exec(bContext *C, wmOperator *UNUSED(op))
 	SpaceNode *snode= CTX_wm_space_node(C);
 	
 	/* sanity checking (poll callback checks this already) */
-	if((snode == NULL) || (snode->edittree == NULL))
+	if ((snode == NULL) || (snode->edittree == NULL))
 		return OPERATOR_CANCELLED;
 	
 	node_flag_toggle_exec(snode, NODE_HIDDEN);
@@ -3039,16 +3140,16 @@ static int node_hide_toggle_exec(bContext *C, wmOperator *UNUSED(op))
 void NODE_OT_hide_toggle(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Hide";
-	ot->description= "Toggle hiding of selected nodes";
-	ot->idname= "NODE_OT_hide_toggle";
+	ot->name = "Hide";
+	ot->description = "Toggle hiding of selected nodes";
+	ot->idname = "NODE_OT_hide_toggle";
 	
 	/* callbacks */
-	ot->exec= node_hide_toggle_exec;
-	ot->poll= ED_operator_node_active;
+	ot->exec = node_hide_toggle_exec;
+	ot->poll = ED_operator_node_active;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int node_preview_toggle_exec(bContext *C, wmOperator *UNUSED(op))
@@ -3056,7 +3157,7 @@ static int node_preview_toggle_exec(bContext *C, wmOperator *UNUSED(op))
 	SpaceNode *snode= CTX_wm_space_node(C);
 
 	/* sanity checking (poll callback checks this already) */
-	if((snode == NULL) || (snode->edittree == NULL))
+	if ((snode == NULL) || (snode->edittree == NULL))
 		return OPERATOR_CANCELLED;
 
 	ED_preview_kill_jobs(C);
@@ -3071,16 +3172,16 @@ static int node_preview_toggle_exec(bContext *C, wmOperator *UNUSED(op))
 void NODE_OT_preview_toggle(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Toggle Node Preview";
-	ot->description= "Toggle preview display for selected nodes";
-	ot->idname= "NODE_OT_preview_toggle";
+	ot->name = "Toggle Node Preview";
+	ot->description = "Toggle preview display for selected nodes";
+	ot->idname = "NODE_OT_preview_toggle";
 
 	/* callbacks */
-	ot->exec= node_preview_toggle_exec;
-	ot->poll= ED_operator_node_active;
+	ot->exec = node_preview_toggle_exec;
+	ot->poll = ED_operator_node_active;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int node_options_toggle_exec(bContext *C, wmOperator *UNUSED(op))
@@ -3088,7 +3189,7 @@ static int node_options_toggle_exec(bContext *C, wmOperator *UNUSED(op))
 	SpaceNode *snode= CTX_wm_space_node(C);
 
 	/* sanity checking (poll callback checks this already) */
-	if((snode == NULL) || (snode->edittree == NULL))
+	if ((snode == NULL) || (snode->edittree == NULL))
 		return OPERATOR_CANCELLED;
 
 	node_flag_toggle_exec(snode, NODE_OPTIONS);
@@ -3101,16 +3202,16 @@ static int node_options_toggle_exec(bContext *C, wmOperator *UNUSED(op))
 void NODE_OT_options_toggle(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Toggle Node Options";
-	ot->description= "Toggle option buttons display for selected nodes";
-	ot->idname= "NODE_OT_options_toggle";
+	ot->name = "Toggle Node Options";
+	ot->description = "Toggle option buttons display for selected nodes";
+	ot->idname = "NODE_OT_options_toggle";
 
 	/* callbacks */
-	ot->exec= node_options_toggle_exec;
-	ot->poll= ED_operator_node_active;
+	ot->exec = node_options_toggle_exec;
+	ot->poll = ED_operator_node_active;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 static int node_socket_toggle_exec(bContext *C, wmOperator *UNUSED(op))
@@ -3120,25 +3221,25 @@ static int node_socket_toggle_exec(bContext *C, wmOperator *UNUSED(op))
 	int hidden;
 
 	/* sanity checking (poll callback checks this already) */
-	if((snode == NULL) || (snode->edittree == NULL))
+	if ((snode == NULL) || (snode->edittree == NULL))
 		return OPERATOR_CANCELLED;
 
 	ED_preview_kill_jobs(C);
 
 	/* Toggle for all selected nodes */
 	hidden = 0;
-	for(node= snode->edittree->nodes.first; node; node= node->next) {
-		if(node->flag & SELECT) {
-			if(node_has_hidden_sockets(node, SOCK_HIDDEN)) {
+	for (node= snode->edittree->nodes.first; node; node= node->next) {
+		if (node->flag & SELECT) {
+			if (node_has_hidden_sockets(node)) {
 				hidden= 1;
 				break;
 			}
 		}
 	}
 	
-	for(node= snode->edittree->nodes.first; node; node= node->next) {
-		if(node->flag & SELECT) {
-			node_set_hidden_sockets(snode, node, SOCK_HIDDEN, !hidden);
+	for (node= snode->edittree->nodes.first; node; node= node->next) {
+		if (node->flag & SELECT) {
+			node_set_hidden_sockets(snode, node, !hidden);
 		}
 	}
 
@@ -3152,16 +3253,16 @@ static int node_socket_toggle_exec(bContext *C, wmOperator *UNUSED(op))
 void NODE_OT_hide_socket_toggle(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Toggle Hidden Node Sockets";
-	ot->description= "Toggle unused node socket display";
-	ot->idname= "NODE_OT_hide_socket_toggle";
+	ot->name = "Toggle Hidden Node Sockets";
+	ot->description = "Toggle unused node socket display";
+	ot->idname = "NODE_OT_hide_socket_toggle";
 
 	/* callbacks */
-	ot->exec= node_socket_toggle_exec;
-	ot->poll= ED_operator_node_active;
+	ot->exec = node_socket_toggle_exec;
+	ot->poll = ED_operator_node_active;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ****************** Mute operator *********************** */
@@ -3173,13 +3274,11 @@ static int node_mute_exec(bContext *C, wmOperator *UNUSED(op))
 
 	ED_preview_kill_jobs(C);
 
-	for(node= snode->edittree->nodes.first; node; node= node->next) {
+	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->mutefunc) {
-			/* Be able to mute in-/output nodes as well.  - DingTo
-			if(node->inputs.first && node->outputs.first) { */
-				node->flag ^= NODE_MUTED;
-				snode_update(snode, node);
+		if ((node->flag & SELECT) && node->typeinfo->internal_connect) {
+			node->flag ^= NODE_MUTED;
+			snode_update(snode, node);
 		}
 	}
 	
@@ -3192,16 +3291,16 @@ static int node_mute_exec(bContext *C, wmOperator *UNUSED(op))
 void NODE_OT_mute_toggle(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Toggle Node Mute";
-	ot->description= "Toggle muting of the nodes";
-	ot->idname= "NODE_OT_mute_toggle";
+	ot->name = "Toggle Node Mute";
+	ot->description = "Toggle muting of the nodes";
+	ot->idname = "NODE_OT_mute_toggle";
 	
 	/* callbacks */
-	ot->exec= node_mute_exec;
-	ot->poll= ED_operator_node_active;
+	ot->exec = node_mute_exec;
+	ot->poll = ED_operator_node_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ****************** Delete operator ******************* */
@@ -3213,11 +3312,11 @@ static int node_delete_exec(bContext *C, wmOperator *UNUSED(op))
 	
 	ED_preview_kill_jobs(C);
 
-	for(node= snode->edittree->nodes.first; node; node= next) {
+	for (node= snode->edittree->nodes.first; node; node= next) {
 		next= node->next;
-		if(node->flag & SELECT) {
+		if (node->flag & SELECT) {
 			/* check id user here, nodeFreeNode is called for free dbase too */
-			if(node->id)
+			if (node->id)
 				node->id->us--;
 			nodeFreeNode(snode->edittree, node);
 		}
@@ -3234,131 +3333,19 @@ static int node_delete_exec(bContext *C, wmOperator *UNUSED(op))
 void NODE_OT_delete(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete";
+	ot->name = "Delete";
 	ot->description = "Delete selected nodes";
-	ot->idname= "NODE_OT_delete";
+	ot->idname = "NODE_OT_delete";
 	
 	/* api callbacks */
-	ot->exec= node_delete_exec;
-	ot->poll= ED_operator_node_active;
+	ot->exec = node_delete_exec;
+	ot->poll = ED_operator_node_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ****************** Delete with reconnect ******************* */
-static int is_connected_to_input_socket(bNode* node, bNodeLink* link)
-{
-	bNodeSocket *sock;
-	if (link->tonode == node) {
-		for(sock= node->inputs.first; sock; sock= sock->next) {
-			if (link->tosock == sock) {
-				return sock->type;
-			}
-		}		
-	}
-	return -1;
-}
-
-static void node_delete_reconnect(bNodeTree* tree, bNode* node) 
-{
-	bNodeLink *link, *next, *first = NULL;
-	bNodeSocket *valsocket= NULL, *colsocket= NULL, *vecsocket= NULL;
-	bNodeSocket *deliveringvalsocket= NULL, *deliveringcolsocket= NULL, *deliveringvecsocket= NULL;
-	bNode *deliveringvalnode= NULL, *deliveringcolnode= NULL, *deliveringvecnode= NULL;
-	bNodeSocket *sock;
-	int type;
-	int numberOfConnectedOutputSockets = 0;
-	int numberOfReconnections = 0;
-	int numberOfConnectedInputSockets = 0;
-
-	/* 
-		test the inputs, not really correct when a node has multiple input sockets of the same type
-		the first link evaluated will be used to determine the possible connection.
-	*/
-	for(link= tree->links.first; link; link=link->next) {
-		if (link->tonode == node)  { numberOfConnectedInputSockets++; }
-		type = is_connected_to_input_socket(node, link);
-		switch (type) {
-		case SOCK_RGBA:
-			if (colsocket == NULL) {
-				colsocket = link->tosock;
-				deliveringcolnode = link->fromnode;
-				deliveringcolsocket = link->fromsock;
-			}
-			break;
-		case SOCK_VECTOR:
-			if (vecsocket == NULL) {
-				vecsocket = link->tosock;
-				deliveringvecnode = link->fromnode;
-				deliveringvecsocket = link->fromsock;
-			}
-			break;
-		case SOCK_FLOAT:
-			if (valsocket == NULL) {
-				valsocket = link->tosock;
-				deliveringvalnode = link->fromnode;
-				deliveringvalsocket = link->fromsock;
-			}
-			break;
-		default:
-			break;
-		}
-	}
-	
-	// we now have the sockets+nodes that fill the inputsockets be aware for group nodes these can be NULL
-	// now make the links for all outputlinks of the node to be reconnected
-	for(link= tree->links.first; link; link=next) {
-		next= link->next;
-		if (link->fromnode == node) {
-			sock = link->fromsock;
-			numberOfConnectedOutputSockets ++;
-			if (!first) first = link;
-			switch(sock->type) {
-			case SOCK_FLOAT:
-				if (deliveringvalsocket) {
-					link->fromnode = deliveringvalnode;
-					link->fromsock = deliveringvalsocket;
-					numberOfReconnections++;
-				}
-				break;
-			case SOCK_VECTOR:
-				if (deliveringvecsocket) {
-					link->fromnode = deliveringvecnode;
-					link->fromsock = deliveringvecsocket;
-					numberOfReconnections++;
-				}
-				break;
-			case SOCK_RGBA:
-				if (deliveringcolsocket) {
-					link->fromnode = deliveringcolnode;
-					link->fromsock = deliveringcolsocket;
-					numberOfReconnections++;
-				}
-				break;
-			}
-		}
-	}
-
-	/* when no connections have been made, and if only one delivering input socket type and one output socket we will connect those two */
-	if (numberOfConnectedOutputSockets == 1 && numberOfReconnections == 0 && numberOfConnectedInputSockets == 1) {
-		if (deliveringcolsocket) {
-			first->fromnode = deliveringcolnode;
-			first->fromsock = deliveringcolsocket;
-		} else if (deliveringvecsocket) {
-			first->fromnode = deliveringvecnode;
-			first->fromsock = deliveringvecsocket;
-		} else if (deliveringvalsocket) {
-			first->fromnode = deliveringvalnode;
-			first->fromsock = deliveringvalsocket;
-		}
-	}
-
-	if(node->id)
-		node->id->us--;
-	nodeFreeNode(tree, node);
-}
-
 static int node_delete_reconnect_exec(bContext *C, wmOperator *UNUSED(op))
 {
 	SpaceNode *snode= CTX_wm_space_node(C);
@@ -3366,10 +3353,15 @@ static int node_delete_reconnect_exec(bContext *C, wmOperator *UNUSED(op))
 
 	ED_preview_kill_jobs(C);
 
-	for(node= snode->edittree->nodes.first; node; node= next) {
+	for (node= snode->edittree->nodes.first; node; node= next) {
 		next= node->next;
-		if(node->flag & SELECT) {
-			node_delete_reconnect(snode->edittree, node);
+		if (node->flag & SELECT) {
+			nodeInternalRelink(snode->edittree, node);
+			
+			/* check id user here, nodeFreeNode is called for free dbase too */
+			if (node->id)
+				node->id->us--;
+			nodeFreeNode(snode->edittree, node);
 		}
 	}
 
@@ -3384,16 +3376,16 @@ static int node_delete_reconnect_exec(bContext *C, wmOperator *UNUSED(op))
 void NODE_OT_delete_reconnect(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete with reconnect";
+	ot->name = "Delete with reconnect";
 	ot->description = "Delete nodes; will reconnect nodes as if deletion was muted";
-	ot->idname= "NODE_OT_delete_reconnect";
+	ot->idname = "NODE_OT_delete_reconnect";
 
 	/* api callbacks */
-	ot->exec= node_delete_reconnect_exec;
-	ot->poll= ED_operator_node_active;
+	ot->exec = node_delete_reconnect_exec;
+	ot->poll = ED_operator_node_active;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ****************** Show Cyclic Dependencies Operator  ******************* */
@@ -3412,16 +3404,16 @@ static int node_show_cycles_exec(bContext *C, wmOperator *UNUSED(op))
 void NODE_OT_show_cyclic_dependencies(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Show Cyclic Dependencies";
-	ot->description= "Sort the nodes and show the cyclic dependencies between the nodes";
-	ot->idname= "NODE_OT_show_cyclic_dependencies";
+	ot->name = "Show Cyclic Dependencies";
+	ot->description = "Sort the nodes and show the cyclic dependencies between the nodes";
+	ot->idname = "NODE_OT_show_cyclic_dependencies";
 	
 	/* callbacks */
-	ot->exec= node_show_cycles_exec;
-	ot->poll= ED_operator_node_active;
+	ot->exec = node_show_cycles_exec;
+	ot->poll = ED_operator_node_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ****************** Add File Node Operator  ******************* */
@@ -3435,11 +3427,8 @@ static int node_add_file_exec(bContext *C, wmOperator *op)
 	Image *ima= NULL;
 	bNodeTemplate ntemp;
 
-	ntemp.type = -1;
-
 	/* check input variables */
-	if (RNA_struct_property_is_set(op->ptr, "filepath"))
-	{
+	if (RNA_struct_property_is_set(op->ptr, "filepath")) {
 		char path[FILE_MAX];
 		RNA_string_get(op->ptr, "filepath", path);
 
@@ -3447,18 +3436,17 @@ static int node_add_file_exec(bContext *C, wmOperator *op)
 
 		ima= BKE_add_image_file(path);
 
-		if(!ima) {
+		if (!ima) {
 			BKE_reportf(op->reports, RPT_ERROR, "Can't read: \"%s\", %s", path, errno ? strerror(errno) : "Unsupported image format");
 			return OPERATOR_CANCELLED;
 		}
 	}
-	else if(RNA_struct_property_is_set(op->ptr, "name"))
-	{
+	else if (RNA_struct_property_is_set(op->ptr, "name")) {
 		char name[MAX_ID_NAME-2];
 		RNA_string_get(op->ptr, "name", name);
 		ima= (Image *)find_id("IM", name);
 
-		if(!ima) {
+		if (!ima) {
 			BKE_reportf(op->reports, RPT_ERROR, "Image named \"%s\", not found", name);
 			return OPERATOR_CANCELLED;
 		}
@@ -3466,12 +3454,20 @@ static int node_add_file_exec(bContext *C, wmOperator *op)
 	
 	node_deselect_all(snode);
 	
-	if (snode->nodetree->type==NTREE_COMPOSIT)
-		ntemp.type = CMP_NODE_IMAGE;
-
-	if (ntemp.type < 0)
-		return OPERATOR_CANCELLED;
-		
+	switch (snode->nodetree->type) {
+		case NTREE_SHADER:
+			ntemp.type = SH_NODE_TEX_IMAGE;
+			break;
+		case NTREE_TEXTURE:
+			ntemp.type = TEX_NODE_IMAGE;
+			break;
+		case NTREE_COMPOSIT:
+			ntemp.type = CMP_NODE_IMAGE;
+			break;
+		default:
+			return OPERATOR_CANCELLED;
+	}
+	
 	ED_preview_kill_jobs(C);
 	
 	node = node_add_node(snode, bmain, scene, &ntemp, snode->mx, snode->my);
@@ -3507,17 +3503,17 @@ static int node_add_file_invoke(bContext *C, wmOperator *op, wmEvent *event)
 void NODE_OT_add_file(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add File Node";
-	ot->description= "Add a file node to the current node editor";
-	ot->idname= "NODE_OT_add_file";
+	ot->name = "Add File Node";
+	ot->description = "Add a file node to the current node editor";
+	ot->idname = "NODE_OT_add_file";
 	
 	/* callbacks */
-	ot->exec= node_add_file_exec;
-	ot->invoke= node_add_file_invoke;
-	ot->poll= composite_node_active;
+	ot->exec = node_add_file_exec;
+	ot->invoke = node_add_file_invoke;
+	ot->poll = ED_operator_node_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);  //XXX TODO, relative_path
 	RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME-2, "Name", "Datablock name to assign");
@@ -3546,13 +3542,13 @@ static int new_node_tree_exec(bContext *C, wmOperator *op)
 		RNA_string_get(op->ptr, "name", treename);
 	
 	ntree = ntreeAddTree(treename, treetype, 0);
-	if(!ntree)
+	if (!ntree)
 		return OPERATOR_CANCELLED;
 	
 	/* hook into UI */
 	uiIDContextProperty(C, &ptr, &prop);
 
-	if(prop) {
+	if (prop) {
 		RNA_id_pointer_create(&ntree->id, &idptr);
 		RNA_property_pointer_set(&ptr, prop, idptr);
 		/* RNA_property_pointer_set increases the user count,
@@ -3561,7 +3557,7 @@ static int new_node_tree_exec(bContext *C, wmOperator *op)
 		--ntree->id.us;
 		RNA_property_update(C, &ptr, prop);
 	}
-	else if(snode) {
+	else if (snode) {
 		Scene *scene= CTX_data_scene(C);
 		snode->nodetree = ntree;
 		
@@ -3574,16 +3570,88 @@ static int new_node_tree_exec(bContext *C, wmOperator *op)
 void NODE_OT_new_node_tree(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "New node tree";
-	ot->idname= "NODE_OT_new_node_tree";
+	ot->name = "New node tree";
+	ot->idname = "NODE_OT_new_node_tree";
 	
 	/* api callbacks */
-	ot->exec= new_node_tree_exec;
-	ot->poll= ED_operator_node_active;
+	ot->exec = new_node_tree_exec;
+	ot->poll = ED_operator_node_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	RNA_def_enum(ot->srna, "type", nodetree_type_items, NTREE_COMPOSIT, "Tree Type", "");
 	RNA_def_string(ot->srna, "name", "NodeTree", MAX_ID_NAME-2, "Name", "");
 }
+
+/* ****************** File Output Add Socket  ******************* */
+
+static int node_output_file_add_socket_exec(bContext *C, wmOperator *op)
+{
+	Scene *scene= CTX_data_scene(C);
+	SpaceNode *snode= CTX_wm_space_node(C);
+	bNodeTree *ntree = snode->edittree;
+	bNode *node = nodeGetActive(ntree);
+	char file_path[MAX_NAME];
+	
+	if (!node)
+		return OPERATOR_CANCELLED;
+	
+	RNA_string_get(op->ptr, "file_path", file_path);
+	ntreeCompositOutputFileAddSocket(ntree, node, file_path, &scene->r.im_format);
+	
+	snode_notify(C, snode);
+	
+	return OPERATOR_FINISHED;
+}
+
+void NODE_OT_output_file_add_socket(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Add File Node Socket";
+	ot->description = "Add a new input to a file output node";
+	ot->idname = "NODE_OT_output_file_add_socket";
+	
+	/* callbacks */
+	ot->exec = node_output_file_add_socket_exec;
+	ot->poll = composite_node_active;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+	
+	RNA_def_string(ot->srna, "file_path", "Image", MAX_NAME, "File Path", "Sub-path of the output file");
+}
+
+/* ****************** Multi File Output Remove Socket  ******************* */
+
+static int node_output_file_remove_active_socket_exec(bContext *C, wmOperator *UNUSED(op))
+{
+	SpaceNode *snode= CTX_wm_space_node(C);
+	bNodeTree *ntree = snode->edittree;
+	bNode *node = nodeGetActive(ntree);
+	
+	if (!node)
+		return OPERATOR_CANCELLED;
+	
+	if (!ntreeCompositOutputFileRemoveActiveSocket(ntree, node))
+		return OPERATOR_CANCELLED;
+	
+	snode_notify(C, snode);
+	
+	return OPERATOR_FINISHED;
+}
+
+void NODE_OT_output_file_remove_active_socket(wmOperatorType *ot)
+{
+	/* identifiers */
+	ot->name = "Remove File Node Socket";
+	ot->description = "Remove active input from a file output node";
+	ot->idname = "NODE_OT_output_file_remove_active_socket";
+	
+	/* callbacks */
+	ot->exec = node_output_file_remove_active_socket_exec;
+	ot->poll = composite_node_active;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+}
diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c
index 6dd5eeb..7ddc4bd 100644
--- a/source/blender/editors/space_node/node_header.c
+++ b/source/blender/editors/space_node/node_header.c
@@ -75,33 +75,33 @@ static void do_node_add(bContext *C, bNodeTemplate *ntemp)
 	bNode *node;
 	
 	/* get location to add node at mouse */
-	for(ar=sa->regionbase.first; ar; ar=ar->next) {
-		if(ar->regiontype == RGN_TYPE_WINDOW) {
+	for (ar=sa->regionbase.first; ar; ar=ar->next) {
+		if (ar->regiontype == RGN_TYPE_WINDOW) {
 			wmWindow *win= CTX_wm_window(C);
 			int x= win->eventstate->x - ar->winrct.xmin;
 			int y= win->eventstate->y - ar->winrct.ymin;
 			
-			if(y < 60) y+= 60;
+			if (y < 60) y+= 60;
 			UI_view2d_region_to_view(&ar->v2d, x, y, &snode->mx, &snode->my);
 		}
 	}
 	
 	/* store selection in temp test flag */
-	for(node= snode->edittree->nodes.first; node; node= node->next) {
-		if(node->flag & NODE_SELECT) node->flag |= NODE_TEST;
+	for (node= snode->edittree->nodes.first; node; node= node->next) {
+		if (node->flag & NODE_SELECT) node->flag |= NODE_TEST;
 		else node->flag &= ~NODE_TEST;
 	}
 	
 	/* node= */ node_add_node(snode, bmain, scene, ntemp, snode->mx, snode->my);
 	
 	/* select previous selection before autoconnect */
-	for(node= snode->edittree->nodes.first; node; node= node->next) {
-		if(node->flag & NODE_TEST) node->flag |= NODE_SELECT;
+	for (node= snode->edittree->nodes.first; node; node= node->next) {
+		if (node->flag & NODE_TEST) node->flag |= NODE_SELECT;
 	}
 	
 	/* deselect after autoconnection */
-	for(node= snode->edittree->nodes.first; node; node= node->next) {
-		if(node->flag & NODE_TEST) node->flag &= ~NODE_SELECT;
+	for (node= snode->edittree->nodes.first; node; node= node->next) {
+		if (node->flag & NODE_TEST) node->flag &= ~NODE_SELECT;
 	}
 		
 	snode_notify(C, snode);
@@ -110,14 +110,22 @@ static void do_node_add(bContext *C, bNodeTemplate *ntemp)
 
 static void do_node_add_static(bContext *C, void *UNUSED(arg), int event)
 {
+	Main *bmain = CTX_data_main(C);
+	Scene *scene = CTX_data_scene(C);
 	bNodeTemplate ntemp;
+	
 	ntemp.type = event;
+	ntemp.main = bmain;
+	ntemp.scene = scene;
+	
 	do_node_add(C, &ntemp);
 }
 
 static void do_node_add_group(bContext *C, void *UNUSED(arg), int event)
 {
 	SpaceNode *snode= CTX_wm_space_node(C);
+	Main *bmain = CTX_data_main(C);
+	Scene *scene = CTX_data_scene(C);
 	bNodeTemplate ntemp;
 	
 	if (event>=0) {
@@ -143,14 +151,24 @@ static void do_node_add_group(bContext *C, void *UNUSED(arg), int event)
 	if (!ntemp.ngroup)
 		return;
 	
+	ntemp.main = bmain;
+	ntemp.scene = scene;
+	
 	do_node_add(C, &ntemp);
 }
 
 #if 0 /* disabled */
 static void do_node_add_dynamic(bContext *C, void *UNUSED(arg), int event)
 {
+	Main *bmain = CTX_data_main(C);
+	Scene *scene = CTX_data_scene(C);
 	bNodeTemplate ntemp;
+	
 	ntemp.type = NODE_DYNAMIC;
+	
+	ntemp.main = bmain;
+	ntemp.scene = scene;
+	
 	do_node_add(C, &ntemp);
 }
 #endif
@@ -177,13 +195,13 @@ static void node_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclass)
 	
 	ntree = snode->nodetree;
 	
-	if(!ntree) {
+	if (!ntree) {
 		uiItemS(layout);
 		return;
 	}
 
-	if(ntree->type == NTREE_SHADER) {
-		if(scene_use_new_shading_nodes(scene))
+	if (ntree->type == NTREE_SHADER) {
+		if (scene_use_new_shading_nodes(scene))
 			compatibility= NODE_NEW_SHADING;
 		else
 			compatibility= NODE_OLD_SHADING;
@@ -196,14 +214,14 @@ 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, "New Group", 0, -NODE_GROUP);
+			uiItemV(layout, IFACE_("New Group"), 0, -NODE_GROUP);
 		if (node_tree_has_type(ntree->type, NODE_FORLOOP))
-			uiItemV(layout, "New For Loop", 0, -NODE_FORLOOP);
+			uiItemV(layout, IFACE_("New For Loop"), 0, -NODE_FORLOOP);
 		if (node_tree_has_type(ntree->type, NODE_WHILELOOP))
-			uiItemV(layout, "New While Loop", 0, -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) {
+		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)) {
 				uiItemV(layout, ngroup->id.name+2, 0, event);
@@ -221,7 +239,7 @@ static void node_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclass)
 		for (ntype=ntreeGetType(ntree->type)->node_types.first; ntype; ntype=ntype->next) {
 			if (ntype->nclass==nodeclass && ntype->name)
 				if (!compatibility || (ntype->compatibility & compatibility))
-					uiItemV(layout, ntype->name, 0, ntype->type);
+					uiItemV(layout, IFACE_(ntype->name), 0, ntype->type);
 		}
 	}
 }
@@ -229,7 +247,7 @@ static void node_add_menu(bContext *C, uiLayout *layout, void *arg_nodeclass)
 static void node_menu_add_foreach_cb(void *calldata, int nclass, const char *name)
 {
 	uiLayout *layout= calldata;
-	uiItemMenuF(layout, name, 0, node_add_menu, SET_INT_IN_POINTER(nclass));
+	uiItemMenuF(layout, IFACE_(name), 0, node_add_menu, SET_INT_IN_POINTER(nclass));
 }
 
 static void node_menu_add(const bContext *C, Menu *menu)
@@ -239,10 +257,10 @@ static void node_menu_add(const bContext *C, Menu *menu)
 	uiLayout *layout= menu->layout;
 	bNodeTreeType *ntreetype= ntreeGetType(snode->treetype);
 
-	if(!snode->nodetree)
+	if (!snode->nodetree)
 		uiLayoutSetActive(layout, 0);
 	
-	if(ntreetype && ntreetype->foreach_nodeclass)
+	if (ntreetype && ntreetype->foreach_nodeclass)
 		ntreetype->foreach_nodeclass(scene, layout, node_menu_add_foreach_cb);
 }
 
diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index 186ad37..aa80f72 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -28,8 +28,8 @@
  *  \ingroup spnode
  */
 
-#ifndef ED_NODE_INTERN_H
-#define ED_NODE_INTERN_H
+#ifndef __NODE_INTERN_H__
+#define __NODE_INTERN_H__
 
 #include <stddef.h> /* for size_t */
 #include "UI_interface.h"
@@ -62,7 +62,6 @@ typedef struct bNodeLinkDrag
 ARegion *node_has_buttons_region(ScrArea *sa);
 
 /* node_header.c */
-void node_header_buttons(const bContext *C, ARegion *ar);
 void node_menus_register(void);
 
 /* node_draw.c */
@@ -82,7 +81,13 @@ void node_operatortypes(void);
 void node_keymap(wmKeyConfig *keyconf);
 
 /* node_select.c */
+void node_select(struct bNode *node);
+void node_deselect(struct bNode *node);
 void node_deselect_all(struct SpaceNode *snode);
+void node_socket_select(struct bNode *node, struct bNodeSocket *sock);
+void node_socket_deselect(struct bNode *node, struct bNodeSocket *sock, int deselect_node);
+void node_deselect_all_input_sockets(struct SpaceNode *snode, int deselect_nodes);
+void node_deselect_all_output_sockets(struct SpaceNode *snode, int deselect_nodes);
 int node_select_same_type(struct SpaceNode *snode);
 int node_select_same_type_np(struct SpaceNode *snode, int dir);
 void node_select_single(struct bContext *C, struct bNode *node);
@@ -105,7 +110,6 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int t
 int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, float coord_array[][2], int resol);
 void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link, int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3 );
 void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage);
-void draw_nodespace_color_info(struct ARegion *ar, int color_manage, int channels, int x, int y, const char cp[4], const float fp[4]);
 
 /* node_edit.c */
 void node_tree_from_ID(ID *id, bNodeTree **ntree, bNodeTree **edittree, int *treetype);
@@ -116,11 +120,11 @@ void snode_set_context(SpaceNode *snode, Scene *scene);
 void snode_make_group_editable(SpaceNode *snode, bNode *gnode);
 void snode_composite_job(const struct bContext *C, ScrArea *sa);
 bNode *node_tree_get_editgroup(bNodeTree *ntree);
-void node_tree_verify_groups(bNodeTree *nodetree);
 void snode_autoconnect(SpaceNode *snode, int allow_multiple, int replace);
-int node_has_hidden_sockets(bNode *node, short flag);
-void node_set_hidden_sockets(SpaceNode *snode, bNode *node, short flag, int set);
+int node_has_hidden_sockets(bNode *node);
+void node_set_hidden_sockets(SpaceNode *snode, bNode *node, int set);
 int node_render_changed_exec(bContext *, wmOperator *);
+int node_find_indicated_socket(struct SpaceNode *snode, struct bNode **nodep, struct bNodeSocket **sockp, int in_out);
 
 void NODE_OT_duplicate(struct wmOperatorType *ot);
 void NODE_OT_delete(struct wmOperatorType *ot);
@@ -130,6 +134,7 @@ void NODE_OT_resize(struct wmOperatorType *ot);
 void NODE_OT_link(struct wmOperatorType *ot);
 void NODE_OT_link_make(struct wmOperatorType *ot);
 void NODE_OT_links_cut(struct wmOperatorType *ot);
+void NODE_OT_links_detach(struct wmOperatorType *ot);
 
 void NODE_OT_group_make(struct wmOperatorType *ot);
 void NODE_OT_group_ungroup(struct wmOperatorType *ot);
@@ -159,6 +164,9 @@ void NODE_OT_add_file(struct wmOperatorType *ot);
 
 void NODE_OT_new_node_tree(struct wmOperatorType *ot);
 
+void NODE_OT_output_file_add_socket(struct wmOperatorType *ot);
+void NODE_OT_output_file_remove_active_socket(struct wmOperatorType *ot);
+
 extern const char *node_context_dir[];
 
 // XXXXXX
@@ -190,4 +198,4 @@ enum {
 	B_NODE_SETIMAGE,
 } eNodeSpace_ButEvents;
 
-#endif /* ED_NODE_INTERN_H */
+#endif /* __NODE_INTERN_H__ */
diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c
index 5080215..e1493b5 100644
--- a/source/blender/editors/space_node/node_ops.c
+++ b/source/blender/editors/space_node/node_ops.c
@@ -77,6 +77,7 @@ void node_operatortypes(void)
 	WM_operatortype_append(NODE_OT_link);
 	WM_operatortype_append(NODE_OT_link_make);
 	WM_operatortype_append(NODE_OT_links_cut);
+	WM_operatortype_append(NODE_OT_links_detach);
 
 	WM_operatortype_append(NODE_OT_group_make);
 	WM_operatortype_append(NODE_OT_group_ungroup);
@@ -99,6 +100,9 @@ void node_operatortypes(void)
 	WM_operatortype_append(NODE_OT_add_file);
 	
 	WM_operatortype_append(NODE_OT_new_node_tree);
+	
+	WM_operatortype_append(NODE_OT_output_file_add_socket);
+	WM_operatortype_append(NODE_OT_output_file_remove_active_socket);
 }
 
 void ED_operatormacros_node(void)
@@ -106,24 +110,28 @@ void ED_operatormacros_node(void)
 	wmOperatorType *ot;
 	wmOperatorTypeMacro *mot;
 	
-	ot= WM_operatortype_append_macro("NODE_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
+	ot = WM_operatortype_append_macro("NODE_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
 	ot->description = "Duplicate selected nodes and move them";
 	WM_operatortype_macro_define(ot, "NODE_OT_duplicate");
 	WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
 
 	/* modified operator call for duplicating with input links */
-	ot= WM_operatortype_append_macro("NODE_OT_duplicate_move_keep_inputs", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
+	ot = WM_operatortype_append_macro("NODE_OT_duplicate_move_keep_inputs", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
 	ot->description = "Duplicate selected nodes keeping input links and move them";
-
 	mot = WM_operatortype_macro_define(ot, "NODE_OT_duplicate");
 	RNA_boolean_set(mot->ptr, "keep_inputs", TRUE);
-
 	WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
 
-	ot= WM_operatortype_append_macro("NODE_OT_select_link_viewer", "Link Viewer", OPTYPE_UNDO);
+	ot = WM_operatortype_append_macro("NODE_OT_select_link_viewer", "Link Viewer", OPTYPE_UNDO);
 	ot->description = "Select node and link it to a viewer node";
 	WM_operatortype_macro_define(ot, "NODE_OT_select");
 	WM_operatortype_macro_define(ot, "NODE_OT_link_viewer");
+
+	ot = WM_operatortype_append_macro("NODE_OT_move_detach_links", "Detach", OPTYPE_UNDO|OPTYPE_REGISTER);
+	ot->description = "Move a node to detach links";
+	WM_operatortype_macro_define(ot, "NODE_OT_links_detach");
+	mot = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate");
+	RNA_boolean_set(mot->ptr, "release_confirm", TRUE);
 }
 
 void node_keymap(struct wmKeyConfig *keyconf)
@@ -132,15 +140,16 @@ void node_keymap(struct wmKeyConfig *keyconf)
 	wmKeyMapItem *kmi;
 	
 	/* Entire Editor only ----------------- */
-	keymap= WM_keymap_find(keyconf, "Node Generic", SPACE_NODE, 0);
+	keymap = WM_keymap_find(keyconf, "Node Generic", SPACE_NODE, 0);
 	
 	WM_keymap_add_item(keymap, "NODE_OT_properties", NKEY, KM_PRESS, 0, 0);
 	
 	/* Main Area only ----------------- */
-	keymap= WM_keymap_find(keyconf, "Node Editor", SPACE_NODE, 0);
+	keymap = WM_keymap_find(keyconf, "Node Editor", SPACE_NODE, 0);
 	
 	/* mouse select in nodes used to be both keys, but perhaps this should be reduced? 
 	 * NOTE: mouse-clicks on left-mouse will fall through to allow transform-tweak, but also link/resize
+	 * NOTE 2: socket select is part of the node select operator, to handle overlapping cases
 	 */
 	kmi = WM_keymap_add_item(keymap, "NODE_OT_select", ACTIONMOUSE, KM_PRESS, 0, 0);
 		RNA_boolean_set(kmi->ptr, "extend", FALSE);
@@ -161,9 +170,9 @@ void node_keymap(struct wmKeyConfig *keyconf)
 	WM_keymap_add_item(keymap, "NODE_OT_select_link_viewer", LEFTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
 	
 	WM_keymap_add_item(keymap, "NODE_OT_backimage_move", MIDDLEMOUSE, KM_PRESS, KM_ALT, 0);
-	kmi= WM_keymap_add_item(keymap, "NODE_OT_backimage_zoom", VKEY, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "NODE_OT_backimage_zoom", VKEY, KM_PRESS, 0, 0);
 		RNA_float_set(kmi->ptr, "factor", 0.83333f);
-	kmi= WM_keymap_add_item(keymap, "NODE_OT_backimage_zoom", VKEY, KM_PRESS, KM_ALT, 0);
+	kmi = WM_keymap_add_item(keymap, "NODE_OT_backimage_zoom", VKEY, KM_PRESS, KM_ALT, 0);
 		RNA_float_set(kmi->ptr, "factor", 1.2f);
 	WM_keymap_add_item(keymap, "NODE_OT_backimage_sample", ACTIONMOUSE, KM_PRESS, KM_ALT, 0);
 
diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c
index 15efd65..4df60e6 100644
--- a/source/blender/editors/space_node/node_select.c
+++ b/source/blender/editors/space_node/node_select.c
@@ -62,7 +62,7 @@ static bNode *node_under_mouse(bNodeTree *ntree, int mx, int my)
 {
 	bNode *node;
 	
-	for(node=ntree->nodes.last; node; node=node->prev) {
+	for (node=ntree->nodes.last; node; node=node->prev) {
 		/* node body (header and scale are in other operators) */
 		if (BLI_in_rctf(&node->totr, mx, my))
 			return node;
@@ -173,13 +173,150 @@ static void node_sort(bNodeTree *ntree)
 	}
 }
 
+void node_select(bNode *node)
+{
+	node->flag |= SELECT;
+}
+
+void node_deselect(bNode *node)
+{
+	bNodeSocket *sock;
+	
+	node->flag &= ~SELECT;
+	
+	/* deselect sockets too */
+	for (sock=node->inputs.first; sock; sock=sock->next)
+		sock->flag &= ~SELECT;
+	for (sock=node->outputs.first; sock; sock=sock->next)
+		sock->flag &= ~SELECT;
+}
+
+static void node_toggle(bNode *node)
+{
+	if (node->flag & SELECT)
+		node_deselect(node);
+	else
+		node_select(node);
+}
+
+void node_socket_select(bNode *node, bNodeSocket *sock)
+{
+	sock->flag |= SELECT;
+	
+	/* select node too */
+	if (node)
+		node->flag |= SELECT;
+}
+
+void node_socket_deselect(bNode *node, bNodeSocket *sock, int deselect_node)
+{
+	sock->flag &= ~SELECT;
+	
+	if (node && deselect_node) {
+		int sel=0;
+		
+		/* if no selected sockets remain, also deselect the node */
+		for (sock=node->inputs.first; sock; sock=sock->next) {
+			if (sock->flag & SELECT) {
+				sel = 1;
+				break;
+			}
+		}
+		for (sock=node->outputs.first; sock; sock=sock->next) {
+			if (sock->flag & SELECT) {
+				sel = 1;
+				break;
+			}
+		}
+		
+		if (!sel)
+			node->flag &= ~SELECT;
+	}
+}
+
+static void node_socket_toggle(bNode *node, bNodeSocket *sock, int deselect_node)
+{
+	if (sock->flag & SELECT)
+		node_socket_deselect(node, sock, deselect_node);
+	else
+		node_socket_select(node, sock);
+}
+
 /* no undo here! */
 void node_deselect_all(SpaceNode *snode)
 {
 	bNode *node;
 	
-	for(node= snode->edittree->nodes.first; node; node= node->next)
-		node->flag &= ~SELECT;
+	for (node= snode->edittree->nodes.first; node; node= node->next)
+		node_deselect(node);
+}
+
+void node_deselect_all_input_sockets(SpaceNode *snode, int deselect_nodes)
+{
+	bNode *node;
+	bNodeSocket *sock;
+	
+	/* XXX not calling node_socket_deselect here each time, because this does iteration
+	 * over all node sockets internally to check if the node stays selected.
+	 * We can do that more efficiently here.
+	 */
+	
+	for (node= snode->edittree->nodes.first; node; node= node->next) {
+		int sel=0;
+		
+		for (sock= node->inputs.first; sock; sock=sock->next)
+			sock->flag &= ~SELECT;
+		
+		/* if no selected sockets remain, also deselect the node */
+		if (deselect_nodes) {
+			for (sock= node->outputs.first; sock; sock=sock->next) {
+				if (sock->flag & SELECT) {
+					sel = 1;
+					break;
+				}
+			}
+			
+			if (!sel)
+				node->flag &= ~SELECT;
+		}
+	}
+	
+	for (sock= snode->edittree->outputs.first; sock; sock=sock->next)
+		sock->flag &= ~SELECT;
+}
+
+void node_deselect_all_output_sockets(SpaceNode *snode, int deselect_nodes)
+{
+	bNode *node;
+	bNodeSocket *sock;
+	
+	/* XXX not calling node_socket_deselect here each time, because this does iteration
+	 * over all node sockets internally to check if the node stays selected.
+	 * We can do that more efficiently here.
+	 */
+	
+	for (node= snode->edittree->nodes.first; node; node= node->next) {
+		int sel=0;
+		
+		for (sock= node->outputs.first; sock; sock=sock->next)
+			sock->flag &= ~SELECT;
+		
+		/* if no selected sockets remain, also deselect the node */
+		if (deselect_nodes) {
+			for (sock= node->inputs.first; sock; sock=sock->next) {
+				if (sock->flag & SELECT) {
+					sel = 1;
+					break;
+				}
+			}
+			
+			if (!sel)
+				node->flag &= ~SELECT;
+		}
+	}
+	
+	for (sock= snode->edittree->inputs.first; sock; sock=sock->next)
+		sock->flag &= ~SELECT;
 }
 
 /* return 1 if we need redraw otherwise zero. */
@@ -203,12 +340,12 @@ int node_select_same_type(SpaceNode *snode)
 		if (p->type != nac->type && p->flag & SELECT) {
 			/* if it's selected but different type, unselect */
 			redraw= 1;
-			p->flag &= ~SELECT;
+			node_deselect(p);
 		}
 		else if (p->type == nac->type && (!(p->flag & SELECT))) {
 			/* if it's the same type and is not selected, select! */
 			redraw= 1;
-			p->flag |= SELECT;
+			node_select(p);
 		}
 	}
 	return(redraw);
@@ -219,7 +356,7 @@ int node_select_same_type(SpaceNode *snode)
  */
 int node_select_same_type_np(SpaceNode *snode, int dir)
 {
-	bNode *nac, *p;
+	bNode *nac, *p, *tnode;
 
 	/* search the active one. */
 	for (nac= snode->edittree->nodes.first; nac; nac= nac->next) {
@@ -248,8 +385,10 @@ int node_select_same_type_np(SpaceNode *snode, int dir)
 	}
 
 	if (p) {
-		node_deselect_all(snode);
-		p->flag |= SELECT;
+		for (tnode=snode->edittree->nodes.first; tnode; tnode=tnode->next)
+			if (tnode!=p)
+				node_deselect(tnode);
+		node_select(p);
 		return(1);
 	}
 	return(0);
@@ -259,9 +398,12 @@ void node_select_single(bContext *C, bNode *node)
 {
 	Main *bmain= CTX_data_main(C);
 	SpaceNode *snode= CTX_wm_space_node(C);
+	bNode *tnode;
 	
-	node_deselect_all(snode);
-	node->flag |= SELECT;
+	for (tnode=snode->edittree->nodes.first; tnode; tnode=tnode->next)
+		if (tnode!=node)
+			node_deselect(tnode);
+	node_select(node);
 	
 	ED_node_set_active(bmain, snode->edittree, node);
 	
@@ -272,34 +414,74 @@ void node_select_single(bContext *C, bNode *node)
 
 /* ****** Click Select ****** */
  
-static bNode *node_mouse_select(Main *bmain, SpaceNode *snode, ARegion *ar, const int mval[2], short extend)
+static int node_mouse_select(Main *bmain, SpaceNode *snode, ARegion *ar, const int mval[2], short extend)
 {
-	bNode *node;
+	bNode *node, *tnode;
+	bNodeSocket *sock, *tsock;
 	float mx, my;
+	int selected = 0;
 	
 	/* get mouse coordinates in view2d space */
-	mx= (float)mval[0];
-	my= (float)mval[1];
-	
 	UI_view2d_region_to_view(&ar->v2d, mval[0], mval[1], &mx, &my);
-	
-	/* find the closest visible node */
-	node = node_under_mouse(snode->edittree, mx, my);
-	
-	if (node) {
-		if (extend == 0) {
-			node_deselect_all(snode);
-			node->flag |= SELECT;
+	/* node_find_indicated_socket uses snode->mx/my */
+	snode->mx = mx;
+	snode->my = my;
+	
+	if (extend) {
+		/* first do socket selection, these generally overlap with nodes.
+		 * socket selection only in extend mode.
+		 */
+		if (node_find_indicated_socket(snode, &node, &sock, SOCK_IN)) {
+			node_socket_toggle(node, sock, 1);
+			selected = 1;
 		}
-		else
-			node->flag ^= SELECT;
+		else if (node_find_indicated_socket(snode, &node, &sock, SOCK_OUT)) {
+			if (sock->flag & SELECT) {
+				node_socket_deselect(node, sock, 1);
+			}
+			else {
+				/* only allow one selected output per node, for sensible linking.
+				 * allows selecting outputs from different nodes though.
+				 */
+				if (node) {
+					for (tsock=node->outputs.first; tsock; tsock=tsock->next)
+						node_socket_deselect(node, tsock, 1);
+				}
+				node_socket_select(node, sock);
+			}
+			selected = 1;
+		}
+		else {
+			/* find the closest visible node */
+			node = node_under_mouse(snode->edittree, mx, my);
+			
+			if (node) {
+				node_toggle(node);
+				
+				ED_node_set_active(bmain, snode->edittree, node);
+				selected = 1;
+			}
+		}
+	}
+	else {	/* extend==0 */
 		
-		ED_node_set_active(bmain, snode->edittree, node);
+		/* find the closest visible node */
+		node = node_under_mouse(snode->edittree, mx, my);
 		
-		node_sort(snode->edittree);
+		if (node) {
+			for (tnode=snode->edittree->nodes.first; tnode; tnode=tnode->next)
+				node_deselect(tnode);
+			node_select(node);
+			ED_node_set_active(bmain, snode->edittree, node);
+			selected = 1;
+		}
 	}
-
-	return node;
+	
+	/* update node order */
+	if (selected)
+		node_sort(snode->edittree);
+	
+	return selected;
 }
 
 static int node_select_exec(bContext *C, wmOperator *op)
@@ -309,7 +491,6 @@ static int node_select_exec(bContext *C, wmOperator *op)
 	ARegion *ar= CTX_wm_region(C);
 	int mval[2];
 	short extend;
-	/* bNode *node= NULL; */ /* UNUSED */
 	
 	/* get settings from RNA properties for operator */
 	mval[0] = RNA_int_get(op->ptr, "mouse_x");
@@ -318,13 +499,17 @@ static int node_select_exec(bContext *C, wmOperator *op)
 	extend = RNA_boolean_get(op->ptr, "extend");
 	
 	/* perform the select */
-	/* node= */ /* UNUSED*/ node_mouse_select(bmain, snode, ar, mval, extend);
-	
-	/* send notifiers */
-	WM_event_add_notifier(C, NC_NODE|NA_SELECTED, NULL);
-	
-	/* allow tweak event to work too */
-	return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
+	if (node_mouse_select(bmain, snode, ar, mval, extend)) {
+		/* send notifiers */
+		WM_event_add_notifier(C, NC_NODE|NA_SELECTED, NULL);
+		
+		/* allow tweak event to work too */
+		return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
+	}
+	else {
+		/* allow tweak event to work too */
+		return OPERATOR_CANCELLED|OPERATOR_PASS_THROUGH;
+	}
 }
 
 static int node_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
@@ -339,16 +524,16 @@ static int node_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 void NODE_OT_select(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select";
-	ot->idname= "NODE_OT_select";
-	ot->description= "Select the node under the cursor";
+	ot->name = "Select";
+	ot->idname = "NODE_OT_select";
+	ot->description = "Select the node under the cursor";
 	
 	/* api callbacks */
-	ot->invoke= node_select_invoke;
-	ot->poll= ED_operator_node_active;
+	ot->invoke = node_select_invoke;
+	ot->poll = ED_operator_node_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_int(ot->srna, "mouse_x", 0, INT_MIN, INT_MAX, "Mouse X", "", INT_MIN, INT_MAX);
@@ -368,23 +553,23 @@ static int node_borderselect_exec(bContext *C, wmOperator *op)
 	int gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
 	int extend= RNA_boolean_get(op->ptr, "extend");
 	
-	rect.xmin= RNA_int_get(op->ptr, "xmin");
-	rect.ymin= RNA_int_get(op->ptr, "ymin");
+	rect.xmin = RNA_int_get(op->ptr, "xmin");
+	rect.ymin = RNA_int_get(op->ptr, "ymin");
 	UI_view2d_region_to_view(&ar->v2d, rect.xmin, rect.ymin, &rectf.xmin, &rectf.ymin);
 	
-	rect.xmax= RNA_int_get(op->ptr, "xmax");
-	rect.ymax= RNA_int_get(op->ptr, "ymax");
+	rect.xmax = RNA_int_get(op->ptr, "xmax");
+	rect.ymax = RNA_int_get(op->ptr, "ymax");
 	UI_view2d_region_to_view(&ar->v2d, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
 	
-	for(node= snode->edittree->nodes.first; node; node= node->next) {
-		if(BLI_isect_rctf(&rectf, &node->totr, NULL)) {
-			if(gesture_mode==GESTURE_MODAL_SELECT)
-				node->flag |= SELECT;
+	for (node= snode->edittree->nodes.first; node; node= node->next) {
+		if (BLI_isect_rctf(&rectf, &node->totr, NULL)) {
+			if (gesture_mode==GESTURE_MODAL_SELECT)
+				node_select(node);
 			else
-				node->flag &= ~SELECT;
+				node_deselect(node);
 		}
-		else if(!extend) {
-			node->flag &= ~SELECT;
+		else if (!extend) {
+			node_deselect(node);
 		}
 	}
 	
@@ -418,20 +603,20 @@ static int node_border_select_invoke(bContext *C, wmOperator *op, wmEvent *event
 void NODE_OT_select_border(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Border Select";
-	ot->idname= "NODE_OT_select_border";
-	ot->description= "Use box selection to select nodes";
+	ot->name = "Border Select";
+	ot->idname = "NODE_OT_select_border";
+	ot->description = "Use box selection to select nodes";
 	
 	/* api callbacks */
-	ot->invoke= node_border_select_invoke;
-	ot->exec= node_borderselect_exec;
-	ot->modal= WM_border_select_modal;
-	ot->cancel= WM_border_select_cancel;
+	ot->invoke = node_border_select_invoke;
+	ot->exec = node_borderselect_exec;
+	ot->modal = WM_border_select_modal;
+	ot->cancel = WM_border_select_cancel;
 	
-	ot->poll= ED_operator_node_active;
+	ot->poll = ED_operator_node_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 	
 	/* rna */
 	WM_operator_properties_gesture_border(ot, TRUE);
@@ -447,17 +632,17 @@ static int node_select_all_exec(bContext *C, wmOperator *UNUSED(op))
 	bNode *node;
 	int count= 0;
 
-	for(node=first; node; node=node->next)
-		if(node->flag & NODE_SELECT)
+	for (node=first; node; node=node->next)
+		if (node->flag & NODE_SELECT)
 			count++;
 
-	if(count) {
-		for(node=first; node; node=node->next)
-			node->flag &= ~NODE_SELECT;
+	if (count) {
+		for (node=first; node; node=node->next)
+			node_deselect(node);
 	}
 	else {
-		for(node=first; node; node=node->next)
-			node->flag |= NODE_SELECT;
+		for (node=first; node; node=node->next)
+			node_select(node);
 	}
 	
 	node_sort(snode->edittree);
@@ -469,7 +654,7 @@ static int node_select_all_exec(bContext *C, wmOperator *UNUSED(op))
 void NODE_OT_select_all(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name = "Select or Deselect All";
+	ot->name = "(De)select All";
 	ot->description = "(De)select all nodes";
 	ot->idname = "NODE_OT_select_all";
 	
@@ -499,7 +684,7 @@ static int node_select_linked_to_exec(bContext *C, wmOperator *UNUSED(op))
 	
 	for (node=snode->edittree->nodes.first; node; node=node->next) {
 		if (node->flag & NODE_TEST)
-			node->flag |= NODE_SELECT;
+			node_select(node);
 	}
 	
 	node_sort(snode->edittree);
@@ -531,17 +716,17 @@ static int node_select_linked_from_exec(bContext *C, wmOperator *UNUSED(op))
 	bNodeLink *link;
 	bNode *node;
 	
-	for(node=snode->edittree->nodes.first; node; node=node->next)
+	for (node=snode->edittree->nodes.first; node; node=node->next)
 		node->flag &= ~NODE_TEST;
 
-	for(link=snode->edittree->links.first; link; link=link->next) {
-		if(link->fromnode && link->tonode && (link->tonode->flag & NODE_SELECT))
+	for (link=snode->edittree->links.first; link; link=link->next) {
+		if (link->fromnode && link->tonode && (link->tonode->flag & NODE_SELECT))
 			link->fromnode->flag |= NODE_TEST;
 	}
 	
-	for(node=snode->edittree->nodes.first; node; node=node->next) {
-		if(node->flag & NODE_TEST)
-			node->flag |= NODE_SELECT;
+	for (node=snode->edittree->nodes.first; node; node=node->next) {
+		if (node->flag & NODE_TEST)
+			node_select(node);
 	}
 	
 	node_sort(snode->edittree);
diff --git a/source/blender/editors/space_node/node_state.c b/source/blender/editors/space_node/node_state.c
index 58623e1..5463d4a 100644
--- a/source/blender/editors/space_node/node_state.c
+++ b/source/blender/editors/space_node/node_state.c
@@ -67,13 +67,13 @@ static void snode_home(ScrArea *UNUSED(sa), ARegion *ar, SpaceNode* snode)
 	oldwidth= cur->xmax - cur->xmin;
 	oldheight= cur->ymax - cur->ymin;
 	
-	cur->xmin= cur->ymin= 0.0f;
+	cur->xmin = cur->ymin = 0.0f;
 	cur->xmax=ar->winx;
 	cur->ymax=ar->winy;
 	
-	if(snode->edittree) {
-		for(node= snode->edittree->nodes.first; node; node= node->next) {
-			if(first) {
+	if (snode->edittree) {
+		for (node= snode->edittree->nodes.first; node; node= node->next) {
+			if (first) {
 				first= 0;
 				ar->v2d.cur= node->totr;
 			}
@@ -88,17 +88,17 @@ static void snode_home(ScrArea *UNUSED(sa), ARegion *ar, SpaceNode* snode)
 	width= cur->xmax - cur->xmin;
 	height= cur->ymax- cur->ymin;
 
-	if(width > height) {
+	if (width > height) {
 		float newheight;
 		newheight= oldheight * width/oldwidth;
-		cur->ymin= cur->ymin - newheight/4;
-		cur->ymax= cur->ymax + newheight/4;
+		cur->ymin = cur->ymin - newheight/4;
+		cur->ymax = cur->ymax + newheight/4;
 	}
 	else {
 		float newwidth;
 		newwidth= oldwidth * height/oldheight;
-		cur->xmin= cur->xmin - newwidth/4;
-		cur->xmax= cur->xmax + newwidth/4;
+		cur->xmin = cur->xmin - newwidth/4;
+		cur->xmax = cur->xmax + newwidth/4;
 	}
 
 	ar->v2d.tot= ar->v2d.cur;
@@ -120,14 +120,14 @@ static int node_view_all_exec(bContext *C, wmOperator *UNUSED(op))
 void NODE_OT_view_all(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View All";
-	ot->idname= "NODE_OT_view_all";
-	ot->description= "Resize view so you can see all nodes";
+	ot->name = "View All";
+	ot->idname = "NODE_OT_view_all";
+	ot->description = "Resize view so you can see all nodes";
 	
 	/* api callbacks */
-	ot->exec= node_view_all_exec;
-	ot->poll= ED_operator_node_active;
+	ot->exec = node_view_all_exec;
+	ot->poll = ED_operator_node_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c
index 8d82dd3..049886b 100644
--- a/source/blender/editors/space_node/node_templates.c
+++ b/source/blender/editors/space_node/node_templates.c
@@ -20,7 +20,7 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-/** \file blender/editors/interface/interface_node.c
+/** \file blender/editors/space_node/node_templates.c
  *  \ingroup edinterface
  */
 
@@ -59,6 +59,7 @@
 #include "../interface/interface_intern.h"
 
 #include "ED_node.h"
+#include "ED_util.h"
 
 /************************* Node Socket Manipulation **************************/
 
@@ -66,13 +67,13 @@ static void node_tag_recursive(bNode *node)
 {
 	bNodeSocket *input;
 
-	if(!node || (node->flag & NODE_TEST))
+	if (!node || (node->flag & NODE_TEST))
 		return; /* in case of cycles */
 	
 	node->flag |= NODE_TEST;
 
-	for(input=node->inputs.first; input; input=input->next)
-		if(input->link)
+	for (input=node->inputs.first; input; input=input->next)
+		if (input->link)
 			node_tag_recursive(input->link->fromnode);
 }
 
@@ -80,13 +81,13 @@ static void node_clear_recursive(bNode *node)
 {
 	bNodeSocket *input;
 
-	if(!node || !(node->flag & NODE_TEST))
+	if (!node || !(node->flag & NODE_TEST))
 		return; /* in case of cycles */
 	
 	node->flag &= ~NODE_TEST;
 
-	for(input=node->inputs.first; input; input=input->next)
-		if(input->link)
+	for (input=node->inputs.first; input; input=input->next)
+		if (input->link)
 			node_clear_recursive(input->link->fromnode);
 }
 
@@ -95,28 +96,28 @@ static void node_remove_linked(bNodeTree *ntree, bNode *rem_node)
 	bNode *node, *next;
 	bNodeSocket *sock;
 
-	if(!rem_node)
+	if (!rem_node)
 		return;
 
 	/* tag linked nodes to be removed */
-	for(node=ntree->nodes.first; node; node=node->next)
+	for (node=ntree->nodes.first; node; node=node->next)
 		node->flag &= ~NODE_TEST;
 	
 	node_tag_recursive(rem_node);
 
 	/* clear tags on nodes that are still used by other nodes */
-	for(node=ntree->nodes.first; node; node=node->next)
-		if(!(node->flag & NODE_TEST))
-			for(sock=node->inputs.first; sock; sock=sock->next)
-				if(sock->link && sock->link->fromnode != rem_node)
+	for (node=ntree->nodes.first; node; node=node->next)
+		if (!(node->flag & NODE_TEST))
+			for (sock=node->inputs.first; sock; sock=sock->next)
+				if (sock->link && sock->link->fromnode != rem_node)
 					node_clear_recursive(sock->link->fromnode);
 
 	/* remove nodes */
-	for(node=ntree->nodes.first; node; node=next) {
+	for (node=ntree->nodes.first; node; node=next) {
 		next = node->next;
 
-		if(node->flag & NODE_TEST) {
-			if(node->id)
+		if (node->flag & NODE_TEST) {
+			if (node->id)
 				node->id->us--;
 			nodeFreeNode(ntree, node);
 		}
@@ -126,7 +127,7 @@ static void node_remove_linked(bNodeTree *ntree, bNode *rem_node)
 /* disconnect socket from the node it is connected to */
 static void node_socket_disconnect(Main *bmain, bNodeTree *ntree, bNode *node_to, bNodeSocket *sock_to)
 {
-	if(!sock_to->link)
+	if (!sock_to->link)
 		return;
 
 	nodeRemLink(ntree, sock_to->link);
@@ -140,7 +141,7 @@ static void node_socket_disconnect(Main *bmain, bNodeTree *ntree, bNode *node_to
 /* remove all nodes connected to this socket, if they aren't connected to other nodes */
 static void node_socket_remove(Main *bmain, bNodeTree *ntree, bNode *node_to, bNodeSocket *sock_to)
 {
-	if(!sock_to->link)
+	if (!sock_to->link)
 		return;
 
 	node_remove_linked(ntree, sock_to->link->fromnode);
@@ -159,31 +160,31 @@ static void node_socket_add_replace(Main *bmain, bNodeTree *ntree, bNode *node_t
 	bNode *node_prev = NULL;
 
 	/* unlink existing node */
-	if(sock_to->link) {
+	if (sock_to->link) {
 		node_prev = sock_to->link->fromnode;
 		nodeRemLink(ntree, sock_to->link);
 	}
 
 	/* find existing node that we can use */
-	for(node_from=ntree->nodes.first; node_from; node_from=node_from->next)
-		if(node_from->type == ntemp->type)
+	for (node_from=ntree->nodes.first; node_from; node_from=node_from->next)
+		if (node_from->type == ntemp->type)
 			break;
 
-	if(node_from)
-		if(!(node_from->inputs.first == NULL && !(node_from->typeinfo->flag & NODE_OPTIONS)))
+	if (node_from)
+		if (!(node_from->inputs.first == NULL && !(node_from->typeinfo->flag & NODE_OPTIONS)))
 			node_from = NULL;
 
-	if(node_prev && node_prev->type == ntemp->type &&
+	if (node_prev && node_prev->type == ntemp->type &&
 		(ntemp->type != NODE_GROUP || node_prev->id == &ntemp->ngroup->id)) {
 		/* keep the previous node if it's the same type */
 		node_from = node_prev;
 	}
-	else if(!node_from) {
+	else if (!node_from) {
 		node_from= nodeAddNode(ntree, ntemp);
 		node_from->locx = node_to->locx - (node_from->typeinfo->width + 50);
 		node_from->locy = node_to->locy;
 
-		if(node_from->id)
+		if (node_from->id)
 			id_us_plus(node_from->id);
 	}
 
@@ -194,15 +195,18 @@ static void node_socket_add_replace(Main *bmain, bNodeTree *ntree, bNode *node_t
 	nodeAddLink(ntree, node_from, sock_from, node_to, sock_to);
 
 	/* copy input sockets from previous node */
-	if(node_prev && node_from != node_prev) {
+	if (node_prev && node_from != node_prev) {
 		bNodeSocket *sock_prev, *sock_from;
 
-		for(sock_prev=node_prev->inputs.first; sock_prev; sock_prev=sock_prev->next) {
-			for(sock_from=node_from->inputs.first; sock_from; sock_from=sock_from->next) {
-				if(strcmp(sock_prev->name, sock_from->name) == 0 && sock_prev->type == sock_from->type) {
+		for (sock_prev=node_prev->inputs.first; sock_prev; sock_prev=sock_prev->next) {
+			for (sock_from=node_from->inputs.first; sock_from; sock_from=sock_from->next) {
+				if (nodeCountSocketLinks(ntree, sock_from) >= sock_from->limit)
+					continue;
+				
+				if (strcmp(sock_prev->name, sock_from->name) == 0 && sock_prev->type == sock_from->type) {
 					bNodeLink *link = sock_prev->link;
 
-					if(link && link->fromnode) {
+					if (link && link->fromnode) {
 						nodeAddLink(ntree, link->fromnode, link->fromsock, node_from, sock_from);
 						nodeRemLink(ntree, link);
 					}
@@ -215,7 +219,7 @@ static void node_socket_add_replace(Main *bmain, bNodeTree *ntree, bNode *node_t
 		}
 
 		/* also preserve mapping for texture nodes */
-		if(node_from->typeinfo->nclass == NODE_CLASS_TEXTURE &&
+		if (node_from->typeinfo->nclass == NODE_CLASS_TEXTURE &&
 		   node_prev->typeinfo->nclass == NODE_CLASS_TEXTURE)
 			memcpy(node_from->storage, node_prev->storage, sizeof(NodeTexBase));
 
@@ -250,7 +254,7 @@ typedef struct NodeLinkArg {
 	uiLayout *layout;
 } NodeLinkArg;
 
-static void ui_node_link(bContext *UNUSED(C), void *arg_p, void *event_p)
+static void ui_node_link(bContext *C, void *arg_p, void *event_p)
 {
 	NodeLinkArg *arg = (NodeLinkArg*)arg_p;
 	Main *bmain = arg->bmain;
@@ -262,34 +266,42 @@ static void ui_node_link(bContext *UNUSED(C), void *arg_p, void *event_p)
 
 	ntemp.type = arg->type;
 	ntemp.ngroup = arg->ngroup;
+	ntemp.scene = CTX_data_scene(C);
+	ntemp.main = CTX_data_main(C);
 
-	if(event == UI_NODE_LINK_DISCONNECT)
+	if (event == UI_NODE_LINK_DISCONNECT)
 		node_socket_disconnect(bmain, ntree, node_to, sock_to);
-	else if(event == UI_NODE_LINK_REMOVE)
+	else if (event == UI_NODE_LINK_REMOVE)
 		node_socket_remove(bmain, ntree, node_to, sock_to);
 	else
 		node_socket_add_replace(bmain, ntree, node_to, sock_to, &ntemp, arg->output);
+	
+	ED_undo_push(C, "Node input modify");
 }
 
 static void ui_node_sock_name(bNodeSocket *sock, char name[UI_MAX_NAME_STR])
 {
-	if(sock->link && sock->link->fromnode) {
+	if (sock->link && sock->link->fromnode) {
 		bNode *node = sock->link->fromnode;
 		char node_name[UI_MAX_NAME_STR];
 
-		if(node->type == NODE_GROUP)
-			BLI_strncpy(node_name, node->id->name+2, UI_MAX_NAME_STR);
+		if (node->type == NODE_GROUP) {
+			if (node->id)
+				BLI_strncpy(node_name, node->id->name+2, UI_MAX_NAME_STR);
+			else
+				BLI_strncpy(node_name, "Group", UI_MAX_NAME_STR);
+		}
 		else
 			BLI_strncpy(node_name, node->typeinfo->name, UI_MAX_NAME_STR);
 
-		if(node->inputs.first == NULL &&
+		if (node->inputs.first == NULL &&
 		   node->outputs.first != node->outputs.last &&
 		   !(node->typeinfo->flag & NODE_OPTIONS))
 			BLI_snprintf(name, UI_MAX_NAME_STR, "%s | %s", node_name, sock->link->fromsock->name);
 		else
 			BLI_strncpy(name, node_name, UI_MAX_NAME_STR);
 	}
-	else if(sock->type == SOCK_SHADER)
+	else if (sock->type == SOCK_SHADER)
 		BLI_strncpy(name, "None", UI_MAX_NAME_STR);
 	else
 		BLI_strncpy(name, "Default", UI_MAX_NAME_STR);
@@ -315,31 +327,31 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
 	int first = 1;
 	int compatibility= 0;
 
-	if(ntree->type == NTREE_SHADER) {
-		if(scene_use_new_shading_nodes(arg->scene))
+	if (ntree->type == NTREE_SHADER) {
+		if (scene_use_new_shading_nodes(arg->scene))
 			compatibility= NODE_NEW_SHADING;
 		else
 			compatibility= NODE_OLD_SHADING;
 	}
 
-	if(nclass == NODE_CLASS_GROUP) {
-		for(ngroup=bmain->nodetree.first; ngroup; ngroup=ngroup->id.next) {
+	if (nclass == NODE_CLASS_GROUP) {
+		for (ngroup=bmain->nodetree.first; ngroup; ngroup=ngroup->id.next) {
 			bNodeSocket *gsock;
 			char name[UI_MAX_NAME_STR];
 			int i, j, num = 0;
 
-			if(ngroup->type != ntree->type)
+			if (ngroup->type != ntree->type)
 				continue;
 
-			for(gsock=ngroup->inputs.first; gsock; gsock=gsock->next)
-				if(ui_compatible_sockets(gsock->type, sock->type))
+			for (gsock=ngroup->inputs.first; gsock; gsock=gsock->next)
+				if (ui_compatible_sockets(gsock->type, sock->type))
 					num++;
 
-			for(i=0, j=0, gsock=ngroup->outputs.first; gsock; gsock=gsock->next, i++) {
-				if(!ui_compatible_sockets(gsock->type, sock->type))
+			for (i=0, j=0, gsock=ngroup->outputs.first; gsock; gsock=gsock->next, i++) {
+				if (!ui_compatible_sockets(gsock->type, sock->type))
 					continue;
 
-				if(first) {
+				if (first) {
 					column= uiLayoutColumn(layout, 0);
 					uiBlockSetCurLayout(block, column);
 
@@ -350,8 +362,8 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
 					first = 0;
 				}
 
-				if(num > 1) {
-					if(j == 0) {
+				if (num > 1) {
+					if (j == 0) {
 						uiItemL(column, ngroup->id.name+2, ICON_NODE);
 						but= block->buttons.last;
 						but->flag= UI_TEXT_LEFT;
@@ -377,26 +389,26 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
 	else {
 		bNodeTreeType *ttype= ntreeGetType(ntree->type);
 
-		for(ntype=ttype->node_types.first; ntype; ntype=ntype->next) {
+		for (ntype=ttype->node_types.first; ntype; ntype=ntype->next) {
 			bNodeSocketTemplate *stemp;
 			char name[UI_MAX_NAME_STR];
 			int i, j, num = 0;
 
-			if(compatibility && !(ntype->compatibility & compatibility))
+			if (compatibility && !(ntype->compatibility & compatibility))
 				continue;
 
-			if(ntype->nclass != nclass)
+			if (ntype->nclass != nclass)
 				continue;
 
-			for(i=0, stemp=ntype->outputs; stemp && stemp->type != -1; stemp++, i++)
-				if(ui_compatible_sockets(stemp->type, sock->type))
+			for (i=0, stemp=ntype->outputs; stemp && stemp->type != -1; stemp++, i++)
+				if (ui_compatible_sockets(stemp->type, sock->type))
 					num++;
 
-			for(i=0, j=0, stemp=ntype->outputs; stemp && stemp->type != -1; stemp++, i++) {
-				if(!ui_compatible_sockets(stemp->type, sock->type))
+			for (i=0, j=0, stemp=ntype->outputs; stemp && stemp->type != -1; stemp++, i++) {
+				if (!ui_compatible_sockets(stemp->type, sock->type))
 					continue;
 
-				if(first) {
+				if (first) {
 					column= uiLayoutColumn(layout, 0);
 					uiBlockSetCurLayout(block, column);
 
@@ -407,8 +419,8 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
 					first = 0;
 				}
 
-				if(num > 1) {
-					if(j == 0) {
+				if (num > 1) {
+					if (j == 0) {
 						uiItemL(column, ntype->name, ICON_NODE);
 						but= block->buttons.last;
 						but->flag= UI_TEXT_LEFT;
@@ -436,7 +448,7 @@ static void node_menu_column_foreach_cb(void *calldata, int nclass, const char *
 {
 	NodeLinkArg *arg = (NodeLinkArg*)calldata;
 
-	if(!ELEM(nclass, NODE_CLASS_GROUP, NODE_CLASS_LAYOUT))
+	if (!ELEM(nclass, NODE_CLASS_GROUP, NODE_CLASS_LAYOUT))
 		ui_node_menu_column(arg, nclass, name);
 }
 
@@ -458,13 +470,13 @@ static void ui_template_node_link_menu(bContext *C, uiLayout *layout, void *but_
 	arg->scene= scene;
 	arg->layout= split;
 	
-	if(ntreetype && ntreetype->foreach_nodeclass)
+	if (ntreetype && ntreetype->foreach_nodeclass)
 		ntreetype->foreach_nodeclass(scene, arg, node_menu_column_foreach_cb);
 
 	column= uiLayoutColumn(split, 0);
 	uiBlockSetCurLayout(block, column);
 
-	if(sock->link) {
+	if (sock->link) {
 		uiItemL(column, "Link", ICON_NONE);
 		but= block->buttons.last;
 		but->flag= UI_TEXT_LEFT;
@@ -496,21 +508,21 @@ void uiTemplateNodeLink(uiLayout *layout, bNodeTree *ntree, bNode *node, bNodeSo
 
 	uiBlockSetCurLayout(block, layout);
 
-	if(sock->link || sock->type == SOCK_SHADER || (sock->flag & SOCK_HIDE_VALUE)) {
+	if (sock->link || sock->type == SOCK_SHADER || (sock->flag & SOCK_HIDE_VALUE)) {
 		char name[UI_MAX_NAME_STR];
 		ui_node_sock_name(sock, name);
-		but= uiDefMenuBut(block, ui_template_node_link_menu, NULL, name, 0, 0, UI_UNIT_X*4, UI_UNIT_Y, "");
+		but = uiDefMenuBut(block, ui_template_node_link_menu, NULL, name, 0, 0, UI_UNIT_X*4, UI_UNIT_Y, "");
 	}
 	else
-		but= uiDefIconMenuBut(block, ui_template_node_link_menu, NULL, ICON_NONE, 0, 0, UI_UNIT_X, UI_UNIT_Y, "");
+		but = uiDefIconMenuBut(block, ui_template_node_link_menu, NULL, ICON_NONE, 0, 0, UI_UNIT_X, UI_UNIT_Y, "");
 
 	but->type= MENU;
 	but->flag |= UI_TEXT_LEFT|UI_BUT_NODE_LINK;
 	but->poin= (char*)but;
 	but->func_argN = arg;
 
-	if(sock->link && sock->link->fromnode)
-		if(sock->link->fromnode->flag & NODE_ACTIVE_TEXTURE)
+	if (sock->link && sock->link->fromnode)
+		if (sock->link->fromnode->flag & NODE_ACTIVE_TEXTURE)
 			but->flag |= UI_BUT_NODE_ACTIVE;
 }
 
@@ -527,8 +539,8 @@ static void ui_node_draw_node(uiLayout *layout, bContext *C, bNodeTree *ntree, b
 
 	RNA_pointer_create(&ntree->id, &RNA_Node, node, &nodeptr);
 
-	if(node->typeinfo->uifunc) {
-		if(node->type != NODE_GROUP) {
+	if (node->typeinfo->uifunc) {
+		if (node->type != NODE_GROUP) {
 			split = uiLayoutSplit(layout, 0.35f, 0);
 			col = uiLayoutColumn(split, 0);
 			col = uiLayoutColumn(split, 0);
@@ -537,7 +549,7 @@ static void ui_node_draw_node(uiLayout *layout, bContext *C, bNodeTree *ntree, b
 		}
 	}
 
-	for(input=node->inputs.first; input; input=input->next)
+	for (input=node->inputs.first; input; input=input->next)
 		ui_node_draw_input(layout, C, ntree, node, input, depth+1);
 }
 
@@ -552,7 +564,7 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
 	int indent = (depth > 1)? 2*(depth - 1): 0;
 	int dependency_loop;
 
-	if(input->flag & SOCK_UNAVAIL)
+	if (input->flag & SOCK_UNAVAIL)
 		return;
 
 	/* to avoid eternal loops on cyclic dependencies */
@@ -560,7 +572,7 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
 	lnode = (input->link)? input->link->fromnode: NULL;
 
 	dependency_loop = (lnode && (lnode->flag & NODE_TEST));
-	if(dependency_loop)
+	if (dependency_loop)
 		lnode = NULL;
 
 	/* socket RNA pointer */
@@ -576,10 +588,10 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
 
 	row = uiLayoutRow(split, 1);
 
-	if(depth > 0) {
+	if (depth > 0) {
 		uiBlockSetEmboss(block, UI_EMBOSSN);
 
-		if(lnode && (lnode->inputs.first || (lnode->typeinfo->uifunc && lnode->type != NODE_GROUP))) {
+		if (lnode && (lnode->inputs.first || (lnode->typeinfo->uifunc && lnode->type != NODE_GROUP))) {
 			int icon = (input->flag & SOCK_COLLAPSED)? ICON_DISCLOSURE_TRI_RIGHT: ICON_DISCLOSURE_TRI_DOWN;
 			uiItemR(row, &inputptr, "show_expanded", UI_ITEM_R_ICON_ONLY, "", icon);
 		}
@@ -596,16 +608,16 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
 	bt= block->buttons.last;
 	bt->flag= UI_TEXT_LEFT;
 
-	if(dependency_loop) {
+	if (dependency_loop) {
 		row = uiLayoutRow(split, 0);
 		uiItemL(row, "Dependency Loop", ICON_ERROR);
 	}
-	else if(lnode) {
+	else if (lnode) {
 		/* input linked to a node */
 		uiTemplateNodeLink(split, ntree, node, input);
 
-		if(!(input->flag & SOCK_COLLAPSED)) {
-			if(depth == 0)
+		if (!(input->flag & SOCK_COLLAPSED)) {
+			if (depth == 0)
 				uiItemS(layout);
 
 			ui_node_draw_node(layout, C, ntree, lnode, depth);
@@ -613,8 +625,8 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
 	}
 	else {
 		/* input not linked, show value */
-		if(input->type != SOCK_SHADER && !(input->flag & SOCK_HIDE_VALUE)) {
-			if(input->type == SOCK_VECTOR) {
+		if (input->type != SOCK_SHADER && !(input->flag & SOCK_HIDE_VALUE)) {
+			if (input->type == SOCK_VECTOR) {
 				row = uiLayoutRow(split, 0);
 				col = uiLayoutColumn(row, 0);
 
@@ -639,14 +651,14 @@ void uiTemplateNodeView(uiLayout *layout, bContext *C, bNodeTree *ntree, bNode *
 {
 	bNode *tnode;
 
-	if(!ntree)
+	if (!ntree)
 		return;
 
 	/* clear for cycle check */
-	for(tnode=ntree->nodes.first; tnode; tnode=tnode->next)
+	for (tnode=ntree->nodes.first; tnode; tnode=tnode->next)
 		tnode->flag &= ~NODE_TEST;
 
-	if(input)
+	if (input)
 		ui_node_draw_input(layout, C, ntree, node, input, 0);
 	else
 		ui_node_draw_node(layout, C, ntree, node, 0);
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index 493fb85..fca9927 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -72,13 +72,13 @@ ARegion *node_has_buttons_region(ScrArea *sa)
 	ARegion *ar, *arnew;
 
 	ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
-	if(ar) return ar;
+	if (ar) return ar;
 	
 	/* add subdiv level; after 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 node");
 	
@@ -125,15 +125,15 @@ static SpaceLink *node_new(const bContext *UNUSED(C))
 	BLI_addtail(&snode->regionbase, ar);
 	ar->regiontype= RGN_TYPE_WINDOW;
 	
-	ar->v2d.tot.xmin=  -256.0f;
-	ar->v2d.tot.ymin=  -256.0f;
-	ar->v2d.tot.xmax= 768.0f;
-	ar->v2d.tot.ymax= 768.0f;
+	ar->v2d.tot.xmin =  -256.0f;
+	ar->v2d.tot.ymin =  -256.0f;
+	ar->v2d.tot.xmax = 768.0f;
+	ar->v2d.tot.ymax = 768.0f;
 	
-	ar->v2d.cur.xmin=  -256.0f;
-	ar->v2d.cur.ymin=  -256.0f;
-	ar->v2d.cur.xmax= 768.0f;
-	ar->v2d.cur.ymax= 768.0f;
+	ar->v2d.cur.xmin =  -256.0f;
+	ar->v2d.cur.ymin =  -256.0f;
+	ar->v2d.cur.xmax = 768.0f;
+	ar->v2d.cur.ymax = 768.0f;
 	
 	ar->v2d.min[0]= 1.0f;
 	ar->v2d.min[1]= 1.0f;
@@ -183,8 +183,8 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
 					ED_area_tag_redraw(sa);
 					break;
 				case ND_TRANSFORM_DONE:
-					if(type==NTREE_COMPOSIT) {
-						if(snode->flag & SNODE_AUTO_RENDER) {
+					if (type==NTREE_COMPOSIT) {
+						if (snode->flag & SNODE_AUTO_RENDER) {
 							snode->recalc= 1;
 							ED_area_tag_refresh(sa);
 						}
@@ -193,48 +193,48 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
 			}
 			break;
 		case NC_WM:
-			if(wmn->data==ND_FILEREAD)
+			if (wmn->data==ND_FILEREAD)
 				ED_area_tag_refresh(sa);
 			break;
 		
 		/* future: add ID checks? */
 		case NC_MATERIAL:
-			if(type==NTREE_SHADER) {
-				if(wmn->data==ND_SHADING)
+			if (type==NTREE_SHADER) {
+				if (wmn->data==ND_SHADING)
 					ED_area_tag_refresh(sa);
-				else if(wmn->data==ND_SHADING_DRAW)
+				else if (wmn->data==ND_SHADING_DRAW)
 					ED_area_tag_refresh(sa);
-				else if(wmn->action==NA_ADDED && snode->edittree)
+				else if (wmn->action==NA_ADDED && snode->edittree)
 					nodeSetActiveID(snode->edittree, ID_MA, wmn->reference);
 					
 			}
 			break;
 		case NC_TEXTURE:
-			if(type==NTREE_SHADER || type==NTREE_TEXTURE) {
-				if(wmn->data==ND_NODES)
+			if (type==NTREE_SHADER || type==NTREE_TEXTURE) {
+				if (wmn->data==ND_NODES)
 					ED_area_tag_refresh(sa);
 			}
 			break;
 		case NC_WORLD:
-			if(type==NTREE_SHADER && shader_type==SNODE_SHADER_WORLD) {
+			if (type==NTREE_SHADER && shader_type==SNODE_SHADER_WORLD) {
 				ED_area_tag_refresh(sa);	
 			}
 			break;
 		case NC_OBJECT:
-			if(type==NTREE_SHADER) {
-				if(wmn->data==ND_OB_SHADING)
+			if (type==NTREE_SHADER) {
+				if (wmn->data==ND_OB_SHADING)
 					ED_area_tag_refresh(sa);
 			}
 			break;
 		case NC_TEXT:
 			/* pynodes */
-			if(wmn->data==ND_SHADING)
+			if (wmn->data==ND_SHADING)
 				ED_area_tag_refresh(sa);
 			break;
 		case NC_SPACE:
-			if(wmn->data==ND_SPACE_NODE)
+			if (wmn->data==ND_SPACE_NODE)
 				ED_area_tag_refresh(sa);
-			else if(wmn->data==ND_SPACE_NODE_VIEW)
+			else if (wmn->data==ND_SPACE_NODE_VIEW)
 				ED_area_tag_redraw(sa);
 			break;
 		case NC_NODE:
@@ -253,11 +253,11 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
 
 		case NC_IMAGE:
 			if (wmn->action == NA_EDITED) {
-				if(type==NTREE_COMPOSIT) {
+				if (type==NTREE_COMPOSIT) {
 					/* note that nodeUpdateID is already called by BKE_image_signal() on all
 					 * scenes so really this is just to know if the images is used in the compo else
 					 * painting on images could become very slow when the compositor is open. */
-					if(nodeUpdateID(snode->nodetree, wmn->reference))
+					if (nodeUpdateID(snode->nodetree, wmn->reference))
 						ED_area_tag_refresh(sa);
 				}
 			}
@@ -272,29 +272,29 @@ static void node_area_refresh(const struct bContext *C, struct ScrArea *sa)
 
 	snode_set_context(snode, CTX_data_scene(C));
 	
-	if(snode->nodetree) {
-		if(snode->treetype==NTREE_SHADER) {
-			if(GS(snode->id->name) == ID_MA) {
+	if (snode->nodetree) {
+		if (snode->treetype==NTREE_SHADER) {
+			if (GS(snode->id->name) == ID_MA) {
 				Material *ma= (Material *)snode->id;
-				if(ma->use_nodes)
+				if (ma->use_nodes)
 					ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
 			}
-			else if(GS(snode->id->name) == ID_LA) {
+			else if (GS(snode->id->name) == ID_LA) {
 				Lamp *la= (Lamp *)snode->id;
-				if(la->use_nodes)
+				if (la->use_nodes)
 					ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
 			}
-			else if(GS(snode->id->name) == ID_WO) {
+			else if (GS(snode->id->name) == ID_WO) {
 				World *wo= (World *)snode->id;
-				if(wo->use_nodes)
+				if (wo->use_nodes)
 					ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
 			}
 		}
-		else if(snode->treetype==NTREE_COMPOSIT) {
+		else if (snode->treetype==NTREE_COMPOSIT) {
 			Scene *scene= (Scene *)snode->id;
-			if(scene->use_nodes) {
+			if (scene->use_nodes) {
 				/* recalc is set on 3d view changes for auto compo */
-				if(snode->recalc) {
+				if (snode->recalc) {
 					snode->recalc= 0;
 					node_render_changed_exec((struct bContext*)C, NULL);
 				}
@@ -302,9 +302,9 @@ static void node_area_refresh(const struct bContext *C, struct ScrArea *sa)
 					snode_composite_job(C, sa);
 			}
 		}
-		else if(snode->treetype==NTREE_TEXTURE) {
+		else if (snode->treetype==NTREE_TEXTURE) {
 			Tex *tex= (Tex *)snode->id;
-			if(tex->use_nodes) {
+			if (tex->use_nodes) {
 				ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
 			}
 		}
@@ -330,7 +330,7 @@ static void node_buttons_area_init(wmWindowManager *wm, ARegion *ar)
 
 	ED_region_panels_init(wm, ar);
 	
-	keymap= WM_keymap_find(wm->defaultconf, "Node Generic", SPACE_NODE, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Node Generic", SPACE_NODE, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
@@ -339,7 +339,7 @@ static void node_buttons_area_draw(const bContext *C, ARegion *ar)
 	ED_region_panels(C, ar, 1, NULL, -1);
 }
 
-/* Initialise main area, setting handlers. */
+/* Initialize main area, setting handlers. */
 static void node_main_area_init(wmWindowManager *wm, ARegion *ar)
 {
 	wmKeyMap *keymap;
@@ -348,10 +348,10 @@ static void node_main_area_init(wmWindowManager *wm, ARegion *ar)
 	UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
 	
 	/* own keymaps */
-	keymap= WM_keymap_find(wm->defaultconf, "Node Generic", SPACE_NODE, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Node Generic", SPACE_NODE, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 	
-	keymap= WM_keymap_find(wm->defaultconf, "Node Editor", SPACE_NODE, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Node Editor", SPACE_NODE, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 	
 	/* add drop boxes */
@@ -372,13 +372,13 @@ static void node_main_area_draw(const bContext *C, ARegion *ar)
 
 static int node_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
 {
-	if(drag->type==WM_DRAG_ID) {
+	if (drag->type==WM_DRAG_ID) {
 		ID *id= (ID *)drag->poin;
-		if( GS(id->name)==ID_IM )
+		if ( GS(id->name)==ID_IM )
 			return 1;
 	}
-	else if(drag->type==WM_DRAG_PATH){
-		if(ELEM(drag->icon, 0, ICON_FILE_IMAGE))	/* rule might not work? */
+	else if (drag->type==WM_DRAG_PATH) {
+		if (ELEM(drag->icon, 0, ICON_FILE_IMAGE))	/* rule might not work? */
 			return 1;
 	}
 	return 0;
@@ -388,7 +388,7 @@ static void node_id_path_drop_copy(wmDrag *drag, wmDropBox *drop)
 {
 	ID *id= (ID *)drag->poin;
 	
-	if(id) {
+	if (id) {
 		RNA_string_set(drop->ptr, "name", id->name+2);
 	}
 	if (drag->path[0]) {
@@ -431,11 +431,11 @@ static void node_region_listener(ARegion *ar, wmNotifier *wmn)
 	/* context changes */
 	switch(wmn->category) {
 		case NC_SPACE:
-			if(wmn->data==ND_SPACE_NODE)
+			if (wmn->data==ND_SPACE_NODE)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_SCREEN:
-			if(wmn->data == ND_GPENCIL)	
+			if (wmn->data == ND_GPENCIL)	
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_SCENE:
@@ -445,11 +445,11 @@ static void node_region_listener(ARegion *ar, wmNotifier *wmn)
 			ED_region_tag_redraw(ar);
 			break;
 		case NC_OBJECT:
-			if(wmn->data==ND_OB_SHADING)
+			if (wmn->data==ND_OB_SHADING)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_ID:
-			if(wmn->action == NA_RENAME)
+			if (wmn->action == NA_RENAME)
 				ED_region_tag_redraw(ar);
 			break;
 	}
@@ -461,16 +461,16 @@ static int node_context(const bContext *C, const char *member, bContextDataResul
 {
 	SpaceNode *snode= CTX_wm_space_node(C);
 	
-	if(CTX_data_dir(member)) {
+	if (CTX_data_dir(member)) {
 		CTX_data_dir_set(result, node_context_dir);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "selected_nodes")) {
+	else if (CTX_data_equals(member, "selected_nodes")) {
 		bNode *node;
 		
-		if(snode->edittree) {
-			for(node=snode->edittree->nodes.last; node; node=node->prev) {
-				if(node->flag & NODE_SELECT) {
+		if (snode->edittree) {
+			for (node=snode->edittree->nodes.last; node; node=node->prev) {
+				if (node->flag & NODE_SELECT) {
 					CTX_data_list_add(result, &snode->edittree->id, &RNA_Node, node);
 				}
 			}
@@ -478,12 +478,12 @@ static int node_context(const bContext *C, const char *member, bContextDataResul
 		CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "active_node")) {
+	else if (CTX_data_equals(member, "active_node")) {
 		bNode *node;
 		
-		if(snode->edittree) {
-			for(node=snode->edittree->nodes.last; node; node=node->prev) {
-				if(node->flag & NODE_ACTIVE) {
+		if (snode->edittree) {
+			for (node=snode->edittree->nodes.last; node; node=node->prev) {
+				if (node->flag & NODE_ACTIVE) {
 					CTX_data_pointer_set(result, &snode->edittree->id, &RNA_Node, node);
 					break;
 				}
diff --git a/source/blender/editors/space_outliner/CMakeLists.txt b/source/blender/editors/space_outliner/CMakeLists.txt
index 27b4a56..5a7bbc2 100644
--- a/source/blender/editors/space_outliner/CMakeLists.txt
+++ b/source/blender/editors/space_outliner/CMakeLists.txt
@@ -22,6 +22,7 @@ set(INC
 	../include
 	../../blenkernel
 	../../blenlib
+	../../blenfont
 	../../blenloader
 	../../imbuf
 	../../makesdna
@@ -47,4 +48,8 @@ set(SRC
 	outliner_intern.h
 )
 
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
 blender_add_lib(bf_editor_space_outliner "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_outliner/SConscript b/source/blender/editors/space_outliner/SConscript
index ab0b858..a6f2e3c 100644
--- a/source/blender/editors/space_outliner/SConscript
+++ b/source/blender/editors/space_outliner/SConscript
@@ -2,9 +2,13 @@
 Import ('env')
 
 sources = env.Glob('*.c')
+defs = []
 
-incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
+incs = '../include ../../blenlib ../../blenfont ../../blenkernel ../../makesdna ../../imbuf'
 incs += ' ../../windowmanager #/intern/guardedalloc ../../makesrna ../../blenloader'
 incs += ' #/extern/glew/include'
 
-env.BlenderLib ( 'bf_editors_space_outliner', sources, Split(incs), [], libtype=['core'], priority=[60] )
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
+
+env.BlenderLib ( 'bf_editors_space_outliner', sources, Split(incs), defines=defs, libtype=['core'], priority=[60] )
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index e407328..7794759 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -29,49 +29,30 @@
  *  \ingroup spoutliner
  */
 
-#include <string.h>
-#include <stdlib.h>
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_anim_types.h"
 #include "DNA_armature_types.h"
-#include "DNA_camera_types.h"
 #include "DNA_group_types.h"
-#include "DNA_key_types.h"
 #include "DNA_lamp_types.h"
-#include "DNA_material_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meta_types.h"
-#include "DNA_particle_types.h"
+#include "DNA_object_types.h"
 #include "DNA_scene_types.h"
-#include "DNA_world_types.h"
 #include "DNA_sequence_types.h"
-#include "DNA_object_types.h"
 
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
+#include "BLI_ghash.h"
 
-#include "BKE_animsys.h"
 #include "BKE_context.h"
 #include "BKE_deform.h"
 #include "BKE_depsgraph.h"
-#include "BKE_fcurve.h"
 #include "BKE_global.h"
-#include "BKE_group.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
 #include "BKE_modifier.h"
 #include "BKE_report.h"
 #include "BKE_scene.h"
-#include "BKE_sequencer.h"
-
-#include "BLI_ghash.h"
 
 #include "ED_armature.h"
 #include "ED_object.h"
 #include "ED_screen.h"
-#include "ED_util.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
@@ -85,7 +66,6 @@
 #include "UI_view2d.h"
 
 #include "RNA_access.h"
-#include "RNA_define.h"
 
 #include "outliner_intern.h"
 
@@ -95,9 +75,9 @@
 static void outliner_height(SpaceOops *soops, ListBase *lb, int *h)
 {
 	TreeElement *te= lb->first;
-	while(te) {
+	while (te) {
 		TreeStoreElem *tselem= TREESTORE(te);
-		if(TSELEM_OPEN(tselem,soops))
+		if (TSELEM_OPEN(tselem,soops))
 			outliner_height(soops, &te->subtree, h);
 		(*h) += UI_UNIT_Y;
 		te= te->next;
@@ -108,11 +88,11 @@ static void outliner_height(SpaceOops *soops, ListBase *lb, int *h)
 static void outliner_width(SpaceOops *soops, ListBase *lb, int *w)
 {
 	TreeElement *te= lb->first;
-	while(te) {
+	while (te) {
 //		TreeStoreElem *tselem= TREESTORE(te);
 		
 		// XXX fixme... te->xend is not set yet
-		if(!TSELEM_OPEN(tselem,soops)) {
+		if (!TSELEM_OPEN(tselem,soops)) {
 			if (te->xend > *w)
 				*w = te->xend;
 		}
@@ -125,17 +105,19 @@ static void outliner_width(SpaceOops *soops, ListBase *lb, int *w)
 static void outliner_rna_width(SpaceOops *soops, ListBase *lb, int *w, int startx)
 {
 	TreeElement *te= lb->first;
-	while(te) {
+	while (te) {
 		TreeStoreElem *tselem= TREESTORE(te);
-			// XXX fixme... (currently, we're using a fixed length of 100)!
-		/*if(te->xend) {
-			if(te->xend > *w)
+		// XXX fixme... (currently, we're using a fixed length of 100)!
+#if 0
+		if (te->xend) {
+			if (te->xend > *w)
 				*w = te->xend;
-		}*/
-		if(startx+100 > *w)
+		}
+#endif
+		if (startx+100 > *w)
 			*w = startx+100;
 
-		if(TSELEM_OPEN(tselem,soops))
+		if (TSELEM_OPEN(tselem,soops))
 			outliner_rna_width(soops, &te->subtree, w, startx+UI_UNIT_X);
 		te= te->next;
 	}
@@ -148,7 +130,7 @@ static void restrictbutton_view_cb(bContext *C, void *poin, void *poin2)
 	Scene *scene = (Scene *)poin;
 	Object *ob = (Object *)poin2;
 
-	if(!common_restrict_check(C, ob)) return;
+	if (!common_restrict_check(C, ob)) return;
 	
 	/* deselect objects that are invisible */
 	if (ob->restrictflag & OB_RESTRICT_VIEW) {
@@ -165,7 +147,7 @@ static void restrictbutton_sel_cb(bContext *C, void *poin, void *poin2)
 	Scene *scene = (Scene *)poin;
 	Object *ob = (Object *)poin2;
 	
-	if(!common_restrict_check(C, ob)) return;
+	if (!common_restrict_check(C, ob)) return;
 	
 	/* if select restriction has just been turned on */
 	if (ob->restrictflag & OB_RESTRICT_SELECT) {
@@ -199,7 +181,7 @@ static void restrictbutton_modifier_cb(bContext *C, void *UNUSED(poin), void *po
 static void restrictbutton_bone_cb(bContext *C, void *UNUSED(poin), void *poin2)
 {
 	Bone *bone= (Bone *)poin2;
-	if(bone && (bone->flag & BONE_HIDDEN_P))
+	if (bone && (bone->flag & BONE_HIDDEN_P))
 		bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
 	WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
 }
@@ -207,7 +189,7 @@ static void restrictbutton_bone_cb(bContext *C, void *UNUSED(poin), void *poin2)
 static void restrictbutton_ebone_cb(bContext *C, void *UNUSED(poin), void *poin2)
 {
 	EditBone *ebone= (EditBone *)poin2;
-	if(ebone && (ebone->flag & BONE_HIDDEN_A))
+	if (ebone && (ebone->flag & BONE_HIDDEN_A))
 		ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
 
 	WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
@@ -217,8 +199,8 @@ static int group_restrict_flag(Group *gr, int flag)
 {
 	GroupObject *gob;
 
-	for(gob= gr->gobject.first; gob; gob= gob->next) {
-		if((gob->ob->restrictflag & flag) == 0)
+	for (gob= gr->gobject.first; gob; gob= gob->next) {
+		if ((gob->ob->restrictflag & flag) == 0)
 			return 0;
 	}
 
@@ -229,8 +211,8 @@ static int group_select_flag(Group *gr)
 {
 	GroupObject *gob;
 
-	for(gob= gr->gobject.first; gob; gob= gob->next)
-		if((gob->ob->flag & SELECT))
+	for (gob= gr->gobject.first; gob; gob= gob->next)
+		if ((gob->ob->flag & SELECT))
 			return 1;
 
 	return 0;
@@ -242,23 +224,23 @@ void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag)
 	GroupObject *gob;
 	Group *gr = (Group *)poin2; 	
 
-	if(group_restrict_flag(gr, flag)) {
-		for(gob= gr->gobject.first; gob; gob= gob->next) {
+	if (group_restrict_flag(gr, flag)) {
+		for (gob= gr->gobject.first; gob; gob= gob->next) {
 			gob->ob->restrictflag &= ~flag;
 			
-			if(flag==OB_RESTRICT_VIEW)
-				if(gob->ob->flag & SELECT)
+			if (flag==OB_RESTRICT_VIEW)
+				if (gob->ob->flag & SELECT)
 					ED_base_object_select(object_in_scene(gob->ob, scene), BA_DESELECT);
 		}
 	}
 	else {
-		for(gob= gr->gobject.first; gob; gob= gob->next) {
+		for (gob= gr->gobject.first; gob; gob= gob->next) {
 			/* not in editmode */
-			if(scene->obedit!=gob->ob) {
+			if (scene->obedit!=gob->ob) {
 				gob->ob->restrictflag |= flag;
 				
-				if(flag==OB_RESTRICT_VIEW)
-					if((gob->ob->flag & SELECT) == 0)
+				if (flag==OB_RESTRICT_VIEW)
+					if ((gob->ob->flag & SELECT) == 0)
 						ED_base_object_select(object_in_scene(gob->ob, scene), BA_SELECT);
 			}
 		}
@@ -290,10 +272,10 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
 	TreeStore *ts= soops->treestore;
 	TreeStoreElem *tselem= tsep;
 	
-	if(ts && tselem) {
+	if (ts && tselem) {
 		TreeElement *te= outliner_find_tse(soops, tselem);
 		
-		if(tselem->type==0) {
+		if (tselem->type==0) {
 			test_idbutton(tselem->id->name+2);	// library.c, unique name and alpha sort
 			
 			switch(GS(tselem->id->name)) {
@@ -333,7 +315,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
 			case TSE_EBONE:
 			{
 				bArmature *arm= (bArmature *)tselem->id;
-				if(arm->edbo) {
+				if (arm->edbo) {
 					EditBone *ebone= te->directdata;
 					char newname[sizeof(ebone->name)];
 					
@@ -405,11 +387,11 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
 	Object *ob = NULL;
 	Group  *gr = NULL;
 
-	for(te= lb->first; te; te= te->next) {
+	for (te= lb->first; te; te= te->next) {
 		tselem= TREESTORE(te);
-		if(te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {	
+		if (te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
 			/* objects have toggle-able restriction flags */
-			if(tselem->type==0 && te->idcode==ID_OB) {
+			if (tselem->type==0 && te->idcode==ID_OB) {
 				PointerRNA ptr;
 				
 				ob = (Object *)tselem->id;
@@ -434,7 +416,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
 				uiBlockSetEmboss(block, UI_EMBOSS);
 				
 			}
-			if(tselem->type==0 && te->idcode==ID_GR){ 
+			if (tselem->type==0 && te->idcode==ID_GR) {
 				int restrict_bool;
 				gr = (Group *)tselem->id;
 				
@@ -455,7 +437,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
 				uiBlockSetEmboss(block, UI_EMBOSS);
 			}
 			/* scene render layers and passes have toggle-able flags too! */
-			else if(tselem->type==TSE_R_LAYER) {
+			else if (tselem->type==TSE_R_LAYER) {
 				uiBlockSetEmboss(block, UI_EMBOSSN);
 				
 				bt= uiDefIconButBitI(block, ICONTOGN, SCE_LAY_DISABLE, 0, ICON_CHECKBOX_HLT-1, 
@@ -464,7 +446,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
 				
 				uiBlockSetEmboss(block, UI_EMBOSS);
 			}
-			else if(tselem->type==TSE_R_PASS) {
+			else if (tselem->type==TSE_R_PASS) {
 				int *layflag= te->directdata;
 				int passflag= 1<<tselem->nr;
 				
@@ -476,14 +458,14 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
 				uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL);
 				
 				layflag++;	/* is lay_xor */
-				if(ELEM8(passflag, SCE_PASS_SPEC, SCE_PASS_SHADOW, SCE_PASS_AO, SCE_PASS_REFLECT, SCE_PASS_REFRACT, SCE_PASS_INDIRECT, SCE_PASS_EMIT, SCE_PASS_ENVIRONMENT))
+				if (ELEM8(passflag, SCE_PASS_SPEC, SCE_PASS_SHADOW, SCE_PASS_AO, SCE_PASS_REFLECT, SCE_PASS_REFRACT, SCE_PASS_INDIRECT, SCE_PASS_EMIT, SCE_PASS_ENVIRONMENT))
 					bt= uiDefIconButBitI(block, TOG, passflag, 0, (*layflag & passflag)?ICON_DOT:ICON_BLANK1, 
 									 (int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, layflag, 0, 0, 0, 0, "Exclude this Pass from Combined");
 				uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL);
 				
 				uiBlockSetEmboss(block, UI_EMBOSS);
 			}
-			else if(tselem->type==TSE_MODIFIER)  {
+			else if (tselem->type==TSE_MODIFIER) {
 				ModifierData *md= (ModifierData *)te->directdata;
 				ob = (Object *)tselem->id;
 				
@@ -496,7 +478,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
 						(int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, &(md->mode), 0, 0, 0, 0, "Restrict/Allow renderability");
 				uiButSetFunc(bt, restrictbutton_modifier_cb, scene, ob);
 			}
-			else if(tselem->type==TSE_POSE_CHANNEL)  {
+			else if (tselem->type==TSE_POSE_CHANNEL) {
 				bPoseChannel *pchan= (bPoseChannel *)te->directdata;
 				Bone *bone = pchan->bone;
 				
@@ -509,7 +491,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
 						(int)ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, (int)te->ys, UI_UNIT_X-1, UI_UNIT_Y-1, &(bone->flag), 0, 0, 0, 0, "Restrict/Allow selection in the 3D View");
 				uiButSetFunc(bt, restrictbutton_bone_cb, NULL, NULL);
 			}
-			else if(tselem->type==TSE_EBONE)  {
+			else if (tselem->type==TSE_EBONE) {
 				EditBone *ebone= (EditBone *)te->directdata;
 				
 				uiBlockSetEmboss(block, UI_EMBOSSN);
@@ -523,7 +505,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
 			}
 		}
 		
-		if(TSELEM_OPEN(tselem,soops)) outliner_draw_restrictbuts(block, scene, ar, soops, &te->subtree);
+		if (TSELEM_OPEN(tselem,soops)) outliner_draw_restrictbuts(block, scene, ar, soops, &te->subtree);
 	}
 }
 
@@ -532,7 +514,7 @@ static void outliner_draw_rnacols(ARegion *ar, int sizex)
 	View2D *v2d= &ar->v2d;
 
 	float miny = v2d->cur.ymin-V2D_SCROLL_HEIGHT;
-	if(miny<v2d->tot.ymin) miny = v2d->tot.ymin;
+	if (miny<v2d->tot.ymin) miny = v2d->tot.ymin;
 
 	UI_ThemeColorShadeAlpha(TH_BACK, -15, -200);
 
@@ -557,17 +539,17 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa
 	
 	uiBlockSetEmboss(block, UI_EMBOSST);
 
-	for(te= lb->first; te; te= te->next) {
+	for (te= lb->first; te; te= te->next) {
 		tselem= TREESTORE(te);
-		if(te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {	
-			if(tselem->type == TSE_RNA_PROPERTY) {
+		if (te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
+			if (tselem->type == TSE_RNA_PROPERTY) {
 				ptr= &te->rnaptr;
 				prop= te->directdata;
 				
-				if(!(RNA_property_type(prop) == PROP_POINTER && (TSELEM_OPEN(tselem,soops))) )
+				if (!(RNA_property_type(prop) == PROP_POINTER && (TSELEM_OPEN(tselem,soops))) )
 					uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, sizex, (int)te->ys, OL_RNA_COL_SIZEX, UI_UNIT_Y-1);
 			}
-			else if(tselem->type == TSE_RNA_ARRAY_ELEM) {
+			else if (tselem->type == TSE_RNA_ARRAY_ELEM) {
 				ptr= &te->rnaptr;
 				prop= te->directdata;
 				
@@ -575,16 +557,16 @@ static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, Spa
 			}
 		}
 		
-		if(TSELEM_OPEN(tselem,soops)) outliner_draw_rnabuts(block, scene, ar, soops, sizex, &te->subtree);
+		if (TSELEM_OPEN(tselem,soops)) outliner_draw_rnabuts(block, scene, ar, soops, sizex, &te->subtree);
 	}
 }
 
 static void operator_call_cb(struct bContext *UNUSED(C), void *arg_kmi, void *arg2)
 {
 	wmOperatorType *ot= arg2;
-	wmKeyMapItem *kmi= arg_kmi;
+	wmKeyMapItem *kmi = arg_kmi;
 	
-	if(ot)
+	if (ot)
 		BLI_strncpy(kmi->idname, ot->idname, OP_MAX_TYPENAME);
 }
 
@@ -592,16 +574,16 @@ static void operator_search_cb(const struct bContext *UNUSED(C), void *UNUSED(ar
 {
 	GHashIterator *iter= WM_operatortype_iter();
 
-	for( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
+	for ( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
 		wmOperatorType *ot= BLI_ghashIterator_getValue(iter);
 		
-		if(BLI_strcasestr(ot->idname, str)) {
+		if (BLI_strcasestr(ot->idname, str)) {
 			char name[OP_MAX_TYPENAME];
 			
 			/* display name for menu */
 			WM_operator_py_idname(name, ot->idname);
 			
-			if(0==uiSearchItemAdd(items, name, ot, 0))
+			if (0==uiSearchItemAdd(items, name, ot, 0))
 				break;
 		}
 	}
@@ -614,7 +596,7 @@ static uiBlock *operator_search_menu(bContext *C, ARegion *ar, void *arg_kmi)
 	static char search[OP_MAX_TYPENAME];
 	wmEvent event;
 	wmWindow *win= CTX_wm_window(C);
-	wmKeyMapItem *kmi= arg_kmi;
+	wmKeyMapItem *kmi = arg_kmi;
 	wmOperatorType *ot= WM_operatortype_find(kmi->idname, 0);
 	uiBlock *block;
 	uiBut *but;
@@ -628,7 +610,7 @@ static uiBlock *operator_search_menu(bContext *C, ARegion *ar, void *arg_kmi)
 	/* fake button, it holds space for search items */
 	uiDefBut(block, LABEL, 0, "", 10, 15, 150, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL);
 	
-	but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 0, 150, UI_UNIT_Y, 0, 0, "");
+	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);
@@ -652,9 +634,9 @@ static uiBlock *operator_search_menu(bContext *C, ARegion *ar, void *arg_kmi)
 
 static short keymap_menu_type(short type)
 {
-	if(ISKEYBOARD(type)) return OL_KM_KEYBOARD;
-	if(ISTWEAK(type)) return OL_KM_TWEAK;
-	if(ISMOUSE(type)) return OL_KM_MOUSE;
+	if (ISKEYBOARD(type)) return OL_KM_KEYBOARD;
+	if (ISTWEAK(type)) return OL_KM_TWEAK;
+	if (ISMOUSE(type)) return OL_KM_MOUSE;
 //	return OL_KM_SPECIALS;
 	return 0;
 }
@@ -733,10 +715,10 @@ static const char *keymap_tweak_dir_menu(void)
 
 static void keymap_type_cb(bContext *C, void *kmi_v, void *UNUSED(arg_v))
 {
-	wmKeyMapItem *kmi= kmi_v;
+	wmKeyMapItem *kmi = kmi_v;
 	short maptype= keymap_menu_type(kmi->type);
 	
-	if(maptype!=kmi->maptype) {
+	if (maptype!=kmi->maptype) {
 		switch(kmi->maptype) {
 			case OL_KM_KEYBOARD:
 				kmi->type= AKEY;
@@ -765,9 +747,9 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo
 	
 	uiBlockSetEmboss(block, UI_EMBOSST);
 	
-	for(te= lb->first; te; te= te->next) {
+	for (te= lb->first; te; te= te->next) {
 		tselem= TREESTORE(te);
-		if(te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
+		if (te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
 			uiBut *but;
 			const char *str;
 			int xstart= 240;
@@ -775,11 +757,11 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo
 			int butw2= 90; /* event type, menus */
 			int butw3= 43; /* modifiers */
 
-			if(tselem->type == TSE_KEYMAP_ITEM) {
-				wmKeyMapItem *kmi= te->directdata;
+			if (tselem->type == TSE_KEYMAP_ITEM) {
+				wmKeyMapItem *kmi = te->directdata;
 				
 				/* modal map? */
-				if(kmi->propvalue);
+				if (kmi->propvalue);
 				else {
 					uiDefBlockBut(block, operator_search_menu, kmi, "", xstart, (int)te->ys+1, butw1, UI_UNIT_Y-1, "Assign new Operator");
 				}
@@ -789,7 +771,7 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo
 				kmi->maptype= keymap_menu_type(kmi->type);
 				
 				str= keymap_type_menu();
-				but= uiDefButS(block, MENU, 0, str,	xstart, (int)te->ys+1, butw2, UI_UNIT_Y-1, &kmi->maptype, 0, 0, 0, 0, "Event type");
+				but = uiDefButS(block, MENU, 0, str,	xstart, (int)te->ys+1, butw2, UI_UNIT_Y-1, &kmi->maptype, 0, 0, 0, 0, "Event type");
 				uiButSetFunc(but, keymap_type_cb, kmi, NULL);
 				xstart+= butw2+5;
 				
@@ -824,7 +806,7 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo
 				xstart+= butw3+5;
 				
 				/* rna property */
-				if(kmi->ptr && kmi->ptr->data) {
+				if (kmi->ptr && kmi->ptr->data) {
 					uiDefBut(block, LABEL, 0, "(RNA property)",	xstart, (int)te->ys+1, butw2, UI_UNIT_Y-1, &kmi->oskey, 0, 0, 0, 0, ""); xstart+= butw2;
 				}
 
@@ -832,7 +814,7 @@ static void outliner_draw_keymapbuts(uiBlock *block, ARegion *ar, SpaceOops *soo
 			}
 		}
 		
-		if(TSELEM_OPEN(tselem,soops)) outliner_draw_keymapbuts(block, ar, soops, &te->subtree);
+		if (TSELEM_OPEN(tselem,soops)) outliner_draw_keymapbuts(block, ar, soops, &te->subtree);
 	}
 }
 
@@ -844,38 +826,38 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Spa
 	TreeStoreElem *tselem;
 	int spx, dx, len;
 	
-	for(te= lb->first; te; te= te->next) {
+	for (te= lb->first; te; te= te->next) {
 		tselem= TREESTORE(te);
-		if(te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
+		if (te->ys+2*UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) {
 			
-			if(tselem->flag & TSE_TEXTBUT) {
+			if (tselem->flag & TSE_TEXTBUT) {
 				
 				/* If we add support to rename Sequence.
 				 * need change this.
 				 */
-				if(tselem->type == TSE_POSE_BASE) continue; // prevent crash when trying to rename 'pose' entry of armature
+				if (tselem->type == TSE_POSE_BASE) continue; // prevent crash when trying to rename 'pose' entry of armature
 				
-				if(tselem->type==TSE_EBONE) len = sizeof(((EditBone*) 0)->name);
+				if (tselem->type==TSE_EBONE) len = sizeof(((EditBone*) 0)->name);
 				else if (tselem->type==TSE_MODIFIER) len = sizeof(((ModifierData*) 0)->name);
-				else if(tselem->id && GS(tselem->id->name)==ID_LI) len = sizeof(((Library*) 0)->name);
+				else if (tselem->id && GS(tselem->id->name)==ID_LI) len = sizeof(((Library*) 0)->name);
 				else len= MAX_ID_NAME-2;
 				
 
 				dx= (int)UI_GetStringWidth(te->name);
-				if(dx<100) dx= 100;
+				if (dx<100) dx= 100;
 				spx=te->xs+2*UI_UNIT_X-4;
-				if(spx+dx+10>ar->v2d.cur.xmax) dx = ar->v2d.cur.xmax-spx-10;
+				if (spx+dx+10>ar->v2d.cur.xmax) dx = ar->v2d.cur.xmax-spx-10;
 
 				bt= uiDefBut(block, TEX, OL_NAMEBUTTON, "", spx, (int)te->ys, dx+10, UI_UNIT_Y-1, (void *)te->name, 1.0, (float)len, 0, 0, "");
 				uiButSetRenameFunc(bt, namebutton_cb, tselem);
 				
 				/* returns false if button got removed */
-				if( 0 == uiButActiveOnly(C, block, bt) )
+				if ( 0 == uiButActiveOnly(C, block, bt) )
 					tselem->flag &= ~TSE_TEXTBUT;
 			}
 		}
 		
-		if(TSELEM_OPEN(tselem,soops)) outliner_buttons(C, block, ar, soops, &te->subtree);
+		if (TSELEM_OPEN(tselem,soops)) outliner_buttons(C, block, ar, soops, &te->subtree);
 	}
 }
 
@@ -892,17 +874,18 @@ struct DrawIconArg {
 
 static void tselem_draw_icon_uibut(struct DrawIconArg *arg, int icon)
 {
-	/* restrict collumn clip... it has been coded by simply overdrawing, doesnt work for buttons */
-	if(arg->x >= arg->xmax) {
+	/* restrict column clip... it has been coded by simply overdrawing, doesnt work for buttons */
+	if (arg->x >= arg->xmax) {
 		glEnable(GL_BLEND);
 		UI_icon_draw_aspect(arg->x, arg->y, icon, 1.0f, arg->alpha);
 		glDisable(GL_BLEND);
-	} else {
+	}
+	else {
 		/* XXX investigate: button placement of icons is way different than UI_icon_draw? */
 		float ufac= UI_UNIT_X/20.0f;
-		uiBut *but= uiDefIconBut(arg->block, LABEL, 0, icon, arg->x-3.0f*ufac, arg->y, UI_UNIT_X-4.0f*ufac, UI_UNIT_Y-4.0f*ufac, NULL, 0.0, 0.0, 1.0, arg->alpha, (arg->id && arg->id->lib) ? arg->id->lib->name : "");
+		uiBut *but = uiDefIconBut(arg->block, LABEL, 0, icon, arg->x-3.0f*ufac, arg->y, UI_UNIT_X-4.0f*ufac, UI_UNIT_Y-4.0f*ufac, NULL, 0.0, 0.0, 1.0, arg->alpha, (arg->id && arg->id->lib) ? arg->id->lib->name : "");
 		
-		if(arg->id)
+		if (arg->id)
 			uiButSetDragID(but, arg->id);
 	}
 
@@ -915,12 +898,12 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
 	/* make function calls a bit compacter */
 	arg.block= block;
 	arg.id= tselem->id;
-	arg.xmax= xmax;
+	arg.xmax = xmax;
 	arg.x= x;
 	arg.y= y;
 	arg.alpha= alpha;
 	
-	if(tselem->type) {
+	if (tselem->type) {
 		switch( tselem->type) {
 			case TSE_ANIM_DATA:
 				UI_icon_draw(x, y, ICON_ANIM_DATA); break; // xxx
@@ -1050,15 +1033,15 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
 			case TSE_POSEGRP_BASE:
 				UI_icon_draw(x, y, ICON_VERTEXSEL); break;
 			case TSE_SEQUENCE:
-				if(te->idcode==SEQ_MOVIE)
+				if (te->idcode==SEQ_MOVIE)
 					UI_icon_draw(x, y, ICON_SEQUENCE);
-				else if(te->idcode==SEQ_META)
+				else if (te->idcode==SEQ_META)
 					UI_icon_draw(x, y, ICON_DOT);
-				else if(te->idcode==SEQ_SCENE)
+				else if (te->idcode==SEQ_SCENE)
 					UI_icon_draw(x, y, ICON_SCENE);
-				else if(te->idcode==SEQ_SOUND)
+				else if (te->idcode==SEQ_SOUND)
 					UI_icon_draw(x, y, ICON_SOUND);
-				else if(te->idcode==SEQ_IMAGE)
+				else if (te->idcode==SEQ_IMAGE)
 					UI_icon_draw(x, y, ICON_IMAGE_COL);
 				else
 					UI_icon_draw(x, y, ICON_PARTICLES);
@@ -1070,7 +1053,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
 				UI_icon_draw(x, y, ICON_OBJECT_DATA);
 				break;
 			case TSE_RNA_STRUCT:
-				if(RNA_struct_is_ID(te->rnaptr.type)) {
+				if (RNA_struct_is_ID(te->rnaptr.type)) {
 					arg.id= (ID *)te->rnaptr.data;
 					tselem_draw_icon_uibut(&arg, RNA_struct_ui_icon(te->rnaptr.type));
 				}
@@ -1178,26 +1161,26 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa
 	TreeStoreElem *tselem;
 	int active;
 
-	for(te= lb->first; te; te= te->next) {
+	for (te= lb->first; te; te= te->next) {
 		
 		/* exit drawing early */
-		if((*offsx) - UI_UNIT_X > xmax)
+		if ((*offsx) - UI_UNIT_X > xmax)
 			break;
 
 		tselem= TREESTORE(te);
 		
 		/* object hierarchy always, further constrained on level */
-		if(level<1 || (tselem->type==0 && te->idcode==ID_OB)) {
+		if (level<1 || (tselem->type==0 && te->idcode==ID_OB)) {
 
 			/* active blocks get white circle */
-			if(tselem->type==0) {
-				if(te->idcode==ID_OB) active= (OBACT==(Object *)tselem->id);
-				else if(scene->obedit && scene->obedit->data==tselem->id) active= 1;	// XXX use context?
+			if (tselem->type==0) {
+				if (te->idcode==ID_OB) active= (OBACT==(Object *)tselem->id);
+				else if (scene->obedit && scene->obedit->data==tselem->id) active= 1;	// XXX use context?
 				else active= tree_element_active(C, scene, soops, te, 0);
 			}
 			else active= tree_element_type_active(NULL, scene, soops, te, tselem, 0);
 			
-			if(active) {
+			if (active) {
 				float ufac= UI_UNIT_X/20.0f;
 
 				uiSetRoundBox(UI_CNR_ALL);
@@ -1215,8 +1198,8 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa
 			(*offsx) += UI_UNIT_X;
 		}
 		
-		/* this tree element always has same amount of branches, so dont draw */
-		if(tselem->type!=TSE_R_LAYER)
+		/* this tree element always has same amount of branches, so don't draw */
+		if (tselem->type!=TSE_R_LAYER)
 			outliner_draw_iconrow(C, block, scene, soops, &te->subtree, level+1, xmax, offsx, ys);
 	}
 	
@@ -1231,7 +1214,7 @@ static void outliner_set_coord_tree_element(SpaceOops *soops, TreeElement *te, i
 	te->xs= (float)startx;
 	te->ys= (float)(*starty);
 	
-	for(ten= te->subtree.first; ten; ten= ten->next) {
+	for (ten= te->subtree.first; ten; ten= ten->next) {
 		outliner_set_coord_tree_element(soops, ten, startx+UI_UNIT_X, starty);
 	}	
 }
@@ -1246,11 +1229,11 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
 	
 	tselem= TREESTORE(te);
 
-	if(*starty+2*UI_UNIT_Y >= ar->v2d.cur.ymin && *starty<= ar->v2d.cur.ymax) {
+	if (*starty+2*UI_UNIT_Y >= ar->v2d.cur.ymin && *starty<= ar->v2d.cur.ymax) {
 		int xmax= ar->v2d.cur.xmax;
 		
-		/* icons can be ui buts, we dont want it to overlap with restrict */
-		if((soops->flag & SO_HIDE_RESTRICTCOLS)==0)
+		/* icons can be ui buts, we don't want it to overlap with restrict */
+		if ((soops->flag & SO_HIDE_RESTRICTCOLS)==0)
 			xmax-= OL_TOGW+UI_UNIT_X;
 		
 		glEnable(GL_BLEND);
@@ -1270,17 +1253,17 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
 		}
 
 		/* colors for active/selected data */
-		if(tselem->type==0) {
-			if(te->idcode==ID_SCE) {
-				if(tselem->id == (ID *)scene) {
+		if (tselem->type==0) {
+			if (te->idcode==ID_SCE) {
+				if (tselem->id == (ID *)scene) {
 					glColor4ub(255, 255, 255, 100);
 					active= 2;
 				}
 			}
-			else if(te->idcode==ID_GR) {
+			else if (te->idcode==ID_GR) {
 				Group *gr = (Group *)tselem->id;
 				
-				if(group_select_flag(gr)) {
+				if (group_select_flag(gr)) {
 					char col[4];
 					UI_GetThemeColorType4ubv(TH_SELECT, SPACE_VIEW3D, col);
 					col[3]= 100;
@@ -1289,24 +1272,24 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
 					active= 2;
 				}
 			}
-			else if(te->idcode==ID_OB) {
+			else if (te->idcode==ID_OB) {
 				Object *ob= (Object *)tselem->id;
 				
-				if(ob==OBACT || (ob->flag & SELECT)) {
+				if (ob==OBACT || (ob->flag & SELECT)) {
 					char col[4]= {0, 0, 0, 0};
 					
 					/* outliner active ob: always white text, circle color now similar to view3d */
 					
 					active= 2; /* means it draws a color circle */
-					if(ob==OBACT) {
-						if(ob->flag & SELECT) {
+					if (ob==OBACT) {
+						if (ob->flag & SELECT) {
 							UI_GetThemeColorType4ubv(TH_ACTIVE, SPACE_VIEW3D, col);
 							col[3]= 100;
 						}
 						
 						active= 1; /* means it draws white text */
 					}
-					else if(ob->flag & SELECT) {
+					else if (ob->flag & SELECT) {
 						UI_GetThemeColorType4ubv(TH_SELECT, SPACE_VIEW3D, col);
 						col[3]= 100;
 					}
@@ -1315,24 +1298,24 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
 				}
 			
 			}
-			else if(scene->obedit && scene->obedit->data==tselem->id) {
+			else if (scene->obedit && scene->obedit->data==tselem->id) {
 				glColor4ub(255, 255, 255, 100);
 				active= 2;
 			}
 			else {
-				if(tree_element_active(C, scene, soops, te, 0)) {
+				if (tree_element_active(C, scene, soops, te, 0)) {
 					glColor4ub(220, 220, 255, 100);
 					active= 2;
 				}
 			}
 		}
 		else {
-			if( tree_element_type_active(NULL, scene, soops, te, tselem, 0) ) active= 2;
+			if ( tree_element_type_active(NULL, scene, soops, te, tselem, 0) ) active= 2;
 			glColor4ub(220, 220, 255, 100);
 		}
 		
 		/* active circle */
-		if(active) {
+		if (active) {
 			uiSetRoundBox(UI_CNR_ALL);
 			uiRoundBox( (float)startx+UI_UNIT_Y-1.5f*ufac, (float)*starty+2.0f*ufac, (float)startx+2.0f*UI_UNIT_Y-4.0f*ufac, (float)*starty+UI_UNIT_Y-1.0f*ufac, UI_UNIT_Y/2.0f-2.0f*ufac);
 			glEnable(GL_BLEND);	/* roundbox disables it */
@@ -1341,15 +1324,15 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
 		}
 		
 		/* open/close icon, only when sublevels, except for scene */
-		if(te->subtree.first || (tselem->type==0 && te->idcode==ID_SCE) || (te->flag & TE_LAZY_CLOSED)) {
+		if (te->subtree.first || (tselem->type==0 && te->idcode==ID_SCE) || (te->flag & TE_LAZY_CLOSED)) {
 			int icon_x;
-			if(tselem->type==0 && ELEM(te->idcode, ID_OB, ID_SCE))
+			if (tselem->type==0 && ELEM(te->idcode, ID_OB, ID_SCE))
 				icon_x = startx;
 			else
 				icon_x = startx+5*ufac;
 			
 				// icons a bit higher
-			if(TSELEM_OPEN(tselem,soops)) 
+			if (TSELEM_OPEN(tselem,soops))
 				UI_icon_draw((float)icon_x, (float)*starty+2*ufac, ICON_DISCLOSURE_TRI_DOWN);
 			else
 				UI_icon_draw((float)icon_x, (float)*starty+2*ufac, ICON_DISCLOSURE_TRI_RIGHT);
@@ -1358,7 +1341,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
 		
 		/* datatype icon */
 		
-		if(!(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM))) {
+		if (!(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM))) {
 			// icons a bit higher
 			tselem_draw_icon(block, xmax, (float)startx+offsx - 0.5f*ufac, (float)*starty+2.0f*ufac, tselem, te, 1.0f);
 			
@@ -1367,9 +1350,9 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
 		else
 			offsx+= 2*ufac;
 		
-		if(tselem->type==0 && tselem->id->lib) {
+		if (tselem->type==0 && tselem->id->lib) {
 			glPixelTransferf(GL_ALPHA_SCALE, 0.5f);
-			if(tselem->id->flag & LIB_INDIRECT)
+			if (tselem->id->flag & LIB_INDIRECT)
 				UI_icon_draw((float)startx+offsx, (float)*starty+2*ufac, ICON_LIBRARY_DATA_INDIRECT);
 			else
 				UI_icon_draw((float)startx+offsx, (float)*starty+2*ufac, ICON_LIBRARY_DATA_DIRECT);
@@ -1379,8 +1362,8 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
 		glDisable(GL_BLEND);
 		
 		/* name */
-		if(active==1) UI_ThemeColor(TH_TEXT_HI);
-		else if(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.75f);
+		if (active==1) UI_ThemeColor(TH_TEXT_HI);
+		else if (ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.75f);
 		else UI_ThemeColor(TH_TEXT);
 		
 		UI_DrawString(startx+offsx, *starty+5*ufac, te->name);
@@ -1388,10 +1371,10 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
 		offsx+= (int)(UI_UNIT_X + UI_GetStringWidth(te->name));
 		
 		/* closed item, we draw the icons, not when it's a scene, or master-server list though */
-		if(!TSELEM_OPEN(tselem,soops)) {
-			if(te->subtree.first) {
-				if(tselem->type==0 && te->idcode==ID_SCE);
-				else if(tselem->type!=TSE_R_LAYER) { /* this tree element always has same amount of branches, so dont draw */
+		if (!TSELEM_OPEN(tselem,soops)) {
+			if (te->subtree.first) {
+				if (tselem->type==0 && te->idcode==ID_SCE);
+				else if (tselem->type!=TSE_R_LAYER) { /* this tree element always has same amount of branches, so don't draw */
 					int tempx= startx+offsx;
 					
 					// divider
@@ -1414,14 +1397,14 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
 	te->ys= (float)*starty;
 	te->xend= startx+offsx;
 		
-	if(TSELEM_OPEN(tselem,soops)) {
+	if (TSELEM_OPEN(tselem,soops)) {
 		*starty-= UI_UNIT_Y;
 		
-		for(ten= te->subtree.first; ten; ten= ten->next)
+		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)
+		for (ten= te->subtree.first; ten; ten= ten->next)
 			outliner_set_coord_tree_element(soops, te, startx, starty);
 		
 		*starty-= UI_UNIT_Y;
@@ -1434,28 +1417,28 @@ static void outliner_draw_hierarchy(SpaceOops *soops, ListBase *lb, int startx,
 	TreeStoreElem *tselem;
 	int y1, y2;
 	
-	if(lb->first==NULL) return;
+	if (lb->first==NULL) return;
 	
 	y1=y2= *starty; /* for vertical lines between objects */
-	for(te=lb->first; te; te= te->next) {
+	for (te=lb->first; te; te= te->next) {
 		y2= *starty;
 		tselem= TREESTORE(te);
 		
 		/* horizontal line? */
-		if(tselem->type==0 && (te->idcode==ID_OB || te->idcode==ID_SCE))
+		if (tselem->type==0 && (te->idcode==ID_OB || te->idcode==ID_SCE))
 			glRecti(startx, *starty, startx+UI_UNIT_X, *starty-1);
 			
 		*starty-= UI_UNIT_Y;
 		
-		if(TSELEM_OPEN(tselem,soops))
+		if (TSELEM_OPEN(tselem,soops))
 			outliner_draw_hierarchy(soops, &te->subtree, startx+UI_UNIT_X, starty);
 	}
 	
 	/* vertical line */
 	te= lb->last;
-	if(te->parent || lb->first!=lb->last) {
+	if (te->parent || lb->first!=lb->last) {
 		tselem= TREESTORE(te);
-		if(tselem->type==0 && te->idcode==ID_OB) {
+		if (tselem->type==0 && te->idcode==ID_OB) {
 			
 			glRecti(startx, y1+UI_UNIT_Y, startx+1, y2);
 		}
@@ -1467,18 +1450,18 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase *
 	TreeElement *te;
 	TreeStoreElem *tselem;
 	
-	for(te= lb->first; te; te= te->next) {
+	for (te= lb->first; te; te= te->next) {
 		tselem= TREESTORE(te);
 		
 		/* selection status */
-		if(TSELEM_OPEN(tselem,soops))
-			if(tselem->type == TSE_RNA_STRUCT)
+		if (TSELEM_OPEN(tselem,soops))
+			if (tselem->type == TSE_RNA_STRUCT)
 				glRecti(0, *starty+1, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, *starty+UI_UNIT_Y-1);
 
 		*starty-= UI_UNIT_Y;
-		if(TSELEM_OPEN(tselem,soops)) {
+		if (TSELEM_OPEN(tselem,soops)) {
 			outliner_draw_struct_marks(ar, soops, &te->subtree, starty);
-			if(tselem->type == TSE_RNA_STRUCT)
+			if (tselem->type == TSE_RNA_STRUCT)
 				fdrawline(0, (float)*starty+UI_UNIT_Y, ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, (float)*starty+UI_UNIT_Y);
 		}
 	}
@@ -1489,15 +1472,15 @@ static void outliner_draw_selection(ARegion *ar, SpaceOops *soops, ListBase *lb,
 	TreeElement *te;
 	TreeStoreElem *tselem;
 	
-	for(te= lb->first; te; te= te->next) {
+	for (te= lb->first; te; te= te->next) {
 		tselem= TREESTORE(te);
 		
 		/* selection status */
-		if(tselem->flag & TSE_SELECTED) {
+		if (tselem->flag & TSE_SELECTED) {
 			glRecti(0, *starty+1, (int)ar->v2d.cur.xmax, *starty+UI_UNIT_Y-1);
 		}
 		*starty-= UI_UNIT_Y;
-		if(TSELEM_OPEN(tselem,soops)) outliner_draw_selection(ar, soops, &te->subtree, starty);
+		if (TSELEM_OPEN(tselem,soops)) outliner_draw_selection(ar, soops, &te->subtree, starty);
 	}
 }
 
@@ -1533,7 +1516,7 @@ static void outliner_draw_tree(bContext *C, uiBlock *block, Scene *scene, ARegio
 	// items themselves
 	starty= (int)ar->v2d.tot.ymax-UI_UNIT_Y-OL_Y_OFFSET;
 	startx= 0;
-	for(te= soops->tree.first; te; te= te->next) {
+	for (te= soops->tree.first; te; te= te->next) {
 		outliner_draw_tree_element(C, block, scene, ar, soops, te, startx, &starty);
 	}
 }
@@ -1547,7 +1530,7 @@ static void outliner_back(ARegion *ar)
 	ystart= (int)ar->v2d.tot.ymax;
 	ystart= UI_UNIT_Y*(ystart/(UI_UNIT_Y))-OL_Y_OFFSET;
 	
-	while(ystart+2*UI_UNIT_Y > ar->v2d.cur.ymin) {
+	while (ystart+2*UI_UNIT_Y > ar->v2d.cur.ymin) {
 		glRecti(0, ystart, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, ystart+UI_UNIT_Y);
 		ystart-= 2*UI_UNIT_Y;
 	}
@@ -1565,7 +1548,7 @@ static void outliner_draw_restrictcols(ARegion *ar)
 	ystart= (int)ar->v2d.tot.ymax;
 	ystart= UI_UNIT_Y*(ystart/(UI_UNIT_Y))-OL_Y_OFFSET;
 	
-	while(ystart+2*UI_UNIT_Y > ar->v2d.cur.ymin) {
+	while (ystart+2*UI_UNIT_Y > ar->v2d.cur.ymin) {
 		glRecti((int)ar->v2d.cur.xmax-OL_TOGW, ystart, (int)ar->v2d.cur.xmax, ystart+UI_UNIT_Y);
 		ystart-= 2*UI_UNIT_Y;
 	}
@@ -1658,12 +1641,12 @@ void draw_outliner(const bContext *C)
 	block= uiBeginBlock(C, ar, __func__, UI_EMBOSS);
 	outliner_draw_tree((bContext *)C, block, scene, ar, soops);
 	
-	if(ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) {
+	if (ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) {
 		/* draw rna buttons */
 		outliner_draw_rnacols(ar, sizex_rna);
 		outliner_draw_rnabuts(block, scene, ar, soops, sizex_rna, &soops->tree);
 	}
-	else if(soops->outlinevis == SO_KEYMAP) {
+	else if (soops->outlinevis == SO_KEYMAP) {
 		outliner_draw_keymapbuts(block, ar, soops, &soops->tree);
 	}
 	else if (!(soops->flag & SO_HIDE_RESTRICTCOLS)) {
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index 80bd829..62d93f6 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -29,78 +29,39 @@
  *  \ingroup spoutliner
  */
 
-#include <math.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stddef.h>
-
 #include "MEM_guardedalloc.h"
 
 #include "DNA_anim_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_camera_types.h"
 #include "DNA_group_types.h"
-#include "DNA_key_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_material_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meta_types.h"
-#include "DNA_particle_types.h"
 #include "DNA_scene_types.h"
-#include "DNA_world_types.h"
-#include "DNA_sequence_types.h"
 #include "DNA_object_types.h"
 
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
-#include "BLI_math_base.h"
-
-#if defined WIN32 && !defined _LIBC
-# include "BLI_fnmatch.h" /* use fnmatch included in blenlib */
-#else
-#  ifndef _GNU_SOURCE
-#    define _GNU_SOURCE
-#  endif
-# include <fnmatch.h>
-#endif
 
+#include "BLF_translation.h"
 
 #include "BKE_animsys.h"
 #include "BKE_context.h"
-#include "BKE_deform.h"
 #include "BKE_depsgraph.h"
-#include "BKE_fcurve.h"
-#include "BKE_global.h"
-#include "BKE_group.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
-#include "BKE_modifier.h"
 #include "BKE_report.h"
 #include "BKE_scene.h"
-#include "BKE_sequencer.h"
 
-#include "ED_armature.h"
 #include "ED_object.h"
 #include "ED_screen.h"
-#include "ED_util.h"
+#include "ED_keyframing.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
 
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-
 #include "UI_interface.h"
-#include "UI_interface_icons.h"
 #include "UI_resources.h"
 #include "UI_view2d.h"
 
 #include "RNA_access.h"
 #include "RNA_define.h"
-#include "RNA_enum_types.h"
-
-#include "ED_keyframing.h"
 
 #include "outliner_intern.h"
 
@@ -158,24 +119,24 @@ static void outliner_open_reveal(SpaceOops *soops, ListBase *lb, TreeElement *te
 static int do_outliner_item_openclose(bContext *C, SpaceOops *soops, TreeElement *te, int all, const float mval[2])
 {
 	
-	if(mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) {
+	if (mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) {
 		TreeStoreElem *tselem= TREESTORE(te);
 		
 		/* all below close/open? */
-		if(all) {
+		if (all) {
 			tselem->flag &= ~TSE_CLOSED;
 			outliner_set_flag(soops, &te->subtree, TSE_CLOSED, !outliner_has_one_flag(soops, &te->subtree, TSE_CLOSED, 1));
 		}
 		else {
-			if(tselem->flag & TSE_CLOSED) tselem->flag &= ~TSE_CLOSED;
+			if (tselem->flag & TSE_CLOSED) tselem->flag &= ~TSE_CLOSED;
 			else tselem->flag |= TSE_CLOSED;
 		}
 		
 		return 1;
 	}
 	
-	for(te= te->subtree.first; te; te= te->next) {
-		if(do_outliner_item_openclose(C, soops, te, all, mval)) 
+	for (te= te->subtree.first; te; te= te->next) {
+		if (do_outliner_item_openclose(C, soops, te, all, mval)) 
 			return 1;
 	}
 	return 0;
@@ -193,8 +154,8 @@ static int outliner_item_openclose(bContext *C, wmOperator *op, wmEvent *event)
 	
 	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_item_openclose(C, soops, te, all, fmval)) 
+	for (te= soops->tree.first; te; te= te->next) {
+		if (do_outliner_item_openclose(C, soops, te, all, fmval)) 
 			break;
 	}
 
@@ -205,13 +166,13 @@ static int outliner_item_openclose(bContext *C, wmOperator *op, wmEvent *event)
 
 void OUTLINER_OT_item_openclose(wmOperatorType *ot)
 {
-	ot->name= "Open/Close Item";
-	ot->idname= "OUTLINER_OT_item_openclose";
-	ot->description= "Toggle whether item under cursor is enabled or closed";
+	ot->name = "Open/Close Item";
+	ot->idname = "OUTLINER_OT_item_openclose";
+	ot->description = "Toggle whether item under cursor is enabled or closed";
 	
-	ot->invoke= outliner_item_openclose;
+	ot->invoke = outliner_item_openclose;
 	
-	ot->poll= ED_operator_outliner_active;
+	ot->poll = ED_operator_outliner_active;
 	
 	RNA_def_boolean(ot->srna, "all", 1, "All", "Close or open all items");
 }
@@ -221,21 +182,21 @@ void OUTLINER_OT_item_openclose(wmOperatorType *ot)
 static void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem, ReportList *reports)
 {
 	/* can't rename rna datablocks entries */
-	if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
+	if (ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
 			/* do nothing */;
 	}
-	else if(ELEM10(tselem->type, TSE_ANIM_DATA, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE,
+	else if (ELEM10(tselem->type, TSE_ANIM_DATA, TSE_NLA, TSE_DEFGROUP_BASE, TSE_CONSTRAINT_BASE, TSE_MODIFIER_BASE,
 	                             TSE_SCRIPT_BASE, TSE_POSE_BASE, TSE_POSEGRP_BASE, TSE_R_LAYER_BASE, TSE_R_PASS))
 	{
 			BKE_report(reports, RPT_WARNING, "Cannot edit builtin name");
 	}
-	else if(ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) {
+	else if (ELEM3(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) {
 		BKE_report(reports, RPT_WARNING, "Cannot edit sequence name");
 	}
-	else if(tselem->id->lib) {
+	else if (tselem->id->lib) {
 		// XXX						error_libdata();
 	} 
-	else if(te->idcode == ID_LI && te->parent) {
+	else if (te->idcode == ID_LI && te->parent) {
 		BKE_report(reports, RPT_WARNING, "Cannot edit the path of an indirectly linked library");
 	} 
 	else {
@@ -248,26 +209,26 @@ void item_rename_cb(bContext *C, Scene *UNUSED(scene), TreeElement *te, TreeStor
 {
 	ARegion *ar= CTX_wm_region(C);
 	ReportList *reports= CTX_wm_reports(C); // XXX
-	do_item_rename(ar, te, tselem, reports) ;
+	do_item_rename(ar, te, tselem, reports);
 }
 
 static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, TreeElement *te, const float mval[2])
 {	
 	ReportList *reports= CTX_wm_reports(C); // XXX
 	
-	if(mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) {
+	if (mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) {
 		TreeStoreElem *tselem= TREESTORE(te);
 		
 		/* name and first icon */
-		if(mval[0]>te->xs+UI_UNIT_X && mval[0]<te->xend) {
+		if (mval[0]>te->xs+UI_UNIT_X && mval[0]<te->xend) {
 			
-			do_item_rename(ar, te, tselem, reports) ;
+			do_item_rename(ar, te, tselem, reports);
 		}
 		return 1;
 	}
 	
-	for(te= te->subtree.first; te; te= te->next) {
-		if(do_outliner_item_rename(C, ar, soops, te, mval)) return 1;
+	for (te= te->subtree.first; te; te= te->next) {
+		if (do_outliner_item_rename(C, ar, soops, te, mval)) return 1;
 	}
 	return 0;
 }
@@ -281,8 +242,8 @@ static int outliner_item_rename(bContext *C, wmOperator *UNUSED(op), wmEvent *ev
 	
 	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_item_rename(C, ar, soops, te, fmval)) break;
+	for (te= soops->tree.first; te; te= te->next) {
+		if (do_outliner_item_rename(C, ar, soops, te, fmval)) break;
 	}
 	
 	return OPERATOR_FINISHED;
@@ -291,13 +252,13 @@ static int outliner_item_rename(bContext *C, wmOperator *UNUSED(op), wmEvent *ev
 
 void OUTLINER_OT_item_rename(wmOperatorType *ot)
 {
-	ot->name= "Rename Item";
-	ot->idname= "OUTLINER_OT_item_rename";
-	ot->description= "Rename item under cursor";
+	ot->name = "Rename Item";
+	ot->idname = "OUTLINER_OT_item_rename";
+	ot->description = "Rename item under cursor";
 	
-	ot->invoke= outliner_item_rename;
+	ot->invoke = outliner_item_rename;
 	
-	ot->poll= ED_operator_outliner_active;
+	ot->poll = ED_operator_outliner_active;
 }
 
 /* ************************************************************** */
@@ -313,10 +274,10 @@ static int outliner_count_levels(SpaceOops *soops, ListBase *lb, int curlevel)
 	TreeElement *te;
 	int level=curlevel, lev;
 	
-	for(te= lb->first; te; te= te->next) {
+	for (te= lb->first; te; te= te->next) {
 		
 		lev= outliner_count_levels(soops, &te->subtree, curlevel+1);
-		if(lev>level) level= lev;
+		if (lev>level) level= lev;
 	}
 	return level;
 }
@@ -327,12 +288,12 @@ int outliner_has_one_flag(SpaceOops *soops, ListBase *lb, short flag, short curl
 	TreeStoreElem *tselem;
 	int level;
 	
-	for(te= lb->first; te; te= te->next) {
+	for (te= lb->first; te; te= te->next) {
 		tselem= TREESTORE(te);
-		if(tselem->flag & flag) return curlevel;
+		if (tselem->flag & flag) return curlevel;
 		
 		level= outliner_has_one_flag(soops, &te->subtree, flag, curlevel+1);
-		if(level) return level;
+		if (level) return level;
 	}
 	return 0;
 }
@@ -342,9 +303,9 @@ void outliner_set_flag(SpaceOops *soops, ListBase *lb, short flag, short set)
 	TreeElement *te;
 	TreeStoreElem *tselem;
 	
-	for(te= lb->first; te; te= te->next) {
+	for (te= lb->first; te; te= te->next) {
 		tselem= TREESTORE(te);
-		if(set==0) tselem->flag &= ~flag;
+		if (set==0) tselem->flag &= ~flag;
 		else tselem->flag |= flag;
 		outliner_set_flag(soops, &te->subtree, flag, set);
 	}
@@ -385,10 +346,10 @@ void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, Tre
 	Object *ob = (Object *)tselem->id;
 	
 	/* add check for edit mode */
-	if(!common_restrict_check(C, ob)) return;
+	if (!common_restrict_check(C, ob)) return;
 	
-	if(base || (base= object_in_scene(ob, scene))) {
-		if((base->object->restrictflag ^= OB_RESTRICT_VIEW)) {
+	if (base || (base= object_in_scene(ob, scene))) {
+		if ((base->object->restrictflag ^= OB_RESTRICT_VIEW)) {
 			ED_base_object_select(base, BA_DESELECT);
 		}
 	}
@@ -417,15 +378,15 @@ static int outliner_toggle_visibility_exec(bContext *C, wmOperator *UNUSED(op))
 void OUTLINER_OT_visibility_toggle(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Toggle Visibility";
-	ot->idname= "OUTLINER_OT_visibility_toggle";
-	ot->description= "Toggle the visibility of selected items";
+	ot->name = "Toggle Visibility";
+	ot->idname = "OUTLINER_OT_visibility_toggle";
+	ot->description = "Toggle the visibility of selected items";
 	
 	/* callbacks */
-	ot->exec= outliner_toggle_visibility_exec;
-	ot->poll= ED_operator_outliner_active_no_editobject;
+	ot->exec = outliner_toggle_visibility_exec;
+	ot->poll = ED_operator_outliner_active_no_editobject;
 	
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* Toggle Selectability ---------------------------------------- */
@@ -434,8 +395,8 @@ void object_toggle_selectability_cb(bContext *UNUSED(C), Scene *scene, TreeEleme
 {
 	Base *base= (Base *)te->directdata;
 	
-	if(base==NULL) base= object_in_scene((Object *)tselem->id, scene);
-	if(base) {
+	if (base==NULL) base= object_in_scene((Object *)tselem->id, scene);
+	if (base) {
 		base->object->restrictflag^=OB_RESTRICT_SELECT;
 	}
 }
@@ -463,15 +424,15 @@ static int outliner_toggle_selectability_exec(bContext *C, wmOperator *UNUSED(op
 void OUTLINER_OT_selectability_toggle(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Toggle Selectability";
-	ot->idname= "OUTLINER_OT_selectability_toggle";
-	ot->description= "Toggle the selectability";
+	ot->name = "Toggle Selectability";
+	ot->idname = "OUTLINER_OT_selectability_toggle";
+	ot->description = "Toggle the selectability";
 	
 	/* callbacks */
-	ot->exec= outliner_toggle_selectability_exec;
-	ot->poll= ED_operator_outliner_active_no_editobject;
+	ot->exec = outliner_toggle_selectability_exec;
+	ot->poll = ED_operator_outliner_active_no_editobject;
 	
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* Toggle Renderability ---------------------------------------- */
@@ -480,8 +441,8 @@ void object_toggle_renderability_cb(bContext *UNUSED(C), Scene *scene, TreeEleme
 {
 	Base *base= (Base *)te->directdata;
 	
-	if(base==NULL) base= object_in_scene((Object *)tselem->id, scene);
-	if(base) {
+	if (base==NULL) base= object_in_scene((Object *)tselem->id, scene);
+	if (base) {
 		base->object->restrictflag^=OB_RESTRICT_RENDER;
 	}
 }
@@ -507,15 +468,15 @@ static int outliner_toggle_renderability_exec(bContext *C, wmOperator *UNUSED(op
 void OUTLINER_OT_renderability_toggle(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Toggle Renderability";
-	ot->idname= "OUTLINER_OT_renderability_toggle";
-	ot->description= "Toggle the renderability of selected items";
+	ot->name = "Toggle Renderability";
+	ot->idname = "OUTLINER_OT_renderability_toggle";
+	ot->description = "Toggle the renderability of selected items";
 	
 	/* callbacks */
-	ot->exec= outliner_toggle_renderability_exec;
-	ot->poll= ED_operator_outliner_active;
+	ot->exec = outliner_toggle_renderability_exec;
+	ot->poll = ED_operator_outliner_active;
 	
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* =============================================== */
@@ -541,13 +502,13 @@ static int outliner_toggle_expanded_exec(bContext *C, wmOperator *UNUSED(op))
 void OUTLINER_OT_expanded_toggle(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Expand/Collapse All";
-	ot->idname= "OUTLINER_OT_expanded_toggle";
-	ot->description= "Expand/Collapse all items";
+	ot->name = "Expand/Collapse All";
+	ot->idname = "OUTLINER_OT_expanded_toggle";
+	ot->description = "Expand/Collapse all items";
 	
 	/* callbacks */
-	ot->exec= outliner_toggle_expanded_exec;
-	ot->poll= ED_operator_outliner_active;
+	ot->exec = outliner_toggle_expanded_exec;
+	ot->poll = ED_operator_outliner_active;
 	
 	/* no undo or registry, UI option */
 }
@@ -576,13 +537,13 @@ static int outliner_toggle_selected_exec(bContext *C, wmOperator *UNUSED(op))
 void OUTLINER_OT_selected_toggle(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Toggle Selected";
-	ot->idname= "OUTLINER_OT_selected_toggle";
-	ot->description= "Toggle the Outliner selection of items";
+	ot->name = "Toggle Selected";
+	ot->idname = "OUTLINER_OT_selected_toggle";
+	ot->description = "Toggle the Outliner selection of items";
 	
 	/* callbacks */
-	ot->exec= outliner_toggle_selected_exec;
-	ot->poll= ED_operator_outliner_active;
+	ot->exec = outliner_toggle_selected_exec;
+	ot->poll = ED_operator_outliner_active;
 	
 	/* no undo or registry, UI option */
 }
@@ -612,8 +573,8 @@ static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op))
 		ytop= (int)(te->ys + (v2d->mask.ymax - v2d->mask.ymin)/2);
 		if (ytop>0) ytop= 0;
 		
-		v2d->cur.ymax= (float)ytop;
-		v2d->cur.ymin= (float)(ytop-(v2d->mask.ymax - v2d->mask.ymin));
+		v2d->cur.ymax = (float)ytop;
+		v2d->cur.ymin = (float)(ytop-(v2d->mask.ymax - v2d->mask.ymin));
 		
 		/* make te->xs ==> te->xend center of view */
 		xdelta = (int)(te->xs - v2d->cur.xmin);
@@ -631,13 +592,13 @@ static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op))
 void OUTLINER_OT_show_active(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Show Active";
-	ot->idname= "OUTLINER_OT_show_active";
-	ot->description= "Adjust the view so that the active Object is shown centered";
+	ot->name = "Show Active";
+	ot->idname = "OUTLINER_OT_show_active";
+	ot->description = "Adjust the view so that the active Object is shown centered";
 	
 	/* callbacks */
-	ot->exec= outliner_show_active_exec;
-	ot->poll= ED_operator_outliner_active;
+	ot->exec = outliner_show_active_exec;
+	ot->poll = ED_operator_outliner_active;
 }
 
 /* View Panning --------------------------------------------------- */
@@ -648,10 +609,10 @@ static int outliner_scroll_page_exec(bContext *C, wmOperator *op)
 	int dy= ar->v2d.mask.ymax - ar->v2d.mask.ymin;
 	int up= 0;
 	
-	if(RNA_boolean_get(op->ptr, "up"))
+	if (RNA_boolean_get(op->ptr, "up"))
 		up= 1;
 
-	if(up == 0) dy= -dy;
+	if (up == 0) dy= -dy;
 	ar->v2d.cur.ymin+= dy;
 	ar->v2d.cur.ymax+= dy;
 	
@@ -664,13 +625,13 @@ static int outliner_scroll_page_exec(bContext *C, wmOperator *op)
 void OUTLINER_OT_scroll_page(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Scroll Page";
-	ot->idname= "OUTLINER_OT_scroll_page";
-	ot->description= "Scroll page up or down";
+	ot->name = "Scroll Page";
+	ot->idname = "OUTLINER_OT_scroll_page";
+	ot->description = "Scroll page up or down";
 	
 	/* callbacks */
-	ot->exec= outliner_scroll_page_exec;
-	ot->poll= ED_operator_outliner_active;
+	ot->exec = outliner_scroll_page_exec;
+	ot->poll = ED_operator_outliner_active;
 	
 	/* properties */
 	RNA_def_boolean(ot->srna, "up", 0, "Up", "Scroll up one page");
@@ -691,9 +652,9 @@ static void outliner_set_coordinates_element(SpaceOops *soops, TreeElement *te,
 	te->ys= (float)(*starty);
 	*starty-= UI_UNIT_Y;
 	
-	if(TSELEM_OPEN(tselem,soops)) {
+	if (TSELEM_OPEN(tselem,soops)) {
 		TreeElement *ten;
-		for(ten= te->subtree.first; ten; ten= ten->next) {
+		for (ten= te->subtree.first; ten; ten= ten->next) {
 			outliner_set_coordinates_element(soops, ten, startx+UI_UNIT_X, starty);
 		}
 	}
@@ -707,7 +668,7 @@ static void outliner_set_coordinates(ARegion *ar, SpaceOops *soops)
 	int starty= (int)(ar->v2d.tot.ymax)-UI_UNIT_Y;
 	int startx= 0;
 	
-	for(te= soops->tree.first; te; te= te->next) {
+	for (te= soops->tree.first; te; te= te->next) {
 		outliner_set_coordinates_element(soops, te, startx, &starty);
 	}
 }
@@ -720,7 +681,7 @@ static TreeElement *outliner_find_named(SpaceOops *soops, ListBase *lb, char *na
 	for (te= lb->first; te; te= te->next) {
 		int found = outliner_filter_has_name(te, name, flags);
 		
-		if(found) {
+		if (found) {
 			/* name is right, but is element the previous one? */
 			if (prev) {
 				if ((te != prev) && (*prevFound)) 
@@ -734,7 +695,7 @@ static TreeElement *outliner_find_named(SpaceOops *soops, ListBase *lb, char *na
 		}
 		
 		tes= outliner_find_named(soops, &te->subtree, name, flags, prev, prevFound);
-		if(tes) return tes;
+		if (tes) return tes;
 	}
 
 	/* nothing valid found */
@@ -781,7 +742,7 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so
 		tselem= TREESTORE(te);
 		if (tselem) {
 			/* expand branches so that it will be visible, we need to get correct coordinates */
-			if( outliner_open_back(soops, te))
+			if ( outliner_open_back(soops, te))
 				outliner_set_coordinates(ar, soops);
 			
 			/* deselect all visible, and select found element */
@@ -790,9 +751,9 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so
 			
 			/* make te->ys center of view */
 			ytop= (int)(te->ys + (ar->v2d.mask.ymax-ar->v2d.mask.ymin)/2);
-			if(ytop>0) ytop= 0;
-			ar->v2d.cur.ymax= (float)ytop;
-			ar->v2d.cur.ymin= (float)(ytop-(ar->v2d.mask.ymax-ar->v2d.mask.ymin));
+			if (ytop>0) ytop= 0;
+			ar->v2d.cur.ymax = (float)ytop;
+			ar->v2d.cur.ymin = (float)(ytop-(ar->v2d.mask.ymax-ar->v2d.mask.ymin));
 			
 			/* make te->xs ==> te->xend center of view */
 			xdelta = (int)(te->xs - ar->v2d.cur.xmin);
@@ -824,14 +785,14 @@ static void outliner_openclose_level(SpaceOops *soops, ListBase *lb, int curleve
 	TreeElement *te;
 	TreeStoreElem *tselem;
 	
-	for(te= lb->first; te; te= te->next) {
+	for (te= lb->first; te; te= te->next) {
 		tselem= TREESTORE(te);
 		
-		if(open) {
-			if(curlevel<=level) tselem->flag &= ~TSE_CLOSED;
+		if (open) {
+			if (curlevel<=level) tselem->flag &= ~TSE_CLOSED;
 		}
 		else {
-			if(curlevel>=level) tselem->flag |= TSE_CLOSED;
+			if (curlevel>=level) tselem->flag |= TSE_CLOSED;
 		}
 		
 		outliner_openclose_level(soops, &te->subtree, curlevel+1, level, open);
@@ -846,12 +807,12 @@ static int outliner_one_level_exec(bContext *C, wmOperator *op)
 	int level;
 	
 	level= outliner_has_one_flag(soops, &soops->tree, TSE_CLOSED, 1);
-	if(add==1) {
-		if(level) outliner_openclose_level(soops, &soops->tree, 1, level, 1);
+	if (add==1) {
+		if (level) outliner_openclose_level(soops, &soops->tree, 1, level, 1);
 	}
 	else {
-		if(level==0) level= outliner_count_levels(soops, &soops->tree, 0);
-		if(level) outliner_openclose_level(soops, &soops->tree, 1, level-1, 0);
+		if (level==0) level= outliner_count_levels(soops, &soops->tree, 0);
+		if (level) outliner_openclose_level(soops, &soops->tree, 1, level-1, 0);
 	}
 	
 	ED_region_tag_redraw(ar);
@@ -862,13 +823,13 @@ static int outliner_one_level_exec(bContext *C, wmOperator *op)
 void OUTLINER_OT_show_one_level(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Show/Hide One Level";
-	ot->idname= "OUTLINER_OT_show_one_level";
-	ot->description= "Expand/collapse all entries by one level";
+	ot->name = "Show/Hide One Level";
+	ot->idname = "OUTLINER_OT_show_one_level";
+	ot->description = "Expand/collapse all entries by one level";
 	
 	/* callbacks */
-	ot->exec= outliner_one_level_exec;
-	ot->poll= ED_operator_outliner_active;
+	ot->exec = outliner_one_level_exec;
+	ot->poll = ED_operator_outliner_active;
 	
 	/* no undo or registry, UI option */
 	
@@ -884,10 +845,10 @@ static int subtree_has_objects(SpaceOops *soops, ListBase *lb)
 	TreeElement *te;
 	TreeStoreElem *tselem;
 	
-	for(te= lb->first; te; te= te->next) {
+	for (te= lb->first; te; te= te->next) {
 		tselem= TREESTORE(te);
-		if(tselem->type==0 && te->idcode==ID_OB) return 1;
-		if( subtree_has_objects(soops, &te->subtree)) return 1;
+		if (tselem->type==0 && te->idcode==ID_OB) return 1;
+		if ( subtree_has_objects(soops, &te->subtree)) return 1;
 	}
 	return 0;
 }
@@ -899,22 +860,22 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOops *soops, ListBase
 	TreeStoreElem *tselem;
 
 	/* open all object elems, close others */
-	for(te= lb->first; te; te= te->next) {
+	for (te= lb->first; te; te= te->next) {
 		tselem= TREESTORE(te);
 		
-		if(tselem->type==0) {
-			if(te->idcode==ID_SCE) {
-				if(tselem->id!=(ID *)scene) tselem->flag |= TSE_CLOSED;
+		if (tselem->type==0) {
+			if (te->idcode==ID_SCE) {
+				if (tselem->id!=(ID *)scene) tselem->flag |= TSE_CLOSED;
 					else tselem->flag &= ~TSE_CLOSED;
 			}
-			else if(te->idcode==ID_OB) {
-				if(subtree_has_objects(soops, &te->subtree)) tselem->flag &= ~TSE_CLOSED;
+			else if (te->idcode==ID_OB) {
+				if (subtree_has_objects(soops, &te->subtree)) tselem->flag &= ~TSE_CLOSED;
 				else tselem->flag |= TSE_CLOSED;
 			}
 		}
 		else tselem->flag |= TSE_CLOSED;
 		
-		if(TSELEM_OPEN(tselem,soops)) tree_element_show_hierarchy(scene, soops, &te->subtree);
+		if (TSELEM_OPEN(tselem,soops)) tree_element_show_hierarchy(scene, soops, &te->subtree);
 	}
 }
 
@@ -936,13 +897,13 @@ static int outliner_show_hierarchy_exec(bContext *C, wmOperator *UNUSED(op))
 void OUTLINER_OT_show_hierarchy(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Show Hierarchy";
-	ot->idname= "OUTLINER_OT_show_hierarchy";
-	ot->description= "Open all object entries and close all others";
+	ot->name = "Show Hierarchy";
+	ot->idname = "OUTLINER_OT_show_hierarchy";
+	ot->description = "Open all object entries and close all others";
 	
 	/* callbacks */
-	ot->exec= outliner_show_hierarchy_exec;
-	ot->poll= ED_operator_outliner_active; //  TODO: shouldn't be allowed in RNA views...
+	ot->exec = outliner_show_hierarchy_exec;
+	ot->poll = ED_operator_outliner_active; //  TODO: shouldn't be allowed in RNA views...
 	
 	/* no undo or registry, UI option */
 }
@@ -978,7 +939,7 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
 	PropertyRNA *prop;
 	char *newpath=NULL;
 	
-	/* optimise tricks:
+	/* optimize tricks:
 	 *	- Don't do anything if the selected item is a 'struct', but arrays are allowed
 	 */
 	if (tselem->type == TSE_RNA_STRUCT)
@@ -1013,12 +974,12 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
 			/* just 'append' property to path 
 			 *	- to prevent memory leaks, we must write to newpath not path, then free old path + swap them
 			 */
-			if(tse->type == TSE_RNA_PROPERTY) {
-				if(RNA_property_type(prop) == PROP_POINTER) {
+			if (tse->type == TSE_RNA_PROPERTY) {
+				if (RNA_property_type(prop) == PROP_POINTER) {
 					/* for pointer we just append property name */
 					newpath= RNA_path_append(*path, ptr, prop, 0, NULL);
 				}
-				else if(RNA_property_type(prop) == PROP_COLLECTION) {
+				else if (RNA_property_type(prop) == PROP_COLLECTION) {
 					char buf[128], *name;
 					
 					temnext= (TreeElement*)(ld->next->data);
@@ -1027,19 +988,19 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
 					nextptr= &temnext->rnaptr;
 					name= RNA_struct_name_get_alloc(nextptr, buf, sizeof(buf), NULL);
 					
-					if(name) {
+					if (name) {
 						/* if possible, use name as a key in the path */
 						newpath= RNA_path_append(*path, NULL, prop, 0, name);
 						
-						if(name != buf)
+						if (name != buf)
 							MEM_freeN(name);
 					}
 					else {
 						/* otherwise use index */
 						int index= 0;
 						
-						for(temsub=tem->subtree.first; temsub; temsub=temsub->next, index++)
-							if(temsub == temnext)
+						for (temsub=tem->subtree.first; temsub; temsub=temsub->next, index++)
+							if (temsub == temnext)
 								break;
 						
 						newpath= RNA_path_append(*path, NULL, prop, index, NULL);
@@ -1049,7 +1010,7 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
 				}
 			}
 			
-			if(newpath) {
+			if (newpath) {
 				if (*path) MEM_freeN(*path);
 				*path= newpath;
 				newpath= NULL;
@@ -1059,11 +1020,11 @@ static void tree_element_to_path(SpaceOops *soops, TreeElement *te, TreeStoreEle
 			/* no ID, so check if entry is RNA-struct, and if that RNA-struct is an ID datablock to extract info from */
 			if (tse->type == TSE_RNA_STRUCT) {
 				/* ptr->data not ptr->id.data seems to be the one we want, since ptr->data is sometimes the owner of this ID? */
-				if(RNA_struct_is_ID(ptr->type)) {
+				if (RNA_struct_is_ID(ptr->type)) {
 					*id= (ID *)ptr->data;
 					
 					/* clear path */
-					if(*path) {
+					if (*path) {
 						MEM_freeN(*path);
 						path= NULL;
 					}
@@ -1128,7 +1089,7 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, ReportL
 			short flag= 0;
 			short groupmode= KSP_GROUP_KSNAME;
 			
-			/* check if RNA-property described by this selected element is an animateable prop */
+			/* check if RNA-property described by this selected element is an animatable prop */
 			if (ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM) && RNA_property_animateable(&te->rnaptr, te->directdata)) {
 				/* get id + path + index info from the selected element */
 				tree_element_to_path(soops, te, tselem, 
@@ -1206,13 +1167,13 @@ static int outliner_drivers_addsel_exec(bContext *C, wmOperator *op)
 void OUTLINER_OT_drivers_add_selected(wmOperatorType *ot)
 {
 	/* api callbacks */
-	ot->idname= "OUTLINER_OT_drivers_add_selected";
-	ot->name= "Add Drivers for Selected";
-	ot->description= "Add drivers to selected items";
+	ot->idname = "OUTLINER_OT_drivers_add_selected";
+	ot->name = "Add Drivers for Selected";
+	ot->description = "Add drivers to selected items";
 	
 	/* api callbacks */
-	ot->exec= outliner_drivers_addsel_exec;
-	ot->poll= ed_operator_outliner_datablocks_active;
+	ot->exec = outliner_drivers_addsel_exec;
+	ot->poll = ed_operator_outliner_datablocks_active;
 	
 	/* flags */
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1241,13 +1202,13 @@ static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *op)
 void OUTLINER_OT_drivers_delete_selected(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->idname= "OUTLINER_OT_drivers_delete_selected";
-	ot->name= "Delete Drivers for Selected";
-	ot->description= "Delete drivers assigned to selected items";
+	ot->idname = "OUTLINER_OT_drivers_delete_selected";
+	ot->name = "Delete Drivers for Selected";
+	ot->description = "Delete drivers assigned to selected items";
 	
 	/* api callbacks */
-	ot->exec= outliner_drivers_deletesel_exec;
-	ot->poll= ed_operator_outliner_datablocks_active;
+	ot->exec = outliner_drivers_deletesel_exec;
+	ot->poll = ed_operator_outliner_datablocks_active;
 	
 	/* flags */
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1283,7 +1244,7 @@ static KeyingSet *verify_active_keyingset(Scene *scene, short add)
 	/* add if none found */
 	// XXX the default settings have yet to evolve
 	if ((add) && (ks==NULL)) {
-		ks= BKE_keyingset_add(&scene->keyingsets, NULL, KEYINGSET_ABSOLUTE, 0);
+		ks= BKE_keyingset_add(&scene->keyingsets, NULL, NULL, KEYINGSET_ABSOLUTE, 0);
 		scene->active_keyingset= BLI_countlist(&scene->keyingsets);
 	}
 	
@@ -1307,7 +1268,7 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa
 			short flag= 0;
 			short groupmode= KSP_GROUP_KSNAME;
 			
-			/* check if RNA-property described by this selected element is an animateable prop */
+			/* check if RNA-property described by this selected element is an animatable prop */
 			if (ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM) && RNA_property_animateable(&te->rnaptr, te->directdata)) {
 				/* get id + path + index info from the selected element */
 				tree_element_to_path(soops, te, tselem, 
@@ -1380,13 +1341,13 @@ static int outliner_keyingset_additems_exec(bContext *C, wmOperator *op)
 void OUTLINER_OT_keyingset_add_selected(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->idname= "OUTLINER_OT_keyingset_add_selected";
-	ot->name= "Keying Set Add Selected";
-	ot->description= "Add selected items (blue-grey rows) to active Keying Set";
+	ot->idname = "OUTLINER_OT_keyingset_add_selected";
+	ot->name = "Keying Set Add Selected";
+	ot->description = "Add selected items (blue-grey rows) to active Keying Set";
 	
 	/* api callbacks */
-	ot->exec= outliner_keyingset_additems_exec;
-	ot->poll= ed_operator_outliner_datablocks_active;
+	ot->exec = outliner_keyingset_additems_exec;
+	ot->poll = ed_operator_outliner_datablocks_active;
 	
 	/* flags */
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1417,13 +1378,13 @@ static int outliner_keyingset_removeitems_exec(bContext *C, wmOperator *UNUSED(o
 void OUTLINER_OT_keyingset_remove_selected(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->idname= "OUTLINER_OT_keyingset_remove_selected";
-	ot->name= "Keying Set Remove Selected";
+	ot->idname = "OUTLINER_OT_keyingset_remove_selected";
+	ot->name = "Keying Set Remove Selected";
 	ot->description = "Remove selected items (blue-grey rows) from active Keying Set";
 	
 	/* api callbacks */
-	ot->exec= outliner_keyingset_removeitems_exec;
-	ot->poll= ed_operator_outliner_datablocks_active;
+	ot->exec = outliner_keyingset_removeitems_exec;
+	ot->poll = ed_operator_outliner_datablocks_active;
 	
 	/* flags */
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -1433,15 +1394,24 @@ void OUTLINER_OT_keyingset_remove_selected(wmOperatorType *ot)
 
 static int parent_drop_exec(bContext *C, wmOperator *op)
 {
-	Object *par = NULL;
+	Object *par = NULL, *ob = NULL;
+	Main *bmain= CTX_data_main(C);
+	Scene *scene= CTX_data_scene(C);
 	int partype = -1;
-	char parname[32];
+	char parname[MAX_ID_NAME], childname[MAX_ID_NAME];
 
 	partype= RNA_enum_get(op->ptr, "type");
 	RNA_string_get(op->ptr, "parent", parname);
 	par= (Object *)find_id("OB", parname);
+	RNA_string_get(op->ptr, "child", childname);
+	ob= (Object *)find_id("OB", childname);
+
+	ED_object_parent_set(op->reports, bmain, scene, ob, par, partype);
 
-	ED_object_parent_set(C, op, par, partype);
+	DAG_scene_sort(bmain, scene);
+	DAG_ids_flush_update(bmain, 0);
+	WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+	WM_event_add_notifier(C, NC_OBJECT|ND_PARENT, NULL);
 
 	return OPERATOR_FINISHED;
 }
@@ -1482,6 +1452,7 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	Object *ob= NULL;
 	SpaceOops *soops= CTX_wm_space_outliner(C);
 	ARegion *ar= CTX_wm_region(C);
+	Main *bmain= CTX_data_main(C);
 	Scene *scene= CTX_data_scene(C);
 	TreeElement *te= NULL;
 	TreeElement *te_found= NULL;
@@ -1498,7 +1469,7 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, wmEvent *event)
 		if (te_found) break;
 	}
 
-	if(te_found) {
+	if (te_found) {
 		RNA_string_set(op->ptr, "parent", te_found->name);
 		/* Identify parent and child */
 		RNA_string_get(op->ptr, "child", childname);
@@ -1519,11 +1490,16 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, wmEvent *event)
 			ED_base_object_select(object_in_scene(ob, scene), BA_SELECT);
 		
 		if ((par->type != OB_ARMATURE) && (par->type != OB_CURVE) && (par->type != OB_LATTICE)) {
-			ED_object_parent_set(C, op, par, partype);
+			if (ED_object_parent_set(op->reports, bmain, scene, ob, par, partype)) {
+				DAG_scene_sort(bmain, scene);
+				DAG_ids_flush_update(bmain, 0);
+				WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+				WM_event_add_notifier(C, NC_OBJECT|ND_PARENT, NULL);
+			}
 		}
 		else {
 			/* Menu creation */
-			uiPopupMenu *pup= uiPupMenuBegin(C, "Set Parent To", ICON_NONE);
+			uiPopupMenu *pup= uiPupMenuBegin(C, IFACE_("Set Parent To"), ICON_NONE);
 			uiLayout *layout= uiPupMenuLayout(pup);
 			
 			PointerRNA ptr;
@@ -1533,7 +1509,8 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, wmEvent *event)
 			RNA_string_set(&ptr, "child", childname);
 			RNA_enum_set(&ptr, "type", PAR_OBJECT);
 			/* Cannot use uiItemEnumO()... have multiple properties to set. */
-			uiItemFullO(layout, "OUTLINER_OT_parent_drop", "Object", 0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
+			uiItemFullO(layout, "OUTLINER_OT_parent_drop", IFACE_("Object"),
+			            0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
 			
 			/* par becomes parent, make the associated menus */
 			if (par->type==OB_ARMATURE) {
@@ -1541,57 +1518,66 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, wmEvent *event)
 				RNA_string_set(&ptr, "parent", parname);
 				RNA_string_set(&ptr, "child", childname);
 				RNA_enum_set(&ptr, "type", PAR_ARMATURE);
-				uiItemFullO(layout, "OUTLINER_OT_parent_drop", "Armature Deform", 0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
+				uiItemFullO(layout, "OUTLINER_OT_parent_drop", IFACE_("Armature Deform"),
+				            0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
 				
 				WM_operator_properties_create(&ptr, "OUTLINER_OT_parent_drop");
 				RNA_string_set(&ptr, "parent", parname);
 				RNA_string_set(&ptr, "child", childname);
 				RNA_enum_set(&ptr, "type", PAR_ARMATURE_NAME);
-				uiItemFullO(layout, "OUTLINER_OT_parent_drop", "   With Empty Groups", 0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
+				uiItemFullO(layout, "OUTLINER_OT_parent_drop", IFACE_("   With Empty Groups"),
+				            0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
 				
 				WM_operator_properties_create(&ptr, "OUTLINER_OT_parent_drop");
 				RNA_string_set(&ptr, "parent", parname);
 				RNA_string_set(&ptr, "child", childname);
 				RNA_enum_set(&ptr, "type", PAR_ARMATURE_ENVELOPE);
-				uiItemFullO(layout, "OUTLINER_OT_parent_drop", "   With Envelope Weights", 0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
+				uiItemFullO(layout, "OUTLINER_OT_parent_drop", IFACE_("   With Envelope Weights"),
+				            0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
 				
 				WM_operator_properties_create(&ptr, "OUTLINER_OT_parent_drop");
 				RNA_string_set(&ptr, "parent", parname);
 				RNA_string_set(&ptr, "child", childname);
 				RNA_enum_set(&ptr, "type", PAR_ARMATURE_AUTO);
-				uiItemFullO(layout, "OUTLINER_OT_parent_drop", "   With Automatic Weights", 0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
+				uiItemFullO(layout, "OUTLINER_OT_parent_drop", IFACE_("   With Automatic Weights"),
+				            0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
 				
 				WM_operator_properties_create(&ptr, "OUTLINER_OT_parent_drop");
 				RNA_string_set(&ptr, "parent", parname);
 				RNA_string_set(&ptr, "child", childname);
 				RNA_enum_set(&ptr, "type", PAR_BONE);
-				uiItemFullO(layout, "OUTLINER_OT_parent_drop", "Bone", 0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
+				uiItemFullO(layout, "OUTLINER_OT_parent_drop", IFACE_("Bone"),
+				            0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
 			}
 			else if (par->type==OB_CURVE) {
 				WM_operator_properties_create(&ptr, "OUTLINER_OT_parent_drop");
 				RNA_string_set(&ptr, "parent", parname);
 				RNA_string_set(&ptr, "child", childname);
 				RNA_enum_set(&ptr, "type", PAR_CURVE);
-				uiItemFullO(layout, "OUTLINER_OT_parent_drop", "Curve Deform", 0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
+				uiItemFullO(layout, "OUTLINER_OT_parent_drop", IFACE_("Curve Deform"),
+				            0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
 				
 				WM_operator_properties_create(&ptr, "OUTLINER_OT_parent_drop");
 				RNA_string_set(&ptr, "parent", parname);
 				RNA_string_set(&ptr, "child", childname);
 				RNA_enum_set(&ptr, "type", PAR_FOLLOW);
-				uiItemFullO(layout, "OUTLINER_OT_parent_drop", "Follow Path", 0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
+				uiItemFullO(layout, "OUTLINER_OT_parent_drop", IFACE_("Follow Path"),
+				            0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
 				
 				WM_operator_properties_create(&ptr, "OUTLINER_OT_parent_drop");
 				RNA_string_set(&ptr, "parent", parname);
 				RNA_string_set(&ptr, "child", childname);
 				RNA_enum_set(&ptr, "type", PAR_PATH_CONST);
-				uiItemFullO(layout, "OUTLINER_OT_parent_drop", "Path Constraint", 0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
+				uiItemFullO(layout, "OUTLINER_OT_parent_drop", IFACE_("Path Constraint"),
+				            0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
 			}
 			else if (par->type == OB_LATTICE) {
 				WM_operator_properties_create(&ptr, "OUTLINER_OT_parent_drop");
 				RNA_string_set(&ptr, "parent", parname);
 				RNA_string_set(&ptr, "child", childname);
 				RNA_enum_set(&ptr, "type", PAR_LATTICE);
-				uiItemFullO(layout, "OUTLINER_OT_parent_drop", "Lattice Deform", 0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
+				uiItemFullO(layout, "OUTLINER_OT_parent_drop", IFACE_("Lattice Deform"),
+				            0, ptr.data, WM_OP_EXEC_DEFAULT, 0);
 			}
 			
 			uiPupMenuEnd(C, pup);
@@ -1609,18 +1595,18 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, wmEvent *event)
 void OUTLINER_OT_parent_drop(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Drop to Set Parent";
+	ot->name = "Drop to Set Parent";
 	ot->description = "Drag to parent in Outliner";
-	ot->idname= "OUTLINER_OT_parent_drop";
+	ot->idname = "OUTLINER_OT_parent_drop";
 
 	/* api callbacks */
-	ot->invoke= parent_drop_invoke;
-	ot->exec= parent_drop_exec;
+	ot->invoke = parent_drop_invoke;
+	ot->exec = parent_drop_exec;
 
-	ot->poll= ED_operator_outliner_active;
+	ot->poll = ED_operator_outliner_active;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_string(ot->srna, "child", "Object", MAX_ID_NAME, "Child", "Child Object");
@@ -1687,17 +1673,17 @@ static int parent_clear_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
 void OUTLINER_OT_parent_clear(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Drop to Clear Parent";
+	ot->name = "Drop to Clear Parent";
 	ot->description = "Drag to clear parent in Outliner";
-	ot->idname= "OUTLINER_OT_parent_clear";
+	ot->idname = "OUTLINER_OT_parent_clear";
 
 	/* api callbacks */
-	ot->invoke= parent_clear_invoke;
+	ot->invoke = parent_clear_invoke;
 
-	ot->poll= ED_operator_outliner_active;
+	ot->poll = ED_operator_outliner_active;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_string(ot->srna, "dragged_obj", "Object", MAX_ID_NAME, "Child", "Child Object");
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index be33fc2..b1990d3 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -29,8 +29,8 @@
  */
 
 
-#ifndef ED_OUTLINER_INTERN_H
-#define ED_OUTLINER_INTERN_H
+#ifndef __OUTLINER_INTERN_H__
+#define __OUTLINER_INTERN_H__
 
 #include "RNA_types.h"
 
@@ -127,20 +127,20 @@ typedef struct TreeElement {
 
 
 /* Outliner Searching --
-
-   Are we looking for something in the outliner?
-   If so finding matches in child items makes it more useful
-
-	 - We want to flag parents to act as being open to filter child matches 
-	 - and also flag matches so we can highlight them
-	 - Flags are stored in TreeStoreElem->flag
-	 - Flag options defined in DNA_outliner_types.h
-	 - SO_SEARCH_RECURSIVE defined in DNA_space_types.h
-	 
-	 - NOT in datablocks view - searching all datablocks takes way too long 
-		to be useful
-	 - not searching into RNA items helps but isn't the complete solution
-	*/
+ *
+ * Are we looking for something in the outliner?
+ * If so finding matches in child items makes it more useful
+ *
+ * - We want to flag parents to act as being open to filter child matches 
+ * - and also flag matches so we can highlight them
+ * - Flags are stored in TreeStoreElem->flag
+ * - Flag options defined in DNA_outliner_types.h
+ * - SO_SEARCH_RECURSIVE defined in DNA_space_types.h
+ *
+ * - NOT in datablocks view - searching all datablocks takes way too long 
+ *   to be useful
+ * - not searching into RNA items helps but isn't the complete solution
+ */
 
 #define SEARCHING_OUTLINER(sov)   (sov->search_flags & SO_SEARCH_RECURSIVE)
 
@@ -237,4 +237,4 @@ void OUTLINER_OT_action_set(struct wmOperatorType *ot);
 void outliner_operatortypes(void);
 void outliner_keymap(struct wmKeyConfig *keyconf);
 
-#endif /* ED_OUTLINER_INTERN_H */
+#endif /* __OUTLINER_INTERN_H__ */
diff --git a/source/blender/editors/space_outliner/outliner_ops.c b/source/blender/editors/space_outliner/outliner_ops.c
index 17434d0..12f8f2c 100644
--- a/source/blender/editors/space_outliner/outliner_ops.c
+++ b/source/blender/editors/space_outliner/outliner_ops.c
@@ -28,9 +28,6 @@
  *  \ingroup spoutliner
  */
 
-
-#include <stdlib.h>
-
 #include "DNA_space_types.h"
 
 #include "WM_api.h"
@@ -42,9 +39,8 @@
 
 #include "outliner_intern.h"
 
-/* ************************** registration **********************************/
-
 
+/* ************************** registration **********************************/
 
 void outliner_operatortypes(void)
 {
@@ -84,7 +80,7 @@ void outliner_operatortypes(void)
 
 void outliner_keymap(wmKeyConfig *keyconf)
 {
-	wmKeyMap *keymap= WM_keymap_find(keyconf, "Outliner", SPACE_OUTLINER, 0);
+	wmKeyMap *keymap = WM_keymap_find(keyconf, "Outliner", SPACE_OUTLINER, 0);
 	wmKeyMapItem *kmi;
 	
 	WM_keymap_add_item(keymap, "OUTLINER_OT_item_rename", LEFTMOUSE, KM_DBL_CLICK, 0, 0);
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 345e7a8..c06576e 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -29,54 +29,23 @@
  *  \ingroup spoutliner
  */
 
-#include <math.h>
-#include <string.h>
 #include <stdlib.h>
-#include <stddef.h>
 
 #include "MEM_guardedalloc.h"
 
-#include "DNA_anim_types.h"
 #include "DNA_armature_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_camera_types.h"
 #include "DNA_group_types.h"
-#include "DNA_key_types.h"
 #include "DNA_lamp_types.h"
 #include "DNA_material_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meta_types.h"
-#include "DNA_particle_types.h"
+#include "DNA_object_types.h"
 #include "DNA_scene_types.h"
-#include "DNA_world_types.h"
 #include "DNA_sequence_types.h"
-#include "DNA_object_types.h"
+#include "DNA_world_types.h"
 
-#include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
-#include "BLI_math_base.h"
-
-#if defined WIN32 && !defined _LIBC
-# include "BLI_fnmatch.h" /* use fnmatch included in blenlib */
-#else
-#  ifndef _GNU_SOURCE
-#    define _GNU_SOURCE
-#  endif
-# include <fnmatch.h>
-#endif
-
 
-#include "BKE_animsys.h"
 #include "BKE_context.h"
-#include "BKE_deform.h"
 #include "BKE_depsgraph.h"
-#include "BKE_fcurve.h"
-#include "BKE_global.h"
-#include "BKE_group.h"
-#include "BKE_library.h"
-#include "BKE_main.h"
-#include "BKE_modifier.h"
-#include "BKE_report.h"
 #include "BKE_scene.h"
 #include "BKE_sequencer.h"
 
@@ -88,12 +57,8 @@
 #include "WM_api.h"
 #include "WM_types.h"
 
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
 
 #include "UI_interface.h"
-#include "UI_interface_icons.h"
-#include "UI_resources.h"
 #include "UI_view2d.h"
 
 #include "RNA_access.h"
@@ -159,11 +124,11 @@ static int tree_element_active_renderlayer(bContext *C, TreeElement *te, TreeSto
 	Scene *sce;
 	
 	/* paranoia check */
-	if(te->idcode!=ID_SCE)
+	if (te->idcode!=ID_SCE)
 		return 0;
 	sce= (Scene *)tselem->id;
 	
-	if(set) {
+	if (set) {
 		sce->r.actlay= tselem->nr;
 		WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, sce);
 	}
@@ -181,25 +146,25 @@ static int  tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops
 	Object *ob= NULL;
 	
 	/* if id is not object, we search back */
-	if(te->idcode==ID_OB) ob= (Object *)tselem->id;
+	if (te->idcode==ID_OB) ob= (Object *)tselem->id;
 	else {
 		ob= (Object *)outliner_search_back(soops, te, ID_OB);
-		if(ob==OBACT) return 0;
+		if (ob==OBACT) return 0;
 	}
-	if(ob==NULL) return 0;
+	if (ob==NULL) return 0;
 	
 	sce= (Scene *)outliner_search_back(soops, te, ID_SCE);
-	if(sce && scene != sce) {
-		ED_screen_set_scene(C, sce);
+	if (sce && scene != sce) {
+		ED_screen_set_scene(C, CTX_wm_screen(C), sce);
 	}
 	
 	/* find associated base in current scene */
 	base= object_in_scene(ob, scene);
 
-	if(base) {
-		if(set==2) {
+	if (base) {
+		if (set==2) {
 			/* swap select */
-			if(base->flag & SELECT)
+			if (base->flag & SELECT)
 				ED_base_object_select(base, BA_DESELECT);
 			else 
 				ED_base_object_select(base, BA_SELECT);
@@ -209,13 +174,13 @@ static int  tree_element_set_active_object(bContext *C, Scene *scene, SpaceOops
 			scene_deselect_all(scene);
 			ED_base_object_select(base, BA_SELECT);
 		}
-		if(C) {
+		if (C) {
 			ED_base_object_activate(C, base); /* adds notifier */
 			WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
 		}
 	}
 	
-	if(ob!=scene->obedit) 
+	if (ob!=scene->obedit)
 		ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO);
 		
 	return 1;
@@ -229,32 +194,32 @@ static int tree_element_active_material(bContext *C, Scene *scene, SpaceOops *so
 	/* we search for the object parent */
 	ob= (Object *)outliner_search_back(soops, te, ID_OB);
 	// note: ob->matbits can be NULL when a local object points to a library mesh.
-	if(ob==NULL || ob!=OBACT || ob->matbits==NULL) return 0;	// just paranoia
+	if (ob==NULL || ob!=OBACT || ob->matbits==NULL) return 0;	// just paranoia
 	
 	/* searching in ob mat array? */
 	tes= te->parent;
-	if(tes->idcode==ID_OB) {
-		if(set) {
+	if (tes->idcode==ID_OB) {
+		if (set) {
 			ob->actcol= te->index+1;
 			ob->matbits[te->index]= 1;	// make ob material active too
 		}
 		else {
-			if(ob->actcol == te->index+1) 
-				if(ob->matbits[te->index]) return 1;
+			if (ob->actcol == te->index+1)
+				if (ob->matbits[te->index]) return 1;
 		}
 	}
 	/* or we search for obdata material */
 	else {
-		if(set) {
+		if (set) {
 			ob->actcol= te->index+1;
 			ob->matbits[te->index]= 0;	// make obdata material active too
 		}
 		else {
-			if(ob->actcol == te->index+1)
-				if(ob->matbits[te->index]==0) return 1;
+			if (ob->actcol == te->index+1)
+				if (ob->matbits[te->index]==0) return 1;
 		}
 	}
-	if(set) {
+	if (set) {
 		WM_event_add_notifier(C, NC_MATERIAL|ND_SHADING, NULL);
 	}
 	return 0;
@@ -267,7 +232,7 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo
 	Object *ob=OBACT;
 	SpaceButs *sbuts=NULL;
 	
-	if(ob==NULL) return 0; // no active object
+	if (ob==NULL) return 0; // no active object
 	
 	/*tselem= TREESTORE(te);*/ /*UNUSED*/
 	
@@ -278,25 +243,25 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo
 	tep= te->parent;
 	tselemp= TREESTORE(tep);
 	
-	if(tep->idcode==ID_WO) {
+	if (tep->idcode==ID_WO) {
 		World *wrld= (World *)tselemp->id;
 
-		if(set) {
-			if(sbuts) {
+		if (set) {
+			if (sbuts) {
 				// 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;
 		}
-		else if(tselemp->id == (ID *)(scene->world)) {
-			if(wrld->texact==te->index) return 1;
+		else if (tselemp->id == (ID *)(scene->world)) {
+			if (wrld->texact==te->index) return 1;
 		}
 	}
-	else if(tep->idcode==ID_LA) {
+	else if (tep->idcode==ID_LA) {
 		Lamp *la= (Lamp *)tselemp->id;
-		if(set) {
-			if(sbuts) {
+		if (set) {
+			if (sbuts) {
 				// XXX sbuts->tabo= TAB_SHADING_TEX;	// hack from header_buttonswin.c
 				// XXX sbuts->texfrom= 2;
 			}
@@ -304,15 +269,15 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo
 			la->texact= te->index;
 		}
 		else {
-			if(tselemp->id == ob->data) {
-				if(la->texact==te->index) return 1;
+			if (tselemp->id == ob->data) {
+				if (la->texact==te->index) return 1;
 			}
 		}
 	}
-	else if(tep->idcode==ID_MA) {
+	else if (tep->idcode==ID_MA) {
 		Material *ma= (Material *)tselemp->id;
-		if(set) {
-			if(sbuts) {
+		if (set) {
+			if (sbuts) {
 				//sbuts->tabo= TAB_SHADING_TEX;	// hack from header_buttonswin.c
 				// XXX sbuts->texfrom= 0;
 			}
@@ -322,12 +287,12 @@ static int tree_element_active_texture(bContext *C, Scene *scene, SpaceOops *soo
 			/* also set active material */
 			ob->actcol= tep->index+1;
 		}
-		else if(tep->flag & TE_ACTIVE) {	// this is active material
-			if(ma->texact==te->index) return 1;
+		else if (tep->flag & TE_ACTIVE) {	// this is active material
+			if (ma->texact==te->index) return 1;
 		}
 	}
 	
-	if(set)
+	if (set)
 		WM_event_add_notifier(C, NC_TEXTURE, NULL);
 
 	return 0;
@@ -340,9 +305,9 @@ static int tree_element_active_lamp(bContext *UNUSED(C), Scene *scene, SpaceOops
 	
 	/* we search for the object parent */
 	ob= (Object *)outliner_search_back(soops, te, ID_OB);
-	if(ob==NULL || ob!=OBACT) return 0;	// just paranoia
+	if (ob==NULL || ob!=OBACT) return 0;	// just paranoia
 	
-	if(set) {
+	if (set) {
 // XXX		extern_set_butspace(F5KEY, 0);
 	}
 	else return 1;
@@ -354,7 +319,7 @@ static int tree_element_active_camera(bContext *UNUSED(C), Scene *scene, SpaceOo
 {
 	Object *ob= (Object *)outliner_search_back(soops, te, ID_OB);
 
-	if(set)
+	if (set)
 		return 0;
 
 	return scene->camera == ob;
@@ -367,19 +332,19 @@ static int tree_element_active_world(bContext *C, Scene *scene, SpaceOops *soops
 	Scene *sce=NULL;
 	
 	tep= te->parent;
-	if(tep) {
+	if (tep) {
 		tselem= TREESTORE(tep);
 		sce= (Scene *)tselem->id;
 	}
 	
-	if(set) {	// make new scene active
-		if(sce && scene != sce) {
-			ED_screen_set_scene(C, sce);
+	if (set) {	// make new scene active
+		if (sce && scene != sce) {
+			ED_screen_set_scene(C, CTX_wm_screen(C), sce);
 		}
 	}
 	
-	if(tep==NULL || tselem->id == (ID *)scene) {
-		if(set) {
+	if (tep==NULL || tselem->id == (ID *)scene) {
+		if (set) {
 // XXX			extern_set_butspace(F8KEY, 0);
 		}
 		else {
@@ -395,7 +360,7 @@ static int tree_element_active_defgroup(bContext *C, Scene *scene, TreeElement *
 	
 	/* id in tselem is object */
 	ob= (Object *)tselem->id;
-	if(set) {
+	if (set) {
 		BLI_assert(te->index+1 >= 0);
 		ob->actdef= te->index+1;
 
@@ -403,8 +368,8 @@ static int tree_element_active_defgroup(bContext *C, Scene *scene, TreeElement *
 		WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, ob);
 	}
 	else {
-		if(ob==OBACT)
-			if(ob->actdef== te->index+1) return 1;
+		if (ob==OBACT)
+			if (ob->actdef== te->index+1) return 1;
 	}
 	return 0;
 }
@@ -413,14 +378,14 @@ static int tree_element_active_posegroup(bContext *C, Scene *scene, TreeElement
 {
 	Object *ob= (Object *)tselem->id;
 	
-	if(set) {
+	if (set) {
 		if (ob->pose) {
 			ob->pose->active_group= te->index+1;
 			WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
 		}
 	}
 	else {
-		if(ob==OBACT && ob->pose) {
+		if (ob==OBACT && ob->pose) {
 			if (ob->pose->active_group== te->index+1) return 1;
 		}
 	}
@@ -433,15 +398,16 @@ static int tree_element_active_posechannel(bContext *C, Scene *scene, TreeElemen
 	bArmature *arm= ob->data;
 	bPoseChannel *pchan= te->directdata;
 	
-	if(set) {
-		if(!(pchan->bone->flag & BONE_HIDDEN_P)) {
+	if (set) {
+		if (!(pchan->bone->flag & BONE_HIDDEN_P)) {
 			
-			if(set==2) ED_pose_deselectall(ob, 2);	// 2 = clear active tag
+			if (set==2) ED_pose_deselectall(ob, 2);	// 2 = clear active tag
 			else ED_pose_deselectall(ob, 0);	// 0 = deselect 
 			
-			if(set==2 && (pchan->bone->flag & BONE_SELECTED)) {
+			if (set==2 && (pchan->bone->flag & BONE_SELECTED)) {
 				pchan->bone->flag &= ~BONE_SELECTED;
-			} else {
+			}
+			else {
 				pchan->bone->flag |= BONE_SELECTED;
 				arm->act_bone= pchan->bone;
 			}
@@ -451,7 +417,7 @@ static int tree_element_active_posechannel(bContext *C, Scene *scene, TreeElemen
 		}
 	}
 	else {
-		if(ob==OBACT && ob->pose) {
+		if (ob==OBACT && ob->pose) {
 			if (pchan->bone->flag & BONE_SELECTED) return 1;
 		}
 	}
@@ -463,14 +429,15 @@ static int tree_element_active_bone(bContext *C, Scene *scene, TreeElement *te,
 	bArmature *arm= (bArmature *)tselem->id;
 	Bone *bone= te->directdata;
 	
-	if(set) {
-		if(!(bone->flag & BONE_HIDDEN_P)) {
-			if(set==2) ED_pose_deselectall(OBACT, 2);	// 2 is clear active tag
+	if (set) {
+		if (!(bone->flag & BONE_HIDDEN_P)) {
+			if (set==2) ED_pose_deselectall(OBACT, 2);	// 2 is clear active tag
 			else ED_pose_deselectall(OBACT, 0);
 			
-			if(set==2 && (bone->flag & BONE_SELECTED)) {
+			if (set==2 && (bone->flag & BONE_SELECTED)) {
 				bone->flag &= ~BONE_SELECTED;
-			} else {
+			}
+			else {
 				bone->flag |= BONE_SELECTED;
 				arm->act_bone= bone;
 			}
@@ -481,7 +448,7 @@ static int tree_element_active_bone(bContext *C, Scene *scene, TreeElement *te,
 	else {
 		Object *ob= OBACT;
 		
-		if(ob && ob->data==arm) {
+		if (ob && ob->data==arm) {
 			if (bone->flag & BONE_SELECTED) return 1;
 		}
 	}
@@ -492,16 +459,16 @@ static int tree_element_active_bone(bContext *C, Scene *scene, TreeElement *te,
 /* ebones only draw in editmode armature */
 static void tree_element_active_ebone__sel(bContext *C, Scene *scene, bArmature *arm, EditBone *ebone, short sel)
 {
-	if(sel) {
+	if (sel) {
 		ebone->flag |= BONE_SELECTED|BONE_ROOTSEL|BONE_TIPSEL;
 		arm->act_edbone= ebone;
 		// flush to parent?
-		if(ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag |= BONE_TIPSEL;
+		if (ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag |= BONE_TIPSEL;
 	}
 	else {
 		ebone->flag &= ~(BONE_SELECTED|BONE_ROOTSEL|BONE_TIPSEL);
 		// flush to parent?
-		if(ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag &= ~BONE_TIPSEL;
+		if (ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag &= ~BONE_TIPSEL;
 	}
 
 	WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, scene->obedit);
@@ -511,16 +478,16 @@ static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te,
 	bArmature *arm= scene->obedit->data;
 	EditBone *ebone= te->directdata;
 
-	if(set==1) {
-		if(!(ebone->flag & BONE_HIDDEN_A)) {
+	if (set==1) {
+		if (!(ebone->flag & BONE_HIDDEN_A)) {
 			ED_armature_deselect_all(scene->obedit, 0);	// deselect
 			tree_element_active_ebone__sel(C, scene, arm, ebone, TRUE);
 			return 1;
 		}
 	}
 	else if (set==2) {
-		if(!(ebone->flag & BONE_HIDDEN_A)) {
-			if(!(ebone->flag & BONE_SELECTED)) {
+		if (!(ebone->flag & BONE_HIDDEN_A)) {
+			if (!(ebone->flag & BONE_SELECTED)) {
 				tree_element_active_ebone__sel(C, scene, arm, ebone, TRUE);
 				return 1;
 			}
@@ -539,7 +506,7 @@ static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te,
 
 static int tree_element_active_modifier(bContext *C, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set)
 {
-	if(set) {
+	if (set) {
 		Object *ob= (Object *)tselem->id;
 		
 		WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
@@ -552,7 +519,7 @@ static int tree_element_active_modifier(bContext *C, TreeElement *UNUSED(te), Tr
 
 static int tree_element_active_psys(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *tselem, int set)
 {
-	if(set) {
+	if (set) {
 		Object *ob= (Object *)tselem->id;
 		
 		WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, ob);
@@ -565,7 +532,7 @@ static int tree_element_active_psys(bContext *C, Scene *UNUSED(scene), TreeEleme
 
 static int tree_element_active_constraint(bContext *C, TreeElement *UNUSED(te), TreeStoreElem *tselem, int set)
 {
-	if(set) {
+	if (set) {
 		Object *ob= (Object *)tselem->id;
 		
 		WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
@@ -586,17 +553,17 @@ static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *UNUS
 	Object *ob= (Object *)tselem->id;
 	Base *base= object_in_scene(ob, scene);
 	
-	if(set) {
-		if(scene->obedit) 
+	if (set) {
+		if (scene->obedit)
 			ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO);
 		
-		if(ob->mode & OB_MODE_POSE) 
+		if (ob->mode & OB_MODE_POSE)
 			ED_armature_exit_posemode(C, base);
 		else 
 			ED_armature_enter_posemode(C, base);
 	}
 	else {
-		if(ob->mode & OB_MODE_POSE) return 1;
+		if (ob->mode & OB_MODE_POSE) return 1;
 	}
 	return 0;
 }
@@ -605,11 +572,11 @@ static int tree_element_active_sequence(TreeElement *te, TreeStoreElem *UNUSED(t
 {
 	Sequence *seq= (Sequence*) te->directdata;
 
-	if(set) {
+	if (set) {
 // XXX		select_single_seq(seq, 1);
 	}
 	else {
-		if(seq->flag & SELECT)
+		if (seq->flag & SELECT)
 			return(1);
 	}
 	return(0);
@@ -621,21 +588,21 @@ static int tree_element_active_sequence_dup(Scene *scene, TreeElement *te, TreeS
 	Editing *ed= seq_give_editing(scene, FALSE);
 
 	seq= (Sequence*)te->directdata;
-	if(set==0) {
-		if(seq->flag & SELECT)
+	if (set==0) {
+		if (seq->flag & SELECT)
 			return(1);
 		return(0);
 	}
 
 // XXX	select_single_seq(seq, 1);
 	p= ed->seqbasep->first;
-	while(p) {
-		if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
+	while (p) {
+		if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
 			p= p->next;
 			continue;
 		}
 
-//		if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
+//		if (!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
 // XXX			select_single_seq(p, 0);
 		p= p->next;
 	}
@@ -644,10 +611,10 @@ static int tree_element_active_sequence_dup(Scene *scene, TreeElement *te, TreeS
 
 static int tree_element_active_keymap_item(bContext *UNUSED(C), TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
 {
-	wmKeyMapItem *kmi= te->directdata;
+	wmKeyMapItem *kmi = te->directdata;
 	
-	if(set==0) {
-		if(kmi->flag & KMI_INACTIVE) return 0;
+	if (set==0) {
+		if (kmi->flag & KMI_INACTIVE) return 0;
 		return 1;
 	}
 	else {
@@ -664,7 +631,7 @@ int tree_element_active(bContext *C, Scene *scene, SpaceOops *soops, TreeElement
 
 	switch(te->idcode) {
 		/* Note: no ID_OB: objects are handled specially to allow multiple
-		   selection. See do_outliner_item_activate. */
+		 * selection. See do_outliner_item_activate. */
 		case ID_MA:
 			return tree_element_active_material(C, scene, soops, te, set);
 		case ID_WO:
@@ -695,8 +662,8 @@ int tree_element_type_active(bContext *C, Scene *scene, SpaceOops *soops, TreeEl
 		case TSE_MODIFIER:
 			return tree_element_active_modifier(C, te, tselem, set);
 		case TSE_LINKED_OB:
-			if(set) tree_element_set_active_object(C, scene, soops, te, set);
-			else if(tselem->id==(ID *)OBACT) return 1;
+			if (set) tree_element_set_active_object(C, scene, soops, te, set);
+			else if (tselem->id==(ID *)OBACT) return 1;
 			break;
 		case TSE_LINKED_PSYS:
 			return tree_element_active_psys(C, scene, te, tselem, set);
@@ -726,24 +693,24 @@ int tree_element_type_active(bContext *C, Scene *scene, SpaceOops *soops, TreeEl
 static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops, TreeElement *te, int extend, const float mval[2])
 {
 	
-	if(mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) {
+	if (mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) {
 		TreeStoreElem *tselem= TREESTORE(te);
 		int openclose= 0;
 		
 		/* open close icon */
-		if((te->flag & TE_ICONROW)==0) {				// hidden icon, no open/close
-			if( mval[0]>te->xs && mval[0]<te->xs+UI_UNIT_X) 
+		if ((te->flag & TE_ICONROW)==0) {				// hidden icon, no open/close
+			if ( mval[0]>te->xs && mval[0]<te->xs+UI_UNIT_X)
 				openclose= 1;
 		}
 		
-		if(openclose) {
+		if (openclose) {
 			/* all below close/open? */
-			if(extend) {
+			if (extend) {
 				tselem->flag &= ~TSE_CLOSED;
 				outliner_set_flag(soops, &te->subtree, TSE_CLOSED, !outliner_has_one_flag(soops, &te->subtree, TSE_CLOSED, 1));
 			}
 			else {
-				if(tselem->flag & TSE_CLOSED) tselem->flag &= ~TSE_CLOSED;
+				if (tselem->flag & TSE_CLOSED) tselem->flag &= ~TSE_CLOSED;
 				else tselem->flag |= TSE_CLOSED;
 				
 			}
@@ -751,50 +718,51 @@ static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, Spa
 			return 1;
 		}
 		/* name and first icon */
-		else if(mval[0]>te->xs+UI_UNIT_X && mval[0]<te->xend) {
+		else if (mval[0]>te->xs+UI_UNIT_X && mval[0]<te->xend) {
 			
 			/* always makes active object */
-			if(tselem->type!=TSE_SEQUENCE && tselem->type!=TSE_SEQ_STRIP && tselem->type!=TSE_SEQUENCE_DUP)
+			if (tselem->type!=TSE_SEQUENCE && tselem->type!=TSE_SEQ_STRIP && tselem->type!=TSE_SEQUENCE_DUP)
 				tree_element_set_active_object(C, scene, soops, te, 1 + (extend!=0 && tselem->type==0));
 			
-			if(tselem->type==0) { // the lib blocks
+			if (tselem->type==0) { // the lib blocks
 				/* editmode? */
-				if(te->idcode==ID_SCE) {
-					if(scene!=(Scene *)tselem->id) {
-						ED_screen_set_scene(C, (Scene *)tselem->id);
+				if (te->idcode==ID_SCE) {
+					if (scene!=(Scene *)tselem->id) {
+						ED_screen_set_scene(C, CTX_wm_screen(C), (Scene *)tselem->id);
 					}
 				}
-				else if(te->idcode==ID_GR) {
+				else if (te->idcode==ID_GR) {
 					Group *gr= (Group *)tselem->id;
 					GroupObject *gob;
 					
-					if(extend) {
+					if (extend) {
 						int sel= BA_SELECT;
-						for(gob= gr->gobject.first; gob; gob= gob->next) {
-							if(gob->ob->flag & SELECT) {
+						for (gob= gr->gobject.first; gob; gob= gob->next) {
+							if (gob->ob->flag & SELECT) {
 								sel= BA_DESELECT;
 								break;
 							}
 						}
 						
-						for(gob= gr->gobject.first; gob; gob= gob->next) {
+						for (gob= gr->gobject.first; gob; gob= gob->next) {
 							ED_base_object_select(object_in_scene(gob->ob, scene), sel);
 						}
 					}
 					else {
 						scene_deselect_all(scene);
 						
-						for(gob= gr->gobject.first; gob; gob= gob->next) {
-							if((gob->ob->flag & SELECT) == 0)
+						for (gob= gr->gobject.first; gob; gob= gob->next) {
+							if ((gob->ob->flag & SELECT) == 0)
 								ED_base_object_select(object_in_scene(gob->ob, scene), BA_SELECT);
 						}
 					}
 					
 					WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
 				}
-				else if(ELEM5(te->idcode, ID_ME, ID_CU, ID_MB, ID_LT, ID_AR)) {
+				else if (ELEM5(te->idcode, ID_ME, ID_CU, ID_MB, ID_LT, ID_AR)) {
 					WM_operator_name_call(C, "OBJECT_OT_editmode_toggle", WM_OP_INVOKE_REGION_WIN, NULL);
-				} else {	// rest of types
+				}
+				else {	// rest of types
 					tree_element_active(C, scene, soops, te, 1);
 				}
 				
@@ -805,8 +773,8 @@ static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, Spa
 		}
 	}
 	
-	for(te= te->subtree.first; te; te= te->next) {
-		if(do_outliner_item_activate(C, scene, ar, soops, te, extend, mval)) return 1;
+	for (te= te->subtree.first; te; te= te->next) {
+		if (do_outliner_item_activate(C, scene, ar, soops, te, extend, mval)) return 1;
 	}
 	return 0;
 }
@@ -830,11 +798,11 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event)
 		return OPERATOR_CANCELLED;
 	}
 
-	for(te= soops->tree.first; te; te= te->next) {
-		if(do_outliner_item_activate(C, scene, ar, soops, te, extend, fmval)) break;
+	for (te= soops->tree.first; te; te= te->next) {
+		if (do_outliner_item_activate(C, scene, ar, soops, te, extend, fmval)) break;
 	}
 	
-	if(te) {
+	if (te) {
 		ED_undo_push(C, "Outliner click event");
 	}
 	else {
@@ -846,7 +814,7 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event)
 						fmval[0], fmval[1], NULL, &row);
 		
 		/* select relevant row */
-		if(outliner_select(soops, &soops->tree, &row, &selecting)) {
+		if (outliner_select(soops, &soops->tree, &row, &selecting)) {
 		
 			soops->storeflag |= SO_TREESTORE_REDRAW;
 		
@@ -863,13 +831,13 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event)
 
 void OUTLINER_OT_item_activate(wmOperatorType *ot)
 {
-	ot->name= "Activate Item";
-	ot->idname= "OUTLINER_OT_item_activate";
-	ot->description= "Handle mouse clicks to activate/select items";
+	ot->name = "Activate Item";
+	ot->idname = "OUTLINER_OT_item_activate";
+	ot->description = "Handle mouse clicks to activate/select items";
 	
-	ot->invoke= outliner_item_activate;
+	ot->invoke = outliner_item_activate;
 	
-	ot->poll= ED_operator_outliner_active;
+	ot->poll = ED_operator_outliner_active;
 	
 	RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection for activation");
 }
@@ -909,15 +877,15 @@ static int outliner_border_select_exec(bContext *C, wmOperator *op)
 	rctf rectf;
 	int gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
 
-	rect.xmin= RNA_int_get(op->ptr, "xmin");
-	rect.ymin= RNA_int_get(op->ptr, "ymin");
+	rect.xmin = RNA_int_get(op->ptr, "xmin");
+	rect.ymin = RNA_int_get(op->ptr, "ymin");
 	UI_view2d_region_to_view(&ar->v2d, rect.xmin, rect.ymin, &rectf.xmin, &rectf.ymin);
 
-	rect.xmax= RNA_int_get(op->ptr, "xmax");
-	rect.ymax= RNA_int_get(op->ptr, "ymax");
+	rect.xmax = RNA_int_get(op->ptr, "xmax");
+	rect.ymax = RNA_int_get(op->ptr, "ymax");
 	UI_view2d_region_to_view(&ar->v2d, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
 
-	for(te= soops->tree.first; te; te= te->next) {
+	for (te= soops->tree.first; te; te= te->next) {
 		outliner_item_border_select(scene, soops, &rectf, te, gesture_mode);
 	}
 
@@ -930,20 +898,20 @@ static int outliner_border_select_exec(bContext *C, wmOperator *op)
 void OUTLINER_OT_select_border(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Border Select";
-	ot->idname= "OUTLINER_OT_select_border";
-	ot->description= "Use box selection to select tree elements";
+	ot->name = "Border Select";
+	ot->idname = "OUTLINER_OT_select_border";
+	ot->description = "Use box selection to select tree elements";
 
 	/* api callbacks */
-	ot->invoke= WM_border_select_invoke;
-	ot->exec= outliner_border_select_exec;
-	ot->modal= WM_border_select_modal;
-	ot->cancel= WM_border_select_cancel;
+	ot->invoke = WM_border_select_invoke;
+	ot->exec = outliner_border_select_exec;
+	ot->modal = WM_border_select_modal;
+	ot->cancel = WM_border_select_cancel;
 
-	ot->poll= ED_operator_outliner_active;
+	ot->poll = ED_operator_outliner_active;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* rna */
 	WM_operator_properties_gesture_border(ot, FALSE);
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index 09a1256..5c527fa 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -29,56 +29,31 @@
  *  \ingroup spoutliner
  */
 
-#include <math.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stddef.h>
-
 #include "MEM_guardedalloc.h"
 
 #include "DNA_anim_types.h"
 #include "DNA_armature_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_camera_types.h"
 #include "DNA_group_types.h"
-#include "DNA_key_types.h"
 #include "DNA_lamp_types.h"
 #include "DNA_material_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_meta_types.h"
-#include "DNA_particle_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_world_types.h"
-#include "DNA_sequence_types.h"
 #include "DNA_object_types.h"
 
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
-#include "BLI_math_base.h"
-
-#if defined WIN32 && !defined _LIBC
-# include "BLI_fnmatch.h" /* use fnmatch included in blenlib */
-#else
-#  ifndef _GNU_SOURCE
-#    define _GNU_SOURCE
-#  endif
-# include <fnmatch.h>
-#endif
-
 
 #include "BKE_animsys.h"
 #include "BKE_context.h"
-#include "BKE_deform.h"
 #include "BKE_depsgraph.h"
 #include "BKE_fcurve.h"
-#include "BKE_global.h"
 #include "BKE_group.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
-#include "BKE_modifier.h"
 #include "BKE_report.h"
 #include "BKE_scene.h"
-#include "BKE_sequencer.h"
 
 #include "ED_armature.h"
 #include "ED_object.h"
@@ -88,12 +63,7 @@
 #include "WM_api.h"
 #include "WM_types.h"
 
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-
 #include "UI_interface.h"
-#include "UI_interface_icons.h"
-#include "UI_resources.h"
 #include "UI_view2d.h"
 
 #include "RNA_access.h"
@@ -115,13 +85,13 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb,
 	TreeElement *te;
 	TreeStoreElem *tselem;
 	
-	for(te= lb->first; te; te= te->next) {
+	for (te= lb->first; te; te= te->next) {
 		tselem= TREESTORE(te);
-		if(tselem->flag & TSE_SELECTED) {
-			if(tselem->type) {
-				if(*datalevel==0) 
+		if (tselem->flag & TSE_SELECTED) {
+			if (tselem->type) {
+				if (*datalevel==0)
 					*datalevel= tselem->type;
-				else if(*datalevel!=tselem->type) 
+				else if (*datalevel!=tselem->type)
 					*datalevel= -1;
 			}
 			else {
@@ -139,13 +109,13 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb,
 					case ID_MA: case ID_TE: case ID_IP: case ID_IM:
 					case ID_SO: case ID_KE: case ID_WO: case ID_AC:
 					case ID_NLA: case ID_TXT: case ID_GR:
-						if(*idlevel==0) *idlevel= idcode;
-						else if(*idlevel!=idcode) *idlevel= -1;
+						if (*idlevel==0) *idlevel= idcode;
+						else if (*idlevel!=idcode) *idlevel= -1;
 							break;
 				}
 			}
 		}
-		if(TSELEM_OPEN(tselem,soops)) {
+		if (TSELEM_OPEN(tselem,soops)) {
 			set_operation_types(soops, &te->subtree,
 								scenelevel, objectlevel, idlevel, datalevel);
 		}
@@ -163,29 +133,29 @@ static void unlink_material_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeEl
 	Material **matar=NULL;
 	int a, totcol=0;
 	
-	if( GS(tsep->id->name)==ID_OB) {
+	if ( GS(tsep->id->name)==ID_OB) {
 		Object *ob= (Object *)tsep->id;
 		totcol= ob->totcol;
 		matar= ob->mat;
 	}
-	else if( GS(tsep->id->name)==ID_ME) {
+	else if ( GS(tsep->id->name)==ID_ME) {
 		Mesh *me= (Mesh *)tsep->id;
 		totcol= me->totcol;
 		matar= me->mat;
 	}
-	else if( GS(tsep->id->name)==ID_CU) {
+	else if ( GS(tsep->id->name)==ID_CU) {
 		Curve *cu= (Curve *)tsep->id;
 		totcol= cu->totcol;
 		matar= cu->mat;
 	}
-	else if( GS(tsep->id->name)==ID_MB) {
+	else if ( GS(tsep->id->name)==ID_MB) {
 		MetaBall *mb= (MetaBall *)tsep->id;
 		totcol= mb->totcol;
 		matar= mb->mat;
 	}
 
-	for(a=0; a<totcol; a++) {
-		if(a==te->index && matar[a]) {
+	for (a=0; a<totcol; a++) {
+		if (a==te->index && matar[a]) {
 			matar[a]->id.us--;
 			matar[a]= NULL;
 		}
@@ -197,23 +167,23 @@ static void unlink_texture_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeEle
 	MTex **mtex= NULL;
 	int a;
 	
-	if( GS(tsep->id->name)==ID_MA) {
+	if ( GS(tsep->id->name)==ID_MA) {
 		Material *ma= (Material *)tsep->id;
 		mtex= ma->mtex;
 	}
-	else if( GS(tsep->id->name)==ID_LA) {
+	else if ( GS(tsep->id->name)==ID_LA) {
 		Lamp *la= (Lamp *)tsep->id;
 		mtex= la->mtex;
 	}
-	else if( GS(tsep->id->name)==ID_WO) {
+	else if ( GS(tsep->id->name)==ID_WO) {
 		World *wrld= (World *)tsep->id;
 		mtex= wrld->mtex;
 	}
 	else return;
 	
-	for(a=0; a<MAX_MTEX; a++) {
-		if(a==te->index && mtex[a]) {
-			if(mtex[a]->tex) {
+	for (a=0; a<MAX_MTEX; a++) {
+		if (a==te->index && mtex[a]) {
+			if (mtex[a]->tex) {
 				mtex[a]->tex->id.us--;
 				mtex[a]->tex= NULL;
 			}
@@ -225,8 +195,8 @@ static void unlink_group_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeEleme
 {
 	Group *group= (Group *)tselem->id;
 	
-	if(tsep) {
-		if( GS(tsep->id->name)==ID_OB) {
+	if (tsep) {
+		if ( GS(tsep->id->name)==ID_OB) {
 			Object *ob= (Object *)tsep->id;
 			ob->dup_group= NULL;
 		}
@@ -252,15 +222,15 @@ static void outliner_do_libdata_operation(bContext *C, Scene *scene, SpaceOops *
 	TreeElement *te;
 	TreeStoreElem *tselem;
 	
-	for(te=lb->first; te; te= te->next) {
+	for (te=lb->first; te; te= te->next) {
 		tselem= TREESTORE(te);
-		if(tselem->flag & TSE_SELECTED) {
-			if(tselem->type==0) {
+		if (tselem->flag & TSE_SELECTED) {
+			if (tselem->type==0) {
 				TreeStoreElem *tsep= TREESTORE(te->parent);
 				operation_cb(C, scene, te, tsep, tselem);
 			}
 		}
-		if(TSELEM_OPEN(tselem,soops)) {
+		if (TSELEM_OPEN(tselem,soops)) {
 			outliner_do_libdata_operation(C, scene, soops, &te->subtree, operation_cb);
 		}
 	}
@@ -272,8 +242,8 @@ static void object_select_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te,
 {
 	Base *base= (Base *)te->directdata;
 	
-	if(base==NULL) base= object_in_scene((Object *)tselem->id, scene);
-	if(base && ((base->object->restrictflag & OB_RESTRICT_VIEW)==0)) {
+	if (base==NULL) base= object_in_scene((Object *)tselem->id, scene);
+	if (base && ((base->object->restrictflag & OB_RESTRICT_VIEW)==0)) {
 		base->flag |= SELECT;
 		base->object->flag |= SELECT;
 	}
@@ -283,8 +253,8 @@ static void object_deselect_cb(bContext *UNUSED(C), Scene *scene, TreeElement *t
 {
 	Base *base= (Base *)te->directdata;
 	
-	if(base==NULL) base= object_in_scene((Object *)tselem->id, scene);
-	if(base) {
+	if (base==NULL) base= object_in_scene((Object *)tselem->id, scene);
+	if (base) {
 		base->flag &= ~SELECT;
 		base->object->flag &= ~SELECT;
 	}
@@ -294,11 +264,11 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto
 {
 	Base *base= (Base *)te->directdata;
 	
-	if(base==NULL) 
+	if (base==NULL)
 		base= object_in_scene((Object *)tselem->id, scene);
-	if(base) {
+	if (base) {
 		// check also library later
-		if(scene->obedit==base->object) 
+		if (scene->obedit==base->object)
 			ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO);
 		
 		ED_base_object_free_and_unlink(CTX_data_main(C), scene, base);
@@ -378,12 +348,13 @@ static void group_linkobs2scene_cb(bContext *UNUSED(C), Scene *scene, TreeElemen
 	GroupObject *gob;
 	Base *base;
 	
-	for(gob=group->gobject.first; gob; gob=gob->next) {
+	for (gob=group->gobject.first; gob; gob=gob->next) {
 		base= object_in_scene(gob->ob, scene);
 		if (base) {
 			base->object->flag |= SELECT;
 			base->flag |= SELECT;
-		} else {
+		}
+		else {
 			/* link to scene */
 			base= MEM_callocN( sizeof(Base), "add_base");
 			BLI_addhead(&scene->base, base);
@@ -391,7 +362,7 @@ static void group_linkobs2scene_cb(bContext *UNUSED(C), Scene *scene, TreeElemen
 			gob->ob->flag |= SELECT;
 			base->flag = gob->ob->flag;
 			base->object= gob->ob;
-			id_lib_extern((ID *)gob->ob); /* incase these are from a linked group */
+			id_lib_extern((ID *)gob->ob); /* in case these are from a linked group */
 		}
 	}
 }
@@ -402,22 +373,22 @@ void outliner_do_object_operation(bContext *C, Scene *scene_act, SpaceOops *soop
 	TreeElement *te;
 	TreeStoreElem *tselem;
 	
-	for(te=lb->first; te; te= te->next) {
+	for (te=lb->first; te; te= te->next) {
 		tselem= TREESTORE(te);
-		if(tselem->flag & TSE_SELECTED) {
-			if(tselem->type==0 && te->idcode==ID_OB) {
+		if (tselem->flag & TSE_SELECTED) {
+			if (tselem->type==0 && te->idcode==ID_OB) {
 				// when objects selected in other scenes... dunno if that should be allowed
 				Scene *scene_owner= (Scene *)outliner_search_back(soops, te, ID_SCE);
-				if(scene_owner && scene_act != scene_owner) {
-					ED_screen_set_scene(C, scene_owner);
+				if (scene_owner && scene_act != scene_owner) {
+					ED_screen_set_scene(C, CTX_wm_screen(C), scene_owner);
 				}
 				/* important to use 'scene_owner' not scene_act else deleting objects can crash.
 				 * only use 'scene_act' when 'scene_owner' is NULL, which can happen when the
-				 * outliner isnt showing scenes: Visible Layer draw mode for eg. */
+				 * outliner isn't showing scenes: Visible Layer draw mode for eg. */
 				operation_cb(C, scene_owner ? scene_owner : scene_act, te, NULL, tselem);
 			}
 		}
-		if(TSELEM_OPEN(tselem,soops)) {
+		if (TSELEM_OPEN(tselem,soops)) {
 			outliner_do_object_operation(C, scene_act, soops, &te->subtree, operation_cb);
 		}
 	}
@@ -459,15 +430,15 @@ static void pchan_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem))
 {
 	bPoseChannel *pchan= (bPoseChannel *)te->directdata;
 	
-	if(event==1)
+	if (event==1)
 		pchan->bone->flag |= BONE_SELECTED;
-	else if(event==2)
+	else if (event==2)
 		pchan->bone->flag &= ~BONE_SELECTED;
-	else if(event==3) {
+	else if (event==3) {
 		pchan->bone->flag |= BONE_HIDDEN_P;
 		pchan->bone->flag &= ~BONE_SELECTED;
 	}
-	else if(event==4)
+	else if (event==4)
 		pchan->bone->flag &= ~BONE_HIDDEN_P;
 }
 
@@ -475,15 +446,15 @@ static void bone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem))
 {
 	Bone *bone= (Bone *)te->directdata;
 	
-	if(event==1)
+	if (event==1)
 		bone->flag |= BONE_SELECTED;
-	else if(event==2)
+	else if (event==2)
 		bone->flag &= ~BONE_SELECTED;
-	else if(event==3) {
+	else if (event==3) {
 		bone->flag |= BONE_HIDDEN_P;
 		bone->flag &= ~BONE_SELECTED;
 	}
-	else if(event==4)
+	else if (event==4)
 		bone->flag &= ~BONE_HIDDEN_P;
 }
 
@@ -491,22 +462,22 @@ static void ebone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem))
 {
 	EditBone *ebone= (EditBone *)te->directdata;
 	
-	if(event==1)
+	if (event==1)
 		ebone->flag |= BONE_SELECTED;
-	else if(event==2)
+	else if (event==2)
 		ebone->flag &= ~BONE_SELECTED;
-	else if(event==3) {
+	else if (event==3) {
 		ebone->flag |= BONE_HIDDEN_A;
 		ebone->flag &= ~BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL;
 	}
-	else if(event==4)
+	else if (event==4)
 		ebone->flag &= ~BONE_HIDDEN_A;
 }
 
 static void sequence_cb(int event, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tselem))
 {
 //	Sequence *seq= (Sequence*) te->directdata;
-	if(event==1) {
+	if (event==1) {
 // XXX		select_single_seq(seq, 1);
 	}
 }
@@ -517,14 +488,14 @@ static void outliner_do_data_operation(SpaceOops *soops, int type, int event, Li
 	TreeElement *te;
 	TreeStoreElem *tselem;
 	
-	for(te=lb->first; te; te= te->next) {
+	for (te=lb->first; te; te= te->next) {
 		tselem= TREESTORE(te);
-		if(tselem->flag & TSE_SELECTED) {
-			if(tselem->type==type) {
+		if (tselem->flag & TSE_SELECTED) {
+			if (tselem->type==type) {
 				operation_cb(event, te, tselem);
 			}
 		}
-		if(TSELEM_OPEN(tselem,soops)) {
+		if (TSELEM_OPEN(tselem,soops)) {
 			outliner_do_data_operation(soops, type, event, &te->subtree, operation_cb);
 		}
 	}
@@ -557,55 +528,55 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
 	
 	event= RNA_enum_get(op->ptr, "type");
 
-	if(event==1) {
+	if (event==1) {
 		Scene *sce= scene;	// to be able to delete, scenes are set...
 		outliner_do_object_operation(C, scene, soops, &soops->tree, object_select_cb);
-		if(scene != sce) {
-			ED_screen_set_scene(C, sce);
+		if (scene != sce) {
+			ED_screen_set_scene(C, CTX_wm_screen(C), sce);
 		}
 		
 		str= "Select Objects";
 		WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
 	}
-	else if(event==2) {
+	else if (event==2) {
 		outliner_do_object_operation(C, scene, soops, &soops->tree, object_deselect_cb);
 		str= "Deselect Objects";
 		WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
 	}
-	else if(event==4) {
+	else if (event==4) {
 		outliner_do_object_operation(C, scene, soops, &soops->tree, object_delete_cb);
 
 		/* XXX: tree management normally happens from draw_outliner(), but when
-		        you're clicking to fast on Delete object from context menu in
-		        outliner several mouse events can be handled in one cycle without
-		        handling notifiers/redraw which leads to deleting the same object twice.
-		        cleanup tree here to prevent such cases. */
+		 *      you're clicking to fast on Delete object from context menu in
+		 *      outliner several mouse events can be handled in one cycle without
+		 *      handling notifiers/redraw which leads to deleting the same object twice.
+		 *      cleanup tree here to prevent such cases. */
 		outliner_cleanup_tree(soops);
 
 		DAG_scene_sort(bmain, scene);
 		str= "Delete Objects";
 		WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
 	}
-	else if(event==5) {	/* disabled, see above enum (ton) */
+	else if (event==5) {	/* disabled, see above enum (ton) */
 		outliner_do_object_operation(C, scene, soops, &soops->tree, id_local_cb);
 		str= "Localized Objects";
 	}
-	else if(event==6) {
+	else if (event==6) {
 		outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_visibility_cb);
 		str= "Toggle Visibility";
 		WM_event_add_notifier(C, NC_SCENE|ND_OB_VISIBLE, scene);
 	}
-	else if(event==7) {
+	else if (event==7) {
 		outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_selectability_cb);
 		str= "Toggle Selectability";
 		WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
 	}
-	else if(event==8) {
+	else if (event==8) {
 		outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_renderability_cb);
 		str= "Toggle Renderability";
 		WM_event_add_notifier(C, NC_SCENE|ND_OB_RENDER, scene);
 	}
-	else if(event==9) {
+	else if (event==9) {
 		outliner_do_object_operation(C, scene, soops, &soops->tree, item_rename_cb);
 		str= "Rename Object";
 	}
@@ -619,18 +590,18 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
 void OUTLINER_OT_object_operation(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Outliner Object Operation";
-	ot->idname= "OUTLINER_OT_object_operation";
-	ot->description= "";
+	ot->name = "Outliner Object Operation";
+	ot->idname = "OUTLINER_OT_object_operation";
+	ot->description = "";
 	
 	/* callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= outliner_object_operation_exec;
-	ot->poll= ED_operator_outliner_active;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = outliner_object_operation_exec;
+	ot->poll = ED_operator_outliner_active;
 	
-	ot->flag= 0;
+	ot->flag = 0;
 
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_object_op_types, 0, "Object Operation", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_object_op_types, 0, "Object Operation", "");
 }
 
 /* **************************************** */
@@ -659,31 +630,31 @@ static int outliner_group_operation_exec(bContext *C, wmOperator *op)
 	
 	event= RNA_enum_get(op->ptr, "type");
 	
-	if(event==1) {
+	if (event==1) {
 		outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_group_cb);
 		str= "Unlink group";
 	}
-	else if(event==2) {
+	else if (event==2) {
 		outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_local_cb);
 		str= "Localized Data";
 	}
-	else if(event==3) {
+	else if (event==3) {
 		outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_linkobs2scene_cb);
 		str= "Link Group Objects to Scene";
 	}
-	else if(event==4) {
+	else if (event==4) {
 		outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_visibility_cb);
 		str= "Toggle Visibility";
 	}
-	else if(event==5) {
+	else if (event==5) {
 		outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_selectability_cb);
 		str= "Toggle Selectability";
 	}
-	else if(event==6) {
+	else if (event==6) {
 		outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_renderability_cb);
 		str= "Toggle Renderability";
 	}
-	else if(event==7) {
+	else if (event==7) {
 		outliner_do_libdata_operation(C, scene, soops, &soops->tree, item_rename_cb);
 		str= "Rename";
 	}
@@ -699,18 +670,18 @@ static int outliner_group_operation_exec(bContext *C, wmOperator *op)
 void OUTLINER_OT_group_operation(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Outliner Group Operation";
-	ot->idname= "OUTLINER_OT_group_operation";
-	ot->description= "";
+	ot->name = "Outliner Group Operation";
+	ot->idname = "OUTLINER_OT_group_operation";
+	ot->description = "";
 	
 	/* callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= outliner_group_operation_exec;
-	ot->poll= ED_operator_outliner_active;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = outliner_group_operation_exec;
+	ot->poll = ED_operator_outliner_active;
 	
-	ot->flag= 0;
+	ot->flag = 0;
 	
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_group_op_types, 0, "Group Operation", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_group_op_types, 0, "Group Operation", "");
 }
 
 /* **************************************** */
@@ -869,18 +840,18 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
 void OUTLINER_OT_id_operation(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Outliner ID data Operation";
-	ot->idname= "OUTLINER_OT_id_operation";
-	ot->description= "";
+	ot->name = "Outliner ID data Operation";
+	ot->idname = "OUTLINER_OT_id_operation";
+	ot->description = "";
 	
 	/* callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= outliner_id_operation_exec;
-	ot->poll= ED_operator_outliner_active;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = outliner_id_operation_exec;
+	ot->poll = ED_operator_outliner_active;
 	
-	ot->flag= 0;
+	ot->flag = 0;
 	
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_id_op_types, 0, "ID data Operation", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_id_op_types, 0, "ID data Operation", "");
 }
 
 /* **************************************** */
@@ -894,7 +865,7 @@ static void outliner_do_id_set_operation(SpaceOops *soops, int type, ListBase *l
 	for (te=lb->first; te; te= te->next) {
 		tselem= TREESTORE(te);
 		if (tselem->flag & TSE_SELECTED) {
-			if(tselem->type==type) {
+			if (tselem->type==type) {
 				TreeStoreElem *tsep = TREESTORE(te->parent);
 				operation_cb(te, tselem, tsep, newid);
 			}
@@ -972,23 +943,23 @@ void OUTLINER_OT_action_set(wmOperatorType *ot)
 	PropertyRNA *prop;
 
 	/* identifiers */
-	ot->name= "Outliner Set Action";
-	ot->idname= "OUTLINER_OT_action_set";
-	ot->description= "Change the active action used";
+	ot->name = "Outliner Set Action";
+	ot->idname = "OUTLINER_OT_action_set";
+	ot->description = "Change the active action used";
 	
 	/* api callbacks */
-	ot->invoke= WM_enum_search_invoke;
-	ot->exec= outliner_action_set_exec;
-	ot->poll= ED_operator_outliner_active;
+	ot->invoke = WM_enum_search_invoke;
+	ot->exec = outliner_action_set_exec;
+	ot->poll = ED_operator_outliner_active;
 	
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 	
 	/* props */
 		// TODO: this would be nicer as an ID-pointer...
 	prop= RNA_def_enum(ot->srna, "action", DummyRNA_NULL_items, 0, "Action", "");
 	RNA_def_enum_funcs(prop, RNA_action_itemf);
-	ot->prop= prop;
+	ot->prop = prop;
 }
 
 /* **************************************** */
@@ -1087,18 +1058,18 @@ static int outliner_animdata_operation_exec(bContext *C, wmOperator *op)
 void OUTLINER_OT_animdata_operation(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Outliner Animation Data Operation";
-	ot->idname= "OUTLINER_OT_animdata_operation";
-	ot->description= "";
+	ot->name = "Outliner Animation Data Operation";
+	ot->idname = "OUTLINER_OT_animdata_operation";
+	ot->description = "";
 	
 	/* callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= outliner_animdata_operation_exec;
-	ot->poll= ED_operator_outliner_active;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = outliner_animdata_operation_exec;
+	ot->poll = ED_operator_outliner_active;
 	
-	ot->flag= 0;
+	ot->flag = 0;
 	
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_animdata_op_types, 0, "Animation Operation", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_animdata_op_types, 0, "Animation Operation", "");
 }
 
 /* **************************************** */
@@ -1124,29 +1095,29 @@ static int outliner_data_operation_exec(bContext *C, wmOperator *op)
 	event= RNA_enum_get(op->ptr, "type");
 	set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
 	
-	if(datalevel==TSE_POSE_CHANNEL) {
-		if(event>0) {
+	if (datalevel==TSE_POSE_CHANNEL) {
+		if (event>0) {
 			outliner_do_data_operation(soops, datalevel, event, &soops->tree, pchan_cb);
 			WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
 			ED_undo_push(C, "PoseChannel operation");
 		}
 	}
-	else if(datalevel==TSE_BONE) {
-		if(event>0) {
+	else if (datalevel==TSE_BONE) {
+		if (event>0) {
 			outliner_do_data_operation(soops, datalevel, event, &soops->tree, bone_cb);
 			WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
 			ED_undo_push(C, "Bone operation");
 		}
 	}
-	else if(datalevel==TSE_EBONE) {
-		if(event>0) {
+	else if (datalevel==TSE_EBONE) {
+		if (event>0) {
 			outliner_do_data_operation(soops, datalevel, event, &soops->tree, ebone_cb);
 			WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
 			ED_undo_push(C, "EditBone operation");
 		}
 	}
-	else if(datalevel==TSE_SEQUENCE) {
-		if(event>0) {
+	else if (datalevel==TSE_SEQUENCE) {
+		if (event>0) {
 			outliner_do_data_operation(soops, datalevel, event, &soops->tree, sequence_cb);
 		}
 	}
@@ -1158,18 +1129,18 @@ static int outliner_data_operation_exec(bContext *C, wmOperator *op)
 void OUTLINER_OT_data_operation(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Outliner Data Operation";
-	ot->idname= "OUTLINER_OT_data_operation";
-	ot->description= "";
+	ot->name = "Outliner Data Operation";
+	ot->idname = "OUTLINER_OT_data_operation";
+	ot->description = "";
 	
 	/* callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= outliner_data_operation_exec;
-	ot->poll= ED_operator_outliner_active;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = outliner_data_operation_exec;
+	ot->poll = ED_operator_outliner_active;
 	
-	ot->flag= 0;
+	ot->flag = 0;
 	
-	ot->prop= RNA_def_enum(ot->srna, "type", prop_data_op_types, 0, "Data Operation", "");
+	ot->prop = RNA_def_enum(ot->srna, "type", prop_data_op_types, 0, "Data Operation", "");
 }
 
 
@@ -1180,7 +1151,7 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S
 {
 	ReportList *reports = CTX_wm_reports(C); // XXX...
 	
-	if(mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) {
+	if (mval[1]>te->ys && mval[1]<te->ys+UI_UNIT_Y) {
 		int scenelevel=0, objectlevel=0, idlevel=0, datalevel=0;
 		TreeStoreElem *tselem= TREESTORE(te);
 		
@@ -1198,15 +1169,15 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S
 		
 		set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
 		
-		if(scenelevel) {
-			//if(objectlevel || datalevel || idlevel) error("Mixed selection");
+		if (scenelevel) {
+			//if (objectlevel || datalevel || idlevel) error("Mixed selection");
 			//else pupmenu("Scene Operations%t|Delete");
 		}
-		else if(objectlevel) {
+		else if (objectlevel) {
 			WM_operator_name_call(C, "OUTLINER_OT_object_operation", WM_OP_INVOKE_REGION_WIN, NULL);
 		}
-		else if(idlevel) {
-			if(idlevel==-1 || datalevel) BKE_report(reports, RPT_WARNING, "Mixed selection");
+		else if (idlevel) {
+			if (idlevel==-1 || datalevel) BKE_report(reports, RPT_WARNING, "Mixed selection");
 			else {
 				if (idlevel==ID_GR)
 					WM_operator_name_call(C, "OUTLINER_OT_group_operation", WM_OP_INVOKE_REGION_WIN, NULL);
@@ -1214,14 +1185,14 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S
 					WM_operator_name_call(C, "OUTLINER_OT_id_operation", WM_OP_INVOKE_REGION_WIN, NULL);
 			}
 		}
-		else if(datalevel) {
-			if(datalevel==-1) BKE_report(reports, RPT_WARNING, "Mixed selection");
+		else if (datalevel) {
+			if (datalevel==-1) BKE_report(reports, RPT_WARNING, "Mixed selection");
 			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)
+				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);
@@ -1231,8 +1202,8 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S
 		return 1;
 	}
 	
-	for(te= te->subtree.first; te; te= te->next) {
-		if(do_outliner_operation_event(C, scene, ar, soops, te, event, mval)) 
+	for (te= te->subtree.first; te; te= te->next) {
+		if (do_outliner_operation_event(C, scene, ar, soops, te, event, mval))
 			return 1;
 	}
 	return 0;
@@ -1249,8 +1220,8 @@ static int outliner_operation(bContext *C, wmOperator *UNUSED(op), wmEvent *even
 	
 	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;
+	for (te= soops->tree.first; te; te= te->next) {
+		if (do_outliner_operation_event(C, scene, ar, soops, te, event, fmval)) break;
 	}
 	
 	return OPERATOR_FINISHED;
@@ -1259,13 +1230,13 @@ static int outliner_operation(bContext *C, wmOperator *UNUSED(op), wmEvent *even
 /* Menu only! Calls other operators */
 void OUTLINER_OT_operation(wmOperatorType *ot)
 {
-	ot->name= "Execute Operation";
-	ot->idname= "OUTLINER_OT_operation";
-	ot->description= "Context menu for item operations";
+	ot->name = "Execute Operation";
+	ot->idname = "OUTLINER_OT_operation";
+	ot->description = "Context menu for item operations";
 	
-	ot->invoke= outliner_operation;
+	ot->invoke = outliner_operation;
 	
-	ot->poll= ED_operator_outliner_active;
+	ot->poll = ED_operator_outliner_active;
 }
 
 /* ****************************************************** */
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 33e0136..e2d4338 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -31,8 +31,15 @@
  
 #include <math.h>
 #include <string.h>
-#include <stdlib.h>
-#include <stddef.h>
+
+#if defined WIN32 && !defined _LIBC  || defined __sun
+# include "BLI_fnmatch.h" /* use fnmatch included in blenlib */
+#else
+#  ifndef _GNU_SOURCE
+#    define _GNU_SOURCE
+#  endif
+# include <fnmatch.h>
+#endif
 
 #include "MEM_guardedalloc.h"
 
@@ -55,51 +62,20 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
-#include "BLI_math_base.h"
+#include "BLI_math.h"
 
-#if defined WIN32 && !defined _LIBC  || defined __sun
-# include "BLI_fnmatch.h" /* use fnmatch included in blenlib */
-#else
-#  ifndef _GNU_SOURCE
-#    define _GNU_SOURCE
-#  endif
-# include <fnmatch.h>
-#endif
-
-
-#include "BKE_animsys.h"
-#include "BKE_context.h"
-#include "BKE_deform.h"
-#include "BKE_depsgraph.h"
 #include "BKE_fcurve.h"
-#include "BKE_global.h"
-#include "BKE_group.h"
-#include "BKE_library.h"
 #include "BKE_main.h"
 #include "BKE_modifier.h"
-#include "BKE_report.h"
-#include "BKE_scene.h"
 #include "BKE_sequencer.h"
 
 #include "ED_armature.h"
-#include "ED_object.h"
 #include "ED_screen.h"
-#include "ED_util.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
 
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-
-#include "UI_interface.h"
-#include "UI_interface_icons.h"
-#include "UI_resources.h"
-#include "UI_view2d.h"
-
 #include "RNA_access.h"
-#include "RNA_define.h"
-#include "RNA_enum_types.h"
 
 #include "outliner_intern.h"
 
@@ -115,23 +91,23 @@ static void outliner_storage_cleanup(SpaceOops *soops)
 {
 	TreeStore *ts= soops->treestore;
 	
-	if(ts) {
+	if (ts) {
 		TreeStoreElem *tselem;
 		int a, unused= 0;
 		
 		/* each element used once, for ID blocks with more users to have each a treestore */
-		for(a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) tselem->used= 0;
+		for (a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) tselem->used= 0;
 		
 		/* cleanup only after reading file or undo step, and always for
 		 * RNA datablocks view in order to save memory */
-		if(soops->storeflag & SO_TREESTORE_CLEANUP) {
+		if (soops->storeflag & SO_TREESTORE_CLEANUP) {
 			
-			for(a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) {
-				if(tselem->id==NULL) unused++;
+			for (a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) {
+				if (tselem->id==NULL) unused++;
 			}
 			
-			if(unused) {
-				if(ts->usedelem == unused) {
+			if (unused) {
+				if (ts->usedelem == unused) {
 					MEM_freeN(ts->data);
 					ts->data= NULL;
 					ts->usedelem= ts->totelem= 0;
@@ -140,8 +116,8 @@ static void outliner_storage_cleanup(SpaceOops *soops)
 					TreeStoreElem *tsnewar, *tsnew;
 					
 					tsnew=tsnewar= MEM_mallocN((ts->usedelem-unused)*sizeof(TreeStoreElem), "new tselem");
-					for(a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) {
-						if(tselem->id) {
+					for (a=0, tselem= ts->data; a<ts->usedelem; a++, tselem++) {
+						if (tselem->id) {
 							*tsnew= *tselem;
 							tsnew++;
 						}
@@ -163,16 +139,16 @@ static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short ty
 	int a;
 	
 	/* case 1; no TreeStore */
-	if(soops->treestore==NULL) {
+	if (soops->treestore==NULL) {
 		soops->treestore= MEM_callocN(sizeof(TreeStore), "treestore");
 	}
 	ts= soops->treestore;
 	
 	/* check if 'te' is in treestore */
 	tselem= ts->data;
-	for(a=0; a<ts->usedelem; a++, tselem++) {
-		if(tselem->id==id && tselem->used==0) {
-			if((type==0 && tselem->type==0) ||(tselem->type==type && tselem->nr==nr)) {
+	for (a=0; a<ts->usedelem; a++, tselem++) {
+		if (tselem->id==id && tselem->used==0) {
+			if ((type==0 && tselem->type==0) ||(tselem->type==type && tselem->nr==nr)) {
 				te->store_index= a;
 				tselem->used= 1;
 				return;
@@ -181,11 +157,11 @@ static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short ty
 	}
 	
 	/* add 1 element to treestore */
-	if(ts->usedelem==ts->totelem) {
+	if (ts->usedelem==ts->totelem) {
 		TreeStoreElem *tsnew;
 		
 		tsnew= MEM_mallocN((ts->totelem+TS_CHUNK)*sizeof(TreeStoreElem), "treestore data");
-		if(ts->data) {
+		if (ts->data) {
 			memcpy(tsnew, ts->data, ts->totelem*sizeof(TreeStoreElem));
 			MEM_freeN(ts->data);
 		}
@@ -196,7 +172,7 @@ static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short ty
 	tselem= ts->data+ts->usedelem;
 	
 	tselem->type= type;
-	if(type) tselem->nr= nr; // we're picky! :)
+	if (type) tselem->nr= nr; // we're picky! :)
 	else tselem->nr= 0;
 	tselem->id= id;
 	tselem->used = 0;
@@ -211,13 +187,13 @@ static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short ty
 
 void outliner_free_tree(ListBase *lb)
 {
-	while(lb->first) {
+	while (lb->first) {
 		TreeElement *te= lb->first;
 		
 		outliner_free_tree(&te->subtree);
 		BLI_remlink(lb, te);
 		
-		if(te->flag & TE_FREE_NAME) MEM_freeN((void *)te->name);
+		if (te->flag & TE_FREE_NAME) MEM_freeN((void *)te->name);
 		MEM_freeN(te);
 	}
 }
@@ -232,10 +208,10 @@ void outliner_cleanup_tree(SpaceOops *soops)
 static TreeElement *outliner_find_tree_element(ListBase *lb, int store_index)
 {
 	TreeElement *te= lb->first, *tes;
-	while(te) {
-		if(te->store_index==store_index) return te;
+	while (te) {
+		if (te->store_index==store_index) return te;
 		tes= outliner_find_tree_element(&te->subtree, store_index);
-		if(tes) return tes;
+		if (tes) return tes;
 		te= te->next;
 	}
 	return NULL;
@@ -248,18 +224,18 @@ TreeElement *outliner_find_tse(SpaceOops *soops, TreeStoreElem *tse)
 	TreeStoreElem *tselem;
 	int a;
 	
-	if(tse->id==NULL) return NULL;
+	if (tse->id==NULL) return NULL;
 	
 	/* check if 'tse' is in treestore */
 	tselem= ts->data;
-	for(a=0; a<ts->usedelem; a++, tselem++) {
-		if((tse->type==0 && tselem->type==0) || (tselem->type==tse->type && tselem->nr==tse->nr)) {
-			if(tselem->id==tse->id) {
+	for (a=0; a<ts->usedelem; a++, tselem++) {
+		if ((tse->type==0 && tselem->type==0) || (tselem->type==tse->type && tselem->nr==tse->nr)) {
+			if (tselem->id==tse->id) {
 				break;
 			}
 		}
 	}
-	if(tselem) 
+	if (tselem) 
 		return outliner_find_tree_element(&soops->tree, a);
 	
 	return NULL;
@@ -271,14 +247,14 @@ TreeElement *outliner_find_id(SpaceOops *soops, ListBase *lb, ID *id)
 	TreeElement *te, *tes;
 	TreeStoreElem *tselem;
 	
-	for(te= lb->first; te; te= te->next) {
+	for (te= lb->first; te; te= te->next) {
 		tselem= TREESTORE(te);
-		if(tselem->type==0) {
-			if(tselem->id==id) return te;
+		if (tselem->type==0) {
+			if (tselem->id==id) return te;
 			/* only deeper on scene or object */
-			if( te->idcode==ID_OB || te->idcode==ID_SCE || (soops->outlinevis == SO_GROUPS && te->idcode==ID_GR)) {
+			if ( te->idcode==ID_OB || te->idcode==ID_SCE || (soops->outlinevis == SO_GROUPS && te->idcode==ID_GR)) {
 				tes= outliner_find_id(soops, &te->subtree, id);
-				if(tes) return tes;
+				if (tes) return tes;
 			}
 		}
 	}
@@ -291,9 +267,9 @@ ID *outliner_search_back(SpaceOops *soops, TreeElement *te, short idcode)
 	TreeStoreElem *tselem;
 	te= te->parent;
 	
-	while(te) {
+	while (te) {
 		tselem= TREESTORE(te);
-		if(tselem->type==0 && te->idcode==idcode) return tselem->id;
+		if (tselem->type==0 && te->idcode==idcode) return tselem->id;
 		te= te->parent;
 	}
 	return NULL;
@@ -318,7 +294,7 @@ static void outliner_add_bone(SpaceOops *soops, ListBase *lb, ID *id, Bone *curB
 	te->name= curBone->name;
 	te->directdata= curBone;
 	
-	for(curBone= curBone->childbase.first; curBone; curBone=curBone->next) {
+	for (curBone= curBone->childbase.first; curBone; curBone=curBone->next) {
 		outliner_add_bone(soops, &te->subtree, id, curBone, te, a);
 	}
 }
@@ -341,7 +317,7 @@ static void outliner_add_passes(SpaceOops *soops, TreeElement *tenla, ID *id, Sc
 	
 	/* save cpu cycles, but we add the first to invoke an open/close triangle */
 	tselem = TREESTORE(tenla);
-	if(tselem->flag & TSE_CLOSED)
+	if (tselem->flag & TSE_CLOSED)
 		return;
 	
 	te= outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_Z));
@@ -422,14 +398,14 @@ static void outliner_add_scene_contents(SpaceOops *soops, ListBase *lb, Scene *s
 	int a;
 	
 	tenla->name= "RenderLayers";
-	for(a=0, srl= sce->r.layers.first; srl; srl= srl->next, a++) {
+	for (a=0, srl= sce->r.layers.first; srl; srl= srl->next, a++) {
 		TreeElement *tenlay= outliner_add_element(soops, &tenla->subtree, sce, te, TSE_R_LAYER, a);
 		tenlay->name= srl->name;
 		tenlay->directdata= &srl->passflag;
 		
-		if(srl->light_override)
+		if (srl->light_override)
 			outliner_add_element(soops, &tenlay->subtree, srl->light_override, tenlay, TSE_LINKED_LAMP, 0);
-		if(srl->mat_override)
+		if (srl->mat_override)
 			outliner_add_element(soops, &tenlay->subtree, srl->mat_override, tenlay, TSE_LINKED_MAT, 0);
 		
 		outliner_add_passes(soops, tenlay, &sce->id, srl);
@@ -469,13 +445,13 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
 		if ((arm->edbo == NULL) && (ob->mode & OB_MODE_POSE)) {
 			int a= 0, const_index= 1000;	/* ensure unique id for bone constraints */
 			
-			for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next, a++) {
+			for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next, a++) {
 				ten= outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_POSE_CHANNEL, a);
 				ten->name= pchan->name;
 				ten->directdata= pchan;
 				pchan->temp= (void *)ten;
 				
-				if(pchan->constraints.first) {
+				if (pchan->constraints.first) {
 					//Object *target;
 					bConstraint *con;
 					TreeElement *ten1;
@@ -483,12 +459,12 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
 					//char *str;
 					
 					tenla1->name= "Constraints";
-					for(con= pchan->constraints.first; con; con= con->next, const_index++) {
+					for (con= pchan->constraints.first; con; con= con->next, const_index++) {
 						ten1= outliner_add_element(soops, &tenla1->subtree, ob, tenla1, TSE_CONSTRAINT, const_index);
 #if 0 /* disabled as it needs to be reworked for recoded constraints system */
 						target= get_constraint_target(con, &str);
-						if(str && str[0]) ten1->name= str;
-						else if(target) ten1->name= target->id.name+2;
+						if (str && str[0]) ten1->name= str;
+						else if (target) ten1->name= target->id.name+2;
 						else ten1->name= con->name;
 #endif
 						ten1->name= con->name;
@@ -499,12 +475,12 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
 			}
 			/* make hierarchy */
 			ten= tenla->subtree.first;
-			while(ten) {
+			while (ten) {
 				TreeElement *nten= ten->next, *par;
 				tselem= TREESTORE(ten);
-				if(tselem->type==TSE_POSE_CHANNEL) {
+				if (tselem->type==TSE_POSE_CHANNEL) {
 					pchan= (bPoseChannel *)ten->directdata;
-					if(pchan->parent) {
+					if (pchan->parent) {
 						BLI_remlink(&tenla->subtree, ten);
 						par= (TreeElement *)pchan->parent->temp;
 						BLI_addtail(&par->subtree, ten);
@@ -516,7 +492,7 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
 		}
 		
 		/* Pose Groups */
-		if(ob->pose->agroups.first) {
+		if (ob->pose->agroups.first) {
 			bActionGroup *agrp;
 			TreeElement *ten;
 			TreeElement *tenla= outliner_add_element(soops, &te->subtree, ob, te, TSE_POSEGRP_BASE, 0);
@@ -531,10 +507,10 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
 		}
 	}
 	
-	for(a=0; a<ob->totcol; a++) 
+	for (a=0; a<ob->totcol; a++) 
 		outliner_add_element(soops, &te->subtree, ob->mat[a], te, 0, a);
 	
-	if(ob->constraints.first) {
+	if (ob->constraints.first) {
 		//Object *target;
 		bConstraint *con;
 		TreeElement *ten;
@@ -546,8 +522,8 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
 			ten= outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_CONSTRAINT, a);
 #if 0 /* disabled due to constraints system targets recode... code here needs review */
 			target= get_constraint_target(con, &str);
-			if(str && str[0]) ten->name= str;
-			else if(target) ten->name= target->id.name+2;
+			if (str && str[0]) ten->name= str;
+			else if (target) ten->name= target->id.name+2;
 			else ten->name= con->name;
 #endif
 			ten->name= con->name;
@@ -641,10 +617,10 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
 				outliner_add_element(soops, &te->subtree, me, te, TSE_ANIM_DATA, 0);
 			
 			outliner_add_element(soops, &te->subtree, me->key, te, 0, 0);
-			for(a=0; a<me->totcol; a++) 
+			for (a=0; a<me->totcol; a++) 
 				outliner_add_element(soops, &te->subtree, me->mat[a], te, 0, a);
 			/* could do tfaces with image links, but the images are not grouped nicely.
-			   would require going over all tfaces, sort images in use. etc... */
+			 * would require going over all tfaces, sort images in use. etc... */
 		}
 			break;
 		case ID_CU:
@@ -655,7 +631,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
 			if (cu->adt)
 				outliner_add_element(soops, &te->subtree, cu, te, TSE_ANIM_DATA, 0);
 			
-			for(a=0; a<cu->totcol; a++) 
+			for (a=0; a<cu->totcol; a++) 
 				outliner_add_element(soops, &te->subtree, cu->mat[a], te, 0, a);
 		}
 			break;
@@ -667,7 +643,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
 			if (mb->adt)
 				outliner_add_element(soops, &te->subtree, mb, te, TSE_ANIM_DATA, 0);
 			
-			for(a=0; a<mb->totcol; a++) 
+			for (a=0; a<mb->totcol; a++) 
 				outliner_add_element(soops, &te->subtree, mb->mat[a], te, 0, a);
 		}
 			break;
@@ -679,8 +655,8 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
 			if (ma->adt)
 				outliner_add_element(soops, &te->subtree, ma, te, TSE_ANIM_DATA, 0);
 			
-			for(a=0; a<MAX_MTEX; a++) {
-				if(ma->mtex[a]) outliner_add_element(soops, &te->subtree, ma->mtex[a]->tex, te, 0, a);
+			for (a=0; a<MAX_MTEX; a++) {
+				if (ma->mtex[a]) outliner_add_element(soops, &te->subtree, ma->mtex[a]->tex, te, 0, a);
 			}
 		}
 			break;
@@ -710,8 +686,8 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
 			if (la->adt)
 				outliner_add_element(soops, &te->subtree, la, te, TSE_ANIM_DATA, 0);
 			
-			for(a=0; a<MAX_MTEX; a++) {
-				if(la->mtex[a]) outliner_add_element(soops, &te->subtree, la->mtex[a]->tex, te, 0, a);
+			for (a=0; a<MAX_MTEX; a++) {
+				if (la->mtex[a]) outliner_add_element(soops, &te->subtree, la->mtex[a]->tex, te, 0, a);
 			}
 		}
 			break;
@@ -719,7 +695,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
 			{
 				Speaker *spk= (Speaker *)id;
 
-				if(spk->adt)
+				if (spk->adt)
 					outliner_add_element(soops, &te->subtree, spk, te, TSE_ANIM_DATA, 0);
 			}
 			break;
@@ -731,8 +707,8 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
 			if (wrld->adt)
 				outliner_add_element(soops, &te->subtree, wrld, te, TSE_ANIM_DATA, 0);
 			
-			for(a=0; a<MAX_MTEX; a++) {
-				if(wrld->mtex[a]) outliner_add_element(soops, &te->subtree, wrld->mtex[a]->tex, te, 0, a);
+			for (a=0; a<MAX_MTEX; a++) {
+				if (wrld->mtex[a]) outliner_add_element(soops, &te->subtree, wrld->mtex[a]->tex, te, 0, a);
 			}
 		}
 			break;
@@ -758,7 +734,7 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
 			if (arm->adt)
 				outliner_add_element(soops, &te->subtree, arm, te, TSE_ANIM_DATA, 0);
 			
-			if(arm->edbo) {
+			if (arm->edbo) {
 				EditBone *ebone;
 				TreeElement *ten;
 				
@@ -770,10 +746,10 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
 				}
 				/* make hierarchy */
 				ten= arm->edbo->first ? ((EditBone *)arm->edbo->first)->temp : NULL;
-				while(ten) {
+				while (ten) {
 					TreeElement *nten= ten->next, *par;
 					ebone= (EditBone *)ten->directdata;
-					if(ebone->parent) {
+					if (ebone->parent) {
 						BLI_remlink(&te->subtree, ten);
 						par= ebone->parent->temp;
 						BLI_addtail(&par->subtree, ten);
@@ -785,10 +761,10 @@ static void outliner_add_id_contents(SpaceOops *soops, TreeElement *te, TreeStor
 			else {
 				/* do not extend Armature when we have posemode */
 				tselem= TREESTORE(te->parent);
-				if( GS(tselem->id->name)==ID_OB && ((Object *)tselem->id)->mode & OB_MODE_POSE);
+				if ( GS(tselem->id->name)==ID_OB && ((Object *)tselem->id)->mode & OB_MODE_POSE);
 				else {
 					Bone *curBone;
-					for (curBone=arm->bonebase.first; curBone; curBone=curBone->next){
+					for (curBone=arm->bonebase.first; curBone; curBone=curBone->next) {
 						outliner_add_bone(soops, &te->subtree, id, curBone, te, &a);
 					}
 				}
@@ -807,12 +783,12 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
 	ID *id= idv;
 	int a = 0;
 	
-	if(ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
+	if (ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
 		id= ((PointerRNA*)idv)->id.data;
-		if(!id) id= ((PointerRNA*)idv)->data;
+		if (!id) id= ((PointerRNA*)idv)->data;
 	}
 
-	if(id==NULL) return NULL;
+	if (id==NULL) return NULL;
 
 	te= MEM_callocN(sizeof(TreeElement), "tree elem");
 	/* add to the visual tree */
@@ -822,24 +798,24 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
 	tselem= TREESTORE(te);	
 	
 	/* if we are searching for something expand to see child elements */
-	if(SEARCHING_OUTLINER(soops))
+	if (SEARCHING_OUTLINER(soops))
 		tselem->flag |= TSE_CHILDSEARCH;
 	
 	te->parent= parent;
 	te->index= index;	// for data arays
-	if(ELEM3(type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP));
-	else if(ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM));
-	else if(type==TSE_ANIM_DATA);
+	if (ELEM3(type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP));
+	else if (ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM));
+	else if (type==TSE_ANIM_DATA);
 	else {
 		te->name= id->name+2; // default, can be overridden by Library or non-ID data
 		te->idcode= GS(id->name);
 	}
 	
-	if(type==0) {
+	if (type==0) {
 		/* ID datablock */
 		outliner_add_id_contents(soops, te, tselem, id);
 	}
-	else if(type==TSE_ANIM_DATA) {
+	else if (type==TSE_ANIM_DATA) {
 		IdAdtTemplate *iat = (IdAdtTemplate *)idv;
 		AnimData *adt= (AnimData *)iat->adt;
 		
@@ -859,7 +835,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
 			ted->name= "Drivers";
 		
 			for (fcu= adt->drivers.first; fcu; fcu= fcu->next) {
-				if (fcu->driver && fcu->driver->variables.first)  {
+				if (fcu->driver && fcu->driver->variables.first) {
 					ChannelDriver *driver= fcu->driver;
 					DriverVar *dvar;
 					
@@ -897,12 +873,12 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
 				
 				for (strip=nlt->strips.first; strip; strip=strip->next, b++) {
 					ten= outliner_add_element(soops, &tenlt->subtree, strip->act, tenlt, TSE_NLA_ACTION, b);
-					if(ten) ten->directdata= strip;
+					if (ten) ten->directdata= strip;
 				}
 			}
 		}
 	}
-	else if(type==TSE_SEQUENCE) {
+	else if (type==TSE_SEQUENCE) {
 		Sequence *seq= (Sequence*) idv;
 		Sequence *p;
 
@@ -914,25 +890,25 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
 		te->idcode= seq->type;
 		te->directdata= seq;
 
-		if(seq->type<7) {
+		if (seq->type<7) {
 			/*
 			 * This work like the sequence.
 			 * If the sequence have a name (not default name)
 			 * show it, in other case put the filename.
 			 */
-			if(strcmp(seq->name, "SQ"))
+			if (strcmp(seq->name, "SQ"))
 				te->name= seq->name;
 			else {
-				if((seq->strip) && (seq->strip->stripdata))
+				if ((seq->strip) && (seq->strip->stripdata))
 					te->name= seq->strip->stripdata->name;
 				else
 					te->name= "SQ None";
 			}
 
-			if(seq->type==SEQ_META) {
+			if (seq->type==SEQ_META) {
 				te->name= "Meta Strip";
 				p= seq->seqbase.first;
-				while(p) {
+				while (p) {
 					outliner_add_element(soops, &te->subtree, (void*)p, te, TSE_SEQUENCE, index);
 					p= p->next;
 				}
@@ -943,23 +919,23 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
 		else
 			te->name= "Effect";
 	}
-	else if(type==TSE_SEQ_STRIP) {
+	else if (type==TSE_SEQ_STRIP) {
 		Strip *strip= (Strip *)idv;
 
-		if(strip->dir)
+		if (strip->dir)
 			te->name= strip->dir;
 		else
 			te->name= "Strip None";
 		te->directdata= strip;
 	}
-	else if(type==TSE_SEQUENCE_DUP) {
+	else if (type==TSE_SEQUENCE_DUP) {
 		Sequence *seq= (Sequence*)idv;
 
 		te->idcode= seq->type;
 		te->directdata= seq;
 		te->name= seq->strip->stripdata->name;
 	}
-	else if(ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
+	else if (ELEM3(type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) {
 		PointerRNA pptr, propptr, *ptr= (PointerRNA*)idv;
 		PropertyRNA *prop, *iterprop;
 		PropertyType proptype;
@@ -967,39 +943,39 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
 
 		/* we do lazy build, for speed and to avoid infinite recusion */
 
-		if(ptr->data == NULL) {
+		if (ptr->data == NULL) {
 			te->name= "(empty)";
 		}
-		else if(type == TSE_RNA_STRUCT) {
+		else if (type == TSE_RNA_STRUCT) {
 			/* struct */
 			te->name= RNA_struct_name_get_alloc(ptr, NULL, 0, NULL);
 
-			if(te->name)
+			if (te->name)
 				te->flag |= TE_FREE_NAME;
 			else
 				te->name= RNA_struct_ui_name(ptr->type);
 
 			/* If searching don't expand RNA entries */
-			if(SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA",te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH;
+			if (SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA",te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH;
 
 			iterprop= RNA_struct_iterator_property(ptr->type);
 			tot= RNA_property_collection_length(ptr, iterprop);
 
 			/* auto open these cases */
-			if(!parent || (RNA_property_type(parent->directdata)) == PROP_POINTER)
-				if(!tselem->used)
+			if (!parent || (RNA_property_type(parent->directdata)) == PROP_POINTER)
+				if (!tselem->used)
 					tselem->flag &= ~TSE_CLOSED;
 
-			if(TSELEM_OPEN(tselem,soops)) {
-				for(a=0; a<tot; a++)
+			if (TSELEM_OPEN(tselem,soops)) {
+				for (a=0; a<tot; a++)
 					outliner_add_element(soops, &te->subtree, (void*)ptr, te, TSE_RNA_PROPERTY, a);
 			}
-			else if(tot)
+			else if (tot)
 				te->flag |= TE_LAZY_CLOSED;
 
 			te->rnaptr= *ptr;
 		}
-		else if(type == TSE_RNA_PROPERTY) {
+		else if (type == TSE_RNA_PROPERTY) {
 			/* property */
 			iterprop= RNA_struct_iterator_property(ptr->type);
 			RNA_property_collection_lookup_int(ptr, iterprop, index, &propptr);
@@ -1012,42 +988,42 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
 			te->rnaptr= *ptr;
 
 			/* If searching don't expand RNA entries */
-			if(SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA",te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH;
+			if (SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA",te->name)==0) tselem->flag &= ~TSE_CHILDSEARCH;
 
-			if(proptype == PROP_POINTER) {
+			if (proptype == PROP_POINTER) {
 				pptr= RNA_property_pointer_get(ptr, prop);
 
-				if(pptr.data) {
-					if(TSELEM_OPEN(tselem,soops))
+				if (pptr.data) {
+					if (TSELEM_OPEN(tselem,soops))
 						outliner_add_element(soops, &te->subtree, (void*)&pptr, te, TSE_RNA_STRUCT, -1);
 					else
 						te->flag |= TE_LAZY_CLOSED;
 				}
 			}
-			else if(proptype == PROP_COLLECTION) {
+			else if (proptype == PROP_COLLECTION) {
 				tot= RNA_property_collection_length(ptr, prop);
 
-				if(TSELEM_OPEN(tselem,soops)) {
-					for(a=0; a<tot; a++) {
+				if (TSELEM_OPEN(tselem,soops)) {
+					for (a=0; a<tot; a++) {
 						RNA_property_collection_lookup_int(ptr, prop, a, &pptr);
 						outliner_add_element(soops, &te->subtree, (void*)&pptr, te, TSE_RNA_STRUCT, a);
 					}
 				}
-				else if(tot)
+				else if (tot)
 					te->flag |= TE_LAZY_CLOSED;
 			}
-			else if(ELEM3(proptype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) {
+			else if (ELEM3(proptype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) {
 				tot= RNA_property_array_length(ptr, prop);
 
-				if(TSELEM_OPEN(tselem,soops)) {
-					for(a=0; a<tot; a++)
+				if (TSELEM_OPEN(tselem,soops)) {
+					for (a=0; a<tot; a++)
 						outliner_add_element(soops, &te->subtree, (void*)ptr, te, TSE_RNA_ARRAY_ELEM, a);
 				}
-				else if(tot)
+				else if (tot)
 					te->flag |= TE_LAZY_CLOSED;
 			}
 		}
-		else if(type == TSE_RNA_ARRAY_ELEM) {
+		else if (type == TSE_RNA_ARRAY_ELEM) {
 			char c;
 
 			prop= parent->directdata;
@@ -1059,12 +1035,12 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
 			c= RNA_property_array_item_char(prop, index);
 
 			te->name= MEM_callocN(sizeof(char)*20, "OutlinerRNAArrayName");
-			if(c) sprintf((char *)te->name, "  %c", c);
+			if (c) sprintf((char *)te->name, "  %c", c);
 			else sprintf((char *)te->name, "  %d", index+1);
 			te->flag |= TE_FREE_NAME;
 		}
 	}
-	else if(type == TSE_KEYMAP) {
+	else if (type == TSE_KEYMAP) {
 		wmKeyMap *km= (wmKeyMap *)idv;
 		wmKeyMapItem *kmi;
 		char opname[OP_MAX_TYPENAME];
@@ -1072,24 +1048,24 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
 		te->directdata= idv;
 		te->name= km->idname;
 		
-		if(TSELEM_OPEN(tselem,soops)) {
+		if (TSELEM_OPEN(tselem,soops)) {
 			a= 0;
 			
-			for (kmi= km->items.first; kmi; kmi= kmi->next, a++) {
+			for (kmi = km->items.first; kmi; kmi = kmi->next, a++) {
 				const char *key= WM_key_event_string(kmi->type);
 				
-				if(key[0]) {
+				if (key[0]) {
 					wmOperatorType *ot= NULL;
 					
-					if(kmi->propvalue);
+					if (kmi->propvalue);
 					else ot= WM_operatortype_find(kmi->idname, 0);
 					
-					if(ot || kmi->propvalue) {
+					if (ot || kmi->propvalue) {
 						TreeElement *ten= outliner_add_element(soops, &te->subtree, kmi, te, TSE_KEYMAP_ITEM, a);
 						
 						ten->directdata= kmi;
 						
-						if(kmi->propvalue) {
+						if (kmi->propvalue) {
 							ten->name= "Modal map, not yet";
 						}
 						else {
@@ -1116,7 +1092,7 @@ static int need_add_seq_dup(Sequence *seq)
 {
 	Sequence *p;
 
-	if((!seq->strip) || (!seq->strip->stripdata) || (!seq->strip->stripdata->name))
+	if ((!seq->strip) || (!seq->strip->stripdata) || (!seq->strip->stripdata->name))
 		return(1);
 
 	/*
@@ -1124,25 +1100,25 @@ static int need_add_seq_dup(Sequence *seq)
 	 * sequence before this, don't need it, just return.
 	 */
 	p= seq->prev;
-	while(p) {
-		if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
+	while (p) {
+		if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
 			p= p->prev;
 			continue;
 		}
 
-		if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
+		if (!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
 			return(2);
 		p= p->prev;
 	}
 
 	p= seq->next;
-	while(p) {
-		if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
+	while (p) {
+		if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
 			p= p->next;
 			continue;
 		}
 
-		if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
+		if (!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
 			return(0);
 		p= p->next;
 	}
@@ -1155,13 +1131,13 @@ static void outliner_add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *t
 	Sequence *p;
 
 	p= seq;
-	while(p) {
-		if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
+	while (p) {
+		if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
 			p= p->next;
 			continue;
 		}
 
-		if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
+		if (!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
 			/* ch= */ /* UNUSED */ outliner_add_element(soops, &te->subtree, (void*)p, te, TSE_SEQUENCE, index);
 		p= p->next;
 	}
@@ -1181,18 +1157,18 @@ static void outliner_make_hierarchy(SpaceOops *soops, ListBase *lb)
 	/* build hierarchy */
 	// XXX also, set extents here...
 	te= lb->first;
-	while(te) {
+	while (te) {
 		ten= te->next;
 		tselem= TREESTORE(te);
 		
-		if(tselem->type==0 && te->idcode==ID_OB) {
+		if (tselem->type==0 && te->idcode==ID_OB) {
 			Object *ob= (Object *)tselem->id;
-			if(ob->parent && ob->parent->id.newid) {
+			if (ob->parent && ob->parent->id.newid) {
 				BLI_remlink(lb, te);
 				tep= (TreeElement *)ob->parent->id.newid;
 				BLI_addtail(&tep->subtree, te);
 				// set correct parent pointers
-				for(te=tep->subtree.first; te; te= te->next) te->parent= tep;
+				for (te=tep->subtree.first; te; te= te->next) te->parent= tep;
 			}
 		}
 		te= ten;
@@ -1216,15 +1192,15 @@ static int treesort_alpha(const void *v1, const void *v2)
 	
 	/* first put objects last (hierarchy) */
 	comp= (x1->idcode==ID_OB);
-	if(x2->idcode==ID_OB) comp+=2;
+	if (x2->idcode==ID_OB) comp+=2;
 	
-	if(comp==1) return 1;
-	else if(comp==2) return -1;
-	else if(comp==3) {
+	if (comp==1) return 1;
+	else if (comp==2) return -1;
+	else if (comp==3) {
 		comp= strcmp(x1->name, x2->name);
 		
-		if( comp>0 ) return 1;
-		else if( comp<0) return -1;
+		if ( comp>0 ) return 1;
+		else if ( comp<0) return -1;
 		return 0;
 	}
 	return 0;
@@ -1237,20 +1213,20 @@ static int treesort_obtype_alpha(const void *v1, const void *v2)
 	const tTreeSort *x1= v1, *x2= v2;
 	
 	/* first put objects last (hierarchy) */
-	if(x1->idcode==ID_OB && x2->idcode!=ID_OB) return 1;
-	else if(x2->idcode==ID_OB && x1->idcode!=ID_OB) return -1;
+	if (x1->idcode==ID_OB && x2->idcode!=ID_OB) return 1;
+	else if (x2->idcode==ID_OB && x1->idcode!=ID_OB) return -1;
 	else {
 		/* 2nd we check ob type */
-		if(x1->idcode==ID_OB && x2->idcode==ID_OB) {
-			if( ((Object *)x1->id)->type > ((Object *)x2->id)->type) return 1;
-			else if( ((Object *)x1->id)->type > ((Object *)x2->id)->type) return -1;
+		if (x1->idcode==ID_OB && x2->idcode==ID_OB) {
+			if ( ((Object *)x1->id)->type > ((Object *)x2->id)->type) return 1;
+			else if ( ((Object *)x1->id)->type > ((Object *)x2->id)->type) return -1;
 			else return 0;
 		}
 		else {
 			int comp= strcmp(x1->name, x2->name);
 			
-			if( comp>0 ) return 1;
-			else if( comp<0) return -1;
+			if ( comp>0 ) return 1;
+			else if ( comp<0) return -1;
 			return 0;
 		}
 	}
@@ -1265,38 +1241,38 @@ static void outliner_sort(SpaceOops *soops, ListBase *lb)
 	int totelem=0;
 	
 	te= lb->last;
-	if(te==NULL) return;
+	if (te==NULL) return;
 	tselem= TREESTORE(te);
 	
 	/* sorting rules; only object lists or deformgroups */
-	if( (tselem->type==TSE_DEFGROUP) || (tselem->type==0 && te->idcode==ID_OB)) {
+	if ( (tselem->type==TSE_DEFGROUP) || (tselem->type==0 && te->idcode==ID_OB)) {
 		
 		/* count first */
-		for(te= lb->first; te; te= te->next) totelem++;
+		for (te= lb->first; te; te= te->next) totelem++;
 		
-		if(totelem>1) {
+		if (totelem>1) {
 			tTreeSort *tear= MEM_mallocN(totelem*sizeof(tTreeSort), "tree sort array");
 			tTreeSort *tp=tear;
 			int skip= 0;
 			
-			for(te= lb->first; te; te= te->next, tp++) {
+			for (te= lb->first; te; te= te->next, tp++) {
 				tselem= TREESTORE(te);
 				tp->te= te;
 				tp->name= te->name;
 				tp->idcode= te->idcode;
-				if(tselem->type && tselem->type!=TSE_DEFGROUP) tp->idcode= 0;	// dont sort this
+				if (tselem->type && tselem->type!=TSE_DEFGROUP) tp->idcode= 0;	// don't sort this
 				tp->id= tselem->id;
 			}
 			/* keep beginning of list */
-			for(tp= tear, skip=0; skip<totelem; skip++, tp++)
-				if(tp->idcode) break;
+			for (tp= tear, skip=0; skip<totelem; skip++, tp++)
+				if (tp->idcode) break;
 			
-			if(skip<totelem)
+			if (skip<totelem)
 				qsort(tear+skip, totelem-skip, sizeof(tTreeSort), treesort_alpha);
 			
 			lb->first=lb->last= NULL;
 			tp= tear;
-			while(totelem--) {
+			while (totelem--) {
 				BLI_addtail(lb, tp->te);
 				tp++;
 			}
@@ -1304,7 +1280,7 @@ static void outliner_sort(SpaceOops *soops, ListBase *lb)
 		}
 	}
 	
-	for(te= lb->first; te; te= te->next) {
+	for (te= lb->first; te; te= te->next) {
 		outliner_sort(soops, &te->subtree);
 	}
 }
@@ -1379,7 +1355,7 @@ static int outliner_filter_tree(SpaceOops *soops, ListBase *lb)
 				outliner_free_tree(&te->subtree);
 				BLI_remlink(lb, te);
 				
-				if(te->flag & TE_FREE_NAME) MEM_freeN((void *)te->name);
+				if (te->flag & TE_FREE_NAME) MEM_freeN((void *)te->name);
 				MEM_freeN(te);
 			}
 		}
@@ -1412,37 +1388,37 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
 	int show_opened= (soops->treestore==NULL); /* on first view, we open scenes */
 
 	/* Are we looking for something - we want to tag parents to filter child matches
-	 - NOT in datablocks view - searching all datablocks takes way too long to be useful
-	 - this variable is only set once per tree build */
-	if(soops->search_string[0]!=0 && soops->outlinevis!=SO_DATABLOCKS)
+	 * - NOT in datablocks view - searching all datablocks takes way too long to be useful
+	 * - this variable is only set once per tree build */
+	if (soops->search_string[0]!=0 && soops->outlinevis!=SO_DATABLOCKS)
 		soops->search_flags |= SO_SEARCH_RECURSIVE;
 	else
 		soops->search_flags &= ~SO_SEARCH_RECURSIVE;
 
-	if(soops->tree.first && (soops->storeflag & SO_TREESTORE_REDRAW))
+	if (soops->tree.first && (soops->storeflag & SO_TREESTORE_REDRAW))
 		return;
 
 	outliner_free_tree(&soops->tree);
 	outliner_storage_cleanup(soops);
 	
 	/* clear ob id.new flags */
-	for(ob= mainvar->object.first; ob; ob= ob->id.next) ob->id.newid= NULL;
+	for (ob= mainvar->object.first; ob; ob= ob->id.next) ob->id.newid= NULL;
 	
 	/* options */
-	if(soops->outlinevis == SO_LIBRARIES) {
+	if (soops->outlinevis == SO_LIBRARIES) {
 		Library *lib;
 		
-		for(lib= mainvar->library.first; lib; lib= lib->id.next) {
+		for (lib= mainvar->library.first; lib; lib= lib->id.next) {
 			ten= outliner_add_element(soops, &soops->tree, lib, NULL, 0, 0);
 			lib->id.newid= (ID *)ten;
 		}
 		/* make hierarchy */
 		ten= soops->tree.first;
-		while(ten) {
+		while (ten) {
 			TreeElement *nten= ten->next, *par;
 			tselem= TREESTORE(ten);
 			lib= (Library *)tselem->id;
-			if(lib->parent) {
+			if (lib->parent) {
 				BLI_remlink(&soops->tree, ten);
 				par= (TreeElement *)lib->parent->id.newid;
 				BLI_addtail(&par->subtree, ten);
@@ -1451,67 +1427,67 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
 			ten= nten;
 		}
 		/* restore newid pointers */
-		for(lib= mainvar->library.first; lib; lib= lib->id.next)
+		for (lib= mainvar->library.first; lib; lib= lib->id.next)
 			lib->id.newid= NULL;
 		
 	}
-	else if(soops->outlinevis == SO_ALL_SCENES) {
+	else if (soops->outlinevis == SO_ALL_SCENES) {
 		Scene *sce;
-		for(sce= mainvar->scene.first; sce; sce= sce->id.next) {
+		for (sce= mainvar->scene.first; sce; sce= sce->id.next) {
 			te= outliner_add_element(soops, &soops->tree, sce, NULL, 0, 0);
 			tselem= TREESTORE(te);
-			if(sce==scene && show_opened) 
+			if (sce==scene && show_opened) 
 				tselem->flag &= ~TSE_CLOSED;
 			
-			for(base= sce->base.first; base; base= base->next) {
+			for (base= sce->base.first; base; base= base->next) {
 				ten= outliner_add_element(soops, &te->subtree, base->object, te, 0, 0);
 				ten->directdata= base;
 			}
 			outliner_make_hierarchy(soops, &te->subtree);
 			/* clear id.newid, to prevent objects be inserted in wrong scenes (parent in other scene) */
-			for(base= sce->base.first; base; base= base->next) base->object->id.newid= NULL;
+			for (base= sce->base.first; base; base= base->next) base->object->id.newid= NULL;
 		}
 	}
-	else if(soops->outlinevis == SO_CUR_SCENE) {
+	else if (soops->outlinevis == SO_CUR_SCENE) {
 		
 		outliner_add_scene_contents(soops, &soops->tree, scene, NULL);
 		
-		for(base= scene->base.first; base; base= base->next) {
+		for (base= scene->base.first; base; base= base->next) {
 			ten= outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
 			ten->directdata= base;
 		}
 		outliner_make_hierarchy(soops, &soops->tree);
 	}
-	else if(soops->outlinevis == SO_VISIBLE) {
-		for(base= scene->base.first; base; base= base->next) {
-			if(base->lay & scene->lay)
+	else if (soops->outlinevis == SO_VISIBLE) {
+		for (base= scene->base.first; base; base= base->next) {
+			if (base->lay & scene->lay)
 				outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
 		}
 		outliner_make_hierarchy(soops, &soops->tree);
 	}
-	else if(soops->outlinevis == SO_GROUPS) {
+	else if (soops->outlinevis == SO_GROUPS) {
 		Group *group;
 		GroupObject *go;
 		
-		for(group= mainvar->group.first; group; group= group->id.next) {
-			if(group->gobject.first) {
+		for (group= mainvar->group.first; group; group= group->id.next) {
+			if (group->gobject.first) {
 				te= outliner_add_element(soops, &soops->tree, group, NULL, 0, 0);
 				
-				for(go= group->gobject.first; go; go= go->next) {
+				for (go= group->gobject.first; go; go= go->next) {
 					ten= outliner_add_element(soops, &te->subtree, go->ob, te, 0, 0);
 					ten->directdata= NULL; /* eh, why? */
 				}
 				outliner_make_hierarchy(soops, &te->subtree);
 				/* clear id.newid, to prevent objects be inserted in wrong scenes (parent in other scene) */
-				for(go= group->gobject.first; go; go= go->next) go->ob->id.newid= NULL;
+				for (go= group->gobject.first; go; go= go->next) go->ob->id.newid= NULL;
 			}
 		}
 	}
-	else if(soops->outlinevis == SO_SAME_TYPE) {
+	else if (soops->outlinevis == SO_SAME_TYPE) {
 		Object *ob= OBACT;
-		if(ob) {
-			for(base= scene->base.first; base; base= base->next) {
-				if(base->object->type==ob->type) {
+		if (ob) {
+			for (base= scene->base.first; base; base= base->next) {
+				if (base->object->type==ob->type) {
 					ten= outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
 					ten->directdata= base;
 				}
@@ -1519,10 +1495,10 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
 			outliner_make_hierarchy(soops, &soops->tree);
 		}
 	}
-	else if(soops->outlinevis == SO_SELECTED) {
-		for(base= scene->base.first; base; base= base->next) {
-			if(base->lay & scene->lay) {
-				if(base==BASACT || (base->flag & SELECT)) {
+	else if (soops->outlinevis == SO_SELECTED) {
+		for (base= scene->base.first; base; base= base->next) {
+			if (base->lay & scene->lay) {
+				if (base==BASACT || (base->flag & SELECT)) {
 					ten= outliner_add_element(soops, &soops->tree, base->object, NULL, 0, 0);
 					ten->directdata= base;
 				}
@@ -1530,65 +1506,65 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
 		}
 		outliner_make_hierarchy(soops, &soops->tree);
 	}
-	else if(soops->outlinevis==SO_SEQUENCE) {
+	else if (soops->outlinevis==SO_SEQUENCE) {
 		Sequence *seq;
 		Editing *ed= seq_give_editing(scene, FALSE);
 		int op;
 
-		if(ed==NULL)
+		if (ed==NULL)
 			return;
 
 		seq= ed->seqbasep->first;
-		if(!seq)
+		if (!seq)
 			return;
 
-		while(seq) {
+		while (seq) {
 			op= need_add_seq_dup(seq);
-			if(op==1) {
+			if (op==1) {
 				/* ten= */ outliner_add_element(soops, &soops->tree, (void*)seq, NULL, TSE_SEQUENCE, 0);
 			}
-			else if(op==0) {
+			else if (op==0) {
 				ten= outliner_add_element(soops, &soops->tree, (void*)seq, NULL, TSE_SEQUENCE_DUP, 0);
 				outliner_add_seq_dup(soops, seq, ten, 0);
 			}
 			seq= seq->next;
 		}
 	}
-	else if(soops->outlinevis==SO_DATABLOCKS) {
+	else if (soops->outlinevis==SO_DATABLOCKS) {
 		PointerRNA mainptr;
 
 		RNA_main_pointer_create(mainvar, &mainptr);
 
 		ten= outliner_add_element(soops, &soops->tree, (void*)&mainptr, NULL, TSE_RNA_STRUCT, -1);
 
-		if(show_opened)  {
+		if (show_opened) {
 			tselem= TREESTORE(ten);
 			tselem->flag &= ~TSE_CLOSED;
 		}
 	}
-	else if(soops->outlinevis==SO_USERDEF) {
+	else if (soops->outlinevis==SO_USERDEF) {
 		PointerRNA userdefptr;
 
 		RNA_pointer_create(NULL, &RNA_UserPreferences, &U, &userdefptr);
 
 		ten= outliner_add_element(soops, &soops->tree, (void*)&userdefptr, NULL, TSE_RNA_STRUCT, -1);
 
-		if(show_opened)  {
+		if (show_opened) {
 			tselem= TREESTORE(ten);
 			tselem->flag &= ~TSE_CLOSED;
 		}
 	}
-	else if(soops->outlinevis==SO_KEYMAP) {
+	else if (soops->outlinevis==SO_KEYMAP) {
 		wmWindowManager *wm= mainvar->wm.first;
 		wmKeyMap *km;
 		
-		for(km= wm->defaultconf->keymaps.first; km; km= km->next) {
+		for (km= wm->defaultconf->keymaps.first; km; km= km->next) {
 			/* ten= */ outliner_add_element(soops, &soops->tree, (void*)km, NULL, TSE_KEYMAP, 0);
 		}
 	}
 	else {
 		ten= outliner_add_element(soops, &soops->tree, OBACT, NULL, 0, 0);
-		if(ten) ten->directdata= BASACT;
+		if (ten) ten->directdata= BASACT;
 	}
 
 	outliner_sort(soops, &soops->tree);
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index ebbe28e..ed050b7 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -66,7 +66,7 @@ static void outliner_main_area_init(wmWindowManager *wm, ARegion *ar)
 	UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
 	
 	/* own keymap */
-	keymap= WM_keymap_find(wm->defaultconf, "Outliner", SPACE_OUTLINER, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Outliner", SPACE_OUTLINER, 0);
 	/* don't pass on view2d mask, it's always set with scrollbar space, hide fails */
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, NULL, &ar->winrct);
 
@@ -83,15 +83,15 @@ static int outliner_parent_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
 	float fmval[2];
 	UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
 
-	if(drag->type == WM_DRAG_ID) {
+	if (drag->type == WM_DRAG_ID) {
 		ID *id = (ID *)drag->poin;
-		if( GS(id->name) == ID_OB ) {
+		if ( GS(id->name) == ID_OB ) {
 			/* Ensure item under cursor is valid drop target */
 			/* Find object hovered over */
-			for(te= soops->tree.first; te; te= te->next) {
+			for (te= soops->tree.first; te; te= te->next) {
 				TreeElement *te_valid;
 				te_valid= outliner_dropzone_parent(C, event, te, fmval);
-				if(te_valid) return 1;
+				if (te_valid) return 1;
 			}
 		}
 	}
@@ -114,20 +114,20 @@ static int outliner_parent_clear_poll(bContext *C, wmDrag *drag, wmEvent *event)
 
 	UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
 
-	if(drag->type == WM_DRAG_ID) {
+	if (drag->type == WM_DRAG_ID) {
 		ID *id = (ID *)drag->poin;
-		if( GS(id->name) == ID_OB ) {
+		if ( GS(id->name) == ID_OB ) {
 			//TODO: Check if no parent?
 			/* Ensure location under cursor is valid dropzone */
-			for(te= soops->tree.first; te; te= te->next) {
-				if(outliner_dropzone_parent_clear(C, event, te, fmval)) return 1;
+			for (te= soops->tree.first; te; te= te->next) {
+				if (outliner_dropzone_parent_clear(C, event, te, fmval)) return 1;
 			}
 			/* Check if mouse cursor is below the tree */
 			te= soops->tree.last;
-			while(((te->flag & TE_LAZY_CLOSED)==0) && (te->subtree.last)) {
+			while (((te->flag & TE_LAZY_CLOSED)==0) && (te->subtree.last)) {
 				te= te->subtree.last;
 			}
-			if(fmval[1] < te->ys) return 1;
+			if (fmval[1] < te->ys) return 1;
 		}
 	}
 	return 0;
@@ -232,15 +232,15 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
 			break;
 		case NC_LAMP:
 			/* For updating lamp icons, when changing lamp type */
-			if(wmn->data == ND_LIGHTING_DRAW)
+			if (wmn->data == ND_LIGHTING_DRAW)
 				ED_region_tag_redraw(ar);
 				break;
 		case NC_SPACE:
-			if(wmn->data == ND_SPACE_OUTLINER)
+			if (wmn->data == ND_SPACE_OUTLINER)
 				ED_region_tag_redraw(ar);
 				break;
 		case NC_ID:
-			if(wmn->action == NA_RENAME)
+			if (wmn->action == NA_RENAME)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_MATERIAL:
@@ -269,7 +269,7 @@ static void outliner_main_area_listener(ARegion *ar, wmNotifier *wmn)
 					ED_region_tag_redraw(ar);
 					break;
 				case ND_ANIMCHAN:
-					if(wmn->action==NA_SELECTED)
+					if (wmn->action==NA_SELECTED)
 						ED_region_tag_redraw(ar);
 					break;
 			}
@@ -301,11 +301,11 @@ static void outliner_header_area_listener(ARegion *ar, wmNotifier *wmn)
 	/* context changes */
 	switch(wmn->category) {
 		case NC_SCENE:
-			if(wmn->data == ND_KEYINGSET)
+			if (wmn->data == ND_KEYINGSET)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_SPACE:
-			if(wmn->data == ND_SPACE_OUTLINER)
+			if (wmn->data == ND_SPACE_OUTLINER)
 				ED_region_tag_redraw(ar);
 			break;
 	}
@@ -349,8 +349,8 @@ static void outliner_free(SpaceLink *sl)
 	SpaceOops *soutliner= (SpaceOops*)sl;
 	
 	outliner_free_tree(&soutliner->tree);
-	if(soutliner->treestore) {
-		if(soutliner->treestore->data) MEM_freeN(soutliner->treestore->data);
+	if (soutliner->treestore) {
+		if (soutliner->treestore->data) MEM_freeN(soutliner->treestore->data);
 		MEM_freeN(soutliner->treestore);
 	}
 	
diff --git a/source/blender/editors/space_script/script_edit.c b/source/blender/editors/space_script/script_edit.c
index 7702e95..4ff0c7b 100644
--- a/source/blender/editors/space_script/script_edit.c
+++ b/source/blender/editors/space_script/script_edit.c
@@ -57,7 +57,7 @@ static int run_pyfile_exec(bContext *C, wmOperator *op)
 	char path[512];
 	RNA_string_get(op->ptr, "filepath", path);
 #ifdef WITH_PYTHON
-	if(BPY_filepath_exec(C, path, op->reports)) {
+	if (BPY_filepath_exec(C, path, op->reports)) {
 		ARegion *ar= CTX_wm_region(C);
 		ED_region_tag_redraw(ar);
 		return OPERATOR_FINISHED;
@@ -71,16 +71,16 @@ static int run_pyfile_exec(bContext *C, wmOperator *op)
 void SCRIPT_OT_python_file_run(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Run python file";
-	ot->description= "Run Python file";
-	ot->idname= "SCRIPT_OT_python_file_run";
+	ot->name = "Run python file";
+	ot->description = "Run Python file";
+	ot->idname = "SCRIPT_OT_python_file_run";
 	ot->flag = OPTYPE_UNDO;
 
 	/* api callbacks */
-	ot->exec= run_pyfile_exec;
-	ot->poll= ED_operator_areaactive;
+	ot->exec = run_pyfile_exec;
+	ot->poll = ED_operator_areaactive;
 
-	RNA_def_string_file_path(ot->srna, "filepath", "", 512, "Path", "");
+	RNA_def_string_file_path(ot->srna, "filepath", "", FILE_MAX, "Path", "");
 }
 
 
@@ -103,10 +103,10 @@ static int script_reload_exec(bContext *C, wmOperator *UNUSED(op))
 void SCRIPT_OT_reload(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Reload Scripts";
-	ot->description= "Reload Scripts";
-	ot->idname= "SCRIPT_OT_reload";
+	ot->name = "Reload Scripts";
+	ot->description = "Reload Scripts";
+	ot->idname = "SCRIPT_OT_reload";
 
 	/* api callbacks */
-	ot->exec= script_reload_exec;
+	ot->exec = script_reload_exec;
 }
diff --git a/source/blender/editors/space_script/script_intern.h b/source/blender/editors/space_script/script_intern.h
index 98e9699..0086386 100644
--- a/source/blender/editors/space_script/script_intern.h
+++ b/source/blender/editors/space_script/script_intern.h
@@ -28,8 +28,8 @@
  *  \ingroup spscript
  */
 
-#ifndef ED_SCRIPT_INTERN_H
-#define ED_SCRIPT_INTERN_H
+#ifndef __SCRIPT_INTERN_H__
+#define __SCRIPT_INTERN_H__
 
 /* internal exports only */
 
@@ -41,5 +41,5 @@ void script_keymap(struct wmKeyConfig *keyconf);
 void SCRIPT_OT_reload(struct wmOperatorType *ot);
 void SCRIPT_OT_python_file_run(struct wmOperatorType *ot);
 
-#endif /* ED_SCRIPT_INTERN_H */
+#endif /* __SCRIPT_INTERN_H__ */
 
diff --git a/source/blender/editors/space_script/script_ops.c b/source/blender/editors/space_script/script_ops.c
index 3ae89ee..0c99d9b 100644
--- a/source/blender/editors/space_script/script_ops.c
+++ b/source/blender/editors/space_script/script_ops.c
@@ -60,7 +60,7 @@ void script_operatortypes(void)
 
 void script_keymap(wmKeyConfig *keyconf)
 {
-	wmKeyMap *keymap= WM_keymap_find(keyconf, "Script", SPACE_SCRIPT, 0);
+	wmKeyMap *keymap = WM_keymap_find(keyconf, "Script", SPACE_SCRIPT, 0);
 
 	/* TODO - this is just while we have no way to load a text datablock */
 	RNA_string_set(WM_keymap_add_item(keymap, "SCRIPT_OT_python_file_run", PKEY, KM_PRESS, KM_CTRL|KM_SHIFT|KM_ALT, 0)->ptr, "filepath", "test.py");
diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c
index dbda276..bad9a01 100644
--- a/source/blender/editors/space_script/space_script.c
+++ b/source/blender/editors/space_script/space_script.c
@@ -135,7 +135,7 @@ static void script_main_area_init(wmWindowManager *wm, ARegion *ar)
 	UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
 	
 	/* own keymap */
-	keymap= WM_keymap_find(wm->defaultconf, "Script", SPACE_SCRIPT, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Script", SPACE_SCRIPT, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
diff --git a/source/blender/editors/space_sequencer/SConscript b/source/blender/editors/space_sequencer/SConscript
index 3430c10..65aadfa 100644
--- a/source/blender/editors/space_sequencer/SConscript
+++ b/source/blender/editors/space_sequencer/SConscript
@@ -8,7 +8,7 @@ incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
 incs += ' ../../makesrna ../../blenloader'
 incs += ' #/intern/audaspace/intern'
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+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] )
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index 03fd22d..dfa733d 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -50,11 +50,12 @@
 
 #include "BKE_context.h"
 #include "BKE_global.h"
+#include "BKE_library.h"
 #include "BKE_main.h"
 #include "BKE_sequencer.h"
+#include "BKE_movieclip.h"
 #include "BKE_report.h"
 
-
 #include "WM_api.h"
 #include "WM_types.h"
 
@@ -79,34 +80,34 @@
 /* Generic functions, reused by add strip operators */
 
 /* avoid passing multiple args and be more verbose */
-#define SEQPROP_STARTFRAME	(1<<0)
-#define SEQPROP_ENDFRAME	(1<<1)
-#define SEQPROP_NOPATHS		(1<<2)
-#define SEQPROP_NOCHAN		(1<<3)
+#define SEQPROP_STARTFRAME  (1 << 0)
+#define SEQPROP_ENDFRAME    (1 << 1)
+#define SEQPROP_NOPATHS     (1 << 2)
+#define SEQPROP_NOCHAN      (1 << 3)
 
 #define SELECT 1
 
 static void sequencer_generic_props__internal(wmOperatorType *ot, int flag)
 {
-	if(flag & SEQPROP_STARTFRAME)
+	if (flag & SEQPROP_STARTFRAME)
 		RNA_def_int(ot->srna, "frame_start", 0, INT_MIN, INT_MAX, "Start Frame", "Start frame of the sequence strip", INT_MIN, INT_MAX);
 	
-	if(flag & SEQPROP_ENDFRAME)
-		RNA_def_int(ot->srna, "frame_end", 0, INT_MIN, INT_MAX, "End Frame", "End frame for the color strip", INT_MIN, INT_MAX); /* not useual since most strips have a fixed length */
+	if (flag & SEQPROP_ENDFRAME)
+		RNA_def_int(ot->srna, "frame_end", 0, INT_MIN, INT_MAX, "End Frame", "End frame for the color strip", INT_MIN, INT_MAX);  /* not usual since most strips have a fixed length */
 	
 	RNA_def_int(ot->srna, "channel", 1, 1, MAXSEQ, "Channel", "Channel to place this strip into", 1, MAXSEQ);
 	
-	RNA_def_boolean(ot->srna, "replace_sel", 1, "Replace Selection", "replace the current selection");
+	RNA_def_boolean(ot->srna, "replace_sel", 1, "Replace Selection", "Replace the current selection");
 
 	RNA_def_boolean(ot->srna, "overlap", 0, "Allow Overlap", "Don't correct overlap on new sequence strips");
 }
 
 static void sequencer_generic_invoke_path__internal(bContext *C, wmOperator *op, const char *identifier)
 {
-	if(RNA_struct_find_property(op->ptr, identifier)) {
-		Scene *scene= CTX_data_scene(C);
-		Sequence *last_seq= seq_active_get(scene);
-		if(last_seq && last_seq->strip && SEQ_HAS_PATH(last_seq)) {
+	if (RNA_struct_find_property(op->ptr, identifier)) {
+		Scene *scene = CTX_data_scene(C);
+		Sequence *last_seq = seq_active_get(scene);
+		if (last_seq && last_seq->strip && SEQ_HAS_PATH(last_seq)) {
 			char path[sizeof(last_seq->strip->dir)];
 			BLI_strncpy(path, last_seq->strip->dir, sizeof(path));
 			BLI_path_abs(path, G.main->name);
@@ -117,21 +118,21 @@ static void sequencer_generic_invoke_path__internal(bContext *C, wmOperator *op,
 
 static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, wmEvent *event, int flag)
 {
-	View2D *v2d= UI_view2d_fromcontext(C);
+	View2D *v2d = UI_view2d_fromcontext(C);
 	
 	float mval_v2d[2];
 	
 	UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &mval_v2d[0], &mval_v2d[1]);
 
-	/* effect strips dont need a channel initialized from the mouse */
-	if(!(flag & SEQPROP_NOCHAN)) {
-		RNA_int_set(op->ptr, "channel", (int)mval_v2d[1]+0.5f);
+	/* effect strips don't need a channel initialized from the mouse */
+	if (!(flag & SEQPROP_NOCHAN)) {
+		RNA_int_set(op->ptr, "channel", (int)mval_v2d[1] + 0.5f);
 	}
 
 	RNA_int_set(op->ptr, "frame_start", (int)mval_v2d[0]);
 	
-	if ((flag & SEQPROP_ENDFRAME) && RNA_struct_property_is_set(op->ptr, "frame_end")==0)
-		RNA_int_set(op->ptr, "frame_end", (int)mval_v2d[0] + 25); // XXX arbitary but ok for now.
+	if ((flag & SEQPROP_ENDFRAME) && RNA_struct_property_is_set(op->ptr, "frame_end") == 0)
+		RNA_int_set(op->ptr, "frame_end", (int)mval_v2d[0] + 25);  // XXX arbitary but ok for now.
 
 	if (!(flag & SEQPROP_NOPATHS)) {
 		sequencer_generic_invoke_path__internal(C, op, "filepath");
@@ -141,25 +142,26 @@ static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, w
 
 static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op)
 {
-	int relative= RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path");
-	int is_file= -1;
+	int relative = RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path");
+	int is_file = -1;
 	memset(seq_load, 0, sizeof(SeqLoadInfo));
 
-	seq_load->start_frame=	RNA_int_get(op->ptr, "frame_start");
-	seq_load->end_frame=	seq_load->start_frame; /* un-set */
+	seq_load->start_frame =  RNA_int_get(op->ptr, "frame_start");
+	seq_load->end_frame =    seq_load->start_frame; /* un-set */
 
-	seq_load->channel=		RNA_int_get(op->ptr, "channel");
-	seq_load->len=			1; // images only, if endframe isnt set!
+	seq_load->channel =      RNA_int_get(op->ptr, "channel");
+	seq_load->len =          1; // images only, if endframe isn't set!
 
-	if(RNA_struct_find_property(op->ptr, "filepath")) {
+	if (RNA_struct_find_property(op->ptr, "filepath")) {
 		RNA_string_get(op->ptr, "filepath", seq_load->path); /* full path, file is set by the caller */
-		is_file= 1;
-	} else if (RNA_struct_find_property(op->ptr, "directory")) {
+		is_file = 1;
+	}
+	else if (RNA_struct_find_property(op->ptr, "directory")) {
 		RNA_string_get(op->ptr, "directory", seq_load->path); /* full path, file is set by the caller */
-		is_file= 0;
+		is_file = 0;
 	}
 
-	if((is_file != -1) && relative)
+	if ((is_file != -1) && relative)
 		BLI_path_rel(seq_load->path, G.main->name);
 
 	
@@ -180,14 +182,14 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op)
 	seq_load->flag |= SEQ_LOAD_FRAME_ADVANCE;
 
 
-	if(is_file==1) {
+	if (is_file == 1) {
 		BLI_strncpy(seq_load->name, BLI_path_basename(seq_load->path), sizeof(seq_load->name));
 	}
-	else if(RNA_struct_find_property(op->ptr, "files")) {
+	else if (RNA_struct_find_property(op->ptr, "files")) {
 		/* used for image strip */
 		/* best guess, first images name */
 		RNA_BEGIN(op->ptr, itemptr, "files") {
-			char *name= RNA_string_get_alloc(&itemptr, "name", NULL, 0);
+			char *name = RNA_string_get_alloc(&itemptr, "name", NULL, 0);
 			BLI_strncpy(seq_load->name, name, sizeof(seq_load->name));
 			MEM_freeN(name);
 			break;
@@ -199,44 +201,41 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op)
 /* add scene operator */
 static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, TRUE);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, TRUE);
 	
 	Scene *sce_seq;
 
-	Sequence *seq;	/* generic strip vars */
+	Sequence *seq;  /* generic strip vars */
 	Strip *strip;
 	
 	int start_frame, channel; /* operator props */
 	
-	start_frame= RNA_int_get(op->ptr, "frame_start");
-	channel= RNA_int_get(op->ptr, "channel");
+	start_frame = RNA_int_get(op->ptr, "frame_start");
+	channel = RNA_int_get(op->ptr, "channel");
 	
-	sce_seq= BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene"));
+	sce_seq = BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene"));
 	
-	if (sce_seq==NULL) {
+	if (sce_seq == NULL) {
 		BKE_report(op->reports, RPT_ERROR, "Scene not found");
 		return OPERATOR_CANCELLED;
 	}
 	
 	seq = alloc_sequence(ed->seqbasep, start_frame, channel);
-	seq->type= SEQ_SCENE;
-	seq->blend_mode= SEQ_CROSS; /* so alpha adjustment fade to the strip below */
+	seq->type = SEQ_SCENE;
+	seq->blend_mode = SEQ_CROSS; /* so alpha adjustment fade to the strip below */
 
-	seq->scene= sce_seq;
-	seq->sfra= sce_seq->r.sfra;
+	seq->scene = sce_seq;
 	
 	/* basic defaults */
-	seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
-	strip->len = seq->len = sce_seq->r.efra - sce_seq->r.sfra + 1;
-	strip->us= 1;
-	
-	strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
+	seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
+	seq->len = sce_seq->r.efra - sce_seq->r.sfra + 1;
+	strip->us = 1;
 	
-	BLI_strncpy(seq->name+2, sce_seq->id.name+2, sizeof(seq->name)-2);
+	BLI_strncpy(seq->name + 2, sce_seq->id.name + 2, sizeof(seq->name) - 2);
 	seqbase_unique_name_recursive(&ed->seqbase, seq);
 
-	seq->scene_sound = sound_scene_add_scene_sound(scene, seq, start_frame, start_frame + strip->len, 0);
+	seq->scene_sound = sound_scene_add_scene_sound(scene, seq, start_frame, start_frame + seq->len, 0);
 
 	calc_sequence_disp(scene, seq);
 	sort_seq(scene);
@@ -247,11 +246,11 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
 		seq->flag |= SELECT;
 	}
 
-	if(RNA_boolean_get(op->ptr, "overlap") == FALSE) {
-		if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
+	if (RNA_boolean_get(op->ptr, "overlap") == FALSE) {
+		if (seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
 	}
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 	
 	return OPERATOR_FINISHED;
 }
@@ -259,12 +258,12 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
 
 static int sequencer_add_scene_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	if(!ED_operator_sequencer_active(C)) {
+	if (!ED_operator_sequencer_active(C)) {
 		BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
 		return OPERATOR_CANCELLED;
 	}
 
-	if(!RNA_struct_property_is_set(op->ptr, "scene"))
+	if (!RNA_struct_property_is_set(op->ptr, "scene"))
 		return WM_enum_search_invoke(C, op, event);
 
 	sequencer_generic_invoke_xy__internal(C, op, event, 0);
@@ -279,56 +278,157 @@ void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot)
 	PropertyRNA *prop;
 	
 	/* identifiers */
-	ot->name= "Add Scene Strip";
-	ot->idname= "SEQUENCER_OT_scene_strip_add";
-	ot->description= "Add a strip to the sequencer using a blender scene as a source";
+	ot->name = "Add Scene Strip";
+	ot->idname = "SEQUENCER_OT_scene_strip_add";
+	ot->description = "Add a strip to the sequencer using a blender scene as a source";
 
 	/* api callbacks */
-	ot->invoke= sequencer_add_scene_strip_invoke;
-	ot->exec= sequencer_add_scene_strip_exec;
+	ot->invoke = sequencer_add_scene_strip_invoke;
+	ot->exec = sequencer_add_scene_strip_exec;
 
-	ot->poll= ED_operator_scene_editable;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
-	prop= RNA_def_enum(ot->srna, "scene", DummyRNA_NULL_items, 0, "Scene", "");
+	prop = RNA_def_enum(ot->srna, "scene", DummyRNA_NULL_items, 0, "Scene", "");
 	RNA_def_enum_funcs(prop, RNA_scene_itemf);
-	ot->prop= prop;
+	ot->prop = prop;
 }
 
+/* add movieclip operator */
+static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op)
+{
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, TRUE);
+	
+	MovieClip *clip;
+
+	Sequence *seq;  /* generic strip vars */
+	Strip *strip;
+	
+	int start_frame, channel; /* operator props */
+	
+	start_frame = RNA_int_get(op->ptr, "frame_start");
+	channel = RNA_int_get(op->ptr, "channel");
+	
+	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");
+		return OPERATOR_CANCELLED;
+	}
+	
+	seq = alloc_sequence(ed->seqbasep, start_frame, channel);
+	seq->type = SEQ_MOVIECLIP;
+	seq->blend_mode = SEQ_CROSS;
+	seq->clip = clip;
+
+	if (seq->clip->id.us == 0)
+		seq->clip->id.us = 1;
+
+	/* basic defaults */
+	seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
+	seq->len =  BKE_movieclip_get_duration(clip);
+	strip->us = 1;
+	
+	BLI_strncpy(seq->name + 2, clip->id.name + 2, sizeof(seq->name) - 2);
+	seqbase_unique_name_recursive(&ed->seqbase, seq);
+
+	calc_sequence_disp(scene, seq);
+	sort_seq(scene);
+	
+	if (RNA_boolean_get(op->ptr, "replace_sel")) {
+		deselect_all_seq(scene);
+		seq_active_set(scene, seq);
+		seq->flag |= SELECT;
+	}
+
+	if (RNA_boolean_get(op->ptr, "overlap") == FALSE) {
+		if (seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
+	}
+
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
+	
+	return OPERATOR_FINISHED;
+}
+
+
+static int sequencer_add_movieclip_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+	if (!ED_operator_sequencer_active(C)) {
+		BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
+		return OPERATOR_CANCELLED;
+	}
+
+	if (!RNA_struct_property_is_set(op->ptr, "clip"))
+		return WM_enum_search_invoke(C, op, event);
+
+	sequencer_generic_invoke_xy__internal(C, op, event, 0);
+	return sequencer_add_movieclip_strip_exec(C, op);
+	// needs a menu
+	// return WM_menu_invoke(C, op, event);
+}
+
+
+void SEQUENCER_OT_movieclip_strip_add(struct wmOperatorType *ot)
+{
+	PropertyRNA *prop;
+	
+	/* identifiers */
+	ot->name = "Add MovieClip Strip";
+	ot->idname = "SEQUENCER_OT_movieclip_strip_add";
+	ot->description = "Add a movieclip strip to the sequencer";
+
+	/* api callbacks */
+	ot->invoke = sequencer_add_movieclip_strip_invoke;
+	ot->exec = sequencer_add_movieclip_strip_exec;
+
+	ot->poll = ED_operator_scene_editable;
+	
+	/* flags */
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+	
+	sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
+	prop = RNA_def_enum(ot->srna, "clip", DummyRNA_NULL_items, 0, "Clip", "");
+	RNA_def_enum_funcs(prop, RNA_movieclip_itemf);
+	ot->prop = prop;
+}
+
+
 static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoadFunc seq_load_func)
 {
-	Scene *scene= CTX_data_scene(C); /* only for sound */
-	Editing *ed= seq_give_editing(scene, TRUE);
+	Scene *scene = CTX_data_scene(C); /* only for sound */
+	Editing *ed = seq_give_editing(scene, TRUE);
 	SeqLoadInfo seq_load;
 	Sequence *seq;
 	int tot_files;
-	const short overlap= RNA_boolean_get(op->ptr, "overlap");
+	const short overlap = RNA_boolean_get(op->ptr, "overlap");
 
 	seq_load_operator_info(&seq_load, op);
 
 	if (seq_load.flag & SEQ_LOAD_REPLACE_SEL)
 		deselect_all_seq(scene);
 
-	tot_files= RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
+	tot_files = RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
 
-	if(tot_files) {
+	if (tot_files) {
 		/* multiple files */
 		char dir_only[FILE_MAX];
 		char file_only[FILE_MAX];
 
 		BLI_split_dir_part(seq_load.path, dir_only, sizeof(dir_only));
 
-		RNA_BEGIN(op->ptr, itemptr, "files") {
+		RNA_BEGIN(op->ptr, itemptr, "files")
+		{
 			RNA_string_get(&itemptr, "name", file_only);
 			BLI_join_dirfile(seq_load.path, sizeof(seq_load.path), dir_only, file_only);
 
 			seq = seq_load_func(C, ed->seqbasep, &seq_load);
 			if (seq) {
-				if(overlap == FALSE) {
-					if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
+				if (overlap == FALSE) {
+					if (seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
 				}
 			}
 		}
@@ -338,13 +438,13 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad
 		/* single file */
 		seq = seq_load_func(C, ed->seqbasep, &seq_load);
 		if (seq) {
-			if(overlap == FALSE) {
-				if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
+			if (overlap == FALSE) {
+				if (seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
 			}
 		}
 	}
 
-	if (seq_load.tot_success==0) {
+	if (seq_load.tot_success == 0) {
 		BKE_reportf(op->reports, RPT_ERROR, "File \"%s\" could not be loaded", seq_load.path);
 		return OPERATOR_CANCELLED;
 	}
@@ -352,7 +452,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad
 	sort_seq(scene);
 	seq_update_muting(ed);
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
 	return OPERATOR_FINISHED;
 }
@@ -367,13 +467,15 @@ static int sequencer_add_movie_strip_exec(bContext *C, wmOperator *op)
 static int sequencer_add_movie_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 
-	if(!ED_operator_sequencer_active(C)) {
+	if (!ED_operator_sequencer_active(C)) {
 		BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
 		return OPERATOR_CANCELLED;
 	}
 
 	/* This is for drag and drop */
-	if(RNA_collection_length(op->ptr, "files") || RNA_struct_property_is_set(op->ptr, "filepath")) {
+	if ((RNA_struct_property_is_set(op->ptr, "files") && RNA_collection_length(op->ptr, "files")) ||
+	    RNA_struct_property_is_set(op->ptr, "filepath"))
+	{
 		sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_NOPATHS);
 		return sequencer_add_movie_strip_exec(C, op);
 	}
@@ -391,20 +493,20 @@ void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot)
 {
 	
 	/* identifiers */
-	ot->name= "Add Movie Strip";
-	ot->idname= "SEQUENCER_OT_movie_strip_add";
-	ot->description= "Add a movie strip to the sequencer";
+	ot->name = "Add Movie Strip";
+	ot->idname = "SEQUENCER_OT_movie_strip_add";
+	ot->description = "Add a movie strip to the sequencer";
 
 	/* api callbacks */
-	ot->invoke= sequencer_add_movie_strip_invoke;
-	ot->exec= sequencer_add_movie_strip_exec;
+	ot->invoke = sequencer_add_movie_strip_invoke;
+	ot->exec = sequencer_add_movie_strip_exec;
 
-	ot->poll= ED_operator_scene_editable;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
-	WM_operator_properties_filesel(ot, FOLDERFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH|WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
+	WM_operator_properties_filesel(ot, FOLDERFILE | MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH | WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
 	sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
 	RNA_def_boolean(ot->srna, "sound", TRUE, "Sound", "Load sound with the movie");
 }
@@ -419,13 +521,15 @@ static int sequencer_add_sound_strip_exec(bContext *C, wmOperator *op)
 static int sequencer_add_sound_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 
-	if(!ED_operator_sequencer_active(C)) {
+	if (!ED_operator_sequencer_active(C)) {
 		BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
 		return OPERATOR_CANCELLED;
 	}
 	
 	/* This is for drag and drop */
-	if(RNA_collection_length(op->ptr, "files") || RNA_struct_property_is_set(op->ptr, "filepath")) {
+	if ((RNA_struct_property_is_set(op->ptr, "files") && RNA_collection_length(op->ptr, "files")) ||
+	    RNA_struct_property_is_set(op->ptr, "filepath"))
+	{
 		sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_NOPATHS);
 		return sequencer_add_sound_strip_exec(C, op);
 	}
@@ -443,20 +547,20 @@ void SEQUENCER_OT_sound_strip_add(struct wmOperatorType *ot)
 {
 	
 	/* identifiers */
-	ot->name= "Add Sound Strip";
-	ot->idname= "SEQUENCER_OT_sound_strip_add";
-	ot->description= "Add a sound strip to the sequencer";
+	ot->name = "Add Sound Strip";
+	ot->idname = "SEQUENCER_OT_sound_strip_add";
+	ot->description = "Add a sound strip to the sequencer";
 
 	/* api callbacks */
-	ot->invoke= sequencer_add_sound_strip_invoke;
-	ot->exec= sequencer_add_sound_strip_exec;
+	ot->invoke = sequencer_add_sound_strip_invoke;
+	ot->exec = sequencer_add_sound_strip_exec;
 
-	ot->poll= ED_operator_scene_editable;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
-	WM_operator_properties_filesel(ot, FOLDERFILE|SOUNDFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH|WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
+	WM_operator_properties_filesel(ot, FOLDERFILE | SOUNDFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH | WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
 	sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
 	RNA_def_boolean(ot->srna, "cache", FALSE, "Cache", "Cache the sound in memory");
 }
@@ -466,8 +570,8 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
 {
 	/* cant use the generic function for this */
 
-	Scene *scene= CTX_data_scene(C); /* only for sound */
-	Editing *ed= seq_give_editing(scene, TRUE);
+	Scene *scene = CTX_data_scene(C); /* only for sound */
+	Editing *ed = seq_give_editing(scene, TRUE);
 	SeqLoadInfo seq_load;
 	Sequence *seq;
 
@@ -477,31 +581,31 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
 	seq_load_operator_info(&seq_load, op);
 
 	/* images are unique in how they handle this - 1 per strip elem */
-	seq_load.len= RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
+	seq_load.len = RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
 
-	if(seq_load.len==0)
+	if (seq_load.len == 0)
 		return OPERATOR_CANCELLED;
 
-	if(seq_load.flag & SEQ_LOAD_REPLACE_SEL)
+	if (seq_load.flag & SEQ_LOAD_REPLACE_SEL)
 		deselect_all_seq(scene);
 
 
 	/* main adding function */
-	seq= sequencer_add_image_strip(C, ed->seqbasep, &seq_load);
-	strip= seq->strip;
-	se= strip->stripdata;
+	seq = sequencer_add_image_strip(C, ed->seqbasep, &seq_load);
+	strip = seq->strip;
+	se = strip->stripdata;
 
 	RNA_BEGIN(op->ptr, itemptr, "files") {
-		char *filename= RNA_string_get_alloc(&itemptr, "name", NULL, 0);
+		char *filename = RNA_string_get_alloc(&itemptr, "name", NULL, 0);
 		BLI_strncpy(se->name, filename, sizeof(se->name));
 		MEM_freeN(filename);
 		se++;
 	}
 	RNA_END;
 
-	if(seq_load.len == 1) {
-		if(seq_load.start_frame < seq_load.end_frame) {
-			seq->endstill= seq_load.end_frame - seq_load.start_frame;
+	if (seq_load.len == 1) {
+		if (seq_load.start_frame < seq_load.end_frame) {
+			seq->endstill = seq_load.end_frame - seq_load.start_frame;
 		}
 	}
 	
@@ -510,13 +614,13 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
 	sort_seq(scene);
 
 	/* last active name */
-	strncpy(ed->act_imagedir, strip->dir, FILE_MAXDIR-1);
+	strncpy(ed->act_imagedir, strip->dir, FILE_MAXDIR - 1);
 
-	if(RNA_boolean_get(op->ptr, "overlap") == FALSE) {
-		if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
+	if (RNA_boolean_get(op->ptr, "overlap") == FALSE) {
+		if (seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
 	}
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
 	return OPERATOR_FINISHED;
 }
@@ -524,15 +628,15 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
 static int sequencer_add_image_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 
-	if(!ED_operator_sequencer_active(C)) {
+	if (!ED_operator_sequencer_active(C)) {
 		BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
 		return OPERATOR_CANCELLED;
 	}
 
 
 	/* drag drop has set the names */
-	if(RNA_collection_length(op->ptr, "files")) {
-		sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_ENDFRAME|SEQPROP_NOPATHS);
+	if (RNA_struct_property_is_set(op->ptr, "files") && RNA_collection_length(op->ptr, "files")) {
+		sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_ENDFRAME | SEQPROP_NOPATHS);
 		return sequencer_add_image_strip_exec(C, op);
 	}
 	
@@ -547,31 +651,31 @@ void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot)
 {
 	
 	/* identifiers */
-	ot->name= "Add Image Strip";
-	ot->idname= "SEQUENCER_OT_image_strip_add";
-	ot->description= "Add an image or image sequence to the sequencer";
+	ot->name = "Add Image Strip";
+	ot->idname = "SEQUENCER_OT_image_strip_add";
+	ot->description = "Add an image or image sequence to the sequencer";
 
 	/* api callbacks */
-	ot->invoke= sequencer_add_image_strip_invoke;
-	ot->exec= sequencer_add_image_strip_exec;
+	ot->invoke = sequencer_add_image_strip_invoke;
+	ot->exec = sequencer_add_image_strip_exec;
 
-	ot->poll= ED_operator_scene_editable;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
-	WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH|WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
-	sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_ENDFRAME);
+	WM_operator_properties_filesel(ot, FOLDERFILE | IMAGEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY | WM_FILESEL_RELPATH | WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
+	sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME | SEQPROP_ENDFRAME);
 }
 
 
 /* add_effect_strip operator */
 static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, TRUE);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, TRUE);
 
-	Sequence *seq;	/* generic strip vars */
+	Sequence *seq;  /* generic strip vars */
 	Strip *strip;
 	struct SeqEffectHandle sh;
 
@@ -580,41 +684,41 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
 	Sequence *seq1, *seq2, *seq3;
 	const char *error_msg;
 
-	start_frame= RNA_int_get(op->ptr, "frame_start");
-	end_frame= RNA_int_get(op->ptr, "frame_end");
-	channel= RNA_int_get(op->ptr, "channel");
+	start_frame = RNA_int_get(op->ptr, "frame_start");
+	end_frame = RNA_int_get(op->ptr, "frame_end");
+	channel = RNA_int_get(op->ptr, "channel");
 
-	type= RNA_enum_get(op->ptr, "type");
+	type = RNA_enum_get(op->ptr, "type");
 	
 	// XXX move to invoke
-	if(!seq_effect_find_selected(scene, NULL, type, &seq1, &seq2, &seq3, &error_msg)) {
+	if (!seq_effect_find_selected(scene, NULL, type, &seq1, &seq2, &seq3, &error_msg)) {
 		BKE_report(op->reports, RPT_ERROR, error_msg);
 		return OPERATOR_CANCELLED;
 	}
 
-	/* If seq1 is NULL and no error was rasied it means the seq is standalone
+	/* If seq1 is NULL and no error was raised it means the seq is standalone
 	 * (like color strips) and we need to check its start and end frames are valid */
-	if (seq1==NULL && end_frame <= start_frame) {
+	if (seq1 == NULL && end_frame <= start_frame) {
 		BKE_report(op->reports, RPT_ERROR, "Start and end frame are not set");
 		return OPERATOR_CANCELLED;
 	}
 
 	seq = alloc_sequence(ed->seqbasep, start_frame, channel);
-	seq->type= type;
+	seq->type = type;
 
-	BLI_strncpy(seq->name+2, give_seqname(seq), sizeof(seq->name)-2);
+	BLI_strncpy(seq->name + 2, give_seqname(seq), sizeof(seq->name) - 2);
 	seqbase_unique_name_recursive(&ed->seqbase, seq);
 
 	sh = get_sequence_effect(seq);
 
-	seq->seq1= seq1;
-	seq->seq2= seq2;
-	seq->seq3= seq3;
+	seq->seq1 = seq1;
+	seq->seq2 = seq2;
+	seq->seq3 = seq3;
 
 	sh.init(seq);
 
 	if (!seq1) { /* effect has no deps */
-		seq->len= 1;
+		seq->len = 1;
 		seq_tx_set_final_right(seq, end_frame);
 	}
 
@@ -623,47 +727,46 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
 	calc_sequence(scene, seq);
 	
 	/* basic defaults */
-	seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
-	strip->len = seq->len;
-	strip->us= 1;
-	if(seq->len>0)
-		strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
+	seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
+	strip->us = 1;
 
-	if (seq->type==SEQ_PLUGIN) {
+	if (seq->type == SEQ_PLUGIN) {
 		char path[FILE_MAX];
 		RNA_string_get(op->ptr, "filepath", path);
 
 		sh.init_plugin(seq, path);
 
-		if(seq->plugin==NULL) {
+		if (seq->plugin == NULL) {
 			BLI_remlink(ed->seqbasep, seq);
 			seq_free_sequence(scene, seq);
 			BKE_reportf(op->reports, RPT_ERROR, "Sequencer plugin \"%s\" could not load", path);
 			return OPERATOR_CANCELLED;
 		}
-	} else if (seq->type == SEQ_COLOR) {
-		SolidColorVars *colvars= (SolidColorVars *)seq->effectdata;
+	}
+	else if (seq->type == SEQ_COLOR) {
+		SolidColorVars *colvars = (SolidColorVars *)seq->effectdata;
 		RNA_float_get_array(op->ptr, "color", colvars->col);
-		seq->blend_mode= SEQ_CROSS; /* so alpha adjustment fade to the strip below */
+		seq->blend_mode = SEQ_CROSS; /* so alpha adjustment fade to the strip below */
 
-	} else if (seq->type == SEQ_ADJUSTMENT) {
-		seq->blend_mode= SEQ_CROSS;
+	}
+	else if (seq->type == SEQ_ADJUSTMENT) {
+		seq->blend_mode = SEQ_CROSS;
 	}
 
 	/* an unset channel is a special case where we automatically go above
 	 * the other strips. */
-	if(!RNA_struct_property_is_set(op->ptr, "channel")) {
-		if(seq->seq1) {
-			int chan= MAX3(	seq->seq1 ? seq->seq1->machine : 0,
-							seq->seq2 ? seq->seq2->machine : 0,
-							seq->seq3 ? seq->seq3->machine : 0);
-			if(chan < MAXSEQ)
-				seq->machine= chan;
+	if (!RNA_struct_property_is_set(op->ptr, "channel")) {
+		if (seq->seq1) {
+			int chan = MAX3(seq->seq1 ? seq->seq1->machine : 0,
+			                seq->seq2 ? seq->seq2->machine : 0,
+			                seq->seq3 ? seq->seq3->machine : 0);
+			if (chan < MAXSEQ)
+				seq->machine = chan;
 		}
 	}
 
-	if(RNA_boolean_get(op->ptr, "overlap") == FALSE) {
-		if(seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
+	if (RNA_boolean_get(op->ptr, "overlap") == FALSE) {
+		if (seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
 	}
 
 	update_changed_seq_and_deps(scene, seq, 1, 1); /* runs calc_sequence */
@@ -679,7 +782,7 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
 		seq->flag |= SELECT;
 	}
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
 	return OPERATOR_FINISHED;
 }
@@ -688,30 +791,30 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
 /* add color */
 static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	short is_type_set= RNA_struct_property_is_set(op->ptr, "type");
-	int type= -1;
-	int prop_flag= SEQPROP_ENDFRAME;
+	short is_type_set = RNA_struct_property_is_set(op->ptr, "type");
+	int type = -1;
+	int prop_flag = SEQPROP_ENDFRAME;
 
-	if(!ED_operator_sequencer_active(C)) {
+	if (!ED_operator_sequencer_active(C)) {
 		BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
 		return OPERATOR_CANCELLED;
 	}
 
-	if(is_type_set) {
-		type= RNA_enum_get(op->ptr, "type");
+	if (is_type_set) {
+		type = RNA_enum_get(op->ptr, "type");
 
 		/* when invoking an effect strip which uses inputs,
-		 * skip initialzing the channel from the mouse.
+		 * skip initializing the channel from the mouse.
 		 * Instead leave the property unset so exec() initializes it to be
 		 * above the strips its applied to. */
-		if(get_sequence_effect_num_inputs(type) != 0) {
+		if (get_sequence_effect_num_inputs(type) != 0) {
 			prop_flag |= SEQPROP_NOCHAN;
 		}
 	}
 
 	sequencer_generic_invoke_xy__internal(C, op, event, prop_flag);
 
-	if (is_type_set && type==SEQ_PLUGIN) {
+	if (is_type_set && type == SEQ_PLUGIN) {
 		/* only plugins need the file selector */
 		WM_event_add_fileselect(C, op);
 		return OPERATOR_RUNNING_MODAL;
@@ -724,21 +827,21 @@ static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, wmEven
 void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Add Effect Strip";
-	ot->idname= "SEQUENCER_OT_effect_strip_add";
-	ot->description= "Add an effect to the sequencer, most are applied on top of existing strips";
+	ot->name = "Add Effect Strip";
+	ot->idname = "SEQUENCER_OT_effect_strip_add";
+	ot->description = "Add an effect to the sequencer, most are applied on top of existing strips";
 
 	/* api callbacks */
-	ot->invoke= sequencer_add_effect_strip_invoke;
-	ot->exec= sequencer_add_effect_strip_exec;
+	ot->invoke = sequencer_add_effect_strip_invoke;
+	ot->exec = sequencer_add_effect_strip_exec;
 
-	ot->poll= ED_operator_scene_editable;
+	ot->poll = ED_operator_scene_editable;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
-	WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
-	sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_ENDFRAME);
+	WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
+	sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME | SEQPROP_ENDFRAME);
 	RNA_def_enum(ot->srna, "type", sequencer_prop_effect_types, SEQ_CROSS, "Type", "Sequencer effect type");
 	RNA_def_float_vector(ot->srna, "color", 3, NULL, 0.0f, 1.0f, "Color", "Initialize the strip with this color (only used when type='COLOR')", 0.0f, 1.0f);
 }
diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.c b/source/blender/editors/space_sequencer/sequencer_buttons.c
index 9aefdea..aeedafa 100644
--- a/source/blender/editors/space_sequencer/sequencer_buttons.c
+++ b/source/blender/editors/space_sequencer/sequencer_buttons.c
@@ -48,58 +48,14 @@
 
 #include "sequencer_intern.h"
 
-
-static void do_sequencer_panel_events(bContext *UNUSED(C), void *UNUSED(arg), int UNUSED(event))
-{
-
-}
-
-
-static void sequencer_panel_view_properties(const bContext *UNUSED(C), Panel *pa)
-{
-	uiBlock *block;
-
-	block= uiLayoutAbsoluteBlock(pa->layout);
-	uiBlockSetHandleFunc(block, do_sequencer_panel_events, NULL);
-	
-}
-
-
-static void sequencer_panel_properties(const bContext *UNUSED(C), Panel *pa)
-{
-	uiBlock *block;
-	
-	block= uiLayoutAbsoluteBlock(pa->layout);
-	uiBlockSetHandleFunc(block, do_sequencer_panel_events, NULL);
-
-}	
-
-void sequencer_buttons_register(ARegionType *art)
-{
-	PanelType *pt;
-
-	pt= MEM_callocN(sizeof(PanelType), "spacetype sequencer strip properties");
-	strcpy(pt->idname, "SEQUENCER_PT_properties");
-	strcpy(pt->label, "Strip Properties");
-	pt->draw= sequencer_panel_properties;
-	BLI_addtail(&art->paneltypes, pt);
-
-	pt= MEM_callocN(sizeof(PanelType), "spacetype sequencer view properties");
-	strcpy(pt->idname, "SEQUENCER_PT_view_properties");
-	strcpy(pt->label, "View Properties");
-	pt->draw= sequencer_panel_view_properties;
-	BLI_addtail(&art->paneltypes, pt);
-
-}
-
 /* **************** operator to open/close properties view ************* */
 
 static int sequencer_properties(bContext *C, wmOperator *UNUSED(op))
 {
-	ScrArea *sa= CTX_wm_area(C);
-	ARegion *ar= sequencer_has_buttons_region(sa);
+	ScrArea *sa = CTX_wm_area(C);
+	ARegion *ar = sequencer_has_buttons_region(sa);
 	
-	if(ar)
+	if (ar)
 		ED_region_toggle_hidden(C, ar);
 
 	return OPERATOR_FINISHED;
@@ -107,14 +63,14 @@ static int sequencer_properties(bContext *C, wmOperator *UNUSED(op))
 
 void SEQUENCER_OT_properties(wmOperatorType *ot)
 {
-	ot->name= "Properties";
-	ot->idname= "SEQUENCER_OT_properties";
-	ot->description= "Open sequencer properties panel";
+	ot->name = "Properties";
+	ot->idname = "SEQUENCER_OT_properties";
+	ot->description = "Open sequencer properties panel";
 	
-	ot->exec= sequencer_properties;
-	ot->poll= ED_operator_sequencer_active;
+	ot->exec = sequencer_properties;
+	ot->poll = ED_operator_sequencer_active;
 	
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 }
 
diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c
index 7bc8600..cd0c877 100644
--- a/source/blender/editors/space_sequencer/sequencer_draw.c
+++ b/source/blender/editors/space_sequencer/sequencer_draw.c
@@ -68,11 +68,11 @@
 #include "sequencer_intern.h"
 
 
-#define SEQ_LEFTHANDLE		1
-#define SEQ_RIGHTHANDLE	2
+#define SEQ_LEFTHANDLE      1
+#define SEQ_RIGHTHANDLE 2
 
 
-/* Note, Dont use SEQ_BEGIN/SEQ_END while drawing!
+/* Note, Don't use SEQ_BEGIN/SEQ_END while drawing!
  * it messes up transform, - Campbell */
 static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, float y1, float x2, float y2);
 
@@ -81,157 +81,161 @@ static void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char col[
 	unsigned char blendcol[3];
 	SolidColorVars *colvars = (SolidColorVars *)seq->effectdata;
 
-	switch(seq->type) {
-	case SEQ_IMAGE:
-		UI_GetThemeColor3ubv(TH_SEQ_IMAGE, col);
-		break;
-		
-	case SEQ_META:
-		UI_GetThemeColor3ubv(TH_SEQ_META, col);
-		break;
-		
-	case SEQ_MOVIE:
-		UI_GetThemeColor3ubv(TH_SEQ_MOVIE, col);
-		break;
-		
-	case SEQ_SCENE:
-		UI_GetThemeColor3ubv(TH_SEQ_SCENE, col);
-		
-		if(seq->scene==curscene) {
-			UI_GetColorPtrShade3ubv(col, col, 20);
-		}
-		break;
-		
-	/* transitions */
-	case SEQ_CROSS:
-	case SEQ_GAMCROSS:
-	case SEQ_WIPE:
-		UI_GetThemeColor3ubv(TH_SEQ_TRANSITION, col);
-
-		/* slightly offset hue to distinguish different effects */
-		if (seq->type == SEQ_CROSS)			rgb_byte_set_hue_float_offset(col,0.04);
-		if (seq->type == SEQ_GAMCROSS)		rgb_byte_set_hue_float_offset(col,0.08);
-		if (seq->type == SEQ_WIPE)			rgb_byte_set_hue_float_offset(col,0.12);
-		break;
-		
-	/* effects */
-	case SEQ_TRANSFORM:
-	case SEQ_SPEED:
-	case SEQ_ADD:
-	case SEQ_SUB:
-	case SEQ_MUL:
-	case SEQ_ALPHAOVER:
-	case SEQ_ALPHAUNDER:
-	case SEQ_OVERDROP:
-	case SEQ_GLOW:
-	case SEQ_MULTICAM:
-	case SEQ_ADJUSTMENT:
-		UI_GetThemeColor3ubv(TH_SEQ_EFFECT, col);
+	switch (seq->type) {
+		case SEQ_IMAGE:
+			UI_GetThemeColor3ubv(TH_SEQ_IMAGE, col);
+			break;
+
+		case SEQ_META:
+			UI_GetThemeColor3ubv(TH_SEQ_META, col);
+			break;
+
+		case SEQ_MOVIE:
+			UI_GetThemeColor3ubv(TH_SEQ_MOVIE, col);
+			break;
+
+		case SEQ_MOVIECLIP:
+			UI_GetThemeColor3ubv(TH_SEQ_MOVIECLIP, col);
+			break;
 		
-		/* slightly offset hue to distinguish different effects */
-		if (seq->type == SEQ_ADD)			rgb_byte_set_hue_float_offset(col,0.04);
-		if (seq->type == SEQ_SUB)			rgb_byte_set_hue_float_offset(col,0.08);
-		if (seq->type == SEQ_MUL)			rgb_byte_set_hue_float_offset(col,0.12);
-		if (seq->type == SEQ_ALPHAOVER)		rgb_byte_set_hue_float_offset(col,0.16);
-		if (seq->type == SEQ_ALPHAUNDER)	rgb_byte_set_hue_float_offset(col,0.20);
-		if (seq->type == SEQ_OVERDROP)		rgb_byte_set_hue_float_offset(col,0.24);
-		if (seq->type == SEQ_GLOW)			rgb_byte_set_hue_float_offset(col,0.28);
-		if (seq->type == SEQ_TRANSFORM)		rgb_byte_set_hue_float_offset(col,0.36);
-		if (seq->type == SEQ_MULTICAM)		rgb_byte_set_hue_float_offset(col,0.32);
-		if (seq->type == SEQ_ADJUSTMENT)		rgb_byte_set_hue_float_offset(col,0.40);
-		break;
+		case SEQ_SCENE:
+			UI_GetThemeColor3ubv(TH_SEQ_SCENE, col);
 		
-	case SEQ_COLOR:
-		if (colvars->col) {
-			rgb_float_to_uchar(col, colvars->col);
-		} else {
-			col[0] = col[1] = col[2] = 128;
-		}
-		break;
+			if (seq->scene == curscene) {
+				UI_GetColorPtrShade3ubv(col, col, 20);
+			}
+			break;
 		
-	case SEQ_PLUGIN:
-		UI_GetThemeColor3ubv(TH_SEQ_PLUGIN, col);
-		break;
+		/* transitions */
+		case SEQ_CROSS:
+		case SEQ_GAMCROSS:
+		case SEQ_WIPE:
+			UI_GetThemeColor3ubv(TH_SEQ_TRANSITION, col);
+
+			/* slightly offset hue to distinguish different effects */
+			if (seq->type == SEQ_CROSS)    rgb_byte_set_hue_float_offset(col, 0.04);
+			if (seq->type == SEQ_GAMCROSS) rgb_byte_set_hue_float_offset(col, 0.08);
+			if (seq->type == SEQ_WIPE)     rgb_byte_set_hue_float_offset(col, 0.12);
+			break;
+
+		/* effects */
+		case SEQ_TRANSFORM:
+		case SEQ_SPEED:
+		case SEQ_ADD:
+		case SEQ_SUB:
+		case SEQ_MUL:
+		case SEQ_ALPHAOVER:
+		case SEQ_ALPHAUNDER:
+		case SEQ_OVERDROP:
+		case SEQ_GLOW:
+		case SEQ_MULTICAM:
+		case SEQ_ADJUSTMENT:
+			UI_GetThemeColor3ubv(TH_SEQ_EFFECT, col);
+
+			/* slightly offset hue to distinguish different effects */
+			if      (seq->type == SEQ_ADD)        rgb_byte_set_hue_float_offset(col, 0.04);
+			else if (seq->type == SEQ_SUB)        rgb_byte_set_hue_float_offset(col, 0.08);
+			else if (seq->type == SEQ_MUL)        rgb_byte_set_hue_float_offset(col, 0.12);
+			else if (seq->type == SEQ_ALPHAOVER)  rgb_byte_set_hue_float_offset(col, 0.16);
+			else if (seq->type == SEQ_ALPHAUNDER) rgb_byte_set_hue_float_offset(col, 0.20);
+			else if (seq->type == SEQ_OVERDROP)   rgb_byte_set_hue_float_offset(col, 0.24);
+			else if (seq->type == SEQ_GLOW)       rgb_byte_set_hue_float_offset(col, 0.28);
+			else if (seq->type == SEQ_TRANSFORM)  rgb_byte_set_hue_float_offset(col, 0.36);
+			else if (seq->type == SEQ_MULTICAM)   rgb_byte_set_hue_float_offset(col, 0.32);
+			else if (seq->type == SEQ_ADJUSTMENT) rgb_byte_set_hue_float_offset(col, 0.40);
+			break;
+
+		case SEQ_COLOR:
+			if (colvars->col) {
+				rgb_float_to_uchar(col, colvars->col);
+			}
+			else {
+				col[0] = col[1] = col[2] = 128;
+			}
+			break;
 		
-	case SEQ_SOUND:
-		UI_GetThemeColor3ubv(TH_SEQ_AUDIO, col);
-		blendcol[0] = blendcol[1] = blendcol[2] = 128;
-		if(seq->flag & SEQ_MUTE) UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.5, 20);
-		break;
+		case SEQ_PLUGIN:
+			UI_GetThemeColor3ubv(TH_SEQ_PLUGIN, col);
+			break;
+
+		case SEQ_SOUND:
+			UI_GetThemeColor3ubv(TH_SEQ_AUDIO, col);
+			blendcol[0] = blendcol[1] = blendcol[2] = 128;
+			if (seq->flag & SEQ_MUTE) UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.5, 20);
+			break;
 		
-	default:
-		col[0] = 10; col[1] = 255; col[2] = 40;
+		default:
+			col[0] = 10; col[1] = 255; col[2] = 40;
 	}
 }
 
 static void drawseqwave(Scene *scene, Sequence *seq, float x1, float y1, float x2, float y2, float stepsize)
 {
 	/*
-	x1 is the starting x value to draw the wave,
-	x2 the end x value, same for y1 and y2
-	stepsize is width of a pixel.
-	*/
-	if(seq->flag & SEQ_AUDIO_DRAW_WAVEFORM)
-	{
+	 * x1 is the starting x value to draw the wave,
+	 * x2 the end x value, same for y1 and y2
+	 * stepsize is width of a pixel.
+	 */
+	if (seq->flag & SEQ_AUDIO_DRAW_WAVEFORM) {
 		int i, j, pos;
-		int length = floor((x2-x1)/stepsize)+1;
-		float ymid = (y1+y2)/2;
-		float yscale = (y2-y1)/2;
+		int length = floor((x2 - x1) / stepsize) + 1;
+		float ymid = (y1 + y2) / 2;
+		float yscale = (y2 - y1) / 2;
 		float samplestep;
 		float startsample, endsample;
 		float value;
 
-		SoundWaveform* waveform;
+		SoundWaveform *waveform;
 
-		if(!seq->sound->waveform)
+		if (!seq->sound->waveform)
 			sound_read_waveform(seq->sound);
 
-		if(!seq->sound->waveform)
-			return; /* zero length sound */
+		if (!seq->sound->waveform)
+			return;  /* zero length sound */
 
 		waveform = seq->sound->waveform;
 
-		if(!waveform)
+		if (!waveform)
 			return;
 
-		startsample = floor((seq->startofs + seq->anim_startofs)/FPS * SOUND_WAVE_SAMPLES_PER_SECOND);
-		endsample = ceil((seq->startofs + seq->anim_startofs + seq->enddisp - seq->startdisp)/FPS * SOUND_WAVE_SAMPLES_PER_SECOND);
-		samplestep = (endsample-startsample) * stepsize / (x2-x1);
+		startsample = floor((seq->startofs + seq->anim_startofs) / FPS * SOUND_WAVE_SAMPLES_PER_SECOND);
+		endsample = ceil((seq->startofs + seq->anim_startofs + seq->enddisp - seq->startdisp) / FPS * SOUND_WAVE_SAMPLES_PER_SECOND);
+		samplestep = (endsample - startsample) * stepsize / (x2 - x1);
 
-		if(length > floor((waveform->length - startsample) / samplestep))
+		if (length > floor((waveform->length - startsample) / samplestep))
 			length = floor((waveform->length - startsample) / samplestep);
 
 		glBegin(GL_LINE_STRIP);
-		for(i = 0; i < length; i++)
+		for (i = 0; i < length; i++)
 		{
 			pos = startsample + i * samplestep;
 
 			value = waveform->data[pos * 3];
 
-			for(j = pos+1; (j < waveform->length) && (j < pos + samplestep); j++)
+			for (j = pos + 1; (j < waveform->length) && (j < pos + samplestep); j++)
 			{
-				if(value > waveform->data[j * 3])
+				if (value > waveform->data[j * 3])
 					value = waveform->data[j * 3];
 			}
 
-			glVertex2f(x1+i*stepsize, ymid + value * yscale);
+			glVertex2f(x1 + i * stepsize, ymid + value * yscale);
 		}
 		glEnd();
 
 		glBegin(GL_LINE_STRIP);
-		for(i = 0; i < length; i++)
+		for (i = 0; i < length; i++)
 		{
 			pos = startsample + i * samplestep;
 
 			value = waveform->data[pos * 3 + 1];
 
-			for(j = pos+1; (j < waveform->length) && (j < pos + samplestep); j++)
+			for (j = pos + 1; (j < waveform->length) && (j < pos + samplestep); j++)
 			{
-				if(value < waveform->data[j * 3 + 1])
+				if (value < waveform->data[j * 3 + 1])
 					value = waveform->data[j * 3 + 1];
 			}
 
-			glVertex2f(x1+i*stepsize, ymid + value * yscale);
+			glVertex2f(x1 + i * stepsize, ymid + value * yscale);
 		}
 		glEnd();
 	}
@@ -239,7 +243,7 @@ static void drawseqwave(Scene *scene, Sequence *seq, float x1, float y1, float x
 
 static void drawmeta_stipple(int value)
 {
-	if(value) {
+	if (value) {
 		glEnable(GL_POLYGON_STIPPLE);
 		glPolygonStipple(stipple_halftone);
 		
@@ -261,36 +265,36 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
 	Sequence *seq;
 	unsigned char col[4];
 
-	int chan_min= MAXSEQ;
-	int chan_max= 0;
-	int chan_range= 0;
-	float draw_range= y2 - y1;
+	int chan_min = MAXSEQ;
+	int chan_max = 0;
+	int chan_range = 0;
+	float draw_range = y2 - y1;
 	float draw_height;
 
 	glEnable(GL_BLEND);
 	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 
-	if(seqm->flag & SEQ_MUTE)
+	if (seqm->flag & SEQ_MUTE)
 		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);
+	for (seq = seqm->seqbase.first; seq; seq = seq->next) {
+		chan_min = MIN2(chan_min, seq->machine);
+		chan_max = MAX2(chan_max, seq->machine);
 	}
 
-	chan_range= (chan_max - chan_min) + 1;
-	draw_height= draw_range / chan_range; 
+	chan_range = (chan_max - chan_min) + 1;
+	draw_height = draw_range / chan_range;
 
-	col[3]= 196; /* alpha, used for all meta children */
+	col[3] = 196; /* alpha, used for all meta children */
 
-	for (seq= seqm->seqbase.first; seq; seq= seq->next) {
-		if((seq->startdisp > x2 || seq->enddisp < x1) == 0) {
-			float y_chan= (seq->machine - chan_min) / (float)(chan_range) * draw_range;
-			float x1_chan= seq->startdisp;
-			float x2_chan= seq->enddisp;
+	for (seq = seqm->seqbase.first; seq; seq = seq->next) {
+		if ((seq->startdisp > x2 || seq->enddisp < x1) == 0) {
+			float y_chan = (seq->machine - chan_min) / (float)(chan_range) * draw_range;
+			float x1_chan = seq->startdisp;
+			float x2_chan = seq->enddisp;
 			float y1_chan, y2_chan;
 
-			if((seqm->flag & SEQ_MUTE) == 0 && (seq->flag & SEQ_MUTE))
+			if ((seqm->flag & SEQ_MUTE) == 0 && (seq->flag & SEQ_MUTE))
 				drawmeta_stipple(1);
 
 			get_seq_color3ubv(scene, seq, col);
@@ -298,11 +302,11 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
 			glColor4ubv(col);
 			
 			/* clamp within parent sequence strip bounds */
-			if(x1_chan < x1) x1_chan= x1;
-			if(x2_chan > x2) x2_chan= x2;
+			if (x1_chan < x1) x1_chan = x1;
+			if (x2_chan > x2) x2_chan = x2;
 
-			y1_chan= y1 + y_chan + (draw_height * SEQ_STRIP_OFSBOTTOM);
-			y2_chan= y1 + y_chan + (draw_height * SEQ_STRIP_OFSTOP);
+			y1_chan = y1 + y_chan + (draw_height * SEQ_STRIP_OFSBOTTOM);
+			y2_chan = y1 + y_chan + (draw_height * SEQ_STRIP_OFSTOP);
 
 			glRectf(x1_chan,  y1_chan, x2_chan,  y2_chan);
 
@@ -310,7 +314,7 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
 			glColor4ubv(col);
 			fdrawbox(x1_chan,  y1_chan, x2_chan,  y2_chan);
 
-			if((seqm->flag & SEQ_MUTE) == 0 && (seq->flag & SEQ_MUTE))
+			if ((seqm->flag & SEQ_MUTE) == 0 && (seq->flag & SEQ_MUTE))
 				drawmeta_stipple(0);
 		}
 	}
@@ -324,81 +328,83 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1,
 /* draw a handle, for each end of a sequence strip */
 static void draw_seq_handle(View2D *v2d, Sequence *seq, float pixelx, short direction)
 {
-	float v1[2], v2[2], v3[2], rx1=0, rx2=0; //for triangles and rect
+	float v1[2], v2[2], v3[2], rx1 = 0, rx2 = 0; //for triangles and rect
 	float x1, x2, y1, y2;
 	float handsize;
 	float minhandle, maxhandle;
 	char numstr[32];
-	unsigned int whichsel=0;
+	unsigned int whichsel = 0;
 	
-	x1= seq->startdisp;
-	x2= seq->enddisp;
+	x1 = seq->startdisp;
+	x2 = seq->enddisp;
 	
-	y1= seq->machine+SEQ_STRIP_OFSBOTTOM;
-	y2= seq->machine+SEQ_STRIP_OFSTOP;
+	y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
+	y2 = seq->machine + SEQ_STRIP_OFSTOP;
 	
 	/* clamp handles to defined size in pixel space */
 	handsize = seq->handsize;
 	minhandle = 7;
 	maxhandle = 40;
-	CLAMP(handsize, minhandle*pixelx, maxhandle*pixelx);
+	CLAMP(handsize, minhandle * pixelx, maxhandle * pixelx);
 	
 	/* set up co-ordinates/dimensions for either left or right handle */
 	if (direction == SEQ_LEFTHANDLE) {	
 		rx1 = x1;
-		rx2 = x1+handsize * 0.75f;
+		rx2 = x1 + handsize * 0.75f;
 		
-		v1[0]= x1+handsize/4; v1[1]= y1+( ((y1+y2)/2.0f - y1)/2);
-		v2[0]= x1+handsize/4; v2[1]= y2-( ((y1+y2)/2.0f - y1)/2);
-		v3[0]= v2[0] + handsize/4; v3[1]= (y1+y2)/2.0f;
+		v1[0] = x1 + handsize / 4; v1[1] = y1 + ( ((y1 + y2) / 2.0f - y1) / 2);
+		v2[0] = x1 + handsize / 4; v2[1] = y2 - ( ((y1 + y2) / 2.0f - y1) / 2);
+		v3[0] = v2[0] + handsize / 4; v3[1] = (y1 + y2) / 2.0f;
 		
 		whichsel = SEQ_LEFTSEL;
-	} else if (direction == SEQ_RIGHTHANDLE) {	
-		rx1 = x2-handsize*0.75f;
+	}
+	else if (direction == SEQ_RIGHTHANDLE) {
+		rx1 = x2 - handsize * 0.75f;
 		rx2 = x2;
 		
-		v1[0]= x2-handsize/4; v1[1]= y1+( ((y1+y2)/2.0f - y1)/2);
-		v2[0]= x2-handsize/4; v2[1]= y2-( ((y1+y2)/2.0f - y1)/2);
-		v3[0]= v2[0] - handsize/4; v3[1]= (y1+y2)/2.0f;
+		v1[0] = x2 - handsize / 4; v1[1] = y1 + ( ((y1 + y2) / 2.0f - y1) / 2);
+		v2[0] = x2 - handsize / 4; v2[1] = y2 - ( ((y1 + y2) / 2.0f - y1) / 2);
+		v3[0] = v2[0] - handsize / 4; v3[1] = (y1 + y2) / 2.0f;
 		
 		whichsel = SEQ_RIGHTSEL;
 	}
 	
 	/* draw! */
-	if(seq->type < SEQ_EFFECT || 
-	   get_sequence_effect_num_inputs(seq->type) == 0) {
-		glEnable( GL_BLEND );
+	if (seq->type < SEQ_EFFECT || 
+	    get_sequence_effect_num_inputs(seq->type) == 0) {
+		glEnable(GL_BLEND);
 		
 		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 		
-		if(seq->flag & whichsel) glColor4ub(0, 0, 0, 80);
+		if (seq->flag & whichsel) glColor4ub(0, 0, 0, 80);
 		else if (seq->flag & SELECT) glColor4ub(255, 255, 255, 30);
 		else glColor4ub(0, 0, 0, 22);
 		
 		glRectf(rx1, y1, rx2, y2);
 		
-		if(seq->flag & whichsel) glColor4ub(255, 255, 255, 200);
+		if (seq->flag & whichsel) glColor4ub(255, 255, 255, 200);
 		else glColor4ub(0, 0, 0, 50);
 		
-		glEnable( GL_POLYGON_SMOOTH );
+		glEnable(GL_POLYGON_SMOOTH);
 		glBegin(GL_TRIANGLES);
 		glVertex2fv(v1); glVertex2fv(v2); glVertex2fv(v3);
 		glEnd();
 		
-		glDisable( GL_POLYGON_SMOOTH );
-		glDisable( GL_BLEND );
+		glDisable(GL_POLYGON_SMOOTH);
+		glDisable(GL_BLEND);
 	}
 	
-	if(G.moving || (seq->flag & whichsel)) {
-		const char col[4]= {255, 255, 255, 255};
+	if (G.moving || (seq->flag & whichsel)) {
+		const char col[4] = {255, 255, 255, 255};
 		if (direction == SEQ_LEFTHANDLE) {
-			BLI_snprintf(numstr, sizeof(numstr),"%d", seq->startdisp);
-			x1= rx1;
+			BLI_snprintf(numstr, sizeof(numstr), "%d", seq->startdisp);
+			x1 = rx1;
 			y1 -= 0.45f;
-		} else {
+		}
+		else {
 			BLI_snprintf(numstr, sizeof(numstr), "%d", seq->enddisp - 1);
-			x1= x2 - handsize*0.75f;
-			y1= y2 + 0.05f;
+			x1 = x2 - handsize * 0.75f;
+			y1 = y2 + 0.05f;
 		}
 		UI_view2d_text_cache_add(v2d, x1, y1, numstr, col);
 	}	
@@ -408,24 +414,24 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
 {
 	float x1, x2, y1, y2, pixely, a;
 	unsigned char col[3], blendcol[3];
-	View2D *v2d= &ar->v2d;
+	View2D *v2d = &ar->v2d;
 	
-	if(seq->type >= SEQ_EFFECT) return;
+	if (seq->type >= SEQ_EFFECT) return;
 
-	x1= seq->startdisp;
-	x2= seq->enddisp;
+	x1 = seq->startdisp;
+	x2 = seq->enddisp;
 	
-	y1= seq->machine+SEQ_STRIP_OFSBOTTOM;
-	y2= seq->machine+SEQ_STRIP_OFSTOP;
+	y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
+	y2 = seq->machine + SEQ_STRIP_OFSTOP;
 
-	pixely = (v2d->cur.ymax - v2d->cur.ymin)/(v2d->mask.ymax - v2d->mask.ymin);
+	pixely = (v2d->cur.ymax - v2d->cur.ymin) / (v2d->mask.ymax - v2d->mask.ymin);
 	
-	if(pixely <= 0) return; /* can happen when the view is split/resized */
+	if (pixely <= 0) return;  /* can happen when the view is split/resized */
 	
 	blendcol[0] = blendcol[1] = blendcol[2] = 120;
 
-	if(seq->startofs) {
-		glEnable( GL_BLEND );
+	if (seq->startofs) {
+		glEnable(GL_BLEND);
 		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 		
 		get_seq_color3ubv(scene, seq, col);
@@ -433,22 +439,23 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
 		if (seq->flag & SELECT) {
 			UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.3, -40);
 			glColor4ub(col[0], col[1], col[2], 170);
-		} else {
+		}
+		else {
 			UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.6, 0);
 			glColor4ub(col[0], col[1], col[2], 110);
 		}
 		
-		glRectf((float)(seq->start), y1-SEQ_STRIP_OFSBOTTOM, x1, y1);
+		glRectf((float)(seq->start), y1 - SEQ_STRIP_OFSBOTTOM, x1, y1);
 		
 		if (seq->flag & SELECT) glColor4ub(col[0], col[1], col[2], 255);
 		else glColor4ub(col[0], col[1], col[2], 160);
 
-		fdrawbox((float)(seq->start), y1-SEQ_STRIP_OFSBOTTOM, x1, y1);	//outline
+		fdrawbox((float)(seq->start), y1 - SEQ_STRIP_OFSBOTTOM, x1, y1);  //outline
 		
-		glDisable( GL_BLEND );
+		glDisable(GL_BLEND);
 	}
-	if(seq->endofs) {
-		glEnable( GL_BLEND );
+	if (seq->endofs) {
+		glEnable(GL_BLEND);
 		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 		
 		get_seq_color3ubv(scene, seq, col);
@@ -456,21 +463,22 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
 		if (seq->flag & SELECT) {
 			UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.3, -40);
 			glColor4ub(col[0], col[1], col[2], 170);
-		} else {
+		}
+		else {
 			UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.6, 0);
 			glColor4ub(col[0], col[1], col[2], 110);
 		}
 		
-		glRectf(x2, y2, (float)(seq->start+seq->len), y2+SEQ_STRIP_OFSBOTTOM);
+		glRectf(x2, y2, (float)(seq->start + seq->len), y2 + SEQ_STRIP_OFSBOTTOM);
 		
 		if (seq->flag & SELECT) glColor4ub(col[0], col[1], col[2], 255);
 		else glColor4ub(col[0], col[1], col[2], 160);
 
-		fdrawbox(x2, y2, (float)(seq->start+seq->len), y2+SEQ_STRIP_OFSBOTTOM);	//outline
+		fdrawbox(x2, y2, (float)(seq->start + seq->len), y2 + SEQ_STRIP_OFSBOTTOM); //outline
 		
-		glDisable( GL_BLEND );
+		glDisable(GL_BLEND);
 	}
-	if(seq->startstill) {
+	if (seq->startstill) {
 		get_seq_color3ubv(scene, seq, col);
 		UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.75, 40);
 		glColor3ubv((GLubyte *)col);
@@ -478,32 +486,32 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq)
 		draw_shadedstrip(seq, col, x1, y1, (float)(seq->start), y2);
 		
 		/* feint pinstripes, helps see exactly which is extended and which isn't,
-		* especially when the extension is very small */ 
+		 * especially when the extension is very small */ 
 		if (seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 24);
 		else UI_GetColorPtrShade3ubv(col, col, -16);
 		
 		glColor3ubv((GLubyte *)col);
 		
-		for(a=y1; a< y2; a+= pixely * 2.0f) {
+		for (a = y1; a < y2; a += pixely * 2.0f) {
 			fdrawline(x1,  a,  (float)(seq->start),  a);
 		}
 	}
-	if(seq->endstill) {
+	if (seq->endstill) {
 		get_seq_color3ubv(scene, seq, col);
 		UI_GetColorPtrBlendShade3ubv(col, blendcol, col, 0.75, 40);
 		glColor3ubv((GLubyte *)col);
 		
-		draw_shadedstrip(seq, col, (float)(seq->start+seq->len), y1, x2, y2);
+		draw_shadedstrip(seq, col, (float)(seq->start + seq->len), y1, x2, y2);
 		
 		/* feint pinstripes, helps see exactly which is extended and which isn't,
-		* especially when the extension is very small */ 
+		 * especially when the extension is very small */ 
 		if (seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, 24);
 		else UI_GetColorPtrShade3ubv(col, col, -16);
 		
 		glColor3ubv((GLubyte *)col);
 		
-		for(a=y1; a< y2; a+= pixely * 2.0f) {
-			fdrawline((float)(seq->start+seq->len),  a,  x2,  a);
+		for (a = y1; a < y2; a += pixely * 2.0f) {
+			fdrawline((float)(seq->start + seq->len),  a,  x2,  a);
 		}
 	}
 }
@@ -513,68 +521,96 @@ static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float
 {
 	rctf rect;
 	char str[32 + FILE_MAX];
-	const char *name= seq->name+2;
+	const char *name = seq->name + 2;
 	char col[4];
 
 	/* note, all strings should include 'name' */
-	if(name[0]=='\0')
-		name= give_seqname(seq);
+	if (name[0] == '\0')
+		name = give_seqname(seq);
 
-	if(seq->type == SEQ_META || seq->type == SEQ_ADJUSTMENT) {
+	if (seq->type == SEQ_META || seq->type == SEQ_ADJUSTMENT) {
 		BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
 	}
-	else if(seq->type == SEQ_SCENE) {
-		if(seq->scene) {
-			if(seq->scene_camera) {
-				BLI_snprintf(str, sizeof(str), "%d | %s: %s (%s)", seq->len, name, seq->scene->id.name+2, ((ID *)seq->scene_camera)->name+2);
-			} else {
-				BLI_snprintf(str, sizeof(str), "%d | %s: %s", seq->len, name, seq->scene->id.name+2);
+	else if (seq->type == SEQ_SCENE) {
+		if (seq->scene) {
+			if (seq->scene_camera) {
+				BLI_snprintf(str, sizeof(str), "%d | %s: %s (%s)",
+				             seq->len, name, seq->scene->id.name + 2, ((ID *)seq->scene_camera)->name + 2);
 			}
+			else {
+				BLI_snprintf(str, sizeof(str), "%d | %s: %s",
+				             seq->len, name, seq->scene->id.name + 2);
+			}
+		}
+		else {
+			BLI_snprintf(str, sizeof(str), "%d | %s",
+			             seq->len, name);
+		}
+	}
+	else if (seq->type == SEQ_MOVIECLIP) {
+		if (seq->clip && strcmp(name, seq->clip->id.name + 2) != 0) {
+			BLI_snprintf(str, sizeof(str), "%d | %s: %s",
+			             seq->len, name, seq->clip->id.name + 2);
 		}
 		else {
-			BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
+			BLI_snprintf(str, sizeof(str), "%d | %s",
+			             seq->len, name);
 		}
 	}
-	else if(seq->type == SEQ_MULTICAM) {
-		BLI_snprintf(str, sizeof(str), "Cam | %s: %d", name, seq->multicam_source);
+	else if (seq->type == SEQ_MULTICAM) {
+		BLI_snprintf(str, sizeof(str), "Cam | %s: %d",
+		             name, seq->multicam_source);
 	}
-	else if(seq->type == SEQ_IMAGE) {
-		BLI_snprintf(str, sizeof(str), "%d | %s: %s%s", seq->len, name, seq->strip->dir, seq->strip->stripdata->name);
+	else if (seq->type == SEQ_IMAGE) {
+		BLI_snprintf(str, sizeof(str), "%d | %s: %s%s",
+		             seq->len, name, seq->strip->dir, seq->strip->stripdata->name);
 	}
-	else if(seq->type & SEQ_EFFECT) {
-		int can_float = (seq->type != SEQ_PLUGIN)
-			|| (seq->plugin && seq->plugin->version >= 4);
-
-		if(seq->seq3!=seq->seq2 && seq->seq1!=seq->seq3)
-			BLI_snprintf(str, sizeof(str), "%d | %s: %d>%d (use %d)%s", seq->len, name, seq->seq1->machine, seq->seq2->machine, seq->seq3->machine, can_float ? "" : " No float, upgrade plugin!");
-		else if (seq->seq1 && seq->seq2)
-			BLI_snprintf(str, sizeof(str), "%d | %s: %d>%d%s", seq->len, name, seq->seq1->machine, seq->seq2->machine, can_float ? "" : " No float, upgrade plugin!");
-		else
-			BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
+	else if (seq->type & SEQ_EFFECT) {
+		int can_float = (seq->type != SEQ_PLUGIN) || (seq->plugin && seq->plugin->version >= 4);
+
+		if (seq->seq3 != seq->seq2 && seq->seq1 != seq->seq3) {
+			BLI_snprintf(str, sizeof(str), "%d | %s: %d>%d (use %d)%s",
+			             seq->len, name, seq->seq1->machine, seq->seq2->machine, seq->seq3->machine,
+			             can_float ? "" : " No float, upgrade plugin!");
+		}
+		else if (seq->seq1 && seq->seq2) {
+			BLI_snprintf(str, sizeof(str), "%d | %s: %d>%d%s",
+			             seq->len, name, seq->seq1->machine, seq->seq2->machine,
+			             can_float ? "" : " No float, upgrade plugin!");
+		}
+		else {
+			BLI_snprintf(str, sizeof(str), "%d | %s",
+			             seq->len, name);
+		}
 	}
 	else if (seq->type == SEQ_SOUND) {
-		if(seq->sound)
-			BLI_snprintf(str, sizeof(str), "%d | %s: %s", seq->len, name, seq->sound->name);
+		if (seq->sound)
+			BLI_snprintf(str, sizeof(str), "%d | %s: %s",
+			             seq->len, name, seq->sound->name);
 		else
-			BLI_snprintf(str, sizeof(str), "%d | %s", seq->len, name);
+			BLI_snprintf(str, sizeof(str), "%d | %s",
+			             seq->len, name);
 	}
 	else if (seq->type == SEQ_MOVIE) {
-		BLI_snprintf(str, sizeof(str), "%d | %s: %s%s", seq->len, name, seq->strip->dir, seq->strip->stripdata->name);
+		BLI_snprintf(str, sizeof(str), "%d | %s: %s%s",
+		             seq->len, name, seq->strip->dir, seq->strip->stripdata->name);
 	}
 	
-	if(seq->flag & SELECT){
-		col[0]= col[1]= col[2]= 255;
-	}else if ((((int)background_col[0] + (int)background_col[1] + (int)background_col[2]) / 3) < 50){
-		col[0]= col[1]= col[2]= 80; /* use lighter text color for dark background */
-	}else{
-		col[0]= col[1]= col[2]= 0;
+	if (seq->flag & SELECT) {
+		col[0] = col[1] = col[2] = 255;
 	}
-	col[3]= 255;
+	else if ((((int)background_col[0] + (int)background_col[1] + (int)background_col[2]) / 3) < 50) {
+		col[0] = col[1] = col[2] = 80; /* use lighter text color for dark background */
+	}
+	else {
+		col[0] = col[1] = col[2] = 0;
+	}
+	col[3] = 255;
 
-	rect.xmin= x1;
-	rect.ymin= y1;
-	rect.xmax= x2;
-	rect.ymax= y2;
+	rect.xmin = x1;
+	rect.ymin = y1;
+	rect.xmax = x2;
+	rect.ymax = y2;
 	UI_view2d_text_cache_rectf(v2d, &rect, str, col);
 }
 
@@ -588,29 +624,29 @@ static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, floa
 		glPolygonStipple(stipple_halftone);
 	}
 	
-	ymid1 = (y2-y1)*0.25f + y1;
-	ymid2 = (y2-y1)*0.65f + y1;
+	ymid1 = (y2 - y1) * 0.25f + y1;
+	ymid2 = (y2 - y1) * 0.65f + y1;
 	
 	glShadeModel(GL_SMOOTH);
 	glBegin(GL_QUADS);
 	
-	if(seq->flag & SEQ_INVALID_EFFECT) { col[0]= 255; col[1]= 0; col[2]= 255; }
-	else if(seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, -50);
+	if (seq->flag & SEQ_INVALID_EFFECT) { col[0] = 255; col[1] = 0; col[2] = 255; }
+	else if (seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, -50);
 	/* else UI_GetColorPtrShade3ubv(col, col, 0); */ /* DO NOTHING */
 	
 	glColor3ubv(col);
 	
-	glVertex2f(x1,y1);
-	glVertex2f(x2,y1);
+	glVertex2f(x1, y1);
+	glVertex2f(x2, y1);
 
-	if(seq->flag & SEQ_INVALID_EFFECT) { col[0]= 255; col[1]= 0; col[2]= 255; }
-	else if(seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 5);
+	if (seq->flag & SEQ_INVALID_EFFECT) { col[0] = 255; col[1] = 0; col[2] = 255; }
+	else if (seq->flag & SELECT) UI_GetColorPtrBlendShade3ubv(col, col, col, 0.0, 5);
 	else UI_GetColorPtrShade3ubv(col, col, -5);
 
 	glColor3ubv((GLubyte *)col);
 	
-	glVertex2f(x2,ymid1);
-	glVertex2f(x1,ymid1);
+	glVertex2f(x2, ymid1);
+	glVertex2f(x1, ymid1);
 	
 	glEnd();
 	
@@ -618,16 +654,16 @@ static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, floa
 	
 	glBegin(GL_QUADS);
 	
-	glVertex2f(x1,ymid2);
-	glVertex2f(x2,ymid2);
+	glVertex2f(x1, ymid2);
+	glVertex2f(x2, ymid2);
 	
-	if(seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, -15);
+	if (seq->flag & SELECT) UI_GetColorPtrShade3ubv(col, col, -15);
 	else UI_GetColorPtrShade3ubv(col, col, 25);
 	
 	glColor3ubv((GLubyte *)col);
 	
-	glVertex2f(x2,y2);
-	glVertex2f(x1,y2);
+	glVertex2f(x2, y2);
+	glVertex2f(x1, y2);
 	
 	glEnd();
 	
@@ -637,13 +673,13 @@ static void draw_shadedstrip(Sequence *seq, unsigned char col[3], float x1, floa
 }
 
 /*
-Draw a sequence strip, bounds check already made
-ARegion is currently only used to get the windows width in pixels
-so wave file sample drawing precision is zoom adjusted
-*/
+ * Draw a sequence strip, bounds check already made
+ * ARegion is currently only used to get the windows width in pixels
+ * so wave file sample drawing precision is zoom adjusted
+ */
 static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline_tint, float pixelx)
 {
-	View2D *v2d= &ar->v2d;
+	View2D *v2d = &ar->v2d;
 	float x1, x2, y1, y2;
 	unsigned char col[3], background_col[3], is_single_image;
 
@@ -651,23 +687,23 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline
 	is_single_image = (char)seq_single_check(seq);
 	
 	/* body */
-	if(seq->startstill) x1= seq->start;
-	else x1= seq->startdisp;
-	y1= seq->machine+SEQ_STRIP_OFSBOTTOM;
-	if(seq->endstill) x2= seq->start+seq->len;
-	else x2= seq->enddisp;
-	y2= seq->machine+SEQ_STRIP_OFSTOP;
-	
-	
+	x1 = (seq->startstill) ? seq->start : seq->startdisp;
+	y1 = seq->machine + SEQ_STRIP_OFSBOTTOM;
+	x2 = (seq->endstill) ? (seq->start + seq->len) : seq->enddisp;
+	y2 = seq->machine + SEQ_STRIP_OFSTOP;
+
+
 	/* get the correct color per strip type*/
 	//get_seq_color3ubv(scene, seq, col);
 	get_seq_color3ubv(scene, seq, background_col);
 	
 	/* draw the main strip body */
-	if (is_single_image) /* single image */
+	if (is_single_image) {  /* single image */
 		draw_shadedstrip(seq, background_col, seq_tx_get_final_left(seq, 0), y1, seq_tx_get_final_right(seq, 0), y2);
-	else /* normal operation */
+	}
+	else {  /* normal operation */
 		draw_shadedstrip(seq, background_col, x1, y1, x2, y2);
+	}
 	
 	/* draw additional info and controls */
 	if (!is_single_image)
@@ -677,14 +713,16 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline
 	draw_seq_handle(v2d, seq, pixelx, SEQ_RIGHTHANDLE);
 	
 	/* draw the strip outline */
-	x1= seq->startdisp;
-	x2= seq->enddisp;
+	x1 = seq->startdisp;
+	x2 = seq->enddisp;
 	
 	/* draw sound wave */
-	if(seq->type == SEQ_SOUND) drawseqwave(scene, seq, x1, y1, x2, y2, (ar->v2d.cur.xmax - ar->v2d.cur.xmin)/ar->winx);
+	if (seq->type == SEQ_SOUND) {
+		drawseqwave(scene, seq, x1, y1, x2, y2, (ar->v2d.cur.xmax - ar->v2d.cur.xmin) / ar->winx);
+	}
 
 	/* draw lock */
-	if(seq->flag & SEQ_LOCK) {
+	if (seq->flag & SEQ_LOCK) {
 		glEnable(GL_POLYGON_STIPPLE);
 		glEnable(GL_BLEND);
 
@@ -704,11 +742,11 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline
 
 	get_seq_color3ubv(scene, seq, col);
 	if (G.moving && (seq->flag & SELECT)) {
-		if(seq->flag & SEQ_OVERLAP) {
-			col[0]= 255; col[1]= col[2]= 40;
+		if (seq->flag & SEQ_OVERLAP) {
+			col[0] = 255; col[1] = col[2] = 40;
 		}
 		else
-			UI_GetColorPtrShade3ubv(col, col, 120+outline_tint);
+			UI_GetColorPtrShade3ubv(col, col, 120 + outline_tint);
 	}
 	else
 		UI_GetColorPtrShade3ubv(col, col, outline_tint);
@@ -726,47 +764,50 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline
 		glDisable(GL_LINE_STIPPLE);
 	}
 	
-	if(seq->type==SEQ_META) drawmeta_contents(scene, seq, x1, y1, x2, y2);
+	if (seq->type == SEQ_META) {
+		drawmeta_contents(scene, seq, x1, y1, x2, y2);
+	}
 	
 	/* calculate if seq is long enough to print a name */
-	x1= seq->startdisp+seq->handsize;
-	x2= seq->enddisp-seq->handsize;
+	x1 = seq->startdisp + seq->handsize;
+	x2 = seq->enddisp - seq->handsize;
 
 	/* info text on the strip */
-	if(x1<v2d->cur.xmin) x1= v2d->cur.xmin;
-	else if(x1>v2d->cur.xmax) x1= v2d->cur.xmax;
-	if(x2<v2d->cur.xmin) x2= v2d->cur.xmin;
-	else if(x2>v2d->cur.xmax) x2= v2d->cur.xmax;
+	if (x1 < v2d->cur.xmin) x1 = v2d->cur.xmin;
+	else if (x1 > v2d->cur.xmax) x1 = v2d->cur.xmax;
+	if (x2 < v2d->cur.xmin) x2 = v2d->cur.xmin;
+	else if (x2 > v2d->cur.xmax) x2 = v2d->cur.xmax;
 
 	/* nice text here would require changing the view matrix for texture text */
-	if( (x2-x1) / pixelx > 32) {
+	if ((x2 - x1) / pixelx > 32) {
 		draw_seq_text(v2d, seq, x1, x2, y1, y2, background_col);
 	}
 }
 
-static Sequence *special_seq_update= NULL;
+static Sequence *special_seq_update = NULL;
 
-static void UNUSED_FUNCTION(set_special_seq_update)(int val)
+static void UNUSED_FUNCTION(set_special_seq_update) (int val)
 {
 //	int x;
 
 	/* if mouse over a sequence && LEFTMOUSE */
-	if(val) {
+	if (val) {
 // XXX		special_seq_update= find_nearest_seq(&x);
 	}
-	else special_seq_update= NULL;
+	else special_seq_update = NULL;
 }
 
-void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq, int cfra, int frame_ofs)
+void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq, int cfra, int frame_ofs)
 {
-	struct Main *bmain= CTX_data_main(C);
-	struct ImBuf *ibuf= NULL;
-	struct ImBuf *scope= NULL;
+	struct Main *bmain = CTX_data_main(C);
+	struct ImBuf *ibuf = NULL;
+	struct ImBuf *scope = NULL;
 	struct View2D *v2d = &ar->v2d;
 	int rectx, recty;
 	float viewrectx, viewrecty;
 	float render_size = 0.0;
 	float proxy_size = 100.0;
+	float col[3];
 	GLuint texid;
 	GLuint last_texid;
 	SeqRenderData context;
@@ -774,15 +815,16 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
 	render_size = sseq->render_size;
 	if (render_size == 0) {
 		render_size = scene->r.size;
-	} else {
+	}
+	else {
 		proxy_size = render_size;
 	}
 	if (render_size < 0) {
 		return;
 	}
 
-	viewrectx = (render_size*(float)scene->r.xsch)/100.0f;
-	viewrecty = (render_size*(float)scene->r.ysch)/100.0f;
+	viewrectx = (render_size * (float)scene->r.xsch) / 100.0f;
+	viewrecty = (render_size * (float)scene->r.ysch) / 100.0f;
 
 	rectx = viewrectx + 0.5f;
 	recty = viewrecty + 0.5f;
@@ -793,9 +835,9 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
 		viewrecty /= proxy_size / 100.0f;
 	}
 
-	if(frame_ofs == 0) {
-		/* XXX TODO: take color from theme */
-		glClearColor(0.0, 0.0, 0.0, 0.0);
+	if (frame_ofs == 0) {
+		UI_GetThemeColor3fv(TH_SEQ_PREVIEW, col);
+		glClearColor(col[0], col[1], col[2], 0.0);
 		glClear(GL_COLOR_BUFFER_BIT);
 	}
 
@@ -806,43 +848,44 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
 	UI_view2d_curRect_validate(v2d);
 
 	/* only initialize the preview if a render is in progress */
-	if(G.rendering)
+	if (G.rendering)
 		return;
 
 	context = seq_new_render_data(bmain, scene, rectx, recty, proxy_size);
 
 	if (special_seq_update)
-		ibuf= give_ibuf_seq_direct(context, cfra + frame_ofs, special_seq_update);
+		ibuf = give_ibuf_seq_direct(context, cfra + frame_ofs, special_seq_update);
 	else if (!U.prefetchframes) // XXX || (G.f & G_PLAYANIM) == 0) {
-		ibuf= (ImBuf *)give_ibuf_seq(context, cfra + frame_ofs, sseq->chanshown);
+		ibuf = give_ibuf_seq(context, cfra + frame_ofs, sseq->chanshown);
 	else
-		ibuf= (ImBuf *)give_ibuf_seq_threaded(context, cfra + frame_ofs, sseq->chanshown);
+		ibuf = give_ibuf_seq_threaded(context, cfra + frame_ofs, sseq->chanshown);
 	
-	if(ibuf==NULL) 
+	if (ibuf == NULL)
 		return;
 
-	if(ibuf->rect==NULL && ibuf->rect_float == NULL) 
+	if (ibuf->rect == NULL && ibuf->rect_float == NULL)
 		return;
 	
-	switch(sseq->mainb) {
-	case SEQ_DRAW_IMG_IMBUF:
-		if (sseq->zebra != 0) {
-			scope = make_zebra_view_from_ibuf(ibuf, sseq->zebra);
-		}
-		break;
-	case SEQ_DRAW_IMG_WAVEFORM:
-		if ((sseq->flag & SEQ_DRAW_COLOR_SEPERATED) != 0) {
-			scope = make_sep_waveform_view_from_ibuf(ibuf);
-		} else {
-			scope = make_waveform_view_from_ibuf(ibuf);
-		}
-		break;
-	case SEQ_DRAW_IMG_VECTORSCOPE:
-		scope = make_vectorscope_view_from_ibuf(ibuf);
-		break;
-	case SEQ_DRAW_IMG_HISTOGRAM:
-		scope = make_histogram_view_from_ibuf(ibuf);
-		break;
+	switch (sseq->mainb) {
+		case SEQ_DRAW_IMG_IMBUF:
+			if (sseq->zebra != 0) {
+				scope = make_zebra_view_from_ibuf(ibuf, sseq->zebra);
+			}
+			break;
+		case SEQ_DRAW_IMG_WAVEFORM:
+			if ((sseq->flag & SEQ_DRAW_COLOR_SEPARATED) != 0) {
+				scope = make_sep_waveform_view_from_ibuf(ibuf);
+			}
+			else {
+				scope = make_waveform_view_from_ibuf(ibuf);
+			}
+			break;
+		case SEQ_DRAW_IMG_VECTORSCOPE:
+			scope = make_vectorscope_view_from_ibuf(ibuf);
+			break;
+		case SEQ_DRAW_IMG_HISTOGRAM:
+			scope = make_histogram_view_from_ibuf(ibuf);
+			break;
 	}
 
 	if (scope) {
@@ -850,14 +893,14 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
 		ibuf = scope;
 	}
 
-	if(ibuf->rect_float && ibuf->rect==NULL) {
+	if (ibuf->rect_float && ibuf->rect == NULL) {
 		IMB_rect_from_float(ibuf);	
 	}
 	
 	/* setting up the view - actual drawing starts here */
 	UI_view2d_view_ortho(v2d);
 
-	last_texid= glaGetOneInteger(GL_TEXTURE_2D);
+	last_texid = glaGetOneInteger(GL_TEXTURE_2D);
 	glEnable(GL_TEXTURE_2D);
 	glGenTextures(1, (GLuint *)&texid);
 
@@ -869,30 +912,30 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
 	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, ibuf->x, ibuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
 	glBegin(GL_QUADS);
 
-	if(frame_ofs) {
+	if (frame_ofs) {
 		rctf tot_clip;
-		tot_clip.xmin= v2d->tot.xmin + (ABS(v2d->tot.xmax - v2d->tot.xmin) * scene->ed->over_border.xmin);
-		tot_clip.ymin= v2d->tot.ymin + (ABS(v2d->tot.ymax - v2d->tot.ymin) * scene->ed->over_border.ymin);
-		tot_clip.xmax= v2d->tot.xmin + (ABS(v2d->tot.xmax - v2d->tot.xmin) * scene->ed->over_border.xmax);
-		tot_clip.ymax= v2d->tot.ymin + (ABS(v2d->tot.ymax - v2d->tot.ymin) * scene->ed->over_border.ymax);
-
-		glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymin);glVertex2f(tot_clip.xmin, tot_clip.ymin);
-		glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymax);glVertex2f(tot_clip.xmin, tot_clip.ymax);
-		glTexCoord2f(scene->ed->over_border.xmax, scene->ed->over_border.ymax);glVertex2f(tot_clip.xmax, tot_clip.ymax);
-		glTexCoord2f(scene->ed->over_border.xmax, scene->ed->over_border.ymin);glVertex2f(tot_clip.xmax, tot_clip.ymin);
+		tot_clip.xmin = v2d->tot.xmin + (ABS(v2d->tot.xmax - v2d->tot.xmin) * scene->ed->over_border.xmin);
+		tot_clip.ymin = v2d->tot.ymin + (ABS(v2d->tot.ymax - v2d->tot.ymin) * scene->ed->over_border.ymin);
+		tot_clip.xmax = v2d->tot.xmin + (ABS(v2d->tot.xmax - v2d->tot.xmin) * scene->ed->over_border.xmax);
+		tot_clip.ymax = v2d->tot.ymin + (ABS(v2d->tot.ymax - v2d->tot.ymin) * scene->ed->over_border.ymax);
+
+		glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymin); glVertex2f(tot_clip.xmin, tot_clip.ymin);
+		glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymax); glVertex2f(tot_clip.xmin, tot_clip.ymax);
+		glTexCoord2f(scene->ed->over_border.xmax, scene->ed->over_border.ymax); glVertex2f(tot_clip.xmax, tot_clip.ymax);
+		glTexCoord2f(scene->ed->over_border.xmax, scene->ed->over_border.ymin); glVertex2f(tot_clip.xmax, tot_clip.ymin);
 	}
 	else {
-		glTexCoord2f(0.0f, 0.0f);glVertex2f(v2d->tot.xmin, v2d->tot.ymin);
-		glTexCoord2f(0.0f, 1.0f);glVertex2f(v2d->tot.xmin, v2d->tot.ymax);
-		glTexCoord2f(1.0f, 1.0f);glVertex2f(v2d->tot.xmax, v2d->tot.ymax);
-		glTexCoord2f(1.0f, 0.0f);glVertex2f(v2d->tot.xmax, v2d->tot.ymin);
+		glTexCoord2f(0.0f, 0.0f); glVertex2f(v2d->tot.xmin, v2d->tot.ymin);
+		glTexCoord2f(0.0f, 1.0f); glVertex2f(v2d->tot.xmin, v2d->tot.ymax);
+		glTexCoord2f(1.0f, 1.0f); glVertex2f(v2d->tot.xmax, v2d->tot.ymax);
+		glTexCoord2f(1.0f, 0.0f); glVertex2f(v2d->tot.xmax, v2d->tot.ymin);
 	}
 	glEnd( );
 	glBindTexture(GL_TEXTURE_2D, last_texid);
 	glDisable(GL_TEXTURE_2D);
 	glDeleteTextures(1, &texid);
 
-	if(sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
+	if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
 
 		float x1 = v2d->tot.xmin;
 		float y1 = v2d->tot.ymin;
@@ -905,23 +948,23 @@ void draw_image_seq(const bContext* C, Scene *scene, ARegion *ar, SpaceSeq *sseq
 		UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 1.0, 0);
 
 		glBegin(GL_LINE_LOOP);
-		glVertex2f(x1-0.5f, y1-0.5f);
-		glVertex2f(x1-0.5f, y2+0.5f);
-		glVertex2f(x2+0.5f, y2+0.5f);
-		glVertex2f(x2+0.5f, y1-0.5f);
+		glVertex2f(x1 - 0.5f, y1 - 0.5f);
+		glVertex2f(x1 - 0.5f, y2 + 0.5f);
+		glVertex2f(x2 + 0.5f, y2 + 0.5f);
+		glVertex2f(x2 + 0.5f, y1 - 0.5f);
 		glEnd();
 
 		/* safety border */
 		if ((sseq->flag & SEQ_DRAW_SAFE_MARGINS) != 0) {
-			float fac= 0.1;
+			float fac = 0.1;
 
-			float a= fac*(x2-x1);
-			x1+= a;
-			x2-= a;
+			float a = fac * (x2 - x1);
+			x1 += a;
+			x2 -= a;
 
-			a= fac*(y2-y1);
-			y1+= a;
-			y2-= a;
+			a = fac * (y2 - y1);
+			y1 += a;
+			y2 -= a;
 
 			glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
 
@@ -957,20 +1000,21 @@ void drawprefetchseqspace(Scene *scene, ARegion *UNUSED(ar), SpaceSeq *sseq)
 	int proxy_size = 100.0; 
 	if (render_size == 0) {
 		render_size = scene->r.size;
-	} else {
+	}
+	else {
 		proxy_size = render_size;
 	}
 	if (render_size < 0) {
 		return;
 	}
 
-	rectx= (render_size*scene->r.xsch)/100;
-	recty= (render_size*scene->r.ysch)/100;
+	rectx = (render_size * scene->r.xsch) / 100;
+	recty = (render_size * scene->r.ysch) / 100;
 
-	if(sseq->mainb != SEQ_DRAW_SEQUENCE) {
+	if (sseq->mainb != SEQ_DRAW_SEQUENCE) {
 		give_ibuf_prefetch_request(
-			rectx, recty, (scene->r.cfra), sseq->chanshown,
-			proxy_size);
+		    rectx, recty, (scene->r.cfra), sseq->chanshown,
+		    proxy_size);
 	}
 }
 #endif
@@ -985,60 +1029,60 @@ static void draw_seq_backdrop(View2D *v2d)
 	glRectf(v2d->cur.xmin,  -1.0,  v2d->cur.xmax,  1.0);
 
 	/* Alternating horizontal stripes */
-	i= MAX2(1, ((int)v2d->cur.ymin)-1);
+	i = MAX2(1, ((int)v2d->cur.ymin) - 1);
 
 	glBegin(GL_QUADS);
-		while (i<v2d->cur.ymax) {
-			if (((int)i) & 1)
-				UI_ThemeColorShade(TH_BACK, -15);
-			else
-				UI_ThemeColorShade(TH_BACK, -25);
-			
-			glVertex2f(v2d->cur.xmax, i);
-			glVertex2f(v2d->cur.xmin, i);
-			glVertex2f(v2d->cur.xmin, i+1);
-			glVertex2f(v2d->cur.xmax, i+1);
+	while (i < v2d->cur.ymax) {
+		if (((int)i) & 1)
+			UI_ThemeColorShade(TH_BACK, -15);
+		else
+			UI_ThemeColorShade(TH_BACK, -25);
 			
-			i+=1.0;
-		}
+		glVertex2f(v2d->cur.xmax, i);
+		glVertex2f(v2d->cur.xmin, i);
+		glVertex2f(v2d->cur.xmin, i + 1);
+		glVertex2f(v2d->cur.xmax, i + 1);
+
+		i += 1.0;
+	}
 	glEnd();
 	
 	/* Darker lines separating the horizontal bands */
-	i= MAX2(1, ((int)v2d->cur.ymin)-1);
+	i = MAX2(1, ((int)v2d->cur.ymin) - 1);
 	UI_ThemeColor(TH_GRID);
 	
 	glBegin(GL_LINES);
-		while (i < v2d->cur.ymax) {
-			glVertex2f(v2d->cur.xmax, i);
-			glVertex2f(v2d->cur.xmin, i);
+	while (i < v2d->cur.ymax) {
+		glVertex2f(v2d->cur.xmax, i);
+		glVertex2f(v2d->cur.xmin, i);
 			
-			i+=1.0;
-		}
+		i += 1.0;
+	}
 	glEnd();
 }
 
 /* draw the contents of the sequencer strips view */
 static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar)
 {
-	Scene *scene= CTX_data_scene(C);
-	View2D *v2d= &ar->v2d;
+	Scene *scene = CTX_data_scene(C);
+	View2D *v2d = &ar->v2d;
 	Sequence *last_seq = seq_active_get(scene);
 	int sel = 0, j;
-	float pixelx = (v2d->cur.xmax - v2d->cur.xmin)/(v2d->mask.xmax - v2d->mask.xmin);
+	float pixelx = (v2d->cur.xmax - v2d->cur.xmin) / (v2d->mask.xmax - v2d->mask.xmin);
 	
 	/* loop through twice, first unselected, then selected */
-	for (j=0; j<2; j++) {
+	for (j = 0; j < 2; j++) {
 		Sequence *seq;
-		int outline_tint= (j) ? -60 : -150; /* highlighting around strip edges indicating selection */
+		int outline_tint = (j) ? -60 : -150; /* highlighting around strip edges indicating selection */
 		
 		/* loop through strips, checking for those that are visible */
-		for (seq= ed->seqbasep->first; seq; seq= seq->next) {
+		for (seq = ed->seqbasep->first; seq; seq = seq->next) {
 			/* 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 (seq->machine+1.0f < v2d->cur.ymin) continue;
+			else if (MAX2(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;
 			
 			/* strip passed all tests unscathed... so draw it now */
@@ -1046,7 +1090,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar)
 		}
 		
 		/* draw selected next time round */
-		sel= SELECT; 
+		sel = SELECT;
 	}
 	
 	/* draw the last selected last (i.e. 'active' in other parts of Blender), removes some overlapping error */
@@ -1081,18 +1125,18 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d)
 /* Draw Timeline/Strip Editor Mode for Sequencer */
 void draw_timeline_seq(const bContext *C, ARegion *ar)
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
-	SpaceSeq *sseq= CTX_wm_space_seq(C);
-	View2D *v2d= &ar->v2d;
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
+	SpaceSeq *sseq = CTX_wm_space_seq(C);
+	View2D *v2d = &ar->v2d;
 	View2DScrollers *scrollers;
-	short unit=0, flag=0;
+	short unit = 0, flag = 0;
 	float col[3];
 	
 	/* clear and setup matrix */
 	UI_GetThemeColor3fv(TH_BACK, col);
 	if (ed && ed->metastack.first) 
-		glClearColor(col[0], col[1], col[2]-0.1f, 0.0f);
+		glClearColor(col[0], col[1], col[2] - 0.1f, 0.0f);
 	else 
 		glClearColor(col[0], col[1], col[2], 0.0f);
 	glClear(GL_COLOR_BUFFER_BIT);
@@ -1113,7 +1157,7 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
 	// NOTE: the gridlines are currently spaced every 25 frames, which is only fine for 25 fps, but maybe not for 30...
 	UI_view2d_constant_grid_draw(v2d);
 	
-	seq_draw_sfra_efra(scene, v2d);	
+	seq_draw_sfra_efra(scene, v2d);
 
 	/* sequence strips (if there is data available to be drawn) */
 	if (ed) {
@@ -1126,8 +1170,8 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
 	
 	/* current frame */
 	UI_view2d_view_ortho(v2d);
-	if ((sseq->flag & SEQ_DRAWFRAMES)==0) 	flag |= DRAWCFRA_UNIT_SECONDS;
-	if ((sseq->flag & SEQ_NO_DRAW_CFRANUM)==0)  flag |= DRAWCFRA_SHOW_NUMBOX;
+	if ((sseq->flag & SEQ_DRAWFRAMES) == 0)      flag |= DRAWCFRA_UNIT_SECONDS;
+	if ((sseq->flag & SEQ_NO_DRAW_CFRANUM) == 0) flag |= DRAWCFRA_SHOW_NUMBOX;
 	ANIM_draw_cfra(C, v2d, flag);
 	
 	/* markers */
@@ -1139,14 +1183,14 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
 	ANIM_draw_previewrange(C, v2d);
 
 	/* overlap playhead */
-	if(scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW) {
-		int cfra_over= (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) ? scene->ed->over_cfra : scene->r.cfra + scene->ed->over_ofs;
+	if (scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW) {
+		int cfra_over = (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS) ? scene->ed->over_cfra : scene->r.cfra + scene->ed->over_ofs;
 		glColor3f(0.2, 0.2, 0.2);
 		// glRectf(cfra_over, v2d->cur.ymin, scene->ed->over_ofs + scene->r.cfra + 1, v2d->cur.ymax);
 
 		glBegin(GL_LINES);
-			glVertex2f(cfra_over, v2d->cur.ymin);
-			glVertex2f(cfra_over, v2d->cur.ymax);
+		glVertex2f(cfra_over, v2d->cur.ymin);
+		glVertex2f(cfra_over, v2d->cur.ymax);
 		glEnd();
 
 	}
@@ -1155,8 +1199,8 @@ void draw_timeline_seq(const bContext *C, ARegion *ar)
 	UI_view2d_view_restore(C);
 
 	/* scrollers */
-	unit= (sseq->flag & SEQ_DRAWFRAMES)? V2D_UNIT_FRAMES : V2D_UNIT_SECONDSSEQ;
-	scrollers= UI_view2d_scrollers_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_UNIT_VALUES, V2D_GRID_CLAMP);
+	unit = (sseq->flag & SEQ_DRAWFRAMES) ? V2D_UNIT_FRAMES : V2D_UNIT_SECONDSSEQ;
+	scrollers = UI_view2d_scrollers_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_UNIT_VALUES, V2D_GRID_CLAMP);
 	UI_view2d_scrollers_draw(C, v2d, scrollers);
 	UI_view2d_scrollers_free(scrollers);
 }
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index ef1c86b..bd306f2 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -55,6 +55,9 @@
 #include "BKE_sequencer.h"
 #include "BKE_report.h"
 #include "BKE_sound.h"
+#include "BKE_movieclip.h"
+
+#include "IMB_imbuf.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
@@ -73,9 +76,6 @@
 /* own include */
 #include "sequencer_intern.h"
 
-static int okee(const char *UNUSED(dummy)) {return 0;}
-
-
 /* XXX */
 /* RNA Enums, used in multiple files */
 EnumPropertyItem sequencer_prop_effect_types[] = {
@@ -129,22 +129,16 @@ typedef struct TransSeq {
 
 typedef struct ProxyBuildJob {
 	Scene *scene; 
-	struct Main * main;
+	struct Main *main;
 	ListBase queue;
-	ThreadMutex queue_lock;
+	int stop;
 } ProxyJob;
 
 static void proxy_freejob(void *pjv)
 {
-	ProxyJob *pj= pjv;
-	Sequence * seq;
-
-	for (seq = pj->queue.first; seq; seq = seq->next) {
-		BLI_remlink(&pj->queue, seq);
-		seq_free_sequence_recurse(pj->scene, seq);
-	}
+	ProxyJob *pj = pjv;
 
-	BLI_mutex_end(&pj->queue_lock);
+	BLI_freelistN(&pj->queue);
 
 	MEM_freeN(pj);
 }
@@ -153,70 +147,69 @@ static void proxy_freejob(void *pjv)
 static void proxy_startjob(void *pjv, short *stop, short *do_update, float *progress)
 {
 	ProxyJob *pj = pjv;
+	LinkData *link;
 
-	while (!*stop) {
-		Sequence * seq;
-
-		BLI_mutex_lock(&pj->queue_lock);
-		
-		if (!pj->queue.first) {
-			BLI_mutex_unlock(&pj->queue_lock);
-			break;
-		}
-
-		seq = pj->queue.first;
-
-		BLI_remlink(&pj->queue, seq);
-		BLI_mutex_unlock(&pj->queue_lock);
+	for (link = pj->queue.first; link; link = link->next) {
+		struct SeqIndexBuildContext *context = link->data;
 
-		seq_proxy_rebuild(pj->main, pj->scene, seq, 
-		                  stop, do_update, progress);
-		seq_free_sequence_recurse(pj->scene, seq);
+		seq_proxy_rebuild(context, stop, do_update, progress);
 	}
 
 	if (*stop) {
-		fprintf(stderr, 
-			"Canceling proxy rebuild on users request...\n");
+		pj->stop = 1;
+		fprintf(stderr,  "Canceling proxy rebuild on users request...\n");
 	}
 }
 
-static void proxy_endjob(void *UNUSED(customdata))
+static void proxy_endjob(void *pjv)
 {
+	ProxyJob *pj = pjv;
+	Editing *ed = seq_give_editing(pj->scene, FALSE);
+	LinkData *link;
+
+	for (link = pj->queue.first; link; link = link->next) {
+		seq_proxy_rebuild_finish(link->data, pj->stop);
+	}
 
+	free_imbuf_seq(pj->scene, &ed->seqbase, FALSE, FALSE);
+
+	WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, pj->scene);
 }
 
-static void seq_proxy_build_job(const bContext *C, Sequence * seq)
+static void seq_proxy_build_job(const bContext *C)
 {
-	wmJob * steve;
+	wmJob *steve;
 	ProxyJob *pj;
-	Scene *scene= CTX_data_scene(C);
-	ScrArea * sa= CTX_wm_area(C);
-
-	seq = seq_dupli_recursive(scene, scene, seq, 0);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
+	ScrArea *sa = CTX_wm_area(C);
+	struct SeqIndexBuildContext *context;
+	LinkData *link;
+	Sequence *seq;
 
-	steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), 
-	                    sa, "Building Proxies", WM_JOB_PROGRESS);
+	steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Building Proxies", WM_JOB_PROGRESS);
 
 	pj = WM_jobs_get_customdata(steve);
 
 	if (!pj) {
 		pj = MEM_callocN(sizeof(ProxyJob), "proxy rebuild job");
 	
-		pj->scene= scene;
+		pj->scene = scene;
 		pj->main = CTX_data_main(C);
 
-		BLI_mutex_init(&pj->queue_lock);
-
 		WM_jobs_customdata(steve, pj, proxy_freejob);
-		WM_jobs_timer(steve, 0.1, NC_SCENE|ND_SEQUENCER,
-		              NC_SCENE|ND_SEQUENCER);
-		WM_jobs_callbacks(steve, proxy_startjob, NULL, NULL,
-		                  proxy_endjob);
+		WM_jobs_timer(steve, 0.1, NC_SCENE | ND_SEQUENCER, NC_SCENE | ND_SEQUENCER);
+		WM_jobs_callbacks(steve, proxy_startjob, NULL, NULL, proxy_endjob);
 	}
 
-	BLI_mutex_lock(&pj->queue_lock);
-	BLI_addtail(&pj->queue, seq);
-	BLI_mutex_unlock(&pj->queue_lock);
+	SEQP_BEGIN(ed, seq) {
+		if ((seq->flag & SELECT)) {
+			context = seq_proxy_rebuild_context(pj->main, pj->scene, seq);
+			link = BLI_genericNodeN(context);
+			BLI_addtail(&pj->queue, link);
+		}
+	}
+	SEQ_END
 
 	if (!WM_jobs_is_running(steve)) {
 		G.afbreek = 0;
@@ -230,21 +223,21 @@ static void seq_proxy_build_job(const bContext *C, Sequence * seq)
 
 void seq_rectf(Sequence *seq, rctf *rectf)
 {
-	if(seq->startstill) rectf->xmin= seq->start;
-	else rectf->xmin= seq->startdisp;
-	rectf->ymin= seq->machine+SEQ_STRIP_OFSBOTTOM;
-	if(seq->endstill) rectf->xmax= seq->start+seq->len;
-	else rectf->xmax= seq->enddisp;
-	rectf->ymax= seq->machine+SEQ_STRIP_OFSTOP;
+	if (seq->startstill) rectf->xmin = seq->start;
+	else rectf->xmin = seq->startdisp;
+	rectf->ymin = seq->machine + SEQ_STRIP_OFSBOTTOM;
+	if (seq->endstill) rectf->xmax = seq->start + seq->len;
+	else rectf->xmax = seq->enddisp;
+	rectf->ymax = seq->machine + SEQ_STRIP_OFSTOP;
 }
 
-static void UNUSED_FUNCTION(change_plugin_seq)(Scene *scene, char *str) /* called from fileselect */
+static void UNUSED_FUNCTION(change_plugin_seq) (Scene * scene, char *str) /* called from fileselect */
 {
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	struct SeqEffectHandle sh;
-	Sequence *last_seq= seq_active_get(scene);
+	Sequence *last_seq = seq_active_get(scene);
 
-	if(last_seq==NULL || last_seq->type != SEQ_PLUGIN) return;
+	if (last_seq == NULL || last_seq->type != SEQ_PLUGIN) return;
 
 	sh = get_sequence_effect(last_seq);
 	sh.free(last_seq);
@@ -254,7 +247,7 @@ static void UNUSED_FUNCTION(change_plugin_seq)(Scene *scene, char *str) /* calle
 	                         last_seq->seq2->machine,
 	                         last_seq->seq3->machine);
 
-	if( seq_test_overlap(ed->seqbasep, last_seq) ) shuffle_seq(ed->seqbasep, last_seq, scene);
+	if (seq_test_overlap(ed->seqbasep, last_seq) ) shuffle_seq(ed->seqbasep, last_seq, scene);
 	
 }
 
@@ -262,41 +255,41 @@ static void UNUSED_FUNCTION(change_plugin_seq)(Scene *scene, char *str) /* calle
 void boundbox_seq(Scene *scene, rctf *rect)
 {
 	Sequence *seq;
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	float min[2], max[2];
 
 	
-	if(ed==NULL) return;
+	if (ed == NULL) return;
 
-	min[0]= 0.0;
-	max[0]= EFRA+1;
-	min[1]= 0.0;
-	max[1]= 8.0;
+	min[0] = 0.0;
+	max[0] = EFRA + 1;
+	min[1] = 0.0;
+	max[1] = 8.0;
 
-	seq= ed->seqbasep->first;
-	while(seq) {
+	seq = ed->seqbasep->first;
+	while (seq) {
 
-		if( min[0] > seq->startdisp-1) min[0]= seq->startdisp-1;
-		if( max[0] < seq->enddisp+1) max[0]= seq->enddisp+1;
-		if( max[1] < seq->machine+2) max[1]= seq->machine+2;
+		if (min[0] > seq->startdisp - 1) min[0] = seq->startdisp - 1;
+		if (max[0] < seq->enddisp + 1) max[0] = seq->enddisp + 1;
+		if (max[1] < seq->machine + 2) max[1] = seq->machine + 2;
 
-		seq= seq->next;
+		seq = seq->next;
 	}
 
-	rect->xmin= min[0];
-	rect->xmax= max[0];
-	rect->ymin= min[1];
-	rect->ymax= max[1];
+	rect->xmin = min[0];
+	rect->xmax = max[0];
+	rect->ymin = min[1];
+	rect->ymax = max[1];
 
 }
 
-static int mouse_frame_side(View2D *v2d, short mouse_x, int frame ) 
+static int mouse_frame_side(View2D *v2d, short mouse_x, int frame)
 {
 	int mval[2];
 	float mouseloc[2];
 	
-	mval[0]= mouse_x;
-	mval[1]= 0;
+	mval[0] = mouse_x;
+	mval[1] = 0;
 	
 	/* choose the side based on which side of the playhead the mouse is on */
 	UI_view2d_region_to_view(v2d, mval[0], mval[1], &mouseloc[0], &mouseloc[1]);
@@ -309,28 +302,28 @@ Sequence *find_neighboring_sequence(Scene *scene, Sequence *test, int lr, int se
 {
 	/* sel - 0==unselected, 1==selected, -1==done care*/
 	Sequence *seq;
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Editing *ed = seq_give_editing(scene, FALSE);
 
-	if(ed==NULL) return NULL;
+	if (ed == NULL) return NULL;
 
-	if (sel>0) sel = SELECT;
+	if (sel > 0) sel = SELECT;
 	
-	for(seq= ed->seqbasep->first; seq; seq= seq->next) {
-		if(	(seq!=test) &&
-			(test->machine==seq->machine) &&
-			((sel == -1) || (sel && (seq->flag & SELECT)) || (sel==0 && (seq->flag & SELECT)==0)  ))
+	for (seq = ed->seqbasep->first; seq; seq = seq->next) {
+		if ((seq != test) &&
+		    (test->machine == seq->machine) &&
+		    ((sel == -1) || (sel && (seq->flag & SELECT)) || (sel == 0 && (seq->flag & SELECT) == 0)  ))
 		{
 			switch (lr) {
-			case SEQ_SIDE_LEFT:
-				if (test->startdisp == (seq->enddisp)) {
-					return seq;
-				}
-				break;
-			case SEQ_SIDE_RIGHT:
-				if (test->enddisp == (seq->startdisp)) {
-					return seq;
-				}
-				break;
+				case SEQ_SIDE_LEFT:
+					if (test->startdisp == (seq->enddisp)) {
+						return seq;
+					}
+					break;
+				case SEQ_SIDE_RIGHT:
+					if (test->enddisp == (seq->startdisp)) {
+						return seq;
+					}
+					break;
 			}
 		}
 	}
@@ -340,46 +333,47 @@ Sequence *find_neighboring_sequence(Scene *scene, Sequence *test, int lr, int se
 static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, int sel) 
 {
 	/* sel - 0==unselected, 1==selected, -1==done care*/
-	Sequence *seq,*best_seq = NULL;
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Sequence *seq, *best_seq = NULL;
+	Editing *ed = seq_give_editing(scene, FALSE);
 	
 	int dist, best_dist;
-	best_dist = MAXFRAME*2;
+	best_dist = MAXFRAME * 2;
 
 	
-	if(ed==NULL) return NULL;
+	if (ed == NULL) return NULL;
 
-	seq= ed->seqbasep->first;
-	while(seq) {
-		if(		(seq!=test) &&
-				(test->machine==seq->machine) &&
-				(test->depth==seq->depth) &&
-				((sel == -1) || (sel==(seq->flag & SELECT))))
+	seq = ed->seqbasep->first;
+	while (seq) {
+		if ((seq != test) &&
+		    (test->machine == seq->machine) &&
+		    (test->depth == seq->depth) &&
+		    ((sel == -1) || (sel == (seq->flag & SELECT))))
 		{
-			dist = MAXFRAME*2;
+			dist = MAXFRAME * 2;
 			
 			switch (lr) {
-			case SEQ_SIDE_LEFT:
-				if (seq->enddisp <= test->startdisp) {
-					dist = test->enddisp - seq->startdisp;
-				}
-				break;
-			case SEQ_SIDE_RIGHT:
-				if (seq->startdisp >= test->enddisp) {
-					dist = seq->startdisp - test->enddisp;
-				}
-				break;
+				case SEQ_SIDE_LEFT:
+					if (seq->enddisp <= test->startdisp) {
+						dist = test->enddisp - seq->startdisp;
+					}
+					break;
+				case SEQ_SIDE_RIGHT:
+					if (seq->startdisp >= test->enddisp) {
+						dist = seq->startdisp - test->enddisp;
+					}
+					break;
 			}
 			
-			if (dist==0) {
+			if (dist == 0) {
 				best_seq = seq;
 				break;
-			} else if (dist < best_dist) {
+			}
+			else if (dist < best_dist) {
 				best_dist = dist;
 				best_seq = seq;
 			}
 		}
-		seq= seq->next;
+		seq = seq->next;
 	}
 	return best_seq; /* can be null */
 }
@@ -388,55 +382,56 @@ static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, i
 Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[2])
 {
 	Sequence *seq;
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	float x, y;
 	float pixelx;
 	float handsize;
 	float displen;
-	*hand= SEQ_SIDE_NONE;
+	*hand = SEQ_SIDE_NONE;
 
 	
-	if(ed==NULL) return NULL;
+	if (ed == NULL) return NULL;
 	
-	pixelx = (v2d->cur.xmax - v2d->cur.xmin)/(v2d->mask.xmax - v2d->mask.xmin);
+	pixelx = (v2d->cur.xmax - v2d->cur.xmin) / (v2d->mask.xmax - v2d->mask.xmin);
 
 	UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y);
 	
-	seq= ed->seqbasep->first;
+	seq = ed->seqbasep->first;
 	
-	while(seq) {
-		if(seq->machine == (int)y) {
+	while (seq) {
+		if (seq->machine == (int)y) {
 			/* check for both normal strips, and strips that have been flipped horizontally */
-			if( ((seq->startdisp < seq->enddisp) && (seq->startdisp<=x && seq->enddisp>=x)) ||
-				((seq->startdisp > seq->enddisp) && (seq->startdisp>=x && seq->enddisp<=x)) )
+			if ( ((seq->startdisp < seq->enddisp) && (seq->startdisp <= x && seq->enddisp >= x)) ||
+			     ((seq->startdisp > seq->enddisp) && (seq->startdisp >= x && seq->enddisp <= x)) )
 			{
-				if(seq_tx_test(seq)) {
+				if (seq_tx_test(seq)) {
 					
 					/* clamp handles to defined size in pixel space */
 					
 					handsize = seq->handsize;
 					displen = (float)abs(seq->startdisp - seq->enddisp);
 					
-					if (displen / pixelx > 16) { /* dont even try to grab the handles of small strips */
+					if (displen / pixelx > 16) { /* don't even try to grab the handles of small strips */
 						/* Set the max value to handle to 1/3 of the total len when its less then 28.
-						* This is important because otherwise selecting handles happens even when you click in the middle */
+						 * This is important because otherwise selecting handles happens even when you click in the middle */
 						
-						if ((displen/3) < 30*pixelx) {
-							handsize = displen/3;
-						} else {
-							CLAMP(handsize, 7*pixelx, 30*pixelx);
+						if ((displen / 3) < 30 * pixelx) {
+							handsize = displen / 3;
+						}
+						else {
+							CLAMP(handsize, 7 * pixelx, 30 * pixelx);
 						}
 						
-						if( handsize+seq->startdisp >=x )
-							*hand= SEQ_SIDE_LEFT;
-						else if( -handsize+seq->enddisp <=x )
-							*hand= SEQ_SIDE_RIGHT;
+						if (handsize + seq->startdisp >= x)
+							*hand = SEQ_SIDE_LEFT;
+						else if (-handsize + seq->enddisp <= x)
+							*hand = SEQ_SIDE_RIGHT;
 					}
 				}
 				return seq;
 			}
 		}
-		seq= seq->next;
+		seq = seq->next;
 	}
 	return NULL;
 }
@@ -450,11 +445,11 @@ static int seq_is_parent(Sequence *par, Sequence *seq)
 static int seq_is_predecessor(Sequence *pred, Sequence *seq)
 {
 	if (!pred) return 0;
-	if(pred == seq) return 0;
-	else if(seq_is_parent(pred, seq)) return 1;
-	else if(pred->seq1 && seq_is_predecessor(pred->seq1, seq)) return 1;
-	else if(pred->seq2 && seq_is_predecessor(pred->seq2, seq)) return 1;
-	else if(pred->seq3 && seq_is_predecessor(pred->seq3, seq)) return 1;
+	if (pred == seq) return 0;
+	else if (seq_is_parent(pred, seq)) return 1;
+	else if (pred->seq1 && seq_is_predecessor(pred->seq1, seq)) return 1;
+	else if (pred->seq2 && seq_is_predecessor(pred->seq2, seq)) return 1;
+	else if (pred->seq3 && seq_is_predecessor(pred->seq3, seq)) return 1;
 
 	return 0;
 }
@@ -462,12 +457,13 @@ static int seq_is_predecessor(Sequence *pred, Sequence *seq)
 void deselect_all_seq(Scene *scene)
 {
 	Sequence *seq;
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Editing *ed = seq_give_editing(scene, FALSE);
 
 	
-	if(ed==NULL) return;
+	if (ed == NULL) return;
 
-	SEQP_BEGIN(ed, seq) {
+	SEQP_BEGIN(ed, seq)
+	{
 		seq->flag &= ~SEQ_ALLSEL;
 	}
 	SEQ_END
@@ -478,49 +474,49 @@ void recurs_sel_seq(Sequence *seqm)
 {
 	Sequence *seq;
 
-	seq= seqm->seqbase.first;
-	while(seq) {
+	seq = seqm->seqbase.first;
+	while (seq) {
 
-		if(seqm->flag & (SEQ_LEFTSEL+SEQ_RIGHTSEL)) seq->flag &= ~SEQ_ALLSEL;
-		else if(seqm->flag & SELECT) seq->flag |= SELECT;
+		if (seqm->flag & (SEQ_LEFTSEL + SEQ_RIGHTSEL)) seq->flag &= ~SEQ_ALLSEL;
+		else if (seqm->flag & SELECT) seq->flag |= SELECT;
 		else seq->flag &= ~SEQ_ALLSEL;
 
-		if(seq->seqbase.first) recurs_sel_seq(seq);
+		if (seq->seqbase.first) recurs_sel_seq(seq);
 
-		seq= seq->next;
+		seq = seq->next;
 	}
 }
 
 int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequence **selseq1, Sequence **selseq2, Sequence **selseq3, const char **error_str)
 {
 	Editing *ed = seq_give_editing(scene, FALSE);
-	Sequence *seq1= NULL, *seq2= NULL, *seq3= NULL, *seq;
+	Sequence *seq1 = NULL, *seq2 = NULL, *seq3 = NULL, *seq;
 	
-	*error_str= NULL;
+	*error_str = NULL;
 
 	if (!activeseq)
-		seq2= seq_active_get(scene);
+		seq2 = seq_active_get(scene);
 
-	for(seq=ed->seqbasep->first; seq; seq=seq->next) {
-		if(seq->flag & SELECT) {
+	for (seq = ed->seqbasep->first; seq; seq = seq->next) {
+		if (seq->flag & SELECT) {
 			if (seq->type == SEQ_SOUND && get_sequence_effect_num_inputs(type) != 0) {
-				*error_str= "Can't apply effects to audio sequence strips";
+				*error_str = "Can't apply effects to audio sequence strips";
 				return 0;
 			}
-			if((seq != activeseq) && (seq != seq2)) {
-								if(seq2 == NULL) seq2= seq;
-								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";
-									return 0;
-								}
+			if ((seq != activeseq) && (seq != seq2)) {
+				if (seq2 == NULL) seq2 = seq;
+				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";
+					return 0;
+				}
 			}
 		}
 	}
 
 	/* make sequence selection a little bit more intuitive
-	   for 3 strips: the last-strip should be sequence3 */
+	 * for 3 strips: the last-strip should be sequence3 */
 	if (seq3 != NULL && seq2 != NULL) {
 		Sequence *tmp = seq2;
 		seq2 = seq3;
@@ -528,33 +524,33 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen
 	}
 	
 
-	switch(get_sequence_effect_num_inputs(type)) {
-	case 0:
-		*selseq1 = *selseq2 = *selseq3 = NULL;
-		return 1; /* succsess */
-	case 1:
-		if(seq2==NULL)  {
-			*error_str= "Need at least one selected sequence strip";
-			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";
-			return 0;
-		}
-		if(seq3 == NULL) seq3= seq2;
+	switch (get_sequence_effect_num_inputs(type)) {
+		case 0:
+			*selseq1 = *selseq2 = *selseq3 = NULL;
+			return 1; /* succsess */
+		case 1:
+			if (seq2 == NULL) {
+				*error_str = "Need at least one selected sequence strip";
+				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";
+				return 0;
+			}
+			if (seq3 == NULL) seq3 = seq2;
 	}
 	
-	if (seq1==NULL && seq2==NULL && seq3==NULL) {
-		*error_str= "TODO: in what cases does this happen?";
+	if (seq1 == NULL && seq2 == NULL && seq3 == NULL) {
+		*error_str = "TODO: in what cases does this happen?";
 		return 0;
 	}
 	
-	*selseq1= seq1;
-	*selseq2= seq2;
-	*selseq3= seq3;
+	*selseq1 = seq1;
+	*selseq2 = seq2;
+	*selseq3 = seq3;
 
 	return 1;
 }
@@ -564,34 +560,34 @@ static Sequence *del_seq_find_replace_recurs(Scene *scene, Sequence *seq)
 	Sequence *seq1, *seq2, *seq3;
 
 	/* try to find a replacement input sequence, and flag for later deletion if
-	   no replacement can be found */
+	 * no replacement can be found */
 
-	if(!seq)
+	if (!seq)
 		return NULL;
-	else if(!(seq->type & SEQ_EFFECT))
-		return ((seq->flag & SELECT)? NULL: seq);
-	else if(!(seq->flag & SELECT)) {
+	else if (!(seq->type & SEQ_EFFECT))
+		return ((seq->flag & SELECT) ? NULL : seq);
+	else if (!(seq->flag & SELECT)) {
 		/* try to find replacement for effect inputs */
-		seq1= del_seq_find_replace_recurs(scene, seq->seq1);
-		seq2= del_seq_find_replace_recurs(scene, seq->seq2);
-		seq3= del_seq_find_replace_recurs(scene, seq->seq3);
+		seq1 = del_seq_find_replace_recurs(scene, seq->seq1);
+		seq2 = del_seq_find_replace_recurs(scene, seq->seq2);
+		seq3 = del_seq_find_replace_recurs(scene, seq->seq3);
 
-		if(seq1==seq->seq1 && seq2==seq->seq2 && seq3==seq->seq3);
-		else if(seq1 || seq2 || seq3) {
-			seq->seq1= (seq1)? seq1: (seq2)? seq2: seq3;
-			seq->seq2= (seq2)? seq2: (seq1)? seq1: seq3;
-			seq->seq3= (seq3)? seq3: (seq1)? seq1: seq2;
+		if (seq1 == seq->seq1 && seq2 == seq->seq2 && seq3 == seq->seq3) ;
+		else if (seq1 || seq2 || seq3) {
+			seq->seq1 = (seq1) ? seq1 : (seq2) ? seq2 : seq3;
+			seq->seq2 = (seq2) ? seq2 : (seq1) ? seq1 : seq3;
+			seq->seq3 = (seq3) ? seq3 : (seq1) ? seq1 : seq2;
 
 			update_changed_seq_and_deps(scene, seq, 1, 1);
 		}
 		else
-			seq->flag |= SELECT; /* mark for delete */
+			seq->flag |= SELECT;  /* mark for delete */
 	}
 
 	if (seq->flag & SELECT) {
-		if((seq1 = del_seq_find_replace_recurs(scene, seq->seq1))) return seq1;
-		if((seq2 = del_seq_find_replace_recurs(scene, seq->seq2))) return seq2;
-		if((seq3 = del_seq_find_replace_recurs(scene, seq->seq3))) return seq3;
+		if ((seq1 = del_seq_find_replace_recurs(scene, seq->seq1))) return seq1;
+		if ((seq2 = del_seq_find_replace_recurs(scene, seq->seq2))) return seq2;
+		if ((seq3 = del_seq_find_replace_recurs(scene, seq->seq3))) return seq3;
 		else return NULL;
 	}
 	else
@@ -603,62 +599,63 @@ static void recurs_del_seq_flag(Scene *scene, ListBase *lb, short flag, short de
 	Sequence *seq, *seqn;
 	Sequence *last_seq = seq_active_get(scene);
 
-	seq= lb->first;
-	while(seq) {
-		seqn= seq->next;
-		if((seq->flag & flag) || deleteall) {
+	seq = lb->first;
+	while (seq) {
+		seqn = seq->next;
+		if ((seq->flag & flag) || deleteall) {
 			BLI_remlink(lb, seq);
-			if(seq==last_seq) seq_active_set(scene, NULL);
-			if(seq->type==SEQ_META) recurs_del_seq_flag(scene, &seq->seqbase, flag, 1);
+			if (seq == last_seq) seq_active_set(scene, NULL);
+			if (seq->type == SEQ_META) recurs_del_seq_flag(scene, &seq->seqbase, flag, 1);
 			seq_free_sequence(scene, seq);
 		}
-		seq= seqn;
+		seq = seqn;
 	}
 }
 
 
-static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe)
+static Sequence *cut_seq_hard(Scene *scene, Sequence *seq, int cutframe)
 {
 	TransSeq ts;
 	Sequence *seqn = NULL;
 	int skip_dup = FALSE;
 
 	/* backup values */
-	ts.start= seq->start;
-	ts.machine= seq->machine;
-	ts.startstill= seq->startstill;
-	ts.endstill= seq->endstill;
-	ts.startdisp= seq->startdisp;
-	ts.enddisp= seq->enddisp;
-	ts.startofs= seq->startofs;
-	ts.endofs= seq->endofs;
-	ts.anim_startofs= seq->anim_startofs;
-	ts.anim_endofs= seq->anim_endofs;
-	ts.len= seq->len;
+	ts.start = seq->start;
+	ts.machine = seq->machine;
+	ts.startstill = seq->startstill;
+	ts.endstill = seq->endstill;
+	ts.startdisp = seq->startdisp;
+	ts.enddisp = seq->enddisp;
+	ts.startofs = seq->startofs;
+	ts.endofs = seq->endofs;
+	ts.anim_startofs = seq->anim_startofs;
+	ts.anim_endofs = seq->anim_endofs;
+	ts.len = seq->len;
 	
 	/* First Strip! */
 	/* strips with extended stillfames before */
 	
-	if ((seq->startstill) && (cutframe <seq->start)) {
+	if ((seq->startstill) && (cutframe < seq->start)) {
 		/* don't do funny things with METAs ... */
 		if (seq->type == SEQ_META) {
 			skip_dup = TRUE;
 			seq->startstill = seq->start - cutframe;
-		} else {
-			seq->start= cutframe -1;
-			seq->startstill= cutframe -seq->startdisp -1;
+		}
+		else {
+			seq->start = cutframe - 1;
+			seq->startstill = cutframe - seq->startdisp - 1;
 			seq->anim_endofs += seq->len - 1;
-			seq->endstill= 0;
+			seq->endstill = 0;
 		}
 	}
 	/* normal strip */
-	else if ((cutframe >=seq->start)&&(cutframe <=(seq->start+seq->len))) {
+	else if ((cutframe >= seq->start) && (cutframe <= (seq->start + seq->len))) {
 		seq->endofs = 0;
 		seq->endstill = 0;
-		seq->anim_endofs += (seq->start+seq->len) - cutframe;
+		seq->anim_endofs += (seq->start + seq->len) - cutframe;
 	}
 	/* strips with extended stillframes after */
-	else if (((seq->start+seq->len) < cutframe) && (seq->endstill)) {
+	else if (((seq->start + seq->len) < cutframe) && (seq->endstill)) {
 		seq->endstill -= seq->enddisp - cutframe;
 		/* don't do funny things with METAs ... */
 		if (seq->type == SEQ_META) {
@@ -668,7 +665,6 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe)
 	
 	reload_sequence_new_file(scene, seq, FALSE);
 	calc_sequence(scene, seq);
-	new_tstripdata(seq); 
 
 	if (!skip_dup) {
 		/* Duplicate AFTER the first change */
@@ -682,13 +678,13 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe)
 		/* strips with extended stillframes before */
 		if ((seqn->startstill) && (cutframe == seqn->start + 1)) {
 			seqn->start = ts.start;
-			seqn->startstill= ts.start- cutframe;
+			seqn->startstill = ts.start - cutframe;
 			seqn->anim_endofs = ts.anim_endofs;
 			seqn->endstill = ts.endstill;
 		}
 		
 		/* normal strip */
-		else if ((cutframe>=seqn->start)&&(cutframe<=(seqn->start+seqn->len))) {
+		else if ((cutframe >= seqn->start) && (cutframe <= (seqn->start + seqn->len))) {
 			seqn->start = cutframe;
 			seqn->startstill = 0;
 			seqn->startofs = 0;
@@ -699,61 +695,61 @@ static Sequence *cut_seq_hard(Scene *scene, Sequence * seq, int cutframe)
 		}				
 		
 		/* strips with extended stillframes after */
-		else if (((seqn->start+seqn->len) < cutframe) && (seqn->endstill)) {
+		else if (((seqn->start + seqn->len) < cutframe) && (seqn->endstill)) {
 			seqn->start = cutframe;
 			seqn->startofs = 0;
-			seqn->anim_startofs += ts.len-1;
-			seqn->endstill = ts.enddisp - cutframe -1;
+			seqn->anim_startofs += ts.len - 1;
+			seqn->endstill = ts.enddisp - cutframe - 1;
 			seqn->startstill = 0;
 		}
 		
 		reload_sequence_new_file(scene, seqn, FALSE);
 		calc_sequence(scene, seqn);
-		new_tstripdata(seqn);
 	}
 	return seqn;
 }
 
-static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe)
+static Sequence *cut_seq_soft(Scene *scene, Sequence *seq, int cutframe)
 {
 	TransSeq ts;
 	Sequence *seqn = NULL;
 	int skip_dup = FALSE;
 
 	/* backup values */
-	ts.start= seq->start;
-	ts.machine= seq->machine;
-	ts.startstill= seq->startstill;
-	ts.endstill= seq->endstill;
-	ts.startdisp= seq->startdisp;
-	ts.enddisp= seq->enddisp;
-	ts.startofs= seq->startofs;
-	ts.endofs= seq->endofs;
-	ts.anim_startofs= seq->anim_startofs;
-	ts.anim_endofs= seq->anim_endofs;
-	ts.len= seq->len;
+	ts.start = seq->start;
+	ts.machine = seq->machine;
+	ts.startstill = seq->startstill;
+	ts.endstill = seq->endstill;
+	ts.startdisp = seq->startdisp;
+	ts.enddisp = seq->enddisp;
+	ts.startofs = seq->startofs;
+	ts.endofs = seq->endofs;
+	ts.anim_startofs = seq->anim_startofs;
+	ts.anim_endofs = seq->anim_endofs;
+	ts.len = seq->len;
 	
 	/* First Strip! */
 	/* strips with extended stillfames before */
 	
-	if ((seq->startstill) && (cutframe <seq->start)) {
+	if ((seq->startstill) && (cutframe < seq->start)) {
 		/* don't do funny things with METAs ... */
 		if (seq->type == SEQ_META) {
 			skip_dup = TRUE;
 			seq->startstill = seq->start - cutframe;
-		} else {
-			seq->start= cutframe -1;
-			seq->startstill= cutframe -seq->startdisp -1;
+		}
+		else {
+			seq->start = cutframe - 1;
+			seq->startstill = cutframe - seq->startdisp - 1;
 			seq->endofs = seq->len - 1;
-			seq->endstill= 0;
+			seq->endstill = 0;
 		}
 	}
 	/* normal strip */
-	else if ((cutframe >=seq->start)&&(cutframe <=(seq->start+seq->len))) {
-		seq->endofs = (seq->start+seq->len) - cutframe;
+	else if ((cutframe >= seq->start) && (cutframe <= (seq->start + seq->len))) {
+		seq->endofs = (seq->start + seq->len) - cutframe;
 	}
 	/* strips with extended stillframes after */
-	else if (((seq->start+seq->len) < cutframe) && (seq->endstill)) {
+	else if (((seq->start + seq->len) < cutframe) && (seq->endstill)) {
 		seq->endstill -= seq->enddisp - cutframe;
 		/* don't do funny things with METAs ... */
 		if (seq->type == SEQ_META) {
@@ -762,7 +758,6 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe)
 	}
 	
 	calc_sequence(scene, seq);
-	new_tstripdata(seq);
 
 	if (!skip_dup) {
 		/* Duplicate AFTER the first change */
@@ -776,13 +771,13 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe)
 		/* strips with extended stillframes before */
 		if ((seqn->startstill) && (cutframe == seqn->start + 1)) {
 			seqn->start = ts.start;
-			seqn->startstill= ts.start- cutframe;
+			seqn->startstill = ts.start - cutframe;
 			seqn->endofs = ts.endofs;
 			seqn->endstill = ts.endstill;
 		}
 		
 		/* normal strip */
-		else if ((cutframe>=seqn->start)&&(cutframe<=(seqn->start+seqn->len))) {
+		else if ((cutframe >= seqn->start) && (cutframe <= (seqn->start + seqn->len))) {
 			seqn->startstill = 0;
 			seqn->startofs = cutframe - ts.start;
 			seqn->endofs = ts.endofs;
@@ -790,15 +785,14 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe)
 		}				
 		
 		/* strips with extended stillframes after */
-		else if (((seqn->start+seqn->len) < cutframe) && (seqn->endstill)) {
-			seqn->start = cutframe - ts.len +1;
-			seqn->startofs = ts.len-1;
-			seqn->endstill = ts.enddisp - cutframe -1;
+		else if (((seqn->start + seqn->len) < cutframe) && (seqn->endstill)) {
+			seqn->start = cutframe - ts.len + 1;
+			seqn->startofs = ts.len - 1;
+			seqn->endstill = ts.enddisp - cutframe - 1;
 			seqn->startstill = 0;
 		}
 		
 		calc_sequence(scene, seqn);
-		new_tstripdata(seqn);
 	}
 	return seqn;
 }
@@ -807,28 +801,31 @@ static Sequence *cut_seq_soft(Scene *scene, Sequence * seq, int cutframe)
 /* like duplicate, but only duplicate and cut overlapping strips,
  * strips to the left of the cutframe are ignored and strips to the right are moved into the new list */
 static int cut_seq_list(Scene *scene, ListBase *old, ListBase *new, int cutframe,
-			Sequence * (*cut_seq)(Scene *, Sequence *, int))
+                        Sequence * (*cut_seq)(Scene *, Sequence *, int))
 {
 	int did_something = FALSE;
 	Sequence *seq, *seq_next_iter;
 	
-	seq= old->first;
+	seq = old->first;
 	
-	while(seq) {
+	while (seq) {
 		seq_next_iter = seq->next; /* we need this because we may remove seq */
 		
-		seq->tmp= NULL;
-		if(seq->flag & SELECT) {
-			if(cutframe > seq->startdisp && 
-			   cutframe < seq->enddisp) {
-				Sequence * seqn = cut_seq(scene, seq, cutframe);
+		seq->tmp = NULL;
+		if (seq->flag & SELECT) {
+			if (cutframe > seq->startdisp && 
+			    cutframe < seq->enddisp)
+			{
+				Sequence *seqn = cut_seq(scene, seq, cutframe);
 				if (seqn) {
 					BLI_addtail(new, seqn);
 				}
 				did_something = TRUE;
-			} else if (seq->enddisp <= cutframe) {
+			}
+			else if (seq->enddisp <= cutframe) {
 				/* do nothing */
-			} else if (seq->startdisp >= cutframe) {
+			}
+			else if (seq->startdisp >= cutframe) {
 				/* move into new list */
 				BLI_remlink(old, seq);
 				BLI_addtail(new, seq);
@@ -842,18 +839,18 @@ static int cut_seq_list(Scene *scene, ListBase *old, ListBase *new, int cutframe
 static int insert_gap(Scene *scene, int gap, int cfra)
 {
 	Sequence *seq;
-	Editing *ed= seq_give_editing(scene, FALSE);
-	int done=0;
+	Editing *ed = seq_give_editing(scene, FALSE);
+	int done = 0;
 
 	/* all strips >= cfra are shifted */
 	
-	if(ed==NULL) return 0;
+	if (ed == NULL) return 0;
 
 	SEQP_BEGIN(ed, seq) {
-		if(seq->startdisp >= cfra) {
-			seq->start+= gap;
+		if (seq->startdisp >= cfra) {
+			seq->start += gap;
 			calc_sequence(scene, seq);
-			done= 1;
+			done = 1;
 		}
 	}
 	SEQ_END
@@ -861,24 +858,25 @@ static int insert_gap(Scene *scene, int gap, int cfra)
 	return done;
 }
 
-static void UNUSED_FUNCTION(touch_seq_files)(Scene *scene)
+static void UNUSED_FUNCTION(touch_seq_files) (Scene * scene)
 {
 	Sequence *seq;
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	char str[256];
 
 	/* touch all strips with movies */
 	
-	if(ed==NULL) return;
+	if (ed == NULL) return;
 
-	if(okee("Touch and print selected movies")==0) return;
+	// XXX25 if (okee("Touch and print selected movies")==0) return;
 
 	WM_cursor_wait(1);
 
-	SEQP_BEGIN(ed, seq) {
-		if(seq->flag & SELECT) {
-			if(seq->type==SEQ_MOVIE) {
-				if(seq->strip && seq->strip->stripdata) {
+	SEQP_BEGIN(ed, seq)
+	{
+		if (seq->flag & SELECT) {
+			if (seq->type == SEQ_MOVIE) {
+				if (seq->strip && seq->strip->stripdata) {
 					BLI_make_file_string(G.main->name, str, seq->strip->dir, seq->strip->stripdata->name);
 					BLI_file_touch(seq->name);
 				}
@@ -891,20 +889,21 @@ static void UNUSED_FUNCTION(touch_seq_files)(Scene *scene)
 	WM_cursor_wait(0);
 }
 
-/*
+#if 0
 static void set_filter_seq(Scene *scene)
 {
 	Sequence *seq;
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Editing *ed = seq_give_editing(scene, FALSE);
 
 	
-	if(ed==NULL) return;
+	if (ed == NULL) return;
 
-	if(okee("Set Deinterlace")==0) return;
+	if (okee("Set Deinterlace") == 0) return;
 
-	SEQP_BEGIN(ed, seq) {
-		if(seq->flag & SELECT) {
-			if(seq->type==SEQ_MOVIE) {
+	SEQP_BEGIN(ed, seq)
+	{
+		if (seq->flag & SELECT) {
+			if (seq->type == SEQ_MOVIE) {
 				seq->flag |= SEQ_FILTERY;
 				reload_sequence_new_file(scene, seq, FALSE);
 				calc_sequence(scene, seq);
@@ -914,16 +913,16 @@ static void set_filter_seq(Scene *scene)
 	}
 	SEQ_END
 }
-*/
+#endif
 
-static void UNUSED_FUNCTION(seq_remap_paths)(Scene *scene)
+static void UNUSED_FUNCTION(seq_remap_paths) (Scene * scene)
 {
 	Sequence *seq, *last_seq = seq_active_get(scene);
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	char from[FILE_MAX], to[FILE_MAX], stripped[FILE_MAX];
 	
 	
-	if(last_seq==NULL) 
+	if (last_seq == NULL)
 		return;
 	
 	BLI_strncpy(from, last_seq->strip->dir, sizeof(from));
@@ -934,16 +933,17 @@ static void UNUSED_FUNCTION(seq_remap_paths)(Scene *scene)
 // XXX	if (0==sbutton(to, 0, sizeof(to)-1, "To: "))
 //		return;
 	
-	if (strcmp(to, from)==0)
+	if (strcmp(to, from) == 0)
 		return;
 	
-	SEQP_BEGIN(ed, seq) {
-		if(seq->flag & SELECT) {
-			if(strncmp(seq->strip->dir, from, strlen(from))==0) {
+	SEQP_BEGIN(ed, seq)
+	{
+		if (seq->flag & SELECT) {
+			if (strncmp(seq->strip->dir, from, strlen(from)) == 0) {
 				printf("found %s\n", seq->strip->dir);
 				
 				/* strip off the beginning */
-				stripped[0]= 0;
+				stripped[0] = 0;
 				BLI_strncpy(stripped, seq->strip->dir + strlen(from), FILE_MAX);
 				
 				/* new path */
@@ -957,25 +957,25 @@ static void UNUSED_FUNCTION(seq_remap_paths)(Scene *scene)
 }
 
 
-static void UNUSED_FUNCTION(no_gaps)(Scene *scene)
+static void UNUSED_FUNCTION(no_gaps) (Scene * scene)
 {
-	Editing *ed= seq_give_editing(scene, FALSE);
-	int cfra, first= 0, done;
+	Editing *ed = seq_give_editing(scene, FALSE);
+	int cfra, first = 0, done;
 
 	
-	if(ed==NULL) return;
+	if (ed == NULL) return;
 
-	for(cfra= CFRA; cfra<=EFRA; cfra++) {
-		if(first==0) {
-			if( evaluate_seq_frame(scene, cfra) ) first= 1;
+	for (cfra = CFRA; cfra <= EFRA; cfra++) {
+		if (first == 0) {
+			if (evaluate_seq_frame(scene, cfra) ) first = 1;
 		}
 		else {
-			done= 1;
-			while( evaluate_seq_frame(scene, cfra) == 0) {
-				done= insert_gap(scene, -1, cfra);
-				if(done==0) break;
+			done = 1;
+			while (evaluate_seq_frame(scene, cfra) == 0) {
+				done = insert_gap(scene, -1, cfra);
+				if (done == 0) break;
 			}
-			if(done==0) break;
+			if (done == 0) break;
 		}
 	}
 
@@ -985,7 +985,7 @@ static void UNUSED_FUNCTION(no_gaps)(Scene *scene)
 static int seq_get_snaplimit(View2D *v2d)
 {
 	/* fake mouse coords to get the snap value
-	a bit lazy but its only done once pre transform */
+	 * a bit lazy but its only done once pre transform */
 	float xmouse, ymouse, x;
 	int mval[2] = {24, 0}; /* 24 screen px snap */
 	
@@ -1003,23 +1003,25 @@ int sequencer_edit_poll(bContext *C)
 	return (seq_give_editing(CTX_data_scene(C), FALSE) != NULL);
 }
 
+#if 0 /* UNUSED */
 int sequencer_strip_poll(bContext *C)
 {
 	Editing *ed;
-	return (((ed= seq_give_editing(CTX_data_scene(C), FALSE)) != NULL) && (ed->act_seq != NULL));
+	return (((ed = seq_give_editing(CTX_data_scene(C), FALSE)) != NULL) && (ed->act_seq != NULL));
 }
+#endif
 
 int sequencer_strip_has_path_poll(bContext *C)
 {
 	Editing *ed;
 	Sequence *seq;
-	return (((ed= seq_give_editing(CTX_data_scene(C), FALSE)) != NULL) && ((seq= ed->act_seq) != NULL) && (SEQ_HAS_PATH(seq)));
+	return (((ed = seq_give_editing(CTX_data_scene(C), FALSE)) != NULL) && ((seq = ed->act_seq) != NULL) && (SEQ_HAS_PATH(seq)));
 }
 
 int sequencer_view_poll(bContext *C)
 {
-	SpaceSeq *sseq= CTX_wm_space_seq(C);
-	Editing *ed= seq_give_editing(CTX_data_scene(C), FALSE);
+	SpaceSeq *sseq = CTX_wm_space_seq(C);
+	Editing *ed = seq_give_editing(CTX_data_scene(C), FALSE);
 	if (ed && sseq && (sseq->mainb == SEQ_DRAW_IMG_IMBUF))
 		return 1;
 
@@ -1029,27 +1031,30 @@ int sequencer_view_poll(bContext *C)
 /* snap operator*/
 static int sequencer_snap_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	Sequence *seq;
 	int snap_frame;
 
-	snap_frame= RNA_int_get(op->ptr, "frame");
+	snap_frame = RNA_int_get(op->ptr, "frame");
 
 	/* also check metas */
-	for(seq= ed->seqbasep->first; seq; seq= seq->next) {
-		if (seq->flag & SELECT && !(seq->depth==0 && seq->flag & SEQ_LOCK) &&
-			seq_tx_test(seq)) {
-			if((seq->flag & (SEQ_LEFTSEL+SEQ_RIGHTSEL))==0) {
+	for (seq = ed->seqbasep->first; seq; seq = seq->next) {
+		if (seq->flag & SELECT && !(seq->depth == 0 && seq->flag & SEQ_LOCK) &&
+		    seq_tx_test(seq))
+		{
+			if ((seq->flag & (SEQ_LEFTSEL + SEQ_RIGHTSEL)) == 0) {
 				/* simple but no anim update */
 				/* seq->start= snap_frame-seq->startofs+seq->startstill; */
 
-				seq_translate(scene, seq, (snap_frame-seq->startofs+seq->startstill) - seq->start);
-			} else { 
-				if(seq->flag & SEQ_LEFTSEL) {
+				seq_translate(scene, seq, (snap_frame - seq->startofs + seq->startstill) - seq->start);
+			}
+			else {
+				if (seq->flag & SEQ_LEFTSEL) {
 					seq_tx_set_final_left(seq, snap_frame);
-				} else { /* SEQ_RIGHTSEL */
+				}
+				else { /* SEQ_RIGHTSEL */
 					seq_tx_set_final_right(seq, snap_frame);
 				}
 				seq_tx_handle_xlimits(seq, seq->flag & SEQ_LEFTSEL, seq->flag & SEQ_RIGHTSEL);
@@ -1059,20 +1064,20 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
 	}
 
 	/* test for effects and overlap
-	 * dont use SEQP_BEGIN since that would be recursive */
-	for(seq= ed->seqbasep->first; seq; seq= seq->next) {
-		if(seq->flag & SELECT && !(seq->depth==0 && seq->flag & SEQ_LOCK)) {
+	 * don't use SEQP_BEGIN since that would be recursive */
+	for (seq = ed->seqbasep->first; seq; seq = seq->next) {
+		if (seq->flag & SELECT && !(seq->depth == 0 && seq->flag & SEQ_LOCK)) {
 			seq->flag &= ~SEQ_OVERLAP;
-			if( seq_test_overlap(ed->seqbasep, seq) ) {
+			if (seq_test_overlap(ed->seqbasep, seq) ) {
 				shuffle_seq(ed->seqbasep, seq, scene);
 			}
 		}
-		else if(seq->type & SEQ_EFFECT) {
-			if(seq->seq1 && (seq->seq1->flag & SELECT)) 
+		else if (seq->type & SEQ_EFFECT) {
+			if (seq->seq1 && (seq->seq1->flag & SELECT)) 
 				calc_sequence(scene, seq);
-			else if(seq->seq2 && (seq->seq2->flag & SELECT)) 
+			else if (seq->seq2 && (seq->seq2->flag & SELECT)) 
 				calc_sequence(scene, seq);
-			else if(seq->seq3 && (seq->seq3->flag & SELECT)) 
+			else if (seq->seq3 && (seq->seq3->flag & SELECT)) 
 				calc_sequence(scene, seq);
 		}
 	}
@@ -1080,7 +1085,7 @@ static int sequencer_snap_exec(bContext *C, wmOperator *op)
 	/* as last: */
 	sort_seq(scene);
 	
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 	
 	return OPERATOR_FINISHED;
 }
@@ -1091,7 +1096,7 @@ static int sequencer_snap_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev
 	
 	int snap_frame;
 	
-	snap_frame= CFRA;
+	snap_frame = CFRA;
 	
 	RNA_int_set(op->ptr, "frame", snap_frame);
 	return sequencer_snap_exec(C, op);
@@ -1100,17 +1105,17 @@ static int sequencer_snap_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev
 void SEQUENCER_OT_snap(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Snap strips";
-	ot->idname= "SEQUENCER_OT_snap";
-	ot->description="Frame where selected strips will be snapped";
+	ot->name = "Snap strips";
+	ot->idname = "SEQUENCER_OT_snap";
+	ot->description = "Frame where selected strips will be snapped";
 	
 	/* api callbacks */
-	ot->invoke= sequencer_snap_invoke;
-	ot->exec= sequencer_snap_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->invoke = sequencer_snap_invoke;
+	ot->exec = sequencer_snap_exec;
+	ot->poll = sequencer_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	RNA_def_int(ot->srna, "frame", 0, INT_MIN, INT_MAX, "Frame", "Frame where selected strips will be snapped", INT_MIN, INT_MAX);
 }
@@ -1118,28 +1123,28 @@ void SEQUENCER_OT_snap(struct wmOperatorType *ot)
 /* mute operator */
 static int sequencer_mute_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	Sequence *seq;
 	int selected;
 
-	selected= !RNA_boolean_get(op->ptr, "unselected");
+	selected = !RNA_boolean_get(op->ptr, "unselected");
 	
-	for(seq= ed->seqbasep->first; seq; seq= seq->next) {
-		if ((seq->flag & SEQ_LOCK)==0) {
-			if(selected){ /* mute unselected */
-				if(seq->flag & SELECT)
+	for (seq = ed->seqbasep->first; seq; seq = seq->next) {
+		if ((seq->flag & SEQ_LOCK) == 0) {
+			if (selected) { /* mute unselected */
+				if (seq->flag & SELECT)
 					seq->flag |= SEQ_MUTE;
 			}
 			else {
-				if((seq->flag & SELECT)==0)
+				if ((seq->flag & SELECT) == 0)
 					seq->flag |= SEQ_MUTE;
 			}
 		}
 	}
 	
 	seq_update_muting(ed);
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 	
 	return OPERATOR_FINISHED;
 }
@@ -1147,16 +1152,16 @@ static int sequencer_mute_exec(bContext *C, wmOperator *op)
 void SEQUENCER_OT_mute(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Mute Strips";
-	ot->idname= "SEQUENCER_OT_mute";
-	ot->description="Mute selected strips";
+	ot->name = "Mute Strips";
+	ot->idname = "SEQUENCER_OT_mute";
+	ot->description = "Mute selected strips";
 	
 	/* api callbacks */
-	ot->exec= sequencer_mute_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->exec = sequencer_mute_exec;
+	ot->poll = sequencer_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Mute unselected rather than selected strips");
 }
@@ -1165,28 +1170,28 @@ void SEQUENCER_OT_mute(struct wmOperatorType *ot)
 /* unmute operator */
 static int sequencer_unmute_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	Sequence *seq;
 	int selected;
 
-	selected= !RNA_boolean_get(op->ptr, "unselected");
+	selected = !RNA_boolean_get(op->ptr, "unselected");
 	
-	for(seq= ed->seqbasep->first; seq; seq= seq->next) {
-		if ((seq->flag & SEQ_LOCK)==0) {
-			if(selected){ /* unmute unselected */
-				if(seq->flag & SELECT)
+	for (seq = ed->seqbasep->first; seq; seq = seq->next) {
+		if ((seq->flag & SEQ_LOCK) == 0) {
+			if (selected) { /* unmute unselected */
+				if (seq->flag & SELECT)
 					seq->flag &= ~SEQ_MUTE;
 			}
 			else {
-				if((seq->flag & SELECT)==0)
+				if ((seq->flag & SELECT) == 0)
 					seq->flag &= ~SEQ_MUTE;
 			}
 		}
 	}
 	
 	seq_update_muting(ed);
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 	
 	return OPERATOR_FINISHED;
 }
@@ -1194,16 +1199,16 @@ static int sequencer_unmute_exec(bContext *C, wmOperator *op)
 void SEQUENCER_OT_unmute(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Un-Mute Strips";
-	ot->idname= "SEQUENCER_OT_unmute";
-	ot->description="Un-Mute unselected rather than selected strips";
+	ot->name = "Un-Mute Strips";
+	ot->idname = "SEQUENCER_OT_unmute";
+	ot->description = "Un-Mute unselected rather than selected strips";
 	
 	/* api callbacks */
-	ot->exec= sequencer_unmute_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->exec = sequencer_unmute_exec;
+	ot->poll = sequencer_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "UnMute unselected rather than selected strips");
 }
@@ -1212,17 +1217,17 @@ void SEQUENCER_OT_unmute(struct wmOperatorType *ot)
 /* lock operator */
 static int sequencer_lock_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	Sequence *seq;
 
-	for(seq= ed->seqbasep->first; seq; seq= seq->next) {
+	for (seq = ed->seqbasep->first; seq; seq = seq->next) {
 		if (seq->flag & SELECT) {
 			seq->flag |= SEQ_LOCK;
 		}
 	}
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
 	return OPERATOR_FINISHED;
 }
@@ -1230,32 +1235,32 @@ static int sequencer_lock_exec(bContext *C, wmOperator *UNUSED(op))
 void SEQUENCER_OT_lock(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Lock Strips";
-	ot->idname= "SEQUENCER_OT_lock";
-	ot->description="Lock the active strip so that it can't be transformed";
+	ot->name = "Lock Strips";
+	ot->idname = "SEQUENCER_OT_lock";
+	ot->description = "Lock the active strip so that it can't be transformed";
 	
 	/* api callbacks */
-	ot->exec= sequencer_lock_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->exec = sequencer_lock_exec;
+	ot->poll = sequencer_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /* unlock operator */
 static int sequencer_unlock_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	Sequence *seq;
 
-	for(seq= ed->seqbasep->first; seq; seq= seq->next) {
+	for (seq = ed->seqbasep->first; seq; seq = seq->next) {
 		if (seq->flag & SELECT) {
 			seq->flag &= ~SEQ_LOCK;
 		}
 	}
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
 	return OPERATOR_FINISHED;
 }
@@ -1263,60 +1268,73 @@ static int sequencer_unlock_exec(bContext *C, wmOperator *UNUSED(op))
 void SEQUENCER_OT_unlock(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "UnLock Strips";
-	ot->idname= "SEQUENCER_OT_unlock";
-	ot->description="Unlock the active strip so that it can't be transformed";
+	ot->name = "UnLock Strips";
+	ot->idname = "SEQUENCER_OT_unlock";
+	ot->description = "Unlock the active strip so that it can't be transformed";
 	
 	/* api callbacks */
-	ot->exec= sequencer_unlock_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->exec = sequencer_unlock_exec;
+	ot->poll = sequencer_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /* reload operator */
-static int sequencer_reload_exec(bContext *C, wmOperator *UNUSED(op))
+static int sequencer_reload_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	Sequence *seq;
+	int adjust_length = RNA_boolean_get(op->ptr, "adjust_length");
 
-	for(seq= ed->seqbasep->first; seq; seq= seq->next) {
-		if(seq->flag & SELECT) {
+	for (seq = ed->seqbasep->first; seq; seq = seq->next) {
+		if (seq->flag & SELECT) {
 			update_changed_seq_and_deps(scene, seq, 0, 1);
+			reload_sequence_new_file(scene, seq, !adjust_length);
+
+			if (adjust_length) {
+				if (seq_test_overlap(ed->seqbasep, seq))
+					shuffle_seq(ed->seqbasep, seq, scene);
+			}
 		}
 	}
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
 	return OPERATOR_FINISHED;
 }
 
 void SEQUENCER_OT_reload(struct wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+
 	/* identifiers */
-	ot->name= "Reload Strips";
-	ot->idname= "SEQUENCER_OT_reload";
-	ot->description="Reload strips in the sequencer";
+	ot->name = "Reload Strips";
+	ot->idname = "SEQUENCER_OT_reload";
+	ot->description = "Reload strips in the sequencer";
 	
 	/* api callbacks */
-	ot->exec= sequencer_reload_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->exec = sequencer_reload_exec;
+	ot->poll = sequencer_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER; /* no undo, the data changed is stored outside 'main' */
+	ot->flag = OPTYPE_REGISTER; /* no undo, the data changed is stored outside 'main' */
+
+	prop = RNA_def_boolean(ot->srna, "adjust_length", 0, "Adjust Length",
+	                       "Adjust lenght of strips to their data lenght");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 }
 
 /* reload operator */
 static int sequencer_refresh_all_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
 
 	free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE);
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
 	return OPERATOR_FINISHED;
 }
@@ -1324,30 +1342,30 @@ static int sequencer_refresh_all_exec(bContext *C, wmOperator *UNUSED(op))
 void SEQUENCER_OT_refresh_all(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Refresh Sequencer";
-	ot->idname= "SEQUENCER_OT_refresh_all";
-	ot->description="Refresh the sequencer editor";
+	ot->name = "Refresh Sequencer";
+	ot->idname = "SEQUENCER_OT_refresh_all";
+	ot->description = "Refresh the sequencer editor";
 	
 	/* api callbacks */
-	ot->exec= sequencer_refresh_all_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->exec = sequencer_refresh_all_exec;
+	ot->poll = sequencer_edit_poll;
 }
 
 static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	Sequence *seq1, *seq2, *seq3, *last_seq = seq_active_get(scene);
 	const char *error_msg;
 
-	if(!seq_effect_find_selected(scene, last_seq, last_seq->type, &seq1, &seq2, &seq3, &error_msg)) {
+	if (!seq_effect_find_selected(scene, last_seq, last_seq->type, &seq1, &seq2, &seq3, &error_msg)) {
 		BKE_report(op->reports, RPT_ERROR, error_msg);
 		return OPERATOR_CANCELLED;
 	}
 	/* see reassigning would create a cycle */
-	if(	seq_is_predecessor(seq1, last_seq) ||
-		seq_is_predecessor(seq2, last_seq) ||
-		seq_is_predecessor(seq3, last_seq)
-	) {
+	if (seq_is_predecessor(seq1, last_seq) ||
+	    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");
 		return OPERATOR_CANCELLED;
 	}
@@ -1358,19 +1376,19 @@ static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op)
 
 	update_changed_seq_and_deps(scene, last_seq, 1, 1);
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
 	return OPERATOR_FINISHED;
 }
 
 static int sequencer_effect_poll(bContext *C)
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
 
-	if(ed) {
-		Sequence *last_seq= seq_active_get(scene);
-		if(last_seq && (last_seq->type & SEQ_EFFECT)) {
+	if (ed) {
+		Sequence *last_seq = seq_active_get(scene);
+		if (last_seq && (last_seq->type & SEQ_EFFECT)) {
 			return 1;
 		}
 	}
@@ -1381,25 +1399,25 @@ static int sequencer_effect_poll(bContext *C)
 void SEQUENCER_OT_reassign_inputs(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Reassign Inputs";
-	ot->idname= "SEQUENCER_OT_reassign_inputs";
-	ot->description="Reassign the inputs for the effect strip";
+	ot->name = "Reassign Inputs";
+	ot->idname = "SEQUENCER_OT_reassign_inputs";
+	ot->description = "Reassign the inputs for the effect strip";
 
 	/* api callbacks */
-	ot->exec= sequencer_reassign_inputs_exec;
-	ot->poll= sequencer_effect_poll;
+	ot->exec = sequencer_reassign_inputs_exec;
+	ot->poll = sequencer_effect_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 
 static int sequencer_swap_inputs_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	Sequence *seq, *last_seq = seq_active_get(scene);
 
-	if(last_seq->seq1==NULL || last_seq->seq2 == NULL) {
+	if (last_seq->seq1 == NULL || last_seq->seq2 == NULL) {
 		BKE_report(op->reports, RPT_ERROR, "No valid inputs to swap");
 		return OPERATOR_CANCELLED;
 	}
@@ -1410,23 +1428,23 @@ static int sequencer_swap_inputs_exec(bContext *C, wmOperator *op)
 
 	update_changed_seq_and_deps(scene, last_seq, 1, 1);
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
 	return OPERATOR_FINISHED;
 }
 void SEQUENCER_OT_swap_inputs(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Swap Inputs";
-	ot->idname= "SEQUENCER_OT_swap_inputs";
-	ot->description="Swap the first two inputs for the effect strip";
+	ot->name = "Swap Inputs";
+	ot->idname = "SEQUENCER_OT_swap_inputs";
+	ot->description = "Swap the first two inputs for the effect strip";
 
 	/* api callbacks */
-	ot->exec= sequencer_swap_inputs_exec;
-	ot->poll= sequencer_effect_poll;
+	ot->exec = sequencer_swap_inputs_exec;
+	ot->poll = sequencer_effect_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 
@@ -1439,22 +1457,23 @@ static EnumPropertyItem prop_cut_types[] = {
 
 static int sequencer_cut_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	int cut_side, cut_hard, cut_frame;
 
 	ListBase newlist;
 	int changed;
 
-	cut_frame= RNA_int_get(op->ptr, "frame");
-	cut_hard= RNA_enum_get(op->ptr, "type");
-	cut_side= RNA_enum_get(op->ptr, "side");
+	cut_frame = RNA_int_get(op->ptr, "frame");
+	cut_hard = RNA_enum_get(op->ptr, "type");
+	cut_side = RNA_enum_get(op->ptr, "side");
 	
-	newlist.first= newlist.last= NULL;
+	newlist.first = newlist.last = NULL;
 
-	if (cut_hard==SEQ_CUT_HARD) {
+	if (cut_hard == SEQ_CUT_HARD) {
 		changed = cut_seq_list(scene, ed->seqbasep, &newlist, cut_frame, cut_seq_hard);
-	} else {
+	}
+	else {
 		changed = cut_seq_list(scene, ed->seqbasep, &newlist, cut_frame, cut_seq_soft);
 	}
 	
@@ -1464,12 +1483,13 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op)
 
 		if (cut_side != SEQ_SIDE_BOTH) {
 			SEQP_BEGIN(ed, seq) {
-				if (cut_side==SEQ_SIDE_LEFT) {
-					if ( seq->startdisp >= cut_frame ) {
+				if (cut_side == SEQ_SIDE_LEFT) {
+					if (seq->startdisp >= cut_frame) {
 						seq->flag &= ~SEQ_ALLSEL;
 					}
-				} else {
-					if ( seq->enddisp <= cut_frame ) {
+				}
+				else {
+					if (seq->enddisp <= cut_frame) {
 						seq->flag &= ~SEQ_ALLSEL;
 					}
 				}
@@ -1480,8 +1500,8 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op)
 		sort_seq(scene);
 	}
 
-	if(changed) {
-		WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	if (changed) {
+		WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 		return OPERATOR_FINISHED;
 	}
 	else {
@@ -1493,13 +1513,13 @@ static int sequencer_cut_exec(bContext *C, wmOperator *op)
 static int sequencer_cut_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 	Scene *scene = CTX_data_scene(C);
-	View2D *v2d= UI_view2d_fromcontext(C);
+	View2D *v2d = UI_view2d_fromcontext(C);
 
-	int cut_side= SEQ_SIDE_BOTH;
-	int cut_frame= CFRA;
+	int cut_side = SEQ_SIDE_BOTH;
+	int cut_frame = CFRA;
 
 	if (ED_operator_sequencer_active(C) && v2d)
-		cut_side= mouse_frame_side(v2d, event->mval[0], cut_frame);
+		cut_side = mouse_frame_side(v2d, event->mval[0], cut_frame);
 	
 	RNA_int_set(op->ptr, "frame", cut_frame);
 	RNA_enum_set(op->ptr, "side", cut_side);
@@ -1512,17 +1532,17 @@ static int sequencer_cut_invoke(bContext *C, wmOperator *op, wmEvent *event)
 void SEQUENCER_OT_cut(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Cut Strips";
-	ot->idname= "SEQUENCER_OT_cut";
-	ot->description="Cut the selected strips";
+	ot->name = "Cut Strips";
+	ot->idname = "SEQUENCER_OT_cut";
+	ot->description = "Cut the selected strips";
 	
 	/* api callbacks */
-	ot->invoke= sequencer_cut_invoke;
-	ot->exec= sequencer_cut_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->invoke = sequencer_cut_invoke;
+	ot->exec = sequencer_cut_exec;
+	ot->poll = sequencer_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	RNA_def_int(ot->srna, "frame", 0, INT_MIN, INT_MAX, "Frame", "Frame where selected strips will be cut", INT_MIN, INT_MAX);
 	RNA_def_enum(ot->srna, "type", prop_cut_types, SEQ_CUT_SOFT, "Type", "The type of cut operation to perform on strips");
@@ -1532,37 +1552,37 @@ void SEQUENCER_OT_cut(struct wmOperatorType *ot)
 /* duplicate operator */
 static int apply_unique_name_cb(Sequence *seq, void *arg_pt)
 {
-	Scene *scene= (Scene *)arg_pt;
-	char name[sizeof(seq->name)-2];
+	Scene *scene = (Scene *)arg_pt;
+	char name[sizeof(seq->name) - 2];
 
-	strcpy(name, seq->name+2);
+	strcpy(name, seq->name + 2);
 	seqbase_unique_name_recursive(&scene->ed->seqbase, seq);
-	seq_dupe_animdata(scene, name, seq->name+2);
+	seq_dupe_animdata(scene, name, seq->name + 2);
 	return 1;
 
 }
 
 static int sequencer_add_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
 
-	ListBase nseqbase= {NULL, NULL};
+	ListBase nseqbase = {NULL, NULL};
 
-	if(ed==NULL)
+	if (ed == NULL)
 		return OPERATOR_CANCELLED;
 
 	seqbase_dupli_recursive(scene, NULL, &nseqbase, ed->seqbasep, SEQ_DUPE_CONTEXT);
 
-	if(nseqbase.first) {
-		Sequence * seq= nseqbase.first;
+	if (nseqbase.first) {
+		Sequence *seq = nseqbase.first;
 		/* rely on the nseqbase list being added at the end */
 		BLI_movelisttolist(ed->seqbasep, &nseqbase);
 
-		for( ; seq; seq= seq->next)
+		for (; seq; seq = seq->next)
 			seq_recursive_apply(seq, apply_unique_name_cb, scene);
 
-		WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+		WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 		return OPERATOR_FINISHED;
 	}
 
@@ -1582,17 +1602,17 @@ static int sequencer_add_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *
 void SEQUENCER_OT_duplicate(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Duplicate Strips";
-	ot->idname= "SEQUENCER_OT_duplicate";
-	ot->description="Duplicate the selected strips";
+	ot->name = "Duplicate Strips";
+	ot->idname = "SEQUENCER_OT_duplicate";
+	ot->description = "Duplicate the selected strips";
 	
 	/* api callbacks */
-	ot->invoke= sequencer_add_duplicate_invoke;
-	ot->exec= sequencer_add_duplicate_exec;
-	ot->poll= ED_operator_sequencer_active;
+	ot->invoke = sequencer_add_duplicate_invoke;
+	ot->exec = sequencer_add_duplicate_exec;
+	ot->poll = ED_operator_sequencer_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* to give to transform */
 	RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
@@ -1601,16 +1621,17 @@ void SEQUENCER_OT_duplicate(wmOperatorType *ot)
 /* delete operator */
 static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	Sequence *seq;
 	MetaStack *ms;
 	int nothingSelected = TRUE;
 
-	seq=seq_active_get(scene);
+	seq = seq_active_get(scene);
 	if (seq && seq->flag & SELECT) { /* avoid a loop since this is likely to be selected */
 		nothingSelected = FALSE;
-	} else {
+	}
+	else {
 		for (seq = ed->seqbasep->first; seq; seq = seq->next) {
 			if (seq->flag & SELECT) {
 				nothingSelected = FALSE;
@@ -1623,29 +1644,28 @@ static int sequencer_delete_exec(bContext *C, wmOperator *UNUSED(op))
 		return OPERATOR_FINISHED;
 
 	/* for effects, try to find a replacement input */
-	for(seq=ed->seqbasep->first; seq; seq=seq->next)
-		if((seq->type & SEQ_EFFECT) && !(seq->flag & SELECT))
+	for (seq = ed->seqbasep->first; seq; seq = seq->next)
+		if ((seq->type & SEQ_EFFECT) && !(seq->flag & SELECT))
 			del_seq_find_replace_recurs(scene, seq);
 
 	/* delete all selected strips */
 	recurs_del_seq_flag(scene, ed->seqbasep, SELECT, 0);
 
 	/* updates lengths etc */
-	seq= ed->seqbasep->first;
-	while(seq) {
+	seq = ed->seqbasep->first;
+	while (seq) {
 		calc_sequence(scene, seq);
-		seq= seq->next;
+		seq = seq->next;
 	}
 
 	/* free parent metas */
-	ms= ed->metastack.last;
-	while(ms) {
-		ms->parseq->strip->len= 0;		/* force new alloc */
+	ms = ed->metastack.last;
+	while (ms) {
 		calc_sequence(scene, ms->parseq);
-		ms= ms->prev;
+		ms = ms->prev;
 	}
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 	
 	return OPERATOR_FINISHED;
 }
@@ -1655,50 +1675,50 @@ void SEQUENCER_OT_delete(wmOperatorType *ot)
 {
 
 	/* identifiers */
-	ot->name= "Erase Strips";
-	ot->idname= "SEQUENCER_OT_delete";
-	ot->description="Erase selected strips from the sequencer";
+	ot->name = "Erase Strips";
+	ot->idname = "SEQUENCER_OT_delete";
+	ot->description = "Erase selected strips from the sequencer";
 	
 	/* api callbacks */
-	ot->invoke= WM_operator_confirm;
-	ot->exec= sequencer_delete_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->invoke = WM_operator_confirm;
+	ot->exec = sequencer_delete_exec;
+	ot->poll = sequencer_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 
 /* offset clear operator */
 static int sequencer_offset_clear_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	Sequence *seq;
 
 	/* for effects, try to find a replacement input */
-	for(seq=ed->seqbasep->first; seq; seq=seq->next) {
-		if((seq->type & SEQ_EFFECT)==0 && (seq->flag & SELECT)) {
-			seq->startofs= seq->endofs= seq->startstill= seq->endstill= 0;
+	for (seq = ed->seqbasep->first; seq; seq = seq->next) {
+		if ((seq->type & SEQ_EFFECT) == 0 && (seq->flag & SELECT)) {
+			seq->startofs = seq->endofs = seq->startstill = seq->endstill = 0;
 		}
 	}
 
 	/* updates lengths etc */
-	seq= ed->seqbasep->first;
-	while(seq) {
+	seq = ed->seqbasep->first;
+	while (seq) {
 		calc_sequence(scene, seq);
-		seq= seq->next;
+		seq = seq->next;
 	}
 
-	for(seq=ed->seqbasep->first; seq; seq=seq->next) {
-		if((seq->type & SEQ_EFFECT)==0 && (seq->flag & SELECT)) {
-			if(seq_test_overlap(ed->seqbasep, seq)) {
+	for (seq = ed->seqbasep->first; seq; seq = seq->next) {
+		if ((seq->type & SEQ_EFFECT) == 0 && (seq->flag & SELECT)) {
+			if (seq_test_overlap(ed->seqbasep, seq)) {
 				shuffle_seq(ed->seqbasep, seq, scene);
 			}
 		}
 	}
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
 	return OPERATOR_FINISHED;
 }
@@ -1708,39 +1728,39 @@ void SEQUENCER_OT_offset_clear(wmOperatorType *ot)
 {
 
 	/* identifiers */
-	ot->name= "Clear Strip Offset";
-	ot->idname= "SEQUENCER_OT_offset_clear";
-	ot->description="Clear strip offsets from the start and end frames";
+	ot->name = "Clear Strip Offset";
+	ot->idname = "SEQUENCER_OT_offset_clear";
+	ot->description = "Clear strip offsets from the start and end frames";
 
 	/* api callbacks */
-	ot->exec= sequencer_offset_clear_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->exec = sequencer_offset_clear_exec;
+	ot->poll = sequencer_edit_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 
 /* separate_images operator */
 static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	
 	Sequence *seq, *seq_new;
 	Strip *strip_new;
 	StripElem *se, *se_new;
 	int start_ofs, cfra, frame_end;
-	int step= RNA_int_get(op->ptr, "length");
+	int step = RNA_int_get(op->ptr, "length");
 
-	seq= ed->seqbasep->first; /* poll checks this is valid */
+	seq = ed->seqbasep->first; /* poll checks this is valid */
 
 	while (seq) {
-		if((seq->flag & SELECT) && (seq->type == SEQ_IMAGE) && (seq->len > 1)) {
-			/* remove seq so overlap tests dont conflict,
-			see seq_free_sequence below for the real free'ing */
+		if ((seq->flag & SELECT) && (seq->type == SEQ_IMAGE) && (seq->len > 1)) {
+			/* remove seq so overlap tests don't conflict,
+			 * see seq_free_sequence below for the real free'ing */
 			BLI_remlink(ed->seqbasep, seq);
-			/* if(seq->ipo) seq->ipo->id.us--; */
+			/* if (seq->ipo) seq->ipo->id.us--; */
 			/* XXX, remove fcurve and assign to split image strips */
 
 			start_ofs = cfra = seq_tx_get_final_left(seq, 0);
@@ -1750,25 +1770,24 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
 				/* new seq */
 				se = give_stripelem(seq, cfra);
 
-				seq_new= seq_dupli_recursive(scene, scene, seq, SEQ_DUPE_UNIQUE_NAME);
+				seq_new = seq_dupli_recursive(scene, scene, seq, SEQ_DUPE_UNIQUE_NAME);
 				BLI_addtail(ed->seqbasep, seq_new);
 
-				seq_new->start= start_ofs;
-				seq_new->type= SEQ_IMAGE;
+				seq_new->start = start_ofs;
+				seq_new->type = SEQ_IMAGE;
 				seq_new->len = 1;
-				seq_new->endstill = step-1;
+				seq_new->endstill = step - 1;
 
 				/* new strip */
-				strip_new= seq_new->strip;
-				strip_new->len= 1;
-				strip_new->us= 1;
+				strip_new = seq_new->strip;
+				strip_new->us = 1;
 
 				/* new stripdata */
-				se_new= strip_new->stripdata;
+				se_new = strip_new->stripdata;
 				BLI_strncpy(se_new->name, se->name, sizeof(se_new->name));
 				calc_sequence(scene, seq_new);
 
-				if(step > 1) {
+				if (step > 1) {
 					seq_new->flag &= ~SEQ_OVERLAP;
 					if (seq_test_overlap(ed->seqbasep, seq_new)) {
 						shuffle_seq(ed->seqbasep, seq_new, scene);
@@ -1783,7 +1802,8 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
 
 			seq_free_sequence(scene, seq);
 			seq = seq->next;
-		} else {
+		}
+		else {
 			seq = seq->next;
 		}
 	}
@@ -1791,7 +1811,7 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
 	/* as last: */
 	sort_seq(scene);
 	
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
 	return OPERATOR_FINISHED;
 }
@@ -1800,16 +1820,16 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
 void SEQUENCER_OT_images_separate(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Separate Images";
-	ot->idname= "SEQUENCER_OT_images_separate";
-	ot->description="On image sequence strips, it returns a strip for each image";
+	ot->name = "Separate Images";
+	ot->idname = "SEQUENCER_OT_images_separate";
+	ot->description = "On image sequence strips, it returns a strip for each image";
 	
 	/* api callbacks */
-	ot->exec= sequencer_separate_images_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->exec = sequencer_separate_images_exec;
+	ot->poll = sequencer_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	RNA_def_int(ot->srna, "length", 1, 1, 1000, "Length", "Length of each frame", 1, INT_MAX);
 }
@@ -1820,19 +1840,19 @@ void SEQUENCER_OT_images_separate(wmOperatorType *ot)
 /* separate_meta_toggle operator */
 static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
-	Sequence *last_seq= seq_active_get(scene);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
+	Sequence *last_seq = seq_active_get(scene);
 	MetaStack *ms;
 
-	if(last_seq && last_seq->type==SEQ_META && last_seq->flag & SELECT) {
+	if (last_seq && last_seq->type == SEQ_META && last_seq->flag & SELECT) {
 		/* Enter Metastrip */
-		ms= MEM_mallocN(sizeof(MetaStack), "metastack");
+		ms = MEM_mallocN(sizeof(MetaStack), "metastack");
 		BLI_addtail(&ed->metastack, ms);
-		ms->parseq= last_seq;
-		ms->oldbasep= ed->seqbasep;
+		ms->parseq = last_seq;
+		ms->oldbasep = ed->seqbasep;
 
-		ed->seqbasep= &last_seq->seqbase;
+		ed->seqbasep = &last_seq->seqbase;
 
 		seq_active_set(scene, NULL);
 
@@ -1842,16 +1862,16 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op))
 
 		Sequence *seq;
 
-		if(ed->metastack.first==NULL)
+		if (ed->metastack.first == NULL)
 			return OPERATOR_CANCELLED;
 
-		ms= ed->metastack.last;
+		ms = ed->metastack.last;
 		BLI_remlink(&ed->metastack, ms);
 
-		ed->seqbasep= ms->oldbasep;
+		ed->seqbasep = ms->oldbasep;
 
 		/* recalc all: the meta can have effects connected to it */
-		for(seq= ed->seqbasep->first; seq; seq= seq->next)
+		for (seq = ed->seqbasep->first; seq; seq = seq->next)
 			calc_sequence(scene, seq);
 
 		seq_active_set(scene, ms->parseq);
@@ -1864,7 +1884,7 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op))
 	}
 
 	seq_update_muting(ed);
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
 	return OPERATOR_FINISHED;
 }
@@ -1872,66 +1892,65 @@ static int sequencer_meta_toggle_exec(bContext *C, wmOperator *UNUSED(op))
 void SEQUENCER_OT_meta_toggle(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Toggle Meta Strip";
-	ot->idname= "SEQUENCER_OT_meta_toggle";
-	ot->description="Toggle a metastrip (to edit enclosed strips)";
+	ot->name = "Toggle Meta Strip";
+	ot->idname = "SEQUENCER_OT_meta_toggle";
+	ot->description = "Toggle a metastrip (to edit enclosed strips)";
 	
 	/* api callbacks */
-	ot->exec= sequencer_meta_toggle_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->exec = sequencer_meta_toggle_exec;
+	ot->poll = sequencer_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 
 /* separate_meta_make operator */
 static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	
 	Sequence *seq, *seqm, *next, *last_seq = seq_active_get(scene);
-	int channel_max= 1;
+	int channel_max = 1;
 
-	if(seqbase_isolated_sel_check(ed->seqbasep)==FALSE) {
+	if (seqbase_isolated_sel_check(ed->seqbasep) == FALSE) {
 		BKE_report(op->reports, RPT_ERROR, "Please select all related strips");
 		return OPERATOR_CANCELLED;
 	}
 
 	/* remove all selected from main list, and put in meta */
 
-	seqm= alloc_sequence(ed->seqbasep, 1, 1); /* channel number set later */
-	strcpy(seqm->name+2, "MetaStrip");
-	seqm->type= SEQ_META;
-	seqm->flag= SELECT;
+	seqm = alloc_sequence(ed->seqbasep, 1, 1); /* channel number set later */
+	strcpy(seqm->name + 2, "MetaStrip");
+	seqm->type = SEQ_META;
+	seqm->flag = SELECT;
 
-	seq= ed->seqbasep->first;
-	while(seq) {
-		next= seq->next;
-		if(seq!=seqm && (seq->flag & SELECT)) {
-			channel_max= MAX2(seq->machine, channel_max);
+	seq = ed->seqbasep->first;
+	while (seq) {
+		next = seq->next;
+		if (seq != seqm && (seq->flag & SELECT)) {
+			channel_max = MAX2(seq->machine, channel_max);
 			BLI_remlink(ed->seqbasep, seq);
 			BLI_addtail(&seqm->seqbase, seq);
 		}
-		seq= next;
+		seq = next;
 	}
-	seqm->machine= last_seq ? last_seq->machine : channel_max;
+	seqm->machine = last_seq ? last_seq->machine : channel_max;
 	calc_sequence(scene, seqm);
 
-	seqm->strip= MEM_callocN(sizeof(Strip), "metastrip");
-	seqm->strip->len= seqm->len;
-	seqm->strip->us= 1;
+	seqm->strip = MEM_callocN(sizeof(Strip), "metastrip");
+	seqm->strip->us = 1;
 	
 	seq_active_set(scene, seqm);
 
-	if( seq_test_overlap(ed->seqbasep, seqm) ) shuffle_seq(ed->seqbasep, seqm, scene);
+	if (seq_test_overlap(ed->seqbasep, seqm) ) shuffle_seq(ed->seqbasep, seqm, scene);
 
 	seq_update_muting(ed);
 
 	seqbase_unique_name_recursive(&scene->ed->seqbase, seqm);
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
 	return OPERATOR_FINISHED;
 }
@@ -1939,17 +1958,17 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
 void SEQUENCER_OT_meta_make(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Make Meta Strip";
-	ot->idname= "SEQUENCER_OT_meta_make";
-	ot->description="Group selected strips into a metastrip";
+	ot->name = "Make Meta Strip";
+	ot->idname = "SEQUENCER_OT_meta_make";
+	ot->description = "Group selected strips into a metastrip";
 	
 	/* api callbacks */
-	ot->invoke= WM_operator_confirm;
-	ot->exec= sequencer_meta_make_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->invoke = WM_operator_confirm;
+	ot->exec = sequencer_meta_make_exec;
+	ot->poll = sequencer_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 
@@ -1965,35 +1984,35 @@ static int seq_depends_on_meta(Sequence *seq, Sequence *seqm)
 /* separate_meta_make operator */
 static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
 
 	Sequence *seq, *last_seq = seq_active_get(scene); /* last_seq checks ed==NULL */
 
-	if(last_seq==NULL || last_seq->type!=SEQ_META)
+	if (last_seq == NULL || last_seq->type != SEQ_META)
 		return OPERATOR_CANCELLED;
 
 	BLI_movelisttolist(ed->seqbasep, &last_seq->seqbase);
 
-	last_seq->seqbase.first= NULL;
-	last_seq->seqbase.last= NULL;
+	last_seq->seqbase.first = NULL;
+	last_seq->seqbase.last = NULL;
 
 	BLI_remlink(ed->seqbasep, last_seq);
 	seq_free_sequence(scene, last_seq);
 
 	/* emtpy meta strip, delete all effects depending on it */
-	for(seq=ed->seqbasep->first; seq; seq=seq->next)
-		if((seq->type & SEQ_EFFECT) && seq_depends_on_meta(seq, last_seq))
+	for (seq = ed->seqbasep->first; seq; seq = seq->next)
+		if ((seq->type & SEQ_EFFECT) && seq_depends_on_meta(seq, last_seq))
 			seq->flag |= SEQ_FLAG_DELETE;
 
 	recurs_del_seq_flag(scene, ed->seqbasep, SEQ_FLAG_DELETE, 0);
 
 	/* test for effects and overlap
-	 * dont use SEQP_BEGIN since that would be recursive */
-	for(seq= ed->seqbasep->first; seq; seq= seq->next) {
-		if(seq->flag & SELECT) {
+	 * don't use SEQP_BEGIN since that would be recursive */
+	for (seq = ed->seqbasep->first; seq; seq = seq->next) {
+		if (seq->flag & SELECT) {
 			seq->flag &= ~SEQ_OVERLAP;
-			if(seq_test_overlap(ed->seqbasep, seq)) {
+			if (seq_test_overlap(ed->seqbasep, seq)) {
 				shuffle_seq(ed->seqbasep, seq, scene);
 			}
 		}
@@ -2002,7 +2021,7 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op))
 	sort_seq(scene);
 	seq_update_muting(ed);
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
 	return OPERATOR_FINISHED;
 }
@@ -2010,29 +2029,29 @@ static int sequencer_meta_separate_exec(bContext *C, wmOperator *UNUSED(op))
 void SEQUENCER_OT_meta_separate(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "UnMeta Strip";
-	ot->idname= "SEQUENCER_OT_meta_separate";
-	ot->description="Put the contents of a metastrip back in the sequencer";
+	ot->name = "UnMeta Strip";
+	ot->idname = "SEQUENCER_OT_meta_separate";
+	ot->description = "Put the contents of a metastrip back in the sequencer";
 	
 	/* api callbacks */
-	ot->invoke= WM_operator_confirm;
-	ot->exec= sequencer_meta_separate_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->invoke = WM_operator_confirm;
+	ot->exec = sequencer_meta_separate_exec;
+	ot->poll = sequencer_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /* view_all operator */
 static int sequencer_view_all_exec(bContext *C, wmOperator *UNUSED(op))
 {
 	//Scene *scene= CTX_data_scene(C);
-	bScreen *sc= CTX_wm_screen(C);
-	ScrArea *area= CTX_wm_area(C);
+	bScreen *sc = CTX_wm_screen(C);
+	ScrArea *area = CTX_wm_area(C);
 	//ARegion *ar= CTX_wm_region(C);
-	View2D *v2d= UI_view2d_fromcontext(C);
+	View2D *v2d = UI_view2d_fromcontext(C);
 
-	v2d->cur= v2d->tot;
+	v2d->cur = v2d->tot;
 	UI_view2d_curRect_validate(v2d);
 	UI_view2d_sync(sc, area, v2d, V2D_LOCK_COPY);
 	
@@ -2043,31 +2062,31 @@ static int sequencer_view_all_exec(bContext *C, wmOperator *UNUSED(op))
 void SEQUENCER_OT_view_all(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View All";
-	ot->idname= "SEQUENCER_OT_view_all";
-	ot->description="View all the strips in the sequencer";
+	ot->name = "View All";
+	ot->idname = "SEQUENCER_OT_view_all";
+	ot->description = "View all the strips in the sequencer";
 	
 	/* api callbacks */
-	ot->exec= sequencer_view_all_exec;
-	ot->poll= ED_operator_sequencer_active;
+	ot->exec = sequencer_view_all_exec;
+	ot->poll = ED_operator_sequencer_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER;
+	ot->flag = OPTYPE_REGISTER;
 }
 
 /* view_all operator */
 static int sequencer_view_all_preview_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	bScreen *sc= CTX_wm_screen(C);
-	ScrArea *area= CTX_wm_area(C);
+	bScreen *sc = CTX_wm_screen(C);
+	ScrArea *area = CTX_wm_area(C);
 #if 0
-	ARegion *ar= CTX_wm_region(C);
-	SpaceSeq *sseq= area->spacedata.first;
-	Scene *scene= CTX_data_scene(C);
+	ARegion *ar = CTX_wm_region(C);
+	SpaceSeq *sseq = area->spacedata.first;
+	Scene *scene = CTX_data_scene(C);
 #endif
-	View2D *v2d= UI_view2d_fromcontext(C);
+	View2D *v2d = UI_view2d_fromcontext(C);
 
-	v2d->cur= v2d->tot;
+	v2d->cur = v2d->tot;
 	UI_view2d_curRect_validate(v2d);
 	UI_view2d_sync(sc, area, v2d, V2D_LOCK_COPY);
 	
@@ -2081,24 +2100,24 @@ static int sequencer_view_all_preview_exec(bContext *C, wmOperator *UNUSED(op))
 
 	seq_reset_imageofs(sseq);
 
-	imgwidth= (scene->r.size*scene->r.xsch)/100;
-	imgheight= (scene->r.size*scene->r.ysch)/100;
+	imgwidth = (scene->r.size * scene->r.xsch) / 100;
+	imgheight = (scene->r.size * scene->r.ysch) / 100;
 
 	/* Apply aspect, dosnt need to be that accurate */
-	imgwidth= (int)(imgwidth * (scene->r.xasp / scene->r.yasp));
+	imgwidth = (int)(imgwidth * (scene->r.xasp / scene->r.yasp));
 
 	if (((imgwidth >= width) || (imgheight >= height)) &&
-		((width > 0) && (height > 0))) {
+	    ((width > 0) && (height > 0))) {
 
 		/* Find the zoom value that will fit the image in the image space */
 		zoomX = ((float)width) / ((float)imgwidth);
 		zoomY = ((float)height) / ((float)imgheight);
-		sseq->zoom= (zoomX < zoomY) ? zoomX : zoomY;
+		sseq->zoom = (zoomX < zoomY) ? zoomX : zoomY;
 
-		sseq->zoom = 1.0f / power_of_2(1/ MIN2(zoomX, zoomY) );
+		sseq->zoom = 1.0f / power_of_2(1 / MIN2(zoomX, zoomY) );
 	}
 	else {
-		sseq->zoom= 1.0f;
+		sseq->zoom = 1.0f;
 	}
 #endif
 
@@ -2109,33 +2128,33 @@ static int sequencer_view_all_preview_exec(bContext *C, wmOperator *UNUSED(op))
 void SEQUENCER_OT_view_all_preview(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View All";
-	ot->idname= "SEQUENCER_OT_view_all_preview";
-	ot->description="Zoom preview to fit in the area";
+	ot->name = "View All";
+	ot->idname = "SEQUENCER_OT_view_all_preview";
+	ot->description = "Zoom preview to fit in the area";
 	
 	/* api callbacks */
-	ot->exec= sequencer_view_all_preview_exec;
-	ot->poll= ED_operator_sequencer_active;
+	ot->exec = sequencer_view_all_preview_exec;
+	ot->poll = ED_operator_sequencer_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER;
+	ot->flag = OPTYPE_REGISTER;
 }
 
 
 static int sequencer_view_zoom_ratio_exec(bContext *C, wmOperator *op)
 {
-	RenderData *r= &CTX_data_scene(C)->r;
-	View2D *v2d= UI_view2d_fromcontext(C);
+	RenderData *r = &CTX_data_scene(C)->r;
+	View2D *v2d = UI_view2d_fromcontext(C);
 
-	float ratio= RNA_float_get(op->ptr, "ratio");
+	float ratio = RNA_float_get(op->ptr, "ratio");
 
-	float winx= (int)(r->size * r->xsch)/100;
-	float winy= (int)(r->size * r->ysch)/100;
+	float winx = (int)(r->size * r->xsch) / 100;
+	float winy = (int)(r->size * r->ysch) / 100;
 
-	float facx= (v2d->mask.xmax - v2d->mask.xmin) / winx;
-	float facy= (v2d->mask.ymax - v2d->mask.ymin) / winy;
+	float facx = (v2d->mask.xmax - v2d->mask.xmin) / winx;
+	float facy = (v2d->mask.ymax - v2d->mask.ymin) / winy;
 
-	BLI_resize_rctf(&v2d->cur, (int)(winx*facx*ratio) + 1, (int)(winy*facy*ratio) + 1);
+	BLI_resize_rctf(&v2d->cur, (int)(winx * facx * ratio) + 1, (int)(winy * facy * ratio) + 1);
 
 	ED_region_tag_redraw(CTX_wm_region(C));
 
@@ -2145,32 +2164,33 @@ static int sequencer_view_zoom_ratio_exec(bContext *C, wmOperator *op)
 void SEQUENCER_OT_view_zoom_ratio(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Sequencer View Zoom Ratio";
-	ot->idname= "SEQUENCER_OT_view_zoom_ratio";
+	ot->name = "Sequencer View Zoom Ratio";
+	ot->idname = "SEQUENCER_OT_view_zoom_ratio";
 	ot->description = "Change zoom ratio of sequencer preview";
 
 	/* api callbacks */
-	ot->exec= sequencer_view_zoom_ratio_exec;
-	ot->poll= ED_operator_sequencer_active;
+	ot->exec = sequencer_view_zoom_ratio_exec;
+	ot->poll = ED_operator_sequencer_active;
 
 	/* properties */
 	RNA_def_float(ot->srna, "ratio", 1.0f, 0.0f, FLT_MAX,
-		"Ratio", "Zoom ratio, 1.0 is 1:1, higher is zoomed in, lower is zoomed out", -FLT_MAX, FLT_MAX);
+	              "Ratio", "Zoom ratio, 1.0 is 1:1, higher is zoomed in, lower is zoomed out", -FLT_MAX, FLT_MAX);
 }
 
 
 #if 0
 static EnumPropertyItem view_type_items[] = {
-		{SEQ_VIEW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""},
-		{SEQ_VIEW_PREVIEW,  "PREVIEW", ICON_SEQ_PREVIEW, "Image Preview", ""},
-		{SEQ_VIEW_SEQUENCE_PREVIEW,  "SEQUENCER_PREVIEW", ICON_SEQ_SEQUENCER, "Sequencer and Image Preview", ""},
-		{0, NULL, 0, NULL, NULL}};
+	{SEQ_VIEW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""},
+	{SEQ_VIEW_PREVIEW,  "PREVIEW", ICON_SEQ_PREVIEW, "Image Preview", ""},
+	{SEQ_VIEW_SEQUENCE_PREVIEW,  "SEQUENCER_PREVIEW", ICON_SEQ_SEQUENCER, "Sequencer and Image Preview", ""},
+	{0, NULL, 0, NULL, NULL}
+};
 #endif
 
 /* view_all operator */
 static int sequencer_view_toggle_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	SpaceSeq *sseq= (SpaceSeq *)CTX_wm_space_data(C);
+	SpaceSeq *sseq = (SpaceSeq *)CTX_wm_space_data(C);
 
 	sseq->view++;
 	if (sseq->view > SEQ_VIEW_SEQUENCE_PREVIEW) sseq->view = SEQ_VIEW_SEQUENCE;
@@ -2183,48 +2203,48 @@ static int sequencer_view_toggle_exec(bContext *C, wmOperator *UNUSED(op))
 void SEQUENCER_OT_view_toggle(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View Toggle";
-	ot->idname= "SEQUENCER_OT_view_toggle";
-	ot->description="Toggle between sequencer views (sequence, preview, both)";
+	ot->name = "View Toggle";
+	ot->idname = "SEQUENCER_OT_view_toggle";
+	ot->description = "Toggle between sequencer views (sequence, preview, both)";
 	
 	/* api callbacks */
-	ot->exec= sequencer_view_toggle_exec;
-	ot->poll= ED_operator_sequencer_active;
+	ot->exec = sequencer_view_toggle_exec;
+	ot->poll = ED_operator_sequencer_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER;
+	ot->flag = OPTYPE_REGISTER;
 }
 
 
 /* view_selected operator */
 static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
-	View2D *v2d= UI_view2d_fromcontext(C);
-	ScrArea *area= CTX_wm_area(C);
-	bScreen *sc= CTX_wm_screen(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Scene *scene = CTX_data_scene(C);
+	View2D *v2d = UI_view2d_fromcontext(C);
+	ScrArea *area = CTX_wm_area(C);
+	bScreen *sc = CTX_wm_screen(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	Sequence *seq;
 
-	int xmin=  MAXFRAME*2;
-	int xmax= -MAXFRAME*2;
-	int ymin=  MAXSEQ+1;
-	int ymax= 0;
+	int xmin =  MAXFRAME * 2;
+	int xmax = -MAXFRAME * 2;
+	int ymin =  MAXSEQ + 1;
+	int ymax = 0;
 	int orig_height;
 	int ymid;
-	int ymargin= 1;
-	int xmargin= FPS;
+	int ymargin = 1;
+	int xmargin = FPS;
 
-	if(ed==NULL)
+	if (ed == NULL)
 		return OPERATOR_CANCELLED;
 
-	for(seq=ed->seqbasep->first; seq; seq=seq->next) {
-		if(seq->flag & SELECT) {
-			xmin= MIN2(xmin, seq->startdisp);
-			xmax= MAX2(xmax, seq->enddisp);
+	for (seq = ed->seqbasep->first; seq; seq = seq->next) {
+		if (seq->flag & SELECT) {
+			xmin = MIN2(xmin, seq->startdisp);
+			xmax = MAX2(xmax, seq->enddisp);
 
-			ymin= MIN2(ymin, seq->machine);
-			ymax= MAX2(ymax, seq->machine);
+			ymin = MIN2(ymin, seq->machine);
+			ymax = MAX2(ymax, seq->machine);
 		}
 	}
 
@@ -2235,20 +2255,20 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
 		ymax += ymargin;
 		ymin -= ymargin;
 
-		orig_height= v2d->cur.ymax - v2d->cur.ymin;
+		orig_height = v2d->cur.ymax - v2d->cur.ymin;
 
-		v2d->cur.xmin= xmin;
-		v2d->cur.xmax= xmax;
+		v2d->cur.xmin = xmin;
+		v2d->cur.xmax = xmax;
 
-		v2d->cur.ymin= ymin;
-		v2d->cur.ymax= ymax;
+		v2d->cur.ymin = ymin;
+		v2d->cur.ymax = ymax;
 
 		/* only zoom out vertically */
 		if (orig_height > v2d->cur.ymax - v2d->cur.ymin) {
-			ymid= (v2d->cur.ymax + v2d->cur.ymin) / 2;
+			ymid = (v2d->cur.ymax + v2d->cur.ymin) / 2;
 
-			v2d->cur.ymin= ymid - (orig_height/2);
-			v2d->cur.ymax= ymid + (orig_height/2);
+			v2d->cur.ymin = ymid - (orig_height / 2);
+			v2d->cur.ymax = ymid + (orig_height / 2);
 		}
 
 		UI_view2d_curRect_validate(v2d);
@@ -2263,31 +2283,31 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
 void SEQUENCER_OT_view_selected(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View Selected";
-	ot->idname= "SEQUENCER_OT_view_selected";
-	ot->description="Zoom the sequencer on the selected strips";
+	ot->name = "View Selected";
+	ot->idname = "SEQUENCER_OT_view_selected";
+	ot->description = "Zoom the sequencer on the selected strips";
 	
 	/* api callbacks */
-	ot->exec= sequencer_view_selected_exec;
-	ot->poll= ED_operator_sequencer_active;
+	ot->exec = sequencer_view_selected_exec;
+	ot->poll = ED_operator_sequencer_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER;
+	ot->flag = OPTYPE_REGISTER;
 }
 
 
 static int find_next_prev_edit(Scene *scene, int cfra, int side)
 {
-	Editing *ed= seq_give_editing(scene, FALSE);
-	Sequence *seq,*best_seq = NULL,*frame_seq = NULL;
+	Editing *ed = seq_give_editing(scene, FALSE);
+	Sequence *seq, *best_seq = NULL, *frame_seq = NULL;
 	
 	int dist, best_dist;
-	best_dist = MAXFRAME*2;
+	best_dist = MAXFRAME * 2;
 
-	if(ed==NULL) return cfra;
+	if (ed == NULL) return cfra;
 	
-	for(seq= ed->seqbasep->first; seq; seq= seq->next) {
-		dist = MAXFRAME*2;
+	for (seq = ed->seqbasep->first; seq; seq = seq->next) {
+		dist = MAXFRAME * 2;
 			
 		switch (side) {
 			case SEQ_SIDE_LEFT:
@@ -2298,8 +2318,9 @@ static int find_next_prev_edit(Scene *scene, int cfra, int side)
 			case SEQ_SIDE_RIGHT:
 				if (seq->startdisp > cfra) {
 					dist = seq->startdisp - cfra;
-				} else if (seq->startdisp == cfra) {
-					frame_seq=seq;
+				}
+				else if (seq->startdisp == cfra) {
+					frame_seq = seq;
 				}
 				break;
 		}
@@ -2311,8 +2332,8 @@ static int find_next_prev_edit(Scene *scene, int cfra, int side)
 	}
 
 	/* if no sequence to the right is found and the
-	   frame is on the start of the last sequence,
-	   move to the end of the last sequence */
+	 * frame is on the start of the last sequence,
+	 * move to the end of the last sequence */
 	if (frame_seq) cfra = frame_seq->enddisp;
 
 	return best_seq ? best_seq->startdisp : cfra;
@@ -2320,13 +2341,13 @@ static int find_next_prev_edit(Scene *scene, int cfra, int side)
 
 static int next_prev_edit_internal(Scene *scene, int side)
 {
-	int change=0;
+	int change = 0;
 	int cfra = CFRA;
-	int nfra= find_next_prev_edit(scene, cfra, side);
+	int nfra = find_next_prev_edit(scene, cfra, side);
 	
 	if (nfra != cfra) {
 		CFRA = nfra;
-		change= 1;
+		change = 1;
 	}
 
 	return change;
@@ -2335,12 +2356,12 @@ static int next_prev_edit_internal(Scene *scene, int side)
 /* move frame to next edit point operator */
 static int sequencer_next_edit_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	
-	if(!next_prev_edit_internal(scene, SEQ_SIDE_RIGHT))
+	if (!next_prev_edit_internal(scene, SEQ_SIDE_RIGHT))
 		return OPERATOR_CANCELLED;
 
-	WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
 
 	return OPERATOR_FINISHED;
 }
@@ -2348,16 +2369,16 @@ static int sequencer_next_edit_exec(bContext *C, wmOperator *UNUSED(op))
 void SEQUENCER_OT_next_edit(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Next Edit";
-	ot->idname= "SEQUENCER_OT_next_edit";
-	ot->description="Move frame to next edit point";
+	ot->name = "Next Edit";
+	ot->idname = "SEQUENCER_OT_next_edit";
+	ot->description = "Move frame to next edit point";
 	
 	/* api callbacks */
-	ot->exec= sequencer_next_edit_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->exec = sequencer_next_edit_exec;
+	ot->poll = sequencer_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* properties */
 }
@@ -2365,12 +2386,12 @@ void SEQUENCER_OT_next_edit(wmOperatorType *ot)
 /* move frame to previous edit point operator */
 static int sequencer_previous_edit_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	
-	if(!next_prev_edit_internal(scene, SEQ_SIDE_LEFT))
+	if (!next_prev_edit_internal(scene, SEQ_SIDE_LEFT))
 		return OPERATOR_CANCELLED;
 
-	WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_FRAME, scene);
 	
 	return OPERATOR_FINISHED;
 }
@@ -2378,21 +2399,21 @@ static int sequencer_previous_edit_exec(bContext *C, wmOperator *UNUSED(op))
 void SEQUENCER_OT_previous_edit(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Previous Edit";
-	ot->idname= "SEQUENCER_OT_previous_edit";
-	ot->description="Move frame to previous edit point";
+	ot->name = "Previous Edit";
+	ot->idname = "SEQUENCER_OT_previous_edit";
+	ot->description = "Move frame to previous edit point";
 	
 	/* api callbacks */
-	ot->exec= sequencer_previous_edit_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->exec = sequencer_previous_edit_exec;
+	ot->poll = sequencer_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* properties */
 }
 
-static void swap_sequence(Scene* scene, Sequence* seqa, Sequence* seqb)
+static void swap_sequence(Scene *scene, Sequence *seqa, Sequence *seqb)
 {
 	int gap = seqb->startdisp - seqa->enddisp;
 	seqb->start = (seqb->start - seqb->startdisp) + seqa->startdisp;
@@ -2402,15 +2423,15 @@ static void swap_sequence(Scene* scene, Sequence* seqa, Sequence* seqb)
 }
 
 #if 0
-static Sequence* sequence_find_parent(Scene* scene, Sequence* child)
+static Sequence *sequence_find_parent(Scene *scene, Sequence *child)
 {
-	Editing *ed= seq_give_editing(scene, FALSE);
-	Sequence *parent= NULL;
+	Editing *ed = seq_give_editing(scene, FALSE);
+	Sequence *parent = NULL;
 	Sequence *seq;
 
-	if(ed==NULL) return NULL;
+	if (ed == NULL) return NULL;
 
-	for(seq= ed->seqbasep->first; seq; seq= seq->next) {
+	for (seq = ed->seqbasep->first; seq; seq = seq->next) {
 		if ( (seq != child) && seq_is_parent(seq, child) ) {
 			parent = seq;
 			break;
@@ -2423,17 +2444,17 @@ static Sequence* sequence_find_parent(Scene* scene, Sequence* child)
 
 static int sequencer_swap_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	Sequence *active_seq = seq_active_get(scene);
 	Sequence *seq, *iseq;
-	int side= RNA_enum_get(op->ptr, "side");
+	int side = RNA_enum_get(op->ptr, "side");
 
-	if(active_seq==NULL) return OPERATOR_CANCELLED;
+	if (active_seq == NULL) return OPERATOR_CANCELLED;
 
 	seq = find_next_prev_sequence(scene, active_seq, side, -1);
 	
-	if(seq) {
+	if (seq) {
 		
 		/* disallow effect strips */
 		if (get_sequence_effect_num_inputs(seq->type) >= 1 && (seq->effectdata || seq->seq1 || seq->seq2 || seq->seq3))
@@ -2451,17 +2472,17 @@ static int sequencer_swap_exec(bContext *C, wmOperator *op)
 		}
 
 		// XXX - should be a generic function
-		for(iseq= scene->ed->seqbasep->first; iseq; iseq= iseq->next) {
-			if((iseq->type & SEQ_EFFECT) && (seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) {
+		for (iseq = scene->ed->seqbasep->first; iseq; iseq = iseq->next) {
+			if ((iseq->type & SEQ_EFFECT) && (seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) {
 				calc_sequence(scene, iseq);
 			}
 		}
 
 		/* do this in a new loop since both effects need to be calculated first */
-		for(iseq= scene->ed->seqbasep->first; iseq; iseq= iseq->next) {
-			if((iseq->type & SEQ_EFFECT) && (seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) {
+		for (iseq = scene->ed->seqbasep->first; iseq; iseq = iseq->next) {
+			if ((iseq->type & SEQ_EFFECT) && (seq_is_parent(iseq, active_seq) || seq_is_parent(iseq, seq))) {
 				/* this may now overlap */
-				if( seq_test_overlap(ed->seqbasep, iseq) ) {
+				if (seq_test_overlap(ed->seqbasep, iseq) ) {
 					shuffle_seq(ed->seqbasep, iseq, scene);
 				}
 			}
@@ -2471,7 +2492,7 @@ static int sequencer_swap_exec(bContext *C, wmOperator *op)
 
 		sort_seq(scene);
 
-		WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+		WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
 		return OPERATOR_FINISHED;
 	}
@@ -2482,16 +2503,16 @@ static int sequencer_swap_exec(bContext *C, wmOperator *op)
 void SEQUENCER_OT_swap(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Swap Strip";
-	ot->idname= "SEQUENCER_OT_swap";
-	ot->description="Swap active strip with strip to the right or left";
+	ot->name = "Swap Strip";
+	ot->idname = "SEQUENCER_OT_swap";
+	ot->description = "Swap active strip with strip to the right or left";
 	
 	/* api callbacks */
-	ot->exec= sequencer_swap_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->exec = sequencer_swap_exec;
+	ot->poll = sequencer_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_enum(ot->srna, "side", prop_side_lr_types, SEQ_SIDE_RIGHT, "Side", "Side of the strip to swap");
@@ -2500,37 +2521,37 @@ void SEQUENCER_OT_swap(wmOperatorType *ot)
 static int sequencer_rendersize_exec(bContext *C, wmOperator *UNUSED(op))
 {
 	int retval = OPERATOR_CANCELLED;
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	Sequence *active_seq = seq_active_get(scene);
 	StripElem *se = NULL;
 
-	if(active_seq==NULL)
+	if (active_seq == NULL)
 		return OPERATOR_CANCELLED;
 
 
 	if (active_seq->strip) {
 		switch (active_seq->type) {
-		case SEQ_IMAGE:
-			se = give_stripelem(active_seq, scene->r.cfra);
-			break;
-		case SEQ_MOVIE:
-			se = active_seq->strip->stripdata;
-			break;
-		case SEQ_SCENE:
-		case SEQ_META:
-		case SEQ_RAM_SOUND:
-		case SEQ_HD_SOUND:
-		default:
-			break;
+			case SEQ_IMAGE:
+				se = give_stripelem(active_seq, scene->r.cfra);
+				break;
+			case SEQ_MOVIE:
+				se = active_seq->strip->stripdata;
+				break;
+			case SEQ_SCENE:
+			case SEQ_META:
+			case SEQ_RAM_SOUND:
+			case SEQ_HD_SOUND:
+			default:
+				break;
 		}
 	}
 
 	if (se) {
 		// prevent setting the render size if sequence values aren't initialized
 		if ( (se->orig_width > 0) && (se->orig_height > 0) ) {
-			scene->r.xsch= se->orig_width;
-			scene->r.ysch= se->orig_height;
-			WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene);
+			scene->r.xsch = se->orig_width;
+			scene->r.ysch = se->orig_height;
+			WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene);
 			retval = OPERATOR_FINISHED;
 		}
 	}
@@ -2541,29 +2562,29 @@ static int sequencer_rendersize_exec(bContext *C, wmOperator *UNUSED(op))
 void SEQUENCER_OT_rendersize(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Render Size";
-	ot->idname= "SEQUENCER_OT_rendersize";
-	ot->description="Set render size and aspect from active sequence";
+	ot->name = "Set Render Size";
+	ot->idname = "SEQUENCER_OT_rendersize";
+	ot->description = "Set render size and aspect from active sequence";
 	
 	/* api callbacks */
-	ot->exec= sequencer_rendersize_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->exec = sequencer_rendersize_exec;
+	ot->poll = sequencer_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* properties */
 }
 
 static void seq_copy_del_sound(Scene *scene, Sequence *seq)
 {
-	if(seq->type == SEQ_META) {
+	if (seq->type == SEQ_META) {
 		Sequence *iseq;
-		for(iseq= seq->seqbase.first; iseq; iseq= iseq->next) {
+		for (iseq = seq->seqbase.first; iseq; iseq = iseq->next) {
 			seq_copy_del_sound(scene, iseq);
 		}
 	}
-	else if(seq->scene_sound) {
+	else if (seq->scene_sound) {
 		sound_remove_scene_sound(scene, seq->scene_sound);
 		seq->scene_sound = NULL;
 	}
@@ -2572,15 +2593,15 @@ static void seq_copy_del_sound(Scene *scene, Sequence *seq)
 /* TODO, validate scenes */
 static int sequencer_copy_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	Sequence *seq;
 
-	ListBase nseqbase= {NULL, NULL};
+	ListBase nseqbase = {NULL, NULL};
 
 	seq_free_clipboard();
 
-	if(seqbase_isolated_sel_check(ed->seqbasep)==FALSE) {
+	if (seqbase_isolated_sel_check(ed->seqbasep) == FALSE) {
 		BKE_report(op->reports, RPT_ERROR, "Please select all related strips");
 		return OPERATOR_CANCELLED;
 	}
@@ -2590,27 +2611,27 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op)
 	/* To make sure the copied strips have unique names between each other add
 	 * them temporarily to the end of the original seqbase. (bug 25932)
 	 */
-	if(nseqbase.first) {
+	if (nseqbase.first) {
 		Sequence *seq, *first_seq = nseqbase.first;
 		BLI_movelisttolist(ed->seqbasep, &nseqbase);
 
-		for(seq=first_seq; seq; seq=seq->next)
+		for (seq = first_seq; seq; seq = seq->next)
 			seq_recursive_apply(seq, apply_unique_name_cb, scene);
 
 		seqbase_clipboard.first = first_seq;
 		seqbase_clipboard.last = ed->seqbasep->last;
 
-		if(first_seq->prev) {
+		if (first_seq->prev) {
 			first_seq->prev->next = NULL;
 			ed->seqbasep->last = first_seq->prev;
 			first_seq->prev = NULL;
 		}
 	}
 
-	seqbase_clipboard_frame= scene->r.cfra;
+	seqbase_clipboard_frame = scene->r.cfra;
 
 	/* Need to remove anything that references the current scene */
-	for(seq= seqbase_clipboard.first; seq; seq= seq->next) {
+	for (seq = seqbase_clipboard.first; seq; seq = seq->next) {
 		seq_copy_del_sound(scene, seq);
 	}
 
@@ -2620,37 +2641,37 @@ static int sequencer_copy_exec(bContext *C, wmOperator *op)
 void SEQUENCER_OT_copy(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Copy";
-	ot->idname= "SEQUENCER_OT_copy";
-	ot->description="";
+	ot->name = "Copy";
+	ot->idname = "SEQUENCER_OT_copy";
+	ot->description = "";
 
 	/* api callbacks */
-	ot->exec= sequencer_copy_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->exec = sequencer_copy_exec;
+	ot->poll = sequencer_edit_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER;
+	ot->flag = OPTYPE_REGISTER;
 
 	/* properties */
 }
 
 static void seq_paste_add_sound(Scene *scene, Sequence *seq)
 {
-	if(seq->type == SEQ_META) {
+	if (seq->type == SEQ_META) {
 		Sequence *iseq;
-		for(iseq= seq->seqbase.first; iseq; iseq= iseq->next) {
+		for (iseq = seq->seqbase.first; iseq; iseq = iseq->next) {
 			seq_paste_add_sound(scene, iseq);
 		}
 	}
-	else if(seq->type == SEQ_SOUND) {
+	else if (seq->type == SEQ_SOUND) {
 		seq->scene_sound = sound_add_scene_sound_defaults(scene, seq);
 	}
 }
 
 static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, TRUE); /* create if needed */
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, TRUE); /* create if needed */
 	ListBase nseqbase = {NULL, NULL};
 	int ofs;
 	Sequence *iseq;
@@ -2661,8 +2682,8 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
 	seqbase_dupli_recursive(scene, NULL, &nseqbase, &seqbase_clipboard, SEQ_DUPE_UNIQUE_NAME);
 
 	/* transform pasted strips before adding */
-	if(ofs) {
-		for(iseq= nseqbase.first; iseq; iseq= iseq->next) {
+	if (ofs) {
+		for (iseq = nseqbase.first; iseq; iseq = iseq->next) {
 			seq_translate(scene, iseq, ofs);
 			seq_sound_init(scene, iseq);
 		}
@@ -2673,14 +2694,14 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
 	BLI_movelisttolist(ed->seqbasep, &nseqbase);
 
 	/* make sure the pasted strips have unique names between them */
-	for(; iseq; iseq=iseq->next) {
+	for (; iseq; iseq = iseq->next) {
 		seq_recursive_apply(iseq, apply_unique_name_cb, scene);
 
 		/* restore valid sound_scene for newly added strips */
 		seq_paste_add_sound(scene, iseq);
 	}
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
 	return OPERATOR_FINISHED;
 }
@@ -2688,33 +2709,33 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
 void SEQUENCER_OT_paste(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Paste";
-	ot->idname= "SEQUENCER_OT_paste";
-	ot->description="";
+	ot->name = "Paste";
+	ot->idname = "SEQUENCER_OT_paste";
+	ot->description = "";
 
 	/* api callbacks */
-	ot->exec= sequencer_paste_exec;
-	ot->poll= ED_operator_sequencer_active;
+	ot->exec = sequencer_paste_exec;
+	ot->poll = ED_operator_sequencer_active;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* properties */
 }
 
 static int sequencer_swap_data_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	Sequence *seq_act;
 	Sequence *seq_other;
 	const char *error_msg;
 
-	if(seq_active_pair_get(scene, &seq_act, &seq_other) == 0) {
+	if (seq_active_pair_get(scene, &seq_act, &seq_other) == 0) {
 		BKE_report(op->reports, RPT_ERROR, "Must select 2 strips");
 		return OPERATOR_CANCELLED;
 	}
 
-	if(seq_swap(seq_act, seq_other, &error_msg) == 0) {
+	if (seq_swap(seq_act, seq_other, &error_msg) == 0) {
 		BKE_report(op->reports, RPT_ERROR, error_msg);
 		return OPERATOR_CANCELLED;
 	}
@@ -2722,16 +2743,16 @@ static int sequencer_swap_data_exec(bContext *C, wmOperator *op)
 	sound_remove_scene_sound(scene, seq_act->scene_sound);
 	sound_remove_scene_sound(scene, seq_other->scene_sound);
 
-	seq_act->scene_sound= NULL;
-	seq_other->scene_sound= NULL;
+	seq_act->scene_sound = NULL;
+	seq_other->scene_sound = NULL;
 
 	calc_sequence(scene, seq_act);
 	calc_sequence(scene, seq_other);
 
-	if(seq_act->sound)		sound_add_scene_sound_defaults(scene, seq_act);
-	if(seq_other->sound)	sound_add_scene_sound_defaults(scene, seq_other);
+	if (seq_act->sound) sound_add_scene_sound_defaults(scene, seq_act);
+	if (seq_other->sound) sound_add_scene_sound_defaults(scene, seq_other);
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
 	return OPERATOR_FINISHED;
 }
@@ -2739,16 +2760,16 @@ static int sequencer_swap_data_exec(bContext *C, wmOperator *op)
 void SEQUENCER_OT_swap_data(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Sequencer Swap Data";
-	ot->idname= "SEQUENCER_OT_swap_data";
-	ot->description="Swap 2 sequencer strips";
+	ot->name = "Sequencer Swap Data";
+	ot->idname = "SEQUENCER_OT_swap_data";
+	ot->description = "Swap 2 sequencer strips";
 
 	/* api callbacks */
-	ot->exec= sequencer_swap_data_exec;
-	ot->poll= ED_operator_sequencer_active;
+	ot->exec = sequencer_swap_data_exec;
+	ot->poll = ED_operator_sequencer_active;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* properties */
 }
@@ -2756,9 +2777,9 @@ void SEQUENCER_OT_swap_data(wmOperatorType *ot)
 /* borderselect operator */
 static int view_ghost_border_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
-	View2D *v2d= UI_view2d_fromcontext(C);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
+	View2D *v2d = UI_view2d_fromcontext(C);
 
 	rctf rect;
 
@@ -2766,7 +2787,7 @@ static int view_ghost_border_exec(bContext *C, wmOperator *op)
 	UI_view2d_region_to_view(v2d, RNA_int_get(op->ptr, "xmin"), RNA_int_get(op->ptr, "ymin"), &rect.xmin, &rect.ymin);
 	UI_view2d_region_to_view(v2d, RNA_int_get(op->ptr, "xmax"), RNA_int_get(op->ptr, "ymax"), &rect.xmax, &rect.ymax);
 
-	if(ed==NULL)
+	if (ed == NULL)
 		return OPERATOR_CANCELLED;
 
 	rect.xmin /=  (float)(ABS(v2d->tot.xmax - v2d->tot.xmin));
@@ -2775,19 +2796,19 @@ static int view_ghost_border_exec(bContext *C, wmOperator *op)
 	rect.xmax /=  (float)(ABS(v2d->tot.xmax - v2d->tot.xmin));
 	rect.ymax /=  (float)(ABS(v2d->tot.ymax - v2d->tot.ymin));
 
-	rect.xmin+=0.5f;
-	rect.xmax+=0.5f;
-	rect.ymin+=0.5f;
-	rect.ymax+=0.5f;
+	rect.xmin += 0.5f;
+	rect.xmax += 0.5f;
+	rect.ymin += 0.5f;
+	rect.ymax += 0.5f;
 
 	CLAMP(rect.xmin, 0.0f, 1.0f);
 	CLAMP(rect.ymin, 0.0f, 1.0f);
 	CLAMP(rect.xmax, 0.0f, 1.0f);
 	CLAMP(rect.ymax, 0.0f, 1.0f);
 
-	scene->ed->over_border= rect;
+	scene->ed->over_border = rect;
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
 	return OPERATOR_FINISHED;
 }
@@ -2796,19 +2817,19 @@ static int view_ghost_border_exec(bContext *C, wmOperator *op)
 void SEQUENCER_OT_view_ghost_border(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Border Offset View";
-	ot->idname= "SEQUENCER_OT_view_ghost_border";
-	ot->description="Enable border select mode";
+	ot->name = "Border Offset View";
+	ot->idname = "SEQUENCER_OT_view_ghost_border";
+	ot->description = "Enable border select mode";
 
 	/* api callbacks */
-	ot->invoke= WM_border_select_invoke;
-	ot->exec= view_ghost_border_exec;
-	ot->modal= WM_border_select_modal;
-	ot->poll= sequencer_view_poll;
-	ot->cancel= WM_border_select_cancel;
+	ot->invoke = WM_border_select_invoke;
+	ot->exec = view_ghost_border_exec;
+	ot->modal = WM_border_select_modal;
+	ot->poll = sequencer_view_poll;
+	ot->cancel = WM_border_select_cancel;
 
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 
 	/* rna */
 	WM_operator_properties_gesture_border(ot, FALSE);
@@ -2817,33 +2838,24 @@ void SEQUENCER_OT_view_ghost_border(wmOperatorType *ot)
 /* rebuild_proxy operator */
 static int sequencer_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene = CTX_data_scene(C);
-	Editing *ed = seq_give_editing(scene, FALSE);
-	Sequence * seq;
+	seq_proxy_build_job(C);
 
-	SEQP_BEGIN(ed, seq) {
-		if ((seq->flag & SELECT)) {
-			seq_proxy_build_job(C, seq);
-		}
-	}
-	SEQ_END
-		
 	return OPERATOR_FINISHED;
 }
 
 void SEQUENCER_OT_rebuild_proxy(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Rebuild Proxy and Timecode Indices";
-	ot->idname= "SEQUENCER_OT_rebuild_proxy";
-	ot->description="Rebuild all selected proxies and timecode indeces using the job system";
+	ot->name = "Rebuild Proxy and Timecode Indices";
+	ot->idname = "SEQUENCER_OT_rebuild_proxy";
+	ot->description = "Rebuild all selected proxies and timecode indeces using the job system";
 	
 	/* api callbacks */
-	ot->exec= sequencer_rebuild_proxy_exec;
-	ot->poll= ED_operator_sequencer_active;
+	ot->exec = sequencer_rebuild_proxy_exec;
+	ot->poll = ED_operator_sequencer_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER;
+	ot->flag = OPTYPE_REGISTER;
 }
 
 /* change ops */
@@ -2857,28 +2869,28 @@ static EnumPropertyItem prop_change_effect_input_types[] = {
 
 static int sequencer_change_effect_input_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
-	Sequence *seq= seq_active_get(scene);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
+	Sequence *seq = seq_active_get(scene);
 
 	Sequence **seq_1, **seq_2;
 
-	switch(RNA_enum_get(op->ptr, "swap")) {
+	switch (RNA_enum_get(op->ptr, "swap")) {
 		case 0:
-			seq_1= &seq->seq1;
-			seq_2= &seq->seq2;
+			seq_1 = &seq->seq1;
+			seq_2 = &seq->seq2;
 			break;
 		case 1:
-			seq_1= &seq->seq2;
-			seq_2= &seq->seq3;
+			seq_1 = &seq->seq2;
+			seq_2 = &seq->seq3;
 			break;
 		default: /* 2 */
-			seq_1= &seq->seq1;
-			seq_2= &seq->seq3;
+			seq_1 = &seq->seq1;
+			seq_2 = &seq->seq3;
 			break;
 	}
 
-	if(*seq_1 == NULL || *seq_2 == NULL) {
+	if (*seq_1 == NULL || *seq_2 == NULL) {
 		BKE_report(op->reports, RPT_ERROR, "One of the effect inputs is unset, can't swap");
 		return OPERATOR_CANCELLED;
 	}
@@ -2888,10 +2900,10 @@ static int sequencer_change_effect_input_exec(bContext *C, wmOperator *op)
 
 	update_changed_seq_and_deps(scene, seq, 0, 1);
 
-	/* important else we dont get the imbuf cache flushed */
+	/* important else we don't get the imbuf cache flushed */
 	free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE);
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
 	return OPERATOR_FINISHED;
 }
@@ -2899,26 +2911,26 @@ static int sequencer_change_effect_input_exec(bContext *C, wmOperator *op)
 void SEQUENCER_OT_change_effect_input(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Change Effect Input";
-	ot->idname= "SEQUENCER_OT_change_effect_input";
-	ot->description="";
+	ot->name = "Change Effect Input";
+	ot->idname = "SEQUENCER_OT_change_effect_input";
+	ot->description = "";
 
 	/* api callbacks */
-	ot->exec= sequencer_change_effect_input_exec;
-	ot->poll= sequencer_effect_poll;
+	ot->exec = sequencer_change_effect_input_exec;
+	ot->poll = sequencer_effect_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-	ot->prop= RNA_def_enum(ot->srna, "swap", prop_change_effect_input_types, 0, "Swap", "The effect inputs to swap");
+	ot->prop = RNA_def_enum(ot->srna, "swap", prop_change_effect_input_types, 0, "Swap", "The effect inputs to swap");
 }
 
 static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
-	Sequence *seq= seq_active_get(scene);
-	const int new_type= RNA_enum_get(op->ptr, "type");
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
+	Sequence *seq = seq_active_get(scene);
+	const int new_type = RNA_enum_get(op->ptr, "type");
 
 	/* free previous effect and init new effect */
 	struct SeqEffectHandle sh;
@@ -2927,11 +2939,11 @@ static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op)
 		return OPERATOR_CANCELLED;
 	}
 
-	/* can someone explain the logic behind only allowing to increse this,
+	/* can someone explain the logic behind only allowing to increase this,
 	 * copied from 2.4x - campbell */
 	if (get_sequence_effect_num_inputs(seq->type) <
-		get_sequence_effect_num_inputs(new_type)
-	) {
+	    get_sequence_effect_num_inputs(new_type))
+	{
 		BKE_report(op->reports, RPT_ERROR, "New effect needs more input strips");
 		return OPERATOR_CANCELLED;
 	}
@@ -2939,7 +2951,7 @@ static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op)
 		sh = get_sequence_effect(seq);
 		sh.free(seq);
 
-		seq->type= new_type;
+		seq->type = new_type;
 
 		sh = get_sequence_effect(seq);
 		sh.init(seq);
@@ -2948,10 +2960,10 @@ static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op)
 	/* update */
 	update_changed_seq_and_deps(scene, seq, 0, 1);
 
-	/* important else we dont get the imbuf cache flushed */
+	/* important else we don't get the imbuf cache flushed */
 	free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE);
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
 	return OPERATOR_FINISHED;
 }
@@ -2959,34 +2971,34 @@ static int sequencer_change_effect_type_exec(bContext *C, wmOperator *op)
 void SEQUENCER_OT_change_effect_type(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Change Effect Type";
-	ot->idname= "SEQUENCER_OT_change_effect_type";
-	ot->description="";
+	ot->name = "Change Effect Type";
+	ot->idname = "SEQUENCER_OT_change_effect_type";
+	ot->description = "";
 
 	/* api callbacks */
-	ot->exec= sequencer_change_effect_type_exec;
-	ot->poll= sequencer_effect_poll;
+	ot->exec = sequencer_change_effect_type_exec;
+	ot->poll = sequencer_effect_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-	ot->prop= RNA_def_enum(ot->srna, "type", sequencer_prop_effect_types, SEQ_CROSS, "Type", "Sequencer effect type");
+	ot->prop = RNA_def_enum(ot->srna, "type", sequencer_prop_effect_types, SEQ_CROSS, "Type", "Sequencer effect type");
 }
 
 static int sequencer_change_path_exec(bContext *C, wmOperator *op)
 {
-	Main *bmain= CTX_data_main(C);
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
-	Sequence *seq= seq_active_get(scene);
-	const int is_relative_path= RNA_boolean_get(op->ptr, "relative_path");
+	Main *bmain = CTX_data_main(C);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
+	Sequence *seq = seq_active_get(scene);
+	const int is_relative_path = RNA_boolean_get(op->ptr, "relative_path");
 
-	if(seq->type == SEQ_IMAGE) {
+	if (seq->type == SEQ_IMAGE) {
 		char directory[FILE_MAX];
-		const int len= RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
+		const int len = RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
 		StripElem *se;
 
-		if(len==0)
+		if (len == 0)
 			return OPERATOR_CANCELLED;
 
 		RNA_string_get(op->ptr, "directory", directory);
@@ -2998,13 +3010,13 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op)
 		}
 		BLI_strncpy(seq->strip->dir, directory, sizeof(seq->strip->dir));
 
-		if(seq->strip->stripdata) {
+		if (seq->strip->stripdata) {
 			MEM_freeN(seq->strip->stripdata);
 		}
-		seq->strip->stripdata= se= MEM_callocN(len*sizeof(StripElem), "stripelem");
+		seq->strip->stripdata = se = MEM_callocN(len * sizeof(StripElem), "stripelem");
 
 		RNA_BEGIN(op->ptr, itemptr, "files") {
-			char *filename= RNA_string_get_alloc(&itemptr, "name", NULL, 0);
+			char *filename = RNA_string_get_alloc(&itemptr, "name", NULL, 0);
 			BLI_strncpy(se->name, filename, sizeof(se->name));
 			MEM_freeN(filename);
 			se++;
@@ -3012,15 +3024,15 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op)
 		RNA_END;
 
 		/* reset these else we wont see all the images */
-		seq->anim_startofs= seq->anim_endofs= 0;
+		seq->anim_startofs = seq->anim_endofs = 0;
 
-		/* correct start/end frames so we dont move
+		/* correct start/end frames so we don't move
 		 * important not to set seq->len= len; allow the function to handle it */
 		reload_sequence_new_file(scene, seq, TRUE);
 
 		calc_sequence(scene, seq);
 
-		/* important else we dont get the imbuf cache flushed */
+		/* important else we don't get the imbuf cache flushed */
 		free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE);
 	}
 	else {
@@ -3032,25 +3044,25 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op)
 		RNA_pointer_create(&scene->id, &RNA_Sequence, seq, &seq_ptr);
 
 		RNA_string_get(op->ptr, "filepath", filepath);
-		prop= RNA_struct_find_property(&seq_ptr, "filepath");
+		prop = RNA_struct_find_property(&seq_ptr, "filepath");
 		RNA_property_string_set(&seq_ptr, prop, filepath);
 		RNA_property_update(C, &seq_ptr, prop);
 	}
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
 
 	return OPERATOR_FINISHED;
 }
 
 static int sequencer_change_path_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	Scene *scene= CTX_data_scene(C);
-	Sequence *seq= seq_active_get(scene);
+	Scene *scene = CTX_data_scene(C);
+	Sequence *seq = seq_active_get(scene);
 
 	RNA_string_set(op->ptr, "directory", seq->strip->dir);
 
 	/* set default display depending on seq type */
-	if(seq->type == SEQ_IMAGE) {
+	if (seq->type == SEQ_IMAGE) {
 		RNA_boolean_set(op->ptr, "filter_movie", FALSE);
 	}
 	else {
@@ -3065,17 +3077,18 @@ static int sequencer_change_path_invoke(bContext *C, wmOperator *op, wmEvent *UN
 void SEQUENCER_OT_change_path(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Change Data/Files";
-	ot->idname= "SEQUENCER_OT_change_path";
-	ot->description="";
+	ot->name = "Change Data/Files";
+	ot->idname = "SEQUENCER_OT_change_path";
+	ot->description = "";
 
 	/* api callbacks */
-	ot->exec= sequencer_change_path_exec;
-	ot->invoke= sequencer_change_path_invoke;
-	ot->poll= sequencer_strip_has_path_poll;
+	ot->exec = sequencer_change_path_exec;
+	ot->invoke = sequencer_change_path_invoke;
+	ot->poll = sequencer_strip_has_path_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-	WM_operator_properties_filesel(ot, FOLDERFILE|IMAGEFILE|MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY|WM_FILESEL_RELPATH|WM_FILESEL_FILEPATH|WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
+	WM_operator_properties_filesel(ot, FOLDERFILE | IMAGEFILE | MOVIEFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_DIRECTORY | WM_FILESEL_RELPATH | WM_FILESEL_FILEPATH | WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
 }
+
diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h
index 812bdbc..c40a809 100644
--- a/source/blender/editors/space_sequencer/sequencer_intern.h
+++ b/source/blender/editors/space_sequencer/sequencer_intern.h
@@ -28,8 +28,8 @@
  *  \ingroup spseq
  */
 
-#ifndef ED_SEQUENCER_INTERN_H
-#define ED_SEQUENCER_INTERN_H
+#ifndef __SEQUENCER_INTERN_H__
+#define __SEQUENCER_INTERN_H__
 
 #include "RNA_access.h"
 #include "DNA_sequence_types.h"
@@ -63,7 +63,6 @@ struct Sequence *find_nearest_seq(struct Scene *scene, struct View2D *v2d, int *
 struct Sequence *find_neighboring_sequence(struct Scene *scene, struct Sequence *test, int lr, int sel);
 void deselect_all_seq(struct Scene *scene);
 void recurs_sel_seq(struct Sequence *seqm);
-int event_to_efftype(int event);
 int seq_effect_find_selected(struct Scene *scene, struct Sequence *activeseq, int type, struct Sequence **selseq1, struct Sequence **selseq2, struct Sequence **selseq3, const char **error_str);
 
 /* operator helpers */
@@ -118,6 +117,8 @@ void SEQUENCER_OT_paste(struct wmOperatorType *ot);
 
 void SEQUENCER_OT_rebuild_proxy(struct wmOperatorType *ot);
 
+void SEQUENCER_OT_update_strip_length(struct wmOperatorType *ot);
+
 /* preview specific operators */
 void SEQUENCER_OT_view_all_preview(struct wmOperatorType *ot);
 
@@ -137,6 +138,7 @@ void SEQUENCER_OT_select_grouped(struct wmOperatorType *ot);
 /* sequencer_select.c */
 void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot);
 void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot);
+void SEQUENCER_OT_movieclip_strip_add(struct wmOperatorType *ot);
 void SEQUENCER_OT_sound_strip_add(struct wmOperatorType *ot);
 void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot);
 void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot);
@@ -174,7 +176,6 @@ struct ImBuf *make_histogram_view_from_ibuf(struct ImBuf * ibuf);
 /* sequencer_buttons.c */
 
 void SEQUENCER_OT_properties(struct wmOperatorType *ot);
-void sequencer_buttons_register(struct ARegionType *art);
 
-#endif /* ED_SEQUENCER_INTERN_H */
+#endif /* __SEQUENCER_INTERN_H__ */
 
diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c
index ec9f8bb..3a02c90 100644
--- a/source/blender/editors/space_sequencer/sequencer_ops.c
+++ b/source/blender/editors/space_sequencer/sequencer_ops.c
@@ -1,6 +1,4 @@
-
 /*
- *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -45,6 +43,7 @@
 #include "WM_api.h"
 #include "WM_types.h"
 
+#include "ED_markers.h"
 #include "ED_transform.h" /* transform keymap */
 
 #include "sequencer_intern.h"
@@ -105,6 +104,7 @@ void sequencer_operatortypes(void)
 
 	/* sequencer_add.c */
 	WM_operatortype_append(SEQUENCER_OT_scene_strip_add);
+	WM_operatortype_append(SEQUENCER_OT_movieclip_strip_add);
 	WM_operatortype_append(SEQUENCER_OT_movie_strip_add);
 	WM_operatortype_append(SEQUENCER_OT_sound_strip_add);
 	WM_operatortype_append(SEQUENCER_OT_image_strip_add);
@@ -118,45 +118,51 @@ void sequencer_operatortypes(void)
 
 void sequencer_keymap(wmKeyConfig *keyconf)
 {
-	wmKeyMap *keymap= WM_keymap_find(keyconf, "SequencerCommon", SPACE_SEQ, 0);
+	wmKeyMap *keymap;
 	wmKeyMapItem *kmi;
-
-	kmi= WM_keymap_add_item(keymap, "WM_OT_context_toggle", OKEY, KM_PRESS, KM_SHIFT, 0);
+	
+	/* Common items ------------------------------------------------------------------ */
+	keymap = WM_keymap_find(keyconf, "SequencerCommon", SPACE_SEQ, 0);
+	
+	kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", OKEY, KM_PRESS, KM_SHIFT, 0);
 	RNA_string_set(kmi->ptr, "data_path", "scene.sequence_editor.show_overlay");
 
 	/* operators common to sequence and preview view */
 	WM_keymap_add_item(keymap, "SEQUENCER_OT_view_toggle", TABKEY, KM_PRESS, KM_CTRL, 0);
 
-	/* operators for sequence */
-	keymap= WM_keymap_find(keyconf, "Sequencer", SPACE_SEQ, 0);
+	/* Strips Region --------------------------------------------------------------- */
+	keymap = WM_keymap_find(keyconf, "Sequencer", SPACE_SEQ, 0);
 	
 	WM_keymap_add_item(keymap, "SEQUENCER_OT_properties", NKEY, KM_PRESS, 0, 0);
 	
 	kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select_all", AKEY, KM_PRESS, 0, 0);
-		RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
+	RNA_enum_set(kmi->ptr, "action", SEL_TOGGLE);
 	kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select_all", IKEY, KM_PRESS, KM_CTRL, 0);
-		RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
+	RNA_enum_set(kmi->ptr, "action", SEL_INVERT);
 
 	kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_cut", KKEY, KM_PRESS, 0, 0);
-		RNA_enum_set(kmi->ptr, "type", SEQ_CUT_SOFT);
+	RNA_enum_set(kmi->ptr, "type", SEQ_CUT_SOFT);
 	kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_cut", KKEY, KM_PRESS, KM_SHIFT, 0);
-		RNA_enum_set(kmi->ptr, "type", SEQ_CUT_HARD);
+	RNA_enum_set(kmi->ptr, "type", SEQ_CUT_HARD);
 	
 	kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_mute", HKEY, KM_PRESS, 0, 0);
-		RNA_boolean_set(kmi->ptr, "unselected", FALSE);
+	RNA_boolean_set(kmi->ptr, "unselected", FALSE);
 	kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_mute", HKEY, KM_PRESS, KM_SHIFT, 0);
-		RNA_boolean_set(kmi->ptr, "unselected", TRUE);
+	RNA_boolean_set(kmi->ptr, "unselected", TRUE);
 	
 	kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_unmute", HKEY, KM_PRESS, KM_ALT, 0);
-		RNA_boolean_set(kmi->ptr, "unselected", FALSE);
-	kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_unmute", HKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
-		RNA_boolean_set(kmi->ptr, "unselected", TRUE);
+	RNA_boolean_set(kmi->ptr, "unselected", FALSE);
+	kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_unmute", HKEY, KM_PRESS, KM_ALT | KM_SHIFT, 0);
+	RNA_boolean_set(kmi->ptr, "unselected", TRUE);
 
 	WM_keymap_add_item(keymap, "SEQUENCER_OT_lock", LKEY, KM_PRESS, KM_SHIFT, 0);
-	WM_keymap_add_item(keymap, "SEQUENCER_OT_unlock", LKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0);
+	WM_keymap_add_item(keymap, "SEQUENCER_OT_unlock", LKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0);
 
 	WM_keymap_add_item(keymap, "SEQUENCER_OT_reassign_inputs", RKEY, KM_PRESS, 0, 0);
+
 	WM_keymap_add_item(keymap, "SEQUENCER_OT_reload", RKEY, KM_PRESS, KM_ALT, 0);
+	kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_reload", RKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0);
+	RNA_boolean_set(kmi->ptr, "adjust_length", TRUE);
 
 	WM_keymap_add_item(keymap, "SEQUENCER_OT_offset_clear", OKEY, KM_PRESS, KM_ALT, 0);
 
@@ -188,81 +194,81 @@ void sequencer_keymap(wmKeyConfig *keyconf)
 	WM_keymap_add_item(keymap, "SEQUENCER_OT_swap_inputs", SKEY, KM_PRESS, KM_ALT, 0);
 
 	/* multicam editing keyboard layout, switch to camera 1-10 using
-	   regular number keys */
+	 * regular number keys */
 	{
 		int keys[] = { ONEKEY, TWOKEY, THREEKEY, FOURKEY, FIVEKEY,
-		               SIXKEY, SEVENKEY, EIGHTKEY, NINEKEY, ZEROKEY };
+			           SIXKEY, SEVENKEY, EIGHTKEY, NINEKEY, ZEROKEY };
 		int i;
 
 		for (i = 1; i <= 10; i++) {
-			RNA_int_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_cut_multicam", keys[i-1], KM_PRESS, 0, 0)->ptr, "camera", i);
+			RNA_int_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_cut_multicam", keys[i - 1], KM_PRESS, 0, 0)->ptr, "camera", i);
 		}
 	}
 
 	/* Mouse selection, a bit verbose :/ */
 	kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, 0, 0);
-		RNA_boolean_set(kmi->ptr, "extend", FALSE);
-		RNA_boolean_set(kmi->ptr, "linked_handle", FALSE);
-		RNA_boolean_set(kmi->ptr, "left_right", FALSE);
-		RNA_boolean_set(kmi->ptr, "linked_time", FALSE);
+	RNA_boolean_set(kmi->ptr, "extend", FALSE);
+	RNA_boolean_set(kmi->ptr, "linked_handle", FALSE);
+	RNA_boolean_set(kmi->ptr, "left_right", FALSE);
+	RNA_boolean_set(kmi->ptr, "linked_time", FALSE);
 	kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0);
-		RNA_boolean_set(kmi->ptr, "extend", TRUE);
-		RNA_boolean_set(kmi->ptr, "linked_handle", FALSE);
-		RNA_boolean_set(kmi->ptr, "left_right", FALSE);
-		RNA_boolean_set(kmi->ptr, "linked_time", FALSE);
+	RNA_boolean_set(kmi->ptr, "extend", TRUE);
+	RNA_boolean_set(kmi->ptr, "linked_handle", FALSE);
+	RNA_boolean_set(kmi->ptr, "left_right", FALSE);
+	RNA_boolean_set(kmi->ptr, "linked_time", FALSE);
 
 
 	/* 2.4x method, now use Alt for handles and select the side based on which handle was selected */
-	/*
+#if 0
 	kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
 	RNA_boolean_set(kmi->ptr, "linked_left", TRUE);
 	kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
 	RNA_boolean_set(kmi->ptr, "linked_right", TRUE);
 	
-	kmi= WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_ALT, 0);
+	kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL | KM_ALT, 0);
 	RNA_boolean_set(kmi->ptr, "linked_left", TRUE);
 	RNA_boolean_set(kmi->ptr, "linked_right", TRUE);
 
-	kmi= WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL|KM_ALT, 0);
+	kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_CTRL | KM_ALT, 0);
 	RNA_boolean_set(kmi->ptr, "extend", TRUE);
 	RNA_boolean_set(kmi->ptr, "linked_left", TRUE);
 	RNA_boolean_set(kmi->ptr, "linked_right", TRUE);
 
-	kmi= WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+	kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
 	RNA_boolean_set(kmi->ptr, "extend", TRUE);
 	RNA_boolean_set(kmi->ptr, "linked_left", TRUE);
 
-	kmi= WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0);
+	kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_ALT, 0);
 	RNA_boolean_set(kmi->ptr, "extend", TRUE);
 	RNA_boolean_set(kmi->ptr, "linked_right", TRUE);
-	 */
+#endif
 
 	/* 2.5 method, Alt and use selected handle */
 	kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
-		RNA_boolean_set(kmi->ptr, "extend", FALSE);
-		RNA_boolean_set(kmi->ptr, "linked_handle", TRUE);
-		RNA_boolean_set(kmi->ptr, "left_right", FALSE);
-		RNA_boolean_set(kmi->ptr, "linked_time", FALSE);
+	RNA_boolean_set(kmi->ptr, "extend", FALSE);
+	RNA_boolean_set(kmi->ptr, "linked_handle", TRUE);
+	RNA_boolean_set(kmi->ptr, "left_right", FALSE);
+	RNA_boolean_set(kmi->ptr, "linked_time", FALSE);
 
-	kmi= WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0);
-		RNA_boolean_set(kmi->ptr, "extend", TRUE);
-		RNA_boolean_set(kmi->ptr, "linked_handle", TRUE);
-		RNA_boolean_set(kmi->ptr, "left_right", FALSE);
-		RNA_boolean_set(kmi->ptr, "linked_time", FALSE);
+	kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_ALT, 0);
+	RNA_boolean_set(kmi->ptr, "extend", TRUE);
+	RNA_boolean_set(kmi->ptr, "linked_handle", TRUE);
+	RNA_boolean_set(kmi->ptr, "left_right", FALSE);
+	RNA_boolean_set(kmi->ptr, "linked_time", FALSE);
 
 	/* match action editor */
-	kmi= WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
-		RNA_boolean_set(kmi->ptr, "extend", FALSE);
-		RNA_boolean_set(kmi->ptr, "linked_handle", FALSE);
-		RNA_boolean_set(kmi->ptr, "left_right", TRUE); /* grr, these conflict - only use left_right if not over an active seq */
-		RNA_boolean_set(kmi->ptr, "linked_time", TRUE);
+	kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
+	RNA_boolean_set(kmi->ptr, "extend", FALSE);
+	RNA_boolean_set(kmi->ptr, "linked_handle", FALSE);
+	RNA_boolean_set(kmi->ptr, "left_right", TRUE);     /* grr, these conflict - only use left_right if not over an active seq */
+	RNA_boolean_set(kmi->ptr, "linked_time", TRUE);
 	/* adjusted since 2.4 */
 
-	kmi= WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
-		RNA_boolean_set(kmi->ptr, "extend", TRUE);
-		RNA_boolean_set(kmi->ptr, "linked_handle", FALSE);
-		RNA_boolean_set(kmi->ptr, "left_right", FALSE);
-		RNA_boolean_set(kmi->ptr, "linked_time", TRUE);
+	kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
+	RNA_boolean_set(kmi->ptr, "extend", TRUE);
+	RNA_boolean_set(kmi->ptr, "linked_handle", FALSE);
+	RNA_boolean_set(kmi->ptr, "left_right", FALSE);
+	RNA_boolean_set(kmi->ptr, "linked_time", TRUE);
 
 	WM_keymap_add_item(keymap, "SEQUENCER_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
 	WM_keymap_add_item(keymap, "SEQUENCER_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
@@ -282,13 +288,18 @@ void sequencer_keymap(wmKeyConfig *keyconf)
 
 	WM_keymap_add_menu(keymap, "SEQUENCER_MT_change", CKEY, KM_PRESS, 0, 0);
 	
-	kmi= WM_keymap_add_item(keymap, "WM_OT_context_set_int", OKEY, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "WM_OT_context_set_int", OKEY, KM_PRESS, 0, 0);
 	RNA_string_set(kmi->ptr, "data_path", "scene.sequence_editor.overlay_frame");
 	RNA_int_set(kmi->ptr, "value", 0);
 
 	transform_keymap_for_space(keyconf, keymap, SPACE_SEQ);
-
-	keymap= WM_keymap_find(keyconf, "SequencerPreview", SPACE_SEQ, 0);
+	
+	/* special markers hotkeys for anim editors: see note in definition of this function */
+	ED_marker_keymap_animedit_conflictfree(keymap);
+	
+	
+	/* Preview Region ----------------------------------------------------------- */
+	keymap = WM_keymap_find(keyconf, "SequencerPreview", SPACE_SEQ, 0);
 	WM_keymap_add_item(keymap, "SEQUENCER_OT_view_all_preview", HOMEKEY, KM_PRESS, 0, 0);
 	WM_keymap_add_item(keymap, "SEQUENCER_OT_properties", NKEY, KM_PRESS, 0, 0);
 
@@ -307,6 +318,5 @@ void sequencer_keymap(wmKeyConfig *keyconf)
 	RNA_float_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_view_zoom_ratio", PAD4, KM_PRESS, 0, 0)->ptr, "ratio", 0.25f);
 	RNA_float_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_view_zoom_ratio", PAD8, KM_PRESS, 0, 0)->ptr, "ratio", 0.125f);
 #endif
-
 }
 
diff --git a/source/blender/editors/space_sequencer/sequencer_scopes.c b/source/blender/editors/space_sequencer/sequencer_scopes.c
index c13a520..6b71591 100644
--- a/source/blender/editors/space_sequencer/sequencer_scopes.c
+++ b/source/blender/editors/space_sequencer/sequencer_scopes.c
@@ -41,27 +41,27 @@
  * only difference is it does some normalize after, need to double check on this - campbell */
 static void rgb_to_yuv_normalized(const float rgb[3], float yuv[3])
 {
-		yuv[0]= 0.299f*rgb[0] + 0.587f*rgb[1] + 0.114f*rgb[2];
-		yuv[1]= 0.492f*(rgb[2] - yuv[0]);
-		yuv[2]= 0.877f*(rgb[0] - yuv[0]);
+	yuv[0] = 0.299f * rgb[0] + 0.587f * rgb[1] + 0.114f * rgb[2];
+	yuv[1] = 0.492f * (rgb[2] - yuv[0]);
+	yuv[2] = 0.877f * (rgb[0] - yuv[0]);
 
-		/* Normalize */
-		yuv[1]*= 255.0f/(122*2.0f);
-		yuv[1]+= 0.5f;
+	/* Normalize */
+	yuv[1] *= 255.0f / (122 * 2.0f);
+	yuv[1] += 0.5f;
 
-		yuv[2]*= 255.0f/(157*2.0f);
-		yuv[2]+= 0.5f;
+	yuv[2] *= 255.0f / (157 * 2.0f);
+	yuv[2] += 0.5f;
 }
 
-static void scope_put_pixel(unsigned char* table, unsigned char * pos)
+static void scope_put_pixel(unsigned char *table, unsigned char *pos)
 {
 	char newval = table[*pos];
 	pos[0] = pos[1] = pos[2] = newval;
 	pos[3] = 255;
 }
 
-static void scope_put_pixel_single(unsigned char* table, unsigned char * pos,
-				   int col)
+static void scope_put_pixel_single(unsigned char *table, unsigned char *pos,
+                                   int col)
 {
 	char newval = table[pos[col]];
 	pos[col] = newval;
@@ -69,10 +69,10 @@ static void scope_put_pixel_single(unsigned char* table, unsigned char * pos,
 }
 
 static void wform_put_line(int w,
-			   unsigned char * last_pos, unsigned char * new_pos)
+                           unsigned char *last_pos, unsigned char *new_pos)
 {
 	if (last_pos > new_pos) {
-		unsigned char* temp = new_pos;
+		unsigned char *temp = new_pos;
 		new_pos = last_pos;
 		last_pos = temp;
 	}
@@ -82,15 +82,15 @@ static void wform_put_line(int w,
 			last_pos[0] = last_pos[1] = last_pos[2] = 32;
 			last_pos[3] = 255;
 		}
-		last_pos += 4*w;
+		last_pos += 4 * w;
 	}
 }
 
 static void wform_put_line_single(
-	int w, unsigned char * last_pos, unsigned char * new_pos, int col)
+    int w, unsigned char *last_pos, unsigned char *new_pos, int col)
 {
 	if (last_pos > new_pos) {
-		unsigned char* temp = new_pos;
+		unsigned char *temp = new_pos;
 		new_pos = last_pos;
 		last_pos = temp;
 	}
@@ -100,16 +100,16 @@ static void wform_put_line_single(
 			last_pos[col] = 32;
 			last_pos[3] = 255;
 		}
-		last_pos += 4*w;
+		last_pos += 4 * w;
 	}
 }
 
-static void wform_put_border(unsigned char * tgt, int w, int h)
+static void wform_put_border(unsigned char *tgt, int w, int h)
 {
 	int x, y;
 
 	for (x = 0; x < w; x++) {
-		unsigned char * p = tgt + 4 * x;
+		unsigned char *p = tgt + 4 * x;
 		p[1] = p[3] = 255.0;
 		p[4 * w + 1] = p[4 * w + 3] = 255.0;
 		p = tgt + 4 * (w * (h - 1) + x);
@@ -118,7 +118,7 @@ static void wform_put_border(unsigned char * tgt, int w, int h)
 	}
 
 	for (y = 0; y < h; y++) {
-		unsigned char * p = tgt + 4 * w * y;
+		unsigned char *p = tgt + 4 * w * y;
 		p[1] = p[3] = 255.0;
 		p[4 + 1] = p[4 + 3] = 255.0;
 		p = tgt + 4 * (w * y + w - 1);
@@ -127,32 +127,32 @@ static void wform_put_border(unsigned char * tgt, int w, int h)
 	}
 }
 
-static void wform_put_gridrow(unsigned char * tgt, float perc, int w, int h)
+static void wform_put_gridrow(unsigned char *tgt, float perc, int w, int h)
 {
 	int i;
 
-	tgt += (int) (perc/100.0f * h) * w * 4;
+	tgt += (int) (perc / 100.0f * h) * w * 4;
 
-	for (i = 0; i < w*2; i++) {
+	for (i = 0; i < w * 2; i++) {
 		tgt[0] = 255;
 
 		tgt += 4;
 	}
 }
 
-static void wform_put_grid(unsigned char * tgt, int w, int h)
+static void wform_put_grid(unsigned char *tgt, int w, int h)
 {
 	wform_put_gridrow(tgt, 90.0, w, h);
 	wform_put_gridrow(tgt, 70.0, w, h);
 	wform_put_gridrow(tgt, 10.0, w, h);
 }
 
-static struct ImBuf *make_waveform_view_from_ibuf_byte(struct ImBuf * ibuf)
+static ImBuf *make_waveform_view_from_ibuf_byte(ImBuf *ibuf)
 {
-	struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect);
-	int x,y;
-	unsigned char* src = (unsigned char*) ibuf->rect;
-	unsigned char* tgt = (unsigned char*) rval->rect;
+	ImBuf *rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect);
+	int x, y;
+	unsigned char *src = (unsigned char *) ibuf->rect;
+	unsigned char *tgt = (unsigned char *) rval->rect;
 	int w = ibuf->x + 3;
 	int h = 515;
 	float waveform_gamma = 0.2;
@@ -161,17 +161,17 @@ static struct ImBuf *make_waveform_view_from_ibuf_byte(struct ImBuf * ibuf)
 	wform_put_grid(tgt, w, h);
 
 	for (x = 0; x < 256; x++) {
-		wtable[x] = (unsigned char) (pow(((float) x + 1)/256, 
-						 waveform_gamma)*255);
+		wtable[x] = (unsigned char) (pow(((float) x + 1) / 256,
+		                                 waveform_gamma) * 255);
 	}
 
 	for (y = 0; y < ibuf->y; y++) {
-		unsigned char * last_p = NULL;
+		unsigned char *last_p = NULL;
 
 		for (x = 0; x < ibuf->x; x++) {
-			unsigned char * rgb = src + 4 * (ibuf->x * y + x);
+			unsigned char *rgb = src + 4 * (ibuf->x * y + x);
 			float v = (float)rgb_to_luma_byte(rgb) / 255.0f;
-			unsigned char * p = tgt;
+			unsigned char *p = tgt;
 			p += 4 * (w * ((int) (v * (h - 3)) + 1) + x + 1);
 
 			scope_put_pixel(wtable, p);
@@ -190,12 +190,12 @@ static struct ImBuf *make_waveform_view_from_ibuf_byte(struct ImBuf * ibuf)
 	return rval;
 }
 
-static struct ImBuf *make_waveform_view_from_ibuf_float(struct ImBuf * ibuf)
+static ImBuf *make_waveform_view_from_ibuf_float(ImBuf *ibuf)
 {
-	struct ImBuf * rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect);
-	int x,y;
-	float* src = ibuf->rect_float;
-	unsigned char* tgt = (unsigned char*) rval->rect;
+	ImBuf *rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect);
+	int x, y;
+	float *src = ibuf->rect_float;
+	unsigned char *tgt = (unsigned char *) rval->rect;
 	int w = ibuf->x + 3;
 	int h = 515;
 	float waveform_gamma = 0.2;
@@ -204,17 +204,17 @@ static struct ImBuf *make_waveform_view_from_ibuf_float(struct ImBuf * ibuf)
 	wform_put_grid(tgt, w, h);
 
 	for (x = 0; x < 256; x++) {
-		wtable[x] = (unsigned char) (pow(((float) x + 1)/256, 
-						 waveform_gamma)*255);
+		wtable[x] = (unsigned char) (pow(((float) x + 1) / 256,
+		                                 waveform_gamma) * 255);
 	}
 
 	for (y = 0; y < ibuf->y; y++) {
-		unsigned char * last_p = NULL;
+		unsigned char *last_p = NULL;
 
 		for (x = 0; x < ibuf->x; x++) {
-			float * rgb = src + 4 * (ibuf->x * y + x);
+			float *rgb = src + 4 * (ibuf->x * y + x);
 			float v = rgb_to_luma(rgb);
-			unsigned char * p = tgt;
+			unsigned char *p = tgt;
 
 			CLAMP(v, 0.0f, 1.0f);
 
@@ -236,25 +236,26 @@ static struct ImBuf *make_waveform_view_from_ibuf_float(struct ImBuf * ibuf)
 	return rval;
 }
 
-struct ImBuf *make_waveform_view_from_ibuf(struct ImBuf * ibuf)
+ImBuf *make_waveform_view_from_ibuf(ImBuf *ibuf)
 {
 	if (ibuf->rect_float) {
 		return make_waveform_view_from_ibuf_float(ibuf);
-	} else {
+	}
+	else {
 		return make_waveform_view_from_ibuf_byte(ibuf);
 	}
 }
 
 
-static struct ImBuf *make_sep_waveform_view_from_ibuf_byte(struct ImBuf * ibuf)
+static ImBuf *make_sep_waveform_view_from_ibuf_byte(ImBuf *ibuf)
 {
-	struct ImBuf * rval = IMB_allocImBuf(
-		ibuf->x + 3, 515, 32, IB_rect);
-	int x,y;
-	unsigned char* src = (unsigned char*) ibuf->rect;
-	unsigned char* tgt = (unsigned char*) rval->rect;
+	ImBuf *rval = IMB_allocImBuf(
+	    ibuf->x + 3, 515, 32, IB_rect);
+	int x, y;
+	unsigned char *src = (unsigned char *) ibuf->rect;
+	unsigned char *tgt = (unsigned char *) rval->rect;
 	int w = ibuf->x + 3;
-	int sw = ibuf->x/3;
+	int sw = ibuf->x / 3;
 	int h = 515;
 	float waveform_gamma = 0.2;
 	unsigned char wtable[256];
@@ -262,8 +263,8 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_byte(struct ImBuf * ibuf)
 	wform_put_grid(tgt, w, h);
 
 	for (x = 0; x < 256; x++) {
-		wtable[x] = (unsigned char) (pow(((float) x + 1)/256, 
-						 waveform_gamma)*255);
+		wtable[x] = (unsigned char) (pow(((float) x + 1) / 256,
+		                                 waveform_gamma) * 255);
 	}
 
 	for (y = 0; y < ibuf->y; y++) {
@@ -271,11 +272,11 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_byte(struct ImBuf * ibuf)
 
 		for (x = 0; x < ibuf->x; x++) {
 			int c;
-			unsigned char * rgb = src + 4 * (ibuf->x * y + x);
+			unsigned char *rgb = src + 4 * (ibuf->x * y + x);
 			for (c = 0; c < 3; c++) {
-				unsigned char * p = tgt;
-				p += 4 * (w * ((rgb[c] * (h - 3))/255 + 1) 
-					  + c * sw + x/3 + 1);
+				unsigned char *p = tgt;
+				p += 4 * (w * ((rgb[c] * (h - 3)) / 255 + 1)
+				          + c * sw + x / 3 + 1);
 
 				scope_put_pixel_single(wtable, p, c);
 				p += 4 * w;
@@ -283,7 +284,7 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_byte(struct ImBuf * ibuf)
 
 				if (last_p[c] != NULL) {
 					wform_put_line_single(
-						w, last_p[c], p, c);
+					    w, last_p[c], p, c);
 				}
 				last_p[c] = p;
 			}
@@ -295,16 +296,14 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_byte(struct ImBuf * ibuf)
 	return rval;
 }
 
-static struct ImBuf *make_sep_waveform_view_from_ibuf_float(
-	struct ImBuf * ibuf)
+static ImBuf *make_sep_waveform_view_from_ibuf_float(ImBuf *ibuf)
 {
-	struct ImBuf * rval = IMB_allocImBuf(
-		ibuf->x + 3, 515, 32, IB_rect);
-	int x,y;
-	float* src = ibuf->rect_float;
-	unsigned char* tgt = (unsigned char*) rval->rect;
+	ImBuf *rval = IMB_allocImBuf(ibuf->x + 3, 515, 32, IB_rect);
+	int x, y;
+	float *src = ibuf->rect_float;
+	unsigned char *tgt = (unsigned char *) rval->rect;
 	int w = ibuf->x + 3;
-	int sw = ibuf->x/3;
+	int sw = ibuf->x / 3;
 	int h = 515;
 	float waveform_gamma = 0.2;
 	unsigned char wtable[256];
@@ -312,8 +311,8 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_float(
 	wform_put_grid(tgt, w, h);
 
 	for (x = 0; x < 256; x++) {
-		wtable[x] = (unsigned char) (pow(((float) x + 1)/256, 
-						 waveform_gamma)*255);
+		wtable[x] = (unsigned char) (pow(((float) x + 1) / 256,
+		                                 waveform_gamma) * 255);
 	}
 
 	for (y = 0; y < ibuf->y; y++) {
@@ -321,15 +320,15 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_float(
 
 		for (x = 0; x < ibuf->x; x++) {
 			int c;
-			float * rgb = src + 4 * (ibuf->x * y + x);
+			float *rgb = src + 4 * (ibuf->x * y + x);
 			for (c = 0; c < 3; c++) {
-				unsigned char * p = tgt;
+				unsigned char *p = tgt;
 				float v = rgb[c];
 
 				CLAMP(v, 0.0f, 1.0f);
 
 				p += 4 * (w * ((int) (v * (h - 3)) + 1)
-					  + c * sw + x/3 + 1);
+				          + c * sw + x / 3 + 1);
 
 				scope_put_pixel_single(wtable, p, c);
 				p += 4 * w;
@@ -337,7 +336,7 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_float(
 
 				if (last_p[c] != NULL) {
 					wform_put_line_single(
-						w, last_p[c], p, c);
+					    w, last_p[c], p, c);
 				}
 				last_p[c] = p;
 			}
@@ -349,20 +348,21 @@ static struct ImBuf *make_sep_waveform_view_from_ibuf_float(
 	return rval;
 }
 
-struct ImBuf *make_sep_waveform_view_from_ibuf(struct ImBuf * ibuf)
+ImBuf *make_sep_waveform_view_from_ibuf(ImBuf *ibuf)
 {
 	if (ibuf->rect_float) {
 		return make_sep_waveform_view_from_ibuf_float(ibuf);
-	} else {
+	}
+	else {
 		return make_sep_waveform_view_from_ibuf_byte(ibuf);
 	}
 }
 
-static void draw_zebra_byte(struct ImBuf * src,struct ImBuf * ibuf, float perc)
+static void draw_zebra_byte(ImBuf *src, ImBuf *ibuf, float perc)
 {
 	unsigned int limit = 255.0f * perc / 100.0f;
-	unsigned char * p = (unsigned char*) src->rect;
-	unsigned char * o = (unsigned char*) ibuf->rect;
+	unsigned char *p = (unsigned char *) src->rect;
+	unsigned char *o = (unsigned char *) ibuf->rect;
 	int x;
 	int y;
 
@@ -389,11 +389,11 @@ static void draw_zebra_byte(struct ImBuf * src,struct ImBuf * ibuf, float perc)
 }
 
 
-static void draw_zebra_float(struct ImBuf * src,struct ImBuf * ibuf,float perc)
+static void draw_zebra_float(ImBuf *src, ImBuf *ibuf, float perc)
 {
 	float limit = perc / 100.0f;
-	float * p = src->rect_float;
-	unsigned char * o = (unsigned char*) ibuf->rect;
+	float *p = src->rect_float;
+	unsigned char *o = (unsigned char *) ibuf->rect;
 	int x;
 	int y;
 
@@ -420,35 +420,36 @@ static void draw_zebra_float(struct ImBuf * src,struct ImBuf * ibuf,float perc)
 	}
 }
 
-struct ImBuf * make_zebra_view_from_ibuf(struct ImBuf * src, float perc)
+ImBuf *make_zebra_view_from_ibuf(ImBuf *src, float perc)
 {
-	struct ImBuf * ibuf = IMB_allocImBuf(src->x, src->y, 32, IB_rect);
+	ImBuf *ibuf = IMB_allocImBuf(src->x, src->y, 32, IB_rect);
 
 	if (src->rect_float) {
 		draw_zebra_float(src, ibuf, perc);
-	} else {
+	}
+	else {
 		draw_zebra_byte(src, ibuf, perc);
 	}
 	return ibuf;
 }
 
-static void draw_histogram_marker(struct ImBuf * ibuf, int x)
+static void draw_histogram_marker(ImBuf *ibuf, int x)
 {
-	unsigned char * p = (unsigned char*) ibuf->rect;
+	unsigned char *p = (unsigned char *) ibuf->rect;
 	int barh = ibuf->y * 0.1;
 	int i;
 
 	p += 4 * (x + ibuf->x * (ibuf->y - barh + 1));
 
-	for (i = 0; i < barh-1; i++) {
+	for (i = 0; i < barh - 1; i++) {
 		p[0] = p[1] = p[2] = 255;
 		p += ibuf->x * 4;
 	}
 }
 
-static void draw_histogram_bar(struct ImBuf * ibuf, int x,float val, int col)
+static void draw_histogram_bar(ImBuf *ibuf, int x, float val, int col)
 {
-	unsigned char * p = (unsigned char*) ibuf->rect;
+	unsigned char *p = (unsigned char *) ibuf->rect;
 	int barh = ibuf->y * val * 0.9f;
 	int i;
 
@@ -460,17 +461,16 @@ static void draw_histogram_bar(struct ImBuf * ibuf, int x,float val, int col)
 	}
 }
 
-static struct ImBuf *make_histogram_view_from_ibuf_byte(
-	struct ImBuf * ibuf)
+static ImBuf *make_histogram_view_from_ibuf_byte(ImBuf *ibuf)
 {
-	struct ImBuf * rval = IMB_allocImBuf(515, 128, 32, IB_rect);
-	int c,x,y;
+	ImBuf *rval = IMB_allocImBuf(515, 128, 32, IB_rect);
+	int c, x, y;
 	unsigned int n;
-	unsigned char* src = (unsigned char*) ibuf->rect;
+	unsigned char *src = (unsigned char *) ibuf->rect;
 
 	unsigned int bins[3][256];
 
-	memset(bins, 0, 3 * 256* sizeof(unsigned int));
+	memset(bins, 0, 3 * 256 * sizeof(unsigned int));
 
 	for (y = 0; y < ibuf->y; y++) {
 		for (x = 0; x < ibuf->x; x++) {
@@ -492,14 +492,14 @@ static struct ImBuf *make_histogram_view_from_ibuf_byte(
 
 	for (c = 0; c < 3; c++) {
 		for (x = 0; x < 256; x++) {
-			draw_histogram_bar(rval, x*2+1, 
-					   ((float) bins[c][x])/n, c);
-			draw_histogram_bar(rval, x*2+2, 
-					   ((float) bins[c][x])/n, c);
+			draw_histogram_bar(rval, x * 2 + 1,
+			                   ((float) bins[c][x]) / n, c);
+			draw_histogram_bar(rval, x * 2 + 2,
+			                   ((float) bins[c][x]) / n, c);
 		}
 	}
 
-	wform_put_border((unsigned char*) rval->rect, rval->x, rval->y);
+	wform_put_border((unsigned char *) rval->rect, rval->x, rval->y);
 	
 	return rval;
 }
@@ -508,23 +508,23 @@ static int get_bin_float(float f)
 {
 	if (f < -0.25f) {
 		f = -0.25f;
-	} else if (f > 1.25f) {
+	}
+	else if (f > 1.25f) {
 		f = 1.25f;
 	}
 
 	return (int) (((f + 0.25f) / 1.5f) * 512);
 }
 
-static struct ImBuf *make_histogram_view_from_ibuf_float(
-	struct ImBuf * ibuf)
+static ImBuf *make_histogram_view_from_ibuf_float(ImBuf *ibuf)
 {
-	struct ImBuf * rval = IMB_allocImBuf(515, 128, 32, IB_rect);
-	int n,c,x,y;
-	float* src = ibuf->rect_float;
+	ImBuf *rval = IMB_allocImBuf(515, 128, 32, IB_rect);
+	int n, c, x, y;
+	float *src = ibuf->rect_float;
 
 	unsigned int bins[3][512];
 
-	memset(bins, 0, 3 * 256* sizeof(unsigned int));
+	memset(bins, 0, 3 * 256 * sizeof(unsigned int));
 
 	for (y = 0; y < ibuf->y; y++) {
 		for (x = 0; x < ibuf->x; x++) {
@@ -548,40 +548,41 @@ static struct ImBuf *make_histogram_view_from_ibuf_float(
 	}
 	for (c = 0; c < 3; c++) {
 		for (x = 0; x < 512; x++) {
-			draw_histogram_bar(rval, x+1, (float) bins[c][x]/n, c);
+			draw_histogram_bar(rval, x + 1, (float) bins[c][x] / n, c);
 		}
 	}
 
-	wform_put_border((unsigned char*) rval->rect, rval->x, rval->y);
+	wform_put_border((unsigned char *) rval->rect, rval->x, rval->y);
 	
 	return rval;
 }
 
-struct ImBuf *make_histogram_view_from_ibuf(struct ImBuf * ibuf)
+ImBuf *make_histogram_view_from_ibuf(ImBuf *ibuf)
 {
 	if (ibuf->rect_float) {
 		return make_histogram_view_from_ibuf_float(ibuf);
-	} else {
+	}
+	else {
 		return make_histogram_view_from_ibuf_byte(ibuf);
 	}
 }
 
 static void vectorscope_put_cross(unsigned char r, unsigned char g, 
-				  unsigned char b, 
-				  char * tgt, int w, int h, int size)
+                                  unsigned char b,
+                                  char *tgt, int w, int h, int size)
 {
 	float rgb[3], yuv[3];
-	char * p;
+	char *p;
 	int x = 0;
 	int y = 0;
 
-	rgb[0]= (float)r/255.0f;
-	rgb[1]= (float)g/255.0f;
-	rgb[2]= (float)b/255.0f;
+	rgb[0] = (float)r / 255.0f;
+	rgb[1] = (float)g / 255.0f;
+	rgb[2] = (float)b / 255.0f;
 	rgb_to_yuv_normalized(rgb, yuv);
 			
 	p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1)) 
-			   + (int) ((yuv[1] * (w - 3) + 1)));
+	               + (int) ((yuv[1] * (w - 3) + 1)));
 
 	if (r == 0 && g == 0 && b == 0) {
 		r = 255;
@@ -589,18 +590,18 @@ static void vectorscope_put_cross(unsigned char r, unsigned char g,
 
 	for (y = -size; y <= size; y++) {
 		for (x = -size; x <= size; x++) {
-			char * q = p + 4 * (y * w + x);
+			char *q = p + 4 * (y * w + x);
 			q[0] = r; q[1] = g; q[2] = b; q[3] = 255;
 		}
 	}
 }
 
-static struct ImBuf *make_vectorscope_view_from_ibuf_byte(struct ImBuf * ibuf)
+static ImBuf *make_vectorscope_view_from_ibuf_byte(ImBuf *ibuf)
 {
-	struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect);
-	int x,y;
-	char* src = (char*) ibuf->rect;
-	char* tgt = (char*) rval->rect;
+	ImBuf *rval = IMB_allocImBuf(515, 515, 32, IB_rect);
+	int x, y;
+	char *src = (char *) ibuf->rect;
+	char *tgt = (char *) rval->rect;
 	float rgb[3], yuv[3];
 	int w = 515;
 	int h = 515;
@@ -608,14 +609,14 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_byte(struct ImBuf * ibuf)
 	unsigned char wtable[256];
 
 	for (x = 0; x < 256; x++) {
-		wtable[x] = (unsigned char) (pow(((float) x + 1)/256, 
-						 scope_gamma)*255);
+		wtable[x] = (unsigned char) (pow(((float) x + 1) / 256,
+		                                 scope_gamma) * 255);
 	}
 
 	for (x = 0; x <= 255; x++) {
-		vectorscope_put_cross(255   ,     0,255 - x, tgt, w, h, 1);
-		vectorscope_put_cross(255   ,     x,      0, tgt, w, h, 1);
-		vectorscope_put_cross(255- x,   255,      0, tgt, w, h, 1);
+		vectorscope_put_cross(255,     0, 255 - x, tgt, w, h, 1);
+		vectorscope_put_cross(255,     x,      0, tgt, w, h, 1);
+		vectorscope_put_cross(255 - x,   255,      0, tgt, w, h, 1);
 		vectorscope_put_cross(0,        255,      x, tgt, w, h, 1);
 		vectorscope_put_cross(0,    255 - x,    255, tgt, w, h, 1);
 		vectorscope_put_cross(x,          0,    255, tgt, w, h, 1);
@@ -623,17 +624,17 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_byte(struct ImBuf * ibuf)
 
 	for (y = 0; y < ibuf->y; y++) {
 		for (x = 0; x < ibuf->x; x++) {
-			char * src1 = src + 4 * (ibuf->x * y + x);
-			char * p;
+			char *src1 = src + 4 * (ibuf->x * y + x);
+			char *p;
 			
-			rgb[0]= (float)src1[0]/255.0f;
-			rgb[1]= (float)src1[1]/255.0f;
-			rgb[2]= (float)src1[2]/255.0f;
+			rgb[0] = (float)src1[0] / 255.0f;
+			rgb[1] = (float)src1[1] / 255.0f;
+			rgb[2] = (float)src1[2] / 255.0f;
 			rgb_to_yuv_normalized(rgb, yuv);
 			
 			p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1)) 
-					   + (int) ((yuv[1] * (w - 3) + 1)));
-			scope_put_pixel(wtable, (unsigned char*)p);
+			               + (int) ((yuv[1] * (w - 3) + 1)));
+			scope_put_pixel(wtable, (unsigned char *)p);
 		}
 	}
 
@@ -642,12 +643,12 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_byte(struct ImBuf * ibuf)
 	return rval;
 }
 
-static struct ImBuf *make_vectorscope_view_from_ibuf_float(struct ImBuf * ibuf)
+static ImBuf *make_vectorscope_view_from_ibuf_float(ImBuf *ibuf)
 {
-	struct ImBuf * rval = IMB_allocImBuf(515, 515, 32, IB_rect);
-	int x,y;
-	float* src = ibuf->rect_float;
-	char* tgt = (char*) rval->rect;
+	ImBuf *rval = IMB_allocImBuf(515, 515, 32, IB_rect);
+	int x, y;
+	float *src = ibuf->rect_float;
+	char *tgt = (char *) rval->rect;
 	float rgb[3], yuv[3];
 	int w = 515;
 	int h = 515;
@@ -655,14 +656,14 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_float(struct ImBuf * ibuf)
 	unsigned char wtable[256];
 
 	for (x = 0; x < 256; x++) {
-		wtable[x] = (unsigned char) (pow(((float) x + 1)/256, 
-						 scope_gamma)*255);
+		wtable[x] = (unsigned char) (pow(((float) x + 1) / 256,
+		                                 scope_gamma) * 255);
 	}
 
 	for (x = 0; x <= 255; x++) {
-		vectorscope_put_cross(255   ,     0,255 - x, tgt, w, h, 1);
-		vectorscope_put_cross(255   ,     x,      0, tgt, w, h, 1);
-		vectorscope_put_cross(255- x,   255,      0, tgt, w, h, 1);
+		vectorscope_put_cross(255,     0, 255 - x, tgt, w, h, 1);
+		vectorscope_put_cross(255,     x,      0, tgt, w, h, 1);
+		vectorscope_put_cross(255 - x,   255,      0, tgt, w, h, 1);
 		vectorscope_put_cross(0,        255,      x, tgt, w, h, 1);
 		vectorscope_put_cross(0,    255 - x,    255, tgt, w, h, 1);
 		vectorscope_put_cross(x,          0,    255, tgt, w, h, 1);
@@ -670,8 +671,8 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_float(struct ImBuf * ibuf)
 
 	for (y = 0; y < ibuf->y; y++) {
 		for (x = 0; x < ibuf->x; x++) {
-			float * src1 = src + 4 * (ibuf->x * y + x);
-			char * p;
+			float *src1 = src + 4 * (ibuf->x * y + x);
+			char *p;
 			
 			memcpy(rgb, src1, 3 * sizeof(float));
 
@@ -682,8 +683,8 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_float(struct ImBuf * ibuf)
 			rgb_to_yuv_normalized(rgb, yuv);
 			
 			p = tgt + 4 * (w * (int) ((yuv[2] * (h - 3) + 1)) 
-					   + (int) ((yuv[1] * (w - 3) + 1)));
-			scope_put_pixel(wtable, (unsigned char*)p);
+			               + (int) ((yuv[1] * (w - 3) + 1)));
+			scope_put_pixel(wtable, (unsigned char *)p);
 		}
 	}
 
@@ -692,11 +693,12 @@ static struct ImBuf *make_vectorscope_view_from_ibuf_float(struct ImBuf * ibuf)
 	return rval;
 }
 
-struct ImBuf *make_vectorscope_view_from_ibuf(struct ImBuf * ibuf)
+ImBuf *make_vectorscope_view_from_ibuf(ImBuf *ibuf)
 {
 	if (ibuf->rect_float) {
 		return make_vectorscope_view_from_ibuf_float(ibuf);
-	} else {
+	}
+	else {
 		return make_vectorscope_view_from_ibuf_byte(ibuf);
 	}
 }
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index a656895..2447ca6 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -63,19 +63,22 @@
 
 /* own include */
 #include "sequencer_intern.h"
-static void *find_nearest_marker(int UNUSED(d1), int UNUSED(d2)) {return NULL;}
+static void *find_nearest_marker(int UNUSED(d1), int UNUSED(d2))
+{
+	return NULL;
+}
 	
 static void select_surrounding_handles(Scene *scene, Sequence *test) /* XXX BRING BACK */
 {
 	Sequence *neighbor;
 	
-	neighbor=find_neighboring_sequence(scene, test, SEQ_SIDE_LEFT, -1);
+	neighbor = find_neighboring_sequence(scene, test, SEQ_SIDE_LEFT, -1);
 	if (neighbor) {
 		neighbor->flag |= SELECT;
 		recurs_sel_seq(neighbor);
 		neighbor->flag |= SEQ_RIGHTSEL;
 	}
-	neighbor=find_neighboring_sequence(scene, test, SEQ_SIDE_RIGHT, -1);
+	neighbor = find_neighboring_sequence(scene, test, SEQ_SIDE_RIGHT, -1);
 	if (neighbor) {
 		neighbor->flag |= SELECT;
 		recurs_sel_seq(neighbor);
@@ -89,24 +92,24 @@ static void select_active_side(ListBase *seqbase, int sel_side, int channel, int
 {
 	Sequence *seq;
 
-	for(seq= seqbase->first; seq; seq=seq->next) {
-		if(channel==seq->machine) {
-			switch(sel_side) {
-			case SEQ_SIDE_LEFT:
-				if (frame > (seq->startdisp)) {
-					seq->flag &= ~(SEQ_RIGHTSEL|SEQ_LEFTSEL);
-					seq->flag |= SELECT;
-				}
-				break;
-			case SEQ_SIDE_RIGHT:
-				if (frame < (seq->startdisp)) {
-					seq->flag &= ~(SEQ_RIGHTSEL|SEQ_LEFTSEL);
-					seq->flag |= SELECT;
-				}
-				break;
-			case SEQ_SIDE_BOTH:
-				seq->flag &= ~(SEQ_RIGHTSEL|SEQ_LEFTSEL);
-				break;
+	for (seq = seqbase->first; seq; seq = seq->next) {
+		if (channel == seq->machine) {
+			switch (sel_side) {
+				case SEQ_SIDE_LEFT:
+					if (frame > (seq->startdisp)) {
+						seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL);
+						seq->flag |= SELECT;
+					}
+					break;
+				case SEQ_SIDE_RIGHT:
+					if (frame < (seq->startdisp)) {
+						seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL);
+						seq->flag |= SELECT;
+					}
+					break;
+				case SEQ_SIDE_BOTH:
+					seq->flag &= ~(SEQ_RIGHTSEL | SEQ_LEFTSEL);
+					break;
 			}
 		}
 	}
@@ -117,28 +120,28 @@ static void select_linked_time(ListBase *seqbase, Sequence *seq_link)
 {
 	Sequence *seq;
 
-	for(seq= seqbase->first; seq; seq=seq->next) {
-		if(seq_link->machine != seq->machine) {
-			int left_match = (seq->startdisp == seq_link->startdisp) ? 1:0;
-			int right_match = (seq->enddisp == seq_link->enddisp) ? 1:0;
+	for (seq = seqbase->first; seq; seq = seq->next) {
+		if (seq_link->machine != seq->machine) {
+			int left_match = (seq->startdisp == seq_link->startdisp) ? 1 : 0;
+			int right_match = (seq->enddisp == seq_link->enddisp) ? 1 : 0;
 
-			if(left_match && right_match) {
+			if (left_match && right_match) {
 				/* a direct match, copy the selection settinhs */
-				seq->flag &= ~(SELECT|SEQ_LEFTSEL|SEQ_RIGHTSEL);
-				seq->flag |= seq_link->flag & (SELECT|SEQ_LEFTSEL|SEQ_RIGHTSEL);
+				seq->flag &= ~(SELECT | SEQ_LEFTSEL | SEQ_RIGHTSEL);
+				seq->flag |= seq_link->flag & (SELECT | SEQ_LEFTSEL | SEQ_RIGHTSEL);
 
 				recurs_sel_seq(seq);
 			}
-			else if(seq_link->flag & SELECT && (left_match || right_match)) {
+			else if (seq_link->flag & SELECT && (left_match || right_match)) {
 
 				/* clear for reselection */
-				seq->flag &= ~(SEQ_LEFTSEL|SEQ_RIGHTSEL);
+				seq->flag &= ~(SEQ_LEFTSEL | SEQ_RIGHTSEL);
 
-				if(left_match && seq_link->flag & SEQ_LEFTSEL)
-					seq->flag |= SELECT|SEQ_LEFTSEL;
+				if (left_match && seq_link->flag & SEQ_LEFTSEL)
+					seq->flag |= SELECT | SEQ_LEFTSEL;
 
-				if(right_match && seq_link->flag & SEQ_RIGHTSEL)
-					seq->flag |= SELECT|SEQ_RIGHTSEL;
+				if (right_match && seq_link->flag & SEQ_RIGHTSEL)
+					seq->flag |= SELECT | SEQ_RIGHTSEL;
 
 				recurs_sel_seq(seq);
 			}
@@ -149,9 +152,9 @@ static void select_linked_time(ListBase *seqbase, Sequence *seq_link)
 #if 0 // BRING BACK
 void select_surround_from_last(Scene *scene)
 {
-	Sequence *seq=get_last_seq(scene);
+	Sequence *seq = get_last_seq(scene);
 	
-	if (seq==NULL)
+	if (seq == NULL)
 		return;
 	
 	select_surrounding_handles(scene, seq);
@@ -159,51 +162,51 @@ void select_surround_from_last(Scene *scene)
 #endif
 
 
-static void UNUSED_FUNCTION(select_single_seq)(Scene *scene, Sequence *seq, int deselect_all) /* BRING BACK */
+static void UNUSED_FUNCTION(select_single_seq) (Scene * scene, Sequence * seq, int deselect_all) /* BRING BACK */
 {
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	
-	if(deselect_all)
+	if (deselect_all)
 		deselect_all_seq(scene);
 	seq_active_set(scene, seq);
 
-	if((seq->type==SEQ_IMAGE) || (seq->type==SEQ_MOVIE)) {
-		if(seq->strip)
+	if ((seq->type == SEQ_IMAGE) || (seq->type == SEQ_MOVIE)) {
+		if (seq->strip)
 			BLI_strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR);
 	}
-	else if(seq->type==SEQ_SOUND) {
-		if(seq->strip)
+	else if (seq->type == SEQ_SOUND) {
+		if (seq->strip)
 			BLI_strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR);
 	}
-	seq->flag|= SELECT;
+	seq->flag |= SELECT;
 	recurs_sel_seq(seq);
 }
 
 #if 0
 static void select_neighbor_from_last(Scene *scene, int lr)
 {
-	Sequence *seq= seq_active_get(scene);
+	Sequence *seq = seq_active_get(scene);
 	Sequence *neighbor;
 	int change = 0;
 	if (seq) {
-		neighbor=find_neighboring_sequence(scene, seq, lr, -1);
+		neighbor = find_neighboring_sequence(scene, seq, lr, -1);
 		if (neighbor) {
 			switch (lr) {
-			case SEQ_SIDE_LEFT:
-				neighbor->flag |= SELECT;
-				recurs_sel_seq(neighbor);
-				neighbor->flag |= SEQ_RIGHTSEL;
-				seq->flag |= SEQ_LEFTSEL;
-				break;
-			case SEQ_SIDE_RIGHT:
-				neighbor->flag |= SELECT;
-				recurs_sel_seq(neighbor);
-				neighbor->flag |= SEQ_LEFTSEL;
-				seq->flag |= SEQ_RIGHTSEL;
-				break;
+				case SEQ_SIDE_LEFT:
+					neighbor->flag |= SELECT;
+					recurs_sel_seq(neighbor);
+					neighbor->flag |= SEQ_RIGHTSEL;
+					seq->flag |= SEQ_LEFTSEL;
+					break;
+				case SEQ_SIDE_RIGHT:
+					neighbor->flag |= SELECT;
+					recurs_sel_seq(neighbor);
+					neighbor->flag |= SEQ_LEFTSEL;
+					seq->flag |= SEQ_RIGHTSEL;
+					break;
 			}
-		seq->flag |= SELECT;
-		change = 1;
+			seq->flag |= SELECT;
+			change = 1;
 		}
 	}
 	if (change) {
@@ -259,16 +262,16 @@ static int sequencer_de_select_all_exec(bContext *C, wmOperator *op)
 void SEQUENCER_OT_select_all(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select or Deselect All";
-	ot->idname= "SEQUENCER_OT_select_all";
-	ot->description="Select or deselect all strips";
+	ot->name = "(De)select All";
+	ot->idname = "SEQUENCER_OT_select_all";
+	ot->description = "Select or deselect all strips";
 	
 	/* api callbacks */
-	ot->exec= sequencer_de_select_all_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->exec = sequencer_de_select_all_exec;
+	ot->poll = sequencer_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	WM_operator_properties_select_all(ot);
 }
@@ -277,21 +280,21 @@ void SEQUENCER_OT_select_all(struct wmOperatorType *ot)
 /* (de)select operator */
 static int sequencer_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	Sequence *seq;
 
-	for(seq= ed->seqbasep->first; seq; seq=seq->next) {
+	for (seq = ed->seqbasep->first; seq; seq = seq->next) {
 		if (seq->flag & SELECT) {
 			seq->flag &= ~SEQ_ALLSEL;
 		}
 		else {
-			seq->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL);
+			seq->flag &= ~(SEQ_LEFTSEL + SEQ_RIGHTSEL);
 			seq->flag |= SELECT;
 		}
 	}
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
 	
 	return OPERATOR_FINISHED;
 }
@@ -299,49 +302,49 @@ static int sequencer_select_inverse_exec(bContext *C, wmOperator *UNUSED(op))
 void SEQUENCER_OT_select_inverse(struct wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Inverse";
-	ot->idname= "SEQUENCER_OT_select_inverse";
-	ot->description="Select unselected strips";
+	ot->name = "Select Inverse";
+	ot->idname = "SEQUENCER_OT_select_inverse";
+	ot->description = "Select unselected strips";
 	
 	/* api callbacks */
-	ot->exec= sequencer_select_inverse_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->exec = sequencer_select_inverse_exec;
+	ot->poll = sequencer_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	View2D *v2d= UI_view2d_fromcontext(C);
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
-	short extend= RNA_boolean_get(op->ptr, "extend");
-	short linked_handle= RNA_boolean_get(op->ptr, "linked_handle");
-	short left_right= RNA_boolean_get(op->ptr, "left_right");
-	short linked_time= RNA_boolean_get(op->ptr, "linked_time");
+	View2D *v2d = UI_view2d_fromcontext(C);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
+	short extend = RNA_boolean_get(op->ptr, "extend");
+	short linked_handle = RNA_boolean_get(op->ptr, "linked_handle");
+	short left_right = RNA_boolean_get(op->ptr, "left_right");
+	short linked_time = RNA_boolean_get(op->ptr, "linked_time");
 	
-	Sequence *seq,*neighbor, *act_orig;
-	int hand,sel_side;
+	Sequence *seq, *neighbor, *act_orig;
+	int hand, sel_side;
 	TimeMarker *marker;
 
-	if(ed==NULL)
+	if (ed == NULL)
 		return OPERATOR_CANCELLED;
 	
-	marker=find_nearest_marker(SCE_MARKERS, 1); //XXX - dummy function for now
+	marker = find_nearest_marker(SCE_MARKERS, 1); //XXX - dummy function for now
 	
-	seq= find_nearest_seq(scene, v2d, &hand, event->mval);
+	seq = find_nearest_seq(scene, v2d, &hand, event->mval);
 
 	// XXX - not nice, Ctrl+RMB needs to do left_right only when not over a strip
-	if(seq && linked_time && left_right)
-		left_right= FALSE;
+	if (seq && linked_time && left_right)
+		left_right = FALSE;
 
 
 	if (marker) {
 		int oldflag;
 		/* select timeline marker */
 		if (extend) {
-			oldflag= marker->flag;
+			oldflag = marker->flag;
 			if (oldflag & SELECT)
 				marker->flag &= ~SELECT;
 			else
@@ -352,21 +355,23 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 			marker->flag |= SELECT;				
 		}
 		
-	} else if (left_right) {
+	}
+	else if (left_right) {
 		/* use different logic for this */
 		float x;
 		deselect_all_seq(scene);
 		UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, NULL);
 
-		SEQP_BEGIN(ed, seq) {
+		SEQP_BEGIN(ed, seq)
+		{
 			if (x < CFRA) {
-				if(seq->enddisp < CFRA) {
+				if (seq->enddisp < CFRA) {
 					seq->flag |= SELECT;
 					recurs_sel_seq(seq);
 				}
 			}
 			else {
-				if(seq->startdisp > CFRA) {
+				if (seq->startdisp > CFRA) {
 					seq->flag |= SELECT;
 					recurs_sel_seq(seq);
 				}
@@ -375,14 +380,14 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 		SEQ_END
 		
 		{
-			SpaceSeq *sseq= CTX_wm_space_seq(C);
+			SpaceSeq *sseq = CTX_wm_space_seq(C);
 			if (sseq && sseq->flag & SEQ_MARKER_TRANS) {
 				TimeMarker *tmarker;
 
-				for (tmarker= scene->markers.first; tmarker; tmarker= tmarker->next) {
-					if(	((x < CFRA) && tmarker->frame < CFRA) ||
-						((x >= CFRA) && tmarker->frame >= CFRA)
-					) {
+				for (tmarker = scene->markers.first; tmarker; tmarker = tmarker->next) {
+					if (((x <  CFRA) && tmarker->frame <  CFRA) ||
+					    ((x >= CFRA) && tmarker->frame >= CFRA))
+					{
 						tmarker->flag |= SELECT;
 					}
 					else {
@@ -391,51 +396,53 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 				}
 			}
 		}
-	} else {
+	}
+	else {
 		// seq= find_nearest_seq(scene, v2d, &hand, mval);
 
-		act_orig= ed->act_seq;
+		act_orig = ed->act_seq;
 
-		if(extend == 0 && linked_handle==0)
+		if (extend == 0 && linked_handle == 0)
 			deselect_all_seq(scene);
 	
-		if(seq) {
+		if (seq) {
 			seq_active_set(scene, seq);
 	
 			if ((seq->type == SEQ_IMAGE) || (seq->type == SEQ_MOVIE)) {
-				if(seq->strip) {
+				if (seq->strip) {
 					BLI_strncpy(ed->act_imagedir, seq->strip->dir, FILE_MAXDIR);
 				}
-			} else
+			}
+			else
 			if (seq->type == SEQ_SOUND) {
-				if(seq->strip) {
+				if (seq->strip) {
 					BLI_strncpy(ed->act_sounddir, seq->strip->dir, FILE_MAXDIR);
 				}
 			}
 	
-			if(extend && (seq->flag & SELECT) && ed->act_seq == act_orig ) {
-				switch(hand) {
-				case SEQ_SIDE_NONE:
-					if (linked_handle==0)
-						seq->flag &= ~SEQ_ALLSEL;
-					break;
-				case SEQ_SIDE_LEFT:
-					seq->flag ^= SEQ_LEFTSEL;
-					break;
-				case SEQ_SIDE_RIGHT:
-					seq->flag ^= SEQ_RIGHTSEL;
-					break;
+			if (extend && (seq->flag & SELECT) && ed->act_seq == act_orig) {
+				switch (hand) {
+					case SEQ_SIDE_NONE:
+						if (linked_handle == 0)
+							seq->flag &= ~SEQ_ALLSEL;
+						break;
+					case SEQ_SIDE_LEFT:
+						seq->flag ^= SEQ_LEFTSEL;
+						break;
+					case SEQ_SIDE_RIGHT:
+						seq->flag ^= SEQ_RIGHTSEL;
+						break;
 				}
 			}
 			else {
 				seq->flag |= SELECT;
-				if(hand==SEQ_SIDE_LEFT)		seq->flag |= SEQ_LEFTSEL;
-				if(hand==SEQ_SIDE_RIGHT)	seq->flag |= SEQ_RIGHTSEL;
+				if (hand == SEQ_SIDE_LEFT) seq->flag |= SEQ_LEFTSEL;
+				if (hand == SEQ_SIDE_RIGHT) seq->flag |= SEQ_RIGHTSEL;
 			}
 			
 			/* On Alt selection, select the strip and bordering handles */
 			if (linked_handle && !ELEM(hand, SEQ_SIDE_LEFT, SEQ_SIDE_RIGHT)) {
-				if(extend==0) deselect_all_seq(scene);
+				if (extend == 0) deselect_all_seq(scene);
 				seq->flag |= SELECT;
 				select_surrounding_handles(scene, seq);
 			}
@@ -445,51 +452,54 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 				 * Second click selects all strips in that direction.
 				 * If there are no adjacent strips, it just selects all in that direction.
 				 */
-				sel_side= hand;
-				neighbor=find_neighboring_sequence(scene, seq, sel_side, -1);
+				sel_side = hand;
+				neighbor = find_neighboring_sequence(scene, seq, sel_side, -1);
 				if (neighbor) {
 					switch (sel_side) {
-					case SEQ_SIDE_LEFT:
-						if ((seq->flag & SEQ_LEFTSEL) && (neighbor->flag & SEQ_RIGHTSEL)) {
-							if(extend==0) deselect_all_seq(scene);
-							seq->flag |= SELECT;
-							
-							select_active_side(ed->seqbasep, SEQ_SIDE_LEFT, seq->machine, seq->startdisp);
-						} else {
-							if(extend==0) deselect_all_seq(scene);
-							seq->flag |= SELECT;
-
-							neighbor->flag |= SELECT;
-							recurs_sel_seq(neighbor);
-							neighbor->flag |= SEQ_RIGHTSEL;
-							seq->flag |= SEQ_LEFTSEL;
-						}
-						break;
-					case SEQ_SIDE_RIGHT:
-						if ((seq->flag & SEQ_RIGHTSEL) && (neighbor->flag & SEQ_LEFTSEL)) {
-							if(extend==0) deselect_all_seq(scene);
-							seq->flag |= SELECT;
-
-							select_active_side(ed->seqbasep, SEQ_SIDE_RIGHT, seq->machine, seq->startdisp);
-						} else {
-							if(extend==0) deselect_all_seq(scene);
-							seq->flag |= SELECT;
-
-							neighbor->flag |= SELECT;
-							recurs_sel_seq(neighbor);
-							neighbor->flag |= SEQ_LEFTSEL;
-							seq->flag |= SEQ_RIGHTSEL;
-						}
-						break;
+						case SEQ_SIDE_LEFT:
+							if ((seq->flag & SEQ_LEFTSEL) && (neighbor->flag & SEQ_RIGHTSEL)) {
+								if (extend == 0) deselect_all_seq(scene);
+								seq->flag |= SELECT;
+
+								select_active_side(ed->seqbasep, SEQ_SIDE_LEFT, seq->machine, seq->startdisp);
+							}
+							else {
+								if (extend == 0) deselect_all_seq(scene);
+								seq->flag |= SELECT;
+
+								neighbor->flag |= SELECT;
+								recurs_sel_seq(neighbor);
+								neighbor->flag |= SEQ_RIGHTSEL;
+								seq->flag |= SEQ_LEFTSEL;
+							}
+							break;
+						case SEQ_SIDE_RIGHT:
+							if ((seq->flag & SEQ_RIGHTSEL) && (neighbor->flag & SEQ_LEFTSEL)) {
+								if (extend == 0) deselect_all_seq(scene);
+								seq->flag |= SELECT;
+
+								select_active_side(ed->seqbasep, SEQ_SIDE_RIGHT, seq->machine, seq->startdisp);
+							}
+							else {
+								if (extend == 0) deselect_all_seq(scene);
+								seq->flag |= SELECT;
+
+								neighbor->flag |= SELECT;
+								recurs_sel_seq(neighbor);
+								neighbor->flag |= SEQ_LEFTSEL;
+								seq->flag |= SEQ_RIGHTSEL;
+							}
+							break;
 					}
-				} else {
-					if(extend==0) deselect_all_seq(scene);
+				}
+				else {
+					if (extend == 0) deselect_all_seq(scene);
 					select_active_side(ed->seqbasep, sel_side, seq->machine, seq->startdisp);
 				}
 			}
 			recurs_sel_seq(seq);
 
-			if(linked_time) {
+			if (linked_time) {
 				select_linked_time(ed->seqbasep, seq);
 			}
 		}
@@ -500,12 +510,12 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	if (marker) {
 		int mval[2], xo, yo;
 //		getmouseco_areawin(mval);
-		xo= mval[0]; 
-		yo= mval[1];
+		xo = mval[0];
+		yo = mval[1];
 		
-		while(get_mbut()) {		
+		while (get_mbut()) {
 //			getmouseco_areawin(mval);
-			if(abs(mval[0]-xo)+abs(mval[1]-yo) > 4) {
+			if (abs(mval[0] - xo) + abs(mval[1] - yo) > 4) {
 				transform_markers('g', 0);
 				return;
 			}
@@ -513,30 +523,30 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	}
 #endif
 	
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
 
 	/* allowing tweaks */
-	return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
+	return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
 }
 
 void SEQUENCER_OT_select(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Activate/Select";
-	ot->idname= "SEQUENCER_OT_select";
-	ot->description="Select a strip (last selected becomes the \"active strip\")";
+	ot->name = "Activate/Select";
+	ot->idname = "SEQUENCER_OT_select";
+	ot->description = "Select a strip (last selected becomes the \"active strip\")";
 	
 	/* api callbacks */
-	ot->invoke= sequencer_select_invoke;
-	ot->poll= ED_operator_sequencer_active;
+	ot->invoke = sequencer_select_invoke;
+	ot->poll = ED_operator_sequencer_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection");
 	RNA_def_boolean(ot->srna, "linked_handle", 0, "Linked Handle", "Select handles next to the active strip");
-	/* for animation this is an enum but atm having an enum isnt useful for us */
+	/* for animation this is an enum but atm having an enum isn't useful for us */
 	RNA_def_boolean(ot->srna, "left_right", 0, "Left/Right", "Select based on the current frame side the cursor is on");
 	RNA_def_boolean(ot->srna, "linked_time", 0, "Linked Time", "Select other strips at the same time");
 }
@@ -547,44 +557,45 @@ void SEQUENCER_OT_select(wmOperatorType *ot)
 /* run recursively to select linked */
 static int select_more_less_seq__internal(Scene *scene, int sel, int linked)
 {
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	Sequence *seq, *neighbor;
-	int change=0;
+	int change = 0;
 	int isel;
 	
-	if(ed==NULL) return 0;
+	if (ed == NULL) return 0;
 	
 	if (sel) {
 		sel = SELECT;
 		isel = 0;
-	} else {
+	}
+	else {
 		sel = 0;
 		isel = SELECT;
 	}
 	
 	if (!linked) {
 		/* if not linked we only want to touch each seq once, newseq */
-		for(seq= ed->seqbasep->first; seq; seq= seq->next) {
+		for (seq = ed->seqbasep->first; seq; seq = seq->next) {
 			seq->tmp = NULL;
 		}
 	}
 	
-	for(seq= ed->seqbasep->first; seq; seq= seq->next) {
-		if((int)(seq->flag & SELECT) == sel) {
-			if ((linked==0 && seq->tmp)==0) {
+	for (seq = ed->seqbasep->first; seq; seq = seq->next) {
+		if ((int)(seq->flag & SELECT) == sel) {
+			if ((linked == 0 && seq->tmp) == 0) {
 				/* only get unselected nabours */
 				neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_LEFT, isel);
 				if (neighbor) {
-					if (sel) {neighbor->flag |= SELECT; recurs_sel_seq(neighbor);}
-					else		neighbor->flag &= ~SELECT;
-					if (linked==0) neighbor->tmp = (Sequence *)1;
+					if (sel) {neighbor->flag |= SELECT; recurs_sel_seq(neighbor); }
+					else neighbor->flag &= ~SELECT;
+					if (linked == 0) neighbor->tmp = (Sequence *)1;
 					change = 1;
 				}
 				neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_RIGHT, isel);
 				if (neighbor) {
-					if (sel) {neighbor->flag |= SELECT; recurs_sel_seq(neighbor);}
-					else		neighbor->flag &= ~SELECT;
-					if (linked==0) neighbor->tmp = (void *)1;
+					if (sel) {neighbor->flag |= SELECT; recurs_sel_seq(neighbor); }
+					else neighbor->flag &= ~SELECT;
+					if (linked == 0) neighbor->tmp = (void *)1;
 					change = 1;
 				}
 			}
@@ -599,12 +610,12 @@ static int select_more_less_seq__internal(Scene *scene, int sel, int linked)
 /* select more operator */
 static int sequencer_select_more_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	
-	if(!select_more_less_seq__internal(scene, 0, 0))
+	if (!select_more_less_seq__internal(scene, 0, 0))
 		return OPERATOR_CANCELLED;
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
 	
 	return OPERATOR_FINISHED;
 }
@@ -612,16 +623,16 @@ static int sequencer_select_more_exec(bContext *C, wmOperator *UNUSED(op))
 void SEQUENCER_OT_select_more(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select More";
-	ot->idname= "SEQUENCER_OT_select_more";
-	ot->description="Select more strips adjacent to the current selection";
+	ot->name = "Select More";
+	ot->idname = "SEQUENCER_OT_select_more";
+	ot->description = "Select more strips adjacent to the current selection";
 	
 	/* api callbacks */
-	ot->exec= sequencer_select_more_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->exec = sequencer_select_more_exec;
+	ot->poll = sequencer_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* properties */
 }
@@ -630,12 +641,12 @@ void SEQUENCER_OT_select_more(wmOperatorType *ot)
 /* select less operator */
 static int sequencer_select_less_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	
-	if(!select_more_less_seq__internal(scene, 1, 0))
+	if (!select_more_less_seq__internal(scene, 1, 0))
 		return OPERATOR_CANCELLED;
  
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
 	
 	return OPERATOR_FINISHED;
 }
@@ -643,16 +654,16 @@ static int sequencer_select_less_exec(bContext *C, wmOperator *UNUSED(op))
 void SEQUENCER_OT_select_less(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Less";
-	ot->idname= "SEQUENCER_OT_select_less";
-	ot->description="Shrink the current selection of adjacent selected strips";
+	ot->name = "Select Less";
+	ot->idname = "SEQUENCER_OT_select_less";
+	ot->description = "Shrink the current selection of adjacent selected strips";
 	
 	/* api callbacks */
-	ot->exec= sequencer_select_less_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->exec = sequencer_select_less_exec;
+	ot->poll = sequencer_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* properties */
 }
@@ -661,20 +672,20 @@ void SEQUENCER_OT_select_less(wmOperatorType *ot)
 /* select pick linked operator (uses the mouse) */
 static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	Scene *scene= CTX_data_scene(C);
-	View2D *v2d= UI_view2d_fromcontext(C);
+	Scene *scene = CTX_data_scene(C);
+	View2D *v2d = UI_view2d_fromcontext(C);
 	
-	short extend= RNA_boolean_get(op->ptr, "extend");
+	short extend = RNA_boolean_get(op->ptr, "extend");
 	
 	Sequence *mouse_seq;
 	int selected, hand;
 
 	/* this works like UV, not mesh */
-	mouse_seq= find_nearest_seq(scene, v2d, &hand, event->mval);
+	mouse_seq = find_nearest_seq(scene, v2d, &hand, event->mval);
 	if (!mouse_seq)
-		return OPERATOR_FINISHED; /* user error as with mesh?? */
+		return OPERATOR_FINISHED;  /* user error as with mesh?? */
 	
-	if (extend==0)
+	if (extend == 0)
 		deselect_all_seq(scene);
 	
 	mouse_seq->flag |= SELECT;
@@ -685,7 +696,7 @@ static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEv
 		selected = select_more_less_seq__internal(scene, 1, 1);
 	}
 	
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
 	
 	return OPERATOR_FINISHED;
 }
@@ -693,26 +704,26 @@ static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEv
 void SEQUENCER_OT_select_linked_pick(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select pick linked";
-	ot->idname= "SEQUENCER_OT_select_linked_pick";
-	ot->description="Select a chain of linked strips nearest to the mouse pointer";
+	ot->name = "Select pick linked";
+	ot->idname = "SEQUENCER_OT_select_linked_pick";
+	ot->description = "Select a chain of linked strips nearest to the mouse pointer";
 	
 	/* api callbacks */
-	ot->invoke= sequencer_select_linked_pick_invoke;
-	ot->poll= ED_operator_sequencer_active;
+	ot->invoke = sequencer_select_linked_pick_invoke;
+	ot->poll = ED_operator_sequencer_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* properties */
-	RNA_def_boolean(ot->srna, "extend", 0, "Extend", "extend the selection");
+	RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection");
 }
 
 
 /* select linked operator */
 static int sequencer_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	int selected;
 
 	selected = 1;
@@ -720,7 +731,7 @@ static int sequencer_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
 		selected = select_more_less_seq__internal(scene, 1, 1);
 	}
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
 
 	return OPERATOR_FINISHED;
 }
@@ -728,16 +739,16 @@ static int sequencer_select_linked_exec(bContext *C, wmOperator *UNUSED(op))
 void SEQUENCER_OT_select_linked(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select linked";
-	ot->idname= "SEQUENCER_OT_select_linked";
-	ot->description="Select all strips adjacent to the current selection";
+	ot->name = "Select linked";
+	ot->idname = "SEQUENCER_OT_select_linked";
+	ot->description = "Select all strips adjacent to the current selection";
 	
 	/* api callbacks */
-	ot->exec= sequencer_select_linked_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->exec = sequencer_select_linked_exec;
+	ot->poll = sequencer_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* properties */
 }
@@ -746,31 +757,31 @@ void SEQUENCER_OT_select_linked(wmOperatorType *ot)
 /* select handles operator */
 static int sequencer_select_handles_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, 0);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, 0);
 	Sequence *seq;
-	int sel_side= RNA_enum_get(op->ptr, "side");
+	int sel_side = RNA_enum_get(op->ptr, "side");
 
 
-	for(seq= ed->seqbasep->first; seq; seq=seq->next) {
+	for (seq = ed->seqbasep->first; seq; seq = seq->next) {
 		if (seq->flag & SELECT) {
-			switch(sel_side) {
-			case SEQ_SIDE_LEFT:
-				seq->flag &= ~SEQ_RIGHTSEL;
-				seq->flag |= SEQ_LEFTSEL;
-				break;
-			case SEQ_SIDE_RIGHT:
-				seq->flag &= ~SEQ_LEFTSEL;
-				seq->flag |= SEQ_RIGHTSEL;
-				break;
-			case SEQ_SIDE_BOTH:
-				seq->flag |= SEQ_LEFTSEL+SEQ_RIGHTSEL;
-				break;
+			switch (sel_side) {
+				case SEQ_SIDE_LEFT:
+					seq->flag &= ~SEQ_RIGHTSEL;
+					seq->flag |= SEQ_LEFTSEL;
+					break;
+				case SEQ_SIDE_RIGHT:
+					seq->flag &= ~SEQ_LEFTSEL;
+					seq->flag |= SEQ_RIGHTSEL;
+					break;
+				case SEQ_SIDE_BOTH:
+					seq->flag |= SEQ_LEFTSEL + SEQ_RIGHTSEL;
+					break;
 			}
 		}
 	}
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
 
 	return OPERATOR_FINISHED;
 }
@@ -778,16 +789,16 @@ static int sequencer_select_handles_exec(bContext *C, wmOperator *op)
 void SEQUENCER_OT_select_handles(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Handles";
-	ot->idname= "SEQUENCER_OT_select_handles";
-	ot->description="Select manipulator handles on the sides of the selected strip";
+	ot->name = "Select Handles";
+	ot->idname = "SEQUENCER_OT_select_handles";
+	ot->description = "Select manipulator handles on the sides of the selected strip";
 	
 	/* api callbacks */
-	ot->exec= sequencer_select_handles_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->exec = sequencer_select_handles_exec;
+	ot->poll = sequencer_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_enum(ot->srna, "side", prop_side_types, SEQ_SIDE_BOTH, "Side", "The side of the handle that is selected");
@@ -796,18 +807,18 @@ void SEQUENCER_OT_select_handles(wmOperatorType *ot)
 /* select side operator */
 static int sequencer_select_active_side_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, 0);
-	Sequence *seq_act= seq_active_get(scene);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, 0);
+	Sequence *seq_act = seq_active_get(scene);
 
-	if (ed==NULL || seq_act==NULL)
+	if (ed == NULL || seq_act == NULL)
 		return OPERATOR_CANCELLED;
 
 	seq_act->flag |= SELECT;
 
 	select_active_side(ed->seqbasep, RNA_enum_get(op->ptr, "side"), seq_act->machine, seq_act->startdisp);
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
 
 	return OPERATOR_FINISHED;
 }
@@ -815,16 +826,16 @@ static int sequencer_select_active_side_exec(bContext *C, wmOperator *op)
 void SEQUENCER_OT_select_active_side(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Active Side";
-	ot->idname= "SEQUENCER_OT_select_active_side";
-	ot->description="Select strips on the nominated side of the active strip";
+	ot->name = "Select Active Side";
+	ot->idname = "SEQUENCER_OT_select_active_side";
+	ot->description = "Select strips on the nominated side of the active strip";
 	
 	/* api callbacks */
-	ot->exec= sequencer_select_active_side_exec;
-	ot->poll= sequencer_edit_poll;
+	ot->exec = sequencer_select_active_side_exec;
+	ot->poll = sequencer_edit_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "side", prop_side_types, SEQ_SIDE_BOTH, "Side", "The side of the handle that is selected");
@@ -834,47 +845,47 @@ void SEQUENCER_OT_select_active_side(wmOperatorType *ot)
 /* borderselect operator */
 static int sequencer_borderselect_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Editing *ed= seq_give_editing(scene, FALSE);
-	View2D *v2d= UI_view2d_fromcontext(C);
+	Scene *scene = CTX_data_scene(C);
+	Editing *ed = seq_give_editing(scene, FALSE);
+	View2D *v2d = UI_view2d_fromcontext(C);
 	
 	Sequence *seq;
 	rcti rect;
 	rctf rectf, rq;
-	short selecting = (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT);
+	short selecting = (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT);
 	int extend = RNA_boolean_get(op->ptr, "extend");
 	int mval[2];
 
-	if(ed==NULL)
+	if (ed == NULL)
 		return OPERATOR_CANCELLED;
 
-	rect.xmin= RNA_int_get(op->ptr, "xmin");
-	rect.ymin= RNA_int_get(op->ptr, "ymin");
-	rect.xmax= RNA_int_get(op->ptr, "xmax");
-	rect.ymax= RNA_int_get(op->ptr, "ymax");
+	rect.xmin = RNA_int_get(op->ptr, "xmin");
+	rect.ymin = RNA_int_get(op->ptr, "ymin");
+	rect.xmax = RNA_int_get(op->ptr, "xmax");
+	rect.ymax = RNA_int_get(op->ptr, "ymax");
 	
-	mval[0]= rect.xmin;
-	mval[1]= rect.ymin;
+	mval[0] = rect.xmin;
+	mval[1] = rect.ymin;
 	UI_view2d_region_to_view(v2d, mval[0], mval[1], &rectf.xmin, &rectf.ymin);
-	mval[0]= rect.xmax;
-	mval[1]= rect.ymax;
+	mval[0] = rect.xmax;
+	mval[1] = rect.ymax;
 	UI_view2d_region_to_view(v2d, mval[0], mval[1], &rectf.xmax, &rectf.ymax);
 
-	for(seq= ed->seqbasep->first; seq; seq= seq->next) {
+	for (seq = ed->seqbasep->first; seq; seq = seq->next) {
 		seq_rectf(seq, &rq);
 		
-		if(BLI_isect_rctf(&rq, &rectf, NULL)) {
-			if(selecting)		seq->flag |= SELECT;
-			else				seq->flag &= ~SEQ_ALLSEL;
+		if (BLI_isect_rctf(&rq, &rectf, NULL)) {
+			if (selecting) seq->flag |= SELECT;
+			else seq->flag &= ~SEQ_ALLSEL;
 			recurs_sel_seq(seq);
 		}
-		else if(!extend) {
+		else if (!extend) {
 			seq->flag &= ~SEQ_ALLSEL;
 			recurs_sel_seq(seq);
 		}
 	}
 
-	WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
+	WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
 
 	return OPERATOR_FINISHED;
 } 
@@ -884,20 +895,20 @@ static int sequencer_borderselect_exec(bContext *C, wmOperator *op)
 void SEQUENCER_OT_select_border(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Border Select";
-	ot->idname= "SEQUENCER_OT_select_border";
-	ot->description="Enable border select mode";
+	ot->name = "Border Select";
+	ot->idname = "SEQUENCER_OT_select_border";
+	ot->description = "Enable border select mode";
 	
 	/* api callbacks */
-	ot->invoke= WM_border_select_invoke;
-	ot->exec= sequencer_borderselect_exec;
-	ot->modal= WM_border_select_modal;
-	ot->cancel= WM_border_select_cancel;
+	ot->invoke = WM_border_select_invoke;
+	ot->exec = sequencer_borderselect_exec;
+	ot->modal = WM_border_select_modal;
+	ot->cancel = WM_border_select_cancel;
 	
-	ot->poll= ED_operator_sequencer_active;
+	ot->poll = ED_operator_sequencer_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* rna */
 	WM_operator_properties_gesture_border(ot, TRUE);
@@ -909,11 +920,11 @@ static EnumPropertyItem sequencer_prop_select_grouped_types[] = {
 	{1, "TYPE", 0, "Type", "Shared strip type"},
 	{2, "TYPE_BASIC", 0, "Global Type", "All strips of same basic type (Graphical or Sound)"},
 	{3, "TYPE_EFFECT", 0, "Effect Type",
-	    "Shared strip effect type (if active strip is not an effect one, select all non-effect strips)"},
+	 "Shared strip effect type (if active strip is not an effect one, select all non-effect strips)"},
 	{4, "DATA", 0, "Data", "Shared data (scene, image, sound, etc.)"},
 	{5, "EFFECT", 0, "Effect", "Shared effects"},
 	{6, "EFFECT_LINK", 0, "Effect/Linked",
-	    "Other strips affected by the active one (sharing some time, and below or effect-assigned)"},
+	 "Other strips affected by the active one (sharing some time, and below or effect-assigned)"},
 	{7, "OVERLAP", 0, "Overlap", "Overlapping time"},
 	{0, NULL, 0, NULL, NULL}
 };
@@ -922,7 +933,7 @@ static EnumPropertyItem sequencer_prop_select_grouped_types[] = {
 
 #define SEQ_IS_EFFECT(_seq) (_seq->type & SEQ_EFFECT)
 
-#define SEQ_USE_DATA(_seq) (_seq->type == SEQ_SCENE || SEQ_HAS_PATH(_seq))
+#define SEQ_USE_DATA(_seq) (ELEM(_seq->type, SEQ_SCENE, SEQ_MOVIECLIP) || SEQ_HAS_PATH(_seq))
 
 static short select_grouped_type(Editing *ed, Sequence *actseq)
 {
@@ -978,7 +989,6 @@ static short select_grouped_data(Editing *ed, Sequence *actseq)
 {
 	Sequence *seq;
 	short changed = FALSE;
-	Scene *sce = actseq->scene;
 	char *dir = actseq->strip ? actseq->strip->dir : NULL;
 
 	if (!SEQ_USE_DATA(actseq))
@@ -993,7 +1003,8 @@ static short select_grouped_data(Editing *ed, Sequence *actseq)
 		}
 		SEQ_END;
 	}
-	else {
+	else if (actseq->type == SEQ_SCENE) {
+		Scene *sce = actseq->scene;
 		SEQP_BEGIN(ed, seq) {
 			if (seq->type == SEQ_SCENE && seq->scene == sce) {
 				seq->flag |= SELECT;
@@ -1002,6 +1013,16 @@ static short select_grouped_data(Editing *ed, Sequence *actseq)
 		}
 		SEQ_END;
 	}
+	else if (actseq->type == SEQ_MOVIECLIP) {
+		MovieClip *clip = actseq->clip;
+		SEQP_BEGIN(ed, seq) {
+			if (seq->type == SEQ_MOVIECLIP && seq->clip == clip) {
+				seq->flag |= SELECT;
+				changed = TRUE;
+			}
+		}
+		SEQ_END;
+	}
 
 	return changed;
 }
@@ -1010,7 +1031,7 @@ static short select_grouped_effect(Editing *ed, Sequence *actseq)
 {
 	Sequence *seq;
 	short changed = FALSE;
-	short effects[SEQ_EFFECT_MAX+1];
+	short effects[SEQ_EFFECT_MAX + 1];
 	int i;
 
 	for (i = 0; i <= SEQ_EFFECT_MAX; i++)
@@ -1025,9 +1046,9 @@ static short select_grouped_effect(Editing *ed, Sequence *actseq)
 
 	SEQP_BEGIN(ed, seq) {
 		if (effects[seq->type]) {
-			if(seq->seq1) seq->seq1->flag |= SELECT;
-			if(seq->seq2) seq->seq2->flag |= SELECT;
-			if(seq->seq3) seq->seq3->flag |= SELECT;
+			if (seq->seq1) seq->seq1->flag |= SELECT;
+			if (seq->seq2) seq->seq2->flag |= SELECT;
+			if (seq->seq3) seq->seq3->flag |= SELECT;
 			changed = TRUE;
 		}
 	}
@@ -1067,18 +1088,20 @@ static short select_grouped_effect_link(Editing *ed, Sequence *actseq)
 	}
 	SEQ_END;
 
-	actseq->tmp= SET_INT_IN_POINTER(TRUE);
+	actseq->tmp = SET_INT_IN_POINTER(TRUE);
 
-	for(seq_begin(ed, &iter, 1); iter.valid; seq_next(&iter)) {
+	for (seq_begin(ed, &iter, 1); iter.valid; seq_next(&iter)) {
 		seq = iter.seq;
 
 		/* Ignore all seqs already selected! */
 		/* Ignore all seqs not sharing some time with active one. */
 		/* Ignore all seqs of incompatible types (audio vs video). */
-		if ((seq->flag & SELECT) || (seq->startdisp >= enddisp) || (seq->enddisp < startdisp)
-		    || (!is_audio && SEQ_IS_SOUND(seq))
-		    || (is_audio && !((seq->type == SEQ_META) || SEQ_IS_SOUND(seq))))
+		if ((seq->flag & SELECT) || (seq->startdisp >= enddisp) || (seq->enddisp < startdisp) ||
+		    (!is_audio && SEQ_IS_SOUND(seq)) ||
+		    (is_audio && !((seq->type == SEQ_META) || SEQ_IS_SOUND(seq))))
+		{
 			continue;
+		}
 
 		/* If the seq is an effect one, we need extra cheking! */
 		if (SEQ_IS_EFFECT(seq) && ((seq->seq1 && seq->seq1->tmp) ||
@@ -1089,12 +1112,12 @@ static short select_grouped_effect_link(Editing *ed, Sequence *actseq)
 			if (enddisp < seq->enddisp) enddisp = seq->enddisp;
 			if (machine < seq->machine) machine = seq->machine;
 
-			seq->tmp= SET_INT_IN_POINTER(TRUE);
+			seq->tmp = SET_INT_IN_POINTER(TRUE);
 
 			seq->flag |= SELECT;
 			changed = TRUE;
 
-			/* Unfortunately, we must restart checks from the begining. */
+			/* Unfortunately, we must restart checks from the beginning. */
 			seq_end(&iter);
 			seq_begin(ed, &iter, 1);
 		}
@@ -1110,6 +1133,10 @@ static short select_grouped_effect_link(Editing *ed, Sequence *actseq)
 	return changed;
 }
 
+#undef SEQ_IS_SOUND
+#undef SEQ_IS_EFFECT
+#undef SEQ_USE_DATA
+
 static int sequencer_select_grouped_exec(bContext *C, wmOperator *op)
 {
 	Scene *scene  = CTX_data_scene(C);
@@ -1133,16 +1160,16 @@ static int sequencer_select_grouped_exec(bContext *C, wmOperator *op)
 		SEQ_END;
 	}
 
-	if(type==1)      changed |= select_grouped_type(ed, actseq);
-	else if(type==2) changed |= select_grouped_type_basic(ed, actseq);
-	else if(type==3) changed |= select_grouped_type_effect(ed, actseq);
-	else if(type==4) changed |= select_grouped_data(ed, actseq);
-	else if(type==5) changed |= select_grouped_effect(ed, actseq);
-	else if(type==6) changed |= select_grouped_effect_link(ed, actseq);
-	else if(type==7) changed |= select_grouped_time_overlap(ed, actseq);
+	if      (type == 1) changed |= select_grouped_type(ed, actseq);
+	else if (type == 2) changed |= select_grouped_type_basic(ed, actseq);
+	else if (type == 3) changed |= select_grouped_type_effect(ed, actseq);
+	else if (type == 4) changed |= select_grouped_data(ed, actseq);
+	else if (type == 5) changed |= select_grouped_effect(ed, actseq);
+	else if (type == 6) changed |= select_grouped_effect_link(ed, actseq);
+	else if (type == 7) changed |= select_grouped_time_overlap(ed, actseq);
 
 	if (changed) {
-		WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER|NA_SELECTED, scene);
+		WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
 		return OPERATOR_FINISHED;
 	}
 
@@ -1162,7 +1189,7 @@ void SEQUENCER_OT_select_grouped(wmOperatorType *ot)
 	ot->poll = sequencer_edit_poll;
 	
 	/* flags */
-	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_boolean(ot->srna, "extend", FALSE, "Extend", "Extend selection instead of deselecting everything first");
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index 303f691..ec340dd 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -56,7 +56,7 @@
 #include "UI_resources.h"
 #include "UI_view2d.h"
 
-#include "sequencer_intern.h"	// own include
+#include "sequencer_intern.h"   // own include
 
 /* ******************** manage regions ********************* */
 
@@ -64,20 +64,20 @@ ARegion *sequencer_has_buttons_region(ScrArea *sa)
 {
 	ARegion *ar, *arnew;
 
-	ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
-	if(ar) return ar;
+	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 sequencer");
+	arnew = MEM_callocN(sizeof(ARegion), "buttons for sequencer");
 	
 	BLI_insertlinkafter(&sa->regionbase, ar, arnew);
-	arnew->regiontype= RGN_TYPE_UI;
-	arnew->alignment= RGN_ALIGN_RIGHT;
+	arnew->regiontype = RGN_TYPE_UI;
+	arnew->alignment = RGN_ALIGN_RIGHT;
 	
 	arnew->flag = RGN_FLAG_HIDDEN;
 	
@@ -86,10 +86,10 @@ ARegion *sequencer_has_buttons_region(ScrArea *sa)
 
 static ARegion *sequencer_find_region(ScrArea *sa, short type)
 {
-	ARegion *ar=NULL;
+	ARegion *ar = NULL;
 	
-	for(ar= sa->regionbase.first; ar; ar= ar->next)
-		if(ar->regiontype==type)
+	for (ar = sa->regionbase.first; ar; ar = ar->next)
+		if (ar->regiontype == type)
 			return ar;
 
 	return ar;
@@ -99,84 +99,84 @@ static ARegion *sequencer_find_region(ScrArea *sa, short type)
 
 static SpaceLink *sequencer_new(const bContext *C)
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	ARegion *ar;
 	SpaceSeq *sseq;
 	
-	sseq= MEM_callocN(sizeof(SpaceSeq), "initsequencer");
-	sseq->spacetype= SPACE_SEQ;
+	sseq = MEM_callocN(sizeof(SpaceSeq), "initsequencer");
+	sseq->spacetype = SPACE_SEQ;
 	sseq->chanshown = 0;
 	sseq->view = SEQ_VIEW_SEQUENCE;
 	sseq->mainb = SEQ_DRAW_IMG_IMBUF;
 	/* header */
-	ar= MEM_callocN(sizeof(ARegion), "header for sequencer");
+	ar = MEM_callocN(sizeof(ARegion), "header for sequencer");
 	
 	BLI_addtail(&sseq->regionbase, ar);
-	ar->regiontype= RGN_TYPE_HEADER;
-	ar->alignment= RGN_ALIGN_BOTTOM;
+	ar->regiontype = RGN_TYPE_HEADER;
+	ar->alignment = RGN_ALIGN_BOTTOM;
 	
 	/* buttons/list view */
-	ar= MEM_callocN(sizeof(ARegion), "buttons for sequencer");
+	ar = MEM_callocN(sizeof(ARegion), "buttons for sequencer");
 	
 	BLI_addtail(&sseq->regionbase, ar);
-	ar->regiontype= RGN_TYPE_UI;
-	ar->alignment= RGN_ALIGN_RIGHT;
+	ar->regiontype = RGN_TYPE_UI;
+	ar->alignment = RGN_ALIGN_RIGHT;
 	ar->flag = RGN_FLAG_HIDDEN;
 	
 	/* preview area */
 	/* NOTE: if you change values here, also change them in sequencer_init_preview_region */
-	ar= MEM_callocN(sizeof(ARegion), "preview area for sequencer");
+	ar = MEM_callocN(sizeof(ARegion), "preview area for sequencer");
 	BLI_addtail(&sseq->regionbase, ar);
-	ar->regiontype= RGN_TYPE_PREVIEW;
-	ar->alignment= RGN_ALIGN_TOP;
+	ar->regiontype = RGN_TYPE_PREVIEW;
+	ar->alignment = RGN_ALIGN_TOP;
 	ar->flag |= RGN_FLAG_HIDDEN;
 	/* for now, aspect ratio should be maintained, and zoom is clamped within sane default limits */
-	ar->v2d.keepzoom= V2D_KEEPASPECT | V2D_KEEPZOOM;
-	ar->v2d.minzoom= 0.00001f;
-	ar->v2d.maxzoom= 100000.0f;
-	ar->v2d.tot.xmin= -960.0f; /* 1920 width centered */
-	ar->v2d.tot.ymin= -540.0f; /* 1080 height centered */
-	ar->v2d.tot.xmax= 960.0f;
-	ar->v2d.tot.ymax= 540.0f;
-	ar->v2d.min[0]= 0.0f;
-	ar->v2d.min[1]= 0.0f;
-	ar->v2d.max[0]= 12000.0f;
-	ar->v2d.max[1]= 12000.0f;
-	ar->v2d.cur= ar->v2d.tot;
-	ar->v2d.align= V2D_ALIGN_FREE; 
-	ar->v2d.keeptot= V2D_KEEPTOT_FREE;
+	ar->v2d.keepzoom = V2D_KEEPASPECT | V2D_KEEPZOOM;
+	ar->v2d.minzoom = 0.00001f;
+	ar->v2d.maxzoom = 100000.0f;
+	ar->v2d.tot.xmin = -960.0f; /* 1920 width centered */
+	ar->v2d.tot.ymin = -540.0f; /* 1080 height centered */
+	ar->v2d.tot.xmax = 960.0f;
+	ar->v2d.tot.ymax = 540.0f;
+	ar->v2d.min[0] = 0.0f;
+	ar->v2d.min[1] = 0.0f;
+	ar->v2d.max[0] = 12000.0f;
+	ar->v2d.max[1] = 12000.0f;
+	ar->v2d.cur = ar->v2d.tot;
+	ar->v2d.align = V2D_ALIGN_FREE;
+	ar->v2d.keeptot = V2D_KEEPTOT_FREE;
 
 
 	/* main area */
-	ar= MEM_callocN(sizeof(ARegion), "main area for sequencer");
+	ar = MEM_callocN(sizeof(ARegion), "main area for sequencer");
 	
 	BLI_addtail(&sseq->regionbase, ar);
-	ar->regiontype= RGN_TYPE_WINDOW;
+	ar->regiontype = RGN_TYPE_WINDOW;
 	
 	
 	/* seq space goes from (0,8) to (0, efra) */
 	
-	ar->v2d.tot.xmin= 0.0f;
-	ar->v2d.tot.ymin= 0.0f;
-	ar->v2d.tot.xmax= scene->r.efra;
-	ar->v2d.tot.ymax= 8.0f;
+	ar->v2d.tot.xmin = 0.0f;
+	ar->v2d.tot.ymin = 0.0f;
+	ar->v2d.tot.xmax = scene->r.efra;
+	ar->v2d.tot.ymax = 8.0f;
 	
-	ar->v2d.cur= ar->v2d.tot;
+	ar->v2d.cur = ar->v2d.tot;
 	
-	ar->v2d.min[0]= 10.0f;
-	ar->v2d.min[1]= 0.5f;
+	ar->v2d.min[0] = 10.0f;
+	ar->v2d.min[1] = 0.5f;
 	
-	ar->v2d.max[0]= MAXFRAMEF;
-	ar->v2d.max[1]= MAXSEQ;
+	ar->v2d.max[0] = MAXFRAMEF;
+	ar->v2d.max[1] = MAXSEQ;
 	
-	ar->v2d.minzoom= 0.01f;
-	ar->v2d.maxzoom= 100.0f;
-	
-	ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
-	ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL);
-	ar->v2d.keepzoom= 0;
-	ar->v2d.keeptot= 0;
-	ar->v2d.align= V2D_ALIGN_NO_NEG_Y;
+	ar->v2d.minzoom = 0.01f;
+	ar->v2d.maxzoom = 100.0f;
+
+	ar->v2d.scroll |= (V2D_SCROLL_BOTTOM | V2D_SCROLL_SCALE_HORIZONTAL);
+	ar->v2d.scroll |= (V2D_SCROLL_LEFT | V2D_SCROLL_SCALE_VERTICAL);
+	ar->v2d.keepzoom = 0;
+	ar->v2d.keeptot = 0;
+	ar->v2d.align = V2D_ALIGN_NO_NEG_Y;
 
 	return (SpaceLink *)sseq;
 }
@@ -186,7 +186,7 @@ static void sequencer_free(SpaceLink *UNUSED(sl))
 {	
 //	SpaceSeq *sseq= (SpaceSequencer*) sl;
 	
-// XXX	if(sseq->gpd) free_gpencil_data(sseq->gpd);
+// XXX	if (sseq->gpd) free_gpencil_data(sseq->gpd);
 
 }
 
@@ -199,81 +199,81 @@ static void sequencer_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(s
 
 static void sequencer_refresh(const bContext *C, ScrArea *sa)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
-	wmWindow *window= CTX_wm_window(C);
-	SpaceSeq *sseq= (SpaceSeq *)sa->spacedata.first;
-	ARegion *ar_main= sequencer_find_region(sa, RGN_TYPE_WINDOW);
-	ARegion *ar_preview= sequencer_find_region(sa, RGN_TYPE_PREVIEW);
-	int view_changed= 0;
+	wmWindowManager *wm = CTX_wm_manager(C);
+	wmWindow *window = CTX_wm_window(C);
+	SpaceSeq *sseq = (SpaceSeq *)sa->spacedata.first;
+	ARegion *ar_main = sequencer_find_region(sa, RGN_TYPE_WINDOW);
+	ARegion *ar_preview = sequencer_find_region(sa, RGN_TYPE_PREVIEW);
+	int view_changed = 0;
 
 	switch (sseq->view) {
 		case SEQ_VIEW_SEQUENCE:
 			if (ar_main && (ar_main->flag & RGN_FLAG_HIDDEN)) {
 				ar_main->flag &= ~RGN_FLAG_HIDDEN;
 				ar_main->v2d.flag &= ~V2D_IS_INITIALISED;
-				view_changed= 1;
+				view_changed = 1;
 			}
 			if (ar_preview && !(ar_preview->flag & RGN_FLAG_HIDDEN)) {
 				ar_preview->flag |= RGN_FLAG_HIDDEN;
 				ar_preview->v2d.flag &= ~V2D_IS_INITIALISED;
-				WM_event_remove_handlers((bContext*)C, &ar_preview->handlers);
-				view_changed= 1;
+				WM_event_remove_handlers((bContext *)C, &ar_preview->handlers);
+				view_changed = 1;
 			}
 			if (ar_main && ar_main->alignment != RGN_ALIGN_NONE) {
-				ar_main->alignment= RGN_ALIGN_NONE;
-				view_changed= 1;
+				ar_main->alignment = RGN_ALIGN_NONE;
+				view_changed = 1;
 			}
 			if (ar_preview && ar_preview->alignment != RGN_ALIGN_NONE) {
-				ar_preview->alignment= RGN_ALIGN_NONE;
-				view_changed= 1;
+				ar_preview->alignment = RGN_ALIGN_NONE;
+				view_changed = 1;
 			}
 			break;
 		case SEQ_VIEW_PREVIEW:
 			if (ar_main && !(ar_main->flag & RGN_FLAG_HIDDEN)) {
 				ar_main->flag |= RGN_FLAG_HIDDEN;
 				ar_main->v2d.flag &= ~V2D_IS_INITIALISED;
-				WM_event_remove_handlers((bContext*)C, &ar_main->handlers);
-				view_changed= 1;
+				WM_event_remove_handlers((bContext *)C, &ar_main->handlers);
+				view_changed = 1;
 			}
 			if (ar_preview && (ar_preview->flag & RGN_FLAG_HIDDEN)) {
 				ar_preview->flag &= ~RGN_FLAG_HIDDEN;
 				ar_preview->v2d.flag &= ~V2D_IS_INITIALISED;
 				ar_preview->v2d.cur = ar_preview->v2d.tot;
-				view_changed= 1;
+				view_changed = 1;
 			}
 			if (ar_main && ar_main->alignment != RGN_ALIGN_NONE) {
-				ar_main->alignment= RGN_ALIGN_NONE;
-				view_changed= 1;
+				ar_main->alignment = RGN_ALIGN_NONE;
+				view_changed = 1;
 			}
 			if (ar_preview && ar_preview->alignment != RGN_ALIGN_NONE) {
-				ar_preview->alignment= RGN_ALIGN_NONE;
-				view_changed= 1;
+				ar_preview->alignment = RGN_ALIGN_NONE;
+				view_changed = 1;
 			}
 			break;
 		case SEQ_VIEW_SEQUENCE_PREVIEW:
 			if (ar_main && (ar_main->flag & RGN_FLAG_HIDDEN)) {
 				ar_main->flag &= ~RGN_FLAG_HIDDEN;
 				ar_main->v2d.flag &= ~V2D_IS_INITIALISED;
-				view_changed= 1;
+				view_changed = 1;
 			}
 			if (ar_preview && (ar_preview->flag & RGN_FLAG_HIDDEN)) {
 				ar_preview->flag &= ~RGN_FLAG_HIDDEN;
 				ar_preview->v2d.flag &= ~V2D_IS_INITIALISED;
 				ar_preview->v2d.cur = ar_preview->v2d.tot;
-				view_changed= 1;
+				view_changed = 1;
 			}
 			if (ar_main && ar_main->alignment != RGN_ALIGN_NONE) {
-				ar_main->alignment= RGN_ALIGN_NONE;
-				view_changed= 1;
+				ar_main->alignment = RGN_ALIGN_NONE;
+				view_changed = 1;
 			}
 			if (ar_preview && ar_preview->alignment != RGN_ALIGN_TOP) {
-				ar_preview->alignment= RGN_ALIGN_TOP;
-				view_changed= 1;
+				ar_preview->alignment = RGN_ALIGN_TOP;
+				view_changed = 1;
 			}
 			break;
 	}
 
-	if(view_changed) {
+	if (view_changed) {
 		ED_area_initialize(wm, window, sa);
 		ED_area_tag_redraw(sa);
 	}
@@ -281,7 +281,7 @@ static void sequencer_refresh(const bContext *C, ScrArea *sa)
 
 static SpaceLink *sequencer_duplicate(SpaceLink *sl)
 {
-	SpaceSeq *sseqn= MEM_dupallocN(sl);
+	SpaceSeq *sseqn = MEM_dupallocN(sl);
 	
 	/* clear or remove stuff from old */
 // XXX	sseq->gpd= gpencil_data_duplicate(sseq->gpd);
@@ -300,15 +300,15 @@ static void sequencer_main_area_init(wmWindowManager *wm, ARegion *ar)
 	
 	UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
 	
-	keymap= WM_keymap_find(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 	
 	/* own keymap */
-	keymap= WM_keymap_find(wm->defaultconf, "Sequencer", SPACE_SEQ, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Sequencer", SPACE_SEQ, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 	
 	/* add drop boxes */
-	lb= WM_dropboxmap_find("Sequencer", SPACE_SEQ, RGN_TYPE_WINDOW);
+	lb = WM_dropboxmap_find("Sequencer", SPACE_SEQ, RGN_TYPE_WINDOW);
 	
 	WM_event_add_dropbox_handler(&ar->handlers, lb);
 	
@@ -326,24 +326,24 @@ static void sequencer_main_area_draw(const bContext *C, ARegion *ar)
 
 static int image_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
 {
-	if(drag->type==WM_DRAG_PATH)
-		if(ELEM(drag->icon, ICON_FILE_IMAGE, ICON_FILE_BLANK))	/* rule might not work? */
+	if (drag->type == WM_DRAG_PATH)
+		if (ELEM(drag->icon, ICON_FILE_IMAGE, ICON_FILE_BLANK)) /* rule might not work? */
 			return 1;
 	return 0;
 }
 
 static int movie_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
 {
-	if(drag->type==WM_DRAG_PATH)
-		if(ELEM3(drag->icon, 0, ICON_FILE_MOVIE, ICON_FILE_BLANK))	/* rule might not work? */
+	if (drag->type == WM_DRAG_PATH)
+		if (ELEM3(drag->icon, 0, ICON_FILE_MOVIE, ICON_FILE_BLANK)) /* rule might not work? */
 			return 1;
 	return 0;
 }
 
 static int sound_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
 {
-	if(drag->type==WM_DRAG_PATH)
-		if(ELEM(drag->icon, ICON_FILE_SOUND, ICON_FILE_BLANK))	/* rule might not work? */
+	if (drag->type == WM_DRAG_PATH)
+		if (ELEM(drag->icon, ICON_FILE_SOUND, ICON_FILE_BLANK)) /* rule might not work? */
 			return 1;
 	return 0;
 }
@@ -351,10 +351,10 @@ static int sound_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(ev
 static void sequencer_drop_copy(wmDrag *drag, wmDropBox *drop)
 {
 	/* copy drag path to properties */
-	if(RNA_struct_find_property(drop->ptr, "filepath"))
+	if (RNA_struct_find_property(drop->ptr, "filepath"))
 		RNA_string_set(drop->ptr, "filepath", drag->path);
 
-	if(RNA_struct_find_property(drop->ptr, "directory")) {
+	if (RNA_struct_find_property(drop->ptr, "directory")) {
 		PointerRNA itemptr;
 		char dir[FILE_MAX], file[FILE_MAX];
 
@@ -371,7 +371,7 @@ static void sequencer_drop_copy(wmDrag *drag, wmDropBox *drop)
 /* this region dropbox definition */
 static void sequencer_dropboxes(void)
 {
-	ListBase *lb= WM_dropboxmap_find("Sequencer", SPACE_SEQ, RGN_TYPE_WINDOW);
+	ListBase *lb = WM_dropboxmap_find("Sequencer", SPACE_SEQ, RGN_TYPE_WINDOW);
 	
 	WM_dropbox_add(lb, "SEQUENCER_OT_image_strip_add", image_drop_poll, sequencer_drop_copy);
 	WM_dropbox_add(lb, "SEQUENCER_OT_movie_strip_add", movie_drop_poll, sequencer_drop_copy);
@@ -394,9 +394,9 @@ static void sequencer_header_area_draw(const bContext *C, ARegion *ar)
 static void sequencer_main_area_listener(ARegion *ar, wmNotifier *wmn)
 {
 	/* context changes */
-	switch(wmn->category) {
+	switch (wmn->category) {
 		case NC_SCENE:
-			switch(wmn->data) {
+			switch (wmn->data) {
 				case ND_FRAME:
 				case ND_FRAME_RANGE:
 				case ND_MARKERS:
@@ -407,11 +407,11 @@ static void sequencer_main_area_listener(ARegion *ar, wmNotifier *wmn)
 			}
 			break;
 		case NC_SPACE:
-			if(wmn->data == ND_SPACE_SEQUENCER)
+			if (wmn->data == ND_SPACE_SEQUENCER)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_ID:
-			if(wmn->action == NA_RENAME)
+			if (wmn->action == NA_RENAME)
 				ED_region_tag_redraw(ar);
 			break;
 	}
@@ -424,34 +424,34 @@ static void sequencer_preview_area_init(wmWindowManager *wm, ARegion *ar)
 
 	UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
 	
-	keymap= WM_keymap_find(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "SequencerCommon", SPACE_SEQ, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 
 	/* own keymap */
-	keymap= WM_keymap_find(wm->defaultconf, "SequencerPreview", SPACE_SEQ, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "SequencerPreview", SPACE_SEQ, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
 static void sequencer_preview_area_draw(const bContext *C, ARegion *ar)
 {
-	ScrArea *sa= CTX_wm_area(C);
-	SpaceSeq *sseq= sa->spacedata.first;
-	Scene *scene= CTX_data_scene(C);
+	ScrArea *sa = CTX_wm_area(C);
+	SpaceSeq *sseq = sa->spacedata.first;
+	Scene *scene = CTX_data_scene(C);
 	
 	/* XXX temp fix for wrong setting in sseq->mainb */
 	if (sseq->mainb == SEQ_DRAW_SEQUENCE) sseq->mainb = SEQ_DRAW_IMG_IMBUF;
 
 	draw_image_seq(C, scene, ar, sseq, scene->r.cfra, 0);
 
-	if(scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW && sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
+	if (scene->ed && scene->ed->over_flag & SEQ_EDIT_OVERLAY_SHOW && sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
 		int over_cfra;
 
-		if(scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS)
-			over_cfra= scene->ed->over_cfra;
+		if (scene->ed->over_flag & SEQ_EDIT_OVERLAY_ABS)
+			over_cfra = scene->ed->over_cfra;
 		else
-			over_cfra= scene->r.cfra + scene->ed->over_ofs;
+			over_cfra = scene->r.cfra + scene->ed->over_ofs;
 
-		if(over_cfra != scene->r.cfra)
+		if (over_cfra != scene->r.cfra)
 			draw_image_seq(C, scene, ar, sseq, scene->r.cfra, over_cfra - scene->r.cfra);
 	}
 
@@ -460,9 +460,9 @@ static void sequencer_preview_area_draw(const bContext *C, ARegion *ar)
 static void sequencer_preview_area_listener(ARegion *ar, wmNotifier *wmn)
 {
 	/* context changes */
-	switch(wmn->category) {
+	switch (wmn->category) {
 		case NC_SCENE:
-			switch(wmn->data) {
+			switch (wmn->data) {
 				case ND_FRAME:
 				case ND_MARKERS:
 				case ND_SEQUENCER:
@@ -471,11 +471,11 @@ static void sequencer_preview_area_listener(ARegion *ar, wmNotifier *wmn)
 			}
 			break;
 		case NC_SPACE:
-			if(wmn->data == ND_SPACE_SEQUENCER)
+			if (wmn->data == ND_SPACE_SEQUENCER)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_ID:
-			switch(wmn->data) {
+			switch (wmn->data) {
 				case NA_RENAME:
 					ED_region_tag_redraw(ar);
 					break;
@@ -502,21 +502,21 @@ static void sequencer_buttons_area_draw(const bContext *C, ARegion *ar)
 static void sequencer_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
 {
 	/* context changes */
-	switch(wmn->category) {
+	switch (wmn->category) {
 		case NC_SCENE:
-		switch(wmn->data) {
-			case ND_FRAME:
-			case ND_SEQUENCER:
-				ED_region_tag_redraw(ar);
-				break;
-		}
-		break;
+			switch (wmn->data) {
+				case ND_FRAME:
+				case ND_SEQUENCER:
+					ED_region_tag_redraw(ar);
+					break;
+			}
+			break;
 		case NC_SPACE:
-			if(wmn->data == ND_SPACE_SEQUENCER)
+			if (wmn->data == ND_SPACE_SEQUENCER)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_ID:
-			if(wmn->action == NA_RENAME)
+			if (wmn->action == NA_RENAME)
 				ED_region_tag_redraw(ar);
 			break;
 	}
@@ -526,72 +526,68 @@ static void sequencer_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
 /* only called once, from space/spacetypes.c */
 void ED_spacetype_sequencer(void)
 {
-	SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype sequencer");
+	SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype sequencer");
 	ARegionType *art;
 	
-	st->spaceid= SPACE_SEQ;
+	st->spaceid = SPACE_SEQ;
 	strncpy(st->name, "Sequencer", BKE_ST_MAXNAME);
 	
-	st->new= sequencer_new;
-	st->free= sequencer_free;
-	st->init= sequencer_init;
-	st->duplicate= sequencer_duplicate;
-	st->operatortypes= sequencer_operatortypes;
-	st->keymap= sequencer_keymap;
-	st->dropboxes= sequencer_dropboxes;
-	st->refresh= sequencer_refresh;
+	st->new = sequencer_new;
+	st->free = sequencer_free;
+	st->init = sequencer_init;
+	st->duplicate = sequencer_duplicate;
+	st->operatortypes = sequencer_operatortypes;
+	st->keymap = sequencer_keymap;
+	st->dropboxes = sequencer_dropboxes;
+	st->refresh = sequencer_refresh;
 
 	/* regions: main window */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
+	art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
 	art->regionid = RGN_TYPE_WINDOW;
-	art->init= sequencer_main_area_init;
-	art->draw= sequencer_main_area_draw;
-	art->listener= sequencer_main_area_listener;
-	art->keymapflag= ED_KEYMAP_VIEW2D|ED_KEYMAP_MARKERS|ED_KEYMAP_FRAMES|ED_KEYMAP_ANIMATION;
+	art->init = sequencer_main_area_init;
+	art->draw = sequencer_main_area_draw;
+	art->listener = sequencer_main_area_listener;
+	art->keymapflag = ED_KEYMAP_VIEW2D | ED_KEYMAP_MARKERS | ED_KEYMAP_FRAMES | ED_KEYMAP_ANIMATION;
 
 	BLI_addhead(&st->regiontypes, art);
 
 	/* preview */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
+	art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
 	art->regionid = RGN_TYPE_PREVIEW;
 	art->prefsizey = 240; // XXX
-	art->init= sequencer_preview_area_init;
-	art->draw= sequencer_preview_area_draw;
-	art->listener= sequencer_preview_area_listener;
-	art->keymapflag= ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_ANIMATION;
+	art->init = sequencer_preview_area_init;
+	art->draw = sequencer_preview_area_draw;
+	art->listener = sequencer_preview_area_listener;
+	art->keymapflag = ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_ANIMATION;
 	BLI_addhead(&st->regiontypes, art);
 	
 	/* regions: listview/buttons */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
+	art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
 	art->regionid = RGN_TYPE_UI;
-	art->prefsizex= 220; // XXX
-	art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES;
-	art->listener= sequencer_buttons_area_listener;
-	art->init= sequencer_buttons_area_init;
-	art->draw= sequencer_buttons_area_draw;
+	art->prefsizex = 220; // XXX
+	art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES;
+	art->listener = sequencer_buttons_area_listener;
+	art->init = sequencer_buttons_area_init;
+	art->draw = sequencer_buttons_area_draw;
 	BLI_addhead(&st->regiontypes, art);
-	
-	/* Keep as python only for now
-	sequencer_buttons_register(art);
-	*/
 
 	/* regions: header */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
+	art = MEM_callocN(sizeof(ARegionType), "spacetype sequencer region");
 	art->regionid = RGN_TYPE_HEADER;
-	art->prefsizey= HEADERY;
-	art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
+	art->prefsizey = HEADERY;
+	art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER;
 	
-	art->init= sequencer_header_area_init;
-	art->draw= sequencer_header_area_draw;
-	art->listener= sequencer_main_area_listener;
+	art->init = sequencer_header_area_init;
+	art->draw = sequencer_header_area_draw;
+	art->listener = sequencer_main_area_listener;
 	
 	BLI_addhead(&st->regiontypes, art);
 	
 	BKE_spacetype_register(st);
 
 	/* set the sequencer callback when not in background mode */
-	if(G.background==0) {
-		sequencer_view3d_cb= ED_view3d_draw_offscreen_imbuf_simple;
+	if (G.background == 0) {
+		sequencer_view3d_cb = ED_view3d_draw_offscreen_imbuf_simple;
 	}
 }
 
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index 314afea..beccca5 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -60,7 +60,7 @@
 #include "RNA_access.h"
 
 
-#include "text_intern.h"	// own include
+#include "text_intern.h"    // own include
 
 /* ******************** default callbacks for text space ***************** */
 
@@ -69,25 +69,25 @@ static SpaceLink *text_new(const bContext *UNUSED(C))
 	ARegion *ar;
 	SpaceText *stext;
 	
-	stext= MEM_callocN(sizeof(SpaceText), "inittext");
-	stext->spacetype= SPACE_TEXT;
+	stext = MEM_callocN(sizeof(SpaceText), "inittext");
+	stext->spacetype = SPACE_TEXT;
 
-	stext->lheight= 12;
-	stext->tabnumber= 4;
-	stext->margin_column= 80;
+	stext->lheight = 12;
+	stext->tabnumber = 4;
+	stext->margin_column = 80;
 	
 	/* header */
-	ar= MEM_callocN(sizeof(ARegion), "header for text");
+	ar = MEM_callocN(sizeof(ARegion), "header for text");
 	
 	BLI_addtail(&stext->regionbase, ar);
-	ar->regiontype= RGN_TYPE_HEADER;
-	ar->alignment= RGN_ALIGN_BOTTOM;
+	ar->regiontype = RGN_TYPE_HEADER;
+	ar->alignment = RGN_ALIGN_BOTTOM;
 	
 	/* main area */
-	ar= MEM_callocN(sizeof(ARegion), "main area for text");
+	ar = MEM_callocN(sizeof(ARegion), "main area for text");
 	
 	BLI_addtail(&stext->regionbase, ar);
-	ar->regiontype= RGN_TYPE_WINDOW;
+	ar->regiontype = RGN_TYPE_WINDOW;
 	
 	return (SpaceLink *)stext;
 }
@@ -95,9 +95,9 @@ static SpaceLink *text_new(const bContext *UNUSED(C))
 /* not spacelink itself */
 static void text_free(SpaceLink *sl)
 {	
-	SpaceText *stext= (SpaceText*) sl;
+	SpaceText *stext = (SpaceText *) sl;
 	
-	stext->text= NULL;
+	stext->text = NULL;
 	text_free_caches(stext);
 }
 
@@ -110,55 +110,55 @@ static void text_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
 
 static SpaceLink *text_duplicate(SpaceLink *sl)
 {
-	SpaceText *stextn= MEM_dupallocN(sl);
+	SpaceText *stextn = MEM_dupallocN(sl);
 
 	/* clear or remove stuff from old */
 
-	stextn->drawcache= NULL; /* space need it's own cache */
+	stextn->drawcache = NULL; /* space need it's own cache */
 
 	return (SpaceLink *)stextn;
 }
 
 static void text_listener(ScrArea *sa, wmNotifier *wmn)
 {
-	SpaceText *st= sa->spacedata.first;
+	SpaceText *st = sa->spacedata.first;
 
 	/* context changes */
-	switch(wmn->category) {
+	switch (wmn->category) {
 		case NC_TEXT:
 			/* check if active text was changed, no need to redraw if text isn't active
-			   reference==NULL means text was unlinked, should update anyway for this
-			   case -- no way to know was text active before unlinking or not */
-			if(wmn->reference && wmn->reference != st->text)
+			 * reference==NULL means text was unlinked, should update anyway for this
+			 * case -- no way to know was text active before unlinking or not */
+			if (wmn->reference && wmn->reference != st->text)
 				break;
 
-			switch(wmn->data) {
+			switch (wmn->data) {
 				case ND_DISPLAY:
 					ED_area_tag_redraw(sa);
 					break;
 				case ND_CURSOR:
-					if(st->text && st->text == wmn->reference)
+					if (st->text && st->text == wmn->reference)
 						text_scroll_to_cursor(st, sa);
 
 					ED_area_tag_redraw(sa);
 					break;
 			}
 
-			switch(wmn->action) {
+			switch (wmn->action) {
 				case NA_EDITED:
-					if(st->text) {
+					if (st->text) {
 						text_drawcache_tag_update(st, 1);
 						text_update_edited(st->text);
 					}
 
 					ED_area_tag_redraw(sa);
-					/* no break -- fall down to tag redraw */
+				/* no break -- fall down to tag redraw */
 				case NA_ADDED:
 				case NA_REMOVED:
 					ED_area_tag_redraw(sa);
 					break;
 				case NA_SELECTED:
-					if(st->text && st->text == wmn->reference)
+					if (st->text && st->text == wmn->reference)
 						text_scroll_to_cursor(st, sa);
 
 					break;
@@ -166,7 +166,7 @@ static void text_listener(ScrArea *sa, wmNotifier *wmn)
 
 			break;
 		case NC_SPACE:
-			if(wmn->data == ND_SPACE_TEXT)
+			if (wmn->data == ND_SPACE_TEXT)
 				ED_area_tag_redraw(sa);
 			break;
 	}
@@ -235,7 +235,7 @@ static void text_keymap(struct wmKeyConfig *keyconf)
 	wmKeyMap *keymap;
 	wmKeyMapItem *kmi;
 	
-	keymap= WM_keymap_find(keyconf, "Text", SPACE_TEXT, 0);
+	keymap = WM_keymap_find(keyconf, "Text", SPACE_TEXT, 0);
 	
 	#ifdef __APPLE__
 	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", LEFTARROWKEY, KM_PRESS, KM_OSKEY, 0)->ptr, "type", LINE_BEGIN);
@@ -245,17 +245,17 @@ static void text_keymap(struct wmKeyConfig *keyconf)
 	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", UPARROWKEY, KM_PRESS, KM_OSKEY, 0)->ptr, "type", FILE_TOP);
 	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", DOWNARROWKEY, KM_PRESS, KM_OSKEY, 0)->ptr, "type", FILE_BOTTOM);
 	
-	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", LEFTARROWKEY, KM_PRESS, KM_SHIFT|KM_OSKEY, 0)->ptr, "type", LINE_BEGIN);
-	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", RIGHTARROWKEY, KM_PRESS, KM_SHIFT|KM_OSKEY, 0)->ptr, "type", LINE_END);
-	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", LEFTARROWKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0)->ptr, "type", PREV_WORD);
-	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", RIGHTARROWKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0)->ptr, "type", NEXT_WORD);
-	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", UPARROWKEY, KM_PRESS, KM_SHIFT|KM_OSKEY, 0)->ptr, "type", FILE_TOP);
-	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", DOWNARROWKEY, KM_PRESS, KM_SHIFT|KM_OSKEY, 0)->ptr, "type", FILE_BOTTOM);
+	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", LEFTARROWKEY, KM_PRESS, KM_SHIFT | KM_OSKEY, 0)->ptr, "type", LINE_BEGIN);
+	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", RIGHTARROWKEY, KM_PRESS, KM_SHIFT | KM_OSKEY, 0)->ptr, "type", LINE_END);
+	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", LEFTARROWKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0)->ptr, "type", PREV_WORD);
+	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", RIGHTARROWKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0)->ptr, "type", NEXT_WORD);
+	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", UPARROWKEY, KM_PRESS, KM_SHIFT | KM_OSKEY, 0)->ptr, "type", FILE_TOP);
+	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", DOWNARROWKEY, KM_PRESS, KM_SHIFT | KM_OSKEY, 0)->ptr, "type", FILE_BOTTOM);
 	
 	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_delete", BACKSPACEKEY, KM_PRESS, KM_ALT, 0)->ptr, "type", DEL_PREV_WORD);
 	
-	WM_keymap_add_item(keymap, "TEXT_OT_save", SKEY, KM_PRESS, KM_ALT|KM_OSKEY, 0);
-	WM_keymap_add_item(keymap, "TEXT_OT_save_as", SKEY, KM_PRESS, KM_ALT|KM_SHIFT|KM_OSKEY, 0);
+	WM_keymap_add_item(keymap, "TEXT_OT_save", SKEY, KM_PRESS, KM_ALT | KM_OSKEY, 0);
+	WM_keymap_add_item(keymap, "TEXT_OT_save_as", SKEY, KM_PRESS, KM_ALT | KM_SHIFT | KM_OSKEY, 0);
 	WM_keymap_add_item(keymap, "TEXT_OT_cut", XKEY, KM_PRESS, KM_OSKEY, 0);
 	WM_keymap_add_item(keymap, "TEXT_OT_copy", CKEY, KM_PRESS, KM_OSKEY, 0); 
 	WM_keymap_add_item(keymap, "TEXT_OT_paste", VKEY, KM_PRESS, KM_OSKEY, 0);
@@ -263,7 +263,7 @@ static void text_keymap(struct wmKeyConfig *keyconf)
 	WM_keymap_add_item(keymap, "TEXT_OT_find_set_selected", EKEY, KM_PRESS, KM_OSKEY, 0);
 	WM_keymap_add_item(keymap, "TEXT_OT_find", GKEY, KM_PRESS, KM_OSKEY, 0);
 	WM_keymap_add_item(keymap, "TEXT_OT_select_all", AKEY, KM_PRESS, KM_OSKEY, 0);
-	WM_keymap_add_item(keymap, "TEXT_OT_select_line", AKEY, KM_PRESS, KM_SHIFT|KM_OSKEY, 0);
+	WM_keymap_add_item(keymap, "TEXT_OT_select_line", AKEY, KM_PRESS, KM_SHIFT | KM_OSKEY, 0);
 	#endif
 	
 	kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_int", WHEELUPMOUSE, KM_PRESS, KM_CTRL, 0);
@@ -286,7 +286,7 @@ static void text_keymap(struct wmKeyConfig *keyconf)
 	WM_keymap_add_item(keymap, "TEXT_OT_open", OKEY, KM_PRESS, KM_ALT, 0);
 	WM_keymap_add_item(keymap, "TEXT_OT_reload", RKEY, KM_PRESS, KM_ALT, 0);
 	WM_keymap_add_item(keymap, "TEXT_OT_save", SKEY, KM_PRESS, KM_ALT, 0);
-	WM_keymap_add_item(keymap, "TEXT_OT_save_as", SKEY, KM_PRESS, KM_ALT|KM_SHIFT|KM_CTRL, 0);
+	WM_keymap_add_item(keymap, "TEXT_OT_save_as", SKEY, KM_PRESS, KM_ALT | KM_SHIFT | KM_CTRL, 0);
 
 	WM_keymap_add_item(keymap, "TEXT_OT_run_script", PKEY, KM_PRESS, KM_ALT, 0);
 	
@@ -298,7 +298,7 @@ static void text_keymap(struct wmKeyConfig *keyconf)
 	WM_keymap_add_item(keymap, "TEXT_OT_copy", INSERTKEY, KM_PRESS, KM_CTRL, 0);
 	WM_keymap_add_item(keymap, "TEXT_OT_paste", INSERTKEY, KM_PRESS, KM_SHIFT, 0);
 
-	if(U.uiflag & USER_MMB_PASTE) { // XXX not dynamic
+	if (U.uiflag & USER_MMB_PASTE) { // XXX not dynamic
 		kmi = WM_keymap_add_item(keymap, "TEXT_OT_paste", MIDDLEMOUSE, KM_PRESS, 0, 0);
 		RNA_boolean_set(kmi->ptr, "selection", TRUE);
 	}
@@ -315,19 +315,19 @@ static void text_keymap(struct wmKeyConfig *keyconf)
 	RNA_boolean_set(kmi->ptr, "split_lines", TRUE);
 
 	WM_keymap_add_item(keymap, "TEXT_OT_select_all", AKEY, KM_PRESS, KM_CTRL, 0);
-	WM_keymap_add_item(keymap, "TEXT_OT_select_line", AKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+	WM_keymap_add_item(keymap, "TEXT_OT_select_line", AKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
 	WM_keymap_add_item(keymap, "TEXT_OT_select_word", LEFTMOUSE, KM_DBL_CLICK, 0, 0);
 	
 
 	WM_keymap_add_item(keymap, "TEXT_OT_indent", TABKEY, KM_PRESS, 0, 0);
 	WM_keymap_add_item(keymap, "TEXT_OT_unindent", TABKEY, KM_PRESS, KM_SHIFT, 0);
-	WM_keymap_add_item(keymap, "TEXT_OT_uncomment", DKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+	WM_keymap_add_item(keymap, "TEXT_OT_uncomment", DKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
 
 	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", HOMEKEY, KM_PRESS, 0, 0)->ptr, "type", LINE_BEGIN);
 	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", ENDKEY, KM_PRESS, 0, 0)->ptr, "type", LINE_END);
 	
 	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", EKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", LINE_END);
-	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", EKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "type", LINE_END);
+	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", EKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0)->ptr, "type", LINE_END);
 	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", LEFTARROWKEY, KM_PRESS, 0, 0)->ptr, "type", PREV_CHAR);
 	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", RIGHTARROWKEY, KM_PRESS, 0, 0)->ptr, "type", NEXT_CHAR);
 	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move", LEFTARROWKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", PREV_WORD);
@@ -343,14 +343,14 @@ static void text_keymap(struct wmKeyConfig *keyconf)
 	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", ENDKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", LINE_END);
 	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", LEFTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", PREV_CHAR);
 	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", RIGHTARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", NEXT_CHAR);
-	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", LEFTARROWKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0)->ptr, "type", PREV_WORD);
-	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", RIGHTARROWKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0)->ptr, "type", NEXT_WORD);
+	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", LEFTARROWKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0)->ptr, "type", PREV_WORD);
+	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", RIGHTARROWKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0)->ptr, "type", NEXT_WORD);
 	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", UPARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", PREV_LINE);
 	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", DOWNARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", NEXT_LINE);
 	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", PAGEUPKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", PREV_PAGE);
 	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", PAGEDOWNKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", NEXT_PAGE);
-	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", HOMEKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0)->ptr, "type", FILE_TOP);
-	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", ENDKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0)->ptr, "type", FILE_BOTTOM);
+	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", HOMEKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0)->ptr, "type", FILE_TOP);
+	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_select", ENDKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0)->ptr, "type", FILE_BOTTOM);
 
 	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_delete", DELKEY, KM_PRESS, 0, 0)->ptr, "type", DEL_NEXT_CHAR);
 	RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_delete", DKEY, KM_PRESS, KM_CTRL, 0)->ptr, "type", DEL_NEXT_CHAR);
@@ -386,13 +386,13 @@ const char *text_context_dir[] = {"edit_text", NULL};
 
 static int text_context(const bContext *C, const char *member, bContextDataResult *result)
 {
-	SpaceText *st= CTX_wm_space_text(C);
+	SpaceText *st = CTX_wm_space_text(C);
 
-	if(CTX_data_dir(member)) {
+	if (CTX_data_dir(member)) {
 		CTX_data_dir_set(result, text_context_dir);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "edit_text")) {
+	else if (CTX_data_equals(member, "edit_text")) {
 		CTX_data_id_pointer_set(result, &st->text->id);
 		return 1;
 	}
@@ -411,7 +411,7 @@ static void text_main_area_init(wmWindowManager *wm, ARegion *ar)
 	UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
 	
 	/* own keymap */
-	keymap= WM_keymap_find(wm->defaultconf, "Text", SPACE_TEXT, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Text", SPACE_TEXT, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 	
 	/* add drop boxes */
@@ -423,7 +423,7 @@ static void text_main_area_init(wmWindowManager *wm, ARegion *ar)
 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);
+	SpaceText *st = CTX_wm_space_text(C);
 	//View2D *v2d= &ar->v2d;
 	
 	/* clear and setup matrix */
@@ -452,8 +452,8 @@ static void text_cursor(wmWindow *win, ScrArea *UNUSED(sa), ARegion *UNUSED(ar))
 
 static int text_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
 {
-	if(drag->type==WM_DRAG_PATH)
-		if(ELEM(drag->icon, ICON_FILE_SCRIPT, ICON_FILE_BLANK))	/* rule might not work? */
+	if (drag->type == WM_DRAG_PATH)
+		if (ELEM(drag->icon, ICON_FILE_SCRIPT, ICON_FILE_BLANK))    /* rule might not work? */
 			return 1;
 	return 0;
 }
@@ -467,7 +467,7 @@ static void text_drop_copy(wmDrag *drag, wmDropBox *drop)
 /* this region dropbox definition */
 static void text_dropboxes(void)
 {
-	ListBase *lb= WM_dropboxmap_find("Text", SPACE_TEXT, RGN_TYPE_WINDOW);
+	ListBase *lb = WM_dropboxmap_find("Text", SPACE_TEXT, RGN_TYPE_WINDOW);
 	
 	WM_dropbox_add(lb, "TEXT_OT_open", text_drop_poll, text_drop_copy);
 
@@ -507,49 +507,49 @@ static void text_properties_area_draw(const bContext *C, ARegion *ar)
 /* only called once, from space/spacetypes.c */
 void ED_spacetype_text(void)
 {
-	SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype text");
+	SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype text");
 	ARegionType *art;
 	
-	st->spaceid= SPACE_TEXT;
+	st->spaceid = SPACE_TEXT;
 	strncpy(st->name, "Text", BKE_ST_MAXNAME);
 	
-	st->new= text_new;
-	st->free= text_free;
-	st->init= text_init;
-	st->duplicate= text_duplicate;
-	st->operatortypes= text_operatortypes;
-	st->keymap= text_keymap;
-	st->listener= text_listener;
-	st->context= text_context;
+	st->new = text_new;
+	st->free = text_free;
+	st->init = text_init;
+	st->duplicate = text_duplicate;
+	st->operatortypes = text_operatortypes;
+	st->keymap = text_keymap;
+	st->listener = text_listener;
+	st->context = text_context;
 	st->dropboxes = text_dropboxes;
 	
 	/* regions: main window */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype text region");
+	art = MEM_callocN(sizeof(ARegionType), "spacetype text region");
 	art->regionid = RGN_TYPE_WINDOW;
-	art->init= text_main_area_init;
-	art->draw= text_main_area_draw;
-	art->cursor= text_cursor;
+	art->init = text_main_area_init;
+	art->draw = text_main_area_draw;
+	art->cursor = text_cursor;
 
 	BLI_addhead(&st->regiontypes, art);
 	
 	/* regions: properties */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype text region");
+	art = MEM_callocN(sizeof(ARegionType), "spacetype text region");
 	art->regionid = RGN_TYPE_UI;
-	art->prefsizex= UI_COMPACT_PANEL_WIDTH;
-	art->keymapflag= ED_KEYMAP_UI;
+	art->prefsizex = UI_COMPACT_PANEL_WIDTH;
+	art->keymapflag = ED_KEYMAP_UI;
 	
-	art->init= text_properties_area_init;
-	art->draw= text_properties_area_draw;
+	art->init = text_properties_area_init;
+	art->draw = text_properties_area_draw;
 	BLI_addhead(&st->regiontypes, art);
 
 	/* regions: header */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype text region");
+	art = MEM_callocN(sizeof(ARegionType), "spacetype text region");
 	art->regionid = RGN_TYPE_HEADER;
-	art->prefsizey= HEADERY;
-	art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_HEADER;
+	art->prefsizey = HEADERY;
+	art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER;
 	
-	art->init= text_header_area_init;
-	art->draw= text_header_area_draw;
+	art->init = text_header_area_init;
+	art->draw = text_header_area_draw;
 
 	BLI_addhead(&st->regiontypes, art);
 
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 8a78f23..84f960e 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -83,8 +83,8 @@ static int text_font_draw(SpaceText *UNUSED(st), int x, int y, const char *str)
 static int text_font_draw_character(SpaceText *st, int x, int y, char c)
 {
 	char str[2];
-	str[0]= c;
-	str[1]= '\0';
+	str[0] = c;
+	str[1] = '\0';
 
 	BLF_position(mono, x, y, 0);
 	BLF_draw(mono, str, 1);
@@ -94,10 +94,10 @@ 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];
+	char str[BLI_UTF8_MAX + 1];
 	size_t len = BLI_str_utf8_size(c);
 	memcpy(str, c, len);
-	str[len]= '\0';
+	str[len] = '\0';
 
 	BLF_position(mono, x, y, 0);
 	BLF_draw(mono, str, len);
@@ -111,32 +111,32 @@ static void flatten_string_append(FlattenString *fs, const char *c, int accum, i
 {
 	int i;
 	
-	if(fs->pos+len > fs->len) {
+	if (fs->pos + len > fs->len) {
 		char *nbuf; int *naccum;
-		fs->len*= 2;
+		fs->len *= 2;
 
-		nbuf= MEM_callocN(sizeof(*fs->buf)*fs->len, "fs->buf");
-		naccum= MEM_callocN(sizeof(*fs->accum)*fs->len, "fs->accum");
+		nbuf = MEM_callocN(sizeof(*fs->buf) * fs->len, "fs->buf");
+		naccum = MEM_callocN(sizeof(*fs->accum) * fs->len, "fs->accum");
 
 		memcpy(nbuf, fs->buf, fs->pos * sizeof(*fs->buf));
 		memcpy(naccum, fs->accum, fs->pos * sizeof(*fs->accum));
 		
-		if(fs->buf != fs->fixedbuf) {
+		if (fs->buf != fs->fixedbuf) {
 			MEM_freeN(fs->buf);
 			MEM_freeN(fs->accum);
 		}
 		
-		fs->buf= nbuf;
-		fs->accum= naccum;
+		fs->buf = nbuf;
+		fs->accum = naccum;
 	}
 	
 	for (i = 0; i < len; i++)
 	{
-		fs->buf[fs->pos+i]= c[i];
-		fs->accum[fs->pos+i]= accum;
+		fs->buf[fs->pos + i] = c[i];
+		fs->accum[fs->pos + i] = accum;
 	}
 
-	fs->pos+= len;
+	fs->pos += len;
 }
 
 int flatten_string(SpaceText *st, FlattenString *fs, const char *in)
@@ -144,22 +144,22 @@ int flatten_string(SpaceText *st, FlattenString *fs, const char *in)
 	int r, i, total = 0;
 
 	memset(fs, 0, sizeof(FlattenString));
-	fs->buf= fs->fixedbuf;
-	fs->accum= fs->fixedaccum;
+	fs->buf = fs->fixedbuf;
+	fs->accum = fs->fixedaccum;
 	fs->len = sizeof(fs->fixedbuf);
 
-	for(r = 0, i = 0; *in; r++) {
-		if(*in=='\t') {
-			i= st->tabnumber - (total%st->tabnumber);
-			total+= i;
+	for (r = 0, i = 0; *in; r++) {
+		if (*in == '\t') {
+			i = st->tabnumber - (total % st->tabnumber);
+			total += i;
 			
-			while(i--)
+			while (i--)
 				flatten_string_append(fs, " ", r, 1);
 			
 			in++;
 		}
 		else {
-			size_t len= BLI_str_utf8_size(in);
+			size_t len = BLI_str_utf8_size(in);
 			flatten_string_append(fs, in, r, len);
 			in += len;
 			total++;
@@ -173,78 +173,85 @@ int flatten_string(SpaceText *st, FlattenString *fs, const char *in)
 
 void flatten_string_free(FlattenString *fs)
 {
-	if(fs->buf != fs->fixedbuf)
+	if (fs->buf != fs->fixedbuf)
 		MEM_freeN(fs->buf);
-	if(fs->accum != fs->fixedaccum)
+	if (fs->accum != fs->fixedaccum)
 		MEM_freeN(fs->accum);
 }
 
 /* Checks the specified source string for a Python built-in function name. This
- name must start at the beginning of the source string and must be followed by
- a non-identifier (see text_check_identifier(char)) or null character.
- 
- If a built-in function is found, the length of the matching name is returned.
- Otherwise, -1 is returned. */
+ * name must start at the beginning of the source string and must be followed by
+ * a non-identifier (see text_check_identifier(char)) or null character.
+ * 
+ * If a built-in function is found, the length of the matching name is returned.
+ * Otherwise, -1 is returned.
+ *
+ * See:
+ * http://docs.python.org/py3k/reference/lexical_analysis.html#keywords
+ */
 
 static int find_builtinfunc(char *string)
 {
 	int a, i;
-	char builtinfuncs[][9] = {"and", "as", "assert", "break", "class", "continue", "def",
-								"del", "elif", "else", "except", "exec", "finally",
-								"for", "from", "global", "if", "import", "in",
-								"is", "lambda", "not", "or", "pass", "print",
-								"raise", "return", "try", "while", "yield", "with"};
-
-	for(a=0; a < sizeof(builtinfuncs)/sizeof(builtinfuncs[0]); a++) {
+	const char *builtinfuncs[] = {
+		/* "False", "None", "True", */ /* see find_bool() */
+		"and", "as", "assert", "break",
+		"class", "continue", "def", "del", "elif", "else", "except",
+		"finally", "for", "from", "global", "if", "import", "in",
+		"is", "lambda", "nonlocal", "not", "or", "pass", "raise",
+		"return", "try", "while", "with", "yield",
+	};
+
+	for (a = 0; a < sizeof(builtinfuncs) / sizeof(builtinfuncs[0]); a++) {
 		i = 0;
-		while(1) {
+		while (1) {
 			/* If we hit the end of a keyword... (eg. "def") */
-			if(builtinfuncs[a][i]=='\0') {
+			if (builtinfuncs[a][i] == '\0') {
 				/* If we still have identifier chars in the source (eg. "definate") */
-				if(text_check_identifier(string[i]))
-					i = -1; /* No match */
+				if (text_check_identifier(string[i]))
+					i = -1;  /* No match */
 				break; /* Next keyword if no match, otherwise we're done */
 				
-			/* If chars mismatch, move on to next keyword */
+				/* If chars mismatch, move on to next keyword */
 			}
-			else if(string[i]!=builtinfuncs[a][i]) {
+			else if (string[i] != builtinfuncs[a][i]) {
 				i = -1;
 				break; /* Break inner loop, start next keyword */
 			}
 			i++;
 		}
-		if(i>0) break; /* If we have a match, we're done */
+		if (i > 0) break;  /* If we have a match, we're done */
 	}
 	return i;
 }
 
 /* Checks the specified source string for a Python special name. This name must
- start at the beginning of the source string and must be followed by a non-
- identifier (see text_check_identifier(char)) or null character.
- 
- If a special name is found, the length of the matching name is returned.
- Otherwise, -1 is returned. */
+ * start at the beginning of the source string and must be followed by a non-
+ * identifier (see text_check_identifier(char)) or null character.
+ * 
+ * If a special name is found, the length of the matching name is returned.
+ * Otherwise, -1 is returned. */
 
 static int find_specialvar(char *string) 
 {
 	int i = 0;
 	/* Check for "def" */
-	if(string[0]=='d' && string[1]=='e' && string[2]=='f')
+	if (string[0] == 'd' && string[1] == 'e' && string[2] == 'f')
 		i = 3;
 	/* Check for "class" */
-	else if(string[0]=='c' && string[1]=='l' && string[2]=='a' && string[3]=='s' && string[4]=='s')
+	else if (string[0] == 'c' && string[1] == 'l' && string[2] == 'a' && string[3] == 's' && string[4] == 's')
 		i = 5;
 	/* If next source char is an identifier (eg. 'i' in "definate") no match */
-	if(i==0 || text_check_identifier(string[i]))
+	if (i == 0 || text_check_identifier(string[i]))
 		return -1;
 	return i;
 }
 
 static int find_decorator(char *string) 
 {
-	if(string[0] == '@') {
+	if (string[0] == '@') {
 		int i = 1;
-		while(text_check_identifier(string[i])) {
+		while (text_check_identifier(string[i])) {
 			i++;
 		}
 		return i;
@@ -256,52 +263,52 @@ static int find_bool(char *string)
 {
 	int i = 0;
 	/* Check for "False" */
-	if(string[0]=='F' && string[1]=='a' && string[2]=='l' && string[3]=='s' && string[4]=='e')
+	if (string[0] == 'F' && string[1] == 'a' && string[2] == 'l' && string[3] == 's' && string[4] == 'e')
 		i = 5;
 	/* Check for "True" */
-	else if(string[0]=='T' && string[1]=='r' && string[2]=='u' && string[3]=='e')
+	else if (string[0] == 'T' && string[1] == 'r' && string[2] == 'u' && string[3] == 'e')
 		i = 4;
 	/* Check for "None" */
-	else if(string[0]=='N' && string[1]=='o' && string[2]=='n' && string[3]=='e')
+	else if (string[0] == 'N' && string[1] == 'o' && string[2] == 'n' && string[3] == 'e')
 		i = 4;
 	/* If next source char is an identifier (eg. 'i' in "definate") no match */
-	if(i==0 || text_check_identifier(string[i]))
+	if (i == 0 || text_check_identifier(string[i]))
 		return -1;
 	return i;
 }
 
 /* Ensures the format string for the given line is long enough, reallocating
- as needed. Allocation is done here, alone, to ensure consistency. */
+ * as needed. Allocation is done here, alone, to ensure consistency. */
 static int text_check_format_len(TextLine *line, unsigned int len)
 {
-	if(line->format) {
-		if(strlen(line->format) < len) {
+	if (line->format) {
+		if (strlen(line->format) < len) {
 			MEM_freeN(line->format);
-			line->format = MEM_mallocN(len+2, "SyntaxFormat");
-			if(!line->format) return 0;
+			line->format = MEM_mallocN(len + 2, "SyntaxFormat");
+			if (!line->format) return 0;
 		}
 	}
 	else {
-		line->format = MEM_mallocN(len+2, "SyntaxFormat");
-		if(!line->format) return 0;
+		line->format = MEM_mallocN(len + 2, "SyntaxFormat");
+		if (!line->format) return 0;
 	}
 
 	return 1;
 }
 
 /* Formats the specified line. If do_next is set, the process will move on to
- the succeeding line if it is affected (eg. multiline strings). Format strings
- may contain any of the following characters:
-	 '_'		Whitespace
-	 '#'		Comment text
-	 '!'		Punctuation and other symbols
-	 'n'		Numerals
-	 'l'		String letters
-	 'v'		Special variables (class, def)
-	 'b'		Built-in names (print, for, etc.)
-	 'q'		Other text (identifiers, etc.)
- It is terminated with a null-terminator '\0' followed by a continuation
- flag indicating whether the line is part of a multi-line string. */
+ * the succeeding line if it is affected (eg. multiline strings). Format strings
+ * may contain any of the following characters:
+ *  '_'  Whitespace
+ *  '#'  Comment text
+ *  '!'  Punctuation and other symbols
+ *  'n'  Numerals
+ *  'l'  String letters
+ *  'v'  Special variables (class, def)
+ *  'b'  Built-in names (print, for, etc.)
+ *  'q'  Other text (identifiers, etc.)
+ * It is terminated with a null-terminator '\0' followed by a continuation
+ * flag indicating whether the line is part of a multi-line string. */
 
 static void txt_format_line(SpaceText *st, TextLine *line, int do_next)
 {
@@ -310,50 +317,50 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next)
 	int len, i;
 
 	/* Get continuation from previous line */
-	if(line->prev && line->prev->format != NULL) {
-		fmt= line->prev->format;
-		cont = fmt[strlen(fmt)+1]; /* Just after the null-terminator */
+	if (line->prev && line->prev->format != NULL) {
+		fmt = line->prev->format;
+		cont = fmt[strlen(fmt) + 1]; /* Just after the null-terminator */
 	}
 	else cont = 0;
 
 	/* Get original continuation from this line */
-	if(line->format != NULL) {
-		fmt= line->format;
-		orig = fmt[strlen(fmt)+1]; /* Just after the null-terminator */
+	if (line->format != NULL) {
+		fmt = line->format;
+		orig = fmt[strlen(fmt) + 1]; /* Just after the null-terminator */
 	}
 	else orig = 0xFF;
 
 	len = flatten_string(st, &fs, line->line);
 	str = fs.buf;
-	if(!text_check_format_len(line, len)) {
+	if (!text_check_format_len(line, len)) {
 		flatten_string_free(&fs);
 		return;
 	}
 	fmt = line->format;
 
-	while(*str) {
+	while (*str) {
 		/* Handle escape sequences by skipping both \ and next char */
-		if(*str == '\\') {
+		if (*str == '\\') {
 			*fmt = prev; fmt++; str++;
-			if(*str == '\0') break;
+			if (*str == '\0') break;
 			*fmt = prev; fmt++; str += BLI_str_utf8_size(str);
 			continue;
 		}
 		/* Handle continuations */
-		else if(cont) {
+		else if (cont) {
 			/* Triple strings ("""...""" or '''...''') */
-			if(cont & TXT_TRISTR) {
+			if (cont & TXT_TRISTR) {
 				find = (cont & TXT_DBLQUOTSTR) ? '"' : '\'';
-				if(*str==find && *(str+1)==find && *(str+2)==find) {
+				if (*str == find && *(str + 1) == find && *(str + 2) == find) {
 					*fmt = 'l'; fmt++; str++;
 					*fmt = 'l'; fmt++; str++;
 					cont = 0;
 				}
-			/* Handle other strings */
+				/* Handle other strings */
 			}
 			else {
 				find = (cont & TXT_DBLQUOTSTR) ? '"' : '\'';
-				if(*str == find) cont = 0;
+				if (*str == find) cont = 0;
 			}
 
 			*fmt = 'l';
@@ -362,14 +369,15 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next)
 		/* Not in a string... */
 		else {
 			/* Deal with comments first */
-			if(prev == '#' || *str == '#') {
+			if (prev == '#' || *str == '#') {
 				*fmt = '#';
 				str += BLI_str_utf8_size(str) - 1;
-			} else if(*str == '"' || *str == '\'') {
+			}
+			else if (*str == '"' || *str == '\'') {
 				/* Strings */
 				find = *str;
-				cont = (*str== '"') ? TXT_DBLQUOTSTR : TXT_SNGQUOTSTR;
-				if(*(str+1) == find && *(str+2) == find) {
+				cont = (*str == '"') ? TXT_DBLQUOTSTR : TXT_SNGQUOTSTR;
+				if (*(str + 1) == find && *(str + 2) == find) {
 					*fmt = 'l'; fmt++; str++;
 					*fmt = 'l'; fmt++; str++;
 					cont |= TXT_TRISTR;
@@ -377,15 +385,15 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next)
 				*fmt = 'l';
 			}
 			/* Whitespace (all ws. has been converted to spaces) */
-			else if(*str == ' ')
+			else if (*str == ' ')
 				*fmt = '_';
 			/* Numbers (digits not part of an identifier and periods followed by digits) */
-			else if((prev != 'q' && text_check_digit(*str)) || (*str == '.' && text_check_digit(*(str+1))))
+			else if ((prev != 'q' && text_check_digit(*str)) || (*str == '.' && text_check_digit(*(str + 1))))
 				*fmt = 'n';
 			/* Booleans */
-			else if(prev != 'q' && (i=find_bool(str)) != -1)
-				if(i>0) {
-					while(i>1) {
+			else if (prev != 'q' && (i = find_bool(str)) != -1)
+				if (i > 0) {
+					while (i > 1) {
 						*fmt = 'n'; fmt++; str++;
 						i--;
 					}
@@ -396,24 +404,24 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next)
 					*fmt = 'q';
 				}
 			/* Punctuation */
-			else if(text_check_delim(*str))
+			else if (text_check_delim(*str))
 				*fmt = '!';
 			/* Identifiers and other text (no previous ws. or delims. so text continues) */
-			else if(prev == 'q') {
+			else if (prev == 'q') {
 				str += BLI_str_utf8_size(str) - 1;
 				*fmt = 'q';
 			}
 			/* Not ws, a digit, punct, or continuing text. Must be new, check for special words */
 			else {
 				/* Special vars(v) or built-in keywords(b) */
-				if((i=find_specialvar(str)) != -1)
+				if ((i = find_specialvar(str)) != -1)
 					prev = 'v';
-				else if((i=find_builtinfunc(str)) != -1)
+				else if ((i = find_builtinfunc(str)) != -1)
 					prev = 'b';
-				else if((i=find_decorator(str)) != -1)
-					prev = 'v'; /* could have a new color for this */
-				if(i>0) {
-					while(i>1) {
+				else if ((i = find_decorator(str)) != -1)
+					prev = 'v';  /* could have a new color for this */
+				if (i > 0) {
+					while (i > 1) {
 						*fmt = prev; fmt++; str++;
 						i--;
 					}
@@ -435,7 +443,7 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next)
 	*fmt = cont;
 
 	/* If continuation has changed and we're allowed, process the next line */
-	if(cont!=orig && do_next && line->next) {
+	if (cont != orig && do_next && line->next) {
 		txt_format_line(st, line->next, do_next);
 	}
 	
@@ -448,9 +456,9 @@ static void txt_format_text(SpaceText *st)
 {
 	TextLine *linep;
 
-	if(!st->text) return;
+	if (!st->text) return;
 
-	for(linep=st->text->lines.first; linep; linep=linep->next)
+	for (linep = st->text->lines.first; linep; linep = linep->next)
 		txt_format_line(st, linep, 0);
 }
 #endif
@@ -488,40 +496,38 @@ static void format_draw_color(char formatchar)
 
 /************************** draw text *****************************/
 
-/***********************/ /*
-
-Notes on word-wrap
---
-All word-wrap functions follow the algorithm below to maintain consistency.
-	line		The line to wrap (tabs converted to spaces)
-	view_width	The maximum number of characters displayable in the region
-				This equals region_width/font_width for the region
-	wrap_chars	Characters that allow wrapping. This equals [' ', '\t', '-']
-
-def wrap(line, view_width, wrap_chars):
-	draw_start = 0
-	draw_end = view_width
-	pos = 0
-	for c in line:
-		if pos-draw_start >= view_width:
-			print line[draw_start:draw_end]
-			draw_start = draw_end
-			draw_end += view_width
-		elif c in wrap_chars:
-			draw_end = pos+1
-		pos += 1
-	print line[draw_start:]
-
-*/ /***********************/
+/* Notes on word-wrap
+ * --
+ * All word-wrap functions follow the algorithm below to maintain consistency.
+ *     line        The line to wrap (tabs converted to spaces)
+ *     view_width    The maximum number of characters displayable in the region
+ *                 This equals region_width/font_width for the region
+ *     wrap_chars    Characters that allow wrapping. This equals [' ', '\t', '-']
+ * 
+ * def wrap(line, view_width, wrap_chars):
+ *     draw_start = 0
+ *     draw_end = view_width
+ *     pos = 0
+ *     for c in line:
+ *         if pos-draw_start >= view_width:
+ *             print line[draw_start:draw_end]
+ *             draw_start = draw_end
+ *             draw_end += view_width
+ *         elif c in wrap_chars:
+ *             draw_end = pos+1
+ *         pos += 1
+ *     print line[draw_start:]
+ * 
+ */
 
 int wrap_width(SpaceText *st, ARegion *ar)
 {
-	int winx= ar->winx - TXT_SCROLL_WIDTH;
+	int winx = ar->winx - TXT_SCROLL_WIDTH;
 	int x, max;
 	
-	x= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
-	max= st->cwidth ? (winx-x)/st->cwidth : 0;
-	return max>8 ? max : 8;
+	x = st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
+	max = st->cwidth ? (winx - x) / st->cwidth : 0;
+	return max > 8 ? max : 8;
 }
 
 /* Sets (offl, offc) for transforming (line, curs) to its wrapped position */
@@ -532,86 +538,87 @@ void wrap_offset(SpaceText *st, ARegion *ar, TextLine *linein, int cursin, int *
 	int i, j, start, end, max, chop;
 	char ch;
 
-	*offl= *offc= 0;
+	*offl = *offc = 0;
 
-	if(!st->text) return;
-	if(!st->wordwrap) return;
+	if (!st->text) return;
+	if (!st->wordwrap) return;
 
-	text= st->text;
+	text = st->text;
 
 	/* Move pointer to first visible line (top) */
-	linep= text->lines.first;
-	i= st->top;
-	while(i>0 && linep) {
-		int lines= text_get_visible_lines(st, ar, linep->line);
+	linep = text->lines.first;
+	i = st->top;
+	while (i > 0 && linep) {
+		int lines = text_get_visible_lines(st, ar, linep->line);
 
 		/* Line before top */
-		if(linep == linein) {
-			if(lines <= i)
+		if (linep == linein) {
+			if (lines <= i)
 				/* no visible part of line */
 				return;
 		}
 
-		if (i-lines<0) {
+		if (i - lines < 0) {
 			break;
-		} else {
-			linep= linep->next;
-			(*offl)+= lines-1;
-			i-= lines;
+		}
+		else {
+			linep = linep->next;
+			(*offl) += lines - 1;
+			i -= lines;
 		}
 	}
 
-	max= wrap_width(st, ar);
+	max = wrap_width(st, ar);
 	cursin = txt_utf8_offset_to_index(linein->line, cursin);
 
-	while(linep) {
-		start= 0;
-		end= max;
-		chop= 1;
-		*offc= 0;
-		for(i=0, j=0; linep->line[j]; j+=BLI_str_utf8_size(linep->line+j)) {
+	while (linep) {
+		start = 0;
+		end = max;
+		chop = 1;
+		*offc = 0;
+		for (i = 0, j = 0; linep->line[j]; j += BLI_str_utf8_size(linep->line + j)) {
 			int chars;
 
 			/* Mimic replacement of tabs */
-			ch= linep->line[j];
-			if(ch=='\t') {
-				chars= st->tabnumber-i%st->tabnumber;
-				if(linep==linein && i<cursin) cursin += chars-1;
-				ch= ' ';
+			ch = linep->line[j];
+			if (ch == '\t') {
+				chars = st->tabnumber - i % st->tabnumber;
+				if (linep == linein && i < cursin) cursin += chars - 1;
+				ch = ' ';
 			}
 			else {
-				chars= 1;
+				chars = 1;
 			}
 
-			while(chars--) {
-				if(i-start>=max) {
-					if(chop && linep==linein && i >= cursin) {
-						if (i==cursin) {
+			while (chars--) {
+				if (i - start >= max) {
+					if (chop && linep == linein && i >= cursin) {
+						if (i == cursin) {
 							(*offl)++;
-							*offc -= end-start;
+							*offc -= end - start;
 						}
 
 						return;
 					}
 
 					(*offl)++;
-					*offc -= end-start;
+					*offc -= end - start;
 
-					start= end;
+					start = end;
 					end += max;
-					chop= 1;
+					chop = 1;
 				}
-				else if(ch==' ' || ch=='-') {
-					end = i+1;
-					chop= 0;
-					if(linep==linein && i >= cursin)
+				else if (ch == ' ' || ch == '-') {
+					end = i + 1;
+					chop = 0;
+					if (linep == linein && i >= cursin)
 						return;
 				}
 				i++;
 			}
 		}
-		if(linep==linein) break;
-		linep= linep->next;
+		if (linep == linein) break;
+		linep = linep->next;
 	}
 }
 
@@ -621,53 +628,53 @@ void wrap_offset_in_line(SpaceText *st, ARegion *ar, TextLine *linein, int cursi
 	int i, j, start, end, chars, max, chop;
 	char ch;
 
-	*offl= *offc= 0;
+	*offl = *offc = 0;
 
-	if(!st->text) return;
-	if(!st->wordwrap) return;
+	if (!st->text) return;
+	if (!st->wordwrap) return;
 
-	max= wrap_width(st, ar);
+	max = wrap_width(st, ar);
 
-	start= 0;
-	end= max;
-	chop= 1;
-	*offc= 0;
+	start = 0;
+	end = max;
+	chop = 1;
+	*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(linein->line + j)) {
 
 		/* Mimic replacement of tabs */
-		ch= linein->line[j];
-		if(ch=='\t') {
-			chars= st->tabnumber-i%st->tabnumber;
-			if(i<cursin) cursin += chars-1;
-			ch= ' ';
+		ch = linein->line[j];
+		if (ch == '\t') {
+			chars = st->tabnumber - i % st->tabnumber;
+			if (i < cursin) cursin += chars - 1;
+			ch = ' ';
 		}
 		else
-			chars= 1;
+			chars = 1;
 
-		while(chars--) {
-			if(i-start>=max) {
-				if(chop && i >= cursin) {
-					if (i==cursin) {
+		while (chars--) {
+			if (i - start >= max) {
+				if (chop && i >= cursin) {
+					if (i == cursin) {
 						(*offl)++;
-						*offc -= end-start;
+						*offc -= end - start;
 					}
 
 					return;
 				}
 
 				(*offl)++;
-				*offc -= end-start;
+				*offc -= end - start;
 
-				start= end;
+				start = end;
 				end += max;
-				chop= 1;
+				chop = 1;
 			}
-			else if(ch==' ' || ch=='-') {
-				end = i+1;
-				chop= 0;
-				if(i >= cursin)
+			else if (ch == ' ' || ch == '-') {
+				end = i + 1;
+				chop = 0;
+				if (i >= cursin)
 					return;
 			}
 			i++;
@@ -677,11 +684,11 @@ void wrap_offset_in_line(SpaceText *st, ARegion *ar, TextLine *linein, int cursi
 
 int text_get_char_pos(SpaceText *st, const char *line, int cur)
 {
-	int a=0, i;
+	int a = 0, i;
 	
-	for(i=0; i<cur && line[i]; i += BLI_str_utf8_size(line + i)) {
-		if(line[i]=='\t')
-			a += st->tabnumber-a%st->tabnumber;
+	for (i = 0; i < cur && line[i]; i += BLI_str_utf8_size(line + i)) {
+		if (line[i] == '\t')
+			a += st->tabnumber - a % st->tabnumber;
 		else
 			a++;
 	}
@@ -690,9 +697,9 @@ int text_get_char_pos(SpaceText *st, const char *line, int cur)
 
 static const char *txt_utf8_get_nth(const char *str, int n)
 {
-	int pos= 0;
+	int pos = 0;
 	while (str[pos] && n--) {
-		pos+= BLI_str_utf8_size(str + pos);
+		pos += BLI_str_utf8_size(str + pos);
 	}
 	return str + pos;
 }
@@ -704,49 +711,49 @@ static int text_draw_wrapped(SpaceText *st, const char *str, int x, int y, int w
 	int mi, ma, mstart, mend;                /* mem */
 	
 	flatten_string(st, &fs, str);
-	str= fs.buf;
-	max= w/st->cwidth;
-	if(max<8) max= 8;
-	basex= x;
-	lines= 1;
+	str = fs.buf;
+	max = w / st->cwidth;
+	if (max < 8) max = 8;
+	basex = x;
+	lines = 1;
 	
-	start= 0; mstart= 0;
-	end= max; mend= txt_utf8_get_nth(str, max) - str;
+	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)) {
-		if(i-start >= max) {
+	for (i = 0, mi = 0; str[mi]; i++, mi += BLI_str_utf8_size(str + mi)) {
+		if (i - start >= max) {
 			/* skip hidden part of line */
-			if(skip) {
+			if (skip) {
 				skip--;
-				start= end; mstart= mend;
-				end += max; mend= txt_utf8_get_nth(str+mend, max) - str;
+				start = end; mstart = mend;
+				end += max; mend = txt_utf8_get_nth(str + mend, max) - str;
 				continue;
 			}
 
 			/* 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)) {
-				if(st->showsyntax && format) format_draw_color(format[a]);
+			for (a = start, ma = mstart; a < end; a++, ma += BLI_str_utf8_size(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;
-			x= basex;
+			x = basex;
 			lines++;
-			start= end; mstart= mend;
-			end += max; mend= txt_utf8_get_nth(str+mend, max) - str;
+			start = end; mstart = mend;
+			end += max; mend = txt_utf8_get_nth(str + mend, max) - str;
 
-			if(y<=0) break;
+			if (y <= 0) break;
 		}
-		else if(str[mi]==' ' || str[mi]=='-') {
-			end = i+1; mend = mi+1;
+		else if (str[mi] == ' ' || str[mi] == '-') {
+			end = i + 1; mend = mi + 1;
 		}
 	}
 
 	/* Draw the remaining text */
-	for(a=start, ma=mstart; str[ma] && y > 0; a++, ma+=BLI_str_utf8_size(str+ma)) {
-		if(st->showsyntax && format)
+	for (a = start, ma = mstart; str[ma] && y > 0; a++, ma += BLI_str_utf8_size(str + ma)) {
+		if (st->showsyntax && format)
 			format_draw_color(format[a]);
 
-		x += text_font_draw_character_utf8(st, x, y, str+ma);
+		x += text_font_draw_character_utf8(st, x, y, str + ma);
 	}
 
 	flatten_string_free(&fs);
@@ -757,27 +764,27 @@ static int text_draw_wrapped(SpaceText *st, const char *str, int x, int y, int w
 static int text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int draw, int x, int y, const char *format)
 {
 	FlattenString fs;
-	int *acc, r=0;
+	int *acc, r = 0;
 	const char *in;
 
-	int w= flatten_string(st, &fs, str);
-	if(w < cshift) {
+	int w = flatten_string(st, &fs, str);
+	if (w < cshift) {
 		flatten_string_free(&fs);
 		return 0; /* String is shorter than shift */
 	}
 	
-	in= txt_utf8_get_nth(fs.buf, cshift);
-	acc= fs.accum+cshift;
-	w= w-cshift;
+	in = txt_utf8_get_nth(fs.buf, cshift);
+	acc = fs.accum + cshift;
+	w = w - cshift;
 
-	if(draw) {
+	if (draw) {
 		int amount = maxwidth ? MIN2(w, maxwidth) : w;
 		
-		if(st->showsyntax && format) {
-			int a, str_shift= 0;
-			format = format+cshift;
+		if (st->showsyntax && format) {
+			int a, str_shift = 0;
+			format = format + cshift;
 
-			for(a = 0; a < amount; a++) {
+			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);
@@ -786,18 +793,18 @@ static int text_draw(SpaceText *st, char *str, int cshift, int maxwidth, int dra
 		else text_font_draw(st, x, y, in);
 	}
 	else {
-		while(w-- && *acc++ < maxwidth)
-			r+= st->cwidth;
+		while (w-- && *acc++ < maxwidth)
+			r += st->cwidth;
 	}
 
 	flatten_string_free(&fs);
 
-	if(cshift && r==0)
+	if (cshift && r == 0)
 		return 0;
-	else if(st->showlinenrs)
-		return r+TXT_OFFSET+TEXTXLOC;
+	else if (st->showlinenrs)
+		return r + TXT_OFFSET + TEXTXLOC;
 	else
-		return r+TXT_OFFSET;
+		return r + TXT_OFFSET;
 }
 
 /************************ cache utilities *****************************/
@@ -819,102 +826,105 @@ typedef struct DrawCache {
 
 static void text_drawcache_init(SpaceText *st)
 {
-	DrawCache *drawcache= MEM_callocN(sizeof (DrawCache), "text draw cache");
+	DrawCache *drawcache = MEM_callocN(sizeof (DrawCache), "text draw cache");
 
-	drawcache->winx= -1;
-	drawcache->nlines= BLI_countlist(&st->text->lines);
-	drawcache->text_id[0]= '\0';
+	drawcache->winx = -1;
+	drawcache->nlines = BLI_countlist(&st->text->lines);
+	drawcache->text_id[0] = '\0';
 
-	st->drawcache= drawcache;
+	st->drawcache = drawcache;
 }
 
 static void text_update_drawcache(SpaceText *st, ARegion *ar)
 {
 	DrawCache *drawcache;
-	int full_update= 0, nlines= 0;
-	Text *txt= st->text;
+	int full_update = 0, nlines = 0;
+	Text *txt = st->text;
 
-	if(!st->drawcache) text_drawcache_init(st);
+	if (!st->drawcache) text_drawcache_init(st);
 
 	text_update_character_width(st);
 
-	drawcache= (DrawCache *)st->drawcache;
-	nlines= drawcache->nlines;
+	drawcache = (DrawCache *)st->drawcache;
+	nlines = drawcache->nlines;
 
 	/* check if full cache update is needed */
-	full_update|= drawcache->winx != ar->winx;                 /* area was resized */
-	full_update|= drawcache->wordwrap != st->wordwrap;         /* word-wrapping option was toggled */
-	full_update|= drawcache->showlinenrs != st->showlinenrs; /* word-wrapping option was toggled */
-	full_update|= drawcache->tabnumber != st->tabnumber;  /* word-wrapping option was toggled */
-	full_update|= drawcache->lheight != st->lheight;      /* word-wrapping option was toggled */
-	full_update|= drawcache->cwidth != st->cwidth;        /* word-wrapping option was toggled */
-	full_update|= strncmp(drawcache->text_id, txt->id.name, MAX_ID_NAME); /* text datablock was changed */
-
-	if(st->wordwrap) {
+	full_update |= drawcache->winx != ar->winx;               /* area was resized */
+	full_update |= drawcache->wordwrap != st->wordwrap;       /* word-wrapping option was toggled */
+	full_update |= drawcache->showlinenrs != st->showlinenrs; /* word-wrapping option was toggled */
+	full_update |= drawcache->tabnumber != st->tabnumber;     /* word-wrapping option was toggled */
+	full_update |= drawcache->lheight != st->lheight;         /* word-wrapping option was toggled */
+	full_update |= drawcache->cwidth != st->cwidth;           /* word-wrapping option was toggled */
+	full_update |= strncmp(drawcache->text_id, txt->id.name, MAX_ID_NAME); /* text datablock was changed */
+
+	if (st->wordwrap) {
 		/* update line heights */
-		if(full_update || !drawcache->line_height) {
+		if (full_update || !drawcache->line_height) {
 			drawcache->valid_head  = 0;
 			drawcache->valid_tail  = 0;
 			drawcache->update_flag = 1;
 		}
 
-		if(drawcache->update_flag) {
-			TextLine *line= st->text->lines.first;
-			int lineno= 0, size, lines_count;
-			int *fp= drawcache->line_height, *new_tail, *old_tail;
+		if (drawcache->update_flag) {
+			TextLine *line = st->text->lines.first;
+			int lineno = 0, size, lines_count;
+			int *fp = drawcache->line_height, *new_tail, *old_tail;
 
-			nlines= BLI_countlist(&txt->lines);
-			size= sizeof(int)*nlines;
+			nlines = BLI_countlist(&txt->lines);
+			size = sizeof(int) * nlines;
 
-			if(fp) fp= MEM_reallocN(fp, size);
-			else fp= MEM_callocN(size, "text drawcache line_height");
+			if (fp) fp = MEM_reallocN(fp, size);
+			else fp = MEM_callocN(size, "text drawcache line_height");
 
-			drawcache->valid_tail= drawcache->valid_head= 0;
-			old_tail= fp + drawcache->nlines - drawcache->valid_tail;
-			new_tail= fp + nlines - drawcache->valid_tail;
+			drawcache->valid_tail = drawcache->valid_head = 0;
+			old_tail = fp + drawcache->nlines - drawcache->valid_tail;
+			new_tail = fp + nlines - drawcache->valid_tail;
 			memmove(new_tail, old_tail, drawcache->valid_tail);
 
-			drawcache->total_lines= 0;
+			drawcache->total_lines = 0;
 
-			if(st->showlinenrs)
-				st->linenrs_tot= (int)floor(log10((float)nlines)) + 1;
+			if (st->showlinenrs)
+				st->linenrs_tot = (int)floor(log10((float)nlines)) + 1;
 
-			while(line) {
-				if(drawcache->valid_head) { /* we're inside valid head lines */
-					lines_count= fp[lineno];
+			while (line) {
+				if (drawcache->valid_head) { /* we're inside valid head lines */
+					lines_count = fp[lineno];
 					drawcache->valid_head--;
-				} else if (lineno > new_tail - fp) {  /* we-re inside valid tail lines */
-					lines_count= fp[lineno];
-				} else {
-					lines_count= text_get_visible_lines(st, ar, line->line);
+				}
+				else if (lineno > new_tail - fp) {  /* we-re inside valid tail lines */
+					lines_count = fp[lineno];
+				}
+				else {
+					lines_count = text_get_visible_lines(st, ar, line->line);
 				}
 
-				fp[lineno]= lines_count;
+				fp[lineno] = lines_count;
 
-				line= line->next;
+				line = line->next;
 				lineno++;
-				drawcache->total_lines+= lines_count;
+				drawcache->total_lines += lines_count;
 			}
 
-			drawcache->line_height= fp;
+			drawcache->line_height = fp;
 		}
-	} else {
-		if(drawcache->line_height) {
+	}
+	else {
+		if (drawcache->line_height) {
 			MEM_freeN(drawcache->line_height);
-			drawcache->line_height= NULL;
+			drawcache->line_height = NULL;
 		}
 
-		if(full_update || drawcache->update_flag) {
-			nlines= BLI_countlist(&txt->lines);
+		if (full_update || drawcache->update_flag) {
+			nlines = BLI_countlist(&txt->lines);
 
-			if(st->showlinenrs)
-				st->linenrs_tot= (int)floor(log10((float)nlines)) + 1;
+			if (st->showlinenrs)
+				st->linenrs_tot = (int)floor(log10((float)nlines)) + 1;
 		}
 
-		drawcache->total_lines= nlines;
+		drawcache->total_lines = nlines;
 	}
 
-	drawcache->nlines= nlines;
+	drawcache->nlines = nlines;
 
 	/* store settings */
 	drawcache->winx        = ar->winx;
@@ -938,48 +948,50 @@ void text_drawcache_tag_update(SpaceText *st, int full)
 	if (st == NULL)
 		return;
 		
-	if(st->drawcache) {
-		DrawCache *drawcache= (DrawCache *)st->drawcache;
-		Text *txt= st->text;
+	if (st->drawcache) {
+		DrawCache *drawcache = (DrawCache *)st->drawcache;
+		Text *txt = st->text;
 
-		if(drawcache->update_flag) {
+		if (drawcache->update_flag) {
 			/* happens when tagging update from space listener */
 			/* should do nothing to prevent locally tagged cache be fully recalculated */
 			return;
 		}
 
-		if(!full) {
-			int sellno= BLI_findindex(&txt->lines, txt->sell);
-			int curlno= BLI_findindex(&txt->lines, txt->curl);
+		if (!full) {
+			int sellno = BLI_findindex(&txt->lines, txt->sell);
+			int curlno = BLI_findindex(&txt->lines, txt->curl);
 
-			if(curlno < sellno) {
-				drawcache->valid_head= curlno;
-				drawcache->valid_tail= drawcache->nlines - sellno - 1;
-			} else {
-				drawcache->valid_head= sellno;
-				drawcache->valid_tail= drawcache->nlines - curlno - 1;
+			if (curlno < sellno) {
+				drawcache->valid_head = curlno;
+				drawcache->valid_tail = drawcache->nlines - sellno - 1;
+			}
+			else {
+				drawcache->valid_head = sellno;
+				drawcache->valid_tail = drawcache->nlines - curlno - 1;
 			}
 
 			/* quick cache recalculation is also used in delete operator,
-			   which could merge lines which are adjusent to current selection lines
-			   expand recalculate area to this lines */
-			if(drawcache->valid_head>0) drawcache->valid_head--;
-			if(drawcache->valid_tail>0) drawcache->valid_tail--;
-		} else {
-			drawcache->valid_head= 0;
-			drawcache->valid_tail= 0;
+			 * which could merge lines which are adjacent to current selection lines
+			 * expand recalculate area to this lines */
+			if (drawcache->valid_head > 0) drawcache->valid_head--;
+			if (drawcache->valid_tail > 0) drawcache->valid_tail--;
+		}
+		else {
+			drawcache->valid_head = 0;
+			drawcache->valid_tail = 0;
 		}
 
-		drawcache->update_flag= 1;
+		drawcache->update_flag = 1;
 	}
 }
 
 void text_free_caches(SpaceText *st)
 {
-	DrawCache *drawcache= (DrawCache *)st->drawcache;
+	DrawCache *drawcache = (DrawCache *)st->drawcache;
 
-	if(drawcache) {
-		if(drawcache->line_height)
+	if (drawcache) {
+		if (drawcache->line_height)
 			MEM_freeN(drawcache->line_height);
 
 		MEM_freeN(drawcache);
@@ -991,7 +1003,7 @@ void text_free_caches(SpaceText *st)
 /* cache should be updated in caller */
 static int text_get_visible_lines_no(SpaceText *st, int lineno)
 {
-	DrawCache *drawcache= (DrawCache *)st->drawcache;
+	DrawCache *drawcache = (DrawCache *)st->drawcache;
 
 	return drawcache->line_height[lineno];
 }
@@ -1001,27 +1013,27 @@ int text_get_visible_lines(SpaceText *st, ARegion *ar, const char *str)
 	int i, j, start, end, max, lines, chars;
 	char ch;
 
-	max= wrap_width(st, ar);
-	lines= 1;
-	start= 0;
-	end= max; 
-	for(i= 0, j= 0; str[j]; j+=BLI_str_utf8_size(str+j)) {
+	max = wrap_width(st, ar);
+	lines = 1;
+	start = 0;
+	end = max;
+	for (i = 0, j = 0; str[j]; j += BLI_str_utf8_size(str + j)) {
 		/* Mimic replacement of tabs */
-		ch= str[j];
-		if(ch=='\t') {
-			chars= st->tabnumber-i%st->tabnumber;
-			ch= ' ';
+		ch = str[j];
+		if (ch == '\t') {
+			chars = st->tabnumber - i % st->tabnumber;
+			ch = ' ';
 		}
-		else chars= 1;
+		else chars = 1;
 
-		while(chars--) {
-			if(i-start >= max) {
+		while (chars--) {
+			if (i - start >= max) {
 				lines++;
-				start= end;
+				start = end;
 				end += max;
 			}
-			else if(ch==' ' || ch=='-') {
-				end= i+1;
+			else if (ch == ' ' || ch == '-') {
+				end = i + 1;
 			}
 
 			i++;
@@ -1033,19 +1045,20 @@ int text_get_visible_lines(SpaceText *st, ARegion *ar, const char *str)
 
 int text_get_span_wrap(SpaceText *st, ARegion *ar, TextLine *from, TextLine *to)
 {
-	if(st->wordwrap) {
-		int ret=0;
-		TextLine *tmp= from;
+	if (st->wordwrap) {
+		int ret = 0;
+		TextLine *tmp = from;
 
 		/* Look forwards */
 		while (tmp) {
 			if (tmp == to) return ret;
-			ret+= text_get_visible_lines(st, ar, tmp->line);
-			tmp= tmp->next;
+			ret += text_get_visible_lines(st, ar, tmp->line);
+			tmp = tmp->next;
 		}
 
 		return ret;
-	} else return txt_get_span(from, to);
+	}
+	else return txt_get_span(from, to);
 }
 
 int text_get_total_lines(SpaceText *st, ARegion *ar)
@@ -1053,7 +1066,7 @@ int text_get_total_lines(SpaceText *st, ARegion *ar)
 	DrawCache *drawcache;
 
 	text_update_drawcache(st, ar);
-	drawcache= (DrawCache *)st->drawcache;
+	drawcache = (DrawCache *)st->drawcache;
 
 	return drawcache->total_lines;
 }
@@ -1061,30 +1074,32 @@ int text_get_total_lines(SpaceText *st, ARegion *ar)
 /* 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 *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 (wrap_top) *wrap_top = 0;
 
-	if(st->wordwrap) {
-		while(i>0 && pline) {
-			int lines= text_get_visible_lines_no(st, lineno);
+	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;
+			if (i - lines < 0) {
+				if (wrap_top) *wrap_top = i;
 				break;
-			} else {
-				pline= pline->next;
-				i-= lines;
+			}
+			else {
+				pline = pline->next;
+				i -= lines;
 				lineno++;
 			}
 		}
-	} else {
-		for(i=st->top; pline->next && i>0; i--)
-			pline= pline->next;
+	}
+	else {
+		for (i = st->top; pline->next && i > 0; i--)
+			pline = pline->next;
 	}
 
 	return pline;
@@ -1101,89 +1116,89 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
 	pix_top_margin = 8;
 	pix_bottom_margin = 4;
 	pix_available = ar->winy - pix_top_margin - pix_bottom_margin;
-	ltexth= text_get_total_lines(st, ar);
+	ltexth = text_get_total_lines(st, ar);
 	blank_lines = st->viewlines / 2;
 	
 	/* nicer code: use scroll rect for entire bar */
-	back->xmin= ar->winx -18;
-	back->xmax= ar->winx;
-	back->ymin= 0;
-	back->ymax= ar->winy;
+	back->xmin = ar->winx - 18;
+	back->xmax = ar->winx;
+	back->ymin = 0;
+	back->ymax = ar->winy;
 	
-	scroll->xmin= ar->winx - 17;
-	scroll->xmax= ar->winx - 5;
-	scroll->ymin= 4;
-	scroll->ymax= 4+pix_available;
+	scroll->xmin = ar->winx - 17;
+	scroll->xmax = ar->winx - 5;
+	scroll->ymin = 4;
+	scroll->ymax = 4 + pix_available;
 	
-	/* when resizing a vieport with the bar at the bottom to a greater height more blank lines will be added */
-	if(ltexth + blank_lines < st->top + st->viewlines) {
+	/* when re-sizing a view-port with the bar at the bottom to a greater height more blank lines will be added */
+	if (ltexth + blank_lines < st->top + st->viewlines) {
 		blank_lines = st->top + st->viewlines - ltexth;
 	}
 	
 	ltexth += blank_lines;
 
-	barheight = (ltexth > 0)? (st->viewlines*pix_available)/ltexth: 0;
+	barheight = (ltexth > 0) ? (st->viewlines * pix_available) / ltexth : 0;
 	pix_bardiff = 0;
-	if(barheight < 20) {
+	if (barheight < 20) {
 		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;
+	barstart = (ltexth > 0) ? ((pix_available - pix_bardiff) * st->top) / ltexth : 0;
 
-	st->txtbar= *scroll;
+	st->txtbar = *scroll;
 	st->txtbar.ymax -= barstart;
 	st->txtbar.ymin = st->txtbar.ymax - barheight;
 
 	CLAMP(st->txtbar.ymin, pix_bottom_margin, ar->winy - pix_top_margin);
 	CLAMP(st->txtbar.ymax, pix_bottom_margin, ar->winy - pix_top_margin);
 
-	st->pix_per_line= (pix_available > 0)? (float) ltexth/pix_available: 0;
-	if(st->pix_per_line < 0.1f) st->pix_per_line=0.1f;
+	st->pix_per_line = (pix_available > 0) ? (float) ltexth / pix_available : 0;
+	if (st->pix_per_line < 0.1f) st->pix_per_line = 0.1f;
 
-	curl_off= text_get_span_wrap(st, ar, st->text->lines.first, st->text->curl);
-	sell_off= text_get_span_wrap(st, ar, st->text->lines.first, st->text->sell);
+	curl_off = text_get_span_wrap(st, ar, st->text->lines.first, st->text->curl);
+	sell_off = text_get_span_wrap(st, ar, st->text->lines.first, st->text->sell);
 	lhlstart = MIN2(curl_off, sell_off);
 	lhlend = MAX2(curl_off, sell_off);
 
-	if(ltexth > 0) {
-		hlstart = (lhlstart * pix_available)/ltexth;
-		hlend = (lhlend * pix_available)/ltexth;
+	if (ltexth > 0) {
+		hlstart = (lhlstart * pix_available) / ltexth;
+		hlend = (lhlend * pix_available) / ltexth;
 
 		/* the scrollbar is non-linear sized */
-		if(pix_bardiff > 0) {
+		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); 	
 			}
-			else if(lhlstart > st->top + st->viewlines && hlstart < barstart + barheight && hlstart > barstart) {
+			else if (lhlstart > st->top + st->viewlines && hlstart < barstart + barheight && hlstart > barstart) {
 				/* push hl start down */
 				hlstart = barstart + barheight;
 			}
-			else if(lhlend > st->top  && lhlstart < st->top && hlstart > barstart) {
+			else if (lhlend > st->top  && lhlstart < st->top && hlstart > barstart) {
 				/*fill out start */
 				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); 	
+				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) {
+			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) {
+			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;
 			}	
 		}	
@@ -1193,13 +1208,13 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
 		hlend = 0;
 	}
 
-	if(hlend - hlstart < 2) { 
+	if (hlend - hlstart < 2) { 
 		hlend = hlstart + 2;
 	}
 	
-	st->txtscroll= *scroll;
-	st->txtscroll.ymax= ar->winy - pix_top_margin - hlstart;
-	st->txtscroll.ymin= ar->winy - pix_top_margin - hlend;
+	st->txtscroll = *scroll;
+	st->txtscroll.ymax = ar->winy - pix_top_margin - hlstart;
+	st->txtscroll.ymin = ar->winy - pix_top_margin - hlend;
 
 	CLAMP(st->txtscroll.ymin, pix_bottom_margin, ar->winy - pix_top_margin);
 	CLAMP(st->txtscroll.ymax, pix_bottom_margin, ar->winy - pix_top_margin);
@@ -1207,23 +1222,23 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
 
 static void draw_textscroll(SpaceText *st, rcti *scroll, rcti *back)
 {
-	bTheme *btheme= UI_GetTheme();
-	uiWidgetColors wcol= btheme->tui.wcol_scroll;
+	bTheme *btheme = UI_GetTheme();
+	uiWidgetColors wcol = btheme->tui.wcol_scroll;
 	unsigned char col[4];
 	float rad;
 	
 	UI_ThemeColor(TH_BACK);
 	glRecti(back->xmin, back->ymin, back->xmax, back->ymax);
 
-	uiWidgetScrollDraw(&wcol, scroll, &st->txtbar, (st->flags & ST_SCROLL_SELECT)?UI_SCROLL_PRESSED:0);
+	uiWidgetScrollDraw(&wcol, scroll, &st->txtbar, (st->flags & ST_SCROLL_SELECT) ? UI_SCROLL_PRESSED : 0);
 
 	uiSetRoundBox(UI_CNR_ALL);
-	rad= 0.4f*MIN2(st->txtscroll.xmax - st->txtscroll.xmin, st->txtscroll.ymax - st->txtscroll.ymin);
+	rad = 0.4f * MIN2(st->txtscroll.xmax - st->txtscroll.xmin, st->txtscroll.ymax - st->txtscroll.ymin);
 	UI_GetThemeColor3ubv(TH_HILITE, col);
-	col[3]= 48;
+	col[3] = 48;
 	glColor4ubv(col);
 	glEnable(GL_BLEND);
-	uiRoundBox(st->txtscroll.xmin+1, st->txtscroll.ymin, st->txtscroll.xmax-1, st->txtscroll.ymax, rad);
+	uiRoundBox(st->txtscroll.xmin + 1, st->txtscroll.ymin, st->txtscroll.xmax - 1, st->txtscroll.ymax, rad);
 	glDisable(GL_BLEND);
 }
 
@@ -1231,28 +1246,28 @@ static void draw_textscroll(SpaceText *st, rcti *scroll, rcti *back)
 
 static void draw_markers(SpaceText *st, ARegion *ar)
 {
-	Text *text= st->text;
+	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);
+	top = first_visible_line(st, ar, NULL);
+	topi = BLI_findindex(&text->lines, top);
 
-	topy= txt_get_span(text->lines.first, top);
+	topy = txt_get_span(text->lines.first, top);
 
-	for(marker= text->markers.first; marker; marker= next) {
-		next= marker->next;
+	for (marker = text->markers.first; marker; marker = next) {
+		next = marker->next;
 
 		/* invisible line (before top) */
-		if(marker->lineno<topi) continue;
+		if (marker->lineno < topi) continue;
 
-		line= BLI_findlink(&text->lines, marker->lineno);
+		line = BLI_findlink(&text->lines, marker->lineno);
 
 		/* Remove broken markers */
-		if(marker->end>line->len || marker->start>marker->end) {
+		if (marker->end > line->len || marker->start > marker->end) {
 			BLI_freelinkN(&text->markers, marker);
 			continue;
 		}
@@ -1266,46 +1281,46 @@ static void draw_markers(SpaceText *st, ARegion *ar)
 		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;
+		if (y2 < 0 || y1 > st->top + st->viewlines) continue;
 
 		glColor3ubv(marker->color);
-		x= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
-		y= ar->winy-3;
+		x = st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
+		y = ar->winy - 3;
 
-		if(y1==y2) {
-			y -= y1*st->lheight;
+		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);
+			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;
+			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);
+			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;
+			y -= st->lheight;
 
-			for(i=y1+1; i<y2; i++) {
+			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);
+				glVertex2i(x, y - st->lheight);
+				glVertex2i(ar->winx, y - st->lheight);
 				glEnd();
-				y-=st->lheight;
+				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);
+			glVertex2i(x + x2 * st->cwidth + 1, y);
+			glVertex2i(x + x2 * st->cwidth + 1, y - st->lheight);
+			glVertex2i(x, y - st->lheight);
 			glEnd();
 		}
 	}
@@ -1316,84 +1331,84 @@ static void draw_markers(SpaceText *st, ARegion *ar)
 static void draw_documentation(SpaceText *st, ARegion *ar)
 {
 	TextLine *tmp;
-	char *docs, buf[DOC_WIDTH+1], *p;
+	char *docs, buf[DOC_WIDTH + 1], *p;
 	int i, br, lines;
 	int boxw, boxh, l, x, y /* , top */ /* UNUSED */;
 	
-	if(!st || !st->text) return;
-	if(!texttool_text_is_active(st->text)) return;
+	if (!st || !st->text) return;
+	if (!texttool_text_is_active(st->text)) return;
 	
 	docs = texttool_docs_get();
 
-	if(!docs) return;
+	if (!docs) return;
 
 	/* Count the visible lines to the cursor */
-	for(tmp=st->text->curl, l=-st->top; tmp; tmp=tmp->prev, l++);
-	if(l<0) return;
+	for (tmp = st->text->curl, l = -st->top; tmp; tmp = tmp->prev, l++) ;
+	if (l < 0) return;
 	
-	if(st->showlinenrs) {
-		x= st->cwidth*(st->text->curc-st->left) + TXT_OFFSET + TEXTXLOC - 4;
+	if (st->showlinenrs) {
+		x = st->cwidth * (st->text->curc - st->left) + TXT_OFFSET + TEXTXLOC - 4;
 	}
 	else {
-		x= st->cwidth*(st->text->curc-st->left) + TXT_OFFSET - 4;
+		x = st->cwidth * (st->text->curc - st->left) + TXT_OFFSET - 4;
 	}
-	if(texttool_suggest_first()) {
-		x += SUGG_LIST_WIDTH*st->cwidth + 50;
+	if (texttool_suggest_first()) {
+		x += SUGG_LIST_WIDTH * st->cwidth + 50;
 	}
 
-	/* top= */ /* UNUSED */ y= ar->winy - st->lheight*l - 2;
-	boxw= DOC_WIDTH*st->cwidth + 20;
-	boxh= (DOC_HEIGHT+1)*st->lheight;
+	/* top= */ /* UNUSED */ y = ar->winy - st->lheight * l - 2;
+	boxw = DOC_WIDTH * st->cwidth + 20;
+	boxh = (DOC_HEIGHT + 1) * st->lheight;
 
 	/* Draw panel */
 	UI_ThemeColor(TH_BACK);
-	glRecti(x, y, x+boxw, y-boxh);
+	glRecti(x, y, x + boxw, y - boxh);
 	UI_ThemeColor(TH_SHADE1);
 	glBegin(GL_LINE_LOOP);
 	glVertex2i(x, y);
-	glVertex2i(x+boxw, y);
-	glVertex2i(x+boxw, y-boxh);
-	glVertex2i(x, y-boxh);
+	glVertex2i(x + boxw, y);
+	glVertex2i(x + boxw, y - boxh);
+	glVertex2i(x, y - boxh);
 	glEnd();
 	glBegin(GL_LINE_LOOP);
-	glVertex2i(x+boxw-10, y-7);
-	glVertex2i(x+boxw-4, y-7);
-	glVertex2i(x+boxw-7, y-2);
+	glVertex2i(x + boxw - 10, y - 7);
+	glVertex2i(x + boxw - 4, y - 7);
+	glVertex2i(x + boxw - 7, y - 2);
 	glEnd();
 	glBegin(GL_LINE_LOOP);
-	glVertex2i(x+boxw-10, y-boxh+7);
-	glVertex2i(x+boxw-4, y-boxh+7);
-	glVertex2i(x+boxw-7, y-boxh+2);
+	glVertex2i(x + boxw - 10, y - boxh + 7);
+	glVertex2i(x + boxw - 4, y - boxh + 7);
+	glVertex2i(x + boxw - 7, y - boxh + 2);
 	glEnd();
 	UI_ThemeColor(TH_TEXT);
 
-	i= 0; br= DOC_WIDTH; lines= 0; // XXX -doc_scroll;
-	for(p=docs; *p; p++) {
-		if(*p == '\r' && *(++p) != '\n') *(--p)= '\n'; /* Fix line endings */
-		if(*p == ' ' || *p == '\t')
-			br= i;
-		else if(*p == '\n') {
-			buf[i]= '\0';
-			if(lines>=0) {
+	i = 0; br = DOC_WIDTH; lines = 0; // XXX -doc_scroll;
+	for (p = docs; *p; p++) {
+		if (*p == '\r' && *(++p) != '\n') *(--p) = '\n';  /* Fix line endings */
+		if (*p == ' ' || *p == '\t')
+			br = i;
+		else if (*p == '\n') {
+			buf[i] = '\0';
+			if (lines >= 0) {
 				y -= st->lheight;
-				text_draw(st, buf, 0, 0, 1, x+4, y-3, NULL);
+				text_draw(st, buf, 0, 0, 1, x + 4, y - 3, NULL);
 			}
-			i= 0; br= DOC_WIDTH; lines++;
+			i = 0; br = DOC_WIDTH; lines++;
 		}
-		buf[i++]= *p;
-		if(i == DOC_WIDTH) { /* Reached the width, go to last break and wrap there */
-			buf[br]= '\0';
-			if(lines>=0) {
+		buf[i++] = *p;
+		if (i == DOC_WIDTH) { /* Reached the width, go to last break and wrap there */
+			buf[br] = '\0';
+			if (lines >= 0) {
 				y -= st->lheight;
-				text_draw(st, buf, 0, 0, 1, x+4, y-3, NULL);
+				text_draw(st, buf, 0, 0, 1, x + 4, y - 3, NULL);
 			}
-			p -= i-br-1; /* Rewind pointer to last break */
-			i= 0; br= DOC_WIDTH; lines++;
+			p -= i - br - 1; /* Rewind pointer to last break */
+			i = 0; br = DOC_WIDTH; lines++;
 		}
-		if(lines >= DOC_HEIGHT) break;
+		if (lines >= DOC_HEIGHT) break;
 	}
 
-	if(0 /* XXX doc_scroll*/ > 0 && lines < DOC_HEIGHT) {
+	if (0 /* XXX doc_scroll*/ > 0 && lines < DOC_HEIGHT) {
 		// XXX doc_scroll--;
 		draw_documentation(st, ar);
 	}
@@ -1405,45 +1420,45 @@ static void draw_suggestion_list(SpaceText *st, ARegion *ar)
 {
 	SuggItem *item, *first, *last, *sel;
 	TextLine *tmp;
-	char str[SUGG_LIST_WIDTH+1];
-	int w, boxw=0, boxh, i, l, x, y, b, *top;
+	char str[SUGG_LIST_WIDTH + 1];
+	int w, boxw = 0, boxh, i, l, x, y, b, *top;
 	
-	if(!st || !st->text) return;
-	if(!texttool_text_is_active(st->text)) return;
+	if (!st || !st->text) return;
+	if (!texttool_text_is_active(st->text)) return;
 
 	first = texttool_suggest_first();
 	last = texttool_suggest_last();
 
-	if(!first || !last) return;
+	if (!first || !last) return;
 
 	text_pop_suggest_list();
 	sel = texttool_suggest_selected();
 	top = texttool_suggest_top();
 
 	/* Count the visible lines to the cursor */
-	for(tmp=st->text->curl, l=-st->top; tmp; tmp=tmp->prev, l++);
-	if(l<0) return;
+	for (tmp = st->text->curl, l = -st->top; tmp; tmp = tmp->prev, l++) ;
+	if (l < 0) return;
 	
-	if(st->showlinenrs) {
-		x = st->cwidth*(st->text->curc-st->left) + TXT_OFFSET + TEXTXLOC - 4;
+	if (st->showlinenrs) {
+		x = st->cwidth * (st->text->curc - st->left) + TXT_OFFSET + TEXTXLOC - 4;
 	}
 	else {
-		x = st->cwidth*(st->text->curc-st->left) + TXT_OFFSET - 4;
+		x = st->cwidth * (st->text->curc - st->left) + TXT_OFFSET - 4;
 	}
-	y = ar->winy - st->lheight*l - 2;
+	y = ar->winy - st->lheight * l - 2;
 
-	boxw = SUGG_LIST_WIDTH*st->cwidth + 20;
-	boxh = SUGG_LIST_SIZE*st->lheight + 8;
+	boxw = SUGG_LIST_WIDTH * st->cwidth + 20;
+	boxh = SUGG_LIST_SIZE * st->lheight + 8;
 	
 	UI_ThemeColor(TH_SHADE1);
-	glRecti(x-1, y+1, x+boxw+1, y-boxh-1);
+	glRecti(x - 1, y + 1, x + boxw + 1, y - boxh - 1);
 	UI_ThemeColor(TH_BACK);
-	glRecti(x, y, x+boxw, y-boxh);
+	glRecti(x, y, x + boxw, y - boxh);
 
 	/* Set the top 'item' of the visible list */
-	for(i=0, item=first; i<*top && item->next; i++, item=item->next);
+	for (i = 0, item = first; i < *top && item->next; i++, item = item->next) ;
 
-	for(i=0; i<SUGG_LIST_SIZE && item; i++, item=item->next) {
+	for (i = 0; i < SUGG_LIST_SIZE && item; i++, item = item->next) {
 
 		y -= st->lheight;
 
@@ -1451,25 +1466,25 @@ static void draw_suggestion_list(SpaceText *st, ARegion *ar)
 
 		w = BLF_width(mono, str);
 		
-		if(item == sel) {
+		if (item == sel) {
 			UI_ThemeColor(TH_SHADE2);
-			glRecti(x+16, y-3, x+16+w, y+st->lheight-3);
+			glRecti(x + 16, y - 3, x + 16 + w, y + st->lheight - 3);
 		}
-		b=1; /* b=1 color block, text is default. b=0 no block, color text */
+		b = 1; /* b=1 color block, text is default. b=0 no block, color text */
 		switch (item->type) {
-			case 'k': UI_ThemeColor(TH_SYNTAX_B); b=0; break;
+			case 'k': UI_ThemeColor(TH_SYNTAX_B); b = 0; break;
 			case 'm': UI_ThemeColor(TH_TEXT); break;
 			case 'f': UI_ThemeColor(TH_SYNTAX_L); break;
 			case 'v': UI_ThemeColor(TH_SYNTAX_N); break;
-			case '?': UI_ThemeColor(TH_TEXT); b=0; break;
+			case '?': UI_ThemeColor(TH_TEXT); b = 0; break;
 		}
-		if(b) {
-			glRecti(x+8, y+2, x+11, y+5);
+		if (b) {
+			glRecti(x + 8, y + 2, x + 11, y + 5);
 			UI_ThemeColor(TH_TEXT);
 		}
-		text_draw(st, str, 0, 0, 1, x+16, y-1, NULL);
+		text_draw(st, str, 0, 0, 1, x + 16, y - 1, NULL);
 
-		if(item == last) break;
+		if (item == last) break;
 	}
 }
 
@@ -1477,12 +1492,12 @@ static void draw_suggestion_list(SpaceText *st, ARegion *ar)
 
 static void draw_cursor(SpaceText *st, ARegion *ar)
 {
-	Text *text= st->text;
-	int vcurl, vcurc, vsell, vselc, hidden=0;
+	Text *text = st->text;
+	int vcurl, vcurc, vsell, vselc, hidden = 0;
 	int x, y, w, i;
 
 	/* Draw the selection */
-	if(text->curl!=text->sell || text->curc!=text->selc) {
+	if (text->curl != text->sell || text->curc != text->selc) {
 		int offl, offc;
 		/* Convert all to view space character coordinates */
 		wrap_offset(st, ar, text->curl, text->curc, &offl, &offc);
@@ -1492,38 +1507,38 @@ static void draw_cursor(SpaceText *st, ARegion *ar)
 		vsell = txt_get_span(text->lines.first, text->sell) - st->top + offl;
 		vselc = text_get_char_pos(st, text->sell->line, text->selc) - st->left + offc;
 
-		if(vcurc<0) vcurc=0;
-		if(vselc<0) vselc=0, hidden=1;
+		if (vcurc < 0) vcurc = 0;
+		if (vselc < 0) vselc = 0, hidden = 1;
 		
 		UI_ThemeColor(TH_SHADE2);
-		x= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
-		y= ar->winy-2;
+		x = st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
+		y = ar->winy - 2;
 
-		if(vcurl==vsell) {
-			y -= vcurl*st->lheight;
-			if(vcurc < vselc)
-				glRecti(x+vcurc*st->cwidth-1, y, x+vselc*st->cwidth, y-st->lheight);
+		if (vcurl == vsell) {
+			y -= vcurl * st->lheight;
+			if (vcurc < vselc)
+				glRecti(x + vcurc * st->cwidth - 1, y, x + vselc * st->cwidth, y - st->lheight);
 			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 - st->lheight);
 		}
 		else {
 			int froml, fromc, tol, toc;
 
-			if(vcurl < vsell) {
-				froml= vcurl; tol= vsell;
-				fromc= vcurc; toc= vselc;
+			if (vcurl < vsell) {
+				froml = vcurl; tol = vsell;
+				fromc = vcurc; toc = vselc;
 			}
 			else {
-				froml= vsell; tol= vcurl;
-				fromc= vselc; toc= vcurc;
+				froml = vsell; tol = vcurl;
+				fromc = vselc; toc = vcurc;
 			}
 
-			y -= froml*st->lheight;
-			glRecti(x+fromc*st->cwidth-1, y, ar->winx, y-st->lheight); y-=st->lheight;
-			for(i=froml+1; i<tol; i++)
-				glRecti(x-4, y, ar->winx, y-st->lheight),  y-=st->lheight;
+			y -= froml * st->lheight;
+			glRecti(x + fromc * st->cwidth - 1, y, ar->winx, y - st->lheight); y -= st->lheight;
+			for (i = froml + 1; i < tol; i++)
+				glRecti(x - 4, y, ar->winx, y - st->lheight),  y -= st->lheight;
 
-			glRecti(x-4, y, x+toc*st->cwidth, y-st->lheight);  y-=st->lheight;
+			glRecti(x - 4, y, x + toc * st->cwidth, y - st->lheight);  y -= st->lheight;
 		}
 	}
 	else {
@@ -1532,59 +1547,60 @@ static void draw_cursor(SpaceText *st, ARegion *ar)
 		vsell = txt_get_span(text->lines.first, text->sell) - st->top + offl;
 		vselc = text_get_char_pos(st, text->sell->line, text->selc) - st->left + offc;
 
-		if(vselc<0) {
-			vselc= 0;
-			hidden= 1;
+		if (vselc < 0) {
+			vselc = 0;
+			hidden = 1;
 		}
 	}
 
-	if(st->line_hlight) {
+	if (st->line_hlight) {
 		int x1, x2, y1, y2;
 
-		if(st->wordwrap) {
+		if (st->wordwrap) {
 			int visible_lines = text_get_visible_lines(st, ar, text->sell->line);
 			int offl, offc;
 
 			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;
-		} else {
-			y1= ar->winy-2 - vsell*st->lheight;
-			y2= y1-st->lheight+1;
+			y1 = ar->winy - 2 - (vsell - offl) * st->lheight;
+			y2 = y1 - st->lheight * visible_lines + 1;
+		}
+		else {
+			y1 = ar->winy - 2 - vsell * st->lheight;
+			y2 = y1 - st->lheight + 1;
 		}
 
-		if(!(y1<0 || y2 > ar->winy)) { /* check we need to draw */
-			x1= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
-			x2= x1 + ar->winx;
+		if (!(y1 < 0 || y2 > ar->winy)) { /* check we need to draw */
+			x1 = st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
+			x2 = x1 + ar->winx;
 
 			glColor4ub(255, 255, 255, 32);
 			
 			glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 			glEnable(GL_BLEND);
-			glRecti(x1-4, y1, x2, y2);
+			glRecti(x1 - 4, y1, x2, y2);
 			glDisable(GL_BLEND);
 		}
 	}
 	
-	if(!hidden) {
+	if (!hidden) {
 		/* 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;
+		x = st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
+		x += vselc * st->cwidth;
+		y = ar->winy - 2 - vsell * st->lheight;
 		
-		if(st->overwrite) {
-			char ch= text->sell->line[text->selc];
+		if (st->overwrite) {
+			char ch = text->sell->line[text->selc];
 			
-			w= st->cwidth;
-			if(ch=='\t')  w*= st->tabnumber-(vselc+st->left)%st->tabnumber;
+			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 - st->lheight - 1, x + w, y - st->lheight + 1);
 		}
 		else {
 			UI_ThemeColor(TH_HILITE);
-			glRecti(x-1, y, x+1, y-st->lheight);
+			glRecti(x - 1, y, x + 1, y - st->lheight);
 		}
 	}
 }
@@ -1601,118 +1617,118 @@ static void draw_brackets(SpaceText *st, ARegion *ar)
 	char ch;
 
 	// showsyntax must be on or else the format string will be null
-	if(!text->curl || !st->showsyntax) return;
-
-	startl= text->curl;
-	startc= text->curc;
-	b= text_check_bracket(startl->line[startc]);
-	if(b==0 && startc>0) b = text_check_bracket(startl->line[--startc]);
-	if(b==0) return;
+	if (!text->curl || !st->showsyntax) return;
+
+	startl = text->curl;
+	startc = text->curc;
+	b = text_check_bracket(startl->line[startc]);
+	if (b == 0 && startc > 0) b = text_check_bracket(startl->line[--startc]);
+	if (b == 0) return;
+
+	linep = startl;
+	c = startc;
+	fc = txt_utf8_offset_to_index(linep->line, startc);
+	endl = NULL;
+	endc = -1;
+	find = -b;
+	stack = 0;
 	
-	linep= startl;
-	c= startc;
-	fc= txt_utf8_offset_to_index(linep->line, startc);
-	endl= NULL;
-	endc= -1;
-	find= -b;
-	stack= 0;
-	
-	/* Dont highlight backets if syntax HL is off or bracket in string or comment. */
-	if(!linep->format || linep->format[fc] == 'l' || linep->format[fc] == '#')
+	/* Don't highlight backets if syntax HL is off or bracket in string or comment. */
+	if (!linep->format || linep->format[fc] == 'l' || linep->format[fc] == '#')
 		return;
 
-	if(b>0) {
+	if (b > 0) {
 		/* opening bracket, search forward for close */
 		fc++;
-		c+= BLI_str_utf8_size(linep->line+c);
-		while(linep) {
-			while(c<linep->len) {
-				if(linep->format && linep->format[fc] != 'l' && linep->format[fc] != '#') {
-					b= text_check_bracket(linep->line[c]);
-					if(b==find) {
-						if(stack==0) {
-							endl= linep;
-							endc= c;
+		c += BLI_str_utf8_size(linep->line + c);
+		while (linep) {
+			while (c < linep->len) {
+				if (linep->format && linep->format[fc] != 'l' && linep->format[fc] != '#') {
+					b = text_check_bracket(linep->line[c]);
+					if (b == find) {
+						if (stack == 0) {
+							endl = linep;
+							endc = c;
 							break;
 						}
 						stack--;
 					}
-					else if(b==-find) {
+					else if (b == -find) {
 						stack++;
 					}
 				}
 				fc++;
-				c+= BLI_str_utf8_size(linep->line+c);
+				c += BLI_str_utf8_size(linep->line + c);
 			}
-			if(endl) break;
-			linep= linep->next;
-			c= 0;
-			fc= 0;
+			if (endl) break;
+			linep = linep->next;
+			c = 0;
+			fc = 0;
 		}
 	}
 	else {
 		/* closing bracket, search backward for open */
 		fc--;
-		if (c>0) c -= linep->line+c-BLI_str_prev_char_utf8(linep->line+c);
-		while(linep) {
-			while(fc>=0) {
-				if(linep->format && linep->format[fc] != 'l' && linep->format[fc] != '#') {
-					b= text_check_bracket(linep->line[c]);
-					if(b==find) {
-						if(stack==0) {
-							endl= linep;
-							endc= c;
+		if (c > 0) c -= linep->line + c - BLI_str_prev_char_utf8(linep->line + c);
+		while (linep) {
+			while (fc >= 0) {
+				if (linep->format && linep->format[fc] != 'l' && linep->format[fc] != '#') {
+					b = text_check_bracket(linep->line[c]);
+					if (b == find) {
+						if (stack == 0) {
+							endl = linep;
+							endc = c;
 							break;
 						}
 						stack--;
 					}
-					else if(b==-find) {
+					else if (b == -find) {
 						stack++;
 					}
 				}
 				fc--;
-				if (c>0) c -= linep->line+c-BLI_str_prev_char_utf8(linep->line+c);
+				if (c > 0) c -= linep->line + c - BLI_str_prev_char_utf8(linep->line + c);
 			}
-			if(endl) break;
-			linep= linep->prev;
-			if(linep) {
-				if (linep->format) fc= strlen(linep->format)-1;
-				else fc= -1;
-				if (linep->len) c= BLI_str_prev_char_utf8(linep->line+linep->len)-linep->line;
-				else fc= -1;
+			if (endl) break;
+			linep = linep->prev;
+			if (linep) {
+				if (linep->format) fc = strlen(linep->format) - 1;
+				else fc = -1;
+				if (linep->len) c = BLI_str_prev_char_utf8(linep->line + linep->len) - linep->line;
+				else fc = -1;
 			}
 		}
 	}
 
-	if(!endl || endc==-1)
+	if (!endl || endc == -1)
 		return;
 
 	UI_ThemeColor(TH_HILITE);	
-	x= st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
-	y= ar->winy - st->lheight;
+	x = st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
+	y = ar->winy - st->lheight;
 
 	/* draw opening bracket */
-	ch= startl->line[startc];
+	ch = startl->line[startc];
 	wrap_offset(st, ar, startl, startc, &offl, &offc);
-	viewc= text_get_char_pos(st, startl->line, startc) - st->left + offc;
+	viewc = text_get_char_pos(st, startl->line, startc) - st->left + offc;
 
-	if(viewc >= 0){
-		viewl= txt_get_span(text->lines.first, startl) - st->top + offl;
+	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, ch);
+		text_font_draw_character(st, x + viewc * st->cwidth + 1, y - viewl * st->lheight, ch);
 	}
 
 	/* draw closing bracket */
-	ch= endl->line[endc];
+	ch = endl->line[endc];
 	wrap_offset(st, ar, endl, endc, &offl, &offc);
-	viewc= text_get_char_pos(st, endl->line, endc) - st->left + offc;
+	viewc = text_get_char_pos(st, endl->line, endc) - st->left + offc;
 
-	if(viewc >= 0) {
-		viewl= txt_get_span(text->lines.first, endl) - st->top + offl;
+	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, ch);
+		text_font_draw_character(st, x + viewc * st->cwidth + 1, y - viewl * st->lheight, ch);
 	}
 }
 
@@ -1720,49 +1736,51 @@ static void draw_brackets(SpaceText *st, ARegion *ar)
 
 void draw_text_main(SpaceText *st, ARegion *ar)
 {
-	Text *text= st->text;
+	Text *text = st->text;
 	TextLine *tmp;
 	rcti scroll, back;
 	char linenr[12];
-	int i, x, y, winx, linecount= 0, lineno= 0;
-	int wraplinecount= 0, wrap_skip= 0;
+	int i, x, y, winx, linecount = 0, lineno = 0;
+	int wraplinecount = 0, wrap_skip = 0;
 
-	if(st->lheight) st->viewlines= (int)ar->winy/st->lheight;
-	else st->viewlines= 0;
+	if (st->lheight) st->viewlines = (int)ar->winy / st->lheight;
+	else st->viewlines = 0;
 
 	/* if no text, nothing to do */
-	if(!text)
+	if (!text)
 		return;
 	
 	text_update_drawcache(st, ar);
 
 	/* make sure all the positional pointers exist */
-	if(!text->curl || !text->sell || !text->lines.first || !text->lines.last)
+	if (!text->curl || !text->sell || !text->lines.first || !text->lines.last)
 		txt_clean_text(text);
 	
 	/* update rects for scroll */
-	calc_text_rcts(st, ar, &scroll, &back);	/* scroll will hold the entire bar size */
+	calc_text_rcts(st, ar, &scroll, &back); /* scroll will hold the entire bar size */
 
 	/* update syntax formatting if needed */
-	tmp= text->lines.first;
-	lineno= 0;
-	for(i= 0; i<st->top && tmp; i++) {
-		if(st->showsyntax && !tmp->format)
+	tmp = text->lines.first;
+	lineno = 0;
+	for (i = 0; i < st->top && tmp; i++) {
+		if (st->showsyntax && !tmp->format)
 			txt_format_line(st, tmp, 0);
 
-		if(st->wordwrap) {
-			int lines= text_get_visible_lines_no(st, lineno);
+		if (st->wordwrap) {
+			int lines = text_get_visible_lines_no(st, lineno);
 
-			if (wraplinecount+lines>st->top) {
-				wrap_skip= st->top-wraplinecount;
+			if (wraplinecount + lines > st->top) {
+				wrap_skip = st->top - wraplinecount;
 				break;
-			} else {
-				wraplinecount+= lines;
-				tmp= tmp->next;
+			}
+			else {
+				wraplinecount += lines;
+				tmp = tmp->next;
 				linecount++;
 			}
-		} else {
-			tmp= tmp->next;
+		}
+		else {
+			tmp = tmp->next;
 			linecount++;
 		}
 
@@ -1770,22 +1788,22 @@ 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 = BLF_fixed_width(mono);
+	st->cwidth = MAX2(st->cwidth, 1);
 
 	/* draw line numbers background */
-	if(st->showlinenrs) {
-		x= TXT_OFFSET + TEXTXLOC;
+	if (st->showlinenrs) {
+		x = TXT_OFFSET + TEXTXLOC;
 
 		UI_ThemeColor(TH_GRID);
-		glRecti((TXT_OFFSET-12), 0, (TXT_OFFSET-5) + TEXTXLOC, ar->winy - 2);
+		glRecti((TXT_OFFSET - 12), 0, (TXT_OFFSET - 5) + TEXTXLOC, ar->winy - 2);
 	}
 	else {
-		st->linenrs_tot= 0; /* not used */
-		x= TXT_OFFSET;
+		st->linenrs_tot = 0; /* not used */
+		x = TXT_OFFSET;
 	}
-	y= ar->winy-st->lheight;
-	winx= ar->winx - TXT_SCROLL_WIDTH;
+	y = ar->winy - st->lheight;
+	winx = ar->winx - TXT_SCROLL_WIDTH;
 	
 	/* draw cursor */
 	draw_cursor(st, ar);
@@ -1793,13 +1811,13 @@ void draw_text_main(SpaceText *st, ARegion *ar)
 	/* draw the text */
 	UI_ThemeColor(TH_TEXT);
 
-	for(i=0; y>0 && i<st->viewlines && tmp; i++, tmp= tmp->next) {
-		if(st->showsyntax && !tmp->format)
+	for (i = 0; y > 0 && i < st->viewlines && tmp; i++, tmp = tmp->next) {
+		if (st->showsyntax && !tmp->format)
 			txt_format_line(st, tmp, 0);
 
-		if(st->showlinenrs && !wrap_skip) {
+		if (st->showlinenrs && !wrap_skip) {
 			/* draw line number */
-			if(tmp == text->curl)
+			if (tmp == text->curl)
 				UI_ThemeColor(TH_HILITE);
 			else
 				UI_ThemeColor(TH_TEXT);
@@ -1811,26 +1829,26 @@ void draw_text_main(SpaceText *st, ARegion *ar)
 			UI_ThemeColor(TH_TEXT);
 		}
 
-		if(st->wordwrap) {
+		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;
+			int lines = text_draw_wrapped(st, tmp->line, x, y, winx - x, tmp->format, wrap_skip);
+			y -= lines * st->lheight;
 		}
 		else {
 			/* draw unwrapped text */
-			text_draw(st, tmp->line, st->left, ar->winx/st->cwidth, 1, x, y, tmp->format);
+			text_draw(st, tmp->line, st->left, ar->winx / st->cwidth, 1, x, y, tmp->format);
 			y -= st->lheight;
 		}
 
-		wrap_skip= 0;
+		wrap_skip = 0;
 	}
 	
-	if(st->flags&ST_SHOW_MARGIN) {
+	if (st->flags & ST_SHOW_MARGIN) {
 		UI_ThemeColor(TH_HILITE);
 
 		glBegin(GL_LINES);
-		glVertex2i(x+st->cwidth*st->margin_column, 0);
-		glVertex2i(x+st->cwidth*st->margin_column, ar->winy - 2);
+		glVertex2i(x + st->cwidth * st->margin_column, 0);
+		glVertex2i(x + st->cwidth * st->margin_column, ar->winy - 2);
 		glEnd();
 	}
 
@@ -1850,26 +1868,26 @@ void draw_text_main(SpaceText *st, ARegion *ar)
 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 = BLF_fixed_width(mono);
+	st->cwidth = MAX2(st->cwidth, 1);
 	text_font_end(st);
 }
 
 /* Moves the view to the cursor location,
-  also used to make sure the view isnt outside the file */
+ * also used to make sure the view isn't outside the file */
 void text_scroll_to_cursor(SpaceText *st, ScrArea *sa)
 {
 	Text *text;
-	ARegion *ar= NULL;
-	int i, x, winx= 0;
+	ARegion *ar = NULL;
+	int i, x, winx = 0;
 
-	if(ELEM3(NULL, st, st->text, st->text->curl)) return;
+	if (ELEM3(NULL, st, st->text, st->text->curl)) return;
 
-	text= st->text;
+	text = st->text;
 
-	for(ar=sa->regionbase.first; ar; ar= ar->next)
-		if(ar->regiontype==RGN_TYPE_WINDOW) {
-			winx= ar->winx;
+	for (ar = sa->regionbase.first; ar; ar = ar->next)
+		if (ar->regiontype == RGN_TYPE_WINDOW) {
+			winx = ar->winx;
 			break;
 		}
 	
@@ -1877,34 +1895,34 @@ void text_scroll_to_cursor(SpaceText *st, ScrArea *sa)
 
 	text_update_character_width(st);
 
-	i= txt_get_span(text->lines.first, text->sell);
-	if(st->wordwrap) {
+	i = txt_get_span(text->lines.first, text->sell);
+	if (st->wordwrap) {
 		int offl, offc;
 		wrap_offset(st, ar, text->sell, text->selc, &offl, &offc);
-		i+= offl;
+		i += offl;
 	}
 
-	if(st->top+st->viewlines <= i || st->top > i)
-		st->top= i - st->viewlines/2;
+	if (st->top + st->viewlines <= i || st->top > i)
+		st->top = i - st->viewlines / 2;
 	
-	if(st->wordwrap) {
-		st->left= 0;
+	if (st->wordwrap) {
+		st->left = 0;
 	}
 	else {
-		x= text_draw(st, text->sell->line, st->left, text->selc, 0, 0, 0, NULL);
+		x = text_draw(st, text->sell->line, st->left, text->selc, 0, 0, 0, NULL);
 
-		if(x==0 || x>winx)
-			st->left= text->curc-0.5*winx/st->cwidth;
+		if (x == 0 || x > winx)
+			st->left = text->curc - 0.5 * winx / st->cwidth;
 	}
 
-	if(st->top < 0) st->top= 0;
-	if(st->left <0) st->left= 0;
+	if (st->top < 0) st->top = 0;
+	if (st->left < 0) st->left = 0;
 }
 
 void text_update_cursor_moved(bContext *C)
 {
-	ScrArea *sa= CTX_wm_area(C);
-	SpaceText *st= CTX_wm_space_text(C);
+	ScrArea *sa = CTX_wm_area(C);
+	SpaceText *st = CTX_wm_space_text(C);
 
 	text_scroll_to_cursor(st, sa);
 }
diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c
index b8e53f7..b0cd6ae 100644
--- a/source/blender/editors/space_text/text_header.c
+++ b/source/blender/editors/space_text/text_header.c
@@ -39,10 +39,10 @@
 #include <sys/stat.h>
 
 #ifndef _WIN32
-#include <unistd.h>
+#  include <unistd.h>
 #else
-#include <io.h>
-#include "BLI_winstuff.h"
+#  include <io.h>
+#  include "BLI_winstuff.h"
 #endif
 
 #include "DNA_windowmanager_types.h"
@@ -68,7 +68,7 @@
 
 #include "text_intern.h"
 
-#define HEADER_PATH_MAX	260
+#define HEADER_PATH_MAX 260
 
 /* ************************ header area region *********************** */
 
@@ -78,20 +78,20 @@ static ARegion *text_has_properties_region(ScrArea *sa)
 {
 	ARegion *ar, *arnew;
 
-	ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
-	if(ar) return ar;
+	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), "properties region");
+	arnew = MEM_callocN(sizeof(ARegion), "properties region");
 	
 	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;
 	
@@ -105,10 +105,10 @@ static int text_properties_poll(bContext *C)
 
 static int text_properties_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	ScrArea *sa= CTX_wm_area(C);
-	ARegion *ar= text_has_properties_region(sa);
+	ScrArea *sa = CTX_wm_area(C);
+	ARegion *ar = text_has_properties_region(sa);
 	
-	if(ar)
+	if (ar)
 		ED_region_toggle_hidden(C, ar);
 
 	return OPERATOR_FINISHED;
@@ -117,13 +117,13 @@ static int text_properties_exec(bContext *C, wmOperator *UNUSED(op))
 void TEXT_OT_properties(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Properties";
-	ot->description= "Toggle text properties panel";
-	ot->idname= "TEXT_OT_properties";
+	ot->name = "Properties";
+	ot->description = "Toggle text properties panel";
+	ot->idname = "TEXT_OT_properties";
 	
 	/* api callbacks */
-	ot->exec= text_properties_exec;
-	ot->poll= text_properties_poll;
+	ot->exec = text_properties_exec;
+	ot->poll = text_properties_poll;
 }
 
 /******************** XXX popup menus *******************/
@@ -134,9 +134,9 @@ void TEXT_OT_properties(wmOperatorType *ot)
 
 	uiPopupMenu *pup;
 
-	if(text) {
-		pup= uiPupMenuBegin(C, "Text", ICON_NONE);
-		if(txt_has_sel(text)) {
+	if (text) {
+		pup = uiPupMenuBegin(C, "Text", ICON_NONE);
+		if (txt_has_sel(text)) {
 			uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_cut");
 			uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_copy");
 		}
@@ -149,7 +149,7 @@ void TEXT_OT_properties(wmOperatorType *ot)
 		uiPupMenuEnd(C, pup);
 	}
 	else {
-		pup= uiPupMenuBegin(C, "File", ICON_NONE);
+		pup = uiPupMenuBegin(C, "File", ICON_NONE);
 		uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_new");
 		uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_open");
 		uiPupMenuEnd(C, pup);
@@ -161,7 +161,7 @@ void TEXT_OT_properties(wmOperatorType *ot)
 
 	uiPopupMenu *pup;
 
-	pup= uiPupMenuBegin(C, "Edit", ICON_NONE);
+	pup = uiPupMenuBegin(C, "Edit", ICON_NONE);
 	uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_cut");
 	uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_copy");
 	uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_paste");
@@ -173,8 +173,8 @@ void TEXT_OT_properties(wmOperatorType *ot)
 
 	uiPopupMenu *pup;
 
-	if(text) {
-		pup= uiPupMenuBegin(C, "Text", ICON_NONE);
+	if (text) {
+		pup = uiPupMenuBegin(C, "Text", ICON_NONE);
 		uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_new");
 		uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_open");
 		uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_save");
@@ -183,7 +183,7 @@ void TEXT_OT_properties(wmOperatorType *ot)
 		uiPupMenuEnd(C, pup);
 	}
 	else {
-		pup= uiPupMenuBegin(C, "File", ICON_NONE);
+		pup = uiPupMenuBegin(C, "File", ICON_NONE);
 		uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_new");
 		uiItemO(layout, NULL, ICON_NONE, "TEXT_OT_open");
 		uiPupMenuEnd(C, pup);
@@ -195,7 +195,7 @@ void TEXT_OT_properties(wmOperatorType *ot)
 
 	uiPopupMenu *pup;
 
-	pup= uiPupMenuBegin(C, "Text", ICON_NONE);
+	pup = uiPupMenuBegin(C, "Text", ICON_NONE);
 	uiItemEnumO(layout, "TEXT_OT_move", "Top of File", 0, "type", FILE_TOP);
 	uiItemEnumO(layout, "TEXT_OT_move", "Bottom of File", 0, "type", FILE_BOTTOM);
 	uiItemEnumO(layout, "TEXT_OT_move", "Page Up", 0, "type", PREV_PAGE);
diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h
index 043fb97..2d297dd 100644
--- a/source/blender/editors/space_text/text_intern.h
+++ b/source/blender/editors/space_text/text_intern.h
@@ -28,8 +28,8 @@
  *  \ingroup sptext
  */
 
-#ifndef ED_TEXT_INTERN_H
-#define ED_TEXT_INTERN_H
+#ifndef __TEXT_INTERN_H__
+#define __TEXT_INTERN_H__
 
 /* internal exports only */
 
@@ -163,5 +163,5 @@ void TEXT_OT_resolve_conflict(struct wmOperatorType *ot);
 /* space_text.c */
 extern const char *text_context_dir[]; /* doc access */
 
-#endif /* ED_TEXT_INTERN_H */
+#endif /* __TEXT_INTERN_H__ */
 
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index db8c1b2..730dfb7 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -73,6 +73,13 @@
 
 /************************ poll ***************************/
 
+
+BLI_INLINE int text_pixel_x_to_index(SpaceText *st, const int x)
+{
+	/* add half the char width so mouse cursor selection is inbetween letters */
+	return (x + (st->cwidth / 2)) / st->cwidth;
+}
+
 static int text_new_poll(bContext *UNUSED(C))
 {
 	return 1;
@@ -80,12 +87,12 @@ static int text_new_poll(bContext *UNUSED(C))
 
 static int text_edit_poll(bContext *C)
 {
-	Text *text= CTX_data_edit_text(C);
+	Text *text = CTX_data_edit_text(C);
 
-	if(!text)
+	if (!text)
 		return 0;
 
-	if(text->id.lib) {
+	if (text->id.lib) {
 		// BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata");
 		return 0;
 	}
@@ -95,13 +102,13 @@ static int text_edit_poll(bContext *C)
 
 static int text_space_edit_poll(bContext *C)
 {
-	SpaceText *st= CTX_wm_space_text(C);
-	Text *text= CTX_data_edit_text(C);
+	SpaceText *st = CTX_wm_space_text(C);
+	Text *text = CTX_data_edit_text(C);
 
-	if(!st || !text)
+	if (!st || !text)
 		return 0;
 
-	if(text->id.lib) {
+	if (text->id.lib) {
 		// BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata");
 		return 0;
 	}
@@ -111,17 +118,17 @@ static int text_space_edit_poll(bContext *C)
 
 static int text_region_edit_poll(bContext *C)
 {
-	SpaceText *st= CTX_wm_space_text(C);
-	Text *text= CTX_data_edit_text(C);
-	ARegion *ar= CTX_wm_region(C);
+	SpaceText *st = CTX_wm_space_text(C);
+	Text *text = CTX_data_edit_text(C);
+	ARegion *ar = CTX_wm_region(C);
 
-	if(!st || !text)
+	if (!st || !text)
 		return 0;
 	
-	if(!ar || ar->regiontype != RGN_TYPE_WINDOW)
+	if (!ar || ar->regiontype != RGN_TYPE_WINDOW)
 		return 0;
 
-	if(text->id.lib) {
+	if (text->id.lib) {
 		// BKE_report(op->reports, RPT_ERROR, "Can't edit external libdata");
 		return 0;
 	}
@@ -133,13 +140,13 @@ static int text_region_edit_poll(bContext *C)
 
 void text_update_line_edited(TextLine *line)
 {
-	if(!line)
+	if (!line)
 		return;
 
 	/* we just free format here, and let it rebuild during draw */
-	if(line->format) {
+	if (line->format) {
 		MEM_freeN(line->format);
-		line->format= NULL;
+		line->format = NULL;
 	}
 }
 
@@ -147,7 +154,7 @@ void text_update_edited(Text *text)
 {
 	TextLine *line;
 
-	for(line=text->lines.first; line; line=line->next)
+	for (line = text->lines.first; line; line = line->next)
 		text_update_line_edited(line);
 }
 
@@ -155,34 +162,34 @@ void text_update_edited(Text *text)
 
 static int text_new_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	SpaceText *st= CTX_wm_space_text(C);
+	SpaceText *st = CTX_wm_space_text(C);
 	Text *text;
 	PointerRNA ptr, idptr;
 	PropertyRNA *prop;
 
-	text= add_empty_text("Text");
+	text = add_empty_text("Text");
 
 	/* hook into UI */
 	uiIDContextProperty(C, &ptr, &prop);
 
-	if(prop) {
+	if (prop) {
 		/* when creating new ID blocks, use is already 1, but RNA
 		 * pointer se also increases user, so this compensates it */
 		/* doesnt always seem to happen... (ton) */
-		if(text->id.us>1)
+		if (text->id.us > 1)
 			text->id.us--;
 
 		RNA_id_pointer_create(&text->id, &idptr);
 		RNA_property_pointer_set(&ptr, prop, idptr);
 		RNA_property_update(C, &ptr, prop);
 	}
-	else if(st) {
-		st->text= text;
-		st->top= 0;
+	else if (st) {
+		st->text = text;
+		st->top = 0;
 		text_drawcache_tag_update(st, 1);
 	}
 
-	WM_event_add_notifier(C, NC_TEXT|NA_ADDED, text);
+	WM_event_add_notifier(C, NC_TEXT | NA_ADDED, text);
 
 	return OPERATOR_FINISHED;
 }
@@ -190,16 +197,16 @@ static int text_new_exec(bContext *C, wmOperator *UNUSED(op))
 void TEXT_OT_new(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Create Text Block";
-	ot->idname= "TEXT_OT_new";
-	ot->description= "Create a new text data block";
+	ot->name = "Create Text Block";
+	ot->idname = "TEXT_OT_new";
+	ot->description = "Create a new text data block";
 	
 	/* api callbacks */
-	ot->exec= text_new_exec;
-	ot->poll= text_new_poll;
+	ot->exec = text_new_exec;
+	ot->poll = text_new_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_UNDO;
+	ot->flag = OPTYPE_UNDO;
 }
 
 /******************* open operator *********************/
@@ -208,7 +215,7 @@ static void text_open_init(bContext *C, wmOperator *op)
 {
 	PropertyPointerRNA *pprop;
 
-	op->customdata= pprop= MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA");
+	op->customdata = pprop = MEM_callocN(sizeof(PropertyPointerRNA), "OpenPropertyPointerRNA");
 	uiIDContextProperty(C, &pprop->ptr, &pprop->prop);
 }
 
@@ -220,7 +227,7 @@ static int text_open_cancel(bContext *UNUSED(C), wmOperator *op)
 
 static int text_open_exec(bContext *C, wmOperator *op)
 {
-	SpaceText *st= CTX_wm_space_text(C);
+	SpaceText *st = CTX_wm_space_text(C);
 	Text *text;
 	PropertyPointerRNA *pprop;
 	PointerRNA idptr;
@@ -229,20 +236,20 @@ static int text_open_exec(bContext *C, wmOperator *op)
 
 	RNA_string_get(op->ptr, "filepath", str);
 
-	text= add_text(str, G.main->name);
+	text = add_text(str, G.main->name);
 
-	if(!text) {
-		if(op->customdata) MEM_freeN(op->customdata);
+	if (!text) {
+		if (op->customdata) MEM_freeN(op->customdata);
 		return OPERATOR_CANCELLED;
 	}
 
-	if(!op->customdata)
+	if (!op->customdata)
 		text_open_init(C, op);
 
 	/* hook into UI */
-	pprop= op->customdata;
+	pprop = op->customdata;
 
-	if(pprop->prop) {
+	if (pprop->prop) {
 		/* when creating new ID blocks, use is already 1, but RNA
 		 * pointer se also increases user, so this compensates it */
 		text->id.us--;
@@ -251,20 +258,20 @@ static int text_open_exec(bContext *C, wmOperator *op)
 		RNA_property_pointer_set(&pprop->ptr, pprop->prop, idptr);
 		RNA_property_update(C, &pprop->ptr, pprop->prop);
 	}
-	else if(st) {
-		st->text= text;
-		st->top= 0;
+	else if (st) {
+		st->text = text;
+		st->top = 0;
 	}
 	
 	if (internal) {
-		if(text->name)
+		if (text->name)
 			MEM_freeN(text->name);
 		
 		text->name = NULL;
 	}
 
 	text_drawcache_tag_update(st, 1);
-	WM_event_add_notifier(C, NC_TEXT|NA_ADDED, text);
+	WM_event_add_notifier(C, NC_TEXT | NA_ADDED, text);
 
 	MEM_freeN(op->customdata);
 
@@ -273,10 +280,10 @@ static int text_open_exec(bContext *C, wmOperator *op)
 
 static int text_open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	Text *text= CTX_data_edit_text(C);
-	char *path= (text && text->name)? text->name: G.main->name;
+	Text *text = CTX_data_edit_text(C);
+	char *path = (text && text->name) ? text->name : G.main->name;
 
-	if(RNA_struct_property_is_set(op->ptr, "filepath"))
+	if (RNA_struct_property_is_set(op->ptr, "filepath"))
 		return text_open_exec(C, op);
 	
 	text_open_init(C, op);
@@ -289,21 +296,21 @@ static int text_open_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 void TEXT_OT_open(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Open Text Block";
-	ot->idname= "TEXT_OT_open";
-	ot->description= "Open a new text data block";
+	ot->name = "Open Text Block";
+	ot->idname = "TEXT_OT_open";
+	ot->description = "Open a new text data block";
 
 	/* api callbacks */
-	ot->exec= text_open_exec;
-	ot->invoke= text_open_invoke;
-	ot->cancel= text_open_cancel;
-	ot->poll= text_new_poll;
+	ot->exec = text_open_exec;
+	ot->invoke = text_open_invoke;
+	ot->cancel = text_open_cancel;
+	ot->poll = text_new_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_UNDO;
+	ot->flag = OPTYPE_UNDO;
 	
 	/* properties */
-	WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE|PYSCRIPTFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);  //XXX TODO, relative_path
+	WM_operator_properties_filesel(ot, FOLDERFILE | TEXTFILE | PYSCRIPTFILE, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);  //XXX TODO, relative_path
 	RNA_def_boolean(ot->srna, "internal", 0, "Make internal", "Make text file internal after loading");
 }
 
@@ -311,22 +318,22 @@ void TEXT_OT_open(wmOperatorType *ot)
 
 static int text_reload_exec(bContext *C, wmOperator *op)
 {
-	Text *text= CTX_data_edit_text(C);
+	Text *text = CTX_data_edit_text(C);
 
-	if(!reopen_text(text)) {
+	if (!reopen_text(text)) {
 		BKE_report(op->reports, RPT_ERROR, "Could not reopen file");
 		return OPERATOR_CANCELLED;
 	}
 
 #ifdef WITH_PYTHON
-	if(text->compiled)
+	if (text->compiled)
 		BPY_text_free_code(text);
 #endif
 
 	text_update_edited(text);
 	text_update_cursor_moved(C);
 	text_drawcache_tag_update(CTX_wm_space_text(C), 1);
-	WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+	WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
 
 	return OPERATOR_FINISHED;
 }
@@ -334,14 +341,14 @@ static int text_reload_exec(bContext *C, wmOperator *op)
 void TEXT_OT_reload(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Reload";
-	ot->idname= "TEXT_OT_reload";
-	ot->description= "Reload active text data block from its file";
+	ot->name = "Reload";
+	ot->idname = "TEXT_OT_reload";
+	ot->description = "Reload active text data block from its file";
 	
 	/* api callbacks */
-	ot->exec= text_reload_exec;
-	ot->invoke= WM_operator_confirm;
-	ot->poll= text_edit_poll;
+	ot->exec = text_reload_exec;
+	ot->invoke = WM_operator_confirm;
+	ot->poll = text_edit_poll;
 }
 
 /******************* delete operator *********************/
@@ -354,21 +361,21 @@ static int text_unlink_poll(bContext *C)
 
 static int text_unlink_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Main *bmain= CTX_data_main(C);
-	SpaceText *st= CTX_wm_space_text(C);
-	Text *text= CTX_data_edit_text(C);
+	Main *bmain = CTX_data_main(C);
+	SpaceText *st = CTX_wm_space_text(C);
+	Text *text = CTX_data_edit_text(C);
 
 	/* make the previous text active, if its not there make the next text active */
-	if(st) {
-		if(text->id.prev) {
+	if (st) {
+		if (text->id.prev) {
 			st->text = text->id.prev;
 			text_update_cursor_moved(C);
-			WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, st->text);
+			WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text);
 		}
-		else if(text->id.next) {
+		else if (text->id.next) {
 			st->text = text->id.next;
 			text_update_cursor_moved(C);
-			WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, st->text);
+			WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text);
 		}
 	}
 
@@ -376,7 +383,7 @@ static int text_unlink_exec(bContext *C, wmOperator *UNUSED(op))
 	free_libblock(&bmain->text, text);
 
 	text_drawcache_tag_update(st, 1);
-	WM_event_add_notifier(C, NC_TEXT|NA_REMOVED, NULL);
+	WM_event_add_notifier(C, NC_TEXT | NA_REMOVED, NULL);
 
 	return OPERATOR_FINISHED;
 }
@@ -384,34 +391,34 @@ static int text_unlink_exec(bContext *C, wmOperator *UNUSED(op))
 void TEXT_OT_unlink(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Unlink";
-	ot->idname= "TEXT_OT_unlink";
-	ot->description= "Unlink active text data block";
+	ot->name = "Unlink";
+	ot->idname = "TEXT_OT_unlink";
+	ot->description = "Unlink active text data block";
 	
 	/* api callbacks */
-	ot->exec= text_unlink_exec;
-	ot->invoke= WM_operator_confirm;
-	ot->poll= text_unlink_poll;
+	ot->exec = text_unlink_exec;
+	ot->invoke = WM_operator_confirm;
+	ot->poll = text_unlink_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_UNDO;
+	ot->flag = OPTYPE_UNDO;
 }
 
 /******************* make internal operator *********************/
 
 static int text_make_internal_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Text *text= CTX_data_edit_text(C);
+	Text *text = CTX_data_edit_text(C);
 
 	text->flags |= TXT_ISMEM | TXT_ISDIRTY;
 
-	if(text->name) {
+	if (text->name) {
 		MEM_freeN(text->name);
-		text->name= NULL;
+		text->name = NULL;
 	}
 
 	text_update_cursor_moved(C);
-	WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+	WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
 
 	return OPERATOR_FINISHED;
 }
@@ -419,25 +426,25 @@ static int text_make_internal_exec(bContext *C, wmOperator *UNUSED(op))
 void TEXT_OT_make_internal(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Make Internal";
-	ot->idname= "TEXT_OT_make_internal";
-	ot->description= "Make active text file internal";
+	ot->name = "Make Internal";
+	ot->idname = "TEXT_OT_make_internal";
+	ot->description = "Make active text file internal";
 
 	/* api callbacks */
-	ot->exec= text_make_internal_exec;
-	ot->poll= text_edit_poll;
+	ot->exec = text_make_internal_exec;
+	ot->poll = text_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_UNDO;
+	ot->flag = OPTYPE_UNDO;
 }
 
 /******************* save operator *********************/
 
 static int text_save_poll(bContext *C)
 {
-	Text *text= CTX_data_edit_text(C);
+	Text *text = CTX_data_edit_text(C);
 
-	if(!text_edit_poll(C))
+	if (!text_edit_poll(C))
 		return 0;
 	
 	return (text->name != NULL && !(text->flags & TXT_ISMEM));
@@ -453,42 +460,42 @@ static void txt_write_file(Text *text, ReportList *reports)
 	BLI_strncpy(filepath, text->name, FILE_MAX);
 	BLI_path_abs(filepath, G.main->name);
 	
-	fp= fopen(filepath, "w");
-	if(fp==NULL) {
+	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");
 		return;
 	}
 
-	tmp= text->lines.first;
-	while(tmp) {
-		if(tmp->next) fprintf(fp, "%s\n", tmp->line);
+	tmp = text->lines.first;
+	while (tmp) {
+		if (tmp->next) fprintf(fp, "%s\n", tmp->line);
 		else fprintf(fp, "%s", tmp->line);
 		
-		tmp= tmp->next;
+		tmp = tmp->next;
 	}
 	
-	fclose (fp);
+	fclose(fp);
 
-	if(stat(filepath, &st) == 0) {
-		text->mtime= st.st_mtime;
+	if (stat(filepath, &st) == 0) {
+		text->mtime = st.st_mtime;
 	}
 	else {
-		text->mtime= 0;
+		text->mtime = 0;
 		BKE_reportf(reports, RPT_WARNING, "Unable to stat \"%s\": %s", filepath, errno ? strerror(errno) : "Unknown error starrng file");
 	}
 	
-	if(text->flags & TXT_ISDIRTY)
+	if (text->flags & TXT_ISDIRTY)
 		text->flags ^= TXT_ISDIRTY;
 }
 
 static int text_save_exec(bContext *C, wmOperator *op)
 {
-	Text *text= CTX_data_edit_text(C);
+	Text *text = CTX_data_edit_text(C);
 
 	txt_write_file(text, op->reports);
 
 	text_update_cursor_moved(C);
-	WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+	WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
 
 	return OPERATOR_FINISHED;
 }
@@ -496,53 +503,53 @@ static int text_save_exec(bContext *C, wmOperator *op)
 void TEXT_OT_save(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Save";
-	ot->idname= "TEXT_OT_save";
-	ot->description= "Save active text data block";
+	ot->name = "Save";
+	ot->idname = "TEXT_OT_save";
+	ot->description = "Save active text data block";
 
 	/* api callbacks */
-	ot->exec= text_save_exec;
-	ot->poll= text_save_poll;
+	ot->exec = text_save_exec;
+	ot->poll = text_save_poll;
 }
 
 /******************* save as operator *********************/
 
 static int text_save_as_exec(bContext *C, wmOperator *op)
 {
-	Text *text= CTX_data_edit_text(C);
+	Text *text = CTX_data_edit_text(C);
 	char str[FILE_MAX];
 
-	if(!text)
+	if (!text)
 		return OPERATOR_CANCELLED;
 
 	RNA_string_get(op->ptr, "filepath", str);
 
-	if(text->name) MEM_freeN(text->name);
-	text->name= BLI_strdup(str);
+	if (text->name) MEM_freeN(text->name);
+	text->name = BLI_strdup(str);
 	text->flags &= ~TXT_ISMEM;
 
 	txt_write_file(text, op->reports);
 
 	text_update_cursor_moved(C);
-	WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+	WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
 
 	return OPERATOR_FINISHED;
 }
 
 static int text_save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	Text *text= CTX_data_edit_text(C);
+	Text *text = CTX_data_edit_text(C);
 	char *str;
 
-	if(RNA_struct_property_is_set(op->ptr, "filepath"))
+	if (RNA_struct_property_is_set(op->ptr, "filepath"))
 		return text_save_as_exec(C, op);
 
-	if(text->name)
-		str= text->name;
-	else if(text->flags & TXT_ISMEM)
-		str= text->id.name+2;
+	if (text->name)
+		str = text->name;
+	else if (text->flags & TXT_ISMEM)
+		str = text->id.name + 2;
 	else
-		str= G.main->name;
+		str = G.main->name;
 	
 	RNA_string_set(op->ptr, "filepath", str);
 	WM_event_add_fileselect(C, op); 
@@ -553,17 +560,17 @@ static int text_save_as_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
 void TEXT_OT_save_as(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Save As";
-	ot->idname= "TEXT_OT_save_as";
-	ot->description= "Save active text file with options";
+	ot->name = "Save As";
+	ot->idname = "TEXT_OT_save_as";
+	ot->description = "Save active text file with options";
 	
 	/* api callbacks */
-	ot->exec= text_save_as_exec;
-	ot->invoke= text_save_as_invoke;
-	ot->poll= text_edit_poll;
+	ot->exec = text_save_as_exec;
+	ot->invoke = text_save_as_invoke;
+	ot->poll = text_edit_poll;
 
 	/* properties */
-	WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE|PYSCRIPTFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);  //XXX TODO, relative_path
+	WM_operator_properties_filesel(ot, FOLDERFILE | TEXTFILE | PYSCRIPTFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);  //XXX TODO, relative_path
 }
 
 /******************* run script operator *********************/
@@ -576,26 +583,26 @@ static int text_run_script_poll(bContext *C)
 static int text_run_script(bContext *C, ReportList *reports)
 {
 #ifdef WITH_PYTHON
-	Text *text= CTX_data_edit_text(C);
-	const short is_live= (reports == NULL);
+	Text *text = CTX_data_edit_text(C);
+	const short is_live = (reports == NULL);
 
 	/* only for comparison */
-	void *curl_prev= text->curl;
-	int curc_prev= text->curc;
+	void *curl_prev = text->curl;
+	int curc_prev = text->curc;
 
 	if (BPY_text_exec(C, text, reports, !is_live)) {
-		if(is_live) {
+		if (is_live) {
 			/* for nice live updates */
-			WM_event_add_notifier(C, NC_WINDOW|NA_EDITED, NULL);
+			WM_event_add_notifier(C, NC_WINDOW | NA_EDITED, NULL);
 		}
 		return OPERATOR_FINISHED;
 	}
 
-	/* Dont report error messages while live editing */
-	if(!is_live) {
-		if(text->curl != curl_prev || curc_prev != text->curc) {
+	/* Don't report error messages while live editing */
+	if (!is_live) {
+		if (text->curl != curl_prev || curc_prev != text->curc) {
 			text_update_cursor_moved(C);
-			WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+			WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
 		}
 
 		BKE_report(reports, RPT_ERROR, "Python script fail, look in the console for now...");
@@ -623,16 +630,16 @@ static int text_run_script_exec(bContext *C, wmOperator *op)
 void TEXT_OT_run_script(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Run Script";
-	ot->idname= "TEXT_OT_run_script";
-	ot->description= "Run active script";
+	ot->name = "Run Script";
+	ot->idname = "TEXT_OT_run_script";
+	ot->description = "Run active script";
 	
 	/* api callbacks */
-	ot->poll= text_run_script_poll;
-	ot->exec= text_run_script_exec;
+	ot->poll = text_run_script_poll;
+	ot->exec = text_run_script_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /******************* refresh pyconstraints operator *********************/
@@ -641,36 +648,36 @@ static int text_refresh_pyconstraints_exec(bContext *UNUSED(C), wmOperator *UNUS
 {
 #ifdef WITH_PYTHON
 #if 0
-	Text *text= CTX_data_edit_text(C);
+	Text *text = CTX_data_edit_text(C);
 	Object *ob;
 	bConstraint *con;
 	short update;
 	
 	/* check all pyconstraints */
-	for(ob= CTX_data_main(C)->object.first; ob; ob= ob->id.next) {
+	for (ob = CTX_data_main(C)->object.first; ob; ob = ob->id.next) {
 		update = 0;
-		if(ob->type==OB_ARMATURE && ob->pose) {
+		if (ob->type == OB_ARMATURE && ob->pose) {
 			bPoseChannel *pchan;
-			for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
-				for(con = pchan->constraints.first; con; con= con->next) {
-					if(con->type==CONSTRAINT_TYPE_PYTHON) {
+			for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+				for (con = pchan->constraints.first; con; con = con->next) {
+					if (con->type == CONSTRAINT_TYPE_PYTHON) {
 						bPythonConstraint *data = con->data;
-						if(data->text==text) BPY_pyconstraint_update(ob, con);
+						if (data->text == text) BPY_pyconstraint_update(ob, con);
 						update = 1;
 						
 					}
 				}
 			}
 		}
-		for(con = ob->constraints.first; con; con= con->next) {
-			if(con->type==CONSTRAINT_TYPE_PYTHON) {
+		for (con = ob->constraints.first; con; con = con->next) {
+			if (con->type == CONSTRAINT_TYPE_PYTHON) {
 				bPythonConstraint *data = con->data;
-				if(data->text==text) BPY_pyconstraint_update(ob, con);
+				if (data->text == text) BPY_pyconstraint_update(ob, con);
 				update = 1;
 			}
 		}
 		
-		if(update) {
+		if (update) {
 			DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 		}
 	}
@@ -683,13 +690,13 @@ static int text_refresh_pyconstraints_exec(bContext *UNUSED(C), wmOperator *UNUS
 void TEXT_OT_refresh_pyconstraints(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Refresh PyConstraints";
-	ot->idname= "TEXT_OT_refresh_pyconstraints";
-	ot->description= "Refresh all pyconstraints";
+	ot->name = "Refresh PyConstraints";
+	ot->idname = "TEXT_OT_refresh_pyconstraints";
+	ot->description = "Refresh all pyconstraints";
 	
 	/* api callbacks */
-	ot->exec= text_refresh_pyconstraints_exec;
-	ot->poll= text_edit_poll;
+	ot->exec = text_refresh_pyconstraints_exec;
+	ot->poll = text_edit_poll;
 }
 
 /******************* paste operator *********************/
@@ -697,80 +704,80 @@ void TEXT_OT_refresh_pyconstraints(wmOperatorType *ot)
 static char *txt_copy_selected(Text *text)
 {
 	TextLine *tmp, *linef, *linel;
-	char *buf= NULL;
-	int charf, charl, length= 0;
+	char *buf = NULL;
+	int charf, charl, length = 0;
 	
-	if(!text) return NULL;
-	if(!text->curl) return NULL;
-	if(!text->sell) return NULL;
+	if (!text) return NULL;
+	if (!text->curl) return NULL;
+	if (!text->sell) return NULL;
 
-	if(!txt_has_sel(text)) return NULL;
+	if (!txt_has_sel(text)) return NULL;
 
-	if(text->curl==text->sell) {
-		linef= linel= text->curl;
+	if (text->curl == text->sell) {
+		linef = linel = text->curl;
 		
-		if(text->curc < text->selc) {
-			charf= text->curc;
-			charl= text->selc;
+		if (text->curc < text->selc) {
+			charf = text->curc;
+			charl = text->selc;
 		}
-		else{
-			charf= text->selc;
-			charl= text->curc;
+		else {
+			charf = text->selc;
+			charl = text->curc;
 		}
 	}
-	else if(txt_get_span(text->curl, text->sell)<0) {
-		linef= text->sell;
-		linel= text->curl;
+	else if (txt_get_span(text->curl, text->sell) < 0) {
+		linef = text->sell;
+		linel = text->curl;
 
-		charf= text->selc;		
-		charl= text->curc;
+		charf = text->selc;
+		charl = text->curc;
 	}
 	else {
-		linef= text->curl;
-		linel= text->sell;
+		linef = text->curl;
+		linel = text->sell;
 		
-		charf= text->curc;
-		charl= text->selc;
+		charf = text->curc;
+		charl = text->selc;
 	}
 
-	if(linef == linel) {
-		length= charl-charf;
+	if (linef == linel) {
+		length = charl - charf;
 
-		buf= MEM_callocN(length+1, "cut buffera");
+		buf = MEM_callocN(length + 1, "cut buffera");
 		
-		BLI_strncpy(buf, linef->line + charf, length+1);
+		BLI_strncpy(buf, linef->line + charf, length + 1);
 	}
 	else {
-		length+= linef->len - charf;
-		length+= charl;
+		length += linef->len - charf;
+		length += charl;
 		length++; /* For the '\n' */
 		
-		tmp= linef->next;
-		while(tmp && tmp!= linel) {
-			length+= tmp->len+1;
-			tmp= tmp->next;
+		tmp = linef->next;
+		while (tmp && tmp != linel) {
+			length += tmp->len + 1;
+			tmp = tmp->next;
 		}
 		
-		buf= MEM_callocN(length+1, "cut bufferb");
+		buf = MEM_callocN(length + 1, "cut bufferb");
 		
-		strncpy(buf, linef->line+ charf, linef->len-charf);
-		length= linef->len-charf;
+		strncpy(buf, linef->line + charf, linef->len - charf);
+		length = linef->len - charf;
 		
-		buf[length++]='\n';
+		buf[length++] = '\n';
 		
-		tmp= linef->next;
-		while(tmp && tmp!=linel) {
-			strncpy(buf+length, tmp->line, tmp->len);
-			length+= tmp->len;
+		tmp = linef->next;
+		while (tmp && tmp != linel) {
+			strncpy(buf + length, tmp->line, tmp->len);
+			length += tmp->len;
 			
-			buf[length++]='\n';			
+			buf[length++] = '\n';
 			
-			tmp= tmp->next;
+			tmp = tmp->next;
 		}
-		strncpy(buf+length, linel->line, charl);
-		length+= charl;
+		strncpy(buf + length, linel->line, charl);
+		length += charl;
 		
-		buf[length]=0;
+		buf[length] = 0;
 	}
 
 	return buf;
@@ -778,13 +785,13 @@ static char *txt_copy_selected(Text *text)
 
 static int text_paste_exec(bContext *C, wmOperator *op)
 {
-	Text *text= CTX_data_edit_text(C);
+	Text *text = CTX_data_edit_text(C);
 	char *buf;
-	int selection= RNA_boolean_get(op->ptr, "selection");
+	int selection = RNA_boolean_get(op->ptr, "selection");
 
-	buf= WM_clipboard_text_get(selection);
+	buf = WM_clipboard_text_get(selection);
 
-	if(!buf)
+	if (!buf)
 		return OPERATOR_CANCELLED;
 
 	text_drawcache_tag_update(CTX_wm_space_text(C), 0);
@@ -795,10 +802,10 @@ static int text_paste_exec(bContext *C, wmOperator *op)
 	MEM_freeN(buf);
 
 	text_update_cursor_moved(C);
-	WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+	WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
 
 	/* run the script while editing, evil but useful */
-	if(CTX_wm_space_text(C)->live_edit)
+	if (CTX_wm_space_text(C)->live_edit)
 		text_run_script(C, NULL);
 
 	return OPERATOR_FINISHED;
@@ -807,13 +814,13 @@ static int text_paste_exec(bContext *C, wmOperator *op)
 void TEXT_OT_paste(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Paste";
-	ot->idname= "TEXT_OT_paste";
-	ot->description= "Paste text from clipboard";
+	ot->name = "Paste";
+	ot->idname = "TEXT_OT_paste";
+	ot->description = "Paste text from clipboard";
 	
 	/* api callbacks */
-	ot->exec= text_paste_exec;
-	ot->poll= text_edit_poll;
+	ot->exec = text_paste_exec;
+	ot->poll = text_edit_poll;
 	
 	/* properties */
 	RNA_def_boolean(ot->srna, "selection", 0, "Selection", "Paste text selected elsewhere rather than copied (X11 only)");
@@ -825,9 +832,9 @@ static void txt_copy_clipboard(Text *text)
 {
 	char *buf;
 
-	buf= txt_copy_selected(text);
+	buf = txt_copy_selected(text);
 
-	if(buf) {
+	if (buf) {
 		WM_clipboard_text_set(buf, 0);
 		MEM_freeN(buf);
 	}
@@ -835,7 +842,7 @@ static void txt_copy_clipboard(Text *text)
 
 static int text_copy_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Text *text= CTX_data_edit_text(C);
+	Text *text = CTX_data_edit_text(C);
 
 	txt_copy_clipboard(text);
 
@@ -845,20 +852,20 @@ static int text_copy_exec(bContext *C, wmOperator *UNUSED(op))
 void TEXT_OT_copy(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Copy";
-	ot->idname= "TEXT_OT_copy";
-	ot->description= "Copy selected text to clipboard";
+	ot->name = "Copy";
+	ot->idname = "TEXT_OT_copy";
+	ot->description = "Copy selected text to clipboard";
 
 	/* api callbacks */
-	ot->exec= text_copy_exec;
-	ot->poll= text_edit_poll;
+	ot->exec = text_copy_exec;
+	ot->poll = text_edit_poll;
 }
 
 /******************* cut operator *********************/
 
 static int text_cut_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Text *text= CTX_data_edit_text(C);
+	Text *text = CTX_data_edit_text(C);
 
 	text_drawcache_tag_update(CTX_wm_space_text(C), 0);
 
@@ -866,10 +873,10 @@ static int text_cut_exec(bContext *C, wmOperator *UNUSED(op))
 	txt_delete_selected(text);
 
 	text_update_cursor_moved(C);
-	WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+	WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
 
 	/* run the script while editing, evil but useful */
-	if(CTX_wm_space_text(C)->live_edit)
+	if (CTX_wm_space_text(C)->live_edit)
 		text_run_script(C, NULL);
 
 	return OPERATOR_FINISHED;
@@ -878,24 +885,24 @@ static int text_cut_exec(bContext *C, wmOperator *UNUSED(op))
 void TEXT_OT_cut(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Cut";
-	ot->idname= "TEXT_OT_cut";
-	ot->description= "Cut selected text to clipboard";
+	ot->name = "Cut";
+	ot->idname = "TEXT_OT_cut";
+	ot->description = "Cut selected text to clipboard";
 	
 	/* api callbacks */
-	ot->exec= text_cut_exec;
-	ot->poll= text_edit_poll;
+	ot->exec = text_cut_exec;
+	ot->poll = text_edit_poll;
 }
 
 /******************* indent operator *********************/
 
 static int text_indent_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Text *text= CTX_data_edit_text(C);
+	Text *text = CTX_data_edit_text(C);
 
 	text_drawcache_tag_update(CTX_wm_space_text(C), 0);
 
-	if(txt_has_sel(text)) {
+	if (txt_has_sel(text)) {
 		txt_order_cursors(text);
 		txt_indent(text);
 	}
@@ -905,7 +912,7 @@ static int text_indent_exec(bContext *C, wmOperator *UNUSED(op))
 	text_update_edited(text);
 
 	text_update_cursor_moved(C);
-	WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+	WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
 
 	return OPERATOR_FINISHED;
 }
@@ -913,22 +920,22 @@ static int text_indent_exec(bContext *C, wmOperator *UNUSED(op))
 void TEXT_OT_indent(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Indent";
-	ot->idname= "TEXT_OT_indent";
-	ot->description= "Indent selected text";
+	ot->name = "Indent";
+	ot->idname = "TEXT_OT_indent";
+	ot->description = "Indent selected text";
 	
 	/* api callbacks */
-	ot->exec= text_indent_exec;
-	ot->poll= text_edit_poll;
+	ot->exec = text_indent_exec;
+	ot->poll = text_edit_poll;
 }
 
 /******************* unindent operator *********************/
 
 static int text_unindent_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Text *text= CTX_data_edit_text(C);
+	Text *text = CTX_data_edit_text(C);
 
-	if(txt_has_sel(text)) {
+	if (txt_has_sel(text)) {
 		text_drawcache_tag_update(CTX_wm_space_text(C), 0);
 
 		txt_order_cursors(text);
@@ -937,7 +944,7 @@ static int text_unindent_exec(bContext *C, wmOperator *UNUSED(op))
 		text_update_edited(text);
 
 		text_update_cursor_moved(C);
-		WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+		WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
 
 		return OPERATOR_FINISHED;
 	}
@@ -948,46 +955,47 @@ static int text_unindent_exec(bContext *C, wmOperator *UNUSED(op))
 void TEXT_OT_unindent(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Unindent";
-	ot->idname= "TEXT_OT_unindent";
-	ot->description= "Unindent selected text";
+	ot->name = "Unindent";
+	ot->idname = "TEXT_OT_unindent";
+	ot->description = "Unindent selected text";
 	
 	/* api callbacks */
-	ot->exec= text_unindent_exec;
-	ot->poll= text_edit_poll;
+	ot->exec = text_unindent_exec;
+	ot->poll = text_edit_poll;
 }
 
 /******************* line break operator *********************/
 
 static int text_line_break_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	SpaceText *st= CTX_wm_space_text(C);
-	Text *text= CTX_data_edit_text(C);
+	SpaceText *st = CTX_wm_space_text(C);
+	Text *text = CTX_data_edit_text(C);
 	int a, curts;
 	int space = (text->flags & TXT_TABSTOSPACES) ? st->tabnumber : 1;
 
 	text_drawcache_tag_update(st, 0);
 
 	// double check tabs/spaces before splitting the line
-	curts= setcurr_tab_spaces(text, space);
+	curts = setcurr_tab_spaces(text, space);
 	txt_split_curline(text);
 
-	for(a=0; a < curts; a++) {
+	for (a = 0; a < curts; a++) {
 		if (text->flags & TXT_TABSTOSPACES) {
 			txt_add_char(text, ' ');
-		} else {
+		}
+		else {
 			txt_add_char(text, '\t');
 		}
 	}
 
-	if(text->curl) {
-		if(text->curl->prev)
+	if (text->curl) {
+		if (text->curl->prev)
 			text_update_line_edited(text->curl->prev);
 		text_update_line_edited(text->curl);
 	}
 
 	text_update_cursor_moved(C);
-	WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+	WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
 
 	return OPERATOR_CANCELLED;
 }
@@ -995,22 +1003,22 @@ static int text_line_break_exec(bContext *C, wmOperator *UNUSED(op))
 void TEXT_OT_line_break(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Line Break";
-	ot->idname= "TEXT_OT_line_break";
-	ot->description= "Insert line break at cursor position";
+	ot->name = "Line Break";
+	ot->idname = "TEXT_OT_line_break";
+	ot->description = "Insert line break at cursor position";
 	
 	/* api callbacks */
-	ot->exec= text_line_break_exec;
-	ot->poll= text_edit_poll;
+	ot->exec = text_line_break_exec;
+	ot->poll = text_edit_poll;
 }
 
 /******************* comment operator *********************/
 
 static int text_comment_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Text *text= CTX_data_edit_text(C);
+	Text *text = CTX_data_edit_text(C);
 
-	if(txt_has_sel(text)) {
+	if (txt_has_sel(text)) {
 		text_drawcache_tag_update(CTX_wm_space_text(C), 0);
 
 		txt_order_cursors(text);
@@ -1018,7 +1026,7 @@ static int text_comment_exec(bContext *C, wmOperator *UNUSED(op))
 		text_update_edited(text);
 
 		text_update_cursor_moved(C);
-		WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+		WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
 		return OPERATOR_FINISHED;
 	}
 
@@ -1028,22 +1036,22 @@ static int text_comment_exec(bContext *C, wmOperator *UNUSED(op))
 void TEXT_OT_comment(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Comment";
-	ot->idname= "TEXT_OT_comment";
-	ot->description= "Convert selected text to comment";
+	ot->name = "Comment";
+	ot->idname = "TEXT_OT_comment";
+	ot->description = "Convert selected text to comment";
 	
 	/* api callbacks */
-	ot->exec= text_comment_exec;
-	ot->poll= text_edit_poll;
+	ot->exec = text_comment_exec;
+	ot->poll = text_edit_poll;
 }
 
 /******************* uncomment operator *********************/
 
 static int text_uncomment_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Text *text= CTX_data_edit_text(C);
+	Text *text = CTX_data_edit_text(C);
 
-	if(txt_has_sel(text)) {
+	if (txt_has_sel(text)) {
 		text_drawcache_tag_update(CTX_wm_space_text(C), 0);
 
 		txt_order_cursors(text);
@@ -1051,7 +1059,7 @@ static int text_uncomment_exec(bContext *C, wmOperator *UNUSED(op))
 		text_update_edited(text);
 
 		text_update_cursor_moved(C);
-		WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+		WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
 
 		return OPERATOR_FINISHED;
 	}
@@ -1062,56 +1070,56 @@ static int text_uncomment_exec(bContext *C, wmOperator *UNUSED(op))
 void TEXT_OT_uncomment(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Uncomment";
-	ot->idname= "TEXT_OT_uncomment";
-	ot->description= "Convert selected comment to text";
+	ot->name = "Uncomment";
+	ot->idname = "TEXT_OT_uncomment";
+	ot->description = "Convert selected comment to text";
 	
 	/* api callbacks */
-	ot->exec= text_uncomment_exec;
-	ot->poll= text_edit_poll;
+	ot->exec = text_uncomment_exec;
+	ot->poll = text_edit_poll;
 }
 
 /******************* convert whitespace operator *********************/
 
 enum { TO_SPACES, TO_TABS };
-static EnumPropertyItem whitespace_type_items[]= {
+static EnumPropertyItem whitespace_type_items[] = {
 	{TO_SPACES, "SPACES", 0, "To Spaces", NULL},
 	{TO_TABS, "TABS", 0, "To Tabs", NULL},
 	{0, NULL, 0, NULL, NULL}};
 
 static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
 {
-	SpaceText *st= CTX_wm_space_text(C);
-	Text *text= CTX_data_edit_text(C);
+	SpaceText *st = CTX_wm_space_text(C);
+	Text *text = CTX_data_edit_text(C);
 	TextLine *tmp;
 	FlattenString fs;
 	size_t a, j;
 	char *text_check_line, *new_line;
 	int extra, number; //unknown for now
-	int type= RNA_enum_get(op->ptr, "type");
+	int type = RNA_enum_get(op->ptr, "type");
 	
 	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'
-	while(tmp) {
+	while (tmp) {
 		text_check_line = tmp->line;
-		number = flatten_string(st, &fs, text_check_line)+1;
+		number = flatten_string(st, &fs, text_check_line) + 1;
 		flatten_string_free(&fs);
 		new_line = MEM_callocN(number, "Converted_Line");
 		j = 0;
-		for(a=0; a < strlen(text_check_line); a++) { //foreach char in line
-			if(text_check_line[a] == '\t') { //checking for tabs
+		for (a = 0; a < strlen(text_check_line); a++) { //foreach char in line
+			if (text_check_line[a] == '\t') { //checking for tabs
 				//get the number of spaces this tabs is showing
-				//i dont like doing it this way but will look into it later
+				//i don't like doing it this way but will look into it later
 				new_line[j] = '\0';
 				number = flatten_string(st, &fs, new_line);
 				flatten_string_free(&fs);
 				new_line[j] = '\t';
-				new_line[j+1] = '\0';
-				number = flatten_string(st, &fs, new_line)-number;
+				new_line[j + 1] = '\0';
+				number = flatten_string(st, &fs, new_line) - number;
 				flatten_string_free(&fs);
 
-				for(extra = 0; extra < number; extra++) {
+				for (extra = 0; extra < number; extra++) {
 					new_line[j] = ' ';
 					j++;
 				}
@@ -1123,8 +1131,8 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
 		}
 		new_line[j] = '\0';
 		// put new_line in the tmp->line spot still need to try and set the curc correctly
-		if(tmp->line) MEM_freeN(tmp->line);
-		if(tmp->format) MEM_freeN(tmp->format);
+		if (tmp->line) MEM_freeN(tmp->line);
+		if (tmp->format) MEM_freeN(tmp->format);
 		
 		tmp->line = new_line;
 		tmp->len = strlen(new_line);
@@ -1132,44 +1140,44 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
 		tmp = tmp->next;
 	}
 	
-	if(type == TO_TABS) // Converting to tabs
-	{	//start over from the begining
+	if (type == TO_TABS) { // Converting to tabs
+		//start over from the beginning
 		tmp = text->lines.first;
 		
-		while(tmp) {
+		while (tmp) {
 			text_check_line = tmp->line;
 			extra = 0;
-			for(a = 0; a < strlen(text_check_line); a++) {
+			for (a = 0; a < strlen(text_check_line); a++) {
 				number = 0;
-				for(j = 0; j < (size_t)st->tabnumber; j++) {
-					if((a+j) <= strlen(text_check_line)) { //check to make sure we are not pass the end of the line
-						if(text_check_line[a+j] != ' ') {
+				for (j = 0; j < (size_t)st->tabnumber; j++) {
+					if ((a + j) <= strlen(text_check_line)) { //check to make sure we are not pass the end of the line
+						if (text_check_line[a + j] != ' ') {
 							number = 1;
 						}
 					}
 				}
-				if(!number) { //found all number of space to equal a tab
-					a = a+(st->tabnumber-1);
-					extra = extra+1;
+				if (!number) { //found all number of space to equal a tab
+					a = a + (st->tabnumber - 1);
+					extra = extra + 1;
 				}
 			}
 			
-			if( extra > 0 ) { //got tabs make malloc and do what you have to do
-				new_line = MEM_callocN(strlen(text_check_line)-(((st->tabnumber*extra)-extra)-1), "Converted_Line");
+			if (extra > 0) {   //got tabs make malloc and do what you have to do
+				new_line = MEM_callocN(strlen(text_check_line) - (((st->tabnumber * extra) - extra) - 1), "Converted_Line");
 				extra = 0; //reuse vars
-				for(a = 0; a < strlen(text_check_line); a++) {
+				for (a = 0; a < strlen(text_check_line); a++) {
 					number = 0;
-					for(j = 0; j < (size_t)st->tabnumber; j++) {
-						if((a+j) <= strlen(text_check_line)) { //check to make sure we are not pass the end of the line
-							if(text_check_line[a+j] != ' ') {
+					for (j = 0; j < (size_t)st->tabnumber; j++) {
+						if ((a + j) <= strlen(text_check_line)) { //check to make sure we are not pass the end of the line
+							if (text_check_line[a + j] != ' ') {
 								number = 1;
 							}
 						}
 					}
 
-					if(!number) { //found all number of space to equal a tab
+					if (!number) { //found all number of space to equal a tab
 						new_line[extra] = '\t';
-						a = a+(st->tabnumber-1);
+						a = a + (st->tabnumber - 1);
 						++extra;
 						
 					}
@@ -1180,8 +1188,8 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
 				}
 				new_line[extra] = '\0';
 				// put new_line in the tmp->line spot still need to try and set the curc correctly
-				if(tmp->line) MEM_freeN(tmp->line);
-				if(tmp->format) MEM_freeN(tmp->format);
+				if (tmp->line) MEM_freeN(tmp->line);
+				if (tmp->format) MEM_freeN(tmp->format);
 				
 				tmp->line = new_line;
 				tmp->len = strlen(new_line);
@@ -1194,7 +1202,7 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
 	text_update_edited(text);
 	text_update_cursor_moved(C);
 	text_drawcache_tag_update(st, 1);
-	WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+	WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
 
 	return OPERATOR_FINISHED;
 }
@@ -1202,13 +1210,13 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
 void TEXT_OT_convert_whitespace(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Convert Whitespace";
-	ot->idname= "TEXT_OT_convert_whitespace";
-	ot->description= "Convert whitespaces by type";
+	ot->name = "Convert Whitespace";
+	ot->idname = "TEXT_OT_convert_whitespace";
+	ot->description = "Convert whitespaces by type";
 	
 	/* api callbacks */
-	ot->exec= text_convert_whitespace_exec;
-	ot->poll= text_edit_poll;
+	ot->exec = text_convert_whitespace_exec;
+	ot->poll = text_edit_poll;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "type", whitespace_type_items, TO_SPACES, "Type", "Type of whitespace to convert to");
@@ -1218,12 +1226,12 @@ void TEXT_OT_convert_whitespace(wmOperatorType *ot)
 
 static int text_select_all_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Text *text= CTX_data_edit_text(C);
+	Text *text = CTX_data_edit_text(C);
 
 	txt_sel_all(text);
 
 	text_update_cursor_moved(C);
-	WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+	WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
 
 	return OPERATOR_FINISHED;
 }
@@ -1231,25 +1239,25 @@ static int text_select_all_exec(bContext *C, wmOperator *UNUSED(op))
 void TEXT_OT_select_all(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select All";
-	ot->idname= "TEXT_OT_select_all";
-	ot->description= "Select all text";
+	ot->name = "Select All";
+	ot->idname = "TEXT_OT_select_all";
+	ot->description = "Select all text";
 	
 	/* api callbacks */
-	ot->exec= text_select_all_exec;
-	ot->poll= text_edit_poll;
+	ot->exec = text_select_all_exec;
+	ot->poll = text_edit_poll;
 }
 
 /******************* select line operator *********************/
 
 static int text_select_line_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Text *text= CTX_data_edit_text(C);
+	Text *text = CTX_data_edit_text(C);
 
 	txt_sel_line(text);
 
 	text_update_cursor_moved(C);
-	WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+	WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
 
 	return OPERATOR_FINISHED;
 }
@@ -1257,26 +1265,26 @@ static int text_select_line_exec(bContext *C, wmOperator *UNUSED(op))
 void TEXT_OT_select_line(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Line";
-	ot->idname= "TEXT_OT_select_line";
-	ot->description= "Select text by line";
+	ot->name = "Select Line";
+	ot->idname = "TEXT_OT_select_line";
+	ot->description = "Select text by line";
 	
 	/* api callbacks */
-	ot->exec= text_select_line_exec;
-	ot->poll= text_edit_poll;
+	ot->exec = text_select_line_exec;
+	ot->poll = text_edit_poll;
 }
 
 /******************* select word operator *********************/
 
 static int text_select_word_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Text *text= CTX_data_edit_text(C);
+	Text *text = CTX_data_edit_text(C);
 
 	txt_jump_left(text, 0);
 	txt_jump_right(text, 1);
 
 	text_update_cursor_moved(C);
-	WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+	WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
 
 	return OPERATOR_FINISHED;
 }
@@ -1284,35 +1292,35 @@ static int text_select_word_exec(bContext *C, wmOperator *UNUSED(op))
 void TEXT_OT_select_word(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Word";
-	ot->idname= "TEXT_OT_select_word";
-	ot->description= "Select word under cursor";
+	ot->name = "Select Word";
+	ot->idname = "TEXT_OT_select_word";
+	ot->description = "Select word under cursor";
 
 	/* api callbacks */
-	ot->exec= text_select_word_exec;
-	ot->poll= text_edit_poll;
+	ot->exec = text_select_word_exec;
+	ot->poll = text_edit_poll;
 }
 
 /******************* previous marker operator *********************/
 
 static int text_previous_marker_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Text *text= CTX_data_edit_text(C);
+	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) {
+	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);
+	WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
 
 	return OPERATOR_FINISHED;
 }
@@ -1320,35 +1328,35 @@ static int text_previous_marker_exec(bContext *C, wmOperator *UNUSED(op))
 void TEXT_OT_previous_marker(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Previous Marker";
-	ot->idname= "TEXT_OT_previous_marker";
-	ot->description= "Move to previous marker";
+	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;
+	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);
+	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) {
+	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);
+	WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
 
 	return OPERATOR_FINISHED;
 }
@@ -1356,25 +1364,25 @@ static int text_next_marker_exec(bContext *C, wmOperator *UNUSED(op))
 void TEXT_OT_next_marker(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Next Marker";
-	ot->idname= "TEXT_OT_next_marker";
-	ot->description= "Move to next marker";
+	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;
+	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);
+	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);
+	WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
 
 	return OPERATOR_FINISHED;
 }
@@ -1382,18 +1390,18 @@ static int text_clear_all_markers_exec(bContext *C, wmOperator *UNUSED(op))
 void TEXT_OT_markers_clear(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Clear All Markers";
-	ot->idname= "TEXT_OT_markers_clear";
-	ot->description= "Clear all markers";
+	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;
+	ot->exec = text_clear_all_markers_exec;
+	ot->poll = text_edit_poll;
 }
 
 /************************ move operator ************************/
 
-static EnumPropertyItem move_type_items[]= {
+static EnumPropertyItem move_type_items[] = {
 	{LINE_BEGIN, "LINE_BEGIN", 0, "Line Begin", ""},
 	{LINE_END, "LINE_END", 0, "Line End", ""},
 	{FILE_TOP, "FILE_TOP", 0, "File Top", ""},
@@ -1409,78 +1417,78 @@ static EnumPropertyItem move_type_items[]= {
 	{0, NULL, 0, NULL, NULL}};
 
 /* get cursor position in line by relative wrapped line and column positions */
-static int text_get_cursor_rel(SpaceText* st, ARegion *ar, TextLine *linein, int rell, int relc)
+static int text_get_cursor_rel(SpaceText *st, ARegion *ar, TextLine *linein, int rell, int relc)
 {
 	int i, j, start, end, max, chop, curs, loop, endj, found, selc;
 	char ch;
 
-	max= wrap_width(st, ar);
+	max = wrap_width(st, ar);
 
-	selc= start= endj= curs= found= 0;
-	end= max;
-	chop= loop= 1;
+	selc = start = endj = curs = found = 0;
+	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(linein->line + j)) {
 		int chars;
 		/* Mimic replacement of tabs */
-		ch= linein->line[j];
-		if(ch=='\t') {
-			chars= st->tabnumber-i%st->tabnumber;
-			ch= ' ';
+		ch = linein->line[j];
+		if (ch == '\t') {
+			chars = st->tabnumber - i % st->tabnumber;
+			ch = ' ';
 		}
-		else chars= 1;
+		else chars = 1;
 
-		while(chars--) {
-			if(rell==0 && i-start==relc) {
+		while (chars--) {
+			if (rell == 0 && i - start == relc) {
 				/* current position could be wrapped to next line */
 				/* this should be checked when end of current line would be reached */
-				selc= j;
-				found= 1;
+				selc = j;
+				found = 1;
 			}
-			else if(i-end==relc) {
-				curs= j;
+			else if (i - end == relc) {
+				curs = j;
 			}
-			if(i-start>=max) {
-				if(found) {
+			if (i - start >= max) {
+				if (found) {
 					/* exact cursor position was found, check if it's */
 					/* still on needed line (hasn't been wrapped) */
-					if(selc>endj && !chop) selc= endj;
-					loop= 0;
+					if (selc > endj && !chop) selc = endj;
+					loop = 0;
 					break;
 				}
 
-				if(chop) endj= j;
+				if (chop) endj = j;
 
-				start= end;
+				start = end;
 				end += max;
-				chop= 1;
+				chop = 1;
 				rell--;
 
-				if(rell==0 && i-start>=relc) {
-					selc= curs;
-					loop= 0;
+				if (rell == 0 && i - start >= relc) {
+					selc = curs;
+					loop = 0;
 					break;
 				}
 			}
-			else if (ch=='\0') {
-				if(!found) selc= linein->len;
-				loop= 0;
+			else if (ch == '\0') {
+				if (!found) selc = linein->len;
+				loop = 0;
 				break;
 			}
-			else if(ch==' ' || ch=='-') {
-				if(found) {
-					loop= 0;
+			else if (ch == ' ' || ch == '-') {
+				if (found) {
+					loop = 0;
 					break;
 				}
 
-				if(rell==0 && i-start>=relc) {
-					selc= curs;
-					loop= 0;
+				if (rell == 0 && i - start >= relc) {
+					selc = curs;
+					loop = 0;
 					break;
 				}
-				end= i+1;
-				endj= j;
-				chop= 0;
+				end = i + 1;
+				endj = j;
+				chop = 0;
 			}
 			i++;
 		}
@@ -1489,83 +1497,87 @@ static int text_get_cursor_rel(SpaceText* st, ARegion *ar, TextLine *linein, int
 	return selc;
 }
 
-static int cursor_skip_find_line(SpaceText* st, ARegion *ar,
-	int lines, TextLine **linep, int *charp, int *rell, int *relc)
+static int cursor_skip_find_line(SpaceText *st, ARegion *ar,
+                                 int lines, TextLine **linep, int *charp, int *rell, int *relc)
 {
 	int offl, offc, visible_lines;
 
 	wrap_offset_in_line(st, ar, *linep, *charp, &offl, &offc);
-	*relc= text_get_char_pos(st, (*linep)->line, *charp) + offc;
-	*rell= lines;
+	*relc = text_get_char_pos(st, (*linep)->line, *charp) + offc;
+	*rell = lines;
 
 	/* handle current line */
-	if(lines>0) {
-		visible_lines= text_get_visible_lines(st, ar, (*linep)->line);
+	if (lines > 0) {
+		visible_lines = text_get_visible_lines(st, ar, (*linep)->line);
 
-		if(*rell-visible_lines+offl>=0) {
-			if(!(*linep)->next) {
-				if(offl < visible_lines-1) {
-					*rell= visible_lines-1;
+		if (*rell - visible_lines + offl >= 0) {
+			if (!(*linep)->next) {
+				if (offl < visible_lines - 1) {
+					*rell = visible_lines - 1;
 					return 1;
 				}
 
-				*charp= (*linep)->len;
+				*charp = (*linep)->len;
 				return 0;
 			}
 
-			*rell-= visible_lines-offl;
-			*linep=(*linep)->next;
-		} else {
-			*rell+= offl;
+			*rell -= visible_lines - offl;
+			*linep = (*linep)->next;
+		}
+		else {
+			*rell += offl;
 			return 1;
 		}
-	} else {
-		if(*rell+offl<=0) {
-			if(!(*linep)->prev) {
-				if(offl) {
-					*rell= 0;
+	}
+	else {
+		if (*rell + offl <= 0) {
+			if (!(*linep)->prev) {
+				if (offl) {
+					*rell = 0;
 					return 1;
 				}
 
-				*charp= 0;
+				*charp = 0;
 				return 0;
 			}
 
-			*rell+= offl;
-			*linep=(*linep)->prev;
-		} else {
-			*rell+= offl;
+			*rell += offl;
+			*linep = (*linep)->prev;
+		}
+		else {
+			*rell += offl;
 			return 1;
 		}
 	}
 
 	/* skip lines and find destination line and offsets */
-	while(*linep) {
-		visible_lines= text_get_visible_lines(st, ar, (*linep)->line);
+	while (*linep) {
+		visible_lines = text_get_visible_lines(st, ar, (*linep)->line);
 
-		if(lines<0) { /* moving top */
-			if(*rell+visible_lines >= 0) {
-				*rell+= visible_lines;
+		if (lines < 0) { /* moving top */
+			if (*rell + visible_lines >= 0) {
+				*rell += visible_lines;
 				break;
 			}
 
-			if(!(*linep)->prev) {
-				*rell= 0;
+			if (!(*linep)->prev) {
+				*rell = 0;
 				break;
 			}
 
-			*rell+= visible_lines;
-			*linep=(*linep)->prev;
-		} else { /* moving bottom */
-			if(*rell-visible_lines < 0) break;
+			*rell += visible_lines;
+			*linep = (*linep)->prev;
+		}
+		else { /* moving bottom */
+			if (*rell - visible_lines < 0) break;
 
-			if(!(*linep)->next) {
-				*rell= visible_lines-1;
+			if (!(*linep)->next) {
+				*rell = visible_lines - 1;
 				break;
 			}
 
-			*rell-= visible_lines;
-			*linep=(*linep)->next;
+			*rell -= visible_lines;
+			*linep = (*linep)->next;
 		}
 	}
 
@@ -1574,7 +1586,7 @@ static int cursor_skip_find_line(SpaceText* st, ARegion *ar,
 
 static void txt_wrap_move_bol(SpaceText *st, ARegion *ar, short sel)
 {
-	Text *text= st->text;
+	Text *text = st->text;
 	TextLine **linep;
 	int *charp;
 	int oldl, oldc, i, j, max, start, end, endj, chop, loop;
@@ -1582,67 +1594,67 @@ static void txt_wrap_move_bol(SpaceText *st, ARegion *ar, short sel)
 
 	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);
+	oldc = *charp;
+	oldl = txt_get_span(text->lines.first, *linep);
 
-	max= wrap_width(st, ar);
+	max = wrap_width(st, ar);
 
-	start= endj= 0;
-	end= max;
-	chop= loop= 1;
-	*charp= 0;
+	start = endj = 0;
+	end = max;
+	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((*linep)->line + j)) {
 		int chars;
 		/* Mimic replacement of tabs */
-		ch= (*linep)->line[j];
-		if(ch=='\t') {
-			chars= st->tabnumber-i%st->tabnumber;
-			ch= ' ';
+		ch = (*linep)->line[j];
+		if (ch == '\t') {
+			chars = st->tabnumber - i % st->tabnumber;
+			ch = ' ';
 		}
-		else chars= 1;
+		else chars = 1;
 
-		while(chars--) {
-			if(i-start>=max) {
-				*charp= endj;
+		while (chars--) {
+			if (i - start >= max) {
+				*charp = endj;
 
-				if(j>=oldc) {
-					if(ch=='\0') *charp= txt_utf8_index_to_offset((*linep)->line, start);
-					loop= 0;
+				if (j >= oldc) {
+					if (ch == '\0') *charp = txt_utf8_index_to_offset((*linep)->line, start);
+					loop = 0;
 					break;
 				}
 
-				if(chop) endj= j;
+				if (chop) endj = j;
 
-				start= end;
+				start = end;
 				end += max;
-				chop= 1;
+				chop = 1;
 			}
-			else if(ch==' ' || ch=='-' || ch=='\0') {
-				if(j>=oldc) {
-					*charp= txt_utf8_index_to_offset((*linep)->line, start);
-					loop= 0;
+			else if (ch == ' ' || ch == '-' || ch == '\0') {
+				if (j >= oldc) {
+					*charp = txt_utf8_index_to_offset((*linep)->line, start);
+					loop = 0;
 					break;
 				}
 
-				end= i+1;
-				endj= j+1;
-				chop= 0;
+				end = i + 1;
+				endj = j + 1;
+				chop = 0;
 			}
 			i++;
 		}
 	}
 
 	if (!sel) txt_pop_sel(text);
-	txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, oldl, *charp);
+	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)
 {
-	Text *text= st->text;
+	Text *text = st->text;
 	TextLine **linep;
 	int *charp;
 	int oldl, oldc, i, j, max, start, end, endj, chop, loop;
@@ -1650,187 +1662,194 @@ static void txt_wrap_move_eol(SpaceText *st, ARegion *ar, short sel)
 
 	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);
+	oldc = *charp;
+	oldl = txt_get_span(text->lines.first, *linep);
 
-	max= wrap_width(st, ar);
+	max = wrap_width(st, ar);
 
-	start= endj= 0;
-	end= max;
-	chop= loop= 1;
-	*charp= 0;
+	start = endj = 0;
+	end = max;
+	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((*linep)->line + j)) {
 		int chars;
 		/* Mimic replacement of tabs */
-		ch= (*linep)->line[j];
-		if(ch=='\t') {
-			chars= st->tabnumber-i%st->tabnumber;
-			ch= ' ';
+		ch = (*linep)->line[j];
+		if (ch == '\t') {
+			chars = st->tabnumber - i % st->tabnumber;
+			ch = ' ';
 		}
-		else chars= 1;
+		else chars = 1;
 
-		while(chars--) {
-			if(i-start>=max) {
-				if(chop) endj= BLI_str_prev_char_utf8((*linep)->line+j)-(*linep)->line;
+		while (chars--) {
+			if (i - start >= max) {
+				if (chop) endj = BLI_str_prev_char_utf8((*linep)->line + j) - (*linep)->line;
 
-				if(endj>=oldc) {
-					if(ch=='\0') *charp= (*linep)->len;
-					else *charp= endj;
-					loop= 0;
+				if (endj >= oldc) {
+					if (ch == '\0') *charp = (*linep)->len;
+					else *charp = endj;
+					loop = 0;
 					break;
 				}
 
-				start= end;
+				start = end;
 				end += max;
-				chop= 1;
-			} else if(ch=='\0') {
-				*charp= (*linep)->len;
-				loop= 0;
+				chop = 1;
+			}
+			else if (ch == '\0') {
+				*charp = (*linep)->len;
+				loop = 0;
 				break;
-			} else if(ch==' ' || ch=='-') {
-				end= i+1;
-				endj= j;
-				chop= 0;
+			}
+			else if (ch == ' ' || ch == '-') {
+				end = i + 1;
+				endj = j;
+				chop = 0;
 			}
 			i++;
 		}
 	}
 
 	if (!sel) txt_pop_sel(text);
-	txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, oldl, *charp);
+	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)
 {
-	Text *text= st->text;
+	Text *text = st->text;
 	TextLine **linep;
 	int *charp;
 	int oldl, oldc, offl, offc, col, newl;
 
 	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;
 
 	/* store previous position */
-	oldc= *charp;
-	newl= oldl= txt_get_span(text->lines.first, *linep);
+	oldc = *charp;
+	newl = oldl = txt_get_span(text->lines.first, *linep);
 
 	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) {
+	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) {
 			int visible_lines;
 
-			*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);
+			*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;
+		}
+		else *charp = 0;
 	}
 
 	if (!sel) txt_pop_sel(text);
-	txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, newl, *charp);
+	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)
 {
-	Text *text= st->text;
+	Text *text = st->text;
 	TextLine **linep;
 	int *charp;
 	int oldl, oldc, offl, offc, col, newl, visible_lines;
 
 	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;
 
 	/* store previous position */
-	oldc= *charp;
-	newl= oldl= txt_get_span(text->lines.first, *linep);
+	oldc = *charp;
+	newl = oldl = txt_get_span(text->lines.first, *linep);
 
 	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);
+	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;
+		}
+		else *charp = (*linep)->len;
 	}
 
 	if (!sel) txt_pop_sel(text);
-	txt_undo_add_toop(text, sel?UNDO_STO:UNDO_CTO, oldl, oldc, newl, *charp);
+	txt_undo_add_toop(text, sel ? UNDO_STO : UNDO_CTO, oldl, oldc, newl, *charp);
 }
 
 /* Moves the cursor vertically by the specified number of lines.
- If the destination line is shorter than the current cursor position, the
- cursor will be positioned at the end of this line.
-
- This is to replace screen_skip for PageUp/Down operations.
+ * If the destination line is shorter than the current cursor position, the
+ * cursor will be positioned at the end of this line.
+ *
+ * This is to replace screen_skip for PageUp/Down operations.
  */
-static void cursor_skip(SpaceText* st, ARegion *ar, Text *text, int lines, int sel)
+static void cursor_skip(SpaceText *st, ARegion *ar, Text *text, int lines, int sel)
 {
 	TextLine **linep;
 	int oldl, oldc, *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;
+	oldl = txt_get_span(text->lines.first, *linep);
+	oldc = *charp;
 
-	if(st && ar && st->wordwrap) {
+	if (st && ar && st->wordwrap) {
 		int rell, relc;
 
 		/* find line and offsets inside it needed to set cursor position */
-		if(cursor_skip_find_line(st, ar, lines, linep, charp, &rell, &relc))
-		  *charp= text_get_cursor_rel (st, ar, *linep, rell, relc);
-	} else {
-		while (lines>0 && (*linep)->next) {
-			*linep= (*linep)->next;
+		if (cursor_skip_find_line(st, ar, lines, linep, charp, &rell, &relc))
+			*charp = text_get_cursor_rel(st, ar, *linep, rell, relc);
+	}
+	else {
+		while (lines > 0 && (*linep)->next) {
+			*linep = (*linep)->next;
 			lines--;
 		}
-		while (lines<0 && (*linep)->prev) {
-			*linep= (*linep)->prev;
+		while (lines < 0 && (*linep)->prev) {
+			*linep = (*linep)->prev;
 			lines++;
 		}
 	}
 
-	if (*charp > (*linep)->len) *charp= (*linep)->len;
+	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);
+	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)
 {
-	SpaceText *st= CTX_wm_space_text(C);
-	Text *text= CTX_data_edit_text(C);
-	ARegion *ar= CTX_wm_region(C);
+	SpaceText *st = CTX_wm_space_text(C);
+	Text *text = CTX_data_edit_text(C);
+	ARegion *ar = CTX_wm_region(C);
 
 	/* ensure we have the right region, it's optional */
-	if(ar && ar->regiontype != RGN_TYPE_WINDOW)
-		ar= NULL;
+	if (ar && ar->regiontype != RGN_TYPE_WINDOW)
+		ar = NULL;
 
-	switch(type) {
+	switch (type) {
 		case LINE_BEGIN:
-			if(st && st->wordwrap && ar) txt_wrap_move_bol(st, ar, select);
+			if (st && st->wordwrap && ar) txt_wrap_move_bol(st, ar, select);
 			else txt_move_bol(text, select);
 			break;
 			
 		case LINE_END:
-			if(st && st->wordwrap && ar) txt_wrap_move_eol(st, ar, select);
+			if (st && st->wordwrap && ar) txt_wrap_move_eol(st, ar, select);
 			else txt_move_eol(text, select);
 			break;
 
@@ -1859,35 +1878,35 @@ static int text_move_cursor(bContext *C, int type, int select)
 			break;
 
 		case PREV_LINE:
-			if(st && st->wordwrap && ar) txt_wrap_move_up(st, ar, select);
+			if (st && st->wordwrap && ar) txt_wrap_move_up(st, ar, select);
 			else txt_move_up(text, select);
 			break;
 			
 		case NEXT_LINE:
-			if(st && st->wordwrap && ar) txt_wrap_move_down(st, ar, select);
+			if (st && st->wordwrap && ar) txt_wrap_move_down(st, ar, select);
 			else txt_move_down(text, select);
 			break;
 
 		case PREV_PAGE:
-			if(st) cursor_skip(st, ar, st->text, -st->viewlines, select);
+			if (st) cursor_skip(st, ar, st->text, -st->viewlines, select);
 			else cursor_skip(NULL, NULL, text, -10, select);
 			break;
 
 		case NEXT_PAGE:
-			if(st) cursor_skip(st, ar, st->text, st->viewlines, select);
+			if (st) cursor_skip(st, ar, st->text, st->viewlines, select);
 			else cursor_skip(NULL, NULL, text, 10, select);
 			break;
 	}
 
 	text_update_cursor_moved(C);
-	WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, text);
+	WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
 
 	return OPERATOR_FINISHED;
 }
 
 static int text_move_exec(bContext *C, wmOperator *op)
 {
-	int type= RNA_enum_get(op->ptr, "type");
+	int type = RNA_enum_get(op->ptr, "type");
 
 	return text_move_cursor(C, type, 0);
 }
@@ -1895,13 +1914,13 @@ static int text_move_exec(bContext *C, wmOperator *op)
 void TEXT_OT_move(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Move Cursor";
-	ot->idname= "TEXT_OT_move";
-	ot->description= "Move cursor to position type";
+	ot->name = "Move Cursor";
+	ot->idname = "TEXT_OT_move";
+	ot->description = "Move cursor to position type";
 	
 	/* api callbacks */
-	ot->exec= text_move_exec;
-	ot->poll= text_edit_poll;
+	ot->exec = text_move_exec;
+	ot->poll = text_edit_poll;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "type", move_type_items, LINE_BEGIN, "Type", "Where to move cursor to");
@@ -1911,7 +1930,7 @@ void TEXT_OT_move(wmOperatorType *ot)
 
 static int text_move_select_exec(bContext *C, wmOperator *op)
 {
-	int type= RNA_enum_get(op->ptr, "type");
+	int type = RNA_enum_get(op->ptr, "type");
 
 	return text_move_cursor(C, type, 1);
 }
@@ -1919,13 +1938,13 @@ static int text_move_select_exec(bContext *C, wmOperator *op)
 void TEXT_OT_move_select(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Move Select";
-	ot->idname= "TEXT_OT_move_select";
-	ot->description= "Make selection from current cursor position to new cursor position type";
+	ot->name = "Move Select";
+	ot->idname = "TEXT_OT_move_select";
+	ot->description = "Make selection from current cursor position to new cursor position type";
 	
 	/* api callbacks */
-	ot->exec= text_move_select_exec;
-	ot->poll= text_space_edit_poll;
+	ot->exec = text_move_select_exec;
+	ot->poll = text_space_edit_poll;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "type", move_type_items, LINE_BEGIN, "Type", "Where to move cursor to, to make a selection");
@@ -1935,40 +1954,40 @@ void TEXT_OT_move_select(wmOperatorType *ot)
 
 static int text_jump_exec(bContext *C, wmOperator *op)
 {
-	Text *text= CTX_data_edit_text(C);
-	int line= RNA_int_get(op->ptr, "line");
-	short nlines= txt_get_span(text->lines.first, text->lines.last)+1;
+	Text *text = CTX_data_edit_text(C);
+	int line = RNA_int_get(op->ptr, "line");
+	short nlines = txt_get_span(text->lines.first, text->lines.last) + 1;
 
-	if(line < 1)
+	if (line < 1)
 		txt_move_toline(text, 1, 0);
-	else if(line > nlines)
-		txt_move_toline(text, nlines-1, 0);
+	else if (line > nlines)
+		txt_move_toline(text, nlines - 1, 0);
 	else
-		txt_move_toline(text, line-1, 0);
+		txt_move_toline(text, line - 1, 0);
 
 	text_update_cursor_moved(C);
-	WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, text);
+	WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
 
 	return OPERATOR_FINISHED;
 }
 
 static int text_jump_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	return WM_operator_props_dialog_popup(C,op,200,100);
+	return WM_operator_props_dialog_popup(C, op, 200, 100);
 
 }
 
 void TEXT_OT_jump(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Jump";
-	ot->idname= "TEXT_OT_jump";
-	ot->description= "Jump cursor to line";
+	ot->name = "Jump";
+	ot->idname = "TEXT_OT_jump";
+	ot->description = "Jump cursor to line";
 	
 	/* api callbacks */
-	ot->invoke= text_jump_invoke;
-	ot->exec= text_jump_exec;
-	ot->poll= text_edit_poll;
+	ot->invoke = text_jump_invoke;
+	ot->exec = text_jump_exec;
+	ot->poll = text_edit_poll;
 
 	/* properties */
 	RNA_def_int(ot->srna, "line", 1, 1, INT_MAX, "Line", "Line number to jump to", 1, 10000);
@@ -1976,7 +1995,7 @@ void TEXT_OT_jump(wmOperatorType *ot)
 
 /******************* delete operator **********************/
 
-static EnumPropertyItem delete_type_items[]= {
+static EnumPropertyItem delete_type_items[] = {
 	{DEL_NEXT_CHAR, "NEXT_CHARACTER", 0, "Next Character", ""},
 	{DEL_PREV_CHAR, "PREVIOUS_CHARACTER", 0, "Previous Character", ""},
 	{DEL_NEXT_WORD, "NEXT_WORD", 0, "Next Word", ""},
@@ -1985,27 +2004,27 @@ static EnumPropertyItem delete_type_items[]= {
 
 static int text_delete_exec(bContext *C, wmOperator *op)
 {
-	Text *text= CTX_data_edit_text(C);
-	int type= RNA_enum_get(op->ptr, "type");
+	Text *text = CTX_data_edit_text(C);
+	int type = RNA_enum_get(op->ptr, "type");
 
 	text_drawcache_tag_update(CTX_wm_space_text(C), 0);
 
-	if(type == DEL_PREV_WORD)
+	if (type == DEL_PREV_WORD)
 		txt_backspace_word(text);
-	else if(type == DEL_PREV_CHAR)
+	else if (type == DEL_PREV_CHAR)
 		txt_backspace_char(text);
-	else if(type == DEL_NEXT_WORD)
+	else if (type == DEL_NEXT_WORD)
 		txt_delete_word(text);
-	else if(type == DEL_NEXT_CHAR)
+	else if (type == DEL_NEXT_CHAR)
 		txt_delete_char(text);
 
 	text_update_line_edited(text->curl);
 
 	text_update_cursor_moved(C);
-	WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+	WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
 
 	/* run the script while editing, evil but useful */
-	if(CTX_wm_space_text(C)->live_edit)
+	if (CTX_wm_space_text(C)->live_edit)
 		text_run_script(C, NULL);
 	
 	return OPERATOR_FINISHED;
@@ -2014,13 +2033,13 @@ static int text_delete_exec(bContext *C, wmOperator *op)
 void TEXT_OT_delete(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Delete";
-	ot->idname= "TEXT_OT_delete";
-	ot->description= "Delete text by cursor position";
+	ot->name = "Delete";
+	ot->idname = "TEXT_OT_delete";
+	ot->description = "Delete text by cursor position";
 	
 	/* api callbacks */
-	ot->exec= text_delete_exec;
-	ot->poll= text_edit_poll;
+	ot->exec = text_delete_exec;
+	ot->poll = text_edit_poll;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "type", delete_type_items, DEL_NEXT_CHAR, "Type", "Which part of the text to delete");
@@ -2030,11 +2049,11 @@ void TEXT_OT_delete(wmOperatorType *ot)
 
 static int text_toggle_overwrite_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	SpaceText *st= CTX_wm_space_text(C);
+	SpaceText *st = CTX_wm_space_text(C);
 
-	st->overwrite= !st->overwrite;
+	st->overwrite = !st->overwrite;
 
-	WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, st->text);
+	WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text);
 
 	return OPERATOR_FINISHED;
 }
@@ -2042,13 +2061,13 @@ static int text_toggle_overwrite_exec(bContext *C, wmOperator *UNUSED(op))
 void TEXT_OT_overwrite_toggle(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Toggle Overwrite";
-	ot->idname= "TEXT_OT_overwrite_toggle";
-	ot->description= "Toggle overwrite while typing";
+	ot->name = "Toggle Overwrite";
+	ot->idname = "TEXT_OT_overwrite_toggle";
+	ot->description = "Toggle overwrite while typing";
 	
 	/* api callbacks */
-	ot->exec= text_toggle_overwrite_exec;
-	ot->poll= text_space_edit_poll;
+	ot->exec = text_toggle_overwrite_exec;
+	ot->poll = text_space_edit_poll;
 }
 
 /******************* scroll operator **********************/
@@ -2060,11 +2079,11 @@ static void txt_screen_skip(SpaceText *st, ARegion *ar, int lines)
 
 	st->top += lines;
 
-	last= text_get_total_lines(st, ar);
-	last= last - (st->viewlines/2);
+	last = text_get_total_lines(st, ar);
+	last = last - (st->viewlines / 2);
 	
-	if(st->top>last) st->top= last;
-	if(st->top<0) st->top= 0;
+	if (st->top > last) st->top = last;
+	if (st->top < 0) st->top = 0;
 }
 
 /* quick enum for tsc->zone (scroller handles) */
@@ -2092,15 +2111,15 @@ static int text_scroll_poll(bContext *C)
 
 static int text_scroll_exec(bContext *C, wmOperator *op)
 {
-	SpaceText *st= CTX_wm_space_text(C);
-	ARegion *ar= CTX_wm_region(C);
+	SpaceText *st = CTX_wm_space_text(C);
+	ARegion *ar = CTX_wm_region(C);
 
-	int lines= RNA_int_get(op->ptr, "lines");
+	int lines = RNA_int_get(op->ptr, "lines");
 
-	if(lines == 0)
+	if (lines == 0)
 		return OPERATOR_CANCELLED;
 
-	txt_screen_skip(st, ar, lines*U.wheellinescroll);
+	txt_screen_skip(st, ar, lines * U.wheellinescroll);
 
 	ED_area_tag_redraw(CTX_wm_area(C));
 
@@ -2109,56 +2128,56 @@ static int text_scroll_exec(bContext *C, wmOperator *op)
 
 static void text_scroll_apply(bContext *C, wmOperator *op, wmEvent *event)
 {
-	SpaceText *st= CTX_wm_space_text(C);
-	ARegion *ar= CTX_wm_region(C);
-	TextScroll *tsc= op->customdata;
-	int mval[2]= {event->x, event->y};
+	SpaceText *st = CTX_wm_space_text(C);
+	ARegion *ar = CTX_wm_region(C);
+	TextScroll *tsc = op->customdata;
+	int mval[2] = {event->x, event->y};
 	short txtdelta[2] = {0, 0};
 
 	text_update_character_width(st);
 
-	if(tsc->first) {
-		tsc->old[0]= mval[0];
-		tsc->old[1]= mval[1];
-		tsc->first= 0;
+	if (tsc->first) {
+		tsc->old[0] = mval[0];
+		tsc->old[1] = mval[1];
+		tsc->first = 0;
 	}
 
-	tsc->delta[0]+= mval[0] - tsc->old[0];
-	tsc->delta[1]+= mval[1] - tsc->old[1];
+	tsc->delta[0] += mval[0] - tsc->old[0];
+	tsc->delta[1] += mval[1] - tsc->old[1];
 
-	if(!tsc->scrollbar) {
-		txtdelta[0]= -tsc->delta[0]/st->cwidth;
-		txtdelta[1]= tsc->delta[1]/st->lheight;
+	if (!tsc->scrollbar) {
+		txtdelta[0] = -tsc->delta[0] / st->cwidth;
+		txtdelta[1] = tsc->delta[1] / st->lheight;
 
-		tsc->delta[0]%= st->cwidth;
-		tsc->delta[1]%= st->lheight;
+		tsc->delta[0] %= st->cwidth;
+		tsc->delta[1] %= st->lheight;
 	}
 	else {
-		txtdelta[1]= -tsc->delta[1]*st->pix_per_line;
-		tsc->delta[1]+= txtdelta[1]/st->pix_per_line;
+		txtdelta[1] = -tsc->delta[1] * st->pix_per_line;
+		tsc->delta[1] += txtdelta[1] / st->pix_per_line;
 	}
 
-	if(txtdelta[0] || txtdelta[1]) {
+	if (txtdelta[0] || txtdelta[1]) {
 		txt_screen_skip(st, ar, txtdelta[1]);
 
-		if(st->wordwrap) {
-			st->left= 0;
+		if (st->wordwrap) {
+			st->left = 0;
 		}
 		else {
-			st->left+= txtdelta[0];
-			if(st->left<0) st->left= 0;
+			st->left += txtdelta[0];
+			if (st->left < 0) st->left = 0;
 		}
 
 		ED_area_tag_redraw(CTX_wm_area(C));
 	}
 
-	tsc->old[0]= mval[0];
-	tsc->old[1]= mval[1];
+	tsc->old[0] = mval[0];
+	tsc->old[1] = mval[1];
 }
 
 static void scroll_exit(bContext *C, wmOperator *op)
 {
-	SpaceText *st= CTX_wm_space_text(C);
+	SpaceText *st = CTX_wm_space_text(C);
 
 	st->flags &= ~ST_SCROLL_SELECT;
 	MEM_freeN(op->customdata);
@@ -2166,25 +2185,25 @@ static void scroll_exit(bContext *C, wmOperator *op)
 
 static int text_scroll_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
-	TextScroll *tsc= op->customdata;
-	SpaceText *st= CTX_wm_space_text(C);
-	ARegion *ar= CTX_wm_region(C);
+	TextScroll *tsc = op->customdata;
+	SpaceText *st = CTX_wm_space_text(C);
+	ARegion *ar = CTX_wm_region(C);
 
-	switch(event->type) {
+	switch (event->type) {
 		case MOUSEMOVE:
-			if(tsc->zone == SCROLLHANDLE_BAR)
+			if (tsc->zone == SCROLLHANDLE_BAR)
 				text_scroll_apply(C, op, event);
 			break;
 		case LEFTMOUSE:
 		case RIGHTMOUSE:
 		case MIDDLEMOUSE:
-			if(ELEM(tsc->zone, SCROLLHANDLE_MIN_OUTSIDE, SCROLLHANDLE_MAX_OUTSIDE)) {
+			if (ELEM(tsc->zone, SCROLLHANDLE_MIN_OUTSIDE, SCROLLHANDLE_MAX_OUTSIDE)) {
 				int last;
 
-				st->top+= st->viewlines * (tsc->zone==SCROLLHANDLE_MIN_OUTSIDE ? 1 : -1);
+				st->top += st->viewlines * (tsc->zone == SCROLLHANDLE_MIN_OUTSIDE ? 1 : -1);
 
-				last= text_get_total_lines(st, ar);
-				last= last - (st->viewlines/2);
+				last = text_get_total_lines(st, ar);
+				last = last - (st->viewlines / 2);
 
 				CLAMP(st->top, 0, last);
 
@@ -2206,18 +2225,18 @@ static int text_scroll_cancel(bContext *C, wmOperator *op)
 
 static int text_scroll_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	SpaceText *st= CTX_wm_space_text(C);
+	SpaceText *st = CTX_wm_space_text(C);
 	TextScroll *tsc;
 	
-	if(RNA_struct_property_is_set(op->ptr, "lines"))
+	if (RNA_struct_property_is_set(op->ptr, "lines"))
 		return text_scroll_exec(C, op);
 	
-	tsc= MEM_callocN(sizeof(TextScroll), "TextScroll");
-	tsc->first= 1;
-	tsc->zone= SCROLLHANDLE_BAR;
-	op->customdata= tsc;
+	tsc = MEM_callocN(sizeof(TextScroll), "TextScroll");
+	tsc->first = 1;
+	tsc->zone = SCROLLHANDLE_BAR;
+	op->customdata = tsc;
 	
-	st->flags|= ST_SCROLL_SELECT;
+	st->flags |= ST_SCROLL_SELECT;
 	
 	if (event->type == MOUSEPAN) {
 		text_update_character_width(st);
@@ -2225,8 +2244,8 @@ static int text_scroll_invoke(bContext *C, wmOperator *op, wmEvent *event)
 		tsc->old[0] = event->x;
 		tsc->old[1] = event->y;
 		/* Sensitivity of scroll set to 4pix per line/char */
-		tsc->delta[0] = (event->x - event->prevx)*st->cwidth/4;
-		tsc->delta[1] = (event->y - event->prevy)*st->lheight/4;
+		tsc->delta[0] = (event->x - event->prevx) * st->cwidth / 4;
+		tsc->delta[1] = (event->y - event->prevy) * st->lheight / 4;
 		tsc->first = 0;
 		tsc->scrollbar = 0;
 		text_scroll_apply(C, op, event);
@@ -2242,22 +2261,22 @@ static int text_scroll_invoke(bContext *C, wmOperator *op, wmEvent *event)
 void TEXT_OT_scroll(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Scroll";
-	/*don't really see the difference between this and
-	  scroll_bar. Both do basically the same thing (aside 
-	  from keymaps).*/
-	ot->idname= "TEXT_OT_scroll";
-	ot->description= "Scroll text screen";
+	ot->name = "Scroll";
+	/* don't really see the difference between this and
+	 * scroll_bar. Both do basically the same thing (aside 
+	 * from keymaps).*/
+	ot->idname = "TEXT_OT_scroll";
+	ot->description = "Scroll text screen";
 	
 	/* api callbacks */
-	ot->exec= text_scroll_exec;
-	ot->invoke= text_scroll_invoke;
-	ot->modal= text_scroll_modal;
-	ot->cancel= text_scroll_cancel;
-	ot->poll= text_scroll_poll;
+	ot->exec = text_scroll_exec;
+	ot->invoke = text_scroll_invoke;
+	ot->modal = text_scroll_modal;
+	ot->cancel = text_scroll_cancel;
+	ot->poll = text_scroll_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
+	ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_POINTER;
 
 	/* properties */
 	RNA_def_int(ot->srna, "lines", 1, INT_MIN, INT_MAX, "Lines", "Number of lines to scroll", -100, 100);
@@ -2268,14 +2287,14 @@ void TEXT_OT_scroll(wmOperatorType *ot)
 static int text_region_scroll_poll(bContext *C)
 {
 	/* same as text_region_edit_poll except it works on libdata too */
-	SpaceText *st= CTX_wm_space_text(C);
-	Text *text= CTX_data_edit_text(C);
-	ARegion *ar= CTX_wm_region(C);
+	SpaceText *st = CTX_wm_space_text(C);
+	Text *text = CTX_data_edit_text(C);
+	ARegion *ar = CTX_wm_region(C);
 
-	if(!st || !text)
+	if (!st || !text)
 		return 0;
 	
-	if(!ar || ar->regiontype != RGN_TYPE_WINDOW)
+	if (!ar || ar->regiontype != RGN_TYPE_WINDOW)
 		return 0;
 	
 	return 1;
@@ -2283,38 +2302,38 @@ static int text_region_scroll_poll(bContext *C)
 
 static int text_scroll_bar_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	SpaceText *st= CTX_wm_space_text(C);
-	ARegion *ar= CTX_wm_region(C);
+	SpaceText *st = CTX_wm_space_text(C);
+	ARegion *ar = CTX_wm_region(C);
 	TextScroll *tsc;
-	const int *mval= event->mval;
-	int zone= -1;
+	const int *mval = event->mval;
+	int zone = -1;
 
-	if(RNA_struct_property_is_set(op->ptr, "lines"))
+	if (RNA_struct_property_is_set(op->ptr, "lines"))
 		return text_scroll_exec(C, op);
 	
 	/* verify we are in the right zone */
-	if(mval[0]>st->txtbar.xmin && mval[0]<st->txtbar.xmax) {
-		if(mval[1]>=st->txtbar.ymin && mval[1]<=st->txtbar.ymax) {
+	if (mval[0] > st->txtbar.xmin && mval[0] < st->txtbar.xmax) {
+		if (mval[1] >= st->txtbar.ymin && mval[1] <= st->txtbar.ymax) {
 			/* mouse inside scroll handle */
 			zone = SCROLLHANDLE_BAR;
 		}
-		else if(mval[1]>TXT_SCROLL_SPACE && mval[1]<ar->winy-TXT_SCROLL_SPACE) {
-			if(mval[1]<st->txtbar.ymin) zone= SCROLLHANDLE_MIN_OUTSIDE;
-			else zone= SCROLLHANDLE_MAX_OUTSIDE;
+		else if (mval[1] > TXT_SCROLL_SPACE && mval[1] < ar->winy - TXT_SCROLL_SPACE) {
+			if (mval[1] < st->txtbar.ymin) zone = SCROLLHANDLE_MIN_OUTSIDE;
+			else zone = SCROLLHANDLE_MAX_OUTSIDE;
 		}
 	}
 
-	if(zone == -1) {
+	if (zone == -1) {
 		/* we are outside slider - nothing to do */
 		return OPERATOR_PASS_THROUGH;
 	}
 
-	tsc= MEM_callocN(sizeof(TextScroll), "TextScroll");
-	tsc->first= 1;
-	tsc->scrollbar= 1;
-	tsc->zone= zone;
-	op->customdata= tsc;
-	st->flags|= ST_SCROLL_SELECT;
+	tsc = MEM_callocN(sizeof(TextScroll), "TextScroll");
+	tsc->first = 1;
+	tsc->scrollbar = 1;
+	tsc->zone = zone;
+	op->customdata = tsc;
+	st->flags |= ST_SCROLL_SELECT;
 
 	/* jump scroll, works in v2d but needs to be added here too :S */
 	if (event->type == MIDDLEMOUSE) {
@@ -2324,7 +2343,7 @@ static int text_scroll_bar_invoke(bContext *C, wmOperator *op, wmEvent *event)
 		tsc->delta[0] = 0;
 		tsc->delta[1] = 0;
 		tsc->first = 0;
-		tsc->zone= SCROLLHANDLE_BAR;
+		tsc->zone = SCROLLHANDLE_BAR;
 		text_scroll_apply(C, op, event);
 	}
 
@@ -2336,21 +2355,21 @@ static int text_scroll_bar_invoke(bContext *C, wmOperator *op, wmEvent *event)
 void TEXT_OT_scroll_bar(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Scrollbar";
-	/*don't really see the difference between this and
-	  scroll. Both do basically the same thing (aside 
-	  from keymaps).*/
-	ot->idname= "TEXT_OT_scroll_bar";
-	ot->description= "Scroll text screen";
+	ot->name = "Scrollbar";
+	/* don't really see the difference between this and
+	 * scroll. Both do basically the same thing (aside 
+	 * from keymaps).*/
+	ot->idname = "TEXT_OT_scroll_bar";
+	ot->description = "Scroll text screen";
 	
 	/* api callbacks */
-	ot->invoke= text_scroll_bar_invoke;
-	ot->modal= text_scroll_modal;
-	ot->cancel= text_scroll_cancel;
-	ot->poll= text_region_scroll_poll;
+	ot->invoke = text_scroll_bar_invoke;
+	ot->modal = text_scroll_modal;
+	ot->cancel = text_scroll_cancel;
+	ot->poll = text_region_scroll_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_BLOCKING;
 
 	/* properties */
 	RNA_def_int(ot->srna, "lines", 1, INT_MIN, INT_MAX, "Lines", "Number of lines to scroll", -100, 100);
@@ -2368,9 +2387,9 @@ 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)) {
-		if(str[i]=='\t') {
-			total += st->tabnumber - total%st->tabnumber;
+	for (i = 0; str[i]; i += BLI_str_utf8_size(str + i)) {
+		if (str[i] == '\t') {
+			total += st->tabnumber - total % st->tabnumber;
 		}
 		else total++;
 	}
@@ -2381,9 +2400,9 @@ 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))
-		if(str[j]=='\t')
-			i += st->tabnumber - i%st->tabnumber;
+	for (i = 0, j = 0; i < index; j += BLI_str_utf8_size(str + j))
+		if (str[j] == '\t')
+			i += st->tabnumber - i % st->tabnumber;
 		else
 			i++;
 	
@@ -2397,10 +2416,11 @@ static TextLine *get_first_visible_line(SpaceText *st, ARegion *ar, int *y)
 	for (i = st->top; i > 0 && linep; ) {
 		int lines = text_get_visible_lines(st, ar, linep->line);
 		
-		if (i-lines < 0) {
+		if (i - lines < 0) {
 			*y += i;
 			break;
-		} else {
+		}
+		else {
 			linep = linep->next;
 			i -= lines;
 		}
@@ -2419,18 +2439,18 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in
 	/* Point to first visible line */
 	TextLine *linep = get_first_visible_line(st, ar, &y);
 	
-	while(loop && linep) {
+	while (loop && linep) {
 		int i = 0, start = 0, end = max; /* view */
 		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(linep->line + j)) {
 			int chars;
 			
 			/* Mimic replacement of tabs */
 			ch = linep->line[j];
-			if(ch == '\t') {
-				chars = st->tabnumber - i%st->tabnumber;
+			if (ch == '\t') {
+				chars = st->tabnumber - i % st->tabnumber;
 				ch = ' ';
 			}
 			else chars = 1;
@@ -2443,34 +2463,34 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in
 					break;
 					/* Exactly at the cursor */
 				}
-				else if (y == 0 && i-start == x) {
+				else if (y == 0 && i - start == x) {
 					/* current position could be wrapped to next line */
 					/* this should be checked when end of current line would be reached */
-					charp = curs= j;
+					charp = curs = j;
 					found = 1;
 					/* Prepare curs for next wrap */
 				}
-				else if(i - end == x) {
+				else if (i - end == x) {
 					curs = j;
 				}
 				if (i - start >= max) {
 					if (found) {
 						/* exact cursor position was found, check if it's */
 						/* still on needed line (hasn't been wrapped) */
-						if (charp > endj && !chop && ch!='\0') charp = endj;
+						if (charp > endj && !chop && ch != '\0') charp = endj;
 						loop = 0;
 						break;
 					}
 					
-					if(chop) endj = j;
+					if (chop) endj = j;
 					start = end;
 					end += max;
 					
-					if(j < linep->len)
+					if (j < linep->len)
 						y--;
 					
 					chop = 1;
-					if (y == 0 && i-start >= x) {
+					if (y == 0 && i - start >= x) {
 						charp = curs;
 						loop = 0;
 						break;
@@ -2482,7 +2502,7 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in
 						break;
 					}
 					
-					if(y == 0 && i-start >= x) {
+					if (y == 0 && i - start >= x) {
 						charp = curs;
 						loop = 0;
 						break;
@@ -2494,12 +2514,12 @@ static void text_cursor_set_to_pos_wrapped(SpaceText *st, ARegion *ar, int x, in
 				i++;
 			}
 			
-			if(ch == '\0') break;
+			if (ch == '\0') break;
 		}
 		
-		if(!loop || found) break;
+		if (!loop || found) break;
 		
-		if(!linep->next) {
+		if (!linep->next) {
 			charp = linep->len;
 			break;
 		}
@@ -2515,24 +2535,24 @@ 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; }
+		if (sel) { text->sell = linep; text->selc = charp; }
 		else { text->curl = linep; text->curc = charp; }
 	}
 }
 
 static void text_cursor_set_to_pos(SpaceText *st, ARegion *ar, int x, int y, int sel)
 {
-	Text *text= st->text;
+	Text *text = st->text;
 	text_update_character_width(st);
-	y= (ar->winy - 2 - y)/st->lheight;
+	y = (ar->winy - 2 - y) / st->lheight;
 
-	if(st->showlinenrs) x-= TXT_OFFSET+TEXTXLOC;
-	else x-= TXT_OFFSET;
+	if (st->showlinenrs) x -= TXT_OFFSET + TEXTXLOC;
+	else x -= TXT_OFFSET;
 
-	if(x<0) x= 0;
-	x = (x/st->cwidth) + st->left;
+	if (x < 0) x = 0;
+	x = text_pixel_x_to_index(st, x) + st->left;
 	
-	if(st->wordwrap) {
+	if (st->wordwrap) {
 		text_cursor_set_to_pos_wrapped(st, ar, x, y, sel);
 	}
 	else {
@@ -2540,105 +2560,105 @@ static void text_cursor_set_to_pos(SpaceText *st, ARegion *ar, int x, int y, int
 		int *charp;
 		int w;
 		
-		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; }
 		
-		y-= txt_get_span(text->lines.first, *linep) - st->top;
+		y -= txt_get_span(text->lines.first, *linep) - st->top;
 		
-		if(y>0) {
-			while(y-- != 0) if((*linep)->next) *linep= (*linep)->next;
+		if (y > 0) {
+			while (y-- != 0) if ((*linep)->next) *linep = (*linep)->next;
 		}
-		else if(y<0) {
-			while(y++ != 0) if((*linep)->prev) *linep= (*linep)->prev;
+		else if (y < 0) {
+			while (y++ != 0) if ((*linep)->prev) *linep = (*linep)->prev;
 		}
 
 		
-		w= flatten_len(st, (*linep)->line);
-		if(x<w) *charp= flatten_index_to_offset(st, (*linep)->line, x);
-		else *charp= (*linep)->len;
+		w = flatten_len(st, (*linep)->line);
+		if (x < w) *charp = flatten_index_to_offset(st, (*linep)->line, x);
+		else *charp = (*linep)->len;
 	}
-	if(!sel) txt_pop_sel(text);
+	if (!sel) txt_pop_sel(text);
 }
 
 static void text_cursor_set_apply(bContext *C, wmOperator *op, wmEvent *event)
 {
-	SpaceText *st= CTX_wm_space_text(C);
-	ARegion *ar= CTX_wm_region(C);
-	SetSelection *ssel= op->customdata;
+	SpaceText *st = CTX_wm_space_text(C);
+	ARegion *ar = CTX_wm_region(C);
+	SetSelection *ssel = op->customdata;
 
-	if(event->mval[1]<0 || event->mval[1]>ar->winy) {
-		int d= (ssel->old[1]-event->mval[1])*st->pix_per_line;
-		if(d) txt_screen_skip(st, ar, d);
+	if (event->mval[1] < 0 || event->mval[1] > ar->winy) {
+		int d = (ssel->old[1] - event->mval[1]) * st->pix_per_line;
+		if (d) txt_screen_skip(st, ar, d);
 
-		text_cursor_set_to_pos(st, ar, event->mval[0], event->mval[1]<0?0:ar->winy, 1);
+		text_cursor_set_to_pos(st, ar, event->mval[0], event->mval[1] < 0 ? 0 : ar->winy, 1);
 
 		text_update_cursor_moved(C);
-		WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, st->text);
+		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--;
+	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--;
 		
 		text_cursor_set_to_pos(st, ar, event->mval[0], event->mval[1], 1);
 		
 		text_update_cursor_moved(C);
-		WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, st->text);
+		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);
 
 		text_update_cursor_moved(C);
-		WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, st->text);
+		WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text);
 
-		ssel->old[0]= event->mval[0];
-		ssel->old[1]= event->mval[1];
+		ssel->old[0] = event->mval[0];
+		ssel->old[1] = event->mval[1];
 	} 
 }
 
 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;
+	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)) {
+	if (txt_has_sel(text)) {
 		buffer = txt_sel_to_buf(text);
 		WM_clipboard_text_set(buffer, 1);
 		MEM_freeN(buffer);
 	}
 
-	linep2= txt_get_span(st->text->lines.first, st->text->sell);
-	charp2= st->text->selc;
+	linep2 = txt_get_span(st->text->lines.first, st->text->sell);
+	charp2 = st->text->selc;
 		
-	if(ssel->sell!=linep2 || ssel->selc!=charp2)
+	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);
+	WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text);
 
 	MEM_freeN(ssel);
 }
 
 static int text_set_selection_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	SpaceText *st= CTX_wm_space_text(C);
+	SpaceText *st = CTX_wm_space_text(C);
 	SetSelection *ssel;
 
-	if(event->mval[0]>=st->txtbar.xmin)
+	if (event->mval[0] >= st->txtbar.xmin)
 		return OPERATOR_PASS_THROUGH;
 
-	op->customdata= MEM_callocN(sizeof(SetSelection), "SetCursor");
-	ssel= op->customdata;
-	ssel->selecting= RNA_boolean_get(op->ptr, "select");
+	op->customdata = MEM_callocN(sizeof(SetSelection), "SetCursor");
+	ssel = op->customdata;
+	ssel->selecting = RNA_boolean_get(op->ptr, "select");
 
-	ssel->old[0]= event->mval[0];
-	ssel->old[1]= event->mval[1];
+	ssel->old[0] = event->mval[0];
+	ssel->old[1] = event->mval[1];
 
-	ssel->sell= txt_get_span(st->text->lines.first, st->text->sell);
-	ssel->selc= st->text->selc;
+	ssel->sell = txt_get_span(st->text->lines.first, st->text->sell);
+	ssel->selc = st->text->selc;
 
 	WM_event_add_modal_handler(C, op);
 
@@ -2649,7 +2669,7 @@ static int text_set_selection_invoke(bContext *C, wmOperator *op, wmEvent *event
 
 static int text_set_selection_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
-	switch(event->type) {
+	switch (event->type) {
 		case LEFTMOUSE:
 		case MIDDLEMOUSE:
 		case RIGHTMOUSE:
@@ -2672,15 +2692,15 @@ static int text_set_selection_cancel(bContext *C, wmOperator *op)
 void TEXT_OT_selection_set(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Selection";
-	ot->idname= "TEXT_OT_selection_set";
-	ot->description= "Set cursor selection";
+	ot->name = "Set Selection";
+	ot->idname = "TEXT_OT_selection_set";
+	ot->description = "Set cursor selection";
 
 	/* api callbacks */
-	ot->invoke= text_set_selection_invoke;
-	ot->modal= text_set_selection_modal;
-	ot->cancel= text_set_selection_cancel;
-	ot->poll= text_region_edit_poll;
+	ot->invoke = text_set_selection_invoke;
+	ot->modal = text_set_selection_modal;
+	ot->cancel = text_set_selection_cancel;
+	ot->poll = text_region_edit_poll;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "select", 0, "Select", "Set selection end rather than cursor");
@@ -2690,31 +2710,31 @@ 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");
+	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;
+	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);
+	WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, st->text);
 
 	return OPERATOR_PASS_THROUGH;
 }
 
 static int text_cursor_set_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	SpaceText *st= CTX_wm_space_text(C);
+	SpaceText *st = CTX_wm_space_text(C);
 
-	if(event->mval[0]>=st->txtbar.xmin)
+	if (event->mval[0] >= st->txtbar.xmin)
 		return OPERATOR_PASS_THROUGH;
 
 	RNA_int_set(op->ptr, "x", event->mval[0]);
@@ -2726,14 +2746,14 @@ static int text_cursor_set_invoke(bContext *C, wmOperator *op, wmEvent *event)
 void TEXT_OT_cursor_set(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Cursor";
-	ot->idname= "TEXT_OT_cursor_set";
-	ot->description= "Set cursor position";
+	ot->name = "Set Cursor";
+	ot->idname = "TEXT_OT_cursor_set";
+	ot->description = "Set cursor position";
 
 	/* api callbacks */
-	ot->invoke= text_cursor_set_invoke;
-	ot->exec= text_cursor_set_exec;
-	ot->poll= text_region_edit_poll;
+	ot->invoke = text_cursor_set_invoke;
+	ot->exec = text_cursor_set_exec;
+	ot->poll = text_region_edit_poll;
 
 	/* properties */
 	RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX);
@@ -2744,37 +2764,37 @@ void TEXT_OT_cursor_set(wmOperatorType *ot)
 
 static int text_line_number_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
 {
-	SpaceText *st= CTX_wm_space_text(C);
-	Text *text= CTX_data_edit_text(C);
-	ARegion *ar= CTX_wm_region(C);
-	const int *mval= event->mval;
+	SpaceText *st = CTX_wm_space_text(C);
+	Text *text = CTX_data_edit_text(C);
+	ARegion *ar = CTX_wm_region(C);
+	const int *mval = event->mval;
 	double time;
-	static int jump_to= 0;
-	static double last_jump= 0;
+	static int jump_to = 0;
+	static double last_jump = 0;
 
 	text_update_character_width(st);
 
-	if(!st->showlinenrs)
+	if (!st->showlinenrs)
 		return OPERATOR_PASS_THROUGH;
 
-	if(!(mval[0]>2 && mval[0]<(TXT_OFFSET + TEXTXLOC) && mval[1]>2 && mval[1]<ar->winy-2))
+	if (!(mval[0] > 2 && mval[0] < (TXT_OFFSET + TEXTXLOC) && mval[1] > 2 && mval[1] < ar->winy - 2))
 		return OPERATOR_PASS_THROUGH;
 
-	if(!(event->ascii>='0' && event->ascii<='9'))
+	if (!(event->ascii >= '0' && event->ascii <= '9'))
 		return OPERATOR_PASS_THROUGH;
 
 	time = PIL_check_seconds_timer();
-	if(last_jump < time-1)
-		jump_to= 0;
+	if (last_jump < time - 1)
+		jump_to = 0;
 
 	jump_to *= 10;
-	jump_to += (int)(event->ascii-'0');
+	jump_to += (int)(event->ascii - '0');
 
-	txt_move_toline(text, jump_to-1, 0);
-	last_jump= time;
+	txt_move_toline(text, jump_to - 1, 0);
+	last_jump = time;
 
 	text_update_cursor_moved(C);
-	WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, text);
+	WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
 
 	return OPERATOR_FINISHED;
 }
@@ -2782,21 +2802,21 @@ static int text_line_number_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
 void TEXT_OT_line_number(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Line Number";
-	ot->idname= "TEXT_OT_line_number";
-	ot->description= "The current line number";
+	ot->name = "Line Number";
+	ot->idname = "TEXT_OT_line_number";
+	ot->description = "The current line number";
 	
 	/* api callbacks */
-	ot->invoke= text_line_number_invoke;
-	ot->poll= text_region_edit_poll;
+	ot->invoke = text_line_number_invoke;
+	ot->poll = text_region_edit_poll;
 }
 
 /******************* insert operator **********************/
 
 static int text_insert_exec(bContext *C, wmOperator *op)
 {
-	SpaceText *st= CTX_wm_space_text(C);
-	Text *text= CTX_data_edit_text(C);
+	SpaceText *st = CTX_wm_space_text(C);
+	Text *text = CTX_data_edit_text(C);
 	char *str;
 	int done = 0;
 	size_t i = 0;
@@ -2804,14 +2824,15 @@ static int text_insert_exec(bContext *C, wmOperator *op)
 
 	text_drawcache_tag_update(st, 0);
 
-	str= RNA_string_get_alloc(op->ptr, "text", NULL, 0);
+	str = RNA_string_get_alloc(op->ptr, "text", NULL, 0);
 
-	if(st && st->overwrite) {
+	if (st && st->overwrite) {
 		while (str[i]) {
 			code = BLI_str_utf8_as_unicode_step(str, &i);
 			done |= txt_replace_char(text, code);
 		}
-	} else {
+	}
+	else {
 		while (str[i]) {
 			code = BLI_str_utf8_as_unicode_step(str, &i);
 			done |= txt_add_char(text, code);
@@ -2820,13 +2841,13 @@ static int text_insert_exec(bContext *C, wmOperator *op)
 
 	MEM_freeN(str);
 	
-	if(!done)
+	if (!done)
 		return OPERATOR_CANCELLED;
 
 	text_update_line_edited(text->curl);
 
 	text_update_cursor_moved(C);
-	WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+	WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
 
 	return OPERATOR_FINISHED;
 }
@@ -2835,24 +2856,25 @@ static int text_insert_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 	int ret;
 
-	// if(!RNA_struct_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */
-	if(!RNA_string_length(op->ptr, "text")) {
+	// if (!RNA_struct_property_is_set(op->ptr, "text")) { /* always set from keymap XXX */
+	if (!RNA_string_length(op->ptr, "text")) {
 		/* if alt/ctrl/super are pressed pass through */
-		if(event->ctrl || event->oskey) {
+		if (event->ctrl || event->oskey) {
 			return OPERATOR_PASS_THROUGH;
 		}
 		else {
-			char str[BLI_UTF8_MAX+1];
+			char str[BLI_UTF8_MAX + 1];
 			size_t len;
 			
 			if (event->utf8_buf[0]) {
 				len = BLI_str_utf8_size(event->utf8_buf);
 				memcpy(str, event->utf8_buf, len);
-			} else {
+			}
+			else {
 				/* in theory, ghost can set value to extended ascii here */
 				len = BLI_str_utf8_from_unicode(event->ascii, str);
 			}
-			str[len]= '\0';
+			str[len] = '\0';
 			RNA_string_set(op->ptr, "text", str);
 		}
 	}
@@ -2860,7 +2882,7 @@ static int text_insert_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	ret = text_insert_exec(C, op);
 	
 	/* run the script while editing, evil but useful */
-	if(ret==OPERATOR_FINISHED && CTX_wm_space_text(C)->live_edit)
+	if (ret == OPERATOR_FINISHED && CTX_wm_space_text(C)->live_edit)
 		text_run_script(C, NULL);
 
 	return ret;
@@ -2868,114 +2890,117 @@ static int text_insert_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 void TEXT_OT_insert(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+
 	/* identifiers */
-	ot->name= "Insert";
-	ot->idname= "TEXT_OT_insert";
-	ot->description= "Insert text at cursor position";
+	ot->name = "Insert";
+	ot->idname = "TEXT_OT_insert";
+	ot->description = "Insert text at cursor position";
 	
 	/* api callbacks */
-	ot->exec= text_insert_exec;
-	ot->invoke= text_insert_invoke;
-	ot->poll= text_edit_poll;
+	ot->exec = text_insert_exec;
+	ot->invoke = text_insert_invoke;
+	ot->poll = text_edit_poll;
 
 	/* properties */
-	RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position");
+	prop = RNA_def_string(ot->srna, "text", "", 0, "Text", "Text to insert at the cursor position");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 }
 
 /******************* find operator *********************/
 
 /* mode */
-#define TEXT_FIND		0
-#define TEXT_REPLACE	1
-#define TEXT_MARK_ALL	2
+#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;
+	Main *bmain = CTX_data_main(C);
+	SpaceText *st = CTX_wm_space_text(C);
+	Text *start = NULL, *text = st->text;
+	int flags, first = 1;
 	int found = 0;
 	char *tmp;
 
-	if(!st->findstr[0] || (mode == TEXT_REPLACE && !st->replacestr[0]))
+	if (!st->findstr[0] || (mode == TEXT_REPLACE && !st->replacestr[0]))
 		return OPERATOR_CANCELLED;
 
-	flags= st->flags;
-	if(flags & ST_FIND_ALL)
+	flags = st->flags;
+	if (flags & ST_FIND_ALL)
 		flags ^= ST_FIND_WRAP;
 
 	do {
-		int proceed= 0;
+		int proceed = 0;
 
-		if(first) {
-			if(text->markers.first)
-				WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+		if (first) {
+			if (text->markers.first)
+				WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
 
 			txt_clear_markers(text, TMARK_GRP_FINDALL, 0);
 		}
 
-		first= 0;
+		first = 0;
 		
 		/* Replace current */
-		if(mode!=TEXT_FIND && txt_has_sel(text)) {
-			tmp= txt_sel_to_buf(text);
+		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 (flags & ST_MATCH_CASE) proceed = strcmp(st->findstr, tmp) == 0;
+			else proceed = BLI_strcasecmp(st->findstr, tmp) == 0;
 
-			if(proceed) {
-				if(mode==TEXT_REPLACE) {
+			if (proceed) {
+				if (mode == TEXT_REPLACE) {
 					txt_insert_buf(text, st->replacestr);
-					if(text->curl && text->curl->format) {
+					if (text->curl && text->curl->format) {
 						MEM_freeN(text->curl->format);
-						text->curl->format= NULL;
+						text->curl->format = NULL;
 					}
 					text_update_cursor_moved(C);
-					WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+					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) {
+				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;
+					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);
+					WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
 				}
 			}
 			MEM_freeN(tmp);
-			tmp= NULL;
+			tmp = NULL;
 		}
 
 		/* Find next */
-		if(txt_find_string(text, st->findstr, flags & ST_FIND_WRAP, flags & ST_MATCH_CASE)) {
+		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);
+			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 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;
+				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;
+			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);
+			if (!found && !proceed) BKE_reportf(op->reports, RPT_ERROR, "Text not found: %s", st->findstr);
 			break;
 		}
 		found = 1;
-	} while(mode==TEXT_MARK_ALL);
+	} while (mode == TEXT_MARK_ALL);
 
 	return OPERATOR_FINISHED;
 }
@@ -2988,13 +3013,13 @@ static int text_find_exec(bContext *C, wmOperator *op)
 void TEXT_OT_find(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Find";
-	ot->idname= "TEXT_OT_find";
-	ot->description= "Find specified text";
+	ot->name = "Find";
+	ot->idname = "TEXT_OT_find";
+	ot->description = "Find specified text";
 	
 	/* api callbacks */
-	ot->exec= text_find_exec;
-	ot->poll= text_space_edit_poll;
+	ot->exec = text_find_exec;
+	ot->poll = text_space_edit_poll;
 }
 
 /******************* replace operator *********************/
@@ -3007,13 +3032,13 @@ static int text_replace_exec(bContext *C, wmOperator *op)
 void TEXT_OT_replace(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Replace";
-	ot->idname= "TEXT_OT_replace";
-	ot->description= "Replace text with the specified text";
+	ot->name = "Replace";
+	ot->idname = "TEXT_OT_replace";
+	ot->description = "Replace text with the specified text";
 
 	/* api callbacks */
-	ot->exec= text_replace_exec;
-	ot->poll= text_space_edit_poll;
+	ot->exec = text_replace_exec;
+	ot->poll = text_space_edit_poll;
 }
 
 /******************* mark all operator *********************/
@@ -3026,28 +3051,28 @@ static int text_mark_all_exec(bContext *C, wmOperator *op)
 void TEXT_OT_mark_all(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Mark All";
-	ot->idname= "TEXT_OT_mark_all";
-	ot->description= "Mark all specified text";
+	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;
+	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)
 {
-	SpaceText *st= CTX_wm_space_text(C);
-	Text *text= CTX_data_edit_text(C);
+	SpaceText *st = CTX_wm_space_text(C);
+	Text *text = CTX_data_edit_text(C);
 	char *tmp;
 
-	tmp= txt_sel_to_buf(text);
+	tmp = txt_sel_to_buf(text);
 	BLI_strncpy(st->findstr, tmp, ST_MAX_FIND_STR);
 	MEM_freeN(tmp);
 
-	if(!st->findstr[0])
+	if (!st->findstr[0])
 		return OPERATOR_FINISHED;
 
 	return text_find_and_replace(C, op, TEXT_FIND);
@@ -3056,24 +3081,24 @@ static int text_find_set_selected_exec(bContext *C, wmOperator *op)
 void TEXT_OT_find_set_selected(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Find Set Selected";
-	ot->idname= "TEXT_OT_find_set_selected";
-	ot->description= "Find specified text and set as selected";
+	ot->name = "Find Set Selected";
+	ot->idname = "TEXT_OT_find_set_selected";
+	ot->description = "Find specified text and set as selected";
 	
 	/* api callbacks */
-	ot->exec= text_find_set_selected_exec;
-	ot->poll= text_space_edit_poll;
+	ot->exec = text_find_set_selected_exec;
+	ot->poll = text_space_edit_poll;
 }
 
 /******************* replace set selected *********************/
 
 static int text_replace_set_selected_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	SpaceText *st= CTX_wm_space_text(C);
-	Text *text= CTX_data_edit_text(C);
+	SpaceText *st = CTX_wm_space_text(C);
+	Text *text = CTX_data_edit_text(C);
 	char *tmp;
 
-	tmp= txt_sel_to_buf(text);
+	tmp = txt_sel_to_buf(text);
 	BLI_strncpy(st->replacestr, tmp, ST_MAX_FIND_STR);
 	MEM_freeN(tmp);
 
@@ -3083,29 +3108,30 @@ static int text_replace_set_selected_exec(bContext *C, wmOperator *UNUSED(op))
 void TEXT_OT_replace_set_selected(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Replace Set Selected";
-	ot->idname= "TEXT_OT_replace_set_selected";
-	ot->description= "Replace text with specified text and set as selected";
+	ot->name = "Replace Set Selected";
+	ot->idname = "TEXT_OT_replace_set_selected";
+	ot->description = "Replace text with specified text and set as selected";
 	
 	/* api callbacks */
-	ot->exec= text_replace_set_selected_exec;
-	ot->poll= text_space_edit_poll;
+	ot->exec = text_replace_set_selected_exec;
+	ot->poll = text_space_edit_poll;
 }
 
 /****************** resolve conflict operator ******************/
 
 enum { RESOLVE_IGNORE, RESOLVE_RELOAD, RESOLVE_SAVE, RESOLVE_MAKE_INTERNAL };
-static EnumPropertyItem resolution_items[]= {
+static EnumPropertyItem resolution_items[] = {
 	{RESOLVE_IGNORE, "IGNORE", 0, "Ignore", ""},
 	{RESOLVE_RELOAD, "RELOAD", 0, "Reload", ""},
 	{RESOLVE_SAVE, "SAVE", 0, "Save", ""},
 	{RESOLVE_MAKE_INTERNAL, "MAKE_INTERNAL", 0, "Make Internal", ""},
-	{0, NULL, 0, NULL, NULL}};
+	{0, NULL, 0, NULL, NULL}
+};
 
 /* returns 0 if file on disk is the same or Text is in memory only
-   returns 1 if file has been modified on disk since last local edit
-   returns 2 if file on disk has been deleted
-   -1 is returned if an error occurs */
+ * returns 1 if file has been modified on disk since last local edit
+ * returns 2 if file on disk has been deleted
+ * -1 is returned if an error occurs */
 
 int text_file_modified(Text *text)
 {
@@ -3113,24 +3139,24 @@ int text_file_modified(Text *text)
 	int result;
 	char file[FILE_MAX];
 
-	if(!text || !text->name)
+	if (!text || !text->name)
 		return 0;
 
 	BLI_strncpy(file, text->name, FILE_MAX);
 	BLI_path_abs(file, G.main->name);
 
-	if(!BLI_exists(file))
+	if (!BLI_exists(file))
 		return 2;
 
 	result = stat(file, &st);
 	
-	if(result == -1)
+	if (result == -1)
 		return -1;
 
-	if((st.st_mode & S_IFMT) != S_IFREG)
+	if ((st.st_mode & S_IFMT) != S_IFREG)
 		return -1;
 
-	if(st.st_mtime > text->mtime)
+	if (st.st_mtime > text->mtime)
 		return 1;
 
 	return 0;
@@ -3142,27 +3168,27 @@ static void text_ignore_modified(Text *text)
 	int result;
 	char file[FILE_MAX];
 
-	if(!text || !text->name) return;
+	if (!text || !text->name) return;
 
 	BLI_strncpy(file, text->name, FILE_MAX);
 	BLI_path_abs(file, G.main->name);
 
-	if(!BLI_exists(file)) return;
+	if (!BLI_exists(file)) return;
 
 	result = stat(file, &st);
 	
-	if(result == -1 || (st.st_mode & S_IFMT) != S_IFREG)
+	if (result == -1 || (st.st_mode & S_IFMT) != S_IFREG)
 		return;
 
-	text->mtime= st.st_mtime;
+	text->mtime = st.st_mtime;
 }
 
 static int text_resolve_conflict_exec(bContext *C, wmOperator *op)
 {
-	Text *text= CTX_data_edit_text(C);
-	int resolution= RNA_enum_get(op->ptr, "resolution");
+	Text *text = CTX_data_edit_text(C);
+	int resolution = RNA_enum_get(op->ptr, "resolution");
 
-	switch(resolution) {
+	switch (resolution) {
 		case RESOLVE_RELOAD:
 			return text_reload_exec(C, op);
 		case RESOLVE_SAVE:
@@ -3179,24 +3205,24 @@ static int text_resolve_conflict_exec(bContext *C, wmOperator *op)
 
 static int text_resolve_conflict_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	Text *text= CTX_data_edit_text(C);
+	Text *text = CTX_data_edit_text(C);
 	uiPopupMenu *pup;
 	uiLayout *layout;
 
-	switch(text_file_modified(text)) {
+	switch (text_file_modified(text)) {
 		case 1:
-			if(text->flags & TXT_ISDIRTY) {
+			if (text->flags & TXT_ISDIRTY) {
 				/* modified locally and externally, ahhh. offer more possibilites. */
-				pup= uiPupMenuBegin(C, "File Modified Outside and Inside Blender", ICON_NONE);
-				layout= uiPupMenuLayout(pup);
+				pup = uiPupMenuBegin(C, "File Modified Outside and Inside Blender", ICON_NONE);
+				layout = uiPupMenuLayout(pup);
 				uiItemEnumO_ptr(layout, op->type, "Reload from disk (ignore local changes)", 0, "resolution", RESOLVE_RELOAD);
 				uiItemEnumO_ptr(layout, op->type, "Save to disk (ignore outside changes)", 0, "resolution", RESOLVE_SAVE);
 				uiItemEnumO_ptr(layout, op->type, "Make text internal (separate copy)", 0, "resolution", RESOLVE_MAKE_INTERNAL);
 				uiPupMenuEnd(C, pup);
 			}
 			else {
-				pup= uiPupMenuBegin(C, "File Modified Outside Blender", ICON_NONE);
-				layout= uiPupMenuLayout(pup);
+				pup = uiPupMenuBegin(C, "File Modified Outside Blender", ICON_NONE);
+				layout = uiPupMenuLayout(pup);
 				uiItemEnumO_ptr(layout, op->type, "Reload from disk", 0, "resolution", RESOLVE_RELOAD);
 				uiItemEnumO_ptr(layout, op->type, "Make text internal (separate copy)", 0, "resolution", RESOLVE_MAKE_INTERNAL);
 				uiItemEnumO_ptr(layout, op->type, "Ignore", 0, "resolution", RESOLVE_IGNORE);
@@ -3204,8 +3230,8 @@ static int text_resolve_conflict_invoke(bContext *C, wmOperator *op, wmEvent *UN
 			}
 			break;
 		case 2:
-			pup= uiPupMenuBegin(C, "File Deleted Outside Blender", ICON_NONE);
-			layout= uiPupMenuLayout(pup);
+			pup = uiPupMenuBegin(C, "File Deleted Outside Blender", ICON_NONE);
+			layout = uiPupMenuLayout(pup);
 			uiItemEnumO_ptr(layout, op->type, "Make text internal", 0, "resolution", RESOLVE_MAKE_INTERNAL);
 			uiItemEnumO_ptr(layout, op->type, "Recreate file", 0, "resolution", RESOLVE_SAVE);
 			uiPupMenuEnd(C, pup);
@@ -3218,14 +3244,14 @@ static int text_resolve_conflict_invoke(bContext *C, wmOperator *op, wmEvent *UN
 void TEXT_OT_resolve_conflict(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Resolve Conflict";
-	ot->idname= "TEXT_OT_resolve_conflict";
-	ot->description= "When external text is out of sync, resolve the conflict";
+	ot->name = "Resolve Conflict";
+	ot->idname = "TEXT_OT_resolve_conflict";
+	ot->description = "When external text is out of sync, resolve the conflict";
 
 	/* api callbacks */
-	ot->exec= text_resolve_conflict_exec;
-	ot->invoke= text_resolve_conflict_invoke;
-	ot->poll= text_save_poll;
+	ot->exec = text_resolve_conflict_exec;
+	ot->invoke = text_resolve_conflict_invoke;
+	ot->poll = text_save_poll;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "resolution", resolution_items, RESOLVE_IGNORE, "Resolution", "How to solve conflict due to differences in internal and external text");
@@ -3235,8 +3261,8 @@ void TEXT_OT_resolve_conflict(wmOperatorType *ot)
 
 static int text_to_3d_object_exec(bContext *C, wmOperator *op)
 {
-	Text *text= CTX_data_edit_text(C);
-	int split_lines= RNA_boolean_get(op->ptr, "split_lines");
+	Text *text = CTX_data_edit_text(C);
+	int split_lines = RNA_boolean_get(op->ptr, "split_lines");
 
 	ED_text_to_object(C, text, split_lines);
 
@@ -3246,16 +3272,16 @@ static int text_to_3d_object_exec(bContext *C, wmOperator *op)
 void TEXT_OT_to_3d_object(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "To 3D Object";
-	ot->idname= "TEXT_OT_to_3d_object";
-	ot->description= "Create 3d text object from active text data block";
+	ot->name = "To 3D Object";
+	ot->idname = "TEXT_OT_to_3d_object";
+	ot->description = "Create 3d text object from active text data block";
 	
 	/* api callbacks */
-	ot->exec= text_to_3d_object_exec;
-	ot->poll= text_edit_poll;
+	ot->exec = text_to_3d_object_exec;
+	ot->poll = text_edit_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "split_lines", 0, "Split Lines", "Create one object per line in the text");
@@ -3266,20 +3292,20 @@ void TEXT_OT_to_3d_object(wmOperatorType *ot)
 
 void ED_text_undo_step(bContext *C, int step)
 {
-	Text *text= CTX_data_edit_text(C);
+	Text *text = CTX_data_edit_text(C);
 
-	if(!text)
+	if (!text)
 		return;
 
-	if(step==1)
+	if (step == 1)
 		txt_do_undo(text);
-	else if(step==-1)
+	else if (step == -1)
 		txt_do_redo(text);
 
 	text_update_edited(text);
 
 	text_update_cursor_moved(C);
 	text_drawcache_tag_update(CTX_wm_space_text(C), 1);
-	WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+	WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
 }
 
diff --git a/source/blender/editors/space_text/text_python.c b/source/blender/editors/space_text/text_python.c
index efe7446..23fff8f 100644
--- a/source/blender/editors/space_text/text_python.c
+++ b/source/blender/editors/space_text/text_python.c
@@ -55,49 +55,49 @@ int text_do_suggest_select(SpaceText *st, ARegion *ar)
 	int tgti, *top;
 	int mval[2] = {0, 0};
 	
-	if(!st || !st->text) return 0;
-	if(!texttool_text_is_active(st->text)) return 0;
+	if (!st || !st->text) return 0;
+	if (!texttool_text_is_active(st->text)) return 0;
 
 	first = texttool_suggest_first();
 	last = texttool_suggest_last();
 	/* sel = texttool_suggest_selected(); */ /* UNUSED */
 	top = texttool_suggest_top();
 
-	if(!last || !first)
+	if (!last || !first)
 		return 0;
 
 	/* Count the visible lines to the cursor */
-	for(tmp=st->text->curl, l=-st->top; tmp; tmp=tmp->prev, l++);
-	if(l<0) return 0;
+	for (tmp = st->text->curl, l = -st->top; tmp; tmp = tmp->prev, l++) ;
+	if (l < 0) return 0;
 
 	text_update_character_width(st);
 	
-	if(st->showlinenrs) {
-		x = st->cwidth*(st->text->curc-st->left) + TXT_OFFSET + TEXTXLOC - 4;
+	if (st->showlinenrs) {
+		x = st->cwidth * (st->text->curc - st->left) + TXT_OFFSET + TEXTXLOC - 4;
 	}
 	else {
-		x = st->cwidth*(st->text->curc-st->left) + TXT_OFFSET - 4;
+		x = st->cwidth * (st->text->curc - st->left) + TXT_OFFSET - 4;
 	}
-	y = ar->winy - st->lheight*l - 2;
+	y = ar->winy - st->lheight * l - 2;
 
-	w = SUGG_LIST_WIDTH*st->cwidth + 20;
-	h = SUGG_LIST_SIZE*st->lheight + 8;
+	w = SUGG_LIST_WIDTH * st->cwidth + 20;
+	h = SUGG_LIST_SIZE * st->lheight + 8;
 
 	// XXX getmouseco_areawin(mval);
 
-	if(mval[0]<x || x+w<mval[0] || mval[1]<y-h || y<mval[1])
+	if (mval[0] < x || x + w < mval[0] || mval[1] < y - h || y < mval[1])
 		return 0;
 
 	/* Work out which of the items is at the top of the visible list */
-	for(i=0, item=first; i<*top && item->next; i++, item=item->next);
+	for (i = 0, item = first; i < *top && item->next; i++, item = item->next) ;
 
 	/* Work out the target item index in the visible list */
-	tgti = (y-mval[1]-4) / st->lheight;
-	if(tgti<0 || tgti>SUGG_LIST_SIZE)
+	tgti = (y - mval[1] - 4) / st->lheight;
+	if (tgti < 0 || tgti > SUGG_LIST_SIZE)
 		return 1;
 
-	for(i=tgti; i>0 && item->next; i--, item=item->next);
-	if(item)
+	for (i = tgti; i > 0 && item->next; i--, item = item->next) ;
+	if (item)
 		texttool_suggest_select(item);
 	return 1;
 }
@@ -107,19 +107,19 @@ void text_pop_suggest_list(void)
 	SuggItem *item, *sel;
 	int *top, i;
 
-	item= texttool_suggest_first();
-	sel= texttool_suggest_selected();
-	top= texttool_suggest_top();
+	item = texttool_suggest_first();
+	sel = texttool_suggest_selected();
+	top = texttool_suggest_top();
 
-	i= 0;
-	while(item && item != sel) {
-		item= item->next;
+	i = 0;
+	while (item && item != sel) {
+		item = item->next;
 		i++;
 	}
-	if(i > *top+SUGG_LIST_SIZE-1)
-		*top= i-SUGG_LIST_SIZE+1;
-	else if(i < *top)
-		*top= i;
+	if (i > *top + SUGG_LIST_SIZE - 1)
+		*top = i - SUGG_LIST_SIZE + 1;
+	else if (i < *top)
+		*top = i;
 }
 
 static void get_suggest_prefix(Text *text, int offset)
@@ -127,53 +127,53 @@ static void get_suggest_prefix(Text *text, int offset)
 	int i, len;
 	char *line, tmp[256];
 
-	if(!text) return;
-	if(!texttool_text_is_active(text)) return;
+	if (!text) return;
+	if (!texttool_text_is_active(text)) return;
 
-	line= text->curl->line;
-	for(i=text->curc-1+offset; i>=0; i--)
-		if(!text_check_identifier(line[i]))
+	line = text->curl->line;
+	for (i = text->curc - 1 + offset; i >= 0; i--)
+		if (!text_check_identifier(line[i]))
 			break;
 	i++;
-	len= text->curc-i+offset;
-	if(len > 255) {
+	len = text->curc - i + offset;
+	if (len > 255) {
 		printf("Suggestion prefix too long\n");
 		len = 255;
 	}
-	BLI_strncpy(tmp, line+i, len);
-	tmp[len]= '\0';
+	BLI_strncpy(tmp, line + i, len);
+	tmp[len] = '\0';
 	texttool_suggest_prefix(tmp);
 }
 
 static void confirm_suggestion(Text *text, int skipleft)
 {
 	SuggItem *sel;
-	int i, over=0;
+	int i, over = 0;
 	char *line;
 
-	if(!text) return;
-	if(!texttool_text_is_active(text)) return;
+	if (!text) return;
+	if (!texttool_text_is_active(text)) return;
 
 	sel = texttool_suggest_selected();
-	if(!sel) return;
+	if (!sel) return;
 
-	line= text->curl->line;
-	i=text->curc-skipleft-1;
-	while(i>=0) {
-		if(!text_check_identifier(line[i]))
+	line = text->curl->line;
+	i = text->curc - skipleft - 1;
+	while (i >= 0) {
+		if (!text_check_identifier(line[i]))
 			break;
 		over++;
 		i--;
 	}
 
-	for(i=0; i<skipleft; i++)
+	for (i = 0; i < skipleft; i++)
 		txt_move_left(text, 0);
-	for(i=0; i<over; i++)
+	for (i = 0; i < over; i++)
 		txt_move_left(text, 1);
 
 	txt_insert_buf(text, sel->name);
 	
-	for(i=0; i<skipleft; i++)
+	for (i = 0; i < skipleft; i++)
 		txt_move_right(text, 0);
 
 	texttool_text_clear();
@@ -189,85 +189,85 @@ static void confirm_suggestion(Text *text, int skipleft)
 #define LR_OSKEY 0
 
 // XXX
-static int doc_scroll= 0;
+static int doc_scroll = 0;
 
-static short UNUSED_FUNCTION(do_texttools)(SpaceText *st, char ascii, unsigned short evnt, short val)
+static short UNUSED_FUNCTION(do_texttools) (SpaceText * st, char ascii, unsigned short evnt, short val)
 {
-	ARegion *ar= NULL; // XXX
-	int qual= 0; // XXX
-	int draw=0, tools=0, swallow=0, scroll=1;
-	if(!texttool_text_is_active(st->text)) return 0;
-	if(!st->text || st->text->id.lib) return 0;
-
-	if(st->doplugins && texttool_text_is_active(st->text)) {
-		if(texttool_suggest_first()) tools |= TOOL_SUGG_LIST;
-		if(texttool_docs_get()) tools |= TOOL_DOCUMENT;
+	ARegion *ar = NULL; // XXX
+	int qual = 0; // XXX
+	int draw = 0, tools = 0, swallow = 0, scroll = 1;
+	if (!texttool_text_is_active(st->text)) return 0;
+	if (!st->text || st->text->id.lib) return 0;
+
+	if (st->doplugins && texttool_text_is_active(st->text)) {
+		if (texttool_suggest_first()) tools |= TOOL_SUGG_LIST;
+		if (texttool_docs_get()) tools |= TOOL_DOCUMENT;
 	}
 
-	if(ascii) {
-		if(tools & TOOL_SUGG_LIST) {
-			if((ascii != '_' && ascii != '*' && ispunct(ascii)) || text_check_whitespace(ascii)) {
+	if (ascii) {
+		if (tools & TOOL_SUGG_LIST) {
+			if ((ascii != '_' && ascii != '*' && ispunct(ascii)) || text_check_whitespace(ascii)) {
 				confirm_suggestion(st->text, 0);
 				text_update_line_edited(st->text->curl);
 			}
-			else if((st->overwrite && txt_replace_char(st->text, ascii)) || txt_add_char(st->text, ascii)) {
+			else if ((st->overwrite && txt_replace_char(st->text, ascii)) || txt_add_char(st->text, ascii)) {
 				get_suggest_prefix(st->text, 0);
 				text_pop_suggest_list();
-				swallow= 1;
-				draw= 1;
+				swallow = 1;
+				draw = 1;
 			}
 		}
-		if(tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll= 0, draw= 1;
+		if (tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll = 0, draw = 1;
 
 	}
-	else if(val==1 && evnt) {
+	else if (val == 1 && evnt) {
 		switch (evnt) {
 			case LEFTMOUSE:
-				if(text_do_suggest_select(st, ar))
-					swallow= 1;
+				if (text_do_suggest_select(st, ar))
+					swallow = 1;
 				else {
-					if(tools & TOOL_SUGG_LIST) texttool_suggest_clear();
-					if(tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll= 0;
+					if (tools & TOOL_SUGG_LIST) texttool_suggest_clear();
+					if (tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll = 0;
 				}
-				draw= 1;
+				draw = 1;
 				break;
 			case MIDDLEMOUSE:
-				if(text_do_suggest_select(st, ar)) {
+				if (text_do_suggest_select(st, ar)) {
 					confirm_suggestion(st->text, 0);
 					text_update_line_edited(st->text->curl);
-					swallow= 1;
+					swallow = 1;
 				}
 				else {
-					if(tools & TOOL_SUGG_LIST) texttool_suggest_clear();
-					if(tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll= 0;
+					if (tools & TOOL_SUGG_LIST) texttool_suggest_clear();
+					if (tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll = 0;
 				}
-				draw= 1;
+				draw = 1;
 				break;
 			case ESCKEY:
-				draw= swallow= 1;
-				if(tools & TOOL_SUGG_LIST) texttool_suggest_clear();
-				else if(tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll= 0;
-				else draw= swallow= 0;
+				draw = swallow = 1;
+				if (tools & TOOL_SUGG_LIST) texttool_suggest_clear();
+				else if (tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll = 0;
+				else draw = swallow = 0;
 				break;
 			case RETKEY:
-				if(tools & TOOL_SUGG_LIST) {
+				if (tools & TOOL_SUGG_LIST) {
 					confirm_suggestion(st->text, 0);
 					text_update_line_edited(st->text->curl);
-					swallow= 1;
-					draw= 1;
+					swallow = 1;
+					draw = 1;
 				}
-				if(tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll= 0, draw= 1;
+				if (tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll = 0, draw = 1;
 				break;
 			case LEFTARROWKEY:
 			case BACKSPACEKEY:
-				if(tools & TOOL_SUGG_LIST) {
-					if(qual)
+				if (tools & TOOL_SUGG_LIST) {
+					if (qual)
 						texttool_suggest_clear();
 					else {
 						/* Work out which char we are about to delete/pass */
-						if(st->text->curl && st->text->curc > 0) {
-							char ch= st->text->curl->line[st->text->curc-1];
-							if((ch=='_' || !ispunct(ch)) && !text_check_whitespace(ch)) {
+						if (st->text->curl && st->text->curc > 0) {
+							char ch = st->text->curl->line[st->text->curc - 1];
+							if ((ch == '_' || !ispunct(ch)) && !text_check_whitespace(ch)) {
 								get_suggest_prefix(st->text, -1);
 								text_pop_suggest_list();
 							}
@@ -278,17 +278,17 @@ static short UNUSED_FUNCTION(do_texttools)(SpaceText *st, char ascii, unsigned s
 							texttool_suggest_clear();
 					}
 				}
-				if(tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll= 0;
+				if (tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll = 0;
 				break;
 			case RIGHTARROWKEY:
-				if(tools & TOOL_SUGG_LIST) {
-					if(qual)
+				if (tools & TOOL_SUGG_LIST) {
+					if (qual)
 						texttool_suggest_clear();
 					else {
 						/* Work out which char we are about to pass */
-						if(st->text->curl && st->text->curc < st->text->curl->len) {
-							char ch= st->text->curl->line[st->text->curc+1];
-							if((ch=='_' || !ispunct(ch)) && !text_check_whitespace(ch)) {
+						if (st->text->curl && st->text->curc < st->text->curl->len) {
+							char ch = st->text->curl->line[st->text->curc + 1];
+							if ((ch == '_' || !ispunct(ch)) && !text_check_whitespace(ch)) {
 								get_suggest_prefix(st->text, 1);
 								text_pop_suggest_list();
 							}
@@ -299,249 +299,254 @@ static short UNUSED_FUNCTION(do_texttools)(SpaceText *st, char ascii, unsigned s
 							texttool_suggest_clear();
 					}
 				}
-				if(tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll= 0;
+				if (tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll = 0;
 				break;
 			case PAGEDOWNKEY:
-				scroll= SUGG_LIST_SIZE-1;
+				scroll = SUGG_LIST_SIZE - 1;
 			case WHEELDOWNMOUSE:
 			case DOWNARROWKEY:
-				if(tools & TOOL_DOCUMENT) {
+				if (tools & TOOL_DOCUMENT) {
 					doc_scroll++;
-					swallow= 1;
-					draw= 1;
+					swallow = 1;
+					draw = 1;
 					break;
 				}
-				else if(tools & TOOL_SUGG_LIST) {
+				else if (tools & TOOL_SUGG_LIST) {
 					SuggItem *sel = texttool_suggest_selected();
-					if(!sel) {
+					if (!sel) {
 						texttool_suggest_select(texttool_suggest_first());
 					}
-					else while(sel && sel!=texttool_suggest_last() && sel->next && scroll--) {
-						texttool_suggest_select(sel->next);
-						sel= sel->next;
+					else {
+						while (sel && sel != texttool_suggest_last() && sel->next && scroll--) {
+							texttool_suggest_select(sel->next);
+							sel = sel->next;
+						}
 					}
 					text_pop_suggest_list();
-					swallow= 1;
-					draw= 1;
+					swallow = 1;
+					draw = 1;
 					break;
 				}
 			case PAGEUPKEY:
-				scroll= SUGG_LIST_SIZE-1;
+				scroll = SUGG_LIST_SIZE - 1;
 			case WHEELUPMOUSE:
 			case UPARROWKEY:
-				if(tools & TOOL_DOCUMENT) {
-					if(doc_scroll>0) doc_scroll--;
-					swallow= 1;
-					draw= 1;
+				if (tools & TOOL_DOCUMENT) {
+					if (doc_scroll > 0) doc_scroll--;
+					swallow = 1;
+					draw = 1;
 					break;
 				}
-				else if(tools & TOOL_SUGG_LIST) {
+				else if (tools & TOOL_SUGG_LIST) {
 					SuggItem *sel = texttool_suggest_selected();
-					while(sel && sel!=texttool_suggest_first() && sel->prev && scroll--) {
+					while (sel && sel != texttool_suggest_first() && sel->prev && scroll--) {
 						texttool_suggest_select(sel->prev);
-						sel= sel->prev;
+						sel = sel->prev;
 					}
 					text_pop_suggest_list();
-					swallow= 1;
-					draw= 1;
+					swallow = 1;
+					draw = 1;
 					break;
 				}
 			case RIGHTSHIFTKEY:
 			case LEFTSHIFTKEY:
 				break;
 			default:
-				if(tools & TOOL_SUGG_LIST) texttool_suggest_clear(), draw= 1;
-				if(tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll= 0, draw= 1;
+				if (tools & TOOL_SUGG_LIST) texttool_suggest_clear(), draw = 1;
+				if (tools & TOOL_DOCUMENT) texttool_docs_clear(), doc_scroll = 0, draw = 1;
 		}
 	}
 
-	if(draw)
-		{}; // XXX redraw_alltext();
-	
+	if (draw) {
+		// XXX redraw_alltext();
+	}
+
 	return swallow;
 }
 
 #if 0
 #ifdef WITH_PYTHON	
-	/* Run text plugin scripts if enabled */
-	if(st->doplugins && event && val) {
-		if(BPY_menu_do_shortcut(PYMENU_TEXTPLUGIN, event, qual)) {
-			do_draw= 1;
-		}
+/* Run text plugin scripts if enabled */
+if (st->doplugins && event && val)
+{
+	if (BPY_menu_do_shortcut(PYMENU_TEXTPLUGIN, event, qual)) {
+		do_draw = 1;
 	}
+}
 #endif
-	if(do_draw)
-		; // XXX redraw_alltext();
+if (do_draw)
+	;     // XXX redraw_alltext();
 #endif
 
-static short UNUSED_FUNCTION(do_textmarkers)(SpaceText *st, char ascii, unsigned short evnt, short val)
+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
+	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;
+	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;
+	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) {
+	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;
+		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;
+				mrk = mrk->next;
 			}
-			if(marker) {
+			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;
+				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 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;
+			evnt = ascii = val = 0;
+			draw = 1;
 		}
-		if(!swallow) return 0;
+		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))
+	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)) {
+					if (txt_add_char(text, ascii)) {
 						text_update_line_edited(st->text->curl);
 					}
 				}
 
-				if(mrk==marker || mrk==nxt) break;
-				mrk=nxt;
+				if (mrk == marker || mrk == nxt) break;
+				mrk = nxt;
 			}
-			swallow= 1;
-			draw= 1;
+			swallow = 1;
+			draw = 1;
 		}
 	}
-	else if(val) {
-		switch(evnt) {
+	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;
+				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);
+					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;
+						if (mrk == marker || mrk == nxt) break;
+						mrk = nxt;
 					}
-					swallow= 1;
-					draw= 1;
+					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;
+				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);
+					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;
+						if (mrk == marker || mrk == nxt) break;
+						mrk = nxt;
 					}
-					swallow= 1;
-					draw= 1;
+					swallow = 1;
+					draw = 1;
 				}
 				break;
 			case TABKEY:
-				if(qual & LR_SHIFTKEY) {
-					nxt= marker->prev;
-					if(!nxt) nxt= text->markers.last;
+				if (qual & LR_SHIFTKEY) {
+					nxt = marker->prev;
+					if (!nxt) nxt = text->markers.last;
 				}
 				else {
-					nxt= marker->next;
-					if(!nxt) nxt= text->markers.first;
+					nxt = marker->next;
+					if (!nxt) nxt = text->markers.first;
 				}
-				if(marker->flags & TMARK_TEMP) {
-					if(nxt==marker) nxt= NULL;
+				if (marker->flags & TMARK_TEMP) {
+					if (nxt == marker) nxt = NULL;
 					BLI_freelinkN(&text->markers, marker);
 				}
-				mrk= nxt;
-				if(mrk) {
+				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;
+				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 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))
+				if (marker->flags & (TMARK_EDITALL | TMARK_TEMP))
 					txt_clear_markers(text, marker->group, 0);
 				else
 					BLI_freelinkN(&text->markers, marker);
-				swallow= 1;
-				draw= 1;
+				swallow = 1;
+				draw = 1;
 				break;
 			case RIGHTMOUSE: /* Marker context menu? */
 			case LEFTMOUSE:
 				break;
 			case FKEY: /* Allow find */
-				if(qual & LR_SHIFTKEY) swallow= 1;
+				if (qual & LR_SHIFTKEY) swallow = 1;
 				break;
 
 			default:
-				if(qual!=0 && qual!=LR_SHIFTKEY)
-					swallow= 1; /* Swallow all other shortcut events */
+				if (qual != 0 && qual != LR_SHIFTKEY)
+					swallow = 1;  /* Swallow all other shortcut events */
 		}
 	}
 	
-	if(draw)
-		{}; // XXX redraw_alltext();
+	if (draw) {
+		// XXX redraw_alltext();
+	}
 	
 	return swallow;
 }
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c
index bf1b1dd..5e56dfa 100644
--- a/source/blender/editors/space_time/space_time.c
+++ b/source/blender/editors/space_time/space_time.c
@@ -106,7 +106,7 @@ static void time_draw_cache(SpaceTime *stime, Object *ob)
 
 	/* iterate over pointcaches on the active object, 
 	 * add spacetimecache and vertex array for each */
-	for(pid=pidlist.first; pid; pid=pid->next) {
+	for (pid=pidlist.first; pid; pid=pid->next) {
 		float col[4], *fp;
 		int i, sta = pid->cache->startframe, end = pid->cache->endframe;
 		int len = (end - sta + 1)*4;
@@ -130,12 +130,12 @@ static void time_draw_cache(SpaceTime *stime, Object *ob)
 				break;
 		}
 
-		if(pid->cache->cached_frames == NULL)
+		if (pid->cache->cached_frames == NULL)
 			continue;
 
 		/* make sure we have stc with correct array length */
-		if(stc == NULL || MEM_allocN_len(stc->array) != len*2*sizeof(float)) {
-			if(stc) {
+		if (stc == NULL || MEM_allocN_len(stc->array) != len*2*sizeof(float)) {
+			if (stc) {
 				MEM_freeN(stc->array);
 			}
 			else {
@@ -227,7 +227,7 @@ static void time_draw_cache(SpaceTime *stime, Object *ob)
 	BLI_freelistN(&pidlist);
 
 	/* free excessive caches */
-	while(stc) {
+	while (stc) {
 		SpaceTimeCache *tmp = stc->next;
 		BLI_remlink(&stime->caches, stc);
 		MEM_freeN(stc->array);
@@ -380,7 +380,7 @@ static void time_refresh(const bContext *UNUSED(C), ScrArea *sa)
 {
 	/* find the main timeline region and refresh cache display*/
 	ARegion *ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
-	if(ar) {
+	if (ar) {
 		SpaceTime *stime = (SpaceTime *)sa->spacedata.first;
 		time_cache_refresh(stime);
 	}
@@ -416,8 +416,8 @@ static void time_listener(ScrArea *sa, wmNotifier *wmn)
 
 						for (ar= sa->regionbase.first; ar; ar= ar->next) {
 							if (ar->regiontype==RGN_TYPE_WINDOW) {
-								ar->v2d.tot.xmin= (float)(SFRA - 4);
-								ar->v2d.tot.xmax= (float)(EFRA + 4);
+								ar->v2d.tot.xmin = (float)(SFRA - 4);
+								ar->v2d.tot.xmax = (float)(EFRA + 4);
 								break;
 							}
 						}
@@ -449,7 +449,7 @@ static void time_main_area_init(wmWindowManager *wm, ARegion *ar)
 	UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
 	
 	/* own keymap */
-	keymap= WM_keymap_find(wm->defaultconf, "Timeline", SPACE_TIME, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Timeline", SPACE_TIME, 0);
 	WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 }
 
@@ -511,7 +511,7 @@ static void time_main_area_listener(ARegion *ar, wmNotifier *wmn)
 	/* context changes */
 	switch(wmn->category) {
 		case NC_SPACE:
-			if(wmn->data == ND_SPACE_TIME)
+			if (wmn->data == ND_SPACE_TIME)
 				ED_region_tag_redraw(ar);
 			break;
 
@@ -551,7 +551,7 @@ static void time_header_area_listener(ARegion *ar, wmNotifier *wmn)
 	/* context changes */
 	switch(wmn->category) {
 		case NC_SCREEN:
-			if(wmn->data==ND_ANIMPLAY)
+			if (wmn->data==ND_ANIMPLAY)
 				ED_region_tag_redraw(ar);
 			break;
 
@@ -567,7 +567,7 @@ static void time_header_area_listener(ARegion *ar, wmNotifier *wmn)
 			}
 
 		case NC_SPACE:
-			if(wmn->data == ND_SPACE_TIME)
+			if (wmn->data == ND_SPACE_TIME)
 				ED_region_tag_redraw(ar);
 			break;
 	}
@@ -599,10 +599,10 @@ static SpaceLink *time_new(const bContext *C)
 	BLI_addtail(&stime->regionbase, ar);
 	ar->regiontype= RGN_TYPE_WINDOW;
 	
-	ar->v2d.tot.xmin= (float)(SFRA - 4);
-	ar->v2d.tot.ymin= 0.0f;
-	ar->v2d.tot.xmax= (float)(EFRA + 4);
-	ar->v2d.tot.ymax= 50.0f;
+	ar->v2d.tot.xmin = (float)(SFRA - 4);
+	ar->v2d.tot.ymin = 0.0f;
+	ar->v2d.tot.xmax = (float)(EFRA + 4);
+	ar->v2d.tot.ymax = 50.0f;
 	
 	ar->v2d.cur= ar->v2d.tot;
 
diff --git a/source/blender/editors/space_time/time_intern.h b/source/blender/editors/space_time/time_intern.h
index a345d00..ce52cbb 100644
--- a/source/blender/editors/space_time/time_intern.h
+++ b/source/blender/editors/space_time/time_intern.h
@@ -29,8 +29,8 @@
  */
 
 
-#ifndef ED_TIME_INTERN_H
-#define ED_TIME_INTERN_H
+#ifndef __TIME_INTERN_H__
+#define __TIME_INTERN_H__
 
 /* internal exports only */
 
@@ -40,5 +40,5 @@ struct wmWindowManager;
 void time_operatortypes(void);
 void time_keymap(struct wmKeyConfig *keyconf);
 
-#endif /* ED_TIME_INTERN_H */
+#endif /* __TIME_INTERN_H__ */
 
diff --git a/source/blender/editors/space_time/time_ops.c b/source/blender/editors/space_time/time_ops.c
index 78d903a..1c1f7a6 100644
--- a/source/blender/editors/space_time/time_ops.c
+++ b/source/blender/editors/space_time/time_ops.c
@@ -56,17 +56,20 @@ static int time_set_sfra_exec (bContext *C, wmOperator *UNUSED(op))
 		return OPERATOR_CANCELLED;
 
 	frame= CFRA;
-	/* if 'end frame' (Preview Range or Actual) is less than 'frame', 
-	 * clamp 'frame' to 'end frame'
-	 */
-	if (PEFRA < frame) frame= PEFRA;
-		
+
 	/* if Preview Range is defined, set the 'start' frame for that */
 	if (PRVRANGEON)
 		scene->r.psfra= frame;
 	else
 		scene->r.sfra= frame;
 	
+	if (PEFRA < frame) {
+		if (PRVRANGEON)
+			scene->r.pefra= frame;
+		else
+			scene->r.efra= frame;
+	}
+	
 	WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
 	
 	return OPERATOR_FINISHED;
@@ -75,16 +78,16 @@ static int time_set_sfra_exec (bContext *C, wmOperator *UNUSED(op))
 static void TIME_OT_start_frame_set (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Start Frame";
-	ot->idname= "TIME_OT_start_frame_set";
-	ot->description="Set the start frame";
+	ot->name = "Set Start Frame";
+	ot->idname = "TIME_OT_start_frame_set";
+	ot->description = "Set the start frame";
 	
 	/* api callbacks */
-	ot->exec= time_set_sfra_exec;
-	ot->poll= ED_operator_timeline_active;
+	ot->exec = time_set_sfra_exec;
+	ot->poll = ED_operator_timeline_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }	
 
 
@@ -98,16 +101,18 @@ static int time_set_efra_exec (bContext *C, wmOperator *UNUSED(op))
 
 	frame= CFRA;
 
-	/* if 'start frame' (Preview Range or Actual) is greater than 'frame', 
-	 * clamp 'frame' to 'end frame'
-	 */
-	if (PSFRA > frame) frame= PSFRA;
-		
 	/* if Preview Range is defined, set the 'end' frame for that */
 	if (PRVRANGEON)
 		scene->r.pefra= frame;
 	else
 		scene->r.efra= frame;
+
+	if (PSFRA > frame) {
+		if (PRVRANGEON)
+			scene->r.psfra= frame;
+		else
+			scene->r.sfra= frame;
+	}
 	
 	WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
 	
@@ -117,16 +122,16 @@ static int time_set_efra_exec (bContext *C, wmOperator *UNUSED(op))
 static void TIME_OT_end_frame_set (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set End Frame";
-	ot->idname= "TIME_OT_end_frame_set";
-	ot->description="Set the end frame";
+	ot->name = "Set End Frame";
+	ot->idname = "TIME_OT_end_frame_set";
+	ot->description = "Set the end frame";
 	
 	/* api callbacks */
-	ot->exec= time_set_efra_exec;
-	ot->poll= ED_operator_timeline_active;
+	ot->exec = time_set_efra_exec;
+	ot->poll = ED_operator_timeline_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ************************ View All Operator *******************************/
@@ -138,12 +143,12 @@ static int time_view_all_exec (bContext *C, wmOperator *UNUSED(op))
 	View2D *v2d= (ar) ? &ar->v2d : NULL;
 	float extra;
 	
-	if ELEM(NULL, scene, ar)
+	if (ELEM(NULL, scene, ar))
 		return OPERATOR_CANCELLED;
 		
 	/* set extents of view to start/end frames (Preview Range too) */
-	v2d->cur.xmin= (float)PSFRA;
-	v2d->cur.xmax= (float)PEFRA;
+	v2d->cur.xmin = (float)PSFRA;
+	v2d->cur.xmax = (float)PEFRA;
 	
 	/* we need an extra "buffer" factor on either side so that the endpoints are visible */
 	extra= 0.01f * (v2d->cur.xmax - v2d->cur.xmin);
@@ -159,16 +164,16 @@ static int time_view_all_exec (bContext *C, wmOperator *UNUSED(op))
 static void TIME_OT_view_all (wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View All";
-	ot->idname= "TIME_OT_view_all";
-	ot->description= "Show the entire playable frame range";
+	ot->name = "View All";
+	ot->idname = "TIME_OT_view_all";
+	ot->description = "Show the entire playable frame range";
 	
 	/* api callbacks */
-	ot->exec= time_view_all_exec;
-	ot->poll= ED_operator_timeline_active;
+	ot->exec = time_view_all_exec;
+	ot->poll = ED_operator_timeline_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 /* ************************** registration **********************************/
@@ -182,7 +187,7 @@ void time_operatortypes(void)
 
 void time_keymap(wmKeyConfig *keyconf)
 {
-	wmKeyMap *keymap= WM_keymap_find(keyconf, "Timeline", SPACE_TIME, 0);
+	wmKeyMap *keymap = WM_keymap_find(keyconf, "Timeline", SPACE_TIME, 0);
 	
 	WM_keymap_add_item(keymap, "TIME_OT_start_frame_set", SKEY, KM_PRESS, 0, 0);
 	WM_keymap_add_item(keymap, "TIME_OT_end_frame_set", EKEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/space_userpref/userpref_intern.h b/source/blender/editors/space_userpref/userpref_intern.h
index fc6d218..0307429 100644
--- a/source/blender/editors/space_userpref/userpref_intern.h
+++ b/source/blender/editors/space_userpref/userpref_intern.h
@@ -28,10 +28,10 @@
  *  \ingroup spuserpref
  */
 
-#ifndef ED_USERPREF_INTERN_H
-#define ED_USERPREF_INTERN_H
+#ifndef __USERPREF_INTERN_H__
+#define __USERPREF_INTERN_H__
 
 /* internal exports only */
 
-#endif /* ED_USERPREF_INTERN_H */
+#endif /* __USERPREF_INTERN_H__ */
 
diff --git a/source/blender/editors/space_view3d/CMakeLists.txt b/source/blender/editors/space_view3d/CMakeLists.txt
index f1ef359..1bba237 100644
--- a/source/blender/editors/space_view3d/CMakeLists.txt
+++ b/source/blender/editors/space_view3d/CMakeLists.txt
@@ -24,6 +24,7 @@ set(INC
 	../../blenkernel
 	../../blenlib
 	../../blenloader
+	../../bmesh
 	../../gpu
 	../../imbuf
 	../../makesdna
@@ -68,4 +69,8 @@ endif()
 
 add_definitions(-DGLEW_STATIC)
 
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
 blender_add_lib(bf_editor_space_view3d "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/space_view3d/SConscript b/source/blender/editors/space_view3d/SConscript
index 84ba8d1..ffe3501 100644
--- a/source/blender/editors/space_view3d/SConscript
+++ b/source/blender/editors/space_view3d/SConscript
@@ -7,13 +7,16 @@ defs = [ 'GLEW_STATIC' ]
 incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
 incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
 incs += ' ../../render/extern/include ../../blenloader'
-incs += ' ../../gpu ../../makesrna ../../blenfont'
+incs += ' ../../gpu ../../makesrna ../../blenfont ../../bmesh'
 incs += ' #/intern/smoke/extern'
 incs += ' #source/gameengine/BlenderRoutines'
 
 if env['WITH_BF_GAMEENGINE']:
     defs.append('WITH_GAMEENGINE')
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
 
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
+
 env.BlenderLib ( 'bf_editors_space_view3d', sources, Split(incs), defines = defs, libtype=['core'], priority=[40] )
diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c
index 638bf5b..d0e344e 100644
--- a/source/blender/editors/space_view3d/drawanimviz.c
+++ b/source/blender/editors/space_view3d/drawanimviz.c
@@ -70,7 +70,7 @@
 /* Set up drawing environment for drawing motion paths */
 void draw_motion_paths_init(View3D *v3d, ARegion *ar) 
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 	
 	if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
 	
@@ -79,15 +79,15 @@ void draw_motion_paths_init(View3D *v3d, ARegion *ar)
 }
 
 /* Draw the given motion path for an Object or a Bone 
- * 	- assumes that the viewport has already been initialised properly
+ *  - assumes that the viewport has already been initialized properly
  *		i.e. draw_motion_paths_init() has been called
  */
 void draw_motion_path_instance(Scene *scene, 
-			Object *ob, bPoseChannel *pchan, bAnimVizSettings *avs, bMotionPath *mpath)
+                               Object *ob, bPoseChannel *pchan, bAnimVizSettings *avs, bMotionPath *mpath)
 {
 	//RegionView3D *rv3d= ar->regiondata;
 	bMotionPathVert *mpv, *mpv_start;
-	int i, stepsize= avs->path_step;
+	int i, stepsize = avs->path_step;
 	int sfra, efra, len;
 	
 	
@@ -99,24 +99,24 @@ void draw_motion_path_instance(Scene *scene,
 		 * the current frame to draw. However, this range is still 
 		 * restricted by the limits of the original path.
 		 */
-		sfra= CFRA - avs->path_bc;
-		efra= CFRA + avs->path_ac;
-		if (sfra < mpath->start_frame) sfra= mpath->start_frame;
-		if (efra > mpath->end_frame) efra= mpath->end_frame;
+		sfra = CFRA - avs->path_bc;
+		efra = CFRA + avs->path_ac;
+		if (sfra < mpath->start_frame) sfra = mpath->start_frame;
+		if (efra > mpath->end_frame) efra = mpath->end_frame;
 		
-		len= efra - sfra;
+		len = efra - sfra;
 		
-		sind= sfra - mpath->start_frame;
-		mpv_start= (mpath->points + sind);
+		sind = sfra - mpath->start_frame;
+		mpv_start = (mpath->points + sind);
 	}
 	else {
-		sfra= mpath->start_frame;
+		sfra = mpath->start_frame;
 		efra = sfra + mpath->length;
 		len = mpath->length;
-		mpv_start= mpath->points;
+		mpv_start = mpath->points;
 	}
 
-	if(len <= 0) {
+	if (len <= 0) {
 		return;
 	}
 
@@ -124,17 +124,17 @@ void draw_motion_path_instance(Scene *scene,
 	glShadeModel(GL_SMOOTH);
 	
 	glBegin(GL_LINE_STRIP); 				
-	for (i=0, mpv=mpv_start; i < len; i++, mpv++) {
-		short sel= (pchan) ? (pchan->bone->flag & BONE_SELECTED) : (ob->flag & SELECT);
+	for (i = 0, mpv = mpv_start; i < len; i++, mpv++) {
+		short sel = (pchan) ? (pchan->bone->flag & BONE_SELECTED) : (ob->flag & SELECT);
 		float intensity; /* how faint */
 		
 		/* set color
-		 * 	- more intense for active/selected bones, less intense for unselected bones
-		 * 	- black for before current frame, green for current frame, blue for after current frame
-		 * 	- intensity decreases as distance from current frame increases
+		 * - more intense for active/selected bones, less intense for unselected bones
+		 * - black for before current frame, green for current frame, blue for after current frame
+		 * - intensity decreases as distance from current frame increases
 		 */
-		#define SET_INTENSITY(A, B, C, min, max) (((1.0f - ((C - B) / (C - A))) * (max-min)) + min) 
-		if ((sfra+i) < CFRA) {
+		#define SET_INTENSITY(A, B, C, min, max) (((1.0f - ((C - B) / (C - A))) * (max - min)) + min)
+		if ((sfra + i) < CFRA) {
 			/* black - before cfra */
 			if (sel) {
 				// intensity= 0.5f;
@@ -146,7 +146,7 @@ void draw_motion_path_instance(Scene *scene,
 			}
 			UI_ThemeColorBlend(TH_WIRE, TH_BACK, intensity);
 		}
-		else if ((sfra+i) > CFRA) {
+		else if ((sfra + i) > CFRA) {
 			/* blue - after cfra */
 			if (sel) {
 				//intensity = 0.5f;
@@ -161,10 +161,10 @@ void draw_motion_path_instance(Scene *scene,
 		else {
 			/* green - on cfra */
 			if (sel) {
-				intensity= 0.5f;
+				intensity = 0.5f;
 			}
 			else {
-				intensity= 0.99f;
+				intensity = 0.99f;
 			}
 			UI_ThemeColorBlendShade(TH_CFRAME, TH_BACK, intensity, 10);
 		}	
@@ -179,62 +179,64 @@ void draw_motion_path_instance(Scene *scene,
 	glPointSize(1.0);
 	
 	/* draw little black point at each frame
-	 * NOTE: this is not really visible/noticable
+	 * NOTE: this is not really visible/noticeable
 	 */
 	glBegin(GL_POINTS);
-	for (i=0, mpv=mpv_start; i < len; i++, mpv++) 
+	for (i = 0, mpv = mpv_start; i < len; i++, mpv++)
 		glVertex3fv(mpv->co);
 	glEnd();
 	
 	/* Draw little white dots at each framestep value */
 	UI_ThemeColor(TH_TEXT_HI);
 	glBegin(GL_POINTS);
-	for (i=0, mpv=mpv_start; i < len; i+=stepsize, mpv+=stepsize) 
+	for (i = 0, mpv = mpv_start; i < len; i += stepsize, mpv += stepsize)
 		glVertex3fv(mpv->co);
 	glEnd();
 	
 	/* Draw big green dot where the current frame is */
 	// NOTE: only do this when drawing keyframes for now... 
-	if (avs->path_viewflag & MOTIONPATH_VIEW_KFRAS) {
+	if ((avs->path_viewflag & MOTIONPATH_VIEW_KFRAS) &&
+	    (sfra < CFRA) && (CFRA <= efra))
+	{
 		UI_ThemeColor(TH_CFRAME);
 		glPointSize(6.0f);
 		
 		glBegin(GL_POINTS);
-			mpv = mpv_start + (CFRA - sfra);
-			glVertex3fv(mpv->co);
+		mpv = mpv_start + (CFRA - sfra);
+		glVertex3fv(mpv->co);
 		glEnd();
 		
 		glPointSize(1.0f);
 		UI_ThemeColor(TH_TEXT_HI);
 	}
 	
-	// XXX, this isnt up to date but probably should be kept so.
+	// XXX, this isn't up to date but probably should be kept so.
 	invert_m4_m4(ob->imat, ob->obmat);
 	
 	/* Draw frame numbers at each framestep value */
 	if (avs->path_viewflag & MOTIONPATH_VIEW_FNUMS) {
 		unsigned char col[4];
 		UI_GetThemeColor3ubv(TH_TEXT_HI, col);
-		col[3]= 255;
+		col[3] = 255;
 
-		for (i=0, mpv=mpv_start; i < len; i+=stepsize, mpv+=stepsize) {
+		for (i = 0, mpv = mpv_start; i < len; i += stepsize, mpv += stepsize) {
 			char numstr[32];
 			float co[3];
 			
 			/* only draw framenum if several consecutive highlighted points don't occur on same point */
 			if (i == 0) {
-				sprintf(numstr, "%d", (i+sfra));
+				sprintf(numstr, "%d", (i + sfra));
 				mul_v3_m4v3(co, ob->imat, mpv->co);
-				view3d_cached_text_draw_add(co, numstr, 0, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, col);
+				view3d_cached_text_draw_add(co, numstr, 0, V3D_CACHE_TEXT_WORLDSPACE | V3D_CACHE_TEXT_ASCII, col);
 			}
-			else if ((i > stepsize) && (i < len-stepsize)) { 
+			else if ((i > stepsize) && (i < len - stepsize)) {
 				bMotionPathVert *mpvP = (mpv - stepsize);
 				bMotionPathVert *mpvN = (mpv + stepsize);
 				
-				if ((equals_v3v3(mpv->co, mpvP->co)==0) || (equals_v3v3(mpv->co, mpvN->co)==0)) {
-					sprintf(numstr, "%d", (sfra+i));
+				if ((equals_v3v3(mpv->co, mpvP->co) == 0) || (equals_v3v3(mpv->co, mpvN->co) == 0)) {
+					sprintf(numstr, "%d", (sfra + i));
 					mul_v3_m4v3(co, ob->imat, mpv->co);
-					view3d_cached_text_draw_add(co, numstr, 0, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, col);
+					view3d_cached_text_draw_add(co, numstr, 0, V3D_CACHE_TEXT_WORLDSPACE | V3D_CACHE_TEXT_ASCII, col);
 				}
 			}
 		}
@@ -244,7 +246,7 @@ void draw_motion_path_instance(Scene *scene,
 	if (avs->path_viewflag & MOTIONPATH_VIEW_KFRAS) {
 		unsigned char col[4];
 
-		AnimData *adt= BKE_animdata_from_id(&ob->id);
+		AnimData *adt = BKE_animdata_from_id(&ob->id);
 		DLRBT_Tree keys;
 		
 		/* build list of all keyframes in active action for object or pchan */
@@ -254,8 +256,8 @@ void draw_motion_path_instance(Scene *scene,
 			/* it is assumed that keyframes for bones are all grouped in a single group
 			 * unless an option is set to always use the whole action
 			 */
-			if ((pchan) && (avs->path_viewflag & MOTIONPATH_VIEW_KFACT)==0) {
-				bActionGroup *agrp= action_groups_find_named(adt->action, pchan->name);
+			if ((pchan) && (avs->path_viewflag & MOTIONPATH_VIEW_KFACT) == 0) {
+				bActionGroup *agrp = action_groups_find_named(adt->action, pchan->name);
 				
 				if (agrp) {
 					agroup_to_keylist(adt, agrp, &keys, NULL);
@@ -270,14 +272,14 @@ void draw_motion_path_instance(Scene *scene,
 		
 		/* Draw slightly-larger yellow dots at each keyframe */
 		UI_GetThemeColor3ubv(TH_VERTEX_SELECT, col);
-		col[3]= 255;
+		col[3] = 255;
 
 		glPointSize(4.0f); // XXX perhaps a bit too big
 		glColor3ubv(col);
 		
 		glBegin(GL_POINTS);
-		for (i=0, mpv=mpv_start; i < len; i++, mpv++) {
-			float mframe= (float)(sfra + i);
+		for (i = 0, mpv = mpv_start; i < len; i++, mpv++) {
+			float mframe = (float)(sfra + i);
 			
 			if (BLI_dlrbTree_search_exact(&keys, compare_ak_cfraPtr, &mframe))
 				glVertex3fv(mpv->co);
@@ -289,15 +291,15 @@ void draw_motion_path_instance(Scene *scene,
 		/* Draw frame numbers of keyframes  */
 		if (avs->path_viewflag & MOTIONPATH_VIEW_KFNOS) {
 			float co[3];
-			for (i=0, mpv=mpv_start; i < len; i++, mpv++) {
-				float mframe= (float)(sfra + i);
+			for (i = 0, mpv = mpv_start; i < len; i++, mpv++) {
+				float mframe = (float)(sfra + i);
 				
 				if (BLI_dlrbTree_search_exact(&keys, compare_ak_cfraPtr, &mframe)) {
 					char numstr[32];
 					
-					sprintf(numstr, "%d", (sfra+i));
+					sprintf(numstr, "%d", (sfra + i));
 					mul_v3_m4v3(co, ob->imat, mpv->co);
-					view3d_cached_text_draw_add(co, numstr, 0, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, col);
+					view3d_cached_text_draw_add(co, numstr, 0, V3D_CACHE_TEXT_WORLDSPACE | V3D_CACHE_TEXT_ASCII, col);
 				}
 			}
 		}
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index 599e113..fec93b3 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -72,30 +72,30 @@
 /* *************** Armature Drawing - Coloring API ***************************** */
 
 /* global here is reset before drawing each bone */
-static ThemeWireColor *bcolor= NULL;
+static ThemeWireColor *bcolor = NULL;
 
 /* values of colCode for set_pchan_glcolor */
 enum {
-	PCHAN_COLOR_NORMAL	= 0, 		/* normal drawing */
-	PCHAN_COLOR_SOLID,				/* specific case where "solid" color is needed */
-	PCHAN_COLOR_CONSTS,				/* "constraint" colors (which may/may-not be suppressed) */
-	
-	PCHAN_COLOR_SPHEREBONE_BASE,	/* for the 'stick' of sphere (envelope) bones */
-	PCHAN_COLOR_SPHEREBONE_END,		/* for the ends of sphere (envelope) bones */
-	PCHAN_COLOR_LINEBONE			/* for the middle of line-bones */
+	PCHAN_COLOR_NORMAL  = 0,        /* normal drawing */
+	PCHAN_COLOR_SOLID,              /* specific case where "solid" color is needed */
+	PCHAN_COLOR_CONSTS,             /* "constraint" colors (which may/may-not be suppressed) */
+
+	PCHAN_COLOR_SPHEREBONE_BASE,    /* for the 'stick' of sphere (envelope) bones */
+	PCHAN_COLOR_SPHEREBONE_END,     /* for the ends of sphere (envelope) bones */
+	PCHAN_COLOR_LINEBONE            /* for the middle of line-bones */
 };
 
 /* This function sets the color-set for coloring a certain bone */
-static void set_pchan_colorset (Object *ob, bPoseChannel *pchan)
+static void set_pchan_colorset(Object *ob, bPoseChannel *pchan)
 {
-	bPose *pose= (ob) ? ob->pose : NULL;
-	bArmature *arm= (ob) ? ob->data : NULL;
-	bActionGroup *grp= NULL;
-	short color_index= 0;
+	bPose *pose = (ob) ? ob->pose : NULL;
+	bArmature *arm = (ob) ? ob->data : NULL;
+	bActionGroup *grp = NULL;
+	short color_index = 0;
 	
 	/* sanity check */
 	if (ELEM4(NULL, ob, arm, pose, pchan)) {
-		bcolor= NULL;
+		bcolor = NULL;
 		return;
 	}
 	
@@ -105,9 +105,9 @@ static void set_pchan_colorset (Object *ob, bPoseChannel *pchan)
 		 * has been set to use one
 		 */
 		if (pchan->agrp_index) {
-			grp= (bActionGroup *)BLI_findlink(&pose->agroups, (pchan->agrp_index - 1));
+			grp = (bActionGroup *)BLI_findlink(&pose->agroups, (pchan->agrp_index - 1));
 			if (grp)
-				color_index= grp->customCol;
+				color_index = grp->customCol;
 		}
 	}
 	
@@ -115,173 +115,181 @@ static void set_pchan_colorset (Object *ob, bPoseChannel *pchan)
 	 * color set (based on the theme colors for 3d-view) is used. 
 	 */
 	if (color_index > 0) {
-		bTheme *btheme= UI_GetTheme();
-		bcolor= &btheme->tarm[(color_index - 1)];
+		bTheme *btheme = UI_GetTheme();
+		bcolor = &btheme->tarm[(color_index - 1)];
 	}
 	else if (color_index == -1) {
 		/* use the group's own custom color set */
-		bcolor= (grp)? &grp->cs : NULL;
+		bcolor = (grp) ? &grp->cs : NULL;
 	}
 	else 
-		bcolor= NULL;
+		bcolor = NULL;
 }
 
 /* This function is for brightening/darkening a given color (like UI_ThemeColorShade()) */
-static void cp_shade_color3ub (unsigned char cp[3], const int offset)
+static void cp_shade_color3ub(unsigned char cp[3], const int offset)
 {
 	int r, g, b;
 	
-	r= offset + (int) cp[0];
+	r = offset + (int) cp[0];
 	CLAMP(r, 0, 255);
-	g= offset + (int) cp[1];
+	g = offset + (int) cp[1];
 	CLAMP(g, 0, 255);
-	b= offset + (int) cp[2];
+	b = offset + (int) cp[2];
 	CLAMP(b, 0, 255);
 	
-	cp[0]= r;
-	cp[1]= g;
-	cp[2]= b;
+	cp[0] = r;
+	cp[1] = g;
+	cp[2] = b;
 }
 
 /* This function sets the gl-color for coloring a certain bone (based on bcolor) */
-static short set_pchan_glColor (short colCode, int boneflag, short constflag)
+static short set_pchan_glColor(short colCode, int boneflag, short constflag)
 {
 	switch (colCode) {
-	case PCHAN_COLOR_NORMAL:
-	{
-		if (bcolor) {
-			unsigned char cp[3];
+		case PCHAN_COLOR_NORMAL:
+		{
+			if (bcolor) {
+				unsigned char cp[3];
 			
-			if (boneflag & BONE_DRAW_ACTIVE) {
-				copy_v3_v3_char((char *)cp, bcolor->active);
-				if(!(boneflag & BONE_SELECTED)) {
-					cp_shade_color3ub(cp, -80);
+				if (boneflag & BONE_DRAW_ACTIVE) {
+					copy_v3_v3_char((char *)cp, bcolor->active);
+					if (!(boneflag & BONE_SELECTED)) {
+						cp_shade_color3ub(cp, -80);
+					}
 				}
-			}
-			else if (boneflag & BONE_SELECTED) {
-				copy_v3_v3_char((char *)cp, bcolor->select);
+				else if (boneflag & BONE_SELECTED) {
+					copy_v3_v3_char((char *)cp, bcolor->select);
+				}
+				else {
+					/* a bit darker than solid */
+					copy_v3_v3_char((char *)cp, bcolor->solid);
+					cp_shade_color3ub(cp, -50);
+				}
+			
+				glColor3ubv(cp);
 			}
 			else {
-				/* a bit darker than solid */
-				copy_v3_v3_char((char *)cp, bcolor->solid);
-				cp_shade_color3ub(cp, -50);
+				if ((boneflag & BONE_DRAW_ACTIVE) && (boneflag & BONE_SELECTED)) {
+					UI_ThemeColorShade(TH_BONE_POSE, 40);
+				}
+				else if (boneflag & BONE_DRAW_ACTIVE) {
+					UI_ThemeColorBlend(TH_WIRE, TH_BONE_POSE, 0.15f); /* unselected active */
+				}
+				else if (boneflag & BONE_SELECTED) {
+					UI_ThemeColor(TH_BONE_POSE);
+				}
+				else {
+					UI_ThemeColor(TH_WIRE);
+				}
 			}
-			
-			glColor3ubv(cp);
-		}
-		else {
-			if (boneflag & BONE_DRAW_ACTIVE && boneflag & BONE_SELECTED) UI_ThemeColorShade(TH_BONE_POSE, 40);
-			else if (boneflag & BONE_DRAW_ACTIVE) UI_ThemeColorBlend(TH_WIRE, TH_BONE_POSE, 0.15f); /* unselected active */
-			else if (boneflag & BONE_SELECTED) UI_ThemeColor(TH_BONE_POSE);
-			else UI_ThemeColor(TH_WIRE);
-		}
-		
-		return 1;
-	}
-		break;
 	
-	case PCHAN_COLOR_SOLID:
-	{
-		if (bcolor) {
-			glColor3ubv((unsigned char *)bcolor->solid);
+			return 1;
 		}
-		else 
-			UI_ThemeColor(TH_BONE_SOLID);
-			
-		return 1;
-	}
 		break;
 		
-	case PCHAN_COLOR_CONSTS:
-	{
-		if ( (bcolor == NULL) || (bcolor->flag & TH_WIRECOLOR_CONSTCOLS) ) {
-			if (constflag & PCHAN_HAS_TARGET) glColor4ub(255, 150, 0, 80);
-			else if (constflag & PCHAN_HAS_IK) glColor4ub(255, 255, 0, 80);
-			else if (constflag & PCHAN_HAS_SPLINEIK) glColor4ub(200, 255, 0, 80);
-			else if (constflag & PCHAN_HAS_CONST) glColor4ub(0, 255, 120, 80);
+		case PCHAN_COLOR_SOLID:
+		{
+			if (bcolor) {
+				glColor3ubv((unsigned char *)bcolor->solid);
+			}
+			else
+				UI_ThemeColor(TH_BONE_SOLID);
 			
 			return 1;
 		}
-		else 
-			return 0;
-	}
 		break;
 		
-	case PCHAN_COLOR_SPHEREBONE_BASE:
-	{
-		if (bcolor) {
-			unsigned char cp[3];
+		case PCHAN_COLOR_CONSTS:
+		{
+			if ((bcolor == NULL) || (bcolor->flag & TH_WIRECOLOR_CONSTCOLS)) {
+				if (constflag & PCHAN_HAS_TARGET) glColor4ub(255, 150, 0, 80);
+				else if (constflag & PCHAN_HAS_IK) glColor4ub(255, 255, 0, 80);
+				else if (constflag & PCHAN_HAS_SPLINEIK) glColor4ub(200, 255, 0, 80);
+				else if (constflag & PCHAN_HAS_CONST) glColor4ub(0, 255, 120, 80);
 			
-			if (boneflag & BONE_DRAW_ACTIVE) {
-				copy_v3_v3_char((char *)cp, bcolor->active);
+				return 1;
 			}
-			else if (boneflag & BONE_SELECTED) {
-				copy_v3_v3_char((char *)cp, bcolor->select);
+			else
+				return 0;
+		}
+		break;
+
+		case PCHAN_COLOR_SPHEREBONE_BASE:
+		{
+			if (bcolor) {
+				unsigned char cp[3];
+
+				if (boneflag & BONE_DRAW_ACTIVE) {
+					copy_v3_v3_char((char *)cp, bcolor->active);
+				}
+				else if (boneflag & BONE_SELECTED) {
+					copy_v3_v3_char((char *)cp, bcolor->select);
+				}
+				else {
+					copy_v3_v3_char((char *)cp, bcolor->solid);
+				}
+
+				glColor3ubv(cp);
 			}
 			else {
-				copy_v3_v3_char((char *)cp, bcolor->solid);
+				if (boneflag & BONE_DRAW_ACTIVE) UI_ThemeColorShade(TH_BONE_POSE, 40);
+				else if (boneflag & BONE_SELECTED) UI_ThemeColor(TH_BONE_POSE);
+				else UI_ThemeColor(TH_BONE_SOLID);
 			}
 			
-			glColor3ubv(cp);
-		}
-		else {
-			if (boneflag & BONE_DRAW_ACTIVE) UI_ThemeColorShade(TH_BONE_POSE, 40);
-			else if (boneflag & BONE_SELECTED) UI_ThemeColor(TH_BONE_POSE);
-			else UI_ThemeColor(TH_BONE_SOLID);
+			return 1;
 		}
-		
-		return 1;
-	}
 		break;
-	case PCHAN_COLOR_SPHEREBONE_END:
-	{
-		if (bcolor) {
-			unsigned char cp[3];
+		case PCHAN_COLOR_SPHEREBONE_END:
+		{
+			if (bcolor) {
+				unsigned char cp[3];
+
+				if (boneflag & BONE_DRAW_ACTIVE) {
+					copy_v3_v3_char((char *)cp, bcolor->active);
+					cp_shade_color3ub(cp, 10);
+				}
+				else if (boneflag & BONE_SELECTED) {
+					copy_v3_v3_char((char *)cp, bcolor->select);
+					cp_shade_color3ub(cp, -30);
+				}
+				else {
+					copy_v3_v3_char((char *)cp, bcolor->solid);
+					cp_shade_color3ub(cp, -30);
+				}
 			
-			if (boneflag & BONE_DRAW_ACTIVE) {
-				copy_v3_v3_char((char *)cp, bcolor->active);
-				cp_shade_color3ub(cp, 10);
-			}
-			else if (boneflag & BONE_SELECTED) {
-				copy_v3_v3_char((char *)cp, bcolor->select);
-				cp_shade_color3ub(cp, -30);
+				glColor3ubv(cp);
 			}
 			else {
-				copy_v3_v3_char((char *)cp, bcolor->solid);
-				cp_shade_color3ub(cp, -30);
+				if (boneflag & BONE_DRAW_ACTIVE) UI_ThemeColorShade(TH_BONE_POSE, 10);
+				else if (boneflag & BONE_SELECTED) UI_ThemeColorShade(TH_BONE_POSE, -30);
+				else UI_ThemeColorShade(TH_BONE_SOLID, -30);
 			}
-			
-			glColor3ubv(cp);
 		}
-		else {
-			if (boneflag & BONE_DRAW_ACTIVE) UI_ThemeColorShade(TH_BONE_POSE, 10);
-			else if (boneflag & BONE_SELECTED) UI_ThemeColorShade(TH_BONE_POSE, -30);
-			else UI_ThemeColorShade(TH_BONE_SOLID, -30);
-		}
-	}
 		break;
 		
-	case PCHAN_COLOR_LINEBONE:
-	{
-		/* inner part in background color or constraint */
-		if ( (constflag) && ((bcolor==NULL) || (bcolor->flag & TH_WIRECOLOR_CONSTCOLS)) ) {
-			if (constflag & PCHAN_HAS_TARGET) glColor3ub(255, 150, 0);
-			else if (constflag & PCHAN_HAS_IK) glColor3ub(255, 255, 0);
-			else if (constflag & PCHAN_HAS_SPLINEIK) glColor3ub(200, 255, 0);
-			else if (constflag & PCHAN_HAS_CONST) glColor3ub(0, 255, 120);
-			else if (constflag) UI_ThemeColor(TH_BONE_POSE);	/* PCHAN_HAS_ACTION */ 
-		}
-		else {
-			if (bcolor) {
-				char *cp= bcolor->solid;
-				glColor4ub(cp[0], cp[1], cp[2], 204);	
+		case PCHAN_COLOR_LINEBONE:
+		{
+			/* inner part in background color or constraint */
+			if ( (constflag) && ((bcolor == NULL) || (bcolor->flag & TH_WIRECOLOR_CONSTCOLS)) ) {
+				if (constflag & PCHAN_HAS_TARGET) glColor3ub(255, 150, 0);
+				else if (constflag & PCHAN_HAS_IK) glColor3ub(255, 255, 0);
+				else if (constflag & PCHAN_HAS_SPLINEIK) glColor3ub(200, 255, 0);
+				else if (constflag & PCHAN_HAS_CONST) glColor3ub(0, 255, 120);
+				else if (constflag) UI_ThemeColor(TH_BONE_POSE);  /* PCHAN_HAS_ACTION */
+			}
+			else {
+				if (bcolor) {
+					char *cp = bcolor->solid;
+					glColor4ub(cp[0], cp[1], cp[2], 204);
+				}
+				else
+					UI_ThemeColorShade(TH_BACK, -30);
 			}
-			else
-				UI_ThemeColorShade(TH_BACK, -30);
-		}
 		
-		return 1;
-	}
+			return 1;
+		}
 		break;
 	}
 	
@@ -290,58 +298,66 @@ static short set_pchan_glColor (short colCode, int boneflag, short constflag)
 
 static void set_ebone_glColor(const unsigned int boneflag)
 {
-	if (boneflag & BONE_DRAW_ACTIVE && boneflag & BONE_SELECTED) UI_ThemeColor(TH_EDGE_SELECT);
-	else if (boneflag & BONE_DRAW_ACTIVE) UI_ThemeColorBlend(TH_WIRE, TH_EDGE_SELECT, 0.15f); /* unselected active */
-	else if (boneflag & BONE_SELECTED) UI_ThemeColorShade(TH_EDGE_SELECT, -20);
-	else UI_ThemeColor(TH_WIRE);
+	if ((boneflag & BONE_DRAW_ACTIVE) && (boneflag & BONE_SELECTED)) {
+		UI_ThemeColor(TH_EDGE_SELECT);
+	}
+	else if (boneflag & BONE_DRAW_ACTIVE) {
+		UI_ThemeColorBlend(TH_WIRE, TH_EDGE_SELECT, 0.15f); /* unselected active */
+	}
+	else if (boneflag & BONE_SELECTED) {
+		UI_ThemeColorShade(TH_EDGE_SELECT, -20);
+	}
+	else {
+		UI_ThemeColor(TH_WIRE);
+	}
 }
 
 /* *************** Armature drawing, helper calls for parts ******************* */
 
 /* half the cube, in Y */
 static float cube[8][3] = {
-{-1.0,  0.0, -1.0},
-{-1.0,  0.0,  1.0},
-{-1.0,  1.0,  1.0},
-{-1.0,  1.0, -1.0},
-{ 1.0,  0.0, -1.0},
-{ 1.0,  0.0,  1.0},
-{ 1.0,  1.0,  1.0},
-{ 1.0,  1.0, -1.0},
+	{-1.0,  0.0, -1.0},
+	{-1.0,  0.0,  1.0},
+	{-1.0,  1.0,  1.0},
+	{-1.0,  1.0, -1.0},
+	{ 1.0,  0.0, -1.0},
+	{ 1.0,  0.0,  1.0},
+	{ 1.0,  1.0,  1.0},
+	{ 1.0,  1.0, -1.0},
 };
 
 static void drawsolidcube_size(float xsize, float ysize, float zsize)
 {
-	static GLuint displist=0;
-	float n[3]= {0.0f};
+	static GLuint displist = 0;
+	float n[3] = {0.0f};
 	
 	glScalef(xsize, ysize, zsize);
 
-	if(displist==0) {
-		displist= glGenLists(1);
+	if (displist == 0) {
+		displist = glGenLists(1);
 		glNewList(displist, GL_COMPILE);
 
 		glBegin(GL_QUADS);
-		n[0]= -1.0;
+		n[0] = -1.0;
 		glNormal3fv(n); 
 		glVertex3fv(cube[0]); glVertex3fv(cube[1]); glVertex3fv(cube[2]); glVertex3fv(cube[3]);
-		n[0]=0;
-		n[1]= -1.0;
+		n[0] = 0;
+		n[1] = -1.0;
 		glNormal3fv(n); 
 		glVertex3fv(cube[0]); glVertex3fv(cube[4]); glVertex3fv(cube[5]); glVertex3fv(cube[1]);
-		n[1]=0;
-		n[0]= 1.0;
+		n[1] = 0;
+		n[0] = 1.0;
 		glNormal3fv(n); 
 		glVertex3fv(cube[4]); glVertex3fv(cube[7]); glVertex3fv(cube[6]); glVertex3fv(cube[5]);
-		n[0]=0;
-		n[1]= 1.0;
+		n[0] = 0;
+		n[1] = 1.0;
 		glNormal3fv(n); 
 		glVertex3fv(cube[7]); glVertex3fv(cube[3]); glVertex3fv(cube[2]); glVertex3fv(cube[6]);
-		n[1]=0;
-		n[2]= 1.0;
+		n[1] = 0;
+		n[2] = 1.0;
 		glNormal3fv(n); 
 		glVertex3fv(cube[1]); glVertex3fv(cube[5]); glVertex3fv(cube[6]); glVertex3fv(cube[2]);
-		n[2]= -1.0;
+		n[2] = -1.0;
 		glNormal3fv(n); 
 		glVertex3fv(cube[7]); glVertex3fv(cube[4]); glVertex3fv(cube[0]); glVertex3fv(cube[3]);
 		glEnd();
@@ -354,15 +370,15 @@ static void drawsolidcube_size(float xsize, float ysize, float zsize)
 
 static void drawcube_size(float xsize, float ysize, float zsize)
 {
-	static GLuint displist=0;
+	static GLuint displist = 0;
 	
-	if(displist == 0) {
-		displist= glGenLists(1);
+	if (displist == 0) {
+		displist = glGenLists(1);
 		glNewList(displist, GL_COMPILE);
 		
 		glBegin(GL_LINE_STRIP);
-		glVertex3fv(cube[0]); glVertex3fv(cube[1]);glVertex3fv(cube[2]); glVertex3fv(cube[3]);
-		glVertex3fv(cube[0]); glVertex3fv(cube[4]);glVertex3fv(cube[5]); glVertex3fv(cube[6]);
+		glVertex3fv(cube[0]); glVertex3fv(cube[1]); glVertex3fv(cube[2]); glVertex3fv(cube[3]);
+		glVertex3fv(cube[0]); glVertex3fv(cube[4]); glVertex3fv(cube[5]); glVertex3fv(cube[6]);
 		glVertex3fv(cube[7]); glVertex3fv(cube[4]);
 		glEnd();
 		
@@ -383,17 +399,17 @@ static void drawcube_size(float xsize, float ysize, float zsize)
 
 static void draw_bonevert(void)
 {
-	static GLuint displist=0;
+	static GLuint displist = 0;
 	
 	if (displist == 0) {
-		GLUquadricObj	*qobj;
+		GLUquadricObj   *qobj;
 		
-		displist= glGenLists(1);
+		displist = glGenLists(1);
 		glNewList(displist, GL_COMPILE);
 			
 		glPushMatrix();
 		
-		qobj	= gluNewQuadric(); 
+		qobj    = gluNewQuadric();
 		gluQuadricDrawStyle(qobj, GLU_SILHOUETTE); 
 		gluDisk(qobj, 0.0,  0.05, 16, 1);
 		
@@ -414,15 +430,15 @@ static void draw_bonevert(void)
 
 static void draw_bonevert_solid(void)
 {
-	static GLuint displist=0;
+	static GLuint displist = 0;
 	
 	if (displist == 0) {
-		GLUquadricObj	*qobj;
+		GLUquadricObj *qobj;
 		
-		displist= glGenLists(1);
+		displist = glGenLists(1);
 		glNewList(displist, GL_COMPILE);
 		
-		qobj	= gluNewQuadric();
+		qobj = gluNewQuadric();
 		gluQuadricDrawStyle(qobj, GLU_FILL); 
 		glShadeModel(GL_SMOOTH);
 		gluSphere(qobj, 0.05, 8, 5);
@@ -435,7 +451,7 @@ static void draw_bonevert_solid(void)
 	glCallList(displist);
 }
 
-static float bone_octahedral_verts[6][3]= {
+static float bone_octahedral_verts[6][3] = {
 	{ 0.0f, 0.0f,  0.0f},
 	{ 0.1f, 0.1f,  0.1f},
 	{ 0.1f, 0.1f, -0.1f},
@@ -444,10 +460,10 @@ static float bone_octahedral_verts[6][3]= {
 	{ 0.0f, 1.0f,  0.0f}
 };
 
-static unsigned int bone_octahedral_wire_sides[8]= {0, 1, 5, 3, 0, 4, 5, 2};
-static unsigned int bone_octahedral_wire_square[8]= {1, 2, 3, 4, 1};
+static unsigned int bone_octahedral_wire_sides[8] = {0, 1, 5, 3, 0, 4, 5, 2};
+static unsigned int bone_octahedral_wire_square[8] = {1, 2, 3, 4, 1};
 
-static unsigned int bone_octahedral_solid_tris[8][3]= {
+static unsigned int bone_octahedral_solid_tris[8][3] = {
 	{2, 1, 0}, /* bottom */
 	{3, 2, 0},
 	{4, 3, 0},
@@ -460,7 +476,7 @@ static unsigned int bone_octahedral_solid_tris[8][3]= {
 };
 
 /* aligned with bone_octahedral_solid_tris */
-static float bone_octahedral_solid_normals[8][3]= {
+static float bone_octahedral_solid_normals[8][3] = {
 	{ 0.70710683f, -0.70710683f,  0.00000000f},
 	{-0.00000000f, -0.70710683f, -0.70710683f},
 	{-0.70710683f, -0.70710683f,  0.00000000f},
@@ -473,23 +489,23 @@ static float bone_octahedral_solid_normals[8][3]= {
 
 static void draw_bone_octahedral(void)
 {
-	static GLuint displist=0;
+	static GLuint displist = 0;
 	
 	if (displist == 0) {
-		displist= glGenLists(1);
+		displist = glGenLists(1);
 		glNewList(displist, GL_COMPILE);
 
 		/*	Section 1, sides */
 		glEnableClientState(GL_VERTEX_ARRAY);
 		glVertexPointer(3, GL_FLOAT, 0, bone_octahedral_verts);
 		glDrawElements(GL_LINE_LOOP,
-		               sizeof(bone_octahedral_wire_sides)/sizeof(*bone_octahedral_wire_sides),
+		               sizeof(bone_octahedral_wire_sides) / sizeof(*bone_octahedral_wire_sides),
 		               GL_UNSIGNED_INT,
 		               bone_octahedral_wire_sides);
 
 		/*	Section 1, square */
 		glDrawElements(GL_LINE_LOOP,
-		               sizeof(bone_octahedral_wire_square)/sizeof(*bone_octahedral_wire_square),
+		               sizeof(bone_octahedral_wire_square) / sizeof(*bone_octahedral_wire_square),
 		               GL_UNSIGNED_INT,
 		               bone_octahedral_wire_square);
 		glDisableClientState(GL_VERTEX_ARRAY);
@@ -502,17 +518,17 @@ static void draw_bone_octahedral(void)
 
 static void draw_bone_solid_octahedral(void)
 {
-	static GLuint displist=0;
+	static GLuint displist = 0;
 
 	if (displist == 0) {
 		int i;
 
-		displist= glGenLists(1);
+		displist = glGenLists(1);
 		glNewList(displist, GL_COMPILE);
 
 #if 1
 		glBegin(GL_TRIANGLES);
-		for(i= 0; i < 8; i++) {
+		for (i = 0; i < 8; i++) {
 			glNormal3fv(bone_octahedral_solid_normals[i]);
 			glVertex3fv(bone_octahedral_verts[bone_octahedral_solid_tris[i][0]]);
 			glVertex3fv(bone_octahedral_verts[bone_octahedral_solid_tris[i][1]]);
@@ -521,12 +537,12 @@ static void draw_bone_solid_octahedral(void)
 
 		glEnd();
 
-#else	/* not working because each vert needs a different normal */
+#else   /* not working because each vert needs a different normal */
 		glEnableClientState(GL_NORMAL_ARRAY);
 		glEnableClientState(GL_VERTEX_ARRAY);
 		glNormalPointer(GL_FLOAT, 0, bone_octahedral_solid_normals);
 		glVertexPointer(3, GL_FLOAT, 0, bone_octahedral_verts);
-		glDrawElements(GL_TRIANGLES, sizeof(bone_octahedral_solid_tris)/sizeof(unsigned int),
+		glDrawElements(GL_TRIANGLES, sizeof(bone_octahedral_solid_tris) / sizeof(unsigned int),
 		               GL_UNSIGNED_INT, bone_octahedral_solid_tris);
 		glDisableClientState(GL_NORMAL_ARRAY);
 		glDisableClientState(GL_VERTEX_ARRAY);
@@ -544,11 +560,11 @@ static void draw_bone_solid_octahedral(void)
 static void draw_bone_points(int dt, int armflag, unsigned int boneflag, int id)
 {
 	/*	Draw root point if we are not connected */
-	if ((boneflag & BONE_CONNECTED)==0) {
+	if ((boneflag & BONE_CONNECTED) == 0) {
 		if (id != -1)
 			glLoadName(id | BONESEL_ROOT);
 		
-		if(dt <= OB_WIRE) {
+		if (dt <= OB_WIRE) {
 			if (armflag & ARM_EDITMODE) {
 				if (boneflag & BONE_ROOTSEL) UI_ThemeColor(TH_VERTEX_SELECT);
 				else UI_ThemeColor(TH_VERTEX);
@@ -606,7 +622,7 @@ static float si[16] = {
 	0.10116832f
 };
 /* 16 values of cos function (still same result!) */
-static float co[16] ={
+static float co[16] = {
 	1.00000000f,
 	0.97952994f, 0.91895781f,
 	0.82076344f, 0.68896691f,
@@ -632,25 +648,25 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel
 		ebone->length = len_v3v3(ebone->head, ebone->tail);
 
 		/*length= ebone->length;*/ /*UNUSED*/
-		tail= ebone->rad_tail;
-		dist= ebone->dist;
+		tail = ebone->rad_tail;
+		dist = ebone->dist;
 		if (ebone->parent && (ebone->flag & BONE_CONNECTED))
-			head= ebone->parent->rad_tail;
+			head = ebone->parent->rad_tail;
 		else
-			head= ebone->rad_head;
-		headvec= ebone->head;
-		tailvec= ebone->tail;
+			head = ebone->rad_head;
+		headvec = ebone->head;
+		tailvec = ebone->tail;
 	}
 	else {
 		/*length= pchan->bone->length;*/ /*UNUSED*/
-		tail= pchan->bone->rad_tail;
-		dist= pchan->bone->dist;
+		tail = pchan->bone->rad_tail;
+		dist = pchan->bone->dist;
 		if (pchan->parent && (pchan->bone->flag & BONE_CONNECTED))
-			head= pchan->parent->bone->rad_tail;
+			head = pchan->parent->bone->rad_tail;
 		else
-			head= pchan->bone->rad_head;
-		headvec= pchan->pose_head;
-		tailvec= pchan->pose_tail;
+			head = pchan->bone->rad_head;
+		headvec = pchan->pose_head;
+		tailvec = pchan->pose_tail;
 	}
 	
 	/* ***** draw it ***** */
@@ -659,24 +675,24 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel
 	sub_v3_v3v3(dirvec, tailvec, headvec);
 	mul_mat3_m4_v3(smat, dirvec);
 	/* clear zcomp */
-	dirvec[2]= 0.0f;
+	dirvec[2] = 0.0f;
 
-	if(head != tail) {
-	/* correcyion when viewing along the bones axis
-	 * it pops in and out but better then artifacts, [#23841] */
-		float view_dist= len_v2(dirvec);
+	if (head != tail) {
+		/* correction when viewing along the bones axis
+		 * it pops in and out but better then artifacts, [#23841] */
+		float view_dist = len_v2(dirvec);
 
-		if(head - view_dist > tail) {
-			tailvec= headvec;
+		if (head - view_dist > tail) {
+			tailvec = headvec;
 			tail = head;
 			zero_v3(dirvec);
-			dirvec[0]= 0.00001; // XXX. weak but ok
+			dirvec[0] = 0.00001; // XXX. weak but ok
 		}
-		else if(tail - view_dist > head) {
-			headvec= tailvec;
+		else if (tail - view_dist > head) {
+			headvec = tailvec;
 			head = tail;
 			zero_v3(dirvec);
-			dirvec[0]= 0.00001; // XXX. weak but ok
+			dirvec[0] = 0.00001; // XXX. weak but ok
 		}
 	}
 
@@ -692,10 +708,10 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel
 		
 		glBegin(GL_QUAD_STRIP);
 		
-		for (a=0; a<16; a++) {
-			vec[0]= - *(si+a) * dirvec[0] + *(co+a) * norvec[0];
-			vec[1]= - *(si+a) * dirvec[1] + *(co+a) * norvec[1];
-			vec[2]= - *(si+a) * dirvec[2] + *(co+a) * norvec[2];
+		for (a = 0; a < 16; a++) {
+			vec[0] = -*(si + a) * dirvec[0] + *(co + a) * norvec[0];
+			vec[1] = -*(si + a) * dirvec[1] + *(co + a) * norvec[1];
+			vec[2] = -*(si + a) * dirvec[2] + *(co + a) * norvec[2];
 
 			madd_v3_v3v3fl(vec1, headvec, vec, head);
 			madd_v3_v3v3fl(vec2, headvec, vec, head + dist);
@@ -706,10 +722,10 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel
 			glVertex3fv(vec2);
 		}
 		
-		for (a=15; a>=0; a--) {
-			vec[0]= *(si+a) * dirvec[0] + *(co+a) * norvec[0];
-			vec[1]= *(si+a) * dirvec[1] + *(co+a) * norvec[1];
-			vec[2]= *(si+a) * dirvec[2] + *(co+a) * norvec[2];
+		for (a = 15; a >= 0; a--) {
+			vec[0] = *(si + a) * dirvec[0] + *(co + a) * norvec[0];
+			vec[1] = *(si + a) * dirvec[1] + *(co + a) * norvec[1];
+			vec[2] = *(si + a) * dirvec[2] + *(co + a) * norvec[2];
 
 			madd_v3_v3v3fl(vec1, tailvec, vec, tail);
 			madd_v3_v3v3fl(vec2, tailvec, vec, tail + dist);
@@ -721,9 +737,9 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel
 		}
 		/* make it cyclic... */
 		
-		vec[0]= - *(si) * dirvec[0] + *(co) * norvec[0];
-		vec[1]= - *(si) * dirvec[1] + *(co) * norvec[1];
-		vec[2]= - *(si) * dirvec[2] + *(co) * norvec[2];
+		vec[0] = -*(si) * dirvec[0] + *(co) * norvec[0];
+		vec[1] = -*(si) * dirvec[1] + *(co) * norvec[1];
+		vec[2] = -*(si) * dirvec[2] + *(co) * norvec[2];
 
 		madd_v3_v3v3fl(vec1, headvec, vec, head);
 		madd_v3_v3v3fl(vec2, headvec, vec, head + dist);
@@ -752,23 +768,23 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4],
 		ebone->length = len_v3v3(ebone->head, ebone->tail);
 		
 		/*length= ebone->length;*/ /*UNUSED*/
-		tail= ebone->rad_tail;
+		tail = ebone->rad_tail;
 		if (ebone->parent && (boneflag & BONE_CONNECTED))
-			head= ebone->parent->rad_tail;
+			head = ebone->parent->rad_tail;
 		else
-			head= ebone->rad_head;
-		headvec= ebone->head;
-		tailvec= ebone->tail;
+			head = ebone->rad_head;
+		headvec = ebone->head;
+		tailvec = ebone->tail;
 	}
 	else {
 		/*length= pchan->bone->length;*/ /*UNUSED*/
-		tail= pchan->bone->rad_tail;
+		tail = pchan->bone->rad_tail;
 		if ((pchan->parent) && (boneflag & BONE_CONNECTED))
-			head= pchan->parent->bone->rad_tail;
+			head = pchan->parent->bone->rad_tail;
 		else
-			head= pchan->bone->rad_head;
-		headvec= pchan->pose_head;
-		tailvec= pchan->pose_tail;
+			head = pchan->bone->rad_head;
+		headvec = pchan->pose_head;
+		tailvec = pchan->pose_tail;
 	}
 	
 	/* sphere root color */
@@ -780,7 +796,7 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4],
 		set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag);
 	
 	/*	Draw root point if we are not connected */
-	if ((boneflag & BONE_CONNECTED)==0) {
+	if ((boneflag & BONE_CONNECTED) == 0) {
 		if (id != -1)
 			glLoadName(id | BONESEL_ROOT);
 		
@@ -809,7 +825,7 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4],
 	/* move vector to viewspace */
 	mul_mat3_m4_v3(smat, dirvec);
 	/* clear zcomp */
-	dirvec[2]= 0.0f;
+	dirvec[2] = 0.0f;
 	/* move vector back */
 	mul_mat3_m4_v3(imat, dirvec);
 	
@@ -849,35 +865,35 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4],
 static void draw_sphere_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id,
                              bPoseChannel *pchan, EditBone *ebone)
 {
-	GLUquadricObj	*qobj;
+	GLUquadricObj *qobj;
 	float head, tail, length;
 	float fac1, fac2;
 	
 	glPushMatrix();
-	qobj	= gluNewQuadric();
+	qobj = gluNewQuadric();
 
 	/* figure out the sizes of spheres */
 	if (ebone) {
-		length= ebone->length;
-		tail= ebone->rad_tail;
+		length = ebone->length;
+		tail = ebone->rad_tail;
 		if (ebone->parent && (boneflag & BONE_CONNECTED))
-			head= ebone->parent->rad_tail;
+			head = ebone->parent->rad_tail;
 		else
-			head= ebone->rad_head;
+			head = ebone->rad_head;
 	}
 	else {
-		length= pchan->bone->length;
-		tail= pchan->bone->rad_tail;
+		length = pchan->bone->length;
+		tail = pchan->bone->rad_tail;
 		if (pchan->parent && (boneflag & BONE_CONNECTED))
-			head= pchan->parent->bone->rad_tail;
+			head = pchan->parent->bone->rad_tail;
 		else
-			head= pchan->bone->rad_head;
+			head = pchan->bone->rad_head;
 	}
 	
 	/* move to z-axis space */
 	glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
 
-	if (dt==OB_SOLID) {
+	if (dt == OB_SOLID) {
 		/* set up solid drawing */
 		glEnable(GL_COLOR_MATERIAL);
 		glEnable(GL_LIGHTING);
@@ -896,11 +912,11 @@ static void draw_sphere_bone(int dt, int armflag, int boneflag, short constflag,
 	}
 	else if (armflag & ARM_POSEMODE)
 		set_pchan_glColor(PCHAN_COLOR_SPHEREBONE_END, boneflag, constflag);
-	else if (dt==OB_SOLID) 
+	else if (dt == OB_SOLID)
 		UI_ThemeColorShade(TH_BONE_SOLID, -30);
 	
 	/*	Draw root point if we are not connected */
-	if ((boneflag & BONE_CONNECTED)==0) {
+	if ((boneflag & BONE_CONNECTED) == 0) {
 		if (id != -1)
 			glLoadName(id | BONESEL_ROOT);
 		gluSphere(qobj, head, 16, 10);
@@ -929,38 +945,38 @@ static void draw_sphere_bone(int dt, int armflag, int boneflag, short constflag,
 	else if (dt == OB_SOLID)
 		UI_ThemeColor(TH_BONE_SOLID);
 	
-	fac1= (length-head)/length;
-	fac2= (length-tail)/length;
+	fac1 = (length - head) / length;
+	fac2 = (length - tail) / length;
 	
-	if (length > (head+tail)) {
+	if (length > (head + tail)) {
 		if (id != -1)
-			glLoadName (id | BONESEL_BONE);
+			glLoadName(id | BONESEL_BONE);
 		
 		glEnable(GL_POLYGON_OFFSET_FILL);
 		glPolygonOffset(-1.0f, -1.0f);
 		
 		glTranslatef(0.0f, 0.0f, head);
-		gluCylinder(qobj, fac1*head + (1.0f-fac1)*tail, fac2*tail + (1.0f-fac2)*head, length-head-tail, 16, 1);
+		gluCylinder(qobj, fac1 * head + (1.0f - fac1) * tail, fac2 * tail + (1.0f - fac2) * head, length - head - tail, 16, 1);
 		glTranslatef(0.0f, 0.0f, -head);
 		
 		glDisable(GL_POLYGON_OFFSET_FILL);
 		
 		/* draw sphere on extrema */
-		glTranslatef(0.0f, 0.0f, length-tail);
-		gluSphere(qobj, fac2*tail + (1.0f-fac2)*head, 16, 10);
-		glTranslatef(0.0f, 0.0f, -length+tail);
+		glTranslatef(0.0f, 0.0f, length - tail);
+		gluSphere(qobj, fac2 * tail + (1.0f - fac2) * head, 16, 10);
+		glTranslatef(0.0f, 0.0f, -length + tail);
 		
 		glTranslatef(0.0f, 0.0f, head);
-		gluSphere(qobj, fac1*head + (1.0f-fac1)*tail, 16, 10);
+		gluSphere(qobj, fac1 * head + (1.0f - fac1) * tail, 16, 10);
 	}
 	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);
+		glTranslatef(0.0f, 0.0f, (head + length - tail) / 2.0f);
+		gluSphere(qobj, fac1 * head + (1.0f - fac1) * tail, 16, 10);
 	}
 	
 	/* restore */
-	if (dt==OB_SOLID) {
+	if (dt == OB_SOLID) {
 		glShadeModel(GL_FLAT);
 		glDisable(GL_LIGHTING);
 		glDisable(GL_COLOR_MATERIAL);
@@ -970,11 +986,11 @@ static void draw_sphere_bone(int dt, int armflag, int boneflag, short constflag,
 	gluDeleteQuadric(qobj);  
 }
 
-static GLubyte bm_dot6[]= {0x0, 0x18, 0x3C, 0x7E, 0x7E, 0x3C, 0x18, 0x0}; 
-static GLubyte bm_dot8[]= {0x3C, 0x7E, 0xFF, 0xFF, 0xFF, 0xFF, 0x7E, 0x3C}; 
+static GLubyte bm_dot6[] = {0x0, 0x18, 0x3C, 0x7E, 0x7E, 0x3C, 0x18, 0x0};
+static GLubyte bm_dot8[] = {0x3C, 0x7E, 0xFF, 0xFF, 0xFF, 0xFF, 0x7E, 0x3C};
 
-static GLubyte bm_dot5[]= {0x0, 0x0, 0x10, 0x38, 0x7c, 0x38, 0x10, 0x0}; 
-static GLubyte bm_dot7[]= {0x0, 0x38, 0x7C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38}; 
+static GLubyte bm_dot5[] = {0x0, 0x0, 0x10, 0x38, 0x7c, 0x38, 0x10, 0x0};
+static GLubyte bm_dot7[] = {0x0, 0x38, 0x7C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38};
 
 
 static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned int id,
@@ -985,15 +1001,15 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
 	glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
 	
 	if (pchan) 
-		length= pchan->bone->length;
+		length = pchan->bone->length;
 	else 
-		length= ebone->length;
+		length = ebone->length;
 	
 	glPushMatrix();
 	glScalef(length, length, length);
 	
 	/* this chunk not in object mode */
-	if (armflag & (ARM_EDITMODE|ARM_POSEMODE)) {
+	if (armflag & (ARM_EDITMODE | ARM_POSEMODE)) {
 		glLineWidth(4.0f);
 		if (armflag & ARM_POSEMODE)
 			set_pchan_glColor(PCHAN_COLOR_NORMAL, boneflag, constflag);
@@ -1002,9 +1018,9 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
 		}
 		
 		/*	Draw root point if we are not connected */
-		if ((boneflag & BONE_CONNECTED)==0) {
-			if (G.f & G_PICKSEL) {	// no bitmap in selection mode, crashes 3d cards...
-				glLoadName (id | BONESEL_ROOT);
+		if ((boneflag & BONE_CONNECTED) == 0) {
+			if (G.f & G_PICKSEL) {  // no bitmap in selection mode, crashes 3d cards...
+				glLoadName(id | BONESEL_ROOT);
 				glBegin(GL_POINTS);
 				glVertex3f(0.0f, 0.0f, 0.0f);
 				glEnd();
@@ -1016,7 +1032,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
 		}
 		
 		if (id != -1)
-			glLoadName((GLuint) id|BONESEL_BONE);
+			glLoadName((GLuint) id | BONESEL_BONE);
 		
 		glBegin(GL_LINES);
 		glVertex3f(0.0f, 0.0f, 0.0f);
@@ -1038,7 +1054,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
 		
 		/* further we send no names */
 		if (id != -1)
-			glLoadName(id & 0xFFFF);	/* object tag, for bordersel optim */
+			glLoadName(id & 0xFFFF);  /* object tag, for bordersel optim */
 		
 		if (armflag & ARM_POSEMODE)
 			set_pchan_glColor(PCHAN_COLOR_LINEBONE, boneflag, constflag);
@@ -1047,8 +1063,8 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
 	glLineWidth(2.0);
 	
 	/*Draw root point if we are not connected */
-	if ((boneflag & BONE_CONNECTED)==0) {
-		if ((G.f & G_PICKSEL)==0) {	
+	if ((boneflag & BONE_CONNECTED) == 0) {
+		if ((G.f & G_PICKSEL) == 0) {
 			/* no bitmap in selection mode, crashes 3d cards... */
 			if (armflag & ARM_EDITMODE) {
 				if (boneflag & BONE_ROOTSEL) UI_ThemeColor(TH_VERTEX_SELECT);
@@ -1069,7 +1085,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
 	glEnd();
 	
 	/* tip */
-	if ((G.f & G_PICKSEL)==0) {	
+	if ((G.f & G_PICKSEL) == 0) {
 		/* no bitmap in selection mode, crashes 3d cards... */
 		if (armflag & ARM_EDITMODE) {
 			if (boneflag & BONE_TIPSEL) UI_ThemeColor(TH_VERTEX_SELECT);
@@ -1086,27 +1102,27 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
 
 static void draw_b_bone_boxes(int dt, bPoseChannel *pchan, float xwidth, float length, float zwidth)
 {
-	int segments= 0;
+	int segments = 0;
 	
 	if (pchan) 
-		segments= pchan->bone->segments;
+		segments = pchan->bone->segments;
 	
 	if ((segments > 1) && (pchan)) {
-		float dlen= length/(float)segments;
-		Mat4 *bbone= b_bone_spline_setup(pchan, 0);
+		float dlen = length / (float)segments;
+		Mat4 *bbone = b_bone_spline_setup(pchan, 0);
 		int a;
 		
-		for (a=0; a<segments; a++, bbone++) {
+		for (a = 0; a < segments; a++, bbone++) {
 			glPushMatrix();
 			glMultMatrixf(bbone->mat);
-			if (dt==OB_SOLID) drawsolidcube_size(xwidth, dlen, zwidth);
+			if (dt == OB_SOLID) drawsolidcube_size(xwidth, dlen, zwidth);
 			else drawcube_size(xwidth, dlen, zwidth);
 			glPopMatrix();
 		}
 	}
 	else {
 		glPushMatrix();
-		if (dt==OB_SOLID) drawsolidcube_size(xwidth, length, zwidth);
+		if (dt == OB_SOLID) drawsolidcube_size(xwidth, length, zwidth);
 		else drawcube_size(xwidth, length, zwidth);
 		glPopMatrix();
 	}
@@ -1118,14 +1134,14 @@ static void draw_b_bone(int dt, int armflag, int boneflag, short constflag, unsi
 	float xwidth, length, zwidth;
 	
 	if (pchan) {
-		xwidth= pchan->bone->xwidth;
-		length= pchan->bone->length;
-		zwidth= pchan->bone->zwidth;
+		xwidth = pchan->bone->xwidth;
+		length = pchan->bone->length;
+		zwidth = pchan->bone->zwidth;
 	}
 	else {
-		xwidth= ebone->xwidth;
-		length= ebone->length;
-		zwidth= ebone->zwidth;
+		xwidth = ebone->xwidth;
+		length = ebone->length;
+		zwidth = ebone->zwidth;
 	}
 	
 	/* draw points only if... */
@@ -1135,7 +1151,7 @@ static void draw_b_bone(int dt, int armflag, int boneflag, short constflag, unsi
 		glScalef(length, length, length);
 		draw_bone_points(dt, armflag, boneflag, id);
 		glPopMatrix();
-		length*= 0.95f;	// make vertices visible
+		length *= 0.95f; // make vertices visible
 	}
 
 	/* colors for modes */
@@ -1146,7 +1162,7 @@ static void draw_b_bone(int dt, int armflag, int boneflag, short constflag, unsi
 			set_pchan_glColor(PCHAN_COLOR_SOLID, boneflag, constflag);
 	}
 	else if (armflag & ARM_EDITMODE) {
-		if (dt==OB_WIRE) {
+		if (dt == OB_WIRE) {
 			set_ebone_glColor(boneflag);
 		}
 		else 
@@ -1154,7 +1170,7 @@ static void draw_b_bone(int dt, int armflag, int boneflag, short constflag, unsi
 	}
 	
 	if (id != -1) {
-		glLoadName ((GLuint) id|BONESEL_BONE);
+		glLoadName((GLuint) id | BONESEL_BONE);
 	}
 	
 	/* set up solid drawing */
@@ -1198,11 +1214,11 @@ static void draw_b_bone(int dt, int armflag, int boneflag, short constflag, unsi
 static void draw_wire_bone_segments(bPoseChannel *pchan, Mat4 *bbones, float length, int segments)
 {
 	if ((segments > 1) && (pchan)) {
-		float dlen= length/(float)segments;
+		float dlen = length / (float)segments;
 		Mat4 *bbone = bbones;
 		int a;
 		
-		for (a=0; a<segments; a++, bbone++) {
+		for (a = 0; a < segments; a++, bbone++) {
 			glPushMatrix();
 			glMultMatrixf(bbone->mat);
 			
@@ -1234,14 +1250,14 @@ static void draw_wire_bone(int dt, int armflag, int boneflag, short constflag, u
 	float length;
 	
 	if (pchan) {
-		segments= pchan->bone->segments;
-		length= pchan->bone->length;
+		segments = pchan->bone->segments;
+		length = pchan->bone->length;
 		
 		if (segments > 1)
 			bbones = b_bone_spline_setup(pchan, 0);
 	}
 	else 
-		length= ebone->length;
+		length = ebone->length;
 	
 	/* draw points only if... */
 	if (armflag & ARM_EDITMODE) {
@@ -1250,19 +1266,19 @@ static void draw_wire_bone(int dt, int armflag, int boneflag, short constflag, u
 		glScalef(length, length, length);
 		draw_bone_points(dt, armflag, boneflag, id);
 		glPopMatrix();
-		length *= 0.95f;	// make vertices visible
+		length *= 0.95f;    // make vertices visible
 	}
 	
 	/* this chunk not in object mode */
-	if (armflag & (ARM_EDITMODE|ARM_POSEMODE)) {
+	if (armflag & (ARM_EDITMODE | ARM_POSEMODE)) {
 		if (id != -1)
-			glLoadName((GLuint) id|BONESEL_BONE);
+			glLoadName((GLuint) id | BONESEL_BONE);
 		
 		draw_wire_bone_segments(pchan, bbones, length, segments);
 		
 		/* further we send no names */
 		if (id != -1)
-			glLoadName(id & 0xFFFF);	/* object tag, for bordersel optim */
+			glLoadName(id & 0xFFFF);    /* object tag, for bordersel optim */
 	}
 	
 	/* colors for modes */
@@ -1280,8 +1296,8 @@ static void draw_wire_bone(int dt, int armflag, int boneflag, short constflag, u
 static void draw_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, float length)
 {
 	
-	/*	Draw a 3d octahedral bone, we use normalized space based on length,
-		for glDisplayLists */
+	/* Draw a 3d octahedral bone, we use normalized space based on length,
+	 * for glDisplayLists */
 	
 	glScalef(length, length, length);
 
@@ -1305,7 +1321,7 @@ static void draw_bone(int dt, int armflag, int boneflag, short constflag, unsign
 	
 	/* now draw the bone itself */
 	if (id != -1) {
-		glLoadName((GLuint) id|BONESEL_BONE);
+		glLoadName((GLuint) id | BONESEL_BONE);
 	}
 	
 	/* wire? */
@@ -1350,7 +1366,7 @@ static void draw_bone(int dt, int armflag, int boneflag, short constflag, unsign
 static void draw_custom_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob,
                              int dt, int armflag, int boneflag, unsigned int id, float length)
 {
-	if(ob==NULL) return;
+	if (ob == NULL) return;
 	
 	glScalef(length, length, length);
 	
@@ -1360,7 +1376,7 @@ static void draw_custom_bone(Scene *scene, View3D *v3d, RegionView3D *rv3d, Obje
 	}
 	
 	if (id != -1) {
-		glLoadName((GLuint) id|BONESEL_BONE);
+		glLoadName((GLuint) id | BONESEL_BONE);
 	}
 	
 	draw_object_instance(scene, v3d, rv3d, ob, dt, armflag & ARM_POSEMODE);
@@ -1372,15 +1388,15 @@ static void pchan_draw_IK_root_lines(bPoseChannel *pchan, short only_temp)
 	bConstraint *con;
 	bPoseChannel *parchan;
 	
-	for (con= pchan->constraints.first; con; con= con->next) {
+	for (con = pchan->constraints.first; con; con = con->next) {
 		if (con->enforce == 0.0f)
 			continue;
 		
 		switch (con->type) {
 			case CONSTRAINT_TYPE_KINEMATIC:
 			{
-				bKinematicConstraint *data = (bKinematicConstraint*)con->data;
-				int segcount= 0;
+				bKinematicConstraint *data = (bKinematicConstraint *)con->data;
+				int segcount = 0;
 				
 				/* if only_temp, only draw if it is a temporary ik-chain */
 				if ((only_temp) && !(data->flag & CONSTRAINT_IK_TEMP))
@@ -1390,18 +1406,18 @@ static void pchan_draw_IK_root_lines(bPoseChannel *pchan, short only_temp)
 				glBegin(GL_LINES);
 				
 				/* exclude tip from chain? */
-				if ((data->flag & CONSTRAINT_IK_TIP)==0)
-					parchan= pchan->parent;
+				if ((data->flag & CONSTRAINT_IK_TIP) == 0)
+					parchan = pchan->parent;
 				else
-					parchan= pchan;
+					parchan = pchan;
 				
 				glVertex3fv(parchan->pose_tail);
 				
 				/* Find the chain's root */
 				while (parchan->parent) {
 					segcount++;
-					if(segcount==data->rootbone || segcount>255) break; // 255 is weak
-					parchan= parchan->parent;
+					if (segcount == data->rootbone || segcount > 255) break;  // 255 is weak
+					parchan = parchan->parent;
 				}
 				if (parchan)
 					glVertex3fv(parchan->pose_head);
@@ -1409,24 +1425,24 @@ static void pchan_draw_IK_root_lines(bPoseChannel *pchan, short only_temp)
 				glEnd();
 				setlinestyle(0);
 			}
-				break;
+			break;
 			case CONSTRAINT_TYPE_SPLINEIK: 
 			{
-				bSplineIKConstraint *data = (bSplineIKConstraint*)con->data;
-				int segcount= 0;
+				bSplineIKConstraint *data = (bSplineIKConstraint *)con->data;
+				int segcount = 0;
 				
 				setlinestyle(3);
 				glBegin(GL_LINES);
 				
-				parchan= pchan;
+				parchan = pchan;
 				glVertex3fv(parchan->pose_tail);
 				
 				/* Find the chain's root */
 				while (parchan->parent) {
 					segcount++;
 					// FIXME: revise the breaking conditions
-					if(segcount==data->chainlen || segcount>255) break; // 255 is weak
-					parchan= parchan->parent;
+					if (segcount == data->chainlen || segcount > 255) break;  // 255 is weak
+					parchan = parchan->parent;
 				}
 				if (parchan) // XXX revise the breaking conditions to only stop at the tail?
 					glVertex3fv(parchan->pose_head);
@@ -1434,7 +1450,7 @@ static void pchan_draw_IK_root_lines(bPoseChannel *pchan, short only_temp)
 				glEnd();
 				setlinestyle(0);
 			}
-				break;
+			break;
 		}
 	}
 }
@@ -1443,12 +1459,12 @@ static void bgl_sphere_project(float ax, float az)
 {
 	float dir[3], sine, q3;
 
-	sine= 1.0f - ax*ax - az*az;
-	q3= (sine < 0.0f)? 0.0f: (float)(2.0*sqrt(sine));
+	sine = 1.0f - ax * ax - az * az;
+	q3 = (sine < 0.0f) ? 0.0f : (float)(2.0 * sqrt(sine));
 
-	dir[0]= -az*q3;
-	dir[1]= 1.0f - 2.0f*sine;
-	dir[2]= ax*q3;
+	dir[0] = -az * q3;
+	dir[1] = 1.0f - 2.0f * sine;
+	dir[2] = ax * q3;
 
 	glVertex3fv(dir);
 }
@@ -1463,7 +1479,7 @@ static void draw_dof_ellipse(float ax, float az)
 		0.994521895368f, 1.0f
 	};
 
-	int i, j, n=16;
+	int i, j, n = 16;
 	float x, z, px, pz;
 
 	glEnable(GL_BLEND);
@@ -1472,33 +1488,33 @@ static void draw_dof_ellipse(float ax, float az)
 	glColor4ub(70, 70, 70, 50);
 
 	glBegin(GL_QUADS);
-	pz= 0.0f;
-	for(i=1; i<n; i++) {
-		z= staticSine[i];
+	pz = 0.0f;
+	for (i = 1; i < n; i++) {
+		z = staticSine[i];
 		
-		px= 0.0f;
-		for(j=1; j<n-i+1; j++) {
+		px = 0.0f;
+		for (j = 1; j < n - i + 1; j++) {
 			x = staticSine[j];
 			
-			if(j == n-i) {
+			if (j == n - i) {
 				glEnd();
 				glBegin(GL_TRIANGLES);
-				bgl_sphere_project(ax*px, az*z);
-				bgl_sphere_project(ax*px, az*pz);
-				bgl_sphere_project(ax*x, az*pz);
+				bgl_sphere_project(ax * px, az * z);
+				bgl_sphere_project(ax * px, az * pz);
+				bgl_sphere_project(ax * x, az * pz);
 				glEnd();
 				glBegin(GL_QUADS);
 			}
 			else {
-				bgl_sphere_project(ax*x, az*z);
-				bgl_sphere_project(ax*x, az*pz);
-				bgl_sphere_project(ax*px, az*pz);
-				bgl_sphere_project(ax*px, az*z);
+				bgl_sphere_project(ax * x, az * z);
+				bgl_sphere_project(ax * x, az * pz);
+				bgl_sphere_project(ax * px, az * pz);
+				bgl_sphere_project(ax * px, az * z);
 			}
 			
-			px= x;
+			px = x;
 		}
-		pz= z;
+		pz = z;
 	}
 	glEnd();
 
@@ -1508,27 +1524,27 @@ static void draw_dof_ellipse(float ax, float az)
 	glColor3ub(0, 0, 0);
 
 	glBegin(GL_LINE_STRIP);
-	for (i=0; i<n; i++)
-		bgl_sphere_project(staticSine[n-i-1]*ax, staticSine[i]*az);
+	for (i = 0; i < n; i++)
+		bgl_sphere_project(staticSine[n - i - 1] * ax, staticSine[i] * az);
 	glEnd();
 }
 
 static void draw_pose_dofs(Object *ob)
 {
-	bArmature *arm= ob->data;
+	bArmature *arm = ob->data;
 	bPoseChannel *pchan;
 	Bone *bone;
 	
-	for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
-		bone= pchan->bone;
+	for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+		bone = pchan->bone;
 		
-		if ( (bone) && !(bone->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG))) {
+		if ( (bone) && !(bone->flag & (BONE_HIDDEN_P | BONE_HIDDEN_PG))) {
 			if (bone->flag & BONE_SELECTED) {
 				if (bone->layer & arm->layer) {
-					if (pchan->ikflag & (BONE_IK_XLIMIT|BONE_IK_ZLIMIT)) {
+					if (pchan->ikflag & (BONE_IK_XLIMIT | BONE_IK_ZLIMIT)) {
 						if (ED_pose_channel_in_IK_chain(ob, pchan)) {
 							float corner[4][3], posetrans[3], mat[4][4];
-							float phi=0.0f, theta=0.0f, scale;
+							float phi = 0.0f, theta = 0.0f, scale;
 							int a, i;
 							
 							/* in parent-bone pose, but own restspace */
@@ -1539,24 +1555,24 @@ static void draw_pose_dofs(Object *ob)
 							
 							if (pchan->parent) {
 								copy_m4_m4(mat, pchan->parent->pose_mat);
-								mat[3][0]= mat[3][1]= mat[3][2]= 0.0f;
+								mat[3][0] = mat[3][1] = mat[3][2] = 0.0f;
 								glMultMatrixf(mat);
 							}
 							
 							copy_m4_m3(mat, pchan->bone->bone_mat);
 							glMultMatrixf(mat);
 							
-							scale= bone->length*pchan->size[1];
+							scale = bone->length * pchan->size[1];
 							glScalef(scale, scale, scale);
 							
 							if (pchan->ikflag & BONE_IK_XLIMIT) {
 								if (pchan->ikflag & BONE_IK_ZLIMIT) {
 									float amin[3], amax[3];
 									
-									for (i=0; i<3; i++) {
+									for (i = 0; i < 3; i++) {
 										/* *0.5f here comes from M_PI/360.0f when rotations were still in degrees */
-										amin[i]= (float)sin(pchan->limitmin[i]*0.5f);
-										amax[i]= (float)sin(pchan->limitmax[i]*0.5f);
+										amin[i] = (float)sin(pchan->limitmin[i] * 0.5f);
+										amax[i] = (float)sin(pchan->limitmax[i] * 0.5f);
 									}
 									
 									glScalef(1.0f, -1.0f, 1.0f);
@@ -1575,21 +1591,21 @@ static void draw_pose_dofs(Object *ob)
 							/* arcs */
 							if (pchan->ikflag & BONE_IK_ZLIMIT) {
 								/* OpenGL requires rotations in degrees; so we're taking the average angle here */
-								theta= RAD2DEGF(0.5f * (pchan->limitmin[2]+pchan->limitmax[2]));
+								theta = RAD2DEGF(0.5f * (pchan->limitmin[2] + pchan->limitmax[2]));
 								glRotatef(theta, 0.0f, 0.0f, 1.0f);
 								
-								glColor3ub(50, 50, 255);	// blue, Z axis limit
+								glColor3ub(50, 50, 255);    // blue, Z axis limit
 								glBegin(GL_LINE_STRIP);
-								for (a=-16; a<=16; a++) {
+								for (a = -16; a <= 16; a++) {
 									/* *0.5f here comes from M_PI/360.0f when rotations were still in degrees */
-									float fac= ((float)a)/16.0f * 0.5f;
+									float fac = ((float)a) / 16.0f * 0.5f;
 									
-									phi= fac * (pchan->limitmax[2] - pchan->limitmin[2]);
+									phi = fac * (pchan->limitmax[2] - pchan->limitmin[2]);
 									
-									i= (a == -16) ? 0 : 1;
-									corner[i][0]= (float)sin(phi);
-									corner[i][1]= (float)cos(phi);
-									corner[i][2]= 0.0f;
+									i = (a == -16) ? 0 : 1;
+									corner[i][0] = (float)sin(phi);
+									corner[i][1] = (float)cos(phi);
+									corner[i][2] = 0.0f;
 									glVertex3fv(corner[i]);
 								}
 								glEnd();
@@ -1599,20 +1615,20 @@ static void draw_pose_dofs(Object *ob)
 							
 							if (pchan->ikflag & BONE_IK_XLIMIT) {
 								/* OpenGL requires rotations in degrees; so we're taking the average angle here */
-								theta= RAD2DEGF(0.5f * (pchan->limitmin[0] + pchan->limitmax[0]));
+								theta = RAD2DEGF(0.5f * (pchan->limitmin[0] + pchan->limitmax[0]));
 								glRotatef(theta, 1.0f, 0.0f, 0.0f);
 								
-								glColor3ub(255, 50, 50);	// Red, X axis limit
+								glColor3ub(255, 50, 50);    // Red, X axis limit
 								glBegin(GL_LINE_STRIP);
-								for (a=-16; a<=16; a++) {
+								for (a = -16; a <= 16; a++) {
 									/* *0.5f here comes from M_PI/360.0f when rotations were still in degrees */
-									float fac= ((float)a)/16.0f * 0.5f;
-									phi= (float)(0.5*M_PI) + fac * (pchan->limitmax[0] - pchan->limitmin[0]);
+									float fac = ((float)a) / 16.0f * 0.5f;
+									phi = (float)(0.5 * M_PI) + fac * (pchan->limitmax[0] - pchan->limitmin[0]);
 									
-									i= (a == -16) ? 2 : 3;
-									corner[i][0]= 0.0f;
-									corner[i][1]= (float)sin(phi);
-									corner[i][2]= (float)cos(phi);
+									i = (a == -16) ? 2 : 3;
+									corner[i][0] = 0.0f;
+									corner[i][1] = (float)sin(phi);
+									corner[i][2] = (float)cos(phi);
 									glVertex3fv(corner[i]);
 								}
 								glEnd();
@@ -1643,19 +1659,19 @@ static void bone_matrix_translate_y(float mat[][4], float y)
 static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt,
                             const short is_ghost, const short is_outline)
 {
-	RegionView3D *rv3d= ar->regiondata;
-	Object *ob= base->object;
-	bArmature *arm= ob->data;
+	RegionView3D *rv3d = ar->regiondata;
+	Object *ob = base->object;
+	bArmature *arm = ob->data;
 	bPoseChannel *pchan;
 	Bone *bone;
 	GLfloat tmp;
 	float smat[4][4], imat[4][4], bmat[4][4];
-	int index= -1;
-	short do_dashed= 3, draw_wire= 0;
+	int index = -1;
+	short do_dashed = 3, draw_wire = 0;
 	int flag;
 	
 	/* being set below */
-	arm->layer_used= 0;
+	arm->layer_used = 0;
 	
 	/* hacky... prevent outline select from drawing dashed helplines */
 	glGetFloatv(GL_LINE_WIDTH, &tmp);
@@ -1663,10 +1679,10 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 	if (v3d->flag & V3D_HIDE_HELPLINES) do_dashed &= ~2;
 	
 	/* precalc inverse matrix for drawing screen aligned */
-	if (arm->drawtype==ARM_ENVELOPE) {
+	if (arm->drawtype == ARM_ENVELOPE) {
 		/* precalc inverse matrix for drawing screen aligned */
 		copy_m4_m4(smat, rv3d->viewmatob);
-		mul_mat3_m4_fl(smat, 1.0f/len_v3(ob->obmat[0]));
+		mul_mat3_m4_fl(smat, 1.0f / len_v3(ob->obmat[0]));
 		invert_m4_m4(imat, smat);
 		
 		/* and draw blended distances */
@@ -1676,14 +1692,14 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 			
 			if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
 			
-			for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
-				bone= pchan->bone;
+			for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+				bone = pchan->bone;
 				if (bone) {
 					/* 1) bone must be visible, 2) for OpenGL select-drawing cannot have unselectable [#27194] 
 					 * NOTE: this is the only case with NO_DEFORM==0 flag, as this is for envelope influence drawing 
 					 */
-					if ( (bone->flag & (BONE_HIDDEN_P|BONE_NO_DEFORM|BONE_HIDDEN_PG))==0 && 
-						 ((G.f & G_PICKSEL)==0 || (bone->flag & BONE_UNSELECTABLE)==0) ) 
+					if ( (bone->flag & (BONE_HIDDEN_P | BONE_NO_DEFORM | BONE_HIDDEN_PG)) == 0 &&
+					     ((G.f & G_PICKSEL) == 0 || (bone->flag & BONE_UNSELECTABLE) == 0) )
 					{
 						if (bone->flag & (BONE_SELECTED)) {
 							if (bone->layer & arm->layer)
@@ -1706,15 +1722,15 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 	/* if solid we draw that first, with selection codes, but without names, axes etc */
 	if (dt > OB_WIRE) {
 		if (arm->flag & ARM_POSEMODE) 
-			index= base->selcol;
+			index = base->selcol;
 		
-		for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
-			bone= pchan->bone;
+		for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+			bone = pchan->bone;
 			arm->layer_used |= bone->layer;
 			
 			/* 1) bone must be visible, 2) for OpenGL select-drawing cannot have unselectable [#27194] */
-			if ( (bone->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG))==0 && 
-				 ((G.f & G_PICKSEL)==0 || (bone->flag & BONE_UNSELECTABLE)==0) ) 
+			if ( (bone->flag & (BONE_HIDDEN_P | BONE_HIDDEN_PG)) == 0 &&
+			     ((G.f & G_PICKSEL) == 0 || (bone->flag & BONE_UNSELECTABLE) == 0) )
 			{
 				if (bone->layer & arm->layer) {
 					int use_custom = (pchan->custom) && !(arm->flag & ARM_NO_CUSTOM);
@@ -1728,8 +1744,8 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 					}
 					
 					/* catch exception for bone with hidden parent */
-					flag= bone->flag;
-					if ( (bone->parent) && (bone->parent->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG)) )
+					flag = bone->flag;
+					if ( (bone->parent) && (bone->parent->flag & (BONE_HIDDEN_P | BONE_HIDDEN_PG)) )
 						flag &= ~BONE_CONNECTED;
 					
 					/* set temporary flag for drawing bone as active, but only if selected */
@@ -1742,63 +1758,68 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 					if (use_custom) {
 						/* if drawwire, don't try to draw in solid */
 						if (pchan->bone->flag & BONE_DRAWWIRE) {
-							draw_wire= 1;
+							draw_wire = 1;
 						}
 						else {
 							draw_custom_bone(scene, v3d, rv3d, pchan->custom,
 							                 OB_SOLID, arm->flag, flag, index, bone->length);
 						}
 					}
-					else if (arm->drawtype==ARM_LINE)
-						;	/* nothing in solid */
-					else if (arm->drawtype==ARM_WIRE)
-						; 	/* nothing in solid */
-					else if (arm->drawtype==ARM_ENVELOPE)
+					else if (arm->drawtype == ARM_LINE) {
+						/* nothing in solid */
+					}
+					else if (arm->drawtype == ARM_WIRE) {
+						/* nothing in solid */
+					}
+					else if (arm->drawtype == ARM_ENVELOPE) {
 						draw_sphere_bone(OB_SOLID, arm->flag, flag, 0, index, pchan, NULL);
-					else if (arm->drawtype==ARM_B_BONE)
+					}
+					else if (arm->drawtype == ARM_B_BONE) {
 						draw_b_bone(OB_SOLID, arm->flag, flag, 0, index, pchan, NULL);
-					else
+					}
+					else {
 						draw_bone(OB_SOLID, arm->flag, flag, 0, index, bone->length);
+					}
 						
 					glPopMatrix();
 				}
 			}
 			
-			if (index!= -1) 
-				index+= 0x10000;	// pose bones count in higher 2 bytes only
+			if (index != -1)
+				index += 0x10000;   // pose bones count in higher 2 bytes only
 		}
 		
 		/* very very confusing... but in object mode, solid draw, we cannot do glLoadName yet,
 		 * stick bones and/or wire custom-shapes are drawn in next loop 
 		 */
-		if (ELEM(arm->drawtype,ARM_LINE,ARM_WIRE)==0 && (draw_wire == 0)) {
+		if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE) == 0 && (draw_wire == 0)) {
 			/* object tag, for bordersel optim */
 			glLoadName(index & 0xFFFF);	
-			index= -1;
+			index = -1;
 		}
 	}
 	
 	/* draw custom bone shapes as wireframes */
-	if ( !(arm->flag & ARM_NO_CUSTOM) &&
-		 ((draw_wire) || (dt <= OB_WIRE)) ) 
+	if (!(arm->flag & ARM_NO_CUSTOM) &&
+	    ((draw_wire) || (dt <= OB_WIRE)) )
 	{
 		if (arm->flag & ARM_POSEMODE)
-			index= base->selcol;
+			index = base->selcol;
 			
 		/* only draw custom bone shapes that need to be drawn as wires */
-		for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
-			bone= pchan->bone;
+		for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+			bone = pchan->bone;
 			
 			/* 1) bone must be visible, 2) for OpenGL select-drawing cannot have unselectable [#27194] */
-			if ( (bone->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG))==0 && 
-				 ((G.f & G_PICKSEL)==0 || (bone->flag & BONE_UNSELECTABLE)==0) ) 
+			if ( (bone->flag & (BONE_HIDDEN_P | BONE_HIDDEN_PG)) == 0 &&
+			     ((G.f & G_PICKSEL) == 0 || (bone->flag & BONE_UNSELECTABLE) == 0) )
 			{
 				if (bone->layer & arm->layer) {
 					if (pchan->custom) {
 						if ((dt < OB_SOLID) || (bone->flag & BONE_DRAWWIRE)) {
 							glPushMatrix();
 							
-							if(pchan->custom_tx) {
+							if (pchan->custom_tx) {
 								glMultMatrixf(pchan->custom_tx->pose_mat);
 							} 
 							else {
@@ -1806,25 +1827,25 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 							}
 							
 							/* prepare colors */
-							if(is_ghost) {
+							if (is_ghost) {
 								/* 13 October 2009, Disabled this to make ghosting show the right colors (Aligorith) */
 							}
 							else if (arm->flag & ARM_POSEMODE)	
 								set_pchan_colorset(ob, pchan);
 							else {
-								if ((scene->basact)==base) {
-									if (base->flag & (SELECT+BA_WAS_SEL)) UI_ThemeColor(TH_ACTIVE);
+								if ((scene->basact) == base) {
+									if (base->flag & (SELECT + BA_WAS_SEL)) UI_ThemeColor(TH_ACTIVE);
 									else UI_ThemeColor(TH_WIRE);
 								}
 								else {
-									if (base->flag & (SELECT+BA_WAS_SEL)) UI_ThemeColor(TH_SELECT);
+									if (base->flag & (SELECT + BA_WAS_SEL)) UI_ThemeColor(TH_SELECT);
 									else UI_ThemeColor(TH_WIRE);
 								}
 							}
 								
 							/* catch exception for bone with hidden parent */
-							flag= bone->flag;
-							if ((bone->parent) && (bone->parent->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG)))
+							flag = bone->flag;
+							if ((bone->parent) && (bone->parent->flag & (BONE_HIDDEN_P | BONE_HIDDEN_PG)))
 								flag &= ~BONE_CONNECTED;
 								
 							/* set temporary flag for drawing bone as active, but only if selected */
@@ -1841,22 +1862,22 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 			}
 			
 			if (index != -1) 
-				index+= 0x10000;	// pose bones count in higher 2 bytes only
+				index += 0x10000;   // pose bones count in higher 2 bytes only
 		}
-		/* stick or wire bones have not been drawn yet so dont clear object selection in this case */
-		if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)==0 && draw_wire) {
+		/* 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);	
-			index= -1;
+			index = -1;
 		}
 	}
 	
 	/* wire draw over solid only in posemode */
 	if ((dt <= OB_WIRE) || (arm->flag & ARM_POSEMODE) || ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) {
 		/* draw line check first. we do selection indices */
-		if ELEM(arm->drawtype, ARM_LINE, ARM_WIRE) {
+		if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) {
 			if (arm->flag & ARM_POSEMODE) 
-				index= base->selcol;
+				index = base->selcol;
 		}
 		/* if solid && posemode, we draw again with polygonoffset */
 		else if ((dt > OB_WIRE) && (arm->flag & ARM_POSEMODE)) {
@@ -1865,26 +1886,26 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 		else {
 			/* and we use selection indices if not done yet */
 			if (arm->flag & ARM_POSEMODE) 
-				index= base->selcol;
+				index = base->selcol;
 		}
 		
-		for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
-			bone= pchan->bone;
+		for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+			bone = pchan->bone;
 			arm->layer_used |= bone->layer;
 			
 			/* 1) bone must be visible, 2) for OpenGL select-drawing cannot have unselectable [#27194] */
-			if ( (bone->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG))==0 && 
-				 ((G.f & G_PICKSEL)==0 || (bone->flag & BONE_UNSELECTABLE)==0) ) 
+			if ( (bone->flag & (BONE_HIDDEN_P | BONE_HIDDEN_PG)) == 0 &&
+			     ((G.f & G_PICKSEL) == 0 || (bone->flag & BONE_UNSELECTABLE) == 0) )
 			{
 				if (bone->layer & arm->layer) {
-					const short constflag= pchan->constflag;
+					const short constflag = pchan->constflag;
 					if ((do_dashed & 1) && (pchan->parent)) {
 						/* Draw a line from our root to the parent's tip 
 						 *	- only if V3D_HIDE_HELPLINES is enabled...
 						 */
-						if ( (do_dashed & 2) && ((bone->flag & BONE_CONNECTED)==0) ) {
+						if ( (do_dashed & 2) && ((bone->flag & BONE_CONNECTED) == 0) ) {
 							if (arm->flag & ARM_POSEMODE) {
-								glLoadName(index & 0xFFFF);	// object tag, for bordersel optim
+								glLoadName(index & 0xFFFF); // object tag, for bordersel optim
 								UI_ThemeColor(TH_WIRE);
 							}
 							setlinestyle(3);
@@ -1896,13 +1917,13 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 						}
 						
 						/* Draw a line to IK root bone 
-						 * 	- only if temporary chain (i.e. "autoik")
+						 *  - only if temporary chain (i.e. "autoik")
 						 */
 						if (arm->flag & ARM_POSEMODE) {
 							if (constflag & PCHAN_HAS_IK) {
 								if (bone->flag & BONE_SELECTED) {
 									if (constflag & PCHAN_HAS_TARGET) glColor3ub(200, 120, 0);
-									else glColor3ub(200, 200, 50);	// add theme!
+									else glColor3ub(200, 200, 50);  // add theme!
 									
 									glLoadName(index & 0xFFFF);
 									pchan_draw_IK_root_lines(pchan, !(do_dashed & 2));
@@ -1910,7 +1931,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 							}
 							else if (constflag & PCHAN_HAS_SPLINEIK) {
 								if (bone->flag & BONE_SELECTED) {
-									glColor3ub(150, 200, 50);	// add theme!
+									glColor3ub(150, 200, 50);   // add theme!
 									
 									glLoadName(index & 0xFFFF);
 									pchan_draw_IK_root_lines(pchan, !(do_dashed & 2));
@@ -1924,8 +1945,8 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 						glMultMatrixf(pchan->pose_mat);
 					
 					/* catch exception for bone with hidden parent */
-					flag= bone->flag;
-					if ((bone->parent) && (bone->parent->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG)))
+					flag = bone->flag;
+					if ((bone->parent) && (bone->parent->flag & (BONE_HIDDEN_P | BONE_HIDDEN_PG)))
 						flag &= ~BONE_CONNECTED;
 					
 					/* set temporary flag for drawing bone as active, but only if selected */
@@ -1937,17 +1958,18 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 					/* set color-set to use */
 					set_pchan_colorset(ob, pchan);
 					
-					if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM))
-						; // custom bone shapes should not be drawn here!
-					else if (arm->drawtype==ARM_ENVELOPE) {
+					if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM)) {
+						/* custom bone shapes should not be drawn here! */
+					}
+					else if (arm->drawtype == ARM_ENVELOPE) {
 						if (dt < OB_SOLID)
 							draw_sphere_bone_wire(smat, imat, arm->flag, flag, constflag, index, pchan, NULL);
 					}
-					else if (arm->drawtype==ARM_LINE)
+					else if (arm->drawtype == ARM_LINE)
 						draw_line_bone(arm->flag, flag, constflag, index, pchan, NULL);
-					else if (arm->drawtype==ARM_WIRE)
+					else if (arm->drawtype == ARM_WIRE)
 						draw_wire_bone(dt, arm->flag, flag, constflag, index, pchan, NULL);
-					else if (arm->drawtype==ARM_B_BONE)
+					else if (arm->drawtype == ARM_B_BONE)
 						draw_b_bone(OB_WIRE, arm->flag, flag, constflag, index, pchan, NULL);
 					else
 						draw_bone(OB_WIRE, arm->flag, flag, constflag, index, bone->length);
@@ -1958,10 +1980,10 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 			
 			/* pose bones count in higher 2 bytes only */
 			if (index != -1) 
-				index+= 0x10000;	
+				index += 0x10000;
 		}
 		/* restore things */
-		if (!ELEM(arm->drawtype, ARM_WIRE, ARM_LINE) && (dt>OB_WIRE) && (arm->flag & ARM_POSEMODE))
+		if (!ELEM(arm->drawtype, ARM_WIRE, ARM_LINE) && (dt > OB_WIRE) && (arm->flag & ARM_POSEMODE))
 			bglPolygonOffset(rv3d->dist, 0.0);
 	}	
 	
@@ -1973,31 +1995,31 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 		draw_pose_dofs(ob);
 
 	/* finally names and axes */
-	if (arm->flag & (ARM_DRAWNAMES|ARM_DRAWAXES) && is_outline == 0) {
+	if ((arm->flag & (ARM_DRAWNAMES | ARM_DRAWAXES)) && (is_outline == 0)) {
 		/* patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing */
 		if ((G.f & G_PICKSEL) == 0) {
 			float vec[3];
 			
 			unsigned char col[4];
 			float col_f[4];
-			glGetFloatv(GL_CURRENT_COLOR, col_f); /* incase this is not set below */
+			glGetFloatv(GL_CURRENT_COLOR, col_f); /* in case this is not set below */
 			rgb_float_to_uchar(col, col_f);
-			col[3]= 255;
+			col[3] = 255;
 			
 			if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
 			
-			for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) {
-				if ((pchan->bone->flag & (BONE_HIDDEN_P|BONE_HIDDEN_PG))==0) {
+			for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+				if ((pchan->bone->flag & (BONE_HIDDEN_P | BONE_HIDDEN_PG)) == 0) {
 					if (pchan->bone->layer & arm->layer) {
-						if (arm->flag & (ARM_EDITMODE|ARM_POSEMODE)) {
-							bone= pchan->bone;
+						if (arm->flag & (ARM_EDITMODE | ARM_POSEMODE)) {
+							bone = pchan->bone;
 							UI_GetThemeColor3ubv((bone->flag & BONE_SELECTED) ? TH_TEXT_HI : TH_TEXT, col);
 						}
 						else if (dt > OB_WIRE) {
 							UI_GetThemeColor3ubv(TH_TEXT, col);
 						}
 						
-						/* 	Draw names of bone 	*/
+						/*  Draw names of bone  */
 						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);
@@ -2011,7 +2033,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 							glMultMatrixf(bmat);
 							
 							glColor3ubv(col);
-							drawaxes(pchan->bone->length*0.25f, OB_ARROWS);
+							drawaxes(pchan->bone->length * 0.25f, OB_ARROWS);
 							
 							glPopMatrix();
 						}
@@ -2027,13 +2049,13 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
 /* in editmode, we don't store the bone matrix... */
 static void get_matrix_editbone(EditBone *eBone, float bmat[][4])
 {
-	float		delta[3];
-	float		mat[3][3];
+	float delta[3];
+	float mat[3][3];
 	
 	/* Compose the parent transforms (i.e. their translations) */
 	sub_v3_v3v3(delta, eBone->tail, eBone->head);	
 	
-	eBone->length = (float)sqrt(delta[0]*delta[0] + delta[1]*delta[1] +delta[2]*delta[2]);
+	eBone->length = (float)sqrt(delta[0] * delta[0] + delta[1] * delta[1] + delta[2] * delta[2]);
 	
 	vec_roll_to_mat3(delta, eBone->roll, mat);
 	copy_m4_m3(bmat, mat);
@@ -2043,21 +2065,21 @@ static void get_matrix_editbone(EditBone *eBone, float bmat[][4])
 
 static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 	EditBone *eBone;
-	bArmature *arm= ob->data;
+	bArmature *arm = ob->data;
 	float smat[4][4], imat[4][4], bmat[4][4];
 	unsigned int index;
 	int flag;
 	
 	/* being set in code below */
-	arm->layer_used= 0;
+	arm->layer_used = 0;
 	
 	/* envelope (deform distance) */
-	if(arm->drawtype==ARM_ENVELOPE) {
+	if (arm->drawtype == ARM_ENVELOPE) {
 		/* precalc inverse matrix for drawing screen aligned */
 		copy_m4_m4(smat, rv3d->viewmatob);
-		mul_mat3_m4_fl(smat, 1.0f/len_v3(ob->obmat[0]));
+		mul_mat3_m4_fl(smat, 1.0f / len_v3(ob->obmat[0]));
 		invert_m4_m4(imat, smat);
 		
 		/* and draw blended distances */
@@ -2066,10 +2088,10 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
 		
 		if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
 
-		for (eBone=arm->edbo->first; eBone; eBone=eBone->next) {
+		for (eBone = arm->edbo->first; eBone; eBone = eBone->next) {
 			if (eBone->layer & arm->layer) {
-				if ((eBone->flag & (BONE_HIDDEN_A|BONE_NO_DEFORM))==0) {
-					if (eBone->flag & (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL))
+				if ((eBone->flag & (BONE_HIDDEN_A | BONE_NO_DEFORM)) == 0) {
+					if (eBone->flag & (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL))
 						draw_sphere_bone_dist(smat, imat, NULL, eBone);
 				}
 			}
@@ -2082,15 +2104,15 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
 	
 	/* if solid we draw it first */
 	if ((dt > OB_WIRE) && (arm->drawtype != ARM_LINE)) {
-		for (eBone=arm->edbo->first, index=0; eBone; eBone=eBone->next, index++) {
+		for (eBone = arm->edbo->first, index = 0; eBone; eBone = eBone->next, index++) {
 			if (eBone->layer & arm->layer) {
-				if ((eBone->flag & BONE_HIDDEN_A)==0) {
+				if ((eBone->flag & BONE_HIDDEN_A) == 0) {
 					glPushMatrix();
 					get_matrix_editbone(eBone, bmat);
 					glMultMatrixf(bmat);
 					
 					/* catch exception for bone with hidden parent */
-					flag= eBone->flag;
+					flag = eBone->flag;
 					if ( (eBone->parent) && !EBONE_VISIBLE(arm, eBone->parent))
 						flag &= ~BONE_CONNECTED;
 						
@@ -2098,11 +2120,11 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
 					if (eBone == arm->act_edbone)
 						flag |= BONE_DRAW_ACTIVE;
 					
-					if (arm->drawtype==ARM_ENVELOPE)
+					if (arm->drawtype == ARM_ENVELOPE)
 						draw_sphere_bone(OB_SOLID, arm->flag, flag, 0, index, NULL, eBone);
-					else if(arm->drawtype==ARM_B_BONE)
+					else if (arm->drawtype == ARM_B_BONE)
 						draw_b_bone(OB_SOLID, arm->flag, flag, 0, index, NULL, eBone);
-					else if (arm->drawtype==ARM_WIRE)
+					else if (arm->drawtype == ARM_WIRE)
 						draw_wire_bone(OB_SOLID, arm->flag, flag, 0, index, NULL, eBone);
 					else {
 						draw_bone(OB_SOLID, arm->flag, flag, 0, index, eBone->length);
@@ -2115,24 +2137,24 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
 	}
 	
 	/* if wire over solid, set offset */
-	index= -1;
+	index = -1;
 	glLoadName(-1);
-	if ELEM(arm->drawtype, ARM_LINE, ARM_WIRE) {
-		if(G.f & G_PICKSEL)
-			index= 0;
+	if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) {
+		if (G.f & G_PICKSEL)
+			index = 0;
 	}
 	else if (dt > OB_WIRE) 
 		bglPolygonOffset(rv3d->dist, 1.0f);
 	else if (arm->flag & ARM_EDITMODE) 
-		index= 0;	/* do selection codes */
+		index = 0;  /* do selection codes */
 	
-	for (eBone=arm->edbo->first; eBone; eBone=eBone->next) {
+	for (eBone = arm->edbo->first; eBone; eBone = eBone->next) {
 		arm->layer_used |= eBone->layer;
 		if (eBone->layer & arm->layer) {
-			if ((eBone->flag & BONE_HIDDEN_A)==0) {
+			if ((eBone->flag & BONE_HIDDEN_A) == 0) {
 				
 				/* catch exception for bone with hidden parent */
-				flag= eBone->flag;
+				flag = eBone->flag;
 				if ( (eBone->parent) && !EBONE_VISIBLE(arm, eBone->parent))
 					flag &= ~BONE_CONNECTED;
 					
@@ -2151,7 +2173,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
 					
 					if (arm->drawtype == ARM_LINE) 
 						draw_line_bone(arm->flag, flag, 0, index, NULL, eBone);
-					else if (arm->drawtype==ARM_WIRE)
+					else if (arm->drawtype == ARM_WIRE)
 						draw_wire_bone(OB_WIRE, arm->flag, flag, 0, index, NULL, eBone);
 					else if (arm->drawtype == ARM_B_BONE)
 						draw_b_bone(OB_WIRE, arm->flag, flag, 0, index, NULL, eBone);
@@ -2164,7 +2186,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
 				/* offset to parent */
 				if (eBone->parent) {
 					UI_ThemeColor(TH_WIRE);
-					glLoadName (-1);		// -1 here is OK!
+					glLoadName(-1);         // -1 here is OK!
 					setlinestyle(3);
 					
 					glBegin(GL_LINES);
@@ -2176,27 +2198,27 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
 				}
 			}
 		}
-		if(index!=-1) index++;
+		if (index != -1) index++;
 	}
 	
 	/* restore */
-	if(index!=-1) glLoadName(-1);
-	if ELEM(arm->drawtype,ARM_LINE,ARM_WIRE);
-	else if (dt>OB_WIRE) bglPolygonOffset(rv3d->dist, 0.0f);
+	if (index != -1) glLoadName(-1);
+	if (ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) ;
+	else if (dt > OB_WIRE) bglPolygonOffset(rv3d->dist, 0.0f);
 	
 	/* finally names and axes */
-	if (arm->flag & (ARM_DRAWNAMES|ARM_DRAWAXES)) {
+	if (arm->flag & (ARM_DRAWNAMES | ARM_DRAWAXES)) {
 		// patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing
 		if ((G.f & G_PICKSEL) == 0) {
 			float vec[3];
 			unsigned char col[4];
-			col[3]= 255;
+			col[3] = 255;
 			
 			if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
 			
-			for (eBone=arm->edbo->first; eBone; eBone=eBone->next) {
-				if(eBone->layer & arm->layer) {
-					if ((eBone->flag & BONE_HIDDEN_A)==0) {
+			for (eBone = arm->edbo->first; eBone; eBone = eBone->next) {
+				if (eBone->layer & arm->layer) {
+					if ((eBone->flag & BONE_HIDDEN_A) == 0) {
 
 						UI_GetThemeColor3ubv((eBone->flag & BONE_SELECTED) ? TH_TEXT_HI : TH_TEXT, col);
 
@@ -2214,7 +2236,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
 							glMultMatrixf(bmat);
 
 							glColor3ubv(col);
-							drawaxes(eBone->length*0.25f, OB_ARROWS);
+							drawaxes(eBone->length * 0.25f, OB_ARROWS);
 							
 							glPopMatrix();
 						}
@@ -2237,15 +2259,15 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
  */
 static void draw_pose_paths(Scene *scene, View3D *v3d, ARegion *ar, Object *ob)
 {
-	bAnimVizSettings *avs= &ob->pose->avs;
-	bArmature *arm= ob->data;
+	bAnimVizSettings *avs = &ob->pose->avs;
+	bArmature *arm = ob->data;
 	bPoseChannel *pchan;
 	
 	/* setup drawing environment for paths */
 	draw_motion_paths_init(v3d, ar);
 	
 	/* draw paths where they exist and they releated bone is visible */
-	for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+	for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
 		if ((pchan->bone->layer & arm->layer) && (pchan->mpath))
 			draw_motion_path_instance(scene, ob, pchan, avs, pchan->mpath);
 	}
@@ -2262,16 +2284,16 @@ static void draw_pose_paths(Scene *scene, View3D *v3d, ARegion *ar, Object *ob)
  */
 static void ghost_poses_tag_unselected(Object *ob, short unset)
 {
-	bArmature *arm= ob->data;
-	bPose *pose= ob->pose;
+	bArmature *arm = ob->data;
+	bPose *pose = ob->pose;
 	bPoseChannel *pchan;
 	
 	/* don't do anything if no hiding any bones */
-	if ((arm->flag & ARM_GHOST_ONLYSEL)==0)
+	if ((arm->flag & ARM_GHOST_ONLYSEL) == 0)
 		return;
 		
 	/* loop over all pchans, adding/removing tags as appropriate */
-	for (pchan= pose->chanbase.first; pchan; pchan= pchan->next) {
+	for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
 		if ((pchan->bone) && (arm->layer & pchan->bone->layer)) {
 			if (unset) {
 				/* remove tags from all pchans if cleaning up */
@@ -2279,7 +2301,7 @@ static void ghost_poses_tag_unselected(Object *ob, short unset)
 			}
 			else {
 				/* set tags on unselected pchans only */
-				if ((pchan->bone->flag & BONE_SELECTED)==0)
+				if ((pchan->bone->flag & BONE_SELECTED) == 0)
 					pchan->bone->flag |= BONE_HIDDEN_PG;
 			}
 		}
@@ -2287,13 +2309,13 @@ static void ghost_poses_tag_unselected(Object *ob, short unset)
 }
 
 /* draw ghosts that occur within a frame range 
- * 	note: object should be in posemode 
+ *  note: object should be in posemode
  */
 static void draw_ghost_poses_range(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
 {
-	Object *ob= base->object;
-	AnimData *adt= BKE_animdata_from_id(&ob->id);
-	bArmature *arm= ob->data;
+	Object *ob = base->object;
+	AnimData *adt = BKE_animdata_from_id(&ob->id);
+	bArmature *arm = ob->data;
 	bPose *posen, *poseo;
 	float start, end, stepsize, range, colfac;
 	int cfrao, flago, ipoflago;
@@ -2303,31 +2325,31 @@ static void draw_ghost_poses_range(Scene *scene, View3D *v3d, ARegion *ar, Base
 	if (end <= start)
 		return;
 	
-	stepsize= (float)(arm->ghostsize);
-	range= (float)(end - start);
+	stepsize = (float)(arm->ghostsize);
+	range = (float)(end - start);
 	
 	/* store values */
 	ob->mode &= ~OB_MODE_POSE;
-	cfrao= CFRA;
-	flago= arm->flag;
-	arm->flag &= ~(ARM_DRAWNAMES|ARM_DRAWAXES);
-	ipoflago= ob->ipoflag; 
+	cfrao = CFRA;
+	flago = arm->flag;
+	arm->flag &= ~(ARM_DRAWNAMES | ARM_DRAWAXES);
+	ipoflago = ob->ipoflag;
 	ob->ipoflag |= OB_DISABLE_PATH;
 	
 	/* copy the pose */
-	poseo= ob->pose;
+	poseo = ob->pose;
 	copy_pose(&posen, ob->pose, 1);
-	ob->pose= posen;
-	armature_rebuild_pose(ob, ob->data);	/* child pointers for IK */
-	ghost_poses_tag_unselected(ob, 0);		/* hide unselected bones if need be */
+	ob->pose = posen;
+	armature_rebuild_pose(ob, ob->data);    /* child pointers for IK */
+	ghost_poses_tag_unselected(ob, 0);      /* hide unselected bones if need be */
 	
 	glEnable(GL_BLEND);
 	if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
 	
 	/* draw from first frame of range to last */
-	for (CFRA= (int)start; CFRA < end; CFRA += (int)stepsize) {
+	for (CFRA = (int)start; CFRA < end; CFRA += (int)stepsize) {
 		colfac = (end - (float)CFRA) / range;
-		UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128-(int)(120.0*sqrt(colfac)));
+		UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128 - (int)(120.0 * sqrt(colfac)));
 		
 		BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
 		where_is_pose(scene, ob);
@@ -2336,16 +2358,16 @@ static void draw_ghost_poses_range(Scene *scene, View3D *v3d, ARegion *ar, Base
 	glDisable(GL_BLEND);
 	if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
 
-	ghost_poses_tag_unselected(ob, 1);		/* unhide unselected bones if need be */
+	ghost_poses_tag_unselected(ob, 1);      /* unhide unselected bones if need be */
 	free_pose(posen);
 	
 	/* restore */
-	CFRA= cfrao;
-	ob->pose= poseo;
-	arm->flag= flago;
+	CFRA = cfrao;
+	ob->pose = poseo;
+	arm->flag = flago;
 	armature_rebuild_pose(ob, ob->data);
 	ob->mode |= OB_MODE_POSE;
-	ob->ipoflag= ipoflago; 
+	ob->ipoflag = ipoflago;
 }
 
 /* draw ghosts on keyframes in action within range 
@@ -2353,10 +2375,10 @@ static void draw_ghost_poses_range(Scene *scene, View3D *v3d, ARegion *ar, Base
  */
 static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
 {
-	Object *ob= base->object;
-	AnimData *adt= BKE_animdata_from_id(&ob->id);
-	bAction *act= (adt) ? adt->action : NULL;
-	bArmature *arm= ob->data;
+	Object *ob = base->object;
+	AnimData *adt = BKE_animdata_from_id(&ob->id);
+	bAction *act = (adt) ? adt->action : NULL;
+	bArmature *arm = ob->data;
 	bPose *posen, *poseo;
 	DLRBT_Tree keys;
 	ActKeyColumn *ak, *akn;
@@ -2373,9 +2395,9 @@ static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, ARegion *ar, Base *
 	action_to_keylist(adt, act, &keys, NULL);
 	BLI_dlrbTree_linkedlist_sync(&keys);
 	
-	range= 0;
-	for (ak= keys.first; ak; ak= akn) {
-		akn= ak->next;
+	range = 0;
+	for (ak = keys.first; ak; ak = akn) {
+		akn = ak->next;
 		
 		if ((ak->cfra < start) || (ak->cfra > end))
 			BLI_freelinkN((ListBase *)&keys, ak);
@@ -2386,27 +2408,27 @@ static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, ARegion *ar, Base *
 	
 	/* store values */
 	ob->mode &= ~OB_MODE_POSE;
-	cfrao= CFRA;
-	flago= arm->flag;
-	arm->flag &= ~(ARM_DRAWNAMES|ARM_DRAWAXES);
+	cfrao = CFRA;
+	flago = arm->flag;
+	arm->flag &= ~(ARM_DRAWNAMES | ARM_DRAWAXES);
 	ob->ipoflag |= OB_DISABLE_PATH;
 	
 	/* copy the pose */
-	poseo= ob->pose;
+	poseo = ob->pose;
 	copy_pose(&posen, ob->pose, 1);
-	ob->pose= posen;
-	armature_rebuild_pose(ob, ob->data);	/* child pointers for IK */
-	ghost_poses_tag_unselected(ob, 0);		/* hide unselected bones if need be */
+	ob->pose = posen;
+	armature_rebuild_pose(ob, ob->data);  /* child pointers for IK */
+	ghost_poses_tag_unselected(ob, 0);    /* hide unselected bones if need be */
 	
 	glEnable(GL_BLEND);
 	if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
 	
 	/* draw from first frame of range to last */
-	for (ak=keys.first, i=0; ak; ak=ak->next, i++) {
-		colfac = i/range;
-		UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128-(int)(120.0*sqrt(colfac)));
+	for (ak = keys.first, i = 0; ak; ak = ak->next, i++) {
+		colfac = i / range;
+		UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128 - (int)(120.0 * sqrt(colfac)));
 		
-		CFRA= (int)ak->cfra;
+		CFRA = (int)ak->cfra;
 		
 		BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
 		where_is_pose(scene, ob);
@@ -2415,67 +2437,67 @@ static void draw_ghost_poses_keys(Scene *scene, View3D *v3d, ARegion *ar, Base *
 	glDisable(GL_BLEND);
 	if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
 
-	ghost_poses_tag_unselected(ob, 1);		/* unhide unselected bones if need be */
+	ghost_poses_tag_unselected(ob, 1);  /* unhide unselected bones if need be */
 	BLI_dlrbTree_free(&keys);
 	free_pose(posen);
 	
 	/* restore */
-	CFRA= cfrao;
-	ob->pose= poseo;
-	arm->flag= flago;
+	CFRA = cfrao;
+	ob->pose = poseo;
+	arm->flag = flago;
 	armature_rebuild_pose(ob, ob->data);
 	ob->mode |= OB_MODE_POSE;
 }
 
 /* draw ghosts around current frame
- * 	- object is supposed to be armature in posemode 
+ *  - object is supposed to be armature in posemode
  */
 static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
 {
-	Object *ob= base->object;
-	AnimData *adt= BKE_animdata_from_id(&ob->id);
-	bArmature *arm= ob->data;
+	Object *ob = base->object;
+	AnimData *adt = BKE_animdata_from_id(&ob->id);
+	bArmature *arm = ob->data;
 	bPose *posen, *poseo;
 	float cur, start, end, stepsize, range, colfac, actframe, ctime;
 	int cfrao, flago;
 	
 	/* pre conditions, get an action with sufficient frames */
-	if ELEM(NULL, adt, adt->action)
+	if (ELEM(NULL, adt, adt->action))
 		return;
 
 	calc_action_range(adt->action, &start, &end, 0);
 	if (start == end)
 		return;
 
-	stepsize= (float)(arm->ghostsize);
-	range= (float)(arm->ghostep)*stepsize + 0.5f;	/* plus half to make the for loop end correct */
+	stepsize = (float)(arm->ghostsize);
+	range = (float)(arm->ghostep) * stepsize + 0.5f;   /* plus half to make the for loop end correct */
 	
 	/* store values */
 	ob->mode &= ~OB_MODE_POSE;
-	cfrao= CFRA;
-	actframe= BKE_nla_tweakedit_remap(adt, (float)CFRA, 0);
-	flago= arm->flag;
-	arm->flag &= ~(ARM_DRAWNAMES|ARM_DRAWAXES);
+	cfrao = CFRA;
+	actframe = BKE_nla_tweakedit_remap(adt, (float)CFRA, 0);
+	flago = arm->flag;
+	arm->flag &= ~(ARM_DRAWNAMES | ARM_DRAWAXES);
 	
 	/* copy the pose */
-	poseo= ob->pose;
+	poseo = ob->pose;
 	copy_pose(&posen, ob->pose, 1);
-	ob->pose= posen;
-	armature_rebuild_pose(ob, ob->data);	/* child pointers for IK */
-	ghost_poses_tag_unselected(ob, 0);		/* hide unselected bones if need be */
+	ob->pose = posen;
+	armature_rebuild_pose(ob, ob->data);    /* child pointers for IK */
+	ghost_poses_tag_unselected(ob, 0);      /* hide unselected bones if need be */
 	
 	glEnable(GL_BLEND);
 	if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
 	
 	/* draw from darkest blend to lowest */
-	for(cur= stepsize; cur<range; cur+=stepsize) {
-		ctime= cur - (float)fmod(cfrao, stepsize);	/* ensures consistent stepping */
-		colfac= ctime/range;
-		UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128-(int)(120.0*sqrt(colfac)));
+	for (cur = stepsize; cur < range; cur += stepsize) {
+		ctime = cur - (float)fmod(cfrao, stepsize);  /* ensures consistent stepping */
+		colfac = ctime / range;
+		UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128 - (int)(120.0 * sqrt(colfac)));
 		
 		/* only within action range */
-		if (actframe+ctime >= start && actframe+ctime <= end) {
-			CFRA= (int)BKE_nla_tweakedit_remap(adt, actframe+ctime, NLATIME_CONVERT_MAP);
+		if (actframe + ctime >= start && actframe + ctime <= end) {
+			CFRA = (int)BKE_nla_tweakedit_remap(adt, actframe + ctime, NLATIME_CONVERT_MAP);
 			
 			if (CFRA != cfrao) {
 				BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
@@ -2484,13 +2506,13 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
 			}
 		}
 		
-		ctime= cur + (float)fmod((float)cfrao, stepsize) - stepsize+1.0f;	/* ensures consistent stepping */
-		colfac= ctime/range;
-		UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128-(int)(120.0*sqrt(colfac)));
+		ctime = cur + (float)fmod((float)cfrao, stepsize) - stepsize + 1.0f;   /* ensures consistent stepping */
+		colfac = ctime / range;
+		UI_ThemeColorShadeAlpha(TH_WIRE, 0, -128 - (int)(120.0 * sqrt(colfac)));
 		
 		/* only within action range */
-		if ((actframe-ctime >= start) && (actframe-ctime <= end)) {
-			CFRA= (int)BKE_nla_tweakedit_remap(adt, actframe-ctime, NLATIME_CONVERT_MAP);
+		if ((actframe - ctime >= start) && (actframe - ctime <= end)) {
+			CFRA = (int)BKE_nla_tweakedit_remap(adt, actframe - ctime, NLATIME_CONVERT_MAP);
 			
 			if (CFRA != cfrao) {
 				BKE_animsys_evaluate_animdata(scene, &ob->id, adt, (float)CFRA, ADT_RECALC_ALL);
@@ -2502,13 +2524,13 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
 	glDisable(GL_BLEND);
 	if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
 
-	ghost_poses_tag_unselected(ob, 1);		/* unhide unselected bones if need be */
+	ghost_poses_tag_unselected(ob, 1);      /* unhide unselected bones if need be */
 	free_pose(posen);
 	
 	/* restore */
-	CFRA= cfrao;
-	ob->pose= poseo;
-	arm->flag= flago;
+	CFRA = cfrao;
+	ob->pose = poseo;
+	arm->flag = flago;
 	armature_rebuild_pose(ob, ob->data);
 	ob->mode |= OB_MODE_POSE;
 }
@@ -2518,49 +2540,50 @@ static void draw_ghost_poses(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
 /* called from drawobject.c, return 1 if nothing was drawn */
 int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, int flag, const short is_outline)
 {
-	Object *ob= base->object;
-	bArmature *arm= ob->data;
-	int retval= 0;
+	Object *ob = base->object;
+	bArmature *arm = ob->data;
+	int retval = 0;
 
-	if(v3d->flag2 & V3D_RENDER_OVERRIDE)
+	if (v3d->flag2 & V3D_RENDER_OVERRIDE)
 		return 1;
 	
-	if(dt>OB_WIRE && !ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) {
+	if (dt > OB_WIRE && !ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) {
 		/* we use color for solid lighting */
 		glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
 		glEnable(GL_COLOR_MATERIAL);
-		glColor3ub(255,255,255);	// clear spec
+		glColor3ub(255, 255, 255);    // clear spec
 		glDisable(GL_COLOR_MATERIAL);
 		
 		glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
-		glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);	// only for lighting...
+		glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW); // only for lighting...
 	}
 	
 	/* arm->flag is being used to detect mode... */
 	/* editmode? */
-	if(arm->edbo) {
+	if (arm->edbo) {
 		arm->flag |= ARM_EDITMODE;
 		draw_ebones(v3d, ar, ob, dt);
 		arm->flag &= ~ARM_EDITMODE;
 	}
-	else{
+	else {
 		/*	Draw Pose */
-		if(ob->pose && ob->pose->chanbase.first) {
+		if (ob->pose && ob->pose->chanbase.first) {
 			/* drawing posemode selection indices or colors only in these cases */
-			if(!(base->flag & OB_FROMDUPLI)) {
-				if(G.f & G_PICKSEL) {
-#if 0				/* nifty but actually confusing to allow bone selection out of posemode */
-					if(OBACT && (OBACT->mode & OB_MODE_WEIGHT_PAINT)) {
-						if(ob==modifiers_isDeformedByArmature(OBACT))
+			if (!(base->flag & OB_FROMDUPLI)) {
+				if (G.f & G_PICKSEL) {
+#if 0
+					/* nifty but actually confusing to allow bone selection out of posemode */
+					if (OBACT && (OBACT->mode & OB_MODE_WEIGHT_PAINT)) {
+						if (ob == modifiers_isDeformedByArmature(OBACT))
 							arm->flag |= ARM_POSEMODE;
 					}
 					else
 #endif
-					if(ob->mode & OB_MODE_POSE) {
+					if (ob->mode & OB_MODE_POSE) {
 						arm->flag |= ARM_POSEMODE;
 					}
 				}
-				else if(ob->mode & OB_MODE_POSE) {
+				else if (ob->mode & OB_MODE_POSE) {
 					if (arm->ghosttype == ARM_GHOST_RANGE) {
 						draw_ghost_poses_range(scene, v3d, ar, base);
 					}
@@ -2571,11 +2594,11 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in
 						if (arm->ghostep)
 							draw_ghost_poses(scene, v3d, ar, base);
 					}
-					if ((flag & DRAW_SCENESET)==0) {
-						if(ob==OBACT) 
+					if ((flag & DRAW_SCENESET) == 0) {
+						if (ob == OBACT)
 							arm->flag |= ARM_POSEMODE;
-						else if(OBACT && (OBACT->mode & OB_MODE_WEIGHT_PAINT)) {
-							if(ob==modifiers_isDeformedByArmature(OBACT))
+						else if (OBACT && (OBACT->mode & OB_MODE_WEIGHT_PAINT)) {
+							if (ob == modifiers_isDeformedByArmature(OBACT))
 								arm->flag |= ARM_POSEMODE;
 						}
 						draw_pose_paths(scene, v3d, ar, ob);
@@ -2585,10 +2608,12 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, in
 			draw_pose_bones(scene, v3d, ar, base, dt, FALSE, is_outline);
 			arm->flag &= ~ARM_POSEMODE; 
 			
-			if(ob->mode & OB_MODE_POSE)
-				UI_ThemeColor(TH_WIRE);	/* restore, for extra draw stuff */
+			if (ob->mode & OB_MODE_POSE)
+				UI_ThemeColor(TH_WIRE);  /* restore, for extra draw stuff */
+		}
+		else {
+			retval = 1;
 		}
-		else retval= 1;
 	}
 	/* restore */
 	glFrontFace(GL_CCW);
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 62c1250..f5f3b4c 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -32,13 +32,14 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "BLI_utildefines.h"
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
 #include "BLI_edgehash.h"
-#include "BLI_editVert.h"
 #include "BLI_utildefines.h"
 
 #include "DNA_material_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_node_types.h"
 #include "DNA_object_types.h"
@@ -46,6 +47,7 @@
 #include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
 #include "DNA_view3d_types.h"
+#include "DNA_windowmanager_types.h"
 
 #include "BKE_DerivedMesh.h"
 #include "BKE_effect.h"
@@ -53,6 +55,7 @@
 #include "BKE_material.h"
 #include "BKE_paint.h"
 #include "BKE_property.h"
+#include "BKE_tessmesh.h"
 #include "BKE_scene.h"
 
 #include "BIF_gl.h"
@@ -68,7 +71,7 @@
 #include "ED_mesh.h"
 #include "ED_uvedit.h"
 
-#include "view3d_intern.h"	// own include
+#include "view3d_intern.h"  // own include
 
 /* user data structures for derived mesh callbacks */
 typedef struct drawMeshFaceSelect_userData {
@@ -77,7 +80,7 @@ typedef struct drawMeshFaceSelect_userData {
 } drawMeshFaceSelect_userData;
 
 typedef struct drawEMTFMapped_userData {
-	EditMesh *em;
+	BMEditMesh *em;
 	short has_mcol;
 	short has_mtface;
 	MFace *mf;
@@ -93,8 +96,8 @@ typedef struct drawTFace_userData {
 
 /* Flags for marked edges */
 enum {
-	eEdge_Visible = (1<<0),
-	eEdge_Select = (1<<1),
+	eEdge_Visible = (1 << 0),
+	eEdge_Select = (1 << 1),
 };
 
 /* Creates a hash of edges to flags indicating selected/visible */
@@ -102,35 +105,33 @@ static void get_marked_edge_info__orFlags(EdgeHash *eh, int v0, int v1, int flag
 {
 	int *flags_p;
 
-	if(!BLI_edgehash_haskey(eh, v0, v1))
+	if (!BLI_edgehash_haskey(eh, v0, v1))
 		BLI_edgehash_insert(eh, v0, v1, NULL);
 
-	flags_p = (int*) BLI_edgehash_lookup_p(eh, v0, v1);
+	flags_p = (int *) BLI_edgehash_lookup_p(eh, v0, v1);
 	*flags_p |= flags;
 }
 
 static EdgeHash *get_tface_mesh_marked_edge_info(Mesh *me)
 {
 	EdgeHash *eh = BLI_edgehash_new();
-	MFace *mf;
-	int i;
+	MPoly *mp;
+	MLoop *ml;
+	MLoop *ml_next;
+	int i, j;
 	
-	for(i=0; i<me->totface; i++) {
-		mf = &me->mface[i];
+	for (i = 0; i < me->totpoly; i++) {
+		mp = &me->mpoly[i];
 
-		if(!(mf->flag & ME_HIDE)) {
+		if (!(mp->flag & ME_HIDE)) {
 			unsigned int flags = eEdge_Visible;
-			if(mf->flag & ME_FACE_SEL) flags |= eEdge_Select;
+			if (mp->flag & ME_FACE_SEL) flags |= eEdge_Select;
 
-			get_marked_edge_info__orFlags(eh, mf->v1, mf->v2, flags);
-			get_marked_edge_info__orFlags(eh, mf->v2, mf->v3, flags);
-
-			if(mf->v4) {
-				get_marked_edge_info__orFlags(eh, mf->v3, mf->v4, flags);
-				get_marked_edge_info__orFlags(eh, mf->v4, mf->v1, flags);
+			ml = me->mloop + mp->loopstart;
+			for (j = 0; j < mp->totloop; j++, ml++) {
+				ml_next = ME_POLY_LOOP_NEXT(me->mloop, mp, j);
+				get_marked_edge_info__orFlags(eh, ml->v, ml_next->v, flags);
 			}
-			else
-				get_marked_edge_info__orFlags(eh, mf->v3, mf->v1, flags);
 		}
 	}
 
@@ -138,42 +139,44 @@ static EdgeHash *get_tface_mesh_marked_edge_info(Mesh *me)
 }
 
 
-static int draw_mesh_face_select__setHiddenOpts(void *userData, int index)
+static DMDrawOption draw_mesh_face_select__setHiddenOpts(void *userData, int index)
 {
 	drawMeshFaceSelect_userData *data = userData;
-	Mesh *me= data->me;
+	Mesh *me = data->me;
 	MEdge *med = &me->medge[index];
 	uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2);
 
-	if(me->drawflag & ME_DRAWEDGES) { 
-		if(me->drawflag & ME_HIDDENEDGES)
-			return 1;
+	if (me->drawflag & ME_DRAWEDGES) {
+		if ((me->drawflag & ME_HIDDENEDGES) || (flags & eEdge_Visible))
+			return DM_DRAW_OPTION_NORMAL;
 		else
-			return (flags & eEdge_Visible);
+			return DM_DRAW_OPTION_SKIP;
 	}
+	else if (flags & eEdge_Select)
+		return DM_DRAW_OPTION_NORMAL;
 	else
-		return (flags & eEdge_Select);
+		return DM_DRAW_OPTION_SKIP;
 }
 
-static int draw_mesh_face_select__setSelectOpts(void *userData, int index)
+static DMDrawOption draw_mesh_face_select__setSelectOpts(void *userData, int index)
 {
 	drawMeshFaceSelect_userData *data = userData;
 	MEdge *med = &data->me->medge[index];
 	uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2);
 
-	return flags & eEdge_Select;
+	return (flags & eEdge_Select) ? DM_DRAW_OPTION_NORMAL : DM_DRAW_OPTION_SKIP;
 }
 
 /* draws unselected */
-static int draw_mesh_face_select__drawFaceOptsInv(void *userData, int index)
+static DMDrawOption draw_mesh_face_select__drawFaceOptsInv(void *userData, int index)
 {
-	Mesh *me = (Mesh*)userData;
+	Mesh *me = (Mesh *)userData;
 
-	MFace *mface = &me->mface[index];
-	if(!(mface->flag&ME_HIDE) && !(mface->flag&ME_FACE_SEL))
-		return 2; /* Don't set color */
+	MPoly *mpoly = &me->mpoly[index];
+	if (!(mpoly->flag & ME_HIDE) && !(mpoly->flag & ME_FACE_SEL))
+		return DM_DRAW_OPTION_NO_MCOL;  /* Don't set color */
 	else
-		return 0;
+		return DM_DRAW_OPTION_SKIP;
 }
 
 static void draw_mesh_face_select(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm)
@@ -194,25 +197,24 @@ static void draw_mesh_face_select(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm)
 	setlinestyle(0);
 
 	/* Draw Selected Faces */
-	if(me->drawflag & ME_DRAWFACES) {
+	if (me->drawflag & ME_DRAWFACES) {
 		glEnable(GL_BLEND);
 		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 		/* dull unselected faces so as not to get in the way of seeing color */
 		glColor4ub(96, 96, 96, 64);
-		dm->drawMappedFacesTex(dm, draw_mesh_face_select__drawFaceOptsInv, NULL, (void*)me);
-		
+		dm->drawMappedFaces(dm, draw_mesh_face_select__drawFaceOptsInv, NULL, NULL, (void *)me, 0);
 		glDisable(GL_BLEND);
 	}
 	
 	bglPolygonOffset(rv3d->dist, 1.0);
 
-		/* Draw Stippled Outline for selected faces */
+	/* Draw Stippled Outline for selected faces */
 	glColor3ub(255, 255, 255);
 	setlinestyle(1);
 	dm->drawMappedEdges(dm, draw_mesh_face_select__setSelectOpts, &data);
 	setlinestyle(0);
 
-	bglPolygonOffset(rv3d->dist, 0.0);	// resets correctly now, even after calling accumulated offsets
+	bglPolygonOffset(rv3d->dist, 0.0);  // resets correctly now, even after calling accumulated offsets
 
 	BLI_edgehash_free(data.eh, NULL);
 }
@@ -221,10 +223,10 @@ static void draw_mesh_face_select(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm)
 
 static Material *give_current_material_or_def(Object *ob, int matnr)
 {
-	extern Material defmaterial;	// render module abuse...
-	Material *ma= give_current_material(ob, matnr);
+	extern Material defmaterial;    // render module abuse...
+	Material *ma = give_current_material(ob, matnr);
 
-	return ma?ma:&defmaterial;
+	return ma ? ma : &defmaterial;
 }
 
 /* Icky globals, fix with userdata parameter */
@@ -240,22 +242,27 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m
 {
 	static Material *c_ma;
 	static int c_textured;
-	static MTFace *c_texface;
+	static MTFace c_texface;
 	static int c_backculled;
 	static int c_badtex;
 	static int c_lit;
+	static int c_has_texface;
 
 	Object *litob = NULL; //to get mode to turn off mipmap in painting mode
 	int backculled = GEMAT_BACKCULL;
 	int alphablend = 0;
 	int textured = 0;
 	int lit = 0;
-	
+	int has_texface = texface != NULL;
+	int need_set_tpage = FALSE;
+
 	if (clearcache) {
-		c_textured= c_lit= c_backculled= -1;
-		c_texface= (MTFace*) -1;
-		c_badtex= 0;
-	} else {
+		c_textured = c_lit = c_backculled = -1;
+		memset(&c_texface, 0, sizeof(MTFace));
+		c_badtex = 0;
+		c_has_texface = -1;
+	}
+	else {
 		textured = gtexdraw.istex;
 		litob = gtexdraw.ob;
 	}
@@ -280,34 +287,42 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m
 	else
 		textured = 0;
 
-	if (backculled!=c_backculled) {
+	if (backculled != c_backculled) {
 		if (backculled) glEnable(GL_CULL_FACE);
 		else glDisable(GL_CULL_FACE);
 
-		c_backculled= backculled;
+		c_backculled = backculled;
 	}
 
-	if (textured!=c_textured || texface!=c_texface) {
-		if (textured ) {
-			c_badtex= !GPU_set_tpage(texface, !(litob->mode & OB_MODE_TEXTURE_PAINT), alphablend);
-		} else {
+	/* need to re-set tpage if textured flag changed or existsment of texface changed..  */
+	need_set_tpage = textured != c_textured || has_texface != c_has_texface;
+	/* ..or if settings inside texface were changed (if texface was used) */
+	need_set_tpage |= texface && memcmp(&c_texface, texface, sizeof(c_texface));
+
+	if (need_set_tpage) {
+		if (textured) {
+			c_badtex = !GPU_set_tpage(texface, !(litob->mode & OB_MODE_TEXTURE_PAINT), alphablend);
+		}
+		else {
 			GPU_set_tpage(NULL, 0, 0);
-			c_badtex= 0;
+			c_badtex = 0;
 		}
-		c_textured= textured;
-		c_texface= texface;
+		c_textured = textured;
+		c_has_texface = has_texface;
+		if (texface)
+			memcpy(&c_texface, texface, sizeof(c_texface));
 	}
 
-	if (c_badtex) lit= 0;
-	if (lit!=c_lit || ma!=c_ma) {
+	if (c_badtex) lit = 0;
+	if (lit != c_lit || ma != c_ma) {
 		if (lit) {
 			float spec[4];
-			if (!ma)ma= give_current_material_or_def(NULL, 0); //default material
+			if (!ma) ma = give_current_material_or_def(NULL, 0);  //default material
 
-			spec[0]= ma->spec*ma->specr;
-			spec[1]= ma->spec*ma->specg;
-			spec[2]= ma->spec*ma->specb;
-			spec[3]= 1.0;
+			spec[0] = ma->spec * ma->specr;
+			spec[1] = ma->spec * ma->specg;
+			spec[2] = ma->spec * ma->specb;
+			spec[3] = 1.0;
 
 			glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, spec);
 			glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
@@ -319,7 +334,7 @@ static int set_draw_settings_cached(int clearcache, MTFace *texface, Material *m
 			glDisable(GL_LIGHTING); 
 			glDisable(GL_COLOR_MATERIAL);
 		}
-		c_lit= lit;
+		c_lit = lit;
 	}
 
 	return c_badtex;
@@ -334,26 +349,26 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, O
 
 	/* texture draw is abused for mask selection mode, do this so wire draw
 	 * with face selection in weight paint is not lit. */
-	if((v3d->drawtype <= OB_WIRE) && (ob->mode & OB_MODE_WEIGHT_PAINT)) {
-		solidtex= FALSE;
-		Gtexdraw.islit= 0;
+	if ((v3d->drawtype <= OB_WIRE) && (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT))) {
+		solidtex = FALSE;
+		Gtexdraw.islit = 0;
 	}
-	else if(v3d->drawtype==OB_SOLID || ((ob->mode & OB_MODE_EDIT) && v3d->drawtype!=OB_TEXTURE)) {
+	else if (v3d->drawtype == OB_SOLID || ((ob->mode & OB_MODE_EDIT) && v3d->drawtype != OB_TEXTURE)) {
 		/* draw with default lights in solid draw mode and edit mode */
-		solidtex= TRUE;
-		Gtexdraw.islit= -1;
+		solidtex = TRUE;
+		Gtexdraw.islit = -1;
 	}
 	else {
 		/* draw with lights in the scene otherwise */
-		solidtex= FALSE;
-		Gtexdraw.islit= GPU_scene_object_lights(scene, ob, v3d->lay, rv3d->viewmat, !rv3d->is_persp);
+		solidtex = FALSE;
+		Gtexdraw.islit = GPU_scene_object_lights(scene, ob, v3d->lay, rv3d->viewmat, !rv3d->is_persp);
 	}
 	
 	rgba_float_to_uchar(obcol, ob->col);
 
 	glCullFace(GL_BACK); glEnable(GL_CULL_FACE);
-	if(solidtex || v3d->drawtype==OB_TEXTURE) istex= 1;
-	else istex= 0;
+	if (solidtex || v3d->drawtype == OB_TEXTURE) istex = 1;
+	else istex = 0;
 
 	Gtexdraw.ob = ob;
 	Gtexdraw.istex = istex;
@@ -386,246 +401,323 @@ static void draw_textured_end(void)
 	glPopMatrix();
 }
 
-static int draw_tface__set_draw_legacy(MTFace *tface, int has_mcol, int matnr)
+static DMDrawOption draw_tface__set_draw_legacy(MTFace *tface, int has_mcol, int matnr)
 {
-	Material *ma= give_current_material(Gtexdraw.ob, matnr+1);
-	int validtexture=0;
+	Material *ma = give_current_material(Gtexdraw.ob, matnr + 1);
+	int validtexture = 0;
 
-	if (ma && (ma->game.flag & GEMAT_INVISIBLE)) return 0;
+	if (ma && (ma->game.flag & GEMAT_INVISIBLE))
+		return DM_DRAW_OPTION_SKIP;
 
 	validtexture = set_draw_settings_cached(0, tface, ma, Gtexdraw);
 
 	if (tface && validtexture) {
 		glColor3ub(0xFF, 0x00, 0xFF);
-		return 2; /* Don't set color */
-	} else if (ma && ma->shade_flag&MA_OBCOLOR) {
+		return DM_DRAW_OPTION_NO_MCOL; /* Don't set color */
+	}
+	else if (ma && (ma->shade_flag & MA_OBCOLOR)) {
 		glColor3ubv(Gtexdraw.obcol);
-		return 2; /* Don't set color */
-	} else if (!has_mcol) {
+		return DM_DRAW_OPTION_NO_MCOL; /* Don't set color */
+	}
+	else if (!has_mcol) {
 		if (tface) glColor3f(1.0, 1.0, 1.0);
 		else {
-			if(ma) {
+			if (ma) {
 				float col[3];
-				if(Gtexdraw.color_profile) linearrgb_to_srgb_v3_v3(col, &ma->r);
+				if (Gtexdraw.color_profile) linearrgb_to_srgb_v3_v3(col, &ma->r);
 				else copy_v3_v3(col, &ma->r);
 				
 				glColor3fv(col);
 			}
 			else glColor3f(1.0, 1.0, 1.0);
 		}
-		return 2; /* Don't set color */
-	} else {
-		return 1; /* Set color from mcol */
+		return DM_DRAW_OPTION_NO_MCOL; /* Don't set color */
+	}
+	else {
+		return DM_DRAW_OPTION_NORMAL; /* Set color from mcol */
 	}
 }
 
-static int draw_mcol__set_draw_legacy(MTFace *UNUSED(tface), int has_mcol, int UNUSED(matnr))
+static DMDrawOption draw_mcol__set_draw_legacy(MTFace *UNUSED(tface), int has_mcol, int UNUSED(matnr))
 {
-	if (has_mcol) return 1;
-	else return 2;
+	if (has_mcol)
+		return DM_DRAW_OPTION_NORMAL;
+	else
+		return DM_DRAW_OPTION_NO_MCOL;
 }
 
-static int draw_tface__set_draw(MTFace *tface, int has_mcol, int matnr)
+static DMDrawOption draw_tface__set_draw(MTFace *tface, int has_mcol, int matnr)
 {
-	Material *ma= give_current_material(Gtexdraw.ob, matnr+1);
+	Material *ma = give_current_material(Gtexdraw.ob, matnr + 1);
 
 	if (ma && (ma->game.flag & GEMAT_INVISIBLE)) return 0;
 
 	if (tface && set_draw_settings_cached(0, tface, ma, Gtexdraw)) {
-		return 2; /* Don't set color */
-	} else if (tface && tface->mode&TF_OBCOL) {
-		return 2; /* Don't set color */
-	} else if (!has_mcol) {
-		return 1; /* Don't set color */
-	} else {
-		return 1; /* Set color from mcol */
+		return DM_DRAW_OPTION_NO_MCOL; /* Don't set color */
+	}
+	else if (tface && (tface->mode & TF_OBCOL)) {
+		return DM_DRAW_OPTION_NO_MCOL; /* Don't set color */
+	}
+	else if (!has_mcol) {
+		/* XXX: this return value looks wrong (and doesn't match comment) */
+		return DM_DRAW_OPTION_NORMAL; /* Don't set color */
+	}
+	else {
+		return DM_DRAW_OPTION_NORMAL; /* Set color from mcol */
 	}
 }
 static void add_tface_color_layer(DerivedMesh *dm)
 {
-	MTFace *tface = DM_get_face_data_layer(dm, CD_MTFACE);
-	MFace *mface = DM_get_face_data_layer(dm, CD_MFACE);
+	MTFace *tface = DM_get_tessface_data_layer(dm, CD_MTFACE);
+	MFace *mface = dm->getTessFaceArray(dm);
 	MCol *finalCol;
-	int i,j;
-	MCol *mcol = dm->getFaceDataArray(dm, CD_WEIGHT_MCOL);
-	if(!mcol)
-		mcol = dm->getFaceDataArray(dm, CD_MCOL);
-
-	finalCol = MEM_mallocN(sizeof(MCol)*4*dm->getNumFaces(dm),"add_tface_color_layer");
-	for(i=0;i<dm->getNumFaces(dm);i++) {
-		Material *ma= give_current_material(Gtexdraw.ob, mface[i].mat_nr+1);
-
-		if (ma && (ma->game.flag&GEMAT_INVISIBLE)) {
-			if( mcol )
-				memcpy(&finalCol[i*4],&mcol[i*4],sizeof(MCol)*4);
+	int i, j;
+	MCol *mcol = dm->getTessFaceDataArray(dm, CD_PREVIEW_MCOL);
+	if (!mcol)
+		mcol = dm->getTessFaceDataArray(dm, CD_MCOL);
+
+	finalCol = MEM_mallocN(sizeof(MCol) * 4 * dm->getNumTessFaces(dm), "add_tface_color_layer");
+	for (i = 0; i < dm->getNumTessFaces(dm); i++) {
+		Material *ma = give_current_material(Gtexdraw.ob, mface[i].mat_nr + 1);
+
+		if (ma && (ma->game.flag & GEMAT_INVISIBLE)) {
+			if (mcol)
+				memcpy(&finalCol[i * 4], &mcol[i * 4], sizeof(MCol) * 4);
 			else
-				for(j=0;j<4;j++) {
-					finalCol[i*4+j].b = 255;
-					finalCol[i*4+j].g = 255;
-					finalCol[i*4+j].r = 255;
+				for (j = 0; j < 4; j++) {
+					finalCol[i * 4 + j].b = 255;
+					finalCol[i * 4 + j].g = 255;
+					finalCol[i * 4 + j].r = 255;
 				}
 		}
 		else if (tface && mface && set_draw_settings_cached(0, tface, ma, Gtexdraw)) {
-			for(j=0;j<4;j++) {
-				finalCol[i*4+j].b = 255;
-				finalCol[i*4+j].g = 0;
-				finalCol[i*4+j].r = 255;
+			for (j = 0; j < 4; j++) {
+				finalCol[i * 4 + j].b = 255;
+				finalCol[i * 4 + j].g = 0;
+				finalCol[i * 4 + j].r = 255;
 			}
-		} else if (tface && tface->mode&TF_OBCOL) {
-			for(j=0;j<4;j++) {
-				finalCol[i*4+j].b = FTOCHAR(Gtexdraw.obcol[0]);
-				finalCol[i*4+j].g = FTOCHAR(Gtexdraw.obcol[1]);
-				finalCol[i*4+j].r = FTOCHAR(Gtexdraw.obcol[2]);
+		}
+		else if (tface && (tface->mode & TF_OBCOL)) {
+			for (j = 0; j < 4; j++) {
+				finalCol[i * 4 + j].b = FTOCHAR(Gtexdraw.obcol[0]);
+				finalCol[i * 4 + j].g = FTOCHAR(Gtexdraw.obcol[1]);
+				finalCol[i * 4 + j].r = FTOCHAR(Gtexdraw.obcol[2]);
 			}
-		} else if (!mcol) {
+		}
+		else if (!mcol) {
 			if (tface) {
-				for(j=0;j<4;j++) {
-					finalCol[i*4+j].b = 255;
-					finalCol[i*4+j].g = 255;
-					finalCol[i*4+j].r = 255;
+				for (j = 0; j < 4; j++) {
+					finalCol[i * 4 + j].b = 255;
+					finalCol[i * 4 + j].g = 255;
+					finalCol[i * 4 + j].r = 255;
 				}
 			}
 			else {
 				float col[3];
-				Material *ma= give_current_material(Gtexdraw.ob, mface[i].mat_nr+1);
+				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);
+				if (ma) {
+					if (Gtexdraw.color_profile) linearrgb_to_srgb_v3_v3(col, &ma->r);
 					else copy_v3_v3(col, &ma->r);
 					
-					for(j=0;j<4;j++) {
-						finalCol[i*4+j].b = FTOCHAR(col[0]);
-						finalCol[i*4+j].g = FTOCHAR(col[1]);
-						finalCol[i*4+j].r = FTOCHAR(col[2]);
+					for (j = 0; j < 4; j++) {
+						finalCol[i * 4 + j].b = FTOCHAR(col[0]);
+						finalCol[i * 4 + j].g = FTOCHAR(col[1]);
+						finalCol[i * 4 + j].r = FTOCHAR(col[2]);
 					}
 				}
 				else
-					for(j=0;j<4;j++) {
-						finalCol[i*4+j].b = 255;
-						finalCol[i*4+j].g = 255;
-						finalCol[i*4+j].r = 255;
+					for (j = 0; j < 4; j++) {
+						finalCol[i * 4 + j].b = 255;
+						finalCol[i * 4 + j].g = 255;
+						finalCol[i * 4 + j].r = 255;
 					}
 			}
-		} else {
-			for(j=0;j<4;j++) {
-				finalCol[i*4+j].r = mcol[i*4+j].r;
-				finalCol[i*4+j].g = mcol[i*4+j].g;
-				finalCol[i*4+j].b = mcol[i*4+j].b;
+		}
+		else {
+			for (j = 0; j < 4; j++) {
+				finalCol[i * 4 + j].r = mcol[i * 4 + j].r;
+				finalCol[i * 4 + j].g = mcol[i * 4 + j].g;
+				finalCol[i * 4 + j].b = mcol[i * 4 + j].b;
 			}
 		}
 	}
-	CustomData_add_layer( &dm->faceData, CD_TEXTURE_MCOL, CD_ASSIGN, finalCol, dm->numFaceData );
+	CustomData_add_layer(&dm->faceData, CD_TEXTURE_MCOL, CD_ASSIGN, finalCol, dm->numTessFaceData);
 }
 
-static int draw_tface_mapped__set_draw(void *userData, int index)
+static DMDrawOption draw_tface_mapped__set_draw(void *userData, int index)
 {
-	Mesh *me = (Mesh*)userData;
-	MTFace *tface = (me->mtface)? &me->mtface[index]: NULL;
-	MFace *mface = &me->mface[index];
-	const int matnr = mface->mat_nr;
-	if (mface->flag & ME_HIDE) return 0;
-	return draw_tface__set_draw(tface, (me->mcol != NULL), matnr);
+	Mesh *me = (Mesh *)userData;
+
+	/* array checked for NULL before calling */
+	MPoly *mpoly = &me->mpoly[index];
+
+	BLI_assert(index >= 0 && index < me->totpoly);
+
+	if (mpoly->flag & ME_HIDE) {
+		return DM_DRAW_OPTION_SKIP;
+	}
+	else {
+		MTexPoly *tpoly = (me->mtpoly) ? &me->mtpoly[index] : NULL;
+		MTFace mtf = {{{0}}};
+		int matnr = mpoly->mat_nr;
+
+		if (tpoly) {
+			ME_MTEXFACE_CPY(&mtf, tpoly);
+		}
+
+		return draw_tface__set_draw(&mtf, (me->mloopcol != NULL), matnr);
+	}
 }
 
-static int draw_em_tf_mapped__set_draw(void *userData, int index)
+static DMDrawOption draw_em_tf_mapped__set_draw(void *userData, int index)
 {
 	drawEMTFMapped_userData *data = userData;
-	EditMesh *em = data->em;
-	EditFace *efa= EM_get_face_for_index(index);
-	MTFace *tface;
-	int matnr;
+	BMEditMesh *em = data->em;
+	BMFace *efa = EDBM_face_at_index(em, index);
 
-	if (efa->h)
-		return 0;
+	if (efa == NULL || BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
+		return DM_DRAW_OPTION_SKIP;
+	}
+	else {
+		MTFace mtf = {{{0}}};
+		int matnr = efa->mat_nr;
 
-	tface = data->has_mtface ? CustomData_em_get(&em->fdata, efa->data, CD_MTFACE) : NULL;
-	matnr = efa->mat_nr;
+		if (data->has_mtface) {
+			MTexPoly *tpoly = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
+			ME_MTEXFACE_CPY(&mtf, tpoly);
+		}
 
-	return draw_tface__set_draw_legacy(tface, data->has_mcol, matnr);
+		return draw_tface__set_draw_legacy(data->has_mtface ? &mtf : NULL,
+		                                   data->has_mcol, matnr);
+	}
 }
 
-static int wpaint__setSolidDrawOptions_material(void *userData, int index, int *drawSmooth_r)
+static DMDrawOption wpaint__setSolidDrawOptions_material(void *userData, int index)
 {
-	Mesh *me = (Mesh*)userData;
+	Mesh *me = (Mesh *)userData;
 
-	if (me->mat && me->mface) {
-		Material *ma= me->mat[me->mface[index].mat_nr];
+	if (me->mat && me->mpoly) {
+		Material *ma = me->mat[me->mpoly[index].mat_nr];
 		if (ma && (ma->game.flag & GEMAT_INVISIBLE)) {
-			return 0;
+			return DM_DRAW_OPTION_SKIP;
 		}
 	}
 
-	*drawSmooth_r = 1;
-	return 1;
+	return DM_DRAW_OPTION_NORMAL;
 }
 
 /* when face select is on, use face hidden flag */
-static int wpaint__setSolidDrawOptions_facemask(void *userData, int index, int *drawSmooth_r)
+static DMDrawOption wpaint__setSolidDrawOptions_facemask(void *userData, int index)
 {
-	Mesh *me = (Mesh*)userData;
-	MFace *mface = &me->mface[index];
-	if (mface->flag & ME_HIDE) return 0;
-	*drawSmooth_r = 1;
-	return 1;
+	Mesh *me = (Mesh *)userData;
+	MPoly *mp = &me->mpoly[index];
+	if (mp->flag & ME_HIDE)
+		return DM_DRAW_OPTION_SKIP;
+	return DM_DRAW_OPTION_NORMAL;
 }
 
 static void draw_mesh_text(Scene *scene, Object *ob, int glsl)
 {
 	Mesh *me = ob->data;
 	DerivedMesh *ddm;
-	MFace *mf, *mface= me->mface;
-	MTFace *tface= me->mtface;
-	MCol *mcol= me->mcol;	/* why does mcol exist? */
+	MPoly *mp, *mface  = me->mpoly;
+	MTexPoly *mtpoly   = me->mtpoly;
+	MLoopUV *mloopuv   = me->mloopuv;
+	MLoopUV *luv;
+	MLoopCol *mloopcol = me->mloopcol;  /* why does mcol exist? */
+	MLoopCol *lcol;
+
 	bProperty *prop = get_ob_property(ob, "Text");
 	GPUVertexAttribs gattribs;
-	int a, totface= me->totface;
+	int a, totpoly = me->totpoly;
+
+	/* fake values to pass to GPU_render_text() */
+	MCol tmp_mcol[4]  = {{0}};
+	MCol *tmp_mcol_pt  = mloopcol ? tmp_mcol : NULL;
+	MTFace tmp_tf      = {{{0}}};
 
 	/* don't draw without tfaces */
-	if(!tface)
+	if (!mtpoly || !mloopuv)
 		return;
 
 	/* don't draw when editing */
-	if(ob->mode & OB_MODE_EDIT)
+	if (ob->mode & OB_MODE_EDIT)
 		return;
-	else if(ob==OBACT)
-		if(paint_facesel_test(ob) || paint_vertsel_test(ob))
+	else if (ob == OBACT)
+		if (paint_facesel_test(ob) || paint_vertsel_test(ob))
 			return;
 
 	ddm = mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH);
 
-	for(a=0, mf=mface; a<totface; a++, tface++, mf++) {
-		short matnr= mf->mat_nr;
-		int mf_smooth= mf->flag & ME_SMOOTH;
+	for (a = 0, mp = mface; a < totpoly; a++, mtpoly++, mp++) {
+		short matnr = mp->mat_nr;
+		int mf_smooth = mp->flag & ME_SMOOTH;
 		Material *mat = me->mat[matnr];
-		int mode= mat->game.flag;
+		int mode = mat->game.flag;
 
-		if (!(mode&GEMAT_INVISIBLE) && (mode&GEMAT_TEXT)) {
+		if (!(mode & GEMAT_INVISIBLE) && (mode & GEMAT_TEXT) && mp->totloop >= 3) {
+			/* get the polygon as a tri/quad */
+			int mp_vi[4];
 			float v1[3], v2[3], v3[3], v4[3];
 			char string[MAX_PROPSTRING];
-			int characters, i, glattrib= -1, badtex= 0;
+			int characters, i, glattrib = -1, badtex = 0;
 
-			if(glsl) {
-				GPU_enable_material(matnr+1, &gattribs);
 
-				for(i=0; i<gattribs.totlayer; i++) {
-					if(gattribs.layer[i].type == CD_MTFACE) {
+			/* TEXFACE */
+			ME_MTEXFACE_CPY(&tmp_tf, mtpoly);
+
+			if (glsl) {
+				GPU_enable_material(matnr + 1, &gattribs);
+
+				for (i = 0; i < gattribs.totlayer; i++) {
+					if (gattribs.layer[i].type == CD_MTFACE) {
 						glattrib = gattribs.layer[i].glindex;
 						break;
 					}
 				}
 			}
 			else {
-				badtex = set_draw_settings_cached(0, tface, mat, Gtexdraw);
+				badtex = set_draw_settings_cached(0, &tmp_tf, mat, Gtexdraw);
 				if (badtex) {
-					if (mcol) mcol+=4;
 					continue;
 				}
 			}
 
-			ddm->getVertCo(ddm, mf->v1, v1);
-			ddm->getVertCo(ddm, mf->v2, v2);
-			ddm->getVertCo(ddm, mf->v3, v3);
-			if (mf->v4) ddm->getVertCo(ddm, mf->v4, v4);
+			mp_vi[0] = me->mloop[mp->loopstart + 0].v;
+			mp_vi[1] = me->mloop[mp->loopstart + 1].v;
+			mp_vi[2] = me->mloop[mp->loopstart + 2].v;
+			mp_vi[3] = (mp->totloop >= 4) ? me->mloop[mp->loopstart + 3].v : 0;
+
+			/* UV */
+			luv = &mloopuv[mp->loopstart];
+			copy_v2_v2(tmp_tf.uv[0], luv->uv); luv++;
+			copy_v2_v2(tmp_tf.uv[1], luv->uv); luv++;
+			copy_v2_v2(tmp_tf.uv[2], luv->uv); luv++;
+			if (mp->totloop >= 4) {
+				copy_v2_v2(tmp_tf.uv[3], luv->uv);
+			}
+
+			/* COLOR */
+			if (mloopcol) {
+				unsigned int totloop_clamp = MIN2(4, mp->totloop);
+				unsigned int j;
+				lcol = &mloopcol[mp->loopstart];
+
+				for (j = 0; j <= totloop_clamp; j++, lcol++) {
+					MESH_MLOOPCOL_TO_MCOL(lcol, &tmp_mcol[j]);
+				}
+			}
+
+			/* LOCATION */
+			ddm->getVertCo(ddm, mp_vi[0], v1);
+			ddm->getVertCo(ddm, mp_vi[1], v2);
+			ddm->getVertCo(ddm, mp_vi[2], v3);
+			if (mp->totloop >= 4) {
+				ddm->getVertCo(ddm, mp_vi[3], v4);
+			}
+
+
 
 			// The BM_FONT handling is in the gpu module, shared with the
 			// game engine, was duplicated previously
@@ -633,22 +725,19 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl)
 			set_property_valstr(prop, string);
 			characters = strlen(string);
 			
-			if(!BKE_image_get_ibuf(tface->tpage, NULL))
+			if (!BKE_image_get_ibuf(mtpoly->tpage, NULL))
 				characters = 0;
 
 			if (!mf_smooth) {
 				float nor[3];
 
-				normal_tri_v3( nor,v1, v2, v3);
+				normal_tri_v3(nor, v1, v2, v3);
 
 				glNormal3fv(nor);
 			}
 
-			GPU_render_text(tface, mode, string, characters,
-				(unsigned int*)mcol, v1, v2, v3, (mf->v4? v4: NULL), glattrib);
-		}
-		if (mcol) {
-			mcol+=4;
+			GPU_render_text(&tmp_tf, mode, string, characters,
+			                (unsigned int *)tmp_mcol_pt, v1, v2, v3, (mp->totloop >= 4 ? v4 : NULL), glattrib);
 		}
 	}
 
@@ -659,10 +748,10 @@ static int compareDrawOptions(void *userData, int cur_index, int next_index)
 {
 	drawTFace_userData *data = userData;
 
-	if(data->mf && data->mf[cur_index].mat_nr != data->mf[next_index].mat_nr)
+	if (data->mf && data->mf[cur_index].mat_nr != data->mf[next_index].mat_nr)
 		return 0;
 
-	if(data->tf && data->tf[cur_index].tpage != data->tf[next_index].tpage)
+	if (data->tf && data->tf[cur_index].tpage != data->tf[next_index].tpage)
 		return 0;
 
 	return 1;
@@ -670,12 +759,12 @@ static int compareDrawOptions(void *userData, int cur_index, int next_index)
 
 static int compareDrawOptionsEm(void *userData, int cur_index, int next_index)
 {
-	drawEMTFMapped_userData *data= userData;
+	drawEMTFMapped_userData *data = userData;
 
-	if(data->mf && data->mf[cur_index].mat_nr != data->mf[next_index].mat_nr)
+	if (data->mf && data->mf[cur_index].mat_nr != data->mf[next_index].mat_nr)
 		return 0;
 
-	if(data->tf && data->tf[cur_index].tpage != data->tf[next_index].tpage)
+	if (data->tf && data->tf[cur_index].tpage != data->tf[next_index].tpage)
 		return 0;
 
 	return 1;
@@ -683,36 +772,37 @@ static int compareDrawOptionsEm(void *userData, int cur_index, int next_index)
 
 void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *dm, int draw_flags)
 {
-	Mesh *me= ob->data;
+	Mesh *me = ob->data;
 	
 	/* correct for negative scale */
-	if(ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW);
+	if (ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW);
 	else glFrontFace(GL_CCW);
 	
 	/* draw the textured mesh */
 	draw_textured_begin(scene, v3d, rv3d, ob);
 
-	glColor4f(1.0f,1.0f,1.0f,1.0f);
+	glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
 
-	if(ob->mode & OB_MODE_EDIT) {
+	if (ob->mode & OB_MODE_EDIT) {
 		drawEMTFMapped_userData data;
 
-		data.em= me->edit_mesh;
-		data.has_mcol= CustomData_has_layer(&me->edit_mesh->fdata, CD_MCOL);
-		data.has_mtface= CustomData_has_layer(&me->edit_mesh->fdata, CD_MTFACE);
-		data.mf= DM_get_face_data_layer(dm, CD_MFACE);
-		data.tf= DM_get_face_data_layer(dm, CD_MTFACE);
+		data.em = me->edit_btmesh;
+		data.has_mcol = CustomData_has_layer(&me->edit_btmesh->bm->ldata, CD_MLOOPCOL);
+		data.has_mtface = CustomData_has_layer(&me->edit_btmesh->bm->pdata, CD_MTEXPOLY);
+		data.mf = DM_get_tessface_data_layer(dm, CD_MFACE);
+		data.tf = DM_get_tessface_data_layer(dm, CD_MTFACE);
 
 		dm->drawMappedFacesTex(dm, draw_em_tf_mapped__set_draw, compareDrawOptionsEm, &data);
 	}
-	else if(draw_flags & DRAW_FACE_SELECT) {
-		if(ob->mode & OB_MODE_WEIGHT_PAINT)
-			dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions_facemask, GPU_enable_material, NULL, me, 1);
+	else if (draw_flags & DRAW_FACE_SELECT) {
+		if (ob->mode & OB_MODE_WEIGHT_PAINT)
+			dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions_facemask, GPU_enable_material, NULL, me,
+			                    DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
 		else
-			dm->drawMappedFacesTex(dm, me->mface ? draw_tface_mapped__set_draw : NULL, NULL, me);
+			dm->drawMappedFacesTex(dm, me->mpoly ? draw_tface_mapped__set_draw : NULL, NULL, me);
 	}
 	else {
-		if(GPU_buffer_legacy(dm)) {
+		if (GPU_buffer_legacy(dm)) {
 			if (draw_flags & DRAW_MODIFIERS_PREVIEW)
 				dm->drawFacesTex(dm, draw_mcol__set_draw_legacy, NULL, NULL);
 			else 
@@ -721,30 +811,30 @@ void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
 		else {
 			drawTFace_userData userData;
 
-			if(!CustomData_has_layer(&dm->faceData,CD_TEXTURE_MCOL))
+			if (!CustomData_has_layer(&dm->faceData, CD_TEXTURE_MCOL))
 				add_tface_color_layer(dm);
 
-			userData.mf = DM_get_face_data_layer(dm, CD_MFACE);
-			userData.tf = DM_get_face_data_layer(dm, CD_MTFACE);
+			userData.mf = DM_get_tessface_data_layer(dm, CD_MFACE);
+			userData.tf = DM_get_tessface_data_layer(dm, CD_MTFACE);
 
 			dm->drawFacesTex(dm, draw_tface__set_draw, compareDrawOptions, &userData);
 		}
 	}
 
 	/* draw game engine text hack */
-	if(get_ob_property(ob, "Text")) 
+	if (get_ob_property(ob, "Text"))
 		draw_mesh_text(scene, ob, 0);
 
 	draw_textured_end();
 	
 	/* draw edges and selected faces over textured mesh */
-	if(!(ob == scene->obedit) && (draw_flags & DRAW_FACE_SELECT))
+	if (!(ob == scene->obedit) && (draw_flags & DRAW_FACE_SELECT))
 		draw_mesh_face_select(rv3d, me, dm);
 
 	/* reset from negative scale correction */
 	glFrontFace(GL_CCW);
 	
-	/* in editmode, the blend mode needs to be set incase it was ADD */
+	/* in editmode, the blend mode needs to be set in case it was ADD */
 	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 }
 
@@ -760,31 +850,31 @@ typedef struct TexMatCallback {
 static void tex_mat_set_material_cb(void *UNUSED(userData), int mat_nr, void *attribs)
 {
 	/* all we have to do here is simply enable the GLSL material, but note
-	   that the GLSL code will give different result depending on the drawtype,
-	   in texture draw mode it will output the active texture node, in material
-	   draw mode it will show the full material. */
+	 * that the GLSL code will give different result depending on the drawtype,
+	 * in texture draw mode it will output the active texture node, in material
+	 * draw mode it will show the full material. */
 	GPU_enable_material(mat_nr, attribs);
 }
 
 static void tex_mat_set_texture_cb(void *userData, int mat_nr, void *attribs)
 {
 	/* texture draw mode without GLSL */
-	TexMatCallback *data= (TexMatCallback*)userData;
+	TexMatCallback *data = (TexMatCallback *)userData;
 	GPUVertexAttribs *gattribs = attribs;
 	Image *ima;
 	ImageUser *iuser;
 	bNode *node;
-	int texture_set= 0;
+	int texture_set = 0;
 
 	/* draw image texture if we find one */
-	if(ED_object_get_active_image(data->ob, mat_nr, &ima, &iuser, &node)) {
+	if (ED_object_get_active_image(data->ob, mat_nr, &ima, &iuser, &node)) {
 		/* get openl texture */
-		int mipmap= 1;
-		int bindcode= (ima)? GPU_verify_image(ima, iuser, 0, 0, mipmap): 0;
+		int mipmap = 1;
+		int bindcode = (ima) ? GPU_verify_image(ima, iuser, 0, 0, mipmap) : 0;
 		float zero[4] = {0.0f, 0.0f, 0.0f, 0.0f};
 
-		if(bindcode) {
-			NodeTexBase *texbase= node->storage;
+		if (bindcode) {
+			NodeTexBase *texbase = node->storage;
 
 			/* disable existing material */
 			GPU_disable_material();
@@ -793,6 +883,7 @@ static void tex_mat_set_texture_cb(void *userData, int mat_nr, void *attribs)
 			glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, 0);
 
 			/* bind texture */
+			glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
 			glEnable(GL_COLOR_MATERIAL);
 			glEnable(GL_TEXTURE_2D);
 
@@ -806,16 +897,16 @@ static void tex_mat_set_texture_cb(void *userData, int mat_nr, void *attribs)
 			/* use active UV texture layer */
 			memset(gattribs, 0, sizeof(*gattribs));
 
-			gattribs->layer[0].type= CD_MTFACE;
-			gattribs->layer[0].name[0]= '\0';
-			gattribs->layer[0].gltexco= 1;
-			gattribs->totlayer= 1;
+			gattribs->layer[0].type = CD_MTFACE;
+			gattribs->layer[0].name[0] = '\0';
+			gattribs->layer[0].gltexco = 1;
+			gattribs->totlayer = 1;
 
-			texture_set= 1;
+			texture_set = 1;
 		}
 	}
 
-	if(!texture_set) {
+	if (!texture_set) {
 		glMatrixMode(GL_TEXTURE);
 		glLoadIdentity();
 		glMatrixMode(GL_MODELVIEW);
@@ -832,65 +923,65 @@ static void tex_mat_set_texture_cb(void *userData, int mat_nr, void *attribs)
 static int tex_mat_set_face_mesh_cb(void *userData, int index)
 {
 	/* faceselect mode face hiding */
-	TexMatCallback *data= (TexMatCallback*)userData;
-	Mesh *me = (Mesh*)data->me;
-	MFace *mface = &me->mface[index];
+	TexMatCallback *data = (TexMatCallback *)userData;
+	Mesh *me = (Mesh *)data->me;
+	MPoly *mp = &me->mpoly[index];
 
-	return !(mface->flag & ME_HIDE);
+	return !(mp->flag & ME_HIDE);
 }
 
-static int tex_mat_set_face_editmesh_cb(void *UNUSED(userData), int index)
+static int tex_mat_set_face_editmesh_cb(void *userData, int index)
 {
 	/* editmode face hiding */
-	EditFace *efa= EM_get_face_for_index(index);
+	TexMatCallback *data = (TexMatCallback *)userData;
+	Mesh *me = (Mesh *)data->me;
+	BMFace *efa = EDBM_face_at_index(me->edit_btmesh, index);
 
-	return !(efa->h);
+	return !BM_elem_flag_test(efa, BM_ELEM_HIDDEN);
 }
 
 void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *dm, int draw_flags)
 {
-	if((!scene_use_new_shading_nodes(scene)) || (draw_flags & DRAW_MODIFIERS_PREVIEW)) {
+	if ((!scene_use_new_shading_nodes(scene)) || (draw_flags & DRAW_MODIFIERS_PREVIEW)) {
 		draw_mesh_textured_old(scene, v3d, rv3d, ob, dm, draw_flags);
 		return;
 	}
 
 	/* set opengl state for negative scale & color */
-	if(ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW);
+	if (ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW);
 	else glFrontFace(GL_CCW);
 
 	glEnable(GL_LIGHTING);
 
-	if(ob->mode & OB_MODE_WEIGHT_PAINT) {
+	if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)) {
 		/* weight paint mode exception */
-		int useColors= 1;
-
 		dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions_material,
-			GPU_enable_material, NULL, ob->data, useColors);
+		                    GPU_enable_material, NULL, ob->data, DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
 	}
 	else {
-		Mesh *me= ob->data;
+		Mesh *me = ob->data;
 		TexMatCallback data = {scene, ob, me, dm};
-		int (*set_face_cb)(void*, int);
+		int (*set_face_cb)(void *, int);
 		int glsl;
 		
 		/* face hiding callback depending on mode */
-		if(ob == scene->obedit)
-			set_face_cb= tex_mat_set_face_editmesh_cb;
-		else if(draw_flags & DRAW_FACE_SELECT)
-			set_face_cb= tex_mat_set_face_mesh_cb;
+		if (ob == scene->obedit)
+			set_face_cb = tex_mat_set_face_editmesh_cb;
+		else if (draw_flags & DRAW_FACE_SELECT)
+			set_face_cb = tex_mat_set_face_mesh_cb;
 		else
-			set_face_cb= NULL;
+			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();
 
 		GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, NULL);
 
-		if(glsl) {
+		if (glsl) {
 			/* draw glsl */
 			dm->drawMappedFacesMat(dm,
-				tex_mat_set_material_cb,
-				set_face_cb, &data);
+			                       tex_mat_set_material_cb,
+			                       set_face_cb, &data);
 		}
 		else {
 			float zero[4] = {0.0f, 0.0f, 0.0f, 0.0f};
@@ -901,8 +992,8 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o
 			glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, 0);
 
 			dm->drawMappedFacesMat(dm,
-				tex_mat_set_texture_cb,
-				set_face_cb, &data);
+			                       tex_mat_set_texture_cb,
+			                       set_face_cb, &data);
 		}
 
 		GPU_end_object_materials();
@@ -920,7 +1011,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o
 	glMatrixMode(GL_MODELVIEW);
 
 	/* faceselect mode drawing over textured mesh */
-	if(!(ob == scene->obedit) && (draw_flags & DRAW_FACE_SELECT))
+	if (!(ob == scene->obedit) && (draw_flags & DRAW_FACE_SELECT))
 		draw_mesh_face_select(rv3d, ob->data, dm);
 }
 
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index e12efb7..4508dae 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -39,6 +39,7 @@
 #include "DNA_lamp_types.h"
 #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"
@@ -47,14 +48,15 @@
 #include "DNA_world_types.h"
 #include "DNA_armature_types.h"
 
+#include "BLI_utildefines.h"
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
-#include "BLI_editVert.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_anim.h"  //for the where_on_path function
+#include "BKE_armature.h"
 #include "BKE_camera.h"
 #include "BKE_constraint.h" // for the get_constraint_target function
 #include "BKE_curve.h"
@@ -79,6 +81,8 @@
 #include "BKE_movieclip.h"
 #include "BKE_tracking.h"
 
+#include "BKE_tessmesh.h"
+
 #include "smoke_API.h"
 
 #include "IMB_imbuf.h"
@@ -103,58 +107,62 @@
 #include "wm_subwindow.h"
 #include "BLF_api.h"
 
-#include "view3d_intern.h"	// own include
-
-
-/* this condition has been made more complex since editmode can draw textures */
-#define CHECK_OB_DRAWTEXTURE(vd, dt)                                          \
-	((ELEM(vd->drawtype, OB_TEXTURE, OB_MATERIAL) && dt>OB_SOLID) ||          \
-	(vd->drawtype==OB_SOLID && vd->flag2 & V3D_SOLID_TEX))
+#include "view3d_intern.h"  // own include
 
 typedef enum eWireDrawMode {
-	OBDRAW_WIRE_OFF= 0,
-	OBDRAW_WIRE_ON= 1,
-	OBDRAW_WIRE_ON_DEPTH= 2
+	OBDRAW_WIRE_OFF = 0,
+	OBDRAW_WIRE_ON = 1,
+	OBDRAW_WIRE_ON_DEPTH = 2
 } eWireDrawMode;
 
 /* user data structures for derived mesh callbacks */
 typedef struct foreachScreenVert_userData {
-	void (*func)(void *userData, EditVert *eve, int x, int y, int index);
+	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, EditEdge *eed, int x0, int y0, int x1, int y1, int index);
+	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, EditFace *efa, int x, int y, int index);
+	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 */
+
 	int sel;
-	EditVert *eve_act;
+	BMVert *eve_act;
 } drawDMVerts_userData;
 
 typedef struct drawDMEdgesSel_userData {
+	BMEditMesh *em; /* BMESH BRANCH ONLY */
+
 	unsigned char *baseCol, *selCol, *actCol;
-	EditEdge *eed_act;
+	BMEdge *eed_act;
 } drawDMEdgesSel_userData;
 
 typedef struct drawDMFacesSel_userData {
 	unsigned char *cols[3];
-	EditFace *efa_act;
+
+	DerivedMesh *dm; /* BMESH BRANCH ONLY */
+	BMEditMesh *em;  /* BMESH BRANCH ONLY */
+
+	BMFace *efa_act;
 	int *orig_index;
 } drawDMFacesSel_userData;
 
 typedef struct drawDMNormal_userData {
+	BMEditMesh *em;
 	float normalsize;
 } drawDMNormal_userData;
 
@@ -170,22 +178,36 @@ static void drawcircle_size(float size);
 static void draw_empty_sphere(float size);
 static void draw_empty_cone(float size);
 
+/* this condition has been made more complex since editmode can draw textures */
+static int check_object_draw_texture(Scene *scene, View3D *v3d, int drawtype)
+{
+	/* texture and material draw modes */
+	if (ELEM(v3d->drawtype, OB_TEXTURE, OB_MATERIAL) && drawtype > OB_SOLID)
+		return TRUE;
+
+	/* textured solid */
+	if (v3d->drawtype == OB_SOLID && (v3d->flag2 & V3D_SOLID_TEX) && !scene_use_new_shading_nodes(scene))
+		return TRUE;
+	
+	return FALSE;
+}
+
 static int check_ob_drawface_dot(Scene *sce, View3D *vd, char dt)
 {
-	if((sce->toolsettings->selectmode & SCE_SELECT_FACE) == 0)
+	if ((sce->toolsettings->selectmode & SCE_SELECT_FACE) == 0)
 		return 0;
 
-	if(G.f & G_BACKBUFSEL)
+	if (G.f & G_BACKBUFSEL)
 		return 0;
 
-	if((vd->flag & V3D_ZBUF_SELECT) == 0)
+	if ((vd->flag & V3D_ZBUF_SELECT) == 0)
 		return 1;
 
-	/* if its drawing textures with zbuf sel, then dont draw dots */
-	if(dt==OB_TEXTURE && vd->drawtype==OB_TEXTURE)
+	/* if its drawing textures with zbuf sel, then don't draw dots */
+	if (dt == OB_TEXTURE && vd->drawtype == OB_TEXTURE)
 		return 0;
 
-	if(vd->drawtype>=OB_SOLID && vd->flag2 & V3D_SOLID_TEX)
+	if ((vd->drawtype >= OB_SOLID) && (vd->flag2 & V3D_SOLID_TEX))
 		return 0;
 
 	return 1;
@@ -194,98 +216,100 @@ static int check_ob_drawface_dot(Scene *sce, View3D *vd, char dt)
 /* ************* only use while object drawing **************
  * or after running ED_view3d_init_mats_rv3d
  * */
-static void view3d_project_short_clip(ARegion *ar, const float vec[3], short adr[2], int local)
+static void view3d_project_short_clip(ARegion *ar, const float vec[3], short adr[2], int is_local)
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 	float fx, fy, vec4[4];
 	
-	adr[0]= IS_CLIPPED;
+	adr[0] = IS_CLIPPED;
 	
 	/* clipplanes in eye space */
-	if(rv3d->rflag & RV3D_CLIPPING) {
-		if(ED_view3d_test_clipping(rv3d, vec, local))
+	if (rv3d->rflag & RV3D_CLIPPING) {
+		if (ED_view3d_clipping_test(rv3d, vec, is_local))
 			return;
 	}
 	
 	copy_v3_v3(vec4, vec);
-	vec4[3]= 1.0;
+	vec4[3] = 1.0;
 	
 	mul_m4_v4(rv3d->persmatob, vec4);
 	
 	/* clipplanes in window space */
-	if( vec4[3] > (float)BL_NEAR_CLIP ) {	/* is the NEAR clipping cutoff for picking */
-		fx= (ar->winx/2)*(1 + vec4[0]/vec4[3]);
+	if (vec4[3] > (float)BL_NEAR_CLIP) {    /* is the NEAR clipping cutoff for picking */
+		fx = (ar->winx / 2) * (1 + vec4[0] / vec4[3]);
 		
-		if( fx>0 && fx<ar->winx) {
+		if (fx > 0 && fx < ar->winx) {
 			
-			fy= (ar->winy/2)*(1 + vec4[1]/vec4[3]);
+			fy = (ar->winy / 2) * (1 + vec4[1] / vec4[3]);
 			
-			if(fy > 0.0f && fy < (float)ar->winy) {
-				adr[0]= (short)floorf(fx);
-				adr[1]= (short)floorf(fy);
+			if (fy > 0.0f && fy < (float)ar->winy) {
+				adr[0] = (short)floorf(fx);
+				adr[1] = (short)floorf(fy);
 			}
 		}
 	}
 }
 
+/* BMESH NOTE: this function is unused in bmesh only */
+
 /* only use while object drawing */
-static void view3d_project_short_noclip(ARegion *ar, const float vec[3], short adr[2])
+static void UNUSED_FUNCTION(view3d_project_short_noclip) (ARegion * ar, const float vec[3], short adr[2])
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 	float fx, fy, vec4[4];
 	
-	adr[0]= IS_CLIPPED;
+	adr[0] = IS_CLIPPED;
 	
 	copy_v3_v3(vec4, vec);
-	vec4[3]= 1.0;
+	vec4[3] = 1.0;
 	
 	mul_m4_v4(rv3d->persmatob, vec4);
 	
-	if( vec4[3] > (float)BL_NEAR_CLIP ) {	/* is the NEAR clipping cutoff for picking */
-		fx= (ar->winx/2)*(1 + vec4[0]/vec4[3]);
+	if (vec4[3] > (float)BL_NEAR_CLIP) {    /* is the NEAR clipping cutoff for picking */
+		fx = (ar->winx / 2) * (1 + vec4[0] / vec4[3]);
 		
-		if( fx>-32700 && fx<32700) {
+		if (fx > -32700 && fx < 32700) {
 			
-			fy= (ar->winy/2)*(1 + vec4[1]/vec4[3]);
+			fy = (ar->winy / 2) * (1 + vec4[1] / vec4[3]);
 			
-			if(fy > -32700.0f && fy < 32700.0f) {
-				adr[0]= (short)floorf(fx);
-				adr[1]= (short)floorf(fy);
+			if (fy > -32700.0f && fy < 32700.0f) {
+				adr[0] = (short)floorf(fx);
+				adr[1] = (short)floorf(fy);
 			}
 		}
 	}
 }
 
 /* same as view3d_project_short_clip but use persmat instead of persmatob for projection */
-static void view3d_project_short_clip_persmat(ARegion *ar, float *vec, short adr[2], int local)
+static void view3d_project_short_clip_persmat(ARegion *ar, const float vec[3], short adr[2], int is_local)
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 	float fx, fy, vec4[4];
 
-	adr[0]= IS_CLIPPED;
+	adr[0] = IS_CLIPPED;
 
 	/* clipplanes in eye space */
-	if(rv3d->rflag & RV3D_CLIPPING) {
-		if(ED_view3d_test_clipping(rv3d, vec, local))
+	if (rv3d->rflag & RV3D_CLIPPING) {
+		if (ED_view3d_clipping_test(rv3d, vec, is_local))
 			return;
 	}
 
 	copy_v3_v3(vec4, vec);
-	vec4[3]= 1.0;
+	vec4[3] = 1.0;
 
 	mul_m4_v4(rv3d->persmat, vec4);
 
 	/* clipplanes in window space */
-	if( vec4[3] > (float)BL_NEAR_CLIP ) {	/* is the NEAR clipping cutoff for picking */
-		fx= (ar->winx/2)*(1 + vec4[0]/vec4[3]);
+	if (vec4[3] > (float)BL_NEAR_CLIP) {    /* is the NEAR clipping cutoff for picking */
+		fx = (ar->winx / 2) * (1 + vec4[0] / vec4[3]);
 
-		if( fx>0 && fx<ar->winx) {
+		if (fx > 0 && fx < ar->winx) {
 
-			fy= (ar->winy/2)*(1 + vec4[1]/vec4[3]);
+			fy = (ar->winy / 2) * (1 + vec4[1] / vec4[3]);
 
-			if(fy > 0.0f && fy < (float)ar->winy) {
-				adr[0]= (short)floorf(fx);
-				adr[1]= (short)floorf(fy);
+			if (fy > 0.0f && fy < (float)ar->winy) {
+				adr[0] = (short)floorf(fx);
+				adr[1] = (short)floorf(fy);
 			}
 		}
 	}
@@ -296,15 +320,15 @@ static void view3d_project_short_clip_persmat(ARegion *ar, float *vec, short adr
 
 int draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, int dt)
 {
-	if(!GPU_glsl_support())
+	if (!GPU_glsl_support())
 		return 0;
-	if(G.f & G_PICKSEL)
+	if (G.f & G_PICKSEL)
 		return 0;
-	if(!CHECK_OB_DRAWTEXTURE(v3d, dt))
+	if (!check_object_draw_texture(scene, v3d, dt))
 		return 0;
-	if(ob==OBACT && (ob && ob->mode & OB_MODE_WEIGHT_PAINT))
+	if (ob == OBACT && (ob && ob->mode & OB_MODE_WEIGHT_PAINT))
 		return 0;
-	if(scene_use_new_shading_nodes(scene))
+	if (scene_use_new_shading_nodes(scene))
 		return 0;
 	
 	return (scene->gm.matmode == GAME_MAT_GLSL) && (dt > OB_SOLID);
@@ -312,23 +336,22 @@ int draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, int dt)
 
 static int check_alpha_pass(Base *base)
 {
-	if(base->flag & OB_FROMDUPLI)
+	if (base->flag & OB_FROMDUPLI)
 		return 0;
 
-	if(G.f & G_PICKSEL)
+	if (G.f & G_PICKSEL)
 		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] = {
@@ -342,7 +365,7 @@ static float cube[8][3] = {
 	{ 1.0,  1.0, -1.0},
 };
 
-/* ----------------- OpenGL Circle Drawing - Tables for Optimised Drawing Speed ------------------ */
+/* ----------------- OpenGL Circle Drawing - Tables for Optimized Drawing Speed ------------------ */
 /* 32 values of sin function (still same result!) */
 #define CIRCLE_RESOL 32
 
@@ -419,16 +442,16 @@ static const float cosval[CIRCLE_RESOL] = {
 
 static void draw_xyz_wire(const float c[3], float size, int axis)
 {
-	float v1[3]= {0.f, 0.f, 0.f}, v2[3] = {0.f, 0.f, 0.f};
+	float v1[3] = {0.f, 0.f, 0.f}, v2[3] = {0.f, 0.f, 0.f};
 	float dim = size * 0.1f;
 	float dx[3], dy[3], dz[3];
 
-	dx[0]=dim; dx[1]=0.f; dx[2]=0.f;
-	dy[0]=0.f; dy[1]=dim; dy[2]=0.f;
-	dz[0]=0.f; dz[1]=0.f; dz[2]=dim;
+	dx[0] = dim; dx[1] = 0.f; dx[2] = 0.f;
+	dy[0] = 0.f; dy[1] = dim; dy[2] = 0.f;
+	dz[0] = 0.f; dz[1] = 0.f; dz[2] = dim;
 
-	switch(axis) {
-		case 0:		/* x axis */
+	switch (axis) {
+		case 0:     /* x axis */
 			glBegin(GL_LINES);
 			
 			/* bottom left to top right */
@@ -450,7 +473,7 @@ static void draw_xyz_wire(const float c[3], float size, int axis)
 			
 			glEnd();
 			break;
-		case 1:		/* y axis */
+		case 1:     /* y axis */
 			glBegin(GL_LINES);
 			
 			/* bottom left to top right */
@@ -473,7 +496,7 @@ static void draw_xyz_wire(const float c[3], float size, int axis)
 			
 			glEnd();
 			break;
-		case 2:		/* z axis */
+		case 2:     /* z axis */
 			glBegin(GL_LINE_STRIP);
 			
 			/* start at top left */
@@ -506,107 +529,110 @@ static void draw_xyz_wire(const float c[3], float size, int axis)
 void drawaxes(float size, char drawtype)
 {
 	int axis;
-	float v1[3]= {0.0, 0.0, 0.0};
-	float v2[3]= {0.0, 0.0, 0.0};
-	float v3[3]= {0.0, 0.0, 0.0};
-	
-	switch(drawtype) {
+	float v1[3] = {0.0, 0.0, 0.0};
+	float v2[3] = {0.0, 0.0, 0.0};
+	float v3[3] = {0.0, 0.0, 0.0};
 	
-	case OB_PLAINAXES:
-		for (axis=0; axis<3; axis++) {
+	switch (drawtype) {
+
+		case OB_PLAINAXES:
+			for (axis = 0; axis < 3; axis++) {
+				glBegin(GL_LINES);
+
+				v1[axis] = size;
+				v2[axis] = -size;
+				glVertex3fv(v1);
+				glVertex3fv(v2);
+
+				/* reset v1 & v2 to zero */
+				v1[axis] = v2[axis] = 0.0f;
+
+				glEnd();
+			}
+			break;
+		case OB_SINGLE_ARROW:
+
 			glBegin(GL_LINES);
-			
-			v1[axis]= size;
-			v2[axis]= -size;
+			/* in positive z direction only */
+			v1[2] = size;
 			glVertex3fv(v1);
 			glVertex3fv(v2);
+			glEnd();
 
-			/* reset v1 & v2 to zero */
-			v1[axis]= v2[axis]= 0.0f;
+			/* square pyramid */
+			glBegin(GL_TRIANGLES);
+
+			v2[0] = size * 0.035f; v2[1] = size * 0.035f;
+			v3[0] = size * -0.035f; v3[1] = size * 0.035f;
+			v2[2] = v3[2] = size * 0.75f;
+
+			for (axis = 0; axis < 4; axis++) {
+				if (axis % 2 == 1) {
+					v2[0] = -v2[0];
+					v3[1] = -v3[1];
+				}
+				else {
+					v2[1] = -v2[1];
+					v3[0] = -v3[0];
+				}
+
+				glVertex3fv(v1);
+				glVertex3fv(v2);
+				glVertex3fv(v3);
 
-			glEnd();
-		}
-		break;
-	case OB_SINGLE_ARROW:
-	
-		glBegin(GL_LINES);
-		/* in positive z direction only */
-		v1[2]= size;
-		glVertex3fv(v1);
-		glVertex3fv(v2);
-		glEnd();
-		
-		/* square pyramid */
-		glBegin(GL_TRIANGLES);
-		
-		v2[0]= size * 0.035f; v2[1] = size * 0.035f;
-		v3[0]= size * -0.035f; v3[1] = size * 0.035f;
-		v2[2]= v3[2]= size * 0.75f;
-		
-		for (axis=0; axis<4; axis++) {
-			if (axis % 2 == 1) {
-				v2[0] = -v2[0];
-				v3[1] = -v3[1];
-			} else {
-				v2[1] = -v2[1];
-				v3[0] = -v3[0];
 			}
-			
-			glVertex3fv(v1);
-			glVertex3fv(v2);
-			glVertex3fv(v3);
-			
-		}
-		glEnd();
-		
-		break;
-	case OB_CUBE:
-		drawcube_size(size);
-		break;
-		
-	case OB_CIRCLE:
-		drawcircle_size(size);
-		break;
-	
-	case OB_EMPTY_SPHERE:
-		draw_empty_sphere(size);
-		break;
+			glEnd();
+
+			break;
+		case OB_CUBE:
+			drawcube_size(size);
+			break;
 
-	case OB_EMPTY_CONE:
-		draw_empty_cone(size);
-		break;
+		case OB_CIRCLE:
+			drawcircle_size(size);
+			break;
 
-	case OB_ARROWS:
-	default:
-		for (axis=0; axis<3; axis++) {
-			const int arrow_axis= (axis==0) ? 1:0;
+		case OB_EMPTY_SPHERE:
+			draw_empty_sphere(size);
+			break;
 
-			glBegin(GL_LINES);
-			
-			v2[axis]= size;
-			glVertex3fv(v1);
-			glVertex3fv(v2);
+		case OB_EMPTY_CONE:
+			draw_empty_cone(size);
+			break;
+
+		case OB_ARROWS:
+		default:
+		{
+			for (axis = 0; axis < 3; axis++) {
+				const int arrow_axis = (axis == 0) ? 1 : 0;
+
+				glBegin(GL_LINES);
+
+				v2[axis] = size;
+				glVertex3fv(v1);
+				glVertex3fv(v2);
 				
-			v1[axis]= size*0.85f;
-			v1[arrow_axis]= -size*0.08f;
-			glVertex3fv(v1);
-			glVertex3fv(v2);
+				v1[axis] = size * 0.85f;
+				v1[arrow_axis] = -size * 0.08f;
+				glVertex3fv(v1);
+				glVertex3fv(v2);
 				
-			v1[arrow_axis]= size*0.08f;
-			glVertex3fv(v1);
-			glVertex3fv(v2);
-			
-			glEnd();
+				v1[arrow_axis] = size * 0.08f;
+				glVertex3fv(v1);
+				glVertex3fv(v2);
+
+				glEnd();
 				
-			v2[axis]+= size*0.125f;
-			
-			draw_xyz_wire(v2, size, axis);
-			
-			
-			/* reset v1 & v2 to zero */
-			v1[arrow_axis]= v1[axis]= v2[axis]= 0.0f;
+				v2[axis] += size * 0.125f;
+
+				draw_xyz_wire(v2, size, axis);
+
+
+				/* reset v1 & v2 to zero */
+				v1[arrow_axis] = v1[axis] = v2[axis] = 0.0f;
+			}
+			break;
 		}
-		break;
 	}
 }
 
@@ -614,49 +640,49 @@ void drawaxes(float size, char drawtype)
 /* Function to draw an Image on a empty Object */
 static void draw_empty_image(Object *ob)
 {
-	Image *ima = (Image*)ob->data;
+	Image *ima = (Image *)ob->data;
 	ImBuf *ibuf = ima ? BKE_image_get_ibuf(ima, NULL) : NULL;
 
 	float scale, ofs_x, ofs_y, sca_x, sca_y;
 	int ima_x, ima_y;
 
-	if(ibuf && (ibuf->rect == NULL) && (ibuf->rect_float != NULL)) {
+	if (ibuf && (ibuf->rect == NULL) && (ibuf->rect_float != NULL)) {
 		IMB_rect_from_float(ibuf);
 	}
 
 	/* Get the buffer dimensions so we can fallback to fake ones */
-	if(ibuf && ibuf->rect) {
-		ima_x= ibuf->x;
-		ima_y= ibuf->y;
+	if (ibuf && ibuf->rect) {
+		ima_x = ibuf->x;
+		ima_y = ibuf->y;
 	}
 	else {
-		ima_x= 1;
-		ima_y= 1;
+		ima_x = 1;
+		ima_y = 1;
 	}
 
 	/* Get the image aspect even if the buffer is invalid */
-	if(ima) {
-		if(ima->aspx > ima->aspy) {
-			sca_x= 1.0f;
-			sca_y= ima->aspy / ima->aspx;
+	if (ima) {
+		if (ima->aspx > ima->aspy) {
+			sca_x = 1.0f;
+			sca_y = ima->aspy / ima->aspx;
 		}
-		else if(ima->aspx < ima->aspy) {
-			sca_x= ima->aspx / ima->aspy;
-			sca_y= 1.0f;
+		else if (ima->aspx < ima->aspy) {
+			sca_x = ima->aspx / ima->aspy;
+			sca_y = 1.0f;
 		}
 		else {
-			sca_x= 1.0f;
-			sca_y= 1.0f;
+			sca_x = 1.0f;
+			sca_y = 1.0f;
 		}
 	}
 	else {
-		sca_x= 1.0f;
-		sca_y= 1.0f;
+		sca_x = 1.0f;
+		sca_y = 1.0f;
 	}
 
 	/* Calculate the scale center based on objects origin */
-	ofs_x= ob->ima_ofs[0] * ima_x;
-	ofs_y= ob->ima_ofs[1] * ima_y;
+	ofs_x = ob->ima_ofs[0] * ima_x;
+	ofs_y = ob->ima_ofs[1] * ima_y;
 
 	glMatrixMode(GL_MODELVIEW);
 	glPushMatrix();
@@ -665,12 +691,12 @@ static void draw_empty_image(Object *ob)
 	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 / (float)MAX2(ima_x * sca_x, ima_y * sca_y));
 
 	/* Set the object scale */
 	glScalef(scale * sca_x, scale * sca_y, 1.0f);
 
-	if(ibuf && ibuf->rect) {
+	if (ibuf && ibuf->rect) {
 		/* Setup GL params */
 		glEnable(GL_BLEND);
 		glBlendFunc(GL_SRC_ALPHA,  GL_ONE_MINUS_SRC_ALPHA);
@@ -703,16 +729,16 @@ static void draw_empty_image(Object *ob)
 static void circball_array_fill(float verts[CIRCLE_RESOL][3], const float cent[3], float rad, float tmat[][4])
 {
 	float vx[3], vy[3];
-	float *viter= (float *)verts;
+	float *viter = (float *)verts;
 	unsigned int a;
 
 	mul_v3_v3fl(vx, tmat[0], rad);
 	mul_v3_v3fl(vy, tmat[1], rad);
 
-	for (a=0; a < CIRCLE_RESOL; a++, viter += 3) {
-		viter[0]= cent[0] + sinval[a] * vx[0] + cosval[a] * vy[0];
-		viter[1]= cent[1] + sinval[a] * vx[1] + cosval[a] * vy[1];
-		viter[2]= cent[2] + sinval[a] * vx[2] + cosval[a] * vy[2];
+	for (a = 0; a < CIRCLE_RESOL; a++, viter += 3) {
+		viter[0] = cent[0] + sinval[a] * vx[0] + cosval[a] * vy[0];
+		viter[1] = cent[1] + sinval[a] * vx[1] + cosval[a] * vy[1];
+		viter[2] = cent[2] + sinval[a] * vx[2] + cosval[a] * vy[2];
 	}
 }
 
@@ -731,16 +757,16 @@ void drawcircball(int mode, const float cent[3], float rad, float tmat[][4])
 /* circle for object centers, special_color is for library or ob users */
 static void drawcentercircle(View3D *v3d, RegionView3D *rv3d, const float co[3], int selstate, int special_color)
 {
-	const float size= ED_view3d_pixel_size(rv3d, co) * (float)U.obcenter_dia * 0.5f;
+	const float size = ED_view3d_pixel_size(rv3d, co) * (float)U.obcenter_dia * 0.5f;
 	float verts[CIRCLE_RESOL][3];
 
 	/* using gldepthfunc guarantees that it does write z values,
-	 * but not checks for it, so centers remain visible independt order of drawing */
-	if(v3d->zbuf)  glDepthFunc(GL_ALWAYS);
+	 * but not checks for it, so centers remain visible independent order of drawing */
+	if (v3d->zbuf) glDepthFunc(GL_ALWAYS);
 	glEnable(GL_BLEND);
 	
-	if(special_color) {
-		if (selstate==ACTIVE || selstate==SELECT) glColor4ub(0x88, 0xFF, 0xFF, 155);
+	if (special_color) {
+		if (selstate == ACTIVE || selstate == SELECT) glColor4ub(0x88, 0xFF, 0xFF, 155);
 
 		else glColor4ub(0x55, 0xCC, 0xCC, 155);
 	}
@@ -763,17 +789,17 @@ static void drawcentercircle(View3D *v3d, RegionView3D *rv3d, const float co[3],
 	UI_ThemeColorShadeAlpha(TH_WIRE, 0, -30);
 	glDrawArrays(GL_LINE_LOOP, 0, CIRCLE_RESOL);
 
-	/* finishe up */
+	/* finish up */
 	glDisableClientState(GL_VERTEX_ARRAY);
 
 	glDisable(GL_BLEND);
 
-	if(v3d->zbuf)  glDepthFunc(GL_LEQUAL);
+	if (v3d->zbuf) glDepthFunc(GL_LEQUAL);
 }
 
 /* *********** text drawing for object/particles/armature ************* */
 static ListBase CachedText[3];
-static int CachedTextLevel= 0;
+static int CachedTextLevel = 0;
 
 typedef struct ViewCachedString {
 	struct ViewCachedString *next, *prev;
@@ -791,8 +817,8 @@ typedef struct ViewCachedString {
 
 void view3d_cached_text_draw_begin(void)
 {
-	ListBase *strings= &CachedText[CachedTextLevel];
-	strings->first= strings->last= NULL;
+	ListBase *strings = &CachedText[CachedTextLevel];
+	strings->first = strings->last = NULL;
 	CachedTextLevel++;
 }
 
@@ -801,17 +827,17 @@ void view3d_cached_text_draw_add(const float co[3],
                                  short xoffs, short flag,
                                  const unsigned char col[4])
 {
-	int alloc_len= strlen(str) + 1;
-	ListBase *strings= &CachedText[CachedTextLevel-1];
+	int alloc_len = strlen(str) + 1;
+	ListBase *strings = &CachedText[CachedTextLevel - 1];
 	/* TODO, replace with more efficient malloc, perhaps memarena per draw? */
-	ViewCachedString *vos= MEM_callocN(sizeof(ViewCachedString) + alloc_len, "ViewCachedString");
+	ViewCachedString *vos = MEM_callocN(sizeof(ViewCachedString) + alloc_len, "ViewCachedString");
 
 	BLI_addtail(strings, vos);
 	copy_v3_v3(vos->vec, co);
-	vos->col.pack= *((int *)col);
-	vos->xoffs= xoffs;
-	vos->flag= flag;
-	vos->str_len= alloc_len-1;
+	vos->col.pack = *((int *)col);
+	vos->xoffs = xoffs;
+	vos->flag = flag;
+	vos->str_len = alloc_len - 1;
 
 	/* allocate past the end */
 	memcpy(++vos, str, alloc_len);
@@ -819,83 +845,86 @@ void view3d_cached_text_draw_add(const float co[3],
 
 void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, float mat[][4])
 {
-	RegionView3D *rv3d= ar->regiondata;
-	ListBase *strings= &CachedText[CachedTextLevel-1];
+	RegionView3D *rv3d = ar->regiondata;
+	ListBase *strings = &CachedText[CachedTextLevel - 1];
 	ViewCachedString *vos;
-	int a, tot= 0;
+	int tot = 0;
 	
 	/* project first and test */
-	for(vos= strings->first; vos; vos= vos->next) {
-		if(mat && !(vos->flag & V3D_CACHE_TEXT_WORLDSPACE))
+	for (vos = strings->first; vos; vos = vos->next) {
+		if (mat && !(vos->flag & V3D_CACHE_TEXT_WORLDSPACE))
 			mul_m4_v3(mat, vos->vec);
 
-		if(vos->flag&V3D_CACHE_TEXT_GLOBALSPACE)
-			view3d_project_short_clip_persmat(ar, vos->vec, vos->sco, 0);
+		if (vos->flag & V3D_CACHE_TEXT_GLOBALSPACE)
+			view3d_project_short_clip_persmat(ar, vos->vec, vos->sco, (vos->flag & V3D_CACHE_TEXT_LOCALCLIP) != 0);
 		else
-			view3d_project_short_clip(ar, vos->vec, vos->sco, 0);
+			view3d_project_short_clip(ar, vos->vec, vos->sco, (vos->flag & V3D_CACHE_TEXT_LOCALCLIP) != 0);
 
-		if(vos->sco[0]!=IS_CLIPPED)
+		if (vos->sco[0] != IS_CLIPPED)
 			tot++;
 	}
 
-	if(tot) {
-		int col_pack_prev= 0;
+	if (tot) {
+		int col_pack_prev = 0;
 
 #if 0
 		bglMats mats; /* ZBuffer depth vars */
 		double ux, uy, uz;
 		float depth;
 
-		if(v3d->zbuf)
+		if (v3d->zbuf)
 			bgl_get_mats(&mats);
 #endif
-		if(rv3d->rflag & RV3D_CLIPPING)
-			for(a=0; a<6; a++)
-				glDisable(GL_CLIP_PLANE0+a);
-		
+		if (rv3d->rflag & RV3D_CLIPPING) {
+			ED_view3d_clipping_disable();
+		}
+
 		glMatrixMode(GL_PROJECTION);
 		glPushMatrix();
 		glMatrixMode(GL_MODELVIEW);
 		glPushMatrix();
 		ED_region_pixelspace(ar);
 		
-		if(depth_write) {
-			if(v3d->zbuf) glDisable(GL_DEPTH_TEST);
+		if (depth_write) {
+			if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
+		}
+		else {
+			glDepthMask(0);
 		}
-		else glDepthMask(0);
 		
-		for(vos= strings->first; vos; vos= vos->next) {
+		for (vos = strings->first; vos; vos = vos->next) {
 			/* too slow, reading opengl info while drawing is very bad,
 			 * better to see if we can use the zbuffer while in pixel space - campbell */
 #if 0
-			if(v3d->zbuf && (vos->flag & V3D_CACHE_TEXT_ZBUF)) {
+			if (v3d->zbuf && (vos->flag & V3D_CACHE_TEXT_ZBUF)) {
 				gluProject(vos->vec[0], vos->vec[1], vos->vec[2], mats.modelview, mats.projection, (GLint *)mats.viewport, &ux, &uy, &uz);
-				glReadPixels(ar->winrct.xmin+vos->mval[0]+vos->xoffs, ar->winrct.ymin+vos->mval[1], 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth);
+				glReadPixels(ar->winrct.xmin + vos->mval[0] + vos->xoffs, ar->winrct.ymin + vos->mval[1], 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth);
 
-				if(uz > depth)
+				if (uz > depth)
 					continue;
 			}
 #endif
-			if(vos->sco[0]!=IS_CLIPPED) {
-				const char *str= (char *)(vos+1);
+			if (vos->sco[0] != IS_CLIPPED) {
+				const char *str = (char *)(vos + 1);
 
-				if(col_pack_prev != vos->col.pack) {
+				if (col_pack_prev != vos->col.pack) {
 					glColor3ubv(vos->col.ub);
-					col_pack_prev= vos->col.pack;
+					col_pack_prev = vos->col.pack;
 				}
+
 				((vos->flag & V3D_CACHE_TEXT_ASCII) ?
-				            BLF_draw_default_ascii :
-				            BLF_draw_default
-				            ) ( (float)vos->sco[0] + vos->xoffs,
-				                (float)vos->sco[1],
-				                (depth_write) ? 0.0f: 2.0f,
-				                str,
-				                vos->str_len);
+				 BLF_draw_default_ascii :
+				 BLF_draw_default
+				)( (float)vos->sco[0] + vos->xoffs,
+				   (float)vos->sco[1],
+				   (depth_write) ? 0.0f : 2.0f,
+				   str,
+				   vos->str_len);
 			}
 		}
 		
-		if(depth_write) {
-			if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+		if (depth_write) {
+			if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
 		}
 		else glDepthMask(1);
 		
@@ -904,12 +933,12 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa
 		glMatrixMode(GL_MODELVIEW);
 		glPopMatrix();
 
-		if(rv3d->rflag & RV3D_CLIPPING)
-			for(a=0; a<6; a++)
-				glEnable(GL_CLIP_PLANE0+a);
+		if (rv3d->rflag & RV3D_CLIPPING) {
+			ED_view3d_clipping_enable();
+		}
 	}
 	
-	if(strings->first) 
+	if (strings->first)
 		BLI_freelistN(strings);
 	
 	CachedTextLevel--;
@@ -921,21 +950,21 @@ static void drawcube(void)
 {
 
 	glBegin(GL_LINE_STRIP);
-		glVertex3fv(cube[0]); glVertex3fv(cube[1]);glVertex3fv(cube[2]); glVertex3fv(cube[3]);
-		glVertex3fv(cube[0]); glVertex3fv(cube[4]);glVertex3fv(cube[5]); glVertex3fv(cube[6]);
-		glVertex3fv(cube[7]); glVertex3fv(cube[4]);
+	glVertex3fv(cube[0]); glVertex3fv(cube[1]); glVertex3fv(cube[2]); glVertex3fv(cube[3]);
+	glVertex3fv(cube[0]); glVertex3fv(cube[4]); glVertex3fv(cube[5]); glVertex3fv(cube[6]);
+	glVertex3fv(cube[7]); glVertex3fv(cube[4]);
 	glEnd();
 
 	glBegin(GL_LINE_STRIP);
-		glVertex3fv(cube[1]); glVertex3fv(cube[5]);
+	glVertex3fv(cube[1]); glVertex3fv(cube[5]);
 	glEnd();
 
 	glBegin(GL_LINE_STRIP);
-		glVertex3fv(cube[2]); glVertex3fv(cube[6]);
+	glVertex3fv(cube[2]); glVertex3fv(cube[6]);
 	glEnd();
 
 	glBegin(GL_LINE_STRIP);
-		glVertex3fv(cube[3]); glVertex3fv(cube[7]);
+	glVertex3fv(cube[3]); glVertex3fv(cube[7]);
 	glEnd();
 }
 
@@ -945,25 +974,25 @@ static void drawcube(void)
 static void drawcube_size(float size)
 {
 	glBegin(GL_LINE_STRIP);
-		glVertex3f(-size,-size,-size); glVertex3f(-size,-size,size);
-		glVertex3f(-size,size,size); glVertex3f(-size,size,-size);
+	glVertex3f(-size, -size, -size); glVertex3f(-size, -size, size);
+	glVertex3f(-size, size, size); glVertex3f(-size, size, -size);
 
-		glVertex3f(-size,-size,-size); glVertex3f(size,-size,-size);
-		glVertex3f(size,-size,size); glVertex3f(size,size,size);
+	glVertex3f(-size, -size, -size); glVertex3f(size, -size, -size);
+	glVertex3f(size, -size, size); glVertex3f(size, size, size);
 
-		glVertex3f(size,size,-size); glVertex3f(size,-size,-size);
+	glVertex3f(size, size, -size); glVertex3f(size, -size, -size);
 	glEnd();
 
 	glBegin(GL_LINE_STRIP);
-		glVertex3f(-size,-size,size); glVertex3f(size,-size,size);
+	glVertex3f(-size, -size, size); glVertex3f(size, -size, size);
 	glEnd();
 
 	glBegin(GL_LINE_STRIP);
-		glVertex3f(-size,size,size); glVertex3f(size,size,size);
+	glVertex3f(-size, size, size); glVertex3f(size, size, size);
 	glEnd();
 
 	glBegin(GL_LINE_STRIP);
-		glVertex3f(-size,size,-size); glVertex3f(size,size,-size);
+	glVertex3f(-size, size, -size); glVertex3f(size, size, -size);
 	glEnd();
 }
 
@@ -977,21 +1006,21 @@ static void drawcube_size(const float size[3])
 	
 
 	glBegin(GL_LINE_STRIP);
-		glVertex3fv(cube[0]); glVertex3fv(cube[1]);glVertex3fv(cube[2]); glVertex3fv(cube[3]);
-		glVertex3fv(cube[0]); glVertex3fv(cube[4]);glVertex3fv(cube[5]); glVertex3fv(cube[6]);
-		glVertex3fv(cube[7]); glVertex3fv(cube[4]);
+	glVertex3fv(cube[0]); glVertex3fv(cube[1]); glVertex3fv(cube[2]); glVertex3fv(cube[3]);
+	glVertex3fv(cube[0]); glVertex3fv(cube[4]); glVertex3fv(cube[5]); glVertex3fv(cube[6]);
+	glVertex3fv(cube[7]); glVertex3fv(cube[4]);
 	glEnd();
 
 	glBegin(GL_LINE_STRIP);
-		glVertex3fv(cube[1]); glVertex3fv(cube[5]);
+	glVertex3fv(cube[1]); glVertex3fv(cube[5]);
 	glEnd();
 
 	glBegin(GL_LINE_STRIP);
-		glVertex3fv(cube[2]); glVertex3fv(cube[6]);
+	glVertex3fv(cube[2]); glVertex3fv(cube[6]);
 	glEnd();
 
 	glBegin(GL_LINE_STRIP);
-		glVertex3fv(cube[3]); glVertex3fv(cube[7]);
+	glVertex3fv(cube[3]); glVertex3fv(cube[7]);
 	glEnd();
 	
 	glPopMatrix();
@@ -1009,8 +1038,8 @@ static void drawshadbuflimits(Lamp *la, float mat[][4])
 	madd_v3_v3v3fl(end, mat[3], lavec, la->clipend);
 
 	glBegin(GL_LINE_STRIP);
-		glVertex3fv(sta);
-		glVertex3fv(end);
+	glVertex3fv(sta);
+	glVertex3fv(end);
 	glEnd();
 
 	glPointSize(3.0);
@@ -1026,76 +1055,76 @@ static void drawshadbuflimits(Lamp *la, float mat[][4])
 static void spotvolume(float lvec[3], float vvec[3], const float inp)
 {
 	/* camera is at 0,0,0 */
-	float temp[3],plane[3],mat1[3][3],mat2[3][3],mat3[3][3],mat4[3][3],q[4],co,si,angle;
+	float temp[3], plane[3], mat1[3][3], mat2[3][3], mat3[3][3], mat4[3][3], q[4], co, si, angle;
 
 	normalize_v3(lvec);
-	normalize_v3(vvec);				/* is this the correct vector ? */
+	normalize_v3(vvec);             /* is this the correct vector ? */
 
-	cross_v3_v3v3(temp,vvec,lvec);		/* equation for a plane through vvec en lvec */
-	cross_v3_v3v3(plane,lvec,temp);		/* a plane perpendicular to this, parrallel with lvec */
+	cross_v3_v3v3(temp, vvec, lvec);      /* equation for a plane through vvec en lvec */
+	cross_v3_v3v3(plane, lvec, temp);     /* a plane perpendicular to this, parrallel with lvec */
 
 	/* vectors are exactly aligned, use the X axis, this is arbitrary */
-	if(normalize_v3(plane) == 0.0f)
-		plane[1]= 1.0f;
+	if (normalize_v3(plane) == 0.0f)
+		plane[1] = 1.0f;
 
 	/* now we've got two equations: one of a cone and one of a plane, but we have
-	three unknowns. We remove one unkown by rotating the plane to z=0 (the plane normal) */
+	 * three unknowns. We remove one unknown by rotating the plane to z=0 (the plane normal) */
 
 	/* rotate around cross product vector of (0,0,1) and plane normal, dot product degrees */
 	/* according definition, we derive cross product is (plane[1],-plane[0],0), en cos = plane[2]);*/
 
 	/* translating this comment to english didnt really help me understanding the math! :-) (ton) */
 	
-	q[1] = plane[1] ; 
-	q[2] = -plane[0] ; 
-	q[3] = 0 ;
+	q[1] =  plane[1];
+	q[2] = -plane[0];
+	q[3] =  0;
 	normalize_v3(&q[1]);
 
-	angle = saacos(plane[2])/2.0f;
+	angle = saacos(plane[2]) / 2.0f;
 	co = cosf(angle);
-	si = sqrtf(1-co*co);
+	si = sqrtf(1 - co * co);
 
 	q[0] =  co;
 	q[1] *= si;
 	q[2] *= si;
 	q[3] =  0;
 
-	quat_to_mat3(mat1,q);
+	quat_to_mat3(mat1, q);
 
 	/* rotate lamp vector now over acos(inp) degrees */
 	copy_v3_v3(vvec, lvec);
 
 	unit_m3(mat2);
 	co = inp;
-	si = sqrtf(1.0f-inp*inp);
+	si = sqrtf(1.0f - inp * inp);
 
 	mat2[0][0] =  co;
 	mat2[1][0] = -si;
 	mat2[0][1] =  si;
 	mat2[1][1] =  co;
-	mul_m3_m3m3(mat3,mat2,mat1);
+	mul_m3_m3m3(mat3, mat2, mat1);
 
 	mat2[1][0] =  si;
 	mat2[0][1] = -si;
-	mul_m3_m3m3(mat4,mat2,mat1);
+	mul_m3_m3m3(mat4, mat2, mat1);
 	transpose_m3(mat1);
 
-	mul_m3_m3m3(mat2,mat1,mat3);
-	mul_m3_v3(mat2,lvec);
-	mul_m3_m3m3(mat2,mat1,mat4);
-	mul_m3_v3(mat2,vvec);
+	mul_m3_m3m3(mat2, mat1, mat3);
+	mul_m3_v3(mat2, lvec);
+	mul_m3_m3m3(mat2, mat1, mat4);
+	mul_m3_v3(mat2, vvec);
 
 	return;
 }
 
 static void draw_spot_cone(Lamp *la, float x, float z)
 {
-	z= fabs(z);
+	z = fabs(z);
 
 	glBegin(GL_TRIANGLE_FAN);
 	glVertex3f(0.0f, 0.0f, -x);
 
-	if(la->mode & LA_SQUARE) {
+	if (la->mode & LA_SQUARE) {
 		glVertex3f(z, z, 0);
 		glVertex3f(-z, z, 0);
 		glVertex3f(-z, -z, 0);
@@ -1106,9 +1135,9 @@ static void draw_spot_cone(Lamp *la, float x, float z)
 		float angle;
 		int a;
 
-		for(a=0; a<33; a++) {
-			angle= a*M_PI*2/(33-1);
-			glVertex3f(z*cosf(angle), z*sinf(angle), 0);
+		for (a = 0; a < 33; a++) {
+			angle = a * M_PI * 2 / (33 - 1);
+			glVertex3f(z * cosf(angle), z * sinf(angle), 0);
 		}
 	}
 
@@ -1132,7 +1161,7 @@ static void draw_transp_spot_volume(Lamp *la, float x, float z)
 	/* draw front side lighting */
 	glCullFace(GL_BACK);
 
-	glBlendFunc(GL_ONE,  GL_ONE); 
+	glBlendFunc(GL_ONE, GL_ONE);
 	glColor4f(0.2f, 0.2f, 0.2f, 1.0f);
 
 	draw_spot_cone(la, x, z);
@@ -1147,24 +1176,24 @@ static void draw_transp_spot_volume(Lamp *la, float x, float z)
 
 static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, int dt, int flag)
 {
-	Object *ob= base->object;
-	const float pixsize= ED_view3d_pixel_size(rv3d, ob->obmat[3]);
-	Lamp *la= ob->data;
-	float vec[3], lvec[3], vvec[3], circrad, x,y,z;
+	Object *ob = base->object;
+	const float pixsize = ED_view3d_pixel_size(rv3d, ob->obmat[3]);
+	Lamp *la = ob->data;
+	float vec[3], lvec[3], vvec[3], circrad, x, y, z;
 	float lampsize;
 	float imat[4][4], curcol[4];
 	unsigned char col[4];
 	/* cone can't be drawn for duplicated lamps, because duplilist would be freed to */
 	/* the moment of view3d_draw_transp() call */
-	const short is_view= (rv3d->persp==RV3D_CAMOB && v3d->camera == base->object);
-	const short drawcone= ((dt > OB_WIRE) &&
-	                       !(G.f & G_PICKSEL) &&
-	                       (la->type == LA_SPOT) &&
-	                       (la->mode & LA_SHOW_CONE) &&
-	                       !(base->flag & OB_FROMDUPLI) &&
-	                       !is_view);
-
-	if(drawcone && !v3d->transp) {
+	const short is_view = (rv3d->persp == RV3D_CAMOB && v3d->camera == base->object);
+	const short drawcone = ((dt > OB_WIRE) &&
+	                        !(G.f & G_PICKSEL) &&
+	                        (la->type == LA_SPOT) &&
+	                        (la->mode & LA_SHOW_CONE) &&
+	                        !(base->flag & OB_FROMDUPLI) &&
+	                        !is_view);
+
+	if (drawcone && !v3d->transp) {
 		/* in this case we need to draw delayed */
 		add_view3d_after(&v3d->afterdraw_transp, base, flag);
 		return;
@@ -1175,7 +1204,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
 	glLoadMatrixf(rv3d->viewmat);
 
 	/* lets calculate the scale: */
-	lampsize= pixsize*((float)U.obcenter_dia*0.5f);
+	lampsize = pixsize * ((float)U.obcenter_dia * 0.5f);
 
 	/* and view aligned matrix: */
 	copy_m4_m4(imat, rv3d->viewinv);
@@ -1187,13 +1216,13 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
 	
 	/* for AA effects */
 	glGetFloatv(GL_CURRENT_COLOR, curcol);
-	curcol[3]= 0.6;
+	curcol[3] = 0.6;
 	glColor4fv(curcol);
 	
-	if(lampsize > 0.0f) {
+	if (lampsize > 0.0f) {
 
-		if(ob->id.us>1) {
-			if (ob==OBACT || (ob->flag & SELECT)) glColor4ub(0x88, 0xFF, 0xFF, 155);
+		if (ob->id.us > 1) {
+			if (ob == OBACT || (ob->flag & SELECT)) glColor4ub(0x88, 0xFF, 0xFF, 155);
 			else glColor4ub(0x77, 0xCC, 0xCC, 155);
 		}
 		
@@ -1204,21 +1233,19 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
 		drawcircball(GL_POLYGON, vec, lampsize, imat);
 		
 		/* restore */
-		if(ob->id.us>1)
+		if (ob->id.us > 1)
 			glColor4fv(curcol);
-			
+
 		/* Outer circle */
-		circrad = 3.0f*lampsize;
+		circrad = 3.0f * lampsize;
 		setlinestyle(3);
 
 		drawcircball(GL_LINE_LOOP, vec, circrad, imat);
 
 		/* draw dashed outer circle if shadow is on. remember some lamps can't have certain shadows! */
-		if(la->type!=LA_HEMI) {
-			if(	(la->mode & LA_SHAD_RAY) ||
-				((la->mode & LA_SHAD_BUF) && (la->type==LA_SPOT))
-			) {
-				drawcircball(GL_LINE_LOOP, vec, circrad + 3.0f*pixsize, imat);
+		if (la->type != LA_HEMI) {
+			if ((la->mode & LA_SHAD_RAY) || ((la->mode & LA_SHAD_BUF) && (la->type == LA_SPOT))) {
+				drawcircball(GL_LINE_LOOP, vec, circrad + 3.0f * pixsize, imat);
 			}
 		}
 	}
@@ -1228,12 +1255,12 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
 	}
 	
 	/* draw the pretty sun rays */
-	if(la->type==LA_SUN) {
+	if (la->type == LA_SUN) {
 		float v1[3], v2[3], mat[3][3];
 		short axis;
 		
 		/* setup a 45 degree rotation matrix */
-		vec_rot_to_mat3(mat, imat[2], (float)M_PI/4.0f);
+		vec_rot_to_mat3(mat, imat[2], (float)M_PI / 4.0f);
 		
 		/* vectors */
 		mul_v3_v3fl(v1, imat[0], circrad * 1.2f);
@@ -1245,7 +1272,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
 		setlinestyle(3);
 		
 		glBegin(GL_LINES);
-		for (axis=0; axis<8; axis++) {
+		for (axis = 0; axis < 8; axis++) {
 			glVertex3fv(v1);
 			glVertex3fv(v2);
 			mul_m3_v3(mat, v1);
@@ -1255,32 +1282,31 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
 		
 		glTranslatef(-vec[0], -vec[1], -vec[2]);
 
-	}		
+	}
 	
-	if (la->type==LA_LOCAL) {
-		if(la->mode & LA_SPHERE) {
+	if (la->type == LA_LOCAL) {
+		if (la->mode & LA_SPHERE) {
 			drawcircball(GL_LINE_LOOP, vec, la->dist, imat);
 		}
-		/* yafray: for photonlight also draw lightcone as for spot */
 	}
 	
-	glPopMatrix();	/* back in object space */
+	glPopMatrix();  /* back in object space */
 	zero_v3(vec);
 	
-	if(is_view) {
+	if (is_view) {
 		/* skip drawing extra info */
 	}
-	else if ((la->type==LA_SPOT) || (la->type==LA_YF_PHOTON)) {
-		lvec[0]=lvec[1]= 0.0; 
+	else if ((la->type == LA_SPOT) || (la->type == LA_YF_PHOTON)) {
+		lvec[0] = lvec[1] = 0.0;
 		lvec[2] = 1.0;
 		x = rv3d->persmat[0][2];
 		y = rv3d->persmat[1][2];
 		z = rv3d->persmat[2][2];
-		vvec[0]= x*ob->obmat[0][0] + y*ob->obmat[0][1] + z*ob->obmat[0][2];
-		vvec[1]= x*ob->obmat[1][0] + y*ob->obmat[1][1] + z*ob->obmat[1][2];
-		vvec[2]= x*ob->obmat[2][0] + y*ob->obmat[2][1] + z*ob->obmat[2][2];
+		vvec[0] = x * ob->obmat[0][0] + y * ob->obmat[0][1] + z * ob->obmat[0][2];
+		vvec[1] = x * ob->obmat[1][0] + y * ob->obmat[1][1] + z * ob->obmat[1][2];
+		vvec[2] = x * ob->obmat[2][0] + y * ob->obmat[2][1] + z * ob->obmat[2][2];
 
-		y = cosf(la->spotsize*(float)(M_PI/360.0));
+		y = cosf(la->spotsize * (float)(M_PI / 360.0));
 		spotvolume(lvec, vvec, y);
 		x = -la->dist;
 		mul_v3_fl(lvec, x);
@@ -1288,75 +1314,75 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
 
 		/* draw the angled sides of the cone */
 		glBegin(GL_LINE_STRIP);
-			glVertex3fv(vvec);
-			glVertex3fv(vec);
-			glVertex3fv(lvec);
+		glVertex3fv(vvec);
+		glVertex3fv(vec);
+		glVertex3fv(lvec);
 		glEnd();
 		
-		z = x*sqrtf(1.0f - y*y);
+		z = x * sqrtf(1.0f - y * y);
 		x *= y;
 
 		/* draw the circle/square at the end of the cone */
-		glTranslatef(0.0, 0.0 ,  x);
-		if(la->mode & LA_SQUARE) {
+		glTranslatef(0.0, 0.0,  x);
+		if (la->mode & LA_SQUARE) {
 			float tvec[3];
-			float z_abs= fabs(z);
+			float z_abs = fabs(z);
 
-			tvec[0]= tvec[1]= z_abs;
-			tvec[2]= 0.0;
+			tvec[0] = tvec[1] = z_abs;
+			tvec[2] = 0.0;
 
 			glBegin(GL_LINE_LOOP);
-				glVertex3fv(tvec);
-				tvec[1]= -z_abs; /* neg */
-				glVertex3fv(tvec);
-				tvec[0]= -z_abs; /* neg */
-				glVertex3fv(tvec);
-				tvec[1]= z_abs; /* pos */
-				glVertex3fv(tvec);
+			glVertex3fv(tvec);
+			tvec[1] = -z_abs; /* neg */
+			glVertex3fv(tvec);
+			tvec[0] = -z_abs; /* neg */
+			glVertex3fv(tvec);
+			tvec[1] = z_abs; /* pos */
+			glVertex3fv(tvec);
 			glEnd();
 		}
 		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));
+		if (la->type == LA_SPOT) {
+			float spotblcirc = fabs(z) * (1 - pow(la->spotblend, 2));
 			/* hide line if it is zero size or overlaps with outer border,
-			   previously it adjusted to always to show it but that seems
-			   confusing because it doesn't show the actual blend size */
+			 * previously it adjusted to always to show it but that seems
+			 * confusing because it doesn't show the actual blend size */
 			if (spotblcirc != 0 && spotblcirc != fabsf(z))
 				circ(0.0, 0.0, spotblcirc);
 		}
 
-		if(drawcone)
+		if (drawcone)
 			draw_transp_spot_volume(la, x, z);
 
 		/* draw clip start, useful for wide cones where its not obvious where the start is */
-		glTranslatef(0.0, 0.0 , -x); /* reverse translation above */
-		if(la->type==LA_SPOT && (la->mode & LA_SHAD_BUF) ) {
+		glTranslatef(0.0, 0.0, -x);  /* reverse translation above */
+		if (la->type == LA_SPOT && (la->mode & LA_SHAD_BUF) ) {
 			float lvec_clip[3];
 			float vvec_clip[3];
-			float clipsta_fac= la->clipsta / -x;
+			float clipsta_fac = la->clipsta / -x;
 
 			interp_v3_v3v3(lvec_clip, vec, lvec, clipsta_fac);
 			interp_v3_v3v3(vvec_clip, vec, vvec, clipsta_fac);
 
 			glBegin(GL_LINE_STRIP);
-				glVertex3fv(lvec_clip);
-				glVertex3fv(vvec_clip);
+			glVertex3fv(lvec_clip);
+			glVertex3fv(vvec_clip);
 			glEnd();
 		}
 	}
-	else if ELEM(la->type, LA_HEMI, LA_SUN) {
+	else if (ELEM(la->type, LA_HEMI, LA_SUN)) {
 		
 		/* draw the line from the circle along the dist */
 		glBegin(GL_LINE_STRIP);
-			vec[2] = -circrad;
-			glVertex3fv(vec); 
-			vec[2]= -la->dist; 
-			glVertex3fv(vec);
+		vec[2] = -circrad;
+		glVertex3fv(vec);
+		vec[2] = -la->dist;
+		glVertex3fv(vec);
 		glEnd();
 		
-		if(la->type==LA_HEMI) {
+		if (la->type == LA_HEMI) {
 			/* draw the hemisphere curves */
 			short axis, steps, dir;
 			float outdist, zdist, mul;
@@ -1365,24 +1391,24 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
 			
 			setlinestyle(4);
 			/* loop over the 4 compass points, and draw each arc as a LINE_STRIP */
-			for (axis=0; axis<4; axis++) {
-				float v[3]= {0.0, 0.0, 0.0};
+			for (axis = 0; axis < 4; axis++) {
+				float v[3] = {0.0, 0.0, 0.0};
 				zdist = 0.02;
 				
 				glBegin(GL_LINE_STRIP);
 				
-				for (steps=0; steps<6; steps++) {
-					if (axis == 0 || axis == 1) { 		/* x axis up, x axis down */	
+				for (steps = 0; steps < 6; steps++) {
+					if (axis == 0 || axis == 1) {       /* x axis up, x axis down */
 						/* make the arcs start at the edge of the energy circle */
-						if (steps == 0) v[0] = dir*circrad;
-						else v[0] = v[0] + dir*(steps*outdist);
-					} else if (axis == 2 || axis == 3) { 		/* y axis up, y axis down */
+						if (steps == 0) v[0] = dir * circrad;
+						else v[0] = v[0] + dir * (steps * outdist);
+					}
+					else if (axis == 2 || axis == 3) {      /* y axis up, y axis down */
 						/* make the arcs start at the edge of the energy circle */
-						if (steps == 0) v[1] = dir*circrad;
-						else v[1] = v[1] + dir*(steps*outdist); 
+						v[1] = (steps == 0) ? (dir * circrad) : (v[1] + dir * (steps * outdist));
 					}
-		
-					v[2] = v[2] - steps*zdist;
+
+					v[2] = v[2] - steps * zdist;
 					
 					glVertex3fv(v);
 					
@@ -1394,16 +1420,17 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
 				dir = -dir;
 			}
 		}
-	} else if(la->type==LA_AREA) {
+	}
+	else if (la->type == LA_AREA) {
 		setlinestyle(3);
-		if(la->area_shape==LA_AREA_SQUARE) 
-			fdrawbox(-la->area_size*0.5f, -la->area_size*0.5f, la->area_size*0.5f, la->area_size*0.5f);
-		else if(la->area_shape==LA_AREA_RECT) 
-			fdrawbox(-la->area_size*0.5f, -la->area_sizey*0.5f, la->area_size*0.5f, la->area_sizey*0.5f);
-
-		glBegin(GL_LINE_STRIP); 
-		glVertex3f(0.0,0.0,-circrad);
-		glVertex3f(0.0,0.0,-la->dist);
+		if (la->area_shape == LA_AREA_SQUARE)
+			fdrawbox(-la->area_size * 0.5f, -la->area_size * 0.5f, la->area_size * 0.5f, la->area_size * 0.5f);
+		else if (la->area_shape == LA_AREA_RECT)
+			fdrawbox(-la->area_size * 0.5f, -la->area_sizey * 0.5f, la->area_size * 0.5f, la->area_sizey * 0.5f);
+
+		glBegin(GL_LINE_STRIP);
+		glVertex3f(0.0, 0.0, -circrad);
+		glVertex3f(0.0, 0.0, -la->dist);
 		glEnd();
 	}
 	
@@ -1413,27 +1440,27 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
 
 	setlinestyle(0);
 	
-	if((la->type == LA_SPOT) && (la->mode & LA_SHAD_BUF) && (is_view == FALSE)) {
+	if ((la->type == LA_SPOT) && (la->mode & LA_SHAD_BUF) && (is_view == FALSE)) {
 		drawshadbuflimits(la, ob->obmat);
 	}
 	
 	UI_GetThemeColor4ubv(TH_LAMP, col);
 	glColor4ubv(col);
-	 
+
 	glEnable(GL_BLEND);
 	
-	if (vec[2]>0) vec[2] -= circrad;
+	if (vec[2] > 0) vec[2] -= circrad;
 	else vec[2] += circrad;
 	
 	glBegin(GL_LINE_STRIP);
-		glVertex3fv(vec); 
-		vec[2]= 0; 
-		glVertex3fv(vec);
+	glVertex3fv(vec);
+	vec[2] = 0;
+	glVertex3fv(vec);
 	glEnd();
 	
 	glPointSize(2.0);
 	glBegin(GL_POINTS);
-		glVertex3fv(vec);
+	glVertex3fv(vec);
 	glEnd();
 	glPointSize(1.0);
 	
@@ -1462,7 +1489,7 @@ static void draw_limit_line(float sta, float end, unsigned int col)
 
 
 /* yafray: draw camera focus point (cross, similar to aqsis code in tuhopuu) */
-/* qdn: now also enabled for Blender to set focus point for defocus composit node */
+/* qdn: now also enabled for Blender to set focus point for defocus composite node */
 static void draw_focus_cross(float dist, float size)
 {
 	glBegin(GL_LINES);
@@ -1475,22 +1502,22 @@ static void draw_focus_cross(float dist, float size)
 
 #ifdef VIEW3D_CAMERA_BORDER_HACK
 float view3d_camera_border_hack_col[4];
-short view3d_camera_border_hack_test= FALSE;
+short view3d_camera_border_hack_test = FALSE;
 #endif
 
 /* ****************** draw clip data *************** */
 
 static void draw_bundle_sphere(void)
 {
-	static GLuint displist= 0;
+	static GLuint displist = 0;
 
 	if (displist == 0) {
 		GLUquadricObj *qobj;
 
-		displist= glGenLists(1);
+		displist = glGenLists(1);
 		glNewList(displist, GL_COMPILE);
 
-		qobj= gluNewQuadric();
+		qobj = gluNewQuadric();
 		gluQuadricDrawStyle(qobj, GLU_FILL);
 		glShadeModel(GL_SMOOTH);
 		gluSphere(qobj, 0.05, 8, 8);
@@ -1504,14 +1531,15 @@ static void draw_bundle_sphere(void)
 }
 
 static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D *v3d,
-			MovieClip *clip, MovieTrackingObject *tracking_object, int flag, int *global_track_index)
+                                                MovieClip *clip, MovieTrackingObject *tracking_object, int flag,
+                                                int *global_track_index, int draw_selected)
 {
-	MovieTracking *tracking= &clip->tracking;
+	MovieTracking *tracking = &clip->tracking;
 	MovieTrackingTrack *track;
 	float mat[4][4], imat[4][4];
 	unsigned char col[4], scol[4];
-	int tracknr= *global_track_index;
-	ListBase *tracksbase= BKE_tracking_object_tracks(tracking, tracking_object);
+	int tracknr = *global_track_index;
+	ListBase *tracksbase = BKE_tracking_object_tracks(tracking, tracking_object);
 
 	UI_GetThemeColor4ubv(TH_TEXT, col);
 	UI_GetThemeColor4ubv(TH_SELECT, scol);
@@ -1520,10 +1548,10 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D
 
 	glPushMatrix();
 
-	if(tracking_object->flag & TRACKING_OBJECT_CAMERA) {
+	if (tracking_object->flag & TRACKING_OBJECT_CAMERA) {
 		/* current ogl matrix is translated in camera space, bundles should
-		   be rendered in world space, so camera matrix should be "removed"
-		   from current ogl matrix */
+		 * be rendered in world space, so camera matrix should be "removed"
+		 * from current ogl matrix */
 		invert_m4_m4(imat, base->object->obmat);
 
 		glMultMatrixf(imat);
@@ -1538,79 +1566,86 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D
 		glMultMatrixf(imat);
 	}
 
-	for (track= tracksbase->first; track; track= track->next) {
-		int selected= TRACK_SELECTED(track);
+	for (track = tracksbase->first; track; track = track->next) {
+		int selected = TRACK_SELECTED(track);
+
+		if (draw_selected && !selected)
+			continue;
 
-		if((track->flag&TRACK_HAS_BUNDLE)==0)
+		if ((track->flag & TRACK_HAS_BUNDLE) == 0)
 			continue;
 
-		if(flag&DRAW_PICKING)
-			glLoadName(base->selcol + (tracknr<<16));
+		if (flag & DRAW_PICKING)
+			glLoadName(base->selcol + (tracknr << 16));
 
 		glPushMatrix();
-			glTranslatef(track->bundle_pos[0], track->bundle_pos[1], track->bundle_pos[2]);
-			glScalef(v3d->bundle_size/0.05f, v3d->bundle_size/0.05f, v3d->bundle_size/0.05f);
+		glTranslatef(track->bundle_pos[0], track->bundle_pos[1], track->bundle_pos[2]);
+		glScalef(v3d->bundle_size / 0.05f, v3d->bundle_size / 0.05f, v3d->bundle_size / 0.05f);
 
-			if(v3d->drawtype==OB_WIRE) {
-				glDisable(GL_LIGHTING);
+		if (v3d->drawtype == OB_WIRE) {
+			glDisable(GL_LIGHTING);
 
-				if(selected) {
-					if(base==BASACT) UI_ThemeColor(TH_ACTIVE);
-					else UI_ThemeColor(TH_SELECT);
-				} else {
-					if(track->flag&TRACK_CUSTOMCOLOR) glColor3fv(track->color);
-					else UI_ThemeColor(TH_WIRE);
-				}
+			if (selected) {
+				if (base == BASACT) UI_ThemeColor(TH_ACTIVE);
+				else UI_ThemeColor(TH_SELECT);
+			}
+			else {
+				if (track->flag & TRACK_CUSTOMCOLOR) glColor3fv(track->color);
+				else UI_ThemeColor(TH_WIRE);
+			}
 
-				drawaxes(0.05f, v3d->bundle_drawtype);
+			drawaxes(0.05f, v3d->bundle_drawtype);
 
-				glEnable(GL_LIGHTING);
-			} else if(v3d->drawtype>OB_WIRE) {
-				if(v3d->bundle_drawtype==OB_EMPTY_SPHERE) {
-					/* selection outline */
-					if(selected) {
-						if(base==BASACT) UI_ThemeColor(TH_ACTIVE);
-						else UI_ThemeColor(TH_SELECT);
-
-						glLineWidth(2.f);
-						glDisable(GL_LIGHTING);
-						glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-
-						draw_bundle_sphere();
-
-						glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-						glEnable(GL_LIGHTING);
-						glLineWidth(1.f);
-					}
+			glEnable(GL_LIGHTING);
+		}
+		else if (v3d->drawtype > OB_WIRE) {
+			if (v3d->bundle_drawtype == OB_EMPTY_SPHERE) {
+				/* selection outline */
+				if (selected) {
+					if (base == BASACT) UI_ThemeColor(TH_ACTIVE);
+					else UI_ThemeColor(TH_SELECT);
 
-					if(track->flag&TRACK_CUSTOMCOLOR) glColor3fv(track->color);
-					else UI_ThemeColor(TH_BUNDLE_SOLID);
+					glLineWidth(2.f);
+					glDisable(GL_LIGHTING);
+					glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
 
 					draw_bundle_sphere();
-				} else {
-					glDisable(GL_LIGHTING);
 
-					if(selected) {
-						if(base==BASACT) UI_ThemeColor(TH_ACTIVE);
-						else UI_ThemeColor(TH_SELECT);
-					} else {
-						if(track->flag&TRACK_CUSTOMCOLOR) glColor3fv(track->color);
-						else UI_ThemeColor(TH_WIRE);
-					}
+					glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+					glEnable(GL_LIGHTING);
+					glLineWidth(1.f);
+				}
 
-					drawaxes(0.05f, v3d->bundle_drawtype);
+				if (track->flag & TRACK_CUSTOMCOLOR) glColor3fv(track->color);
+				else UI_ThemeColor(TH_BUNDLE_SOLID);
 
-					glEnable(GL_LIGHTING);
+				draw_bundle_sphere();
+			}
+			else {
+				glDisable(GL_LIGHTING);
+
+				if (selected) {
+					if (base == BASACT) UI_ThemeColor(TH_ACTIVE);
+					else UI_ThemeColor(TH_SELECT);
+				}
+				else {
+					if (track->flag & TRACK_CUSTOMCOLOR) glColor3fv(track->color);
+					else UI_ThemeColor(TH_WIRE);
 				}
+
+				drawaxes(0.05f, v3d->bundle_drawtype);
+
+				glEnable(GL_LIGHTING);
 			}
+		}
 
 		glPopMatrix();
 
-		if((flag & DRAW_PICKING)==0 && (v3d->flag2&V3D_SHOW_BUNDLENAME)) {
+		if ((flag & DRAW_PICKING) == 0 && (v3d->flag2 & V3D_SHOW_BUNDLENAME)) {
 			float pos[3];
 			unsigned char tcol[4];
 
-			if(selected) memcpy(tcol, scol, sizeof(tcol));
+			if (selected) memcpy(tcol, scol, sizeof(tcol));
 			else memcpy(tcol, col, sizeof(tcol));
 
 			mul_v3_m4v3(pos, mat, track->bundle_pos);
@@ -1620,47 +1655,48 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D
 		tracknr++;
 	}
 
-	if((flag & DRAW_PICKING)==0) {
-		if((v3d->flag2&V3D_SHOW_CAMERAPATH) && (tracking_object->flag&TRACKING_OBJECT_CAMERA)) {
+	if ((flag & DRAW_PICKING) == 0) {
+		if ((v3d->flag2 & V3D_SHOW_CAMERAPATH) && (tracking_object->flag & TRACKING_OBJECT_CAMERA)) {
 			MovieTrackingReconstruction *reconstruction;
-			reconstruction= BKE_tracking_object_reconstruction(tracking, tracking_object);
+			reconstruction = BKE_tracking_object_reconstruction(tracking, tracking_object);
 
-			if(reconstruction->camnr) {
-				MovieReconstructedCamera *camera= reconstruction->cameras;
-				int a= 0;
+			if (reconstruction->camnr) {
+				MovieReconstructedCamera *camera = reconstruction->cameras;
+				int a = 0;
 
 				glDisable(GL_LIGHTING);
 				UI_ThemeColor(TH_CAMERA_PATH);
 				glLineWidth(2.0f);
 
 				glBegin(GL_LINE_STRIP);
-					for(a= 0; a<reconstruction->camnr; a++, camera++) {
-						glVertex3fv(camera->mat[3]);
-					}
-					glEnd();
+				for (a = 0; a < reconstruction->camnr; a++, camera++) {
+					glVertex3fv(camera->mat[3]);
+				}
+				glEnd();
 
-					glLineWidth(1.0f);
-					glEnable(GL_LIGHTING);
+				glLineWidth(1.0f);
+				glEnable(GL_LIGHTING);
 			}
 		}
 	}
 
 	glPopMatrix();
 
-	*global_track_index= tracknr;
+	*global_track_index = tracknr;
 }
 
-static void draw_viewport_reconstruction(Scene *scene, Base *base, View3D *v3d, MovieClip *clip, int flag)
+static void draw_viewport_reconstruction(Scene *scene, Base *base, View3D *v3d, MovieClip *clip,
+                                         int flag, int draw_selected)
 {
-	MovieTracking *tracking= &clip->tracking;
+	MovieTracking *tracking = &clip->tracking;
 	MovieTrackingObject *tracking_object;
 	float curcol[4];
-	int global_track_index= 1;
+	int global_track_index = 1;
 
-	if((v3d->flag2&V3D_SHOW_RECONSTRUCTION)==0)
+	if ((v3d->flag2 & V3D_SHOW_RECONSTRUCTION) == 0)
 		return;
 
-	if(v3d->flag2&V3D_RENDER_OVERRIDE)
+	if (v3d->flag2 & V3D_RENDER_OVERRIDE)
 		return;
 
 	glGetFloatv(GL_CURRENT_COLOR, curcol);
@@ -1670,12 +1706,12 @@ static void draw_viewport_reconstruction(Scene *scene, Base *base, View3D *v3d,
 	glEnable(GL_COLOR_MATERIAL);
 	glShadeModel(GL_SMOOTH);
 
-	tracking_object= tracking->objects.first;
-	while(tracking_object) {
+	tracking_object = tracking->objects.first;
+	while (tracking_object) {
 		draw_viewport_object_reconstruction(scene, base, v3d, clip, tracking_object,
-					flag, &global_track_index);
+		                                    flag, &global_track_index, draw_selected);
 
-		tracking_object= tracking_object->next;
+		tracking_object = tracking_object->next;
 	}
 
 	/* restore */
@@ -1685,7 +1721,7 @@ static void draw_viewport_reconstruction(Scene *scene, Base *base, View3D *v3d,
 
 	glColor4fv(curcol);
 
-	if(flag&DRAW_PICKING)
+	if (flag & DRAW_PICKING)
 		glLoadName(base->selcol);
 }
 
@@ -1694,31 +1730,33 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
 {
 	/* a standing up pyramid with (0,0,0) as top */
 	Camera *cam;
-	Object *ob= base->object;
+	Object *ob = base->object;
 	float tvec[3];
 	float vec[4][3], asp[2], shift[2], scale[3];
 	int i;
 	float drawsize;
-	const short is_view= (rv3d->persp==RV3D_CAMOB && ob==v3d->camera);
-	MovieClip *clip= object_get_movieclip(scene, base->object, 0);
+	const short is_view = (rv3d->persp == RV3D_CAMOB && ob == v3d->camera);
+	MovieClip *clip = object_get_movieclip(scene, base->object, 0);
 
 	/* draw data for movie clip set as active for scene */
-	if(clip)
-		draw_viewport_reconstruction(scene, base, v3d, clip, flag);
+	if (clip) {
+		draw_viewport_reconstruction(scene, base, v3d, clip, flag, FALSE);
+		draw_viewport_reconstruction(scene, base, v3d, clip, flag, TRUE);
+	}
 
 #ifdef VIEW3D_CAMERA_BORDER_HACK
-	if(is_view && !(G.f & G_PICKSEL)) {
+	if (is_view && !(G.f & G_PICKSEL)) {
 		glGetFloatv(GL_CURRENT_COLOR, view3d_camera_border_hack_col);
-		view3d_camera_border_hack_test= TRUE;
+		view3d_camera_border_hack_test = TRUE;
 		return;
 	}
 #endif
 
-	cam= ob->data;
+	cam = ob->data;
 
-	scale[0]= 1.0f / len_v3(ob->obmat[0]);
-	scale[1]= 1.0f / len_v3(ob->obmat[1]);
-	scale[2]= 1.0f / len_v3(ob->obmat[2]);
+	scale[0] = 1.0f / len_v3(ob->obmat[0]);
+	scale[1] = 1.0f / len_v3(ob->obmat[1]);
+	scale[2] = 1.0f / len_v3(ob->obmat[2]);
 
 	camera_view_frame_ex(scene, cam, cam->drawsize, is_view, scale,
 	                     asp, shift, &drawsize, vec);
@@ -1734,7 +1772,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
 	glVertex3fv(vec[3]);
 	glEnd();
 
-	if(is_view)
+	if (is_view)
 		return;
 
 	zero_v3(tvec);
@@ -1751,36 +1789,36 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
 
 
 	/* arrow on top */
-	tvec[2]= vec[1][2]; /* copy the depth */
+	tvec[2] = vec[1][2]; /* copy the depth */
 
 
 	/* draw an outline arrow for inactive cameras and filled
 	 * for active cameras. We actually draw both outline+filled
-	 * for active cameras so the wire can be seen side-on */	
-	for (i=0;i<2;i++) {
-		if (i==0) glBegin(GL_LINE_LOOP);
-		else if (i==1 && (ob == v3d->camera)) glBegin(GL_TRIANGLES);
+	 * for active cameras so the wire can be seen side-on */
+	for (i = 0; i < 2; i++) {
+		if (i == 0) glBegin(GL_LINE_LOOP);
+		else if (i == 1 && (ob == v3d->camera)) glBegin(GL_TRIANGLES);
 		else break;
 
-		tvec[0]= shift[0] + ((-0.7f * drawsize) * scale[0]);
-		tvec[1]= shift[1] + ((drawsize * (asp[1] + 0.1f)) * scale[1]);
+		tvec[0] = shift[0] + ((-0.7f * drawsize) * scale[0]);
+		tvec[1] = shift[1] + ((drawsize * (asp[1] + 0.1f)) * scale[1]);
 		glVertex3fv(tvec); /* left */
 		
-		tvec[0]= shift[0] + ((0.7f * drawsize) * scale[0]);
+		tvec[0] = shift[0] + ((0.7f * drawsize) * scale[0]);
 		glVertex3fv(tvec); /* right */
 		
-		tvec[0]= shift[0];
-		tvec[1]= shift[1] + ((1.1f * drawsize * (asp[1] + 0.7f)) * scale[1]);
+		tvec[0] = shift[0];
+		tvec[1] = shift[1] + ((1.1f * drawsize * (asp[1] + 0.7f)) * scale[1]);
 		glVertex3fv(tvec); /* top */
-	
+
 		glEnd();
 	}
 
-	if(flag==0) {
-		if(cam->flag & (CAM_SHOWLIMITS+CAM_SHOWMIST)) {
+	if (flag == 0) {
+		if (cam->flag & (CAM_SHOWLIMITS + CAM_SHOWMIST)) {
 			float nobmat[4][4];
 			World *wrld;
-	
+
 			/* draw in normalized object matrix space */
 			copy_m4_m4(nobmat, ob->obmat);
 			normalize_m4(nobmat);
@@ -1789,16 +1827,16 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
 			glLoadMatrixf(rv3d->viewmat);
 			glMultMatrixf(nobmat);
 
-			if(cam->flag & CAM_SHOWLIMITS) {
+			if (cam->flag & CAM_SHOWLIMITS) {
 				draw_limit_line(cam->clipsta, cam->clipend, 0x77FFFF);
-				/* qdn: was yafray only, now also enabled for Blender to be used with defocus composit node */
+				/* qdn: was yafray only, now also enabled for Blender to be used with defocus composite node */
 				draw_focus_cross(object_camera_dof_distance(ob), cam->drawsize);
 			}
 
-			wrld= scene->world;
-			if(cam->flag & CAM_SHOWMIST) 
-				if(wrld) draw_limit_line(wrld->miststa, wrld->miststa+wrld->mistdist, 0xFFFFFF);
-				
+			wrld = scene->world;
+			if (cam->flag & CAM_SHOWMIST)
+				if (wrld) draw_limit_line(wrld->miststa, wrld->miststa + wrld->mistdist, 0xFFFFFF);
+
 			glPopMatrix();
 		}
 	}
@@ -1815,11 +1853,11 @@ static void drawspeaker(Scene *UNUSED(scene), View3D *UNUSED(v3d), RegionView3D
 
 	glEnable(GL_BLEND);
 
-	for(j = 0; j < 3; j++) {
-		vec[2] = 0.25f * j -0.125f;
+	for (j = 0; j < 3; j++) {
+		vec[2] = 0.25f * j - 0.125f;
 
 		glBegin(GL_LINE_LOOP);
-		for(i = 0; i < 16; i++) {
+		for (i = 0; i < 16; i++) {
 			vec[0] = cosf((float)M_PI * i / 8.0f) * (j == 0 ? 0.5f : 0.25f);
 			vec[1] = sinf((float)M_PI * i / 8.0f) * (j == 0 ? 0.5f : 0.25f);
 			glVertex3fv(vec);
@@ -1827,17 +1865,17 @@ static void drawspeaker(Scene *UNUSED(scene), View3D *UNUSED(v3d), RegionView3D
 		glEnd();
 	}
 
-	for(j = 0; j < 4; j++) {
+	for (j = 0; j < 4; j++) {
 		vec[0] = (((j + 1) % 2) * (j - 1)) * 0.5f;
 		vec[1] = ((j % 2) * (j - 2)) * 0.5f;
 		glBegin(GL_LINE_STRIP);
-		for(i = 0; i < 3; i++) {
-			if(i == 1) {
+		for (i = 0; i < 3; i++) {
+			if (i == 1) {
 				vec[0] *= 0.5f;
 				vec[1] *= 0.5f;
 			}
 
-			vec[2] = 0.25f * i -0.125f;
+			vec[2] = 0.25f * i - 0.125f;
 			glVertex3fv(vec);
 		}
 		glEnd();
@@ -1849,23 +1887,23 @@ static void drawspeaker(Scene *UNUSED(scene), View3D *UNUSED(v3d), RegionView3D
 static void lattice_draw_verts(Lattice *lt, DispList *dl, short sel)
 {
 	BPoint *bp = lt->def;
-	float *co = dl?dl->verts:NULL;
+	float *co = dl ? dl->verts : NULL;
 	int u, v, w;
 
-	UI_ThemeColor(sel?TH_VERTEX_SELECT:TH_VERTEX);
+	UI_ThemeColor(sel ? TH_VERTEX_SELECT : TH_VERTEX);
 	glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
 	bglBegin(GL_POINTS);
 
-	for(w=0; w<lt->pntsw; w++) {
-		int wxt = (w==0 || w==lt->pntsw-1);
-		for(v=0; v<lt->pntsv; v++) {
-			int vxt = (v==0 || v==lt->pntsv-1);
-			for(u=0; u<lt->pntsu; u++, bp++, co+=3) {
-				int uxt = (u==0 || u==lt->pntsu-1);
-				if(!(lt->flag & LT_OUTSIDE) || uxt || vxt || wxt) {
-					if(bp->hide==0) {
-						if((bp->f1 & SELECT)==sel) {
-							bglVertex3fv(dl?co:bp->vec);
+	for (w = 0; w < lt->pntsw; w++) {
+		int wxt = (w == 0 || w == lt->pntsw - 1);
+		for (v = 0; v < lt->pntsv; v++) {
+			int vxt = (v == 0 || v == lt->pntsv - 1);
+			for (u = 0; u < lt->pntsu; u++, bp++, co += 3) {
+				int uxt = (u == 0 || u == lt->pntsu - 1);
+				if (!(lt->flag & LT_OUTSIDE) || uxt || vxt || wxt) {
+					if (bp->hide == 0) {
+						if ((bp->f1 & SELECT) == sel) {
+							bglVertex3fv(dl ? co : bp->vec);
 						}
 					}
 				}
@@ -1874,24 +1912,24 @@ static void lattice_draw_verts(Lattice *lt, DispList *dl, short sel)
 	}
 	
 	glPointSize(1.0);
-	bglEnd();	
+	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;
+	Object *obedit = vc->obedit;
+	Lattice *lt = obedit->data;
 	BPoint *bp = lt->editlatt->latt->def;
 	DispList *dl = find_displist(&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;
+	float *co = dl ? dl->verts : NULL;
+	int i, N = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw;
 	short s[2] = {IS_CLIPPED, 0};
 
-	ED_view3d_local_clipping(vc->rv3d, obedit->obmat); /* for local clipping lookups */
+	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) {
-			view3d_project_short_clip(vc->ar, dl?co:bp->vec, s, 1);
+	for (i = 0; i < N; i++, bp++, co += 3) {
+		if (bp->hide == 0) {
+			view3d_project_short_clip(vc->ar, dl ? co : bp->vec, s, TRUE);
 			if (s[0] != IS_CLIPPED)
 				func(userData, bp, s[0], s[1]);
 		}
@@ -1900,20 +1938,21 @@ void lattice_foreachScreenVert(ViewContext *vc, void (*func)(void *userData, BPo
 
 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;
+	int index = ((w * lt->pntsv + v) * lt->pntsu) + u;
 
-	if(use_wcol) {
+	if (use_wcol) {
 		float col[3];
-		MDeformWeight *mdw= defvert_find_index (lt->dvert+index, use_wcol-1);
+		MDeformWeight *mdw = defvert_find_index(lt->dvert + index, use_wcol - 1);
 		
-		weight_to_rgb(col, mdw?mdw->weight:0.0f);
+		weight_to_rgb(col, mdw ? mdw->weight : 0.0f);
 		glColor3fv(col);
 
 	}
 	
 	if (dl) {
-		glVertex3fv(&dl->verts[index*3]);
-	} else {
+		glVertex3fv(&dl->verts[index * 3]);
+	}
+	else {
 		glVertex3fv(lt->def[index].vec);
 	}
 }
@@ -1921,63 +1960,63 @@ static void drawlattice__point(Lattice *lt, DispList *dl, int u, int v, int w, i
 /* lattice color is hardcoded, now also shows weightgroup values in edit mode */
 static void drawlattice(Scene *scene, View3D *v3d, Object *ob)
 {
-	Lattice *lt= ob->data;
+	Lattice *lt = ob->data;
 	DispList *dl;
 	int u, v, w;
-	int use_wcol= 0, is_edit= (lt->editlatt != NULL);
+	int use_wcol = 0, is_edit = (lt->editlatt != NULL);
 
 	/* now we default make displist, this will modifiers work for non animated case */
-	if(ob->disp.first==NULL)
+	if (ob->disp.first == NULL)
 		lattice_calc_modifiers(scene, ob);
-	dl= find_displist(&ob->disp, DL_VERTS);
+	dl = find_displist(&ob->disp, DL_VERTS);
 	
-	if(is_edit) {
-		lt= lt->editlatt->latt;
+	if (is_edit) {
+		lt = lt->editlatt->latt;
 
 		cpack(0x004000);
 		
-		if(ob->defbase.first && lt->dvert) {
-			use_wcol= ob->actdef;
+		if (ob->defbase.first && lt->dvert) {
+			use_wcol = ob->actdef;
 			glShadeModel(GL_SMOOTH);
 		}
 	}
 	
 	glBegin(GL_LINES);
-	for(w=0; w<lt->pntsw; w++) {
-		int wxt = (w==0 || w==lt->pntsw-1);
-		for(v=0; v<lt->pntsv; v++) {
-			int vxt = (v==0 || v==lt->pntsv-1);
-			for(u=0; u<lt->pntsu; u++) {
-				int uxt = (u==0 || u==lt->pntsu-1);
-
-				if(w && ((uxt || vxt) || !(lt->flag & LT_OUTSIDE))) {
-					drawlattice__point(lt, dl, u, v, w-1, use_wcol);
+	for (w = 0; w < lt->pntsw; w++) {
+		int wxt = (w == 0 || w == lt->pntsw - 1);
+		for (v = 0; v < lt->pntsv; v++) {
+			int vxt = (v == 0 || v == lt->pntsv - 1);
+			for (u = 0; u < lt->pntsu; u++) {
+				int uxt = (u == 0 || u == lt->pntsu - 1);
+
+				if (w && ((uxt || vxt) || !(lt->flag & LT_OUTSIDE))) {
+					drawlattice__point(lt, dl, u, v, w - 1, use_wcol);
 					drawlattice__point(lt, dl, u, v, w, use_wcol);
 				}
-				if(v && ((uxt || wxt) || !(lt->flag & LT_OUTSIDE))) {
-					drawlattice__point(lt, dl, u, v-1, w, use_wcol);
+				if (v && ((uxt || wxt) || !(lt->flag & LT_OUTSIDE))) {
+					drawlattice__point(lt, dl, u, v - 1, w, use_wcol);
 					drawlattice__point(lt, dl, u, v, w, use_wcol);
 				}
-				if(u && ((vxt || wxt) || !(lt->flag & LT_OUTSIDE))) {
-					drawlattice__point(lt, dl, u-1, v, w, use_wcol);
+				if (u && ((vxt || wxt) || !(lt->flag & LT_OUTSIDE))) {
+					drawlattice__point(lt, dl, u - 1, v, w, use_wcol);
 					drawlattice__point(lt, dl, u, v, w, use_wcol);
 				}
 			}
 		}
-	}		
+	}
 	glEnd();
 	
 	/* restoration for weight colors */
-	if(use_wcol)
+	if (use_wcol)
 		glShadeModel(GL_FLAT);
 
-	if(is_edit) {
-		if(v3d->zbuf) glDisable(GL_DEPTH_TEST);
+	if (is_edit) {
+		if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
 		
 		lattice_draw_verts(lt, dl, 0);
 		lattice_draw_verts(lt, dl, 1);
 		
-		if(v3d->zbuf) glEnable(GL_DEPTH_TEST); 
+		if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
 	}
 }
 
@@ -1985,60 +2024,65 @@ 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 dont
- * use the object matrix in the useual way */
-static void mesh_foreachScreenVert__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
+ * 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;
-	EditVert *eve = EM_get_vert_for_index(index);
+	BMVert *eve = EDBM_vert_at_index(data->vc.em, index);
 
-	if (eve->h==0) {
-		short s[2]= {IS_CLIPPED, 0};
+	if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
+		short s[2] = {IS_CLIPPED, 0};
 
 		if (data->clipVerts != V3D_CLIP_TEST_OFF) {
-			view3d_project_short_clip(data->vc.ar, co, s, 1);
-		} else {
-			view3d_project_short_noclip(data->vc.ar, co, s);
+			view3d_project_short_clip(data->vc.ar, co, s, TRUE);
+		}
+		else {
+			float co2[2];
+			mul_v3_m4v3(co2, data->vc.obedit->obmat, co);
+			project_short_noclip(data->vc.ar, co2, s);
 		}
 
-		if (s[0]!=IS_CLIPPED)
+		if (s[0] != IS_CLIPPED)
 			data->func(data->userData, eve, s[0], s[1], index);
 	}
 }
 
 void mesh_foreachScreenVert(
-        ViewContext *vc,
-        void (*func)(void *userData, EditVert *eve, int x, int y, int index),
-        void *userData, eV3DClipTest clipVerts)
+    ViewContext *vc,
+    void (*func)(void *userData, BMVert *eve, int x, int y, int index),
+    void *userData, eV3DClipTest clipVerts)
 {
 	foreachScreenVert_userData data;
-	DerivedMesh *dm = editmesh_get_derived_cage(vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH);
+	DerivedMesh *dm = editbmesh_get_derived_cage(vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH);
 	
-	data.vc= *vc;
+	data.vc = *vc;
 	data.func = func;
 	data.userData = userData;
 	data.clipVerts = clipVerts;
 
-	if(clipVerts != V3D_CLIP_TEST_OFF)
-		ED_view3d_local_clipping(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */
+	if (clipVerts != V3D_CLIP_TEST_OFF)
+		ED_view3d_clipping_local(vc->rv3d, vc->obedit->obmat);  /* for local clipping lookups */
 
-	EM_init_index_arrays(vc->em, 1, 0, 0);
+	EDBM_index_arrays_init(vc->em, 1, 0, 0);
 	dm->foreachMappedVert(dm, mesh_foreachScreenVert__mapFunc, &data);
-	EM_free_index_arrays();
+	EDBM_index_arrays_free(vc->em);
 
 	dm->release(dm);
 }
 
 /*  draw callback */
-static void drawSelectedVertices__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
+static void drawSelectedVertices__mapFunc(void *userData, int index, const float co[3],
+                                          const float UNUSED(no_f[3]), const short UNUSED(no_s[3]))
 {
 	MVert *mv = &((MVert *)userData)[index];
 
-	if(!(mv->flag & ME_HIDE)) {
-		const char sel= mv->flag & SELECT;
+	if (!(mv->flag & ME_HIDE)) {
+		const char sel = mv->flag & SELECT;
 
 		// TODO define selected color
-		if(sel) {
+		if (sel) {
 			glColor3f(1.0f, 1.0f, 0.0f);
 		}
 		else {
@@ -2055,33 +2099,33 @@ static void drawSelectedVertices(DerivedMesh *dm, Mesh *me)
 	dm->foreachMappedVert(dm, drawSelectedVertices__mapFunc, me->mvert);
 	glEnd();
 }
-static int is_co_in_region(ARegion *ar, const short co[2])
-{
-	return ( (co[0] != IS_CLIPPED) && /* may be the only initialized value, check first */
-	         (co[0] >= 0)          &&
-	         (co[0] <  ar->winx)   &&
-	         (co[1] >= 0)          &&
-	         (co[1] <  ar->winy));
-}
-static void mesh_foreachScreenEdge__mapFunc(void *userData, int index, float *v0co, float *v1co)
+
+static void mesh_foreachScreenEdge__mapFunc(void *userData, int index, const float v0co[3], const float v1co[3])
 {
 	foreachScreenEdge_userData *data = userData;
-	EditEdge *eed = EM_get_edge_for_index(index);
-	short s[2][2];
+	BMEdge *eed = EDBM_edge_at_index(data->vc.em, index);
+
+	if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
+		short s[2][2];
 
-	if (eed->h==0) {
 		if (data->clipVerts == V3D_CLIP_TEST_RV3D_CLIPPING) {
-			view3d_project_short_clip(data->vc.ar, v0co, s[0], 1);
-			view3d_project_short_clip(data->vc.ar, v1co, s[1], 1);
+			view3d_project_short_clip(data->vc.ar, v0co, s[0], TRUE);
+			view3d_project_short_clip(data->vc.ar, v1co, s[1], TRUE);
 		}
 		else {
-			view3d_project_short_noclip(data->vc.ar, v0co, s[0]);
-			view3d_project_short_noclip(data->vc.ar, v1co, s[1]);
+			float v1_co[3], v2_co[3];
+
+			mul_v3_m4v3(v1_co, data->vc.obedit->obmat, v0co);
+			mul_v3_m4v3(v2_co, data->vc.obedit->obmat, v1co);
+
+			project_short_noclip(data->vc.ar, v1_co, s[0]);
+			project_short_noclip(data->vc.ar, v2_co, s[1]);
 
 			if (data->clipVerts == V3D_CLIP_TEST_REGION) {
-				if ( !is_co_in_region(data->vc.ar, s[0]) &&
-				     !is_co_in_region(data->vc.ar, s[1]))
-				{
+				/* make an int copy */
+				int s_int[2][2] = {{s[0][0], s[0][1]},
+				                   {s[1][0], s[1][1]}};
+				if (!BLI_segment_in_rcti(&data->win_rect, s_int[0], s_int[1])) {
 					return;
 				}
 			}
@@ -2092,36 +2136,45 @@ static void mesh_foreachScreenEdge__mapFunc(void *userData, int index, float *v0
 }
 
 void mesh_foreachScreenEdge(
-        ViewContext *vc,
-        void (*func)(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index),
-        void *userData, eV3DClipTest clipVerts)
+    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 = editmesh_get_derived_cage(vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH);
+	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.vc= *vc;
 	data.func = func;
 	data.userData = userData;
 	data.clipVerts = clipVerts;
 
-	if(clipVerts != V3D_CLIP_TEST_OFF)
-		ED_view3d_local_clipping(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */
+	if (clipVerts != V3D_CLIP_TEST_OFF)
+		ED_view3d_clipping_local(vc->rv3d, vc->obedit->obmat);  /* for local clipping lookups */
 
-	EM_init_index_arrays(vc->em, 0, 1, 0);
+	EDBM_index_arrays_init(vc->em, 0, 1, 0);
 	dm->foreachMappedEdge(dm, mesh_foreachScreenEdge__mapFunc, &data);
-	EM_free_index_arrays();
+	EDBM_index_arrays_free(vc->em);
 
 	dm->release(dm);
 }
 
-static void mesh_foreachScreenFace__mapFunc(void *userData, int index, float *cent, float *UNUSED(no))
+static void mesh_foreachScreenFace__mapFunc(void *userData, int index, const float cent[3], const float UNUSED(no[3]))
 {
 	foreachScreenFace_userData *data = userData;
-	EditFace *efa = EM_get_face_for_index(index);
-	short s[2];
+	BMFace *efa = EDBM_face_at_index(data->vc.em, index);
 
-	if (efa && efa->h==0 && efa->fgonf!=EM_FGON) {
-		view3d_project_short_clip(data->vc.ar, cent, s, 1);
+	if (efa && !BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
+		float cent2[3];
+		short s[2];
+
+		mul_v3_m4v3(cent2, data->vc.obedit->obmat, cent);
+		project_short(data->vc.ar, cent2, s);
 
 		if (s[0] != IS_CLIPPED) {
 			data->func(data->userData, efa, s[0], s[1], index);
@@ -2130,59 +2183,60 @@ static void mesh_foreachScreenFace__mapFunc(void *userData, int index, float *ce
 }
 
 void mesh_foreachScreenFace(
-        ViewContext *vc,
-        void (*func)(void *userData, EditFace *efa, int x, int y, int index),
-        void *userData)
+    ViewContext *vc,
+    void (*func)(void *userData, BMFace *efa, int x, int y, int index),
+    void *userData)
 {
 	foreachScreenFace_userData data;
-	DerivedMesh *dm = editmesh_get_derived_cage(vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH);
+	DerivedMesh *dm = editbmesh_get_derived_cage(vc->scene, vc->obedit, vc->em, CD_MASK_BAREMESH);
 
-	data.vc= *vc;
+	data.vc = *vc;
 	data.func = func;
 	data.userData = userData;
 
-	//if(clipVerts)
-	ED_view3d_local_clipping(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */
+	//if (clipVerts)
+	ED_view3d_clipping_local(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */
 
-	EM_init_index_arrays(vc->em, 0, 0, 1);
+	EDBM_index_arrays_init(vc->em, 0, 0, 1);
 	dm->foreachMappedFaceCenter(dm, mesh_foreachScreenFace__mapFunc, &data);
-	EM_free_index_arrays();
+	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)
+    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;
+	Curve *cu = vc->obedit->data;
 	short s[2] = {IS_CLIPPED, 0};
 	Nurb *nu;
 	int i;
-	ListBase *nurbs= curve_editnurbs(cu);
+	ListBase *nurbs = curve_editnurbs(cu);
 
-	ED_view3d_local_clipping(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */
+	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++) {
+	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) {
+				if (bezt->hide == 0) {
 					
-					if(cu->drawflag & CU_HIDE_HANDLES) {
-						view3d_project_short_clip(vc->ar, bezt->vec[1], s, 1);
+					if (cu->drawflag & CU_HIDE_HANDLES) {
+						view3d_project_short_clip(vc->ar, bezt->vec[1], s, TRUE);
 						if (s[0] != IS_CLIPPED)
 							func(userData, nu, NULL, bezt, 1, s[0], s[1]);
-					} else {
-						view3d_project_short_clip(vc->ar, bezt->vec[0], s, 1);
+					}
+					else {
+						view3d_project_short_clip(vc->ar, bezt->vec[0], s, TRUE);
 						if (s[0] != IS_CLIPPED)
 							func(userData, nu, NULL, bezt, 0, s[0], s[1]);
-						view3d_project_short_clip(vc->ar, bezt->vec[1], s, 1);
+						view3d_project_short_clip(vc->ar, bezt->vec[1], s, TRUE);
 						if (s[0] != IS_CLIPPED)
 							func(userData, nu, NULL, bezt, 1, s[0], s[1]);
-						view3d_project_short_clip(vc->ar, bezt->vec[2], s, 1);
+						view3d_project_short_clip(vc->ar, bezt->vec[2], s, TRUE);
 						if (s[0] != IS_CLIPPED)
 							func(userData, nu, NULL, bezt, 2, s[0], s[1]);
 					}
@@ -2190,11 +2244,11 @@ void nurbs_foreachScreenVert(
 			}
 		}
 		else {
-			for (i=0; i<nu->pntsu*nu->pntsv; i++) {
+			for (i = 0; i < nu->pntsu * nu->pntsv; i++) {
 				BPoint *bp = &nu->bp[i];
 
-				if(bp->hide==0) {
-					view3d_project_short_clip(vc->ar, bp->vec, s, 1);
+				if (bp->hide == 0) {
+					view3d_project_short_clip(vc->ar, bp->vec, s, TRUE);
 					if (s[0] != IS_CLIPPED)
 						func(userData, nu, bp, NULL, -1, s[0], s[1]);
 				}
@@ -2214,22 +2268,23 @@ void nurbs_foreachScreenVert(
  * logic!!!
  */
 
-static void draw_dm_face_normals__mapFunc(void *userData, int index, float *cent, float *no)
+static void draw_dm_face_normals__mapFunc(void *userData, int index, const float cent[3], const float no[3])
 {
 	drawDMNormal_userData *data = userData;
-	EditFace *efa = EM_get_face_for_index(index);
+	BMFace *efa = EDBM_face_at_index(data->em, index);
 
-	if (efa->h==0 && efa->fgonf!=EM_FGON) {
+	if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
 		glVertex3fv(cent);
 		glVertex3f(cent[0] + no[0] * data->normalsize,
 		           cent[1] + no[1] * data->normalsize,
 		           cent[2] + no[2] * data->normalsize);
 	}
 }
-static void draw_dm_face_normals(Scene *scene, DerivedMesh *dm) 
+static void draw_dm_face_normals(BMEditMesh *em, Scene *scene, DerivedMesh *dm) 
 {
 	drawDMNormal_userData data;
 
+	data.em = em;
 	data.normalsize = scene->toolsettings->normalsize;
 
 	glBegin(GL_LINES);
@@ -2237,28 +2292,30 @@ static void draw_dm_face_normals(Scene *scene, DerivedMesh *dm)
 	glEnd();
 }
 
-static void draw_dm_face_centers__mapFunc(void *userData, int index, float *cent, float *UNUSED(no))
+static void draw_dm_face_centers__mapFunc(void *userData, int index, const float cent[3], const float UNUSED(no[3]))
 {
-	EditFace *efa = EM_get_face_for_index(index);
-	int sel = *((int*) userData);
-
-	if (efa->h==0 && efa->fgonf!=EM_FGON && (efa->f&SELECT)==sel) {
+	BMFace *efa = EDBM_face_at_index(((void **)userData)[0], index);
+	int sel = *(((int **)userData)[1]);
+	
+	if (efa && !BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && BM_elem_flag_test(efa, BM_ELEM_SELECT) == sel) {
 		bglVertex3fv(cent);
 	}
 }
-static void draw_dm_face_centers(DerivedMesh *dm, int sel)
+static void draw_dm_face_centers(BMEditMesh *em, DerivedMesh *dm, int sel)
 {
+	void *ptrs[2] = {em, &sel};
+
 	bglBegin(GL_POINTS);
-	dm->foreachMappedFaceCenter(dm, draw_dm_face_centers__mapFunc, &sel);
+	dm->foreachMappedFaceCenter(dm, draw_dm_face_centers__mapFunc, ptrs);
 	bglEnd();
 }
 
-static void draw_dm_vert_normals__mapFunc(void *userData, int index, float *co, float *no_f, short *no_s)
+static void draw_dm_vert_normals__mapFunc(void *userData, int index, const float co[3], const float no_f[3], const short no_s[3])
 {
 	drawDMNormal_userData *data = userData;
-	EditVert *eve = EM_get_vert_for_index(index);
+	BMVert *eve = EDBM_vert_at_index(data->em, index);
 
-	if (eve->h==0) {
+	if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
 		glVertex3fv(co);
 
 		if (no_f) {
@@ -2273,10 +2330,11 @@ static void draw_dm_vert_normals__mapFunc(void *userData, int index, float *co,
 		}
 	}
 }
-static void draw_dm_vert_normals(Scene *scene, DerivedMesh *dm) 
+static void draw_dm_vert_normals(BMEditMesh *em, Scene *scene, DerivedMesh *dm) 
 {
 	drawDMNormal_userData data;
 
+	data.em = em;
 	data.normalsize = scene->toolsettings->normalsize;
 
 	glBegin(GL_LINES);
@@ -2284,15 +2342,16 @@ static void draw_dm_vert_normals(Scene *scene, DerivedMesh *dm)
 	glEnd();
 }
 
-	/* Draw verts with color set based on selection */
-static void draw_dm_verts__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
+/* Draw verts with color set based on selection */
+static void draw_dm_verts__mapFunc(void *userData, int index, const float co[3],
+                                   const float UNUSED(no_f[3]), const short UNUSED(no_s[3]))
 {
-	drawDMVerts_userData * data = userData;
-	EditVert *eve = EM_get_vert_for_index(index);
+	drawDMVerts_userData *data = userData;
+	BMVert *eve = EDBM_vert_at_index(data->em, index);
 
-	if (eve->h==0 && (eve->f&SELECT)==data->sel) {
+	if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN) && BM_elem_flag_test(eve, BM_ELEM_SELECT) == data->sel) {
 		/* draw active larger - need to stop/start point drawing for this :/ */
-		if (eve==data->eve_act) {
+		if (eve == data->eve_act) {
 			float size = UI_GetThemeValuef(TH_VERTEX_SIZE);
 			UI_ThemeColor4(TH_EDITMESH_ACTIVE);
 			
@@ -2303,239 +2362,291 @@ static void draw_dm_verts__mapFunc(void *userData, int index, float *co, float *
 			bglVertex3fv(co);
 			bglEnd();
 			
-			UI_ThemeColor4(data->sel?TH_VERTEX_SELECT:TH_VERTEX);
+			UI_ThemeColor4(data->sel ? TH_VERTEX_SELECT : TH_VERTEX);
 			glPointSize(size);
 			bglBegin(GL_POINTS);
-		} else {
+		}
+		else {
 			bglVertex3fv(co);
 		}
 	}
 }
 
-static void draw_dm_verts(DerivedMesh *dm, int sel, EditVert *eve_act)
+static void draw_dm_verts(BMEditMesh *em, DerivedMesh *dm, int sel, BMVert *eve_act)
 {
 	drawDMVerts_userData data;
 	data.sel = sel;
 	data.eve_act = eve_act;
+	data.em = em;
 
 	bglBegin(GL_POINTS);
 	dm->foreachMappedVert(dm, draw_dm_verts__mapFunc, &data);
 	bglEnd();
 }
 
-	/* Draw edges with color set based on selection */
-static int draw_dm_edges_sel__setDrawOptions(void *userData, int index)
+/* Draw edges with color set based on selection */
+static DMDrawOption draw_dm_edges_sel__setDrawOptions(void *userData, int index)
 {
-	EditEdge *eed = EM_get_edge_for_index(index);
+	BMEdge *eed;
 	//unsigned char **cols = userData, *col;
-	drawDMEdgesSel_userData * data = userData;
+	drawDMEdgesSel_userData *data = userData;
 	unsigned char *col;
 
-	if (eed->h==0) {
-		if (eed==data->eed_act) {
+	eed = EDBM_edge_at_index(data->em, index);
+
+	if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
+		if (eed == data->eed_act) {
 			glColor4ubv(data->actCol);
-		} else {
-			if (eed->f&SELECT) {
+		}
+		else {
+			if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
 				col = data->selCol;
-			} else {
+			}
+			else {
 				col = data->baseCol;
 			}
 			/* no alpha, this is used so a transparent color can disable drawing unselected edges in editmode  */
-			if (col[3]==0) return 0;
+			if (col[3] == 0)
+				return DM_DRAW_OPTION_SKIP;
 			
 			glColor4ubv(col);
 		}
-		return 1;
-	} else {
-		return 0;
+		return DM_DRAW_OPTION_NORMAL;
+	}
+	else {
+		return DM_DRAW_OPTION_SKIP;
 	}
 }
-static void draw_dm_edges_sel(DerivedMesh *dm, unsigned char *baseCol, unsigned char *selCol, unsigned char *actCol, EditEdge *eed_act) 
+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;
 	
 	data.baseCol = baseCol;
 	data.selCol = selCol;
 	data.actCol = actCol;
+	data.em = em;
 	data.eed_act = eed_act;
 	dm->drawMappedEdges(dm, draw_dm_edges_sel__setDrawOptions, &data);
 }
 
-	/* Draw edges */
-static int draw_dm_edges__setDrawOptions(void *UNUSED(userData), int index)
+/* Draw edges */
+static DMDrawOption draw_dm_edges__setDrawOptions(void *userData, int index)
 {
-	return EM_get_edge_for_index(index)->h==0;
+	if (BM_elem_flag_test(EDBM_edge_at_index(userData, index), BM_ELEM_HIDDEN))
+		return DM_DRAW_OPTION_SKIP;
+	else
+		return DM_DRAW_OPTION_NORMAL;
 }
-static void draw_dm_edges(DerivedMesh *dm) 
+
+static void draw_dm_edges(BMEditMesh *em, DerivedMesh *dm) 
 {
-	dm->drawMappedEdges(dm, draw_dm_edges__setDrawOptions, NULL);
+	dm->drawMappedEdges(dm, draw_dm_edges__setDrawOptions, em);
 }
 
-	/* Draw edges with color interpolated based on selection */
-static int draw_dm_edges_sel_interp__setDrawOptions(void *UNUSED(userData), int index)
+/* Draw edges with color interpolated based on selection */
+static DMDrawOption draw_dm_edges_sel_interp__setDrawOptions(void *userData, int index)
 {
-	return EM_get_edge_for_index(index)->h==0;
+	if (BM_elem_flag_test(EDBM_edge_at_index(((void **)userData)[0], index), BM_ELEM_HIDDEN))
+		return DM_DRAW_OPTION_SKIP;
+	else
+		return DM_DRAW_OPTION_NORMAL;
 }
 static void draw_dm_edges_sel_interp__setDrawInterpOptions(void *userData, int index, float t)
 {
-	EditEdge *eed = EM_get_edge_for_index(index);
+	BMEdge *eed = EDBM_edge_at_index(((void **)userData)[0], index);
 	unsigned char **cols = userData;
-	unsigned char *col0 = cols[(eed->v1->f&SELECT)?1:0];
-	unsigned char *col1 = cols[(eed->v2->f&SELECT)?1:0];
+	unsigned char *col0 = cols[(BM_elem_flag_test(eed->v1, BM_ELEM_SELECT)) ? 2 : 1];
+	unsigned char *col1 = cols[(BM_elem_flag_test(eed->v2, BM_ELEM_SELECT)) ? 2 : 1];
 
-	glColor4ub(	col0[0] + (col1[0]-col0[0])*t,
-				col0[1] + (col1[1]-col0[1])*t,
-				col0[2] + (col1[2]-col0[2])*t,
-				col0[3] + (col1[3]-col0[3])*t);
+	glColor4ub(col0[0] + (col1[0] - col0[0]) * t,
+	           col0[1] + (col1[1] - col0[1]) * t,
+	           col0[2] + (col1[2] - col0[2]) * t,
+	           col0[3] + (col1[3] - col0[3]) * t);
 }
 
-static void draw_dm_edges_sel_interp(DerivedMesh *dm, unsigned char *baseCol, unsigned char *selCol)
+static void draw_dm_edges_sel_interp(BMEditMesh *em, DerivedMesh *dm, unsigned char *baseCol, unsigned char *selCol)
 {
-	unsigned char *cols[2];
-	cols[0]= baseCol;
-	cols[1]= selCol;
+	void *cols[3] = {em, baseCol, selCol};
+
 	dm->drawMappedEdgesInterp(dm, draw_dm_edges_sel_interp__setDrawOptions, draw_dm_edges_sel_interp__setDrawInterpOptions, cols);
 }
 
-	/* Draw only seam edges */
-static int draw_dm_edges_seams__setDrawOptions(void *UNUSED(userData), int index)
+/* Draw only seam edges */
+static DMDrawOption draw_dm_edges_seams__setDrawOptions(void *userData, int index)
 {
-	EditEdge *eed = EM_get_edge_for_index(index);
+	BMEdge *eed = EDBM_edge_at_index(userData, index);
 
-	return (eed->h==0 && eed->seam);
+	if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && BM_elem_flag_test(eed, BM_ELEM_SEAM))
+		return DM_DRAW_OPTION_NORMAL;
+	else
+		return DM_DRAW_OPTION_SKIP;
 }
-static void draw_dm_edges_seams(DerivedMesh *dm)
+
+static void draw_dm_edges_seams(BMEditMesh *em, DerivedMesh *dm)
 {
-	dm->drawMappedEdges(dm, draw_dm_edges_seams__setDrawOptions, NULL);
+	dm->drawMappedEdges(dm, draw_dm_edges_seams__setDrawOptions, em);
 }
 
-	/* Draw only sharp edges */
-static int draw_dm_edges_sharp__setDrawOptions(void *UNUSED(userData), int index)
+/* Draw only sharp edges */
+static DMDrawOption draw_dm_edges_sharp__setDrawOptions(void *userData, int index)
 {
-	EditEdge *eed = EM_get_edge_for_index(index);
+	BMEdge *eed = EDBM_edge_at_index(userData, index);
 
-	return (eed->h==0 && eed->sharp);
+	if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && !BM_elem_flag_test(eed, BM_ELEM_SMOOTH))
+		return DM_DRAW_OPTION_NORMAL;
+	else
+		return DM_DRAW_OPTION_SKIP;
 }
-static void draw_dm_edges_sharp(DerivedMesh *dm)
+
+static void draw_dm_edges_sharp(BMEditMesh *em, DerivedMesh *dm)
 {
-	dm->drawMappedEdges(dm, draw_dm_edges_sharp__setDrawOptions, NULL);
+	dm->drawMappedEdges(dm, draw_dm_edges_sharp__setDrawOptions, em);
 }
 
 
-	/* Draw faces with color set based on selection
-	 * return 2 for the active face so it renders with stipple enabled */
-static int draw_dm_faces_sel__setDrawOptions(void *userData, int index, int *UNUSED(drawSmooth_r))
+/* Draw faces with color set based on selection
+ * return 2 for the active face so it renders with stipple enabled */
+static DMDrawOption draw_dm_faces_sel__setDrawOptions(void *userData, int index)
 {
-	drawDMFacesSel_userData * data = userData;
-	EditFace *efa = EM_get_face_for_index(index);
+	drawDMFacesSel_userData *data = userData;
+	BMFace *efa = EDBM_face_at_index(data->em, index);
 	unsigned char *col;
 	
-	if (efa->h==0) {
+	if (!efa)
+		return DM_DRAW_OPTION_SKIP;
+	
+	if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
 		if (efa == data->efa_act) {
 			glColor4ubv(data->cols[2]);
-			return 2; /* stipple */
-		} else {
-			col = data->cols[(efa->f&SELECT)?1:0];
-			if (col[3]==0) return 0;
+			return DM_DRAW_OPTION_STIPPLE;
+		}
+		else {
+			col = data->cols[BM_elem_flag_test(efa, BM_ELEM_SELECT) ? 1 : 0];
+			if (col[3] == 0)
+				return DM_DRAW_OPTION_SKIP;
 			glColor4ubv(col);
-			return 1;
+			return DM_DRAW_OPTION_NORMAL;
 		}
 	}
-	return 0;
+	return DM_DRAW_OPTION_SKIP;
 }
 
 static int draw_dm_faces_sel__compareDrawOptions(void *userData, int index, int next_index)
 {
+
 	drawDMFacesSel_userData *data = userData;
-	EditFace *efa;
-	EditFace *next_efa;
+	BMFace *efa;
+	BMFace *next_efa;
+
 	unsigned char *col, *next_col;
 
-	if(!data->orig_index)
+	if (!data->orig_index)
 		return 0;
 
-	efa= EM_get_face_for_index(data->orig_index[index]);
-	next_efa= EM_get_face_for_index(data->orig_index[next_index]);
+	efa = EDBM_face_at_index(data->em, data->orig_index[index]);
+	next_efa = EDBM_face_at_index(data->em, data->orig_index[next_index]);
 
-	if(efa == next_efa)
+	if (efa == next_efa)
 		return 1;
 
-	if(efa == data->efa_act || next_efa == data->efa_act)
+	if (efa == data->efa_act || next_efa == data->efa_act)
 		return 0;
 
-	col = data->cols[(efa->f&SELECT)?1:0];
-	next_col = data->cols[(next_efa->f&SELECT)?1:0];
+	col = data->cols[BM_elem_flag_test(efa, BM_ELEM_SELECT) ? 1 : 0];
+	next_col = data->cols[BM_elem_flag_test(next_efa, BM_ELEM_SELECT) ? 1 : 0];
 
-	if(col[3]==0 || next_col[3]==0)
+	if (col[3] == 0 || next_col[3] == 0)
 		return 0;
 
 	return col == next_col;
 }
 
 /* also draws the active face */
-static void draw_dm_faces_sel(DerivedMesh *dm, unsigned char *baseCol, unsigned char *selCol, unsigned char *actCol, EditFace *efa_act) 
+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;
+	data.dm = dm;
 	data.cols[0] = baseCol;
+	data.em = em;
 	data.cols[1] = selCol;
 	data.cols[2] = actCol;
 	data.efa_act = efa_act;
-	data.orig_index = DM_get_face_data_layer(dm, CD_ORIGINDEX);
+	data.orig_index = DM_get_tessface_data_layer(dm, CD_ORIGINDEX);
 
 	dm->drawMappedFaces(dm, draw_dm_faces_sel__setDrawOptions, GPU_enable_material, draw_dm_faces_sel__compareDrawOptions, &data, 0);
 }
 
-static int draw_dm_creases__setDrawOptions(void *UNUSED(userData), int index)
+static DMDrawOption draw_dm_creases__setDrawOptions(void *userData, int index)
 {
-	EditEdge *eed = EM_get_edge_for_index(index);
-
-	if (eed->h==0 && eed->crease != 0.0f) {
-		UI_ThemeColorBlend(TH_WIRE, TH_EDGE_CREASE, eed->crease);
-		return 1;
-	} else {
-		return 0;
+	BMEditMesh *em = userData;
+	BMEdge *eed = EDBM_edge_at_index(userData, index);
+	float *crease = eed ? (float *)CustomData_bmesh_get(&em->bm->edata, eed->head.data, CD_CREASE) : NULL;
+	
+	if (!crease)
+		return DM_DRAW_OPTION_SKIP;
+	
+	if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && *crease != 0.0f) {
+		UI_ThemeColorBlend(TH_WIRE, TH_EDGE_CREASE, *crease);
+		return DM_DRAW_OPTION_NORMAL;
+	}
+	else {
+		return DM_DRAW_OPTION_SKIP;
 	}
 }
-static void draw_dm_creases(DerivedMesh *dm)
+static void draw_dm_creases(BMEditMesh *em, DerivedMesh *dm)
 {
 	glLineWidth(3.0);
-	dm->drawMappedEdges(dm, draw_dm_creases__setDrawOptions, NULL);
+	dm->drawMappedEdges(dm, draw_dm_creases__setDrawOptions, em);
 	glLineWidth(1.0);
 }
 
-static int draw_dm_bweights__setDrawOptions(void *UNUSED(userData), int index)
+static DMDrawOption draw_dm_bweights__setDrawOptions(void *userData, int index)
 {
-	EditEdge *eed = EM_get_edge_for_index(index);
+	BMEditMesh *em = userData;
+	BMEdge *eed = EDBM_edge_at_index(userData, index);
+	float *bweight = (float *)CustomData_bmesh_get(&em->bm->edata, eed->head.data, CD_BWEIGHT);
 
-	if (eed->h==0 && eed->bweight != 0.0f) {
-		UI_ThemeColorBlend(TH_WIRE, TH_EDGE_SELECT, eed->bweight);
-		return 1;
-	} else {
-		return 0;
+	if (!bweight)
+		return DM_DRAW_OPTION_SKIP;
+	
+	if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN) && *bweight != 0.0f) {
+		UI_ThemeColorBlend(TH_WIRE, TH_EDGE_SELECT, *bweight);
+		return DM_DRAW_OPTION_NORMAL;
+	}
+	else {
+		return DM_DRAW_OPTION_SKIP;
 	}
 }
-static void draw_dm_bweights__mapFunc(void *UNUSED(userData), int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
+static void draw_dm_bweights__mapFunc(void *userData, int index, const float co[3],
+                                      const float UNUSED(no_f[3]), const short UNUSED(no_s[3]))
 {
-	EditVert *eve = EM_get_vert_for_index(index);
-
-	if (eve->h==0 && eve->bweight != 0.0f) {
-		UI_ThemeColorBlend(TH_VERTEX, TH_VERTEX_SELECT, eve->bweight);
+	BMEditMesh *em = userData;
+	BMVert *eve = EDBM_vert_at_index(userData, index);
+	float *bweight = (float *)CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_BWEIGHT);
+	
+	if (!bweight)
+		return;
+	
+	if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN) && *bweight != 0.0f) {
+		UI_ThemeColorBlend(TH_VERTEX, TH_VERTEX_SELECT, *bweight);
 		bglVertex3fv(co);
 	}
 }
-static void draw_dm_bweights(Scene *scene, DerivedMesh *dm)
+static void draw_dm_bweights(BMEditMesh *em, Scene *scene, DerivedMesh *dm)
 {
-	ToolSettings *ts= scene->toolsettings;
+	ToolSettings *ts = scene->toolsettings;
 
 	if (ts->selectmode & SCE_SELECT_VERTEX) {
 		glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE) + 2);
 		bglBegin(GL_POINTS);
-		dm->foreachMappedVert(dm, draw_dm_bweights__mapFunc, NULL);
+		dm->foreachMappedVert(dm, draw_dm_bweights__mapFunc, em);
 		bglEnd();
 	}
 	else {
 		glLineWidth(3.0);
-		dm->drawMappedEdges(dm, draw_dm_bweights__setDrawOptions, NULL);
+		dm->drawMappedEdges(dm, draw_dm_bweights__setDrawOptions, em);
 		glLineWidth(1.0);
 	}
 }
@@ -2549,69 +2660,71 @@ static void draw_dm_bweights(Scene *scene, DerivedMesh *dm)
 
 /* EditMesh drawing routines*/
 
-static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit,
-                                DerivedMesh *cageDM, EditVert *eve_act)
+static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, 
+                                BMEditMesh *em, DerivedMesh *cageDM, BMVert *eve_act)
 {
-	ToolSettings *ts= scene->toolsettings;
+	ToolSettings *ts = scene->toolsettings;
 	int sel;
 
-	if(v3d->zbuf) glDepthMask(0);		// disable write in zbuffer, zbuf select
+	if (v3d->zbuf) glDepthMask(0);      // disable write in zbuffer, zbuf select
 
-	for (sel=0; sel<2; sel++) {
+	for (sel = 0; sel < 2; sel++) {
 		unsigned char col[4], fcol[4];
 		int pass;
 
-		UI_GetThemeColor3ubv(sel?TH_VERTEX_SELECT:TH_VERTEX, col);
-		UI_GetThemeColor3ubv(sel?TH_FACE_DOT:TH_WIRE, fcol);
+		UI_GetThemeColor3ubv(sel ? TH_VERTEX_SELECT : TH_VERTEX, col);
+		UI_GetThemeColor3ubv(sel ? TH_FACE_DOT : TH_WIRE, fcol);
 
-		for (pass=0; pass<2; pass++) {
+		for (pass = 0; pass < 2; pass++) {
 			float size = UI_GetThemeValuef(TH_VERTEX_SIZE);
 			float fsize = UI_GetThemeValuef(TH_FACEDOT_SIZE);
 
-			if (pass==0) {
-				if(v3d->zbuf && !(v3d->flag&V3D_ZBUF_SELECT)) {
+			if (pass == 0) {
+				if (v3d->zbuf && !(v3d->flag & V3D_ZBUF_SELECT)) {
 					glDisable(GL_DEPTH_TEST);
-						
+
 					glEnable(GL_BLEND);
-				} else {
+				}
+				else {
 					continue;
 				}
 
-				size = (size > 2.1f ? size/2.0f:size);
-				fsize = (fsize > 2.1f ? fsize/2.0f:fsize);
+				size = (size > 2.1f ? size / 2.0f : size);
+				fsize = (fsize > 2.1f ? fsize / 2.0f : fsize);
 				col[3] = fcol[3] = 100;
-			} else {
+			}
+			else {
 				col[3] = fcol[3] = 255;
 			}
-				
-			if(ts->selectmode & SCE_SELECT_VERTEX) {
+
+			if (ts->selectmode & SCE_SELECT_VERTEX) {
 				glPointSize(size);
 				glColor4ubv(col);
-				draw_dm_verts(cageDM, sel, eve_act);
+				draw_dm_verts(em, cageDM, sel, eve_act);
 			}
 			
-			if(check_ob_drawface_dot(scene, v3d, obedit->dt)) {
+			if (check_ob_drawface_dot(scene, v3d, obedit->dt)) {
 				glPointSize(fsize);
 				glColor4ubv(fcol);
-				draw_dm_face_centers(cageDM, sel);
+				draw_dm_face_centers(em, cageDM, sel);
 			}
 			
-			if (pass==0) {
+			if (pass == 0) {
 				glDisable(GL_BLEND);
 				glEnable(GL_DEPTH_TEST);
 			}
 		}
 	}
 
-	if(v3d->zbuf) glDepthMask(1);
+	if (v3d->zbuf) glDepthMask(1);
 	glPointSize(1.0);
 }
 
-static void draw_em_fancy_edges(Scene *scene, View3D *v3d,
+static void draw_em_fancy_edges(BMEditMesh *em, Scene *scene, View3D *v3d,
                                 Mesh *me, DerivedMesh *cageDM, short sel_only,
-                                EditEdge *eed_act)
+                                BMEdge *eed_act)
 {
-	ToolSettings *ts= scene->toolsettings;
+	ToolSettings *ts = scene->toolsettings;
 	int pass;
 	unsigned char wireCol[4], selCol[4], actCol[4];
 
@@ -2620,94 +2733,105 @@ static void draw_em_fancy_edges(Scene *scene, View3D *v3d,
 	UI_GetThemeColor4ubv(TH_WIRE, wireCol);
 	UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, actCol);
 	
-	/* when sel only is used, dont render wire, only selected, this is used for
+	/* when sel only is used, don't render wire, only selected, this is used for
 	 * textured draw mode when the 'edges' option is disabled */
 	if (sel_only)
 		wireCol[3] = 0;
 
-	for (pass=0; pass<2; pass++) {
-			/* show wires in transparant when no zbuf clipping for select */
-		if (pass==0) {
-			if (v3d->zbuf && (v3d->flag & V3D_ZBUF_SELECT)==0) {
+	for (pass = 0; pass < 2; pass++) {
+		/* show wires in transparant when no zbuf clipping for select */
+		if (pass == 0) {
+			if (v3d->zbuf && (v3d->flag & V3D_ZBUF_SELECT) == 0) {
 				glEnable(GL_BLEND);
 				glDisable(GL_DEPTH_TEST);
 				selCol[3] = 85;
 				if (!sel_only) wireCol[3] = 85;
-			} else {
+			}
+			else {
 				continue;
 			}
-		} else {
+		}
+		else {
 			selCol[3] = 255;
 			if (!sel_only) wireCol[3] = 255;
 		}
 
-		if(ts->selectmode == SCE_SELECT_FACE) {
-			draw_dm_edges_sel(cageDM, wireCol, selCol, actCol, eed_act);
-		}	
-		else if( (me->drawflag & ME_DRAWEDGES) || (ts->selectmode & SCE_SELECT_EDGE) ) {	
-			if(cageDM->drawMappedEdgesInterp && (ts->selectmode & SCE_SELECT_VERTEX)) {
+		if (ts->selectmode == SCE_SELECT_FACE) {
+			draw_dm_edges_sel(em, cageDM, wireCol, selCol, actCol, eed_act);
+		}
+		else if ( (me->drawflag & ME_DRAWEDGES) || (ts->selectmode & SCE_SELECT_EDGE) ) {
+			if (cageDM->drawMappedEdgesInterp && (ts->selectmode & SCE_SELECT_VERTEX)) {
 				glShadeModel(GL_SMOOTH);
-				draw_dm_edges_sel_interp(cageDM, wireCol, selCol);
+				draw_dm_edges_sel_interp(em, cageDM, wireCol, selCol);
 				glShadeModel(GL_FLAT);
-			} else {
-				draw_dm_edges_sel(cageDM, wireCol, selCol, actCol, eed_act);
+			}
+			else {
+				draw_dm_edges_sel(em, cageDM, wireCol, selCol, actCol, eed_act);
 			}
 		}
 		else {
 			if (!sel_only) {
 				glColor4ubv(wireCol);
-				draw_dm_edges(cageDM);
+				draw_dm_edges(em, cageDM);
 			}
 		}
 
-		if (pass==0) {
+		if (pass == 0) {
 			glDisable(GL_BLEND);
 			glEnable(GL_DEPTH_TEST);
 		}
 	}
 }	
 
-static void draw_em_measure_stats(View3D *v3d, Object *ob, EditMesh *em, UnitSettings *unit)
+static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitSettings *unit)
 {
-	Mesh *me= ob->data;
-	EditEdge *eed;
-	EditFace *efa;
-	float v1[3], v2[3], v3[3], v4[3], vmid[3];
-	float fvec[3];
+	const short txt_flag = V3D_CACHE_TEXT_ASCII | V3D_CACHE_TEXT_LOCALCLIP;
+	Mesh *me = ob->data;
+	float v1[3], v2[3], v3[3], vmid[3], fvec[3];
 	char numstr[32]; /* Stores the measurement display text here */
 	const char *conv_float; /* Use a float conversion matching the grid size */
-	unsigned char col[4]= {0, 0, 0, 255}; /* color of the text to draw */
+	unsigned char col[4] = {0, 0, 0, 255}; /* color of the text to draw */
 	float area; /* area of the face */
-	float grid= unit->system ? unit->scale_length : v3d->grid;
-	const int do_split= unit->flag & USER_UNIT_OPT_SPLIT;
-	const int do_global= v3d->flag & V3D_GLOBAL_STATS;
-	const int do_moving= G.moving;
+	float grid = unit->system ? unit->scale_length : v3d->grid;
+	const int do_split = unit->flag & USER_UNIT_OPT_SPLIT;
+	const int do_global = v3d->flag & V3D_GLOBAL_STATS;
+	const int do_moving = G.moving;
+
+	BMIter iter;
+	int i;
 
 	/* make the precision of the pronted value proportionate to the gridsize */
 
-	if (grid < 0.01f)		conv_float= "%.6g";
-	else if (grid < 0.1f)	conv_float= "%.5g";
-	else if (grid < 1.0f)	conv_float= "%.4g";
-	else if (grid < 10.0f)	conv_float= "%.3g";
-	else					conv_float= "%.2g";
+	if (grid < 0.01f) conv_float = "%.6g";
+	else if (grid < 0.1f) conv_float = "%.5g";
+	else if (grid < 1.0f) conv_float = "%.4g";
+	else if (grid < 10.0f) conv_float = "%.3g";
+	else conv_float = "%.2g";
 	
-	if(me->drawflag & ME_DRAWEXTRA_EDGELEN) {
+	if (me->drawflag & ME_DRAWEXTRA_EDGELEN) {
+		BMEdge *eed;
+
 		UI_GetThemeColor3ubv(TH_DRAWEXTRA_EDGELEN, col);
 
-		for(eed= em->edges.first; eed; eed= eed->next) {
-			/* draw non fgon edges, or selected edges, or edges next to selected verts while draging */
-			if((eed->h != EM_FGON) && ((eed->f & SELECT) || (do_moving && ((eed->v1->f & SELECT) || (eed->v2->f & SELECT)) ))) {
+		eed = BM_iter_new(&iter, em->bm, BM_EDGES_OF_MESH, NULL);
+		for (; eed; eed = BM_iter_step(&iter)) {
+			/* draw selected edges, or edges next to selected verts while draging */
+			if (BM_elem_flag_test(eed, BM_ELEM_SELECT) ||
+			    (do_moving && (BM_elem_flag_test(eed->v1, BM_ELEM_SELECT) ||
+			                   BM_elem_flag_test(eed->v2, BM_ELEM_SELECT))))
+			{
+
 				copy_v3_v3(v1, eed->v1->co);
 				copy_v3_v3(v2, eed->v2->co);
 
 				mid_v3_v3v3(vmid, v1, v2);
 
-				if(do_global) {
+				if (do_global) {
 					mul_mat3_m4_v3(ob->obmat, v1);
 					mul_mat3_m4_v3(ob->obmat, v2);
 				}
 
-				if(unit->system) {
+				if (unit->system) {
 					bUnit_AsString(numstr, sizeof(numstr), len_v3v3(v1, v2) * unit->scale_length, 3,
 					               unit->system, B_UNIT_LENGTH, do_split, FALSE);
 				}
@@ -2715,198 +2839,214 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, EditMesh *em, UnitSet
 					sprintf(numstr, conv_float, len_v3v3(v1, v2));
 				}
 
-				view3d_cached_text_draw_add(vmid, numstr, 0, V3D_CACHE_TEXT_ASCII, col);
+				view3d_cached_text_draw_add(vmid, numstr, 0, txt_flag, col);
 			}
 		}
 	}
 
-	if(me->drawflag & ME_DRAWEXTRA_FACEAREA) {
-// XXX		extern int faceselectedOR(EditFace *efa, int flag); // editmesh.h shouldn't be in this file... ok for now?
+	if (me->drawflag & ME_DRAWEXTRA_FACEAREA) {
+		/* would be nice to use BM_face_calc_area, but that is for 2d faces
+		 * so instead add up tessellation triangle areas */
+		BMFace *f;
+		int n;
+
+#define DRAW_EM_MEASURE_STATS_FACEAREA()                                      \
+	if (BM_elem_flag_test(f, BM_ELEM_SELECT)) {                               \
+		mul_v3_fl(vmid, 1.0 / n);                                             \
+		if (unit->system)                                                     \
+			bUnit_AsString(numstr, sizeof(numstr), area * unit->scale_length, \
+			               3, unit->system, B_UNIT_LENGTH, do_split, FALSE);  \
+		else                                                                  \
+			BLI_snprintf(numstr, sizeof(numstr), conv_float, area);           \
+		view3d_cached_text_draw_add(vmid, numstr, 0, txt_flag, col);          \
+	}
+
 		UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEAREA, col);
 		
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if((efa->f & SELECT)) { // XXX || (do_moving && faceselectedOR(efa, SELECT)) ) {
-				copy_v3_v3(v1, efa->v1->co);
-				copy_v3_v3(v2, efa->v2->co);
-				copy_v3_v3(v3, efa->v3->co);
-				if (efa->v4) {
-					copy_v3_v3(v4, efa->v4->co);
-				}
-				if(do_global) {
-					mul_mat3_m4_v3(ob->obmat, v1);
-					mul_mat3_m4_v3(ob->obmat, v2);
-					mul_mat3_m4_v3(ob->obmat, v3);
-					if (efa->v4) mul_mat3_m4_v3(ob->obmat, v4);
-				}
-				
-				if (efa->v4)
-					area=  area_quad_v3(v1, v2, v3, v4);
-				else
-					area = area_tri_v3(v1, v2, v3);
-
-				if(unit->system) {
-					// XXX should be B_UNIT_AREA
-					bUnit_AsString(numstr, sizeof(numstr), area * unit->scale_length, 3,
-					               unit->system, B_UNIT_LENGTH, do_split, FALSE);
-				}
-				else {
-					sprintf(numstr, conv_float, area);
-				}
-
-				view3d_cached_text_draw_add(efa->cent, numstr, 0, V3D_CACHE_TEXT_ASCII, col);
+		f = NULL;
+		area = 0.0;
+		zero_v3(vmid);
+		n = 0;
+		for (i = 0; i < em->tottri; i++) {
+			BMLoop **l = em->looptris[i];
+			if (f && l[0]->f != f) {
+				DRAW_EM_MEASURE_STATS_FACEAREA();
+				zero_v3(vmid);
+				area = 0.0;
+				n = 0;
+			}
+
+			f = l[0]->f;
+			copy_v3_v3(v1, l[0]->v->co);
+			copy_v3_v3(v2, l[1]->v->co);
+			copy_v3_v3(v3, l[2]->v->co);
+			if (do_global) {
+				mul_mat3_m4_v3(ob->obmat, v1);
+				mul_mat3_m4_v3(ob->obmat, v2);
+				mul_mat3_m4_v3(ob->obmat, v3);
 			}
+			area += area_tri_v3(v1, v2, v3);
+			add_v3_v3(vmid, v1);
+			add_v3_v3(vmid, v2);
+			add_v3_v3(vmid, v3);
+			n += 3;
+		}
+
+		if (f) {
+			DRAW_EM_MEASURE_STATS_FACEAREA();
 		}
+#undef DRAW_EM_MEASURE_STATS_FACEAREA
 	}
 
-	if(me->drawflag & ME_DRAWEXTRA_FACEANG) {
-		EditEdge *e1, *e2, *e3, *e4;
+	if (me->drawflag & ME_DRAWEXTRA_FACEANG) {
+		BMFace *efa;
+
 		UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEANG, col);
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			copy_v3_v3(v1, efa->v1->co);
-			copy_v3_v3(v2, efa->v2->co);
-			copy_v3_v3(v3, efa->v3->co);
-			if(efa->v4) {
-				copy_v3_v3(v4, efa->v4->co); 
-			}
-			else {
-				copy_v3_v3(v4, v3);
-			}
-			if(do_global) {
-				mul_mat3_m4_v3(ob->obmat, v1);
-				mul_mat3_m4_v3(ob->obmat, v2);
-				mul_mat3_m4_v3(ob->obmat, v3);
-				mul_mat3_m4_v3(ob->obmat, v4); /* intentionally executed even for tri's */
-			}
-			
-			e1= efa->e1;
-			e2= efa->e2;
-			e3= efa->e3;
-			if(efa->e4) e4= efa->e4; else e4= e3;
-			
-			/* Calculate the angles */
-				
-			if( (e4->f & e1->f & SELECT) || (do_moving && (efa->v1->f & SELECT)) ) {
-				/* Vec 1 */
-				sprintf(numstr,"%.3g", RAD2DEGF(angle_v3v3v3(v4, v1, v2)));
-				interp_v3_v3v3(fvec, efa->cent, efa->v1->co, 0.8f);
-				view3d_cached_text_draw_add(fvec, numstr, 0, V3D_CACHE_TEXT_ASCII, col);
-			}
-			if( (e1->f & e2->f & SELECT) || (do_moving && (efa->v2->f & SELECT)) ) {
-				/* Vec 2 */
-				sprintf(numstr,"%.3g", RAD2DEGF(angle_v3v3v3(v1, v2, v3)));
-				interp_v3_v3v3(fvec, efa->cent, efa->v2->co, 0.8f);
-				view3d_cached_text_draw_add(fvec, numstr, 0, V3D_CACHE_TEXT_ASCII, col);
-			}
-			if( (e2->f & e3->f & SELECT) || (do_moving && (efa->v3->f & SELECT)) ) {
-				/* Vec 3 */
-				if(efa->v4) 
-					sprintf(numstr,"%.3g", RAD2DEGF(angle_v3v3v3(v2, v3, v4)));
-				else
-					sprintf(numstr,"%.3g", RAD2DEGF(angle_v3v3v3(v2, v3, v1)));
-				interp_v3_v3v3(fvec, efa->cent, efa->v3->co, 0.8f);
-				view3d_cached_text_draw_add(fvec, numstr, 0, V3D_CACHE_TEXT_ASCII, col);
-			}
-				/* Vec 4 */
-			if(efa->v4) {
-				if( (e3->f & e4->f & SELECT) || (do_moving && (efa->v4->f & SELECT)) ) {
-					sprintf(numstr,"%.3g", RAD2DEGF(angle_v3v3v3(v3, v4, v1)));
-					interp_v3_v3v3(fvec, efa->cent, efa->v4->co, 0.8f);
-					view3d_cached_text_draw_add(fvec, numstr, 0, V3D_CACHE_TEXT_ASCII, col);
+
+
+		for (efa = BM_iter_new(&iter, em->bm, BM_FACES_OF_MESH, NULL);
+		     efa; efa = BM_iter_step(&iter))
+		{
+			BMIter liter;
+			BMLoop *loop;
+
+			BM_face_calc_center_bounds(efa, vmid);
+
+			for (loop = BM_iter_new(&liter, em->bm, BM_LOOPS_OF_FACE, efa);
+			     loop; loop = BM_iter_step(&liter))
+			{
+				float v1[3], v2[3], v3[3];
+
+				copy_v3_v3(v1, loop->prev->v->co);
+				copy_v3_v3(v2, loop->v->co);
+				copy_v3_v3(v3, loop->next->v->co);
+
+				if (do_global) {
+					mul_mat3_m4_v3(ob->obmat, v1);
+					mul_mat3_m4_v3(ob->obmat, v2);
+					mul_mat3_m4_v3(ob->obmat, v3);
+				}
+
+				if ( (BM_elem_flag_test(efa, BM_ELEM_SELECT)) ||
+				     (do_moving && BM_elem_flag_test(loop->v, BM_ELEM_SELECT)))
+				{
+					BLI_snprintf(numstr, sizeof(numstr), "%.3g", RAD2DEGF(angle_v3v3v3(v1, v2, v3)));
+					interp_v3_v3v3(fvec, vmid, v2, 0.8f);
+					view3d_cached_text_draw_add(fvec, numstr, 0, txt_flag, col);
 				}
 			}
 		}
 	}
 }
 
-static void draw_em_indices(EditMesh *em)
+static void draw_em_indices(BMEditMesh *em)
 {
-	EditEdge *e;
-	EditFace *f;
-	EditVert *v;
+	const short txt_flag = V3D_CACHE_TEXT_ASCII | V3D_CACHE_TEXT_LOCALCLIP;
+	BMEdge *e;
+	BMFace *f;
+	BMVert *v;
 	int i;
 	char numstr[32];
 	float pos[3];
 	unsigned char col[4];
 
-	/* For now, reuse appropriate theme colors from stats text colors */
+	BMIter iter;
+	BMesh *bm = em->bm;
 
+	/* For now, reuse appropriate theme colors from stats text colors */
+	i = 0;
 	if (em->selectmode & SCE_SELECT_VERTEX) {
 		UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEANG, col);
-		for (v = em->verts.first, i = 0; v; v = v->next, i++) {
-			if (v->f & SELECT) {
+		BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+			if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
 				sprintf(numstr, "%d", i);
-				view3d_cached_text_draw_add(v->co, numstr, 0, V3D_CACHE_TEXT_ASCII, col);
+				view3d_cached_text_draw_add(v->co, numstr, 0, txt_flag, col);
 			}
+			i++;
 		}
 	}
 
 	if (em->selectmode & SCE_SELECT_EDGE) {
+		i = 0;
 		UI_GetThemeColor3ubv(TH_DRAWEXTRA_EDGELEN, col);
-		for (e = em->edges.first, i = 0; e; e = e->next, i++) {
-			if (e->f & SELECT) {
+		BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+			if (BM_elem_flag_test(e, BM_ELEM_SELECT)) {
 				sprintf(numstr, "%d", i);
 				mid_v3_v3v3(pos, e->v1->co, e->v2->co);
-				view3d_cached_text_draw_add(pos, numstr, 0, V3D_CACHE_TEXT_ASCII, col);
+				view3d_cached_text_draw_add(pos, numstr, 0, txt_flag, col);
 			}
+			i++;
 		}
 	}
 
 	if (em->selectmode & SCE_SELECT_FACE) {
+		i = 0;
 		UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEAREA, col);
-		for (f = em->faces.first, i = 0; f; f = f->next, i++) {
-			if (f->f & SELECT) {
+		BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+			if (BM_elem_flag_test(f, BM_ELEM_SELECT)) {
+				BM_face_calc_center_mean(f, pos);
 				sprintf(numstr, "%d", i);
-				view3d_cached_text_draw_add(f->cent, numstr, 0, V3D_CACHE_TEXT_ASCII, col);
+				view3d_cached_text_draw_add(pos, numstr, 0, txt_flag, col);
 			}
+			i++;
 		}
 	}
 }
 
-static int draw_em_fancy__setFaceOpts(void *UNUSED(userData), int index, int *UNUSED(drawSmooth_r))
+static DMDrawOption draw_em_fancy__setFaceOpts(void *userData, int index)
 {
-	EditFace *efa = EM_get_face_for_index(index);
+	BMFace *efa = EDBM_face_at_index(userData, index);
 
-	if (efa->h==0) {
-		GPU_enable_material(efa->mat_nr+1, NULL);
-		return 1;
+	if (efa && !BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
+		GPU_enable_material(efa->mat_nr + 1, NULL);
+		return DM_DRAW_OPTION_NORMAL;
 	}
 	else
-		return 0;
+		return DM_DRAW_OPTION_SKIP;
 }
 
-static int draw_em_fancy__setGLSLFaceOpts(void *UNUSED(userData), int index)
+static DMDrawOption draw_em_fancy__setGLSLFaceOpts(void *userData, int index)
 {
-	EditFace *efa = EM_get_face_for_index(index);
+	BMFace *efa = EDBM_face_at_index(userData, index);
 
-	return (efa->h==0);
+	if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN))
+		return DM_DRAW_OPTION_SKIP;
+	else
+		return DM_DRAW_OPTION_NORMAL;
 }
 
 static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
-                          Object *ob, EditMesh *em, DerivedMesh *cageDM, DerivedMesh *finalDM, int dt)
+                          Object *ob, BMEditMesh *em, DerivedMesh *cageDM, DerivedMesh *finalDM, int dt)
+
 {
 	Mesh *me = ob->data;
-	EditFace *efa_act = EM_get_actFace(em, 0); /* annoying but active faces is stored differently */
-	EditEdge *eed_act = NULL;
-	EditVert *eve_act = NULL;
+	BMFace *efa_act = BM_active_face_get(em->bm, FALSE); /* annoying but active faces is stored differently */
+	BMEdge *eed_act = NULL;
+	BMVert *eve_act = NULL;
 	
-	if (em->selected.last) {
-		EditSelection *ese = em->selected.last;
+	if (em->bm->selected.last) {
+		BMEditSelection *ese = em->bm->selected.last;
 		/* face is handeled above */
-		/*if (ese->type == EDITFACE ) {
-			efa_act = (EditFace *)ese->data;
-		} else */ if ( ese->type == EDITEDGE ) {
-			eed_act = (EditEdge *)ese->data;
-		} else if ( ese->type == EDITVERT ) {
-			eve_act = (EditVert *)ese->data;
+#if 0
+		if (ese->type == BM_FACE) {
+			efa_act = (BMFace *)ese->data;
+		}
+		else 
+#endif
+		if (ese->htype == BM_EDGE) {
+			eed_act = (BMEdge *)ese->ele;
+		}
+		else if (ese->htype == BM_VERT) {
+			eve_act = (BMVert *)ese->ele;
 		}
 	}
 	
-	EM_init_index_arrays(em, 1, 1, 1);
+	EDBM_index_arrays_init(em, 1, 1, 1);
 
-	if(dt>OB_WIRE) {
-		if(CHECK_OB_DRAWTEXTURE(v3d, dt)) {
-			if(draw_glsl_material(scene, ob, v3d, dt)) {
-				glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
+	if (dt > OB_WIRE) {
+		if (check_object_draw_texture(scene, v3d, dt)) {
+			if (draw_glsl_material(scene, ob, v3d, dt)) {
+				glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW);
 
 				finalDM->drawMappedFacesGLSL(finalDM, GPU_enable_material,
 				                             draw_em_fancy__setGLSLFaceOpts, em);
@@ -2921,134 +3061,137 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d,
 		else {
 			/* 3 floats for position,
 			 * 3 for normal and times two because the faces may actually be quads instead of triangles */
-			glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, me->flag & ME_TWOSIDED);
+			glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, (me->flag & ME_TWOSIDED) ? GL_TRUE : GL_FALSE);
 
 			glEnable(GL_LIGHTING);
-			glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
-			finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts, GPU_enable_material, NULL, NULL, 0);
+			glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW);
+			finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts, GPU_enable_material, NULL, me->edit_btmesh, 0);
 
 			glFrontFace(GL_CCW);
 			glDisable(GL_LIGHTING);
+			glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
 		}
-			
+
 		// Setup for drawing wire over, disable zbuffer
 		// write to show selected edge wires better
 		UI_ThemeColor(TH_WIRE);
 
 		bglPolygonOffset(rv3d->dist, 1.0);
 		glDepthMask(0);
-	} 
+	}
 	else {
-		if (cageDM!=finalDM) {
+		if (cageDM != finalDM) {
 			UI_ThemeColorBlend(TH_WIRE, TH_BACK, 0.7);
 			finalDM->drawEdges(finalDM, 1, 0);
 		}
 	}
 	
-	if(me->drawflag & ME_DRAWFACES) {	/* transp faces */
+	if (me->drawflag & ME_DRAWFACES) {  /* transp faces */
 		unsigned char col1[4], col2[4], col3[4];
-			
+
 		UI_GetThemeColor4ubv(TH_FACE, col1);
 		UI_GetThemeColor4ubv(TH_FACE_SELECT, col2);
 		UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, col3);
 		
 		glEnable(GL_BLEND);
-		glDepthMask(0);		// disable write in zbuffer, needed for nice transp
+		glDepthMask(0);     // disable write in zbuffer, needed for nice transp
 		
-		/* dont draw unselected faces, only selected, this is MUCH nicer when texturing */
-		if CHECK_OB_DRAWTEXTURE(v3d, dt)
+		/* don't draw unselected faces, only selected, this is MUCH nicer when texturing */
+		if (check_object_draw_texture(scene, v3d, dt))
 			col1[3] = 0;
 		
-		draw_dm_faces_sel(cageDM, col1, col2, col3, efa_act);
+		draw_dm_faces_sel(em, cageDM, col1, col2, col3, efa_act);
 
 		glDisable(GL_BLEND);
-		glDepthMask(1);		// restore write in zbuffer
-	} else if (efa_act) {
+		glDepthMask(1);     // restore write in zbuffer
+	}
+	else if (efa_act) {
 		/* even if draw faces is off it would be nice to draw the stipple face
 		 * Make all other faces zero alpha except for the active
 		 * */
 		unsigned char col1[4], col2[4], col3[4];
-		col1[3] = col2[3] = 0; /* dont draw */
+		col1[3] = col2[3] = 0; /* don't draw */
 		UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, col3);
 		
 		glEnable(GL_BLEND);
-		glDepthMask(0);		// disable write in zbuffer, needed for nice transp
+		glDepthMask(0);     // disable write in zbuffer, needed for nice transp
 		
-		draw_dm_faces_sel(cageDM, col1, col2, col3, efa_act);
+		draw_dm_faces_sel(em, cageDM, col1, col2, col3, efa_act);
 
 		glDisable(GL_BLEND);
-		glDepthMask(1);		// restore write in zbuffer
+		glDepthMask(1);     // restore write in zbuffer
 		
 	}
 
 	/* here starts all fancy draw-extra over */
-	if((me->drawflag & ME_DRAWEDGES)==0 && CHECK_OB_DRAWTEXTURE(v3d, dt)) {
-		/* we are drawing textures and 'ME_DRAWEDGES' is disabled, dont draw any edges */
+	if ((me->drawflag & ME_DRAWEDGES) == 0 && check_object_draw_texture(scene, v3d, dt)) {
+		/* we are drawing textures and 'ME_DRAWEDGES' is disabled, don't draw any edges */
 		
 		/* only draw selected edges otherwise there is no way of telling if a face is selected */
-		draw_em_fancy_edges(scene, v3d, me, cageDM, 1, eed_act);
+		draw_em_fancy_edges(em, scene, v3d, me, cageDM, 1, eed_act);
 		
-	} else {
-		if(me->drawflag & ME_DRAWSEAMS) {
+	}
+	else {
+		if (me->drawflag & ME_DRAWSEAMS) {
 			UI_ThemeColor(TH_EDGE_SEAM);
 			glLineWidth(2);
-	
-			draw_dm_edges_seams(cageDM);
-	
-			glColor3ub(0,0,0);
+
+			draw_dm_edges_seams(em, cageDM);
+
+			glColor3ub(0, 0, 0);
 			glLineWidth(1);
 		}
 		
-		if(me->drawflag & ME_DRAWSHARP) {
+		if (me->drawflag & ME_DRAWSHARP) {
 			UI_ThemeColor(TH_EDGE_SHARP);
 			glLineWidth(2);
-	
-			draw_dm_edges_sharp(cageDM);
-	
-			glColor3ub(0,0,0);
+
+			draw_dm_edges_sharp(em, cageDM);
+
+			glColor3ub(0, 0, 0);
 			glLineWidth(1);
 		}
-	
-		if(me->drawflag & ME_DRAWCREASES) {
-			draw_dm_creases(cageDM);
+
+		if (me->drawflag & ME_DRAWCREASES && CustomData_has_layer(&em->bm->edata, CD_CREASE)) {
+			draw_dm_creases(em, cageDM);
 		}
-		if(me->drawflag & ME_DRAWBWEIGHTS) {
-			draw_dm_bweights(scene, cageDM);
+		if (me->drawflag & ME_DRAWBWEIGHTS) {
+			draw_dm_bweights(em, scene, cageDM);
 		}
 
-		draw_em_fancy_edges(scene, v3d, me, cageDM, 0, eed_act);
+		draw_em_fancy_edges(em, scene, v3d, me, cageDM, 0, eed_act);
 	}
-	if(em) {
-		draw_em_fancy_verts(scene, v3d, ob, cageDM, eve_act);
+	if (em) {
+		draw_em_fancy_verts(scene, v3d, ob, em, cageDM, eve_act);
 
-		if(me->drawflag & ME_DRAWNORMALS) {
+		if (me->drawflag & ME_DRAWNORMALS) {
 			UI_ThemeColor(TH_NORMAL);
-			draw_dm_face_normals(scene, cageDM);
+			draw_dm_face_normals(em, scene, cageDM);
 		}
-		if(me->drawflag & ME_DRAW_VNORMALS) {
+		if (me->drawflag & ME_DRAW_VNORMALS) {
 			UI_ThemeColor(TH_VNORMAL);
-			draw_dm_vert_normals(scene, cageDM);
+			draw_dm_vert_normals(em, scene, cageDM);
 		}
 
-		if ( (me->drawflag & (ME_DRAWEXTRA_EDGELEN|ME_DRAWEXTRA_FACEAREA|ME_DRAWEXTRA_FACEANG)) &&
+		if ( (me->drawflag & (ME_DRAWEXTRA_EDGELEN | ME_DRAWEXTRA_FACEAREA | ME_DRAWEXTRA_FACEANG)) &&
 		     !(v3d->flag2 & V3D_RENDER_OVERRIDE))
 		{
 			draw_em_measure_stats(v3d, ob, em, &scene->unit);
 		}
 
-		if ((G.f & G_DEBUG) && (me->drawflag & ME_DRAWEXTRA_INDICES) &&
+		if ((G.debug & G_DEBUG) && (me->drawflag & ME_DRAWEXTRA_INDICES) &&
 		    !(v3d->flag2 & V3D_RENDER_OVERRIDE)) {
 			draw_em_indices(em);
 		}
 	}
 
-	if(dt>OB_WIRE) {
+	if (dt > OB_WIRE) {
 		glDepthMask(1);
 		bglPolygonOffset(rv3d->dist, 0.0);
 		GPU_disable_material();
 	}
 
-	EM_free_index_arrays();
+	EDBM_index_arrays_free(em);
 }
 
 /* Mesh drawing routines */
@@ -3056,14 +3199,16 @@ 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==0) {	// not when we draw the transparent pass
+	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) {
-			glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); 
+		 * drawFacesSolid() doesn't draw the transparent faces */
+		if (ob->dtx & OB_DRAWTRANSP) {
+			glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
 			dm->drawFacesSolid(dm, NULL, 0, GPU_enable_material);
 			glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
 			GPU_disable_material();
@@ -3071,70 +3216,64 @@ static void draw_mesh_object_outline(View3D *v3d, Object *ob, DerivedMesh *dm)
 		else {
 			dm->drawEdges(dm, 0, 1);
 		}
-					
+
 		glLineWidth(1.0);
 		glDepthMask(1);
 	}
 }
 
-static int wpaint__setSolidDrawOptions(void *UNUSED(userData), int UNUSED(index), int *drawSmooth_r)
-{
-	*drawSmooth_r = 1;
-	return 1;
-}
-
 static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base, int dt, int flag)
 {
-	Object *ob= base->object;
+	Object *ob = base->object;
 	Mesh *me = ob->data;
-	Material *ma= give_current_material(ob, 1);
+	Material *ma = give_current_material(ob, 1);
 	const short hasHaloMat = (ma && (ma->material_type == MA_TYPE_HALO));
-	eWireDrawMode draw_wire= OBDRAW_WIRE_OFF;
+	eWireDrawMode draw_wire = OBDRAW_WIRE_OFF;
 	int /* totvert,*/ totedge, totface;
-	DerivedMesh *dm= mesh_get_derived_final(scene, ob, scene->customdata_mask);
-	const short is_obact= (ob == OBACT);
+	DerivedMesh *dm = mesh_get_derived_final(scene, ob, scene->customdata_mask);
+	const short is_obact = (ob == OBACT);
 	int draw_flags = (is_obact && paint_facesel_test(ob)) ? DRAW_FACE_SELECT : 0;
 
-	if(!dm)
+	if (!dm)
 		return;
 
 	/* Check to draw dynamic paint colors (or weights from WeightVG modifiers).
 	 * Note: Last "preview-active" modifier in stack will win! */
-	if(DM_get_face_data_layer(dm, CD_WEIGHT_MCOL) && modifiers_isPreview(ob))
+	if (DM_get_tessface_data_layer(dm, CD_PREVIEW_MCOL) && modifiers_isPreview(ob))
 		draw_flags |= DRAW_MODIFIERS_PREVIEW;
 
 	/* Unwanted combination */
 	if (draw_flags & DRAW_FACE_SELECT) {
-		draw_wire= OBDRAW_WIRE_OFF;
+		draw_wire = OBDRAW_WIRE_OFF;
 	}
 	else if (ob->dtx & OB_DRAWWIRE) {
-		draw_wire= OBDRAW_WIRE_ON_DEPTH; /* draw wire after solid using zoffset and depth buffer adjusment */
+		draw_wire = OBDRAW_WIRE_ON_DEPTH; /* draw wire after solid using zoffset and depth buffer adjusment */
 	}
 	
 	/* totvert = dm->getNumVerts(dm); */ /*UNUSED*/
 	totedge = dm->getNumEdges(dm);
-	totface = dm->getNumFaces(dm);
+	totface = dm->getNumTessFaces(dm);
 	
 	/* vertexpaint, faceselect wants this, but it doesnt work for shaded? */
-	glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
+	glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW);
 
-	if(dt==OB_BOUNDBOX) {
-		if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
+	if (dt == OB_BOUNDBOX) {
+		if (((v3d->flag2 & V3D_RENDER_OVERRIDE) && v3d->drawtype >= OB_WIRE) == 0)
 			draw_bounding_volume(scene, ob, ob->boundtype);
 	}
-	else if(hasHaloMat || (totface==0 && totedge==0)) {
+	else if (hasHaloMat || (totface == 0 && totedge == 0)) {
 		glPointSize(1.5);
 		dm->drawVerts(dm);
 		glPointSize(1.0);
 	}
-	else if(dt==OB_WIRE || totface==0) {
-		draw_wire= OBDRAW_WIRE_ON; /* draw wire only, no depth buffer stuff  */
+	else if (dt == OB_WIRE || totface == 0) {
+		draw_wire = OBDRAW_WIRE_ON; /* draw wire only, no depth buffer stuff  */
 	}
 	else if ( (draw_flags & DRAW_FACE_SELECT || (is_obact && ob->mode & OB_MODE_TEXTURE_PAINT)) ||
-	          CHECK_OB_DRAWTEXTURE(v3d, dt))
+	          check_object_draw_texture(scene, v3d, dt))
 	{
 		if ( (v3d->flag & V3D_SELECT_OUTLINE) &&
-		     ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) &&
+		     ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) &&
 		     (base->flag & SELECT) &&
 		     !(G.f & G_PICKSEL || (draw_flags & DRAW_FACE_SELECT)) &&
 		     (draw_wire == OBDRAW_WIRE_OFF))
@@ -3142,11 +3281,11 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
 			draw_mesh_object_outline(v3d, ob, dm);
 		}
 
-		if(draw_glsl_material(scene, ob, v3d, dt) && !(draw_flags & DRAW_MODIFIERS_PREVIEW)) {
-			glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
+		if (draw_glsl_material(scene, ob, v3d, dt) && !(draw_flags & DRAW_MODIFIERS_PREVIEW)) {
+			glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW);
 
 			dm->drawFacesGLSL(dm, GPU_enable_material);
-//			if(get_ob_property(ob, "Text"))
+//			if (get_ob_property(ob, "Text"))
 // XXX				draw_mesh_text(ob, 1);
 			GPU_disable_material();
 
@@ -3156,25 +3295,26 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
 			draw_mesh_textured(scene, v3d, rv3d, ob, dm, draw_flags);
 		}
 
-		if(!(draw_flags & DRAW_FACE_SELECT)) {
-			if(base->flag & SELECT)
+		if (!(draw_flags & DRAW_FACE_SELECT)) {
+			if (base->flag & SELECT)
 				UI_ThemeColor(is_obact ? TH_ACTIVE : TH_SELECT);
 			else
 				UI_ThemeColor(TH_WIRE);
 
-			if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0)
+			if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0)
 				dm->drawLooseEdges(dm);
 		}
 	}
-	else if(dt==OB_SOLID) {
-		if(is_obact && ob->mode & OB_MODE_WEIGHT_PAINT) {
+	else if (dt == OB_SOLID) {
+		if (is_obact && ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)) {
 			/* weight paint in solid mode, special case. focus on making the weights clear
 			 * rather than the shading, this is also forced in wire view */
 			GPU_enable_material(0, NULL);
-			dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, GPU_enable_material, NULL, me->mface, 1);
-		
+			dm->drawMappedFaces(dm, NULL, GPU_enable_material, NULL, me->mpoly,
+			                    DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
+
 			bglPolygonOffset(rv3d->dist, 1.0);
-			glDepthMask(0);	// disable write in zbuffer, selected edge wires show better
+			glDepthMask(0); // disable write in zbuffer, selected edge wires show better
 
 			glEnable(GL_BLEND);
 			glColor4ub(255, 255, 255, 96);
@@ -3190,18 +3330,18 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
 
 			GPU_disable_material();
 			
-			/* since we already draw wire as wp guide, dont draw over the top */
-			draw_wire= OBDRAW_WIRE_OFF;
+			/* since we already draw wire as wp guide, don't draw over the top */
+			draw_wire = OBDRAW_WIRE_OFF;
 		}
 		else if (draw_flags & DRAW_MODIFIERS_PREVIEW) {
 			/* for object selection draws no shade */
-			if (flag & (DRAW_PICKING|DRAW_CONSTCOLOR)) {
+			if (flag & (DRAW_PICKING | DRAW_CONSTCOLOR)) {
 				dm->drawFacesSolid(dm, NULL, 0, GPU_enable_material);
 			}
 			else {
 				/* draw outline */
 				if ( (v3d->flag & V3D_SELECT_OUTLINE) &&
-				     ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) &&
+				     ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) &&
 				     (base->flag & SELECT) &&
 				     (draw_wire == OBDRAW_WIRE_OFF) &&
 				     (ob->sculpt == NULL))
@@ -3216,7 +3356,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
 				
 				/* set default spec */
 				glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
-				glEnable(GL_COLOR_MATERIAL);	/* according manpages needed */
+				glEnable(GL_COLOR_MATERIAL);    /* according manpages needed */
 				glColor3ub(120, 120, 120);
 				glDisable(GL_COLOR_MATERIAL);
 				/* diffuse */
@@ -3224,7 +3364,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
 				glEnable(GL_LIGHTING);
 				glEnable(GL_COLOR_MATERIAL);
 
-				dm->drawMappedFaces(dm, NULL, GPU_enable_material, NULL, NULL, 1);
+				dm->drawMappedFaces(dm, NULL, GPU_enable_material, NULL, NULL, DM_DRAW_USE_COLORS);
 				glDisable(GL_COLOR_MATERIAL);
 				glDisable(GL_LIGHTING);
 
@@ -3235,7 +3375,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
 			Paint *p;
 
 			if ( (v3d->flag & V3D_SELECT_OUTLINE) &&
-			     ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) &&
+			     ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) &&
 			     (base->flag & SELECT) &&
 			     (draw_wire == OBDRAW_WIRE_OFF) &&
 			     (ob->sculpt == NULL))
@@ -3243,18 +3383,18 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
 				draw_mesh_object_outline(v3d, ob, dm);
 			}
 
-			glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, me->flag & ME_TWOSIDED );
+			glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, (me->flag & ME_TWOSIDED) ? GL_TRUE : GL_FALSE);
 
 			glEnable(GL_LIGHTING);
-			glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
+			glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW);
 
-			if(ob->sculpt && (p=paint_get_active(scene))) {
+			if (ob->sculpt && (p = paint_get_active(scene))) {
 				float planes[4][4];
 				float (*fpl)[4] = NULL;
-				int fast= (p->flags & PAINT_FAST_NAVIGATE) && (rv3d->rflag & RV3D_NAVIGATING);
+				int fast = (p->flags & PAINT_FAST_NAVIGATE) && (rv3d->rflag & RV3D_NAVIGATING);
 
-				if(ob->sculpt->partial_redraw) {
-					if(ar->do_draw & RGN_DRAW_PARTIAL) {
+				if (ob->sculpt->partial_redraw) {
+					if (ar->do_draw & RGN_DRAW_PARTIAL) {
 						sculpt_get_redraw_planes(planes, ar, rv3d, ob);
 						fpl = planes;
 						ob->sculpt->partial_redraw = 0;
@@ -3271,24 +3411,27 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
 			glFrontFace(GL_CCW);
 			glDisable(GL_LIGHTING);
 
-			if(base->flag & SELECT) {
+			glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
+
+			if (base->flag & SELECT) {
 				UI_ThemeColor(is_obact ? TH_ACTIVE : TH_SELECT);
-			} else {
+			}
+			else {
 				UI_ThemeColor(TH_WIRE);
 			}
-			if(!ob->sculpt && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0)
+			if (!ob->sculpt && (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0)
 				dm->drawLooseEdges(dm);
 		}
 	}
-	else if(dt==OB_PAINT) {
+	else if (dt == OB_PAINT) {
 		if (is_obact) {
-			if(ob && ob->mode & OB_MODE_WEIGHT_PAINT) {
+			if (ob && ob->mode & OB_MODE_WEIGHT_PAINT) {
 				/* enforce default material settings */
 				GPU_enable_material(0, NULL);
 				
 				/* but set default spec */
 				glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
-				glEnable(GL_COLOR_MATERIAL);	/* according manpages needed */
+				glEnable(GL_COLOR_MATERIAL);    /* according manpages needed */
 				glColor3ub(120, 120, 120);
 				glDisable(GL_COLOR_MATERIAL);
 				/* diffuse */
@@ -3296,40 +3439,44 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
 				glEnable(GL_LIGHTING);
 				glEnable(GL_COLOR_MATERIAL);
 
-				dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, GPU_enable_material, NULL, me->mface, 1);
+				dm->drawMappedFaces(dm, NULL, GPU_enable_material, NULL, me->mpoly,
+				                    DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
 				glDisable(GL_COLOR_MATERIAL);
 				glDisable(GL_LIGHTING);
 
 				GPU_disable_material();
 			}
-			else if(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_TEXTURE_PAINT)) {
-				if(me->mcol)
-					dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, GPU_enable_material, NULL, NULL, 1);
+			else if (ob->mode & OB_MODE_VERTEX_PAINT) {
+				if (me->mloopcol)
+					dm->drawMappedFaces(dm, NULL, GPU_enable_material, NULL, NULL,
+					                    DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH);
 				else {
 					glColor3f(1.0f, 1.0f, 1.0f);
-					dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, GPU_enable_material, NULL, NULL, 0);
+					dm->drawMappedFaces(dm, NULL, GPU_enable_material, NULL, NULL,
+					                    DM_DRAW_ALWAYS_SMOOTH);
 				}
 			}
 		}
 	}
 	
 	/* set default draw color back for wire or for draw-extra later on */
-	if (dt!=OB_WIRE) {
-		if(base->flag & SELECT) {
+	if (dt != OB_WIRE) {
+		if (base->flag & SELECT) {
 			if (is_obact && ob->flag & OB_FROMGROUP)
 				UI_ThemeColor(TH_GROUP_ACTIVE);
-			else if(ob->flag & OB_FROMGROUP) 
+			else if (ob->flag & OB_FROMGROUP)
 				UI_ThemeColorShade(TH_GROUP_ACTIVE, -16);
-			else if(flag!=DRAW_CONSTCOLOR)
+			else if (flag != DRAW_CONSTCOLOR)
 				UI_ThemeColor(is_obact ? TH_ACTIVE : TH_SELECT);
 			else
-				glColor3ub(80,80,80);
-		} else {
-			if (ob->flag & OB_FROMGROUP) 
+				glColor3ub(80, 80, 80);
+		}
+		else {
+			if (ob->flag & OB_FROMGROUP)
 				UI_ThemeColor(TH_GROUP);
 			else {
-				if(ob->dtx & OB_DRAWWIRE && flag==DRAW_CONSTCOLOR)
-					glColor3ub(80,80,80);
+				if (ob->dtx & OB_DRAWWIRE && flag == DRAW_CONSTCOLOR)
+					glColor3ub(80, 80, 80);
 				else
 					UI_ThemeColor(TH_WIRE);
 			}
@@ -3337,10 +3484,10 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
 	}
 	if (draw_wire != OBDRAW_WIRE_OFF) {
 
-		/* When using wireframe object traw in particle edit mode
+		/* When using wireframe object draw in particle edit mode
 		 * the mesh gets in the way of seeing the particles, fade the wire color
 		 * with the background. */
-		if(is_obact && (ob->mode & OB_MODE_PARTICLE_EDIT)) {
+		if (is_obact && (ob->mode & OB_MODE_PARTICLE_EDIT)) {
 			float col_wire[4], col_bg[4], col[3];
 
 			UI_GetThemeColor3fv(TH_BACK, col_bg);
@@ -3358,21 +3505,21 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
 		 * if draw wire is 1 then just drawing wire, no need for depth buffer stuff,
 		 * otherwise this wire is to overlay solid mode faces so do some depth buffer tricks.
 		 */
-		if (dt!=OB_WIRE && (draw_wire == OBDRAW_WIRE_ON_DEPTH)) {
+		if (dt != OB_WIRE && (draw_wire == OBDRAW_WIRE_ON_DEPTH)) {
 			bglPolygonOffset(rv3d->dist, 1.0);
-			glDepthMask(0);	// disable write in zbuffer, selected edge wires show better
+			glDepthMask(0); // disable write in zbuffer, selected edge wires show better
 		}
 		
-		if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_SOLID)==0)
-			dm->drawEdges(dm, (dt==OB_WIRE || totface==0), me->drawflag & ME_ALLEDGES);
+		if (((v3d->flag2 & V3D_RENDER_OVERRIDE) && v3d->drawtype >= OB_SOLID) == 0)
+			dm->drawEdges(dm, (dt == OB_WIRE || totface == 0), me->drawflag & ME_ALLEDGES);
 
-		if (dt!=OB_WIRE && (draw_wire == OBDRAW_WIRE_ON_DEPTH)) {
+		if (dt != OB_WIRE && (draw_wire == OBDRAW_WIRE_ON_DEPTH)) {
 			glDepthMask(1);
 			bglPolygonOffset(rv3d->dist, 0.0);
 		}
 	}
 	
-	if(is_obact && paint_vertsel_test(ob)) {
+	if (is_obact && paint_vertsel_test(ob)) {
 		
 		glColor3f(0.0f, 0.0f, 0.0f);
 		glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
@@ -3387,39 +3534,39 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
 /* returns 1 if nothing was drawn, for detecting to draw an object center */
 static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, Base *base, int dt, int flag)
 {
-	Object *ob= base->object;
-	Object *obedit= scene->obedit;
-	Mesh *me= ob->data;
-	EditMesh *em= me->edit_mesh;
-	int do_alpha_after= 0, drawlinked= 0, retval= 0, glsl, check_alpha, i;
+	Object *ob = base->object;
+	Object *obedit = scene->obedit;
+	Mesh *me = ob->data;
+	BMEditMesh *em = me->edit_btmesh;
+	int do_alpha_after = 0, drawlinked = 0, retval = 0, glsl, check_alpha, i;
 
 	/* If we are drawing shadows and any of the materials don't cast a shadow,
 	 * then don't draw the object */
 	if (v3d->flag2 & V3D_RENDER_SHADOW) {
-		for(i=0; i<ob->totcol; ++i) {
-			Material *ma= give_current_material(ob, i);
+		for (i = 0; i < ob->totcol; ++i) {
+			Material *ma = give_current_material(ob, i);
 			if (ma && !(ma->mode & MA_SHADBUF)) {
 				return 1;
 			}
 		}
 	}
 	
-	if(obedit && ob!=obedit && ob->data==obedit->data) {
-		if(ob_get_key(ob) || ob_get_key(obedit));
-		else if(ob->modifiers.first || obedit->modifiers.first);
-		else drawlinked= 1;
+	if (obedit && ob != obedit && ob->data == obedit->data) {
+		if (ob_get_key(ob) || ob_get_key(obedit)) {}
+		else if (ob->modifiers.first || obedit->modifiers.first) {}
+		else drawlinked = 1;
 	}
 	
-	if(ob==obedit || drawlinked) {
+	if (ob == obedit || drawlinked) {
 		DerivedMesh *finalDM, *cageDM;
 		
-		if (obedit!=ob)
-			finalDM = cageDM = editmesh_get_derived_base(ob, em);
+		if (obedit != ob)
+			finalDM = cageDM = editbmesh_get_derived_base(ob, em);
 		else
-			cageDM = editmesh_get_derived_cage_and_final(scene, ob, em, &finalDM,
-											scene->customdata_mask);
+			cageDM = editbmesh_get_derived_cage_and_final(scene, ob, em, &finalDM,
+			                                              scene->customdata_mask);
 
-		if(dt>OB_WIRE) {
+		if (dt > OB_WIRE) {
 			glsl = draw_glsl_material(scene, ob, v3d, dt);
 
 			GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, NULL);
@@ -3429,40 +3576,40 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
 
 		GPU_end_object_materials();
 
-		if (obedit!=ob && finalDM)
+		if (obedit != ob && finalDM)
 			finalDM->release(finalDM);
 	}
 	else {
 		/* don't create boundbox here with mesh_get_bb(), the derived system will make it, puts deformed bb's OK */
-		if(me->totface<=4 || ED_view3d_boundbox_clip(rv3d, ob->obmat, (ob->bb)? ob->bb: me->bb)) {
+		if (me->totpoly <= 4 || ED_view3d_boundbox_clip(rv3d, ob->obmat, (ob->bb) ? ob->bb : me->bb)) {
 			glsl = draw_glsl_material(scene, ob, v3d, dt);
 			check_alpha = check_alpha_pass(base);
 
-			if(dt==OB_SOLID || glsl) {
+			if (dt == OB_SOLID || glsl) {
 				GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl,
-					(check_alpha)? &do_alpha_after: NULL);
+				                           (check_alpha) ? &do_alpha_after : NULL);
 			}
 
 			draw_mesh_fancy(scene, ar, v3d, rv3d, base, dt, flag);
 
 			GPU_end_object_materials();
 			
-			if(me->totvert==0) retval= 1;
+			if (me->totvert == 0) retval = 1;
 		}
 	}
 	
 	/* GPU_begin_object_materials checked if this is needed */
-	if(do_alpha_after) {
-		if(ob->dtx & OB_DRAWXRAY) {
+	if (do_alpha_after) {
+		if (ob->dtx & OB_DRAWXRAY) {
 			add_view3d_after(&v3d->afterdraw_xraytransp, base, flag);
 		}
 		else {
 			add_view3d_after(&v3d->afterdraw_transp, base, flag);
 		}
 	}
-	else if(ob->dtx & OB_DRAWXRAY && ob->dtx & OB_DRAWTRANSP) {
+	else if (ob->dtx & OB_DRAWXRAY && ob->dtx & OB_DRAWTRANSP) {
 		/* special case xray+transp when alpha is 1.0, without this the object vanishes */
-		if(v3d->xray == 0 && v3d->transp == 0) {
+		if (v3d->xray == 0 && v3d->transp == 0) {
 			add_view3d_after(&v3d->afterdraw_xray, base, flag);
 		}
 	}
@@ -3472,8 +3619,8 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
 
 /* ************** DRAW DISPLIST ****************** */
 
-static int draw_index_wire= 1;
-static int index3_nors_incr= 1;
+static int draw_index_wire = 1;
+static int index3_nors_incr = 1;
 
 /* returns 1 when nothing was drawn */
 static int drawDispListwire(ListBase *dlbase)
@@ -3482,87 +3629,87 @@ static int drawDispListwire(ListBase *dlbase)
 	int parts, nr;
 	float *data;
 
-	if(dlbase==NULL) return 1;
+	if (dlbase == NULL) return 1;
 	
 	glEnableClientState(GL_VERTEX_ARRAY);
-	glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); 
+	glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
 
-	for(dl= dlbase->first; dl; dl= dl->next) {
-		if(dl->parts==0 || dl->nr==0)
+	for (dl = dlbase->first; dl; dl = dl->next) {
+		if (dl->parts == 0 || dl->nr == 0)
 			continue;
 		
-		data= dl->verts;
-	
-		switch(dl->type) {
-		case DL_SEGM:
-			
-			glVertexPointer(3, GL_FLOAT, 0, data);
-			
-			for(parts=0; parts<dl->parts; parts++)
-				glDrawArrays(GL_LINE_STRIP, parts*dl->nr, dl->nr);
-				
-			break;
-		case DL_POLY:
-			
-			glVertexPointer(3, GL_FLOAT, 0, data);
-			
-			for(parts=0; parts<dl->parts; parts++)
-				glDrawArrays(GL_LINE_LOOP, parts*dl->nr, dl->nr);
-			
-			break;
-		case DL_SURF:
-			
-			glVertexPointer(3, GL_FLOAT, 0, data);
-			
-			for(parts=0; parts<dl->parts; parts++) {
-				if(dl->flag & DL_CYCL_U) 
-					glDrawArrays(GL_LINE_LOOP, parts*dl->nr, dl->nr);
-				else
-					glDrawArrays(GL_LINE_STRIP, parts*dl->nr, dl->nr);
-			}
-			
-			for(nr=0; nr<dl->nr; nr++) {
-				int ofs= 3*dl->nr;
-				
-				data= (  dl->verts )+3*nr;
-				parts= dl->parts;
+		data = dl->verts;
+
+		switch (dl->type) {
+			case DL_SEGM:
 
-				if(dl->flag & DL_CYCL_V) glBegin(GL_LINE_LOOP);
-				else glBegin(GL_LINE_STRIP);
+				glVertexPointer(3, GL_FLOAT, 0, data);
+
+				for (parts = 0; parts < dl->parts; parts++)
+					glDrawArrays(GL_LINE_STRIP, parts * dl->nr, dl->nr);
 				
-				while(parts--) {
-					glVertex3fv(data);
-					data+=ofs;
+				break;
+			case DL_POLY:
+
+				glVertexPointer(3, GL_FLOAT, 0, data);
+
+				for (parts = 0; parts < dl->parts; parts++)
+					glDrawArrays(GL_LINE_LOOP, parts * dl->nr, dl->nr);
+
+				break;
+			case DL_SURF:
+
+				glVertexPointer(3, GL_FLOAT, 0, data);
+
+				for (parts = 0; parts < dl->parts; parts++) {
+					if (dl->flag & DL_CYCL_U)
+						glDrawArrays(GL_LINE_LOOP, parts * dl->nr, dl->nr);
+					else
+						glDrawArrays(GL_LINE_STRIP, parts * dl->nr, dl->nr);
 				}
-				glEnd();
-				
-				/* (ton) this code crashes for me when resolv is 86 or higher... no clue */
+
+				for (nr = 0; nr < dl->nr; nr++) {
+					int ofs = 3 * dl->nr;
+
+					data = (dl->verts) + 3 * nr;
+					parts = dl->parts;
+
+					if (dl->flag & DL_CYCL_V) glBegin(GL_LINE_LOOP);
+					else glBegin(GL_LINE_STRIP);
+
+					while (parts--) {
+						glVertex3fv(data);
+						data += ofs;
+					}
+					glEnd();
+
+/* (ton) this code crashes for me when resolv is 86 or higher... no clue */
 //				glVertexPointer(3, GL_FLOAT, sizeof(float)*3*dl->nr, data + 3*nr);
-//				if(dl->flag & DL_CYCL_V) 
+//				if (dl->flag & DL_CYCL_V)
 //					glDrawArrays(GL_LINE_LOOP, 0, dl->parts);
 //				else
 //					glDrawArrays(GL_LINE_STRIP, 0, dl->parts);
-			}
-			break;
-			
-		case DL_INDEX3:
-			if(draw_index_wire) {
-				glVertexPointer(3, GL_FLOAT, 0, dl->verts);
-				glDrawElements(GL_TRIANGLES, 3*dl->parts, GL_UNSIGNED_INT, dl->index);
-			}
-			break;
-			
-		case DL_INDEX4:
-			if(draw_index_wire) {
-				glVertexPointer(3, GL_FLOAT, 0, dl->verts);
-				glDrawElements(GL_QUADS, 4*dl->parts, GL_UNSIGNED_INT, dl->index);
-			}
-			break;
+				}
+				break;
+
+			case DL_INDEX3:
+				if (draw_index_wire) {
+					glVertexPointer(3, GL_FLOAT, 0, dl->verts);
+					glDrawElements(GL_TRIANGLES, 3 * dl->parts, GL_UNSIGNED_INT, dl->index);
+				}
+				break;
+
+			case DL_INDEX4:
+				if (draw_index_wire) {
+					glVertexPointer(3, GL_FLOAT, 0, dl->verts);
+					glDrawElements(GL_QUADS, 4 * dl->parts, GL_UNSIGNED_INT, dl->index);
+				}
+				break;
 		}
 	}
 	
 	glDisableClientState(GL_VERTEX_ARRAY);
-	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 
+	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
 	
 	return 0;
 }
@@ -3574,7 +3721,7 @@ static void drawDispListsolid(ListBase *lb, Object *ob, int glsl)
 	float *data, curcol[4];
 	float *ndata;
 	
-	if(lb==NULL) return;
+	if (lb == NULL) return;
 	
 	/* for drawing wire */
 	glGetFloatv(GL_CURRENT_COLOR, curcol);
@@ -3582,103 +3729,103 @@ static void drawDispListsolid(ListBase *lb, Object *ob, int glsl)
 	glEnable(GL_LIGHTING);
 	glEnableClientState(GL_VERTEX_ARRAY);
 	
-	if(ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW);
+	if (ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW);
 	else glFrontFace(GL_CCW);
 	
-	if(ob->type==OB_MBALL) {	// mball always smooth shaded
+	if (ob->type == OB_MBALL) {   // mball always smooth shaded
 		glShadeModel(GL_SMOOTH);
 	}
 	
-	dl= lb->first;
-	while(dl) {
-		data= dl->verts;
-		ndata= dl->nors;
+	dl = lb->first;
+	while (dl) {
+		data = dl->verts;
+		ndata = dl->nors;
 
-		switch(dl->type) {
-		case DL_SEGM:
-			if(ob->type==OB_SURF) {
-				int nr;
+		switch (dl->type) {
+			case DL_SEGM:
+				if (ob->type == OB_SURF) {
+					int nr;
 
-				glDisable(GL_LIGHTING);
-				glColor3fv(curcol);
-				
-				// glVertexPointer(3, GL_FLOAT, 0, dl->verts);
-				// glDrawArrays(GL_LINE_STRIP, 0, dl->nr);
+					glDisable(GL_LIGHTING);
+					glColor3fv(curcol);
 
-				glBegin(GL_LINE_STRIP);
-				for(nr= dl->nr; nr; nr--, data+=3)
-					glVertex3fv(data);
-				glEnd();
+					// glVertexPointer(3, GL_FLOAT, 0, dl->verts);
+					// glDrawArrays(GL_LINE_STRIP, 0, dl->nr);
 
-				glEnable(GL_LIGHTING);
-			}
-			break;
-		case DL_POLY:
-			if(ob->type==OB_SURF) {
-				int nr;
+					glBegin(GL_LINE_STRIP);
+					for (nr = dl->nr; nr; nr--, data += 3)
+						glVertex3fv(data);
+					glEnd();
 
-				glDisable(GL_LIGHTING);
-				
-				/* for some reason glDrawArrays crashes here in half of the platforms (not osx) */
-				//glVertexPointer(3, GL_FLOAT, 0, dl->verts);
-				//glDrawArrays(GL_LINE_LOOP, 0, dl->nr);
-				
-				glBegin(GL_LINE_LOOP);
-				for(nr= dl->nr; nr; nr--, data+=3)
-					glVertex3fv(data);
-				glEnd();
-				
-				glEnable(GL_LIGHTING);
+					glEnable(GL_LIGHTING);
+				}
 				break;
-			}
-		case DL_SURF:
-			
-			if(dl->index) {
-				GPU_enable_material(dl->col+1, (glsl)? &gattribs: NULL);
-				
-				if(dl->rt & CU_SMOOTH) glShadeModel(GL_SMOOTH);
-				else glShadeModel(GL_FLAT);
+			case DL_POLY:
+				if (ob->type == OB_SURF) {
+					int nr;
+
+					glDisable(GL_LIGHTING);
+
+					/* for some reason glDrawArrays crashes here in half of the platforms (not osx) */
+					//glVertexPointer(3, GL_FLOAT, 0, dl->verts);
+					//glDrawArrays(GL_LINE_LOOP, 0, dl->nr);
+
+					glBegin(GL_LINE_LOOP);
+					for (nr = dl->nr; nr; nr--, data += 3)
+						glVertex3fv(data);
+					glEnd();
+
+					glEnable(GL_LIGHTING);
+					break;
+				}
+			case DL_SURF:
+
+				if (dl->index) {
+					GPU_enable_material(dl->col + 1, (glsl) ? &gattribs : NULL);
+
+					if (dl->rt & CU_SMOOTH) glShadeModel(GL_SMOOTH);
+					else glShadeModel(GL_FLAT);
+
+					glEnableClientState(GL_NORMAL_ARRAY);
+					glVertexPointer(3, GL_FLOAT, 0, dl->verts);
+					glNormalPointer(GL_FLOAT, 0, dl->nors);
+					glDrawElements(GL_QUADS, 4 * dl->totindex, GL_UNSIGNED_INT, dl->index);
+					glDisableClientState(GL_NORMAL_ARRAY);
+				}
+				break;
+
+			case DL_INDEX3:
+				GPU_enable_material(dl->col + 1, (glsl) ? &gattribs : NULL);
 
-				glEnableClientState(GL_NORMAL_ARRAY);
 				glVertexPointer(3, GL_FLOAT, 0, dl->verts);
-				glNormalPointer(GL_FLOAT, 0, dl->nors);
-				glDrawElements(GL_QUADS, 4*dl->totindex, GL_UNSIGNED_INT, dl->index);
-				glDisableClientState(GL_NORMAL_ARRAY);
-			}			
-			break;
 
-		case DL_INDEX3:
-			GPU_enable_material(dl->col+1, (glsl)? &gattribs: NULL);
-			
-			glVertexPointer(3, GL_FLOAT, 0, dl->verts);
-			
-			/* voor polys only one normal needed */
-			if(index3_nors_incr) {
+				/* voor polys only one normal needed */
+				if (index3_nors_incr) {
+					glEnableClientState(GL_NORMAL_ARRAY);
+					glNormalPointer(GL_FLOAT, 0, dl->nors);
+				}
+				else
+					glNormal3fv(ndata);
+
+				glDrawElements(GL_TRIANGLES, 3 * dl->parts, GL_UNSIGNED_INT, dl->index);
+
+				if (index3_nors_incr)
+					glDisableClientState(GL_NORMAL_ARRAY);
+
+				break;
+
+			case DL_INDEX4:
+				GPU_enable_material(dl->col + 1, (glsl) ? &gattribs : NULL);
+
 				glEnableClientState(GL_NORMAL_ARRAY);
+				glVertexPointer(3, GL_FLOAT, 0, dl->verts);
 				glNormalPointer(GL_FLOAT, 0, dl->nors);
-			}
-			else
-				glNormal3fv(ndata);
-			
-			glDrawElements(GL_TRIANGLES, 3*dl->parts, GL_UNSIGNED_INT, dl->index);
-			
-			if(index3_nors_incr)
+				glDrawElements(GL_QUADS, 4 * dl->parts, GL_UNSIGNED_INT, dl->index);
 				glDisableClientState(GL_NORMAL_ARRAY);
 
-			break;
-
-		case DL_INDEX4:
-			GPU_enable_material(dl->col+1, (glsl)? &gattribs: NULL);
-			
-			glEnableClientState(GL_NORMAL_ARRAY);
-			glVertexPointer(3, GL_FLOAT, 0, dl->verts);
-			glNormalPointer(GL_FLOAT, 0, dl->nors);
-			glDrawElements(GL_QUADS, 4*dl->parts, GL_UNSIGNED_INT, dl->index);
-			glDisableClientState(GL_NORMAL_ARRAY);
-
-			break;
+				break;
 		}
-		dl= dl->next;
+		dl = dl->next;
 	}
 
 	glDisableClientState(GL_VERTEX_ARRAY);
@@ -3690,25 +3837,24 @@ static void drawDispListsolid(ListBase *lb, Object *ob, int glsl)
 static void drawCurveDMWired(Object *ob)
 {
 	DerivedMesh *dm = ob->derivedFinal;
-	dm->drawEdges (dm, 1, 0);
+	dm->drawEdges(dm, 1, 0);
 }
 
 /* return 1 when nothing was drawn */
 static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, int dt)
 {
-	Object *ob= base->object;
+	Object *ob = base->object;
 	DerivedMesh *dm = ob->derivedFinal;
 
 	if (!dm) {
 		return 1;
 	}
 
-	if(dt>OB_WIRE && dm->getNumFaces(dm)) {
+	if (dt > OB_WIRE && dm->getNumTessFaces(dm)) {
 		int glsl = draw_glsl_material(scene, ob, v3d, dt);
 		GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, NULL);
 
-		if(!glsl) {
-			glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
+		if (!glsl) {
 			glEnable(GL_LIGHTING);
 			dm->drawFacesSolid(dm, NULL, 0, GPU_enable_material);
 			glDisable(GL_LIGHTING);
@@ -3717,9 +3863,10 @@ static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, B
 			dm->drawFacesGLSL(dm, GPU_enable_material);
 
 		GPU_end_object_materials();
-	} else {
-		if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_SOLID)==0)
-			drawCurveDMWired (ob);
+	}
+	else {
+		if (((v3d->flag2 & V3D_RENDER_OVERRIDE) && v3d->drawtype >= OB_SOLID) == 0)
+			drawCurveDMWired(ob);
 	}
 
 	return 0;
@@ -3728,121 +3875,118 @@ static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, B
 /* returns 1 when nothing was drawn */
 static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, int dt)
 {
-	Object *ob= base->object;
-	ListBase *lb=NULL;
+	Object *ob = base->object;
+	ListBase *lb = NULL;
 	DispList *dl;
 	Curve *cu;
-	const short render_only= (v3d->flag2 & V3D_RENDER_OVERRIDE);
-	const short solid= (dt > OB_WIRE);
-	int retval= 0;
+	const short render_only = (v3d->flag2 & V3D_RENDER_OVERRIDE);
+	const short solid = (dt > OB_WIRE);
+	int retval = 0;
 
 	if (drawCurveDerivedMesh(scene, v3d, rv3d, base, dt) == 0) {
 		return 0;
 	}
 
-	switch(ob->type) {
-	case OB_FONT:
-	case OB_CURVE:
-		cu= ob->data;
-		
-		lb= &ob->disp;
-		
-		if(solid) {
-			dl= lb->first;
-			if(dl==NULL) return 1;
+	switch (ob->type) {
+		case OB_FONT:
+		case OB_CURVE:
+			cu = ob->data;
 
-			if(dl->nors==NULL) addnormalsDispList(lb);
-			index3_nors_incr= 0;
-			
-			if( displist_has_faces(lb)==0) {
-				if(!render_only) {
-					draw_index_wire= 0;
-					drawDispListwire(lb);
-					draw_index_wire= 1;
+			lb = &ob->disp;
+
+			if (solid) {
+				dl = lb->first;
+				if (dl == NULL) return 1;
+
+				if (dl->nors == NULL) addnormalsDispList(lb);
+				index3_nors_incr = 0;
+
+				if (displist_has_faces(lb) == 0) {
+					if (!render_only) {
+						draw_index_wire = 0;
+						drawDispListwire(lb);
+						draw_index_wire = 1;
+					}
 				}
+				else {
+					if (draw_glsl_material(scene, ob, v3d, dt)) {
+						GPU_begin_object_materials(v3d, rv3d, scene, ob, 1, NULL);
+						drawDispListsolid(lb, ob, 1);
+						GPU_end_object_materials();
+					}
+					else {
+						GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL);
+						drawDispListsolid(lb, ob, 0);
+						GPU_end_object_materials();
+					}
+					if (cu->editnurb && cu->bevobj == NULL && cu->taperobj == NULL && cu->ext1 == 0.0f && cu->ext2 == 0.0f) {
+						cpack(0);
+						draw_index_wire = 0;
+						drawDispListwire(lb);
+						draw_index_wire = 1;
+					}
+				}
+				index3_nors_incr = 1;
 			}
 			else {
-				if(draw_glsl_material(scene, ob, v3d, dt)) {
+				if (!render_only || (render_only && displist_has_faces(lb))) {
+					draw_index_wire = 0;
+					retval = drawDispListwire(lb);
+					draw_index_wire = 1;
+				}
+			}
+			break;
+		case OB_SURF:
+
+			lb = &ob->disp;
+
+			if (solid) {
+				dl = lb->first;
+				if (dl == NULL) return 1;
+
+				if (dl->nors == NULL) addnormalsDispList(lb);
+
+				if (draw_glsl_material(scene, ob, v3d, dt)) {
 					GPU_begin_object_materials(v3d, rv3d, scene, ob, 1, NULL);
 					drawDispListsolid(lb, ob, 1);
 					GPU_end_object_materials();
 				}
 				else {
 					GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL);
-					glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
 					drawDispListsolid(lb, ob, 0);
 					GPU_end_object_materials();
 				}
-				if(cu->editnurb && cu->bevobj==NULL && cu->taperobj==NULL && cu->ext1 == 0.0f && cu->ext2 == 0.0f) {
-					cpack(0);
-					draw_index_wire= 0;
-					drawDispListwire(lb);
-					draw_index_wire= 1;
-				}
-			}
-			index3_nors_incr= 1;
-		}
-		else {
-			if(!render_only || (render_only && displist_has_faces(lb))) {
-				draw_index_wire= 0;
-				retval= drawDispListwire(lb);
-				draw_index_wire= 1;
-			}
-		}
-		break;
-	case OB_SURF:
-
-		lb= &ob->disp;
-		
-		if(solid) {
-			dl= lb->first;
-			if(dl==NULL) return 1;
-			
-			if(dl->nors==NULL) addnormalsDispList(lb);
-			
-			if(draw_glsl_material(scene, ob, v3d, dt)) {
-				GPU_begin_object_materials(v3d, rv3d, scene, ob, 1, NULL);
-				drawDispListsolid(lb, ob, 1);
-				GPU_end_object_materials();
 			}
 			else {
-				GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL);
-				glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
-				drawDispListsolid(lb, ob, 0);
-				GPU_end_object_materials();
+				retval = drawDispListwire(lb);
 			}
-		}
-		else {
-			retval= drawDispListwire(lb);
-		}
-		break;
-	case OB_MBALL:
-		
-		if( is_basis_mball(ob)) {
-			lb= &ob->disp;
-			if(lb->first==NULL) makeDispListMBall(scene, ob);
-			if(lb->first==NULL) return 1;
-			
-			if(solid) {
-				
-				if(draw_glsl_material(scene, ob, v3d, dt)) {
-					GPU_begin_object_materials(v3d, rv3d, scene, ob, 1, NULL);
-					drawDispListsolid(lb, ob, 1);
-					GPU_end_object_materials();
+			break;
+		case OB_MBALL:
+
+			if (is_basis_mball(ob)) {
+				lb = &ob->disp;
+				if (lb->first == NULL) makeDispListMBall(scene, ob);
+				if (lb->first == NULL) return 1;
+
+				if (solid) {
+
+					if (draw_glsl_material(scene, ob, v3d, dt)) {
+						GPU_begin_object_materials(v3d, rv3d, scene, ob, 1, NULL);
+						drawDispListsolid(lb, ob, 1);
+						GPU_end_object_materials();
+					}
+					else {
+						GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL);
+						drawDispListsolid(lb, ob, 0);
+						GPU_end_object_materials();
+					}
 				}
 				else {
-					GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL);
-					glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
-					drawDispListsolid(lb, ob, 0);
-					GPU_end_object_materials();
+					/* MetaBalls use DL_INDEX4 type of DispList */
+					retval = drawDispListwire(lb);
 				}
 			}
-			else{
-				/* MetaBalls use DL_INDEX4 type of DispList */
-				retval= drawDispListwire(lb);
-			}
-		}
-		break;
+			break;
 	}
 	
 	return retval;
@@ -3852,21 +3996,21 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas
 static void draw_particle_arrays(int draw_as, int totpoint, int ob_dt, int select)
 {
 	/* draw created data arrays */
-	switch(draw_as){
+	switch (draw_as) {
 		case PART_DRAW_AXIS:
 		case PART_DRAW_CROSS:
-			glDrawArrays(GL_LINES, 0, 6*totpoint);
+			glDrawArrays(GL_LINES, 0, 6 * totpoint);
 			break;
 		case PART_DRAW_LINE:
-			glDrawArrays(GL_LINES, 0, 2*totpoint);
+			glDrawArrays(GL_LINES, 0, 2 * totpoint);
 			break;
 		case PART_DRAW_BB:
-			if(ob_dt<=OB_WIRE || select)
-				glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
+			if (ob_dt <= OB_WIRE || select)
+				glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
 			else
-				glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 
+				glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
 
-			glDrawArrays(GL_QUADS, 0, 4*totpoint);
+			glDrawArrays(GL_QUADS, 0, 4 * totpoint);
 			break;
 		default:
 			glDrawArrays(GL_POINTS, 0, totpoint);
@@ -3879,102 +4023,102 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix
 	float vec[3], vec2[3];
 	float *vd = NULL;
 	float *cd = NULL;
-	float ma_col[3]= {0.0f, 0.0f, 0.0f};
+	float ma_col[3] = {0.0f, 0.0f, 0.0f};
 
 	/* null only for PART_DRAW_CIRC */
-	if(pdd) {
+	if (pdd) {
 		vd = pdd->vd;
 		cd = pdd->cd;
 
-		if(pdd->ma_col) {
+		if (pdd->ma_col) {
 			copy_v3_v3(ma_col, pdd->ma_col);
 		}
 	}
 
-	switch(draw_as){
+	switch (draw_as) {
 		case PART_DRAW_DOT:
 		{
-			if(vd) {
-				copy_v3_v3(vd,state->co); pdd->vd+=3;
+			if (vd) {
+				copy_v3_v3(vd, state->co); pdd->vd += 3;
 			}
-			if(cd) {
+			if (cd) {
 				copy_v3_v3(cd, pdd->ma_col);
-				pdd->cd+=3;
+				pdd->cd += 3;
 			}
 			break;
 		}
 		case PART_DRAW_CROSS:
 		case PART_DRAW_AXIS:
 		{
-			vec[0]=2.0f*pixsize;
-			vec[1]=vec[2]=0.0;
-			mul_qt_v3(state->rot,vec);
-			if(draw_as==PART_DRAW_AXIS) {
-				if(cd) {
-					cd[1]=cd[2]=cd[4]=cd[5]=0.0;
-					cd[0]=cd[3]=1.0;
-					cd[6]=cd[8]=cd[9]=cd[11]=0.0;
-					cd[7]=cd[10]=1.0;
-					cd[13]=cd[12]=cd[15]=cd[16]=0.0;
-					cd[14]=cd[17]=1.0;
-					pdd->cd+=18;
+			vec[0] = 2.0f * pixsize;
+			vec[1] = vec[2] = 0.0;
+			mul_qt_v3(state->rot, vec);
+			if (draw_as == PART_DRAW_AXIS) {
+				if (cd) {
+					cd[1] = cd[2] = cd[4] = cd[5] = 0.0;
+					cd[0] = cd[3] = 1.0;
+					cd[6] = cd[8] = cd[9] = cd[11] = 0.0;
+					cd[7] = cd[10] = 1.0;
+					cd[13] = cd[12] = cd[15] = cd[16] = 0.0;
+					cd[14] = cd[17] = 1.0;
+					pdd->cd += 18;
 				}
 
-				copy_v3_v3(vec2,state->co);
+				copy_v3_v3(vec2, state->co);
 			}
 			else {
-				if(cd) {
-					cd[0]=cd[3]=cd[6]=cd[ 9]=cd[12]=cd[15]= ma_col[0];
-					cd[1]=cd[4]=cd[7]=cd[10]=cd[13]=cd[16]= ma_col[1];
-					cd[2]=cd[5]=cd[8]=cd[11]=cd[14]=cd[17]= ma_col[2];
-					pdd->cd+=18;
+				if (cd) {
+					cd[0] = cd[3] = cd[6] = cd[9] = cd[12] = cd[15] = ma_col[0];
+					cd[1] = cd[4] = cd[7] = cd[10] = cd[13] = cd[16] = ma_col[1];
+					cd[2] = cd[5] = cd[8] = cd[11] = cd[14] = cd[17] = ma_col[2];
+					pdd->cd += 18;
 				}
 				sub_v3_v3v3(vec2, state->co, vec);
 			}
 
 			add_v3_v3(vec, state->co);
-			copy_v3_v3(pdd->vd,vec); pdd->vd+=3;
-			copy_v3_v3(pdd->vd,vec2); pdd->vd+=3;
-				
-			vec[1]=2.0f*pixsize;
-			vec[0]=vec[2]=0.0;
-			mul_qt_v3(state->rot,vec);
-			if(draw_as==PART_DRAW_AXIS){
-				copy_v3_v3(vec2,state->co);
-			}		
+			copy_v3_v3(pdd->vd, vec); pdd->vd += 3;
+			copy_v3_v3(pdd->vd, vec2); pdd->vd += 3;
+
+			vec[1] = 2.0f * pixsize;
+			vec[0] = vec[2] = 0.0;
+			mul_qt_v3(state->rot, vec);
+			if (draw_as == PART_DRAW_AXIS) {
+				copy_v3_v3(vec2, state->co);
+			}
 			else sub_v3_v3v3(vec2, state->co, vec);
 
 			add_v3_v3(vec, state->co);
-			copy_v3_v3(pdd->vd,vec); pdd->vd+=3;
-			copy_v3_v3(pdd->vd,vec2); pdd->vd+=3;
+			copy_v3_v3(pdd->vd, vec); pdd->vd += 3;
+			copy_v3_v3(pdd->vd, vec2); pdd->vd += 3;
 
-			vec[2]=2.0f*pixsize;
-			vec[0]=vec[1]=0.0;
-			mul_qt_v3(state->rot,vec);
-			if(draw_as==PART_DRAW_AXIS){
-				copy_v3_v3(vec2,state->co);
+			vec[2] = 2.0f * pixsize;
+			vec[0] = vec[1] = 0.0;
+			mul_qt_v3(state->rot, vec);
+			if (draw_as == PART_DRAW_AXIS) {
+				copy_v3_v3(vec2, state->co);
 			}
 			else sub_v3_v3v3(vec2, state->co, vec);
 
 			add_v3_v3(vec, state->co);
 
-			copy_v3_v3(pdd->vd,vec); pdd->vd+=3;
-			copy_v3_v3(pdd->vd,vec2); pdd->vd+=3;
+			copy_v3_v3(pdd->vd, vec); pdd->vd += 3;
+			copy_v3_v3(pdd->vd, vec2); pdd->vd += 3;
 			break;
 		}
 		case PART_DRAW_LINE:
 		{
-			copy_v3_v3(vec,state->vel);
+			copy_v3_v3(vec, state->vel);
 			normalize_v3(vec);
-			if(draw & PART_DRAW_VEL_LENGTH)
-				mul_v3_fl(vec,len_v3(state->vel));
-			madd_v3_v3v3fl(pdd->vd, state->co, vec, -draw_line[0]); pdd->vd+=3;
-			madd_v3_v3v3fl(pdd->vd, state->co, vec,  draw_line[1]); pdd->vd+=3;
-			if(cd) {
-				cd[0]=cd[3]= ma_col[0];
-				cd[1]=cd[4]= ma_col[1];
-				cd[2]=cd[5]= ma_col[2];
-				pdd->cd+=6;
+			if (draw & PART_DRAW_VEL_LENGTH)
+				mul_v3_fl(vec, len_v3(state->vel));
+			madd_v3_v3v3fl(pdd->vd, state->co, vec, -draw_line[0]); pdd->vd += 3;
+			madd_v3_v3v3fl(pdd->vd, state->co, vec,  draw_line[1]); pdd->vd += 3;
+			if (cd) {
+				cd[0] = cd[3] = ma_col[0];
+				cd[1] = cd[4] = ma_col[1];
+				cd[2] = cd[5] = ma_col[2];
+				pdd->cd += 6;
 			}
 			break;
 		}
@@ -3986,11 +4130,11 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix
 		case PART_DRAW_BB:
 		{
 			float xvec[3], yvec[3], zvec[3], bb_center[3];
-			if(cd) {
-				cd[0]=cd[3]=cd[6]=cd[ 9]= ma_col[0];
-				cd[1]=cd[4]=cd[7]=cd[10]= ma_col[1];
-				cd[2]=cd[5]=cd[8]=cd[11]= ma_col[2];
-				pdd->cd+=12;
+			if (cd) {
+				cd[0] = cd[3] = cd[6] = cd[9] = ma_col[0];
+				cd[1] = cd[4] = cd[7] = cd[10] = ma_col[1];
+				cd[2] = cd[5] = cd[8] = cd[11] = ma_col[2];
+				pdd->cd += 12;
 			}
 
 
@@ -4000,21 +4144,21 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix
 			psys_make_billboard(bb, xvec, yvec, zvec, bb_center);
 			
 			add_v3_v3v3(pdd->vd, bb_center, xvec);
-			add_v3_v3(pdd->vd, yvec); pdd->vd+=3;
+			add_v3_v3(pdd->vd, yvec); pdd->vd += 3;
 
 			sub_v3_v3v3(pdd->vd, bb_center, xvec);
-			add_v3_v3(pdd->vd, yvec); pdd->vd+=3;
+			add_v3_v3(pdd->vd, yvec); pdd->vd += 3;
 
 			sub_v3_v3v3(pdd->vd, bb_center, xvec);
-			sub_v3_v3v3(pdd->vd, pdd->vd,yvec); pdd->vd+=3;
+			sub_v3_v3v3(pdd->vd, pdd->vd, yvec); pdd->vd += 3;
 
 			add_v3_v3v3(pdd->vd, bb_center, xvec);
-			sub_v3_v3v3(pdd->vd, pdd->vd, yvec); pdd->vd+=3;
+			sub_v3_v3v3(pdd->vd, pdd->vd, yvec); pdd->vd += 3;
 
-			copy_v3_v3(pdd->nd, zvec); pdd->nd+=3;
-			copy_v3_v3(pdd->nd, zvec); pdd->nd+=3;
-			copy_v3_v3(pdd->nd, zvec); pdd->nd+=3;
-			copy_v3_v3(pdd->nd, zvec); pdd->nd+=3;
+			copy_v3_v3(pdd->nd, zvec); pdd->nd += 3;
+			copy_v3_v3(pdd->nd, zvec); pdd->nd += 3;
+			copy_v3_v3(pdd->nd, zvec); pdd->nd += 3;
+			copy_v3_v3(pdd->nd, zvec); pdd->nd += 3;
 			break;
 		}
 	}
@@ -4023,7 +4167,7 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix
 /* mostly tries to use vertex arrays for speed										*/
 
 /* 1. check that everything is ok & updated */
-/* 2. start initialising things				*/
+/* 2. start initializing things				*/
 /* 3. initialize according to draw type		*/
 /* 4. allocate drawing data arrays			*/
 /* 5. start filling the arrays				*/
@@ -4032,91 +4176,86 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix
 static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv3d,
                                      Base *base, ParticleSystem *psys, int ob_dt)
 {
-	Object *ob=base->object;
+	Object *ob = base->object;
 	ParticleEditSettings *pset = PE_settings(scene);
-	ParticleSettings *part;
-	ParticleData *pars, *pa;
-	ParticleKey state, *states=NULL;
+	ParticleSettings *part = psys->part;
+	ParticleData *pars = psys->particles;
+	ParticleData *pa;
+	ParticleKey state, *states = NULL;
 	ParticleBillboardData bb;
-	ParticleSimulationData sim= {NULL};
+	ParticleSimulationData sim = {NULL};
 	ParticleDrawData *pdd = psys->pdd;
 	Material *ma;
 	float vel[3], imat[4][4];
 	float timestep, pixsize_scale, pa_size, r_tilt, r_length;
 	float pa_time, pa_birthtime, pa_dietime, pa_health, intensity;
 	float cfra;
-	float ma_col[3]= {0.0f, 0.0f, 0.0f};
-	int a, totpart, totpoint=0, totve=0, drawn, draw_as, totchild=0;
-	int select=ob->flag&SELECT, create_cdata=0, need_v=0;
+	float ma_col[3] = {0.0f, 0.0f, 0.0f};
+	int a, totpart, totpoint = 0, totve = 0, drawn, draw_as, totchild = 0;
+	int select = ob->flag & SELECT, create_cdata = 0, need_v = 0;
 	GLint polygonmode[2];
 	char numstr[32];
-	unsigned char tcol[4]= {0, 0, 0, 255};
+	unsigned char tcol[4] = {0, 0, 0, 255};
 
 /* 1. */
-	if(psys==NULL)
-		return;
-
-	part=psys->part;
-	pars=psys->particles;
-
-	if(part==NULL || !psys_check_enabled(ob, psys))
+	if (part == NULL || !psys_check_enabled(ob, psys))
 		return;
 
-	if(pars==NULL) return;
+	if (pars == NULL) return;
 
 	/* don't draw normal paths in edit mode */
-	if(psys_in_edit_mode(scene, psys) && (pset->flag & PE_DRAW_PART)==0)
+	if (psys_in_edit_mode(scene, psys) && (pset->flag & PE_DRAW_PART) == 0)
 		return;
-		
-	if(part->draw_as == PART_DRAW_REND)
+
+	if (part->draw_as == PART_DRAW_REND)
 		draw_as = part->ren_as;
 	else
 		draw_as = part->draw_as;
 
-	if(draw_as == PART_DRAW_NOT)
+	if (draw_as == PART_DRAW_NOT)
 		return;
 
 /* 2. */
-	sim.scene= scene;
-	sim.ob= ob;
-	sim.psys= psys;
-	sim.psmd = psys_get_modifier(ob,psys);
+	sim.scene = scene;
+	sim.ob = ob;
+	sim.psys = psys;
+	sim.psmd = psys_get_modifier(ob, psys);
 
-	if(part->phystype==PART_PHYS_KEYED){
-		if(psys->flag&PSYS_KEYED){
+	if (part->phystype == PART_PHYS_KEYED) {
+		if (psys->flag & PSYS_KEYED) {
 			psys_count_keyed_targets(&sim);
-			if(psys->totkeyed==0)
+			if (psys->totkeyed == 0)
 				return;
 		}
 	}
 
-	if(select){
-		select=0;
-		if(psys_get_current(ob)==psys)
-			select=1;
+	if (select) {
+		select = 0;
+		if (psys_get_current(ob) == psys)
+			select = 1;
 	}
 
-	psys->flag|=PSYS_DRAWING;
+	psys->flag |= PSYS_DRAWING;
 
-	if(part->type==PART_HAIR && !psys->childcache)
-		totchild=0;
+	if (part->type == PART_HAIR && !psys->childcache)
+		totchild = 0;
 	else
-		totchild=psys->totchild*part->disp/100;
+		totchild = psys->totchild * part->disp / 100;
 
-	ma= give_current_material(ob,part->omat);
+	ma = give_current_material(ob, part->omat);
 
-	if(v3d->zbuf) glDepthMask(1);
+	if (v3d->zbuf) glDepthMask(1);
 
-	if((ma) && (part->draw_col == PART_DRAW_COL_MAT)) {
+	if ((ma) && (part->draw_col == PART_DRAW_COL_MAT)) {
 		rgb_float_to_uchar(tcol, &(ma->r));
 		copy_v3_v3(ma_col, &ma->r);
 	}
 
 	glColor3ubv(tcol);
 
-	timestep= psys_get_timestep(&sim);
+	timestep = psys_get_timestep(&sim);
 
-	if( (base->flag & OB_FROMDUPLI) && (ob->flag & OB_FROMGROUP) ) {
+	if ( (base->flag & OB_FROMDUPLI) && (ob->flag & OB_FROMGROUP) ) {
 		float mat[4][4];
 		mult_m4_m4m4(mat, ob->obmat, psys->imat);
 		glMultMatrixf(mat);
@@ -4125,27 +4264,27 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
 	/* needed for text display */
 	invert_m4_m4(ob->imat, ob->obmat);
 
-	totpart=psys->totpart;
+	totpart = psys->totpart;
 
-	cfra= BKE_curframe(scene);
+	cfra = BKE_curframe(scene);
 
-	if(draw_as==PART_DRAW_PATH && psys->pathcache==NULL && psys->childcache==NULL)
-		draw_as=PART_DRAW_DOT;
+	if (draw_as == PART_DRAW_PATH && psys->pathcache == NULL && psys->childcache == NULL)
+		draw_as = PART_DRAW_DOT;
 
 /* 3. */
-	switch(draw_as){
+	switch (draw_as) {
 		case PART_DRAW_DOT:
-			if(part->draw_size)
+			if (part->draw_size)
 				glPointSize(part->draw_size);
 			else
-				glPointSize(2.0); /* default dot size */
+				glPointSize(2.0);  /* default dot size */
 			break;
 		case PART_DRAW_CIRC:
 			/* calculate view aligned matrix: */
 			copy_m4_m4(imat, rv3d->viewinv);
 			normalize_v3(imat[0]);
 			normalize_v3(imat[1]);
-			/* no break! */
+		/* no break! */
 		case PART_DRAW_CROSS:
 		case PART_DRAW_AXIS:
 			/* lets calculate the scale: */
@@ -4155,36 +4294,36 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
 			else
 				pixsize_scale = part->draw_size;
 
-			if(draw_as==PART_DRAW_AXIS)
+			if (draw_as == PART_DRAW_AXIS)
 				create_cdata = 1;
 			break;
 		case PART_DRAW_OB:
-			if(part->dup_ob==NULL)
-				draw_as=PART_DRAW_DOT;
+			if (part->dup_ob == NULL)
+				draw_as = PART_DRAW_DOT;
 			else
-				draw_as=0;
+				draw_as = 0;
 			break;
 		case PART_DRAW_GR:
-			if(part->dup_group==NULL)
-				draw_as=PART_DRAW_DOT;
+			if (part->dup_group == NULL)
+				draw_as = PART_DRAW_DOT;
 			else
-				draw_as=0;
+				draw_as = 0;
 			break;
 		case PART_DRAW_BB:
-			if(v3d->camera==NULL && part->bb_ob==NULL){
+			if (v3d->camera == NULL && part->bb_ob == NULL) {
 				printf("Billboards need an active camera or a target object!\n");
 
-				draw_as=part->draw_as=PART_DRAW_DOT;
+				draw_as = part->draw_as = PART_DRAW_DOT;
 
-				if(part->draw_size)
+				if (part->draw_size)
 					glPointSize(part->draw_size);
 				else
-					glPointSize(2.0); /* default dot size */
+					glPointSize(2.0);  /* default dot size */
 			}
-			else if(part->bb_ob)
-				bb.ob=part->bb_ob;
+			else if (part->bb_ob)
+				bb.ob = part->bb_ob;
 			else
-				bb.ob=v3d->camera;
+				bb.ob = v3d->camera;
 
 			bb.align = part->bb_align;
 			bb.anim = part->bb_anim;
@@ -4193,42 +4332,44 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
 		case PART_DRAW_PATH:
 			break;
 		case PART_DRAW_LINE:
-			need_v=1;
+			need_v = 1;
 			break;
 	}
-	if(part->draw & PART_DRAW_SIZE && part->draw_as!=PART_DRAW_CIRC){
+	if (part->draw & PART_DRAW_SIZE && part->draw_as != PART_DRAW_CIRC) {
 		copy_m4_m4(imat, rv3d->viewinv);
 		normalize_v3(imat[0]);
 		normalize_v3(imat[1]);
 	}
 
-	if(ELEM3(draw_as, PART_DRAW_DOT, PART_DRAW_CROSS, PART_DRAW_LINE)
-		&& part->draw_col > PART_DRAW_COL_MAT)
+	if (ELEM3(draw_as, PART_DRAW_DOT, PART_DRAW_CROSS, PART_DRAW_LINE) &&
+	    (part->draw_col > PART_DRAW_COL_MAT))
+	{
 		create_cdata = 1;
+	}
 
-	if(!create_cdata && pdd && pdd->cdata) {
+	if (!create_cdata && pdd && pdd->cdata) {
 		MEM_freeN(pdd->cdata);
 		pdd->cdata = pdd->cd = NULL;
 	}
 
 /* 4. */
-	if(draw_as && ELEM(draw_as, PART_DRAW_PATH, PART_DRAW_CIRC)==0) {
+	if (draw_as && ELEM(draw_as, PART_DRAW_PATH, PART_DRAW_CIRC) == 0) {
 		int tot_vec_size = (totpart + totchild) * 3 * sizeof(float);
 		int create_ndata = 0;
 
-		if(!pdd)
+		if (!pdd)
 			pdd = psys->pdd = MEM_callocN(sizeof(ParticleDrawData), "ParticlDrawData");
 
-		if(part->draw_as == PART_DRAW_REND && part->trail_count > 1) {
+		if (part->draw_as == PART_DRAW_REND && part->trail_count > 1) {
 			tot_vec_size *= part->trail_count;
 			psys_make_temp_pointcache(ob, psys);
 		}
 
-		switch(draw_as) {
+		switch (draw_as) {
 			case PART_DRAW_AXIS:
 			case PART_DRAW_CROSS:
 				tot_vec_size *= 6;
-				if(draw_as != PART_DRAW_CROSS)
+				if (draw_as != PART_DRAW_CROSS)
 					create_cdata = 1;
 				break;
 			case PART_DRAW_LINE:
@@ -4240,231 +4381,236 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
 				break;
 		}
 
-		if(pdd->tot_vec_size != tot_vec_size)
+		if (pdd->tot_vec_size != tot_vec_size)
 			psys_free_pdd(psys);
 
-		if(!pdd->vdata)
+		if (!pdd->vdata)
 			pdd->vdata = MEM_callocN(tot_vec_size, "particle_vdata");
-		if(create_cdata && !pdd->cdata)
+		if (create_cdata && !pdd->cdata)
 			pdd->cdata = MEM_callocN(tot_vec_size, "particle_cdata");
-		if(create_ndata && !pdd->ndata)
+		if (create_ndata && !pdd->ndata)
 			pdd->ndata = MEM_callocN(tot_vec_size, "particle_ndata");
 
-		if(part->draw & PART_DRAW_VEL && draw_as != PART_DRAW_LINE) {
-			if(!pdd->vedata)
+		if (part->draw & PART_DRAW_VEL && draw_as != PART_DRAW_LINE) {
+			if (!pdd->vedata)
 				pdd->vedata = MEM_callocN(2 * (totpart + totchild) * 3 * sizeof(float), "particle_vedata");
 
 			need_v = 1;
-		} else if (pdd->vedata) {
+		}
+		else if (pdd->vedata) {
 			/* velocity data not needed, so free it */
 			MEM_freeN(pdd->vedata);
-			pdd->vedata= NULL;
+			pdd->vedata = NULL;
 		}
 
-		pdd->vd= pdd->vdata;
-		pdd->ved= pdd->vedata;
-		pdd->cd= pdd->cdata;
-		pdd->nd= pdd->ndata;
-		pdd->tot_vec_size= tot_vec_size;
+		pdd->vd = pdd->vdata;
+		pdd->ved = pdd->vedata;
+		pdd->cd = pdd->cdata;
+		pdd->nd = pdd->ndata;
+		pdd->tot_vec_size = tot_vec_size;
 	}
-	else if(psys->pdd) {
+	else if (psys->pdd) {
 		psys_free_pdd(psys);
 		MEM_freeN(psys->pdd);
 		pdd = psys->pdd = NULL;
 	}
 
-	if(pdd) {
-		pdd->ma_col= ma_col;
+	if (pdd) {
+		pdd->ma_col = ma_col;
 	}
 
-	psys->lattice= psys_get_lattice(&sim);
+	psys->lattice = psys_get_lattice(&sim);
 
 	/* circles don't use drawdata, so have to add a special case here */
-	if((pdd || draw_as==PART_DRAW_CIRC) && draw_as!=PART_DRAW_PATH){
-/* 5. */
-		if(pdd && (pdd->flag & PARTICLE_DRAW_DATA_UPDATED)
-			&& (pdd->vedata || part->draw & (PART_DRAW_SIZE|PART_DRAW_NUM|PART_DRAW_HEALTH))==0) {
+	if ((pdd || draw_as == PART_DRAW_CIRC) && draw_as != PART_DRAW_PATH) {
+		/* 5. */
+		if (pdd && (pdd->flag & PARTICLE_DRAW_DATA_UPDATED) &&
+		    (pdd->vedata || part->draw & (PART_DRAW_SIZE | PART_DRAW_NUM | PART_DRAW_HEALTH)) == 0)
+		{
 			totpoint = pdd->totpoint; /* draw data is up to date */
 		}
-		else for(a=0,pa=pars; a<totpart+totchild; a++, pa++){
-			/* setup per particle individual stuff */
-			if(a<totpart){
-				if(totchild && (part->draw&PART_DRAW_PARENT)==0) continue;
-				if(pa->flag & PARS_NO_DISP || pa->flag & PARS_UNEXIST) continue;
-
-				pa_time=(cfra-pa->time)/pa->lifetime;
-				pa_birthtime=pa->time;
-				pa_dietime = pa->dietime;
-				pa_size=pa->size;
-				if(part->phystype==PART_PHYS_BOIDS)
-					pa_health = pa->boid->data.health;
-				else
-					pa_health = -1.0;
-
-				r_tilt = 2.0f*(PSYS_FRAND(a + 21) - 0.5f);
-				r_length = PSYS_FRAND(a + 22);
-
-				if(part->draw_col > PART_DRAW_COL_MAT) {
-					switch(part->draw_col) {
-						case PART_DRAW_COL_VEL:
-							intensity = len_v3(pa->state.vel)/part->color_vec_max;
-							break;
-						case PART_DRAW_COL_ACC:
-							intensity = len_v3v3(pa->state.vel, pa->prev_state.vel)/((pa->state.time-pa->prev_state.time)*part->color_vec_max);
-							break;
-						default:
-							intensity= 1.0f; /* should never happen */
+		else {
+			for (a = 0, pa = pars; a < totpart + totchild; a++, pa++) {
+				/* setup per particle individual stuff */
+				if (a < totpart) {
+					if (totchild && (part->draw & PART_DRAW_PARENT) == 0) continue;
+					if (pa->flag & PARS_NO_DISP || pa->flag & PARS_UNEXIST) continue;
+
+					pa_time = (cfra - pa->time) / pa->lifetime;
+					pa_birthtime = pa->time;
+					pa_dietime = pa->dietime;
+					pa_size = pa->size;
+					if (part->phystype == PART_PHYS_BOIDS)
+						pa_health = pa->boid->data.health;
+					else
+						pa_health = -1.0;
+
+					r_tilt = 2.0f * (PSYS_FRAND(a + 21) - 0.5f);
+					r_length = PSYS_FRAND(a + 22);
+
+					if (part->draw_col > PART_DRAW_COL_MAT) {
+						switch (part->draw_col) {
+							case PART_DRAW_COL_VEL:
+								intensity = len_v3(pa->state.vel) / part->color_vec_max;
+								break;
+							case PART_DRAW_COL_ACC:
+								intensity = len_v3v3(pa->state.vel, pa->prev_state.vel) / ((pa->state.time - pa->prev_state.time) * part->color_vec_max);
+								break;
+							default:
+								intensity = 1.0f; /* should never happen */
+						}
+						CLAMP(intensity, 0.f, 1.f);
+						weight_to_rgb(ma_col, intensity);
 					}
-					CLAMP(intensity, 0.f, 1.f);
-					weight_to_rgb(ma_col, intensity);
 				}
-			}
-			else{
-				ChildParticle *cpa= &psys->child[a-totpart];
-
-				pa_time=psys_get_child_time(psys,cpa,cfra,&pa_birthtime,&pa_dietime);
-				pa_size=psys_get_child_size(psys,cpa,cfra,NULL);
-
-				pa_health = -1.0;
+				else {
+					ChildParticle *cpa = &psys->child[a - totpart];
 
-				r_tilt = 2.0f*(PSYS_FRAND(a + 21) - 0.5f);
-				r_length = PSYS_FRAND(a + 22);
-			}
+					pa_time = psys_get_child_time(psys, cpa, cfra, &pa_birthtime, &pa_dietime);
+					pa_size = psys_get_child_size(psys, cpa, cfra, NULL);
 
-			drawn = 0;
-			if(part->draw_as == PART_DRAW_REND && part->trail_count > 1) {
-				float length = part->path_end * (1.0f - part->randlength * r_length);
-				int trail_count = part->trail_count * (1.0f - part->randlength * r_length);
-				float ct = ((part->draw & PART_ABS_PATH_TIME) ? cfra : pa_time) - length;
-				float dt = length / (trail_count ? (float)trail_count : 1.0f);
-				int i=0;
+					pa_health = -1.0;
 
-				ct+=dt;
-				for(i=0; i < trail_count; i++, ct += dt) {
-					float pixsize;
+					r_tilt = 2.0f * (PSYS_FRAND(a + 21) - 0.5f);
+					r_length = PSYS_FRAND(a + 22);
+				}
 
-					if(part->draw & PART_ABS_PATH_TIME) {
-						if(ct < pa_birthtime || ct > pa_dietime)
+				drawn = 0;
+				if (part->draw_as == PART_DRAW_REND && part->trail_count > 1) {
+					float length = part->path_end * (1.0f - part->randlength * r_length);
+					int trail_count = part->trail_count * (1.0f - part->randlength * r_length);
+					float ct = ((part->draw & PART_ABS_PATH_TIME) ? cfra : pa_time) - length;
+					float dt = length / (trail_count ? (float)trail_count : 1.0f);
+					int i = 0;
+
+					ct += dt;
+					for (i = 0; i < trail_count; i++, ct += dt) {
+						float pixsize;
+
+						if (part->draw & PART_ABS_PATH_TIME) {
+							if (ct < pa_birthtime || ct > pa_dietime)
+								continue;
+						}
+						else if (ct < 0.0f || ct > 1.0f)
 							continue;
-					}
-					else if(ct < 0.0f || ct > 1.0f)
-						continue;
 
-					state.time = (part->draw & PART_ABS_PATH_TIME) ? -ct : -(pa_birthtime + ct * (pa_dietime - pa_birthtime));
-					psys_get_particle_on_path(&sim,a,&state,need_v);
-					
-					if(psys->parent)
-						mul_m4_v3(psys->parent->obmat, state.co);
-
-					/* create actiual particle data */
-					if(draw_as == PART_DRAW_BB) {
-						bb.offset[0] = part->bb_offset[0];
-						bb.offset[1] = part->bb_offset[1];
-						bb.size[0] = part->bb_size[0] * pa_size;
-						if (part->bb_align==PART_BB_VEL) {
-							float pa_vel = len_v3(state.vel);
-							float head = part->bb_vel_head*pa_vel;
-							float tail = part->bb_vel_tail*pa_vel;
-							bb.size[1] = part->bb_size[1]*pa_size + head + tail;
-							/* use offset to adjust the particle center. this is relative to size, so need to divide! */
-							if (bb.size[1] > 0.0f)
-								bb.offset[1] += (head-tail) / bb.size[1];
+						state.time = (part->draw & PART_ABS_PATH_TIME) ? -ct : -(pa_birthtime + ct * (pa_dietime - pa_birthtime));
+						psys_get_particle_on_path(&sim, a, &state, need_v);
+
+						if (psys->parent)
+							mul_m4_v3(psys->parent->obmat, state.co);
+
+						/* create actiual particle data */
+						if (draw_as == PART_DRAW_BB) {
+							bb.offset[0] = part->bb_offset[0];
+							bb.offset[1] = part->bb_offset[1];
+							bb.size[0] = part->bb_size[0] * pa_size;
+							if (part->bb_align == PART_BB_VEL) {
+								float pa_vel = len_v3(state.vel);
+								float head = part->bb_vel_head * pa_vel;
+								float tail = part->bb_vel_tail * pa_vel;
+								bb.size[1] = part->bb_size[1] * pa_size + head + tail;
+								/* use offset to adjust the particle center. this is relative to size, so need to divide! */
+								if (bb.size[1] > 0.0f)
+									bb.offset[1] += (head - tail) / bb.size[1];
+							}
+							else
+								bb.size[1] = part->bb_size[1] * pa_size;
+							bb.tilt = part->bb_tilt * (1.0f - part->bb_rand_tilt * r_tilt);
+							bb.time = ct;
 						}
-						else
-							bb.size[1] = part->bb_size[1] * pa_size;
-						bb.tilt = part->bb_tilt * (1.0f - part->bb_rand_tilt * r_tilt);
-						bb.time = ct;
-					}
 
-					pixsize = ED_view3d_pixel_size(rv3d, state.co) * pixsize_scale;
+						pixsize = ED_view3d_pixel_size(rv3d, state.co) * pixsize_scale;
 
-					draw_particle(&state, draw_as, part->draw, pixsize, imat, part->draw_line, &bb, psys->pdd);
+						draw_particle(&state, draw_as, part->draw, pixsize, imat, part->draw_line, &bb, psys->pdd);
 
-					totpoint++;
-					drawn = 1;
+						totpoint++;
+						drawn = 1;
+					}
 				}
-			}
-			else
-			{
-				state.time=cfra;
-				if(psys_get_particle_state(&sim,a,&state,0)){
-					float pixsize;
-
-					if(psys->parent)
-						mul_m4_v3(psys->parent->obmat, state.co);
-
-					/* create actiual particle data */
-					if(draw_as == PART_DRAW_BB) {
-						bb.offset[0] = part->bb_offset[0];
-						bb.offset[1] = part->bb_offset[1];
-						bb.size[0] = part->bb_size[0] * pa_size;
-						if (part->bb_align==PART_BB_VEL) {
-							float pa_vel = len_v3(state.vel);
-							float head = part->bb_vel_head*pa_vel;
-							float tail = part->bb_vel_tail*pa_vel;
-							bb.size[1] = part->bb_size[1]*pa_size + head + tail;
-							/* use offset to adjust the particle center. this is relative to size, so need to divide! */
-							if (bb.size[1] > 0.0f)
-								bb.offset[1] += (head-tail) / bb.size[1];
+				else {
+					state.time = cfra;
+					if (psys_get_particle_state(&sim, a, &state, 0)) {
+						float pixsize;
+
+						if (psys->parent)
+							mul_m4_v3(psys->parent->obmat, state.co);
+
+						/* create actiual particle data */
+						if (draw_as == PART_DRAW_BB) {
+							bb.offset[0] = part->bb_offset[0];
+							bb.offset[1] = part->bb_offset[1];
+							bb.size[0] = part->bb_size[0] * pa_size;
+							if (part->bb_align == PART_BB_VEL) {
+								float pa_vel = len_v3(state.vel);
+								float head = part->bb_vel_head * pa_vel;
+								float tail = part->bb_vel_tail * pa_vel;
+								bb.size[1] = part->bb_size[1] * pa_size + head + tail;
+								/* use offset to adjust the particle center. this is relative to size, so need to divide! */
+								if (bb.size[1] > 0.0f)
+									bb.offset[1] += (head - tail) / bb.size[1];
+							}
+							else
+								bb.size[1] = part->bb_size[1] * pa_size;
+							bb.tilt = part->bb_tilt * (1.0f - part->bb_rand_tilt * r_tilt);
+							bb.time = pa_time;
 						}
-						else
-							bb.size[1] = part->bb_size[1] * pa_size;
-						bb.tilt = part->bb_tilt * (1.0f - part->bb_rand_tilt * r_tilt);
-						bb.time = pa_time;
-					}
 
-					pixsize = ED_view3d_pixel_size(rv3d, state.co) * pixsize_scale;
+						pixsize = ED_view3d_pixel_size(rv3d, state.co) * pixsize_scale;
 
-					draw_particle(&state, draw_as, part->draw, pixsize, imat, part->draw_line, &bb, pdd);
+						draw_particle(&state, draw_as, part->draw, pixsize, imat, part->draw_line, &bb, pdd);
 
-					totpoint++;
-					drawn = 1;
+						totpoint++;
+						drawn = 1;
+					}
 				}
-			}
-
-			if(drawn) {
-				/* additional things to draw for each particle	*/
-				/* (velocity, size and number)					*/
-				if((part->draw & PART_DRAW_VEL) && pdd && pdd->vedata){
-					copy_v3_v3(pdd->ved,state.co);
-					pdd->ved += 3;
-					mul_v3_v3fl(vel, state.vel, timestep);
-					add_v3_v3v3(pdd->ved, state.co, vel);
-					pdd->ved+=3;
 
-					totve++;
-				}
+				if (drawn) {
+					/* additional things to draw for each particle	*/
+					/* (velocity, size and number)					*/
+					if ((part->draw & PART_DRAW_VEL) && pdd && pdd->vedata) {
+						copy_v3_v3(pdd->ved, state.co);
+						pdd->ved += 3;
+						mul_v3_v3fl(vel, state.vel, timestep);
+						add_v3_v3v3(pdd->ved, state.co, vel);
+						pdd->ved += 3;
+
+						totve++;
+					}
 
-				if(part->draw & PART_DRAW_SIZE){
-					setlinestyle(3);
-					drawcircball(GL_LINE_LOOP, state.co, pa_size, imat);
-					setlinestyle(0);
-				}
+					if (part->draw & PART_DRAW_SIZE) {
+						setlinestyle(3);
+						drawcircball(GL_LINE_LOOP, state.co, pa_size, imat);
+						setlinestyle(0);
+					}
 
 
-				if((part->draw & PART_DRAW_NUM || part->draw & PART_DRAW_HEALTH) && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0){
-					float vec_txt[3];
-					char *val_pos= numstr;
-					numstr[0]= '\0';
+					if ((part->draw & PART_DRAW_NUM || part->draw & PART_DRAW_HEALTH) &&
+					    (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0)
+					{
+						float vec_txt[3];
+						char *val_pos = numstr;
+						numstr[0] = '\0';
 
-					if(part->draw&PART_DRAW_NUM) {
-						if(a < totpart && (part->draw & PART_DRAW_HEALTH) && (part->phystype==PART_PHYS_BOIDS)) {
-							sprintf(val_pos, "%d:%.2f", a, pa_health);
+						if (part->draw & PART_DRAW_NUM) {
+							if (a < totpart && (part->draw & PART_DRAW_HEALTH) && (part->phystype == PART_PHYS_BOIDS)) {
+								sprintf(val_pos, "%d:%.2f", a, pa_health);
+							}
+							else {
+								sprintf(val_pos, "%d", a);
+							}
 						}
 						else {
-							sprintf(val_pos, "%d", a);
-						}
-					}
-					else {
-						if(a < totpart && (part->draw & PART_DRAW_HEALTH) && (part->phystype==PART_PHYS_BOIDS)) {
-							sprintf(val_pos, "%.2f", pa_health);
+							if (a < totpart && (part->draw & PART_DRAW_HEALTH) && (part->phystype == PART_PHYS_BOIDS)) {
+								sprintf(val_pos, "%.2f", pa_health);
+							}
 						}
-					}
 
-					/* in path drawing state.co is the end point */
-					/* use worldspace beause object matrix is already applied */
-					mul_v3_m4v3(vec_txt, ob->imat, state.co);
-					view3d_cached_text_draw_add(vec_txt, numstr, 10, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, tcol);
+						/* in path drawing state.co is the end point */
+						/* use worldspace beause object matrix is already applied */
+						mul_v3_m4v3(vec_txt, ob->imat, state.co);
+						view3d_cached_text_draw_add(vec_txt, numstr, 10, V3D_CACHE_TEXT_WORLDSPACE | V3D_CACHE_TEXT_ASCII, tcol);
+					}
 				}
 			}
 		}
@@ -4474,44 +4620,46 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
 	glGetIntegerv(GL_POLYGON_MODE, polygonmode);
 	glEnableClientState(GL_VERTEX_ARRAY);
 
-	if(draw_as==PART_DRAW_PATH){
+	if (draw_as == PART_DRAW_PATH) {
 		ParticleCacheKey **cache, *path;
-		float /* *cd2=NULL, */ /* UNUSED */ *cdata2=NULL;
+		float /* *cd2=NULL, */ /* UNUSED */ *cdata2 = NULL;
 
 		/* setup gl flags */
 		if (1) { //ob_dt > OB_WIRE) {
 			glEnableClientState(GL_NORMAL_ARRAY);
 
-			if(part->draw_col == PART_DRAW_COL_MAT)
+			if (part->draw_col == PART_DRAW_COL_MAT)
 				glEnableClientState(GL_COLOR_ARRAY);
 
 			glEnable(GL_LIGHTING);
 			glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
 			glEnable(GL_COLOR_MATERIAL);
 		}
-		/*else {
+#if 0
+		else {
 			glDisableClientState(GL_NORMAL_ARRAY);
 
 			glDisable(GL_COLOR_MATERIAL);
 			glDisable(GL_LIGHTING);
 			UI_ThemeColor(TH_WIRE);
-		}*/
+		}
+#endif
 
-		if(totchild && (part->draw&PART_DRAW_PARENT)==0)
-			totpart=0;
-		else if(psys->pathcache==NULL)
-			totpart=0;
+		if (totchild && (part->draw & PART_DRAW_PARENT) == 0)
+			totpart = 0;
+		else if (psys->pathcache == NULL)
+			totpart = 0;
 
 		/* draw actual/parent particles */
-		cache=psys->pathcache;
-		for(a=0, pa=psys->particles; a<totpart; a++, pa++){
-			path=cache[a];
-			if(path->steps > 0) {
+		cache = psys->pathcache;
+		for (a = 0, pa = psys->particles; a < totpart; a++, pa++) {
+			path = cache[a];
+			if (path->steps > 0) {
 				glVertexPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), path->co);
 
-				if(1) { //ob_dt > OB_WIRE) {
+				if (1) { //ob_dt > OB_WIRE) {
 					glNormalPointer(GL_FLOAT, sizeof(ParticleCacheKey), path->vel);
-					if(part->draw_col == PART_DRAW_COL_MAT)
+					if (part->draw_col == PART_DRAW_COL_MAT)
 						glColorPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), path->col);
 				}
 
@@ -4520,14 +4668,14 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
 		}
 		
 		/* draw child particles */
-		cache=psys->childcache;
-		for(a=0; a<totchild; a++){
-			path=cache[a];
+		cache = psys->childcache;
+		for (a = 0; a < totchild; a++) {
+			path = cache[a];
 			glVertexPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), path->co);
 
-			if(1) { //ob_dt > OB_WIRE) {
+			if (1) { //ob_dt > OB_WIRE) {
 				glNormalPointer(GL_FLOAT, sizeof(ParticleCacheKey), path->vel);
-				if(part->draw_col == PART_DRAW_COL_MAT)
+				if (part->draw_col == PART_DRAW_COL_MAT)
 					glColorPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), path->col);
 			}
 
@@ -4536,45 +4684,45 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
 
 
 		/* restore & clean up */
-		if(1) { //ob_dt > OB_WIRE) {
-			if(part->draw_col == PART_DRAW_COL_MAT)
+		if (1) { //ob_dt > OB_WIRE) {
+			if (part->draw_col == PART_DRAW_COL_MAT)
 				glDisable(GL_COLOR_ARRAY);
 			glDisable(GL_COLOR_MATERIAL);
 		}
 
-		if(cdata2)
+		if (cdata2)
 			MEM_freeN(cdata2);
-		/* cd2= */ /* UNUSED */ cdata2=NULL;
+		/* cd2= */ /* UNUSED */ cdata2 = NULL;
 
 		glLineWidth(1.0f);
 
-		if((part->draw & PART_DRAW_NUM) && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0){
-			cache=psys->pathcache;
+		if ((part->draw & PART_DRAW_NUM) && (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
+			cache = psys->pathcache;
 
-			for(a=0, pa=psys->particles; a<totpart; a++, pa++){
+			for (a = 0, pa = psys->particles; a < totpart; a++, pa++) {
 				float vec_txt[3];
 				BLI_snprintf(numstr, sizeof(numstr), "%i", a);
 				/* use worldspace beause object matrix is already applied */
 				mul_v3_m4v3(vec_txt, ob->imat, cache[a]->co);
-				view3d_cached_text_draw_add(vec_txt, numstr, 10, V3D_CACHE_TEXT_WORLDSPACE|V3D_CACHE_TEXT_ASCII, tcol);
+				view3d_cached_text_draw_add(vec_txt, numstr, 10, V3D_CACHE_TEXT_WORLDSPACE | V3D_CACHE_TEXT_ASCII, tcol);
 			}
 		}
 	}
-	else if(pdd && ELEM(draw_as, 0, PART_DRAW_CIRC)==0){
+	else if (pdd && ELEM(draw_as, 0, PART_DRAW_CIRC) == 0) {
 		glDisableClientState(GL_COLOR_ARRAY);
 
 		/* enable point data array */
-		if(pdd->vdata){
+		if (pdd->vdata) {
 			glEnableClientState(GL_VERTEX_ARRAY);
 			glVertexPointer(3, GL_FLOAT, 0, pdd->vdata);
 		}
 		else
 			glDisableClientState(GL_VERTEX_ARRAY);
 
-		if(select) {
+		if (select) {
 			UI_ThemeColor(TH_ACTIVE);
 			
-			if(part->draw_size)
+			if (part->draw_size)
 				glPointSize(part->draw_size + 2);
 			else
 				glPointSize(4.0);
@@ -4592,17 +4740,17 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
 		/* enable other data arrays */
 
 		/* billboards are drawn this way */
-		if(pdd->ndata && ob_dt>OB_WIRE){
+		if (pdd->ndata && ob_dt > OB_WIRE) {
 			glEnableClientState(GL_NORMAL_ARRAY);
 			glNormalPointer(GL_FLOAT, 0, pdd->ndata);
 			glEnable(GL_LIGHTING);
 		}
-		else{
+		else {
 			glDisableClientState(GL_NORMAL_ARRAY);
 			glDisable(GL_LIGHTING);
 		}
 
-		if(pdd->cdata){
+		if (pdd->cdata) {
 			glEnableClientState(GL_COLOR_ARRAY);
 			glColorPointer(3, GL_FLOAT, 0, pdd->cdata);
 		}
@@ -4613,13 +4761,13 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
 		pdd->totpoint = totpoint;
 	}
 
-	if(pdd && pdd->vedata){
+	if (pdd && pdd->vedata) {
 		glDisableClientState(GL_COLOR_ARRAY);
 		cpack(0xC0C0C0);
 		
 		glVertexPointer(3, GL_FLOAT, 0, pdd->vedata);
 		
-		glDrawArrays(GL_LINES, 0, 2*totve);
+		glDrawArrays(GL_LINES, 0, 2 * totve);
 	}
 
 	glPolygonMode(GL_FRONT, polygonmode[0]);
@@ -4632,39 +4780,39 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
 	glDisableClientState(GL_VERTEX_ARRAY);
 	glDisableClientState(GL_NORMAL_ARRAY);
 
-	if(states)
+	if (states)
 		MEM_freeN(states);
 
 	psys->flag &= ~PSYS_DRAWING;
 
 	/* draw data can't be saved for billboards as they must update to target changes */
-	if(draw_as == PART_DRAW_BB) {
+	if (draw_as == PART_DRAW_BB) {
 		psys_free_pdd(psys);
 		pdd->flag &= ~PARTICLE_DRAW_DATA_UPDATED;
 	}
 
-	if(psys->lattice){
+	if (psys->lattice) {
 		end_latt_deform(psys->lattice);
-		psys->lattice= NULL;
+		psys->lattice = NULL;
 	}
 
-	if(pdd) {
+	if (pdd) {
 		/* drop references to stack memory */
-		pdd->ma_col= NULL;
+		pdd->ma_col = NULL;
 	}
 
-	if( (base->flag & OB_FROMDUPLI) && (ob->flag & OB_FROMGROUP) ) {
+	if ( (base->flag & OB_FROMDUPLI) && (ob->flag & OB_FROMGROUP) ) {
 		glLoadMatrixf(rv3d->viewmat);
 	}
 }
 
 static void draw_update_ptcache_edit(Scene *scene, Object *ob, PTCacheEdit *edit)
 {
-	if(edit->psys && edit->psys->flag & PSYS_HAIR_UPDATED)
+	if (edit->psys && edit->psys->flag & PSYS_HAIR_UPDATED)
 		PE_update_object(scene, ob, 0);
 
 	/* create path and child path cache if it doesn't exist already */
-	if(edit->pathcache == NULL)
+	if (edit->pathcache == NULL)
 		psys_cache_edit_paths(scene, ob, edit, CFRA);
 }
 
@@ -4675,18 +4823,18 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
 	PTCacheEditKey *key;
 	ParticleEditSettings *pset = PE_settings(scene);
 	int i, k, totpoint = edit->totpoint, timed = pset->flag & PE_FADE_TIME ? pset->fade_frames : 0;
-	int steps=1;
+	int steps = 1;
 	float sel_col[3];
 	float nosel_col[3];
 	float *pathcol = NULL, *pcol;
 
-	if(edit->pathcache == NULL)
+	if (edit->pathcache == NULL)
 		return;
 
 	PE_hide_keys_time(scene, edit, CFRA);
 
 	/* opengl setup */
-	if((v3d->flag & V3D_ZBUF_SELECT)==0)
+	if ((v3d->flag & V3D_ZBUF_SELECT) == 0)
 		glDisable(GL_DEPTH_TEST);
 
 	/* get selection theme colors */
@@ -4694,10 +4842,10 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
 	UI_GetThemeColor3fv(TH_VERTEX, nosel_col);
 
 	/* draw paths */
-	if(timed) {
+	if (timed) {
 		glEnable(GL_BLEND);
 		steps = (*edit->pathcache)->steps + 1;
-		pathcol = MEM_callocN(steps*4*sizeof(float), "particle path color data");
+		pathcol = MEM_callocN(steps * 4 * sizeof(float), "particle path color data");
 	}
 
 	glEnableClientState(GL_VERTEX_ARRAY);
@@ -4707,23 +4855,23 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
 	glEnable(GL_COLOR_MATERIAL);
 	glShadeModel(GL_SMOOTH);
 
-	if(pset->brushtype == PE_BRUSH_WEIGHT) {
+	if (pset->brushtype == PE_BRUSH_WEIGHT) {
 		glLineWidth(2.0f);
 		glDisable(GL_LIGHTING);
 	}
 
-	cache=edit->pathcache;
-	for(i=0; i<totpoint; i++){
+	cache = edit->pathcache;
+	for (i = 0; i < totpoint; i++) {
 		path = cache[i];
 		glVertexPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), path->co);
 
-		if(timed) {
-			for(k=0, pcol=pathcol, pkey=path; k<steps; k++, pkey++, pcol+=4){
+		if (timed) {
+			for (k = 0, pcol = pathcol, pkey = path; k < steps; k++, pkey++, pcol += 4) {
 				copy_v3_v3(pcol, pkey->col);
-				pcol[3] = 1.0f - fabsf((float)(CFRA) - pkey->time)/(float)pset->fade_frames;
+				pcol[3] = 1.0f - fabsf((float)(CFRA) -pkey->time) / (float)pset->fade_frames;
 			}
 
-			glColorPointer(4, GL_FLOAT, 4*sizeof(float), pathcol);
+			glColorPointer(4, GL_FLOAT, 4 * sizeof(float), pathcol);
 		}
 		else
 			glColorPointer(3, GL_FLOAT, sizeof(ParticleCacheKey), path->col);
@@ -4731,75 +4879,75 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
 		glDrawArrays(GL_LINE_STRIP, 0, path->steps + 1);
 	}
 
-	if(pathcol) { MEM_freeN(pathcol); pathcol = pcol = NULL; }
+	if (pathcol) { MEM_freeN(pathcol); pathcol = pcol = NULL; }
 
 
 	/* draw edit vertices */
-	if(pset->selectmode!=SCE_SELECT_PATH){
+	if (pset->selectmode != SCE_SELECT_PATH) {
 		glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE));
 
-		if(pset->selectmode==SCE_SELECT_POINT){
-			float *pd=NULL,*pdata=NULL;
-			float *cd=NULL,*cdata=NULL;
+		if (pset->selectmode == SCE_SELECT_POINT) {
+			float *pd = NULL, *pdata = NULL;
+			float *cd = NULL, *cdata = NULL;
 			int totkeys = 0;
 
-			for (i=0, point=edit->points; i<totpoint; i++, point++)
-				if(!(point->flag & PEP_HIDE))
+			for (i = 0, point = edit->points; i < totpoint; i++, point++)
+				if (!(point->flag & PEP_HIDE))
 					totkeys += point->totkey;
 
-			if(edit->points && !(edit->points->keys->flag & PEK_USE_WCO))
-				pd=pdata=MEM_callocN(totkeys*3*sizeof(float), "particle edit point data");
-			cd=cdata=MEM_callocN(totkeys*(timed?4:3)*sizeof(float), "particle edit color data");
+			if (edit->points && !(edit->points->keys->flag & PEK_USE_WCO))
+				pd = pdata = MEM_callocN(totkeys * 3 * sizeof(float), "particle edit point data");
+			cd = cdata = MEM_callocN(totkeys * (timed ? 4 : 3) * sizeof(float), "particle edit color data");
 
-			for(i=0, point=edit->points; i<totpoint; i++, point++){
-				if(point->flag & PEP_HIDE)
+			for (i = 0, point = edit->points; i < totpoint; i++, point++) {
+				if (point->flag & PEP_HIDE)
 					continue;
 
-				for(k=0, key=point->keys; k<point->totkey; k++, key++){
-					if(pd) {
+				for (k = 0, key = point->keys; k < point->totkey; k++, key++) {
+					if (pd) {
 						copy_v3_v3(pd, key->co);
 						pd += 3;
 					}
 
-					if(key->flag&PEK_SELECT){
-						copy_v3_v3(cd,sel_col);
+					if (key->flag & PEK_SELECT) {
+						copy_v3_v3(cd, sel_col);
 					}
-					else{
-						copy_v3_v3(cd,nosel_col);
+					else {
+						copy_v3_v3(cd, nosel_col);
 					}
 
-					if(timed)
-						*(cd+3) = 1.0f - fabsf((float)CFRA - *key->time)/(float)pset->fade_frames;
+					if (timed)
+						*(cd + 3) = 1.0f - fabsf((float)CFRA - *key->time) / (float)pset->fade_frames;
 
-					cd += (timed?4:3);
+					cd += (timed ? 4 : 3);
 				}
 			}
-			cd=cdata;
-			pd=pdata;
-			for(i=0, point=edit->points; i<totpoint; i++, point++){
-				if(point->flag & PEP_HIDE)
+			cd = cdata;
+			pd = pdata;
+			for (i = 0, point = edit->points; i < totpoint; i++, point++) {
+				if (point->flag & PEP_HIDE || point->totkey == 0)
 					continue;
 
-				if(point->keys->flag & PEK_USE_WCO)
+				if (point->keys->flag & PEK_USE_WCO)
 					glVertexPointer(3, GL_FLOAT, sizeof(PTCacheEditKey), point->keys->world_co);
 				else
-					glVertexPointer(3, GL_FLOAT, 3*sizeof(float), pd);
+					glVertexPointer(3, GL_FLOAT, 3 * sizeof(float), pd);
 
-				glColorPointer((timed?4:3), GL_FLOAT, (timed?4:3)*sizeof(float), cd);
+				glColorPointer((timed ? 4 : 3), GL_FLOAT, (timed ? 4 : 3) * sizeof(float), cd);
 
 				glDrawArrays(GL_POINTS, 0, point->totkey);
 
 				pd += pd ? 3 * point->totkey : 0;
-				cd += (timed?4:3) * point->totkey;
+				cd += (timed ? 4 : 3) * point->totkey;
 			}
-			if(pdata) { MEM_freeN(pdata); pd=pdata=NULL; }
-			if(cdata) { MEM_freeN(cdata); cd=cdata=NULL; }
+			if (pdata) { MEM_freeN(pdata); pd = pdata = NULL; }
+			if (cdata) { MEM_freeN(cdata); cd = cdata = NULL; }
 		}
-		else if(pset->selectmode == SCE_SELECT_END){
-			for(i=0, point=edit->points; i<totpoint; i++, point++){
-				if((point->flag & PEP_HIDE)==0){
+		else if (pset->selectmode == SCE_SELECT_END) {
+			for (i = 0, point = edit->points; i < totpoint; i++, point++) {
+				if ((point->flag & PEP_HIDE) == 0 && point->totkey) {
 					key = point->keys + point->totkey - 1;
-					if(key->flag & PEK_SELECT)
+					if (key->flag & PEK_SELECT)
 						glColor3fv(sel_col);
 					else
 						glColor3fv(nosel_col);
@@ -4819,18 +4967,18 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
 	glDisableClientState(GL_NORMAL_ARRAY);
 	glDisableClientState(GL_VERTEX_ARRAY);
 	glShadeModel(GL_FLAT);
-	if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+	if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
 	glLineWidth(1.0f);
 	glPointSize(1.0);
 }
 //static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float tw,float th)
-static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float ith,float drw_size)
+static void ob_draw_RE_motion(float com[3], float rotscale[3][3], float itw, float ith, float drw_size)
 {
 	float tr[3][3];
-	float root[3],tip[3];
-	float tw,th;
+	float root[3], tip[3];
+	float tw, th;
 	/* take a copy for not spoiling original */
-	copy_m3_m3(tr,rotscale);
+	copy_m3_m3(tr, rotscale);
 	tw = itw * drw_size;
 	th = ith * drw_size;
 
@@ -4838,50 +4986,50 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float
 	glBegin(GL_LINES);
 	root[1] = root[2] = 0.0f;
 	root[0] = -drw_size;
-	mul_m3_v3(tr,root);
+	mul_m3_v3(tr, root);
 	add_v3_v3(root, com);
-	glVertex3fv(root); 
+	glVertex3fv(root);
 	tip[1] = tip[2] = 0.0f;
 	tip[0] = drw_size;
-	mul_m3_v3(tr,tip);
+	mul_m3_v3(tr, tip);
 	add_v3_v3(tip, com);
-	glVertex3fv(tip); 
+	glVertex3fv(tip);
 	glEnd();
 
-	root[1] =0.0f; root[2] = tw;
+	root[1] = 0.0f; root[2] = tw;
 	root[0] = th;
 	glBegin(GL_LINES);
-	mul_m3_v3(tr,root);
+	mul_m3_v3(tr, root);
 	add_v3_v3(root, com);
-	glVertex3fv(root); 
-	glVertex3fv(tip); 
+	glVertex3fv(root);
+	glVertex3fv(tip);
 	glEnd();
 
-	root[1] =0.0f; root[2] = -tw;
+	root[1] = 0.0f; root[2] = -tw;
 	root[0] = th;
 	glBegin(GL_LINES);
-	mul_m3_v3(tr,root);
+	mul_m3_v3(tr, root);
 	add_v3_v3(root, com);
-	glVertex3fv(root); 
-	glVertex3fv(tip); 
+	glVertex3fv(root);
+	glVertex3fv(tip);
 	glEnd();
 
-	root[1] =tw; root[2] = 0.0f;
-	root[0] =th;
+	root[1] = tw; root[2] = 0.0f;
+	root[0] = th;
 	glBegin(GL_LINES);
-	mul_m3_v3(tr,root);
+	mul_m3_v3(tr, root);
 	add_v3_v3(root, com);
-	glVertex3fv(root); 
-	glVertex3fv(tip); 
+	glVertex3fv(root);
+	glVertex3fv(tip);
 	glEnd();
 
-	root[1] =-tw; root[2] = 0.0f;
+	root[1] = -tw; root[2] = 0.0f;
 	root[0] = th;
 	glBegin(GL_LINES);
-	mul_m3_v3(tr,root);
+	mul_m3_v3(tr, root);
 	add_v3_v3(root, com);
-	glVertex3fv(root); 
-	glVertex3fv(tip); 
+	glVertex3fv(root);
+	glVertex3fv(tip);
 	glEnd();
 
 	glColor4ub(0x00, 0x7F, 0x00, 155);
@@ -4889,100 +5037,100 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float
 	glBegin(GL_LINES);
 	root[0] = root[2] = 0.0f;
 	root[1] = -drw_size;
-	mul_m3_v3(tr,root);
+	mul_m3_v3(tr, root);
 	add_v3_v3(root, com);
-	glVertex3fv(root); 
+	glVertex3fv(root);
 	tip[0] = tip[2] = 0.0f;
 	tip[1] = drw_size;
-	mul_m3_v3(tr,tip);
+	mul_m3_v3(tr, tip);
 	add_v3_v3(tip, com);
-	glVertex3fv(tip); 
+	glVertex3fv(tip);
 	glEnd();
 
-	root[0] =0.0f; root[2] = tw;
+	root[0] = 0.0f; root[2] = tw;
 	root[1] = th;
 	glBegin(GL_LINES);
-	mul_m3_v3(tr,root);
+	mul_m3_v3(tr, root);
 	add_v3_v3(root, com);
-	glVertex3fv(root); 
-	glVertex3fv(tip); 
+	glVertex3fv(root);
+	glVertex3fv(tip);
 	glEnd();
 
-	root[0] =0.0f; root[2] = -tw;
+	root[0] = 0.0f; root[2] = -tw;
 	root[1] = th;
 	glBegin(GL_LINES);
-	mul_m3_v3(tr,root);
+	mul_m3_v3(tr, root);
 	add_v3_v3(root, com);
-	glVertex3fv(root); 
-	glVertex3fv(tip); 
+	glVertex3fv(root);
+	glVertex3fv(tip);
 	glEnd();
 
-	root[0] =tw; root[2] = 0.0f;
-	root[1] =th;
+	root[0] = tw; root[2] = 0.0f;
+	root[1] = th;
 	glBegin(GL_LINES);
-	mul_m3_v3(tr,root);
+	mul_m3_v3(tr, root);
 	add_v3_v3(root, com);
-	glVertex3fv(root); 
-	glVertex3fv(tip); 
+	glVertex3fv(root);
+	glVertex3fv(tip);
 	glEnd();
 
-	root[0] =-tw; root[2] = 0.0f;
+	root[0] = -tw; root[2] = 0.0f;
 	root[1] = th;
 	glBegin(GL_LINES);
-	mul_m3_v3(tr,root);
+	mul_m3_v3(tr, root);
 	add_v3_v3(root, com);
-	glVertex3fv(root); 
-	glVertex3fv(tip); 
+	glVertex3fv(root);
+	glVertex3fv(tip);
 	glEnd();
 
 	glColor4ub(0x00, 0x00, 0x7F, 155);
 	glBegin(GL_LINES);
 	root[0] = root[1] = 0.0f;
 	root[2] = -drw_size;
-	mul_m3_v3(tr,root);
+	mul_m3_v3(tr, root);
 	add_v3_v3(root, com);
-	glVertex3fv(root); 
+	glVertex3fv(root);
 	tip[0] = tip[1] = 0.0f;
 	tip[2] = drw_size;
-	mul_m3_v3(tr,tip);
+	mul_m3_v3(tr, tip);
 	add_v3_v3(tip, com);
-	glVertex3fv(tip); 
+	glVertex3fv(tip);
 	glEnd();
 
-	root[0] =0.0f; root[1] = tw;
+	root[0] = 0.0f; root[1] = tw;
 	root[2] = th;
 	glBegin(GL_LINES);
-	mul_m3_v3(tr,root);
+	mul_m3_v3(tr, root);
 	add_v3_v3(root, com);
-	glVertex3fv(root); 
-	glVertex3fv(tip); 
+	glVertex3fv(root);
+	glVertex3fv(tip);
 	glEnd();
 
-	root[0] =0.0f; root[1] = -tw;
+	root[0] = 0.0f; root[1] = -tw;
 	root[2] = th;
 	glBegin(GL_LINES);
-	mul_m3_v3(tr,root);
+	mul_m3_v3(tr, root);
 	add_v3_v3(root, com);
-	glVertex3fv(root); 
-	glVertex3fv(tip); 
+	glVertex3fv(root);
+	glVertex3fv(tip);
 	glEnd();
 
 	root[0] = tw; root[1] = 0.0f;
 	root[2] = th;
 	glBegin(GL_LINES);
-	mul_m3_v3(tr,root);
+	mul_m3_v3(tr, root);
 	add_v3_v3(root, com);
-	glVertex3fv(root); 
-	glVertex3fv(tip); 
+	glVertex3fv(root);
+	glVertex3fv(tip);
 	glEnd();
 
 	root[0] = -tw; root[1] = 0.0f;
 	root[2] = th;
 	glBegin(GL_LINES);
-	mul_m3_v3(tr,root);
+	mul_m3_v3(tr, root);
 	add_v3_v3(root, com);
-	glVertex3fv(root); 
-	glVertex3fv(tip); 
+	glVertex3fv(root);
+	glVertex3fv(tip);
 	glEnd();
 }
 
@@ -4994,49 +5142,49 @@ static void tekenhandlesN(Nurb *nu, short sel, short hide_handles)
 	float *fp;
 	int a;
 
-	if(nu->hide || hide_handles) return;
+	if (nu->hide || hide_handles) return;
 
-	glBegin(GL_LINES); 
+	glBegin(GL_LINES);
 
-	if(nu->type == CU_BEZIER) {
+	if (nu->type == CU_BEZIER) {
 
 #define TH_HANDLE_COL_TOT ((TH_HANDLE_SEL_FREE - TH_HANDLE_FREE) + 1)
-		/* use MIN2 when indexing to ensure newer files dont read outside the array */
+		/* use MIN2 when indexing to ensure newer files don't read outside the array */
 		unsigned char handle_cols[TH_HANDLE_COL_TOT][3];
-		const int basecol= sel ? TH_HANDLE_SEL_FREE : TH_HANDLE_FREE;
+		const int basecol = sel ? TH_HANDLE_SEL_FREE : TH_HANDLE_FREE;
 
-		for (a=0; a < TH_HANDLE_COL_TOT; a++) {
+		for (a = 0; a < TH_HANDLE_COL_TOT; a++) {
 			UI_GetThemeColor3ubv(basecol + a, handle_cols[a]);
 		}
 
-		bezt= nu->bezt;
-		a= nu->pntsu;
-		while(a--) {
-			if(bezt->hide==0) {
-				if( (bezt->f2 & SELECT)==sel) {
-					fp= bezt->vec[0];
+		bezt = nu->bezt;
+		a = nu->pntsu;
+		while (a--) {
+			if (bezt->hide == 0) {
+				if ( (bezt->f2 & SELECT) == sel) {
+					fp = bezt->vec[0];
 
-					glColor3ubv(handle_cols[MIN2(bezt->h1, TH_HANDLE_COL_TOT-1)]);
+					glColor3ubv(handle_cols[MIN2(bezt->h1, TH_HANDLE_COL_TOT - 1)]);
 					glVertex3fv(fp);
-					glVertex3fv(fp+3); 
+					glVertex3fv(fp + 3);
 
-					glColor3ubv(handle_cols[MIN2(bezt->h2, TH_HANDLE_COL_TOT-1)]);
-					glVertex3fv(fp+3); 
-					glVertex3fv(fp+6); 
+					glColor3ubv(handle_cols[MIN2(bezt->h2, TH_HANDLE_COL_TOT - 1)]);
+					glVertex3fv(fp + 3);
+					glVertex3fv(fp + 6);
 				}
-				else if( (bezt->f1 & SELECT)==sel) {
-					fp= bezt->vec[0];
+				else if ( (bezt->f1 & SELECT) == sel) {
+					fp = bezt->vec[0];
 
-					glColor3ubv(handle_cols[MIN2(bezt->h1, TH_HANDLE_COL_TOT-1)]);
-					glVertex3fv(fp); 
-					glVertex3fv(fp+3); 
+					glColor3ubv(handle_cols[MIN2(bezt->h1, TH_HANDLE_COL_TOT - 1)]);
+					glVertex3fv(fp);
+					glVertex3fv(fp + 3);
 				}
-				else if( (bezt->f3 & SELECT)==sel) {
-					fp= bezt->vec[1];
+				else if ( (bezt->f3 & SELECT) == sel) {
+					fp = bezt->vec[1];
 
-					glColor3ubv(handle_cols[MIN2(bezt->h2, TH_HANDLE_COL_TOT-1)]);
-					glVertex3fv(fp); 
-					glVertex3fv(fp+3); 
+					glColor3ubv(handle_cols[MIN2(bezt->h2, TH_HANDLE_COL_TOT - 1)]);
+					glVertex3fv(fp);
+					glVertex3fv(fp + 3);
 				}
 			}
 			bezt++;
@@ -5054,32 +5202,32 @@ static void tekenhandlesN_active(Nurb *nu)
 	float *fp;
 	int a;
 
-	if(nu->hide) return;
+	if (nu->hide) return;
 
 	UI_ThemeColor(TH_ACTIVE_SPLINE);
 	glLineWidth(2);
 
 	glBegin(GL_LINES);
 
-	if(nu->type == CU_BEZIER) {
-		bezt= nu->bezt;
-		a= nu->pntsu;
-		while(a--) {
-			if(bezt->hide==0) {
-				fp= bezt->vec[0];
+	if (nu->type == CU_BEZIER) {
+		bezt = nu->bezt;
+		a = nu->pntsu;
+		while (a--) {
+			if (bezt->hide == 0) {
+				fp = bezt->vec[0];
 
 				glVertex3fv(fp);
-				glVertex3fv(fp+3);
+				glVertex3fv(fp + 3);
 
-				glVertex3fv(fp+3);
-				glVertex3fv(fp+6);
+				glVertex3fv(fp + 3);
+				glVertex3fv(fp + 6);
 			}
 			bezt++;
 		}
 	}
 	glEnd();
 
-	glColor3ub(0,0,0);
+	glColor3ub(0, 0, 0);
 	glLineWidth(1);
 }
 
@@ -5090,56 +5238,59 @@ static void tekenvertsN(Nurb *nu, short sel, short hide_handles, void *lastsel)
 	float size;
 	int a, color;
 
-	if(nu->hide) return;
+	if (nu->hide) return;
 
-	if(sel) color= TH_VERTEX_SELECT;
-	else color= TH_VERTEX;
+	if (sel) color = TH_VERTEX_SELECT;
+	else color = TH_VERTEX;
 
 	UI_ThemeColor(color);
 
-	size= UI_GetThemeValuef(TH_VERTEX_SIZE);
+	size = UI_GetThemeValuef(TH_VERTEX_SIZE);
 	glPointSize(size);
 	
 	bglBegin(GL_POINTS);
 	
-	if(nu->type == CU_BEZIER) {
+	if (nu->type == CU_BEZIER) {
 
-		bezt= nu->bezt;
-		a= nu->pntsu;
-		while(a--) {
-			if(bezt->hide==0) {
+		bezt = nu->bezt;
+		a = nu->pntsu;
+		while (a--) {
+			if (bezt->hide == 0) {
 				if (sel == 1 && bezt == lastsel) {
 					UI_ThemeColor(TH_LASTSEL_POINT);
 					bglVertex3fv(bezt->vec[1]);
 
 					if (!hide_handles) {
-						if(bezt->f1 & SELECT) bglVertex3fv(bezt->vec[0]);
-						if(bezt->f3 & SELECT) bglVertex3fv(bezt->vec[2]);
+						if (bezt->f1 & SELECT) bglVertex3fv(bezt->vec[0]);
+						if (bezt->f3 & SELECT) bglVertex3fv(bezt->vec[2]);
 					}
 
 					UI_ThemeColor(color);
-				} else if (hide_handles) {
-					if((bezt->f2 & SELECT)==sel) bglVertex3fv(bezt->vec[1]);
-				} else {
-					if((bezt->f1 & SELECT)==sel) bglVertex3fv(bezt->vec[0]);
-					if((bezt->f2 & SELECT)==sel) bglVertex3fv(bezt->vec[1]);
-					if((bezt->f3 & SELECT)==sel) bglVertex3fv(bezt->vec[2]);
+				}
+				else if (hide_handles) {
+					if ((bezt->f2 & SELECT) == sel) bglVertex3fv(bezt->vec[1]);
+				}
+				else {
+					if ((bezt->f1 & SELECT) == sel) bglVertex3fv(bezt->vec[0]);
+					if ((bezt->f2 & SELECT) == sel) bglVertex3fv(bezt->vec[1]);
+					if ((bezt->f3 & SELECT) == sel) bglVertex3fv(bezt->vec[2]);
 				}
 			}
 			bezt++;
 		}
 	}
 	else {
-		bp= nu->bp;
-		a= nu->pntsu*nu->pntsv;
-		while(a--) {
-			if(bp->hide==0) {
+		bp = nu->bp;
+		a = nu->pntsu * nu->pntsv;
+		while (a--) {
+			if (bp->hide == 0) {
 				if (bp == lastsel) {
 					UI_ThemeColor(TH_LASTSEL_POINT);
 					bglVertex3fv(bp->vec);
 					UI_ThemeColor(color);
-				} else {
-					if((bp->f1 & SELECT)==sel) bglVertex3fv(bp->vec);
+				}
+				else {
+					if ((bp->f1 & SELECT) == sel) bglVertex3fv(bp->vec);
 				}
 			}
 			bp++;
@@ -5158,19 +5309,19 @@ static void editnurb_draw_active_poly(Nurb *nu)
 	UI_ThemeColor(TH_ACTIVE_SPLINE);
 	glLineWidth(2);
 
-	bp= nu->bp;
-	for(b=0; b<nu->pntsv; b++) {
-		if(nu->flagu & 1) glBegin(GL_LINE_LOOP);
+	bp = nu->bp;
+	for (b = 0; b < nu->pntsv; b++) {
+		if (nu->flagu & 1) glBegin(GL_LINE_LOOP);
 		else glBegin(GL_LINE_STRIP);
 
-		for(a=0; a<nu->pntsu; a++, bp++) {
+		for (a = 0; a < nu->pntsu; a++, bp++) {
 			glVertex3fv(bp->vec);
 		}
 
 		glEnd();
 	}
 
-	glColor3ub(0,0,0);
+	glColor3ub(0, 0, 0);
 	glLineWidth(1);
 }
 
@@ -5183,39 +5334,39 @@ static void editnurb_draw_active_nurbs(Nurb *nu)
 	glLineWidth(2);
 
 	glBegin(GL_LINES);
-	bp= nu->bp;
-	for(b=0; b<nu->pntsv; b++) {
-		bp1= bp;
+	bp = nu->bp;
+	for (b = 0; b < nu->pntsv; b++) {
+		bp1 = bp;
 		bp++;
 
-		for(a=nu->pntsu-1; a>0; a--, bp++) {
-			if(bp->hide==0 && bp1->hide==0) {
+		for (a = nu->pntsu - 1; a > 0; a--, bp++) {
+			if (bp->hide == 0 && bp1->hide == 0) {
 				glVertex3fv(bp->vec);
 				glVertex3fv(bp1->vec);
 			}
-			bp1= bp;
+			bp1 = bp;
 		}
 	}
 
-	if(nu->pntsv > 1) {	/* surface */
+	if (nu->pntsv > 1) {    /* surface */
 
-		ofs= nu->pntsu;
-		for(b=0; b<nu->pntsu; b++) {
-			bp1= nu->bp+b;
-			bp= bp1+ofs;
-			for(a=nu->pntsv-1; a>0; a--, bp+=ofs) {
-				if(bp->hide==0 && bp1->hide==0) {
+		ofs = nu->pntsu;
+		for (b = 0; b < nu->pntsu; b++) {
+			bp1 = nu->bp + b;
+			bp = bp1 + ofs;
+			for (a = nu->pntsv - 1; a > 0; a--, bp += ofs) {
+				if (bp->hide == 0 && bp1->hide == 0) {
 					glVertex3fv(bp->vec);
 					glVertex3fv(bp1->vec);
 				}
-				bp1= bp;
+				bp1 = bp;
 			}
 		}
 	}
 
 	glEnd();
 
-	glColor3ub(0,0,0);
+	glColor3ub(0, 0, 0);
 	glLineWidth(1);
 }
 
@@ -5224,117 +5375,121 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel)
 	Nurb *nu;
 	BPoint *bp, *bp1;
 	int a, b, ofs, index;
-	Curve *cu= (Curve*)ob->data;
-
-	index= 0;
-	nu= nurb;
-	while(nu) {
-		if(nu->hide==0) {
-			switch(nu->type) {
-			case CU_POLY:
-				if (!sel && index== cu->actnu) {
-					/* we should draw active spline highlight below everything */
-					editnurb_draw_active_poly(nu);
-				}
-
-				UI_ThemeColor(TH_NURB_ULINE);
-				bp= nu->bp;
-				for(b=0; b<nu->pntsv; b++) {
-					if(nu->flagu & 1) glBegin(GL_LINE_LOOP);
-					else glBegin(GL_LINE_STRIP);
-
-					for(a=0; a<nu->pntsu; a++, bp++) {
-						glVertex3fv(bp->vec);
+	Curve *cu = (Curve *)ob->data;
+
+	index = 0;
+	nu = nurb;
+	while (nu) {
+		if (nu->hide == 0) {
+			switch (nu->type) {
+				case CU_POLY:
+					if (!sel && index == cu->actnu) {
+						/* we should draw active spline highlight below everything */
+						editnurb_draw_active_poly(nu);
 					}
 
-					glEnd();
-				}
-				break;
-			case CU_NURBS:
-				if (!sel && index== cu->actnu) {
-					/* we should draw active spline highlight below everything */
-					editnurb_draw_active_nurbs(nu);
-				}
+					UI_ThemeColor(TH_NURB_ULINE);
+					bp = nu->bp;
+					for (b = 0; b < nu->pntsv; b++) {
+						if (nu->flagu & 1) glBegin(GL_LINE_LOOP);
+						else glBegin(GL_LINE_STRIP);
 
-				bp= nu->bp;
-				for(b=0; b<nu->pntsv; b++) {
-					bp1= bp;
-					bp++;
-					for(a=nu->pntsu-1; a>0; a--, bp++) {
-						if(bp->hide==0 && bp1->hide==0) {
-							if(sel) {
-								if( (bp->f1 & SELECT) && ( bp1->f1 & SELECT ) ) {
-									UI_ThemeColor(TH_NURB_SEL_ULINE);
-		
-									glBegin(GL_LINE_STRIP);
-									glVertex3fv(bp->vec); 
-									glVertex3fv(bp1->vec);
-									glEnd();
-								}
-							}
-							else {
-								if( (bp->f1 & SELECT) && ( bp1->f1 & SELECT) );
-								else {
-									UI_ThemeColor(TH_NURB_ULINE);
-		
-									glBegin(GL_LINE_STRIP);
-									glVertex3fv(bp->vec); 
-									glVertex3fv(bp1->vec);
-									glEnd();
-								}
-							}
+						for (a = 0; a < nu->pntsu; a++, bp++) {
+							glVertex3fv(bp->vec);
 						}
-						bp1= bp;
+
+						glEnd();
 					}
-				}
-				if(nu->pntsv > 1) {	/* surface */
-
-					ofs= nu->pntsu;
-					for(b=0; b<nu->pntsu; b++) {
-						bp1= nu->bp+b;
-						bp= bp1+ofs;
-						for(a=nu->pntsv-1; a>0; a--, bp+=ofs) {
-							if(bp->hide==0 && bp1->hide==0) {
-								if(sel) {
-									if( (bp->f1 & SELECT) && ( bp1->f1 & SELECT) ) {
-										UI_ThemeColor(TH_NURB_SEL_VLINE);
-			
+					break;
+				case CU_NURBS:
+					if (!sel && index == cu->actnu) {
+						/* we should draw active spline highlight below everything */
+						editnurb_draw_active_nurbs(nu);
+					}
+
+					bp = nu->bp;
+					for (b = 0; b < nu->pntsv; b++) {
+						bp1 = bp;
+						bp++;
+						for (a = nu->pntsu - 1; a > 0; a--, bp++) {
+							if (bp->hide == 0 && bp1->hide == 0) {
+								if (sel) {
+									if ( (bp->f1 & SELECT) && (bp1->f1 & SELECT) ) {
+										UI_ThemeColor(TH_NURB_SEL_ULINE);
+
 										glBegin(GL_LINE_STRIP);
-										glVertex3fv(bp->vec); 
+										glVertex3fv(bp->vec);
 										glVertex3fv(bp1->vec);
 										glEnd();
 									}
 								}
 								else {
-									if( (bp->f1 & SELECT) && ( bp1->f1 & SELECT) );
+									if ((bp->f1 & SELECT) && (bp1->f1 & SELECT)) {
+										/* pass */
+									}
 									else {
-										UI_ThemeColor(TH_NURB_VLINE);
-			
+										UI_ThemeColor(TH_NURB_ULINE);
+
 										glBegin(GL_LINE_STRIP);
-										glVertex3fv(bp->vec); 
+										glVertex3fv(bp->vec);
 										glVertex3fv(bp1->vec);
 										glEnd();
 									}
 								}
 							}
-							bp1= bp;
+							bp1 = bp;
 						}
 					}
+					if (nu->pntsv > 1) {    /* surface */
+
+						ofs = nu->pntsu;
+						for (b = 0; b < nu->pntsu; b++) {
+							bp1 = nu->bp + b;
+							bp = bp1 + ofs;
+							for (a = nu->pntsv - 1; a > 0; a--, bp += ofs) {
+								if (bp->hide == 0 && bp1->hide == 0) {
+									if (sel) {
+										if ( (bp->f1 & SELECT) && (bp1->f1 & SELECT) ) {
+											UI_ThemeColor(TH_NURB_SEL_VLINE);
+
+											glBegin(GL_LINE_STRIP);
+											glVertex3fv(bp->vec);
+											glVertex3fv(bp1->vec);
+											glEnd();
+										}
+									}
+									else {
+										if ((bp->f1 & SELECT) && (bp1->f1 & SELECT)) {
+											/* pass */
+										}
+										else {
+											UI_ThemeColor(TH_NURB_VLINE);
+
+											glBegin(GL_LINE_STRIP);
+											glVertex3fv(bp->vec);
+											glVertex3fv(bp1->vec);
+											glEnd();
+										}
+									}
+								}
+								bp1 = bp;
+							}
+						}
 
-				}
-				break;
+					}
+					break;
 			}
 		}
 
 		++index;
-		nu= nu->next;
+		nu = nu->next;
 	}
 }
 
 static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, Nurb *nurb, int dt)
 {
-	ToolSettings *ts= scene->toolsettings;
-	Object *ob= base->object;
+	ToolSettings *ts = scene->toolsettings;
+	Object *ob = base->object;
 	Curve *cu = ob->data;
 	Nurb *nu;
 	BevList *bl;
@@ -5345,12 +5500,12 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
 	UI_ThemeColor(TH_WIRE);
 	drawDispList(scene, v3d, rv3d, base, dt);
 
-	if(v3d->zbuf) glDisable(GL_DEPTH_TEST);
+	if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
 	
 	/* first non-selected and active handles */
-	index= 0;
-	for(nu=nurb; nu; nu=nu->next) {
-		if(nu->type == CU_BEZIER) {
+	index = 0;
+	for (nu = nurb; nu; nu = nu->next) {
+		if (nu->type == CU_BEZIER) {
 			if (index == cu->actnu && !hide_handles)
 				tekenhandlesN_active(nu);
 			tekenhandlesN(nu, 0, hide_handles);
@@ -5360,36 +5515,36 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
 	draw_editnurb(ob, nurb, 0);
 	draw_editnurb(ob, nurb, 1);
 	/* selected handles */
-	for(nu=nurb; nu; nu=nu->next) {
-		if(nu->type == CU_BEZIER && (cu->drawflag & CU_HIDE_HANDLES)==0)
+	for (nu = nurb; nu; nu = nu->next) {
+		if (nu->type == CU_BEZIER && (cu->drawflag & CU_HIDE_HANDLES) == 0)
 			tekenhandlesN(nu, 1, hide_handles);
 		tekenvertsN(nu, 0, hide_handles, NULL);
 	}
 	
-	if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+	if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
 
-	/*	direction vectors for 3d curve paths
-		when at its lowest, dont render normals */
-	if(cu->flag & CU_3D && ts->normalsize > 0.0015f && (cu->drawflag & CU_HIDE_NORMALS)==0) {
+	/* direction vectors for 3d curve paths
+	 * when at its lowest, don't render normals */
+	if ((cu->flag & CU_3D) && (ts->normalsize > 0.0015f) && (cu->drawflag & CU_HIDE_NORMALS) == 0) {
 
 		UI_ThemeColor(TH_WIRE);
-		for (bl=cu->bev.first,nu=nurb; nu && bl; bl=bl->next,nu=nu->next) {
-			BevPoint *bevp= (BevPoint *)(bl+1);		
-			int nr= bl->nr;
-			int skip= nu->resolu/16;
+		for (bl = cu->bev.first, nu = nurb; nu && bl; bl = bl->next, nu = nu->next) {
+			BevPoint *bevp = (BevPoint *)(bl + 1);
+			int nr = bl->nr;
+			int skip = nu->resolu / 16;
 			
-			while (nr-->0) { /* accounts for empty bevel lists */
-				const float fac= bevp->radius * ts->normalsize;
+			while (nr-- > 0) { /* accounts for empty bevel lists */
+				const float fac = bevp->radius * ts->normalsize;
 				float vec_a[3]; // Offset perpendicular to the curve
 				float vec_b[3]; // Delta along the curve
 
-				vec_a[0]= fac;
-				vec_a[1]= 0.0f;
-				vec_a[2]= 0.0f;
+				vec_a[0] = fac;
+				vec_a[1] = 0.0f;
+				vec_a[2] = 0.0f;
 
-				vec_b[0]= -fac;
-				vec_b[1]= 0.0f;
-				vec_b[2]= 0.0f;
+				vec_b[0] = -fac;
+				vec_b[1] = 0.0f;
+				vec_b[2] = 0.0f;
 				
 				mul_qt_v3(bevp->quat, vec_a);
 				mul_qt_v3(bevp->quat, vec_b);
@@ -5405,36 +5560,36 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
 				glVertex3fv(vec_b);
 				glEnd();
 				
-				bevp += skip+1;
+				bevp += skip + 1;
 				nr -= skip;
 			}
 		}
 	}
 
-	if(v3d->zbuf) glDisable(GL_DEPTH_TEST);
+	if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
 	
-	for(nu=nurb; nu; nu=nu->next) {
+	for (nu = nurb; nu; nu = nu->next) {
 		tekenvertsN(nu, 1, hide_handles, cu->lastsel);
 	}
 	
-	if(v3d->zbuf) glEnable(GL_DEPTH_TEST); 
+	if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
 }
 
 /* draw a sphere for use as an empty drawtype */
-static void draw_empty_sphere (float size)
+static void draw_empty_sphere(float size)
 {
-	static GLuint displist=0;
+	static GLuint displist = 0;
 	
 	if (displist == 0) {
-		GLUquadricObj	*qobj;
+		GLUquadricObj   *qobj;
 		
-		displist= glGenLists(1);
+		displist = glGenLists(1);
 		glNewList(displist, GL_COMPILE);
 		
 		glPushMatrix();
 		
-		qobj	= gluNewQuadric(); 
-		gluQuadricDrawStyle(qobj, GLU_SILHOUETTE); 
+		qobj = gluNewQuadric();
+		gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
 		gluDisk(qobj, 0.0,  1, 16, 1);
 		
 		glRotatef(90, 0, 1, 0);
@@ -5443,7 +5598,7 @@ static void draw_empty_sphere (float size)
 		glRotatef(90, 1, 0, 0);
 		gluDisk(qobj, 0.0,  1, 16, 1);
 		
-		gluDeleteQuadric(qobj);  
+		gluDeleteQuadric(qobj);
 		
 		glPopMatrix();
 		glEndList();
@@ -5451,54 +5606,54 @@ static void draw_empty_sphere (float size)
 	
 	glScalef(size, size, size);
 	glCallList(displist);
-	glScalef(1.0f/size, 1.0f/size, 1.0f/size);
+	glScalef(1.0f / size, 1.0f / size, 1.0f / size);
 }
 
 /* draw a cone for use as an empty drawtype */
-static void draw_empty_cone (float size)
+static void draw_empty_cone(float size)
 {
-	float cent=0;
+	float cent = 0;
 	float radius;
-	GLUquadricObj *qobj = gluNewQuadric(); 
-	gluQuadricDrawStyle(qobj, GLU_SILHOUETTE); 
+	GLUquadricObj *qobj = gluNewQuadric();
+	gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
 	
 	
 	glPushMatrix();
 	
 	radius = size;
-	glTranslatef(cent,cent, cent);
+	glTranslatef(cent, cent, cent);
 	glScalef(radius, size * 2.0f, radius);
-	glRotatef(-90., 1.0, 0.0, 0.0);
+	glRotatef(-90.0, 1.0, 0.0, 0.0);
 	gluCylinder(qobj, 1.0, 0.0, 1.0, 8, 1);
 
 	glPopMatrix();
 	
-	gluDeleteQuadric(qobj); 
+	gluDeleteQuadric(qobj);
 }
 
 /* draw points on curve speed handles */
 #if 0 // XXX old animation system stuff
 static void curve_draw_speed(Scene *scene, Object *ob)
 {
-	Curve *cu= ob->data;
+	Curve *cu = ob->data;
 	IpoCurve *icu;
 	BezTriple *bezt;
 	float loc[4], dir[3];
 	int a;
 	
-	if(cu->ipo==NULL)
+	if (cu->ipo == NULL)
 		return;
 	
-	icu= cu->ipo->curve.first; 
-	if(icu==NULL || icu->totvert<2)
+	icu = cu->ipo->curve.first;
+	if (icu == NULL || icu->totvert < 2)
 		return;
 	
-	glPointSize( UI_GetThemeValuef(TH_VERTEX_SIZE) );
+	glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE) );
 	bglBegin(GL_POINTS);
 
-	for(a=0, bezt= icu->bezt; a<icu->totvert; a++, bezt++) {
-		if( where_on_path(ob, bezt->vec[1][1], loc, dir)) {
-			UI_ThemeColor((bezt->f2 & SELECT) && ob==OBACT?TH_VERTEX_SELECT:TH_VERTEX);
+	for (a = 0, bezt = icu->bezt; a < icu->totvert; a++, bezt++) {
+		if (where_on_path(ob, bezt->vec[1][1], loc, dir)) {
+			UI_ThemeColor((bezt->f2 & SELECT) && ob == OBACT ? TH_VERTEX_SELECT : TH_VERTEX);
 			bglVertex3fv(loc);
 		}
 	}
@@ -5526,14 +5681,14 @@ static void draw_textcurs(float textcurs[4][2])
 static void drawspiral(const float cent[3], float rad, float tmat[][4], int start)
 {
 	float vec[3], vx[3], vy[3];
-	const float tot_inv= (1.0f / (float)CIRCLE_RESOL);
+	const float tot_inv = (1.0f / (float)CIRCLE_RESOL);
 	int a;
-	char inverse= FALSE;
+	char inverse = FALSE;
 	float x, y, fac;
 
 	if (start < 0) {
 		inverse = TRUE;
-		start= -start;
+		start = -start;
 	}
 
 	mul_v3_v3fl(vx, tmat[0], rad);
@@ -5541,47 +5696,47 @@ static void drawspiral(const float cent[3], float rad, float tmat[][4], int star
 
 	glBegin(GL_LINE_STRIP);
 
-	if (inverse==0) {
+	if (inverse == 0) {
 		copy_v3_v3(vec, cent);
 		glVertex3fv(vec);
 
-		for(a=0; a<CIRCLE_RESOL; a++) {
-			if (a+start>=CIRCLE_RESOL)
-				start=-a + 1;
+		for (a = 0; a < CIRCLE_RESOL; a++) {
+			if (a + start >= CIRCLE_RESOL)
+				start = -a + 1;
 
-			fac= (float)a * tot_inv;
-			x= sinval[a+start] * fac;
-			y= cosval[a+start] * fac;
+			fac = (float)a * tot_inv;
+			x = sinval[a + start] * fac;
+			y = cosval[a + start] * fac;
 
-			vec[0]= cent[0] + (x * vx[0] + y * vy[0]);
-			vec[1]= cent[1] + (x * vx[1] + y * vy[1]);
-			vec[2]= cent[2] + (x * vx[2] + y * vy[2]);
+			vec[0] = cent[0] + (x * vx[0] + y * vy[0]);
+			vec[1] = cent[1] + (x * vx[1] + y * vy[1]);
+			vec[2] = cent[2] + (x * vx[2] + y * vy[2]);
 
 			glVertex3fv(vec);
 		}
 	}
 	else {
-		fac= (float)(CIRCLE_RESOL-1) * tot_inv;
-		x= sinval[start] * fac;
-		y= cosval[start] * fac;
+		fac = (float)(CIRCLE_RESOL - 1) * tot_inv;
+		x = sinval[start] * fac;
+		y = cosval[start] * fac;
 
-		vec[0]= cent[0] + (x * vx[0] + y * vy[0]);
-		vec[1]= cent[1] + (x * vx[1] + y * vy[1]);
-		vec[2]= cent[2] + (x * vx[2] + y * vy[2]);
+		vec[0] = cent[0] + (x * vx[0] + y * vy[0]);
+		vec[1] = cent[1] + (x * vx[1] + y * vy[1]);
+		vec[2] = cent[2] + (x * vx[2] + y * vy[2]);
 
 		glVertex3fv(vec);
 
-		for(a=0; a<CIRCLE_RESOL; a++) {
-			if (a+start>=CIRCLE_RESOL)
-				start=-a + 1;
+		for (a = 0; a < CIRCLE_RESOL; a++) {
+			if (a + start >= CIRCLE_RESOL)
+				start = -a + 1;
 
-			fac= (float)(-a+(CIRCLE_RESOL-1)) * tot_inv;
-			x= sinval[a+start] * fac;
-			y= cosval[a+start] * fac;
+			fac = (float)(-a + (CIRCLE_RESOL - 1)) * tot_inv;
+			x = sinval[a + start] * fac;
+			y = cosval[a + start] * fac;
 
-			vec[0]= cent[0] + (x * vx[0] + y * vy[0]);
-			vec[1]= cent[1] + (x * vx[1] + y * vy[1]);
-			vec[2]= cent[2] + (x * vx[2] + y * vy[2]);
+			vec[0] = cent[0] + (x * vx[0] + y * vy[0]);
+			vec[1] = cent[1] + (x * vx[1] + y * vy[1]);
+			vec[2] = cent[2] + (x * vx[2] + y * vy[2]);
 			glVertex3fv(vec);
 		}
 	}
@@ -5600,11 +5755,11 @@ 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 */
-	for (degrees=0; degrees<CIRCLE_RESOL; degrees++) {
-		x= cosval[degrees];
-		y= sinval[degrees];
+	for (degrees = 0; degrees < CIRCLE_RESOL; degrees++) {
+		x = cosval[degrees];
+		y = sinval[degrees];
 		
-		glVertex3f(x*size, 0.0f, y*size);
+		glVertex3f(x * size, 0.0f, y * size);
 	}
 	
 	glEnd();
@@ -5617,20 +5772,20 @@ static void drawtube(const float vec[3], float radius, float height, float tmat[
 	float cur[3];
 	drawcircball(GL_LINE_LOOP, vec, radius, tmat);
 
-	copy_v3_v3(cur,vec);
-	cur[2]+=height;
+	copy_v3_v3(cur, vec);
+	cur[2] += height;
 
 	drawcircball(GL_LINE_LOOP, cur, radius, tmat);
 
 	glBegin(GL_LINES);
-		glVertex3f(vec[0]+radius,vec[1],vec[2]);
-		glVertex3f(cur[0]+radius,cur[1],cur[2]);
-		glVertex3f(vec[0]-radius,vec[1],vec[2]);
-		glVertex3f(cur[0]-radius,cur[1],cur[2]);
-		glVertex3f(vec[0],vec[1]+radius,vec[2]);
-		glVertex3f(cur[0],cur[1]+radius,cur[2]);
-		glVertex3f(vec[0],vec[1]-radius,vec[2]);
-		glVertex3f(cur[0],cur[1]-radius,cur[2]);
+	glVertex3f(vec[0] + radius, vec[1], vec[2]);
+	glVertex3f(cur[0] + radius, cur[1], cur[2]);
+	glVertex3f(vec[0] - radius, vec[1], vec[2]);
+	glVertex3f(cur[0] - radius, cur[1], cur[2]);
+	glVertex3f(vec[0], vec[1] + radius, vec[2]);
+	glVertex3f(cur[0], cur[1] + radius, cur[2]);
+	glVertex3f(vec[0], vec[1] - radius, vec[2]);
+	glVertex3f(cur[0], cur[1] - radius, cur[2]);
 	glEnd();
 }
 /* needs fixing if non-identity matrice used */
@@ -5638,51 +5793,51 @@ static void drawcone(const float vec[3], float radius, float height, float tmat[
 {
 	float cur[3];
 
-	copy_v3_v3(cur,vec);
-	cur[2]+=height;
+	copy_v3_v3(cur, vec);
+	cur[2] += height;
 
 	drawcircball(GL_LINE_LOOP, cur, radius, tmat);
 
 	glBegin(GL_LINES);
-		glVertex3f(vec[0],vec[1],vec[2]);
-		glVertex3f(cur[0]+radius,cur[1],cur[2]);
-		glVertex3f(vec[0],vec[1],vec[2]);
-		glVertex3f(cur[0]-radius,cur[1],cur[2]);
-		glVertex3f(vec[0],vec[1],vec[2]);
-		glVertex3f(cur[0],cur[1]+radius,cur[2]);
-		glVertex3f(vec[0],vec[1],vec[2]);
-		glVertex3f(cur[0],cur[1]-radius,cur[2]);
+	glVertex3f(vec[0], vec[1], vec[2]);
+	glVertex3f(cur[0] + radius, cur[1], cur[2]);
+	glVertex3f(vec[0], vec[1], vec[2]);
+	glVertex3f(cur[0] - radius, cur[1], cur[2]);
+	glVertex3f(vec[0], vec[1], vec[2]);
+	glVertex3f(cur[0], cur[1] + radius, cur[2]);
+	glVertex3f(vec[0], vec[1], vec[2]);
+	glVertex3f(cur[0], cur[1] - radius, cur[2]);
 	glEnd();
 }
 /* return 1 if nothing was drawn */
 static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, int dt)
 {
-	Object *ob= base->object;
+	Object *ob = base->object;
 	MetaBall *mb;
 	MetaElem *ml;
 	float imat[4][4];
-	int code= 1;
+	int code = 1;
 	
-	mb= ob->data;
+	mb = ob->data;
 
-	if(mb->editelems) {
+	if (mb->editelems) {
 		UI_ThemeColor(TH_WIRE);
-		if((G.f & G_PICKSEL)==0 ) drawDispList(scene, v3d, rv3d, base, dt);
-		ml= mb->editelems->first;
+		if ((G.f & G_PICKSEL) == 0) drawDispList(scene, v3d, rv3d, base, dt);
+		ml = mb->editelems->first;
 	}
 	else {
-		if((base->flag & OB_FROMDUPLI)==0) 
+		if ((base->flag & OB_FROMDUPLI) == 0)
 			drawDispList(scene, v3d, rv3d, base, dt);
-		ml= mb->elems.first;
+		ml = mb->elems.first;
 	}
 
-	if(ml==NULL) return 1;
+	if (ml == NULL) return 1;
 
-	if(v3d->flag2 & V3D_RENDER_OVERRIDE) return 0;
+	if (v3d->flag2 & V3D_RENDER_OVERRIDE) return 0;
 	
 	/* in case solid draw, reset wire colors */
-	if(ob->flag & SELECT) {
-		if(ob==OBACT) UI_ThemeColor(TH_ACTIVE);
+	if (ob->flag & SELECT) {
+		if (ob == OBACT) UI_ThemeColor(TH_ACTIVE);
 		else UI_ThemeColor(TH_SELECT);
 	}
 	else UI_ThemeColor(TH_WIRE);
@@ -5691,51 +5846,51 @@ static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
 	normalize_v3(imat[0]);
 	normalize_v3(imat[1]);
 	
-	while(ml) {
-	
+	while (ml) {
+
 		/* draw radius */
-		if(mb->editelems) {
-			if((ml->flag & SELECT) && (ml->flag & MB_SCALE_RAD)) cpack(0xA0A0F0);
+		if (mb->editelems) {
+			if ((ml->flag & SELECT) && (ml->flag & MB_SCALE_RAD)) cpack(0xA0A0F0);
 			else cpack(0x3030A0);
 			
-			if(G.f & G_PICKSEL) {
-				ml->selcol1= code;
+			if (G.f & G_PICKSEL) {
+				ml->selcol1 = code;
 				glLoadName(code++);
 			}
 		}
 		drawcircball(GL_LINE_LOOP, &(ml->x), ml->rad, imat);
 
 		/* draw stiffness */
-		if(mb->editelems) {
-			if((ml->flag & SELECT) && !(ml->flag & MB_SCALE_RAD)) cpack(0xA0F0A0);
+		if (mb->editelems) {
+			if ((ml->flag & SELECT) && !(ml->flag & MB_SCALE_RAD)) cpack(0xA0F0A0);
 			else cpack(0x30A030);
 			
-			if(G.f & G_PICKSEL) {
-				ml->selcol2= code;
+			if (G.f & G_PICKSEL) {
+				ml->selcol2 = code;
 				glLoadName(code++);
 			}
-			drawcircball(GL_LINE_LOOP, &(ml->x), ml->rad*atanf(ml->s)/(float)M_PI_2, imat);
+			drawcircball(GL_LINE_LOOP, &(ml->x), ml->rad * atanf(ml->s) / (float)M_PI_2, imat);
 		}
 		
-		ml= ml->next;
+		ml = ml->next;
 	}
 	return 0;
 }
 
 static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
 {
-	PartDeflect *pd= ob->pd;
+	PartDeflect *pd = ob->pd;
 	float imat[4][4], tmat[4][4];
-	float vec[3]= {0.0, 0.0, 0.0};
+	float vec[3] = {0.0, 0.0, 0.0};
 	int curcol;
 	float size;
 
 	/* XXX why? */
-	if(ob!=scene->obedit && (ob->flag & SELECT)) {
-		if(ob==OBACT) curcol= TH_ACTIVE;
-		else curcol= TH_SELECT;
+	if (ob != scene->obedit && (ob->flag & SELECT)) {
+		if (ob == OBACT) curcol = TH_ACTIVE;
+		else curcol = TH_SELECT;
 	}
-	else curcol= TH_WIRE;
+	else curcol = TH_EMPTY;
 	
 	/* scale size of circle etc with the empty drawsize */
 	if (ob->type == OB_EMPTY) size = ob->empty_drawsize;
@@ -5754,15 +5909,17 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
 		
 		//if (has_ipo_code(ob->ipo, OB_PD_FSTR))
 		//	force_val = IPO_GetFloatValue(ob->ipo, OB_PD_FSTR, scene->r.cfra);
-		//else 
+		//else
+		{
 			force_val = pd->f_strength;
+		}
 		force_val *= 0.1f;
 		drawcircball(GL_LINE_LOOP, vec, size, tmat);
-		vec[2]= 0.5f * force_val;
+		vec[2] = 0.5f * force_val;
 		drawcircball(GL_LINE_LOOP, vec, size, tmat);
-		vec[2]= 1.0f * force_val;
+		vec[2] = 1.0f * force_val;
 		drawcircball(GL_LINE_LOOP, vec, size, tmat);
-		vec[2]= 1.5f * force_val;
+		vec[2] = 1.5f * force_val;
 		drawcircball(GL_LINE_LOOP, vec, size, tmat);
 		vec[2] = 0.0f; /* reset vec for max dist circle */
 		
@@ -5770,31 +5927,35 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
 	else if (pd->forcefield == PFIELD_FORCE) {
 		float ffall_val;
 
-		//if (has_ipo_code(ob->ipo, OB_PD_FFALL)) 
+		//if (has_ipo_code(ob->ipo, OB_PD_FFALL))
 		//	ffall_val = IPO_GetFloatValue(ob->ipo, OB_PD_FFALL, scene->r.cfra);
-		//else 
+		//else
+		{
 			ffall_val = pd->f_power;
+		}
 
 		UI_ThemeColorBlend(curcol, TH_BACK, 0.5);
 		drawcircball(GL_LINE_LOOP, vec, size, imat);
 		UI_ThemeColorBlend(curcol, TH_BACK, 0.9f - 0.4f / powf(1.5f, ffall_val));
 		drawcircball(GL_LINE_LOOP, vec, size * 1.5f, imat);
 		UI_ThemeColorBlend(curcol, TH_BACK, 0.9f - 0.4f / powf(2.0f, ffall_val));
-		drawcircball(GL_LINE_LOOP, vec, size*2.0f, imat);
+		drawcircball(GL_LINE_LOOP, vec, size * 2.0f, imat);
 	}
 	else if (pd->forcefield == PFIELD_VORTEX) {
 		float /*ffall_val,*/ force_val;
 
 		unit_m4(tmat);
-		//if (has_ipo_code(ob->ipo, OB_PD_FFALL)) 
+		//if (has_ipo_code(ob->ipo, OB_PD_FFALL))
 		//	ffall_val = IPO_GetFloatValue(ob->ipo, OB_PD_FFALL, scene->r.cfra);
-		//else 
+		//else
 		//	ffall_val = pd->f_power;
 
 		//if (has_ipo_code(ob->ipo, OB_PD_FSTR))
 		//	force_val = IPO_GetFloatValue(ob->ipo, OB_PD_FSTR, scene->r.cfra);
-		//else 
+		//else
+		{
 			force_val = pd->f_strength;
+		}
 
 		UI_ThemeColorBlend(curcol, TH_BACK, 0.7f);
 		if (force_val < 0) {
@@ -5806,15 +5967,17 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
 			drawspiral(vec, size, tmat, -16);
 		}
 	}
-	else if (pd->forcefield == PFIELD_GUIDE && ob->type==OB_CURVE) {
-		Curve *cu= ob->data;
-		if((cu->flag & CU_PATH) && cu->path && cu->path->data) {
+	else if (pd->forcefield == PFIELD_GUIDE && ob->type == OB_CURVE) {
+		Curve *cu = ob->data;
+		if ((cu->flag & CU_PATH) && cu->path && cu->path->data) {
 			float mindist, guidevec1[4], guidevec2[3];
 
 			//if (has_ipo_code(ob->ipo, OB_PD_FSTR))
 			//	mindist = IPO_GetFloatValue(ob->ipo, OB_PD_FSTR, scene->r.cfra);
-			//else 
+			//else
+			{
 				mindist = pd->f_strength;
+			}
 
 			/*path end*/
 			setlinestyle(3);
@@ -5828,63 +5991,63 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
 			UI_ThemeColorBlend(curcol, TH_BACK, 0.5);
 			drawcircball(GL_LINE_LOOP, guidevec1, mindist, imat);
 			
-			copy_v3_v3(vec, guidevec1);	/* max center */
+			copy_v3_v3(vec, guidevec1); /* max center */
 		}
 	}
 
 	setlinestyle(3);
 	UI_ThemeColorBlend(curcol, TH_BACK, 0.5);
 
-	if(pd->falloff==PFIELD_FALL_SPHERE){
+	if (pd->falloff == PFIELD_FALL_SPHERE) {
 		/* as last, guide curve alters it */
-		if(pd->flag & PFIELD_USEMAX)
-			drawcircball(GL_LINE_LOOP, vec, pd->maxdist, imat);		
+		if (pd->flag & PFIELD_USEMAX)
+			drawcircball(GL_LINE_LOOP, vec, pd->maxdist, imat);
 
-		if(pd->flag & PFIELD_USEMIN)
+		if (pd->flag & PFIELD_USEMIN)
 			drawcircball(GL_LINE_LOOP, vec, pd->mindist, imat);
 	}
-	else if(pd->falloff==PFIELD_FALL_TUBE){
-		float radius,distance;
+	else if (pd->falloff == PFIELD_FALL_TUBE) {
+		float radius, distance;
 
 		unit_m4(tmat);
 
-		vec[0]=vec[1]=0.0f;
-		radius=(pd->flag&PFIELD_USEMAXR)?pd->maxrad:1.0f;
-		distance=(pd->flag&PFIELD_USEMAX)?pd->maxdist:0.0f;
-		vec[2]=distance;
-		distance=(pd->flag&PFIELD_POSZ)?-distance:-2.0f*distance;
+		vec[0] = vec[1] = 0.0f;
+		radius = (pd->flag & PFIELD_USEMAXR) ? pd->maxrad : 1.0f;
+		distance = (pd->flag & PFIELD_USEMAX) ? pd->maxdist : 0.0f;
+		vec[2] = distance;
+		distance = (pd->flag & PFIELD_POSZ) ? -distance : -2.0f * distance;
 
-		if(pd->flag & (PFIELD_USEMAX|PFIELD_USEMAXR))
-			drawtube(vec,radius,distance,tmat);
+		if (pd->flag & (PFIELD_USEMAX | PFIELD_USEMAXR))
+			drawtube(vec, radius, distance, tmat);
 
-		radius=(pd->flag&PFIELD_USEMINR)?pd->minrad:1.0f;
-		distance=(pd->flag&PFIELD_USEMIN)?pd->mindist:0.0f;
-		vec[2]=distance;
-		distance=(pd->flag&PFIELD_POSZ)?-distance:-2.0f*distance;
+		radius = (pd->flag & PFIELD_USEMINR) ? pd->minrad : 1.0f;
+		distance = (pd->flag & PFIELD_USEMIN) ? pd->mindist : 0.0f;
+		vec[2] = distance;
+		distance = (pd->flag & PFIELD_POSZ) ? -distance : -2.0f * distance;
 
-		if(pd->flag & (PFIELD_USEMIN|PFIELD_USEMINR))
-			drawtube(vec,radius,distance,tmat);
+		if (pd->flag & (PFIELD_USEMIN | PFIELD_USEMINR))
+			drawtube(vec, radius, distance, tmat);
 	}
-	else if(pd->falloff==PFIELD_FALL_CONE){
-		float radius,distance;
+	else if (pd->falloff == PFIELD_FALL_CONE) {
+		float radius, distance;
 
 		unit_m4(tmat);
 
-		radius= DEG2RADF((pd->flag&PFIELD_USEMAXR) ? pd->maxrad : 1.0f);
-		distance=(pd->flag&PFIELD_USEMAX)?pd->maxdist:0.0f;
+		radius = DEG2RADF((pd->flag & PFIELD_USEMAXR) ? pd->maxrad : 1.0f);
+		distance = (pd->flag & PFIELD_USEMAX) ? pd->maxdist : 0.0f;
 
-		if(pd->flag & (PFIELD_USEMAX|PFIELD_USEMAXR)){
-			drawcone(vec, distance * sinf(radius),distance * cosf(radius), tmat);
-			if((pd->flag & PFIELD_POSZ)==0)
-				drawcone(vec, distance * sinf(radius),-distance * cosf(radius),tmat);
+		if (pd->flag & (PFIELD_USEMAX | PFIELD_USEMAXR)) {
+			drawcone(vec, distance * sinf(radius), distance * cosf(radius), tmat);
+			if ((pd->flag & PFIELD_POSZ) == 0)
+				drawcone(vec, distance * sinf(radius), -distance * cosf(radius), tmat);
 		}
 
-		radius= DEG2RADF((pd->flag&PFIELD_USEMINR) ? pd->minrad : 1.0f);
-		distance=(pd->flag&PFIELD_USEMIN)?pd->mindist:0.0f;
+		radius = DEG2RADF((pd->flag & PFIELD_USEMINR) ? pd->minrad : 1.0f);
+		distance = (pd->flag & PFIELD_USEMIN) ? pd->mindist : 0.0f;
 
-		if(pd->flag & (PFIELD_USEMIN|PFIELD_USEMINR)){
-			drawcone(vec,distance*sinf(radius),distance*cosf(radius),tmat);
-			if((pd->flag & PFIELD_POSZ)==0)
+		if (pd->flag & (PFIELD_USEMIN | PFIELD_USEMINR)) {
+			drawcone(vec, distance * sinf(radius), distance * cosf(radius), tmat);
+			if ((pd->flag & PFIELD_POSZ) == 0)
 				drawcone(vec, distance * sinf(radius), -distance * cosf(radius), tmat);
 		}
 	}
@@ -5894,8 +6057,8 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d)
 static void draw_box(float vec[8][3])
 {
 	glBegin(GL_LINE_STRIP);
-	glVertex3fv(vec[0]); glVertex3fv(vec[1]);glVertex3fv(vec[2]); glVertex3fv(vec[3]);
-	glVertex3fv(vec[0]); glVertex3fv(vec[4]);glVertex3fv(vec[5]); glVertex3fv(vec[6]);
+	glVertex3fv(vec[0]); glVertex3fv(vec[1]); glVertex3fv(vec[2]); glVertex3fv(vec[3]);
+	glVertex3fv(vec[0]); glVertex3fv(vec[4]); glVertex3fv(vec[5]); glVertex3fv(vec[6]);
 	glVertex3fv(vec[7]); glVertex3fv(vec[4]);
 	glEnd();
 
@@ -5910,20 +6073,20 @@ static void draw_box(float vec[8][3])
 #if 0
 static void get_local_bounds(Object *ob, float center[3], float size[3])
 {
-	BoundBox *bb= object_get_boundbox(ob);
+	BoundBox *bb = object_get_boundbox(ob);
 	
-	if(bb==NULL) {
+	if (bb == NULL) {
 		zero_v3(center);
 		copy_v3_v3(size, ob->size);
 	}
 	else {
-		size[0]= 0.5*fabs(bb->vec[0][0] - bb->vec[4][0]);
-		size[1]= 0.5*fabs(bb->vec[0][1] - bb->vec[2][1]);
-		size[2]= 0.5*fabs(bb->vec[0][2] - bb->vec[1][2]);
-		
-		center[0]= (bb->vec[0][0] + bb->vec[4][0])/2.0;
-		center[1]= (bb->vec[0][1] + bb->vec[2][1])/2.0;
-		center[2]= (bb->vec[0][2] + bb->vec[1][2])/2.0;
+		size[0] = 0.5 * fabs(bb->vec[0][0] - bb->vec[4][0]);
+		size[1] = 0.5 * fabs(bb->vec[0][1] - bb->vec[2][1]);
+		size[2] = 0.5 * fabs(bb->vec[0][2] - bb->vec[1][2]);
+
+		center[0] = (bb->vec[0][0] + bb->vec[4][0]) / 2.0;
+		center[1] = (bb->vec[0][1] + bb->vec[2][1]) / 2.0;
+		center[2] = (bb->vec[0][2] + bb->vec[1][2]) / 2.0;
 	}
 }
 #endif
@@ -5931,68 +6094,71 @@ static void get_local_bounds(Object *ob, float center[3], float size[3])
 static void draw_bb_quadric(BoundBox *bb, char type)
 {
 	float size[3], cent[3];
-	GLUquadricObj *qobj = gluNewQuadric(); 
-	
-	gluQuadricDrawStyle(qobj, GLU_SILHOUETTE); 
+	GLUquadricObj *qobj = gluNewQuadric();
 	
-	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]);
+	gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
 	
-	cent[0]= 0.5f*(bb->vec[0][0] + bb->vec[4][0]);
-	cent[1]= 0.5f*(bb->vec[0][1] + bb->vec[2][1]);
-	cent[2]= 0.5f*(bb->vec[0][2] + bb->vec[1][2]);
+	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]);
+
+	cent[0] = 0.5f * (bb->vec[0][0] + bb->vec[4][0]);
+	cent[1] = 0.5f * (bb->vec[0][1] + bb->vec[2][1]);
+	cent[2] = 0.5f * (bb->vec[0][2] + bb->vec[1][2]);
 	
 	glPushMatrix();
-	if(type==OB_BOUND_SPHERE) {
+	if (type == OB_BOUND_SPHERE) {
 		glTranslatef(cent[0], cent[1], cent[2]);
 		glScalef(size[0], size[1], size[2]);
 		gluSphere(qobj, 1.0, 8, 5);
-	}	
-	else if(type==OB_BOUND_CYLINDER) {
+	}
+	else if (type == OB_BOUND_CYLINDER) {
 		float radius = size[0] > size[1] ? size[0] : size[1];
-		glTranslatef(cent[0], cent[1], cent[2]-size[2]);
+		glTranslatef(cent[0], cent[1], cent[2] - size[2]);
 		glScalef(radius, radius, 2.0f * size[2]);
 		gluCylinder(qobj, 1.0, 1.0, 1.0, 8, 1);
 	}
-	else if(type==OB_BOUND_CONE) {
+	else if (type == OB_BOUND_CONE) {
 		float radius = size[0] > size[1] ? size[0] : size[1];
-		glTranslatef(cent[0], cent[1], cent[2]-size[2]);
+		glTranslatef(cent[0], cent[1], cent[2] - size[2]);
 		glScalef(radius, radius, 2.0f * size[2]);
 		gluCylinder(qobj, 1.0, 0.0, 1.0, 8, 1);
 	}
 	glPopMatrix();
 	
-	gluDeleteQuadric(qobj); 
+	gluDeleteQuadric(qobj);
 }
 
 static void draw_bounding_volume(Scene *scene, Object *ob, char type)
 {
-	BoundBox *bb= NULL;
+	BoundBox *bb = NULL;
 	
-	if(ob->type==OB_MESH) {
-		bb= mesh_get_bb(ob);
+	if (ob->type == OB_MESH) {
+		bb = mesh_get_bb(ob);
 	}
-	else if ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT) {
-		bb= ob->bb ? ob->bb : ( (Curve *)ob->data )->bb;
+	else if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
+		bb = ob->bb ? ob->bb : ( (Curve *)ob->data)->bb;
 	}
-	else if(ob->type==OB_MBALL) {
-		if(is_basis_mball(ob)) {
-			bb= ob->bb;
-			if(bb==NULL) {
+	else if (ob->type == OB_MBALL) {
+		if (is_basis_mball(ob)) {
+			bb = ob->bb;
+			if (bb == NULL) {
 				makeDispListMBall(scene, ob);
-				bb= ob->bb;
+				bb = ob->bb;
 			}
 		}
 	}
+	else if (ob->type == OB_ARMATURE) {
+		bb = BKE_armature_get_bb(ob);
+	}
 	else {
 		drawcube();
 		return;
 	}
 	
-	if(bb==NULL) return;
+	if (bb == NULL) return;
 	
-	if(type==OB_BOUND_BOX) draw_box(bb->vec);
+	if (type == OB_BOUND_BOX) draw_box(bb->vec);
 	else draw_bb_quadric(bb, type);
 	
 }
@@ -6001,29 +6167,29 @@ static void drawtexspace(Object *ob)
 {
 	float vec[8][3], loc[3], size[3];
 	
-	if(ob->type==OB_MESH) {
+	if (ob->type == OB_MESH) {
 		mesh_get_texspace(ob->data, loc, NULL, size);
 	}
-	else if ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT) {
-		Curve *cu= ob->data;
+	else if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
+		Curve *cu = ob->data;
 		copy_v3_v3(size, cu->size);
 		copy_v3_v3(loc, cu->loc);
 	}
-	else if(ob->type==OB_MBALL) {
-		MetaBall *mb= ob->data;
+	else if (ob->type == OB_MBALL) {
+		MetaBall *mb = ob->data;
 		copy_v3_v3(size, mb->size);
 		copy_v3_v3(loc, mb->loc);
 	}
 	else return;
 	
-	vec[0][0]=vec[1][0]=vec[2][0]=vec[3][0]= loc[0]-size[0];
-	vec[4][0]=vec[5][0]=vec[6][0]=vec[7][0]= loc[0]+size[0];
+	vec[0][0] = vec[1][0] = vec[2][0] = vec[3][0] = loc[0] - size[0];
+	vec[4][0] = vec[5][0] = vec[6][0] = vec[7][0] = loc[0] + size[0];
 	
-	vec[0][1]=vec[1][1]=vec[4][1]=vec[5][1]= loc[1]-size[1];
-	vec[2][1]=vec[3][1]=vec[6][1]=vec[7][1]= loc[1]+size[1];
+	vec[0][1] = vec[1][1] = vec[4][1] = vec[5][1] = loc[1] - size[1];
+	vec[2][1] = vec[3][1] = vec[6][1] = vec[7][1] = loc[1] + size[1];
 
-	vec[0][2]=vec[3][2]=vec[4][2]=vec[7][2]= loc[2]-size[2];
-	vec[1][2]=vec[2][2]=vec[5][2]=vec[6][2]= loc[2]+size[2];
+	vec[0][2] = vec[3][2] = vec[4][2] = vec[7][2] = loc[2] - size[2];
+	vec[1][2] = vec[2][2] = vec[5][2] = vec[6][2] = loc[2] + size[2];
 	
 	setlinestyle(2);
 
@@ -6035,40 +6201,43 @@ static void drawtexspace(Object *ob)
 /* draws wire outline */
 static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
 {
-	RegionView3D *rv3d= ar->regiondata;
-	Object *ob= base->object;
+	RegionView3D *rv3d = ar->regiondata;
+	Object *ob = base->object;
 	
 	glLineWidth(2.0);
 	glDepthMask(0);
 	
-	if(ELEM3(ob->type, OB_FONT,OB_CURVE, OB_SURF)) {
+	if (ELEM3(ob->type, OB_FONT, OB_CURVE, OB_SURF)) {
 		Curve *cu = ob->data;
 		DerivedMesh *dm = ob->derivedFinal;
-		int hasfaces= 0;
+		int hasfaces = 0;
 
 		if (dm) {
-			hasfaces= dm->getNumFaces(dm);
-		} else {
-			hasfaces= displist_has_faces(&ob->disp);
+			hasfaces = dm->getNumTessFaces(dm);
+		}
+		else {
+			hasfaces = displist_has_faces(&ob->disp);
 		}
 
 		if (hasfaces && ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
-			draw_index_wire= 0;
+			draw_index_wire = 0;
 			if (dm) {
 				draw_mesh_object_outline(v3d, ob, dm);
-			} else {
+			}
+			else {
 				drawDispListwire(&ob->disp);
 			}
-			draw_index_wire= 1;
+			draw_index_wire = 1;
 		}
-	} else if (ob->type==OB_MBALL) {
-		if(is_basis_mball(ob)) {
-			if((base->flag & OB_FROMDUPLI)==0)
+	}
+	else if (ob->type == OB_MBALL) {
+		if (is_basis_mball(ob)) {
+			if ((base->flag & OB_FROMDUPLI) == 0)
 				drawDispListwire(&ob->disp);
 		}
 	}
-	else if(ob->type==OB_ARMATURE) {
-		if(!(ob->mode & OB_MODE_POSE && base == scene->basact))
+	else if (ob->type == OB_ARMATURE) {
+		if (!(ob->mode & OB_MODE_POSE && base == scene->basact))
 			draw_armature(scene, v3d, ar, base, OB_WIRE, FALSE, TRUE);
 	}
 
@@ -6078,48 +6247,51 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base)
 
 static void drawWireExtra(Scene *scene, RegionView3D *rv3d, Object *ob) 
 {
-	if(ob!=scene->obedit && (ob->flag & SELECT)) {
-		if(ob==OBACT) {
-			if(ob->flag & OB_FROMGROUP) UI_ThemeColor(TH_GROUP_ACTIVE);
+	if (ob != scene->obedit && (ob->flag & SELECT)) {
+		if (ob == OBACT) {
+			if (ob->flag & OB_FROMGROUP) UI_ThemeColor(TH_GROUP_ACTIVE);
 			else UI_ThemeColor(TH_ACTIVE);
 		}
-		else if(ob->flag & OB_FROMGROUP)
+		else if (ob->flag & OB_FROMGROUP)
 			UI_ThemeColorShade(TH_GROUP_ACTIVE, -16);
 		else
 			UI_ThemeColor(TH_SELECT);
 	}
 	else {
-		if(ob->flag & OB_FROMGROUP)
+		if (ob->flag & OB_FROMGROUP)
 			UI_ThemeColor(TH_GROUP);
 		else {
-			if(ob->dtx & OB_DRAWWIRE) {
-				glColor3ub(80,80,80);
-			} else {
+			if (ob->dtx & OB_DRAWWIRE) {
+				glColor3ub(80, 80, 80);
+			}
+			else {
 				UI_ThemeColor(TH_WIRE);
 			}
 		}
 	}
 	
 	bglPolygonOffset(rv3d->dist, 1.0);
-	glDepthMask(0);	// disable write in zbuffer, selected edge wires show better
+	glDepthMask(0); // disable write in zbuffer, selected edge wires show better
 	
 	if (ELEM3(ob->type, OB_FONT, OB_CURVE, OB_SURF)) {
 		Curve *cu = ob->data;
 		if (ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
-			if (ob->type==OB_CURVE)
-				draw_index_wire= 0;
+			if (ob->type == OB_CURVE)
+				draw_index_wire = 0;
 
 			if (ob->derivedFinal) {
 				drawCurveDMWired(ob);
-			} else {
+			}
+			else {
 				drawDispListwire(&ob->disp);
 			}
 
-			if (ob->type==OB_CURVE)
-				draw_index_wire= 1;
+			if (ob->type == OB_CURVE)
+				draw_index_wire = 1;
 		}
-	} else if (ob->type==OB_MBALL) {
-		if(is_basis_mball(ob)) {
+	}
+	else if (ob->type == OB_MBALL) {
+		if (is_basis_mball(ob)) {
 			drawDispListwire(&ob->disp);
 		}
 	}
@@ -6134,13 +6306,13 @@ static void draw_hooks(Object *ob)
 	ModifierData *md;
 	float vec[3];
 	
-	for (md=ob->modifiers.first; md; md=md->next) {
-		if (md->type==eModifierType_Hook) {
-			HookModifierData *hmd = (HookModifierData*) md;
+	for (md = ob->modifiers.first; md; md = md->next) {
+		if (md->type == eModifierType_Hook) {
+			HookModifierData *hmd = (HookModifierData *) md;
 
 			mul_v3_m4v3(vec, ob->obmat, hmd->cent);
 
-			if(hmd->object) {
+			if (hmd->object) {
 				setlinestyle(3);
 				glBegin(GL_LINES);
 				glVertex3fv(hmd->object->obmat[3]);
@@ -6160,79 +6332,80 @@ static void draw_hooks(Object *ob)
 
 static void drawRBpivot(bRigidBodyJointConstraint *data)
 {
+	const char *axis_str[3] = {"px", "py", "pz"};
 	int axis;
 	float mat[4][4];
 
 	/* color */
 	float curcol[4];
 	unsigned char tcol[4];
+
 	glGetFloatv(GL_CURRENT_COLOR, curcol);
 	rgb_float_to_uchar(tcol, curcol);
-	tcol[3]= 255;
+	tcol[3] = 255;
 
-	eul_to_mat4(mat,&data->axX);
-	glLineWidth (4.0f);
+	eul_to_mat4(mat, &data->axX);
+	glLineWidth(4.0f);
 	setlinestyle(2);
-	for (axis=0; axis<3; axis++) {
-		float dir[3] = {0,0,0};
+	for (axis = 0; axis < 3; axis++) {
+		float dir[3] = {0, 0, 0};
 		float v[3];
 
 		copy_v3_v3(v, &data->pivX);
 
 		dir[axis] = 1.f;
 		glBegin(GL_LINES);
-		mul_m4_v3(mat,dir);
+		mul_m4_v3(mat, dir);
 		add_v3_v3(v, dir);
 		glVertex3fv(&data->pivX);
-		glVertex3fv(v);			
+		glVertex3fv(v);
 		glEnd();
-		if (axis==0)
-			view3d_cached_text_draw_add(v, "px", 0, V3D_CACHE_TEXT_ASCII, tcol);
-		else if (axis==1)
-			view3d_cached_text_draw_add(v, "py", 0, V3D_CACHE_TEXT_ASCII, tcol);
-		else
-			view3d_cached_text_draw_add(v, "pz", 0, V3D_CACHE_TEXT_ASCII, tcol);
+
+		view3d_cached_text_draw_add(v, axis_str[axis], 0, V3D_CACHE_TEXT_ASCII, tcol);
 	}
-	glLineWidth (1.0f);
+	glLineWidth(1.0f);
 	setlinestyle(0);
 }
 
 /* flag can be DRAW_PICKING	and/or DRAW_CONSTCOLOR, DRAW_SCENESET */
 void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
 {
-	static int warning_recursive= 0;
+	static int warning_recursive = 0;
 	ModifierData *md = NULL;
-	Object *ob= base->object;
+	Object *ob = base->object;
 	Curve *cu;
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 	float vec1[3], vec2[3];
-	unsigned int col=0;
-	int /*sel, drawtype,*/ colindex= 0;
-	int i, selstart, selend, empty_object=0;
-	short dt, dtx, zbufoff= 0;
-	const short is_obact= (ob == OBACT);
+	unsigned int col = 0;
+	int /*sel, drawtype,*/ colindex = 0;
+	int i, selstart, selend, empty_object = 0;
+	short dt, dtx, zbufoff = 0;
+	const short is_obact = (ob == OBACT);
 
 	/* only once set now, will be removed too, should become a global standard */
 	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 
-	if (ob!=scene->obedit) {
-		if (ob->restrictflag & OB_RESTRICT_VIEW) 
+	if (ob != scene->obedit) {
+		if (ob->restrictflag & OB_RESTRICT_VIEW) {
 			return;
-		if ((ob->restrictflag & OB_RESTRICT_RENDER) && 
-			(v3d->flag2 & V3D_RENDER_OVERRIDE))
+		}
+		else if ((ob->restrictflag & OB_RESTRICT_RENDER) &&
+		         (v3d->flag2 & V3D_RENDER_OVERRIDE))
+		{
 			return;
+		}
 	}
 
 	/* XXX particles are not safe for simultaneous threaded render */
-	if(G.rendering && ob->particlesystem.first)
+	if (G.rendering && ob->particlesystem.first)
 		return;
 
 	/* xray delay? */
-	if((flag & DRAW_PICKING)==0 && (base->flag & OB_FROMDUPLI)==0) {
+	if ((flag & DRAW_PICKING) == 0 && (base->flag & OB_FROMDUPLI) == 0) {
 		/* don't do xray in particle mode, need the z-buffer */
-		if(!(ob->mode & OB_MODE_PARTICLE_EDIT)) {
+		if (!(ob->mode & OB_MODE_PARTICLE_EDIT)) {
 			/* xray and transp are set when it is drawing the 2nd/3rd pass */
-			if(!v3d->xray && !v3d->transp && (ob->dtx & OB_DRAWXRAY) && !(ob->dtx & OB_DRAWTRANSP)) {
+			if (!v3d->xray && !v3d->transp && (ob->dtx & OB_DRAWXRAY) && !(ob->dtx & OB_DRAWTRANSP)) {
 				add_view3d_after(&v3d->afterdraw_xray, base, flag);
 				return;
 			}
@@ -6243,11 +6416,11 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
 	view3d_cached_text_draw_begin();
 	
 	/* patch? children objects with a timeoffs change the parents. How to solve! */
-	/* if( ((int)ob->ctime) != F_(scene->r.cfra)) where_is_object(scene, ob); */
+	/* if ( ((int)ob->ctime) != F_(scene->r.cfra)) where_is_object(scene, ob); */
 	
 	/* draw motion paths (in view space) */
-	if (ob->mpath && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
-		bAnimVizSettings *avs= &ob->avs;
+	if (ob->mpath && (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
+		bAnimVizSettings *avs = &ob->avs;
 		
 		/* setup drawing environment for paths */
 		draw_motion_paths_init(v3d, ar);
@@ -6264,30 +6437,30 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
 	ED_view3d_init_mats_rv3d_gl(ob, rv3d);
 
 	/* which wire color */
-	if((flag & DRAW_CONSTCOLOR) == 0) {
+	if ((flag & DRAW_CONSTCOLOR) == 0) {
 		/* confusing logic here, there are 2 methods of setting the color
 		 * 'colortab[colindex]' and 'theme_id', colindex overrides theme_id.
 		 *
 		 * note: no theme yet for 'colindex' */
-		int theme_id= TH_WIRE;
-		int theme_shade= 0;
+		int theme_id = TH_WIRE;
+		int theme_shade = 0;
 
 		project_short(ar, ob->obmat[3], &base->sx);
 
-		if(		(scene->obedit == NULL) &&
-		        (G.moving & G_TRANSFORM_OBJ) &&
-		        (base->flag & (SELECT+BA_WAS_SEL)))
+		if ((scene->obedit == NULL) &&
+		    (G.moving & G_TRANSFORM_OBJ) &&
+		    (base->flag & (SELECT + BA_WAS_SEL)))
 		{
-			theme_id= TH_TRANSFORM;
+			theme_id = TH_TRANSFORM;
 		}
 		else {
 			/* Sets the 'colindex' */
-			if(ob->id.lib) {
-				colindex= (base->flag & (SELECT+BA_WAS_SEL)) ? 4 : 3;
+			if (ob->id.lib) {
+				colindex = (base->flag & (SELECT + BA_WAS_SEL)) ? 4 : 3;
 			}
-			else if(warning_recursive==1) {
-				if(base->flag & (SELECT+BA_WAS_SEL)) {
-					colindex= (scene->basact==base) ? 8 : 7;
+			else if (warning_recursive == 1) {
+				if (base->flag & (SELECT + BA_WAS_SEL)) {
+					colindex = (scene->basact == base) ? 8 : 7;
 				}
 				else {
 					colindex = 6;
@@ -6295,26 +6468,28 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
 			}
 			/* Sets the 'theme_id' or fallback to wire */
 			else {
-				if(ob->flag & OB_FROMGROUP) {
-					if(base->flag & (SELECT+BA_WAS_SEL)) {
+				if (ob->flag & OB_FROMGROUP) {
+					if (base->flag & (SELECT + BA_WAS_SEL)) {
 						/* uses darker active color for non-active + selected*/
-						theme_id= TH_GROUP_ACTIVE;
+						theme_id = TH_GROUP_ACTIVE;
 						
-						if(scene->basact != base) {
-							theme_shade= -16;
+						if (scene->basact != base) {
+							theme_shade = -16;
 						}
 					}
 					else {
-						theme_id= TH_GROUP;
+						theme_id = TH_GROUP;
 					}
 				}
 				else {
-					if(base->flag & (SELECT+BA_WAS_SEL)) {
-						theme_id= scene->basact == base ? TH_ACTIVE : TH_SELECT;
+					if (base->flag & (SELECT + BA_WAS_SEL)) {
+						theme_id = scene->basact == base ? TH_ACTIVE : TH_SELECT;
 					}
 					else {
-						if(ob->type==OB_LAMP) theme_id= TH_LAMP;
-						else if(ob->type==OB_SPEAKER) theme_id= TH_SPEAKER;
+						if (ob->type == OB_LAMP) theme_id = TH_LAMP;
+						else if (ob->type == OB_SPEAKER) theme_id = TH_SPEAKER;
+						else if (ob->type == OB_CAMERA) theme_id = TH_CAMERA;
+						else if (ob->type == OB_EMPTY) theme_id = TH_EMPTY;
 						/* fallback to TH_WIRE */
 					}
 				}
@@ -6322,85 +6497,86 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
 		}
 
 		/* finally set the color */
-		if(colindex == 0) {
-			if(theme_shade == 0) UI_ThemeColor(theme_id);
-			else                 UI_ThemeColorShade(theme_id, theme_shade);
+		if (colindex == 0) {
+			if (theme_shade == 0) UI_ThemeColor(theme_id);
+			else UI_ThemeColorShade(theme_id, theme_shade);
 		}
 		else {
-			col= colortab[colindex];
+			col = colortab[colindex];
 			cpack(col);
 		}
 	}
 
 	/* maximum drawtype */
-	dt= v3d->drawtype;
-	if(dt==OB_RENDER) dt= OB_SOLID;
-	dt= MIN2(dt, ob->dt);
-	if(v3d->zbuf==0 && dt>OB_WIRE) dt= OB_WIRE;
-	dtx= 0;
+	dt = v3d->drawtype;
+	if (dt == OB_RENDER) dt = OB_SOLID;
+	dt = MIN2(dt, ob->dt);
+	if (v3d->zbuf == 0 && dt > OB_WIRE) dt = OB_WIRE;
+	dtx = 0;
 
 	/* faceselect exception: also draw solid when dt==wire, except in editmode */
-	if (is_obact && (ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT))) {
-		if(ob->type==OB_MESH) {
+	if (is_obact && (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT))) {
+		if (ob->type == OB_MESH) {
 
-			if(ob->mode & OB_MODE_EDIT);
+			if (ob->mode & OB_MODE_EDIT) {
+				/* pass */
+			}
 			else {
-				if(dt<OB_SOLID) {
-					zbufoff= 1;
-					dt= OB_SOLID;
-				}
-				else {
-					dt= OB_PAINT;
+				if (dt < OB_SOLID) {
+					zbufoff = 1;
+					dt = OB_SOLID;
 				}
+				else if (ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT))
+					dt = OB_PAINT;
 
 				glEnable(GL_DEPTH_TEST);
 			}
 		}
 		else {
-			if(dt<OB_SOLID) {
-				dt= OB_SOLID;
+			if (dt < OB_SOLID) {
+				dt = OB_SOLID;
 				glEnable(GL_DEPTH_TEST);
-				zbufoff= 1;
+				zbufoff = 1;
 			}
 		}
 	}
 	
 	/* draw-extra supported for boundbox drawmode too */
-	if(dt>=OB_BOUNDBOX ) {
+	if (dt >= OB_BOUNDBOX) {
 
-		dtx= ob->dtx;
-		if(ob->mode & OB_MODE_EDIT) {
+		dtx = ob->dtx;
+		if (ob->mode & OB_MODE_EDIT) {
 			// the only 2 extra drawtypes alowed in editmode
-			dtx= dtx & (OB_DRAWWIRE|OB_TEXSPACE);
+			dtx = dtx & (OB_DRAWWIRE | OB_TEXSPACE);
 		}
 
 	}
 
 	/* bad exception, solve this! otherwise outline shows too late */
-	if(ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
+	if (ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
 		/* still needed for curves hidden in other layers. depgraph doesnt handle that yet */
-		if (ob->disp.first==NULL) makeDispListCurveTypes(scene, ob, 0);
+		if (ob->disp.first == NULL) makeDispListCurveTypes(scene, ob, 0);
 	}
 	
 	/* draw outline for selected objects, mesh does itself */
-	if((v3d->flag & V3D_SELECT_OUTLINE) && ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) && ob->type!=OB_MESH) {
-		if(dt>OB_WIRE && (ob->mode & OB_MODE_EDIT)==0 && (flag & DRAW_SCENESET)==0) {
-			if (!(ob->dtx&OB_DRAWWIRE) && (ob->flag&SELECT) && !(flag&DRAW_PICKING)) {
+	if ((v3d->flag & V3D_SELECT_OUTLINE) && ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) && ob->type != OB_MESH) {
+		if (dt > OB_WIRE && (ob->mode & OB_MODE_EDIT) == 0 && (flag & DRAW_SCENESET) == 0) {
+			if (!(ob->dtx & OB_DRAWWIRE) && (ob->flag & SELECT) && !(flag & DRAW_PICKING)) {
 				
 				drawObjectSelect(scene, v3d, ar, base);
 			}
 		}
 	}
 
-	switch( ob->type) {
+	switch (ob->type) {
 		case OB_MESH:
-			empty_object= draw_mesh_object(scene, ar, v3d, rv3d, base, dt, flag);
-			if(flag!=DRAW_CONSTCOLOR) dtx &= ~OB_DRAWWIRE; // mesh draws wire itself
+			empty_object = draw_mesh_object(scene, ar, v3d, rv3d, base, dt, flag);
+			if (flag != DRAW_CONSTCOLOR) dtx &= ~OB_DRAWWIRE;  // mesh draws wire itself
 
 			break;
 		case OB_FONT:
-			cu= ob->data;
-			if(cu->editfont) {
+			cu = ob->data;
+			if (cu->editfont) {
 				draw_textcurs(cu->editfont->textcurs);
 
 				if (cu->flag & CU_FAST) {
@@ -6408,7 +6584,8 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
 					set_inverted_drawing(1);
 					drawDispList(scene, v3d, rv3d, base, OB_WIRE);
 					set_inverted_drawing(0);
-				} else {
+				}
+				else {
 					drawDispList(scene, v3d, rv3d, base, dt);
 				}
 
@@ -6421,17 +6598,17 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
 					vec1[1] += cu->linedist * cu->fsize;
 					vec2[1] -= cu->lines * cu->linedist * cu->fsize;
 					setlinestyle(3);
-					glBegin(GL_LINE_STRIP); 
-					glVertex2fv(vec1); 
-					glVertex2fv(vec2); 
+					glBegin(GL_LINE_STRIP);
+					glVertex2fv(vec1);
+					glVertex2fv(vec2);
 					glEnd();
 					setlinestyle(0);
 				}
 
 				setlinestyle(3);
-				for (i=0; i<cu->totbox; i++) {
+				for (i = 0; i < cu->totbox; i++) {
 					if (cu->tb[i].w != 0.0f) {
-						UI_ThemeColor(i == (cu->actbox-1) ? TH_ACTIVE : TH_WIRE);
+						UI_ThemeColor(i == (cu->actbox - 1) ? TH_ACTIVE : TH_WIRE);
 						vec1[0] = (cu->xof * cu->fsize) + cu->tb[i].x;
 						vec1[1] = (cu->yof * cu->fsize) + cu->tb[i].y + cu->fsize;
 						vec1[2] = 0.001;
@@ -6456,71 +6633,75 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
 
 					cpack(0xffffff);
 					set_inverted_drawing(1);
-					for (i=0; i<(selend-selstart+1); i++) {
+					for (i = 0; i < (selend - selstart + 1); i++) {
 						SelBox *sb = &(cu->selboxes[i]);
 
-						if (i<(selend-selstart)) {
-							if (cu->selboxes[i+1].y == sb->y)
-								selboxw= cu->selboxes[i+1].x - sb->x;
+						if (i < (selend - selstart)) {
+							if (cu->selboxes[i + 1].y == sb->y)
+								selboxw = cu->selboxes[i + 1].x - sb->x;
 							else
-								selboxw= sb->w;
+								selboxw = sb->w;
 						}
 						else {
-							selboxw= sb->w;
+							selboxw = sb->w;
 						}
 						glBegin(GL_QUADS);
 						glVertex3f(sb->x, sb->y, 0.001);
-						glVertex3f(sb->x+selboxw, sb->y, 0.001);
-						glVertex3f(sb->x+selboxw, sb->y+sb->h, 0.001);
-						glVertex3f(sb->x, sb->y+sb->h, 0.001);
+						glVertex3f(sb->x + selboxw, sb->y, 0.001);
+						glVertex3f(sb->x + selboxw, sb->y + sb->h, 0.001);
+						glVertex3f(sb->x, sb->y + sb->h, 0.001);
 						glEnd();
 					}
 					set_inverted_drawing(0);
 				}
 			}
-			else if(dt==OB_BOUNDBOX) {
-				if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
+			else if (dt == OB_BOUNDBOX) {
+				if (((v3d->flag2 & V3D_RENDER_OVERRIDE) && v3d->drawtype >= OB_WIRE) == 0) {
 					draw_bounding_volume(scene, ob, ob->boundtype);
+				}
+			}
+			else if (ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
+				empty_object = drawDispList(scene, v3d, rv3d, base, dt);
 			}
-			else if(ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb))
-				empty_object= drawDispList(scene, v3d, rv3d, base, dt);
 
 			break;
 		case OB_CURVE:
 		case OB_SURF:
-			cu= ob->data;
+			cu = ob->data;
 
-			if(cu->editnurb) {
-				ListBase *nurbs= curve_editnurbs(cu);
+			if (cu->editnurb) {
+				ListBase *nurbs = curve_editnurbs(cu);
 				drawnurb(scene, v3d, rv3d, base, nurbs->first, dt);
 			}
-			else if(dt==OB_BOUNDBOX) {
-				if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
+			else if (dt == OB_BOUNDBOX) {
+				if (((v3d->flag2 & V3D_RENDER_OVERRIDE) && (v3d->drawtype >= OB_WIRE)) == 0) {
 					draw_bounding_volume(scene, ob, ob->boundtype);
+				}
 			}
-			else if(ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
-				empty_object= drawDispList(scene, v3d, rv3d, base, dt);
+			else if (ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) {
+				empty_object = drawDispList(scene, v3d, rv3d, base, dt);
 
-//XXX old animsys				if(cu->path)
-//               					curve_draw_speed(scene, ob);
+//XXX old animsys				if (cu->path)
+//                                  curve_draw_speed(scene, ob);
 			}
 			break;
 		case OB_MBALL:
 		{
-			MetaBall *mb= ob->data;
+			MetaBall *mb = ob->data;
 			
-			if(mb->editelems) 
+			if (mb->editelems)
 				drawmball(scene, v3d, rv3d, base, dt);
-			else if(dt==OB_BOUNDBOX) {
-				if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0)
+			else if (dt == OB_BOUNDBOX) {
+				if (((v3d->flag2 & V3D_RENDER_OVERRIDE) && (v3d->drawtype >= OB_WIRE)) == 0) {
 					draw_bounding_volume(scene, ob, ob->boundtype);
+				}
 			}
-			else 
-				empty_object= drawmball(scene, v3d, rv3d, base, dt);
+			else
+				empty_object = drawmball(scene, v3d, rv3d, base, dt);
 			break;
 		}
 		case OB_EMPTY:
-			if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
+			if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
 				if (ob->empty_drawtype == OB_EMPTY_IMAGE) {
 					draw_empty_image(ob);
 				}
@@ -6530,84 +6711,95 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
 			}
 			break;
 		case OB_LAMP:
-			if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
+			if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
 				drawlamp(scene, v3d, rv3d, base, dt, flag);
-				if(dtx || (base->flag & SELECT)) glMultMatrixf(ob->obmat);
+				if (dtx || (base->flag & SELECT)) glMultMatrixf(ob->obmat);
 			}
 			break;
 		case OB_CAMERA:
-		if ( (v3d->flag2 & V3D_RENDER_OVERRIDE)==0 ||
-		     (rv3d->persp==RV3D_CAMOB && v3d->camera==ob)) /* special exception for active camera */
-		{
-			drawcamera(scene, v3d, rv3d, base, flag);
-			break;
-		}
+			if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0 ||
+			    (rv3d->persp == RV3D_CAMOB && v3d->camera == ob)) /* special exception for active camera */
+			{
+				drawcamera(scene, v3d, rv3d, base, flag);
+				break;
+			}
 		case OB_SPEAKER:
-			if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0)
+			if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0)
 				drawspeaker(scene, v3d, rv3d, ob, flag);
 			break;
 		case OB_LATTICE:
-			if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
+			if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
 				drawlattice(scene, v3d, ob);
 			}
 			break;
 		case OB_ARMATURE:
-			if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
-				if(dt>OB_WIRE) GPU_enable_material(0, NULL); // we use default material
-				empty_object= draw_armature(scene, v3d, ar, base, dt, flag, FALSE);
-				if(dt>OB_WIRE) GPU_disable_material();
+			if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
+				/* Do not allow boundbox in edit nor pose mode! */
+				if ((dt == OB_BOUNDBOX) && (ob->mode & (OB_MODE_EDIT | OB_MODE_POSE)))
+					dt = OB_WIRE;
+				if (dt == OB_BOUNDBOX) {
+					draw_bounding_volume(scene, ob, ob->boundtype);
+				}
+				else {
+					if (dt > OB_WIRE)
+						GPU_enable_material(0, NULL);  /* we use default material */
+					empty_object = draw_armature(scene, v3d, ar, base, dt, flag, FALSE);
+					if (dt > OB_WIRE)
+						GPU_disable_material();
+				}
 			}
 			break;
 		default:
-			if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
+			if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
 				drawaxes(1.0, OB_ARROWS);
 			}
 	}
 
-	if((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
+	if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
 
-		if(ob->soft /*&& flag & OB_SBMOTION*/){
-			float mrt[3][3],msc[3][3],mtr[3][3]; 
-			SoftBody *sb= NULL;
-			float tipw = 0.5f, tiph = 0.5f,drawsize = 4.0f;
-			if ((sb= ob->soft)){
-				if(sb->solverflags & SBSO_ESTIMATEIPO){
+		if (ob->soft /*&& flag & OB_SBMOTION*/) {
+			float mrt[3][3], msc[3][3], mtr[3][3];
+			SoftBody *sb = NULL;
+			float tipw = 0.5f, tiph = 0.5f, drawsize = 4.0f;
+			if ((sb = ob->soft)) {
+				if (sb->solverflags & SBSO_ESTIMATEIPO) {
 
 					glLoadMatrixf(rv3d->viewmat);
-					copy_m3_m3(msc,sb->lscale);
-					copy_m3_m3(mrt,sb->lrot);
-					mul_m3_m3m3(mtr,mrt,msc); 
-					ob_draw_RE_motion(sb->lcom,mtr,tipw,tiph,drawsize);
+					copy_m3_m3(msc, sb->lscale);
+					copy_m3_m3(mrt, sb->lrot);
+					mul_m3_m3m3(mtr, mrt, msc);
+					ob_draw_RE_motion(sb->lcom, mtr, tipw, tiph, drawsize);
 					glMultMatrixf(ob->obmat);
 				}
 			}
 		}
 
-		if(ob->pd && ob->pd->forcefield) {
+		if (ob->pd && ob->pd->forcefield) {
 			draw_forcefield(scene, ob, rv3d);
 		}
 	}
 
 	/* code for new particle system */
-	if(		(warning_recursive==0) &&
-			(ob->particlesystem.first) &&
-			(flag & DRAW_PICKING)==0 &&
-			(ob!=scene->obedit)	
-	  ) {
+	if ((warning_recursive == 0) &&
+	    (ob->particlesystem.first) &&
+	    (flag & DRAW_PICKING) == 0 &&
+	    (ob != scene->obedit)
+	    )
+	{
 		ParticleSystem *psys;
 
-		if(col || (ob->flag & SELECT)) cpack(0xFFFFFF);	/* for visibility, also while wpaint */
+		if (col || (ob->flag & SELECT)) cpack(0xFFFFFF);    /* for visibility, also while wpaint */
 		//glDepthMask(GL_FALSE);
 
 		glLoadMatrixf(rv3d->viewmat);
 		
 		view3d_cached_text_draw_begin();
 
-		for(psys=ob->particlesystem.first; psys; psys=psys->next) {
+		for (psys = ob->particlesystem.first; psys; psys = psys->next) {
 			/* run this so that possible child particles get cached */
 			if (ob->mode & OB_MODE_PARTICLE_EDIT && is_obact) {
 				PTCacheEdit *edit = PE_create_current(scene, ob);
-				if(edit && edit->psys == psys)
+				if (edit && edit->psys == psys)
 					draw_update_ptcache_edit(scene, ob, edit);
 			}
 
@@ -6619,18 +6811,18 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
 		glMultMatrixf(ob->obmat);
 		
 		//glDepthMask(GL_TRUE);
-		if(col) cpack(col);
+		if (col) cpack(col);
 	}
 
 	/* draw edit particles last so that they can draw over child particles */
-	if ( (warning_recursive==0) &&
-	     (flag & DRAW_PICKING)==0 &&
+	if ( (warning_recursive == 0) &&
+	     (flag & DRAW_PICKING) == 0 &&
 	     (!scene->obedit))
 	{
 
 		if (ob->mode & OB_MODE_PARTICLE_EDIT && is_obact) {
 			PTCacheEdit *edit = PE_create_current(scene, ob);
-			if(edit) {
+			if (edit) {
 				glLoadMatrixf(rv3d->viewmat);
 				draw_update_ptcache_edit(scene, ob, edit);
 				draw_ptcache_edit(scene, v3d, edit);
@@ -6640,20 +6832,19 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
 	}
 
 	/* draw code for smoke */
-	if((md = modifiers_findByType(ob, eModifierType_Smoke))) {
+	if ((md = modifiers_findByType(ob, eModifierType_Smoke))) {
 		SmokeModifierData *smd = (SmokeModifierData *)md;
 
 		// draw collision objects
-		if((smd->type & MOD_SMOKE_TYPE_COLL) && smd->coll)
-		{
-			/*SmokeCollSettings *scs = smd->coll;
-			if(scs->points)
-			{
+		if ((smd->type & MOD_SMOKE_TYPE_COLL) && smd->coll) {
+#if 0
+			SmokeCollSettings *scs = smd->coll;
+			if (scs->points) {
 				size_t i;
 
 				glLoadMatrixf(rv3d->viewmat);
 
-				if(col || (ob->flag & SELECT)) cpack(0xFFFFFF);	
+				if (col || (ob->flag & SELECT)) cpack(0xFFFFFF);
 				glDepthMask(GL_FALSE);
 				glEnable(GL_BLEND);
 				
@@ -6661,9 +6852,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
 				// glPointSize(3.0);
 				bglBegin(GL_POINTS);
 
-				for(i = 0; i < scs->numpoints; i++)
+				for (i = 0; i < scs->numpoints; i++)
 				{
-					bglVertex3fv(&scs->points[3*i]);
+					bglVertex3fv(&scs->points[3 * i]);
 				}
 
 				bglEnd();
@@ -6672,19 +6863,18 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
 				glMultMatrixf(ob->obmat);
 				glDisable(GL_BLEND);
 				glDepthMask(GL_TRUE);
-				if(col) cpack(col);
+				if (col) cpack(col);
 				
 			}
-			*/
+#endif
 		}
 
 		// 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 (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);
@@ -6699,9 +6889,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
 				float *density = smoke_get_density(smd->domain->fluid);
 
 				glLoadMatrixf(rv3d->viewmat);
-				// glMultMatrixf(ob->obmat);	
+				// glMultMatrixf(ob->obmat);
 
-				if(col || (ob->flag & SELECT)) cpack(0xFFFFFF);	
+				if (col || (ob->flag & SELECT)) cpack(0xFFFFFF);
 				glDepthMask(GL_FALSE);
 				glEnable(GL_BLEND);
 				
@@ -6709,23 +6899,23 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
 				// glPointSize(3.0);
 				bglBegin(GL_POINTS);
 
-				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);
+				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);
+							}
+						}
 					}
 				}
 
@@ -6735,11 +6925,10 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
 				glMultMatrixf(ob->obmat);
 				glDisable(GL_BLEND);
 				glDepthMask(GL_TRUE);
-				if(col) cpack(col);
+				if (col) cpack(col);
 #endif
 			}
-			else if(smd->domain->wt && (smd->domain->viewsettings & MOD_SMOKE_VIEW_SHOWBIG))
-			{
+			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,
@@ -6751,21 +6940,19 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
 		}
 	}
 
-	if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
-
+	if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
 		bConstraint *con;
-		for(con=ob->constraints.first; con; con= con->next) 
-		{
-			if(con->type==CONSTRAINT_TYPE_RIGIDBODYJOINT) 
-			{
-				bRigidBodyJointConstraint *data = (bRigidBodyJointConstraint*)con->data;
-				if(data->flag&CONSTRAINT_DRAW_PIVOT)
+
+		for (con = ob->constraints.first; con; con = con->next) {
+			if (con->type == CONSTRAINT_TYPE_RIGIDBODYJOINT) {
+				bRigidBodyJointConstraint *data = (bRigidBodyJointConstraint *)con->data;
+				if (data->flag & CONSTRAINT_DRAW_PIVOT)
 					drawRBpivot(data);
 			}
 		}
 
-		if(ob->gameflag & OB_BOUNDS) {
-			if(ob->boundtype!=ob->collision_boundtype || (dtx & OB_BOUNDBOX)==0) {
+		if (ob->gameflag & OB_BOUNDS) {
+			if (ob->boundtype != ob->collision_boundtype || (dtx & OB_BOUNDBOX) == 0) {
 				setlinestyle(2);
 				draw_bounding_volume(scene, ob, ob->collision_boundtype);
 				setlinestyle(0);
@@ -6773,37 +6960,42 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
 		}
 
 		/* draw extra: after normal draw because of makeDispList */
-		if(dtx && (G.f & G_RENDER_OGL)==0) {
+		if (dtx && (G.f & G_RENDER_OGL) == 0) {
 
-			if(dtx & OB_AXIS) {
+			if (dtx & OB_AXIS) {
 				drawaxes(1.0f, OB_ARROWS);
 			}
-			if(dtx & OB_BOUNDBOX) {
+			if (dtx & OB_BOUNDBOX) {
 				draw_bounding_volume(scene, ob, ob->boundtype);
 			}
-			if(dtx & OB_TEXSPACE) drawtexspace(ob);
-			if(dtx & OB_DRAWNAME) {
+			if (dtx & OB_TEXSPACE) {
+				drawtexspace(ob);
+			}
+			if (dtx & OB_DRAWNAME) {
 				/* patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing */
-				/* but, we also dont draw names for sets or duplicators */
-				if(flag == 0) {
-					float zero[3]= {0,0,0};
+				/* but, we also don't draw names for sets or duplicators */
+				if (flag == 0) {
+					float zero[3] = {0, 0, 0};
 					float curcol[4];
 					unsigned char tcol[4];
 					glGetFloatv(GL_CURRENT_COLOR, curcol);
 					rgb_float_to_uchar(tcol, curcol);
-					tcol[3]= 255;
-					view3d_cached_text_draw_add(zero, ob->id.name+2, 10, 0, tcol);
+					tcol[3] = 255;
+					view3d_cached_text_draw_add(zero, ob->id.name + 2, 10, 0, tcol);
 				}
 			}
-			/*if(dtx & OB_DRAWIMAGE) drawDispListwire(&ob->disp);*/
-			if((dtx & OB_DRAWWIRE) && dt>=OB_SOLID) drawWireExtra(scene, rv3d, ob);
+			/*if (dtx & OB_DRAWIMAGE) drawDispListwire(&ob->disp);*/
+			if ((dtx & OB_DRAWWIRE) && dt >= OB_SOLID) {
+				drawWireExtra(scene, rv3d, ob);
+			}
 		}
 	}
 
-	if(dt<=OB_SOLID && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
-		if((ob->gameflag & OB_DYNAMIC) || 
-			((ob->gameflag & OB_BOUNDS) && (ob->boundtype == OB_BOUND_SPHERE))) {
-			float imat[4][4], vec[3]= {0.0f, 0.0f, 0.0f};
+	if (dt <= OB_SOLID && (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
+		if ((ob->gameflag & OB_DYNAMIC) ||
+		    ((ob->gameflag & OB_BOUNDS) && (ob->boundtype == OB_BOUND_SPHERE)))
+		{
+			float imat[4][4], vec[3] = {0.0f, 0.0f, 0.0f};
 
 			invert_m4_m4(imat, rv3d->viewmatob);
 
@@ -6819,51 +7011,57 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
 
 	glLoadMatrixf(rv3d->viewmat);
 
-	if(zbufoff) glDisable(GL_DEPTH_TEST);
+	if (zbufoff) {
+		glDisable(GL_DEPTH_TEST);
+	}
 
-	if(warning_recursive) return;
-	if(base->flag & OB_FROMDUPLI) return;
-	if(v3d->flag2 & V3D_RENDER_OVERRIDE) return;
+	if ((warning_recursive) ||
+	    (base->flag & OB_FROMDUPLI) ||
+	    (v3d->flag2 & V3D_RENDER_OVERRIDE))
+	{
+		return;
+	}
 
 	/* object centers, need to be drawn in viewmat space for speed, but OK for picking select */
-	if (!is_obact || !(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT))) {
-		int do_draw_center= -1;	/* defines below are zero or positive... */
-
-		if(v3d->flag2 & V3D_RENDER_OVERRIDE) {
-			/* dont draw */
-		} else if((scene->basact)==base)
-			do_draw_center= ACTIVE;
-		else if(base->flag & SELECT) 
-			do_draw_center= SELECT;
-		else if(empty_object || (v3d->flag & V3D_DRAW_CENTERS)) 
-			do_draw_center= DESELECT;
-
-		if(do_draw_center != -1) {
-			if(flag & DRAW_PICKING) {
+	if (!is_obact || !(ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT))) {
+		int do_draw_center = -1; /* defines below are zero or positive... */
+
+		if (v3d->flag2 & V3D_RENDER_OVERRIDE) {
+			/* don't draw */
+		}
+		else if ((scene->basact) == base)
+			do_draw_center = ACTIVE;
+		else if (base->flag & SELECT)
+			do_draw_center = SELECT;
+		else if (empty_object || (v3d->flag & V3D_DRAW_CENTERS))
+			do_draw_center = DESELECT;
+
+		if (do_draw_center != -1) {
+			if (flag & DRAW_PICKING) {
 				/* draw a single point for opengl selection */
 				glBegin(GL_POINTS);
 				glVertex3fv(ob->obmat[3]);
 				glEnd();
-			} 
-			else if((flag & DRAW_CONSTCOLOR)==0) {
+			}
+			else if ((flag & DRAW_CONSTCOLOR) == 0) {
 				/* we don't draw centers for duplicators and sets */
-				if(U.obcenter_dia > 0) {
+				if (U.obcenter_dia > 0) {
 					/* check > 0 otherwise grease pencil can draw into the circle select which is annoying. */
-					drawcentercircle(v3d, rv3d, ob->obmat[3], do_draw_center, ob->id.lib || ob->id.us>1);
+					drawcentercircle(v3d, rv3d, ob->obmat[3], do_draw_center, ob->id.lib || ob->id.us > 1);
 				}
 			}
 		}
 	}
 
 	/* not for sets, duplicators or picking */
-	if(flag==0 && (v3d->flag & V3D_HIDE_HELPLINES)== 0 && (v3d->flag2 & V3D_RENDER_OVERRIDE)== 0) {
+	if (flag == 0 && (v3d->flag & V3D_HIDE_HELPLINES) == 0 && (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
 		ListBase *list;
 		
 		/* draw hook center and offset line */
-		if(ob!=scene->obedit) draw_hooks(ob);
+		if (ob != scene->obedit) draw_hooks(ob);
 		
 		/* help lines and so */
-		if(ob!=scene->obedit && ob->parent && (ob->parent->lay & v3d->lay)) {
+		if (ob != scene->obedit && ob->parent && (ob->parent->lay & v3d->lay)) {
 			setlinestyle(3);
 			glBegin(GL_LINES);
 			glVertex3fv(ob->obmat[3]);
@@ -6884,32 +7082,32 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
 			UI_make_axis_color(col1, col2, 'Z');
 			glColor3ubv(col2);
 			
-			cob= constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT);
+			cob = constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT);
 			
-			for (curcon = list->first; curcon; curcon=curcon->next) {
-				bConstraintTypeInfo *cti= constraint_get_typeinfo(curcon);
+			for (curcon = list->first; curcon; curcon = curcon->next) {
+				bConstraintTypeInfo *cti = constraint_get_typeinfo(curcon);
 				ListBase targets = {NULL, NULL};
 				bConstraintTarget *ct;
 				
-				if(ELEM(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_OBJECTSOLVER)) {
+				if (ELEM(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_OBJECTSOLVER)) {
 					/* special case for object solver and follow track constraints because they don't fill
-					   constraint targets properly (design limitation -- scene is needed for their target
-					   but it can't be accessed from get_targets callvack) */
+					 * constraint targets properly (design limitation -- scene is needed for their target
+					 * but it can't be accessed from get_targets callvack) */
 
-					Object *camob= NULL;
+					Object *camob = NULL;
 
-					if(cti->type==CONSTRAINT_TYPE_FOLLOWTRACK) {
-						bFollowTrackConstraint *data= (bFollowTrackConstraint *)curcon->data;
+					if (cti->type == CONSTRAINT_TYPE_FOLLOWTRACK) {
+						bFollowTrackConstraint *data = (bFollowTrackConstraint *)curcon->data;
 
-						camob= data->camera ? data->camera : scene->camera;
+						camob = data->camera ? data->camera : scene->camera;
 					}
-					else if(cti->type==CONSTRAINT_TYPE_OBJECTSOLVER) {
-						bObjectSolverConstraint *data= (bObjectSolverConstraint *)curcon->data;
+					else if (cti->type == CONSTRAINT_TYPE_OBJECTSOLVER) {
+						bObjectSolverConstraint *data = (bObjectSolverConstraint *)curcon->data;
 
-						camob= data->camera ? data->camera : scene->camera;
+						camob = data->camera ? data->camera : scene->camera;
 					}
 
-					if(camob) {
+					if (camob) {
 						setlinestyle(3);
 						glBegin(GL_LINES);
 						glVertex3fv(camob->obmat[3]);
@@ -6921,9 +7119,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
 				else if ((curcon->flag & CONSTRAINT_EXPAND) && (cti) && (cti->get_constraint_targets)) {
 					cti->get_constraint_targets(curcon, &targets);
 					
-					for (ct= targets.first; ct; ct= ct->next) {
+					for (ct = targets.first; ct; ct = ct->next) {
 						/* calculate target's matrix */
-						if (cti->get_target_matrix) 
+						if (cti->get_target_matrix)
 							cti->get_target_matrix(curcon, cob, ct, BKE_curframe(scene));
 						else
 							unit_m4(ct->matrix);
@@ -6950,14 +7148,15 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
 
 /* ***************** BACKBUF SEL (BBS) ********* */
 
-static void bbs_obmode_mesh_verts__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
+static void bbs_obmode_mesh_verts__mapFunc(void *userData, int index, const float co[3],
+                                           const float UNUSED(no_f[3]), const short UNUSED(no_s[3]))
 {
 	bbsObmodeMeshVerts_userData *data = userData;
 	MVert *mv = &data->mvert[index];
 	int offset = (intptr_t) data->offset;
 
 	if (!(mv->flag & ME_HIDE)) {
-		WM_set_framebuffer_index_color(offset+index);
+		WM_set_framebuffer_index_color(offset + index);
 		bglVertex3fv(co);
 	}
 }
@@ -6968,132 +7167,147 @@ static void bbs_obmode_mesh_verts(Object *ob, DerivedMesh *dm, int offset)
 	Mesh *me = ob->data;
 	MVert *mvert = me->mvert;
 	data.mvert = mvert;
-	data.offset = (void*)(intptr_t) offset;
-	glPointSize( UI_GetThemeValuef(TH_VERTEX_SIZE) );
+	data.offset = (void *)(intptr_t) offset;
+	glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE) );
 	bglBegin(GL_POINTS);
 	dm->foreachMappedVert(dm, bbs_obmode_mesh_verts__mapFunc, &data);
 	bglEnd();
 	glPointSize(1.0);
 }
 
-static void bbs_mesh_verts__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
+static void bbs_mesh_verts__mapFunc(void *userData, int index, const float co[3],
+                                    const float UNUSED(no_f[3]), const short UNUSED(no_s[3]))
 {
-	int offset = (intptr_t) userData;
-	EditVert *eve = EM_get_vert_for_index(index);
+	void **ptrs = userData;
+	int offset = (intptr_t) ptrs[0];
+	BMVert *eve = EDBM_vert_at_index(ptrs[1], index);
 
-	if (eve->h==0) {
-		WM_set_framebuffer_index_color(offset+index);
+	if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
+		WM_set_framebuffer_index_color(offset + index);
 		bglVertex3fv(co);
 	}
 }
-static void bbs_mesh_verts(DerivedMesh *dm, int offset)
+static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *dm, int offset)
 {
-	glPointSize( UI_GetThemeValuef(TH_VERTEX_SIZE) );
+	void *ptrs[2] = {(void *)(intptr_t) offset, em};
+
+	glPointSize(UI_GetThemeValuef(TH_VERTEX_SIZE) );
 	bglBegin(GL_POINTS);
-	dm->foreachMappedVert(dm, bbs_mesh_verts__mapFunc, (void*)(intptr_t) offset);
+	dm->foreachMappedVert(dm, bbs_mesh_verts__mapFunc, ptrs);
 	bglEnd();
 	glPointSize(1.0);
 }		
 
-static int bbs_mesh_wire__setDrawOptions(void *userData, int index)
+static DMDrawOption bbs_mesh_wire__setDrawOptions(void *userData, int index)
 {
-	int offset = (intptr_t) userData;
-	EditEdge *eed = EM_get_edge_for_index(index);
+	void **ptrs = userData;
+	int offset = (intptr_t) ptrs[0];
+	BMEdge *eed = EDBM_edge_at_index(ptrs[1], index);
 
-	if (eed->h==0) {
-		WM_set_framebuffer_index_color(offset+index);
-		return 1;
-	} else {
-		return 0;
+	if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
+		WM_set_framebuffer_index_color(offset + index);
+		return DM_DRAW_OPTION_NORMAL;
+	}
+	else {
+		return DM_DRAW_OPTION_SKIP;
 	}
 }
-static void bbs_mesh_wire(DerivedMesh *dm, int offset)
+static void bbs_mesh_wire(BMEditMesh *em, DerivedMesh *dm, int offset)
 {
-	dm->drawMappedEdges(dm, bbs_mesh_wire__setDrawOptions, (void*)(intptr_t) offset);
+	void *ptrs[2] = {(void *)(intptr_t) offset, em};
+	dm->drawMappedEdges(dm, bbs_mesh_wire__setDrawOptions, ptrs);
 }		
 
-static int bbs_mesh_solid__setSolidDrawOptions(void *userData, int index, int *UNUSED(drawSmooth_r))
+static DMDrawOption bbs_mesh_solid__setSolidDrawOptions(void *userData, int index)
 {
-	if (EM_get_face_for_index(index)->h==0) {
-		if (userData) {
-			WM_set_framebuffer_index_color(index+1);
+	BMFace *efa = EDBM_face_at_index(((void **)userData)[0], index);
+	
+	if (efa && !BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
+		if (((void **)userData)[1]) {
+			WM_set_framebuffer_index_color(index + 1);
 		}
-		return 1;
-	} else {
-		return 0;
+		return DM_DRAW_OPTION_NORMAL;
+	}
+	else {
+		return DM_DRAW_OPTION_SKIP;
 	}
 }
 
-static void bbs_mesh_solid__drawCenter(void *UNUSED(userData), int index, float *cent, float *UNUSED(no))
+static void bbs_mesh_solid__drawCenter(void *userData, int index, const float cent[3], const float UNUSED(no[3]))
 {
-	EditFace *efa = EM_get_face_for_index(index);
+	BMFace *efa = EDBM_face_at_index(((void **)userData)[0], index);
 
-	if (efa->h==0 && efa->fgonf!=EM_FGON) {
-		WM_set_framebuffer_index_color(index+1);
+	if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
+		WM_set_framebuffer_index_color(index + 1);
 
 		bglVertex3fv(cent);
 	}
 }
 
 /* two options, facecolors or black */
-static void bbs_mesh_solid_EM(Scene *scene, View3D *v3d,
+static void bbs_mesh_solid_EM(BMEditMesh *em, Scene *scene, View3D *v3d,
                               Object *ob, DerivedMesh *dm, int facecol)
 {
+	void *ptrs[2] = {em, NULL}; //second one being null means to draw black
 	cpack(0);
 
 	if (facecol) {
-		dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, GPU_enable_material, NULL, (void*)(intptr_t) 1, 0);
+		ptrs[1] = (void *)(intptr_t) 1;
+		dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, GPU_enable_material, NULL, ptrs, 0);
 
-		if(check_ob_drawface_dot(scene, v3d, ob->dt)) {
+		if (check_ob_drawface_dot(scene, v3d, ob->dt)) {
 			glPointSize(UI_GetThemeValuef(TH_FACEDOT_SIZE));
-		
+
 			bglBegin(GL_POINTS);
-			dm->foreachMappedFaceCenter(dm, bbs_mesh_solid__drawCenter, NULL);
+			dm->foreachMappedFaceCenter(dm, bbs_mesh_solid__drawCenter, ptrs);
 			bglEnd();
 		}
 
-	} else {
-		dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, GPU_enable_material, NULL, (void*) 0, 0);
+	}
+	else {
+		dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, GPU_enable_material, NULL, ptrs, 0);
 	}
 }
 
-static int bbs_mesh_solid__setDrawOpts(void *UNUSED(userData), int index, int *UNUSED(drawSmooth_r))
+static DMDrawOption bbs_mesh_solid__setDrawOpts(void *UNUSED(userData), int index)
 {
-	WM_set_framebuffer_index_color(index+1);
-	return 1;
+	WM_set_framebuffer_index_color(index + 1);
+	return DM_DRAW_OPTION_NORMAL;
 }
 
-static int bbs_mesh_solid_hide__setDrawOpts(void *userData, int index, int *UNUSED(drawSmooth_r))
+static DMDrawOption bbs_mesh_solid_hide__setDrawOpts(void *userData, int index)
 {
 	Mesh *me = userData;
 
-	if (!(me->mface[index].flag&ME_HIDE)) {
-		WM_set_framebuffer_index_color(index+1);
-		return 1;
-	} else {
-		return 0;
+	if (!(me->mpoly[index].flag & ME_HIDE)) {
+		WM_set_framebuffer_index_color(index + 1);
+		return DM_DRAW_OPTION_NORMAL;
+	}
+	else {
+		return DM_DRAW_OPTION_SKIP;
 	}
 }
 
 // must have called WM_set_framebuffer_index_color beforehand
-static int bbs_mesh_solid_hide2__setDrawOpts(void *userData, int index, int *UNUSED(drawSmooth_r))
+static DMDrawOption bbs_mesh_solid_hide2__setDrawOpts(void *userData, int index)
 {
 	Mesh *me = userData;
 
-	if (!(me->mface[index].flag & ME_HIDE)) {
-		return 1;
-	} else {
-		return 0;
+	if (!(me->mpoly[index].flag & ME_HIDE)) {
+		return DM_DRAW_OPTION_NORMAL;
+	}
+	else {
+		return DM_DRAW_OPTION_SKIP;
 	}
 }
 static void bbs_mesh_solid(Scene *scene, Object *ob)
 {
 	DerivedMesh *dm = mesh_get_derived_final(scene, ob, scene->customdata_mask);
-	Mesh *me = (Mesh*)ob->data;
+	Mesh *me = (Mesh *)ob->data;
 	
 	glColor3ub(0, 0, 0);
 
-	if((me->editflag & ME_EDIT_PAINT_MASK))
+	if ((me->editflag & ME_EDIT_PAINT_MASK))
 		dm->drawMappedFaces(dm, bbs_mesh_solid_hide__setDrawOpts, GPU_enable_material, NULL, me, 0);
 	else
 		dm->drawMappedFaces(dm, bbs_mesh_solid__setDrawOpts, GPU_enable_material, NULL, me, 0);
@@ -7103,72 +7317,74 @@ static void bbs_mesh_solid(Scene *scene, Object *ob)
 
 void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob)
 {
-	ToolSettings *ts= scene->toolsettings;
+	ToolSettings *ts = scene->toolsettings;
 
 	glMultMatrixf(ob->obmat);
 
 	glClearDepth(1.0); glClear(GL_DEPTH_BUFFER_BIT);
 	glEnable(GL_DEPTH_TEST);
 
-	switch( ob->type) {
-	case OB_MESH:
-		if(ob->mode & OB_MODE_EDIT) {
-			Mesh *me= ob->data;
-			EditMesh *em= me->edit_mesh;
+	switch (ob->type) {
+		case OB_MESH:
+			if (ob->mode & OB_MODE_EDIT) {
+				Mesh *me = ob->data;
+				BMEditMesh *em = me->edit_btmesh;
 
-			DerivedMesh *dm = editmesh_get_derived_cage(scene, ob, em, CD_MASK_BAREMESH);
+				DerivedMesh *dm = editbmesh_get_derived_cage(scene, ob, em, CD_MASK_BAREMESH);
 
-			EM_init_index_arrays(em, 1, 1, 1);
+				EDBM_index_arrays_init(em, 1, 1, 1);
 
-			bbs_mesh_solid_EM(scene, v3d, ob, dm, ts->selectmode & SCE_SELECT_FACE);
-			if(ts->selectmode & SCE_SELECT_FACE)
-				em_solidoffs = 1+em->totface;
-			else
-				em_solidoffs= 1;
-			
-			bglPolygonOffset(rv3d->dist, 1.0);
-			
-			// we draw edges always, for loop (select) tools
-			bbs_mesh_wire(dm, em_solidoffs);
-			em_wireoffs= em_solidoffs + em->totedge;
-			
-			// we draw verts if vert select mode or if in transform (for snap).
-			if(ts->selectmode & SCE_SELECT_VERTEX || G.moving & G_TRANSFORM_EDIT) {
-				bbs_mesh_verts(dm, em_wireoffs);
-				em_vertoffs= em_wireoffs + em->totvert;
-			}
-			else em_vertoffs= em_wireoffs;
-			
-			bglPolygonOffset(rv3d->dist, 0.0);
+				bbs_mesh_solid_EM(em, scene, v3d, ob, dm, ts->selectmode & SCE_SELECT_FACE);
+				if (ts->selectmode & SCE_SELECT_FACE)
+					bm_solidoffs = 1 + em->bm->totface;
+				else
+					bm_solidoffs = 1;
 
-			dm->release(dm);
+				bglPolygonOffset(rv3d->dist, 1.0);
 
-			EM_free_index_arrays();
-		}
-		else {
-			Mesh *me= ob->data;
-			if(     (me->editflag & ME_EDIT_VERT_SEL) &&
-			        /* currently vertex select only supports weight paint */
-			        (ob->mode & OB_MODE_WEIGHT_PAINT))
-			{
-				DerivedMesh *dm = mesh_get_derived_final(scene, ob, scene->customdata_mask);
-				glColor3ub(0, 0, 0);
+				// we draw edges always, for loop (select) tools
+				bbs_mesh_wire(em, dm, bm_solidoffs);
+				bm_wireoffs = bm_solidoffs + em->bm->totedge;
 
-				dm->drawMappedFaces(dm, bbs_mesh_solid_hide2__setDrawOpts, GPU_enable_material, NULL, me, 0);
+				// we draw verts if vert select mode or if in transform (for snap).
+				if ((ts->selectmode & SCE_SELECT_VERTEX) || (G.moving & G_TRANSFORM_EDIT)) {
+					bbs_mesh_verts(em, dm, bm_wireoffs);
+					bm_vertoffs = bm_wireoffs + em->bm->totvert;
+				}
+				else {
+					bm_vertoffs = bm_wireoffs;
+				}
+
+				bglPolygonOffset(rv3d->dist, 0.0);
 
-				
-				bbs_obmode_mesh_verts(ob, dm, 1);
-				em_vertoffs = me->totvert+1;
 				dm->release(dm);
+
+				EDBM_index_arrays_free(em);
 			}
 			else {
-				bbs_mesh_solid(scene, ob);
+				Mesh *me = ob->data;
+				if ((me->editflag & ME_EDIT_VERT_SEL) &&
+				    /* currently vertex select only supports weight paint */
+				    (ob->mode & OB_MODE_WEIGHT_PAINT))
+				{
+					DerivedMesh *dm = mesh_get_derived_final(scene, ob, scene->customdata_mask);
+					glColor3ub(0, 0, 0);
+
+					dm->drawMappedFaces(dm, bbs_mesh_solid_hide2__setDrawOpts, GPU_enable_material, NULL, me, 0);
+
+
+					bbs_obmode_mesh_verts(ob, dm, 1);
+					bm_vertoffs = me->totvert + 1;
+					dm->release(dm);
+				}
+				else {
+					bbs_mesh_solid(scene, ob);
+				}
 			}
-		}
-		break;
-	case OB_CURVE:
-	case OB_SURF:
-		break;
+			break;
+		case OB_CURVE:
+		case OB_SURF:
+			break;
 	}
 
 	glLoadMatrixf(rv3d->viewmat);
@@ -7180,28 +7396,28 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
 
 /* helper function for drawing object instances - meshes */
 static void draw_object_mesh_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, 
-									  Object *ob, int dt, int outline)
+                                      Object *ob, int dt, int outline)
 {
-	Mesh *me= ob->data;
-	DerivedMesh *dm=NULL, *edm=NULL;
+	Mesh *me = ob->data;
+	DerivedMesh *dm = NULL, *edm = NULL;
 	int glsl;
 	
-	if(ob->mode & OB_MODE_EDIT)
-		edm= editmesh_get_derived_base(ob, me->edit_mesh);
-	else 
+	if (ob->mode & OB_MODE_EDIT)
+		edm = editbmesh_get_derived_base(ob, me->edit_btmesh);
+	else
 		dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
 
-	if(dt<=OB_WIRE) {
-		if(dm)
+	if (dt <= OB_WIRE) {
+		if (dm)
 			dm->drawEdges(dm, 1, 0);
-		else if(edm)
-			edm->drawEdges(edm, 1, 0);	
+		else if (edm)
+			edm->drawEdges(edm, 1, 0);
 	}
 	else {
-		if(outline)
-			draw_mesh_object_outline(v3d, ob, dm?dm:edm);
+		if (outline)
+			draw_mesh_object_outline(v3d, ob, dm ? dm : edm);
 
-		if(dm) {
+		if (dm) {
 			glsl = draw_glsl_material(scene, ob, v3d, dt);
 			GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, NULL);
 		}
@@ -7211,29 +7427,28 @@ static void draw_object_mesh_instance(Scene *scene, View3D *v3d, RegionView3D *r
 			glDisable(GL_COLOR_MATERIAL);
 		}
 		
-		glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
-		glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
+		glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW);
 		glEnable(GL_LIGHTING);
 		
-		if(dm) {
+		if (dm) {
 			dm->drawFacesSolid(dm, NULL, 0, GPU_enable_material);
 			GPU_end_object_materials();
 		}
-		else if(edm)
+		else if (edm)
 			edm->drawMappedFaces(edm, NULL, GPU_enable_material, NULL, NULL, 0);
 		
 		glDisable(GL_LIGHTING);
 	}
 
-	if(edm) edm->release(edm);
-	if(dm) dm->release(dm);
+	if (edm) edm->release(edm);
+	if (dm) dm->release(dm);
 }
 
 void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, int dt, int outline)
 {
-	if (ob == NULL) 
+	if (ob == NULL)
 		return;
-		
+
 	switch (ob->type) {
 		case OB_MESH:
 			draw_object_mesh_instance(scene, v3d, rv3d, ob, dt, outline);
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index 1ed8e44..0e520a5 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -38,12 +38,11 @@
 #include "DNA_screen_types.h"
 #include "DNA_view3d_types.h"
 
+#include "BLI_utildefines.h"
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
-#include "BLI_editVert.h"
 #include "BLI_edgehash.h"
 #include "BLI_rand.h"
-#include "BLI_utildefines.h"
 
 #include "BKE_curve.h"
 #include "BKE_constraint.h" // for the get_constraint_target function
@@ -78,7 +77,7 @@
 #include "BLF_api.h"
 
 
-#include "view3d_intern.h"	// own include
+#include "view3d_intern.h"  // own include
 
 
 #ifdef _WIN32
@@ -91,38 +90,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 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);
 }
   #if 0
 static double tval()
 {
 	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
 #endif
@@ -135,13 +134,13 @@ static int intersect_edges(float *points, float a, float b, float c, float d, fl
 	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]);
-		if ((t>0)&&(t<1)) {
-			points[numpoints * 3 + 0] = edges[i][0][0] + edges[i][1][0]*t;
-			points[numpoints * 3 + 1] = edges[i][0][1] + edges[i][1][1]*t;
-			points[numpoints * 3 + 2] = edges[i][0][2] + edges[i][1][2]*t;
+	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]);
+		if ((t > 0) && (t < 1)) {
+			points[numpoints * 3 + 0] = edges[i][0][0] + edges[i][1][0] * t;
+			points[numpoints * 3 + 1] = edges[i][0][1] + edges[i][1][1] * t;
+			points[numpoints * 3 + 2] = edges[i][0][2] + edges[i][1][2] * t;
 			numpoints++;
 		}
 	}
@@ -160,14 +159,14 @@ static int convex(float *p0, float *up, float *a, float *b)
 
 void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3], float dx, GPUTexture *tex_shadow)
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 
 	float viewnormal[3];
 	int i, j, n, good_index;
 	float d /*, d0 */ /* UNUSED */, dd, ds;
 	float *points = NULL;
 	int numpoints = 0;
-	float cor[3] = {1.,1.,1.};
+	float cor[3] = {1.0f, 1.0f, 1.0f};
 	int gl_depth = 0, gl_blend = 0;
 
 	/* draw slices of smoke is adapted from c++ code authored
@@ -198,28 +197,28 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3
 	/* 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";
+	                   "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";
 	GLuint prog;
 
 	
 	float size[3];
 
-	if(!tex) {
+	if (!tex) {
 		printf("Could not allocate 3D texture for 3D View smoke drawing.\n");
 		return;
 	}
@@ -306,42 +305,42 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3
 	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;
+	for (i = 0; i < 8; i++) {
+		float x, y, z;
 
 		x = cv[i][0] - viewnormal[0];
 		y = cv[i][1] - viewnormal[1];
 		z = cv[i][2] - viewnormal[2];
 
-		if ((x>=min[0])&&(x<=max[0])
-			&&(y>=min[1])&&(y<=max[1])
-			&&(z>=min[2])&&(z<=max[2])) {
+		if ((x >= min[0]) && (x <= max[0]) &&
+		    (y >= min[1]) && (y <= max[1]) &&
+		    (z >= min[2]) && (z <= max[2]))
+		{
 			break;
 		}
 	}
 
-	if(i >= 8) {
+	if (i >= 8) {
 		/* fallback, avoid using buffer over-run */
-		i= 0;
+		i = 0;
 	}
 
 	// printf("i: %d\n", i);
 	// printf("point %f, %f, %f\n", cv[i][0], cv[i][1], cv[i][2]);
 
-	if (GL_TRUE == glewIsSupported("GL_ARB_fragment_program"))
-	{
+	if (GL_TRUE == glewIsSupported("GL_ARB_fragment_program")) {
 		glEnable(GL_FRAGMENT_PROGRAM_ARB);
 		glGenProgramsARB(1, &prog);
 
@@ -349,23 +348,23 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3
 		glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, (GLsizei)strlen(text), text);
 
 		// cell spacing
-		glProgramLocalParameter4fARB (GL_FRAGMENT_PROGRAM_ARB, 0, dx, dx, dx, 1.0);
+		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);
+		glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 1, 7.0, 7.0, 7.0, 1.0);
 	}
 	else
 		printf("Your gfx card does not support 3D View smoke drawing.\n");
 
 	GPU_texture_bind(tex, 0);
-	if(tex_shadow)
+	if (tex_shadow)
 		GPU_texture_bind(tex_shadow, 1);
 	else
 		printf("No volume shadow\n");
 
 	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]);
-		cor[2] = (float)res[2]/(float)power_of_2_max_i(res[2]);
+		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]);
+		cor[2] = (float)res[2] / (float)power_of_2_max_i(res[2]);
 	}
 
 	// our slices are defined by the plane equation a*x + b*y +c*z + d = 0
@@ -374,24 +373,24 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3
 	// inserting previously found vertex into the plane equation
 
 	/* 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]);
+	ds = (ABS(viewnormal[0]) * size[0] + ABS(viewnormal[1]) * size[1] + ABS(viewnormal[2]) * size[2]);
 	dd = 0.05; // ds/512.0f;
 	n = 0;
 	good_index = i;
 
 	// printf("d0: %f, dd: %f, ds: %f\n\n", d0, dd, ds);
 
-	points = MEM_callocN(sizeof(float)*12*3, "smoke_points_preview");
+	points = MEM_callocN(sizeof(float) * 12 * 3, "smoke_points_preview");
 
-	while(1) {
+	while (1) {
 		float p0[3];
 		float tmp_point[3], tmp_point2[3];
 
-		if(dd*(float)n > ds)
+		if (dd * (float)n > ds)
 			break;
 
 		copy_v3_v3(tmp_point, viewnormal);
-		mul_v3_fl(tmp_point, -dd*((ds/dd)-(float)n));
+		mul_v3_fl(tmp_point, -dd * ((ds / dd) - (float)n));
 		add_v3_v3v3(tmp_point2, cv[good_index], tmp_point);
 		d = dot_v3v3(tmp_point2, viewnormal);
 
@@ -407,12 +406,9 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3
 			copy_v3_v3(p0, points);
 
 			// sort points to get a convex polygon
-			for(i = 1; i < numpoints - 1; i++)
-			{
-				for(j = i + 1; j < numpoints; j++)
-				{
-					if(!convex(p0, viewnormal, &points[j * 3], &points[i * 3]))
-					{
+			for (i = 1; i < numpoints - 1; i++) {
+				for (j = i + 1; j < numpoints; j++) {
+					if (!convex(p0, viewnormal, &points[j * 3], &points[i * 3])) {
 						float tmp2[3];
 						copy_v3_v3(tmp2, &points[j * 3]);
 						copy_v3_v3(&points[j * 3], &points[i * 3]);
@@ -438,12 +434,11 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3
 	tend();
 	// printf ( "Draw Time: %f\n",( float ) tval() );
 
-	if(tex_shadow)
+	if (tex_shadow)
 		GPU_texture_unbind(tex_shadow);
 	GPU_texture_unbind(tex);
 
-	if(GLEW_ARB_fragment_program)
-	{
+	if (GLEW_ARB_fragment_program) {
 		glDisable(GL_FRAGMENT_PROGRAM_ARB);
 		glDeleteProgramsARB(1, &prog);
 	}
@@ -451,10 +446,11 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3
 
 	MEM_freeN(points);
 
-	if(!gl_blend)
+	if (!gl_blend) {
 		glDisable(GL_BLEND);
-	if(gl_depth)
-	{
+	}
+
+	if (gl_depth) {
 		glEnable(GL_DEPTH_TEST);
 		glDepthMask(GL_TRUE);	
 	}
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 94ab847..72b67c2 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -62,7 +62,7 @@
 
 #include "UI_resources.h"
 
-#include "view3d_intern.h"	// own include
+#include "view3d_intern.h"  // own include
 
 /* ******************** manage regions ********************* */
 
@@ -70,20 +70,20 @@ ARegion *view3d_has_buttons_region(ScrArea *sa)
 {
 	ARegion *ar, *arnew;
 
-	ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
-	if(ar) return ar;
+	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 view3d");
+	arnew = MEM_callocN(sizeof(ARegion), "buttons for view3d");
 	
 	BLI_insertlinkafter(&sa->regionbase, ar, arnew);
-	arnew->regiontype= RGN_TYPE_UI;
-	arnew->alignment= RGN_ALIGN_RIGHT;
+	arnew->regiontype = RGN_TYPE_UI;
+	arnew->alignment = RGN_ALIGN_RIGHT;
 	
 	arnew->flag = RGN_FLAG_HIDDEN;
 	
@@ -92,42 +92,42 @@ ARegion *view3d_has_buttons_region(ScrArea *sa)
 
 ARegion *view3d_has_tools_region(ScrArea *sa)
 {
-	ARegion *ar, *artool=NULL, *arprops=NULL, *arhead;
+	ARegion *ar, *artool = NULL, *arprops = NULL, *arhead;
 	
-	for(ar= sa->regionbase.first; ar; ar= ar->next) {
-		if(ar->regiontype==RGN_TYPE_TOOLS)
-			artool= ar;
-		if(ar->regiontype==RGN_TYPE_TOOL_PROPS)
-			arprops= ar;
+	for (ar = sa->regionbase.first; ar; ar = ar->next) {
+		if (ar->regiontype == RGN_TYPE_TOOLS)
+			artool = ar;
+		if (ar->regiontype == RGN_TYPE_TOOL_PROPS)
+			arprops = ar;
 	}
 	
 	/* tool region hide/unhide also hides props */
-	if(arprops && artool) return artool;
+	if (arprops && artool) return artool;
 	
-	if(artool==NULL) {
+	if (artool == NULL) {
 		/* add subdiv level; after header */
-		for(arhead= sa->regionbase.first; arhead; arhead= arhead->next)
-			if(arhead->regiontype==RGN_TYPE_HEADER)
+		for (arhead = sa->regionbase.first; arhead; arhead = arhead->next)
+			if (arhead->regiontype == RGN_TYPE_HEADER)
 				break;
 		
 		/* is error! */
-		if(arhead==NULL) return NULL;
+		if (arhead == NULL) return NULL;
 		
-		artool= MEM_callocN(sizeof(ARegion), "tools for view3d");
+		artool = MEM_callocN(sizeof(ARegion), "tools for view3d");
 		
 		BLI_insertlinkafter(&sa->regionbase, arhead, artool);
-		artool->regiontype= RGN_TYPE_TOOLS;
-		artool->alignment= RGN_ALIGN_LEFT; //RGN_OVERLAP_LEFT;
+		artool->regiontype = RGN_TYPE_TOOLS;
+		artool->alignment = RGN_ALIGN_LEFT; //RGN_OVERLAP_LEFT;
 		artool->flag = RGN_FLAG_HIDDEN;
 	}
 
-	if(arprops==NULL) {
+	if (arprops == NULL) {
 		/* add extra subdivided region for tool properties */
-		arprops= MEM_callocN(sizeof(ARegion), "tool props for view3d");
+		arprops = MEM_callocN(sizeof(ARegion), "tool props for view3d");
 		
 		BLI_insertlinkafter(&sa->regionbase, artool, arprops);
-		arprops->regiontype= RGN_TYPE_TOOL_PROPS;
-		arprops->alignment= RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV;
+		arprops->regiontype = RGN_TYPE_TOOL_PROPS;
+		arprops->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
 	}
 	
 	return artool;
@@ -138,14 +138,14 @@ ARegion *view3d_has_tools_region(ScrArea *sa)
 /* function to always find a regionview3d context inside 3D window */
 RegionView3D *ED_view3d_context_rv3d(bContext *C)
 {
-	RegionView3D *rv3d= CTX_wm_region_view3d(C);
+	RegionView3D *rv3d = CTX_wm_region_view3d(C);
 	
-	if(rv3d==NULL) {
-		ScrArea *sa =CTX_wm_area(C);
-		if(sa && sa->spacetype==SPACE_VIEW3D) {
-			ARegion *ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
-			if(ar) {
-				rv3d= ar->regiondata;
+	if (rv3d == NULL) {
+		ScrArea *sa = CTX_wm_area(C);
+		if (sa && sa->spacetype == SPACE_VIEW3D) {
+			ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+			if (ar) {
+				rv3d = ar->regiondata;
 			}
 		}
 	}
@@ -156,33 +156,33 @@ RegionView3D *ED_view3d_context_rv3d(bContext *C)
  * so return that, the caller can then access the ar->regiondata */
 int ED_view3d_context_user_region(bContext *C, View3D **v3d_r, ARegion **ar_r)
 {
-	ScrArea *sa= CTX_wm_area(C);
+	ScrArea *sa = CTX_wm_area(C);
 
 	*v3d_r = NULL;
 	*ar_r = NULL;
 
-	if(sa && sa->spacetype==SPACE_VIEW3D) {
-		ARegion *ar= CTX_wm_region(C);
+	if (sa && sa->spacetype == SPACE_VIEW3D) {
+		ARegion *ar = CTX_wm_region(C);
 		View3D *v3d = (View3D *)sa->spacedata.first;
 
-		if(ar) {
-			RegionView3D *rv3d= ar->regiondata;
-			if(rv3d && rv3d->viewlock == 0) {
+		if (ar) {
+			RegionView3D *rv3d = ar->regiondata;
+			if (rv3d && rv3d->viewlock == 0) {
 				*v3d_r = v3d;
 				*ar_r = ar;
 				return 1;
 			}
 			else {
-				ARegion *ar_unlock_user= NULL;
-				ARegion *ar_unlock= NULL;
-				for(ar= sa->regionbase.first; ar; ar= ar->next) {
+				ARegion *ar_unlock_user = NULL;
+				ARegion *ar_unlock = NULL;
+				for (ar = sa->regionbase.first; ar; ar = ar->next) {
 					/* find the first unlocked rv3d */
-					if(ar->regiondata && ar->regiontype == RGN_TYPE_WINDOW) {
-						rv3d= ar->regiondata;
-						if(rv3d->viewlock == 0) {
-							ar_unlock= ar;
-							if(rv3d->persp==RV3D_PERSP || rv3d->persp==RV3D_CAMOB) {
-								ar_unlock_user= ar;
+					if (ar->regiondata && ar->regiontype == RGN_TYPE_WINDOW) {
+						rv3d = ar->regiondata;
+						if (rv3d->viewlock == 0) {
+							ar_unlock = ar;
+							if (rv3d->persp == RV3D_PERSP || rv3d->persp == RV3D_CAMOB) {
+								ar_unlock_user = ar;
 								break;
 							}
 						} 
@@ -190,13 +190,13 @@ int ED_view3d_context_user_region(bContext *C, View3D **v3d_r, ARegion **ar_r)
 				}
 
 				/* camera/perspective view get priority when the active region is locked */
-				if(ar_unlock_user) {
+				if (ar_unlock_user) {
 					*v3d_r = v3d;
 					*ar_r = ar_unlock_user;
 					return 1;
 				}
 
-				if(ar_unlock) {
+				if (ar_unlock) {
 					*v3d_r = v3d;
 					*ar_r = ar_unlock;
 					return 1;
@@ -226,7 +226,7 @@ void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d)
 	mult_m4_m4m4(rv3d->persmatob, rv3d->persmat, ob->obmat);
 
 	/* initializes object space clipping, speeds up clip tests */
-	ED_view3d_local_clipping(rv3d, ob->obmat);
+	ED_view3d_clipping_local(rv3d, ob->obmat);
 }
 
 void ED_view3d_init_mats_rv3d_gl(struct Object *ob, struct RegionView3D *rv3d)
@@ -234,8 +234,8 @@ void ED_view3d_init_mats_rv3d_gl(struct Object *ob, struct RegionView3D *rv3d)
 	ED_view3d_init_mats_rv3d(ob, rv3d);
 
 	/* we have to multiply instead of loading viewmatob to make
-	   it work with duplis using displists, otherwise it will
-	   override the dupli-matrix */
+	 * it work with duplis using displists, otherwise it will
+	 * override the dupli-matrix */
 	glMultMatrixf(ob->obmat);
 }
 
@@ -243,24 +243,24 @@ void ED_view3d_init_mats_rv3d_gl(struct Object *ob, struct RegionView3D *rv3d)
 
 static SpaceLink *view3d_new(const bContext *C)
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	ARegion *ar;
 	View3D *v3d;
 	RegionView3D *rv3d;
 	
-	v3d= MEM_callocN(sizeof(View3D), "initview3d");
-	v3d->spacetype= SPACE_VIEW3D;
-	v3d->blockscale= 0.7f;
-	v3d->lay= v3d->layact= 1;
-	if(scene) {
-		v3d->lay= v3d->layact= scene->lay;
-		v3d->camera= scene->camera;
+	v3d = MEM_callocN(sizeof(View3D), "initview3d");
+	v3d->spacetype = SPACE_VIEW3D;
+	v3d->blockscale = 0.7f;
+	v3d->lay = v3d->layact = 1;
+	if (scene) {
+		v3d->lay = v3d->layact = scene->lay;
+		v3d->camera = scene->camera;
 	}
-	v3d->scenelock= TRUE;
-	v3d->grid= 1.0f;
-	v3d->gridlines= 16;
+	v3d->scenelock = TRUE;
+	v3d->grid = 1.0f;
+	v3d->gridlines = 16;
 	v3d->gridsubdiv = 10;
-	v3d->drawtype= OB_SOLID;
+	v3d->drawtype = OB_SOLID;
 	
 	v3d->gridflag |= V3D_SHOW_X;
 	v3d->gridflag |= V3D_SHOW_Y;
@@ -270,60 +270,60 @@ static SpaceLink *view3d_new(const bContext *C)
 	v3d->flag |= V3D_SELECT_OUTLINE;
 	v3d->flag2 |= V3D_SHOW_RECONSTRUCTION;
 	
-	v3d->lens= 35.0f;
-	v3d->near= 0.01f;
-	v3d->far= 1000.0f;
+	v3d->lens = 35.0f;
+	v3d->near = 0.01f;
+	v3d->far = 1000.0f;
 
 	v3d->twflag |= U.tw_flag & V3D_USE_MANIPULATOR;
-	v3d->twtype= V3D_MANIP_TRANSLATE;
-	v3d->around= V3D_CENTROID;
+	v3d->twtype = V3D_MANIP_TRANSLATE;
+	v3d->around = V3D_CENTROID;
 	
-	v3d->bundle_size= 0.2f;
-	v3d->bundle_drawtype= OB_PLAINAXES;
+	v3d->bundle_size = 0.2f;
+	v3d->bundle_drawtype = OB_PLAINAXES;
 	
 	/* header */
-	ar= MEM_callocN(sizeof(ARegion), "header for view3d");
+	ar = MEM_callocN(sizeof(ARegion), "header for view3d");
 	
 	BLI_addtail(&v3d->regionbase, ar);
-	ar->regiontype= RGN_TYPE_HEADER;
-	ar->alignment= RGN_ALIGN_BOTTOM;
+	ar->regiontype = RGN_TYPE_HEADER;
+	ar->alignment = RGN_ALIGN_BOTTOM;
 	
 	/* tool shelf */
-	ar= MEM_callocN(sizeof(ARegion), "toolshelf for view3d");
+	ar = MEM_callocN(sizeof(ARegion), "toolshelf for view3d");
 	
 	BLI_addtail(&v3d->regionbase, ar);
-	ar->regiontype= RGN_TYPE_TOOLS;
-	ar->alignment= RGN_ALIGN_LEFT;
+	ar->regiontype = RGN_TYPE_TOOLS;
+	ar->alignment = RGN_ALIGN_LEFT;
 	ar->flag = RGN_FLAG_HIDDEN;
 	
 	/* tool properties */
-	ar= MEM_callocN(sizeof(ARegion), "tool properties for view3d");
+	ar = MEM_callocN(sizeof(ARegion), "tool properties for view3d");
 	
 	BLI_addtail(&v3d->regionbase, ar);
-	ar->regiontype= RGN_TYPE_TOOL_PROPS;
-	ar->alignment= RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV;
+	ar->regiontype = RGN_TYPE_TOOL_PROPS;
+	ar->alignment = RGN_ALIGN_BOTTOM | RGN_SPLIT_PREV;
 	ar->flag = RGN_FLAG_HIDDEN;
 	
 	/* buttons/list view */
-	ar= MEM_callocN(sizeof(ARegion), "buttons for view3d");
+	ar = MEM_callocN(sizeof(ARegion), "buttons for view3d");
 	
 	BLI_addtail(&v3d->regionbase, ar);
-	ar->regiontype= RGN_TYPE_UI;
-	ar->alignment= RGN_ALIGN_RIGHT;
+	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 view3d");
+	ar = MEM_callocN(sizeof(ARegion), "main area for view3d");
 	
 	BLI_addtail(&v3d->regionbase, ar);
-	ar->regiontype= RGN_TYPE_WINDOW;
+	ar->regiontype = RGN_TYPE_WINDOW;
 	
-	ar->regiondata= MEM_callocN(sizeof(RegionView3D), "region view3d");
-	rv3d= ar->regiondata;
-	rv3d->viewquat[0]= 1.0f;
-	rv3d->persp= RV3D_PERSP;
-	rv3d->view= RV3D_VIEW_PERSPORTHO;
-	rv3d->dist= 10.0;
+	ar->regiondata = MEM_callocN(sizeof(RegionView3D), "region view3d");
+	rv3d = ar->regiondata;
+	rv3d->viewquat[0] = 1.0f;
+	rv3d->persp = RV3D_PERSP;
+	rv3d->view = RV3D_VIEW_PERSPORTHO;
+	rv3d->dist = 10.0;
 	
 	return (SpaceLink *)v3d;
 }
@@ -331,17 +331,13 @@ static SpaceLink *view3d_new(const bContext *C)
 /* not spacelink itself */
 static void view3d_free(SpaceLink *sl)
 {
-	View3D *vd= (View3D *) sl;
+	View3D *vd = (View3D *) sl;
 
-	BGpic *bgpic;
-	for(bgpic= vd->bgpicbase.first; bgpic; bgpic= bgpic->next) {
-		if(bgpic->ima) bgpic->ima->id.us--;
-	}
 	BLI_freelistN(&vd->bgpicbase);
 
-	if(vd->localvd) MEM_freeN(vd->localvd);
+	if (vd->localvd) MEM_freeN(vd->localvd);
 	
-	if(vd->properties_storage) MEM_freeN(vd->properties_storage);
+	if (vd->properties_storage) MEM_freeN(vd->properties_storage);
 }
 
 
@@ -353,32 +349,28 @@ static void view3d_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
 
 static SpaceLink *view3d_duplicate(SpaceLink *sl)
 {
-	View3D *v3do= (View3D *)sl;
-	View3D *v3dn= MEM_dupallocN(sl);
-	BGpic *bgpic;
+	View3D *v3do = (View3D *)sl;
+	View3D *v3dn = MEM_dupallocN(sl);
 	
 	/* clear or remove stuff from old */
 	
 // XXX	BIF_view3d_previewrender_free(v3do);
 	
-	if(v3do->localvd) {
-		v3do->localvd= NULL;
-		v3do->properties_storage= NULL;
-		v3do->lay= v3dn->localvd->lay;
+	if (v3do->localvd) {
+		v3do->localvd = NULL;
+		v3do->properties_storage = NULL;
+		v3do->lay = v3dn->localvd->lay;
 		v3do->lay &= 0xFFFFFF;
 	}
 
-	if(v3dn->drawtype == OB_RENDER)
+	if (v3dn->drawtype == OB_RENDER)
 		v3dn->drawtype = OB_SOLID;
 	
 	/* copy or clear inside new stuff */
 
 	BLI_duplicatelist(&v3dn->bgpicbase, &v3do->bgpicbase);
-	for(bgpic= v3dn->bgpicbase.first; bgpic; bgpic= bgpic->next)
-		if(bgpic->ima)
-			bgpic->ima->id.us++;
 
-	v3dn->properties_storage= NULL;
+	v3dn->properties_storage = NULL;
 	
 	return (SpaceLink *)v3dn;
 }
@@ -392,76 +384,76 @@ static void view3d_main_area_init(wmWindowManager *wm, ARegion *ar)
 	/* object ops. */
 	
 	/* important to be before Pose keymap since they can both be enabled at once */
-	keymap= WM_keymap_find(wm->defaultconf, "Face Mask", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Face Mask", 0, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 	
 	
-	keymap= WM_keymap_find(wm->defaultconf, "Weight Paint Vertex Selection", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Weight Paint Vertex Selection", 0, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 
 	/* pose is not modal, operator poll checks for this */
-	keymap= WM_keymap_find(wm->defaultconf, "Pose", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Pose", 0, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 	
-	keymap= WM_keymap_find(wm->defaultconf, "Object Mode", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Object Mode", 0, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 
-	keymap= WM_keymap_find(wm->defaultconf, "Image Paint", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Image Paint", 0, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 
-	keymap= WM_keymap_find(wm->defaultconf, "Vertex Paint", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Vertex Paint", 0, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 
-	keymap= WM_keymap_find(wm->defaultconf, "Weight Paint", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Weight Paint", 0, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 
-	keymap= WM_keymap_find(wm->defaultconf, "Sculpt", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Sculpt", 0, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 	
-	keymap= WM_keymap_find(wm->defaultconf, "Mesh", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Mesh", 0, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 	
-	keymap= WM_keymap_find(wm->defaultconf, "Curve", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Curve", 0, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 	
-	keymap= WM_keymap_find(wm->defaultconf, "Armature", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Armature", 0, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 
-	keymap= WM_keymap_find(wm->defaultconf, "Pose", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Pose", 0, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 
-	keymap= WM_keymap_find(wm->defaultconf, "Metaball", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Metaball", 0, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 	
-	keymap= WM_keymap_find(wm->defaultconf, "Lattice", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Lattice", 0, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 
 	/* armature sketching needs to take over mouse */
-	keymap= WM_keymap_find(wm->defaultconf, "Armature Sketch", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Armature Sketch", 0, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 
-	keymap= WM_keymap_find(wm->defaultconf, "Particle", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Particle", 0, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 
 	/* editfont keymap swallows all... */
-	keymap= WM_keymap_find(wm->defaultconf, "Font", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Font", 0, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 
-	keymap= WM_keymap_find(wm->defaultconf, "Object Non-modal", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Object Non-modal", 0, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 
-	keymap= WM_keymap_find(wm->defaultconf, "Frames", 0, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "Frames", 0, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 
 	/* own keymap, last so modes can override it */
-	keymap= WM_keymap_find(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 
-	keymap= WM_keymap_find(wm->defaultconf, "3D View", SPACE_VIEW3D, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "3D View", SPACE_VIEW3D, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 	
 	/* add drop boxes */
-	lb= WM_dropboxmap_find("View3D", SPACE_VIEW3D, RGN_TYPE_WINDOW);
+	lb = WM_dropboxmap_find("View3D", SPACE_VIEW3D, RGN_TYPE_WINDOW);
 	
 	WM_event_add_dropbox_handler(&ar->handlers, lb);
 	
@@ -469,9 +461,9 @@ static void view3d_main_area_init(wmWindowManager *wm, ARegion *ar)
 
 static int view3d_ob_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
 {
-	if(drag->type==WM_DRAG_ID) {
-		ID *id= (ID *)drag->poin;
-		if( GS(id->name)==ID_OB )
+	if (drag->type == WM_DRAG_ID) {
+		ID *id = (ID *)drag->poin;
+		if (GS(id->name) == ID_OB)
 			return 1;
 	}
 	return 0;
@@ -479,9 +471,9 @@ static int view3d_ob_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSE
 
 static int view3d_mat_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
 {
-	if(drag->type==WM_DRAG_ID) {
-		ID *id= (ID *)drag->poin;
-		if( GS(id->name)==ID_MA )
+	if (drag->type == WM_DRAG_ID) {
+		ID *id = (ID *)drag->poin;
+		if (GS(id->name) == ID_MA)
 			return 1;
 	}
 	return 0;
@@ -489,13 +481,13 @@ static int view3d_mat_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUS
 
 static int view3d_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
 {
-	if(drag->type==WM_DRAG_ID) {
-		ID *id= (ID *)drag->poin;
-		if( GS(id->name)==ID_IM )
+	if (drag->type == WM_DRAG_ID) {
+		ID *id = (ID *)drag->poin;
+		if (GS(id->name) == ID_IM)
 			return 1;
 	}
-	else if(drag->type==WM_DRAG_PATH){
-		if(ELEM(drag->icon, 0, ICON_FILE_IMAGE))	/* rule might not work? */
+	else if (drag->type == WM_DRAG_PATH) {
+		if (ELEM(drag->icon, 0, ICON_FILE_IMAGE))   /* rule might not work? */
 			return 1;
 	}
 	return 0;
@@ -504,7 +496,7 @@ static int view3d_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUS
 
 static int view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
 {
-	if( ED_view3d_give_base_under_cursor(C, event->mval) ) {
+	if (ED_view3d_give_base_under_cursor(C, event->mval) ) {
 		return 0;
 	}
 	return view3d_ima_drop_poll(C, drag, event);
@@ -512,7 +504,7 @@ static int view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
 
 static int view3d_ima_ob_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
 {
-	if( ED_view3d_give_base_under_cursor(C, event->mval) ) {
+	if (ED_view3d_give_base_under_cursor(C, event->mval) ) {
 		return view3d_ima_drop_poll(C, drag, event);
 	}
 	return 0;
@@ -520,31 +512,31 @@ static int view3d_ima_ob_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
 
 static void view3d_ob_drop_copy(wmDrag *drag, wmDropBox *drop)
 {
-	ID *id= (ID *)drag->poin;
+	ID *id = (ID *)drag->poin;
 	PointerRNA ptr;
 
 	/* need to put name in sub-operator in macro */
-	ptr= RNA_pointer_get(drop->ptr, "OBJECT_OT_add_named");
-	if(ptr.data)
-		RNA_string_set(&ptr, "name", id->name+2);
+	ptr = RNA_pointer_get(drop->ptr, "OBJECT_OT_add_named");
+	if (ptr.data)
+		RNA_string_set(&ptr, "name", id->name + 2);
 	else
-		RNA_string_set(drop->ptr, "name", id->name+2);
+		RNA_string_set(drop->ptr, "name", id->name + 2);
 }
 
 static void view3d_id_drop_copy(wmDrag *drag, wmDropBox *drop)
 {
-	ID *id= (ID *)drag->poin;
+	ID *id = (ID *)drag->poin;
 	
-	RNA_string_set(drop->ptr, "name", id->name+2);
+	RNA_string_set(drop->ptr, "name", id->name + 2);
 }
 
 static void view3d_id_path_drop_copy(wmDrag *drag, wmDropBox *drop)
 {
-	ID *id= (ID *)drag->poin;
+	ID *id = (ID *)drag->poin;
 	
-	if(id)
-		RNA_string_set(drop->ptr, "name", id->name+2);
-	if(drag->path[0]) 
+	if (id)
+		RNA_string_set(drop->ptr, "name", id->name + 2);
+	if (drag->path[0])
 		RNA_string_set(drop->ptr, "filepath", drag->path);
 }
 
@@ -552,7 +544,7 @@ static void view3d_id_path_drop_copy(wmDrag *drag, wmDropBox *drop)
 /* region dropbox definition */
 static void view3d_dropboxes(void)
 {
-	ListBase *lb= WM_dropboxmap_find("View3D", SPACE_VIEW3D, RGN_TYPE_WINDOW);
+	ListBase *lb = WM_dropboxmap_find("View3D", SPACE_VIEW3D, RGN_TYPE_WINDOW);
 	
 	WM_dropbox_add(lb, "OBJECT_OT_add_named_cursor", view3d_ob_drop_poll, view3d_ob_drop_copy);
 	WM_dropbox_add(lb, "OBJECT_OT_drop_named_material", view3d_mat_drop_poll, view3d_id_drop_copy);
@@ -565,46 +557,46 @@ static void view3d_dropboxes(void)
 /* type callback, not region itself */
 static void view3d_main_area_free(ARegion *ar)
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 	
-	if(rv3d) {
-		if(rv3d->localvd) MEM_freeN(rv3d->localvd);
-		if(rv3d->clipbb) MEM_freeN(rv3d->clipbb);
+	if (rv3d) {
+		if (rv3d->localvd) MEM_freeN(rv3d->localvd);
+		if (rv3d->clipbb) MEM_freeN(rv3d->clipbb);
 
-		if(rv3d->ri) { 
+		if (rv3d->ri) {
 			// XXX		BIF_view3d_previewrender_free(rv3d);
 		}
 
-		if(rv3d->render_engine)
+		if (rv3d->render_engine)
 			RE_engine_free(rv3d->render_engine);
 		
-		if(rv3d->depths) {
-			if(rv3d->depths->depths) MEM_freeN(rv3d->depths->depths);
+		if (rv3d->depths) {
+			if (rv3d->depths->depths) MEM_freeN(rv3d->depths->depths);
 			MEM_freeN(rv3d->depths);
 		}
 		MEM_freeN(rv3d);
-		ar->regiondata= NULL;
+		ar->regiondata = NULL;
 	}
 }
 
 /* copy regiondata */
 static void *view3d_main_area_duplicate(void *poin)
 {
-	if(poin) {
-		RegionView3D *rv3d= poin, *new;
+	if (poin) {
+		RegionView3D *rv3d = poin, *new;
 	
-		new= MEM_dupallocN(rv3d);
-		if(rv3d->localvd) 
-			new->localvd= MEM_dupallocN(rv3d->localvd);
-		if(rv3d->clipbb) 
-			new->clipbb= MEM_dupallocN(rv3d->clipbb);
+		new = MEM_dupallocN(rv3d);
+		if (rv3d->localvd)
+			new->localvd = MEM_dupallocN(rv3d->localvd);
+		if (rv3d->clipbb)
+			new->clipbb = MEM_dupallocN(rv3d->clipbb);
 		
-		new->depths= NULL;
-		new->ri= NULL;
-		new->render_engine= NULL;
-		new->gpd= NULL;
-		new->sms= NULL;
-		new->smooth_timer= NULL;
+		new->depths = NULL;
+		new->ri = NULL;
+		new->render_engine = NULL;
+		new->gpd = NULL;
+		new->sms = NULL;
+		new->smooth_timer = NULL;
 		
 		return new;
 	}
@@ -613,28 +605,28 @@ static void *view3d_main_area_duplicate(void *poin)
 
 static void view3d_recalc_used_layers(ARegion *ar, wmNotifier *wmn, Scene *scene)
 {
-	wmWindow *win= wmn->wm->winactive;
+	wmWindow *win = wmn->wm->winactive;
 	ScrArea *sa;
-	unsigned int lay_used= 0;
+	unsigned int lay_used = 0;
 	Base *base;
 
 	if (!win) return;
 
-	base= scene->base.first;
-	while(base) {
-		lay_used |= base->lay & ((1<<20)-1); /* ignore localview */
+	base = scene->base.first;
+	while (base) {
+		lay_used |= base->lay & ((1 << 20) - 1); /* ignore localview */
 
-		if (lay_used == (1<<20)-1)
+		if (lay_used == (1 << 20) - 1)
 			break;
 
-		base= base->next;
+		base = base->next;
 	}
 
-	for(sa= win->screen->areabase.first; sa; sa= sa->next) {
-		if(sa->spacetype == SPACE_VIEW3D) {
-			if(BLI_findindex(&sa->regionbase, ar) != -1) {
-				View3D *v3d= sa->spacedata.first;
-				v3d->lay_used= lay_used;
+	for (sa = win->screen->areabase.first; sa; sa = sa->next) {
+		if (sa->spacetype == SPACE_VIEW3D) {
+			if (BLI_findindex(&sa->regionbase, ar) != -1) {
+				View3D *v3d = sa->spacedata.first;
+				v3d->lay_used = lay_used;
 				break;
 			}
 		}
@@ -646,9 +638,9 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
 	bScreen *sc;
 
 	/* context changes */
-	switch(wmn->category) {
+	switch (wmn->category) {
 		case NC_ANIMATION:
-			switch(wmn->data) {
+			switch (wmn->data) {
 				case ND_KEYFRAME_PROP:
 				case ND_NLA_ACTCHANGE:
 					ED_region_tag_redraw(ar);
@@ -665,7 +657,7 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
 			}
 			break;
 		case NC_SCENE:
-			switch(wmn->data) {
+			switch (wmn->data) {
 				case ND_LAYER_CONTENT:
 					view3d_recalc_used_layers(ar, wmn, wmn->reference);
 					ED_region_tag_redraw(ar);
@@ -688,7 +680,7 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_OBJECT:
-			switch(wmn->data) {
+			switch (wmn->data) {
 				case ND_BONE_ACTIVE:
 				case ND_BONE_SELECT:
 				case ND_TRANSFORM:
@@ -701,20 +693,20 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
 					ED_region_tag_redraw(ar);
 					break;
 			}
-			switch(wmn->action) {
+			switch (wmn->action) {
 				case NA_ADDED:
 					ED_region_tag_redraw(ar);
 					break;
 			}
 			break;
 		case NC_GEOM:
-			switch(wmn->data) {
+			switch (wmn->data) {
 				case ND_DATA:
 				case ND_SELECT:
 					ED_region_tag_redraw(ar);
 					break;
 			}
-			switch(wmn->action) {
+			switch (wmn->action) {
 				case NA_EDITED:
 					ED_region_tag_redraw(ar);
 					break;
@@ -725,32 +717,32 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
 			ED_region_tag_redraw(ar);
 			break;
 		case NC_BRUSH:
-			if(wmn->action == NA_EDITED)
+			if (wmn->action == NA_EDITED)
 				ED_region_tag_redraw_overlay(ar);
 			break;			
 		case NC_MATERIAL:
-			switch(wmn->data) {
+			switch (wmn->data) {
 				case ND_SHADING_DRAW:
 					ED_region_tag_redraw(ar);
 					break;
 			}
 			break;
 		case NC_WORLD:
-			switch(wmn->data) {
+			switch (wmn->data) {
 				case ND_WORLD_DRAW:
 					/* handled by space_view3d_listener() for v3d access */
 					break;
 				case ND_WORLD_STARS:
 				{
-					RegionView3D *rv3d= ar->regiondata;
-					if(rv3d->persp == RV3D_CAMOB) {
+					RegionView3D *rv3d = ar->regiondata;
+					if (rv3d->persp == RV3D_CAMOB) {
 						ED_region_tag_redraw(ar);
 					}
 				}
 			}
 			break;
 		case NC_LAMP:
-			switch(wmn->data) {
+			switch (wmn->data) {
 				case ND_LIGHTING_DRAW:
 					ED_region_tag_redraw(ar);
 					break;
@@ -766,24 +758,24 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
 			ED_region_tag_redraw(ar);
 			break;
 		case NC_MOVIECLIP:
-			if(wmn->data==ND_DISPLAY)
+			if (wmn->data == ND_DISPLAY)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_SPACE:
-			if(wmn->data == ND_SPACE_VIEW3D) {
+			if (wmn->data == ND_SPACE_VIEW3D) {
 				if (wmn->subtype == NS_VIEW3D_GPU) {
-					RegionView3D *rv3d= ar->regiondata;
+					RegionView3D *rv3d = ar->regiondata;
 					rv3d->rflag |= RV3D_GPULIGHT_UPDATE;
 				}
 				ED_region_tag_redraw(ar);
 			}
 			break;
 		case NC_ID:
-			if(wmn->action == NA_RENAME)
+			if (wmn->action == NA_RENAME)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_SCREEN:
-			switch(wmn->data) {
+			switch (wmn->data) {
 				case ND_GPENCIL:
 				case ND_ANIMPLAY:
 				case ND_SKETCH:
@@ -794,7 +786,7 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
 				case ND_SCREENSET:
 					/* screen was changed, need to update used layers due to NC_SCENE|ND_LAYER_CONTENT */
 					/* updates used layers only for View3D in active screen */
-					sc= wmn->reference;
+					sc = wmn->reference;
 					view3d_recalc_used_layers(ar, wmn, sc->scene);
 					ED_region_tag_redraw(ar);
 					break;
@@ -807,9 +799,9 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
 /* concept is to retrieve cursor type context-less */
 static void view3d_main_area_cursor(wmWindow *win, ScrArea *UNUSED(sa), ARegion *UNUSED(ar))
 {
-	Scene *scene= win->screen->scene;
+	Scene *scene = win->screen->scene;
 
-	if(scene->obedit) {
+	if (scene->obedit) {
 		WM_cursor_set(win, CURSOR_EDIT);
 	}
 	else {
@@ -820,7 +812,7 @@ static void view3d_main_area_cursor(wmWindow *win, ScrArea *UNUSED(sa), ARegion
 /* add handlers, stuff you only do once or on area/region changes */
 static void view3d_header_area_init(wmWindowManager *wm, ARegion *ar)
 {
-	wmKeyMap *keymap= WM_keymap_find(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
+	wmKeyMap *keymap = WM_keymap_find(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
 	
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 
@@ -835,9 +827,9 @@ static void view3d_header_area_draw(const bContext *C, ARegion *ar)
 static void view3d_header_area_listener(ARegion *ar, wmNotifier *wmn)
 {
 	/* context changes */
-	switch(wmn->category) {
+	switch (wmn->category) {
 		case NC_SCENE:
-			switch(wmn->data) {
+			switch (wmn->data) {
 				case ND_FRAME:
 				case ND_OB_ACTIVE:
 				case ND_OB_SELECT:
@@ -851,7 +843,7 @@ static void view3d_header_area_listener(ARegion *ar, wmNotifier *wmn)
 			}
 			break;
 		case NC_SPACE:
-			if(wmn->data == ND_SPACE_VIEW3D)
+			if (wmn->data == ND_SPACE_VIEW3D)
 				ED_region_tag_redraw(ar);
 			break;
 	}
@@ -864,7 +856,7 @@ static void view3d_buttons_area_init(wmWindowManager *wm, ARegion *ar)
 
 	ED_region_panels_init(wm, ar);
 	
-	keymap= WM_keymap_find(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
@@ -876,9 +868,9 @@ static void view3d_buttons_area_draw(const bContext *C, ARegion *ar)
 static void view3d_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
 {
 	/* context changes */
-	switch(wmn->category) {
+	switch (wmn->category) {
 		case NC_ANIMATION:
-			switch(wmn->data) {
+			switch (wmn->data) {
 				case ND_KEYFRAME_PROP:
 				case ND_NLA_ACTCHANGE:
 					ED_region_tag_redraw(ar);
@@ -891,7 +883,7 @@ static void view3d_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
 			}
 			break;
 		case NC_SCENE:
-			switch(wmn->data) {
+			switch (wmn->data) {
 				case ND_FRAME:
 				case ND_OB_ACTIVE:
 				case ND_OB_SELECT:
@@ -903,14 +895,14 @@ static void view3d_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
 					ED_region_tag_redraw(ar);
 					break;
 			}
-			switch(wmn->action) {
+			switch (wmn->action) {
 				case NA_EDITED:
 					ED_region_tag_redraw(ar);
 					break;
 			}
 			break;
 		case NC_OBJECT:
-			switch(wmn->data) {
+			switch (wmn->data) {
 				case ND_BONE_ACTIVE:
 				case ND_BONE_SELECT:
 				case ND_TRANSFORM:
@@ -923,7 +915,7 @@ static void view3d_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
 			}
 			break;
 		case NC_GEOM:
-			switch(wmn->data) {
+			switch (wmn->data) {
 				case ND_DATA:
 				case ND_SELECT:
 					ED_region_tag_redraw(ar);
@@ -933,23 +925,24 @@ static void view3d_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_TEXTURE:
+		case NC_MATERIAL:
 			/* for brush textures */
 			ED_region_tag_redraw(ar);
 			break;
 		case NC_BRUSH:
-			if(wmn->action==NA_EDITED)
+			if (wmn->action == NA_EDITED)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_SPACE:
-			if(wmn->data == ND_SPACE_VIEW3D)
+			if (wmn->data == ND_SPACE_VIEW3D)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_ID:
-			if(wmn->action == NA_RENAME)
+			if (wmn->action == NA_RENAME)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_SCREEN: 
-			if(wmn->data == ND_GPENCIL)
+			if (wmn->data == ND_GPENCIL)
 				ED_region_tag_redraw(ar);
 			break;
 	}
@@ -962,7 +955,7 @@ static void view3d_tools_area_init(wmWindowManager *wm, ARegion *ar)
 	
 	ED_region_panels_init(wm, ar);
 
-	keymap= WM_keymap_find(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
+	keymap = WM_keymap_find(wm->defaultconf, "3D View Generic", SPACE_VIEW3D, 0);
 	WM_event_add_keymap_handler(&ar->handlers, keymap);
 }
 
@@ -974,17 +967,17 @@ static void view3d_tools_area_draw(const bContext *C, ARegion *ar)
 static void view3d_props_area_listener(ARegion *ar, wmNotifier *wmn)
 {
 	/* context changes */
-	switch(wmn->category) {
+	switch (wmn->category) {
 		case NC_WM:
-			if(wmn->data == ND_HISTORY)
+			if (wmn->data == ND_HISTORY)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_SCENE:
-			if(wmn->data == ND_MODE)
+			if (wmn->data == ND_MODE)
 				ED_region_tag_redraw(ar);
 			break;
 		case NC_SPACE:
-			if(wmn->data == ND_SPACE_VIEW3D)
+			if (wmn->data == ND_SPACE_VIEW3D)
 				ED_region_tag_redraw(ar);
 			break;
 	}
@@ -996,27 +989,27 @@ static void space_view3d_listener(struct ScrArea *sa, struct wmNotifier *wmn)
 	View3D *v3d = sa->spacedata.first;
 
 	/* context changes */
-	switch(wmn->category) {
+	switch (wmn->category) {
 		case NC_SCENE:
-			switch(wmn->data) {
+			switch (wmn->data) {
 				case ND_WORLD:
-					if(v3d->flag2 & V3D_RENDER_OVERRIDE)
+					if (v3d->flag2 & V3D_RENDER_OVERRIDE)
 						ED_area_tag_redraw_regiontype(sa, RGN_TYPE_WINDOW);
 					break;
 			}
 			break;
 		case NC_WORLD:
-			switch(wmn->data) {
+			switch (wmn->data) {
 				case ND_WORLD_DRAW:
-					if(v3d->flag2 & V3D_RENDER_OVERRIDE)
+					if (v3d->flag2 & V3D_RENDER_OVERRIDE)
 						ED_area_tag_redraw_regiontype(sa, RGN_TYPE_WINDOW);
 					break;
 			}
 			break;
 		case NC_MATERIAL:
-			switch(wmn->data) {
+			switch (wmn->data) {
 				case ND_NODES:
-					if(v3d->drawtype == OB_TEXTURE)
+					if (v3d->drawtype == OB_TEXTURE)
 						ED_area_tag_redraw_regiontype(sa, RGN_TYPE_WINDOW);
 					break;
 			}
@@ -1042,26 +1035,27 @@ static void space_view3d_listener(struct ScrArea *sa, struct wmNotifier *wmn)
 const char *view3d_context_dir[] = {
 	"selected_objects", "selected_bases", "selected_editable_objects",
 	"selected_editable_bases", "visible_objects", "visible_bases", "selectable_objects", "selectable_bases",
-	"active_base", "active_object", NULL};
+	"active_base", "active_object", NULL
+};
 
 static int view3d_context(const bContext *C, const char *member, bContextDataResult *result)
 {
-	View3D *v3d= CTX_wm_view3d(C);
-	Scene *scene= CTX_data_scene(C);
+	View3D *v3d = CTX_wm_view3d(C);
+	Scene *scene = CTX_data_scene(C);
 	Base *base;
 	/* fallback to the scene layer, allows duplicate and other object operators to run outside the 3d view */
-	unsigned int lay = v3d ? v3d->lay:scene->lay;
+	unsigned int lay = v3d ? v3d->lay : scene->lay;
 
-	if(CTX_data_dir(member)) {
+	if (CTX_data_dir(member)) {
 		CTX_data_dir_set(result, view3d_context_dir);
 	}
-	else if(CTX_data_equals(member, "selected_objects") || CTX_data_equals(member, "selected_bases")) {
-		int selected_objects= CTX_data_equals(member, "selected_objects");
+	else if (CTX_data_equals(member, "selected_objects") || CTX_data_equals(member, "selected_bases")) {
+		int selected_objects = CTX_data_equals(member, "selected_objects");
 
-		for(base=scene->base.first; base; base=base->next) {
-			if((base->flag & SELECT) && (base->lay & lay)) {
-				if((base->object->restrictflag & OB_RESTRICT_VIEW)==0) {
-					if(selected_objects)
+		for (base = scene->base.first; base; base = base->next) {
+			if ((base->flag & SELECT) && (base->lay & lay)) {
+				if ((base->object->restrictflag & OB_RESTRICT_VIEW) == 0) {
+					if (selected_objects)
 						CTX_data_id_list_add(result, &base->object->id);
 					else
 						CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
@@ -1071,14 +1065,14 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
 		CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "selected_editable_objects") || CTX_data_equals(member, "selected_editable_bases")) {
-		int selected_editable_objects= CTX_data_equals(member, "selected_editable_objects");
-
-		for(base=scene->base.first; base; base=base->next) {
-			if((base->flag & SELECT) && (base->lay & lay)) {
-				if((base->object->restrictflag & OB_RESTRICT_VIEW)==0) {
-					if(0==object_is_libdata(base->object)) {
-						if(selected_editable_objects)
+	else if (CTX_data_equals(member, "selected_editable_objects") || CTX_data_equals(member, "selected_editable_bases")) {
+		int selected_editable_objects = CTX_data_equals(member, "selected_editable_objects");
+
+		for (base = scene->base.first; base; base = base->next) {
+			if ((base->flag & SELECT) && (base->lay & lay)) {
+				if ((base->object->restrictflag & OB_RESTRICT_VIEW) == 0) {
+					if (0 == object_is_libdata(base->object)) {
+						if (selected_editable_objects)
 							CTX_data_id_list_add(result, &base->object->id);
 						else
 							CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
@@ -1089,13 +1083,13 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
 		CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "visible_objects") || CTX_data_equals(member, "visible_bases")) {
-		int visible_objects= CTX_data_equals(member, "visible_objects");
+	else if (CTX_data_equals(member, "visible_objects") || CTX_data_equals(member, "visible_bases")) {
+		int visible_objects = CTX_data_equals(member, "visible_objects");
 
-		for(base=scene->base.first; base; base=base->next) {
-			if(base->lay & lay) {
-				if((base->object->restrictflag & OB_RESTRICT_VIEW)==0) {
-					if(visible_objects)
+		for (base = scene->base.first; base; base = base->next) {
+			if (base->lay & lay) {
+				if ((base->object->restrictflag & OB_RESTRICT_VIEW) == 0) {
+					if (visible_objects)
 						CTX_data_id_list_add(result, &base->object->id);
 					else
 						CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
@@ -1105,13 +1099,13 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
 		CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
 		return 1;
 	}
-	else if(CTX_data_equals(member, "selectable_objects") || CTX_data_equals(member, "selectable_bases")) {
-		int selectable_objects= CTX_data_equals(member, "selectable_objects");
+	else if (CTX_data_equals(member, "selectable_objects") || CTX_data_equals(member, "selectable_bases")) {
+		int selectable_objects = CTX_data_equals(member, "selectable_objects");
 
-		for(base=scene->base.first; base; base=base->next) {
-			if(base->lay & lay) {
-				if((base->object->restrictflag & OB_RESTRICT_VIEW)==0 && (base->object->restrictflag & OB_RESTRICT_SELECT)==0) {
-					if(selectable_objects)
+		for (base = scene->base.first; base; base = base->next) {
+			if (base->lay & lay) {
+				if ((base->object->restrictflag & OB_RESTRICT_VIEW) == 0 && (base->object->restrictflag & OB_RESTRICT_SELECT) == 0) {
+					if (selectable_objects)
 						CTX_data_id_list_add(result, &base->object->id);
 					else
 						CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
@@ -1121,16 +1115,16 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
 		CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
 		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)
+	else if (CTX_data_equals(member, "active_base")) {
+		if (scene->basact && (scene->basact->lay & lay))
+			if ((scene->basact->object->restrictflag & OB_RESTRICT_VIEW) == 0)
 				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)
+	else if (CTX_data_equals(member, "active_object")) {
+		if (scene->basact && (scene->basact->lay & lay))
+			if ((scene->basact->object->restrictflag & OB_RESTRICT_VIEW) == 0)
 				CTX_data_id_pointer_set(result, &scene->basact->object->id);
 		
 		return 1;
@@ -1146,56 +1140,56 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
 /* only called once, from space/spacetypes.c */
 void ED_spacetype_view3d(void)
 {
-	SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype view3d");
+	SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype view3d");
 	ARegionType *art;
 	
-	st->spaceid= SPACE_VIEW3D;
+	st->spaceid = SPACE_VIEW3D;
 	strncpy(st->name, "View3D", BKE_ST_MAXNAME);
 	
-	st->new= view3d_new;
-	st->free= view3d_free;
-	st->init= view3d_init;
+	st->new = view3d_new;
+	st->free = view3d_free;
+	st->init = view3d_init;
 	st->listener = space_view3d_listener;
-	st->duplicate= view3d_duplicate;
-	st->operatortypes= view3d_operatortypes;
-	st->keymap= view3d_keymap;
-	st->dropboxes= view3d_dropboxes;
-	st->context= view3d_context;
+	st->duplicate = view3d_duplicate;
+	st->operatortypes = view3d_operatortypes;
+	st->keymap = view3d_keymap;
+	st->dropboxes = view3d_dropboxes;
+	st->context = view3d_context;
 	
 	/* regions: main window */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype view3d main region");
+	art = MEM_callocN(sizeof(ARegionType), "spacetype view3d main region");
 	art->regionid = RGN_TYPE_WINDOW;
-	art->keymapflag= ED_KEYMAP_GPENCIL;
-	art->draw= view3d_main_area_draw;
-	art->init= view3d_main_area_init;
-	art->free= view3d_main_area_free;
-	art->duplicate= view3d_main_area_duplicate;
-	art->listener= view3d_main_area_listener;
-	art->cursor= view3d_main_area_cursor;
-	art->lock= 1;	/* can become flag, see BKE_spacedata_draw_locks */
+	art->keymapflag = ED_KEYMAP_GPENCIL;
+	art->draw = view3d_main_area_draw;
+	art->init = view3d_main_area_init;
+	art->free = view3d_main_area_free;
+	art->duplicate = view3d_main_area_duplicate;
+	art->listener = view3d_main_area_listener;
+	art->cursor = view3d_main_area_cursor;
+	art->lock = 1;   /* can become flag, see BKE_spacedata_draw_locks */
 	BLI_addhead(&st->regiontypes, art);
 	
 	/* regions: listview/buttons */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype view3d buttons region");
+	art = MEM_callocN(sizeof(ARegionType), "spacetype view3d buttons region");
 	art->regionid = RGN_TYPE_UI;
-	art->prefsizex= 180; // XXX
-	art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES;
-	art->listener= view3d_buttons_area_listener;
-	art->init= view3d_buttons_area_init;
-	art->draw= view3d_buttons_area_draw;
+	art->prefsizex = 180; // XXX
+	art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES;
+	art->listener = view3d_buttons_area_listener;
+	art->init = view3d_buttons_area_init;
+	art->draw = view3d_buttons_area_draw;
 	BLI_addhead(&st->regiontypes, art);
 
 	view3d_buttons_register(art);
 
 	/* regions: tool(bar) */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype view3d tools region");
+	art = MEM_callocN(sizeof(ARegionType), "spacetype view3d tools region");
 	art->regionid = RGN_TYPE_TOOLS;
-	art->prefsizex= 160; // XXX
-	art->prefsizey= 50; // XXX
-	art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES;
-	art->listener= view3d_buttons_area_listener;
-	art->init= view3d_tools_area_init;
-	art->draw= view3d_tools_area_draw;
+	art->prefsizex = 160; // XXX
+	art->prefsizey = 50; // XXX
+	art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES;
+	art->listener = view3d_buttons_area_listener;
+	art->init = view3d_tools_area_init;
+	art->draw = view3d_tools_area_draw;
 	BLI_addhead(&st->regiontypes, art);
 	
 #if 0
@@ -1204,27 +1198,27 @@ void ED_spacetype_view3d(void)
 #endif
 
 	/* regions: tool properties */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype view3d tool properties region");
+	art = MEM_callocN(sizeof(ARegionType), "spacetype view3d tool properties region");
 	art->regionid = RGN_TYPE_TOOL_PROPS;
-	art->prefsizex= 0;
-	art->prefsizey= 120;
-	art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES;
-	art->listener= view3d_props_area_listener;
-	art->init= view3d_tools_area_init;
-	art->draw= view3d_tools_area_draw;
+	art->prefsizex = 0;
+	art->prefsizey = 120;
+	art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES;
+	art->listener = view3d_props_area_listener;
+	art->init = view3d_tools_area_init;
+	art->draw = view3d_tools_area_draw;
 	BLI_addhead(&st->regiontypes, art);
 	
 	view3d_tool_props_register(art);
 	
 	
 	/* regions: header */
-	art= MEM_callocN(sizeof(ARegionType), "spacetype view3d header region");
+	art = MEM_callocN(sizeof(ARegionType), "spacetype view3d header region");
 	art->regionid = RGN_TYPE_HEADER;
-	art->prefsizey= HEADERY;
-	art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
-	art->listener= view3d_header_area_listener;
-	art->init= view3d_header_area_init;
-	art->draw= view3d_header_area_draw;
+	art->prefsizey = HEADERY;
+	art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER;
+	art->listener = view3d_header_area_listener;
+	art->init = view3d_header_area_init;
+	art->draw = view3d_header_area_draw;
 	BLI_addhead(&st->regiontypes, art);
 	
 	BKE_spacetype_register(st);
diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c
index 5238fd3..c3ff00e 100644
--- a/source/blender/editors/space_view3d/view3d_buttons.c
+++ b/source/blender/editors/space_view3d/view3d_buttons.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
@@ -18,7 +18,7 @@
  * The Original Code is Copyright (C) 2009 Blender Foundation.
  * All rights reserved.
  *
- * 
+ *
  * Contributor(s): Blender Foundation
  *
  * ***** END GPL LICENSE BLOCK *****
@@ -38,15 +38,17 @@
 #include "DNA_curve_types.h"
 #include "DNA_lattice_types.h"
 #include "DNA_meta_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 
 #include "MEM_guardedalloc.h"
 
+#include "BLF_translation.h"
+
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
-#include "BLI_editVert.h"
 #include "BLI_rand.h"
 #include "BLI_utildefines.h"
 
@@ -58,6 +60,7 @@
 #include "BKE_main.h"
 #include "BKE_mesh.h"
 #include "BKE_screen.h"
+#include "BKE_tessmesh.h"
 #include "BKE_deform.h"
 #include "BKE_object.h"
 
@@ -76,53 +79,18 @@
 #include "UI_interface.h"
 #include "UI_resources.h"
 
-#include "view3d_intern.h"	// own include
+#include "view3d_intern.h"  /* own include */
 
 
 /* ******************* view3d space & buttons ************** */
-#define B_NOP		1
-#define B_REDR		2
-#define B_OBJECTPANELROT 	1007
+#define B_NOP       		1
+#define B_REDR      		2
 #define B_OBJECTPANELMEDIAN 1008
-#define B_ARMATUREPANEL1 	1009
-#define B_ARMATUREPANEL2 	1010
-#define B_OBJECTPANELPARENT 1011
-#define B_OBJECTPANEL		1012
-#define B_ARMATUREPANEL3 	1013
-#define B_OBJECTPANELSCALE 	1014
-#define B_OBJECTPANELDIMS 	1015
-#define B_TRANSFORMSPACEADD	1016
-#define B_TRANSFORMSPACECLEAR	1017
-#define B_SETPT_AUTO	2125
-#define B_SETPT_VECTOR	2126
-#define B_SETPT_ALIGN	2127
-#define B_SETPT_FREE	2128
-#define B_RECALCMBALL	2501
-
-#define B_WEIGHT0_0		2840
-#define B_WEIGHT1_4		2841
-#define B_WEIGHT1_2		2842
-#define B_WEIGHT3_4		2843
-#define B_WEIGHT1_0		2844
-
-#define B_OPA1_8		2845
-#define B_OPA1_4		2846
-#define B_OPA1_2		2847
-#define B_OPA3_4		2848
-#define B_OPA1_0		2849
-
-#define B_CLR_WPAINT	2850
-
-#define B_RV3D_LOCKED	2900
-#define B_RV3D_BOXVIEW	2901
-#define B_RV3D_BOXCLIP	2902
-
-#define B_IDNAME		3000
 
 /* temporary struct for storing transform properties */
 typedef struct {
-	float ob_eul[4];	// used for quat too....
-	float ob_scale[3]; // need temp space due to linked values
+	float ob_eul[4];   /* used for quat too... */
+	float ob_scale[3]; /* need temp space due to linked values */
 	float ob_dims[3];
 	short link_scale;
 	float ve_median[7];
@@ -130,113 +98,145 @@ typedef struct {
 	float *defweightp;
 } TransformProperties;
 
+/* Helper function to compute a median changed value,
+ * when the value should be clamped in [0.0, 1.0].
+ * Returns either 0.0, 1.0 (both can be applied directly), a positive scale factor
+ * for scale down, or a negative one for scale up.
+ */
+static float compute_scale_factor(const float ve_median, const float median)
+{
+	if (ve_median <= 0.0f)
+		return 0.0f;
+	else if (ve_median >= 1.0f)
+		return 1.0f;
+	else {
+		/* Scale value to target median. */
+		float median_new = ve_median;
+		float median_orig = ve_median - median; /* Previous median value. */
+
+		/* In case of floating point error. */
+		CLAMP(median_orig, 0.0f, 1.0f);
+		CLAMP(median_new, 0.0f, 1.0f);
+
+		if (median_new <= median_orig) {
+			/* Scale down. */
+			return median_new / median_orig;
+		}
+		else {
+			/* Scale up, negative to indicate it... */
+			return -(1.0f - median_new) / (1.0f - median_orig);
+		}
+	}
+}
 
 /* is used for both read and write... */
 static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float lim)
 {
-	uiBlock *block= (layout)? uiLayoutAbsoluteBlock(layout): NULL;
-	MDeformVert *dvert=NULL;
+	uiBlock *block = (layout) ? uiLayoutAbsoluteBlock(layout) : NULL;
+	MDeformVert *dvert = NULL;
 	TransformProperties *tfp;
 	float median[7], ve_median[7];
 	int tot, totw, totweight, totedge, totradius;
 	char defstr[320];
 	PointerRNA radius_ptr;
 
-	median[0]= median[1]= median[2]= median[3]= median[4]= median[5]= median[6]= 0.0;
-	tot= totw= totweight= totedge= totradius= 0;
-	defstr[0]= 0;
+	median[0] = median[1] = median[2] = median[3] = median[4] = median[5] = median[6] = 0.0;
+	tot = totw = totweight = totedge = totradius = 0;
+	defstr[0] = 0;
 
 	/* make sure we got storage */
-	if(v3d->properties_storage==NULL)
-		v3d->properties_storage= MEM_callocN(sizeof(TransformProperties), "TransformProperties");
-	tfp= v3d->properties_storage;
-	
-	if(ob->type==OB_MESH) {
-		Mesh *me= ob->data;
-		EditMesh *em = BKE_mesh_get_editmesh(me);
-		EditVert *eve, *evedef=NULL;
-		EditEdge *eed;
-		
-		eve= em->verts.first;
-		while(eve) {
-			if(eve->f & SELECT) {
-				evedef= eve;
+	if (v3d->properties_storage == NULL)
+		v3d->properties_storage = MEM_callocN(sizeof(TransformProperties), "TransformProperties");
+	tfp = v3d->properties_storage;
+
+	if (ob->type == OB_MESH) {
+		Mesh *me = ob->data;
+		BMEditMesh *em = me->edit_btmesh;
+		BMesh *bm = em->bm;
+		BMVert *eve, *evedef = NULL;
+		BMEdge *eed;
+		BMIter iter;
+
+		BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
+			if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
+				evedef = eve;
 				tot++;
 				add_v3_v3(median, eve->co);
 			}
-			eve= eve->next;
 		}
-		eed= em->edges.first;
-		while(eed) {
-			if((eed->f & SELECT)) {
+
+		BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
+			if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
+				float *f;
+
 				totedge++;
-				median[3]+= eed->crease;
-				median[6]+= eed->bweight;
+				f = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_CREASE);
+				median[3] += f ? *f : 0.0f;
+
+				f = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_BWEIGHT);
+				median[6] += f ? *f : 0.0f;
 			}
-			eed= eed->next;
 		}
 
 		/* check for defgroups */
-		if(evedef)
-			dvert= CustomData_em_get(&em->vdata, evedef->data, CD_MDEFORMVERT);
-		if(tot==1 && dvert && dvert->totweight) {
+		if (evedef)
+			dvert = CustomData_bmesh_get(&bm->vdata, evedef->head.data, CD_MDEFORMVERT);
+		if (tot == 1 && dvert && dvert->totweight) {
 			bDeformGroup *dg;
-			int i, max=1, init=1;
+			int i, max = 1, init = 1;
 			char str[320];
-			
-			for (i=0; i<dvert->totweight; i++){
-				dg = BLI_findlink (&ob->defbase, dvert->dw[i].def_nr);
-				if(dg) {
-					max+= BLI_snprintf(str, sizeof(str), "%s %%x%d|", dg->name, dvert->dw[i].def_nr); 
+
+			for (i = 0; i < dvert->totweight; i++) {
+				dg = BLI_findlink(&ob->defbase, dvert->dw[i].def_nr);
+				if (dg) {
+					max += BLI_snprintf(str, sizeof(str), "%s %%x%d|", dg->name, dvert->dw[i].def_nr);
 					if (max < sizeof(str)) strcat(defstr, str);
 				}
 
-				if(tfp->curdef==dvert->dw[i].def_nr) {
-					init= 0;
-					tfp->defweightp= &dvert->dw[i].weight;
+				if (tfp->curdef == dvert->dw[i].def_nr) {
+					init = 0;
+					tfp->defweightp = &dvert->dw[i].weight;
 				}
 			}
-			
-			if(init) {	// needs new initialized 
-				tfp->curdef= dvert->dw[0].def_nr;
-				tfp->defweightp= &dvert->dw[0].weight;
+
+			if (init) { /* needs new initialized */
+				tfp->curdef = dvert->dw[0].def_nr;
+				tfp->defweightp = &dvert->dw[0].weight;
 			}
 		}
-
-		BKE_mesh_end_editmesh(me, em);
 	}
-	else if(ob->type==OB_CURVE || ob->type==OB_SURF) {
-		Curve *cu= ob->data;
+	else if (ob->type == OB_CURVE || ob->type == OB_SURF) {
+		Curve *cu = ob->data;
 		Nurb *nu;
 		BPoint *bp;
 		BezTriple *bezt;
 		int a;
-		ListBase *nurbs= curve_editnurbs(cu);
-		StructRNA *seltype= NULL;
-		void *selp= NULL;
-
-		nu= nurbs->first;
-		while(nu) {
-			if(nu->type == CU_BEZIER) {
-				bezt= nu->bezt;
-				a= nu->pntsu;
-				while(a--) {
-					if(bezt->f2 & SELECT) {
+		ListBase *nurbs = curve_editnurbs(cu);
+		StructRNA *seltype = NULL;
+		void *selp = NULL;
+
+		nu = nurbs->first;
+		while (nu) {
+			if (nu->type == CU_BEZIER) {
+				bezt = nu->bezt;
+				a = nu->pntsu;
+				while (a--) {
+					if (bezt->f2 & SELECT) {
 						add_v3_v3(median, bezt->vec[1]);
 						tot++;
-						median[4]+= bezt->weight;
+						median[4] += bezt->weight;
 						totweight++;
-						median[5]+= bezt->radius;
+						median[5] += bezt->radius;
 						totradius++;
-						selp= bezt;
-						seltype= &RNA_BezierSplinePoint;
+						selp = bezt;
+						seltype = &RNA_BezierSplinePoint;
 					}
 					else {
-						if(bezt->f1 & SELECT) {
+						if (bezt->f1 & SELECT) {
 							add_v3_v3(median, bezt->vec[0]);
 							tot++;
 						}
-						if(bezt->f3 & SELECT) {
+						if (bezt->f3 & SELECT) {
 							add_v3_v3(median, bezt->vec[2]);
 							tot++;
 						}
@@ -245,50 +245,50 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
 				}
 			}
 			else {
-				bp= nu->bp;
-				a= nu->pntsu*nu->pntsv;
-				while(a--) {
-					if(bp->f1 & SELECT) {
+				bp = nu->bp;
+				a = nu->pntsu * nu->pntsv;
+				while (a--) {
+					if (bp->f1 & SELECT) {
 						add_v3_v3(median, bp->vec);
-						median[3]+= bp->vec[3];
+						median[3] += bp->vec[3];
 						totw++;
 						tot++;
-						median[4]+= bp->weight;
+						median[4] += bp->weight;
 						totweight++;
-						median[5]+= bp->radius;
+						median[5] += bp->radius;
 						totradius++;
-						selp= bp;
-						seltype= &RNA_SplinePoint;
+						selp = bp;
+						seltype = &RNA_SplinePoint;
 					}
 					bp++;
 				}
 			}
-			nu= nu->next;
+			nu = nu->next;
 		}
 
-		if(totradius==1)
+		if (totradius == 1)
 			RNA_pointer_create(&cu->id, seltype, selp, &radius_ptr);
 	}
-	else if(ob->type==OB_LATTICE) {
-		Lattice *lt= ob->data;
+	else if (ob->type == OB_LATTICE) {
+		Lattice *lt = ob->data;
 		BPoint *bp;
 		int a;
-		
-		a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
-		bp= lt->editlatt->latt->def;
-		while(a--) {
-			if(bp->f1 & SELECT) {
+
+		a = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw;
+		bp = lt->editlatt->latt->def;
+		while (a--) {
+			if (bp->f1 & SELECT) {
 				add_v3_v3(median, bp->vec);
 				tot++;
-				median[4]+= bp->weight;
+				median[4] += bp->weight;
 				totweight++;
 			}
 			bp++;
 		}
 	}
-	
-	if(tot==0) {
-		uiDefBut(block, LABEL, 0, "Nothing selected",0, 130, 200, 20, NULL, 0, 0, 0, 0, "");
+
+	if (tot == 0) {
+		uiDefBut(block, LABEL, 0, IFACE_("Nothing selected"), 0, 130, 200, 20, NULL, 0, 0, 0, 0, "");
 		return;
 	}
 	median[0] /= (float)tot;
@@ -298,173 +298,166 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
 		median[3] /= (float)totedge;
 		median[6] /= (float)totedge;
 	}
-	else if(totw) median[3] /= (float)totw;
-	if(totweight) median[4] /= (float)totweight;
-	if(totradius) median[5] /= (float)totradius;
-	
-	if(v3d->flag & V3D_GLOBAL_STATS)
+	else if (totw)
+		median[3] /= (float)totw;
+	if (totweight)
+		median[4] /= (float)totweight;
+	if (totradius)
+		median[5] /= (float)totradius;
+
+	if (v3d->flag & V3D_GLOBAL_STATS)
 		mul_m4_v3(ob->obmat, median);
-	
-	if(block) {	// buttons
+
+	if (block) { /* buttons */
 		uiBut *but;
+		int yi = 200;
+		const int buth = 20 * UI_DPI_ICON_FAC;
+		const int but_margin = 2;
 
 		memcpy(tfp->ve_median, median, sizeof(tfp->ve_median));
-		
+
 		uiBlockBeginAlign(block);
-		if(tot==1) {
-			uiDefBut(block, LABEL, 0, "Vertex:",					0, 150, 200, 20, NULL, 0, 0, 0, 0, "");
-			uiBlockBeginAlign(block);
-
-			but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "X:",		0, 130, 200, 20, &(tfp->ve_median[0]), -lim, lim, 10, 3, "");
-			uiButSetUnitType(but, PROP_UNIT_LENGTH);
-			but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Y:",		0, 110, 200, 20, &(tfp->ve_median[1]), -lim, lim, 10, 3, "");
-			uiButSetUnitType(but, PROP_UNIT_LENGTH);
-			but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Z:",		0, 90, 200, 20, &(tfp->ve_median[2]), -lim, lim, 10, 3, "");
-			uiButSetUnitType(but, PROP_UNIT_LENGTH);
-
-			if(totw==1) {
-				uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "W:",	0, 70, 200, 20, &(tfp->ve_median[3]), 0.01, 100.0, 1, 3, "");
-				uiBlockBeginAlign(block);
-				uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, "Global",		0, 45, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays global values");
-				uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, "Local",		100, 45, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays local values");
-				uiBlockEndAlign(block);
-				if(totweight)
-					uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:",	0, 20, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 1, 3, "");
-				if(totradius) {
-					if(totradius==1) uiDefButR(block, NUM, 0, "Radius", 0, 20, 200, 20, &radius_ptr, "radius", 0, 0.0, 100.0, 10, 3, NULL);
-					else uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:",	0, 20, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 1, 3, "Radius of curve CPs");
-				}
-			}
-			else {
-				uiBlockBeginAlign(block);
-				uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, "Global",		0, 65, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays global values");
-				uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, "Local",		100, 65, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays local values");
-				uiBlockEndAlign(block);
-				if(totweight)
-					uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:",	0, 40, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 10, 3, "");
-				if(totradius) {
-					if(totradius==1) uiDefButR(block, NUM, 0, "Radius", 0, 40, 200, 20, &radius_ptr, "radius", 0, 0.0, 100.0, 10, 3, NULL);
-					else uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:",	0, 40, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 10, 3, "Radius of curve CPs");
-				}
-			}
+		if (tot == 1) {
+			uiDefBut(block, LABEL, 0, IFACE_("Vertex:"), 0, yi -= buth, 200, buth, NULL, 0, 0, 0, 0, "");
 		}
 		else {
-			uiDefBut(block, LABEL, 0, "Median:",					0, 150, 200, 20, NULL, 0, 0, 0, 0, "");
-			uiBlockBeginAlign(block);
-			but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "X:",		0, 130, 200, 20, &(tfp->ve_median[0]), -lim, lim, 10, 3, "");
-			uiButSetUnitType(but, PROP_UNIT_LENGTH);
-			but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Y:",		0, 110, 200, 20, &(tfp->ve_median[1]), -lim, lim, 10, 3, "");
-			uiButSetUnitType(but, PROP_UNIT_LENGTH);
-			but= uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Z:",		0, 90, 200, 20, &(tfp->ve_median[2]), -lim, lim, 10, 3, "");
-			uiButSetUnitType(but, PROP_UNIT_LENGTH);
-			if(totw==tot) {
-				uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "W:",	0, 70, 200, 20, &(tfp->ve_median[3]), 0.01, 100.0, 1, 3, "");
-				uiBlockEndAlign(block);
-				uiBlockBeginAlign(block);
-				uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, "Global",		0, 45, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays global values");
-				uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, "Local",		100, 45, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays local values");
-				uiBlockEndAlign(block);
-				if(totweight)
-					uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:",	0, 20, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 10, 3, "Weight is used for SoftBody Goal");
-				if(totradius)
-					uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:",	0, 20, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 10, 3, "Radius of curve CPs");
-				uiBlockEndAlign(block);
-			}
-			else {
-				uiBlockBeginAlign(block);
-				uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, "Global",		0, 65, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays global values");
-				uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, "Local",		100, 65, 100, 20, &v3d->flag, 0, 0, 0, 0, "Displays local values");
-				uiBlockEndAlign(block);
-				if(totweight)
-					uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Weight:",	0, 40, 200, 20, &(tfp->ve_median[4]), 0.0, 1.0, 1, 3, "Weight is used for SoftBody Goal");
-				if(totradius)
-					uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Radius:",	0, 20, 200, 20, &(tfp->ve_median[5]), 0.0, 100.0, 1, 3, "Radius of curve CPs");
-				uiBlockEndAlign(block);
-			}
+			uiDefBut(block, LABEL, 0, IFACE_("Median:"), 0, yi -= buth, 200, buth, NULL, 0, 0, 0, 0, "");
 		}
 
-		if(totedge==1){
-			uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Crease:",	0, 40, 200, 20, &(tfp->ve_median[3]), 0.0, 1.0, 1, 3, "");
-			uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Bevel Weight:",	0, 20, 200, 20, &(tfp->ve_median[6]), 0.0, 1.0, 1, 3, "");
+		uiBlockBeginAlign(block);
+
+		/* Should be no need to translate these. */
+		but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "X:", 0, yi -= buth, 200, buth,
+		                &(tfp->ve_median[0]), -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, "");
+		uiButSetUnitType(but, PROP_UNIT_LENGTH);
+		but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Y:", 0, yi -= buth, 200, buth,
+		                &(tfp->ve_median[1]), -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, "");
+		uiButSetUnitType(but, PROP_UNIT_LENGTH);
+		but = uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Z:",0, yi -= buth, 200, buth,
+		                &(tfp->ve_median[2]), -lim, lim, 10, RNA_TRANSLATION_PREC_DEFAULT, "");
+		uiButSetUnitType(but, PROP_UNIT_LENGTH);
+
+		if (totw == tot) {
+			uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "W:", 0, yi -= buth, 200, buth,
+			          &(tfp->ve_median[3]), 0.01, 100.0, 1, 3, "");
 		}
-		else if(totedge>1){
-			uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Mean Crease:",	0, 40, 200, 20, &(tfp->ve_median[3]), 0.0, 1.0, 1, 3, "");
-			uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, "Mean Bevel Weight:",	0, 20, 200, 20, &(tfp->ve_median[6]), 0.0, 1.0, 1, 3, "");
+
+		uiBlockBeginAlign(block);
+		uiDefButBitS(block, TOG, V3D_GLOBAL_STATS, B_REDR, IFACE_("Global"),
+		             0, yi -= buth + but_margin, 100, buth,
+		             &v3d->flag, 0, 0, 0, 0, "Displays global values");
+		uiDefButBitS(block, TOGN, V3D_GLOBAL_STATS, B_REDR, IFACE_("Local"),
+		             100, yi, 100, buth,
+		             &v3d->flag, 0, 0, 0, 0, "Displays local values");
+		uiBlockEndAlign(block);
+
+		if (totweight == 1) {
+			uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Weight:"),
+			          0, yi -= buth + but_margin, 200, buth,
+			          &(tfp->ve_median[4]), 0.0, 1.0, 1, 3, TIP_("Weight used for SoftBody Goal"));
+		}
+		else if (totweight > 1) {
+			uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Weight:"),
+			          0, yi -= buth, 200, buth,
+			          &(tfp->ve_median[4]), 0.0, 1.0, 1, 3, TIP_("Weight used for SoftBody Goal"));
 		}
 
+		if (totradius == 1) {
+			uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Radius:"),
+			          0, yi -= buth + but_margin, 200, buth,
+			          &(tfp->ve_median[5]), 0.0, 100.0, 1, 3, TIP_("Radius of curve control points"));
+		}
+		else if (totradius > 1) {
+			uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Radius:"),
+			          0, yi -= buth + but_margin, 200, buth,
+			          &(tfp->ve_median[5]), 0.0, 100.0, 1, 3, TIP_("Radius of curve control points"));
+		}
+
+		if (totedge == 1) {
+			uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Crease:"),
+			          0, yi -= buth + but_margin, 200, buth,
+			          &(tfp->ve_median[3]), 0.0, 1.0, 1, 3, TIP_("Weight used by SubSurf modifier"));
+			uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Bevel Weight:"),
+			          0, yi -= buth + but_margin, 200, buth,
+			          &(tfp->ve_median[6]), 0.0, 1.0, 1, 3, TIP_("Weight used by Bevel modifier"));
+		}
+		else if (totedge > 1) {
+			uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Crease:"),
+			          0, yi -= buth + but_margin, 200, buth,
+			          &(tfp->ve_median[3]), 0.0, 1.0, 1, 3, TIP_("Weight used by SubSurf modifier"));
+			uiDefButF(block, NUM, B_OBJECTPANELMEDIAN, IFACE_("Mean Bevel Weight:"),
+			          0, yi -= buth + but_margin, 200, buth,
+			          &(tfp->ve_median[6]), 0.0, 1.0, 1, 3, TIP_("Weight used by Bevel modifier"));
+		}
+
+		uiBlockEndAlign(block);
+		uiBlockEndAlign(block);
+
 	}
-	else {	// apply
+	else { /* apply */
 		memcpy(ve_median, tfp->ve_median, sizeof(tfp->ve_median));
-		
-		if(v3d->flag & V3D_GLOBAL_STATS) {
+
+		if (v3d->flag & V3D_GLOBAL_STATS) {
 			invert_m4_m4(ob->imat, ob->obmat);
 			mul_m4_v3(ob->imat, median);
 			mul_m4_v3(ob->imat, ve_median);
 		}
 		sub_v3_v3v3(median, ve_median, median);
-		median[3]= ve_median[3]-median[3];
-		median[4]= ve_median[4]-median[4];
-		median[5]= ve_median[5]-median[5];
-		median[6]= ve_median[6]-median[6];
-		
-		if(ob->type==OB_MESH) {
-			Mesh *me= ob->data;
-			EditMesh *em = BKE_mesh_get_editmesh(me);
-
-			/* allow for some rounding error becasue of matrix transform */
-			if(len_v3(median) > 0.000001f) {
-				EditVert *eve;
-
-				for(eve= em->verts.first; eve; eve= eve->next) {
-					if(eve->f & SELECT) {
+		median[3] = ve_median[3] - median[3];
+		median[4] = ve_median[4] - median[4];
+		median[5] = ve_median[5] - median[5];
+		median[6] = ve_median[6] - median[6];
+
+		if (ob->type == OB_MESH) {
+			Mesh *me = ob->data;
+			BMEditMesh *em = me->edit_btmesh;
+			BMesh *bm = em->bm;
+			BMVert *eve;
+			BMIter iter;
+
+			if (len_v3(median) > 0.000001f) {
+
+				BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
+					if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
 						add_v3_v3(eve->co, median);
 					}
 				}
 
-				recalc_editnormals(em);
+				EDBM_mesh_normals_update(em);
 			}
 
-			if(median[3] != 0.0f) {
-				EditEdge *eed;
-				const float fixed_crease= (ve_median[3] <= 0.0f ? 0.0f : (ve_median[3] >= 1.0f ? 1.0f : FLT_MAX));
+			if (median[3] != 0.0f) {
+				BMEdge *eed;
+				const float sca = compute_scale_factor(ve_median[3], median[3]);
 
-				if(fixed_crease != FLT_MAX) {
-					/* simple case */
-
-					for(eed= em->edges.first; eed; eed= eed->next) {
-						if(eed->f & SELECT) {
-							eed->crease= fixed_crease;
+				if (ELEM(sca, 0.0f, 1.0f)) {
+					BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
+						if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
+							float *crease = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_CREASE);
+							if (crease) {
+								*crease = sca;
+							}
 						}
 					}
 				}
-				else {
-					/* scale crease to target median */
-					float median_new= ve_median[3];
-					float median_orig= ve_median[3] - median[3]; /* previous median value */
-
-					/* incase of floating point error */
-					CLAMP(median_orig, 0.0f, 1.0f);
-					CLAMP(median_new, 0.0f, 1.0f);
-
-					if(median_new < median_orig) {
-						/* scale down */
-						const float sca= median_new / median_orig;
-						
-						for(eed= em->edges.first; eed; eed= eed->next) {
-							if(eed->f & SELECT) {
-								eed->crease *= sca;
-								CLAMP(eed->crease, 0.0f, 1.0f);
+				else if (sca > 0.0f) {
+					BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
+						if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
+							float *crease = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_CREASE);
+							if (crease) {
+								*crease *= sca;
+								CLAMP(*crease, 0.0f, 1.0f);
 							}
 						}
 					}
-					else {
-						/* scale up */
-						const float sca= (1.0f - median_new) / (1.0f - median_orig);
-
-						for(eed= em->edges.first; eed; eed= eed->next) {
-							if(eed->f & SELECT) {
-								eed->crease = 1.0f - ((1.0f - eed->crease) * sca);
-								CLAMP(eed->crease, 0.0f, 1.0f);
+				}
+				else {
+					BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
+						if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
+							float *crease = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_CREASE);
+							if (crease) {
+								*crease = 1.0f + ((1.0f - *crease) * sca);
+								CLAMP(*crease, 0.0f, 1.0f);
 							}
 						}
 					}
@@ -472,79 +465,82 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
 			}
 
 			if (median[6] != 0.0f) {
-				EditEdge *eed;
-				const float fixed_bweight= (ve_median[6] <= 0.0f ? 0.0f : (ve_median[6] >= 1.0f ? 1.0f : FLT_MAX));
-
-				if(fixed_bweight != FLT_MAX) {
-					/* simple case */
-
-					for(eed= em->edges.first; eed; eed= eed->next) {
-						if(eed->f & SELECT) {
-							eed->bweight= fixed_bweight;
+				BMEdge *eed;
+				const float sca = compute_scale_factor(ve_median[6], median[6]);
+
+				if (ELEM(sca, 0.0f, 1.0f)) {
+					BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
+						if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
+							float *bweight = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_BWEIGHT);
+							if (bweight) {
+								*bweight = sca;
+							}
 						}
 					}
 				}
-				else {
-					/* scale crease to target median */
-					float median_new= ve_median[6];
-					float median_orig= ve_median[6] - median[6]; /* previous median value */
-
-					/* incase of floating point error */
-					CLAMP(median_orig, 0.0f, 1.0f);
-					CLAMP(median_new, 0.0f, 1.0f);
-
-					if(median_new < median_orig) {
-						/* scale down */
-						const float sca= median_new / median_orig;
-
-						for(eed= em->edges.first; eed; eed= eed->next) {
-							if(eed->f & SELECT) {
-								eed->bweight *= sca;
-								CLAMP(eed->bweight, 0.0f, 1.0f);
+				else if (sca > 0.0f) {
+					BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
+						if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
+							float *bweight = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_BWEIGHT);
+							if (bweight) {
+								*bweight *= sca;
+								CLAMP(*bweight, 0.0f, 1.0f);
 							}
 						}
 					}
-					else {
-						/* scale up */
-						const float sca= (1.0f - median_new) / (1.0f - median_orig);
-
-						for(eed= em->edges.first; eed; eed= eed->next) {
-							if(eed->f & SELECT) {
-								eed->bweight = 1.0f - ((1.0f - eed->bweight) * sca);
-								CLAMP(eed->bweight, 0.0f, 1.0f);
+				}
+				else {
+					BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
+						if (BM_elem_flag_test(eed, BM_ELEM_SELECT) && !BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
+							float *bweight = (float *)CustomData_bmesh_get(&bm->edata, eed->head.data, CD_BWEIGHT);
+							if (bweight) {
+								*bweight = 1.0f + ((1.0f - *bweight) * sca);
+								CLAMP(*bweight, 0.0f, 1.0f);
 							}
 						}
 					}
 				}
 			}
-			BKE_mesh_end_editmesh(me, em);
+			EDBM_mesh_normals_update(em);
 		}
-		else if(ob->type==OB_CURVE || ob->type==OB_SURF) {
-			Curve *cu= ob->data;
+		else if (ELEM(ob->type, OB_CURVE, OB_SURF)) {
+			Curve *cu = ob->data;
 			Nurb *nu;
 			BPoint *bp;
 			BezTriple *bezt;
 			int a;
-			ListBase *nurbs= curve_editnurbs(cu);
-
-			nu= nurbs->first;
-			while(nu) {
-				if(nu->type == CU_BEZIER) {
-					bezt= nu->bezt;
-					a= nu->pntsu;
-					while(a--) {
-						if(bezt->f2 & SELECT) {
+			ListBase *nurbs = curve_editnurbs(cu);
+			const float scale_w = compute_scale_factor(ve_median[4], median[4]);
+
+			nu = nurbs->first;
+			while (nu) {
+				if (nu->type == CU_BEZIER) {
+					bezt = nu->bezt;
+					a = nu->pntsu;
+					while (a--) {
+						if (bezt->f2 & SELECT) {
 							add_v3_v3(bezt->vec[0], median);
 							add_v3_v3(bezt->vec[1], median);
 							add_v3_v3(bezt->vec[2], median);
-							bezt->weight+= median[4];
-							bezt->radius+= median[5];
+
+							if (median[4] != 0.0f) {
+								if (ELEM(scale_w, 0.0f, 1.0f)) {
+									bezt->weight = scale_w;
+								}
+								else {
+									bezt->weight = scale_w > 0.0f ? bezt->weight * scale_w :
+									                                1.0f + ((1.0f - bezt->weight) * scale_w);
+									CLAMP(bezt->weight, 0.0f, 1.0f);
+								}
+							}
+
+							bezt->radius += median[5];
 						}
 						else {
-							if(bezt->f1 & SELECT) {
+							if (bezt->f1 & SELECT) {
 								add_v3_v3(bezt->vec[0], median);
 							}
-							if(bezt->f3 & SELECT) {
+							if (bezt->f3 & SELECT) {
 								add_v3_v3(bezt->vec[2], median);
 							}
 						}
@@ -552,14 +548,25 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
 					}
 				}
 				else {
-					bp= nu->bp;
-					a= nu->pntsu*nu->pntsv;
-					while(a--) {
-						if(bp->f1 & SELECT) {
+					bp = nu->bp;
+					a = nu->pntsu * nu->pntsv;
+					while (a--) {
+						if (bp->f1 & SELECT) {
 							add_v3_v3(bp->vec, median);
-							bp->vec[3]+= median[3];
-							bp->weight+= median[4];
-							bp->radius+= median[5];
+							bp->vec[3] += median[3];
+
+							if (median[4] != 0.0f) {
+								if (ELEM(scale_w, 0.0f, 1.0f)) {
+									bp->weight = scale_w;
+								}
+								else {
+									bp->weight = scale_w > 0.0f ? bp->weight * scale_w :
+									                              1.0f + ((1.0f - bp->weight) * scale_w);
+									CLAMP(bp->weight, 0.0f, 1.0f);
+								}
+							}
+
+							bp->radius += median[5];
 						}
 						bp++;
 					}
@@ -567,26 +574,37 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
 				test2DNurb(nu);
 				testhandlesNurb(nu); /* test for bezier too */
 
-				nu= nu->next;
+				nu = nu->next;
 			}
 		}
-		else if(ob->type==OB_LATTICE) {
-			Lattice *lt= ob->data;
+		else if (ob->type == OB_LATTICE) {
+			Lattice *lt = ob->data;
 			BPoint *bp;
 			int a;
-			
-			a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
-			bp= lt->editlatt->latt->def;
-			while(a--) {
-				if(bp->f1 & SELECT) {
+			const float scale_w = compute_scale_factor(ve_median[4], median[4]);
+
+			a = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw;
+			bp = lt->editlatt->latt->def;
+			while (a--) {
+				if (bp->f1 & SELECT) {
 					add_v3_v3(bp->vec, median);
-					bp->weight+= median[4];
+
+					if (median[4] != 0.0f) {
+						if (ELEM(scale_w, 0.0f, 1.0f)) {
+							bp->weight = scale_w;
+						}
+						else {
+							bp->weight = scale_w > 0.0f ? bp->weight * scale_w :
+							                              1.0f + ((1.0f - bp->weight) * scale_w);
+							CLAMP(bp->weight, 0.0f, 1.0f);
+						}
+					}
 				}
 				bp++;
 			}
 		}
-		
-//		ED_undo_push(C, "Transform properties");
+
+/*		ED_undo_push(C, "Transform properties"); */
 	}
 }
 #define B_VGRP_PNL_COPY 1
@@ -594,50 +612,48 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
 #define B_VGRP_PNL_EDIT_SINGLE 8 /* or greater */
 #define B_VGRP_PNL_COPY_SINGLE 16384 /* or greater */
 
-static void act_vert_def(Object *ob, EditVert **eve, MDeformVert **dvert)
+static void act_vert_def(Object *ob, BMVert **eve, MDeformVert **dvert)
 {
-	if(ob && ob->mode & OB_MODE_EDIT && ob->type==OB_MESH && ob->defbase.first) {
-		Mesh *me= ob->data;
-		EditMesh *em = BKE_mesh_get_editmesh(me);
-		EditSelection *ese = ((EditSelection*)em->selected.last);
-
-		if(ese && ese->type == EDITVERT) {
-			*eve= (EditVert*)ese->data;
-			*dvert= CustomData_em_get(&em->vdata, (*eve)->data, CD_MDEFORMVERT);
+	if (ob && ob->mode & OB_MODE_EDIT && ob->type == OB_MESH && ob->defbase.first) {
+		Mesh *me = ob->data;
+		BMEditMesh *em = me->edit_btmesh;
+		BMEditSelection *ese = (BMEditSelection *)em->bm->selected.last;
+
+		if (ese && ese->htype == BM_VERT) {
+			*eve = (BMVert *)ese->ele;
+			*dvert = CustomData_bmesh_get(&em->bm->vdata, (*eve)->head.data, CD_MDEFORMVERT);
 			return;
 		}
-
-		BKE_mesh_end_editmesh(me, em);
 	}
 
-	*eve= NULL;
-	*dvert= NULL;
+	*eve = NULL;
+	*dvert = NULL;
 }
 
-static void editvert_mirror_update(Object *ob, EditVert *eve, int def_nr, int index)
+static void editvert_mirror_update(Object *ob, BMVert *eve, int def_nr, int index)
 {
-	Mesh *me= ob->data;
-	EditMesh *em = BKE_mesh_get_editmesh(me);
-	EditVert *eve_mirr;
+	Mesh *me = ob->data;
+	BMEditMesh *em = me->edit_btmesh;
+	BMVert *eve_mirr;
 
-	eve_mirr= editmesh_get_x_mirror_vert(ob, em, eve, eve->co, index);
+	eve_mirr = editbmesh_get_x_mirror_vert(ob, em, eve, eve->co, index);
 
-	if(eve_mirr && eve_mirr != eve) {
-		MDeformVert *dvert_src= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
-		MDeformVert *dvert_dst= CustomData_em_get(&em->vdata, eve_mirr->data, CD_MDEFORMVERT);
-		if(dvert_dst) {
-			if(def_nr == -1) {
+	if (eve_mirr && eve_mirr != eve) {
+		MDeformVert *dvert_src = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
+		MDeformVert *dvert_dst = CustomData_bmesh_get(&em->bm->vdata, eve_mirr->head.data, CD_MDEFORMVERT);
+		if (dvert_dst) {
+			if (def_nr == -1) {
 				/* all vgroups, add groups where neded  */
 				int flip_map_len;
-				int *flip_map= defgroup_flip_map(ob, &flip_map_len, TRUE);
+				int *flip_map = defgroup_flip_map(ob, &flip_map_len, TRUE);
 				defvert_sync_mapped(dvert_dst, dvert_src, flip_map, flip_map_len, TRUE);
 				MEM_freeN(flip_map);
 			}
 			else {
 				/* single vgroup */
-				MDeformWeight *dw= defvert_verify_index(dvert_dst, defgroup_flip_index(ob, def_nr, 1));
-				if(dw) {
-					dw->weight= defvert_find_weight(dvert_src, def_nr);
+				MDeformWeight *dw = defvert_verify_index(dvert_dst, defgroup_flip_index(ob, def_nr, 1));
+				if (dw) {
+					dw->weight = defvert_find_weight(dvert_src, def_nr);
 				}
 			}
 		}
@@ -646,86 +662,89 @@ static void editvert_mirror_update(Object *ob, EditVert *eve, int def_nr, int in
 
 static void vgroup_adjust_active(Object *ob, int def_nr)
 {
-	EditVert *eve_act;
+	BMVert *eve_act;
 	MDeformVert *dvert_act;
 
 	act_vert_def(ob, &eve_act, &dvert_act);
 
-	if(dvert_act) {
-		if(((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_X)
+	if (dvert_act) {
+		if (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_X)
 			editvert_mirror_update(ob, eve_act, def_nr, -1);
 	}
 }
 
 static void vgroup_copy_active_to_sel(Object *ob)
 {
-	EditVert *eve_act;
+	BMVert *eve_act;
 	MDeformVert *dvert_act;
 
 	act_vert_def(ob, &eve_act, &dvert_act);
 
-	if(dvert_act==NULL) {
+	if (dvert_act == NULL) {
 		return;
 	}
 	else {
-		Mesh *me= ob->data;
-		EditMesh *em = BKE_mesh_get_editmesh(me);
-		EditVert *eve;
+		Mesh *me = ob->data;
+		BMEditMesh *em = me->edit_btmesh;
+		BMIter iter;
+		BMVert *eve;
 		MDeformVert *dvert;
-		int index= 0;
+		int index = 0;
 
-		for(eve= em->verts.first; eve; eve= eve->next, index++) {
-			if(eve->f & SELECT && eve != eve_act) {
-				dvert= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
-				if(dvert) {
+		BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+			if (BM_elem_flag_test(eve, BM_ELEM_SELECT) && eve != eve_act) {
+				dvert = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
+				if (dvert) {
 					defvert_copy(dvert, dvert_act);
 
-					if(me->editflag & ME_EDIT_MIRROR_X)
+					if (me->editflag & ME_EDIT_MIRROR_X)
 						editvert_mirror_update(ob, eve, -1, index);
 
 				}
 			}
+
+			index++;
 		}
 	}
 }
 
 static void vgroup_copy_active_to_sel_single(Object *ob, const int def_nr)
 {
-	EditVert *eve_act;
+	BMVert *eve_act;
 	MDeformVert *dv_act;
 
 	act_vert_def(ob, &eve_act, &dv_act);
 
-	if(dv_act==NULL) {
+	if (dv_act == NULL) {
 		return;
 	}
 	else {
-		Mesh *me= ob->data;
-		EditMesh *em = BKE_mesh_get_editmesh(me);
-		EditVert *eve;
+		Mesh *me = ob->data;
+		BMEditMesh *em = me->edit_btmesh;
+		BMIter iter;
+		BMVert *eve;
 		MDeformVert *dv;
 		MDeformWeight *dw;
 		float weight_act;
-		int index= 0;
+		int index = 0;
 
-		dw= defvert_find_index(dv_act, def_nr);
+		dw = defvert_find_index(dv_act, def_nr);
 
-		if(dw == NULL)
+		if (dw == NULL)
 			return;
 
-		weight_act= dw->weight;
+		weight_act = dw->weight;
 
-		for (eve= em->verts.first; eve; eve= eve->next, index++) {
-			if (eve->f & SELECT && eve != eve_act) {
-				dv= CustomData_em_get(&em->vdata, eve->data, CD_MDEFORMVERT);
-				if(dv) {
-					dw= defvert_find_index(dv, def_nr);
-					if (dw) {
-						dw->weight= weight_act;
+		eve = BM_iter_new(&iter, em->bm, BM_VERTS_OF_MESH, NULL);
+		for (index = 0; eve; eve = BM_iter_step(&iter), index++) {
+			if (BM_elem_flag_test(eve, BM_ELEM_SELECT) && eve != eve_act) {
+				dv = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
+				dw = defvert_find_index(dv, def_nr);
+				if (dw) {
+					dw->weight = weight_act;
 
-						if (me->editflag & ME_EDIT_MIRROR_X) {
-							editvert_mirror_update(ob, eve, -1, index);
-						}
+					if (me->editflag & ME_EDIT_MIRROR_X) {
+						editvert_mirror_update(ob, eve, -1, index);
 					}
 				}
 			}
@@ -739,55 +758,54 @@ static void vgroup_copy_active_to_sel_single(Object *ob, const int def_nr)
 
 static void vgroup_normalize_active(Object *ob)
 {
-	EditVert *eve_act;
+	BMVert *eve_act;
 	MDeformVert *dvert_act;
 
 	act_vert_def(ob, &eve_act, &dvert_act);
 
-	if(dvert_act==NULL)
+	if (dvert_act == NULL)
 		return;
 
 	defvert_normalize(dvert_act);
 
-	if(((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_X)
+	if (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_X)
 		editvert_mirror_update(ob, eve_act, -1, -1);
-
-
-
 }
 
 static void do_view3d_vgroup_buttons(bContext *C, void *UNUSED(arg), int event)
 {
-	Scene *scene= CTX_data_scene(C);
-	Object *ob= OBACT;
+	Scene *scene = CTX_data_scene(C);
+	Object *ob = OBACT;
 
-	if(event==B_VGRP_PNL_NORMALIZE) {
+	/* XXX TODO Use operators? */
+	if (event == B_VGRP_PNL_NORMALIZE) {
 		vgroup_normalize_active(ob);
 	}
-	else if(event == B_VGRP_PNL_COPY) {
+	else if (event == B_VGRP_PNL_COPY) {
 		vgroup_copy_active_to_sel(ob);
 	}
-	else if(event >= B_VGRP_PNL_COPY_SINGLE) {
+	else if (event >= B_VGRP_PNL_COPY_SINGLE) {
 		vgroup_copy_active_to_sel_single(ob, event - B_VGRP_PNL_COPY_SINGLE);
 	}
-	else if(event >= B_VGRP_PNL_EDIT_SINGLE) {
+	else if (event >= B_VGRP_PNL_EDIT_SINGLE) {
 		vgroup_adjust_active(ob, event - B_VGRP_PNL_EDIT_SINGLE);
 	}
 
-//  todo
-//	if(((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_X)
-//		ED_vgroup_mirror(ob, 1, 1, 0);
+#if 0 /* TODO */
+	if (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_X)
+		ED_vgroup_mirror(ob, 1, 1, 0);
+#endif
 
 	/* default for now */
 	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_DATA, ob->data);
 }
 
 static int view3d_panel_vgroup_poll(const bContext *C, PanelType *UNUSED(pt))
 {
-	Scene *scene= CTX_data_scene(C);
-	Object *ob= OBACT;
-	EditVert *eve_act;
+	Scene *scene = CTX_data_scene(C);
+	Object *ob = OBACT;
+	BMVert *eve_act;
 	MDeformVert *dvert_act;
 
 	act_vert_def(ob, &eve_act, &dvert_act);
@@ -798,16 +816,16 @@ static int view3d_panel_vgroup_poll(const bContext *C, PanelType *UNUSED(pt))
 
 static void view3d_panel_vgroup(const bContext *C, Panel *pa)
 {
-	uiBlock *block= uiLayoutAbsoluteBlock(pa->layout);
-	Scene *scene= CTX_data_scene(C);
-	Object *ob= OBACT;
+	uiBlock *block = uiLayoutAbsoluteBlock(pa->layout);
+	Scene *scene = CTX_data_scene(C);
+	Object *ob = OBACT;
 
-	EditVert *eve;
+	BMVert *eve;
 	MDeformVert *dv;
 
 	act_vert_def(ob, &eve, &dv);
 
-	if(dv && dv->totweight) {
+	if (dv && dv->totweight) {
 		uiLayout *col;
 		bDeformGroup *dg;
 		MDeformWeight *dw = dv->dw;
@@ -816,25 +834,29 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa)
 
 		uiBlockSetHandleFunc(block, do_view3d_vgroup_buttons, NULL);
 
-		col= uiLayoutColumn(pa->layout, 0);
-		block= uiLayoutAbsoluteBlock(col);
+		col = uiLayoutColumn(pa->layout, 0);
+		block = uiLayoutAbsoluteBlock(col);
 
 		uiBlockBeginAlign(block);
 
-		for (i= dv->totweight; i != 0; i--, dw++) {
-			dg = BLI_findlink (&ob->defbase, dw->def_nr);
-			if(dg) {
-				uiDefButF(block, NUM, B_VGRP_PNL_EDIT_SINGLE + dw->def_nr, dg->name,	0, yco, 180, 20, &dw->weight, 0.0, 1.0, 1, 3, "");
-				uiDefBut(block, BUT, B_VGRP_PNL_COPY_SINGLE + dw->def_nr, "C", 180,yco,20,20, NULL, 0, 0, 0, 0, "Copy this groups weight to other selected verts");
+		for (i = dv->totweight; i != 0; i--, dw++) {
+			dg = BLI_findlink(&ob->defbase, dw->def_nr);
+			if (dg) {
+				uiDefButF(block, NUM, B_VGRP_PNL_EDIT_SINGLE + dw->def_nr, dg->name, 0, yco, 180, 20,
+				          &dw->weight, 0.0, 1.0, 1, 3, "");
+				uiDefBut(block, BUT, B_VGRP_PNL_COPY_SINGLE + dw->def_nr, "C", 180, yco, 20, 20,
+				         NULL, 0, 0, 0, 0, TIP_("Copy this group's weight to other selected verts"));
 				yco -= 20;
 			}
 		}
-		yco-=2;
+		yco -= 2;
 
 		uiBlockEndAlign(block);
 		uiBlockBeginAlign(block);
-		uiDefBut(block, BUT, B_VGRP_PNL_NORMALIZE, "Normalize", 0, yco,100,20, NULL, 0, 0, 0, 0, "Normalize active vertex weights");
-		uiDefBut(block, BUT, B_VGRP_PNL_COPY, "Copy", 100,yco,100,20, NULL, 0, 0, 0, 0, "Copy active vertex to other seleted verts");
+		uiDefBut(block, BUT, B_VGRP_PNL_NORMALIZE, IFACE_("Normalize"), 0, yco, 100, 20,
+		         NULL, 0, 0, 0, 0, TIP_("Normalize active vertex weights"));
+		uiDefBut(block, BUT, B_VGRP_PNL_COPY, IFACE_("Copy"), 100, yco, 100, 20,
+		         NULL, 0, 0, 0, 0, TIP_("Copy active vertex to other seleted verts"));
 		uiBlockEndAlign(block);
 	}
 }
@@ -842,549 +864,273 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa)
 static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr)
 {
 	uiLayout *split, *colsub;
-	
+
 	split = uiLayoutSplit(layout, 0.8, 0);
-	
+
 	if (ptr->type == &RNA_PoseBone) {
 		PointerRNA boneptr;
 		Bone *bone;
-		
+
 		boneptr = RNA_pointer_get(ptr, "bone");
 		bone = boneptr.data;
 		uiLayoutSetActive(split, !(bone->parent && bone->flag & BONE_CONNECTED));
 	}
 	colsub = uiLayoutColumn(split, 1);
-	uiItemR(colsub, ptr, "location", 0, "Location", ICON_NONE);
+	uiItemR(colsub, ptr, "location", 0, NULL, ICON_NONE);
 	colsub = uiLayoutColumn(split, 1);
 	uiItemL(colsub, "", ICON_NONE);
-	uiItemR(colsub, ptr, "lock_location", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
-	
+	uiItemR(colsub, ptr, "lock_location", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
+
 	split = uiLayoutSplit(layout, 0.8, 0);
-	
-	switch(RNA_enum_get(ptr, "rotation_mode")) {
+
+	switch (RNA_enum_get(ptr, "rotation_mode")) {
 		case ROT_MODE_QUAT: /* quaternion */
 			colsub = uiLayoutColumn(split, 1);
-			uiItemR(colsub, ptr, "rotation_quaternion", 0, "Rotation", ICON_NONE);
+			uiItemR(colsub, ptr, "rotation_quaternion", 0, IFACE_("Rotation"), ICON_NONE);
 			colsub = uiLayoutColumn(split, 1);
-			uiItemR(colsub, ptr, "lock_rotations_4d", UI_ITEM_R_TOGGLE, "4L", ICON_NONE);
+			uiItemR(colsub, ptr, "lock_rotations_4d", UI_ITEM_R_TOGGLE, IFACE_("4L"), ICON_NONE);
 			if (RNA_boolean_get(ptr, "lock_rotations_4d"))
-				uiItemR(colsub, ptr, "lock_rotation_w", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
+				uiItemR(colsub, ptr, "lock_rotation_w", UI_ITEM_R_TOGGLE + UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
 			else
 				uiItemL(colsub, "", ICON_NONE);
-			uiItemR(colsub, ptr, "lock_rotation", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
+			uiItemR(colsub, ptr, "lock_rotation", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
 			break;
 		case ROT_MODE_AXISANGLE: /* axis angle */
 			colsub = uiLayoutColumn(split, 1);
-			uiItemR(colsub, ptr, "rotation_axis_angle", 0, "Rotation", ICON_NONE);
+			uiItemR(colsub, ptr, "rotation_axis_angle", 0, IFACE_("Rotation"), ICON_NONE);
 			colsub = uiLayoutColumn(split, 1);
-			uiItemR(colsub, ptr, "lock_rotations_4d", UI_ITEM_R_TOGGLE, "4L", ICON_NONE);
+			uiItemR(colsub, ptr, "lock_rotations_4d", UI_ITEM_R_TOGGLE, IFACE_("4L"), ICON_NONE);
 			if (RNA_boolean_get(ptr, "lock_rotations_4d"))
-				uiItemR(colsub, ptr, "lock_rotation_w", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
+				uiItemR(colsub, ptr, "lock_rotation_w", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
 			else
 				uiItemL(colsub, "", ICON_NONE);
-			uiItemR(colsub, ptr, "lock_rotation", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
+			uiItemR(colsub, ptr, "lock_rotation", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
 			break;
 		default: /* euler rotations */
 			colsub = uiLayoutColumn(split, 1);
-			uiItemR(colsub, ptr, "rotation_euler", 0, "Rotation", ICON_NONE);
+			uiItemR(colsub, ptr, "rotation_euler", 0, IFACE_("Rotation"), ICON_NONE);
 			colsub = uiLayoutColumn(split, 1);
 			uiItemL(colsub, "", ICON_NONE);
-			uiItemR(colsub, ptr, "lock_rotation", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
+			uiItemR(colsub, ptr, "lock_rotation", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
 			break;
 	}
 	uiItemR(layout, ptr, "rotation_mode", 0, "", ICON_NONE);
-	
+
 	split = uiLayoutSplit(layout, 0.8, 0);
 	colsub = uiLayoutColumn(split, 1);
-	uiItemR(colsub, ptr, "scale", 0, "Scale", ICON_NONE);
+	uiItemR(colsub, ptr, "scale", 0, NULL, ICON_NONE);
 	colsub = uiLayoutColumn(split, 1);
 	uiItemL(colsub, "", ICON_NONE);
-	uiItemR(colsub, ptr, "lock_scale", UI_ITEM_R_TOGGLE+UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
-	
+	uiItemR(colsub, ptr, "lock_scale", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
+
 	if (ptr->type == &RNA_Object) {
 		Object *ob = ptr->data;
 		/* dimensions and material support just happen to be the same checks
 		 * later we may want to add dimensions for lattice, armature etc too */
 		if (OB_TYPE_SUPPORT_MATERIAL(ob->type)) {
-			uiItemR(layout, ptr, "dimensions", 0, "Dimensions", ICON_NONE);
+			uiItemR(layout, ptr, "dimensions", 0, NULL, ICON_NONE);
 		}
 	}
 }
 
 static void v3d_posearmature_buts(uiLayout *layout, Object *ob)
 {
-//	uiBlock *block= uiLayoutGetBlock(layout);
-//	bArmature *arm;
 	bPoseChannel *pchan;
-//	TransformProperties *tfp= v3d->properties_storage;
 	PointerRNA pchanptr;
 	uiLayout *col;
-//	uiLayout *row;
-//	uiBut *but;
 
-	pchan= get_active_posechannel(ob);
+	pchan = get_active_posechannel(ob);
 
-//	row= uiLayoutRow(layout, 0);
-	
-	if (!pchan)	{
-		uiItemL(layout, "No Bone Active", ICON_NONE);
-		return; 
+	if (!pchan) {
+		uiItemL(layout, IFACE_("No Bone Active"), ICON_NONE);
+		return;
 	}
 
 	RNA_pointer_create(&ob->id, &RNA_PoseBone, pchan, &pchanptr);
 
-	col= uiLayoutColumn(layout, 0);
-	
+	col = uiLayoutColumn(layout, 0);
+
 	/* XXX: RNA buts show data in native types (i.e. quats, 4-component axis/angle, etc.)
-	 * but oldskool UI shows in eulers always. Do we want to be able to still display in Eulers?
+	 * but old-school UI shows in eulers always. Do we want to be able to still display in Eulers?
 	 * Maybe needs RNA/ui options to display rotations as different types... */
 	v3d_transform_butsR(col, &pchanptr);
-
-#if 0
-	uiLayoutAbsoluteBlock(layout);
-
-	if (pchan->rotmode == ROT_MODE_AXISANGLE) {
-		float quat[4];
-		/* convert to euler, passing through quats... */
-		axis_angle_to_quat(quat, pchan->rotAxis, pchan->rotAngle);
-		quat_to_eul( tfp->ob_eul,quat);
-	}
-	else if (pchan->rotmode == ROT_MODE_QUAT)
-		quat_to_eul( tfp->ob_eul,pchan->quat);
-	else
-		copy_v3_v3(tfp->ob_eul, pchan->eul);
-	tfp->ob_eul[0]*= RAD2DEGF(1.0f);
-	tfp->ob_eul[1]*= RAD2DEGF(1.0f);
-	tfp->ob_eul[2]*= RAD2DEGF(1.0f);
-	
-	uiDefBut(block, LABEL, 0, "Location:",			0, 240, 100, 20, 0, 0, 0, 0, 0, "");
-	uiBlockBeginAlign(block);
-	
-	but= uiDefButF(block, NUM, B_ARMATUREPANEL2, "X:",	0, 220, 120, 19, pchan->loc, -lim, lim, 100, 3, "");
-	uiButSetUnitType(but, PROP_UNIT_LENGTH);
-	but= uiDefButF(block, NUM, B_ARMATUREPANEL2, "Y:",	0, 200, 120, 19, pchan->loc+1, -lim, lim, 100, 3, "");
-	uiButSetUnitType(but, PROP_UNIT_LENGTH);
-	but= uiDefButF(block, NUM, B_ARMATUREPANEL2, "Z:",	0, 180, 120, 19, pchan->loc+2, -lim, lim, 100, 3, "");
-	uiButSetUnitType(but, PROP_UNIT_LENGTH);
-	uiBlockEndAlign(block);
-	
-	uiBlockBeginAlign(block);
-	uiDefIconButBitS(block, ICONTOG, OB_LOCK_LOCX, B_REDR, ICON_UNLOCKED,	125, 220, 25, 19, &(pchan->protectflag), 0, 0, 0, 0, "Protects X Location value from being Transformed");
-	uiDefIconButBitS(block, ICONTOG, OB_LOCK_LOCY, B_REDR, ICON_UNLOCKED,	125, 200, 25, 19, &(pchan->protectflag), 0, 0, 0, 0, "Protects Y Location value from being Transformed");
-	uiDefIconButBitS(block, ICONTOG, OB_LOCK_LOCZ, B_REDR, ICON_UNLOCKED,	125, 180, 25, 19, &(pchan->protectflag), 0, 0, 0, 0, "Protects Z Location value from being Transformed");
-	uiBlockEndAlign(block);
-	
-	uiDefBut(block, LABEL, 0, "Rotation:",			0, 160, 100, 20, 0, 0, 0, 0, 0, "");
-	uiBlockBeginAlign(block);
-	uiDefButF(block, NUM, B_ARMATUREPANEL3, "X:",	0, 140, 120, 19, tfp->ob_eul, -1000.0, 1000.0, 100, 3, "");
-	uiDefButF(block, NUM, B_ARMATUREPANEL3, "Y:",	0, 120, 120, 19, tfp->ob_eul+1, -1000.0, 1000.0, 100, 3, "");
-	uiDefButF(block, NUM, B_ARMATUREPANEL3, "Z:",	0, 100, 120, 19, tfp->ob_eul+2, -1000.0, 1000.0, 100, 3, "");
-	uiBlockEndAlign(block);
-	
-	uiBlockBeginAlign(block);
-	uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTX, B_REDR, ICON_UNLOCKED,	125, 140, 25, 19, &(pchan->protectflag), 0, 0, 0, 0, "Protects X Rotation value from being Transformed");
-	uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTY, B_REDR, ICON_UNLOCKED,	125, 120, 25, 19, &(pchan->protectflag), 0, 0, 0, 0, "Protects Y Rotation value from being Transformed");
-	uiDefIconButBitS(block, ICONTOG, OB_LOCK_ROTZ, B_REDR, ICON_UNLOCKED,	125, 100, 25, 19, &(pchan->protectflag), 0, 0, 0, 0, "Protects Z Rotation value from being Transformed");
-	uiBlockEndAlign(block);
-	
-	uiDefBut(block, LABEL, 0, "Scale:",				0, 80, 100, 20, 0, 0, 0, 0, 0, "");
-	uiBlockBeginAlign(block);
-	uiDefButF(block, NUM, B_ARMATUREPANEL2, "X:",	0, 60, 120, 19, pchan->size, -lim, lim, 10, 3, "");
-	uiDefButF(block, NUM, B_ARMATUREPANEL2, "Y:",	0, 40, 120, 19, pchan->size+1, -lim, lim, 10, 3, "");
-	uiDefButF(block, NUM, B_ARMATUREPANEL2, "Z:",	0, 20, 120, 19, pchan->size+2, -lim, lim, 10, 3, "");
-	uiBlockEndAlign(block);
-	
-	uiBlockBeginAlign(block);
-	uiDefIconButBitS(block, ICONTOG, OB_LOCK_SCALEX, B_REDR, ICON_UNLOCKED,	125, 60, 25, 19, &(pchan->protectflag), 0, 0, 0, 0, "Protects X Scale value from being Transformed");
-	uiDefIconButBitS(block, ICONTOG, OB_LOCK_SCALEY, B_REDR, ICON_UNLOCKED,	125, 40, 25, 19, &(pchan->protectflag), 0, 0, 0, 0, "Protects Y Scale value from being Transformed");
-	uiDefIconButBitS(block, ICONTOG, OB_LOCK_SCALEZ, B_REDR, ICON_UNLOCKED,	125, 20, 25, 19, &(pchan->protectflag), 0, 0, 0, 0, "Protects z Scale value from being Transformed");
-	uiBlockEndAlign(block);
-#endif
-}
-
-/* assumes armature editmode */
-#if 0
-static void validate_editbonebutton_cb(bContext *C, void *bonev, void *namev)
-{
-	EditBone *eBone= bonev;
-	char oldname[sizeof(eBone->name)], newname[sizeof(eBone->name)];
-
-	/* need to be on the stack */
-	BLI_strncpy(newname, eBone->name, sizeof(eBone->name));
-	BLI_strncpy(oldname, (char *)namev, sizeof(eBone->name));
-	/* restore */
-	BLI_strncpy(eBone->name, oldname, sizeof(eBone->name));
-
-	ED_armature_bone_rename(CTX_data_edit_object(C)->data, oldname, newname); // editarmature.c
-	WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, CTX_data_edit_object(C)); // XXX fix
 }
-#endif
 
 static void v3d_editarmature_buts(uiLayout *layout, Object *ob)
 {
-//	uiBlock *block= uiLayoutGetBlock(layout);
-	bArmature *arm= ob->data;
+	bArmature *arm = ob->data;
 	EditBone *ebone;
-//	TransformProperties *tfp= v3d->properties_storage;
-//	uiLayout *row;
 	uiLayout *col;
 	PointerRNA eboneptr;
-	
-	ebone= arm->act_edbone;
 
-	if (!ebone || (ebone->layer & arm->layer)==0) {
-		uiItemL(layout, "Nothing selected", ICON_NONE);
+	ebone = arm->act_edbone;
+
+	if (!ebone || (ebone->layer & arm->layer) == 0) {
+		uiItemL(layout, IFACE_("Nothing selected"), ICON_NONE);
 		return;
 	}
-//	row= uiLayoutRow(layout, 0);
+
 	RNA_pointer_create(&arm->id, &RNA_EditBone, ebone, &eboneptr);
 
-	col= uiLayoutColumn(layout, 0);
-	uiItemR(col, &eboneptr, "head", 0, "Head", ICON_NONE);
-	if (ebone->parent && ebone->flag & BONE_CONNECTED ) {
+	col = uiLayoutColumn(layout, 0);
+	uiItemR(col, &eboneptr, "head", 0, NULL, ICON_NONE);
+	if (ebone->parent && ebone->flag & BONE_CONNECTED) {
 		PointerRNA parptr = RNA_pointer_get(&eboneptr, "parent");
-		uiItemR(col, &parptr, "tail_radius", 0, "Radius (Parent)", ICON_NONE);
-	} else {
-		uiItemR(col, &eboneptr, "head_radius", 0, "Radius", ICON_NONE);
+		uiItemR(col, &parptr, "tail_radius", 0, IFACE_("Radius (Parent)"), ICON_NONE);
 	}
-	
-	uiItemR(col, &eboneptr, "tail", 0, "Tail", ICON_NONE);
-	uiItemR(col, &eboneptr, "tail_radius", 0, "Radius", ICON_NONE);
-	
-	uiItemR(col, &eboneptr, "roll", 0, "Roll", ICON_NONE);
-	uiItemR(col, &eboneptr, "envelope_distance", 0, "Envelope", ICON_NONE);
+	else {
+		uiItemR(col, &eboneptr, "head_radius", 0, IFACE_("Radius"), ICON_NONE);
+	}
+
+	uiItemR(col, &eboneptr, "tail", 0, NULL, ICON_NONE);
+	uiItemR(col, &eboneptr, "tail_radius", 0, IFACE_("Radius"), ICON_NONE);
+
+	uiItemR(col, &eboneptr, "roll", 0, NULL, ICON_NONE);
+	uiItemR(col, &eboneptr, "envelope_distance", 0, IFACE_("Envelope"), ICON_NONE);
 }
 
 static void v3d_editmetaball_buts(uiLayout *layout, Object *ob)
 {
 	PointerRNA mbptr, ptr;
-	MetaBall *mball= ob->data;
-//	uiLayout *row;
+	MetaBall *mball = ob->data;
 	uiLayout *col;
-	
-	if (!mball || !(mball->lastelem)) return;
-	
+
+	if (!mball || !(mball->lastelem))
+		return;
+
 	RNA_pointer_create(&mball->id, &RNA_MetaBall, mball, &mbptr);
-	
-//	row= uiLayoutRow(layout, 0);
 
 	RNA_pointer_create(&mball->id, &RNA_MetaElement, mball->lastelem, &ptr);
-	
-	col= uiLayoutColumn(layout, 0);
-	uiItemR(col, &ptr, "co", 0, "Location", ICON_NONE);
-	
-	uiItemR(col, &ptr, "radius", 0, "Radius", ICON_NONE);
-	uiItemR(col, &ptr, "stiffness", 0, "Stiffness", ICON_NONE);
-	
-	uiItemR(col, &ptr, "type", 0, "Type", ICON_NONE);
-	
-	col= uiLayoutColumn(layout, 1);
+
+	col = uiLayoutColumn(layout, 0);
+	uiItemR(col, &ptr, "co", 0, NULL, ICON_NONE);
+
+	uiItemR(col, &ptr, "radius", 0, NULL, ICON_NONE);
+	uiItemR(col, &ptr, "stiffness", 0, NULL, ICON_NONE);
+
+	uiItemR(col, &ptr, "type", 0, NULL, ICON_NONE);
+
+	col = uiLayoutColumn(layout, 1);
 	switch (RNA_enum_get(&ptr, "type")) {
 		case MB_BALL:
 			break;
 		case MB_CUBE:
-			uiItemL(col, "Size:", ICON_NONE);
+			uiItemL(col, IFACE_("Size:"), ICON_NONE);
 			uiItemR(col, &ptr, "size_x", 0, "X", ICON_NONE);
 			uiItemR(col, &ptr, "size_y", 0, "Y", ICON_NONE);
 			uiItemR(col, &ptr, "size_z", 0, "Z", ICON_NONE);
 			break;
 		case MB_TUBE:
-			uiItemL(col, "Size:", ICON_NONE);
+			uiItemL(col, IFACE_("Size:"), ICON_NONE);
 			uiItemR(col, &ptr, "size_x", 0, "X", ICON_NONE);
 			break;
 		case MB_PLANE:
-			uiItemL(col, "Size:", ICON_NONE);
+			uiItemL(col, IFACE_("Size:"), ICON_NONE);
 			uiItemR(col, &ptr, "size_x", 0, "X", ICON_NONE);
 			uiItemR(col, &ptr, "size_y", 0, "Y", ICON_NONE);
 			break;
 		case MB_ELIPSOID:
-			uiItemL(col, "Size:", ICON_NONE);
+			uiItemL(col, IFACE_("Size:"), ICON_NONE);
 			uiItemR(col, &ptr, "size_x", 0, "X", ICON_NONE);
 			uiItemR(col, &ptr, "size_y", 0, "Y", ICON_NONE);
 			uiItemR(col, &ptr, "size_z", 0, "Z", ICON_NONE);
-			break;		   
-	}	
+			break;
+	}
 }
 
 static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event)
 {
-	Main *bmain= CTX_data_main(C);
-	Scene *scene= CTX_data_scene(C);
-//	Object *obedit= CTX_data_edit_object(C);
-	View3D *v3d= CTX_wm_view3d(C);
-//	BoundBox *bb;
-	Object *ob= OBACT;
-	TransformProperties *tfp= v3d->properties_storage;
-	
-	switch(event) {
-	
-	case B_REDR:
-		ED_area_tag_redraw(CTX_wm_area(C));
-		return; /* no notifier! */
-		
-	case B_OBJECTPANEL:
-		DAG_id_tag_update(&ob->id, OB_RECALC_OB);
-		break;
-
-	
-	case B_OBJECTPANELMEDIAN:
-		if(ob) {
-			v3d_editvertex_buts(NULL, v3d, ob, 1.0);
-			DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
-		}
-		break;
-		
-		/* note; this case also used for parbone */
-	case B_OBJECTPANELPARENT:
-		if(ob) {
-			if (ob->id.lib || BKE_object_parent_loop_check(ob->parent, ob))
-				ob->parent= NULL;
-			else {
-				DAG_scene_sort(bmain, scene);
-				DAG_id_tag_update(&ob->id, OB_RECALC_OB);
-			}
-		}
-		break;
-		
-
-	case B_ARMATUREPANEL3:  // rotate button on channel
-		{
-			bPoseChannel *pchan;
-			float eul[3];
-			
-			pchan= get_active_posechannel(ob);
-			if (!pchan) return;
-			
-			/* make a copy to eul[3], to allow TAB on buttons to work */
-			eul[0]= DEG2RADF(tfp->ob_eul[0]);
-			eul[1]= DEG2RADF(tfp->ob_eul[1]);
-			eul[2]= DEG2RADF(tfp->ob_eul[2]);
-			
-			if (pchan->rotmode == ROT_MODE_AXISANGLE) {
-				float quat[4];
-				/* convert to axis-angle, passing through quats  */
-				eul_to_quat( quat,eul);
-				quat_to_axis_angle( pchan->rotAxis, &pchan->rotAngle,quat);
-			}
-			else if (pchan->rotmode == ROT_MODE_QUAT)
-				eul_to_quat( pchan->quat,eul);
-			else
-				copy_v3_v3(pchan->eul, eul);
-		}
-		/* no break, pass on */
-	case B_ARMATUREPANEL2:
-		{
-			ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
-			DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
-		}
-		break;
-	case B_TRANSFORMSPACEADD:
-	{
-		char names[sizeof(((TransformOrientation *)NULL)->name)]= "";
-		BIF_createTransformOrientation(C, NULL, names, 1, 0);
-		break;
-	}
-	case B_TRANSFORMSPACECLEAR:
-		BIF_clearTransformOrientation(C);
-		break;
-		
-#if 0 // XXX
-	case B_WEIGHT0_0:
-		wpaint->weight = 0.0f;
-		break;
-		
-	case B_WEIGHT1_4:
-		wpaint->weight = 0.25f;
-		break;
-	case B_WEIGHT1_2:
-		wpaint->weight = 0.5f;
-		break;
-	case B_WEIGHT3_4:
-		wpaint->weight = 0.75f;
-		break;
-	case B_WEIGHT1_0:
-		wpaint->weight = 1.0f;
-		break;
-		
-	case B_OPA1_8:
-		wpaint->a = 0.125f;
-		break;
-	case B_OPA1_4:
-		wpaint->a = 0.25f;
-		break;
-	case B_OPA1_2:
-		wpaint->a = 0.5f;
-		break;
-	case B_OPA3_4:
-		wpaint->a = 0.75f;
-		break;
-	case B_OPA1_0:
-		wpaint->a = 1.0f;
-		break;
-#endif
-	case B_CLR_WPAINT:
-//		if(!multires_level1_test()) {
-		{
-			bDeformGroup *defGroup = BLI_findlink(&ob->defbase, ob->actdef-1);
-			if(defGroup) {
-				Mesh *me= ob->data;
-				int a;
-				for(a=0; a<me->totvert; a++)
-					ED_vgroup_vert_remove (ob, defGroup, a);
+	Scene *scene = CTX_data_scene(C);
+	View3D *v3d = CTX_wm_view3d(C);
+	Object *ob = OBACT;
+
+	switch (event) {
+
+		case B_REDR:
+			ED_area_tag_redraw(CTX_wm_area(C));
+			return; /* no notifier! */
+
+		case B_OBJECTPANELMEDIAN:
+			if (ob) {
+				v3d_editvertex_buts(NULL, v3d, ob, 1.0);
 				DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 			}
-		}
-		break;
-	case B_RV3D_LOCKED:
-	case B_RV3D_BOXVIEW:
-	case B_RV3D_BOXCLIP:
-		{
-			ScrArea *sa= CTX_wm_area(C);
-			ARegion *ar= sa->regionbase.last;
-			RegionView3D *rv3d;
-			short viewlock;
-			
-			ar= ar->prev;
-			rv3d= ar->regiondata;
-			viewlock= rv3d->viewlock;
-			
-			if((viewlock & RV3D_LOCKED)==0)
-				viewlock= 0;
-			else if((viewlock & RV3D_BOXVIEW)==0)
-				viewlock &= ~RV3D_BOXCLIP;
-			
-			for(; ar; ar= ar->prev) {
-				if(ar->alignment==RGN_ALIGN_QSPLIT) {
-					rv3d= ar->regiondata;
-					rv3d->viewlock= viewlock;
-				}
-			}
-			
-			if(rv3d->viewlock & RV3D_BOXVIEW)
-				view3d_boxview_copy(sa, sa->regionbase.last);
-			
-			ED_area_tag_redraw(sa);
-		}
-		break;
+			break;
 	}
 
 	/* default for now */
-	WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d);
+	WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
 }
 
 static void view3d_panel_object(const bContext *C, Panel *pa)
 {
 	uiBlock *block;
-	Scene *scene= CTX_data_scene(C);
-	Object *obedit= CTX_data_edit_object(C);
-	View3D *v3d= CTX_wm_view3d(C);
-	//uiBut *bt;
-	Object *ob= OBACT;
-	// TransformProperties *tfp; // UNUSED
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit = CTX_data_edit_object(C);
+	View3D *v3d = CTX_wm_view3d(C);
+	Object *ob = OBACT;
 	PointerRNA obptr;
-	uiLayout *col /* , *row */ /* UNUSED */;
+	uiLayout *col;
 	float lim;
-	
-	if(ob==NULL) return;
 
-	/* make sure we got storage */
-	/*
-	if(v3d->properties_storage==NULL)
-		v3d->properties_storage= MEM_callocN(sizeof(TransformProperties), "TransformProperties");
-	tfp= v3d->properties_storage;
-	
-// XXX	uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
-
-	if(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)) {
-	}
-	else {
-		if((ob->mode & OB_MODE_PARTICLE_EDIT)==0) {
-			uiBlockEndAlign(block);
-		}
-	}
-	*/
+	if (ob == NULL)
+		return;
 
-	lim= 10000.0f * MAX2(1.0f, v3d->grid);
+	lim = 10000.0f * MAX2(1.0f, v3d->grid);
 
-	block= uiLayoutGetBlock(pa->layout);
+	block = uiLayoutGetBlock(pa->layout);
 	uiBlockSetHandleFunc(block, do_view3d_region_buttons, NULL);
 
-	col= uiLayoutColumn(pa->layout, 0);
-	/* row= uiLayoutRow(col, 0); */ /* UNUSED */
+	col = uiLayoutColumn(pa->layout, 0);
+	/* row = uiLayoutRow(col, 0); */ /* UNUSED */
 	RNA_id_pointer_create(&ob->id, &obptr);
 
-	if(ob==obedit) {
-		if(ob->type==OB_ARMATURE) v3d_editarmature_buts(col, ob);
-		else if(ob->type==OB_MBALL) v3d_editmetaball_buts(col, ob);
-		else v3d_editvertex_buts(col, v3d, ob, lim);
+	if (ob == obedit) {
+		if (ob->type == OB_ARMATURE)
+			v3d_editarmature_buts(col, ob);
+		else if (ob->type == OB_MBALL)
+			v3d_editmetaball_buts(col, ob);
+		else
+			v3d_editvertex_buts(col, v3d, ob, lim);
 	}
-	else if(ob->mode & OB_MODE_POSE) {
+	else if (ob->mode & OB_MODE_POSE) {
 		v3d_posearmature_buts(col, ob);
 	}
 	else {
-
 		v3d_transform_butsR(col, &obptr);
 	}
 }
 
-#if 0
-static void view3d_panel_preview(bContext *C, ARegion *ar, short cntrl)	// VIEW3D_HANDLER_PREVIEW
-{
-	uiBlock *block;
-	View3D *v3d= sa->spacedata.first;
-	int ofsx, ofsy;
-	
-	block= uiBeginBlock(C, ar, __func__, UI_EMBOSS);
-	uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | UI_PNL_SCALE | cntrl);
-	uiSetPanelHandler(VIEW3D_HANDLER_PREVIEW);  // for close and esc
-	
-	ofsx= -150+(sa->winx/2)/v3d->blockscale;
-	ofsy= -100+(sa->winy/2)/v3d->blockscale;
-	if(uiNewPanel(C, ar, block, "Preview", "View3d", ofsx, ofsy, 300, 200)==0) return;
-
-	uiBlockSetDrawExtraFunc(block, BIF_view3d_previewdraw);
-	
-	if(scene->recalc & SCE_PRV_CHANGED) {
-		scene->recalc &= ~SCE_PRV_CHANGED;
-		//printf("found recalc\n");
-		BIF_view3d_previewrender_free(sa->spacedata.first);
-		BIF_preview_changed(0);
-	}
-}
-#endif
-
 void view3d_buttons_register(ARegionType *art)
 {
 	PanelType *pt;
 
-	pt= MEM_callocN(sizeof(PanelType), "spacetype view3d panel object");
+	pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel object");
 	strcpy(pt->idname, "VIEW3D_PT_object");
 	strcpy(pt->label, "Transform");
-	pt->draw= view3d_panel_object;
+	pt->draw = view3d_panel_object;
 	BLI_addtail(&art->paneltypes, pt);
-	
-	pt= MEM_callocN(sizeof(PanelType), "spacetype view3d panel gpencil");
+
+	pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel gpencil");
 	strcpy(pt->idname, "VIEW3D_PT_gpencil");
 	strcpy(pt->label, "Grease Pencil");
-	pt->draw= gpencil_panel_standard;
+	pt->draw = gpencil_panel_standard;
 	BLI_addtail(&art->paneltypes, pt);
 
-	pt= MEM_callocN(sizeof(PanelType), "spacetype view3d panel vgroup");
+	pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel vgroup");
 	strcpy(pt->idname, "VIEW3D_PT_vgroup");
 	strcpy(pt->label, "Vertex Groups");
-	pt->draw= view3d_panel_vgroup;
-	pt->poll= view3d_panel_vgroup_poll;
+	pt->draw = view3d_panel_vgroup;
+	pt->poll = view3d_panel_vgroup_poll;
 	BLI_addtail(&art->paneltypes, pt);
-
-	// XXX view3d_panel_preview(C, ar, 0);
 }
 
 static int view3d_properties(bContext *C, wmOperator *UNUSED(op))
 {
-	ScrArea *sa= CTX_wm_area(C);
-	ARegion *ar= view3d_has_buttons_region(sa);
-	
-	if(ar)
+	ScrArea *sa = CTX_wm_area(C);
+	ARegion *ar = view3d_has_buttons_region(sa);
+
+	if (ar)
 		ED_region_toggle_hidden(C, ar);
 
 	return OPERATOR_FINISHED;
@@ -1392,13 +1138,13 @@ static int view3d_properties(bContext *C, wmOperator *UNUSED(op))
 
 void VIEW3D_OT_properties(wmOperatorType *ot)
 {
-	ot->name= "Properties";
-	ot->description= "Toggles the properties panel display";
-	ot->idname= "VIEW3D_OT_properties";
-	
-	ot->exec= view3d_properties;
-	ot->poll= ED_operator_view3d_active;
-	
+	ot->name = "Properties";
+	ot->description = "Toggles the properties panel display";
+	ot->idname = "VIEW3D_OT_properties";
+
+	ot->exec = view3d_properties;
+	ot->poll = ED_operator_view3d_active;
+
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 }
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 4f46a74..ec383e1 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -65,7 +65,7 @@
 #include "BKE_movieclip.h"
 
 #include "RE_engine.h"
-#include "RE_pipeline.h"	// make_stars
+#include "RE_pipeline.h"    // make_stars
 
 #include "IMB_imbuf_types.h"
 #include "IMB_imbuf.h"
@@ -92,17 +92,17 @@
 #include "GPU_material.h"
 #include "GPU_extensions.h"
 
-#include "view3d_intern.h"	// own include
+#include "view3d_intern.h"  // own include
 
 
 
 static void star_stuff_init_func(void)
 {
-	cpack(-1);
+	cpack(0xFFFFFF);
 	glPointSize(1.0);
 	glBegin(GL_POINTS);
 }
-static void star_stuff_vertex_func(float* i)
+static void star_stuff_vertex_func(float*i)
 {
 	glVertex3fv(i);
 }
@@ -119,9 +119,9 @@ void circf(float x, float y, float rad)
 	
 	glPushMatrix(); 
 	
-	glTranslatef(x,  y, 0.); 
+	glTranslatef(x, y, 0.0);
 	
-	gluDisk( qobj, 0.0,  rad, 32, 1); 
+	gluDisk(qobj, 0.0,  rad, 32, 1);
 	
 	glPopMatrix(); 
 	
@@ -136,9 +136,9 @@ void circ(float x, float y, float rad)
 	
 	glPushMatrix(); 
 	
-	glTranslatef(x,  y, 0.); 
+	glTranslatef(x, y, 0.0);
 	
-	gluDisk( qobj, 0.0,  rad, 32, 1); 
+	gluDisk(qobj, 0.0,  rad, 32, 1);
 	
 	glPopMatrix(); 
 	
@@ -150,101 +150,109 @@ void circ(float x, float y, float rad)
 
 static void view3d_draw_clipping(RegionView3D *rv3d)
 {
-	BoundBox *bb= rv3d->clipbb;
+	BoundBox *bb = rv3d->clipbb;
 
-	if(bb) {
-		static unsigned int clipping_index[6][4]= {{0, 1, 2, 3},
-		                                           {0, 4, 5, 1},
-		                                           {4, 7, 6, 5},
-		                                           {7, 3, 2, 6},
-		                                           {1, 5, 6, 2},
-		                                           {7, 4, 0, 3}};
+	if (bb) {
+		static unsigned int clipping_index[6][4] = {{0, 1, 2, 3},
+		                                            {0, 4, 5, 1},
+		                                            {4, 7, 6, 5},
+		                                            {7, 3, 2, 6},
+		                                            {1, 5, 6, 2},
+		                                            {7, 4, 0, 3}};
 
 		UI_ThemeColorShade(TH_BACK, -8);
 
 		glEnableClientState(GL_VERTEX_ARRAY);
 		glVertexPointer(3, GL_FLOAT, 0, bb->vec);
-		glDrawElements(GL_QUADS, sizeof(clipping_index)/sizeof(unsigned int), GL_UNSIGNED_INT, clipping_index);
+		glDrawElements(GL_QUADS, sizeof(clipping_index) / sizeof(unsigned int), GL_UNSIGNED_INT, clipping_index);
 		glDisableClientState(GL_VERTEX_ARRAY);
 
 	}
 }
 
-void view3d_set_clipping(RegionView3D *rv3d)
+void ED_view3d_clipping_set(RegionView3D *rv3d)
 {
 	double plane[4];
-	int a, tot=4;
-	
-	if(rv3d->viewlock) tot= 6;
-	
-	for(a=0; a<tot; a++) {
-		QUATCOPY(plane, rv3d->clip[a]);
-		glClipPlane(GL_CLIP_PLANE0+a, plane);
-		glEnable(GL_CLIP_PLANE0+a);
+	const unsigned int tot = (rv3d->viewlock) ? 4 : 6;
+	unsigned int a;
+
+	for (a = 0; a < tot; a++) {
+		copy_v4db_v4fl(plane, rv3d->clip[a]);
+		glClipPlane(GL_CLIP_PLANE0 + a, plane);
+		glEnable(GL_CLIP_PLANE0 + a);
 	}
 }
 
-void view3d_clr_clipping(void)
+/* use these to temp disable/enable clipping when 'rv3d->rflag & RV3D_CLIPPING' is set */
+void ED_view3d_clipping_disable(void)
 {
-	int a;
-	
-	for(a=0; a<6; a++) {
-		glDisable(GL_CLIP_PLANE0+a);
+	unsigned int a;
+
+	for (a = 0; a < 6; a++) {
+		glDisable(GL_CLIP_PLANE0 + a);
+	}
+}
+void ED_view3d_clipping_enable(void)
+{
+	unsigned int a;
+
+	for (a = 0; a < 6; a++) {
+		glEnable(GL_CLIP_PLANE0 + a);
 	}
 }
 
-static int test_clipping(const float vec[3], float clip[][4])
+static int view3d_clipping_test(const float vec[3], float clip[][4])
 {
 	float view[3];
 	copy_v3_v3(view, vec);
 
-	if(0.0f < clip[0][3] + dot_v3v3(view, clip[0]))
-		if(0.0f < clip[1][3] + dot_v3v3(view, clip[1]))
-			if(0.0f < clip[2][3] + dot_v3v3(view, clip[2]))
-				if(0.0f < clip[3][3] + dot_v3v3(view, clip[3]))
+	if (0.0f < clip[0][3] + dot_v3v3(view, clip[0]))
+		if (0.0f < clip[1][3] + dot_v3v3(view, clip[1]))
+			if (0.0f < clip[2][3] + dot_v3v3(view, clip[2]))
+				if (0.0f < clip[3][3] + dot_v3v3(view, clip[3]))
 					return 0;
 
 	return 1;
 }
 
-/* for 'local' ED_view3d_local_clipping must run first
+/* for 'local' ED_view3d_clipping_local must run first
  * then all comparisons can be done in localspace */
-int ED_view3d_test_clipping(RegionView3D *rv3d, const float vec[3], const int local)
+int ED_view3d_clipping_test(RegionView3D *rv3d, const float vec[3], const int is_local)
 {
-	return test_clipping(vec, local ? rv3d->clip_local : rv3d->clip);
+	return view3d_clipping_test(vec, is_local ? rv3d->clip_local : rv3d->clip);
 }
 
 /* ********* end custom clipping *********** */
 
 
-static void drawgrid_draw(ARegion *ar, float wx, float wy, float x, float y, float dx)
+static void drawgrid_draw(ARegion *ar, double wx, double wy, double x, double y, double dx)
 {	
-	float verts[2][2];
+	double verts[2][2];
 
-	x+= (wx); 
-	y+= (wy);
+	x += (wx);
+	y += (wy);
 
 	/* set fixed 'Y' */
-	verts[0][1]= 0.0f;
-	verts[1][1]= (float)ar->winy;
+	verts[0][1] = 0.0f;
+	verts[1][1] = (double)ar->winy;
 
 	/* iter over 'X' */
-	verts[0][0] = verts[1][0] = x-dx*floorf(x/dx);
+	verts[0][0] = verts[1][0] = x - dx *floor(x / dx);
 	glEnableClientState(GL_VERTEX_ARRAY);
-	glVertexPointer(2, GL_FLOAT, 0, verts);
+	glVertexPointer(2, GL_DOUBLE, 0, verts);
 
-	while(verts[0][0] < ar->winx) {
+	while (verts[0][0] < ar->winx) {
 		glDrawArrays(GL_LINES, 0, 2);
 		verts[0][0] = verts[1][0] = verts[0][0] + dx;
 	}
 
 	/* set fixed 'X' */
-	verts[0][0]= 0.0f;
-	verts[1][0]= (float)ar->winx;
+	verts[0][0] = 0.0f;
+	verts[1][0] = (double)ar->winx;
 
 	/* iter over 'Y' */
-	verts[0][1]= verts[1][1]= y-dx*floorf(y/dx);
-	while(verts[0][1] < ar->winy) {
+	verts[0][1] = verts[1][1] = y - dx *floor(y / dx);
+	while (verts[0][1] < ar->winy) {
 		glDrawArrays(GL_LINES, 0, 2);
 		verts[0][1] = verts[1][1] = verts[0][1] + dx;
 	}
@@ -257,69 +265,66 @@ static void drawgrid_draw(ARegion *ar, float wx, float wy, float x, float y, flo
 static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **grid_unit)
 {
 	/* extern short bgpicmode; */
-	RegionView3D *rv3d= ar->regiondata;
-	float wx, wy, x, y, fw, fx, fy, dx;
-	float vec4[4];
+	RegionView3D *rv3d = ar->regiondata;
+	double wx, wy, x, y, fw, fx, fy, dx;
+	double vec4[4];
 	unsigned char col[3], col2[3];
 
-	vec4[0]=vec4[1]=vec4[2]=0.0; 
-	vec4[3]= 1.0;
-	mul_m4_v4(rv3d->persmat, vec4);
-	fx= vec4[0]; 
-	fy= vec4[1]; 
-	fw= vec4[3];
+	fx = rv3d->persmat[3][0];
+	fy = rv3d->persmat[3][1];
+	fw = rv3d->persmat[3][3];
 
-	wx= (ar->winx/2.0);	/* because of rounding errors, grid at wrong location */
-	wy= (ar->winy/2.0);
+	wx = (ar->winx / 2.0); /* because of rounding errors, grid at wrong location */
+	wy = (ar->winy / 2.0);
 
-	x= (wx)*fx/fw;
-	y= (wy)*fy/fw;
+	x = (wx) * fx / fw;
+	y = (wy) * fy / fw;
 
-	vec4[0]=vec4[1]= v3d->grid;
+	vec4[0] = vec4[1] = v3d->grid;
 
-	vec4[2]= 0.0;
-	vec4[3]= 1.0;
-	mul_m4_v4(rv3d->persmat, vec4);
-	fx= vec4[0]; 
-	fy= vec4[1]; 
-	fw= vec4[3];
+	vec4[2] = 0.0;
+	vec4[3] = 1.0;
+	mul_m4_v4d(rv3d->persmat, vec4);
+	fx = vec4[0];
+	fy = vec4[1];
+	fw = vec4[3];
 
-	dx= fabs(x-(wx)*fx/fw);
-	if(dx==0) dx= fabs(y-(wy)*fy/fw);
+	dx = fabs(x - (wx) * fx / fw);
+	if (dx == 0) dx = fabs(y - (wy) * fy / fw);
 	
-	glDepthMask(0);		// disable write in zbuffer
+	glDepthMask(0);     // disable write in zbuffer
 
 	/* check zoom out */
 	UI_ThemeColor(TH_GRID);
 	
-	if(unit->system) {
+	if (unit->system) {
 		/* Use GRID_MIN_PX*2 for units because very very small grid
 		 * items are less useful when dealing with units */
 		void *usys;
 		int len, i;
-		float dx_scalar;
+		double dx_scalar;
 		float blend_fac;
 
 		bUnit_GetSystem(&usys, &len, unit->system, B_UNIT_LENGTH);
 
-		if(usys) {
-			i= len;
-			while(i--) {
-				float scalar= bUnit_GetScaler(usys, i);
+		if (usys) {
+			i = len;
+			while (i--) {
+				double scalar = bUnit_GetScaler(usys, i);
 
 				dx_scalar = dx * scalar / unit->scale_length;
-				if (dx_scalar < (GRID_MIN_PX*2))
+				if (dx_scalar < (GRID_MIN_PX * 2))
 					continue;
 
 				/* Store the smallest drawn grid size units name so users know how big each grid cell is */
-				if(*grid_unit==NULL) {
-					*grid_unit= bUnit_GetNameDisplay(usys, i);
-					rv3d->gridview= (scalar * v3d->grid) / unit->scale_length;
+				if (*grid_unit == NULL) {
+					*grid_unit = bUnit_GetNameDisplay(usys, i);
+					rv3d->gridview = (scalar * v3d->grid) / unit->scale_length;
 				}
-				blend_fac= 1-((GRID_MIN_PX*2)/dx_scalar);
+				blend_fac = 1 - ((GRID_MIN_PX * 2) / dx_scalar);
 
 				/* tweak to have the fade a bit nicer */
-				blend_fac= (blend_fac * blend_fac) * 2.0f;
+				blend_fac = (blend_fac * blend_fac) * 2.0f;
 				CLAMP(blend_fac, 0.3f, 1.0f);
 
 
@@ -332,83 +337,83 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
 	else {
 		short sublines = v3d->gridsubdiv;
 
-		if(dx<GRID_MIN_PX) {
-			rv3d->gridview*= sublines;
-			dx*= sublines;
-			
-			if(dx<GRID_MIN_PX) {
-				rv3d->gridview*= sublines;
-				dx*= sublines;
-
-				if(dx<GRID_MIN_PX) {
-					rv3d->gridview*= sublines;
-					dx*=sublines;
-					if(dx<GRID_MIN_PX);
+		if (dx < GRID_MIN_PX) {
+			rv3d->gridview *= sublines;
+			dx *= sublines;
+
+			if (dx < GRID_MIN_PX) {
+				rv3d->gridview *= sublines;
+				dx *= sublines;
+
+				if (dx < GRID_MIN_PX) {
+					rv3d->gridview *= sublines;
+					dx *= sublines;
+					if (dx < GRID_MIN_PX) ;
 					else {
 						UI_ThemeColor(TH_GRID);
 						drawgrid_draw(ar, wx, wy, x, y, dx);
 					}
 				}
-				else {	// start blending out
-					UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/(GRID_MIN_PX*6));
+				else {  // start blending out
+					UI_ThemeColorBlend(TH_BACK, TH_GRID, dx / (GRID_MIN_PX * 6));
 					drawgrid_draw(ar, wx, wy, x, y, dx);
 
 					UI_ThemeColor(TH_GRID);
-					drawgrid_draw(ar, wx, wy, x, y, sublines*dx);
+					drawgrid_draw(ar, wx, wy, x, y, sublines * dx);
 				}
 			}
-			else {	// start blending out (GRID_MIN_PX < dx < (GRID_MIN_PX*10))
-				UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/(GRID_MIN_PX*6));
+			else {  // start blending out (GRID_MIN_PX < dx < (GRID_MIN_PX*10))
+				UI_ThemeColorBlend(TH_BACK, TH_GRID, dx / (GRID_MIN_PX * 6));
 				drawgrid_draw(ar, wx, wy, x, y, dx);
 
 				UI_ThemeColor(TH_GRID);
-				drawgrid_draw(ar, wx, wy, x, y, sublines*dx);
+				drawgrid_draw(ar, wx, wy, x, y, sublines * dx);
 			}
 		}
 		else {
-			if(dx>(GRID_MIN_PX*10)) {		// start blending in
-				rv3d->gridview/= sublines;
-				dx/= sublines;
-				if(dx>(GRID_MIN_PX*10)) {		// start blending in
-					rv3d->gridview/= sublines;
-					dx/= sublines;
-					if(dx>(GRID_MIN_PX*10)) {
+			if (dx > (GRID_MIN_PX * 10)) {      // start blending in
+				rv3d->gridview /= sublines;
+				dx /= sublines;
+				if (dx > (GRID_MIN_PX * 10)) {      // start blending in
+					rv3d->gridview /= sublines;
+					dx /= sublines;
+					if (dx > (GRID_MIN_PX * 10)) {
 						UI_ThemeColor(TH_GRID);
 						drawgrid_draw(ar, wx, wy, x, y, dx);
 					}
 					else {
-						UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/(GRID_MIN_PX*6));
+						UI_ThemeColorBlend(TH_BACK, TH_GRID, dx / (GRID_MIN_PX * 6));
 						drawgrid_draw(ar, wx, wy, x, y, dx);
 						UI_ThemeColor(TH_GRID);
-						drawgrid_draw(ar, wx, wy, x, y, dx*sublines);
+						drawgrid_draw(ar, wx, wy, x, y, dx * sublines);
 					}
 				}
 				else {
-					UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/(GRID_MIN_PX*6));
+					UI_ThemeColorBlend(TH_BACK, TH_GRID, dx / (GRID_MIN_PX * 6));
 					drawgrid_draw(ar, wx, wy, x, y, dx);
 					UI_ThemeColor(TH_GRID);
-					drawgrid_draw(ar, wx, wy, x, y, dx*sublines);
+					drawgrid_draw(ar, wx, wy, x, y, dx * sublines);
 				}
 			}
 			else {
-				UI_ThemeColorBlend(TH_BACK, TH_GRID, dx/(GRID_MIN_PX*6));
+				UI_ThemeColorBlend(TH_BACK, TH_GRID, dx / (GRID_MIN_PX * 6));
 				drawgrid_draw(ar, wx, wy, x, y, dx);
 				UI_ThemeColor(TH_GRID);
-				drawgrid_draw(ar, wx, wy, x, y, dx*sublines);
+				drawgrid_draw(ar, wx, wy, x, y, dx * sublines);
 			}
 		}
 	}
 
 
-	x+= (wx); 
-	y+= (wy);
+	x += (wx);
+	y += (wy);
 	UI_GetThemeColor3ubv(TH_GRID, col);
 
 	setlinestyle(0);
 	
 	/* center cross */
 	/* horizontal line */
-	if( ELEM(rv3d->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT)) 
+	if (ELEM(rv3d->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT))
 		UI_make_axis_color(col, col2, 'Y');
 	else UI_make_axis_color(col, col2, 'X');
 	glColor3ubv(col2);
@@ -416,14 +421,14 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
 	fdrawline(0.0,  y,  (float)ar->winx,  y); 
 	
 	/* vertical line */
-	if( ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM)) 
+	if (ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM))
 		UI_make_axis_color(col, col2, 'Y');
 	else UI_make_axis_color(col, col2, 'Z');
 	glColor3ubv(col2);
 
 	fdrawline(x, 0.0, x, (float)ar->winy); 
 
-	glDepthMask(1);		// enable write in zbuffer
+	glDepthMask(1);     // enable write in zbuffer
 }
 #undef GRID_MIN_PX
 
@@ -431,68 +436,68 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
 {
 	float grid, grid_scale;
 	unsigned char col_grid[3];
-	const int gridlines= v3d->gridlines/2;
+	const int gridlines = v3d->gridlines / 2;
 
-	if(v3d->gridlines<3) return;
+	if (v3d->gridlines < 3) return;
 	
-	grid_scale= v3d->grid;
+	grid_scale = v3d->grid;
 	/* use 'grid_scale' instead of 'v3d->grid' from now on */
 
 	/* apply units */
-	if(scene->unit.system) {
+	if (scene->unit.system) {
 		void *usys;
 		int len;
 
 		bUnit_GetSystem(&usys, &len, scene->unit.system, B_UNIT_LENGTH);
 
-		if(usys) {
-			int i= bUnit_GetBaseUnit(usys);
-			*grid_unit= bUnit_GetNameDisplay(usys, i);
+		if (usys) {
+			int i = bUnit_GetBaseUnit(usys);
+			*grid_unit = bUnit_GetNameDisplay(usys, i);
 			grid_scale = (grid_scale * (float)bUnit_GetScaler(usys, i)) / scene->unit.scale_length;
 		}
 	}
 
-	grid= gridlines * grid_scale;
+	grid = gridlines * grid_scale;
 
-	if(v3d->zbuf && scene->obedit) glDepthMask(0);	// for zbuffer-select
+	if (v3d->zbuf && scene->obedit) glDepthMask(0);  // for zbuffer-select
 
 	UI_GetThemeColor3ubv(TH_GRID, col_grid);
 
 	/* draw the Y axis and/or grid lines */
-	if(v3d->gridflag & V3D_SHOW_FLOOR) {
-		float vert[4][3]= {{0.0f}};
+	if (v3d->gridflag & V3D_SHOW_FLOOR) {
+		float vert[4][3] = {{0.0f}};
 		unsigned char col_bg[3];
 		unsigned char col_grid_emphasise[3], col_grid_light[3];
 		int a;
-		int prev_emphasise= -1;
+		int prev_emphasise = -1;
 
 		UI_GetThemeColor3ubv(TH_BACK, col_bg);
 
 		/* emphasise division lines lighter instead of darker, if background is darker than grid */
 		UI_GetColorPtrShade3ubv(col_grid, col_grid_light, 10);
 		UI_GetColorPtrShade3ubv(col_grid, col_grid_emphasise,
-		                        (((col_grid[0]+col_grid[1]+col_grid[2])+30) >
-		                          (col_bg[0]+col_bg[1]+col_bg[2])) ? 20 : -10);
+		                        (((col_grid[0] + col_grid[1] + col_grid[2]) + 30) >
+		                         (col_bg[0] + col_bg[1] + col_bg[2])) ? 20 : -10);
 
 		/* set fixed axis */
-		vert[0][0]= vert[2][1]= grid;
-		vert[1][0]= vert[3][1]= -grid;
+		vert[0][0] = vert[2][1] = grid;
+		vert[1][0] = vert[3][1] = -grid;
 
 		glEnableClientState(GL_VERTEX_ARRAY);
 		glVertexPointer(3, GL_FLOAT, 0, vert);
 
-		for(a= -gridlines;a<=gridlines;a++) {
-			const float line= a * grid_scale;
-			const int is_emphasise= (a % 10) == 0;
+		for (a = -gridlines; a <= gridlines; a++) {
+			const float line = a * grid_scale;
+			const int is_emphasise = (a % 10) == 0;
 
-			if(is_emphasise != prev_emphasise) {
+			if (is_emphasise != prev_emphasise) {
 				glColor3ubv(is_emphasise ? col_grid_emphasise : col_grid_light);
-				prev_emphasise= is_emphasise;
+				prev_emphasise = is_emphasise;
 			}
 
 			/* set variable axis */
-			vert[0][1]= vert[1][1]=
-			vert[2][0]= vert[3][0]= line;
+			vert[0][1] = vert[1][1] =
+			vert[2][0] = vert[3][0] = line;
 
 			glDrawArrays(GL_LINES, 0, 4);
 		}
@@ -506,28 +511,29 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
 	/* check for the 'show Z axis' preference */
 	if (v3d->gridflag & (V3D_SHOW_X | V3D_SHOW_Y | V3D_SHOW_Z)) {
 		int axis;
-		for(axis= 0; axis < 3; axis++)
-		if (v3d->gridflag & (V3D_SHOW_X << axis)) {
-			float vert[3];
-			unsigned char tcol[3];
-
-			UI_make_axis_color(col_grid, tcol, 'X' + axis);
-			glColor3ubv(tcol);
-
-			glBegin(GL_LINE_STRIP);
-			zero_v3(vert);
-			vert[axis]= grid;
-			glVertex3fv(vert );
-			vert[axis]= -grid;
-			glVertex3fv(vert);
-			glEnd();
+		for (axis = 0; axis < 3; axis++) {
+			if (v3d->gridflag & (V3D_SHOW_X << axis)) {
+				float vert[3];
+				unsigned char tcol[3];
+
+				UI_make_axis_color(col_grid, tcol, 'X' + axis);
+				glColor3ubv(tcol);
+
+				glBegin(GL_LINE_STRIP);
+				zero_v3(vert);
+				vert[axis] = grid;
+				glVertex3fv(vert);
+				vert[axis] = -grid;
+				glVertex3fv(vert);
+				glEnd();
+			}
 		}
 	}
 
 
 
 
-	if(v3d->zbuf && scene->obedit) glDepthMask(1);	
+	if (v3d->zbuf && scene->obedit) glDepthMask(1);
 	
 }
 
@@ -536,16 +542,16 @@ static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d)
 	int mx, my, co[2];
 	int flag;
 	
-	/* we dont want the clipping for cursor */
-	flag= v3d->flag;
-	v3d->flag= 0;
+	/* we don't want the clipping for cursor */
+	flag = v3d->flag;
+	v3d->flag = 0;
 	project_int(ar, give_cursor(scene, v3d), co);
-	v3d->flag= flag;
+	v3d->flag = flag;
 	
 	mx = co[0];
 	my = co[1];
 	
-	if(mx!=IS_CLIPPED) {
+	if (mx != IS_CLIPPED) {
 		setlinestyle(0); 
 		cpack(0xFF);
 		circ((float)mx, (float)my, 10.0);
@@ -555,10 +561,10 @@ static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d)
 		setlinestyle(0);
 		cpack(0x0);
 		
-		sdrawline(mx-20, my, mx-5, my);
-		sdrawline(mx+5, my, mx+20, my);
-		sdrawline(mx, my-20, mx, my-5);
-		sdrawline(mx, my+5, mx, my+20);
+		sdrawline(mx - 20, my, mx - 5, my);
+		sdrawline(mx + 5, my, mx + 20, my);
+		sdrawline(mx, my - 20, mx, my - 5);
+		sdrawline(mx, my + 5, mx, my + 20);
 	}
 }
 
@@ -568,9 +574,9 @@ static void draw_view_axis(RegionView3D *rv3d)
 {
 	const float k = U.rvisize;   /* axis size */
 	const float toll = 0.5;      /* used to see when view is quasi-orthogonal */
-	const float start = k + 1.0f;/* axis center in screen coordinates, x=y */
+	const float start = k + 1.0f; /* axis center in screen coordinates, x=y */
 	float ydisp = 0.0;          /* vertical displacement to allow obj info text */
-	int bright = 25*(float)U.rvibright + 5; /* axis alpha (rvibright has range 0-10) */
+	int bright = 25 * (float)U.rvibright + 5; /* axis alpha (rvibright has range 0-10) */
 
 	float vec[3];
 	float dx, dy;
@@ -649,7 +655,7 @@ static void draw_rotation_guide(RegionView3D *rv3d)
 	float o[3]; // center of rotation
 	float end[3]; // endpoints for drawing
 
-	float color[4] = {0.f ,0.4235f, 1.f, 1.f}; // bright blue so it matches device LEDs
+	float color[4] = {0.0f, 0.4235f, 1.0f, 1.0f}; // bright blue so it matches device LEDs
 
 	negate_v3_v3(o, rv3d->ofs);
 
@@ -688,7 +694,7 @@ static void draw_rotation_guide(RegionView3D *rv3d)
 		
 		// -- draw ring around rotation center --
 		{
-#define		ROT_AXIS_DETAIL 13
+#define     ROT_AXIS_DETAIL 13
 
 			const float s = 0.05f * scale;
 			const float step = 2.f * (float)(M_PI / ROT_AXIS_DETAIL);
@@ -721,18 +727,18 @@ static void draw_rotation_guide(RegionView3D *rv3d)
 			}
 			glEnd();
 
-#undef		ROT_AXIS_DETAIL
+#undef      ROT_AXIS_DETAIL
 		}
 
 		color[3] = 1.f; // solid dot
 	}
 	else
-		color[3] = 0.5f; // see-through dot
+		color[3] = 0.5f;  // see-through dot
 
 	// -- draw rotation center --
 	glColor4fv(color);
 	glBegin(GL_POINTS);
-		glVertex3fv(o);
+	glVertex3fv(o);
 	glEnd();
 
 	// find screen coordinates for rotation center, then draw pretty icon
@@ -749,13 +755,13 @@ static void draw_view_icon(RegionView3D *rv3d)
 {
 	BIFIconID icon;
 	
-	if( ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM)) 
-		icon= ICON_AXIS_TOP;
-	else if( ELEM(rv3d->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK)) 
-		icon= ICON_AXIS_FRONT;
-	else if( ELEM(rv3d->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT)) 
-		icon= ICON_AXIS_SIDE;
-	else return ;
+	if (ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM))
+		icon = ICON_AXIS_TOP;
+	else if (ELEM(rv3d->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK))
+		icon = ICON_AXIS_FRONT;
+	else if (ELEM(rv3d->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT))
+		icon = ICON_AXIS_SIDE;
+	else return;
 	
 	glEnable(GL_BLEND);
 	glBlendFunc(GL_SRC_ALPHA,  GL_ONE_MINUS_SRC_ALPHA); 
@@ -796,15 +802,17 @@ static const char *view3d_get_name(View3D *v3d, RegionView3D *rv3d)
 			break;
 			
 		default:
-			if (rv3d->persp==RV3D_CAMOB) {
+			if (rv3d->persp == RV3D_CAMOB) {
 				if ((v3d->camera) && (v3d->camera->type == OB_CAMERA)) {
 					Camera *cam;
 					cam = v3d->camera->data;
 					name = (cam->type != CAM_ORTHO) ? "Camera Persp" : "Camera Ortho";
-				} else {
+				}
+				else {
 					name = "Object as Camera";
 				}
-			} else { 
+			}
+			else {
 				name = (rv3d->persp == RV3D_ORTHO) ? "User Ortho" : "User Persp";
 			}
 			break;
@@ -815,94 +823,94 @@ static const char *view3d_get_name(View3D *v3d, RegionView3D *rv3d)
 
 static void draw_viewport_name(ARegion *ar, View3D *v3d)
 {
-	RegionView3D *rv3d= ar->regiondata;
-	const char *name= view3d_get_name(v3d, rv3d);
+	RegionView3D *rv3d = ar->regiondata;
+	const char *name = view3d_get_name(v3d, rv3d);
 	char tmpstr[24];
 	
 	if (v3d->localvd) {
 		BLI_snprintf(tmpstr, sizeof(tmpstr), "%s (Local)", name);
-		name= tmpstr;
+		name = tmpstr;
 	}
 
 	if (name) {
 		UI_ThemeColor(TH_TEXT_HI);
-		BLF_draw_default_ascii(22,  ar->winy-17, 0.0f, name, sizeof(tmpstr));
+		BLF_draw_default_ascii(22,  ar->winy - 17, 0.0f, name, sizeof(tmpstr));
 	}
 }
 
 /* draw info beside axes in bottom left-corner: 
-* 	framenum, object name, bone name (if available), marker name (if available)
-*/
+ * framenum, object name, bone name (if available), marker name (if available)
+ */
 static void draw_selected_name(Scene *scene, Object *ob)
 {
 	char info[256], *markern;
-	short offset=30;
+	short offset = 30;
 	
 	/* get name of marker on current frame (if available) */
-	markern= scene_find_marker_name(scene, CFRA);
+	markern = scene_find_marker_name(scene, CFRA);
 	
 	/* check if there is an object */
-	if(ob) {
+	if (ob) {
 		/* name(s) to display depends on type of object */
-		if(ob->type==OB_ARMATURE) {
-			bArmature *arm= ob->data;
-			char *name= NULL;
+		if (ob->type == OB_ARMATURE) {
+			bArmature *arm = ob->data;
+			char *name = NULL;
 			
 			/* show name of active bone too (if possible) */
-			if(arm->edbo) {
+			if (arm->edbo) {
 
-				if(arm->act_edbone)
-					name= ((EditBone *)arm->act_edbone)->name;
+				if (arm->act_edbone)
+					name = ((EditBone *)arm->act_edbone)->name;
 
 			}
-			else if(ob->mode & OB_MODE_POSE) {
-				if(arm->act_bone) {
+			else if (ob->mode & OB_MODE_POSE) {
+				if (arm->act_bone) {
 
-					if(arm->act_bone->layer & arm->layer)
-						name= arm->act_bone->name;
+					if (arm->act_bone->layer & arm->layer)
+						name = arm->act_bone->name;
 
 				}
 			}
-			if(name && markern)
-				BLI_snprintf(info, sizeof(info), "(%d) %s %s <%s>", CFRA, ob->id.name+2, name, markern);
-			else if(name)
-				BLI_snprintf(info, sizeof(info), "(%d) %s %s", CFRA, ob->id.name+2, name);
+			if (name && markern)
+				BLI_snprintf(info, sizeof(info), "(%d) %s %s <%s>", CFRA, ob->id.name + 2, name, markern);
+			else if (name)
+				BLI_snprintf(info, sizeof(info), "(%d) %s %s", CFRA, ob->id.name + 2, name);
 			else
-				BLI_snprintf(info, sizeof(info), "(%d) %s", CFRA, ob->id.name+2);
+				BLI_snprintf(info, sizeof(info), "(%d) %s", CFRA, ob->id.name + 2);
 		}
-		else if(ELEM3(ob->type, OB_MESH, OB_LATTICE, OB_CURVE)) {
-			Key *key= NULL;
+		else if (ELEM3(ob->type, OB_MESH, OB_LATTICE, OB_CURVE)) {
+			Key *key = NULL;
 			KeyBlock *kb = NULL;
 			char shapes[MAX_NAME + 10];
 			
 			/* try to display active shapekey too */
 			shapes[0] = '\0';
 			key = ob_get_key(ob);
-			if(key){
-				kb = BLI_findlink(&key->block, ob->shapenr-1);
-				if(kb){
+			if (key) {
+				kb = BLI_findlink(&key->block, ob->shapenr - 1);
+				if (kb) {
 					BLI_snprintf(shapes, sizeof(shapes), ": %s ", kb->name);
-					if(ob->shapeflag == OB_SHAPE_LOCK){
+					if (ob->shapeflag == OB_SHAPE_LOCK) {
 						strcat(shapes, " (Pinned)");
 					}
 				}
 			}
 			
-			if(markern)
-				BLI_snprintf(info, sizeof(info), "(%d) %s %s <%s>", CFRA, ob->id.name+2, shapes, markern);
+			if (markern)
+				BLI_snprintf(info, sizeof(info), "(%d) %s %s <%s>", CFRA, ob->id.name + 2, shapes, markern);
 			else
-				BLI_snprintf(info, sizeof(info), "(%d) %s %s", CFRA, ob->id.name+2, shapes);
+				BLI_snprintf(info, sizeof(info), "(%d) %s %s", CFRA, ob->id.name + 2, shapes);
 		}
 		else {
 			/* standard object */
 			if (markern)
-				BLI_snprintf(info, sizeof(info), "(%d) %s <%s>", CFRA, ob->id.name+2, markern);
+				BLI_snprintf(info, sizeof(info), "(%d) %s <%s>", CFRA, ob->id.name + 2, markern);
 			else
-				BLI_snprintf(info, sizeof(info), "(%d) %s", CFRA, ob->id.name+2);
+				BLI_snprintf(info, sizeof(info), "(%d) %s", CFRA, ob->id.name + 2);
 		}
 		
 		/* color depends on whether there is a keyframe */
-		if (id_frame_has_keyframe((ID *)ob, /*BKE_curframe(scene)*/(float)(CFRA), ANIMFILTER_KEYS_LOCAL))
+		if (id_frame_has_keyframe((ID *)ob, /*BKE_curframe(scene)*/ (float)(CFRA), ANIMFILTER_KEYS_LOCAL))
 			UI_ThemeColor(TH_VERTEX_SELECT);
 		else
 			UI_ThemeColor(TH_TEXT_HI);
@@ -933,26 +941,26 @@ static void view3d_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionV
 	/* get viewport viewplane */
 	camera_params_init(&params);
 	camera_params_from_view3d(&params, v3d, rv3d);
-	if(no_zoom)
-		params.zoom= 1.0f;
+	if (no_zoom)
+		params.zoom = 1.0f;
 	camera_params_compute_viewplane(&params, ar->winx, ar->winy, 1.0f, 1.0f);
-	rect_view= params.viewplane;
+	rect_view = params.viewplane;
 
 	/* get camera viewplane */
 	camera_params_init(&params);
 	camera_params_from_object(&params, v3d->camera);
-	if(no_shift) {
-		params.shiftx= 0.0f;
-		params.shifty= 0.0f;
+	if (no_shift) {
+		params.shiftx = 0.0f;
+		params.shifty = 0.0f;
 	}
 	camera_params_compute_viewplane(&params, scene->r.xsch, scene->r.ysch, scene->r.xasp, scene->r.yasp);
-	rect_camera= params.viewplane;
+	rect_camera = params.viewplane;
 
 	/* get camera border within viewport */
-	viewborder_r->xmin= ((rect_camera.xmin - rect_view.xmin)/(rect_view.xmax - rect_view.xmin))*ar->winx;
-	viewborder_r->xmax= ((rect_camera.xmax - rect_view.xmin)/(rect_view.xmax - rect_view.xmin))*ar->winx;
-	viewborder_r->ymin= ((rect_camera.ymin - rect_view.ymin)/(rect_view.ymax - rect_view.ymin))*ar->winy;
-	viewborder_r->ymax= ((rect_camera.ymax - rect_view.ymin)/(rect_view.ymax - rect_view.ymin))*ar->winy;
+	viewborder_r->xmin = ((rect_camera.xmin - rect_view.xmin) / (rect_view.xmax - rect_view.xmin)) * ar->winx;
+	viewborder_r->xmax = ((rect_camera.xmax - rect_view.xmin) / (rect_view.xmax - rect_view.xmin)) * ar->winx;
+	viewborder_r->ymin = ((rect_camera.ymin - rect_view.ymin) / (rect_view.ymax - rect_view.ymin)) * ar->winy;
+	viewborder_r->ymax = ((rect_camera.ymax - rect_view.ymin) / (rect_view.ymax - rect_view.ymin)) * ar->winy;
 }
 
 void ED_view3d_calc_camera_border_size(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, float size_r[2])
@@ -960,8 +968,8 @@ void ED_view3d_calc_camera_border_size(Scene *scene, ARegion *ar, View3D *v3d, R
 	rctf viewborder;
 
 	view3d_camera_border(scene, ar, v3d, rv3d, &viewborder, TRUE, TRUE);
-	size_r[0]= viewborder.xmax - viewborder.xmin;
-	size_r[1]= viewborder.ymax - viewborder.ymin;
+	size_r[0] = viewborder.xmax - viewborder.xmin;
+	size_r[1] = viewborder.ymax - viewborder.ymin;
 }
 
 void ED_view3d_calc_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d,
@@ -974,10 +982,10 @@ static void drawviewborder_grid3(float x1, float x2, float y1, float y2, float f
 {
 	float x3, y3, x4, y4;
 
-	x3= x1 + fac * (x2-x1);
-	y3= y1 + fac * (y2-y1);
-	x4= x1 + (1.0f - fac) * (x2-x1);
-	y4= y1 + (1.0f - fac) * (y2-y1);
+	x3 = x1 + fac * (x2 - x1);
+	y3 = y1 + fac * (y2 - y1);
+	x4 = x1 + (1.0f - fac) * (x2 - x1);
+	y4 = y1 + (1.0f - fac) * (y2 - y1);
 
 	glBegin(GL_LINES);
 	glVertex2f(x1, y3);
@@ -998,18 +1006,18 @@ static void drawviewborder_grid3(float x1, float x2, float y1, float y2, float f
 static void drawviewborder_triangle(float x1, float x2, float y1, float y2, const char golden, const char dir)
 {
 	float ofs;
-	float w= x2 - x1;
-	float h= y2 - y1;
+	float w = x2 - x1;
+	float h = y2 - y1;
 
 	glBegin(GL_LINES);
-	if(w > h) {
-		if(golden) {
-			ofs = w * (1.0f-(1.0f/1.61803399f));
+	if (w > h) {
+		if (golden) {
+			ofs = w * (1.0f - (1.0f / 1.61803399f));
 		}
 		else {
 			ofs = h * (h / w);
 		}
-		if(dir == 'B') SWAP(float, y1, y2);
+		if (dir == 'B') SWAP(float, y1, y2);
 
 		glVertex2f(x1, y1);
 		glVertex2f(x2, y2);
@@ -1021,13 +1029,13 @@ static void drawviewborder_triangle(float x1, float x2, float y1, float y2, cons
 		glVertex2f(x1 + ofs, y1);
 	}
 	else {
-		if(golden) {
-			ofs = h * (1.0f-(1.0f/1.61803399f));
+		if (golden) {
+			ofs = h * (1.0f - (1.0f / 1.61803399f));
 		}
 		else {
 			ofs = w * (w / h);
 		}
-		if(dir == 'B') SWAP(float, x1, x2);
+		if (dir == 'B') SWAP(float, x1, x2);
 
 		glVertex2f(x1, y1);
 		glVertex2f(x2, y2);
@@ -1048,39 +1056,40 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
 	float x1i, x2i, y1i, y2i;
 	float x3, y3, x4, y4;
 	rctf viewborder;
-	Camera *ca= NULL;
-	RegionView3D *rv3d= (RegionView3D *)ar->regiondata;
+	Camera *ca = NULL;
+	RegionView3D *rv3d = (RegionView3D *)ar->regiondata;
 	
-	if(v3d->camera==NULL)
+	if (v3d->camera == NULL)
 		return;
-	if(v3d->camera->type==OB_CAMERA)
+	if (v3d->camera->type == OB_CAMERA)
 		ca = v3d->camera->data;
 	
 	ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, FALSE);
 	/* the offsets */
-	x1= viewborder.xmin;
-	y1= viewborder.ymin;
-	x2= viewborder.xmax;
-	y2= viewborder.ymax;
+	x1 = viewborder.xmin;
+	y1 = viewborder.ymin;
+	x2 = viewborder.xmax;
+	y2 = viewborder.ymax;
 	
 	/* apply offsets so the real 3D camera shows through */
 
 	/* note: quite un-scientific but without this bit extra
 	 * 0.0001 on the lower left the 2D border sometimes
 	 * obscures the 3D camera border */
-	/* note: with VIEW3D_CAMERA_BORDER_HACK defined this error isn't noticable
-	 * but keep it here incase we need to remove the workaround */
-	x1i= (int)(x1 - 1.0001f);
-	y1i= (int)(y1 - 1.0001f);
-	x2i= (int)(x2 + (1.0f-0.0001f));
-	y2i= (int)(y2 + (1.0f-0.0001f));
+	/* note: with VIEW3D_CAMERA_BORDER_HACK defined this error isn't noticeable
+	 * but keep it here in case we need to remove the workaround */
+	x1i = (int)(x1 - 1.0001f);
+	y1i = (int)(y1 - 1.0001f);
+	x2i = (int)(x2 + (1.0f - 0.0001f));
+	y2i = (int)(y2 + (1.0f - 0.0001f));
 	
 	/* passepartout, specified in camera edit buttons */
 	if (ca && (ca->flag & CAM_SHOWPASSEPARTOUT) && ca->passepartalpha > 0.000001f) {
 		if (ca->passepartalpha == 1.0f) {
 			glColor3f(0, 0, 0);
-		} else {
-			glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
+		}
+		else {
+			glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 			glEnable(GL_BLEND);
 			glColor4f(0, 0, 0, ca->passepartalpha);
 		}
@@ -1106,10 +1115,10 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
 	glRectf(x1i, y1i, x2i, y2i);
 
 #ifdef VIEW3D_CAMERA_BORDER_HACK
-	if(view3d_camera_border_hack_test == TRUE) {
+	if (view3d_camera_border_hack_test == TRUE) {
 		glColor4fv(view3d_camera_border_hack_col);
-		glRectf(x1i+1, y1i+1, x2i-1, y2i-1);
-		view3d_camera_border_hack_test= FALSE;
+		glRectf(x1i + 1, y1i + 1, x2i - 1, y2i - 1);
+		view3d_camera_border_hack_test = FALSE;
 	}
 #endif
 
@@ -1125,25 +1134,25 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
 	glRectf(x1i, y1i, x2i, y2i);
 
 	/* border */
-	if(scene->r.mode & R_BORDER) {
+	if (scene->r.mode & R_BORDER) {
 		
 		cpack(0);
-		x3= x1+ scene->r.border.xmin*(x2-x1);
-		y3= y1+ scene->r.border.ymin*(y2-y1);
-		x4= x1+ scene->r.border.xmax*(x2-x1);
-		y4= y1+ scene->r.border.ymax*(y2-y1);
+		x3 = x1 + scene->r.border.xmin * (x2 - x1);
+		y3 = y1 + scene->r.border.ymin * (y2 - y1);
+		x4 = x1 + scene->r.border.xmax * (x2 - x1);
+		y4 = y1 + scene->r.border.ymax * (y2 - y1);
 		
 		cpack(0x4040FF);
 		glRectf(x3,  y3,  x4,  y4); 
 	}
 
 	/* safety border */
-	if(ca) {
+	if (ca) {
 		if (ca->dtx & CAM_DTX_CENTER) {
 			UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0);
 
-			x3= x1+ 0.5f*(x2-x1);
-			y3= y1+ 0.5f*(y2-y1);
+			x3 = x1 + 0.5f * (x2 - x1);
+			y3 = y1 + 0.5f * (y2 - y1);
 
 			glBegin(GL_LINES);
 			glVertex2f(x1, y3);
@@ -1168,12 +1177,12 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
 
 		if (ca->dtx & CAM_DTX_THIRDS) {
 			UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0);
-			drawviewborder_grid3(x1, x2, y1, y2, 1.0f/3.0f);
+			drawviewborder_grid3(x1, x2, y1, y2, 1.0f / 3.0f);
 		}
 
 		if (ca->dtx & CAM_DTX_GOLDEN) {
 			UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0);
-			drawviewborder_grid3(x1, x2, y1, y2, 1.0f-(1.0f/1.61803399f));
+			drawviewborder_grid3(x1, x2, y1, y2, 1.0f - (1.0f / 1.61803399f));
 		}
 
 		if (ca->dtx & CAM_DTX_GOLDEN_TRI_A) {
@@ -1197,15 +1206,15 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
 		}
 
 		if (ca->flag & CAM_SHOWTITLESAFE) {
-			fac= 0.1;
+			fac = 0.1;
 
-			a= fac*(x2-x1);
-			x1+= a;
-			x2-= a;
+			a = fac * (x2 - x1);
+			x1 += a;
+			x2 -= a;
 
-			a= fac*(y2-y1);
-			y1+= a;
-			y2-= a;
+			a = fac * (y2 - y1);
+			y1 += a;
+			y2 -= a;
 
 			UI_ThemeColorBlendShade(TH_WIRE, TH_BACK, 0.25, 0);
 
@@ -1214,33 +1223,33 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
 		}
 		if (ca && (ca->flag & CAM_SHOWSENSOR)) {
 			/* determine sensor fit, and get sensor x/y, for auto fit we
-			   assume and square sensor and only use sensor_x */
-			float sizex= scene->r.xsch*scene->r.xasp;
-			float sizey= scene->r.ysch*scene->r.yasp;
+			 * assume and square sensor and only use sensor_x */
+			float sizex = scene->r.xsch * scene->r.xasp;
+			float sizey = scene->r.ysch * scene->r.yasp;
 			int sensor_fit = camera_sensor_fit(ca->sensor_fit, sizex, sizey);
-			float sensor_x= ca->sensor_x;
-			float sensor_y= (ca->sensor_fit == CAMERA_SENSOR_FIT_AUTO)? ca->sensor_x: ca->sensor_y;
+			float sensor_x = ca->sensor_x;
+			float sensor_y = (ca->sensor_fit == CAMERA_SENSOR_FIT_AUTO) ? ca->sensor_x : ca->sensor_y;
 
 			/* determine sensor plane */
 			rctf rect;
 
-			if(sensor_fit == CAMERA_SENSOR_FIT_HOR) {
-				float sensor_scale = (x2i-x1i) / sensor_x;
+			if (sensor_fit == CAMERA_SENSOR_FIT_HOR) {
+				float sensor_scale = (x2i - x1i) / sensor_x;
 				float sensor_height = sensor_scale * sensor_y;
 
-				rect.xmin= x1i;
-				rect.xmax= x2i;
-				rect.ymin= (y1i + y2i)*0.5f - sensor_height*0.5f;
-				rect.ymax= rect.ymin + sensor_height;
+				rect.xmin = x1i;
+				rect.xmax = x2i;
+				rect.ymin = (y1i + y2i) * 0.5f - sensor_height * 0.5f;
+				rect.ymax = rect.ymin + sensor_height;
 			}
 			else {
-				float sensor_scale = (y2i-y1i) / sensor_y;
+				float sensor_scale = (y2i - y1i) / sensor_y;
 				float sensor_width = sensor_scale * sensor_x;
 
-				rect.xmin= (x1i + x2i)*0.5f - sensor_width*0.5f;
-				rect.xmax= rect.xmin + sensor_width;
-				rect.ymin= y1i;
-				rect.ymax= y2i;
+				rect.xmin = (x1i + x2i) * 0.5f - sensor_width * 0.5f;
+				rect.xmax = rect.xmin + sensor_width;
+				rect.ymin = y1i;
+				rect.ymax = y2i;
 			}
 
 			/* draw */
@@ -1255,7 +1264,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
 	/* camera name - draw in highlighted text color */
 	if (ca && (ca->flag & CAM_SHOWNAME)) {
 		UI_ThemeColor(TH_TEXT_HI);
-		BLF_draw_default(x1i, y1i-15, 0.0f, v3d->camera->id.name+2, sizeof(v3d->camera->id.name)-2);
+		BLF_draw_default(x1i, y1i - 15, 0.0f, v3d->camera->id.name + 2, sizeof(v3d->camera->id.name) - 2);
 		UI_ThemeColor(TH_WIRE);
 	}
 }
@@ -1264,30 +1273,30 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
 
 static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 	struct Base *base = scene->basact;
 	int multisample_enabled;
 	rcti winrct;
 
 	BLI_assert(ar->regiontype == RGN_TYPE_WINDOW);
 
-	if(base && (base->object->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT) ||
-	            paint_facesel_test(base->object)))
+	if (base && (base->object->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT) ||
+	             paint_facesel_test(base->object)))
 	{
 		/* do nothing */
 	}
-	else if((base && (base->object->mode & OB_MODE_TEXTURE_PAINT)) &&
-	        scene->toolsettings && (scene->toolsettings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE))
+	else if ((base && (base->object->mode & OB_MODE_TEXTURE_PAINT)) &&
+	         scene->toolsettings && (scene->toolsettings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE))
 	{
 		/* do nothing */
 	}
-	else if((base && (base->object->mode & OB_MODE_PARTICLE_EDIT)) &&
-	        v3d->drawtype > OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT))
+	else if ((base && (base->object->mode & OB_MODE_PARTICLE_EDIT)) &&
+	         v3d->drawtype > OB_WIRE && (v3d->flag & V3D_ZBUF_SELECT))
 	{
 		/* do nothing */
 	}
-	else if(scene->obedit && v3d->drawtype>OB_WIRE &&
-	        (v3d->flag & V3D_ZBUF_SELECT)) {
+	else if (scene->obedit && v3d->drawtype > OB_WIRE &&
+	         (v3d->flag & V3D_ZBUF_SELECT)) {
 		/* do nothing */
 	}
 	else {
@@ -1295,29 +1304,29 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
 		return;
 	}
 
-	if( !(v3d->flag & V3D_INVALID_BACKBUF) ) return;
+	if (!(v3d->flag & V3D_INVALID_BACKBUF) ) return;
 
-//	if(test) {
-//		if(qtest()) {
+//	if (test) {
+//		if (qtest()) {
 //			addafterqueue(ar->win, BACKBUFDRAW, 1);
 //			return;
 //		}
 //	}
 
-	if(v3d->drawtype > OB_WIRE) v3d->zbuf= TRUE;
+	if (v3d->drawtype > OB_WIRE) v3d->zbuf = TRUE;
 	
 	/* dithering and AA break color coding, so disable */
 	glDisable(GL_DITHER);
 
-	multisample_enabled= glIsEnabled(GL_MULTISAMPLE_ARB);
-	if(multisample_enabled)
+	multisample_enabled = glIsEnabled(GL_MULTISAMPLE_ARB);
+	if (multisample_enabled)
 		glDisable(GL_MULTISAMPLE_ARB);
 
 	region_scissor_winrct(ar, &winrct);
 	glScissor(winrct.xmin, winrct.ymin, winrct.xmax - winrct.xmin, winrct.ymax - winrct.ymin);
 
 	glClearColor(0.0, 0.0, 0.0, 0.0); 
-	if(v3d->zbuf) {
+	if (v3d->zbuf) {
 		glEnable(GL_DEPTH_TEST);
 		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 	}
@@ -1326,26 +1335,26 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
 		glDisable(GL_DEPTH_TEST);
 	}
 	
-	if(rv3d->rflag & RV3D_CLIPPING)
-		view3d_set_clipping(rv3d);
+	if (rv3d->rflag & RV3D_CLIPPING)
+		ED_view3d_clipping_set(rv3d);
 	
 	G.f |= G_BACKBUFSEL;
 	
-	if(base && (base->lay & v3d->lay))
+	if (base && (base->lay & v3d->lay))
 		draw_object_backbufsel(scene, v3d, rv3d, base->object);
 
 	v3d->flag &= ~V3D_INVALID_BACKBUF;
-	ar->swap= 0; /* mark invalid backbuf for wm draw */
+	ar->swap = 0; /* mark invalid backbuf for wm draw */
 
 	G.f &= ~G_BACKBUFSEL;
-	v3d->zbuf= FALSE; 
+	v3d->zbuf = FALSE;
 	glDisable(GL_DEPTH_TEST);
 	glEnable(GL_DITHER);
-	if(multisample_enabled)
+	if (multisample_enabled)
 		glEnable(GL_MULTISAMPLE_ARB);
 
-	if(rv3d->rflag & RV3D_CLIPPING)
-		view3d_clr_clipping();
+	if (rv3d->rflag & RV3D_CLIPPING)
+		ED_view3d_clipping_disable();
 
 	/* it is important to end a view in a transform compatible with buttons */
 //	persp(PERSP_WIN);  // set ortho
@@ -1354,7 +1363,7 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d)
 
 void view3d_validate_backbuf(ViewContext *vc)
 {
-	if(vc->v3d->flag & V3D_INVALID_BACKBUF)
+	if (vc->v3d->flag & V3D_INVALID_BACKBUF)
 		backdrawview3d(vc->scene, vc->ar, vc->v3d);
 }
 
@@ -1363,16 +1372,16 @@ unsigned int view3d_sample_backbuf(ViewContext *vc, int x, int y)
 {
 	unsigned int col;
 	
-	if(x >= vc->ar->winx || y >= vc->ar->winy) return 0;
-	x+= vc->ar->winrct.xmin;
-	y+= vc->ar->winrct.ymin;
+	if (x >= vc->ar->winx || y >= vc->ar->winy) return 0;
+	x += vc->ar->winrct.xmin;
+	y += vc->ar->winrct.ymin;
 	
 	view3d_validate_backbuf(vc);
 
 	glReadPixels(x,  y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE,  &col);
 	glReadBuffer(GL_BACK);	
 	
-	if(ENDIAN_ORDER==B_ENDIAN) SWITCH_INT(col);
+	if (ENDIAN_ORDER == B_ENDIAN) SWITCH_INT(col);
 	
 	return WM_framebuffer_to_index(col);
 }
@@ -1386,47 +1395,47 @@ ImBuf *view3d_read_backbuf(ViewContext *vc, short xmin, short ymin, short xmax,
 	short xminc, yminc, xmaxc, ymaxc, xs, ys;
 	
 	/* clip */
-	if(xmin<0) xminc= 0; else xminc= xmin;
-	if(xmax >= vc->ar->winx) xmaxc= vc->ar->winx-1; else xmaxc= xmax;
-	if(xminc > xmaxc) return NULL;
+	if (xmin < 0) xminc = 0; else xminc = xmin;
+	if (xmax >= vc->ar->winx) xmaxc = vc->ar->winx - 1; else xmaxc = xmax;
+	if (xminc > xmaxc) return NULL;
 
-	if(ymin<0) yminc= 0; else yminc= ymin;
-	if(ymax >= vc->ar->winy) ymaxc= vc->ar->winy-1; else ymaxc= ymax;
-	if(yminc > ymaxc) return NULL;
+	if (ymin < 0) yminc = 0; else yminc = ymin;
+	if (ymax >= vc->ar->winy) ymaxc = vc->ar->winy - 1; else ymaxc = ymax;
+	if (yminc > ymaxc) return NULL;
 	
-	ibuf= IMB_allocImBuf((xmaxc-xminc+1), (ymaxc-yminc+1), 32, IB_rect);
+	ibuf = IMB_allocImBuf((xmaxc - xminc + 1), (ymaxc - yminc + 1), 32, IB_rect);
 
 	view3d_validate_backbuf(vc); 
 	
 	glReadPixels(vc->ar->winrct.xmin + xminc,
 	             vc->ar->winrct.ymin + yminc,
-	             (xmaxc-xminc + 1),
-	             (ymaxc-yminc + 1),
+	             (xmaxc - xminc + 1),
+	             (ymaxc - yminc + 1),
 	             GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
 
 	glReadBuffer(GL_BACK);	
 
-	if(ENDIAN_ORDER==B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf);
+	if (ENDIAN_ORDER == B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf);
 
-	a= (xmaxc-xminc+1)*(ymaxc-yminc+1);
-	dr= ibuf->rect;
-	while(a--) {
-		if(*dr) *dr= WM_framebuffer_to_index(*dr);
+	a = (xmaxc - xminc + 1) * (ymaxc - yminc + 1);
+	dr = ibuf->rect;
+	while (a--) {
+		if (*dr) *dr = WM_framebuffer_to_index(*dr);
 		dr++;
 	}
 	
 	/* put clipped result back, if needed */
-	if(xminc==xmin && xmaxc==xmax && yminc==ymin && ymaxc==ymax) 
+	if (xminc == xmin && xmaxc == xmax && yminc == ymin && ymaxc == ymax)
 		return ibuf;
 	
-	ibuf1= IMB_allocImBuf( (xmax-xmin+1),(ymax-ymin+1),32,IB_rect);
-	rd= ibuf->rect;
-	dr= ibuf1->rect;
-		
-	for(ys= ymin; ys<=ymax; ys++) {
-		for(xs= xmin; xs<=xmax; xs++, dr++) {
-			if( xs>=xminc && xs<=xmaxc && ys>=yminc && ys<=ymaxc) {
-				*dr= *rd;
+	ibuf1 = IMB_allocImBuf( (xmax - xmin + 1), (ymax - ymin + 1), 32, IB_rect);
+	rd = ibuf->rect;
+	dr = ibuf1->rect;
+
+	for (ys = ymin; ys <= ymax; ys++) {
+		for (xs = xmin; xs <= xmax; xs++, dr++) {
+			if (xs >= xminc && xs <= xmaxc && ys >= yminc && ys <= ymaxc) {
+				*dr = *rd;
 				rd++;
 			}
 		}
@@ -1437,59 +1446,59 @@ 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, 
-										void *handle, unsigned int (*indextest)(void *handle, unsigned int index))
+                                        unsigned int min, unsigned int max, int *dist, short strict,
+                                        void *handle, unsigned int (*indextest)(void *handle, unsigned int index))
 {
 	struct ImBuf *buf;
 	unsigned int *bufmin, *bufmax, *tbuf;
 	int minx, miny;
 	int a, b, rc, nr, amount, dirvec[4][2];
-	int distance=0;
+	int distance = 0;
 	unsigned int index = 0;
 	short indexok = 0;	
 
-	amount= (size-1)/2;
+	amount = (size - 1) / 2;
 
-	minx = mval[0]-(amount+1);
-	miny = mval[1]-(amount+1);
-	buf = view3d_read_backbuf(vc, minx, miny, minx+size-1, miny+size-1);
+	minx = mval[0] - (amount + 1);
+	miny = mval[1] - (amount + 1);
+	buf = view3d_read_backbuf(vc, minx, miny, minx + size - 1, miny + size - 1);
 	if (!buf) return 0;
 
-	rc= 0;
+	rc = 0;
 	
-	dirvec[0][0]= 1; dirvec[0][1]= 0;
-	dirvec[1][0]= 0; dirvec[1][1]= -size;
-	dirvec[2][0]= -1; dirvec[2][1]= 0;
-	dirvec[3][0]= 0; dirvec[3][1]= size;
+	dirvec[0][0] = 1; dirvec[0][1] = 0;
+	dirvec[1][0] = 0; dirvec[1][1] = -size;
+	dirvec[2][0] = -1; dirvec[2][1] = 0;
+	dirvec[3][0] = 0; dirvec[3][1] = size;
 	
 	bufmin = buf->rect;
 	tbuf = buf->rect;
-	bufmax = buf->rect + size*size;
-	tbuf+= amount*size+ amount;
+	bufmax = buf->rect + size * size;
+	tbuf += amount * size + amount;
 	
-	for(nr=1; nr<=size; nr++) {
+	for (nr = 1; nr <= size; nr++) {
 		
-		for(a=0; a<2; a++) {
-			for(b=0; b<nr; b++, distance++) {
-				if (*tbuf && *tbuf>=min && *tbuf<max) { //we got a hit
-					if(strict){
-						indexok =  indextest(handle, *tbuf - min+1);
-						if(indexok){
-							*dist= (short) sqrt( (float)distance   );
-							index = *tbuf - min+1;
+		for (a = 0; a < 2; a++) {
+			for (b = 0; b < nr; b++, distance++) {
+				if (*tbuf && *tbuf >= min && *tbuf < max) { //we got a hit
+					if (strict) {
+						indexok =  indextest(handle, *tbuf - min + 1);
+						if (indexok) {
+							*dist = (short) sqrt( (float)distance);
+							index = *tbuf - min + 1;
 							goto exit; 
 						}						
 					}
-					else{
-						*dist= (short) sqrt( (float)distance ); // XXX, this distance is wrong - 
-						index = *tbuf - min+1; // messy yah, but indices start at 1
+					else {
+						*dist = (short) sqrt( (float)distance); // XXX, this distance is wrong -
+						index = *tbuf - min + 1; // messy yah, but indices start at 1
 						goto exit;
 					}			
 				}
 				
-				tbuf+= (dirvec[rc][0]+dirvec[rc][1]);
+				tbuf += (dirvec[rc][0] + dirvec[rc][1]);
 				
-				if(tbuf<bufmin || tbuf>=bufmax) {
+				if (tbuf < bufmin || tbuf >= bufmax) {
 					goto exit;
 				}
 			}
@@ -1506,135 +1515,140 @@ exit:
 
 /* ************************************************************* */
 
-static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
+static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, int foreground)
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 	BGpic *bgpic;
 	Image *ima;
 	MovieClip *clip;
-	ImBuf *ibuf= NULL, *freeibuf;
+	ImBuf *ibuf = NULL, *freeibuf;
 	float vec[4], fac, asp, zoomx, zoomy;
 	float x1, y1, x2, y2, cx, cy;
+	int fg_flag = foreground ? V3D_BGPIC_FOREGROUND : 0;
 
+	for (bgpic = v3d->bgpicbase.first; bgpic; bgpic = bgpic->next) {
 
-	for ( bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next ) {
+		if ((bgpic->flag & V3D_BGPIC_FOREGROUND) != fg_flag)
+			continue;
 
-		if(	(bgpic->view == 0) || /* zero for any */
-			(bgpic->view & (1<<rv3d->view)) || /* check agaist flags */
-			(rv3d->persp==RV3D_CAMOB && bgpic->view == (1<<RV3D_VIEW_CAMERA))
-		) {
+		if ((bgpic->view == 0) || /* zero for any */
+		    (bgpic->view & (1 << rv3d->view)) || /* check agaist flags */
+		    (rv3d->persp == RV3D_CAMOB && bgpic->view == (1 << RV3D_VIEW_CAMERA)))
+		{
 			/* disable individual images */
-			if((bgpic->flag&V3D_BGPIC_DISABLED))
+			if ((bgpic->flag & V3D_BGPIC_DISABLED))
 				continue;
 
-			freeibuf= NULL;
-			if(bgpic->source==V3D_BGPIC_IMAGE) {
-				ima= bgpic->ima;
-				if(ima==NULL)
+			freeibuf = NULL;
+			if (bgpic->source == V3D_BGPIC_IMAGE) {
+				ima = bgpic->ima;
+				if (ima == NULL)
 					continue;
 				BKE_image_user_calc_frame(&bgpic->iuser, CFRA, 0);
-				ibuf= BKE_image_get_ibuf(ima, &bgpic->iuser);
-			} else {
-				clip= NULL;
+				ibuf = BKE_image_get_ibuf(ima, &bgpic->iuser);
+			}
+			else {
+				clip = NULL;
 
-				if(bgpic->flag&V3D_BGPIC_CAMERACLIP) {
-					if(scene->camera)
-						clip= object_get_movieclip(scene, scene->camera, 1);
-				} else clip= bgpic->clip;
+				if (bgpic->flag & V3D_BGPIC_CAMERACLIP) {
+					if (scene->camera)
+						clip = object_get_movieclip(scene, scene->camera, 1);
+				}
+				else clip = bgpic->clip;
 
-				if(clip==NULL)
+				if (clip == NULL)
 					continue;
 
 				BKE_movieclip_user_set_frame(&bgpic->cuser, CFRA);
-				ibuf= BKE_movieclip_get_ibuf(clip, &bgpic->cuser);
+				ibuf = BKE_movieclip_get_ibuf(clip, &bgpic->cuser);
 
 				/* working with ibuf from image and clip has got different workflow now.
-				   ibuf acquired from clip is referenced by cache system and should
-				   be dereferenced after usage. */
-				freeibuf= ibuf;
+				 * ibuf acquired from clip is referenced by cache system and should
+				 * be dereferenced after usage. */
+				freeibuf = ibuf;
 			}
 
-			if(ibuf==NULL)
+			if (ibuf == NULL)
 				continue;
 
-			if((ibuf->rect==NULL && ibuf->rect_float==NULL) || ibuf->channels!=4) { /* invalid image format */
-				if(freeibuf)
+			if ((ibuf->rect == NULL && ibuf->rect_float == NULL) || ibuf->channels != 4) { /* invalid image format */
+				if (freeibuf)
 					IMB_freeImBuf(freeibuf);
 
 				continue;
 			}
 
-			if(ibuf->rect==NULL)
+			if (ibuf->rect == NULL)
 				IMB_rect_from_float(ibuf);
 
-			if(rv3d->persp==RV3D_CAMOB) {
+			if (rv3d->persp == RV3D_CAMOB) {
 				rctf vb;
 
 				ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, FALSE);
 
-				x1= vb.xmin;
-				y1= vb.ymin;
-				x2= vb.xmax;
-				y2= vb.ymax;
+				x1 = vb.xmin;
+				y1 = vb.ymin;
+				x2 = vb.xmax;
+				y2 = vb.ymax;
 			}
 			else {
 				float sco[2];
-				const float mval_f[2]= {1.0f, 0.0f};
+				const float mval_f[2] = {1.0f, 0.0f};
 
 				/* calc window coord */
 				initgrabz(rv3d, 0.0, 0.0, 0.0);
 				ED_view3d_win_to_delta(ar, mval_f, vec);
-				fac= MAX3( fabs(vec[0]), fabs(vec[1]), fabs(vec[1]) );
-				fac= 1.0f/fac;
+				fac = maxf(fabsf(vec[0]), maxf(fabsf(vec[1]), fabsf(vec[2]))); /* largest abs axis */
+				fac = 1.0f / fac;
 
-				asp= ( (float)ibuf->y)/(float)ibuf->x;
+				asp = ( (float)ibuf->y) / (float)ibuf->x;
 
-				vec[0] = vec[1] = vec[2] = 0.0;
-				ED_view3d_project_float(ar, vec, sco, rv3d->persmat);
+				zero_v3(vec);
+				ED_view3d_project_float_v2(ar, vec, sco, rv3d->persmat);
 				cx = sco[0];
 				cy = sco[1];
 
-				x1=  cx+ fac*(bgpic->xof-bgpic->size);
-				y1=  cy+ asp*fac*(bgpic->yof-bgpic->size);
-				x2=  cx+ fac*(bgpic->xof+bgpic->size);
-				y2=  cy+ asp*fac*(bgpic->yof+bgpic->size);
+				x1 =  cx + fac * (bgpic->xof - bgpic->size);
+				y1 =  cy + asp * fac * (bgpic->yof - bgpic->size);
+				x2 =  cx + fac * (bgpic->xof + bgpic->size);
+				y2 =  cy + asp * fac * (bgpic->yof + bgpic->size);
 			}
 
 			/* complete clip? */
 
-			if(x2 < 0 || y2 < 0 || x1 > ar->winx || y1 > ar->winy) {
-				if(freeibuf)
+			if (x2 < 0 || y2 < 0 || x1 > ar->winx || y1 > ar->winy) {
+				if (freeibuf)
 					IMB_freeImBuf(freeibuf);
 
 				continue;
 			}
 
-			zoomx= (x2-x1)/ibuf->x;
-			zoomy= (y2-y1)/ibuf->y;
+			zoomx = (x2 - x1) / ibuf->x;
+			zoomy = (y2 - y1) / ibuf->y;
 
 			/* for some reason; zoomlevels down refuses to use GL_ALPHA_SCALE */
-			if(zoomx < 1.0f || zoomy < 1.0f) {
-				float tzoom= MIN2(zoomx, zoomy);
-				int mip= 0;
+			if (zoomx < 1.0f || zoomy < 1.0f) {
+				float tzoom = MIN2(zoomx, zoomy);
+				int mip = 0;
 
-				if((ibuf->userflags&IB_MIPMAP_INVALID) != 0) {
+				if ((ibuf->userflags & IB_MIPMAP_INVALID) != 0) {
 					IMB_remakemipmap(ibuf, 0);
-					ibuf->userflags&= ~IB_MIPMAP_INVALID;
+					ibuf->userflags &= ~IB_MIPMAP_INVALID;
 				}
-				else if(ibuf->mipmap[0]==NULL)
+				else if (ibuf->mipmap[0] == NULL)
 					IMB_makemipmap(ibuf, 0);
 
-				while(tzoom < 1.0f && mip<8 && ibuf->mipmap[mip]) {
-					tzoom*= 2.0f;
-					zoomx*= 2.0f;
-					zoomy*= 2.0f;
+				while (tzoom < 1.0f && mip < 8 && ibuf->mipmap[mip]) {
+					tzoom *= 2.0f;
+					zoomx *= 2.0f;
+					zoomy *= 2.0f;
 					mip++;
 				}
-				if(mip>0)
-					ibuf= ibuf->mipmap[mip-1];
+				if (mip > 0)
+					ibuf = ibuf->mipmap[mip - 1];
 			}
 
-			if(v3d->zbuf) glDisable(GL_DEPTH_TEST);
+			if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
 			glDepthMask(0);
 
 			glEnable(GL_BLEND);
@@ -1647,7 +1661,7 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
 			ED_region_pixelspace(ar);
 
 			glPixelZoom(zoomx, zoomy);
-			glColor4f(1.0f, 1.0f, 1.0f, 1.0f-bgpic->blend);
+			glColor4f(1.0f, 1.0f, 1.0f, 1.0f - bgpic->blend);
 			glaDrawPixelsTex(x1, y1, ibuf->x, ibuf->y, GL_UNSIGNED_BYTE, ibuf->rect);
 
 			glPixelZoom(1.0, 1.0);
@@ -1661,14 +1675,34 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
 			glDisable(GL_BLEND);
 
 			glDepthMask(1);
-			if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+			if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
 
-			if(freeibuf)
+			if (freeibuf)
 				IMB_freeImBuf(freeibuf);
 		}
 	}
 }
 
+static void draw_bgpics(Scene *scene, ARegion *ar, View3D *v3d, int foreground)
+{
+	RegionView3D *rv3d = ar->regiondata;
+
+	if ((v3d->flag & V3D_DISPBGPICS) == 0)
+		return;
+
+	if (v3d->flag2 & V3D_RENDER_OVERRIDE)
+		return;
+
+	if ((rv3d->view == RV3D_VIEW_USER) || (rv3d->persp != RV3D_ORTHO)) {
+		if (rv3d->persp == RV3D_CAMOB) {
+			draw_bgpic(scene, ar, v3d, foreground);
+		}
+	}
+	else {
+			draw_bgpic(scene, ar, v3d, foreground);
+	}
+}
+
 /* ****************** View3d afterdraw *************** */
 
 typedef struct View3DAfter {
@@ -1680,10 +1714,10 @@ typedef struct View3DAfter {
 /* temp storage of Objects that need to be drawn as last */
 void add_view3d_after(ListBase *lb, Base *base, int flag)
 {
-	View3DAfter *v3da= MEM_callocN(sizeof(View3DAfter), "View 3d after");
+	View3DAfter *v3da = MEM_callocN(sizeof(View3DAfter), "View 3d after");
 	BLI_addtail(lb, v3da);
-	v3da->base= base;
-	v3da->flag= flag;
+	v3da->base = base;
+	v3da->flag = flag;
 }
 
 /* disables write in zbuffer and draws it over */
@@ -1692,15 +1726,15 @@ static void view3d_draw_transp(Scene *scene, ARegion *ar, View3D *v3d)
 	View3DAfter *v3da, *next;
 	
 	glDepthMask(0);
-	v3d->transp= TRUE;
+	v3d->transp = TRUE;
 	
-	for(v3da= v3d->afterdraw_transp.first; v3da; v3da= next) {
-		next= v3da->next;
+	for (v3da = v3d->afterdraw_transp.first; v3da; v3da = next) {
+		next = v3da->next;
 		draw_object(scene, ar, v3d, v3da->base, v3da->flag);
 		BLI_remlink(&v3d->afterdraw_transp, v3da);
 		MEM_freeN(v3da);
 	}
-	v3d->transp= FALSE;
+	v3d->transp = FALSE;
 	
 	glDepthMask(1);
 	
@@ -1711,17 +1745,17 @@ static void view3d_draw_xray(Scene *scene, ARegion *ar, View3D *v3d, int clear)
 {
 	View3DAfter *v3da, *next;
 
-	if(clear && v3d->zbuf)
+	if (clear && v3d->zbuf)
 		glClear(GL_DEPTH_BUFFER_BIT);
 
-	v3d->xray= TRUE;
-	for(v3da= v3d->afterdraw_xray.first; v3da; v3da= next) {
-		next= v3da->next;
+	v3d->xray = TRUE;
+	for (v3da = v3d->afterdraw_xray.first; v3da; v3da = next) {
+		next = v3da->next;
 		draw_object(scene, ar, v3d, v3da->base, v3da->flag);
 		BLI_remlink(&v3d->afterdraw_xray, v3da);
 		MEM_freeN(v3da);
 	}
-	v3d->xray= FALSE;
+	v3d->xray = FALSE;
 }
 
 
@@ -1730,40 +1764,40 @@ static void view3d_draw_xraytransp(Scene *scene, ARegion *ar, View3D *v3d, int c
 {
 	View3DAfter *v3da, *next;
 
-	if(clear && v3d->zbuf)
+	if (clear && v3d->zbuf)
 		glClear(GL_DEPTH_BUFFER_BIT);
 
-	v3d->xray= TRUE;
-	v3d->transp= TRUE;
+	v3d->xray = TRUE;
+	v3d->transp = TRUE;
 	
-	for(v3da= v3d->afterdraw_xraytransp.first; v3da; v3da= next) {
-		next= v3da->next;
+	for (v3da = v3d->afterdraw_xraytransp.first; v3da; v3da = next) {
+		next = v3da->next;
 		draw_object(scene, ar, v3d, v3da->base, v3da->flag);
 		BLI_remlink(&v3d->afterdraw_xraytransp, v3da);
 		MEM_freeN(v3da);
 	}
 
-	v3d->transp= FALSE;
-	v3d->xray= FALSE;
+	v3d->transp = FALSE;
+	v3d->xray = FALSE;
 
 }
 
 /* *********************** */
 
 /*
-	In most cases call draw_dupli_objects,
-	draw_dupli_objects_color was added because when drawing set dupli's
-	we need to force the color
+ * In most cases call draw_dupli_objects,
+ * draw_dupli_objects_color was added because when drawing set dupli's
+ * we need to force the color
  */
 
 #if 0
 int dupli_ob_sort(void *arg1, void *arg2)
 {
-	void *p1= ((DupliObject *)arg1)->ob;
-	void *p2= ((DupliObject *)arg2)->ob;
+	void *p1 = ((DupliObject *)arg1)->ob;
+	void *p2 = ((DupliObject *)arg2)->ob;
 	int val = 0;
-	if (p1 < p2)		val = -1;
-	else if (p1 > p2)	val = 1;
+	if (p1 < p2) val = -1;
+	else if (p1 > p2) val = 1;
 	return val;
 }
 #endif
@@ -1771,93 +1805,93 @@ int dupli_ob_sort(void *arg1, void *arg2)
 
 static DupliObject *dupli_step(DupliObject *dob)
 {
-	while(dob && dob->no_draw)
-		dob= dob->next;
+	while (dob && dob->no_draw)
+		dob = dob->next;
 	return dob;
 }
 
 static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int color)
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 	ListBase *lb;
-	DupliObject *dob_prev= NULL, *dob, *dob_next= NULL;
+	DupliObject *dob_prev = NULL, *dob, *dob_next = NULL;
 	Base tbase;
 	BoundBox bb, *bb_tmp; /* use a copy because draw_object, calls clear_mesh_caches */
-	GLuint displist=0;
-	short transflag, use_displist= -1;	/* -1 is initialize */
+	GLuint displist = 0;
+	short transflag, use_displist = -1;  /* -1 is initialize */
 	char dt, dtx;
 	
 	if (base->object->restrictflag & OB_RESTRICT_VIEW) return;
 	
-	tbase.flag= OB_FROMDUPLI|base->flag;
-	lb= object_duplilist(scene, base->object);
+	tbase.flag = OB_FROMDUPLI | base->flag;
+	lb = object_duplilist(scene, base->object);
 	// BLI_sortlist(lb, dupli_ob_sort); // might be nice to have if we have a dupli list with mixed objects.
 
-	dob=dupli_step(lb->first);
-	if(dob) dob_next= dupli_step(dob->next);
+	dob = dupli_step(lb->first);
+	if (dob) dob_next = dupli_step(dob->next);
 
-	for( ; dob ; dob_prev= dob, dob= dob_next, dob_next= dob_next ? dupli_step(dob_next->next) : NULL) {
-		tbase.object= dob->ob;
+	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;
+		dt = tbase.object->dt;   tbase.object->dt = MIN2(tbase.object->dt, base->object->dt);
+		dtx = tbase.object->dtx; tbase.object->dtx = base->object->dtx;
 
 		/* negative scale flag has to propagate */
-		transflag= tbase.object->transflag;
-		if(base->object->transflag & OB_NEG_SCALE)
+		transflag = tbase.object->transflag;
+		if (base->object->transflag & OB_NEG_SCALE)
 			tbase.object->transflag ^= OB_NEG_SCALE;
 
 		UI_ThemeColorBlend(color, TH_BACK, 0.5);
 
 		/* generate displist, test for new object */
-		if(dob_prev && dob_prev->ob != dob->ob) {
-			if(use_displist==1)
+		if (dob_prev && dob_prev->ob != dob->ob) {
+			if (use_displist == 1)
 				glDeleteLists(displist, 1);
 
-			use_displist= -1;
+			use_displist = -1;
 		}
 
 		/* generate displist */
-		if(use_displist == -1) {
+		if (use_displist == -1) {
 
 			/* note, since this was added, its checked dob->type==OB_DUPLIGROUP
 			 * however this is very slow, it was probably needed for the NLA
 			 * offset feature (used in group-duplicate.blend but no longer works in 2.5)
 			 * so for now it should be ok to - campbell */
 
-			if ( /* if this is the last no need  to make a displist */
-			     (dob_next==NULL || dob_next->ob != dob->ob) ||
-			     /* lamp drawing messes with matrices, could be handled smarter... but this works */
-			     (dob->ob->type == OB_LAMP) ||
-			     (dob->type == OB_DUPLIGROUP && dob->animated) ||
-			     !(bb_tmp= object_get_boundbox(dob->ob)))
+			if (/* if this is the last no need  to make a displist */
+			    (dob_next == NULL || dob_next->ob != dob->ob) ||
+			    /* lamp drawing messes with matrices, could be handled smarter... but this works */
+			    (dob->ob->type == OB_LAMP) ||
+			    (dob->type == OB_DUPLIGROUP && dob->animated) ||
+			    !(bb_tmp = object_get_boundbox(dob->ob)))
 			{
 				// printf("draw_dupli_objects_color: skipping displist for %s\n", dob->ob->id.name+2);
-				use_displist= 0;
+				use_displist = 0;
 			}
 			else {
 				// printf("draw_dupli_objects_color: using displist for %s\n", dob->ob->id.name+2);
-				bb= *bb_tmp; /* must make a copy  */
+				bb = *bb_tmp; /* must make a copy  */
 
 				/* disable boundbox check for list creation */
 				object_boundbox_flag(dob->ob, OB_BB_DISABLED, 1);
 				/* need this for next part of code */
-				unit_m4(dob->ob->obmat);	/* obmat gets restored */
+				unit_m4(dob->ob->obmat);    /* obmat gets restored */
 
-				displist= glGenLists(1);
+				displist = glGenLists(1);
 				glNewList(displist, GL_COMPILE);
 				draw_object(scene, ar, v3d, &tbase, DRAW_CONSTCOLOR);
 				glEndList();
 
-				use_displist= 1;
+				use_displist = 1;
 				object_boundbox_flag(dob->ob, OB_BB_DISABLED, 0);
 			}
 		}
-		if(use_displist) {
+		if (use_displist) {
 			glMultMatrixf(dob->mat);
-			if(ED_view3d_boundbox_clip(rv3d, dob->mat, &bb))
+			if (ED_view3d_boundbox_clip(rv3d, dob->mat, &bb))
 				glCallList(displist);
 			glLoadMatrixf(rv3d->viewmat);
 		}
@@ -1866,28 +1900,28 @@ static void draw_dupli_objects_color(Scene *scene, ARegion *ar, View3D *v3d, Bas
 			draw_object(scene, ar, v3d, &tbase, DRAW_CONSTCOLOR);
 		}
 
-		tbase.object->dt= dt;
-		tbase.object->dtx= dtx;
-		tbase.object->transflag= transflag;
+		tbase.object->dt = dt;
+		tbase.object->dtx = dtx;
+		tbase.object->transflag = transflag;
 	}
 	
 	/* Transp afterdraw disabled, afterdraw only stores base pointers, and duplis can be same obj */
 	
-	free_object_duplilist(lb);	/* does restore */
+	free_object_duplilist(lb);  /* does restore */
 	
-	if(use_displist)
+	if (use_displist)
 		glDeleteLists(displist, 1);
 }
 
 static void draw_dupli_objects(Scene *scene, ARegion *ar, View3D *v3d, Base *base)
 {
 	/* define the color here so draw_dupli_objects_color can be called
-	* from the set loop */
+	 * from the set loop */
 	
-	int color= (base->flag & SELECT)?TH_SELECT:TH_WIRE;
+	int color = (base->flag & SELECT) ? TH_SELECT : TH_WIRE;
 	/* debug */
-	if(base->object->dup_group && base->object->dup_group->id.us<1)
-		color= TH_REDALERT;
+	if (base->object->dup_group && base->object->dup_group->id.us < 1)
+		color = TH_REDALERT;
 	
 	draw_dupli_objects_color(scene, ar, v3d, base, color);
 }
@@ -1898,81 +1932,83 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect)
 	rcti r;
 	/* clamp rect by area */
 
-	r.xmin= 0;
-	r.xmax= ar->winx-1;
-	r.ymin= 0;
-	r.ymax= ar->winy-1;
+	r.xmin = 0;
+	r.xmax = ar->winx - 1;
+	r.ymin = 0;
+	r.ymax = ar->winy - 1;
 
 	/* Constrain rect to depth bounds */
 	BLI_isect_rcti(&r, rect, rect);
 
 	/* assign values to compare with the ViewDepths */
-	x= rect->xmin;
-	y= rect->ymin;
+	x = rect->xmin;
+	y = rect->ymin;
 
-	w= rect->xmax - rect->xmin;
-	h= rect->ymax - rect->ymin;
+	w = rect->xmax - rect->xmin;
+	h = rect->ymax - rect->ymin;
 
-	if(w <= 0 || h <= 0) {
-		if(d->depths)
+	if (w <= 0 || h <= 0) {
+		if (d->depths)
 			MEM_freeN(d->depths);
-		d->depths= NULL;
-
-		d->damaged= FALSE;
-	}
-	else if(	d->w != w ||
-		d->h != h ||
-		d->x != x ||
-		d->y != y ||
-		d->depths==NULL
-	) {
-		d->x= x;
-		d->y= y;
-		d->w= w;
-		d->h= h;
-
-		if(d->depths)
+		d->depths = NULL;
+
+		d->damaged = FALSE;
+	}
+	else if (d->w != w ||
+	         d->h != h ||
+	         d->x != x ||
+	         d->y != y ||
+	         d->depths == NULL
+	         )
+	{
+		d->x = x;
+		d->y = y;
+		d->w = w;
+		d->h = h;
+
+		if (d->depths)
 			MEM_freeN(d->depths);
 
-		d->depths= MEM_mallocN(sizeof(float)*d->w*d->h,"View depths Subset");
+		d->depths = MEM_mallocN(sizeof(float) * d->w * d->h, "View depths Subset");
 		
-		d->damaged= TRUE;
+		d->damaged = TRUE;
 	}
 
-	if(d->damaged) {
-		glReadPixels(ar->winrct.xmin+d->x,ar->winrct.ymin+d->y, d->w,d->h, GL_DEPTH_COMPONENT,GL_FLOAT, d->depths);
-		glGetDoublev(GL_DEPTH_RANGE,d->depth_range);
-		d->damaged= FALSE;
+	if (d->damaged) {
+		glReadPixels(ar->winrct.xmin + d->x, ar->winrct.ymin + d->y, d->w, d->h, GL_DEPTH_COMPONENT, GL_FLOAT, d->depths);
+		glGetDoublev(GL_DEPTH_RANGE, d->depth_range);
+		d->damaged = FALSE;
 	}
 }
 
 /* note, with nouveau drivers the glReadPixels() is very slow. [#24339] */
 void ED_view3d_depth_update(ARegion *ar)
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 	
 	/* Create storage for, and, if necessary, copy depth buffer */
-	if(!rv3d->depths) rv3d->depths= MEM_callocN(sizeof(ViewDepths),"ViewDepths");
-	if(rv3d->depths) {
-		ViewDepths *d= rv3d->depths;
-		if(d->w != ar->winx ||
-		   d->h != ar->winy ||
-		   !d->depths) {
-			d->w= ar->winx;
-			d->h= ar->winy;
-			if(d->depths)
+	if (!rv3d->depths) rv3d->depths = MEM_callocN(sizeof(ViewDepths), "ViewDepths");
+	if (rv3d->depths) {
+		ViewDepths *d = rv3d->depths;
+		if (d->w != ar->winx ||
+		    d->h != ar->winy ||
+		    !d->depths)
+		{
+			d->w = ar->winx;
+			d->h = ar->winy;
+			if (d->depths)
 				MEM_freeN(d->depths);
-			d->depths= MEM_mallocN(sizeof(float)*d->w*d->h,"View depths");
-			d->damaged= 1;
+			d->depths = MEM_mallocN(sizeof(float) * d->w * d->h, "View depths");
+			d->damaged = 1;
 		}
 		
-		if(d->damaged) {
-			glReadPixels(ar->winrct.xmin,ar->winrct.ymin,d->w,d->h,
-						 GL_DEPTH_COMPONENT,GL_FLOAT, d->depths);
+		if (d->damaged) {
+			glReadPixels(ar->winrct.xmin, ar->winrct.ymin, d->w, d->h,
+			             GL_DEPTH_COMPONENT, GL_FLOAT, d->depths);
 			
-			glGetDoublev(GL_DEPTH_RANGE,d->depth_range);
+			glGetDoublev(GL_DEPTH_RANGE, d->depth_range);
 			
-			d->damaged= 0;
+			d->damaged = 0;
 		}
 	}
 }
@@ -1981,20 +2017,20 @@ void ED_view3d_depth_update(ARegion *ar)
 float view3d_depth_near(ViewDepths *d)
 {
 	/* convert to float for comparisons */
-	const float near= (float)d->depth_range[0];
-	const float far_real= (float)d->depth_range[1];
-	float far= far_real;
+	const float near = (float)d->depth_range[0];
+	const float far_real = (float)d->depth_range[1];
+	float far = far_real;
 
-	const float *depths= d->depths;
-	float depth= FLT_MAX;
-	int i= (int)d->w * (int)d->h; /* cast to avoid short overflow */
+	const float *depths = d->depths;
+	float depth = FLT_MAX;
+	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. */	
-	while(i--) {
-		depth= *depths++;
-		if((depth < far) && (depth > near)) {
-			far= depth;
+	while (i--) {
+		depth = *depths++;
+		if ((depth < far) && (depth > near)) {
+			far = depth;
 		}
 	}
 
@@ -2003,11 +2039,11 @@ float view3d_depth_near(ViewDepths *d)
 
 void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d)
 {
-	short zbuf= v3d->zbuf;
-	RegionView3D *rv3d= ar->regiondata;
+	short zbuf = v3d->zbuf;
+	RegionView3D *rv3d = ar->regiondata;
 
-	setwinmatrixview3d(ar, v3d, NULL);	/* 0= no pick rect */
-	setviewmatrixview3d(scene, v3d, rv3d);	/* note: calls where_is_object for camera... */
+	setwinmatrixview3d(ar, v3d, NULL);  /* 0= no pick rect */
+	setviewmatrixview3d(scene, v3d, rv3d);  /* note: calls where_is_object for camera... */
 
 	mult_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat);
 	invert_m4_m4(rv3d->persinv, rv3d->persmat);
@@ -2017,32 +2053,32 @@ void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d)
 
 	glLoadMatrixf(rv3d->viewmat);
 
-	v3d->zbuf= TRUE;
+	v3d->zbuf = TRUE;
 	glEnable(GL_DEPTH_TEST);
 
 	draw_gpencil_view3d(scene, v3d, ar, 1);
 	
-	v3d->zbuf= zbuf;
+	v3d->zbuf = zbuf;
 
 }
 
-void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *))
+void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (*func)(void *))
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 	Base *base;
-	short zbuf= v3d->zbuf;
-	short flag= v3d->flag;
-	float glalphaclip= U.glalphaclip;
-	int obcenter_dia= U.obcenter_dia;
+	short zbuf = v3d->zbuf;
+	short flag = v3d->flag;
+	float glalphaclip = U.glalphaclip;
+	int obcenter_dia = U.obcenter_dia;
 	/* temp set drawtype to solid */
 	
 	/* Setting these temporarily is not nice */
 	v3d->flag &= ~V3D_SELECT_OUTLINE;
 	U.glalphaclip = 0.5; /* not that nice but means we wont zoom into billboards */
-	U.obcenter_dia= 0;
+	U.obcenter_dia = 0;
 	
-	setwinmatrixview3d(ar, v3d, NULL);	/* 0= no pick rect */
-	setviewmatrixview3d(scene, v3d, rv3d);	/* note: calls where_is_object for camera... */
+	setwinmatrixview3d(ar, v3d, NULL);  /* 0= no pick rect */
+	setviewmatrixview3d(scene, v3d, rv3d);  /* note: calls where_is_object for camera... */
 	
 	mult_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat);
 	invert_m4_m4(rv3d->persinv, rv3d->persmat);
@@ -2053,21 +2089,21 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *))
 	glLoadMatrixf(rv3d->viewmat);
 //	persp(PERSP_STORE);  // store correct view for persp(PERSP_VIEW) calls
 	
-	if(rv3d->rflag & RV3D_CLIPPING) {
-		view3d_set_clipping(rv3d);
+	if (rv3d->rflag & RV3D_CLIPPING) {
+		ED_view3d_clipping_set(rv3d);
 	}
 	
-	v3d->zbuf= TRUE;
+	v3d->zbuf = TRUE;
 	glEnable(GL_DEPTH_TEST);
 	
 	/* draw set first */
-	if(scene->set) {
+	if (scene->set) {
 		Scene *sce_iter;
-		for(SETLOOPER(scene->set, sce_iter, base)) {
-			if(v3d->lay & base->lay) {
+		for (SETLOOPER(scene->set, sce_iter, base)) {
+			if (v3d->lay & base->lay) {
 				if (func == NULL || func(base)) {
 					draw_object(scene, ar, v3d, base, 0);
-					if(base->object->transflag & OB_DUPLI) {
+					if (base->object->transflag & OB_DUPLI) {
 						draw_dupli_objects_color(scene, ar, v3d, base, TH_WIRE);
 					}
 				}
@@ -2075,11 +2111,11 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *))
 		}
 	}
 	
-	for(base= scene->base.first; base; base= base->next) {
-		if(v3d->lay & base->lay) {
+	for (base = scene->base.first; base; base = base->next) {
+		if (v3d->lay & base->lay) {
 			if (func == NULL || func(base)) {
 				/* dupli drawing */
-				if(base->object->transflag & OB_DUPLI) {
+				if (base->object->transflag & OB_DUPLI) {
 					draw_dupli_objects(scene, ar, v3d, base);
 				}
 				draw_object(scene, ar, v3d, base, 0);
@@ -2087,73 +2123,73 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *))
 		}
 	}
 	
-	/* this isnt that nice, draw xray objects as if they are normal */
-	if (	v3d->afterdraw_transp.first ||
-			v3d->afterdraw_xray.first || 
-			v3d->afterdraw_xraytransp.first
-	) {
+	/* this isn't that nice, draw xray objects as if they are normal */
+	if (v3d->afterdraw_transp.first ||
+	    v3d->afterdraw_xray.first ||
+	    v3d->afterdraw_xraytransp.first)
+	{
 		View3DAfter *v3da, *next;
 		int mask_orig;
 
-		v3d->xray= TRUE;
+		v3d->xray = TRUE;
 		
 		/* transp materials can change the depth mask, see #21388 */
 		glGetIntegerv(GL_DEPTH_WRITEMASK, &mask_orig);
 
 
-		if(v3d->afterdraw_xray.first || v3d->afterdraw_xraytransp.first) {
+		if (v3d->afterdraw_xray.first || v3d->afterdraw_xraytransp.first) {
 			glDepthFunc(GL_ALWAYS); /* always write into the depth bufer, overwriting front z values */
-			for(v3da= v3d->afterdraw_xray.first; v3da; v3da= next) {
-				next= v3da->next;
+			for (v3da = v3d->afterdraw_xray.first; v3da; v3da = next) {
+				next = v3da->next;
 				draw_object(scene, ar, v3d, v3da->base, 0);
 			}
 			glDepthFunc(GL_LEQUAL); /* Now write the depth buffer normally */
 		}
 
 		/* draw 3 passes, transp/xray/xraytransp */
-		v3d->xray= FALSE;
-		v3d->transp= TRUE;
-		for(v3da= v3d->afterdraw_transp.first; v3da; v3da= next) {
-			next= v3da->next;
+		v3d->xray = FALSE;
+		v3d->transp = TRUE;
+		for (v3da = v3d->afterdraw_transp.first; v3da; v3da = next) {
+			next = v3da->next;
 			draw_object(scene, ar, v3d, v3da->base, 0);
 			BLI_remlink(&v3d->afterdraw_transp, v3da);
 			MEM_freeN(v3da);
 		}
 
-		v3d->xray= TRUE;
-		v3d->transp= FALSE;  
-		for(v3da= v3d->afterdraw_xray.first; v3da; v3da= next) {
-			next= v3da->next;
+		v3d->xray = TRUE;
+		v3d->transp = FALSE;
+		for (v3da = v3d->afterdraw_xray.first; v3da; v3da = next) {
+			next = v3da->next;
 			draw_object(scene, ar, v3d, v3da->base, 0);
 			BLI_remlink(&v3d->afterdraw_xray, v3da);
 			MEM_freeN(v3da);
 		}
 
-		v3d->xray= TRUE;
-		v3d->transp= TRUE;
-		for(v3da= v3d->afterdraw_xraytransp.first; v3da; v3da= next) {
-			next= v3da->next;
+		v3d->xray = TRUE;
+		v3d->transp = TRUE;
+		for (v3da = v3d->afterdraw_xraytransp.first; v3da; v3da = next) {
+			next = v3da->next;
 			draw_object(scene, ar, v3d, v3da->base, 0);
 			BLI_remlink(&v3d->afterdraw_xraytransp, v3da);
 			MEM_freeN(v3da);
 		}
 
 		
-		v3d->xray= FALSE;
-		v3d->transp= FALSE;
+		v3d->xray = FALSE;
+		v3d->transp = FALSE;
 
 		glDepthMask(mask_orig);
 	}
 	
-	if(rv3d->rflag & RV3D_CLIPPING)
-		view3d_clr_clipping();
+	if (rv3d->rflag & RV3D_CLIPPING)
+		ED_view3d_clipping_disable();
 	
 	v3d->zbuf = zbuf;
-	if(!v3d->zbuf) glDisable(GL_DEPTH_TEST);
+	if (!v3d->zbuf) glDisable(GL_DEPTH_TEST);
 
 	U.glalphaclip = glalphaclip;
 	v3d->flag = flag;
-	U.obcenter_dia= obcenter_dia;
+	U.obcenter_dia = obcenter_dia;
 }
 
 typedef struct View3DShadow {
@@ -2165,17 +2201,17 @@ static void gpu_render_lamp_update(Scene *scene, View3D *v3d, Object *ob, Object
                                    float obmat[][4], ListBase *shadows)
 {
 	GPULamp *lamp;
-	Lamp *la = (Lamp*)ob->data;
+	Lamp *la = (Lamp *)ob->data;
 	View3DShadow *shadow;
 	
 	lamp = GPU_lamp_from_blender(scene, ob, par);
 	
-	if(lamp) {
+	if (lamp) {
 		GPU_lamp_update(lamp, ob->lay, (ob->restrictflag & OB_RESTRICT_RENDER), obmat);
 		GPU_lamp_update_colors(lamp, la->r, la->g, la->b, la->energy);
 		
-		if((ob->lay & v3d->lay) && GPU_lamp_has_shadow_buffer(lamp)) {
-			shadow= MEM_callocN(sizeof(View3DShadow), "View3DShadow");
+		if ((ob->lay & v3d->lay) && GPU_lamp_has_shadow_buffer(lamp)) {
+			shadow = MEM_callocN(sizeof(View3DShadow), "View3DShadow");
 			shadow->lamp = lamp;
 			BLI_addtail(shadows, shadow);
 		}
@@ -2190,21 +2226,21 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d)
 	Base *base;
 	Object *ob;
 	
-	shadows.first= shadows.last= NULL;
+	shadows.first = shadows.last = NULL;
 	
 	/* update lamp transform and gather shadow lamps */
-	for(SETLOOPER(scene, sce_iter, base)) {
-		ob= base->object;
+	for (SETLOOPER(scene, sce_iter, base)) {
+		ob = base->object;
 		
-		if(ob->type == OB_LAMP)
+		if (ob->type == OB_LAMP)
 			gpu_render_lamp_update(scene, v3d, ob, NULL, ob->obmat, &shadows);
 		
 		if (ob->transflag & OB_DUPLI) {
 			DupliObject *dob;
 			ListBase *lb = object_duplilist(scene, ob);
 			
-			for(dob=lb->first; dob; dob=dob->next)
-				if(dob->ob->type==OB_LAMP)
+			for (dob = lb->first; dob; dob = dob->next)
+				if (dob->ob->type == OB_LAMP)
 					gpu_render_lamp_update(scene, v3d, dob->ob, ob, dob->mat, &shadows);
 			
 			free_object_duplilist(lb);
@@ -2212,16 +2248,16 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d)
 	}
 	
 	/* render shadows after updating all lamps, nested object_duplilist
-		* don't work correct since it's replacing object matrices */
-	for(shadow=shadows.first; shadow; shadow=shadow->next) {
+	 * don't work correct since it's replacing object matrices */
+	for (shadow = shadows.first; shadow; shadow = shadow->next) {
 		/* this needs to be done better .. */
 		float viewmat[4][4], winmat[4][4];
-		int drawtype, lay, winsize, flag2=v3d->flag2;
-		ARegion ar= {NULL};
-		RegionView3D rv3d= {{{0}}};
+		int drawtype, lay, winsize, flag2 = v3d->flag2;
+		ARegion ar = {NULL};
+		RegionView3D rv3d = {{{0}}};
 		
-		drawtype= v3d->drawtype;
-		lay= v3d->lay;
+		drawtype = v3d->drawtype;
+		lay = v3d->lay;
 		
 		v3d->drawtype = OB_SOLID;
 		v3d->lay &= GPU_lamp_shadow_layer(shadow->lamp);
@@ -2230,20 +2266,20 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d)
 		
 		GPU_lamp_shadow_buffer_bind(shadow->lamp, viewmat, &winsize, winmat);
 
-		ar.regiondata= &rv3d;
-		ar.regiontype= RGN_TYPE_WINDOW;
-		rv3d.persp= RV3D_CAMOB;
+		ar.regiondata = &rv3d;
+		ar.regiontype = RGN_TYPE_WINDOW;
+		rv3d.persp = RV3D_CAMOB;
 		copy_m4_m4(rv3d.winmat, winmat);
 		copy_m4_m4(rv3d.viewmat, viewmat);
 		invert_m4_m4(rv3d.viewinv, rv3d.viewmat);
 		mult_m4_m4m4(rv3d.persmat, rv3d.winmat, rv3d.viewmat);
 		invert_m4_m4(rv3d.persinv, rv3d.viewinv);
 
-		ED_view3d_draw_offscreen(scene, v3d, &ar, winsize, winsize, viewmat, winmat);
+		ED_view3d_draw_offscreen(scene, v3d, &ar, winsize, winsize, viewmat, winmat, FALSE);
 		GPU_lamp_shadow_buffer_unbind(shadow->lamp);
 		
-		v3d->drawtype= drawtype;
-		v3d->lay= lay;
+		v3d->drawtype = drawtype;
+		v3d->lay = lay;
 		v3d->flag2 = flag2;
 	}
 	
@@ -2254,19 +2290,19 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d)
 
 CustomDataMask ED_view3d_datamask(Scene *scene, View3D *v3d)
 {
-	CustomDataMask mask= 0;
+	CustomDataMask mask = 0;
 
-	if ( ELEM(v3d->drawtype, OB_TEXTURE, OB_MATERIAL) ||
-	     ((v3d->drawtype == OB_SOLID) && (v3d->flag2 & V3D_SOLID_TEX)))
+	if (ELEM(v3d->drawtype, OB_TEXTURE, OB_MATERIAL) ||
+	    ((v3d->drawtype == OB_SOLID) && (v3d->flag2 & V3D_SOLID_TEX)))
 	{
 		mask |= CD_MASK_MTFACE | CD_MASK_MCOL;
 
-		if(scene_use_new_shading_nodes(scene)) {
-			if(v3d->drawtype == OB_MATERIAL)
+		if (scene_use_new_shading_nodes(scene)) {
+			if (v3d->drawtype == OB_MATERIAL)
 				mask |= CD_MASK_ORCO;
 		}
 		else {
-			if(scene->gm.matmode == GAME_MAT_GLSL)
+			if (scene->gm.matmode == GAME_MAT_GLSL)
 				mask |= CD_MASK_ORCO;
 		}
 	}
@@ -2276,8 +2312,8 @@ CustomDataMask ED_view3d_datamask(Scene *scene, View3D *v3d)
 
 CustomDataMask ED_view3d_object_datamask(Scene *scene)
 {
-	Object *ob= scene->basact ? scene->basact->object : NULL;
-	CustomDataMask mask= 0;
+	Object *ob = scene->basact ? scene->basact->object : NULL;
+	CustomDataMask mask = 0;
 
 	if (ob) {
 		/* check if we need tfaces & mcols due to face select or texture paint */
@@ -2291,7 +2327,7 @@ CustomDataMask ED_view3d_object_datamask(Scene *scene)
 		}
 
 		if (ob->mode & OB_MODE_WEIGHT_PAINT) {
-			mask |= CD_MASK_WEIGHT_MCOL;
+			mask |= CD_MASK_PREVIEW_MCOL;
 		}
 	}
 
@@ -2301,13 +2337,13 @@ CustomDataMask ED_view3d_object_datamask(Scene *scene)
 /* goes over all modes and view3d settings */
 CustomDataMask ED_view3d_screen_datamask(bScreen *screen)
 {
-	Scene *scene= screen->scene;
+	Scene *scene = screen->scene;
 	CustomDataMask mask = CD_MASK_BAREMESH;
 	ScrArea *sa;
 	
 	/* check if we need tfaces & mcols due to view mode */
-	for(sa = screen->areabase.first; sa; sa = sa->next) {
-		if(sa->spacetype == SPACE_VIEW3D) {
+	for (sa = screen->areabase.first; sa; sa = sa->next) {
+		if (sa->spacetype == SPACE_VIEW3D) {
 			mask |= ED_view3d_datamask(scene, (View3D *)sa->spacedata.first);
 		}
 	}
@@ -2317,22 +2353,22 @@ CustomDataMask ED_view3d_screen_datamask(bScreen *screen)
 	return mask;
 }
 
-static void view3d_main_area_setup_view(Scene *scene, View3D *v3d, ARegion *ar, float viewmat[][4], float winmat[][4])
+void ED_view3d_update_viewmat(Scene *scene, View3D *v3d, ARegion *ar, float viewmat[][4], float winmat[][4])
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 
 	/* setup window matrices */
-	if(winmat)
+	if (winmat)
 		copy_m4_m4(rv3d->winmat, winmat);
 	else
-		setwinmatrixview3d(ar, v3d, NULL); /* NULL= no pickrect */
-	
+		setwinmatrixview3d(ar, v3d, NULL);  /* NULL= no pickrect */
+
 	/* setup view matrix */
-	if(viewmat)
+	if (viewmat)
 		copy_m4_m4(rv3d->viewmat, viewmat);
 	else
-		setviewmatrixview3d(scene, v3d, rv3d);	/* note: calls where_is_object for camera... */
-	
+		setviewmatrixview3d(scene, v3d, rv3d);  /* note: calls where_is_object for camera... */
+
 	/* update utilitity matrices */
 	mult_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat);
 	invert_m4_m4(rv3d->persinv, rv3d->persmat);
@@ -2345,19 +2381,26 @@ static void view3d_main_area_setup_view(Scene *scene, View3D *v3d, ARegion *ar,
 		float v1[3], v2[3];
 		float len1, len2;
 
-		v1[0]= rv3d->persmat[0][0];
-		v1[1]= rv3d->persmat[1][0];
-		v1[2]= rv3d->persmat[2][0];
+		v1[0] = rv3d->persmat[0][0];
+		v1[1] = rv3d->persmat[1][0];
+		v1[2] = rv3d->persmat[2][0];
 
-		v2[0]= rv3d->persmat[0][1];
-		v2[1]= rv3d->persmat[1][1];
-		v2[2]= rv3d->persmat[2][1];
-		
-		len1= 1.0f / len_v3(v1);
-		len2= 1.0f / len_v3(v2);
+		v2[0] = rv3d->persmat[0][1];
+		v2[1] = rv3d->persmat[1][1];
+		v2[2] = rv3d->persmat[2][1];
+
+		len1 = 1.0f / len_v3(v1);
+		len2 = 1.0f / len_v3(v2);
 
 		rv3d->pixsize = (2.0f * MAX2(len1, len2)) / (float)MAX2(ar->winx, ar->winy);
 	}
+}
+
+static void view3d_main_area_setup_view(Scene *scene, View3D *v3d, ARegion *ar, float viewmat[][4], float winmat[][4])
+{
+	RegionView3D *rv3d = ar->regiondata;
+
+	ED_view3d_update_viewmat(scene, v3d, ar, viewmat, winmat);
 
 	/* set for opengl */
 	glMatrixMode(GL_PROJECTION);
@@ -2367,27 +2410,29 @@ static void view3d_main_area_setup_view(Scene *scene, View3D *v3d, ARegion *ar,
 }
 
 void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar,
-                              int winx, int winy, float viewmat[][4], float winmat[][4])
+                              int winx, int winy, float viewmat[][4], float winmat[][4],
+                              int draw_background)
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 	Base *base;
 	float backcol[3];
 	int bwinx, bwiny;
 	rcti brect;
+	ImBuf *bg_ibuf = NULL;
 
 	glPushMatrix();
 
 	/* set temporary new size */
-	bwinx= ar->winx;
-	bwiny= ar->winy;
-	brect= ar->winrct;
+	bwinx = ar->winx;
+	bwiny = ar->winy;
+	brect = ar->winrct;
 	
-	ar->winx= winx;
-	ar->winy= winy;	
-	ar->winrct.xmin= 0;
-	ar->winrct.ymin= 0;
-	ar->winrct.xmax= winx;
-	ar->winrct.ymax= winy;
+	ar->winx = winx;
+	ar->winy = winy;
+	ar->winrct.xmin = 0;
+	ar->winrct.ymin = 0;
+	ar->winrct.xmax = winx;
+	ar->winrct.ymax = winy;
 	
 	
 	/* set flags */
@@ -2398,59 +2443,106 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar,
 	GPU_free_images_anim();
 	
 	/* shadow buffers, before we setup matrices */
-	if(draw_glsl_material(scene, NULL, v3d, v3d->drawtype))
+	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(scene->world) {
-		if(scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
-			linearrgb_to_srgb_v3_v3(backcol, &scene->world->horr);
-		else
-			copy_v3_v3(backcol, &scene->world->horr);
-		glClearColor(backcol[0], backcol[1], backcol[2], 0.0);
+	/* if scene has got active clip, use it for render backdrop */
+	if (draw_background && scene->clip && rv3d->persp == RV3D_CAMOB && v3d->camera) {
+		MovieClipUser user = {0};
+
+		BKE_movieclip_user_set_frame(&user, CFRA);
+		bg_ibuf = BKE_movieclip_get_ibuf(scene->clip, &user);
 	}
-	else {
-		UI_ThemeClearColor(TH_BACK);	
+
+	if (!bg_ibuf) {
+		/* 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) */
+		if (scene->world) {
+			if (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
+				linearrgb_to_srgb_v3_v3(backcol, &scene->world->horr);
+			else
+				copy_v3_v3(backcol, &scene->world->horr);
+			glClearColor(backcol[0], backcol[1], backcol[2], 0.0);
+		}
+		else {
+			UI_ThemeClearColor(TH_BACK);
+		}
 	}
 
-	glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
+	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+	if (bg_ibuf) {
+		unsigned char *pixels, *cp, *dst_cp;
+		int i;
+
+		if (bg_ibuf->rect_float && !bg_ibuf->rect)
+			IMB_rect_from_float(bg_ibuf);
+
+		dst_cp = pixels = MEM_callocN(4 * sizeof(unsigned char) * bg_ibuf->x * bg_ibuf->y, "draw offscreen clip pixels");
+		cp = (unsigned char *)bg_ibuf->rect;
+		for (i = 0; i < bg_ibuf->x * bg_ibuf->y; i++, cp += 4, dst_cp += 4) {
+			dst_cp[0] = cp[0];
+			dst_cp[1] = cp[1];
+			dst_cp[2] = cp[2];
+			dst_cp[3] = 255;
+		}
+
+		glMatrixMode(GL_PROJECTION);
+		glPushMatrix();
+		glMatrixMode(GL_MODELVIEW);
+		glPushMatrix();
+		ED_region_pixelspace(ar);
+
+		glPixelZoom((float)winx / bg_ibuf->x, (float)winy / bg_ibuf->y);
+		glaDrawPixelsTex(0, 0, bg_ibuf->x, bg_ibuf->y, GL_UNSIGNED_BYTE, pixels);
+
+		glPixelZoom(1.0, 1.0);
+
+		glMatrixMode(GL_PROJECTION);
+		glPopMatrix();
+		glMatrixMode(GL_MODELVIEW);
+		glPopMatrix();
+
+		IMB_freeImBuf(bg_ibuf);
+		MEM_freeN(pixels);
+	}
 
 	/* setup view matrices */
 	view3d_main_area_setup_view(scene, v3d, ar, viewmat, winmat);
 
-	if(rv3d->rflag & RV3D_CLIPPING)
+	if (rv3d->rflag & RV3D_CLIPPING)
 		view3d_draw_clipping(rv3d);
 
 	/* set zbuffer */
-	if(v3d->drawtype > OB_WIRE) {
-		v3d->zbuf= TRUE;
+	if (v3d->drawtype > OB_WIRE) {
+		v3d->zbuf = TRUE;
 		glEnable(GL_DEPTH_TEST);
 	}
 	else
-		v3d->zbuf= FALSE;
+		v3d->zbuf = FALSE;
 
-	if(rv3d->rflag & RV3D_CLIPPING)
-		view3d_set_clipping(rv3d);
+	if (rv3d->rflag & RV3D_CLIPPING)
+		ED_view3d_clipping_set(rv3d);
 
 	/* draw set first */
-	if(scene->set) {
+	if (scene->set) {
 		Scene *sce_iter;
-		for(SETLOOPER(scene->set, sce_iter, base)) {
-			if(v3d->lay & base->lay) {
+		for (SETLOOPER(scene->set, sce_iter, base)) {
+			if (v3d->lay & base->lay) {
 				UI_ThemeColorBlend(TH_WIRE, TH_BACK, 0.6f);
-				draw_object(scene, ar, v3d, base, DRAW_CONSTCOLOR|DRAW_SCENESET);
+				draw_object(scene, ar, v3d, base, DRAW_CONSTCOLOR | DRAW_SCENESET);
 				
-				if(base->object->transflag & OB_DUPLI)
+				if (base->object->transflag & OB_DUPLI)
 					draw_dupli_objects_color(scene, ar, v3d, base, TH_WIRE);
 			}
 		}
 	}
 	
 	/* then draw not selected and the duplis, but skip editmode object */
-	for(base= scene->base.first; base; base= base->next) {
-		if(v3d->lay & base->lay) {
+	for (base = scene->base.first; base; base = base->next) {
+		if (v3d->lay & base->lay) {
 			/* dupli drawing */
-			if(base->object->transflag & OB_DUPLI)
+			if (base->object->transflag & OB_DUPLI)
 				draw_dupli_objects(scene, ar, v3d, base);
 
 			draw_object(scene, ar, v3d, base, 0);
@@ -2458,21 +2550,21 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar,
 	}
 
 	/* must be before xray draw which clears the depth buffer */
-	if(v3d->zbuf) glDisable(GL_DEPTH_TEST);
+	if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
 	draw_gpencil_view3d(scene, v3d, ar, 1);
-	if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+	if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
 
 	/* transp and X-ray afterdraw stuff */
-	if(v3d->afterdraw_transp.first)		view3d_draw_transp(scene, ar, v3d);
-	if(v3d->afterdraw_xray.first)		view3d_draw_xray(scene, ar, v3d, 1);	// clears zbuffer if it is used!
-	if(v3d->afterdraw_xraytransp.first)	view3d_draw_xraytransp(scene, ar, v3d, 1);
+	if (v3d->afterdraw_transp.first)     view3d_draw_transp(scene, ar, v3d);
+	if (v3d->afterdraw_xray.first)       view3d_draw_xray(scene, ar, v3d, 1);         // clears zbuffer if it is used!
+	if (v3d->afterdraw_xraytransp.first) view3d_draw_xraytransp(scene, ar, v3d, 1);
 
-	if(rv3d->rflag & RV3D_CLIPPING)
-		view3d_clr_clipping();
+	if (rv3d->rflag & RV3D_CLIPPING)
+		ED_view3d_clipping_disable();
 
 	/* cleanup */
-	if(v3d->zbuf) {
-		v3d->zbuf= FALSE;
+	if (v3d->zbuf) {
+		v3d->zbuf = FALSE;
 		glDisable(GL_DEPTH_TEST);
 	}
 
@@ -2486,8 +2578,8 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar,
 	GPU_free_images_anim();
 
 	/* restore size */
-	ar->winx= bwinx;
-	ar->winy= bwiny;
+	ar->winx = bwinx;
+	ar->winy = bwiny;
 	ar->winrct = brect;
 
 	glPopMatrix();
@@ -2500,9 +2592,9 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar,
 
 /* utility func for ED_view3d_draw_offscreen */
 ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar,
-                                      int sizex, int sizey, unsigned int flag, char err_out[256])
+                                      int sizex, int sizey, unsigned int flag, int draw_background, char err_out[256])
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 	ImBuf *ibuf;
 	GPUOffScreen *ofs;
 	
@@ -2510,14 +2602,14 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar,
 	glPushAttrib(GL_LIGHTING_BIT);
 
 	/* bind */
-	ofs= GPU_offscreen_create(sizex, sizey, err_out);
-	if(ofs == NULL)
+	ofs = GPU_offscreen_create(sizex, sizey, err_out);
+	if (ofs == NULL)
 		return NULL;
 
 	GPU_offscreen_bind(ofs);
 
 	/* render 3d view */
-	if(rv3d->persp==RV3D_CAMOB && v3d->camera) {
+	if (rv3d->persp == RV3D_CAMOB && v3d->camera) {
 		CameraParams params;
 
 		camera_params_init(&params);
@@ -2525,21 +2617,21 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar,
 		camera_params_compute_viewplane(&params, sizex, sizey, scene->r.xasp, scene->r.yasp);
 		camera_params_compute_matrix(&params);
 
-		ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, params.winmat);
+		ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, params.winmat, draw_background);
 	}
 	else {
-		ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, NULL);
+		ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, NULL, draw_background);
 	}
 
 	/* read in pixels & stamp */
-	ibuf= IMB_allocImBuf(sizex, sizey, 32, flag);
+	ibuf = IMB_allocImBuf(sizex, sizey, 32, flag);
 
-	if(ibuf->rect_float)
+	if (ibuf->rect_float)
 		GPU_offscreen_read_pixels(ofs, GL_FLOAT, ibuf->rect_float);
-	else if(ibuf->rect)
+	else if (ibuf->rect)
 		GPU_offscreen_read_pixels(ofs, GL_UNSIGNED_BYTE, ibuf->rect);
 	
-	//if((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW))
+	//if ((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW))
 	//	BKE_stamp_buf(scene, NULL, rr->rectf, rr->rectx, rr->recty, 4);
 
 	/* unbind */
@@ -2548,7 +2640,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar,
 
 	glPopAttrib();
 	
-	if(ibuf->rect_float && ibuf->rect)
+	if (ibuf->rect_float && ibuf->rect)
 		IMB_rect_from_float(ibuf);
 	
 	return ibuf;
@@ -2556,23 +2648,23 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar,
 
 /* creates own 3d views, used by the sequencer */
 ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, Object *camera, int width, int height,
-                                             unsigned int flag, int drawtype, char err_out[256])
+                                             unsigned int flag, int drawtype, int draw_background, char err_out[256])
 {
-	View3D v3d= {NULL};
-	ARegion ar= {NULL};
-	RegionView3D rv3d= {{{0}}};
+	View3D v3d = {NULL};
+	ARegion ar = {NULL};
+	RegionView3D rv3d = {{{0}}};
 
 	/* connect data */
-	v3d.regionbase.first= v3d.regionbase.last= &ar;
-	ar.regiondata= &rv3d;
-	ar.regiontype= RGN_TYPE_WINDOW;
+	v3d.regionbase.first = v3d.regionbase.last = &ar;
+	ar.regiondata = &rv3d;
+	ar.regiontype = RGN_TYPE_WINDOW;
 
-	v3d.camera= camera;
-	v3d.lay= scene->lay;
+	v3d.camera = camera;
+	v3d.lay = scene->lay;
 	v3d.drawtype = drawtype;
 	v3d.flag2 = V3D_RENDER_OVERRIDE;
 
-	rv3d.persp= RV3D_CAMOB;
+	rv3d.persp = RV3D_CAMOB;
 
 	copy_m4_m4(rv3d.viewinv, v3d.camera->obmat);
 	normalize_m4(rv3d.viewinv);
@@ -2587,15 +2679,15 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, Object *camera, int w
 		camera_params_compute_matrix(&params);
 
 		copy_m4_m4(rv3d.winmat, params.winmat);
-		v3d.near= params.clipsta;
-		v3d.far= params.clipend;
-		v3d.lens= params.lens;
+		v3d.near = params.clipsta;
+		v3d.far = params.clipend;
+		v3d.lens = params.lens;
 	}
 
 	mult_m4_m4m4(rv3d.persmat, rv3d.winmat, rv3d.viewmat);
 	invert_m4_m4(rv3d.persinv, rv3d.viewinv);
 
-	return ED_view3d_draw_offscreen_imbuf(scene, &v3d, &ar, width, height, flag, err_out);
+	return ED_view3d_draw_offscreen_imbuf(scene, &v3d, &ar, width, height, flag, draw_background, err_out);
 
 	// seq_view3d_cb(scene, cfra, render_size, seqrectx, seqrecty);
 }
@@ -2606,7 +2698,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, Object *camera, int w
  */
 static void draw_viewport_fps(Scene *scene, ARegion *ar)
 {
-	ScreenFrameRateInfo *fpsi= scene->fps_info;
+	ScreenFrameRateInfo *fpsi = scene->fps_info;
 	float fps;
 	char printable[16];
 	int i, tot;
@@ -2618,11 +2710,11 @@ static void draw_viewport_fps(Scene *scene, ARegion *ar)
 	
 #if 0
 	/* this is too simple, better do an average */
-	fps = (float)(1.0/(fpsi->lredrawtime-fpsi->redrawtime))
+	fps = (float)(1.0 / (fpsi->lredrawtime - fpsi->redrawtime))
 #else
-	fpsi->redrawtimes_fps[fpsi->redrawtime_index] = (float)(1.0/(fpsi->lredrawtime-fpsi->redrawtime));
+	fpsi->redrawtimes_fps[fpsi->redrawtime_index] = (float)(1.0 / (fpsi->lredrawtime - fpsi->redrawtime));
 	
-	for (i=0, tot=0, fps=0.0f ; i < REDRAW_FRAME_AVERAGE ; i++) {
+	for (i = 0, tot = 0, fps = 0.0f; i < REDRAW_FRAME_AVERAGE; i++) {
 		if (fpsi->redrawtimes_fps[i]) {
 			fps += fpsi->redrawtimes_fps[i];
 			tot++;
@@ -2639,52 +2731,64 @@ static void draw_viewport_fps(Scene *scene, ARegion *ar)
 	}
 #endif
 
-	/* is this more then half a frame behind? */
-	if (fps+0.5f < (float)(FPS)) {
+	      /* is this more then half a frame behind? */
+	      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));
+		BLI_snprintf(printable, sizeof(printable), "fps: %i", (int)(fps + 0.5f));
 	}
 	
-	BLF_draw_default_ascii(22,  ar->winy-17, 0.0f, printable, sizeof(printable));
+	BLF_draw_default_ascii(22,  ar->winy - 17, 0.0f, printable, sizeof(printable));
 }
 
 static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar)
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	View3D *v3d = CTX_wm_view3d(C);
-	RegionView3D *rv3d= CTX_wm_region_view3d(C);
+	RegionView3D *rv3d = CTX_wm_region_view3d(C);
 	RenderEngineType *type;
 
-	if(!rv3d->render_engine) {
-		type= RE_engines_find(scene->r.engine);
+	/* create render engine */
+	if (!rv3d->render_engine) {
+		type = RE_engines_find(scene->r.engine);
 
-		if(!(type->view_update && type->view_draw))
+		if (!(type->view_update && type->view_draw))
 			return 0;
 
-		rv3d->render_engine= RE_engine_create(type);
+		rv3d->render_engine = RE_engine_create(type);
 		type->view_update(rv3d->render_engine, C);
 	}
 
+	/* setup view matrices */
 	view3d_main_area_setup_view(scene, v3d, ar, NULL, NULL);
 
+	/* background draw */
 	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
-	glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
+	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
 	ED_region_pixelspace(ar);
 
-	type= rv3d->render_engine->type;
+	/* render result draw */
+	if (v3d->flag & V3D_DISPBGPICS)
+		draw_bgpic(scene, ar, v3d, FALSE);
+	else
+		fdrawcheckerboard(0, 0, ar->winx, ar->winy);
+
+	type = rv3d->render_engine->type;
 	type->view_draw(rv3d->render_engine, C);
 
+	if (v3d->flag & V3D_DISPBGPICS)
+		draw_bgpic(scene, ar, v3d, TRUE);
+
 	return 1;
 }
 
 static void view3d_main_area_draw_engine_info(RegionView3D *rv3d, ARegion *ar)
 {
-	if(!rv3d->render_engine || !rv3d->render_engine->text)
+	if (!rv3d->render_engine || !rv3d->render_engine->text)
 		return;
 
 	ED_region_info_draw(ar, rv3d->render_engine->text, 1, 0.25);
@@ -2693,15 +2797,15 @@ static void view3d_main_area_draw_engine_info(RegionView3D *rv3d, ARegion *ar)
 /* warning: this function has duplicate drawing in ED_view3d_draw_offscreen() */
 static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const char **grid_unit)
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	View3D *v3d = CTX_wm_view3d(C);
-	RegionView3D *rv3d= CTX_wm_region_view3d(C);
+	RegionView3D *rv3d = CTX_wm_region_view3d(C);
 	Base *base;
 	float backcol[3];
 	unsigned int lay_used;
 
 	/* shadow buffers, before we setup matrices */
-	if(draw_glsl_material(scene, NULL, v3d, v3d->drawtype))
+	if (draw_glsl_material(scene, NULL, v3d, v3d->drawtype))
 		gpu_update_lamps_shadows(scene, v3d);
 	
 	/* reset default OpenGL lights if needed (i.e. after preferences have been altered) */
@@ -2711,8 +2815,8 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
 	}
 
 	/* clear background */
-	if((v3d->flag2 & V3D_RENDER_OVERRIDE) && scene->world) {
-		if(scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
+	if ((v3d->flag2 & V3D_RENDER_OVERRIDE) && scene->world) {
+		if (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT)
 			linearrgb_to_srgb_v3_v3(backcol, &scene->world->horr);
 		else
 			copy_v3_v3(backcol, &scene->world->horr);
@@ -2721,49 +2825,48 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
 	else
 		UI_ThemeClearColor(TH_BACK);
 
-	glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
+	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 	
 	/* setup view matrices */
 	view3d_main_area_setup_view(scene, v3d, ar, NULL, NULL);
 
 	ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW);
 
-	if(rv3d->rflag & RV3D_CLIPPING)
+	if (rv3d->rflag & RV3D_CLIPPING)
 		view3d_draw_clipping(rv3d);
 	
 	/* set zbuffer after we draw clipping region */
-	if(v3d->drawtype > OB_WIRE) {
-		v3d->zbuf= TRUE;
+	if (v3d->drawtype > OB_WIRE) {
+		v3d->zbuf = TRUE;
 		glEnable(GL_DEPTH_TEST);
 	}
 	else
-		v3d->zbuf= FALSE;
+		v3d->zbuf = FALSE;
 
 	/* enables anti-aliasing for 3D view drawing */
-	/*if (!(U.gameflags & USER_DISABLE_AA))
-		glEnable(GL_MULTISAMPLE_ARB);*/
-	
+#if 0
+	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;
+	rv3d->gridview = v3d->grid;
 
-	if((rv3d->view == RV3D_VIEW_USER) || (rv3d->persp != RV3D_ORTHO)) {
-		if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
+	if ((rv3d->view == RV3D_VIEW_USER) || (rv3d->persp != RV3D_ORTHO)) {
+		if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
 			drawfloor(scene, v3d, grid_unit);
 		}
-		if(rv3d->persp==RV3D_CAMOB) {
-			if(scene->world) {
-				if(scene->world->mode & WO_STARS) {
+		if (rv3d->persp == RV3D_CAMOB) {
+			if (scene->world) {
+				if (scene->world->mode & WO_STARS) {
 					RE_make_stars(NULL, scene, star_stuff_init_func, star_stuff_vertex_func,
-								  star_stuff_term_func);
+					              star_stuff_term_func);
 				}
 			}
-			if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
-				if(v3d->flag & V3D_DISPBGPICS) draw_bgpic(scene, ar, v3d);
-			}
 		}
 	}
 	else {
-		if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
+		if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
 			ED_region_pixelspace(ar);
 			drawgrid(&scene->unit, ar, v3d, grid_unit);
 			/* XXX make function? replaces persp(1) */
@@ -2771,27 +2874,25 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
 			glLoadMatrixf(rv3d->winmat);
 			glMatrixMode(GL_MODELVIEW);
 			glLoadMatrixf(rv3d->viewmat);
-
-			if(v3d->flag & V3D_DISPBGPICS) {
-				draw_bgpic(scene, ar, v3d);
-			}
 		}
 	}
-	
-	if(rv3d->rflag & RV3D_CLIPPING)
-		view3d_set_clipping(rv3d);
+
+	draw_bgpics(scene, ar, v3d, FALSE);
+
+	if (rv3d->rflag & RV3D_CLIPPING)
+		ED_view3d_clipping_set(rv3d);
 
 	/* draw set first */
-	if(scene->set) {
+	if (scene->set) {
 		Scene *sce_iter;
-		for(SETLOOPER(scene->set, sce_iter, base)) {
+		for (SETLOOPER(scene->set, sce_iter, base)) {
 			
-			if(v3d->lay & base->lay) {
+			if (v3d->lay & base->lay) {
 				
 				UI_ThemeColorBlend(TH_WIRE, TH_BACK, 0.6f);
-				draw_object(scene, ar, v3d, base, DRAW_CONSTCOLOR|DRAW_SCENESET);
+				draw_object(scene, ar, v3d, base, DRAW_CONSTCOLOR | DRAW_SCENESET);
 				
-				if(base->object->transflag & OB_DUPLI) {
+				if (base->object->transflag & OB_DUPLI) {
 					draw_dupli_objects_color(scene, ar, v3d, base, TH_WIRE);
 				}
 			}
@@ -2800,72 +2901,76 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
 		/* Transp and X-ray afterdraw stuff for sets is done later */
 	}
 
-	lay_used= 0;
+	lay_used = 0;
 
 	/* then draw not selected and the duplis, but skip editmode object */
-	for(base= scene->base.first; base; base= base->next) {
-		lay_used |= base->lay & ((1<<20)-1);
+	for (base = scene->base.first; base; base = base->next) {
+		lay_used |= base->lay & ((1 << 20) - 1);
 
-		if(v3d->lay & base->lay) {
+		if (v3d->lay & base->lay) {
 			
 			/* dupli drawing */
-			if(base->object->transflag & OB_DUPLI) {
+			if (base->object->transflag & OB_DUPLI) {
 				draw_dupli_objects(scene, ar, v3d, base);
 			}
-			if((base->flag & SELECT)==0) {
-				if(base->object!=scene->obedit) 
+			if ((base->flag & SELECT) == 0) {
+				if (base->object != scene->obedit)
 					draw_object(scene, ar, v3d, base, 0);
 			}
 		}
 	}
 
-	if(v3d->lay_used != lay_used) { /* happens when loading old files or loading with UI load */
+	if (v3d->lay_used != lay_used) { /* happens when loading old files or loading with UI load */
 		/* find header and force tag redraw */
-		ScrArea *sa= CTX_wm_area(C);
-		ARegion *ar_header= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
+		ScrArea *sa = CTX_wm_area(C);
+		ARegion *ar_header = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
 		ED_region_tag_redraw(ar_header); /* can be NULL */
-		v3d->lay_used= lay_used;
+		v3d->lay_used = lay_used;
 	}
 
 	/* draw selected and editmode */
-	for(base= scene->base.first; base; base= base->next) {
-		if(v3d->lay & base->lay) {
-			if (base->object==scene->obedit || ( base->flag & SELECT) ) 
+	for (base = scene->base.first; base; base = base->next) {
+		if (v3d->lay & base->lay) {
+			if (base->object == scene->obedit || (base->flag & SELECT) )
 				draw_object(scene, ar, v3d, base, 0);
 		}
 	}
 
+	draw_bgpics(scene, ar, v3d, TRUE);
+
 //	REEB_draw();
 
-	if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
+	if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
 		/* must be before xray draw which clears the depth buffer */
-		if(v3d->zbuf) glDisable(GL_DEPTH_TEST);
+		if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
 		draw_gpencil_view3d(scene, v3d, ar, 1);
-		if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+		if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
 	}
 
 	/* Transp and X-ray afterdraw stuff */
-	if(v3d->afterdraw_transp.first)		view3d_draw_transp(scene, ar, v3d);
-	if(v3d->afterdraw_xray.first)		view3d_draw_xray(scene, ar, v3d, 1);	// clears zbuffer if it is used!
-	if(v3d->afterdraw_xraytransp.first)	view3d_draw_xraytransp(scene, ar, v3d, 1);
+	if (v3d->afterdraw_transp.first) view3d_draw_transp(scene, ar, v3d);
+	if (v3d->afterdraw_xray.first) view3d_draw_xray(scene, ar, v3d, 1);         // clears zbuffer if it is used!
+	if (v3d->afterdraw_xraytransp.first) view3d_draw_xraytransp(scene, ar, v3d, 1);
 	
 	ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
 
-	if(rv3d->rflag & RV3D_CLIPPING)
-		view3d_clr_clipping();
+	if (rv3d->rflag & RV3D_CLIPPING)
+		ED_view3d_clipping_disable();
 	
 	BIF_draw_manipulator(C);
-	
+
+#if 0
 	/* Disable back anti-aliasing */
-	/*if (!(U.gameflags & USER_DISABLE_AA))
-		glDisable(GL_MULTISAMPLE_ARB);*/
+	if (!(U.gameflags & USER_DISABLE_AA))
+		glDisable(GL_MULTISAMPLE_ARB);
+#endif
 
-	if(v3d->zbuf) {
-		v3d->zbuf= FALSE;
+	if (v3d->zbuf) {
+		v3d->zbuf = FALSE;
 		glDisable(GL_DEPTH_TEST);
 	}
 
-	if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
+	if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
 		BDR_drawSketch(C);
 	}
 
@@ -2877,54 +2982,54 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const
 
 static void view3d_main_area_draw_info(const bContext *C, ARegion *ar, const char *grid_unit)
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	View3D *v3d = CTX_wm_view3d(C);
-	RegionView3D *rv3d= CTX_wm_region_view3d(C);
-	bScreen *screen= CTX_wm_screen(C);
+	RegionView3D *rv3d = CTX_wm_region_view3d(C);
+	bScreen *screen = CTX_wm_screen(C);
 
 	Object *ob;
 
-	if(rv3d->persp==RV3D_CAMOB)
+	if (rv3d->persp == RV3D_CAMOB)
 		drawviewborder(scene, ar, v3d);
 
-	if ((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
+	if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
 		/* 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);
+		//	if (v3d->flag2 & V3D_DISPGP)
+		draw_gpencil_view3d(scene, v3d, ar, 0);
 
 		drawcursor(scene, ar, v3d);
 	}
 	
-	if(U.uiflag & USER_SHOW_ROTVIEWICON)
+	if (U.uiflag & USER_SHOW_ROTVIEWICON)
 		draw_view_axis(rv3d);
 	else	
 		draw_view_icon(rv3d);
 	
-	ob= OBACT;
-	if(U.uiflag & USER_DRAWVIEWINFO) 
+	ob = OBACT;
+	if (U.uiflag & USER_DRAWVIEWINFO)
 		draw_selected_name(scene, ob);
 
-	if(rv3d->render_engine) {
+	if (rv3d->render_engine) {
 		view3d_main_area_draw_engine_info(rv3d, ar);
 		return;
 	}
 
-	if((U.uiflag & USER_SHOW_FPS) && screen->animtimer) {
+	if ((U.uiflag & USER_SHOW_FPS) && screen->animtimer) {
 		draw_viewport_fps(scene, ar);
 	}
-	else if(U.uiflag & USER_SHOW_VIEWPORTNAME) {
+	else if (U.uiflag & USER_SHOW_VIEWPORTNAME) {
 		draw_viewport_name(ar, v3d);
 	}
 
 	if (grid_unit) { /* draw below the viewport name */
-		char numstr[32]= "";
+		char numstr[32] = "";
 
 		UI_ThemeColor(TH_TEXT_HI);
-		if(v3d->grid != 1.0f) {
+		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,
+		BLF_draw_default_ascii(22,  ar->winy - (USER_SHOW_VIEWPORTNAME ? 40 : 20), 0.0f,
 		                       numstr[0] ? numstr : grid_unit, sizeof(numstr));
 	}
 }
@@ -2932,10 +3037,10 @@ static void view3d_main_area_draw_info(const bContext *C, ARegion *ar, const cha
 void view3d_main_area_draw(const bContext *C, ARegion *ar)
 {
 	View3D *v3d = CTX_wm_view3d(C);
-	const char *grid_unit= NULL;
+	const char *grid_unit = NULL;
 
 	/* draw viewport using external renderer? */
-	if(!(v3d->drawtype == OB_RENDER && view3d_main_area_draw_engine(C, ar))) {
+	if (!(v3d->drawtype == OB_RENDER && view3d_main_area_draw_engine(C, ar))) {
 		/* draw viewport using opengl */
 		view3d_main_area_draw_objects(C, ar, &grid_unit);
 		ED_region_pixelspace(ar);
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index f617f67..6f637af 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -77,7 +77,7 @@
 
 #include "PIL_time.h" /* smoothview */
 
-#include "view3d_intern.h"	// own include
+#include "view3d_intern.h"  // own include
 
 /* ********************** view3d_edit: view manipulations ********************* */
 
@@ -86,12 +86,12 @@ int ED_view3d_camera_lock_check(View3D *v3d, RegionView3D *rv3d)
 	return ((v3d->camera) &&
 	        (v3d->camera->id.lib == NULL) &&
 	        (v3d->flag2 & V3D_LOCK_CAMERA) &&
-	        (rv3d->persp==RV3D_CAMOB));
+	        (rv3d->persp == RV3D_CAMOB));
 }
 
 void ED_view3d_camera_lock_init(View3D *v3d, RegionView3D *rv3d)
 {
-	if(ED_view3d_camera_lock_check(v3d, rv3d)) {
+	if (ED_view3d_camera_lock_check(v3d, rv3d)) {
 		ED_view3d_from_object(v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL);
 	}
 }
@@ -99,18 +99,18 @@ void ED_view3d_camera_lock_init(View3D *v3d, RegionView3D *rv3d)
 /* return TRUE if the camera is moved */
 int ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d)
 {
-	if(ED_view3d_camera_lock_check(v3d, rv3d)) {
+	if (ED_view3d_camera_lock_check(v3d, rv3d)) {
 		ObjectTfmProtectedChannels obtfm;
 		Object *root_parent;
 
-		if((U.uiflag & USER_CAM_LOCK_NO_PARENT)==0 && (root_parent= v3d->camera->parent)) {
+		if ((U.uiflag & USER_CAM_LOCK_NO_PARENT) == 0 && (root_parent = v3d->camera->parent)) {
 			Object *ob_update;
 			float view_mat[4][4];
 			float diff_mat[4][4];
 			float parent_mat[4][4];
 
-			while(root_parent->parent) {
-				root_parent= root_parent->parent;
+			while (root_parent->parent) {
+				root_parent = root_parent->parent;
 			}
 
 			ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist);
@@ -124,11 +124,11 @@ int ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d)
 			object_apply_mat4(root_parent, parent_mat, TRUE, FALSE);
 			object_tfm_protected_restore(root_parent, &obtfm, root_parent->protectflag);
 
-			ob_update= v3d->camera;
-			while(ob_update) {
+			ob_update = v3d->camera;
+			while (ob_update) {
 				DAG_id_tag_update(&ob_update->id, OB_RECALC_OB);
-				WM_main_add_notifier(NC_OBJECT|ND_TRANSFORM, ob_update);
-				ob_update= ob_update->parent;
+				WM_main_add_notifier(NC_OBJECT | ND_TRANSFORM, ob_update);
+				ob_update = ob_update->parent;
 			}
 		}
 		else {
@@ -137,7 +137,7 @@ int ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d)
 			object_tfm_protected_restore(v3d->camera, &obtfm, v3d->camera->protectflag);
 
 			DAG_id_tag_update(&v3d->camera->id, OB_RECALC_OB);
-			WM_main_add_notifier(NC_OBJECT|ND_TRANSFORM, v3d->camera);
+			WM_main_add_notifier(NC_OBJECT | ND_TRANSFORM, v3d->camera);
 		}
 
 		return TRUE;
@@ -155,73 +155,73 @@ static void view3d_boxview_clip(ScrArea *sa)
 	ARegion *ar;
 	BoundBox *bb = MEM_callocN(sizeof(BoundBox), "clipbb");
 	float clip[6][4];
-	float x1= 0.0f, y1= 0.0f, z1= 0.0f, ofs[3] = {0.0f, 0.0f, 0.0f};
+	float x1 = 0.0f, y1 = 0.0f, z1 = 0.0f, ofs[3] = {0.0f, 0.0f, 0.0f};
 	int val;
 
 	/* create bounding box */
-	for(ar= sa->regionbase.first; ar; ar= ar->next) {
-		if(ar->regiontype==RGN_TYPE_WINDOW) {
-			RegionView3D *rv3d= ar->regiondata;
+	for (ar = sa->regionbase.first; ar; ar = ar->next) {
+		if (ar->regiontype == RGN_TYPE_WINDOW) {
+			RegionView3D *rv3d = ar->regiondata;
 
-			if(rv3d->viewlock & RV3D_BOXCLIP) {
-				if(ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM)) {
-					if(ar->winx>ar->winy) x1= rv3d->dist;
-					else x1= ar->winx*rv3d->dist/ar->winy;
+			if (rv3d->viewlock & RV3D_BOXCLIP) {
+				if (ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM)) {
+					if (ar->winx > ar->winy) x1 = rv3d->dist;
+					else x1 = ar->winx * rv3d->dist / ar->winy;
 
-					if(ar->winx>ar->winy) y1= ar->winy*rv3d->dist/ar->winx;
-					else y1= rv3d->dist;
+					if (ar->winx > ar->winy) y1 = ar->winy * rv3d->dist / ar->winx;
+					else y1 = rv3d->dist;
 					copy_v2_v2(ofs, rv3d->ofs);
 				}
-				else if(ELEM(rv3d->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK)) {
-					ofs[2]= rv3d->ofs[2];
+				else if (ELEM(rv3d->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK)) {
+					ofs[2] = rv3d->ofs[2];
 
-					if(ar->winx>ar->winy) z1= ar->winy*rv3d->dist/ar->winx;
-					else z1= rv3d->dist;
+					if (ar->winx > ar->winy) z1 = ar->winy * rv3d->dist / ar->winx;
+					else z1 = rv3d->dist;
 				}
 			}
 		}
 	}
 
-	for(val=0; val<8; val++) {
-		if(ELEM4(val, 0, 3, 4, 7))
-			bb->vec[val][0]= -x1 - ofs[0];
+	for (val = 0; val < 8; val++) {
+		if (ELEM4(val, 0, 3, 4, 7))
+			bb->vec[val][0] = -x1 - ofs[0];
 		else
-			bb->vec[val][0]=  x1 - ofs[0];
+			bb->vec[val][0] =  x1 - ofs[0];
 
-		if(ELEM4(val, 0, 1, 4, 5))
-			bb->vec[val][1]= -y1 - ofs[1];
+		if (ELEM4(val, 0, 1, 4, 5))
+			bb->vec[val][1] = -y1 - ofs[1];
 		else
-			bb->vec[val][1]=  y1 - ofs[1];
+			bb->vec[val][1] =  y1 - ofs[1];
 
-		if(val > 3)
-			bb->vec[val][2]= -z1 - ofs[2];
+		if (val > 3)
+			bb->vec[val][2] = -z1 - ofs[2];
 		else
-			bb->vec[val][2]=  z1 - ofs[2];
+			bb->vec[val][2] =  z1 - ofs[2];
 	}
 
 	/* normals for plane equations */
-	normal_tri_v3( clip[0],bb->vec[0], bb->vec[1], bb->vec[4]);
-	normal_tri_v3( clip[1],bb->vec[1], bb->vec[2], bb->vec[5]);
-	normal_tri_v3( clip[2],bb->vec[2], bb->vec[3], bb->vec[6]);
-	normal_tri_v3( clip[3],bb->vec[3], bb->vec[0], bb->vec[7]);
-	normal_tri_v3( clip[4],bb->vec[4], bb->vec[5], bb->vec[6]);
-	normal_tri_v3( clip[5],bb->vec[0], bb->vec[2], bb->vec[1]);
+	normal_tri_v3(clip[0], bb->vec[0], bb->vec[1], bb->vec[4]);
+	normal_tri_v3(clip[1], bb->vec[1], bb->vec[2], bb->vec[5]);
+	normal_tri_v3(clip[2], bb->vec[2], bb->vec[3], bb->vec[6]);
+	normal_tri_v3(clip[3], bb->vec[3], bb->vec[0], bb->vec[7]);
+	normal_tri_v3(clip[4], bb->vec[4], bb->vec[5], bb->vec[6]);
+	normal_tri_v3(clip[5], bb->vec[0], bb->vec[2], bb->vec[1]);
 
 	/* then plane equations */
-	for(val=0; val<6; val++) {
+	for (val = 0; val < 6; val++) {
 		clip[val][3] = -dot_v3v3(clip[val], bb->vec[val % 5]);
 	}
 
 	/* create bounding box */
-	for(ar= sa->regionbase.first; ar; ar= ar->next) {
-		if(ar->regiontype==RGN_TYPE_WINDOW) {
-			RegionView3D *rv3d= ar->regiondata;
+	for (ar = sa->regionbase.first; ar; ar = ar->next) {
+		if (ar->regiontype == RGN_TYPE_WINDOW) {
+			RegionView3D *rv3d = ar->regiondata;
 
-			if(rv3d->viewlock & RV3D_BOXCLIP) {
+			if (rv3d->viewlock & RV3D_BOXCLIP) {
 				rv3d->rflag |= RV3D_CLIPPING;
 				memcpy(rv3d->clip, clip, sizeof(clip));
-				if(rv3d->clipbb) MEM_freeN(rv3d->clipbb);
-				rv3d->clipbb= MEM_dupallocN(bb);
+				if (rv3d->clipbb) MEM_freeN(rv3d->clipbb);
+				rv3d->clipbb = MEM_dupallocN(bb);
 			}
 		}
 	}
@@ -232,33 +232,33 @@ static void view3d_boxview_clip(ScrArea *sa)
 static void view3d_boxview_sync(ScrArea *sa, ARegion *ar)
 {
 	ARegion *artest;
-	RegionView3D *rv3d= ar->regiondata;
-	short clip= 0;
+	RegionView3D *rv3d = ar->regiondata;
+	short clip = 0;
 
-	for(artest= sa->regionbase.first; artest; artest= artest->next) {
-		if(artest!=ar && artest->regiontype==RGN_TYPE_WINDOW) {
-			RegionView3D *rv3dtest= artest->regiondata;
+	for (artest = sa->regionbase.first; artest; artest = artest->next) {
+		if (artest != ar && artest->regiontype == RGN_TYPE_WINDOW) {
+			RegionView3D *rv3dtest = artest->regiondata;
 
-			if(rv3dtest->viewlock) {
-				rv3dtest->dist= rv3d->dist;
+			if (rv3dtest->viewlock) {
+				rv3dtest->dist = rv3d->dist;
 
-				if( ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM) ) {
-					if( ELEM(rv3dtest->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK))
-						rv3dtest->ofs[0]= rv3d->ofs[0];
-					else if( ELEM(rv3dtest->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT))
-						rv3dtest->ofs[1]= rv3d->ofs[1];
+				if (ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM) ) {
+					if (ELEM(rv3dtest->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK))
+						rv3dtest->ofs[0] = rv3d->ofs[0];
+					else if (ELEM(rv3dtest->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT))
+						rv3dtest->ofs[1] = rv3d->ofs[1];
 				}
-				else if( ELEM(rv3d->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK) ) {
-					if( ELEM(rv3dtest->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM))
-						rv3dtest->ofs[0]= rv3d->ofs[0];
-					else if( ELEM(rv3dtest->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT))
-						rv3dtest->ofs[2]= rv3d->ofs[2];
+				else if (ELEM(rv3d->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK) ) {
+					if (ELEM(rv3dtest->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM))
+						rv3dtest->ofs[0] = rv3d->ofs[0];
+					else if (ELEM(rv3dtest->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT))
+						rv3dtest->ofs[2] = rv3d->ofs[2];
 				}
-				else if( ELEM(rv3d->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT) ) {
-					if( ELEM(rv3dtest->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM))
-						rv3dtest->ofs[1]= rv3d->ofs[1];
-					if( ELEM(rv3dtest->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK))
-						rv3dtest->ofs[2]= rv3d->ofs[2];
+				else if (ELEM(rv3d->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT) ) {
+					if (ELEM(rv3dtest->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM))
+						rv3dtest->ofs[1] = rv3d->ofs[1];
+					if (ELEM(rv3dtest->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK))
+						rv3dtest->ofs[2] = rv3d->ofs[2];
 				}
 
 				clip |= rv3dtest->viewlock & RV3D_BOXCLIP;
@@ -268,7 +268,7 @@ static void view3d_boxview_sync(ScrArea *sa, ARegion *ar)
 		}
 	}
 
-	if(clip) {
+	if (clip) {
 		view3d_boxview_clip(sa);
 	}
 }
@@ -277,15 +277,15 @@ static void view3d_boxview_sync(ScrArea *sa, ARegion *ar)
 void view3d_boxview_copy(ScrArea *sa, ARegion *ar)
 {
 	ARegion *artest;
-	RegionView3D *rv3d= ar->regiondata;
-	short clip= 0;
+	RegionView3D *rv3d = ar->regiondata;
+	short clip = 0;
 
-	for(artest= sa->regionbase.first; artest; artest= artest->next) {
-		if(artest!=ar && artest->regiontype==RGN_TYPE_WINDOW) {
-			RegionView3D *rv3dtest= artest->regiondata;
+	for (artest = sa->regionbase.first; artest; artest = artest->next) {
+		if (artest != ar && artest->regiontype == RGN_TYPE_WINDOW) {
+			RegionView3D *rv3dtest = artest->regiondata;
 
-			if(rv3dtest->viewlock) {
-				rv3dtest->dist= rv3d->dist;
+			if (rv3dtest->viewlock) {
+				rv3dtest->dist = rv3d->dist;
 				copy_v3_v3(rv3dtest->ofs, rv3d->ofs);
 				ED_region_tag_redraw(artest);
 
@@ -294,7 +294,7 @@ void view3d_boxview_copy(ScrArea *sa, ARegion *ar)
 		}
 	}
 
-	if(clip) {
+	if (clip) {
 		view3d_boxview_clip(sa);
 	}
 }
@@ -302,39 +302,39 @@ void view3d_boxview_copy(ScrArea *sa, ARegion *ar)
 /* 'clip' is used to know if our clip setting has changed */
 void ED_view3d_quadview_update(ScrArea *sa, ARegion *ar, short do_clip)
 {
-	ARegion *arsync= NULL;
-	RegionView3D *rv3d= ar->regiondata;
+	ARegion *ar_sync = NULL;
+	RegionView3D *rv3d = ar->regiondata;
 	short viewlock;
 	/* this function copies flags from the first of the 3 other quadview
-	   regions to the 2 other, so it assumes this is the region whose
-	   properties are always being edited, weak */
-	viewlock= rv3d->viewlock;
+	 * regions to the 2 other, so it assumes this is the region whose
+	 * properties are always being edited, weak */
+	viewlock = rv3d->viewlock;
 
-	if((viewlock & RV3D_LOCKED)==0)
-		viewlock= 0;
-	else if((viewlock & RV3D_BOXVIEW)==0) {
+	if ((viewlock & RV3D_LOCKED) == 0)
+		viewlock = 0;
+	else if ((viewlock & RV3D_BOXVIEW) == 0) {
 		viewlock &= ~RV3D_BOXCLIP;
-		do_clip= TRUE;
+		do_clip = TRUE;
 	}
 
-	for(; ar; ar= ar->prev) {
-		if(ar->alignment==RGN_ALIGN_QSPLIT) {
-			rv3d= ar->regiondata;
-			rv3d->viewlock= viewlock;
+	for (; ar; ar = ar->prev) {
+		if (ar->alignment == RGN_ALIGN_QSPLIT) {
+			rv3d = ar->regiondata;
+			rv3d->viewlock = viewlock;
 
-			if(do_clip && (viewlock & RV3D_BOXCLIP)==0) {
+			if (do_clip && (viewlock & RV3D_BOXCLIP) == 0) {
 				rv3d->rflag &= ~RV3D_BOXCLIP;
 			}
 
-			/* use arsync so we sync with one of the aligned views below
+			/* use ar_sync so we sync with one of the aligned views below
 			 * else the view jumps on changing view settings like 'clip'
 			 * since it copies from the perspective view */
-			arsync= ar;
+			ar_sync = ar;
 		}
 	}
 
-	if(rv3d->viewlock & RV3D_BOXVIEW) {
-		view3d_boxview_copy(sa, arsync ? arsync : sa->regionbase.last);
+	if (rv3d->viewlock & RV3D_BOXVIEW) {
+		view3d_boxview_copy(sa, ar_sync ? ar_sync : sa->regionbase.last);
 	}
 
 	ED_area_tag_redraw(sa);
@@ -356,7 +356,7 @@ typedef struct ViewOpsData {
 	float viewquat[4]; /* working copy of rv3d->viewquat */
 	float trackvec[3];
 	float mousevec[3]; /* dolly only */
-	float reverse, dist0;
+	float reverse, dist0, camzoom0;
 	float grid, far;
 	short axis_snap; /* view rotate only */
 
@@ -371,57 +371,58 @@ typedef struct ViewOpsData {
 
 #define TRACKBALLSIZE  (1.1)
 
-static void calctrackballvec(rcti *rect, int mx, int my, float *vec)
+static void calctrackballvec(rcti *rect, int mx, int my, float vec[3])
 {
 	float x, y, radius, d, z, t;
 
-	radius= TRACKBALLSIZE;
+	radius = TRACKBALLSIZE;
 
 	/* normalize x and y */
-	x= (rect->xmax + rect->xmin)/2 - mx;
-	x/= (float)((rect->xmax - rect->xmin)/4);
-	y= (rect->ymax + rect->ymin)/2 - my;
-	y/= (float)((rect->ymax - rect->ymin)/2);
+	x = (rect->xmax + rect->xmin) / 2 - mx;
+	x /= (float)((rect->xmax - rect->xmin) / 4);
+	y = (rect->ymax + rect->ymin) / 2 - my;
+	y /= (float)((rect->ymax - rect->ymin) / 2);
 
-	d = sqrt(x*x + y*y);
+	d = sqrt(x * x + y * y);
 	if (d < radius * (float)M_SQRT1_2) { /* Inside sphere */
-		z= sqrt(radius*radius - d*d);
+		z = sqrt(radius * radius - d * d);
 	}
 	else { /* On hyperbola */
-		t= radius / (float)M_SQRT2;
-		z= t*t / d;
+		t = radius / (float)M_SQRT2;
+		z = t * t / d;
 	}
 
-	vec[0]= x;
-	vec[1]= y;
-	vec[2]= -z;		/* yah yah! */
+	vec[0] = x;
+	vec[1] = y;
+	vec[2] = -z;     /* yah yah! */
 }
 
 
 static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event)
 {
-	static float lastofs[3] = {0,0,0};
+	static float lastofs[3] = {0, 0, 0};
 	RegionView3D *rv3d;
-	ViewOpsData *vod= MEM_callocN(sizeof(ViewOpsData), "viewops data");
+	ViewOpsData *vod = MEM_callocN(sizeof(ViewOpsData), "viewops data");
 
 	/* store data */
-	op->customdata= vod;
-	vod->sa= CTX_wm_area(C);
-	vod->ar= CTX_wm_region(C);
-	vod->v3d= vod->sa->spacedata.first;
-	vod->rv3d= rv3d= vod->ar->regiondata;
+	op->customdata = vod;
+	vod->sa = CTX_wm_area(C);
+	vod->ar = CTX_wm_region(C);
+	vod->v3d = vod->sa->spacedata.first;
+	vod->rv3d = rv3d = vod->ar->regiondata;
 
 	/* set the view from the camera, if view locking is enabled.
 	 * we may want to make this optional but for now its needed always */
 	ED_view3d_camera_lock_init(vod->v3d, vod->rv3d);
 
-	vod->dist0= rv3d->dist;
+	vod->dist0 = rv3d->dist;
+	vod->camzoom0 = rv3d->camzoom;
 	copy_qt_qt(vod->viewquat, rv3d->viewquat);
 	copy_qt_qt(vod->oldquat, rv3d->viewquat);
-	vod->origx= vod->oldx= event->x;
-	vod->origy= vod->oldy= event->y;
-	vod->origkey= event->type; /* the key that triggered the operator.  */
-	vod->use_dyn_ofs= (U.uiflag & USER_ORBIT_SELECTION) ? 1:0;
+	vod->origx = vod->oldx = event->x;
+	vod->origy = vod->oldy = event->y;
+	vod->origkey = event->type; /* the key that triggered the operator.  */
+	vod->use_dyn_ofs = (U.uiflag & USER_ORBIT_SELECTION) ? 1 : 0;
 	copy_v3_v3(vod->ofs, rv3d->ofs);
 
 	if (vod->use_dyn_ofs) {
@@ -433,7 +434,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event)
 
 		view3d_operator_needs_opengl(C); /* needed for zbuf drawing */
 
-		if((vod->use_dyn_ofs=ED_view3d_autodist(CTX_data_scene(C), vod->ar, vod->v3d, event->mval, vod->dyn_ofs))) {
+		if ((vod->use_dyn_ofs = ED_view3d_autodist(CTX_data_scene(C), vod->ar, vod->v3d, event->mval, vod->dyn_ofs))) {
 			if (rv3d->is_persp) {
 				float my_origin[3]; /* original G.vd->ofs */
 				float my_pivot[3]; /* view */
@@ -443,10 +444,10 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event)
 				float mat[3][3];
 				float upvec[3];
 
-				negate_v3_v3(my_origin, rv3d->ofs);				/* ofs is flipped */
+				negate_v3_v3(my_origin, rv3d->ofs);             /* ofs is flipped */
 
-				/* Set the dist value to be the distance from this 3d point */
-				/* this means youll always be able to zoom into it and panning wont go bad when dist was zero */
+				/* Set the dist value to be the distance from this 3d point
+				 * this means youll always be able to zoom into it and panning wont go bad when dist was zero */
 
 				/* remove dist value */
 				upvec[0] = upvec[1] = 0;
@@ -455,7 +456,7 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event)
 
 				mul_m3_v3(mat, upvec);
 				sub_v3_v3v3(my_pivot, rv3d->ofs, upvec);
-				negate_v3(my_pivot);				/* ofs is flipped */
+				negate_v3(my_pivot);                /* ofs is flipped */
 
 				/* find a new ofs value that is along the view axis (rather than the mouse location) */
 				closest_to_line_v3(dvec, vod->dyn_ofs, my_pivot, my_origin);
@@ -475,17 +476,17 @@ static void viewops_data_create(bContext *C, wmOperator *op, wmEvent *event)
 		ED_view3d_win_to_vector(vod->ar, mval_f, vod->mousevec);
 	}
 
-	/* lookup, we dont pass on v3d to prevent confusement */
-	vod->grid= vod->v3d->grid;
-	vod->far= vod->v3d->far;
+	/* lookup, we don't pass on v3d to prevent confusement */
+	vod->grid = vod->v3d->grid;
+	vod->far = vod->v3d->far;
 
 	calctrackballvec(&vod->ar->winrct, event->x, event->y, vod->trackvec);
 
 	initgrabz(rv3d, -rv3d->ofs[0], -rv3d->ofs[1], -rv3d->ofs[2]);
 
-	vod->reverse= 1.0f;
+	vod->reverse = 1.0f;
 	if (rv3d->persmat[2][1] < 0.0f)
-		vod->reverse= -1.0f;
+		vod->reverse = -1.0f;
 
 	rv3d->rflag |= RV3D_NAVIGATING;
 }
@@ -495,29 +496,27 @@ static void viewops_data_free(bContext *C, wmOperator *op)
 	ARegion *ar;
 	Paint *p = paint_get_active(CTX_data_scene(C));
 
-	if(op->customdata) {
-		ViewOpsData *vod= op->customdata;
-		ar= vod->ar;
+	if (op->customdata) {
+		ViewOpsData *vod = op->customdata;
+		ar = vod->ar;
 		vod->rv3d->rflag &= ~RV3D_NAVIGATING;
 
-		if(vod->timer)
+		if (vod->timer)
 			WM_event_remove_timer(CTX_wm_manager(C), vod->timer->win, vod->timer);
 
 		MEM_freeN(vod);
-		op->customdata= NULL;
+		op->customdata = NULL;
 	}
 	else {
-		ar= CTX_wm_region(C);
+		ar = CTX_wm_region(C);
 	}
 
-	if(p && (p->flags & PAINT_FAST_NAVIGATE))
+	if (p && (p->flags & PAINT_FAST_NAVIGATE))
 		ED_region_tag_redraw(ar);
 }
 
 /* ************************** viewrotate **********************************/
 
-static const float thres = 0.93f; //cos(20 deg);
-
 #define COS45 0.7071068
 #define SIN45 COS45
 
@@ -569,39 +568,40 @@ static const float snapquats[NUM_SNAP_QUATS][5] = {
 };
 
 enum {
-	VIEW_PASS= 0,
+	VIEW_PASS = 0,
 	VIEW_APPLY,
 	VIEW_CONFIRM
 };
 
 /* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
-#define VIEW_MODAL_CONFIRM				1 /* used for all view operations */
-#define VIEWROT_MODAL_AXIS_SNAP_ENABLE	2
-#define VIEWROT_MODAL_AXIS_SNAP_DISABLE	3
-#define VIEWROT_MODAL_SWITCH_ZOOM		4
-#define VIEWROT_MODAL_SWITCH_MOVE		5
-#define VIEWROT_MODAL_SWITCH_ROTATE		6
+#define VIEW_MODAL_CONFIRM              1 /* used for all view operations */
+#define VIEWROT_MODAL_AXIS_SNAP_ENABLE  2
+#define VIEWROT_MODAL_AXIS_SNAP_DISABLE 3
+#define VIEWROT_MODAL_SWITCH_ZOOM       4
+#define VIEWROT_MODAL_SWITCH_MOVE       5
+#define VIEWROT_MODAL_SWITCH_ROTATE     6
 
 /* called in transform_ops.c, on each regeneration of keymaps  */
 void viewrotate_modal_keymap(wmKeyConfig *keyconf)
 {
 	static EnumPropertyItem modal_items[] = {
-	{VIEW_MODAL_CONFIRM,	"CONFIRM", 0, "Confirm", ""},
+		{VIEW_MODAL_CONFIRM,    "CONFIRM", 0, "Confirm", ""},
 
-	{VIEWROT_MODAL_AXIS_SNAP_ENABLE,	"AXIS_SNAP_ENABLE", 0, "Enable Axis Snap", ""},
-	{VIEWROT_MODAL_AXIS_SNAP_DISABLE,	"AXIS_SNAP_DISABLE", 0, "Disable Axis Snap", ""},
+		{VIEWROT_MODAL_AXIS_SNAP_ENABLE,    "AXIS_SNAP_ENABLE", 0, "Enable Axis Snap", ""},
+		{VIEWROT_MODAL_AXIS_SNAP_DISABLE,   "AXIS_SNAP_DISABLE", 0, "Disable Axis Snap", ""},
 		
-	{VIEWROT_MODAL_SWITCH_ZOOM, "SWITCH_TO_ZOOM", 0, "Switch to Zoom"},
-	{VIEWROT_MODAL_SWITCH_MOVE, "SWITCH_TO_MOVE", 0, "Switch to Move"},
+		{VIEWROT_MODAL_SWITCH_ZOOM, "SWITCH_TO_ZOOM", 0, "Switch to Zoom"},
+		{VIEWROT_MODAL_SWITCH_MOVE, "SWITCH_TO_MOVE", 0, "Switch to Move"},
 
-	{0, NULL, 0, NULL, NULL}};
+		{0, NULL, 0, NULL, NULL}
+	};
 
-	wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Rotate Modal");
+	wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Rotate Modal");
 
 	/* this function is called for each spacetype, only needs to add map once */
-	if(keymap) return;
+	if (keymap && keymap->modal_items) return;
 
-	keymap= WM_modalkeymap_add(keyconf, "View3D Rotate Modal", modal_items);
+	keymap = WM_modalkeymap_add(keyconf, "View3D Rotate Modal", modal_items);
 
 	/* items for modal map */
 	WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, VIEW_MODAL_CONFIRM);
@@ -610,11 +610,12 @@ void viewrotate_modal_keymap(wmKeyConfig *keyconf)
 	WM_modalkeymap_add_item(keymap, LEFTALTKEY, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_AXIS_SNAP_ENABLE);
 	WM_modalkeymap_add_item(keymap, LEFTALTKEY, KM_RELEASE, KM_ANY, 0, VIEWROT_MODAL_AXIS_SNAP_DISABLE);
 
-	/* disabled mode switching for now, can re-implement better, later on
+	/* disabled mode switching for now, can re-implement better, later on */
+#if 0
 	WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ZOOM);
 	WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ZOOM);
 	WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_SWITCH_MOVE);
-	*/
+#endif
 	
 	/* assign map to operators */
 	WM_modalkeymap_assign(keymap, "VIEW3D_OT_rotate");
@@ -623,9 +624,9 @@ void viewrotate_modal_keymap(wmKeyConfig *keyconf)
 
 static void viewrotate_apply(ViewOpsData *vod, int x, int y)
 {
-	RegionView3D *rv3d= vod->rv3d;
+	RegionView3D *rv3d = vod->rv3d;
 
-	rv3d->view= RV3D_VIEW_USER; /* need to reset everytime because of view snapping */
+	rv3d->view = RV3D_VIEW_USER; /* need to reset everytime because of view snapping */
 
 	if (U.flag & USER_TRACKBALL) {
 		float phi, si, q1[4], dvec[3], newvec[3];
@@ -637,23 +638,22 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
 		si = len_v3(dvec);
 		si /= (float)(2.0 * TRACKBALLSIZE);
 
-		cross_v3_v3v3(q1+1, vod->trackvec, newvec);
-		normalize_v3(q1+1);
+		cross_v3_v3v3(q1 + 1, vod->trackvec, newvec);
+		normalize_v3(q1 + 1);
 
-		/* Allow for rotation beyond the interval
-			* [-pi, pi] */
+		/* Allow for rotation beyond the interval [-pi, pi] */
 		while (si > 1.0f)
 			si -= 2.0f;
 
 		/* This relation is used instead of
-			* phi = asin(si) so that the angle
-			* of rotation is linearly proportional
-			* to the distance that the mouse is
-			* dragged. */
+		 * - phi = asin(si) so that the angle
+		 * - of rotation is linearly proportional
+		 * - to the distance that the mouse is
+		 * - dragged. */
 		phi = si * (float)(M_PI / 2.0);
 
-		q1[0]= cos(phi);
-		mul_v3_fl(q1+1, sin(phi));
+		q1[0] = cos(phi);
+		mul_v3_fl(q1 + 1, sin(phi));
 		mul_qt_qtqt(vod->viewquat, q1, vod->oldquat);
 
 		if (vod->use_dyn_ofs) {
@@ -671,28 +671,46 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
 	}
 	else {
 		/* New turntable view code by John Aughey */
-		float phi, q1[4];
+		float q1[4];
 		float m[3][3];
 		float m_inv[3][3];
-		float xvec[3] = {1.0f, 0.0f, 0.0f};
-		/* Sensitivity will control how fast the viewport rotates.  0.0035 was
-			obtained experimentally by looking at viewport rotation sensitivities
-			on other modeling programs. */
+		const float zvec_global[3] = {0.0f, 0.0f, 1.0f};
+		float xaxis[3];
+
+		/* Sensitivity will control how fast the viewport rotates.  0.007 was
+		 * obtained experimentally by looking at viewport rotation sensitivities
+		 * on other modeling programs. */
 		/* Perhaps this should be a configurable user parameter. */
-		const float sensitivity = 0.0035f;
+		const float sensitivity = 0.007f;
 
 		/* Get the 3x3 matrix and its inverse from the quaternion */
-		quat_to_mat3( m,vod->viewquat);
-		invert_m3_m3(m_inv,m);
+		quat_to_mat3(m, vod->viewquat);
+		invert_m3_m3(m_inv, m);
+
+		/* avoid gimble lock */
+#if 1
+		if (len_squared_v3v3(zvec_global, m_inv[2]) > 0.001f) {
+			float fac;
+			cross_v3_v3v3(xaxis, zvec_global, m_inv[2]);
+			if (dot_v3v3(xaxis, m_inv[0]) < 0) {
+				negate_v3(xaxis);
+			}
+			fac = angle_normalized_v3v3(zvec_global, m_inv[2]) / M_PI;
+			fac = fabsf(fac - 0.5f) * 2;
+			fac = fac * fac;
+			interp_v3_v3v3(xaxis, xaxis, m_inv[0], fac);
+		}
+		else
+#endif
+		{
+			copy_v3_v3(xaxis, m_inv[0]);
+		}
 
 		/* Determine the direction of the x vector (for rotating up and down) */
 		/* This can likely be computed directly from the quaternion. */
-		mul_m3_v3(m_inv,xvec);
 
 		/* Perform the up/down rotation */
-		phi = sensitivity * -(y - vod->oldy);
-		q1[0] = cos(phi);
-		mul_v3_v3fl(q1+1, xvec, sin(phi));
+		axis_angle_to_quat(q1, xaxis, sensitivity * -(y - vod->oldy));
 		mul_qt_qtqt(vod->viewquat, vod->viewquat, q1);
 
 		if (vod->use_dyn_ofs) {
@@ -703,10 +721,7 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
 		}
 
 		/* Perform the orbital rotation */
-		phi = sensitivity * vod->reverse * (x - vod->oldx);
-		q1[0] = cos(phi);
-		q1[1] = q1[2] = 0.0;
-		q1[3] = sin(phi);
+		axis_angle_to_quat(q1, zvec_global, sensitivity * vod->reverse * (x - vod->oldx));
 		mul_qt_qtqt(vod->viewquat, vod->viewquat, q1);
 
 		if (vod->use_dyn_ofs) {
@@ -718,24 +733,24 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
 	}
 
 	/* check for view snap */
-	if (vod->axis_snap){
+	if (vod->axis_snap) {
 		int i;
 		float viewquat_inv[4];
-		float zaxis[3]={0,0,1};
+		float zaxis[3] = {0, 0, 1};
 		invert_qt_qt(viewquat_inv, vod->viewquat);
 
 		mul_qt_v3(viewquat_inv, zaxis);
 
-		for (i = 0 ; i < NUM_SNAP_QUATS; i++){
+		for (i = 0; i < NUM_SNAP_QUATS; i++) {
 
 			float view = (int)snapquats[i][4];
 			float viewquat_inv_test[4];
-			float zaxis_test[3]={0,0,1};
+			float zaxis_test[3] = {0, 0, 1};
 
 			invert_qt_qt(viewquat_inv_test, snapquats[i]);
 			mul_qt_v3(viewquat_inv_test, zaxis_test);
 			
-			if(angle_v3v3(zaxis_test, zaxis) < DEG2RADF(45/3)) {
+			if (angle_v3v3(zaxis_test, zaxis) < DEG2RADF(45 / 3)) {
 				/* find the best roll */
 				float quat_roll[4], quat_final[4], quat_best[4];
 				float viewquat_align[4]; /* viewquat aligned to zaxis_test */
@@ -752,10 +767,10 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
 				invert_qt_qt(viewquat_align_inv, viewquat_align);
 
 				/* find best roll */
-				for(j= 0; j<8; j++) {
+				for (j = 0; j < 8; j++) {
 					float angle;
-					float xaxis1[3]={1,0,0};
-					float xaxis2[3]={1,0,0};
+					float xaxis1[3] = {1, 0, 0};
+					float xaxis2[3] = {1, 0, 0};
 					float quat_final_inv[4];
 
 					axis_angle_to_quat(quat_roll, zaxis_test, (float)j * DEG2RADF(45.0f));
@@ -768,24 +783,24 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
 					invert_qt_qt(quat_final_inv, quat_final);
 					mul_qt_v3(viewquat_align_inv, xaxis1);
 					mul_qt_v3(quat_final_inv, xaxis2);
-					angle= angle_v3v3(xaxis1, xaxis2);
+					angle = angle_v3v3(xaxis1, xaxis2);
 
-					if(angle <= best_angle) {
-						best_angle= angle;
+					if (angle <= best_angle) {
+						best_angle = angle;
 						copy_qt_qt(quat_best, quat_final);
-						if(j) view= 0; /* view grid assumes certain up axis */
+						if (j) view = 0;  /* view grid assumes certain up axis */
 					}
 				}
 
 				copy_qt_qt(vod->viewquat, quat_best);
-				rv3d->view= view; /* if we snap to a rolled camera the grid is invalid */
+				rv3d->view = view; /* if we snap to a rolled camera the grid is invalid */
 
 				break;
 			}
 		}
 	}
-	vod->oldx= x;
-	vod->oldy= y;
+	vod->oldx = x;
+	vod->oldy = y;
 
 	/* avoid precision loss over time */
 	normalize_qt(vod->viewquat);
@@ -801,44 +816,44 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
 
 static int viewrotate_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
-	ViewOpsData *vod= op->customdata;
-	short event_code= VIEW_PASS;
+	ViewOpsData *vod = op->customdata;
+	short event_code = VIEW_PASS;
 
 	/* execute the events */
-	if(event->type==MOUSEMOVE) {
-		event_code= VIEW_APPLY;
+	if (event->type == MOUSEMOVE) {
+		event_code = VIEW_APPLY;
 	}
-	else if(event->type==EVT_MODAL_MAP) {
+	else if (event->type == EVT_MODAL_MAP) {
 		switch (event->val) {
 			case VIEW_MODAL_CONFIRM:
-				event_code= VIEW_CONFIRM;
+				event_code = VIEW_CONFIRM;
 				break;
 			case VIEWROT_MODAL_AXIS_SNAP_ENABLE:
-				vod->axis_snap= TRUE;
-				event_code= VIEW_APPLY;
+				vod->axis_snap = TRUE;
+				event_code = VIEW_APPLY;
 				break;
 			case VIEWROT_MODAL_AXIS_SNAP_DISABLE:
-				vod->axis_snap= FALSE;
-				event_code= VIEW_APPLY;
+				vod->axis_snap = FALSE;
+				event_code = VIEW_APPLY;
 				break;
 			case VIEWROT_MODAL_SWITCH_ZOOM:
 				WM_operator_name_call(C, "VIEW3D_OT_zoom", WM_OP_INVOKE_DEFAULT, NULL);
-				event_code= VIEW_CONFIRM;
+				event_code = VIEW_CONFIRM;
 				break;
 			case VIEWROT_MODAL_SWITCH_MOVE:
 				WM_operator_name_call(C, "VIEW3D_OT_move", WM_OP_INVOKE_DEFAULT, NULL);
-				event_code= VIEW_CONFIRM;
+				event_code = VIEW_CONFIRM;
 				break;
 		}
 	}
-	else if(event->type==vod->origkey && event->val==KM_RELEASE) {
-		event_code= VIEW_CONFIRM;
+	else if (event->type == vod->origkey && event->val == KM_RELEASE) {
+		event_code = VIEW_CONFIRM;
 	}
 
-	if(event_code==VIEW_APPLY) {
+	if (event_code == VIEW_APPLY) {
 		viewrotate_apply(vod, event->x, event->y);
 	}
-	else if (event_code==VIEW_CONFIRM) {
+	else if (event_code == VIEW_CONFIRM) {
 		ED_view3d_depth_tag_update(vod->rv3d);
 		viewops_data_free(C, op);
 
@@ -855,31 +870,31 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 	/* makes op->customdata */
 	viewops_data_create(C, op, event);
-	vod= op->customdata;
-	rv3d= vod->rv3d;
+	vod = op->customdata;
+	rv3d = vod->rv3d;
 
-	if(rv3d->viewlock) { /* poll should check but in some cases fails, see poll func for details */
+	if (rv3d->viewlock) { /* poll should check but in some cases fails, see poll func for details */
 		viewops_data_free(C, op);
 		return OPERATOR_PASS_THROUGH;
 	}
 
 	/* switch from camera view when: */
-	if(rv3d->persp != RV3D_PERSP) {
+	if (rv3d->persp != RV3D_PERSP) {
 
 		if (U.uiflag & USER_AUTOPERSP) {
-			if(!ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) {
-				rv3d->persp= RV3D_PERSP;
+			if (!ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) {
+				rv3d->persp = RV3D_PERSP;
 			}
 		}
-		else if(rv3d->persp==RV3D_CAMOB) {
+		else if (rv3d->persp == RV3D_CAMOB) {
 
 			/* changed since 2.4x, use the camera view */
-			if(vod->v3d->camera) {
+			if (vod->v3d->camera) {
 				ED_view3d_from_object(vod->v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, NULL);
 			}
 
-			if(!ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) {
-				rv3d->persp= rv3d->lpersp;
+			if (!ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) {
+				rv3d->persp = rv3d->lpersp;
 			}
 		}
 		ED_region_tag_redraw(vod->ar);
@@ -912,9 +927,9 @@ 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) {
+	if (ED_operator_view3d_active(C)) {
+		RegionView3D *rv3d = CTX_wm_region_view3d(C);
+		if (rv3d && rv3d->persp == RV3D_CAMOB) {
 			return 1;
 		}
 	}
@@ -930,7 +945,7 @@ static int view3d_camera_user_poll(bContext *C)
 
 	if (ED_view3d_context_user_region(C, &v3d, &ar)) {
 		RegionView3D *rv3d = ar->regiondata;
-		if(rv3d->persp==RV3D_CAMOB) {
+		if (rv3d->persp == RV3D_CAMOB) {
 			return 1;
 		}
 	}
@@ -949,29 +964,29 @@ void VIEW3D_OT_rotate(wmOperatorType *ot)
 {
 
 	/* identifiers */
-	ot->name= "Rotate view";
+	ot->name = "Rotate view";
 	ot->description = "Rotate the view";
-	ot->idname= "VIEW3D_OT_rotate";
+	ot->idname = "VIEW3D_OT_rotate";
 
 	/* api callbacks */
-	ot->invoke= viewrotate_invoke;
-	ot->modal= viewrotate_modal;
-	ot->poll= ED_operator_region_view3d_active;
-	ot->cancel= viewrotate_cancel;
+	ot->invoke = viewrotate_invoke;
+	ot->modal = viewrotate_modal;
+	ot->poll = ED_operator_region_view3d_active;
+	ot->cancel = viewrotate_cancel;
 
 	/* flags */
-	ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
+	ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_POINTER;
 }
 
 /* NDOF utility functions
  * (should these functions live in this file?)
  */
-float ndof_to_axis_angle(struct wmNDOFMotionData* ndof, float axis[3])
+float ndof_to_axis_angle(struct wmNDOFMotionData*ndof, float axis[3])
 {
 	return ndof->dt * normalize_v3_v3(axis, ndof->rvec);
 }
 
-void ndof_to_quat(struct wmNDOFMotionData* ndof, float q[4])
+void ndof_to_quat(struct wmNDOFMotionData*ndof, float q[4])
 {
 	float axis[3];
 	float angle;
@@ -990,8 +1005,8 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event
 		return OPERATOR_CANCELLED;
 	else {
 		View3D *v3d = CTX_wm_view3d(C);
-		RegionView3D* rv3d = CTX_wm_region_view3d(C);
-		wmNDOFMotionData* ndof = (wmNDOFMotionData*) event->customdata;
+		RegionView3D*rv3d = CTX_wm_region_view3d(C);
+		wmNDOFMotionData*ndof = (wmNDOFMotionData *) event->customdata;
 
 		ED_view3d_camera_lock_init(v3d, rv3d);
 
@@ -1013,7 +1028,7 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event
 			/* #define DEBUG_NDOF_MOTION */
 			#ifdef DEBUG_NDOF_MOTION
 			printf("ndof: T=(%.2f,%.2f,%.2f) R=(%.2f,%.2f,%.2f) dt=%.3f delivered to 3D view\n",
-				ndof->tx, ndof->ty, ndof->tz, ndof->rx, ndof->ry, ndof->rz, ndof->dt);
+			       ndof->tx, ndof->ty, ndof->tz, ndof->rx, ndof->ry, ndof->rz, ndof->dt);
 			#endif
 
 			if (ndof->tz) {
@@ -1073,11 +1088,12 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event
 					/* apply rotation */
 					mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rot);
 
-				} else {
+				}
+				else {
 
 					/* turntable view code by John Aughey, adapted for 3D mouse by [mce] */
 					float angle, rot[4];
-					float xvec[3] = {1,0,0};
+					float xvec[3] = {1, 0, 0};
 
 					/* Determine the direction of the x vector (for rotating up and down) */
 					mul_qt_v3(view_inv, xvec);
@@ -1087,7 +1103,7 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event
 					if (U.ndof_flag & NDOF_TILT_INVERT_AXIS)
 						angle = -angle;
 					rot[0] = cos(angle);
-					mul_v3_v3fl(rot+1, xvec, sin(angle));
+					mul_v3_v3fl(rot + 1, xvec, sin(angle));
 					mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rot);
 
 					/* Perform the orbital rotation */
@@ -1140,9 +1156,9 @@ static int ndof_pan_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
 	if (event->type != NDOF_MOTION)
 		return OPERATOR_CANCELLED;
 	else {
-		View3D *v3d= CTX_wm_view3d(C);
-		RegionView3D* rv3d = CTX_wm_region_view3d(C);
-		wmNDOFMotionData* ndof = (wmNDOFMotionData*) event->customdata;
+		View3D *v3d = CTX_wm_view3d(C);
+		RegionView3D*rv3d = CTX_wm_region_view3d(C);
+		wmNDOFMotionData*ndof = (wmNDOFMotionData *) event->customdata;
 
 		ED_view3d_camera_lock_init(v3d, rv3d);
 
@@ -1158,7 +1174,7 @@ static int ndof_pan_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
 
 			float pan_vec[3] = {
 				ndof->tx, ndof->ty, 0
-				};
+			};
 
 			/* "zoom in" or "translate"? depends on zoom mode in user settings? */
 			if (ndof->tz) {
@@ -1235,29 +1251,31 @@ void VIEW3D_OT_ndof_pan(struct wmOperatorType *ot)
 void viewmove_modal_keymap(wmKeyConfig *keyconf)
 {
 	static EnumPropertyItem modal_items[] = {
-	{VIEW_MODAL_CONFIRM,	"CONFIRM", 0, "Confirm", ""},
+		{VIEW_MODAL_CONFIRM,    "CONFIRM", 0, "Confirm", ""},
 		
-	{VIEWROT_MODAL_SWITCH_ZOOM, "SWITCH_TO_ZOOM", 0, "Switch to Zoom"},
-	{VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"},
+		{VIEWROT_MODAL_SWITCH_ZOOM, "SWITCH_TO_ZOOM", 0, "Switch to Zoom"},
+		{VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"},
 
-	{0, NULL, 0, NULL, NULL}};
+		{0, NULL, 0, NULL, NULL}
+	};
 
-	wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Move Modal");
+	wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Move Modal");
 
 	/* this function is called for each spacetype, only needs to add map once */
-	if(keymap) return;
+	if (keymap && keymap->modal_items) return;
 
-	keymap= WM_modalkeymap_add(keyconf, "View3D Move Modal", modal_items);
+	keymap = WM_modalkeymap_add(keyconf, "View3D Move Modal", modal_items);
 
 	/* items for modal map */
 	WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, VIEW_MODAL_CONFIRM);
 	WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, VIEW_MODAL_CONFIRM);
 
-	/* disabled mode switching for now, can re-implement better, later on
+	/* disabled mode switching for now, can re-implement better, later on */
+#if 0
 	WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ZOOM);
 	WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ZOOM);
 	WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_RELEASE, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ROTATE);
-	*/
+#endif
 	
 	/* assign map to operators */
 	WM_modalkeymap_assign(keymap, "VIEW3D_OT_move");
@@ -1266,10 +1284,10 @@ void viewmove_modal_keymap(wmKeyConfig *keyconf)
 
 static void viewmove_apply(ViewOpsData *vod, int x, int y)
 {
-	if((vod->rv3d->persp==RV3D_CAMOB) && !ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) {
-		const float zoomfac= BKE_screen_view3d_zoom_to_fac((float)vod->rv3d->camzoom) * 2.0f;
-		vod->rv3d->camdx += (vod->oldx - x)/(vod->ar->winx * zoomfac);
-		vod->rv3d->camdy += (vod->oldy - y)/(vod->ar->winy * zoomfac);
+	if ((vod->rv3d->persp == RV3D_CAMOB) && !ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) {
+		const float zoomfac = BKE_screen_view3d_zoom_to_fac((float)vod->rv3d->camzoom) * 2.0f;
+		vod->rv3d->camdx += (vod->oldx - x) / (vod->ar->winx * zoomfac);
+		vod->rv3d->camdy += (vod->oldy - y) / (vod->ar->winy * zoomfac);
 		CLAMP(vod->rv3d->camdx, -1.0f, 1.0f);
 		CLAMP(vod->rv3d->camdy, -1.0f, 1.0f);
 	}
@@ -1277,18 +1295,18 @@ static void viewmove_apply(ViewOpsData *vod, int x, int y)
 		float dvec[3];
 		float mval_f[2];
 
-		mval_f[0]= x - vod->oldx;
-		mval_f[1]= y - vod->oldy;
+		mval_f[0] = x - vod->oldx;
+		mval_f[1] = y - vod->oldy;
 		ED_view3d_win_to_delta(vod->ar, mval_f, dvec);
 
 		add_v3_v3(vod->rv3d->ofs, dvec);
 
-		if(vod->rv3d->viewlock & RV3D_BOXVIEW)
+		if (vod->rv3d->viewlock & RV3D_BOXVIEW)
 			view3d_boxview_sync(vod->sa, vod->ar);
 	}
 
-	vod->oldx= x;
-	vod->oldy= y;
+	vod->oldx = x;
+	vod->oldy = y;
 
 	ED_view3d_camera_lock_sync(vod->v3d, vod->rv3d);
 
@@ -1299,36 +1317,36 @@ static void viewmove_apply(ViewOpsData *vod, int x, int y)
 static int viewmove_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
 
-	ViewOpsData *vod= op->customdata;
-	short event_code= VIEW_PASS;
+	ViewOpsData *vod = op->customdata;
+	short event_code = VIEW_PASS;
 
 	/* execute the events */
-	if(event->type==MOUSEMOVE) {
-		event_code= VIEW_APPLY;
+	if (event->type == MOUSEMOVE) {
+		event_code = VIEW_APPLY;
 	}
-	else if(event->type==EVT_MODAL_MAP) {
+	else if (event->type == EVT_MODAL_MAP) {
 		switch (event->val) {
 			case VIEW_MODAL_CONFIRM:
-				event_code= VIEW_CONFIRM;
+				event_code = VIEW_CONFIRM;
 				break;
 			case VIEWROT_MODAL_SWITCH_ZOOM:
 				WM_operator_name_call(C, "VIEW3D_OT_zoom", WM_OP_INVOKE_DEFAULT, NULL);
-				event_code= VIEW_CONFIRM;
+				event_code = VIEW_CONFIRM;
 				break;
 			case VIEWROT_MODAL_SWITCH_ROTATE:
 				WM_operator_name_call(C, "VIEW3D_OT_rotate", WM_OP_INVOKE_DEFAULT, NULL);
-				event_code= VIEW_CONFIRM;
+				event_code = VIEW_CONFIRM;
 				break;
 		}
 	}
-	else if(event->type==vod->origkey && event->val==KM_RELEASE) {
-		event_code= VIEW_CONFIRM;
+	else if (event->type == vod->origkey && event->val == KM_RELEASE) {
+		event_code = VIEW_CONFIRM;
 	}
 
-	if(event_code==VIEW_APPLY) {
+	if (event_code == VIEW_APPLY) {
 		viewmove_apply(vod, event->x, event->y);
 	}
-	else if (event_code==VIEW_CONFIRM) {
+	else if (event_code == VIEW_CONFIRM) {
 		ED_view3d_depth_tag_update(vod->rv3d);
 
 		viewops_data_free(C, op);
@@ -1345,7 +1363,7 @@ static int viewmove_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 	/* makes op->customdata */
 	viewops_data_create(C, op, event);
-	vod= op->customdata;
+	vod = op->customdata;
 
 	if (event->type == MOUSEPAN) {
 		viewmove_apply(vod, event->prevx, event->prevy);
@@ -1374,18 +1392,18 @@ void VIEW3D_OT_move(wmOperatorType *ot)
 {
 
 	/* identifiers */
-	ot->name= "Move view";
+	ot->name = "Move view";
 	ot->description = "Move the view";
-	ot->idname= "VIEW3D_OT_move";
+	ot->idname = "VIEW3D_OT_move";
 
 	/* api callbacks */
-	ot->invoke= viewmove_invoke;
-	ot->modal= viewmove_modal;
-	ot->poll= ED_operator_view3d_active;
-	ot->cancel= viewmove_cancel;
+	ot->invoke = viewmove_invoke;
+	ot->modal = viewmove_modal;
+	ot->poll = ED_operator_view3d_active;
+	ot->cancel = viewmove_cancel;
 
 	/* flags */
-	ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
+	ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_POINTER;
 }
 
 /* ************************ viewzoom ******************************** */
@@ -1395,29 +1413,30 @@ void VIEW3D_OT_move(wmOperatorType *ot)
 void viewzoom_modal_keymap(wmKeyConfig *keyconf)
 {
 	static EnumPropertyItem modal_items[] = {
-	{VIEW_MODAL_CONFIRM,	"CONFIRM", 0, "Confirm", ""},
+		{VIEW_MODAL_CONFIRM,    "CONFIRM", 0, "Confirm", ""},
 		
-	{VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"},
-	{VIEWROT_MODAL_SWITCH_MOVE, "SWITCH_TO_MOVE", 0, "Switch to Move"},
+		{VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"},
+		{VIEWROT_MODAL_SWITCH_MOVE, "SWITCH_TO_MOVE", 0, "Switch to Move"},
 
-	{0, NULL, 0, NULL, NULL}};
+		{0, NULL, 0, NULL, NULL}};
 
-	wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Zoom Modal");
+	wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Zoom Modal");
 
 	/* this function is called for each spacetype, only needs to add map once */
-	if(keymap) return;
+	if (keymap && keymap->modal_items) return;
 
-	keymap= WM_modalkeymap_add(keyconf, "View3D Zoom Modal", modal_items);
+	keymap = WM_modalkeymap_add(keyconf, "View3D Zoom Modal", modal_items);
 
 	/* items for modal map */
 	WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, VIEW_MODAL_CONFIRM);
 	WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, VIEW_MODAL_CONFIRM);
 
-	/* disabled mode switching for now, can re-implement better, later on
+	/* disabled mode switching for now, can re-implement better, later on */
+#if 0
 	WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ROTATE);
 	WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_RELEASE, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ROTATE);
 	WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_SWITCH_MOVE);
-	 */
+#endif
 	
 	/* assign map to operators */
 	WM_modalkeymap_assign(keymap, "VIEW3D_OT_zoom");
@@ -1425,9 +1444,9 @@ void viewzoom_modal_keymap(wmKeyConfig *keyconf)
 
 static void view_zoom_mouseloc(ARegion *ar, float dfac, int mx, int my)
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 
-	if(U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
+	if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) {
 		float dvec[3];
 		float tvec[3];
 		float tpos[3];
@@ -1439,8 +1458,8 @@ static void view_zoom_mouseloc(ARegion *ar, float dfac, int mx, int my)
 		/* Project cursor position into 3D space */
 		initgrabz(rv3d, tpos[0], tpos[1], tpos[2]);
 
-		mval_f[0]= (float)(((mx - ar->winrct.xmin) * 2) - ar->winx) / 2.0f;
-		mval_f[1]= (float)(((my - ar->winrct.ymin) * 2) - ar->winy) / 2.0f;
+		mval_f[0] = (float)(((mx - ar->winrct.xmin) * 2) - ar->winx) / 2.0f;
+		mval_f[1] = (float)(((my - ar->winrct.ymin) * 2) - ar->winy) / 2.0f;
 		ED_view3d_win_to_delta(ar, mval_f, dvec);
 
 		/* Calculate view target position for dolly */
@@ -1455,7 +1474,8 @@ static void view_zoom_mouseloc(ARegion *ar, float dfac, int mx, int my)
 
 		/* Calculate final offset */
 		madd_v3_v3v3fl(rv3d->ofs, tvec, dvec, dfac);
-	} else {
+	}
+	else {
 		rv3d->dist *= dfac;
 	}
 }
@@ -1463,41 +1483,51 @@ 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)
 {
-	float zfac=1.0;
+	float zfac = 1.0;
+	short use_cam_zoom;
+
+	use_cam_zoom = (vod->rv3d->persp == RV3D_CAMOB) && !(vod->rv3d->is_persp && ED_view3d_camera_lock_check(vod->v3d, vod->rv3d));
 
-	if(viewzoom==USER_ZOOM_CONT) {
-		double time= PIL_check_seconds_timer();
-		float time_step= (float)(time - vod->timer_lastdraw);
+	if (use_cam_zoom) {
+		float delta;
+		delta = (x - vod->origx + y - vod->origy) / 10.0f;
+		vod->rv3d->camzoom = vod->camzoom0 - delta;
+
+		CLAMP(vod->rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
+	}
+	if (viewzoom == USER_ZOOM_CONT) {
+		double time = PIL_check_seconds_timer();
+		float time_step = (float)(time - vod->timer_lastdraw);
 		float fac;
 
 		if (U.uiflag & USER_ZOOM_HORIZ) {
-			fac= (float)(x - vod->origx);
+			fac = (float)(x - vod->origx);
 		}
 		else {
-			fac= (float)(y - vod->origy);
+			fac = (float)(y - vod->origy);
 		}
 
-		if(zoom_invert) {
-			fac= -fac;
+		if (zoom_invert) {
+			fac = -fac;
 		}
 
 		// oldstyle zoom
 		zfac = 1.0f + ((fac / 20.0f) * time_step);
-		vod->timer_lastdraw= time;
+		vod->timer_lastdraw = time;
 	}
-	else if(viewzoom==USER_ZOOM_SCALE) {
+	else if (viewzoom == USER_ZOOM_SCALE) {
 		int ctr[2], len1, len2;
 		// method which zooms based on how far you move the mouse
 
-		ctr[0] = (vod->ar->winrct.xmax + vod->ar->winrct.xmin)/2;
-		ctr[1] = (vod->ar->winrct.ymax + vod->ar->winrct.ymin)/2;
+		ctr[0] = (vod->ar->winrct.xmax + vod->ar->winrct.xmin) / 2;
+		ctr[1] = (vod->ar->winrct.ymax + vod->ar->winrct.ymin) / 2;
 
-		len1 = (int)sqrt((ctr[0] - x)*(ctr[0] - x) + (ctr[1] - y)*(ctr[1] - y)) + 5;
-		len2 = (int)sqrt((ctr[0] - vod->origx)*(ctr[0] - vod->origx) + (ctr[1] - vod->origy)*(ctr[1] - vod->origy)) + 5;
+		len1 = (int)sqrt((ctr[0] - x) * (ctr[0] - x) + (ctr[1] - y) * (ctr[1] - y)) + 5;
+		len2 = (int)sqrt((ctr[0] - vod->origx) * (ctr[0] - vod->origx) + (ctr[1] - vod->origy) * (ctr[1] - vod->origy)) + 5;
 
-		zfac = vod->dist0 * ((float)len2/len1) / vod->rv3d->dist;
+		zfac = vod->dist0 * ((float)len2 / len1) / vod->rv3d->dist;
 	}
-	else {	/* USER_ZOOM_DOLLY */
+	else {  /* USER_ZOOM_DOLLY */
 		float len1, len2;
 		
 		if (U.uiflag & USER_ZOOM_HORIZ) {
@@ -1512,18 +1542,26 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, const short viewzoom,
 			SWAP(float, len1, len2);
 		}
 		
-		zfac = vod->dist0 * (2.0f * ((len2/len1)-1.0f) + 1.0f) / vod->rv3d->dist;
+		if (use_cam_zoom) {
+			zfac = vod->camzoom0 * (2.0f * ((len2 / len1) - 1.0f) + 1.0f) / vod->rv3d->camzoom;
+			zfac = 0;
+		}
+		else {
+			zfac = vod->dist0 * (2.0f * ((len2 / len1) - 1.0f) + 1.0f) / vod->rv3d->dist;
+		}
 	}
 
-	if(zfac != 1.0f && zfac*vod->rv3d->dist > 0.001f * vod->grid &&
-			zfac * vod->rv3d->dist < 10.0f * vod->far)
-		view_zoom_mouseloc(vod->ar, zfac, vod->oldx, vod->oldy);
+	if (!use_cam_zoom) {
+		if (zfac != 1.0f && zfac * vod->rv3d->dist > 0.001f * vod->grid &&
+		    zfac * vod->rv3d->dist < 10.0f * vod->far)
+			view_zoom_mouseloc(vod->ar, zfac, vod->oldx, vod->oldy);
+	}
 
 	/* these limits were in old code too */
-	if(vod->rv3d->dist<0.001f * vod->grid) vod->rv3d->dist= 0.001f * vod->grid;
-	if(vod->rv3d->dist>10.0f * vod->far) vod->rv3d->dist=10.0f * vod->far;
+	if (vod->rv3d->dist < 0.001f * vod->grid) vod->rv3d->dist = 0.001f * vod->grid;
+	if (vod->rv3d->dist > 10.0f * vod->far) vod->rv3d->dist = 10.0f * vod->far;
 
-	if(vod->rv3d->viewlock & RV3D_BOXVIEW)
+	if (vod->rv3d->viewlock & RV3D_BOXVIEW)
 		view3d_boxview_sync(vod->sa, vod->ar);
 
 	ED_view3d_camera_lock_sync(vod->v3d, vod->rv3d);
@@ -1534,40 +1572,40 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, const short viewzoom,
 
 static int viewzoom_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
-	ViewOpsData *vod= op->customdata;
-	short event_code= VIEW_PASS;
+	ViewOpsData *vod = op->customdata;
+	short event_code = VIEW_PASS;
 
 	/* execute the events */
 	if (event->type == TIMER && event->customdata == vod->timer) {
 		/* continuous zoom */
-		event_code= VIEW_APPLY;
+		event_code = VIEW_APPLY;
 	}
-	else if(event->type==MOUSEMOVE) {
-		event_code= VIEW_APPLY;
+	else if (event->type == MOUSEMOVE) {
+		event_code = VIEW_APPLY;
 	}
-	else if(event->type==EVT_MODAL_MAP) {
+	else if (event->type == EVT_MODAL_MAP) {
 		switch (event->val) {
 			case VIEW_MODAL_CONFIRM:
-				event_code= VIEW_CONFIRM;
+				event_code = VIEW_CONFIRM;
 				break;
 			case VIEWROT_MODAL_SWITCH_MOVE:
 				WM_operator_name_call(C, "VIEW3D_OT_move", WM_OP_INVOKE_DEFAULT, NULL);
-				event_code= VIEW_CONFIRM;
+				event_code = VIEW_CONFIRM;
 				break;
 			case VIEWROT_MODAL_SWITCH_ROTATE:
 				WM_operator_name_call(C, "VIEW3D_OT_rotate", WM_OP_INVOKE_DEFAULT, NULL);
-				event_code= VIEW_CONFIRM;
+				event_code = VIEW_CONFIRM;
 				break;
 		}
 	}
-	else if(event->type==vod->origkey && event->val==KM_RELEASE) {
-		event_code= VIEW_CONFIRM;
+	else if (event->type == vod->origkey && event->val == KM_RELEASE) {
+		event_code = VIEW_CONFIRM;
 	}
 
-	if(event_code==VIEW_APPLY) {
+	if (event_code == VIEW_APPLY) {
 		viewzoom_apply(vod, event->x, event->y, U.viewzoom, (U.uiflag & USER_ZOOM_INVERT) != 0);
 	}
-	else if (event_code==VIEW_CONFIRM) {
+	else if (event_code == VIEW_CONFIRM) {
 		ED_view3d_depth_tag_update(vod->rv3d);
 		viewops_data_free(C, op);
 
@@ -1585,49 +1623,49 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
 	ARegion *ar;
 	short use_cam_zoom;
 
-	int delta= RNA_int_get(op->ptr, "delta");
+	int delta = RNA_int_get(op->ptr, "delta");
 	int mx, my;
 
-	if(op->customdata) {
-		ViewOpsData *vod= op->customdata;
+	if (op->customdata) {
+		ViewOpsData *vod = op->customdata;
 
-		sa= vod->sa;
-		ar= vod->ar;
+		sa = vod->sa;
+		ar = vod->ar;
 	}
 	else {
-		sa= CTX_wm_area(C);
-		ar= CTX_wm_region(C);
+		sa = CTX_wm_area(C);
+		ar = CTX_wm_region(C);
 	}
 
-	v3d= sa->spacedata.first;
-	rv3d= ar->regiondata;
+	v3d = sa->spacedata.first;
+	rv3d = ar->regiondata;
 
-	mx= RNA_struct_property_is_set(op->ptr, "mx") ? RNA_int_get(op->ptr, "mx") : ar->winx / 2;
-	my= RNA_struct_property_is_set(op->ptr, "my") ? RNA_int_get(op->ptr, "my") : ar->winy / 2;
+	mx = RNA_struct_property_is_set(op->ptr, "mx") ? RNA_int_get(op->ptr, "mx") : ar->winx / 2;
+	my = RNA_struct_property_is_set(op->ptr, "my") ? RNA_int_get(op->ptr, "my") : ar->winy / 2;
 
-	use_cam_zoom= (rv3d->persp==RV3D_CAMOB) && !(rv3d->is_persp && ED_view3d_camera_lock_check(v3d, rv3d));
+	use_cam_zoom = (rv3d->persp == RV3D_CAMOB) && !(rv3d->is_persp && ED_view3d_camera_lock_check(v3d, rv3d));
 
-	if(delta < 0) {
+	if (delta < 0) {
 		/* this min and max is also in viewmove() */
-		if(use_cam_zoom) {
-			rv3d->camzoom-= 10;
-			if(rv3d->camzoom < RV3D_CAMZOOM_MIN) rv3d->camzoom= RV3D_CAMZOOM_MIN;
+		if (use_cam_zoom) {
+			rv3d->camzoom -= 10.0f;
+			if (rv3d->camzoom < RV3D_CAMZOOM_MIN) rv3d->camzoom = RV3D_CAMZOOM_MIN;
 		}
-		else if(rv3d->dist < 10.0f * v3d->far) {
+		else if (rv3d->dist < 10.0f * v3d->far) {
 			view_zoom_mouseloc(ar, 1.2f, mx, my);
 		}
 	}
 	else {
-		if(use_cam_zoom) {
-			rv3d->camzoom+= 10;
-			if(rv3d->camzoom > RV3D_CAMZOOM_MAX) rv3d->camzoom= RV3D_CAMZOOM_MAX;
+		if (use_cam_zoom) {
+			rv3d->camzoom += 10.0f;
+			if (rv3d->camzoom > RV3D_CAMZOOM_MAX) rv3d->camzoom = RV3D_CAMZOOM_MAX;
 		}
-		else if(rv3d->dist> 0.001f * v3d->grid) {
+		else if (rv3d->dist > 0.001f * v3d->grid) {
 			view_zoom_mouseloc(ar, .83333f, mx, my);
 		}
 	}
 
-	if(rv3d->viewlock & RV3D_BOXVIEW)
+	if (rv3d->viewlock & RV3D_BOXVIEW)
 		view3d_boxview_sync(sa, ar);
 
 	ED_view3d_depth_tag_update(rv3d);
@@ -1646,29 +1684,31 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
 void viewdolly_modal_keymap(wmKeyConfig *keyconf)
 {
 	static EnumPropertyItem modal_items[] = {
-	{VIEW_MODAL_CONFIRM,	"CONFIRM", 0, "Confirm", ""},
+		{VIEW_MODAL_CONFIRM,    "CONFIRM", 0, "Confirm", ""},
 
-	{VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"},
-	{VIEWROT_MODAL_SWITCH_MOVE, "SWITCH_TO_MOVE", 0, "Switch to Move"},
+		{VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"},
+		{VIEWROT_MODAL_SWITCH_MOVE, "SWITCH_TO_MOVE", 0, "Switch to Move"},
 
-	{0, NULL, 0, NULL, NULL}};
+		{0, NULL, 0, NULL, NULL}
+	};
 
-	wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Dolly Modal");
+	wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Dolly Modal");
 
 	/* this function is called for each spacetype, only needs to add map once */
-	if(keymap) return;
+	if (keymap && keymap->modal_items) return;
 
-	keymap= WM_modalkeymap_add(keyconf, "View3D Dolly Modal", modal_items);
+	keymap = WM_modalkeymap_add(keyconf, "View3D Dolly Modal", modal_items);
 
 	/* items for modal map */
 	WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_RELEASE, KM_ANY, 0, VIEW_MODAL_CONFIRM);
 	WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, VIEW_MODAL_CONFIRM);
 
-	/* disabled mode switching for now, can re-implement better, later on
+	/* disabled mode switching for now, can re-implement better, later on */
+#if 0
 	WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ROTATE);
 	WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_RELEASE, KM_ANY, 0, VIEWROT_MODAL_SWITCH_ROTATE);
 	WM_modalkeymap_add_item(keymap, LEFTSHIFTKEY, KM_PRESS, KM_ANY, 0, VIEWROT_MODAL_SWITCH_MOVE);
-	 */
+#endif
 	
 	/* assign map to operators */
 	WM_modalkeymap_assign(keymap, "VIEW3D_OT_dolly");
@@ -1681,7 +1721,7 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 	/* makes op->customdata */
 	viewops_data_create(C, op, event);
-	vod= op->customdata;
+	vod = op->customdata;
 
 	/* if one or the other zoom position aren't set, set from event */
 	if (!RNA_struct_property_is_set(op->ptr, "mx") || !RNA_struct_property_is_set(op->ptr, "my")) {
@@ -1689,7 +1729,7 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
 		RNA_int_set(op->ptr, "my", event->y);
 	}
 
-	if(RNA_struct_property_is_set(op->ptr, "delta")) {
+	if (RNA_struct_property_is_set(op->ptr, "delta")) {
 		viewzoom_exec(C, op);
 	}
 	else {
@@ -1711,10 +1751,10 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
 			return OPERATOR_FINISHED;
 		}
 		else {
-			if(U.viewzoom == USER_ZOOM_CONT) {
+			if (U.viewzoom == USER_ZOOM_CONT) {
 				/* needs a timer to continue redrawing */
-				vod->timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
-				vod->timer_lastdraw= PIL_check_seconds_timer();
+				vod->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
+				vod->timer_lastdraw = PIL_check_seconds_timer();
 			}
 
 			/* add temp handler */
@@ -1736,19 +1776,19 @@ static int viewzoom_cancel(bContext *C, wmOperator *op)
 void VIEW3D_OT_zoom(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Zoom View";
+	ot->name = "Zoom View";
 	ot->description = "Zoom in/out in the view";
-	ot->idname= "VIEW3D_OT_zoom";
+	ot->idname = "VIEW3D_OT_zoom";
 
 	/* api callbacks */
-	ot->invoke= viewzoom_invoke;
-	ot->exec= viewzoom_exec;
-	ot->modal= viewzoom_modal;
-	ot->poll= ED_operator_region_view3d_active;
-	ot->cancel= viewzoom_cancel;
+	ot->invoke = viewzoom_invoke;
+	ot->exec = viewzoom_exec;
+	ot->modal = viewzoom_modal;
+	ot->poll = ED_operator_region_view3d_active;
+	ot->cancel = viewzoom_cancel;
 
 	/* flags */
-	ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
+	ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_POINTER;
 
 	RNA_def_int(ot->srna, "delta", 0, INT_MIN, INT_MAX, "Delta", "", INT_MIN, INT_MAX);
 	RNA_def_int(ot->srna, "mx", 0, 0, INT_MAX, "Zoom Position X", "", 0, INT_MAX);
@@ -1759,13 +1799,13 @@ void VIEW3D_OT_zoom(wmOperatorType *ot)
 /* ************************ viewdolly ******************************** */
 static void view_dolly_mouseloc(ARegion *ar, float orig_ofs[3], float dvec[3], float dfac)
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 	madd_v3_v3v3fl(rv3d->ofs, orig_ofs, dvec, -(1.0f - dfac));
 }
 
 static void viewdolly_apply(ViewOpsData *vod, int x, int y, const short zoom_invert)
 {
-	float zfac=1.0;
+	float zfac = 1.0;
 
 	{
 		float len1, len2;
@@ -1784,10 +1824,10 @@ static void viewdolly_apply(ViewOpsData *vod, int x, int y, const short zoom_inv
 		zfac =  1.0f + ((len2 - len1) * 0.01f * vod->rv3d->dist);
 	}
 
-	if(zfac != 1.0f)
+	if (zfac != 1.0f)
 		view_dolly_mouseloc(vod->ar, vod->ofs, vod->mousevec, zfac);
 
-	if(vod->rv3d->viewlock & RV3D_BOXVIEW)
+	if (vod->rv3d->viewlock & RV3D_BOXVIEW)
 		view3d_boxview_sync(vod->sa, vod->ar);
 
 	ED_view3d_camera_lock_sync(vod->v3d, vod->rv3d);
@@ -1798,36 +1838,36 @@ static void viewdolly_apply(ViewOpsData *vod, int x, int y, const short zoom_inv
 
 static int viewdolly_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
-	ViewOpsData *vod= op->customdata;
-	short event_code= VIEW_PASS;
+	ViewOpsData *vod = op->customdata;
+	short event_code = VIEW_PASS;
 
 	/* execute the events */
-	if(event->type==MOUSEMOVE) {
-		event_code= VIEW_APPLY;
+	if (event->type == MOUSEMOVE) {
+		event_code = VIEW_APPLY;
 	}
-	else if(event->type==EVT_MODAL_MAP) {
+	else if (event->type == EVT_MODAL_MAP) {
 		switch (event->val) {
 			case VIEW_MODAL_CONFIRM:
-				event_code= VIEW_CONFIRM;
+				event_code = VIEW_CONFIRM;
 				break;
 			case VIEWROT_MODAL_SWITCH_MOVE:
 				WM_operator_name_call(C, "VIEW3D_OT_move", WM_OP_INVOKE_DEFAULT, NULL);
-				event_code= VIEW_CONFIRM;
+				event_code = VIEW_CONFIRM;
 				break;
 			case VIEWROT_MODAL_SWITCH_ROTATE:
 				WM_operator_name_call(C, "VIEW3D_OT_rotate", WM_OP_INVOKE_DEFAULT, NULL);
-				event_code= VIEW_CONFIRM;
+				event_code = VIEW_CONFIRM;
 				break;
 		}
 	}
-	else if(event->type==vod->origkey && event->val==KM_RELEASE) {
-		event_code= VIEW_CONFIRM;
+	else if (event->type == vod->origkey && event->val == KM_RELEASE) {
+		event_code = VIEW_CONFIRM;
 	}
 
-	if(event_code==VIEW_APPLY) {
+	if (event_code == VIEW_APPLY) {
 		viewdolly_apply(vod, event->x, event->y, (U.uiflag & USER_ZOOM_INVERT) != 0);
 	}
-	else if (event_code==VIEW_CONFIRM) {
+	else if (event_code == VIEW_CONFIRM) {
 		ED_view3d_depth_tag_update(vod->rv3d);
 		viewops_data_free(C, op);
 
@@ -1845,38 +1885,38 @@ static int viewdolly_exec(bContext *C, wmOperator *op)
 	ARegion *ar;
 	float mousevec[3];
 
-	int delta= RNA_int_get(op->ptr, "delta");
+	int delta = RNA_int_get(op->ptr, "delta");
 
-	if(op->customdata) {
-		ViewOpsData *vod= op->customdata;
+	if (op->customdata) {
+		ViewOpsData *vod = op->customdata;
 
-		sa= vod->sa;
-		ar= vod->ar;
+		sa = vod->sa;
+		ar = vod->ar;
 		copy_v3_v3(mousevec, vod->mousevec);
 	}
 	else {
-		sa= CTX_wm_area(C);
-		ar= CTX_wm_region(C);
+		sa = CTX_wm_area(C);
+		ar = CTX_wm_region(C);
 		negate_v3_v3(mousevec, ((RegionView3D *)ar->regiondata)->viewinv[2]);
 		normalize_v3(mousevec);
 	}
 
 	/* v3d= sa->spacedata.first; */ /* UNUSED */
-	rv3d= ar->regiondata;
+	rv3d = ar->regiondata;
 
 	/* overwrite the mouse vector with the view direction (zoom into the center) */
-	if((U.uiflag & USER_ZOOM_TO_MOUSEPOS) == 0) {
+	if ((U.uiflag & USER_ZOOM_TO_MOUSEPOS) == 0) {
 		normalize_v3_v3(mousevec, rv3d->viewinv[2]);
 	}
 
-	if(delta < 0) {
+	if (delta < 0) {
 		view_dolly_mouseloc(ar, rv3d->ofs, mousevec, 1.2f);
 	}
 	else {
 		view_dolly_mouseloc(ar, rv3d->ofs, mousevec, .83333f);
 	}
 
-	if(rv3d->viewlock & RV3D_BOXVIEW)
+	if (rv3d->viewlock & RV3D_BOXVIEW)
 		view3d_boxview_sync(sa, ar);
 
 	ED_view3d_depth_tag_update(rv3d);
@@ -1894,7 +1934,7 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 	/* makes op->customdata */
 	viewops_data_create(C, op, event);
-	vod= op->customdata;
+	vod = op->customdata;
 
 	/* if one or the other zoom position aren't set, set from event */
 	if (!RNA_struct_property_is_set(op->ptr, "mx") || !RNA_struct_property_is_set(op->ptr, "my")) {
@@ -1902,12 +1942,12 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, wmEvent *event)
 		RNA_int_set(op->ptr, "my", event->y);
 	}
 
-	if(RNA_struct_property_is_set(op->ptr, "delta")) {
+	if (RNA_struct_property_is_set(op->ptr, "delta")) {
 		viewdolly_exec(C, op);
 	}
 	else {
 		/* overwrite the mouse vector with the view direction (zoom into the center) */
-		if((U.uiflag & USER_ZOOM_TO_MOUSEPOS) == 0) {
+		if ((U.uiflag & USER_ZOOM_TO_MOUSEPOS) == 0) {
 			negate_v3_v3(vod->mousevec, vod->rv3d->viewinv[2]);
 			normalize_v3(vod->mousevec);
 		}
@@ -1943,14 +1983,14 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, wmEvent *event)
 /* like ED_operator_region_view3d_active but check its not in ortho view */
 static int viewdolly_poll(bContext *C)
 {
-	RegionView3D *rv3d= CTX_wm_region_view3d(C);
+	RegionView3D *rv3d = CTX_wm_region_view3d(C);
 
-	if(rv3d) {
+	if (rv3d) {
 		if (rv3d->persp == RV3D_PERSP) {
 			return 1;
 		}
 		else {
-			View3D *v3d= CTX_wm_view3d(C);
+			View3D *v3d = CTX_wm_view3d(C);
 			if (ED_view3d_camera_lock_check(v3d, rv3d)) {
 				return 1;
 			}
@@ -1969,19 +2009,19 @@ static int viewdolly_cancel(bContext *C, wmOperator *op)
 void VIEW3D_OT_dolly(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Dolly view";
+	ot->name = "Dolly view";
 	ot->description = "Dolly in/out in the view";
-	ot->idname= "VIEW3D_OT_dolly";
+	ot->idname = "VIEW3D_OT_dolly";
 
 	/* api callbacks */
-	ot->invoke= viewdolly_invoke;
-	ot->exec= viewdolly_exec;
-	ot->modal= viewdolly_modal;
-	ot->poll= viewdolly_poll;
-	ot->cancel= viewdolly_cancel;
+	ot->invoke = viewdolly_invoke;
+	ot->exec = viewdolly_exec;
+	ot->modal = viewdolly_modal;
+	ot->poll = viewdolly_poll;
+	ot->cancel = viewdolly_cancel;
 
 	/* flags */
-	ot->flag= OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
+	ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_POINTER;
 
 	RNA_def_int(ot->srna, "delta", 0, INT_MIN, INT_MAX, "Delta", "", INT_MIN, INT_MAX);
 	RNA_def_int(ot->srna, "mx", 0, 0, INT_MAX, "Zoom Position X", "", 0, INT_MAX);
@@ -1992,22 +2032,22 @@ void VIEW3D_OT_dolly(wmOperatorType *ot)
 
 static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2.4x */
 {
-	ARegion *ar= CTX_wm_region(C);
+	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);
+	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 skip_camera = ED_view3d_camera_lock_check(v3d, rv3d);
 
-	int center= RNA_boolean_get(op->ptr, "center");
+	int center = RNA_boolean_get(op->ptr, "center");
 
 	float size, min[3], max[3], afm[3];
-	int ok= 1, onedone=0;
+	int ok = 1, onedone = 0;
 
-	if(center) {
+	if (center) {
 		/* in 2.4x this also move the cursor to (0, 0, 0) (with shift+c). */
-		curs= give_cursor(scene, v3d);
+		curs = give_cursor(scene, v3d);
 		zero_v3(min);
 		zero_v3(max);
 		zero_v3(curs);
@@ -2016,18 +2056,18 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
 		INIT_MINMAX(min, max);
 	}
 
-	for(base= scene->base.first; base; base= base->next) {
-		if(BASE_VISIBLE(v3d, base)) {
-			onedone= 1;
+	for (base = scene->base.first; base; base = base->next) {
+		if (BASE_VISIBLE(v3d, base)) {
+			onedone = 1;
 
-			if(skip_camera && base->object == v3d->camera) {
+			if (skip_camera && base->object == v3d->camera) {
 				continue;
 			}
 
 			minmax_object(base->object, min, max);
 		}
 	}
-	if(!onedone) {
+	if (!onedone) {
 		ED_region_tag_redraw(ar);
 		/* TODO - should this be cancel?
 		 * I think no, because we always move the cursor, with or without
@@ -2040,27 +2080,27 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
 	}
 
 	sub_v3_v3v3(afm, max, min);
-	size= 0.7f*MAX3(afm[0], afm[1], afm[2]);
-	if(size == 0.0f) ok= 0;
+	size = 0.7f * MAX3(afm[0], afm[1], afm[2]);
+	if (size == 0.0f) ok = 0;
 
-	if(ok) {
+	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;
+		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 (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;
+		if ((rv3d->persp == RV3D_CAMOB) && !ED_view3d_camera_lock_check(v3d, rv3d)) {
+			rv3d->persp = RV3D_PERSP;
 			smooth_view(C, v3d, ar, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL);
 		}
 		else {
@@ -2069,7 +2109,7 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
 	}
 // XXX	BIF_view3d_previewrender_signal(curarea, PR_DBASE|PR_DISPRECT);
 
-	WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d);
+	WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
 
 	return OPERATOR_FINISHED;
 }
@@ -2078,16 +2118,16 @@ static int view3d_all_exec(bContext *C, wmOperator *op) /* was view3d_home() in
 void VIEW3D_OT_view_all(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View All";
+	ot->name = "View All";
 	ot->description = "View all objects in scene";
-	ot->idname= "VIEW3D_OT_view_all";
+	ot->idname = "VIEW3D_OT_view_all";
 
 	/* api callbacks */
-	ot->exec= view3d_all_exec;
-	ot->poll= ED_operator_region_view3d_active;
+	ot->exec = view3d_all_exec;
+	ot->poll = ED_operator_region_view3d_active;
 
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 
 	RNA_def_boolean(ot->srna, "center", 0, "Center", "");
 }
@@ -2095,15 +2135,15 @@ void VIEW3D_OT_view_all(wmOperatorType *ot)
 /* like a localview without local!, was centerview() in 2.4x */
 static int viewselected_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	ARegion *ar= CTX_wm_region(C);
+	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);
+	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];
-	int ok=0, ok_dist=1;
-	const short skip_camera= ED_view3d_camera_lock_check(v3d, rv3d);
+	int ok = 0, ok_dist = 1;
+	const short skip_camera = ED_view3d_camera_lock_check(v3d, rv3d);
 
 	/* SMOOTHVIEW */
 	float new_ofs[3];
@@ -2111,36 +2151,36 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op))
 
 	INIT_MINMAX(min, max);
 
-	if (ob && ob->mode & OB_MODE_WEIGHT_PAINT) {
-		/* hardcoded exception, we look for the one selected armature */
+	if (ob && (ob->mode & OB_MODE_WEIGHT_PAINT)) {
+		/* hard-coded exception, we look for the one selected armature */
 		/* this is weak code this way, we should make a generic active/selection callback interface once... */
 		Base *base;
-		for(base=scene->base.first; base; base= base->next) {
-			if(TESTBASELIB(v3d, base)) {
-				if(base->object->type==OB_ARMATURE)
-					if(base->object->mode & OB_MODE_POSE)
+		for (base = scene->base.first; base; base = base->next) {
+			if (TESTBASELIB(v3d, base)) {
+				if (base->object->type == OB_ARMATURE)
+					if (base->object->mode & OB_MODE_POSE)
 						break;
 			}
 		}
-		if(base)
-			ob= base->object;
+		if (base)
+			ob = base->object;
 	}
 
 
-	if(obedit) {
-		ok = minmax_verts(obedit, min, max);	/* only selected */
+	if (obedit) {
+		ok = minmax_verts(obedit, min, max);    /* only selected */
 	}
-	else if(ob && (ob->mode & OB_MODE_POSE)) {
-		if(ob->pose) {
-			bArmature *arm= ob->data;
+	else if (ob && (ob->mode & OB_MODE_POSE)) {
+		if (ob->pose) {
+			bArmature *arm = ob->data;
 			bPoseChannel *pchan;
 			float vec[3];
 
-			for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
-				if(pchan->bone->flag & BONE_SELECTED) {
-					if(pchan->bone->layer & arm->layer) {
-						bPoseChannel *pchan_tx= pchan->custom_tx ? pchan->custom_tx : pchan;
-						ok= 1;
+			for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+				if (pchan->bone->flag & BONE_SELECTED) {
+					if (pchan->bone->layer & arm->layer) {
+						bPoseChannel *pchan_tx = pchan->custom_tx ? pchan->custom_tx : pchan;
+						ok = 1;
 						mul_v3_m4v3(vec, ob->obmat, pchan_tx->pose_head);
 						DO_MINMAX(vec, min, max);
 						mul_v3_m4v3(vec, ob->obmat, pchan_tx->pose_tail);
@@ -2151,46 +2191,46 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op))
 		}
 	}
 	else if (paint_facesel_test(ob)) {
-		ok= paintface_minmax(ob, min, max);
+		ok = paintface_minmax(ob, min, max);
 	}
 	else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT)) {
-		ok= PE_minmax(scene, min, max);
+		ok = PE_minmax(scene, min, max);
 	}
 	else {
 		Base *base;
-		for(base= FIRSTBASE; base; base = base->next) {
-			if(TESTBASE(v3d, base))  {
+		for (base = FIRSTBASE; base; base = base->next) {
+			if (TESTBASE(v3d, base)) {
 
-				if(skip_camera && base->object == v3d->camera) {
+				if (skip_camera && base->object == v3d->camera) {
 					continue;
 				}
 
 				/* account for duplis */
-				if (minmax_object_duplis(scene, base->object, min, max)==0)
-					minmax_object(base->object, min, max); /* use if duplis not found */
+				if (minmax_object_duplis(scene, base->object, min, max) == 0)
+					minmax_object(base->object, min, max);  /* use if duplis not found */
 
-				ok= 1;
+				ok = 1;
 			}
 		}
 	}
 
-	if(ok==0) return OPERATOR_FINISHED;
+	if (ok == 0) return OPERATOR_FINISHED;
 
 	sub_v3_v3v3(afm, max, min);
-	size= MAX3(afm[0], afm[1], afm[2]);
+	size = MAX3(afm[0], afm[1], afm[2]);
 
-	if(!rv3d->is_persp) {
-		if(size < 0.0001f) { /* if its a sinble point. dont even re-scale */
-			ok_dist= 0;
+	if (!rv3d->is_persp) {
+		if (size < 0.0001f) { /* if its a sinble point. don't even re-scale */
+			ok_dist = 0;
 		}
 		else {
 			/* perspective should be a bit farther away to look nice */
-			size*= 0.7f;
+			size *= 0.7f;
 		}
 	}
 	else {
-		if(size <= v3d->near*1.5f) {
-			size= v3d->near*1.5f;
+		if (size <= v3d->near * 1.5f) {
+			size = v3d->near * 1.5f;
 		}
 	}
 
@@ -2200,14 +2240,14 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op))
 	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 (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;
+	if (rv3d->persp == RV3D_CAMOB && !ED_view3d_camera_lock_check(v3d, rv3d)) {
+		rv3d->persp = RV3D_PERSP;
 		smooth_view(C, v3d, ar, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL);
 	}
 	else {
@@ -2225,26 +2265,26 @@ void VIEW3D_OT_view_selected(wmOperatorType *ot)
 {
 
 	/* identifiers */
-	ot->name= "View Selected";
+	ot->name = "View Selected";
 	ot->description = "Move the view to the selection center";
-	ot->idname= "VIEW3D_OT_view_selected";
+	ot->idname = "VIEW3D_OT_view_selected";
 
 	/* api callbacks */
-	ot->exec= viewselected_exec;
-	ot->poll= ED_operator_region_view3d_active;
+	ot->exec = viewselected_exec;
+	ot->poll = ED_operator_region_view3d_active;
 
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 }
 
 static int viewcenter_cursor_exec(bContext *C, wmOperator *UNUSED(op))
 {
 	View3D *v3d = CTX_wm_view3d(C);
-	RegionView3D *rv3d= CTX_wm_region_view3d(C);
-	Scene *scene= CTX_data_scene(C);
+	RegionView3D *rv3d = CTX_wm_region_view3d(C);
+	Scene *scene = CTX_data_scene(C);
 	
 	if (rv3d) {
-		ARegion *ar= CTX_wm_region(C);
+		ARegion *ar = CTX_wm_region(C);
 
 		/* non camera center */
 		float new_ofs[3];
@@ -2260,21 +2300,21 @@ static int viewcenter_cursor_exec(bContext *C, wmOperator *UNUSED(op))
 void VIEW3D_OT_view_center_cursor(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Center View to Cursor";
-	ot->description= "Center the view so that the cursor is in the middle of the view";
-	ot->idname= "VIEW3D_OT_view_center_cursor";
+	ot->name = "Center View to Cursor";
+	ot->description = "Center the view so that the cursor is in the middle of the view";
+	ot->idname = "VIEW3D_OT_view_center_cursor";
 	
 	/* api callbacks */
-	ot->exec= viewcenter_cursor_exec;
-	ot->poll= ED_operator_view3d_active;
+	ot->exec = viewcenter_cursor_exec;
+	ot->poll = ED_operator_view3d_active;
 	
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 }
 
 static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was view3d_home() in 2.4x */
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	float xfac, yfac;
 	float size[2];
 
@@ -2286,18 +2326,18 @@ static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was
 	ED_view3d_context_user_region(C, &v3d, &ar);
 	rv3d = ar->regiondata;
 
-	rv3d->camdx= rv3d->camdy= 0.0f;
+	rv3d->camdx = rv3d->camdy = 0.0f;
 
 	ED_view3d_calc_camera_border_size(scene, ar, v3d, rv3d, size);
 
 	/* 4px is just a little room from the edge of the area */
-	xfac= (float)ar->winx / (float)(size[0] + 4);
-	yfac= (float)ar->winy / (float)(size[1] + 4);
+	xfac = (float)ar->winx / (float)(size[0] + 4);
+	yfac = (float)ar->winy / (float)(size[1] + 4);
 
-	rv3d->camzoom= BKE_screen_view3d_zoom_from_fac(MIN2(xfac, yfac));
+	rv3d->camzoom = BKE_screen_view3d_zoom_from_fac(MIN2(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));
+	WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C));
 
 	return OPERATOR_FINISHED;
 }
@@ -2305,16 +2345,16 @@ static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was
 void VIEW3D_OT_view_center_camera(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View Camera Center";
+	ot->name = "View Camera Center";
 	ot->description = "Center the camera view";
-	ot->idname= "VIEW3D_OT_view_center_camera";
+	ot->idname = "VIEW3D_OT_view_center_camera";
 
 	/* api callbacks */
-	ot->exec= view3d_center_camera_exec;
-	ot->poll= view3d_camera_user_poll;
+	ot->exec = view3d_center_camera_exec;
+	ot->poll = view3d_camera_user_poll;
 
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 }
 
 /* ********************* Set render border operator ****************** */
@@ -2322,26 +2362,26 @@ void VIEW3D_OT_view_center_camera(wmOperatorType *ot)
 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);
+	ARegion *ar = CTX_wm_region(C);
+	RegionView3D *rv3d = ED_view3d_context_rv3d(C);
+	Scene *scene = CTX_data_scene(C);
 
 	rcti rect;
 	rctf vb;
 
 	/* get border select values using rna */
-	rect.xmin= RNA_int_get(op->ptr, "xmin");
-	rect.ymin= RNA_int_get(op->ptr, "ymin");
-	rect.xmax= RNA_int_get(op->ptr, "xmax");
-	rect.ymax= RNA_int_get(op->ptr, "ymax");
+	rect.xmin = RNA_int_get(op->ptr, "xmin");
+	rect.ymin = RNA_int_get(op->ptr, "ymin");
+	rect.xmax = RNA_int_get(op->ptr, "xmax");
+	rect.ymax = RNA_int_get(op->ptr, "ymax");
 
 	/* calculate range */
 	ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, FALSE);
 
-	scene->r.border.xmin= ((float)rect.xmin-vb.xmin)/(vb.xmax-vb.xmin);
-	scene->r.border.ymin= ((float)rect.ymin-vb.ymin)/(vb.ymax-vb.ymin);
-	scene->r.border.xmax= ((float)rect.xmax-vb.xmin)/(vb.xmax-vb.xmin);
-	scene->r.border.ymax= ((float)rect.ymax-vb.ymin)/(vb.ymax-vb.ymin);
+	scene->r.border.xmin = ((float)rect.xmin - vb.xmin) / (vb.xmax - vb.xmin);
+	scene->r.border.ymin = ((float)rect.ymin - vb.ymin) / (vb.ymax - vb.ymin);
+	scene->r.border.xmax = ((float)rect.xmax - vb.xmin) / (vb.xmax - vb.xmin);
+	scene->r.border.ymax = ((float)rect.ymax - vb.ymin) / (vb.ymax - vb.ymin);
 
 	/* actually set border */
 	CLAMP(scene->r.border.xmin, 0.0f, 1.0f);
@@ -2352,16 +2392,17 @@ static int render_border_exec(bContext *C, wmOperator *op)
 	/* 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 ))
+	     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))
 	{
 		scene->r.mode &= ~R_BORDER;
-	} else {
+	}
+	else {
 		scene->r.mode |= R_BORDER;
 	}
 	
-	WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+	WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, NULL);
 
 	return OPERATOR_FINISHED;
 
@@ -2370,20 +2411,20 @@ static int render_border_exec(bContext *C, wmOperator *op)
 void VIEW3D_OT_render_border(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Render Border";
+	ot->name = "Set Render Border";
 	ot->description = "Set the boundaries of the border render and enables border render";
-	ot->idname= "VIEW3D_OT_render_border";
+	ot->idname = "VIEW3D_OT_render_border";
 
 	/* api callbacks */
-	ot->invoke= WM_border_select_invoke;
-	ot->exec= render_border_exec;
-	ot->modal= WM_border_select_modal;
-	ot->cancel= WM_border_select_cancel;
+	ot->invoke = WM_border_select_invoke;
+	ot->exec = render_border_exec;
+	ot->modal = WM_border_select_modal;
+	ot->cancel = WM_border_select_cancel;
 
-	ot->poll= view3d_camera_active_poll;
+	ot->poll = view3d_camera_active_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* rna */
 	RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX);
@@ -2396,10 +2437,10 @@ void VIEW3D_OT_render_border(wmOperatorType *ot)
 
 static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
 {
-	ARegion *ar= CTX_wm_region(C);
+	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);
+	RegionView3D *rv3d = CTX_wm_region_view3d(C);
+	Scene *scene = CTX_data_scene(C);
 
 	/* Zooms in on a border drawn by the user */
 	rcti rect;
@@ -2411,17 +2452,17 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
 
 	/* ZBuffer depth vars */
 	bglMats mats;
-	float depth_close= FLT_MAX;
+	float depth_close = FLT_MAX;
 	double cent[2],  p[3];
 
 	/* note; otherwise opengl won't work */
 	view3d_operator_needs_opengl(C);
 
 	/* get border select values using rna */
-	rect.xmin= RNA_int_get(op->ptr, "xmin");
-	rect.ymin= RNA_int_get(op->ptr, "ymin");
-	rect.xmax= RNA_int_get(op->ptr, "xmax");
-	rect.ymax= RNA_int_get(op->ptr, "ymax");
+	rect.xmin = RNA_int_get(op->ptr, "xmin");
+	rect.ymin = RNA_int_get(op->ptr, "ymin");
+	rect.xmax = RNA_int_get(op->ptr, "xmax");
+	rect.ymax = RNA_int_get(op->ptr, "ymax");
 
 	/* Get Z Depths, needed for perspective, nice for ortho */
 	bgl_get_mats(&mats);
@@ -2429,25 +2470,25 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
 	
 	{
 		/* avoid allocating the whole depth buffer */
-		ViewDepths depth_temp= {0};
+		ViewDepths depth_temp = {0};
 
 		/* avoid view3d_update_depths() for speed. */
 		view3d_update_depths_rect(ar, &depth_temp, &rect);
 	
 		/* find the closest Z pixel */
-		depth_close= view3d_depth_near(&depth_temp);
+		depth_close = view3d_depth_near(&depth_temp);
 	
 		MEM_freeN(depth_temp.depths);
 	}
 
-	cent[0] = (((double)rect.xmin)+((double)rect.xmax)) / 2;
-	cent[1] = (((double)rect.ymin)+((double)rect.ymax)) / 2;
+	cent[0] = (((double)rect.xmin) + ((double)rect.xmax)) / 2;
+	cent[1] = (((double)rect.ymin) + ((double)rect.ymax)) / 2;
 
 	if (rv3d->is_persp) {
 		double p_corner[3];
 
 		/* no depths to use, we cant do anything! */
-		if (depth_close==FLT_MAX){
+		if (depth_close == FLT_MAX) {
 			BKE_report(op->reports, RPT_ERROR, "Depth Too Large");
 			return OPERATOR_CANCELLED;
 		}
@@ -2456,25 +2497,26 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
 		                    mats.modelview, mats.projection, (GLint *)mats.viewport,
 		                    &p[0], &p[1], &p[2])) ||
 		     (!gluUnProject((double)rect.xmin, (double)rect.ymin, depth_close,
-			                mats.modelview, mats.projection, (GLint *)mats.viewport,
-			                &p_corner[0], &p_corner[1], &p_corner[2])))
+		                    mats.modelview, mats.projection, (GLint *)mats.viewport,
+		                    &p_corner[0], &p_corner[1], &p_corner[2])))
 		{
 			return OPERATOR_CANCELLED;
 		}
 
-		dvec[0] = p[0]-p_corner[0];
-		dvec[1] = p[1]-p_corner[1];
-		dvec[2] = p[2]-p_corner[2];
+		dvec[0] = p[0] - p_corner[0];
+		dvec[1] = p[1] - p_corner[1];
+		dvec[2] = p[2] - p_corner[2];
 
 		new_dist = len_v3(dvec);
-		if(new_dist <= v3d->near * 1.5f) new_dist= v3d->near * 1.5f;
+		if (new_dist <= v3d->near * 1.5f) new_dist = v3d->near * 1.5f;
 
 		new_ofs[0] = -p[0];
 		new_ofs[1] = -p[1];
 		new_ofs[2] = -p[2];
 
-	} else { /* othographic */
-		/* find the current window width and height */
+	}
+	else { /* othographic */
+		   /* find the current window width and height */
 		vb[0] = ar->winx;
 		vb[1] = ar->winy;
 
@@ -2496,25 +2538,25 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
 
 			initgrabz(rv3d, -new_ofs[0], -new_ofs[1], -new_ofs[2]);
 
-			mval_f[0]= (rect.xmin + rect.xmax - vb[0]) / 2.0f;
-			mval_f[1]= (rect.ymin + rect.ymax - vb[1]) / 2.0f;
+			mval_f[0] = (rect.xmin + rect.xmax - vb[0]) / 2.0f;
+			mval_f[1] = (rect.ymin + rect.ymax - vb[1]) / 2.0f;
 			ED_view3d_win_to_delta(ar, mval_f, dvec);
 			/* center the view to the center of the rectangle */
 			sub_v3_v3(new_ofs, dvec);
 		}
 
 		/* work out the ratios, so that everything selected fits when we zoom */
-		xscale = ((rect.xmax-rect.xmin)/vb[0]);
-		yscale = ((rect.ymax-rect.ymin)/vb[1]);
-		scale = (xscale >= yscale)?xscale:yscale;
+		xscale = ((rect.xmax - rect.xmin) / vb[0]);
+		yscale = ((rect.ymax - rect.ymin) / vb[1]);
+		scale = (xscale >= yscale) ? xscale : yscale;
 
 		/* zoom in as required, or as far as we can go */
-		new_dist = ((new_dist*scale) >= 0.001f * v3d->grid)? new_dist*scale:0.001f * v3d->grid;
+		new_dist = ((new_dist * scale) >= 0.001f * v3d->grid) ? new_dist * scale : 0.001f * v3d->grid;
 	}
 
 	smooth_view(C, v3d, ar, NULL, NULL, new_ofs, NULL, &new_dist, NULL);
 
-	if(rv3d->viewlock & RV3D_BOXVIEW)
+	if (rv3d->viewlock & RV3D_BOXVIEW)
 		view3d_boxview_sync(CTX_wm_area(C), ar);
 
 	return OPERATOR_FINISHED;
@@ -2522,8 +2564,8 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
 
 static int view3d_zoom_border_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	View3D *v3d= CTX_wm_view3d(C);
-	RegionView3D *rv3d= CTX_wm_region_view3d(C);
+	View3D *v3d = CTX_wm_view3d(C);
+	RegionView3D *rv3d = CTX_wm_region_view3d(C);
 
 	/* if in camera view do not exec the operator so we do not conflict with set render border*/
 	if ((rv3d->persp != RV3D_CAMOB) || ED_view3d_camera_lock_check(v3d, rv3d))
@@ -2535,20 +2577,20 @@ static int view3d_zoom_border_invoke(bContext *C, wmOperator *op, wmEvent *event
 void VIEW3D_OT_zoom_border(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Border Zoom";
+	ot->name = "Border Zoom";
 	ot->description = "Zoom in the view to the nearest object contained in the border";
-	ot->idname= "VIEW3D_OT_zoom_border";
+	ot->idname = "VIEW3D_OT_zoom_border";
 
 	/* api callbacks */
-	ot->invoke= view3d_zoom_border_invoke;
-	ot->exec= view3d_zoom_border_exec;
-	ot->modal= WM_border_select_modal;
-	ot->cancel= WM_border_select_cancel;
+	ot->invoke = view3d_zoom_border_invoke;
+	ot->exec = view3d_zoom_border_exec;
+	ot->modal = WM_border_select_modal;
+	ot->cancel = WM_border_select_cancel;
 
-	ot->poll= ED_operator_region_view3d_active;
+	ot->poll = ED_operator_region_view3d_active;
 
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 
 	/* rna */
 	RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX);
@@ -2561,19 +2603,19 @@ void VIEW3D_OT_zoom_border(wmOperatorType *ot)
 /* sets the view to 1:1 camera/render-pixel */
 static void view3d_set_1_to_1_viewborder(Scene *scene, ARegion *ar, View3D *v3d)
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 	float size[2];
-	int im_width= (scene->r.size*scene->r.xsch)/100;
+	int im_width = (scene->r.size * scene->r.xsch) / 100;
 	
 	ED_view3d_calc_camera_border_size(scene, ar, v3d, rv3d, size);
 
-	rv3d->camzoom= BKE_screen_view3d_zoom_from_fac((float)im_width/size[0]);
+	rv3d->camzoom = BKE_screen_view3d_zoom_from_fac((float)im_width / size[0]);
 	CLAMP(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
 }
 
 static int view3d_zoom_1_to_1_camera_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 
 	View3D *v3d;
 	ARegion *ar;
@@ -2583,7 +2625,7 @@ static int view3d_zoom_1_to_1_camera_exec(bContext *C, wmOperator *UNUSED(op))
 
 	view3d_set_1_to_1_viewborder(scene, ar, v3d);
 
-	WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d);
+	WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
 
 	return OPERATOR_FINISHED;
 }
@@ -2591,16 +2633,16 @@ static int view3d_zoom_1_to_1_camera_exec(bContext *C, wmOperator *UNUSED(op))
 void VIEW3D_OT_zoom_camera_1_to_1(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Zoom Camera 1:1";
+	ot->name = "Zoom Camera 1:1";
 	ot->description = "Match the camera to 1:1 to the render output";
-	ot->idname= "VIEW3D_OT_zoom_camera_1_to_1";
+	ot->idname = "VIEW3D_OT_zoom_camera_1_to_1";
 
 	/* api callbacks */
-	ot->exec= view3d_zoom_1_to_1_camera_exec;
-	ot->poll= view3d_camera_user_poll;
+	ot->exec = view3d_zoom_1_to_1_camera_exec;
+	ot->poll = view3d_camera_user_poll;
 
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 }
 
 /* ********************* Changing view operator ****************** */
@@ -2613,7 +2655,8 @@ static EnumPropertyItem prop_view_items[] = {
 	{RV3D_VIEW_TOP, "TOP", 0, "Top", "View From the Top"},
 	{RV3D_VIEW_BOTTOM, "BOTTOM", 0, "Bottom", "View From the Bottom"},
 	{RV3D_VIEW_CAMERA, "CAMERA", 0, "Camera", "View From the active camera"},
-	{0, NULL, 0, NULL, NULL}};
+	{0, NULL, 0, NULL, NULL}
+};
 
 
 /* would like to make this a generic function - outside of transform */
@@ -2622,19 +2665,19 @@ static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar,
                           float q1, float q2, float q3, float q4,
                           short view, int perspo, int align_active)
 {
-	RegionView3D *rv3d= ar->regiondata; /* no NULL check is needed, poll checks */
+	RegionView3D *rv3d = ar->regiondata; /* no NULL check is needed, poll checks */
 	float new_quat[4];
 
-	new_quat[0]= q1; new_quat[1]= q2;
-	new_quat[2]= q3; new_quat[3]= q4;
+	new_quat[0] = q1; new_quat[1] = q2;
+	new_quat[2] = q3; new_quat[3] = q4;
 	normalize_qt(new_quat);
 
-	if(align_active) {
+	if (align_active) {
 		/* align to active object */
-		Object *obact= CTX_data_active_object(C);
-		if (obact==NULL) {
+		Object *obact = CTX_data_active_object(C);
+		if (obact == NULL) {
 			/* no active object, ignore this option */
-			align_active= FALSE;
+			align_active = FALSE;
 		}
 		else {
 			float obact_quat[4];
@@ -2643,46 +2686,50 @@ static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar,
 			/* same as transform manipulator when normal is set */
 			ED_getTransformOrientationMatrix(C, twmat, FALSE);
 
-			mat3_to_quat( obact_quat,twmat);
+			mat3_to_quat(obact_quat, twmat);
 			invert_qt(obact_quat);
 			mul_qt_qtqt(new_quat, new_quat, obact_quat);
 
-			rv3d->view= view= RV3D_VIEW_USER;
+			rv3d->view = view = RV3D_VIEW_USER;
 		}
 	}
 
-	if(align_active==FALSE) {
+	if (align_active == FALSE) {
 		/* normal operation */
-		if(rv3d->viewlock) {
+		if (rv3d->viewlock) {
 			/* only pass on if */
-			if(rv3d->view==RV3D_VIEW_FRONT && view==RV3D_VIEW_BACK);
-			else if(rv3d->view==RV3D_VIEW_BACK && view==RV3D_VIEW_FRONT);
-			else if(rv3d->view==RV3D_VIEW_RIGHT && view==RV3D_VIEW_LEFT);
-			else if(rv3d->view==RV3D_VIEW_LEFT && view==RV3D_VIEW_RIGHT);
-			else if(rv3d->view==RV3D_VIEW_BOTTOM && view==RV3D_VIEW_TOP);
-			else if(rv3d->view==RV3D_VIEW_TOP && view==RV3D_VIEW_BOTTOM);
-			else return;
+
+			/* nice confusing if-block */
+			if (!((rv3d->view == RV3D_VIEW_FRONT  && view == RV3D_VIEW_BACK)  ||
+			      (rv3d->view == RV3D_VIEW_BACK   && view == RV3D_VIEW_FRONT) ||
+			      (rv3d->view == RV3D_VIEW_RIGHT  && view == RV3D_VIEW_LEFT)  ||
+			      (rv3d->view == RV3D_VIEW_LEFT   && view == RV3D_VIEW_RIGHT) ||
+			      (rv3d->view == RV3D_VIEW_BOTTOM && view == RV3D_VIEW_TOP)   ||
+			      (rv3d->view == RV3D_VIEW_TOP    && view == RV3D_VIEW_BOTTOM)))
+			{
+				return;
+			}
 		}
 
-		rv3d->view= view;
+		rv3d->view = view;
 	}
 
-	if(rv3d->viewlock) {
+	if (rv3d->viewlock) {
 		ED_region_tag_redraw(ar);
 		return;
 	}
 
-	if (rv3d->persp==RV3D_CAMOB && v3d->camera) {
+	if (rv3d->persp == RV3D_CAMOB && v3d->camera) {
 
-		if (U.uiflag & USER_AUTOPERSP) rv3d->persp= view ? RV3D_ORTHO : RV3D_PERSP;
-		else if(rv3d->persp==RV3D_CAMOB) rv3d->persp= perspo;
+		if (U.uiflag & USER_AUTOPERSP) rv3d->persp = view ? RV3D_ORTHO : RV3D_PERSP;
+		else if (rv3d->persp == RV3D_CAMOB) rv3d->persp = perspo;
 
 		smooth_view(C, v3d, ar, v3d->camera, NULL, rv3d->ofs, new_quat, NULL, NULL);
 	}
 	else {
 
-		if (U.uiflag & USER_AUTOPERSP) rv3d->persp= view ? RV3D_ORTHO : RV3D_PERSP;
-		else if(rv3d->persp==RV3D_CAMOB) rv3d->persp= perspo;
+		if (U.uiflag & USER_AUTOPERSP) rv3d->persp = view ? RV3D_ORTHO : RV3D_PERSP;
+		else if (rv3d->persp == RV3D_CAMOB) rv3d->persp = perspo;
 
 		smooth_view(C, v3d, ar, NULL, NULL, NULL, new_quat, NULL, NULL);
 	}
@@ -2694,7 +2741,7 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
 	View3D *v3d;
 	ARegion *ar;
 	RegionView3D *rv3d;
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	static int perspo = RV3D_PERSP;
 	int viewnum, align_active, nextperspo;
 
@@ -2706,25 +2753,26 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
 	align_active = RNA_boolean_get(op->ptr, "align_active");
 
 	/* set this to zero, gets handled in axis_set_view */
-	if(rv3d->viewlock)
-		align_active= 0;
+	if (rv3d->viewlock)
+		align_active = 0;
 
 	/* Use this to test if we started out with a camera */
 
 	if (rv3d->persp == RV3D_CAMOB) {
-		nextperspo= rv3d->lpersp;
-	} else {
-		nextperspo= perspo;
+		nextperspo = rv3d->lpersp;
+	}
+	else {
+		nextperspo = perspo;
 	}
 
 	switch (viewnum) {
-		case RV3D_VIEW_BOTTOM :
+		case RV3D_VIEW_BOTTOM:
 			axis_set_view(C, v3d, ar, 0.0, -1.0, 0.0, 0.0,
 			              viewnum, nextperspo, align_active);
 			break;
 
 		case RV3D_VIEW_BACK:
-			axis_set_view(C, v3d, ar, 0.0, 0.0, (float)-cos(M_PI/4.0), (float)-cos(M_PI/4.0),
+			axis_set_view(C, v3d, ar, 0.0, 0.0, (float)-cos(M_PI / 4.0), (float)-cos(M_PI / 4.0),
 			              viewnum, nextperspo, align_active);
 			break;
 
@@ -2739,7 +2787,7 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
 			break;
 
 		case RV3D_VIEW_FRONT:
-			axis_set_view(C, v3d, ar, (float)cos(M_PI/4.0), (float)-sin(M_PI/4.0), 0.0, 0.0,
+			axis_set_view(C, v3d, ar, (float)cos(M_PI / 4.0), (float)-sin(M_PI / 4.0), 0.0, 0.0,
 			              viewnum, nextperspo, align_active);
 			break;
 
@@ -2749,62 +2797,62 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
 			break;
 
 		case RV3D_VIEW_CAMERA:
-			if(rv3d->viewlock==0) {
+			if (rv3d->viewlock == 0) {
 				/* lastview -  */
 
-				if(rv3d->persp != RV3D_CAMOB) {
-					Object *ob= OBACT;
+				if (rv3d->persp != RV3D_CAMOB) {
+					Object *ob = OBACT;
 
 					if (!rv3d->smooth_timer) {
 						/* store settings of current view before allowing overwriting with camera view
 						 * only if we're not currently in a view transition */
 						copy_qt_qt(rv3d->lviewquat, rv3d->viewquat);
-						rv3d->lview= rv3d->view;
-						rv3d->lpersp= rv3d->persp;
+						rv3d->lview = rv3d->view;
+						rv3d->lpersp = rv3d->persp;
 					}
 
 	#if 0
-					if(G.qual==LR_ALTKEY) {
-						if(oldcamera && is_an_active_object(oldcamera)) {
-							v3d->camera= oldcamera;
+					if (G.qual == LR_ALTKEY) {
+						if (oldcamera && is_an_active_object(oldcamera)) {
+							v3d->camera = oldcamera;
 						}
 						handle_view3d_lock();
 					}
 	#endif
 					
 					/* first get the default camera for the view lock type */
-					if(v3d->scenelock) {
+					if (v3d->scenelock) {
 						/* sets the camera view if available */
-						v3d->camera= scene->camera;						
+						v3d->camera = scene->camera;
 					}
 					else {
 						/* use scene camera if one is not set (even though we're unlocked) */
-						if(v3d->camera==NULL) {
-							v3d->camera= scene->camera;
+						if (v3d->camera == NULL) {
+							v3d->camera = scene->camera;
 						}
 					}
 
-					/* if the camera isnt found, check a number of options */
-					if(v3d->camera==NULL && ob && ob->type==OB_CAMERA)
-						v3d->camera= ob;
+					/* if the camera isn't found, check a number of options */
+					if (v3d->camera == NULL && ob && ob->type == OB_CAMERA)
+						v3d->camera = ob;
 					
-					if(v3d->camera==NULL)
-						v3d->camera= scene_find_camera(scene);		
+					if (v3d->camera == NULL)
+						v3d->camera = scene_find_camera(scene);
 
 					/* couldnt find any useful camera, bail out */
-					if(v3d->camera==NULL)
+					if (v3d->camera == NULL)
 						return OPERATOR_CANCELLED;
 					
-					/* important these dont get out of sync for locked scenes */
-					if(v3d->scenelock)
-						scene->camera= v3d->camera;
+					/* important these don't get out of sync for locked scenes */
+					if (v3d->scenelock)
+						scene->camera = v3d->camera;
 
 					/* finally do snazzy view zooming */
-					rv3d->persp= RV3D_CAMOB;
+					rv3d->persp = RV3D_CAMOB;
 					smooth_view(C, v3d, ar, NULL, v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, &v3d->lens);
 
 				}
-				else{
+				else {
 					/* return to settings of last view */
 					/* does smooth_view too */
 					axis_set_view(C, v3d, ar,
@@ -2814,11 +2862,11 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
 			}
 			break;
 
-		default :
+		default:
 			break;
 	}
 
-	if(rv3d->persp != RV3D_CAMOB) perspo= rv3d->persp;
+	if (rv3d->persp != RV3D_CAMOB) perspo = rv3d->persp;
 
 	return OPERATOR_FINISHED;
 }
@@ -2826,20 +2874,24 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
 
 void VIEW3D_OT_viewnumpad(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+
 	/* identifiers */
-	ot->name= "View numpad";
+	ot->name = "View numpad";
 	ot->description = "Set the view";
-	ot->idname= "VIEW3D_OT_viewnumpad";
+	ot->idname = "VIEW3D_OT_viewnumpad";
 
 	/* api callbacks */
-	ot->exec= viewnumpad_exec;
-	ot->poll= ED_operator_rv3d_user_region_poll;
+	ot->exec = viewnumpad_exec;
+	ot->poll = ED_operator_rv3d_user_region_poll;
 
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 
-	RNA_def_enum(ot->srna, "type", prop_view_items, 0, "View", "The Type of view");
-	RNA_def_boolean(ot->srna, "align_active", 0, "Align Active", "Align to the active object's axis");
+	prop = RNA_def_enum(ot->srna, "type", prop_view_items, 0, "View", "The Type of view");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+	prop = RNA_def_boolean(ot->srna, "align_active", 0, "Align Active", "Align to the active object's axis");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 }
 
 static EnumPropertyItem prop_view_orbit_items[] = {
@@ -2847,7 +2899,8 @@ static EnumPropertyItem prop_view_orbit_items[] = {
 	{V3D_VIEW_STEPRIGHT, "ORBITRIGHT", 0, "Orbit Right", "Orbit the view around to the Right"},
 	{V3D_VIEW_STEPUP, "ORBITUP", 0, "Orbit Up", "Orbit the view Up"},
 	{V3D_VIEW_STEPDOWN, "ORBITDOWN", 0, "Orbit Down", "Orbit the view Down"},
-	{0, NULL, 0, NULL, NULL}};
+	{0, NULL, 0, NULL, NULL}
+};
 
 static int vieworbit_exec(bContext *C, wmOperator *op)
 {
@@ -2863,31 +2916,31 @@ static int vieworbit_exec(bContext *C, wmOperator *op)
 
 	orbitdir = RNA_enum_get(op->ptr, "type");
 
-	if(rv3d->viewlock==0) {
-		if((rv3d->persp != RV3D_CAMOB) || ED_view3d_camera_lock_check(v3d, rv3d)) {
-			if(orbitdir == V3D_VIEW_STEPLEFT || orbitdir == V3D_VIEW_STEPRIGHT) {
+	if (rv3d->viewlock == 0) {
+		if ((rv3d->persp != RV3D_CAMOB) || ED_view3d_camera_lock_check(v3d, rv3d)) {
+			if (orbitdir == V3D_VIEW_STEPLEFT || orbitdir == V3D_VIEW_STEPRIGHT) {
 				float si;
 				/* z-axis */
-				phi= (float)(M_PI/360.0)*U.pad_rot_angle;
-				if(orbitdir == V3D_VIEW_STEPRIGHT) phi= -phi;
-				si= (float)sin(phi);
-				q1[0]= (float)cos(phi);
-				q1[1]= q1[2]= 0.0;
-				q1[3]= si;
+				phi = (float)(M_PI / 360.0) * U.pad_rot_angle;
+				if (orbitdir == V3D_VIEW_STEPRIGHT) phi = -phi;
+				si = (float)sin(phi);
+				q1[0] = (float)cos(phi);
+				q1[1] = q1[2] = 0.0;
+				q1[3] = si;
 				mul_qt_qtqt(new_quat, rv3d->viewquat, q1);
-				rv3d->view= RV3D_VIEW_USER;
+				rv3d->view = RV3D_VIEW_USER;
 			}
-			else if(orbitdir == V3D_VIEW_STEPDOWN || orbitdir == V3D_VIEW_STEPUP) {
+			else if (orbitdir == V3D_VIEW_STEPDOWN || orbitdir == V3D_VIEW_STEPUP) {
 				/* horizontal axis */
-				copy_v3_v3(q1+1, rv3d->viewinv[0]);
+				copy_v3_v3(q1 + 1, rv3d->viewinv[0]);
 
-				normalize_v3(q1+1);
-				phi= (float)(M_PI/360.0)*U.pad_rot_angle;
-				if(orbitdir == V3D_VIEW_STEPDOWN) phi= -phi;
-				q1[0]= (float)cos(phi);
-				mul_v3_fl(q1+1, sin(phi));
+				normalize_v3(q1 + 1);
+				phi = (float)(M_PI / 360.0) * U.pad_rot_angle;
+				if (orbitdir == V3D_VIEW_STEPDOWN) phi = -phi;
+				q1[0] = (float)cos(phi);
+				mul_v3_fl(q1 + 1, sin(phi));
 				mul_qt_qtqt(new_quat, rv3d->viewquat, q1);
-				rv3d->view= RV3D_VIEW_USER;
+				rv3d->view = RV3D_VIEW_USER;
 			}
 
 			smooth_view(C, CTX_wm_view3d(C), ar, NULL, NULL, NULL, new_quat, NULL, NULL);
@@ -2900,16 +2953,16 @@ static int vieworbit_exec(bContext *C, wmOperator *op)
 void VIEW3D_OT_view_orbit(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View Orbit";
+	ot->name = "View Orbit";
 	ot->description = "Orbit the view";
-	ot->idname= "VIEW3D_OT_view_orbit";
+	ot->idname = "VIEW3D_OT_view_orbit";
 
 	/* api callbacks */
-	ot->exec= vieworbit_exec;
-	ot->poll= ED_operator_rv3d_user_region_poll;
+	ot->exec = vieworbit_exec;
+	ot->poll = ED_operator_rv3d_user_region_poll;
 
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 	RNA_def_enum(ot->srna, "type", prop_view_orbit_items, 0, "Orbit", "Direction of View Orbit");
 }
 
@@ -2918,26 +2971,27 @@ static EnumPropertyItem prop_view_pan_items[] = {
 	{V3D_VIEW_PANRIGHT, "PANRIGHT", 0, "Pan Right", "Pan the view to the Right"},
 	{V3D_VIEW_PANUP, "PANUP", 0, "Pan Up", "Pan the view Up"},
 	{V3D_VIEW_PANDOWN, "PANDOWN", 0, "Pan Down", "Pan the view Down"},
-	{0, NULL, 0, NULL, NULL}};
+	{0, NULL, 0, NULL, NULL}
+};
 
 static int viewpan_exec(bContext *C, wmOperator *op)
 {
-	ARegion *ar= CTX_wm_region(C);
-	RegionView3D *rv3d= CTX_wm_region_view3d(C);
+	ARegion *ar = CTX_wm_region(C);
+	RegionView3D *rv3d = CTX_wm_region_view3d(C);
 	float vec[3];
-	float mval_f[2]= {0.0f, 0.0f};
+	float mval_f[2] = {0.0f, 0.0f};
 	int pandir;
 
 	pandir = RNA_enum_get(op->ptr, "type");
 
 	initgrabz(rv3d, 0.0, 0.0, 0.0);
-	if(pandir == V3D_VIEW_PANRIGHT)		{ mval_f[0]= -32.0f; ED_view3d_win_to_delta(ar, mval_f, vec); }
-	else if(pandir == V3D_VIEW_PANLEFT)	{ mval_f[0]=  32.0f; ED_view3d_win_to_delta(ar, mval_f, vec); }
-	else if(pandir == V3D_VIEW_PANUP)	{ mval_f[1]= -25.0f; ED_view3d_win_to_delta(ar, mval_f, vec); }
-	else if(pandir == V3D_VIEW_PANDOWN)	{ mval_f[1]=  25.0f; ED_view3d_win_to_delta(ar, mval_f, vec); }
+	if      (pandir == V3D_VIEW_PANRIGHT)  { mval_f[0] = -32.0f; ED_view3d_win_to_delta(ar, mval_f, vec); }
+	else if (pandir == V3D_VIEW_PANLEFT)   { mval_f[0] =  32.0f; ED_view3d_win_to_delta(ar, mval_f, vec); }
+	else if (pandir == V3D_VIEW_PANUP)     { mval_f[1] = -25.0f; ED_view3d_win_to_delta(ar, mval_f, vec); }
+	else if (pandir == V3D_VIEW_PANDOWN)   { mval_f[1] =  25.0f; ED_view3d_win_to_delta(ar, mval_f, vec); }
 	add_v3_v3(rv3d->ofs, vec);
 
-	if(rv3d->viewlock & RV3D_BOXVIEW)
+	if (rv3d->viewlock & RV3D_BOXVIEW)
 		view3d_boxview_sync(CTX_wm_area(C), ar);
 
 	ED_region_tag_redraw(ar);
@@ -2948,16 +3002,16 @@ static int viewpan_exec(bContext *C, wmOperator *op)
 void VIEW3D_OT_view_pan(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View Pan";
+	ot->name = "View Pan";
 	ot->description = "Pan the view";
-	ot->idname= "VIEW3D_OT_view_pan";
+	ot->idname = "VIEW3D_OT_view_pan";
 
 	/* api callbacks */
-	ot->exec= viewpan_exec;
-	ot->poll= ED_operator_region_view3d_active;
+	ot->exec = viewpan_exec;
+	ot->poll = ED_operator_region_view3d_active;
 
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 	RNA_def_enum(ot->srna, "type", prop_view_pan_items, 0, "Pan", "Direction of View Pan");
 }
 
@@ -2971,10 +3025,10 @@ static int viewpersportho_exec(bContext *C, wmOperator *UNUSED(op))
 	ED_view3d_context_user_region(C, &v3d_dummy, &ar);
 	rv3d = ar->regiondata;
 
-	if(rv3d->viewlock==0) {
-		if(rv3d->persp!=RV3D_ORTHO)
-			rv3d->persp=RV3D_ORTHO;
-		else rv3d->persp=RV3D_PERSP;
+	if (rv3d->viewlock == 0) {
+		if (rv3d->persp != RV3D_ORTHO)
+			rv3d->persp = RV3D_ORTHO;
+		else rv3d->persp = RV3D_PERSP;
 		ED_region_tag_redraw(ar);
 	}
 
@@ -2985,16 +3039,16 @@ static int viewpersportho_exec(bContext *C, wmOperator *UNUSED(op))
 void VIEW3D_OT_view_persportho(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "View Persp/Ortho";
+	ot->name = "View Persp/Ortho";
 	ot->description = "Switch the current view from perspective/orthographic";
-	ot->idname= "VIEW3D_OT_view_persportho";
+	ot->idname = "VIEW3D_OT_view_persportho";
 
 	/* api callbacks */
-	ot->exec= viewpersportho_exec;
-	ot->poll= ED_operator_rv3d_user_region_poll;
+	ot->exec = viewpersportho_exec;
+	ot->poll = ED_operator_rv3d_user_region_poll;
 
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 }
 
 
@@ -3002,7 +3056,7 @@ void VIEW3D_OT_view_persportho(wmOperatorType *ot)
 
 static BGpic *background_image_add(bContext *C)
 {
-	View3D *v3d= CTX_wm_view3d(C);
+	View3D *v3d = CTX_wm_view3d(C);
 
 	return ED_view3D_background_image_new(v3d);
 }
@@ -3016,21 +3070,21 @@ static int background_image_add_exec(bContext *C, wmOperator *UNUSED(op))
 
 static int background_image_add_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	View3D *v3d= CTX_wm_view3d(C);
-	Image *ima= NULL;
+	View3D *v3d = CTX_wm_view3d(C);
+	Image *ima = NULL;
 	BGpic *bgpic;
-	char name[MAX_ID_NAME-2];
+	char name[MAX_ID_NAME - 2];
 	
 	/* check input variables */
-	if(RNA_struct_property_is_set(op->ptr, "filepath")) {
+	if (RNA_struct_property_is_set(op->ptr, "filepath")) {
 		char path[FILE_MAX];
 		
 		RNA_string_get(op->ptr, "filepath", path);
-		ima= BKE_add_image_file(path);
+		ima = BKE_add_image_file(path);
 	}
-	else if(RNA_struct_property_is_set(op->ptr, "name")) {
+	else if (RNA_struct_property_is_set(op->ptr, "name")) {
 		RNA_string_get(op->ptr, "name", name);
-		ima= (Image *)find_id("IM", name);
+		ima = (Image *)find_id("IM", name);
 	}
 	
 	bgpic = background_image_add(C);
@@ -3038,14 +3092,14 @@ static int background_image_add_invoke(bContext *C, wmOperator *op, wmEvent *UNU
 	if (ima) {
 		bgpic->ima = ima;
 		
-		if(ima->id.us==0) id_us_plus(&ima->id);
+		if (ima->id.us == 0) id_us_plus(&ima->id);
 		else id_lib_extern(&ima->id);
 		
 		if (!(v3d->flag & V3D_DISPBGPICS))
 			v3d->flag |= V3D_DISPBGPICS;
 	}
 	
-	WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d);
+	WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
 	
 	return OPERATOR_FINISHED;
 }
@@ -3054,7 +3108,7 @@ void VIEW3D_OT_background_image_add(wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name   = "Add Background Image";
-	ot->description= "Add a new background image";
+	ot->description = "Add a new background image";
 	ot->idname = "VIEW3D_OT_background_image_add";
 
 	/* api callbacks */
@@ -3066,7 +3120,7 @@ void VIEW3D_OT_background_image_add(wmOperatorType *ot)
 	ot->flag   = 0;
 	
 	/* properties */
-	RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME-2, "Name", "Image name to assign");
+	RNA_def_string(ot->srna, "name", "Image", MAX_ID_NAME - 2, "Name", "Image name to assign");
 	RNA_def_string(ot->srna, "filepath", "Path", FILE_MAX, "Filepath", "Path to image file");
 }
 
@@ -3076,11 +3130,11 @@ static int background_image_remove_exec(bContext *C, wmOperator *op)
 {
 	View3D *v3d = CTX_wm_view3d(C);
 	int index = RNA_int_get(op->ptr, "index");
-	BGpic *bgpic_rem= BLI_findlink(&v3d->bgpicbase, index);
+	BGpic *bgpic_rem = BLI_findlink(&v3d->bgpicbase, index);
 
-	if(bgpic_rem) {
+	if (bgpic_rem) {
 		ED_view3D_background_image_remove(v3d, bgpic_rem);
-		WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d);
+		WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
 		return OPERATOR_FINISHED;
 	}
 	else {
@@ -3093,7 +3147,7 @@ void VIEW3D_OT_background_image_remove(wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name   = "Remove Background Image";
-	ot->description= "Remove a background image from the 3D view";
+	ot->description = "Remove a background image from the 3D view";
 	ot->idname = "VIEW3D_OT_background_image_remove";
 
 	/* api callbacks */
@@ -3103,7 +3157,7 @@ void VIEW3D_OT_background_image_remove(wmOperatorType *ot)
 	/* flags */
 	ot->flag   = 0;
 
-	RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "Background image index to remove ", 0, INT_MAX);
+	RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "Background image index to remove", 0, INT_MAX);
 }
 
 /* ********************* set clipping operator ****************** */
@@ -3112,14 +3166,14 @@ static void calc_clipping_plane(float clip[6][4], BoundBox *clipbb)
 {
 	int val;
 
-	for(val=0; val<4; val++) {
+	for (val = 0; val < 4; val++) {
 
-		normal_tri_v3( clip[val],clipbb->vec[val], clipbb->vec[val==3?0:val+1], clipbb->vec[val+4]);
+		normal_tri_v3(clip[val], clipbb->vec[val], clipbb->vec[val == 3 ? 0 : val + 1], clipbb->vec[val + 4]);
 
-		clip[val][3]=
-			- clip[val][0]*clipbb->vec[val][0]
-			- clip[val][1]*clipbb->vec[val][1]
-			- clip[val][2]*clipbb->vec[val][2];
+		/* TODO - this is just '-dot_v3v3(clip[val], clipbb->vec[val])' isnt it? - sould replace */
+		clip[val][3] = -clip[val][0] * clipbb->vec[val][0] -
+		                clip[val][1] * clipbb->vec[val][1] -
+		                clip[val][2] * clipbb->vec[val][2];
 	}
 }
 
@@ -3131,33 +3185,33 @@ static void calc_local_clipping(float clip_local[][4], BoundBox *clipbb, float m
 
 	invert_m4_m4(imat, mat);
 
-	for(i=0; i<8; i++) {
+	for (i = 0; i < 8; i++) {
 		mul_v3_m4v3(clipbb_local.vec[i], imat, clipbb->vec[i]);
 	}
 
 	calc_clipping_plane(clip_local, &clipbb_local);
 }
 
-void ED_view3d_local_clipping(RegionView3D *rv3d, float mat[][4])
+void ED_view3d_clipping_local(RegionView3D *rv3d, float mat[][4])
 {
-	if(rv3d->rflag & RV3D_CLIPPING)
+	if (rv3d->rflag & RV3D_CLIPPING)
 		calc_local_clipping(rv3d->clip_local, rv3d->clipbb, mat);
 }
 
 static int view3d_clipping_exec(bContext *C, wmOperator *op)
 {
-	RegionView3D *rv3d= CTX_wm_region_view3d(C);
+	RegionView3D *rv3d = CTX_wm_region_view3d(C);
 	ViewContext vc;
 	bglMats mats;
 	rcti rect;
 
-	rect.xmin= RNA_int_get(op->ptr, "xmin");
-	rect.ymin= RNA_int_get(op->ptr, "ymin");
-	rect.xmax= RNA_int_get(op->ptr, "xmax");
-	rect.ymax= RNA_int_get(op->ptr, "ymax");
+	rect.xmin = RNA_int_get(op->ptr, "xmin");
+	rect.ymin = RNA_int_get(op->ptr, "ymin");
+	rect.xmax = RNA_int_get(op->ptr, "xmax");
+	rect.ymax = RNA_int_get(op->ptr, "ymax");
 
 	rv3d->rflag |= RV3D_CLIPPING;
-	rv3d->clipbb= MEM_callocN(sizeof(BoundBox), "clipbb");
+	rv3d->clipbb = MEM_callocN(sizeof(BoundBox), "clipbb");
 
 	/* note; otherwise opengl won't work */
 	view3d_operator_needs_opengl(C);
@@ -3171,14 +3225,14 @@ static int view3d_clipping_exec(bContext *C, wmOperator *op)
 
 static int view3d_clipping_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	RegionView3D *rv3d= CTX_wm_region_view3d(C);
-	ARegion *ar= CTX_wm_region(C);
+	RegionView3D *rv3d = CTX_wm_region_view3d(C);
+	ARegion *ar = CTX_wm_region(C);
 
-	if(rv3d->rflag & RV3D_CLIPPING) {
+	if (rv3d->rflag & RV3D_CLIPPING) {
 		rv3d->rflag &= ~RV3D_CLIPPING;
 		ED_region_tag_redraw(ar);
-		if(rv3d->clipbb) MEM_freeN(rv3d->clipbb);
-		rv3d->clipbb= NULL;
+		if (rv3d->clipbb) MEM_freeN(rv3d->clipbb);
+		rv3d->clipbb = NULL;
 		return OPERATOR_FINISHED;
 	}
 	else {
@@ -3191,20 +3245,20 @@ void VIEW3D_OT_clip_border(wmOperatorType *ot)
 {
 
 	/* identifiers */
-	ot->name= "Clipping Border";
+	ot->name = "Clipping Border";
 	ot->description = "Set the view clipping border";
-	ot->idname= "VIEW3D_OT_clip_border";
+	ot->idname = "VIEW3D_OT_clip_border";
 
 	/* api callbacks */
-	ot->invoke= view3d_clipping_invoke;
-	ot->exec= view3d_clipping_exec;
-	ot->modal= WM_border_select_modal;
-	ot->cancel= WM_border_select_cancel;
+	ot->invoke = view3d_clipping_invoke;
+	ot->exec = view3d_clipping_exec;
+	ot->modal = WM_border_select_modal;
+	ot->cancel = WM_border_select_cancel;
 
-	ot->poll= ED_operator_region_view3d_active;
+	ot->poll = ED_operator_region_view3d_active;
 
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 
 	/* rna */
 	RNA_def_int(ot->srna, "xmin", 0, INT_MIN, INT_MAX, "X Min", "", INT_MIN, INT_MAX);
@@ -3218,42 +3272,42 @@ void VIEW3D_OT_clip_border(wmOperatorType *ot)
 /* mx my in region coords */
 static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
 {
-	Scene *scene= CTX_data_scene(C);
-	ARegion *ar= CTX_wm_region(C);
+	Scene *scene = CTX_data_scene(C);
+	ARegion *ar = CTX_wm_region(C);
 	View3D *v3d = CTX_wm_view3d(C);
-	RegionView3D *rv3d= CTX_wm_region_view3d(C);
+	RegionView3D *rv3d = CTX_wm_region_view3d(C);
 	float dx, dy, fz, *fp = NULL, dvec[3], oldcurs[3];
 	int mval[2];
 //	short ctrl= 0; // XXX
 	int flip;
-	fp= give_cursor(scene, v3d);
+	fp = give_cursor(scene, v3d);
 
-//	if(obedit && ctrl) lr_click= 1;
+//	if (obedit && ctrl) lr_click= 1;
 	copy_v3_v3(oldcurs, fp);
 
 	project_int_noclip(ar, fp, mval);
-	flip= initgrabz(rv3d, fp[0], fp[1], fp[2]);
+	flip = initgrabz(rv3d, fp[0], fp[1], fp[2]);
 	
 	/* reset the depth based on the view offset */
-	if(flip) {
+	if (flip) {
 		negate_v3_v3(fp, rv3d->ofs);
 
 		/* re initialize */
 		project_int_noclip(ar, fp, mval);
-		flip= initgrabz(rv3d, fp[0], fp[1], fp[2]);
+		flip = initgrabz(rv3d, fp[0], fp[1], fp[2]);
 		(void)flip;
 	}
 
-	if(mval[0]!=IS_CLIPPED) {
+	if (mval[0] != IS_CLIPPED) {
 		short depth_used = 0;
 
 		if (U.uiflag & USER_ORBIT_ZBUF) { /* maybe this should be accessed some other way */
 			view3d_operator_needs_opengl(C);
 			if (ED_view3d_autodist(scene, ar, v3d, event->mval, fp))
-				depth_used= 1;
+				depth_used = 1;
 		}
 
-		if(depth_used==0) {
+		if (depth_used == 0) {
 			float mval_f[2];
 			VECSUB2D(mval_f, mval, event->mval);
 			ED_view3d_win_to_delta(ar, mval_f, dvec);
@@ -3262,21 +3316,21 @@ static int set_3dcursor_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *eve
 	}
 	else {
 
-		dx= ((float)(event->mval[0]-(ar->winx/2)))*rv3d->zfac/(ar->winx/2);
-		dy= ((float)(event->mval[1]-(ar->winy/2)))*rv3d->zfac/(ar->winy/2);
+		dx = ((float)(event->mval[0] - (ar->winx / 2))) * rv3d->zfac / (ar->winx / 2);
+		dy = ((float)(event->mval[1] - (ar->winy / 2))) * rv3d->zfac / (ar->winy / 2);
 
-		fz= rv3d->persmat[0][3]*fp[0]+ rv3d->persmat[1][3]*fp[1]+ rv3d->persmat[2][3]*fp[2]+ rv3d->persmat[3][3];
-		fz= fz/rv3d->zfac;
+		fz = rv3d->persmat[0][3] * fp[0] + rv3d->persmat[1][3] * fp[1] + rv3d->persmat[2][3] * fp[2] + rv3d->persmat[3][3];
+		fz = fz / rv3d->zfac;
 
-		fp[0]= (rv3d->persinv[0][0]*dx + rv3d->persinv[1][0]*dy+ rv3d->persinv[2][0]*fz)-rv3d->ofs[0];
-		fp[1]= (rv3d->persinv[0][1]*dx + rv3d->persinv[1][1]*dy+ rv3d->persinv[2][1]*fz)-rv3d->ofs[1];
-		fp[2]= (rv3d->persinv[0][2]*dx + rv3d->persinv[1][2]*dy+ rv3d->persinv[2][2]*fz)-rv3d->ofs[2];
+		fp[0] = (rv3d->persinv[0][0] * dx + rv3d->persinv[1][0] * dy + rv3d->persinv[2][0] * fz) - rv3d->ofs[0];
+		fp[1] = (rv3d->persinv[0][1] * dx + rv3d->persinv[1][1] * dy + rv3d->persinv[2][1] * fz) - rv3d->ofs[1];
+		fp[2] = (rv3d->persinv[0][2] * dx + rv3d->persinv[1][2] * dy + rv3d->persinv[2][2] * fz) - rv3d->ofs[2];
 	}
 
-	if(v3d && v3d->localvd)
-		WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d);
+	if (v3d && v3d->localvd)
+		WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
 	else
-		WM_event_add_notifier(C, NC_SCENE|NA_EDITED, scene);
+		WM_event_add_notifier(C, NC_SCENE | NA_EDITED, scene);
 
 	return OPERATOR_FINISHED;
 }
@@ -3285,17 +3339,17 @@ void VIEW3D_OT_cursor3d(wmOperatorType *ot)
 {
 
 	/* identifiers */
-	ot->name= "Set 3D Cursor";
+	ot->name = "Set 3D Cursor";
 	ot->description = "Set the location of the 3D cursor";
-	ot->idname= "VIEW3D_OT_cursor3d";
+	ot->idname = "VIEW3D_OT_cursor3d";
 
 	/* api callbacks */
-	ot->invoke= set_3dcursor_invoke;
+	ot->invoke = set_3dcursor_invoke;
 
-	ot->poll= ED_operator_view3d_active;
+	ot->poll = ED_operator_view3d_active;
 
 	/* flags */
-//	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+//	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
 	/* rna later */
 
@@ -3308,16 +3362,16 @@ static int manipulator_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
 	View3D *v3d = CTX_wm_view3d(C);
 
-	if(!(v3d->twflag & V3D_USE_MANIPULATOR)) return OPERATOR_PASS_THROUGH;
-	if(!(v3d->twflag & V3D_DRAW_MANIPULATOR)) return OPERATOR_PASS_THROUGH;
+	if (!(v3d->twflag & V3D_USE_MANIPULATOR)) return OPERATOR_PASS_THROUGH;
+	if (!(v3d->twflag & V3D_DRAW_MANIPULATOR)) return OPERATOR_PASS_THROUGH;
 
 	/* only no modifier or shift */
-	if(event->keymodifier != 0 && event->keymodifier != KM_SHIFT) return OPERATOR_PASS_THROUGH;
+	if (event->keymodifier != 0 && event->keymodifier != KM_SHIFT) return OPERATOR_PASS_THROUGH;
 
 	/* note; otherwise opengl won't work */
 	view3d_operator_needs_opengl(C);
 
-	if(0==BIF_do_manipulator(C, event, op))
+	if (0 == BIF_do_manipulator(C, event, op))
 		return OPERATOR_PASS_THROUGH;
 
 	return OPERATOR_FINISHED;
@@ -3327,14 +3381,14 @@ void VIEW3D_OT_manipulator(wmOperatorType *ot)
 {
 
 	/* identifiers */
-	ot->name= "3D Manipulator";
+	ot->name = "3D Manipulator";
 	ot->description = "Manipulate selected item by axis";
-	ot->idname= "VIEW3D_OT_manipulator";
+	ot->idname = "VIEW3D_OT_manipulator";
 
 	/* api callbacks */
-	ot->invoke= manipulator_invoke;
+	ot->invoke = manipulator_invoke;
 
-	ot->poll= ED_operator_view3d_active;
+	ot->poll = ED_operator_view3d_active;
 
 	/* properties to pass to transform */
 	Transform_Properties(ot, P_CONSTRAINT);
@@ -3344,7 +3398,7 @@ static int enable_manipulator_invoke(bContext *C, wmOperator *op, wmEvent *UNUSE
 {
 	View3D *v3d = CTX_wm_view3d(C);
 
-	v3d->twtype=0;
+	v3d->twtype = 0;
 	
 	if (RNA_boolean_get(op->ptr, "translate"))
 		v3d->twtype |= V3D_MANIP_TRANSLATE;
@@ -3353,26 +3407,31 @@ static int enable_manipulator_invoke(bContext *C, wmOperator *op, wmEvent *UNUSE
 	if (RNA_boolean_get(op->ptr, "scale"))
 		v3d->twtype |= V3D_MANIP_SCALE;
 		
-	WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d);
+	WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
 
 	return OPERATOR_FINISHED;
 }
 
 void VIEW3D_OT_enable_manipulator(wmOperatorType *ot)
 {
+	PropertyRNA *prop;
+
 	/* identifiers */
-	ot->name= "Enable 3D Manipulator";
+	ot->name = "Enable 3D Manipulator";
 	ot->description = "Enable the transform manipulator for use";
-	ot->idname= "VIEW3D_OT_enable_manipulator";
+	ot->idname = "VIEW3D_OT_enable_manipulator";
 	
 	/* api callbacks */
-	ot->invoke= enable_manipulator_invoke;
-	ot->poll= ED_operator_view3d_active;
+	ot->invoke = enable_manipulator_invoke;
+	ot->poll = ED_operator_view3d_active;
 	
 	/* rna later */
-	RNA_def_boolean(ot->srna, "translate", 0, "Translate", "Enable the translate manipulator");
-	RNA_def_boolean(ot->srna, "rotate", 0, "Rotate", "Enable the rotate manipulator");
-	RNA_def_boolean(ot->srna, "scale", 0, "Scale", "Enable the scale manipulator");
+	prop = RNA_def_boolean(ot->srna, "translate", 0, "Translate", "Enable the translate manipulator");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+	prop = RNA_def_boolean(ot->srna, "rotate", 0, "Rotate", "Enable the rotate manipulator");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+	prop = RNA_def_boolean(ot->srna, "scale", 0, "Scale", "Enable the scale manipulator");
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 }
 
 /* ************************* below the line! *********************** */
@@ -3380,16 +3439,16 @@ void VIEW3D_OT_enable_manipulator(wmOperatorType *ot)
 
 static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int margin)
 {
-	ViewDepths depth_temp= {0};
+	ViewDepths depth_temp = {0};
 	rcti rect;
 	float depth_close;
 
-	if(margin==0) {
+	if (margin == 0) {
 		/* Get Z Depths, needed for perspective, nice for ortho */
-		rect.xmin= mval[0];
-		rect.ymin= mval[1];
-		rect.xmax= mval[0] + 1;
-		rect.ymax= mval[1] + 1;
+		rect.xmin = mval[0];
+		rect.ymin = mval[1];
+		rect.xmax = mval[0] + 1;
+		rect.ymax = mval[1] + 1;
 	}
 	else {
 		rect.xmax = mval[0] + margin;
@@ -3400,8 +3459,8 @@ static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int marg
 	}
 
 	view3d_update_depths_rect(ar, &depth_temp, &rect);
-	depth_close= view3d_depth_near(&depth_temp);
-	if(depth_temp.depths) MEM_freeN(depth_temp.depths);
+	depth_close = view3d_depth_near(&depth_temp);
+	if (depth_temp.depths) MEM_freeN(depth_temp.depths);
 	return depth_close;
 }
 
@@ -3409,16 +3468,16 @@ static float view_autodist_depth_margin(ARegion *ar, const int mval[2], int marg
 int ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2], float mouse_worldloc[3])
 {
 	bglMats mats; /* ZBuffer depth vars */
-	float depth_close= FLT_MAX;
+	float depth_close = FLT_MAX;
 	double cent[2],  p[3];
 
 	/* Get Z Depths, needed for perspective, nice for ortho */
 	bgl_get_mats(&mats);
 	draw_depth(scene, ar, v3d, NULL);
 
-	depth_close= view_autodist_depth_margin(ar, mval, 4);
+	depth_close = view_autodist_depth_margin(ar, mval, 4);
 
-	if (depth_close==FLT_MAX)
+	if (depth_close == FLT_MAX)
 		return 0;
 
 	cent[0] = (double)mval[0];
@@ -3439,13 +3498,13 @@ int ED_view3d_autodist(Scene *scene, ARegion *ar, View3D *v3d, const int mval[2]
 int ED_view3d_autodist_init(Scene *scene, ARegion *ar, View3D *v3d, int mode) //, float *autodist )
 {
 	/* Get Z Depths, needed for perspective, nice for ortho */
-	switch(mode) {
-	case 0:
-		draw_depth(scene, ar, v3d, NULL);
-		break;
-	case 1:
-		draw_depth_gpencil(scene, ar, v3d);
-		break;
+	switch (mode) {
+		case 0:
+			draw_depth(scene, ar, v3d, NULL);
+			break;
+		case 1:
+			draw_depth_gpencil(scene, ar, v3d);
+			break;
 	}
 
 	return 1;
@@ -3460,12 +3519,12 @@ int ED_view3d_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldl
 	double cent[2],  p[3];
 
 	/* Get Z Depths, needed for perspective, nice for ortho */
-	if(force_depth)
-		depth= *force_depth;
+	if (force_depth)
+		depth = *force_depth;
 	else
-		depth= view_autodist_depth_margin(ar, mval, margin);
+		depth = view_autodist_depth_margin(ar, mval, margin);
 
-	if (depth==FLT_MAX)
+	if (depth == FLT_MAX)
 		return 0;
 
 	cent[0] = (double)mval[0];
@@ -3474,7 +3533,7 @@ int ED_view3d_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldl
 	bgl_get_mats(&mats);
 
 	if (!gluUnProject(cent[0], cent[1], depth,
-	    mats.modelview, mats.projection, (GLint *)mats.viewport, &p[0], &p[1], &p[2]))
+	                  mats.modelview, mats.projection, (GLint *)mats.viewport, &p[0], &p[1], &p[2]))
 	{
 		return 0;
 	}
@@ -3487,9 +3546,9 @@ int ED_view3d_autodist_simple(ARegion *ar, const int mval[2], float mouse_worldl
 
 int ED_view3d_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth)
 {
-	*depth= view_autodist_depth_margin(ar, mval, margin);
+	*depth = view_autodist_depth_margin(ar, mval, margin);
 
-	return (*depth==FLT_MAX) ? 0:1;
+	return (*depth == FLT_MAX) ? 0 : 1;
 }
 
 static int depth_segment_cb(int x, int y, void *userData)
@@ -3498,13 +3557,13 @@ static int depth_segment_cb(int x, int y, void *userData)
 	int mval[2];
 	float depth;
 
-	mval[0]= x;
-	mval[1]= y;
+	mval[0] = x;
+	mval[1] = y;
 
-	depth= view_autodist_depth_margin(data->ar, mval, data->margin);
+	depth = view_autodist_depth_margin(data->ar, mval, data->margin);
 
-	if(depth != FLT_MAX) {
-		data->depth= depth;
+	if (depth != FLT_MAX) {
+		data->depth = depth;
 		return 0;
 	}
 	else {
@@ -3519,25 +3578,26 @@ int ED_view3d_autodist_depth_seg(struct ARegion *ar, const int mval_sta[2], cons
 	int p1[2];
 	int p2[2];
 
-	data.ar= ar;
-	data.margin= margin;
-	data.depth= FLT_MAX;
+	data.ar = ar;
+	data.margin = margin;
+	data.depth = FLT_MAX;
 
 	copy_v2_v2_int(p1, mval_sta);
 	copy_v2_v2_int(p2, mval_end);
 
 	plot_line_v2v2i(p1, p2, depth_segment_cb, &data);
 
-	*depth= data.depth;
+	*depth = data.depth;
 
-	return (*depth==FLT_MAX) ? 0:1;
+	return (*depth == FLT_MAX) ? 0 : 1;
 }
 
-/* Gets the view trasnformation from a camera
-* currently dosnt take camzoom into account
-*
-* The dist is not modified for this function, if NULL its assimed zero
-* */
+/**
+ * Gets the view transformation from a camera
+ * currently dosnt take camzoom into account
+ *
+ * The dist is not modified for this function, if NULL its assumed zero
+ */
 void ED_view3d_from_m4(float mat[][4], float ofs[3], float quat[4], float *dist)
 {
 	/* Offset */
@@ -3555,9 +3615,9 @@ void ED_view3d_from_m4(float mat[][4], float ofs[3], float quat[4], float *dist)
 		float nmat[3][3];
 		float vec[3];
 
-		vec[0]= 0.0f;
-		vec[1]= 0.0f;
-		vec[2]= -(*dist);
+		vec[0] = 0.0f;
+		vec[1] = 0.0f;
+		vec[2] = -(*dist);
 
 		copy_m3_m4(nmat, mat);
 		normalize_m3(nmat);
@@ -3569,8 +3629,8 @@ void ED_view3d_from_m4(float mat[][4], float ofs[3], float quat[4], float *dist)
 
 void ED_view3d_to_m4(float mat[][4], const float ofs[3], const float quat[4], const float dist)
 {
-	float iviewquat[4]= {-quat[0], quat[1], quat[2], quat[3]};
-	float dvec[3]= {0.0f, 0.0f, dist};
+	float iviewquat[4] = {-quat[0], quat[1], quat[2], quat[3]};
+	float dvec[3] = {0.0f, 0.0f, dist};
 
 	quat_to_mat4(mat, iviewquat);
 	mul_mat3_m4_v3(mat, dvec);
@@ -3583,12 +3643,12 @@ void ED_view3d_from_object(Object *ob, float ofs[3], float quat[4], float *dist,
 {
 	ED_view3d_from_m4(ob->obmat, ofs, quat, dist);
 
-	if(lens) {
+	if (lens) {
 		CameraParams params;
 
 		camera_params_init(&params);
 		camera_params_from_object(&params, ob);
-		*lens= params.lens;
+		*lens = params.lens;
 	}
 }
 
@@ -3602,13 +3662,13 @@ void ED_view3d_to_object(Object *ob, const float ofs[3], const float quat[4], co
 
 BGpic *ED_view3D_background_image_new(View3D *v3d)
 {
-	BGpic *bgpic= MEM_callocN(sizeof(BGpic), "Background Image");
+	BGpic *bgpic = MEM_callocN(sizeof(BGpic), "Background Image");
 
-	bgpic->size= 5.0;
-	bgpic->blend= 0.5;
-	bgpic->iuser.fie_ima= 2;
-	bgpic->iuser.ok= 1;
-	bgpic->view= 0; /* 0 for all */
+	bgpic->size = 5.0;
+	bgpic->blend = 0.5;
+	bgpic->iuser.fie_ima = 2;
+	bgpic->iuser.ok = 1;
+	bgpic->view = 0; /* 0 for all */
 	bgpic->flag |= V3D_BGPIC_EXPANDED;
 
 	BLI_addtail(&v3d->bgpicbase, bgpic);
@@ -3620,24 +3680,18 @@ void ED_view3D_background_image_remove(View3D *v3d, BGpic *bgpic)
 {
 	BLI_remlink(&v3d->bgpicbase, bgpic);
 
-	if(bgpic->ima)
-		id_us_min(&bgpic->ima->id);
-
-	if(bgpic->clip)
-		id_us_min(&bgpic->clip->id);
-
 	MEM_freeN(bgpic);
 }
 
 void ED_view3D_background_image_clear(View3D *v3d)
 {
-	BGpic *bgpic= v3d->bgpicbase.first;
+	BGpic *bgpic = v3d->bgpicbase.first;
 
-	while(bgpic) {
-		BGpic *next_bgpic= bgpic->next;
+	while (bgpic) {
+		BGpic *next_bgpic = bgpic->next;
 
 		ED_view3D_background_image_remove(v3d, bgpic);
 
-		bgpic= next_bgpic;
+		bgpic = next_bgpic;
 	}
 }
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index 801f2d5..5b66248 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -24,12 +24,10 @@
  *  \ingroup spview3d
  */
 
-
 /* 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
-
 #include "DNA_anim_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_object_types.h"
@@ -58,11 +56,10 @@
 
 #include "PIL_time.h" /* smoothview */
 
-#include "view3d_intern.h"	// own include
-
+#include "view3d_intern.h"  /* own include */
 /* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
 enum {
-	FLY_MODAL_CANCEL= 1,
+	FLY_MODAL_CANCEL = 1,
 	FLY_MODAL_CONFIRM,
 	FLY_MODAL_ACCELERATE,
 	FLY_MODAL_DECELERATE,
@@ -87,41 +84,42 @@ enum {
 void fly_modal_keymap(wmKeyConfig *keyconf)
 {
 	static EnumPropertyItem modal_items[] = {
-	    {FLY_MODAL_CANCEL,	"CANCEL", 0, "Cancel", ""},
-	    {FLY_MODAL_CONFIRM,	"CONFIRM", 0, "Confirm", ""},
-	    {FLY_MODAL_ACCELERATE, "ACCELERATE", 0, "Accelerate", ""},
-	    {FLY_MODAL_DECELERATE, "DECELERATE", 0, "Decelerate", ""},
+		{FLY_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
+		{FLY_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""},
+		{FLY_MODAL_ACCELERATE, "ACCELERATE", 0, "Accelerate", ""},
+		{FLY_MODAL_DECELERATE, "DECELERATE", 0, "Decelerate", ""},
 
-	    {FLY_MODAL_PAN_ENABLE,	"PAN_ENABLE", 0, "Pan Enable", ""},
-	    {FLY_MODAL_PAN_DISABLE,	"PAN_DISABLE", 0, "Pan Disable", ""},
+		{FLY_MODAL_PAN_ENABLE, "PAN_ENABLE", 0, "Pan Enable", ""},
+		{FLY_MODAL_PAN_DISABLE, "PAN_DISABLE", 0, "Pan Disable", ""},
 
-	    {FLY_MODAL_DIR_FORWARD,	"FORWARD", 0, "Fly Forward", ""},
-	    {FLY_MODAL_DIR_BACKWARD,"BACKWARD", 0, "Fly Backward", ""},
-	    {FLY_MODAL_DIR_LEFT,	"LEFT", 0, "Fly Left", ""},
-	    {FLY_MODAL_DIR_RIGHT,	"RIGHT", 0, "Fly Right", ""},
-	    {FLY_MODAL_DIR_UP,		"UP", 0, "Fly Up", ""},
-	    {FLY_MODAL_DIR_DOWN,	"DOWN", 0, "Fly Down", ""},
+		{FLY_MODAL_DIR_FORWARD, "FORWARD", 0, "Fly Forward", ""},
+		{FLY_MODAL_DIR_BACKWARD, "BACKWARD", 0, "Fly Backward", ""},
+		{FLY_MODAL_DIR_LEFT, "LEFT", 0, "Fly Left", ""},
+		{FLY_MODAL_DIR_RIGHT, "RIGHT", 0, "Fly Right", ""},
+		{FLY_MODAL_DIR_UP, "UP", 0, "Fly Up", ""},
+		{FLY_MODAL_DIR_DOWN, "DOWN", 0, "Fly Down", ""},
 
-	    {FLY_MODAL_AXIS_LOCK_X,	"AXIS_LOCK_X", 0, "X Axis Correction", "X axis correction (toggle)"},
-	    {FLY_MODAL_AXIS_LOCK_Z,	"AXIS_LOCK_Z", 0, "X Axis Correction", "Z axis correction (toggle)"},
+		{FLY_MODAL_AXIS_LOCK_X, "AXIS_LOCK_X", 0, "X Axis Correction", "X axis correction (toggle)"},
+		{FLY_MODAL_AXIS_LOCK_Z, "AXIS_LOCK_Z", 0, "X Axis Correction", "Z axis correction (toggle)"},
 
-	    {FLY_MODAL_PRECISION_ENABLE,	"PRECISION_ENABLE", 0, "Precision Enable", ""},
-	    {FLY_MODAL_PRECISION_DISABLE,	"PRECISION_DISABLE", 0, "Precision Disable", ""},
+		{FLY_MODAL_PRECISION_ENABLE, "PRECISION_ENABLE", 0, "Precision Enable", ""},
+		{FLY_MODAL_PRECISION_DISABLE, "PRECISION_DISABLE", 0, "Precision Disable", ""},
 
-	    {FLY_MODAL_FREELOOK_ENABLE, 	"FREELOOK_ENABLE", 0, "Rotation Enable", ""},
-	    {FLY_MODAL_FREELOOK_DISABLE,	"FREELOOK_DISABLE", 0, "Rotation Disable", ""},
+		{FLY_MODAL_FREELOOK_ENABLE, "FREELOOK_ENABLE", 0, "Rotation Enable", ""},
+		{FLY_MODAL_FREELOOK_DISABLE, "FREELOOK_DISABLE", 0, "Rotation Disable", ""},
 
-	    {0, NULL, 0, NULL, NULL}};
+		{0, NULL, 0, NULL, NULL}};
 
-	wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Fly Modal");
+	wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Fly Modal");
 
 	/* this function is called for each spacetype, only needs to add map once */
-	if (keymap) return;
+	if (keymap && keymap->modal_items)
+		return;
 
-	keymap= WM_modalkeymap_add(keyconf, "View3D Fly Modal", modal_items);
+	keymap = WM_modalkeymap_add(keyconf, "View3D Fly Modal", modal_items);
 
 	/* items for modal map */
-	WM_modalkeymap_add_item(keymap, ESCKEY,    KM_PRESS, KM_ANY, 0, FLY_MODAL_CANCEL);
+	WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, FLY_MODAL_CANCEL);
 	WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_ANY, KM_ANY, 0, FLY_MODAL_CANCEL);
 
 	WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_ANY, KM_ANY, 0, FLY_MODAL_CONFIRM);
@@ -171,11 +169,12 @@ typedef struct FlyInfo {
 	short state;
 	short redraw;
 	unsigned char use_precision;
-	unsigned char use_freelook; /* if the user presses shift they can look about
-	                             * without moving the direction there looking */
+	/* if the user presses shift they can look about
+	 * without moving the direction there looking */
+	unsigned char use_freelook;
 
 	int mval[2]; /* latest 2D mouse values */
-	wmNDOFMotionData* ndof; /* latest 3D mouse values */
+	wmNDOFMotionData*ndof;  /* latest 3D mouse values */
 
 	/* fly state state */
 	float speed; /* the speed the view is moving per redraw */
@@ -183,10 +182,10 @@ typedef struct FlyInfo {
 	short pan_view; /* when true, pan the view instead of rotating */
 
 	/* relative view axis locking - xlock, zlock
-	0; disabled
-	1; enabled but not checking because mouse hasnt moved outside the margin since locking was checked an not needed
-	   when the mouse moves, locking is set to 2 so checks are done.
-	2; mouse moved and checking needed, if no view altering is donem its changed back to 1 */
+	 * 0) disabled
+	 * 1) enabled but not checking because mouse hasn't moved outside the margin since locking was checked an not needed
+	 *    when the mouse moves, locking is set to 2 so checks are done.
+	 * 2) mouse moved and checking needed, if no view altering is done its changed back to 1 */
 	short xlock, zlock;
 	float xlock_momentum, zlock_momentum; /* nicer dynamics */
 	float grid; /* world scale 1.0 default */
@@ -196,15 +195,17 @@ typedef struct FlyInfo {
 
 	/* backup values */
 	float dist_backup; /* backup the views distance since we use a zero dist for fly mode */
-	float ofs_backup[3]; /* backup the views offset incase the user cancels flying in non camera mode */
-	float rot_backup[4]; /* backup the views quat incase the user cancels flying in non camera mode.
-	                      * (quat for view, eul for camera) */
-	short persp_backup; /* remember if were ortho or not, only used for restoring the view if it was a ortho view */
+	float ofs_backup[3]; /* backup the views offset in case the user cancels flying in non camera mode */
 
-	short is_ortho_cam; /* are we flying an ortho camera in perspective view,
-						 * which was originall in ortho view?
-						 * could probably figure it out but better be explicit */
+	/* backup the views quat in case the user cancels flying in non camera mode.
+	 * (quat for view, eul for camera) */
+	float rot_backup[4];
+	short persp_backup; /* remember if were ortho or not, only used for restoring the view if it was a ortho view */
 
+	/* are we flying an ortho camera in perspective view,
+	 * which was originall in ortho view?
+	 * could probably figure it out but better be explicit */
+	short is_ortho_cam;
 	void *obtfm; /* backup the objects transform */
 
 	/* compare between last state */
@@ -223,67 +224,67 @@ static void drawFlyPixel(const struct bContext *UNUSED(C), struct ARegion *UNUSE
 	FlyInfo *fly = arg;
 
 	/* draws 4 edge brackets that frame the safe area where the
-	mouse can move during fly mode without spinning the view */
+	 * mouse can move during fly mode without spinning the view */
 	float x1, x2, y1, y2;
-	
-	x1= 0.45f * (float)fly->ar->winx;
-	y1= 0.45f * (float)fly->ar->winy;
-	x2= 0.55f * (float)fly->ar->winx;
-	y2= 0.55f * (float)fly->ar->winy;
+
+	x1 = 0.45f * (float)fly->ar->winx;
+	y1 = 0.45f * (float)fly->ar->winy;
+	x2 = 0.55f * (float)fly->ar->winx;
+	y2 = 0.55f * (float)fly->ar->winy;
 	cpack(0);
-	
-	
+
 	glBegin(GL_LINES);
 	/* bottom left */
-	glVertex2f(x1,y1); 
-	glVertex2f(x1,y1+5);
-	
-	glVertex2f(x1,y1); 
-	glVertex2f(x1+5,y1);
-	
+	glVertex2f(x1, y1);
+	glVertex2f(x1, y1 + 5);
+
+	glVertex2f(x1, y1);
+	glVertex2f(x1 + 5, y1);
+
 	/* top right */
-	glVertex2f(x2,y2); 
-	glVertex2f(x2,y2-5);
-	
-	glVertex2f(x2,y2); 
-	glVertex2f(x2-5,y2);
-	
+	glVertex2f(x2, y2);
+	glVertex2f(x2, y2 - 5);
+
+	glVertex2f(x2, y2);
+	glVertex2f(x2 - 5, y2);
+
 	/* top left */
-	glVertex2f(x1,y2); 
-	glVertex2f(x1,y2-5);
-	
-	glVertex2f(x1,y2); 
-	glVertex2f(x1+5,y2);
-	
+	glVertex2f(x1, y2);
+	glVertex2f(x1, y2 - 5);
+
+	glVertex2f(x1, y2);
+	glVertex2f(x1 + 5, y2);
+
 	/* bottom right */
-	glVertex2f(x2,y1); 
-	glVertex2f(x2,y1+5);
-	
-	glVertex2f(x2,y1); 
-	glVertex2f(x2-5,y1);
+	glVertex2f(x2, y1);
+	glVertex2f(x2, y1 + 5);
+
+	glVertex2f(x2, y1);
+	glVertex2f(x2 - 5, y1);
 	glEnd();
 }
 
 /* FlyInfo->state */
-#define FLY_RUNNING		0
-#define FLY_CANCEL		1
-#define FLY_CONFIRM		2
+#define FLY_RUNNING     0
+#define FLY_CANCEL      1
+#define FLY_CONFIRM     2
 
-static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *event)
+static int initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *event)
 {
-	float upvec[3]; // tmp
+	wmWindow *win = CTX_wm_window(C);
+	float upvec[3]; /* tmp */
 	float mat[3][3];
 
-	fly->rv3d= CTX_wm_region_view3d(C);
+	fly->rv3d = CTX_wm_region_view3d(C);
 	fly->v3d = CTX_wm_view3d(C);
 	fly->ar = CTX_wm_region(C);
-	fly->scene= CTX_data_scene(C);
+	fly->scene = CTX_data_scene(C);
 
 #ifdef NDOF_FLY_DEBUG
 	puts("\n-- fly begin --");
 #endif
 
-	if (fly->rv3d->persp==RV3D_CAMOB && fly->v3d->camera->id.lib) {
+	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;
 	}
@@ -293,113 +294,117 @@ static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *even
 		return FALSE;
 	}
 
-	if (fly->rv3d->persp==RV3D_CAMOB && fly->v3d->camera->constraints.first) {
+	if (fly->rv3d->persp == RV3D_CAMOB && fly->v3d->camera->constraints.first) {
 		BKE_report(op->reports, RPT_ERROR, "Cannot fly an object with constraints");
 		return FALSE;
 	}
 
-	fly->state= FLY_RUNNING;
-	fly->speed= 0.0f;
-	fly->axis= 2;
-	fly->pan_view= FALSE;
-	fly->xlock= FALSE;
-	fly->zlock= FALSE;
-	fly->xlock_momentum=0.0f;
-	fly->zlock_momentum=0.0f;
-	fly->grid= 1.0f;
-	fly->use_precision= FALSE;
-	fly->use_freelook= FALSE;
+	fly->state = FLY_RUNNING;
+	fly->speed = 0.0f;
+	fly->axis = 2;
+	fly->pan_view = FALSE;
+	fly->xlock = FALSE;
+	fly->zlock = FALSE;
+	fly->xlock_momentum = 0.0f;
+	fly->zlock_momentum = 0.0f;
+	fly->grid = 1.0f;
+	fly->use_precision = FALSE;
+	fly->use_freelook = FALSE;
 
 #ifdef NDOF_FLY_DRAW_TOOMUCH
-	fly->redraw= 1;
+	fly->redraw = 1;
 #endif
-	fly->dvec_prev[0]= fly->dvec_prev[1]= fly->dvec_prev[2]= 0.0f;
+	zero_v3(fly->dvec_prev);
 
-	fly->timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
+	fly->timer = WM_event_add_timer(CTX_wm_manager(C), win, TIMER, 0.01f);
 
 	copy_v2_v2_int(fly->mval, event->mval);
 	fly->ndof = NULL;
 
-	fly->time_lastdraw= fly->time_lastwheel= PIL_check_seconds_timer();
+	fly->time_lastdraw = fly->time_lastwheel = PIL_check_seconds_timer();
 
 	fly->draw_handle_pixel = ED_region_draw_cb_activate(fly->ar->type, drawFlyPixel, fly, REGION_DRAW_POST_PIXEL);
 
 	fly->rv3d->rflag |= RV3D_NAVIGATING; /* so we draw the corner margins */
 
 	/* detect weather to start with Z locking */
-	upvec[0]=1.0f; upvec[1]=0.0f; upvec[2]=0.0f;
+	upvec[0] = 1.0f;
+	upvec[1] = 0.0f;
+	upvec[2] = 0.0f;
 	copy_m3_m4(mat, fly->rv3d->viewinv);
 	mul_m3_v3(mat, upvec);
 	if (fabs(upvec[2]) < 0.1)
 		fly->zlock = 1;
-	upvec[0]=0; upvec[1]=0; upvec[2]=0;
+	upvec[0] = 0;
+	upvec[1] = 0;
+	upvec[2] = 0;
 
-	fly->persp_backup= fly->rv3d->persp;
-	fly->dist_backup= fly->rv3d->dist;
+	fly->persp_backup = fly->rv3d->persp;
+	fly->dist_backup = fly->rv3d->dist;
 
 	/* check for flying ortho camera - which we cant support well
 	 * we _could_ also check for an ortho camera but this is easier */
-	if(     (fly->rv3d->persp == RV3D_CAMOB) &&
-	        (fly->v3d->camera != NULL) &&
-	        (fly->rv3d->is_persp == FALSE))
+	if ((fly->rv3d->persp == RV3D_CAMOB) &&
+	    (fly->v3d->camera != NULL) &&
+	    (fly->rv3d->is_persp == FALSE))
 	{
-		((Camera *)fly->v3d->camera->data)->type= CAM_PERSP;
-		fly->is_ortho_cam= TRUE;
+		((Camera *)fly->v3d->camera->data)->type = CAM_PERSP;
+		fly->is_ortho_cam = TRUE;
 	}
 
-	if (fly->rv3d->persp==RV3D_CAMOB) {
+	if (fly->rv3d->persp == RV3D_CAMOB) {
 		Object *ob_back;
-		if ((U.uiflag & USER_CAM_LOCK_NO_PARENT)==0 && (fly->root_parent=fly->v3d->camera->parent)) {
-			while(fly->root_parent->parent)
-				fly->root_parent= fly->root_parent->parent;
-			ob_back= fly->root_parent;
+		if ((U.uiflag & USER_CAM_LOCK_NO_PARENT) == 0 && (fly->root_parent = fly->v3d->camera->parent)) {
+			while (fly->root_parent->parent)
+				fly->root_parent = fly->root_parent->parent;
+			ob_back = fly->root_parent;
 		}
 		else {
-			ob_back= fly->v3d->camera;
+			ob_back = fly->v3d->camera;
 		}
 
 		/* store the original camera loc and rot */
 		/* TODO. axis angle etc */
 
-		fly->obtfm= object_tfm_backup(ob_back);
+		fly->obtfm = object_tfm_backup(ob_back);
 
 		where_is_object(fly->scene, fly->v3d->camera);
 		negate_v3_v3(fly->rv3d->ofs, fly->v3d->camera->obmat[3]);
 
-		fly->rv3d->dist=0.0;
+		fly->rv3d->dist = 0.0;
 	}
 	else {
 		/* perspective or ortho */
-		if (fly->rv3d->persp==RV3D_ORTHO)
-			fly->rv3d->persp= RV3D_PERSP; /*if ortho projection, make perspective */
+		if (fly->rv3d->persp == RV3D_ORTHO)
+			fly->rv3d->persp = RV3D_PERSP;  /* if ortho projection, make perspective */
 
 		copy_qt_qt(fly->rot_backup, fly->rv3d->viewquat);
 		copy_v3_v3(fly->ofs_backup, fly->rv3d->ofs);
 
 		/* the dist defines a vector that is infront of the offset
-		to rotate the view about.
-		this is no good for fly mode because we
-		want to rotate about the viewers center.
-		but to correct the dist removal we must
-		alter offset so the view doesn't jump. */
+		 * to rotate the view about.
+		 * this is no good for fly mode because we
+		 * want to rotate about the viewers center.
+		 * but to correct the dist removal we must
+		 * alter offset so the view doesn't jump. */
 
-		fly->rv3d->dist= 0.0f;
+		fly->rv3d->dist = 0.0f;
 
-		upvec[2]= fly->dist_backup; /*x and y are 0*/
+		upvec[2] = fly->dist_backup; /* x and y are 0 */
 		mul_m3_v3(mat, upvec);
 		sub_v3_v3(fly->rv3d->ofs, upvec);
-		/*Done with correcting for the dist*/
+		/* Done with correcting for the dist */
 	}
-	
+
 	/* center the mouse, probably the UI mafia are against this but without its quite annoying */
-	WM_cursor_warp(CTX_wm_window(C), fly->ar->winrct.xmin + fly->ar->winx/2, fly->ar->winrct.ymin + fly->ar->winy/2);
-	
+	WM_cursor_warp(win, fly->ar->winrct.xmin + fly->ar->winx / 2, fly->ar->winrct.ymin + fly->ar->winy / 2);
+
 	return 1;
 }
 
 static int flyEnd(bContext *C, FlyInfo *fly)
 {
-	RegionView3D *rv3d= fly->rv3d;
+	RegionView3D *rv3d = fly->rv3d;
 	View3D *v3d = fly->v3d;
 
 	float upvec[3];
@@ -415,13 +420,13 @@ static int flyEnd(bContext *C, FlyInfo *fly)
 
 	ED_region_draw_cb_exit(fly->ar->type, fly->draw_handle_pixel);
 
-	rv3d->dist= fly->dist_backup;
+	rv3d->dist = fly->dist_backup;
 
 	if (fly->state == FLY_CANCEL) {
-	/* Revert to original view? */
-		if (fly->persp_backup==RV3D_CAMOB) { /* a camera view */
+		/* Revert to original view? */
+		if (fly->persp_backup == RV3D_CAMOB) { /* a camera view */
 			Object *ob_back;
-			ob_back= (fly->root_parent) ? fly->root_parent : fly->v3d->camera;
+			ob_back = (fly->root_parent) ? fly->root_parent : fly->v3d->camera;
 
 			/* store the original camera loc and rot */
 			object_tfm_restore(ob_back, fly->obtfm);
@@ -432,26 +437,27 @@ static int flyEnd(bContext *C, FlyInfo *fly)
 			/* 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;
+			rv3d->persp = fly->persp_backup;
 		}
 	}
-	else if (fly->persp_backup==RV3D_CAMOB) {	/* camera */
+	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);
 	}
 	else { /* not camera */
+
 		/* Apply the fly mode view */
-		/*restore the dist*/
+		/* restore the dist */
 		float mat[3][3];
-		upvec[0]= upvec[1]= 0;
-		upvec[2]= fly->dist_backup; /*x and y are 0*/
+		upvec[0] = upvec[1] = 0;
+		upvec[2] = fly->dist_backup; /* x and y are 0 */
 		copy_m3_m4(mat, rv3d->viewinv);
 		mul_m3_v3(mat, upvec);
 		add_v3_v3(rv3d->ofs, upvec);
-		/*Done with correcting for the dist */
+		/* Done with correcting for the dist */
 	}
 
-	if(fly->is_ortho_cam) {
-		((Camera *)fly->v3d->camera->data)->type= CAM_ORTHO;
+	if (fly->is_ortho_cam) {
+		((Camera *)fly->v3d->camera->data)->type = CAM_ORTHO;
 	}
 
 	rv3d->rflag &= ~RV3D_NAVIGATING;
@@ -459,7 +465,6 @@ static int flyEnd(bContext *C, FlyInfo *fly)
 
 	if (fly->obtfm)
 		MEM_freeN(fly->obtfm);
-
 	if (fly->ndof)
 		MEM_freeN(fly->ndof);
 
@@ -481,20 +486,20 @@ static void flyEvent(FlyInfo *fly, wmEvent *event)
 		copy_v2_v2_int(fly->mval, event->mval);
 	}
 	else if (event->type == NDOF_MOTION) {
-		// do these automagically get delivered? yes.
+		/* do these automagically get delivered? yes. */
 		// puts("ndof motion detected in fly mode!");
 		// static const char* tag_name = "3D mouse position";
 
-		wmNDOFMotionData* incoming_ndof = (wmNDOFMotionData*) event->customdata;
+		wmNDOFMotionData *incoming_ndof = (wmNDOFMotionData *)event->customdata;
 		switch (incoming_ndof->progress) {
 			case P_STARTING:
-				// start keeping track of 3D mouse position
+				/* start keeping track of 3D mouse position */
 #ifdef NDOF_FLY_DEBUG
 				puts("start keeping track of 3D mouse position");
 #endif
-				// fall through...
+			/* fall through... */
 			case P_IN_PROGRESS:
-				// update 3D mouse position
+				/* update 3D mouse position */
 #ifdef NDOF_FLY_DEBUG
 				putchar('.'); fflush(stdout);
 #endif
@@ -518,12 +523,12 @@ static void flyEvent(FlyInfo *fly, wmEvent *event)
 					fly->ndof = NULL;
 				}
 				/* update the time else the view will jump when 2D mouse/timer resume */
-				fly->time_lastdraw= PIL_check_seconds_timer();
+				fly->time_lastdraw = PIL_check_seconds_timer();
 				break;
 			default:
-				; // should always be one of the above 3
-			}
+				break; /* should always be one of the above 3 */
 		}
+	}
 	/* handle modal keymap first */
 	else if (event->type == EVT_MODAL_MAP) {
 		switch (event->val) {
@@ -539,18 +544,17 @@ static void flyEvent(FlyInfo *fly, wmEvent *event)
 				double time_currwheel;
 				float time_wheel;
 
-				time_currwheel= PIL_check_seconds_timer();
+				time_currwheel = PIL_check_seconds_timer();
 				time_wheel = (float)(time_currwheel - fly->time_lastwheel);
 				fly->time_lastwheel = time_currwheel;
-				/*printf("Wheel %f\n", time_wheel);*/
-				/*Mouse wheel delays range from 0.5==slow to 0.01==fast*/
+				/* Mouse wheel delays range from 0.5==slow to 0.01==fast */
 				time_wheel = 1.0f + (10.0f - (20.0f * MIN2(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */
 
 				if (fly->speed < 0.0f) {
-					fly->speed= 0.0f;
+					fly->speed = 0.0f;
 				}
 				else {
-					fly->speed += fly->grid*time_wheel * (fly->use_precision ? 0.1f : 1.0f);
+					fly->speed += fly->grid * time_wheel * (fly->use_precision ? 0.1f : 1.0f);
 				}
 				break;
 			}
@@ -559,69 +563,106 @@ static void flyEvent(FlyInfo *fly, wmEvent *event)
 				double time_currwheel;
 				float time_wheel;
 
-				time_currwheel= PIL_check_seconds_timer();
+				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 * MIN2(time_wheel, 0.5f))); /* 0-0.5 -> 0-5.0 */
 
 				if (fly->speed > 0.0f) {
-					fly->speed=0;
+					fly->speed = 0;
 				}
 				else {
-					fly->speed-= fly->grid*time_wheel * (fly->use_precision ? 0.1f : 1.0f);
+					fly->speed -= fly->grid * time_wheel * (fly->use_precision ? 0.1f : 1.0f);
 				}
 				break;
 			}
 			case FLY_MODAL_PAN_ENABLE:
-				fly->pan_view= TRUE;
+				fly->pan_view = TRUE;
 				break;
 			case FLY_MODAL_PAN_DISABLE:
 //XXX2.5		warp_pointer(cent_orig[0], cent_orig[1]);
-				fly->pan_view= FALSE;
+				fly->pan_view = FALSE;
 				break;
 
-				/* impliment WASD keys */
+			/* implement WASD keys,
+			 * comments only for 'forward '*/
 			case FLY_MODAL_DIR_FORWARD:
-				if (fly->speed < 0.0f) fly->speed= -fly->speed; /* flip speed rather than stopping, game like motion */
-				else if (fly->axis==2) fly->speed += fly->grid; /* increse like mousewheel if were already
-				                                                 * moving in that difection*/
-				fly->axis= 2;
+				if (fly->axis == 2 && fly->speed < 0.0f) { /* reverse direction stops, tap again to continue */
+					fly->axis = -1;
+				}
+				else {
+					/* flip speed rather than stopping, game like motion,
+					 * else increase like mousewheel if were already moving in that direction */
+					if (fly->speed < 0.0f)   fly->speed = -fly->speed;
+					else if (fly->axis == 2) fly->speed += fly->grid;
+					fly->axis = 2;
+				}
 				break;
 			case FLY_MODAL_DIR_BACKWARD:
-				if (fly->speed > 0.0f) fly->speed= -fly->speed;
-				else if (fly->axis==2) fly->speed -= fly->grid;
-				fly->axis= 2;
+				if (fly->axis == 2 && fly->speed > 0.0f) {
+					fly->axis = -1;
+				}
+				else {
+					if (fly->speed > 0.0f)   fly->speed = -fly->speed;
+					else if (fly->axis == 2) fly->speed -= fly->grid;
+
+					fly->axis = 2;
+				}
 				break;
 			case FLY_MODAL_DIR_LEFT:
-				if (fly->speed < 0.0f) fly->speed= -fly->speed;
-				else if (fly->axis==0) fly->speed += fly->grid;
-				fly->axis= 0;
+				if (fly->axis == 0 && fly->speed < 0.0f) {
+					fly->axis = -1;
+				}
+				else {
+					if (fly->speed < 0.0f)   fly->speed = -fly->speed;
+					else if (fly->axis == 0) fly->speed += fly->grid;
+
+					fly->axis = 0;
+				}
 				break;
 			case FLY_MODAL_DIR_RIGHT:
-				if (fly->speed > 0.0f) fly->speed= -fly->speed;
-				else if (fly->axis==0) fly->speed -= fly->grid;
-				fly->axis= 0;
+				if (fly->axis == 0 && fly->speed > 0.0f) {
+					fly->axis = -1;
+				}
+				else {
+					if (fly->speed > 0.0f)   fly->speed = -fly->speed;
+					else if (fly->axis == 0) fly->speed -= fly->grid;
+
+					fly->axis = 0;
+				}
 				break;
 			case FLY_MODAL_DIR_DOWN:
-				if (fly->speed < 0.0f) fly->speed= -fly->speed;
-				else if (fly->axis==1) fly->speed += fly->grid;
-				fly->axis= 1;
+				if (fly->axis == 1 && fly->speed < 0.0f) {
+					fly->axis = -1;
+				}
+				else {
+					if (fly->speed < 0.0f)   fly->speed = -fly->speed;
+					else if (fly->axis == 1) fly->speed += fly->grid;
+					fly->axis = 1;
+				}
 				break;
 			case FLY_MODAL_DIR_UP:
-				if (fly->speed > 0.0f) fly->speed= -fly->speed;
-				else if (fly->axis==1) fly->speed -= fly->grid;
-				fly->axis= 1;
+				if (fly->axis == 1 && fly->speed > 0.0f) {
+					fly->axis = -1;
+				}
+				else {
+					if (fly->speed > 0.0f)   fly->speed = -fly->speed;
+					else if (fly->axis == 1) fly->speed -= fly->grid;
+					fly->axis = 1;
+				}
 				break;
 
 			case FLY_MODAL_AXIS_LOCK_X:
-				if (fly->xlock) fly->xlock=0;
+				if (fly->xlock)
+					fly->xlock = 0;
 				else {
 					fly->xlock = 2;
 					fly->xlock_momentum = 0.0;
 				}
 				break;
 			case FLY_MODAL_AXIS_LOCK_Z:
-				if (fly->zlock) fly->zlock=0;
+				if (fly->zlock)
+					fly->zlock = 0;
 				else {
 					fly->zlock = 2;
 					fly->zlock_momentum = 0.0;
@@ -629,29 +670,28 @@ static void flyEvent(FlyInfo *fly, wmEvent *event)
 				break;
 
 			case FLY_MODAL_PRECISION_ENABLE:
-				fly->use_precision= TRUE;
+				fly->use_precision = TRUE;
 				break;
 			case FLY_MODAL_PRECISION_DISABLE:
-				fly->use_precision= FALSE;
+				fly->use_precision = FALSE;
 				break;
 
 			case FLY_MODAL_FREELOOK_ENABLE:
-				fly->use_freelook= TRUE;
+				fly->use_freelook = TRUE;
 				break;
 			case FLY_MODAL_FREELOOK_DISABLE:
-				fly->use_freelook= FALSE;
+				fly->use_freelook = FALSE;
 				break;
 		}
 	}
 }
 
-
-static void move_camera(bContext* C, RegionView3D* rv3d, FlyInfo* fly, int orientationChanged, int positionChanged)
+static void move_camera(bContext *C, RegionView3D *rv3d, FlyInfo *fly, int orientationChanged, int positionChanged)
 {
 	/* we are in camera view so apply the view ofs and quat to the view matrix and set the camera to the view */
 
-	View3D* v3d = fly->v3d;
-	Scene *scene= fly->scene;
+	View3D*v3d = fly->v3d;
+	Scene *scene = fly->scene;
 	ID *id_key;
 
 	/* transform the parent or the camera? */
@@ -673,42 +713,42 @@ static void move_camera(bContext* C, RegionView3D* rv3d, FlyInfo* fly, int orien
 
 		// where_is_object(scene, fly->root_parent);
 
-		ob_update= v3d->camera->parent;
-		while(ob_update) {
+		ob_update = v3d->camera->parent;
+		while (ob_update) {
 			DAG_id_tag_update(&ob_update->id, OB_RECALC_OB);
-			ob_update= ob_update->parent;
+			ob_update = ob_update->parent;
 		}
 
-		id_key= &fly->root_parent->id;
+		id_key = &fly->root_parent->id;
 	}
 	else {
 		float view_mat[4][4];
 		ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist);
 		object_apply_mat4(v3d->camera, view_mat, TRUE, FALSE);
-		id_key= &v3d->camera->id;
+		id_key = &v3d->camera->id;
 	}
 
 	/* record the motion */
 	if (autokeyframe_cfra_can_key(scene, id_key)) {
 		ListBase dsources = {NULL, NULL};
-		
+
 		/* add datasource override for the camera object */
-		ANIM_relative_keyingset_add_source(&dsources, id_key, NULL, NULL); 
-		
+		ANIM_relative_keyingset_add_source(&dsources, id_key, NULL, NULL);
+
 		/* insert keyframes 
 		 *	1) on the first frame
 		 *	2) on each subsequent frame
 		 *		TODO: need to check in future that frame changed before doing this 
 		 */
 		if (orientationChanged) {
-			KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_ROTATION_ID);
+			KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_ROTATION_ID);
 			ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA);
 		}
 		if (positionChanged) {
-			KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOCATION_ID);
+			KeyingSet *ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOCATION_ID);
 			ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, (float)CFRA);
 		}
-		
+
 		/* free temp data */
 		BLI_freelistN(&dsources);
 	}
@@ -720,26 +760,24 @@ static int flyApply(bContext *C, FlyInfo *fly)
 #define FLY_ZUP_CORRECT_FAC 0.1f /* amount to correct per step */
 #define FLY_ZUP_CORRECT_ACCEL 0.05f /* increase upright momentum each step */
 
-	/*
-	fly mode - Shift+F
-	a fly loop where the user can move move the view as if they are flying
-	*/
-	RegionView3D *rv3d= fly->rv3d;
+	/* fly mode - Shift+F
+	 * a fly loop where the user can move move the view as if they are flying
+	 */
+	RegionView3D *rv3d = fly->rv3d;
 	ARegion *ar = fly->ar;
 
-	float mat[3][3], /* 3x3 copy of the view matrix so we can move along the view axis */
-	dvec[3]={0,0,0}, /* this is the direction thast added to the view offset per redraw */
+	float mat[3][3]; /* 3x3 copy of the view matrix so we can move along the view axis */
+	float dvec[3] = {0, 0, 0}; /* this is the direction thast added to the view offset per redraw */
 
 	/* Camera Uprighting variables */
-	upvec[3]={0,0,0}, /* stores the view's up vector */
+	float upvec[3] = {0, 0, 0}; /* stores the view's up vector */
 
-	moffset[2], /* mouse offset from the views center */
-	tmp_quat[4]; /* used for rotating the view */
+	float moffset[2]; /* mouse offset from the views center */
+	float tmp_quat[4]; /* used for rotating the view */
 
-	int
-//	cent_orig[2], /* view center */
-//XXX- can avoid using // 	cent[2], /* view center modified */
-	xmargin, ymargin; /* x and y margin are define the safe area where the mouses movement wont rotate the view */
+//	int cent_orig[2], /* view center */
+//XXX- can avoid using //   cent[2], /* view center modified */
+	int xmargin, ymargin; /* x and y margin are define the safe area where the mouses movement wont rotate the view */
 
 #ifdef NDOF_FLY_DEBUG
 	{
@@ -748,9 +786,8 @@ static int flyApply(bContext *C, FlyInfo *fly)
 	}
 #endif
 
-
-	xmargin= ar->winx/20.0f;
-	ymargin= ar->winy/20.0f;
+	xmargin = ar->winx / 20.0f;
+	ymargin = ar->winy / 20.0f;
 
 	// UNUSED
 	// cent_orig[0]= ar->winrct.xmin + ar->winx/2;
@@ -759,65 +796,67 @@ static int flyApply(bContext *C, FlyInfo *fly)
 	{
 
 		/* mouse offset from the center */
-		moffset[0]= fly->mval[0]- ar->winx/2;
-		moffset[1]= fly->mval[1]- ar->winy/2;
+		moffset[0] = fly->mval[0] - ar->winx / 2;
+		moffset[1] = fly->mval[1] - ar->winy / 2;
 
 		/* enforce a view margin */
-		if (moffset[0]>xmargin)			moffset[0]-=xmargin;
-		else if (moffset[0] < -xmargin)	moffset[0]+=xmargin;
-		else							moffset[0]=0;
+		if      (moffset[0] >  xmargin) moffset[0] -= xmargin;
+		else if (moffset[0] < -xmargin) moffset[0] += xmargin;
+		else                            moffset[0] =  0;
 
-		if (moffset[1]>ymargin)			moffset[1]-=ymargin;
-		else if (moffset[1] < -ymargin)	moffset[1]+=ymargin;
-		else							moffset[1]=0;
+		if      (moffset[1] >  ymargin) moffset[1] -= ymargin;
+		else if (moffset[1] < -ymargin) moffset[1] += ymargin;
+		else                            moffset[1] =  0;
 
 
 		/* scale the mouse movement by this value - scales mouse movement to the view size
 		 * moffset[0]/(ar->winx-xmargin*2) - window size minus margin (same for y)
 		 *
-		 * the mouse moves isnt linear */
+		 * the mouse moves isn't linear */
 
 		if (moffset[0]) {
-			moffset[0] /= ar->winx - (xmargin*2);
+			moffset[0] /= ar->winx - (xmargin * 2);
 			moffset[0] *= fabsf(moffset[0]);
 		}
 
 		if (moffset[1]) {
-			moffset[1] /= ar->winy - (ymargin*2);
+			moffset[1] /= ar->winy - (ymargin * 2);
 			moffset[1] *= fabsf(moffset[1]);
 		}
 
 		/* Should we redraw? */
-		if ( (fly->speed != 0.0f) ||
-		     moffset[0] || moffset[1] ||
-		     fly->zlock || fly->xlock ||
-		     dvec[0] || dvec[1] || dvec[2])
+		if ((fly->speed != 0.0f) ||
+		    moffset[0] || moffset[1] ||
+		    fly->zlock || fly->xlock ||
+		    dvec[0] || dvec[1] || dvec[2])
 		{
 			float dvec_tmp[3];
-			double time_current; /*time how fast it takes for us to redraw, this is so simple scenes dont fly too fast */
+
+			/* time how fast it takes for us to redraw,
+			 * this is so simple scenes don't fly too fast */
+			double time_current;
 			float time_redraw;
 			float time_redraw_clamped;
 #ifdef NDOF_FLY_DRAW_TOOMUCH
-			fly->redraw= 1;
+			fly->redraw = 1;
 #endif
-			time_current= PIL_check_seconds_timer();
-			time_redraw= (float)(time_current - fly->time_lastdraw);
-			time_redraw_clamped= MIN2(0.05f, time_redraw); /* clamp redraw time to avoid jitter in roll correction */
-			fly->time_lastdraw= time_current;
-			/*fprintf(stderr, "%f\n", time_redraw);*/ /* 0.002 is a small redraw 0.02 is larger */
+			time_current = PIL_check_seconds_timer();
+			time_redraw = (float)(time_current - fly->time_lastdraw);
+			time_redraw_clamped = MIN2(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
-			shift slows many other areas of blender down */
+			 * shift slows many other areas of blender down */
 			if (fly->use_precision)
-				fly->speed= fly->speed * (1.0f-time_redraw_clamped);
+				fly->speed = fly->speed * (1.0f - time_redraw_clamped);
 
 			copy_m3_m4(mat, rv3d->viewinv);
 
-			if (fly->pan_view==TRUE) {
+			if (fly->pan_view == TRUE) {
 				/* pan only */
-				dvec_tmp[0]= -moffset[0];
-				dvec_tmp[1]= -moffset[1];
-				dvec_tmp[2]= 0;
+				dvec_tmp[0] = -moffset[0];
+				dvec_tmp[1] = -moffset[1];
+				dvec_tmp[2] = 0;
 
 				if (fly->use_precision) {
 					dvec_tmp[0] *= 0.1f;
@@ -829,45 +868,47 @@ static int flyApply(bContext *C, FlyInfo *fly)
 			}
 			else {
 				float roll; /* similar to the angle between the camera's up and the Z-up,
-				             * but its very rough so just roll*/
+				             * but its very rough so just roll */
 
 				/* rotate about the X axis- look up/down */
 				if (moffset[1]) {
-					upvec[0]=1;
-					upvec[1]=0;
-					upvec[2]=0;
+					upvec[0] = 1;
+					upvec[1] = 0;
+					upvec[2] = 0;
 					mul_m3_v3(mat, upvec);
 					/* Rotate about the relative up vec */
-					axis_angle_to_quat( tmp_quat, upvec, (float)moffset[1] * time_redraw * -FLY_ROTATE_FAC);
+					axis_angle_to_quat(tmp_quat, upvec, (float)moffset[1] * time_redraw * -FLY_ROTATE_FAC);
 					mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, tmp_quat);
 
-					if (fly->xlock) fly->xlock = 2; /*check for rotation*/
-					if (fly->zlock) fly->zlock = 2;
-					fly->xlock_momentum= 0.0f;
+					if (fly->xlock)
+						fly->xlock = 2;  /* check for rotation */
+					if (fly->zlock)
+						fly->zlock = 2;
+					fly->xlock_momentum = 0.0f;
 				}
 
 				/* rotate about the Y axis- look left/right */
 				if (moffset[0]) {
 
 					/* if we're upside down invert the moffset */
-					upvec[0]= 0.0f;
-					upvec[1]= 1.0f;
-					upvec[2]= 0.0f;
+					upvec[0] = 0.0f;
+					upvec[1] = 1.0f;
+					upvec[2] = 0.0f;
 					mul_m3_v3(mat, upvec);
 
 					if (upvec[2] < 0.0f)
-						moffset[0]= -moffset[0];
+						moffset[0] = -moffset[0];
 
 					/* make the lock vectors */
 					if (fly->zlock) {
-						upvec[0]= 0.0f;
-						upvec[1]= 0.0f;
-						upvec[2]= 1.0f;
+						upvec[0] = 0.0f;
+						upvec[1] = 0.0f;
+						upvec[2] = 1.0f;
 					}
 					else {
-						upvec[0]= 0.0f;
-						upvec[1]= 1.0f;
-						upvec[2]= 0.0f;
+						upvec[0] = 0.0f;
+						upvec[1] = 1.0f;
+						upvec[2] = 0.0f;
 						mul_m3_v3(mat, upvec);
 					}
 
@@ -875,22 +916,24 @@ static int flyApply(bContext *C, FlyInfo *fly)
 					axis_angle_to_quat(tmp_quat, upvec, (float)moffset[0] * time_redraw * FLY_ROTATE_FAC);
 					mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, tmp_quat);
 
-					if (fly->xlock) fly->xlock = 2;/*check for rotation*/
-					if (fly->zlock) fly->zlock = 2;
+					if (fly->xlock)
+						fly->xlock = 2;  /* check for rotation */
+					if (fly->zlock)
+						fly->zlock = 2;
 				}
 
-				if (fly->zlock==2) {
-					upvec[0]= 1.0f;
-					upvec[1]= 0.0f;
-					upvec[2]= 0.0f;
+				if (fly->zlock == 2) {
+					upvec[0] = 1.0f;
+					upvec[1] = 0.0f;
+					upvec[2] = 0.0f;
 					mul_m3_v3(mat, upvec);
 
-					/*make sure we have some z rolling*/
+					/* make sure we have some z rolling */
 					if (fabsf(upvec[2]) > 0.00001f) {
-						roll= upvec[2] * 5.0f;
-						upvec[0]= 0.0f; /*rotate the view about this axis*/
-						upvec[1]= 0.0f;
-						upvec[2]= 1.0f;
+						roll = upvec[2] * 5.0f;
+						upvec[0] = 0.0f; /* rotate the view about this axis */
+						upvec[1] = 0.0f;
+						upvec[2] = 1.0f;
 
 						mul_m3_v3(mat, upvec);
 						/* Rotate about the relative up vec */
@@ -901,51 +944,54 @@ static int flyApply(bContext *C, FlyInfo *fly)
 						fly->zlock_momentum += FLY_ZUP_CORRECT_ACCEL;
 					}
 					else {
-						fly->zlock= 1; /* dont check until the view rotates again */
-						fly->zlock_momentum= 0.0f;
+						fly->zlock = 1; /* don't check until the view rotates again */
+						fly->zlock_momentum = 0.0f;
 					}
 				}
 
-				if (fly->xlock==2 && moffset[1]==0) { /*only apply xcorrect when mouse isnt applying x rot*/
-					upvec[0]=0;
-					upvec[1]=0;
-					upvec[2]=1;
+				if (fly->xlock == 2 && moffset[1] == 0) { /* only apply xcorrect when mouse isn't applying x rot */
+					upvec[0] = 0;
+					upvec[1] = 0;
+					upvec[2] = 1;
 					mul_m3_v3(mat, upvec);
-					/*make sure we have some z rolling*/
+					/* make sure we have some z rolling */
 					if (fabsf(upvec[2]) > 0.00001f) {
-						roll= upvec[2] * -5.0f;
+						roll = upvec[2] * -5.0f;
 
-						upvec[0]= 1.0f; /*rotate the view about this axis*/
-						upvec[1]= 0.0f;
-						upvec[2]= 0.0f;
+						upvec[0] = 1.0f; /* rotate the view about this axis */
+						upvec[1] = 0.0f;
+						upvec[2] = 0.0f;
 
 						mul_m3_v3(mat, upvec);
 
 						/* Rotate about the relative up vec */
-						axis_angle_to_quat( tmp_quat, upvec, roll*time_redraw_clamped*fly->xlock_momentum*0.1f);
+						axis_angle_to_quat(tmp_quat, upvec, roll * time_redraw_clamped * fly->xlock_momentum * 0.1f);
 						mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, tmp_quat);
 
 						fly->xlock_momentum += 0.05f;
 					}
 					else {
-						fly->xlock=1; /* see above */
-						fly->xlock_momentum= 0.0f;
+						fly->xlock = 1; /* see above */
+						fly->xlock_momentum = 0.0f;
 					}
 				}
 
-
-				if (!fly->use_freelook) {
+				if (fly->axis == -1) {
+					/* pause */
+					zero_v3(dvec_tmp);
+				}
+				else if (!fly->use_freelook) {
 					/* Normal operation */
 					/* define dvec, view direction vector */
-					dvec_tmp[0]= dvec_tmp[1]= dvec_tmp[2]= 0.0f;
+					zero_v3(dvec_tmp);
 					/* move along the current axis */
-					dvec_tmp[fly->axis]= 1.0f;
+					dvec_tmp[fly->axis] = 1.0f;
 
 					mul_m3_v3(mat, dvec_tmp);
 				}
 				else {
 					normalize_v3_v3(dvec_tmp, fly->dvec_prev);
-					if(fly->speed < 0.0f) {
+					if (fly->speed < 0.0f) {
 						negate_v3(dvec_tmp);
 					}
 				}
@@ -954,10 +1000,10 @@ static int flyApply(bContext *C, FlyInfo *fly)
 			}
 
 			/* impose a directional lag */
-			interp_v3_v3v3(dvec, dvec_tmp, fly->dvec_prev, (1.0f/(1.0f+(time_redraw*5.0f))));
+			interp_v3_v3v3(dvec, dvec_tmp, fly->dvec_prev, (1.0f / (1.0f + (time_redraw * 5.0f))));
 
-			if (rv3d->persp==RV3D_CAMOB) {
-				Object *lock_ob= fly->root_parent ? fly->root_parent : fly->v3d->camera;
+			if (rv3d->persp == RV3D_CAMOB) {
+				Object *lock_ob = fly->root_parent ? fly->root_parent : fly->v3d->camera;
 				if (lock_ob->protectflag & OB_LOCK_LOCX) dvec[0] = 0.0;
 				if (lock_ob->protectflag & OB_LOCK_LOCY) dvec[1] = 0.0;
 				if (lock_ob->protectflag & OB_LOCK_LOCZ) dvec[2] = 0.0;
@@ -965,13 +1011,13 @@ static int flyApply(bContext *C, FlyInfo *fly)
 
 			add_v3_v3(rv3d->ofs, dvec);
 
-			if (rv3d->persp==RV3D_CAMOB)
+			if (rv3d->persp == RV3D_CAMOB)
 				move_camera(C, rv3d, fly, (fly->xlock || fly->zlock || moffset[0] || moffset[1]), fly->speed);
 
 		}
 		else {
 			/* we're not redrawing but we need to update the time else the view will jump */
-			fly->time_lastdraw= PIL_check_seconds_timer();
+			fly->time_lastdraw = PIL_check_seconds_timer();
 		}
 		/* end drawing */
 		copy_v3_v3(fly->dvec_prev, dvec);
@@ -983,28 +1029,30 @@ static int flyApply(bContext *C, FlyInfo *fly)
 static int flyApply_ndof(bContext *C, FlyInfo *fly)
 {
 	/* shorthand for oft-used variables */
-	wmNDOFMotionData* ndof = fly->ndof;
+	wmNDOFMotionData *ndof = fly->ndof;
 	const float dt = ndof->dt;
-	RegionView3D* rv3d = fly->rv3d;
+	RegionView3D*rv3d = fly->rv3d;
 	const int flag = U.ndof_flag;
 
-/*	int shouldRotate = (flag & NDOF_SHOULD_ROTATE) && (fly->pan_view == FALSE),
-	    shouldTranslate = (flag & (NDOF_SHOULD_PAN | NDOF_SHOULD_ZOOM)); */
+#if 0
+	int shouldRotate = (flag & NDOF_SHOULD_ROTATE) && (fly->pan_view == FALSE),
+	    shouldTranslate = (flag & (NDOF_SHOULD_PAN | NDOF_SHOULD_ZOOM));
+#endif
 
-	int shouldRotate = (fly->pan_view == FALSE),
-	    shouldTranslate = TRUE;
+	int shouldRotate = (fly->pan_view == FALSE);
+	int shouldTranslate = TRUE;
 
 	float view_inv[4];
 	invert_qt_qt(view_inv, rv3d->viewquat);
 
-	rv3d->rot_angle = 0.f; // disable onscreen rotation doo-dad
+	rv3d->rot_angle = 0.0f; /* disable onscreen rotation doo-dad */
 
 	if (shouldTranslate) {
-		const float forward_sensitivity = 1.f;
+		const float forward_sensitivity  = 1.0f;
 		const float vertical_sensitivity = 0.4f;
-		const float lateral_sensitivity = 0.6f;
+		const float lateral_sensitivity  = 0.6f;
 
-		float speed = 10.f; /* blender units per second */
+		float speed = 10.0f; /* blender units per second */
 		/* ^^ this is ok for default cube scene, but should scale with.. something */
 
 		float trans[3] = {lateral_sensitivity  * ndof->tvec[0],
@@ -1016,7 +1064,7 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly)
 
 		mul_v3_fl(trans, speed * dt);
 
-		// transform motion from view to world coordinates
+		/* transform motion from view to world coordinates */
 		mul_qt_v3(view_inv, trans);
 
 		if (flag & NDOF_FLY_HELICOPTER) {
@@ -1024,16 +1072,16 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly)
 			trans[2] = speed * dt * vertical_sensitivity * ndof->tvec[1];
 		}
 
-		if (rv3d->persp==RV3D_CAMOB) {
-			// respect camera position locks
-			Object *lock_ob= fly->root_parent ? fly->root_parent : fly->v3d->camera;
-			if (lock_ob->protectflag & OB_LOCK_LOCX) trans[0] = 0.f;
-			if (lock_ob->protectflag & OB_LOCK_LOCY) trans[1] = 0.f;
-			if (lock_ob->protectflag & OB_LOCK_LOCZ) trans[2] = 0.f;
+		if (rv3d->persp == RV3D_CAMOB) {
+			/* respect camera position locks */
+			Object *lock_ob = fly->root_parent ? fly->root_parent : fly->v3d->camera;
+			if (lock_ob->protectflag & OB_LOCK_LOCX) trans[0] = 0.0f;
+			if (lock_ob->protectflag & OB_LOCK_LOCY) trans[1] = 0.0f;
+			if (lock_ob->protectflag & OB_LOCK_LOCZ) trans[2] = 0.0f;
 		}
 
 		if (!is_zero_v3(trans)) {
-			// move center of view opposite of hand motion (this is camera mode, not object mode)
+			/* move center of view opposite of hand motion (this is camera mode, not object mode) */
 			sub_v3_v3(rv3d->ofs, trans);
 			shouldTranslate = TRUE;
 		}
@@ -1043,7 +1091,7 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly)
 	}
 
 	if (shouldRotate) {
-		const float turn_sensitivity = 1.f;
+		const float turn_sensitivity = 1.0f;
 
 		float rotation[4];
 		float axis[3];
@@ -1058,15 +1106,15 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly)
 			/* transform rotation axis from view to world coordinates */
 			mul_qt_v3(view_inv, axis);
 
-			// apply rotation to view
+			/* apply rotation to view */
 			axis_angle_to_quat(rotation, axis, angle);
 			mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, rotation);
 
 			if (flag & NDOF_LOCK_HORIZON) {
 				/* force an upright viewpoint
 				 * TODO: make this less... sudden */
-				float view_horizon[3] = {1.f, 0.f, 0.f}; /* view +x */
-				float view_direction[3] = {0.f, 0.f, -1.f}; /* view -z (into screen) */
+				float view_horizon[3] = {1.0f, 0.0f, 0.0f}; /* view +x */
+				float view_direction[3] = {0.0f, 0.0f, -1.0f}; /* view -z (into screen) */
 
 				/* find new inverse since viewquat has changed */
 				invert_qt_qt(view_inv, rv3d->viewquat);
@@ -1099,7 +1147,7 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly)
 	if (shouldTranslate || shouldRotate) {
 		fly->redraw = TRUE;
 
-		if (rv3d->persp==RV3D_CAMOB) {
+		if (rv3d->persp == RV3D_CAMOB) {
 			move_camera(C, rv3d, fly, shouldRotate, shouldTranslate);
 		}
 	}
@@ -1107,20 +1155,19 @@ static int flyApply_ndof(bContext *C, FlyInfo *fly)
 	return OPERATOR_FINISHED;
 }
 
-
 static int fly_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	RegionView3D *rv3d= CTX_wm_region_view3d(C);
+	RegionView3D *rv3d = CTX_wm_region_view3d(C);
 	FlyInfo *fly;
 
 	if (rv3d->viewlock)
 		return OPERATOR_CANCELLED;
 
-	fly= MEM_callocN(sizeof(FlyInfo), "FlyOperation");
+	fly = MEM_callocN(sizeof(FlyInfo), "FlyOperation");
 
-	op->customdata= fly;
+	op->customdata = fly;
 
-	if (initFlyInfo(C, fly, op, event)==FALSE) {
+	if (initFlyInfo(C, fly, op, event) == FALSE) {
 		MEM_freeN(op->customdata);
 		return OPERATOR_CANCELLED;
 	}
@@ -1138,7 +1185,7 @@ static int fly_cancel(bContext *C, wmOperator *op)
 
 	fly->state = FLY_CANCEL;
 	flyEnd(C, fly);
-	op->customdata= NULL;
+	op->customdata = NULL;
 
 	return OPERATOR_CANCELLED;
 }
@@ -1146,21 +1193,21 @@ static int fly_cancel(bContext *C, wmOperator *op)
 static int fly_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
 	int exit_code;
-	short do_draw= FALSE;
-	FlyInfo *fly= op->customdata;
-	RegionView3D *rv3d= fly->rv3d;
-	Object *fly_object= fly->root_parent ? fly->root_parent : fly->v3d->camera;
+	short do_draw = FALSE;
+	FlyInfo *fly = op->customdata;
+	RegionView3D *rv3d = fly->rv3d;
+	Object *fly_object = fly->root_parent ? fly->root_parent : fly->v3d->camera;
 
-	fly->redraw= 0;
+	fly->redraw = 0;
 
 	flyEvent(fly, event);
 
 	if (fly->ndof) { /* 3D mouse overrules [2D mouse + timer] */
-		if (event->type==NDOF_MOTION) {
+		if (event->type == NDOF_MOTION) {
 			flyApply_ndof(C, fly);
 		}
 	}
-	else if (event->type==TIMER && event->customdata == fly->timer) {
+	else if (event->type == TIMER && event->customdata == fly->timer) {
 		flyApply(C, fly);
 	}
 
@@ -1168,12 +1215,12 @@ static int fly_modal(bContext *C, wmOperator *op, wmEvent *event)
 
 	exit_code = flyEnd(C, fly);
 
-	if (exit_code!=OPERATOR_RUNNING_MODAL)
-		do_draw= TRUE;
+	if (exit_code != OPERATOR_RUNNING_MODAL)
+		do_draw = TRUE;
 
 	if (do_draw) {
-		if (rv3d->persp==RV3D_CAMOB) {
-			WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, fly_object);
+		if (rv3d->persp == RV3D_CAMOB) {
+			WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, fly_object);
 		}
 
 		// puts("redraw!"); // too frequent, commented with NDOF_FLY_DRAW_TOOMUCH for now
@@ -1186,16 +1233,16 @@ static int fly_modal(bContext *C, wmOperator *op, wmEvent *event)
 void VIEW3D_OT_fly(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Fly Navigation";
-	ot->description= "Interactively fly around the scene";
-	ot->idname= "VIEW3D_OT_fly";
+	ot->name = "Fly Navigation";
+	ot->description = "Interactively fly around the scene";
+	ot->idname = "VIEW3D_OT_fly";
 
 	/* api callbacks */
-	ot->invoke= fly_invoke;
-	ot->cancel= fly_cancel;
-	ot->modal= fly_modal;
-	ot->poll= ED_operator_view3d_active;
+	ot->invoke = fly_invoke;
+	ot->cancel = fly_cancel;
+	ot->modal = fly_modal;
+	ot->poll = ED_operator_view3d_active;
 
 	/* flags */
-	ot->flag= OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_BLOCKING;
 }
diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c
index e9b339c..ab4eca2 100644
--- a/source/blender/editors/space_view3d/view3d_header.c
+++ b/source/blender/editors/space_view3d/view3d_header.c
@@ -35,6 +35,7 @@
 
 #include "DNA_scene_types.h"
 #include "DNA_object_types.h"
+#include "DNA_mesh_types.h"
 
 #include "RNA_access.h"
 
@@ -42,7 +43,6 @@
 
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
-#include "BLI_editVert.h"
 #include "BLI_utildefines.h"
 
 #include "BLF_translation.h"
@@ -55,6 +55,7 @@
 #include "BKE_modifier.h"
 #include "BKE_paint.h"
 #include "BKE_screen.h"
+#include "BKE_tessmesh.h"
 
 #include "ED_mesh.h"
 #include "ED_util.h"
@@ -84,75 +85,76 @@
  */
 
 /* view3d handler codes */
-#define VIEW3D_HANDLER_BACKGROUND	1
-#define VIEW3D_HANDLER_PROPERTIES	2
-#define VIEW3D_HANDLER_OBJECT		3
-#define VIEW3D_HANDLER_PREVIEW		4
-#define VIEW3D_HANDLER_MULTIRES         5
-#define VIEW3D_HANDLER_TRANSFORM	6
+#define VIEW3D_HANDLER_BACKGROUND   1
+#define VIEW3D_HANDLER_PROPERTIES   2
+#define VIEW3D_HANDLER_OBJECT       3
+#define VIEW3D_HANDLER_PREVIEW      4
+#define VIEW3D_HANDLER_MULTIRES     5
+#define VIEW3D_HANDLER_TRANSFORM    6
 #define VIEW3D_HANDLER_GREASEPENCIL 7
-#define VIEW3D_HANDLER_BONESKETCH	8
+#define VIEW3D_HANDLER_BONESKETCH   8
 
 /* end XXX ************* */
 
 static void do_view3d_header_buttons(bContext *C, void *arg, int event);
 
 #define B_SCENELOCK 101
-#define B_FULL		102
-#define B_HOME		103
-#define B_VIEWBUT	104
-#define B_PERSP		105
+#define B_FULL      102
+#define B_HOME      103
+#define B_VIEWBUT   104
+#define B_PERSP     105
 #define B_MODESELECT 108
-#define B_SEL_VERT	110
-#define B_SEL_EDGE	111
-#define B_SEL_FACE	112
-#define B_MAN_TRANS	116
-#define B_MAN_ROT	117
-#define B_MAN_SCALE	118
-#define B_NDOF		119	
-#define B_MAN_MODE	120
-#define B_REDR		122
-#define B_NOP		123
+#define B_SEL_VERT  110
+#define B_SEL_EDGE  111
+#define B_SEL_FACE  112
+#define B_MAN_TRANS 116
+#define B_MAN_ROT   117
+#define B_MAN_SCALE 118
+#define B_NDOF      119
+#define B_MAN_MODE  120
+#define B_REDR      122
+#define B_NOP       123
 
 // XXX quickly ported across
 static void handle_view3d_lock(bContext *C) 
 {
-	Main *bmain= CTX_data_main(C);
-	Scene *scene= CTX_data_scene(C);
-	ScrArea *sa= CTX_wm_area(C);
-	View3D *v3d= CTX_wm_view3d(C);
+	Main *bmain = CTX_data_main(C);
+	Scene *scene = CTX_data_scene(C);
+	ScrArea *sa = CTX_wm_area(C);
+	View3D *v3d = CTX_wm_view3d(C);
 	
 	if (v3d != NULL && sa != NULL) {
-		if(v3d->localvd==NULL && v3d->scenelock && sa->spacetype==SPACE_VIEW3D) {
+		if (v3d->localvd == NULL && v3d->scenelock && sa->spacetype == SPACE_VIEW3D) {
 			/* copy to scene */
-			scene->lay= v3d->lay;
-			scene->layact= v3d->layact;
-			scene->camera= v3d->camera;
+			scene->lay = v3d->lay;
+			scene->layact = v3d->layact;
+			scene->camera = v3d->camera;
 
-			/* not through notifiery, listener don't have context
-			   and non-open screens or spaces need to be updated too */
+			/* not through notifier, listener don't have context
+			 * and non-open screens or spaces need to be updated too */
 			BKE_screen_view3d_main_sync(&bmain->screen, scene);
 			
 			/* notifiers for scene update */
-			WM_event_add_notifier(C, NC_SCENE|ND_LAYER, scene);
+			WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene);
 		}
 	}
 }
 
-/* layer code is on three levels actually:
-- here for operator
-- uiTemplateLayers in interface/ code for buttons
-- ED_view3d_scene_layer_set for RNA
+/**
+ * layer code is on three levels actually:
+ * - here for operator
+ * - uiTemplateLayers in interface/ code for buttons
+ * - ED_view3d_scene_layer_set for RNA
  */
 static void view3d_layers_editmode_ensure(Scene *scene, View3D *v3d)
 {
 	/* sanity check - when in editmode disallow switching the editmode layer off since its confusing
 	 * an alternative would be to always draw the editmode object. */
-	if(scene->obedit && (scene->obedit->lay & v3d->lay)==0) {
+	if (scene->obedit && (scene->obedit->lay & v3d->lay) == 0) {
 		int bit;
-		for(bit=0; bit<32; bit++) {
-			if(scene->obedit->lay & (1<<bit)) {
-				v3d->lay |= 1<<bit;
+		for (bit = 0; bit < 32; bit++) {
+			if (scene->obedit->lay & (1 << bit)) {
+				v3d->lay |= 1 << bit;
 				break;
 			}
 		}
@@ -161,59 +163,60 @@ static void view3d_layers_editmode_ensure(Scene *scene, View3D *v3d)
 
 static int view3d_layers_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	ScrArea *sa= CTX_wm_area(C);
-	View3D *v3d= sa->spacedata.first;
-	int nr= RNA_int_get(op->ptr, "nr");
-	int toggle= RNA_boolean_get(op->ptr, "toggle");
+	Scene *scene = CTX_data_scene(C);
+	ScrArea *sa = CTX_wm_area(C);
+	View3D *v3d = sa->spacedata.first;
+	int nr = RNA_int_get(op->ptr, "nr");
+	int toggle = RNA_boolean_get(op->ptr, "toggle");
 	
-	if(nr < 0)
+	if (nr < 0)
 		return OPERATOR_CANCELLED;
 
-	if(nr == 0) {
+	if (nr == 0) {
 		/* all layers */
-		if(!v3d->layact)
-			v3d->layact= 1;
+		if (!v3d->layact)
+			v3d->layact = 1;
 
-		if (toggle && v3d->lay == ((1<<20)-1)) {
+		if (toggle && v3d->lay == ((1 << 20) - 1)) {
 			/* return to active layer only */
 			v3d->lay = v3d->layact;
 
 			view3d_layers_editmode_ensure(scene, v3d);
 		}
 		else {
-			v3d->lay |= (1<<20)-1;
+			v3d->lay |= (1 << 20) - 1;
 		}		
 	}
 	else {
 		int bit;
 		nr--;
 
-		if(RNA_boolean_get(op->ptr, "extend")) {
-			if(toggle && v3d->lay & (1<<nr) && (v3d->lay & ~(1<<nr)))
-				v3d->lay &= ~(1<<nr);
+		if (RNA_boolean_get(op->ptr, "extend")) {
+			if (toggle && v3d->lay & (1 << nr) && (v3d->lay & ~(1 << nr)))
+				v3d->lay &= ~(1 << nr);
 			else
-				v3d->lay |= (1<<nr);
-		} else {
-			v3d->lay = (1<<nr);
+				v3d->lay |= (1 << nr);
+		}
+		else {
+			v3d->lay = (1 << nr);
 		}
 
 		view3d_layers_editmode_ensure(scene, v3d);
 
 		/* set active layer, ensure to always have one */
-		if(v3d->lay & (1<<nr))
-		   v3d->layact= 1<<nr;
-		else if((v3d->lay & v3d->layact)==0) {
-			for(bit=0; bit<32; bit++) {
-				if(v3d->lay & (1<<bit)) {
-					v3d->layact= 1<<bit;
+		if (v3d->lay & (1 << nr))
+			v3d->layact = 1 << nr;
+		else if ((v3d->lay & v3d->layact) == 0) {
+			for (bit = 0; bit < 32; bit++) {
+				if (v3d->lay & (1 << bit)) {
+					v3d->layact = 1 << bit;
 					break;
 				}
 			}
 		}
 	}
 	
-	if(v3d->scenelock) handle_view3d_lock(C);
+	if (v3d->scenelock) handle_view3d_lock(C);
 	
 	DAG_on_visible_update(CTX_data_main(C), FALSE);
 
@@ -226,16 +229,16 @@ static int view3d_layers_exec(bContext *C, wmOperator *op)
 /* the local per-keymap-entry keymap will solve it */
 static int view3d_layers_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	if(event->ctrl || event->oskey)
+	if (event->ctrl || event->oskey)
 		return OPERATOR_PASS_THROUGH;
 	
-	if(event->shift)
+	if (event->shift)
 		RNA_boolean_set(op->ptr, "extend", TRUE);
 	else
 		RNA_boolean_set(op->ptr, "extend", FALSE);
 	
-	if(event->alt) {
-		int nr= RNA_int_get(op->ptr, "nr") + 10;
+	if (event->alt) {
+		int nr = RNA_int_get(op->ptr, "nr") + 10;
 		RNA_int_set(op->ptr, "nr", nr);
 	}
 	view3d_layers_exec(C, op);
@@ -245,23 +248,23 @@ static int view3d_layers_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 static int view3d_layers_poll(bContext *C)
 {
-	return (ED_operator_view3d_active(C) && CTX_wm_view3d(C)->localvd==NULL);
+	return (ED_operator_view3d_active(C) && CTX_wm_view3d(C)->localvd == NULL);
 }
 
 void VIEW3D_OT_layers(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Layers";
-	ot->description= "Toggle layer(s) visibility";
-	ot->idname= "VIEW3D_OT_layers";
+	ot->name = "Layers";
+	ot->description = "Toggle layer(s) visibility";
+	ot->idname = "VIEW3D_OT_layers";
 	
 	/* api callbacks */
-	ot->invoke= view3d_layers_invoke;
-	ot->exec= view3d_layers_exec;
-	ot->poll= view3d_layers_poll;
+	ot->invoke = view3d_layers_invoke;
+	ot->exec = view3d_layers_exec;
+	ot->poll = view3d_layers_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	RNA_def_int(ot->srna, "nr", 1, 0, 20, "Number", "The layer number to set, zero for all layers", 0, 20);
 	RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Add this layer to the current view layers");
@@ -277,29 +280,26 @@ static int modeselect_addmode(char *str, const char *title, int id, int icon)
 
 static char *view3d_modeselect_pup(Scene *scene)
 {
-	Object *ob= OBACT;
+	Object *ob = OBACT;
 	static char string[512];
-	const char *title= IFACE_("Mode: %t");
+	const char *title = IFACE_("Mode: %t");
 	char *str = string;
 
 	BLI_strncpy(str, title, sizeof(string));
 
 	str += modeselect_addmode(str, N_("Object Mode"), OB_MODE_OBJECT, ICON_OBJECT_DATA);
 
-	if(ob==NULL || ob->data==NULL) return string;
-	if(ob->id.lib) return string;
+	if (ob == NULL || ob->data == NULL) return string;
+	if (ob->id.lib) return string;
 
-	if(!((ID *)ob->data)->lib) {
+	if (!((ID *)ob->data)->lib) {
 		/* if active object is editable */
-		if ( ((ob->type == OB_MESH)
-			|| (ob->type == OB_CURVE) || (ob->type == OB_SURF) || (ob->type == OB_FONT)
-			|| (ob->type == OB_MBALL) || (ob->type == OB_LATTICE))) {
-
+		if (ELEM6(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL, OB_LATTICE)) {
 			str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT, ICON_EDITMODE_HLT);
 		}
 		else if (ob->type == OB_ARMATURE) {
 			if (ob->mode & OB_MODE_POSE)
-				str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT|OB_MODE_POSE, ICON_EDITMODE_HLT);
+				str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT | OB_MODE_POSE, ICON_EDITMODE_HLT);
 			else
 				str += modeselect_addmode(str, N_("Edit Mode"), OB_MODE_EDIT, ICON_EDITMODE_HLT);
 		}
@@ -314,13 +314,13 @@ static char *view3d_modeselect_pup(Scene *scene)
 	}
 
 	/* if active object is an armature */
-	if (ob->type==OB_ARMATURE) {
+	if (ob->type == OB_ARMATURE) {
 		str += modeselect_addmode(str, N_("Pose Mode"), OB_MODE_POSE, ICON_POSE_HLT);
 	}
 
-	if ( ob->particlesystem.first ||
-	     modifiers_findByType(ob, eModifierType_Cloth) ||
-	     modifiers_findByType(ob, eModifierType_Softbody))
+	if (ob->particlesystem.first ||
+	    modifiers_findByType(ob, eModifierType_Cloth) ||
+	    modifiers_findByType(ob, eModifierType_Softbody))
 	{
 		str += modeselect_addmode(str, N_("Particle Mode"), OB_MODE_PARTICLE_EDIT, ICON_PARTICLEMODE);
 	}
@@ -331,102 +331,98 @@ static char *view3d_modeselect_pup(Scene *scene)
 
 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;
+	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);
-	EditMesh *em= NULL;
-	int ctrl= win->eventstate->ctrl, shift= win->eventstate->shift;
+	BMEditMesh *em = NULL;
+	int ctrl = win->eventstate->ctrl, shift = win->eventstate->shift;
 	PointerRNA props_ptr;
 	
-	if(obedit && obedit->type==OB_MESH) {
-		em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
+	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) {
-	case B_REDR:
-		ED_area_tag_redraw(sa);
-		break;
-		
-	case B_MODESELECT:
-		WM_operator_properties_create(&props_ptr, "OBJECT_OT_mode_set");
-		RNA_enum_set(&props_ptr, "mode", v3d->modeselect);
-		WM_operator_name_call(C, "OBJECT_OT_mode_set", WM_OP_EXEC_REGION_WIN, &props_ptr);
-		WM_operator_properties_free(&props_ptr);
-		break;		
-		
-	case B_SEL_VERT:
-		if(em) {
-			if(shift==0 || em->selectmode==0)
-				em->selectmode= SCE_SELECT_VERTEX;
-			ts->selectmode= em->selectmode;
-			EM_selectmode_set(em);
-			WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
-			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) EM_convertsel(em, SCE_SELECT_VERTEX,SCE_SELECT_EDGE); 
+	switch (event) {
+		case B_REDR:
+			ED_area_tag_redraw(sa);
+			break;
+
+		case B_MODESELECT:
+			WM_operator_properties_create(&props_ptr, "OBJECT_OT_mode_set");
+			RNA_enum_set(&props_ptr, "mode", v3d->modeselect);
+			WM_operator_name_call(C, "OBJECT_OT_mode_set", WM_OP_EXEC_REGION_WIN, &props_ptr);
+			WM_operator_properties_free(&props_ptr);
+			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);
+				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;
 				}
-				em->selectmode = SCE_SELECT_EDGE;
+				ts->selectmode = em->selectmode;
+				EDBM_selectmode_set(em);
+				WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+				ED_undo_push(C, "Selectmode Set: Edge");
 			}
-			ts->selectmode= em->selectmode;
-			EM_selectmode_set(em);
-			WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
-			ED_undo_push(C, "Selectmode Set: Edge");
-		}
-		break;
-	case B_SEL_FACE:
-		if(em) {
-			if( shift==0 || em->selectmode==0){
-				if( ((em->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_VERTEX) || ((em->selectmode ^ SCE_SELECT_FACE) == SCE_SELECT_EDGE)){
-					if(ctrl)
-						EM_convertsel(em, (em->selectmode ^ SCE_SELECT_FACE),SCE_SELECT_FACE);
+			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;
 				}
-				em->selectmode = SCE_SELECT_FACE;
+				ts->selectmode = em->selectmode;
+				EDBM_selectmode_set(em);
+				WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+				ED_undo_push(C, "Selectmode Set: Face");
 			}
-			ts->selectmode= em->selectmode;
-			EM_selectmode_set(em);
-			WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
-			ED_undo_push(C, "Selectmode Set: Face");
-		}
-		break;	
+			break;
 
-	case B_MAN_TRANS:
-		if( shift==0 || v3d->twtype==0) {
-			v3d->twtype= V3D_MANIP_TRANSLATE;
-		}
-		ED_area_tag_redraw(sa);
-		break;
-	case B_MAN_ROT:
-		if( shift==0 || v3d->twtype==0) {
-			v3d->twtype= V3D_MANIP_ROTATE;
-		}
-		ED_area_tag_redraw(sa);
-		break;
-	case B_MAN_SCALE:
-		if( shift==0 || v3d->twtype==0) {
-			v3d->twtype= V3D_MANIP_SCALE;
-		}
-		ED_area_tag_redraw(sa);
-		break;
-	case B_NDOF:
-		ED_area_tag_redraw(sa);
-		break;
-	case B_MAN_MODE:
-		ED_area_tag_redraw(sa);
-		break;
-	default:
-		break;
+		case B_MAN_TRANS:
+			if (shift == 0 || v3d->twtype == 0) {
+				v3d->twtype = V3D_MANIP_TRANSLATE;
+			}
+			ED_area_tag_redraw(sa);
+			break;
+		case B_MAN_ROT:
+			if (shift == 0 || v3d->twtype == 0) {
+				v3d->twtype = V3D_MANIP_ROTATE;
+			}
+			ED_area_tag_redraw(sa);
+			break;
+		case B_MAN_SCALE:
+			if (shift == 0 || v3d->twtype == 0) {
+				v3d->twtype = V3D_MANIP_SCALE;
+			}
+			ED_area_tag_redraw(sa);
+			break;
+		case B_NDOF:
+			ED_area_tag_redraw(sa);
+			break;
+		case B_MAN_MODE:
+			ED_area_tag_redraw(sa);
+			break;
+		default:
+			break;
 	}
-
-	if(obedit && obedit->type==OB_MESH)
-		BKE_mesh_end_editmesh(obedit->data, em);
 }
 
 /* Returns the icon associated with an object mode */
@@ -434,8 +430,8 @@ static int object_mode_icon(int mode)
 {
 	EnumPropertyItem *item = object_mode_items;
 	
-	while(item->name != NULL) {
-		if(item->value == mode)
+	while (item->name != NULL) {
+		if (item->value == mode)
 			return item->icon;
 		++item;
 	}
@@ -446,102 +442,104 @@ static int object_mode_icon(int mode)
 void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C)
 {
 	Object *obedit = CTX_data_edit_object(C);
-	uiBlock *block= uiLayoutGetBlock(layout);
+	uiBlock *block = uiLayoutGetBlock(layout);
 
 	uiBlockSetHandleFunc(block, do_view3d_header_buttons, NULL);
 
-	if(obedit && (obedit->type == OB_MESH)) {
-		EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
+	if (obedit && (obedit->type == OB_MESH)) {
+		BMEditMesh *em = BMEdit_FromObject(obedit);
 		uiLayout *row;
 
-		row= uiLayoutRow(layout, 1);
-		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 mode");
-		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 mode");
-		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 mode");
-
-		BKE_mesh_end_editmesh(obedit->data, em);
+		row = uiLayoutRow(layout, 1);
+		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");
 	}
 }
 
 void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
 {
-	bScreen *screen= CTX_wm_screen(C);
-	ScrArea *sa= CTX_wm_area(C);
-	View3D *v3d= sa->spacedata.first;
-	Scene *scene= CTX_data_scene(C);
-	ToolSettings *ts= CTX_data_tool_settings(C);
+	bScreen *screen = CTX_wm_screen(C);
+	ScrArea *sa = CTX_wm_area(C);
+	View3D *v3d = sa->spacedata.first;
+	Scene *scene = CTX_data_scene(C);
+	ToolSettings *ts = CTX_data_tool_settings(C);
 	PointerRNA v3dptr, toolsptr, sceneptr;
-	Object *ob= OBACT;
+	Object *ob = OBACT;
 	Object *obedit = CTX_data_edit_object(C);
 	uiBlock *block;
 	uiBut *but;
 	uiLayout *row;
-	const float dpi_fac= UI_DPI_FAC;
+	const float dpi_fac = UI_DPI_FAC;
+	int is_paint = 0;
 	
 	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);
 
-	block= uiLayoutGetBlock(layout);
+	block = uiLayoutGetBlock(layout);
 	uiBlockSetHandleFunc(block, do_view3d_header_buttons, NULL);
 
 	/* other buttons: */
 	uiBlockSetEmboss(block, UI_EMBOSS);
 	
 	/* mode */
-	if(ob) {
+	if (ob) {
 		v3d->modeselect = ob->mode;
+		is_paint = ELEM4(ob->mode, OB_MODE_SCULPT, OB_MODE_VERTEX_PAINT, OB_MODE_WEIGHT_PAINT, OB_MODE_TEXTURE_PAINT);
 	}
 	else {
 		v3d->modeselect = OB_MODE_OBJECT;
 	}
 
-	row= uiLayoutRow(layout, 1);
-	uiDefIconTextButS(block, MENU, B_MODESELECT, object_mode_icon(v3d->modeselect), view3d_modeselect_pup(scene) , 
-			  0,0,126 * dpi_fac, UI_UNIT_Y, &(v3d->modeselect), 0, 0, 0, 0, TIP_("Mode"));
+	row = uiLayoutRow(layout, 1);
+	uiDefIconTextButS(block, MENU, B_MODESELECT, object_mode_icon(v3d->modeselect), view3d_modeselect_pup(scene),
+	                  0, 0, 126 * dpi_fac, UI_UNIT_Y, &(v3d->modeselect), 0, 0, 0, 0, TIP_("Mode"));
 	
 	/* Draw type */
 	uiItemR(layout, &v3dptr, "viewport_shade", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
 
-	if (obedit==NULL && ((ob && ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)))) {
-		/* Manipulators aren't used in weight paint mode */
-		
-		PointerRNA meshptr;
+	if (obedit == NULL && is_paint) {
+		/* Manipulators aren't used in paint modes */
+		if (!ELEM(ob->mode, OB_MODE_SCULPT, OB_MODE_PARTICLE_EDIT)) {
+			/* masks aren't used for sculpt and particle painting */
+			PointerRNA meshptr;
 
-		RNA_pointer_create(&ob->id, &RNA_Mesh, ob->data, &meshptr);
-		if(ob->mode & (OB_MODE_TEXTURE_PAINT|OB_MODE_VERTEX_PAINT)) {
-			uiItemR(layout, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
-		}
-		else {
-			
-			row= uiLayoutRow(layout, 1);
-			uiItemR(row, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
-			uiItemR(row, &meshptr, "use_paint_mask_vertex", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
+			RNA_pointer_create(&ob->id, &RNA_Mesh, ob->data, &meshptr);
+			if (ob->mode & (OB_MODE_TEXTURE_PAINT | OB_MODE_VERTEX_PAINT)) {
+				uiItemR(layout, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
+			}
+			else {
+				row = uiLayoutRow(layout, 1);
+				uiItemR(row, &meshptr, "use_paint_mask", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
+				uiItemR(row, &meshptr, "use_paint_mask_vertex", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
+			}
 		}
-	} else {
+	}
+	else {
 		const char *str_menu;
 
-		row= uiLayoutRow(layout, 1);
+		row = uiLayoutRow(layout, 1);
 		uiItemR(row, &v3dptr, "pivot_point", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
 
 		/* pose/object only however we want to allow in weight paint mode too
-		 * so dont be totally strict and just check not-editmode for now */
+		 * so don't be totally strict and just check not-editmode for now */
 		if (obedit == NULL) {
 			uiItemR(row, &v3dptr, "use_pivot_point_align", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
 		}
 
 		/* Transform widget / manipulators */
-		row= uiLayoutRow(layout, 1);
+		row = uiLayoutRow(layout, 1);
 		uiItemR(row, &v3dptr, "show_manipulator", UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
-		block= uiLayoutGetBlock(row);
+		block = uiLayoutGetBlock(row);
 		
-		if(v3d->twflag & V3D_USE_MANIPULATOR) {
-			but= uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Translate manipulator mode"));
+		if (v3d->twflag & V3D_USE_MANIPULATOR) {
+			but = uiDefIconButBitC(block, TOG, V3D_MANIP_TRANSLATE, B_MAN_TRANS, ICON_MAN_TRANS, 0, 0, UI_UNIT_X, UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Translate manipulator - Shift-Click for multiple modes"));
 			uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
-			but= uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Rotate manipulator mode"));
+			but = uiDefIconButBitC(block, TOG, V3D_MANIP_ROTATE, B_MAN_ROT, ICON_MAN_ROT, 0, 0, UI_UNIT_X, UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Rotate manipulator - Shift-Click for multiple modes"));
 			uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
-			but= uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0,0,UI_UNIT_X,UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Scale manipulator mode"));
+			but = uiDefIconButBitC(block, TOG, V3D_MANIP_SCALE, B_MAN_SCALE, ICON_MAN_SCALE, 0, 0, UI_UNIT_X, UI_UNIT_Y, &v3d->twtype, 1.0, 0.0, 0, 0, TIP_("Scale manipulator - Shift-Click for multiple modes"));
 			uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
 		}
 			
@@ -550,12 +548,12 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C)
 		}
 			
 		str_menu = BIF_menustringTransformOrientation(C, "Orientation");
-		but= uiDefButC(block, MENU, B_MAN_MODE, str_menu,0,0,70 * dpi_fac, UI_UNIT_Y, &v3d->twmode, 0, 0, 0, 0, TIP_("Transform Orientation"));
+		but = uiDefButC(block, MENU, B_MAN_MODE, str_menu, 0, 0, 70 * dpi_fac, UI_UNIT_Y, &v3d->twmode, 0, 0, 0, 0, TIP_("Transform Orientation"));
 		uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
 		MEM_freeN((void *)str_menu);
 	}
 
-	if(obedit==NULL && v3d->localvd==NULL) {
+	if (obedit == NULL && v3d->localvd == NULL) {
 		unsigned int ob_lay = ob ? ob->lay : 0;
 
 		/* Layers */
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 07754c0..168775d 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -28,28 +28,27 @@
  *  \ingroup spview3d
  */
 
-#ifndef ED_VIEW3D_INTERN_H
-#define ED_VIEW3D_INTERN_H
+#ifndef __VIEW3D_INTERN_H__
+#define __VIEW3D_INTERN_H__
 
 #include "ED_view3d.h"
 
 /* internal exports only */
 
-struct bScreen;
 struct ARegion;
+struct ARegionType;
 struct BoundBox;
-struct Object;
 struct DerivedMesh;
-struct wmOperatorType;
-struct bContext;
-struct wmWindowManager;
-struct EditMesh;
+struct Object;
 struct ViewContext;
-struct ARegionType;
-struct bPoseChannel;
 struct bAnimVizSettings;
+struct bContext;
 struct bMotionPath;
+struct bPoseChannel;
+struct bScreen;
 struct wmNDOFMotionData;
+struct wmOperatorType;
+struct wmWindowManager;
 
 #define BL_NEAR_CLIP 0.001
 
@@ -63,7 +62,6 @@ struct wmNDOFMotionData;
 #define DRAW_FACE_SELECT 2
 
 /* view3d_header.c */
-void view3d_header_buttons(const struct bContext *C, struct ARegion *ar);
 void VIEW3D_OT_layers(struct wmOperatorType *ot);
 
 /* view3d_ops.c */
@@ -93,7 +91,6 @@ 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_zoom_border(struct wmOperatorType *ot);
-void VIEW3D_OT_drawtype(struct wmOperatorType *ot);
 
 void view3d_boxview_copy(ScrArea *sa, ARegion *ar);
 void ndof_to_quat(struct wmNDOFMotionData* ndof, float q[4]);
@@ -126,6 +123,7 @@ void view3d_cached_text_draw_end(View3D *v3d, ARegion *ar, int depth_write, floa
 #define V3D_CACHE_TEXT_WORLDSPACE	(1<<1)
 #define V3D_CACHE_TEXT_ASCII		(1<<2)
 #define V3D_CACHE_TEXT_GLOBALSPACE	(1<<3)
+#define V3D_CACHE_TEXT_LOCALCLIP	(1<<4)
 
 /* drawarmature.c */
 int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, int flag, const short is_outline);
@@ -137,8 +135,6 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, struct Ob
 void view3d_main_area_draw(const struct bContext *C, struct ARegion *ar);
 void draw_depth(Scene *scene, struct ARegion *ar, View3D *v3d, int (* func)(void *));
 void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d);
-void view3d_clr_clipping(void);
-void view3d_set_clipping(RegionView3D *rv3d);
 void add_view3d_after(ListBase *lb, Base *base, int flag);
 
 void circf(float x, float y, float rad);
@@ -148,7 +144,6 @@ float view3d_depth_near(struct ViewDepths *d);
 
 /* view3d_select.c */
 void VIEW3D_OT_select(struct wmOperatorType *ot);
-void VIEW3D_OT_select_extend(struct wmOperatorType *ot);
 void VIEW3D_OT_select_circle(struct wmOperatorType *ot);
 void VIEW3D_OT_select_border(struct wmOperatorType *ot);
 void VIEW3D_OT_select_lasso(struct wmOperatorType *ot);
@@ -204,7 +199,7 @@ extern const char *view3d_context_dir[]; /* doc access */
 /* draw_volume.c */
 void draw_volume(struct ARegion *ar, struct GPUTexture *tex, float *min, float *max, int res[3], float dx, struct GPUTexture *tex_shadow);
 
-/* workaround for trivial but noticable camera bug caused by imprecision
+/* workaround for trivial but noticeable camera bug caused by imprecision
  * between view border calculation in 2D/3D space, workaround for bug [#28037].
  * without this deifne we get the old behavior which is to try and align them
  * both which _mostly_ works fine, but when the camera moves beyond ~1000 in
@@ -215,5 +210,5 @@ extern float view3d_camera_border_hack_col[4];
 extern short view3d_camera_border_hack_test;
 #endif
 
-#endif /* ED_VIEW3D_INTERN_H */
+#endif /* __VIEW3D_INTERN_H__ */
 
diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c
index 759f3ed..99da487 100644
--- a/source/blender/editors/space_view3d/view3d_ops.c
+++ b/source/blender/editors/space_view3d/view3d_ops.c
@@ -112,13 +112,13 @@ void view3d_keymap(wmKeyConfig *keyconf)
 	wmKeyMap *keymap;
 	wmKeyMapItem *kmi;
 	
-	keymap= WM_keymap_find(keyconf, "3D View Generic", SPACE_VIEW3D, 0);
+	keymap = WM_keymap_find(keyconf, "3D View Generic", SPACE_VIEW3D, 0);
 	
 	WM_keymap_add_item(keymap, "VIEW3D_OT_properties", NKEY, KM_PRESS, 0, 0);
 	WM_keymap_add_item(keymap, "VIEW3D_OT_toolshelf", TKEY, KM_PRESS, 0, 0);
 	
 	/* only for region 3D window */
-	keymap= WM_keymap_find(keyconf, "3D View", SPACE_VIEW3D, 0);
+	keymap = WM_keymap_find(keyconf, "3D View", SPACE_VIEW3D, 0);
 	
 	kmi = WM_keymap_verify_item(keymap, "VIEW3D_OT_manipulator", LEFTMOUSE, KM_PRESS, KM_ANY, 0);
 	RNA_boolean_set(kmi->ptr, "release_confirm", TRUE);
@@ -132,7 +132,7 @@ void view3d_keymap(wmKeyConfig *keyconf)
 	WM_keymap_verify_item(keymap, "VIEW3D_OT_rotate", MIDDLEMOUSE, KM_PRESS, 0, 0);
 	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_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);
 	
@@ -190,28 +190,28 @@ void view3d_keymap(wmKeyConfig *keyconf)
 	RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", WHEELUPMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "type", V3D_VIEW_PANUP);
 	RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", WHEELDOWNMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "type", V3D_VIEW_PANDOWN);
 
-	RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", WHEELUPMOUSE, KM_PRESS, KM_CTRL|KM_ALT, 0)->ptr, "type", V3D_VIEW_STEPLEFT);
-	RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", WHEELDOWNMOUSE, KM_PRESS, KM_CTRL|KM_ALT, 0)->ptr, "type", V3D_VIEW_STEPRIGHT);
-	RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", WHEELUPMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0)->ptr, "type", V3D_VIEW_STEPUP);
-	RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", WHEELDOWNMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0)->ptr, "type", V3D_VIEW_STEPDOWN);
+	RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", WHEELUPMOUSE, KM_PRESS, KM_CTRL | KM_ALT, 0)->ptr, "type", V3D_VIEW_STEPLEFT);
+	RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", WHEELDOWNMOUSE, KM_PRESS, KM_CTRL | KM_ALT, 0)->ptr, "type", V3D_VIEW_STEPRIGHT);
+	RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", WHEELUPMOUSE, KM_PRESS, KM_SHIFT | KM_ALT, 0)->ptr, "type", V3D_VIEW_STEPUP);
+	RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", WHEELDOWNMOUSE, KM_PRESS, KM_SHIFT | KM_ALT, 0)->ptr, "type", V3D_VIEW_STEPDOWN);
 	
 	/* active aligned, replaces '*' key in 2.4x */
-	kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_SHIFT, 0);
 	RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_FRONT);
 	RNA_boolean_set(kmi->ptr, "align_active", TRUE);
-	kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, KM_SHIFT, 0);
 	RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_RIGHT);
 	RNA_boolean_set(kmi->ptr, "align_active", TRUE);
-	kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_SHIFT, 0);
 	RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_TOP);
 	RNA_boolean_set(kmi->ptr, "align_active", TRUE);
-	kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
 	RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_BACK);
 	RNA_boolean_set(kmi->ptr, "align_active", TRUE);
-	kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
 	RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_LEFT);
 	RNA_boolean_set(kmi->ptr, "align_active", TRUE);
-	kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
 	RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_BOTTOM);
 	RNA_boolean_set(kmi->ptr, "align_active", TRUE);
 	
@@ -227,13 +227,13 @@ void view3d_keymap(wmKeyConfig *keyconf)
 	RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_BOTTOM, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_BOTTOM);
 
 	/* 3D mouse align */
-	kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_FRONT, KM_PRESS, KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_FRONT, KM_PRESS, KM_SHIFT, 0);
 	RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_FRONT);
 	RNA_boolean_set(kmi->ptr, "align_active", TRUE);
-	kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_RIGHT, KM_PRESS, KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_RIGHT, KM_PRESS, KM_SHIFT, 0);
 	RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_RIGHT);
 	RNA_boolean_set(kmi->ptr, "align_active", TRUE);
-	kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_TOP, KM_PRESS, KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", NDOF_BUTTON_TOP, KM_PRESS, KM_SHIFT, 0);
 	RNA_enum_set(kmi->ptr, "type", RV3D_VIEW_TOP);
 	RNA_boolean_set(kmi->ptr, "align_active", TRUE);
 
@@ -275,34 +275,34 @@ void view3d_keymap(wmKeyConfig *keyconf)
 	RNA_boolean_set(kmi->ptr, "center", FALSE);
 	RNA_boolean_set(kmi->ptr, "object", FALSE);
 	RNA_boolean_set(kmi->ptr, "enumerate", FALSE);
-	kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
+	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
 	RNA_boolean_set(kmi->ptr, "extend", FALSE);
 	RNA_boolean_set(kmi->ptr, "center", TRUE);
 	RNA_boolean_set(kmi->ptr, "object", TRUE); /* use Ctrl+Select for 2 purposes */
 	RNA_boolean_set(kmi->ptr, "enumerate", FALSE);
-	kmi= WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
+	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
 	RNA_boolean_set(kmi->ptr, "extend", FALSE);
 	RNA_boolean_set(kmi->ptr, "center", FALSE);
 	RNA_boolean_set(kmi->ptr, "object", FALSE);
 	RNA_boolean_set(kmi->ptr, "enumerate", TRUE);
 
 	/* selection key-combinations */
-	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
 	RNA_boolean_set(kmi->ptr, "extend", TRUE);
 	RNA_boolean_set(kmi->ptr, "center", TRUE);
 	RNA_boolean_set(kmi->ptr, "object", FALSE);
 	RNA_boolean_set(kmi->ptr, "enumerate", FALSE);
-	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL|KM_ALT, 0);
+	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_CTRL | KM_ALT, 0);
 	RNA_boolean_set(kmi->ptr, "extend", FALSE);
 	RNA_boolean_set(kmi->ptr, "center", TRUE);
 	RNA_boolean_set(kmi->ptr, "object", FALSE);
 	RNA_boolean_set(kmi->ptr, "enumerate", TRUE);
-	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0);
+	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_ALT, 0);
 	RNA_boolean_set(kmi->ptr, "extend", TRUE);
 	RNA_boolean_set(kmi->ptr, "center", FALSE);
 	RNA_boolean_set(kmi->ptr, "object", FALSE);
 	RNA_boolean_set(kmi->ptr, "enumerate", TRUE);
-	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL|KM_ALT, 0);
+	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_CTRL | KM_ALT, 0);
 	RNA_boolean_set(kmi->ptr, "extend", TRUE);
 	RNA_boolean_set(kmi->ptr, "center", TRUE);
 	RNA_boolean_set(kmi->ptr, "object", FALSE);
@@ -311,7 +311,7 @@ void view3d_keymap(wmKeyConfig *keyconf)
 	WM_keymap_add_item(keymap, "VIEW3D_OT_select_border", BKEY, KM_PRESS, 0, 0);
 	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_CTRL, 0);
 	RNA_boolean_set(kmi->ptr, "deselect", FALSE);
-	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_SHIFT|KM_CTRL, 0);
+	kmi = WM_keymap_add_item(keymap, "VIEW3D_OT_select_lasso", EVT_TWEAK_A, KM_ANY, KM_SHIFT | KM_CTRL, 0);
 	RNA_boolean_set(kmi->ptr, "deselect", TRUE);
 	WM_keymap_add_item(keymap, "VIEW3D_OT_select_circle", CKEY, KM_PRESS, 0, 0);
 	
@@ -319,7 +319,7 @@ void view3d_keymap(wmKeyConfig *keyconf)
 	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);
 	
-	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_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);
 	
 	WM_keymap_add_menu(keymap, "VIEW3D_MT_snap", SKEY, KM_PRESS, KM_SHIFT, 0);
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index f98149d..ac9c328 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -39,6 +39,7 @@
 #include "DNA_armature_types.h"
 #include "DNA_curve_types.h"
 #include "DNA_meta_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
@@ -48,7 +49,6 @@
 
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
-#include "BLI_editVert.h"
 #include "BLI_rand.h"
 #include "BLI_linklist.h"
 #include "BLI_utildefines.h"
@@ -61,6 +61,7 @@
 #include "BKE_context.h"
 #include "BKE_paint.h"
 #include "BKE_armature.h"
+#include "BKE_tessmesh.h"
 #include "BKE_movieclip.h"
 #include "BKE_object.h"
 #include "BKE_tracking.h"
@@ -87,18 +88,18 @@
 #include "UI_interface.h"
 #include "UI_resources.h"
 
-#include "view3d_intern.h"	// own include
+#include "view3d_intern.h"  // own include
 
 // TODO: should return whether there is valid context to continue
 void view3d_set_viewcontext(bContext *C, ViewContext *vc)
 {
 	memset(vc, 0, sizeof(ViewContext));
-	vc->ar= CTX_wm_region(C);
-	vc->scene= CTX_data_scene(C);
-	vc->v3d= CTX_wm_view3d(C);
-	vc->rv3d= CTX_wm_region_view3d(C);
-	vc->obact= CTX_data_active_object(C);
-	vc->obedit= CTX_data_edit_object(C); 
+	vc->ar = CTX_wm_region(C);
+	vc->scene = CTX_data_scene(C);
+	vc->v3d = CTX_wm_view3d(C);
+	vc->rv3d = CTX_wm_region_view3d(C);
+	vc->obact = CTX_data_active_object(C);
+	vc->obedit = CTX_data_edit_object(C);
 }
 
 int view3d_get_view_aligned_coordinate(ViewContext *vc, float fp[3], const int mval[2], const short do_fallback)
@@ -106,14 +107,14 @@ int view3d_get_view_aligned_coordinate(ViewContext *vc, float fp[3], const int m
 	float dvec[3];
 	int mval_cpy[2];
 
-	mval_cpy[0]= mval[0];
-	mval_cpy[1]= mval[1];
+	mval_cpy[0] = mval[0];
+	mval_cpy[1] = mval[1];
 
 	project_int_noclip(vc->ar, fp, mval_cpy);
 
 	initgrabz(vc->rv3d, fp[0], fp[1], fp[2]);
 
-	if(mval_cpy[0]!=IS_CLIPPED) {
+	if (mval_cpy[0] != IS_CLIPPED) {
 		float mval_f[2];
 		VECSUB2D(mval_f, mval_cpy, mval);
 		ED_view3d_win_to_delta(vc->ar, mval_f, dvec);
@@ -123,7 +124,7 @@ int view3d_get_view_aligned_coordinate(ViewContext *vc, float fp[3], const int m
 	}
 	else {
 		/* fallback to the view center */
-		if(do_fallback) {
+		if (do_fallback) {
 			negate_v3_v3(fp, vc->rv3d->ofs);
 			return view3d_get_view_aligned_coordinate(vc, fp, mval, FALSE);
 		}
@@ -143,14 +144,15 @@ void view3d_get_transformation(const ARegion *ar, RegionView3D *rv3d, Object *ob
 
 	if (ob) {
 		mult_m4_m4m4(cpy, rv3d->viewmat, ob->obmat);
-	} else {
+	}
+	else {
 		copy_m4_m4(cpy, rv3d->viewmat);
 	}
 
-	for(i = 0; i < 4; ++i) {
-		for(j = 0; j < 4; ++j) {
-			mats->projection[i*4+j] = rv3d->winmat[i][j];
-			mats->modelview[i*4+j] = cpy[i][j];
+	for (i = 0; i < 4; ++i) {
+		for (j = 0; j < 4; ++j) {
+			mats->projection[i * 4 + j] = rv3d->winmat[i][j];
+			mats->modelview[i * 4 + j] = cpy[i][j];
 		}
 	}
 
@@ -164,43 +166,49 @@ void view3d_get_transformation(const ARegion *ar, RegionView3D *rv3d, Object *ob
 
 /* local prototypes */
 
-static void EM_backbuf_checkAndSelectVerts(EditMesh *em, int select)
+static void edbm_backbuf_check_and_select_verts(BMEditMesh *em, int select)
 {
-	EditVert *eve;
-	int index= em_wireoffs;
+	BMVert *eve;
+	BMIter iter;
+	int index = bm_wireoffs;
 
-	for(eve= em->verts.first; eve; eve= eve->next, index++) {
-		if(eve->h==0) {
-			if(EM_check_backbuf(index)) {
-				eve->f = select?(eve->f|1):(eve->f&~1);
+	eve = BM_iter_new(&iter, em->bm, BM_VERTS_OF_MESH, NULL);
+	for (; eve; eve = BM_iter_step(&iter), index++) {
+		if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
+			if (EDBM_backbuf_check(index)) {
+				BM_vert_select_set(em->bm, eve, select);
 			}
 		}
 	}
 }
 
-static void EM_backbuf_checkAndSelectEdges(EditMesh *em, int select)
+static void edbm_backbuf_check_and_select_edges(BMEditMesh *em, int select)
 {
-	EditEdge *eed;
-	int index= em_solidoffs;
+	BMEdge *eed;
+	BMIter iter;
+	int index = bm_solidoffs;
 
-	for(eed= em->edges.first; eed; eed= eed->next, index++) {
-		if(eed->h==0) {
-			if(EM_check_backbuf(index)) {
-				EM_select_edge(eed, select);
+	eed = BM_iter_new(&iter, em->bm, BM_EDGES_OF_MESH, NULL);
+	for (; eed; eed = BM_iter_step(&iter), index++) {
+		if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
+			if (EDBM_backbuf_check(index)) {
+				BM_edge_select_set(em->bm, eed, select);
 			}
 		}
 	}
 }
 
-static void EM_backbuf_checkAndSelectFaces(EditMesh *em, int select)
+static void edbm_backbuf_check_and_select_faces(BMEditMesh *em, int select)
 {
-	EditFace *efa;
-	int index= 1;
+	BMFace *efa;
+	BMIter iter;
+	int index = 1;
 
-	for(efa= em->faces.first; efa; efa= efa->next, index++) {
-		if(efa->h==0) {
-			if(EM_check_backbuf(index)) {
-				EM_select_face_fgon(em, efa, select);
+	efa = BM_iter_new(&iter, em->bm, BM_FACES_OF_MESH, NULL);
+	for (; efa; efa = BM_iter_step(&iter), index++) {
+		if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
+			if (EDBM_backbuf_check(index)) {
+				BM_face_select_set(em->bm, efa, select);
 			}
 		}
 	}
@@ -208,31 +216,32 @@ static void EM_backbuf_checkAndSelectFaces(EditMesh *em, int select)
 
 
 /* object mode, EM_ prefix is confusing here, rename? */
-static void EM_backbuf_checkAndSelectVerts_obmode(Mesh *me, int select)
+static void edbm_backbuf_check_and_select_verts_obmode(Mesh *me, int select)
 {
 	MVert *mv = me->mvert;
 	int a;
 
 	if (mv) {
-		for(a=1; a<=me->totvert; a++, mv++) {
-			if(EM_check_backbuf(a)) {
-				if(!(mv->flag & ME_HIDE)) {
-					mv->flag = select?(mv->flag|SELECT):(mv->flag&~SELECT);
+		for (a = 1; a <= me->totvert; a++, mv++) {
+			if (EDBM_backbuf_check(a)) {
+				if (!(mv->flag & ME_HIDE)) {
+					mv->flag = select ? (mv->flag | SELECT) : (mv->flag & ~SELECT);
 				}
 			}
 		}
 	}
 }
 /* object mode, EM_ prefix is confusing here, rename? */
-static void EM_backbuf_checkAndSelectTFaces(Mesh *me, int select)
+
+static void edbm_backbuf_check_and_select_tfaces(Mesh *me, int select)
 {
-	MFace *mface = me->mface;
+	MPoly *mpoly = me->mpoly;
 	int a;
 
-	if (mface) {
-		for(a=1; a<=me->totface; a++, mface++) {
-			if(EM_check_backbuf(a)) {
-				mface->flag = select?(mface->flag|ME_FACE_SEL):(mface->flag&~ME_FACE_SEL);
+	if (mpoly) {
+		for (a = 1; a <= me->totpoly; a++, mpoly++) {
+			if (EDBM_backbuf_check(a)) {
+				mpoly->flag = select ? (mpoly->flag | ME_FACE_SEL) : (mpoly->flag & ~ME_FACE_SEL);
 			}
 		}
 	}
@@ -253,9 +262,9 @@ static int view3d_selectable_data(bContext *C)
 	if (!ED_operator_region_view3d_active(C))
 		return 0;
 
-	if(ob) {
+	if (ob) {
 		if (ob->mode & OB_MODE_EDIT) {
-			if(ob->type == OB_FONT) {
+			if (ob->type == OB_FONT) {
 				return 0;
 			}
 		}
@@ -263,7 +272,7 @@ static int view3d_selectable_data(bContext *C)
 			if (ob->mode & OB_MODE_SCULPT) {
 				return 0;
 			}
-			if ((ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_WEIGHT_PAINT|OB_MODE_TEXTURE_PAINT)) &&
+			if ((ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT)) &&
 			    !paint_facesel_test(ob) && !paint_vertsel_test(ob))
 			{
 				return 0;
@@ -286,22 +295,22 @@ static int edge_inside_rect(rcti *rect, short x1, short y1, short x2, short y2)
 	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, x1, y1, x2, y2)) 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 (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;
 	
 	/* 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 = (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);
 	
-	if(d1<0 && d2<0 && d3<0 && d4<0) return 0;
-	if(d1>0 && d2>0 && d3>0 && d4>0) return 0;
+	if (d1 < 0 && d2 < 0 && d3 < 0 && d4 < 0) return 0;
+	if (d1 > 0 && d2 > 0 && d3 > 0 && d4 > 0) return 0;
 	
 	return 1;
 }
@@ -313,47 +322,47 @@ static int edge_inside_rect(rcti *rect, short x1, short y1, short x2, short y2)
 int lasso_inside(int mcords[][2], short moves, int sx, int sy)
 {
 	/* we do the angle rule, define that all added angles should be about zero or 2*PI */
-	float angletot=0.0, len, dot, ang, cross, fp1[2], fp2[2];
+	float angletot = 0.0, len, dot, ang, cross, fp1[2], fp2[2];
 	int a;
 	int *p1, *p2;
 	
-	if(sx==IS_CLIPPED)
+	if (sx == IS_CLIPPED)
 		return 0;
 	
-	p1= mcords[moves-1];
-	p2= mcords[0];
+	p1 = mcords[moves - 1];
+	p2 = mcords[0];
 	
 	/* first vector */
-	fp1[0]= (float)(p1[0]-sx);
-	fp1[1]= (float)(p1[1]-sy);
-	len= sqrt(fp1[0]*fp1[0] + fp1[1]*fp1[1]);
-	fp1[0]/= len;
-	fp1[1]/= len;
+	fp1[0] = (float)(p1[0] - sx);
+	fp1[1] = (float)(p1[1] - sy);
+	len = sqrt(fp1[0] * fp1[0] + fp1[1] * fp1[1]);
+	fp1[0] /= len;
+	fp1[1] /= len;
 	
-	for(a=0; a<moves; a++) {
+	for (a = 0; a < moves; a++) {
 		/* second vector */
-		fp2[0]= (float)(p2[0]-sx);
-		fp2[1]= (float)(p2[1]-sy);
-		len= sqrt(fp2[0]*fp2[0] + fp2[1]*fp2[1]);
-		fp2[0]/= len;
-		fp2[1]/= len;
+		fp2[0] = (float)(p2[0] - sx);
+		fp2[1] = (float)(p2[1] - sy);
+		len = sqrt(fp2[0] * fp2[0] + fp2[1] * fp2[1]);
+		fp2[0] /= len;
+		fp2[1] /= len;
 		
 		/* dot and angle and cross */
-		dot= fp1[0]*fp2[0] + fp1[1]*fp2[1];
-		ang= fabs(saacos(dot));
+		dot = fp1[0] * fp2[0] + fp1[1] * fp2[1];
+		ang = fabs(saacos(dot));
 
-		cross= (float)((p1[1]-p2[1])*(p1[0]-sx) + (p2[0]-p1[0])*(p1[1]-sy));
+		cross = (float)((p1[1] - p2[1]) * (p1[0] - sx) + (p2[0] - p1[0]) * (p1[1] - sy));
 		
-		if(cross<0.0f) angletot-= ang;
-		else angletot+= ang;
+		if (cross < 0.0f) angletot -= ang;
+		else angletot += ang;
 		
 		/* circulate */
-		fp1[0]= fp2[0]; fp1[1]= fp2[1];
-		p1= p2;
-		p2= mcords[a+1];
+		fp1[0] = fp2[0]; fp1[1] = fp2[1];
+		p1 = p2;
+		p2 = mcords[a + 1];
 	}
 	
-	if( fabs(angletot) > 4.0 ) return 1;
+	if (fabs(angletot) > 4.0) return 1;
 	return 0;
 }
 
@@ -363,21 +372,21 @@ int lasso_inside_edge(int mcords[][2], short moves, int x0, int y0, int x1, int
 	int v1[2], v2[2];
 	int a;
 
-	if(x0==IS_CLIPPED || x1==IS_CLIPPED)
+	if (x0 == IS_CLIPPED || x1 == IS_CLIPPED)
 		return 0;
 	
 	v1[0] = x0, v1[1] = y0;
 	v2[0] = x1, v2[1] = y1;
 
 	/* check points in lasso */
-	if(lasso_inside(mcords, moves, v1[0], v1[1])) return 1;
-	if(lasso_inside(mcords, moves, v2[0], v2[1])) return 1;
+	if (lasso_inside(mcords, moves, v1[0], v1[1])) return 1;
+	if (lasso_inside(mcords, moves, v2[0], v2[1])) return 1;
 	
 	/* no points in lasso, so we have to intersect with lasso edge */
 	
-	if( isect_line_line_v2_int(mcords[0], mcords[moves-1], v1, v2) > 0) return 1;
-	for(a=0; a<moves-1; a++) {
-		if( isect_line_line_v2_int(mcords[a], mcords[a+1], v1, v2) > 0) return 1;
+	if (isect_line_line_v2_int(mcords[0], mcords[moves - 1], v1, v2) > 0) return 1;
+	for (a = 0; a < moves - 1; a++) {
+		if (isect_line_line_v2_int(mcords[a], mcords[a + 1], v1, v2) > 0) return 1;
 	}
 	
 	return 0;
@@ -385,26 +394,26 @@ int lasso_inside_edge(int mcords[][2], short moves, int x0, int y0, int x1, int
 
 
 /* warning; lasso select with backbuffer-check draws in backbuf with persp(PERSP_WIN) 
-   and returns with persp(PERSP_VIEW). After lasso select backbuf is not OK
-*/
+ * and returns with persp(PERSP_VIEW). After lasso select backbuf is not OK
+ */
 static void do_lasso_select_pose(ViewContext *vc, Object *ob, int mcords[][2], short moves, short select)
 {
 	bPoseChannel *pchan;
 	float vec[3];
 	int sco1[2], sco2[2];
-	bArmature *arm= ob->data;
+	bArmature *arm = ob->data;
 	
-	if(ob->type!=OB_ARMATURE || ob->pose==NULL) return;
+	if (ob->type != OB_ARMATURE || ob->pose == NULL) return;
 
-	for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
-		if (PBONE_VISIBLE(arm, pchan->bone) && (pchan->bone->flag & BONE_UNSELECTABLE)==0) {
+	for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+		if (PBONE_VISIBLE(arm, pchan->bone) && (pchan->bone->flag & BONE_UNSELECTABLE) == 0) {
 			mul_v3_m4v3(vec, ob->obmat, pchan->pose_head);
 			project_int(vc->ar, vec, sco1);
 			mul_v3_m4v3(vec, ob->obmat, pchan->pose_tail);
 			project_int(vc->ar, vec, sco2);
 			
-			if(lasso_inside_edge(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1])) {
-				if(select) pchan->bone->flag |= BONE_SELECTED;
+			if (lasso_inside_edge(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1])) {
+				if (select) pchan->bone->flag |= BONE_SELECTED;
 				else pchan->bone->flag &= ~BONE_SELECTED;
 			}
 		}
@@ -415,8 +424,8 @@ static void object_deselect_all_visible(Scene *scene, View3D *v3d)
 {
 	Base *base;
 
-	for(base= scene->base.first; base; base= base->next) {
-		if(BASE_SELECTABLE(v3d, base)) {
+	for (base = scene->base.first; base; base = base->next) {
+		if (BASE_SELECTABLE(v3d, base)) {
 			ED_base_object_select(base, BA_DESELECT);
 		}
 	}
@@ -429,16 +438,16 @@ static void do_lasso_select_objects(ViewContext *vc, int mcords[][2], short move
 	if (extend == 0 && select)
 		object_deselect_all_visible(vc->scene, vc->v3d);
 
-	for(base= vc->scene->base.first; base; base= base->next) {
-		if(BASE_SELECTABLE(vc->v3d, base)) { /* use this to avoid un-needed lasso lookups */
+	for (base = vc->scene->base.first; base; base = base->next) {
+		if (BASE_SELECTABLE(vc->v3d, base)) { /* use this to avoid un-needed lasso lookups */
 			project_short(vc->ar, base->object->obmat[3], &base->sx);
-			if(lasso_inside(mcords, moves, base->sx, base->sy)) {
+			if (lasso_inside(mcords, moves, base->sx, base->sy)) {
 				
-				if(select) ED_base_object_select(base, BA_SELECT);
+				if (select) ED_base_object_select(base, BA_SELECT);
 				else ED_base_object_select(base, BA_DESELECT);
-				base->object->flag= base->flag;
+				base->object->flag = base->flag;
 			}
-			if(base->object->mode & OB_MODE_POSE) {
+			if (base->object->mode & OB_MODE_POSE) {
 				do_lasso_select_pose(vc, base->object, mcords, moves, select);
 			}
 		}
@@ -449,66 +458,67 @@ static void lasso_select_boundbox(rcti *rect, int mcords[][2], short moves)
 {
 	short a;
 	
-	rect->xmin= rect->xmax= mcords[0][0];
-	rect->ymin= rect->ymax= mcords[0][1];
+	rect->xmin = rect->xmax = mcords[0][0];
+	rect->ymin = rect->ymax = mcords[0][1];
 	
-	for(a=1; a<moves; a++) {
-		if(mcords[a][0]<rect->xmin) rect->xmin= mcords[a][0];
-		else if(mcords[a][0]>rect->xmax) rect->xmax= mcords[a][0];
-		if(mcords[a][1]<rect->ymin) rect->ymin= mcords[a][1];
-		else if(mcords[a][1]>rect->ymax) rect->ymax= mcords[a][1];
+	for (a = 1; a < moves; a++) {
+		if (mcords[a][0] < rect->xmin) rect->xmin = mcords[a][0];
+		else if (mcords[a][0] > rect->xmax) rect->xmax = mcords[a][0];
+		if (mcords[a][1] < rect->ymin) rect->ymin = mcords[a][1];
+		else if (mcords[a][1] > rect->ymax) rect->ymax = mcords[a][1];
 	}
 }
 
-static void do_lasso_select_mesh__doSelectVert(void *userData, EditVert *eve, int x, int y, int UNUSED(index))
+static void do_lasso_select_mesh__doSelectVert(void *userData, BMVert *eve, int x, int y, int UNUSED(index))
 {
 	LassoSelectUserData *data = userData;
 
 	if (BLI_in_rcti(data->rect, x, y) && lasso_inside(data->mcords, data->moves, x, y)) {
-		eve->f = data->select?(eve->f|1):(eve->f&~1);
+		BM_vert_select_set(data->vc->em->bm, eve, data->select);
 	}
 }
-static void do_lasso_select_mesh__doSelectEdge(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index)
+static void do_lasso_select_mesh__doSelectEdge(void *userData, BMEdge *eed, int x0, int y0, int x1, int y1, int index)
 {
 	LassoSelectUserData *data = userData;
 
-	if (EM_check_backbuf(em_solidoffs+index)) {
-		if (data->pass==0) {
-			if (	edge_fully_inside_rect(data->rect, x0, y0, x1, y1)  &&
-					lasso_inside(data->mcords, data->moves, x0, y0) &&
-					lasso_inside(data->mcords, data->moves, x1, y1)) {
-				EM_select_edge(eed, data->select);
+	if (EDBM_backbuf_check(bm_solidoffs + index)) {
+		if (data->pass == 0) {
+			if (edge_fully_inside_rect(data->rect, x0, y0, x1, y1)  &&
+			    lasso_inside(data->mcords, data->moves, x0, y0) &&
+			    lasso_inside(data->mcords, data->moves, x1, y1)) {
+				BM_edge_select_set(data->vc->em->bm, eed, data->select);
 				data->done = 1;
 			}
-		} else {
+		}
+		else {
 			if (lasso_inside_edge(data->mcords, data->moves, x0, y0, x1, y1)) {
-				EM_select_edge(eed, data->select);
+				BM_edge_select_set(data->vc->em->bm, eed, data->select);
 			}
 		}
 	}
 }
-static void do_lasso_select_mesh__doSelectFace(void *userData, EditFace *efa, int x, int y, int UNUSED(index))
+static void do_lasso_select_mesh__doSelectFace(void *userData, BMFace *efa, int x, int y, int UNUSED(index))
 {
 	LassoSelectUserData *data = userData;
 
 	if (BLI_in_rcti(data->rect, x, y) && lasso_inside(data->mcords, data->moves, x, y)) {
-		EM_select_face_fgon(data->vc->em, efa, data->select);
+		BM_face_select_set(data->vc->em->bm, efa, data->select);
 	}
 }
 
 static void do_lasso_select_mesh(ViewContext *vc, int mcords[][2], short moves, short extend, short select)
 {
 	LassoSelectUserData data;
-	ToolSettings *ts= vc->scene->toolsettings;
+	ToolSettings *ts = vc->scene->toolsettings;
 	rcti rect;
 	int bbsel;
 	
 	lasso_select_boundbox(&rect, mcords, moves);
 	
 	/* set editmesh */
-	vc->em= ((Mesh *)vc->obedit->data)->edit_mesh;
+	vc->em = BMEdit_FromObject(vc->obedit);
 
-	data.vc= vc;
+	data.vc = vc;
 	data.rect = ▭
 	data.mcords = mcords;
 	data.moves = moves;
@@ -517,46 +527,47 @@ static void do_lasso_select_mesh(ViewContext *vc, int mcords[][2], short moves,
 	data.pass = 0;
 
 	if (extend == 0 && select)
-		EM_deselect_all(vc->em);
+		EDBM_flag_disable_all(vc->em, BM_ELEM_SELECT);
 
-	 /* for non zbuf projections, dont change the GL state */
+	/* for non zbuf projections, don't change the GL state */
 	ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
 
 	glLoadMatrixf(vc->rv3d->viewmat);
-	bbsel= EM_mask_init_backbuf_border(vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
+	bbsel = EDBM_backbuf_border_mask_init(vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
 	
-	if(ts->selectmode & SCE_SELECT_VERTEX) {
+	if (ts->selectmode & SCE_SELECT_VERTEX) {
 		if (bbsel) {
-			EM_backbuf_checkAndSelectVerts(vc->em, select);
+			edbm_backbuf_check_and_select_verts(vc->em, select);
 		}
 		else {
 			mesh_foreachScreenVert(vc, do_lasso_select_mesh__doSelectVert, &data, V3D_CLIP_TEST_RV3D_CLIPPING);
 		}
 	}
-	if(ts->selectmode & SCE_SELECT_EDGE) {
+	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);
 
-		if (data.done==0) {
+		if (data.done == 0) {
 			data.pass = 1;
 			mesh_foreachScreenEdge(vc, do_lasso_select_mesh__doSelectEdge, &data, V3D_CLIP_TEST_OFF);
 		}
 	}
 	
-	if(ts->selectmode & SCE_SELECT_FACE) {
+	if (ts->selectmode & SCE_SELECT_FACE) {
 		if (bbsel) {
-			EM_backbuf_checkAndSelectFaces(vc->em, select);
+			edbm_backbuf_check_and_select_faces(vc->em, select);
 		}
 		else {
 			mesh_foreachScreenFace(vc, do_lasso_select_mesh__doSelectFace, &data);
 		}
 	}
 	
-	EM_free_backbuf();
-	EM_selectmode_flush(vc->em);	
+	EDBM_backbuf_free();
+	EDBM_selectmode_flush(vc->em);
 }
 
+/* BMESH_TODO */
 #if 0
 /* this is an exception in that its the only lasso that dosnt use the 3d view (uses space image view) */
 static void do_lasso_select_mesh_uv(int mcords[][2], short moves, short select)
@@ -571,7 +582,7 @@ static void do_lasso_select_mesh_uv(int mcords[][2], short moves, short select)
 	if (draw_uvs_face_check()) { /* Face Center Sel */
 		float cent[2];
 		ok = 0;
-		for (efa= em->faces.first; efa; efa= efa->next) {
+		for (efa = em->faces.first; efa; efa = efa->next) {
 			/* assume not touched */
 			efa->tmp.l = 0;
 			tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
@@ -587,18 +598,20 @@ static void do_lasso_select_mesh_uv(int mcords[][2], short moves, short select)
 		if (ok)
 			uvface_setsel__internal(select);
 		
-	} else { /* Vert Sel*/
-		for (efa= em->faces.first; efa; efa= efa->next) {
+	}
+	else { /* Vert Sel*/
+		for (efa = em->faces.first; efa; efa = efa->next) {
 			tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-			if (uvedit_face_visible(scene, ima, efa, tf)) {		
-				nverts= efa->v4? 4: 3;
-				for(i=0; i<nverts; i++) {
+			if (uvedit_face_visible_test(scene, ima, efa, tf)) {		
+				nverts = efa->v4 ? 4 : 3;
+				for (i = 0; i < nverts; i++) {
 					if ((select) != (simaUVSel_Check(efa, tf, i))) {
 						uvco_to_areaco_noclip(tf->uv[i], screenUV);
 						if (BLI_in_rcti(&rect, screenUV[0], screenUV[1]) && lasso_inside(mcords, moves, screenUV[0], screenUV[1])) {
 							if (select) {
 								simaUVSel_Set(efa, tf, i);
-							} else {
+							}
+							else {
 								simaUVSel_UnSet(efa, tf, i);
 							}
 						}
@@ -609,7 +622,7 @@ static void do_lasso_select_mesh_uv(int mcords[][2], short moves, short select)
 	}
 	if (ok && G.sima->flag & SI_SYNC_UVSEL) {
 		if (select) EM_select_flush(vc->em);
-		else		EM_deselect_flush(vc->em);
+		else EM_deselect_flush(vc->em);
 	}
 }
 #endif
@@ -617,24 +630,28 @@ static void do_lasso_select_mesh_uv(int mcords[][2], short moves, short select)
 static void do_lasso_select_curve__doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
 {
 	LassoSelectUserData *data = userData;
-	Object *obedit= data->vc->obedit;
-	Curve *cu= (Curve*)obedit->data;
+	Object *obedit = data->vc->obedit;
+	Curve *cu = (Curve *)obedit->data;
 
 	if (lasso_inside(data->mcords, data->moves, x, y)) {
 		if (bp) {
-			bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT);
+			bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
 			if (bp == cu->lastsel && !(bp->f1 & 1)) cu->lastsel = NULL;
-		} else {
+		}
+		else {
 			if (cu->drawflag & CU_HIDE_HANDLES) {
 				/* can only be beztindex==0 here since handles are hidden */
-				bezt->f1 = bezt->f2 = bezt->f3 = data->select?(bezt->f2|SELECT):(bezt->f2&~SELECT);
-			} else {
-				if (beztindex==0) {
-					bezt->f1 = data->select?(bezt->f1|SELECT):(bezt->f1&~SELECT);
-				} else if (beztindex==1) {
-					bezt->f2 = data->select?(bezt->f2|SELECT):(bezt->f2&~SELECT);
-				} else {
-					bezt->f3 = data->select?(bezt->f3|SELECT):(bezt->f3&~SELECT);
+				bezt->f1 = bezt->f2 = bezt->f3 = data->select ? (bezt->f2 | SELECT) : (bezt->f2 & ~SELECT);
+			}
+			else {
+				if (beztindex == 0) {
+					bezt->f1 = data->select ? (bezt->f1 | SELECT) : (bezt->f1 & ~SELECT);
+				}
+				else if (beztindex == 1) {
+					bezt->f2 = data->select ? (bezt->f2 | SELECT) : (bezt->f2 & ~SELECT);
+				}
+				else {
+					bezt->f3 = data->select ? (bezt->f3 | SELECT) : (bezt->f3 & ~SELECT);
 				}
 			}
 
@@ -665,7 +682,7 @@ static void do_lasso_select_lattice__doSelect(void *userData, BPoint *bp, int x,
 	LassoSelectUserData *data = userData;
 
 	if (lasso_inside(data->mcords, data->moves, x, y)) {
-		bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT);
+		bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
 	}
 }
 static void do_lasso_select_lattice(ViewContext *vc, int mcords[][2], short moves, short extend, short select)
@@ -686,50 +703,50 @@ static void do_lasso_select_lattice(ViewContext *vc, int mcords[][2], short move
 
 static void do_lasso_select_armature(ViewContext *vc, int mcords[][2], short moves, short extend, short select)
 {
-	bArmature *arm= vc->obedit->data;
+	bArmature *arm = vc->obedit->data;
 	EditBone *ebone;
 	float vec[3];
 	short sco1[2], sco2[2], didpoint;
-	int change= FALSE;
+	int change = FALSE;
 
-	if (extend==0 && select)
+	if (extend == 0 && select)
 		ED_armature_deselect_all_visible(vc->obedit);
 
 	/* set editdata in vc */
 	
-	for (ebone= arm->edbo->first; ebone; ebone=ebone->next) {
-		if (EBONE_VISIBLE(arm, ebone) && (ebone->flag & BONE_UNSELECTABLE)==0) {
+	for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
+		if (EBONE_VISIBLE(arm, ebone) && (ebone->flag & BONE_UNSELECTABLE) == 0) {
 			mul_v3_m4v3(vec, vc->obedit->obmat, ebone->head);
 			project_short(vc->ar, vec, sco1);
 			mul_v3_m4v3(vec, vc->obedit->obmat, ebone->tail);
 			project_short(vc->ar, vec, sco2);
 			
-			didpoint= 0;
-			if(lasso_inside(mcords, moves, sco1[0], sco1[1])) {
-				if(select) ebone->flag |= BONE_ROOTSEL;
+			didpoint = 0;
+			if (lasso_inside(mcords, moves, sco1[0], sco1[1])) {
+				if (select) ebone->flag |= BONE_ROOTSEL;
 				else ebone->flag &= ~BONE_ROOTSEL;
-				didpoint= 1;
-				change= TRUE;
+				didpoint = 1;
+				change = TRUE;
 			}
-			if(lasso_inside(mcords, moves, sco2[0], sco2[1])) {
-				if(select) ebone->flag |= BONE_TIPSEL;
+			if (lasso_inside(mcords, moves, sco2[0], sco2[1])) {
+				if (select) ebone->flag |= BONE_TIPSEL;
 				else ebone->flag &= ~BONE_TIPSEL;
-				didpoint= 1;
-				change= TRUE;
+				didpoint = 1;
+				change = TRUE;
 			}
 			/* if one of points selected, we skip the bone itself */
-			if(didpoint==0 && lasso_inside_edge(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1])) {
-				if(select) ebone->flag |= BONE_TIPSEL|BONE_ROOTSEL|BONE_SELECTED;
-				else ebone->flag &= ~(BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
-				change= TRUE;
+			if (didpoint == 0 && lasso_inside_edge(mcords, moves, sco1[0], sco1[1], sco2[0], sco2[1])) {
+				if (select) ebone->flag |= BONE_TIPSEL | BONE_ROOTSEL | BONE_SELECTED;
+				else ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
+				change = TRUE;
 			}
 		}
 	}
 	
-	if(change) {
+	if (change) {
 		ED_armature_sync_selection(arm->edbo);
 		ED_armature_validate_active(arm);
-		WM_main_add_notifier(NC_OBJECT|ND_BONE_SELECT, vc->obedit);
+		WM_main_add_notifier(NC_OBJECT | ND_BONE_SELECT, vc->obedit);
 	}
 }
 
@@ -738,25 +755,25 @@ static void do_lasso_select_armature(ViewContext *vc, int mcords[][2], short mov
 
 static void do_lasso_select_meta(ViewContext *vc, int mcords[][2], short moves, short extend, short select)
 {
-	MetaBall *mb = (MetaBall*)vc->obedit->data;
+	MetaBall *mb = (MetaBall *)vc->obedit->data;
 	MetaElem *ml;
 	float vec[3];
 	short sco[2];
 
 	if (extend == 0 && select) {
-		for(ml= mb->editelems->first; ml; ml= ml->next) {
+		for (ml = mb->editelems->first; ml; ml = ml->next) {
 			ml->flag &= ~SELECT;
 		}
 	}
 
-	for(ml= mb->editelems->first; ml; ml= ml->next) {
+	for (ml = mb->editelems->first; ml; ml = ml->next) {
 		
 		mul_v3_m4v3(vec, vc->obedit->obmat, &ml->x);
 		project_short(vc->ar, vec, sco);
 
-		if(lasso_inside(mcords, moves, sco[0], sco[1])) {
-			if(select)	ml->flag |= SELECT;
-			else		ml->flag &= ~SELECT;
+		if (lasso_inside(mcords, moves, sco[0], sco[1])) {
+			if (select) ml->flag |= SELECT;
+			else ml->flag &= ~SELECT;
 		}
 	}
 }
@@ -769,42 +786,41 @@ int do_paintvert_box_select(ViewContext *vc, rcti *rect, int select, int extend)
 	unsigned int *rt;
 	int a, index;
 	char *selar;
-	int sx= rect->xmax-rect->xmin+1;
-	int sy= rect->ymax-rect->ymin+1;
+	int sx = rect->xmax - rect->xmin + 1;
+	int sy = rect->ymax - rect->ymin + 1;
 
-	me= vc->obact->data;
+	me = vc->obact->data;
 
-	if(me==NULL || me->totvert==0 || sx*sy <= 0)
+	if (me == NULL || me->totvert == 0 || sx * sy <= 0)
 		return OPERATOR_CANCELLED;
 
-	selar= MEM_callocN(me->totvert+1, "selar");
+	selar = MEM_callocN(me->totvert + 1, "selar");
 
 	if (extend == 0 && select)
 		paintvert_deselect_all_visible(vc->obact, SEL_DESELECT, FALSE);
 
 	view3d_validate_backbuf(vc);
 
-	ibuf = IMB_allocImBuf(sx,sy,32,IB_rect);
+	ibuf = IMB_allocImBuf(sx, sy, 32, IB_rect);
 	rt = ibuf->rect;
-	glReadPixels(rect->xmin+vc->ar->winrct.xmin,  rect->ymin+vc->ar->winrct.ymin, sx, sy, GL_RGBA, GL_UNSIGNED_BYTE,  ibuf->rect);
-	if(ENDIAN_ORDER==B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf);
+	glReadPixels(rect->xmin + vc->ar->winrct.xmin,  rect->ymin + vc->ar->winrct.ymin, sx, sy, GL_RGBA, GL_UNSIGNED_BYTE,  ibuf->rect);
+	if (ENDIAN_ORDER == B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf);
 
-	a= sx*sy;
-	while(a--) {
-		if(*rt) {
-			index= WM_framebuffer_to_index(*rt);
-			if(index<=me->totvert) selar[index]= 1;
+	a = sx * sy;
+	while (a--) {
+		if (*rt) {
+			index = WM_framebuffer_to_index(*rt);
+			if (index <= me->totvert) selar[index] = 1;
 		}
 		rt++;
 	}
 
-	mvert= me->mvert;
-	for(a=1; a<=me->totvert; a++, mvert++) {
-		if(selar[a]) {
-			if(mvert->flag & ME_HIDE);
-			else {
-				if(select) mvert->flag |= SELECT;
-				else mvert->flag &= ~SELECT;
+	mvert = me->mvert;
+	for (a = 1; a <= me->totvert; a++, mvert++) {
+		if (selar[a]) {
+			if ((mvert->flag & ME_HIDE) == 0) {
+				if (select) mvert->flag |=  SELECT;
+				else        mvert->flag &= ~SELECT;
 			}
 		}
 	}
@@ -823,46 +839,46 @@ int do_paintvert_box_select(ViewContext *vc, rcti *rect, int select, int extend)
 
 static void do_lasso_select_paintvert(ViewContext *vc, int mcords[][2], short moves, short extend, short select)
 {
-	Object *ob= vc->obact;
-	Mesh *me= ob?ob->data:NULL;
+	Object *ob = vc->obact;
+	Mesh *me = ob ? ob->data : NULL;
 	rcti rect;
 
-	if(me==NULL || me->totvert==0)
+	if (me == NULL || me->totvert == 0)
 		return;
 
-	if(extend==0 && select)
-		paintvert_deselect_all_visible(ob, SEL_DESELECT, FALSE); /* flush selection at the end */
-	em_vertoffs= me->totvert+1;	/* max index array */
+	if (extend == 0 && select)
+		paintvert_deselect_all_visible(ob, SEL_DESELECT, FALSE);  /* flush selection at the end */
+	bm_vertoffs = me->totvert + 1; /* max index array */
 
 	lasso_select_boundbox(&rect, mcords, moves);
-	EM_mask_init_backbuf_border(vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
+	EDBM_backbuf_border_mask_init(vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
 
-	EM_backbuf_checkAndSelectVerts_obmode(me, select);
+	edbm_backbuf_check_and_select_verts_obmode(me, select);
 
-	EM_free_backbuf();
+	EDBM_backbuf_free();
 
 	paintvert_flush_flags(ob);
 }
 static void do_lasso_select_paintface(ViewContext *vc, int mcords[][2], short moves, short extend, short select)
 {
-	Object *ob= vc->obact;
-	Mesh *me= ob?ob->data:NULL;
+	Object *ob = vc->obact;
+	Mesh *me = ob ? ob->data : NULL;
 	rcti rect;
 
-	if(me==NULL || me->totface==0)
+	if (me == NULL || me->totpoly == 0)
 		return;
 
-	if(extend==0 && select)
-		paintface_deselect_all_visible(ob, SEL_DESELECT, FALSE); /* flush selection at the end */
+	if (extend == 0 && select)
+		paintface_deselect_all_visible(ob, SEL_DESELECT, FALSE);  /* flush selection at the end */
 
-	em_vertoffs= me->totface+1;	/* max index array */
+	bm_vertoffs = me->totpoly + 1; /* max index array */
 
 	lasso_select_boundbox(&rect, mcords, moves);
-	EM_mask_init_backbuf_border(vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
+	EDBM_backbuf_border_mask_init(vc, mcords, moves, rect.xmin, rect.ymin, rect.xmax, rect.ymax);
 	
-	EM_backbuf_checkAndSelectTFaces(me, select);
+	edbm_backbuf_check_and_select_tfaces(me, select);
 
-	EM_free_backbuf();
+	EDBM_backbuf_free();
 
 	paintface_flush_flags(ob);
 }
@@ -880,16 +896,17 @@ static void do_lasso_select_node(int mcords[][2], short moves, short select)
 	lasso_select_boundbox(&rect, mcords, moves);
 	
 	/* store selection in temp test flag */
-	for(node= snode->edittree->nodes.first; node; node= node->next) {
+	for (node = snode->edittree->nodes.first; node; node = node->next) {
 		
-		node_centf[0] = (node->totr.xmin+node->totr.xmax)/2;
-		node_centf[1] = (node->totr.ymin+node->totr.ymax)/2;
+		node_centf[0] = (node->totr.xmin + node->totr.xmax) / 2;
+		node_centf[1] = (node->totr.ymin + node->totr.ymax) / 2;
 		
 		ipoco_to_areaco_noclip(G.v2d, node_centf, node_cent);
 		if (BLI_in_rcti(&rect, node_cent[0], node_cent[1]) && lasso_inside(mcords, moves, node_cent[0], node_cent[1])) {
 			if (select) {
 				node->flag |= SELECT;
-			} else {
+			}
+			else {
 				node->flag &= ~SELECT;
 			}
 		}
@@ -902,75 +919,75 @@ static void view3d_lasso_select(bContext *C, ViewContext *vc, int mcords[][2], s
 {
 	Object *ob = CTX_data_active_object(C);
 
-	if(vc->obedit==NULL) { /* Object Mode */
-		if(paint_facesel_test(ob))
+	if (vc->obedit == NULL) { /* Object Mode */
+		if (paint_facesel_test(ob))
 			do_lasso_select_paintface(vc, mcords, moves, extend, select);
-		else if(paint_vertsel_test(ob))
+		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_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_PARTICLE_EDIT)
 			PE_lasso_select(C, mcords, moves, extend, select);
 		else {
 			do_lasso_select_objects(vc, mcords, moves, extend, select);
-			WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, vc->scene);
+			WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, vc->scene);
 		}
 	}
 	else { /* Edit Mode */
-		switch(vc->obedit->type) {
-		case OB_MESH:
-			do_lasso_select_mesh(vc, mcords, moves, extend, select);
-			break;
-		case OB_CURVE:
-		case OB_SURF:
-			do_lasso_select_curve(vc, mcords, moves, extend, select);
-			break;
-		case OB_LATTICE:
-			do_lasso_select_lattice(vc, mcords, moves, extend, select);
-			break;
-		case OB_ARMATURE:
-			do_lasso_select_armature(vc, mcords, moves, extend, select);
-			break;
-		case OB_MBALL:
-			do_lasso_select_meta(vc, mcords, moves, extend, select);
-			break;
-		default:
-			assert(!"lasso select on incorrect object type");
+		switch (vc->obedit->type) {
+			case OB_MESH:
+				do_lasso_select_mesh(vc, mcords, moves, extend, select);
+				break;
+			case OB_CURVE:
+			case OB_SURF:
+				do_lasso_select_curve(vc, mcords, moves, extend, select);
+				break;
+			case OB_LATTICE:
+				do_lasso_select_lattice(vc, mcords, moves, extend, select);
+				break;
+			case OB_ARMATURE:
+				do_lasso_select_armature(vc, mcords, moves, extend, select);
+				break;
+			case OB_MBALL:
+				do_lasso_select_meta(vc, mcords, moves, extend, select);
+				break;
+			default:
+				assert(!"lasso select on incorrect object type");
 		}
 
-		WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc->obedit->data);
+		WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc->obedit->data);
 	}
 }
 
 
 /* lasso operator gives properties, but since old code works
-   with short array we convert */
+ * with short array we convert */
 static int view3d_lasso_select_exec(bContext *C, wmOperator *op)
 {
 	ViewContext vc;
-	int i= 0;
+	int i = 0;
 	int mcords[1024][2];
 
 	RNA_BEGIN(op->ptr, itemptr, "path") {
 		float loc[2];
 		
 		RNA_float_get_array(&itemptr, "loc", loc);
-		mcords[i][0]= (int)loc[0];
-		mcords[i][1]= (int)loc[1];
+		mcords[i][0] = (int)loc[0];
+		mcords[i][1] = (int)loc[1];
 		i++;
-		if(i>=1024) break;
+		if (i >= 1024) break;
 	}
 	RNA_END;
 	
-	if(i>1) {
+	if (i > 1) {
 		short extend, select;
 		view3d_operator_needs_opengl(C);
 		
 		/* setup view context for argument to callbacks */
 		view3d_set_viewcontext(C, &vc);
 		
-		extend= RNA_boolean_get(op->ptr, "extend");
-		select= !RNA_boolean_get(op->ptr, "deselect");
+		extend = RNA_boolean_get(op->ptr, "extend");
+		select = !RNA_boolean_get(op->ptr, "deselect");
 		view3d_lasso_select(C, &vc, mcords, i, extend, select);
 		
 		return OPERATOR_FINISHED;
@@ -980,18 +997,18 @@ static int view3d_lasso_select_exec(bContext *C, wmOperator *op)
 
 void VIEW3D_OT_select_lasso(wmOperatorType *ot)
 {
-	ot->name= "Lasso Select";
-	ot->description= "Select items using lasso selection";
-	ot->idname= "VIEW3D_OT_select_lasso";
+	ot->name = "Lasso Select";
+	ot->description = "Select items using lasso selection";
+	ot->idname = "VIEW3D_OT_select_lasso";
 	
-	ot->invoke= WM_gesture_lasso_invoke;
-	ot->modal= WM_gesture_lasso_modal;
-	ot->exec= view3d_lasso_select_exec;
-	ot->poll= view3d_selectable_data;
-	ot->cancel= WM_gesture_lasso_cancel;
+	ot->invoke = WM_gesture_lasso_invoke;
+	ot->modal = WM_gesture_lasso_modal;
+	ot->exec = view3d_lasso_select_exec;
+	ot->poll = view3d_selectable_data;
+	ot->cancel = WM_gesture_lasso_cancel;
 	
 	/* flags */
-	ot->flag= OPTYPE_UNDO;
+	ot->flag = OPTYPE_UNDO;
 	
 	RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", "");
 	RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Deselect rather than select items");
@@ -1006,41 +1023,41 @@ void VIEW3D_OT_select_lasso(wmOperatorType *ot)
 static unsigned int samplerect(unsigned int *buf, int size, unsigned int dontdo)
 {
 	Base *base;
-	unsigned int *bufmin,*bufmax;
-	int a,b,rc,tel,len,dirvec[4][2],maxob;
-	unsigned int retval=0;
+	unsigned int *bufmin, *bufmax;
+	int a, b, rc, tel, len, dirvec[4][2], maxob;
+	unsigned int retval = 0;
 	
-	base= LASTBASE;
-	if(base==0) return 0;
-	maxob= base->selcol;
+	base = LASTBASE;
+	if (base == 0) return 0;
+	maxob = base->selcol;
 
-	len= (size-1)/2;
-	rc= 0;
+	len = (size - 1) / 2;
+	rc = 0;
 
-	dirvec[0][0]= 1;
-	dirvec[0][1]= 0;
-	dirvec[1][0]= 0;
-	dirvec[1][1]= -size;
-	dirvec[2][0]= -1;
-	dirvec[2][1]= 0;
-	dirvec[3][0]= 0;
-	dirvec[3][1]= size;
+	dirvec[0][0] = 1;
+	dirvec[0][1] = 0;
+	dirvec[1][0] = 0;
+	dirvec[1][1] = -size;
+	dirvec[2][0] = -1;
+	dirvec[2][1] = 0;
+	dirvec[3][0] = 0;
+	dirvec[3][1] = size;
 
-	bufmin= buf;
-	bufmax= buf+ size*size;
-	buf+= len*size+ len;
+	bufmin = buf;
+	bufmax = buf + size * size;
+	buf += len * size + len;
 
-	for(tel=1;tel<=size;tel++) {
+	for (tel = 1; tel <= size; tel++) {
 
-		for(a=0;a<2;a++) {
-			for(b=0;b<tel;b++) {
+		for (a = 0; a < 2; a++) {
+			for (b = 0; b < tel; b++) {
 
-				if(*buf && *buf<=maxob && *buf!=dontdo) return *buf;
-				if( *buf==dontdo ) retval= dontdo;	/* if only color dontdo is available, still return dontdo */
+				if (*buf && *buf <= maxob && *buf != dontdo) return *buf;
+				if (*buf == dontdo) retval = dontdo;  /* if only color dontdo is available, still return dontdo */
 				
-				buf+= (dirvec[rc][0]+dirvec[rc][1]);
+				buf += (dirvec[rc][0] + dirvec[rc][1]);
 
-				if(buf<bufmin || buf>=bufmax) return retval;
+				if (buf < bufmin || buf >= bufmax) return retval;
 			}
 			rc++;
 			rc &= 3;
@@ -1055,62 +1072,62 @@ static unsigned int samplerect(unsigned int *buf, int size, unsigned int dontdo)
 
 /* The max number of menu items in an object select menu */
 typedef struct SelMenuItemF {
-	char idname[MAX_ID_NAME-2];
+	char idname[MAX_ID_NAME - 2];
 	int icon;
 } SelMenuItemF;
 
-#define SEL_MENU_SIZE	22
+#define SEL_MENU_SIZE   22
 static SelMenuItemF object_mouse_select_menu_data[SEL_MENU_SIZE];
 
 /* special (crappy) operator only for menu select */
 static EnumPropertyItem *object_select_menu_enum_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
 {
-	EnumPropertyItem *item= NULL, item_tmp= {0};
-	int totitem= 0;
-	int i= 0;
+	EnumPropertyItem *item = NULL, item_tmp = {0};
+	int totitem = 0;
+	int i = 0;
 
-	/* dont need context but avoid docgen using this */
+	/* don't need context but avoid docgen using this */
 	if (C == NULL || object_mouse_select_menu_data[i].idname[0] == '\0') {
 		return DummyRNA_NULL_items;
 	}
 
 	for (; i < SEL_MENU_SIZE && object_mouse_select_menu_data[i].idname[0] != '\0'; i++) {
-		item_tmp.name= object_mouse_select_menu_data[i].idname;
-		item_tmp.identifier= object_mouse_select_menu_data[i].idname;
-		item_tmp.value= i;
-		item_tmp.icon= object_mouse_select_menu_data[i].icon;
+		item_tmp.name = object_mouse_select_menu_data[i].idname;
+		item_tmp.identifier = object_mouse_select_menu_data[i].idname;
+		item_tmp.value = i;
+		item_tmp.icon = object_mouse_select_menu_data[i].icon;
 		RNA_enum_item_add(&item, &totitem, &item_tmp);
 	}
 
 	RNA_enum_item_end(&item, &totitem);
-	*free= 1;
+	*free = 1;
 
 	return item;
 }
 
 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");
+	int name_index = RNA_enum_get(op->ptr, "name");
+	short extend = RNA_boolean_get(op->ptr, "extend");
 	short changed = 0;
-	const char *name= object_mouse_select_menu_data[name_index].idname;
+	const char *name = object_mouse_select_menu_data[name_index].idname;
 
-	if(!extend) {
-		CTX_DATA_BEGIN(C, Base*, base, selectable_bases) {
-			if(base->flag & SELECT) {
+	if (!extend) {
+		CTX_DATA_BEGIN(C, Base *, base, selectable_bases) {
+			if (base->flag & SELECT) {
 				ED_base_object_select(base, BA_DESELECT);
-				changed= 1;
+				changed = 1;
 			}
 		}
 		CTX_DATA_END;
 	}
 
-	CTX_DATA_BEGIN(C, Base*, base, selectable_bases) {
+	CTX_DATA_BEGIN(C, Base *, base, selectable_bases) {
 		/* this is a bit dodjy, there should only be ONE object with this name, but library objects can mess this up */
-		if(strcmp(name, base->object->id.name+2)==0) {
+		if (strcmp(name, base->object->id.name + 2) == 0) {
 			ED_base_object_activate(C, base);
 			ED_base_object_select(base, BA_SELECT);
-			changed= 1;
+			changed = 1;
 		}
 	}
 	CTX_DATA_END;
@@ -1119,8 +1136,8 @@ static int object_select_menu_exec(bContext *C, wmOperator *op)
 	memset(object_mouse_select_menu_data, 0, sizeof(object_mouse_select_menu_data));
 
 	/* undo? */
-	if(changed) {
-		WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+	if (changed) {
+		WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
 		return OPERATOR_FINISHED;
 	}
 	else {
@@ -1133,22 +1150,22 @@ void VIEW3D_OT_select_menu(wmOperatorType *ot)
 	PropertyRNA *prop;
 
 	/* identifiers */
-	ot->name= "Select Menu";
+	ot->name = "Select Menu";
 	ot->description = "Menu object selection";
-	ot->idname= "VIEW3D_OT_select_menu";
+	ot->idname = "VIEW3D_OT_select_menu";
 
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= object_select_menu_exec;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = object_select_menu_exec;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* keyingset to use (dynamic enum) */
-	prop= RNA_def_enum(ot->srna, "name", DummyRNA_NULL_items, 0, "Object Name", "");
+	prop = RNA_def_enum(ot->srna, "name", DummyRNA_NULL_items, 0, "Object Name", "");
 	RNA_def_enum_funcs(prop, object_select_menu_enum_itemf);
 	RNA_def_property_flag(prop, PROP_HIDDEN);
-	ot->prop= prop;
+	ot->prop = prop;
 
 	RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first");
 }
@@ -1157,9 +1174,9 @@ static void deselectall_except(Scene *scene, Base *b)   /* deselect all except b
 {
 	Base *base;
 	
-	for(base= FIRSTBASE; base; base= base->next) {
+	for (base = FIRSTBASE; base; base = base->next) {
 		if (base->flag & SELECT) {
-			if(b!=base) {
+			if (b != base) {
 				ED_base_object_select(base, BA_DESELECT);
 			}
 		}
@@ -1170,45 +1187,45 @@ static Base *object_mouse_select_menu(bContext *C, ViewContext *vc, unsigned int
 {
 	short baseCount = 0;
 	short ok;
-	LinkNode *linklist= NULL;
+	LinkNode *linklist = NULL;
 	
-	CTX_DATA_BEGIN(C, Base*, base, selectable_bases) {
-		ok= FALSE;
+	CTX_DATA_BEGIN(C, Base *, base, selectable_bases) {
+		ok = FALSE;
 
 		/* two selection methods, the CTRL select uses max dist of 15 */
-		if(buffer) {
+		if (buffer) {
 			int a;
-			for(a=0; a<hits; a++) {
+			for (a = 0; a < hits; a++) {
 				/* index was converted */
-				if(base->selcol==buffer[ (4 * a) + 3 ])
-					ok= TRUE;
+				if (base->selcol == buffer[(4 * a) + 3])
+					ok = TRUE;
 			}
 		}
 		else {
-			int temp, dist=15;
+			int temp, dist = 15;
 
 			project_short(vc->ar, base->object->obmat[3], &base->sx);
 			
-			temp= abs(base->sx -mval[0]) + abs(base->sy -mval[1]);
-			if(temp < dist)
-				ok= TRUE;
+			temp = abs(base->sx - mval[0]) + abs(base->sy - mval[1]);
+			if (temp < dist)
+				ok = TRUE;
 		}
 
-		if(ok) {
+		if (ok) {
 			baseCount++;
 			BLI_linklist_prepend(&linklist, base);
 
-			if (baseCount==SEL_MENU_SIZE)
+			if (baseCount == SEL_MENU_SIZE)
 				break;
 		}
 	}
 	CTX_DATA_END;
 
-	if(baseCount==0) {
+	if (baseCount == 0) {
 		return NULL;
 	}
-	if(baseCount == 1) {
-		Base *base= (Base *)linklist->link;
+	if (baseCount == 1) {
+		Base *base = (Base *)linklist->link;
 		BLI_linklist_free(linklist, NULL);
 		return base;
 	}
@@ -1219,12 +1236,12 @@ static Base *object_mouse_select_menu(bContext *C, ViewContext *vc, unsigned int
 
 		memset(object_mouse_select_menu_data, 0, sizeof(object_mouse_select_menu_data));
 
-		for (node = linklist, i = 0; node; node= node->next, i++) {
-			Base *base=node->link;
-			Object *ob= base->object;
-			char *name= ob->id.name+2;
+		for (node = linklist, i = 0; node; node = node->next, i++) {
+			Base *base = node->link;
+			Object *ob = base->object;
+			char *name = ob->id.name + 2;
 
-			BLI_strncpy(object_mouse_select_menu_data[i].idname, name, MAX_ID_NAME-2);
+			BLI_strncpy(object_mouse_select_menu_data[i].idname, name, MAX_ID_NAME - 2);
 			object_mouse_select_menu_data[i].icon = uiIconFromID(&ob->id);
 		}
 
@@ -1248,50 +1265,50 @@ static short mixed_bones_object_selectbuffer(ViewContext *vc, unsigned int *buff
 {
 	rcti rect;
 	int offs;
-	short a, hits15, hits9=0, hits5=0;
-	short has_bones15=0, has_bones9=0, has_bones5=0;
-	
-	BLI_init_rcti(&rect, mval[0]-14, mval[0]+14, mval[1]-14, mval[1]+14);
-	hits15= view3d_opengl_select(vc, buffer, MAXPICKBUF, &rect);
-	if(hits15>0) {
-		for(a=0; a<hits15; a++) if(buffer[4*a+3] & 0xFFFF0000) has_bones15= 1;
-		
-		offs= 4*hits15;
-		BLI_init_rcti(&rect, mval[0]-9, mval[0]+9, mval[1]-9, mval[1]+9);
-		hits9= view3d_opengl_select(vc, buffer+offs, MAXPICKBUF-offs, &rect);
-		if(hits9>0) {
-			for(a=0; a<hits9; a++) if(buffer[offs+4*a+3] & 0xFFFF0000) has_bones9= 1;
-			
-			offs+= 4*hits9;
-			BLI_init_rcti(&rect, mval[0]-5, mval[0]+5, mval[1]-5, mval[1]+5);
-			hits5= view3d_opengl_select(vc, buffer+offs, MAXPICKBUF-offs, &rect);
-			if(hits5>0) {
-				for(a=0; a<hits5; a++) if(buffer[offs+4*a+3] & 0xFFFF0000) has_bones5= 1;
+	short a, hits15, hits9 = 0, hits5 = 0;
+	short has_bones15 = 0, has_bones9 = 0, has_bones5 = 0;
+	
+	BLI_init_rcti(&rect, mval[0] - 14, mval[0] + 14, mval[1] - 14, mval[1] + 14);
+	hits15 = view3d_opengl_select(vc, buffer, MAXPICKBUF, &rect);
+	if (hits15 > 0) {
+		for (a = 0; a < hits15; a++) if (buffer[4 * a + 3] & 0xFFFF0000) has_bones15 = 1;
+
+		offs = 4 * hits15;
+		BLI_init_rcti(&rect, mval[0] - 9, mval[0] + 9, mval[1] - 9, mval[1] + 9);
+		hits9 = view3d_opengl_select(vc, buffer + offs, MAXPICKBUF - offs, &rect);
+		if (hits9 > 0) {
+			for (a = 0; a < hits9; a++) if (buffer[offs + 4 * a + 3] & 0xFFFF0000) has_bones9 = 1;
+
+			offs += 4 * hits9;
+			BLI_init_rcti(&rect, mval[0] - 5, mval[0] + 5, mval[1] - 5, mval[1] + 5);
+			hits5 = view3d_opengl_select(vc, buffer + offs, MAXPICKBUF - offs, &rect);
+			if (hits5 > 0) {
+				for (a = 0; a < hits5; a++) if (buffer[offs + 4 * a + 3] & 0xFFFF0000) has_bones5 = 1;
 			}
 		}
 		
-		if(has_bones5) {
-			offs= 4*hits15 + 4*hits9;
-			memcpy(buffer, buffer+offs, 4*offs);
+		if (has_bones5) {
+			offs = 4 * hits15 + 4 * hits9;
+			memcpy(buffer, buffer + offs, 4 * offs);
 			return hits5;
 		}
-		if(has_bones9) {
-			offs= 4*hits15;
-			memcpy(buffer, buffer+offs, 4*offs);
+		if (has_bones9) {
+			offs = 4 * hits15;
+			memcpy(buffer, buffer + offs, 4 * offs);
 			return hits9;
 		}
-		if(has_bones15) {
+		if (has_bones15) {
 			return hits15;
 		}
 		
-		if(hits5>0) {
-			offs= 4*hits15 + 4*hits9;
-			memcpy(buffer, buffer+offs, 4*offs);
+		if (hits5 > 0) {
+			offs = 4 * hits15 + 4 * hits9;
+			memcpy(buffer, buffer + offs, 4 * offs);
 			return hits5;
 		}
-		if(hits9>0) {
-			offs= 4*hits15;
-			memcpy(buffer, buffer+offs, 4*offs);
+		if (hits9 > 0) {
+			offs = 4 * hits15;
+			memcpy(buffer, buffer + offs, 4 * offs);
 			return hits9;
 		}
 		return hits15;
@@ -1303,90 +1320,90 @@ static short mixed_bones_object_selectbuffer(ViewContext *vc, unsigned int *buff
 /* returns basact */
 static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int hits, const int mval[2], Base *startbase, int has_bones)
 {
-	Scene *scene= vc->scene;
-	View3D *v3d= vc->v3d;
-	Base *base, *basact= NULL;
-	static int lastmval[2]={-100, -100};
-	int a, donearest= 0;
+	Scene *scene = vc->scene;
+	View3D *v3d = vc->v3d;
+	Base *base, *basact = NULL;
+	static int lastmval[2] = {-100, -100};
+	int a, donearest = 0;
 	
 	/* define if we use solid nearest select or not */
-	if(v3d->drawtype>OB_WIRE) {
-		donearest= 1;
-		if( ABS(mval[0]-lastmval[0])<3 && ABS(mval[1]-lastmval[1])<3) {
-			if(!has_bones)	/* hrms, if theres bones we always do nearest */
-				donearest= 0;
+	if (v3d->drawtype > OB_WIRE) {
+		donearest = 1;
+		if (ABS(mval[0] - lastmval[0]) < 3 && ABS(mval[1] - lastmval[1]) < 3) {
+			if (!has_bones) /* hrms, if theres bones we always do nearest */
+				donearest = 0;
 		}
 	}
-	lastmval[0]= mval[0]; lastmval[1]= mval[1];
+	lastmval[0] = mval[0]; lastmval[1] = mval[1];
 	
-	if(donearest) {
-		unsigned int min= 0xFFFFFFFF;
-		int selcol= 0, notcol=0;
+	if (donearest) {
+		unsigned int min = 0xFFFFFFFF;
+		int selcol = 0, notcol = 0;
 		
 		
-		if(has_bones) {
+		if (has_bones) {
 			/* we skip non-bone hits */
-			for(a=0; a<hits; a++) {
-				if( min > buffer[4*a+1] && (buffer[4*a+3] & 0xFFFF0000) ) {
-					min= buffer[4*a+1];
-					selcol= buffer[4*a+3] & 0xFFFF;
+			for (a = 0; a < hits; a++) {
+				if (min > buffer[4 * a + 1] && (buffer[4 * a + 3] & 0xFFFF0000) ) {
+					min = buffer[4 * a + 1];
+					selcol = buffer[4 * a + 3] & 0xFFFF;
 				}
 			}
 		}
 		else {
 			/* only exclude active object when it is selected... */
-			if(BASACT && (BASACT->flag & SELECT) && hits>1) notcol= BASACT->selcol;	
+			if (BASACT && (BASACT->flag & SELECT) && hits > 1) notcol = BASACT->selcol;
 			
-			for(a=0; a<hits; a++) {
-				if( min > buffer[4*a+1] && notcol!=(buffer[4*a+3] & 0xFFFF)) {
-					min= buffer[4*a+1];
-					selcol= buffer[4*a+3] & 0xFFFF;
+			for (a = 0; a < hits; a++) {
+				if (min > buffer[4 * a + 1] && notcol != (buffer[4 * a + 3] & 0xFFFF)) {
+					min = buffer[4 * a + 1];
+					selcol = buffer[4 * a + 3] & 0xFFFF;
 				}
 			}
 		}
 		
-		base= FIRSTBASE;
-		while(base) {
-			if(BASE_SELECTABLE(v3d, base)) {
-				if(base->selcol==selcol) break;
+		base = FIRSTBASE;
+		while (base) {
+			if (BASE_SELECTABLE(v3d, base)) {
+				if (base->selcol == selcol) break;
 			}
-			base= base->next;
+			base = base->next;
 		}
-		if(base) basact= base;
+		if (base) basact = base;
 	}
 	else {
 		
-		base= startbase;
-		while(base) {
+		base = startbase;
+		while (base) {
 			/* skip objects with select restriction, to prevent prematurely ending this loop
-			* with an un-selectable choice */
+			 * with an un-selectable choice */
 			if (base->object->restrictflag & OB_RESTRICT_SELECT) {
-				base=base->next;
-				if(base==NULL) base= FIRSTBASE;
-				if(base==startbase) break;
+				base = base->next;
+				if (base == NULL) base = FIRSTBASE;
+				if (base == startbase) break;
 			}
 			
-			if(BASE_SELECTABLE(v3d, base)) {
-				for(a=0; a<hits; a++) {
-					if(has_bones) {
+			if (BASE_SELECTABLE(v3d, base)) {
+				for (a = 0; a < hits; a++) {
+					if (has_bones) {
 						/* skip non-bone objects */
-						if((buffer[4*a+3] & 0xFFFF0000)) {
-							if(base->selcol== (buffer[(4*a)+3] & 0xFFFF))
-								basact= base;
+						if ((buffer[4 * a + 3] & 0xFFFF0000)) {
+							if (base->selcol == (buffer[(4 * a) + 3] & 0xFFFF))
+								basact = base;
 						}
 					}
 					else {
-						if(base->selcol== (buffer[(4*a)+3] & 0xFFFF))
-							basact= base;
+						if (base->selcol == (buffer[(4 * a) + 3] & 0xFFFF))
+							basact = base;
 					}
 				}
 			}
 			
-			if(basact) break;
+			if (basact) break;
 			
-			base= base->next;
-			if(base==NULL) base= FIRSTBASE;
-			if(base==startbase) break;
+			base = base->next;
+			if (base == NULL) base = FIRSTBASE;
+			if (base == startbase) break;
 		}
 	}
 	
@@ -1397,22 +1414,22 @@ static Base *mouse_select_eval_buffer(ViewContext *vc, unsigned int *buffer, int
 Base *ED_view3d_give_base_under_cursor(bContext *C, const int mval[2])
 {
 	ViewContext vc;
-	Base *basact= NULL;
-	unsigned int buffer[4*MAXPICKBUF];
+	Base *basact = NULL;
+	unsigned int buffer[4 * MAXPICKBUF];
 	int hits;
 	
 	/* setup view context for argument to callbacks */
 	view3d_operator_needs_opengl(C);
 	view3d_set_viewcontext(C, &vc);
 	
-	hits= mixed_bones_object_selectbuffer(&vc, buffer, mval);
+	hits = mixed_bones_object_selectbuffer(&vc, buffer, mval);
 	
-	if(hits>0) {
-		int a, has_bones= 0;
+	if (hits > 0) {
+		int a, has_bones = 0;
 		
-		for(a=0; a<hits; a++) if(buffer[4*a+3] & 0xFFFF0000) has_bones= 1;
+		for (a = 0; a < hits; a++) if (buffer[4 * a + 3] & 0xFFFF0000) has_bones = 1;
 		
-		basact= mouse_select_eval_buffer(&vc, buffer, hits, mval, vc.scene->base.first, has_bones);
+		basact = mouse_select_eval_buffer(&vc, buffer, hits, mval, vc.scene->base.first, has_bones);
 	}
 	
 	return basact;
@@ -1422,18 +1439,18 @@ static void deselect_all_tracks(MovieTracking *tracking)
 {
 	MovieTrackingObject *object;
 
-	object= tracking->objects.first;
-	while(object) {
-		ListBase *tracksbase= BKE_tracking_object_tracks(tracking, object);
-		MovieTrackingTrack *track= tracksbase->first;
+	object = tracking->objects.first;
+	while (object) {
+		ListBase *tracksbase = BKE_tracking_object_tracks(tracking, object);
+		MovieTrackingTrack *track = tracksbase->first;
 
-		while(track) {
+		while (track) {
 			BKE_tracking_deselect_track(track, TRACK_AREA_ALL);
 
-			track= track->next;
+			track = track->next;
 		}
 
-		object= object->next;
+		object = object->next;
 	}
 }
 
@@ -1441,11 +1458,11 @@ static void deselect_all_tracks(MovieTracking *tracking)
 static int mouse_select(bContext *C, const int mval[2], short extend, short obcenter, short enumerate)
 {
 	ViewContext vc;
-	ARegion *ar= CTX_wm_region(C);
-	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;
+	ARegion *ar = CTX_wm_region(C);
+	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 retval = 0;
 	short hits;
 	
@@ -1453,146 +1470,148 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce
 	view3d_set_viewcontext(C, &vc);
 	
 	/* always start list from basact in wire mode */
-	startbase=  FIRSTBASE;
-	if(BASACT && BASACT->next) startbase= BASACT->next;
+	startbase =  FIRSTBASE;
+	if (BASACT && BASACT->next) startbase = BASACT->next;
 	
 	/* This block uses the control key to make the object selected by its center point rather than its contents */
 	/* in editmode do not activate */
-	if(obcenter) {
+	if (obcenter) {
 		
 		/* note; shift+alt goes to group-flush-selecting */
-		if(enumerate) {
-			basact= object_mouse_select_menu(C, &vc, NULL, 0, mval, extend);
-		} else {
-			base= startbase;
-			while(base) {
+		if (enumerate) {
+			basact = object_mouse_select_menu(C, &vc, NULL, 0, mval, extend);
+		}
+		else {
+			base = startbase;
+			while (base) {
 				if (BASE_SELECTABLE(v3d, base)) {
 					project_short(ar, base->object->obmat[3], &base->sx);
 					
-					temp= abs(base->sx -mval[0]) + abs(base->sy -mval[1]);
-					if(base==BASACT) temp+=10;
-					if(temp<dist ) {
+					temp = abs(base->sx - mval[0]) + abs(base->sy - mval[1]);
+					if (base == BASACT) temp += 10;
+					if (temp < dist) {
 						
-						dist= temp;
-						basact= base;
+						dist = temp;
+						basact = base;
 					}
 				}
-				base= base->next;
+				base = base->next;
 				
-				if(base==NULL) base= FIRSTBASE;
-				if(base==startbase) break;
+				if (base == NULL) base = FIRSTBASE;
+				if (base == startbase) break;
 			}
 		}
 	}
 	else {
-		unsigned int buffer[4*MAXPICKBUF];
+		unsigned int buffer[4 * MAXPICKBUF];
 
 		/* if objects have posemode set, the bones are in the same selection buffer */
 		
-		hits= mixed_bones_object_selectbuffer(&vc, buffer, mval);
+		hits = mixed_bones_object_selectbuffer(&vc, buffer, mval);
 		
-		if(hits>0) {
-			int has_bones= 0;
+		if (hits > 0) {
+			int has_bones = 0;
 			
 			/* note: bundles are handling in the same way as bones */
-			for(a=0; a<hits; a++) if(buffer[4*a+3] & 0xFFFF0000) has_bones= 1;
+			for (a = 0; a < hits; a++) if (buffer[4 * a + 3] & 0xFFFF0000) has_bones = 1;
 
 			/* note; shift+alt goes to group-flush-selecting */
-			if(has_bones==0 && enumerate) {
-				basact= object_mouse_select_menu(C, &vc, buffer, hits, mval, extend);
-			} else {
-				basact= mouse_select_eval_buffer(&vc, buffer, hits, mval, startbase, has_bones);
+			if (has_bones == 0 && enumerate) {
+				basact = object_mouse_select_menu(C, &vc, buffer, hits, mval, extend);
+			}
+			else {
+				basact = mouse_select_eval_buffer(&vc, buffer, hits, mval, startbase, has_bones);
 			}
 			
-			if(has_bones && basact) {
-				if(basact->object->type==OB_CAMERA) {
-					if(BASACT==basact) {
+			if (has_bones && basact) {
+				if (basact->object->type == OB_CAMERA) {
+					if (BASACT == basact) {
 						int i, hitresult;
-						int changed= 0;
+						int changed = 0;
 
-						for (i=0; i< hits; i++) {
-							hitresult= buffer[3+(i*4)];
+						for (i = 0; i < hits; i++) {
+							hitresult = buffer[3 + (i * 4)];
 
 							/* if there's bundles in buffer select bundles first,
-							   so non-camera elements should be ignored in buffer */
-							if(basact->selcol != (hitresult & 0xFFFF)) {
+							 * so non-camera elements should be ignored in buffer */
+							if (basact->selcol != (hitresult & 0xFFFF)) {
 								continue;
 							}
 
 							/* index of bundle is 1<<16-based. if there's no "bone" index
-							   in hight word, this buffer value belongs to camera,. not to bundle */
-							if(buffer[4*i+3] & 0xFFFF0000) {
-								MovieClip *clip= object_get_movieclip(scene, basact->object, 0);
-								MovieTracking *tracking= &clip->tracking;
+							 * in hight word, this buffer value belongs to camera,. not to bundle */
+							if (buffer[4 * i + 3] & 0xFFFF0000) {
+								MovieClip *clip = object_get_movieclip(scene, basact->object, 0);
+								MovieTracking *tracking = &clip->tracking;
 								ListBase *tracksbase;
 								MovieTrackingTrack *track;
 
-								track= BKE_tracking_indexed_track(&clip->tracking, hitresult >> 16, &tracksbase);
+								track = BKE_tracking_indexed_track(&clip->tracking, hitresult >> 16, &tracksbase);
 
-								if(TRACK_SELECTED(track) && extend) {
-									changed= 0;
+								if (TRACK_SELECTED(track) && extend) {
+									changed = 0;
 									BKE_tracking_deselect_track(track, TRACK_AREA_ALL);
 								}
 								else {
-									int oldsel= TRACK_SELECTED(track) ? 1 : 0;
-									if(!extend)
+									int oldsel = TRACK_SELECTED(track) ? 1 : 0;
+									if (!extend)
 										deselect_all_tracks(tracking);
 
 									BKE_tracking_select_track(tracksbase, track, TRACK_AREA_ALL, extend);
 
-									if(oldsel!=(TRACK_SELECTED(track) ? 1 : 0))
-										changed= 1;
+									if (oldsel != (TRACK_SELECTED(track) ? 1 : 0))
+										changed = 1;
 								}
 
-								basact->flag|= SELECT;
-								basact->object->flag= basact->flag;
+								basact->flag |= SELECT;
+								basact->object->flag = basact->flag;
 
-								retval= 1;
+								retval = 1;
 
-								WM_event_add_notifier(C, NC_MOVIECLIP|ND_SELECT, track);
-								WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
+								WM_event_add_notifier(C, NC_MOVIECLIP | ND_SELECT, track);
+								WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
 
 								break;
 							}
 						}
 
-						if(!changed) {
+						if (!changed) {
 							/* fallback to regular object selection if no new bundles were selected,
-							   allows to select object parented to reconstruction object */
-							basact= mouse_select_eval_buffer(&vc, buffer, hits, mval, startbase, 0);
+							 * allows to select object parented to reconstruction object */
+							basact = mouse_select_eval_buffer(&vc, buffer, hits, mval, startbase, 0);
 						}
 					}
 				}
-				else if(ED_do_pose_selectbuffer(scene, basact, buffer, hits, extend) ) {	/* then bone is found */
+				else if (ED_do_pose_selectbuffer(scene, basact, buffer, hits, extend) ) {   /* then bone is found */
 				
 					/* we make the armature selected: 
-					   not-selected active object in posemode won't work well for tools */
-					basact->flag|= SELECT;
-					basact->object->flag= basact->flag;
+					 * not-selected active object in posemode won't work well for tools */
+					basact->flag |= SELECT;
+					basact->object->flag = basact->flag;
 					
 					retval = 1;
-					WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, basact->object);
-					WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, basact->object);
+					WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, basact->object);
+					WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, basact->object);
 					
 					/* in weightpaint, we use selected bone to select vertexgroup, so no switch to new active object */
-					if(BASACT && BASACT->object->mode & OB_MODE_WEIGHT_PAINT) {
+					if (BASACT && (BASACT->object->mode & OB_MODE_WEIGHT_PAINT)) {
 						/* prevent activating */
-						basact= NULL;
+						basact = NULL;
 					}
 
 				}
 				/* prevent bone selecting to pass on to object selecting */
-				if(basact==BASACT)
-					basact= NULL;
+				if (basact == BASACT)
+					basact = NULL;
 			}
 		}
 	}
 	
 	/* so, do we have something selected? */
-	if(basact) {
+	if (basact) {
 		retval = 1;
 		
-		if(vc.obedit) {
+		if (vc.obedit) {
 			/* only do select */
 			deselectall_except(scene, basact);
 			ED_base_object_select(basact, BA_SELECT);
@@ -1600,29 +1619,29 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce
 		/* also prevent making it active on mouse selection */
 		else if (BASE_SELECTABLE(v3d, basact)) {
 
-			oldbasact= BASACT;
+			oldbasact = BASACT;
 			
-			if(!extend) {
+			if (!extend) {
 				deselectall_except(scene, basact);
 				ED_base_object_select(basact, BA_SELECT);
 			}
-			else if(0) {
+			else if (0) {
 				// XXX select_all_from_groups(basact);
 			}
 			else {
-				if(basact->flag & SELECT) {
-					if(basact==oldbasact)
+				if (basact->flag & SELECT) {
+					if (basact == oldbasact)
 						ED_base_object_select(basact, BA_DESELECT);
 				}
 				else ED_base_object_select(basact, BA_SELECT);
 			}
 
-			if(oldbasact != basact) {
+			if (oldbasact != basact) {
 				ED_base_object_activate(C, basact); /* adds notifier */
 			}
 		}
 
-		WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
+		WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
 	}
 
 	return retval;
@@ -1638,22 +1657,22 @@ typedef struct BoxSelectUserData {
 
 int edge_inside_circle(short centx, short centy, short rad, short x1, short y1, short x2, short y2)
 {
-	int radsq= rad*rad;
+	int radsq = rad * rad;
 	float v1[2], v2[2], v3[2];
 	
 	/* check points in circle itself */
-	if( (x1-centx)*(x1-centx) + (y1-centy)*(y1-centy) <= radsq ) return 1;
-	if( (x2-centx)*(x2-centx) + (y2-centy)*(y2-centy) <= radsq ) return 1;
+	if ( (x1 - centx) * (x1 - centx) + (y1 - centy) * (y1 - centy) <= radsq) return 1;
+	if ( (x2 - centx) * (x2 - centx) + (y2 - centy) * (y2 - centy) <= radsq) return 1;
 	
 	/* pointdistline */
-	v3[0]= centx;
-	v3[1]= centy;
-	v1[0]= x1;
-	v1[1]= y1;
-	v2[0]= x2;
-	v2[1]= y2;
+	v3[0] = centx;
+	v3[1] = centy;
+	v1[0] = x1;
+	v1[1] = y1;
+	v2[0] = x2;
+	v2[1] = y2;
 	
-	if( dist_to_line_segment_v2(v3, v1, v2) < (float)rad ) return 1;
+	if (dist_to_line_segment_v2(v3, v1, v2) < (float)rad) return 1;
 	
 	return 0;
 }
@@ -1661,24 +1680,28 @@ int edge_inside_circle(short centx, short centy, short rad, short x1, short y1,
 static void do_nurbs_box_select__doSelect(void *userData, Nurb *UNUSED(nu), BPoint *bp, BezTriple *bezt, int beztindex, int x, int y)
 {
 	BoxSelectUserData *data = userData;
-	Object *obedit= data->vc->obedit;
-	Curve *cu= (Curve*)obedit->data;
+	Object *obedit = data->vc->obedit;
+	Curve *cu = (Curve *)obedit->data;
 
 	if (BLI_in_rcti(data->rect, x, y)) {
 		if (bp) {
-			bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT);
+			bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
 			if (bp == cu->lastsel && !(bp->f1 & 1)) cu->lastsel = NULL;
-		} else {
+		}
+		else {
 			if (cu->drawflag & CU_HIDE_HANDLES) {
 				/* can only be beztindex==0 here since handles are hidden */
-				bezt->f1 = bezt->f2 = bezt->f3 = data->select?(bezt->f2|SELECT):(bezt->f2&~SELECT);
-			} else {
-				if (beztindex==0) {
-					bezt->f1 = data->select?(bezt->f1|SELECT):(bezt->f1&~SELECT);
-				} else if (beztindex==1) {
-					bezt->f2 = data->select?(bezt->f2|SELECT):(bezt->f2&~SELECT);
-				} else {
-					bezt->f3 = data->select?(bezt->f3|SELECT):(bezt->f3&~SELECT);
+				bezt->f1 = bezt->f2 = bezt->f3 = data->select ? (bezt->f2 | SELECT) : (bezt->f2 & ~SELECT);
+			}
+			else {
+				if (beztindex == 0) {
+					bezt->f1 = data->select ? (bezt->f1 | SELECT) : (bezt->f1 & ~SELECT);
+				}
+				else if (beztindex == 1) {
+					bezt->f2 = data->select ? (bezt->f2 | SELECT) : (bezt->f2 & ~SELECT);
+				}
+				else {
+					bezt->f3 = data->select ? (bezt->f3 | SELECT) : (bezt->f3 & ~SELECT);
 				}
 			}
 
@@ -1708,14 +1731,14 @@ static void do_lattice_box_select__doSelect(void *userData, BPoint *bp, int x, i
 	BoxSelectUserData *data = userData;
 
 	if (BLI_in_rcti(data->rect, x, y)) {
-		bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT);
+		bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
 	}
 }
 static int do_lattice_box_select(ViewContext *vc, rcti *rect, int select, int extend)
 {
 	BoxSelectUserData data;
 
-	data.vc= vc;
+	data.vc = vc;
 	data.rect = rect;
 	data.select = select;
 
@@ -1728,123 +1751,126 @@ static int do_lattice_box_select(ViewContext *vc, rcti *rect, int select, int ex
 	return OPERATOR_FINISHED;
 }
 
-static void do_mesh_box_select__doSelectVert(void *userData, EditVert *eve, int x, int y, int UNUSED(index))
+static void do_mesh_box_select__doSelectVert(void *userData, BMVert *eve, int x, int y, int UNUSED(index))
 {
 	BoxSelectUserData *data = userData;
 
 	if (BLI_in_rcti(data->rect, x, y)) {
-		eve->f = data->select?(eve->f|1):(eve->f&~1);
+		BM_vert_select_set(data->vc->em->bm, eve, data->select);
 	}
 }
-static void do_mesh_box_select__doSelectEdge(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int index)
+static void do_mesh_box_select__doSelectEdge(void *userData, BMEdge *eed, int x0, int y0, int x1, int y1, int index)
 {
 	BoxSelectUserData *data = userData;
 
-	if(EM_check_backbuf(em_solidoffs+index)) {
-		if (data->pass==0) {
+	if (EDBM_backbuf_check(bm_solidoffs + index)) {
+		if (data->pass == 0) {
 			if (edge_fully_inside_rect(data->rect, x0, y0, x1, y1)) {
-				EM_select_edge(eed, data->select);
+				BM_edge_select_set(data->vc->em->bm, eed, data->select);
 				data->done = 1;
 			}
-		} else {
+		}
+		else {
 			if (edge_inside_rect(data->rect, x0, y0, x1, y1)) {
-				EM_select_edge(eed, data->select);
+				BM_edge_select_set(data->vc->em->bm, eed, data->select);
 			}
 		}
 	}
 }
-static void do_mesh_box_select__doSelectFace(void *userData, EditFace *efa, int x, int y, int UNUSED(index))
+static void do_mesh_box_select__doSelectFace(void *userData, BMFace *efa, int x, int y, int UNUSED(index))
 {
 	BoxSelectUserData *data = userData;
 
 	if (BLI_in_rcti(data->rect, x, y)) {
-		EM_select_face_fgon(data->vc->em, efa, data->select);
+		BM_face_select_set(data->vc->em->bm, efa, data->select);
 	}
 }
 static int do_mesh_box_select(ViewContext *vc, rcti *rect, int select, int extend)
 {
 	BoxSelectUserData data;
-	ToolSettings *ts= vc->scene->toolsettings;
+	ToolSettings *ts = vc->scene->toolsettings;
 	int bbsel;
 	
-	data.vc= vc;
+	data.vc = vc;
 	data.rect = rect;
 	data.select = select;
 	data.pass = 0;
 	data.done = 0;
 
 	if (extend == 0 && select)
-		EM_deselect_all(vc->em);
+		EDBM_flag_disable_all(vc->em, BM_ELEM_SELECT);
 
-	/* for non zbuf projections, dont change the GL state */
+	/* for non zbuf projections, don't change the GL state */
 	ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d);
 
 	glLoadMatrixf(vc->rv3d->viewmat);
-	bbsel= EM_init_backbuf_border(vc, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
+	bbsel = EDBM_backbuf_border_init(vc, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
 
-	if(ts->selectmode & SCE_SELECT_VERTEX) {
+	if (ts->selectmode & SCE_SELECT_VERTEX) {
 		if (bbsel) {
-			EM_backbuf_checkAndSelectVerts(vc->em, select);
-		} else {
+			edbm_backbuf_check_and_select_verts(vc->em, select);
+		}
+		else {
 			mesh_foreachScreenVert(vc, do_mesh_box_select__doSelectVert, &data, V3D_CLIP_TEST_RV3D_CLIPPING);
 		}
 	}
-	if(ts->selectmode & SCE_SELECT_EDGE) {
-			/* Does both bbsel and non-bbsel versions (need screen cos for both) */
+	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);
 
-		if (data.done==0) {
+		if (data.done == 0) {
 			data.pass = 1;
 			mesh_foreachScreenEdge(vc, do_mesh_box_select__doSelectEdge, &data, V3D_CLIP_TEST_OFF);
 		}
 	}
 	
-	if(ts->selectmode & SCE_SELECT_FACE) {
-		if(bbsel) {
-			EM_backbuf_checkAndSelectFaces(vc->em, select);
-		} else {
+	if (ts->selectmode & SCE_SELECT_FACE) {
+		if (bbsel) {
+			edbm_backbuf_check_and_select_faces(vc->em, select);
+		}
+		else {
 			mesh_foreachScreenFace(vc, do_mesh_box_select__doSelectFace, &data);
 		}
 	}
 	
-	EM_free_backbuf();
+	EDBM_backbuf_free();
 		
-	EM_selectmode_flush(vc->em);
+	EDBM_selectmode_flush(vc->em);
 	
 	return OPERATOR_FINISHED;
 }
 
 static int do_meta_box_select(ViewContext *vc, rcti *rect, int select, int extend)
 {
-	MetaBall *mb = (MetaBall*)vc->obedit->data;
+	MetaBall *mb = (MetaBall *)vc->obedit->data;
 	MetaElem *ml;
 	int a;
 
-	unsigned int buffer[4*MAXPICKBUF];
+	unsigned int buffer[4 * MAXPICKBUF];
 	short hits;
 
-	hits= view3d_opengl_select(vc, buffer, MAXPICKBUF, rect);
+	hits = view3d_opengl_select(vc, buffer, MAXPICKBUF, rect);
 
 	if (extend == 0 && select) {
-		for(ml= mb->editelems->first; ml; ml= ml->next) {
+		for (ml = mb->editelems->first; ml; ml = ml->next) {
 			ml->flag &= ~SELECT;
 		}
 	}
 	
-	for(ml= mb->editelems->first; ml; ml= ml->next) {
-		for(a=0; a<hits; a++) {
-			if(ml->selcol1==buffer[ (4 * a) + 3 ]) {
+	for (ml = mb->editelems->first; ml; ml = ml->next) {
+		for (a = 0; a < hits; a++) {
+			if (ml->selcol1 == buffer[(4 * a) + 3]) {
 				ml->flag |= MB_SCALE_RAD;
-				if(select)	ml->flag |= SELECT;
-				else		ml->flag &= ~SELECT;
+				if (select) ml->flag |= SELECT;
+				else ml->flag &= ~SELECT;
 				break;
 			}
-			if(ml->selcol2==buffer[ (4 * a) + 3 ]) {
+			if (ml->selcol2 == buffer[(4 * a) + 3]) {
 				ml->flag &= ~MB_SCALE_RAD;
-				if(select)	ml->flag |= SELECT;
-				else		ml->flag &= ~SELECT;
+				if (select) ml->flag |= SELECT;
+				else ml->flag &= ~SELECT;
 				break;
 			}
 		}
@@ -1855,63 +1881,63 @@ static int do_meta_box_select(ViewContext *vc, rcti *rect, int select, int exten
 
 static int do_armature_box_select(ViewContext *vc, rcti *rect, short select, short extend)
 {
-	bArmature *arm= vc->obedit->data;
+	bArmature *arm = vc->obedit->data;
 	EditBone *ebone;
 	int a;
 
-	unsigned int buffer[4*MAXPICKBUF];
+	unsigned int buffer[4 * MAXPICKBUF];
 	short hits;
 
-	hits= view3d_opengl_select(vc, buffer, MAXPICKBUF, rect);
+	hits = view3d_opengl_select(vc, buffer, MAXPICKBUF, rect);
 	
 	/* clear flag we use to detect point was affected */
-	for(ebone= arm->edbo->first; ebone; ebone= ebone->next)
+	for (ebone = arm->edbo->first; ebone; ebone = ebone->next)
 		ebone->flag &= ~BONE_DONE;
 	
-	if (extend==0 && select)
+	if (extend == 0 && select)
 		ED_armature_deselect_all_visible(vc->obedit);
 
 	/* first we only check points inside the border */
-	for (a=0; a<hits; a++){
-		int index = buffer[(4*a)+3];
-		if (index!=-1) {
+	for (a = 0; a < hits; a++) {
+		int index = buffer[(4 * a) + 3];
+		if (index != -1) {
 			ebone = BLI_findlink(arm->edbo, index & ~(BONESEL_ANY));
-			if ((ebone->flag & BONE_UNSELECTABLE)==0) {
+			if ((ebone->flag & BONE_UNSELECTABLE) == 0) {
 				if (index & BONESEL_TIP) {
 					ebone->flag |= BONE_DONE;
-					if (select)	ebone->flag |= BONE_TIPSEL;
-					else		ebone->flag &= ~BONE_TIPSEL;
+					if (select) ebone->flag |= BONE_TIPSEL;
+					else ebone->flag &= ~BONE_TIPSEL;
 				}
 				
 				if (index & BONESEL_ROOT) {
 					ebone->flag |= BONE_DONE;
-					if (select)	ebone->flag |= BONE_ROOTSEL;
-					else		ebone->flag &= ~BONE_ROOTSEL;
+					if (select) ebone->flag |= BONE_ROOTSEL;
+					else ebone->flag &= ~BONE_ROOTSEL;
 				}
 			}
 		}
 	}
 	
 	/* now we have to flush tag from parents... */
-	for(ebone= arm->edbo->first; ebone; ebone= ebone->next) {
-		if(ebone->parent && (ebone->flag & BONE_CONNECTED)) {
-			if(ebone->parent->flag & BONE_DONE)
+	for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
+		if (ebone->parent && (ebone->flag & BONE_CONNECTED)) {
+			if (ebone->parent->flag & BONE_DONE)
 				ebone->flag |= BONE_DONE;
 		}
 	}
 	
 	/* only select/deselect entire bones when no points where in the rect */
-	for (a=0; a<hits; a++){
-		int index = buffer[(4*a)+3];
-		if (index!=-1) {
+	for (a = 0; a < hits; a++) {
+		int index = buffer[(4 * a) + 3];
+		if (index != -1) {
 			ebone = BLI_findlink(arm->edbo, index & ~(BONESEL_ANY));
 			if (index & BONESEL_BONE) {
-				if ((ebone->flag & BONE_UNSELECTABLE)==0) {
-					if(!(ebone->flag & BONE_DONE)) {
+				if ((ebone->flag & BONE_UNSELECTABLE) == 0) {
+					if (!(ebone->flag & BONE_DONE)) {
 						if (select)
-							ebone->flag |= (BONE_ROOTSEL|BONE_TIPSEL|BONE_SELECTED);
+							ebone->flag |= (BONE_ROOTSEL | BONE_TIPSEL | BONE_SELECTED);
 						else
-							ebone->flag &= ~(BONE_ROOTSEL|BONE_TIPSEL|BONE_SELECTED);
+							ebone->flag &= ~(BONE_ROOTSEL | BONE_TIPSEL | BONE_SELECTED);
 					}
 				}
 			}
@@ -1926,94 +1952,95 @@ static int do_armature_box_select(ViewContext *vc, rcti *rect, short select, sho
 static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, int select, int extend)
 {
 	Bone *bone;
-	Object *ob= vc->obact;
-	unsigned int *vbuffer=NULL; /* selection buffer	*/
-	unsigned int *col;			/* color in buffer	*/
+	Object *ob = vc->obact;
+	unsigned int *vbuffer = NULL; /* selection buffer	*/
+	unsigned int *col;          /* color in buffer	*/
 	int bone_only;
-	int bone_selected=0;
-	int totobj= MAXPICKBUF;	// XXX solve later
+	int bone_selected = 0;
+	int totobj = MAXPICKBUF; // XXX solve later
 	short hits;
 	
-	if((ob) && (ob->mode & OB_MODE_POSE))
-		bone_only= 1;
+	if ((ob) && (ob->mode & OB_MODE_POSE))
+		bone_only = 1;
 	else
-		bone_only= 0;
+		bone_only = 0;
 	
 	if (extend == 0 && select) {
 		if (bone_only) {
 			CTX_DATA_BEGIN(C, bPoseChannel *, pchan, visible_pose_bones) {
-				if ((pchan->bone->flag & BONE_UNSELECTABLE)==0) {
-					pchan->bone->flag &= ~(BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
+				if ((pchan->bone->flag & BONE_UNSELECTABLE) == 0) {
+					pchan->bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
 				}
 			}
 			CTX_DATA_END;
-		} else {
+		}
+		else {
 			object_deselect_all_visible(vc->scene, vc->v3d);
 		}
 	}
 
 	/* selection buffer now has bones potentially too, so we add MAXPICKBUF */
-	vbuffer = MEM_mallocN(4 * (totobj+MAXPICKBUF) * sizeof(unsigned int), "selection buffer");
-	hits= view3d_opengl_select(vc, vbuffer, 4*(totobj+MAXPICKBUF), rect);
+	vbuffer = MEM_mallocN(4 * (totobj + MAXPICKBUF) * sizeof(unsigned int), "selection buffer");
+	hits = view3d_opengl_select(vc, vbuffer, 4 * (totobj + MAXPICKBUF), rect);
 	/*
-	LOGIC NOTES (theeth):
-	The buffer and ListBase have the same relative order, which makes the selection
-	very simple. Loop through both data sets at the same time, if the color
-	is the same as the object, we have a hit and can move to the next color
-	and object pair, if not, just move to the next object,
-	keeping the same color until we have a hit.
-
-	The buffer order is defined by OGL standard, hopefully no stupid GFX card
-	does it incorrectly.
-	*/
-
-	if (hits>0) { /* no need to loop if there's no hit */
+	 * LOGIC NOTES (theeth):
+	 * The buffer and ListBase have the same relative order, which makes the selection
+	 * very simple. Loop through both data sets at the same time, if the color
+	 * is the same as the object, we have a hit and can move to the next color
+	 * and object pair, if not, just move to the next object,
+	 * keeping the same color until we have a hit.
+	 * 
+	 * The buffer order is defined by OGL standard, hopefully no stupid GFX card
+	 * does it incorrectly.
+	 */
+
+	if (hits > 0) { /* no need to loop if there's no hit */
 		Base *base;
 		col = vbuffer + 3;
 		
-		for(base= vc->scene->base.first; base && hits; base= base->next) {
-			if(BASE_SELECTABLE(vc->v3d, base)) {
-				while (base->selcol == (*col & 0xFFFF)) {	/* we got an object */
+		for (base = vc->scene->base.first; base && hits; base = base->next) {
+			if (BASE_SELECTABLE(vc->v3d, base)) {
+				while (base->selcol == (*col & 0xFFFF)) {   /* we got an object */
 					
-					if(*col & 0xFFFF0000) {					/* we got a bone */
+					if (*col & 0xFFFF0000) {                    /* we got a bone */
 						bone = get_indexed_bone(base->object, *col & ~(BONESEL_ANY));
-						if(bone) {
-							if(select) {
-								if ((bone->flag & BONE_UNSELECTABLE)==0) {
+						if (bone) {
+							if (select) {
+								if ((bone->flag & BONE_UNSELECTABLE) == 0) {
 									bone->flag |= BONE_SELECTED;
-									bone_selected=1;
+									bone_selected = 1;
 // XXX									select_actionchannel_by_name(base->object->action, bone->name, 1);
 								}
 							}
 							else {
-								bArmature *arm= base->object->data;
+								bArmature *arm = base->object->data;
 								bone->flag &= ~BONE_SELECTED;
 // XXX									select_actionchannel_by_name(base->object->action, bone->name, 0);
-								if(arm->act_bone==bone)
-									arm->act_bone= NULL;
+								if (arm->act_bone == bone)
+									arm->act_bone = NULL;
 								
 							}
 						}
 					}
-					else if(!bone_only) {
+					else if (!bone_only) {
 						if (select)
 							ED_base_object_select(base, BA_SELECT);
 						else
 							ED_base_object_select(base, BA_DESELECT);
 					}
 
-					col+=4;	/* next color */
+					col += 4; /* next color */
 					hits--;
-					if(hits==0) break;
+					if (hits == 0) break;
 				}
 			}
 			
 			if (bone_selected) {
-				WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, base->object);
+				WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, base->object);
 			}
 		}
 
-		WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, vc->scene);
+		WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, vc->scene);
 
 	}
 	MEM_freeN(vbuffer);
@@ -2028,74 +2055,74 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
 	short extend;
 	short select;
 
-	int ret= OPERATOR_CANCELLED;
+	int ret = OPERATOR_CANCELLED;
 
 	view3d_operator_needs_opengl(C);
 
 	/* setup view context for argument to callbacks */
 	view3d_set_viewcontext(C, &vc);
 	
-	select= (RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_SELECT);
-	rect.xmin= RNA_int_get(op->ptr, "xmin");
-	rect.ymin= RNA_int_get(op->ptr, "ymin");
-	rect.xmax= RNA_int_get(op->ptr, "xmax");
-	rect.ymax= RNA_int_get(op->ptr, "ymax");
+	select = (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT);
+	rect.xmin = RNA_int_get(op->ptr, "xmin");
+	rect.ymin = RNA_int_get(op->ptr, "ymin");
+	rect.xmax = RNA_int_get(op->ptr, "xmax");
+	rect.ymax = RNA_int_get(op->ptr, "ymax");
 	extend = RNA_boolean_get(op->ptr, "extend");
 
-	if(vc.obedit) {
-		switch(vc.obedit->type) {
-		case OB_MESH:
-			vc.em= ((Mesh *)vc.obedit->data)->edit_mesh;
-			ret= do_mesh_box_select(&vc, &rect, select, extend);
+	if (vc.obedit) {
+		switch (vc.obedit->type) {
+			case OB_MESH:
+				vc.em = BMEdit_FromObject(vc.obedit);
+				ret = do_mesh_box_select(&vc, &rect, select, extend);
 //			if (EM_texFaceCheck())
-			if(ret & OPERATOR_FINISHED) {
-				WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc.obedit->data);
-			}
-			break;
-		case OB_CURVE:
-		case OB_SURF:
-			ret= do_nurbs_box_select(&vc, &rect, select, extend);
-			if(ret & OPERATOR_FINISHED) {
-				WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc.obedit->data);
-			}
-			break;
-		case OB_MBALL:
-			ret= do_meta_box_select(&vc, &rect, select, extend);
-			if(ret & OPERATOR_FINISHED) {
-				WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc.obedit->data);
-			}
-			break;
-		case OB_ARMATURE:
-			ret= do_armature_box_select(&vc, &rect, select, extend);
-			if(ret & OPERATOR_FINISHED) {
-				WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, vc.obedit);
-			}
-			break;
-		case OB_LATTICE:
-			ret= do_lattice_box_select(&vc, &rect, select, extend);		
-			if(ret & OPERATOR_FINISHED) {
-				WM_event_add_notifier(C, NC_GEOM|ND_SELECT, vc.obedit->data);
-			}
-			break;			
-		default:
-			assert(!"border select on incorrect object type");
+				if (ret & OPERATOR_FINISHED) {
+					WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit->data);
+				}
+				break;
+			case OB_CURVE:
+			case OB_SURF:
+				ret = do_nurbs_box_select(&vc, &rect, select, extend);
+				if (ret & OPERATOR_FINISHED) {
+					WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit->data);
+				}
+				break;
+			case OB_MBALL:
+				ret = do_meta_box_select(&vc, &rect, select, extend);
+				if (ret & OPERATOR_FINISHED) {
+					WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit->data);
+				}
+				break;
+			case OB_ARMATURE:
+				ret = do_armature_box_select(&vc, &rect, select, extend);
+				if (ret & OPERATOR_FINISHED) {
+					WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, vc.obedit);
+				}
+				break;
+			case OB_LATTICE:
+				ret = do_lattice_box_select(&vc, &rect, select, extend);
+				if (ret & OPERATOR_FINISHED) {
+					WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit->data);
+				}
+				break;
+			default:
+				assert(!"border select on incorrect object type");
 		}
 	}
-	else {	/* no editmode, unified for bones and objects */
-		if(vc.obact && vc.obact->mode & OB_MODE_SCULPT) {
+	else {  /* no editmode, unified for bones and objects */
+		if (vc.obact && vc.obact->mode & OB_MODE_SCULPT) {
 			/* pass */
 		}
-		else if(vc.obact && paint_facesel_test(vc.obact)) {
-			ret= do_paintface_box_select(&vc, &rect, select, extend);
+		else if (vc.obact && paint_facesel_test(vc.obact)) {
+			ret = do_paintface_box_select(&vc, &rect, select, extend);
 		}
-		else if(vc.obact && paint_vertsel_test(vc.obact)) {
-			ret= do_paintvert_box_select(&vc, &rect, select, extend);
+		else if (vc.obact && paint_vertsel_test(vc.obact)) {
+			ret = do_paintvert_box_select(&vc, &rect, select, extend);
 		}
-		else if(vc.obact && vc.obact->mode & OB_MODE_PARTICLE_EDIT) {
-			ret= PE_border_select(C, &rect, select, extend);
+		else if (vc.obact && vc.obact->mode & OB_MODE_PARTICLE_EDIT) {
+			ret = PE_border_select(C, &rect, select, extend);
 		}
 		else { /* object mode with none active */
-			ret= do_object_pose_box_select(C, &vc, &rect, select, extend);
+			ret = do_object_pose_box_select(C, &vc, &rect, select, extend);
 		}
 	}
 
@@ -2109,19 +2136,19 @@ static int view3d_borderselect_exec(bContext *C, wmOperator *op)
 void VIEW3D_OT_select_border(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Border Select";
-	ot->description= "Select items using border selection";
-	ot->idname= "VIEW3D_OT_select_border";
+	ot->name = "Border Select";
+	ot->description = "Select items using border selection";
+	ot->idname = "VIEW3D_OT_select_border";
 	
 	/* api callbacks */
-	ot->invoke= WM_border_select_invoke;
-	ot->exec= view3d_borderselect_exec;
-	ot->modal= WM_border_select_modal;
-	ot->poll= view3d_selectable_data;
-	ot->cancel= WM_border_select_cancel;
+	ot->invoke = WM_border_select_invoke;
+	ot->exec = view3d_borderselect_exec;
+	ot->modal = WM_border_select_modal;
+	ot->poll = view3d_selectable_data;
+	ot->cancel = WM_border_select_cancel;
 	
 	/* flags */
-	ot->flag= OPTYPE_UNDO;
+	ot->flag = OPTYPE_UNDO;
 	
 	/* rna */
 	WM_operator_properties_gesture_border(ot, TRUE);
@@ -2134,22 +2161,22 @@ static int vertsel_vert_pick(struct bContext *C, Mesh *me, const int mval[2], un
 	ViewContext vc;
 	view3d_set_viewcontext(C, &vc);
 
-	if (!me || me->totvert==0)
+	if (!me || me->totvert == 0)
 		return 0;
 
 	if (size > 0) {
 		/* sample rect to increase changes of selecting, so that when clicking
-		   on an face in the backbuf, we can still select a vert */
+		 * on an face in the backbuf, we can still select a vert */
 
 		int dist;
-		*index = view3d_sample_backbuf_rect(&vc, mval, size, 1, me->totvert+1, &dist,0,NULL, NULL);
+		*index = view3d_sample_backbuf_rect(&vc, mval, size, 1, me->totvert + 1, &dist, 0, NULL, NULL);
 	}
 	else {
 		/* sample only on the exact position */
 		*index = view3d_sample_backbuf(&vc, mval[0], mval[1]);
 	}
 
-	if ((*index)<=0 || (*index)>(unsigned int)me->totvert)
+	if ((*index) <= 0 || (*index) > (unsigned int)me->totvert)
 		return 0;
 
 	(*index)--;
@@ -2161,20 +2188,21 @@ static int vertsel_vert_pick(struct bContext *C, Mesh *me, const int mval[2], un
 /* gets called via generic mouse select operator */
 static int mouse_weight_paint_vertex_select(bContext *C, const int mval[2], short extend, Object *obact)
 {
-	Mesh* me= obact->data; /* already checked for NULL */
+	Mesh*me = obact->data; /* already checked for NULL */
 	unsigned int index = 0;
 	MVert *mv;
 
-	if(vertsel_vert_pick(C, me, mval, &index, 50)) {
-		mv = me->mvert+index;
-		if(extend) {
+	if (vertsel_vert_pick(C, me, mval, &index, 50)) {
+		mv = me->mvert + index;
+		if (extend) {
 			mv->flag ^= SELECT;
-		} else {
+		}
+		else {
 			paintvert_deselect_all_visible(obact, SEL_DESELECT, FALSE);
 			mv->flag |= SELECT;
 		}
 		paintvert_flush_flags(obact);
-		WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obact->data);
+		WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data);
 		return 1;
 	}
 	return 0;
@@ -2185,44 +2213,44 @@ static int mouse_weight_paint_vertex_select(bContext *C, const int mval[2], shor
 
 static int view3d_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	Object *obedit= CTX_data_edit_object(C);
-	Object *obact= CTX_data_active_object(C);
-	short extend= RNA_boolean_get(op->ptr, "extend");
-	short center= RNA_boolean_get(op->ptr, "center");
-	short enumerate= RNA_boolean_get(op->ptr, "enumerate");
-	short object= RNA_boolean_get(op->ptr, "object");
-	int	retval = 0;
+	Object *obedit = CTX_data_edit_object(C);
+	Object *obact = CTX_data_active_object(C);
+	short extend = RNA_boolean_get(op->ptr, "extend");
+	short center = RNA_boolean_get(op->ptr, "center");
+	short enumerate = RNA_boolean_get(op->ptr, "enumerate");
+	short object = RNA_boolean_get(op->ptr, "object");
+	int retval = 0;
 
 	view3d_operator_needs_opengl(C);
 
-	if(object) {
-		obedit= NULL;
-		obact= NULL;
+	if (object) {
+		obedit = NULL;
+		obact = NULL;
 
 		/* ack, this is incorrect but to do this correctly we would need an
 		 * alternative editmode/objectmode keymap, this copies the functionality
 		 * from 2.4x where Ctrl+Select in editmode does object select only */
-		center= FALSE;
+		center = FALSE;
 	}
 
-	if(obedit && object==FALSE) {
-		if(obedit->type==OB_MESH)
+	if (obedit && object == FALSE) {
+		if (obedit->type == OB_MESH)
 			retval = mouse_mesh(C, event->mval, extend);
-		else if(obedit->type==OB_ARMATURE)
+		else if (obedit->type == OB_ARMATURE)
 			retval = mouse_armature(C, event->mval, extend);
-		else if(obedit->type==OB_LATTICE)
+		else if (obedit->type == OB_LATTICE)
 			retval = mouse_lattice(C, event->mval, extend);
-		else if(ELEM(obedit->type, OB_CURVE, OB_SURF))
+		else if (ELEM(obedit->type, OB_CURVE, OB_SURF))
 			retval = mouse_nurb(C, event->mval, extend);
-		else if(obedit->type==OB_MBALL)
+		else if (obedit->type == OB_MBALL)
 			retval = mouse_mball(C, event->mval, extend);
 			
 	}
-	else if(obact && obact->mode & OB_MODE_SCULPT)
+	else if (obact && obact->mode & OB_MODE_SCULPT)
 		return OPERATOR_CANCELLED;
-	else if(obact && obact->mode & OB_MODE_PARTICLE_EDIT)
+	else if (obact && obact->mode & OB_MODE_PARTICLE_EDIT)
 		return PE_mouse_particles(C, event->mval, extend);
-	else if(obact && paint_facesel_test(obact))
+	else if (obact && paint_facesel_test(obact))
 		retval = paintface_mouse_select(C, obact, event->mval, extend);
 	else if (paint_vertsel_test(obact))
 		retval = mouse_weight_paint_vertex_select(C, event->mval, extend, obact);
@@ -2233,24 +2261,24 @@ static int view3d_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	 * FINISHED to signal one operator worked
 	 * */
 	if (retval)
-		return OPERATOR_PASS_THROUGH|OPERATOR_FINISHED;
+		return OPERATOR_PASS_THROUGH | OPERATOR_FINISHED;
 	else
-		return OPERATOR_PASS_THROUGH; /* nothing selected, just passthrough */
+		return OPERATOR_PASS_THROUGH;  /* nothing selected, just passthrough */
 }
 
 void VIEW3D_OT_select(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Activate/Select";
-	ot->description= "Activate/select item(s)";
-	ot->idname= "VIEW3D_OT_select";
+	ot->name = "Activate/Select";
+	ot->description = "Activate/select item(s)";
+	ot->idname = "VIEW3D_OT_select";
 	
 	/* api callbacks */
-	ot->invoke= view3d_select_invoke;
-	ot->poll= ED_operator_view3d_active;
+	ot->invoke = view3d_select_invoke;
+	ot->poll = ED_operator_view3d_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_UNDO;
+	ot->flag = OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first");
@@ -2269,45 +2297,45 @@ typedef struct CircleSelectUserData {
 	float radius;
 } CircleSelectUserData;
 
-static void mesh_circle_doSelectVert(void *userData, EditVert *eve, int x, int y, int UNUSED(index))
+static void mesh_circle_doSelectVert(void *userData, BMVert *eve, int x, int y, int UNUSED(index))
 {
 	CircleSelectUserData *data = userData;
 	int mx = x - data->mval[0], my = y - data->mval[1];
-	float r = sqrt(mx*mx + my*my);
+	float r = sqrt(mx * mx + my * my);
 
-	if (r<=data->radius) {
-		eve->f = data->select?(eve->f|1):(eve->f&~1);
+	if (r <= data->radius) {
+		BM_vert_select_set(data->vc->em->bm, eve, data->select);
 	}
 }
-static void mesh_circle_doSelectEdge(void *userData, EditEdge *eed, int x0, int y0, int x1, int y1, int UNUSED(index))
+static void mesh_circle_doSelectEdge(void *userData, BMEdge *eed, int x0, int y0, int x1, int y1, int UNUSED(index))
 {
 	CircleSelectUserData *data = userData;
 
 	if (edge_inside_circle(data->mval[0], data->mval[1], (short) data->radius, x0, y0, x1, y1)) {
-		EM_select_edge(eed, data->select);
+		BM_edge_select_set(data->vc->em->bm, eed, data->select);
 	}
 }
-static void mesh_circle_doSelectFace(void *userData, EditFace *efa, int x, int y, int UNUSED(index))
+static void mesh_circle_doSelectFace(void *userData, BMFace *efa, int x, int y, int UNUSED(index))
 {
 	CircleSelectUserData *data = userData;
 	int mx = x - data->mval[0], my = y - data->mval[1];
-	float r = sqrt(mx*mx + my*my);
+	float r = sqrt(mx * mx + my * my);
 	
-	if (r<=data->radius) {
-		EM_select_face_fgon(data->vc->em, efa, data->select);
+	if (r <= data->radius) {
+		BM_face_select_set(data->vc->em->bm, efa, data->select);
 	}
 }
 
 static void mesh_circle_select(ViewContext *vc, int select, const int mval[2], float rad)
 {
-	ToolSettings *ts= vc->scene->toolsettings;
+	ToolSettings *ts = vc->scene->toolsettings;
 	int bbsel;
 	CircleSelectUserData data;
 	
-	bbsel= EM_init_backbuf_circle(vc, mval[0], mval[1], (short)(rad+1.0f));
+	bbsel = EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0));
 	ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
 
-	vc->em= ((Mesh *)vc->obedit->data)->edit_mesh;
+	vc->em = BMEdit_FromObject(vc->obedit);
 
 	data.vc = vc;
 	data.select = select;
@@ -2315,62 +2343,65 @@ static void mesh_circle_select(ViewContext *vc, int select, const int mval[2], f
 	data.mval[1] = mval[1];
 	data.radius = rad;
 
-	if(ts->selectmode & SCE_SELECT_VERTEX) {
-		if(bbsel) {
-			EM_backbuf_checkAndSelectVerts(vc->em, select==LEFTMOUSE);
-		} else {
+	if (ts->selectmode & SCE_SELECT_VERTEX) {
+		if (bbsel) {
+			edbm_backbuf_check_and_select_verts(vc->em, select == LEFTMOUSE);
+		}
+		else {
 			mesh_foreachScreenVert(vc, mesh_circle_doSelectVert, &data, V3D_CLIP_TEST_RV3D_CLIPPING);
 		}
 	}
 
-	if(ts->selectmode & SCE_SELECT_EDGE) {
+	if (ts->selectmode & SCE_SELECT_EDGE) {
 		if (bbsel) {
-			EM_backbuf_checkAndSelectEdges(vc->em, select==LEFTMOUSE);
-		} else {
+			edbm_backbuf_check_and_select_edges(vc->em, select == LEFTMOUSE);
+		}
+		else {
 			mesh_foreachScreenEdge(vc, mesh_circle_doSelectEdge, &data, V3D_CLIP_TEST_OFF);
 		}
 	}
 	
-	if(ts->selectmode & SCE_SELECT_FACE) {
-		if(bbsel) {
-			EM_backbuf_checkAndSelectFaces(vc->em, select==LEFTMOUSE);
-		} else {
+	if (ts->selectmode & SCE_SELECT_FACE) {
+		if (bbsel) {
+			edbm_backbuf_check_and_select_faces(vc->em, select == LEFTMOUSE);
+		}
+		else {
 			mesh_foreachScreenFace(vc, mesh_circle_doSelectFace, &data);
 		}
 	}
 
-	EM_free_backbuf();
-	EM_selectmode_flush(vc->em);
+	EDBM_backbuf_free();
+	EDBM_selectmode_flush(vc->em);
 }
 
 static void paint_facesel_circle_select(ViewContext *vc, int select, const int mval[2], float rad)
 {
-	Object *ob= vc->obact;
-	Mesh *me = ob?ob->data:NULL;
+	Object *ob = vc->obact;
+	Mesh *me = ob ? ob->data : NULL;
 	/* int bbsel; */ /* UNUSED */
 
 	if (me) {
-		em_vertoffs= me->totface+1;	/* max index array */
+		bm_vertoffs = me->totpoly + 1; /* max index array */
 
-		/* bbsel= */ /* UNUSED */ EM_init_backbuf_circle(vc, mval[0], mval[1], (short)(rad+1.0f));
-		EM_backbuf_checkAndSelectTFaces(me, select==LEFTMOUSE);
-		EM_free_backbuf();
+		/* bbsel= */ /* UNUSED */ EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0));
+		edbm_backbuf_check_and_select_tfaces(me, select == LEFTMOUSE);
+		EDBM_backbuf_free();
 	}
 }
 
 
 static void paint_vertsel_circle_select(ViewContext *vc, int select, const int mval[2], float rad)
 {
-	Object *ob= vc->obact;
-	Mesh *me = ob?ob->data:NULL;
+	Object *ob = vc->obact;
+	Mesh *me = ob ? ob->data : NULL;
 	/* int bbsel; */ /* UNUSED */
 	/* CircleSelectUserData data = {NULL}; */ /* UNUSED */
 	if (me) {
-		em_vertoffs= me->totvert+1;	/* max index array */
+		bm_vertoffs = me->totvert + 1; /* max index array */
 
-		/* bbsel= */ /* UNUSED */ EM_init_backbuf_circle(vc, mval[0], mval[1], (short)(rad+1.0f));
-		EM_backbuf_checkAndSelectVerts_obmode(me, select==LEFTMOUSE);
-		EM_free_backbuf();
+		/* 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();
 
 		paintvert_flush_flags(ob);
 	}
@@ -2381,26 +2412,30 @@ static void nurbscurve_circle_doSelect(void *userData, Nurb *UNUSED(nu), BPoint
 {
 	CircleSelectUserData *data = userData;
 	int mx = x - data->mval[0], my = y - data->mval[1];
-	float r = sqrt(mx*mx + my*my);
-	Object *obedit= data->vc->obedit;
-	Curve *cu= (Curve*)obedit->data;
+	float r = sqrt(mx * mx + my * my);
+	Object *obedit = data->vc->obedit;
+	Curve *cu = (Curve *)obedit->data;
 
-	if (r<=data->radius) {
+	if (r <= data->radius) {
 		if (bp) {
-			bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT);
+			bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
 
 			if (bp == cu->lastsel && !(bp->f1 & 1)) cu->lastsel = NULL;
-		} else {
+		}
+		else {
 			if (cu->drawflag & CU_HIDE_HANDLES) {
 				/* can only be beztindex==0 here since handles are hidden */
-				bezt->f1 = bezt->f2 = bezt->f3 = data->select?(bezt->f2|SELECT):(bezt->f2&~SELECT);
-			} else {
-				if (beztindex==0) {
-					bezt->f1 = data->select?(bezt->f1|SELECT):(bezt->f1&~SELECT);
-				} else if (beztindex==1) {
-					bezt->f2 = data->select?(bezt->f2|SELECT):(bezt->f2&~SELECT);
-				} else {
-					bezt->f3 = data->select?(bezt->f3|SELECT):(bezt->f3&~SELECT);
+				bezt->f1 = bezt->f2 = bezt->f3 = data->select ? (bezt->f2 | SELECT) : (bezt->f2 & ~SELECT);
+			}
+			else {
+				if (beztindex == 0) {
+					bezt->f1 = data->select ? (bezt->f1 | SELECT) : (bezt->f1 & ~SELECT);
+				}
+				else if (beztindex == 1) {
+					bezt->f2 = data->select ? (bezt->f2 | SELECT) : (bezt->f2 & ~SELECT);
+				}
+				else {
+					bezt->f3 = data->select ? (bezt->f3 | SELECT) : (bezt->f3 & ~SELECT);
 				}
 			}
 
@@ -2429,10 +2464,10 @@ static void latticecurve_circle_doSelect(void *userData, BPoint *bp, int x, int
 {
 	CircleSelectUserData *data = userData;
 	int mx = x - data->mval[0], my = y - data->mval[1];
-	float r = sqrt(mx*mx + my*my);
+	float r = sqrt(mx * mx + my * my);
 
-	if (r<=data->radius) {
-		bp->f1 = data->select?(bp->f1|SELECT):(bp->f1&~SELECT);
+	if (r <= data->radius) {
+		bp->f1 = data->select ? (bp->f1 | SELECT) : (bp->f1 & ~SELECT);
 	}
 }
 static void lattice_circle_select(ViewContext *vc, int select, const int mval[2], float rad)
@@ -2456,7 +2491,7 @@ static short pchan_circle_doSelectJoint(void *userData, bPoseChannel *pchan, int
 {
 	CircleSelectUserData *data = userData;
 	int mx = x - data->mval[0], my = y - data->mval[1];
-	float r = sqrt(mx*mx + my*my);
+	float r = sqrt(mx * mx + my * my);
 	
 	if (r <= data->radius) {
 		if (data->select)
@@ -2473,7 +2508,7 @@ static void pose_circle_select(ViewContext *vc, int select, const int mval[2], f
 	bArmature *arm = vc->obact->data;
 	bPose *pose = vc->obact->pose;
 	bPoseChannel *pchan;
-	int change= FALSE;
+	int change = FALSE;
 	
 	/* set vc->edit data */
 	data.select = select;
@@ -2484,9 +2519,9 @@ 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 */
 	
 	/* check each PoseChannel... */
-	// TODO: could be optimised at some point
+	// TODO: could be optimized at some point
 	for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
-		short sco1[2], sco2[2], didpoint=0;
+		short sco1[2], sco2[2], didpoint = 0;
 		float vec[3];
 		
 		/* skip invisible bones */
@@ -2505,15 +2540,15 @@ static void pose_circle_select(ViewContext *vc, int select, const int mval[2], f
 		 *	- the call to check also does the selection already
 		 */
 		if (pchan_circle_doSelectJoint(&data, pchan, sco1[0], sco1[1]))
-			didpoint= 1;
+			didpoint = 1;
 		if (pchan_circle_doSelectJoint(&data, pchan, sco2[0], sco2[1]))
-			didpoint= 1;
+			didpoint = 1;
 		
 		change |= didpoint;
 	}
 
 	if (change) {
-		WM_main_add_notifier(NC_OBJECT|ND_BONE_SELECT, vc->obact);
+		WM_main_add_notifier(NC_OBJECT | ND_BONE_SELECT, vc->obact);
 	}
 }
 
@@ -2521,7 +2556,7 @@ static short armature_circle_doSelectJoint(void *userData, EditBone *ebone, int
 {
 	CircleSelectUserData *data = userData;
 	int mx = x - data->mval[0], my = y - data->mval[1];
-	float r = sqrt(mx*mx + my*my);
+	float r = sqrt(mx * mx + my * my);
 	
 	if (r <= data->radius) {
 		if (head) {
@@ -2543,9 +2578,9 @@ static short armature_circle_doSelectJoint(void *userData, EditBone *ebone, int
 static void armature_circle_select(ViewContext *vc, int select, const int mval[2], float rad)
 {
 	CircleSelectUserData data;
-	bArmature *arm= vc->obedit->data;
+	bArmature *arm = vc->obedit->data;
 	EditBone *ebone;
-	int change= FALSE;
+	int change = FALSE;
 	
 	/* set vc->edit data */
 	data.select = select;
@@ -2556,9 +2591,9 @@ static void armature_circle_select(ViewContext *vc, int select, const int mval[2
 	ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
 	
 	/* check each EditBone... */
-	// TODO: could be optimised at some point
-	for (ebone= arm->edbo->first; ebone; ebone=ebone->next) {
-		short sco1[2], sco2[2], didpoint=0;
+	// TODO: could be optimized at some point
+	for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
+		short sco1[2], sco2[2], didpoint = 0;
 		float vec[3];
 		
 		/* project head location to screenspace */
@@ -2573,27 +2608,27 @@ static void armature_circle_select(ViewContext *vc, int select, const int mval[2
 		 *	- the call to check also does the selection already
 		 */
 		if (armature_circle_doSelectJoint(&data, ebone, sco1[0], sco1[1], 1))
-			didpoint= 1;
+			didpoint = 1;
 		if (armature_circle_doSelectJoint(&data, ebone, sco2[0], sco2[1], 0))
-			didpoint= 1;
+			didpoint = 1;
 			
 		/* only if the endpoints didn't get selected, deal with the middle of the bone too */
 		// XXX should we just do this always?
-		if ( (didpoint==0) && edge_inside_circle(mval[0], mval[1], rad, sco1[0], sco1[1], sco2[0], sco2[1]) ) {
+		if ( (didpoint == 0) && edge_inside_circle(mval[0], mval[1], rad, sco1[0], sco1[1], sco2[0], sco2[1]) ) {
 			if (select) 
-				ebone->flag |= BONE_TIPSEL|BONE_ROOTSEL|BONE_SELECTED;
+				ebone->flag |= BONE_TIPSEL | BONE_ROOTSEL | BONE_SELECTED;
 			else 
-				ebone->flag &= ~(BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
-			change= TRUE;
+				ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
+			change = TRUE;
 		}
 		
 		change |= didpoint;
 	}
 
-	if(change) {
+	if (change) {
 		ED_armature_sync_selection(arm->edbo);
 		ED_armature_validate_active(arm);
-		WM_main_add_notifier(NC_OBJECT|ND_BONE_SELECT, vc->obedit);
+		WM_main_add_notifier(NC_OBJECT | ND_BONE_SELECT, vc->obedit);
 	}
 }
 
@@ -2601,43 +2636,43 @@ static void armature_circle_select(ViewContext *vc, int select, const int mval[2
 
 static void obedit_circle_select(ViewContext *vc, short select, const int mval[2], float rad)
 {
-	switch(vc->obedit->type) {		
-	case OB_MESH:
-		mesh_circle_select(vc, select, mval, rad);
-		break;
-	case OB_CURVE:
-	case OB_SURF:
-		nurbscurve_circle_select(vc, select, mval, rad);
-		break;
-	case OB_LATTICE:
-		lattice_circle_select(vc, select, mval, rad);
-		break;
-	case OB_ARMATURE:
-		armature_circle_select(vc, select, mval, rad);
-		break;
-	default:
-		return;
+	switch (vc->obedit->type) {
+		case OB_MESH:
+			mesh_circle_select(vc, select, mval, rad);
+			break;
+		case OB_CURVE:
+		case OB_SURF:
+			nurbscurve_circle_select(vc, select, mval, rad);
+			break;
+		case OB_LATTICE:
+			lattice_circle_select(vc, select, mval, rad);
+			break;
+		case OB_ARMATURE:
+			armature_circle_select(vc, select, mval, rad);
+			break;
+		default:
+			return;
 	}
 }
 
 /* not a real operator, only for circle test */
 static int view3d_circle_select_exec(bContext *C, wmOperator *op)
 {
-	ScrArea *sa= CTX_wm_area(C);
-	ARegion *ar= CTX_wm_region(C);
-	Scene *scene= CTX_data_scene(C);
-	Object *obact= CTX_data_active_object(C);
-	View3D *v3d= sa->spacedata.first;
-	int x= RNA_int_get(op->ptr, "x");
-	int y= RNA_int_get(op->ptr, "y");
-	int radius= RNA_int_get(op->ptr, "radius");
-	int gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
+	ScrArea *sa = CTX_wm_area(C);
+	ARegion *ar = CTX_wm_region(C);
+	Scene *scene = CTX_data_scene(C);
+	Object *obact = CTX_data_active_object(C);
+	View3D *v3d = sa->spacedata.first;
+	int x = RNA_int_get(op->ptr, "x");
+	int y = RNA_int_get(op->ptr, "y");
+	int radius = RNA_int_get(op->ptr, "radius");
+	int gesture_mode = RNA_int_get(op->ptr, "gesture_mode");
 	int select;
 	
-	select= (gesture_mode==GESTURE_MODAL_SELECT);
+	select = (gesture_mode == GESTURE_MODAL_SELECT);
 
-	if( CTX_data_edit_object(C) || paint_facesel_test(obact) || paint_vertsel_test(obact) ||
-		(obact && (obact->mode & (OB_MODE_PARTICLE_EDIT|OB_MODE_POSE))) )
+	if (CTX_data_edit_object(C) || paint_facesel_test(obact) || paint_vertsel_test(obact) ||
+	    (obact && (obact->mode & (OB_MODE_PARTICLE_EDIT | OB_MODE_POSE))) )
 	{
 		ViewContext vc;
 		int mval[2];
@@ -2645,45 +2680,45 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op)
 		view3d_operator_needs_opengl(C);
 		
 		view3d_set_viewcontext(C, &vc);
-		mval[0]= x;
-		mval[1]= y;
+		mval[0] = x;
+		mval[1] = y;
 
-		if(CTX_data_edit_object(C)) {
+		if (CTX_data_edit_object(C)) {
 			obedit_circle_select(&vc, select, mval, (float)radius);
-			WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obact->data);
+			WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data);
 		}
-		else if(paint_facesel_test(obact)) {
+		else if (paint_facesel_test(obact)) {
 			paint_facesel_circle_select(&vc, select, mval, (float)radius);
-			WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obact->data);
+			WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data);
 		}
-		else if(paint_vertsel_test(obact)) {
+		else if (paint_vertsel_test(obact)) {
 			paint_vertsel_circle_select(&vc, select, mval, (float)radius);
-			WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obact->data);
+			WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obact->data);
 		}
-		else if(obact->mode & OB_MODE_POSE)
+		else if (obact->mode & OB_MODE_POSE)
 			pose_circle_select(&vc, select, mval, (float)radius);
 		else
 			return PE_circle_select(C, select, mval, (float)radius);
 	}
-	else if(obact && obact->mode & OB_MODE_SCULPT) {
+	else if (obact && obact->mode & OB_MODE_SCULPT) {
 		return OPERATOR_CANCELLED;
 	}
 	else {
 		Base *base;
-		select= select?BA_SELECT:BA_DESELECT;
-		for(base= FIRSTBASE; base; base= base->next) {
-			if(BASE_SELECTABLE(v3d, base)) {
+		select = select ? BA_SELECT : BA_DESELECT;
+		for (base = FIRSTBASE; base; base = base->next) {
+			if (BASE_SELECTABLE(v3d, base)) {
 				project_short(ar, base->object->obmat[3], &base->sx);
-				if(base->sx!=IS_CLIPPED) {
-					int dx= base->sx-x;
-					int dy= base->sy-y;
-					if( dx*dx + dy*dy < radius*radius)
+				if (base->sx != IS_CLIPPED) {
+					int dx = base->sx - x;
+					int dy = base->sy - y;
+					if (dx * dx + dy * dy < radius * radius)
 						ED_base_object_select(base, select);
 				}
 			}
 		}
 		
-		WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
+		WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
 	}
 	
 	return OPERATOR_FINISHED;
@@ -2691,18 +2726,18 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op)
 
 void VIEW3D_OT_select_circle(wmOperatorType *ot)
 {
-	ot->name= "Circle Select";
-	ot->description= "Select items using circle selection";
-	ot->idname= "VIEW3D_OT_select_circle";
+	ot->name = "Circle Select";
+	ot->description = "Select items using circle selection";
+	ot->idname = "VIEW3D_OT_select_circle";
 	
-	ot->invoke= WM_gesture_circle_invoke;
-	ot->modal= WM_gesture_circle_modal;
-	ot->exec= view3d_circle_select_exec;
-	ot->poll= view3d_selectable_data;
-	ot->cancel= WM_gesture_circle_cancel;
+	ot->invoke = WM_gesture_circle_invoke;
+	ot->modal = WM_gesture_circle_modal;
+	ot->exec = view3d_circle_select_exec;
+	ot->poll = view3d_selectable_data;
+	ot->cancel = WM_gesture_circle_cancel;
 	
 	/* flags */
-	ot->flag= OPTYPE_UNDO;
+	ot->flag = OPTYPE_UNDO;
 	
 	RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX);
 	RNA_def_int(ot->srna, "y", 0, INT_MIN, INT_MAX, "Y", "", INT_MIN, INT_MAX);
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index 3665b0b..1c1fa4c 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -38,13 +38,13 @@
 #include "DNA_armature_types.h"
 #include "DNA_curve_types.h"
 #include "DNA_lattice_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_meta_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_object_types.h"
 
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
-#include "BLI_editVert.h"
 #include "BLI_linklist.h"
 #include "BLI_utildefines.h"
 
@@ -55,6 +55,8 @@
 #include "BKE_lattice.h"
 #include "BKE_main.h"
 #include "BKE_object.h"
+#include "BKE_tessmesh.h"
+#include "BKE_DerivedMesh.h"
 #include "BKE_scene.h"
 #include "BKE_tracking.h"
 
@@ -71,7 +73,7 @@
 
 #include "view3d_intern.h"
 
-extern float originmat[3][3];	/* XXX object.c */
+extern float originmat[3][3];   /* XXX object.c */
 
 /* ************************************************** */
 /* ********************* old transform stuff ******** */
@@ -80,57 +82,60 @@ extern float originmat[3][3];	/* XXX object.c */
 
 typedef struct TransVert {
 	float *loc;
-	float oldloc[3], fac;
+	float oldloc[3], maploc[3], fac;
 	float *val, oldval;
 	int flag;
 	float *nor;
 } TransVert;
 
-static TransVert *transvmain=NULL;
-static int tottrans= 0;
+              /* SELECT == (1 << 0) */
+#define TX_VERT_USE_MAPLOC (1 << 1)
+
+static TransVert *transvmain = NULL;
+static int tottrans = 0;
 
 /* copied from editobject.c, now uses (almost) proper depgraph */
 static void special_transvert_update(Object *obedit)
 {
-	if(obedit) {
+	if (obedit) {
 		DAG_id_tag_update(obedit->data, 0);
 		
-		if(obedit->type==OB_MESH) {
-			Mesh *me= obedit->data;
-			recalc_editnormals(me->edit_mesh);	// does face centers too
+		if (obedit->type == OB_MESH) {
+			Mesh *me = obedit->data;
+			BM_mesh_normals_update(me->edit_btmesh->bm, TRUE);  // does face centers too
 		}
 		else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
-			Curve *cu= obedit->data;
-			ListBase *nurbs= curve_editnurbs(cu);
-			Nurb *nu= nurbs->first;
+			Curve *cu = obedit->data;
+			ListBase *nurbs = curve_editnurbs(cu);
+			Nurb *nu = nurbs->first;
 
-			while(nu) {
+			while (nu) {
 				/* keep handles' vectors unchanged */
-				if(nu->bezt) {
-					int a= nu->pntsu;
-					TransVert *tv= transvmain;
-					BezTriple *bezt= nu->bezt;
+				if (nu->bezt) {
+					int a = nu->pntsu;
+					TransVert *tv = transvmain;
+					BezTriple *bezt = nu->bezt;
 
-					while(a--) {
-						if(bezt->f1 & SELECT) tv++;
+					while (a--) {
+						if (bezt->f1 & SELECT) tv++;
 
-						if(bezt->f2 & SELECT) {
+						if (bezt->f2 & SELECT) {
 							float v[3];
 
-							if(bezt->f1 & SELECT) {
-								sub_v3_v3v3(v, (tv-1)->oldloc, tv->oldloc);
+							if (bezt->f1 & SELECT) {
+								sub_v3_v3v3(v, (tv - 1)->oldloc, tv->oldloc);
 								add_v3_v3v3(bezt->vec[0], bezt->vec[1], v);
 							}
 
-							if(bezt->f3 & SELECT) {
-								sub_v3_v3v3(v, (tv+1)->oldloc, tv->oldloc);
+							if (bezt->f3 & SELECT) {
+								sub_v3_v3v3(v, (tv + 1)->oldloc, tv->oldloc);
 								add_v3_v3v3(bezt->vec[2], bezt->vec[1], v);
 							}
 
 							tv++;
 						}
 
-						if(bezt->f3 & SELECT) tv++;
+						if (bezt->f3 & SELECT) tv++;
 
 						bezt++;
 					}
@@ -138,17 +143,17 @@ static void special_transvert_update(Object *obedit)
 
 				test2DNurb(nu);
 				testhandlesNurb(nu); /* test for bezier too */
-				nu= nu->next;
+				nu = nu->next;
 			}
 		}
-		else if(obedit->type==OB_ARMATURE){
-			bArmature *arm= obedit->data;
+		else if (obedit->type == OB_ARMATURE) {
+			bArmature *arm = obedit->data;
 			EditBone *ebo;
-			TransVert *tv= transvmain;
-			int a=0;
+			TransVert *tv = transvmain;
+			int a = 0;
 			
 			/* Ensure all bone tails are correctly adjusted */
-			for (ebo= arm->edbo->first; ebo; ebo=ebo->next) {
+			for (ebo = arm->edbo->first; ebo; ebo = ebo->next) {
 				/* adjust tip if both ends selected */
 				if ((ebo->flag & BONE_ROOTSEL) && (ebo->flag & BONE_TIPSEL)) {
 					if (tv) {
@@ -158,121 +163,180 @@ static void special_transvert_update(Object *obedit)
 						add_v3_v3(ebo->tail, diffvec);
 						
 						a++;
-						if (a<tottrans) tv++;
+						if (a < tottrans) tv++;
 					}
 				}
 			}
 			
 			/* Ensure all bones are correctly adjusted */
-			for (ebo= arm->edbo->first; ebo; ebo=ebo->next) {
-				if ((ebo->flag & BONE_CONNECTED) && ebo->parent){
+			for (ebo = arm->edbo->first; ebo; ebo = ebo->next) {
+				if ((ebo->flag & BONE_CONNECTED) && ebo->parent) {
 					/* If this bone has a parent tip that has been moved */
-					if (ebo->parent->flag & BONE_TIPSEL){
+					if (ebo->parent->flag & BONE_TIPSEL) {
 						copy_v3_v3(ebo->head, ebo->parent->tail);
 					}
 					/* If this bone has a parent tip that has NOT been moved */
-					else{
+					else {
 						copy_v3_v3(ebo->parent->tail, ebo->head);
 					}
 				}
 			}
-			if(arm->flag & ARM_MIRROR_EDIT)
+			if (arm->flag & ARM_MIRROR_EDIT)
 				transform_armature_mirror_update(obedit);
 		}
-		else if(obedit->type==OB_LATTICE) {
-			Lattice *lt= obedit->data;
+		else if (obedit->type == OB_LATTICE) {
+			Lattice *lt = obedit->data;
 			
-			if(lt->editlatt->latt->flag & LT_OUTSIDE)
+			if (lt->editlatt->latt->flag & LT_OUTSIDE)
 				outside_lattice(lt->editlatt->latt);
 		}
 	}
 }
 
+static void set_mapped_co(void *vuserdata, int index, const float co[3],
+                          const float UNUSED(no[3]), const short UNUSED(no_s[3]))
+{
+	void **userdata = vuserdata;
+	BMEditMesh *em = userdata[0];
+	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;
+	}
+}
+
 /* 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) */
+#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, float *max, int mode)
 {
 	Nurb *nu;
 	BezTriple *bezt;
 	BPoint *bp;
-	TransVert *tv=NULL;
+	TransVert *tv = NULL;
 	MetaElem *ml;
-	EditVert *eve;
-	EditBone	*ebo;
+	BMVert *eve;
+	EditBone    *ebo;
 	float total, center[3], centroid[3];
 	int a;
 
-	tottrans= 0; // global!
+	tottrans = 0; // global!
 	
 	INIT_MINMAX(min, max);
-	centroid[0]=centroid[1]=centroid[2]= 0.0;
+	zero_v3(centroid);
 	
-	if(obedit->type==OB_MESH) {
-		Mesh *me= obedit->data;
-		EditMesh *em= me->edit_mesh;
+	if (obedit->type == OB_MESH) {
+		Mesh *me = obedit->data;
+		BMEditMesh *em = me->edit_btmesh;
+		BMesh *bm = em->bm;
+		BMIter iter;
+		void *userdata[2] = {em, NULL};
+		/*int proptrans= 0; */ /*UNUSED*/
 		
+		/* abuses vertex index all over, set, just set dirty here,
+		 * perhaps this could use its own array instead? - campbell */
+
 		// transform now requires awareness for select mode, so we tag the f1 flags in verts
-		tottrans= 0;
-		if(em->selectmode & SCE_SELECT_VERTEX) {
-			for(eve= em->verts.first; eve; eve= eve->next) {
-				if(eve->h==0 && (eve->f & SELECT)) {
-					eve->f1= SELECT;
+		tottrans = 0;
+		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! */
 					tottrans++;
 				}
-				else eve->f1= 0;
+				else BM_elem_index_set(eve, 0);  /* set_dirty! */
 			}
 		}
-		else if(em->selectmode & SCE_SELECT_EDGE) {
-			EditEdge *eed;
-			for(eve= em->verts.first; eve; eve= eve->next) eve->f1= 0;
-			for(eed= em->edges.first; eed; eed= eed->next) {
-				if(eed->h==0 && (eed->f & SELECT)) eed->v1->f1= eed->v2->f1= SELECT;
+		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_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_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
+				if (BM_elem_index_get(eve)) tottrans++;
 			}
-			for(eve= em->verts.first; eve; eve= eve->next) if(eve->f1) tottrans++;
 		}
 		else {
-			EditFace *efa;
-			for(eve= em->verts.first; eve; eve= eve->next) eve->f1= 0;
-			for(efa= em->faces.first; efa; efa= efa->next) {
-				if(efa->h==0 && (efa->f & SELECT)) {
-					efa->v1->f1= efa->v2->f1= efa->v3->f1= SELECT;
-					if(efa->v4) efa->v4->f1= SELECT;
+			BMFace *efa;
+
+			BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
+				BM_elem_index_set(eve, 0); /* set_dirty! */
+			}
+
+			BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+				if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
+					BMIter liter;
+					BMLoop *l;
+					
+					BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+						BM_elem_index_set(l->v, 1); /* set_dirty! */
+					}
 				}
 			}
-			for(eve= em->verts.first; eve; eve= eve->next) if(eve->f1) tottrans++;
+
+			BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
+				if (BM_elem_index_get(eve)) tottrans++;
+			}
 		}
+		/* for any of the 3 loops above which all dirty the indices */
+		bm->elem_index_dirty |= BM_VERT;
 		
 		/* and now make transverts */
-		if(tottrans) {
-			tv=transvmain= MEM_callocN(tottrans*sizeof(TransVert), "maketransverts");
-
-			for(eve= em->verts.first; eve; eve= eve->next) {
-				if(eve->f1) {
+		if (tottrans) {
+			tv = transvmain = MEM_callocN(tottrans * sizeof(TransVert), "maketransverts");
+		
+			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! */
 					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= eve->f1 & SELECT;
+					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++;
+					a++;
+				}
+				else {
+					BM_elem_index_set(eve, -1); /* set_dirty! */
 				}
 			}
+			/* set dirty already, above */
+
+			userdata[1] = transvmain;
+		}
+		
+		if (transvmain && em->derivedCage) {
+			EDBM_index_arrays_init(em, 1, 0, 0);
+			em->derivedCage->foreachMappedVert(em->derivedCage, set_mapped_co, userdata);
+			EDBM_index_arrays_free(em);
 		}
 	}
-	else if (obedit->type==OB_ARMATURE){
-		bArmature *arm= obedit->data;
-		int totmalloc= BLI_countlist(arm->edbo);
+	else if (obedit->type == OB_ARMATURE) {
+		bArmature *arm = obedit->data;
+		int totmalloc = BLI_countlist(arm->edbo);
 
 		totmalloc *= 2;  /* probably overkill but bones can have 2 trans verts each */
 
-		tv=transvmain= MEM_callocN(totmalloc*sizeof(TransVert), "maketransverts armature");
+		tv = transvmain = MEM_callocN(totmalloc * sizeof(TransVert), "maketransverts armature");
 		
-		for (ebo= arm->edbo->first; ebo; ebo=ebo->next){
-			if(ebo->layer & arm->layer) {
-				short tipsel= (ebo->flag & BONE_TIPSEL);
-				short rootsel= (ebo->flag & BONE_ROOTSEL);
-				short rootok= (!(ebo->parent && (ebo->flag & BONE_CONNECTED) && ebo->parent->flag & BONE_TIPSEL));
+		for (ebo = arm->edbo->first; ebo; ebo = ebo->next) {
+			if (ebo->layer & arm->layer) {
+				short tipsel = (ebo->flag & BONE_TIPSEL);
+				short rootsel = (ebo->flag & BONE_ROOTSEL);
+				short rootok = (!(ebo->parent && (ebo->flag & BONE_CONNECTED) && (ebo->parent->flag & BONE_TIPSEL)));
 				
 				if ((tipsel && rootsel) || (rootsel)) {
 					/* Don't add the tip (unless mode & TM_ALL_JOINTS, for getting all joints),
@@ -281,27 +345,27 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
 					 */
 					if (rootok) {
 						copy_v3_v3(tv->oldloc, ebo->head);
-						tv->loc= ebo->head;
-						tv->nor= NULL;
-						tv->flag= 1;
+						tv->loc = ebo->head;
+						tv->nor = NULL;
+						tv->flag = 1;
 						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->loc = ebo->tail;
+						tv->nor = NULL;
+						tv->flag = 1;
 						tv++;
 						tottrans++;
 					}
 				}
 				else if (tipsel) {
 					copy_v3_v3(tv->oldloc, ebo->tail);
-					tv->loc= ebo->tail;
-					tv->nor= NULL;
-					tv->flag= 1;
+					tv->loc = ebo->tail;
+					tv->nor = NULL;
+					tv->flag = 1;
 					tv++;
 					tottrans++;
 				}
@@ -309,49 +373,49 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
 		}
 	}
 	else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
-		Curve *cu= obedit->data;
-		int totmalloc= 0;
-		ListBase *nurbs= curve_editnurbs(cu);
+		Curve *cu = obedit->data;
+		int totmalloc = 0;
+		ListBase *nurbs = curve_editnurbs(cu);
 
-		for(nu= nurbs->first; nu; nu= nu->next) {
-			if(nu->type == CU_BEZIER)
-				totmalloc += 3*nu->pntsu;
+		for (nu = nurbs->first; nu; nu = nu->next) {
+			if (nu->type == CU_BEZIER)
+				totmalloc += 3 * nu->pntsu;
 			else
-				totmalloc += nu->pntsu*nu->pntsv;
+				totmalloc += nu->pntsu * nu->pntsv;
 		}
-		tv=transvmain= MEM_callocN(totmalloc*sizeof(TransVert), "maketransverts curve");
-
-		nu= nurbs->first;
-		while(nu) {
-			if(nu->type == CU_BEZIER) {
-				a= nu->pntsu;
-				bezt= nu->bezt;
-				while(a--) {
-					if(bezt->hide==0) {
-						int skip_handle= 0;
-						if(bezt->f2 & SELECT)
-							skip_handle= mode & TM_SKIP_HANDLES;
-
-						if((bezt->f1 & SELECT) && !skip_handle) {
+		tv = transvmain = MEM_callocN(totmalloc * sizeof(TransVert), "maketransverts curve");
+
+		nu = nurbs->first;
+		while (nu) {
+			if (nu->type == CU_BEZIER) {
+				a = nu->pntsu;
+				bezt = nu->bezt;
+				while (a--) {
+					if (bezt->hide == 0) {
+						int skip_handle = 0;
+						if (bezt->f2 & SELECT)
+							skip_handle = mode & TM_SKIP_HANDLES;
+
+						if ((bezt->f1 & SELECT) && !skip_handle) {
 							copy_v3_v3(tv->oldloc, bezt->vec[0]);
-							tv->loc= bezt->vec[0];
-							tv->flag= bezt->f1 & SELECT;
+							tv->loc = bezt->vec[0];
+							tv->flag = bezt->f1 & SELECT;
 							tv++;
 							tottrans++;
 						}
-						if(bezt->f2 & SELECT) {
+						if (bezt->f2 & SELECT) {
 							copy_v3_v3(tv->oldloc, bezt->vec[1]);
-							tv->loc= bezt->vec[1];
-							tv->val= &(bezt->alfa);
-							tv->oldval= bezt->alfa;
-							tv->flag= bezt->f2 & SELECT;
+							tv->loc = bezt->vec[1];
+							tv->val = &(bezt->alfa);
+							tv->oldval = bezt->alfa;
+							tv->flag = bezt->f2 & SELECT;
 							tv++;
 							tottrans++;
 						}
-						if((bezt->f3 & SELECT) && !skip_handle) {
+						if ((bezt->f3 & SELECT) && !skip_handle) {
 							copy_v3_v3(tv->oldloc, bezt->vec[2]);
-							tv->loc= bezt->vec[2];
-							tv->flag= bezt->f3 & SELECT;
+							tv->loc = bezt->vec[2];
+							tv->flag = bezt->f3 & SELECT;
 							tv++;
 							tottrans++;
 						}
@@ -360,16 +424,16 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
 				}
 			}
 			else {
-				a= nu->pntsu*nu->pntsv;
-				bp= nu->bp;
-				while(a--) {
-					if(bp->hide==0) {
-						if(bp->f1 & SELECT) {
+				a = nu->pntsu * nu->pntsv;
+				bp = nu->bp;
+				while (a--) {
+					if (bp->hide == 0) {
+						if (bp->f1 & SELECT) {
 							copy_v3_v3(tv->oldloc, bp->vec);
-							tv->loc= bp->vec;
-							tv->val= &(bp->alfa);
-							tv->oldval= bp->alfa;
-							tv->flag= bp->f1 & SELECT;
+							tv->loc = bp->vec;
+							tv->val = &(bp->alfa);
+							tv->oldval = bp->alfa;
+							tv->flag = bp->f1 & SELECT;
 							tv++;
 							tottrans++;
 						}
@@ -377,44 +441,44 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
 					bp++;
 				}
 			}
-			nu= nu->next;
+			nu = nu->next;
 		}
 	}
-	else if(obedit->type==OB_MBALL) {
-		MetaBall *mb= obedit->data;
-		int totmalloc= BLI_countlist(mb->editelems);
+	else if (obedit->type == OB_MBALL) {
+		MetaBall *mb = obedit->data;
+		int totmalloc = BLI_countlist(mb->editelems);
 		
-		tv=transvmain= MEM_callocN(totmalloc*sizeof(TransVert), "maketransverts mball");
+		tv = transvmain = MEM_callocN(totmalloc * sizeof(TransVert), "maketransverts mball");
 		
-		ml= mb->editelems->first;
-		while(ml) {
-			if(ml->flag & SELECT) {
-				tv->loc= &ml->x;
+		ml = mb->editelems->first;
+		while (ml) {
+			if (ml->flag & SELECT) {
+				tv->loc = &ml->x;
 				copy_v3_v3(tv->oldloc, tv->loc);
-				tv->val= &(ml->rad);
-				tv->oldval= ml->rad;
-				tv->flag= 1;
+				tv->val = &(ml->rad);
+				tv->oldval = ml->rad;
+				tv->flag = 1;
 				tv++;
 				tottrans++;
 			}
-			ml= ml->next;
+			ml = ml->next;
 		}
 	}
-	else if(obedit->type==OB_LATTICE) {
-		Lattice *lt= obedit->data;
+	else if (obedit->type == OB_LATTICE) {
+		Lattice *lt = obedit->data;
 		
-		bp= lt->editlatt->latt->def;
+		bp = lt->editlatt->latt->def;
 		
-		a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
+		a = lt->editlatt->latt->pntsu * lt->editlatt->latt->pntsv * lt->editlatt->latt->pntsw;
 		
-		tv=transvmain= MEM_callocN(a*sizeof(TransVert), "maketransverts latt");
+		tv = transvmain = MEM_callocN(a * sizeof(TransVert), "maketransverts latt");
 		
-		while(a--) {
-			if(bp->f1 & SELECT) {
-				if(bp->hide==0) {
+		while (a--) {
+			if (bp->f1 & SELECT) {
+				if (bp->hide == 0) {
 					copy_v3_v3(tv->oldloc, bp->vec);
-					tv->loc= bp->vec;
-					tv->flag= bp->f1 & SELECT;
+					tv->loc = bp->vec;
+					tv->flag = bp->f1 & SELECT;
 					tv++;
 					tottrans++;
 				}
@@ -423,25 +487,25 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
 		}
 	}
 	
-	if(!tottrans && transvmain) {
+	if (!tottrans && transvmain) {
 		/* prevent memory leak. happens for curves/latticies due to */
 		/* difficult condition of adding points to trans data */
 		MEM_freeN(transvmain);
-		transvmain= NULL;
+		transvmain = NULL;
 	}
 
 	/* cent etc */
-	tv= transvmain;
-	total= 0.0;
-	for(a=0; a<tottrans; a++, tv++) {
-		if(tv->flag & SELECT) {
+	tv = transvmain;
+	total = 0.0;
+	for (a = 0; a < tottrans; a++, tv++) {
+		if (tv->flag & SELECT) {
 			add_v3_v3(centroid, tv->oldloc);
 			total += 1.0f;
 			DO_MINMAX(tv->oldloc, min, max);
 		}
 	}
-	if(total != 0.0f) {
-		mul_v3_fl(centroid, 1.0f/total);
+	if (total != 0.0f) {
+		mul_v3_fl(centroid, 1.0f / total);
 	}
 
 	mid_v3_v3v3(center, min, max);
@@ -451,34 +515,34 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode)
 
 static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
 {
-	Main *bmain= CTX_data_main(C);
-	Object *obedit= CTX_data_edit_object(C);
-	Scene *scene= CTX_data_scene(C);
-	RegionView3D *rv3d= CTX_wm_region_data(C);
+	Main *bmain = CTX_data_main(C);
+	Object *obedit = CTX_data_edit_object(C);
+	Scene *scene = CTX_data_scene(C);
+	RegionView3D *rv3d = CTX_wm_region_data(C);
 	TransVert *tv;
 	float gridf, imat[3][3], bmat[3][3], vec[3];
 	int a;
 
-	gridf= rv3d->gridview;
+	gridf = rv3d->gridview;
 
-	if(obedit) {
-		tottrans= 0;
+	if (obedit) {
+		tottrans = 0;
 		
-		if ELEM6(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL)
+		if (ELEM6(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL))
 			make_trans_verts(obedit, bmat[0], bmat[1], 0);
-		if(tottrans==0) return OPERATOR_CANCELLED;
+		if (tottrans == 0) return OPERATOR_CANCELLED;
 		
 		copy_m3_m4(bmat, obedit->obmat);
 		invert_m3_m3(imat, bmat);
 		
-		tv= transvmain;
-		for(a=0; a<tottrans; a++, tv++) {
+		tv = transvmain;
+		for (a = 0; a < tottrans; a++, tv++) {
 			copy_v3_v3(vec, tv->loc);
 			mul_m3_v3(bmat, vec);
 			add_v3_v3(vec, obedit->obmat[3]);
-			vec[0]= gridf*floorf(0.5f+ vec[0]/gridf);
-			vec[1]= gridf*floorf(0.5f+ vec[1]/gridf);
-			vec[2]= gridf*floorf(0.5f+ vec[2]/gridf);
+			vec[0] = gridf * floorf(0.5f + vec[0] / gridf);
+			vec[1] = gridf * floorf(0.5f + vec[1] / gridf);
+			vec[2] = gridf * floorf(0.5f + vec[2] / gridf);
 			sub_v3_v3(vec, obedit->obmat[3]);
 			
 			mul_m3_v3(imat, vec);
@@ -488,31 +552,31 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
 		special_transvert_update(obedit);
 		
 		MEM_freeN(transvmain);
-		transvmain= NULL;
+		transvmain = NULL;
 	}
 	else {
 		struct KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_LOCATION_ID);
 
-		CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
-			if(ob->mode & OB_MODE_POSE) {
+		CTX_DATA_BEGIN(C, Object *, ob, selected_editable_objects) {
+			if (ob->mode & OB_MODE_POSE) {
 				bPoseChannel *pchan;
-				bArmature *arm= ob->data;
+				bArmature *arm = ob->data;
 				
 				invert_m4_m4(ob->imat, ob->obmat);
 				
-				for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
-					if(pchan->bone->flag & BONE_SELECTED) {
-						if(pchan->bone->layer & arm->layer) {
-							if((pchan->bone->flag & BONE_CONNECTED)==0) {
+				for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+					if (pchan->bone->flag & BONE_SELECTED) {
+						if (pchan->bone->layer & arm->layer) {
+							if ((pchan->bone->flag & BONE_CONNECTED) == 0) {
 								float nLoc[3];
 								
 								/* get nearest grid point to snap to */
 								copy_v3_v3(nLoc, pchan->pose_mat[3]);
 								/* We must operate in world space! */
 								mul_m4_v3(ob->obmat, nLoc);
-								vec[0]= gridf * (float)(floor(0.5f+ nLoc[0]/gridf));
-								vec[1]= gridf * (float)(floor(0.5f+ nLoc[1]/gridf));
-								vec[2]= gridf * (float)(floor(0.5f+ nLoc[2]/gridf));
+								vec[0] = gridf * (float)(floor(0.5f + nLoc[0] / gridf));
+								vec[1] = gridf * (float)(floor(0.5f + nLoc[1] / gridf));
+								vec[2] = gridf * (float)(floor(0.5f + nLoc[2] / gridf));
 								/* Back in object space... */
 								mul_m4_v3(ob->imat, vec);
 								
@@ -520,12 +584,12 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
 								armature_loc_pose_to_bone(pchan, vec, vec);
 								
 								/* adjust location */
-								if ((pchan->protectflag & OB_LOCK_LOCX)==0)
-									pchan->loc[0]= vec[0];
-								if ((pchan->protectflag & OB_LOCK_LOCY)==0)
-									pchan->loc[1]= vec[1];
-								if ((pchan->protectflag & OB_LOCK_LOCZ)==0)
-									pchan->loc[2]= vec[2];
+								if ((pchan->protectflag & OB_LOCK_LOCX) == 0)
+									pchan->loc[0] = vec[0];
+								if ((pchan->protectflag & OB_LOCK_LOCY) == 0)
+									pchan->loc[1] = vec[1];
+								if ((pchan->protectflag & OB_LOCK_LOCZ) == 0)
+									pchan->loc[2] = vec[2];
 
 								/* auto-keyframing */
 								ED_autokeyframe_pchan(C, scene, ob, pchan, ks);
@@ -536,29 +600,29 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
 						}
 					}
 				}
-				ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
+				ob->pose->flag |= (POSE_LOCKED | POSE_DO_UNLOCK);
 				
 				DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 			}
 			else {
 				ob->recalc |= OB_RECALC_OB;
 				
-				vec[0]= -ob->obmat[3][0]+gridf*floorf(0.5f+ ob->obmat[3][0]/gridf);
-				vec[1]= -ob->obmat[3][1]+gridf*floorf(0.5f+ ob->obmat[3][1]/gridf);
-				vec[2]= -ob->obmat[3][2]+gridf*floorf(0.5f+ ob->obmat[3][2]/gridf);
+				vec[0] = -ob->obmat[3][0] + gridf *floorf(0.5f + ob->obmat[3][0] / gridf);
+				vec[1] = -ob->obmat[3][1] + gridf *floorf(0.5f + ob->obmat[3][1] / gridf);
+				vec[2] = -ob->obmat[3][2] + gridf *floorf(0.5f + ob->obmat[3][2] / gridf);
 				
-				if(ob->parent) {
+				if (ob->parent) {
 					where_is_object(scene, ob);
 					
 					invert_m3_m3(imat, originmat);
 					mul_m3_v3(imat, vec);
 				}
-				if ((ob->protectflag & OB_LOCK_LOCX)==0)
-					ob->loc[0]+= vec[0];
-				if ((ob->protectflag & OB_LOCK_LOCY)==0)
-					ob->loc[1]+= vec[1];
-				if ((ob->protectflag & OB_LOCK_LOCZ)==0)
-					ob->loc[2]+= vec[2];
+				if ((ob->protectflag & OB_LOCK_LOCX) == 0)
+					ob->loc[0] += vec[0];
+				if ((ob->protectflag & OB_LOCK_LOCY) == 0)
+					ob->loc[1] += vec[1];
+				if ((ob->protectflag & OB_LOCK_LOCZ) == 0)
+					ob->loc[2] += vec[2];
 				
 				/* auto-keyframing */
 				ED_autokeyframe_object(C, scene, ob, ks);
@@ -568,7 +632,7 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
 	}
 
 	DAG_ids_flush_update(bmain, 0);
-	WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+	WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
 	
 	return OPERATOR_FINISHED;
 }
@@ -576,44 +640,44 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op))
 void VIEW3D_OT_snap_selected_to_grid(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Snap Selection to Grid";
-	ot->description= "Snap selected item(s) to nearest grid node";
-	ot->idname= "VIEW3D_OT_snap_selected_to_grid";
+	ot->name = "Snap Selection to Grid";
+	ot->description = "Snap selected item(s) to nearest grid node";
+	ot->idname = "VIEW3D_OT_snap_selected_to_grid";
 	
 	/* api callbacks */
-	ot->exec= snap_sel_to_grid;
-	ot->poll= ED_operator_region_view3d_active;
+	ot->exec = snap_sel_to_grid;
+	ot->poll = ED_operator_region_view3d_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /* *************************************************** */
 
 static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
 {
-	Main *bmain= CTX_data_main(C);
-	Object *obedit= CTX_data_edit_object(C);
-	Scene *scene= CTX_data_scene(C);
-	View3D *v3d= CTX_wm_view3d(C);
+	Main *bmain = CTX_data_main(C);
+	Object *obedit = CTX_data_edit_object(C);
+	Scene *scene = CTX_data_scene(C);
+	View3D *v3d = CTX_wm_view3d(C);
 	TransVert *tv;
 	float *curs, imat[3][3], bmat[3][3], vec[3];
 	int a;
 
-	curs= give_cursor(scene, v3d);
+	curs = give_cursor(scene, v3d);
 
-	if(obedit) {
-		tottrans= 0;
+	if (obedit) {
+		tottrans = 0;
 		
-		if ELEM6(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL)
+		if (ELEM6(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL))
 			make_trans_verts(obedit, bmat[0], bmat[1], 0);
-		if(tottrans==0) return OPERATOR_CANCELLED;
+		if (tottrans == 0) return OPERATOR_CANCELLED;
 		
 		copy_m3_m4(bmat, obedit->obmat);
 		invert_m3_m3(imat, bmat);
 		
-		tv= transvmain;
-		for(a=0; a<tottrans; a++, tv++) {
+		tv = transvmain;
+		for (a = 0; a < tottrans; a++, tv++) {
 			sub_v3_v3v3(vec, curs, obedit->obmat[3]);
 			mul_m3_v3(imat, vec);
 			copy_v3_v3(tv->loc, vec);
@@ -622,34 +686,34 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
 		special_transvert_update(obedit);
 		
 		MEM_freeN(transvmain);
-		transvmain= NULL;
+		transvmain = NULL;
 	}
 	else {
 		struct KeyingSet *ks = ANIM_get_keyingset_for_autokeying(scene, ANIM_KS_LOCATION_ID);
 
-		CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) {
-			if(ob->mode & OB_MODE_POSE) {
+		CTX_DATA_BEGIN(C, Object *, ob, selected_editable_objects) {
+			if (ob->mode & OB_MODE_POSE) {
 				bPoseChannel *pchan;
-				bArmature *arm= ob->data;
+				bArmature *arm = ob->data;
 				
 				invert_m4_m4(ob->imat, ob->obmat);
 				copy_v3_v3(vec, curs);
 				mul_m4_v3(ob->imat, vec);
 				
-				for (pchan = ob->pose->chanbase.first; pchan; pchan=pchan->next) {
-					if(pchan->bone->flag & BONE_SELECTED) {
-						if(pchan->bone->layer & arm->layer) {
-							if((pchan->bone->flag & BONE_CONNECTED)==0) {
+				for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+					if (pchan->bone->flag & BONE_SELECTED) {
+						if (pchan->bone->layer & arm->layer) {
+							if ((pchan->bone->flag & BONE_CONNECTED) == 0) {
 								/* Get position in pchan (pose) space. */
 								armature_loc_pose_to_bone(pchan, vec, vec);
 
 								/* copy new position */
-								if ((pchan->protectflag & OB_LOCK_LOCX)==0)
-									pchan->loc[0]= vec[0];
-								if ((pchan->protectflag & OB_LOCK_LOCY)==0)
-									pchan->loc[1]= vec[1];
-								if ((pchan->protectflag & OB_LOCK_LOCZ)==0)
-									pchan->loc[2]= vec[2];
+								if ((pchan->protectflag & OB_LOCK_LOCX) == 0)
+									pchan->loc[0] = vec[0];
+								if ((pchan->protectflag & OB_LOCK_LOCY) == 0)
+									pchan->loc[1] = vec[1];
+								if ((pchan->protectflag & OB_LOCK_LOCZ) == 0)
+									pchan->loc[2] = vec[2];
 
 								/* auto-keyframing */
 								ED_autokeyframe_pchan(C, scene, ob, pchan, ks);
@@ -660,29 +724,29 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
 						}
 					}
 				}
-				ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
+				ob->pose->flag |= (POSE_LOCKED | POSE_DO_UNLOCK);
 				
 				DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 			}
 			else {
 				ob->recalc |= OB_RECALC_OB;
 				
-				vec[0]= -ob->obmat[3][0] + curs[0];
-				vec[1]= -ob->obmat[3][1] + curs[1];
-				vec[2]= -ob->obmat[3][2] + curs[2];
+				vec[0] = -ob->obmat[3][0] + curs[0];
+				vec[1] = -ob->obmat[3][1] + curs[1];
+				vec[2] = -ob->obmat[3][2] + curs[2];
 				
-				if(ob->parent) {
+				if (ob->parent) {
 					where_is_object(scene, ob);
 					
 					invert_m3_m3(imat, originmat);
 					mul_m3_v3(imat, vec);
 				}
-				if ((ob->protectflag & OB_LOCK_LOCX)==0)
-					ob->loc[0]+= vec[0];
-				if ((ob->protectflag & OB_LOCK_LOCY)==0)
-					ob->loc[1]+= vec[1];
-				if ((ob->protectflag & OB_LOCK_LOCZ)==0)
-					ob->loc[2]+= vec[2];
+				if ((ob->protectflag & OB_LOCK_LOCX) == 0)
+					ob->loc[0] += vec[0];
+				if ((ob->protectflag & OB_LOCK_LOCY) == 0)
+					ob->loc[1] += vec[1];
+				if ((ob->protectflag & OB_LOCK_LOCZ) == 0)
+					ob->loc[2] += vec[2];
 
 				/* auto-keyframing */
 				ED_autokeyframe_object(C, scene, ob, ks);
@@ -692,7 +756,7 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
 	}
 
 	DAG_ids_flush_update(bmain, 0);
-	WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+	WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
 	
 	return OPERATOR_FINISHED;
 }
@@ -700,35 +764,35 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op))
 void VIEW3D_OT_snap_selected_to_cursor(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Snap Selection to Cursor";
-	ot->description= "Snap selected item(s) to cursor";
-	ot->idname= "VIEW3D_OT_snap_selected_to_cursor";
+	ot->name = "Snap Selection to Cursor";
+	ot->description = "Snap selected item(s) to cursor";
+	ot->idname = "VIEW3D_OT_snap_selected_to_cursor";
 	
 	/* api callbacks */
-	ot->exec= snap_sel_to_curs;
-	ot->poll= ED_operator_view3d_active;
+	ot->exec = snap_sel_to_curs;
+	ot->poll = ED_operator_view3d_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /* *************************************************** */
 
 static int snap_curs_to_grid(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
-	RegionView3D *rv3d= CTX_wm_region_data(C);
-	View3D *v3d= CTX_wm_view3d(C);
+	Scene *scene = CTX_data_scene(C);
+	RegionView3D *rv3d = CTX_wm_region_data(C);
+	View3D *v3d = CTX_wm_view3d(C);
 	float gridf, *curs;
 
-	gridf= rv3d->gridview;
-	curs= give_cursor(scene, v3d);
+	gridf = rv3d->gridview;
+	curs = give_cursor(scene, v3d);
 
-	curs[0]= gridf*floorf(0.5f+curs[0]/gridf);
-	curs[1]= gridf*floorf(0.5f+curs[1]/gridf);
-	curs[2]= gridf*floorf(0.5f+curs[2]/gridf);
+	curs[0] = gridf * floorf(0.5f + curs[0] / gridf);
+	curs[1] = gridf * floorf(0.5f + curs[1] / gridf);
+	curs[2] = gridf * floorf(0.5f + curs[2] / gridf);
 	
-	WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d);	// hrm
+	WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);    // hrm
 	
 	return OPERATOR_FINISHED;
 }
@@ -736,32 +800,32 @@ static int snap_curs_to_grid(bContext *C, wmOperator *UNUSED(op))
 void VIEW3D_OT_snap_cursor_to_grid(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Snap Cursor to Grid";
-	ot->description= "Snap cursor to nearest grid node";
-	ot->idname= "VIEW3D_OT_snap_cursor_to_grid";
+	ot->name = "Snap Cursor to Grid";
+	ot->description = "Snap cursor to nearest grid node";
+	ot->idname = "VIEW3D_OT_snap_cursor_to_grid";
 	
 	/* api callbacks */
-	ot->exec= snap_curs_to_grid;
-	ot->poll= ED_operator_region_view3d_active;
+	ot->exec = snap_curs_to_grid;
+	ot->poll = ED_operator_region_view3d_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /* **************************************************** */
 
 static void bundle_midpoint(Scene *scene, Object *ob, float vec[3])
 {
-	MovieClip *clip= object_get_movieclip(scene, ob, 0);
+	MovieClip *clip = object_get_movieclip(scene, ob, 0);
 	MovieTracking *tracking;
 	MovieTrackingObject *object;
-	int ok= 0;
+	int ok = 0;
 	float min[3], max[3], mat[4][4], pos[3], cammat[4][4] = MAT4_UNITY;
 
-	if(!clip)
+	if (!clip)
 		return;
 
-	tracking= &clip->tracking;
+	tracking = &clip->tracking;
 
 	copy_m4_m4(cammat, ob->obmat);
 
@@ -769,12 +833,12 @@ static void bundle_midpoint(Scene *scene, Object *ob, float vec[3])
 
 	INIT_MINMAX(min, max);
 
-	for (object= tracking->objects.first; object; object= object->next) {
-		ListBase *tracksbase= BKE_tracking_object_tracks(tracking, object);
-		MovieTrackingTrack *track= tracksbase->first;
+	for (object = tracking->objects.first; object; object = object->next) {
+		ListBase *tracksbase = BKE_tracking_object_tracks(tracking, object);
+		MovieTrackingTrack *track = tracksbase->first;
 		float obmat[4][4];
 
-		if(object->flag & TRACKING_OBJECT_CAMERA) {
+		if (object->flag & TRACKING_OBJECT_CAMERA) {
 			copy_m4_m4(obmat, mat);
 		}
 		else {
@@ -786,48 +850,48 @@ static void bundle_midpoint(Scene *scene, Object *ob, float vec[3])
 			mult_m4_m4m4(obmat, cammat, imat);
 		}
 
-		while(track) {
-			if((track->flag&TRACK_HAS_BUNDLE) && TRACK_SELECTED(track)) {
-				ok= 1;
+		while (track) {
+			if ((track->flag & TRACK_HAS_BUNDLE) && TRACK_SELECTED(track)) {
+				ok = 1;
 				mul_v3_m4v3(pos, obmat, track->bundle_pos);
 				DO_MINMAX(pos, min, max);
 			}
 
-			track= track->next;
+			track = track->next;
 		}
 	}
 
-	if(ok) {
+	if (ok) {
 		mid_v3_v3v3(vec, min, max);
 	}
 }
 
 static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
 {
-	Object *obedit= CTX_data_edit_object(C);
-	Scene *scene= CTX_data_scene(C);
-	View3D *v3d= CTX_wm_view3d(C);
+	Object *obedit = CTX_data_edit_object(C);
+	Scene *scene = CTX_data_scene(C);
+	View3D *v3d = CTX_wm_view3d(C);
 	TransVert *tv;
 	float *curs, bmat[3][3], vec[3], min[3], max[3], centroid[3];
 	int count, a;
 
-	curs= give_cursor(scene, v3d);
+	curs = give_cursor(scene, v3d);
 
-	count= 0;
+	count = 0;
 	INIT_MINMAX(min, max);
-	centroid[0]= centroid[1]= centroid[2]= 0.0;
+	zero_v3(centroid);
 
-	if(obedit) {
-		tottrans=0;
+	if (obedit) {
+		tottrans = 0;
 		
-		if ELEM6(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL)
-			make_trans_verts(obedit, bmat[0], bmat[1], TM_ALL_JOINTS|TM_SKIP_HANDLES);
-		if(tottrans==0) return OPERATOR_CANCELLED;
+		if (ELEM6(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE, OB_MBALL))
+			make_trans_verts(obedit, bmat[0], bmat[1], TM_ALL_JOINTS | TM_SKIP_HANDLES);
+		if (tottrans == 0) return OPERATOR_CANCELLED;
 		
 		copy_m3_m4(bmat, obedit->obmat);
 		
-		tv= transvmain;
-		for(a=0; a<tottrans; a++, tv++) {
+		tv = transvmain;
+		for (a = 0; a < tottrans; a++, tv++) {
 			copy_v3_v3(vec, tv->loc);
 			mul_m3_v3(bmat, vec);
 			add_v3_v3(vec, obedit->obmat[3]);
@@ -835,25 +899,25 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
 			DO_MINMAX(vec, min, max);
 		}
 		
-		if(v3d->around==V3D_CENTROID) {
-			mul_v3_fl(centroid, 1.0f/(float)tottrans);
+		if (v3d->around == V3D_CENTROID) {
+			mul_v3_fl(centroid, 1.0f / (float)tottrans);
 			copy_v3_v3(curs, centroid);
 		}
 		else {
 			mid_v3_v3v3(curs, min, max);
 		}
 		MEM_freeN(transvmain);
-		transvmain= NULL;
+		transvmain = NULL;
 	}
 	else {
-		Object *obact= CTX_data_active_object(C);
+		Object *obact = CTX_data_active_object(C);
 		
-		if(obact && (obact->mode & OB_MODE_POSE)) {
-			bArmature *arm= obact->data;
+		if (obact && (obact->mode & OB_MODE_POSE)) {
+			bArmature *arm = obact->data;
 			bPoseChannel *pchan;
-			for (pchan = obact->pose->chanbase.first; pchan; pchan=pchan->next) {
-				if(arm->layer & pchan->bone->layer) {
-					if(pchan->bone->flag & BONE_SELECTED) {
+			for (pchan = obact->pose->chanbase.first; pchan; pchan = pchan->next) {
+				if (arm->layer & pchan->bone->layer) {
+					if (pchan->bone->flag & BONE_SELECTED) {
 						copy_v3_v3(vec, pchan->pose_head);
 						mul_m4_v3(obact->obmat, vec);
 						add_v3_v3(centroid, vec);
@@ -864,13 +928,13 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
 			}
 		}
 		else {
-			CTX_DATA_BEGIN(C, Object*, ob, selected_objects) {
+			CTX_DATA_BEGIN(C, Object *, ob, selected_objects) {
 				copy_v3_v3(vec, ob->obmat[3]);
 
 				/* special case for camera -- snap to bundles */
-				if(ob->type==OB_CAMERA) {
+				if (ob->type == OB_CAMERA) {
 					/* snap to bundles should happen only when bundles are visible */
-					if(v3d->flag2&V3D_SHOW_RECONSTRUCTION) {
+					if (v3d->flag2 & V3D_SHOW_RECONSTRUCTION) {
 						bundle_midpoint(scene, ob, vec);
 					}
 				}
@@ -881,9 +945,9 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
 			}
 			CTX_DATA_END;
 		}
-		if(count) {
-			if(v3d->around==V3D_CENTROID) {
-				mul_v3_fl(centroid, 1.0f/(float)count);
+		if (count) {
+			if (v3d->around == V3D_CENTROID) {
+				mul_v3_fl(centroid, 1.0f / (float)count);
 				copy_v3_v3(curs, centroid);
 			}
 			else {
@@ -891,7 +955,7 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
 			}
 		}
 	}
-	WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d);
+	WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
 	
 	return OPERATOR_FINISHED;
 }
@@ -899,38 +963,38 @@ static int snap_curs_to_sel(bContext *C, wmOperator *UNUSED(op))
 void VIEW3D_OT_snap_cursor_to_selected(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Snap Cursor to Selected";
-	ot->description= "Snap cursor to center of selected item(s)";
-	ot->idname= "VIEW3D_OT_snap_cursor_to_selected";
+	ot->name = "Snap Cursor to Selected";
+	ot->description = "Snap cursor to center of selected item(s)";
+	ot->idname = "VIEW3D_OT_snap_cursor_to_selected";
 	
 	/* api callbacks */
-	ot->exec= snap_curs_to_sel;
-	ot->poll= ED_operator_view3d_active;
+	ot->exec = snap_curs_to_sel;
+	ot->poll = ED_operator_view3d_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /* ********************************************** */
 
 static int snap_curs_to_active(bContext *C, wmOperator *UNUSED(op))
 {
-	Object *obedit= CTX_data_edit_object(C);
-	Object *obact= CTX_data_active_object(C);
-	Scene *scene= CTX_data_scene(C);
-	View3D *v3d= CTX_wm_view3d(C);
+	Object *obedit = CTX_data_edit_object(C);
+	Object *obact = CTX_data_active_object(C);
+	Scene *scene = CTX_data_scene(C);
+	View3D *v3d = CTX_wm_view3d(C);
 	float *curs;
 	
 	curs = give_cursor(scene, v3d);
 
-	if (obedit)  {
+	if (obedit) {
 		if (obedit->type == OB_MESH) {
 			/* check active */
-			Mesh *me= obedit->data;
-			EditSelection ese;
+			Mesh *me = obedit->data;
+			BMEditSelection ese;
 			
-			if (EM_get_actSelection(me->edit_mesh, &ese)) {
-				EM_editselection_center(curs, &ese);
+			if (BM_select_history_active_get(me->edit_btmesh->bm, &ese)) {
+				BM_editselection_center(&ese, curs);
 			}
 			
 			mul_m4_v3(obedit->obmat, curs);
@@ -942,39 +1006,37 @@ static int snap_curs_to_active(bContext *C, wmOperator *UNUSED(op))
 		}
 	}
 	
-	WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d);
+	WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
 	return OPERATOR_FINISHED;
 }
 
 void VIEW3D_OT_snap_cursor_to_active(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Snap Cursor to Active";
-	ot->description= "Snap cursor to active item";
-	ot->idname= "VIEW3D_OT_snap_cursor_to_active";
+	ot->name = "Snap Cursor to Active";
+	ot->description = "Snap cursor to active item";
+	ot->idname = "VIEW3D_OT_snap_cursor_to_active";
 	
 	/* api callbacks */
-	ot->exec= snap_curs_to_active;
-	ot->poll= ED_operator_view3d_active;
+	ot->exec = snap_curs_to_active;
+	ot->poll = ED_operator_view3d_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /* **************************************************** */
 /*New Code - Snap Cursor to Center -*/
 static int snap_curs_to_center(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
-	View3D *v3d= CTX_wm_view3d(C);
+	Scene *scene = CTX_data_scene(C);
+	View3D *v3d = CTX_wm_view3d(C);
 	float *curs;
-	curs= give_cursor(scene, v3d);
+	curs = give_cursor(scene, v3d);
 
-	curs[0]= 0.0;
-	curs[1]= 0.0;
-	curs[2]= 0.0;
+	zero_v3(curs);
 	
-	WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d);
+	WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
 	
 	return OPERATOR_FINISHED;
 }
@@ -982,16 +1044,16 @@ static int snap_curs_to_center(bContext *C, wmOperator *UNUSED(op))
 void VIEW3D_OT_snap_cursor_to_center(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Snap Cursor to Center";
-	ot->description= "Snap cursor to the Center";
-	ot->idname= "VIEW3D_OT_snap_cursor_to_center";
+	ot->name = "Snap Cursor to Center";
+	ot->description = "Snap cursor to the Center";
+	ot->idname = "VIEW3D_OT_snap_cursor_to_center";
 	
 	/* api callbacks */
-	ot->exec= snap_curs_to_center;
-	ot->poll= ED_operator_view3d_active;
+	ot->exec = snap_curs_to_center;
+	ot->poll = ED_operator_view3d_active;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /* **************************************************** */
@@ -1003,17 +1065,17 @@ int minmax_verts(Object *obedit, float *min, float *max)
 	float centroid[3], vec[3], bmat[3][3];
 	int a;
 
-	tottrans=0;
-	if ELEM5(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE)
+	tottrans = 0;
+	if (ELEM5(obedit->type, OB_ARMATURE, OB_LATTICE, OB_MESH, OB_SURF, OB_CURVE))
 		make_trans_verts(obedit, bmat[0], bmat[1], TM_ALL_JOINTS);
 	
-	if(tottrans==0) return 0;
+	if (tottrans == 0) return 0;
 
 	copy_m3_m4(bmat, obedit->obmat);
 	
-	tv= transvmain;
-	for(a=0; a<tottrans; a++, tv++) {
-		copy_v3_v3(vec, tv->loc);
+	tv = transvmain;
+	for (a = 0; a < tottrans; a++, tv++) {
+		copy_v3_v3(vec, (tv->flag & TX_VERT_USE_MAPLOC) ? tv->maploc : tv->loc);
 		mul_m3_v3(bmat, vec);
 		add_v3_v3(vec, obedit->obmat[3]);
 		add_v3_v3(centroid, vec);
@@ -1021,8 +1083,7 @@ int minmax_verts(Object *obedit, float *min, float *max)
 	}
 	
 	MEM_freeN(transvmain);
-	transvmain= NULL;
+	transvmain = NULL;
 	
 	return 1;
 }
-
diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c
index 0705d06..82ab6cd 100644
--- a/source/blender/editors/space_view3d/view3d_toolbar.c
+++ b/source/blender/editors/space_view3d/view3d_toolbar.c
@@ -41,7 +41,6 @@
 
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
-#include "BLI_editVert.h"
 #include "BLI_rand.h"
 #include "BLI_utildefines.h"
 #include "BLI_ghash.h"
@@ -65,7 +64,7 @@
 #include "UI_interface.h"
 #include "UI_resources.h"
 
-#include "view3d_intern.h"	// own include
+#include "view3d_intern.h"  // own include
 
 
 /* ******************* view3d space & buttons ************** */
@@ -77,16 +76,16 @@ static void view3d_panel_operator_redo_buts(const bContext *C, Panel *pa, wmOper
 
 static void view3d_panel_operator_redo_header(const bContext *C, Panel *pa)
 {
-	wmOperator *op= WM_operator_last_redo(C);
+	wmOperator *op = WM_operator_last_redo(C);
 
-	if(op) BLI_strncpy(pa->drawname, op->type->name, sizeof(pa->drawname));
+	if (op) BLI_strncpy(pa->drawname, op->type->name, sizeof(pa->drawname));
 	else BLI_strncpy(pa->drawname, IFACE_("Operator"), sizeof(pa->drawname));
 }
 
 static void view3d_panel_operator_redo_operator(const bContext *C, Panel *pa, wmOperator *op)
 {
-	if(op->type->flag & OPTYPE_MACRO) {
-		for(op= op->macro.first; op; op= op->next) {
+	if (op->type->flag & OPTYPE_MACRO) {
+		for (op = op->macro.first; op; op = op->next) {
 			uiItemL(pa->layout, op->type->name, ICON_NONE);
 			view3d_panel_operator_redo_operator(C, pa, op);
 		}
@@ -99,15 +98,15 @@ static void view3d_panel_operator_redo_operator(const bContext *C, Panel *pa, wm
 /* TODO de-duplicate redo panel functions - campbell */
 static void view3d_panel_operator_redo(const bContext *C, Panel *pa)
 {
-	wmOperator *op= WM_operator_last_redo(C);
+	wmOperator *op = WM_operator_last_redo(C);
 	uiBlock *block;
 	
-	if(op==NULL)
+	if (op == NULL)
 		return;
-	if(WM_operator_poll((bContext*)C, op->type) == 0)
+	if (WM_operator_poll((bContext *)C, op->type) == 0)
 		return;
 	
-	block= uiLayoutGetBlock(pa->layout);
+	block = uiLayoutGetBlock(pa->layout);
 	
 	if (!WM_operator_check_ui_enabled(C, op->type->name))
 		uiLayoutSetEnabled(pa->layout, 0);
@@ -128,10 +127,10 @@ typedef struct CustomTool {
 
 static void operator_call_cb(struct bContext *C, void *arg_listbase, void *arg2)
 {
-	wmOperatorType *ot= arg2;
+	wmOperatorType *ot = arg2;
 	
-	if(ot) {
-		CustomTool *ct= MEM_callocN(sizeof(CustomTool), "CustomTool");
+	if (ot) {
+		CustomTool *ct = MEM_callocN(sizeof(CustomTool), "CustomTool");
 		
 		BLI_addtail(arg_listbase, ct);
 		BLI_strncpy(ct->opname, ot->idname, OP_MAX_TYPENAME);
@@ -142,15 +141,15 @@ static void operator_call_cb(struct bContext *C, void *arg_listbase, void *arg2)
 
 static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), const char *str, uiSearchItems *items)
 {
-	GHashIterator *iter= WM_operatortype_iter();
+	GHashIterator *iter = WM_operatortype_iter();
 
-	for( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
-		wmOperatorType *ot= BLI_ghashIterator_getValue(iter);
+	for (; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
+		wmOperatorType *ot = BLI_ghashIterator_getValue(iter);
 
-		if(BLI_strcasestr(ot->name, str)) {
-			if(WM_operator_poll((bContext*)C, ot)) {
+		if (BLI_strcasestr(ot->name, str)) {
+			if (WM_operator_poll((bContext *)C, ot)) {
 				
-				if(0==uiSearchItemAdd(items, ot->name, ot, 0))
+				if (0 == uiSearchItemAdd(items, ot->name, ot, 0))
 					break;
 			}
 		}
@@ -164,31 +163,31 @@ static uiBlock *tool_search_menu(bContext *C, ARegion *ar, void *arg_listbase)
 {
 	static char search[OP_MAX_TYPENAME];
 	wmEvent event;
-	wmWindow *win= CTX_wm_window(C);
+	wmWindow *win = CTX_wm_window(C);
 	uiBlock *block;
 	uiBut *but;
 	
 	/* clear initial search string, then all items show */
-	search[0]= 0;
+	search[0] = 0;
 	
-	block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
-	uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_RET_1);
+	block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
+	uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_RET_1);
 	
 	/* fake button, it holds space for search items */
 	uiDefBut(block, LABEL, 0, "", 10, 15, 150, uiSearchBoxhHeight(), 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, 150, 19, 0, 0, "");
 	uiButSetSearchFunc(but, operator_search_cb, arg_listbase, operator_call_cb, NULL);
 	
 	uiBoundsBlock(block, 6);
 	uiBlockSetDirection(block, UI_DOWN);	
 	uiEndBlock(C, block);
 	
-	event= *(win->eventstate);	/* XXX huh huh? make api call */
-	event.type= EVT_BUT_OPEN;
-	event.val= KM_PRESS;
-	event.customdata= but;
-	event.customdatafree= FALSE;
+	event = *(win->eventstate);  /* XXX huh huh? make api call */
+	event.type = EVT_BUT_OPEN;
+	event.val = KM_PRESS;
+	event.customdata = but;
+	event.customdatafree = FALSE;
 	wm_event_add(win, &event);
 	
 	return block;
@@ -197,25 +196,25 @@ static uiBlock *tool_search_menu(bContext *C, ARegion *ar, void *arg_listbase)
 
 static void view3d_panel_tool_shelf(const bContext *C, Panel *pa)
 {
-	SpaceLink *sl= CTX_wm_space_data(C);
-	SpaceType *st= NULL;
+	SpaceLink *sl = CTX_wm_space_data(C);
+	SpaceType *st = NULL;
 	uiLayout *col;
-	const char *context= CTX_data_mode_string(C);
+	const char *context = CTX_data_mode_string(C);
 	
-	if(sl)
-		st= BKE_spacetype_from_id(sl->spacetype);
+	if (sl)
+		st = BKE_spacetype_from_id(sl->spacetype);
 	
-	if(st && st->toolshelf.first) {
+	if (st && st->toolshelf.first) {
 		CustomTool *ct;
 		
-		for(ct= st->toolshelf.first; ct; ct= ct->next) {
-			if(0==strncmp(context, ct->context, OP_MAX_TYPENAME)) {
-				col= uiLayoutColumn(pa->layout, 1);
+		for (ct = st->toolshelf.first; ct; ct = ct->next) {
+			if (0 == strncmp(context, ct->context, OP_MAX_TYPENAME)) {
+				col = uiLayoutColumn(pa->layout, 1);
 				uiItemFullO(col, ct->opname, NULL, ICON_NONE, NULL, WM_OP_INVOKE_REGION_WIN, 0);
 			}
 		}
 	}
-	col= uiLayoutColumn(pa->layout, 1);
+	col = uiLayoutColumn(pa->layout, 1);
 	uiDefBlockBut(uiLayoutGetBlock(pa->layout), tool_search_menu, &st->toolshelf, "Add Tool", 0, 0, UI_UNIT_X, UI_UNIT_Y, "Add Tool in shelf, gets saved in files");
 }
 
@@ -224,10 +223,10 @@ void view3d_toolshelf_register(ARegionType *art)
 {
 	PanelType *pt;
 
-	pt= MEM_callocN(sizeof(PanelType), "spacetype view3d panel tools");
+	pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel tools");
 	strcpy(pt->idname, "VIEW3D_PT_tool_shelf");
 	strcpy(pt->label, "Tool Shelf");
-	pt->draw= view3d_panel_tool_shelf;
+	pt->draw = view3d_panel_tool_shelf;
 	BLI_addtail(&art->paneltypes, pt);
 }
 
@@ -235,11 +234,11 @@ void view3d_tool_props_register(ARegionType *art)
 {
 	PanelType *pt;
 	
-	pt= MEM_callocN(sizeof(PanelType), "spacetype view3d panel last operator");
+	pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel last operator");
 	strcpy(pt->idname, "VIEW3D_PT_last_operator");
 	strcpy(pt->label, "Operator");
-	pt->draw_header= view3d_panel_operator_redo_header;
-	pt->draw= view3d_panel_operator_redo;
+	pt->draw_header = view3d_panel_operator_redo_header;
+	pt->draw = view3d_panel_operator_redo;
 	BLI_addtail(&art->paneltypes, pt);
 }
 
@@ -247,10 +246,10 @@ void view3d_tool_props_register(ARegionType *art)
 
 static int view3d_toolshelf(bContext *C, wmOperator *UNUSED(op))
 {
-	ScrArea *sa= CTX_wm_area(C);
-	ARegion *ar= view3d_has_tools_region(sa);
+	ScrArea *sa = CTX_wm_area(C);
+	ARegion *ar = view3d_has_tools_region(sa);
 	
-	if(ar)
+	if (ar)
 		ED_region_toggle_hidden(C, ar);
 
 	return OPERATOR_FINISHED;
@@ -258,13 +257,14 @@ static int view3d_toolshelf(bContext *C, wmOperator *UNUSED(op))
 
 void VIEW3D_OT_toolshelf(wmOperatorType *ot)
 {
-	ot->name= "Tool Shelf";
-	ot->description= "Toggles tool shelf display";
-	ot->idname= "VIEW3D_OT_toolshelf";
+	ot->name = "Tool Shelf";
+	ot->description = "Toggles tool shelf display";
+	ot->idname = "VIEW3D_OT_toolshelf";
 	
-	ot->exec= view3d_toolshelf;
-	ot->poll= ED_operator_view3d_active;
+	ot->exec = view3d_toolshelf;
+	ot->poll = ED_operator_view3d_active;
 	
 	/* flags */
-	ot->flag= 0;
+	ot->flag = 0;
 }
+
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 1a2e893..8a0cb4b 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -71,15 +71,15 @@
 #include "RNA_access.h"
 #include "RNA_define.h"
 
-#include "view3d_intern.h"	// own include
+#include "view3d_intern.h"  // own include
 
 /* use this call when executing an operator,
-   event system doesn't set for each event the
-   opengl drawing context */
+ * event system doesn't set for each event the
+ * opengl drawing context */
 void view3d_operator_needs_opengl(const bContext *C)
 {
 	wmWindow *win = CTX_wm_window(C);
-	ARegion *ar= CTX_wm_region(C);
+	ARegion *ar = CTX_wm_region(C);
 	
 	view3d_region_operator_needs_opengl(win, ar);
 }
@@ -87,10 +87,10 @@ void view3d_operator_needs_opengl(const bContext *C)
 void view3d_region_operator_needs_opengl(wmWindow *win, ARegion *ar)
 {
 	/* for debugging purpose, context should always be OK */
-	if ((ar == NULL) || (ar->regiontype!=RGN_TYPE_WINDOW))
+	if ((ar == NULL) || (ar->regiontype != RGN_TYPE_WINDOW))
 		printf("view3d_region_operator_needs_opengl error, wrong region\n");
 	else {
-		RegionView3D *rv3d= ar->regiondata;
+		RegionView3D *rv3d = ar->regiondata;
 		
 		wmSubWindowSet(win, ar->swinid);
 		glMatrixMode(GL_PROJECTION);
@@ -102,7 +102,7 @@ void view3d_region_operator_needs_opengl(wmWindow *win, ARegion *ar)
 
 float *give_cursor(Scene *scene, View3D *v3d)
 {
-	if(v3d && v3d->localvd) return v3d->cursor;
+	if (v3d && v3d->localvd) return v3d->cursor;
 	else return scene->cursor;
 }
 
@@ -126,42 +126,42 @@ struct SmoothViewStore {
 void smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera, Object *camera,
                  float *ofs, float *quat, float *dist, float *lens)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
-	wmWindow *win= CTX_wm_window(C);
-	ScrArea *sa= CTX_wm_area(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
+	wmWindow *win = CTX_wm_window(C);
+	ScrArea *sa = CTX_wm_area(C);
 
-	RegionView3D *rv3d= ar->regiondata;
-	struct SmoothViewStore sms= {0};
-	short ok= FALSE;
+	RegionView3D *rv3d = ar->regiondata;
+	struct SmoothViewStore sms = {0};
+	short ok = FALSE;
 	
 	/* initialize sms */
 	copy_v3_v3(sms.new_ofs, rv3d->ofs);
 	copy_qt_qt(sms.new_quat, rv3d->viewquat);
-	sms.new_dist= rv3d->dist;
-	sms.new_lens= v3d->lens;
-	sms.to_camera= 0;
+	sms.new_dist = rv3d->dist;
+	sms.new_lens = v3d->lens;
+	sms.to_camera = 0;
 
 	/* 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 infact
 	 * there is an active camera which is locked to the view.
 	 *
-	 * In the case where smooth view is moving _to_ a camera we dont want that
+	 * In the case where smooth view is moving _to_ a camera we don't want that
 	 * camera to be moved or changed, so only when the camera is not being set should
 	 * we allow camera option locking to initialize the view settings from the camera.
 	 */
-	if(camera == NULL && oldcamera == NULL) {
+	if (camera == NULL && oldcamera == NULL) {
 		ED_view3d_camera_lock_init(v3d, rv3d);
 	}
 
 	/* store the options we want to end with */
-	if(ofs) copy_v3_v3(sms.new_ofs, ofs);
-	if(quat) copy_qt_qt(sms.new_quat, quat);
-	if(dist) sms.new_dist= *dist;
-	if(lens) sms.new_lens= *lens;
+	if (ofs) copy_v3_v3(sms.new_ofs, ofs);
+	if (quat) copy_qt_qt(sms.new_quat, quat);
+	if (dist) sms.new_dist = *dist;
+	if (lens) sms.new_lens = *lens;
 
 	if (camera) {
 		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 = 1; /* restore view3d values in end */
 	}
 	
 	if (C && U.smooth_viewtx) {
@@ -179,35 +179,35 @@ void smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera, Objec
 			changed = 1;
 		
 		/* The new view is different from the old one
-			* so animate the view */
+		 * so animate the view */
 		if (changed) {
 
 			/* original values */
 			if (oldcamera) {
-				sms.orig_dist= rv3d->dist; // below function does weird stuff with it...
+				sms.orig_dist = rv3d->dist; // below function does weird stuff with it...
 				ED_view3d_from_object(oldcamera, sms.orig_ofs, sms.orig_quat, &sms.orig_dist, &sms.orig_lens);
 			}
 			else {
 				copy_v3_v3(sms.orig_ofs, rv3d->ofs);
 				copy_qt_qt(sms.orig_quat, rv3d->viewquat);
-				sms.orig_dist= rv3d->dist;
-				sms.orig_lens= v3d->lens;
+				sms.orig_dist = rv3d->dist;
+				sms.orig_lens = v3d->lens;
 			}
 			/* grid draw as floor */
-			if((rv3d->viewlock & RV3D_LOCKED)==0) {
+			if ((rv3d->viewlock & RV3D_LOCKED) == 0) {
 				/* use existing if exists, means multiple calls to smooth view wont loose the original 'view' setting */
-				sms.orig_view= rv3d->sms ? rv3d->sms->orig_view : rv3d->view;
-				rv3d->view= RV3D_VIEW_USER;
+				sms.orig_view = rv3d->sms ? rv3d->sms->orig_view : rv3d->view;
+				rv3d->view = RV3D_VIEW_USER;
 			}
 
-			sms.time_allowed= (double)U.smooth_viewtx / 1000.0;
+			sms.time_allowed = (double)U.smooth_viewtx / 1000.0;
 			
 			/* if this is view rotation only
-				* we can decrease the time allowed by
-				* the angle between quats 
-				* this means small rotations wont lag */
+			 * we can decrease the time allowed by
+			 * the angle between quats 
+			 * this means small rotations wont lag */
 			if (quat && !ofs && !dist) {
-				float vec1[3]={0,0,1}, vec2[3]= {0,0,1};
+				float vec1[3] = {0, 0, 1}, vec2[3] = {0, 0, 1};
 				float q1[4], q2[4];
 
 				invert_qt_qt(q1, sms.new_quat);
@@ -221,33 +221,33 @@ void smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera, Objec
 			}
 
 			/* ensure it shows correct */
-			if(sms.to_camera) rv3d->persp= RV3D_PERSP;
+			if (sms.to_camera) rv3d->persp = RV3D_PERSP;
 
 			rv3d->rflag |= RV3D_NAVIGATING;
 			
 			/* keep track of running timer! */
-			if(rv3d->sms==NULL)
-				rv3d->sms= MEM_mallocN(sizeof(struct SmoothViewStore), "smoothview v3d");
-			*rv3d->sms= sms;
-			if(rv3d->smooth_timer)
+			if (rv3d->sms == NULL)
+				rv3d->sms = MEM_mallocN(sizeof(struct SmoothViewStore), "smoothview v3d");
+			*rv3d->sms = sms;
+			if (rv3d->smooth_timer)
 				WM_event_remove_timer(wm, win, rv3d->smooth_timer);
 			/* TIMER1 is hardcoded in keymap */
-			rv3d->smooth_timer= WM_event_add_timer(wm, win, TIMER1, 1.0/100.0);	/* max 30 frs/sec */
+			rv3d->smooth_timer = WM_event_add_timer(wm, win, TIMER1, 1.0 / 100.0); /* max 30 frs/sec */
 			
-			ok= TRUE;
+			ok = TRUE;
 		}
 	}
 	
 	/* if we get here nothing happens */
-	if(ok == FALSE) {
-		if(sms.to_camera==0) {
+	if (ok == FALSE) {
+		if (sms.to_camera == 0) {
 			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;
 		}
 
-		if(rv3d->viewlock & RV3D_BOXVIEW)
+		if (rv3d->viewlock & RV3D_BOXVIEW)
 			view3d_boxview_copy(sa, ar);
 
 		ED_region_tag_redraw(ar);
@@ -258,25 +258,25 @@ void smooth_view(bContext *C, View3D *v3d, ARegion *ar, Object *oldcamera, Objec
 static int view3d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
 {
 	View3D *v3d = CTX_wm_view3d(C);
-	RegionView3D *rv3d= CTX_wm_region_view3d(C);
-	struct SmoothViewStore *sms= rv3d->sms;
+	RegionView3D *rv3d = CTX_wm_region_view3d(C);
+	struct SmoothViewStore *sms = rv3d->sms;
 	float step, step_inv;
 	
 	/* escape if not our timer */
-	if(rv3d->smooth_timer==NULL || rv3d->smooth_timer!=event->customdata)
+	if (rv3d->smooth_timer == NULL || rv3d->smooth_timer != event->customdata)
 		return OPERATOR_PASS_THROUGH;
 	
-	if(sms->time_allowed != 0.0)
-		step = (float)((rv3d->smooth_timer->duration)/sms->time_allowed);
+	if (sms->time_allowed != 0.0)
+		step = (float)((rv3d->smooth_timer->duration) / sms->time_allowed);
 	else
 		step = 1.0f;
 	
 	/* end timer */
-	if(step >= 1.0f) {
+	if (step >= 1.0f) {
 		
 		/* if we went to camera, store the original */
-		if(sms->to_camera) {
-			rv3d->persp= RV3D_CAMOB;
+		if (sms->to_camera) {
+			rv3d->persp = RV3D_CAMOB;
 			copy_v3_v3(rv3d->ofs, sms->orig_ofs);
 			copy_qt_qt(rv3d->viewquat, sms->orig_quat);
 			rv3d->dist = sms->orig_dist;
@@ -291,41 +291,41 @@ static int view3d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent
 			ED_view3d_camera_lock_sync(v3d, rv3d);
 		}
 		
-		if((rv3d->viewlock & RV3D_LOCKED)==0) {
-			rv3d->view= sms->orig_view;
+		if ((rv3d->viewlock & RV3D_LOCKED) == 0) {
+			rv3d->view = sms->orig_view;
 		}
 
 		MEM_freeN(rv3d->sms);
-		rv3d->sms= NULL;
+		rv3d->sms = NULL;
 		
 		WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), rv3d->smooth_timer);
-		rv3d->smooth_timer= NULL;
+		rv3d->smooth_timer = NULL;
 		rv3d->rflag &= ~RV3D_NAVIGATING;
 	}
 	else {
 		int i;
 		
 		/* ease in/out */
-		if (step < 0.5f)	step = (float)pow(step*2.0f, 2.0)/2.0f;
-		else				step = (float)1.0f-(powf(2.0f*(1.0f-step),2.0f)/2.0f);
+		if (step < 0.5f) step = (float)pow(step * 2.0f, 2.0) / 2.0f;
+		else step = (float)1.0f - (powf(2.0f * (1.0f - step), 2.0f) / 2.0f);
 
-		step_inv = 1.0f-step;
+		step_inv = 1.0f - step;
 
-		for (i=0; i<3; i++)
-			rv3d->ofs[i] = sms->new_ofs[i] * step + sms->orig_ofs[i]*step_inv;
+		for (i = 0; i < 3; i++)
+			rv3d->ofs[i] = sms->new_ofs[i] * step + sms->orig_ofs[i] * step_inv;
 
 		interp_qt_qtqt(rv3d->viewquat, sms->orig_quat, sms->new_quat, step);
 		
-		rv3d->dist = sms->new_dist * step + sms->orig_dist*step_inv;
-		v3d->lens = sms->new_lens * step + sms->orig_lens*step_inv;
+		rv3d->dist = sms->new_dist * step + sms->orig_dist * step_inv;
+		v3d->lens = sms->new_lens * step + sms->orig_lens * step_inv;
 
 		ED_view3d_camera_lock_sync(v3d, rv3d);
 	}
 	
-	if(rv3d->viewlock & RV3D_BOXVIEW)
+	if (rv3d->viewlock & RV3D_BOXVIEW)
 		view3d_boxview_copy(CTX_wm_area(C), CTX_wm_region(C));
 	
-	WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d);
+	WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
 	
 	return OPERATOR_FINISHED;
 }
@@ -334,14 +334,14 @@ void VIEW3D_OT_smoothview(wmOperatorType *ot)
 {
 	
 	/* identifiers */
-	ot->name= "Smooth View";
-	ot->idname= "VIEW3D_OT_smoothview";
-	ot->description="The time to animate the change of view (in milliseconds)";
+	ot->name = "Smooth View";
+	ot->idname = "VIEW3D_OT_smoothview";
+	ot->description = "The time to animate the change of view (in milliseconds)";
 	
 	/* api callbacks */
-	ot->invoke= view3d_smoothview_invoke;
+	ot->invoke = view3d_smoothview_invoke;
 	
-	ot->poll= ED_operator_view3d_active;
+	ot->poll = ED_operator_view3d_active;
 }
 
 /* ****************** change view operators ****************** */
@@ -349,13 +349,13 @@ void VIEW3D_OT_smoothview(wmOperatorType *ot)
 static int view3d_camera_to_view_exec(bContext *C, wmOperator *UNUSED(op))
 {
 	View3D *v3d = CTX_wm_view3d(C);
-	RegionView3D *rv3d= CTX_wm_region_view3d(C);
+	RegionView3D *rv3d = CTX_wm_region_view3d(C);
 	ObjectTfmProtectedChannels obtfm;
 
 	copy_qt_qt(rv3d->lviewquat, rv3d->viewquat);
-	rv3d->lview= rv3d->view;
-	if(rv3d->persp != RV3D_CAMOB) {
-		rv3d->lpersp= rv3d->persp;
+	rv3d->lview = rv3d->view;
+	if (rv3d->persp != RV3D_CAMOB) {
+		rv3d->lpersp = rv3d->persp;
 	}
 
 	object_tfm_protected_backup(v3d->camera, &obtfm);
@@ -367,7 +367,7 @@ static int view3d_camera_to_view_exec(bContext *C, wmOperator *UNUSED(op))
 	DAG_id_tag_update(&v3d->camera->id, OB_RECALC_OB);
 	rv3d->persp = RV3D_CAMOB;
 	
-	WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, v3d->camera);
+	WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, v3d->camera);
 	
 	return OPERATOR_FINISHED;
 
@@ -375,10 +375,10 @@ static int view3d_camera_to_view_exec(bContext *C, wmOperator *UNUSED(op))
 
 static int view3d_camera_to_view_poll(bContext *C)
 {
-	View3D *v3d= CTX_wm_view3d(C);
-	if(v3d && v3d->camera && v3d->camera->id.lib==NULL) {
-		RegionView3D *rv3d= CTX_wm_region_view3d(C);
-		if(rv3d && !rv3d->viewlock) {
+	View3D *v3d = CTX_wm_view3d(C);
+	if (v3d && v3d->camera && v3d->camera->id.lib == NULL) {
+		RegionView3D *rv3d = CTX_wm_region_view3d(C);
+		if (rv3d && !rv3d->viewlock) {
 			return 1;
 		}
 	}
@@ -389,25 +389,25 @@ static int view3d_camera_to_view_poll(bContext *C)
 void VIEW3D_OT_camera_to_view(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Align Camera To View";
-	ot->description= "Set camera view to active view";
-	ot->idname= "VIEW3D_OT_camera_to_view";
+	ot->name = "Align Camera To View";
+	ot->description = "Set camera view to active view";
+	ot->idname = "VIEW3D_OT_camera_to_view";
 	
 	/* api callbacks */
-	ot->exec= view3d_camera_to_view_exec;
-	ot->poll= view3d_camera_to_view_poll;
+	ot->exec = view3d_camera_to_view_exec;
+	ot->poll = view3d_camera_to_view_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /* unlike VIEW3D_OT_view_selected this is for framing a render and not
  * meant to take into account vertex/bone selection for eg. */
 static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	View3D *v3d = CTX_wm_view3d(C);
-	Object *camera_ob= v3d->camera;
+	Object *camera_ob = v3d->camera;
 
 	float r_co[3]; /* the new location to apply */
 
@@ -427,7 +427,7 @@ static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *UNUSED(o
 
 		/* notifiers */
 		DAG_id_tag_update(&camera_ob->id, OB_RECALC_OB);
-		WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, camera_ob);
+		WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, camera_ob);
 		return OPERATOR_FINISHED;
 	}
 	else {
@@ -437,10 +437,10 @@ static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *UNUSED(o
 
 static int view3d_camera_to_view_selected_poll(bContext *C)
 {
-	View3D *v3d= CTX_wm_view3d(C);
-	if(v3d && v3d->camera && v3d->camera->id.lib==NULL) {
-		RegionView3D *rv3d= CTX_wm_region_view3d(C);
-		if(rv3d) {
+	View3D *v3d = CTX_wm_view3d(C);
+	if (v3d && v3d->camera && v3d->camera->id.lib == NULL) {
+		RegionView3D *rv3d = CTX_wm_region_view3d(C);
+		if (rv3d) {
 			if (rv3d->is_persp == FALSE) {
 				CTX_wm_operator_poll_msg_set(C, "Only valid for a perspective camera view");
 			}
@@ -456,16 +456,16 @@ static int view3d_camera_to_view_selected_poll(bContext *C)
 void VIEW3D_OT_camera_to_view_selected(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Camera Fit Frame to Selected";
-	ot->description= "Move the camera so selected objects are framed";
-	ot->idname= "VIEW3D_OT_camera_to_view_selected";
+	ot->name = "Camera Fit Frame to Selected";
+	ot->description = "Move the camera so selected objects are framed";
+	ot->idname = "VIEW3D_OT_camera_to_view_selected";
 
 	/* api callbacks */
-	ot->exec= view3d_camera_to_view_selected_exec;
-	ot->poll= view3d_camera_to_view_selected_poll;
+	ot->exec = view3d_camera_to_view_selected_exec;
+	ot->poll = view3d_camera_to_view_selected_poll;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 
@@ -475,24 +475,24 @@ static int view3d_setobjectascamera_exec(bContext *C, wmOperator *UNUSED(op))
 	ARegion *ar;
 	RegionView3D *rv3d;
 
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	Object *ob = CTX_data_active_object(C);
 
 	/* no NULL check is needed, poll checks */
 	ED_view3d_context_user_region(C, &v3d, &ar);
 	rv3d = ar->regiondata;
 
-	if(ob) {
-		Object *camera_old= (rv3d->persp == RV3D_CAMOB) ? V3D_CAMERA_SCENE(scene, v3d) : NULL;
-		rv3d->persp= RV3D_CAMOB;
-		v3d->camera= ob;
-		if(v3d->scenelock)
-			scene->camera= ob;
+	if (ob) {
+		Object *camera_old = (rv3d->persp == RV3D_CAMOB) ? V3D_CAMERA_SCENE(scene, v3d) : NULL;
+		rv3d->persp = RV3D_CAMOB;
+		v3d->camera = ob;
+		if (v3d->scenelock)
+			scene->camera = ob;
 
-		if(camera_old != ob) /* unlikely but looks like a glitch when set to the same */
+		if (camera_old != ob) /* unlikely but looks like a glitch when set to the same */
 			smooth_view(C, v3d, ar, camera_old, v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, &v3d->lens);
 
-		WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS|NC_OBJECT|ND_DRAW, CTX_data_scene(C));
+		WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS | NC_OBJECT | ND_DRAW, CTX_data_scene(C));
 	}
 	
 	return OPERATOR_FINISHED;
@@ -510,16 +510,16 @@ void VIEW3D_OT_object_as_camera(wmOperatorType *ot)
 {
 	
 	/* identifiers */
-	ot->name= "Set Active Object as Camera";
-	ot->description= "Set the active object as the active camera for this view or scene";
-	ot->idname= "VIEW3D_OT_object_as_camera";
+	ot->name = "Set Active Object as Camera";
+	ot->description = "Set the active object as the active camera for this view or scene";
+	ot->idname = "VIEW3D_OT_object_as_camera";
 	
 	/* api callbacks */
-	ot->exec= view3d_setobjectascamera_exec;
-	ot->poll= ED_operator_rv3d_user_region_poll;
+	ot->exec = view3d_setobjectascamera_exec;
+	ot->poll = ED_operator_rv3d_user_region_poll;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 }
 
 /* ********************************** */
@@ -531,9 +531,9 @@ void ED_view3d_calc_clipping(BoundBox *bb, float planes[4][4], bglMats *mats, co
 	int val, flip_sign, a;
 
 	/* near zero floating point values can give issues with gluUnProject
-		in side view on some implementations */
-	if(fabs(mats->modelview[0]) < 1e-6) mats->modelview[0]= 0.0;
-	if(fabs(mats->modelview[5]) < 1e-6) mats->modelview[5]= 0.0;
+	 * in side view on some implementations */
+	if (fabs(mats->modelview[0]) < 1e-6) mats->modelview[0] = 0.0;
+	if (fabs(mats->modelview[5]) < 1e-6) mats->modelview[5] = 0.0;
 
 	/* Set up viewport so that gluUnProject will give correct values */
 	mats->viewport[0] = 0;
@@ -541,44 +541,44 @@ void ED_view3d_calc_clipping(BoundBox *bb, float planes[4][4], bglMats *mats, co
 
 	/* four clipping planes and bounding volume */
 	/* first do the bounding volume */
-	for(val=0; val<4; val++) {
-		xs= (val==0||val==3)?rect->xmin:rect->xmax;
-		ys= (val==0||val==1)?rect->ymin:rect->ymax;
+	for (val = 0; val < 4; val++) {
+		xs = (val == 0 || val == 3) ? rect->xmin : rect->xmax;
+		ys = (val == 0 || val == 1) ? rect->ymin : rect->ymax;
 
 		gluUnProject(xs, ys, 0.0, mats->modelview, mats->projection, mats->viewport, &p[0], &p[1], &p[2]);
-		VECCOPY(bb->vec[val], p);
+		copy_v3fl_v3db(bb->vec[val], p);
 
 		gluUnProject(xs, ys, 1.0, mats->modelview, mats->projection, mats->viewport, &p[0], &p[1], &p[2]);
-		VECCOPY(bb->vec[4+val], p);
+		copy_v3fl_v3db(bb->vec[4 + val], p);
 	}
 
 	/* verify if we have negative scale. doing the transform before cross
-	   product flips the sign of the vector compared to doing cross product
-	   before transform then, so we correct for that. */
-	for(a=0; a<16; a++)
-		((float*)modelview)[a] = mats->modelview[a];
+	 * product flips the sign of the vector compared to doing cross product
+	 * before transform then, so we correct for that. */
+	for (a = 0; a < 16; a++)
+		((float *)modelview)[a] = mats->modelview[a];
 	flip_sign = is_negative_m4(modelview);
 
 	/* then plane equations */
-	for(val=0; val<4; val++) {
+	for (val = 0; val < 4; val++) {
 
-		normal_tri_v3(planes[val], bb->vec[val], bb->vec[val==3?0:val+1], bb->vec[val+4]);
+		normal_tri_v3(planes[val], bb->vec[val], bb->vec[val == 3 ? 0 : val + 1], bb->vec[val + 4]);
 
-		if(flip_sign)
+		if (flip_sign)
 			negate_v3(planes[val]);
 
-		planes[val][3]= - planes[val][0]*bb->vec[val][0]
-			- planes[val][1]*bb->vec[val][1]
-			- planes[val][2]*bb->vec[val][2];
+		planes[val][3] = -planes[val][0] * bb->vec[val][0]
+		                 - planes[val][1] * bb->vec[val][1]
+		                 - planes[val][2] * bb->vec[val][2];
 	}
 }
 
 /* create intersection coordinates in view Z direction at mouse coordinates */
 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;
+	RegionView3D *rv3d = ar->regiondata;
 	
-	if(rv3d->is_persp) {
+	if (rv3d->is_persp) {
 		float vec[3];
 		ED_view3d_win_to_vector(ar, mval, vec);
 
@@ -600,9 +600,9 @@ void ED_view3d_win_to_segment_clip(ARegion *ar, View3D *v3d, const float mval[2]
 	}
 
 	/* clipping */
-	if(rv3d->rflag & RV3D_CLIPPING) {
+	if (rv3d->rflag & RV3D_CLIPPING) {
 		int a;
-		for(a=0; a<4; a++) {
+		for (a = 0; a < 4; a++) {
 			clip_line_plane(ray_start, ray_end, rv3d->clip[a]);
 		}
 	}
@@ -643,51 +643,51 @@ void ED_view3d_global_to_vector(RegionView3D *rv3d, const float coord[3], float
 
 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];
+	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;
+		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)
-		* */
+	 * (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
+	 * 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;
+	if (rv3d->zfac < 0.0f) rv3d->zfac = -rv3d->zfac;
 	
 	return flip;
 }
 
 void ED_view3d_win_to_3d(ARegion *ar, const float depth_pt[3], const float mval[2], float out[3])
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 	
 	float line_sta[3];
 	float line_end[3];
 
-	if(rv3d->is_persp) {
+	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) {
+		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];
+		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);
@@ -698,15 +698,15 @@ void ED_view3d_win_to_3d(ARegion *ar, const float depth_pt[3], const float mval[
 /* only to detect delta motion */
 void ED_view3d_win_to_delta(ARegion *ar, const float mval[2], float out[3])
 {
-	RegionView3D *rv3d= ar->regiondata;
+	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;
+	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);
+	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);
 }
 
 /* doesn't rely on initgrabz */
@@ -714,12 +714,12 @@ void ED_view3d_win_to_delta(ARegion *ar, const float mval[2], float out[3])
  * the mouse cursor as a normalized vector */
 void ED_view3d_win_to_vector(ARegion *ar, const float mval[2], float out[3])
 {
-	RegionView3D *rv3d= ar->regiondata;
+	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;
+	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]);
 	}
@@ -736,7 +736,7 @@ float ED_view3d_depth_read_cached(ViewContext *vc, int x, int y)
 	x -= vc->ar->winrct.xmin;
 	y -= vc->ar->winrct.ymin;
 
-	if(vd && vd->depths && x > 0 && y > 0 && x < vd->w && y < vd->h)
+	if (vd && vd->depths && x > 0 && y > 0 && x < vd->w && y < vd->h)
 		return vd->depths[y * vd->w + x];
 	else
 		return 1;
@@ -744,8 +744,8 @@ float ED_view3d_depth_read_cached(ViewContext *vc, int x, int y)
 
 void ED_view3d_depth_tag_update(RegionView3D *rv3d)
 {
-	if(rv3d->depths)
-		rv3d->depths->damaged= 1;
+	if (rv3d->depths)
+		rv3d->depths->damaged = 1;
 }
 
 void ED_view3d_ob_project_mat_get(RegionView3D *rv3d, Object *ob, float pmat[4][4])
@@ -756,57 +756,58 @@ void ED_view3d_ob_project_mat_get(RegionView3D *rv3d, Object *ob, float pmat[4][
 	mult_m4_m4m4(pmat, rv3d->winmat, vmat);
 }
 
-#if 0
 /* Uses window coordinates (x,y) and depth component z to find a point in
-   modelspace */
+ * modelspace */
 void view3d_unproject(bglMats *mats, float out[3], const short x, const short y, const float z)
 {
 	double ux, uy, uz;
 
-		gluUnProject(x,y,z, mats->modelview, mats->projection,
-			 (GLint *)mats->viewport, &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;
 }
-#endif
 
 /* use view3d_get_object_project_mat to get projecting mat */
-void ED_view3d_project_float(const ARegion *ar, const float vec[3], float adr[2], float mat[4][4])
+void ED_view3d_project_float_v2(const ARegion *ar, const float vec[3], float adr[2], float mat[4][4])
 {
 	float vec4[4];
 	
-	adr[0]= IS_CLIPPED;
 	copy_v3_v3(vec4, vec);
-	vec4[3]= 1.0;
+	vec4[3] = 1.0;
+	/* adr[0]= IS_CLIPPED; */ /* always overwritten */
 	
 	mul_m4_v4(mat, vec4);
 	
-	if( vec4[3]>FLT_EPSILON ) {
-		adr[0] = (float)(ar->winx/2.0f)+(ar->winx/2.0f)*vec4[0]/vec4[3];	
-		adr[1] = (float)(ar->winy/2.0f)+(ar->winy/2.0f)*vec4[1]/vec4[3];
-	} else {
+	if (vec4[3] > FLT_EPSILON) {
+		adr[0] = (float)(ar->winx / 2.0f) + (ar->winx / 2.0f) * vec4[0] / vec4[3];
+		adr[1] = (float)(ar->winy / 2.0f) + (ar->winy / 2.0f) * vec4[1] / vec4[3];
+	}
+	else {
 		adr[0] = adr[1] = 0.0f;
 	}
 }
 
 /* use view3d_get_object_project_mat to get projecting mat */
-void ED_view3d_project_float_v3(ARegion *ar, float *vec, float *adr, float mat[4][4])
+void ED_view3d_project_float_v3(ARegion *ar, const float vec[3], float adr[3], float mat[4][4])
 {
 	float vec4[4];
 	
 	copy_v3_v3(vec4, vec);
-	vec4[3]= 1.0;
-	adr[0]= IS_CLIPPED;
+	vec4[3] = 1.0;
+	/* adr[0]= IS_CLIPPED; */ /* always overwritten */
 	
 	mul_m4_v4(mat, vec4);
 	
-	if( vec4[3]>FLT_EPSILON ) {
-		adr[0] = (float)(ar->winx/2.0f)+(ar->winx/2.0f)*vec4[0]/vec4[3];	
-		adr[1] = (float)(ar->winy/2.0f)+(ar->winy/2.0f)*vec4[1]/vec4[3];
-		adr[2] = vec4[2]/vec4[3];
-	} else {
-		adr[0] = adr[1] = adr[2] = 0.0f;
+	if (vec4[3] > FLT_EPSILON) {
+		adr[0] = (float)(ar->winx / 2.0f) + (ar->winx / 2.0f) * vec4[0] / vec4[3];
+		adr[1] = (float)(ar->winy / 2.0f) + (ar->winy / 2.0f) * vec4[1] / vec4[3];
+		adr[2] = vec4[2] / vec4[3];
+	}
+	else {
+		zero_v3(adr);
 	}
 }
 
@@ -816,61 +817,62 @@ int ED_view3d_boundbox_clip(RegionView3D *rv3d, float obmat[][4], BoundBox *bb)
 	
 	float mat[4][4];
 	float vec[4], min, max;
-	int a, flag= -1, fl;
+	int a, flag = -1, fl;
 	
-	if(bb==NULL) return 1;
-	if(bb->flag & OB_BB_DISABLED) return 1;
+	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++) {
+	for (a = 0; a < 8; a++) {
 		copy_v3_v3(vec, bb->vec[a]);
-		vec[3]= 1.0;
+		vec[3] = 1.0;
 		mul_m4_v4(mat, vec);
-		max= vec[3];
-		min= -vec[3];
+		max = vec[3];
+		min = -vec[3];
 		
-		fl= 0;
-		if(vec[0] < min) fl+= 1;
-		if(vec[0] > max) fl+= 2;
-		if(vec[1] < min) fl+= 4;
-		if(vec[1] > max) fl+= 8;
-		if(vec[2] < min) fl+= 16;
-		if(vec[2] > max) fl+= 32;
+		fl = 0;
+		if (vec[0] < min) fl += 1;
+		if (vec[0] > max) fl += 2;
+		if (vec[1] < min) fl += 4;
+		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;
+		if (flag == 0) return 1;
 	}
 	
 	return 0;
 }
 
-void project_short(ARegion *ar, const float vec[3], short adr[2])	/* clips */
+void project_short(ARegion *ar, const float vec[3], short adr[2])   /* clips */
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 	float fx, fy, vec4[4];
 	
-	adr[0]= IS_CLIPPED;
+	adr[0] = IS_CLIPPED;
 	
-	if(rv3d->rflag & RV3D_CLIPPING) {
-		if(ED_view3d_test_clipping(rv3d, vec, 0))
+	if (rv3d->rflag & RV3D_CLIPPING) {
+		if (ED_view3d_clipping_test(rv3d, vec, FALSE)) {
 			return;
+		}
 	}
 	
 	copy_v3_v3(vec4, vec);
-	vec4[3]= 1.0;
+	vec4[3] = 1.0;
 	mul_m4_v4(rv3d->persmat, vec4);
 	
-	if( vec4[3] > (float)BL_NEAR_CLIP ) {	/* 0.001 is the NEAR clipping cutoff for picking */
-		fx= (ar->winx/2)*(1 + vec4[0]/vec4[3]);
+	if (vec4[3] > (float)BL_NEAR_CLIP) {    /* 0.001 is the NEAR clipping cutoff for picking */
+		fx = (ar->winx / 2) * (1 + vec4[0] / vec4[3]);
 		
-		if( fx>0 && fx<ar->winx) {
+		if (fx > 0 && fx < ar->winx) {
 			
-			fy= (ar->winy/2)*(1 + vec4[1]/vec4[3]);
+			fy = (ar->winy / 2) * (1 + vec4[1] / vec4[3]);
 			
-			if(fy > 0.0f && fy < (float)ar->winy) {
-				adr[0]= (short)floor(fx); 
-				adr[1]= (short)floor(fy);
+			if (fy > 0.0f && fy < (float)ar->winy) {
+				adr[0] = (short)floor(fx);
+				adr[1] = (short)floor(fy);
 			}
 		}
 	}
@@ -878,24 +880,24 @@ void project_short(ARegion *ar, const float vec[3], short adr[2])	/* clips */
 
 void project_int(ARegion *ar, const float vec[3], int adr[2])
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 	float fx, fy, vec4[4];
 	
 	copy_v3_v3(vec4, vec);
-	vec4[3]= 1.0;
-	adr[0]= (int)2140000000.0f;
+	vec4[3] = 1.0;
+	adr[0] = (int)2140000000.0f;
 	
 	mul_m4_v4(rv3d->persmat, vec4);
 	
-	if( vec4[3] > (float)BL_NEAR_CLIP ) {	/* 0.001 is the NEAR clipping cutoff for picking */
-		fx= (ar->winx/2)*(1 + vec4[0]/vec4[3]);
+	if (vec4[3] > (float)BL_NEAR_CLIP) {    /* 0.001 is the NEAR clipping cutoff for picking */
+		fx = (ar->winx / 2) * (1 + vec4[0] / vec4[3]);
 		
-		if( fx>-2140000000.0f && fx<2140000000.0f) {
-			fy= (ar->winy/2)*(1 + vec4[1]/vec4[3]);
+		if (fx > -2140000000.0f && fx < 2140000000.0f) {
+			fy = (ar->winy / 2) * (1 + vec4[1] / vec4[3]);
 			
-			if(fy>-2140000000.0f && fy<2140000000.0f) {
-				adr[0]= (int)floor(fx); 
-				adr[1]= (int)floor(fy);
+			if (fy > -2140000000.0f && fy < 2140000000.0f) {
+				adr[0] = (int)floor(fx);
+				adr[1] = (int)floor(fy);
 			}
 		}
 	}
@@ -903,17 +905,17 @@ void project_int(ARegion *ar, const float vec[3], int adr[2])
 
 void project_int_noclip(ARegion *ar, const float vec[3], int adr[2])
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 	float fx, fy, vec4[4];
 	
 	copy_v3_v3(vec4, vec);
-	vec4[3]= 1.0;
+	vec4[3] = 1.0;
 	
 	mul_m4_v4(rv3d->persmat, vec4);
 	
-	if( fabs(vec4[3]) > BL_NEAR_CLIP ) {
-		fx = (ar->winx/2)*(1 + vec4[0]/vec4[3]);
-		fy = (ar->winy/2)*(1 + vec4[1]/vec4[3]);
+	if (fabs(vec4[3]) > BL_NEAR_CLIP) {
+		fx = (ar->winx / 2) * (1 + vec4[0] / vec4[3]);
+		fy = (ar->winy / 2) * (1 + vec4[1] / vec4[3]);
 		
 		adr[0] = (int)floor(fx); 
 		adr[1] = (int)floor(fy);
@@ -926,25 +928,25 @@ void project_int_noclip(ARegion *ar, const float vec[3], int adr[2])
 
 void project_short_noclip(ARegion *ar, const float vec[3], short adr[2])
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 	float fx, fy, vec4[4];
 	
 	copy_v3_v3(vec4, vec);
-	vec4[3]= 1.0;
-	adr[0]= IS_CLIPPED;
+	vec4[3] = 1.0;
+	adr[0] = IS_CLIPPED;
 	
 	mul_m4_v4(rv3d->persmat, vec4);
 	
-	if( vec4[3] > (float)BL_NEAR_CLIP ) {	/* 0.001 is the NEAR clipping cutoff for picking */
-		fx= (ar->winx/2)*(1 + vec4[0]/vec4[3]);
+	if (vec4[3] > (float)BL_NEAR_CLIP) {    /* 0.001 is the NEAR clipping cutoff for picking */
+		fx = (ar->winx / 2) * (1 + vec4[0] / vec4[3]);
 		
-		if( fx>-32700 && fx<32700) {
+		if (fx > -32700 && fx < 32700) {
 			
-			fy= (ar->winy/2)*(1 + vec4[1]/vec4[3]);
+			fy = (ar->winy / 2) * (1 + vec4[1] / vec4[3]);
 			
-			if(fy > -32700.0f && fy < 32700.0f) {
-				adr[0]= (short)floor(fx); 
-				adr[1]= (short)floor(fy);
+			if (fy > -32700.0f && fy < 32700.0f) {
+				adr[0] = (short)floor(fx);
+				adr[1] = (short)floor(fy);
 			}
 		}
 	}
@@ -955,37 +957,37 @@ void apply_project_float(float persmat[4][4], int winx, int winy, const float ve
 	float vec4[4];
 
 	copy_v3_v3(vec4, vec);
-	vec4[3]= 1.0;
-	adr[0]= IS_CLIPPED;
+	vec4[3] = 1.0;
+	adr[0] = IS_CLIPPED;
 
 	mul_m4_v4(persmat, vec4);
 
-	if(vec4[3] > (float)BL_NEAR_CLIP) {
-		adr[0] = (float)(winx/2.0f)+(winx/2.0f)*vec4[0]/vec4[3];
-		adr[1] = (float)(winy/2.0f)+(winy/2.0f)*vec4[1]/vec4[3];
+	if (vec4[3] > (float)BL_NEAR_CLIP) {
+		adr[0] = (float)(winx / 2.0f) + (winx / 2.0f) * vec4[0] / vec4[3];
+		adr[1] = (float)(winy / 2.0f) + (winy / 2.0f) * vec4[1] / vec4[3];
 	}
 }
 
 void project_float(ARegion *ar, const float vec[3], float adr[2])
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 
 	apply_project_float(rv3d->persmat, ar->winx, ar->winy, vec, adr);
 }
 
 void project_float_noclip(ARegion *ar, const float vec[3], float adr[2])
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 	float vec4[4];
 	
 	copy_v3_v3(vec4, vec);
-	vec4[3]= 1.0;
+	vec4[3] = 1.0;
 	
 	mul_m4_v4(rv3d->persmat, vec4);
 	
-	if( fabs(vec4[3]) > BL_NEAR_CLIP ) {
-		adr[0] = (float)(ar->winx/2.0f)+(ar->winx/2.0f)*vec4[0]/vec4[3];
-		adr[1] = (float)(ar->winy/2.0f)+(ar->winy/2.0f)*vec4[1]/vec4[3];
+	if (fabs(vec4[3]) > BL_NEAR_CLIP) {
+		adr[0] = (float)(ar->winx / 2.0f) + (ar->winx / 2.0f) * vec4[0] / vec4[3];
+		adr[1] = (float)(ar->winy / 2.0f) + (ar->winy / 2.0f) * vec4[1] / vec4[3];
 	}
 	else {
 		adr[0] = ar->winx / 2.0f;
@@ -1001,8 +1003,8 @@ int ED_view3d_clip_range_get(View3D *v3d, RegionView3D *rv3d, float *clipsta, fl
 	camera_params_init(&params);
 	camera_params_from_view3d(&params, v3d, rv3d);
 
-	if(clipsta) *clipsta= params.clipsta;
-	if(clipend) *clipend= params.clipend;
+	if (clipsta) *clipsta = params.clipsta;
+	if (clipend) *clipend = params.clipend;
 
 	return params.is_ortho;
 }
@@ -1017,22 +1019,22 @@ int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winx, int winy,
 	camera_params_from_view3d(&params, v3d, rv3d);
 	camera_params_compute_viewplane(&params, winx, winy, 1.0f, 1.0f);
 
-	if(viewplane) *viewplane= params.viewplane;
-	if(clipsta) *clipsta= params.clipsta;
-	if(clipend) *clipend= params.clipend;
+	if (viewplane) *viewplane = params.viewplane;
+	if (clipsta) *clipsta = params.clipsta;
+	if (clipend) *clipend = params.clipend;
 	
 	return params.is_ortho;
 }
 
-void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect)		/* rect: for picking */
+void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect)       /* rect: for picking */
 {
-	RegionView3D *rv3d= ar->regiondata;
+	RegionView3D *rv3d = ar->regiondata;
 	rctf viewplane;
 	float clipsta, clipend, x1, y1, x2, y2;
 	int orth;
 	
-	orth= ED_view3d_viewplane_get(v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend);
-	rv3d->is_persp= !orth;
+	orth = ED_view3d_viewplane_get(v3d, rv3d, ar->winx, ar->winy, &viewplane, &clipsta, &clipend);
+	rv3d->is_persp = !orth;
 
 #if 0
 	printf("%s: %d %d %f %f %f %f %f %f\n", __func__, winx, winy,
@@ -1040,32 +1042,32 @@ void setwinmatrixview3d(ARegion *ar, View3D *v3d, rctf *rect)		/* rect: for pick
 	       clipsta, clipend);
 #endif
 
-	x1= viewplane.xmin;
-	y1= viewplane.ymin;
-	x2= viewplane.xmax;
-	y2= viewplane.ymax;
-	
-	if(rect) {		/* picking */
-		rect->xmin/= (float)ar->winx;
-		rect->xmin= x1+rect->xmin*(x2-x1);
-		rect->ymin/= (float)ar->winy;
-		rect->ymin= y1+rect->ymin*(y2-y1);
-		rect->xmax/= (float)ar->winx;
-		rect->xmax= x1+rect->xmax*(x2-x1);
-		rect->ymax/= (float)ar->winy;
-		rect->ymax= y1+rect->ymax*(y2-y1);
+	x1 = viewplane.xmin;
+	y1 = viewplane.ymin;
+	x2 = viewplane.xmax;
+	y2 = viewplane.ymax;
+
+	if (rect) {  /* picking */
+		rect->xmin /= (float)ar->winx;
+		rect->xmin = x1 + rect->xmin * (x2 - x1);
+		rect->ymin /= (float)ar->winy;
+		rect->ymin = y1 + rect->ymin * (y2 - y1);
+		rect->xmax /= (float)ar->winx;
+		rect->xmax = x1 + rect->xmax * (x2 - x1);
+		rect->ymax /= (float)ar->winy;
+		rect->ymax = y1 + rect->ymax * (y2 - y1);
 		
-		if(orth) wmOrtho(rect->xmin, rect->xmax, rect->ymin, rect->ymax, -clipend, clipend);
+		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);
+		if (orth) wmOrtho(x1, x2, y1, y2, clipsta, clipend);
 		else wmFrustum(x1, x2, y1, y2, clipsta, clipend);
 	}
 
 	/* update matrix in 3d view region */
-	glGetFloatv(GL_PROJECTION_MATRIX, (float*)rv3d->winmat);
+	glGetFloatv(GL_PROJECTION_MATRIX, (float *)rv3d->winmat);
 }
 
 static void obmat_to_viewmat(View3D *v3d, RegionView3D *rv3d, Object *ob, short smooth)
@@ -1073,7 +1075,7 @@ static void obmat_to_viewmat(View3D *v3d, RegionView3D *rv3d, Object *ob, short
 	float bmat[4][4];
 	float tmat[3][3];
 	
-	rv3d->view= RV3D_VIEW_USER; /* dont show the grid */
+	rv3d->view = RV3D_VIEW_USER; /* don't show the grid */
 	
 	copy_m4_m4(bmat, ob->obmat);
 	normalize_m4(bmat);
@@ -1083,122 +1085,124 @@ static void obmat_to_viewmat(View3D *v3d, RegionView3D *rv3d, Object *ob, short
 	copy_m3_m4(tmat, rv3d->viewmat);
 	if (smooth) {
 		float new_quat[4];
-		if (rv3d->persp==RV3D_CAMOB && v3d->camera) {
+		if (rv3d->persp == RV3D_CAMOB && v3d->camera) {
 			/* were from a camera view */
 			
 			float orig_ofs[3];
-			float orig_dist= rv3d->dist;
-			float orig_lens= v3d->lens;
+			float orig_dist = rv3d->dist;
+			float orig_lens = v3d->lens;
 			copy_v3_v3(orig_ofs, rv3d->ofs);
 			
 			/* Switch from camera view */
-			mat3_to_quat( new_quat,tmat);
+			mat3_to_quat(new_quat, tmat);
 			
-			rv3d->persp=RV3D_PERSP;
-			rv3d->dist= 0.0;
+			rv3d->persp = RV3D_PERSP;
+			rv3d->dist = 0.0;
 			
 			ED_view3d_from_object(v3d->camera, rv3d->ofs, NULL, NULL, &v3d->lens);
 			smooth_view(NULL, NULL, NULL, NULL, NULL, orig_ofs, new_quat, &orig_dist, &orig_lens); // XXX
 			
-			rv3d->persp=RV3D_CAMOB; /* just to be polite, not needed */
+			rv3d->persp = RV3D_CAMOB; /* just to be polite, not needed */
 			
-		} else {
-			mat3_to_quat( new_quat,tmat);
+		}
+		else {
+			mat3_to_quat(new_quat, tmat);
 			smooth_view(NULL, NULL, NULL, NULL, NULL, NULL, new_quat, NULL, NULL); // XXX
 		}
-	} else {
-		mat3_to_quat( rv3d->viewquat,tmat);
+	}
+	else {
+		mat3_to_quat(rv3d->viewquat, tmat);
 	}
 }
 
-#define QUATSET(a, b, c, d, e)	a[0]=b; a[1]=c; a[2]=d; a[3]=e; 
+#define QUATSET(a, b, c, d, e) { a[0] = b; a[1] = c; a[2] = d; a[3] = e; } (void)0
 
 int ED_view3d_lock(RegionView3D *rv3d)
 {
-	switch(rv3d->view) {
-	case RV3D_VIEW_BOTTOM :
-		QUATSET(rv3d->viewquat,0.0, -1.0, 0.0, 0.0);
-		break;
+	switch (rv3d->view) {
+		case RV3D_VIEW_BOTTOM:
+			QUATSET(rv3d->viewquat, 0.0, -1.0, 0.0, 0.0);
+			break;
 
-	case RV3D_VIEW_BACK:
-		QUATSET(rv3d->viewquat,0.0, 0.0, (float)-cos(M_PI/4.0), (float)-cos(M_PI/4.0));
-		break;
+		case RV3D_VIEW_BACK:
+			QUATSET(rv3d->viewquat, 0.0, 0.0, (float)-cos(M_PI / 4.0), (float)-cos(M_PI / 4.0));
+			break;
 
-	case RV3D_VIEW_LEFT:
-		QUATSET(rv3d->viewquat,0.5, -0.5, 0.5, 0.5);
-		break;
+		case RV3D_VIEW_LEFT:
+			QUATSET(rv3d->viewquat, 0.5, -0.5, 0.5, 0.5);
+			break;
 
-	case RV3D_VIEW_TOP:
-		QUATSET(rv3d->viewquat,1.0, 0.0, 0.0, 0.0);
-		break;
+		case RV3D_VIEW_TOP:
+			QUATSET(rv3d->viewquat, 1.0, 0.0, 0.0, 0.0);
+			break;
 
-	case RV3D_VIEW_FRONT:
-		QUATSET(rv3d->viewquat,(float)cos(M_PI/4.0), (float)-sin(M_PI/4.0), 0.0, 0.0);
-		break;
+		case RV3D_VIEW_FRONT:
+			QUATSET(rv3d->viewquat, (float)cos(M_PI / 4.0), (float)-sin(M_PI / 4.0), 0.0, 0.0);
+			break;
 
-	case RV3D_VIEW_RIGHT:
-		QUATSET(rv3d->viewquat, 0.5, -0.5, -0.5, -0.5);
-		break;
-	default:
-		return FALSE;
+		case RV3D_VIEW_RIGHT:
+			QUATSET(rv3d->viewquat, 0.5, -0.5, -0.5, -0.5);
+			break;
+		default:
+			return FALSE;
 	}
 
 	return TRUE;
 }
 
-/* dont set windows active in here, is used by renderwin too */
+/* don't set windows active in here, is used by renderwin too */
 void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d)
 {
-	if(rv3d->persp==RV3D_CAMOB) {	    /* obs/camera */
-		if(v3d->camera) {
+	if (rv3d->persp == RV3D_CAMOB) {      /* obs/camera */
+		if (v3d->camera) {
 			where_is_object(scene, v3d->camera);	
 			obmat_to_viewmat(v3d, rv3d, v3d->camera, 0);
 		}
 		else {
-			quat_to_mat4( rv3d->viewmat,rv3d->viewquat);
-			rv3d->viewmat[3][2]-= rv3d->dist;
+			quat_to_mat4(rv3d->viewmat, rv3d->viewquat);
+			rv3d->viewmat[3][2] -= rv3d->dist;
 		}
 	}
 	else {
 		/* should be moved to better initialize later on XXX */
-		if(rv3d->viewlock)
+		if (rv3d->viewlock)
 			ED_view3d_lock(rv3d);
 		
-		quat_to_mat4( rv3d->viewmat,rv3d->viewquat);
-		if(rv3d->persp==RV3D_PERSP) rv3d->viewmat[3][2]-= rv3d->dist;
-		if(v3d->ob_centre) {
-			Object *ob= v3d->ob_centre;
+		quat_to_mat4(rv3d->viewmat, rv3d->viewquat);
+		if (rv3d->persp == RV3D_PERSP) rv3d->viewmat[3][2] -= rv3d->dist;
+		if (v3d->ob_centre) {
+			Object *ob = v3d->ob_centre;
 			float vec[3];
 			
 			copy_v3_v3(vec, ob->obmat[3]);
-			if(ob->type==OB_ARMATURE && v3d->ob_centre_bone[0]) {
-				bPoseChannel *pchan= get_pose_channel(ob->pose, v3d->ob_centre_bone);
-				if(pchan) {
+			if (ob->type == OB_ARMATURE && v3d->ob_centre_bone[0]) {
+				bPoseChannel *pchan = get_pose_channel(ob->pose, v3d->ob_centre_bone);
+				if (pchan) {
 					copy_v3_v3(vec, pchan->pose_mat[3]);
 					mul_m4_v3(ob->obmat, vec);
 				}
 			}
-			translate_m4( rv3d->viewmat,-vec[0], -vec[1], -vec[2]);
+			translate_m4(rv3d->viewmat, -vec[0], -vec[1], -vec[2]);
 		}
 		else if (v3d->ob_centre_cursor) {
 			float vec[3];
 			copy_v3_v3(vec, give_cursor(scene, v3d));
 			translate_m4(rv3d->viewmat, -vec[0], -vec[1], -vec[2]);
 		}
-		else translate_m4( rv3d->viewmat,rv3d->ofs[0], rv3d->ofs[1], rv3d->ofs[2]);
+		else translate_m4(rv3d->viewmat, rv3d->ofs[0], rv3d->ofs[1], rv3d->ofs[2]);
 	}
 }
 
-/* IGLuint-> GLuint*/
+/* IGLuint-> GLuint */
 /* Warning: be sure to account for a negative return value
-*   This is an error, "Too many objects in select buffer"
-*   and no action should be taken (can crash blender) if this happens
-*/
+ *   This is an error, "Too many objects in select buffer"
+ *   and no action should be taken (can crash blender) if this happens
+ */
 short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int bufsize, rcti *input)
 {
-	Scene *scene= vc->scene;
-	View3D *v3d= vc->v3d;
-	ARegion *ar= vc->ar;
+	Scene *scene = vc->scene;
+	View3D *v3d = vc->v3d;
+	ARegion *ar = vc->ar;
 	rctf rect;
 	short code, hits;
 	char dt, dtx;
@@ -1206,81 +1210,81 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b
 	G.f |= G_PICKSEL;
 	
 	/* case not a border select */
-	if(input->xmin==input->xmax) {
-		rect.xmin= input->xmin-12;	// seems to be default value for bones only now
-		rect.xmax= input->xmin+12;
-		rect.ymin= input->ymin-12;
-		rect.ymax= input->ymin+12;
+	if (input->xmin == input->xmax) {
+		rect.xmin = input->xmin - 12; // seems to be default value for bones only now
+		rect.xmax = input->xmin + 12;
+		rect.ymin = input->ymin - 12;
+		rect.ymax = input->ymin + 12;
 	}
 	else {
-		rect.xmin= input->xmin;
-		rect.xmax= input->xmax;
-		rect.ymin= input->ymin;
-		rect.ymax= input->ymax;
+		rect.xmin = input->xmin;
+		rect.xmax = input->xmax;
+		rect.ymin = input->ymin;
+		rect.ymax = input->ymax;
 	}
 	
 	setwinmatrixview3d(ar, v3d, &rect);
 	mult_m4_m4m4(vc->rv3d->persmat, vc->rv3d->winmat, vc->rv3d->viewmat);
 	
-	if(v3d->drawtype > OB_WIRE) {
-		v3d->zbuf= TRUE;
+	if (v3d->drawtype > OB_WIRE) {
+		v3d->zbuf = TRUE;
 		glEnable(GL_DEPTH_TEST);
 	}
 	
-	if(vc->rv3d->rflag & RV3D_CLIPPING)
-		view3d_set_clipping(vc->rv3d);
+	if (vc->rv3d->rflag & RV3D_CLIPPING)
+		ED_view3d_clipping_set(vc->rv3d);
 	
-	glSelectBuffer( bufsize, (GLuint *)buffer);
+	glSelectBuffer(bufsize, (GLuint *)buffer);
 	glRenderMode(GL_SELECT);
-	glInitNames();	/* these two calls whatfor? It doesnt work otherwise */
+	glInitNames();  /* these two calls whatfor? It doesnt work otherwise */
 	glPushName(-1);
-	code= 1;
+	code = 1;
 	
-	if(vc->obedit && vc->obedit->type==OB_MBALL) {
-		draw_object(scene, ar, v3d, BASACT, DRAW_PICKING|DRAW_CONSTCOLOR);
+	if (vc->obedit && vc->obedit->type == OB_MBALL) {
+		draw_object(scene, ar, v3d, BASACT, DRAW_PICKING | DRAW_CONSTCOLOR);
 	}
-	else if((vc->obedit && vc->obedit->type==OB_ARMATURE)) {
+	else if ((vc->obedit && vc->obedit->type == OB_ARMATURE)) {
 		/* if not drawing sketch, draw bones */
-		if(!BDR_drawSketchNames(vc)) {
-			draw_object(scene, ar, v3d, BASACT, DRAW_PICKING|DRAW_CONSTCOLOR);
+		if (!BDR_drawSketchNames(vc)) {
+			draw_object(scene, ar, v3d, BASACT, DRAW_PICKING | DRAW_CONSTCOLOR);
 		}
 	}
 	else {
 		Base *base;
 		
-		v3d->xray= TRUE;	// otherwise it postpones drawing
-		for(base= scene->base.first; base; base= base->next) {
-			if(base->lay & v3d->lay) {
+		v3d->xray = TRUE;    // otherwise it postpones drawing
+		for (base = scene->base.first; base; base = base->next) {
+			if (base->lay & v3d->lay) {
 				
 				if (base->object->restrictflag & OB_RESTRICT_SELECT)
-					base->selcol= 0;
+					base->selcol = 0;
 				else {
-					base->selcol= code;
+					base->selcol = code;
 					glLoadName(code);
-					draw_object(scene, ar, v3d, base, DRAW_PICKING|DRAW_CONSTCOLOR);
+					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) {
+					if ((base->object->transflag & OB_DUPLI) && base->object->dup_group) {
 						ListBase *lb;
 						DupliObject *dob;
 						Base tbase;
 						
-						tbase.flag= OB_FROMDUPLI;
-						lb= object_duplilist(scene, base->object);
+						tbase.flag = OB_FROMDUPLI;
+						lb = object_duplilist(scene, base->object);
 						
-						for(dob= lb->first; dob; dob= dob->next) {
-							tbase.object= dob->ob;
+						for (dob = lb->first; dob; dob = dob->next) {
+							tbase.object = dob->ob;
 							copy_m4_m4(dob->ob->obmat, dob->mat);
 							
 							/* 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;
+							dt = tbase.object->dt;   tbase.object->dt = MIN2(tbase.object->dt, base->object->dt);
+							dtx = tbase.object->dtx; tbase.object->dtx = base->object->dtx;
 
-							draw_object(scene, ar, v3d, &tbase, DRAW_PICKING|DRAW_CONSTCOLOR);
+							draw_object(scene, ar, v3d, &tbase, DRAW_PICKING | DRAW_CONSTCOLOR);
 							
-							tbase.object->dt= dt;
-							tbase.object->dtx= dtx;
+							tbase.object->dt = dt;
+							tbase.object->dtx = dtx;
 
 							copy_m4_m4(dob->ob->obmat, dob->omat);
 						}
@@ -1290,26 +1294,26 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b
 				}				
 			}
 		}
-		v3d->xray= FALSE;	// restore
+		v3d->xray = FALSE;   // restore
 	}
 	
-	glPopName();	/* see above (pushname) */
-	hits= glRenderMode(GL_RENDER);
+	glPopName();    /* see above (pushname) */
+	hits = glRenderMode(GL_RENDER);
 	
 	G.f &= ~G_PICKSEL;
 	setwinmatrixview3d(ar, v3d, NULL);
 	mult_m4_m4m4(vc->rv3d->persmat, vc->rv3d->winmat, vc->rv3d->viewmat);
 	
-	if(v3d->drawtype > OB_WIRE) {
-		v3d->zbuf= 0;
+	if (v3d->drawtype > OB_WIRE) {
+		v3d->zbuf = 0;
 		glDisable(GL_DEPTH_TEST);
 	}
 // XXX	persp(PERSP_WIN);
 	
-	if(vc->rv3d->rflag & RV3D_CLIPPING)
-		view3d_clr_clipping();
+	if (vc->rv3d->rflag & RV3D_CLIPPING)
+		ED_view3d_clipping_disable();
 	
-	if(hits<0) printf("Too many objects in select buffer\n");	// XXX make error message
+	if (hits < 0) printf("Too many objects in select buffer\n");  // XXX make error message
 	
 	return hits;
 }
@@ -1322,64 +1326,64 @@ static unsigned int free_localbit(Main *bmain)
 	ScrArea *sa;
 	bScreen *sc;
 	
-	lay= 0;
+	lay = 0;
 	
 	/* sometimes we loose a localview: when an area is closed */
 	/* check all areas: which localviews are in use? */
-	for(sc= bmain->screen.first; sc; sc= sc->id.next) {
-		for(sa= sc->areabase.first; sa; sa= sa->next) {
-			SpaceLink *sl= sa->spacedata.first;
-			for(; sl; sl= sl->next) {
-				if(sl->spacetype==SPACE_VIEW3D) {
-					View3D *v3d= (View3D*) sl;
+	for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+		for (sa = sc->areabase.first; sa; sa = sa->next) {
+			SpaceLink *sl = sa->spacedata.first;
+			for (; sl; sl = sl->next) {
+				if (sl->spacetype == SPACE_VIEW3D) {
+					View3D *v3d = (View3D *) sl;
 					lay |= v3d->lay;
 				}
 			}
 		}
 	}
 	
-	if( (lay & 0x01000000)==0) return 0x01000000;
-	if( (lay & 0x02000000)==0) return 0x02000000;
-	if( (lay & 0x04000000)==0) return 0x04000000;
-	if( (lay & 0x08000000)==0) return 0x08000000;
-	if( (lay & 0x10000000)==0) return 0x10000000;
-	if( (lay & 0x20000000)==0) return 0x20000000;
-	if( (lay & 0x40000000)==0) return 0x40000000;
-	if( (lay & 0x80000000)==0) return 0x80000000;
+	if ((lay & 0x01000000) == 0) return 0x01000000;
+	if ((lay & 0x02000000) == 0) return 0x02000000;
+	if ((lay & 0x04000000) == 0) return 0x04000000;
+	if ((lay & 0x08000000) == 0) return 0x08000000;
+	if ((lay & 0x10000000) == 0) return 0x10000000;
+	if ((lay & 0x20000000) == 0) return 0x20000000;
+	if ((lay & 0x40000000) == 0) return 0x40000000;
+	if ((lay & 0x80000000) == 0) return 0x80000000;
 	
 	return 0;
 }
 
 int ED_view3d_scene_layer_set(int lay, const int *values, int *active)
 {
-	int i, tot= 0;
+	int i, tot = 0;
 	
 	/* ensure we always have some layer selected */
-	for(i=0; i<20; i++)
-		if(values[i])
+	for (i = 0; i < 20; i++)
+		if (values[i])
 			tot++;
 	
-	if(tot==0)
+	if (tot == 0)
 		return lay;
 	
-	for(i=0; i<20; i++) {
+	for (i = 0; i < 20; i++) {
 		
 		if (active) {
 			/* if this value has just been switched on, make that layer active */
-			if (values[i] && (lay & (1<<i))==0) {
-				*active = (1<<i);
+			if (values[i] && (lay & (1 << i)) == 0) {
+				*active = (1 << i);
 			}
 		}
 			
-		if (values[i]) lay |= (1<<i);
-		else lay &= ~(1<<i);
+		if (values[i]) lay |= (1 << i);
+		else lay &= ~(1 << i);
 	}
 	
 	/* ensure always an active layer */
-	if (active && (lay & *active)==0) {
-		for(i=0; i<20; i++) {
-			if(lay & (1<<i)) {
-				*active= 1<<i;
+	if (active && (lay & *active) == 0) {
+		for (i = 0; i < 20; i++) {
+			if (lay & (1 << i)) {
+				*active = 1 << i;
 				break;
 			}
 		}
@@ -1390,97 +1394,97 @@ int ED_view3d_scene_layer_set(int lay, const int *values, int *active)
 
 static void initlocalview(Main *bmain, Scene *scene, ScrArea *sa)
 {
-	View3D *v3d= sa->spacedata.first;
+	View3D *v3d = sa->spacedata.first;
 	Base *base;
 	float size = 0.0, min[3], max[3], box[3];
 	unsigned int locallay;
-	int ok=0;
+	int ok = 0;
 
-	if(v3d->localvd) return;
+	if (v3d->localvd) return;
 
 	INIT_MINMAX(min, max);
 
-	locallay= free_localbit(bmain);
+	locallay = free_localbit(bmain);
 
-	if(locallay==0) {
-		printf("Sorry, no more than 8 localviews\n");	// XXX error 
-		ok= 0;
+	if (locallay == 0) {
+		printf("Sorry, no more than 8 localviews\n");   // XXX error
+		ok = 0;
 	}
 	else {
-		if(scene->obedit) {
+		if (scene->obedit) {
 			minmax_object(scene->obedit, min, max);
 			
-			ok= 1;
+			ok = 1;
 		
 			BASACT->lay |= locallay;
-			scene->obedit->lay= BASACT->lay;
+			scene->obedit->lay = BASACT->lay;
 		}
 		else {
-			for(base= FIRSTBASE; base; base= base->next) {
-				if(TESTBASE(v3d, base))  {
+			for (base = FIRSTBASE; base; base = base->next) {
+				if (TESTBASE(v3d, base)) {
 					minmax_object(base->object, min, max);
 					base->lay |= locallay;
-					base->object->lay= base->lay;
-					ok= 1;
+					base->object->lay = base->lay;
+					ok = 1;
 				}
 			}
 		}
 		
-		box[0]= (max[0]-min[0]);
-		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;
+		box[0] = (max[0] - min[0]);
+		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;
 	}
 	
-	if(ok) {
+	if (ok) {
 		ARegion *ar;
 		
-		v3d->localvd= MEM_mallocN(sizeof(View3D), "localview");
+		v3d->localvd = MEM_mallocN(sizeof(View3D), "localview");
 		
 		memcpy(v3d->localvd, v3d, sizeof(View3D));
 
-		for(ar= sa->regionbase.first; ar; ar= ar->next) {
-			if(ar->regiontype == RGN_TYPE_WINDOW) {
-				RegionView3D *rv3d= ar->regiondata;
+		for (ar = sa->regionbase.first; ar; ar = ar->next) {
+			if (ar->regiontype == RGN_TYPE_WINDOW) {
+				RegionView3D *rv3d = ar->regiondata;
 
-				rv3d->localvd= MEM_mallocN(sizeof(RegionView3D), "localview region");
+				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;
+				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;
 
-				rv3d->dist= size;
+				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 *= 0.7f;
 
 				// correction for window aspect ratio
-				if(ar->winy>2 && ar->winx>2) {
-					float asp= (float)ar->winx/(float)ar->winy;
-					if(asp < 1.0f) asp= 1.0f/asp;
-					rv3d->dist*= asp;
+				if (ar->winy > 2 && ar->winx > 2) {
+					float asp = (float)ar->winx / (float)ar->winy;
+					if (asp < 1.0f) asp = 1.0f / asp;
+					rv3d->dist *= asp;
 				}
 				
-				if (rv3d->persp==RV3D_CAMOB) rv3d->persp= RV3D_PERSP;
+				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];
+				v3d->cursor[0] = -rv3d->ofs[0];
+				v3d->cursor[1] = -rv3d->ofs[1];
+				v3d->cursor[2] = -rv3d->ofs[2];
 			}
 		}
 		
-		v3d->lay= locallay;
+		v3d->lay = locallay;
 	}
 	else {
 		/* clear flags */ 
-		for(base= FIRSTBASE; base; base= base->next) {
-			if( base->lay & locallay ) {
-				base->lay-= locallay;
-				if(base->lay==0) base->lay= v3d->layact;
-				if(base->object != scene->obedit) base->flag |= SELECT;
-				base->object->lay= base->lay;
+		for (base = FIRSTBASE; base; base = base->next) {
+			if (base->lay & locallay) {
+				base->lay -= locallay;
+				if (base->lay == 0) base->lay = v3d->layact;
+				if (base->object != scene->obedit) base->flag |= SELECT;
+				base->object->lay = base->lay;
 			}
 		}		
 	}
@@ -1490,37 +1494,37 @@ static void initlocalview(Main *bmain, Scene *scene, ScrArea *sa)
 static void restore_localviewdata(ScrArea *sa, int free)
 {
 	ARegion *ar;
-	View3D *v3d= sa->spacedata.first;
+	View3D *v3d = sa->spacedata.first;
 	
-	if(v3d->localvd==NULL) return;
+	if (v3d->localvd == NULL) return;
 	
-	v3d->near= v3d->localvd->near;
-	v3d->far= v3d->localvd->far;
-	v3d->lay= v3d->localvd->lay;
-	v3d->layact= v3d->localvd->layact;
-	v3d->drawtype= v3d->localvd->drawtype;
-	v3d->camera= v3d->localvd->camera;
+	v3d->near = v3d->localvd->near;
+	v3d->far = v3d->localvd->far;
+	v3d->lay = v3d->localvd->lay;
+	v3d->layact = v3d->localvd->layact;
+	v3d->drawtype = v3d->localvd->drawtype;
+	v3d->camera = v3d->localvd->camera;
 	
-	if(free) {
+	if (free) {
 		MEM_freeN(v3d->localvd);
-		v3d->localvd= NULL;
+		v3d->localvd = NULL;
 	}
 	
-	for(ar= sa->regionbase.first; ar; ar= ar->next) {
-		if(ar->regiontype == RGN_TYPE_WINDOW) {
-			RegionView3D *rv3d= ar->regiondata;
+	for (ar = sa->regionbase.first; ar; ar = ar->next) {
+		if (ar->regiontype == RGN_TYPE_WINDOW) {
+			RegionView3D *rv3d = ar->regiondata;
 			
-			if(rv3d->localvd) {
-				rv3d->dist= rv3d->localvd->dist;
+			if (rv3d->localvd) {
+				rv3d->dist = rv3d->localvd->dist;
 				copy_v3_v3(rv3d->ofs, rv3d->localvd->ofs);
 				copy_qt_qt(rv3d->viewquat, rv3d->localvd->viewquat);
-				rv3d->view= rv3d->localvd->view;
-				rv3d->persp= rv3d->localvd->persp;
-				rv3d->camzoom= rv3d->localvd->camzoom;
+				rv3d->view = rv3d->localvd->view;
+				rv3d->persp = rv3d->localvd->persp;
+				rv3d->camzoom = rv3d->localvd->camzoom;
 
-				if(free) {
+				if (free) {
 					MEM_freeN(rv3d->localvd);
-					rv3d->localvd= NULL;
+					rv3d->localvd = NULL;
 				}
 			}
 		}
@@ -1529,28 +1533,28 @@ static void restore_localviewdata(ScrArea *sa, int free)
 
 static void endlocalview(Main *bmain, Scene *scene, ScrArea *sa)
 {
-	View3D *v3d= sa->spacedata.first;
+	View3D *v3d = sa->spacedata.first;
 	struct Base *base;
 	unsigned int locallay;
 	
-	if(v3d->localvd) {
+	if (v3d->localvd) {
 		
-		locallay= v3d->lay & 0xFF000000;
+		locallay = v3d->lay & 0xFF000000;
 		
 		restore_localviewdata(sa, 1); // 1 = free
 
 		/* for when in other window the layers have changed */
-		if(v3d->scenelock) v3d->lay= scene->lay;
+		if (v3d->scenelock) v3d->lay = scene->lay;
 		
-		for(base= FIRSTBASE; base; base= base->next) {
-			if( base->lay & locallay ) {
-				base->lay-= locallay;
-				if(base->lay==0) base->lay= v3d->layact;
-				if(base->object != scene->obedit) {
+		for (base = FIRSTBASE; base; base = base->next) {
+			if (base->lay & locallay) {
+				base->lay -= locallay;
+				if (base->lay == 0) base->lay = v3d->layact;
+				if (base->object != scene->obedit) {
 					base->flag |= SELECT;
 					base->object->flag |= SELECT;
 				}
-				base->object->lay= base->lay;
+				base->object->lay = base->lay;
 			}
 		}
 		
@@ -1560,9 +1564,9 @@ static void endlocalview(Main *bmain, Scene *scene, ScrArea *sa)
 
 static int localview_exec(bContext *C, wmOperator *UNUSED(unused))
 {
-	View3D *v3d= CTX_wm_view3d(C);
+	View3D *v3d = CTX_wm_view3d(C);
 	
-	if(v3d->localvd)
+	if (v3d->localvd)
 		endlocalview(CTX_data_main(C), CTX_data_scene(C), CTX_wm_area(C));
 	else
 		initlocalview(CTX_data_main(C), CTX_data_scene(C), CTX_wm_area(C));
@@ -1576,15 +1580,15 @@ void VIEW3D_OT_localview(wmOperatorType *ot)
 {
 	
 	/* identifiers */
-	ot->name= "Local View";
-	ot->description= "Toggle display of selected object(s) separately and centered in view";
-	ot->idname= "VIEW3D_OT_localview";
+	ot->name = "Local View";
+	ot->description = "Toggle display of selected object(s) separately and centered in view";
+	ot->idname = "VIEW3D_OT_localview";
 	
 	/* api callbacks */
-	ot->exec= localview_exec;
-	ot->flag= OPTYPE_UNDO; /* localview changes object layer bitflags */
+	ot->exec = localview_exec;
+	ot->flag = OPTYPE_UNDO; /* localview changes object layer bitflags */
 	
-	ot->poll= ED_operator_view3d_active;
+	ot->poll = ED_operator_view3d_active;
 }
 
 #ifdef WITH_GAMEENGINE
@@ -1596,12 +1600,12 @@ static void SaveState(bContext *C, wmWindow *win)
 	
 	glPushAttrib(GL_ALL_ATTRIB_BITS);
 
-	if(obact && obact->mode & OB_MODE_TEXTURE_PAINT)
+	if (obact && obact->mode & OB_MODE_TEXTURE_PAINT)
 		GPU_paint_set_mipmap(1);
 	
-	queue_back= win->queue;
+	queue_back = win->queue;
 	
-	win->queue.first= win->queue.last= NULL;
+	win->queue.first = win->queue.last = NULL;
 	
 	//XXX waitcursor(1);
 }
@@ -1610,7 +1614,7 @@ static void RestoreState(bContext *C, wmWindow *win)
 {
 	Object *obact = CTX_data_active_object(C);
 	
-	if(obact && obact->mode & OB_MODE_TEXTURE_PAINT)
+	if (obact && obact->mode & OB_MODE_TEXTURE_PAINT)
 		GPU_paint_set_mipmap(0);
 
 	//XXX curarea->win_swap = 0;
@@ -1621,8 +1625,8 @@ static void RestoreState(bContext *C, wmWindow *win)
 	//XXX waitcursor(0);
 	//XXX G.qual= 0;
 	
-	if(win) /* check because closing win can set to NULL */
-		win->queue= queue_back;
+	if (win) /* check because closing win can set to NULL */
+		win->queue = queue_back;
 	
 	GPU_state_init();
 	GPU_set_tpage(NULL, 0, 0);
@@ -1638,37 +1642,37 @@ static void game_set_commmandline_options(GameData *gm)
 
 	if ( (syshandle = SYS_GetSystem()) ) {
 		/* User defined settings */
-		test= (U.gameflags & USER_DISABLE_MIPMAP);
+		test = (U.gameflags & USER_DISABLE_MIPMAP);
 		GPU_set_mipmap(!test);
 		SYS_WriteCommandLineInt(syshandle, "nomipmap", test);
 
 		/* File specific settings: */
 		/* Only test the first one. These two are switched
 		 * simultaneously. */
-		test= (gm->flag & GAME_SHOW_FRAMERATE);
+		test = (gm->flag & GAME_SHOW_FRAMERATE);
 		SYS_WriteCommandLineInt(syshandle, "show_framerate", test);
 		SYS_WriteCommandLineInt(syshandle, "show_profile", test);
 
 		test = (gm->flag & GAME_SHOW_DEBUG_PROPS);
 		SYS_WriteCommandLineInt(syshandle, "show_properties", test);
 
-		test= (gm->flag & GAME_SHOW_PHYSICS);
+		test = (gm->flag & GAME_SHOW_PHYSICS);
 		SYS_WriteCommandLineInt(syshandle, "show_physics", test);
 
-		test= (gm->flag & GAME_ENABLE_ALL_FRAMES);
+		test = (gm->flag & GAME_ENABLE_ALL_FRAMES);
 		SYS_WriteCommandLineInt(syshandle, "fixedtime", test);
 
-		test= (gm->flag & GAME_ENABLE_ANIMATION_RECORD);
+		test = (gm->flag & GAME_ENABLE_ANIMATION_RECORD);
 		SYS_WriteCommandLineInt(syshandle, "animation_record", test);
 
-		test= (gm->flag & GAME_IGNORE_DEPRECATION_WARNINGS);
+		test = (gm->flag & GAME_IGNORE_DEPRECATION_WARNINGS);
 		SYS_WriteCommandLineInt(syshandle, "ignore_deprecation_warnings", test);
 
-		test= (gm->matmode == GAME_MAT_MULTITEX);
+		test = (gm->matmode == GAME_MAT_MULTITEX);
 		SYS_WriteCommandLineInt(syshandle, "blender_material", test);
-		test= (gm->matmode == GAME_MAT_GLSL);
+		test = (gm->matmode == GAME_MAT_GLSL);
 		SYS_WriteCommandLineInt(syshandle, "blender_glsl_material", test);
-		test= (gm->flag & GAME_DISPLAY_LISTS);
+		test = (gm->flag & GAME_DISPLAY_LISTS);
 		SYS_WriteCommandLineInt(syshandle, "displaylists", test);
 
 
@@ -1680,15 +1684,15 @@ static void game_set_commmandline_options(GameData *gm)
 static int game_engine_poll(bContext *C)
 {
 	/* we need a context and area to launch BGE
-	it's a temporary solution to avoid crash at load time
-	if we try to auto run the BGE. Ideally we want the
-	context to be set as soon as we load the file. */
+	 * it's a temporary solution to avoid crash at load time
+	 * if we try to auto run the BGE. Ideally we want the
+	 * context to be set as soon as we load the file. */
 
-	if(CTX_wm_window(C)==NULL) return 0;
-	if(CTX_wm_screen(C)==NULL) return 0;
-	if(CTX_wm_area(C)==NULL) return 0;
+	if (CTX_wm_window(C) == NULL) return 0;
+	if (CTX_wm_screen(C) == NULL) return 0;
+	if (CTX_wm_area(C) == NULL) return 0;
 
-	if(CTX_data_mode_enum(C)!=CTX_MODE_OBJECT)
+	if (CTX_data_mode_enum(C) != CTX_MODE_OBJECT)
 		return 0;
 
 	return 1;
@@ -1696,24 +1700,24 @@ static int game_engine_poll(bContext *C)
 
 int ED_view3d_context_activate(bContext *C)
 {
-	bScreen *sc= CTX_wm_screen(C);
-	ScrArea *sa= CTX_wm_area(C);
+	bScreen *sc = CTX_wm_screen(C);
+	ScrArea *sa = CTX_wm_area(C);
 	ARegion *ar;
 
 	/* sa can be NULL when called from python */
-	if(sa==NULL || sa->spacetype != SPACE_VIEW3D)
-		for(sa=sc->areabase.first; sa; sa= sa->next)
-			if(sa->spacetype==SPACE_VIEW3D)
+	if (sa == NULL || sa->spacetype != SPACE_VIEW3D)
+		for (sa = sc->areabase.first; sa; sa = sa->next)
+			if (sa->spacetype == SPACE_VIEW3D)
 				break;
 
-	if(!sa)
+	if (!sa)
 		return 0;
 	
-	for(ar=sa->regionbase.first; ar; ar=ar->next)
-		if(ar->regiontype == RGN_TYPE_WINDOW)
+	for (ar = sa->regionbase.first; ar; ar = ar->next)
+		if (ar->regiontype == RGN_TYPE_WINDOW)
 			break;
 	
-	if(!ar)
+	if (!ar)
 		return 0;
 	
 	// bad context switch ..
@@ -1727,33 +1731,33 @@ static int game_engine_exec(bContext *C, wmOperator *op)
 {
 #ifdef WITH_GAMEENGINE
 	Scene *startscene = CTX_data_scene(C);
-	ScrArea /* *sa, */ /* UNUSED */ *prevsa= CTX_wm_area(C);
-	ARegion *ar, *prevar= CTX_wm_region(C);
-	wmWindow *prevwin= CTX_wm_window(C);
+	ScrArea /* *sa, */ /* UNUSED */ *prevsa = CTX_wm_area(C);
+	ARegion *ar, *prevar = CTX_wm_region(C);
+	wmWindow *prevwin = CTX_wm_window(C);
 	RegionView3D *rv3d;
 	rcti cam_frame;
 
 	(void)op; /* unused */
 	
 	// bad context switch ..
-	if(!ED_view3d_context_activate(C))
+	if (!ED_view3d_context_activate(C))
 		return OPERATOR_CANCELLED;
 	
 	/* redraw to hide any menus/popups, we don't go back to
-	   the window manager until after this operator exits */
+	 * the window manager until after this operator exits */
 	WM_redraw_windows(C);
 
-	rv3d= CTX_wm_region_view3d(C);
+	rv3d = CTX_wm_region_view3d(C);
 	/* sa= CTX_wm_area(C); */ /* UNUSED */
-	ar= CTX_wm_region(C);
+	ar = CTX_wm_region(C);
 
 	view3d_operator_needs_opengl(C);
 	
 	game_set_commmandline_options(&startscene->gm);
 
-	if((rv3d->persp == RV3D_CAMOB) &&
-	   (startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) &&
-	   (startscene->gm.stereoflag != STEREO_DOME))
+	if ((rv3d->persp == RV3D_CAMOB) &&
+	    (startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) &&
+	    (startscene->gm.stereoflag != STEREO_DOME))
 	{
 		/* Letterbox */
 		rctf cam_framef;
@@ -1777,16 +1781,16 @@ static int game_engine_exec(bContext *C, wmOperator *op)
 	StartKetsjiShell(C, ar, &cam_frame, 1);
 
 	/* window wasnt closed while the BGE was running */
-	if(BLI_findindex(&CTX_wm_manager(C)->windows, prevwin) == -1) {
-		prevwin= NULL;
+	if (BLI_findindex(&CTX_wm_manager(C)->windows, prevwin) == -1) {
+		prevwin = NULL;
 		CTX_wm_window_set(C, NULL);
 	}
 	
 	ED_area_tag_redraw(CTX_wm_area(C));
 
-	if(prevwin) {
+	if (prevwin) {
 		/* restore context, in case it changed in the meantime, for
-		   example by working in another window or closing it */
+		 * example by working in another window or closing it */
 		CTX_wm_region_set(C, prevar);
 		CTX_wm_window_set(C, prevwin);
 		CTX_wm_area_set(C, prevsa);
@@ -1810,62 +1814,65 @@ void VIEW3D_OT_game_start(wmOperatorType *ot)
 {
 	
 	/* identifiers */
-	ot->name= "Start Game Engine";
-	ot->description= "Start game engine";
-	ot->idname= "VIEW3D_OT_game_start";
+	ot->name = "Start Game Engine";
+	ot->description = "Start game engine";
+	ot->idname = "VIEW3D_OT_game_start";
 	
 	/* api callbacks */
-	ot->exec= game_engine_exec;
+	ot->exec = game_engine_exec;
 	
-	ot->poll= game_engine_poll;
+	ot->poll = game_engine_poll;
 }
 
 /* ************************************** */
 
-void view3d_align_axis_to_vector(View3D *v3d, RegionView3D *rv3d, int axisidx, float vec[3])
+static void UNUSED_FUNCTION(view3d_align_axis_to_vector)(View3D *v3d, RegionView3D *rv3d, int axisidx, float vec[3])
 {
 	float alignaxis[3] = {0.0, 0.0, 0.0};
 	float norm[3], axis[3], angle, new_quat[4];
 	
-	if(axisidx > 0) alignaxis[axisidx-1]= 1.0;
-	else alignaxis[-axisidx-1]= -1.0;
+	if (axisidx > 0) alignaxis[axisidx - 1] = 1.0;
+	else alignaxis[-axisidx - 1] = -1.0;
 
 	normalize_v3_v3(norm, vec);
 
-	angle= (float)acos(dot_v3v3(alignaxis, norm));
+	angle = (float)acos(dot_v3v3(alignaxis, norm));
 	cross_v3_v3v3(axis, alignaxis, norm);
-	axis_angle_to_quat( new_quat,axis, -angle);
+	axis_angle_to_quat(new_quat, axis, -angle);
 	
-	rv3d->view= RV3D_VIEW_USER;
+	rv3d->view = RV3D_VIEW_USER;
 	
-	if (rv3d->persp==RV3D_CAMOB && v3d->camera) {
+	if (rv3d->persp == RV3D_CAMOB && v3d->camera) {
 		/* switch out of camera view */
 		float orig_ofs[3];
-		float orig_dist= rv3d->dist;
-		float orig_lens= v3d->lens;
+		float orig_dist = rv3d->dist;
+		float orig_lens = v3d->lens;
 		
 		copy_v3_v3(orig_ofs, rv3d->ofs);
-		rv3d->persp= RV3D_PERSP;
-		rv3d->dist= 0.0;
+		rv3d->persp = RV3D_PERSP;
+		rv3d->dist = 0.0;
 		ED_view3d_from_object(v3d->camera, rv3d->ofs, NULL, NULL, &v3d->lens);
 		smooth_view(NULL, NULL, NULL, NULL, NULL, orig_ofs, new_quat, &orig_dist, &orig_lens); // XXX
-	} else {
-		if (rv3d->persp==RV3D_CAMOB) rv3d->persp= RV3D_PERSP; /* switch out of camera mode */
+	}
+	else {
+		if (rv3d->persp == RV3D_CAMOB) rv3d->persp = RV3D_PERSP;  /* switch out of camera mode */
 		smooth_view(NULL, NULL, NULL, NULL, NULL, NULL, new_quat, NULL, NULL); // XXX
 	}
 }
 
 float ED_view3d_pixel_size(struct RegionView3D *rv3d, const float co[3])
 {
-	return  (rv3d->persmat[3][3] + (
-				rv3d->persmat[0][3]*co[0] +
-				rv3d->persmat[1][3]*co[1] +
-				rv3d->persmat[2][3]*co[2])
-			) * rv3d->pixsize;
+	return (rv3d->persmat[3][3] + (
+	            rv3d->persmat[0][3] * co[0] +
+	            rv3d->persmat[1][3] * co[1] +
+	            rv3d->persmat[2][3] * co[2])
+	        ) * rv3d->pixsize;
 }
 
 /* view matrix properties utilities */
 
+/* unused */
+#if 0
 void ED_view3d_operator_properties_viewmat(wmOperatorType *ot)
 {
 	PropertyRNA *prop;
@@ -1882,16 +1889,16 @@ void ED_view3d_operator_properties_viewmat(wmOperatorType *ot)
 
 void ED_view3d_operator_properties_viewmat_set(bContext *C, wmOperator *op)
 {
-	ARegion *ar= CTX_wm_region(C);
-	RegionView3D *rv3d= ED_view3d_context_rv3d(C);
+	ARegion *ar = CTX_wm_region(C);
+	RegionView3D *rv3d = ED_view3d_context_rv3d(C);
 
-	if(!RNA_struct_property_is_set(op->ptr, "region_width"))
+	if (!RNA_struct_property_is_set(op->ptr, "region_width"))
 		RNA_int_set(op->ptr, "region_width", ar->winx);
 
-	if(!RNA_struct_property_is_set(op->ptr, "region_height"))
+	if (!RNA_struct_property_is_set(op->ptr, "region_height"))
 		RNA_int_set(op->ptr, "region_height", ar->winy);
 
-	if(!RNA_struct_property_is_set(op->ptr, "perspective_matrix"))
+	if (!RNA_struct_property_is_set(op->ptr, "perspective_matrix"))
 		RNA_float_set_array(op->ptr, "perspective_matrix", (float *)rv3d->persmat);
 }
 
@@ -1902,3 +1909,4 @@ void ED_view3d_operator_properties_viewmat_get(wmOperator *op, int *winx, int *w
 
 	RNA_float_get_array(op->ptr, "perspective_matrix", (float *)persmat);
 }
+#endif
diff --git a/source/blender/editors/transform/CMakeLists.txt b/source/blender/editors/transform/CMakeLists.txt
index a659afb..05a4f6f 100644
--- a/source/blender/editors/transform/CMakeLists.txt
+++ b/source/blender/editors/transform/CMakeLists.txt
@@ -24,6 +24,7 @@ set(INC
 	../../blenkernel
 	../../blenlib
 	../../blenloader
+	../../bmesh
 	../../makesdna
 	../../makesrna
 	../../windowmanager
@@ -48,4 +49,8 @@ set(SRC
 	transform.h
 )
 
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
 blender_add_lib(bf_editor_transform "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/transform/SConscript b/source/blender/editors/transform/SConscript
index f2d5bae..dbf6179 100644
--- a/source/blender/editors/transform/SConscript
+++ b/source/blender/editors/transform/SConscript
@@ -6,6 +6,11 @@ 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'
+incs += ' ../../gpu ../../makesrna ../../blenloader ../../bmesh'
 
-env.BlenderLib ( 'bf_editors_transform', sources, Split(incs), [], libtype=['core'], priority=[40] )
+defs = []
+
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
+
+env.BlenderLib ( 'bf_editors_transform', sources, Split(incs), defs, libtype=['core'], priority=[40] )
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 9d36847..f3819a1 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -47,6 +47,7 @@
 #include "DNA_anim_types.h"
 #include "DNA_armature_types.h"
 #include "DNA_constraint_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_movieclip_types.h"
 #include "DNA_scene_types.h"		/* PET modes			*/
@@ -81,9 +82,10 @@
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
-#include "BLI_editVert.h"
 #include "BLI_ghash.h"
 #include "BLI_linklist.h"
+#include "BLI_smallhash.h"
+#include "BLI_array.h"
 
 #include "UI_resources.h"
 
@@ -93,6 +95,8 @@
 
 #include "transform.h"
 
+#include <stdio.h>
+
 static void drawTransformApply(const struct bContext *C, struct ARegion *ar, void *arg);
 static int doEdgeSlide(TransInfo *t, float perc);
 
@@ -100,7 +104,7 @@ static int doEdgeSlide(TransInfo *t, float perc);
 
 void setTransformViewMatrices(TransInfo *t)
 {
-	if(t->spacetype==SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) {
+	if (t->spacetype==SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) {
 		RegionView3D *rv3d = t->ar->regiondata;
 
 		copy_m4_m4(t->viewmat, rv3d->viewmat);
@@ -120,7 +124,7 @@ void setTransformViewMatrices(TransInfo *t)
 	calculateCenter2D(t);
 }
 
-static void convertViewVec2D(View2D *v2d, float *vec, int dx, int dy)
+static void convertViewVec2D(View2D *v2d, float vec[3], int dx, int dy)
 {
 	float divx, divy;
 	
@@ -132,51 +136,53 @@ static void convertViewVec2D(View2D *v2d, float *vec, int dx, int dy)
 	vec[2]= 0.0f;
 }
 
-void convertViewVec(TransInfo *t, float *vec, int dx, int dy)
+void convertViewVec(TransInfo *t, float r_vec[3], int dx, int dy)
 {
-	if(t->spacetype==SPACE_VIEW3D) {
-		if(t->ar->regiontype == RGN_TYPE_WINDOW) {
-			float mval_f[2];
-			mval_f[0]= dx;
-			mval_f[1]= dy;
-			ED_view3d_win_to_delta(t->ar, mval_f, vec);
-		}
+	if ((t->spacetype == SPACE_VIEW3D) && (t->ar->regiontype == RGN_TYPE_WINDOW)) {
+		float mval_f[2];
+		mval_f[0] = dx;
+		mval_f[1] = dy;
+		ED_view3d_win_to_delta(t->ar, mval_f, r_vec);
 	}
-	else if(t->spacetype==SPACE_IMAGE) {
+	else if (t->spacetype==SPACE_IMAGE) {
 		float aspx, aspy;
 
-		convertViewVec2D(t->view, vec, dx, dy);
+		convertViewVec2D(t->view, r_vec, dx, dy);
 
 		ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
-		vec[0]*= aspx;
-		vec[1]*= aspy;
+		r_vec[0] *= aspx;
+		r_vec[1] *= aspy;
 	}
-	else if(ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) {
-		convertViewVec2D(t->view, vec, dx, dy);
+	else if (ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) {
+		convertViewVec2D(t->view, r_vec, dx, dy);
 	}
-	else if(ELEM(t->spacetype, SPACE_NODE, SPACE_SEQ)) {
-		convertViewVec2D(&t->ar->v2d, vec, dx, dy);
+	else if (ELEM(t->spacetype, SPACE_NODE, SPACE_SEQ)) {
+		convertViewVec2D(&t->ar->v2d, r_vec, dx, dy);
 	}
-	else if(t->spacetype==SPACE_CLIP) {
+	else if (t->spacetype==SPACE_CLIP) {
 		View2D *v2d = t->view;
 		float divx, divy;
 
-		divx= v2d->mask.xmax-v2d->mask.xmin;
-		divy= v2d->mask.ymax-v2d->mask.ymin;
+		divx = v2d->mask.xmax-v2d->mask.xmin;
+		divy = v2d->mask.ymax-v2d->mask.ymin;
 
-		vec[0]= (v2d->cur.xmax-v2d->cur.xmin)*(dx)/divx;
-		vec[1]= (v2d->cur.ymax-v2d->cur.ymin)*(dy)/divy;
-		vec[2]= 0.0f;
+		r_vec[0] = (v2d->cur.xmax-v2d->cur.xmin)*(dx)/divx;
+		r_vec[1] = (v2d->cur.ymax-v2d->cur.ymin)*(dy)/divy;
+		r_vec[2] = 0.0f;
+	}
+	else {
+		printf("%s: called in an invalid context\n", __func__);
+		zero_v3(r_vec);
 	}
 }
 
-void projectIntView(TransInfo *t, float *vec, int *adr)
+void projectIntView(TransInfo *t, const float vec[3], int adr[2])
 {
 	if (t->spacetype==SPACE_VIEW3D) {
-		if(t->ar->regiontype == RGN_TYPE_WINDOW)
+		if (t->ar->regiontype == RGN_TYPE_WINDOW)
 			project_int_noclip(t->ar, vec, adr);
 	}
-	else if(t->spacetype==SPACE_IMAGE) {
+	else if (t->spacetype==SPACE_IMAGE) {
 		float aspx, aspy, v[2];
 
 		ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
@@ -185,7 +191,7 @@ void projectIntView(TransInfo *t, float *vec, int *adr)
 
 		UI_view2d_to_region_no_clip(t->view, v[0], v[1], adr, adr+1);
 	}
-	else if(t->spacetype == SPACE_ACTION) {
+	else if (t->spacetype == SPACE_ACTION) {
 		int out[2] = {0, 0};
 #if 0
 		SpaceAction *sact = t->sa->spacedata.first;
@@ -204,45 +210,50 @@ void projectIntView(TransInfo *t, float *vec, int *adr)
 		adr[0]= out[0];
 		adr[1]= out[1];
 	}
-	else if(ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) {
+	else if (ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) {
 		int out[2] = {0, 0};
 
 		UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], out, out+1);
 		adr[0]= out[0];
 		adr[1]= out[1];
 	}
-	else if(t->spacetype==SPACE_SEQ) { /* XXX not tested yet, but should work */
+	else if (t->spacetype==SPACE_SEQ) { /* XXX not tested yet, but should work */
 		int out[2] = {0, 0};
 
 		UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], out, out+1);
 		adr[0]= out[0];
 		adr[1]= out[1];
 	}
-	else if(t->spacetype==SPACE_CLIP) {
+	else if (t->spacetype==SPACE_CLIP) {
 		UI_view2d_to_region_no_clip(t->view, vec[0], vec[1], adr, adr+1);
 	}
 }
 
-void projectFloatView(TransInfo *t, float *vec, float *adr)
+void projectFloatView(TransInfo *t, const float vec[3], float adr[2])
 {
-	if (t->spacetype==SPACE_VIEW3D) {
-		if(t->ar->regiontype == RGN_TYPE_WINDOW)
-			project_float_noclip(t->ar, vec, adr);
-	}
-	else if(ELEM(t->spacetype, SPACE_IMAGE, SPACE_CLIP)) {
-		int a[2];
-
-		projectIntView(t, vec, a);
-		adr[0]= a[0];
-		adr[1]= a[1];
+	switch (t->spacetype) {
+		case SPACE_VIEW3D:
+		{
+			if (t->ar->regiontype == RGN_TYPE_WINDOW) {
+				project_float_noclip(t->ar, vec, adr);
+				return;
+			}
+			break;
+		}
+		case SPACE_IMAGE:
+		case SPACE_CLIP:
+		case SPACE_IPO:
+		case SPACE_NLA:
+		{
+			int a[2];
+			projectIntView(t, vec, a);
+			adr[0] = a[0];
+			adr[1] = a[1];
+			return;
+		}
 	}
-	else if(ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) {
-		int a[2];
 
-		projectIntView(t, vec, a);
-		adr[0]= a[0];
-		adr[1]= a[1];
-	}
+	zero_v2(adr);
 }
 
 void applyAspectRatio(TransInfo *t, float *vec)
@@ -251,7 +262,7 @@ void applyAspectRatio(TransInfo *t, float *vec)
 		SpaceImage *sima= t->sa->spacedata.first;
 		float aspx, aspy;
 
-		if((sima->flag & SI_COORDFLOATS)==0) {
+		if ((sima->flag & SI_COORDFLOATS)==0) {
 			int width, height;
 			ED_space_image_size(sima, &width, &height);
 
@@ -271,7 +282,7 @@ void removeAspectRatio(TransInfo *t, float *vec)
 		SpaceImage *sima= t->sa->spacedata.first;
 		float aspx, aspy;
 
-		if((sima->flag & SI_COORDFLOATS)==0) {
+		if ((sima->flag & SI_COORDFLOATS)==0) {
 			int width, height;
 			ED_space_image_size(sima, &width, &height);
 
@@ -290,7 +301,7 @@ static void viewRedrawForce(const bContext *C, TransInfo *t)
 	if (t->spacetype == SPACE_VIEW3D)
 	{
 		/* Do we need more refined tags? */
-		if(t->flag & T_POSE)
+		if (t->flag & T_POSE)
 			WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
 		else
 			WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
@@ -312,24 +323,22 @@ static void viewRedrawForce(const bContext *C, TransInfo *t)
 	else if (t->spacetype == SPACE_NLA) {
 		WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
 	}
-	else if(t->spacetype == SPACE_NODE)
-	{
+	else if (t->spacetype == SPACE_NODE) {
 		//ED_area_tag_redraw(t->sa);
 		WM_event_add_notifier(C, NC_SPACE|ND_SPACE_NODE_VIEW, NULL);
 	}
-	else if(t->spacetype == SPACE_SEQ)
-	{
+	else if (t->spacetype == SPACE_SEQ) {
 		WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, NULL);
 	}
 	else if (t->spacetype==SPACE_IMAGE) {
 		// XXX how to deal with lock?
 		SpaceImage *sima= (SpaceImage*)t->sa->spacedata.first;
-		if(sima->lock) WM_event_add_notifier(C, NC_GEOM|ND_DATA, t->obedit->data);
+		if (sima->lock) WM_event_add_notifier(C, NC_GEOM|ND_DATA, t->obedit->data);
 		else ED_area_tag_redraw(t->sa);
 	}
 	else if (t->spacetype==SPACE_CLIP) {
-		SpaceClip *sc= (SpaceClip*)t->sa->spacedata.first;
-		MovieClip *clip= ED_space_clip(sc);
+		SpaceClip *sc = (SpaceClip*)t->sa->spacedata.first;
+		MovieClip *clip = ED_space_clip(sc);
 
 		/* objects could be parented to tracking data, so send this for viewport refresh */
 		WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
@@ -342,7 +351,7 @@ static void viewRedrawPost(bContext *C, TransInfo *t)
 {
 	ED_area_headerprint(t->sa, NULL);
 	
-	if(t->spacetype == SPACE_VIEW3D) {
+	if (t->spacetype == SPACE_VIEW3D) {
 		/* 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);
@@ -353,15 +362,15 @@ static void viewRedrawPost(bContext *C, TransInfo *t)
 	}
 	
 #if 0 // TRANSFORM_FIX_ME
-	if(t->spacetype==SPACE_VIEW3D) {
+	if (t->spacetype==SPACE_VIEW3D) {
 		allqueue(REDRAWBUTSOBJECT, 0);
 		allqueue(REDRAWVIEW3D, 0);
 	}
-	else if(t->spacetype==SPACE_IMAGE) {
+	else if (t->spacetype==SPACE_IMAGE) {
 		allqueue(REDRAWIMAGE, 0);
 		allqueue(REDRAWVIEW3D, 0);
 	}
-	else if(ELEM3(t->spacetype, SPACE_ACTION, SPACE_NLA, SPACE_IPO)) {
+	else if (ELEM3(t->spacetype, SPACE_ACTION, SPACE_NLA, SPACE_IPO)) {
 		allqueue(REDRAWVIEW3D, 0);
 		allqueue(REDRAWACTION, 0);
 		allqueue(REDRAWNLA, 0);
@@ -384,7 +393,7 @@ void BIF_selectOrientation(void)
 	val= pupmenu(str_menu);
 	MEM_freeN(str_menu);
 
-	if(val >= 0) {
+	if (val >= 0) {
 		G.vd->twmode = val;
 	}
 #endif
@@ -409,23 +418,27 @@ static void view_editmove(unsigned short UNUSED(event))
 	switch(event) {
 		case WHEELUPMOUSE:
 
-			if( G.qual & LR_SHIFTKEY ) {
-				if( G.qual & LR_ALTKEY ) {
+			if ( G.qual & LR_SHIFTKEY ) {
+				if ( G.qual & LR_ALTKEY ) {
 					G.qual &= ~LR_SHIFTKEY;
 					persptoetsen(PAD2);
 					G.qual |= LR_SHIFTKEY;
-				} else {
+				}
+				else {
 					persptoetsen(PAD2);
 				}
-			} else if( G.qual & LR_CTRLKEY ) {
-				if( G.qual & LR_ALTKEY ) {
+			}
+			else if ( G.qual & LR_CTRLKEY ) {
+				if ( G.qual & LR_ALTKEY ) {
 					G.qual &= ~LR_CTRLKEY;
 					persptoetsen(PAD4);
 					G.qual |= LR_CTRLKEY;
-				} else {
+				}
+				else {
 					persptoetsen(PAD4);
 				}
-			} else if(U.uiflag & USER_WHEELZOOMDIR)
+			}
+			else if (U.uiflag & USER_WHEELZOOMDIR)
 				persptoetsen(PADMINUS);
 			else
 				persptoetsen(PADPLUSKEY);
@@ -433,23 +446,27 @@ static void view_editmove(unsigned short UNUSED(event))
 			refresh = 1;
 			break;
 		case WHEELDOWNMOUSE:
-			if( G.qual & LR_SHIFTKEY ) {
-				if( G.qual & LR_ALTKEY ) {
+			if ( G.qual & LR_SHIFTKEY ) {
+				if ( G.qual & LR_ALTKEY ) {
 					G.qual &= ~LR_SHIFTKEY;
 					persptoetsen(PAD8);
 					G.qual |= LR_SHIFTKEY;
-				} else {
+				}
+				else {
 					persptoetsen(PAD8);
 				}
-			} else if( G.qual & LR_CTRLKEY ) {
-				if( G.qual & LR_ALTKEY ) {
+			}
+			else if ( G.qual & LR_CTRLKEY ) {
+				if ( G.qual & LR_ALTKEY ) {
 					G.qual &= ~LR_CTRLKEY;
 					persptoetsen(PAD6);
 					G.qual |= LR_CTRLKEY;
-				} else {
+				}
+				else {
 					persptoetsen(PAD6);
 				}
-			} else if(U.uiflag & USER_WHEELZOOMDIR)
+			}
+			else if (U.uiflag & USER_WHEELZOOMDIR)
 				persptoetsen(PADPLUSKEY);
 			else
 				persptoetsen(PADMINUS);
@@ -522,7 +539,7 @@ wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf)
 	wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Transform Modal Map");
 	
 	/* this function is called for each spacetype, only needs to add map once */
-	if(keymap) return NULL;
+	if (keymap && keymap->modal_items) return NULL;
 	
 	keymap= WM_modalkeymap_add(keyconf, "Transform Modal Map", modal_items);
 	
@@ -601,15 +618,15 @@ int transformEvent(TransInfo *t, wmEvent *event)
 				break;
 			case TFM_MODAL_TRANSLATE:
 				/* only switch when... */
-				if( ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL) ) {
+				if ( ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL) ) {
 					resetTransRestrictions(t);
 					restoreTransObjects(t);
 					initTranslation(t);
 					initSnapping(t, NULL); // need to reinit after mode change
 					t->redraw |= TREDRAW_HARD;
 				}
-				else if(t->mode == TFM_TRANSLATION) {
-					if(t->options&CTX_MOVIECLIP) {
+				else if (t->mode == TFM_TRANSLATION) {
+					if (t->options&CTX_MOVIECLIP) {
 						restoreTransObjects(t);
 
 						t->flag^= T_ALT_TRANSFORM;
@@ -619,8 +636,8 @@ int transformEvent(TransInfo *t, wmEvent *event)
 				break;
 			case TFM_MODAL_ROTATE:
 				/* only switch when... */
-				if(!(t->options & CTX_TEXTURE) && !(t->options & CTX_MOVIECLIP)) {
-					if( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) {
+				if (!(t->options & CTX_TEXTURE) && !(t->options & CTX_MOVIECLIP)) {
+					if ( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) {
 						
 						resetTransRestrictions(t);
 						
@@ -639,7 +656,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
 				break;
 			case TFM_MODAL_RESIZE:
 				/* only switch when... */
-				if( ELEM3(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL) ) {
+				if ( ELEM3(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL) ) {
 					resetTransRestrictions(t);
 					restoreTransObjects(t);
 					initResize(t);
@@ -751,9 +768,9 @@ int transformEvent(TransInfo *t, wmEvent *event)
 				t->redraw |= TREDRAW_HARD;
 				break;
 			case TFM_MODAL_PROPSIZE_UP:
-				if(t->flag & T_PROP_EDIT) {
+				if (t->flag & T_PROP_EDIT) {
 					t->prop_size*= 1.1f;
-					if(t->spacetype==SPACE_VIEW3D && t->persp != RV3D_ORTHO)
+					if (t->spacetype==SPACE_VIEW3D && t->persp != RV3D_ORTHO)
 						t->prop_size= MIN2(t->prop_size, ((View3D *)t->view)->far);
 					calculatePropRatio(t);
 				}
@@ -786,7 +803,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
 	}
 	/* else do non-mapped events */
 	else if (event->val==KM_PRESS) {
-		switch (event->type){
+		switch (event->type) {
 		case RIGHTMOUSE:
 			t->state = TRANS_CANCEL;
 			break;
@@ -854,7 +871,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
 			break;
 		case GKEY:
 			/* only switch when... */
-			if( ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL) ) {
+			if ( ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL) ) {
 				resetTransRestrictions(t);
 				restoreTransObjects(t);
 				initTranslation(t);
@@ -864,7 +881,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
 			break;
 		case SKEY:
 			/* only switch when... */
-			if( ELEM3(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL) ) {
+			if ( ELEM3(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL) ) {
 				resetTransRestrictions(t);
 				restoreTransObjects(t);
 				initResize(t);
@@ -874,8 +891,8 @@ int transformEvent(TransInfo *t, wmEvent *event)
 			break;
 		case RKEY:
 			/* only switch when... */
-			if(!(t->options & CTX_TEXTURE) && !(t->options & CTX_MOVIECLIP)) {
-				if( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) {
+			if (!(t->options & CTX_TEXTURE) && !(t->options & CTX_MOVIECLIP)) {
+				if ( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) {
 
 					resetTransRestrictions(t);
 
@@ -909,21 +926,25 @@ int transformEvent(TransInfo *t, wmEvent *event)
 				if (t->flag & T_2D_EDIT) {
 					if (cmode == 'X') {
 						stopConstraint(t);
-					} else {
+					}
+					else {
 						setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS0), "along X");
 					}
-				} else {
+				}
+				else {
 					if (cmode == 'X') {
 						if (t->con.orientation != V3D_MANIP_GLOBAL) {
 							stopConstraint(t);
-						} else {
+						}
+						else {
 							short orientation = t->current_orientation != V3D_MANIP_GLOBAL ? t->current_orientation : V3D_MANIP_LOCAL;
 							if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0)
 								setUserConstraint(t, orientation, (CON_AXIS0), "along %s X");
 							else if (t->modifiers & MOD_CONSTRAINT_PLANE)
 								setUserConstraint(t, orientation, (CON_AXIS1|CON_AXIS2), "locking %s X");
 						}
-					} else {
+					}
+					else {
 						if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0)
 							setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS0), "along %s X");
 						else if (t->modifiers & MOD_CONSTRAINT_PLANE)
@@ -938,21 +959,25 @@ int transformEvent(TransInfo *t, wmEvent *event)
 				if (t->flag & T_2D_EDIT) {
 					if (cmode == 'Y') {
 						stopConstraint(t);
-					} else {
+					}
+					else {
 						setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS1), "along Y");
 					}
-				} else {
+				}
+				else {
 					if (cmode == 'Y') {
 						if (t->con.orientation != V3D_MANIP_GLOBAL) {
 							stopConstraint(t);
-						} else {
+						}
+						else {
 							short orientation = t->current_orientation != V3D_MANIP_GLOBAL ? t->current_orientation : V3D_MANIP_LOCAL;
 							if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0)
 								setUserConstraint(t, orientation, (CON_AXIS1), "along %s Y");
 							else if (t->modifiers & MOD_CONSTRAINT_PLANE)
 								setUserConstraint(t, orientation, (CON_AXIS0|CON_AXIS2), "locking %s Y");
 						}
-					} else {
+					}
+					else {
 						if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0)
 							setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS1), "along %s Y");
 						else if (t->modifiers & MOD_CONSTRAINT_PLANE)
@@ -967,14 +992,16 @@ int transformEvent(TransInfo *t, wmEvent *event)
 				if (cmode == 'Z') {
 					if (t->con.orientation != V3D_MANIP_GLOBAL) {
 						stopConstraint(t);
-					} else {
+					}
+					else {
 						short orientation = t->current_orientation != V3D_MANIP_GLOBAL ? t->current_orientation : V3D_MANIP_LOCAL;
 						if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0)
 							setUserConstraint(t, orientation, (CON_AXIS2), "along %s Z");
 						else if (t->modifiers & MOD_CONSTRAINT_PLANE)
 							setUserConstraint(t, orientation, (CON_AXIS0|CON_AXIS1), "locking %s Z");
 					}
-				} else {
+				}
+				else {
 					if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0)
 						setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS2), "along %s Z");
 					else if (t->modifiers & MOD_CONSTRAINT_PLANE)
@@ -991,9 +1018,9 @@ int transformEvent(TransInfo *t, wmEvent *event)
 			}
 			break;
 		case PADPLUSKEY:
-			if(event->alt && t->flag & T_PROP_EDIT) {
+			if (event->alt && t->flag & T_PROP_EDIT) {
 				t->prop_size *= 1.1f;
-				if(t->spacetype==SPACE_VIEW3D && t->persp != RV3D_ORTHO)
+				if (t->spacetype==SPACE_VIEW3D && t->persp != RV3D_ORTHO)
 					t->prop_size= MIN2(t->prop_size, ((View3D *)t->view)->far);
 				calculatePropRatio(t);
 			}
@@ -1008,7 +1035,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
 			t->redraw= 1;
 			break;
 		case PADMINUS:
-			if(event->alt && t->flag & T_PROP_EDIT) {
+			if (event->alt && t->flag & T_PROP_EDIT) {
 				t->prop_size*= 0.90909090f;
 				calculatePropRatio(t);
 			}
@@ -1035,7 +1062,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
 
 	}
 	else if (event->val==KM_RELEASE) {
-		switch (event->type){
+		switch (event->type) {
 		case LEFTSHIFTKEY:
 		case RIGHTSHIFTKEY:
 			t->modifiers &= ~MOD_CONSTRAINT_PLANE;
@@ -1051,7 +1078,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
 			break;
 //		case LEFTMOUSE:
 //		case RIGHTMOUSE:
-//			if(WM_modal_tweak_exit(event, t->event_type))
+//			if (WM_modal_tweak_exit(event, t->event_type))
 ////			if (t->options & CTX_TWEAK)
 //				t->state = TRANS_CONFIRM;
 //			break;
@@ -1196,7 +1223,7 @@ static void drawArc(float size, float angle_start, float angle_end, int segments
 
 	glBegin(GL_LINE_STRIP);
 
-	for( angle = angle_start; angle < angle_end; angle += delta)
+	for ( angle = angle_start; angle < angle_end; angle += delta)
 	{
 		glVertex2f( cosf(angle) * size, sinf(angle) * size);
 	}
@@ -1209,7 +1236,7 @@ static int helpline_poll(bContext *C)
 {
 	ARegion *ar= CTX_wm_region(C);
 	
-	if(ar && ar->regiontype==RGN_TYPE_WINDOW)
+	if (ar && ar->regiontype==RGN_TYPE_WINDOW)
 		return 1;
 	return 0;
 }
@@ -1227,13 +1254,13 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
 		mval[1]= y;
 
 		copy_v3_v3(vecrot, t->center);
-		if(t->flag & T_EDIT) {
+		if (t->flag & T_EDIT) {
 			Object *ob= t->obedit;
-			if(ob) mul_m4_v3(ob->obmat, vecrot);
+			if (ob) mul_m4_v3(ob->obmat, vecrot);
 		}
-		else if(t->flag & T_POSE) {
+		else if (t->flag & T_POSE) {
 			Object *ob=t->poseobj;
-			if(ob) mul_m4_v3(ob->obmat, vecrot);
+			if (ob) mul_m4_v3(ob->obmat, vecrot);
 		}
 
 		projectFloatView(t, vecrot, cent);	// no overflow in extreme cases
@@ -1427,7 +1454,8 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
 		/* do we check for parameter? */
 		if (t->modifiers & MOD_SNAP) {
 			ts->snap_flag |= SCE_SNAP;
-		} else {
+		}
+		else {
 			ts->snap_flag &= ~SCE_SNAP;
 		}
 
@@ -1465,7 +1493,8 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
 		 * */
 		if (t->con.mode & CON_APPLY) {
 			RNA_enum_set(op->ptr, "constraint_orientation", t->con.orientation);
-		} else {
+		}
+		else {
 			RNA_enum_set(op->ptr, "constraint_orientation", t->current_orientation);
 		}
 
@@ -1500,7 +1529,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
 
 	if ( (prop = RNA_struct_find_property(op->ptr, "texture_space")) && RNA_property_is_set(op->ptr, prop))
 	{
-		if(RNA_property_boolean_get(op->ptr, prop)) {
+		if (RNA_property_boolean_get(op->ptr, prop)) {
 			options |= CTX_TEXTURE;
 		}
 	}
@@ -1515,8 +1544,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
 	{
 		t->launch_event = RIGHTMOUSE;
 	}
-	else if (t->launch_event == EVT_TWEAK_L)
-	{
+	else if (t->launch_event == EVT_TWEAK_L) {
 		t->launch_event = LEFTMOUSE;
 	}
 
@@ -1532,7 +1560,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
 		return 0;
 	}
 
-	if(t->spacetype == SPACE_VIEW3D)
+	if (t->spacetype == SPACE_VIEW3D)
 	{
 		//calc_manipulator_stats(curarea);
 		initTransformOrientation(C, t);
@@ -1542,12 +1570,13 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
 		//t->draw_handle_pixel = ED_region_draw_cb_activate(t->ar->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL);
 		t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), helpline_poll, drawHelpline, t);
 	}
-	else if(t->spacetype == SPACE_IMAGE) {
+	else if (t->spacetype == SPACE_IMAGE) {
 		unit_m3(t->spacemtx);
 		t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
 		//t->draw_handle_pixel = ED_region_draw_cb_activate(t->ar->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL);
+		t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), helpline_poll, drawHelpline, t);
 	}
-	else if(t->spacetype == SPACE_CLIP) {
+	else if (t->spacetype == SPACE_CLIP) {
 		unit_m3(t->spacemtx);
 		t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
 		t->options |= CTX_MOVIECLIP;
@@ -1563,7 +1592,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
 	}
 
 	/* Stupid code to have Ctrl-Click on manipulator work ok */
-	if(event)
+	if (event)
 	{
 		wmKeyMap *keymap = WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap);
 		wmKeyMapItem *kmi;
@@ -1637,7 +1666,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
 	case TFM_BONESIZE:
 		{	/* used for both B-Bone width (bonesize) as for deform-dist (envelope) */
 			bArmature *arm= t->poseobj->data;
-			if(arm->drawtype==ARM_ENVELOPE)
+			if (arm->drawtype==ARM_ENVELOPE)
 				initBoneEnvelope(t);
 			else
 				initBoneSize(t);
@@ -1665,7 +1694,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
 		/* same as TFM_TIME_EXTEND, but we need the mode info for later 
 		 * so that duplicate-culling will work properly
 		 */
-		if ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)
+		if (ELEM(t->spacetype, SPACE_IPO, SPACE_NLA))
 			initTranslation(t);
 		else
 			initTimeTranslate(t);
@@ -1677,7 +1706,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
 		 * (for Graph/NLA Editors only since they uses 'standard' transforms to get 2D movement)
 		 * depending on which editor this was called from
 		 */
-		if ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)
+		if (ELEM(t->spacetype, SPACE_IPO, SPACE_NLA))
 			initTranslation(t);
 		else
 			initTimeTranslate(t);
@@ -1702,7 +1731,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
 		break;
 	}
 
-	if(t->state == TRANS_CANCEL)
+	if (t->state == TRANS_CANCEL)
 	{
 		postTrans(C, t);
 		return 0;
@@ -1712,11 +1741,12 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
 	/* overwrite initial values if operator supplied a non-null vector */
 	if ( (prop = RNA_struct_find_property(op->ptr, "value")) && RNA_property_is_set(op->ptr, prop))
 	{
-		float values[4]= {0}; /* incase value isn't length 4, avoid uninitialized memory  */
+		float values[4]= {0}; /* in case value isn't length 4, avoid uninitialized memory  */
 
-		if(RNA_property_array_check(prop)) {
+		if (RNA_property_array_check(prop)) {
 			RNA_float_get_array(op->ptr, "value", values);
-		} else {
+		}
+		else {
 			values[0]= RNA_float_get(op->ptr, "value");
 		}
 
@@ -1775,7 +1805,8 @@ void transformApply(bContext *C, TransInfo *t)
 			viewRedrawForce(C, t);
 		}
 		t->redraw = TREDRAW_NOTHING;
-	} else if (t->redraw & TREDRAW_SOFT) {
+	}
+	else if (t->redraw & TREDRAW_SOFT) {
 		viewRedrawForce(C, t);
 	}
 
@@ -1814,17 +1845,16 @@ int transformEnd(bContext *C, TransInfo *t)
 	if (t->state != TRANS_STARTING && t->state != TRANS_RUNNING)
 	{
 		/* handle restoring objects */
-		if(t->state == TRANS_CANCEL)
+		if (t->state == TRANS_CANCEL)
 		{
 			/* exception, edge slide transformed UVs too */
-			if(t->mode==TFM_EDGE_SLIDE)
+			if (t->mode==TFM_EDGE_SLIDE)
 				doEdgeSlide(t, 0.0f);
 			
 			exit_code = OPERATOR_CANCELLED;
 			restoreTransObjects(t);	// calls recalcData()
 		}
-		else
-		{
+		else {
 			exit_code = OPERATOR_FINISHED;
 		}
 
@@ -1839,11 +1869,11 @@ int transformEnd(bContext *C, TransInfo *t)
 
 		/*  Undo as last, certainly after special_trans_update! */
 
-		if(t->state == TRANS_CANCEL) {
-//			if(t->undostr) ED_undo_push(C, t->undostr);
+		if (t->state == TRANS_CANCEL) {
+//			if (t->undostr) ED_undo_push(C, t->undostr);
 		}
 		else {
-//			if(t->undostr) ED_undo_push(C, t->undostr);
+//			if (t->undostr) ED_undo_push(C, t->undostr);
 //			else ED_undo_push(C, transform_to_undostr(t));
 		}
 		t->undostr= NULL;
@@ -1860,31 +1890,31 @@ int transformEnd(bContext *C, TransInfo *t)
 
 static void protectedTransBits(short protectflag, float *vec)
 {
-	if(protectflag & OB_LOCK_LOCX)
+	if (protectflag & OB_LOCK_LOCX)
 		vec[0]= 0.0f;
-	if(protectflag & OB_LOCK_LOCY)
+	if (protectflag & OB_LOCK_LOCY)
 		vec[1]= 0.0f;
-	if(protectflag & OB_LOCK_LOCZ)
+	if (protectflag & OB_LOCK_LOCZ)
 		vec[2]= 0.0f;
 }
 
 static void protectedSizeBits(short protectflag, float *size)
 {
-	if(protectflag & OB_LOCK_SCALEX)
+	if (protectflag & OB_LOCK_SCALEX)
 		size[0]= 1.0f;
-	if(protectflag & OB_LOCK_SCALEY)
+	if (protectflag & OB_LOCK_SCALEY)
 		size[1]= 1.0f;
-	if(protectflag & OB_LOCK_SCALEZ)
+	if (protectflag & OB_LOCK_SCALEZ)
 		size[2]= 1.0f;
 }
 
 static void protectedRotateBits(short protectflag, float *eul, float *oldeul)
 {
-	if(protectflag & OB_LOCK_ROTX)
+	if (protectflag & OB_LOCK_ROTX)
 		eul[0]= oldeul[0];
-	if(protectflag & OB_LOCK_ROTY)
+	if (protectflag & OB_LOCK_ROTY)
 		eul[1]= oldeul[1];
-	if(protectflag & OB_LOCK_ROTZ)
+	if (protectflag & OB_LOCK_ROTZ)
 		eul[2]= oldeul[2];
 }
 
@@ -2072,8 +2102,8 @@ static void constraintob_from_transdata(bConstraintOb *cob, TransData *td)
 		if (td->ext->rotOrder == ROT_MODE_QUAT) {
 			/* quats */
 			/* objects and bones do normalization first too, otherwise
-			   we don't necessarily end up with a rotation matrix, and
-			   then conversion back to quat gives a different result */
+			 * we don't necessarily end up with a rotation matrix, and
+			 * then conversion back to quat gives a different result */
 			float quat[4];
 			normalize_qt_qt(quat, td->ext->quat);
 			quat_to_mat4(cob->matrix, quat);
@@ -2117,7 +2147,7 @@ static void constraintRotLim(TransInfo *UNUSED(t), TransData *td)
 					continue;
 
 				/* only do conversion if necessary, to preserve quats and eulers */
-				if(!dolimit) {
+				if (!dolimit) {
 					constraintob_from_transdata(&cob, td);
 					dolimit= 1;
 				}
@@ -2141,7 +2171,7 @@ static void constraintRotLim(TransInfo *UNUSED(t), TransData *td)
 			}
 		}
 		
-		if(dolimit) {
+		if (dolimit) {
 			/* copy results from cob->matrix */
 			if (td->ext->rotOrder == ROT_MODE_QUAT) {
 				/* quats */
@@ -2270,7 +2300,7 @@ void initWarp(TransInfo *t)
 	t->flag |= T_NO_CONSTRAINT;
 	
 	/* we need min/max in view space */
-	for(i = 0; i < t->total; i++) {
+	for (i = 0; i < t->total; i++) {
 		float center[3];
 		copy_v3_v3(center, t->data[i].center);
 		mul_m3_v3(t->data[i].mtx, center);
@@ -2361,7 +2391,7 @@ int Warp(TransInfo *t, const int UNUSED(mval[2]))
 
 	circumfac /= 2; /* only need 180 on each side to make 360 */
 	
-	for(i = 0; i < t->total; i++, td++) {
+	for (i = 0; i < t->total; i++, td++) {
 		float loc[3];
 		if (td->flag & TD_NOACTION)
 			break;
@@ -2443,12 +2473,11 @@ int handleEventShear(TransInfo *t, wmEvent *event)
 			initMouseInputMode(t, &t->mouse, INPUT_VERTICAL_ABSOLUTE);
 			t->customData = (void*)1;
 		}
-		else
-		{
+		else {
 			initMouseInputMode(t, &t->mouse, INPUT_HORIZONTAL_ABSOLUTE);
 			t->customData = NULL;
 		}
-		
+
 		status = 1;
 	}
 	
@@ -2487,6 +2516,8 @@ int Shear(TransInfo *t, const int UNUSED(mval[2]))
 		sprintf(str, "Shear: %.3f %s", value, t->proptext);
 	}
 	
+	t->values[0] = value;
+
 	unit_m3(smat);
 	
 	// Custom data signals shear direction
@@ -2498,7 +2529,7 @@ int Shear(TransInfo *t, const int UNUSED(mval[2]))
 	mul_m3_m3m3(tmat, smat, persmat);
 	mul_m3_m3m3(totmat, persinv, tmat);
 	
-	for(i = 0 ; i < t->total; i++, td++) {
+	for (i = 0 ; i < t->total; i++, td++) {
 		if (td->flag & TD_NOACTION)
 			break;
 		
@@ -2613,9 +2644,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 ( 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];
 }
 
 
@@ -2667,7 +2698,7 @@ static void ElementResize(TransInfo *t, TransData *td, float mat[3][3])
 		protectedSizeBits(td->protectflag, fsize);
 		
 		if ((t->flag & T_V3D_ALIGN)==0) {	// align mode doesn't resize objects itself
-			if((td->flag & TD_SINGLESIZE) && !(t->con.mode & CON_APPLY)){
+			if ((td->flag & TD_SINGLESIZE) && !(t->con.mode & CON_APPLY)) {
 				/* scale val and reset size */
 				 *td->val = td->ival * (1 + (fsize[0] - 1) * td->factor);
 				
@@ -2724,12 +2755,11 @@ int Resize(TransInfo *t, const int mval[2])
 	char str[200];
 	
 	/* for manipulator, center handle, the scaling can't be done relative to center */
-	if( (t->flag & T_USES_MANIPULATOR) && t->con.mode==0)
+	if ( (t->flag & T_USES_MANIPULATOR) && t->con.mode==0)
 	{
 		ratio = 1.0f - ((t->imval[0] - mval[0]) + (t->imval[1] - mval[1]))/100.0f;
 	}
-	else
-	{
+	else {
 		ratio = t->values[0];
 	}
 	
@@ -2761,7 +2791,7 @@ int Resize(TransInfo *t, const int mval[2])
 	
 	headerResize(t, size, str);
 	
-	for(i = 0, td=t->data; i < t->total; i++, td++) {
+	for (i = 0, td=t->data; i < t->total; i++, td++) {
 		if (td->flag & TD_NOACTION)
 			break;
 		
@@ -2778,7 +2808,7 @@ int Resize(TransInfo *t, const int mval[2])
 		if (t->con.applySize)
 			t->con.applySize(t, NULL, mat);
 		
-		for(i = 0, td=t->data; i < t->total; i++, td++)
+		for (i = 0, td=t->data; i < t->total; i++, td++)
 			ElementResize(t, td, mat);
 	}
 	
@@ -2813,7 +2843,7 @@ void initToSphere(TransInfo *t)
 	t->flag |= T_NO_CONSTRAINT;
 	
 	// Calculate average radius
-	for(i = 0 ; i < t->total; i++, td++) {
+	for (i = 0 ; i < t->total; i++, td++) {
 		t->val += len_v3v3(t->center, td->iloc);
 	}
 	
@@ -2855,7 +2885,7 @@ int ToSphere(TransInfo *t, const int UNUSED(mval[2]))
 	}
 	
 	
-	for(i = 0 ; i < t->total; i++, td++) {
+	for (i = 0 ; i < t->total; i++, td++) {
 		float tratio;
 		if (td->flag & TD_NOACTION)
 			break;
@@ -2947,11 +2977,11 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
 		add_v3_v3v3(td->loc, td->iloc, vec);
 		
 		
-		if(td->flag & TD_USEQUAT) {
+		if (td->flag & TD_USEQUAT) {
 			mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL);
 			mat3_to_quat( quat,fmat);	// Actual transform
 			
-			if(td->ext->quat){
+			if (td->ext->quat) {
 				mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat);
 				
 				/* is there a reason not to have this here? -jahka */
@@ -2992,7 +3022,7 @@ static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short
 			sub_v3_v3v3(vec, vec, td->center); // Translation needed from the initial location
 			
 			/* special exception, see TD_PBONE_LOCAL_MTX definition comments */
-			if(td->flag & TD_PBONE_LOCAL_MTX_P) {
+			if (td->flag & TD_PBONE_LOCAL_MTX_P) {
 				/* do nothing */
 			}
 			else if (td->flag & TD_PBONE_LOCAL_MTX_C) {
@@ -3142,7 +3172,7 @@ static void applyRotation(TransInfo *t, float angle, float axis[3])
 	
 	vec_rot_to_mat3( mat,axis, angle);
 	
-	for(i = 0 ; i < t->total; i++, td++) {
+	for (i = 0 ; i < t->total; i++, td++) {
 		
 		if (td->flag & TD_NOACTION)
 			break;
@@ -3174,7 +3204,8 @@ int Rotation(TransInfo *t, const int UNUSED(mval[2]))
 	
 	if ((t->con.mode & CON_APPLY) && t->con.applyRot) {
 		t->con.applyRot(t, NULL, t->axis, NULL);
-	} else {
+	}
+	else {
 		/* reset axis if constraint is not set */
 		copy_v3_v3(t->axis, t->axis_orig);
 	}
@@ -3245,7 +3276,7 @@ static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float a
 
 	mul_m3_m3m3(mat, smat, totmat);
 
-	for(i = 0 ; i < t->total; i++, td++) {
+	for (i = 0 ; i < t->total; i++, td++) {
 		if (td->flag & TD_NOACTION)
 			break;
 
@@ -3336,7 +3367,7 @@ void initTranslation(TransInfo *t)
 	t->num.flag = 0;
 	t->num.idx_max = t->idx_max;
 
-	if(t->spacetype == SPACE_VIEW3D) {
+	if (t->spacetype == SPACE_VIEW3D) {
 		RegionView3D *rv3d = t->ar->regiondata;
 
 		if (rv3d) {
@@ -3345,7 +3376,7 @@ void initTranslation(TransInfo *t)
 			t->snap[2] = t->snap[1] * 0.1f;
 		}
 	}
-	else if(ELEM(t->spacetype, SPACE_IMAGE, SPACE_CLIP)) {
+	else if (ELEM(t->spacetype, SPACE_IMAGE, SPACE_CLIP)) {
 		t->snap[0] = 0.0f;
 		t->snap[1] = 0.125f;
 		t->snap[2] = 0.0625f;
@@ -3377,10 +3408,10 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str)
 		applyAspectRatio(t, dvec);
 
 		dist = len_v3(vec);
-		if(!(t->flag & T_2D_EDIT) && t->scene->unit.system) {
+		if (!(t->flag & T_2D_EDIT) && t->scene->unit.system) {
 			int i, do_split= t->scene->unit.flag & USER_UNIT_OPT_SPLIT ? 1:0;
 
-			for(i=0; i<3; i++)
+			for (i=0; i<3; i++)
 				bUnit_AsString(&tvec[i*20], 20, dvec[i]*t->scene->unit.scale_length, 4, t->scene->unit.system, B_UNIT_LENGTH, do_split, 1);
 		}
 		else {
@@ -3390,17 +3421,17 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str)
 		}
 	}
 
-	if(!(t->flag & T_2D_EDIT) && t->scene->unit.system)
+	if (!(t->flag & T_2D_EDIT) && t->scene->unit.system)
 		bUnit_AsString(distvec, sizeof(distvec), dist*t->scene->unit.scale_length, 4, t->scene->unit.system, B_UNIT_LENGTH, t->scene->unit.flag & USER_UNIT_OPT_SPLIT, 0);
-	else if( dist > 1e10f || dist < -1e10f )	/* prevent string buffer overflow */
+	else if ( dist > 1e10f || dist < -1e10f )	/* prevent string buffer overflow */
 		sprintf(distvec, "%.4e", dist);
 	else
 		sprintf(distvec, "%.4f", dist);
 
-	if(t->flag & T_AUTOIK) {
+	if (t->flag & T_AUTOIK) {
 		short chainlen= t->settings->autoik_chainlen;
 
-		if(chainlen)
+		if (chainlen)
 			sprintf(autoik, "AutoIK-Len: %d", chainlen);
 		else
 			autoik[0]= '\0';
@@ -3421,7 +3452,7 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str)
 		}
 	}
 	else {
-		if(t->flag & T_2D_EDIT)
+		if (t->flag & T_2D_EDIT)
 			spos += sprintf(spos, "Dx: %s   Dy: %s (%s)%s %s", &tvec[0], &tvec[20], distvec, t->con.text, t->proptext);
 		else
 			spos += sprintf(spos, "Dx: %s   Dy: %s  Dz: %s (%s)%s %s  %s", &tvec[0], &tvec[20], &tvec[40], distvec, t->con.text, t->proptext, &autoik[0]);
@@ -3439,7 +3470,7 @@ static void applyTranslation(TransInfo *t, float vec[3])
 	float tvec[3];
 	int i;
 
-	for(i = 0 ; i < t->total; i++, td++) {
+	for (i = 0 ; i < t->total; i++, td++) {
 		if (td->flag & TD_NOACTION)
 			break;
 		
@@ -3447,10 +3478,8 @@ static void applyTranslation(TransInfo *t, float vec[3])
 			continue;
 		
 		/* handle snapping rotation before doing the translation */
-		if (usingSnappingNormal(t))
-		{
-			if (validSnappingNormal(t))
-			{
+		if (usingSnappingNormal(t)) {
+			if (validSnappingNormal(t)) {
 				float *original_normal = td->axismtx[2];
 				float axis[3];
 				float quat[4];
@@ -3466,8 +3495,7 @@ static void applyTranslation(TransInfo *t, float vec[3])
 				
 				ElementRotation(t, td, mat, V3D_LOCAL);
 			}
-			else
-			{
+			else {
 				float mat[3][3];
 				
 				unit_m3(mat);
@@ -3489,7 +3517,8 @@ static void applyTranslation(TransInfo *t, float vec[3])
 		
 		protectedTransBits(td->protectflag, tvec);
 		
-		add_v3_v3v3(td->loc, td->iloc, tvec);
+		if (td->loc)
+			add_v3_v3v3(td->loc, td->iloc, tvec);
 		
 		constraintTransLim(t, td);
 	}
@@ -3589,8 +3618,9 @@ int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
 		sprintf(str, "Shrink/Fatten: %.4f %s", distance, t->proptext);
 	}
 
+	t->values[0] = distance;
 
-	for(i = 0 ; i < t->total; i++, td++) {
+	for (i = 0 ; i < t->total; i++, td++) {
 		if (td->flag & TD_NOACTION)
 			break;
 
@@ -3660,7 +3690,7 @@ int Tilt(TransInfo *t, const int UNUSED(mval[2]))
 		sprintf(str, "Tilt: %.2f %s", RAD2DEGF(final), t->proptext);
 	}
 
-	for(i = 0 ; i < t->total; i++, td++) {
+	for (i = 0 ; i < t->total; i++, td++) {
 		if (td->flag & TD_NOACTION)
 			break;
 
@@ -3727,15 +3757,15 @@ int CurveShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
 		sprintf(str, "Shrink/Fatten: %3f", ratio);
 	}
 
-	for(i = 0 ; i < t->total; i++, td++) {
+	for (i = 0 ; i < t->total; i++, td++) {
 		if (td->flag & TD_NOACTION)
 			break;
 
 		if (td->flag & TD_SKIP)
 			continue;
 
-		if(td->val) {
-			//*td->val= ratio;
+		if (td->val) {
+			// *td->val= ratio;
 			*td->val= td->ival*ratio;
 			if (*td->val <= 0.0f) *td->val = 0.001f;
 		}
@@ -3794,11 +3824,13 @@ int PushPull(TransInfo *t, const int UNUSED(mval[2]))
 		sprintf(str, "Push/Pull: %.4f%s %s", distance, t->con.text, t->proptext);
 	}
 
+	t->values[0] = distance;
+
 	if (t->con.applyRot && t->con.mode & CON_APPLY) {
 		t->con.applyRot(t, NULL, axis, NULL);
 	}
 
-	for(i = 0 ; i < t->total; i++, td++) {
+	for (i = 0 ; i < t->total; i++, td++) {
 		if (td->flag & TD_NOACTION)
 			break;
 
@@ -3868,7 +3900,7 @@ void initBevel(TransInfo *t)
 int handleEventBevel(TransInfo *t, wmEvent *event)
 {
 	if (event->val==KM_PRESS) {
-		if(!G.editBMesh) return 0;
+		if (!G.editBMesh) return 0;
 
 		switch (event->type) {
 		case MIDDLEMOUSE:
@@ -3929,7 +3961,7 @@ int Bevel(TransInfo *t, const int UNUSED(mval[2]))
 	}
 
 	if (distance < 0) distance = -distance;
-	for(i = 0 ; i < t->total; i++, td++) {
+	for (i = 0 ; i < t->total; i++, td++) {
 		if (td->axismtx[1][0] > 0 && distance > td->axismtx[1][0]) {
 			d = td->axismtx[1][0];
 		}
@@ -4001,7 +4033,7 @@ int BevelWeight(TransInfo *t, const int UNUSED(mval[2]))
 			sprintf(str, "Bevel Weight: %.3f %s", weight, t->proptext);
 	}
 
-	for(i = 0 ; i < t->total; i++, td++) {
+	for (i = 0 ; i < t->total; i++, td++) {
 		if (td->flag & TD_NOACTION)
 			break;
 
@@ -4074,7 +4106,7 @@ int Crease(TransInfo *t, const int UNUSED(mval[2]))
 			sprintf(str, "Crease: %.3f %s", crease, t->proptext);
 	}
 
-	for(i = 0 ; i < t->total; i++, td++) {
+	for (i = 0 ; i < t->total; i++, td++) {
 		if (td->flag & TD_NOACTION)
 			break;
 
@@ -4169,12 +4201,10 @@ int BoneSize(TransInfo *t, const int mval[2])
 	
 	// TRANSFORM_FIX_ME MOVE TO MOUSE INPUT
 	/* for manipulator, center handle, the scaling can't be done relative to center */
-	if( (t->flag & T_USES_MANIPULATOR) && t->con.mode==0)
-	{
+	if ((t->flag & T_USES_MANIPULATOR) && t->con.mode==0) {
 		ratio = 1.0f - ((t->imval[0] - mval[0]) + (t->imval[1] - mval[1]))/100.0f;
 	}
-	else
-	{
+	else {
 		ratio = t->values[0];
 	}
 	
@@ -4197,7 +4227,7 @@ int BoneSize(TransInfo *t, const int mval[2])
 	
 	headerBoneSize(t, size, str);
 	
-	for(i = 0 ; i < t->total; i++, td++) {
+	for (i = 0 ; i < t->total; i++, td++) {
 		if (td->flag & TD_NOACTION)
 			break;
 		
@@ -4259,7 +4289,7 @@ int BoneEnvelope(TransInfo *t, const int UNUSED(mval[2]))
 		sprintf(str, "Envelope: %3f", ratio);
 	}
 	
-	for(i = 0 ; i < t->total; i++, td++) {
+	for (i = 0 ; i < t->total; i++, td++) {
 		if (td->flag & TD_NOACTION)
 			break;
 		
@@ -4283,544 +4313,587 @@ int BoneEnvelope(TransInfo *t, const int UNUSED(mval[2]))
 }
 
 /* ********************  Edge Slide   *************** */
+static BMEdge *get_other_edge(BMVert *v, BMEdge *e)
+{
+	BMIter iter;
+	BMEdge *e2;
+
+	BM_ITER_ELEM (e2, &iter, v, BM_EDGES_OF_VERT) {
+		if (BM_elem_flag_test(e2, BM_ELEM_SELECT) && e2 != e)
+			return e2;
+	}
+
+	return NULL;
+}
+
+static BMLoop *get_next_loop(BMVert *v, BMLoop *l,
+                             BMEdge *olde, BMEdge *nexte, float vec[3])
+{
+	BMLoop *firstl;
+	float a[3] = {0.0f, 0.0f, 0.0f}, n[3] = {0.0f, 0.0f, 0.0f};
+	int i=0;
+
+	firstl = l;
+	do {
+		l = BM_face_other_edge_loop(l->f, l->e, v);
+		if (l->radial_next == l)
+			return NULL;
+		
+		if (l->e == nexte) {
+			if (i) {
+				mul_v3_fl(a, 1.0f / (float)i);
+			}
+			else {
+				float f1[3], f2[3], f3[3];
+
+				sub_v3_v3v3(f1, BM_edge_other_vert(olde, v)->co, v->co);
+				sub_v3_v3v3(f2, BM_edge_other_vert(nexte, v)->co, v->co);
+
+				cross_v3_v3v3(f3, f1, l->f->no);
+				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);
+			}
+			
+			copy_v3_v3(vec, a);
+			return l;
+		}
+		else {
+			sub_v3_v3v3(n, BM_edge_other_vert(l->e, v)->co, v->co);
+			add_v3_v3v3(a, a, n);
+			i += 1;
+		}
+
+		if (BM_face_other_edge_loop(l->f, l->e, v)->e == nexte) {
+			if (i)
+				mul_v3_fl(a, 1.0f / (float)i);
+			
+			copy_v3_v3(vec, a);
+			return BM_face_other_edge_loop(l->f, l->e, v);
+		}
+		
+		l = l->radial_next;
+	} while (l != firstl); 
+
+	if (i)
+		mul_v3_fl(a, 1.0f / (float)i);
+	
+	copy_v3_v3(vec, a);
+	
+	return NULL;
+}
 
 static int createSlideVerts(TransInfo *t)
 {
 	Mesh *me = t->obedit->data;
-	EditMesh *em = me->edit_mesh;
-	EditFace *efa;
-	EditEdge *eed,*first=NULL,*last=NULL, *temp = NULL;
-	EditVert *ev, *nearest = NULL;
-	LinkNode *edgelist = NULL, *vertlist=NULL, *look;
-	GHash *vertgh;
-	TransDataSlideVert *tempsv;
-	int i, j, numsel, numadded=0, timesthrough = 0, vertsel=0;
-	/* UV correction vars */
-	GHash **uvarray= NULL;
+	BMEditMesh *em = me->edit_btmesh;
+	BMesh *bm = em->bm;
+	BMIter iter, iter2;
+	BMEdge *e, *e1 /*, *ee, *le */ /* UNUSED */;
+	BMVert *v, *v2, *first;
+	BMLoop *l, *l1, *l2;
+	TransDataSlideVert *sv_array;
+	BMBVHTree *btree = BMBVH_NewBVH(em, 0, NULL, NULL);
+	SmallHash table;
 	SlideData *sld = MEM_callocN(sizeof(*sld), "sld");
-	const int  uvlay_tot=  (t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) ? CustomData_number_of_layers(&em->fdata, CD_MTFACE) : 0;
-	int uvlay_idx;
-	TransDataSlideUv *slideuvs=NULL, *suv=NULL, *suv_last=NULL;
-	RegionView3D *v3d = t->ar ? t->ar->regiondata : NULL; /* background mode support */
+	View3D *v3d = t->sa ? t->sa->spacedata.first : NULL;
+	RegionView3D *rv3d = t->ar ? t->ar->regiondata : NULL; /* background mode support */
+	ARegion *ar = t->ar;
 	float projectMat[4][4];
-	float start[3] = {0.0f, 0.0f, 0.0f}, end[3] = {0.0f, 0.0f, 0.0f};
-	float vec[3];
-	float totvec=0.0;
+	float start[3] = {0.0f, 0.0f, 0.0f}, dir[3], end[3] = {0.0f, 0.0f, 0.0f};
+	float vec[3], vec2[3], lastvec[3] /*, size, dis=0.0, z */ /* UNUSED */;
+	int numsel, i, j;
 
 	if (!v3d) {
-		/*ok, let's try to survive this*/
+		/* ok, let's try to survive this */
 		unit_m4(projectMat);
-	} else {
-		ED_view3d_ob_project_mat_get(v3d, t->obedit, projectMat);
 	}
-	
-	numsel =0;
-
-	// Get number of selected edges and clear some flags
-	for(eed=em->edges.first;eed;eed=eed->next) {
-		eed->f1 = 0;
-		eed->f2 = 0;
-		if(eed->f & SELECT) numsel++;
-	}
-
-	for(ev=em->verts.first;ev;ev=ev->next) {
-		ev->f1 = 0;
+	else {
+		ED_view3d_ob_project_mat_get(rv3d, t->obedit, projectMat);
 	}
+	
+	BLI_smallhash_init(&sld->vhash);
+	BLI_smallhash_init(&sld->origfaces);
+	BLI_smallhash_init(&table);
+	
+	/*ensure valid selection*/
+	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+		if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
+			numsel = 0;
+			BM_ITER_ELEM (e, &iter2, v, BM_EDGES_OF_VERT) {
+				if (BM_elem_flag_test(e, BM_ELEM_SELECT)) {
+					/* BMESH_TODO: this is probably very evil,
+					 * set v->e to a selected edge*/
+					v->e = e;
 
-	//Make sure each edge only has 2 faces
-	// make sure loop doesn't cross face
-	for(efa=em->faces.first;efa;efa=efa->next) {
-		int ct = 0;
-		if(efa->e1->f & SELECT) {
-			ct++;
-			efa->e1->f1++;
-			if(efa->e1->f1 > 2) {
-				//BKE_report(op->reports, RPT_ERROR, "3+ face edge");
-				MEM_freeN(sld);
-				return 0;
-			}
-		}
-		if(efa->e2->f & SELECT) {
-			ct++;
-			efa->e2->f1++;
-			if(efa->e2->f1 > 2) {
-				//BKE_report(op->reports, RPT_ERROR, "3+ face edge");
-				MEM_freeN(sld);
-				return 0;
+					numsel++;
+				}
 			}
-		}
-		if(efa->e3->f & SELECT) {
-			ct++;
-			efa->e3->f1++;
-			if(efa->e3->f1 > 2) {
-				//BKE_report(op->reports, RPT_ERROR, "3+ face edge");
+
+			if (numsel == 0 || numsel > 2) {
 				MEM_freeN(sld);
-				return 0;
+				BMBVH_FreeBVH(btree);
+				return 0; /* invalid edge selection */
 			}
 		}
-		if(efa->e4 && efa->e4->f & SELECT) {
-			ct++;
-			efa->e4->f1++;
-			if(efa->e4->f1 > 2) {
-				//BKE_report(op->reports, RPT_ERROR, "3+ face edge");
+	}
+
+	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+		if (BM_elem_flag_test(e, BM_ELEM_SELECT)) {
+			if (!BM_edge_is_manifold(e)) {
 				MEM_freeN(sld);
-				return 0;
+				BMBVH_FreeBVH(btree);
+				return 0; /* can only handle exactly 2 faces around each edge */
 			}
 		}
-		// Make sure loop is not 2 edges of same face
-		if(ct > 1) {
-		   //BKE_report(op->reports, RPT_ERROR, "Loop crosses itself");
-			MEM_freeN(sld);
-			return 0;
-		}
 	}
 
-	// Get # of selected verts
-	for(ev=em->verts.first;ev;ev=ev->next) {
-		if(ev->f & SELECT) vertsel++;
+	j = 0;
+	BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+		if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
+			BM_elem_flag_enable(v, BM_ELEM_TAG);
+			BLI_smallhash_insert(&table, (uintptr_t)v, SET_INT_IN_POINTER(j));
+			j += 1;
+		}
+		else {
+			BM_elem_flag_disable(v, BM_ELEM_TAG);
+		}
 	}
 
-	// Test for multiple segments
-	if(vertsel > numsel+1) {
-		//BKE_report(op->reports, RPT_ERROR, "Please choose a single edge loop");
+	if (!j) {
 		MEM_freeN(sld);
+		BMBVH_FreeBVH(btree);
 		return 0;
 	}
 
-	// Get the edgeloop in order - mark f1 with SELECT once added
-	for(eed=em->edges.first;eed;eed=eed->next) {
-		if((eed->f & SELECT) && !(eed->f1 & SELECT)) {
-			// If this is the first edge added, just put it in
-			if(!edgelist) {
-				BLI_linklist_prepend(&edgelist,eed);
-				numadded++;
-				first = eed;
-				last  = eed;
-				eed->f1 = SELECT;
-			} else {
-				if(editedge_getSharedVert(eed, last)) {
-					BLI_linklist_append(&edgelist,eed);
-					eed->f1 = SELECT;
-					numadded++;
-					last = eed;
-				}  else if(editedge_getSharedVert(eed, first)) {
-					BLI_linklist_prepend(&edgelist,eed);
-					eed->f1 = SELECT;
-					numadded++;
-					first = eed;
-				}
-			}
-		}
-		if(eed->next == NULL && numadded != numsel) {
-			eed=em->edges.first;
-			timesthrough++;
-		}
+	sv_array = MEM_callocN(sizeof(TransDataSlideVert) * j, "sv_array");
 
-		// It looks like there was an unexpected case - Hopefully should not happen
-		if(timesthrough >= numsel*2) {
-			BLI_linklist_free(edgelist,NULL);
-			//BKE_report(op->reports, RPT_ERROR, "Could not order loop");
-			MEM_freeN(sld);
-			return 0;
-		}
-	}
+	j = 0;
+	while (1) {
+		v = NULL;
+		BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+			if (BM_elem_flag_test(v, BM_ELEM_TAG))
+				break;
 
-	// Put the verts in order in a linklist
-	look = edgelist;
-	while(look) {
-		eed = look->link;
-		if(!vertlist) {
-			if(look->next) {
-				temp = look->next->link;
-
-				//This is the first entry takes care of extra vert
-				if(eed->v1 != temp->v1 && eed->v1 != temp->v2) {
-					BLI_linklist_append(&vertlist,eed->v1);
-					eed->v1->f1 = 1;
-				} else {
-					BLI_linklist_append(&vertlist,eed->v2);
-					eed->v2->f1 = 1;
-				}
-			} else {
-				//This is the case that we only have 1 edge
-				BLI_linklist_append(&vertlist,eed->v1);
-				eed->v1->f1 = 1;
-			}
-		}
-		// for all the entries
-		if(eed->v1->f1 != 1) {
-			BLI_linklist_append(&vertlist,eed->v1);
-			eed->v1->f1 = 1;
-		} else  if(eed->v2->f1 != 1) {
-			BLI_linklist_append(&vertlist,eed->v2);
-			eed->v2->f1 = 1;
 		}
-		look = look->next;
-	}
-
-	// populate the SlideVerts
-
-	vertgh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "createSlideVerts gh");
-	look = vertlist;
-	while(look) {
-		i=0;
-		j=0;
-		ev = look->link;
-		tempsv = (struct TransDataSlideVert*)MEM_mallocN(sizeof(struct TransDataSlideVert),"SlideVert");
-		tempsv->up = NULL;
-		tempsv->down = NULL;
-		tempsv->origvert.co[0] = ev->co[0];
-		tempsv->origvert.co[1] = ev->co[1];
-		tempsv->origvert.co[2] = ev->co[2];
-		tempsv->origvert.no[0] = ev->no[0];
-		tempsv->origvert.no[1] = ev->no[1];
-		tempsv->origvert.no[2] = ev->no[2];
-		// i is total edges that vert is on
-		// j is total selected edges that vert is on
-
-		for(eed=em->edges.first;eed;eed=eed->next) {
-			if(eed->v1 == ev || eed->v2 == ev) {
-				i++;
-				if(eed->f & SELECT) {
-					 j++;
-				}
-			}
-		}
-		// If the vert is in the middle of an edge loop, it touches 2 selected edges and 2 unselected edges
-		if(i == 4 && j == 2) {
-			for(eed=em->edges.first;eed;eed=eed->next) {
-				if(editedge_containsVert(eed, ev)) {
-					if(!(eed->f & SELECT)) {
-						if(!tempsv->up) {
-							tempsv->up = eed;
-						} else if (!(tempsv->down)) {
-							tempsv->down = eed;
-						}
-					}
-				}
-			}
-		}
-		// If it is on the end of the loop, it touches 1 selected and as least 2 more unselected
-		if(i >= 3 && j == 1) {
-			for(eed=em->edges.first;eed;eed=eed->next) {
-				if(editedge_containsVert(eed, ev) && eed->f & SELECT) {
-					for(efa = em->faces.first;efa;efa=efa->next) {
-						if(editface_containsEdge(efa, eed)) {
-							if(editedge_containsVert(efa->e1, ev) && efa->e1 != eed) {
-								if(!tempsv->up) {
-									tempsv->up = efa->e1;
-								} else if (!(tempsv->down)) {
-									tempsv->down = efa->e1;
-								}
-							}
-							if(editedge_containsVert(efa->e2, ev) && efa->e2 != eed) {
-								if(!tempsv->up) {
-									tempsv->up = efa->e2;
-								} else if (!(tempsv->down)) {
-									tempsv->down = efa->e2;
-								}
-							}
-							if(editedge_containsVert(efa->e3, ev) && efa->e3 != eed) {
-								if(!tempsv->up) {
-									tempsv->up = efa->e3;
-								} else if (!(tempsv->down)) {
-									tempsv->down = efa->e3;
-								}
-							}
-							if(efa->e4) {
-								if(editedge_containsVert(efa->e4, ev) && efa->e4 != eed) {
-									if(!tempsv->up) {
-										tempsv->up = efa->e4;
-									} else if (!(tempsv->down)) {
-										tempsv->down = efa->e4;
-									}
-								}
-							}
 
-						}
-					}
-				}
+		if (!v)
+			break;
+
+		if (!v->e)
+			continue;
+		
+		first = v;
+
+		/*walk along the edge loop*/
+		e = v->e;
+
+		/*first, rewind*/
+		numsel = 0;
+		do {
+			e = get_other_edge(v, e);
+			if (!e) {
+				e = v->e;
+				break;
 			}
-		}
-		if(i > 4 && j == 2) {
-			BLI_ghash_free(vertgh, NULL, (GHashValFreeFP)MEM_freeN);
-			BLI_linklist_free(vertlist,NULL);
-			BLI_linklist_free(edgelist,NULL);
-			return 0;
-		}
-		BLI_ghash_insert(vertgh,ev,tempsv);
 
-		look = look->next;
-	}
+			numsel += 1;
 
-	// make sure the UPs and DOWNs are 'faceloops'
-	// Also find the nearest slidevert to the cursor
+			if (!BM_elem_flag_test(BM_edge_other_vert(e, v), BM_ELEM_TAG))
+				break;
 
-	look = vertlist;
-	nearest = NULL;
-	while(look) {
-		tempsv  = BLI_ghash_lookup(vertgh,(EditVert*)look->link);
+			v = BM_edge_other_vert(e, v);
+		} while (e != first->e);
 
-		if(!tempsv->up || !tempsv->down) {
-			//BKE_report(op->reports, RPT_ERROR, "Missing rails");
-			BLI_ghash_free(vertgh, NULL, (GHashValFreeFP)MEM_freeN);
-			BLI_linklist_free(vertlist,NULL);
-			BLI_linklist_free(edgelist,NULL);
-			return 0;
-		}
+		BM_elem_flag_disable(v, BM_ELEM_TAG);
 
-		if(me->drawflag & ME_DRAWEXTRA_EDGELEN) {
-			if(!(tempsv->up->f & SELECT)) {
-				tempsv->up->f |= SELECT;
-				tempsv->up->f2 |= 16;
-			} else {
-				tempsv->up->f2 |= ~16;
-			}
-			if(!(tempsv->down->f & SELECT)) {
-				tempsv->down->f |= SELECT;
-				tempsv->down->f2 |= 16;
-			} else {
-				tempsv->down->f2 |= ~16;
-			}
+		l1 = l2 = l = NULL;
+		l1 = e->l;
+		l2 = e->l->radial_next;
+
+		l = BM_face_other_edge_loop(l1->f, l1->e, v);
+		sub_v3_v3v3(vec, BM_edge_other_vert(l->e, v)->co, v->co);
+
+		if (l2 != l1) {
+			l = BM_face_other_edge_loop(l2->f, l2->e, v);
+			sub_v3_v3v3(vec2, BM_edge_other_vert(l->e, v)->co, v->co);
+		}
+		else {
+			l2 = NULL;
 		}
 
-		if(look->next != NULL) {
-			TransDataSlideVert *sv;
-			
-			ev = (EditVert*)look->next->link;
-			sv = BLI_ghash_lookup(vertgh, ev);
+		/*iterate over the loop*/
+		first = v;
+		do {
+			TransDataSlideVert *sv = sv_array + j;
 
-			if(sv) {
-				float co[3], co2[3], tvec[3];
+			sv->v = v;
+			sv->origvert = *v;
+			copy_v3_v3(sv->upvec, vec);
+			if (l2)
+				copy_v3_v3(sv->downvec, vec2);
 
-				ev = (EditVert*)look->link;
+			l = BM_face_other_edge_loop(l1->f, l1->e, v);
+			sv->up = BM_edge_other_vert(l->e, v);
 
-				if(!sharesFace(em, tempsv->up,sv->up)) {
-					EditEdge *swap;
-					swap = sv->up;
-					sv->up = sv->down;
-					sv->down = swap;
-				}
+			if (l2) {
+				l = BM_face_other_edge_loop(l2->f, l2->e, v);
+				sv->down = BM_edge_other_vert(l->e, v);
+			}
+
+			v2=v, v = BM_edge_other_vert(e, v);
+
+			e1 = e;
+			e = get_other_edge(v, e);
+			if (!e) {
+				//v2=v, v = BM_edge_other_vert(l1->e, v);
+
+				sv = sv_array + j + 1;
+				sv->v = v;
+				sv->origvert = *v;
 				
-				if (v3d) {
-					ED_view3d_project_float(t->ar, tempsv->up->v1->co, co, projectMat);
-					ED_view3d_project_float(t->ar, tempsv->up->v2->co, co2, projectMat);
+				l = BM_face_other_edge_loop(l1->f, l1->e, v);
+				sv->up = BM_edge_other_vert(l->e, v);
+				sub_v3_v3v3(sv->upvec, BM_edge_other_vert(l->e, v)->co, v->co);
+
+				if (l2) {
+					l = BM_face_other_edge_loop(l2->f, l2->e, v);
+					sv->down = BM_edge_other_vert(l->e, v);
+					sub_v3_v3v3(sv->downvec, BM_edge_other_vert(l->e, v)->co, v->co);
 				}
 
-				if (ev == tempsv->up->v1) {
-					sub_v3_v3v3(tvec, co, co2);
-				} else {
-					sub_v3_v3v3(tvec, co2, co);
-				}
+				BM_elem_flag_disable(v, BM_ELEM_TAG);
+				BM_elem_flag_disable(v2, BM_ELEM_TAG);
+				
+				j += 2;
+				break;
+			}
 
-				add_v3_v3(start, tvec);
+			l1 = get_next_loop(v, l1, e1, e, vec);
+			l2 = l2 ? get_next_loop(v, l2, e1, e, vec2) : NULL;
 
-				if (v3d) {
-					ED_view3d_project_float(t->ar, tempsv->down->v1->co, co, projectMat);
-					ED_view3d_project_float(t->ar, tempsv->down->v2->co, co2, projectMat);
-				}
+			j += 1;
 
-				if (ev == tempsv->down->v1) {
-					sub_v3_v3v3(tvec, co2, co);
-				} else {
-					sub_v3_v3v3(tvec, co, co2);
-				}
+			BM_elem_flag_disable(v, BM_ELEM_TAG);
+			BM_elem_flag_disable(v2, BM_ELEM_TAG);
+		} while (e != first->e && l1);
+	}
 
-				add_v3_v3(end, tvec);
+	//EDBM_flag_disable_all(em, BM_ELEM_SELECT);
 
-				totvec += 1.0f;
-				nearest = (EditVert*)look->link;
+	sld->sv = sv_array;
+	sld->totsv = j;
+	
+	/*find mouse vector*/
+	/* dis = z = -1.0f; */ /* UNUSED */
+	/* size = 50.0; */ /* UNUSED */
+	zero_v3(lastvec); zero_v3(dir);
+	/* ee = le = NULL; */ /* UNUSED */
+	BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+		if (BM_elem_flag_test(e, BM_ELEM_SELECT)) {
+			BMIter iter2;
+			BMEdge *e2;
+			float vec1[3], dis2, mval[2] = {t->mval[0], t->mval[1]}, d;
+						
+			/* search cross edges for visible edge to the mouse cursor,
+			 * then use the shared vertex to calculate screen vector*/
+			dis2 = -1.0f;
+			for (i=0; i<2; i++) {
+				v = i?e->v1:e->v2;
+				BM_ITER_ELEM (e2, &iter2, v, BM_EDGES_OF_VERT) {
+					if (BM_elem_flag_test(e2, BM_ELEM_SELECT))
+						continue;
+					
+					if (!BMBVH_EdgeVisible(btree, e2, ar, v3d, t->obedit))
+						continue;
+					
+					j = GET_INT_FROM_POINTER(BLI_smallhash_lookup(&table, (uintptr_t)v));
+
+					if (sv_array[j].down) {
+						ED_view3d_project_float_v3(ar, sv_array[j].down->co, vec1, projectMat);
+					}
+					else {
+						add_v3_v3v3(vec1, v->co, sv_array[j].downvec);
+						ED_view3d_project_float_v3(ar, vec1, vec1, projectMat);
+					}
+					
+					if (sv_array[j].up) {
+						ED_view3d_project_float_v3(ar, sv_array[j].up->co, vec2, projectMat);
+					}
+					else {
+						add_v3_v3v3(vec1, v->co, sv_array[j].upvec);
+						ED_view3d_project_float_v3(ar, vec2, vec2, projectMat);
+					}
+
+					d = dist_to_line_segment_v2(mval, vec1, vec2);
+					if (dis2 == -1.0f || d < dis2) {
+						dis2 = d;
+						/* ee = e2; */ /* UNUSED */
+						/* size = len_v3v3(vec1, vec2); */ /* UNUSED */
+						sub_v3_v3v3(dir, vec1, vec2);
+					}
+				}
 			}
 		}
+	}
+
+	bmesh_edit_begin(bm, BMO_OP_FLAG_UNTAN_MULTIRES);
 
+	/*create copies of faces for customdata projection*/
+	sv_array = sld->sv;
+	for (i=0; i<sld->totsv; i++, sv_array++) {
+		BMIter fiter, liter;
+		BMFace *f;
+		BMLoop *l;
+		
+		BM_ITER_ELEM (f, &fiter, sv_array->v, BM_FACES_OF_VERT) {
+			
+			if (!BLI_smallhash_haskey(&sld->origfaces, (uintptr_t)f)) {
+				BMFace *copyf = BM_face_copy(bm, f, TRUE, TRUE);
+				
+				BM_face_select_set(bm, copyf, FALSE);
+				BM_elem_flag_enable(copyf, BM_ELEM_HIDDEN);
+				BM_ITER_ELEM (l, &liter, copyf, BM_LOOPS_OF_FACE) {
+					BM_vert_select_set(bm, l->v, FALSE);
+					BM_elem_flag_enable(l->v, BM_ELEM_HIDDEN);
+					BM_edge_select_set(bm, l->e, FALSE);
+					BM_elem_flag_enable(l->e, BM_ELEM_HIDDEN);
+				}
 
+				BLI_smallhash_insert(&sld->origfaces, (uintptr_t)f, copyf);
+			}
+		}
 
-		look = look->next;
+		BLI_smallhash_insert(&sld->vhash, (uintptr_t)sv_array->v, sv_array);
 	}
+	
+	sld->origfaces_init = TRUE;
+	sld->em = em;
+	
+	/*zero out start*/
+	zero_v3(start);
+	
+	/*dir holds a vector along edge loop*/
+	copy_v3_v3(end, dir);
+	mul_v3_fl(end, 0.5);
+	
+	sld->start[0] = t->mval[0] + start[0];
+	sld->start[1] = t->mval[1] + start[1];
 
-	add_v3_v3(start, end);
-	mul_v3_fl(start, 0.5f*(1.0f/totvec));
-	copy_v3_v3(vec, start);
-	start[0] = t->mval[0];
-	start[1] = t->mval[1];
-	add_v3_v3v3(end, start, vec);
+	sld->end[0] = t->mval[0] + end[0];
+	sld->end[1] = t->mval[1] + end[1];
+	
+	sld->perc = 0.0f;
+	
+	t->customData = sld;
+	
+	BLI_smallhash_release(&table);
+	BMBVH_FreeBVH(btree);
+	
+	return 1;
+}
 
+void projectSVData(TransInfo *t, int final)
+{
+	SlideData *sld = t->customData;
+	TransDataSlideVert *sv;
+	BMEditMesh *em = sld->em;
+	SmallHash visit;
+	int i;
 
-	/* Ensure minimum screen distance, when looking top down on edge loops */
-#define EDGE_SLIDE_MIN 30
-	if (len_squared_v2v2(start, end) < (EDGE_SLIDE_MIN * EDGE_SLIDE_MIN)) {
-		if(ABS(start[0]-end[0]) + ABS(start[1]-end[1]) < 4.0f) {
-			/* even more exceptional case, points are ontop of each other */
-			end[0]= start[0];
-			end[1]= start[1] + EDGE_SLIDE_MIN;
-		}
-		else {
-			sub_v2_v2(end, start);
-			normalize_v2(end);
-			mul_v2_fl(end, EDGE_SLIDE_MIN);
-			add_v2_v2(end, start);
-		}
-	}
-#undef EDGE_SLIDE_MIN
+	if (!em)
+		return;
+	
+	if (!(t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT))
+		return;
 
+	/* don't do this at all for non-basis shape keys, too easy to
+	 * accidentally break uv maps or vertex colors then */
+	if (em->bm->shapenr > 1)
+		return;
 
-	sld->start[0] = (int) start[0];
-	sld->start[1] = (int) start[1];
-	sld->end[0] = (int) end[0];
-	sld->end[1] = (int) end[1];
+	BLI_smallhash_init(&visit);
 	
-	if (uvlay_tot) {
-		int maxnum = 0;
+	for (i=0, sv = sld->sv; i < sld->totsv; sv++, i++) {
+		BMIter fiter;
+		BMFace *f;
+		
 
-		uvarray = MEM_callocN( uvlay_tot * sizeof(GHash *), "SlideUVs Array");
-		sld->totuv = uvlay_tot;
-		suv_last = slideuvs = MEM_callocN( uvlay_tot * (numadded+1) * sizeof(TransDataSlideUv), "SlideUVs"); /* uvLayers * verts */
-		suv = NULL;
+		/* BMESH_TODO, this interpolates between vertex/loops which are not moved
+		 * (are only apart of a face attached to a slide vert), couldn't we iterate BM_LOOPS_OF_VERT
+		 * here and only iterpolate those? */
+		BM_ITER_ELEM (f, &fiter, sv->v, BM_FACES_OF_VERT) {
+			BMIter liter;
+			BMLoop *l;
 
-		for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
+			BMFace *f_copy;      /* the copy of 'f' */
+			BMFace *f_copy_flip; /* the copy of 'f' or detect if we need to flip to the shorter side. */
 
-			uvarray[uvlay_idx] = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "createSlideVerts2 gh");
+			char is_sel, is_hide;
 
-			for(ev=em->verts.first;ev;ev=ev->next) {
-				ev->tmp.l = 0;
-			}
-			look = vertlist;
-			while(look) {
-				float *uv_new;
-				tempsv  = BLI_ghash_lookup(vertgh,(EditVert*)look->link);
-
-				ev = look->link;
-				suv = NULL;
-				for(efa = em->faces.first;efa;efa=efa->next) {
-					if (ev->tmp.l != -1) { /* test for self, in this case its invalid */
-						int k=-1; /* face corner */
-
-						/* Is this vert in the faces corner? */
-						if		(efa->v1==ev)				k=0;
-						else if	(efa->v2==ev)				k=1;
-						else if	(efa->v3==ev)				k=2;
-						else if	(efa->v4 && efa->v4==ev)	k=3;
-
-						if (k != -1) {
-							MTFace *tf = CustomData_em_get_n(&em->fdata, efa->data, CD_MTFACE, uvlay_idx);
-							EditVert *ev_up, *ev_down;
-
-							uv_new = tf->uv[k];
-
-							if (ev->tmp.l) {
-								if (fabsf(suv->origuv[0]-uv_new[0]) > 0.0001f || fabsf(suv->origuv[1]-uv_new[1]) > 0.0001f) {
-									ev->tmp.l = -1; /* Tag as invalid */
-									BLI_linklist_free(suv->fuv_list,NULL);
-									suv->fuv_list = NULL;
-									BLI_ghash_remove(uvarray[uvlay_idx],ev, NULL, NULL);
-									suv = NULL;
-									break;
-								}
-							} else {
-								ev->tmp.l = 1;
-								suv = suv_last;
-
-								suv->fuv_list = NULL;
-								suv->uv_up = suv->uv_down = NULL;
-								suv->origuv[0] = uv_new[0];
-								suv->origuv[1] = uv_new[1];
-
-								BLI_linklist_prepend(&suv->fuv_list, uv_new);
-								BLI_ghash_insert(uvarray[uvlay_idx],ev,suv);
-
-								suv_last++; /* advance to next slide UV */
-								maxnum++;
+			
+			if (BLI_smallhash_haskey(&visit, (uintptr_t)f))
+				continue;
+			
+			BLI_smallhash_insert(&visit, (uintptr_t)f, NULL);
+			
+			/* the face attributes of the copied face will get
+			 * copied over, so its necessary to save the selection
+			 * and hidden state*/
+			is_sel = BM_elem_flag_test(f, BM_ELEM_SELECT);
+			is_hide = BM_elem_flag_test(f, BM_ELEM_HIDDEN);
+			
+			f_copy = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)f);
+			
+			/* project onto copied projection face */
+			BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+				f_copy_flip = f_copy;
+
+				if (BM_elem_flag_test(l->e, BM_ELEM_SELECT) || BM_elem_flag_test(l->prev->e, BM_ELEM_SELECT)) {
+					/* the loop is attached of the selected edges that are sliding */
+					BMLoop *l_ed_sel = l;
+					
+					if (!BM_elem_flag_test(l->e, BM_ELEM_SELECT))
+						l_ed_sel = l_ed_sel->prev;
+					
+					if (sld->perc < 0.0f) {
+						if (BM_vert_in_face(l_ed_sel->radial_next->f, sv->down)) {
+							f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)l_ed_sel->radial_next->f);
+						}
+					}
+					else if (sld->perc > 0.0f) {
+						if (BM_vert_in_face(l_ed_sel->radial_next->f, sv->up)) {
+							f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)l_ed_sel->radial_next->f);
+						}
+					}
+
+					BLI_assert(f_copy_flip != NULL);
+					if (!f_copy_flip) {
+						continue;  /* shouldn't happen, but protection */
+					}
+				}
+				else {
+					/* the loop is attached to only one vertex and not a selected edge,
+					 * this means we have to find a selected edges face going in the right direction
+					 * to copy from else we get bad distortion see: [#31080] */
+					BMIter eiter;
+					BMEdge *e_sel;
+
+					BM_ITER_ELEM (e_sel, &eiter, l->v, BM_EDGES_OF_VERT) {
+						if (BM_elem_flag_test(e_sel, BM_ELEM_SELECT)) {;
+							break;
+						}
+					}
+
+					if (e_sel) {
+						/* warning if the UV's are not contiguous, this will copy from the _wrong_ UVs
+						 * in fact whenever the face being copied is not 'f_copy' this can happen,
+						 * we could be a lot smarter about this but would need to deal with every UV channel or
+						 * add a way to mask out lauers when calling #BM_loop_interp_from_face() */
+						if (sld->perc < 0.0f) {
+							if (BM_vert_in_face(e_sel->l->f, sv->down)) {
+								f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)e_sel->l->f);
+							}
+							else if (BM_vert_in_face(e_sel->l->radial_next->f, sv->down)) {
+								f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)e_sel->l->radial_next->f);
 							}
 
-							/* Now get the uvs along the up or down edge if we can */
-							if (suv) {
-								if (!suv->uv_up) {
-									ev_up = editedge_getOtherVert(tempsv->up,ev);
-									if		(efa->v1==ev_up)				suv->uv_up = tf->uv[0];
-									else if	(efa->v2==ev_up)				suv->uv_up = tf->uv[1];
-									else if	(efa->v3==ev_up)				suv->uv_up = tf->uv[2];
-									else if	(efa->v4 && efa->v4==ev_up)		suv->uv_up = tf->uv[3];
-								}
-								if (!suv->uv_down) { /* if the first face was apart of the up edge, it cant be apart of the down edge */
-									ev_down = editedge_getOtherVert(tempsv->down,ev);
-									if		(efa->v1==ev_down)				suv->uv_down = tf->uv[0];
-									else if	(efa->v2==ev_down)				suv->uv_down = tf->uv[1];
-									else if	(efa->v3==ev_down)				suv->uv_down = tf->uv[2];
-									else if	(efa->v4 && efa->v4==ev_down)	suv->uv_down = tf->uv[3];
-								}
-
-								/* Copy the pointers to the face UV's */
-								BLI_linklist_prepend(&suv->fuv_list, uv_new);
+						}
+						else if (sld->perc > 0.0f) {
+							if (BM_vert_in_face(e_sel->l->f, sv->up)) {
+								f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)e_sel->l->f);
+							}
+							else if (BM_vert_in_face(e_sel->l->radial_next->f, sv->up)) {
+								f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)e_sel->l->radial_next->f);
 							}
 						}
 					}
+
 				}
-				look = look->next;
+				
+				/* only loop data, no vertex data since that contains shape keys,
+				 * and we do not want to mess up other shape keys */
+				BM_loop_interp_from_face(em->bm, l, f_copy_flip, FALSE, FALSE);
+
+				if (final) {
+					BM_loop_interp_multires(em->bm, l, f_copy_flip);
+					if (f_copy != f_copy_flip) {
+						BM_loop_interp_multires(em->bm, l, f_copy);
+					}
+				}
+			}
+			
+			/* make sure face-attributes are correct (e.g. MTexPoly) */
+			BM_elem_attrs_copy(em->bm, em->bm, f_copy, f);
+			
+			/* restore selection and hidden flags */
+			BM_face_select_set(em->bm, f, is_sel);
+			if (!is_hide) {
+				/* this check is a workaround for bug, see note - [#30735],
+				 * without this edge can be hidden and selected */
+				BM_elem_hide_set(em->bm, f, is_hide);
 			}
-		} /* end uv map loop */
-	} /* end uvlay_tot */
+		}
+	}
+	
+	BLI_smallhash_release(&visit);
+}
 
-	sld->uvhash = uvarray;
-	sld->slideuv = slideuvs;
-	sld->vhash = vertgh;
-	sld->nearest = nearest;
-	sld->vertlist = vertlist;
-	sld->edgelist = edgelist;
-	sld->suv_last = suv_last;
-	sld->uvlay_tot = uvlay_tot;
+void freeSlideTempFaces(SlideData *sld)
+{
+	if (sld->origfaces_init) {
+		SmallHashIter hiter;
+		BMFace *copyf;
 
-	// we should have enough info now to slide
+		copyf = BLI_smallhash_iternew(&sld->origfaces, &hiter, NULL);
+		for (; copyf; copyf=BLI_smallhash_iternext(&hiter, NULL)) {
+			BM_face_verts_kill(sld->em->bm, copyf);
+		}
 
-	t->customData = sld;
+		BLI_smallhash_release(&sld->origfaces);
 
-	return 1;
+		sld->origfaces_init = FALSE;
+	}
 }
 
+
 void freeSlideVerts(TransInfo *t)
 {
-	TransDataSlideUv *suv;
 	SlideData *sld = t->customData;
-	Mesh *me = t->obedit->data;
-	int uvlay_idx;
-
-	if(me->drawflag & ME_DRAWEXTRA_EDGELEN) {
-		TransDataSlideVert *tempsv;
+	
+#if 0 /*BMESH_TODO*/
+	if (me->drawflag & ME_DRAWEXTRA_EDGELEN) {
+		TransDataSlideVert *sv;
 		LinkNode *look = sld->vertlist;
 		GHash *vertgh = sld->vhash;
-		while(look) {
-			tempsv  = BLI_ghash_lookup(vertgh,(EditVert*)look->link);
-			if(tempsv != NULL) {
-				tempsv->up->f &= !SELECT;
-				tempsv->down->f &= !SELECT;
+		while (look) {
+			sv  = BLI_ghash_lookup(vertgh,(EditVert*)look->link);
+			if (sv != NULL) {
+				sv->up->f &= !SELECT;
+				sv->down->f &= !SELECT;
 			}
 			look = look->next;
 		}
 	}
+#endif
+	
+	if (!sld)
+		return;
+	
+	freeSlideTempFaces(sld);
 
-	//BLI_ghash_free(edgesgh, freeGHash, NULL);
-	BLI_ghash_free(sld->vhash, NULL, (GHashValFreeFP)MEM_freeN);
-	BLI_linklist_free(sld->vertlist, NULL);
-	BLI_linklist_free(sld->edgelist, NULL);
-
-	if (sld->uvlay_tot) {
-		for (uvlay_idx=0; uvlay_idx<sld->uvlay_tot; uvlay_idx++) {
-			BLI_ghash_free(sld->uvhash[uvlay_idx], NULL, NULL);
-		}
-
-		suv = sld->suv_last-1;
-		while (suv >= sld->slideuv) {
-			if (suv->fuv_list) {
-				BLI_linklist_free(suv->fuv_list,NULL);
-			}
-			suv--;
-		}
-
-		MEM_freeN(sld->slideuv);
-		MEM_freeN(sld->uvhash);
-	}
+	bmesh_edit_end(sld->em->bm, BMO_OP_FLAG_UNTAN_MULTIRES);
 
+	BLI_smallhash_release(&sld->vhash);
+	
+	MEM_freeN(sld->sv);
 	MEM_freeN(sld);
+	
 	t->customData = NULL;
+	
+	recalcData(t);
 }
 
 void initEdgeSlide(TransInfo *t)
@@ -4830,7 +4903,7 @@ void initEdgeSlide(TransInfo *t)
 	t->mode = TFM_EDGE_SLIDE;
 	t->transform = EdgeSlide;
 	
-	if(!createSlideVerts(t)) {
+	if (!createSlideVerts(t)) {
 		t->state= TRANS_CANCEL;
 		return;
 	}
@@ -4860,108 +4933,28 @@ void initEdgeSlide(TransInfo *t)
 static int doEdgeSlide(TransInfo *t, float perc)
 {
 	SlideData *sld = t->customData;
-	EditVert *ev, *nearest = sld->nearest;
-	EditVert *centerVert, *upVert, *downVert;
-	LinkNode *vertlist=sld->vertlist, *look;
-	GHash *vertgh = sld->vhash;
-	TransDataSlideVert *tempsv;
-	float len;
-	int prop=1, flip=0;
-	/* UV correction vars */
-	GHash **uvarray= sld->uvhash;
-	const int  uvlay_tot= sld->uvlay_tot;
-	int uvlay_idx;
-	TransDataSlideUv *suv;
-	float uv_tmp[2];
-	LinkNode *fuv_link;
-
-	tempsv = BLI_ghash_lookup(vertgh,nearest);
-
-	centerVert = editedge_getSharedVert(tempsv->up, tempsv->down);
-	upVert = editedge_getOtherVert(tempsv->up, centerVert);
-	downVert = editedge_getOtherVert(tempsv->down, centerVert);
-
-	len = MIN2(perc, len_v3v3(upVert->co,downVert->co));
-	len = MAX2(len, 0);
-
-	//Adjust Edgeloop
-	if(prop) {
-		look = vertlist;
-		while(look) {
-			EditVert *tempev;
-			ev = look->link;
-			tempsv = BLI_ghash_lookup(vertgh,ev);
-
-			tempev = editedge_getOtherVert((perc>=0)?tempsv->up:tempsv->down, ev);
-			interp_v3_v3v3(ev->co, tempsv->origvert.co, tempev->co, fabs(perc));
-
-			if (uvlay_tot) {
-				for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
-					suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev );
-					if (suv && suv->fuv_list && suv->uv_up && suv->uv_down) {
-						interp_v2_v2v2(uv_tmp, suv->origuv,  (perc>=0)?suv->uv_up:suv->uv_down, fabs(perc));
-						fuv_link = suv->fuv_list;
-						while (fuv_link) {
-							copy_v2_v2(((float *)fuv_link->link), uv_tmp);
-							fuv_link = fuv_link->next;
-						}
-					}
-				}
-			}
+	TransDataSlideVert *svlist = sld->sv, *sv;
+	float vec[3];
+	int i;
 
-			look = look->next;
+	sld->perc = perc;
+
+	sv = svlist;
+	for (i=0; i<sld->totsv; i++, sv++) {
+		if (perc > 0.0f) {
+			copy_v3_v3(vec, sv->upvec);
+			mul_v3_fl(vec, perc);
+			add_v3_v3v3(sv->v->co, sv->origvert.co, vec);
 		}
-	}
-	else {
-		//Non prop code
-		look = vertlist;
-		while(look) {
-			float newlen, edgelen;
-			ev = look->link;
-			tempsv = BLI_ghash_lookup(vertgh,ev);
-			edgelen = len_v3v3(editedge_getOtherVert(tempsv->up,ev)->co,editedge_getOtherVert(tempsv->down,ev)->co);
-			newlen = (edgelen != 0.0f)? (len / edgelen): 0.0f;
-			if(newlen > 1.0f) {newlen = 1.0;}
-			if(newlen < 0.0f) {newlen = 0.0;}
-			if(flip == 0) {
-				interp_v3_v3v3(ev->co, editedge_getOtherVert(tempsv->down,ev)->co, editedge_getOtherVert(tempsv->up,ev)->co, fabs(newlen));
-				if (uvlay_tot) {
-					/* dont do anything if no UVs */
-					for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
-						suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev );
-						if (suv && suv->fuv_list && suv->uv_up && suv->uv_down) {
-							interp_v2_v2v2(uv_tmp, suv->uv_down, suv->uv_up, fabs(newlen));
-							fuv_link = suv->fuv_list;
-							while (fuv_link) {
-								copy_v2_v2(((float *)fuv_link->link), uv_tmp);
-								fuv_link = fuv_link->next;
-							}
-						}
-					}
-				}
-			} else{
-				interp_v3_v3v3(ev->co, editedge_getOtherVert(tempsv->up,ev)->co, editedge_getOtherVert(tempsv->down,ev)->co, fabs(newlen));
-
-				if (uvlay_tot) {
-					/* dont do anything if no UVs */
-					for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
-						suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev );
-						if (suv && suv->fuv_list && suv->uv_up && suv->uv_down) {
-							interp_v2_v2v2(uv_tmp, suv->uv_up, suv->uv_down, fabs(newlen));
-							fuv_link = suv->fuv_list;
-							while (fuv_link) {
-								copy_v2_v2(((float *)fuv_link->link), uv_tmp);
-								fuv_link = fuv_link->next;
-							}
-						}
-					}
-				}
-			}
-			look = look->next;
+		else {
+			copy_v3_v3(vec, sv->downvec);
+			mul_v3_fl(vec, -perc);
+			add_v3_v3v3(sv->v->co, sv->origvert.co, vec);
 		}
-
 	}
-
+	
+	projectSVData(t, 0);
+	
 	return 1;
 }
 
@@ -4992,6 +4985,8 @@ int EdgeSlide(TransInfo *t, const int UNUSED(mval[2]))
 
 	CLAMP(final, -1.0f, 1.0f);
 
+	t->values[0] = final;
+
 	/*do stuff here*/
 	if (t->customData)
 		doEdgeSlide(t, final);
@@ -5097,7 +5092,7 @@ int BakeTime(TransInfo *t, const int mval[2])
 
 	float fac = 0.1f;
 
-	if(t->mouse.precision) {
+	if (t->mouse.precision) {
 		/* calculate ratio for shiftkey pos, and for total, and blend these for precision */
 		time= (float)(t->center2d[0] - t->mouse.precision_mval[0]) * fac;
 		time+= 0.1f*((float)(t->center2d[0]*fac - mval[0]) -time);
@@ -5129,7 +5124,7 @@ int BakeTime(TransInfo *t, const int mval[2])
 			sprintf(str, "Time: %.3f %s", time, t->proptext);
 	}
 
-	for(i = 0 ; i < t->total; i++, td++) {
+	for (i = 0 ; i < t->total; i++, td++) {
 		if (td->flag & TD_NOACTION)
 			break;
 
@@ -5171,7 +5166,7 @@ int Mirror(TransInfo *t, const int UNUSED(mval[2]))
 	char str[200];
 
 	/*
-	 * OPTIMISATION:
+	 * OPTIMIZATION:
 	 * This still recalcs transformation on mouse move
 	 * while it should only recalc on constraint change
 	 * */
@@ -5188,7 +5183,7 @@ int Mirror(TransInfo *t, const int UNUSED(mval[2]))
 
 		sprintf(str, "Mirror%s", t->con.text);
 
-		for(i = 0, td=t->data; i < t->total; i++, td++) {
+		for (i = 0, td=t->data; i < t->total; i++, td++) {
 			if (td->flag & TD_NOACTION)
 				break;
 
@@ -5202,13 +5197,12 @@ int Mirror(TransInfo *t, const int UNUSED(mval[2]))
 
 		ED_area_headerprint(t->sa, str);
 	}
-	else
-	{
+	else {
 		size[0] = size[1] = size[2] = 1;
 
 		size_to_mat3( mat,size);
 
-		for(i = 0, td=t->data; i < t->total; i++, td++) {
+		for (i = 0, td=t->data; i < t->total; i++, td++) {
 			if (td->flag & TD_NOACTION)
 				break;
 
@@ -5220,7 +5214,7 @@ int Mirror(TransInfo *t, const int UNUSED(mval[2]))
 
 		recalcData(t);
 
-		if(t->flag & T_2D_EDIT)
+		if (t->flag & T_2D_EDIT)
 			ED_area_headerprint(t->sa, "Select a mirror axis (X, Y)");
 		else
 			ED_area_headerprint(t->sa, "Select a mirror axis (X, Y, Z)");
@@ -5249,7 +5243,7 @@ int Align(TransInfo *t, const int UNUSED(mval[2]))
 	/* saving original center */
 	copy_v3_v3(center, t->center);
 
-	for(i = 0 ; i < t->total; i++, td++)
+	for (i = 0 ; i < t->total; i++, td++)
 	{
 		float mat[3][3], invmat[3][3];
 
@@ -5264,7 +5258,7 @@ int Align(TransInfo *t, const int UNUSED(mval[2]))
 			copy_v3_v3(t->center, td->center);
 		}
 		else {
-			if(t->settings->selectmode & SCE_SELECT_FACE) {
+			if (t->settings->selectmode & SCE_SELECT_FACE) {
 				copy_v3_v3(t->center, td->center);
 			}
 		}
@@ -5324,7 +5318,7 @@ static void applySeqSlide(TransInfo *t, float val[2])
 	TransData *td = t->data;
 	int i;
 
-	for(i = 0 ; i < t->total; i++, td++) {
+	for (i = 0 ; i < t->total; i++, td++) {
 		float tvec[2];
 
 		if (td->flag & TD_NOACTION)
@@ -5460,7 +5454,7 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, TransData2D *td2d,
 #if 0   /* 'doTime' disabled for now */
 
 		const Scene *scene= t->scene;
-		const short doTime= 0; //getAnimEdit_DrawTime(t); // NOTE: this works, but may be confusing behaviour given the option's label, hence disabled
+		const short doTime= 0; //getAnimEdit_DrawTime(t); // NOTE: this works, but may be confusing behavior given the option's label, hence disabled
 		const double secf= FPS;
 #endif
 		double val;
@@ -5541,7 +5535,7 @@ void initTimeTranslate(TransInfo *t)
 	t->num.flag = 0;
 	t->num.idx_max = t->idx_max;
 
-	/* initialise snap like for everything else */
+	/* initialize snap like for everything else */
 	t->snap[0] = 0.0f;
 	t->snap[1] = t->snap[2] = 1.0f;
 
@@ -5679,7 +5673,8 @@ void initTimeSlide(TransInfo *t)
 
 		/* set flag for drawing stuff */
 		saction->flag |= SACTION_MOVING;
-	} else {
+	}
+	else {
 		t->state = TRANS_CANCEL;
 	}
 
@@ -5695,7 +5690,7 @@ void initTimeSlide(TransInfo *t)
 	t->num.flag = 0;
 	t->num.idx_max = t->idx_max;
 
-	/* initialise snap like for everything else */
+	/* initialize snap like for everything else */
 	t->snap[0] = 0.0f;
 	t->snap[1] = t->snap[2] = 1.0f;
 
@@ -5837,7 +5832,7 @@ void initTimeScale(TransInfo *t)
 	t->num.flag = 0;
 	t->num.idx_max = t->idx_max;
 
-	/* initialise snap like for everything else */
+	/* initialize snap like for everything else */
 	t->snap[0] = 0.0f;
 	t->snap[1] = t->snap[2] = 1.0f;
 
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index aab7dda..0bef331 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -30,15 +30,16 @@
  */
 
 
-#ifndef TRANSFORM_H
-#define TRANSFORM_H
+#ifndef __TRANSFORM_H__
+#define __TRANSFORM_H__
 
 #include "ED_transform.h"
 #include "ED_numinput.h"
 
 #include "DNA_listBase.h"
 
-#include "BLI_editVert.h"
+#include "BLI_smallhash.h"
+#include "BKE_tessmesh.h"
 
 /* ************************** Types ***************************** */
 
@@ -64,6 +65,7 @@ struct wmEvent;
 struct wmTimer;
 struct ARegion;
 struct ReportList;
+struct SmallHash;
 
 typedef struct TransSnapPoint {
 	struct TransSnapPoint *next,*prev;
@@ -101,36 +103,36 @@ typedef struct TransCon {
 	float imtx[3][3];    /* Inverse Matrix of the Constraint space                                    */
 	float pmtx[3][3];    /* Projection Constraint Matrix (same as imtx with some axis == 0)           */
 	float center[3];     /* transformation center to define where to draw the view widget
-							ALWAYS in global space. Unlike the transformation center                  */
+	                      * ALWAYS in global space. Unlike the transformation center                  */
 	int   imval[2];	     /* initial mouse value for visual calculation                                */
-						 /* the one in TransInfo is not garanty to stay the same (Rotates change it)  */
+	                     /* the one in TransInfo is not garanty to stay the same (Rotates change it)  */
 	int   mode;          /* Mode flags of the Constraint                                              */
 	void  (*drawExtra)(struct TransInfo *);
-						 /* For constraints that needs to draw differently from the other
-							uses this instead of the generic draw function							  */
+	                     /* For constraints that needs to draw differently from the other
+	                      * uses this instead of the generic draw function                            */
 	void  (*applyVec)(struct TransInfo *, struct TransData *, float *, float *, float *);
-						 /* Apply function pointer for linear vectorial transformation                */
-						 /* The last three parameters are pointers to the in/out/printable vectors    */
+	                     /* Apply function pointer for linear vectorial transformation                */
+	                     /* The last three parameters are pointers to the in/out/printable vectors    */
 	void  (*applySize)(struct TransInfo *, struct TransData *, float [3][3]);
-						 /* Apply function pointer for size transformation */
+	                     /* Apply function pointer for size transformation */
 	void  (*applyRot)(struct TransInfo *, struct TransData *, float [3], float *);
-						 /* Apply function pointer for rotation transformation */
+	                     /* Apply function pointer for rotation transformation */
 } TransCon;
 
 typedef struct TransDataExtension {
 	float drot[3];		 /* Initial object drot */
-	// float drotAngle;	 /* Initial object drotAngle,    TODO: not yet implimented */
-	// float drotAxis[3];	 /* Initial object drotAxis, TODO: not yet implimented */
+	// float drotAngle;	 /* Initial object drotAngle,    TODO: not yet implemented */
+	// float drotAxis[3];	 /* Initial object drotAxis, TODO: not yet implemented */
 	float dquat[4];		 /* Initial object dquat */
 	float dscale[3];     /* Initial object dscale */
 	float *rot;          /* Rotation of the data to transform (Faculative)                                 */
 	float  irot[3];      /* Initial rotation                                                               */
 	float *quat;         /* Rotation quaternion of the data to transform (Faculative)                      */
 	float  iquat[4];	 /* Initial rotation quaternion                                                    */
-	float *rotAngle;	 /* Rotation angle of the data to transform (Faculative) 						 */
-	float  irotAngle;	 /* Initial rotation angle 												 */
-	float *rotAxis;		 /* Rotation axis of the data to transform (Faculative) 						 */
-	float  irotAxis[4];	 /* Initial rotation axis 													 */
+	float *rotAngle;	 /* Rotation angle of the data to transform (Faculative)                           */
+	float  irotAngle;	 /* Initial rotation angle                                                         */
+	float *rotAxis;		 /* Rotation axis of the data to transform (Faculative)                            */
+	float  irotAxis[4];	 /* Initial rotation axis                                                          */
 	float *size;         /* Size of the data to transform (Faculative)                                     */
 	float  isize[3];	 /* Initial size                                                                   */
 	float  obmat[4][4];	 /* Object matrix */
@@ -146,7 +148,7 @@ typedef struct TransData2D {
 	float ih1[2], ih2[2];
 } TransData2D;
 
-/* we need to store 2 handles for each transdata incase the other handle wasnt selected */
+/* we need to store 2 handles for each transdata in case the other handle wasnt selected */
 typedef struct TransDataCurveHandleFlags {
 	char ih1, ih2;
 	char *h1, *h2;
@@ -179,28 +181,30 @@ typedef struct TransDataNla {
 } TransDataNla;
 
 struct LinkNode;
-struct EditEdge;
-struct EditVert;
 struct GHash;
-typedef struct TransDataSlideUv {
-	float origuv[2];
-	float *uv_up, *uv_down;
-	//float *fuv[4];
-	struct LinkNode *fuv_list;
-} TransDataSlideUv;
 
 typedef struct TransDataSlideVert {
-	struct EditEdge *up, *down;
-	struct EditVert origvert;
+	struct BMVert vup, vdown;
+	struct BMVert origvert;
+
+	struct BMVert *up, *down;
+	struct BMVert *v;
+
+	float upvec[3], downvec[3];
 } TransDataSlideVert;
 
 typedef struct SlideData {
-	TransDataSlideUv *slideuv, *suv_last;
-	int totuv, uvlay_tot;
-	struct GHash *vhash, **uvhash;
-	struct EditVert *nearest;
-	struct LinkNode *edgelist, *vertlist;
+	TransDataSlideVert *sv;
+	int totsv;
+	
+	struct SmallHash vhash;
+	struct SmallHash origfaces;
+
 	int start[2], end[2];
+	struct BMEditMesh *em;
+	float perc;
+	/* flag that is set when origfaces is initialized */
+	int origfaces_init;
 } SlideData;
 
 typedef struct TransData {
@@ -219,8 +223,8 @@ typedef struct TransData {
 	struct bConstraint *con;	/* for objects/bones, the first constraint in its constraint stack */
 	TransDataExtension *ext;	/* for objects, poses. 1 single malloc per TransInfo! */
 	TransDataCurveHandleFlags *hdata; /* for curves, stores handle flags for modification/cancel */
-	void  *extra;		 /* extra data (mirrored element pointer, in editmode mesh to EditVert) (editbone for roll fixing) (...) */
-	int  flag;         /* Various flags */
+	void  *extra;		 /* extra data (mirrored element pointer, in editmode mesh to BMVert) (editbone for roll fixing) (...) */
+	int  flag;           /* Various flags */
 	short  protectflag;	 /* If set, copy of Object or PoseChannel protection */
 } TransData;
 
@@ -440,9 +444,9 @@ void transformApply(struct bContext *C, TransInfo *t);
 int  transformEnd(struct bContext *C, TransInfo *t);
 
 void setTransformViewMatrices(TransInfo *t);
-void convertViewVec(TransInfo *t, float *vec, int dx, int dy);
-void projectIntView(TransInfo *t, float *vec, int *adr);
-void projectFloatView(TransInfo *t, float *vec, float *adr);
+void convertViewVec(TransInfo *t, float r_vec[3], int dx, int dy);
+void projectIntView(TransInfo *t, const float vec[3], int adr[2]);
+void projectFloatView(TransInfo *t, const float vec[3], float adr[2]);
 
 void applyAspectRatio(TransInfo *t, float *vec);
 void removeAspectRatio(TransInfo *t, float *vec);
@@ -550,7 +554,6 @@ int calc_manipulator_stats(const struct bContext *C);
 /*********************** TransData Creation and General Handling *********** */
 void createTransData(struct bContext *C, TransInfo *t);
 void sort_trans_data_dist(TransInfo *t);
-void add_tdi_poin(float *poin, float *old, float delta);
 void special_aftertrans_update(struct bContext *C, TransInfo *t);
 
 void transform_autoik_update(TransInfo *t, short mode);
@@ -645,14 +648,11 @@ void resetTransRestrictions(TransInfo *t);
 
 void drawLine(TransInfo *t, float *center, float *dir, char axis, short options);
 
-TransDataCurveHandleFlags *initTransDataCurveHandes(TransData *td, struct BezTriple *bezt);
-
 /* DRAWLINE options flags */
 #define DRAWLIGHT	1
 
 void applyTransObjects(TransInfo *t);
 void restoreTransObjects(TransInfo *t);
-void restoreTransNodes(TransInfo *t);
 void recalcData(TransInfo *t);
 
 void calculateCenter(TransInfo *t);
@@ -679,7 +679,6 @@ int createSpaceNormal(float mat[3][3], float normal[3]);
 int createSpaceNormalTangent(float mat[3][3], float normal[3], float tangent[3]);
 
 struct TransformOrientation *addMatrixSpace(struct bContext *C, float mat[3][3], char name[], int overwrite);
-int addObjectSpace(struct bContext *C, struct Object *ob);
 void applyTransformOrientation(const struct bContext *C, float mat[3][3], char *name);
 
 #define ORIENTATION_NONE	0
@@ -690,6 +689,8 @@ void applyTransformOrientation(const struct bContext *C, float mat[3][3], char *
 
 int getTransformOrientation(const struct bContext *C, float normal[3], float plane[3], int activeOnly);
 
+void freeSlideTempFaces(SlideData *sld);
 void freeSlideVerts(TransInfo *t);
+void projectSVData(TransInfo *t, int final);
 
 #endif
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index bd34477..18e9c1a 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -80,16 +80,13 @@ static void constraintAutoValues(TransInfo *t, float vec[3])
 	{
 		float nval = (t->flag & T_NULL_ONE)?1.0f:0.0f;
 
-		if ((mode & CON_AXIS0) == 0)
-		{
+		if ((mode & CON_AXIS0) == 0) {
 			vec[0] = nval;
 		}
-		if ((mode & CON_AXIS1) == 0)
-		{
+		if ((mode & CON_AXIS1) == 0) {
 			vec[1] = nval;
 		}
-		if ((mode & CON_AXIS2) == 0)
-		{
+		if ((mode & CON_AXIS2) == 0) {
 			vec[2] = nval;
 		}
 	}
@@ -165,8 +162,7 @@ static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3])
 	}
 
 	/* autovalues is operator param, use that directly but not if snapping is forced */
-	if (t->flag & T_AUTOVALUES && (t->tsnap.status & SNAP_FORCED) == 0)
-	{
+	if (t->flag & T_AUTOVALUES && (t->tsnap.status & SNAP_FORCED) == 0) {
 		mul_v3_m3v3(vec, t->con.imtx, t->auto_values);
 		constraintAutoValues(t, vec);
 		/* inverse transformation at the end */
@@ -187,21 +183,21 @@ static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3])
 
 static void viewAxisCorrectCenter(TransInfo *t, float t_con_center[3])
 {
-	if(t->spacetype == SPACE_VIEW3D) {
+	if (t->spacetype == SPACE_VIEW3D) {
 		// View3D *v3d = t->sa->spacedata.first;
 		const float min_dist= 1.0f; // v3d->near;
 		float dir[3];
 		float l;
 
 		sub_v3_v3v3(dir, t_con_center, t->viewinv[3]);
-		if(dot_v3v3(dir, t->viewinv[2]) < 0.0f) {
+		if (dot_v3v3(dir, t->viewinv[2]) < 0.0f) {
 			negate_v3(dir);
 		}
 		project_v3_v3v3(dir, dir, t->viewinv[2]);
 
 		l= len_v3(dir);
 
-		if(l < min_dist) {
+		if (l < min_dist) {
 			float diff[3];
 			normalize_v3_v3(diff, t->viewinv[2]);
 			mul_v3_fl(diff, min_dist - l);
@@ -216,7 +212,7 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3
 	float norm[3], vec[3], factor, angle;
 	float t_con_center[3];
 
-	if(in[0]==0.0f && in[1]==0.0f && in[2]==0.0f)
+	if (in[0]==0.0f && in[1]==0.0f && in[2]==0.0f)
 		return;
 
 	copy_v3_v3(t_con_center, t->con.center);
@@ -231,13 +227,13 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3
 	angle = RAD2DEGF(angle);
 
 	/* For when view is parallel to constraint... will cause NaNs otherwise
-	   So we take vertical motion in 3D space and apply it to the
-	   constraint axis. Nice for camera grab + MMB */
-	if(angle < 5.0f) {
+	 * So we take vertical motion in 3D space and apply it to the
+	 * constraint axis. Nice for camera grab + MMB */
+	if (angle < 5.0f) {
 		project_v3_v3v3(vec, in, t->viewinv[1]);
 		factor = dot_v3v3(t->viewinv[1], vec) * 2.0f;
 		/* since camera distance is quite relative, use quadratic relationship. holding shift can compensate */
-		if(factor<0.0f) factor*= -factor;
+		if (factor<0.0f) factor*= -factor;
 		else factor*= factor;
 
 		copy_v3_v3(out, axis);
@@ -265,10 +261,12 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3
 			copy_v3_v3(out, axis);
 			if (factor > 0) {
 				mul_v3_fl(out, 1000000000.0f);
-			} else {
+			}
+			else {
 				mul_v3_fl(out, -1000000000.0f);
 			}
-		} else {
+		}
+		else {
 			add_v3_v3v3(v2, t_con_center, axis);
 			add_v3_v3v3(v4, v, norm);
 			
@@ -280,9 +278,9 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3
 
 			/* possible some values become nan when
 			 * viewpoint and object are both zero */
-			if(!finite(out[0])) out[0]= 0.0f;
-			if(!finite(out[1])) out[1]= 0.0f;
-			if(!finite(out[2])) out[2]= 0.0f;
+			if (!finite(out[0])) out[0]= 0.0f;
+			if (!finite(out[1])) out[1]= 0.0f;
+			if (!finite(out[2])) out[2]= 0.0f;
 		}
 	}
 }
@@ -597,11 +595,11 @@ void setLocalConstraint(TransInfo *t, int mode, const char text[])
 }
 
 /*
-	Set the constraint according to the user defined orientation
-
-	ftext is a format string passed to BLI_snprintf. It will add the name of
-	the orientation where %s is (logically).
-*/
+ * Set the constraint according to the user defined orientation
+ *
+ * ftext is a format string passed to BLI_snprintf. It will add the name of
+ * the orientation where %s is (logically).
+ */
 void setUserConstraint(TransInfo *t, short orientation, int mode, const char ftext[])
 {
 	char text[40];
@@ -658,7 +656,7 @@ void drawConstraint(TransInfo *t)
 
 	/* nasty exception for Z constraint in camera view */
 	// TRANSFORM_FIX_ME
-//	if((t->flag & T_OBJECT) && G.vd->camera==OBACT && G.vd->persp==V3D_CAMOB)
+//	if ((t->flag & T_OBJECT) && G.vd->camera==OBACT && G.vd->persp==V3D_CAMOB)
 //		return;
 
 	if (tc->drawExtra) {
@@ -680,7 +678,7 @@ void drawConstraint(TransInfo *t)
 			glColor3ubv((GLubyte *)col2);
 
 			depth_test_enabled = glIsEnabled(GL_DEPTH_TEST);
-			if(depth_test_enabled)
+			if (depth_test_enabled)
 				glDisable(GL_DEPTH_TEST);
 
 			setlinestyle(1);
@@ -690,7 +688,7 @@ void drawConstraint(TransInfo *t)
 			glEnd();
 			setlinestyle(0);
 
-			if(depth_test_enabled)
+			if (depth_test_enabled)
 				glEnable(GL_DEPTH_TEST);
 		}
 
@@ -716,13 +714,11 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
 
 		UI_ThemeColor(TH_GRID);
 
-		if(t->spacetype == SPACE_VIEW3D && rv3d != NULL)
-		{
+		if (t->spacetype == SPACE_VIEW3D && rv3d != NULL) {
 			copy_m4_m4(tmat, rv3d->viewmat);
 			invert_m4_m4(imat, tmat);
 		}
-		else
-		{
+		else {
 			unit_m4(tmat);
 			unit_m4(imat);
 		}
@@ -731,12 +727,10 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
 
 		copy_v3_v3(center, t->center);
 
-		if((t->spacetype == SPACE_VIEW3D) && t->obedit)
-		{
+		if ((t->spacetype == SPACE_VIEW3D) && t->obedit) {
 			mul_m4_v3(t->obedit->obmat, center); /* because t->center is in local space */
 		}
-		else if(t->spacetype == SPACE_IMAGE)
-		{
+		else if (t->spacetype == SPACE_IMAGE) {
 			float aspx, aspy;
 
 			ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
@@ -757,10 +751,10 @@ static void drawObjectConstraint(TransInfo *t)
 	TransData * td = t->data;
 
 	/* Draw the first one lighter because that's the one who controls the others.
-	   Meaning the transformation is projected on that one and just copied on the others
-	   constraint space.
-	   In a nutshell, the object with light axis is controlled by the user and the others follow.
-	   Without drawing the first light, users have little clue what they are doing.
+	 * Meaning the transformation is projected on that one and just copied on the others
+	 * constraint space.
+	 * In a nutshell, the object with light axis is controlled by the user and the others follow.
+	 * Without drawing the first light, users have little clue what they are doing.
 	 */
 	if (t->con.mode & CON_AXIS0) {
 		drawLine(t, td->ob->obmat[3], td->axismtx[0], 'X', DRAWLIGHT);
@@ -774,7 +768,7 @@ static void drawObjectConstraint(TransInfo *t)
 
 	td++;
 
-	for(i=1;i<t->total;i++,td++) {
+	for (i=1;i<t->total;i++,td++) {
 		if (t->con.mode & CON_AXIS0) {
 			drawLine(t, td->ob->obmat[3], td->axismtx[0], 'X', 0);
 		}
@@ -896,12 +890,12 @@ static void setNearestAxis3d(TransInfo *t)
 	mvec[2] = 0.0f;
 
 	/* we need to correct axis length for the current zoomlevel of view,
-	   this to prevent projected values to be clipped behind the camera
-	   and to overflow the short integers.
-	   The formula used is a bit stupid, just a simplification of the substraction
-	   of two 2D points 30 pixels apart (that's the last factor in the formula) after
-	   projecting them with window_to_3d_delta and then get the length of that vector.
-	*/
+	 * this to prevent projected values to be clipped behind the camera
+	 * and to overflow the short integers.
+	 * The formula used is a bit stupid, just a simplification of the subtraction
+	 * of two 2D points 30 pixels apart (that's the last factor in the formula) after
+	 * projecting them with window_to_3d_delta and then get the length of that vector.
+	 */
 	zfac= t->persmat[0][3]*t->center[0]+ t->persmat[1][3]*t->center[1]+ t->persmat[2][3]*t->center[2]+ t->persmat[3][3];
 	zfac = len_v3(t->persinv[0]) * 2.0f/t->ar->winx * zfac * 30.0f;
 
@@ -1041,10 +1035,10 @@ int getConstraintSpaceDimension(TransInfo *t)
 
 	return n;
 /*
-  Someone willing to do it criptically could do the following instead:
-
-  return t->con & (CON_AXIS0|CON_AXIS1|CON_AXIS2);
-
-  Based on the assumptions that the axis flags are one after the other and start at 1
-*/
+ * Someone willing to do it cryptically could do the following instead:
+ *
+ * return t->con & (CON_AXIS0|CON_AXIS1|CON_AXIS2);
+ *
+ * Based on the assumptions that the axis flags are one after the other and start at 1
+ */
 }
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index fe244fb..062f88f 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -41,6 +41,7 @@
 #include "DNA_anim_types.h"
 #include "DNA_armature_types.h"
 #include "DNA_lattice_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_meta_types.h"
 #include "DNA_node_types.h"
 #include "DNA_screen_types.h"
@@ -55,29 +56,37 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "BLI_math.h"
+#include "BLI_blenlib.h"
+#include "BLI_array.h"
+#include "BLI_utildefines.h"
+#include "BLI_smallhash.h"
+
+#include "BKE_DerivedMesh.h"
 #include "BKE_action.h"
 #include "BKE_armature.h"
+#include "BKE_bmesh.h"
+#include "BKE_constraint.h"
 #include "BKE_context.h"
 #include "BKE_curve.h"
-#include "BKE_constraint.h"
 #include "BKE_depsgraph.h"
 #include "BKE_fcurve.h"
-#include "BKE_gpencil.h"
 #include "BKE_global.h"
+#include "BKE_gpencil.h"
 #include "BKE_key.h"
 #include "BKE_main.h"
 #include "BKE_modifier.h"
+#include "BKE_movieclip.h"
 #include "BKE_nla.h"
+#include "BKE_node.h"
 #include "BKE_object.h"
 #include "BKE_particle.h"
-#include "BKE_sequencer.h"
 #include "BKE_pointcache.h"
-#include "BKE_bmesh.h"
-#include "BKE_scene.h"
 #include "BKE_report.h"
+#include "BKE_scene.h"
+#include "BKE_sequencer.h"
+#include "BKE_tessmesh.h"
 #include "BKE_tracking.h"
-#include "BKE_movieclip.h"
-#include "BKE_node.h"
 
 
 #include "ED_anim_api.h"
@@ -100,16 +109,10 @@
 
 #include "UI_view2d.h"
 
-#include "BLI_math.h"
-#include "BLI_blenlib.h"
-#include "BLI_editVert.h"
-#include "BLI_utildefines.h"
-
 #include "RNA_access.h"
 
-extern ListBase editelems;
-
 #include "transform.h"
+#include "bmesh.h"
 
 #include "BLO_sys_types.h" // for intptr_t support
 
@@ -172,7 +175,7 @@ void sort_trans_data_dist(TransInfo *t)
 	TransData *start = t->data;
 	int i = 1;
 
-	while(i < t->total && start->flag & TD_SELECTED) {
+	while (i < t->total && start->flag & TD_SELECTED) {
 		start++;
 		i++;
 	}
@@ -208,17 +211,17 @@ static void sort_trans_data(TransInfo *t)
 }
 
 /* distance calculated from not-selected vertex to nearest selected vertex
-   warning; this is loops inside loop, has minor N^2 issues, but by sorting list it is OK */
+ * warning; this is loops inside loop, has minor N^2 issues, but by sorting list it is OK */
 static void set_prop_dist(TransInfo *t, short with_dist)
 {
 	TransData *tob;
 	int a;
 
-	for(a=0, tob= t->data; a<t->total; a++, tob++) {
+	for (a=0, tob= t->data; a<t->total; a++, tob++) {
 
 		tob->rdist= 0.0f; // init, it was mallocced
 
-		if((tob->flag & TD_SELECTED)==0) {
+		if ((tob->flag & TD_SELECTED)==0) {
 			TransData *td;
 			int i;
 			float dist, vec[3];
@@ -226,7 +229,7 @@ static void set_prop_dist(TransInfo *t, short with_dist)
 			tob->rdist = -1.0f; // signal for next loop
 
 			for (i = 0, td= t->data; i < t->total; i++, td++) {
-				if(td->flag & TD_SELECTED) {
+				if (td->flag & TD_SELECTED) {
 					sub_v3_v3v3(vec, tob->center, td->center);
 					mul_m3_v3(tob->mtx, vec);
 					dist = normalize_v3(vec);
@@ -266,7 +269,7 @@ static void createTransTexspace(TransInfo *t)
 	}
 
 	id = ob->data;
-	if(id == NULL || !ELEM3( GS(id->name), ID_ME, ID_CU, ID_MB )) {
+	if (id == NULL || !ELEM3( GS(id->name), ID_ME, ID_CU, ID_MB )) {
 		t->total = 0;
 		return;
 	}
@@ -286,7 +289,7 @@ static void createTransTexspace(TransInfo *t)
 
 	if (give_obdata_texspace(ob, &texflag, &td->loc, &td->ext->size, &td->ext->rot)) {
 		ob->dtx |= OB_TEXSPACE;
-		*texflag &= ~AUTOSPACE;
+		*texflag &= ~ME_AUTOSPACE;
 	}
 
 	copy_v3_v3(td->iloc, td->loc);
@@ -298,16 +301,17 @@ static void createTransTexspace(TransInfo *t)
 
 static void createTransEdge(TransInfo *t)
 {
-	EditMesh *em = ((Mesh *)t->obedit->data)->edit_mesh;
+	BMEditMesh *em = BMEdit_FromObject(t->obedit);
 	TransData *td = NULL;
-	EditEdge *eed;
+	BMEdge *eed;
+	BMIter iter;
 	float mtx[3][3], smtx[3][3];
 	int count=0, countsel=0;
 	int propmode = t->flag & T_PROP_EDIT;
 
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		if(eed->h==0) {
-			if (eed->f & SELECT) countsel++;
+	BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
+		if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
+			if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) countsel++;
 			if (propmode) count++;
 		}
 	}
@@ -315,7 +319,7 @@ static void createTransEdge(TransInfo *t)
 	if (countsel == 0)
 		return;
 
-	if(propmode) {
+	if (propmode) {
 		t->total = count;
 	}
 	else {
@@ -327,14 +331,17 @@ static void createTransEdge(TransInfo *t)
 	copy_m3_m4(mtx, t->obedit->obmat);
 	invert_m3_m3(smtx, mtx);
 
-	for(eed= em->edges.first; eed; eed= eed->next) {
-		if(eed->h==0 && (eed->f & SELECT || propmode)) {
+	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);
+			
 			/* 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);
 
 			td->loc= NULL;
-			if (eed->f & SELECT)
+			if (BM_elem_flag_test(eed, BM_ELEM_SELECT))
 				td->flag= TD_SELECTED;
 			else
 				td->flag= 0;
@@ -345,12 +352,12 @@ static void createTransEdge(TransInfo *t)
 
 			td->ext = NULL;
 			if (t->mode == TFM_BWEIGHT) {
-				td->val = &(eed->bweight);
-				td->ival = eed->bweight;
+				td->val = bweight;
+				td->ival = bweight ? *bweight : 1.0f;
 			}
 			else {
-				td->val = &(eed->crease);
-				td->ival = eed->crease;
+				td->val = crease;
+				td->ival = crease ? *crease : 0.0f;
 			}
 
 			td++;
@@ -364,13 +371,13 @@ static bKinematicConstraint *has_targetless_ik(bPoseChannel *pchan)
 {
 	bConstraint *con= pchan->constraints.first;
 
-	for(;con; con= con->next) {
-		if(con->type==CONSTRAINT_TYPE_KINEMATIC && (con->enforce!=0.0f)) {
+	for (;con; con= con->next) {
+		if (con->type==CONSTRAINT_TYPE_KINEMATIC && (con->enforce!=0.0f)) {
 			bKinematicConstraint *data= con->data;
 
-			if(data->tar==NULL)
+			if (data->tar==NULL)
 				return data;
-			if(data->tar->type==OB_ARMATURE && data->subtarget[0]==0)
+			if (data->tar->type==OB_ARMATURE && data->subtarget[0]==0)
 				return data;
 		}
 	}
@@ -384,32 +391,32 @@ static short apply_targetless_ik(Object *ob)
 	int segcount, apply= 0;
 
 	/* now we got a difficult situation... we have to find the
-	   target-less IK pchans, and apply transformation to the all
-	   pchans that were in the chain */
+	 * target-less IK pchans, and apply transformation to the all
+	 * pchans that were in the chain */
 
 	for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) {
 		data= has_targetless_ik(pchan);
-		if(data && (data->flag & CONSTRAINT_IK_AUTO)) {
+		if (data && (data->flag & CONSTRAINT_IK_AUTO)) {
 
 			/* fill the array with the bones of the chain (armature.c does same, keep it synced) */
 			segcount= 0;
 
 			/* exclude tip from chain? */
-			if(!(data->flag & CONSTRAINT_IK_TIP))
+			if (!(data->flag & CONSTRAINT_IK_TIP))
 				parchan= pchan->parent;
 			else
 				parchan= pchan;
 
 			/* Find the chain's root & count the segments needed */
-			for (; parchan; parchan=parchan->parent){
+			for (; parchan; parchan=parchan->parent) {
 				chanlist[segcount]= parchan;
 				segcount++;
 
-				if(segcount==data->rootbone || segcount>255) break; // 255 is weak
+				if (segcount==data->rootbone || segcount>255) break; // 255 is weak
 			}
-			for(;segcount;segcount--) {
+			for (;segcount;segcount--) {
 				Bone *bone;
-				float rmat[4][4], tmat[4][4], imat[4][4];
+				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) */
@@ -420,7 +427,9 @@ static short apply_targetless_ik(Object *ob)
 				bone= parchan->bone;
 				bone->flag |= BONE_TRANSFORM;	/* ensures it gets an auto key inserted */
 
-				if(parchan->parent) {
+	/* XXX Old code. Will remove it later. */
+#if 0
+				if (parchan->parent) {
 					Bone *parbone= parchan->parent->bone;
 					float offs_bone[4][4];
 
@@ -434,7 +443,7 @@ static short apply_targetless_ik(Object *ob)
 					offs_bone[3][1]+= parbone->length;
 
 					/* pose_mat(b-1) * offs_bone */
-					if(parchan->bone->flag & BONE_HINGE) {
+					if (parchan->bone->flag & BONE_HINGE) {
 						/* the rotation of the parent restposition */
 						copy_m4_m4(rmat, parbone->arm_mat);	/* rmat used as temp */
 
@@ -445,7 +454,7 @@ static short apply_targetless_ik(Object *ob)
 
 						mult_m4_m4m4(tmat, rmat, offs_bone);
 					}
-					else if(parchan->bone->flag & BONE_NO_SCALE) {
+					else if (parchan->bone->flag & BONE_NO_SCALE) {
 						mult_m4_m4m4(tmat, parchan->parent->pose_mat, offs_bone);
 						normalize_m4(tmat);
 					}
@@ -462,6 +471,8 @@ static short apply_targetless_ik(Object *ob)
 				}
 				/* result matrix */
 				mult_m4_m4m4(rmat, imat, parchan->pose_mat);
+#endif
+				armature_mat_pose_to_bone(parchan, parchan->pose_mat, rmat);
 
 				/* apply and decompose, doesn't work for constraints or non-uniform scale well */
 				{
@@ -601,9 +612,9 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
 		copy_m3_m3(bmat, pchan->bone->bone_mat);
 
 	if (pchan->parent) {
-		if(pchan->bone->flag & BONE_HINGE) {
+		if (pchan->bone->flag & BONE_HINGE) {
 			copy_m3_m4(pmat, pchan->parent->bone->arm_mat);
-			if(!(pchan->bone->flag & BONE_NO_SCALE)) {
+			if (!(pchan->bone->flag & BONE_NO_SCALE)) {
 				float tsize[3], tsmat[3][3];
 				mat4_to_size(tsize, pchan->parent->pose_mat);
 				size_to_mat3(tsmat, tsize);
@@ -612,7 +623,7 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
 		}
 		else {
 			copy_m3_m4(pmat, pchan->parent->pose_mat);
-			if(pchan->bone->flag & BONE_NO_SCALE)
+			if (pchan->bone->flag & BONE_NO_SCALE)
 				normalize_m3(pmat);
 		}
 
@@ -640,7 +651,7 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
 	/* exceptional case: rotate the pose bone which also applies transformation
 	 * when a parentless bone has BONE_NO_LOCAL_LOCATION [] */
 	if (!ELEM(t->mode, TFM_TRANSLATION, TFM_RESIZE) && (pchan->bone->flag & BONE_NO_LOCAL_LOCATION)) {
-		if(pchan->parent) {
+		if (pchan->parent) {
 			/* same as td->smtx but without pchan->bone->bone_mat */
 			td->flag |= TD_PBONE_LOCAL_MTX_C;
 			mul_m3_m3m3(td->ext->l_smtx, pchan->bone->bone_mat, td->smtx);
@@ -658,7 +669,7 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
 	if (t->mode==TFM_BONESIZE) {
 		bArmature *arm= t->poseobj->data;
 
-		if(arm->drawtype==ARM_ENVELOPE) {
+		if (arm->drawtype==ARM_ENVELOPE) {
 			td->loc= NULL;
 			td->val= &bone->dist;
 			td->ival= bone->dist;
@@ -674,8 +685,8 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
 	/* in this case we can do target-less IK grabbing */
 	if (t->mode==TFM_TRANSLATION) {
 		bKinematicConstraint *data= has_targetless_ik(pchan);
-		if(data) {
-			if(data->flag & CONSTRAINT_IK_TIP) {
+		if (data) {
+			if (data->flag & CONSTRAINT_IK_TIP) {
 				copy_v3_v3(data->grabtarget, pchan->pose_tail);
 			}
 			else {
@@ -699,17 +710,18 @@ static void bone_children_clear_transflag(int mode, short around, ListBase *lb)
 {
 	Bone *bone= lb->first;
 
-	for(;bone;bone= bone->next) {
-		if((bone->flag & BONE_HINGE) && (bone->flag & BONE_CONNECTED))
+	for (;bone;bone= bone->next) {
+		if ((bone->flag & BONE_HINGE) && (bone->flag & BONE_CONNECTED))
 		{
 			bone->flag |= BONE_HINGE_CHILD_TRANSFORM;
 		}
-		else if (bone->flag & BONE_TRANSFORM && (mode == TFM_ROTATION || mode == TFM_TRACKBALL) && around == V3D_LOCAL)
+		else if ((bone->flag & BONE_TRANSFORM) &&
+		         (mode == TFM_ROTATION || mode == TFM_TRACKBALL) &&
+		         (around == V3D_LOCAL))
 		{
 			bone->flag |= BONE_TRANSFORM_CHILD;
 		}
-		else
-		{
+		else {
 			bone->flag &= ~BONE_TRANSFORM;
 		}
 
@@ -745,28 +757,28 @@ int count_set_pose_transflags(int *out_mode, short around, Object *ob)
 
 	/* make sure no bone can be transformed when a parent is transformed */
 	/* since pchans are depsgraph sorted, the parents are in beginning of list */
-	if(mode != TFM_BONESIZE) {
-		for(pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+	if (mode != TFM_BONESIZE) {
+		for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
 			bone = pchan->bone;
-			if(bone->flag & BONE_TRANSFORM)
+			if (bone->flag & BONE_TRANSFORM)
 				bone_children_clear_transflag(mode, around, &bone->childbase);
 		}
 	}
 	/* now count, and check if we have autoIK or have to switch from translate to rotate */
 	hastranslation = 0;
 
-	for(pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+	for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
 		bone = pchan->bone;
-		if(bone->flag & BONE_TRANSFORM) {
+		if (bone->flag & BONE_TRANSFORM) {
 			total++;
 			
-			if(mode == TFM_TRANSLATION) {
-				if( has_targetless_ik(pchan)==NULL ) {
-					if(pchan->parent && (pchan->bone->flag & BONE_CONNECTED)) {
-						if(pchan->bone->flag & BONE_HINGE_CHILD_TRANSFORM)
+			if (mode == TFM_TRANSLATION) {
+				if ( has_targetless_ik(pchan)==NULL ) {
+					if (pchan->parent && (pchan->bone->flag & BONE_CONNECTED)) {
+						if (pchan->bone->flag & BONE_HINGE_CHILD_TRANSFORM)
 							hastranslation = 1;
 					}
-					else if((pchan->protectflag & OB_LOCK_LOC)!=OB_LOCK_LOC)
+					else if ((pchan->protectflag & OB_LOCK_LOC)!=OB_LOCK_LOC)
 						hastranslation = 1;
 				}
 				else
@@ -776,7 +788,7 @@ int count_set_pose_transflags(int *out_mode, short around, Object *ob)
 	}
 
 	/* if there are no translatable bones, do rotation */
-	if(mode == TFM_TRANSLATION && !hastranslation)
+	if (mode == TFM_TRANSLATION && !hastranslation)
 	{
 		*out_mode = TFM_ROTATION;
 	}
@@ -864,7 +876,7 @@ static void pose_grab_with_ik_clear(Object *ob)
 					continue;
 				}
 				pchan->constflag |= PCHAN_HAS_IK;
-				if(data->tar==NULL || (data->tar->type==OB_ARMATURE && data->subtarget[0]==0))
+				if (data->tar==NULL || (data->tar->type==OB_ARMATURE && data->subtarget[0]==0))
 					pchan->constflag |= PCHAN_HAS_TARGET;
 			}
 		}
@@ -1055,7 +1067,7 @@ static void createTransPose(TransInfo *t, Object *ob)
 	/* set flags and count total (warning, can change transform to rotate) */
 	t->total = count_set_pose_transflags(&t->mode, t->around, ob);
 
-	if(t->total == 0) return;
+	if (t->total == 0) return;
 
 	t->flag |= T_POSE;
 	t->poseobj= ob;	/* we also allow non-active objects to be transformed, in weightpaint */
@@ -1063,7 +1075,7 @@ static void createTransPose(TransInfo *t, Object *ob)
 	/* init trans data */
 	td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransPoseBone");
 	tdx = t->ext = MEM_callocN(t->total*sizeof(TransDataExtension), "TransPoseBoneExt");
-	for(i=0; i<t->total; i++, td++, tdx++) {
+	for (i=0; i<t->total; i++, td++, tdx++) {
 		td->ext= tdx;
 		td->val = NULL;
 	}
@@ -1077,12 +1089,12 @@ static void createTransPose(TransInfo *t, Object *ob)
 		}
 	}
 
-	if(td != (t->data+t->total)) {
+	if (td != (t->data+t->total)) {
 		// XXX use transform operator reports
 		// BKE_report(op->reports, RPT_DEBUG, "Bone selection count error");
 	}
 
-	/* initialise initial auto=ik chainlen's? */
+	/* initialize initial auto=ik chainlen's? */
 	if (ik_on) transform_autoik_update(t, 0);
 }
 
@@ -1114,13 +1126,11 @@ static void createTransArmatureVerts(TransInfo *t)
 				if (ebo->flag & BONE_SELECTED)
 					t->total++;
 			}
-			else if (t->mode==TFM_BONE_ROLL)
-			{
+			else if (t->mode==TFM_BONE_ROLL) {
 				if (ebo->flag & BONE_SELECTED)
 					t->total++;
 			}
-			else
-			{
+			else {
 				if (ebo->flag & BONE_TIPSEL)
 					t->total++;
 				if (ebo->flag & BONE_ROOTSEL)
@@ -1179,17 +1189,15 @@ static void createTransArmatureVerts(TransInfo *t)
 				}
 
 			}
-			else if (t->mode==TFM_BONESIZE)
-			{
+			else if (t->mode==TFM_BONESIZE) {
 				if (ebo->flag & BONE_SELECTED) {
-					if(arm->drawtype==ARM_ENVELOPE)
+					if (arm->drawtype==ARM_ENVELOPE)
 					{
 						td->loc= NULL;
 						td->val= &ebo->dist;
 						td->ival= ebo->dist;
 					}
-					else
-					{
+					else {
 						// abusive storage of scale in the loc pointer :)
 						td->loc= &ebo->xwidth;
 						copy_v3_v3(td->iloc, td->loc);
@@ -1213,8 +1221,7 @@ static void createTransArmatureVerts(TransInfo *t)
 					td++;
 				}
 			}
-			else if (t->mode==TFM_BONE_ROLL)
-			{
+			else if (t->mode==TFM_BONE_ROLL) {
 				if (ebo->flag & BONE_SELECTED)
 				{
 					td->loc= NULL;
@@ -1230,8 +1237,7 @@ static void createTransArmatureVerts(TransInfo *t)
 					td++;
 				}
 			}
-			else
-			{
+			else {
 				if (ebo->flag & BONE_TIPSEL)
 				{
 					copy_v3_v3(td->iloc, ebo->tail);
@@ -1299,15 +1305,15 @@ static void createTransMBallVerts(TransInfo *t)
 	int propmode = t->flag & T_PROP_EDIT;
 
 	/* count totals */
-	for(ml= mb->editelems->first; ml; ml= ml->next) {
-		if(ml->flag & SELECT) countsel++;
-		if(propmode) count++;
+	for (ml= mb->editelems->first; ml; ml= ml->next) {
+		if (ml->flag & SELECT) countsel++;
+		if (propmode) count++;
 	}
 
 	/* note: in prop mode we need at least 1 selected */
 	if (countsel==0) return;
 
-	if(propmode) t->total = count;
+	if (propmode) t->total = count;
 	else t->total = countsel;
 
 	td = t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(MBall EditMode)");
@@ -1316,13 +1322,13 @@ static void createTransMBallVerts(TransInfo *t)
 	copy_m3_m4(mtx, t->obedit->obmat);
 	invert_m3_m3(smtx, mtx);
 
-	for(ml= mb->editelems->first; ml; ml= ml->next) {
-		if(propmode || (ml->flag & SELECT)) {
+	for (ml= mb->editelems->first; ml; ml= ml->next) {
+		if (propmode || (ml->flag & SELECT)) {
 			td->loc= &ml->x;
 			copy_v3_v3(td->iloc, td->loc);
 			copy_v3_v3(td->center, td->loc);
 
-			if(ml->flag & SELECT) td->flag= TD_SELECTED | TD_USEQUAT | TD_SINGLESIZE;
+			if (ml->flag & SELECT) td->flag= TD_SELECTED | TD_USEQUAT | TD_SINGLESIZE;
 			else td->flag= TD_USEQUAT;
 
 			copy_m3_m3(td->smtx, smtx);
@@ -1331,11 +1337,11 @@ static void createTransMBallVerts(TransInfo *t)
 			td->ext = tx;
 
 			/* Radius of MetaElem (mass of MetaElem influence) */
-			if(ml->flag & MB_SCALE_RAD){
+			if (ml->flag & MB_SCALE_RAD) {
 				td->val = &ml->rad;
 				td->ival = ml->rad;
 			}
-			else{
+			else {
 				td->val = &ml->s;
 				td->ival = ml->s;
 			}
@@ -1368,7 +1374,7 @@ static void calc_distanceCurveVerts(TransData *head, TransData *tail)
 			td_near = td;
 			td->dist = 0.0f;
 		}
-		else if(td_near) {
+		else if (td_near) {
 			float dist;
 			dist = len_v3v3(td_near->center, td->center);
 			if (dist < (td-1)->dist) {
@@ -1389,7 +1395,7 @@ static void calc_distanceCurveVerts(TransData *head, TransData *tail)
 			td_near = td;
 			td->dist = 0.0f;
 		}
-		else if(td_near) {
+		else if (td_near) {
 			float dist;
 			dist = len_v3v3(td_near->center, td->center);
 			if (td->flag & TD_NOTCONNECTED || dist < td->dist || (td+1)->dist < td->dist) {
@@ -1413,7 +1419,7 @@ static TransDataCurveHandleFlags *initTransDataCurveHandles(TransData *td, struc
 	hdata = td->hdata = MEM_mallocN(sizeof(TransDataCurveHandleFlags), "CuHandle Data");
 	hdata->ih1 = bezt->h1;
 	hdata->h1 = &bezt->h1;
-	hdata->ih2 = bezt->h2; /* incase the second is not selected */
+	hdata->ih2 = bezt->h2; /* in case the second is not selected */
 	hdata->h2 = &bezt->h2;
 	return hdata;
 }
@@ -1434,31 +1440,32 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
 	ListBase *nurbs;
 
 	/* to be sure */
-	if(cu->editnurb==NULL) return;
+	if (cu->editnurb==NULL) return;
 
 	/* count total of vertices, check identical as in 2nd loop for making transdata! */
 	nurbs= curve_editnurbs(cu);
-	for(nu= nurbs->first; nu; nu= nu->next) {
-		if(nu->type == CU_BEZIER) {
-			for(a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) {
-				if(bezt->hide==0) {
+	for (nu= nurbs->first; nu; nu= nu->next) {
+		if (nu->type == CU_BEZIER) {
+			for (a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) {
+				if (bezt->hide==0) {
 					if (hide_handles) {
-						if(bezt->f2 & SELECT) countsel+=3;
-						if(propmode) count+= 3;
-					} else {
-						if(bezt->f1 & SELECT) countsel++;
-						if(bezt->f2 & SELECT) countsel++;
-						if(bezt->f3 & SELECT) countsel++;
-						if(propmode) count+= 3;
+						if (bezt->f2 & SELECT) countsel+=3;
+						if (propmode) count+= 3;
+					}
+					else {
+						if (bezt->f1 & SELECT) countsel++;
+						if (bezt->f2 & SELECT) countsel++;
+						if (bezt->f3 & SELECT) countsel++;
+						if (propmode) count+= 3;
 					}
 				}
 			}
 		}
 		else {
-			for(a= nu->pntsu*nu->pntsv, bp= nu->bp; a>0; a--, bp++) {
-				if(bp->hide==0) {
-					if(propmode) count++;
-					if(bp->f1 & SELECT) countsel++;
+			for (a= nu->pntsu*nu->pntsv, bp= nu->bp; a>0; a--, bp++) {
+				if (bp->hide==0) {
+					if (propmode) count++;
+					if (bp->f1 & SELECT) countsel++;
 				}
 			}
 		}
@@ -1466,7 +1473,7 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
 	/* note: in prop mode we need at least 1 selected */
 	if (countsel==0) return;
 
-	if(propmode) t->total = count;
+	if (propmode) t->total = count;
 	else t->total = countsel;
 	t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(Curve EditMode)");
 
@@ -1474,15 +1481,15 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
 	invert_m3_m3(smtx, mtx);
 
 	td = t->data;
-	for(nu= nurbs->first; nu; nu= nu->next) {
-		if(nu->type == CU_BEZIER) {
+	for (nu= nurbs->first; nu; nu= nu->next) {
+		if (nu->type == CU_BEZIER) {
 			TransData *head, *tail;
 			head = tail = td;
-			for(a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) {
-				if(bezt->hide==0) {
+			for (a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) {
+				if (bezt->hide==0) {
 					TransDataCurveHandleFlags *hdata = NULL;
 
-					if(		propmode ||
+					if (		propmode ||
 							((bezt->f2 & SELECT) && hide_handles) ||
 							((bezt->f1 & SELECT) && hide_handles == 0)
 					  ) {
@@ -1490,10 +1497,11 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
 						td->loc= bezt->vec[0];
 						copy_v3_v3(td->center, bezt->vec[(hide_handles || bezt->f2 & SELECT) ? 1:0]);
 						if (hide_handles) {
-							if(bezt->f2 & SELECT) td->flag= TD_SELECTED;
+							if (bezt->f2 & SELECT) td->flag= TD_SELECTED;
 							else td->flag= 0;
-						} else {
-							if(bezt->f1 & SELECT) td->flag= TD_SELECTED;
+						}
+						else {
+							if (bezt->f1 & SELECT) td->flag= TD_SELECTED;
 							else td->flag= 0;
 						}
 						td->ext = NULL;
@@ -1510,21 +1518,23 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
 					}
 
 					/* This is the Curve Point, the other two are handles */
-					if(propmode || (bezt->f2 & SELECT)) {
+					if (propmode || (bezt->f2 & SELECT)) {
 						copy_v3_v3(td->iloc, bezt->vec[1]);
 						td->loc= bezt->vec[1];
 						copy_v3_v3(td->center, td->loc);
-						if(bezt->f2 & SELECT) td->flag= TD_SELECTED;
+						if (bezt->f2 & SELECT) td->flag= TD_SELECTED;
 						else td->flag= 0;
 						td->ext = NULL;
 
 						if (t->mode==TFM_CURVE_SHRINKFATTEN) { /* || t->mode==TFM_RESIZE) {*/ /* TODO - make points scale */
 							td->val = &(bezt->radius);
 							td->ival = bezt->radius;
-						} else if (t->mode==TFM_TILT) {
+						}
+						else if (t->mode==TFM_TILT) {
 							td->val = &(bezt->alfa);
 							td->ival = bezt->alfa;
-						} else {
+						}
+						else {
 							td->val = NULL;
 						}
 
@@ -1541,7 +1551,7 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
 						count++;
 						tail++;
 					}
-					if(		propmode ||
+					if (		propmode ||
 							((bezt->f2 & SELECT) && hide_handles) ||
 							((bezt->f3 & SELECT) && hide_handles == 0)
 					  ) {
@@ -1549,10 +1559,11 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
 						td->loc= bezt->vec[2];
 						copy_v3_v3(td->center, bezt->vec[(hide_handles || bezt->f2 & SELECT) ? 1:2]);
 						if (hide_handles) {
-							if(bezt->f2 & SELECT) td->flag= TD_SELECTED;
+							if (bezt->f2 & SELECT) td->flag= TD_SELECTED;
 							else td->flag= 0;
-						} else {
-							if(bezt->f3 & SELECT) td->flag= TD_SELECTED;
+						}
+						else {
+							if (bezt->f3 & SELECT) td->flag= TD_SELECTED;
 							else td->flag= 0;
 						}
 						td->ext = NULL;
@@ -1579,7 +1590,7 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
 				calc_distanceCurveVerts(head, tail-1);
 
 			/* TODO - in the case of tilt and radius we can also avoid allocating the initTransDataCurveHandles
-			 * but for now just dont change handle types */
+			 * but for now just don't change handle types */
 			if (ELEM(t->mode, TFM_CURVE_SHRINKFATTEN, TFM_TILT) == 0) {
 				/* sets the handles based on their selection, do this after the data is copied to the TransData */
 				testhandlesNurb(nu);
@@ -1588,20 +1599,21 @@ static void createTransCurveVerts(bContext *C, TransInfo *t)
 		else {
 			TransData *head, *tail;
 			head = tail = td;
-			for(a= nu->pntsu*nu->pntsv, bp= nu->bp; a>0; a--, bp++) {
-				if(bp->hide==0) {
-					if(propmode || (bp->f1 & SELECT)) {
+			for (a= nu->pntsu*nu->pntsv, bp= nu->bp; a>0; a--, bp++) {
+				if (bp->hide==0) {
+					if (propmode || (bp->f1 & SELECT)) {
 						copy_v3_v3(td->iloc, bp->vec);
 						td->loc= bp->vec;
 						copy_v3_v3(td->center, td->loc);
-						if(bp->f1 & SELECT) td->flag= TD_SELECTED;
+						if (bp->f1 & SELECT) td->flag= TD_SELECTED;
 						else td->flag= 0;
 						td->ext = NULL;
 
 						if (t->mode==TFM_CURVE_SHRINKFATTEN || t->mode==TFM_RESIZE) {
 							td->val = &(bp->radius);
 							td->ival = bp->radius;
-						} else {
+						}
+						else {
 							td->val = &(bp->alfa);
 							td->ival = bp->alfa;
 						}
@@ -1639,10 +1651,10 @@ static void createTransLatticeVerts(TransInfo *t)
 
 	bp = latt->def;
 	a  = latt->pntsu * latt->pntsv * latt->pntsw;
-	while(a--) {
-		if(bp->hide==0) {
-			if(bp->f1 & SELECT) countsel++;
-			if(propmode) count++;
+	while (a--) {
+		if (bp->hide==0) {
+			if (bp->f1 & SELECT) countsel++;
+			if (propmode) count++;
 		}
 		bp++;
 	}
@@ -1650,7 +1662,7 @@ static void createTransLatticeVerts(TransInfo *t)
 	 /* note: in prop mode we need at least 1 selected */
 	if (countsel==0) return;
 
-	if(propmode) t->total = count;
+	if (propmode) t->total = count;
 	else t->total = countsel;
 	t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(Lattice EditMode)");
 
@@ -1660,13 +1672,13 @@ static void createTransLatticeVerts(TransInfo *t)
 	td = t->data;
 	bp = latt->def;
 	a  = latt->pntsu * latt->pntsv * latt->pntsw;
-	while(a--) {
-		if(propmode || (bp->f1 & SELECT)) {
-			if(bp->hide==0) {
+	while (a--) {
+		if (propmode || (bp->f1 & SELECT)) {
+			if (bp->hide==0) {
 				copy_v3_v3(td->iloc, bp->vec);
 				td->loc= bp->vec;
 				copy_v3_v3(td->center, td->loc);
-				if(bp->f1 & SELECT) td->flag= TD_SELECTED;
+				if (bp->f1 & SELECT) td->flag= TD_SELECTED;
 				else td->flag= 0;
 				copy_m3_m3(td->smtx, smtx);
 				copy_m3_m3(td->mtx, mtx);
@@ -1700,33 +1712,33 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
 	int count = 0, hasselected = 0;
 	int propmode = t->flag & T_PROP_EDIT;
 
-	if(edit==NULL || t->settings->particle.selectmode==SCE_SELECT_PATH) return;
+	if (edit==NULL || t->settings->particle.selectmode==SCE_SELECT_PATH) return;
 
 	psys = edit->psys;
 
-	if(psys)
+	if (psys)
 		psmd = psys_get_modifier(ob,psys);
 
 	base->flag |= BA_HAS_RECALC_DATA;
 
-	for(i=0, point=edit->points; i<edit->totpoint; i++, point++) {
+	for (i=0, point=edit->points; i<edit->totpoint; i++, point++) {
 		point->flag &= ~PEP_TRANSFORM;
 		transformparticle= 0;
 
-		if((point->flag & PEP_HIDE)==0) {
-			for(k=0, key=point->keys; k<point->totkey; k++, key++) {
-				if((key->flag&PEK_HIDE)==0) {
-					if(key->flag&PEK_SELECT) {
+		if ((point->flag & PEP_HIDE)==0) {
+			for (k=0, key=point->keys; k<point->totkey; k++, key++) {
+				if ((key->flag&PEK_HIDE)==0) {
+					if (key->flag&PEK_SELECT) {
 						hasselected= 1;
 						transformparticle= 1;
 					}
-					else if(propmode)
+					else if (propmode)
 						transformparticle= 1;
 				}
 			}
 		}
 
-		if(transformparticle) {
+		if (transformparticle) {
 			count += point->totkey;
 			point->flag |= PEP_TRANSFORM;
 		}
@@ -1738,7 +1750,7 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
 	t->total = count;
 	td = t->data = MEM_callocN(t->total * sizeof(TransData), "TransObData(Particle Mode)");
 
-	if(t->mode == TFM_BAKE_TIME)
+	if (t->mode == TFM_BAKE_TIME)
 		tx = t->ext = MEM_callocN(t->total * sizeof(TransDataExtension), "Particle_TransExtension");
 	else
 		tx = t->ext = NULL;
@@ -1747,17 +1759,17 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
 
 	invert_m4_m4(ob->imat,ob->obmat);
 
-	for(i=0, point=edit->points; i<edit->totpoint; i++, point++) {
+	for (i=0, point=edit->points; i<edit->totpoint; i++, point++) {
 		TransData *head, *tail;
 		head = tail = td;
 
-		if(!(point->flag & PEP_TRANSFORM)) continue;
+		if (!(point->flag & PEP_TRANSFORM)) continue;
 
-		if(psys && !(psys->flag & PSYS_GLOBAL_HAIR))
+		if (psys && !(psys->flag & PSYS_GLOBAL_HAIR))
 			psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles + i, mat);
 
-		for(k=0, key=point->keys; k<point->totkey; k++, key++) {
-			if(key->flag & PEK_USE_WCO) {
+		for (k=0, key=point->keys; k<point->totkey; k++, key++) {
+			if (key->flag & PEK_USE_WCO) {
 				copy_v3_v3(key->world_co, key->co);
 				mul_m4_v3(mat, key->world_co);
 				td->loc = key->world_co;
@@ -1768,34 +1780,34 @@ static void createTransParticleVerts(bContext *C, TransInfo *t)
 			copy_v3_v3(td->iloc, td->loc);
 			copy_v3_v3(td->center, td->loc);
 
-			if(key->flag & PEK_SELECT)
+			if (key->flag & PEK_SELECT)
 				td->flag |= TD_SELECTED;
-			else if(!propmode)
+			else if (!propmode)
 				td->flag |= TD_SKIP;
 
 			unit_m3(td->mtx);
 			unit_m3(td->smtx);
 
 			/* don't allow moving roots */
-			if(k==0 && pset->flag & PE_LOCK_FIRST && (!psys || !(psys->flag & PSYS_GLOBAL_HAIR)))
+			if (k==0 && pset->flag & PE_LOCK_FIRST && (!psys || !(psys->flag & PSYS_GLOBAL_HAIR)))
 				td->protectflag |= OB_LOCK_LOC;
 
 			td->ob = ob;
 			td->ext = tx;
-			if(t->mode == TFM_BAKE_TIME) {
+			if (t->mode == TFM_BAKE_TIME) {
 				td->val = key->time;
 				td->ival = *(key->time);
 				/* abuse size and quat for min/max values */
 				td->flag |= TD_NO_EXT;
-				if(k==0) tx->size = NULL;
+				if (k==0) tx->size = NULL;
 				else tx->size = (key - 1)->time;
 
-				if(k == point->totkey - 1) tx->quat = NULL;
+				if (k == point->totkey - 1) tx->quat = NULL;
 				else tx->quat = (key + 1)->time;
 			}
 
 			td++;
-			if(tx)
+			if (tx)
 				tx++;
 			tail++;
 		}
@@ -1817,26 +1829,26 @@ void flushTransParticles(TransInfo *t)
 	float mat[4][4], imat[4][4], co[3];
 	int i, k, propmode = t->flag & T_PROP_EDIT;
 
-	if(psys)
+	if (psys)
 		psmd = psys_get_modifier(ob, psys);
 
 	/* we do transform in world space, so flush world space position
 	 * back to particle local space (only for hair particles) */
 	td= t->data;
-	for(i=0, point=edit->points; i<edit->totpoint; i++, point++, td++) {
-		if(!(point->flag & PEP_TRANSFORM)) continue;
+	for (i=0, point=edit->points; i<edit->totpoint; i++, point++, td++) {
+		if (!(point->flag & PEP_TRANSFORM)) continue;
 
-		if(psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
+		if (psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
 			psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles + i, mat);
 			invert_m4_m4(imat,mat);
 
-			for(k=0, key=point->keys; k<point->totkey; k++, key++) {
+			for (k=0, key=point->keys; k<point->totkey; k++, key++) {
 				copy_v3_v3(co, key->world_co);
 				mul_m4_v3(imat, co);
 
 
 				/* optimization for proportional edit */
-				if(!propmode || !compare_v3v3(key->co, co, 0.0001f)) {
+				if (!propmode || !compare_v3v3(key->co, co, 0.0001f)) {
 					copy_v3_v3(key->co, co);
 					point->flag |= PEP_EDIT_RECALC;
 				}
@@ -1854,139 +1866,136 @@ void flushTransParticles(TransInfo *t)
 /* proportional distance based on connectivity  */
 #define THRESHOLDFACTOR (1.0f-0.0001f)
 
-static int connectivity_edge(float mtx[][3], EditVert *v1, EditVert *v2)
+/* I did this wrong, it should be a breadth-first search
+ * but instead it's a depth-first search, fudged
+ * to report shortest distances.  I have no idea how fast
+ * or slow this is. */
+static void editmesh_set_connectivity_distance(BMEditMesh *em, float mtx[][3], float *dists)
 {
-	float edge_vec[3];
-	float edge_len;
-	int done = 0;
-
-	/* note: hidden verts are not being checked for, this assumes
-	 * flushing of hidden faces & edges is working right */
-	
-	if (v1->f2 + v2->f2 == 4)
-		return 0;
+	BMVert **queue = NULL;
+	float *dqueue = NULL;
+	int *tots = MEM_callocN(sizeof(int)*em->bm->totvert, "tots editmesh_set_connectivity_distance");
+	BLI_array_declare(queue);
+	BLI_array_declare(dqueue);
+	SmallHash svisit, *visit=&svisit;
+	BMVert *v;
+	BMIter viter;
+	int i, start;
 	
-	sub_v3_v3v3(edge_vec, v1->co, v2->co);
-	mul_m3_v3(mtx, edge_vec);
-
-	edge_len = len_v3(edge_vec);
-
-	if (v1->f2) {
-		if (v2->f2) {
-			if (v2->tmp.fp + edge_len < THRESHOLDFACTOR * v1->tmp.fp) {
-				v1->tmp.fp = v2->tmp.fp + edge_len;
-				done = 1;
-			} else if (v1->tmp.fp + edge_len < THRESHOLDFACTOR * v2->tmp.fp) {
-				v2->tmp.fp = v1->tmp.fp + edge_len;
-				done = 1;
-			}
-		}
-		else {
-			v2->f2 = 1;
-			v2->tmp.fp = v1->tmp.fp + edge_len;
-			done = 1;
-		}
-	}
-	else if (v2->f2) {
-		v1->f2 = 1;
-		v1->tmp.fp = v2->tmp.fp + edge_len;
-		done = 1;
-	}
+	fill_vn_fl(dists, em->bm->totvert, FLT_MAX);
 
-	return done;
-}
+	BM_mesh_elem_index_ensure(em->bm, BM_VERT);
 
-static void editmesh_set_connectivity_distance(EditMesh *em, float mtx[][3])
-{
-	EditVert *eve;
-	EditEdge *eed;
-	EditFace *efa;
-	int done= 1;
-
-	/* f2 flag is used for 'selection' */
-	/* tmp.l is offset on scratch array   */
-	for(eve= em->verts.first; eve; eve= eve->next) {
-		if(eve->h==0) {
-			eve->tmp.fp = 0;
-
-			if(eve->f & SELECT) {
-				eve->f2= 2;
-			}
-			else {
-				eve->f2 = 0;
-			}
-		}
-	}
+	BLI_smallhash_init(visit);
 
+	BM_ITER_MESH (v, &viter, em->bm, BM_VERTS_OF_MESH) {
+		if (BM_elem_flag_test(v, BM_ELEM_SELECT)==0 || BM_elem_flag_test(v, BM_ELEM_HIDDEN))
+			continue;
+			
+		
+		BLI_smallhash_insert(visit, (uintptr_t)v, NULL);
+		BLI_array_append(queue, v);
+		BLI_array_append(dqueue, 0.0f);
+		dists[BM_elem_index_get(v)] = 0.0f;
+	}
+	
+	start = 0;
+	while (start < BLI_array_count(queue)) {
+		BMIter eiter;
+		BMEdge *e;
+		BMVert *v3, *v2;
+		float d, vec[3];
+		
+		v2 = queue[start];
+		d = dqueue[start];
+		
+		BM_ITER_ELEM (e, &eiter, v2, BM_EDGES_OF_VERT) {
+			float d2;
+			v3 = BM_edge_other_vert(e, v2);
+			
+			if (BM_elem_flag_test(v3, BM_ELEM_SELECT) || BM_elem_flag_test(v3, BM_ELEM_HIDDEN))
+				continue;
+			
+			sub_v3_v3v3(vec, v2->co, v3->co);
+			mul_m3_v3(mtx, vec);
+			
+			d2 = d + len_v3(vec);
+			
+			if (dists[BM_elem_index_get(v3)] != FLT_MAX)
+				dists[BM_elem_index_get(v3)] = MIN2(d2, dists[BM_elem_index_get(v3)]);
+			else
+				dists[BM_elem_index_get(v3)] = d2;
+			
+			tots[BM_elem_index_get(v3)] = 1;
 
-	/* Floodfill routine */
-	/*
-	At worst this is n*n of complexity where n is number of edges
-	Best case would be n if the list is ordered perfectly.
-	Estimate is n log n in average (so not too bad)
-	*/
-	while(done) {
-		done= 0;
-
-		for(eed= em->edges.first; eed; eed= eed->next) {
-			if(eed->h==0) {
-				done |= connectivity_edge(mtx, eed->v1, eed->v2);
-			}
+			if (BLI_smallhash_haskey(visit, (uintptr_t)v3))
+				continue;
+			
+			BLI_smallhash_insert(visit, (uintptr_t)v3, NULL);
+			
+			BLI_array_append(queue, v3);
+			BLI_array_append(dqueue, d2);
 		}
+		
+		start++;
+	}
 
-		/* do internal edges for quads */
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if (efa->v4 && efa->h==0) {
-				done |= connectivity_edge(mtx, efa->v1, efa->v3);
-				done |= connectivity_edge(mtx, efa->v2, efa->v4);
-			}
-		}
+	BLI_smallhash_release(visit);
+	
+	for (i=0; i<em->bm->totvert; i++) {
+		if (tots[i])
+			dists[i] /= (float)tots[i];
 	}
+	
+	BLI_array_free(queue);
+	BLI_array_free(dqueue);
+	MEM_freeN(tots);
 }
 
 /* loop-in-a-loop I know, but we need it! (ton) */
-static void get_face_center(float *cent, EditMesh *em, EditVert *eve)
+ static void get_face_center(float cent_r[3], BMVert *eve)
+
 {
-	EditFace *efa;
+	BMFace *efa;
+	BMIter iter;
 
-	for(efa= em->faces.first; efa; efa= efa->next)
-		if(efa->f & SELECT)
-			if(efa->v1==eve || efa->v2==eve || efa->v3==eve || efa->v4==eve)
-				break;
-	if(efa) {
-		copy_v3_v3(cent, efa->cent);
+	BM_ITER_ELEM (efa, &iter, eve, BM_FACES_OF_VERT) {
+		if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
+			BM_face_calc_center_mean(efa, cent_r);
+			break;
+		}
 	}
 }
 
-static void get_edge_center(float *cent, EditMesh *em, EditVert *eve)
+static void get_edge_center(float cent_r[3], BMVert *eve)
 {
-	EditEdge *eed;
+	BMEdge *eed;
+	BMIter iter;
 
-	for(eed= em->edges.first; eed; eed= eed->next)
-		if(eed->f & SELECT)
-			if(eed->v1==eve || eed->v2==eve)
-				break;
-	if(eed) {
-		mid_v3_v3v3(cent, eed->v1->co, eed->v2->co);
+	BM_ITER_ELEM (eed, &iter, eve, BM_EDGES_OF_VERT) {
+		if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
+			mid_v3_v3v3(cent_r, eed->v1->co, eed->v2->co);
+			break;
+		}
 	}
 }
 
-/* way to overwrite what data is edited with transform
- * static void VertsToTransData(TransData *td, EditVert *eve, BakeKey *key) */
-static void VertsToTransData(TransInfo *t, TransData *td, EditMesh *em, EditVert *eve)
+/* way to overwrite what data is edited with transform */
+static void VertsToTransData(TransInfo *t, TransData *td, BMEditMesh *em, BMVert *eve, float *bweight)
 {
 	td->flag = 0;
-	//if(key)
+	//if (key)
 	//	td->loc = key->co;
 	//else
 	td->loc = eve->co;
 
 	copy_v3_v3(td->center, td->loc);
-	if(t->around==V3D_LOCAL) {
-		if(em->selectmode & SCE_SELECT_FACE)
-			get_face_center(td->center, em, eve);
-		else if(em->selectmode & SCE_SELECT_EDGE)
-			get_edge_center(td->center, em, eve);
+
+	if (t->around==V3D_LOCAL) {
+		if (em->selectmode & SCE_SELECT_FACE)
+			get_face_center(td->center, eve);
+		else if (em->selectmode & SCE_SELECT_EDGE)
+			get_edge_center(td->center, eve);
 	}
 	copy_v3_v3(td->iloc, td->loc);
 
@@ -2003,8 +2012,8 @@ static void VertsToTransData(TransInfo *t, TransData *td, EditMesh *em, EditVert
 	td->val = NULL;
 	td->extra = NULL;
 	if (t->mode == TFM_BWEIGHT) {
-		td->val = &(eve->bweight);
-		td->ival = eve->bweight;
+		td->val = bweight;
+		td->ival = bweight ? *(bweight) : 1.0f;
 	}
 }
 
@@ -2012,18 +2021,23 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
 {
 	ToolSettings *ts = CTX_data_tool_settings(C);
 	TransData *tob = NULL;
-	EditMesh *em = ((Mesh *)t->obedit->data)->edit_mesh;
-	EditVert *eve;
-	EditVert *eve_act = NULL;
+	BMEditMesh *em = BMEdit_FromObject(t->obedit);
+	BMesh *bm = em->bm;
+	BMVert *eve;
+	BMIter iter;
+	BMVert *eve_act = NULL;
 	float *mappedcos = NULL, *quats= NULL;
 	float mtx[3][3], smtx[3][3], (*defmats)[3][3] = NULL, (*defcos)[3] = NULL;
+	float *dists=NULL;
 	int count=0, countsel=0, a, totleft;
 	int propmode = (t->flag & T_PROP_EDIT) ? (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) : 0;
 	int mirror = 0;
+	char *selstate = NULL;
 	short selectmode = ts->selectmode;
 
 	if (t->flag & T_MIRROR)
 	{
+		EDBM_verts_mirror_cache_begin(em, TRUE);
 		mirror = 1;
 	}
 
@@ -2032,55 +2046,84 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
 		selectmode = SCE_SELECT_EDGE;
 	}
 
+	/* BMESH_TODO, writing into the index values is BAD!, means we cant
+	 * use the values for vertex mirror - campbell */
+
 	// transform now requires awareness for select mode, so we tag the f1 flags in verts
-	if(selectmode & SCE_SELECT_VERTEX) {
-		for(eve= em->verts.first; eve; eve= eve->next) {
-			if(eve->h==0 && (eve->f & SELECT))
-				eve->f1= SELECT;
-			else
-				eve->f1= 0;
+	if (selectmode & SCE_SELECT_VERTEX) {
+		BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
+			BM_elem_flag_set(eve, BM_ELEM_TAG, BM_elem_flag_test(eve, BM_ELEM_SELECT));
 		}
 	}
-	else if(selectmode & SCE_SELECT_EDGE) {
-		EditEdge *eed;
-		for(eve= em->verts.first; eve; eve= eve->next) eve->f1= 0;
-		for(eed= em->edges.first; eed; eed= eed->next) {
-			if(eed->h==0 && (eed->f & SELECT))
-				eed->v1->f1= eed->v2->f1= SELECT;
+	else if (selectmode & SCE_SELECT_EDGE) {
+		BMEdge *eed;
+
+		eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL);
+		for ( ; eve; eve=BM_iter_step(&iter)) BM_elem_flag_disable(eve, BM_ELEM_TAG);
+
+		eed = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, NULL);
+		for ( ; eed; eed=BM_iter_step(&iter)) {
+			if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
+				BM_elem_flag_enable(eed->v1, BM_ELEM_TAG);
+				BM_elem_flag_enable(eed->v2, BM_ELEM_TAG);
+			}
 		}
 	}
 	else {
-		EditFace *efa;
-		for(eve= em->verts.first; eve; eve= eve->next) eve->f1= 0;
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->h==0 && (efa->f & SELECT)) {
-				efa->v1->f1= efa->v2->f1= efa->v3->f1= SELECT;
-				if(efa->v4) efa->v4->f1= SELECT;
+		BMFace *efa;
+		eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL);
+		for ( ; eve; eve=BM_iter_step(&iter)) BM_elem_flag_disable(eve, BM_ELEM_TAG);
+
+		efa = BM_iter_new(&iter, bm, BM_FACES_OF_MESH, NULL);
+		for ( ; efa; efa=BM_iter_step(&iter)) {
+			if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
+				BMIter liter;
+				BMLoop *l;
+
+				l = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, efa);
+				for (; l; l=BM_iter_step(&liter)) {
+					BM_elem_flag_enable(l->v, BM_ELEM_TAG);
+				}
 			}
 		}
 	}
 
-	/* now we can count */
-	for(eve= em->verts.first; eve; eve= eve->next) {
-		if(eve->h==0) {
-			if(eve->f1) countsel++;
-			if(propmode) count++;
+	/* now we can count. we store selection state in selstate, since
+	 * get_crazy_mapped_editverts messes up the index state of the
+	 * verts*/
+	selstate = MEM_callocN(sizeof(*selstate) * bm->totvert, __func__);
+	eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL);
+	for (a=0; eve; eve=BM_iter_step(&iter), a++) {
+		if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
+			if (BM_elem_flag_test(eve, BM_ELEM_TAG)) {
+				selstate[a] = 1;
+				countsel++;
+			}
+			if (propmode) count++;
 		}
 	}
 
-	 /* note: in prop mode we need at least 1 selected */
-	if (countsel==0) return;
+	/* note: in prop mode we need at least 1 selected */
+	if (countsel == 0) {
+		goto cleanup;
+	}
 
 	/* check active */
-	if (em->selected.last) {
-		EditSelection *ese = em->selected.last;
-		if ( ese->type == EDITVERT ) {
-			eve_act = (EditVert *)ese->data;
+	if (em->bm->selected.last) {
+		BMEditSelection *ese = em->bm->selected.last;
+		if (ese->htype == BM_VERT) {
+			eve_act = (BMVert *)ese->ele;
 		}
 	}
 
 
-	if(propmode) t->total = count;
+	if (propmode) {
+		t->total = count;
+
+		/* allocating scratch arrays */
+		if (propmode & T_PROP_CONNECTED)
+			dists = MEM_mallocN(em->bm->totvert * sizeof(float), "scratch nears");
+	}
 	else t->total = countsel;
 
 	tob= t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(Mesh EditMode)");
@@ -2088,38 +2131,39 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
 	copy_m3_m4(mtx, t->obedit->obmat);
 	invert_m3_m3(smtx, mtx);
 
-	if(propmode & T_PROP_CONNECTED) {
-		editmesh_set_connectivity_distance(em, mtx);
+	if (propmode & T_PROP_CONNECTED) {
+		editmesh_set_connectivity_distance(em, mtx, dists);
 	}
 
 	/* detect CrazySpace [tm] */
-	if(modifiers_getCageIndex(t->scene, t->obedit, NULL, 1)>=0) {
-		if(modifiers_isCorrectableDeformed(t->obedit)) {
+	if (modifiers_getCageIndex(t->scene, t->obedit, NULL, 1)>=0) {
+		if (modifiers_isCorrectableDeformed(t->obedit)) {
 			/* check if we can use deform matrices for modifier from the
-			   start up to stack, they are more accurate than quats */
-			totleft= editmesh_get_first_deform_matrices(t->scene, t->obedit, em, &defmats, &defcos);
+			 * start up to stack, they are more accurate than quats */
+			totleft= editbmesh_get_first_deform_matrices(t->scene, t->obedit, em, &defmats, &defcos);
 
 			/* if we still have more modifiers, also do crazyspace
-			   correction with quats, relative to the coordinates after
-			   the modifiers that support deform matrices (defcos) */
-			if(totleft > 0) {
+			 * correction with quats, relative to the coordinates after
+			 * the modifiers that support deform matrices (defcos) */
+			if (totleft > 0) {
 				mappedcos= crazyspace_get_mapped_editverts(t->scene, t->obedit);
 				quats= MEM_mallocN( (t->total)*sizeof(float)*4, "crazy quats");
-				crazyspace_set_quats_editmesh(em, (float*)defcos, mappedcos, quats);
-				if(mappedcos)
+				crazyspace_set_quats_editmesh(em, (float*)defcos, mappedcos, quats); /* BMESH_TODO, abuses vertex index, should use an int array */
+				if (mappedcos)
 					MEM_freeN(mappedcos);
 			}
 
-			if(defcos)
+			if (defcos)
 				MEM_freeN(defcos);
 		}
 	}
 
 	/* find out which half we do */
-	if(mirror) {
-		for (eve=em->verts.first; eve; eve=eve->next) {
-			if(eve->h==0 && eve->f1 && eve->co[0]!=0.0f) {
-				if(eve->co[0]<0.0f)
+	if (mirror) {
+		eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL);
+		for (a=0; eve; eve=BM_iter_step(&iter), a++) {
+			if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN) && selstate[a] && eve->co[0]!=0.0f) {
+				if (eve->co[0]<0.0f)
 				{
 					t->mirror = -1;
 					mirror = -1;
@@ -2129,20 +2173,23 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
 		}
 	}
 
-	for (a=0, eve=em->verts.first; eve; eve=eve->next, a++) {
-		if(eve->h==0) {
-			if(propmode || eve->f1) {
-				VertsToTransData(t, tob, em, eve);
+	eve = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL);
+	for (a=0; eve; eve=BM_iter_step(&iter), a++) {
+		if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
+			if (propmode || selstate[a]) {
+				float *bweight = CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_BWEIGHT);
+				
+				VertsToTransData(t, tob, em, eve, bweight);
 
 				/* selected */
-				if(eve->f1) tob->flag |= TD_SELECTED;
+				if (selstate[a]) tob->flag |= TD_SELECTED;
 
 				/* active */
-				if(eve == eve_act) tob->flag |= TD_ACTIVE;
+				if (eve == eve_act) tob->flag |= TD_ACTIVE;
 
-				if(propmode) {
-					if (eve->f2) {
-						tob->dist= eve->tmp.fp;
+				if (propmode) {
+					if (propmode & T_PROP_CONNECTED) {
+						tob->dist = dists[a];
 					}
 					else {
 						tob->flag |= TD_NOTCONNECTED;
@@ -2151,14 +2198,14 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
 				}
 
 				/* CrazySpace */
-				if(defmats || (quats && eve->tmp.p)) {
-					float mat[3][3], imat[3][3], qmat[3][3];
+				if (defmats || (quats && BM_elem_index_get(eve) != -1)) {
+					float mat[3][3], qmat[3][3], imat[3][3];
 
 					/* use both or either quat and defmat correction */
-					if(quats && eve->tmp.f) {
-						quat_to_mat3( qmat,eve->tmp.p);
+					if (quats && BM_elem_index_get(eve) != -1) {
+						quat_to_mat3(qmat, quats + 4*BM_elem_index_get(eve));
 
-						if(defmats)
+						if (defmats)
 							mul_serie_m3(mat, mtx, qmat, defmats[a],
 								NULL, NULL, NULL, NULL, NULL);
 						else
@@ -2178,9 +2225,9 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
 				}
 
 				/* Mirror? */
-				if( (mirror>0 && tob->iloc[0]>0.0f) || (mirror<0 && tob->iloc[0]<0.0f)) {
-					EditVert *vmir= editmesh_get_x_mirror_vert(t->obedit, em, eve, tob->iloc, a);	/* initializes octree on first call */
-					if(vmir != eve) {
+				if ( (mirror>0 && tob->iloc[0]>0.0f) || (mirror<0 && tob->iloc[0]<0.0f)) {
+					BMVert *vmir= EDBM_verts_mirror_get(em, eve); //t->obedit, em, eve, tob->iloc, a);
+					if (vmir && vmir != eve) {
 						tob->extra = vmir;
 					}
 				}
@@ -2192,7 +2239,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
 	if (mirror != 0)
 	{
 		tob = t->data;
-		for( a = 0; a < t->total; a++, tob++ )
+		for ( a = 0; a < t->total; a++, tob++ )
 		{
 			if (ABS(tob->loc[0]) <= 0.00001f)
 			{
@@ -2200,12 +2247,22 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
 			}
 		}
 	}
-	
+
+cleanup:
 	/* crazy space free */
-	if(quats)
+	if (quats)
 		MEM_freeN(quats);
-	if(defmats)
+	if (defmats)
 		MEM_freeN(defmats);
+	if (dists)
+		MEM_freeN(dists);
+	
+	MEM_freeN(selstate);
+
+	if (t->flag & T_MIRROR) {
+		EDBM_verts_mirror_cache_end(em);
+		mirror = 1;
+	}
 }
 
 /* *** NODE EDITOR *** */
@@ -2215,13 +2272,13 @@ void flushTransNodes(TransInfo *t)
 	TransData2D *td;
 
 	/* flush to 2d vector from internally used 3d vector */
-	for(a=0, td= t->data2d; a<t->total; a++, td++) {
+	for (a=0, td= t->data2d; a<t->total; a++, td++) {
 		td->loc2d[0]= td->loc[0];
 		td->loc2d[1]= td->loc[1];
 	}
 	
 	/* handle intersection with noodles */
-	if(t->total==1) {
+	if (t->total==1) {
 		ED_node_link_intersect_test(t->sa, 1);
 	}
 	
@@ -2229,7 +2286,7 @@ void flushTransNodes(TransInfo *t)
 
 /* *** SEQUENCE EDITOR *** */
 
-/* commented _only_ because the meta may have animaion data which
+/* commented _only_ because the meta may have animation data which
  * needs moving too [#28158] */
 
 #define SEQ_TX_NESTED_METAS
@@ -2251,7 +2308,7 @@ void flushTransSeq(TransInfo *t)
 	Sequence *seq_prev= NULL;
 
 	/* flush to 2d vector from internally used 3d vector */
-	for(a=0, td= t->data, td2d= t->data2d; a<t->total; a++, td++, td2d++) {
+	for (a=0, td= t->data, td2d= t->data2d; a<t->total; a++, td++, td2d++) {
 		tdsq= (TransDataSeq *)td->extra;
 		seq= tdsq->seq;
 		old_start = seq->start;
@@ -2284,17 +2341,17 @@ void flushTransSeq(TransInfo *t)
 		}
 
 		if (seq != seq_prev) {
-			if(seq->depth==0) {
+			if (seq->depth==0) {
 				/* Calculate this strip and all nested strips
 				 * children are ALWAYS transformed first
-				 * so we dont need to do this in another loop. */
+				 * so we don't need to do this in another loop. */
 				calc_sequence(t->scene, seq);
 			}
 			else {
 				calc_sequence_disp(t->scene, seq);
 			}
 
-			if(tdsq->sel_flag == SELECT)
+			if (tdsq->sel_flag == SELECT)
 				seq_offset_animdata(t->scene, seq, seq->start - old_start);
 		}
 		seq_prev= seq;
@@ -2320,16 +2377,16 @@ void flushTransSeq(TransInfo *t)
 	/* need to do the overlap check in a new loop otherwise adjacent strips
 	 * will not be updated and we'll get false positives */
 	seq_prev= NULL;
-	for(a=0, td= t->data, td2d= t->data2d; a<t->total; a++, td++, td2d++) {
+	for (a=0, td= t->data, td2d= t->data2d; a<t->total; a++, td++, td2d++) {
 
 		tdsq= (TransDataSeq *)td->extra;
 		seq= tdsq->seq;
 
 		if (seq != seq_prev) {
-			if(seq->depth==0) {
+			if (seq->depth==0) {
 				/* test overlap, displayes red outline */
 				seq->flag &= ~SEQ_OVERLAP;
-				if( seq_test_overlap(seqbasep, seq) ) {
+				if ( seq_test_overlap(seqbasep, seq) ) {
 					seq->flag |= SEQ_OVERLAP;
 				}
 			}
@@ -2347,9 +2404,9 @@ static void UVsToTransData(SpaceImage *sima, TransData *td, TransData2D *td2d, f
 	ED_space_image_uv_aspect(sima, &aspx, &aspy);
 
 	/* uv coords are scaled by aspects. this is needed for rotations and
-	   proportional editing to be consistent with the stretchted uv coords
-	   that are displayed. this also means that for display and numinput,
-	   and when the the uv coords are flushed, these are converted each time */
+	 * proportional editing to be consistent with the stretched uv coords
+	 * that are displayed. this also means that for display and numinput,
+	 * and when the the uv coords are flushed, these are converted each time */
 	td2d->loc[0] = uv[0]*aspx;
 	td2d->loc[1] = uv[1]*aspy;
 	td2d->loc[2] = 0.0f;
@@ -2365,7 +2422,7 @@ static void UVsToTransData(SpaceImage *sima, TransData *td, TransData2D *td2d, f
 
 	td->ext= NULL; td->val= NULL;
 
-	if(selected) {
+	if (selected) {
 		td->flag |= TD_SELECTED;
 		td->dist= 0.0;
 	}
@@ -2383,30 +2440,33 @@ static void createTransUVs(bContext *C, TransInfo *t)
 	Scene *scene = t->scene;
 	TransData *td = NULL;
 	TransData2D *td2d = NULL;
-	MTFace *tf;
+	MTexPoly *tf;
+	MLoopUV *luv;
+	BMEditMesh *em = BMEdit_FromObject(t->obedit);
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
 	int count=0, countsel=0;
 	int propmode = t->flag & T_PROP_EDIT;
 
-	EditMesh *em = ((Mesh *)t->obedit->data)->edit_mesh;
-	EditFace *efa;
-
-	if(!ED_space_image_show_uvedit(sima, t->obedit)) return;
+	if (!ED_space_image_show_uvedit(sima, t->obedit)) return;
 
 	/* count */
-	for (efa= em->faces.first; efa; efa= efa->next) {
-		tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+	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(scene, ima, efa, tf)) {
-			efa->tmp.p = tf;
+		if (!uvedit_face_visible_test(scene, ima, efa, tf)) {
+			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)) 
+				countsel++;
 
-			if (uvedit_uv_selected(scene, efa, tf, 0)) countsel++;
-			if (uvedit_uv_selected(scene, efa, tf, 1)) countsel++;
-			if (uvedit_uv_selected(scene, efa, tf, 2)) countsel++;
-			if (efa->v4 && uvedit_uv_selected(scene, efa, tf, 3)) countsel++;
-			if(propmode)
-				count += (efa->v4)? 4: 3;
-		} else {
-			efa->tmp.p = NULL;
+			if (propmode)
+				count++;
 		}
 	}
 
@@ -2416,29 +2476,25 @@ static void createTransUVs(bContext *C, TransInfo *t)
 	t->total= (propmode)? count: countsel;
 	t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(UV Editing)");
 	/* for each 2d uv coord a 3d vector is allocated, so that they can be
-	   treated just as if they were 3d verts */
+	 * treated just as if they were 3d verts */
 	t->data2d= MEM_callocN(t->total*sizeof(TransData2D), "TransObData2D(UV Editing)");
 
-	if(sima->flag & SI_CLIP_UV)
+	if (sima->flag & SI_CLIP_UV)
 		t->flag |= T_CLIP_UV;
 
 	td= t->data;
 	td2d= t->data2d;
 
-	for (efa= em->faces.first; efa; efa= efa->next) {
-		if ((tf=(MTFace *)efa->tmp.p)) {
-			if (propmode) {
-				UVsToTransData(sima, td++, td2d++, tf->uv[0], uvedit_uv_selected(scene, efa, tf, 0));
-				UVsToTransData(sima, td++, td2d++, tf->uv[1], uvedit_uv_selected(scene, efa, tf, 1));
-				UVsToTransData(sima, td++, td2d++, tf->uv[2], uvedit_uv_selected(scene, efa, tf, 2));
-				if(efa->v4)
-					UVsToTransData(sima, td++, td2d++, tf->uv[3], uvedit_uv_selected(scene, efa, tf, 3));
-			} else {
-				if(uvedit_uv_selected(scene, efa, tf, 0))				UVsToTransData(sima, td++, td2d++, tf->uv[0], 1);
-				if(uvedit_uv_selected(scene, efa, tf, 1))				UVsToTransData(sima, td++, td2d++, tf->uv[1], 1);
-				if(uvedit_uv_selected(scene, efa, tf, 2))				UVsToTransData(sima, td++, td2d++, tf->uv[2], 1);
-				if(efa->v4 && uvedit_uv_selected(scene, efa, tf, 3))	UVsToTransData(sima, td++, td2d++, tf->uv[3], 1);
-			}
+	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+		if (!BM_elem_flag_test(efa, BM_ELEM_TAG))
+			continue;
+
+		BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+			if (!propmode && !uvedit_uv_select_test(em, scene, l))
+				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));
 		}
 	}
 
@@ -2459,11 +2515,11 @@ void flushTransUVs(TransInfo *t)
 	invy= 1.0f/aspy;
 
 	/* flush to 2d vector from internally used 3d vector */
-	for(a=0, td= t->data2d; a<t->total; a++, td++) {
+	for (a=0, td= t->data2d; a<t->total; a++, td++) {
 		td->loc2d[0]= td->loc[0]*invx;
 		td->loc2d[1]= td->loc[1]*invy;
 
-		if((sima->flag & SI_PIXELSNAP) && (t->state != TRANS_CANCEL)) {
+		if ((sima->flag & SI_PIXELSNAP) && (t->state != TRANS_CANCEL)) {
 			td->loc2d[0]= (float)floor(width*td->loc2d[0] + 0.5f)/width;
 			td->loc2d[1]= (float)floor(height*td->loc2d[1] + 0.5f)/height;
 		}
@@ -2480,36 +2536,36 @@ int clipUVTransform(TransInfo *t, float *vec, int resize)
 	min[0]= min[1]= 0.0f;
 	max[0]= aspx; max[1]= aspy;
 
-	for(a=0, td= t->data; a<t->total; a++, td++) {
+	for (a=0, td= t->data; a<t->total; a++, td++) {
 		DO_MINMAX2(td->loc, min, max);
 	}
 
-	if(resize) {
-		if(min[0] < 0.0f && t->center[0] > 0.0f && t->center[0] < aspx*0.5f)
+	if (resize) {
+		if (min[0] < 0.0f && t->center[0] > 0.0f && t->center[0] < aspx*0.5f)
 			vec[0] *= t->center[0]/(t->center[0] - min[0]);
-		else if(max[0] > aspx && t->center[0] < aspx)
+		else if (max[0] > aspx && t->center[0] < aspx)
 			vec[0] *= (t->center[0] - aspx)/(t->center[0] - max[0]);
 		else
 			clipx= 0;
 
-		if(min[1] < 0.0f && t->center[1] > 0.0f && t->center[1] < aspy*0.5f)
+		if (min[1] < 0.0f && t->center[1] > 0.0f && t->center[1] < aspy*0.5f)
 			vec[1] *= t->center[1]/(t->center[1] - min[1]);
-		else if(max[1] > aspy && t->center[1] < aspy)
+		else if (max[1] > aspy && t->center[1] < aspy)
 			vec[1] *= (t->center[1] - aspy)/(t->center[1] - max[1]);
 		else
 			clipy= 0;
 	}
 	else {
-		if(min[0] < 0.0f)
+		if (min[0] < 0.0f)
 			vec[0] -= min[0];
-		else if(max[0] > aspx)
+		else if (max[0] > aspx)
 			vec[0] -= max[0]-aspx;
 		else
 			clipx= 0;
 
-		if(min[1] < 0.0f)
+		if (min[1] < 0.0f)
 			vec[1] -= min[1];
-		else if(max[1] > aspy)
+		else if (max[1] > aspy)
 			vec[1] -= max[1]-aspy;
 		else
 			clipy= 0;
@@ -2606,6 +2662,7 @@ static void createTransNlaData(bContext *C, TransInfo *t)
 	td= t->data;
 	t->customData= MEM_callocN(t->total*sizeof(TransDataNla), "TransDataNla (NLA Editor)");
 	tdn= t->customData;
+	t->flag |= T_FREE_CUSTOMDATA;
 	
 	/* loop 2: build transdata array */
 	for (ale= anim_data.first; ale; ale= ale->next) {
@@ -2998,7 +3055,7 @@ static TransData *ActionFCurveToTransData(TransData *td, TransData2D **td2dv, FC
 			if (FrameOnMouseSide(side, bezt->vec[1][0], cfra)) {
 				TimeToTransData(td, bezt->vec[1], adt);
 				
-				/*set flags to move handles as necassary*/
+				/*set flags to move handles as necessary*/
 				td->flag |= TD_MOVEHANDLE1|TD_MOVEHANDLE2;
 				td2d->h1 = bezt->vec[0];
 				td2d->h2 = bezt->vec[2];
@@ -3118,7 +3175,7 @@ static void createTransActionData(bContext *C, TransInfo *t)
 	for (ale= anim_data.first; ale; ale= ale->next) {
 		AnimData *adt= ANIM_nla_mapping_get(&ac, ale);
 		
-		/* convert current-frame to action-time (slightly less accurate, espcially under
+		/* convert current-frame to action-time (slightly less accurate, especially under
 		 * higher scaling ratios, but is faster than converting all points)
 		 */
 		if (adt)
@@ -3174,7 +3231,7 @@ static void createTransActionData(bContext *C, TransInfo *t)
 			AnimData *adt= ANIM_nla_mapping_get(&ac, ale);
 			FCurve *fcu= (FCurve *)ale->key_data;
 			
-			/* convert current-frame to action-time (slightly less accurate, espcially under
+			/* convert current-frame to action-time (slightly less accurate, especially under
 			 * higher scaling ratios, but is faster than converting all points)
 			 */
 			if (adt)
@@ -3217,7 +3274,7 @@ static void createTransActionData(bContext *C, TransInfo *t)
 
 /* ********************* GRAPH EDITOR ************************* */
 
-/* Helper function for createTransGraphEditData, which is reponsible for associating
+/* Helper function for createTransGraphEditData, which is responsible for associating
  * source data with transform data
  */
 static void bezt_to_transdata (TransData *td, TransData2D *td2d, AnimData *adt, BezTriple *bezt, 
@@ -3345,7 +3402,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
 		AnimData *adt= ANIM_nla_mapping_get(&ac, ale);
 		FCurve *fcu= (FCurve *)ale->key_data;
 		
-		/* convert current-frame to action-time (slightly less accurate, espcially under
+		/* convert current-frame to action-time (slightly less accurate, especially under
 		 * higher scaling ratios, but is faster than converting all points)
 		 */
 		if (adt)
@@ -3366,7 +3423,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
 
 				if (ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE)) {
 					/* for 'normal' pivots - just include anything that is selected.
-					   this works a bit differently in translation modes */
+					 * this works a bit differently in translation modes */
 					if (sel2) count++;
 					else {
 						if (sel1) count++;
@@ -3436,7 +3493,7 @@ static void createTransGraphEditData(bContext *C, TransInfo *t)
 		FCurve *fcu= (FCurve *)ale->key_data;
 		short intvals= (fcu->flag & FCURVE_INT_VALUES);
 		
-		/* convert current-frame to action-time (slightly less accurate, espcially under
+		/* convert current-frame to action-time (slightly less accurate, especially under
 		 * higher scaling ratios, but is faster than converting all points)
 		 */
 		if (adt)
@@ -3593,7 +3650,7 @@ static void sort_time_beztmaps (BeztMap *bezms, int totvert, const short UNUSED(
 			}
 			
 			/* do we need to check if the handles need to be swapped?
-			 * optimisation: this only needs to be performed in the first loop
+			 * optimization: this only needs to be performed in the first loop
 			 */
 			if (bezm->swapHs == 0) {
 				if ( (bezm->bezt->vec[0][0] > bezm->bezt->vec[1][0]) &&
@@ -3626,7 +3683,7 @@ static void beztmap_to_data (TransInfo *t, FCurve *fcu, BeztMap *bezms, int totv
 	/* dynamically allocate an array of chars to mark whether an TransData's
 	 * pointers have been fixed already, so that we don't override ones that are
 	 * already done
-	  */
+	 */
 	adjusted= MEM_callocN(t->total, "beztmap_adjusted_map");
 	
 	/* for each beztmap item, find if it is used anywhere */
@@ -3662,9 +3719,9 @@ static void beztmap_to_data (TransInfo *t, FCurve *fcu, BeztMap *bezms, int totv
 				td2d->loc2d= (bezts + bezm->newIndex)->vec[1];
 					
 				/* if only control point is selected, the handle pointers need to be updated as well */
-				if(td2d->h1)
+				if (td2d->h1)
 					td2d->h1= (bezts + bezm->newIndex)->vec[0];
-				if(td2d->h2)
+				if (td2d->h2)
 					td2d->h2= (bezts + bezm->newIndex)->vec[2];
 					
 				adjusted[j] = 1;
@@ -3672,7 +3729,7 @@ static void beztmap_to_data (TransInfo *t, FCurve *fcu, BeztMap *bezms, int totv
 
 			/* the handle type pointer has to be updated too */
 			if (adjusted[j] && td->flag & TD_BEZTRIPLE && td->hdata) {
-				if(bezm->swapHs == 1) {
+				if (bezm->swapHs == 1) {
 					td->hdata->h1 = &(bezts + bezm->newIndex)->h2;
 					td->hdata->h2 = &(bezts + bezm->newIndex)->h1;
 				}
@@ -3789,7 +3846,7 @@ void flushTransGraphData(TransInfo *t)
 /* ******************* Sequencer Transform data ******************* */
 
 /* This function applies the rules for transforming a strip so duplicate
- * checks dont need to be added in multiple places.
+ * checks don't need to be added in multiple places.
  *
  * recursive, count and flag MUST be set.
  *
@@ -3821,8 +3878,8 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count
 			else if (t->frame_side=='L' && left >= cfra)	*recursive= 0;
 			else											*recursive= 1;
 
-			*count= 0;
-			*flag= 0;
+			*count= 1;
+			*flag= (seq->flag | SELECT) & ~(SEQ_LEFTSEL|SEQ_RIGHTSEL);
 		}
 		else {
 
@@ -3841,7 +3898,8 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count
 				else					*flag |= SEQ_LEFTSEL;
 			}
 		}
-	} else {
+	}
+	else {
 
 		t->frame_side= 'B';
 
@@ -3861,7 +3919,8 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count
 				if ((seq->flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL)) == (SEQ_LEFTSEL|SEQ_RIGHTSEL)) {
 					*flag= seq->flag;
 					*count= 2; /* we need 2 transdata's */
-				} else {
+				}
+				else {
 					*flag= seq->flag;
 					*count= 1; /* selected or with a handle selected */
 				}
@@ -3869,7 +3928,7 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count
 				/* Recursive */
 
 				if ((seq->type == SEQ_META) && ((seq->flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL)) == 0)) {
-					/* if any handles are selected, dont recurse */
+					/* if any handles are selected, don't recurse */
 					*recursive = 1;
 				}
 				else {
@@ -3887,8 +3946,8 @@ static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count
 #else
 			if (seq->type == SEQ_META) {
 				/* Meta's can only directly be moved between channels since they
-				 * dont have their start and length set directly (children affect that)
-				 * since this Meta is nested we dont need any of its data infact.
+				 * don't have their start and length set directly (children affect that)
+				 * since this Meta is nested we don't need any of its data infact.
 				 * calc_sequence() will update its settings when run on the toplevel meta */
 				*flag= 0;
 				*count= 0;
@@ -4037,7 +4096,7 @@ static void freeSeqData(TransInfo *t)
 {
 	Editing *ed= seq_give_editing(t->scene, FALSE);
 
-	if(ed != NULL) {
+	if (ed != NULL) {
 		ListBase *seqbasep= ed->seqbasep;
 		TransData *td= t->data;
 		int a;
@@ -4054,7 +4113,7 @@ static void freeSeqData(TransInfo *t)
 #if 0		// default 2.4 behavior
 
 			/* flush to 2d vector from internally used 3d vector */
-			for(a=0; a<t->total; a++, td++) {
+			for (a=0; a<t->total; a++, td++) {
 				if ((seq != seq_prev) && (seq->depth==0) && (seq->flag & SEQ_OVERLAP)) {
 				seq= ((TransDataSeq *)td->extra)->seq;
 					shuffle_seq(seqbasep, seq);
@@ -4067,7 +4126,7 @@ static void freeSeqData(TransInfo *t)
 			{
 				int overlap= 0;
 
-				for(a=0; a<t->total; a++, td++) {
+				for (a=0; a<t->total; a++, td++) {
 					seq_prev= NULL;
 					seq= ((TransDataSeq *)td->extra)->seq;
 					if ((seq != seq_prev) && (seq->depth==0) && (seq->flag & SEQ_OVERLAP)) {
@@ -4077,18 +4136,18 @@ static void freeSeqData(TransInfo *t)
 					seq_prev= seq;
 				}
 
-				if(overlap) {
+				if (overlap) {
 					int has_effect= 0;
-					for(seq= seqbasep->first; seq; seq= seq->next)
+					for (seq= seqbasep->first; seq; seq= seq->next)
 						seq->tmp= NULL;
 
 					td= t->data;
 					seq_prev= NULL;
-					for(a=0; a<t->total; a++, td++) {
+					for (a=0; a<t->total; a++, td++) {
 						seq= ((TransDataSeq *)td->extra)->seq;
 						if ((seq != seq_prev)) {
 							/* check effects strips, we cant change their time */
-							if((seq->type & SEQ_EFFECT) && seq->seq1) {
+							if ((seq->type & SEQ_EFFECT) && seq->seq1) {
 								has_effect= TRUE;
 							}
 							else {
@@ -4100,14 +4159,14 @@ static void freeSeqData(TransInfo *t)
 
 					shuffle_seq_time(seqbasep, t->scene);
 
-					if(has_effect) {
+					if (has_effect) {
 						/* update effects strips based on strips just moved in time */
 						td= t->data;
 						seq_prev= NULL;
-						for(a=0; a<t->total; a++, td++) {
+						for (a=0; a<t->total; a++, td++) {
 							seq= ((TransDataSeq *)td->extra)->seq;
 							if ((seq != seq_prev)) {
-								if((seq->type & SEQ_EFFECT) && seq->seq1) {
+								if ((seq->type & SEQ_EFFECT) && seq->seq1) {
 									calc_sequence(t->scene, seq);
 								}
 							}
@@ -4116,11 +4175,11 @@ static void freeSeqData(TransInfo *t)
 						/* now if any effects _still_ overlap, we need to move them up */
 						td= t->data;
 						seq_prev= NULL;
-						for(a=0; a<t->total; a++, td++) {
+						for (a=0; a<t->total; a++, td++) {
 							seq= ((TransDataSeq *)td->extra)->seq;
 							if ((seq != seq_prev)) {
-								if((seq->type & SEQ_EFFECT) && seq->seq1) {
-									if(seq_test_overlap(seqbasep, seq)) {
+								if ((seq->type & SEQ_EFFECT) && seq->seq1) {
+									if (seq_test_overlap(seqbasep, seq)) {
 										shuffle_seq(seqbasep, seq, t->scene);
 									}
 								}
@@ -4132,9 +4191,9 @@ static void freeSeqData(TransInfo *t)
 			}
 #endif
 
-			for(seq= seqbasep->first; seq; seq= seq->next) {
+			for (seq= seqbasep->first; seq; seq= seq->next) {
 				/* We might want to build a list of effects that need to be updated during transform */
-				if(seq->type & SEQ_EFFECT) {
+				if (seq->type & SEQ_EFFECT) {
 					if		(seq->seq1 && seq->seq1->flag & SELECT) calc_sequence(t->scene, seq);
 					else if	(seq->seq2 && seq->seq2->flag & SELECT) calc_sequence(t->scene, seq);
 					else if	(seq->seq3 && seq->seq3->flag & SELECT) calc_sequence(t->scene, seq);
@@ -4145,7 +4204,7 @@ static void freeSeqData(TransInfo *t)
 		}
 		else {
 			/* Cancelled, need to update the strips display */
-			for(a=0; a<t->total; a++, td++) {
+			for (a=0; a<t->total; a++, td++) {
 				seq= ((TransDataSeq *)td->extra)->seq;
 				if ((seq != seq_prev) && (seq->depth==0)) {
 					calc_sequence_disp(t->scene, seq);
@@ -4155,9 +4214,9 @@ static void freeSeqData(TransInfo *t)
 		}
 	}
 
-	if (t->customData) {
+	if ((t->customData != NULL) && (t->flag & T_FREE_CUSTOMDATA)) {
 		MEM_freeN(t->customData);
-		t->customData= NULL;
+		t->customData = NULL;
 	}
 	if (t->data) {
 		MEM_freeN(t->data); // XXX postTrans usually does this
@@ -4201,12 +4260,12 @@ static void createTransSeqData(bContext *C, TransInfo *t)
 #ifdef XXX_DURIAN_ANIM_TX_HACK
 	{
 		Sequence *seq;
-		for(seq= ed->seqbasep->first; seq; seq= seq->next) {
+		for (seq= ed->seqbasep->first; seq; seq= seq->next) {
 			/* hack */
-			if((seq->flag & SELECT)==0 && seq->type & SEQ_EFFECT) {
+			if ((seq->flag & SELECT)==0 && seq->type & SEQ_EFFECT) {
 				Sequence *seq_user;
 				int i;
-				for(i=0; i<3; i++) {
+				for (i=0; i<3; i++) {
 					seq_user= *((&seq->seq1) + i);
 					if ( seq_user && (seq_user->flag & SELECT) &&
 					     !(seq_user->flag & SEQ_LOCK) &&
@@ -4232,7 +4291,8 @@ static void createTransSeqData(bContext *C, TransInfo *t)
 
 	td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransSeq TransData");
 	td2d = t->data2d = MEM_callocN(t->total*sizeof(TransData2D), "TransSeq TransData2D");
-	tdsq = t->customData= MEM_callocN(t->total*sizeof(TransDataSeq), "TransSeq TransDataSeq");
+	tdsq = t->customData = MEM_callocN(t->total*sizeof(TransDataSeq), "TransSeq TransDataSeq");
+	t->flag |= T_FREE_CUSTOMDATA;
 
 
 
@@ -4299,7 +4359,7 @@ static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
 
 	td->con= ob->constraints.first;
 
-	/* hack: tempolarily disable tracking and/or constraints when getting
+	/* hack: temporarily disable tracking and/or constraints when getting
 	 *		object matrix, if tracking is on, or if constraints don't need
 	 * 		inverse correction to stop it from screwing up space conversion
 	 *		matrix later
@@ -4344,8 +4404,8 @@ 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 implimented
-		// copy_v3_v3(td->ext->drotAxis, ob->drotAxis);	// XXX, not implimented
+		// td->ext->drotAngle= ob->drotAngle;			// XXX, not implemented
+		// copy_v3_v3(td->ext->drotAxis, ob->drotAxis);	// XXX, not implemented
 	}
 	else {
 		td->ext->rot= NULL;
@@ -4402,13 +4462,13 @@ static void set_trans_object_base_flags(TransInfo *t)
 	View3D *v3d = t->view;
 
 	/*
-	 if Base selected and has parent selected:
-	 base->flag= BA_WAS_SEL
+	 * if Base selected and has parent selected:
+	 * base->flag= BA_WAS_SEL
 	 */
 	Base *base;
 
 	/* don't do it if we're not actually going to recalculate anything */
-	if(t->mode == TFM_DUMMY)
+	if (t->mode == TFM_DUMMY)
 		return;
 
 	/* makes sure base flags and object flags are identical */
@@ -4416,23 +4476,23 @@ static void set_trans_object_base_flags(TransInfo *t)
 
 	/* handle pending update events, otherwise they got copied below */
 	for (base= scene->base.first; base; base= base->next) {
-		if(base->object->recalc)
+		if (base->object->recalc)
 			object_handle_update(t->scene, base->object);
 	}
 
 	for (base= scene->base.first; base; base= base->next) {
 		base->flag &= ~BA_WAS_SEL;
 
-		if(TESTBASELIB_BGMODE(v3d, scene, base)) {
+		if (TESTBASELIB_BGMODE(v3d, scene, base)) {
 			Object *ob= base->object;
 			Object *parsel= ob->parent;
 
 			/* if parent selected, deselect */
-			while(parsel) {
-				if(parsel->flag & SELECT) {
+			while (parsel) {
+				if (parsel->flag & SELECT) {
 					Base *parbase = object_in_scene(parsel, scene);
-					if(parbase) { /* in rare cases this can fail */
-						if TESTBASELIB_BGMODE(v3d, scene, parbase) {
+					if (parbase) { /* in rare cases this can fail */
+						if (TESTBASELIB_BGMODE(v3d, scene, parbase)) {
 							break;
 						}
 					}
@@ -4440,12 +4500,13 @@ static void set_trans_object_base_flags(TransInfo *t)
 				parsel= parsel->parent;
 			}
 
-			if(parsel)
+			if (parsel)
 			{
 				/* rotation around local centers are allowed to propagate */
 				if ((t->mode == TFM_ROTATION || t->mode == TFM_TRACKBALL)  && t->around == V3D_LOCAL) {
 					base->flag |= BA_TRANSFORM_CHILD;
-				} else {
+				}
+				else {
 					base->flag &= ~SELECT;
 					base->flag |= BA_WAS_SEL;
 				}
@@ -4461,9 +4522,9 @@ static void set_trans_object_base_flags(TransInfo *t)
 	/* and we store them temporal in base (only used for transform code) */
 	/* this because after doing updates, the object->recalc is cleared */
 	for (base= scene->base.first; base; base= base->next) {
-		if(base->object->recalc & OB_RECALC_OB)
+		if (base->object->recalc & OB_RECALC_OB)
 			base->flag |= BA_HAS_RECALC_OB;
-		if(base->object->recalc & OB_RECALC_DATA)
+		if (base->object->recalc & OB_RECALC_DATA)
 			base->flag |= BA_HAS_RECALC_DATA;
 	}
 }
@@ -4497,11 +4558,11 @@ static int count_proportional_objects(TransInfo *t)
 	{
 		/* mark all parents */
 		for (base= scene->base.first; base; base= base->next) {
-			if(TESTBASELIB_BGMODE(v3d, scene, base)) {
+			if (TESTBASELIB_BGMODE(v3d, scene, base)) {
 				Object *parent = base->object->parent;
 	
 				/* flag all parents */
-				while(parent) {
+				while (parent) {
 					parent->flag |= BA_TRANSFORM_PARENT;
 					parent = parent->parent;
 				}
@@ -4541,9 +4602,9 @@ static int count_proportional_objects(TransInfo *t)
 	/* and we store them temporal in base (only used for transform code) */
 	/* this because after doing updates, the object->recalc is cleared */
 	for (base= scene->base.first; base; base= base->next) {
-		if(base->object->recalc & OB_RECALC_OB)
+		if (base->object->recalc & OB_RECALC_OB)
 			base->flag |= BA_HAS_RECALC_OB;
-		if(base->object->recalc & OB_RECALC_DATA)
+		if (base->object->recalc & OB_RECALC_DATA)
 			base->flag |= BA_HAS_RECALC_DATA;
 	}
 
@@ -4557,7 +4618,7 @@ static void clear_trans_object_base_flags(TransInfo *t)
 
 	for (base= sce->base.first; base; base = base->next)
 	{
-		if(base->flag & BA_WAS_SEL)
+		if (base->flag & BA_WAS_SEL)
 			base->flag |= SELECT;
 
 		base->flag &= ~(BA_WAS_SEL|BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA|BA_TEMP_TAG|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT);
@@ -4682,7 +4743,7 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o
 		float cfra= (float)CFRA;
 		short flag= 0;
 		
-		/* flag is initialised from UserPref keyframing settings
+		/* flag is initialized from UserPref keyframing settings
 		 *	- special exception for targetless IK - INSERTKEY_MATRIX keyframes should get
 		 * 	  visual keyframes even if flag not set, as it's not that useful otherwise
 		 *	  (for quick animation recording)
@@ -4807,7 +4868,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
 {
 	Object *ob;
 //	short redrawipo=0, resetslowpar=1;
-	int cancelled= (t->state == TRANS_CANCEL);
+	int canceled= (t->state == TRANS_CANCEL);
 	short duplicate= (t->mode == TFM_TIME_DUPLICATE);
 	
 	/* early out when nothing happened */
@@ -4816,8 +4877,29 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
 	
 	if (t->spacetype==SPACE_VIEW3D) {
 		if (t->obedit) {
-			if (cancelled==0) {
-				EM_automerge(t->scene, t->obedit, 1);
+			if (canceled==0) {
+				/* we need to delete the temporary faces before automerging */
+				if (t->mode == TFM_EDGE_SLIDE) {
+					SlideData *sld = t->customData;
+
+					/* handle multires re-projection, done
+					 * on transform completion since it's
+					 * really slow -joeedh */
+					projectSVData(t, TRUE);
+
+					/* free temporary faces to avoid automerging and deleting
+					 * during cleanup - psy-fi */
+					freeSlideTempFaces(sld);
+				}
+				EDBM_automerge(t->scene, t->obedit, 1);
+			}
+			else {
+				if (t->mode == TFM_EDGE_SLIDE) {
+					SlideData *sld = t->customData;
+
+					sld->perc = 0.0;
+					projectSVData(t, FALSE);
+				}
 			}
 		}
 	}
@@ -4830,12 +4912,12 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
 
 		/* marker transform, not especially nice but we may want to move markers
 		 * at the same time as keyframes in the dope sheet. */
-		if ((sseq->flag & SEQ_MARKER_TRANS) && (cancelled == 0)) {
+		if ((sseq->flag & SEQ_MARKER_TRANS) && (canceled == 0)) {
 			/* cant use , TFM_TIME_EXTEND
 			 * for some reason EXTEND is changed into TRANSLATE, so use frame_side instead */
 
-			if(t->mode == TFM_SEQ_SLIDE) {
-				if(t->frame_side == 'B')
+			if (t->mode == TFM_SEQ_SLIDE) {
+				if (t->frame_side == 'B')
 					ED_markers_post_apply_transform(&t->scene->markers, t->scene, TFM_TIME_TRANSLATE, t->values[0], t->frame_side);
 			}
 			else if (ELEM(t->frame_side, 'L', 'R')) {
@@ -4848,19 +4930,19 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
 		SpaceNode *snode= (SpaceNode *)t->sa->spacedata.first;
 		ED_node_update_hierarchy(C, snode->edittree);
 		
-		if(cancelled == 0)
+		if (canceled == 0)
 			ED_node_link_insert(t->sa);
 		
 		/* clear link line */
 		ED_node_link_intersect_test(t->sa, 0);
 	}
 	else if (t->spacetype == SPACE_CLIP) {
-		SpaceClip *sc= t->sa->spacedata.first;
-		MovieClip *clip= ED_space_clip(sc);
+		SpaceClip *sc = t->sa->spacedata.first;
+		MovieClip *clip = ED_space_clip(sc);
 
-		if(t->scene->nodetree) {
+		if (t->scene->nodetree) {
 			/* tracks can be used for stabilization nodes,
-			   flush update for such nodes */
+			 * flush update for such nodes */
 			nodeUpdateID(t->scene->nodetree, &clip->id);
 			WM_event_add_notifier(C, NC_SCENE|ND_NODES, NULL);
 		}
@@ -4869,7 +4951,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
 		SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
 		bAnimContext ac;
 		
-		/* initialise relevant anim-context 'context' data */
+		/* initialize relevant anim-context 'context' data */
 		if (ANIM_animdata_get_context(C, &ac) == 0)
 			return;
 			
@@ -4890,11 +4972,11 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
 				
 				/* 3 cases here for curve cleanups:
 				 * 1) NOTRANSKEYCULL on     -> cleanup of duplicates shouldn't be done
-				 * 2) cancelled == 0        -> user confirmed the transform, so duplicates should be removed
-				 * 3) cancelled + duplicate -> user cancelled the transform, but we made duplicates, so get rid of these
+				 * 2) canceled == 0        -> user confirmed the transform, so duplicates should be removed
+				 * 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these
 				 */
 				if ( (saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
-					 ((cancelled == 0) || (duplicate)) )
+					 ((canceled == 0) || (duplicate)) )
 				{
 					if (adt) {
 						ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 1);
@@ -4921,11 +5003,11 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
 			
 			/* 3 cases here for curve cleanups:
 			 * 1) NOTRANSKEYCULL on     -> cleanup of duplicates shouldn't be done
-			 * 2) cancelled == 0        -> user confirmed the transform, so duplicates should be removed
-			 * 3) cancelled + duplicate -> user cancelled the transform, but we made duplicates, so get rid of these
+			 * 2) canceled == 0        -> user confirmed the transform, so duplicates should be removed
+			 * 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these
 			 */
 			if ( (saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
-				 ((cancelled == 0) || (duplicate)) )
+				 ((canceled == 0) || (duplicate)) )
 			{
 				posttrans_action_clean(&ac, (bAction *)ac.data);
 			}
@@ -4934,11 +5016,11 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
 			/* remove duplicate frames and also make sure points are in order! */
 				/* 3 cases here for curve cleanups:
 				 * 1) NOTRANSKEYCULL on     -> cleanup of duplicates shouldn't be done
-				 * 2) cancelled == 0        -> user confirmed the transform, so duplicates should be removed
-				 * 3) cancelled + duplicate -> user cancelled the transform, but we made duplicates, so get rid of these
+				 * 2) canceled == 0        -> user confirmed the transform, so duplicates should be removed
+				 * 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these
 				 */
 			if ( (saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
-				 ((cancelled == 0) || (duplicate)) )
+				 ((canceled == 0) || (duplicate)) )
 			{
 				bGPdata *gpd;
 				
@@ -4954,7 +5036,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
 		/* marker transform, not especially nice but we may want to move markers
 		 * at the same time as keyframes in the dope sheet. 
 		 */
-		if ((saction->flag & SACTION_MARKERS_MOVE) && (cancelled == 0)) {
+		if ((saction->flag & SACTION_MARKERS_MOVE) && (canceled == 0)) {
 			if (t->mode == TFM_TIME_TRANSLATE) {
 #if 0
 				if (ELEM(t->frame_side, 'L', 'R')) { /* TFM_TIME_EXTEND */
@@ -4984,7 +5066,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
 		bAnimContext ac;
 		const short use_handle = !(sipo->flag & SIPO_NOHANDLES);
 		
-		/* initialise relevant anim-context 'context' data */
+		/* initialize relevant anim-context 'context' data */
 		if (ANIM_animdata_get_context(C, &ac) == 0)
 			return;
 		
@@ -5003,11 +5085,11 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
 				
 				/* 3 cases here for curve cleanups:
 				 * 1) NOTRANSKEYCULL on     -> cleanup of duplicates shouldn't be done
-				 * 2) cancelled == 0        -> user confirmed the transform, so duplicates should be removed
-				 * 3) cancelled + duplicate -> user cancelled the transform, but we made duplicates, so get rid of these
+				 * 2) canceled == 0        -> user confirmed the transform, so duplicates should be removed
+				 * 3) canceled + duplicate -> user canceled the transform, but we made duplicates, so get rid of these
 				 */
 				if ( (sipo->flag & SIPO_NOTRANSKEYCULL)==0 &&
-					 ((cancelled == 0) || (duplicate)) )
+					 ((canceled == 0) || (duplicate)) )
 				{
 					if (adt) {
 						ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 0);
@@ -5028,13 +5110,13 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
 		 * Note: if the refresh is really needed after cancel then some way
 		 *       has to be added to not update handle types (see bug 22289).
 		 */
-		if(!cancelled)
+		if (!canceled)
 			ANIM_editkeyframes_refresh(&ac);
 	}
 	else if (t->spacetype == SPACE_NLA) {
 		bAnimContext ac;
 		
-		/* initialise relevant anim-context 'context' data */
+		/* initialize relevant anim-context 'context' data */
 		if (ANIM_animdata_get_context(C, &ac) == 0)
 			return;
 			
@@ -5067,7 +5149,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
 	else if (t->obedit) {
 		if (t->obedit->type == OB_MESH)
 		{
-			EditMesh *em = ((Mesh *)t->obedit->data)->edit_mesh;
+			BMEditMesh *em = BMEdit_FromObject(t->obedit);
 			/* table needs to be created for each edit command, since vertices can move etc */
 			mesh_octree_table(t->obedit, em, NULL, 'e');
 		}
@@ -5080,7 +5162,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
 		ob= t->poseobj;
 		arm= ob->data;
 
-		if((t->flag & T_AUTOIK) && (t->options & CTX_AUTOCONFIRM)) {
+		if ((t->flag & T_AUTOIK) && (t->options & CTX_AUTOCONFIRM)) {
 			/* when running transform non-interactively (operator exec),
 			 * we need to update the pose otherwise no updates get called during
 			 * transform and the auto-ik is not applied. see [#26164] */
@@ -5089,25 +5171,25 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
 		}
 
 		/* set BONE_TRANSFORM flags for autokey, manipulator draw might have changed them */
-		if (!cancelled && (t->mode != TFM_DUMMY))
+		if (!canceled && (t->mode != TFM_DUMMY))
 			count_set_pose_transflags(&t->mode, t->around, ob);
 
 		/* if target-less IK grabbing, we calculate the pchan transforms and clear flag */
-		if (!cancelled && t->mode==TFM_TRANSLATION)
+		if (!canceled && t->mode==TFM_TRANSLATION)
 			targetless_ik= apply_targetless_ik(ob);
 		else {
 			/* not forget to clear the auto flag */
 			for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) {
 				bKinematicConstraint *data= has_targetless_ik(pchan);
-				if(data) data->flag &= ~CONSTRAINT_IK_AUTO;
+				if (data) data->flag &= ~CONSTRAINT_IK_AUTO;
 			}
 		}
 
 		if (t->mode==TFM_TRANSLATION)
 			pose_grab_with_ik_clear(ob);
 
-		/* automatic inserting of keys and unkeyed tagging - only if transform wasn't cancelled (or TFM_DUMMY) */
-		if (!cancelled && (t->mode != TFM_DUMMY)) {
+		/* automatic inserting of keys and unkeyed tagging - only if transform wasn't canceled (or TFM_DUMMY) */
+		if (!canceled && (t->mode != TFM_DUMMY)) {
 			autokeyframe_pose_cb_func(C, t->scene, (View3D *)t->view, ob, t->mode, targetless_ik);
 			DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 		}
@@ -5125,7 +5207,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
 	          (ob->mode & OB_MODE_PARTICLE_EDIT) &&
 	          PE_get_current(t->scene, ob))
 	{
-		/* do nothing */ ;
+		/* do nothing */
 	}
 	else { /* Objects */
 		int i, recalcObPaths=0;
@@ -5144,8 +5226,8 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
 
 			/* flag object caches as outdated */
 			BKE_ptcache_ids_from_object(&pidlist, ob, t->scene, MAX_DUPLI_RECUR);
-			for(pid=pidlist.first; pid; pid=pid->next) {
-				if(pid->type != PTCACHE_TYPE_PARTICLES) /* particles don't need reset on geometry change */
+			for (pid=pidlist.first; pid; pid=pid->next) {
+				if (pid->type != PTCACHE_TYPE_PARTICLES) /* particles don't need reset on geometry change */
 					pid->cache->flag |= PTCACHE_OUTDATED;
 			}
 			BLI_freelistN(&pidlist);
@@ -5161,7 +5243,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
 			DAG_id_tag_update(&ob->id, OB_RECALC_OB);
 
 			/* Set autokey if necessary */
-			if (!cancelled) {
+			if (!canceled) {
 				autokeyframe_ob_cb_func(C, t->scene, (View3D *)t->view, ob, t->mode);
 				
 				/* only calculate paths if there are paths to be recalculated */
@@ -5179,7 +5261,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
 
 			/* recalculating the frame positions means we loose our original transform if its not auto-keyed [#24451]
 			 * this hack re-applies it, which is annoying, only alternatives are...
-			 * - dont recalc paths.
+			 * - don't recalc paths.
 			 * - have an object_handle_update() which gives is the new transform without touching the objects.
 			 * - only recalc paths on auto-keying.
 			 * - ED_objects_recalculate_paths could backup/restore transforms.
@@ -5194,7 +5276,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
 
 
 #if 0 // TRANSFORM_FIX_ME
-	if(resetslowpar)
+	if (resetslowpar)
 		reset_slowparents();
 #endif
 }
@@ -5210,7 +5292,7 @@ static void createTransObject(bContext *C, TransInfo *t)
 	/* count */
 	t->total= CTX_DATA_COUNT(C, selected_objects);
 	
-	if(!t->total) {
+	if (!t->total) {
 		/* clear here, main transform function escapes too */
 		clear_trans_object_base_flags(t);
 		return;
@@ -5314,7 +5396,7 @@ static void createTransNodeData(bContext *C, TransInfo *t)
 	SpaceNode *snode= t->sa->spacedata.first;
 	bNode *node;
 
-	if(!snode->edittree) {
+	if (!snode->edittree) {
 		t->total= 0;
 		return;
 	}
@@ -5362,20 +5444,21 @@ typedef struct TransDataTracking {
 	short coord;
 } TransDataTracking;
 
-static void markerToTransDataInit(TransData *td, TransData2D *td2d,
-			TransDataTracking *tdt, MovieTrackingTrack *track, int area, float *loc, float *rel, float *off)
+static void markerToTransDataInit(TransData *td, TransData2D *td2d, TransDataTracking *tdt, MovieTrackingTrack *track,
+                                  int area, float *loc, float *rel, float *off)
 {
-	int anchor = area==TRACK_AREA_POINT && off;
+	int anchor = area == TRACK_AREA_POINT && off;
 
 	tdt->mode = transDataTracking_ModeTracks;
 
-	if(anchor) {
+	if (anchor) {
 		td2d->loc[0] = rel[0]; /* hold original location */
 		td2d->loc[1] = rel[1];
 
 		tdt->loc= loc;
 		td2d->loc2d = loc; /* current location */
-	} else {
+	}
+	else {
 		td2d->loc[0] = loc[0]; /* hold original location */
 		td2d->loc[1] = loc[1];
 
@@ -5383,60 +5466,61 @@ static void markerToTransDataInit(TransData *td, TransData2D *td2d,
 	}
 	td2d->loc[2] = 0.0f;
 
-	tdt->relative= rel;
-	tdt->area= area;
+	tdt->relative = rel;
+	tdt->area = area;
 
-	tdt->markersnr= track->markersnr;
-	tdt->markers= track->markers;
+	tdt->markersnr = track->markersnr;
+	tdt->markers = track->markers;
 
-	if(rel) {
-		if(!anchor) {
-			td2d->loc[0]+= rel[0];
-			td2d->loc[1]+= rel[1];
+	if (rel) {
+		if (!anchor) {
+			td2d->loc[0] += rel[0];
+			td2d->loc[1] += rel[1];
 		}
 
 		copy_v2_v2(tdt->srelative, rel);
 	}
 
-	if(off)
+	if (off)
 		copy_v2_v2(tdt->soffset, off);
 
 	td->flag = 0;
 	td->loc = td2d->loc;
-	VECCOPY(td->center, td->loc);
-	VECCOPY(td->iloc, td->loc);
+	copy_v3_v3(td->center, td->loc);
+	copy_v3_v3(td->iloc, td->loc);
 
 	memset(td->axismtx, 0, sizeof(td->axismtx));
 	td->axismtx[2][2] = 1.0f;
 
-	td->ext= NULL; td->val= NULL;
+	td->ext= NULL;
+	td->val= NULL;
 
 	td->flag |= TD_SELECTED;
-	td->dist= 0.0;
+	td->dist = 0.0;
 
 	unit_m3(td->mtx);
 	unit_m3(td->smtx);
 }
 
 static void trackToTransData(SpaceClip *sc, TransData *td, TransData2D *td2d,
-			TransDataTracking *tdt, MovieTrackingTrack *track)
+                             TransDataTracking *tdt, MovieTrackingTrack *track)
 {
-	MovieTrackingMarker *marker= BKE_tracking_ensure_marker(track, sc->user.framenr);
+	MovieTrackingMarker *marker = BKE_tracking_ensure_marker(track, sc->user.framenr);
 
-	tdt->flag= marker->flag;
-	marker->flag&= ~(MARKER_DISABLED|MARKER_TRACKED);
+	tdt->flag = marker->flag;
+	marker->flag &= ~(MARKER_DISABLED|MARKER_TRACKED);
 
 	markerToTransDataInit(td++, td2d++, tdt++, track, TRACK_AREA_POINT, track->offset, marker->pos, track->offset);
 
-	if(track->flag&SELECT)
+	if (track->flag & SELECT)
 		markerToTransDataInit(td++, td2d++, tdt++, track, TRACK_AREA_POINT, marker->pos, NULL, NULL);
 
-	if(track->pat_flag&SELECT) {
+	if (track->pat_flag & SELECT) {
 		markerToTransDataInit(td++, td2d++, tdt++, track, TRACK_AREA_PAT, track->pat_min, marker->pos, NULL);
 		markerToTransDataInit(td++, td2d++, tdt++, track, TRACK_AREA_PAT, track->pat_max, marker->pos, NULL);
 	}
 
-	if(track->search_flag&SELECT) {
+	if (track->search_flag & SELECT) {
 		markerToTransDataInit(td++, td2d++, tdt++, track, TRACK_AREA_SEARCH, track->search_min, marker->pos, NULL);
 		markerToTransDataInit(td++, td2d++, tdt++, track, TRACK_AREA_SEARCH, track->search_max, marker->pos, NULL);
 	}
@@ -5444,10 +5528,12 @@ static void trackToTransData(SpaceClip *sc, TransData *td, TransData2D *td2d,
 
 static void transDataTrackingFree(TransInfo *t)
 {
-	TransDataTracking *tdt= t->customData;
+	TransDataTracking *tdt = t->customData;
+
+	if (tdt) {
+		if (tdt->smarkers)
+			MEM_freeN(tdt->smarkers);
 
-	if(tdt) {
-		if(tdt->smarkers) MEM_freeN(tdt->smarkers);
 		MEM_freeN(tdt);
 	}
 }
@@ -5458,7 +5544,7 @@ static void createTransTrackingTracksData(bContext *C, TransInfo *t)
 	TransData2D *td2d;
 	SpaceClip *sc = CTX_wm_space_clip(C);
 	MovieClip *clip = ED_space_clip(sc);
-	ListBase *tracksbase= BKE_tracking_get_tracks(&clip->tracking);
+	ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
 	MovieTrackingTrack *track;
 	MovieTrackingMarker *marker;
 	TransDataTracking *tdt;
@@ -5468,34 +5554,39 @@ static void createTransTrackingTracksData(bContext *C, TransInfo *t)
 	t->total = 0;
 
 	track = tracksbase->first;
-	while(track) {
-		if(TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_LOCKED)==0) {
-			marker= BKE_tracking_get_marker(track, framenr);
+	while (track) {
+		if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
+			marker = BKE_tracking_get_marker(track, framenr);
 
 			t->total++;	/* offset */
 
-			if(track->flag&SELECT) t->total++;
-			if(track->pat_flag&SELECT) t->total+= 2;
-			if(track->search_flag&SELECT) t->total+= 2;
+			if (track->flag & SELECT)
+				t->total++;
+
+			if (track->pat_flag & SELECT)
+				t->total+= 2;
+
+			if (track->search_flag & SELECT)
+				t->total+= 2;
 		}
 
 		track = track->next;
 	}
 
-	if(t->total==0)
+	if (t->total == 0)
 		return;
 
 	td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransTracking TransData");
 	td2d = t->data2d = MEM_callocN(t->total*sizeof(TransData2D), "TransTracking TransData2D");
 	tdt = t->customData = MEM_callocN(t->total*sizeof(TransDataTracking), "TransTracking TransDataTracking");
 
-	t->customFree= transDataTrackingFree;
+	t->customFree = transDataTrackingFree;
 
 	/* create actual data */
 	track = tracksbase->first;
-	while(track) {
-		if(TRACK_VIEW_SELECTED(sc, track) && (track->flag&TRACK_LOCKED)==0) {
-			marker= BKE_tracking_get_marker(track, framenr);
+	while (track) {
+		if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED) == 0) {
+			marker = BKE_tracking_get_marker(track, framenr);
 
 			trackToTransData(sc, td, td2d, tdt, track);
 
@@ -5504,20 +5595,29 @@ static void createTransTrackingTracksData(bContext *C, TransInfo *t)
 			td2d++;
 			tdt++;
 
-			if((marker->flag&MARKER_DISABLED)==0) {
-				if(track->flag&SELECT) {td++; td2d++; tdt++;}
-				if(track->pat_flag&SELECT) {td+= 2; td2d+= 2;tdt+=2;}
+			if ((marker->flag & MARKER_DISABLED) == 0) {
+				if (track->flag & SELECT) {
+					td++;
+					td2d++;
+					tdt++;
+				}
+
+				if (track->pat_flag & SELECT) {
+					td += 2;
+					td2d += 2;
+					tdt +=2;
+				}
 			}
 
-			if(track->search_flag&SELECT) {
-				td+= 2;
-				td2d+= 2;
-				tdt+= 2;
+			if (track->search_flag & SELECT) {
+				td += 2;
+				td2d += 2;
+				tdt += 2;
 
-				if(marker->flag&MARKER_DISABLED) {
-					td+= 3;
-					td2d+= 3;
-					tdt+= 3;
+				if (marker->flag & MARKER_DISABLED) {
+					td += 3;
+					td2d += 3;
+					tdt += 3;
 				};
 			}
 		}
@@ -5527,7 +5627,7 @@ static void createTransTrackingTracksData(bContext *C, TransInfo *t)
 }
 
 static void markerToTransCurveDataInit(TransData *td, TransData2D *td2d, TransDataTracking *tdt,
-									   MovieTrackingMarker *marker, MovieTrackingMarker *prev_marker,
+                                       MovieTrackingMarker *marker, MovieTrackingMarker *prev_marker,
                                        short coord, float size)
 {
 	float frames_delta = (marker->framenr - prev_marker->framenr);
@@ -5549,16 +5649,17 @@ static void markerToTransCurveDataInit(TransData *td, TransData2D *td2d, TransDa
 
 	td->flag = 0;
 	td->loc = td2d->loc;
-	VECCOPY(td->center, td->loc);
-	VECCOPY(td->iloc, td->loc);
+	copy_v3_v3(td->center, td->loc);
+	copy_v3_v3(td->iloc, td->loc);
 
 	memset(td->axismtx, 0, sizeof(td->axismtx));
 	td->axismtx[2][2] = 1.0f;
 
-	td->ext= NULL; td->val= NULL;
+	td->ext= NULL;
+	td->val= NULL;
 
 	td->flag |= TD_SELECTED;
-	td->dist= 0.0;
+	td->dist = 0.0;
 
 	unit_m3(td->mtx);
 	unit_m3(td->smtx);
@@ -5582,19 +5683,19 @@ static void createTransTrackingCurvesData(bContext *C, TransInfo *t)
 	t->total = 0;
 
 	track = tracksbase->first;
-	while(track) {
-		if(TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
-			for(i = 1; i < track->markersnr; i++) {
+	while (track) {
+		if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
+			for (i = 1; i < track->markersnr; i++) {
 				marker = &track->markers[i];
 				prev_marker = &track->markers[i-1];
 
-				if((marker->flag & MARKER_DISABLED) || (prev_marker->flag & MARKER_DISABLED))
+				if ((marker->flag & MARKER_DISABLED) || (prev_marker->flag & MARKER_DISABLED))
 					continue;
 
-				if(marker->flag & MARKER_GRAPH_SEL_X)
+				if (marker->flag & MARKER_GRAPH_SEL_X)
 					t->total += 1;
 
-				if(marker->flag & MARKER_GRAPH_SEL_Y)
+				if (marker->flag & MARKER_GRAPH_SEL_Y)
 					t->total += 1;
 			}
 		}
@@ -5602,7 +5703,7 @@ static void createTransTrackingCurvesData(bContext *C, TransInfo *t)
 		track = track->next;
 	}
 
-	if(t->total==0)
+	if (t->total == 0)
 		return;
 
 	td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransTracking TransData");
@@ -5613,23 +5714,23 @@ static void createTransTrackingCurvesData(bContext *C, TransInfo *t)
 
 	/* create actual data */
 	track = tracksbase->first;
-	while(track) {
-		if(TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
-			for(i = 1; i < track->markersnr; i++) {
+	while (track) {
+		if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
+			for (i = 1; i < track->markersnr; i++) {
 				marker = &track->markers[i];
 				prev_marker = &track->markers[i-1];
 
-				if((marker->flag & MARKER_DISABLED) || (prev_marker->flag & MARKER_DISABLED))
+				if ((marker->flag & MARKER_DISABLED) || (prev_marker->flag & MARKER_DISABLED))
 					continue;
 
-				if(marker->flag & MARKER_GRAPH_SEL_X) {
+				if (marker->flag & MARKER_GRAPH_SEL_X) {
 					markerToTransCurveDataInit(td, td2d, tdt, marker, &track->markers[i-1], 0, width);
 					td += 1;
 					td2d += 1;
 					tdt += 1;
 				}
 
-				if(marker->flag & MARKER_GRAPH_SEL_Y) {
+				if (marker->flag & MARKER_GRAPH_SEL_Y) {
 					markerToTransCurveDataInit(td, td2d, tdt, marker, &track->markers[i-1], 1, height);
 
 					td += 1;
@@ -5651,13 +5752,13 @@ static void createTransTrackingData(bContext *C, TransInfo *t)
 
 	t->total = 0;
 
-	if(!clip || !BKE_movieclip_has_frame(clip, &sc->user))
+	if (!clip || !BKE_movieclip_has_frame(clip, &sc->user))
 		return;
 
-	if(!ELEM(t->mode, TFM_RESIZE, TFM_TRANSLATION))
+	if (!ELEM(t->mode, TFM_RESIZE, TFM_TRANSLATION))
 		return;
 
-	if(ar->regiontype == RGN_TYPE_PREVIEW) {
+	if (ar->regiontype == RGN_TYPE_PREVIEW) {
 		/* transformation was called from graph editor */
 		createTransTrackingCurvesData(C, t);
 	}
@@ -5669,44 +5770,49 @@ static void createTransTrackingData(bContext *C, TransInfo *t)
 static void cancelTransTracking(TransInfo *t)
 {
 	TransDataTracking *tdt = t->customData;
-	SpaceClip *sc= t->sa->spacedata.first;
-	MovieClip *clip= ED_space_clip(sc);
-	ListBase *tracksbase= BKE_tracking_get_tracks(&clip->tracking);
+	SpaceClip *sc = t->sa->spacedata.first;
+	MovieClip *clip = ED_space_clip(sc);
+	ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
 	MovieTrackingTrack *track;
 	MovieTrackingMarker *marker;
 	int a, framenr = sc->user.framenr;
 
-	if(tdt->mode == transDataTracking_ModeTracks) {
+	if (tdt->mode == transDataTracking_ModeTracks) {
 		track = tracksbase->first;
-		while(track) {
-			if(TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
+		while (track) {
+			if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
 				marker = BKE_tracking_get_marker(track, framenr);
 				marker->flag = tdt->flag;
 
 				tdt++;
 
-				if(track->flag&SELECT) tdt++;
-				if(track->pat_flag&SELECT) tdt += 2;
-				if(track->search_flag&SELECT) tdt += 2;
+				if (track->flag & SELECT)
+					tdt++;
+
+				if (track->pat_flag & SELECT)
+					tdt += 2;
+
+				if (track->search_flag & SELECT)
+					tdt += 2;
 			}
 
 			track = track->next;
 		}
 	}
-	else if(tdt->mode == transDataTracking_ModeCurves) {
+	else if (tdt->mode == transDataTracking_ModeCurves) {
 		MovieTrackingMarker *prev_marker;
 
 		track = tracksbase->first;
-		while(track) {
-			if(TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
-				for(a = 1; a < track->markersnr; a++) {
+		while (track) {
+			if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
+				for (a = 1; a < track->markersnr; a++) {
 					marker = &track->markers[a];
 					prev_marker = &track->markers[a-1];
 
-					if((marker->flag & MARKER_DISABLED) || (prev_marker->flag & MARKER_DISABLED))
+					if ((marker->flag & MARKER_DISABLED) || (prev_marker->flag & MARKER_DISABLED))
 						continue;
 
-					if(marker->flag & (MARKER_GRAPH_SEL_X|MARKER_GRAPH_SEL_Y)) {
+					if (marker->flag & (MARKER_GRAPH_SEL_X|MARKER_GRAPH_SEL_Y)) {
 						marker->flag = tdt->flag;
 					}
 				}
@@ -5724,19 +5830,19 @@ void flushTransTracking(TransInfo *t)
 	TransDataTracking *tdt;
 	int a;
 
-	if(t->state == TRANS_CANCEL)
+	if (t->state == TRANS_CANCEL)
 		cancelTransTracking(t);
 
 	/* flush to 2d vector from internally used 3d vector */
-	for(a=0, td= t->data, td2d= t->data2d, tdt= t->customData; a<t->total; a++, td2d++, td++, tdt++) {
-		if(tdt->mode == transDataTracking_ModeTracks) {
-			if(t->flag&T_ALT_TRANSFORM) {
-				if(tdt->area==TRACK_AREA_POINT && tdt->relative) {
+	for (a=0, td= t->data, td2d= t->data2d, tdt= t->customData; a<t->total; a++, td2d++, td++, tdt++) {
+		if (tdt->mode == transDataTracking_ModeTracks) {
+			if (t->flag & T_ALT_TRANSFORM) {
+				if (tdt->area == TRACK_AREA_POINT && tdt->relative) {
 					float d[2], d2[2];
 
-					if(!tdt->smarkers) {
-						tdt->smarkers= MEM_callocN(sizeof(*tdt->smarkers)*tdt->markersnr, "flushTransTracking markers");
-						for(a= 0; a<tdt->markersnr; a++)
+					if (!tdt->smarkers) {
+						tdt->smarkers = MEM_callocN(sizeof(*tdt->smarkers)*tdt->markersnr, "flushTransTracking markers");
+						for (a = 0; a < tdt->markersnr; a++)
 							copy_v2_v2(tdt->smarkers[a], tdt->markers[a].pos);
 					}
 
@@ -5745,22 +5851,22 @@ void flushTransTracking(TransInfo *t)
 
 					sub_v2_v2v2(d2, td2d->loc, tdt->srelative);
 
-					for(a= 0; a<tdt->markersnr; a++)
+					for (a= 0; a<tdt->markersnr; a++)
 						add_v2_v2v2(tdt->markers[a].pos, tdt->smarkers[a], d2);
 
 					negate_v2_v2(td2d->loc2d, d);
 				}
 			}
 
-			if(tdt->area!=TRACK_AREA_POINT || tdt->relative==0) {
+			if (tdt->area!=TRACK_AREA_POINT || tdt->relative==0) {
 				td2d->loc2d[0] = td2d->loc[0];
 				td2d->loc2d[1] = td2d->loc[1];
 
-				if(tdt->relative)
+				if (tdt->relative)
 					sub_v2_v2(td2d->loc2d, tdt->relative);
 			}
 		}
-		else if(tdt->mode == transDataTracking_ModeCurves) {
+		else if (tdt->mode == transDataTracking_ModeCurves) {
 			td2d->loc2d[tdt->coord] = tdt->prev_pos[tdt->coord] + td2d->loc[1] * tdt->scale;
 		}
 	}
@@ -5779,7 +5885,7 @@ void createTransData(bContext *C, TransInfo *t)
 		t->ext = NULL;
 		t->flag |= T_EDIT;
 		createTransEdge(t);
-		if(t->data && t->flag & T_PROP_EDIT) {
+		if (t->data && t->flag & T_PROP_EDIT) {
 			sort_trans_data(t);	// makes selected become first in array
 			set_prop_dist(t, 1);
 			sort_trans_data_dist(t);
@@ -5792,7 +5898,7 @@ void createTransData(bContext *C, TransInfo *t)
 	else if (t->spacetype == SPACE_IMAGE) {
 		t->flag |= T_POINTS|T_2D_EDIT;
 		createTransUVs(C, t);
-		if(t->data && (t->flag & T_PROP_EDIT)) {
+		if (t->data && (t->flag & T_PROP_EDIT)) {
 			sort_trans_data(t);	// makes selected become first in array
 			set_prop_dist(t, 1);
 			sort_trans_data_dist(t);
@@ -5822,7 +5928,7 @@ void createTransData(bContext *C, TransInfo *t)
 		}
 #endif
 	}
-	else if(t->spacetype == SPACE_NODE) {
+	else if (t->spacetype == SPACE_NODE) {
 		t->flag |= T_2D_EDIT|T_POINTS;
 		createTransNodeData(C, t);
 		if (t->data && (t->flag & T_PROP_EDIT)) {
@@ -5840,7 +5946,7 @@ void createTransData(bContext *C, TransInfo *t)
 		if (t->obedit->type == OB_MESH) {
 			createTransEditVerts(C, t);
 		}
-		else if ELEM(t->obedit->type, OB_CURVE, OB_SURF) {
+		else if (ELEM(t->obedit->type, OB_CURVE, OB_SURF)) {
 			createTransCurveVerts(C, t);
 		}
 		else if (t->obedit->type==OB_LATTICE) {
@@ -5859,7 +5965,7 @@ void createTransData(bContext *C, TransInfo *t)
 
 		t->flag |= T_EDIT|T_POINTS;
 
-		if(t->data && t->flag & T_PROP_EDIT) {
+		if (t->data && t->flag & T_PROP_EDIT) {
 			if (ELEM(t->obedit->type, OB_CURVE, OB_MESH)) {
 				sort_trans_data(t);	// makes selected become first in array
 				set_prop_dist(t, 0);
@@ -5873,7 +5979,7 @@ void createTransData(bContext *C, TransInfo *t)
 		}
 
 		/* exception... hackish, we want bonesize to use bone orientation matrix (ton) */
-		if(t->mode==TFM_BONESIZE) {
+		if (t->mode==TFM_BONESIZE) {
 			t->flag &= ~(T_EDIT|T_POINTS);
 			t->flag |= T_POSE;
 			t->poseobj = ob;	/* <- tsk tsk, this is going to give issues one day */
@@ -5888,23 +5994,22 @@ void createTransData(bContext *C, TransInfo *t)
 		/* important that ob_armature can be set even when its not selected [#23412]
 		 * lines below just check is also visible */
 		Object *ob_armature= modifiers_isDeformedByArmature(ob);
-		if(ob_armature && ob_armature->mode & OB_MODE_POSE) {
+		if (ob_armature && ob_armature->mode & OB_MODE_POSE) {
 			Base *base_arm= object_in_scene(ob_armature, t->scene);
-			if(base_arm) {
+			if (base_arm) {
 				View3D *v3d = t->view;
-				if(BASE_VISIBLE(v3d, base_arm)) {
+				if (BASE_VISIBLE(v3d, base_arm)) {
 					createTransPose(t, ob_armature);
 				}
 			}
 			
 		}
 	}
-	else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT) 
-		&& PE_start_edit(PE_get_current(scene, ob))) {
+	else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT) && PE_start_edit(PE_get_current(scene, ob))) {
 		createTransParticleVerts(C, t);
 		t->flag |= T_POINTS;
 
-		if(t->data && t->flag & T_PROP_EDIT) {
+		if (t->data && t->flag & T_PROP_EDIT) {
 			sort_trans_data(t);	// makes selected become first in array
 			set_prop_dist(t, 1);
 			sort_trans_data_dist(t);
@@ -5915,13 +6020,13 @@ void createTransData(bContext *C, TransInfo *t)
 		 * transform ops redo clears sculpt/project undo stack.
 		 *
 		 * Could use 'OB_MODE_ALL_PAINT' since there are key conflicts,
-		 * transform + paint isnt well supported. */
+		 * transform + paint isn't well supported. */
 	}
 	else {
 		createTransObject(C, t);
 		t->flag |= T_OBJECT;
 
-		if(t->data && t->flag & T_PROP_EDIT) {
+		if (t->data && t->flag & T_PROP_EDIT) {
 			// selected objects are already first, no need to presort
 			set_prop_dist(t, 1);
 			sort_trans_data_dist(t);
@@ -5931,7 +6036,7 @@ void createTransData(bContext *C, TransInfo *t)
 		{
 			View3D *v3d = t->view;
 			RegionView3D *rv3d = CTX_wm_region_view3d(C);
-			if(rv3d && (t->flag & T_OBJECT) && v3d->camera == OBACT && rv3d->persp==RV3D_CAMOB)
+			if (rv3d && (t->flag & T_OBJECT) && v3d->camera == OBACT && rv3d->persp==RV3D_CAMOB)
 			{
 				t->flag |= T_CAMERA;
 			}
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 3c019c1..b500398 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -44,11 +44,17 @@
 #include "DNA_space_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_object_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_view3d_types.h"
 #include "DNA_modifier_types.h"
 #include "DNA_movieclip_types.h"
 
+#include "BLI_math.h"
+#include "BLI_blenlib.h"
+#include "BLI_rand.h"
+#include "BLI_utildefines.h"
+
 #include "RNA_access.h"
 
 //#include "BIF_screen.h"
@@ -71,6 +77,7 @@
 #include "BKE_mesh.h"
 #include "BKE_nla.h"
 #include "BKE_context.h"
+#include "BKE_tessmesh.h"
 #include "BKE_tracking.h"
 
 #include "ED_anim_api.h"
@@ -89,12 +96,6 @@
 
 //#include "BDR_unwrapper.h"
 
-#include "BLI_math.h"
-#include "BLI_blenlib.h"
-#include "BLI_editVert.h"
-#include "BLI_rand.h"
-#include "BLI_utildefines.h"
-
 #include "WM_types.h"
 #include "WM_api.h"
 
@@ -106,8 +107,6 @@
 
 #include "transform.h"
 
-extern ListBase editelems;
-
 /* ************************** Functions *************************** */
 
 void getViewVector(TransInfo *t, float coord[3], float vec[3])
@@ -148,17 +147,17 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
 		if ((md->type==eModifierType_Mirror) && (md->mode & eModifierMode_Realtime)) {
 			MirrorModifierData *mmd = (MirrorModifierData*) md;
 			
-			if(mmd->flag & MOD_MIR_CLIPPING) {
+			if (mmd->flag & MOD_MIR_CLIPPING) {
 				axis = 0;
-				if(mmd->flag & MOD_MIR_AXIS_X) {
+				if (mmd->flag & MOD_MIR_AXIS_X) {
 					axis |= 1;
 					tolerance[0] = mmd->tolerance;
 				}
-				if(mmd->flag & MOD_MIR_AXIS_Y) {
+				if (mmd->flag & MOD_MIR_AXIS_Y) {
 					axis |= 2;
 					tolerance[1] = mmd->tolerance;
 				}
-				if(mmd->flag & MOD_MIR_AXIS_Z) {
+				if (mmd->flag & MOD_MIR_AXIS_Z) {
 					axis |= 4;
 					tolerance[2] = mmd->tolerance;
 				}
@@ -175,7 +174,7 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
 						invert_m4_m4(imtx, mtx);
 					}
 					
-					for(i = 0 ; i < t->total; i++, td++) {
+					for (i = 0 ; i < t->total; i++, td++) {
 						int clip;
 						float loc[3], iloc[3];
 						
@@ -196,8 +195,8 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
 						}
 						
 						clip = 0;
-						if(axis & 1) {
-							if(fabsf(iloc[0])<=tolerance[0] ||
+						if (axis & 1) {
+							if (fabsf(iloc[0])<=tolerance[0] ||
 							   loc[0]*iloc[0]<0.0f)
 							{
 								loc[0]= 0.0f;
@@ -205,16 +204,16 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
 							}
 						}
 						
-						if(axis & 2) {
-							if(fabs(iloc[1])<=tolerance[1] ||
+						if (axis & 2) {
+							if (fabs(iloc[1])<=tolerance[1] ||
 							   loc[1]*iloc[1]<0.0f)
 							{
 								loc[1]= 0.0f;
 								clip = 1;
 							}
 						}
-						if(axis & 4) {
-							if(fabs(iloc[2])<=tolerance[2] ||
+						if (axis & 4) {
+							if (fabs(iloc[2])<=tolerance[2] ||
 							   loc[2]*iloc[2]<0.0f)
 							{
 								loc[2]= 0.0f;
@@ -236,13 +235,13 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
 }
 
 /* assumes obedit set to mesh object */
-static void editmesh_apply_to_mirror(TransInfo *t)
+static void editbmesh_apply_to_mirror(TransInfo *t)
 {
 	TransData *td = t->data;
-	EditVert *eve;
+	BMVert *eve;
 	int i;
 	
-	for(i = 0 ; i < t->total; i++, td++) {
+	for (i = 0 ; i < t->total; i++, td++) {
 		if (td->flag & TD_NOACTION)
 			break;
 		if (td->loc==NULL)
@@ -270,7 +269,7 @@ static void animrecord_check_state (Scene *scene, ID *id, wmTimer *animtimer)
 	ScreenAnimData *sad= (animtimer) ? animtimer->customdata : NULL;
 	
 	/* sanity checks */
-	if ELEM3(NULL, scene, id, sad)
+	if (ELEM3(NULL, scene, id, sad))
 		return;
 	
 	/* check if we need a new strip if:
@@ -338,7 +337,7 @@ static void recalcData_actedit(TransInfo *t)
 	bAnimListElem *ale;
 	int filter;
 	
-	/* initialise relevant anim-context 'context' data from TransInfo data */
+	/* initialize relevant anim-context 'context' data from TransInfo data */
 		/* NOTE: sync this with the code in ANIM_animdata_get_context() */
 	ac.scene= t->scene;
 	ac.obact= OBACT;
@@ -374,7 +373,6 @@ static void recalcData_actedit(TransInfo *t)
 		BLI_freelistN(&anim_data);
 	}
 }
-
 /* helper for recalcData() - for Graph Editor transforms */
 static void recalcData_graphedit(TransInfo *t)
 {
@@ -389,7 +387,7 @@ static void recalcData_graphedit(TransInfo *t)
 	int dosort = 0;
 	
 	
-	/* initialise relevant anim-context 'context' data from TransInfo data */
+	/* initialize relevant anim-context 'context' data from TransInfo data */
 		/* NOTE: sync this with the code in ANIM_animdata_get_context() */
 	scene= ac.scene= t->scene;
 	ac.obact= OBACT;
@@ -469,7 +467,7 @@ static void recalcData_nla(TransInfo *t)
 		if ((snla->flag & SNLA_NOREALTIMEUPDATES) == 0)
 			ANIM_id_update(t->scene, tdn->id);
 		
-		/* if cancelling transform, just write the values without validating, then move on */
+		/* if canceling transform, just write the values without validating, then move on */
 		if (t->state == TRANS_CANCEL) {
 			/* clear the values by directly overwriting the originals, but also need to restore
 			 * endpoints of neighboring transition-strips
@@ -500,7 +498,7 @@ static void recalcData_nla(TransInfo *t)
 			continue;
 		}
 		
-		/* firstly, check if the proposed transform locations would overlap with any neighbouring strips
+		/* firstly, check if the proposed transform locations would overlap with any neighboring strips
 		 * (barring transitions) which are absolute barriers since they are not being moved
 		 *
 		 * this is done as a iterative procedure (done 5 times max for now)
@@ -512,7 +510,7 @@ static void recalcData_nla(TransInfo *t)
 			if ((pExceeded && nExceeded) || (iter == 4) ) {
 				/* both endpoints exceeded (or iteration ping-pong'd meaning that we need a compromise)
 				 *	- simply crop strip to fit within the bounds of the strips bounding it
-				 *	- if there were no neighbours, clear the transforms (make it default to the strip's current values)
+				 *	- if there were no neighbors, clear the transforms (make it default to the strip's current values)
 				 */
 				if (strip->prev && strip->next) {
 					tdn->h1[0]= strip->prev->end;
@@ -629,7 +627,7 @@ static void recalcData_image(TransInfo *t)
 		SpaceImage *sima= t->sa->spacedata.first;
 		
 		flushTransUVs(t);
-		if(sima->flag & SI_LIVE_UNWRAP)
+		if (sima->flag & SI_LIVE_UNWRAP)
 			ED_uvedit_live_unwrap_re_solve();
 		
 		DAG_id_tag_update(t->obedit->data, 0);
@@ -639,31 +637,31 @@ static void recalcData_image(TransInfo *t)
 /* helper for recalcData() - for Movie Clip transforms */
 static void recalcData_clip(TransInfo *t)
 {
-	SpaceClip *sc= t->sa->spacedata.first;
-	MovieClip *clip= ED_space_clip(sc);
-	ListBase *tracksbase= BKE_tracking_get_tracks(&clip->tracking);
+	SpaceClip *sc = t->sa->spacedata.first;
+	MovieClip *clip = ED_space_clip(sc);
+	ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
 	MovieTrackingTrack *track;
 	
 	flushTransTracking(t);
 	
-	track= tracksbase->first;
-	while(track) {
-		if(TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
+	track = tracksbase->first;
+	while (track) {
+		if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
 			if (t->mode == TFM_TRANSLATION) {
-				if(TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))
+				if (TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))
 					BKE_tracking_clamp_track(track, CLAMP_PAT_POS);
-				if(TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))
+				if (TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))
 					BKE_tracking_clamp_track(track, CLAMP_SEARCH_POS);
 			}
 			else if (t->mode == TFM_RESIZE) {
-				if(TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))
+				if (TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))
 					BKE_tracking_clamp_track(track, CLAMP_PAT_DIM);
-				if(TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))
+				if (TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))
 					BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM);
 			}
 		}
 		
-		track= track->next;
+		track = track->next;
 	}
 	
 	DAG_id_tag_update(&clip->id, 0);
@@ -675,12 +673,12 @@ static void recalcData_view3d(TransInfo *t)
 	Base *base = t->scene->basact;
 	
 	if (t->obedit) {
-		if ELEM(t->obedit->type, OB_CURVE, OB_SURF) {
+		if (ELEM(t->obedit->type, OB_CURVE, OB_SURF)) {
 			Curve *cu= t->obedit->data;
 			ListBase *nurbs= curve_editnurbs(cu);
 			Nurb *nu= nurbs->first;
 			
-			if(t->state != TRANS_CANCEL) {
+			if (t->state != TRANS_CANCEL) {
 				clipMirrorModifier(t, t->obedit);
 				applyProject(t);
 			}
@@ -688,85 +686,86 @@ static void recalcData_view3d(TransInfo *t)
 			DAG_id_tag_update(t->obedit->data, 0);  /* sets recalc flags */
 				
 			if (t->state == TRANS_CANCEL) {
-				while(nu) {
+				while (nu) {
 					calchandlesNurb(nu); /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */
 					nu= nu->next;
 				}
 			} 
 			else {
 				/* Normal updating */
-				while(nu) {
+				while (nu) {
 					test2DNurb(nu);
 					calchandlesNurb(nu);
 					nu= nu->next;
 				}
 			}
 		}
-		else if(t->obedit->type==OB_LATTICE) {
+		else if (t->obedit->type==OB_LATTICE) {
 			Lattice *la= t->obedit->data;
 			
-			if(t->state != TRANS_CANCEL) {
+			if (t->state != TRANS_CANCEL) {
 				applyProject(t);
 			}
 			
 			DAG_id_tag_update(t->obedit->data, 0);  /* sets recalc flags */
 			
-			if(la->editlatt->latt->flag & LT_OUTSIDE) outside_lattice(la->editlatt->latt);
+			if (la->editlatt->latt->flag & LT_OUTSIDE) outside_lattice(la->editlatt->latt);
 		}
 		else if (t->obedit->type == OB_MESH) {
-			EditMesh *em = ((Mesh*)t->obedit->data)->edit_mesh;
+			BMEditMesh *em = BMEdit_FromObject(t->obedit);
 			/* mirror modifier clipping? */
-			if(t->state != TRANS_CANCEL) {
+			if (t->state != TRANS_CANCEL) {
 				/* apply clipping after so we never project past the clip plane [#25423] */
 				applyProject(t);
 				clipMirrorModifier(t, t->obedit);
 			}
-			if((t->options & CTX_NO_MIRROR) == 0 && (t->flag & T_MIRROR))
-				editmesh_apply_to_mirror(t);
+			if ((t->options & CTX_NO_MIRROR) == 0 && (t->flag & T_MIRROR))
+				editbmesh_apply_to_mirror(t);
 				
 			DAG_id_tag_update(t->obedit->data, 0);  /* sets recalc flags */
 			
-			recalc_editnormals(em);
+			EDBM_mesh_normals_update(em);
+			BMEdit_RecalcTessellation(em);
 		}
-		else if(t->obedit->type==OB_ARMATURE) { /* no recalc flag, does pose */
+		else if (t->obedit->type==OB_ARMATURE) { /* no recalc flag, does pose */
 			bArmature *arm= t->obedit->data;
 			ListBase *edbo = arm->edbo;
 			EditBone *ebo;
 			TransData *td = t->data;
 			int i;
 			
-			if(t->state != TRANS_CANCEL) {
+			if (t->state != TRANS_CANCEL) {
 				applyProject(t);
 			}
 			
 			/* Ensure all bones are correctly adjusted */
-			for (ebo = edbo->first; ebo; ebo = ebo->next){
+			for (ebo = edbo->first; ebo; ebo = ebo->next) {
 				
-				if ((ebo->flag & BONE_CONNECTED) && ebo->parent){
+				if ((ebo->flag & BONE_CONNECTED) && ebo->parent) {
 					/* If this bone has a parent tip that has been moved */
-					if (ebo->parent->flag & BONE_TIPSEL){
+					if (ebo->parent->flag & BONE_TIPSEL) {
 						copy_v3_v3 (ebo->head, ebo->parent->tail);
-						if(t->mode==TFM_BONE_ENVELOPE) ebo->rad_head= ebo->parent->rad_tail;
+						if (t->mode==TFM_BONE_ENVELOPE) ebo->rad_head= ebo->parent->rad_tail;
 					}
 					/* If this bone has a parent tip that has NOT been moved */
-					else{
+					else {
 						copy_v3_v3 (ebo->parent->tail, ebo->head);
-						if(t->mode==TFM_BONE_ENVELOPE) ebo->parent->rad_tail= ebo->rad_head;
+						if (t->mode==TFM_BONE_ENVELOPE) ebo->parent->rad_tail= ebo->rad_head;
 					}
 				}
 				
 				/* on extrude bones, oldlength==0.0f, so we scale radius of points */
 				ebo->length= len_v3v3(ebo->head, ebo->tail);
-				if(ebo->oldlength==0.0f) {
+				if (ebo->oldlength==0.0f) {
 					ebo->rad_head= 0.25f*ebo->length;
 					ebo->rad_tail= 0.10f*ebo->length;
 					ebo->dist= 0.25f*ebo->length;
-					if(ebo->parent) {
-						if(ebo->rad_head > ebo->parent->rad_tail)
+					if (ebo->parent) {
+						if (ebo->rad_head > ebo->parent->rad_tail)
 							ebo->rad_head= ebo->parent->rad_tail;
 					}
 				}
-				else if(t->mode!=TFM_BONE_ENVELOPE) {
+				else if (t->mode!=TFM_BONE_ENVELOPE) {
 					/* if bones change length, lets do that for the deform distance as well */
 					ebo->dist*= ebo->length/ebo->oldlength;
 					ebo->rad_head*= ebo->length/ebo->oldlength;
@@ -779,7 +778,7 @@ static void recalcData_view3d(TransInfo *t)
 			if (t->mode != TFM_BONE_ROLL)
 			{
 				/* fix roll */
-				for(i = 0; i < t->total; i++, td++)
+				for (i = 0; i < t->total; i++, td++)
 				{
 					if (td->extra)
 					{
@@ -796,8 +795,7 @@ static void recalcData_view3d(TransInfo *t)
 							rotation_between_vecs_to_quat(qrot, td->axismtx[1], vec);
 							mul_qt_v3(qrot, up_axis);
 						}
-						else
-						{
+						else {
 							mul_m3_v3(t->mat, up_axis);
 						}
 						
@@ -806,19 +804,18 @@ static void recalcData_view3d(TransInfo *t)
 				}
 			}
 			
-			if(arm->flag & ARM_MIRROR_EDIT)
+			if (arm->flag & ARM_MIRROR_EDIT)
 				transform_armature_mirror_update(t->obedit);
 			
 		}
-		else
-		{
-			if(t->state != TRANS_CANCEL) {
+		else {
+			if (t->state != TRANS_CANCEL) {
 				applyProject(t);
 			}
 			DAG_id_tag_update(t->obedit->data, 0);  /* sets recalc flags */
 		}
 	}
-	else if( (t->flag & T_POSE) && t->poseobj) {
+	else if ( (t->flag & T_POSE) && t->poseobj) {
 		Object *ob= t->poseobj;
 		bArmature *arm= ob->data;
 		
@@ -843,8 +840,8 @@ static void recalcData_view3d(TransInfo *t)
 		else
 			where_is_pose(t->scene, ob);
 	}
-	else if(base && (base->object->mode & OB_MODE_PARTICLE_EDIT) && PE_get_current(t->scene, base->object)) {
-		if(t->state != TRANS_CANCEL) {
+	else if (base && (base->object->mode & OB_MODE_PARTICLE_EDIT) && PE_get_current(t->scene, base->object)) {
+		if (t->state != TRANS_CANCEL) {
 			applyProject(t);
 		}
 		flushTransParticles(t);
@@ -852,7 +849,7 @@ static void recalcData_view3d(TransInfo *t)
 	else {
 		int i;
 		
-		if(t->state != TRANS_CANCEL) {
+		if (t->state != TRANS_CANCEL) {
 			applyProject(t);
 		}
 		
@@ -924,7 +921,7 @@ void drawLine(TransInfo *t, float *center, float *dir, char axis, short options)
 		
 		glPushMatrix();
 		
-		//if(t->obedit) glLoadMatrixf(t->obedit->obmat);	// sets opengl viewing
+		//if (t->obedit) glLoadMatrixf(t->obedit->obmat);	// sets opengl viewing
 		
 		
 		copy_v3_v3(v3, dir);
@@ -968,8 +965,8 @@ 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;
+//	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;
@@ -992,8 +989,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
 		copy_v2_v2_int(t->imval, event->mval);
 		t->event_type = event->type;
 	}
-	else
-	{
+	else {
 		t->imval[0] = 0;
 		t->imval[1] = 0;
 	}
@@ -1033,7 +1029,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
 
 
 	/* Assign the space type, some exceptions for running in different mode */
-	if(sa == NULL) {
+	if (sa == NULL) {
 		/* background mode */
 		t->spacetype= SPACE_EMPTY;
 	}
@@ -1047,7 +1043,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
 	}
 
 
-	if(t->spacetype == SPACE_VIEW3D)
+	if (t->spacetype == SPACE_VIEW3D)
 	{
 		View3D *v3d = sa->spacedata.first;
 		
@@ -1061,7 +1057,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
 			v3d->twtype = 0;
 		}
 
-		if(v3d->flag & V3D_ALIGN) t->flag |= T_V3D_ALIGN;
+		if (v3d->flag & V3D_ALIGN) t->flag |= T_V3D_ALIGN;
 		t->around = v3d->around;
 		
 		if (op && RNA_struct_find_property(op->ptr, "constraint_orientation") && RNA_struct_property_is_set(op->ptr, "constraint_orientation"))
@@ -1073,22 +1069,21 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
 				t->current_orientation = V3D_MANIP_GLOBAL;
 			}
 		}
-		else
-		{
+		else {
 			t->current_orientation = v3d->twmode;
 		}
 
 		/* exceptional case */
-		if(t->around==V3D_LOCAL && (t->settings->selectmode & SCE_SELECT_FACE)) {
-			if(ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL)) {
+		if (t->around==V3D_LOCAL && (t->settings->selectmode & SCE_SELECT_FACE)) {
+			if (ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL)) {
 				t->options |= CTX_NO_PET;
 			}
 		}
 
 		/* initialize UV transform from */
 		if (op && RNA_struct_find_property(op->ptr, "correct_uv")) {
-			if(RNA_struct_property_is_set(op->ptr, "correct_uv")) {
-				if(RNA_boolean_get(op->ptr, "correct_uv")) {
+			if (RNA_struct_property_is_set(op->ptr, "correct_uv")) {
+				if (RNA_boolean_get(op->ptr, "correct_uv")) {
 					t->settings->uvcalc_flag |= UVCALC_TRANSFORM_CORRECT;
 				}
 				else {
@@ -1101,28 +1096,24 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
 		}
 
 	}
-	else if(t->spacetype==SPACE_IMAGE)
-	{
+	else if (t->spacetype==SPACE_IMAGE) {
 		SpaceImage *sima = sa->spacedata.first;
 		// XXX for now, get View2D from the active region
 		t->view = &ar->v2d;
 		t->around = sima->around;
 	}
-	else if(t->spacetype==SPACE_NODE)
-	{
+	else if (t->spacetype==SPACE_NODE) {
 		// XXX for now, get View2D from the active region
 		t->view = &ar->v2d;
 		t->around = V3D_CENTER;
 	}
-	else if(t->spacetype==SPACE_IPO) 
-	{
+	else if (t->spacetype==SPACE_IPO) {
 		SpaceIpo *sipo= sa->spacedata.first;
 		t->view = &ar->v2d;
 		t->around = sipo->around;
 	}
-	else
-	{
-		if(ar) {
+	else {
+		if (ar) {
 			// XXX for now, get View2D  from the active region
 			t->view = &ar->v2d;
 			// XXX for now, the center point is the midpoint of the data
@@ -1140,10 +1131,8 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
 			t->flag |= T_RELEASE_CONFIRM;
 		}
 	}
-	else
-	{
-		if (U.flag & USER_RELEASECONFIRM)
-		{
+	else {
+		if (U.flag & USER_RELEASECONFIRM) {
 			t->flag |= T_RELEASE_CONFIRM;
 		}
 	}
@@ -1157,8 +1146,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
 		}
 	}
 	// Need stuff to take it from edit mesh or whatnot here
-	else if (t->spacetype == SPACE_VIEW3D)
-	{
+	else if (t->spacetype == SPACE_VIEW3D) {
 		if (t->obedit && t->obedit->type == OB_MESH && (((Mesh *)t->obedit->data)->editflag & ME_EDIT_MIRROR_X))
 		{
 			t->flag |= T_MIRROR;
@@ -1180,22 +1168,18 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
 				break;
 			}
 		}
-		else
-		{
+		else {
 			/* use settings from scene only if modal */
-			if (t->flag & T_MODAL)
-			{
-				if ((t->options & CTX_NO_PET) == 0)
-				{
-					if (t->obedit && ts->proportional != PROP_EDIT_OFF)
-					{
+			if (t->flag & T_MODAL) {
+				if ((t->options & CTX_NO_PET) == 0) {
+					if (t->obedit && ts->proportional != PROP_EDIT_OFF) {
 						t->flag |= T_PROP_EDIT;
 
-						if(ts->proportional == PROP_EDIT_CONNECTED)
+						if (ts->proportional == PROP_EDIT_CONNECTED) {
 							t->flag |= T_PROP_CONNECTED;
+						}
 					}
-					else if (t->obedit == NULL && ts->proportional_objects)
-					{
+					else if (t->obedit == NULL && ts->proportional_objects) {
 						t->flag |= T_PROP_EDIT;
 					}
 				}
@@ -1206,8 +1190,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
 		{
 			t->prop_size = RNA_float_get(op->ptr, "proportional_size");
 		}
-		else
-		{
+		else {
 			t->prop_size = ts->proportional_size;
 		}
 		
@@ -1223,8 +1206,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
 		{
 			t->prop_mode = RNA_enum_get(op->ptr, "proportional_edit_falloff");
 		}
-		else
-		{
+		else {
 			t->prop_mode = ts->prop_mode;
 		}
 	}
@@ -1263,7 +1245,7 @@ void postTrans (bContext *C, TransInfo *t)
 		/* Can take over freeing t->data and data2d etc... */
 		t->customFree(t);
 	}
-	else if (t->customData) {
+	else if ((t->customData != NULL) && (t->flag & T_FREE_CUSTOMDATA)) {
 		MEM_freeN(t->customData);
 	}
 
@@ -1272,7 +1254,7 @@ void postTrans (bContext *C, TransInfo *t)
 		int a;
 		
 		/* free data malloced per trans-data */
-		for(a=0, td= t->data; a<t->total; a++, td++) {
+		for (a=0, td= t->data; a<t->total; a++, td++) {
 			if (td->flag & TD_BEZTRIPLE) 
 				MEM_freeN(td->hdata);
 		}
@@ -1287,12 +1269,12 @@ void postTrans (bContext *C, TransInfo *t)
 		t->data2d= NULL;
 	}
 	
-	if(t->spacetype==SPACE_IMAGE) {
+	if (t->spacetype==SPACE_IMAGE) {
 		SpaceImage *sima= t->sa->spacedata.first;
-		if(sima->flag & SI_LIVE_UNWRAP)
+		if (sima->flag & SI_LIVE_UNWRAP)
 			ED_uvedit_live_unwrap_end(t->state == TRANS_CANCEL);
 	}
-	else if(t->spacetype==SPACE_VIEW3D) {
+	else if (t->spacetype==SPACE_VIEW3D) {
 		View3D *v3d = t->sa->spacedata.first;
 		/* restore manipulator */
 		if (t->flag & T_MODAL) {
@@ -1336,10 +1318,10 @@ static void restoreElement(TransData *td)
 		if (td->ext->rot) {
 			copy_v3_v3(td->ext->rot, td->ext->irot);
 		}
-		if(td->ext->rotAngle) {
+		if (td->ext->rotAngle) {
 			*td->ext->rotAngle= td->ext->irotAngle;
 		}
-		if(td->ext->rotAxis) {
+		if (td->ext->rotAxis) {
 			copy_v3_v3(td->ext->rotAxis, td->ext->irotAxis);
 		}
 		/* XXX, drotAngle & drotAxis not used yet */
@@ -1423,7 +1405,7 @@ void calculateCenterCursor2D(TransInfo *t)
 	float aspx=1.0, aspy=1.0;
 	float *cursor= NULL;
 	
-	if(t->spacetype==SPACE_IMAGE) {
+	if (t->spacetype==SPACE_IMAGE) {
 		SpaceImage *sima= (SpaceImage *)t->sa->spacedata.first;
 		/* only space supported right now but may change */
 		ED_space_image_uv_aspect(sima, &aspx, &aspy);
@@ -1456,7 +1438,7 @@ void calculateCenterMedian(TransInfo *t)
 	int total = 0;
 	int i;
 	
-	for(i = 0; i < t->total; i++) {
+	for (i = 0; i < t->total; i++) {
 		if (t->data[i].flag & TD_SELECTED) {
 			if (!(t->data[i].flag & TD_NOCENTER))
 			{
@@ -1466,13 +1448,13 @@ void calculateCenterMedian(TransInfo *t)
 		}
 		else {
 			/*
-			   All the selected elements are at the head of the array
-			   which means we can stop when it finds unselected data
-			*/
+			 * All the selected elements are at the head of the array
+			 * which means we can stop when it finds unselected data
+			 */
 			break;
 		}
 	}
-	if(i)
+	if (i)
 		mul_v3_fl(partial, 1.0f / total);
 	copy_v3_v3(t->center, partial);
 	
@@ -1484,7 +1466,7 @@ void calculateCenterBound(TransInfo *t)
 	float max[3];
 	float min[3];
 	int i;
-	for(i = 0; i < t->total; i++) {
+	for (i = 0; i < t->total; i++) {
 		if (i) {
 			if (t->data[i].flag & TD_SELECTED) {
 				if (!(t->data[i].flag & TD_NOCENTER))
@@ -1492,9 +1474,9 @@ void calculateCenterBound(TransInfo *t)
 			}
 			else {
 				/*
-				   All the selected elements are at the head of the array
-				   which means we can stop when it finds unselected data
-				*/
+				 * All the selected elements are at the head of the array
+				 * which means we can stop when it finds unselected data
+				 */
 				break;
 			}
 		}
@@ -1519,9 +1501,9 @@ void calculateCenter(TransInfo *t)
 		calculateCenterMedian(t);
 		break;
 	case V3D_CURSOR:
-		if(t->spacetype==SPACE_IMAGE)
+		if (t->spacetype==SPACE_IMAGE)
 			calculateCenterCursor2D(t);
-		else if(t->spacetype==SPACE_IPO)
+		else if (t->spacetype==SPACE_IPO)
 			calculateCenterCursorGraph2D(t);
 		else
 			calculateCenterCursor(t);
@@ -1537,12 +1519,12 @@ void calculateCenter(TransInfo *t)
 		/* EDIT MODE ACTIVE EDITMODE ELEMENT */
 
 		if (t->obedit) {
-			if(t->obedit->type == OB_MESH) {
-				EditSelection ese;
-				EditMesh *em = BKE_mesh_get_editmesh(t->obedit->data);
+			if (t->obedit && t->obedit->type == OB_MESH) {
+				BMEditSelection ese;
+				BMEditMesh *em = BMEdit_FromObject(t->obedit);
 
-				if (EM_get_actSelection(em, &ese)) {
-					EM_editselection_center(t->center, &ese);
+				if (BM_select_history_active_get(em->bm, &ese)) {
+					BM_editselection_center(&ese, t->center);
 					calculateCenter2D(t);
 					break;
 				}
@@ -1560,12 +1542,11 @@ void calculateCenter(TransInfo *t)
 		} /* END EDIT MODE ACTIVE ELEMENT */
 
 		calculateCenterMedian(t);
-		if((t->flag & (T_EDIT|T_POSE))==0)
+		if ((t->flag & (T_EDIT|T_POSE))==0)
 		{
 			Scene *scene = t->scene;
 			Object *ob= OBACT;
-			if(ob)
-			{
+			if (ob) {
 				copy_v3_v3(t->center, ob->obmat[3]);
 				projectIntView(t, t->center, t->center2d);
 			}
@@ -1576,23 +1557,19 @@ void calculateCenter(TransInfo *t)
 	
 	/* setting constraint center */
 	copy_v3_v3(t->con.center, t->center);
-	if(t->flag & (T_EDIT|T_POSE))
-	{
+	if (t->flag & (T_EDIT|T_POSE)) {
 		Object *ob= t->obedit?t->obedit:t->poseobj;
 		mul_m4_v3(ob->obmat, t->con.center);
 	}
 	
 	/* for panning from cameraview */
-	if(t->flag & T_OBJECT)
-	{
-		if(t->spacetype==SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW)
-		{
+	if (t->flag & T_OBJECT) {
+		if (t->spacetype==SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) {
 			View3D *v3d = t->view;
 			Scene *scene = t->scene;
 			RegionView3D *rv3d = t->ar->regiondata;
 			
-			if(v3d->camera == OBACT && rv3d->persp==RV3D_CAMOB)
-			{
+			if (v3d->camera == OBACT && rv3d->persp==RV3D_CAMOB) {
 				float axis[3];
 				/* persinv is nasty, use viewinv instead, always right */
 				copy_v3_v3(axis, t->viewinv[2]);
@@ -1606,7 +1583,7 @@ void calculateCenter(TransInfo *t)
 				projectIntView(t, axis, t->center2d);
 				
 				/* rotate only needs correct 2d center, grab needs initgrabz() value */
-				if(t->mode==TFM_TRANSLATION)
+				if (t->mode==TFM_TRANSLATION)
 				{
 					copy_v3_v3(t->center, axis);
 					copy_v3_v3(t->con.center, t->center);
@@ -1615,10 +1592,9 @@ void calculateCenter(TransInfo *t)
 		}
 	}
 	
-	if(t->spacetype==SPACE_VIEW3D)
-	{
+	if (t->spacetype==SPACE_VIEW3D) {
 		/* initgrabz() defines a factor for perspective depth correction, used in window_to_3d_delta() */
-		if(t->flag & (T_EDIT|T_POSE)) {
+		if (t->flag & (T_EDIT|T_POSE)) {
 			Object *ob= t->obedit?t->obedit:t->poseobj;
 			float vec[3];
 			
@@ -1640,12 +1616,11 @@ void calculatePropRatio(TransInfo *t)
 	short connected = t->flag & T_PROP_CONNECTED;
 
 	if (t->flag & T_PROP_EDIT) {
-		for(i = 0 ; i < t->total; i++, td++) {
+		for (i = 0 ; i < t->total; i++, td++) {
 			if (td->flag & TD_SELECTED) {
 				td->factor = 1.0f;
 			}
-			else if (t->flag & T_MIRROR && td->loc[0] * t->mirror < -0.00001f)
-			{
+			else if (t->flag & T_MIRROR && td->loc[0] * t->mirror < -0.00001f) {
 				td->flag |= TD_SKIP;
 				td->factor = 0.0f;
 				restoreElement(td);
@@ -1654,11 +1629,12 @@ void calculatePropRatio(TransInfo *t)
 						(td->flag & TD_NOTCONNECTED || td->dist > t->prop_size))
 				||
 					(connected == 0 &&
-						td->rdist > t->prop_size)) {
+						td->rdist > t->prop_size))
+			{
 				/*
-				   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.
-				*/
+				 * 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.
+				 */
 				td->flag |= TD_NOACTION;
 				td->factor = 0.0f;
 				restoreElement(td);
@@ -1735,7 +1711,7 @@ void calculatePropRatio(TransInfo *t)
 		}
 	}
 	else {
-		for(i = 0 ; i < t->total; i++, td++) {
+		for (i = 0 ; i < t->total; i++, td++) {
 			td->factor = 1.0;
 		}
 		t->proptext[0]= '\0';
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index a4f03e7..bd3fb20 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -44,16 +44,14 @@
 static void InputVector(TransInfo *t, MouseInput *mi, const int mval[2], float output[3])
 {
 	float vec[3], dvec[3];
-	if(mi->precision)
-	{
+	if (mi->precision) {
 		/* calculate the main translation and the precise one separate */
 		convertViewVec(t, dvec, (mval[0] - mi->precision_mval[0]), (mval[1] - mi->precision_mval[1]));
 		mul_v3_fl(dvec, 0.1f);
 		convertViewVec(t, vec, (mi->precision_mval[0] - t->imval[0]), (mi->precision_mval[1] - t->imval[1]));
 		add_v3_v3v3(output, vec, dvec);
 	}
-	else
-	{
+	else {
 		convertViewVec(t, output, (mval[0] - t->imval[0]), (mval[1] - t->imval[1]));
 	}
 
@@ -62,8 +60,7 @@ static void InputVector(TransInfo *t, MouseInput *mi, const int mval[2], float o
 static void InputSpring(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2], float output[3])
 {
 	float ratio, precise_ratio, dx, dy;
-	if(mi->precision)
-	{
+	if (mi->precision) {
 		/* calculate ratio for shiftkey pos, and for total, and blend these for precision */
 		dx = (float)(mi->center[0] - mi->precision_mval[0]);
 		dy = (float)(mi->center[1] - mi->precision_mval[1]);
@@ -75,8 +72,7 @@ static void InputSpring(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2],
 
 		ratio = (ratio + (precise_ratio - ratio) / 10.0f) / mi->factor;
 	}
-	else
-	{
+	else {
 		dx = (float)(mi->center[0] - mval[0]);
 		dy = (float)(mi->center[1] - mval[1]);
 		ratio = (float)sqrt( dx*dx + dy*dy) / mi->factor;
@@ -101,13 +97,11 @@ static void InputSpringFlip(TransInfo *t, MouseInput *mi, const int mval[2], flo
 static void InputTrackBall(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2], float output[3])
 {
 
-	if(mi->precision)
-	{
+	if (mi->precision) {
 		output[0] = ( mi->imval[1] - mi->precision_mval[1] ) + ( mi->precision_mval[1] - mval[1] ) * 0.1f;
 		output[1] = ( mi->precision_mval[0] - mi->imval[0] ) + ( mval[0] - mi->precision_mval[0] ) * 0.1f;
 	}
-	else
-	{
+	else {
 		output[0] = (float)( mi->imval[1] - mval[1] );
 		output[1] = (float)( mval[0] - mi->imval[0] );
 	}
@@ -122,8 +116,7 @@ static void InputHorizontalRatio(TransInfo *t, MouseInput *mi, const int mval[2]
 
 	pad = t->ar->winx / 10;
 
-	if (mi->precision)
-	{
+	if (mi->precision) {
 		/* deal with Shift key by adding motion / 10 to motion before shift press */
 		x = mi->precision_mval[0] + (float)(mval[0] - mi->precision_mval[0]) / 10.0f;
 	}
@@ -243,15 +236,14 @@ static void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2],
 	float dphi;
 
 	dphi = saacos((float)deler);
-	if( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
+	if ( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
 
 	/* If the angle is zero, because of lack of precision close to the 1.0 value in acos
 	 * approximate the angle with the opposite side of the normalized triangle
 	 * This is a good approximation here since the smallest acos value seems to be around
 	 * 0.02 degree and lower values don't even have a 0.01% error compared to the approximation
-	 * */
-	if (dphi == 0)
-	{
+	 */
+	if (dphi == 0) {
 		double dx, dy;
 
 		dx2 /= A;
@@ -264,14 +256,15 @@ static void InputAngle(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2],
 		dy = dy1 - dy2;
 
 		dphi = sqrt(dx*dx + dy*dy);
-		if( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
+		if ( (dx1*dy2-dx2*dy1)>0.0 ) dphi= -dphi;
 	}
 
-	if(mi->precision) dphi = dphi/30.0f;
+	if (mi->precision) {
+		dphi = dphi/30.0f;
+	}
 
 	/* if no delta angle, don't update initial position */
-	if (dphi != 0)
-	{
+	if (dphi != 0) {
 		mi->imval[0] = mval[0];
 		mi->imval[1] = mval[1];
 	}
@@ -314,7 +307,7 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
 	/* TODO, holding R-key can cause mem leak, but this causes [#28903]
 	 * disable for now. */
 #if 0
-	if(mi->data) {
+	if (mi->data) {
 		MEM_freeN(mi->data);
 		mi->data= NULL;
 	}
@@ -385,13 +378,11 @@ void setInputPostFct(MouseInput *mi, void	(*post)(struct TransInfo *, float [3])
 
 void applyMouseInput(TransInfo *t, MouseInput *mi, const int mval[2], float output[3])
 {
-	if (mi->apply != NULL)
-	{
+	if (mi->apply != NULL) {
 		mi->apply(t, mi, mval, output);
 	}
 
-	if (mi->post)
-	{
+	if (mi->post) {
 		mi->post(t, output);
 	}
 }
@@ -404,16 +395,14 @@ int handleMouseInput(TransInfo *t, MouseInput *mi, wmEvent *event)
 	{
 	case LEFTSHIFTKEY:
 	case RIGHTSHIFTKEY:
-		if (event->val==KM_PRESS)
-		{
+		if (event->val == KM_PRESS) {
 			t->modifiers |= MOD_PRECISION;
 			/* shift is modifier for higher precision transform
 			 * store the mouse position where the normal movement ended */
 			copy_v2_v2_int(mi->precision_mval, event->mval);
 			mi->precision = 1;
 		}
-		else
-		{
+		else {
 			t->modifiers &= ~MOD_PRECISION;
 			mi->precision = 0;
 		}
diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c
index 5578ea7..5b70b25 100644
--- a/source/blender/editors/transform/transform_manipulator.c
+++ b/source/blender/editors/transform/transform_manipulator.c
@@ -46,11 +46,15 @@
 #include "DNA_armature_types.h"
 #include "DNA_curve_types.h"
 #include "DNA_lattice_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_meta_types.h"
 #include "DNA_screen_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_view3d_types.h"
 
+#include "BLI_math.h"
+#include "BLI_utildefines.h"
+
 #include "RNA_access.h"
 
 #include "BKE_action.h"
@@ -60,10 +64,7 @@
 #include "BKE_mesh.h"
 #include "BKE_particle.h"
 #include "BKE_pointcache.h"
-
-#include "BLI_math.h"
-#include "BLI_editVert.h"
-#include "BLI_utildefines.h"
+#include "BKE_tessmesh.h"
 
 #include "BIF_gl.h"
 
@@ -119,25 +120,25 @@ static void calc_tw_center(Scene *scene, float *co)
 
 static void protectflag_to_drawflags(short protectflag, short *drawflags)
 {
-	if(protectflag & OB_LOCK_LOCX)
+	if (protectflag & OB_LOCK_LOCX)
 		*drawflags &= ~MAN_TRANS_X;
-	if(protectflag & OB_LOCK_LOCY)
+	if (protectflag & OB_LOCK_LOCY)
 		*drawflags &= ~MAN_TRANS_Y;
-	if(protectflag & OB_LOCK_LOCZ)
+	if (protectflag & OB_LOCK_LOCZ)
 		*drawflags &= ~MAN_TRANS_Z;
 
-	if(protectflag & OB_LOCK_ROTX)
+	if (protectflag & OB_LOCK_ROTX)
 		*drawflags &= ~MAN_ROT_X;
-	if(protectflag & OB_LOCK_ROTY)
+	if (protectflag & OB_LOCK_ROTY)
 		*drawflags &= ~MAN_ROT_Y;
-	if(protectflag & OB_LOCK_ROTZ)
+	if (protectflag & OB_LOCK_ROTZ)
 		*drawflags &= ~MAN_ROT_Z;
 
-	if(protectflag & OB_LOCK_SCALEX)
+	if (protectflag & OB_LOCK_SCALEX)
 		*drawflags &= ~MAN_SCALE_X;
-	if(protectflag & OB_LOCK_SCALEY)
+	if (protectflag & OB_LOCK_SCALEY)
 		*drawflags &= ~MAN_SCALE_Y;
-	if(protectflag & OB_LOCK_SCALEZ)
+	if (protectflag & OB_LOCK_SCALEZ)
 		*drawflags &= ~MAN_SCALE_Z;
 }
 
@@ -146,7 +147,7 @@ static void stats_pose(Scene *scene, RegionView3D *rv3d, bPoseChannel *pchan)
 {
 	Bone *bone= pchan->bone;
 
-	if(bone) {
+	if (bone) {
 		if (bone->flag & BONE_TRANSFORM) {
 			calc_tw_center(scene, pchan->pose_head);
 			protectflag_to_drawflags(pchan->protectflag, &rv3d->twdrawflag);
@@ -201,13 +202,12 @@ static int test_rotmode_euler(short rotmode)
 int gimbal_axis(Object *ob, float gmat[][3])
 {
 	if (ob) {
-		if(ob->mode & OB_MODE_POSE)
-		{
+		if (ob->mode & OB_MODE_POSE) {
 			bPoseChannel *pchan= get_active_posechannel(ob);
 
-			if(pchan) {
+			if (pchan) {
 				float mat[3][3], tmat[3][3], obmat[3][3];
-				if(test_rotmode_euler(pchan->rotmode)) {
+				if (test_rotmode_euler(pchan->rotmode)) {
 					eulO_to_gimbal_axis(mat, pchan->eul, pchan->rotmode);
 				}
 				else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
@@ -221,8 +221,7 @@ int gimbal_axis(Object *ob, float gmat[][3])
 				/* apply bone transformation */
 				mul_m3_m3m3(tmat, pchan->bone->bone_mat, mat);
 
-				if (pchan->parent)
-				{
+				if (pchan->parent) {
 					float parent_mat[3][3];
 
 					copy_m3_m4(parent_mat, pchan->parent->pose_mat);
@@ -232,8 +231,7 @@ int gimbal_axis(Object *ob, float gmat[][3])
 					copy_m3_m4(obmat, ob->obmat);
 					mul_m3_m3m3(gmat, obmat, mat);
 				}
-				else
-				{
+				else {
 					/* needed if object transformation isn't identity */
 					copy_m3_m4(obmat, ob->obmat);
 					mul_m3_m3m3(gmat, obmat, tmat);
@@ -244,18 +242,17 @@ int gimbal_axis(Object *ob, float gmat[][3])
 			}
 		}
 		else {
-			if(test_rotmode_euler(ob->rotmode)) {
+			if (test_rotmode_euler(ob->rotmode)) {
 				eulO_to_gimbal_axis(gmat, ob->rot, ob->rotmode);
 			}
-			else if(ob->rotmode == ROT_MODE_AXISANGLE) {
+			else if (ob->rotmode == ROT_MODE_AXISANGLE) {
 				axis_angle_to_gimbal_axis(gmat, ob->rotAxis, ob->rotAngle);
 			}
 			else { /* quat */
 				return 0;
 			}
 
-			if (ob->parent)
-			{
+			if (ob->parent) {
 				float parent_mat[3][3];
 				copy_m3_m4(parent_mat, ob->parent->obmat);
 				normalize_m3(parent_mat);
@@ -290,91 +287,82 @@ int calc_manipulator_stats(const bContext *C)
 	rv3d->twdrawflag= 0xFFFF;
 
 	/* transform widget centroid/center */
-	scene->twcent[0]= scene->twcent[1]= scene->twcent[2]= 0.0f;
 	INIT_MINMAX(scene->twmin, scene->twmax);
+	zero_v3(scene->twcent);
 
-	if(obedit) {
+	if (obedit) {
 		ob= obedit;
-		if((ob->lay & v3d->lay)==0) return 0;
+		if ((ob->lay & v3d->lay)==0) return 0;
 
-		if(obedit->type==OB_MESH) {
-			EditMesh *em = BKE_mesh_get_editmesh(obedit->data);
-			EditVert *eve;
-			EditSelection ese;
+		if (obedit->type==OB_MESH) {
+			BMEditMesh *em = BMEdit_FromObject(obedit);
+			BMEditSelection ese;
 			float vec[3]= {0,0,0};
 
 			/* USE LAST SELECTE WITH ACTIVE */
-			if (v3d->around==V3D_ACTIVE && EM_get_actSelection(em, &ese)) {
-				EM_editselection_center(vec, &ese);
+			if ((v3d->around == V3D_ACTIVE) && BM_select_history_active_get(em->bm, &ese)) {
+				BM_editselection_center(&ese, vec);
 				calc_tw_center(scene, vec);
 				totsel= 1;
-			} else {
+			}
+			else {
+				BMesh *bm = em->bm;
+				BMVert *eve;
+
+				BMIter iter;
+
 				/* do vertices/edges/faces for center depending on selection
-				   mode. note we can't use just vertex selection flag because
-				   it is not flush down on changes */
-				if(ts->selectmode & SCE_SELECT_VERTEX) {
-					for(eve= em->verts.first; eve; eve= eve->next) {
-						if(eve->f & SELECT) {
-							totsel++;
-							calc_tw_center(scene, eve->co);
+				 * mode. note we can't use just vertex selection flag because
+				 * it is not flush down on changes */
+				if (ts->selectmode & SCE_SELECT_VERTEX) {
+					BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
+						if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
+							if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
+								totsel++;
+								calc_tw_center(scene, eve->co);
+							}
 						}
 					}
 				}
-				else if(ts->selectmode & SCE_SELECT_EDGE) {
-					EditEdge *eed;
-
-					for(eve= em->verts.first; eve; eve= eve->next) eve->f1= 0;
-					for(eed= em->edges.first; eed; eed= eed->next) {
-						if(eed->h==0 && (eed->f & SELECT)) {
-							if(!eed->v1->f1) {
-								eed->v1->f1= 1;
-								totsel++;
-								calc_tw_center(scene, eed->v1->co);
-							}
-							if(!eed->v2->f1) {
-								eed->v2->f1= 1;
-								totsel++;
-								calc_tw_center(scene, eed->v2->co);
+				else if (ts->selectmode & SCE_SELECT_EDGE) {
+					BMIter itersub;
+					BMEdge *eed;
+					BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
+						if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
+							/* check the vertex has a selected edge, only add it once */
+							BM_ITER_ELEM (eed, &itersub, eve, BM_EDGES_OF_VERT) {
+								if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
+									totsel++;
+									calc_tw_center(scene, eve->co);
+									break;
+								}
 							}
 						}
 					}
 				}
 				else {
-					EditFace *efa;
-
-					for(eve= em->verts.first; eve; eve= eve->next) eve->f1= 0;
-					for(efa= em->faces.first; efa; efa= efa->next) {
-						if(efa->h==0 && (efa->f & SELECT)) {
-							if(!efa->v1->f1) {
-								efa->v1->f1= 1;
-								totsel++;
-								calc_tw_center(scene, efa->v1->co);
-							}
-							if(!efa->v2->f1) {
-								efa->v2->f1= 1;
-								totsel++;
-								calc_tw_center(scene, efa->v2->co);
-							}
-							if(!efa->v3->f1) {
-								efa->v3->f1= 1;
-								totsel++;
-								calc_tw_center(scene, efa->v3->co);
-							}
-							if(efa->v4 && !efa->v4->f1) {
-								efa->v4->f1= 1;
-								totsel++;
-								calc_tw_center(scene, efa->v4->co);
+					BMIter itersub;
+					BMFace *efa;
+					BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
+						if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
+							/* check the vertex has a selected face, only add it once */
+							BM_ITER_ELEM (efa, &itersub, eve, BM_FACES_OF_VERT) {
+								if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
+									totsel++;
+									calc_tw_center(scene, eve->co);
+									break;
+								}
 							}
 						}
 					}
 				}
 			}
 		} /* end editmesh */
-		else if (obedit->type==OB_ARMATURE){
+		else if (obedit->type==OB_ARMATURE) {
 			bArmature *arm= obedit->data;
 			EditBone *ebo;
-			for (ebo= arm->edbo->first; ebo; ebo=ebo->next){
-				if(EBONE_VISIBLE(arm, ebo)) {
+			for (ebo= arm->edbo->first; ebo; ebo=ebo->next) {
+				if (EBONE_VISIBLE(arm, ebo)) {
 					if (ebo->flag & BONE_TIPSEL) {
 						calc_tw_center(scene, ebo->tail);
 						totsel++;
@@ -389,7 +377,7 @@ int calc_manipulator_stats(const bContext *C)
 				}
 			}
 		}
-		else if ELEM(obedit->type, OB_CURVE, OB_SURF) {
+		else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
 			Curve *cu= obedit->data;
 			float center[3];
 
@@ -404,11 +392,11 @@ int calc_manipulator_stats(const bContext *C)
 				ListBase *nurbs= curve_editnurbs(cu);
 
 				nu= nurbs->first;
-				while(nu) {
-					if(nu->type == CU_BEZIER) {
+				while (nu) {
+					if (nu->type == CU_BEZIER) {
 						bezt= nu->bezt;
 						a= nu->pntsu;
-						while(a--) {
+						while (a--) {
 							/* exceptions
 							 * if handles are hidden then only check the center points.
 							 * If the center knot is selected then only use this as the center point.
@@ -424,11 +412,11 @@ int calc_manipulator_stats(const bContext *C)
 								totsel++;
 							}
 							else {
-								if(bezt->f1) {
+								if (bezt->f1) {
 									calc_tw_center(scene, bezt->vec[0]);
 									totsel++;
 								}
-								if(bezt->f3) {
+								if (bezt->f3) {
 									calc_tw_center(scene, bezt->vec[2]);
 									totsel++;
 								}
@@ -439,8 +427,8 @@ int calc_manipulator_stats(const bContext *C)
 					else {
 						bp= nu->bp;
 						a= nu->pntsu*nu->pntsv;
-						while(a--) {
-							if(bp->f1 & SELECT) {
+						while (a--) {
+							if (bp->f1 & SELECT) {
 								calc_tw_center(scene, bp->vec);
 								totsel++;
 							}
@@ -451,13 +439,13 @@ int calc_manipulator_stats(const bContext *C)
 				}
 			}
 		}
-		else if(obedit->type==OB_MBALL) {
+		else if (obedit->type==OB_MBALL) {
 			MetaBall *mb = (MetaBall*)obedit->data;
 			MetaElem *ml /* , *ml_sel=NULL */ /* UNUSED */;
 
 			ml= mb->editelems->first;
-			while(ml) {
-				if(ml->flag & SELECT) {
+			while (ml) {
+				if (ml->flag & SELECT) {
 					calc_tw_center(scene, &ml->x);
 					/* ml_sel = ml; */ /* UNUSED */
 					totsel++;
@@ -465,15 +453,15 @@ int calc_manipulator_stats(const bContext *C)
 				ml= ml->next;
 			}
 		}
-		else if(obedit->type==OB_LATTICE) {
+		else if (obedit->type==OB_LATTICE) {
 			BPoint *bp;
 			Lattice *lt= obedit->data;
 
 			bp= lt->editlatt->latt->def;
 
 			a= lt->editlatt->latt->pntsu*lt->editlatt->latt->pntsv*lt->editlatt->latt->pntsw;
-			while(a--) {
-				if(bp->f1 & SELECT) {
+			while (a--) {
+				if (bp->f1 & SELECT) {
 					calc_tw_center(scene, bp->vec);
 					totsel++;
 				}
@@ -482,24 +470,24 @@ int calc_manipulator_stats(const bContext *C)
 		}
 
 		/* selection center */
-		if(totsel) {
+		if (totsel) {
 			mul_v3_fl(scene->twcent, 1.0f/(float)totsel);	// centroid!
 			mul_m4_v3(obedit->obmat, scene->twcent);
 			mul_m4_v3(obedit->obmat, scene->twmin);
 			mul_m4_v3(obedit->obmat, scene->twmax);
 		}
 	}
-	else if(ob && (ob->mode & OB_MODE_POSE)) {
+	else if (ob && (ob->mode & OB_MODE_POSE)) {
 		bPoseChannel *pchan;
 		int mode = TFM_ROTATION; // mislead counting bones... bah. We don't know the manipulator mode, could be mixed
 
-		if((ob->lay & v3d->lay)==0) return 0;
+		if ((ob->lay & v3d->lay)==0) return 0;
 
 		totsel = count_set_pose_transflags(&mode, 0, ob);
 
-		if(totsel) {
+		if (totsel) {
 			/* use channels to get stats */
-			for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+			for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
 				stats_pose(scene, rv3d, pchan);
 			}
 
@@ -509,22 +497,22 @@ int calc_manipulator_stats(const bContext *C)
 			mul_m4_v3(ob->obmat, scene->twmax);
 		}
 	}
-	else if(ob && (ob->mode & OB_MODE_ALL_PAINT)) {
+	else if (ob && (ob->mode & OB_MODE_ALL_PAINT)) {
 		;
 	}
-	else if(ob && ob->mode & OB_MODE_PARTICLE_EDIT) {
+	else if (ob && ob->mode & OB_MODE_PARTICLE_EDIT) {
 		PTCacheEdit *edit= PE_get_current(scene, ob);
 		PTCacheEditPoint *point;
 		PTCacheEditKey *ek;
 		int k;
 
-		if(edit) {
+		if (edit) {
 			point = edit->points;
-			for(a=0; a<edit->totpoint; a++,point++) {
-				if(point->flag & PEP_HIDE) continue;
+			for (a=0; a<edit->totpoint; a++,point++) {
+				if (point->flag & PEP_HIDE) continue;
 
-				for(k=0, ek=point->keys; k<point->totkey; k++, ek++) {
-					if(ek->flag & PEK_SELECT) {
+				for (k=0, ek=point->keys; k<point->totkey; k++, ek++) {
+					if (ek->flag & PEK_SELECT) {
 						calc_tw_center(scene, ek->flag & PEK_USE_WCO ? ek->world_co : ek->co);
 						totsel++;
 					}
@@ -532,7 +520,7 @@ int calc_manipulator_stats(const bContext *C)
 			}
 
 			/* selection center */
-			if(totsel)
+			if (totsel)
 				mul_v3_fl(scene->twcent, 1.0f/(float)totsel);	// centroid!
 		}
 	}
@@ -540,11 +528,11 @@ int calc_manipulator_stats(const bContext *C)
 
 		/* we need the one selected object, if its not active */
 		ob= OBACT;
-		if(ob && !(ob->flag & SELECT)) ob= NULL;
+		if (ob && !(ob->flag & SELECT)) ob= NULL;
 
-		for(base= scene->base.first; base; base= base->next) {
-			if TESTBASELIB(v3d, base) {
-				if(ob==NULL)
+		for (base= scene->base.first; base; base= base->next) {
+			if (TESTBASELIB(v3d, base)) {
+				if (ob==NULL)
 					ob= base->object;
 				calc_tw_center(scene, base->object->obmat[3]);
 				protectflag_to_drawflags(base->object->protectflag, &rv3d->twdrawflag);
@@ -553,13 +541,13 @@ int calc_manipulator_stats(const bContext *C)
 		}
 
 		/* selection center */
-		if(totsel) {
+		if (totsel) {
 			mul_v3_fl(scene->twcent, 1.0f/(float)totsel);	// centroid!
 		}
 	}
 
 	/* global, local or normal orientation? */
-	if(ob && totsel) {
+	if (ob && totsel) {
 
 		switch(v3d->twmode) {
 		
@@ -576,7 +564,7 @@ int calc_manipulator_stats(const bContext *C)
 			/* if not gimbal, fall through to normal */
 		}
 		case V3D_MANIP_NORMAL:
-			if(obedit || ob->mode & OB_MODE_POSE) {
+			if (obedit || ob->mode & OB_MODE_POSE) {
 				float mat[3][3];
 				ED_getTransformOrientationMatrix(C, mat, (v3d->around == V3D_ACTIVE));
 				copy_m4_m3(rv3d->twmat, mat);
@@ -661,14 +649,14 @@ static float screen_aligned(RegionView3D *rv3d, float mat[][4])
 }
 
 
-/* radring = radius of donut rings
-   radhole = radius hole
-   start = starting segment (based on nrings)
-   end   = end segment
-   nsides = amount of points in ring
-   nrigns = amount of rings
-*/
-static void partial_donut(float radring, float radhole, int start, int end, int nsides, int nrings)
+/* radring = radius of doughnut rings
+ * radhole = radius hole
+ * start = starting segment (based on nrings)
+ * end   = end segment
+ * nsides = amount of points in ring
+ * nrigns = amount of rings
+ */
+static void partial_doughnut(float radring, float radhole, int start, int end, int nsides, int nrings)
 {
 	float theta, phi, theta1;
 	float cos_theta, sin_theta;
@@ -676,7 +664,7 @@ static void partial_donut(float radring, float radhole, int start, int end, int
 	float ring_delta, side_delta;
 	int i, j, docaps= 1;
 
-	if(start==0 && end==nrings) docaps= 0;
+	if (start==0 && end==nrings) docaps= 0;
 
 	ring_delta= 2.0f*(float)M_PI/(float)nrings;
 	side_delta= 2.0f*(float)M_PI/(float)nsides;
@@ -685,15 +673,15 @@ static void partial_donut(float radring, float radhole, int start, int end, int
 	cos_theta= (float)cos(theta);
 	sin_theta= (float)sin(theta);
 
-	for(i= nrings - 1; i >= 0; i--) {
+	for (i= nrings - 1; i >= 0; i--) {
 		theta1= theta + ring_delta;
 		cos_theta1= (float)cos(theta1);
 		sin_theta1= (float)sin(theta1);
 
-		if(docaps && i==start) {	// cap
+		if (docaps && i==start) {	// cap
 			glBegin(GL_POLYGON);
 			phi= 0.0;
-			for(j= nsides; j >= 0; j--) {
+			for (j= nsides; j >= 0; j--) {
 				float cos_phi, sin_phi, dist;
 
 				phi += side_delta;
@@ -705,10 +693,10 @@ static void partial_donut(float radring, float radhole, int start, int end, int
 			}
 			glEnd();
 		}
-		if(i>=start && i<=end) {
+		if (i>=start && i<=end) {
 			glBegin(GL_QUAD_STRIP);
 			phi= 0.0;
-			for(j= nsides; j >= 0; j--) {
+			for (j= nsides; j >= 0; j--) {
 				float cos_phi, sin_phi, dist;
 
 				phi += side_delta;
@@ -722,10 +710,10 @@ static void partial_donut(float radring, float radhole, int start, int end, int
 			glEnd();
 		}
 
-		if(docaps && i==end) {	// cap
+		if (docaps && i==end) {	// cap
 			glBegin(GL_POLYGON);
 			phi= 0.0;
-			for(j= nsides; j >= 0; j--) {
+			for (j= nsides; j >= 0; j--) {
 				float cos_phi, sin_phi, dist;
 
 				phi -= side_delta;
@@ -757,31 +745,31 @@ static char axisBlendAngle(float angle)
 }
 
 /* three colors can be set;
-   grey for ghosting
-   moving: in transform theme color
-   else the red/green/blue
-*/
+ * grey for ghosting
+ * moving: in transform theme color
+ * else the red/green/blue
+ */
 static void manipulator_setcolor(View3D *v3d, char axis, int colcode, unsigned char alpha)
 {
 	unsigned char col[4]= {0};
 	col[3]= alpha;
 
-	if(colcode==MAN_GHOST) {
+	if (colcode==MAN_GHOST) {
 		col[3]= 70;
 	}
-	else if(colcode==MAN_MOVECOL) {
+	else if (colcode==MAN_MOVECOL) {
 		UI_GetThemeColor3ubv(TH_TRANSFORM, col);
 	}
 	else {
 		switch(axis) {
 		case 'C':
 			UI_GetThemeColor3ubv(TH_TRANSFORM, col);
-			if(v3d->twmode == V3D_MANIP_LOCAL) {
+			if (v3d->twmode == V3D_MANIP_LOCAL) {
 				col[0]= col[0]>200?255:col[0]+55;
 				col[1]= col[1]>200?255:col[1]+55;
 				col[2]= col[2]>200?255:col[2]+55;
 			}
-			else if(v3d->twmode == V3D_MANIP_NORMAL) {
+			else if (v3d->twmode == V3D_MANIP_NORMAL) {
 				col[0]= col[0]<55?0:col[0]-55;
 				col[1]= col[1]<55?0:col[1]-55;
 				col[2]= col[2]<55?0:col[2]-55;
@@ -811,27 +799,27 @@ static void draw_manipulator_axes(View3D *v3d, RegionView3D *rv3d, int colcode,
 {
 
 	/* axes */
-	if(flagx) {
+	if (flagx) {
 		manipulator_setcolor(v3d, 'X', colcode, axisBlendAngle(rv3d->twangle[0]));
-		if(flagx & MAN_SCALE_X) glLoadName(MAN_SCALE_X);
-		else if(flagx & MAN_TRANS_X) glLoadName(MAN_TRANS_X);
+		if (flagx & MAN_SCALE_X) glLoadName(MAN_SCALE_X);
+		else if (flagx & MAN_TRANS_X) glLoadName(MAN_TRANS_X);
 		glBegin(GL_LINES);
 		glVertex3f(0.2f, 0.0f, 0.0f);
 		glVertex3f(1.0f, 0.0f, 0.0f);
 		glEnd();
 	}
-	if(flagy) {
-		if(flagy & MAN_SCALE_Y) glLoadName(MAN_SCALE_Y);
-		else if(flagy & MAN_TRANS_Y) glLoadName(MAN_TRANS_Y);
+	if (flagy) {
+		if (flagy & MAN_SCALE_Y) glLoadName(MAN_SCALE_Y);
+		else if (flagy & MAN_TRANS_Y) glLoadName(MAN_TRANS_Y);
 		manipulator_setcolor(v3d, 'Y', colcode, axisBlendAngle(rv3d->twangle[1]));
 		glBegin(GL_LINES);
 		glVertex3f(0.0f, 0.2f, 0.0f);
 		glVertex3f(0.0f, 1.0f, 0.0f);
 		glEnd();
 	}
-	if(flagz) {
-		if(flagz & MAN_SCALE_Z) glLoadName(MAN_SCALE_Z);
-		else if(flagz & MAN_TRANS_Z) glLoadName(MAN_TRANS_Z);
+	if (flagz) {
+		if (flagz & MAN_SCALE_Z) glLoadName(MAN_SCALE_Z);
+		else if (flagz & MAN_TRANS_Z) glLoadName(MAN_TRANS_Z);
 		manipulator_setcolor(v3d, 'Z', colcode, axisBlendAngle(rv3d->twangle[2]));
 		glBegin(GL_LINES);
 		glVertex3f(0.0f, 0.0f, 0.2f);
@@ -871,11 +859,11 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
 	int colcode;
 	int ortho;
 
-	if(moving) colcode= MAN_MOVECOL;
+	if (moving) colcode= MAN_MOVECOL;
 	else colcode= MAN_RGB;
 
 	/* when called while moving in mixed mode, do not draw when... */
-	if((drawflags & MAN_ROT_C)==0) return;
+	if ((drawflags & MAN_ROT_C)==0) return;
 
 	/* Init stuff */
 	glDisable(GL_DEPTH_TEST);
@@ -889,9 +877,9 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
 	glPushMatrix();
 	glTranslatef(rv3d->twmat[3][0], rv3d->twmat[3][1], rv3d->twmat[3][2]);
 
-	if(arcs) {
+	if (arcs) {
 		/* clipplane makes nice handles, calc here because of multmatrix but with translate! */
-		VECCOPY(plane, rv3d->viewinv[2]); /* float -> double */
+		copy_v3db_v3fl(plane, rv3d->viewinv[2]);
 		plane[3]= -0.02f*size; // clip just a bit more
 		glClipPlane(GL_CLIP_PLANE0, plane);
 	}
@@ -899,28 +887,28 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
 	glRotatef( -360.0f*saacos(rv3d->viewquat[0])/(float)M_PI, rv3d->viewquat[1], rv3d->viewquat[2], rv3d->viewquat[3]);
 
 	/* Screen aligned help circle */
-	if(arcs) {
-		if((G.f & G_PICKSEL)==0) {
+	if (arcs) {
+		if ((G.f & G_PICKSEL)==0) {
 			UI_ThemeColorShade(TH_BACK, -30);
 			drawcircball(GL_LINE_LOOP, unitmat[3], size, unitmat);
 		}
 	}
 
 	/* Screen aligned trackball rot circle */
-	if(drawflags & MAN_ROT_T) {
-		if(G.f & G_PICKSEL) glLoadName(MAN_ROT_T);
+	if (drawflags & MAN_ROT_T) {
+		if (G.f & G_PICKSEL) glLoadName(MAN_ROT_T);
 
 		UI_ThemeColor(TH_TRANSFORM);
 		drawcircball(GL_LINE_LOOP, unitmat[3], 0.2f*size, unitmat);
 	}
 
 	/* Screen aligned view rot circle */
-	if(drawflags & MAN_ROT_V) {
-		if(G.f & G_PICKSEL) glLoadName(MAN_ROT_V);
+	if (drawflags & MAN_ROT_V) {
+		if (G.f & G_PICKSEL) glLoadName(MAN_ROT_V);
 		UI_ThemeColor(TH_TRANSFORM);
 		drawcircball(GL_LINE_LOOP, unitmat[3], 1.2f*size, unitmat);
 
-		if(moving) {
+		if (moving) {
 			float vec[3];
 			vec[0]= 0; // XXX (float)(t->imval[0] - t->center2d[0]);
 			vec[1]= 0; // XXX (float)(t->imval[1] - t->center2d[1]);
@@ -939,7 +927,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
 	ortho = is_orthogonal_m4(rv3d->twmat);
 	
 	/* apply the transform delta */
-	if(moving) {
+	if (moving) {
 		copy_m4_m4(matt, rv3d->twmat); // to copy the parts outside of [3][3]
 		// XXX mul_m4_m3m4(matt, t->mat, rv3d->twmat);
 		if (ortho) {
@@ -955,11 +943,11 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
 	}
 
 	/* axes */
-	if(arcs==0) {
-		if(!(G.f & G_PICKSEL)) {
-			if( (combo & V3D_MANIP_SCALE)==0) {
+	if (arcs==0) {
+		if (!(G.f & G_PICKSEL)) {
+			if ( (combo & V3D_MANIP_SCALE)==0) {
 				/* axis */
-				if( (drawflags & MAN_ROT_X) || (moving && (drawflags & MAN_ROT_Z)) ) {
+				if ( (drawflags & MAN_ROT_X) || (moving && (drawflags & MAN_ROT_Z)) ) {
 					preOrthoFront(ortho, rv3d->twmat, 2);
 					manipulator_setcolor(v3d, 'X', colcode, 255);
 					glBegin(GL_LINES);
@@ -968,7 +956,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
 					glEnd();
 					postOrtho(ortho);
 				}
-				if( (drawflags & MAN_ROT_Y) || (moving && (drawflags & MAN_ROT_X)) ) {
+				if ( (drawflags & MAN_ROT_Y) || (moving && (drawflags & MAN_ROT_X)) ) {
 					preOrthoFront(ortho, rv3d->twmat, 0);
 					manipulator_setcolor(v3d, 'Y', colcode, 255);
 					glBegin(GL_LINES);
@@ -977,7 +965,7 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
 					glEnd();
 					postOrtho(ortho);
 				}
-				if( (drawflags & MAN_ROT_Z) || (moving && (drawflags & MAN_ROT_Y)) ) {
+				if ( (drawflags & MAN_ROT_Z) || (moving && (drawflags & MAN_ROT_Y)) ) {
 					preOrthoFront(ortho, rv3d->twmat, 1);
 					manipulator_setcolor(v3d, 'Z', colcode, 255);
 					glBegin(GL_LINES);
@@ -990,20 +978,20 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
 		}
 	}
 
-	if(arcs==0 && moving) {
+	if (arcs==0 && moving) {
 
 		/* Z circle */
-		if(drawflags & MAN_ROT_Z) {
+		if (drawflags & MAN_ROT_Z) {
 			preOrthoFront(ortho, matt, 2);
-			if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
+			if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
 			manipulator_setcolor(v3d, 'Z', colcode, 255);
 			drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat);
 			postOrtho(ortho);
 		}
 		/* X circle */
-		if(drawflags & MAN_ROT_X) {
+		if (drawflags & MAN_ROT_X) {
 			preOrthoFront(ortho, matt, 0);
-			if(G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
+			if (G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
 			glRotatef(90.0, 0.0, 1.0, 0.0);
 			manipulator_setcolor(v3d, 'X', colcode, 255);
 			drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat);
@@ -1011,9 +999,9 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
 			postOrtho(ortho);
 		}
 		/* Y circle */
-		if(drawflags & MAN_ROT_Y) {
+		if (drawflags & MAN_ROT_Y) {
 			preOrthoFront(ortho, matt, 1);
-			if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
+			if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
 			glRotatef(-90.0, 1.0, 0.0, 0.0);
 			manipulator_setcolor(v3d, 'Y', colcode, 255);
 			drawcircball(GL_LINE_LOOP, unitmat[3], 1.0, unitmat);
@@ -1021,37 +1009,37 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
 			postOrtho(ortho);
 		}
 
-		if(arcs) glDisable(GL_CLIP_PLANE0);
+		if (arcs) glDisable(GL_CLIP_PLANE0);
 	}
 	// donut arcs
-	if(arcs) {
+	if (arcs) {
 		glEnable(GL_CLIP_PLANE0);
 
 		/* Z circle */
-		if(drawflags & MAN_ROT_Z) {
+		if (drawflags & MAN_ROT_Z) {
 			preOrthoFront(ortho, rv3d->twmat, 2);
-			if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
+			if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
 			manipulator_setcolor(v3d, 'Z', colcode, 255);
-			partial_donut(cusize/4.0f, 1.0f, 0, 48, 8, 48);
+			partial_doughnut(cusize/4.0f, 1.0f, 0, 48, 8, 48);
 			postOrtho(ortho);
 		}
 		/* X circle */
-		if(drawflags & MAN_ROT_X) {
+		if (drawflags & MAN_ROT_X) {
 			preOrthoFront(ortho, rv3d->twmat, 0);
-			if(G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
+			if (G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
 			glRotatef(90.0, 0.0, 1.0, 0.0);
 			manipulator_setcolor(v3d, 'X', colcode, 255);
-			partial_donut(cusize/4.0f, 1.0f, 0, 48, 8, 48);
+			partial_doughnut(cusize/4.0f, 1.0f, 0, 48, 8, 48);
 			glRotatef(-90.0, 0.0, 1.0, 0.0);
 			postOrtho(ortho);
 		}
 		/* Y circle */
-		if(drawflags & MAN_ROT_Y) {
+		if (drawflags & MAN_ROT_Y) {
 			preOrthoFront(ortho, rv3d->twmat, 1);
-			if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
+			if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
 			glRotatef(-90.0, 1.0, 0.0, 0.0);
 			manipulator_setcolor(v3d, 'Y', colcode, 255);
-			partial_donut(cusize/4.0f, 1.0f, 0, 48, 8, 48);
+			partial_doughnut(cusize/4.0f, 1.0f, 0, 48, 8, 48);
 			glRotatef(90.0, 1.0, 0.0, 0.0);
 			postOrtho(ortho);
 		}
@@ -1059,46 +1047,46 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
 		glDisable(GL_CLIP_PLANE0);
 	}
 
-	if(arcs==0) {
+	if (arcs==0) {
 
 		/* Z handle on X axis */
-		if(drawflags & MAN_ROT_Z) {
+		if (drawflags & MAN_ROT_Z) {
 			preOrthoFront(ortho, rv3d->twmat, 2);
 			glPushMatrix();
-			if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
+			if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
 			manipulator_setcolor(v3d, 'Z', colcode, 255);
 
-			partial_donut(0.7f*cusize, 1.0f, 31, 33, 8, 64);
+			partial_doughnut(0.7f*cusize, 1.0f, 31, 33, 8, 64);
 
 			glPopMatrix();
 			postOrtho(ortho);
 		}
 
 		/* Y handle on X axis */
-		if(drawflags & MAN_ROT_Y) {
+		if (drawflags & MAN_ROT_Y) {
 			preOrthoFront(ortho, rv3d->twmat, 1);
 			glPushMatrix();
-			if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
+			if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
 			manipulator_setcolor(v3d, 'Y', colcode, 255);
 
 			glRotatef(90.0, 1.0, 0.0, 0.0);
 			glRotatef(90.0, 0.0, 0.0, 1.0);
-			partial_donut(0.7f*cusize, 1.0f, 31, 33, 8, 64);
+			partial_doughnut(0.7f*cusize, 1.0f, 31, 33, 8, 64);
 
 			glPopMatrix();
 			postOrtho(ortho);
 		}
 
 		/* X handle on Z axis */
-		if(drawflags & MAN_ROT_X) {
+		if (drawflags & MAN_ROT_X) {
 			preOrthoFront(ortho, rv3d->twmat, 0);
 			glPushMatrix();
-			if(G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
+			if (G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
 			manipulator_setcolor(v3d, 'X', colcode, 255);
 
 			glRotatef(-90.0, 0.0, 1.0, 0.0);
 			glRotatef(90.0, 0.0, 0.0, 1.0);
-			partial_donut(0.7f*cusize, 1.0f, 31, 33, 8, 64);
+			partial_doughnut(0.7f*cusize, 1.0f, 31, 33, 8, 64);
 
 			glPopMatrix();
 			postOrtho(ortho);
@@ -1109,27 +1097,26 @@ static void draw_manipulator_rotate(View3D *v3d, RegionView3D *rv3d, int moving,
 	/* restore */
 	glLoadMatrixf(rv3d->viewmat);
 	gluDeleteQuadric(qobj);
-	if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+	if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
 
 }
 
 static void drawsolidcube(float size)
 {
 	static float cube[8][3] = {
-	{-1.0, -1.0, -1.0},
-	{-1.0, -1.0,  1.0},
-	{-1.0,  1.0,  1.0},
-	{-1.0,  1.0, -1.0},
-	{ 1.0, -1.0, -1.0},
-	{ 1.0, -1.0,  1.0},
-	{ 1.0,  1.0,  1.0},
-	{ 1.0,  1.0, -1.0},	};
-	float n[3];
+	    {-1.0, -1.0, -1.0},
+	    {-1.0, -1.0,  1.0},
+	    {-1.0,  1.0,  1.0},
+	    {-1.0,  1.0, -1.0},
+	    { 1.0, -1.0, -1.0},
+	    { 1.0, -1.0,  1.0},
+	    { 1.0,  1.0,  1.0},
+	    { 1.0,  1.0, -1.0}, };
+	float n[3] = {0.0f};
 
 	glPushMatrix();
 	glScalef(size, size, size);
 
-	n[0]=0; n[1]=0; n[2]=0;
 	glBegin(GL_QUADS);
 	n[0]= -1.0;
 	glNormal3fv(n);
@@ -1181,17 +1168,17 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving,
 	float cusize= cywid*0.75f, dz;
 
 	/* when called while moving in mixed mode, do not draw when... */
-	if((drawflags & MAN_SCALE_C)==0) return;
+	if ((drawflags & MAN_SCALE_C)==0) return;
 
 	glDisable(GL_DEPTH_TEST);
 
 	/* not in combo mode */
-	if( (combo & (V3D_MANIP_TRANSLATE|V3D_MANIP_ROTATE))==0) {
+	if ( (combo & (V3D_MANIP_TRANSLATE|V3D_MANIP_ROTATE))==0) {
 		float size, unitmat[4][4];
 		int shift= 0; // XXX
 
 		/* center circle, do not add to selection when shift is pressed (planar constraint)  */
-		if( (G.f & G_PICKSEL) && shift==0) glLoadName(MAN_SCALE_C);
+		if ( (G.f & G_PICKSEL) && shift==0) glLoadName(MAN_SCALE_C);
 
 		manipulator_setcolor(v3d, 'C', colcode, 255);
 		glPushMatrix();
@@ -1204,7 +1191,7 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving,
 	}
 	else dz= 1.0f-4.0f*cusize;
 
-	if(moving) {
+	if (moving) {
 		float matt[4][4];
 
 		copy_m4_m4(matt, rv3d->twmat); // to copy the parts outside of [3][3]
@@ -1224,31 +1211,31 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving,
 
 	/* Z cube */
 	glTranslatef(0.0, 0.0, dz);
-	if(drawflags & MAN_SCALE_Z) {
-		if(G.f & G_PICKSEL) glLoadName(MAN_SCALE_Z);
+	if (drawflags & MAN_SCALE_Z) {
+		if (G.f & G_PICKSEL) glLoadName(MAN_SCALE_Z);
 		manipulator_setcolor(v3d, 'Z', colcode, axisBlendAngle(rv3d->twangle[2]));
 		drawsolidcube(cusize);
 	}
 	/* X cube */
 	glTranslatef(dz, 0.0, -dz);
-	if(drawflags & MAN_SCALE_X) {
-		if(G.f & G_PICKSEL) glLoadName(MAN_SCALE_X);
+	if (drawflags & MAN_SCALE_X) {
+		if (G.f & G_PICKSEL) glLoadName(MAN_SCALE_X);
 		manipulator_setcolor(v3d, 'X', colcode, axisBlendAngle(rv3d->twangle[0]));
 		drawsolidcube(cusize);
 	}
 	/* Y cube */
 	glTranslatef(-dz, dz, 0.0);
-	if(drawflags & MAN_SCALE_Y) {
-		if(G.f & G_PICKSEL) glLoadName(MAN_SCALE_Y);
+	if (drawflags & MAN_SCALE_Y) {
+		if (G.f & G_PICKSEL) glLoadName(MAN_SCALE_Y);
 		manipulator_setcolor(v3d, 'Y', colcode, axisBlendAngle(rv3d->twangle[1]));
 		drawsolidcube(cusize);
 	}
 
 	/* if shiftkey, center point as last, for selectbuffer order */
-	if(G.f & G_PICKSEL) {
+	if (G.f & G_PICKSEL) {
 		int shift= 0; // XXX
 
-		if(shift) {
+		if (shift) {
 			glTranslatef(0.0, -dz, 0.0);
 			glLoadName(MAN_SCALE_C);
 			glBegin(GL_POINTS);
@@ -1260,7 +1247,7 @@ static void draw_manipulator_scale(View3D *v3d, RegionView3D *rv3d, int moving,
 	/* restore */
 	glLoadMatrixf(rv3d->viewmat);
 
-	if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+	if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
 	glFrontFace(GL_CCW);
 }
 
@@ -1300,16 +1287,16 @@ static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUS
 	int shift= 0; // XXX
 
 	/* when called while moving in mixed mode, do not draw when... */
-	if((drawflags & MAN_TRANS_C)==0) return;
+	if ((drawflags & MAN_TRANS_C)==0) return;
 
-	// XXX if(moving) glTranslatef(t->vec[0], t->vec[1], t->vec[2]);
+	// XXX if (moving) glTranslatef(t->vec[0], t->vec[1], t->vec[2]);
 	glDisable(GL_DEPTH_TEST);
 
 	qobj= gluNewQuadric();
 	gluQuadricDrawStyle(qobj, GLU_FILL);
 
 	/* center circle, do not add to selection when shift is pressed (planar constraint) */
-	if( (G.f & G_PICKSEL) && shift==0) glLoadName(MAN_TRANS_C);
+	if ( (G.f & G_PICKSEL) && shift==0) glLoadName(MAN_TRANS_C);
 
 	manipulator_setcolor(v3d, 'C', colcode, 255);
 	glPushMatrix();
@@ -1325,26 +1312,26 @@ static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUS
 	glLoadName(-1);
 
 	// translate drawn as last, only axis when no combo with scale, or for ghosting
-	if((combo & V3D_MANIP_SCALE)==0 || colcode==MAN_GHOST)
+	if ((combo & V3D_MANIP_SCALE)==0 || colcode==MAN_GHOST)
 		draw_manipulator_axes(v3d, rv3d, colcode, drawflags & MAN_TRANS_X, drawflags & MAN_TRANS_Y, drawflags & MAN_TRANS_Z);
 
 
 	/* offset in combo mode, for rotate a bit more */
-	if(combo & (V3D_MANIP_ROTATE)) dz= 1.0f+2.0f*cylen;
-	else if(combo & (V3D_MANIP_SCALE)) dz= 1.0f+0.5f*cylen;
+	if (combo & (V3D_MANIP_ROTATE)) dz= 1.0f+2.0f*cylen;
+	else if (combo & (V3D_MANIP_SCALE)) dz= 1.0f+0.5f*cylen;
 	else dz= 1.0f;
 
 	/* Z Cone */
 	glTranslatef(0.0, 0.0, dz);
-	if(drawflags & MAN_TRANS_Z) {
-		if(G.f & G_PICKSEL) glLoadName(MAN_TRANS_Z);
+	if (drawflags & MAN_TRANS_Z) {
+		if (G.f & G_PICKSEL) glLoadName(MAN_TRANS_Z);
 		manipulator_setcolor(v3d, 'Z', colcode, axisBlendAngle(rv3d->twangle[2]));
 		draw_cone(qobj, cylen, cywid);
 	}
 	/* X Cone */
 	glTranslatef(dz, 0.0, -dz);
-	if(drawflags & MAN_TRANS_X) {
-		if(G.f & G_PICKSEL) glLoadName(MAN_TRANS_X);
+	if (drawflags & MAN_TRANS_X) {
+		if (G.f & G_PICKSEL) glLoadName(MAN_TRANS_X);
 		glRotatef(90.0, 0.0, 1.0, 0.0);
 		manipulator_setcolor(v3d, 'X', colcode, axisBlendAngle(rv3d->twangle[0]));
 		draw_cone(qobj, cylen, cywid);
@@ -1352,8 +1339,8 @@ static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUS
 	}
 	/* Y Cone */
 	glTranslatef(-dz, dz, 0.0);
-	if(drawflags & MAN_TRANS_Y) {
-		if(G.f & G_PICKSEL) glLoadName(MAN_TRANS_Y);
+	if (drawflags & MAN_TRANS_Y) {
+		if (G.f & G_PICKSEL) glLoadName(MAN_TRANS_Y);
 		glRotatef(-90.0, 1.0, 0.0, 0.0);
 		manipulator_setcolor(v3d, 'Y', colcode, axisBlendAngle(rv3d->twangle[1]));
 		draw_cone(qobj, cylen, cywid);
@@ -1362,7 +1349,7 @@ static void draw_manipulator_translate(View3D *v3d, RegionView3D *rv3d, int UNUS
 	gluDeleteQuadric(qobj);
 	glLoadMatrixf(rv3d->viewmat);
 
-	if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+	if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
 
 }
 
@@ -1374,7 +1361,7 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
 	float cywid= 0.25f*cylen;
 
 	/* when called while moving in mixed mode, do not draw when... */
-	if((drawflags & MAN_ROT_C)==0) return;
+	if ((drawflags & MAN_ROT_C)==0) return;
 
 	/* prepare for screen aligned draw */
 	glPushMatrix();
@@ -1385,14 +1372,14 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
 	qobj= gluNewQuadric();
 
 	/* Screen aligned view rot circle */
-	if(drawflags & MAN_ROT_V) {
+	if (drawflags & MAN_ROT_V) {
 		float unitmat[4][4]= MAT4_UNITY;
 
-		if(G.f & G_PICKSEL) glLoadName(MAN_ROT_V);
+		if (G.f & G_PICKSEL) glLoadName(MAN_ROT_V);
 		UI_ThemeColor(TH_TRANSFORM);
 		drawcircball(GL_LINE_LOOP, unitmat[3], 1.2f*size, unitmat);
 
-		if(moving) {
+		if (moving) {
 			float vec[3];
 			vec[0]= 0; // XXX (float)(t->imval[0] - t->center2d[0]);
 			vec[1]= 0; // XXX (float)(t->imval[1] - t->center2d[1]);
@@ -1408,7 +1395,7 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
 	glPopMatrix();
 
 	/* apply the transform delta */
-	if(moving) {
+	if (moving) {
 		float matt[4][4];
 		copy_m4_m4(matt, rv3d->twmat); // to copy the parts outside of [3][3]
 		// XXX 		if (t->flag & T_USES_MANIPULATOR) {
@@ -1423,10 +1410,10 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
 	glFrontFace(is_negative_m4(rv3d->twmat) ? GL_CW:GL_CCW);
 
 	/* axis */
-	if( (G.f & G_PICKSEL)==0 ) {
+	if ( (G.f & G_PICKSEL)==0 ) {
 
 		// only draw axis when combo didn't draw scale axes
-		if((combo & V3D_MANIP_SCALE)==0)
+		if ((combo & V3D_MANIP_SCALE)==0)
 			draw_manipulator_axes(v3d, rv3d, colcode, drawflags & MAN_ROT_X, drawflags & MAN_ROT_Y, drawflags & MAN_ROT_Z);
 
 		/* only has to be set when not in picking */
@@ -1435,15 +1422,15 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
 
 	/* Z cyl */
 	glTranslatef(0.0, 0.0, 1.0);
-	if(drawflags & MAN_ROT_Z) {
-		if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
+	if (drawflags & MAN_ROT_Z) {
+		if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Z);
 		manipulator_setcolor(v3d, 'Z', colcode, 255);
 		draw_cylinder(qobj, cylen, cywid);
 	}
 	/* X cyl */
 	glTranslatef(1.0, 0.0, -1.0);
-	if(drawflags & MAN_ROT_X) {
-		if(G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
+	if (drawflags & MAN_ROT_X) {
+		if (G.f & G_PICKSEL) glLoadName(MAN_ROT_X);
 		glRotatef(90.0, 0.0, 1.0, 0.0);
 		manipulator_setcolor(v3d, 'X', colcode, 255);
 		draw_cylinder(qobj, cylen, cywid);
@@ -1451,8 +1438,8 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
 	}
 	/* Y cylinder */
 	glTranslatef(-1.0, 1.0, 0.0);
-	if(drawflags & MAN_ROT_Y) {
-		if(G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
+	if (drawflags & MAN_ROT_Y) {
+		if (G.f & G_PICKSEL) glLoadName(MAN_ROT_Y);
 		glRotatef(-90.0, 1.0, 0.0, 0.0);
 		manipulator_setcolor(v3d, 'Y', colcode, 255);
 		draw_cylinder(qobj, cylen, cywid);
@@ -1463,7 +1450,7 @@ static void draw_manipulator_rotate_cyl(View3D *v3d, RegionView3D *rv3d, int mov
 	gluDeleteQuadric(qobj);
 	glLoadMatrixf(rv3d->viewmat);
 
-	if(v3d->zbuf) glEnable(GL_DEPTH_TEST);
+	if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
 
 }
 
@@ -1483,15 +1470,15 @@ void BIF_draw_manipulator(const bContext *C)
 	RegionView3D *rv3d= ar->regiondata;
 	int totsel;
 
-	if(!(v3d->twflag & V3D_USE_MANIPULATOR)) return;
-//	if(G.moving && (G.moving & G_TRANSFORM_MANIP)==0) return;
+	if (!(v3d->twflag & V3D_USE_MANIPULATOR)) return;
+//	if (G.moving && (G.moving & G_TRANSFORM_MANIP)==0) return;
 
-//	if(G.moving==0) {
+//	if (G.moving==0) {
 	{
 		v3d->twflag &= ~V3D_DRAW_MANIPULATOR;
 
 		totsel= calc_manipulator_stats(C);
-		if(totsel==0) return;
+		if (totsel==0) return;
 
 		v3d->twflag |= V3D_DRAW_MANIPULATOR;
 
@@ -1502,9 +1489,9 @@ void BIF_draw_manipulator(const bContext *C)
 			rv3d->twmat[3][0]= (scene->twmin[0] + scene->twmax[0])/2.0f;
 			rv3d->twmat[3][1]= (scene->twmin[1] + scene->twmax[1])/2.0f;
 			rv3d->twmat[3][2]= (scene->twmin[2] + scene->twmax[2])/2.0f;
-			if(v3d->around==V3D_ACTIVE && scene->obedit==NULL) {
+			if (v3d->around==V3D_ACTIVE && scene->obedit==NULL) {
 				Object *ob= OBACT;
-				if(ob && !(ob->mode & OB_MODE_POSE))
+				if (ob && !(ob->mode & OB_MODE_POSE))
 					copy_v3_v3(rv3d->twmat[3], ob->obmat[3]);
 			}
 			break;
@@ -1523,23 +1510,23 @@ void BIF_draw_manipulator(const bContext *C)
 	test_manipulator_axis(C);
 	drawflags= rv3d->twdrawflag;	/* set in calc_manipulator_stats */
 
-	if(v3d->twflag & V3D_DRAW_MANIPULATOR) {
+	if (v3d->twflag & V3D_DRAW_MANIPULATOR) {
 
 		glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
 		glEnable(GL_BLEND);
-		if(v3d->twtype & V3D_MANIP_ROTATE) {
+		if (v3d->twtype & V3D_MANIP_ROTATE) {
 
-			if(G.rt==3) {
-				if(G.moving) draw_manipulator_rotate_cyl(v3d, rv3d, 1, drawflags, v3d->twtype, MAN_MOVECOL);
+			if (G.rt==3) {
+				if (G.moving) draw_manipulator_rotate_cyl(v3d, rv3d, 1, drawflags, v3d->twtype, MAN_MOVECOL);
 				else draw_manipulator_rotate_cyl(v3d, rv3d, 0, drawflags, v3d->twtype, MAN_RGB);
 			}
 			else
 				draw_manipulator_rotate(v3d, rv3d, 0 /* G.moving*/, drawflags, v3d->twtype);
 		}
-		if(v3d->twtype & V3D_MANIP_SCALE) {
+		if (v3d->twtype & V3D_MANIP_SCALE) {
 			draw_manipulator_scale(v3d, rv3d, 0, drawflags, v3d->twtype, MAN_RGB);
 		}
-		if(v3d->twtype & V3D_MANIP_TRANSLATE) {
+		if (v3d->twtype & V3D_MANIP_TRANSLATE) {
 			draw_manipulator_translate(v3d, rv3d, 0, drawflags, v3d->twtype, MAN_RGB);
 		}
 
@@ -1558,10 +1545,10 @@ static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const int mval[2], fl
 
 	G.f |= G_PICKSEL;
 
-	rect.xmin= mval[0]-hotspot;
-	rect.xmax= mval[0]+hotspot;
-	rect.ymin= mval[1]-hotspot;
-	rect.ymax= mval[1]+hotspot;
+	rect.xmin = mval[0]-hotspot;
+	rect.xmax = mval[0]+hotspot;
+	rect.ymin = mval[1]-hotspot;
+	rect.ymax = mval[1]+hotspot;
 
 	setwinmatrixview3d(ar, v3d, &rect);
 	mult_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat);
@@ -1572,13 +1559,13 @@ static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const int mval[2], fl
 	glPushName(-2);
 
 	/* do the drawing */
-	if(v3d->twtype & V3D_MANIP_ROTATE) {
-		if(G.rt==3) draw_manipulator_rotate_cyl(v3d, rv3d, 0, MAN_ROT_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB);
+	if (v3d->twtype & V3D_MANIP_ROTATE) {
+		if (G.rt==3) draw_manipulator_rotate_cyl(v3d, rv3d, 0, MAN_ROT_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB);
 		else draw_manipulator_rotate(v3d, rv3d, 0, MAN_ROT_C & rv3d->twdrawflag, v3d->twtype);
 	}
-	if(v3d->twtype & V3D_MANIP_SCALE)
+	if (v3d->twtype & V3D_MANIP_SCALE)
 		draw_manipulator_scale(v3d, rv3d, 0, MAN_SCALE_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB);
-	if(v3d->twtype & V3D_MANIP_TRANSLATE)
+	if (v3d->twtype & V3D_MANIP_TRANSLATE)
 		draw_manipulator_translate(v3d, rv3d, 0, MAN_TRANS_C & rv3d->twdrawflag, v3d->twtype, MAN_RGB);
 
 	glPopName();
@@ -1588,29 +1575,29 @@ static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const int mval[2], fl
 	setwinmatrixview3d(ar, v3d, NULL);
 	mult_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat);
 
-	if(hits==1) return buffer[3];
-	else if(hits>1) {
+	if (hits==1) return buffer[3];
+	else if (hits>1) {
 		GLuint val, dep, mindep=0, mindeprot=0, minval=0, minvalrot=0;
 		int a;
 
 		/* we compare the hits in buffer, but value centers highest */
 		/* we also store the rotation hits separate (because of arcs) and return hits on other widgets if there are */
 
-		for(a=0; a<hits; a++) {
+		for (a=0; a<hits; a++) {
 			dep= buffer[4*a + 1];
 			val= buffer[4*a + 3];
 
-			if(val==MAN_TRANS_C) return MAN_TRANS_C;
-			else if(val==MAN_SCALE_C) return MAN_SCALE_C;
+			if (val==MAN_TRANS_C) return MAN_TRANS_C;
+			else if (val==MAN_SCALE_C) return MAN_SCALE_C;
 			else {
-				if(val & MAN_ROT_C) {
-					if(minvalrot==0 || dep<mindeprot) {
+				if (val & MAN_ROT_C) {
+					if (minvalrot==0 || dep<mindeprot) {
 						mindeprot= dep;
 						minvalrot= val;
 					}
 				}
 				else {
-					if(minval==0 || dep<mindep) {
+					if (minval==0 || dep<mindep) {
 						mindep= dep;
 						minval= val;
 					}
@@ -1618,7 +1605,7 @@ static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const int mval[2], fl
 			}
 		}
 
-		if(minval)
+		if (minval)
 			return minval;
 		else
 			return minvalrot;
@@ -1637,26 +1624,26 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op)
 	int val;
 	int shift = event->shift;
 
-	if(!(v3d->twflag & V3D_USE_MANIPULATOR)) return 0;
-	if(!(v3d->twflag & V3D_DRAW_MANIPULATOR)) return 0;
+	if (!(v3d->twflag & V3D_USE_MANIPULATOR)) return 0;
+	if (!(v3d->twflag & V3D_DRAW_MANIPULATOR)) return 0;
 
 	/* Force orientation */
 	RNA_enum_set(op->ptr, "constraint_orientation", v3d->twmode);
 
 	// find the hotspots first test narrow hotspot
 	val= manipulator_selectbuf(sa, ar, event->mval, 0.5f*(float)U.tw_hotspot);
-	if(val) {
+	if (val) {
 
 		// drawflags still global, for drawing call above
 		drawflags= manipulator_selectbuf(sa, ar, event->mval, 0.2f*(float)U.tw_hotspot);
-		if(drawflags==0) drawflags= val;
+		if (drawflags==0) drawflags= val;
 
 		if (drawflags & MAN_TRANS_C) {
 			switch(drawflags) {
 			case MAN_TRANS_C:
 				break;
 			case MAN_TRANS_X:
-				if(shift) {
+				if (shift) {
 					constraint_axis[1] = 1;
 					constraint_axis[2] = 1;
 				}
@@ -1664,7 +1651,7 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op)
 					constraint_axis[0] = 1;
 				break;
 			case MAN_TRANS_Y:
-				if(shift) {
+				if (shift) {
 					constraint_axis[0] = 1;
 					constraint_axis[2] = 1;
 				}
@@ -1672,7 +1659,7 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op)
 					constraint_axis[1] = 1;
 				break;
 			case MAN_TRANS_Z:
-				if(shift) {
+				if (shift) {
 					constraint_axis[0] = 1;
 					constraint_axis[1] = 1;
 				}
@@ -1687,7 +1674,7 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op)
 		else if (drawflags & MAN_SCALE_C) {
 			switch(drawflags) {
 			case MAN_SCALE_X:
-				if(shift) {
+				if (shift) {
 					constraint_axis[1] = 1;
 					constraint_axis[2] = 1;
 				}
@@ -1695,7 +1682,7 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op)
 					constraint_axis[0] = 1;
 				break;
 			case MAN_SCALE_Y:
-				if(shift) {
+				if (shift) {
 					constraint_axis[0] = 1;
 					constraint_axis[2] = 1;
 				}
@@ -1703,7 +1690,7 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op)
 					constraint_axis[1] = 1;
 				break;
 			case MAN_SCALE_Z:
-				if(shift) {
+				if (shift) {
 					constraint_axis[0] = 1;
 					constraint_axis[1] = 1;
 				}
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 1843768..09078c1 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -155,21 +155,21 @@ static int snap_type_exec(bContext *C, wmOperator *op)
 static void TRANSFORM_OT_snap_type(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Snap Type";
-	ot->description= "Set the snap element type";
-	ot->idname= "TRANSFORM_OT_snap_type";
+	ot->name = "Snap Type";
+	ot->description = "Set the snap element type";
+	ot->idname = "TRANSFORM_OT_snap_type";
 
 	/* api callbacks */
-	ot->invoke= WM_menu_invoke;
-	ot->exec= snap_type_exec;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = snap_type_exec;
 
-	ot->poll= ED_operator_areaactive;
+	ot->poll = ED_operator_areaactive;
 
 	/* flags */
-	ot->flag= OPTYPE_UNDO;
+	ot->flag = OPTYPE_UNDO;
 
 	/* props */
-	ot->prop= RNA_def_enum(ot->srna, "type", snap_element_items, 0, "Type", "Set the snap element type");
+	ot->prop = RNA_def_enum(ot->srna, "type", snap_element_items, 0, "Type", "Set the snap element type");
 
 }
 
@@ -203,7 +203,7 @@ static void TRANSFORM_OT_select_orientation(struct wmOperatorType *ot)
 
 	/* identifiers */
 	ot->name   = "Select Orientation";
-	ot->description= "Select transformation orientation";
+	ot->description = "Select transformation orientation";
 	ot->idname = "TRANSFORM_OT_select_orientation";
 	ot->flag   = OPTYPE_UNDO;
 
@@ -245,7 +245,7 @@ static int delete_orientation_poll(bContext *C)
 		return 0;
 	
 	
-	if(v3d) {
+	if (v3d) {
 		selected_index = (v3d->twmode - V3D_MANIP_CUSTOM);
 	}
 	
@@ -256,7 +256,7 @@ static void TRANSFORM_OT_delete_orientation(struct wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name   = "Delete Orientation";
-	ot->description= "Delete transformation orientation";
+	ot->description = "Delete transformation orientation";
 	ot->idname = "TRANSFORM_OT_delete_orientation";
 	ot->flag   = OPTYPE_UNDO;
 
@@ -291,7 +291,7 @@ static void TRANSFORM_OT_create_orientation(struct wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name   = "Create Orientation";
-	ot->description= "Create transformation orientation from selection";
+	ot->description = "Create transformation orientation from selection";
 	ot->idname = "TRANSFORM_OT_create_orientation";
 	ot->flag   = OPTYPE_REGISTER|OPTYPE_UNDO;
 
@@ -341,7 +341,7 @@ static int transformops_data(bContext *C, wmOperator *op, wmEvent *event)
 		G.moving = 1;
 
 		/* store data */
-		if(retval) {
+		if (retval) {
 			op->customdata = t;
 		}
 		else {
@@ -429,7 +429,7 @@ static int transform_invoke(bContext *C, wmOperator *op, wmEvent *event)
 		return OPERATOR_CANCELLED;
 	}
 
-	if(RNA_struct_property_is_set(op->ptr, "value")) {
+	if (RNA_struct_property_is_set(op->ptr, "value")) {
 		return transform_exec(C, op);
 	}
 	else {
@@ -500,12 +500,12 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
 	
 	if (flags & P_OPTIONS)
 	{
-		RNA_def_boolean(ot->srna, "texture_space", 0, "Edit Object data texture space", "");
+		RNA_def_boolean(ot->srna, "texture_space", 0, "Edit Texture Space", "Edit Object data texture space");
 	}
 
 	if (flags & P_CORRECT_UV)
 	{
-		RNA_def_boolean(ot->srna, "correct_uv", 0, "Correct UV coords when transforming", "");
+		RNA_def_boolean(ot->srna, "correct_uv", 0, "Correct UVs", "Correct UV coordinates when transforming");
 	}
 
 	// Add confirm method all the time. At the end because it's not really that important and should be hidden only in log, not in keymap edit
@@ -517,7 +517,7 @@ void TRANSFORM_OT_translate(struct wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name   = "Translate";
-	ot->description= "Translate selected items";
+	ot->description = "Translate (move) selected items";
 	ot->idname = OP_TRANSLATION;
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
 
@@ -525,7 +525,7 @@ void TRANSFORM_OT_translate(struct wmOperatorType *ot)
 	ot->invoke = transform_invoke;
 	ot->exec   = transform_exec;
 	ot->modal  = transform_modal;
-	ot->cancel  = transform_cancel;
+	ot->cancel = transform_cancel;
 	ot->poll   = ED_operator_screenactive;
 
 	RNA_def_float_vector_xyz(ot->srna, "value", 3, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
@@ -537,7 +537,7 @@ void TRANSFORM_OT_resize(struct wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name   = "Resize";
-	ot->description= "Resize selected items"; 
+	ot->description = "Scale (resize) selected items"; 
 	ot->idname = OP_RESIZE;
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
 
@@ -545,7 +545,7 @@ void TRANSFORM_OT_resize(struct wmOperatorType *ot)
 	ot->invoke = transform_invoke;
 	ot->exec   = transform_exec;
 	ot->modal  = transform_modal;
-	ot->cancel  = transform_cancel;
+	ot->cancel = transform_cancel;
 	ot->poll   = ED_operator_screenactive;
 
 	RNA_def_float_vector(ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
@@ -558,7 +558,7 @@ void TRANSFORM_OT_trackball(struct wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name   = "Trackball";
-	ot->description= "Trackball style rotation of selected items";
+	ot->description = "Trackball style rotation of selected items";
 	ot->idname = OP_TRACKBALL;
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
 
@@ -566,10 +566,10 @@ void TRANSFORM_OT_trackball(struct wmOperatorType *ot)
 	ot->invoke = transform_invoke;
 	ot->exec   = transform_exec;
 	ot->modal  = transform_modal;
-	ot->cancel  = transform_cancel;
+	ot->cancel = transform_cancel;
 	ot->poll   = ED_operator_screenactive;
 
-	RNA_def_float_vector(ot->srna, "value", 2, VecOne, -FLT_MAX, FLT_MAX, "angle", "", -FLT_MAX, FLT_MAX);
+	RNA_def_float_vector(ot->srna, "value", 2, VecOne, -FLT_MAX, FLT_MAX, "Angle", "", -FLT_MAX, FLT_MAX);
 
 	Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP);
 }
@@ -578,7 +578,7 @@ void TRANSFORM_OT_rotate(struct wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name   = "Rotate";
-	ot->description= "Rotate selected items";
+	ot->description = "Rotate selected items";
 	ot->idname = OP_ROTATION;
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
 
@@ -586,7 +586,7 @@ void TRANSFORM_OT_rotate(struct wmOperatorType *ot)
 	ot->invoke = transform_invoke;
 	ot->exec   = transform_exec;
 	ot->modal  = transform_modal;
-	ot->cancel  = transform_cancel;
+	ot->cancel = transform_cancel;
 	ot->poll   = ED_operator_screenactive;
 
 	RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2);
@@ -598,10 +598,10 @@ void TRANSFORM_OT_tilt(struct wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name   = "Tilt";
-	/*optionals - 
-		"Tilt selected vertices"
-		"Specify an extra axis rotation for selected vertices of 3d curve" */
-	ot->description= "Tilt selected control vertices of 3d curve"; 
+	/* optionals - 
+	 * "Tilt selected vertices"
+	 * "Specify an extra axis rotation for selected vertices of 3d curve" */
+	ot->description = "Tilt selected control vertices of 3d curve"; 
 	ot->idname = OP_TILT;
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
 
@@ -609,7 +609,7 @@ void TRANSFORM_OT_tilt(struct wmOperatorType *ot)
 	ot->invoke = transform_invoke;
 	ot->exec   = transform_exec;
 	ot->modal  = transform_modal;
-	ot->cancel  = transform_cancel;
+	ot->cancel = transform_cancel;
 	ot->poll   = ED_operator_editcurve_3d;
 
 	RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2);
@@ -621,7 +621,7 @@ void TRANSFORM_OT_warp(struct wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name   = "Warp";
-	ot->description= "Warp selected items around the cursor";
+	ot->description = "Warp selected items around the cursor";
 	ot->idname = OP_WARP;
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
 
@@ -629,7 +629,7 @@ void TRANSFORM_OT_warp(struct wmOperatorType *ot)
 	ot->invoke = transform_invoke;
 	ot->exec   = transform_exec;
 	ot->modal  = transform_modal;
-	ot->cancel  = transform_cancel;
+	ot->cancel = transform_cancel;
 	ot->poll   = ED_operator_screenactive;
 
 	RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2);
@@ -642,7 +642,7 @@ void TRANSFORM_OT_shear(struct wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name   = "Shear";
-	ot->description= "Shear selected items along the horizontal screen axis";
+	ot->description = "Shear selected items along the horizontal screen axis";
 	ot->idname = OP_SHEAR;
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
 
@@ -650,7 +650,7 @@ void TRANSFORM_OT_shear(struct wmOperatorType *ot)
 	ot->invoke = transform_invoke;
 	ot->exec   = transform_exec;
 	ot->modal  = transform_modal;
-	ot->cancel  = transform_cancel;
+	ot->cancel = transform_cancel;
 	ot->poll   = ED_operator_screenactive;
 
 	RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
@@ -663,7 +663,7 @@ void TRANSFORM_OT_push_pull(struct wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name   = "Push/Pull";
-	ot->description= "Push/Pull selected items";
+	ot->description = "Push/Pull selected items";
 	ot->idname = OP_PUSH_PULL;
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
 
@@ -671,7 +671,7 @@ void TRANSFORM_OT_push_pull(struct wmOperatorType *ot)
 	ot->invoke = transform_invoke;
 	ot->exec   = transform_exec;
 	ot->modal  = transform_modal;
-	ot->cancel  = transform_cancel;
+	ot->cancel = transform_cancel;
 	ot->poll   = ED_operator_screenactive;
 
 	RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Distance", "", -FLT_MAX, FLT_MAX);
@@ -683,7 +683,7 @@ void TRANSFORM_OT_shrink_fatten(struct wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name   = "Shrink/Fatten";
-	ot->description= "Shrink/fatten selected vertices along normals";
+	ot->description = "Shrink/fatten selected vertices along normals";
 	ot->idname = OP_SHRINK_FATTEN;
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
 
@@ -691,7 +691,7 @@ void TRANSFORM_OT_shrink_fatten(struct wmOperatorType *ot)
 	ot->invoke = transform_invoke;
 	ot->exec   = transform_exec;
 	ot->modal  = transform_modal;
-	ot->cancel  = transform_cancel;
+	ot->cancel = transform_cancel;
 	ot->poll   = ED_operator_editmesh;
 
 	RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
@@ -704,7 +704,7 @@ void TRANSFORM_OT_tosphere(struct wmOperatorType *ot)
 	/* identifiers */
 	ot->name   = "To Sphere";
 	//added "around mesh center" to differentiate between "MESH_OT_vertices_to_sphere()" 
-	ot->description= "Move selected vertices outward in a spherical shape around mesh center";
+	ot->description = "Move selected vertices outward in a spherical shape around mesh center";
 	ot->idname = OP_TOSPHERE;
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
 
@@ -712,7 +712,7 @@ void TRANSFORM_OT_tosphere(struct wmOperatorType *ot)
 	ot->invoke = transform_invoke;
 	ot->exec   = transform_exec;
 	ot->modal  = transform_modal;
-	ot->cancel  = transform_cancel;
+	ot->cancel = transform_cancel;
 	ot->poll   = ED_operator_screenactive;
 
 	RNA_def_float_factor(ot->srna, "value", 0, 0, 1, "Factor", "", 0, 1);
@@ -724,7 +724,7 @@ void TRANSFORM_OT_mirror(struct wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name   = "Mirror";
-	ot->description= "Mirror selected vertices around one or more axes";
+	ot->description = "Mirror selected vertices around one or more axes";
 	ot->idname = OP_MIRROR;
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
 
@@ -732,7 +732,7 @@ void TRANSFORM_OT_mirror(struct wmOperatorType *ot)
 	ot->invoke = transform_invoke;
 	ot->exec   = transform_exec;
 	ot->modal  = transform_modal;
-	ot->cancel  = transform_cancel;
+	ot->cancel = transform_cancel;
 	ot->poll   = ED_operator_screenactive;
 
 	Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL);
@@ -742,7 +742,7 @@ void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name   = "Edge Slide";
-	ot->description= "Slide an edge loop along a mesh"; 
+	ot->description = "Slide an edge loop along a mesh"; 
 	ot->idname = OP_EDGE_SLIDE;
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
 
@@ -750,7 +750,7 @@ void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot)
 	ot->invoke = transform_invoke;
 	ot->exec   = transform_exec;
 	ot->modal  = transform_modal;
-	ot->cancel  = transform_cancel;
+	ot->cancel = transform_cancel;
 	ot->poll   = ED_operator_editmesh;
 
 	RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f);
@@ -762,7 +762,7 @@ void TRANSFORM_OT_edge_crease(struct wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name   = "Edge Crease";
-	ot->description= "Change the crease of edges";
+	ot->description = "Change the crease of edges";
 	ot->idname = OP_EDGE_CREASE;
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
 
@@ -770,7 +770,7 @@ void TRANSFORM_OT_edge_crease(struct wmOperatorType *ot)
 	ot->invoke = transform_invoke;
 	ot->exec   = transform_exec;
 	ot->modal  = transform_modal;
-	ot->cancel  = transform_cancel;
+	ot->cancel = transform_cancel;
 	ot->poll   = ED_operator_editmesh;
 
 	RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f);
@@ -782,7 +782,7 @@ void TRANSFORM_OT_seq_slide(struct wmOperatorType *ot)
 {
 	/* identifiers */
 	ot->name   = "Sequence Slide";
-	ot->description= "Slide a sequence strip in time";
+	ot->description = "Slide a sequence strip in time";
 	ot->idname = OP_SEQ_SLIDE;
 	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
 
@@ -790,7 +790,7 @@ void TRANSFORM_OT_seq_slide(struct wmOperatorType *ot)
 	ot->invoke = transform_invoke;
 	ot->exec   = transform_exec;
 	ot->modal  = transform_modal;
-	ot->cancel  = transform_cancel;
+	ot->cancel = transform_cancel;
 	ot->poll   = ED_operator_sequencer_active;
 
 	RNA_def_float_vector(ot->srna, "value", 2, VecOne, -FLT_MAX, FLT_MAX, "Angle", "", -FLT_MAX, FLT_MAX);
@@ -804,15 +804,15 @@ void TRANSFORM_OT_transform(struct wmOperatorType *ot)
 
 	/* identifiers */
 	ot->name   = "Transform";
-	ot->description= "Transform selected items by mode type";
+	ot->description = "Transform selected items by mode type";
 	ot->idname = "TRANSFORM_OT_transform";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
 
 	/* api callbacks */
 	ot->invoke = transform_invoke;
 	ot->exec   = transform_exec;
 	ot->modal  = transform_modal;
-	ot->cancel  = transform_cancel;
+	ot->cancel = transform_cancel;
 	ot->poll   = ED_operator_screenactive;
 
 	prop= RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
@@ -897,19 +897,19 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
 
 			break;
 		case SPACE_ACTION:
-			kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", GKEY, KM_PRESS, 0, 0);
+			kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", GKEY, KM_PRESS, 0, 0);
 			RNA_enum_set(kmi->ptr, "mode", TFM_TIME_TRANSLATE);
 			
-			kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0);
+			kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0);
 			RNA_enum_set(kmi->ptr, "mode", TFM_TIME_TRANSLATE);
 			
-			kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
+			kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
 			RNA_enum_set(kmi->ptr, "mode", TFM_TIME_EXTEND);
 			
-			kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, 0, 0);
+			kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, 0, 0);
 			RNA_enum_set(kmi->ptr, "mode", TFM_TIME_SCALE);
 			
-			kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", TKEY, KM_PRESS, KM_SHIFT, 0);
+			kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", TKEY, KM_PRESS, KM_SHIFT, 0);
 			RNA_enum_set(kmi->ptr, "mode", TFM_TIME_SLIDE);
 			break;
 		case SPACE_IPO:
@@ -917,7 +917,7 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
 			
 			WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_S, KM_ANY, 0, 0);
 			
-			kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
+			kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
 			RNA_enum_set(kmi->ptr, "mode", TFM_TIME_EXTEND);
 			
 			WM_keymap_add_item(keymap, OP_ROTATION, RKEY, KM_PRESS, 0, 0);
@@ -925,36 +925,43 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
 			WM_keymap_add_item(keymap, OP_RESIZE, SKEY, KM_PRESS, 0, 0);
 			break;
 		case SPACE_NLA:
-			kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", GKEY, KM_PRESS, 0, 0);
+			kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", GKEY, KM_PRESS, 0, 0);
 			RNA_enum_set(kmi->ptr, "mode", TFM_TRANSLATION);
 			
-			kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0);
+			kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0);
 			RNA_enum_set(kmi->ptr, "mode", TFM_TRANSLATION);
 			
-			kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
+			kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
 			RNA_enum_set(kmi->ptr, "mode", TFM_TIME_EXTEND);
 			
-			kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, 0, 0);
+			kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, 0, 0);
 			RNA_enum_set(kmi->ptr, "mode", TFM_TIME_SCALE);
 			break;
 		case SPACE_NODE:
 			WM_keymap_add_item(keymap, OP_TRANSLATION, GKEY, KM_PRESS, 0, 0);
 
-			kmi= WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_A, KM_ANY, 0, 0);
+			kmi = WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_A, KM_ANY, 0, 0);
 			RNA_boolean_set(kmi->ptr, "release_confirm", TRUE);
-			kmi= WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_S, KM_ANY, 0, 0);
+			kmi = WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_S, KM_ANY, 0, 0);
 			RNA_boolean_set(kmi->ptr, "release_confirm", TRUE);
 
 			WM_keymap_add_item(keymap, OP_ROTATION, RKEY, KM_PRESS, 0, 0);
 
 			WM_keymap_add_item(keymap, OP_RESIZE, SKEY, KM_PRESS, 0, 0);
+
+			/* detach and translate */
+			WM_keymap_add_item(keymap, "NODE_OT_move_detach_links", DKEY, KM_PRESS, KM_ALT, 0);
+
+			/* XXX release_confirm is set in the macro operator definition */
+			WM_keymap_add_item(keymap, "NODE_OT_move_detach_links", EVT_TWEAK_A, KM_ANY, KM_ALT, 0);
+			WM_keymap_add_item(keymap, "NODE_OT_move_detach_links", EVT_TWEAK_S, KM_ANY, KM_ALT, 0);
 			break;
 		case SPACE_SEQ:
 			WM_keymap_add_item(keymap, OP_SEQ_SLIDE, GKEY, KM_PRESS, 0, 0);
 
 			WM_keymap_add_item(keymap, OP_SEQ_SLIDE, EVT_TWEAK_S, KM_ANY, 0, 0);
 
-			kmi= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
+			kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
 			RNA_enum_set(kmi->ptr, "mode", TFM_TIME_EXTEND);
 			break;
 		case SPACE_IMAGE:
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 0e77c23..0f92900 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -32,22 +32,22 @@
 
 #include "DNA_armature_types.h"
 #include "DNA_curve_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
 #include "DNA_view3d_types.h"
 
+#include "BLI_math.h"
+#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
 
 #include "BKE_armature.h"
 #include "BKE_curve.h"
 #include "BKE_context.h"
+#include "BKE_tessmesh.h"
 #include "BKE_report.h"
 
-#include "BLI_math.h"
-#include "BLI_blenlib.h"
-#include "BLI_editVert.h"
-#include "BLI_utildefines.h"
-
 #include "BLF_translation.h"
 
 //#include "BIF_editmesh.h"
@@ -74,7 +74,7 @@ void BIF_clearTransformOrientation(bContext *C)
 	BLI_freelistN(transform_spaces);
 	
 	// Need to loop over all view3d
-	if(v3d && v3d->twmode >= V3D_MANIP_CUSTOM) {
+	if (v3d && v3d->twmode >= V3D_MANIP_CUSTOM) {
 		v3d->twmode = V3D_MANIP_GLOBAL;	/* fallback to global	*/
 	}
 }
@@ -121,8 +121,7 @@ void BIF_createTransformOrientation(bContext *C, ReportList *reports, char *name
 		ts = createObjectSpace(C, reports, name, overwrite);
 	}
 	
-	if (use && ts != NULL)
-	{
+	if (use && ts != NULL) {
 		BIF_selectTransformOrientation(C, ts);
 	}
 }
@@ -143,8 +142,7 @@ TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(reports)
 	normalize_m3(mat);
 
 	/* use object name if no name is given */
-	if (name[0] == 0)
-	{
+	if (name[0] == 0) {
 		strncpy(name, ob->id.name+2, MAX_ID_NAME-2);
 	}
 
@@ -163,8 +161,7 @@ TransformOrientation *createBoneSpace(bContext *C, ReportList *reports, char *na
 		return NULL;
 	}
 
-	if (name[0] == 0)
-	{
+	if (name[0] == 0) {
 		strcpy(name, "Bone");
 	}
 
@@ -187,8 +184,7 @@ TransformOrientation *createMeshSpace(bContext *C, ReportList *reports, char *na
 				return NULL;
 			}
 	
-			if (name[0] == 0)
-			{
+			if (name[0] == 0) {
 				strcpy(name, "Vertex");
 			}
 			break;
@@ -198,8 +194,7 @@ TransformOrientation *createMeshSpace(bContext *C, ReportList *reports, char *na
 				return NULL;
 			}
 	
-			if (name[0] == 0)
-			{
+			if (name[0] == 0) {
 				strcpy(name, "Edge");
 			}
 			break;
@@ -209,8 +204,7 @@ TransformOrientation *createMeshSpace(bContext *C, ReportList *reports, char *na
 				return NULL;
 			}
 	
-			if (name[0] == 0)
-			{
+			if (name[0] == 0) {
 				strcpy(name, "Face");
 			}
 			break;
@@ -253,8 +247,7 @@ int createSpaceNormalTangent(float mat[3][3], float normal[3], float tangent[3])
 	}
 	
 	/* preempt zero length tangent from causing trouble */
-	if (tangent[0] == 0 && tangent[1] == 0 && tangent[2] == 0)
-	{
+	if (tangent[0] == 0 && tangent[1] == 0 && tangent[2] == 0) {
 		tangent[2] = 1;
 	}
 
@@ -275,18 +268,15 @@ TransformOrientation* addMatrixSpace(bContext *C, float mat[3][3], char name[],
 	ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces;
 	TransformOrientation *ts = NULL;
 
-	if (overwrite)
-	{
+	if (overwrite) {
 		ts = findOrientationName(transform_spaces, name);
 	}
-	else
-	{
+	else {
 		uniqueOrientationName(transform_spaces, name);
 	}
 
 	/* if not, create a new one */
-	if (ts == NULL)
-	{
+	if (ts == NULL) {
 		ts = MEM_callocN(sizeof(TransformOrientation), "UserTransSpace from matrix");
 		BLI_addtail(transform_spaces, ts);
 		strncpy(ts->name, name, sizeof(ts->name));
@@ -307,7 +297,7 @@ void BIF_removeTransformOrientation(bContext *C, TransformOrientation *target)
 	for (i = 0, ts = transform_spaces->first; ts; ts = ts->next, i++) {
 		if (ts == target) {
 			View3D *v3d = CTX_wm_view3d(C);
-			if(v3d) {
+			if (v3d) {
 				int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM);
 				
 				// Transform_fix_me NEED TO DO THIS FOR ALL VIEW3D
@@ -333,7 +323,7 @@ void BIF_removeTransformOrientationIndex(bContext *C, int index)
 
 	if (ts) {
 		View3D *v3d = CTX_wm_view3d(C);
-		if(v3d) {
+		if (v3d) {
 			int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM);
 			
 			// Transform_fix_me NEED TO DO THIS FOR ALL VIEW3D
@@ -368,7 +358,7 @@ void BIF_selectTransformOrientation(bContext *C, TransformOrientation *target)
 void BIF_selectTransformOrientationValue(bContext *C, int orientation)
 {
 	View3D *v3d = CTX_wm_view3d(C);
-	if(v3d) /* currently using generic poll */
+	if (v3d) /* currently using generic poll */
 		v3d->twmode = orientation;
 }
 
@@ -391,19 +381,19 @@ EnumPropertyItem *BIF_enumTransformOrientation(bContext *C)
 	RNA_enum_item_add(&item, &totitem, &local);
 	RNA_enum_item_add(&item, &totitem, &view);
 
-	if(C) {
+	if (C) {
 		scene= CTX_data_scene(C);
 
-		if(scene) {
+		if (scene) {
 			transform_spaces = &scene->transform_spaces;
 			ts = transform_spaces->first;
 		}
 	}
 		
-	if(ts)
+	if (ts)
 		RNA_enum_item_add_separator(&item, &totitem);
 
-	for(; ts; ts = ts->next) {
+	for (; ts; ts = ts->next) {
 		tmp.identifier = "CUSTOM";
 		tmp.name= ts->name;
 		tmp.value = i++;
@@ -479,11 +469,11 @@ static int count_bone_select(bArmature *arm, ListBase *lb, int do_it)
 	int do_next;
 	int total = 0;
 	
-	for(bone= lb->first; bone; bone= bone->next) {
+	for (bone= lb->first; bone; bone= bone->next) {
 		bone->flag &= ~BONE_TRANSFORM;
 		do_next = do_it;
-		if(do_it) {
-			if(bone->layer & arm->layer) {
+		if (do_it) {
+			if (bone->layer & arm->layer) {
 				if (bone->flag & BONE_SELECTED) {
 					bone->flag |= BONE_TRANSFORM;
 					total++;
@@ -517,7 +507,7 @@ void initTransformOrientation(bContext *C, TransInfo *t)
 		}
 		/* no gimbal fallthrough to normal */
 	case V3D_MANIP_NORMAL:
-		if(obedit || (ob && ob->mode & OB_MODE_POSE)) {
+		if (obedit || (ob && ob->mode & OB_MODE_POSE)) {
 			strcpy(t->spacename, "normal");
 			ED_getTransformOrientationMatrix(C, t->spacemtx, (v3d->around == V3D_ACTIVE));
 			break;
@@ -526,18 +516,18 @@ void initTransformOrientation(bContext *C, TransInfo *t)
 	case V3D_MANIP_LOCAL:
 		strcpy(t->spacename, "local");
 		
-		if(ob) {
+		if (ob) {
 			copy_m3_m4(t->spacemtx, ob->obmat);
 			normalize_m3(t->spacemtx);
-		} else {
+		}
+		else {
 			unit_m3(t->spacemtx);
 		}
 		
 		break;
 		
 	case V3D_MANIP_VIEW:
-		if (t->ar->regiontype == RGN_TYPE_WINDOW)
-		{
+		if (t->ar->regiontype == RGN_TYPE_WINDOW) {
 			RegionView3D *rv3d = t->ar->regiondata;
 			float mat[3][3];
 
@@ -546,8 +536,7 @@ void initTransformOrientation(bContext *C, TransInfo *t)
 			normalize_m3(mat);
 			copy_m3_m3(t->spacemtx, mat);
 		}
-		else
-		{
+		else {
 			unit_m3(t->spacemtx);
 		}
 		break;
@@ -569,8 +558,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
 	normal[0] = normal[1] = normal[2] = 0;
 	plane[0] = plane[1] = plane[2] = 0;
 
-	if(obedit)
-	{
+	if (obedit) {
 		float imat[3][3], mat[3][3];
 		
 		/* we need the transpose of the inverse for a normal... */
@@ -581,59 +569,55 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
 
 		ob= obedit;
 
-		if(ob->type==OB_MESH)
-		{
+		if (ob->type==OB_MESH) {
 			Mesh *me= ob->data;
-			EditMesh *em = me->edit_mesh;
-			EditVert *eve;
-			EditSelection ese;
+			BMEditMesh *em = me->edit_btmesh;
+			BMVert *eve;
+			BMEditSelection ese;
 			float vec[3]= {0,0,0};
 			
 			/* USE LAST SELECTED WITH ACTIVE */
-			if (activeOnly && EM_get_actSelection(em, &ese))
-			{
-				EM_editselection_normal(normal, &ese);
-				EM_editselection_plane(plane, &ese);
+			if (activeOnly && BM_select_history_active_get(em->bm, &ese)) {
+				BM_editselection_normal(&ese, normal);
+				BM_editselection_plane(&ese, plane);
 				
-				switch (ese.type)
+				switch (ese.htype)
 				{
-					case EDITVERT:
+					case BM_VERT:
 						result = ORIENTATION_VERT;
 						break;
-					case EDITEDGE:
+					case BM_EDGE:
 						result = ORIENTATION_EDGE;
 						break;
-					case EDITFACE:
+					case BM_FACE:
 						result = ORIENTATION_FACE;
 						break;
 				}
 			}
-			else
-			{
-				if (em->totfacesel >= 1)
-				{
-					EditFace *efa;
-					
-					for(efa= em->faces.first; efa; efa= efa->next)
-					{
-						if(efa->f & SELECT)
-						{
-							add_v3_v3(normal, efa->n);
-							sub_v3_v3v3(vec, efa->v2->co, efa->v1->co);
+			else {
+				if (em->bm->totfacesel >= 1) {
+					BMFace *efa;
+					BMIter iter;
+
+					BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+						if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
+							add_v3_v3(normal, efa->no);
+							sub_v3_v3v3(vec,
+							            BM_FACE_FIRST_LOOP(efa)->v->co,
+							            BM_FACE_FIRST_LOOP(efa)->next->v->co);
 							add_v3_v3(plane, vec);
 						}
 					}
 					
 					result = ORIENTATION_FACE;
 				}
-				else if (em->totvertsel == 3)
-				{
-					EditVert *v1 = NULL, *v2 = NULL, *v3 = NULL;
+				else if (em->bm->totvertsel == 3) {
+					BMVert *v1 = NULL, *v2 = NULL, *v3 = NULL;
+					BMIter iter;
 					float cotangent[3];
 					
-					for (eve = em->verts.first; eve; eve = eve->next)
-					{
-						if ( eve->f & SELECT ) {
+					BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+						if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
 							if (v1 == NULL) {
 								v1 = eve; 
 							}
@@ -652,12 +636,12 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
 					}
 
 					/* if there's an edge available, use that for the tangent */
-					if (em->totedgesel >= 1)
-					{
-						EditEdge *eed = NULL;
-	
-						for(eed= em->edges.first; eed; eed= eed->next) {
-							if(eed->f & SELECT) {
+					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)) {
 								sub_v3_v3v3(plane, eed->v2->co, eed->v1->co);
 								break;
 							}
@@ -666,12 +650,12 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
 
 					result = ORIENTATION_FACE;
 				}
-				else if (em->totedgesel == 1)
-				{
-					EditEdge *eed;
-
-					for(eed= em->edges.first; eed; eed= eed->next) {
-						if(eed->f & SELECT) {
+				else 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)) {
 							/* use average vert normals as plane and edge vector as normal */
 							copy_v3_v3(plane, eed->v1->no);
 							add_v3_v3(plane, eed->v2->no);
@@ -681,13 +665,12 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
 					}
 					result = ORIENTATION_EDGE;
 				}
-				else if (em->totvertsel == 2)
-				{
-					EditVert *v1 = NULL, *v2 = NULL;
-		
-					for (eve = em->verts.first; eve; eve = eve->next)
-					{
-						if ( eve->f & SELECT ) {
+				else if (em->bm->totvertsel == 2) {
+					BMVert *v1 = NULL, *v2 = NULL;
+					BMIter iter;
+
+					BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+						if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
 							if (v1 == NULL) {
 								v1 = eve; 
 							}
@@ -703,24 +686,24 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
 					}
 					result = ORIENTATION_EDGE;
 				}
-				else if (em->totvertsel == 1)
-				{
-					for (eve = em->verts.first; eve; eve = eve->next)
-					{
-						if ( eve->f & SELECT ) {
+				else if (em->bm->totvertsel == 1) {
+					BMIter iter;
+
+					BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+						if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
 							copy_v3_v3(normal, eve->no);
 							break;
 						}
 					}
 					result = ORIENTATION_VERT;
 				}
-				else if (em->totvertsel > 3)
-				{
-					normal[0] = normal[1] = normal[2] = 0;
-					
-					for (eve = em->verts.first; eve; eve = eve->next)
-					{
-						if ( eve->f & SELECT ) {
+				else if (em->bm->totvertsel > 3) {
+					BMIter iter;
+
+					zero_v3(normal);
+
+					BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+						if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
 							add_v3_v3(normal, eve->no);
 						}
 					}
@@ -729,40 +712,32 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
 				}
 			}
 		} /* end editmesh */
-		else if ELEM(obedit->type, OB_CURVE, OB_SURF)
-		{
+		else if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
 			Curve *cu= obedit->data;
 			Nurb *nu;
 			BezTriple *bezt;
 			int a;
 			ListBase *nurbs= curve_editnurbs(cu);
 
-			for (nu = nurbs->first; nu; nu = nu->next)
-			{
+			for (nu = nurbs->first; nu; nu = nu->next) {
 				/* only bezier has a normal */
-				if(nu->type == CU_BEZIER)
-				{
+				if (nu->type == CU_BEZIER) {
 					bezt= nu->bezt;
 					a= nu->pntsu;
-					while(a--)
+					while (a--)
 					{
 						/* exception */
-						if ( (bezt->f1 & SELECT) + (bezt->f2 & SELECT) + (bezt->f3 & SELECT) > SELECT )
-						{
+						if ((bezt->f1 & SELECT) + (bezt->f2 & SELECT) + (bezt->f3 & SELECT) > SELECT) {
 							sub_v3_v3v3(normal, bezt->vec[0], bezt->vec[2]);
 						}
-						else
-						{
-							if(bezt->f1)
-							{
+						else {
+							if (bezt->f1) {
 								sub_v3_v3v3(normal, bezt->vec[0], bezt->vec[1]);
 							}
-							if(bezt->f2)
-							{
+							if (bezt->f2) {
 								sub_v3_v3v3(normal, bezt->vec[0], bezt->vec[2]);
 							}
-							if(bezt->f3)
-							{
+							if (bezt->f3) {
 								sub_v3_v3v3(normal, bezt->vec[1], bezt->vec[2]);
 							}
 						}
@@ -771,36 +746,29 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
 				}
 			}
 			
-			if (normal[0] != 0 || normal[1] != 0 || normal[2] != 0)
-			{
+			if (normal[0] != 0 || normal[1] != 0 || normal[2] != 0) {
 				result = ORIENTATION_NORMAL;
 			}
 		}
-		else if(obedit->type==OB_MBALL)
-		{
+		else if (obedit->type==OB_MBALL) {
 #if 0 // XXX
 			/* editmball.c */
-			extern ListBase editelems;  /* go away ! */
 			MetaElem *ml, *ml_sel = NULL;
 	
 			/* loop and check that only one element is selected */	
-			for (ml = editelems.first; ml; ml = ml->next)
-			{
+			for (ml = editelems.first; ml; ml = ml->next) {
 				if (ml->flag & SELECT) {
-					if (ml_sel == NULL)
-					{
+					if (ml_sel == NULL) {
 						ml_sel = ml;
 					}
-					else
-					{
+					else {
 						ml_sel = NULL;
 						break;
 					}
 				}
 			}
 			
-			if (ml_sel)
-			{	
+			if (ml_sel) {	
 				float mat[4][4];
 
 				/* Rotation of MetaElem is stored in quat */
@@ -815,16 +783,13 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
 #endif
 			
 		}
-		else if (obedit->type == OB_ARMATURE)
-		{
+		else if (obedit->type == OB_ARMATURE) {
 			bArmature *arm = obedit->data;
 			EditBone *ebone;
 			
 			for (ebone = arm->edbo->first; ebone; ebone=ebone->next) {
-				if (arm->layer & ebone->layer)
-				{
-					if (ebone->flag & BONE_SELECTED)
-					{
+				if (arm->layer & ebone->layer) {
+					if (ebone->flag & BONE_SELECTED) {
 						float tmat[3][3];
 						float vec[3];
 						sub_v3_v3v3(vec, ebone->tail, ebone->head);
@@ -840,37 +805,33 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
 			normalize_v3(normal);
 			normalize_v3(plane);
 
-			if (plane[0] != 0 || plane[1] != 0 || plane[2] != 0)
-			{
+			if (plane[0] != 0 || plane[1] != 0 || plane[2] != 0) {
 				result = ORIENTATION_EDGE;
 			}
 
 		}
 
 		/* Vectors from edges don't need the special transpose inverse multiplication */
-		if (result == ORIENTATION_EDGE)
-		{
+		if (result == ORIENTATION_EDGE) {
 			mul_mat3_m4_v3(ob->obmat, normal);
 			mul_mat3_m4_v3(ob->obmat, plane);
 		}
-		else
-		{
+		else {
 			mul_m3_v3(mat, normal);
 			mul_m3_v3(mat, plane);
 		}
 	}
-	else if(ob && (ob->mode & OB_MODE_POSE))
-	{
+	else if (ob && (ob->mode & OB_MODE_POSE)) {
 		bArmature *arm= ob->data;
 		bPoseChannel *pchan;
 		int totsel;
 		
 		totsel = count_bone_select(arm, &arm->bonebase, 1);
-		if(totsel) {
+		if (totsel) {
 			float imat[3][3], mat[3][3];
 
 			/* use channels to get stats */
-			for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+			for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
 				if (pchan->bone && pchan->bone->flag & BONE_TRANSFORM) {
 					add_v3_v3(normal, pchan->pose_mat[2]);
 					add_v3_v3(plane, pchan->pose_mat[1]);
@@ -889,17 +850,17 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
 			result = ORIENTATION_EDGE;
 		}
 	}
-	else if(ob && (ob->mode & (OB_MODE_ALL_PAINT|OB_MODE_PARTICLE_EDIT)))
-	{
+	else if (ob && (ob->mode & (OB_MODE_ALL_PAINT|OB_MODE_PARTICLE_EDIT))) {
+		/* pass */
 	}
 	else {
 		/* we need the one selected object, if its not active */
 		ob = OBACT;
-		if(ob && !(ob->flag & SELECT)) ob = NULL;
+		if (ob && !(ob->flag & SELECT)) ob = NULL;
 		
-		for(base= scene->base.first; base; base= base->next) {
-			if TESTBASELIB(v3d, base) {
-				if(ob == NULL) { 
+		for (base= scene->base.first; base; base= base->next) {
+			if (TESTBASELIB(v3d, base)) {
+				if (ob == NULL) {
 					ob= base->object;
 					break;
 				}
@@ -928,33 +889,28 @@ void ED_getTransformOrientationMatrix(const bContext *C, float orientation_mat[]
 	switch (type)
 	{
 		case ORIENTATION_NORMAL:
-			if (createSpaceNormalTangent(orientation_mat, normal, plane) == 0)
-			{
+			if (createSpaceNormalTangent(orientation_mat, normal, plane) == 0) {
 				type = ORIENTATION_NONE;
 			}
 			break;
 		case ORIENTATION_VERT:
-			if (createSpaceNormal(orientation_mat, normal) == 0)
-			{
+			if (createSpaceNormal(orientation_mat, normal) == 0) {
 				type = ORIENTATION_NONE;
 			}
 			break;
 		case ORIENTATION_EDGE:
-			if (createSpaceNormalTangent(orientation_mat, normal, plane) == 0)
-			{
+			if (createSpaceNormalTangent(orientation_mat, normal, plane) == 0) {
 				type = ORIENTATION_NONE;
 			}
 			break;
 		case ORIENTATION_FACE:
-			if (createSpaceNormalTangent(orientation_mat, normal, plane) == 0)
-			{
+			if (createSpaceNormalTangent(orientation_mat, normal, plane) == 0) {
 				type = ORIENTATION_NONE;
 			}
 			break;
 	}
 
-	if (type == ORIENTATION_NONE)
-	{
+	if (type == ORIENTATION_NONE) {
 		unit_m3(orientation_mat);
 	}
 }
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index d079bd4..7bdd3dd 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -40,6 +40,7 @@
 #include "DNA_armature_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_object_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h" // Temporary, for snapping to other unselected meshes
 #include "DNA_space_types.h"
 #include "DNA_screen_types.h"
@@ -49,7 +50,6 @@
 #include "RNA_access.h"
 
 #include "BLI_math.h"
-#include "BLI_editVert.h"
 #include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
 
@@ -68,6 +68,8 @@
 #include "BKE_object.h"
 #include "BKE_anim.h" /* for duplis */
 #include "BKE_context.h"
+#include "BKE_tessmesh.h"
+#include "BKE_mesh.h"
 
 #include "ED_armature.h"
 #include "ED_image.h"
@@ -167,7 +169,8 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
 			for (p = t->tsnap.points.first; p; p = p->next) {
 				if (p == t->tsnap.selectedPoint) {
 					glColor4ubv(selectedCol);
-				} else {
+				}
+				else {
 					glColor4ubv(col);
 				}
 
@@ -193,14 +196,12 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
 				glEnd();
 			}
 			
-			if(v3d->zbuf)
+			if (v3d->zbuf)
 				glEnable(GL_DEPTH_TEST);
 		}
-		else if (t->spacetype==SPACE_IMAGE)
-		{
-			/*This will not draw, and Im nor sure why - campbell */
-			
-			/*			
+		else if (t->spacetype==SPACE_IMAGE) {
+			/* This will not draw, and Im nor sure why - campbell */
+#if 0
 			float xuser_asp, yuser_asp;
 			int wi, hi;
 			float w, h;
@@ -228,7 +229,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
 			
 			glTranslatef(-t->tsnap.snapPoint[0], -t->tsnap.snapPoint[1], 0.0f);
 			setlinestyle(0);
-			*/
+#endif
 			
 		}
 	}
@@ -265,12 +266,12 @@ void applyProject(TransInfo *t)
 		float imat[4][4];
 		int i;
 	
-		if(t->flag & (T_EDIT|T_POSE)) {
+		if (t->flag & (T_EDIT|T_POSE)) {
 			Object *ob = t->obedit?t->obedit:t->poseobj;
 			invert_m4_m4(imat, ob->obmat);
 		}
 
-		for(i = 0 ; i < t->total; i++, td++) {
+		for (i = 0 ; i < t->total; i++, td++) {
 			float iloc[3], loc[3], no[3];
 			float mval[2];
 			int dist = 1000;
@@ -287,8 +288,7 @@ void applyProject(TransInfo *t)
 				Object *ob = t->obedit?t->obedit:t->poseobj;
 				mul_m4_v3(ob->obmat, iloc);
 			}
-			else if (t->flag & T_OBJECT)
-			{
+			else if (t->flag & T_OBJECT) {
 				td->ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
 				object_handle_update(t->scene, td->ob);
 				copy_v3_v3(iloc, td->ob->obmat[3]);
@@ -298,7 +298,7 @@ void applyProject(TransInfo *t)
 			
 			if (snapObjectsTransform(t, mval, &dist, loc, no, t->tsnap.modeSelect))
 			{
-//				if(t->flag & (T_EDIT|T_POSE)) {
+//				if (t->flag & (T_EDIT|T_POSE)) {
 //					mul_m4_v3(imat, loc);
 //				}
 //				
@@ -326,8 +326,7 @@ void applySnapping(TransInfo *t, float *vec)
 	
 		t->tsnap.applySnap(t, vec);
 	}
-	else if ((t->tsnap.mode != SCE_SNAP_MODE_INCREMENT) && activeSnap(t))
-	{
+	else if ((t->tsnap.mode != SCE_SNAP_MODE_INCREMENT) && activeSnap(t)) {
 		double current = PIL_check_seconds_timer();
 		
 		// Time base quirky code to go around findnearest slowness
@@ -387,8 +386,7 @@ static void initSnappingMode(TransInfo *t)
 	Scene *scene = t->scene;
 
 	/* force project off when not supported */
-	if (ts->snap_mode != SCE_SNAP_MODE_FACE)
-	{
+	if (ts->snap_mode != SCE_SNAP_MODE_FACE) {
 		t->tsnap.project = 0;
 	}
 
@@ -403,12 +401,10 @@ static void initSnappingMode(TransInfo *t)
 			(obedit != NULL && ELEM4(obedit->type, OB_MESH, OB_ARMATURE, OB_CURVE, OB_LATTICE)) ) // Temporary limited to edit mode meshes, armature, curves
 		{
 			/* Exclude editmesh if using proportional edit */
-			if ((obedit->type == OB_MESH) && (t->flag & T_PROP_EDIT))
-			{
+			if ((obedit->type == OB_MESH) && (t->flag & T_PROP_EDIT)) {
 				t->tsnap.modeSelect = SNAP_NOT_OBEDIT;
 			}
-			else
-			{
+			else {
 				t->tsnap.modeSelect = t->tsnap.snap_self ? SNAP_ALL : SNAP_NOT_OBEDIT;
 			}
 		}
@@ -424,14 +420,12 @@ static void initSnappingMode(TransInfo *t)
 		{
 			t->tsnap.modeSelect = SNAP_NOT_SELECTED;
 		}
-		else
-		{
+		else {
 			/* Grid if snap is not possible */
 			t->tsnap.mode = SCE_SNAP_MODE_INCREMENT;
 		}
 	}
-	else
-	{
+	else {
 		/* Always grid outside of 3D view */
 		t->tsnap.mode = SCE_SNAP_MODE_INCREMENT;
 	}
@@ -482,10 +476,8 @@ void initSnapping(TransInfo *t, wmOperator *op)
 		}
 	}
 	/* use scene defaults only when transform is modal */
-	else if (t->flag & T_MODAL)
-	{
-		if(ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE))
-		{
+	else if (t->flag & T_MODAL) {
+		if (ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE)) {
 			if (ts->snap_flag & SCE_SNAP) {
 				t->modifiers |= MOD_SNAP;
 			}
@@ -578,7 +570,7 @@ int updateSelectedSnapPoint(TransInfo *t)
 		int closest_dist = 0;
 		int screen_loc[2];
 
-		for( p = t->tsnap.points.first; p; p = p->next ) {
+		for ( p = t->tsnap.points.first; p; p = p->next ) {
 			int dx, dy;
 			int dist;
 
@@ -640,7 +632,8 @@ void getSnapPoint(TransInfo *t, float vec[3])
 		}
 
 		mul_v3_fl(vec, 1.0f / total);
-	} else {
+	}
+	else {
 		copy_v3_v3(vec, t->tsnap.snapPoint);
 	}
 }
@@ -654,15 +647,15 @@ static void ApplySnapTranslation(TransInfo *t, float vec[3])
 	sub_v3_v3v3(vec, point, t->tsnap.snapTarget);
 }
 
-static void ApplySnapRotation(TransInfo *t, float *vec)
+static void ApplySnapRotation(TransInfo *t, float *value)
 {
 	if (t->tsnap.target == SCE_SNAP_TARGET_CLOSEST) {
-		*vec = t->tsnap.dist;
+		*value = t->tsnap.dist;
 	}
 	else {
 		float point[3];
 		getSnapPoint(t, point);
-		*vec = RotationBetween(t, t->tsnap.snapTarget, point);
+		*value = RotationBetween(t, t->tsnap.snapTarget, point);
 	}
 }
 
@@ -690,7 +683,7 @@ 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);	
-	if(t->flag & (T_EDIT|T_POSE)) {
+	if (t->flag & (T_EDIT|T_POSE)) {
 		Object *ob= t->obedit?t->obedit:t->poseobj;
 		mul_m4_v3(ob->obmat, center);
 	}
@@ -746,7 +739,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);	
-	if(t->flag & (T_EDIT|T_POSE)) {
+	if (t->flag & (T_EDIT|T_POSE)) {
 		Object *ob= t->obedit?t->obedit:t->poseobj;
 		mul_m4_v3(ob->obmat, center);
 	}
@@ -794,7 +787,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
 			
 			depth_peels.first = depth_peels.last = NULL;
 			
-			peelObjectsTransForm(t, &depth_peels, mval);
+			peelObjectsTransForm(t, &depth_peels, mval, t->tsnap.modeSelect);
 			
 //			if (LAST_SNAP_POINT_VALID)
 //			{
@@ -830,23 +823,20 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
 						}
 					}
 					/* otherwise, pair first with second and so on */
-					else
-					{
+					else {
 						for (p2 = p1->next; p2 && p2->ob != p1->ob; p2 = p2->next)
 						{
 							/* nothing to do here */
 						}
 					}
 					
-					if (p2)
-					{
+					if (p2) {
 						p2->flag = 1;
 						
 						add_v3_v3v3(vec, p1->p, p2->p);
 						mul_v3_fl(vec, 0.5f);
 					}
-					else
-					{
+					else {
 						copy_v3_v3(vec, p1->p);
 					}
 					
@@ -859,8 +849,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
 					
 					new_dist = len_v3v3(last_p, vec);
 					
-					if (new_dist < max_dist)
-					{
+					if (new_dist < max_dist) {
 						copy_v3_v3(p, vec);
 						max_dist = new_dist;
 					}
@@ -879,13 +868,11 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
 			
 			BLI_freelistN(&depth_peels);
 		}
-		else
-		{
+		else {
 			found = snapObjectsTransform(t, mval, &dist, loc, no, t->tsnap.modeSelect);
 		}
 		
-		if (found == 1)
-		{
+		if (found == 1) {
 			float tangent[3];
 			
 			sub_v3_v3v3(tangent, loc, t->tsnap.snapPoint);
@@ -901,20 +888,18 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
 
 			t->tsnap.status |=  POINT_INIT;
 		}
-		else
-		{
+		else {
 			t->tsnap.status &= ~POINT_INIT;
 		}
 	}
-	else if (t->spacetype == SPACE_IMAGE && t->obedit != NULL && t->obedit->type==OB_MESH)
-	{	/* same as above but for UV's */
+	else if (t->spacetype == SPACE_IMAGE && t->obedit != NULL && t->obedit->type==OB_MESH) {
 		/* same as above but for UV's */
 		Image *ima= ED_space_image(t->sa->spacedata.first);
 		float aspx, aspy, co[2];
 		
 		UI_view2d_region_to_view(&t->ar->v2d, t->mval[0], t->mval[1], co, co+1);
 
-		if(ED_uvedit_nearest_uv(t->scene, t->obedit, ima, co, t->tsnap.snapPoint))
+		if (ED_uvedit_nearest_uv(t->scene, t->obedit, ima, co, t->tsnap.snapPoint))
 		{
 			ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
 			t->tsnap.snapPoint[0] *= aspx;
@@ -922,8 +907,7 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
 
 			t->tsnap.status |=  POINT_INIT;
 		}
-		else
-		{
+		else {
 			t->tsnap.status &= ~POINT_INIT;
 		}
 	}
@@ -937,7 +921,7 @@ static void TargetSnapCenter(TransInfo *t)
 	if ((t->tsnap.status & TARGET_INIT) == 0)
 	{
 		copy_v3_v3(t->tsnap.snapTarget, t->center);	
-		if(t->flag & (T_EDIT|T_POSE)) {
+		if (t->flag & (T_EDIT|T_POSE)) {
 			Object *ob= t->obedit?t->obedit:t->poseobj;
 			mul_m4_v3(ob->obmat, t->tsnap.snapTarget);
 		}
@@ -955,7 +939,7 @@ static void TargetSnapActive(TransInfo *t)
 		TransData *active_td = NULL;
 		int i;
 
-		for(td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++)
+		for (td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++)
 		{
 			if (td->flag & TD_ACTIVE)
 			{
@@ -968,7 +952,7 @@ static void TargetSnapActive(TransInfo *t)
 		{	
 			copy_v3_v3(t->tsnap.snapTarget, active_td->center);
 				
-			if(t->flag & (T_EDIT|T_POSE)) {
+			if (t->flag & (T_EDIT|T_POSE)) {
 				Object *ob= t->obedit?t->obedit:t->poseobj;
 				mul_m4_v3(ob->obmat, t->tsnap.snapTarget);
 			}
@@ -976,8 +960,7 @@ static void TargetSnapActive(TransInfo *t)
 			t->tsnap.status |= TARGET_INIT;
 		}
 		/* No active, default to median */
-		else
-		{
+		else {
 			t->tsnap.target = SCE_SNAP_TARGET_MEDIAN;
 			t->tsnap.targetSnap = TargetSnapMedian;
 			TargetSnapMedian(t);
@@ -997,14 +980,14 @@ static void TargetSnapMedian(TransInfo *t)
 		t->tsnap.snapTarget[1] = 0;
 		t->tsnap.snapTarget[2] = 0;
 		
-		for(td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++)
+		for (td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++)
 		{
 			add_v3_v3(t->tsnap.snapTarget, td->center);
 		}
 		
 		mul_v3_fl(t->tsnap.snapTarget, 1.0 / i);
 		
-		if(t->flag & (T_EDIT|T_POSE)) {
+		if (t->flag & (T_EDIT|T_POSE)) {
 			Object *ob= t->obedit?t->obedit:t->poseobj;
 			mul_m4_v3(ob->obmat, t->tsnap.snapTarget);
 		}
@@ -1024,7 +1007,7 @@ static void TargetSnapClosest(TransInfo *t)
 		if (t->flag & T_OBJECT)
 		{
 			int i;
-			for(td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++)
+			for (td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++)
 			{
 				struct BoundBox *bb = object_get_boundbox(td->ob);
 				
@@ -1042,8 +1025,7 @@ static void TargetSnapClosest(TransInfo *t)
 						
 						dist = t->tsnap.distance(t, loc, t->tsnap.snapPoint);
 						
-						if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist))
-						{
+						if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist)) {
 							copy_v3_v3(t->tsnap.snapTarget, loc);
 							closest = td;
 							t->tsnap.dist = dist; 
@@ -1051,8 +1033,7 @@ static void TargetSnapClosest(TransInfo *t)
 					}
 				}
 				/* use element center otherwise */
-				else
-				{
+				else {
 					float loc[3];
 					float dist;
 					
@@ -1069,17 +1050,15 @@ static void TargetSnapClosest(TransInfo *t)
 				}
 			}
 		}
-		else
-		{
+		else {
 			int i;
-			for(td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++)
-			{
+			for (td = t->data, i = 0 ; i < t->total && td->flag & TD_SELECTED ; i++, td++) {
 				float loc[3];
 				float dist;
 				
 				copy_v3_v3(loc, td->center);
 				
-				if(t->flag & (T_EDIT|T_POSE)) {
+				if (t->flag & (T_EDIT|T_POSE)) {
 					Object *ob= t->obedit?t->obedit:t->poseobj;
 					mul_m4_v3(ob->obmat, loc);
 				}
@@ -1301,7 +1280,7 @@ static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm
 	mul_m4_v3(imat, ray_start_local);
 	mul_mat3_m4_v3(imat, ray_normal_local);
 
-	if(arm->edbo)
+	if (arm->edbo)
 	{
 		EditBone *eBone;
 
@@ -1323,8 +1302,7 @@ static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm
 			}
 		}
 	}
-	else if (ob->pose && ob->pose->chanbase.first)
-	{
+	else if (ob->pose && ob->pose->chanbase.first) {
 		bPoseChannel *pchan;
 		Bone *bone;
 		
@@ -1352,13 +1330,13 @@ static int snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *arm
 	return retval;
 }
 
-static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh *dm, EditMesh *em, float obmat[][4],
+static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh *dm, BMEditMesh *em, float obmat[][4],
                            const float ray_start[3], const float ray_normal[3], const float mval[2],
                            float r_loc[3], float r_no[3], int *r_dist, float *r_depth)
 {
 	int retval = 0;
 	int totvert = dm->getNumVerts(dm);
-	int totface = dm->getNumFaces(dm);
+	int totface = dm->getNumTessFaces(dm);
 
 	if (totvert > 0) {
 		float imat[4][4];
@@ -1405,9 +1383,9 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
 					hit.index = -1;
 					hit.dist = *r_depth * (*r_depth == FLT_MAX ? 1.0f : local_scale);
 
-					if(treeData.tree && BLI_bvhtree_ray_cast(treeData.tree, ray_start_local, ray_normal_local, 0.0f, &hit, treeData.raycast_callback, &treeData) != -1)
+					if (treeData.tree && BLI_bvhtree_ray_cast(treeData.tree, ray_start_local, ray_normal_local, 0.0f, &hit, treeData.raycast_callback, &treeData) != -1)
 					{
-						if(hit.dist/local_scale <= *r_depth) {
+						if (hit.dist/local_scale <= *r_depth) {
 							*r_depth= hit.dist/local_scale;
 							copy_v3_v3(r_loc, hit.co);
 							copy_v3_v3(r_no, hit.no);
@@ -1426,46 +1404,54 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
 
 #else
 					MVert *verts = dm->getVertArray(dm);
-					MFace *faces = dm->getFaceArray(dm);
+					MFace *faces = dm->getTessFaceArray(dm);
 					int *index_array = NULL;
 					int index = 0;
 					int i;
 					
 					if (em != NULL)
 					{
-						index_array = dm->getFaceDataArray(dm, CD_ORIGINDEX);
-						EM_init_index_arrays(em, 0, 0, 1);
+						index_array = dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
+						EDBM_index_arrays_init(em, 0, 0, 1);
 					}
 					
-					for( i = 0; i < totface; i++) {
-						EditFace *efa = NULL;
+					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)
-							{
+							if (index_array) {
 								index = index_array[i];
 							}
-							else
-							{
+							else {
 								index = i;
 							}
 							
-							if (index == ORIGINDEX_NONE)
-							{
+							if (index == ORIGINDEX_NONE) {
 								test = 0;
 							}
-							else
-							{
-								efa = EM_get_face_for_index(index);
+							else {
+								efa = EDBM_face_at_index(em, index);
 								
-								if (efa && (efa->h || (efa->v1->f & SELECT) || (efa->v2->f & SELECT) || (efa->v3->f & SELECT) || (efa->v4 && efa->v4->f & SELECT)))
+								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;
+										}
+									}
+								}
 							}
 						}
 						
@@ -1492,7 +1478,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
 					
 					if (em != NULL)
 					{
-						EM_free_index_arrays();
+						EDBM_index_arrays_free(em);
 					}
 #endif
 					break;
@@ -1507,35 +1493,30 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
 					if (em != NULL)
 					{
 						index_array = dm->getVertDataArray(dm, CD_ORIGINDEX);
-						EM_init_index_arrays(em, 1, 0, 0);
+						EDBM_index_arrays_init(em, 1, 0, 0);
 					}
 					
-					for( i = 0; i < totvert; i++) {
-						EditVert *eve = NULL;
+					for ( i = 0; i < totvert; i++) {
+						BMVert *eve = NULL;
 						MVert *v = verts + i;
 						
 						test = 1; /* reset for every vert */
 					
-						if (em != NULL)
-						{
-							if (index_array)
-							{
+						if (em != NULL) {
+							if (index_array) {
 								index = index_array[i];
 							}
-							else
-							{
+							else {
 								index = i;
 							}
 							
-							if (index == ORIGINDEX_NONE)
-							{
+							if (index == ORIGINDEX_NONE) {
 								test = 0;
 							}
-							else
-							{
-								eve = EM_get_vert_for_index(index);
+							else {
+								eve = EDBM_vert_at_index(em, index);
 								
-								if (eve && (eve->h || (eve->f & SELECT)))
+								if (eve && (BM_elem_flag_test(eve, BM_ELEM_HIDDEN) || BM_elem_flag_test(eve, BM_ELEM_SELECT)))
 								{
 									test = 0;
 								}
@@ -1551,7 +1532,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
 
 					if (em != NULL)
 					{
-						EM_free_index_arrays();
+						EDBM_index_arrays_free(em);
 					}
 					break;
 				}
@@ -1567,35 +1548,33 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
 					if (em != NULL)
 					{
 						index_array = dm->getEdgeDataArray(dm, CD_ORIGINDEX);
-						EM_init_index_arrays(em, 0, 1, 0);
+						EDBM_index_arrays_init(em, 0, 1, 0);
 					}
 					
-					for( i = 0; i < totedge; i++) {
-						EditEdge *eed = NULL;
+					for ( i = 0; i < totedge; i++) {
+						BMEdge *eed = NULL;
 						MEdge *e = edges + i;
 						
 						test = 1; /* reset for every vert */
 					
 						if (em != NULL)
 						{
-							if (index_array)
-							{
+							if (index_array) {
 								index = index_array[i];
 							}
-							else
-							{
+							else {
 								index = i;
 							}
 							
-							if (index == ORIGINDEX_NONE)
-							{
+							if (index == ORIGINDEX_NONE) {
 								test = 0;
 							}
-							else
-							{
-								eed = EM_get_edge_for_index(index);
+							else {
+								eed = EDBM_edge_at_index(em, index);
 								
-								if (eed && (eed->h || (eed->v1->f & SELECT) || (eed->v2->f & SELECT)))
+								if (eed && (BM_elem_flag_test(eed, BM_ELEM_HIDDEN) ||
+									BM_elem_flag_test(eed->v1, BM_ELEM_SELECT) || 
+									BM_elem_flag_test(eed->v2, BM_ELEM_SELECT)))
 								{
 									test = 0;
 								}
@@ -1611,7 +1590,7 @@ static int snapDerivedMesh(short snap_mode, ARegion *ar, Object *ob, DerivedMesh
 
 					if (em != NULL)
 					{
-						EM_free_index_arrays();
+						EDBM_index_arrays_free(em);
 					}
 					break;
 				}
@@ -1630,17 +1609,15 @@ static int snapObject(Scene *scene, ARegion *ar, Object *ob, int editobject, flo
 	int retval = 0;
 	
 	if (ob->type == OB_MESH) {
-		EditMesh *em;
+		BMEditMesh *em;
 		DerivedMesh *dm;
 		
-		if (editobject)
-		{
-			em = ((Mesh *)ob->data)->edit_mesh;
-			/* dm = editmesh_get_derived_cage(scene, ob, em, CD_MASK_BAREMESH); */
-			dm = editmesh_get_derived_base(ob, em); /* limitation, em & dm MUST have the same number of faces */
+		if (editobject) {
+			em = BMEdit_FromObject(ob);
+			/* dm = editbmesh_get_derived_cage(scene, ob, em, CD_MASK_BAREMESH); */
+			dm = editbmesh_get_derived_base(ob, em); /* limitation, em & dm MUST have the same number of faces */
 		}
-		else
-		{
+		else {
 			em = NULL;
 			dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
 		}
@@ -1649,8 +1626,7 @@ static int snapObject(Scene *scene, ARegion *ar, Object *ob, int editobject, flo
 
 		dm->release(dm);
 	}
-	else if (ob->type == OB_ARMATURE)
-	{
+	else if (ob->type == OB_ARMATURE) {
 		retval = snapArmature(ts->snap_mode, ar, ob, ob->data, obmat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, r_depth);
 	}
 	
@@ -1667,8 +1643,7 @@ static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, c
 	
 	ED_view3d_win_to_ray(ar, v3d, mval, ray_start, ray_normal);
 
-	if (mode == SNAP_ALL && obedit)
-	{
+	if (mode == SNAP_ALL && obedit) {
 		Object *ob = obedit;
 
 		retval |= snapObject(scene, ar, ob, 1, ob->obmat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, &depth);
@@ -1680,8 +1655,7 @@ static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, c
 	 * To solve that problem, we do it first as an exception. 
 	 * */
 	base= BASACT;
-	if(base && base->object && base->object->mode & OB_MODE_PARTICLE_EDIT)
-	{
+	if (base && base->object && base->object->mode & OB_MODE_PARTICLE_EDIT) {
 		Object *ob = base->object;
 		retval |= snapObject(scene, ar, ob, 0, ob->obmat, ray_start, ray_normal, mval, r_loc, r_no, r_dist, &depth);
 	}
@@ -1695,12 +1669,11 @@ static int snapObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, c
 		{
 			Object *ob = base->object;
 			
-			if (ob->transflag & OB_DUPLI)
-			{
+			if (ob->transflag & OB_DUPLI) {
 				DupliObject *dupli_ob;
 				ListBase *lb = object_duplilist(scene, ob);
 				
-				for(dupli_ob = lb->first; dupli_ob; dupli_ob = dupli_ob->next)
+				for (dupli_ob = lb->first; dupli_ob; dupli_ob = dupli_ob->next)
 				{
 					Object *dob = dupli_ob->ob;
 					
@@ -1739,12 +1712,10 @@ static int cmpPeel(void *arg1, void *arg2)
 	DepthPeel *p2 = arg2;
 	int val = 0;
 	
-	if (p1->depth < p2->depth)
-	{
+	if (p1->depth < p2->depth) {
 		val = -1;
 	}
-	else if (p1->depth > p2->depth)
-	{
+	else if (p1->depth > p2->depth) {
 		val = 1;
 	}
 	
@@ -1758,13 +1729,11 @@ static void removeDoublesPeel(ListBase *depth_peels)
 	for (peel = depth_peels->first; peel; peel = peel->next)
 	{
 		DepthPeel *next_peel = peel->next;
-		
-		if (next_peel && ABS(peel->depth - next_peel->depth) < 0.0015f)
-		{
+
+		if (next_peel && ABS(peel->depth - next_peel->depth) < 0.0015f) {
 			peel->next = next_peel->next;
 			
-			if (next_peel->next)
-			{
+			if (next_peel->next) {
 				next_peel->next->prev = peel;
 			}
 			
@@ -1793,7 +1762,7 @@ static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4],
 {
 	int retval = 0;
 	int totvert = dm->getNumVerts(dm);
-	int totface = dm->getNumFaces(dm);
+	int totface = dm->getNumTessFaces(dm);
 	
 	if (totvert > 0) {
 		float imat[4][4];
@@ -1823,10 +1792,10 @@ static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4],
 		
 		if (test == 1) {
 			MVert *verts = dm->getVertArray(dm);
-			MFace *faces = dm->getFaceArray(dm);
+			MFace *faces = dm->getTessFaceArray(dm);
 			int i;
 			
-			for( i = 0; i < totface; i++) {
+			for ( i = 0; i < totface; i++) {
 				MFace *f = faces + i;
 				float lambda;
 				int result;
@@ -1860,8 +1829,7 @@ static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4],
 					addDepthPeel(depth_peels, new_depth, location, normal, ob);
 				}
 		
-				if (f->v4 && result == 0)
-				{
+				if (f->v4 && result == 0) {
 					result = isect_ray_tri_threshold_v3(ray_start_local, ray_normal_local, verts[f->v3].co, verts[f->v4].co, verts[f->v1].co, &lambda, NULL, 0.001);
 					
 					if (result) {
@@ -1897,7 +1865,7 @@ static int peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[][4],
 	return retval;
 } 
 
-static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, ListBase *depth_peels, const float mval[2])
+static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, ListBase *depth_peels, const float mval[2], SnapMode mode)
 {
 	Base *base;
 	int retval = 0;
@@ -1905,34 +1873,31 @@ static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, L
 	
 	ED_view3d_win_to_ray(ar, v3d, mval, ray_start, ray_normal);
 
-	for ( base = scene->base.first; base != NULL; base = base->next ) {
-		if ( BASE_SELECTABLE(v3d, base) ) {
+	for (base = scene->base.first; base != NULL; base = base->next) {
+		if (BASE_SELECTABLE(v3d, base)) {
 			Object *ob = base->object;
-			
-			if (ob->transflag & OB_DUPLI)
-			{
+
+			if (ob->transflag & OB_DUPLI) {
 				DupliObject *dupli_ob;
 				ListBase *lb = object_duplilist(scene, ob);
 				
-				for(dupli_ob = lb->first; dupli_ob; dupli_ob = dupli_ob->next)
+				for (dupli_ob = lb->first; dupli_ob; dupli_ob = dupli_ob->next)
 				{
 					Object *dob = dupli_ob->ob;
 					
 					if (dob->type == OB_MESH) {
-						EditMesh *em;
+						BMEditMesh *em;
 						DerivedMesh *dm = NULL;
 						int val;
 
-						if (dob != obedit)
-						{
+						if (dob != obedit) {
 							dm = mesh_get_derived_final(scene, dob, CD_MASK_BAREMESH);
 							
 							val = peelDerivedMesh(dob, dm, dob->obmat, ray_start, ray_normal, mval, depth_peels);
 						}
-						else
-						{
-							em = ((Mesh *)dob->data)->edit_mesh;
-							dm = editmesh_get_derived_cage(scene, obedit, em, CD_MASK_BAREMESH);
+						else {
+							em = BMEdit_FromObject(dob);
+							dm = editbmesh_get_derived_cage(scene, obedit, em, CD_MASK_BAREMESH);
 							
 							val = peelDerivedMesh(dob, dm, dob->obmat, ray_start, ray_normal, mval, depth_peels);
 						}
@@ -1947,27 +1912,24 @@ static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, L
 			}
 			
 			if (ob->type == OB_MESH) {
-				EditMesh *em;
-				DerivedMesh *dm = NULL;
-				int val;
+				int val = 0;
 
-				if (ob != obedit)
-				{
-					dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
+				if (ob != obedit && ((mode == SNAP_NOT_SELECTED && (base->flag & (SELECT|BA_WAS_SEL)) == 0) || ELEM(mode, SNAP_ALL, SNAP_NOT_OBEDIT))) {
+					DerivedMesh *dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH);
 					
 					val = peelDerivedMesh(ob, dm, ob->obmat, ray_start, ray_normal, mval, depth_peels);
+					dm->release(dm);
 				}
-				else
-				{
-					em = ((Mesh *)ob->data)->edit_mesh;
-					dm = editmesh_get_derived_cage(scene, obedit, em, CD_MASK_BAREMESH);
+				else if (ob == obedit && mode != SNAP_NOT_OBEDIT) {
+					BMEditMesh *em = BMEdit_FromObject(ob);
+					DerivedMesh *dm = editbmesh_get_derived_cage(scene, obedit, em, CD_MASK_BAREMESH);
 					
 					val = peelDerivedMesh(ob, dm, ob->obmat, ray_start, ray_normal, mval, depth_peels);
+					dm->release(dm);
 				}
 					
 				retval = retval || val;
 				
-				dm->release(dm);
 			}
 		}
 	}
@@ -1978,17 +1940,17 @@ static int peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, L
 	return retval;
 }
 
-int peelObjectsTransForm(TransInfo *t, ListBase *depth_peels, const float mval[2])
+int peelObjectsTransForm(TransInfo *t, ListBase *depth_peels, const float mval[2], SnapMode mode)
 {
-	return peelObjects(t->scene, t->view, t->ar, t->obedit, depth_peels, mval);
+	return peelObjects(t->scene, t->view, t->ar, t->obedit, depth_peels, mval, mode);
 }
 
-int peelObjectsContext(bContext *C, ListBase *depth_peels, const float mval[2])
+int peelObjectsContext(bContext *C, ListBase *depth_peels, const float mval[2], SnapMode mode)
 {
 	ScrArea *sa = CTX_wm_area(C);
 	View3D *v3d = sa->spacedata.first;
 
-	return peelObjects(CTX_data_scene(C), v3d, CTX_wm_region(C), CTX_data_edit_object(C), depth_peels, mval);
+	return peelObjects(CTX_data_scene(C), v3d, CTX_wm_region(C), CTX_data_edit_object(C), depth_peels, mval, mode);
 }
 
 /*================================================================*/
@@ -2031,7 +1993,7 @@ static void applyGrid(TransInfo *t, float *val, int max_index, float fac[3], Gea
 	int i;
 	float asp[3] = {1.0f, 1.0f, 1.0f}; // TODO: Remove hard coded limit here (3)
 
-	if(max_index > 2) {
+	if (max_index > 2) {
 		printf("applyGrid: invalid index %d, clamping\n", max_index);
 		max_index= 2;
 	}
@@ -2041,7 +2003,7 @@ static void applyGrid(TransInfo *t, float *val, int max_index, float fac[3], Gea
 		return;
 	
 	/* evil hack - snapping needs to be adapted for image aspect ratio */
-	if((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) {
+	if ((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) {
 		ED_space_image_uv_aspect(t->sa->spacedata.first, asp, asp+1);
 	}
 
diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt
index 7a6ccdf..c13e6c1 100644
--- a/source/blender/editors/util/CMakeLists.txt
+++ b/source/blender/editors/util/CMakeLists.txt
@@ -20,9 +20,11 @@
 
 set(INC
 	../include
+	../../blenfont
 	../../blenkernel
 	../../blenlib
 	../../blenloader
+	../../bmesh
 	../../makesdna
 	../../makesrna
 	../../windowmanager
@@ -87,4 +89,8 @@ set(SRC
 	../include/UI_view2d.h
 )
 
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
 blender_add_lib(bf_editor_util "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/util/SConscript b/source/blender/editors/util/SConscript
index cfbc735..74879e5 100644
--- a/source/blender/editors/util/SConscript
+++ b/source/blender/editors/util/SConscript
@@ -2,10 +2,14 @@
 Import ('env')
 
 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 += ' ../../makesrna'
+incs += ' ../../makesrna ../../bmesh'
 incs += ' ../../blenloader'
 
-env.BlenderLib ( 'bf_editors_util', sources, Split(incs), [], libtype=['core','player'], priority=[330,210] )
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
+
+env.BlenderLib ( 'bf_editors_util', sources, Split(incs), defines=defs, libtype=['core','player'], priority=[330,210] )
diff --git a/source/blender/editors/util/crazyspace.c b/source/blender/editors/util/crazyspace.c
index 9ee4a87..4b03c84 100644
--- a/source/blender/editors/util/crazyspace.c
+++ b/source/blender/editors/util/crazyspace.c
@@ -35,16 +35,17 @@
 #include "DNA_scene_types.h"
 #include "DNA_object_types.h"
 #include "DNA_modifier_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 
+#include "BLI_utildefines.h"
+#include "BLI_math.h"
+
 #include "BKE_DerivedMesh.h"
 #include "BKE_modifier.h"
 #include "BKE_multires.h"
 #include "BKE_mesh.h"
-
-#include "BLI_utildefines.h"
-#include "BLI_math.h"
-#include "BLI_editVert.h"
+#include "BKE_tessmesh.h"
 
 #include "ED_util.h"
 
@@ -53,7 +54,7 @@ typedef struct {
 	short *flags;
 } MappedUserData;
 
-#define TAN_MAKE_VEC(a, b, c)	a[0]= b[0] + 0.2f*(b[0]-c[0]); a[1]= b[1] + 0.2f*(b[1]-c[1]); a[2]= b[2] + 0.2f*(b[2]-c[2])
+#define TAN_MAKE_VEC(a, b, c)   a[0] = b[0] + 0.2f * (b[0] - c[0]); a[1] = b[1] + 0.2f * (b[1] - c[1]); a[2] = b[2] + 0.2f * (b[2] - c[2])
 static void set_crazy_vertex_quat(float *quat, float *v1, float *v2, float *v3, float *def1, float *def2, float *def3)
 {
 	float vecu[3], vecv[3];
@@ -61,27 +62,28 @@ static void set_crazy_vertex_quat(float *quat, float *v1, float *v2, float *v3,
 
 	TAN_MAKE_VEC(vecu, v1, v2);
 	TAN_MAKE_VEC(vecv, v1, v3);
-	tri_to_quat( q1,v1, vecu, vecv);
+	tri_to_quat(q1, v1, vecu, vecv);
 
 	TAN_MAKE_VEC(vecu, def1, def2);
 	TAN_MAKE_VEC(vecv, def1, def3);
-	tri_to_quat( q2,def1, vecu, vecv);
+	tri_to_quat(q2, def1, vecu, vecv);
 
 	sub_qt_qtqt(quat, q2, q1);
 }
 #undef TAN_MAKE_VEC
 
-static void make_vertexcos__mapFunc(void *userData, int index, float *co, float *UNUSED(no_f), short *UNUSED(no_s))
+static void make_vertexcos__mapFunc(void *userData, int index, const float co[3],
+                                    const float UNUSED(no_f[3]), const short UNUSED(no_s[3]))
 {
-	MappedUserData *mappedData= (MappedUserData*)userData;
+	MappedUserData *mappedData = (MappedUserData *)userData;
 	float *vec = mappedData->vertexcos;
 
-	vec+= 3*index;
-	if(!mappedData->flags[index]) {
+	vec += 3 * index;
+	if (!mappedData->flags[index]) {
 		/* we need coord from prototype vertex, not it clones or images,
-		   suppose they stored in the beginning of vertex array stored in DM */
+		 * suppose they stored in the beginning of vertex array stored in DM */
 		copy_v3_v3(vec, co);
-		mappedData->flags[index]= 1;
+		mappedData->flags[index] = 1;
 	}
 }
 
@@ -90,11 +92,11 @@ static int modifiers_disable_subsurf_temporary(Object *ob)
 	ModifierData *md;
 	int disabled = 0;
 
-	for(md=ob->modifiers.first; md; md=md->next)
-		if(md->type==eModifierType_Subsurf)
-			if(md->mode & eModifierMode_OnCage) {
+	for (md = ob->modifiers.first; md; md = md->next)
+		if (md->type == eModifierType_Subsurf)
+			if (md->mode & eModifierMode_OnCage) {
 				md->mode ^= eModifierMode_DisableTemporary;
-				disabled= 1;
+				disabled = 1;
 			}
 
 	return disabled;
@@ -103,27 +105,27 @@ static int modifiers_disable_subsurf_temporary(Object *ob)
 /* disable subsurf temporal, get mapped cos, and enable it */
 float *crazyspace_get_mapped_editverts(Scene *scene, Object *obedit)
 {
-	Mesh *me= obedit->data;
+	Mesh *me = obedit->data;
 	DerivedMesh *dm;
 	float *vertexcos;
-	int nverts= me->edit_mesh->totvert;
+	int nverts = me->edit_btmesh->bm->totvert;
 	short *flags;
 	MappedUserData userData;
 
 	/* disable subsurf temporal, get mapped cos, and enable it */
-	if(modifiers_disable_subsurf_temporary(obedit)) {
+	if (modifiers_disable_subsurf_temporary(obedit)) {
 		/* need to make new derivemesh */
-		makeDerivedMesh(scene, obedit, me->edit_mesh, CD_MASK_BAREMESH);
+		makeDerivedMesh(scene, obedit, me->edit_btmesh, CD_MASK_BAREMESH, 0);
 	}
 
 	/* now get the cage */
-	dm= editmesh_get_derived_cage(scene, obedit, me->edit_mesh, CD_MASK_BAREMESH);
+	dm = editbmesh_get_derived_cage(scene, obedit, me->edit_btmesh, CD_MASK_BAREMESH);
 
-	vertexcos= MEM_callocN(3*sizeof(float)*nverts, "vertexcos map");
-	flags= MEM_callocN(sizeof(short)*nverts, "vertexcos flags");
+	vertexcos = MEM_callocN(3 * sizeof(float) * nverts, "vertexcos map");
+	flags = MEM_callocN(sizeof(short) * nverts, "vertexcos flags");
 
-	userData.vertexcos= vertexcos;
-	userData.flags= flags;
+	userData.vertexcos = vertexcos;
+	userData.flags = flags;
 	dm->foreachMappedVert(dm, make_vertexcos__mapFunc, &userData);
 
 	dm->release(dm);
@@ -136,77 +138,128 @@ float *crazyspace_get_mapped_editverts(Scene *scene, Object *obedit)
 	return vertexcos;
 }
 
-void crazyspace_set_quats_editmesh(EditMesh *em, float *origcos, float *mappedcos, float *quats)
+void crazyspace_set_quats_editmesh(BMEditMesh *em, float *origcos, float *mappedcos, float *quats)
 {
-	EditVert *eve, *prev;
-	EditFace *efa;
+	BMVert *v;
+	BMIter iter, liter;
+	BMLoop *l;
+	float *v1, *v2, *v3, *co1, *co2, *co3;
+	int *vert_table = MEM_callocN(sizeof(int) * em->bm->totvert, "vert_table");
+	int index = 0;
+
+	BM_mesh_elem_index_ensure(em->bm, BM_VERT);
+
+	BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) {
+		if (!BM_elem_flag_test(v, BM_ELEM_SELECT) || BM_elem_flag_test(v, BM_ELEM_HIDDEN))
+			continue;
+		
+		BM_ITER_ELEM (l, &liter, v, BM_LOOPS_OF_VERT) {
+			BMLoop *l2 = BM_face_other_edge_loop(l->f, l->e, v);
+			
+			/* retrieve mapped coordinates */
+			v1 = mappedcos + 3 * BM_elem_index_get(l->v);
+			v2 = mappedcos + 3 * BM_elem_index_get(BM_edge_other_vert(l2->e, l->v));
+			v3 = mappedcos + 3 * BM_elem_index_get(BM_edge_other_vert(l->e, l->v));
+
+			co1 = (origcos) ? origcos + 3 * BM_elem_index_get(l->v) : l->v->co;
+			co2 = (origcos) ? origcos + 3 * BM_elem_index_get(BM_edge_other_vert(l2->e, l->v)) : BM_edge_other_vert(l2->e, l->v)->co;
+			co3 = (origcos) ? origcos + 3 * BM_elem_index_get(BM_edge_other_vert(l->e, l->v)) : BM_edge_other_vert(l->e, l->v)->co;
+			
+			set_crazy_vertex_quat(quats, v1, v2, v3, co1, co2, co3);
+			quats += 4;
+			
+			vert_table[BM_elem_index_get(l->v)] = index + 1;
+			
+			index++;
+			break; /*just do one corner*/
+		}
+	}
+
+	index = 0;
+	BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) {
+		if (vert_table[index] != 0)
+			BM_elem_index_set(v, vert_table[index] - 1);  /* set_dirty! */
+		else
+			BM_elem_index_set(v, -1);  /* set_dirty! */
+		
+		index++;
+	}
+	em->bm->elem_index_dirty |= BM_VERT;
+
+	MEM_freeN(vert_table);
+#if 0
+	BMEditVert *eve, *prev;
+	BMEditFace *efa;
+	BMIter iter;
 	float *v1, *v2, *v3, *v4, *co1, *co2, *co3, *co4;
-	intptr_t index= 0;
+	intptr_t index = 0;
 
 	/* two abused locations in vertices */
-	for(eve= em->verts.first; eve; eve= eve->next, index++) {
+	for (eve = em->verts.first; eve; eve = eve->next, index++) {
 		eve->tmp.p = NULL;
-		eve->prev= (EditVert *)index;
+		eve->prev = (EditVert *)index;
 	}
 
 	/* first store two sets of tangent vectors in vertices, we derive it just from the face-edges */
-	for(efa= em->faces.first; efa; efa= efa->next) {
+	for (efa = em->faces.first; efa; efa = efa->next) {
 
 		/* retrieve mapped coordinates */
-		v1= mappedcos + 3*(intptr_t)(efa->v1->prev);
-		v2= mappedcos + 3*(intptr_t)(efa->v2->prev);
-		v3= mappedcos + 3*(intptr_t)(efa->v3->prev);
+		v1 = mappedcos + 3 * (intptr_t)(efa->v1->prev);
+		v2 = mappedcos + 3 * (intptr_t)(efa->v2->prev);
+		v3 = mappedcos + 3 * (intptr_t)(efa->v3->prev);
 
-		co1= (origcos)? origcos + 3*(intptr_t)(efa->v1->prev): efa->v1->co;
-		co2= (origcos)? origcos + 3*(intptr_t)(efa->v2->prev): efa->v2->co;
-		co3= (origcos)? origcos + 3*(intptr_t)(efa->v3->prev): efa->v3->co;
+		co1 = (origcos) ? origcos + 3 * (intptr_t)(efa->v1->prev) : efa->v1->co;
+		co2 = (origcos) ? origcos + 3 * (intptr_t)(efa->v2->prev) : efa->v2->co;
+		co3 = (origcos) ? origcos + 3 * (intptr_t)(efa->v3->prev) : efa->v3->co;
 
-		if(efa->v2->tmp.p==NULL && efa->v2->f1) {
+		if (efa->v2->tmp.p == NULL && efa->v2->f1) {
 			set_crazy_vertex_quat(quats, co2, co3, co1, v2, v3, v1);
-			efa->v2->tmp.p= (void*)quats;
-			quats+= 4;
+			efa->v2->tmp.p = (void *)quats;
+			quats += 4;
 		}
 
-		if(efa->v4) {
-			v4= mappedcos + 3*(intptr_t)(efa->v4->prev);
-			co4= (origcos)? origcos + 3*(intptr_t)(efa->v4->prev): efa->v4->co;
+		if (efa->v4) {
+			v4 = mappedcos + 3 * (intptr_t)(efa->v4->prev);
+			co4 = (origcos) ? origcos + 3 * (intptr_t)(efa->v4->prev) : efa->v4->co;
 
-			if(efa->v1->tmp.p==NULL && efa->v1->f1) {
+			if (efa->v1->tmp.p == NULL && efa->v1->f1) {
 				set_crazy_vertex_quat(quats, co1, co2, co4, v1, v2, v4);
-				efa->v1->tmp.p= (void*)quats;
-				quats+= 4;
+				efa->v1->tmp.p = (void *)quats;
+				quats += 4;
 			}
-			if(efa->v3->tmp.p==NULL && efa->v3->f1) {
+			if (efa->v3->tmp.p == NULL && efa->v3->f1) {
 				set_crazy_vertex_quat(quats, co3, co4, co2, v3, v4, v2);
-				efa->v3->tmp.p= (void*)quats;
-				quats+= 4;
+				efa->v3->tmp.p = (void *)quats;
+				quats += 4;
 			}
-			if(efa->v4->tmp.p==NULL && efa->v4->f1) {
+			if (efa->v4->tmp.p == NULL && efa->v4->f1) {
 				set_crazy_vertex_quat(quats, co4, co1, co3, v4, v1, v3);
-				efa->v4->tmp.p= (void*)quats;
-				quats+= 4;
+				efa->v4->tmp.p = (void *)quats;
+				quats += 4;
 			}
 		}
 		else {
-			if(efa->v1->tmp.p==NULL && efa->v1->f1) {
+			if (efa->v1->tmp.p == NULL && efa->v1->f1) {
 				set_crazy_vertex_quat(quats, co1, co2, co3, v1, v2, v3);
-				efa->v1->tmp.p= (void*)quats;
-				quats+= 4;
+				efa->v1->tmp.p = (void *)quats;
+				quats += 4;
 			}
-			if(efa->v3->tmp.p==NULL && efa->v3->f1) {
+			if (efa->v3->tmp.p == NULL && efa->v3->f1) {
 				set_crazy_vertex_quat(quats, co3, co1, co2, v3, v1, v2);
-				efa->v3->tmp.p= (void*)quats;
-				quats+= 4;
+				efa->v3->tmp.p = (void *)quats;
+				quats += 4;
 			}
 		}
 	}
 
 	/* restore abused prev pointer */
-	for(prev= NULL, eve= em->verts.first; eve; prev= eve, eve= eve->next)
-		eve->prev= prev;
-
+	for (prev = NULL, eve = em->verts.first; eve; prev = eve, eve = eve->next)
+		eve->prev = prev;
+#endif
 }
 
+/* BMESH_TODO - use MPolys over MFace's */
+
 void crazyspace_set_quats_mesh(Mesh *me, float *origcos, float *mappedcos, float *quats)
 {
 	int i;
@@ -214,60 +267,61 @@ void crazyspace_set_quats_mesh(Mesh *me, float *origcos, float *mappedcos, float
 	MFace *mface;
 	float *v1, *v2, *v3, *v4, *co1, *co2, *co3, *co4;
 
-	mvert= me->mvert;
-	for(i=0; i<me->totvert; i++, mvert++)
-		mvert->flag&= ~ME_VERT_TMP_TAG;
+	mvert = me->mvert;
+	for (i = 0; i < me->totvert; i++, mvert++)
+		mvert->flag &= ~ME_VERT_TMP_TAG;
 
 	/* first store two sets of tangent vectors in vertices, we derive it just from the face-edges */
-	mvert= me->mvert;
-	mface= me->mface;
-	for(i=0; i<me->totface; i++, mface++) {
+	mvert = me->mvert;
+	mface = me->mface;
+	for (i = 0; i < me->totface; i++, mface++) {
 
 		/* retrieve mapped coordinates */
-		v1= mappedcos + 3*mface->v1;
-		v2= mappedcos + 3*mface->v2;
-		v3= mappedcos + 3*mface->v3;
+		v1 = mappedcos + 3 * mface->v1;
+		v2 = mappedcos + 3 * mface->v2;
+		v3 = mappedcos + 3 * mface->v3;
 
-		co1= (origcos)? origcos + 3*mface->v1: mvert[mface->v1].co;
-		co2= (origcos)? origcos + 3*mface->v2: mvert[mface->v2].co;
-		co3= (origcos)? origcos + 3*mface->v3: mvert[mface->v3].co;
+		co1 = (origcos) ? origcos + 3 * mface->v1 : mvert[mface->v1].co;
+		co2 = (origcos) ? origcos + 3 * mface->v2 : mvert[mface->v2].co;
+		co3 = (origcos) ? origcos + 3 * mface->v3 : mvert[mface->v3].co;
 
-		if((mvert[mface->v2].flag&ME_VERT_TMP_TAG)==0) {
-			set_crazy_vertex_quat(&quats[mface->v2*4], co2, co3, co1, v2, v3, v1);
-			mvert[mface->v2].flag|= ME_VERT_TMP_TAG;
+		if ((mvert[mface->v2].flag & ME_VERT_TMP_TAG) == 0) {
+			set_crazy_vertex_quat(&quats[mface->v2 * 4], co2, co3, co1, v2, v3, v1);
+			mvert[mface->v2].flag |= ME_VERT_TMP_TAG;
 		}
 
-		if(mface->v4) {
-			v4= mappedcos + 3*mface->v4;
-			co4= (origcos)? origcos + 3*mface->v4: mvert[mface->v4].co;
+		if (mface->v4) {
+			v4 = mappedcos + 3 * mface->v4;
+			co4 = (origcos) ? origcos + 3 * mface->v4 : mvert[mface->v4].co;
 
-			if((mvert[mface->v1].flag&ME_VERT_TMP_TAG)==0) {
-				set_crazy_vertex_quat(&quats[mface->v1*4], co1, co2, co4, v1, v2, v4);
-				mvert[mface->v1].flag|= ME_VERT_TMP_TAG;
+			if ((mvert[mface->v1].flag & ME_VERT_TMP_TAG) == 0) {
+				set_crazy_vertex_quat(&quats[mface->v1 * 4], co1, co2, co4, v1, v2, v4);
+				mvert[mface->v1].flag |= ME_VERT_TMP_TAG;
 			}
-			if((mvert[mface->v3].flag&ME_VERT_TMP_TAG)==0) {
-				set_crazy_vertex_quat(&quats[mface->v3*4], co3, co4, co2, v3, v4, v2);
-				mvert[mface->v3].flag|= ME_VERT_TMP_TAG;
+			if ((mvert[mface->v3].flag & ME_VERT_TMP_TAG) == 0) {
+				set_crazy_vertex_quat(&quats[mface->v3 * 4], co3, co4, co2, v3, v4, v2);
+				mvert[mface->v3].flag |= ME_VERT_TMP_TAG;
 			}
-			if((mvert[mface->v4].flag&ME_VERT_TMP_TAG)==0) {
-				set_crazy_vertex_quat(&quats[mface->v4*4], co4, co1, co3, v4, v1, v3);
-				mvert[mface->v4].flag|= ME_VERT_TMP_TAG;
+			if ((mvert[mface->v4].flag & ME_VERT_TMP_TAG) == 0) {
+				set_crazy_vertex_quat(&quats[mface->v4 * 4], co4, co1, co3, v4, v1, v3);
+				mvert[mface->v4].flag |= ME_VERT_TMP_TAG;
 			}
 		}
 		else {
-			if((mvert[mface->v1].flag&ME_VERT_TMP_TAG)==0) {
-				set_crazy_vertex_quat(&quats[mface->v1*4], co1, co2, co3, v1, v2, v3);
-				mvert[mface->v1].flag|= ME_VERT_TMP_TAG;
+			if ((mvert[mface->v1].flag & ME_VERT_TMP_TAG) == 0) {
+				set_crazy_vertex_quat(&quats[mface->v1 * 4], co1, co2, co3, v1, v2, v3);
+				mvert[mface->v1].flag |= ME_VERT_TMP_TAG;
 			}
-			if((mvert[mface->v3].flag&ME_VERT_TMP_TAG)==0) {
-				set_crazy_vertex_quat(&quats[mface->v3*4], co3, co1, co2, v3, v1, v2);
-				mvert[mface->v3].flag|= ME_VERT_TMP_TAG;
+			if ((mvert[mface->v3].flag & ME_VERT_TMP_TAG) == 0) {
+				set_crazy_vertex_quat(&quats[mface->v3 * 4], co3, co1, co2, v3, v1, v2);
+				mvert[mface->v3].flag |= ME_VERT_TMP_TAG;
 			}
 		}
 	}
 }
 
-int editmesh_get_first_deform_matrices(Scene *scene, Object *ob, EditMesh *em, float (**deformmats)[3][3], float (**deformcos)[3])
+int editbmesh_get_first_deform_matrices(Scene *scene, Object *ob, BMEditMesh *em, 
+                                        float (**deformmats)[3][3], float (**deformcos)[3])
 {
 	ModifierData *md;
 	DerivedMesh *dm;
@@ -281,40 +335,40 @@ int editmesh_get_first_deform_matrices(Scene *scene, Object *ob, EditMesh *em, f
 	md = modifiers_getVirtualModifierList(ob);
 
 	/* compute the deformation matrices and coordinates for the first
-	   modifiers with on cage editing that are enabled and support computing
-	   deform matrices */
-	for(i = 0; md && i <= cageIndex; i++, md = md->next) {
+	 * modifiers with on cage editing that are enabled and support computing
+	 * deform matrices */
+	for (i = 0; md && i <= cageIndex; i++, md = md->next) {
 		ModifierTypeInfo *mti = modifierType_getInfo(md->type);
 
-		if(!editmesh_modifier_is_enabled(scene, md, dm))
+		if (!editbmesh_modifier_is_enabled(scene, md, dm))
 			continue;
 
-		if(mti->type==eModifierTypeType_OnlyDeform && mti->deformMatricesEM) {
-			if(!defmats) {
-				dm= editmesh_get_derived(em, NULL);
-				deformedVerts= editmesh_get_vertex_cos(em, &numVerts);
-				defmats= MEM_callocN(sizeof(*defmats)*numVerts, "defmats");
+		if (mti->type == eModifierTypeType_OnlyDeform && mti->deformMatricesEM) {
+			if (!defmats) {
+				dm = getEditDerivedBMesh(em, ob, NULL);
+				deformedVerts = editbmesh_get_vertex_cos(em, &numVerts);
+				defmats = MEM_callocN(sizeof(*defmats) * numVerts, "defmats");
 
-				for(a=0; a<numVerts; a++)
+				for (a = 0; a < numVerts; a++)
 					unit_m3(defmats[a]);
 			}
 
 			mti->deformMatricesEM(md, ob, em, dm, deformedVerts, defmats,
-				numVerts);
+			                      numVerts);
 		}
 		else
 			break;
 	}
 
-	for(; md && i <= cageIndex; md = md->next, i++)
-		if(editmesh_modifier_is_enabled(scene, md, dm) && modifier_isCorrectableDeformed(md))
+	for (; md && i <= cageIndex; md = md->next, i++)
+		if (editbmesh_modifier_is_enabled(scene, md, dm) && modifier_isCorrectableDeformed(md))
 			numleft++;
 
-	if(dm)
+	if (dm)
 		dm->release(dm);
 
-	*deformmats= defmats;
-	*deformcos= deformedVerts;
+	*deformmats = defmats;
+	*deformcos = deformedVerts;
 
 	return numleft;
 }
@@ -323,99 +377,99 @@ int sculpt_get_first_deform_matrices(Scene *scene, Object *ob, float (**deformma
 {
 	ModifierData *md;
 	DerivedMesh *dm;
-	int a, numVerts= 0;
-	float (*defmats)[3][3]= NULL, (*deformedVerts)[3]= NULL;
-	MultiresModifierData *mmd= get_multires_modifier(scene, ob, 0);
+	int a, numVerts = 0;
+	float (*defmats)[3][3] = NULL, (*deformedVerts)[3] = NULL;
+	MultiresModifierData *mmd = get_multires_modifier(scene, ob, 0);
 	int has_multires = mmd != NULL && mmd->sculptlvl > 0;
-	int numleft= 0;
+	int numleft = 0;
 
-	if(has_multires) {
-		*deformmats= NULL;
-		*deformcos= NULL;
+	if (has_multires) {
+		*deformmats = NULL;
+		*deformcos = NULL;
 		return numleft;
 	}
 
-	dm= NULL;
-	md= modifiers_getVirtualModifierList(ob);
+	dm = NULL;
+	md = modifiers_getVirtualModifierList(ob);
 
-	for(; md; md= md->next) {
-		ModifierTypeInfo *mti= modifierType_getInfo(md->type);
+	for (; md; md = md->next) {
+		ModifierTypeInfo *mti = modifierType_getInfo(md->type);
 
-		if(!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
+		if (!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
 
-		if(mti->type==eModifierTypeType_OnlyDeform) {
-			if(!defmats) {
-				Mesh *me= (Mesh*)ob->data;
-				dm= mesh_create_derived(me, ob, NULL);
-				deformedVerts= mesh_getVertexCos(me, &numVerts);
-				defmats= MEM_callocN(sizeof(*defmats)*numVerts, "defmats");
+		if (mti->type == eModifierTypeType_OnlyDeform) {
+			if (!defmats) {
+				Mesh *me = (Mesh *)ob->data;
+				dm = mesh_create_derived(me, ob, NULL);
+				deformedVerts = mesh_getVertexCos(me, &numVerts);
+				defmats = MEM_callocN(sizeof(*defmats) * numVerts, "defmats");
 
-				for(a=0; a<numVerts; a++)
+				for (a = 0; a < numVerts; a++)
 					unit_m3(defmats[a]);
 			}
 
-			if(mti->deformMatrices) mti->deformMatrices(md, ob, dm, deformedVerts, defmats, numVerts);
+			if (mti->deformMatrices) mti->deformMatrices(md, ob, dm, deformedVerts, defmats, numVerts);
 			else break;
 		}
 	}
 
-	for(; md; md= md->next) {
-		ModifierTypeInfo *mti= modifierType_getInfo(md->type);
+	for (; md; md = md->next) {
+		ModifierTypeInfo *mti = modifierType_getInfo(md->type);
 
-		if(!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
+		if (!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
 
-		if(mti->type==eModifierTypeType_OnlyDeform)
+		if (mti->type == eModifierTypeType_OnlyDeform)
 			numleft++;
 	}
 
-	if(dm)
+	if (dm)
 		dm->release(dm);
 
-	*deformmats= defmats;
-	*deformcos= deformedVerts;
+	*deformmats = defmats;
+	*deformcos = deformedVerts;
 
 	return numleft;
 }
 
 void crazyspace_build_sculpt(Scene *scene, Object *ob, float (**deformmats)[3][3], float (**deformcos)[3])
 {
-	int totleft= sculpt_get_first_deform_matrices(scene, ob, deformmats, deformcos);
+	int totleft = sculpt_get_first_deform_matrices(scene, ob, deformmats, deformcos);
 
-	if(totleft) {
+	if (totleft) {
 		/* there are deformation modifier which doesn't support deformation matrices
-		   calculation. Need additional crazyspace correction */
+		 * calculation. Need additional crazyspace correction */
 
-		float (*deformedVerts)[3]= *deformcos;
-		float (*origVerts)[3]= MEM_dupallocN(deformedVerts);
-		float *quats= NULL;
-		int i, deformed= 0;
-		ModifierData *md= modifiers_getVirtualModifierList(ob);
-		Mesh *me= (Mesh*)ob->data;
+		float (*deformedVerts)[3] = *deformcos;
+		float (*origVerts)[3] = MEM_dupallocN(deformedVerts);
+		float *quats = NULL;
+		int i, deformed = 0;
+		ModifierData *md = modifiers_getVirtualModifierList(ob);
+		Mesh *me = (Mesh *)ob->data;
 
-		for(; md; md= md->next) {
-			ModifierTypeInfo *mti= modifierType_getInfo(md->type);
+		for (; md; md = md->next) {
+			ModifierTypeInfo *mti = modifierType_getInfo(md->type);
 
-			if(!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
+			if (!modifier_isEnabled(scene, md, eModifierMode_Realtime)) continue;
 
-			if(mti->type==eModifierTypeType_OnlyDeform) {
+			if (mti->type == eModifierTypeType_OnlyDeform) {
 				/* skip leading modifiers which have been already
-				   handled in sculpt_get_first_deform_matrices */
-				if(mti->deformMatrices && !deformed)
+				 * handled in sculpt_get_first_deform_matrices */
+				if (mti->deformMatrices && !deformed)
 					continue;
 
 				mti->deformVerts(md, ob, NULL, deformedVerts, me->totvert, 0, 0);
-				deformed= 1;
+				deformed = 1;
 			}
 		}
 
-		quats= MEM_mallocN(me->totvert*sizeof(float)*4, "crazy quats");
+		quats = MEM_mallocN(me->totvert * sizeof(float) * 4, "crazy quats");
 
-		crazyspace_set_quats_mesh(me, (float*)origVerts, (float*)deformedVerts, quats);
+		crazyspace_set_quats_mesh(me, (float *)origVerts, (float *)deformedVerts, quats);
 
-		for(i=0; i<me->totvert; i++) {
+		for (i = 0; i < me->totvert; i++) {
 			float qmat[3][3], tmat[3][3];
 
-			quat_to_mat3(qmat, &quats[i*4]);
+			quat_to_mat3(qmat, &quats[i * 4]);
 			mul_m3_m3m3(tmat, qmat, (*deformmats)[i]);
 			copy_m3_m3((*deformmats)[i], tmat);
 		}
@@ -424,14 +478,14 @@ void crazyspace_build_sculpt(Scene *scene, Object *ob, float (**deformmats)[3][3
 		MEM_freeN(quats);
 	}
 
-	if(!*deformmats) {
+	if (!*deformmats) {
 		int a, numVerts;
-		Mesh *me= (Mesh*)ob->data;
+		Mesh *me = (Mesh *)ob->data;
 
-		*deformcos= mesh_getVertexCos(me, &numVerts);
-		*deformmats= MEM_callocN(sizeof(*(*deformmats))*numVerts, "defmats");
+		*deformcos = mesh_getVertexCos(me, &numVerts);
+		*deformmats = MEM_callocN(sizeof(*(*deformmats)) * numVerts, "defmats");
 
-		for(a=0; a<numVerts; a++)
+		for (a = 0; a < numVerts; a++)
 			unit_m3((*deformmats)[a]);
 	}
 }
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index a40c6cf..6d9f273 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -35,12 +35,12 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "DNA_mesh_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_packedFile_types.h"
 
 #include "BLI_blenlib.h"
-#include "BLI_editVert.h"
 
 #include "BKE_context.h"
 #include "BKE_global.h"
@@ -67,22 +67,22 @@
 
 void ED_editors_init(bContext *C)
 {
-	Main *bmain= CTX_data_main(C);
-	Scene *sce= CTX_data_scene(C);
-	Object *ob, *obact= (sce && sce->basact)? sce->basact->object: NULL;
+	Main *bmain = CTX_data_main(C);
+	Scene *sce = CTX_data_scene(C);
+	Object *ob, *obact = (sce && sce->basact) ? sce->basact->object : NULL;
 	ID *data;
 
 	/* toggle on modes for objects that were saved with these enabled. for
-	   e.g. linked objects we have to ensure that they are actually the
-	   active object in this scene. */
-	for(ob=bmain->object.first; ob; ob=ob->id.next) {
-		int mode= ob->mode;
+	 * e.g. linked objects we have to ensure that they are actually the
+	 * active object in this scene. */
+	for (ob = bmain->object.first; ob; ob = ob->id.next) {
+		int mode = ob->mode;
 
-		if(mode && (mode != OB_MODE_POSE)) {
-			ob->mode= 0;
-			data= ob->data;
+		if (mode && (mode != OB_MODE_POSE)) {
+			ob->mode = 0;
+			data = ob->data;
 
-			if(ob == obact && !ob->id.lib && !(data && data->lib))
+			if (ob == obact && !ob->id.lib && !(data && data->lib))
 				ED_object_toggle_modes(C, mode);
 		}
 	}
@@ -91,30 +91,30 @@ void ED_editors_init(bContext *C)
 /* frees all editmode stuff */
 void ED_editors_exit(bContext *C)
 {
-	Main *bmain= CTX_data_main(C);
+	Main *bmain = CTX_data_main(C);
 	Scene *sce;
 
-	if(!bmain)
+	if (!bmain)
 		return;
 	
 	/* frees all editmode undos */
 	undo_editmode_clear();
 	ED_undo_paint_free();
 	
-	for(sce=bmain->scene.first; sce; sce= sce->id.next) {
-		if(sce->obedit) {
-			Object *ob= sce->obedit;
+	for (sce = bmain->scene.first; sce; sce = sce->id.next) {
+		if (sce->obedit) {
+			Object *ob = sce->obedit;
 		
-			if(ob) {
-				if(ob->type==OB_MESH) {
-					Mesh *me= ob->data;
-					if(me->edit_mesh) {
-						free_editMesh(me->edit_mesh);
-						MEM_freeN(me->edit_mesh);
-						me->edit_mesh= NULL;
+			if (ob) {
+				if (ob->type == OB_MESH) {
+					Mesh *me = ob->data;
+					if (me->edit_btmesh) {
+						EDBM_mesh_free(me->edit_btmesh);
+						MEM_freeN(me->edit_btmesh);
+						me->edit_btmesh = NULL;
 					}
 				}
-				else if(ob->type==OB_ARMATURE) {
+				else if (ob->type == OB_ARMATURE) {
 					ED_armature_edit_free(ob);
 				}
 			}
@@ -135,30 +135,30 @@ void ED_editors_exit(bContext *C)
 void apply_keyb_grid(int shift, int ctrl, float *val, float fac1, float fac2, float fac3, int invert)
 {
 	/* fac1 is for 'nothing', fac2 for CTRL, fac3 for SHIFT */
-	if(invert)
-		ctrl= !ctrl;
+	if (invert)
+		ctrl = !ctrl;
 	
-	if(ctrl && shift) {
-		if(fac3 != 0.0f) *val= fac3*floorf(*val/fac3 +0.5f);
+	if (ctrl && shift) {
+		if (fac3 != 0.0f) *val = fac3 * floorf(*val / fac3 + 0.5f);
 	}
-	else if(ctrl) {
-		if(fac2 != 0.0f) *val= fac2*floorf(*val/fac2 +0.5f);
+	else if (ctrl) {
+		if (fac2 != 0.0f) *val = fac2 * floorf(*val / fac2 + 0.5f);
 	}
 	else {
-		if(fac1 != 0.0f) *val= fac1*floorf(*val/fac1 +0.5f);
+		if (fac1 != 0.0f) *val = fac1 * floorf(*val / fac1 + 0.5f);
 	}
 }
 
-
+#if 0 /* UNUSED */
 int GetButStringLength(const char *str) 
 {
 	int rt;
 	
-	rt= UI_GetStringWidth(str);
+	rt = UI_GetStringWidth(str);
 	
 	return rt + 15;
 }
-
+#endif
 
 void unpack_menu(bContext *C, const char *opname, const char *id_name, const char *abs_name, const char *folder, struct PackedFile *pf)
 {
@@ -168,25 +168,25 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha
 	char line[FILE_MAX + 100];
 	wmOperatorType *ot = WM_operatortype_find(opname, 1);
 
-	pup= uiPupMenuBegin(C, "Unpack file", ICON_NONE);
-	layout= uiPupMenuLayout(pup);
+	pup = uiPupMenuBegin(C, "Unpack file", ICON_NONE);
+	layout = uiPupMenuLayout(pup);
 
 	strcpy(line, "Remove Pack");
-	props_ptr= uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+	props_ptr = uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
 	RNA_enum_set(&props_ptr, "method", PF_REMOVE);
 	RNA_string_set(&props_ptr, "id", id_name);
 
-	if(G.relbase_valid) {
+	if (G.relbase_valid) {
 		char local_name[FILE_MAXDIR + FILE_MAX], fi[FILE_MAX];
 
 		BLI_strncpy(local_name, abs_name, sizeof(local_name));
 		BLI_splitdirstring(local_name, fi);
 		BLI_snprintf(local_name, sizeof(local_name), "//%s/%s", folder, fi);
-		if(strcmp(abs_name, local_name)!=0) {
-			switch(checkPackedFile(local_name, pf)) {
+		if (strcmp(abs_name, local_name) != 0) {
+			switch (checkPackedFile(local_name, pf)) {
 				case PF_NOFILE:
 					BLI_snprintf(line, sizeof(line), "Create %s", local_name);
-					props_ptr= uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+					props_ptr = uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
 					RNA_enum_set(&props_ptr, "method", PF_WRITE_LOCAL);
 					RNA_string_set(&props_ptr, "id", id_name);
 
@@ -194,7 +194,7 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha
 				case PF_EQUAL:
 					BLI_snprintf(line, sizeof(line), "Use %s (identical)", local_name);
 					//uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_LOCAL);
-					props_ptr= uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+					props_ptr = uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
 					RNA_enum_set(&props_ptr, "method", PF_USE_LOCAL);
 					RNA_string_set(&props_ptr, "id", id_name);
 
@@ -202,13 +202,13 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha
 				case PF_DIFFERS:
 					BLI_snprintf(line, sizeof(line), "Use %s (differs)", local_name);
 					//uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_LOCAL);
-					props_ptr= uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+					props_ptr = uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
 					RNA_enum_set(&props_ptr, "method", PF_USE_LOCAL);
 					RNA_string_set(&props_ptr, "id", id_name);
 
 					BLI_snprintf(line, sizeof(line), "Overwrite %s", local_name);
 					//uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_WRITE_LOCAL);
-					props_ptr= uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+					props_ptr = uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
 					RNA_enum_set(&props_ptr, "method", PF_WRITE_LOCAL);
 					RNA_string_set(&props_ptr, "id", id_name);
 					break;
@@ -216,31 +216,31 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha
 		}
 	}
 
-	switch(checkPackedFile(abs_name, pf)) {
+	switch (checkPackedFile(abs_name, pf)) {
 		case PF_NOFILE:
 			BLI_snprintf(line, sizeof(line), "Create %s", abs_name);
 			//uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_WRITE_ORIGINAL);
-			props_ptr= uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+			props_ptr = uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
 			RNA_enum_set(&props_ptr, "method", PF_WRITE_ORIGINAL);
 			RNA_string_set(&props_ptr, "id", id_name);
 			break;
 		case PF_EQUAL:
 			BLI_snprintf(line, sizeof(line), "Use %s (identical)", abs_name);
 			//uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_ORIGINAL);
-			props_ptr= uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+			props_ptr = uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
 			RNA_enum_set(&props_ptr, "method", PF_USE_ORIGINAL);
 			RNA_string_set(&props_ptr, "id", id_name);
 			break;
 		case PF_DIFFERS:
 			BLI_snprintf(line, sizeof(line), "Use %s (differs)", abs_name);
 			//uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_USE_ORIGINAL);
-			props_ptr= uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+			props_ptr = uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
 			RNA_enum_set(&props_ptr, "method", PF_USE_ORIGINAL);
 			RNA_string_set(&props_ptr, "id", id_name);
 
 			BLI_snprintf(line, sizeof(line), "Overwrite %s", abs_name);
 			//uiItemEnumO_ptr(layout, ot, line, 0, "method", PF_WRITE_ORIGINAL);
-			props_ptr= uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+			props_ptr = uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
 			RNA_enum_set(&props_ptr, "method", PF_WRITE_ORIGINAL);
 			RNA_string_set(&props_ptr, "id", id_name);
 			break;
diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c
index 34dffc1..ac0f830 100644
--- a/source/blender/editors/util/editmode_undo.c
+++ b/source/blender/editors/util/editmode_undo.c
@@ -59,25 +59,23 @@
 
 /* ***************** generic editmode undo system ********************* */
 /*
+ * Add this in your local code:
+ *
+ * void undo_editmode_push(bContext *C, const char *name, 
+ *      void * (*getdata)(bContext *C),     // use context to retrieve current editdata
+ *      void (*freedata)(void *),           // pointer to function freeing data
+ *      void (*to_editmode)(void *, void *),        // data to editmode conversion
+ *      void * (*from_editmode)(void *))      // editmode to data conversion
+ *      int  (*validate_undo)(void *, void *))      // check if undo data is still valid
+ *
+ *
+ * Further exported for UI is:
+ *
+ * void undo_editmode_step(bContext *C, int step);	 // undo and redo
+ * void undo_editmode_clear(void)				// free & clear all data
+ * void undo_editmode_menu(void)				// history menu
+ */
 
-Add this in your local code:
-
-void undo_editmode_push(bContext *C, const char *name, 
-		void * (*getdata)(bContext *C),     // use context to retrieve current editdata
-		void (*freedata)(void *), 			// pointer to function freeing data
-		void (*to_editmode)(void *, void *),        // data to editmode conversion
-		void * (*from_editmode)(void *))      // editmode to data conversion
-		int  (*validate_undo)(void *, void *))      // check if undo data is still valid
-
-
-Further exported for UI is:
-
-void undo_editmode_step(bContext *C, int step);	 // undo and redo
-void undo_editmode_clear(void)				// free & clear all data
-void undo_editmode_menu(void)				// history menu
-
-
-*/
 /* ********************************************************************* */
 
 /* ****** XXX ***** */
@@ -85,113 +83,113 @@ static void error(const char *UNUSED(arg)) {}
 /* ****** XXX ***** */
 
 
-#define MAXUNDONAME	64
+#define MAXUNDONAME 64
 typedef struct UndoElem {
 	struct UndoElem *next, *prev;
-	ID id;			// copy of editmode object ID
-	Object *ob;		// pointer to edited object
-	int type;		// type of edited object
+	ID id;          // copy of editmode object ID
+	Object *ob;     // pointer to edited object
+	int type;       // type of edited object
 	void *undodata;
 	uintptr_t undosize;
 	char name[MAXUNDONAME];
-	void * (*getdata)(bContext *C);
+	void * (*getdata)(bContext * C);
 	void (*freedata)(void *);
-	void (*to_editmode)(void *, void *);
-	void * (*from_editmode)(void *);
+	void (*to_editmode)(void *, void *, void *);
+	void * (*from_editmode)(void *, void *);
 	int (*validate_undo)(void *, void *);
 } UndoElem;
 
-static ListBase undobase={NULL, NULL};
-static UndoElem *curundo= NULL;
+static ListBase undobase = {NULL, NULL};
+static UndoElem *curundo = NULL;
 
 
 /* ********************* xtern api calls ************* */
 
-static void undo_restore(UndoElem *undo, void *editdata)
+static void undo_restore(UndoElem *undo, void *editdata, void *obdata)
 {
-	if(undo) {
-		undo->to_editmode(undo->undodata, editdata);	
+	if (undo) {
+		undo->to_editmode(undo->undodata, editdata, obdata);	
 	}
 }
 
 /* name can be a dynamic string */
 void undo_editmode_push(bContext *C, const char *name, 
-						void * (*getdata)(bContext *C),
-						void (*freedata)(void *), 
-						void (*to_editmode)(void *, void *),  
-						void *(*from_editmode)(void *),
-						int (*validate_undo)(void *, void *))
+                        void * (*getdata)(bContext * C),
+                        void (*freedata)(void *),
+                        void (*to_editmode)(void *, void *, void *),
+                        void *(*from_editmode)(void *, void *),
+                        int (*validate_undo)(void *, void *))
 {
 	UndoElem *uel;
-	Object *obedit= CTX_data_edit_object(C);
+	Object *obedit = CTX_data_edit_object(C);
 	void *editdata;
 	int nr;
 	uintptr_t memused, totmem, maxmem;
 
-	/* at first here was code to prevent an "original" key to be insterted twice
-	   this was giving conflicts for example when mesh changed due to keys or apply */
+	/* at first here was code to prevent an "original" key to be inserted twice
+	 * this was giving conflicts for example when mesh changed due to keys or apply */
 	
 	/* remove all undos after (also when curundo==NULL) */
-	while(undobase.last != curundo) {
-		uel= undobase.last;
+	while (undobase.last != curundo) {
+		uel = undobase.last;
 		uel->freedata(uel->undodata);
 		BLI_freelinkN(&undobase, uel);
 	}
 	
 	/* make new */
-	curundo= uel= MEM_callocN(sizeof(UndoElem), "undo editmode");
+	curundo = uel = MEM_callocN(sizeof(UndoElem), "undo editmode");
 	BLI_strncpy(uel->name, name, sizeof(uel->name));
 	BLI_addtail(&undobase, uel);
 	
-	uel->getdata= getdata;
-	uel->freedata= freedata;
-	uel->to_editmode= to_editmode;
-	uel->from_editmode= from_editmode;
-	uel->validate_undo= validate_undo;
+	uel->getdata = getdata;
+	uel->freedata = freedata;
+	uel->to_editmode = to_editmode;
+	uel->from_editmode = from_editmode;
+	uel->validate_undo = validate_undo;
 	
 	/* limit amount to the maximum amount*/
-	nr= 0;
-	uel= undobase.last;
-	while(uel) {
+	nr = 0;
+	uel = undobase.last;
+	while (uel) {
 		nr++;
-		if(nr==U.undosteps) break;
-		uel= uel->prev;
+		if (nr == U.undosteps) break;
+		uel = uel->prev;
 	}
-	if(uel) {
-		while(undobase.first!=uel) {
-			UndoElem *first= undobase.first;
+	if (uel) {
+		while (undobase.first != uel) {
+			UndoElem *first = undobase.first;
 			first->freedata(first->undodata);
 			BLI_freelinkN(&undobase, first);
 		}
 	}
 
 	/* copy  */
-	memused= MEM_get_memory_in_use();
-	editdata= getdata(C);
-	curundo->undodata= curundo->from_editmode(editdata);
-	curundo->undosize= MEM_get_memory_in_use() - memused;
-	curundo->ob= obedit;
-	curundo->id= obedit->id;
-	curundo->type= obedit->type;
-
-	if(U.undomemory != 0) {
+	memused = MEM_get_memory_in_use();
+	editdata = getdata(C);
+	curundo->undodata = curundo->from_editmode(editdata, obedit->data);
+	curundo->undosize = MEM_get_memory_in_use() - memused;
+	curundo->ob = obedit;
+	curundo->id = obedit->id;
+	curundo->type = obedit->type;
+
+	if (U.undomemory != 0) {
 		/* limit to maximum memory (afterwards, we can't know in advance) */
-		totmem= 0;
-		maxmem= ((uintptr_t)U.undomemory)*1024*1024;
-
-		uel= undobase.last;
-		while(uel && uel->prev) {
-			totmem+= uel->undosize;
-			if(totmem>maxmem) break;
-			uel= uel->prev;
+		totmem = 0;
+		maxmem = ((uintptr_t)U.undomemory) * 1024 * 1024;
+
+		uel = undobase.last;
+		while (uel && uel->prev) {
+			totmem += uel->undosize;
+			if (totmem > maxmem) break;
+			uel = uel->prev;
 		}
 
-		if(uel) {
-			if(uel->prev && uel->prev->prev)
-				uel= uel->prev;
+		if (uel) {
+			if (uel->prev && uel->prev->prev)
+				uel = uel->prev;
 
-			while(undobase.first!=uel) {
-				UndoElem *first= undobase.first;
+			while (undobase.first != uel) {
+				UndoElem *first = undobase.first;
 				first->freedata(first->undodata);
 				BLI_freelinkN(&undobase, first);
 			}
@@ -203,76 +201,76 @@ void undo_editmode_push(bContext *C, const char *name,
 static void undo_clean_stack(bContext *C)
 {
 	UndoElem *uel, *next;
-	Object *obedit= CTX_data_edit_object(C);
+	Object *obedit = CTX_data_edit_object(C);
 	
 	/* global undo changes pointers, so we also allow identical names */
 	/* side effect: when deleting/renaming object and start editing new one with same name */
 	
-	uel= undobase.first; 
-	while(uel) {
-		void *editdata= uel->getdata(C);
-		int isvalid= 0;
-		next= uel->next;
+	uel = undobase.first;
+	while (uel) {
+		void *editdata = uel->getdata(C);
+		int isvalid = 0;
+		next = uel->next;
 		
 		/* for when objects are converted, renamed, or global undo changes pointers... */
-		if(uel->type==obedit->type) {
-			if(strcmp(uel->id.name, obedit->id.name)==0) {
-				if(uel->validate_undo==NULL)
-					isvalid= 1;
-				else if(uel->validate_undo(uel->undodata, editdata))
-					isvalid= 1;
+		if (uel->type == obedit->type) {
+			if (strcmp(uel->id.name, obedit->id.name) == 0) {
+				if (uel->validate_undo == NULL)
+					isvalid = 1;
+				else if (uel->validate_undo(uel->undodata, editdata))
+					isvalid = 1;
 			}
 		}
-		if(isvalid) 
-			uel->ob= obedit;
+		if (isvalid) 
+			uel->ob = obedit;
 		else {
-			if(uel == curundo)
-				curundo= NULL;
+			if (uel == curundo)
+				curundo = NULL;
 
 			uel->freedata(uel->undodata);
 			BLI_freelinkN(&undobase, uel);
 		}
 		
-		uel= next;
+		uel = next;
 	}
 	
-	if(curundo == NULL) curundo= undobase.last;
+	if (curundo == NULL) curundo = undobase.last;
 }
 
 /* 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);
+	Object *obedit = CTX_data_edit_object(C);
 	
 	/* prevent undo to happen on wrong object, stack can be a mix */
 	undo_clean_stack(C);
 	
-	if(step==0) {
-		undo_restore(curundo, curundo->getdata(C));
+	if (step == 0) {
+		undo_restore(curundo, curundo->getdata(C), obedit->data);
 	}
-	else if(step==1) {
+	else if (step == 1) {
 		
-		if(curundo==NULL || curundo->prev==NULL) error("No more steps to undo");
+		if (curundo == NULL || curundo->prev == NULL) error("No more steps to undo");
 		else {
-			if(G.f & G_DEBUG) printf("undo %s\n", curundo->name);
-			curundo= curundo->prev;
-			undo_restore(curundo, curundo->getdata(C));
+			if (G.debug & G_DEBUG) printf("undo %s\n", curundo->name);
+			curundo = curundo->prev;
+			undo_restore(curundo, curundo->getdata(C), obedit->data);
 		}
 	}
 	else {
 		/* curundo has to remain current situation! */
 		
-		if(curundo==NULL || curundo->next==NULL) error("No more steps to redo");
+		if (curundo == NULL || curundo->next == NULL) error("No more steps to redo");
 		else {
-			undo_restore(curundo->next, curundo->getdata(C));
-			curundo= curundo->next;
-			if(G.f & G_DEBUG) printf("redo %s\n", curundo->name);
+			undo_restore(curundo->next, curundo->getdata(C), obedit->data);
+			curundo = curundo->next;
+			if (G.debug & G_DEBUG) printf("redo %s\n", curundo->name);
 		}
 	}
 	
 	/* special case for editmesh, mode must be copied back to the scene */
-	if(obedit->type == OB_MESH) {
-		EM_selectmode_to_scene(CTX_data_scene(C), obedit);
+	if (obedit->type == OB_MESH) {
+		EDBM_selectmode_to_scene(C);
 	}
 
 	DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
@@ -284,25 +282,25 @@ void undo_editmode_clear(void)
 {
 	UndoElem *uel;
 	
-	uel= undobase.first;
-	while(uel) {
+	uel = undobase.first;
+	while (uel) {
 		uel->freedata(uel->undodata);
-		uel= uel->next;
+		uel = uel->next;
 	}
 	BLI_freelistN(&undobase);
-	curundo= NULL;
+	curundo = NULL;
 }
 
 /* based on index nr it does a restore */
 void undo_editmode_number(bContext *C, int nr)
 {
 	UndoElem *uel;
-	int a=1;
+	int a = 1;
 	
-	for(uel= undobase.first; uel; uel= uel->next, a++) {
-		if(a==nr) break;
+	for (uel = undobase.first; uel; uel = uel->next, a++) {
+		if (a == nr) break;
 	}
-	curundo= uel;
+	curundo = uel;
 	undo_editmode_step(C, 0);
 }
 
@@ -310,12 +308,12 @@ void undo_editmode_name(bContext *C, const char *undoname)
 {
 	UndoElem *uel;
 	
-	for(uel= undobase.last; uel; uel= uel->prev) {
-		if(strcmp(undoname, uel->name)==0)
+	for (uel = undobase.last; uel; uel = uel->prev) {
+		if (strcmp(undoname, uel->name) == 0)
 			break;
 	}
-	if(uel && uel->prev) {
-		curundo= uel->prev;
+	if (uel && uel->prev) {
+		curundo = uel->prev;
 		undo_editmode_step(C, 0);
 	}
 }
@@ -323,11 +321,11 @@ void undo_editmode_name(bContext *C, const char *undoname)
 /* undoname optionally, if NULL it just checks for existing undo steps */
 int undo_editmode_valid(const char *undoname)
 {
-	if(undoname) {
+	if (undoname) {
 		UndoElem *uel;
 		
-		for(uel= undobase.last; uel; uel= uel->prev) {
-			if(strcmp(undoname, uel->name)==0)
+		for (uel = undobase.last; uel; uel = uel->prev) {
+			if (strcmp(undoname, uel->name) == 0)
 				break;
 		}
 		return uel != NULL;
@@ -345,12 +343,12 @@ const char *undo_editmode_get_name(bContext *C, int nr, int *active)
 	/* prevent wrong numbers to be returned */
 	undo_clean_stack(C);
 	
-	if(active) *active= 0;
+	if (active) *active = 0;
 	
-	uel= BLI_findlink(&undobase, nr);
-	if(uel) {
-		if(active && uel==curundo)
-			*active= 1;
+	uel = BLI_findlink(&undobase, nr);
+	if (uel) {
+		if (active && uel == curundo)
+			*active = 1;
 		return uel->name;
 	}
 	return NULL;
@@ -359,7 +357,7 @@ const char *undo_editmode_get_name(bContext *C, int nr, int *active)
 
 void *undo_editmode_get_prev(Object *ob)
 {
-	UndoElem *ue= undobase.last;
-	if(ue && ue->prev && ue->prev->ob==ob) return ue->prev->undodata;
+	UndoElem *ue = undobase.last;
+	if (ue && ue->prev && ue->prev->ob == ob) return ue->prev->undodata;
 	return NULL;
 }
diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c
index 52422d3..c037508 100644
--- a/source/blender/editors/util/numinput.c
+++ b/source/blender/editors/util/numinput.c
@@ -30,8 +30,8 @@
  */
 
 
-#include <math.h>			/* fabs */
-#include <stdio.h>			/* for size_t */
+#include <math.h>           /* fabs */
+#include <stdio.h>          /* for size_t */
 
 #include "BLI_utildefines.h"
 #include "BLI_string.h"
@@ -46,19 +46,19 @@
 
 void initNumInput(NumInput *n)
 {
-	n->flag		=
-	n->idx		=
-	n->idx_max	=
+	n->flag     =
+	n->idx      =
+	n->idx_max  =
 	n->inv[0]   =
 	n->inv[1]   =
 	n->inv[2]   =
-	n->ctrl[0]	= 
-	n->ctrl[1]	= 
-	n->ctrl[2]	= 0;
+	n->ctrl[0]  = 
+	n->ctrl[1]  = 
+	n->ctrl[2]  = 0;
 
-	n->val[0]		= 
-	n->val[1]	= 
-	n->val[2]	= 0.0f;
+	n->val[0]   = 
+	n->val[1]   = 
+	n->val[2]   = 0.0f;
 }
 
 void outputNumInput(NumInput *n, char *str)
@@ -67,7 +67,7 @@ void outputNumInput(NumInput *n, char *str)
 	char inv[] = "1/";
 	short i, j;
 
-	for (j=0; j<=n->idx_max; j++) {
+	for (j = 0; j <= n->idx_max; j++) {
 		/* if AFFECTALL and no number typed and cursor not on number, use first number */
 		if (n->flag & NUM_AFFECT_ALL && n->idx != j && n->ctrl[j] == 0)
 			i = 0;
@@ -84,35 +84,35 @@ void outputNumInput(NumInput *n, char *str)
 		else
 			inv[0] = 0;
 
-		if( n->val[i] > 1e10f || n->val[i] < -1e10f )
-			BLI_snprintf(&str[j*20], 20, "%s%.4e%c", inv, n->val[i], cur);
+		if (n->val[i] > 1e10f || n->val[i] < -1e10f)
+			BLI_snprintf(&str[j * 20], 20, "%s%.4e%c", inv, n->val[i], cur);
 		else
 			switch (n->ctrl[i]) {
-			case 0:
-				BLI_snprintf(&str[j*20], 20, "%sNONE%c", inv, cur);
-				break;
-			case 1:
-			case -1:
-				BLI_snprintf(&str[j*20], 20, "%s%.0f%c", inv, n->val[i], cur);
-				break;
-			case 10:
-			case -10:
-				BLI_snprintf(&str[j*20], 20, "%s%.f.%c", inv, n->val[i], cur);
-				break;
-			case 100:
-			case -100:
-				BLI_snprintf(&str[j*20], 20, "%s%.1f%c", inv, n->val[i], cur);
-				break;
-			case 1000:
-			case -1000:
-				BLI_snprintf(&str[j*20], 20, "%s%.2f%c", inv, n->val[i], cur);
-				break;
-			case 10000:
-			case -10000:
-				BLI_snprintf(&str[j*20], 20, "%s%.3f%c", inv, n->val[i], cur);
-				break;
-			default:
-				BLI_snprintf(&str[j*20], 20, "%s%.4e%c", inv, n->val[i], cur);
+				case 0:
+					BLI_snprintf(&str[j * 20], 20, "%sNONE%c", inv, cur);
+					break;
+				case 1:
+				case -1:
+					BLI_snprintf(&str[j * 20], 20, "%s%.0f%c", inv, n->val[i], cur);
+					break;
+				case 10:
+				case -10:
+					BLI_snprintf(&str[j * 20], 20, "%s%.f.%c", inv, n->val[i], cur);
+					break;
+				case 100:
+				case -100:
+					BLI_snprintf(&str[j * 20], 20, "%s%.1f%c", inv, n->val[i], cur);
+					break;
+				case 1000:
+				case -1000:
+					BLI_snprintf(&str[j * 20], 20, "%s%.2f%c", inv, n->val[i], cur);
+					break;
+				case 10000:
+				case -10000:
+					BLI_snprintf(&str[j * 20], 20, "%s%.3f%c", inv, n->val[i], cur);
+					break;
+				default:
+					BLI_snprintf(&str[j * 20], 20, "%s%.4e%c", inv, n->val[i], cur);
 			}
 	}
 }
@@ -121,7 +121,7 @@ short hasNumInput(NumInput *n)
 {
 	short i;
 
-	for (i=0; i<=n->idx_max; i++) {
+	for (i = 0; i <= n->idx_max; i++) {
 		if (n->ctrl[i])
 			return 1;
 	}
@@ -134,7 +134,7 @@ void applyNumInput(NumInput *n, float *vec)
 	short i, j;
 
 	if (hasNumInput(n)) {
-		for (j=0; j<=n->idx_max; j++) {
+		for (j = 0; j <= n->idx_max; j++) {
 			/* if AFFECTALL and no number typed and cursor not on number, use first number */
 			if (n->flag & NUM_AFFECT_ALL && n->idx != j && n->ctrl[j] == 0)
 				i = 0;
@@ -148,12 +148,10 @@ void applyNumInput(NumInput *n, float *vec)
 				vec[j] = 0.0001f;
 			}
 			else {
-				if (n->inv[i])
-				{
+				if (n->inv[i]) {
 					vec[j] = 1.0f / n->val[i];
 				}
-				else
-				{
+				else {
 					vec[j] = n->val[i];
 				}
 			}
@@ -168,137 +166,138 @@ char handleNumInput(NumInput *n, wmEvent *event)
 
 	if (event->type == EVT_MODAL_MAP) {
 		switch (event->val) {
-		case NUM_MODAL_INCREMENT_UP:
-			if (!n->ctrl[idx])
-				n->ctrl[idx] = 1;
+			case NUM_MODAL_INCREMENT_UP:
+				if (!n->ctrl[idx])
+					n->ctrl[idx] = 1;
 
-			n->val[idx] += n->increment;
-			break;
-		case NUM_MODAL_INCREMENT_DOWN:
-			if (!n->ctrl[idx])
-				n->ctrl[idx] = 1;
+				n->val[idx] += n->increment;
+				break;
+			case NUM_MODAL_INCREMENT_DOWN:
+				if (!n->ctrl[idx])
+					n->ctrl[idx] = 1;
 
-			n->val[idx] -= n->increment;
-			break;
-		default:
-			return 0;
+				n->val[idx] -= n->increment;
+				break;
+			default:
+				return 0;
 		}
-	} else {
+	}
+	else {
 		switch (event->type) {
-		case BACKSPACEKEY:
-			if (n->ctrl[idx] == 0) {
-				n->val[0]		=
-					n->val[1]	=
-					n->val[2]	= 0.0f;
-				n->ctrl[0]		=
-					n->ctrl[1]	=
-					n->ctrl[2]	= 0;
-				n->inv[0]		=
-					n->inv[1]	=
-					n->inv[2]	= 0;
-			}
-			else {
-				n->val[idx] = 0.0f;
-				n->ctrl[idx] = 0;
-				n->inv[idx] = 0;
-			}
-			break;
-		case PERIODKEY:
-		case PADPERIOD:
-			if (n->flag & NUM_NO_FRACTION)
-				return 0;
-
-			switch (n->ctrl[idx])
-			{
-			case 0:
-			case 1:
-				n->ctrl[idx] = 10;
-				break;
-			case -1:
-				n->ctrl[idx] = -10;
-			}
-			break;
-		case PADMINUS:
-			if(event->alt)
+			case BACKSPACEKEY:
+				if (n->ctrl[idx] == 0) {
+					n->val[0]       =
+					    n->val[1]   =
+					    n->val[2]   = 0.0f;
+					n->ctrl[0]      =
+					    n->ctrl[1]  =
+					    n->ctrl[2]  = 0;
+					n->inv[0]       =
+					    n->inv[1]   =
+					    n->inv[2]   = 0;
+				}
+				else {
+					n->val[idx] = 0.0f;
+					n->ctrl[idx] = 0;
+					n->inv[idx] = 0;
+				}
 				break;
-		case MINUSKEY:
-			if (n->flag & NUM_NO_NEGATIVE)
+			case PERIODKEY:
+			case PADPERIOD:
+				if (n->flag & NUM_NO_FRACTION)
+					return 0;
+
+				switch (n->ctrl[idx])
+				{
+					case 0:
+					case 1:
+						n->ctrl[idx] = 10;
+						break;
+					case -1:
+						n->ctrl[idx] = -10;
+				}
 				break;
+			case PADMINUS:
+				if (event->alt)
+					break;
+			case MINUSKEY:
+				if (n->flag & NUM_NO_NEGATIVE)
+					break;
 
-			if (n->ctrl[idx]) {
-				n->ctrl[idx] *= -1;
-				n->val[idx] *= -1;
-			}
-			else
-				n->ctrl[idx] = -1;
-			break;
-		case PADSLASHKEY:
-		case SLASHKEY:
-			if (n->flag & NUM_NO_FRACTION)
-				return 0;
+				if (n->ctrl[idx]) {
+					n->ctrl[idx] *= -1;
+					n->val[idx] *= -1;
+				}
+				else
+					n->ctrl[idx] = -1;
+				break;
+			case PADSLASHKEY:
+			case SLASHKEY:
+				if (n->flag & NUM_NO_FRACTION)
+					return 0;
 
-			n->inv[idx] = !n->inv[idx];
-			break;
-		case TABKEY:
-			if (idx_max == 0)
-				return 0;
+				n->inv[idx] = !n->inv[idx];
+				break;
+			case TABKEY:
+				if (idx_max == 0)
+					return 0;
 
-			idx++;
-			if (idx > idx_max)
-				idx = 0;
-			n->idx = idx;
-			break;
-		case PAD9:
-		case NINEKEY:
-			Val += 1.0f;
-		case PAD8:
-		case EIGHTKEY:
-			Val += 1.0f;
-		case PAD7:
-		case SEVENKEY:
-			Val += 1.0f;
-		case PAD6:
-		case SIXKEY:
-			Val += 1.0f;
-		case PAD5:
-		case FIVEKEY:
-			Val += 1.0f;
-		case PAD4:
-		case FOURKEY:
-			Val += 1.0f;
-		case PAD3:
-		case THREEKEY:
-			Val += 1.0f;
-		case PAD2:
-		case TWOKEY:
-			Val += 1.0f;
-		case PAD1:
-		case ONEKEY:
-			Val += 1.0f;
-		case PAD0:
-		case ZEROKEY:
-			if (!n->ctrl[idx])
-				n->ctrl[idx] = 1;
+				idx++;
+				if (idx > idx_max)
+					idx = 0;
+				n->idx = idx;
+				break;
+			case PAD9:
+			case NINEKEY:
+				Val += 1.0f;
+			case PAD8:
+			case EIGHTKEY:
+				Val += 1.0f;
+			case PAD7:
+			case SEVENKEY:
+				Val += 1.0f;
+			case PAD6:
+			case SIXKEY:
+				Val += 1.0f;
+			case PAD5:
+			case FIVEKEY:
+				Val += 1.0f;
+			case PAD4:
+			case FOURKEY:
+				Val += 1.0f;
+			case PAD3:
+			case THREEKEY:
+				Val += 1.0f;
+			case PAD2:
+			case TWOKEY:
+				Val += 1.0f;
+			case PAD1:
+			case ONEKEY:
+				Val += 1.0f;
+			case PAD0:
+			case ZEROKEY:
+				if (!n->ctrl[idx])
+					n->ctrl[idx] = 1;
 
-			if (fabsf(n->val[idx]) > 9999999.0f);
-			else if (n->ctrl[idx] == 1) {
-				n->val[idx] *= 10;
-				n->val[idx] += Val;
-			}
-			else if (n->ctrl[idx] == -1) {
-				n->val[idx] *= 10;
-				n->val[idx] -= Val;
-			}
-			else {
-				/* float resolution breaks when over six digits after comma */
-				if( ABS(n->ctrl[idx]) < 10000000) {
-					n->val[idx] += Val / (float)n->ctrl[idx];
-					n->ctrl[idx] *= 10;
+				if (fabsf(n->val[idx]) > 9999999.0f) ;
+				else if (n->ctrl[idx] == 1) {
+					n->val[idx] *= 10;
+					n->val[idx] += Val;
 				}
-			}
-			break;
-		default:
-			return 0;
+				else if (n->ctrl[idx] == -1) {
+					n->val[idx] *= 10;
+					n->val[idx] -= Val;
+				}
+				else {
+					/* float resolution breaks when over six digits after comma */
+					if (ABS(n->ctrl[idx]) < 10000000) {
+						n->val[idx] += Val / (float)n->ctrl[idx];
+						n->ctrl[idx] *= 10;
+					}
+				}
+				break;
+			default:
+				return 0;
 		}
 	}
 	
diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c
index 4fb9f91..a43d549 100644
--- a/source/blender/editors/util/undo.c
+++ b/source/blender/editors/util/undo.c
@@ -37,13 +37,15 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "DNA_mesh_types.h"
 #include "DNA_object_types.h"
 
 #include "BLI_blenlib.h"
-#include "BLI_editVert.h"
 #include "BLI_dynstr.h"
 #include "BLI_utildefines.h"
 
+#include "BLF_translation.h"
+
 #include "BKE_blender.h"
 #include "BKE_context.h"
 #include "BKE_global.h"
@@ -78,52 +80,52 @@
 
 void ED_undo_push(bContext *C, const char *str)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
-	Object *obedit= CTX_data_edit_object(C);
-	Object *obact= CTX_data_active_object(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
+	Object *obedit = CTX_data_edit_object(C);
+	Object *obact = CTX_data_active_object(C);
 
-	if (G.f & G_DEBUG)
+	if (G.debug & G_DEBUG)
 		printf("undo push %s\n", str);
 	
-	if(obedit) {
+	if (obedit) {
 		if (U.undosteps == 0) return;
 		
-		if(obedit->type==OB_MESH)
+		if (obedit->type == OB_MESH)
 			undo_push_mesh(C, str);
-		else if ELEM(obedit->type, OB_CURVE, OB_SURF)
+		else if (ELEM(obedit->type, OB_CURVE, OB_SURF))
 			undo_push_curve(C, str);
-		else if (obedit->type==OB_FONT)
+		else if (obedit->type == OB_FONT)
 			undo_push_font(C, str);
-		else if (obedit->type==OB_MBALL)
+		else if (obedit->type == OB_MBALL)
 			undo_push_mball(C, str);
-		else if (obedit->type==OB_LATTICE)
+		else if (obedit->type == OB_LATTICE)
 			undo_push_lattice(C, str);
-		else if (obedit->type==OB_ARMATURE)
+		else if (obedit->type == OB_ARMATURE)
 			undo_push_armature(C, str);
 	}
-	else if(obact && obact->mode & OB_MODE_PARTICLE_EDIT) {
+	else if (obact && obact->mode & OB_MODE_PARTICLE_EDIT) {
 		if (U.undosteps == 0) return;
 		
 		PE_undo_push(CTX_data_scene(C), str);
 	}
 	else {
-		if(U.uiflag & USER_GLOBALUNDO) 
+		if (U.uiflag & USER_GLOBALUNDO) 
 			BKE_write_undo(C, str);
 	}
 	
-	if(wm->file_saved) {
-		wm->file_saved= 0;
+	if (wm->file_saved) {
+		wm->file_saved = 0;
 		/* notifier that data changed, for save-over warning or header */
-		WM_event_add_notifier(C, NC_WM|ND_DATACHANGED, NULL);
+		WM_event_add_notifier(C, NC_WM | ND_DATACHANGED, NULL);
 	}
 }
 
 /* note: also check undo_history_exec() in bottom if you change notifiers */
 static int ed_undo_step(bContext *C, int step, const char *undoname)
 {	
-	Object *obedit= CTX_data_edit_object(C);
-	Object *obact= CTX_data_active_object(C);
-	ScrArea *sa= CTX_wm_area(C);
+	Object *obedit = CTX_data_edit_object(C);
+	Object *obact = CTX_data_active_object(C);
+	ScrArea *sa = CTX_wm_area(C);
 
 	/* undo during jobs are running can easily lead to freeing data using by jobs,
 	 * or they can just lead to freezing job in some other cases */
@@ -132,16 +134,16 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
 	}
 
 	/* grease pencil can be can be used in plenty of spaces, so check it first */
-	if(ED_gpencil_session_active()) {
+	if (ED_gpencil_session_active()) {
 		return ED_undo_gpencil_step(C, step, undoname);
 	}
 
-	if(sa && sa->spacetype==SPACE_IMAGE) {
-		SpaceImage *sima= (SpaceImage *)sa->spacedata.first;
+	if (sa && sa->spacetype == SPACE_IMAGE) {
+		SpaceImage *sima = (SpaceImage *)sa->spacedata.first;
 		
-		if((obact && obact->mode & OB_MODE_TEXTURE_PAINT) || sima->flag & SI_DRAWTOOL) {
-			if(!ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step, undoname) && undoname)
-				if(U.uiflag & USER_GLOBALUNDO)
+		if ((obact && obact->mode & OB_MODE_TEXTURE_PAINT) || sima->flag & SI_DRAWTOOL) {
+			if (!ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step, undoname) && undoname)
+				if (U.uiflag & USER_GLOBALUNDO)
 					BKE_undo_name(C, undoname);
 
 			WM_event_add_notifier(C, NC_WINDOW, NULL);
@@ -149,52 +151,52 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
 		}
 	}
 
-	if(sa && sa->spacetype==SPACE_TEXT) {
+	if (sa && sa->spacetype == SPACE_TEXT) {
 		ED_text_undo_step(C, step);
 	}
-	else if(obedit) {
-		if ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE) {
-			if(undoname)
+	else if (obedit) {
+		if (ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE)) {
+			if (undoname)
 				undo_editmode_name(C, undoname);
 			else
 				undo_editmode_step(C, step);
 
-			WM_event_add_notifier(C, NC_GEOM|ND_DATA, NULL);
+			WM_event_add_notifier(C, NC_GEOM | ND_DATA, NULL);
 		}
 	}
 	else {
-		int do_glob_undo= 0;
+		int do_glob_undo = 0;
 		
-		if(obact && obact->mode & OB_MODE_TEXTURE_PAINT) {
-			if(!ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step, undoname))
-				do_glob_undo= 1;
+		if (obact && obact->mode & OB_MODE_TEXTURE_PAINT) {
+			if (!ED_undo_paint_step(C, UNDO_PAINT_IMAGE, step, undoname))
+				do_glob_undo = 1;
 		}
-		else if(obact && obact->mode & OB_MODE_SCULPT) {
-			if(!ED_undo_paint_step(C, UNDO_PAINT_MESH, step, undoname))
-				do_glob_undo= 1;
+		else if (obact && obact->mode & OB_MODE_SCULPT) {
+			if (!ED_undo_paint_step(C, UNDO_PAINT_MESH, step, undoname))
+				do_glob_undo = 1;
 		}
-		else if(obact && obact->mode & OB_MODE_PARTICLE_EDIT) {
-			if(step==1)
+		else if (obact && obact->mode & OB_MODE_PARTICLE_EDIT) {
+			if (step == 1)
 				PE_undo(CTX_data_scene(C));
 			else
 				PE_redo(CTX_data_scene(C));
 		}
 		else {
-			do_glob_undo= 1;
+			do_glob_undo = 1;
 		}
 		
-		if(do_glob_undo) {
-			if(U.uiflag & USER_GLOBALUNDO) {
+		if (do_glob_undo) {
+			if (U.uiflag & USER_GLOBALUNDO) {
 				// note python defines not valid here anymore.
 				//#ifdef WITH_PYTHON
 				// XXX		BPY_scripts_clear_pyobjects();
 				//#endif
-				if(undoname)
+				if (undoname)
 					BKE_undo_name(C, undoname);
 				else
 					BKE_undo_step(C, step);
 
-				WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, CTX_data_scene(C));
+				WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, CTX_data_scene(C));
 			}
 			
 		}
@@ -229,23 +231,23 @@ void ED_undo_pop_op(bContext *C, wmOperator *op)
 /* name optionally, function used to check for operator redo panel */
 int ED_undo_valid(const bContext *C, const char *undoname)
 {
-	Object *obedit= CTX_data_edit_object(C);
-	Object *obact= CTX_data_active_object(C);
-	ScrArea *sa= CTX_wm_area(C);
+	Object *obedit = CTX_data_edit_object(C);
+	Object *obact = CTX_data_active_object(C);
+	ScrArea *sa = CTX_wm_area(C);
 	
-	if(sa && sa->spacetype==SPACE_IMAGE) {
-		SpaceImage *sima= (SpaceImage *)sa->spacedata.first;
+	if (sa && sa->spacetype == SPACE_IMAGE) {
+		SpaceImage *sima = (SpaceImage *)sa->spacedata.first;
 		
-		if((obact && obact->mode & OB_MODE_TEXTURE_PAINT) || sima->flag & SI_DRAWTOOL) {
+		if ((obact && obact->mode & OB_MODE_TEXTURE_PAINT) || sima->flag & SI_DRAWTOOL) {
 			return 1;
 		}
 	}
 	
-	if(sa && sa->spacetype==SPACE_TEXT) {
+	if (sa && sa->spacetype == SPACE_TEXT) {
 		return 1;
 	}
-	else if(obedit) {
-		if ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE) {
+	else if (obedit) {
+		if (ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE)) {
 			return undo_editmode_valid(undoname);
 		}
 	}
@@ -253,19 +255,19 @@ int ED_undo_valid(const bContext *C, const char *undoname)
 		
 		/* if below tests fail, global undo gets executed */
 		
-		if(obact && obact->mode & OB_MODE_TEXTURE_PAINT) {
-			if( ED_undo_paint_valid(UNDO_PAINT_IMAGE, undoname) )
+		if (obact && obact->mode & OB_MODE_TEXTURE_PAINT) {
+			if (ED_undo_paint_valid(UNDO_PAINT_IMAGE, undoname) )
 				return 1;
 		}
-		else if(obact && obact->mode & OB_MODE_SCULPT) {
-			if( ED_undo_paint_valid(UNDO_PAINT_MESH, undoname) )
+		else if (obact && obact->mode & OB_MODE_SCULPT) {
+			if (ED_undo_paint_valid(UNDO_PAINT_MESH, undoname) )
 				return 1;
 		}
-		else if(obact && obact->mode & OB_MODE_PARTICLE_EDIT) {
+		else if (obact && obact->mode & OB_MODE_PARTICLE_EDIT) {
 			return PE_undo_valid(CTX_data_scene(C));
 		}
 		
-		if(U.uiflag & USER_GLOBALUNDO) {
+		if (U.uiflag & USER_GLOBALUNDO) {
 			return BKE_undo_valid(undoname);
 		}
 	}
@@ -298,26 +300,26 @@ static int ed_redo_exec(bContext *C, wmOperator *UNUSED(op))
 void ED_OT_undo(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Undo";
-	ot->description= "Undo previous action";
-	ot->idname= "ED_OT_undo";
+	ot->name = "Undo";
+	ot->description = "Undo previous action";
+	ot->idname = "ED_OT_undo";
 	
 	/* api callbacks */
-	ot->exec= ed_undo_exec;
-	ot->poll= ED_operator_screenactive;
+	ot->exec = ed_undo_exec;
+	ot->poll = ED_operator_screenactive;
 }
 
 void ED_OT_undo_push(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Undo Push";
-	ot->description= "Add an undo state (internal use only)";
-	ot->idname= "ED_OT_undo_push";
+	ot->name = "Undo Push";
+	ot->description = "Add an undo state (internal use only)";
+	ot->idname = "ED_OT_undo_push";
 	
 	/* api callbacks */
-	ot->exec= ed_undo_push_exec;
+	ot->exec = ed_undo_push_exec;
 
-	ot->flag= OPTYPE_INTERNAL;
+	ot->flag = OPTYPE_INTERNAL;
 
 	RNA_def_string(ot->srna, "message", "Add an undo step *function may be moved*", MAXUNDONAME, "Undo Message", "");
 }
@@ -325,29 +327,29 @@ void ED_OT_undo_push(wmOperatorType *ot)
 void ED_OT_redo(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Redo";
-	ot->description= "Redo previous action";
-	ot->idname= "ED_OT_redo";
+	ot->name = "Redo";
+	ot->description = "Redo previous action";
+	ot->idname = "ED_OT_redo";
 	
 	/* api callbacks */
-	ot->exec= ed_redo_exec;
-	ot->poll= ED_operator_screenactive;
+	ot->exec = ed_redo_exec;
+	ot->poll = ED_operator_screenactive;
 }
 
 
 /* ui callbacks should call this rather than calling WM_operator_repeat() themselves */
 int ED_undo_operator_repeat(bContext *C, struct wmOperator *op)
 {
-	int ret= 0;
+	int ret = 0;
 
-	if(op) {
-		wmWindowManager *wm= CTX_wm_manager(C);
-		struct Scene *scene= CTX_data_scene(C);
+	if (op) {
+		wmWindowManager *wm = CTX_wm_manager(C);
+		struct Scene *scene = CTX_data_scene(C);
 
-		ARegion *ar= CTX_wm_region(C);
-		ARegion *ar1= BKE_area_find_region_type(CTX_wm_area(C), RGN_TYPE_WINDOW);
+		ARegion *ar = CTX_wm_region(C);
+		ARegion *ar1 = BKE_area_find_region_type(CTX_wm_area(C), RGN_TYPE_WINDOW);
 
-		if(ar1)
+		if (ar1)
 			CTX_wm_region_set(C, ar1);
 
 		if ( (WM_operator_repeat_check(C, op)) &&
@@ -361,26 +363,26 @@ int ED_undo_operator_repeat(bContext *C, struct wmOperator *op)
 		{
 			int retval;
 
-			if (G.f & G_DEBUG)
+			if (G.debug & G_DEBUG)
 				printf("redo_cb: operator redo %s\n", op->type->name);
 			ED_undo_pop_op(C, op);
 
-			if(op->type->check) {
+			if (op->type->check) {
 				op->type->check(C, op); /* ignore return value since its running again anyway */
 			}
 
-			retval= WM_operator_repeat(C, op);
-			if((retval & OPERATOR_FINISHED)==0) {
-				if (G.f & G_DEBUG)
+			retval = WM_operator_repeat(C, op);
+			if ((retval & OPERATOR_FINISHED) == 0) {
+				if (G.debug & G_DEBUG)
 					printf("redo_cb: operator redo failed: %s, return %d\n", op->type->name, retval);
 				ED_undo_redo(C);
 			}
 			else {
-				ret= 1;
+				ret = 1;
 			}
 		}
 		else {
-			if (G.f & G_DEBUG) {
+			if (G.debug & G_DEBUG) {
 				printf("redo_cb: WM_operator_repeat_check returned false %s\n", op->type->name);
 			}
 		}
@@ -389,7 +391,7 @@ int ED_undo_operator_repeat(bContext *C, struct wmOperator *op)
 		CTX_wm_region_set(C, ar);
 	}
 	else {
-		if (G.f & G_DEBUG) {
+		if (G.debug & G_DEBUG) {
 			printf("redo_cb: ED_undo_operator_repeat called with NULL 'op'\n");
 		}
 	}
@@ -411,25 +413,25 @@ void ED_undo_operator_repeat_cb_evt(bContext *C, void *arg_op, int UNUSED(arg_ev
 
 /* ************************** */
 
-#define UNDOSYSTEM_GLOBAL	1
-#define UNDOSYSTEM_EDITMODE	2
-#define UNDOSYSTEM_PARTICLE	3
+#define UNDOSYSTEM_GLOBAL   1
+#define UNDOSYSTEM_EDITMODE 2
+#define UNDOSYSTEM_PARTICLE 3
 
 static int get_undo_system(bContext *C)
 {
-	Object *obedit= CTX_data_edit_object(C);
+	Object *obedit = CTX_data_edit_object(C);
 	
 	/* find out which undo system */
-	if(obedit) {
+	if (obedit) {
 		if (ELEM7(obedit->type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE))
 			return UNDOSYSTEM_EDITMODE;
 	}
 	else {
-		Object *obact= CTX_data_active_object(C);
+		Object *obact = CTX_data_active_object(C);
 		
-		if(obact && obact->mode & OB_MODE_PARTICLE_EDIT)
+		if (obact && obact->mode & OB_MODE_PARTICLE_EDIT)
 			return UNDOSYSTEM_PARTICLE;
-		else if(U.uiflag & USER_GLOBALUNDO)
+		else if (U.uiflag & USER_GLOBALUNDO)
 			return UNDOSYSTEM_GLOBAL;
 	}
 	
@@ -439,29 +441,31 @@ static int get_undo_system(bContext *C)
 /* create enum based on undo items */
 static EnumPropertyItem *rna_undo_itemf(bContext *C, int undosys, int *totitem)
 {
-	EnumPropertyItem item_tmp= {0}, *item= NULL;
-	int active, i= 0;
+	EnumPropertyItem item_tmp = {0}, *item = NULL;
+	int active, i = 0;
 	
-	while(TRUE) {
-		const char *name= NULL;
+	while (TRUE) {
+		const char *name = NULL;
 		
-		if(undosys==UNDOSYSTEM_PARTICLE) {
-			name= PE_undo_get_name(CTX_data_scene(C), i, &active);
+		if (undosys == UNDOSYSTEM_PARTICLE) {
+			name = PE_undo_get_name(CTX_data_scene(C), i, &active);
 		}
-		else if(undosys==UNDOSYSTEM_EDITMODE) {
-			name= undo_editmode_get_name(C, i, &active);
+		else if (undosys == UNDOSYSTEM_EDITMODE) {
+			name = undo_editmode_get_name(C, i, &active);
 		}
 		else {
-			name= BKE_undo_get_name(i, &active);
+			name = BKE_undo_get_name(i, &active);
 		}
 		
-		if(name) {
-			item_tmp.identifier= item_tmp.name= name;
-			if(active)
-				item_tmp.icon= ICON_RESTRICT_VIEW_OFF;
+		if (name) {
+			item_tmp.identifier = name;
+			/* XXX This won't work with non-default contexts (e.g. operators) :/ */
+			item_tmp.name = IFACE_(name);
+			if (active)
+				item_tmp.icon = ICON_RESTRICT_VIEW_OFF;
 			else 
-				item_tmp.icon= ICON_NONE;
-			item_tmp.value= i++;
+				item_tmp.icon = ICON_NONE;
+			item_tmp.value = i++;
 			RNA_enum_item_add(&item, totitem, &item_tmp);
 		}
 		else
@@ -476,23 +480,23 @@ static EnumPropertyItem *rna_undo_itemf(bContext *C, int undosys, int *totitem)
 
 static int undo_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	int undosys, totitem= 0;
+	int undosys, totitem = 0;
 	
-	undosys= get_undo_system(C);
+	undosys = get_undo_system(C);
 	
-	if(undosys) {
-		EnumPropertyItem *item= rna_undo_itemf(C, undosys, &totitem);
+	if (undosys) {
+		EnumPropertyItem *item = rna_undo_itemf(C, undosys, &totitem);
 		
-		if(totitem > 0) {
-			uiPopupMenu *pup= uiPupMenuBegin(C, op->type->name, ICON_NONE);
-			uiLayout *layout= uiPupMenuLayout(pup);
-			uiLayout *split= uiLayoutSplit(layout, 0, 0), *column = NULL;
+		if (totitem > 0) {
+			uiPopupMenu *pup = uiPupMenuBegin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE);
+			uiLayout *layout = uiPupMenuLayout(pup);
+			uiLayout *split = uiLayoutSplit(layout, 0, 0), *column = NULL;
 			int i, c;
 			
-			for(c=0, i=totitem-1; i >= 0; i--, c++) {
-				if( (c % 20)==0 )
-					column= uiLayoutColumn(split, 0);
-				if(item[i].identifier)
+			for (c = 0, i = totitem - 1; i >= 0; i--, c++) {
+				if ( (c % 20) == 0)
+					column = uiLayoutColumn(split, 0);
+				if (item[i].identifier)
 					uiItemIntO(column, item[i].name, item[i].icon, op->type->idname, "item", item[i].value);
 				
 			}
@@ -509,20 +513,20 @@ static int undo_history_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
 /* note: also check ed_undo_step() in top if you change notifiers */
 static int undo_history_exec(bContext *C, wmOperator *op)
 {
-	if(RNA_struct_property_is_set(op->ptr, "item")) {
-		int undosys= get_undo_system(C);
-		int item= RNA_int_get(op->ptr, "item");
+	if (RNA_struct_property_is_set(op->ptr, "item")) {
+		int undosys = get_undo_system(C);
+		int item = RNA_int_get(op->ptr, "item");
 		
-		if(undosys==UNDOSYSTEM_PARTICLE) {
+		if (undosys == UNDOSYSTEM_PARTICLE) {
 			PE_undo_number(CTX_data_scene(C), item);
 		}
-		else if(undosys==UNDOSYSTEM_EDITMODE) {
-			undo_editmode_number(C, item+1);
-			WM_event_add_notifier(C, NC_GEOM|ND_DATA, NULL);
+		else if (undosys == UNDOSYSTEM_EDITMODE) {
+			undo_editmode_number(C, item + 1);
+			WM_event_add_notifier(C, NC_GEOM | ND_DATA, NULL);
 		}
 		else {
 			BKE_undo_number(C, item);
-			WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, CTX_data_scene(C));
+			WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, CTX_data_scene(C));
 		}
 		WM_event_add_notifier(C, NC_WINDOW, NULL);
 		
@@ -534,14 +538,14 @@ static int undo_history_exec(bContext *C, wmOperator *op)
 void ED_OT_undo_history(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Undo History";
-	ot->description= "Redo specific action in history";
-	ot->idname= "ED_OT_undo_history";
+	ot->name = "Undo History";
+	ot->description = "Redo specific action in history";
+	ot->idname = "ED_OT_undo_history";
 	
 	/* api callbacks */
-	ot->invoke= undo_history_invoke;
-	ot->exec= undo_history_exec;
-	ot->poll= ED_operator_screenactive;
+	ot->invoke = undo_history_invoke;
+	ot->exec = undo_history_exec;
+	ot->poll = ED_operator_screenactive;
 	
 	RNA_def_int(ot->srna, "item", 0, 0, INT_MAX, "Item", "", 0, INT_MAX);
 
diff --git a/source/blender/editors/util/util_intern.h b/source/blender/editors/util/util_intern.h
index c6e2d07..d366ad7 100644
--- a/source/blender/editors/util/util_intern.h
+++ b/source/blender/editors/util/util_intern.h
@@ -29,8 +29,8 @@
  */
 
 
-#ifndef ED_UTIL_INTERN_H
-#define ED_UTIL_INTERN_H
+#ifndef __UTIL_INTERN_H__
+#define __UTIL_INTERN_H__
 
 /* internal exports only */
 
@@ -42,5 +42,5 @@ void	*undo_editmode_get_prev		(struct Object *ob);
 void	undo_editmode_step			(struct bContext *C, int step);
 void	undo_editmode_number		(struct bContext *C, int nr);
 
-#endif /* ED_UTIL_INTERN_H */
+#endif /* __UTIL_INTERN_H__ */
 
diff --git a/source/blender/editors/uvedit/CMakeLists.txt b/source/blender/editors/uvedit/CMakeLists.txt
index a747c2a..1c69e56 100644
--- a/source/blender/editors/uvedit/CMakeLists.txt
+++ b/source/blender/editors/uvedit/CMakeLists.txt
@@ -23,6 +23,7 @@ set(INC
 	../../blenkernel
 	../../blenlib
 	../../blenloader
+	../../bmesh
 	../../makesdna
 	../../makesrna
 	../../windowmanager
diff --git a/source/blender/editors/uvedit/SConscript b/source/blender/editors/uvedit/SConscript
index 2523de0..d236b18 100644
--- a/source/blender/editors/uvedit/SConscript
+++ b/source/blender/editors/uvedit/SConscript
@@ -5,6 +5,6 @@ sources = env.Glob('*.c')
 
 incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
 incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
-incs += ' ../../makesrna #/intern/opennl/extern ../../gpu ../../blenloader'
+incs += ' ../../bmesh ../../makesrna #/intern/opennl/extern ../../gpu ../../blenloader'
 
 env.BlenderLib ( 'bf_editors_uvedit', sources, Split(incs), [], libtype=['core'], priority=[45] )
diff --git a/source/blender/editors/uvedit/uvedit_buttons.c b/source/blender/editors/uvedit/uvedit_buttons.c
index a6712bf..ec645f8 100644
--- a/source/blender/editors/uvedit/uvedit_buttons.c
+++ b/source/blender/editors/uvedit/uvedit_buttons.c
@@ -32,6 +32,7 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
@@ -40,13 +41,13 @@
 
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
-#include "BLI_editVert.h"
 #include "BLI_utildefines.h"
 
 #include "BKE_context.h"
 #include "BKE_customdata.h"
 #include "BKE_mesh.h"
 #include "BKE_screen.h"
+#include "BKE_tessmesh.h"
 
 #include "ED_image.h"
 #include "ED_uvedit.h"
@@ -57,42 +58,35 @@
 #include "WM_api.h"
 #include "WM_types.h"
 
-#define B_UVEDIT_VERTEX		3
+#define B_UVEDIT_VERTEX     3
 
 /* UV Utilities */
 
-static int uvedit_center(Scene *scene, EditMesh *em, Image *ima, float center[2])
+static int uvedit_center(Scene *scene, BMEditMesh *em, Image *ima, float center[2])
 {
-	EditFace *efa;
-	MTFace *tf;
-	int tot= 0;
-
+	BMFace *f;
+	BMLoop *l;
+	BMIter iter, liter;
+	MTexPoly *tf;
+	MLoopUV *luv;
+	int tot = 0.0;
+	
 	zero_v2(center);
-
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
-		if(uvedit_face_visible(scene, ima, efa, tf)) {
-			if(uvedit_uv_selected(scene, efa, tf, 0)) {
-				add_v2_v2(center, tf->uv[0]);
-				tot++;
-			}
-			if(uvedit_uv_selected(scene, efa, tf, 1)) {
-				add_v2_v2(center, tf->uv[1]);
-				tot++;
-			}
-			if(uvedit_uv_selected(scene, efa, tf, 2)) {
-				add_v2_v2(center, tf->uv[2]);
-				tot++;
-			}
-			if(efa->v4 && uvedit_uv_selected(scene, efa, tf, 3)) {
-				add_v2_v2(center, tf->uv[3]);
+	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)) {
+				add_v2_v2(center, luv->uv);
 				tot++;
 			}
 		}
 	}
 
-	if(tot > 0) {
+	if (tot > 0) {
 		center[0] /= tot;
 		center[1] /= tot;
 	}
@@ -100,23 +94,19 @@ static int uvedit_center(Scene *scene, EditMesh *em, Image *ima, float center[2]
 	return tot;
 }
 
-static void uvedit_translate(Scene *scene, EditMesh *em, Image *ima, float delta[2])
+static void uvedit_translate(Scene *scene, BMEditMesh *em, Image *UNUSED(ima), float delta[2])
 {
-	EditFace *efa;
-	MTFace *tf;
-
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
-		if(uvedit_face_visible(scene, ima, efa, tf)) {
-			if(uvedit_uv_selected(scene, efa, tf, 0))
-				add_v2_v2(tf->uv[0], delta);
-			if(uvedit_uv_selected(scene, efa, tf, 1))
-				add_v2_v2(tf->uv[1], delta);
-			if(uvedit_uv_selected(scene, efa, tf, 2))
-				add_v2_v2(tf->uv[2], delta);
-			if(efa->v4 && uvedit_uv_selected(scene, efa, tf, 3))
-				add_v2_v2(tf->uv[3], delta);
+	BMFace *f;
+	BMLoop *l;
+	BMIter iter, liter;
+	MLoopUV *luv;
+	
+	BM_ITER_MESH (f, &iter, em->bm, BM_FACES_OF_MESH) {
+		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)) {
+				add_v2_v2(luv->uv, delta);
+			}
 		}
 	}
 }
@@ -127,75 +117,71 @@ static float uvedit_old_center[2];
 
 static void uvedit_vertex_buttons(const bContext *C, uiBlock *block)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	Scene *scene= CTX_data_scene(C);
-	Object *obedit= CTX_data_edit_object(C);
-	Image *ima= sima->image;
+	SpaceImage *sima = CTX_wm_space_image(C);
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit = CTX_data_edit_object(C);
+	Image *ima = sima->image;
+	BMEditMesh *em;
 	float center[2];
 	int imx, imy, step, digits;
-	EditMesh *em;
 
 	ED_space_image_size(sima, &imx, &imy);
 	
-	em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
+	em = BMEdit_FromObject(obedit);
 
-	if(uvedit_center(scene, em, ima, center)) {
+	if (uvedit_center(scene, em, ima, center)) {
 		copy_v2_v2(uvedit_old_center, center);
 
-		if(!(sima->flag & SI_COORDFLOATS)) {
+		if (!(sima->flag & SI_COORDFLOATS)) {
 			uvedit_old_center[0] *= imx;
 			uvedit_old_center[1] *= imy;
 		}
 
-		if(sima->flag & SI_COORDFLOATS) {
-			step= 1;
-			digits= 3;
+		if (sima->flag & SI_COORDFLOATS) {
+			step = 1;
+			digits = 3;
 		}
 		else {
-			step= 100;
-			digits= 2;
+			step = 100;
+			digits = 2;
 		}
 		
 		uiBlockBeginAlign(block);
-		uiDefButF(block, NUM, B_UVEDIT_VERTEX, "X:",	10, 10, 145, 19, &uvedit_old_center[0], -10*imx, 10.0*imx, step, digits, "");
-		uiDefButF(block, NUM, B_UVEDIT_VERTEX, "Y:",	165, 10, 145, 19, &uvedit_old_center[1], -10*imy, 10.0*imy, step, digits, "");
+		uiDefButF(block, NUM, B_UVEDIT_VERTEX, "X:",    10, 10, 145, 19, &uvedit_old_center[0], -10 * imx, 10.0 * imx, step, digits, "");
+		uiDefButF(block, NUM, B_UVEDIT_VERTEX, "Y:",    165, 10, 145, 19, &uvedit_old_center[1], -10 * imy, 10.0 * imy, step, digits, "");
 		uiBlockEndAlign(block);
 	}
-
-	BKE_mesh_end_editmesh(obedit->data, em);
 }
 
 static void do_uvedit_vertex(bContext *C, void *UNUSED(arg), int event)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	Scene *scene= CTX_data_scene(C);
-	Object *obedit= CTX_data_edit_object(C);
-	Image *ima= sima->image;
-	EditMesh *em;
+	SpaceImage *sima = CTX_wm_space_image(C);
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit = CTX_data_edit_object(C);
+	Image *ima = sima->image;
+	BMEditMesh *em;
 	float center[2], delta[2];
 	int imx, imy;
 
-	if(event != B_UVEDIT_VERTEX)
+	if (event != B_UVEDIT_VERTEX)
 		return;
 
-	em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
+	em = BMEdit_FromObject(obedit);
 
 	ED_space_image_size(sima, &imx, &imy);
 	uvedit_center(scene, em, ima, center);
 
-	if(sima->flag & SI_COORDFLOATS) {
-		delta[0]= uvedit_old_center[0] - center[0];
-		delta[1]= uvedit_old_center[1] - center[1];
+	if (sima->flag & SI_COORDFLOATS) {
+		delta[0] = uvedit_old_center[0] - center[0];
+		delta[1] = uvedit_old_center[1] - center[1];
 	}
 	else {
-		delta[0]= uvedit_old_center[0]/imx - center[0];
-		delta[1]= uvedit_old_center[1]/imy - center[1];
+		delta[0] = uvedit_old_center[0] / imx - center[0];
+		delta[1] = uvedit_old_center[1] / imy - center[1];
 	}
 
 	uvedit_translate(scene, em, ima, delta);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
-
 	WM_event_add_notifier(C, NC_IMAGE, sima->image);
 }
 
@@ -203,7 +189,7 @@ static void do_uvedit_vertex(bContext *C, void *UNUSED(arg), int event)
 
 static int image_panel_uv_poll(const bContext *C, PanelType *UNUSED(pt))
 {
-	Object *obedit= CTX_data_edit_object(C);
+	Object *obedit = CTX_data_edit_object(C);
 	return ED_uvedit_test(obedit);
 }
 
@@ -211,7 +197,7 @@ static void image_panel_uv(const bContext *C, Panel *pa)
 {
 	uiBlock *block;
 	
-	block= uiLayoutAbsoluteBlock(pa->layout);
+	block = uiLayoutAbsoluteBlock(pa->layout);
 	uiBlockSetHandleFunc(block, do_uvedit_vertex, NULL);
 
 	uvedit_vertex_buttons(C, block);
@@ -221,11 +207,11 @@ void ED_uvedit_buttons_register(ARegionType *art)
 {
 	PanelType *pt;
 
-	pt= MEM_callocN(sizeof(PanelType), "spacetype image panel uv");
+	pt = MEM_callocN(sizeof(PanelType), "spacetype image panel uv");
 	strcpy(pt->idname, "IMAGE_PT_uv");
 	strcpy(pt->label, "UV Vertex");
-	pt->draw= image_panel_uv;
-	pt->poll= image_panel_uv_poll;
+	pt->draw = image_panel_uv;
+	pt->poll = image_panel_uv_poll;
 	BLI_addtail(&art->paneltypes, pt);
 }
 
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index 6ced91f..e772ff5 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -31,7 +31,11 @@
 #include <float.h>
 #include <math.h>
 #include <stdlib.h>
+#include <string.h>
 
+#include "MEM_guardedalloc.h"
+
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
@@ -39,12 +43,13 @@
 #include "DNA_space_types.h"
 
 #include "BLI_math.h"
-#include "BLI_editVert.h"
 #include "BLI_utildefines.h"
 
 #include "BKE_DerivedMesh.h"
 #include "BKE_mesh.h"
+#include "BKE_tessmesh.h"
 
+#include "BLI_array.h"
 
 #include "BIF_gl.h"
 #include "BIF_glutil.h"
@@ -66,37 +71,37 @@ static void drawcursor_sima(SpaceImage *sima, ARegion *ar)
 	ED_space_image_size(sima, &width, &height);
 	ED_space_image_zoom(sima, ar, &zoomx, &zoomy);
 
-	w= zoomx*width/256.0f;
-	h= zoomy*height/256.0f;
+	w = zoomx * width / 256.0f;
+	h = zoomy * height / 256.0f;
 	
 	cpack(0xFFFFFF);
 	glTranslatef(sima->cursor[0], sima->cursor[1], 0.0);
-	fdrawline(-0.05f/w, 0, 0, 0.05f/h);
-	fdrawline(0, 0.05f/h, 0.05f/w, 0.0f);
-	fdrawline(0.05f/w, 0.0f, 0.0f, -0.05f/h);
-	fdrawline(0.0f, -0.05f/h, -0.05f/w, 0.0f);
+	fdrawline(-0.05f / w, 0, 0, 0.05f / h);
+	fdrawline(0, 0.05f / h, 0.05f / w, 0.0f);
+	fdrawline(0.05f / w, 0.0f, 0.0f, -0.05f / h);
+	fdrawline(0.0f, -0.05f / h, -0.05f / w, 0.0f);
 
 	setlinestyle(4);
 	cpack(0xFF);
-	fdrawline(-0.05f/w, 0.0f, 0.0f, 0.05f/h);
-	fdrawline(0.0f, 0.05f/h, 0.05f/w, 0.0f);
-	fdrawline(0.05f/w, 0.0f, 0.0f, -0.05f/h);
-	fdrawline(0.0f, -0.05f/h, -0.05f/w, 0.0f);
+	fdrawline(-0.05f / w, 0.0f, 0.0f, 0.05f / h);
+	fdrawline(0.0f, 0.05f / h, 0.05f / w, 0.0f);
+	fdrawline(0.05f / w, 0.0f, 0.0f, -0.05f / h);
+	fdrawline(0.0f, -0.05f / h, -0.05f / w, 0.0f);
 
 
 	setlinestyle(0.0f);
 	cpack(0x0);
-	fdrawline(-0.020f/w, 0.0f, -0.1f/w, 0.0f);
-	fdrawline(0.1f/w, 0.0f, 0.020f/w, 0.0f);
-	fdrawline(0.0f, -0.020f/h, 0.0f, -0.1f/h);
-	fdrawline(0.0f, 0.1f/h, 0.0f, 0.020f/h);
+	fdrawline(-0.020f / w, 0.0f, -0.1f / w, 0.0f);
+	fdrawline(0.1f / w, 0.0f, 0.020f / w, 0.0f);
+	fdrawline(0.0f, -0.020f / h, 0.0f, -0.1f / h);
+	fdrawline(0.0f, 0.1f / h, 0.0f, 0.020f / h);
 
 	setlinestyle(1);
 	cpack(0xFFFFFF);
-	fdrawline(-0.020f/w, 0.0f, -0.1f/w, 0.0f);
-	fdrawline(0.1f/w, 0.0f, 0.020f/w, 0.0f);
-	fdrawline(0.0f, -0.020f/h, 0.0f, -0.1f/h);
-	fdrawline(0.0f, 0.1f/h, 0.0f, 0.020f/h);
+	fdrawline(-0.020f / w, 0.0f, -0.1f / w, 0.0f);
+	fdrawline(0.1f / w, 0.0f, 0.020f / w, 0.0f);
+	fdrawline(0.0f, -0.020f / h, 0.0f, -0.1f / h);
+	fdrawline(0.0f, 0.1f / h, 0.0f, 0.020f / h);
 
 	glTranslatef(-sima->cursor[0], -sima->cursor[1], 0.0);
 	setlinestyle(0);
@@ -104,13 +109,13 @@ static void drawcursor_sima(SpaceImage *sima, ARegion *ar)
 
 static int draw_uvs_face_check(Scene *scene)
 {
-	ToolSettings *ts= scene->toolsettings;
+	ToolSettings *ts = scene->toolsettings;
 
 	/* checks if we are selecting only faces */
-	if(ts->uv_flag & UV_SYNC_SELECTION) {
-		if(ts->selectmode == SCE_SELECT_FACE)
+	if (ts->uv_flag & UV_SYNC_SELECTION) {
+		if (ts->selectmode == SCE_SELECT_FACE)
 			return 2;
-		else if(ts->selectmode & SCE_SELECT_FACE)
+		else if (ts->selectmode & SCE_SELECT_FACE)
 			return 1;
 		else
 			return 0;
@@ -121,34 +126,32 @@ static int draw_uvs_face_check(Scene *scene)
 
 static void draw_uvs_shadow(Object *obedit)
 {
-	EditMesh *em;
-	EditFace *efa;
-	MTFace *tf;
-	
-	em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMesh *bm = em->bm;
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	MLoopUV *luv;
 
 	/* draws the grey mesh when painting */
 	glColor3ub(112, 112, 112);
 
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
+	BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
 		glBegin(GL_LINE_LOOP);
-			glVertex2fv(tf->uv[0]);
-			glVertex2fv(tf->uv[1]);
-			glVertex2fv(tf->uv[2]);
-			if(efa->v4) glVertex2fv(tf->uv[3]);
+		BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+			luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
+
+			glVertex2fv(luv->uv);
+		}
 		glEnd();
 	}
-
-	BKE_mesh_end_editmesh(obedit->data, em);
 }
 
 static int draw_uvs_dm_shadow(DerivedMesh *dm)
 {
 	/* draw shadow mesh - this is the mesh with the modifier applied */
 
-	if(dm && dm->drawUVEdges && CustomData_has_layer(&dm->faceData, CD_MTFACE)) {
+	if (dm && dm->drawUVEdges && CustomData_has_layer(&dm->loopData, CD_MLOOPUV)) {
 		glColor3ub(112, 112, 112);
 		dm->drawUVEdges(dm);
 		return 1;
@@ -157,76 +160,114 @@ static int draw_uvs_dm_shadow(DerivedMesh *dm)
 	return 0;
 }
 
-static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFace *activetf)
+static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTexPoly *activetf)
 {
-	EditFace *efa;
-	MTFace *tf;
-	Image *ima= sima->image;
-	float aspx, aspy, col[4], tf_uv[4][2];
-	
+	BMesh *bm = em->bm;
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	MTexPoly *tf;
+	MLoopUV *luv;
+	Image *ima = sima->image;
+	BLI_array_declare(tf_uv);
+	BLI_array_declare(tf_uvorig);
+	float aspx, aspy, col[4], (*tf_uv)[2] = NULL, (*tf_uvorig)[2] = NULL;
+	int i, j, nverts;
+
 	ED_space_image_uv_aspect(sima, &aspx, &aspy);
 	
-	switch(sima->dt_uvstretch) {
+	switch (sima->dt_uvstretch) {
 		case SI_UVDT_STRETCH_AREA:
 		{
-			float totarea=0.0f, totuvarea=0.0f, areadiff, uvarea, area;
+			float totarea = 0.0f, totuvarea = 0.0f, areadiff, uvarea, area;
 			
-			for(efa= em->faces.first; efa; efa= efa->next) {
-				tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-				uv_copy_aspect(tf->uv, tf_uv, aspx, aspy);
+			BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+				tf = CustomData_bmesh_get(&bm->pdata, efa->head.data, CD_MTEXPOLY);
+				
+				BLI_array_empty(tf_uv);
+				BLI_array_empty(tf_uvorig);
+				BLI_array_growitems(tf_uv, efa->len);
+				BLI_array_growitems(tf_uvorig, efa->len);
+
+				i = 0;
+				BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+					luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
+
+					copy_v2_v2(tf_uvorig[i], luv->uv);
+
+					i++;
+				}
+
+				poly_copy_aspect(tf_uvorig, tf_uv, aspx, aspy, efa->len);
 
-				totarea += EM_face_area(efa);
+				totarea += BM_face_calc_area(efa);
 				//totuvarea += tf_area(tf, efa->v4!=0);
-				totuvarea += uv_area(tf_uv, efa->v4 != NULL);
+				totuvarea += poly_uv_area(tf_uv, efa->len);
 				
-				if(uvedit_face_visible(scene, ima, efa, tf)) {
-					efa->tmp.p = tf;
+				if (uvedit_face_visible_test(scene, ima, efa, tf)) {
+					BM_elem_flag_enable(efa, BM_ELEM_TAG);
 				}
 				else {
-					if(tf == activetf)
-						activetf= NULL;
-					efa->tmp.p = NULL;
+					if (tf == activetf)
+						activetf = NULL;
+					BM_elem_flag_disable(efa, BM_ELEM_TAG);
 				}
 			}
 			
-			if(totarea < FLT_EPSILON || totuvarea < FLT_EPSILON) {
+			if (totarea < FLT_EPSILON || totuvarea < FLT_EPSILON) {
 				col[0] = 1.0;
 				col[1] = col[2] = 0.0;
 				glColor3fv(col);
-				for(efa= em->faces.first; efa; efa= efa->next) {
-					if((tf=(MTFace *)efa->tmp.p)) {
-						glBegin(efa->v4?GL_QUADS:GL_TRIANGLES);
-							glVertex2fv(tf->uv[0]);
-							glVertex2fv(tf->uv[1]);
-							glVertex2fv(tf->uv[2]);
-							if(efa->v4) glVertex2fv(tf->uv[3]);
+				BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+					if (BM_elem_flag_test(efa, BM_ELEM_TAG)) {
+						glBegin(GL_POLYGON);
+						BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+							luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
+							glVertex2fv(luv->uv);
+						}
 						glEnd();
 					}
 				}
 			}
 			else {
-				for(efa= em->faces.first; efa; efa= efa->next) {
-					if((tf=(MTFace *)efa->tmp.p)) {
-						area = EM_face_area(efa) / totarea;
-						uv_copy_aspect(tf->uv, tf_uv, aspx, aspy);
+				BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+					if (BM_elem_flag_test(efa, BM_ELEM_TAG)) {
+						area = BM_face_calc_area(efa) / totarea;
+
+						BLI_array_empty(tf_uv);
+						BLI_array_empty(tf_uvorig);
+						BLI_array_growitems(tf_uv, efa->len);
+						BLI_array_growitems(tf_uvorig, efa->len);
+
+						i = 0;
+						BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+							luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
+
+							copy_v2_v2(tf_uvorig[i], luv->uv);
+
+							i++;
+						}
+
+						poly_copy_aspect(tf_uvorig, tf_uv, aspx, aspy, efa->len);
+
 						//uvarea = tf_area(tf, efa->v4!=0) / totuvarea;
-						uvarea = uv_area(tf_uv, efa->v4 != NULL) / totuvarea;
+						uvarea = poly_uv_area(tf_uv, efa->len) / totuvarea;
 						
-						if(area < FLT_EPSILON || uvarea < FLT_EPSILON)
+						if (area < FLT_EPSILON || uvarea < FLT_EPSILON)
 							areadiff = 1.0f;
-						else if(area>uvarea)
-							areadiff = 1.0f-(uvarea/area);
+						else if (area > uvarea)
+							areadiff = 1.0f - (uvarea / area);
 						else
-							areadiff = 1.0f-(area/uvarea);
+							areadiff = 1.0f - (area / uvarea);
 						
 						weight_to_rgb(col, areadiff);
 						glColor3fv(col);
 						
-						glBegin(efa->v4?GL_QUADS:GL_TRIANGLES);
-							glVertex2fv(tf->uv[0]);
-							glVertex2fv(tf->uv[1]);
-							glVertex2fv(tf->uv[2]);
-							if(efa->v4) glVertex2fv(tf->uv[3]);
+						glBegin(GL_POLYGON);
+						BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+							luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
+							glVertex2fv(luv->uv);
+						}
 						glEnd();
 					}
 				}
@@ -235,149 +276,95 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac
 		}
 		case SI_UVDT_STRETCH_ANGLE:
 		{
-			float uvang1,uvang2,uvang3,uvang4;
-			float ang1,ang2,ang3,ang4;
-			float av1[3], av2[3], av3[3], av4[3]; /* use for 2d and 3d  angle vectors */
+			float *uvang = NULL;
+			float *ang = NULL;
+			float (*av)[3] = NULL;  /* use for 2d and 3d  angle vectors */
+			float (*auv)[2] = NULL;
 			float a;
-			
+
+			BLI_array_declare(uvang);
+			BLI_array_declare(ang);
+			BLI_array_declare(av);
+			BLI_array_declare(auv);
+
 			col[3] = 0.5; /* hard coded alpha, not that nice */
 			
 			glShadeModel(GL_SMOOTH);
 			
-			for(efa= em->faces.first; efa; efa= efa->next) {
-				tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+			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(scene, ima, efa, tf)) {
-					efa->tmp.p = tf;
-					uv_copy_aspect(tf->uv, tf_uv, aspx, aspy);
-					if(efa->v4) {
-						
-#if 0						/* Simple but slow, better reuse normalized vectors */
+				if (uvedit_face_visible_test(scene, ima, efa, tf)) {
+					nverts = efa->len;
+					BM_elem_flag_enable(efa, BM_ELEM_TAG);
+					BLI_array_empty(tf_uv);
+					BLI_array_empty(tf_uvorig);
+					BLI_array_empty(uvang);
+					BLI_array_empty(ang);
+					BLI_array_empty(av);
+					BLI_array_empty(auv);
+					BLI_array_growitems(tf_uv, nverts);
+					BLI_array_growitems(tf_uvorig, nverts);
+					BLI_array_growitems(uvang, nverts);
+					BLI_array_growitems(ang, nverts);
+					BLI_array_growitems(av, nverts);
+					BLI_array_growitems(auv, nverts);
+
+					BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) {
+						luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
+						copy_v2_v2(tf_uvorig[i], luv->uv);
+					}
+
+					poly_copy_aspect(tf_uvorig, tf_uv, aspx, aspy, nverts);
+
+					j = nverts - 1;
+					BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) {
+						sub_v2_v2v2(auv[i], tf_uv[j], tf_uv[i]); normalize_v2(auv[i]);
+						sub_v3_v3v3(av[i], l->prev->v->co, l->v->co); normalize_v3(av[i]);
+						j = i;
+					}
+
+					for (i = 0; i < nverts; i++) {
+#if 0
+						/* Simple but slow, better reuse normalized vectors
+						 * (Not ported to bmesh, copied for reference) */
 						uvang1 = RAD2DEG(angle_v2v2v2(tf_uv[3], tf_uv[0], tf_uv[1]));
 						ang1 = RAD2DEG(angle_v3v3v3(efa->v4->co, efa->v1->co, efa->v2->co));
-						
-						uvang2 = RAD2DEG(angle_v2v2v2(tf_uv[0], tf_uv[1], tf_uv[2]));
-						ang2 = RAD2DEG(angle_v3v3v3(efa->v1->co, efa->v2->co, efa->v3->co));
-						
-						uvang3 = RAD2DEG(angle_v2v2v2(tf_uv[1], tf_uv[2], tf_uv[3]));
-						ang3 = RAD2DEG(angle_v3v3v3(efa->v2->co, efa->v3->co, efa->v4->co));
-						
-						uvang4 = RAD2DEG(angle_v2v2v2(tf_uv[2], tf_uv[3], tf_uv[0]));
-						ang4 = RAD2DEG(angle_v3v3v3(efa->v3->co, efa->v4->co, efa->v1->co));
 #endif
-						
-						/* uv angles */
-						sub_v2_v2v2(av1, tf_uv[3], tf_uv[0]); normalize_v2(av1);
-						sub_v2_v2v2(av2, tf_uv[0], tf_uv[1]); normalize_v2(av2);
-						sub_v2_v2v2(av3, tf_uv[1], tf_uv[2]); normalize_v2(av3);
-						sub_v2_v2v2(av4, tf_uv[2], tf_uv[3]); normalize_v2(av4);
-						
-						/* This is the correct angle however we are only comparing angles
-						 * uvang1 = 90-((angle_normalized_v2v2(av1, av2) * RAD2DEGF(1.0f))-90);*/
-						uvang1 = angle_normalized_v2v2(av1, av2);
-						uvang2 = angle_normalized_v2v2(av2, av3);
-						uvang3 = angle_normalized_v2v2(av3, av4);
-						uvang4 = angle_normalized_v2v2(av4, av1);
-						
-						/* 3d angles */
-						sub_v3_v3v3(av1, efa->v4->co, efa->v1->co); normalize_v3(av1);
-						sub_v3_v3v3(av2, efa->v1->co, efa->v2->co); normalize_v3(av2);
-						sub_v3_v3v3(av3, efa->v2->co, efa->v3->co); normalize_v3(av3);
-						sub_v3_v3v3(av4, efa->v3->co, efa->v4->co); normalize_v3(av4);
-						
-						/* This is the correct angle however we are only comparing angles
-						 * ang1 = 90-((angle_normalized_v3v3(av1, av2) * RAD2DEGF(1.0f))-90);*/
-						ang1 = angle_normalized_v3v3(av1, av2);
-						ang2 = angle_normalized_v3v3(av2, av3);
-						ang3 = angle_normalized_v3v3(av3, av4);
-						ang4 = angle_normalized_v3v3(av4, av1);
-						
-						glBegin(GL_QUADS);
-						
-						/* This simple makes the angles display worse then they really are ;)
-						 * 1.0-powf((1.0-a), 2) */
-						
-						a = fabsf(uvang1-ang1)/(float)M_PI;
-						weight_to_rgb(col, 1.0f-powf((1.0f-a), 2.0f));
-						glColor3fv(col);
-						glVertex2fv(tf->uv[0]);
-						a = fabsf(uvang2-ang2)/(float)M_PI;
-						weight_to_rgb(col, 1.0f-powf((1.0f-a), 2.0f));
-						glColor3fv(col);
-						glVertex2fv(tf->uv[1]);
-						a = fabsf(uvang3-ang3)/(float)M_PI;
-						weight_to_rgb(col, 1.0f-powf((1.0f-a), 2.0f));
-						glColor3fv(col);
-						glVertex2fv(tf->uv[2]);
-						a = fabsf(uvang4-ang4)/(float)M_PI;
-						weight_to_rgb(col, 1.0f-powf((1.0f-a), 2.0f));
-						glColor3fv(col);
-						glVertex2fv(tf->uv[3]);
-						
+						uvang[i] = angle_normalized_v2v2(auv[i], auv[(i + 1) % nverts]);
+						ang[i] = angle_normalized_v3v3(av[i], av[(i + 1) % nverts]);
 					}
-					else {
-#if 0						/* Simple but slow, better reuse normalized vectors */
-						uvang1 = RAD2DEG(angle_v2v2v2(tf_uv[2], tf_uv[0], tf_uv[1]));
-						ang1 = RAD2DEG(angle_v3v3v3(efa->v3->co, efa->v1->co, efa->v2->co));
-						
-						uvang2 = RAD2DEG(angle_v2v2v2(tf_uv[0], tf_uv[1], tf_uv[2]));
-						ang2 = RAD2DEG(angle_v3v3v3(efa->v1->co, efa->v2->co, efa->v3->co));
-						
-						uvang3 = M_PI-(uvang1+uvang2);
-						ang3 = M_PI-(ang1+ang2);
-#endif						
-						
-						/* uv angles */
-						sub_v2_v2v2(av1, tf_uv[2], tf_uv[0]); normalize_v2(av1);
-						sub_v2_v2v2(av2, tf_uv[0], tf_uv[1]); normalize_v2(av2);
-						sub_v2_v2v2(av3, tf_uv[1], tf_uv[2]); normalize_v2(av3);
-						
-						/* This is the correct angle however we are only comparing angles
-						 * uvang1 = 90-((angle_normalized_v2v2(av1, av2) * 180.0/M_PI)-90); */
-						uvang1 = angle_normalized_v2v2(av1, av2);
-						uvang2 = angle_normalized_v2v2(av2, av3);
-						uvang3 = angle_normalized_v2v2(av3, av1);
-						
-						/* 3d angles */
-						sub_v3_v3v3(av1, efa->v3->co, efa->v1->co); normalize_v3(av1);
-						sub_v3_v3v3(av2, efa->v1->co, efa->v2->co); normalize_v3(av2);
-						sub_v3_v3v3(av3, efa->v2->co, efa->v3->co); normalize_v3(av3);
-						/* This is the correct angle however we are only comparing angles
-						 * ang1 = 90-((angle_normalized_v3v3(av1, av2) * 180.0/M_PI)-90); */
-						ang1 = angle_normalized_v3v3(av1, av2);
-						ang2 = angle_normalized_v3v3(av2, av3);
-						ang3 = angle_normalized_v3v3(av3, av1);
-						
-						/* This simple makes the angles display worse then they really are ;)
-						 * 1.0f-powf((1.0-a), 2) */
-						
-						glBegin(GL_TRIANGLES);
-						a = fabsf(uvang1-ang1)/(float)M_PI;
-						weight_to_rgb(col, 1.0f-powf((1.0f-a), 2.0f));
-						glColor3fv(col);
-						glVertex2fv(tf->uv[0]);
-						a = fabsf(uvang2-ang2)/(float)M_PI;
-						weight_to_rgb(col, 1.0f-powf((1.0f-a), 2.0f));
-						glColor3fv(col);
-						glVertex2fv(tf->uv[1]);
-						a = fabsf(uvang3-ang3)/(float)M_PI;
-						weight_to_rgb(col, 1.0f-powf((1.0f-a), 2.0f));
+
+					glBegin(GL_POLYGON);
+					BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) {
+						luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
+						a = fabsf(uvang[i] - ang[i]) / (float)M_PI;
+						weight_to_rgb(col, 1.0f - powf((1.0f - a), 2.0f));
 						glColor3fv(col);
-						glVertex2fv(tf->uv[2]);
+						glVertex2fv(luv->uv);
 					}
 					glEnd();
 				}
 				else {
-					if(tf == activetf)
-						activetf= NULL;
-					efa->tmp.p = NULL;
+					if (tf == activetf)
+						activetf = NULL;
+					BM_elem_flag_disable(efa, BM_ELEM_TAG);
 				}
 			}
 
 			glShadeModel(GL_FLAT);
+
+			BLI_array_free(uvang);
+			BLI_array_free(ang);
+			BLI_array_free(av);
+			BLI_array_free(auv);
+
 			break;
 		}
 	}
+
+	BLI_array_free(tf_uv);
+	BLI_array_free(tf_uvorig);
 }
 
 static void draw_uvs_other(Scene *scene, Object *obedit, Image *curimage)
@@ -386,28 +373,30 @@ static void draw_uvs_other(Scene *scene, Object *obedit, Image *curimage)
 
 	glColor3ub(96, 96, 96);
 
-	for(base=scene->base.first; base; base=base->next) {
-		Object *ob= base->object;
+	for (base = scene->base.first; base; base = base->next) {
+		Object *ob = base->object;
 
-		if(!(base->flag & SELECT)) continue;
-		if(!(base->lay & scene->lay)) continue;
-		if(ob->restrictflag & OB_RESTRICT_VIEW) continue;
+		if (!(base->flag & SELECT)) continue;
+		if (!(base->lay & scene->lay)) continue;
+		if (ob->restrictflag & OB_RESTRICT_VIEW) continue;
 
-		if((ob->type==OB_MESH) && (ob!=obedit)) {
-			Mesh *me= ob->data;
+		if ((ob->type == OB_MESH) && (ob != obedit)) {
+			Mesh *me = ob->data;
 
-			if(me->mtface) {
-				MFace *mface= me->mface;
-				MTFace *tface= me->mtface;
-				int a;
+			if (me->mtpoly) {
+				MPoly *mpoly = me->mpoly;
+				MTexPoly *mtpoly = me->mtpoly;
+				MLoopUV *mloopuv;
+				int a, b;
 
-				for(a=me->totface; a>0; a--, tface++, mface++) {
-					if(tface->tpage == curimage) {
+				for (a = me->totpoly; a > 0; a--, mtpoly++, mpoly++) {
+					if (mtpoly->tpage == curimage) {
 						glBegin(GL_LINE_LOOP);
-						glVertex2fv(tface->uv[0]);
-						glVertex2fv(tface->uv[1]);
-						glVertex2fv(tface->uv[2]);
-						if(mface->v4) glVertex2fv(tface->uv[3]);
+
+						mloopuv = me->mloopuv + mpoly->loopstart;
+						for (b = 0; b < mpoly->totloop; b++, mloopuv++) {
+							glVertex2fv(mloopuv->uv);
+						}
 						glEnd();
 					}
 				}
@@ -418,26 +407,28 @@ static void draw_uvs_other(Scene *scene, Object *obedit, Image *curimage)
 
 static void draw_uvs_texpaint(SpaceImage *sima, Scene *scene, Object *ob)
 {
-	Mesh *me= ob->data;
+	Mesh *me = ob->data;
 	Image *curimage = ED_space_image(sima);
 
-	if(sima->flag & SI_DRAW_OTHER)
+	if (sima->flag & SI_DRAW_OTHER)
 		draw_uvs_other(scene, ob, curimage);
 
 	glColor3ub(112, 112, 112);
 
-	if(me->mtface) {
-		MFace *mface= me->mface;
-		MTFace *tface= me->mtface;
-		int a;
+	if (me->mtface) {
+		MPoly *mpoly = me->mpoly;
+		MTexPoly *tface = me->mtpoly;
+		MLoopUV *mloopuv;
+		int a, b;
 
-		for(a=me->totface; a>0; a--, tface++, mface++) {
-			if(tface->tpage == curimage) {
+		for (a = me->totpoly; a > 0; a--, tface++, mpoly++) {
+			if (tface->tpage == curimage) {
 				glBegin(GL_LINE_LOOP);
-				glVertex2fv(tface->uv[0]);
-				glVertex2fv(tface->uv[1]);
-				glVertex2fv(tface->uv[2]);
-				if(mface->v4) glVertex2fv(tface->uv[3]);
+
+				mloopuv = me->mloopuv + mpoly->loopstart;
+				for (b = 0; b < mpoly->totloop; b++, mloopuv++) {
+					glVertex2fv(mloopuv->uv);
+				}
 				glEnd();
 			}
 		}
@@ -448,105 +439,110 @@ static void draw_uvs_texpaint(SpaceImage *sima, Scene *scene, Object *ob)
 static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
 {
 	ToolSettings *ts;
-	Mesh *me= obedit->data;
-	EditMesh *em;
-	EditFace *efa, *efa_act;
-	MTFace *tf, *activetf = NULL;
+	Mesh *me = obedit->data;
+	BMEditMesh *em = me->edit_btmesh;
+	BMesh *bm = em->bm;
+	BMFace *efa, *efa_act, *activef;
+	BMLoop *l;
+	BMIter iter, liter;
+	MTexPoly *tf, *activetf = NULL;
+	MLoopUV *luv;
 	DerivedMesh *finaldm, *cagedm;
 	unsigned char col1[4], col2[4];
 	float pointsize;
 	int drawfaces, interpedges;
-	Image *ima= sima->image;
-	StitchPreviewer *stitch_preview = uv_get_stitch_previewer();
+	Image *ima = sima->image;
 
-	em= BKE_mesh_get_editmesh(me);
-	activetf= EM_get_active_mtface(em, &efa_act, NULL, 0); /* will be set to NULL if hidden */
+	StitchPreviewer *stitch_preview = uv_get_stitch_previewer();
 
-	ts= scene->toolsettings;
+	activetf = EDBM_mtexpoly_active_get(em, &efa_act, FALSE); /* will be set to NULL if hidden */
+	activef = BM_active_face_get(bm, FALSE);
+	ts = scene->toolsettings;
 
-	drawfaces= draw_uvs_face_check(scene);
-	if(ts->uv_flag & UV_SYNC_SELECTION)
-		interpedges= (ts->selectmode & SCE_SELECT_VERTEX);
+	drawfaces = draw_uvs_face_check(scene);
+	if (ts->uv_flag & UV_SYNC_SELECTION)
+		interpedges = (ts->selectmode & SCE_SELECT_VERTEX);
 	else
-		interpedges= (ts->uv_selectmode == UV_SELECT_VERTEX);
+		interpedges = (ts->uv_selectmode == UV_SELECT_VERTEX);
 	
 	/* draw other uvs */
-	if(sima->flag & SI_DRAW_OTHER) {
-		Image *curimage= (activetf)? activetf->tpage: NULL;
+	if (sima->flag & SI_DRAW_OTHER) {
+		Image *curimage = (activetf) ? activetf->tpage : NULL;
 
 		draw_uvs_other(scene, obedit, curimage);
 	}
 
 	/* 1. draw shadow mesh */
 	
-	if(sima->flag & SI_DRAWSHADOW) {
+	if (sima->flag & SI_DRAWSHADOW) {
 		/* first try existing derivedmesh */
-		if(!draw_uvs_dm_shadow(em->derivedFinal)) {
+		if (!draw_uvs_dm_shadow(em->derivedFinal)) {
 			/* create one if it does not exist */
-			cagedm = editmesh_get_derived_cage_and_final(scene, obedit, em, &finaldm, CD_MASK_BAREMESH|CD_MASK_MTFACE);
+			cagedm = editbmesh_get_derived_cage_and_final(scene, obedit, me->edit_btmesh, &finaldm, CD_MASK_BAREMESH | CD_MASK_MTFACE);
 
 			/* when sync selection is enabled, all faces are drawn (except for hidden)
 			 * so if cage is the same as the final, theres no point in drawing this */
-			if(!((ts->uv_flag & UV_SYNC_SELECTION) && (cagedm == finaldm)))
+			if (!((ts->uv_flag & UV_SYNC_SELECTION) && (cagedm == finaldm)))
 				draw_uvs_dm_shadow(finaldm);
 			
 			/* release derivedmesh again */
-			if(cagedm != finaldm) cagedm->release(cagedm);
+			if (cagedm != finaldm) cagedm->release(cagedm);
 			finaldm->release(finaldm);
 		}
 	}
 	
 	/* 2. draw colored faces */
 	
-	if(sima->flag & SI_DRAW_STRETCH) {
+	if (sima->flag & SI_DRAW_STRETCH) {
 		draw_uvs_stretch(sima, scene, em, activetf);
 	}
-	else if(!(sima->flag & SI_NO_DRAWFACES)) {
+	else if (!(sima->flag & SI_NO_DRAWFACES)) {
 		/* draw transparent faces */
 		UI_GetThemeColor4ubv(TH_FACE, col1);
 		UI_GetThemeColor4ubv(TH_FACE_SELECT, col2);
 		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 		glEnable(GL_BLEND);
 		
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+		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(scene, ima, efa, tf)) {
-				efa->tmp.p = tf;
-				if(tf==activetf) continue; /* important the temp pointer is set above */
+			if (uvedit_face_visible_test(scene, ima, efa, tf)) {
+				BM_elem_flag_enable(efa, BM_ELEM_TAG);
+				if (tf == activetf) continue;  /* important the temp boolean is set above */
 
-				if(uvedit_face_selected(scene, efa, tf))
+				if (uvedit_face_select_test(scene, em, efa))
 					glColor4ubv((GLubyte *)col2);
 				else
 					glColor4ubv((GLubyte *)col1);
-					
-				glBegin(efa->v4?GL_QUADS:GL_TRIANGLES);
-					glVertex2fv(tf->uv[0]);
-					glVertex2fv(tf->uv[1]);
-					glVertex2fv(tf->uv[2]);
-					if(efa->v4) glVertex2fv(tf->uv[3]);
+				
+				glBegin(GL_POLYGON);
+				BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+					luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
+					glVertex2fv(luv->uv);
+				}
 				glEnd();
 			}
 			else {
-				if(tf == activetf)
-					activetf= NULL;
-				efa->tmp.p = NULL;
+				if (tf == activetf)
+					activetf = NULL;
+				BM_elem_flag_disable(efa, BM_ELEM_TAG);
 			}
 		}
 		glDisable(GL_BLEND);
 	}
 	else {
 		/* would be nice to do this within a draw loop but most below are optional, so it would involve too many checks */
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+		
+		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(scene, ima, efa, tf)) {		
-				efa->tmp.p = tf;
+			if (uvedit_face_visible_test(scene, ima, efa, tf)) {		
+				BM_elem_flag_enable(efa, BM_ELEM_TAG);
 			}
 			else {
-				if(tf == activetf)
-					activetf= NULL;
-				efa->tmp.p = NULL;
+				if (tf == activetf)
+					activetf = NULL;
+				BM_elem_flag_disable(efa, BM_ELEM_TAG);
 			}
 		}
 		
@@ -554,67 +550,71 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
 
 	/* 3. draw active face stippled */
 
-	if(activetf) {
-		glEnable(GL_BLEND);
-		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-		UI_ThemeColor4(TH_EDITMESH_ACTIVE);
+	if (activef) {
+		tf = CustomData_bmesh_get(&bm->pdata, activef->head.data, CD_MTEXPOLY);
+		if (uvedit_face_visible_test(scene, ima, activef, tf)) {
+			glEnable(GL_BLEND);
+			glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+			UI_ThemeColor4(TH_EDITMESH_ACTIVE);
 
-		glEnable(GL_POLYGON_STIPPLE);
-		glPolygonStipple(stipple_quarttone);
+			glEnable(GL_POLYGON_STIPPLE);
+			glPolygonStipple(stipple_quarttone);
 
-		glBegin(efa_act->v4? GL_QUADS: GL_TRIANGLES);
-			glVertex2fv(activetf->uv[0]);
-			glVertex2fv(activetf->uv[1]);
-			glVertex2fv(activetf->uv[2]);
-			if(efa_act->v4) glVertex2fv(activetf->uv[3]);
-		glEnd();
+			glBegin(GL_POLYGON);
+			BM_ITER_ELEM (l, &liter, activef, BM_LOOPS_OF_FACE) {
+				luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
+				glVertex2fv(luv->uv);
+			}
+			glEnd();
 
-		glDisable(GL_POLYGON_STIPPLE);
-		glDisable(GL_BLEND);
+			glDisable(GL_POLYGON_STIPPLE);
+			glDisable(GL_BLEND);
+		}
 	}
 	
 	/* 4. draw edges */
 
-	if(sima->flag & SI_SMOOTH_UV) {
+	if (sima->flag & SI_SMOOTH_UV) {
 		glEnable(GL_LINE_SMOOTH);
 		glEnable(GL_BLEND);
 		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 	}
 	
-	switch(sima->dt_uv) {
+	switch (sima->dt_uv) {
 		case SI_UVDT_DASH:
-			for(efa= em->faces.first; efa; efa= efa->next) {
-				tf= (MTFace *)efa->tmp.p; /* visible faces cached */
+			BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+				if (!BM_elem_flag_test(efa, BM_ELEM_TAG))
+					continue;
+				tf = CustomData_bmesh_get(&bm->pdata, efa->head.data, CD_MTEXPOLY);
 
-				if(tf) {
+				if (tf) {
 					cpack(0x111111);
 
 					glBegin(GL_LINE_LOOP);
-						glVertex2fv(tf->uv[0]);
-						glVertex2fv(tf->uv[1]);
-						glVertex2fv(tf->uv[2]);
-						if(efa->v4) glVertex2fv(tf->uv[3]);
+					BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+						luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
+						glVertex2fv(luv->uv);
+					}
 					glEnd();
-				
+
 					setlinestyle(2);
 					cpack(0x909090);
 
-					glBegin(GL_LINE_STRIP);
-						glVertex2fv(tf->uv[0]);
-						glVertex2fv(tf->uv[1]);
-					glEnd();
-		
-					glBegin(GL_LINE_STRIP);
-						glVertex2fv(tf->uv[0]);
-						if(efa->v4) glVertex2fv(tf->uv[3]);
-						else glVertex2fv(tf->uv[2]);
+					glBegin(GL_LINE_LOOP);
+					BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+						luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
+						glVertex2fv(luv->uv);
+					}
 					glEnd();
-		
+
+#if 0
 					glBegin(GL_LINE_STRIP);
-						glVertex2fv(tf->uv[1]);
-						glVertex2fv(tf->uv[2]);
-						if(efa->v4) glVertex2fv(tf->uv[3]);
+					luv = CustomData_bmesh_get(&bm->ldata, efa->lbase->head.data, CD_MLOOPUV);
+					glVertex2fv(luv->uv);
+					luv = CustomData_bmesh_get(&bm->ldata, efa->lbase->next->head.data, CD_MLOOPUV);
+					glVertex2fv(luv->uv);
 					glEnd();
+#endif
 
 					setlinestyle(0);
 				}
@@ -622,141 +622,112 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
 			break;
 		case SI_UVDT_BLACK: /* black/white */
 		case SI_UVDT_WHITE: 
-			if(sima->dt_uv==SI_UVDT_WHITE) glColor3f(1.0f, 1.0f, 1.0f);
+			if (sima->dt_uv == SI_UVDT_WHITE) glColor3f(1.0f, 1.0f, 1.0f);
 			else glColor3f(0.0f, 0.0f, 0.0f);
 
-			for(efa= em->faces.first; efa; efa= efa->next) {
-				tf= (MTFace *)efa->tmp.p; /* visible faces cached */
+			BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+				if (!BM_elem_flag_test(efa, BM_ELEM_TAG))
+					continue;
 
-				if(tf) {
-					glBegin(GL_LINE_LOOP);
-						glVertex2fv(tf->uv[0]);
-						glVertex2fv(tf->uv[1]);
-						glVertex2fv(tf->uv[2]);
-						if(efa->v4) glVertex2fv(tf->uv[3]);
-					glEnd();
+				glBegin(GL_LINE_LOOP);
+				BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+					luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
+					glVertex2fv(luv->uv);
 				}
+				glEnd();
 			}
 			break;
 		case SI_UVDT_OUTLINE:
 			glLineWidth(3);
 			cpack(0x0);
 			
-			for(efa= em->faces.first; efa; efa= efa->next) {
-				tf= (MTFace *)efa->tmp.p; /* visible faces cached */
+			BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+				if (!BM_elem_flag_test(efa, BM_ELEM_TAG))
+					continue;
 
-				if(tf) {
-					glBegin(GL_LINE_LOOP);
-						glVertex2fv(tf->uv[0]);
-						glVertex2fv(tf->uv[1]);
-						glVertex2fv(tf->uv[2]);
-						if(efa->v4) glVertex2fv(tf->uv[3]);
-					glEnd();
+				glBegin(GL_LINE_LOOP);
+				BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+					luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
+					glVertex2fv(luv->uv);
 				}
+				glEnd();
 			}
 			
 			glLineWidth(1);
 			col2[0] = col2[1] = col2[2] = 192; col2[3] = 255;
 			glColor4ubv((unsigned char *)col2); 
 			
-			if(me->drawflag & ME_DRAWEDGES) {
-				int lastsel= 0, sel;
+			if (me->drawflag & ME_DRAWEDGES) {
+				int sel, lastsel = -1;
 				UI_GetThemeColor4ubv(TH_VERTEX_SELECT, col1);
 
-				if(interpedges) {
+				if (interpedges) {
 					glShadeModel(GL_SMOOTH);
 
-					for(efa= em->faces.first; efa; efa= efa->next) {
-						tf= (MTFace *)efa->tmp.p; /* visible faces cached */
-
-						if(tf) {
-							glBegin(GL_LINE_LOOP);
-							sel = (uvedit_uv_selected(scene, efa, tf, 0)? 1 : 0);
-							if(sel != lastsel) { glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; }
-							glVertex2fv(tf->uv[0]);
-							
-							sel = uvedit_uv_selected(scene, efa, tf, 1)? 1 : 0;
-							if(sel != lastsel) { glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; }
-							glVertex2fv(tf->uv[1]);
-							
-							sel = uvedit_uv_selected(scene, efa, tf, 2)? 1 : 0;
-							if(sel != lastsel) { glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; }
-							glVertex2fv(tf->uv[2]);
-							
-							if(efa->v4) {
-								sel = uvedit_uv_selected(scene, efa, tf, 3)? 1 : 0;
-								if(sel != lastsel) { glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; }
-								glVertex2fv(tf->uv[3]);
-							}
-							
-							glEnd();
+					BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+						if (!BM_elem_flag_test(efa, BM_ELEM_TAG))
+							continue;
+
+						glBegin(GL_LINE_LOOP);
+						BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+							sel = (uvedit_uv_select_test(em, scene, l) ? 1 : 0);
+							glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2);
+
+							luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
+							glVertex2fv(luv->uv);
 						}
+						glEnd();
 					}
 
 					glShadeModel(GL_FLAT);
 				}
 				else {
-					for(efa= em->faces.first; efa; efa= efa->next) {
-						tf= (MTFace *)efa->tmp.p; /* visible faces cached */
-
-						if(tf) {
-							glBegin(GL_LINES);
-							sel = (uvedit_edge_selected(scene, efa, tf, 0)? 1 : 0);
-							if(sel != lastsel) { glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; }
-							glVertex2fv(tf->uv[0]);
-							glVertex2fv(tf->uv[1]);
-							
-							sel = uvedit_edge_selected(scene, efa, tf, 1)? 1 : 0;
-							if(sel != lastsel) { glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; }
-							glVertex2fv(tf->uv[1]);
-							glVertex2fv(tf->uv[2]);
-							
-							sel = uvedit_edge_selected(scene, efa, tf, 2)? 1 : 0;
-							if(sel != lastsel) { glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; }
-							glVertex2fv(tf->uv[2]);
-							
-							if(efa->v4) {
-								glVertex2fv(tf->uv[3]);
-
-								sel = uvedit_edge_selected(scene, efa, tf, 3)? 1 : 0;
-								if(sel != lastsel) { glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2); lastsel = sel; }
-								glVertex2fv(tf->uv[3]);
+					BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+						if (!BM_elem_flag_test(efa, BM_ELEM_TAG))
+							continue;
+
+						glBegin(GL_LINES);
+						BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+							sel = (uvedit_edge_select_test(em, scene, l) ? 1 : 0);
+							if (sel != lastsel) {
+								glColor4ubv(sel ? (GLubyte *)col1 : (GLubyte *)col2);
+								lastsel = sel;
 							}
-
-							glVertex2fv(tf->uv[0]);
-							
-							glEnd();
+							luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
+							glVertex2fv(luv->uv);
+							luv = CustomData_bmesh_get(&bm->ldata, l->next->head.data, CD_MLOOPUV);
+							glVertex2fv(luv->uv);
 						}
+						glEnd();
 					}
 				}
 			}
 			else {
 				/* no nice edges */
-				for(efa= em->faces.first; efa; efa= efa->next) {
-					tf= (MTFace *)efa->tmp.p; /* visible faces cached */
-
-					if(tf) {
-						glBegin(GL_LINE_LOOP);
-							glVertex2fv(tf->uv[0]);
-							glVertex2fv(tf->uv[1]);
-							glVertex2fv(tf->uv[2]);
-							if(efa->v4) glVertex2fv(tf->uv[3]);
-						glEnd();
+				BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+					if (!BM_elem_flag_test(efa, BM_ELEM_TAG))
+						continue;
+				
+					glBegin(GL_LINE_LOOP);
+					BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+						luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
+						glVertex2fv(luv->uv);
 					}
+					glEnd();
 				}
 			}
 			
 			break;
 	}
 
-	if(sima->flag & SI_SMOOTH_UV) {
+	if (sima->flag & SI_SMOOTH_UV) {
 		glDisable(GL_LINE_SMOOTH);
 		glDisable(GL_BLEND);
 	}
 
 	/* 5. draw face centers */
 
-	if(drawfaces) {
+	if (drawfaces) {
 		float cent[2];
 		
 		pointsize = UI_GetThemeValuef(TH_FACEDOT_SIZE);
@@ -766,11 +737,12 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
 		UI_ThemeColor(TH_WIRE);
 
 		bglBegin(GL_POINTS);
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			tf= (MTFace *)efa->tmp.p; /* visible faces cached */
+		BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+			if (!BM_elem_flag_test(efa, BM_ELEM_TAG))
+				continue;
 
-			if(tf && !uvedit_face_selected(scene, efa, tf)) {
-				uv_center(tf->uv, cent, efa->v4 != NULL);
+			if (!uvedit_face_select_test(scene, em, efa)) {
+				poly_uv_center(em, efa, cent);
 				bglVertex2fv(cent);
 			}
 		}
@@ -780,11 +752,12 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
 		UI_ThemeColor(TH_FACE_DOT);
 
 		bglBegin(GL_POINTS);
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			tf= (MTFace *)efa->tmp.p; /* visible faces cached */
+		BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+			if (!BM_elem_flag_test(efa, BM_ELEM_TAG))
+				continue;
 
-			if(tf && uvedit_face_selected(scene, efa, tf)) {
-				uv_center(tf->uv, cent, efa->v4 != NULL);
+			if (uvedit_face_select_test(scene, em, efa)) {
+				poly_uv_center(em, efa, cent);
 				bglVertex2fv(cent);
 			}
 		}
@@ -793,47 +766,40 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
 
 	/* 6. draw uv vertices */
 	
-	if(drawfaces != 2) { /* 2 means Mesh Face Mode */
+	if (drawfaces != 2) { /* 2 means Mesh Face Mode */
 		/* unselected uvs */
 		UI_ThemeColor(TH_VERTEX);
 		pointsize = UI_GetThemeValuef(TH_VERTEX_SIZE);
 		glPointSize(pointsize);
 	
 		bglBegin(GL_POINTS);
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			tf= (MTFace *)efa->tmp.p; /* visible faces cached */
-
-			if(tf) {
-				if(!uvedit_uv_selected(scene, efa, tf, 0))
-					bglVertex2fv(tf->uv[0]);
-				if(!uvedit_uv_selected(scene, efa, tf, 1))
-					bglVertex2fv(tf->uv[1]);
-				if(!uvedit_uv_selected(scene, efa, tf, 2))
-					bglVertex2fv(tf->uv[2]);
-				if(efa->v4 && !uvedit_uv_selected(scene, efa, tf, 3))
-					bglVertex2fv(tf->uv[3]);
+		BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+			if (!BM_elem_flag_test(efa, BM_ELEM_TAG))
+				continue;
+
+			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+				luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
+				if (!uvedit_uv_select_test(em, scene, l))
+					bglVertex2fv(luv->uv);
 			}
 		}
 		bglEnd();
 	
 		/* pinned uvs */
 		/* give odd pointsizes odd pin pointsizes */
-		glPointSize(pointsize*2 + (((int)pointsize % 2)? (-1): 0));
+		glPointSize(pointsize * 2 + (((int)pointsize % 2) ? (-1) : 0));
 		cpack(0xFF);
 	
 		bglBegin(GL_POINTS);
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			tf= (MTFace *)efa->tmp.p; /* visible faces cached */
-
-			if(tf) {
-				if(tf->unwrap & TF_PIN1)
-					bglVertex2fv(tf->uv[0]);
-				if(tf->unwrap & TF_PIN2)
-					bglVertex2fv(tf->uv[1]);
-				if(tf->unwrap & TF_PIN3)
-					bglVertex2fv(tf->uv[2]);
-				if(efa->v4 && (tf->unwrap & TF_PIN4))
-					bglVertex2fv(tf->uv[3]);
+		BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+			if (!BM_elem_flag_test(efa, BM_ELEM_TAG))
+				continue;
+
+			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+				luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
+
+				if (luv->flag & MLOOPUV_PINNED)
+					bglVertex2fv(luv->uv);
 			}
 		}
 		bglEnd();
@@ -843,25 +809,23 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
 		glPointSize(pointsize);
 	
 		bglBegin(GL_POINTS);
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			tf= (MTFace *)efa->tmp.p; /* visible faces cached */
-
-			if(tf) {
-				if(uvedit_uv_selected(scene, efa, tf, 0))
-					bglVertex2fv(tf->uv[0]);
-				if(uvedit_uv_selected(scene, efa, tf, 1))
-					bglVertex2fv(tf->uv[1]);
-				if(uvedit_uv_selected(scene, efa, tf, 2))
-					bglVertex2fv(tf->uv[2]);
-				if(efa->v4 && uvedit_uv_selected(scene, efa, tf, 3))
-					bglVertex2fv(tf->uv[3]);
+		BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+			if (!BM_elem_flag_test(efa, BM_ELEM_TAG))
+				continue;
+
+			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+				luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
+
+				if (uvedit_uv_select_test(em, scene, l))
+					bglVertex2fv(luv->uv);
 			}
 		}
 		bglEnd();	
 	}
 
 	/* finally draw stitch preview */
-	if(stitch_preview) {
+	if (stitch_preview) {
+		int i, index = 0;
 		glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
 		glEnableClientState(GL_VERTEX_ARRAY);
 
@@ -870,37 +834,28 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
 		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->static_quads);
-		glDrawArrays(GL_QUADS, 0, stitch_preview->num_static_quads*4);
-
-		glVertexPointer(2, GL_FLOAT, 0, stitch_preview->preview_tris);
-		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-		UI_ThemeColor4(TH_STITCH_PREVIEW_FACE);
-		glDrawArrays(GL_TRIANGLES, 0, stitch_preview->num_tris*3);
-		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-		UI_ThemeColor4(TH_STITCH_PREVIEW_EDGE);
-		glDrawArrays(GL_TRIANGLES, 0, stitch_preview->num_tris*3);
-		glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
-		/*UI_ThemeColor4(TH_STITCH_PREVIEW_VERT);
-		glDrawArrays(GL_TRIANGLES, 0, stitch_preview->num_tris*3);*/
-
-		glVertexPointer(2, GL_FLOAT, 0, stitch_preview->preview_quads);
-		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-		UI_ThemeColor4(TH_STITCH_PREVIEW_FACE);
-		glDrawArrays(GL_QUADS, 0, stitch_preview->num_quads*4);
-		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-		UI_ThemeColor4(TH_STITCH_PREVIEW_EDGE);
-		glDrawArrays(GL_QUADS, 0, stitch_preview->num_quads*4);
+		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);
-		/*UI_ThemeColor4(TH_STITCH_PREVIEW_VERT);
-		glDrawArrays(GL_QUADS, 0, stitch_preview->num_quads*4);*/
-
+#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.0);
+		glPointSize(pointsize * 2.0);
 		UI_ThemeColor4(TH_STITCH_PREVIEW_STITCHABLE);
 		glVertexPointer(2, GL_FLOAT, 0, stitch_preview->preview_stitchable);
 		glDrawArrays(GL_POINTS, 0, stitch_preview->num_stitchable);
@@ -914,7 +869,6 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
 	}
 
 	glPointSize(1.0);
-	BKE_mesh_end_editmesh(obedit->data, em);
 }
 
 void draw_uvedit_main(SpaceImage *sima, ARegion *ar, Scene *scene, Object *obedit, Object *obact)
@@ -923,18 +877,18 @@ void draw_uvedit_main(SpaceImage *sima, ARegion *ar, Scene *scene, Object *obedi
 	int show_uvedit, show_uvshadow, show_texpaint_uvshadow;
 
 	show_texpaint_uvshadow = (obact && obact->type == OB_MESH && obact->mode == OB_MODE_TEXTURE_PAINT);
-	show_uvedit= ED_space_image_show_uvedit(sima, obedit);
-	show_uvshadow= ED_space_image_show_uvshadow(sima, obedit);
+	show_uvedit = ED_space_image_show_uvedit(sima, obedit);
+	show_uvshadow = ED_space_image_show_uvshadow(sima, obedit);
 
-	if(show_uvedit || show_uvshadow || show_texpaint_uvshadow) {
-		if(show_uvshadow)
+	if (show_uvedit || show_uvshadow || show_texpaint_uvshadow) {
+		if (show_uvshadow)
 			draw_uvs_shadow(obedit);
-		else if(show_uvedit)
+		else if (show_uvedit)
 			draw_uvs(sima, scene, obedit);
 		else
 			draw_uvs_texpaint(sima, scene, obact);
 
-		if(show_uvedit && !(toolsettings->use_uv_sculpt))
+		if (show_uvedit && !(toolsettings->use_uv_sculpt))
 			drawcursor_sima(sima, ar);
 	}
 }
diff --git a/source/blender/editors/uvedit/uvedit_intern.h b/source/blender/editors/uvedit/uvedit_intern.h
index ef25159..fdcb5db 100644
--- a/source/blender/editors/uvedit/uvedit_intern.h
+++ b/source/blender/editors/uvedit/uvedit_intern.h
@@ -29,11 +29,10 @@
  */
 
 
-#ifndef ED_UVEDIT_INTERN_H
-#define ED_UVEDIT_INTERN_H
+#ifndef __UVEDIT_INTERN_H__
+#define __UVEDIT_INTERN_H__
 
-struct EditFace;
-struct EditMesh;
+struct MTexPoly;
 struct Image;
 struct MTFace;
 struct Object;
@@ -41,59 +40,68 @@ struct Scene;
 struct SpaceImage;
 struct UvElementMap;
 struct wmOperatorType;
+struct BMEditMesh;
+struct BMFace;
+struct BMLoop;
+struct BMEdge;
+struct BMVert;
 
 /* id can be from 0 to 3 */
 #define TF_PIN_MASK(id) (TF_PIN1 << id)
 #define TF_SEL_MASK(id) (TF_SEL1 << id)
 
+/* visibility and selection */
+int uvedit_face_visible_nolocal(struct Scene *scene, struct BMFace *efa);
+
 /* geometric utilities */
 
 void uv_center(float uv[][2], float cent[2], int quad);
 float uv_area(float uv[][2], int quad);
 void uv_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy);
 
+float poly_uv_area(float uv[][2], int len);
+void poly_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy, int len);
+void poly_uv_center(struct BMEditMesh *em, struct BMFace *f, float cent[2]);
+
 /* find nearest */
 
 typedef struct NearestHit {
-	struct EditFace *efa;
-	struct MTFace *tf;
-
-	int vert, uv;
-	int edge, vert2;
+	struct BMFace *efa;
+	struct MTexPoly *tf;
+	struct BMLoop *l, *nextl;
+	struct MLoopUV *luv, *nextluv;
+	int lindex; //index of loop within face
+	int vert1, vert2; //index in mesh of edge vertices
 } NearestHit;
 
-void uv_find_nearest_vert(struct Scene *scene, struct Image *ima, struct EditMesh *em, float co[2], float penalty[2], struct NearestHit *hit);
-void uv_find_nearest_edge(struct Scene *scene, struct Image *ima, struct EditMesh *em, float co[2], struct NearestHit *hit);
+void uv_find_nearest_vert(struct Scene *scene, struct Image *ima, struct BMEditMesh *em, float co[2], float penalty[2], struct NearestHit *hit);
+void uv_find_nearest_edge(struct Scene *scene, struct Image *ima, struct BMEditMesh *em, float co[2], struct NearestHit *hit);
 
 /* utility tool functions */
 
-struct UvElement *ED_get_uv_element(struct UvElementMap *map, struct EditFace *efa, int index);
+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 {
-	/* OpenGL requires different calls for Triangles and Quads.
-	 * here we'll store the quads of the mesh */
-	float *preview_quads;
-	/* ...and here we'll store the triangles*/
-	float *preview_tris;
+	/* 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 triangles and quads to be drawn */
-	unsigned int num_tris;
-	unsigned int num_quads;
+	/* here we'll store the number of elements to be drawn */
 	unsigned int num_stitchable;
 	unsigned int num_unstitchable;
-
-	/* store static island Quads */
-	float *static_quads;
+	unsigned int preview_uvs;
 	/* ...and here we'll store the triangles*/
 	float *static_tris;
 	unsigned int num_static_tris;
-	unsigned int num_static_quads;
 } StitchPreviewer;
 
 StitchPreviewer *uv_get_stitch_previewer(void);
@@ -111,5 +119,5 @@ void UV_OT_sphere_project(struct wmOperatorType *ot);
 void UV_OT_unwrap(struct wmOperatorType *ot);
 void UV_OT_stitch(struct wmOperatorType *ot);
 
-#endif /* ED_UVEDIT_INTERN_H */
+#endif /* __UVEDIT_INTERN_H__ */
 
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index 5f836ec..1c62ce3 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -33,18 +33,22 @@
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
+#include <string.h>
 
 #include "MEM_guardedalloc.h"
 
 #include "DNA_object_types.h"
 #include "DNA_material_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_node_types.h"
+#include "DNA_image_types.h"
+#include "DNA_space_types.h"
 #include "DNA_scene_types.h"
 
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
-#include "BLI_editVert.h"
+#include "BLI_array.h"
 #include "BLI_utildefines.h"
 
 #include "BKE_context.h"
@@ -58,6 +62,7 @@
 #include "BKE_node.h"
 #include "BKE_report.h"
 #include "BKE_scene.h"
+#include "BKE_tessmesh.h"
 
 #include "ED_image.h"
 #include "ED_mesh.h"
@@ -77,40 +82,44 @@
 
 #include "uvedit_intern.h"
 
+static void select_all_perform(Scene *scene, Image *ima, BMEditMesh *em, int action);
+
 /************************* state testing ************************/
 
 int ED_uvedit_test(Object *obedit)
 {
-	EditMesh *em;
+	BMEditMesh *em;
 	int ret;
 
-	if(!obedit || obedit->type != OB_MESH)
+	if (!obedit)
+		return 0;
+	
+	if (obedit->type != OB_MESH)
 		return 0;
 
-	em = BKE_mesh_get_editmesh(obedit->data);
-	ret = EM_texFaceCheck(em);
-	BKE_mesh_end_editmesh(obedit->data, em);
+	em = BMEdit_FromObject(obedit);
+	ret = EDBM_mtexpoly_check(em);
 	
 	return ret;
 }
 
 static int ED_operator_uvedit_can_uv_sculpt(struct bContext *C)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
 	ToolSettings *toolsettings = CTX_data_tool_settings(C);
-	Object *obedit= CTX_data_edit_object(C);
+	Object *obedit = CTX_data_edit_object(C);
 
 	return ED_space_image_show_uvedit(sima, obedit) && !(toolsettings->use_uv_sculpt);
 }
 
-static int UNUSED_FUNCTION(ED_operator_uvmap_mesh)(bContext *C)
+static int UNUSED_FUNCTION(ED_operator_uvmap_mesh) (bContext * C)
 {
-	Object *ob= CTX_data_active_object(C);
+	Object *ob = CTX_data_active_object(C);
 
-	if(ob && ob->type==OB_MESH) {
+	if (ob && ob->type == OB_MESH) {
 		Mesh *me = ob->data;
 
-		if(CustomData_get_layer(&me->fdata, CD_MTFACE) != NULL)
+		if (CustomData_get_layer(&me->fdata, CD_MTFACE) != NULL)
 			return 1;
 	}
 
@@ -125,30 +134,30 @@ static int is_image_texture_node(bNode *node)
 
 int ED_object_get_active_image(Object *ob, int mat_nr, Image **ima, ImageUser **iuser, bNode **node_r)
 {
-	Material *ma= give_current_material(ob, mat_nr);
-	bNode *node= (ma && ma->use_nodes)? nodeGetActiveTexture(ma->nodetree): NULL;
+	Material *ma = give_current_material(ob, mat_nr);
+	bNode *node = (ma && ma->use_nodes) ? nodeGetActiveTexture(ma->nodetree) : NULL;
 
-	if(node && is_image_texture_node(node)) {
-		if(ima) *ima= (Image*)node->id;
-		if(iuser) *iuser= NULL;
-		if(node_r) *node_r= node;
+	if (node && is_image_texture_node(node)) {
+		if (ima) *ima = (Image *)node->id;
+		if (iuser) *iuser = NULL;
+		if (node_r) *node_r = node;
 		return TRUE;
 	}
 	
-	if(ima) *ima= NULL;
-	if(iuser) *iuser= NULL;
-	if(node_r) *node_r= node;
+	if (ima) *ima = NULL;
+	if (iuser) *iuser = NULL;
+	if (node_r) *node_r = node;
 
 	return FALSE;
 }
 
 void ED_object_assign_active_image(Main *bmain, Object *ob, int mat_nr, Image *ima)
 {
-	Material *ma= give_current_material(ob, mat_nr);
-	bNode *node= (ma && ma->use_nodes)? nodeGetActiveTexture(ma->nodetree): NULL;
+	Material *ma = give_current_material(ob, mat_nr);
+	bNode *node = (ma && ma->use_nodes) ? nodeGetActiveTexture(ma->nodetree) : NULL;
 
-	if(node && is_image_texture_node(node)) {
-		node->id= &ima->id;
+	if (node && is_image_texture_node(node)) {
+		node->id = &ima->id;
 		ED_node_generic_update(bmain, ma->nodetree, node);
 	}
 }
@@ -157,98 +166,99 @@ 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)
 {
-	EditMesh *em;
-	EditFace *efa;
-	MTFace *tf;
-	int update= 0;
+	BMEditMesh *em;
+	BMFace *efa;
+	BMIter iter;
+	MTexPoly *tf;
+	int update = 0;
 	
 	/* skip assigning these procedural images... */
-	if(ima && (ima->type==IMA_TYPE_R_RESULT || ima->type==IMA_TYPE_COMPOSITE))
+	if (ima && (ima->type == IMA_TYPE_R_RESULT || ima->type == IMA_TYPE_COMPOSITE))
 		return;
 
 	/* verify we have a mesh we can work with */
-	if(!obedit || (obedit->type != OB_MESH))
+	if (!obedit || (obedit->type != OB_MESH))
 		return;
 
-	em= BKE_mesh_get_editmesh(((Mesh*)obedit->data));
-	if(!em || !em->faces.first) {
-		BKE_mesh_end_editmesh(obedit->data, em);
+	em = BMEdit_FromObject(obedit);
+	if (!em || !em->bm->totface) {
 		return;
 	}
 
-	if(scene_use_new_shading_nodes(scene)) {
+	if (scene_use_new_shading_nodes(scene)) {
 		/* new shading system, assign image in material */
-		int sloppy= 1;
-		EditFace *efa= EM_get_actFace(em, sloppy);
+		int sloppy = 1;
+		BMFace *efa = BM_active_face_get(em->bm, sloppy);
 
-		if(efa)
-			ED_object_assign_active_image(bmain, obedit, efa->mat_nr, ima);
+		if (efa)
+			ED_object_assign_active_image(bmain, obedit, efa->mat_nr + 1, ima);
 	}
 	else {
 		/* old shading system, assign image to selected faces */
 		
 		/* ensure we have a uv map */
-		if(!CustomData_has_layer(&em->fdata, CD_MTFACE)) {
-			EM_add_data_layer(em, &em->fdata, CD_MTFACE, NULL);
-			update= 1;
+		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);
+			update = 1;
 		}
 
 		/* now assign to all visible faces */
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+		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(scene, previma, efa, tf)) {
-				if(ima) {
-					tf->tpage= ima;
+			if (uvedit_face_visible_test(scene, previma, efa, tf)) {
+				if (ima) {
+					tf->tpage = ima;
 					
-					if(ima->id.us==0) id_us_plus(&ima->id);
+					if (ima->id.us == 0) id_us_plus(&ima->id);
 					else id_lib_extern(&ima->id);
 				}
-				else
-					tf->tpage= NULL;
+				else {
+					tf->tpage = NULL;
+				}
 
 				update = 1;
 			}
 		}
 
 		/* and update depdency graph */
-		if(update)
+		if (update)
 			DAG_id_tag_update(obedit->data, 0);
 	}
 
-	BKE_mesh_end_editmesh(obedit->data, em);
 }
 
-/* dotile -	1, set the tile flag (from the space image)
- * 			2, set the tile index for the faces. */
+/* dotile - 1, set the tile flag (from the space image)
+ *          2, set the tile index for the faces. */
 static int uvedit_set_tile(Object *obedit, Image *ima, int curtile)
 {
-	EditMesh *em;
-	EditFace *efa;
-	MTFace *tf;
+	BMEditMesh *em;
+	BMFace *efa;
+	BMIter iter;
+	MTexPoly *tf;
 	
 	/* verify if we have something to do */
-	if(!ima || !ED_uvedit_test(obedit))
+	if (!ima || !ED_uvedit_test(obedit))
 		return 0;
 
-	if((ima->tpageflag & IMA_TILES) == 0)
+	if ((ima->tpageflag & IMA_TILES) == 0)
 		return 0;
 
 	/* skip assigning these procedural images... */
-	if(ima->type==IMA_TYPE_R_RESULT || ima->type==IMA_TYPE_COMPOSITE)
+	if (ima->type == IMA_TYPE_R_RESULT || ima->type == IMA_TYPE_COMPOSITE)
 		return 0;
 	
-	em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
+	em = BMEdit_FromObject(obedit);
 
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+		tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
 
-		if(efa->h==0 && efa->f & SELECT)
-			tf->tile= curtile; /* set tile index */
+		if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && BM_elem_flag_test(efa, BM_ELEM_SELECT))
+			tf->tile = curtile;  /* set tile index */
 	}
 
 	DAG_id_tag_update(obedit->data, 0);
-	BKE_mesh_end_editmesh(obedit->data, em);
 
 	return 1;
 }
@@ -259,172 +269,252 @@ static void uvedit_pixel_to_float(SpaceImage *sima, float *dist, float pixeldist
 {
 	int width, height;
 
-	if(sima) {
+	if (sima) {
 		ED_space_image_size(sima, &width, &height);
 	}
 	else {
-		width= 256;
-		height= 256;
+		width = 256;
+		height = 256;
 	}
 
-	dist[0]= pixeldist/width;
-	dist[1]= pixeldist/height;
+	dist[0] = pixeldist / width;
+	dist[1] = pixeldist / height;
 }
 
 /*************** visibility and selection utilities **************/
 
-int uvedit_face_visible_nolocal(Scene *scene, EditFace *efa)
+int uvedit_face_visible_nolocal(Scene *scene, BMFace *efa)
 {
-	ToolSettings *ts= scene->toolsettings;
+	ToolSettings *ts = scene->toolsettings;
 
-	if(ts->uv_flag & UV_SYNC_SELECTION)
-		return (efa->h==0);
+	if (ts->uv_flag & UV_SYNC_SELECTION)
+		return (BM_elem_flag_test(efa, BM_ELEM_HIDDEN) == 0);
 	else
-		return (efa->h==0 && (efa->f & SELECT));
+		return (BM_elem_flag_test(efa, BM_ELEM_HIDDEN) == 0 && BM_elem_flag_test(efa, BM_ELEM_SELECT));
 }
 
-int uvedit_face_visible(Scene *scene, Image *ima, EditFace *efa, MTFace *tf)
+int uvedit_face_visible_test(Scene *scene, Image *ima, BMFace *efa, MTexPoly *tf)
 {
-	ToolSettings *ts= scene->toolsettings;
+	ToolSettings *ts = scene->toolsettings;
 
-	if(ts->uv_flag & UV_SHOW_SAME_IMAGE)
-		return (tf->tpage==ima)? uvedit_face_visible_nolocal(scene, efa): 0;
+	if (ts->uv_flag & UV_SHOW_SAME_IMAGE)
+		return (tf->tpage == ima) ? uvedit_face_visible_nolocal(scene, efa) : 0;
 	else
 		return uvedit_face_visible_nolocal(scene, efa);
 }
 
-int uvedit_face_selected(Scene *scene, EditFace *efa, MTFace *tf)
+int uvedit_face_select_test(Scene *scene, BMEditMesh *em, BMFace *efa)
 {
-	ToolSettings *ts= scene->toolsettings;
+	ToolSettings *ts = scene->toolsettings;
 
-	if(ts->uv_flag & UV_SYNC_SELECTION)
-		return (efa->f & SELECT);
-	else
-		return (!(~tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3)) &&(!efa->v4 || tf->flag & TF_SEL4));
+	if (ts->uv_flag & UV_SYNC_SELECTION)
+		return (BM_elem_flag_test(efa, BM_ELEM_SELECT));
+	else {
+		BMLoop *l;
+		MLoopUV *luv;
+		BMIter liter;
+
+		BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+			luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+			if (!(luv->flag & MLOOPUV_VERTSEL))
+				return 0;
+		}
+
+		return 1;
+	}
 }
 
-void uvedit_face_select(Scene *scene, EditFace *efa, MTFace *tf)
+int uvedit_face_select_enable(Scene *scene, BMEditMesh *em, BMFace *efa, const short do_history)
 {
-	ToolSettings *ts= scene->toolsettings;
+	ToolSettings *ts = scene->toolsettings;
 
-	if(ts->uv_flag & UV_SYNC_SELECTION)
-		EM_select_face(efa, 1);
-	else
-		tf->flag |= (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
+	if (ts->uv_flag & UV_SYNC_SELECTION) {
+		BM_face_select_set(em->bm, efa, TRUE);
+		if (do_history) {
+			BM_select_history_store(em->bm, (BMElem *)efa);
+		}
+	}
+	else {
+		BMLoop *l;
+		MLoopUV *luv;
+		BMIter liter;
+
+		BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+			luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+			luv->flag |= MLOOPUV_VERTSEL;
+		}
+
+		return 1;
+	}
+
+	return 0;
 }
 
-void uvedit_face_deselect(Scene *scene, EditFace *efa, MTFace *tf)
+int uvedit_face_select_disable(Scene *scene, BMEditMesh *em, BMFace *efa)
 {
-	ToolSettings *ts= scene->toolsettings;
+	ToolSettings *ts = scene->toolsettings;
 
-	if(ts->uv_flag & UV_SYNC_SELECTION)
-		EM_select_face(efa, 0);
-	else
-		tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
+	if (ts->uv_flag & UV_SYNC_SELECTION) {
+		BM_face_select_set(em->bm, efa, FALSE);
+	}
+	else {
+		BMLoop *l;
+		MLoopUV *luv;
+		BMIter liter;
+
+		BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+			luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+			luv->flag &= ~MLOOPUV_VERTSEL;
+		}
+
+		return 1;
+	}
+
+	return 0;
 }
 
-int uvedit_edge_selected(Scene *scene, EditFace *efa, MTFace *tf, int i)
+int uvedit_edge_select_test(BMEditMesh *em, Scene *scene, BMLoop *l)
 {
-	ToolSettings *ts= scene->toolsettings;
-	int nvert= (efa->v4)? 4: 3;
+	ToolSettings *ts = scene->toolsettings;
 
-	if(ts->uv_flag & UV_SYNC_SELECTION) {
-		if(ts->selectmode & SCE_SELECT_FACE)
-			return (efa->f & SELECT);
-		else if(ts->selectmode & SCE_SELECT_EDGE)
-			return (*(&efa->e1 + i))->f & SELECT;
-		else
-			return (((efa->v1 + i)->f & SELECT) && ((efa->v1 + (i+1)%nvert)->f & SELECT));
+	if (ts->uv_flag & UV_SYNC_SELECTION) {
+		if (ts->selectmode & SCE_SELECT_FACE) {
+			return BM_elem_flag_test(l->f, BM_ELEM_SELECT);
+		}
+		else if (ts->selectmode == SCE_SELECT_EDGE) {
+			return BM_elem_flag_test(l->e, BM_ELEM_SELECT);
+		}
+		else {
+			return BM_elem_flag_test(l->v, BM_ELEM_SELECT) && 
+			       BM_elem_flag_test(l->next->v, BM_ELEM_SELECT);
+		}
+	}
+	else {
+		MLoopUV *luv1, *luv2;
+
+		luv1 = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+		luv2 = CustomData_bmesh_get(&em->bm->ldata, l->next->head.data, CD_MLOOPUV);
+
+		return (luv1->flag & MLOOPUV_VERTSEL) && (luv2->flag & MLOOPUV_VERTSEL);
 	}
-	else
-		return (tf->flag & TF_SEL_MASK(i)) && (tf->flag & TF_SEL_MASK((i+1)%nvert));
 }
 
-void uvedit_edge_select(Scene *scene, EditFace *efa, MTFace *tf, int i)
+void uvedit_edge_select_enable(BMEditMesh *em, Scene *scene, BMLoop *l, const short do_history)
+
 {
-	ToolSettings *ts= scene->toolsettings;
-	int nvert= (efa->v4)? 4: 3;
+	ToolSettings *ts = scene->toolsettings;
 
-	if(ts->uv_flag & UV_SYNC_SELECTION) {
-		if(ts->selectmode & SCE_SELECT_FACE)
-			EM_select_face(efa, 1);
-		else if(ts->selectmode & SCE_SELECT_EDGE)
-			EM_select_edge((*(&efa->e1 + i)), 1);
+	if (ts->uv_flag & UV_SYNC_SELECTION) {
+		if (ts->selectmode & SCE_SELECT_FACE)
+			BM_face_select_set(em->bm, l->f, TRUE);
+		else if (ts->selectmode & SCE_SELECT_EDGE)
+			BM_edge_select_set(em->bm, l->e, TRUE);
 		else {
-			(efa->v1 + i)->f |= SELECT;
-			(efa->v1 + (i+1)%nvert)->f |= SELECT;
+			BM_vert_select_set(em->bm, l->e->v1, TRUE);
+			BM_vert_select_set(em->bm, l->e->v2, TRUE);
+		}
+
+		if (do_history) {
+			BM_select_history_store(em->bm, (BMElem *)l->e);
 		}
 	}
-	else
-		tf->flag |= TF_SEL_MASK(i)|TF_SEL_MASK((i+1)%nvert);
+	else {
+		MLoopUV *luv1, *luv2;
+
+		luv1 = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+		luv2 = CustomData_bmesh_get(&em->bm->ldata, l->next->head.data, CD_MLOOPUV);
+		
+		luv1->flag |= MLOOPUV_VERTSEL;
+		luv2->flag |= MLOOPUV_VERTSEL;
+	}
 }
 
-void uvedit_edge_deselect(Scene *scene, EditFace *efa, MTFace *tf, int i)
+void uvedit_edge_select_disable(BMEditMesh *em, Scene *scene, BMLoop *l)
+
 {
-	ToolSettings *ts= scene->toolsettings;
-	int nvert= (efa->v4)? 4: 3;
+	ToolSettings *ts = scene->toolsettings;
 
-	if(ts->uv_flag & UV_SYNC_SELECTION) {
-		if(ts->selectmode & SCE_SELECT_FACE)
-			EM_select_face(efa, 0);
-		else if(ts->selectmode & SCE_SELECT_EDGE)
-			EM_select_edge((*(&efa->e1 + i)), 0);
+	if (ts->uv_flag & UV_SYNC_SELECTION) {
+		if (ts->selectmode & SCE_SELECT_FACE)
+			BM_face_select_set(em->bm, l->f, FALSE);
+		else if (ts->selectmode & SCE_SELECT_EDGE)
+			BM_edge_select_set(em->bm, l->e, FALSE);
 		else {
-			(efa->v1 + i)->f &= ~SELECT;
-			(efa->v1 + (i+1)%nvert)->f &= ~SELECT;
+			BM_vert_select_set(em->bm, l->e->v1, FALSE);
+			BM_vert_select_set(em->bm, l->e->v2, FALSE);
 		}
 	}
-	else
-		tf->flag &= ~(TF_SEL_MASK(i)|TF_SEL_MASK((i+1)%nvert));
+	else {
+		MLoopUV *luv1, *luv2;
+
+		luv1 = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+		luv2 = CustomData_bmesh_get(&em->bm->ldata, l->next->head.data, CD_MLOOPUV);
+		
+		luv1->flag &= ~MLOOPUV_VERTSEL;
+		luv2->flag &= ~MLOOPUV_VERTSEL;
+	}
 }
 
-int uvedit_uv_selected(Scene *scene, EditFace *efa, MTFace *tf, int i)
+int uvedit_uv_select_test(BMEditMesh *em, Scene *scene, BMLoop *l)
 {
-	ToolSettings *ts= scene->toolsettings;
+	ToolSettings *ts = scene->toolsettings;
 
-	if(ts->uv_flag & UV_SYNC_SELECTION) {
-		if(ts->selectmode & SCE_SELECT_FACE)
-			return (efa->f & SELECT);
+	if (ts->uv_flag & UV_SYNC_SELECTION) {
+		if (ts->selectmode & SCE_SELECT_FACE)
+			return BM_elem_flag_test(l->f, BM_ELEM_SELECT);
 		else
-			return (*(&efa->v1 + i))->f & SELECT;
+			return BM_elem_flag_test(l->v, BM_ELEM_SELECT);
+	}
+	else {
+		MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+
+		return luv->flag & MLOOPUV_VERTSEL;
 	}
-	else
-		return tf->flag & TF_SEL_MASK(i);
 }
 
-void uvedit_uv_select(Scene *scene, EditFace *efa, MTFace *tf, int i)
+void uvedit_uv_select_enable(BMEditMesh *em, Scene *scene, BMLoop *l, const short do_history)
 {
-	ToolSettings *ts= scene->toolsettings;
+	ToolSettings *ts = scene->toolsettings;
 
-	if(ts->uv_flag & UV_SYNC_SELECTION) {
-		if(ts->selectmode & SCE_SELECT_FACE)
-			EM_select_face(efa, 1);
+	if (ts->uv_flag & UV_SYNC_SELECTION) {
+		if (ts->selectmode & SCE_SELECT_FACE)
+			BM_face_select_set(em->bm, l->f, TRUE);
 		else
-			(*(&efa->v1 + i))->f |= SELECT;
+			BM_vert_select_set(em->bm, l->v, TRUE);
+
+		if (do_history) {
+			BM_select_history_remove(em->bm, (BMElem *)l->v);
+		}
+	}
+	else {
+		MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+		
+		luv->flag |= MLOOPUV_VERTSEL;
 	}
-	else
-		tf->flag |= TF_SEL_MASK(i);
 }
 
-void uvedit_uv_deselect(Scene *scene, EditFace *efa, MTFace *tf, int i)
+void uvedit_uv_select_disable(BMEditMesh *em, Scene *scene, BMLoop *l)
 {
-	ToolSettings *ts= scene->toolsettings;
+	ToolSettings *ts = scene->toolsettings;
 
-	if(ts->uv_flag & UV_SYNC_SELECTION) {
-		if(ts->selectmode & SCE_SELECT_FACE)
-			EM_select_face(efa, 0);
+	if (ts->uv_flag & UV_SYNC_SELECTION) {
+		if (ts->selectmode & SCE_SELECT_FACE)
+			BM_face_select_set(em->bm, l->f, FALSE);
 		else
-			(*(&efa->v1 + i))->f &= ~SELECT;
+			BM_vert_select_set(em->bm, l->v, FALSE);
+	}
+	else {
+		MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+		
+		luv->flag &= ~MLOOPUV_VERTSEL;
 	}
-	else
-		tf->flag &= ~TF_SEL_MASK(i);
 }
 
 /*********************** live unwrap utilities ***********************/
 
 void uvedit_live_unwrap_update(SpaceImage *sima, Scene *scene, Object *obedit)
 {
-	if(sima && (sima->flag & SI_LIVE_UNWRAP)) {
+	if (sima && (sima->flag & SI_LIVE_UNWRAP)) {
 		ED_uvedit_live_unwrap_begin(scene, obedit);
 		ED_uvedit_live_unwrap_re_solve();
 		ED_uvedit_live_unwrap_end(0);
@@ -432,10 +522,26 @@ void uvedit_live_unwrap_update(SpaceImage *sima, Scene *scene, Object *obedit)
 }
 
 /*********************** geometric utilities ***********************/
+void poly_uv_center(BMEditMesh *em, BMFace *f, float cent[2])
+{
+	BMLoop *l;
+	MLoopUV *luv;
+	BMIter liter;
+
+	zero_v2(cent);
+
+	BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+		luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+		add_v2_v2(cent, luv->uv);
+	}
+
+	mul_v2_fl(cent, 1.0f / (float)f->len);
+}
+
 
 void uv_center(float uv[][2], float cent[2], int quad)
 {
-	if(quad) {
+	if (quad) {
 		cent[0] = (uv[0][0] + uv[1][0] + uv[2][0] + uv[3][0]) / 4.0f;
 		cent[1] = (uv[0][1] + uv[1][1] + uv[2][1] + uv[3][1]) / 4.0f;
 	}
@@ -447,353 +553,414 @@ void uv_center(float uv[][2], float cent[2], int quad)
 
 float uv_area(float uv[][2], int quad)
 {
-	if(quad)
+	if (quad)
 		return area_tri_v2(uv[0], uv[1], uv[2]) + area_tri_v2(uv[0], uv[2], uv[3]); 
 	else
 		return area_tri_v2(uv[0], uv[1], uv[2]); 
 }
 
-void uv_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy)
+float poly_uv_area(float uv[][2], int len)
 {
-	uv[0][0] = uv_orig[0][0]*aspx;
-	uv[0][1] = uv_orig[0][1]*aspy;
-	
-	uv[1][0] = uv_orig[1][0]*aspx;
-	uv[1][1] = uv_orig[1][1]*aspy;
-	
-	uv[2][0] = uv_orig[2][0]*aspx;
-	uv[2][1] = uv_orig[2][1]*aspy;
-	
-	uv[3][0] = uv_orig[3][0]*aspx;
-	uv[3][1] = uv_orig[3][1]*aspy;
+	//BMESH_TODO: make this not suck
+	//maybe use scanfill? I dunno.
+
+	if (len >= 4)
+		return area_tri_v2(uv[0], uv[1], uv[2]) + area_tri_v2(uv[0], uv[2], uv[3]); 
+	else
+		return area_tri_v2(uv[0], uv[1], uv[2]); 
+
+	return 1.0;
+}
+
+void poly_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy, int len)
+{
+	int i;
+	for (i = 0; i < len; i++) {
+		uv[i][0] = uv_orig[i][0] * aspx;
+		uv[i][1] = uv_orig[i][1] * aspy;
+	}
 }
 
 int ED_uvedit_minmax(Scene *scene, Image *ima, Object *obedit, float *min, float *max)
 {
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	EditFace *efa;
-	MTFace *tf;
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	MTexPoly *tf;
+	MLoopUV *luv;
 	int sel;
 
 	INIT_MINMAX2(min, max);
 
-	sel= 0;
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-		if(uvedit_face_visible(scene, ima, efa, tf)) {
-			if(uvedit_uv_selected(scene, efa, tf, 0))				{ DO_MINMAX2(tf->uv[0], min, max); sel = 1; }
-			if(uvedit_uv_selected(scene, efa, tf, 1))				{ DO_MINMAX2(tf->uv[1], min, max); sel = 1; }
-			if(uvedit_uv_selected(scene, efa, tf, 2))				{ DO_MINMAX2(tf->uv[2], min, max); sel = 1; }
-			if(efa->v4 && (uvedit_uv_selected(scene, efa, tf, 3)))	{ DO_MINMAX2(tf->uv[3], min, max); sel = 1; }
+	sel = 0;
+	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)) {
+				luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+				DO_MINMAX2(luv->uv, min, max); 
+				sel = 1;
+			}
 		}
 	}
-	
-	BKE_mesh_end_editmesh(obedit->data, em);
+
 	return sel;
 }
 
-static int ED_uvedit_median(Scene *scene, Image *ima, Object *obedit, float co[3])
+static int ED_uvedit_median(Scene *scene, Image *ima, Object *obedit, float co[2])
 {
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	EditFace *efa;
-	MTFace *tf;
-	unsigned int sel= 0;
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	MTexPoly *tf;
+	MLoopUV *luv;
+	unsigned int sel = 0;
 
-	zero_v3(co);
-
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-		if(uvedit_face_visible(scene, ima, efa, tf)) {
-			if(uvedit_uv_selected(scene, efa, tf, 0))				{ add_v3_v3(co, tf->uv[0]); sel++; }
-			if(uvedit_uv_selected(scene, efa, tf, 1))				{ add_v3_v3(co, tf->uv[1]); sel++; }
-			if(uvedit_uv_selected(scene, efa, tf, 2))				{ add_v3_v3(co, tf->uv[2]); sel++; }
-			if(efa->v4 && (uvedit_uv_selected(scene, efa, tf, 3)))	{ add_v3_v3(co, tf->uv[3]); sel++; }
+	zero_v2(co);
+	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) {
+			luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+			if (uvedit_uv_select_test(em, scene, l)) {
+				add_v2_v2(co, luv->uv);
+				sel++;
+			}
 		}
 	}
 
-	mul_v3_fl(co, 1.0f/(float)sel);
+	mul_v2_fl(co, 1.0f / (float)sel);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
 	return (sel != 0);
 }
 
-static int uvedit_center(Scene *scene, Image *ima, Object *obedit, float *cent, char mode)
+static int uvedit_center(Scene *scene, Image *ima, Object *obedit, float cent[2], char mode)
 {
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	float min[2], max[2];
-	int change= 0;
+	int change = FALSE;
 	
-	if(mode==V3D_CENTER) { /* bounding box */
-		if(ED_uvedit_minmax(scene, ima, obedit, min, max)) {
-			change = 1;
-
-			cent[0]= (min[0]+max[0])/2.0f;
-			cent[1]= (min[1]+max[1])/2.0f;
+	if (mode == V3D_CENTER) {  /* bounding box */
+		float min[2], max[2];
+		if (ED_uvedit_minmax(scene, ima, obedit, min, max)) {
+			mid_v2_v2v2(cent, min, max);
+			change = TRUE;
 		}
 	}
 	else {
-		if(ED_uvedit_median(scene, ima, obedit, cent)) {
-			change = 1;
+		if (ED_uvedit_median(scene, ima, obedit, cent)) {
+			change = TRUE;
 		}
-
-	}
-
-	if(change) {
-		BKE_mesh_end_editmesh(obedit->data, em);
-		return 1;
 	}
 
-	BKE_mesh_end_editmesh(obedit->data, em);
-	return 0;
+	return change;
 }
 
 /************************** find nearest ****************************/
 
-void uv_find_nearest_edge(Scene *scene, Image *ima, EditMesh *em, float co[2], NearestHit *hit)
+void uv_find_nearest_edge(Scene *scene, Image *ima, BMEditMesh *em, float co[2], NearestHit *hit)
 {
-	MTFace *tf;
-	EditFace *efa;
-	EditVert *eve;
+	MTexPoly *tf;
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	MLoopUV *luv, *nextluv;
 	float mindist, dist;
-	int i, nverts;
+	int i;
 
-	mindist= 1e10f;
+	mindist = 1e10f;
 	memset(hit, 0, sizeof(*hit));
 
-	for(i=0, eve=em->verts.first; eve; eve=eve->next, i++)
-		eve->tmp.l = i;
+	BM_mesh_elem_index_ensure(em->bm, BM_VERT);
 	
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
-		if(uvedit_face_visible(scene, ima, efa, tf)) {
-			nverts= efa->v4? 4: 3;
-
-			for(i=0; i<nverts; i++) {
-				dist= dist_to_line_segment_v2(co, tf->uv[i], tf->uv[(i+1)%nverts]);
+	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;
+		
+		i = 0;
+		BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+			luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+			nextluv = CustomData_bmesh_get(&em->bm->ldata, l->next->head.data, CD_MLOOPUV);
 
-				if(dist < mindist) {
-					hit->tf= tf;
-					hit->efa= efa;
-					hit->edge= i;
-					mindist= dist;
+			dist = dist_to_line_segment_v2(co, luv->uv, nextluv->uv);
 
-					hit->vert= (*(&efa->v1 + i))->tmp.l;
-					hit->vert2= (*(&efa->v1 + ((i+1)%nverts)))->tmp.l;
-				}
+			if (dist < mindist) {
+				hit->tf = tf;
+				hit->efa = efa;
+				
+				hit->l = l;
+				hit->nextl = l->next;
+				hit->luv = luv;
+				hit->nextluv = nextluv;
+				hit->lindex = i;
+				hit->vert1 = BM_elem_index_get(hit->l->v);
+				hit->vert2 = BM_elem_index_get(hit->l->next->v);
+
+				mindist = dist;
 			}
+
+			i++;
 		}
 	}
 }
 
-static void find_nearest_uv_face(Scene *scene, Image *ima, EditMesh *em, float co[2], NearestHit *hit)
+static void find_nearest_uv_face(Scene *scene, Image *ima, BMEditMesh *em, float co[2], NearestHit *hit)
 {
-	MTFace *tf;
-	EditFace *efa;
+	MTexPoly *tf;
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	MLoopUV *luv;
 	float mindist, dist, cent[2];
-	int i, nverts;
 
-	mindist= 1e10f;
+	mindist = 1e10f;
 	memset(hit, 0, sizeof(*hit));
-	
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
 
-		if(uvedit_face_visible(scene, ima, efa, tf)) {
-			nverts= efa->v4? 4: 3;
-			cent[0]= cent[1]= 0.0f;
+	/*this will fill in hit.vert1 and hit.vert2*/
+	uv_find_nearest_edge(scene, ima, em, co, hit);
+	hit->l = hit->nextl = NULL;
+	hit->luv = hit->nextluv = NULL;
 
-			for(i=0; i<nverts; i++) {
-				add_v2_v2(cent, tf->uv[i]);
-			}
+	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;
+		
+		cent[0] = cent[1] = 0.0f;
+		BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+			luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
 
-			cent[0] /= nverts;
-			cent[1] /= nverts;
-			dist= fabs(co[0]- cent[0]) + fabs(co[1]- cent[1]);
+			add_v2_v2(cent, luv->uv);
+		}
 
-			if(dist < mindist) {
-				hit->tf= tf;
-				hit->efa= efa;
-				mindist= dist;
-			}
+		cent[0] /= efa->len;
+		cent[1] /= efa->len;
+		dist = fabs(co[0] - cent[0]) + fabs(co[1] - cent[1]);
+
+		if (dist < mindist) {
+			hit->tf = tf;
+			hit->efa = efa;
+			mindist = dist;
 		}
 	}
 }
 
-static int nearest_uv_between(MTFace *tf, int nverts, int id, float co[2], float uv[2])
+static int nearest_uv_between(BMEditMesh *em, BMFace *efa, int UNUSED(nverts), int id,
+                              float co[2], float uv[2])
 {
-	float m[3], v1[3], v2[3], c1, c2;
-	int id1, id2;
+	BMLoop *l;
+	MLoopUV *luv;
+	BMIter iter;
+	float m[3], v1[3], v2[3], c1, c2, *uv1, /* *uv2, */ /* UNUSED */ *uv3;
+	int id1, id2, i;
 
-	id1= (id+nverts-1)%nverts;
-	id2= (id+nverts+1)%nverts;
+	id1 = (id + efa->len - 1) % efa->len;
+	id2 = (id + efa->len + 1) % efa->len;
 
-	m[0]= co[0]-uv[0];
-	m[1]= co[1]-uv[1];
-	sub_v2_v2v2(v1, tf->uv[id1], tf->uv[id]);
-	sub_v2_v2v2(v2, tf->uv[id2], tf->uv[id]);
+	m[0] = co[0] - uv[0];
+	m[1] = co[1] - uv[1];
+
+	i = 0;
+	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)
+			uv1 = luv->uv;
+		else if (i == id)
+			;  /* uv2 = luv->uv; */ /* UNUSED */
+		else if (i == id2)
+			uv3 = luv->uv;
+
+		i++;
+	}
+
+	sub_v3_v3v3(v1, uv1, uv);
+	sub_v3_v3v3(v2, uv3, uv);
 
 	/* m and v2 on same side of v-v1? */
-	c1= v1[0]*m[1] - v1[1]*m[0];
-	c2= v1[0]*v2[1] - v1[1]*v2[0];
+	c1 = v1[0] * m[1] - v1[1] * m[0];
+	c2 = v1[0] * v2[1] - v1[1] * v2[0];
 
-	if(c1*c2 < 0.0f)
+	if (c1 * c2 < 0.0f)
 		return 0;
 
 	/* m and v1 on same side of v-v2? */
-	c1= v2[0]*m[1] - v2[1]*m[0];
-	c2= v2[0]*v1[1] - v2[1]*v1[0];
+	c1 = v2[0] * m[1] - v2[1] * m[0];
+	c2 = v2[0] * v1[1] - v2[1] * v1[0];
 
-	return (c1*c2 >= 0.0f);
+	return (c1 * c2 >= 0.0f);
 }
 
-void uv_find_nearest_vert(Scene *scene, Image *ima, EditMesh *em, float co[2], float penalty[2], NearestHit *hit)
+void uv_find_nearest_vert(Scene *scene, Image *ima, BMEditMesh *em,
+                          float co[2], float penalty[2], NearestHit *hit)
 {
-	EditFace *efa;
-	EditVert *eve;
-	MTFace *tf;
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	MTexPoly *tf;
+	MLoopUV *luv;
 	float mindist, dist;
-	int i, nverts;
+	int i;
 
-	mindist= 1e10f;
+	/*this will fill in hit.vert1 and hit.vert2*/
+	uv_find_nearest_edge(scene, ima, em, co, hit);
+	hit->l = hit->nextl = NULL;
+	hit->luv = hit->nextluv = NULL;
+
+	mindist = 1e10f;
 	memset(hit, 0, sizeof(*hit));
 	
-	for(i=0, eve=em->verts.first; eve; eve=eve->next, i++)
-		eve->tmp.l = i;
-	
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+	BM_mesh_elem_index_ensure(em->bm, BM_VERT);
 
-		if(uvedit_face_visible(scene, ima, efa, tf)) {
-			nverts= efa->v4? 4: 3;
-
-			for(i=0; i<nverts; i++) {
-				if(penalty && uvedit_uv_selected(scene, efa, tf, i))
-					dist= fabsf(co[0]-tf->uv[i][0])+penalty[0] + fabsf(co[1]-tf->uv[i][1]) + penalty[1];
-				else
-					dist= fabsf(co[0]-tf->uv[i][0]) + fabsf(co[1]-tf->uv[i][1]);
+	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;
+		
+		i = 0;
+		BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+			luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
 
-				if(dist<=mindist) {
-					if(dist==mindist)
-						if(!nearest_uv_between(tf, nverts, i, co, tf->uv[i]))
-							continue;
+			if (penalty && uvedit_uv_select_test(em, scene, l))
+				dist = fabs(co[0] - luv->uv[0]) + penalty[0] + fabs(co[1] - luv->uv[1]) + penalty[1];
+			else
+				dist = fabs(co[0] - luv->uv[0]) + fabs(co[1] - luv->uv[1]);
 
-					mindist= dist;
+			if (dist <= mindist) {
+				if (dist == mindist)
+					if (!nearest_uv_between(em, efa, efa->len, i, co, luv->uv)) {
+						i++;
+						continue;
+					}
 
-					hit->uv= i;
-					hit->tf= tf;
-					hit->efa= efa;
+				mindist = dist;
 
-					hit->vert= (*(&efa->v1 + i))->tmp.l;
-				}
+				hit->l = l;
+				hit->nextl = l->next;
+				hit->luv = luv;
+				hit->nextluv = CustomData_bmesh_get(&em->bm->ldata, l->next->head.data, CD_MLOOPUV);
+				hit->tf = tf;
+				hit->efa = efa;
+				hit->lindex = i;
+				hit->vert1 = BM_elem_index_get(hit->l->v);
 			}
+
+			i++;
 		}
 	}
 }
 
 int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, float co[2], float uv[2])
 {
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	EditFace *efa;
-	MTFace *tf;
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	MTexPoly *tf;
+	MLoopUV *luv;
 	float mindist, dist;
-	int i, nverts, found= 0;
+	int found = 0;
 
-	mindist= 1e10f;
-	uv[0]= co[0];
-	uv[1]= co[1];
+	mindist = 1e10f;
+	uv[0] = co[0];
+	uv[1] = co[1];
 	
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
-		if(uvedit_face_visible(scene, ima, efa, tf)) {
-			nverts= efa->v4? 4: 3;
-
-			for(i=0; i<nverts; i++) {
-				if(uvedit_uv_selected(scene, efa, tf, i))
-					continue;
-
-				dist= fabs(co[0]-tf->uv[i][0]) + fabs(co[1]-tf->uv[i][1]);
+	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) {
+			luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+			dist = fabs(co[0] - luv->uv[0]) + fabs(co[1] - luv->uv[1]);
 
-				if(dist<=mindist) {
-					mindist= dist;
+			if (dist <= mindist) {
+				mindist = dist;
 
-					uv[0]= tf->uv[i][0];
-					uv[1]= tf->uv[i][1];
-					found= 1;
-				}
+				uv[0] = luv->uv[0];
+				uv[1] = luv->uv[1];
+				found = 1;
 			}
 		}
 	}
 
-	BKE_mesh_end_editmesh(obedit->data, em);
 	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 uv_vertex_loop_flag(UvMapVert *first)
+static void select_edgeloop_uv_vertex_loop_flag(UvMapVert *first)
 {
 	UvMapVert *iterv;
-	int count= 0;
+	int count = 0;
 
-	for(iterv=first; iterv; iterv=iterv->next) {
-		if(iterv->separate && iterv!=first)
+	for (iterv = first; iterv; iterv = iterv->next) {
+		if (iterv->separate && iterv != first)
 			break;
 
 		count++;
 	}
 	
-	if(count < 5)
-		first->flag= 1;
+	if (count < 5)
+		first->flag = 1;
 }
 
-static UvMapVert *uv_vertex_map_get(UvVertMap *vmap, EditFace *efa, int a)
+static UvMapVert *select_edgeloop_uv_vertex_map_get(UvVertMap *vmap, BMFace *efa, int a)
 {
 	UvMapVert *iterv, *first;
-	
-	first= EM_get_uv_map_vert(vmap, (*(&efa->v1 + a))->tmp.l);
+	BMLoop *l;
 
-	for(iterv=first; iterv; iterv=iterv->next) {
-		if(iterv->separate)
-			first= iterv;
-		if(iterv->f == efa->tmp.l)
+	l = BM_iter_at_index(NULL, BM_LOOPS_OF_FACE, efa, a);
+	first = EDBM_uv_vert_map_at_index(vmap,  BM_elem_index_get(l->v));
+
+	for (iterv = first; iterv; iterv = iterv->next) {
+		if (iterv->separate)
+			first = iterv;
+		if (iterv->f == BM_elem_index_get(efa))
 			return first;
 	}
 	
 	return NULL;
 }
 
-UvElement *ED_get_uv_element(UvElementMap *map, EditFace *efa, int index)
-{
-	UvElement *element = map->vert[(*(&efa->v1 + index))->tmp.l];
-
-	for(; element; element = element->next)
-		if(element->face == efa)
-			return element;
-
-	return NULL;
-}
-
-static int uv_edge_tag_faces(UvMapVert *first1, UvMapVert *first2, int *totface)
+static int select_edgeloop_uv_edge_tag_faces(BMEditMesh *em, UvMapVert *first1, UvMapVert *first2, int *totface)
 {
 	UvMapVert *iterv1, *iterv2;
-	EditFace *efa;
+	BMFace *efa;
 	int tot = 0;
 
 	/* count number of faces this edge has */
-	for(iterv1=first1; iterv1; iterv1=iterv1->next) {
-		if(iterv1->separate && iterv1 != first1)
+	for (iterv1 = first1; iterv1; iterv1 = iterv1->next) {
+		if (iterv1->separate && iterv1 != first1)
 			break;
 
-		for(iterv2=first2; iterv2; iterv2=iterv2->next) {
-			if(iterv2->separate && iterv2 != first2)
+		for (iterv2 = first2; iterv2; iterv2 = iterv2->next) {
+			if (iterv2->separate && iterv2 != first2)
 				break;
 
-			if(iterv1->f == iterv2->f) {
+			if (iterv1->f == iterv2->f) {
 				/* if face already tagged, don't do this edge */
-				efa= EM_get_face_for_index(iterv1->f);
-				if(efa->f1)
+				efa = EDBM_face_at_index(em, iterv1->f);
+				if (BM_elem_flag_test(efa, BM_ELEM_TAG))
 					return 0;
 
 				tot++;
@@ -802,23 +969,23 @@ static int uv_edge_tag_faces(UvMapVert *first1, UvMapVert *first2, int *totface)
 		}
 	}
 
-	if(*totface == 0) /* start edge */
-		*totface= tot;
-	else if(tot != *totface) /* check for same number of faces as start edge */
+	if (*totface == 0) /* start edge */
+		*totface = tot;
+	else if (tot != *totface) /* check for same number of faces as start edge */
 		return 0;
 
 	/* tag the faces */
-	for(iterv1=first1; iterv1; iterv1=iterv1->next) {
-		if(iterv1->separate && iterv1 != first1)
+	for (iterv1 = first1; iterv1; iterv1 = iterv1->next) {
+		if (iterv1->separate && iterv1 != first1)
 			break;
 
-		for(iterv2=first2; iterv2; iterv2=iterv2->next) {
-			if(iterv2->separate && iterv2 != first2)
+		for (iterv2 = first2; iterv2; iterv2 = iterv2->next) {
+			if (iterv2->separate && iterv2 != first2)
 				break;
 
-			if(iterv1->f == iterv2->f) {
-				efa= EM_get_face_for_index(iterv1->f);
-				efa->f1= 1;
+			if (iterv1->f == iterv2->f) {
+				efa = EDBM_face_at_index(em, iterv1->f);
+				BM_elem_flag_enable(efa, BM_ELEM_TAG);
 				break;
 			}
 		}
@@ -827,69 +994,70 @@ static int uv_edge_tag_faces(UvMapVert *first1, UvMapVert *first2, int *totface)
 	return 1;
 }
 
-static int select_edgeloop(Scene *scene, Image *ima, EditMesh *em, NearestHit *hit, float limit[2], int extend)
+static int select_edgeloop(Scene *scene, Image *ima, BMEditMesh *em, NearestHit *hit,
+                           float limit[2], const short extend)
 {
-	EditVert *eve;
-	EditFace *efa;
-	MTFace *tf;
+	BMFace *efa;
+	BMIter iter, liter;
+	BMLoop *l;
+	MTexPoly *tf;
 	UvVertMap *vmap;
 	UvMapVert *iterv1, *iterv2;
-	int a, count, looking, nverts, starttotf, select;
+	int a, looking, nverts, starttotf, select;
 
 	/* setup */
-	EM_init_index_arrays(em, 0, 0, 1);
-	vmap= EM_make_uv_vert_map(em, 0, 0, limit);
+	EDBM_index_arrays_init(em, 0, 0, 1);
+	vmap = EDBM_uv_vert_map_create(em, 0, 0, limit);
 
-	for(count=0, eve=em->verts.first; eve; count++, eve= eve->next)
-		eve->tmp.l = count;
+	BM_mesh_elem_index_ensure(em->bm, BM_VERT | BM_FACE);
 
-	for(count=0, efa= em->faces.first; efa; count++, efa= efa->next) {
-		if(!extend) {
-			tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-			uvedit_face_deselect(scene, efa, tf);
-		}
-
-		efa->tmp.l= count;
-		efa->f1= 0;
+	if (!extend) {
+		select_all_perform(scene, ima, em, SEL_DESELECT);
 	}
-	
+
+	BM_mesh_elem_hflag_disable_all(em->bm, BM_FACE, BM_ELEM_TAG, FALSE);
+
 	/* set flags for first face and verts */
-	nverts= (hit->efa->v4)? 4: 3;
-	iterv1= uv_vertex_map_get(vmap, hit->efa, hit->edge);
-	iterv2= uv_vertex_map_get(vmap, hit->efa, (hit->edge+1)%nverts);
-	uv_vertex_loop_flag(iterv1);
-	uv_vertex_loop_flag(iterv2);
+	nverts = hit->efa->len;
+	iterv1 = select_edgeloop_uv_vertex_map_get(vmap, hit->efa, hit->lindex);
+	iterv2 = select_edgeloop_uv_vertex_map_get(vmap, hit->efa, (hit->lindex + 1) % nverts);
+	select_edgeloop_uv_vertex_loop_flag(iterv1);
+	select_edgeloop_uv_vertex_loop_flag(iterv2);
 
-	starttotf= 0;
-	uv_edge_tag_faces(iterv1, iterv2, &starttotf);
+	starttotf = 0;
+	select_edgeloop_uv_edge_tag_faces(em, iterv1, iterv2, &starttotf);
 
-	/* sorry, first edge isnt even ok */
-	if(iterv1->flag==0 && iterv2->flag==0) looking= 0;
-	else looking= 1;
+	/* sorry, first edge isn't even ok */
+	if (iterv1->flag == 0 && iterv2->flag == 0) looking = 0;
+	else looking = 1;
 
 	/* iterate */
-	while(looking) {
-		looking= 0;
+	while (looking) {
+		looking = 0;
 
 		/* find correct valence edges which are not tagged yet, but connect to tagged one */
-		for(efa= em->faces.first; efa; efa=efa->next) {
-			tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
 
-			if(!efa->f1 && uvedit_face_visible(scene, ima, efa, tf)) {
-				nverts= (efa->v4)? 4: 3;
-				for(a=0; a<nverts; a++) {
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
+
+			if (!BM_elem_flag_test(efa, BM_ELEM_TAG) && uvedit_face_visible_test(scene, ima, efa, tf)) {
+				nverts = efa->len;
+				for (a = 0; a < nverts; a++) {
 					/* check face not hidden and not tagged */
-					iterv1= uv_vertex_map_get(vmap, efa, a);
-					iterv2= uv_vertex_map_get(vmap, efa, (a+1)%nverts);
+					iterv1 = select_edgeloop_uv_vertex_map_get(vmap, efa, a);
+					iterv2 = select_edgeloop_uv_vertex_map_get(vmap, efa, (a + 1) % nverts);
+					
+					if (!iterv1 || !iterv2)
+						continue;
 
 					/* check if vertex is tagged and has right valence */
-					if(iterv1->flag || iterv2->flag) {
-						if(uv_edge_tag_faces(iterv1, iterv2, &starttotf)) {
-							looking= 1;
-							efa->f1= 1;
+					if (iterv1->flag || iterv2->flag) {
+						if (select_edgeloop_uv_edge_tag_faces(em, iterv1, iterv2, &starttotf)) {
+							looking = 1;
+							BM_elem_flag_enable(efa, BM_ELEM_TAG);
 
-							uv_vertex_loop_flag(iterv1);
-							uv_vertex_loop_flag(iterv2);
+							select_edgeloop_uv_vertex_loop_flag(iterv1);
+							select_edgeloop_uv_vertex_loop_flag(iterv2);
 							break;
 						}
 					}
@@ -899,163 +1067,239 @@ static int select_edgeloop(Scene *scene, Image *ima, EditMesh *em, NearestHit *h
 	}
 
 	/* do the actual select/deselect */
-	nverts= (hit->efa->v4)? 4: 3;
-	iterv1= uv_vertex_map_get(vmap, hit->efa, hit->edge);
-	iterv2= uv_vertex_map_get(vmap, hit->efa, (hit->edge+1)%nverts);
-	iterv1->flag= 1;
-	iterv2->flag= 1;
-
-	if(extend) {
-		tf= CustomData_em_get(&em->fdata, hit->efa->data, CD_MTFACE);
-
-		if(uvedit_uv_selected(scene, hit->efa, tf, hit->edge))
-			select= 0;
+	nverts = hit->efa->len;
+	iterv1 = select_edgeloop_uv_vertex_map_get(vmap, hit->efa, hit->lindex);
+	iterv2 = select_edgeloop_uv_vertex_map_get(vmap, hit->efa, (hit->lindex + 1) % nverts);
+	iterv1->flag = 1;
+	iterv2->flag = 1;
+
+	if (extend) {
+		if (uvedit_uv_select_test(em, scene, hit->l))
+			select = 0;
 		else
-			select= 1;
+			select = 1;
 	}
 	else
-		select= 1;
+		select = 1;
 	
-	for(efa= em->faces.first; efa; efa=efa->next) {
-		tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+		a = 0;
+		BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+			iterv1 = select_edgeloop_uv_vertex_map_get(vmap, efa, a);
 
-		nverts= (efa->v4)? 4: 3;
-		for(a=0; a<nverts; a++) {
-			iterv1= uv_vertex_map_get(vmap, efa, a);
-
-			if(iterv1->flag) {
-				if(select) uvedit_uv_select(scene, efa, tf, a);
-				else uvedit_uv_deselect(scene, efa, tf, a);
+			if (iterv1->flag) {
+				if (select) uvedit_uv_select_enable(em, scene, l, FALSE);
+				else uvedit_uv_select_disable(em, scene, l);
 			}
+
+			a++;
 		}
 	}
 
 	/* cleanup */
-	EM_free_uv_vert_map(vmap);
-	EM_free_index_arrays();
+	EDBM_uv_vert_map_free(vmap);
+	EDBM_index_arrays_free(em);
 
-	return (select)? 1: -1;
+	return (select) ? 1 : -1;
 }
 
 /*********************** linked select ***********************/
 
-static void select_linked(Scene *scene, Image *ima, EditMesh *em, float limit[2], NearestHit *hit, int extend)
+static void select_linked(Scene *scene, Image *ima, BMEditMesh *em, float limit[2], NearestHit *hit, int extend)
 {
-	EditFace *efa;
-	MTFace *tf;
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	MTexPoly *tf;
+	MLoopUV *luv;
 	UvVertMap *vmap;
 	UvMapVert *vlist, *iterv, *startv;
-	int i, nverts, stacksize= 0, *stack;
+	int i, stacksize = 0, *stack;
 	unsigned int a;
 	char *flag;
 
-	EM_init_index_arrays(em, 0, 0, 1); /* we can use this too */
-	vmap= EM_make_uv_vert_map(em, 1, 0, limit);
-	if(vmap == NULL)
+	EDBM_index_arrays_init(em, 0, 0, 1); /* we can use this too */
+	vmap = EDBM_uv_vert_map_create(em, 1, 1, limit);
+
+	if (vmap == NULL)
 		return;
 
-	stack= MEM_mallocN(sizeof(*stack) * em->totface, "UvLinkStack");
-	flag= MEM_callocN(sizeof(*flag) * em->totface, "UvLinkFlag");
+	stack = MEM_mallocN(sizeof(*stack) * (em->bm->totface + 1), "UvLinkStack");
+	flag = MEM_callocN(sizeof(*flag) * em->bm->totface, "UvLinkFlag");
 
-	if(!hit) {
-		for(a=0, efa= em->faces.first; efa; efa= efa->next, a++) {
-			tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+	if (!hit) {
+		BM_ITER_MESH_INDEX (efa, &iter, em->bm, BM_FACES_OF_MESH, a) {
+			tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
 
-			if(uvedit_face_visible(scene, ima, efa, tf)) {
-				const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3);
-				if(tf->flag & select_flag) {
-					stack[stacksize]= a;
-					stacksize++;
-					flag[a]= 1;
+			if (uvedit_face_visible_test(scene, ima, efa, tf)) {
+				BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+					luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+
+					if (luv->flag & MLOOPUV_VERTSEL) {
+						stack[stacksize] = a;
+						stacksize++;
+						flag[a] = 1;
+
+						break;
+					}
 				}
 			}
 		}
 	}
 	else {
-		for(a=0, efa= em->faces.first; efa; efa= efa->next, a++) {
-			if(efa == hit->efa) {
-				stack[stacksize]= a;
+		a = 0;
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			if (efa == hit->efa) {
+				stack[stacksize] = a;
 				stacksize++;
-				flag[a]= 1;
+				flag[a] = 1;
 				break;
 			}
+
+			a++;
 		}
 	}
 
-	while(stacksize > 0) {
+	while (stacksize > 0) {
+		int j;
+
 		stacksize--;
-		a= stack[stacksize];
+		a = stack[stacksize];
+		
+		j = 0;
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			if (j == a)
+				break;
 
-		efa = EM_get_face_for_index(a);
+			j++;
+		}
 
-		nverts= efa->v4? 4: 3;
+		i = 0;
+		BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
 
-		for(i=0; i<nverts; i++) {
 			/* make_uv_vert_map_EM sets verts tmp.l to the indices */
-			vlist= EM_get_uv_map_vert(vmap, (*(&efa->v1 + i))->tmp.l);
+			vlist = EDBM_uv_vert_map_at_index(vmap, BM_elem_index_get(l->v));
 			
-			startv= vlist;
+			startv = vlist;
 
-			for(iterv=vlist; iterv; iterv=iterv->next) {
-				if(iterv->separate)
-					startv= iterv;
-				if(iterv->f == a)
+			for (iterv = vlist; iterv; iterv = iterv->next) {
+				if (iterv->separate)
+					startv = iterv;
+				if (iterv->f == a)
 					break;
 			}
 
-			for(iterv=startv; iterv; iterv=iterv->next) {
-				if((startv != iterv) && (iterv->separate))
+			for (iterv = startv; iterv; iterv = iterv->next) {
+				if ((startv != iterv) && (iterv->separate))
 					break;
-				else if(!flag[iterv->f]) {
-					flag[iterv->f]= 1;
-					stack[stacksize]= iterv->f;
+				else if (!flag[iterv->f]) {
+					flag[iterv->f] = 1;
+					stack[stacksize] = iterv->f;
 					stacksize++;
 				}
 			}
+
+			i++;
 		}
 	}
 
-	if(!extend) {
-		for(a=0, efa= em->faces.first; efa; efa= efa->next, a++) {
-			tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-			if(flag[a])
-				tf->flag |= (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
-			else
-				tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
+	if (!extend) {
+		a = 0;
+		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);
+				
+				if (flag[a])
+					luv->flag |= MLOOPUV_VERTSEL;
+				else
+					luv->flag &= ~MLOOPUV_VERTSEL;
+			}
+			a++;
 		}
 	}
 	else {
-		for(a=0, efa= em->faces.first; efa; efa= efa->next, a++) {
-			if(flag[a]) {
-				const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3);
-				tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-				if((tf->flag & select_flag))
+		a = 0;
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			if (!flag[a]) {
+				a++;
+				continue;
+			}
+			
+			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+				luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+						
+				if (luv->flag & MLOOPUV_VERTSEL)
 					break;
 			}
+			
+			if (l)
+				break;
+			
+			a++;
 		}
 
-		if(efa) {
-			for(a=0, efa= em->faces.first; efa; efa= efa->next, a++) {
-				if(flag[a]) {
-					tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-					tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
+		if (efa) {
+			a = 0;
+			BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+				if (!flag[a]) {
+					a++;
+					continue;
 				}
+
+				BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+					luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+					
+					luv->flag &= ~MLOOPUV_VERTSEL;
+				}
+
+				a++;
 			}
 		}
 		else {
-			for(a=0, efa= em->faces.first; efa; efa= efa->next, a++) {
-				if(flag[a]) {
-					tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-					tf->flag |= (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
+			a = 0;
+			BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+				if (!flag[a]) {
+					a++;
+					continue;
 				}
+
+				BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+					luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+					
+					luv->flag |= MLOOPUV_VERTSEL;
+				}
+
+				a++;
 			}
 		}
 	}
 	
 	MEM_freeN(stack);
 	MEM_freeN(flag);
-	EM_free_uv_vert_map(vmap);
-	EM_free_index_arrays();
+	EDBM_uv_vert_map_free(vmap);
+	EDBM_index_arrays_free(em);
+}
+
+/* WATCH IT: this returns first selected UV,
+ * not ideal in many cases since there could be multiple */
+static float *uv_sel_co_from_eve(Scene *scene, Image *ima, BMEditMesh *em, BMVert *eve)
+{
+	BMIter liter;
+	BMLoop *l;
+
+	BM_ITER_ELEM (l, &liter, eve, BM_LOOPS_OF_VERT) {
+		MTexPoly *tf = CustomData_bmesh_get(&em->bm->pdata, l->f->head.data, CD_MTEXPOLY);
+
+		if (!uvedit_face_visible_test(scene, ima, l->f, tf))
+			continue;
+
+		if (uvedit_uv_select_test(em, scene, l)) {
+			MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+			return luv->uv;
+		}
+	}
+
+	return NULL;
 }
 
 /* ******************** align operator **************** */
@@ -1066,205 +1310,224 @@ static void weld_align_uv(bContext *C, int tool)
 	Scene *scene;
 	Object *obedit;
 	Image *ima;
-	EditMesh *em;
-	EditFace *efa;
-	MTFace *tf;
+	BMEditMesh *em;
+	BMIter iter, liter;
+	MTexPoly *tf;
+	MLoopUV *luv;
 	float cent[2], min[2], max[2];
 	
-	scene= CTX_data_scene(C);
-	obedit= CTX_data_edit_object(C);
-	em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	ima= CTX_data_edit_image(C);
-	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);
+	sima = CTX_wm_space_image(C);
 
 	INIT_MINMAX2(min, max);
 
-	if(tool == 'a') {
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+	if (tool == 'a') {
+		BMFace *efa;
+		BMLoop *l;
 
-			if(uvedit_face_visible(scene, ima, efa, tf)) {
-				if(uvedit_uv_selected(scene, efa, tf, 0))
-					DO_MINMAX2(tf->uv[0], min, max)
-				if(uvedit_uv_selected(scene, efa, tf, 1))
-					DO_MINMAX2(tf->uv[1], min, max)
-				if(uvedit_uv_selected(scene, efa, tf, 2))
-					DO_MINMAX2(tf->uv[2], min, max)
-				if(efa->v4 && uvedit_uv_selected(scene, efa, tf, 3))
-					DO_MINMAX2(tf->uv[3], min, max)
+		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)) {
+					luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+					DO_MINMAX2(luv->uv, min, max);
+				}
 			}
 		}
 
-		tool= (max[0]-min[0] >= max[1]-min[1])? 'y': 'x';
+		tool = (max[0] - min[0] >= max[1] - min[1]) ? 'y' : 'x';
 	}
 
 	uvedit_center(scene, ima, obedit, cent, 0);
 
-	if(tool == 'x' || tool == 'w') {
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-			if(uvedit_face_visible(scene, ima, efa, tf)) {
-				if(uvedit_uv_selected(scene, efa, tf, 0))
-					tf->uv[0][0]= cent[0];
-				if(uvedit_uv_selected(scene, efa, tf, 1))
-					tf->uv[1][0]= cent[0];
-				if(uvedit_uv_selected(scene, efa, tf, 2))
-					tf->uv[2][0]= cent[0];
-				if(efa->v4 && uvedit_uv_selected(scene, efa, tf, 3))
-					tf->uv[3][0]= cent[0];
-			}
-		}
-	}
-
-	if(tool == 'y' || tool == 'w') {
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-			if(uvedit_face_visible(scene, ima, efa, tf)) {
-				if(uvedit_uv_selected(scene, efa, tf, 0))
-					tf->uv[0][1]= cent[1];
-				if(uvedit_uv_selected(scene, efa, tf, 1))
-					tf->uv[1][1]= cent[1];
-				if(uvedit_uv_selected(scene, efa, tf, 2))
-					tf->uv[2][1]= cent[1];
-				if(efa->v4 && uvedit_uv_selected(scene, efa, tf, 3))
-					tf->uv[3][1]= cent[1];
-			}
-		}
-	}
-
-	if(tool == 's' || tool == 't' || tool == 'u') {
-		 /* pass 1&2 variables */
-		int i, j;
-		int starttmpl= -1, connectedtostarttmpl= -1, startcorner;
-		int endtmpl= -1,   connectedtoendtmpl= -1,   endcorner;
-		MTFace *startface, *endface;
-		int itmpl, jtmpl;
-		EditVert *eve;
-		int pass; /* first 2 passes find endpoints, 3rd pass moves middle points, 4th pass is fail-on-face-selected */
-		EditFace *startefa, *endefa= NULL; /* endefa shouldnt need to be initialized but just incase */
-
-		 /* pass 3 variables */
-		float startx, starty, firstm,  firstb,  midx,      midy;
-		float endx,   endy,   secondm, secondb, midmovedx, midmovedy;
-		float IsVertical_check= -1;
-		float IsHorizontal_check= -1;
-
-		for(i= 0, eve= em->verts.first; eve; eve= eve->next, i++) /* give each point a unique name */
-			eve->tmp.l= i;
-		for(pass= 1; pass <= 3; pass++) { /* do this for each endpoint */
-			if(pass == 3){ /* calculate */
-				startx= startface->uv[startcorner][0];
-				starty= startface->uv[startcorner][1];
-				endx= endface->uv[endcorner][0];
-				endy= endface->uv[endcorner][1];
-				firstm= (endy-starty)/(endx-startx);
-				firstb= starty-(firstm*startx);
-				secondm= -1.0f/firstm;
-				if(startx == endx) IsVertical_check= startx;
-				if(starty == endy) IsHorizontal_check= starty;
-			}
-			for(efa= em->faces.first; efa; efa= efa->next) { /* for each face */
-				tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); /* get face */
-				if(uvedit_face_visible(scene, ima, efa, tf)) { /* if you can see it */
-					if(uvedit_face_selected(scene, efa, tf)) { /* if the face is selected, get out now! */
-						pass= 4;
-						break;
-					}
-					for(i= 0; (i < 3 || (i == 3 && efa->v4)); i++) { /* for each point of the face */
-						itmpl= (*(&efa->v1 + i))->tmp.l; /* get unique name for points */
-						if(pass == 3) { /* move */
-							if(uvedit_uv_selected(scene, efa, tf, i)) {
-								if(!(itmpl == starttmpl || itmpl == endtmpl)) {
-									if(IsVertical_check != -1) tf->uv[i][0]= IsVertical_check;
-									if(IsHorizontal_check != -1) tf->uv[i][1]= IsHorizontal_check;
-									if((IsVertical_check == -1) && (IsHorizontal_check == -1)) {
-										midx= tf->uv[i][0];
-										midy= tf->uv[i][1];
-										if(tool == 's') {
-											secondb= midy-(secondm*midx);
-											midmovedx= (secondb-firstb)/(firstm-secondm);
-											midmovedy= (secondm*midmovedx)+secondb;
-											tf->uv[i][0]= midmovedx;
-											tf->uv[i][1]= midmovedy;
-										}
-										else if(tool == 't') {
-											tf->uv[i][0]= (midy-firstb)/firstm; /* midmovedx */
-										}
-										else if(tool == 'u') {
-											tf->uv[i][1]= (firstm*midx)+firstb; /* midmovedy */
-										}
-									}
-								}
-							}
+	if (tool == 'x' || tool == 'w') {
+		BMFace *efa;
+		BMLoop *l;
+
+		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)) {
+					luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+					luv->uv[0] = cent[0];
+				}
+
+			}
+		}
+	}
+
+	if (tool == 'y' || tool == 'w') {
+		BMFace *efa;
+		BMLoop *l;
+
+		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)) {
+					luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+					luv->uv[1] = cent[1];
+				}
+
+			}
+		}
+	}
+
+	if (tool == 's' || tool == 't' || tool == 'u') {
+		BMEdge *eed;
+		BMLoop *l;
+		BMVert *eve;
+		BMVert *eve_start;
+		BMIter iter, liter, eiter;
+
+		/* clear tag */
+		BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+			BM_elem_flag_disable(eve, BM_ELEM_TAG);
+		}
+
+		/* tag verts with a selected UV */
+		BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+			BM_ITER_ELEM (l, &liter, eve, BM_LOOPS_OF_VERT) {
+				tf = CustomData_bmesh_get(&em->bm->pdata, l->f->head.data, CD_MTEXPOLY);
+
+				if (!uvedit_face_visible_test(scene, ima, l->f, tf))
+					continue;
+
+				if (uvedit_uv_select_test(em, scene, l)) {
+					BM_elem_flag_enable(eve, BM_ELEM_TAG);
+					break;
+				}
+			}
+		}
+
+		/* flush vertex tags to edges */
+		BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
+			BM_elem_flag_set(eed, BM_ELEM_TAG, (BM_elem_flag_test(eed->v1, BM_ELEM_TAG) &&
+			                                    BM_elem_flag_test(eed->v2, BM_ELEM_TAG)));
+		}
+
+		/* find a vertex with only one tagged edge */
+		eve_start = NULL;
+		BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+			int tot_eed_tag = 0;
+			BM_ITER_ELEM (eed, &eiter, eve, BM_EDGES_OF_VERT) {
+				if (BM_elem_flag_test(eed, BM_ELEM_TAG)) {
+					tot_eed_tag++;
+				}
+			}
+
+			if (tot_eed_tag == 1) {
+				eve_start = eve;
+				break;
+			}
+		}
+
+		if (eve_start) {
+			BMVert **eve_line = NULL;
+			BMVert *eve_next = NULL;
+			BLI_array_declare(eve_line);
+			int i;
+
+			eve = eve_start;
+
+			/* walk over edges, building an array of verts in a line */
+			while (eve) {
+				BLI_array_append(eve_line, eve);
+				/* don't touch again */
+				BM_elem_flag_disable(eve, BM_ELEM_TAG);
+
+				eve_next = NULL;
+
+				/* find next eve */
+				BM_ITER_ELEM (eed, &eiter, eve, BM_EDGES_OF_VERT) {
+					if (BM_elem_flag_test(eed, BM_ELEM_TAG)) {
+						BMVert *eve_other = BM_edge_other_vert(eed, eve);
+						if (BM_elem_flag_test(eve_other, BM_ELEM_TAG)) {
+							/* this is a tagged vert we didnt walk over yet, step onto it */
+							eve_next = eve_other;
+							break;
 						}
-						else {
-							for(j= 0; (j < 3 || (j == 3 && efa->v4)); j++) { /* also for each point on the face */
-								jtmpl= (*(&efa->v1 + j))->tmp.l;
-								if(i != j && (!efa->v4 || ABS(i-j) !=  2)) { /* if the points are connected */
-									/* quad   (0,1,2,3) 0,1 0,3 1,0 1,2 2,1 2,3 3,0 3,2
-									 * triangle (0,1,2) 0,1 0,2 1,0 1,2 2,0 2,1 */
-									if(uvedit_uv_selected(scene, efa, tf, i) && uvedit_uv_selected(scene, efa, tf, j)) {
-										 /* if the edge is selected */
-										if(pass == 1) { /* if finding first endpoint */
-											if(starttmpl == -1) { /* if the first endpoint isn't found yet */
-												starttmpl= itmpl; /* set unique name for endpoint */
-												connectedtostarttmpl= jtmpl;
-												 /* get point that endpoint is connected to */
-												startface= tf; /* get face it's on */
-												startcorner= i; /* what corner of the face? */
-												startefa= efa;
-												efa= em->faces.first;
-												tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-												i= -1;
-												break;
-											}
-											if(starttmpl == itmpl && jtmpl != connectedtostarttmpl) {
-												starttmpl= -1; /* not an endpoint */
-												efa= startefa;
-												tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-												i= startcorner;
-												break;
-											}
-										}
-										else if(pass == 2) { /* if finding second endpoint */
-											if(endtmpl == -1 && itmpl != starttmpl) {
-												endtmpl= itmpl;
-												connectedtoendtmpl= jtmpl;
-												endface= tf;
-												endcorner= i;
-												endefa= efa;
-												efa= em->faces.first;
-												tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-												i= -1;
-												break;
-											}
-											if(endtmpl == itmpl && jtmpl != connectedtoendtmpl) {
-												endtmpl= -1;
-												efa= endefa;
-												tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-												i= endcorner;
-												break;
-											}
-										}
-									}
-								}
-							}
+					}
+				}
+
+				eve = eve_next;
+			}
+
+			/* now we have all verts, make into a line */
+			if (BLI_array_count(eve_line) > 2) {
+
+				/* we know the returns from these must be valid */
+				float *uv_start = uv_sel_co_from_eve(scene, ima, em, eve_line[0]);
+				float *uv_end   = uv_sel_co_from_eve(scene, ima, em, eve_line[BLI_array_count(eve_line) - 1]);
+				/* For t & u modes */
+				float a = 0.0f;
+
+				if (tool == 't') {
+					if (uv_start[1] == uv_end[1])
+						tool = 's';
+					else
+						a = (uv_end[0] - uv_start[0]) / (uv_end[1] - uv_start[1]);
+				}
+				else if (tool == 'u') {
+					if (uv_start[0] == uv_end[0])
+						tool = 's';
+					else
+						a = (uv_end[1] - uv_start[1]) / (uv_end[0] - uv_start[0]);
+				}
+
+				/* go over all verts except for endpoints */
+				for (i = 0; i < BLI_array_count(eve_line); i++) {
+					BM_ITER_ELEM (l, &liter, eve_line[i], BM_LOOPS_OF_VERT) {
+						tf = CustomData_bmesh_get(&em->bm->pdata, l->f->head.data, CD_MTEXPOLY);
+
+						if (!uvedit_face_visible_test(scene, ima, l->f, tf))
+							continue;
+
+						if (uvedit_uv_select_test(em, scene, l)) {
+							MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+							/* Projection of point (x, y) over line (x1, y1, x2, y2) along X axis:
+							 * new_y = (y2 - y1) / (x2 - x1) * (x - x1) + y1
+							 * Maybe this should be a BLI func? Or is it already existing?
+							 * Could use interp_v2_v2v2, but not sure it's worth it here...*/
+							if (tool == 't')
+								luv->uv[0] = a * (luv->uv[1] - uv_start[1]) + uv_start[0];
+							else if (tool == 'u')
+								luv->uv[1] = a * (luv->uv[0] - uv_start[0]) + uv_start[1];
+							else
+								closest_to_line_segment_v2(luv->uv, luv->uv, uv_start, uv_end);
 						}
 					}
 				}
 			}
-			if(pass == 2 && (starttmpl == -1 || endtmpl == -1)) {
-				/* if endpoints aren't found */
-				pass=4;
+			else {
+				/* error - not a line, needs 3+ points  */
+			}
+
+			if (eve_line) {
+				MEM_freeN(eve_line);
 			}
 		}
+		else {
+			/* error - cant find an endpoint */
+		}
 	}
 
+
 	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);
-
-	BKE_mesh_end_editmesh(obedit->data, em);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 }
 
 static int align_exec(bContext *C, wmOperator *op)
@@ -1286,14 +1549,14 @@ static void UV_OT_align(wmOperatorType *ot)
 		{0, NULL, 0, NULL, NULL}};
 
 	/* identifiers */
-	ot->name= "Align";
-	ot->description= "Align selected UV vertices to an axis";
-	ot->idname= "UV_OT_align";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "Align";
+	ot->description = "Align selected UV vertices to an axis";
+	ot->idname = "UV_OT_align";
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* api callbacks */
-	ot->exec= align_exec;
-	ot->poll= ED_operator_image_active;	/* requires space image */;
+	ot->exec = align_exec;
+	ot->poll = ED_operator_image_active; /* requires space image */;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "axis", axis_items, 'a', "Axis", "Axis to align UV locations on");
@@ -1311,60 +1574,59 @@ static int weld_exec(bContext *C, wmOperator *UNUSED(op))
 static void UV_OT_weld(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Weld";
-	ot->description= "Weld selected UV vertices together";
-	ot->idname= "UV_OT_weld";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "Weld";
+	ot->description = "Weld selected UV vertices together";
+	ot->idname = "UV_OT_weld";
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* api callbacks */
-	ot->exec= weld_exec;
-	ot->poll= ED_operator_uvedit;
+	ot->exec = weld_exec;
+	ot->poll = ED_operator_uvedit;
 }
 
+
 /* ******************** (de)select all operator **************** */
 
-static void select_all_perform(bContext *C, int action)
+static void select_all_perform(Scene *scene, Image *ima, BMEditMesh *em, int action)
 {
-	Scene *scene;
-	ToolSettings *ts;
-	Object *obedit;
-	EditMesh *em;
-	EditFace *efa;
-	Image *ima;
-	MTFace *tf;
-	
-	scene= CTX_data_scene(C);
-	ts= CTX_data_tool_settings(C);
-	obedit= CTX_data_edit_object(C);
-	em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	ima= CTX_data_edit_image(C);
-	
-	if(ts->uv_flag & UV_SYNC_SELECTION) {
+	ToolSettings *ts = scene->toolsettings;
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	MTexPoly *tf;
+	MLoopUV *luv;
+
+	if (ts->uv_flag & UV_SYNC_SELECTION) {
+
 		switch (action) {
-		case SEL_TOGGLE:
-			EM_toggle_select_all(em);
-			break;
-		case SEL_SELECT:
-			EM_select_all(em);
-			break;
-		case SEL_DESELECT:
-			EM_deselect_all(em);
-			break;
-		case SEL_INVERT:
-			EM_select_swap(em);
-			break;
+			case SEL_TOGGLE:
+				EDBM_select_toggle_all(em);
+				break;
+			case SEL_SELECT:
+				EDBM_flag_enable_all(em, BM_ELEM_SELECT);
+				break;
+			case SEL_DESELECT:
+				EDBM_flag_disable_all(em, BM_ELEM_SELECT);
+				break;
+			case SEL_INVERT:
+				EDBM_select_swap(em);
+				EDBM_selectmode_flush(em);
+				break;
 		}
 	}
 	else {
-
 		if (action == SEL_TOGGLE) {
 			action = SEL_SELECT;
-			for(efa= em->faces.first; efa; efa= efa->next) {
-				const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3);
-				tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+			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;
 
-				if(uvedit_face_visible(scene, ima, efa, tf)) {
-					if(tf->flag & select_flag) {
+				BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+					luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+
+					if (luv->flag & MLOOPUV_VERTSEL) {
 						action = SEL_DESELECT;
 						break;
 					}
@@ -1372,22 +1634,26 @@ static void select_all_perform(bContext *C, int action)
 			}
 		}
 	
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+		
+		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(scene, ima, efa, tf)) {
-				const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3);
+			if (!uvedit_face_visible_test(scene, ima, efa, tf))
+				continue;
+
+			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+				luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
 
 				switch (action) {
-				case SEL_SELECT:
-					tf->flag |= select_flag;
-					break;
-				case SEL_DESELECT:
-					tf->flag &= ~select_flag;
-					break;
-				case SEL_INVERT:
-					tf->flag ^= select_flag;
-					break;
+					case SEL_SELECT:
+						luv->flag |= MLOOPUV_VERTSEL;
+						break;
+					case SEL_DESELECT:
+						luv->flag &= ~MLOOPUV_VERTSEL;
+						break;
+					case SEL_INVERT:
+						luv->flag ^= MLOOPUV_VERTSEL;
+						break;
 				}
 			}
 		}
@@ -1396,51 +1662,53 @@ static void select_all_perform(bContext *C, int action)
 
 static int select_all_exec(bContext *C, wmOperator *op)
 {
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	int action= RNA_enum_get(op->ptr, "action");
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit = CTX_data_edit_object(C);
+	Image *ima = CTX_data_edit_image(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
 
-	select_all_perform(C, action);
+	int action = RNA_enum_get(op->ptr, "action");
 
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
+	select_all_perform(scene, ima, em, action);
+
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
 	return OPERATOR_FINISHED;
 }
 
 static void UV_OT_select_all(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select or Deselect All";
-	ot->description= "Change selection of all UV vertices";
-	ot->idname= "UV_OT_select_all";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "(De)select All";
+	ot->description = "Change selection of all UV vertices";
+	ot->idname = "UV_OT_select_all";
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* api callbacks */
-	ot->exec= select_all_exec;
-	ot->poll= ED_operator_uvedit;
+	ot->exec = select_all_exec;
+	ot->poll = ED_operator_uvedit;
 
 	WM_operator_properties_select_all(ot);
 }
 
 /* ******************** mouse select operator **************** */
 
-static int sticky_select(float *limit, int hitv[4], int v, float *hituv[4], float *uv, int sticky)
+static int sticky_select(float *limit, int hitv[4], int v, float *hituv[4], float *uv, int sticky, int hitlen)
 {
 	int i;
 
 	/* this function test if some vertex needs to selected
 	 * in addition to the existing ones due to sticky select */
-	if(sticky == SI_STICKY_DISABLE)
+	if (sticky == SI_STICKY_DISABLE)
 		return 0;
 
-	for(i=0; i<4; i++) {
-		if(hitv[i] == v) {
-			if(sticky == SI_STICKY_LOC) {
-				if(fabsf(hituv[i][0]-uv[0]) < limit[0] && fabsf(hituv[i][1]-uv[1]) < limit[1])
+	for (i = 0; i < hitlen; i++) {
+		if (hitv[i] == v) {
+			if (sticky == SI_STICKY_LOC) {
+				if (fabsf(hituv[i][0] - uv[0]) < limit[0] && fabsf(hituv[i][1] - uv[1]) < limit[1])
 					return 1;
 			}
-			else if(sticky == SI_STICKY_VERTEX)
+			else if (sticky == SI_STICKY_VERTEX)
 				return 1;
 		}
 	}
@@ -1450,18 +1718,24 @@ static int sticky_select(float *limit, int hitv[4], int v, float *hituv[4], floa
 
 static int mouse_select(bContext *C, float co[2], int extend, int loop)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	Scene *scene= CTX_data_scene(C);
-	ToolSettings *ts= CTX_data_tool_settings(C);
-	Object *obedit= CTX_data_edit_object(C);
-	Image *ima= CTX_data_edit_image(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	EditFace *efa;
-	MTFace *tf;
+	SpaceImage *sima = CTX_wm_space_image(C);
+	Scene *scene = CTX_data_scene(C);
+	ToolSettings *ts = CTX_data_tool_settings(C);
+	Object *obedit = CTX_data_edit_object(C);
+	Image *ima = CTX_data_edit_image(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	MTexPoly *tf;
+	MLoopUV *luv;
 	NearestHit hit;
-	int a, i, select = 1, selectmode, sticky, sync, hitv[4], nvert;
-	int flush = 0; /* 0 == dont flush, 1 == sel, -1 == desel;  only use when selection sync is enabled */
-	float limit[2], *hituv[4], penalty[2];
+	int i, select = 1, selectmode, sticky, sync, *hitv = NULL;
+	BLI_array_declare(hitv);
+	int flush = 0, hitlen = 0; /* 0 == don't flush, 1 == sel, -1 == desel;  only use when selection sync is enabled */
+	float limit[2], **hituv = NULL;
+	BLI_array_declare(hituv);
+	float penalty[2];
 
 	/* notice 'limit' is the same no matter the zoom level, since this is like
 	 * remove doubles and could annoying if it joined points when zoomed out.
@@ -1473,253 +1747,285 @@ static int mouse_select(bContext *C, float co[2], int extend, int loop)
 	uvedit_pixel_to_float(sima, penalty, 5.0f / sima->zoom);
 
 	/* retrieve operation mode */
-	if(ts->uv_flag & UV_SYNC_SELECTION) {
-		sync= 1;
+	if (ts->uv_flag & UV_SYNC_SELECTION) {
+		sync = 1;
 
-		if(ts->selectmode & SCE_SELECT_FACE)
-			selectmode= UV_SELECT_FACE;
-		else if(ts->selectmode & SCE_SELECT_EDGE)
-			selectmode= UV_SELECT_EDGE;
+		if (ts->selectmode & SCE_SELECT_FACE)
+			selectmode = UV_SELECT_FACE;
+		else if (ts->selectmode & SCE_SELECT_EDGE)
+			selectmode = UV_SELECT_EDGE;
 		else
-			selectmode= UV_SELECT_VERTEX;
+			selectmode = UV_SELECT_VERTEX;
 
-		sticky= SI_STICKY_DISABLE;
+		sticky = SI_STICKY_DISABLE;
 	}
 	else {
-		sync= 0;
-		selectmode= ts->uv_selectmode;
-		sticky= (sima)? sima->sticky: 1;
+		sync = 0;
+		selectmode = ts->uv_selectmode;
+		sticky = (sima) ? sima->sticky : 1;
 	}
 
 	/* find nearest element */
-	if(loop) {
+	if (loop) {
 		/* find edge */
 		uv_find_nearest_edge(scene, ima, em, co, &hit);
-		if(hit.efa == NULL) {
-			BKE_mesh_end_editmesh(obedit->data, em);
+		if (hit.efa == NULL) {
+			BLI_array_free(hitv);
+			BLI_array_free(hituv);
 			return OPERATOR_CANCELLED;
 		}
+
+		hitlen = 0;
 	}
-	else if(selectmode == UV_SELECT_VERTEX) {
+	else if (selectmode == UV_SELECT_VERTEX) {
 		/* find vertex */
 		uv_find_nearest_vert(scene, ima, em, co, penalty, &hit);
-		if(hit.efa == NULL) {
-			BKE_mesh_end_editmesh(obedit->data, em);
+		if (hit.efa == NULL) {
+			BLI_array_free(hitv);
+			BLI_array_free(hituv);
 			return OPERATOR_CANCELLED;
 		}
 
 		/* mark 1 vertex as being hit */
-		for(i=0; i<4; i++)
-			hitv[i]= 0xFFFFFFFF;
+		BLI_array_growitems(hitv, hit.efa->len);
+		BLI_array_growitems(hituv, hit.efa->len);
+		for (i = 0; i < hit.efa->len; i++) {
+			hitv[i] = 0xFFFFFFFF;
+		}
+
+		hitv[hit.lindex] = hit.vert1;
+		hituv[hit.lindex] = hit.luv->uv;
 
-		hitv[hit.uv]= hit.vert;
-		hituv[hit.uv]= hit.tf->uv[hit.uv];
+		hitlen = hit.efa->len;
 	}
-	else if(selectmode == UV_SELECT_EDGE) {
+	else if (selectmode == UV_SELECT_EDGE) {
 		/* find edge */
 		uv_find_nearest_edge(scene, ima, em, co, &hit);
-		if(hit.efa == NULL) {
-			BKE_mesh_end_editmesh(obedit->data, em);
+		if (hit.efa == NULL) {
+			BLI_array_free(hitv);
+			BLI_array_free(hituv);
 			return OPERATOR_CANCELLED;
 		}
 
 		/* mark 2 edge vertices as being hit */
-		for(i=0; i<4; i++)
-			hitv[i]= 0xFFFFFFFF;
+		BLI_array_growitems(hitv,  hit.efa->len);
+		BLI_array_growitems(hituv, hit.efa->len);
+		fill_vn_i(hitv, hit.efa->len, 0xFFFFFFFF);
 
-		nvert= (hit.efa->v4)? 4: 3;
+		hitv[hit.lindex] = hit.vert1;
+		hitv[(hit.lindex + 1) % hit.efa->len] = hit.vert2;
+		hituv[hit.lindex] = hit.luv->uv;
+		hituv[(hit.lindex + 1) % hit.efa->len] = hit.nextluv->uv;
 
-		hitv[hit.edge]= hit.vert;
-		hitv[(hit.edge+1)%nvert]= hit.vert2;
-		hituv[hit.edge]= hit.tf->uv[hit.edge];
-		hituv[(hit.edge+1)%nvert]= hit.tf->uv[(hit.edge+1)%nvert];
+		hitlen = hit.efa->len;
 	}
-	else if(selectmode == UV_SELECT_FACE) {
+	else if (selectmode == UV_SELECT_FACE) {
 		/* find face */
 		find_nearest_uv_face(scene, ima, em, co, &hit);
-		if(hit.efa == NULL) {
-			BKE_mesh_end_editmesh(obedit->data, em);
+		if (hit.efa == NULL) {
+			BLI_array_free(hitv);
+			BLI_array_free(hituv);
 			return OPERATOR_CANCELLED;
 		}
 		
 		/* make active */
-		EM_set_actFace(em, hit.efa);
+		BM_active_face_set(em->bm, hit.efa);
 
 		/* mark all face vertices as being hit */
-		for(i=0; i<4; i++)
-			hituv[i]= hit.tf->uv[i];
 
-		hitv[0]= hit.efa->v1->tmp.l;
-		hitv[1]= hit.efa->v2->tmp.l;
-		hitv[2]= hit.efa->v3->tmp.l;
+		BLI_array_growitems(hitv,  hit.efa->len);
+		BLI_array_growitems(hituv, hit.efa->len);
+		i = 0;
+		BM_ITER_ELEM (l, &liter, hit.efa, BM_LOOPS_OF_FACE) {
+			luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+			hituv[i] = luv->uv;
+			hitv[i] = BM_elem_index_get(l->v);
+			i++;
+		}
 		
-		if(hit.efa->v4)	hitv[3]= hit.efa->v4->tmp.l;
-		else hitv[3]= 0xFFFFFFFF;
+		hitlen = hit.efa->len;
 	}
-	else if(selectmode == UV_SELECT_ISLAND) {
+	else if (selectmode == UV_SELECT_ISLAND) {
 		uv_find_nearest_vert(scene, ima, em, co, NULL, &hit);
 
-		if(hit.efa==NULL) {
-			BKE_mesh_end_editmesh(obedit->data, em);
+		if (hit.efa == NULL) {
+			BLI_array_free(hitv);
+			BLI_array_free(hituv);
 			return OPERATOR_CANCELLED;
 		}
+
+		hitlen = 0;
 	}
 	else {
-		BKE_mesh_end_editmesh(obedit->data, em);
+		hitlen = 0;
+		BLI_array_free(hitv);
+		BLI_array_free(hituv);
 		return OPERATOR_CANCELLED;
 	}
 
 	/* do selection */
-	if(loop) {
-		flush= select_edgeloop(scene, ima, em, &hit, limit, extend);
+	if (loop) {
+		flush = select_edgeloop(scene, ima, em, &hit, limit, extend);
 	}
-	else if(selectmode == UV_SELECT_ISLAND) {
+	else if (selectmode == UV_SELECT_ISLAND) {
 		select_linked(scene, ima, em, limit, &hit, extend);
 	}
-	else if(extend) {
-		if(selectmode == UV_SELECT_VERTEX) {
+	else if (extend) {
+		if (selectmode == UV_SELECT_VERTEX) {
 			/* (de)select uv vertex */
-			if(uvedit_uv_selected(scene, hit.efa, hit.tf, hit.uv)) {
-				uvedit_uv_deselect(scene, hit.efa, hit.tf, hit.uv);
-				select= 0;
+			if (uvedit_uv_select_test(em, scene, hit.l)) {
+				uvedit_uv_select_disable(em, scene, hit.l);
+				select = 0;
 			}
 			else {
-				uvedit_uv_select(scene, hit.efa, hit.tf, hit.uv);
-				select= 1;
+				uvedit_uv_select_enable(em, scene, hit.l, TRUE);
+				select = 1;
 			}
 			flush = 1;
 		}
-		else if(selectmode == UV_SELECT_EDGE) {
+		else if (selectmode == UV_SELECT_EDGE) {
 			/* (de)select edge */
-			if(uvedit_edge_selected(scene, hit.efa, hit.tf, hit.edge)) {
-				uvedit_edge_deselect(scene, hit.efa, hit.tf, hit.edge);
-				select= 0;
+			if (uvedit_edge_select_test(em, scene, hit.l)) {
+				uvedit_edge_select_disable(em, scene, hit.l);
+				select = 0;
 			}
 			else {
-				uvedit_edge_select(scene, hit.efa, hit.tf, hit.edge);
-				select= 1;
+				uvedit_edge_select_enable(em, scene, hit.l, TRUE);
+				select = 1;
 			}
 			flush = 1;
 		}
-		else if(selectmode == UV_SELECT_FACE) {
+		else if (selectmode == UV_SELECT_FACE) {
 			/* (de)select face */
-			if(uvedit_face_selected(scene, hit.efa, hit.tf)) {
-				uvedit_face_deselect(scene, hit.efa, hit.tf);
-				select= 0;
+			if (uvedit_face_select_test(scene, em, hit.efa)) {
+				uvedit_face_select_disable(scene, em, hit.efa);
+				select = 0;
 			}
 			else {
-				uvedit_face_select(scene, hit.efa, hit.tf);
-				select= 1;
+				uvedit_face_select_enable(scene, em, hit.efa, TRUE);
+				select = 1;
 			}
 			flush = -1;
 		}
 
+		/* de-selecting an edge may deselect a face too - validate */
+		if (sync) {
+			if (select == FALSE) {
+				BM_select_history_validate(em->bm);
+			}
+		}
+
 		/* (de)select sticky uv nodes */
-		if(sticky != SI_STICKY_DISABLE) {
-			EditVert *ev;
-			
-			for(a=0, ev=em->verts.first; ev; ev = ev->next, a++)
-				ev->tmp.l = a;
-			
+		if (sticky != SI_STICKY_DISABLE) {
+
+			BM_mesh_elem_index_ensure(em->bm, BM_VERT);
+
 			/* deselect */
-			if(select==0) {
-				for(efa= em->faces.first; efa; efa= efa->next) {
-					tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
-					if(uvedit_face_visible(scene, ima, efa, tf)) {
-						if(sticky_select(limit, hitv, efa->v1->tmp.l, hituv, tf->uv[0], sticky))
-							uvedit_uv_deselect(scene, efa, tf, 0);
-						if(sticky_select(limit, hitv, efa->v2->tmp.l, hituv, tf->uv[1], sticky))
-							uvedit_uv_deselect(scene, efa, tf, 1);
-						if(sticky_select(limit, hitv, efa->v3->tmp.l, hituv, tf->uv[2], sticky))
-							uvedit_uv_deselect(scene, efa, tf, 2);
-						if(efa->v4)
-							if(sticky_select(limit, hitv, efa->v4->tmp.l, hituv, tf->uv[3], sticky))
-								uvedit_uv_deselect(scene, efa, tf, 3);
+			if (select == 0) {
+				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) {
+						luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+						if (sticky_select(limit, hitv, BM_elem_index_get(l->v), hituv, luv->uv, sticky, hitlen))
+							uvedit_uv_select_disable(em, scene, l);
 					}
 				}
 				flush = -1;
 			}
 			/* select */
 			else {
-				for(efa= em->faces.first; efa; efa= efa->next) {
-					tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
-					if(uvedit_face_visible(scene, ima, efa, tf)) {
-						if(sticky_select(limit, hitv, efa->v1->tmp.l, hituv, tf->uv[0], sticky))
-							uvedit_uv_select(scene, efa, tf, 0);
-						if(sticky_select(limit, hitv, efa->v2->tmp.l, hituv, tf->uv[1], sticky))
-							uvedit_uv_select(scene, efa, tf, 1);
-						if(sticky_select(limit, hitv, efa->v3->tmp.l, hituv, tf->uv[2], sticky))
-							uvedit_uv_select(scene, efa, tf, 2);
-						if(efa->v4)
-							if(sticky_select(limit, hitv, efa->v4->tmp.l, hituv, tf->uv[3], sticky))
-								uvedit_uv_select(scene, efa, tf, 3);
+				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) {
+						luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+						if (sticky_select(limit, hitv, BM_elem_index_get(l->v), hituv, luv->uv, sticky, hitlen))
+							uvedit_uv_select_enable(em, scene, l, FALSE);
 					}
 				}
-				
+
 				flush = 1;
 			}			
 		}
 	}
 	else {
 		/* deselect all */
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-			uvedit_face_deselect(scene, efa, tf);
-		}
+		select_all_perform(scene, ima, em, SEL_DESELECT);
 
-		if(selectmode == UV_SELECT_VERTEX) {
+		if (selectmode == UV_SELECT_VERTEX) {
 			/* select vertex */
-			uvedit_uv_select(scene, hit.efa, hit.tf, hit.uv);
-			flush= 1;
+			uvedit_uv_select_enable(em, scene, hit.l, TRUE);
+			flush = 1;
 		}
-		else if(selectmode == UV_SELECT_EDGE) {
+		else if (selectmode == UV_SELECT_EDGE) {
 			/* select edge */
-			uvedit_edge_select(scene, hit.efa, hit.tf, hit.edge);
-			flush= 1;
+			uvedit_edge_select_enable(em, scene, hit.l, TRUE);
+			flush = 1;
 		}
-		else if(selectmode == UV_SELECT_FACE) {
+		else if (selectmode == UV_SELECT_FACE) {
 			/* select face */
-			uvedit_face_select(scene, hit.efa, hit.tf);
+			uvedit_face_select_enable(scene, em, hit.efa, TRUE);
 		}
 
 		/* select sticky uvs */
-		if(sticky != SI_STICKY_DISABLE) {
-			for(efa= em->faces.first; efa; efa= efa->next) {
-				tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-				if(uvedit_face_visible(scene, ima, efa, tf)) {
-					if(sticky == SI_STICKY_DISABLE) continue;
-
-					if(sticky_select(limit, hitv, efa->v1->tmp.l, hituv, tf->uv[0], sticky))
-						uvedit_uv_select(scene, efa, tf, 0);
-					if(sticky_select(limit, hitv, efa->v2->tmp.l, hituv, tf->uv[1], sticky))
-						uvedit_uv_select(scene, efa, tf, 1);
-					if(sticky_select(limit, hitv, efa->v3->tmp.l, hituv, tf->uv[2], sticky))
-						uvedit_uv_select(scene, efa, tf, 2);
-					if(efa->v4)
-						if(sticky_select(limit, hitv, efa->v4->tmp.l, hituv, tf->uv[3], sticky))
-							uvedit_uv_select(scene, efa, tf, 3);
-
-					flush= 1;
+		if (sticky != SI_STICKY_DISABLE) {
+			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 (sticky == SI_STICKY_DISABLE) continue;
+					luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+
+					if (sticky_select(limit, hitv, BM_elem_index_get(l->v), hituv, luv->uv, sticky, hitlen))
+						uvedit_uv_select_enable(em, scene, l, FALSE);
+
+					flush = 1;
 				}
 			}
 		}
 	}
-	
-	if(sync) {
+
+	if (sync) {
 		/* flush for mesh selection */
-		if(ts->selectmode != SCE_SELECT_FACE) {
-			if(flush==1)		EM_select_flush(em);
-			else if(flush==-1)	EM_deselect_flush(em);
+
+		/* before bmesh */
+#if 0
+		if (ts->selectmode != SCE_SELECT_FACE) {
+			if (flush == 1) EDBM_select_flush(em);
+			else if (flush == -1) EDBM_deselect_flush(em);
+		}
+#else
+		if (flush != 0) {
+			if (loop) {
+				/* push vertex -> edge selection */
+				if (select) {
+					EDBM_select_flush(em);
+				}
+				else {
+					EDBM_deselect_flush(em);
+				}
+			}
+			else {
+				EDBM_selectmode_flush(em);
+			}
 		}
+#endif
 	}
-	
+
 	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
-	
-	BKE_mesh_end_editmesh(obedit->data, em);
-	return OPERATOR_PASS_THROUGH|OPERATOR_FINISHED;
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+
+	BLI_array_free(hitv);
+	BLI_array_free(hituv);
+
+	return OPERATOR_PASS_THROUGH | OPERATOR_FINISHED;
 }
 
 static int select_exec(bContext *C, wmOperator *op)
@@ -1728,15 +2034,15 @@ static int select_exec(bContext *C, wmOperator *op)
 	int extend, loop;
 
 	RNA_float_get_array(op->ptr, "location", co);
-	extend= RNA_boolean_get(op->ptr, "extend");
-	loop= 0;
+	extend = RNA_boolean_get(op->ptr, "extend");
+	loop = 0;
 
 	return mouse_select(C, co, extend, loop);
 }
 
 static int select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	ARegion *ar= CTX_wm_region(C);
+	ARegion *ar = CTX_wm_region(C);
 	float co[2];
 
 	UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
@@ -1748,21 +2054,21 @@ static int select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 static void UV_OT_select(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select";
-	ot->description= "Select UV vertices";
-	ot->idname= "UV_OT_select";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "Select";
+	ot->description = "Select UV vertices";
+	ot->idname = "UV_OT_select";
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* api callbacks */
-	ot->exec= select_exec;
-	ot->invoke= select_invoke;
-	ot->poll= ED_operator_image_active;	/* requires space image */;
+	ot->exec = select_exec;
+	ot->invoke = select_invoke;
+	ot->poll = ED_operator_image_active; /* requires space image */;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "extend", 0,
-		"Extend", "Extend selection rather than clearing the existing selection");
+	                "Extend", "Extend selection rather than clearing the existing selection");
 	RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX,
-		"Location", "Mouse location in normalized coordinates, 0.0 to 1.0 is within the image bounds", -100.0f, 100.0f);
+	                     "Location", "Mouse location in normalized coordinates, 0.0 to 1.0 is within the image bounds", -100.0f, 100.0f);
 }
 
 /* ******************** loop select operator **************** */
@@ -1773,15 +2079,15 @@ static int select_loop_exec(bContext *C, wmOperator *op)
 	int extend, loop;
 
 	RNA_float_get_array(op->ptr, "location", co);
-	extend= RNA_boolean_get(op->ptr, "extend");
-	loop= 1;
+	extend = RNA_boolean_get(op->ptr, "extend");
+	loop = 1;
 
 	return mouse_select(C, co, extend, loop);
 }
 
 static int select_loop_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	ARegion *ar= CTX_wm_region(C);
+	ARegion *ar = CTX_wm_region(C);
 	float co[2];
 
 	UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
@@ -1793,53 +2099,52 @@ static int select_loop_invoke(bContext *C, wmOperator *op, wmEvent *event)
 static void UV_OT_select_loop(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Loop Select";
-	ot->description= "Select a loop of connected UV vertices";
-	ot->idname= "UV_OT_select_loop";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "Loop Select";
+	ot->description = "Select a loop of connected UV vertices";
+	ot->idname = "UV_OT_select_loop";
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* api callbacks */
-	ot->exec= select_loop_exec;
-	ot->invoke= select_loop_invoke;
-	ot->poll= ED_operator_image_active;	/* requires space image */;
+	ot->exec = select_loop_exec;
+	ot->invoke = select_loop_invoke;
+	ot->poll = ED_operator_image_active; /* requires space image */;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "extend", 0,
-		"Extend", "Extend selection rather than clearing the existing selection");
+	                "Extend", "Extend selection rather than clearing the existing selection");
 	RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX,
-		"Location", "Mouse location in normalized coordinates, 0.0 to 1.0 is within the image bounds", -100.0f, 100.0f);
+	                     "Location", "Mouse location in normalized coordinates, 0.0 to 1.0 is within the image bounds", -100.0f, 100.0f);
 }
 
 /* ******************** linked select operator **************** */
 
 static int select_linked_internal(bContext *C, wmOperator *op, wmEvent *event, int pick)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	Scene *scene= CTX_data_scene(C);
-	ToolSettings *ts= CTX_data_tool_settings(C);
-	Object *obedit= CTX_data_edit_object(C);
-	Image *ima= CTX_data_edit_image(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
+	SpaceImage *sima = CTX_wm_space_image(C);
+	Scene *scene = CTX_data_scene(C);
+	ToolSettings *ts = CTX_data_tool_settings(C);
+	Object *obedit = CTX_data_edit_object(C);
+	Image *ima = CTX_data_edit_image(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
 	float limit[2];
 	int extend;
 
-	NearestHit hit, *hit_p= NULL;
+	NearestHit hit, *hit_p = NULL;
 
-	if(ts->uv_flag & UV_SYNC_SELECTION) {
+	if (ts->uv_flag & UV_SYNC_SELECTION) {
 		BKE_report(op->reports, RPT_ERROR, "Can't select linked when sync selection is enabled");
-		BKE_mesh_end_editmesh(obedit->data, em);
 		return OPERATOR_CANCELLED;
 	}
 
-	extend= RNA_boolean_get(op->ptr, "extend");
+	extend = RNA_boolean_get(op->ptr, "extend");
 	uvedit_pixel_to_float(sima, limit, 0.05f);
 
-	if(pick) {
+	if (pick) {
 		float co[2];
 
-		if(event) {
+		if (event) {
 			/* invoke */
-			ARegion *ar= CTX_wm_region(C);
+			ARegion *ar = CTX_wm_region(C);
 
 			UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
 			RNA_float_set_array(op->ptr, "location", co);
@@ -1850,15 +2155,14 @@ static int select_linked_internal(bContext *C, wmOperator *op, wmEvent *event, i
 		}
 
 		uv_find_nearest_vert(scene, ima, em, co, NULL, &hit);
-		hit_p= &hit;
+		hit_p = &hit;
 	}
 
 	select_linked(scene, ima, em, limit, hit_p, extend);
 
 	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
 	return OPERATOR_FINISHED;
 }
 
@@ -1870,18 +2174,18 @@ static int select_linked_exec(bContext *C, wmOperator *op)
 static void UV_OT_select_linked(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Linked";
-	ot->description= "Select all UV vertices linked to the active UV map";
-	ot->idname= "UV_OT_select_linked";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "Select Linked";
+	ot->description = "Select all UV vertices linked to the active UV map";
+	ot->idname = "UV_OT_select_linked";
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* api callbacks */
-	ot->exec= select_linked_exec;
-	ot->poll= ED_operator_image_active;	/* requires space image */
+	ot->exec = select_linked_exec;
+	ot->poll = ED_operator_image_active;    /* requires space image */
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "extend", 0,
-		"Extend", "Extend selection rather than clearing the existing selection");
+	                "Extend", "Extend selection rather than clearing the existing selection");
 }
 
 static int select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event)
@@ -1897,71 +2201,85 @@ static int select_linked_pick_exec(bContext *C, wmOperator *op)
 static void UV_OT_select_linked_pick(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Select Linked Pick";
-	ot->description= "Select all UV vertices linked under the mouse";
-	ot->idname= "UV_OT_select_linked_pick";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "Select Linked Pick";
+	ot->description = "Select all UV vertices linked under the mouse";
+	ot->idname = "UV_OT_select_linked_pick";
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* api callbacks */
-	ot->invoke= select_linked_pick_invoke;
-	ot->exec= select_linked_pick_exec;
-	ot->poll= ED_operator_image_active;	/* requires space image */;
+	ot->invoke = select_linked_pick_invoke;
+	ot->exec = select_linked_pick_exec;
+	ot->poll = ED_operator_image_active; /* requires space image */;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "extend", 0,
-		"Extend", "Extend selection rather than clearing the existing selection");
+	                "Extend", "Extend selection rather than clearing the existing selection");
 
 	RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX,
-		"Location", "Mouse location in normalized coordinates, 0.0 to 1.0 is within the image bounds", -100.0f, 100.0f);
+	                     "Location", "Mouse location in normalized coordinates, 0.0 to 1.0 is within the image bounds", -100.0f, 100.0f);
 }
 
 /* ******************** unlink selection operator **************** */
 
 static int unlink_selection_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	ToolSettings *ts= CTX_data_tool_settings(C);
-	Object *obedit= CTX_data_edit_object(C);
-	Image *ima= CTX_data_edit_image(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	EditFace *efa;
-	MTFace *tf;
-
-	if(ts->uv_flag & UV_SYNC_SELECTION) {
+	Scene *scene = CTX_data_scene(C);
+	ToolSettings *ts = CTX_data_tool_settings(C);
+	Object *obedit = CTX_data_edit_object(C);
+	Image *ima = CTX_data_edit_image(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	MTexPoly *tf;
+	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_mesh_end_editmesh(obedit->data, em);
 		return OPERATOR_CANCELLED;
 	}
 	
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+		int desel = 0;
 
-		if(uvedit_face_visible(scene, ima, efa, tf)) {
-			const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3);
-			if(~tf->flag & select_flag)
-				tf->flag &= ~select_flag;
+		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) {
+			luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+			
+			if (!(luv->flag & MLOOPUV_VERTSEL)) {
+				desel = 1;
+				break;
+			}
+		}
 
+		if (desel) {
+			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+				luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+				luv->flag &= ~MLOOPUV_VERTSEL;
+			}
 		}
 	}
 	
 	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
 	return OPERATOR_FINISHED;
 }
 
 static void UV_OT_unlink_selected(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Unlink Selection";
-	ot->description= "Unlink selected UV vertices from active UV map";
-	ot->idname= "UV_OT_unlink_selected";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "Unlink Selection";
+	ot->description = "Unlink selected UV vertices from active UV map";
+	ot->idname = "UV_OT_unlink_selected";
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* api callbacks */
-	ot->exec= unlink_selection_exec;
-	ot->poll= ED_operator_uvedit;
+	ot->exec = unlink_selection_exec;
+	ot->poll = ED_operator_uvedit;
 }
 
 /* ******************** border select operator **************** */
@@ -1981,85 +2299,82 @@ static void uv_faces_do_sticky(bContext *C, SpaceImage *sima, Scene *scene, Obje
 	 * This only needs to be done when the Mesh is not used for
 	 * selection (so for sticky modes, vertex or location based). */
 	
-	ToolSettings *ts= CTX_data_tool_settings(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	EditFace *efa;
-	MTFace *tf;
-	int nverts, i;
+	ToolSettings *ts = CTX_data_tool_settings(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	/* MTexPoly *tf; */
 	
-	if((ts->uv_flag & UV_SYNC_SELECTION)==0 && sima->sticky == SI_STICKY_VERTEX) {
+	if ((ts->uv_flag & UV_SYNC_SELECTION) == 0 && sima->sticky == SI_STICKY_VERTEX) {
 		/* Tag all verts as untouched, then touch the ones that have a face center
-		 * in the loop and select all MTFace UV's that use a touched vert. */
-		EditVert *eve;
+		 * in the loop and select all MLoopUV's that use a touched vert. */
+		BMVert *eve;
 		
-		for(eve= em->verts.first; eve; eve= eve->next)
-			eve->tmp.l = 0;
+		BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
+			BM_elem_flag_disable(eve, BM_ELEM_TAG);
+		}
 		
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->tmp.l) {
-				if(efa->v4)
-					efa->v1->tmp.l=	efa->v2->tmp.l= efa->v3->tmp.l= efa->v4->tmp.l=1;
-				else
-					efa->v1->tmp.l= efa->v2->tmp.l= efa->v3->tmp.l= 1;
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			if (BM_elem_flag_test(efa, BM_ELEM_TAG)) {
+				BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+					BM_elem_flag_enable(l->v, BM_ELEM_TAG);
+				}
 			}
 		}
 
 		/* now select tagged verts */
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);		
-			nverts= efa->v4? 4: 3;
-			for(i=0; i<nverts; i++) {
-				if((*(&efa->v1 + i))->tmp.l) {
-					if(select)
-						uvedit_uv_select(scene, efa, tf, i);
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			/* tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); */ /* UNUSED */
+
+			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+				if (BM_elem_flag_test(l->v, BM_ELEM_TAG)) {
+					if (select)
+						uvedit_uv_select_enable(em, scene, l, FALSE);
 					else
-						uvedit_uv_deselect(scene, efa, tf, i);
+						uvedit_uv_select_disable(em, scene, l);
 				}
 			}
 		}
 	}
-	else if((ts->uv_flag & UV_SYNC_SELECTION)==0 && sima->sticky == SI_STICKY_LOC) {
-		EditFace *efa_vlist;
-		MTFace *tf_vlist;
-		UvMapVert *start_vlist=NULL, *vlist_iter;
+	else if ((ts->uv_flag & UV_SYNC_SELECTION) == 0 && sima->sticky == SI_STICKY_LOC) {
+		BMFace *efa_vlist;
+		/* MTexPoly *tf_vlist; */ /* UNUSED */
+		UvMapVert *start_vlist = NULL, *vlist_iter;
 		struct UvVertMap *vmap;
 		float limit[2];
 		unsigned int efa_index;
-		//EditVert *eve; /* removed vert counting for now */ 
+		//BMVert *eve; /* removed vert counting for now */ 
 		//int a;
 		
 		uvedit_pixel_to_float(sima, limit, 0.05);
 		
-		EM_init_index_arrays(em, 0, 0, 1);
-		vmap= EM_make_uv_vert_map(em, 0, 0, limit);
+		EDBM_index_arrays_init(em, 0, 0, 1);
+		vmap = EDBM_uv_vert_map_create(em, 0, 0, limit);
 		
 		/* verts are numbered above in make_uv_vert_map_EM, make sure this stays true! */
-		/*for(a=0, eve= em->verts.first; eve; a++, eve= eve->next)
-			eve->tmp.l = a; */
-		
-		if(vmap == NULL) {
-			BKE_mesh_end_editmesh(obedit->data, em);
+		if (vmap == NULL) {
 			return;
 		}
 		
-		for(efa_index=0, efa= em->faces.first; efa; efa_index++, efa= efa->next) {
-			if(efa->tmp.l) {
-				tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-				nverts= efa->v4? 4: 3;
-
-				for(i=0; i<nverts; i++) {
-					if(select)
-						uvedit_uv_select(scene, efa, tf, i);
+		efa = BM_iter_new(&iter, em->bm, BM_FACES_OF_MESH, NULL);
+		for (efa_index = 0; efa; efa = BM_iter_step(&iter), efa_index++) {
+			if (BM_elem_flag_test(efa, BM_ELEM_TAG)) {
+				/* tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); */ /* UNUSED */
+				
+				BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+					if (select)
+						uvedit_uv_select_enable(em, scene, l, FALSE);
 					else
-						uvedit_uv_deselect(scene, efa, tf, i);
+						uvedit_uv_select_disable(em, scene, l);
 					
-					vlist_iter= EM_get_uv_map_vert(vmap, (*(&efa->v1 + i))->tmp.l);
+					vlist_iter = EDBM_uv_vert_map_at_index(vmap, BM_elem_index_get(l->v));
 					
 					while (vlist_iter) {
-						if(vlist_iter->separate)
+						if (vlist_iter->separate)
 							start_vlist = vlist_iter;
 						
-						if(efa_index == vlist_iter->f)
+						if (efa_index == vlist_iter->f)
 							break;
 
 						vlist_iter = vlist_iter->next;
@@ -2068,190 +2383,174 @@ static void uv_faces_do_sticky(bContext *C, SpaceImage *sima, Scene *scene, Obje
 					vlist_iter = start_vlist;
 					while (vlist_iter) {
 						
-						if(vlist_iter != start_vlist && vlist_iter->separate)
+						if (vlist_iter != start_vlist && vlist_iter->separate)
 							break;
 						
-						if(efa_index != vlist_iter->f) {
-							efa_vlist = EM_get_face_for_index(vlist_iter->f);
-							tf_vlist = CustomData_em_get(&em->fdata, efa_vlist->data, CD_MTFACE);
+						if (efa_index != vlist_iter->f) {
+							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 */
 							
-							if(select)
-								uvedit_uv_select(scene, efa_vlist, tf_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);
 							else
-								uvedit_uv_deselect(scene, efa_vlist, tf_vlist, vlist_iter->tfindex);
+								uvedit_uv_select_disable(em, scene, BM_iter_at_index(em->bm, BM_LOOPS_OF_FACE, efa_vlist, vlist_iter->tfindex));
 						}
 						vlist_iter = vlist_iter->next;
 					}
 				}
 			}
 		}
-		EM_free_index_arrays();
-		EM_free_uv_vert_map(vmap);
+		EDBM_index_arrays_free(em);
+		EDBM_uv_vert_map_free(vmap);
 		
 	}
 	else { /* SI_STICKY_DISABLE or ts->uv_flag & UV_SYNC_SELECTION */
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->tmp.l) {
-				tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-				if(select)
-					uvedit_face_select(scene, efa, tf);
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			if (BM_elem_flag_test(efa, BM_ELEM_TAG)) {
+				if (select)
+					uvedit_face_select_enable(scene, em, efa, FALSE);
 				else
-					uvedit_face_deselect(scene, efa, tf);
+					uvedit_face_select_disable(scene, em, efa);
 			}
 		}
 	}
-	BKE_mesh_end_editmesh(obedit->data, em);
 }
 
 static int border_select_exec(bContext *C, wmOperator *op)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	Scene *scene= CTX_data_scene(C);
-	ToolSettings *ts= CTX_data_tool_settings(C);
-	Object *obedit= CTX_data_edit_object(C);
-	Image *ima= CTX_data_edit_image(C);
-	ARegion *ar= CTX_wm_region(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	EditFace *efa;
-	MTFace *tface;
+	SpaceImage *sima = CTX_wm_space_image(C);
+	Scene *scene = CTX_data_scene(C);
+	ToolSettings *ts = CTX_data_tool_settings(C);
+	Object *obedit = CTX_data_edit_object(C);
+	Image *ima = CTX_data_edit_image(C);
+	ARegion *ar = CTX_wm_region(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	MTexPoly *tf;
+	MLoopUV *luv;
 	rcti rect;
 	rctf rectf;
 	int change, pinned, select, faces, extend;
 
 	/* get rectangle from operator */
-	rect.xmin= RNA_int_get(op->ptr, "xmin");
-	rect.ymin= RNA_int_get(op->ptr, "ymin");
-	rect.xmax= RNA_int_get(op->ptr, "xmax");
-	rect.ymax= RNA_int_get(op->ptr, "ymax");
+	rect.xmin = RNA_int_get(op->ptr, "xmin");
+	rect.ymin = RNA_int_get(op->ptr, "ymin");
+	rect.xmax = RNA_int_get(op->ptr, "xmax");
+	rect.ymax = RNA_int_get(op->ptr, "ymax");
 		
 	UI_view2d_region_to_view(&ar->v2d, rect.xmin, rect.ymin, &rectf.xmin, &rectf.ymin);
 	UI_view2d_region_to_view(&ar->v2d, rect.xmax, rect.ymax, &rectf.xmax, &rectf.ymax);
 
 	/* figure out what to select/deselect */
-	select= (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT);
-	pinned= RNA_boolean_get(op->ptr, "pinned");
-	extend= RNA_boolean_get(op->ptr, "extend");
+	select = (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_SELECT);
+	pinned = RNA_boolean_get(op->ptr, "pinned");
+	extend = RNA_boolean_get(op->ptr, "extend");
 
-	if(!extend)
-		select_all_perform(C, SEL_DESELECT);
+	if (!extend)
+		select_all_perform(scene, ima, em, SEL_DESELECT);
 	
-	if(ts->uv_flag & UV_SYNC_SELECTION)
-		faces= (ts->selectmode == SCE_SELECT_FACE);
+	if (ts->uv_flag & UV_SYNC_SELECTION)
+		faces = (ts->selectmode == SCE_SELECT_FACE);
 	else
-		faces= (ts->uv_selectmode == UV_SELECT_FACE);
+		faces = (ts->uv_selectmode == UV_SELECT_FACE);
 
 	/* do actual selection */
-	if(faces && !pinned) {
+	if (faces && !pinned) {
 		/* handle face selection mode */
 		float cent[2];
 
-		change= 0;
+		change = 0;
 
-		for(efa= em->faces.first; efa; efa= efa->next) {
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
 			/* assume not touched */
-			efa->tmp.l = 0;
-			tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-			if(uvedit_face_visible(scene, ima, efa, tface)) {
-				uv_center(tface->uv, cent, efa->v4 != NULL);
-				if(BLI_in_rctf(&rectf, cent[0], cent[1])) {
-					efa->tmp.l = change = 1;
+			BM_elem_flag_disable(efa, BM_ELEM_TAG);
+
+			tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
+			if (uvedit_face_visible_test(scene, ima, efa, tf)) {
+				poly_uv_center(em, efa, cent);
+				if (BLI_in_rctf(&rectf, cent[0], cent[1])) {
+					BM_elem_flag_enable(efa, BM_ELEM_TAG);
+					change = 1;
 				}
 			}
 		}
 
 		/* (de)selects all tagged faces and deals with sticky modes */
-		if(change)
+		if (change)
 			uv_faces_do_sticky(C, sima, scene, obedit, select);
 	}
 	else {
 		/* other selection modes */
-		change= 1;
+		change = 1;
+		
+		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) {
+				luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+
+				if (!pinned || (ts->uv_flag & UV_SYNC_SELECTION) ) {
 
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-			if(uvedit_face_visible(scene, ima, efa, tface)) {
-				if(!pinned || (ts->uv_flag & UV_SYNC_SELECTION) ) {
 					/* UV_SYNC_SELECTION - can't do pinned selection */
-					if(BLI_in_rctf(&rectf, tface->uv[0][0], tface->uv[0][1])) {
-						if(select)	uvedit_uv_select(scene, efa, tface, 0);
-						else		uvedit_uv_deselect(scene, efa, tface, 0);
-					}
-					if(BLI_in_rctf(&rectf, tface->uv[1][0], tface->uv[1][1])) {
-						if(select)	uvedit_uv_select(scene, efa, tface, 1);
-						else		uvedit_uv_deselect(scene, efa, tface, 1);
-					}
-					if(BLI_in_rctf(&rectf, tface->uv[2][0], tface->uv[2][1])) {
-						if(select)	uvedit_uv_select(scene, efa, tface, 2);
-						else		uvedit_uv_deselect(scene, efa, tface, 2);
-					}
-					if(efa->v4 && BLI_in_rctf(&rectf, tface->uv[3][0], tface->uv[3][1])) {
-						if(select)	uvedit_uv_select(scene, efa, tface, 3);
-						else		uvedit_uv_deselect(scene, efa, tface, 3);
+					if (BLI_in_rctf(&rectf, luv->uv[0], luv->uv[1])) {
+						if (select) uvedit_uv_select_enable(em, scene, l, FALSE);
+						else uvedit_uv_select_disable(em, scene, l);
 					}
 				}
-				else if(pinned) {
-					if((tface->unwrap & TF_PIN1) && 
-						BLI_in_rctf(&rectf, tface->uv[0][0], tface->uv[0][1])) {
-						
-						if(select)	uvedit_uv_select(scene, efa, tface, 0);
-						else		uvedit_uv_deselect(scene, efa, tface, 0);
-					}
-					if((tface->unwrap & TF_PIN2) && 
-						BLI_in_rctf(&rectf, tface->uv[1][0], tface->uv[1][1])) {
-						
-						if(select)	uvedit_uv_select(scene, efa, tface, 1);
-						else		uvedit_uv_deselect(scene, efa, tface, 1);
-					}
-					if((tface->unwrap & TF_PIN3) && 
-						BLI_in_rctf(&rectf, tface->uv[2][0], tface->uv[2][1])) {
-						
-						if(select)	uvedit_uv_select(scene, efa, tface, 2);
-						else		uvedit_uv_deselect(scene, efa, tface, 2);
-					}
-					if((efa->v4) && (tface->unwrap & TF_PIN4) && BLI_in_rctf(&rectf, tface->uv[3][0], tface->uv[3][1])) {
-						if(select)	uvedit_uv_select(scene, efa, tface, 3);
-						else		uvedit_uv_deselect(scene, efa, tface, 3);
+				else if (pinned) {
+					if ((luv->flag & MLOOPUV_PINNED) && 
+					    BLI_in_rctf(&rectf, luv->uv[0], luv->uv[1])) {
+						if (select) uvedit_uv_select_enable(em, scene, l, FALSE);
+						else uvedit_uv_select_disable(em, scene, l);
 					}
 				}
 			}
 		}
 	}
 
-	if(change) {
-		/* make sure newly selected vert selection is updated*/
-		if(ts->uv_flag & UV_SYNC_SELECTION) {
-			if(ts->selectmode != SCE_SELECT_FACE) {
-				if(select)	EM_select_flush(em);
-				else		EM_deselect_flush(em);
+	if (change) {
+		/* bmesh API habdles flushing but not on de-select */
+		if (ts->uv_flag & UV_SYNC_SELECTION) {
+			if (ts->selectmode != SCE_SELECT_FACE) {
+				if (select == FALSE) {
+					EDBM_deselect_flush(em);
+				}
+			}
+		}
+
+		if (ts->uv_flag & UV_SYNC_SELECTION) {
+			if (select == FALSE) {
+				BM_select_history_validate(em->bm);
 			}
 		}
 
-		WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
+		WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 		
-		BKE_mesh_end_editmesh(obedit->data, em);
 		return OPERATOR_FINISHED;
 	}
-	
-	BKE_mesh_end_editmesh(obedit->data, em);
+
 	return OPERATOR_CANCELLED;
 } 
 
 static void UV_OT_select_border(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Border Select";
-	ot->description= "Select UV vertices using border selection";
-	ot->idname= "UV_OT_select_border";
+	ot->name = "Border Select";
+	ot->description = "Select UV vertices using border selection";
+	ot->idname = "UV_OT_select_border";
 	
 	/* api callbacks */
-	ot->invoke= WM_border_select_invoke;
-	ot->exec= border_select_exec;
-	ot->modal= WM_border_select_modal;
-	ot->poll= ED_operator_image_active;	/* requires space image */;
-	ot->cancel= WM_border_select_cancel;
+	ot->invoke = WM_border_select_invoke;
+	ot->exec = border_select_exec;
+	ot->modal = WM_border_select_modal;
+	ot->poll = ED_operator_image_active; /* requires space image */;
+	ot->cancel = WM_border_select_cancel;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_boolean(ot->srna, "pinned", 0, "Pinned", "Border select pinned UVs only");
@@ -2261,87 +2560,89 @@ static void UV_OT_select_border(wmOperatorType *ot)
 
 /* ******************** circle select operator **************** */
 
-static void select_uv_inside_ellipse(Scene *scene, int select, EditFace *efa, MTFace *tface, int index, float *offset, float *ell, int select_index)
+static void select_uv_inside_ellipse(BMEditMesh *em, SpaceImage *UNUSED(sima), Scene *scene, int select,
+                                     float *offset, float *ell, BMLoop *l, MLoopUV *luv)
 {
 	/* normalized ellipse: ell[0] = scaleX, ell[1] = scaleY */
 	float x, y, r2, *uv;
 	
-	uv= tface->uv[index];
+	
+	uv = luv->uv;
 
-	x= (uv[0] - offset[0])*ell[0];
-	y= (uv[1] - offset[1])*ell[1];
+	x = (uv[0] - offset[0]) * ell[0];
+	y = (uv[1] - offset[1]) * ell[1];
 
-	r2 = x*x + y*y;
-	if(r2 < 1.0f) {
-		if(select)	uvedit_uv_select(scene, efa, tface, select_index);
-		else uvedit_uv_deselect(scene, efa, tface, select_index);
+	r2 = x * x + y * y;
+	if (r2 < 1.0f) {
+		if (select) uvedit_uv_select_enable(em, scene, l, FALSE);
+		else uvedit_uv_select_disable(em, scene, l);
 	}
 }
 
 static int circle_select_exec(bContext *C, wmOperator *op)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	Scene *scene= CTX_data_scene(C);
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	ARegion *ar= CTX_wm_region(C);
-	EditFace *efa;
-	MTFace *tface;
+	SpaceImage *sima = CTX_wm_space_image(C);
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	ARegion *ar = CTX_wm_region(C);
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	MLoopUV *luv;
 	int x, y, radius, width, height, select;
 	float zoomx, zoomy, offset[2], ellipse[2];
-	int gesture_mode= RNA_int_get(op->ptr, "gesture_mode");
+	int gesture_mode = RNA_int_get(op->ptr, "gesture_mode");
 
 	/* get operator properties */
-	select= (gesture_mode == GESTURE_MODAL_SELECT);
-	x= RNA_int_get(op->ptr, "x");
-	y= RNA_int_get(op->ptr, "y");
-	radius= RNA_int_get(op->ptr, "radius");
+	select = (gesture_mode == GESTURE_MODAL_SELECT);
+	x = RNA_int_get(op->ptr, "x");
+	y = RNA_int_get(op->ptr, "y");
+	radius = RNA_int_get(op->ptr, "radius");
 
 	/* compute ellipse size and location, not a circle since we deal
 	 * with non square image. ellipse is normalized, r = 1.0. */
 	ED_space_image_size(sima, &width, &height);
 	ED_space_image_zoom(sima, ar, &zoomx, &zoomy);
 
-	ellipse[0]= width*zoomx/radius;
-	ellipse[1]= height*zoomy/radius;
+	ellipse[0] = width * zoomx / radius;
+	ellipse[1] = height * zoomy / radius;
 
 	UI_view2d_region_to_view(&ar->v2d, x, y, &offset[0], &offset[1]);
 	
 	/* do selection */
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-		select_uv_inside_ellipse(scene, select, efa, tface, 0, offset, ellipse, 0);
-		select_uv_inside_ellipse(scene, select, efa, tface, 1, offset, ellipse, 1);
-		select_uv_inside_ellipse(scene, select, efa, tface, 2, offset, ellipse, 2);
-		if(efa->v4)
-			select_uv_inside_ellipse(scene, select, efa, tface, 3, offset, ellipse, 3);
+	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);
+			select_uv_inside_ellipse(em, sima, scene, select, offset, ellipse, l, luv);
+		}
 	}
 
-	if(select) EM_select_flush(em);
+#if 0 //I think the BM_elem_select_set api stuff handles all this as necessary?
+	if (select) EM_select_flush(em);
 	else EM_deselect_flush(em);
+#endif
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
-
-	BKE_mesh_end_editmesh(obedit->data, em);
 	return OPERATOR_FINISHED;
 }
 
 static void UV_OT_circle_select(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Circle Select";
-	ot->description= "Select UV vertices using circle selection";
-	ot->idname= "UV_OT_circle_select";
+	ot->name = "Circle Select";
+	ot->description = "Select UV vertices using circle selection";
+	ot->idname = "UV_OT_circle_select";
 	
 	/* api callbacks */
-	ot->invoke= WM_gesture_circle_invoke;
-	ot->modal= WM_gesture_circle_modal;
-	ot->exec= circle_select_exec;
-	ot->poll= ED_operator_image_active;	/* requires space image */;
-	ot->cancel= WM_gesture_circle_cancel;
+	ot->invoke = WM_gesture_circle_invoke;
+	ot->modal = WM_gesture_circle_modal;
+	ot->exec = circle_select_exec;
+	ot->poll = ED_operator_image_active; /* requires space image */;
+	ot->cancel = WM_gesture_circle_cancel;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* properties */
 	RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX);
@@ -2354,13 +2655,13 @@ static void UV_OT_circle_select(wmOperatorType *ot)
 
 static void snap_uv_to_pixel(float *uvco, float w, float h)
 {
-	uvco[0] = ((float)((int)((uvco[0]*w) + 0.5f)))/w;
-	uvco[1] = ((float)((int)((uvco[1]*h) + 0.5f)))/h;
+	uvco[0] = ((float)((int)((uvco[0] * w) + 0.5f))) / w;
+	uvco[1] = ((float)((int)((uvco[1] * h) + 0.5f))) / h;
 }
 
 static void snap_cursor_to_pixels(SpaceImage *sima)
 {
-	int width= 0, height= 0;
+	int width = 0, height = 0;
 
 	ED_space_image_size(sima, &width, &height);
 	snap_uv_to_pixel(sima->cursor, width, height);
@@ -2373,26 +2674,26 @@ static int snap_cursor_to_selection(Scene *scene, Image *ima, Object *obedit, Sp
 
 static int snap_cursor_exec(bContext *C, wmOperator *op)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	Scene *scene= CTX_data_scene(C);
-	Object *obedit= CTX_data_edit_object(C);
-	Image *ima= CTX_data_edit_image(C);
-	int change= 0;
+	SpaceImage *sima = CTX_wm_space_image(C);
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit = CTX_data_edit_object(C);
+	Image *ima = CTX_data_edit_image(C);
+	int change = 0;
 
-	switch(RNA_enum_get(op->ptr, "target")) {
+	switch (RNA_enum_get(op->ptr, "target")) {
 		case 0:
 			snap_cursor_to_pixels(sima);
-			change= 1;
+			change = 1;
 			break;
 		case 1:
-			change= snap_cursor_to_selection(scene, ima, obedit, sima);
+			change = snap_cursor_to_selection(scene, ima, obedit, sima);
 			break;
 	}
 
-	if(!change)
+	if (!change)
 		return OPERATOR_CANCELLED;
 	
-	WM_event_add_notifier(C, NC_SPACE|ND_SPACE_IMAGE, sima);
+	WM_event_add_notifier(C, NC_SPACE | ND_SPACE_IMAGE, sima);
 
 	return OPERATOR_FINISHED;
 }
@@ -2405,14 +2706,14 @@ static void UV_OT_snap_cursor(wmOperatorType *ot)
 		{0, NULL, 0, NULL, NULL}};
 
 	/* identifiers */
-	ot->name= "Snap Cursor";
-	ot->description= "Snap cursor to target type";
-	ot->idname= "UV_OT_snap_cursor";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "Snap Cursor";
+	ot->description = "Snap cursor to target type";
+	ot->idname = "UV_OT_snap_cursor";
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* api callbacks */
-	ot->exec= snap_cursor_exec;
-	ot->poll= ED_operator_image_active;	/* requires space image */;
+	ot->exec = snap_cursor_exec;
+	ot->poll = ED_operator_image_active; /* requires space image */;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "target", target_items, 0, "Target", "Target to snap the selected UVs to");
@@ -2422,218 +2723,149 @@ static void UV_OT_snap_cursor(wmOperatorType *ot)
 
 static int snap_uvs_to_cursor(Scene *scene, Image *ima, Object *obedit, SpaceImage *sima)
 {
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	EditFace *efa;
-	MTFace *tface;
-	short change= 0;
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	MTexPoly *tface;
+	MLoopUV *luv;
+	short change = 0;
 
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-		if(uvedit_face_visible(scene, ima, efa, tface)) {
-			if(uvedit_uv_selected(scene, efa, tface, 0))		copy_v2_v2(tface->uv[0], sima->cursor);
-			if(uvedit_uv_selected(scene, efa, tface, 1))		copy_v2_v2(tface->uv[1], sima->cursor);
-			if(uvedit_uv_selected(scene, efa, tface, 2))		copy_v2_v2(tface->uv[2], sima->cursor);
-			if(efa->v4)
-				if(uvedit_uv_selected(scene, efa, tface, 3))	copy_v2_v2(tface->uv[3], sima->cursor);
+	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+		tface = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
+		if (!uvedit_face_visible_test(scene, ima, efa, tface))
+			continue;
 
-			change= 1;
+		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);
+				copy_v2_v2(luv->uv, sima->cursor);
+				change = 1;
+			}
 		}
 	}
 
-	BKE_mesh_end_editmesh(obedit->data, em);
 	return change;
 }
 
 static int snap_uvs_to_adjacent_unselected(Scene *scene, Image *ima, Object *obedit)
 {
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	EditFace *efa;
-	EditVert *eve;
-	MTFace *tface;
-	short change = 0;
-	int count = 0;
-	float *coords;
-	short *usercount, users;
-	
-	/* set all verts to -1 : an unused index*/
-	for(eve= em->verts.first; eve; eve= eve->next)
-		eve->tmp.l=-1;
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMesh *bm = em->bm;
+	BMFace *f;
+	BMLoop *l, *lsub;
+	BMIter iter, liter, lsubiter;
+	MTexPoly *tface;
+	MLoopUV *luv;
+	short change = FALSE;
 	
 	/* index every vert that has a selected UV using it, but only once so as to
 	 * get unique indices and to count how much to malloc */
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
-		if(uvedit_face_visible(scene, ima, efa, tface)) {
-			if(uvedit_uv_selected(scene, efa, tface, 0) && efa->v1->tmp.l==-1)		efa->v1->tmp.l= count++;
-			if(uvedit_uv_selected(scene, efa, tface, 1) && efa->v2->tmp.l==-1)		efa->v2->tmp.l= count++;
-			if(uvedit_uv_selected(scene, efa, tface, 2) && efa->v3->tmp.l==-1)		efa->v3->tmp.l= count++;
-			if(efa->v4)
-				if(uvedit_uv_selected(scene, efa, tface, 3) && efa->v4->tmp.l==-1)	efa->v4->tmp.l= count++;
-
-			change = 1;
-			
-			/* optional speedup */
-			efa->tmp.p = tface;
-		}
-		else
-			efa->tmp.p = NULL;
-	}
-	
-	coords = MEM_callocN(sizeof(float)*count*2, "snap to adjacent coords");
-	usercount = MEM_callocN(sizeof(short)*count, "snap to adjacent counts");
-	
-	/* add all UV coords from visible, unselected UV coords as well as counting them to average later */
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		if((tface=(MTFace *)efa->tmp.p)) {
-			/* is this an unselected UV we can snap to? */
-			if(efa->v1->tmp.l >= 0 && (!uvedit_uv_selected(scene, efa, tface, 0))) {
-				coords[efa->v1->tmp.l*2] +=		tface->uv[0][0];
-				coords[(efa->v1->tmp.l*2)+1] +=	tface->uv[0][1];
-				usercount[efa->v1->tmp.l]++;
-				change = 1;
-			}
-			if(efa->v2->tmp.l >= 0 && (!uvedit_uv_selected(scene, efa, tface, 1))) {
-				coords[efa->v2->tmp.l*2] +=		tface->uv[1][0];
-				coords[(efa->v2->tmp.l*2)+1] +=	tface->uv[1][1];
-				usercount[efa->v2->tmp.l]++;
-				change = 1;
-			}
-			if(efa->v3->tmp.l >= 0 && (!uvedit_uv_selected(scene, efa, tface, 2))) {
-				coords[efa->v3->tmp.l*2] +=		tface->uv[2][0];
-				coords[(efa->v3->tmp.l*2)+1] +=	tface->uv[2][1];
-				usercount[efa->v3->tmp.l]++;
-				change = 1;
-			}
-			
-			if(efa->v4) {
-				if(efa->v4->tmp.l >= 0 && (!uvedit_uv_selected(scene, efa, tface, 3))) {
-					coords[efa->v4->tmp.l*2] +=		tface->uv[3][0];
-					coords[(efa->v4->tmp.l*2)+1] +=	tface->uv[3][1];
-					usercount[efa->v4->tmp.l]++;
-					change = 1;
-				}
+	BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+		tface = CustomData_bmesh_get(&bm->pdata, f->head.data, CD_MTEXPOLY);
+		if (uvedit_face_visible_test(scene, ima, f, tface)) {
+			BM_elem_flag_enable(f, BM_ELEM_TAG);
+			BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+				BM_elem_flag_set(l, BM_ELEM_TAG, uvedit_uv_select_test(em, scene, l));
 			}
 		}
+		else {
+			BM_elem_flag_disable(f, BM_ELEM_TAG);
+		}
 	}
-	
-	/* no other verts selected, bail out */
-	if(!change) {
-		MEM_freeN(coords);
-		MEM_freeN(usercount);
-		BKE_mesh_end_editmesh(obedit->data, em);
-		return change;
-	}
-	
-	/* copy the averaged unselected UVs back to the selected UVs */
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		if((tface=(MTFace *)efa->tmp.p)) {
-			
-			if(	uvedit_uv_selected(scene, efa, tface, 0) &&
-					efa->v1->tmp.l >= 0 &&
-					(users = usercount[efa->v1->tmp.l])
-			) {
-				tface->uv[0][0] = coords[efa->v1->tmp.l*2]		/ users;
-				tface->uv[0][1] = coords[(efa->v1->tmp.l*2)+1]	/ users;
-			}
 
-			if(	uvedit_uv_selected(scene, efa, tface, 1) &&
-					efa->v2->tmp.l >= 0 &&
-					(users = usercount[efa->v2->tmp.l])
-			) {
-				tface->uv[1][0] = coords[efa->v2->tmp.l*2]		/ users;
-				tface->uv[1][1] = coords[(efa->v2->tmp.l*2)+1]	/ users;
-			}
-			
-			if(	uvedit_uv_selected(scene, efa, tface, 2) &&
-					efa->v3->tmp.l >= 0 &&
-					(users = usercount[efa->v3->tmp.l])
-			) {
-				tface->uv[2][0] = coords[efa->v3->tmp.l*2]		/ users;
-				tface->uv[2][1] = coords[(efa->v3->tmp.l*2)+1]	/ users;
-			}
-			
-			if(efa->v4) {
-				if(	uvedit_uv_selected(scene, efa, tface, 3) &&
-						efa->v4->tmp.l >= 0 &&
-						(users = usercount[efa->v4->tmp.l])
-				) {
-					tface->uv[3][0] = coords[efa->v4->tmp.l*2]		/ users;
-					tface->uv[3][1] = coords[(efa->v4->tmp.l*2)+1]	/ users;
+	BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+		if (BM_elem_flag_test(f, BM_ELEM_TAG)) {           /* face: visible */
+			BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+				if (BM_elem_flag_test(l, BM_ELEM_TAG)) {   /* loop: selected*/
+					float uv[2] = {0.0f, 0.0f};
+					int uv_tot = 0;
+
+					BM_ITER_ELEM (lsub, &lsubiter, l->v, BM_LOOPS_OF_VERT) {
+						if (BM_elem_flag_test(lsub->f, BM_ELEM_TAG) && /* face: visible */
+						    !BM_elem_flag_test(lsub, BM_ELEM_TAG))     /* loop: unselected  */
+						{
+
+							luv = CustomData_bmesh_get(&bm->ldata, lsub->head.data, CD_MLOOPUV);
+							add_v2_v2(uv, luv->uv);
+							uv_tot++;
+						}
+					}
+
+					if (uv_tot) {
+						luv = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_MLOOPUV);
+						mul_v2_v2fl(luv->uv, uv, 1.0f / (float)uv_tot);
+						change = TRUE;
+					}
 				}
 			}
 		}
 	}
-	
-	MEM_freeN(coords);
-	MEM_freeN(usercount);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
 	return change;
 }
 
 static int snap_uvs_to_pixels(SpaceImage *sima, Scene *scene, Object *obedit)
 {
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	Image *ima;
-	EditFace *efa;
-	MTFace *tface;
-	int width= 0, height= 0;
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	Image *ima = sima->image;
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	MTexPoly *tface;
+	MLoopUV *luv;
+	int width = 0, height = 0;
 	float w, h;
 	short change = 0;
 
-	if(!sima)
-		return 0;
-	
-	ima= sima->image;
-	
 	ED_space_image_size(sima, &width, &height);
 	w = (float)width;
 	h = (float)height;
 	
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		tface= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-		if(uvedit_face_visible(scene, ima, efa, tface)) {
-			if(uvedit_uv_selected(scene, efa, tface, 0)) snap_uv_to_pixel(tface->uv[0], w, h);
-			if(uvedit_uv_selected(scene, efa, tface, 1)) snap_uv_to_pixel(tface->uv[1], w, h);
-			if(uvedit_uv_selected(scene, efa, tface, 2)) snap_uv_to_pixel(tface->uv[2], w, h);
-			if(efa->v4)
-				if(uvedit_uv_selected(scene, efa, tface, 3)) snap_uv_to_pixel(tface->uv[3], w, h);
+	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+		tface = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
+		if (!uvedit_face_visible_test(scene, ima, efa, tface))
+			continue;
 
-			change = 1;
+		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);
+				snap_uv_to_pixel(luv->uv, w, h);
+			}
 		}
+
+		change = 1;
 	}
 
-	BKE_mesh_end_editmesh(obedit->data, em);
 	return change;
 }
 
 static int snap_selection_exec(bContext *C, wmOperator *op)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	Scene *scene= CTX_data_scene(C);
-	Object *obedit= CTX_data_edit_object(C);
-	Image *ima= CTX_data_edit_image(C);
-	int change= 0;
+	SpaceImage *sima = CTX_wm_space_image(C);
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit = CTX_data_edit_object(C);
+	Image *ima = CTX_data_edit_image(C);
+	int change = 0;
 
-	switch(RNA_enum_get(op->ptr, "target")) {
+	switch (RNA_enum_get(op->ptr, "target")) {
 		case 0:
-			change= snap_uvs_to_pixels(sima, scene, obedit);
+			change = snap_uvs_to_pixels(sima, scene, obedit);
 			break;
 		case 1:
-			change= snap_uvs_to_cursor(scene, ima, obedit, sima);
+			change = snap_uvs_to_cursor(scene, ima, obedit, sima);
 			break;
 		case 2:
-			change= snap_uvs_to_adjacent_unselected(scene, ima, obedit);
+			change = snap_uvs_to_adjacent_unselected(scene, ima, obedit);
 			break;
 	}
 
-	if(!change)
+	if (!change)
 		return OPERATOR_CANCELLED;
 
 	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);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 
 	return OPERATOR_FINISHED;
 }
@@ -2647,14 +2879,14 @@ static void UV_OT_snap_selected(wmOperatorType *ot)
 		{0, NULL, 0, NULL, NULL}};
 
 	/* identifiers */
-	ot->name= "Snap Selection";
-	ot->description= "Snap selected UV vertices to target type";
-	ot->idname= "UV_OT_snap_selected";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "Snap Selection";
+	ot->description = "Snap selected UV vertices to target type";
+	ot->idname = "UV_OT_snap_selected";
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* api callbacks */
-	ot->exec= snap_selection_exec;
-	ot->poll= ED_operator_image_active;	/* requires space image */;
+	ot->exec = snap_selection_exec;
+	ot->poll = ED_operator_image_active; /* requires space image */;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "target", target_items, 0, "Target", "Target to snap the selected UVs to");
@@ -2664,52 +2896,52 @@ static void UV_OT_snap_selected(wmOperatorType *ot)
 
 static int pin_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Object *obedit= CTX_data_edit_object(C);
-	Image *ima= CTX_data_edit_image(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	EditFace *efa;
-	MTFace *tface;
-	int clear= RNA_boolean_get(op->ptr, "clear");
-	
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
-		if(uvedit_face_visible(scene, ima, efa, tface)) {
-			if(!clear) {
-				if(uvedit_uv_selected(scene, efa, tface, 0)) tface->unwrap |= TF_PIN1;
-				if(uvedit_uv_selected(scene, efa, tface, 1)) tface->unwrap |= TF_PIN2;
-				if(uvedit_uv_selected(scene, efa, tface, 2)) tface->unwrap |= TF_PIN3;
-				if(efa->v4)
-					if(uvedit_uv_selected(scene, efa, tface, 3)) tface->unwrap |= TF_PIN4;
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit = CTX_data_edit_object(C);
+	Image *ima = CTX_data_edit_image(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	MTexPoly *tface;
+	MLoopUV *luv;
+	int clear = RNA_boolean_get(op->ptr, "clear");
+	
+	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+		tface = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
+		if (!uvedit_face_visible_test(scene, ima, efa, tface))
+			continue;
+
+		BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+			luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+			
+			if (!clear) {
+				if (uvedit_uv_select_test(em, scene, l))
+					luv->flag |= MLOOPUV_PINNED;
 			}
 			else {
-				if(uvedit_uv_selected(scene, efa, tface, 0)) tface->unwrap &= ~TF_PIN1;
-				if(uvedit_uv_selected(scene, efa, tface, 1)) tface->unwrap &= ~TF_PIN2;
-				if(uvedit_uv_selected(scene, efa, tface, 2)) tface->unwrap &= ~TF_PIN3;
-				if(efa->v4)
-					if(uvedit_uv_selected(scene, efa, tface, 3)) tface->unwrap &= ~TF_PIN4;
+				if (uvedit_uv_select_test(em, scene, l))
+					luv->flag &= ~MLOOPUV_PINNED;
 			}
 		}
 	}
 	
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
 	return OPERATOR_FINISHED;
 }
 
 static void UV_OT_pin(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Pin";
-	ot->description= "Set/clear selected UV vertices as anchored between multiple unwrap operations";
-	ot->idname= "UV_OT_pin";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "Pin";
+	ot->description = "Set/clear selected UV vertices as anchored between multiple unwrap operations";
+	ot->idname = "UV_OT_pin";
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* api callbacks */
-	ot->exec= pin_exec;
-	ot->poll= ED_operator_uvedit;
+	ot->exec = pin_exec;
+	ot->poll = ED_operator_uvedit;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "clear", 0, "Clear", "Clear pinning for the selection instead of setting it");
@@ -2719,182 +2951,178 @@ static void UV_OT_pin(wmOperatorType *ot)
 
 static int select_pinned_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
-	Object *obedit= CTX_data_edit_object(C);
-	Image *ima= CTX_data_edit_image(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	EditFace *efa;
-	MTFace *tface;
-	
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
-		if(uvedit_face_visible(scene, ima, efa, tface)) {
-			if(tface->unwrap & TF_PIN1) uvedit_uv_select(scene, efa, tface, 0);
-			if(tface->unwrap & TF_PIN2) uvedit_uv_select(scene, efa, tface, 1);
-			if(tface->unwrap & TF_PIN3) uvedit_uv_select(scene, efa, tface, 2);
-			if(efa->v4) {
-				if(tface->unwrap & TF_PIN4) uvedit_uv_select(scene, efa, tface, 3);
-			}
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit = CTX_data_edit_object(C);
+	Image *ima = CTX_data_edit_image(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	MTexPoly *tface;
+	MLoopUV *luv;
+	
+	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+		tface = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
+		if (!uvedit_face_visible_test(scene, ima, efa, tface))
+			continue;
+
+		BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+			luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+			
+			if (luv->flag & MLOOPUV_PINNED)
+				uvedit_uv_select_enable(em, scene, l, FALSE);
 		}
 	}
 	
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
 	return OPERATOR_FINISHED;
 }
 
 static void UV_OT_select_pinned(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Selected Pinned";
-	ot->description= "Select all pinned UV vertices";
-	ot->idname= "UV_OT_select_pinned";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "Selected Pinned";
+	ot->description = "Select all pinned UV vertices";
+	ot->idname = "UV_OT_select_pinned";
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* api callbacks */
-	ot->exec= select_pinned_exec;
-	ot->poll= ED_operator_uvedit;
+	ot->exec = select_pinned_exec;
+	ot->poll = ED_operator_uvedit;
 }
 
 /********************** hide operator *********************/
 
-static int hide_exec(bContext *C, wmOperator *op)
+/* check if we are selected or unselected based on 'bool_test' arg,
+ * needed for select swap support */
+#define UV_SEL_TEST(luv, bool_test) ((((luv)->flag & MLOOPUV_VERTSEL) == MLOOPUV_VERTSEL) == bool_test)
+
+/* is every UV vert selected or unselected depending on bool_test */
+static int bm_face_is_all_uv_sel(BMesh *bm, BMFace *f, int bool_test)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	ToolSettings *ts= CTX_data_tool_settings(C);
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	EditFace *efa;
-	MTFace *tf;
-	int swap= RNA_boolean_get(op->ptr, "unselected");
-	int facemode= sima ? sima->flag & SI_SELACTFACE : 0;
+	BMLoop *l_iter;
+	BMLoop *l_first;
+
+	l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+	do {
+		MLoopUV *luv = CustomData_bmesh_get(&bm->ldata, l_iter->head.data, CD_MLOOPUV);
+		if (!UV_SEL_TEST(luv, bool_test)) {
+			return FALSE;
+		}
+	} while ((l_iter = l_iter->next) != l_first);
+
+	return TRUE;
+}
 
-	if(ts->uv_flag & UV_SYNC_SELECTION) {
-		EM_hide_mesh(em, swap);
-		WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
+static int hide_exec(bContext *C, wmOperator *op)
+{
+	SpaceImage *sima = CTX_wm_space_image(C);
+	ToolSettings *ts = CTX_data_tool_settings(C);
+	Object *obedit = CTX_data_edit_object(C);
+	Scene *scene = CTX_data_scene(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	MLoopUV *luv;
+	MTexPoly *tf;
+	int swap = RNA_boolean_get(op->ptr, "unselected");
+	Image *ima = sima ? sima->image : NULL;
+	int facemode = (ts->uv_selectmode == UV_SELECT_FACE);
+
+	if (ts->uv_flag & UV_SYNC_SELECTION) {
+		EDBM_mesh_hide(em, swap);
+		WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
-		BKE_mesh_end_editmesh(obedit->data, em);
 		return OPERATOR_FINISHED;
 	}
-	
-	if(swap) {
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->f & SELECT) {
-				tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-				if(facemode) {
-					/* Pretend face mode */
-					if((	(efa->v4==NULL && 
-							(	tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3)) ==			(TF_SEL1|TF_SEL2|TF_SEL3) )			 ||
-							(	tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)) ==	(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)	) == 0) {
-						
-						if(em->selectmode == SCE_SELECT_FACE) {
-							efa->f &= ~SELECT;
-							/* must re-select after */
-							efa->e1->f &= ~SELECT;
-							efa->e2->f &= ~SELECT;
-							efa->e3->f &= ~SELECT;
-							if(efa->e4) efa->e4->f &= ~SELECT;
-						}
-						else
-							EM_select_face(efa, 0);
-					}
-					tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
-				}
-				else if(em->selectmode == SCE_SELECT_FACE) {
-					const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3);
-					if((tf->flag & select_flag)==0) {
-						EM_select_face(efa, 0);
-						tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
-					}
-				}
-				else {
-					/* EM_deselect_flush will deselect the face */
-					if((tf->flag & TF_SEL1)==0)				efa->v1->f &= ~SELECT;
-					if((tf->flag & TF_SEL2)==0)				efa->v2->f &= ~SELECT;
-					if((tf->flag & TF_SEL3)==0)				efa->v3->f &= ~SELECT;
-					if((efa->v4) && (tf->flag & TF_SEL4)==0)	efa->v4->f &= ~SELECT;			
 
-					tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
-				}
+	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+		int hide = 0;
+
+		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) {
+			luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+
+			if (UV_SEL_TEST(luv, !swap)) {
+				hide = 1;
+				break;
 			}
 		}
-	}
-	else {
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->f & SELECT) {
-				tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
-				if(facemode) {
-					if(	(efa->v4==NULL && 
-							(	tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3)) ==			(TF_SEL1|TF_SEL2|TF_SEL3) )			 ||
-							(	tf->flag & (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)) ==	(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4)	) {
-						
-						if(em->selectmode == SCE_SELECT_FACE) {
-							efa->f &= ~SELECT;
-							/* must re-select after */
-							efa->e1->f &= ~SELECT;
-							efa->e2->f &= ~SELECT;
-							efa->e3->f &= ~SELECT;
-							if(efa->e4) efa->e4->f &= ~SELECT;
+
+		if (hide) {
+			/* note, a special case for edges could be used,
+			 * for now edges act like verts and get flushed */
+			if (facemode) {
+				if (em->selectmode == SCE_SELECT_FACE) {
+					/* check that every UV is selected */
+					if (bm_face_is_all_uv_sel(em->bm, efa, TRUE) == !swap) {
+						BM_face_select_set(em->bm, efa, FALSE);
+					}
+					uvedit_face_select_disable(scene, em, efa);
+				}
+				else {
+					if (bm_face_is_all_uv_sel(em->bm, efa, TRUE) == !swap) {
+						BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+							luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+							if (UV_SEL_TEST(luv, !swap)) {
+								BM_vert_select_set(em->bm, l->v, FALSE);
+							}
 						}
-						else
-							EM_select_face(efa, 0);
 					}
+					if (!swap) uvedit_face_select_disable(scene, em, efa);
 
-					tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
-				}
-				else if(em->selectmode == SCE_SELECT_FACE) {
-					const char select_flag= efa->v4 ? (TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4) : (TF_SEL1|TF_SEL2|TF_SEL3);
-					if(tf->flag & select_flag)
-						EM_select_face(efa, 0);
 
-					tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
 				}
-				else {
-					/* EM_deselect_flush will deselect the face */
-					if(tf->flag & TF_SEL1)				efa->v1->f &= ~SELECT;
-					if(tf->flag & TF_SEL2)				efa->v2->f &= ~SELECT;
-					if(tf->flag & TF_SEL3)				efa->v3->f &= ~SELECT;
-					if((efa->v4) && tf->flag & TF_SEL4)	efa->v4->f &= ~SELECT;
-
-					tf->flag &= ~(TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4);
+			}
+			else if (em->selectmode == SCE_SELECT_FACE) {
+				/* check if a UV is de-selected */
+				if (bm_face_is_all_uv_sel(em->bm, efa, FALSE) != !swap) {
+					BM_face_select_set(em->bm, efa, FALSE);
+					uvedit_face_select_disable(scene, em, efa);
+				}
+			}
+			else {
+				BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+					luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+					if (UV_SEL_TEST(luv, !swap)) {
+						BM_vert_select_set(em->bm, l->v, FALSE);
+						if (!swap) luv->flag &= ~MLOOPUV_VERTSEL;
+					}
 				}
 			}
 		}
 	}
+
+	/* flush vertex selection changes */
+	if (em->selectmode != SCE_SELECT_FACE)
+		EDBM_selectmode_flush_ex(em, SCE_SELECT_VERTEX | SCE_SELECT_EDGE);
 	
-	/*deselects too many but ok for now*/
-	if(em->selectmode & (SCE_SELECT_EDGE|SCE_SELECT_VERTEX))
-		EM_deselect_flush(em);
-	
-	if(em->selectmode==SCE_SELECT_FACE) {
-		/* de-selected all edges from faces that were de-selected.
-		 * now make sure all faces that are selected also have selected edges */
-		for(efa= em->faces.first; efa; efa= efa->next)
-			if(efa->f & SELECT)
-				EM_select_face(efa, 1);
-	}
-	
-	EM_validate_selections(em);
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
+	BM_select_history_validate(em->bm);
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
 	return OPERATOR_FINISHED;
 }
 
+#undef UV_SEL_TEST
+
 static void UV_OT_hide(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Hide Selected";
-	ot->description= "Hide (un)selected UV vertices";
-	ot->idname= "UV_OT_hide";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "Hide Selected";
+	ot->description = "Hide (un)selected UV vertices";
+	ot->idname = "UV_OT_hide";
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* api callbacks */
-	ot->exec= hide_exec;
-	ot->poll= ED_operator_uvedit;
+	ot->exec = hide_exec;
+	ot->poll = ED_operator_uvedit;
 
 	/* props */
 	RNA_def_boolean(ot->srna, "unselected", 0, "Unselected", "Hide unselected rather than selected");
@@ -2904,131 +3132,129 @@ static void UV_OT_hide(wmOperatorType *ot)
 
 static int reveal_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	ToolSettings *ts= CTX_data_tool_settings(C);
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	EditFace *efa;
-	MTFace *tf;
-	int facemode= sima ? sima->flag & SI_SELACTFACE : 0;
-	int stickymode= sima ? (sima->sticky != SI_STICKY_DISABLE) : 1;
-	
+	SpaceImage *sima = CTX_wm_space_image(C);
+	ToolSettings *ts = CTX_data_tool_settings(C);
+	Object *obedit = CTX_data_edit_object(C);
+	/*Scene *scene = CTX_data_scene(C);*/ /*UNUSED*/
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	MLoopUV *luv;
+	int facemode = (ts->uv_selectmode == UV_SELECT_FACE);
+	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. */
+
 	/* call the mesh function if we are in mesh sync sel */
-	if(ts->uv_flag & UV_SYNC_SELECTION) {
-		EM_reveal_mesh(em);
-		WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
+	if (ts->uv_flag & UV_SYNC_SELECTION) {
+		EDBM_mesh_reveal(em);
+		WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
-		BKE_mesh_end_editmesh(obedit->data, em);
 		return OPERATOR_FINISHED;
 	}
-	
-	if(facemode) {
-		if(em->selectmode == SCE_SELECT_FACE) {
-			for(efa= em->faces.first; efa; efa= efa->next) {
-				if(!(efa->h) && !(efa->f & SELECT)) {
-					tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-					EM_select_face(efa, 1);
-					tf->flag |= TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4;
+	if (facemode) {
+		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);
+				if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && !BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
+					BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+						luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+						luv->flag |= MLOOPUV_VERTSEL;
+					}
+					/* BM_face_select_set(em->bm, efa, TRUE); */
+					BM_elem_flag_enable(efa, BM_ELEM_TAG);
 				}
 			}
 		}
 		else {
 			/* enable adjacent faces to have disconnected UV selections if sticky is disabled */
-			if(!stickymode) {
-				for(efa= em->faces.first; efa; efa= efa->next) {
-					if(!(efa->h) && !(efa->f & SELECT)) {
-						/* All verts must be unselected for the face to be selected in the UV view */
-						if((efa->v1->f&SELECT)==0 && (efa->v2->f&SELECT)==0 && (efa->v3->f&SELECT)==0 && (efa->v4==NULL || (efa->v4->f&SELECT)==0)) {
-							tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
-							tf->flag |= TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4;
-							/* Cant use EM_select_face here because it unselects the verts
-							 * and we cant tell if the face was totally unselected or not */
-							/*EM_select_face(efa, 1);
-							 * 
-							 * See Loop with EM_select_face() below... */
-							efa->f |= SELECT;
+			if (!stickymode) {
+				BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+					BM_elem_flag_disable(efa, BM_ELEM_TAG);
+					if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && !BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
+						int totsel = 0;
+						BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+							totsel += BM_elem_flag_test(l->v, BM_ELEM_SELECT);
+						}
+						
+						if (!totsel) {
+							BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+								luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+								luv->flag |= MLOOPUV_VERTSEL;
+							}
+							/* BM_face_select_set(em->bm, efa, TRUE); */
+							BM_elem_flag_enable(efa, BM_ELEM_TAG);
 						}
 					}
 				}
 			}
 			else {
-				for(efa= em->faces.first; efa; efa= efa->next) {
-					if(!(efa->h) && !(efa->f & SELECT)) {
-						tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
-						if((efa->v1->f & SELECT)==0)				{tf->flag |= TF_SEL1;}
-						if((efa->v2->f & SELECT)==0)				{tf->flag |= TF_SEL2;}
-						if((efa->v3->f & SELECT)==0)				{tf->flag |= TF_SEL3;}
-						if((efa->v4 && (efa->v4->f & SELECT)==0))	{tf->flag |= TF_SEL4;}
-
-						efa->f |= SELECT;
+				BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+					BM_elem_flag_disable(efa, BM_ELEM_TAG);
+					if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && !BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
+						BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+							if (BM_elem_flag_test(l->v, BM_ELEM_SELECT) == 0) {
+								luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+								luv->flag |= MLOOPUV_VERTSEL;
+							}
+						}
+						/* BM_face_select_set(em->bm, efa, TRUE); */
+						BM_elem_flag_enable(efa, BM_ELEM_TAG);
 					}
 				}
 			}
-			
-			/* Select all edges and verts now */
-			for(efa= em->faces.first; efa; efa= efa->next)
-				/* we only selected the face flags, and didnt changes edges or verts, fix this now */
-				if(!(efa->h) && (efa->f & SELECT))
-					EM_select_face(efa, 1);
-
-			EM_select_flush(em);
 		}
 	}
-	else if(em->selectmode == SCE_SELECT_FACE) {
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(!(efa->h) && !(efa->f & SELECT)) {
-				tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-				efa->f |= SELECT;
-				tf->flag |= TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4;
+	else 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);
+			if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && !BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
+				BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+					luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+					luv->flag |= MLOOPUV_VERTSEL;
+				}
+				/* BM_face_select_set(em->bm, efa, TRUE); */
+				BM_elem_flag_enable(efa, BM_ELEM_TAG);
 			}
 		}
-		
-		/* Select all edges and verts now */
-		for(efa= em->faces.first; efa; efa= efa->next)
-			/* we only selected the face flags, and didnt changes edges or verts, fix this now */
-			if(!(efa->h) && (efa->f & SELECT))
-				EM_select_face(efa, 1);
 	}
 	else {
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(!(efa->h) && !(efa->f & SELECT)) {
-				tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
-				if((efa->v1->f & SELECT)==0)				{tf->flag |= TF_SEL1;}
-				if((efa->v2->f & SELECT)==0)				{tf->flag |= TF_SEL2;}
-				if((efa->v3->f & SELECT)==0)				{tf->flag |= TF_SEL3;}
-				if((efa->v4 && (efa->v4->f & SELECT)==0))	{tf->flag |= TF_SEL4;}
-
-				efa->f |= SELECT;
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			BM_elem_flag_disable(efa, BM_ELEM_TAG);
+			if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN) && !BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
+				BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+					if (BM_elem_flag_test(l->v, BM_ELEM_SELECT) == 0) {
+						luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+						luv->flag |= MLOOPUV_VERTSEL;
+					}
+				}
+				/* BM_face_select_set(em->bm, efa, TRUE); */
+				BM_elem_flag_enable(efa, BM_ELEM_TAG);
 			}
 		}
-		
-		/* Select all edges and verts now */
-		for(efa= em->faces.first; efa; efa= efa->next)
-			/* we only selected the face flags, and didnt changes edges or verts, fix this now */
-			if(!(efa->h) && (efa->f & SELECT))
-				EM_select_face(efa, 1);
 	}
+	
+	/* re-select tagged faces */
+	BM_mesh_elem_hflag_enable_test(em->bm, BM_FACE, BM_ELEM_SELECT, TRUE, BM_ELEM_TAG);
 
-	WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
+	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
 	return OPERATOR_FINISHED;
 }
 
 static void UV_OT_reveal(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Reveal Hidden";
-	ot->description= "Reveal all hidden UV vertices";
-	ot->idname= "UV_OT_reveal";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "Reveal Hidden";
+	ot->description = "Reveal all hidden UV vertices";
+	ot->idname = "UV_OT_reveal";
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* api callbacks */
-	ot->exec= reveal_exec;
-	ot->poll= ED_operator_uvedit;
+	ot->exec = reveal_exec;
+	ot->poll = ED_operator_uvedit;
 }
 
 /******************** set 3d cursor operator ********************/
@@ -3038,21 +3264,21 @@ static int set_2d_cursor_exec(bContext *C, wmOperator *op)
 	SpaceImage *sima = CTX_wm_space_image(C);
 	float location[2];
 
-	if(!sima)
+	if (!sima)
 		return OPERATOR_CANCELLED;
 
 	RNA_float_get_array(op->ptr, "location", location);
-	sima->cursor[0]= location[0];
-	sima->cursor[1]= location[1];
+	sima->cursor[0] = location[0];
+	sima->cursor[1] = location[1];
 	
-	WM_event_add_notifier(C, NC_SPACE|ND_SPACE_IMAGE, NULL);
+	WM_event_add_notifier(C, NC_SPACE | ND_SPACE_IMAGE, NULL);
 	
 	return OPERATOR_FINISHED;
 }
 
 static int set_2d_cursor_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	ARegion *ar= CTX_wm_region(C);
+	ARegion *ar = CTX_wm_region(C);
 	float location[2];
 
 	UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &location[0], &location[1]);
@@ -3064,17 +3290,17 @@ static int set_2d_cursor_invoke(bContext *C, wmOperator *op, wmEvent *event)
 static void UV_OT_cursor_set(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set 2D Cursor";
-	ot->description= "Set 2D cursor location";
-	ot->idname= "UV_OT_cursor_set";
+	ot->name = "Set 2D Cursor";
+	ot->description = "Set 2D cursor location";
+	ot->idname = "UV_OT_cursor_set";
 	
 	/* api callbacks */
-	ot->exec= set_2d_cursor_exec;
-	ot->invoke= set_2d_cursor_invoke;
-	ot->poll= ED_operator_image_active;	/* requires space image */;
+	ot->exec = set_2d_cursor_exec;
+	ot->invoke = set_2d_cursor_invoke;
+	ot->poll = ED_operator_image_active; /* requires space image */;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in normalised (0.0-1.0) coordinates", -10.0f, 10.0f);
@@ -3084,15 +3310,15 @@ static void UV_OT_cursor_set(wmOperatorType *ot)
 
 static int set_tile_exec(bContext *C, wmOperator *op)
 {
-	Image *ima= CTX_data_edit_image(C);
+	Image *ima = CTX_data_edit_image(C);
 	int tile[2];
-	Object *obedit= CTX_data_edit_object(C);
+	Object *obedit = CTX_data_edit_object(C);
 
 	RNA_int_get_array(op->ptr, "tile", tile);
 
-	if(uvedit_set_tile(obedit, ima, tile[0] + ima->xrep*tile[1])) {
-		WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-		WM_event_add_notifier(C, NC_SPACE|ND_SPACE_IMAGE, NULL);
+	if (uvedit_set_tile(obedit, ima, tile[0] + ima->xrep * tile[1])) {
+		WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
+		WM_event_add_notifier(C, NC_SPACE | ND_SPACE_IMAGE, NULL);
 
 		return OPERATOR_FINISHED;
 	}
@@ -3102,25 +3328,25 @@ static int set_tile_exec(bContext *C, wmOperator *op)
 
 static int set_tile_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	SpaceImage *sima= CTX_wm_space_image(C);
-	Image *ima= CTX_data_edit_image(C);
-	ARegion *ar= CTX_wm_region(C);
+	SpaceImage *sima = CTX_wm_space_image(C);
+	Image *ima = CTX_data_edit_image(C);
+	ARegion *ar = CTX_wm_region(C);
 	float fx, fy;
 	int tile[2];
 
-	if(!ima || !(ima->tpageflag & IMA_TILES))
+	if (!ima || !(ima->tpageflag & IMA_TILES))
 		return OPERATOR_CANCELLED;
 
 	UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &fx, &fy);
 
-	if(fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
-		fx= fx*ima->xrep;
-		fy= fy*ima->yrep;
+	if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {
+		fx = fx * ima->xrep;
+		fy = fy * ima->yrep;
 		
-		tile[0]= fx;
-		tile[1]= fy;
+		tile[0] = fx;
+		tile[1] = fy;
 		
-		sima->curtile= tile[1]*ima->xrep + tile[0];
+		sima->curtile = tile[1] * ima->xrep + tile[0];
 		RNA_int_set_array(op->ptr, "tile", tile);
 	}
 
@@ -3130,17 +3356,17 @@ static int set_tile_invoke(bContext *C, wmOperator *op, wmEvent *event)
 static void UV_OT_tile_set(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Set Tile";
-	ot->description= "Set UV image tile coordinates";
-	ot->idname= "UV_OT_tile_set";
+	ot->name = "Set Tile";
+	ot->description = "Set UV image tile coordinates";
+	ot->idname = "UV_OT_tile_set";
 	
 	/* api callbacks */
-	ot->exec= set_tile_exec;
-	ot->invoke= set_tile_invoke;
-	ot->poll= ED_operator_image_active;	/* requires space image */;
+	ot->exec = set_tile_exec;
+	ot->invoke = set_tile_invoke;
+	ot->poll = ED_operator_image_active; /* requires space image */;
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* properties */
 	RNA_def_int_vector(ot->srna, "tile", 2, NULL, 0, INT_MAX, "Tile", "Tile coordinate", 0, 10);
@@ -3151,25 +3377,28 @@ static int seams_from_islands_exec(bContext *C, wmOperator *op)
 {
 	UvVertMap *vmap;
 	Object *ob = CTX_data_edit_object(C);
-	Mesh *me= (Mesh*)ob->data;
-	EditMesh *em;
-	EditEdge *editedge;
+	Mesh *me = (Mesh *)ob->data;
+	BMEditMesh *em;
+	BMEdge *editedge;
 	float limit[2] = {STD_UV_CONNECT_LIMIT, STD_UV_CONNECT_LIMIT};
 	char mark_seams = RNA_boolean_get(op->ptr, "mark_seams");
 	char mark_sharp = RNA_boolean_get(op->ptr, "mark_sharp");
 
-	em = BKE_mesh_get_editmesh(me);
+	BMesh *bm;
+	BMIter iter;
 
-	if(!EM_texFaceCheck(em)) {
-		BKE_mesh_end_editmesh(ob->data, em);
+	em = me->edit_btmesh;
+	bm = em->bm;
+
+	if (!EDBM_mtexpoly_check(em)) {
 		return OPERATOR_CANCELLED;
 	}
 
 	/* This code sets editvert->tmp.l to the index. This will be useful later on. */
-	EM_init_index_arrays(em, 0, 0, 1);
-	vmap = EM_make_uv_vert_map(em, 0, 0, limit);
+	EDBM_index_arrays_init(em, 0, 0, 1);
+	vmap = EDBM_uv_vert_map_create(em, 0, 0, limit);
 
-	for(editedge = em->edges.first; editedge; editedge = editedge->next) {
+	BM_ITER_MESH (editedge, &iter, bm, BM_EDGES_OF_MESH) {
 		/* flags to determine if we uv is separated from first editface match */
 		char separated1 = 0, separated2;
 		/* set to denote edge must be flagged as seam */
@@ -3179,42 +3408,42 @@ static int seams_from_islands_exec(bContext *C, wmOperator *op)
 		/* For use with v1coincident. v1coincident will change only if we've had commonFaces */
 		int commonFaces = 0;
 
-		EditFace *efa1, *efa2;
+		BMFace *efa1, *efa2;
 
 		UvMapVert *mv1, *mvinit1, *mv2, *mvinit2, *mviter;
 		/* mv2cache stores the first of the list of coincident uv's for later comparison
 		 * mv2sep holds the last separator and is copied to mv2cache when a hit is first found */
 		UvMapVert *mv2cache = NULL, *mv2sep = NULL;
 
-		mvinit1 = vmap->vert[editedge->v1->tmp.l];
-		if(mark_seams)
-			editedge->seam = 0;
+		mvinit1 = vmap->vert[BM_elem_index_get(editedge->v1)];
+		if (mark_seams)
+			BM_elem_flag_disable(editedge, BM_ELEM_SEAM);
 
-		for(mv1 = mvinit1; mv1 && !faces_separated; mv1 = mv1->next) {
-			if(mv1->separate && commonFaces)
+		for (mv1 = mvinit1; mv1 && !faces_separated; mv1 = mv1->next) {
+			if (mv1->separate && commonFaces)
 				v1coincident = 0;
 
 			separated2 = 0;
-			efa1 = EM_get_face_for_index(mv1->f);
-			mvinit2 = vmap->vert[editedge->v2->tmp.l];
+			efa1 = EDBM_face_at_index(em, mv1->f);
+			mvinit2 = vmap->vert[BM_elem_index_get(editedge->v2)];
 
-			for(mv2 = mvinit2; mv2; mv2 = mv2->next) {
-				if(mv2->separate)
+			for (mv2 = mvinit2; mv2; mv2 = mv2->next) {
+				if (mv2->separate)
 					mv2sep = mv2;
 
-				efa2 = EM_get_face_for_index(mv2->f);
-				if(efa1 == efa2) {
+				efa2 = EDBM_face_at_index(em, mv2->f);
+				if (efa1 == efa2) {
 					/* if v1 is not coincident no point in comparing */
-					if(v1coincident) {
+					if (v1coincident) {
 						/* have we found previously anything? */
-						if(mv2cache) {
+						if (mv2cache) {
 							/* flag seam unless proved to be coincident with previous hit */
 							separated2 = 1;
-							for(mviter = mv2cache; mviter; mviter = mviter->next) {
-								if(mviter->separate && mviter != mv2cache)
+							for (mviter = mv2cache; mviter; mviter = mviter->next) {
+								if (mviter->separate && mviter != mv2cache)
 									break;
 								/* coincident with previous hit, do not flag seam */
-								if(mviter == mv2)
+								if (mviter == mv2)
 									separated2 = 0;
 							}
 						}
@@ -3227,7 +3456,7 @@ static int seams_from_islands_exec(bContext *C, wmOperator *op)
 					else
 						separated1 = 1;
 
-					if(separated1 || separated2) {
+					if (separated1 || separated2) {
 						faces_separated = 1;
 						break;
 					}
@@ -3235,22 +3464,21 @@ static int seams_from_islands_exec(bContext *C, wmOperator *op)
 			}
 		}
 
-		if(faces_separated) {
-			if(mark_seams)
-				editedge->seam = 1;
-			if(mark_sharp)
-				editedge->sharp = 1;
+		if (faces_separated) {
+			if (mark_seams)
+				BM_elem_flag_enable(editedge, BM_ELEM_SEAM);
+			if (mark_sharp)
+				BM_elem_flag_disable(editedge, BM_ELEM_SMOOTH);
 		}
 	}
 
 	me->drawflag |= ME_DRAWSEAMS;
 
-	EM_free_uv_vert_map(vmap);
-	EM_free_index_arrays();
-	BKE_mesh_end_editmesh(me, em);
+	EDBM_uv_vert_map_free(vmap);
+	EDBM_index_arrays_free(em);
 
 	DAG_id_tag_update(&me->id, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
 
 	return OPERATOR_FINISHED;
 }
@@ -3259,16 +3487,16 @@ static int seams_from_islands_exec(bContext *C, wmOperator *op)
 static void UV_OT_seams_from_islands(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Seams From Islands";
-	ot->description= "Set mesh seams according to island setup in the UV editor";
-	ot->idname= "UV_OT_seams_from_islands";
+	ot->name = "Seams From Islands";
+	ot->description = "Set mesh seams according to island setup in the UV editor";
+	ot->idname = "UV_OT_seams_from_islands";
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* api callbacks */
-	ot->exec= seams_from_islands_exec;
-	ot->poll= ED_operator_uvedit;
+	ot->exec = seams_from_islands_exec;
+	ot->poll = ED_operator_uvedit;
 
 	RNA_def_boolean(ot->srna, "mark_seams", 1, "Mark Seams", "Mark boundary edges as seams");
 	RNA_def_boolean(ot->srna, "mark_sharp", 0, "Mark Sharp", "Mark boundary edges as sharp");
@@ -3278,28 +3506,29 @@ static int mark_seam_exec(bContext *C, wmOperator *UNUSED(op))
 {
 	Object *ob = CTX_data_edit_object(C);
 	Scene *scene = CTX_data_scene(C);
-	Mesh *me= (Mesh*)ob->data;
-	EditMesh *em= BKE_mesh_get_editmesh(me);
-	EditFace *efa;
-
-	for(efa = em->faces.first; efa; efa = efa->next) {
-		MTFace *mt = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-		int i, nverts = efa->v4? 4 : 3;
-
-		for(i = 0; i < nverts; i++)
-			if(uvedit_edge_selected(scene, efa, mt, i))
-				(*(&efa->e1 + i))->seam = 1;
+	Mesh *me = (Mesh *)ob->data;
+	BMEditMesh *em = me->edit_btmesh;
+	BMesh *bm = em->bm;
+	BMFace *efa;
+	BMLoop *loop;
+
+	BMIter iter, liter;
+
+	BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+		BM_ITER_ELEM (loop, &liter, efa, BM_LOOPS_OF_FACE) {
+			if (uvedit_edge_select_test(em, scene, loop)) {
+				BM_elem_flag_enable(loop->e, BM_ELEM_SEAM);
+			}
+		}
 	}
 
 	me->drawflag |= ME_DRAWSEAMS;
 
-	if(scene->toolsettings->edge_mode_live_unwrap)
+	if (scene->toolsettings->edge_mode_live_unwrap)
 		ED_unwrap_lscm(scene, ob, FALSE);
 
-	BKE_mesh_end_editmesh(me, em);
-
 	DAG_id_tag_update(&me->id, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, me);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, me);
 
 	return OPERATOR_FINISHED;
 }
@@ -3307,16 +3536,16 @@ static int mark_seam_exec(bContext *C, wmOperator *UNUSED(op))
 static void UV_OT_mark_seam(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Mark Seams";
-	ot->description= "Mark selected UV edges as seams";
-	ot->idname= "UV_OT_mark_seam";
+	ot->name = "Mark Seams";
+	ot->description = "Mark selected UV edges as seams";
+	ot->idname = "UV_OT_mark_seam";
 
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
 	/* api callbacks */
-	ot->exec= mark_seam_exec;
-	ot->poll= ED_operator_uvedit;
+	ot->exec = mark_seam_exec;
+	ot->poll = ED_operator_uvedit;
 }
 
 
@@ -3338,7 +3567,9 @@ void ED_operatortypes_uvedit(void)
 	WM_operatortype_append(UV_OT_snap_selected);
 
 	WM_operatortype_append(UV_OT_align);
+
 	WM_operatortype_append(UV_OT_stitch);
+
 	WM_operatortype_append(UV_OT_seams_from_islands);
 	WM_operatortype_append(UV_OT_mark_seam);
 	WM_operatortype_append(UV_OT_weld);
@@ -3366,8 +3597,8 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf)
 	wmKeyMap *keymap;
 	wmKeyMapItem *kmi;
 	
-	keymap= WM_keymap_find(keyconf, "UV Editor", 0, 0);
-	keymap->poll= ED_operator_uvedit_can_uv_sculpt;
+	keymap = WM_keymap_find(keyconf, "UV Editor", 0, 0);
+	keymap->poll = ED_operator_uvedit_can_uv_sculpt;
 
 	/* Uv sculpt toggle */
 	kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", QKEY, KM_PRESS, 0, 0);
@@ -3380,7 +3611,7 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf)
 	RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select", SELECTMOUSE, KM_PRESS, 0, 0)->ptr, "extend", FALSE);
 	RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", TRUE);
 	RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select_loop", SELECTMOUSE, KM_PRESS, KM_ALT, 0)->ptr, "extend", FALSE);
-	RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select_loop", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0)->ptr, "extend", TRUE);
+	RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select_loop", SELECTMOUSE, KM_PRESS, KM_SHIFT | KM_ALT, 0)->ptr, "extend", TRUE);
 
 	/* border/circle selection */
 	kmi = WM_keymap_add_item(keymap, "UV_OT_select_border", BKEY, KM_PRESS, 0, 0);
@@ -3393,7 +3624,7 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf)
 	/* selection manipulation */
 	RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0)->ptr, "extend", FALSE);
 	RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select_linked_pick", LKEY, KM_PRESS, 0, 0)->ptr, "extend", FALSE);
-	RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select_linked", LKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "extend", TRUE);
+	RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select_linked", LKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0)->ptr, "extend", TRUE);
 	RNA_boolean_set(WM_keymap_add_item(keymap, "UV_OT_select_linked_pick", LKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "extend", TRUE);
 
 	WM_keymap_add_item(keymap, "UV_OT_unlink_selected", LKEY, KM_PRESS, KM_ALT, 0);
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index d651a17..c1abfe6 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -32,24 +32,23 @@
 /* Utils */
 
 #if 0
-	#define param_assert(condition);
-	#define param_warning(message);
-	#define param_test_equals_ptr(condition);
-	#define param_test_equals_int(condition);
+	#define param_assert(condition)
+	#define param_warning(message)
+	#define param_test_equals_ptr(condition)
+	#define param_test_equals_int(condition)
 #else
 	#define param_assert(condition) \
 		if (!(condition)) \
-			{ /*printf("Assertion %s:%d\n", __FILE__, __LINE__); abort();*/ }
+			{ /*printf("Assertion %s:%d\n", __FILE__, __LINE__); abort();*/ } (void)0
 	#define param_warning(message) \
-		{ /*printf("Warning %s:%d: %s\n", __FILE__, __LINE__, message);*/ }
+		{ /*printf("Warning %s:%d: %s\n", __FILE__, __LINE__, message);*/ } (void)0
 	#define param_test_equals_ptr(str, a, b) \
 		if (a != b) \
-			{ /*printf("Equals %s => %p != %p\n", str, a, b);*/ };
+			{ /*printf("Equals %s => %p != %p\n", str, a, b);*/ } (void)0
 	#define param_test_equals_int(str, a, b) \
 		if (a != b) \
-			{ /*printf("Equals %s => %d != %d\n", str, a, b);*/ };
+			{ /*printf("Equals %s => %d != %d\n", str, a, b);*/ } (void)0
 #endif
-
 typedef enum PBool {
 	P_TRUE = 1,
 	P_FALSE = 0
@@ -84,10 +83,10 @@ typedef struct PVert {
 	struct PVert *nextlink;
 
 	union PVertUnion {
-		PHashKey key;			/* construct */
-		int id;					/* abf/lscm matrix index */
-		float distortion;		/* area smoothing */
-		HeapNode *heaplink;		/* edge collapsing */
+		PHashKey key;           /* construct */
+		int id;                 /* abf/lscm matrix index */
+		float distortion;       /* area smoothing */
+		HeapNode *heaplink;     /* edge collapsing */
 	} u;
 
 	struct PEdge *edge;
@@ -101,10 +100,10 @@ typedef struct PEdge {
 	struct PEdge *nextlink;
 
 	union PEdgeUnion {
-		PHashKey key;					/* construct */
-		int id;							/* abf matrix index */
-		HeapNode *heaplink;				/* fill holes */
-		struct PEdge *nextcollapse;		/* simplification */
+		PHashKey key;                   /* construct */
+		int id;                         /* abf matrix index */
+		HeapNode *heaplink;             /* fill holes */
+		struct PEdge *nextcollapse;     /* simplification */
 	} u;
 
 	struct PVert *vert;
@@ -120,10 +119,10 @@ typedef struct PFace {
 	struct PFace *nextlink;
 
 	union PFaceUnion {
-		PHashKey key;			/* construct */
-		int chart;				/* construct splitting*/
-		float area3d;			/* stretch */
-		int id;					/* abf matrix index */
+		PHashKey key;           /* construct */
+		int chart;              /* construct splitting*/
+		float area3d;           /* stretch */
+		int id;                 /* abf matrix index */
 	} u;
 
 	struct PEdge *edge;
@@ -219,10 +218,10 @@ typedef struct PHandle {
 
 
 /* PHash
-   - special purpose hash that keeps all its elements in a single linked list.
-   - after construction, this hash is thrown away, and the list remains.
-   - removing elements is not possible efficiently.
-*/
+ * - special purpose hash that keeps all its elements in a single linked list.
+ * - after construction, this hash is thrown away, and the list remains.
+ * - removing elements is not possible efficiently.
+ */
 
 static int PHashSizes[] = {
 	1, 3, 5, 11, 17, 37, 67, 131, 257, 521, 1031, 2053, 4099, 8209, 
@@ -230,12 +229,12 @@ static int PHashSizes[] = {
 	4194319, 8388617, 16777259, 33554467, 67108879, 134217757, 268435459
 };
 
-#define PHASH_hash(ph, item) (((uintptr_t) (item))%((unsigned int) (ph)->cursize))
-#define PHASH_edge(v1, v2)	 ((v1)^(v2))
+#define PHASH_hash(ph, item) (((uintptr_t) (item)) % ((unsigned int) (ph)->cursize))
+#define PHASH_edge(v1, v2)   ((v1) ^ (v2))
 
 static PHash *phash_new(PHashLink **list, int sizehint)
 {
-	PHash *ph = (PHash*)MEM_callocN(sizeof(PHash), "PHash");
+	PHash *ph = (PHash *)MEM_callocN(sizeof(PHash), "PHash");
 	ph->size = 0;
 	ph->cursize_id = 0;
 	ph->list = list;
@@ -244,7 +243,7 @@ static PHash *phash_new(PHashLink **list, int sizehint)
 		ph->cursize_id++;
 
 	ph->cursize = PHashSizes[ph->cursize_id];
-	ph->buckets = (PHashLink**)MEM_callocN(ph->cursize*sizeof(*ph->buckets), "PHashBuckets");
+	ph->buckets = (PHashLink **)MEM_callocN(ph->cursize * sizeof(*ph->buckets), "PHashBuckets");
 
 	return ph;
 }
@@ -280,12 +279,12 @@ static void phash_insert(PHash *ph, PHashLink *link)
 		
 	ph->size++;
 
-	if (ph->size > (size*3)) {
+	if (ph->size > (size * 3)) {
 		PHashLink *next = NULL, *first = *(ph->list);
 
 		ph->cursize = PHashSizes[++ph->cursize_id];
 		MEM_freeN(ph->buckets);
-		ph->buckets = (PHashLink**)MEM_callocN(ph->cursize*sizeof(*ph->buckets), "PHashBuckets");
+		ph->buckets = (PHashLink **)MEM_callocN(ph->cursize * sizeof(*ph->buckets), "PHashBuckets");
 		ph->size = 0;
 		*(ph->list) = NULL;
 
@@ -340,7 +339,7 @@ static float p_vec_angle_cos(float *v1, float *v2, float *v3)
 	normalize_v3(d1);
 	normalize_v3(d2);
 
-	return d1[0]*d2[0] + d1[1]*d2[1] + d1[2]*d2[2];
+	return d1[0] * d2[0] + d1[1] * d2[1] + d1[2] * d2[2];
 }
 
 static float p_vec_angle(float *v1, float *v2, float *v3)
@@ -391,8 +390,8 @@ static float p_face_area(PFace *f)
 
 static float p_area_signed(float *v1, float *v2, float *v3)
 {
-	return 0.5f*(((v2[0] - v1[0])*(v3[1] - v1[1])) - 
-				((v3[0] - v1[0])*(v2[1] - v1[1])));
+	return 0.5f * (((v2[0] - v1[0]) * (v3[1] - v1[1])) -
+	               ((v3[0] - v1[0]) * (v2[1] - v1[1])));
 }
 
 static float p_face_uv_area_signed(PFace *f)
@@ -400,8 +399,8 @@ static float p_face_uv_area_signed(PFace *f)
 	PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
 	PVert *v1 = e1->vert, *v2 = e2->vert, *v3 = e3->vert;
 
-	return 0.5f*(((v2->uv[0] - v1->uv[0])*(v3->uv[1] - v1->uv[1])) - 
-				((v3->uv[0] - v1->uv[0])*(v2->uv[1] - v1->uv[1])));
+	return 0.5f * (((v2->uv[0] - v1->uv[0]) * (v3->uv[1] - v1->uv[1])) -
+	               ((v3->uv[0] - v1->uv[0]) * (v2->uv[1] - v1->uv[1])));
 }
 
 static float p_edge_length(PEdge *e)
@@ -413,7 +412,7 @@ static float p_edge_length(PEdge *e)
 	d[1] = v2->co[1] - v1->co[1];
 	d[2] = v2->co[2] - v1->co[2];
 
-	return sqrt(d[0]*d[0] + d[1]*d[1] + d[2]*d[2]);
+	return sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
 }
 
 static float p_edge_uv_length(PEdge *e)
@@ -424,7 +423,7 @@ static float p_edge_uv_length(PEdge *e)
 	d[0] = v2->uv[0] - v1->uv[0];
 	d[1] = v2->uv[1] - v1->uv[1];
 
-	return sqrt(d[0]*d[0] + d[1]*d[1]);
+	return sqrt(d[0] * d[0] + d[1] * d[1]);
 }
 
 static void p_chart_uv_bbox(PChart *chart, float *minv, float *maxv)
@@ -433,7 +432,7 @@ static void p_chart_uv_bbox(PChart *chart, float *minv, float *maxv)
 
 	INIT_MINMAX2(minv, maxv);
 
-	for (v=chart->verts; v; v=v->nextlink) {
+	for (v = chart->verts; v; v = v->nextlink) {
 		DO_MINMAX2(v->uv, minv, maxv);
 	}
 }
@@ -442,7 +441,7 @@ static void p_chart_uv_scale(PChart *chart, float scale)
 {
 	PVert *v;
 
-	for (v=chart->verts; v; v=v->nextlink) {
+	for (v = chart->verts; v; v = v->nextlink) {
 		v->uv[0] *= scale;
 		v->uv[1] *= scale;
 	}
@@ -452,7 +451,7 @@ static void p_chart_uv_scale_xy(PChart *chart, float x, float y)
 {
 	PVert *v;
 
-	for (v=chart->verts; v; v=v->nextlink) {
+	for (v = chart->verts; v; v = v->nextlink) {
 		v->uv[0] *= x;
 		v->uv[1] *= y;
 	}
@@ -462,7 +461,7 @@ static void p_chart_uv_translate(PChart *chart, float trans[2])
 {
 	PVert *v;
 
-	for (v=chart->verts; v; v=v->nextlink) {
+	for (v = chart->verts; v; v = v->nextlink) {
 		v->uv[0] += trans[0];
 		v->uv[1] += trans[1];
 	}
@@ -472,14 +471,14 @@ static PBool p_intersect_line_2d_dir(float *v1, float *dir1, float *v2, float *d
 {
 	float lmbda, div;
 
-	div= dir2[0]*dir1[1] - dir2[1]*dir1[0];
+	div = dir2[0] * dir1[1] - dir2[1] * dir1[0];
 
 	if (div == 0.0f)
 		return P_FALSE;
 
-	lmbda= ((v1[1]-v2[1])*dir1[0]-(v1[0]-v2[0])*dir1[1])/div;
-	isect[0] = v1[0] + lmbda*dir2[0];
-	isect[1] = v1[1] + lmbda*dir2[1];
+	lmbda = ((v1[1] - v2[1]) * dir1[0] - (v1[0] - v2[0]) * dir1[1]) / div;
+	isect[0] = v1[0] + lmbda * dir2[0];
+	isect[1] = v1[1] + lmbda * dir2[1];
 
 	return P_TRUE;
 }
@@ -497,9 +496,9 @@ static PBool p_intersect_line_2d(float *v1, float *v2, float *v3, float *v4, flo
 
 	if (!p_intersect_line_2d_dir(v1, dir1, v2, dir2, isect)) {
 		/* parallel - should never happen in theory for polygon kernel, but
-		   let's give a point nearby in case things go wrong */
-		isect[0] = (v1[0] + v2[0])*0.5f;
-		isect[1] = (v1[1] + v2[1])*0.5f;
+		 * let's give a point nearby in case things go wrong */
+		isect[0] = (v1[0] + v2[0]) * 0.5f;
+		isect[1] = (v1[1] + v2[1]) * 0.5f;
 		return P_FALSE;
 	}
 
@@ -516,7 +515,7 @@ static PEdge *p_wheel_edge_next(PEdge *e)
 
 static PEdge *p_wheel_edge_prev(PEdge *e)
 {   
-	return (e->pair)? e->pair->next: NULL;
+	return (e->pair) ? e->pair->next : NULL;
 }
 
 static PEdge *p_boundary_edge_next(PEdge *e)
@@ -570,10 +569,10 @@ static void p_chart_topological_sanity_check(PChart *chart)
 	PVert *v;
 	PEdge *e;
 
-	for (v=chart->verts; v; v=v->nextlink)
+	for (v = chart->verts; v; v = v->nextlink)
 		param_test_equals_ptr("v->edge->vert", v, v->edge->vert);
 	
-	for (e=chart->edges; e; e=e->nextlink) {
+	for (e = chart->edges; e; e = e->nextlink) {
 		if (e->pair) {
 			param_test_equals_ptr("e->pair->pair", e, e->pair->pair);
 			param_test_equals_ptr("pair->vert", e->vert, e->pair->next->vert);
@@ -600,13 +599,13 @@ static void p_vert_load_pin_select_uvs(PHandle *handle, PVert *v)
 				v->flag |= PVERT_SELECT;
 
 			if (e->flag & PEDGE_PIN) {
-				pinuv[0] += e->orig_uv[0]*handle->aspx;
-				pinuv[1] += e->orig_uv[1]*handle->aspy;
+				pinuv[0] += e->orig_uv[0] * handle->aspx;
+				pinuv[1] += e->orig_uv[1] * handle->aspy;
 				npins++;
 			}
 			else {
-				v->uv[0] += e->orig_uv[0]*handle->aspx;
-				v->uv[1] += e->orig_uv[1]*handle->aspy;
+				v->uv[0] += e->orig_uv[0] * handle->aspx;
+				v->uv[1] += e->orig_uv[1] * handle->aspy;
 			}
 
 			nedges++;
@@ -616,8 +615,8 @@ static void p_vert_load_pin_select_uvs(PHandle *handle, PVert *v)
 	} while (e && e != (v->edge));
 
 	if (npins > 0) {
-		v->uv[0] = pinuv[0]/npins;
-		v->uv[1] = pinuv[1]/npins;
+		v->uv[0] = pinuv[0] / npins;
+		v->uv[1] = pinuv[1] / npins;
 		v->flag |= PVERT_PIN;
 	}
 	else if (nedges > 0) {
@@ -630,10 +629,10 @@ static void p_flush_uvs(PHandle *handle, PChart *chart)
 {
 	PEdge *e;
 
-	for (e=chart->edges; e; e=e->nextlink) {
+	for (e = chart->edges; e; e = e->nextlink) {
 		if (e->orig_uv) {
-			e->orig_uv[0] = e->vert->uv[0]/handle->aspx;
-			e->orig_uv[1] = e->vert->uv[1]/handle->aspy;
+			e->orig_uv[0] = e->vert->uv[0] / handle->aspx;
+			e->orig_uv[1] = e->vert->uv[1] / handle->aspy;
 		}
 	}
 }
@@ -643,10 +642,10 @@ static void p_flush_uvs_blend(PHandle *handle, PChart *chart, float blend)
 	PEdge *e;
 	float invblend = 1.0f - blend;
 
-	for (e=chart->edges; e; e=e->nextlink) {
+	for (e = chart->edges; e; e = e->nextlink) {
 		if (e->orig_uv) {
-			e->orig_uv[0] = blend*e->old_uv[0] + invblend*e->vert->uv[0]/handle->aspx;
-			e->orig_uv[1] = blend*e->old_uv[1] + invblend*e->vert->uv[1]/handle->aspy;
+			e->orig_uv[0] = blend * e->old_uv[0] + invblend * e->vert->uv[0] / handle->aspx;
+			e->orig_uv[1] = blend * e->old_uv[1] + invblend * e->vert->uv[1] / handle->aspy;
 		}
 	}
 }
@@ -691,20 +690,20 @@ static void p_face_restore_uvs(PFace *f)
 
 static PVert *p_vert_add(PHandle *handle, PHashKey key, float *co, PEdge *e)
 {
-	PVert *v = (PVert*)BLI_memarena_alloc(handle->arena, sizeof *v);
+	PVert *v = (PVert *)BLI_memarena_alloc(handle->arena, sizeof *v);
 	copy_v3_v3(v->co, co);
 	v->u.key = key;
 	v->edge = e;
 	v->flag = 0;
 
-	phash_insert(handle->hash_verts, (PHashLink*)v);
+	phash_insert(handle->hash_verts, (PHashLink *)v);
 
 	return v;
 }
 
 static PVert *p_vert_lookup(PHandle *handle, PHashKey key, float *co, PEdge *e)
 {
-	PVert *v = (PVert*)phash_lookup(handle->hash_verts, key);
+	PVert *v = (PVert *)phash_lookup(handle->hash_verts, key);
 
 	if (v)
 		return v;
@@ -714,7 +713,7 @@ static PVert *p_vert_lookup(PHandle *handle, PHashKey key, float *co, PEdge *e)
 
 static PVert *p_vert_copy(PChart *chart, PVert *v)
 {
-	PVert *nv = (PVert*)BLI_memarena_alloc(chart->handle->arena, sizeof *nv);
+	PVert *nv = (PVert *)BLI_memarena_alloc(chart->handle->arena, sizeof *nv);
 
 	copy_v3_v3(nv->co, v->co);
 	nv->uv[0] = v->uv[0];
@@ -729,7 +728,7 @@ static PVert *p_vert_copy(PChart *chart, PVert *v)
 static PEdge *p_edge_lookup(PHandle *handle, PHashKey *vkeys)
 {
 	PHashKey key = PHASH_edge(vkeys[0], vkeys[1]);
-	PEdge *e = (PEdge*)phash_lookup(handle->hash_edges, key);
+	PEdge *e = (PEdge *)phash_lookup(handle->hash_edges, key);
 
 	while (e) {
 		if ((e->vert->u.key == vkeys[0]) && (e->next->vert->u.key == vkeys[1]))
@@ -737,16 +736,18 @@ static PEdge *p_edge_lookup(PHandle *handle, PHashKey *vkeys)
 		else if ((e->vert->u.key == vkeys[1]) && (e->next->vert->u.key == vkeys[0]))
 			return e;
 
-		e = (PEdge*)phash_next(handle->hash_edges, key, (PHashLink*)e);
+		e = (PEdge *)phash_next(handle->hash_edges, key, (PHashLink *)e);
 	}
 
 	return NULL;
 }
 
-static PBool p_face_exists(PHandle *handle, PHashKey *vkeys, int i1, int i2, int i3)
+static int p_face_exists(ParamHandle *phandle, ParamKey *pvkeys, int i1, int i2, int i3)
 {
+	PHandle *handle = (PHandle *)phandle;
+	PHashKey *vkeys = (PHashKey *)pvkeys;
 	PHashKey key = PHASH_edge(vkeys[i1], vkeys[i2]);
-	PEdge *e = (PEdge*)phash_lookup(handle->hash_edges, key);
+	PEdge *e = (PEdge *)phash_lookup(handle->hash_edges, key);
 
 	while (e) {
 		if ((e->vert->u.key == vkeys[i1]) && (e->next->vert->u.key == vkeys[i2])) {
@@ -758,7 +759,7 @@ static PBool p_face_exists(PHandle *handle, PHashKey *vkeys, int i1, int i2, int
 				return P_TRUE;
 		}
 
-		e = (PEdge*)phash_next(handle->hash_edges, key, (PHashLink*)e);
+		e = (PEdge *)phash_next(handle->hash_edges, key, (PHashLink *)e);
 	}
 
 	return P_FALSE;
@@ -766,7 +767,7 @@ static PBool p_face_exists(PHandle *handle, PHashKey *vkeys, int i1, int i2, int
 
 static PChart *p_chart_new(PHandle *handle)
 {
-	PChart *chart = (PChart*)MEM_callocN(sizeof*chart, "PChart");
+	PChart *chart = (PChart *)MEM_callocN(sizeof *chart, "PChart");
 	chart->handle = handle;
 
 	return chart;
@@ -798,12 +799,12 @@ static PBool p_edge_implicit_seam(PEdge *e, PEdge *ep)
 		uvp2 = ep->orig_uv;
 	}
 
-	if((fabsf(uv1[0]-uvp1[0]) > limit[0]) || (fabsf(uv1[1]-uvp1[1]) > limit[1])) {
+	if ((fabsf(uv1[0] - uvp1[0]) > limit[0]) || (fabsf(uv1[1] - uvp1[1]) > limit[1])) {
 		e->flag |= PEDGE_SEAM;
 		ep->flag |= PEDGE_SEAM;
 		return P_TRUE;
 	}
-	if((fabsf(uv2[0]-uvp2[0]) > limit[0]) || (fabsf(uv2[1]-uvp2[1]) > limit[1])) {
+	if ((fabsf(uv2[0] - uvp2[0]) > limit[0]) || (fabsf(uv2[1] - uvp2[1]) > limit[1])) {
 		e->flag |= PEDGE_SEAM;
 		ep->flag |= PEDGE_SEAM;
 		return P_TRUE;
@@ -824,7 +825,7 @@ static PBool p_edge_has_pair(PHandle *handle, PEdge *e, PEdge **pair, PBool impl
 		return P_FALSE;
 	
 	key = PHASH_edge(key1, key2);
-	pe = (PEdge*)phash_lookup(handle->hash_edges, key);
+	pe = (PEdge *)phash_lookup(handle->hash_edges, key);
 	*pair = NULL;
 
 	while (pe) {
@@ -833,11 +834,13 @@ static PBool p_edge_has_pair(PHandle *handle, PEdge *e, PEdge **pair, PBool impl
 			v2 = pe->next->vert;
 
 			if (((v1->u.key == key1) && (v2->u.key == key2)) ||
-				((v1->u.key == key2) && (v2->u.key == key1))) {
+			    ((v1->u.key == key2) && (v2->u.key == key1)))
+			{
 
 				/* don't connect seams and t-junctions */
 				if ((pe->flag & PEDGE_SEAM) || *pair ||
-					(impl && p_edge_implicit_seam(e, pe))) {
+				    (impl && p_edge_implicit_seam(e, pe)))
+				{
 					*pair = NULL;
 					return P_FALSE;
 				}
@@ -846,7 +849,7 @@ static PBool p_edge_has_pair(PHandle *handle, PEdge *e, PEdge **pair, PBool impl
 			}
 		}
 
-		pe = (PEdge*)phash_next(handle->hash_edges, key, (PHashLink*)pe);
+		pe = (PEdge *)phash_next(handle->hash_edges, key, (PHashLink *)pe);
 	}
 
 	if (*pair && (e->vert == (*pair)->vert)) {
@@ -864,7 +867,7 @@ static PBool p_edge_connect_pair(PHandle *handle, PEdge *e, PEdge ***stack, PBoo
 {
 	PEdge *pair = NULL;
 
-	if(!e->pair && p_edge_has_pair(handle, e, &pair, impl)) {
+	if (!e->pair && p_edge_has_pair(handle, e, &pair, impl)) {
 		if (e->vert == pair->vert)
 			p_face_flip(pair->face);
 
@@ -882,7 +885,7 @@ static PBool p_edge_connect_pair(PHandle *handle, PEdge *e, PEdge ***stack, PBoo
 
 static int p_connect_pairs(PHandle *handle, PBool impl)
 {
-	PEdge **stackbase = MEM_mallocN(sizeof*stackbase*phash_size(handle->hash_faces), "Pstackbase");
+	PEdge **stackbase = MEM_mallocN(sizeof *stackbase * phash_size(handle->hash_faces), "Pstackbase");
 	PEdge **stack = stackbase;
 	PFace *f, *first;
 	PEdge *e, *e1, *e2;
@@ -890,7 +893,7 @@ static int p_connect_pairs(PHandle *handle, PBool impl)
 	int ncharts = 0;
 
 	/* connect pairs, count edges, set vertex-edge pointer to a pairless edge */
-	for (first=chart->faces; first; first=first->nextlink) {
+	for (first = chart->faces; first; first = first->nextlink) {
 		if (first->flag & PFACE_CONNECTED)
 			continue;
 
@@ -977,7 +980,7 @@ static void p_split_vert(PChart *chart, PEdge *e)
 
 static PChart **p_split_charts(PHandle *handle, PChart *chart, int ncharts)
 {
-	PChart **charts = MEM_mallocN(sizeof*charts * ncharts, "PCharts"), *nchart;
+	PChart **charts = MEM_mallocN(sizeof *charts * ncharts, "PCharts"), *nchart;
 	PFace *f, *nextf;
 	int i;
 
@@ -1019,12 +1022,12 @@ static PFace *p_face_add(PHandle *handle)
 	PEdge *e1, *e2, *e3;
 
 	/* allocate */
-	f = (PFace*)BLI_memarena_alloc(handle->arena, sizeof *f);
-	f->flag=0; // init !
+	f = (PFace *)BLI_memarena_alloc(handle->arena, sizeof *f);
+	f->flag = 0; // init !
 
-	e1 = (PEdge*)BLI_memarena_alloc(handle->arena, sizeof *e1);
-	e2 = (PEdge*)BLI_memarena_alloc(handle->arena, sizeof *e2);
-	e3 = (PEdge*)BLI_memarena_alloc(handle->arena, sizeof *e3);
+	e1 = (PEdge *)BLI_memarena_alloc(handle->arena, sizeof *e1);
+	e2 = (PEdge *)BLI_memarena_alloc(handle->arena, sizeof *e2);
+	e3 = (PEdge *)BLI_memarena_alloc(handle->arena, sizeof *e3);
 
 	/* set up edges */
 	f->edge = e1;
@@ -1038,16 +1041,16 @@ static PFace *p_face_add(PHandle *handle)
 	e2->pair = NULL;
 	e3->pair = NULL;
    
-	e1->flag =0;
-	e2->flag =0;
-	e3->flag =0;
+	e1->flag = 0;
+	e2->flag = 0;
+	e3->flag = 0;
 
 	return f;
 }
 
 static PFace *p_face_add_construct(PHandle *handle, ParamKey key, ParamKey *vkeys,
-								   float *co[3], float *uv[3], int i1, int i2, int i3,
-								   ParamBool *pin, ParamBool *select)
+                                   float *co[3], float *uv[3], int i1, int i2, int i3,
+                                   ParamBool *pin, ParamBool *select)
 {
 	PFace *f = p_face_add(handle);
 	PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
@@ -1074,15 +1077,15 @@ static PFace *p_face_add_construct(PHandle *handle, ParamKey key, ParamKey *vkey
 
 	/* insert into hash */
 	f->u.key = key;
-	phash_insert(handle->hash_faces, (PHashLink*)f);
+	phash_insert(handle->hash_faces, (PHashLink *)f);
 
 	e1->u.key = PHASH_edge(vkeys[i1], vkeys[i2]);
 	e2->u.key = PHASH_edge(vkeys[i2], vkeys[i3]);
 	e3->u.key = PHASH_edge(vkeys[i3], vkeys[i1]);
 
-	phash_insert(handle->hash_edges, (PHashLink*)e1);
-	phash_insert(handle->hash_edges, (PHashLink*)e2);
-	phash_insert(handle->hash_edges, (PHashLink*)e3);
+	phash_insert(handle->hash_edges, (PHashLink *)e1);
+	phash_insert(handle->hash_edges, (PHashLink *)e2);
+	phash_insert(handle->hash_edges, (PHashLink *)e3);
 
 	return f;
 }
@@ -1115,19 +1118,19 @@ static PFace *p_face_add_fill(PChart *chart, PVert *v1, PVert *v2, PVert *v3)
 
 static PBool p_quad_split_direction(PHandle *handle, float **co, PHashKey *vkeys)
 {
-	float fac= len_v3v3(co[0], co[2]) - len_v3v3(co[1], co[3]);
+	float fac = len_v3v3(co[0], co[2]) - len_v3v3(co[1], co[3]);
 	PBool dir = (fac <= 0.0f);
 
 	/* the face exists check is there because of a special case: when
-	   two quads share three vertices, they can each be split into two
-	   triangles, resulting in two identical triangles. for example in
-	   suzanne's nose. */
+	 * two quads share three vertices, they can each be split into two
+	 * triangles, resulting in two identical triangles. for example in
+	 * suzanne's nose. */
 	if (dir) {
-		if (p_face_exists(handle,vkeys,0,1,2) || p_face_exists(handle,vkeys,0,2,3))
+		if (p_face_exists(handle, vkeys, 0, 1, 2) || p_face_exists(handle, vkeys, 0, 2, 3))
 			return !dir;
 	}
 	else {
-		if (p_face_exists(handle,vkeys,0,1,3) || p_face_exists(handle,vkeys,1,2,3))
+		if (p_face_exists(handle, vkeys, 0, 1, 3) || p_face_exists(handle, vkeys, 1, 2, 3))
 			return !dir;
 	}
 
@@ -1146,7 +1149,7 @@ static void p_chart_boundaries(PChart *chart, int *nboundaries, PEdge **outer)
 	if (outer)
 		*outer = NULL;
 
-	for (e=chart->edges; e; e=e->nextlink) {
+	for (e = chart->edges; e; e = e->nextlink) {
 		if (e->pair || (e->flag & PEDGE_DONE))
 			continue;
 
@@ -1160,7 +1163,7 @@ static void p_chart_boundaries(PChart *chart, int *nboundaries, PEdge **outer)
 			be->flag |= PEDGE_DONE;
 			len += p_edge_length(be);
 			be = be->next->vert->edge;
-		} while(be != e);
+		} while (be != e);
 
 		if (outer && (len > maxlen)) {
 			*outer = e;
@@ -1168,7 +1171,7 @@ static void p_chart_boundaries(PChart *chart, int *nboundaries, PEdge **outer)
 		}
 	}
 
-	for (e=chart->edges; e; e=e->nextlink)
+	for (e = chart->edges; e; e = e->nextlink)
 		e->flag &= ~PEDGE_DONE;
 }
 
@@ -1211,7 +1214,7 @@ static void p_chart_fill_boundary(PChart *chart, PEdge *be, int nedges)
 		e->u.heaplink = BLI_heap_insert(heap, angle, e);
 
 		e = p_boundary_edge_next(e);
-	} while(e != be);
+	} while (e != be);
 
 	if (nedges == 2) {
 		/* no real boundary, but an isolated seam */
@@ -1226,7 +1229,7 @@ static void p_chart_fill_boundary(PChart *chart, PEdge *be, int nedges)
 		while (nedges > 2) {
 			PEdge *ne, *ne1, *ne2;
 
-			e = (PEdge*)BLI_heap_popmin(heap);
+			e = (PEdge *)BLI_heap_popmin(heap);
 
 			e1 = p_boundary_edge_prev(e);
 			e2 = p_boundary_edge_next(e);
@@ -1283,7 +1286,7 @@ static void p_chart_fill_boundaries(PChart *chart, PEdge *outer)
 	PEdge *e, *be; /* *enext - as yet unused */
 	int nedges;
 
-	for (e=chart->edges; e; e=e->nextlink) {
+	for (e = chart->edges; e; e = e->nextlink) {
 		/* enext = e->nextlink; - as yet unused */
 
 		if (e->pair || (e->flag & PEDGE_FILLED))
@@ -1295,7 +1298,7 @@ static void p_chart_fill_boundaries(PChart *chart, PEdge *outer)
 			be->flag |= PEDGE_FILLED;
 			be = be->next->vert->edge;
 			nedges++;
-		} while(be != e);
+		} while (be != e);
 
 		if (e != outer)
 			p_chart_fill_boundary(chart, e, nedges);
@@ -1320,7 +1323,7 @@ static void p_polygon_kernel_clip(float (*oldpoints)[2], int noldpoints, float (
 	float *p2, *p1, isect[2];
 	int i, p2in, p1in;
 
-	p1 = oldpoints[noldpoints-1];
+	p1 = oldpoints[noldpoints - 1];
 	p1in = p_polygon_point_in(cp1, cp2, p1);
 	*nnewpoints = 0;
 
@@ -1362,20 +1365,20 @@ static void p_polygon_kernel_center(float (*points)[2], int npoints, float *cent
 	int i, size, nnewpoints = npoints;
 	float (*oldpoints)[2], (*newpoints)[2], *p1, *p2;
 	
-	size = npoints*3;
-	oldpoints = MEM_mallocN(sizeof(float)*2*size, "PPolygonOldPoints");
-	newpoints = MEM_mallocN(sizeof(float)*2*size, "PPolygonNewPoints");
+	size = npoints * 3;
+	oldpoints = MEM_mallocN(sizeof(float) * 2 * size, "PPolygonOldPoints");
+	newpoints = MEM_mallocN(sizeof(float) * 2 * size, "PPolygonNewPoints");
 
-	memcpy(oldpoints, points, sizeof(float)*2*npoints);
+	memcpy(oldpoints, points, sizeof(float) * 2 * npoints);
 
 	for (i = 0; i < npoints; i++) {
 		p1 = points[i];
-		p2 = points[(i+1)%npoints];
+		p2 = points[(i + 1) % npoints];
 		p_polygon_kernel_clip(oldpoints, nnewpoints, newpoints, &nnewpoints, p1, p2);
 
 		if (nnewpoints == 0) {
 			/* degenerate case, use center of original polygon */
-			memcpy(oldpoints, points, sizeof(float)*2*npoints);
+			memcpy(oldpoints, points, sizeof(float) * 2 * npoints);
 			nnewpoints = npoints;
 			break;
 		}
@@ -1390,13 +1393,13 @@ static void p_polygon_kernel_center(float (*points)[2], int npoints, float *cent
 			return;
 		}
 
-		if (nnewpoints*2 > size) {
+		if (nnewpoints * 2 > size) {
 			size *= 2;
 			MEM_freeN(oldpoints);
-			oldpoints = MEM_mallocN(sizeof(float)*2*size, "oldpoints");
-			memcpy(oldpoints, newpoints, sizeof(float)*2*nnewpoints);
+			oldpoints = MEM_mallocN(sizeof(float) * 2 * size, "oldpoints");
+			memcpy(oldpoints, newpoints, sizeof(float) * 2 * nnewpoints);
 			MEM_freeN(newpoints);
-			newpoints = MEM_mallocN(sizeof(float)*2*size, "newpoints");
+			newpoints = MEM_mallocN(sizeof(float) * 2 * size, "newpoints");
 		}
 		else {
 			float (*sw_points)[2] = oldpoints;
@@ -1439,7 +1442,7 @@ static float p_vert_cotan(float *v1, float *v2, float *v3)
 	if (clen == 0.0f)
 		return 0.0f;
 	
-	return dot_v3v3(a, b)/clen;
+	return dot_v3v3(a, b) / clen;
 }
 	
 static PBool p_vert_flipped_wheel_triangle(PVert *v)
@@ -1478,10 +1481,10 @@ static PBool p_vert_map_harmonic_weights(PVert *v)
 			v2 = e->pair->next->next->vert;
 			t2 = p_vert_cotan(v2->co, e->pair->vert->co, v1->co);
 
-			weight = 0.5f*(t1 + t2);
+			weight = 0.5f * (t1 + t2);
 			weightsum += weight;
-			positionsum[0] += weight*e->pair->vert->uv[0];
-			positionsum[1] += weight*e->pair->vert->uv[1];
+			positionsum[0] += weight * e->pair->vert->uv[0];
+			positionsum[1] += weight * e->pair->vert->uv[1];
 
 			e = p_wheel_edge_next(e);
 		} while (e && (e != v->edge));
@@ -1500,15 +1503,15 @@ static PBool p_vert_map_harmonic_weights(PVert *v)
 			t2 = p_vert_cotan(v2->co, v->co, v1->co);
 
 			weightsum += t1 + t2;
-			positionsum[0] += (v2->uv[1] - v1->uv[1]) + (t1*v2->uv[0] + t2*v1->uv[0]);
-			positionsum[1] += (v1->uv[0] - v2->uv[0]) + (t1*v2->uv[1] + t2*v1->uv[1]);
+			positionsum[0] += (v2->uv[1] - v1->uv[1]) + (t1 * v2->uv[0] + t2 * v1->uv[0]);
+			positionsum[1] += (v1->uv[0] - v2->uv[0]) + (t1 * v2->uv[1] + t2 * v1->uv[1]);
 		
 			e = p_wheel_edge_next(e);
 		} while (e && (e != v->edge));
 	}
 
 	if (weightsum != 0.0f) {
-		weightsum = 1.0f/weightsum;
+		weightsum = 1.0f / weightsum;
 		positionsum[0] *= weightsum;
 		positionsum[1] *= weightsum;
 	}
@@ -1534,8 +1537,8 @@ static void p_vert_harmonic_insert(PVert *v)
 
 	if (!p_vert_map_harmonic_weights(v)) {
 		/* do polygon kernel center insertion: this is quite slow, but should
-		   only be needed for 0.01 % of verts or so, when insert with harmonic
-		   weights fails */
+		 * only be needed for 0.01 % of verts or so, when insert with harmonic
+		 * weights fails */
 
 		int npoints = 0, i;
 		float (*points)[2];
@@ -1549,7 +1552,7 @@ static void p_vert_harmonic_insert(PVert *v)
 		if (e == NULL)
 			npoints++;
 
-		points = MEM_mallocN(sizeof(float)*2*npoints, "PHarmonicPoints");
+		points = MEM_mallocN(sizeof(float) * 2 * npoints, "PHarmonicPoints");
 
 		e = v->edge;
 		i = 0;
@@ -1757,7 +1760,7 @@ static PBool p_collapse_allowed_topologic(PEdge *edge, PEdge *pair)
 			return P_FALSE;
 	}
 	/* avoid merging two boundaries (oldv and keepv are on the 'other side' of
-	   the chart) */
+	 * the chart) */
 	else if (!p_vert_interior(oldv) && !p_vert_interior(keepv))
 		return P_FALSE;
 	
@@ -1787,7 +1790,7 @@ static PBool p_collapse_allowed_geometric(PEdge *edge, PEdge *pair)
 
 	p_collapsing_verts(edge, pair, &oldv, &keepv);
 
-	angulardefect = 2*M_PI;
+	angulardefect = 2 * M_PI;
 
 	e = oldv->edge;
 	do {
@@ -1817,7 +1820,7 @@ static PBool p_collapse_allowed_geometric(PEdge *edge, PEdge *pair)
 		b[2] = M_PI - b[0] - b[1];
 
 		/* abf criterion 1: avoid sharp and obtuse angles */
-		minangle = 15.0f*M_PI/180.0f;
+		minangle = 15.0f * M_PI / 180.0f;
 		maxangle = M_PI - minangle;
 
 		for (i = 0; i < 3; i++) {
@@ -1832,7 +1835,7 @@ static PBool p_collapse_allowed_geometric(PEdge *edge, PEdge *pair)
 
 	if (p_vert_interior(oldv)) {
 		/* hlscm criterion: angular defect smaller than threshold */
-		if (fabs(angulardefect) > (M_PI*30.0/180.0))
+		if (fabs(angulardefect) > (M_PI * 30.0 / 180.0))
 			return P_FALSE;
 	}
 	else {
@@ -1845,7 +1848,7 @@ static PBool p_collapse_allowed_geometric(PEdge *edge, PEdge *pair)
 		
 		/* don't collapse significant boundary changes */
 		angle = p_vec_angle(v1->co, oldv->co, v2->co);
-		if (angle < (M_PI*160.0/180.0))
+		if (angle < (M_PI * 160.0 / 180.0))
 			return P_FALSE;
 	}
 
@@ -1862,13 +1865,13 @@ static PBool p_collapse_allowed(PEdge *edge, PEdge *pair)
 		return P_FALSE;
 	
 	return (p_collapse_allowed_topologic(edge, pair) &&
-			p_collapse_allowed_geometric(edge, pair));
+	        p_collapse_allowed_geometric(edge, pair));
 }
 
 static float p_collapse_cost(PEdge *edge, PEdge *pair)
 {
 	/* based on volume and boundary optimization from:
-	  "Fast and Memory Efficient Polygonal Simplification" P. Lindstrom, G. Turk */
+	 * "Fast and Memory Efficient Polygonal Simplification" P. Lindstrom, G. Turk */
 
 	PVert *oldv, *keepv;
 	PEdge *e;
@@ -1879,8 +1882,8 @@ static float p_collapse_cost(PEdge *edge, PEdge *pair)
 	int nshapeold = 0, nshapenew = 0;
 
 	p_collapsing_verts(edge, pair, &oldv, &keepv);
-	oldf1 = (edge)? edge->face: NULL;
-	oldf2 = (pair)? pair->face: NULL;
+	oldf1 = (edge) ? edge->face : NULL;
+	oldf2 = (pair) ? pair->face : NULL;
 
 	sub_v3_v3v3(edgevec, keepv->co, oldv->co);
 
@@ -1898,7 +1901,7 @@ static float p_collapse_cost(PEdge *edge, PEdge *pair)
 			sub_v3_v3v3(tetrav3, co2, oldv->co);
 			cross_v3_v3v3(c, tetrav2, tetrav3);
 
-			volumecost += fabs(dot_v3v3(edgevec, c)/6.0f);
+			volumecost += fabs(dot_v3v3(edgevec, c) / 6.0f);
 #if 0
 			shapecost += dot_v3v3(co1, keepv->co);
 
@@ -1907,19 +1910,19 @@ static float p_collapse_cost(PEdge *edge, PEdge *pair)
 #endif
 
 			p_triangle_angles(oldv->co, co1, co2, &a1, &a2, &a3);
-			a1 = a1 - M_PI/3.0;
-			a2 = a2 - M_PI/3.0;
-			a3 = a3 - M_PI/3.0;
-			shapeold = (a1*a1 + a2*a2 + a3*a3)/((M_PI/2)*(M_PI/2));
+			a1 = a1 - M_PI / 3.0;
+			a2 = a2 - M_PI / 3.0;
+			a3 = a3 - M_PI / 3.0;
+			shapeold = (a1 * a1 + a2 * a2 + a3 * a3) / ((M_PI / 2) * (M_PI / 2));
 
 			nshapeold++;
 		}
 		else {
 			p_triangle_angles(keepv->co, co1, co2, &a1, &a2, &a3);
-			a1 = a1 - M_PI/3.0;
-			a2 = a2 - M_PI/3.0;
-			a3 = a3 - M_PI/3.0;
-			shapenew = (a1*a1 + a2*a2 + a3*a3)/((M_PI/2)*(M_PI/2));
+			a1 = a1 - M_PI / 3.0;
+			a2 = a2 - M_PI / 3.0;
+			a3 = a3 - M_PI / 3.0;
+			shapenew = (a1 * a1 + a2 * a2 + a3 * a3) / ((M_PI / 2) * (M_PI / 2));
 
 			nshapenew++;
 		}
@@ -1936,13 +1939,13 @@ static float p_collapse_cost(PEdge *edge, PEdge *pair)
 
 	elen = len_v3(edgevec);
 	weight = 1.0f; /* 0.2f */
-	cost = weight*volumecost*volumecost + elen*elen*areacost*areacost;
+	cost = weight * volumecost * volumecost + elen * elen * areacost * areacost;
 #if 0
 	cost += shapecost;
 #else
 	shapeold /= nshapeold;
 	shapenew /= nshapenew;
-	shapecost = (shapeold + 0.00001)/(shapenew + 0.00001);
+	shapecost = (shapeold + 0.00001) / (shapenew + 0.00001);
 
 	cost *= shapecost;
 #endif
@@ -2003,7 +2006,7 @@ static void p_chart_post_collapse_flush(PChart *chart, PEdge *collapsed)
 
 	chart->nverts = chart->nedges = chart->nfaces = 0;
 
-	for (v=verts; v; v=nextv) {
+	for (v = verts; v; v = nextv) {
 		nextv = v->nextlink;
 
 		if (v->flag & PVERT_COLLAPSE) {
@@ -2017,7 +2020,7 @@ static void p_chart_post_collapse_flush(PChart *chart, PEdge *collapsed)
 		}
 	}
 
-	for (e=edges; e; e=nexte) {
+	for (e = edges; e; e = nexte) {
 		nexte = e->nextlink;
 
 		if (!collapsed || !(e->flag & PEDGE_COLLAPSE_EDGE)) {
@@ -2034,8 +2037,8 @@ static void p_chart_post_collapse_flush(PChart *chart, PEdge *collapsed)
 	}
 
 	/* these are added last so they can be popped of in the right order
-	   for splitting */
-	for (e=collapsed; e; e=e->nextlink) {
+	 * for splitting */
+	for (e = collapsed; e; e = e->nextlink) {
 		e->nextlink = e->u.nextcollapse;
 		laste = e;
 	}
@@ -2044,7 +2047,7 @@ static void p_chart_post_collapse_flush(PChart *chart, PEdge *collapsed)
 		chart->collapsed_edges = collapsed;
 	}
 
-	for (f=faces; f; f=nextf) {
+	for (f = faces; f; f = nextf) {
 		nextf = f->nextlink;
 
 		if (f->flag & PFACE_COLLAPSE) {
@@ -2067,21 +2070,21 @@ static void p_chart_post_split_flush(PChart *chart)
 	PEdge *e, *nexte = NULL;
 	PFace *f, *nextf = NULL;
 
-	for (v=chart->collapsed_verts; v; v=nextv) {
+	for (v = chart->collapsed_verts; v; v = nextv) {
 		nextv = v->nextlink;
 		v->nextlink = chart->verts;
 		chart->verts = v;
 		chart->nverts++;
 	}
 
-	for (e=chart->collapsed_edges; e; e=nexte) {
+	for (e = chart->collapsed_edges; e; e = nexte) {
 		nexte = e->nextlink;
 		e->nextlink = chart->edges;
 		chart->edges = e;
 		chart->nedges++;
 	}
 
-	for (f=chart->collapsed_faces; f; f=nextf) {
+	for (f = chart->collapsed_faces; f; f = nextf) {
 		nextf = f->nextlink;
 		f->nextlink = chart->faces;
 		chart->faces = f;
@@ -2096,19 +2099,19 @@ static void p_chart_post_split_flush(PChart *chart)
 static void p_chart_simplify_compute(PChart *chart)
 {
 	/* Computes a list of edge collapses / vertex splits. The collapsed
-	   simplices go in the chart->collapsed_* lists, The original and
-	   collapsed may then be view as stacks, where the next collapse/split
-	   is at the top of the respective lists. */
+	 * simplices go in the chart->collapsed_* lists, The original and
+	 * collapsed may then be view as stacks, where the next collapse/split
+	 * is at the top of the respective lists. */
 
 	Heap *heap = BLI_heap_new();
 	PVert *v, **wheelverts;
 	PEdge *collapsededges = NULL, *e;
 	int nwheelverts, i, ncollapsed = 0;
 
-	wheelverts = MEM_mallocN(sizeof(PVert*)*chart->nverts, "PChartWheelVerts");
+	wheelverts = MEM_mallocN(sizeof(PVert *) * chart->nverts, "PChartWheelVerts");
 
 	/* insert all potential collapses into heap */
-	for (v=chart->verts; v; v=v->nextlink) {
+	for (v = chart->verts; v; v = v->nextlink) {
 		float cost;
 		PEdge *e = NULL;
 		
@@ -2120,7 +2123,7 @@ static void p_chart_simplify_compute(PChart *chart)
 			v->u.heaplink = NULL;
 	}
 
-	for (e=chart->edges; e; e=e->nextlink)
+	for (e = chart->edges; e; e = e->nextlink)
 		e->u.nextcollapse = NULL;
 
 	/* pop edge collapse out of heap one by one */
@@ -2129,7 +2132,7 @@ static void p_chart_simplify_compute(PChart *chart)
 			break;
 
 		HeapNode *link = BLI_heap_top(heap);
-		PEdge *edge = (PEdge*)BLI_heap_popmin(heap), *pair = edge->pair;
+		PEdge *edge = (PEdge *)BLI_heap_popmin(heap), *pair = edge->pair;
 		PVert *oldv, *keepv;
 		PEdge *wheele, *nexte;
 
@@ -2138,9 +2141,9 @@ static void p_chart_simplify_compute(PChart *chart)
 		collapsededges = edge;
 
 		if (edge->vert->u.heaplink != link) {
-			edge->flag |= (PEDGE_COLLAPSE_EDGE|PEDGE_COLLAPSE_PAIR);
+			edge->flag |= (PEDGE_COLLAPSE_EDGE | PEDGE_COLLAPSE_PAIR);
 			edge->next->vert->u.heaplink = NULL;
-			SWAP(PEdge*, edge, pair);
+			SWAP(PEdge *, edge, pair);
 		}
 		else {
 			edge->flag |= PEDGE_COLLAPSE_EDGE;
@@ -2198,7 +2201,7 @@ static void p_chart_complexify(PChart *chart)
 	PVert *newv, *keepv;
 	int x = 0;
 
-	for (e=chart->collapsed_edges; e; e=e->nextlink) {
+	for (e = chart->collapsed_edges; e; e = e->nextlink) {
 		if (!(e->flag & PEDGE_COLLAPSE_EDGE))
 			break;
 
@@ -2206,7 +2209,7 @@ static void p_chart_complexify(PChart *chart)
 		pair = e->pair;
 
 		if (edge->flag & PEDGE_COLLAPSE_PAIR) {
-			SWAP(PEdge*, edge, pair);
+			SWAP(PEdge *, edge, pair);
 		}
 
 		p_split_vertex(edge, pair);
@@ -2250,28 +2253,28 @@ static void p_abf_setup_system(PAbfSystem *sys)
 {
 	int i;
 
-	sys->alpha = (float*)MEM_mallocN(sizeof(float)*sys->nangles, "ABFalpha");
-	sys->beta = (float*)MEM_mallocN(sizeof(float)*sys->nangles, "ABFbeta");
-	sys->sine = (float*)MEM_mallocN(sizeof(float)*sys->nangles, "ABFsine");
-	sys->cosine = (float*)MEM_mallocN(sizeof(float)*sys->nangles, "ABFcosine");
-	sys->weight = (float*)MEM_mallocN(sizeof(float)*sys->nangles, "ABFweight");
+	sys->alpha = (float *)MEM_mallocN(sizeof(float) * sys->nangles, "ABFalpha");
+	sys->beta = (float *)MEM_mallocN(sizeof(float) * sys->nangles, "ABFbeta");
+	sys->sine = (float *)MEM_mallocN(sizeof(float) * sys->nangles, "ABFsine");
+	sys->cosine = (float *)MEM_mallocN(sizeof(float) * sys->nangles, "ABFcosine");
+	sys->weight = (float *)MEM_mallocN(sizeof(float) * sys->nangles, "ABFweight");
 
-	sys->bAlpha = (float*)MEM_mallocN(sizeof(float)*sys->nangles, "ABFbalpha");
-	sys->bTriangle = (float*)MEM_mallocN(sizeof(float)*sys->nfaces, "ABFbtriangle");
-	sys->bInterior = (float*)MEM_mallocN(sizeof(float)*2*sys->ninterior, "ABFbinterior");
+	sys->bAlpha = (float *)MEM_mallocN(sizeof(float) * sys->nangles, "ABFbalpha");
+	sys->bTriangle = (float *)MEM_mallocN(sizeof(float) * sys->nfaces, "ABFbtriangle");
+	sys->bInterior = (float *)MEM_mallocN(sizeof(float) * 2 * sys->ninterior, "ABFbinterior");
 
-	sys->lambdaTriangle = (float*)MEM_callocN(sizeof(float)*sys->nfaces, "ABFlambdatri");
-	sys->lambdaPlanar = (float*)MEM_callocN(sizeof(float)*sys->ninterior, "ABFlamdaplane");
-	sys->lambdaLength = (float*)MEM_mallocN(sizeof(float)*sys->ninterior, "ABFlambdalen");
+	sys->lambdaTriangle = (float *)MEM_callocN(sizeof(float) * sys->nfaces, "ABFlambdatri");
+	sys->lambdaPlanar = (float *)MEM_callocN(sizeof(float) * sys->ninterior, "ABFlamdaplane");
+	sys->lambdaLength = (float *)MEM_mallocN(sizeof(float) * sys->ninterior, "ABFlambdalen");
 
-	sys->J2dt = MEM_mallocN(sizeof(float)*sys->nangles*3, "ABFj2dt");
-	sys->bstar = (float*)MEM_mallocN(sizeof(float)*sys->nfaces, "ABFbstar");
-	sys->dstar = (float*)MEM_mallocN(sizeof(float)*sys->nfaces, "ABFdstar");
+	sys->J2dt = MEM_mallocN(sizeof(float) * sys->nangles * 3, "ABFj2dt");
+	sys->bstar = (float *)MEM_mallocN(sizeof(float) * sys->nfaces, "ABFbstar");
+	sys->dstar = (float *)MEM_mallocN(sizeof(float) * sys->nfaces, "ABFdstar");
 
 	for (i = 0; i < sys->ninterior; i++)
 		sys->lambdaLength[i] = 1.0;
 	
-	sys->minangle = 7.5*M_PI/180.0;
+	sys->minangle = 7.5 * M_PI / 180.0;
 	sys->maxangle = (float)M_PI - sys->minangle;
 }
 
@@ -2318,7 +2321,7 @@ static float p_abf_compute_sin_product(PAbfSystem *sys, PVert *v, int aid)
 
 		if (aid == e1->u.id) {
 			/* we are computing a derivative for this angle,
-			   so we use cos and drop the other part */
+			 * so we use cos and drop the other part */
 			sin1 *= sys->cosine[e1->u.id];
 			sin2 = 0.0;
 		}
@@ -2344,7 +2347,7 @@ static float p_abf_compute_grad_alpha(PAbfSystem *sys, PFace *f, PEdge *e)
 	PVert *v = e->vert, *v1 = e->next->vert, *v2 = e->next->next->vert;
 	float deriv;
 
-	deriv = (sys->alpha[e->u.id] - sys->beta[e->u.id])*sys->weight[e->u.id];
+	deriv = (sys->alpha[e->u.id] - sys->beta[e->u.id]) * sys->weight[e->u.id];
 	deriv += sys->lambdaTriangle[f->u.id];
 
 	if (v->flag & PVERT_INTERIOR) {
@@ -2353,12 +2356,12 @@ static float p_abf_compute_grad_alpha(PAbfSystem *sys, PFace *f, PEdge *e)
 
 	if (v1->flag & PVERT_INTERIOR) {
 		float product = p_abf_compute_sin_product(sys, v1, e->u.id);
-		deriv += sys->lambdaLength[v1->u.id]*product;
+		deriv += sys->lambdaLength[v1->u.id] * product;
 	}
 
 	if (v2->flag & PVERT_INTERIOR) {
 		float product = p_abf_compute_sin_product(sys, v2, e->u.id);
-		deriv += sys->lambdaLength[v2->u.id]*product;
+		deriv += sys->lambdaLength[v2->u.id] * product;
 	}
 
 	return deriv;
@@ -2371,7 +2374,7 @@ static float p_abf_compute_gradient(PAbfSystem *sys, PChart *chart)
 	PVert *v;
 	float norm = 0.0;
 
-	for (f=chart->faces; f; f=f->nextlink) {
+	for (f = chart->faces; f; f = f->nextlink) {
 		PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
 		float gtriangle, galpha1, galpha2, galpha3;
 
@@ -2383,16 +2386,16 @@ static float p_abf_compute_gradient(PAbfSystem *sys, PChart *chart)
 		sys->bAlpha[e2->u.id] = -galpha2;
 		sys->bAlpha[e3->u.id] = -galpha3;
 
-		norm += galpha1*galpha1 + galpha2*galpha2 + galpha3*galpha3;
+		norm += galpha1 * galpha1 + galpha2 * galpha2 + galpha3 * galpha3;
 
 		gtriangle = sys->alpha[e1->u.id] + sys->alpha[e2->u.id] + sys->alpha[e3->u.id] - (float)M_PI;
 		sys->bTriangle[f->u.id] = -gtriangle;
-		norm += gtriangle*gtriangle;
+		norm += gtriangle * gtriangle;
 	}
 
-	for (v=chart->verts; v; v=v->nextlink) {
+	for (v = chart->verts; v; v = v->nextlink) {
 		if (v->flag & PVERT_INTERIOR) {
-			float gplanar = -2*M_PI, glength;
+			float gplanar = -2 * M_PI, glength;
 
 			e = v->edge;
 			do {
@@ -2401,11 +2404,11 @@ static float p_abf_compute_gradient(PAbfSystem *sys, PChart *chart)
 			} while (e && (e != v->edge));
 
 			sys->bInterior[v->u.id] = -gplanar;
-			norm += gplanar*gplanar;
+			norm += gplanar * gplanar;
 
 			glength = p_abf_compute_sin_product(sys, v, -1);
 			sys->bInterior[sys->ninterior + v->u.id] = -glength;
-			norm += glength*glength;
+			norm += glength * glength;
 		}
 	}
 
@@ -2416,7 +2419,7 @@ static PBool p_abf_matrix_invert(PAbfSystem *sys, PChart *chart)
 {
 	PFace *f;
 	PEdge *e;
-	int i, j, ninterior = sys->ninterior, nvar = 2*sys->ninterior;
+	int i, j, ninterior = sys->ninterior, nvar = 2 * sys->ninterior;
 	PBool success;
 
 	nlNewContext();
@@ -2429,30 +2432,30 @@ static PBool p_abf_matrix_invert(PAbfSystem *sys, PChart *chart)
 	for (i = 0; i < nvar; i++)
 		nlRightHandSideAdd(0, i, sys->bInterior[i]);
 
-	for (f=chart->faces; f; f=f->nextlink) {
+	for (f = chart->faces; f; f = f->nextlink) {
 		float wi1, wi2, wi3, b, si, beta[3], j2[3][3], W[3][3];
 		float row1[6], row2[6], row3[6];
 		int vid[6];
 		PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
 		PVert *v1 = e1->vert, *v2 = e2->vert, *v3 = e3->vert;
 
-		wi1 = 1.0f/sys->weight[e1->u.id];
-		wi2 = 1.0f/sys->weight[e2->u.id];
-		wi3 = 1.0f/sys->weight[e3->u.id];
+		wi1 = 1.0f / sys->weight[e1->u.id];
+		wi2 = 1.0f / sys->weight[e2->u.id];
+		wi3 = 1.0f / sys->weight[e3->u.id];
 
 		/* bstar1 = (J1*dInv*bAlpha - bTriangle) */
-		b = sys->bAlpha[e1->u.id]*wi1;
-		b += sys->bAlpha[e2->u.id]*wi2;
-		b += sys->bAlpha[e3->u.id]*wi3;
+		b = sys->bAlpha[e1->u.id] * wi1;
+		b += sys->bAlpha[e2->u.id] * wi2;
+		b += sys->bAlpha[e3->u.id] * wi3;
 		b -= sys->bTriangle[f->u.id];
 
 		/* si = J1*d*J1t */
-		si = 1.0f/(wi1 + wi2 + wi3);
+		si = 1.0f / (wi1 + wi2 + wi3);
 
 		/* J1t*si*bstar1 - bAlpha */
-		beta[0] = b*si - sys->bAlpha[e1->u.id];
-		beta[1] = b*si - sys->bAlpha[e2->u.id];
-		beta[2] = b*si - sys->bAlpha[e3->u.id];
+		beta[0] = b * si - sys->bAlpha[e1->u.id];
+		beta[1] = b * si - sys->bAlpha[e2->u.id];
+		beta[2] = b * si - sys->bAlpha[e3->u.id];
 
 		/* use this later for computing other lambda's */
 		sys->bstar[f->u.id] = b;
@@ -2470,59 +2473,59 @@ static PBool p_abf_matrix_invert(PAbfSystem *sys, PChart *chart)
 			vid[3] = ninterior + v1->u.id;
 
 			sys->J2dt[e1->u.id][0] = j2[0][0] = 1.0f * wi1;
-			sys->J2dt[e2->u.id][0] = j2[1][0] = p_abf_compute_sin_product(sys, v1, e2->u.id)*wi2;
-			sys->J2dt[e3->u.id][0] = j2[2][0] = p_abf_compute_sin_product(sys, v1, e3->u.id)*wi3;
+			sys->J2dt[e2->u.id][0] = j2[1][0] = p_abf_compute_sin_product(sys, v1, e2->u.id) * wi2;
+			sys->J2dt[e3->u.id][0] = j2[2][0] = p_abf_compute_sin_product(sys, v1, e3->u.id) * wi3;
 
-			nlRightHandSideAdd(0, v1->u.id, j2[0][0]*beta[0]);
-			nlRightHandSideAdd(0, ninterior + v1->u.id, j2[1][0]*beta[1] + j2[2][0]*beta[2]);
+			nlRightHandSideAdd(0, v1->u.id, j2[0][0] * beta[0]);
+			nlRightHandSideAdd(0, ninterior + v1->u.id, j2[1][0] * beta[1] + j2[2][0] * beta[2]);
 
-			row1[0] = j2[0][0]*W[0][0];
-			row2[0] = j2[0][0]*W[1][0];
-			row3[0] = j2[0][0]*W[2][0];
+			row1[0] = j2[0][0] * W[0][0];
+			row2[0] = j2[0][0] * W[1][0];
+			row3[0] = j2[0][0] * W[2][0];
 
-			row1[3] = j2[1][0]*W[0][1] + j2[2][0]*W[0][2];
-			row2[3] = j2[1][0]*W[1][1] + j2[2][0]*W[1][2];
-			row3[3] = j2[1][0]*W[2][1] + j2[2][0]*W[2][2];
+			row1[3] = j2[1][0] * W[0][1] + j2[2][0] * W[0][2];
+			row2[3] = j2[1][0] * W[1][1] + j2[2][0] * W[1][2];
+			row3[3] = j2[1][0] * W[2][1] + j2[2][0] * W[2][2];
 		}
 
 		if (v2->flag & PVERT_INTERIOR) {
 			vid[1] = v2->u.id;
 			vid[4] = ninterior + v2->u.id;
 
-			sys->J2dt[e1->u.id][1] = j2[0][1] = p_abf_compute_sin_product(sys, v2, e1->u.id)*wi1;
-			sys->J2dt[e2->u.id][1] = j2[1][1] = 1.0f*wi2;
-			sys->J2dt[e3->u.id][1] = j2[2][1] = p_abf_compute_sin_product(sys, v2, e3->u.id)*wi3;
+			sys->J2dt[e1->u.id][1] = j2[0][1] = p_abf_compute_sin_product(sys, v2, e1->u.id) * wi1;
+			sys->J2dt[e2->u.id][1] = j2[1][1] = 1.0f * wi2;
+			sys->J2dt[e3->u.id][1] = j2[2][1] = p_abf_compute_sin_product(sys, v2, e3->u.id) * wi3;
 
-			nlRightHandSideAdd(0, v2->u.id, j2[1][1]*beta[1]);
-			nlRightHandSideAdd(0, ninterior + v2->u.id, j2[0][1]*beta[0] + j2[2][1]*beta[2]);
+			nlRightHandSideAdd(0, v2->u.id, j2[1][1] * beta[1]);
+			nlRightHandSideAdd(0, ninterior + v2->u.id, j2[0][1] * beta[0] + j2[2][1] * beta[2]);
 
-			row1[1] = j2[1][1]*W[0][1];
-			row2[1] = j2[1][1]*W[1][1];
-			row3[1] = j2[1][1]*W[2][1];
+			row1[1] = j2[1][1] * W[0][1];
+			row2[1] = j2[1][1] * W[1][1];
+			row3[1] = j2[1][1] * W[2][1];
 
-			row1[4] = j2[0][1]*W[0][0] + j2[2][1]*W[0][2];
-			row2[4] = j2[0][1]*W[1][0] + j2[2][1]*W[1][2];
-			row3[4] = j2[0][1]*W[2][0] + j2[2][1]*W[2][2];
+			row1[4] = j2[0][1] * W[0][0] + j2[2][1] * W[0][2];
+			row2[4] = j2[0][1] * W[1][0] + j2[2][1] * W[1][2];
+			row3[4] = j2[0][1] * W[2][0] + j2[2][1] * W[2][2];
 		}
 
 		if (v3->flag & PVERT_INTERIOR) {
 			vid[2] = v3->u.id;
 			vid[5] = ninterior + v3->u.id;
 
-			sys->J2dt[e1->u.id][2] = j2[0][2] = p_abf_compute_sin_product(sys, v3, e1->u.id)*wi1;
-			sys->J2dt[e2->u.id][2] = j2[1][2] = p_abf_compute_sin_product(sys, v3, e2->u.id)*wi2;
+			sys->J2dt[e1->u.id][2] = j2[0][2] = p_abf_compute_sin_product(sys, v3, e1->u.id) * wi1;
+			sys->J2dt[e2->u.id][2] = j2[1][2] = p_abf_compute_sin_product(sys, v3, e2->u.id) * wi2;
 			sys->J2dt[e3->u.id][2] = j2[2][2] = 1.0f * wi3;
 
-			nlRightHandSideAdd(0, v3->u.id, j2[2][2]*beta[2]);
-			nlRightHandSideAdd(0, ninterior + v3->u.id, j2[0][2]*beta[0] + j2[1][2]*beta[1]);
+			nlRightHandSideAdd(0, v3->u.id, j2[2][2] * beta[2]);
+			nlRightHandSideAdd(0, ninterior + v3->u.id, j2[0][2] * beta[0] + j2[1][2] * beta[1]);
 
-			row1[2] = j2[2][2]*W[0][2];
-			row2[2] = j2[2][2]*W[1][2];
-			row3[2] = j2[2][2]*W[2][2];
+			row1[2] = j2[2][2] * W[0][2];
+			row2[2] = j2[2][2] * W[1][2];
+			row3[2] = j2[2][2] * W[2][2];
 
-			row1[5] = j2[0][2]*W[0][0] + j2[1][2]*W[0][1];
-			row2[5] = j2[0][2]*W[1][0] + j2[1][2]*W[1][1];
-			row3[5] = j2[0][2]*W[2][0] + j2[1][2]*W[2][1];
+			row1[5] = j2[0][2] * W[0][0] + j2[1][2] * W[0][1];
+			row2[5] = j2[0][2] * W[1][0] + j2[1][2] * W[1][1];
+			row3[5] = j2[0][2] * W[2][0] + j2[1][2] * W[2][1];
 		}
 
 		for (i = 0; i < 3; i++) {
@@ -2538,20 +2541,20 @@ static PBool p_abf_matrix_invert(PAbfSystem *sys, PChart *chart)
 					continue;
 
 				if (i == 0)
-					nlMatrixAdd(r, c, j2[0][i]*row1[j]);
+					nlMatrixAdd(r, c, j2[0][i] * row1[j]);
 				else
-					nlMatrixAdd(r + ninterior, c, j2[0][i]*row1[j]);
+					nlMatrixAdd(r + ninterior, c, j2[0][i] * row1[j]);
 
 				if (i == 1)
-					nlMatrixAdd(r, c, j2[1][i]*row2[j]);
+					nlMatrixAdd(r, c, j2[1][i] * row2[j]);
 				else
-					nlMatrixAdd(r + ninterior, c, j2[1][i]*row2[j]);
+					nlMatrixAdd(r + ninterior, c, j2[1][i] * row2[j]);
 
 
 				if (i == 2)
-					nlMatrixAdd(r, c, j2[2][i]*row3[j]);
+					nlMatrixAdd(r, c, j2[2][i] * row3[j]);
 				else
-					nlMatrixAdd(r + ninterior, c, j2[2][i]*row3[j]);
+					nlMatrixAdd(r + ninterior, c, j2[2][i] * row3[j]);
 			}
 		}
 	}
@@ -2563,7 +2566,7 @@ static PBool p_abf_matrix_invert(PAbfSystem *sys, PChart *chart)
 	success = nlSolve();
 
 	if (success) {
-		for (f=chart->faces; f; f=f->nextlink) {
+		for (f = chart->faces; f; f = f->nextlink) {
 			float dlambda1, pre[3], dalpha;
 			PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
 			PVert *v1 = e1->vert, *v2 = e2->vert, *v3 = e3->vert;
@@ -2573,40 +2576,40 @@ static PBool p_abf_matrix_invert(PAbfSystem *sys, PChart *chart)
 			if (v1->flag & PVERT_INTERIOR) {
 				float x = nlGetVariable(0, v1->u.id);
 				float x2 = nlGetVariable(0, ninterior + v1->u.id);
-				pre[0] += sys->J2dt[e1->u.id][0]*x;
-				pre[1] += sys->J2dt[e2->u.id][0]*x2;
-				pre[2] += sys->J2dt[e3->u.id][0]*x2;
+				pre[0] += sys->J2dt[e1->u.id][0] * x;
+				pre[1] += sys->J2dt[e2->u.id][0] * x2;
+				pre[2] += sys->J2dt[e3->u.id][0] * x2;
 			}
 
 			if (v2->flag & PVERT_INTERIOR) {
 				float x = nlGetVariable(0, v2->u.id);
 				float x2 = nlGetVariable(0, ninterior + v2->u.id);
-				pre[0] += sys->J2dt[e1->u.id][1]*x2;
-				pre[1] += sys->J2dt[e2->u.id][1]*x;
-				pre[2] += sys->J2dt[e3->u.id][1]*x2;
+				pre[0] += sys->J2dt[e1->u.id][1] * x2;
+				pre[1] += sys->J2dt[e2->u.id][1] * x;
+				pre[2] += sys->J2dt[e3->u.id][1] * x2;
 			}
 
 			if (v3->flag & PVERT_INTERIOR) {
 				float x = nlGetVariable(0, v3->u.id);
 				float x2 = nlGetVariable(0, ninterior + v3->u.id);
-				pre[0] += sys->J2dt[e1->u.id][2]*x2;
-				pre[1] += sys->J2dt[e2->u.id][2]*x2;
-				pre[2] += sys->J2dt[e3->u.id][2]*x;
+				pre[0] += sys->J2dt[e1->u.id][2] * x2;
+				pre[1] += sys->J2dt[e2->u.id][2] * x2;
+				pre[2] += sys->J2dt[e3->u.id][2] * x;
 			}
 
 			dlambda1 = pre[0] + pre[1] + pre[2];
-			dlambda1 = sys->dstar[f->u.id]*(sys->bstar[f->u.id] - dlambda1);
+			dlambda1 = sys->dstar[f->u.id] * (sys->bstar[f->u.id] - dlambda1);
 			
 			sys->lambdaTriangle[f->u.id] += dlambda1;
 
 			dalpha = (sys->bAlpha[e1->u.id] - dlambda1);
-			sys->alpha[e1->u.id] += dalpha/sys->weight[e1->u.id] - pre[0];
+			sys->alpha[e1->u.id] += dalpha / sys->weight[e1->u.id] - pre[0];
 
 			dalpha = (sys->bAlpha[e2->u.id] - dlambda1);
-			sys->alpha[e2->u.id] += dalpha/sys->weight[e2->u.id] - pre[1];
+			sys->alpha[e2->u.id] += dalpha / sys->weight[e2->u.id] - pre[1];
 
 			dalpha = (sys->bAlpha[e3->u.id] - dlambda1);
-			sys->alpha[e3->u.id] += dalpha/sys->weight[e3->u.id] - pre[2];
+			sys->alpha[e3->u.id] += dalpha / sys->weight[e3->u.id] - pre[2];
 
 			/* clamp */
 			e = f->edge;
@@ -2636,12 +2639,12 @@ static PBool p_chart_abf_solve(PChart *chart)
 	PEdge *e, *e1, *e2, *e3;
 	PAbfSystem sys;
 	int i;
-	float /* lastnorm, */ /* UNUSED */ limit = (chart->nfaces > 100)? 1.0f: 0.001f;
+	float /* lastnorm, */ /* UNUSED */ limit = (chart->nfaces > 100) ? 1.0f : 0.001f;
 
 	/* setup id's */
 	sys.ninterior = sys.nfaces = sys.nangles = 0;
 
-	for (v=chart->verts; v; v=v->nextlink) {
+	for (v = chart->verts; v; v = v->nextlink) {
 		if (p_vert_interior(v)) {
 			v->flag |= PVERT_INTERIOR;
 			v->u.id = sys.ninterior++;
@@ -2650,7 +2653,7 @@ static PBool p_chart_abf_solve(PChart *chart)
 			v->flag &= ~PVERT_INTERIOR;
 	}
 
-	for (f=chart->faces; f; f=f->nextlink) {
+	for (f = chart->faces; f; f = f->nextlink) {
 		e1 = f->edge; e2 = e1->next; e3 = e2->next;
 		f->u.id = sys.nfaces++;
 
@@ -2663,7 +2666,7 @@ static PBool p_chart_abf_solve(PChart *chart)
 	p_abf_setup_system(&sys);
 
 	/* compute initial angles */
-	for (f=chart->faces; f; f=f->nextlink) {
+	for (f = chart->faces; f; f = f->nextlink) {
 		float a1, a2, a3;
 
 		e1 = f->edge; e2 = e1->next; e3 = e2->next;
@@ -2686,12 +2689,12 @@ static PBool p_chart_abf_solve(PChart *chart)
 		sys.alpha[e2->u.id] = sys.beta[e2->u.id] = a2;
 		sys.alpha[e3->u.id] = sys.beta[e3->u.id] = a3;
 
-		sys.weight[e1->u.id] = 2.0f/(a1*a1);
-		sys.weight[e2->u.id] = 2.0f/(a2*a2);
-		sys.weight[e3->u.id] = 2.0f/(a3*a3);
+		sys.weight[e1->u.id] = 2.0f / (a1 * a1);
+		sys.weight[e2->u.id] = 2.0f / (a2 * a2);
+		sys.weight[e3->u.id] = 2.0f / (a3 * a3);
 	}
 
-	for (v=chart->verts; v; v=v->nextlink) {
+	for (v = chart->verts; v; v = v->nextlink) {
 		if (v->flag & PVERT_INTERIOR) {
 			float anglesum = 0.0, scale;
 
@@ -2701,11 +2704,11 @@ static PBool p_chart_abf_solve(PChart *chart)
 				e = e->next->next->pair;
 			} while (e && (e != v->edge));
 
-			scale = (anglesum == 0.0f)? 0.0f: 2.0f*(float)M_PI/anglesum;
+			scale = (anglesum == 0.0f) ? 0.0f : 2.0f * (float)M_PI / anglesum;
 
 			e = v->edge;
 			do {
-				sys.beta[e->u.id] = sys.alpha[e->u.id] = sys.beta[e->u.id]*scale;
+				sys.beta[e->u.id] = sys.alpha[e->u.id] = sys.beta[e->u.id] * scale;
 				e = e->next->next->pair;
 			} while (e && (e != v->edge));
 		}
@@ -2773,15 +2776,15 @@ static void p_chart_pin_positions(PChart *chart, PVert **pin1, PVert **pin2)
 
 		if ((sub[0] > sub[1]) && (sub[0] > sub[2])) {
 			dirx = 0;
-			diry = (sub[1] > sub[2])? 1: 2;
+			diry = (sub[1] > sub[2]) ? 1 : 2;
 		}
 		else if ((sub[1] > sub[0]) && (sub[1] > sub[2])) {
 			dirx = 1;
-			diry = (sub[0] > sub[2])? 0: 2;
+			diry = (sub[0] > sub[2]) ? 0 : 2;
 		}
 		else {
 			dirx = 2;
-			diry = (sub[0] > sub[1])? 0: 1;
+			diry = (sub[0] > sub[1]) ? 0 : 1;
 		}
 
 		if (dirx == 2) {
@@ -2807,8 +2810,8 @@ static PBool p_chart_symmetry_pins(PChart *chart, PEdge *outer, PVert **pin1, PV
 	float maxlen = 0.0f, curlen = 0.0f, totlen = 0.0f, firstlen = 0.0f;
 	float len1, len2;
  
-	 /* find longest series of verts split in the chart itself, these are
-	   marked during construction */
+	/* find longest series of verts split in the chart itself, these are
+	 * marked during construction */
 	be = outer;
 	lastbe = p_boundary_edge_prev(be);
 	do {
@@ -2818,7 +2821,8 @@ static PBool p_chart_symmetry_pins(PChart *chart, PEdge *outer, PVert **pin1, PV
 		nextbe = p_boundary_edge_next(be);
 
 		if ((be->vert->flag & PVERT_SPLIT) ||
-			(lastbe->vert->flag & nextbe->vert->flag & PVERT_SPLIT)) {
+		    (lastbe->vert->flag & nextbe->vert->flag & PVERT_SPLIT))
+		{
 			if (!cure) {
 				if (be == outer)
 					firste1 = be;
@@ -2845,7 +2849,7 @@ static PBool p_chart_symmetry_pins(PChart *chart, PEdge *outer, PVert **pin1, PV
 
 		lastbe = be;
 		be = nextbe;
-	} while(be != outer);
+	} while (be != outer);
 
 	/* make sure we also count a series of splits over the starting point */
 	if (cure && (cure != outer)) {
@@ -2858,7 +2862,7 @@ static PBool p_chart_symmetry_pins(PChart *chart, PEdge *outer, PVert **pin1, PV
 		}
 	}
 
-	if (!maxe1 || !maxe2 || (maxlen < 0.5f*totlen))
+	if (!maxe1 || !maxe2 || (maxlen < 0.5f * totlen))
 		return P_FALSE;
 	
 	/* find pin1 in the split vertices */
@@ -2917,7 +2921,7 @@ static void p_chart_extrema_verts(PChart *chart, PVert **pin1, PVert **pin2)
 	minvert[0] = minvert[1] = minvert[2] = NULL;
 	maxvert[0] = maxvert[1] = maxvert[2] = NULL;
 
-	for (v = chart->verts; v; v=v->nextlink) {
+	for (v = chart->verts; v; v = v->nextlink) {
 		for (i = 0; i < 3; i++) {
 			if (v->co[i] < minv[i]) {
 				minv[i] = v->co[i];
@@ -2951,9 +2955,9 @@ static void p_chart_lscm_load_solution(PChart *chart)
 {
 	PVert *v;
 
-	for (v=chart->verts; v; v=v->nextlink) {
-		v->uv[0] = nlGetVariable(0, 2*v->u.id);
-		v->uv[1] = nlGetVariable(0, 2*v->u.id + 1);
+	for (v = chart->verts; v; v = v->nextlink) {
+		v->uv[0] = nlGetVariable(0, 2 * v->u.id);
+		v->uv[1] = nlGetVariable(0, 2 * v->u.id + 1);
 	}
 }
 
@@ -2964,7 +2968,7 @@ static void p_chart_lscm_begin(PChart *chart, PBool live, PBool abf)
 	int npins = 0, id = 0;
 
 	/* give vertices matrix indices and count pins */
-	for (v=chart->verts; v; v=v->nextlink) {
+	for (v = chart->verts; v; v = v->nextlink) {
 		if (v->flag & PVERT_PIN) {
 			npins++;
 			if (v->flag & PVERT_SELECT)
@@ -3005,12 +3009,12 @@ static void p_chart_lscm_begin(PChart *chart, PBool live, PBool abf)
 			chart->flag |= PCHART_NOPACK;
 		}
 
-		for (v=chart->verts; v; v=v->nextlink)
+		for (v = chart->verts; v; v = v->nextlink)
 			v->u.id = id++;
 
 		nlNewContext();
-		nlSolverParameteri(NL_NB_VARIABLES, 2*chart->nverts);
-		nlSolverParameteri(NL_NB_ROWS, 2*chart->nfaces);
+		nlSolverParameteri(NL_NB_VARIABLES, 2 * chart->nverts);
+		nlSolverParameteri(NL_NB_ROWS, 2 * chart->nfaces);
 		nlSolverParameteri(NL_LEAST_SQUARES, NL_TRUE);
 
 		chart->u.lscm.context = nlGetCurrent();
@@ -3032,30 +3036,30 @@ static PBool p_chart_lscm_solve(PHandle *handle, PChart *chart)
 	/* TODO: make loading pins work for simplify/complexify. */
 #endif
 
-	for (v=chart->verts; v; v=v->nextlink)
+	for (v = chart->verts; v; v = v->nextlink)
 		if (v->flag & PVERT_PIN)
-			p_vert_load_pin_select_uvs(handle, v); /* reload for live */
+			p_vert_load_pin_select_uvs(handle, v);  /* reload for live */
 
 	if (chart->u.lscm.pin1) {
-		nlLockVariable(2*pin1->u.id);
-		nlLockVariable(2*pin1->u.id + 1);
-		nlLockVariable(2*pin2->u.id);
-		nlLockVariable(2*pin2->u.id + 1);
-	
-		nlSetVariable(0, 2*pin1->u.id, pin1->uv[0]);
-		nlSetVariable(0, 2*pin1->u.id + 1, pin1->uv[1]);
-		nlSetVariable(0, 2*pin2->u.id, pin2->uv[0]);
-		nlSetVariable(0, 2*pin2->u.id + 1, pin2->uv[1]);
+		nlLockVariable(2 * pin1->u.id);
+		nlLockVariable(2 * pin1->u.id + 1);
+		nlLockVariable(2 * pin2->u.id);
+		nlLockVariable(2 * pin2->u.id + 1);
+
+		nlSetVariable(0, 2 * pin1->u.id, pin1->uv[0]);
+		nlSetVariable(0, 2 * pin1->u.id + 1, pin1->uv[1]);
+		nlSetVariable(0, 2 * pin2->u.id, pin2->uv[0]);
+		nlSetVariable(0, 2 * pin2->u.id + 1, pin2->uv[1]);
 	}
 	else {
 		/* set and lock the pins */
-		for (v=chart->verts; v; v=v->nextlink) {
+		for (v = chart->verts; v; v = v->nextlink) {
 			if (v->flag & PVERT_PIN) {
-				nlLockVariable(2*v->u.id);
-				nlLockVariable(2*v->u.id + 1);
+				nlLockVariable(2 * v->u.id);
+				nlLockVariable(2 * v->u.id + 1);
 
-				nlSetVariable(0, 2*v->u.id, v->uv[0]);
-				nlSetVariable(0, 2*v->u.id + 1, v->uv[1]);
+				nlSetVariable(0, 2 * v->u.id, v->uv[0]);
+				nlSetVariable(0, 2 * v->u.id + 1, v->uv[1]);
 			}
 		}
 	}
@@ -3065,7 +3069,7 @@ static PBool p_chart_lscm_solve(PHandle *handle, PChart *chart)
 	nlBegin(NL_MATRIX);
 
 	row = 0;
-	for (f=chart->faces; f; f=f->nextlink) {
+	for (f = chart->faces; f; f = f->nextlink) {
 		PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
 		PVert *v1 = e1->vert, *v2 = e2->vert, *v3 = e3->vert;
 		float a1, a2, a3, ratio, cosine, sine;
@@ -3088,51 +3092,51 @@ static PBool p_chart_lscm_solve(PHandle *handle, PChart *chart)
 
 		/* shift vertices to find most stable order */
 		if (sina3 != sinmax) {
-			SHIFT3(PVert*, v1, v2, v3);
+			SHIFT3(PVert *, v1, v2, v3);
 			SHIFT3(float, a1, a2, a3);
 			SHIFT3(float, sina1, sina2, sina3);
 
 			if (sina2 == sinmax) {
-				SHIFT3(PVert*, v1, v2, v3);
+				SHIFT3(PVert *, v1, v2, v3);
 				SHIFT3(float, a1, a2, a3);
 				SHIFT3(float, sina1, sina2, sina3);
 			}
 		}
 
 		/* angle based lscm formulation */
-		ratio = (sina3 == 0.0f)? 1.0f: sina2/sina3;
-		cosine = cosf(a1)*ratio;
-		sine = sina1*ratio;
+		ratio = (sina3 == 0.0f) ? 1.0f : sina2 / sina3;
+		cosine = cosf(a1) * ratio;
+		sine = sina1 * ratio;
 
 #if 0
 		nlBegin(NL_ROW);
-		nlCoefficient(2*v1->u.id,   cosine - 1.0);
-		nlCoefficient(2*v1->u.id+1, -sine);
-		nlCoefficient(2*v2->u.id,   -cosine);
-		nlCoefficient(2*v2->u.id+1, sine);
-		nlCoefficient(2*v3->u.id,   1.0);
+		nlCoefficient(2 * v1->u.id,   cosine - 1.0);
+		nlCoefficient(2 * v1->u.id + 1, -sine);
+		nlCoefficient(2 * v2->u.id,   -cosine);
+		nlCoefficient(2 * v2->u.id + 1, sine);
+		nlCoefficient(2 * v3->u.id,   1.0);
 		nlEnd(NL_ROW);
 
 		nlBegin(NL_ROW);
-		nlCoefficient(2*v1->u.id,   sine);
-		nlCoefficient(2*v1->u.id+1, cosine - 1.0);
-		nlCoefficient(2*v2->u.id,   -sine);
-		nlCoefficient(2*v2->u.id+1, -cosine);
-		nlCoefficient(2*v3->u.id+1, 1.0);
+		nlCoefficient(2 * v1->u.id,   sine);
+		nlCoefficient(2 * v1->u.id + 1, cosine - 1.0);
+		nlCoefficient(2 * v2->u.id,   -sine);
+		nlCoefficient(2 * v2->u.id + 1, -cosine);
+		nlCoefficient(2 * v3->u.id + 1, 1.0);
 		nlEnd(NL_ROW);
 #else
-		nlMatrixAdd(row, 2*v1->u.id,   cosine - 1.0f);
-		nlMatrixAdd(row, 2*v1->u.id+1, -sine);
-		nlMatrixAdd(row, 2*v2->u.id,   -cosine);
-		nlMatrixAdd(row, 2*v2->u.id+1, sine);
-		nlMatrixAdd(row, 2*v3->u.id,   1.0);
+		nlMatrixAdd(row, 2 * v1->u.id,   cosine - 1.0f);
+		nlMatrixAdd(row, 2 * v1->u.id + 1, -sine);
+		nlMatrixAdd(row, 2 * v2->u.id,   -cosine);
+		nlMatrixAdd(row, 2 * v2->u.id + 1, sine);
+		nlMatrixAdd(row, 2 * v3->u.id,   1.0);
 		row++;
 
-		nlMatrixAdd(row, 2*v1->u.id,   sine);
-		nlMatrixAdd(row, 2*v1->u.id+1, cosine - 1.0f);
-		nlMatrixAdd(row, 2*v2->u.id,   -sine);
-		nlMatrixAdd(row, 2*v2->u.id+1, -cosine);
-		nlMatrixAdd(row, 2*v3->u.id+1, 1.0);
+		nlMatrixAdd(row, 2 * v1->u.id,   sine);
+		nlMatrixAdd(row, 2 * v1->u.id + 1, cosine - 1.0f);
+		nlMatrixAdd(row, 2 * v2->u.id,   -sine);
+		nlMatrixAdd(row, 2 * v2->u.id + 1, -cosine);
+		nlMatrixAdd(row, 2 * v3->u.id + 1, 1.0);
 		row++;
 #endif
 	}
@@ -3146,7 +3150,7 @@ static PBool p_chart_lscm_solve(PHandle *handle, PChart *chart)
 		return P_TRUE;
 	}
 	else {
-		for (v=chart->verts; v; v=v->nextlink) {
+		for (v = chart->verts; v; v = v->nextlink) {
 			v->uv[0] = 0.0f;
 			v->uv[1] = 0.0f;
 		}
@@ -3178,7 +3182,7 @@ static void p_stretch_pin_boundary(PChart *chart)
 {
 	PVert *v;
 
-	for(v=chart->verts; v; v=v->nextlink)
+	for (v = chart->verts; v; v = v->nextlink)
 		if (v->edge->pair == NULL)
 			v->flag |= PVERT_PIN;
 		else
@@ -3198,7 +3202,7 @@ static float p_face_stretch(PFace *f)
 	if (area <= 0.0f) /* flipped face -> infinite stretch */
 		return 1e10f;
 	
-	w= 1.0f/(2.0f*area);
+	w = 1.0f / (2.0f * area);
 
 	/* compute derivatives */
 	copy_v3_v3(Ps, v1->co);
@@ -3228,10 +3232,10 @@ static float p_face_stretch(PFace *f)
 	mul_v3_fl(Pt, w);
 
 	/* Sander Tensor */
-	a= dot_v3v3(Ps, Ps);
-	c= dot_v3v3(Pt, Pt);
+	a = dot_v3v3(Ps, Ps);
+	c = dot_v3v3(Pt, Pt);
 
-	T =  sqrt(0.5f*(a + c));
+	T =  sqrt(0.5f * (a + c));
 	if (f->flag & PFACE_FILLED)
 		T *= 0.2f;
 
@@ -3259,8 +3263,8 @@ static void p_chart_stretch_minimize(PChart *chart, RNG *rng)
 	float orig_stretch, low, stretch_low, high, stretch_high, mid, stretch;
 	float orig_uv[2], dir[2], random_angle, trusted_radius;
 
-	for(v=chart->verts; v; v=v->nextlink) {
-		if((v->flag & PVERT_PIN) || !(v->flag & PVERT_SELECT))
+	for (v = chart->verts; v; v = v->nextlink) {
+		if ((v->flag & PVERT_PIN) || !(v->flag & PVERT_SELECT))
 			continue;
 
 		orig_stretch = p_stretch_compute_vertex(v);
@@ -3296,8 +3300,8 @@ static void p_chart_stretch_minimize(PChart *chart, RNG *rng)
 		/* binary search for lowest stretch position */
 		for (j = 0; j < P_STRETCH_ITER; j++) {
 			mid = 0.5f * (low + high);
-			v->uv[0]= orig_uv[0] + mid*dir[0];
-			v->uv[1]= orig_uv[1] + mid*dir[1];
+			v->uv[0] = orig_uv[0] + mid * dir[0];
+			v->uv[1] = orig_uv[1] + mid * dir[1];
 			stretch = p_stretch_compute_vertex(v);
 
 			if (stretch_low < stretch_high) {
@@ -3311,7 +3315,7 @@ static void p_chart_stretch_minimize(PChart *chart, RNG *rng)
 		}
 
 		/* no luck, stretch has increased, reset to old values */
-		if(stretch >= orig_stretch)
+		if (stretch >= orig_stretch)
 			copy_v2_v2(v->uv, orig_uv);
 	}
 }
@@ -3320,8 +3324,8 @@ static void p_chart_stretch_minimize(PChart *chart, RNG *rng)
 
 static int p_compare_geometric_uv(const void *a, const void *b)
 {
-	PVert *v1 = *(PVert**)a;
-	PVert *v2 = *(PVert**)b;
+	PVert *v1 = *(PVert **)a;
+	PVert *v2 = *(PVert **)b;
 
 	if (v1->uv[0] < v2->uv[0])
 		return -1;
@@ -3355,26 +3359,26 @@ static PBool p_chart_convex_hull(PChart *chart, PVert ***verts, int *nverts, int
 	do {
 		npoints++;
 		e = p_boundary_edge_next(e);
-	} while(e != be);
+	} while (e != be);
 
-	p = points = (PVert**)MEM_mallocN(sizeof(PVert*)*npoints*2, "PCHullpoints");
-	U = (PVert**)MEM_mallocN(sizeof(PVert*)*npoints, "PCHullU");
-	L = (PVert**)MEM_mallocN(sizeof(PVert*)*npoints, "PCHullL");
+	p = points = (PVert **)MEM_mallocN(sizeof(PVert *) * npoints * 2, "PCHullpoints");
+	U = (PVert **)MEM_mallocN(sizeof(PVert *) * npoints, "PCHullU");
+	L = (PVert **)MEM_mallocN(sizeof(PVert *) * npoints, "PCHullL");
 
 	e = be;
 	do {
 		*p = e->vert;
 		p++;
 		e = p_boundary_edge_next(e);
-	} while(e != be);
+	} while (e != be);
 
-	qsort(points, npoints, sizeof(PVert*), p_compare_geometric_uv);
+	qsort(points, npoints, sizeof(PVert *), p_compare_geometric_uv);
 
 	ulen = llen = 0;
-	for (p=points, i = 0; i < npoints; i++, p++) {
-		while ((ulen > 1) && (p_area_signed(U[ulen-2]->uv, (*p)->uv, U[ulen-1]->uv) <= 0))
+	for (p = points, i = 0; i < npoints; i++, p++) {
+		while ((ulen > 1) && (p_area_signed(U[ulen - 2]->uv, (*p)->uv, U[ulen - 1]->uv) <= 0))
 			ulen--;
-		while ((llen > 1) && (p_area_signed(L[llen-2]->uv, (*p)->uv, L[llen-1]->uv) >= 0))
+		while ((llen > 1) && (p_area_signed(L[llen - 2]->uv, (*p)->uv, L[llen - 1]->uv) >= 0))
 			llen--;
 
 		U[ulen] = *p;
@@ -3384,11 +3388,11 @@ static PBool p_chart_convex_hull(PChart *chart, PVert ***verts, int *nverts, int
 	}
 
 	npoints = 0;
-	for (p=points, i = 0; i < ulen; i++, p++, npoints++)
+	for (p = points, i = 0; i < ulen; i++, p++, npoints++)
 		*p = U[i];
 
 	/* the first and last point in L are left out, since they are also in U */
-	for (i = llen-2; i > 0; i--, p++, npoints++)
+	for (i = llen - 2; i > 0; i--, p++, npoints++)
 		*p = L[i];
 
 	*verts = points;
@@ -3404,7 +3408,7 @@ static PBool p_chart_convex_hull(PChart *chart, PVert ***verts, int *nverts, int
 static float p_rectangle_area(float *p1, float *dir, float *p2, float *p3, float *p4)
 {
 	/* given 4 points on the rectangle edges and the direction of on edge,
-	   compute the area of the rectangle */
+	 * compute the area of the rectangle */
 
 	float orthodir[2], corner1[2], corner2[2], corner3[2];
 
@@ -3420,7 +3424,7 @@ static float p_rectangle_area(float *p1, float *dir, float *p2, float *p3, float
 	if (!p_intersect_line_2d_dir(p3, dir, p4, orthodir, corner3))
 		return 1e10;
 
-	return len_v2v2(corner1, corner2)*len_v2v2(corner2, corner3);
+	return len_v2v2(corner1, corner2) * len_v2v2(corner2, corner3);
 }
 
 static float p_chart_minimum_area_angle(PChart *chart)
@@ -3438,16 +3442,16 @@ static float p_chart_minimum_area_angle(PChart *chart)
 		return 0.0;
 
 	/* find left/top/right/bottom points, and compute angle for each point */
-	angles = MEM_mallocN(sizeof(float)*npoints, "PMinAreaAngles");
+	angles = MEM_mallocN(sizeof(float) * npoints, "PMinAreaAngles");
 
 	mini = maxi = 0;
 	miny = 1e10;
 	maxy = -1e10;
 
 	for (i = 0; i < npoints; i++) {
-		p1 = (i == 0)? points[npoints-1]: points[i-1];
+		p1 = (i == 0) ? points[npoints - 1] : points[i - 1];
 		p2 = points[i];
-		p3 = (i == npoints-1)? points[0]: points[i+1];
+		p3 = (i == npoints - 1) ? points[0] : points[i + 1];
 
 		angles[i] = (float)M_PI - p_vec2_angle(p1->uv, p2->uv, p3->uv);
 
@@ -3469,19 +3473,19 @@ static float p_chart_minimum_area_angle(PChart *chart)
 
 	v[0] = points[idx[0]]->uv[0];
 	v[1] = points[idx[0]]->uv[1] + 1.0f;
-	a[0] = p_vec2_angle(points[(idx[0]+1)%npoints]->uv, points[idx[0]]->uv, v);
+	a[0] = p_vec2_angle(points[(idx[0] + 1) % npoints]->uv, points[idx[0]]->uv, v);
 
 	v[0] = points[idx[1]]->uv[0] + 1.0f;
 	v[1] = points[idx[1]]->uv[1];
-	a[1] = p_vec2_angle(points[(idx[1]+1)%npoints]->uv, points[idx[1]]->uv, v);
+	a[1] = p_vec2_angle(points[(idx[1] + 1) % npoints]->uv, points[idx[1]]->uv, v);
 
 	v[0] = points[idx[2]]->uv[0];
 	v[1] = points[idx[2]]->uv[1] - 1.0f;
-	a[2] = p_vec2_angle(points[(idx[2]+1)%npoints]->uv, points[idx[2]]->uv, v);
+	a[2] = p_vec2_angle(points[(idx[2] + 1) % npoints]->uv, points[idx[2]]->uv, v);
 
 	v[0] = points[idx[3]]->uv[0] - 1.0f;
 	v[1] = points[idx[3]]->uv[1];
-	a[3] = p_vec2_angle(points[(idx[3]+1)%npoints]->uv, points[idx[3]]->uv, v);
+	a[3] = p_vec2_angle(points[(idx[3] + 1) % npoints]->uv, points[idx[3]]->uv, v);
 
 	/* 4 rotating calipers */
 
@@ -3489,7 +3493,7 @@ static float p_chart_minimum_area_angle(PChart *chart)
 	minarea = 1e10;
 	minangle = 0.0;
 
-	while (rotated <= (float)(M_PI/2.0)) { /* INVESTIGATE: how far to rotate? */
+	while (rotated <= (float)(M_PI / 2.0)) { /* INVESTIGATE: how far to rotate? */
 		/* rotate with the smallest angle */
 		mini = 0;
 		mina = 1e10;
@@ -3501,26 +3505,26 @@ static float p_chart_minimum_area_angle(PChart *chart)
 			}
 
 		rotated += mina;
-		nextidx = (idx[mini]+1)%npoints;
+		nextidx = (idx[mini] + 1) % npoints;
 
 		a[mini] = angles[nextidx];
-		a[(mini+1)%4] = a[(mini+1)%4] - mina;
-		a[(mini+2)%4] = a[(mini+2)%4] - mina;
-		a[(mini+3)%4] = a[(mini+3)%4] - mina;
+		a[(mini + 1) % 4] = a[(mini + 1) % 4] - mina;
+		a[(mini + 2) % 4] = a[(mini + 2) % 4] - mina;
+		a[(mini + 3) % 4] = a[(mini + 3) % 4] - mina;
 
 		/* compute area */
 		p1 = points[idx[mini]];
 		p1n = points[nextidx];
-		p2 = points[idx[(mini+1)%4]];
-		p3 = points[idx[(mini+2)%4]];
-		p4 = points[idx[(mini+3)%4]];
+		p2 = points[idx[(mini + 1) % 4]];
+		p3 = points[idx[(mini + 2) % 4]];
+		p4 = points[idx[(mini + 3) % 4]];
 
 		len = len_v2v2(p1->uv, p1n->uv);
 
 		if (len > 0.0f) {
-			len = 1.0f/len;
-			v[0] = (p1n->uv[0] - p1->uv[0])*len;
-			v[1] = (p1n->uv[1] - p1->uv[1])*len;
+			len = 1.0f / len;
+			v[0] = (p1n->uv[0] - p1->uv[0]) * len;
+			v[1] = (p1n->uv[1] - p1->uv[1]) * len;
 
 			area = p_rectangle_area(p1->uv, v, p2->uv, p3->uv, p4->uv);
 
@@ -3535,8 +3539,8 @@ static float p_chart_minimum_area_angle(PChart *chart)
 	}
 
 	/* try keeping rotation as small as possible */
-	if (minangle > (float)(M_PI/4))
-		minangle -= (float)(M_PI/2.0);
+	if (minangle > (float)(M_PI / 4))
+		minangle -= (float)(M_PI / 2.0);
 
 	MEM_freeN(angles);
 	MEM_freeN(points);
@@ -3551,10 +3555,10 @@ static void p_chart_rotate_minimum_area(PChart *chart)
 	float cosine = cos(angle);
 	PVert *v;
 
-	for (v = chart->verts; v; v=v->nextlink) {
+	for (v = chart->verts; v; v = v->nextlink) {
 		float oldu = v->uv[0], oldv = v->uv[1];
-		v->uv[0] = cosine*oldu - sine*oldv;
-		v->uv[1] = sine*oldu + cosine*oldv;
+		v->uv[0] = cosine * oldu - sine * oldv;
+		v->uv[1] = sine * oldu + cosine * oldv;
 	}
 }
 
@@ -3583,21 +3587,21 @@ static void p_barycentric_2d(float *v1, float *v2, float *v3, float *p, float *b
 	c[0] = v3[0] - v1[0];
 	c[1] = v3[1] - v1[1];
 
-	div = a[0]*c[1] - a[1]*c[0];
+	div = a[0] * c[1] - a[1] * c[0];
 
 	if (div == 0.0f) {
-		b[0] = 1.0f/3.0f;
-		b[1] = 1.0f/3.0f;
-		b[2] = 1.0f/3.0f;
+		b[0] = 1.0f / 3.0f;
+		b[1] = 1.0f / 3.0f;
+		b[2] = 1.0f / 3.0f;
 	}
 	else {
 		h[0] = p[0] - v1[0];
 		h[1] = p[1] - v1[1];
 
-		div = 1.0f/div;
+		div = 1.0f / div;
 
-		b[1] = (h[0]*c[1] - h[1]*c[0])*div;
-		b[2] = (a[0]*h[1] - a[1]*h[0])*div;
+		b[1] = (h[0] * c[1] - h[1] * c[0]) * div;
+		b[2] = (a[0] * h[1] - a[1] * h[0]) * div;
 		b[0] = 1.0f - b[1] - b[2];
 	}
 }
@@ -3609,8 +3613,8 @@ static PBool p_triangle_inside(SmoothTriangle *t, float *co)
 	p_barycentric_2d(t->co1, t->co2, t->co3, co, b);
 
 	if ((b[0] >= 0.0f) && (b[1] >= 0.0f) && (b[2] >= 0.0f)) {
-		co[0] = t->oco1[0]*b[0] + t->oco2[0]*b[1] + t->oco3[0]*b[2];
-		co[1] = t->oco1[1]*b[0] + t->oco2[1]*b[1] + t->oco3[1]*b[2];
+		co[0] = t->oco1[0] * b[0] + t->oco2[0] * b[1] + t->oco3[0] * b[2];
+		co[1] = t->oco1[1] * b[0] + t->oco2[1] * b[1] + t->oco3[1] * b[2];
 		return P_TRUE;
 	}
 
@@ -3630,11 +3634,11 @@ static SmoothNode *p_node_new(MemArena *arena, SmoothTriangle **tri, int ntri, f
 	if (ntri <= 10 || depth >= 15)
 		return node;
 	
-	t1 = MEM_mallocN(sizeof(SmoothTriangle)*ntri, "PNodeTri1");
-	t2 = MEM_mallocN(sizeof(SmoothTriangle)*ntri, "PNodeTri1");
+	t1 = MEM_mallocN(sizeof(SmoothTriangle) * ntri, "PNodeTri1");
+	t2 = MEM_mallocN(sizeof(SmoothTriangle) * ntri, "PNodeTri1");
 
-	axis = (bmax[0] - bmin[0] > bmax[1] - bmin[1])? 0: 1;
-	split = 0.5f*(bmin[axis] + bmax[axis]);
+	axis = (bmax[0] - bmin[0] > bmax[1] - bmin[1]) ? 0 : 1;
+	split = 0.5f * (bmin[axis] + bmax[axis]);
 
 	for (i = 0; i < ntri; i++) {
 		t = tri[i];
@@ -3665,11 +3669,11 @@ static SmoothNode *p_node_new(MemArena *arena, SmoothTriangle **tri, int ntri, f
 	/* mi = bmin[axis]; */ /* UNUSED */
 	mx = bmax[axis];
 	bmax[axis] = split;
-	node->c1 = p_node_new(arena, t1, t1size, bmin, bmax, depth+1);
+	node->c1 = p_node_new(arena, t1, t1size, bmin, bmax, depth + 1);
 
 	bmin[axis] = bmax[axis];
 	bmax[axis] = mx;
-	node->c2 = p_node_new(arena, t2, t2size, bmin, bmax, depth+1);
+	node->c2 = p_node_new(arena, t2, t2size, bmin, bmax, depth + 1);
 
 	return node;
 }
@@ -3708,9 +3712,9 @@ static PBool p_node_intersect(SmoothNode *node, float *co)
 
 static int p_compare_float(const void *a, const void *b)
 {
-	if (*((float*)a) < *((float*)b))
+	if (*((float *)a) < *((float *)b))
 		return -1;
-	else if (*((float*)a) == *((float*)b))
+	else if (*((float *)a) == *((float *)b))
 		return 0;
 	else
 		return 1;
@@ -3719,17 +3723,17 @@ static int p_compare_float(const void *a, const void *b)
 static float p_smooth_median_edge_length(PChart *chart)
 {
 	PEdge *e;
-	float *lengths = MEM_mallocN(sizeof(chart->edges)*chart->nedges, "PMedianLength");
+	float *lengths = MEM_mallocN(sizeof(chart->edges) * chart->nedges, "PMedianLength");
 	float median;
 	int i;
 
 	/* ok, so i'm lazy */
-	for (i=0, e=chart->edges; e; e=e->nextlink, i++)
+	for (i = 0, e = chart->edges; e; e = e->nextlink, i++)
 		lengths[i] = p_edge_length(e);
 	
 	qsort(lengths, i, sizeof(float), p_compare_float);
 
-	median = lengths[i/2];
+	median = lengths[i / 2];
 	MEM_freeN(lengths);
 
 	return median;
@@ -3737,10 +3741,10 @@ static float p_smooth_median_edge_length(PChart *chart)
 
 static float p_smooth_distortion(PEdge *e, float avg2d, float avg3d)
 {
-	float len2d = p_edge_uv_length(e)*avg3d;
-	float len3d = p_edge_length(e)*avg2d;
+	float len2d = p_edge_uv_length(e) * avg3d;
+	float len3d = p_edge_length(e) * avg2d;
 
-	return (len3d == 0.0f)? 0.0f: len2d/len3d;
+	return (len3d == 0.0f) ? 0.0f : len2d / len3d;
 }
 
 static void p_smooth(PChart *chart)
@@ -3762,17 +3766,17 @@ static void p_smooth(PChart *chart)
 		return;
 
 	p_chart_uv_bbox(chart, minv, maxv);
-	median = p_smooth_median_edge_length(chart)*0.10f;
+	median = p_smooth_median_edge_length(chart) * 0.10f;
 
 	if (median == 0.0f)
 		return;
 
-	invmedian = 1.0f/median;
+	invmedian = 1.0f / median;
 
 	/* compute edge distortion */
 	avglen2d = avglen3d = 0.0;
 
-	for (e=chart->edges; e; e=e->nextlink) {
+	for (e = chart->edges; e; e = e->nextlink) {
 		avglen2d += p_edge_uv_length(e);
 		avglen3d += p_edge_length(e);
 	}
@@ -3780,7 +3784,7 @@ static void p_smooth(PChart *chart)
 	avglen2d /= nedges;
 	avglen3d /= nedges;
 
-	for (v=chart->verts; v; v=v->nextlink) {
+	for (v = chart->verts; v; v = v->nextlink) {
 		v->u.distortion = 0.0;
 		nwheel = 0;
 
@@ -3790,49 +3794,49 @@ static void p_smooth(PChart *chart)
 			nwheel++;
 
 			e = e->next->next->pair;
-		} while(e && (e != v->edge));
+		} while (e && (e != v->edge));
 
 		v->u.distortion /= nwheel;
 	}
 
 	/* need to do excessive grid size checking still */
-	center[0] = 0.5f*(minv[0] + maxv[0]);
-	center[1] = 0.5f*(minv[1] + maxv[1]);
+	center[0] = 0.5f * (minv[0] + maxv[0]);
+	center[1] = 0.5f * (minv[1] + maxv[1]);
 
-	dx = 0.5f*(maxv[0] - minv[0]);
-	dy = 0.5f*(maxv[1] - minv[1]);
+	dx = 0.5f * (maxv[0] - minv[0]);
+	dy = 0.5f * (maxv[1] - minv[1]);
 
 	padding = 0.15f;
-	dx += padding*dx + 2.0f*median;
-	dy += padding*dy + 2.0f*median;
+	dx += padding * dx + 2.0f * median;
+	dy += padding * dy + 2.0f * median;
 
-	gridx = (int)(dx*invmedian);
-	gridy = (int)(dy*invmedian);
+	gridx = (int)(dx * invmedian);
+	gridy = (int)(dy * invmedian);
 
-	minv[0] = center[0] - median*gridx;
-	minv[1] = center[1] - median*gridy;
-	maxv[0] = center[0] + median*gridx;
-	maxv[1] = center[1] + median*gridy;
+	minv[0] = center[0] - median * gridx;
+	minv[1] = center[1] - median * gridy;
+	maxv[0] = center[0] + median * gridx;
+	maxv[1] = center[1] + median * gridy;
 
 	/* create grid */
-	gridx = gridx*2 + 1;
-	gridy = gridy*2 + 1;
+	gridx = gridx * 2 + 1;
+	gridy = gridy * 2 + 1;
 
 	if ((gridx <= 2) || (gridy <= 2))
 		return;
 	
-	edgesx = gridx-1;
-	edgesy = gridy-1;
-	nsize = gridx*gridy;
-	esize = edgesx*edgesy;
-	
-	nodes = MEM_mallocN(sizeof(float)*nsize, "PSmoothNodes");
-	nodesx = MEM_mallocN(sizeof(float)*nsize, "PSmoothNodesX");
-	nodesy = MEM_mallocN(sizeof(float)*nsize, "PSmoothNodesY");
-	oldnodesx = MEM_mallocN(sizeof(float)*nsize, "PSmoothOldNodesX");
-	oldnodesy = MEM_mallocN(sizeof(float)*nsize, "PSmoothOldNodesY");
-	hedges = MEM_mallocN(sizeof(float)*esize, "PSmoothHEdges");
-	vedges = MEM_mallocN(sizeof(float)*esize, "PSmoothVEdges");
+	edgesx = gridx - 1;
+	edgesy = gridy - 1;
+	nsize = gridx * gridy;
+	esize = edgesx * edgesy;
+
+	nodes = MEM_mallocN(sizeof(float) * nsize, "PSmoothNodes");
+	nodesx = MEM_mallocN(sizeof(float) * nsize, "PSmoothNodesX");
+	nodesy = MEM_mallocN(sizeof(float) * nsize, "PSmoothNodesY");
+	oldnodesx = MEM_mallocN(sizeof(float) * nsize, "PSmoothOldNodesX");
+	oldnodesy = MEM_mallocN(sizeof(float) * nsize, "PSmoothOldNodesY");
+	hedges = MEM_mallocN(sizeof(float) * esize, "PSmoothHEdges");
+	vedges = MEM_mallocN(sizeof(float) * esize, "PSmoothVEdges");
 
 	if (!nodes || !nodesx || !nodesy || !oldnodesx || !oldnodesy || !hedges || !vedges) {
 		if (nodes) MEM_freeN(nodes);
@@ -3849,17 +3853,17 @@ static void p_smooth(PChart *chart)
 
 	for (x = 0; x < gridx; x++) {
 		for (y = 0; y < gridy; y++) {
-			i = x + y*gridx;
+			i = x + y * gridx;
 
-			nodesx[i] = minv[0] + median*x;
-			nodesy[i] = minv[1] + median*y;
+			nodesx[i] = minv[0] + median * x;
+			nodesy[i] = minv[1] + median * y;
 
 			nodes[i] = 1.0f;
 		}
 	}
 
 	/* embed in grid */
-	for (f=chart->faces; f; f=f->nextlink) {
+	for (f = chart->faces; f; f = f->nextlink) {
 		PEdge *e1 = f->edge, *e2 = e1->next, *e3 = e2->next;
 		float fmin[2], fmax[2];
 		int bx1, by1, bx2, by2;
@@ -3870,16 +3874,16 @@ static void p_smooth(PChart *chart)
 		DO_MINMAX2(e2->vert->uv, fmin, fmax);
 		DO_MINMAX2(e3->vert->uv, fmin, fmax);
 
-		bx1 = (int)((fmin[0] - minv[0])*invmedian);
-		by1 = (int)((fmin[1] - minv[1])*invmedian);
-		bx2 = (int)((fmax[0] - minv[0])*invmedian + 2);
-		by2 = (int)((fmax[1] - minv[1])*invmedian + 2);
+		bx1 = (int)((fmin[0] - minv[0]) * invmedian);
+		by1 = (int)((fmin[1] - minv[1]) * invmedian);
+		bx2 = (int)((fmax[0] - minv[0]) * invmedian + 2);
+		by2 = (int)((fmax[1] - minv[1]) * invmedian + 2);
 
 		for (x = bx1; x < bx2; x++) {
 			for (y = by1; y < by2; y++) {
 				float p[2], b[3];
 
-				i = x + y*gridx;
+				i = x + y * gridx;
 		
 				p[0] = nodesx[i];
 				p[1] = nodesy[i];
@@ -3887,9 +3891,9 @@ static void p_smooth(PChart *chart)
 				p_barycentric_2d(e1->vert->uv, e2->vert->uv, e3->vert->uv, p, b);
 
 				if ((b[0] > 0.0f) && (b[1] > 0.0f) && (b[2] > 0.0f)) {
-					nodes[i] = e1->vert->u.distortion*b[0];
-					nodes[i] += e2->vert->u.distortion*b[1];
-					nodes[i] += e3->vert->u.distortion*b[2];
+					nodes[i] = e1->vert->u.distortion * b[0];
+					nodes[i] += e2->vert->u.distortion * b[1];
+					nodes[i] += e3->vert->u.distortion * b[2];
 				}
 			}
 		}
@@ -3898,22 +3902,22 @@ static void p_smooth(PChart *chart)
 	/* smooth the grid */
 	maxiter = 10;
 	totiter = 0;
-	climit = 0.00001f*nsize;
+	climit = 0.00001f * nsize;
 
 	for (it = 0; it < maxiter; it++) {
 		moved = 0.0f;
 
 		for (x = 0; x < edgesx; x++) {
 			for (y = 0; y < edgesy; y++) {
-				i = x + y*gridx;
-				j = x + y*edgesx;
+				i = x + y * gridx;
+				j = x + y * edgesx;
 
-				hedges[j] = (nodes[i] + nodes[i+1])*0.5f;
-				vedges[j] = (nodes[i] + nodes[i+gridx])*0.5f;
+				hedges[j] = (nodes[i] + nodes[i + 1]) * 0.5f;
+				vedges[j] = (nodes[i] + nodes[i + gridx]) * 0.5f;
 
 				/* we do *inverse* mapping */
-				hedges[j] = 1.0f/hedges[j];
-				vedges[j] = 1.0f/vedges[j];
+				hedges[j] = 1.0f / hedges[j];
+				vedges[j] = 1.0f / vedges[j];
 			}
 		}
 
@@ -3924,37 +3928,37 @@ static void p_smooth(PChart *chart)
 			d = 0.0f;
 			totiter += 1;
 			
-			memcpy(oldnodesx, nodesx, sizeof(float)*nsize);
-			memcpy(oldnodesy, nodesy, sizeof(float)*nsize);
+			memcpy(oldnodesx, nodesx, sizeof(float) * nsize);
+			memcpy(oldnodesy, nodesy, sizeof(float) * nsize);
 
-			for (x=1; x < gridx-1; x++) {
-				for (y=1; y < gridy-1; y++) {
+			for (x = 1; x < gridx - 1; x++) {
+				for (y = 1; y < gridy - 1; y++) {
 					float p[2], oldp[2], sum1, sum2, diff[2], length;
 
-					i = x + gridx*y;
-					j = x + edgesx*y;
+					i = x + gridx * y;
+					j = x + edgesx * y;
 
 					oldp[0] = oldnodesx[i];
 					oldp[1] = oldnodesy[i];
 
-					sum1 = hedges[j-1]*oldnodesx[i-1];
-					sum1 += hedges[j]*oldnodesx[i+1];
-					sum1 += vedges[j-edgesx]*oldnodesx[i-gridx];
-					sum1 += vedges[j]*oldnodesx[i+gridx];
+					sum1 = hedges[j - 1] * oldnodesx[i - 1];
+					sum1 += hedges[j] * oldnodesx[i + 1];
+					sum1 += vedges[j - edgesx] * oldnodesx[i - gridx];
+					sum1 += vedges[j] * oldnodesx[i + gridx];
 
-					sum2 = hedges[j-1];
+					sum2 = hedges[j - 1];
 					sum2 += hedges[j];
-					sum2 += vedges[j-edgesx];
+					sum2 += vedges[j - edgesx];
 					sum2 += vedges[j];
 
-					nodesx[i] = sum1/sum2;
+					nodesx[i] = sum1 / sum2;
 
-					sum1 = hedges[j-1]*oldnodesy[i-1];
-					sum1 += hedges[j]*oldnodesy[i+1];
-					sum1 += vedges[j-edgesx]*oldnodesy[i-gridx];
-					sum1 += vedges[j]*oldnodesy[i+gridx];
+					sum1 = hedges[j - 1] * oldnodesy[i - 1];
+					sum1 += hedges[j] * oldnodesy[i + 1];
+					sum1 += vedges[j - edgesx] * oldnodesy[i - gridx];
+					sum1 += vedges[j] * oldnodesy[i + gridx];
 
-					nodesy[i] = sum1/sum2;
+					nodesy[i] = sum1 / sum2;
 					
 					p[0] = nodesx[i];
 					p[1] = nodesy[i];
@@ -3962,7 +3966,7 @@ static void p_smooth(PChart *chart)
 					diff[0] = p[0] - oldp[0];
 					diff[1] = p[1] - oldp[1];
 
-					length = sqrt(diff[0]*diff[0] + diff[1]*diff[1]);
+					length = sqrt(diff[0] * diff[0] + diff[1] * diff[1]);
 					d = MAX2(d, length);
 					moved += length;
 				}
@@ -3982,8 +3986,8 @@ static void p_smooth(PChart *chart)
 	MEM_freeN(vedges);
 
 	/* create bsp */
-	t = triangles = MEM_mallocN(sizeof(SmoothTriangle)*esize*2, "PSmoothTris");
-	trip = tri = MEM_mallocN(sizeof(SmoothTriangle*)*esize*2, "PSmoothTriP");
+	t = triangles = MEM_mallocN(sizeof(SmoothTriangle) * esize * 2, "PSmoothTris");
+	trip = tri = MEM_mallocN(sizeof(SmoothTriangle *) * esize * 2, "PSmoothTriP");
 
 	if (!triangles || !tri) {
 		MEM_freeN(nodes);
@@ -3999,33 +4003,33 @@ static void p_smooth(PChart *chart)
 
 	for (x = 0; x < edgesx; x++) {
 		for (y = 0; y < edgesy; y++) {
-			i = x + y*gridx;
+			i = x + y * gridx;
 
 			t->co1[0] = nodesx[i];
 			t->co1[1] = nodesy[i];
 
-			t->co2[0] = nodesx[i+1];
-			t->co2[1] = nodesy[i+1];
+			t->co2[0] = nodesx[i + 1];
+			t->co2[1] = nodesy[i + 1];
 
-			t->co3[0] = nodesx[i+gridx];
-			t->co3[1] = nodesy[i+gridx];
+			t->co3[0] = nodesx[i + gridx];
+			t->co3[1] = nodesy[i + gridx];
 
-			t->oco1[0] = minv[0] + x*median;
-			t->oco1[1] = minv[1] + y*median;
+			t->oco1[0] = minv[0] + x * median;
+			t->oco1[1] = minv[1] + y * median;
 
-			t->oco2[0] = minv[0] + (x+1)*median;
-			t->oco2[1] = minv[1] + y*median;
+			t->oco2[0] = minv[0] + (x + 1) * median;
+			t->oco2[1] = minv[1] + y * median;
 
-			t->oco3[0] = minv[0] + x*median;
-			t->oco3[1] = minv[1] + (y+1)*median;
+			t->oco3[0] = minv[0] + x * median;
+			t->oco3[1] = minv[1] + (y + 1) * median;
 
-			t2 = t+1;
+			t2 = t + 1;
 
-			t2->co1[0] = nodesx[i+gridx+1];
-			t2->co1[1] = nodesy[i+gridx+1];
+			t2->co1[0] = nodesx[i + gridx + 1];
+			t2->co1[1] = nodesy[i + gridx + 1];
 
-			t2->oco1[0] = minv[0] + (x+1)*median;
-			t2->oco1[1] = minv[1] + (y+1)*median;
+			t2->oco1[0] = minv[0] + (x + 1) * median;
+			t2->oco1[1] = minv[1] + (y + 1) * median;
 
 			t2->co2[0] = t->co2[0]; t2->co2[1] = t->co2[1];
 			t2->oco2[0] = t->oco2[0]; t2->oco2[1] = t->oco2[1];
@@ -4042,10 +4046,10 @@ static void p_smooth(PChart *chart)
 	MEM_freeN(nodesx);
 	MEM_freeN(nodesy);
 
-	arena = BLI_memarena_new(1<<16, "param smooth arena");
-	root = p_node_new(arena, tri, esize*2, minv, maxv, 0);
+	arena = BLI_memarena_new(1 << 16, "param smooth arena");
+	root = p_node_new(arena, tri, esize * 2, minv, maxv, 0);
 
-	for (v=chart->verts; v; v=v->nextlink)
+	for (v = chart->verts; v; v = v->nextlink)
 		if (!p_node_intersect(root, v->uv))
 			param_warning("area smoothing error: couldn't find mapping triangle\n");
 
@@ -4059,23 +4063,23 @@ static void p_smooth(PChart *chart)
 
 ParamHandle *param_construct_begin(void)
 {
-	PHandle *handle = MEM_callocN(sizeof*handle, "PHandle");
+	PHandle *handle = MEM_callocN(sizeof *handle, "PHandle");
 	handle->construction_chart = p_chart_new(handle);
 	handle->state = PHANDLE_STATE_ALLOCATED;
-	handle->arena = BLI_memarena_new((1<<16), "param construct arena");
+	handle->arena = BLI_memarena_new((1 << 16), "param construct arena");
 	handle->aspx = 1.0f;
 	handle->aspy = 1.0f;
 
-	handle->hash_verts = phash_new((PHashLink**)&handle->construction_chart->verts, 1);
-	handle->hash_edges = phash_new((PHashLink**)&handle->construction_chart->edges, 1);
-	handle->hash_faces = phash_new((PHashLink**)&handle->construction_chart->faces, 1);
+	handle->hash_verts = phash_new((PHashLink **)&handle->construction_chart->verts, 1);
+	handle->hash_edges = phash_new((PHashLink **)&handle->construction_chart->edges, 1);
+	handle->hash_faces = phash_new((PHashLink **)&handle->construction_chart->faces, 1);
 
-	return (ParamHandle*)handle;
+	return (ParamHandle *)handle;
 }
 
 void param_aspect_ratio(ParamHandle *handle, float aspx, float aspy)
 {
-	PHandle *phandle = (PHandle*)handle;
+	PHandle *phandle = (PHandle *)handle;
 
 	phandle->aspx = aspx;
 	phandle->aspy = aspy;
@@ -4083,11 +4087,11 @@ void param_aspect_ratio(ParamHandle *handle, float aspx, float aspy)
 
 void param_delete(ParamHandle *handle)
 {
-	PHandle *phandle = (PHandle*)handle;
+	PHandle *phandle = (PHandle *)handle;
 	int i;
 
 	param_assert((phandle->state == PHANDLE_STATE_ALLOCATED) ||
-				 (phandle->state == PHANDLE_STATE_CONSTRUCTED));
+	             (phandle->state == PHANDLE_STATE_CONSTRUCTED));
 
 	for (i = 0; i < phandle->ncharts; i++)
 		p_chart_delete(phandle->charts[i]);
@@ -4108,10 +4112,10 @@ void param_delete(ParamHandle *handle)
 }
 
 void param_face_add(ParamHandle *handle, ParamKey key, int nverts,
-					ParamKey *vkeys, float **co, float **uv,
-					ParamBool *pin, ParamBool *select)
+                    ParamKey *vkeys, float **co, float **uv,
+                    ParamBool *pin, ParamBool *select)
 {
-	PHandle *phandle = (PHandle*)handle;
+	PHandle *phandle = (PHandle *)handle;
 
 	param_assert(phash_lookup(phandle->hash_faces, key) == NULL);
 	param_assert(phandle->state == PHANDLE_STATE_ALLOCATED);
@@ -4127,13 +4131,14 @@ void param_face_add(ParamHandle *handle, ParamKey key, int nverts,
 			p_face_add_construct(phandle, key, vkeys, co, uv, 1, 2, 3, pin, select);
 		}
 	}
-	else
+	else if (!p_face_exists(phandle, vkeys, 0, 1, 2)) {
 		p_face_add_construct(phandle, key, vkeys, co, uv, 0, 1, 2, pin, select);
+	}
 }
 
 void param_edge_set_seam(ParamHandle *handle, ParamKey *vkeys)
 {
-	PHandle *phandle = (PHandle*)handle;
+	PHandle *phandle = (PHandle *)handle;
 	PEdge *e;
 
 	param_assert(phandle->state == PHANDLE_STATE_ALLOCATED);
@@ -4145,7 +4150,7 @@ void param_edge_set_seam(ParamHandle *handle, ParamKey *vkeys)
 
 void param_construct_end(ParamHandle *handle, ParamBool fill, ParamBool impl)
 {
-	PHandle *phandle = (PHandle*)handle;
+	PHandle *phandle = (PHandle *)handle;
 	PChart *chart = phandle->construction_chart;
 	int i, j, nboundaries = 0;
 	PEdge *outer;
@@ -4180,7 +4185,7 @@ void param_construct_end(ParamHandle *handle, ParamBool fill, ParamBool impl)
 		if (fill && (nboundaries > 1))
 			p_chart_fill_boundaries(chart, outer);
 
-		for (v=chart->verts; v; v=v->nextlink)
+		for (v = chart->verts; v; v = v->nextlink)
 			p_vert_load_pin_select_uvs(handle, v);
 	}
 
@@ -4191,7 +4196,7 @@ void param_construct_end(ParamHandle *handle, ParamBool fill, ParamBool impl)
 
 void param_lscm_begin(ParamHandle *handle, ParamBool live, ParamBool abf)
 {
-	PHandle *phandle = (PHandle*)handle;
+	PHandle *phandle = (PHandle *)handle;
 	PFace *f;
 	int i;
 
@@ -4199,7 +4204,7 @@ void param_lscm_begin(ParamHandle *handle, ParamBool live, ParamBool abf)
 	phandle->state = PHANDLE_STATE_LSCM;
 
 	for (i = 0; i < phandle->ncharts; i++) {
-		for (f=phandle->charts[i]->faces; f; f=f->nextlink)
+		for (f = phandle->charts[i]->faces; f; f = f->nextlink)
 			p_face_backup_uvs(f);
 		p_chart_lscm_begin(phandle->charts[i], (PBool)live, (PBool)abf);
 	}
@@ -4207,7 +4212,7 @@ void param_lscm_begin(ParamHandle *handle, ParamBool live, ParamBool abf)
 
 void param_lscm_solve(ParamHandle *handle)
 {
-	PHandle *phandle = (PHandle*)handle;
+	PHandle *phandle = (PHandle *)handle;
 	PChart *chart;
 	int i;
 	PBool result;
@@ -4231,7 +4236,7 @@ void param_lscm_solve(ParamHandle *handle)
 
 void param_lscm_end(ParamHandle *handle)
 {
-	PHandle *phandle = (PHandle*)handle;
+	PHandle *phandle = (PHandle *)handle;
 	int i;
 
 	param_assert(phandle->state == PHANDLE_STATE_LSCM);
@@ -4248,7 +4253,7 @@ void param_lscm_end(ParamHandle *handle)
 
 void param_stretch_begin(ParamHandle *handle)
 {
-	PHandle *phandle = (PHandle*)handle;
+	PHandle *phandle = (PHandle *)handle;
 	PChart *chart;
 	PVert *v;
 	PFace *f;
@@ -4263,12 +4268,12 @@ void param_stretch_begin(ParamHandle *handle)
 	for (i = 0; i < phandle->ncharts; i++) {
 		chart = phandle->charts[i];
 
-		for (v=chart->verts; v; v=v->nextlink)
-			v->flag &= ~PVERT_PIN; /* don't use user-defined pins */
+		for (v = chart->verts; v; v = v->nextlink)
+			v->flag &= ~PVERT_PIN;  /* don't use user-defined pins */
 
 		p_stretch_pin_boundary(chart);
 
-		for (f=chart->faces; f; f=f->nextlink) {
+		for (f = chart->faces; f; f = f->nextlink) {
 			p_face_backup_uvs(f);
 			f->u.area3d = p_face_area(f);
 		}
@@ -4277,7 +4282,7 @@ void param_stretch_begin(ParamHandle *handle)
 
 void param_stretch_blend(ParamHandle *handle, float blend)
 {
-	PHandle *phandle = (PHandle*)handle;
+	PHandle *phandle = (PHandle *)handle;
 
 	param_assert(phandle->state == PHANDLE_STATE_STRETCH);
 	phandle->blend = blend;
@@ -4285,7 +4290,7 @@ void param_stretch_blend(ParamHandle *handle, float blend)
 
 void param_stretch_iter(ParamHandle *handle)
 {
-	PHandle *phandle = (PHandle*)handle;
+	PHandle *phandle = (PHandle *)handle;
 	PChart *chart;
 	int i;
 
@@ -4299,7 +4304,7 @@ void param_stretch_iter(ParamHandle *handle)
 
 void param_stretch_end(ParamHandle *handle)
 {
-	PHandle *phandle = (PHandle*)handle;
+	PHandle *phandle = (PHandle *)handle;
 
 	param_assert(phandle->state == PHANDLE_STATE_STRETCH);
 	phandle->state = PHANDLE_STATE_CONSTRUCTED;
@@ -4310,7 +4315,7 @@ void param_stretch_end(ParamHandle *handle)
 
 void param_smooth_area(ParamHandle *handle)
 {
-	PHandle *phandle = (PHandle*)handle;
+	PHandle *phandle = (PHandle *)handle;
 	int i;
 
 	param_assert(phandle->state == PHANDLE_STATE_CONSTRUCTED);
@@ -4319,7 +4324,7 @@ void param_smooth_area(ParamHandle *handle)
 		PChart *chart = phandle->charts[i];
 		PVert *v;
 
-		for (v=chart->verts; v; v=v->nextlink)
+		for (v = chart->verts; v; v = v->nextlink)
 			v->flag &= ~PVERT_PIN;
 
 		p_smooth(chart);
@@ -4333,20 +4338,20 @@ void param_pack(ParamHandle *handle, float margin)
 	float tot_width, tot_height, scale;
 	 
 	PChart *chart;
-	int i, unpacked=0;
+	int i, unpacked = 0;
 	float trans[2];
-	double area= 0.0;
+	double area = 0.0;
 	
-	PHandle *phandle = (PHandle*)handle;
+	PHandle *phandle = (PHandle *)handle;
 	
 	if (phandle->ncharts == 0)
 		return;
 	
-	if(phandle->aspx != phandle->aspy)
-		param_scale(handle, 1.0f/phandle->aspx, 1.0f/phandle->aspy);
+	if (phandle->aspx != phandle->aspy)
+		param_scale(handle, 1.0f / phandle->aspx, 1.0f / phandle->aspy);
 	
 	/* we may not use all these boxes */
-	boxarray = MEM_mallocN( phandle->ncharts*sizeof(boxPack), "boxPack box");
+	boxarray = MEM_mallocN(phandle->ncharts * sizeof(boxPack), "boxPack box");
 	
 	
 	for (i = 0; i < phandle->ncharts; i++) {
@@ -4357,7 +4362,7 @@ void param_pack(ParamHandle *handle, float margin)
 			continue;
 		}
 		
-		box = boxarray+(i-unpacked);
+		box = boxarray + (i - unpacked);
 		
 		p_chart_uv_bbox(chart, trans, chart->u.pack.size);
 		
@@ -4370,16 +4375,16 @@ void param_pack(ParamHandle *handle, float margin)
 		box->h =  chart->u.pack.size[1] + trans[1];
 		box->index = i; /* warning this index skips PCHART_NOPACK boxes */
 		
-		if(margin>0.0f)
-			area += sqrt(box->w*box->h);
+		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 dependant on UV scale,
+	if (margin > 0.0f) {
+		/* multiply the margin by the area to give predictable results not dependent on UV scale,
 		 * ...Without using the area running pack multiple times also gives a bad feedback loop.
 		 * multiply by 0.1 so the margin value from the UI can be from 0.0 to 1.0 but not give a massive margin */
-		margin = (margin*(float)area) * 0.1f;
-		unpacked= 0;
+		margin = (margin * (float)area) * 0.1f;
+		unpacked = 0;
 		for (i = 0; i < phandle->ncharts; i++) {
 			chart = phandle->charts[i];
 			
@@ -4388,24 +4393,24 @@ void param_pack(ParamHandle *handle, float margin)
 				continue;
 			}
 			
-			box = boxarray+(i-unpacked);
+			box = boxarray + (i - unpacked);
 			trans[0] = margin;
 			trans[1] = margin;
 			p_chart_uv_translate(chart, trans);
-			box->w += margin*2;
-			box->h += margin*2;
+			box->w += margin * 2;
+			box->h += margin * 2;
 		}
 	}
 	
-	boxPack2D(boxarray, phandle->ncharts-unpacked, &tot_width, &tot_height);
+	boxPack2D(boxarray, phandle->ncharts - unpacked, &tot_width, &tot_height);
 	
-	if (tot_height>tot_width)
-		scale = 1.0f/tot_height;
+	if (tot_height > tot_width)
+		scale = 1.0f / tot_height;
 	else
-		scale = 1.0f/tot_width;
+		scale = 1.0f / tot_width;
 	
-	for (i = 0; i < phandle->ncharts-unpacked; i++) {
-		box = boxarray+i;
+	for (i = 0; i < phandle->ncharts - unpacked; i++) {
+		box = boxarray + i;
 		trans[0] = box->x;
 		trans[1] = box->y;
 		
@@ -4415,7 +4420,7 @@ void param_pack(ParamHandle *handle, float margin)
 	}
 	MEM_freeN(boxarray);
 
-	if(phandle->aspx != phandle->aspy)
+	if (phandle->aspx != phandle->aspy)
 		param_scale(handle, phandle->aspx, phandle->aspy);
 }
 
@@ -4426,7 +4431,7 @@ void param_average(ParamHandle *handle)
 	float tot_uvarea = 0.0f, tot_facearea = 0.0f;
 	float tot_fac, fac;
 	float minv[2], maxv[2], trans[2];
-	PHandle *phandle = (PHandle*)handle;
+	PHandle *phandle = (PHandle *)handle;
 	
 	if (phandle->ncharts == 0)
 		return;
@@ -4438,7 +4443,7 @@ void param_average(ParamHandle *handle)
 		chart->u.pack.area = 0.0f; /* 3d area */
 		chart->u.pack.rescale = 0.0f; /* UV area, abusing rescale for tmp storage, oh well :/ */
 		
-		for (f=chart->faces; f; f=f->nextlink) {
+		for (f = chart->faces; f; f = f->nextlink) {
 			chart->u.pack.area += p_face_area(f);
 			chart->u.pack.rescale += fabsf(p_face_uv_area_signed(f));
 		}
@@ -4447,12 +4452,12 @@ void param_average(ParamHandle *handle)
 		tot_uvarea += chart->u.pack.rescale;
 	}
 	
-	if (tot_facearea == tot_uvarea || tot_facearea==0.0f || tot_uvarea==0.0f) {
+	if (tot_facearea == tot_uvarea || tot_facearea == 0.0f || tot_uvarea == 0.0f) {
 		/* nothing to do */
 		return;
 	}
 	
-	tot_fac = tot_facearea/tot_uvarea;
+	tot_fac = tot_facearea / tot_uvarea;
 	
 	for (i = 0; i < phandle->ncharts; i++) {
 		chart = phandle->charts[i];
@@ -4461,8 +4466,8 @@ void param_average(ParamHandle *handle)
 			
 			/* Get the island center */
 			p_chart_uv_bbox(chart, minv, maxv);
-			trans[0] = (minv[0] + maxv[0]) /-2.0f;
-			trans[1] = (minv[1] + maxv[1]) /-2.0f;
+			trans[0] = (minv[0] + maxv[0]) / -2.0f;
+			trans[1] = (minv[1] + maxv[1]) / -2.0f;
 			
 			/* Move center to 0,0 */
 			p_chart_uv_translate(chart, trans);
@@ -4478,7 +4483,7 @@ void param_average(ParamHandle *handle)
 
 void param_scale(ParamHandle *handle, float x, float y)
 {
-	PHandle *phandle = (PHandle*)handle;
+	PHandle *phandle = (PHandle *)handle;
 	PChart *chart;
 	int i;
 
@@ -4490,7 +4495,7 @@ void param_scale(ParamHandle *handle, float x, float y)
 
 void param_flush(ParamHandle *handle)
 {
-	PHandle *phandle = (PHandle*)handle;
+	PHandle *phandle = (PHandle *)handle;
 	PChart *chart;
 	int i;
 
@@ -4509,7 +4514,7 @@ void param_flush(ParamHandle *handle)
 
 void param_flush_restore(ParamHandle *handle)
 {
-	PHandle *phandle = (PHandle*)handle;
+	PHandle *phandle = (PHandle *)handle;
 	PChart *chart;
 	PFace *f;
 	int i;
@@ -4517,7 +4522,7 @@ void param_flush_restore(ParamHandle *handle)
 	for (i = 0; i < phandle->ncharts; i++) {
 		chart = phandle->charts[i];
 
-		for (f=chart->faces; f; f=f->nextlink)
+		for (f = chart->faces; f; f = f->nextlink)
 			p_face_restore_uvs(f);
 	}
 }
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.h b/source/blender/editors/uvedit/uvedit_parametrizer.h
index e8dac73..1643a89 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.h
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.h
@@ -2,8 +2,8 @@
  *  \ingroup eduv
  */
 
-#ifndef __PARAMETRIZER_H__
-#define __PARAMETRIZER_H__
+#ifndef __UVEDIT_PARAMETRIZER_H__
+#define __UVEDIT_PARAMETRIZER_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -19,15 +19,15 @@ typedef enum ParamBool {
 } ParamBool;
 
 /* Chart construction:
-   -------------------
-   - faces and seams may only be added between construct_{begin|end}
-   - the pointers to co and uv are stored, rather than being copied
-   - vertices are implicitly created
-   - in construct_end the mesh will be split up according to the seams
-   - the resulting charts must be:
-	  - manifold, connected, open (at least one boundary loop)
-   - output will be written to the uv pointers
-*/
+ * -------------------
+ * - faces and seams may only be added between construct_{begin|end}
+ * - the pointers to co and uv are stored, rather than being copied
+ * - vertices are implicitly created
+ * - in construct_end the mesh will be split up according to the seams
+ * - the resulting charts must be:
+ * - manifold, connected, open (at least one boundary loop)
+ * - output will be written to the uv pointers
+ */
 
 ParamHandle *param_construct_begin(void);
 
@@ -49,15 +49,15 @@ void param_construct_end(ParamHandle *handle, ParamBool fill, ParamBool impl);
 void param_delete(ParamHandle *chart);
 
 /* Least Squares Conformal Maps:
-   -----------------------------
-   - charts with less than two pinned vertices are assigned 2 pins
-   - lscm is divided in three steps:
-	  - begin: compute matrix and it's factorization (expensive)
-	  - solve using pinned coordinates (cheap)
-	  - end: clean up 
-	- uv coordinates are allowed to change within begin/end, for
-	  quick re-solving
-*/
+ * -----------------------------
+ * - charts with less than two pinned vertices are assigned 2 pins
+ * - lscm is divided in three steps:
+ * - begin: compute matrix and it's factorization (expensive)
+ * - solve using pinned coordinates (cheap)
+ * - end: clean up 
+ * - uv coordinates are allowed to change within begin/end, for
+ *   quick re-solving
+ */
 
 void param_lscm_begin(ParamHandle *handle, ParamBool live, ParamBool abf);
 void param_lscm_solve(ParamHandle *handle);
@@ -96,5 +96,5 @@ void param_flush_restore(ParamHandle *handle);
 }
 #endif
 
-#endif /*__PARAMETRIZER_H__*/
+#endif /*__UVEDIT_PARAMETRIZER_H__*/
 
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index c012a23..36b1e77 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -25,7 +25,7 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-/** \file blender/editors/uvedit/uvedit_stitch.c
+/** \file blender/editors/uvedit/uvedit_smart_stitch.c
  *  \ingroup eduv
  */
 
@@ -37,10 +37,10 @@
 #include "MEM_guardedalloc.h"
 
 #include "DNA_object_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_scene_types.h"
 
-#include "BLI_editVert.h"
 #include "BLI_ghash.h"
 #include "BLI_math.h"
 #include "BLI_math_vector.h"
@@ -50,6 +50,7 @@
 #include "BKE_customdata.h"
 #include "BKE_depsgraph.h"
 #include "BKE_mesh.h"
+#include "BKE_tessmesh.h"
 
 #include "ED_mesh.h"
 #include "ED_uvedit.h"
@@ -72,7 +73,7 @@ struct IslandStitchData;
 
 /* This is a straightforward implementation, count the uv's in the island that will move and take the mean displacement/rotation and apply it to all
  * elements of the island except from the stitchable */
-typedef struct IslandStitchData{
+typedef struct IslandStitchData {
 	/* rotation can be used only for edges, for vertices there is no such notion */
 	float rotation;
 	float translation[2];
@@ -86,7 +87,7 @@ typedef struct IslandStitchData{
 	char stitchableCandidate;
 	/* if edge rotation is used, flag so that vertex rotation is not used */
 	char use_edge_rotation;
-}IslandStitchData;
+} IslandStitchData;
 
 /* just for averaging UVs */
 typedef struct UVVertAverage {
@@ -102,7 +103,7 @@ typedef struct UvEdge {
 	char flag;
 	/* element that guarantees element->face has the face on element->tfindex and element->tfindex+1 is the second uv */
 	UvElement *element;
-}UvEdge;
+} UvEdge;
 
 
 /* stitch state object */
@@ -116,7 +117,7 @@ typedef struct StitchState {
 	/* stich at midpoints or at islands */
 	char midpoints;
 	/* editmesh, cached for use in modal handler */
-	EditMesh *em;
+	BMEditMesh *em;
 	/* element map for getting info about uv connectivity */
 	UvElementMap *element_map;
 	/* edge container */
@@ -139,11 +140,13 @@ typedef struct StitchState {
 	/* island that stays in place */
 	int static_island;
 	/* store number of primitives per face so that we can allocate the active island buffer later */
-	unsigned int *quads_per_island;
 	unsigned int *tris_per_island;
 } StitchState;
 
-
+typedef struct PreviewPosition {
+	int data_position;
+	int polycount_position;
+} PreviewPosition;
 /*
  * defines for UvElement flags
  */
@@ -159,24 +162,22 @@ typedef struct StitchState {
 static StitchPreviewer *_stitch_preview;
 
 /* constructor */
-static StitchPreviewer * stitch_preview_init(void)
+static StitchPreviewer *stitch_preview_init(void)
 {
 	_stitch_preview = MEM_mallocN(sizeof(StitchPreviewer), "stitch_previewer");
-	_stitch_preview->preview_quads = NULL;
-	_stitch_preview->preview_tris = NULL;
+	_stitch_preview->preview_polys = NULL;
 	_stitch_preview->preview_stitchable = NULL;
 	_stitch_preview->preview_unstitchable = NULL;
+	_stitch_preview->uvs_per_polygon = NULL;
 
-	_stitch_preview->num_quads = 0;
-	_stitch_preview->num_tris = 0;
+	_stitch_preview->preview_uvs = 0;
+	_stitch_preview->num_polys = 0;
 	_stitch_preview->num_stitchable = 0;
 	_stitch_preview->num_unstitchable = 0;
 
-	_stitch_preview->static_quads = NULL;
 	_stitch_preview->static_tris = NULL;
 
 	_stitch_preview->num_static_tris = 0;
-	_stitch_preview->num_static_quads = 0;
 
 	return _stitch_preview;
 }
@@ -184,32 +185,28 @@ static StitchPreviewer * stitch_preview_init(void)
 /* destructor...yeah this should be C++ :) */
 static void stitch_preview_delete(void)
 {
-	if(_stitch_preview)
-	{
-		if(_stitch_preview->preview_quads){
-			MEM_freeN(_stitch_preview->preview_quads);
-			_stitch_preview->preview_quads = NULL;
+	if (_stitch_preview) {
+		if (_stitch_preview->preview_polys) {
+			MEM_freeN(_stitch_preview->preview_polys);
+			_stitch_preview->preview_polys = NULL;
 		}
-		if(_stitch_preview->preview_tris){
-			MEM_freeN(_stitch_preview->preview_tris);
-			_stitch_preview->preview_tris = NULL;
+		if (_stitch_preview->uvs_per_polygon) {
+			MEM_freeN(_stitch_preview->uvs_per_polygon);
+			_stitch_preview->uvs_per_polygon = NULL;
 		}
-		if(_stitch_preview->preview_stitchable){
+		if (_stitch_preview->preview_stitchable) {
 			MEM_freeN(_stitch_preview->preview_stitchable);
 			_stitch_preview->preview_stitchable = NULL;
 		}
-		if(_stitch_preview->preview_unstitchable){
+		if (_stitch_preview->preview_unstitchable) {
 			MEM_freeN(_stitch_preview->preview_unstitchable);
 			_stitch_preview->preview_unstitchable = NULL;
 		}
-		if(_stitch_preview->static_quads){
-			MEM_freeN(_stitch_preview->static_quads);
-			_stitch_preview->static_quads = NULL;
-		}
-		if(_stitch_preview->static_tris){
+		if (_stitch_preview->static_tris) {
 			MEM_freeN(_stitch_preview->static_tris);
 			_stitch_preview->static_tris = NULL;
 		}
+
 		MEM_freeN(_stitch_preview);
 		_stitch_preview = NULL;
 	}
@@ -230,87 +227,104 @@ static void stitch_update_header(StitchState *stitch_state, bContext *C)
 	static char str[] = "(S)nap %s, (M)idpoints %s, (L)imit %.2f (Alt Wheel adjust) %s, Switch (I)sland, shift select vertices";
 
 	char msg[HEADER_LENGTH];
-	ScrArea *sa= CTX_wm_area(C);
+	ScrArea *sa = CTX_wm_area(C);
 
-	if(sa) {
+	if (sa) {
 		BLI_snprintf(msg, HEADER_LENGTH, str,
-				stitch_state->snap_islands? "On" : "Off",
-				stitch_state->midpoints? "On": "Off",
-				stitch_state->limit_dist,
-				stitch_state->use_limit? "On" : "Off");
+		             stitch_state->snap_islands ? "On" : "Off",
+		             stitch_state->midpoints    ? "On" : "Off",
+		             stitch_state->limit_dist,
+		             stitch_state->use_limit    ? "On" : "Off");
 
 		ED_area_headerprint(sa, msg);
 	}
 }
 
-static int getNumOfIslandUvs(UvElementMap *elementMap, int island){
-	if(island == elementMap->totalIslands-1){
+static int getNumOfIslandUvs(UvElementMap *elementMap, int island)
+{
+	if (island == elementMap->totalIslands - 1) {
 		return elementMap->totalUVs - elementMap->islandIndices[island];
-	}else{
-		return elementMap->islandIndices[island+1] - elementMap->islandIndices[island];
+	}
+	else {
+		return elementMap->islandIndices[island + 1] - elementMap->islandIndices[island];
 	}
 }
 
-static void stitch_uv_rotate(float rotation, float medianPoint[2], float uv[2]){
+static void stitch_uv_rotate(float rotation, float medianPoint[2], float uv[2])
+{
 	float uv_rotation_result[2];
 
 	uv[0] -= medianPoint[0];
 	uv[1] -= medianPoint[1];
 
-	uv_rotation_result[0] = cos(rotation)*uv[0] - sin(rotation)*uv[1];
-	uv_rotation_result[1] = sin(rotation)*uv[0] + cos(rotation)*uv[1];
+	uv_rotation_result[0] = cos(rotation) * uv[0] - sin(rotation) * uv[1];
+	uv_rotation_result[1] = sin(rotation) * uv[0] + cos(rotation) * uv[1];
 
 	uv[0] = uv_rotation_result[0] + medianPoint[0];
 	uv[1] = uv_rotation_result[1] + medianPoint[1];
 }
 
-static int stitch_check_uvs_stitchable(UvElement *element, UvElement *element_iter, StitchState *state){
+static int stitch_check_uvs_stitchable(UvElement *element, UvElement *element_iter, StitchState *state)
+{
 	float limit;
 	int do_limit;
 
-	if(element_iter == element){
+	if (element_iter == element) {
 		return 0;
 	}
 
 	limit = state->limit_dist;
 	do_limit = state->use_limit;
 
-	if(do_limit){
-		MTFace *mtface_orig = CustomData_em_get(&state->em->fdata, element->face->data, CD_MTFACE);
-		MTFace *mtface_iter = CustomData_em_get(&state->em->fdata, element_iter->face->data, CD_MTFACE);
+	if (do_limit) {
+		MLoopUV *luv_orig, *luv_iter;
+		BMLoop *l_orig, *l_iter;
+
+
+		l_orig = element->l;
+		luv_orig = CustomData_bmesh_get(&state->em->bm->ldata, l_orig->head.data, CD_MLOOPUV);
+		l_iter = element_iter->l;
+		luv_iter = CustomData_bmesh_get(&state->em->bm->ldata, l_iter->head.data, CD_MLOOPUV);
 
-		if(fabs(mtface_orig->uv[element->tfindex][0] - mtface_iter->uv[element_iter->tfindex][0]) < limit
-			&& fabs(mtface_orig->uv[element->tfindex][1] - mtface_iter->uv[element_iter->tfindex][1]) < limit){
+		if (fabs(luv_orig->uv[0] - luv_iter->uv[0]) < limit &&
+		    fabs(luv_orig->uv[1] - luv_iter->uv[1]) < limit)
+		{
 			return 1;
-		}else
+		}
+		else {
 			return 0;
-	}else
+		}
+	}
+	else {
 		return 1;
+	}
 }
 
 
-static int stitch_check_uvs_state_stitchable(UvElement *element, UvElement *element_iter, StitchState *state){
-	if((state->snap_islands && element->island == element_iter->island) ||
-			(!state->midpoints && element->island == element_iter->island))
+static int stitch_check_uvs_state_stitchable(UvElement *element, UvElement *element_iter, StitchState *state)
+{
+	if ((state->snap_islands && element->island == element_iter->island) ||
+	    (!state->midpoints && element->island == element_iter->island))
+	{
 		return 0;
+	}
 
 	return stitch_check_uvs_stitchable(element, element_iter, state);
 }
 
 
 /* calculate snapping for islands */
-static void stitch_calculate_island_snapping(StitchState *state, StitchPreviewer *preview, IslandStitchData *island_stitch_data, int final){
+static void stitch_calculate_island_snapping(StitchState *state, PreviewPosition *preview_position, StitchPreviewer *preview, IslandStitchData *island_stitch_data, int final)
+{
 	int i;
-	EditFace *efa;
-	MTFace *mt;
 	UvElement *element;
 
-	for(i = 0; i <  state->element_map->totalIslands; i++){
-		if(island_stitch_data[i].addedForPreview){
+	for (i = 0; i <  state->element_map->totalIslands; i++) {
+		if (island_stitch_data[i].addedForPreview) {
 			int numOfIslandUVs = 0, j;
 
 			/* check to avoid divide by 0 */
-			if(island_stitch_data[i].num_rot_elements>0){
+			if (island_stitch_data[i].num_rot_elements > 0) {
 				island_stitch_data[i].rotation /= island_stitch_data[i].num_rot_elements;
 				island_stitch_data[i].medianPoint[0] /= island_stitch_data[i].numOfElements;
 				island_stitch_data[i].medianPoint[1] /= island_stitch_data[i].numOfElements;
@@ -319,33 +333,30 @@ static void stitch_calculate_island_snapping(StitchState *state, StitchPreviewer
 			island_stitch_data[i].translation[1] /= island_stitch_data[i].numOfElements;
 			numOfIslandUVs = getNumOfIslandUvs(state->element_map, i);
 			element = &state->element_map->buf[state->element_map->islandIndices[i]];
-			for(j = 0; j < numOfIslandUVs; j++, element++){
+			for (j = 0; j < numOfIslandUVs; j++, element++) {
 				/* stitchable uvs have already been processed, don't process */
-				if(!(element->flag & STITCH_PROCESSED)){
-					efa = element->face;
-					mt = CustomData_em_get(&state->em->fdata, efa->data, CD_MTFACE);
-					if(final){
+				if (!(element->flag & STITCH_PROCESSED)) {
+					MLoopUV *luv;
+					BMLoop *l;
 
-						stitch_uv_rotate(island_stitch_data[i].rotation, island_stitch_data[i].medianPoint, mt->uv[element->tfindex]);
+					l = element->l;
+					luv = CustomData_bmesh_get(&state->em->bm->ldata, l->head.data, CD_MLOOPUV);
 
-						mt->uv[element->tfindex][0] += island_stitch_data[i].translation[0];
-						mt->uv[element->tfindex][1] += island_stitch_data[i].translation[1];
-					}
-					else if(efa->tmp.l != STITCH_NO_PREVIEW){
-						if(efa->v4){
+					if (final) {
 
-							stitch_uv_rotate(island_stitch_data[i].rotation, island_stitch_data[i].medianPoint, &preview->preview_quads[efa->tmp.l + 2*element->tfindex]);
+						stitch_uv_rotate(island_stitch_data[i].rotation, island_stitch_data[i].medianPoint, luv->uv);
 
-							preview->preview_quads[efa->tmp.l + 2*element->tfindex] += island_stitch_data[i].translation[0];
-							preview->preview_quads[efa->tmp.l + 2*element->tfindex + 1] += island_stitch_data[i].translation[1];
-						}
-						else {
+						add_v2_v2(luv->uv, island_stitch_data[i].translation);
+					}
 
-							stitch_uv_rotate(island_stitch_data[i].rotation, island_stitch_data[i].medianPoint, &preview->preview_tris[efa->tmp.l + 2*element->tfindex]);
+					else {
+						int face_preview_pos = preview_position[BM_elem_index_get(element->face)].data_position;
 
-							preview->preview_tris[efa->tmp.l + 2*element->tfindex]  += island_stitch_data[i].translation[0];
-							preview->preview_tris[efa->tmp.l + 2*element->tfindex + 1] += island_stitch_data[i].translation[1];
-						}
+						stitch_uv_rotate(island_stitch_data[i].rotation, island_stitch_data[i].medianPoint,
+						                 preview->preview_polys + face_preview_pos + 2 * element->tfindex);
+
+						add_v2_v2(preview->preview_polys + face_preview_pos + 2 * element->tfindex,
+						          island_stitch_data[i].translation);
 					}
 				}
 				/* cleanup */
@@ -360,30 +371,28 @@ static void stitch_calculate_island_snapping(StitchState *state, StitchPreviewer
 static void stitch_island_calculate_edge_rotation(UvEdge *edge, StitchState *state, UVVertAverage *uv_average, unsigned int *uvfinal_map, IslandStitchData *island_stitch_data)
 {
 	UvElement *element1, *element2;
-	EditFace *efa1;
-	EditFace *efa2;
-	MTFace *mt1;
-	MTFace *mt2;
 	float uv1[2], uv2[2];
 	float edgecos, edgesin;
 	int index1, index2;
 	float rotation;
+	MLoopUV *luv1, *luv2;
+	BMLoop *l1, *l2;
 
 	element1 = state->uvs[edge->uv1];
 	element2 = state->uvs[edge->uv2];
 
-	efa1 = element1->face;
-	mt1 = CustomData_em_get(&state->em->fdata, efa1->data, CD_MTFACE);
-	efa2 = element2->face;
-	mt2 = CustomData_em_get(&state->em->fdata, efa2->data, CD_MTFACE);
+	l1 = element1->l;
+	luv1 = CustomData_bmesh_get(&state->em->bm->ldata, l1->head.data, CD_MLOOPUV);
+	l2 = element2->l;
+	luv2 = CustomData_bmesh_get(&state->em->bm->ldata, l2->head.data, CD_MLOOPUV);
 
 	index1 = uvfinal_map[element1 - state->element_map->buf];
 	index2 = uvfinal_map[element2 - state->element_map->buf];
 
 	/* the idea here is to take the directions of the edges and find the rotation between final and initial
-	* direction. This, using inner and outer vector products, gives the angle. Directions are differences so... */
-	uv1[0] = mt2->uv[element2->tfindex][0] - mt1->uv[element1->tfindex][0];
-	uv1[1] = mt2->uv[element2->tfindex][1] - mt1->uv[element1->tfindex][1];
+	 * direction. This, using inner and outer vector products, gives the angle. Directions are differences so... */
+	uv1[0] = luv2->uv[0] - luv1->uv[0];
+	uv1[1] = luv2->uv[1] - luv1->uv[1];
 
 	uv2[0] = uv_average[index2].uv[0] - uv_average[index1].uv[0];
 	uv2[1] = uv_average[index2].uv[1] - uv_average[index1].uv[1];
@@ -391,10 +400,10 @@ static void stitch_island_calculate_edge_rotation(UvEdge *edge, StitchState *sta
 	normalize_v2(uv1);
 	normalize_v2(uv2);
 
-	edgecos = uv1[0]*uv2[0] + uv1[1]*uv2[1];
-	edgesin = uv1[0]*uv2[1] - uv2[0]*uv1[1];
+	edgecos = uv1[0] * uv2[0] + uv1[1] * uv2[1];
+	edgesin = uv1[0] * uv2[1] - uv2[0] * uv1[1];
 
-	rotation = (edgesin > 0)? acos(MAX2(-1.0, MIN2(1.0, edgecos))): -acos(MAX2(-1.0, MIN2(1.0, edgecos)));
+	rotation = (edgesin > 0) ? acos(MAX2(-1.0, MIN2(1.0, edgecos))) : -acos(MAX2(-1.0, MIN2(1.0, edgecos)));
 
 	island_stitch_data[element1->island].num_rot_elements++;
 	island_stitch_data[element1->island].rotation += rotation;
@@ -407,16 +416,19 @@ static void stitch_island_calculate_vert_rotation(UvElement *element, StitchStat
 	int index;
 	UvElement *element_iter;
 	float rotation = 0;
+	BMLoop *l;
 
-	if(element->island == state->static_island && !state->midpoints)
+	if (element->island == state->static_island && !state->midpoints)
 		return;
 
-	index = (*(&element->face->v1 + element->tfindex))->tmp.l;
+	l = element->l;
+
+	index = BM_elem_index_get(l->v);
 
 	element_iter = state->element_map->vert[index];
 
-	for(; element_iter; element_iter = element_iter->next){
-		if(element_iter->separate && stitch_check_uvs_state_stitchable(element, element_iter, state)){
+	for (; element_iter; element_iter = element_iter->next) {
+		if (element_iter->separate && stitch_check_uvs_state_stitchable(element, element_iter, state)) {
 			int index_tmp1, index_tmp2;
 			float normal[2];
 			/* easily possible*/
@@ -426,14 +438,14 @@ static void stitch_island_calculate_vert_rotation(UvElement *element, StitchStat
 			index_tmp2 = element - state->element_map->buf;
 			index_tmp2 = state->map[index_tmp2];
 
-			negate_v2_v2(normal, state->normals + index_tmp2*2);
-			edgecos = dot_v2v2(normal, state->normals + index_tmp1*2);
-			edgesin = cross_v2v2(normal, state->normals + index_tmp1*2);
-			rotation += (edgesin > 0)? acos(edgecos): -acos(edgecos);
+			negate_v2_v2(normal, state->normals + index_tmp2 * 2);
+			edgecos = dot_v2v2(normal, state->normals + index_tmp1 * 2);
+			edgesin = cross_v2v2(normal, state->normals + index_tmp1 * 2);
+			rotation += (edgesin > 0) ? acos(edgecos) : -acos(edgecos);
 		}
 	}
 
-	if(state->midpoints)
+	if (state->midpoints)
 		rotation /= 2.0;
 	island_stitch_data[element->island].num_rot_elements++;
 	island_stitch_data[element->island].rotation += rotation;
@@ -442,29 +454,26 @@ static void stitch_island_calculate_vert_rotation(UvElement *element, StitchStat
 
 static void stitch_state_delete(StitchState *stitch_state)
 {
-	if(stitch_state){
-		if(stitch_state->element_map){
-			EM_free_uv_element_map(stitch_state->element_map);
+	if (stitch_state) {
+		if (stitch_state->element_map) {
+			EDBM_uv_element_map_free(stitch_state->element_map);
 		}
-		if(stitch_state->uvs){
+		if (stitch_state->uvs) {
 			MEM_freeN(stitch_state->uvs);
 		}
-		if(stitch_state->selection_stack){
+		if (stitch_state->selection_stack) {
 			MEM_freeN(stitch_state->selection_stack);
 		}
-		if(stitch_state->quads_per_island){
-			MEM_freeN(stitch_state->quads_per_island);
-		}
-		if(stitch_state->tris_per_island){
+		if (stitch_state->tris_per_island) {
 			MEM_freeN(stitch_state->tris_per_island);
 		}
-		if(stitch_state->map){
+		if (stitch_state->map) {
 			MEM_freeN(stitch_state->map);
 		}
-		if(stitch_state->normals){
+		if (stitch_state->normals) {
 			MEM_freeN(stitch_state->normals);
 		}
-		if(stitch_state->edges){
+		if (stitch_state->edges) {
 			MEM_freeN(stitch_state->edges);
 		}
 		MEM_freeN(stitch_state);
@@ -474,19 +483,23 @@ static void stitch_state_delete(StitchState *stitch_state)
 
 
 /* checks for remote uvs that may be stitched with a certain uv, flags them if stitchable. */
-static void determine_uv_stitchability(UvElement *element, StitchState *state, IslandStitchData *island_stitch_data){
+static void determine_uv_stitchability(UvElement *element, StitchState *state, IslandStitchData *island_stitch_data)
+{
 	int vert_index;
 	UvElement *element_iter;
+	BMLoop *l;
 
-	vert_index = (*(&element->face->v1 + element->tfindex))->tmp.l;
+	l = element->l;
+
+	vert_index = BM_elem_index_get(l->v);
 	element_iter = state->element_map->vert[vert_index];
 
-	for(; element_iter; element_iter = element_iter->next){
-		if(element_iter->separate){
-			if(element_iter == element){
+	for (; element_iter; element_iter = element_iter->next) {
+		if (element_iter->separate) {
+			if (element_iter == element) {
 				continue;
 			}
-			if(stitch_check_uvs_stitchable(element, element_iter, state)){
+			if (stitch_check_uvs_stitchable(element, element_iter, state)) {
 				island_stitch_data[element_iter->island].stitchableCandidate = 1;
 				island_stitch_data[element->island].stitchableCandidate = 1;
 				element->flag |= STITCH_STITCHABLE_CANDIDATE;
@@ -497,58 +510,62 @@ static void determine_uv_stitchability(UvElement *element, StitchState *state, I
 
 
 /* set preview buffer position of UV face in editface->tmp.l */
-static void stitch_set_face_preview_buffer_position(EditFace *efa, StitchPreviewer *preview)
+static void stitch_set_face_preview_buffer_position(BMFace *efa, StitchPreviewer *preview, PreviewPosition *preview_position)
 {
-	if(efa->tmp.l == STITCH_NO_PREVIEW)
-	{
-		if(efa->v4)
-		{
-			efa->tmp.l = preview->num_quads*8;
-			preview->num_quads++;
-		} else {
-			efa->tmp.l = preview->num_tris*6;
-			preview->num_tris++;
-		}
+	int index = BM_elem_index_get(efa);
+
+	if (preview_position[index].data_position == STITCH_NO_PREVIEW) {
+		preview_position[index].data_position = preview->preview_uvs * 2;
+		preview_position[index].polycount_position = preview->num_polys++;
+		preview->preview_uvs += efa->len;
 	}
 }
 
 
 /* setup face preview for all coincident uvs and their faces */
-static void stitch_setup_face_preview_for_uv_group(UvElement *element, StitchState *state, IslandStitchData *island_stitch_data){
+static void stitch_setup_face_preview_for_uv_group(UvElement *element, StitchState *state, IslandStitchData *island_stitch_data,
+                                                   PreviewPosition *preview_position) {
 	StitchPreviewer *preview = uv_get_stitch_previewer();
 
 	/* static island does not change so returning immediately */
-	if(state->snap_islands && !state->midpoints && state->static_island == element->island)
+	if (state->snap_islands && !state->midpoints && state->static_island == element->island)
 		return;
 
-	if(state->snap_islands){
+	if (state->snap_islands) {
 		island_stitch_data[element->island].addedForPreview = 1;
 	}
 
-	do{
-		stitch_set_face_preview_buffer_position(element->face, preview);
+	do {
+		stitch_set_face_preview_buffer_position(element->face, preview, preview_position);
 		element = element->next;
-	}while(element && !element->separate);
+	} while (element && !element->separate);
 }
 
 
 /* checks if uvs are indeed stitchable and registers so that they can be shown in preview */
-static void stitch_validate_stichability(UvElement *element, StitchState *state, IslandStitchData *island_stitch_data){
+static void stitch_validate_stichability(UvElement *element, StitchState *state, IslandStitchData *island_stitch_data,
+                                         PreviewPosition *preview_position) {
 	UvElement *element_iter;
 	StitchPreviewer *preview;
+	int vert_index;
+	BMLoop *l;
+
+	l = element->l;
+
+	vert_index = BM_elem_index_get(l->v);
 
 	preview = uv_get_stitch_previewer();
-	element_iter = state->element_map->vert[(*(&element->face->v1 + element->tfindex))->tmp.l];
+	element_iter = state->element_map->vert[vert_index];
 
-	for(; element_iter; element_iter = element_iter->next){
-		if(element_iter->separate){
-			if(element_iter == element)
+	for (; element_iter; element_iter = element_iter->next) {
+		if (element_iter->separate) {
+			if (element_iter == element)
 				continue;
-			if(stitch_check_uvs_state_stitchable(element, element_iter, state)){
-				if((element_iter->island == state->static_island) || (element->island == state->static_island)){
+			if (stitch_check_uvs_state_stitchable(element, element_iter, state)) {
+				if ((element_iter->island == state->static_island) || (element->island == state->static_island)) {
 					element->flag |= STITCH_STITCHABLE;
 					preview->num_stitchable++;
-					stitch_setup_face_preview_for_uv_group(element, state, island_stitch_data);
+					stitch_setup_face_preview_for_uv_group(element, state, island_stitch_data, preview_position);
 					return;
 				}
 			}
@@ -556,7 +573,7 @@ static void stitch_validate_stichability(UvElement *element, StitchState *state,
 	}
 
 	/* this can happen if the uvs to be stitched are not on a stitchable island */
-	if(!(element->flag & STITCH_STITCHABLE)){
+	if (!(element->flag & STITCH_STITCHABLE)) {
 		preview->num_unstitchable++;
 	}
 }
@@ -568,58 +585,61 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final)
 	StitchPreviewer *preview;
 	IslandStitchData *island_stitch_data = NULL;
 	int previous_island = state->static_island;
-	EditFace *efa;
-	EditVert *ev;
+	BMFace *efa;
+	BMIter iter;
 	UVVertAverage *final_position;
 	char stitch_midpoints = state->midpoints;
 	/* used to map uv indices to uvaverage indices for selection */
 	unsigned int *uvfinal_map;
+	/* per face preview position in preview buffer */
+	PreviewPosition *preview_position;
 
 	/* cleanup previous preview */
 	stitch_preview_delete();
 	preview = stitch_preview_init();
-	if(preview == NULL)
+	if (preview == NULL)
 		return 0;
+
+	preview_position = MEM_mallocN(state->em->bm->totface * sizeof(*preview_position), "stitch_face_preview_position");
 	/* each face holds its position in the preview buffer in tmp. -1 is uninitialized */
-	for(efa = state->em->faces.first; efa; efa = efa->next){
-		efa->tmp.l = STITCH_NO_PREVIEW;
+	for (i = 0; i < state->em->bm->totface; i++) {
+		preview_position[i].data_position = STITCH_NO_PREVIEW;
 	}
 
-	island_stitch_data = MEM_callocN(sizeof(*island_stitch_data)*state->element_map->totalIslands, "stitch_island_data");
-	if(!island_stitch_data){
+	island_stitch_data = MEM_callocN(sizeof(*island_stitch_data) * state->element_map->totalIslands, "stitch_island_data");
+	if (!island_stitch_data) {
 		return 0;
 	}
 
-	/* store indices to editVerts. */
-	for(ev = state->em->verts.first, i = 0; ev; ev = ev->next, i++){
-		ev->tmp.l = i;
-	}
+	/* store indices to editVerts and Faces. May be unneeded but ensuring anyway */
+	BM_mesh_elem_index_ensure(state->em->bm, BM_VERT | BM_FACE);
 
 	/*****************************************
 	 *  First determine stitchability of uvs *
 	 *****************************************/
 
-	for(i = 0; i < state->selection_size; i++){
+	for (i = 0; i < state->selection_size; i++) {
 		UvElement *element = state->selection_stack[i];
 		determine_uv_stitchability(element, state, island_stitch_data);
 	}
 
 	/* set static island to one that is added for preview */
 	state->static_island %= state->element_map->totalIslands;
-	while(!(island_stitch_data[state->static_island].stitchableCandidate)){
+	while (!(island_stitch_data[state->static_island].stitchableCandidate)) {
 		state->static_island++;
 		state->static_island %= state->element_map->totalIslands;
 		/* this is entirely possible if for example limit stitching with no stitchable verts or no selection */
-		if(state->static_island == previous_island)
+		if (state->static_island == previous_island)
 			break;
 	}
 
-	for(i = 0; i < state->selection_size; i++){
+	for (i = 0; i < state->selection_size; i++) {
 		UvElement *element = state->selection_stack[i];
-		if(element->flag & STITCH_STITCHABLE_CANDIDATE){
+		if (element->flag & STITCH_STITCHABLE_CANDIDATE) {
 			element->flag &= ~STITCH_STITCHABLE_CANDIDATE;
-			stitch_validate_stichability(element, state, island_stitch_data);
-		}else{
+			stitch_validate_stichability(element, state, island_stitch_data, preview_position);
+		}
+		else {
 			/* add to preview for unstitchable */
 			preview->num_unstitchable++;
 		}
@@ -628,15 +648,15 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final)
 	/*****************************************
 	 *  Setup preview for stitchable islands *
 	 *****************************************/
-	if(state->snap_islands){
-		for(i = 0; i <  state->element_map->totalIslands; i++){
-			if(island_stitch_data[i].addedForPreview){
+	if (state->snap_islands) {
+		for (i = 0; i <  state->element_map->totalIslands; i++) {
+			if (island_stitch_data[i].addedForPreview) {
 				int numOfIslandUVs = 0, j;
 				UvElement *element;
 				numOfIslandUVs = getNumOfIslandUvs(state->element_map, i);
 				element = &state->element_map->buf[state->element_map->islandIndices[i]];
-				for(j = 0; j < numOfIslandUVs; j++, element++){
-					stitch_set_face_preview_buffer_position(element->face, preview);
+				for (j = 0; j < numOfIslandUVs; j++, element++) {
+					stitch_set_face_preview_buffer_position(element->face, preview, preview_position);
 				}
 			}
 		}
@@ -645,71 +665,83 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final)
 	/*********************************************************************
 	 * Setup the preview buffers and fill them with the appropriate data *
 	 *********************************************************************/
-	if(!final){
-		unsigned int tricount = 0, quadcount = 0;
+	if (!final) {
+		BMIter liter;
+		BMLoop *l;
+		MLoopUV *luv;
+		unsigned int buffer_index = 0;
 		int stitchBufferIndex = 0, unstitchBufferIndex = 0;
 		/* initialize the preview buffers */
-		preview->preview_quads = (float *)MEM_mallocN(preview->num_quads*sizeof(float)*8, "quad_uv_stitch_prev");
-		preview->preview_tris = (float *)MEM_mallocN(preview->num_tris*sizeof(float)*6, "tri_uv_stitch_prev");
+		preview->preview_polys = (float *)MEM_mallocN(preview->preview_uvs * sizeof(float) * 2, "tri_uv_stitch_prev");
+		preview->uvs_per_polygon = MEM_mallocN(preview->num_polys * sizeof(*preview->uvs_per_polygon), "tri_uv_stitch_prev");
+		preview->preview_stitchable = (float *)MEM_mallocN(preview->num_stitchable * sizeof(float) * 2, "stitch_preview_stichable_data");
+		preview->preview_unstitchable = (float *)MEM_mallocN(preview->num_unstitchable * sizeof(float) * 2, "stitch_preview_unstichable_data");
 
-		preview->preview_stitchable = (float *)MEM_mallocN(preview->num_stitchable*sizeof(float)*2, "stitch_preview_stichable_data");
-		preview->preview_unstitchable = (float *)MEM_mallocN(preview->num_unstitchable*sizeof(float)*2, "stitch_preview_unstichable_data");
+		preview->static_tris = (float *)MEM_mallocN(state->tris_per_island[state->static_island] * sizeof(float) * 6, "static_island_preview_tris");
 
-		preview->static_quads = (float *)MEM_mallocN(state->quads_per_island[state->static_island]*sizeof(float)*8, "static_island_preview_quads");
-		preview->static_tris = (float *)MEM_mallocN(state->tris_per_island[state->static_island]*sizeof(float)*6, "static_island_preview_tris");
-
-		preview->num_static_quads = state->quads_per_island[state->static_island];
 		preview->num_static_tris = state->tris_per_island[state->static_island];
 		/* will cause cancel and freeing of all data structures so OK */
-		if(!preview->preview_quads || !preview->preview_tris || !preview->preview_stitchable || !preview->preview_unstitchable){
+		if (!preview->preview_polys || !preview->preview_stitchable || !preview->preview_unstitchable) {
 			return 0;
 		}
 
 		/* copy data from MTFaces to the preview display buffers */
-		for(efa = state->em->faces.first; efa; efa = efa->next){
-			MTFace *mt = CustomData_em_get(&state->em->fdata, efa->data, CD_MTFACE);
-			UvElement *element = ED_get_uv_element(state->element_map, efa, 0);
-
-			if(element){
-				if(efa->tmp.l != STITCH_NO_PREVIEW){
-					if(efa->v4) {
-						memcpy(preview->preview_quads+efa->tmp.l, &mt->uv[0][0], 8*sizeof(float));
-					} else {
-						memcpy(preview->preview_tris+efa->tmp.l, &mt->uv[0][0], 6*sizeof(float));
+		BM_ITER_MESH (efa, &iter, state->em->bm, BM_FACES_OF_MESH) {
+			/* just to test if face was added for processing. uvs of inselected vertices will return NULL */
+			UvElement *element = ED_uv_element_get(state->element_map, efa, BM_FACE_FIRST_LOOP(efa));
+
+			if (element) {
+				int numoftris = efa->len - 2;
+				int index = BM_elem_index_get(efa);
+				int face_preview_pos = preview_position[index].data_position;
+				if (face_preview_pos != STITCH_NO_PREVIEW) {
+					preview->uvs_per_polygon[preview_position[index].polycount_position] = efa->len;
+					BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) {
+						luv = CustomData_bmesh_get(&state->em->bm->ldata, l->head.data, CD_MLOOPUV);
+						copy_v2_v2(preview->preview_polys + face_preview_pos + i * 2, luv->uv);
 					}
 				}
 
-				if(element->island == state->static_island){
-					if(efa->v4) {
-						memcpy(preview->static_quads + quadcount*8, &mt->uv[0][0], 8*sizeof(float));
-						quadcount++;
-					} else {
-						memcpy(preview->static_tris + tricount*6, &mt->uv[0][0], 6*sizeof(float));
-						tricount++;
+				if (element->island == state->static_island) {
+					BMLoop *fl = BM_FACE_FIRST_LOOP(efa);
+					MLoopUV *fuv = CustomData_bmesh_get(&state->em->bm->ldata, fl->head.data, CD_MLOOPUV);
+
+					BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) {
+						if (i < numoftris) {
+							/* using next since the first uv is already accounted for */
+							BMLoop *lnext = l->next;
+							MLoopUV *luvnext = CustomData_bmesh_get(&state->em->bm->ldata, lnext->next->head.data, CD_MLOOPUV);
+							luv = CustomData_bmesh_get(&state->em->bm->ldata, lnext->head.data, CD_MLOOPUV);
+
+							memcpy(preview->static_tris + buffer_index, fuv->uv, 2 * sizeof(float));
+							memcpy(preview->static_tris + buffer_index + 2, luv->uv, 2 * sizeof(float));
+							memcpy(preview->static_tris + buffer_index + 4, luvnext->uv, 2 * sizeof(float));
+							buffer_index += 6;
+						}
+						else {
+							break;
+						}
 					}
 				}
 			}
 		}
 
 		/* fill the appropriate preview buffers */
-		for(i = 0; i < state->total_separate_uvs; i++){
+		for (i = 0; i < state->total_separate_uvs; i++) {
 			UvElement *element = (UvElement *)state->uvs[i];
-			if(element->flag & STITCH_STITCHABLE){
-				MTFace *mt;
-				efa = element->face;
-				mt = CustomData_em_get(&state->em->fdata, efa->data, CD_MTFACE);
+			if (element->flag & STITCH_STITCHABLE) {
+				l = element->l;
+				luv = CustomData_bmesh_get(&state->em->bm->ldata, l->head.data, CD_MLOOPUV);
+
+				copy_v2_v2(&preview->preview_stitchable[stitchBufferIndex * 2], luv->uv);
 
-				preview->preview_stitchable[stitchBufferIndex*2] = mt->uv[element->tfindex][0];
-				preview->preview_stitchable[stitchBufferIndex*2 + 1] = mt->uv[element->tfindex][1];
 				stitchBufferIndex++;
 			}
-			else if(element->flag & STITCH_SELECTED){
-				MTFace *mt;
-				efa = element->face;
-				mt = CustomData_em_get(&state->em->fdata, efa->data, CD_MTFACE);
+			else if (element->flag & STITCH_SELECTED) {
+				l = element->l;
+				luv = CustomData_bmesh_get(&state->em->bm->ldata, l->head.data, CD_MLOOPUV);
 
-				preview->preview_unstitchable[unstitchBufferIndex*2] = mt->uv[element->tfindex][0];
-				preview->preview_unstitchable[unstitchBufferIndex*2 + 1] = mt->uv[element->tfindex][1];
+				copy_v2_v2(&preview->preview_unstitchable[unstitchBufferIndex * 2], luv->uv);
 				unstitchBufferIndex++;
 			}
 		}
@@ -719,89 +751,90 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final)
 	 * Here we calculate the final coordinates of the uvs *
 	 ******************************************************/
 
-	final_position = MEM_callocN(state->selection_size*sizeof(*final_position), "stitch_uv_average");
-	uvfinal_map = MEM_mallocN(state->element_map->totalUVs*sizeof(*uvfinal_map), "stitch_uv_final_map");
+	final_position = MEM_callocN(state->selection_size * sizeof(*final_position), "stitch_uv_average");
+	uvfinal_map = MEM_mallocN(state->element_map->totalUVs * sizeof(*uvfinal_map), "stitch_uv_final_map");
 
 	/* first pass, calculate final position for stitchable uvs of the static island */
-	for(i = 0; i < state->selection_size; i++){
+	for (i = 0; i < state->selection_size; i++) {
 		UvElement *element = state->selection_stack[i];
-		if(element->flag & STITCH_STITCHABLE){
-			MTFace *mt;
-
+		if (element->flag & STITCH_STITCHABLE) {
+			BMLoop *l;
+			MLoopUV *luv;
 			UvElement *element_iter;
 
-			uvfinal_map[element - state->element_map->buf] = i;
+			l = element->l;
+			luv = CustomData_bmesh_get(&state->em->bm->ldata, l->head.data, CD_MLOOPUV);
+
 
-			efa = element->face;
-			mt = CustomData_em_get(&state->em->fdata, efa->data, CD_MTFACE);
+			uvfinal_map[element - state->element_map->buf] = i;
 
-			final_position[i].uv[0] = mt->uv[element->tfindex][0];
-			final_position[i].uv[1] = mt->uv[element->tfindex][1];
+			copy_v2_v2(final_position[i].uv, luv->uv);
 			final_position[i].count = 1;
 
-			if(state->snap_islands && element->island == state->static_island && !stitch_midpoints)
+			if (state->snap_islands && element->island == state->static_island && !stitch_midpoints)
 				continue;
 
-			element_iter = state->element_map->vert[(*(&element->face->v1 + element->tfindex))->tmp.l];
+			element_iter = state->element_map->vert[BM_elem_index_get(l->v)];
 
-			for(;element_iter; element_iter = element_iter->next){
-				if(element_iter->separate){
-					if(stitch_check_uvs_state_stitchable(element, element_iter, state)){
-						efa = element_iter->face;
-						mt = CustomData_em_get(&state->em->fdata, efa->data, CD_MTFACE);
-						if(stitch_midpoints){
-							final_position[i].uv[0] += mt->uv[element_iter->tfindex][0];
-							final_position[i].uv[1] += mt->uv[element_iter->tfindex][1];
+			for ( ; element_iter; element_iter = element_iter->next) {
+				if (element_iter->separate) {
+					if (stitch_check_uvs_state_stitchable(element, element_iter, state)) {
+						l = element_iter->l;
+						luv = CustomData_bmesh_get(&state->em->bm->ldata, l->head.data, CD_MLOOPUV);
+						if (stitch_midpoints) {
+							add_v2_v2(final_position[i].uv, luv->uv);
 							final_position[i].count++;
-						}else if(element_iter->island == state->static_island){
+						}
+						else if (element_iter->island == state->static_island) {
 							/* if multiple uvs on the static island exist,
 							 * last checked remains. to disambiguate we need to limit or use
 							 * edge stitch */
-							final_position[i].uv[0] = mt->uv[element_iter->tfindex][0];
-							final_position[i].uv[1] = mt->uv[element_iter->tfindex][1];
+							copy_v2_v2(final_position[i].uv, luv->uv);
 						}
 					}
 				}
 			}
 		}
-		if(stitch_midpoints){
+		if (stitch_midpoints) {
 			final_position[i].uv[0] /= final_position[i].count;
 			final_position[i].uv[1] /= final_position[i].count;
 		}
 	}
 
 	/* second pass, calculate island rotation and translation before modifying any uvs */
-	if(state->snap_islands){
-		for(i = 0; i < state->selection_size; i++){
+	if (state->snap_islands) {
+		for (i = 0; i < state->selection_size; i++) {
 			UvElement *element = state->selection_stack[i];
-			if(element->flag & STITCH_STITCHABLE){
-				MTFace *mt;
-				efa = element->face;
-				mt = CustomData_em_get(&state->em->fdata, efa->data, CD_MTFACE);
+			if (element->flag & STITCH_STITCHABLE) {
+				BMLoop *l;
+				MLoopUV *luv;
+
+				l = element->l;
+				luv = CustomData_bmesh_get(&state->em->bm->ldata, l->head.data, CD_MLOOPUV);
 
 				/* accumulate each islands' translation from stitchable elements. it is important to do here
 				 * because in final pass MTFaces get modified and result is zero. */
-				island_stitch_data[element->island].translation[0] += final_position[i].uv[0] - mt->uv[element->tfindex][0];
-				island_stitch_data[element->island].translation[1] += final_position[i].uv[1] - mt->uv[element->tfindex][1];
-				island_stitch_data[element->island].medianPoint[0] += mt->uv[element->tfindex][0];
-				island_stitch_data[element->island].medianPoint[1] += mt->uv[element->tfindex][1];
+				island_stitch_data[element->island].translation[0] += final_position[i].uv[0] - luv->uv[0];
+				island_stitch_data[element->island].translation[1] += final_position[i].uv[1] - luv->uv[1];
+				island_stitch_data[element->island].medianPoint[0] += luv->uv[0];
+				island_stitch_data[element->island].medianPoint[1] += luv->uv[1];
 				island_stitch_data[element->island].numOfElements++;
 			}
 		}
 
 		/* only calculate rotation when an edge has been fully selected */
-		for(i = 0; i < state->total_boundary_edges; i++){
-			UvEdge *edge = state->edges+i;
-			if((state->uvs[edge->uv1]->flag & STITCH_STITCHABLE) && (state->uvs[edge->uv2]->flag & STITCH_STITCHABLE)){
+		for (i = 0; i < state->total_boundary_edges; i++) {
+			UvEdge *edge = state->edges + i;
+			if ((state->uvs[edge->uv1]->flag & STITCH_STITCHABLE) && (state->uvs[edge->uv2]->flag & STITCH_STITCHABLE)) {
 				stitch_island_calculate_edge_rotation(edge, state, final_position, uvfinal_map, island_stitch_data);
 				island_stitch_data[state->uvs[edge->uv1]->island].use_edge_rotation = 1;
 			}
 		}
 
-		for(i = 0; i < state->selection_size; i++){
+		for (i = 0; i < state->selection_size; i++) {
 			UvElement *element = state->selection_stack[i];
-			if(!island_stitch_data[element->island].use_edge_rotation){
-				if(element->flag & STITCH_STITCHABLE){
+			if (!island_stitch_data[element->island].use_edge_rotation) {
+				if (element->flag & STITCH_STITCHABLE) {
 					stitch_island_calculate_vert_rotation(element, state, island_stitch_data);
 				}
 			}
@@ -810,69 +843,71 @@ static int stitch_process_data(StitchState *state, Scene *scene, int final)
 	}
 
 	/* third pass, propagate changes to coincident uvs */
-	for(i = 0; i < state->selection_size; i++){
+	for (i = 0; i < state->selection_size; i++) {
 		UvElement *element = state->selection_stack[i];
-		if(element->flag & STITCH_STITCHABLE){
+		if (element->flag & STITCH_STITCHABLE) {
 			UvElement *element_iter = element;
 			/* propagate to coincident uvs */
-			do{
-				MTFace *mt;
+			do {
+				BMLoop *l;
+				MLoopUV *luv;
 
-				efa = element_iter->face;
-				mt = CustomData_em_get(&state->em->fdata, efa->data, CD_MTFACE);
+				l = element_iter->l;
+				luv = CustomData_bmesh_get(&state->em->bm->ldata, l->head.data, CD_MLOOPUV);
 
 				element_iter->flag |= STITCH_PROCESSED;
 				/* either flush to preview or to the MTFace, if final */
-				if(final){
-					mt->uv[element_iter->tfindex][0] = final_position[i].uv[0];
-					mt->uv[element_iter->tfindex][1] = final_position[i].uv[1];
-
-					uvedit_uv_select(scene, efa, mt, element_iter->tfindex);
-				}else if(efa->tmp.l != STITCH_NO_PREVIEW){
-					if(efa->v4){
-						*(preview->preview_quads+efa->tmp.l + element_iter->tfindex*2) = final_position[i].uv[0];
-						*(preview->preview_quads+efa->tmp.l + element_iter->tfindex*2 + 1) = final_position[i].uv[1];
-					}else{
-						*(preview->preview_tris+efa->tmp.l + element_iter->tfindex*2) = final_position[i].uv[0];
-						*(preview->preview_tris+efa->tmp.l + element_iter->tfindex*2 + 1) = final_position[i].uv[1];
+				if (final) {
+					copy_v2_v2(luv->uv, final_position[i].uv);
+
+					uvedit_uv_select_enable(state->em, scene, l, FALSE);
+				}
+				else {
+					int face_preview_pos = preview_position[BM_elem_index_get(element_iter->face)].data_position;
+					if (face_preview_pos != STITCH_NO_PREVIEW) {
+						copy_v2_v2(preview->preview_polys + face_preview_pos + 2 * element_iter->tfindex,
+						           final_position[i].uv);
 					}
 				}
 
 				/* end of calculations, keep only the selection flag */
-				if( (!state->snap_islands) || ((!stitch_midpoints) && (element_iter->island == state->static_island))) {
+				if ( (!state->snap_islands) || ((!stitch_midpoints) && (element_iter->island == state->static_island))) {
 					element_iter->flag &= STITCH_SELECTED;
 				}
 
 				element_iter = element_iter->next;
-			}while(element_iter && !element_iter->separate);
+			} while (element_iter && !element_iter->separate);
 		}
 	}
 
 	/* final pass, calculate Island translation/rotation if needed */
-	if(state->snap_islands){
-		stitch_calculate_island_snapping(state, preview, island_stitch_data, final);
+	if (state->snap_islands) {
+		stitch_calculate_island_snapping(state, preview_position, preview, island_stitch_data, final);
 	}
 
 	MEM_freeN(final_position);
 	MEM_freeN(uvfinal_map);
 	MEM_freeN(island_stitch_data);
+	MEM_freeN(preview_position);
 
 	return 1;
 }
 
-/* Stitch hash initialisation functions */
-static unsigned int	uv_edge_hash(const void *key){
+/* Stitch hash initialization functions */
+static unsigned int uv_edge_hash(const void *key)
+{
 	UvEdge *edge = (UvEdge *)key;
 	return
-		BLI_ghashutil_inthash(SET_INT_IN_POINTER(edge->uv2)) +
-		BLI_ghashutil_inthash(SET_INT_IN_POINTER(edge->uv1));
+	    BLI_ghashutil_inthash(SET_INT_IN_POINTER(edge->uv2)) +
+	    BLI_ghashutil_inthash(SET_INT_IN_POINTER(edge->uv1));
 }
 
-static int uv_edge_compare(const void *a, const void *b){
+static int uv_edge_compare(const void *a, const void *b)
+{
 	UvEdge *edge1 = (UvEdge *)a;
 	UvEdge *edge2 = (UvEdge *)b;
 
-	if((edge1->uv1 == edge2->uv1) && (edge1->uv2 == edge2->uv2)){
+	if ((edge1->uv1 == edge2->uv1) && (edge1->uv2 == edge2->uv2)) {
 		return 0;
 	}
 	return 1;
@@ -880,60 +915,56 @@ static int uv_edge_compare(const void *a, const void *b){
 
 
 /* Select all common uvs */
-static void stitch_select_uv(UvElement *element, StitchState *stitch_state, int always_select)
+static void stitch_select_uv(UvElement *element, StitchState *state, int always_select)
 {
-	/* This works due to setting of tmp in find nearest uv vert */
+	BMLoop *l;
 	UvElement *element_iter;
-	UvElement **selection_stack = stitch_state->selection_stack;
+	UvElement **selection_stack = state->selection_stack;
+
+	l = element->l;
 
-	element_iter = stitch_state->element_map->vert[(*(&element->face->v1 + element->tfindex))->tmp.l];
+	element_iter = state->element_map->vert[BM_elem_index_get(l->v)];
 	/* first deselect all common uvs */
-	for(; element_iter; element_iter = element_iter->next){
-		if(element_iter->separate){
+	for (; element_iter; element_iter = element_iter->next) {
+		if (element_iter->separate) {
 			/* only separators go to selection */
-			if(element_iter->flag & STITCH_SELECTED){
+			if (element_iter->flag & STITCH_SELECTED) {
 				int i;
-				if(always_select)
+				if (always_select)
 					continue;
 
 				element_iter->flag &= ~STITCH_SELECTED;
-				for(i = 0; i < stitch_state->selection_size; i++){
-					if(selection_stack[i] == element_iter){
-						(stitch_state->selection_size)--;
-						selection_stack[i] = selection_stack[stitch_state->selection_size];
+				for (i = 0; i < state->selection_size; i++) {
+					if (selection_stack[i] == element_iter) {
+						(state->selection_size)--;
+						selection_stack[i] = selection_stack[state->selection_size];
 						break;
 					}
 				}
-			}else{
+			}
+			else {
 				element_iter->flag |= STITCH_SELECTED;
-				selection_stack[(stitch_state->selection_size)++] = element_iter;
+				selection_stack[state->selection_size++] = element_iter;
 			}
 		}
 	}
 }
 
-static void stitch_calculate_edge_normal(EditMesh *em, UvEdge *edge, float *normal)
+static void stitch_calculate_edge_normal(BMEditMesh *em, UvEdge *edge, float *normal)
 {
-	UvElement *element = edge->element;
-	EditFace *efa = element->face;
-	MTFace *mt = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-	int nverts = efa->v4?4 : 3;
-	int index = (element->tfindex + 2)%nverts;
-	float tangent[2], internal[2];
+	BMLoop *l1 = edge->element->l;
+	BMLoop *l2 = l1->next;
+	MLoopUV *luv1, *luv2;
+	float tangent[2];
+
+	luv1 = CustomData_bmesh_get(&em->bm->ldata, l1->head.data, CD_MLOOPUV);
+	luv2 = CustomData_bmesh_get(&em->bm->ldata, l2->head.data, CD_MLOOPUV);
 
-	sub_v2_v2v2(tangent, mt->uv[(element->tfindex + 1)%nverts],  mt->uv[element->tfindex]);
-	sub_v2_v2v2(internal, mt->uv[index],  mt->uv[element->tfindex]);
+	sub_v2_v2v2(tangent, luv2->uv,  luv1->uv);
 
-	/* choose one of the normals */
 	normal[0] = tangent[1];
 	normal[1] = -tangent[0];
 
-	/* if normal points inside the face, invert */
-	if(dot_v2v2(normal, internal) > 0){
-		normal[0] = -tangent[1];
-		normal[1] = tangent[0];
-	}
-
 	normalize_v2(normal);
 }
 
@@ -947,9 +978,11 @@ static int stitch_init(bContext *C, wmOperator *op)
 	/* maps uvelements to their first coincident uv */
 	int *map;
 	int counter = 0, i;
-	EditFace *efa;
-	EditMesh *em;
-	GHashIterator* ghi;
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	BMEditMesh *em;
+	GHashIterator *ghi;
 	UvEdge *all_edges;
 	StitchState *state = MEM_mallocN(sizeof(StitchState), "stitch state");
 	Scene *scene = CTX_data_scene(C);
@@ -959,23 +992,24 @@ static int stitch_init(bContext *C, wmOperator *op)
 
 	op->customdata = state;
 
-	if(!state)
+	if (!state)
 		return 0;
 
 	/* initialize state */
 	state->use_limit = RNA_boolean_get(op->ptr, "use_limit");
 	state->limit_dist = RNA_float_get(op->ptr, "limit");
-	state->em = em = BKE_mesh_get_editmesh((Mesh*)obedit->data);
+	state->em = em = BMEdit_FromObject(obedit);
 	state->snap_islands = RNA_boolean_get(op->ptr, "snap_islands");
 	state->static_island = RNA_int_get(op->ptr, "static_island");
 	state->midpoints = RNA_boolean_get(op->ptr, "midpoint_snap");
 	/* in uv synch selection, all uv's are visible */
-	if(ts->uv_flag & UV_SYNC_SELECTION){
-		state->element_map = EM_make_uv_element_map(state->em, 0, 1);
-	}else{
-		state->element_map = EM_make_uv_element_map(state->em, 1, 1);
+	if (ts->uv_flag & UV_SYNC_SELECTION) {
+		state->element_map = EDBM_uv_element_map_create(state->em, 0, 1);
+	}
+	else {
+		state->element_map = EDBM_uv_element_map_create(state->em, 1, 1);
 	}
-	if(!state->element_map){
+	if (!state->element_map) {
 		stitch_state_delete(state);
 		return 0;
 	}
@@ -985,27 +1019,27 @@ static int stitch_init(bContext *C, wmOperator *op)
 	state->static_island %= state->element_map->totalIslands;
 
 	/* Count 'unique' uvs */
-	for(i = 0; i < state->element_map->totalUVs; i++){
-		if(state->element_map->buf[i].separate){
+	for (i = 0; i < state->element_map->totalUVs; i++) {
+		if (state->element_map->buf[i].separate) {
 			counter++;
 		}
 	}
 
 	/* Allocate the unique uv buffers */
-	state->uvs = MEM_mallocN(sizeof(*state->uvs)*counter, "uv_stitch_unique_uvs");
+	state->uvs = MEM_mallocN(sizeof(*state->uvs) * counter, "uv_stitch_unique_uvs");
 	/* internal uvs need no normals but it is hard and slow to keep a map of
 	 * normals only for boundary uvs, so allocating for all uvs */
-	state->normals = MEM_callocN(sizeof(*state->normals)*counter*2, "uv_stitch_normals");
+	state->normals = MEM_callocN(sizeof(*state->normals) * counter * 2, "uv_stitch_normals");
 	state->total_separate_uvs = counter;
 	/* we can at most have totalUVs edges or uvs selected. Actually they are less, considering we store only
 	 * unique uvs for processing but I am accounting for all bizarre cases, especially for edges, this way */
-	state->selection_stack = MEM_mallocN(sizeof(*state->selection_stack)*counter, "uv_stitch_selection_stack");
-	state->map = map = MEM_mallocN(sizeof(*map)*state->element_map->totalUVs, "uv_stitch_unique_map");
+	state->selection_stack = MEM_mallocN(sizeof(*state->selection_stack) * counter, "uv_stitch_selection_stack");
+	state->map = map = MEM_mallocN(sizeof(*map) * state->element_map->totalUVs, "uv_stitch_unique_map");
 	/* Allocate the edge stack */
 	edgeHash = BLI_ghash_new(uv_edge_hash, uv_edge_compare, "stitch_edge_hash");
-	all_edges = MEM_mallocN(sizeof(*all_edges)*state->element_map->totalUVs, "stitch_all_edges");
+	all_edges = MEM_mallocN(sizeof(*all_edges) * state->element_map->totalUVs, "stitch_all_edges");
 
-	if(!state->selection_stack || !state->uvs || !map || !edgeHash || !all_edges){
+	if (!state->selection_stack || !state->uvs || !map || !edgeHash || !all_edges) {
 		stitch_state_delete(state);
 		return 0;
 	}
@@ -1013,10 +1047,10 @@ static int stitch_init(bContext *C, wmOperator *op)
 	/* So that we can use this as index for the UvElements */
 	counter = -1;
 	/* initialize the unique UVs and map */
-	for(i = 0; i < state->em->totvert; i++){
+	for (i = 0; i < em->bm->totvert; i++) {
 		UvElement *element = state->element_map->vert[i];
-		for(; element; element = element->next){
-			if(element->separate){
+		for (; element; element = element->next) {
+			if (element->separate) {
 				counter++;
 				state->uvs[counter] = element;
 			}
@@ -1025,42 +1059,42 @@ static int stitch_init(bContext *C, wmOperator *op)
 		}
 	}
 
+	counter = 0;
 	/* Now, on to generate our uv connectivity data */
-	for(efa = state->em->faces.first, counter = 0; efa; efa = efa->next){
-		if((ts->uv_flag & UV_SYNC_SELECTION) || (!efa->h && efa->f & SELECT)){
-			int nverts = efa->v4 ? 4 : 3;
-
-			for(i = 0; i < nverts; i++){
-				UvElement *element = ED_get_uv_element(state->element_map, efa, i);
-				int offset1, itmp1 = element - state->element_map->buf;
-				int offset2, itmp2 = ED_get_uv_element(state->element_map, efa, (i+1)%nverts) - state->element_map->buf;
-
-				offset1 = map[itmp1];
-				offset2 = map[itmp2];
-
-				all_edges[counter].flag = 0;
-				all_edges[counter].element = element;
-				/* using an order policy, sort uvs according to address space. This avoids
-				 * Having two different UvEdges with the same uvs on different positions  */
-				if(offset1 < offset2){
-					all_edges[counter].uv1 = offset1;
-					all_edges[counter].uv2 = offset2;
-				}
-				else{
-					all_edges[counter].uv1 = offset2;
-					all_edges[counter].uv2 = offset1;
-				}
+	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+		if (!(ts->uv_flag & UV_SYNC_SELECTION) && ((BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) || !BM_elem_flag_test(efa, BM_ELEM_SELECT)))
+			continue;
+
+		BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+			UvElement *element = ED_uv_element_get(state->element_map, efa, l);
+			int offset1, itmp1 = element - state->element_map->buf;
+			int offset2, itmp2 = ED_uv_element_get(state->element_map, efa, l->next) - state->element_map->buf;
+
+			offset1 = map[itmp1];
+			offset2 = map[itmp2];
+
+			all_edges[counter].flag = 0;
+			all_edges[counter].element = element;
+			/* using an order policy, sort uvs according to address space. This avoids
+			 * Having two different UvEdges with the same uvs on different positions  */
+			if (offset1 < offset2) {
+				all_edges[counter].uv1 = offset1;
+				all_edges[counter].uv2 = offset2;
+			}
+			else {
+				all_edges[counter].uv1 = offset2;
+				all_edges[counter].uv2 = offset1;
+			}
 
-				if(BLI_ghash_haskey(edgeHash, &all_edges[counter])){
-					char *flag = BLI_ghash_lookup(edgeHash, &all_edges[counter]);
-					*flag = 0;
-				}
-				else{
-					BLI_ghash_insert(edgeHash, &all_edges[counter], &(all_edges[counter].flag));
-					all_edges[counter].flag = STITCH_BOUNDARY;
-				}
-				counter++;
+			if (BLI_ghash_haskey(edgeHash, &all_edges[counter])) {
+				char *flag = BLI_ghash_lookup(edgeHash, &all_edges[counter]);
+				*flag = 0;
+			}
+			else {
+				BLI_ghash_insert(edgeHash, &all_edges[counter], &(all_edges[counter].flag));
+				all_edges[counter].flag = STITCH_BOUNDARY;
 			}
+			counter++;
 		}
 	}
 
@@ -1068,14 +1102,14 @@ static int stitch_init(bContext *C, wmOperator *op)
 	ghi = BLI_ghashIterator_new(edgeHash);
 	total_edges = 0;
 	/* fill the edges with data */
-	for(; !BLI_ghashIterator_isDone(ghi); BLI_ghashIterator_step(ghi)){
+	for (; !BLI_ghashIterator_isDone(ghi); BLI_ghashIterator_step(ghi)) {
 		UvEdge *edge = ((UvEdge *)BLI_ghashIterator_getKey(ghi));
-		if(edge->flag & STITCH_BOUNDARY){
+		if (edge->flag & STITCH_BOUNDARY) {
 			total_edges++;
 		}
 	}
-	state->edges = edges = MEM_mallocN(sizeof(*edges)*total_edges, "stitch_edges");
-	if(!ghi || !edges){
+	state->edges = edges = MEM_mallocN(sizeof(*edges) * total_edges, "stitch_edges");
+	if (!ghi || !edges) {
 		MEM_freeN(all_edges);
 		stitch_state_delete(state);
 		return 0;
@@ -1084,9 +1118,9 @@ static int stitch_init(bContext *C, wmOperator *op)
 	state->total_boundary_edges = total_edges;
 
 	/* fill the edges with data */
-	for(i = 0, BLI_ghashIterator_init(ghi, edgeHash); !BLI_ghashIterator_isDone(ghi); BLI_ghashIterator_step(ghi)){
+	for (i = 0, BLI_ghashIterator_init(ghi, edgeHash); !BLI_ghashIterator_isDone(ghi); BLI_ghashIterator_step(ghi)) {
 		UvEdge *edge = ((UvEdge *)BLI_ghashIterator_getKey(ghi));
-		if(edge->flag & STITCH_BOUNDARY){
+		if (edge->flag & STITCH_BOUNDARY) {
 			edges[i++] = *((UvEdge *)BLI_ghashIterator_getKey(ghi));
 		}
 	}
@@ -1105,15 +1139,15 @@ static int stitch_init(bContext *C, wmOperator *op)
 	 * a point "inside" the island, that can be provided by
 	 * the opposite uv for a quad, or the next uv for a triangle. */
 
-	for(i = 0; i < total_edges; i++){
+	for (i = 0; i < total_edges; i++) {
 		float normal[2];
 		stitch_calculate_edge_normal(em, edges + i, normal);
 
-		add_v2_v2(state->normals + edges[i].uv1*2, normal);
-		add_v2_v2(state->normals + edges[i].uv2*2, normal);
+		add_v2_v2(state->normals + edges[i].uv1 * 2, normal);
+		add_v2_v2(state->normals + edges[i].uv2 * 2, normal);
 
-		normalize_v2(state->normals + edges[i].uv1*2);
-		normalize_v2(state->normals + edges[i].uv2*2);
+		normalize_v2(state->normals + edges[i].uv1 * 2);
+		normalize_v2(state->normals + edges[i].uv2 * 2);
 	}
 
 
@@ -1122,67 +1156,56 @@ static int stitch_init(bContext *C, wmOperator *op)
 	state->selection_size = 0;
 
 	/* Load old selection if redoing operator with different settings */
-	if(RNA_struct_property_is_set(op->ptr, "selection")){
+	if (RNA_struct_property_is_set(op->ptr, "selection")) {
 		int faceIndex, elementIndex;
 		UvElement *element;
 
-		EM_init_index_arrays(em, 0, 0, 1);
-
+		EDBM_index_arrays_init(em, 0, 0, 1);
 
-			RNA_BEGIN(op->ptr, itemptr, "selection") {
-				faceIndex = RNA_int_get(&itemptr, "face_index");
-				elementIndex = RNA_int_get(&itemptr, "element_index");
-				efa = EM_get_face_for_index(faceIndex);
-				element = ED_get_uv_element(state->element_map, efa, elementIndex);
-				stitch_select_uv(element, state, 1);
-			}
-			RNA_END;
+		RNA_BEGIN(op->ptr, itemptr, "selection") {
+			faceIndex = RNA_int_get(&itemptr, "face_index");
+			elementIndex = RNA_int_get(&itemptr, "element_index");
+			efa = EDBM_face_at_index(em, faceIndex);
+			element = ED_uv_element_get(state->element_map, efa, BM_iter_at_index(NULL, BM_LOOPS_OF_FACE, efa, elementIndex));
+			stitch_select_uv(element, state, 1);
+		}
+		RNA_END;
 
-		EM_free_index_arrays();
+		EDBM_index_arrays_free(em);
 		/* Clear the selection */
 		RNA_collection_clear(op->ptr, "selection");
 
-	} else {
-		for(efa = state->em->faces.first ; efa; efa = efa->next){
-			int numOfVerts;
-			MTFace *mt;
-			mt = CustomData_em_get(&state->em->fdata, efa->data, CD_MTFACE);
-			numOfVerts = efa->v4 ? 4 : 3;
-
-			for(i = 0; i < numOfVerts; i++){
-				if(uvedit_uv_selected(scene, efa, mt, i)){
-					UvElement *element = ED_get_uv_element(state->element_map, efa, i);
+	}
+	else {
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			i = 0;
+			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+				if (uvedit_uv_select_test(em, scene, l)) {
+					UvElement *element = ED_uv_element_get(state->element_map, efa, l);
 					stitch_select_uv(element, state, 1);
 				}
+				i++;
 			}
 		}
 	}
 
-	/***** initialise static island preview data *****/
+	/***** initialize static island preview data *****/
 
-	state->quads_per_island = MEM_mallocN(sizeof(*state->quads_per_island)*state->element_map->totalIslands,
-			"stitch island quads");
-	state->tris_per_island = MEM_mallocN(sizeof(*state->tris_per_island)*state->element_map->totalIslands,
-			"stitch island tris");
-	for(i = 0; i < state->element_map->totalIslands; i++){
-		state->quads_per_island[i] = 0;
+	state->tris_per_island = MEM_mallocN(sizeof(*state->tris_per_island) * state->element_map->totalIslands,
+	                                     "stitch island tris");
+	for (i = 0; i < state->element_map->totalIslands; i++) {
 		state->tris_per_island[i] = 0;
 	}
 
-	for(efa = state->em->faces.first; efa; efa = efa->next){
-		UvElement *element = ED_get_uv_element(state->element_map, efa, 0);
+	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+		UvElement *element = ED_uv_element_get(state->element_map, efa, BM_FACE_FIRST_LOOP(efa));
 
-		if(element){
-			if(efa->v4){
-				state->quads_per_island[element->island]++;
-			}
-			else {
-				state->tris_per_island[element->island]++;
-			}
+		if (element) {
+			state->tris_per_island[element->island] += (efa->len > 2) ? efa->len - 2 : 0;
 		}
 	}
 
-	if(!stitch_process_data(state, scene, 0)){
+	if (!stitch_process_data(state, scene, 0)) {
 		stitch_state_delete(state);
 		return 0;
 	}
@@ -1194,11 +1217,11 @@ static int stitch_init(bContext *C, wmOperator *op)
 static int stitch_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
 	Object *obedit = CTX_data_edit_object(C);
-	if(!stitch_init(C, op))
+	if (!stitch_init(C, op))
 		return OPERATOR_CANCELLED;
 
 	WM_event_add_modal_handler(C, op);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 	return OPERATOR_RUNNING_MODAL;
 }
 
@@ -1207,17 +1230,16 @@ static void stitch_exit(bContext *C, wmOperator *op, int finished)
 	StitchState *stitch_state;
 	Scene *scene;
 	SpaceImage *sima;
-	ScrArea *sa= CTX_wm_area(C);
+	ScrArea *sa = CTX_wm_area(C);
 	Object *obedit;
 
-	scene= CTX_data_scene(C);
-	obedit= CTX_data_edit_object(C);
-	sima= CTX_wm_space_image(C);
+	scene = CTX_data_scene(C);
+	obedit = CTX_data_edit_object(C);
+	sima = CTX_wm_space_image(C);
 
 	stitch_state = (StitchState *)op->customdata;
 
-	if(finished){
-		EditFace *efa;
+	if (finished) {
 		int i;
 
 		RNA_float_set(op->ptr, "limit", stitch_state->limit_dist);
@@ -1226,18 +1248,15 @@ static void stitch_exit(bContext *C, wmOperator *op, int finished)
 		RNA_int_set(op->ptr, "static_island", stitch_state->static_island);
 		RNA_boolean_set(op->ptr, "midpoint_snap", stitch_state->midpoints);
 
-		for(i = 0, efa = stitch_state->em->faces.first; efa; efa = efa->next, i++){
-			efa->tmp.l = i;
-		}
-
 		/* Store selection for re-execution of stitch */
-		for(i = 0; i < stitch_state->selection_size; i++){
+		for (i = 0; i < stitch_state->selection_size; i++) {
 			PointerRNA itemptr;
 			UvElement *element = stitch_state->selection_stack[i];
 
 			RNA_collection_add(op->ptr, "selection", &itemptr);
 
-			RNA_int_set(&itemptr, "face_index", element->face->tmp.l);
+			RNA_int_set(&itemptr, "face_index", BM_elem_index_get(element->face));
+
 			RNA_int_set(&itemptr, "element_index", element->tfindex);
 		}
 
@@ -1245,12 +1264,11 @@ static void stitch_exit(bContext *C, wmOperator *op, int finished)
 		uvedit_live_unwrap_update(sima, scene, obedit);
 	}
 
-	if(sa)
+	if (sa)
 		ED_area_headerprint(sa, NULL);
 
 	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-	BKE_mesh_end_editmesh(obedit->data, stitch_state->em);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 
 	stitch_state_delete(stitch_state);
 	op->customdata = NULL;
@@ -1270,34 +1288,35 @@ static int stitch_exec(bContext *C, wmOperator *op)
 {
 	Scene *scene = CTX_data_scene(C);
 
-	if(!stitch_init(C, op))
+	if (!stitch_init(C, op))
 		return OPERATOR_CANCELLED;
-	if(stitch_process_data((StitchState *)op->customdata, scene, 1)){
+	if (stitch_process_data((StitchState *)op->customdata, scene, 1)) {
 		stitch_exit(C, op, 1);
 		return OPERATOR_FINISHED;
-	}else {
+	}
+	else {
 		return stitch_cancel(C, op);
 	}
 }
 
-static void stitch_select(bContext *C, Scene *scene, wmEvent *event, StitchState *stitch_state){
+static void stitch_select(bContext *C, Scene *scene, wmEvent *event, StitchState *stitch_state)
+{
 	/* add uv under mouse to processed uv's */
 	float co[2];
 	NearestHit hit;
-	ARegion *ar= CTX_wm_region(C);
-	Image *ima= CTX_data_edit_image(C);
+	ARegion *ar = CTX_wm_region(C);
+	Image *ima = CTX_data_edit_image(C);
 
 	UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
 	uv_find_nearest_vert(scene, ima, stitch_state->em, co, NULL, &hit);
 
-	if(hit.efa)
-	{
+	if (hit.efa) {
 		/* Add vertex to selection, deselect all common uv's of vert other
 		 * than selected and update the preview. This behavior was decided so that
 		 * you can do stuff like deselect the opposite stitchable vertex and the initial still gets deselected */
 
 		/* This works due to setting of tmp in find nearest uv vert */
-		UvElement *element = ED_get_uv_element(stitch_state->element_map, hit.efa, hit.uv);
+		UvElement *element = ED_uv_element_get(stitch_state->element_map, hit.efa, hit.l);
 		stitch_select_uv(element, stitch_state, 0);
 
 	}
@@ -1310,7 +1329,7 @@ static int stitch_modal(bContext *C, wmOperator *op, wmEvent *event)
 
 	stitch_state = (StitchState *)op->customdata;
 
-	switch(event->type){
+	switch (event->type) {
 		case MIDDLEMOUSE:
 			return OPERATOR_PASS_THROUGH;
 
@@ -1320,11 +1339,11 @@ static int stitch_modal(bContext *C, wmOperator *op, wmEvent *event)
 
 
 		case LEFTMOUSE:
-			if(event->shift && (U.flag & USER_LMOUSESELECT)){
-				if(event->val == KM_RELEASE){
+			if (event->shift && (U.flag & USER_LMOUSESELECT)) {
+				if (event->val == KM_RELEASE) {
 					stitch_select(C, scene, event, stitch_state);
 
-					if(!stitch_process_data(stitch_state, scene, 0)){
+					if (!stitch_process_data(stitch_state, scene, 0)) {
 						return stitch_cancel(C, op);
 					}
 				}
@@ -1332,7 +1351,7 @@ static int stitch_modal(bContext *C, wmOperator *op, wmEvent *event)
 			}
 		case PADENTER:
 		case RETKEY:
-			if(stitch_process_data(stitch_state, scene, 1)){
+			if (stitch_process_data(stitch_state, scene, 1)) {
 				stitch_exit(C, op, 1);
 				return OPERATOR_FINISHED;
 			}
@@ -1343,35 +1362,36 @@ static int stitch_modal(bContext *C, wmOperator *op, wmEvent *event)
 		/* Increase limit */
 		case PADPLUSKEY:
 		case WHEELUPMOUSE:
-			if(event->alt){
+			if (event->alt) {
 				stitch_state->limit_dist += 0.01;
-				if(!stitch_process_data(stitch_state, scene, 0)){
+				if (!stitch_process_data(stitch_state, scene, 0)) {
 					return stitch_cancel(C, op);
 				}
 				break;
 			}
-			else{
+			else {
 				return OPERATOR_PASS_THROUGH;
 			}
 		/* Decrease limit */
 		case PADMINUS:
 		case WHEELDOWNMOUSE:
-			if(event->alt){
+			if (event->alt) {
 				stitch_state->limit_dist -= 0.01;
 				stitch_state->limit_dist = MAX2(0.01, stitch_state->limit_dist);
-				if(!stitch_process_data(stitch_state, scene, 0)){
+				if (!stitch_process_data(stitch_state, scene, 0)) {
 					return stitch_cancel(C, op);
 				}
 				break;
-			}else{
+			}
+			else {
 				return OPERATOR_PASS_THROUGH;
 			}
 
 		/* Use Limit (Default off)*/
 		case LKEY:
-			if(event->val == KM_PRESS){
+			if (event->val == KM_PRESS) {
 				stitch_state->use_limit = !stitch_state->use_limit;
-				if(!stitch_process_data(stitch_state, scene, 0)){
+				if (!stitch_process_data(stitch_state, scene, 0)) {
 					return stitch_cancel(C, op);
 				}
 				break;
@@ -1379,11 +1399,11 @@ static int stitch_modal(bContext *C, wmOperator *op, wmEvent *event)
 			return OPERATOR_RUNNING_MODAL;
 
 		case IKEY:
-			if(event->val == KM_PRESS){
+			if (event->val == KM_PRESS) {
 				stitch_state->static_island++;
 				stitch_state->static_island %= stitch_state->element_map->totalIslands;
 
-				if(!stitch_process_data(stitch_state, scene, 0)){
+				if (!stitch_process_data(stitch_state, scene, 0)) {
 					return stitch_cancel(C, op);
 				}
 				break;
@@ -1391,9 +1411,9 @@ static int stitch_modal(bContext *C, wmOperator *op, wmEvent *event)
 			return OPERATOR_RUNNING_MODAL;
 
 		case MKEY:
-			if(event->val == KM_PRESS){
+			if (event->val == KM_PRESS) {
 				stitch_state->midpoints = !stitch_state->midpoints;
-				if(!stitch_process_data(stitch_state, scene, 0)){
+				if (!stitch_process_data(stitch_state, scene, 0)) {
 					return stitch_cancel(C, op);
 				}
 			}
@@ -1401,13 +1421,13 @@ static int stitch_modal(bContext *C, wmOperator *op, wmEvent *event)
 
 		/* Select geometry*/
 		case RIGHTMOUSE:
-			if(!event->shift){
-					return stitch_cancel(C, op);
+			if (!event->shift) {
+				return stitch_cancel(C, op);
 			}
-			if(event->val == KM_RELEASE && !(U.flag & USER_LMOUSESELECT)){
+			if (event->val == KM_RELEASE && !(U.flag & USER_LMOUSESELECT)) {
 				stitch_select(C, scene, event, stitch_state);
 
-				if(!stitch_process_data(stitch_state, scene, 0)){
+				if (!stitch_process_data(stitch_state, scene, 0)) {
 					return stitch_cancel(C, op);
 				}
 				break;
@@ -1416,14 +1436,16 @@ static int stitch_modal(bContext *C, wmOperator *op, wmEvent *event)
 
 		/* snap islands on/off */
 		case SKEY:
-			if(event->val == KM_PRESS){
+			if (event->val == KM_PRESS) {
 				stitch_state->snap_islands = !stitch_state->snap_islands;
-				if(!stitch_process_data(stitch_state, scene, 0)){
+				if (!stitch_process_data(stitch_state, scene, 0)) {
 					return stitch_cancel(C, op);
 				}
 				break;
-			} else
-			return OPERATOR_RUNNING_MODAL;
+			}
+			else {
+				return OPERATOR_RUNNING_MODAL;
+			}
 
 		default:
 			return OPERATOR_RUNNING_MODAL;
@@ -1443,29 +1465,27 @@ void UV_OT_stitch(wmOperatorType *ot)
 	ot->name = "Stitch";
 	ot->description = "Stitch selected UV vertices by proximity";
 	ot->idname = "UV_OT_stitch";
-	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* api callbacks */
 	ot->invoke = stitch_invoke;
 	ot->modal = stitch_modal;
 	ot->exec = stitch_exec;
 	ot->cancel = stitch_cancel;
-	ot->poll= ED_operator_uvedit;
+	ot->poll = ED_operator_uvedit;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "use_limit", 0, "Use Limit", "Stitch UVs within a specified limit distance");
 	RNA_def_boolean(ot->srna, "snap_islands", 1, "Snap Islands",
-	                          "Snap islands together (on edge stitch mode, rotates the islands too)");
+	                "Snap islands together (on edge stitch mode, rotates the islands too)");
 
 	RNA_def_float(ot->srna, "limit", 0.01f, 0.0f, FLT_MAX, "Limit",
-	                        "Limit distance in normalized coordinates", 0.0, FLT_MAX);
+	              "Limit distance in normalized coordinates", 0.0, FLT_MAX);
 	RNA_def_int(ot->srna, "static_island", 0, 0, INT_MAX, "Static Island",
-	                      "Island that stays in place when stitching islands", 0, INT_MAX);
+	            "Island that stays in place when stitching islands", 0, INT_MAX);
 	RNA_def_boolean(ot->srna, "midpoint_snap", 0, "Snap At Midpoint",
-	                          "UVs are stitched at midpoint instead of at static island");
+	                "UVs are stitched at midpoint instead of at static island");
 	prop = RNA_def_collection_runtime(ot->srna, "selection", &RNA_SelectedUvElement, "Selection", "");
 	/* Selection should not be editable or viewed in toolbar */
 	RNA_def_property_flag(prop, PROP_HIDDEN);
 }
-
-
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index f356963..2a9d472 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -37,16 +37,18 @@
 #include "MEM_guardedalloc.h"
 
 #include "DNA_camera_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_modifier_types.h"
 
+#include "BLI_utildefines.h"
 #include "BLI_math.h"
 #include "BLI_edgehash.h"
-#include "BLI_editVert.h"
 #include "BLI_uvproject.h"
 #include "BLI_utildefines.h"
+#include "BLI_rand.h"
 #include "BLI_string.h"
 
 #include "BKE_cdderivedmesh.h"
@@ -58,6 +60,13 @@
 #include "BKE_main.h"
 #include "BKE_mesh.h"
 #include "BKE_report.h"
+#include "BKE_tessmesh.h"
+
+#include "BLI_math.h"
+#include "BLI_edgehash.h"
+#include "BLI_scanfill.h"
+#include "BLI_array.h"
+#include "BLI_uvproject.h"
 
 #include "PIL_time.h"
 
@@ -79,44 +88,45 @@
 
 static int ED_uvedit_ensure_uvs(bContext *C, Scene *scene, Object *obedit)
 {
-	Main *bmain= CTX_data_main(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	EditFace *efa;
-	MTFace *tf;
+	Main *bmain = CTX_data_main(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMFace *efa;
+	BMIter iter;
 	Image *ima;
 	bScreen *sc;
 	ScrArea *sa;
 	SpaceLink *slink;
 	SpaceImage *sima;
 
-	if(ED_uvedit_test(obedit)) {
-		BKE_mesh_end_editmesh(obedit->data, em);
+	if (ED_uvedit_test(obedit)) {
 		return 1;
 	}
 
-	if(em && em->faces.first)
-		EM_add_data_layer(em, &em->fdata, CD_MTFACE, NULL);
-	
-	if(!ED_uvedit_test(obedit)) {
-		BKE_mesh_end_editmesh(obedit->data, em);
+	if (em && em->bm->totface && !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);
+		ED_mesh_uv_loop_reset_ex(C, obedit->data, 0);
+	}
+
+	if (!ED_uvedit_test(obedit)) {
 		return 0;
 	}
 
-	ima= CTX_data_edit_image(C);
+	ima = CTX_data_edit_image(C);
 
-	if(!ima) {
+	if (!ima) {
 		/* no image in context in the 3d view, we find first image window .. */
-		sc= CTX_wm_screen(C);
+		sc = CTX_wm_screen(C);
 
-		for(sa=sc->areabase.first; sa; sa=sa->next) {
-			slink= sa->spacedata.first;
-			if(slink->spacetype == SPACE_IMAGE) {
-				sima= (SpaceImage*)slink;
+		for (sa = sc->areabase.first; sa; sa = sa->next) {
+			slink = sa->spacedata.first;
+			if (slink->spacetype == SPACE_IMAGE) {
+				sima = (SpaceImage *)slink;
 
-				ima= sima->image;
-				if(ima) {
-					if(ima->type==IMA_TYPE_R_RESULT || ima->type==IMA_TYPE_COMPOSITE)
-						ima= NULL;
+				ima = sima->image;
+				if (ima) {
+					if (ima->type == IMA_TYPE_R_RESULT || ima->type == IMA_TYPE_COMPOSITE)
+						ima = NULL;
 					else
 						break;
 				}
@@ -124,148 +134,188 @@ static int ED_uvedit_ensure_uvs(bContext *C, Scene *scene, Object *obedit)
 		}
 	}
 	
-	if(ima)
+	if (ima)
 		ED_uvedit_assign_image(bmain, scene, obedit, ima, NULL);
 	
 	/* select new UV's */
-	for(efa=em->faces.first; efa; efa=efa->next) {
-		tf= (MTFace *)CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-		uvedit_face_select(scene, efa, tf);
+	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+		uvedit_face_select_enable(scene, em, efa, FALSE);
 	}
 
-	BKE_mesh_end_editmesh(obedit->data, em);
 	return 1;
 }
 
 /****************** Parametrizer Conversion ***************/
 
-static int uvedit_have_selection(Scene *scene, EditMesh *em, short implicit)
+static int uvedit_have_selection(Scene *scene, BMEditMesh *em, short implicit)
 {
-	EditFace *efa;
-	MTFace *tf;
-
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	MLoopUV *luv;
+	
 	/* verify if we have any selected uv's before unwrapping,
-	   so we can cancel the operator early */
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
-			if(efa->h)
+	 * so we can cancel the operator early */
+	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+		if (scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
+			if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN))
 				continue;
 		}
-		else if((efa->h) || ((efa->f & SELECT)==0))
+		else if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN) || !BM_elem_flag_test(efa, BM_ELEM_SELECT))
 			continue;
-
-		tf= (MTFace *)CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
-		if(!tf)
-			return 1; /* default selected if doesn't exists */
+	
+		BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+			luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+			if (!luv)
+				return 1;
+			
+			if (uvedit_uv_select_test(em, scene, l))
+				break;
+		}
 		
-		if(implicit &&
-			!(	uvedit_uv_selected(scene, efa, tf, 0) ||
-				uvedit_uv_selected(scene, efa, tf, 1) ||
-				uvedit_uv_selected(scene, efa, tf, 2) ||
-				(efa->v4 && uvedit_uv_selected(scene, efa, tf, 3)) )
-		) {
+		if (implicit && !l)
 			continue;
-		}
-
+		
 		return 1;
 	}
 
 	return 0;
 }
 
-static ParamHandle *construct_param_handle(Scene *scene, EditMesh *em, short implicit,
-                                           short fill, short sel, short correct_aspect)
+static ParamHandle *construct_param_handle(Scene *scene, BMEditMesh *em, 
+                                           short implicit, short fill, short sel,
+                                           short correct_aspect)
 {
+	ScanFillContext sf_ctx;
 	ParamHandle *handle;
-	EditFace *efa;
-	EditEdge *eed;
-	EditVert *ev;
-	MTFace *tf;
-	int a;
+	BMFace *efa;
+	BMLoop *l;
+	BMEdge *eed;
+	BMIter iter, liter;
+	MTexPoly *tf;
 	
 	handle = param_construct_begin();
 
-	if(correct_aspect) {
-		efa = EM_get_actFace(em, 1);
+	if (correct_aspect) {
+		efa = BM_active_face_get(em->bm, TRUE);
 
-		if(efa) {
+		if (efa) {
 			float aspx, aspy;
-			tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+			tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
 
 			ED_image_uv_aspect(tf->tpage, &aspx, &aspy);
 		
-			if(aspx!=aspy)
+			if (aspx != aspy)
 				param_aspect_ratio(handle, aspx, aspy);
 		}
 	}
 	
 	/* we need the vert indices */
-	for(ev= em->verts.first, a=0; ev; ev= ev->next, a++)
-		ev->tmp.l = a;
+	BM_mesh_elem_index_ensure(em->bm, BM_VERT);
+
+	BLI_srand(0);
 	
-	for(efa= em->faces.first; efa; efa= efa->next) {
+	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+		ScanFillVert *v, *lastv, *firstv;
+		ScanFillFace *sefa;
 		ParamKey key, vkeys[4];
 		ParamBool pin[4], select[4];
+		BMLoop *ls[3];
 		float *co[4];
 		float *uv[4];
-		int nverts;
-		
-		if((efa->h) || (sel && (efa->f & SELECT)==0))
-			continue;
+		int i, lsel;
 
-		tf= (MTFace *)CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-		
-		if(implicit &&
-			!(	uvedit_uv_selected(scene, efa, tf, 0) ||
-				uvedit_uv_selected(scene, efa, tf, 1) ||
-				uvedit_uv_selected(scene, efa, tf, 2) ||
-				(efa->v4 && uvedit_uv_selected(scene, efa, tf, 3)) )
-		) {
+		if ((BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) || (sel && BM_elem_flag_test(efa, BM_ELEM_SELECT) == 0))
 			continue;
+
+		lsel = 0;
+
+		BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+			if (uvedit_uv_select_test(em, scene, l)) {
+				lsel = 1;
+				break;
+			}
 		}
 
+		if (implicit && !lsel)
+			continue;
+
 		key = (ParamKey)efa;
-		vkeys[0] = (ParamKey)efa->v1->tmp.l;
-		vkeys[1] = (ParamKey)efa->v2->tmp.l;
-		vkeys[2] = (ParamKey)efa->v3->tmp.l;
-
-		co[0] = efa->v1->co;
-		co[1] = efa->v2->co;
-		co[2] = efa->v3->co;
-
-		uv[0] = tf->uv[0];
-		uv[1] = tf->uv[1];
-		uv[2] = tf->uv[2];
-
-		pin[0] = ((tf->unwrap & TF_PIN1) != 0);
-		pin[1] = ((tf->unwrap & TF_PIN2) != 0);
-		pin[2] = ((tf->unwrap & TF_PIN3) != 0);
-
-		select[0] = ((uvedit_uv_selected(scene, efa, tf, 0)) != 0);
-		select[1] = ((uvedit_uv_selected(scene, efa, tf, 1)) != 0);
-		select[2] = ((uvedit_uv_selected(scene, efa, tf, 2)) != 0);
-
-		if(efa->v4) {
-			vkeys[3] = (ParamKey)efa->v4->tmp.l;
-			co[3] = efa->v4->co;
-			uv[3] = tf->uv[3];
-			pin[3] = ((tf->unwrap & TF_PIN4) != 0);
-			select[3] = (uvedit_uv_selected(scene, efa, tf, 3) != 0);
-			nverts = 4;
+
+
+		if (efa->len == 3 || efa->len == 4) {
+			/* for quads let parametrize split, it can make better decisions
+			 * about which split is best for unwrapping than scanfill */
+			i = 0;
+			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+				MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+				vkeys[i] = (ParamKey)BM_elem_index_get(l->v);
+				co[i] = l->v->co;
+				uv[i] = luv->uv;
+				pin[i] = (luv->flag & MLOOPUV_PINNED) != 0;
+				select[i] = uvedit_uv_select_test(em, scene, l) != 0;
+
+				i++;
+			}
+
+			param_face_add(handle, key, i, vkeys, co, uv, pin, select);
 		}
-		else
-			nverts = 3;
+		else {
+			/* ngon - scanfill time! */
+			BLI_begin_edgefill(&sf_ctx);
+			
+			firstv = lastv = NULL;
+			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+				int i;
+				
+				v = BLI_addfillvert(&sf_ctx, l->v->co);
+				
+				/* add small random offset */
+				for (i = 0; i < 3; i++) {
+					v->co[i] += (BLI_frand() - 0.5f) * FLT_EPSILON * 50;
+				}
+				
+				v->tmp.p = l;
+
+				if (lastv) {
+					BLI_addfilledge(&sf_ctx, lastv, v);
+				}
+
+				lastv = v;
+				if (!firstv) 
+					firstv = v;
+			}
+
+			BLI_addfilledge(&sf_ctx, firstv, v);
+
+			BLI_edgefill_ex(&sf_ctx, TRUE, efa->no);
+			for (sefa = sf_ctx.fillfacebase.first; sefa; sefa = sefa->next) {
+				ls[0] = sefa->v1->tmp.p;
+				ls[1] = sefa->v2->tmp.p;
+				ls[2] = sefa->v3->tmp.p;
+
+				for (i = 0; i < 3; i++) {
+					MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, ls[i]->head.data, CD_MLOOPUV);
+					vkeys[i] = (ParamKey)BM_elem_index_get(ls[i]->v);
+					co[i] = ls[i]->v->co;
+					uv[i] = luv->uv;
+					pin[i] = (luv->flag & MLOOPUV_PINNED) != 0;
+					select[i] = uvedit_uv_select_test(em, scene, ls[i]) != 0;
+				}
 
-		param_face_add(handle, key, nverts, vkeys, co, uv, pin, select);
+				param_face_add(handle, key, 3, vkeys, co, uv, pin, select);
+			}
+
+			BLI_end_edgefill(&sf_ctx);
+		}
 	}
 
-	if(!implicit) {
-		for(eed= em->edges.first; eed; eed= eed->next) {
-			if(eed->seam) {
+	if (!implicit) {
+		BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) {
+			if (BM_elem_flag_test(eed, BM_ELEM_SEAM)) {
 				ParamKey vkeys[2];
-				vkeys[0] = (ParamKey)eed->v1->tmp.l;
-				vkeys[1] = (ParamKey)eed->v2->tmp.l;
+				vkeys[0] = (ParamKey)BM_elem_index_get(eed->v1);
+				vkeys[1] = (ParamKey)BM_elem_index_get(eed->v2);
 				param_edge_set_seam(handle, vkeys);
 			}
 		}
@@ -277,37 +327,38 @@ static ParamHandle *construct_param_handle(Scene *scene, EditMesh *em, short imp
 }
 
 
-static void texface_from_original_index(EditFace *editFace, MTFace *texFace, int index, float **uv, ParamBool *pin, ParamBool *select, Scene *scene)
+static void texface_from_original_index(BMFace *efa, int index, float **uv, ParamBool *pin, ParamBool *select, Scene *scene, BMEditMesh *em)
 {
-	int i, nverts = (editFace->v4)? 4: 3;
+	BMLoop *l;
+	BMIter liter;
+	MLoopUV *luv;
 
 	*uv = NULL;
 	*pin = 0;
 	*select = 1;
 
-	if(index == ORIGINDEX_NONE)
+	if (index == ORIGINDEX_NONE)
 		return;
 
-	for(i = 0; i < nverts; i++) {
-		if((*(&editFace->v1 + i))->tmp.t == index) {
-			*uv = texFace->uv[i];
-			*pin = ((texFace->unwrap & TF_PIN_MASK(i)) != 0);
-			*select = (uvedit_uv_selected(scene, editFace, texFace, i) != 0);
+	BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+		if (BM_elem_index_get(l->v) == index) {
+			luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+			*uv = luv->uv;
+			*pin = (luv->flag & MLOOPUV_PINNED) ? 1 : 0;
+			*select = (uvedit_uv_select_test(em, scene, l) != 0);
 		}
 	}
 }
 
 /* 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, EditMesh *editMesh, short fill, short sel, short correct_aspect)
+static ParamHandle *construct_param_handle_subsurfed(Scene *scene, BMEditMesh *em, short fill, short sel, short correct_aspect)
 {
 	ParamHandle *handle;
 	/* index pointers */
 	MFace *face;
 	MEdge *edge;
-	EditVert *editVert;
-	EditFace *editFace, **editFaceTmp;
-	EditEdge *editEdge, **editEdgeTmp;
+	BMFace *editFace;
 	int i;
 
 	/* modifier initialization data, will  control what type of subdivision will happen*/
@@ -320,30 +371,27 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, EditMesh *edi
 	MVert *subsurfedVerts;
 	MEdge *subsurfedEdges;
 	MFace *subsurfedFaces;
-	/* MTFace *subsurfedTexfaces; */ /* UNUSED */
 	/* number of vertices and faces for subsurfed mesh*/
 	int numOfEdges, numOfFaces;
 
 	/* holds a map to editfaces for every subsurfed MFace. These will be used to get hidden/ selected flags etc. */
-	EditFace **faceMap;
-	/* Mini container to hold all EditFaces so that they may be indexed easily and fast. */
-	EditFace **editFaceArray;
+	BMFace **faceMap;
 	/* similar to the above, we need a way to map edges to their original ones */
-	EditEdge **edgeMap;
-	EditEdge **editEdgeArray;
+	BMEdge **edgeMap;
 
 	handle = param_construct_begin();
 
-	if(correct_aspect) {
-		EditFace *eface = EM_get_actFace(editMesh, 1);
+	if (correct_aspect) {
+		editFace = BM_active_face_get(em->bm, TRUE);
 
-		if(eface) {
+		if (editFace) {
+			MTexPoly *tf;
 			float aspx, aspy;
-			MTFace *texface= CustomData_em_get(&editMesh->fdata, eface->data, CD_MTFACE);
+			tf = CustomData_bmesh_get(&em->bm->pdata, editFace->head.data, CD_MTEXPOLY);
 
-			ED_image_uv_aspect(texface->tpage, &aspx, &aspy);
-		
-			if(aspx!=aspy)
+			ED_image_uv_aspect(tf->tpage, &aspx, &aspy);
+
+			if (aspx != aspy)
 				param_aspect_ratio(handle, aspx, aspy);
 		}
 	}
@@ -352,82 +400,63 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, EditMesh *edi
 	smd.levels = scene->toolsettings->uv_subsurf_level;
 	smd.subdivType = ME_CC_SUBSURF;
 		
-	initialDerived = CDDM_from_editmesh(editMesh, NULL);
+	initialDerived = CDDM_from_BMEditMesh(em, NULL, 0, 0);
 	derivedMesh = subsurf_make_derived_from_derived(initialDerived, &smd,
-		0, NULL, 0, 0, 1);
+	                                                0, NULL, 0, 0, 1);
 
 	initialDerived->release(initialDerived);
 
 	/* get the derived data */
 	subsurfedVerts = derivedMesh->getVertArray(derivedMesh);
 	subsurfedEdges = derivedMesh->getEdgeArray(derivedMesh);
-	subsurfedFaces = derivedMesh->getFaceArray(derivedMesh);
+	subsurfedFaces = derivedMesh->getTessFaceArray(derivedMesh);
 
 	origVertIndices = derivedMesh->getVertDataArray(derivedMesh, CD_ORIGINDEX);
 	origEdgeIndices = derivedMesh->getEdgeDataArray(derivedMesh, CD_ORIGINDEX);
-	origFaceIndices = derivedMesh->getFaceDataArray(derivedMesh, CD_ORIGINDEX);
-
-	/* subsurfedTexfaces = derivedMesh->getFaceDataArray(derivedMesh, CD_MTFACE); */ /* UNUSED */
+	origFaceIndices = derivedMesh->getTessFaceDataArray(derivedMesh, CD_ORIGINDEX);
 
 	numOfEdges = derivedMesh->getNumEdges(derivedMesh);
-	numOfFaces = derivedMesh->getNumFaces(derivedMesh);
+	numOfFaces = derivedMesh->getNumTessFaces(derivedMesh);
 
-	faceMap = MEM_mallocN(numOfFaces*sizeof(EditFace *), "unwrap_edit_face_map");
-	editFaceArray = MEM_mallocN(editMesh->totface*sizeof(EditFace *), "unwrap_editFaceArray");
+	faceMap = MEM_mallocN(numOfFaces * sizeof(BMFace *), "unwrap_edit_face_map");
 
-	/* fill edit face array with edit faces */
-	for(editFace = editMesh->faces.first, editFaceTmp = editFaceArray; editFace; editFace= editFace->next, editFaceTmp++)
-		*editFaceTmp = editFace;
+	BM_mesh_elem_index_ensure(em->bm, BM_VERT);
+	EDBM_index_arrays_init(em, 0, 1, 1);
 
 	/* map subsurfed faces to original editFaces */
-	for(i = 0; i < numOfFaces; i++)
-		faceMap[i] = editFaceArray[origFaceIndices[i]];
+	for (i = 0; i < numOfFaces; i++)
+		faceMap[i] = EDBM_face_at_index(em, origFaceIndices[i]);
 
-	MEM_freeN(editFaceArray);
-
-	edgeMap = MEM_mallocN(numOfEdges*sizeof(EditEdge *), "unwrap_edit_edge_map");
-	editEdgeArray = MEM_mallocN(editMesh->totedge*sizeof(EditEdge *), "unwrap_editEdgeArray");
-
-	/* fill edit edge array with edit edges */
-	for(editEdge = editMesh->edges.first, editEdgeTmp = editEdgeArray; editEdge; editEdge= editEdge->next, editEdgeTmp++)
-		*editEdgeTmp = editEdge;
+	edgeMap = MEM_mallocN(numOfEdges * sizeof(BMEdge *), "unwrap_edit_edge_map");
 
 	/* map subsurfed edges to original editEdges */
-	for(i = 0; i < numOfEdges; i++) {
+	for (i = 0; i < numOfEdges; i++) {
 		/* not all edges correspond to an old edge */
-		edgeMap[i] = (origEdgeIndices[i] != -1)?
-			editEdgeArray[origEdgeIndices[i]] : NULL;
+		edgeMap[i] = (origEdgeIndices[i] != -1) ?
+		             EDBM_edge_at_index(em, origEdgeIndices[i]) : NULL;
 	}
 
-	MEM_freeN(editEdgeArray);
-
-	/* we need the editvert indices too */
-	for(editVert = editMesh->verts.first, i=0; editVert; editVert = editVert->next, i++)
-		editVert->tmp.t = i;
+	EDBM_index_arrays_free(em);
 
 	/* Prepare and feed faces to the solver */
-	for(i = 0; i < numOfFaces; i++) {
+	for (i = 0; i < numOfFaces; i++) {
 		ParamKey key, vkeys[4];
 		ParamBool pin[4], select[4];
 		float *co[4];
 		float *uv[4];
-		EditFace *origFace = faceMap[i];
-		MTFace *origtexface = (MTFace *)CustomData_em_get(&editMesh->fdata, origFace->data, CD_MTFACE);
+		BMFace *origFace = faceMap[i];
 		
-		face = subsurfedFaces+i;
+		face = subsurfedFaces + i;
 
-		if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
-			if(origFace->h)
+		if (scene->toolsettings->uv_flag & UV_SYNC_SELECTION) {
+			if (BM_elem_flag_test(origFace, BM_ELEM_HIDDEN))
 				continue;
 		}
 		else {
-			if((origFace->h) || (sel && (origFace->f & SELECT)==0))
+			if (BM_elem_flag_test(origFace, BM_ELEM_HIDDEN) || (sel && !BM_elem_flag_test(origFace, BM_ELEM_SELECT)))
 				continue;
 		}
 
-		/* Now we feed the rest of the data from the subsurfed faces */
-		/* texface= subsurfedTexfaces+i; */ /* UNUSED */
-
 		/* We will not check for v4 here. Subsurfed mfaces always have 4 vertices. */
 		key = (ParamKey)face;
 		vkeys[0] = (ParamKey)face->v1;
@@ -442,17 +471,17 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, EditMesh *edi
 		
 		/* This is where all the magic is done. If the vertex exists in the, we pass the original uv pointer to the solver, thus
 		 * flushing the solution to the edit mesh. */
-		texface_from_original_index(origFace, origtexface, origVertIndices[face->v1], &uv[0], &pin[0], &select[0], scene);
-		texface_from_original_index(origFace, origtexface, origVertIndices[face->v2], &uv[1], &pin[1], &select[1], scene);
-		texface_from_original_index(origFace, origtexface, origVertIndices[face->v3], &uv[2], &pin[2], &select[2], scene);
-		texface_from_original_index(origFace, origtexface, origVertIndices[face->v4], &uv[3], &pin[3], &select[3], scene);
+		texface_from_original_index(origFace, origVertIndices[face->v1], &uv[0], &pin[0], &select[0], scene, em);
+		texface_from_original_index(origFace, origVertIndices[face->v2], &uv[1], &pin[1], &select[1], scene, em);
+		texface_from_original_index(origFace, origVertIndices[face->v3], &uv[2], &pin[2], &select[2], scene, em);
+		texface_from_original_index(origFace, origVertIndices[face->v4], &uv[3], &pin[3], &select[3], scene, em);
 
 		param_face_add(handle, key, 4, vkeys, co, uv, pin, select);
 	}
 
 	/* these are calculated from original mesh too */
-	for(edge = subsurfedEdges, i = 0; i < numOfEdges; i++, edge++) {
-		if((edgeMap[i] != NULL) && edgeMap[i]->seam) {
+	for (edge = subsurfedEdges, i = 0; i < numOfEdges; i++, edge++) {
+		if ((edgeMap[i] != NULL) && BM_elem_flag_test(edgeMap[i], BM_ELEM_SEAM)) {
 			ParamKey vkeys[2];
 			vkeys[0] = (ParamKey)edge->v1;
 			vkeys[1] = (ParamKey)edge->v2;
@@ -475,7 +504,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, EditMesh *edi
 typedef struct MinStretch {
 	Scene *scene;
 	Object *obedit;
-	EditMesh *em;
+	BMEditMesh *em;
 	ParamHandle *handle;
 	float blend;
 	double lasttime;
@@ -485,41 +514,40 @@ typedef struct MinStretch {
 
 static int minimize_stretch_init(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
 	MinStretch *ms;
-	int fill_holes= RNA_boolean_get(op->ptr, "fill_holes");
-	short implicit= 1;
+	int fill_holes = RNA_boolean_get(op->ptr, "fill_holes");
+	short implicit = 1;
 
-	if(!uvedit_have_selection(scene, em, implicit)) {
-		BKE_mesh_end_editmesh(obedit->data, em);
+	if (!uvedit_have_selection(scene, em, implicit)) {
 		return 0;
 	}
 
-	ms= MEM_callocN(sizeof(MinStretch), "MinStretch");
-	ms->scene= scene;
-	ms->obedit= obedit;
-	ms->em= em;
-	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->lasttime= PIL_check_seconds_timer();
+	ms = MEM_callocN(sizeof(MinStretch), "MinStretch");
+	ms->scene = scene;
+	ms->obedit = obedit;
+	ms->em = em;
+	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->lasttime = PIL_check_seconds_timer();
 
 	param_stretch_begin(ms->handle);
-	if(ms->blend != 0.0f)
+	if (ms->blend != 0.0f)
 		param_stretch_blend(ms->handle, ms->blend);
 
-	op->customdata= ms;
+	op->customdata = ms;
 
 	return 1;
 }
 
 static void minimize_stretch_iteration(bContext *C, wmOperator *op, int interactive)
 {
-	MinStretch *ms= op->customdata;
-	ScrArea *sa= CTX_wm_area(C);
+	MinStretch *ms = op->customdata;
+	ScrArea *sa = CTX_wm_area(C);
 
 	param_stretch_blend(ms->handle, ms->blend);
 	param_stretch_iter(ms->handle);
@@ -527,12 +555,12 @@ static void minimize_stretch_iteration(bContext *C, wmOperator *op, int interact
 	ms->i++;
 	RNA_int_set(op->ptr, "iterations", ms->i);
 
-	if(interactive && (PIL_check_seconds_timer() - ms->lasttime > 0.5)) {
+	if (interactive && (PIL_check_seconds_timer() - ms->lasttime > 0.5)) {
 		char str[100];
 
 		param_flush(ms->handle);
 
-		if(sa) {
+		if (sa) {
 			BLI_snprintf(str, sizeof(str), "Minimize Stretch. Blend %.2f", ms->blend);
 			ED_area_headerprint(sa, str);
 		}
@@ -540,21 +568,21 @@ static void minimize_stretch_iteration(bContext *C, wmOperator *op, int interact
 		ms->lasttime = PIL_check_seconds_timer();
 
 		DAG_id_tag_update(ms->obedit->data, 0);
-		WM_event_add_notifier(C, NC_GEOM|ND_DATA, ms->obedit->data);
+		WM_event_add_notifier(C, NC_GEOM | ND_DATA, ms->obedit->data);
 	}
 }
 
 static void minimize_stretch_exit(bContext *C, wmOperator *op, int cancel)
 {
-	MinStretch *ms= op->customdata;
-	ScrArea *sa= CTX_wm_area(C);
+	MinStretch *ms = op->customdata;
+	ScrArea *sa = CTX_wm_area(C);
 
-	if(sa)
+	if (sa)
 		ED_area_headerprint(sa, NULL);
-	if(ms->timer)
+	if (ms->timer)
 		WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), ms->timer);
 
-	if(cancel)
+	if (cancel)
 		param_flush_restore(ms->handle);
 	else
 		param_flush(ms->handle);
@@ -563,21 +591,21 @@ static void minimize_stretch_exit(bContext *C, wmOperator *op, int cancel)
 	param_delete(ms->handle);
 
 	DAG_id_tag_update(ms->obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, ms->obedit->data);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, ms->obedit->data);
 
 	MEM_freeN(ms);
-	op->customdata= NULL;
+	op->customdata = NULL;
 }
 
 static int minimize_stretch_exec(bContext *C, wmOperator *op)
 {
 	int i, iterations;
 
-	if(!minimize_stretch_init(C, op))
+	if (!minimize_stretch_init(C, op))
 		return OPERATOR_CANCELLED;
 
-	iterations= RNA_int_get(op->ptr, "iterations");
-	for(i=0; i<iterations; i++)
+	iterations = RNA_int_get(op->ptr, "iterations");
+	for (i = 0; i < iterations; i++)
 		minimize_stretch_iteration(C, op, 0);
 	minimize_stretch_exit(C, op, 0);
 
@@ -588,23 +616,23 @@ static int minimize_stretch_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(
 {
 	MinStretch *ms;
 
-	if(!minimize_stretch_init(C, op))
+	if (!minimize_stretch_init(C, op))
 		return OPERATOR_CANCELLED;
 
 	minimize_stretch_iteration(C, op, 1);
 
-	ms= op->customdata;
+	ms = op->customdata;
 	WM_event_add_modal_handler(C, op);
-	ms->timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
+	ms->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
 
 	return OPERATOR_RUNNING_MODAL;
 }
 
 static int minimize_stretch_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
-	MinStretch *ms= op->customdata;
+	MinStretch *ms = op->customdata;
 
-	switch(event->type) {
+	switch (event->type) {
 		case ESCKEY:
 		case RIGHTMOUSE:
 			minimize_stretch_exit(C, op, 1);
@@ -616,34 +644,34 @@ static int minimize_stretch_modal(bContext *C, wmOperator *op, wmEvent *event)
 			return OPERATOR_FINISHED;
 		case PADPLUSKEY:
 		case WHEELUPMOUSE:
-			if(ms->blend < 0.95f) {
+			if (ms->blend < 0.95f) {
 				ms->blend += 0.1f;
-				ms->lasttime= 0.0f;
+				ms->lasttime = 0.0f;
 				RNA_float_set(op->ptr, "blend", ms->blend);
 				minimize_stretch_iteration(C, op, 1);
 			}
 			break;
 		case PADMINUS:
 		case WHEELDOWNMOUSE:
-			if(ms->blend > 0.05f) {
+			if (ms->blend > 0.05f) {
 				ms->blend -= 0.1f;
-				ms->lasttime= 0.0f;
+				ms->lasttime = 0.0f;
 				RNA_float_set(op->ptr, "blend", ms->blend);
 				minimize_stretch_iteration(C, op, 1);
 			}
 			break;
 		case TIMER:
-			if(ms->timer == event->customdata) {
-				double start= PIL_check_seconds_timer();
+			if (ms->timer == event->customdata) {
+				double start = PIL_check_seconds_timer();
 
 				do {
 					minimize_stretch_iteration(C, op, 1);
-				} while(PIL_check_seconds_timer() - start < 0.01);
+				} while (PIL_check_seconds_timer() - start < 0.01);
 			}
 			break;
 	}
 
-	if(ms->iterations && ms->i >= ms->iterations) {
+	if (ms->iterations && ms->i >= ms->iterations) {
 		minimize_stretch_exit(C, op, 0);
 		return OPERATOR_FINISHED;
 	}
@@ -661,44 +689,40 @@ static int minimize_stretch_cancel(bContext *C, wmOperator *op)
 void UV_OT_minimize_stretch(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Minimize Stretch";
-	ot->idname= "UV_OT_minimize_stretch";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_GRAB_POINTER|OPTYPE_BLOCKING;
-	ot->description="Reduce UV stretching by relaxing angles";
+	ot->name = "Minimize Stretch";
+	ot->idname = "UV_OT_minimize_stretch";
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_GRAB_POINTER | OPTYPE_BLOCKING;
+	ot->description = "Reduce UV stretching by relaxing angles";
 	
 	/* api callbacks */
-	ot->exec= minimize_stretch_exec;
-	ot->invoke= minimize_stretch_invoke;
-	ot->modal= minimize_stretch_modal;
-	ot->cancel= minimize_stretch_cancel;
-	ot->poll= ED_operator_uvedit;
+	ot->exec = minimize_stretch_exec;
+	ot->invoke = minimize_stretch_invoke;
+	ot->modal = minimize_stretch_modal;
+	ot->cancel = minimize_stretch_cancel;
+	ot->poll = ED_operator_uvedit;
 
 	/* properties */
-	RNA_def_boolean(ot->srna, "fill_holes", 1, "Fill Holes",
-	                "Virtual fill holes in mesh before unwrapping, to better avoid overlaps and preserve symmetry");
-	RNA_def_float_factor(ot->srna, "blend", 0.0f, 0.0f, 1.0f, "Blend",
-	                     "Blend factor between stretch minimized and original", 0.0f, 1.0f);
-	RNA_def_int(ot->srna, "iterations", 0, 0, INT_MAX, "Iterations",
-	            "Number of iterations to run, 0 is unlimited when run interactively", 0, 100);
+	RNA_def_boolean(ot->srna, "fill_holes", 1, "Fill Holes", "Virtual fill holes in mesh before unwrapping, to better avoid overlaps and preserve symmetry");
+	RNA_def_float_factor(ot->srna, "blend", 0.0f, 0.0f, 1.0f, "Blend", "Blend factor between stretch minimized and original", 0.0f, 1.0f);
+	RNA_def_int(ot->srna, "iterations", 0, 0, INT_MAX, "Iterations", "Number of iterations to run, 0 is unlimited when run interactively", 0, 100);
 }
 
 /* ******************** Pack Islands operator **************** */
 
 static int pack_islands_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
 	ParamHandle *handle;
-	short implicit= 1;
+	short implicit = 1;
 
-	if(!uvedit_have_selection(scene, em, implicit)) {
-		BKE_mesh_end_editmesh(obedit->data, em);
+	if (!uvedit_have_selection(scene, em, implicit)) {
 		return OPERATOR_CANCELLED;
 	}
 
-	if(RNA_struct_property_is_set(op->ptr, "margin")) {
-		scene->toolsettings->uvcalc_margin= RNA_float_get(op->ptr, "margin");
+	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);
@@ -710,65 +734,61 @@ static int pack_islands_exec(bContext *C, wmOperator *op)
 	param_delete(handle);
 	
 	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
 	return OPERATOR_FINISHED;
 }
 
 void UV_OT_pack_islands(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Pack Islands";
-	ot->idname= "UV_OT_pack_islands";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "Pack Islands";
+	ot->idname = "UV_OT_pack_islands";
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* api callbacks */
-	ot->exec= pack_islands_exec;
-	ot->poll= ED_operator_uvedit;
+	ot->exec = pack_islands_exec;
+	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.0f, 0.0f, 1.0f, "Margin", "Space between islands", 0.0f, 1.0f);
 }
 
 /* ******************** Average Islands Scale operator **************** */
 
 static int average_islands_scale_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
 	ParamHandle *handle;
-	short implicit= 1;
+	short implicit = 1;
 
-	if(!uvedit_have_selection(scene, em, implicit)) {
-		BKE_mesh_end_editmesh(obedit->data, em);
+	if (!uvedit_have_selection(scene, em, implicit)) {
 		return OPERATOR_CANCELLED;
 	}
 
-	handle= construct_param_handle(scene, em, implicit, 0, 1, 1);
+	handle = construct_param_handle(scene, em, implicit, 0, 1, 1);
 	param_average(handle);
 	param_flush(handle);
 	param_delete(handle);
 	
 	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
 	return OPERATOR_FINISHED;
 }
 
 void UV_OT_average_islands_scale(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Average Islands Scale";
-	ot->idname= "UV_OT_average_islands_scale";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "Average Islands Scale";
+	ot->idname = "UV_OT_average_islands_scale";
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* api callbacks */
-	ot->exec= average_islands_scale_exec;
-	ot->poll= ED_operator_uvedit;
+	ot->exec = average_islands_scale_exec;
+	ot->poll = ED_operator_uvedit;
 }
 
 /**************** Live Unwrap *****************/
@@ -777,28 +797,26 @@ static ParamHandle *liveHandle = NULL;
 
 void ED_uvedit_live_unwrap_begin(Scene *scene, Object *obedit)
 {
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
 	short abf = scene->toolsettings->unwrapper == 0;
 	short fillholes = scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES;
 	short use_subsurf = scene->toolsettings->uvcalc_flag & UVCALC_USESUBSURF;
 
-	if(!ED_uvedit_test(obedit)) {
-		BKE_mesh_end_editmesh(obedit->data, em);
+	if (!ED_uvedit_test(obedit)) {
 		return;
 	}
 
-	if(use_subsurf)
+	if (use_subsurf)
 		liveHandle = construct_param_handle_subsurfed(scene, em, fillholes, 0, 1);
 	else
 		liveHandle = construct_param_handle(scene, em, 0, fillholes, 0, 1);
 
 	param_lscm_begin(liveHandle, PARAM_TRUE, abf);
-	BKE_mesh_end_editmesh(obedit->data, em);
 }
 
 void ED_uvedit_live_unwrap_re_solve(void)
 {
-	if(liveHandle) {
+	if (liveHandle) {
 		param_lscm_solve(liveHandle);
 		param_flush(liveHandle);
 	}
@@ -806,60 +824,72 @@ void ED_uvedit_live_unwrap_re_solve(void)
 	
 void ED_uvedit_live_unwrap_end(short cancel)
 {
-	if(liveHandle) {
+	if (liveHandle) {
 		param_lscm_end(liveHandle);
-		if(cancel)
+		if (cancel)
 			param_flush_restore(liveHandle);
 		param_delete(liveHandle);
 		liveHandle = NULL;
 	}
 }
 
+void ED_uvedit_live_unwrap(Scene *scene, Object *obedit)
+{
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+
+    if (scene->toolsettings->edge_mode_live_unwrap &&
+        CustomData_has_layer(&em->bm->ldata, CD_MLOOPUV)) {
+        ED_unwrap_lscm(scene, obedit, FALSE); /* unwrap all not just sel */
+    }
+}
+
 /*************** UV Map Common Transforms *****************/
 
 #define VIEW_ON_EQUATOR 0
-#define VIEW_ON_POLES	1
-#define ALIGN_TO_OBJECT	2
+#define VIEW_ON_POLES   1
+#define ALIGN_TO_OBJECT 2
 
-#define POLAR_ZX	0
-#define POLAR_ZY	1
+#define POLAR_ZX    0
+#define POLAR_ZY    1
 
-static void uv_map_transform_center(Scene *scene, View3D *v3d, float *result, Object *ob, EditMesh *em)
+static void uv_map_transform_center(Scene *scene, View3D *v3d, float *result, 
+                                    Object *ob, BMEditMesh *em)
 {
-	EditFace *efa;
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
 	float min[3], max[3], *cursx;
-	int around= (v3d)? v3d->around: V3D_CENTER;
+	int around = (v3d) ? v3d->around : V3D_CENTER;
 
 	/* only operates on the edit object - this is all that's needed now */
 
-	switch(around)  {
+	switch (around) {
 		case V3D_CENTER: /* bounding box center */
-			min[0]= min[1]= min[2]= 1e20f;
-			max[0]= max[1]= max[2]= -1e20f; 
-
-			for(efa= em->faces.first; efa; efa= efa->next) {
-				if(efa->f & SELECT) {
-					DO_MINMAX(efa->v1->co, min, max);
-					DO_MINMAX(efa->v2->co, min, max);
-					DO_MINMAX(efa->v3->co, min, max);
-					if(efa->v4) DO_MINMAX(efa->v4->co, min, max);
+			min[0] = min[1] = min[2] = 1e20f;
+			max[0] = max[1] = max[2] = -1e20f;
+			
+			BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+				if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
+					BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+						DO_MINMAX(l->v->co, min, max);
+					}
 				}
 			}
 			mid_v3_v3v3(result, min, max);
 			break;
 
 		case V3D_CURSOR: /*cursor center*/ 
-			cursx= give_cursor(scene, v3d);
+			cursx = give_cursor(scene, v3d);
 			/* shift to objects world */
-			result[0]= cursx[0]-ob->obmat[3][0];
-			result[1]= cursx[1]-ob->obmat[3][1];
-			result[2]= cursx[2]-ob->obmat[3][2];
+			result[0] = cursx[0] - ob->obmat[3][0];
+			result[1] = cursx[1] - ob->obmat[3][1];
+			result[2] = cursx[2] - ob->obmat[3][2];
 			break;
 
 		case V3D_LOCAL: /*object center*/
 		case V3D_CENTROID: /* multiple objects centers, only one object here*/
 		default:
-			result[0]= result[1]= result[2]= 0.0;
+			result[0] = result[1] = result[2] = 0.0;
 			break;
 	}
 }
@@ -868,25 +898,25 @@ static void uv_map_rotation_matrix(float result[][4], RegionView3D *rv3d, Object
                                    float upangledeg, float sideangledeg, float radius)
 {
 	float rotup[4][4], rotside[4][4], viewmatrix[4][4], rotobj[4][4];
-	float sideangle= 0.0f, upangle= 0.0f;
+	float sideangle = 0.0f, upangle = 0.0f;
 	int k;
 
 	/* get rotation of the current view matrix */
-	if(rv3d)
+	if (rv3d)
 		copy_m4_m4(viewmatrix, rv3d->viewmat);
 	else
 		unit_m4(viewmatrix);
 
 	/* but shifting */
-	for(k=0; k<4; k++)
-		viewmatrix[3][k] =0.0f;
+	for (k = 0; k < 4; k++)
+		viewmatrix[3][k] = 0.0f;
 
 	/* get rotation of the current object matrix */
-	copy_m4_m4(rotobj,ob->obmat);
+	copy_m4_m4(rotobj, ob->obmat);
 
 	/* but shifting */
-	for(k=0; k<4; k++)
-		rotobj[3][k] =0.0f;
+	for (k = 0; k < 4; k++)
+		rotobj[3][k] = 0.0f;
 
 	zero_m4(rotup);
 	zero_m4(rotside);
@@ -894,19 +924,19 @@ static void uv_map_rotation_matrix(float result[][4], RegionView3D *rv3d, Object
 	/* compensate front/side.. against opengl x,y,z world definition */
 	/* this is "kanonen gegen spatzen", a few plus minus 1 will do here */
 	/* i wanted to keep the reason here, so we're rotating*/
-	sideangle= (float)M_PI*(sideangledeg + 180.0f)/180.0f;
-	rotside[0][0]= (float)cos(sideangle);
-	rotside[0][1]= -(float)sin(sideangle);
-	rotside[1][0]= (float)sin(sideangle);
-	rotside[1][1]= (float)cos(sideangle);
-	rotside[2][2]= 1.0f;
-
-	upangle= (float)M_PI*upangledeg/180.0f;
-	rotup[1][1]= (float)cos(upangle)/radius;
-	rotup[1][2]= -(float)sin(upangle)/radius;
-	rotup[2][1]= (float)sin(upangle)/radius;
-	rotup[2][2]= (float)cos(upangle)/radius;
-	rotup[0][0]= (float)1.0f/radius;
+	sideangle = (float)M_PI * (sideangledeg + 180.0f) / 180.0f;
+	rotside[0][0] = (float)cos(sideangle);
+	rotside[0][1] = -(float)sin(sideangle);
+	rotside[1][0] = (float)sin(sideangle);
+	rotside[1][1] = (float)cos(sideangle);
+	rotside[2][2] = 1.0f;
+
+	upangle = (float)M_PI * upangledeg / 180.0f;
+	rotup[1][1] = (float)cos(upangle) / radius;
+	rotup[1][2] = -(float)sin(upangle) / radius;
+	rotup[2][1] = (float)sin(upangle) / radius;
+	rotup[2][2] = (float)cos(upangle) / radius;
+	rotup[0][0] = (float)1.0f / radius;
 
 	/* calculate transforms*/
 	mul_serie_m4(result, rotup, rotside, viewmatrix, rotobj, NULL, NULL, NULL, NULL);
@@ -915,47 +945,46 @@ static void uv_map_rotation_matrix(float result[][4], RegionView3D *rv3d, Object
 static void uv_map_transform(bContext *C, wmOperator *op, float center[3], float rotmat[4][4])
 {
 	/* context checks are messy here, making it work in both 3d view and uv editor */
-	Scene *scene= CTX_data_scene(C);
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	View3D *v3d= CTX_wm_view3d(C);
-	RegionView3D *rv3d= CTX_wm_region_view3d(C);
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	View3D *v3d = CTX_wm_view3d(C);
+	RegionView3D *rv3d = CTX_wm_region_view3d(C);
 	/* common operator properties */
-	int align= RNA_enum_get(op->ptr, "align");
-	int direction= RNA_enum_get(op->ptr, "direction");
-	float radius= RNA_struct_find_property(op->ptr, "radius")? RNA_float_get(op->ptr, "radius"): 1.0f;
+	int align = RNA_enum_get(op->ptr, "align");
+	int direction = RNA_enum_get(op->ptr, "direction");
+	float radius = RNA_struct_find_property(op->ptr, "radius") ? RNA_float_get(op->ptr, "radius") : 1.0f;
 	float upangledeg, sideangledeg;
 
 	uv_map_transform_center(scene, v3d, center, obedit, em);
 
-	if(direction == VIEW_ON_EQUATOR) {
-		upangledeg= 90.0f;
-		sideangledeg= 0.0f;
+	if (direction == VIEW_ON_EQUATOR) {
+		upangledeg = 90.0f;
+		sideangledeg = 0.0f;
 	}
 	else {
-		upangledeg= 0.0f;
-		if(align == POLAR_ZY) sideangledeg= 0.0f;
-		else sideangledeg= 90.0f;
+		upangledeg = 0.0f;
+		if (align == POLAR_ZY) sideangledeg = 0.0f;
+		else sideangledeg = 90.0f;
 	}
 
 	/* be compatible to the "old" sphere/cylinder mode */
-	if(direction == ALIGN_TO_OBJECT)
+	if (direction == ALIGN_TO_OBJECT)
 		unit_m4(rotmat);
 	else 
 		uv_map_rotation_matrix(rotmat, rv3d, obedit, upangledeg, sideangledeg, radius);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
 }
 
 static void uv_transform_properties(wmOperatorType *ot, int radius)
 {
-	static EnumPropertyItem direction_items[]= {
+	static EnumPropertyItem direction_items[] = {
 		{VIEW_ON_EQUATOR, "VIEW_ON_EQUATOR", 0, "View on Equator", "3D view is on the equator"},
 		{VIEW_ON_POLES, "VIEW_ON_POLES", 0, "View on Poles", "3D view is on the poles"},
 		{ALIGN_TO_OBJECT, "ALIGN_TO_OBJECT", 0, "Align to Object", "Align according to object transform"},
 		{0, NULL, 0, NULL, NULL}
 	};
-	static EnumPropertyItem align_items[]= {
+	static EnumPropertyItem align_items[] = {
 		{POLAR_ZX, "POLAR_ZX", 0, "Polar ZX", "Polar 0 is X"},
 		{POLAR_ZY, "POLAR_ZY", 0, "Polar ZY", "Polar 0 is Y"},
 		{0, NULL, 0, NULL, NULL}
@@ -965,52 +994,52 @@ static void uv_transform_properties(wmOperatorType *ot, int radius)
 	             "Direction of the sphere or cylinder");
 	RNA_def_enum(ot->srna, "align", align_items, VIEW_ON_EQUATOR, "Align",
 	             "How to determine rotation around the pole");
-	if(radius)
+	if (radius)
 		RNA_def_float(ot->srna, "radius", 1.0f, 0.0f, FLT_MAX, "Radius",
 		              "Radius of the sphere or cylinder", 0.0001f, 100.0f);
 }
 
-static void correct_uv_aspect(EditMesh *em)
+static void correct_uv_aspect(BMEditMesh *em)
 {
-	EditFace *efa= EM_get_actFace(em, 1);
-	MTFace *tf;
-	float scale, aspx= 1.0f, aspy=1.0f;
+	BMFace *efa = BM_active_face_get(em->bm, TRUE);
+	BMLoop *l;
+	BMIter iter, liter;
+	MLoopUV *luv;
+	float scale, aspx = 1.0f, aspy = 1.0f;
 	
-	if(efa) {
-		tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+	if (efa) {
+		MTexPoly *tf;
+
+		tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
 		ED_image_uv_aspect(tf->tpage, &aspx, &aspy);
 	}
 	
-	if(aspx == aspy)
+	if (aspx == aspy)
 		return;
 		
-	if(aspx > aspy) {
-		scale= aspy/aspx;
-
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->f & SELECT) {
-				tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
-				tf->uv[0][0]= ((tf->uv[0][0]-0.5f)*scale)+0.5f;
-				tf->uv[1][0]= ((tf->uv[1][0]-0.5f)*scale)+0.5f;
-				tf->uv[2][0]= ((tf->uv[2][0]-0.5f)*scale)+0.5f;
-				if(efa->v4)
-					tf->uv[3][0]= ((tf->uv[3][0]-0.5f)*scale)+0.5f;
+	if (aspx > aspy) {
+		scale = aspy / aspx;
+
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			if (!BM_elem_flag_test(efa, BM_ELEM_SELECT) || BM_elem_flag_test(efa, BM_ELEM_HIDDEN))
+				continue;
+			
+			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+				luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+				luv->uv[0] = ((luv->uv[0] - 0.5) * scale) + 0.5;
 			}
 		}
 	}
 	else {
-		scale= aspx/aspy;
+		scale = aspx / aspy;
 
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->f & SELECT) {
-				tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
-				tf->uv[0][1]= ((tf->uv[0][1]-0.5f)*scale)+0.5f;
-				tf->uv[1][1]= ((tf->uv[1][1]-0.5f)*scale)+0.5f;
-				tf->uv[2][1]= ((tf->uv[2][1]-0.5f)*scale)+0.5f;
-				if(efa->v4)
-					tf->uv[3][1]= ((tf->uv[3][1]-0.5f)*scale)+0.5f;
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			if (!BM_elem_flag_test(efa, BM_ELEM_SELECT) || BM_elem_flag_test(efa, BM_ELEM_HIDDEN))
+				continue;
+			
+			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+				luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+				luv->uv[1] = ((luv->uv[1] - 0.5) * scale) + 0.5;
 			}
 		}
 	}
@@ -1028,70 +1057,65 @@ static void uv_map_clip_correct_properties(wmOperatorType *ot)
 	                "Scale UV coordinates to bounds after unwrapping");
 }
 
-static void uv_map_clip_correct(EditMesh *em, wmOperator *op)
+static void uv_map_clip_correct(BMEditMesh *em, wmOperator *op)
 {
-	EditFace *efa;
-	MTFace *tf;
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	MLoopUV *luv;
 	float dx, dy, min[2], max[2];
-	int b, nverts;
-	int correct_aspect= RNA_boolean_get(op->ptr, "correct_aspect");
-	int clip_to_bounds= RNA_boolean_get(op->ptr, "clip_to_bounds");
-	int scale_to_bounds= RNA_boolean_get(op->ptr, "scale_to_bounds");
+	int correct_aspect = RNA_boolean_get(op->ptr, "correct_aspect");
+	int clip_to_bounds = RNA_boolean_get(op->ptr, "clip_to_bounds");
+	int scale_to_bounds = RNA_boolean_get(op->ptr, "scale_to_bounds");
 
 	/* correct for image aspect ratio */
-	if(correct_aspect)
+	if (correct_aspect)
 		correct_uv_aspect(em);
 
-	if(scale_to_bounds) {
+	if (scale_to_bounds) {
 		INIT_MINMAX2(min, max);
 		
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->f & SELECT) {
-				tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
-				DO_MINMAX2(tf->uv[0], min, max);
-				DO_MINMAX2(tf->uv[1], min, max);
-				DO_MINMAX2(tf->uv[2], min, max);
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			if (!BM_elem_flag_test(efa, BM_ELEM_SELECT))
+				continue;
 
-				if(efa->v4)
-					DO_MINMAX2(tf->uv[3], min, max);
+			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);
 			}
 		}
 		
 		/* rescale UV to be in 1/1 */
-		dx= (max[0]-min[0]);
-		dy= (max[1]-min[1]);
-
-		if(dx > 0.0f)
-			dx= 1.0f/dx;
-		if(dy > 0.0f)
-			dy= 1.0f/dy;
+		dx = (max[0] - min[0]);
+		dy = (max[1] - min[1]);
 
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->f & SELECT) {
-				tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+		if (dx > 0.0f)
+			dx = 1.0f / dx;
+		if (dy > 0.0f)
+			dy = 1.0f / dy;
 
-				nverts= (efa->v4)? 4: 3;
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			if (!BM_elem_flag_test(efa, BM_ELEM_SELECT))
+				continue;
 
-				for(b=0; b<nverts; b++) {
-					tf->uv[b][0]= (tf->uv[b][0]-min[0])*dx;
-					tf->uv[b][1]= (tf->uv[b][1]-min[1])*dy;
-				}
+			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+				luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+				
+				luv->uv[0] = (luv->uv[0] - min[0]) * dx;
+				luv->uv[1] = (luv->uv[1] - min[1]) * dy;
 			}
 		}
 	}
-	else if(clip_to_bounds) {
+	else if (clip_to_bounds) {
 		/* clipping and wrapping */
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->f & SELECT) {
-				tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-			
-				nverts= (efa->v4)? 4: 3;
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			if (!BM_elem_flag_test(efa, BM_ELEM_SELECT))
+				continue;
 
-				for(b=0; b<nverts; b++) {
-					CLAMP(tf->uv[b][0], 0.0f, 1.0f);
-					CLAMP(tf->uv[b][1], 0.0f, 1.0f);
-				}
+			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+				luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+				CLAMP(luv->uv[0], 0.0f, 1.0f);
+				CLAMP(luv->uv[1], 0.0f, 1.0f);
 			}
 		}
 	}
@@ -1102,17 +1126,17 @@ static void uv_map_clip_correct(EditMesh *em, wmOperator *op)
 /* assumes UV Map is checked, doesn't run update funcs */
 void ED_unwrap_lscm(Scene *scene, Object *obedit, const short sel)
 {
+	BMEditMesh *em = BMEdit_FromObject(obedit);
 	ParamHandle *handle;
 
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	const short fill_holes= scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES;
-	const short correct_aspect= !(scene->toolsettings->uvcalc_flag & UVCALC_NO_ASPECT_CORRECT);
+	const short fill_holes = scene->toolsettings->uvcalc_flag & UVCALC_FILLHOLES;
+	const short correct_aspect = !(scene->toolsettings->uvcalc_flag & UVCALC_NO_ASPECT_CORRECT);
 	const short use_subsurf = scene->toolsettings->uvcalc_flag & UVCALC_USESUBSURF;
 
-	if(use_subsurf)
+	if (use_subsurf)
 		handle = construct_param_handle_subsurfed(scene, em, fill_holes, sel, correct_aspect);
 	else
-		handle= construct_param_handle(scene, em, 0, fill_holes, sel, correct_aspect);
+		handle = construct_param_handle(scene, em, 0, fill_holes, sel, correct_aspect);
 
 	param_lscm_begin(handle, PARAM_FALSE, scene->toolsettings->unwrapper == 0);
 	param_lscm_solve(handle);
@@ -1123,37 +1147,32 @@ void ED_unwrap_lscm(Scene *scene, Object *obedit, const short sel)
 	param_flush(handle);
 
 	param_delete(handle);
-
-	BKE_mesh_end_editmesh(obedit->data, em);
 }
 
 static int unwrap_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
 	int method = RNA_enum_get(op->ptr, "method");
 	int fill_holes = RNA_boolean_get(op->ptr, "fill_holes");
 	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};
-	short implicit= 0;
+	short implicit = 0;
 
-	if(!uvedit_have_selection(scene, em, implicit)) {
-		BKE_mesh_end_editmesh(obedit->data, em);
-		return 0;
+	if (!uvedit_have_selection(scene, em, implicit)) {
+		return OPERATOR_CANCELLED;
 	}
-
-	BKE_mesh_end_editmesh(obedit->data, em);
 	
 	/* add uvs if they don't exist yet */
-	if(!ED_uvedit_ensure_uvs(C, scene, obedit)) {
+	if (!ED_uvedit_ensure_uvs(C, scene, obedit)) {
 		return OPERATOR_CANCELLED;
 	}
 
 	mat4_to_size(obsize, obedit->obmat);
-	if(!compare_v3v3(obsize, unitsize, 1e-4f))
+	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.");
 
 	/* remember last method for live unwrap */
@@ -1161,20 +1180,20 @@ static int unwrap_exec(bContext *C, wmOperator *op)
 	
 	scene->toolsettings->uv_subsurf_level = subsurf_level;
 
-	if(fill_holes)		scene->toolsettings->uvcalc_flag |=  UVCALC_FILLHOLES;
-	else				scene->toolsettings->uvcalc_flag &= ~UVCALC_FILLHOLES;
+	if (fill_holes) scene->toolsettings->uvcalc_flag |=  UVCALC_FILLHOLES;
+	else scene->toolsettings->uvcalc_flag &= ~UVCALC_FILLHOLES;
 
-	if(correct_aspect)	scene->toolsettings->uvcalc_flag &= ~UVCALC_NO_ASPECT_CORRECT;
-	else				scene->toolsettings->uvcalc_flag |=  UVCALC_NO_ASPECT_CORRECT;
+	if (correct_aspect) scene->toolsettings->uvcalc_flag &= ~UVCALC_NO_ASPECT_CORRECT;
+	else scene->toolsettings->uvcalc_flag |=  UVCALC_NO_ASPECT_CORRECT;
 
-	if(use_subsurf)		scene->toolsettings->uvcalc_flag |= UVCALC_USESUBSURF;
-	else				scene->toolsettings->uvcalc_flag &= ~UVCALC_USESUBSURF;
+	if (use_subsurf) scene->toolsettings->uvcalc_flag |= UVCALC_USESUBSURF;
+	else scene->toolsettings->uvcalc_flag &= ~UVCALC_USESUBSURF;
 
 	/* execute unwrap */
 	ED_unwrap_lscm(scene, obedit, TRUE);
 
 	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 
 	return OPERATOR_FINISHED;
 }
@@ -1187,14 +1206,14 @@ void UV_OT_unwrap(wmOperatorType *ot)
 		{0, NULL, 0, NULL, NULL}};
 
 	/* identifiers */
-	ot->name= "Unwrap";
-	ot->description= "Unwrap the mesh of the object being edited";
-	ot->idname= "UV_OT_unwrap";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "Unwrap";
+	ot->description = "Unwrap the mesh of the object being edited";
+	ot->idname = "UV_OT_unwrap";
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* api callbacks */
-	ot->exec= unwrap_exec;
-	ot->poll= ED_operator_uvmap;
+	ot->exec = unwrap_exec;
+	ot->poll = ED_operator_uvmap;
 
 	/* properties */
 	RNA_def_enum(ot->srna, "method", method_items, 0, "Method",
@@ -1204,64 +1223,61 @@ void UV_OT_unwrap(wmOperatorType *ot)
 	RNA_def_boolean(ot->srna, "correct_aspect", 1, "Correct Aspect",
 	                "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");
+	                "Map UVs taking vertex position after subsurf into account");
 	RNA_def_int(ot->srna, "uv_subsurf_level", 1, 1, 6, "SubSurf Target",
-	                      "Number of times to subdivide before calculating UVs", 1, 6);
+	            "Number of times to subdivide before calculating UVs", 1, 6);
 }
 
 /**************** Project From View operator **************/
 static int uv_from_view_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Object *obedit= CTX_data_edit_object(C);
-	Camera *camera= NULL;
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	ARegion *ar= CTX_wm_region(C);
-	View3D *v3d= CTX_wm_view3d(C);
-	RegionView3D *rv3d= ar->regiondata;
-	EditFace *efa;
-	MTFace *tf;
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit = CTX_data_edit_object(C);
+	Camera *camera = NULL;
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	ARegion *ar = CTX_wm_region(C);
+	View3D *v3d = CTX_wm_view3d(C);
+	RegionView3D *rv3d = CTX_wm_region_view3d(C);
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	MLoopUV *luv;
 	float rotmat[4][4];
 
 	/* add uvs if they don't exist yet */
-	if(!ED_uvedit_ensure_uvs(C, scene, obedit)) {
-		BKE_mesh_end_editmesh(obedit->data, em);
+	if (!ED_uvedit_ensure_uvs(C, scene, obedit)) {
 		return OPERATOR_CANCELLED;
 	}
 
 	/* establish the camera object, so we can default to view mapping if anything is wrong with it */
-	if ((rv3d->persp==RV3D_CAMOB) && (v3d->camera) && (v3d->camera->type==OB_CAMERA)) {
-		camera= v3d->camera->data;
+	if ((rv3d->persp == RV3D_CAMOB) && (v3d->camera) && (v3d->camera->type == OB_CAMERA)) {
+		camera = v3d->camera->data;
 	}
 
-	if(RNA_boolean_get(op->ptr, "orthographic")) {
-		uv_map_rotation_matrix(rotmat, ar->regiondata, obedit, 90.0f, 0.0f, 1.0f);
+	if (RNA_boolean_get(op->ptr, "orthographic")) {
+		uv_map_rotation_matrix(rotmat, rv3d, obedit, 90.0f, 0.0f, 1.0f);
 		
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->f & SELECT) {
-				tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
-				project_from_view_ortho(tf->uv[0], efa->v1->co, rotmat);
-				project_from_view_ortho(tf->uv[1], efa->v2->co, rotmat);
-				project_from_view_ortho(tf->uv[2], efa->v3->co, rotmat);
-				if(efa->v4)
-					project_from_view_ortho(tf->uv[3], efa->v4->co, rotmat);
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			if (!BM_elem_flag_test(efa, BM_ELEM_SELECT))
+				continue;
+
+			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+				luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+				project_from_view_ortho(luv->uv, l->v->co, rotmat);
 			}
 		}
 	}
 	else if (camera) {
-		struct UvCameraInfo *uci= project_camera_info(v3d->camera, obedit->obmat, scene->r.xsch, scene->r.ysch);
+		struct UvCameraInfo *uci = project_camera_info(v3d->camera, obedit->obmat, scene->r.xsch, scene->r.ysch);
 		
-		if(uci) {
-			for(efa= em->faces.first; efa; efa= efa->next) {
-				if(efa->f & SELECT) {
-					tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
-					project_from_camera(tf->uv[0], efa->v1->co, uci);
-					project_from_camera(tf->uv[1], efa->v2->co, uci);
-					project_from_camera(tf->uv[2], efa->v3->co, uci);
-					if(efa->v4)
-						project_from_camera(tf->uv[3], efa->v4->co, uci);
+		if (uci) {
+			BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+				if (!BM_elem_flag_test(efa, BM_ELEM_SELECT))
+					continue;
+
+				BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+					luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+					project_from_camera(luv->uv, l->v->co, uci);
 				}
 			}
 			
@@ -1271,15 +1287,13 @@ static int uv_from_view_exec(bContext *C, wmOperator *op)
 	else {
 		copy_m4_m4(rotmat, obedit->obmat);
 
-		for(efa= em->faces.first; efa; efa= efa->next) {
-			if(efa->f & SELECT) {
-				tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+		BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+			if (!BM_elem_flag_test(efa, BM_ELEM_SELECT))
+				continue;
 
-				project_from_view(tf->uv[0], efa->v1->co, rv3d->persmat, rotmat, ar->winx, ar->winy);
-				project_from_view(tf->uv[1], efa->v2->co, rv3d->persmat, rotmat, ar->winx, ar->winy);
-				project_from_view(tf->uv[2], efa->v3->co, rv3d->persmat, rotmat, ar->winx, ar->winy);
-				if(efa->v4)
-					project_from_view(tf->uv[3], efa->v4->co, rv3d->persmat, rotmat, ar->winx, ar->winy);
+			BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+				luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+				project_from_view(luv->uv, l->v->co, rv3d->persmat, rotmat, ar->winx, ar->winy);
 			}
 		}
 	}
@@ -1287,17 +1301,16 @@ static int uv_from_view_exec(bContext *C, wmOperator *op)
 	uv_map_clip_correct(em, op);
 
 	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
 	return OPERATOR_FINISHED;
 }
 
 static int uv_from_view_poll(bContext *C)
 {
-	RegionView3D *rv3d= CTX_wm_region_view3d(C);
+	RegionView3D *rv3d = CTX_wm_region_view3d(C);
 
-	if(!ED_operator_uvmap(C))
+	if (!ED_operator_uvmap(C))
 		return 0;
 
 	return (rv3d != NULL);
@@ -1306,13 +1319,13 @@ static int uv_from_view_poll(bContext *C)
 void UV_OT_from_view(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Project From View";
-	ot->idname= "UV_OT_project_from_view";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "Project From View";
+	ot->idname = "UV_OT_project_from_view";
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* api callbacks */
-	ot->exec= uv_from_view_exec;
-	ot->poll= uv_from_view_poll;
+	ot->exec = uv_from_view_exec;
+	ot->poll = uv_from_view_poll;
 
 	/* properties */
 	RNA_def_boolean(ot->srna, "orthographic", 0, "Orthographic", "Use orthographic projection");
@@ -1323,53 +1336,35 @@ void UV_OT_from_view(wmOperatorType *ot)
 
 static int reset_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Scene *scene= CTX_data_scene(C);
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	EditFace *efa;
-	MTFace *tf;
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit = CTX_data_edit_object(C);
+	Mesh *me = (Mesh *)obedit->data;
 
 	/* add uvs if they don't exist yet */
-	if(!ED_uvedit_ensure_uvs(C, scene, obedit)) {
-		BKE_mesh_end_editmesh(obedit->data, em);
+	if (!ED_uvedit_ensure_uvs(C, scene, obedit)) {
 		return OPERATOR_CANCELLED;
 	}
 
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		if(efa->f & SELECT) {
-			tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
-			tf->uv[0][0]= 0.0f;
-			tf->uv[0][1]= 0.0f;
-			
-			tf->uv[1][0]= 1.0f;
-			tf->uv[1][1]= 0.0f;
-			
-			tf->uv[2][0]= 1.0f;
-			tf->uv[2][1]= 1.0f;
-			
-			tf->uv[3][0]= 0.0f;
-			tf->uv[3][1]= 1.0f;
-		}
+	if (!ED_mesh_uv_loop_reset(C, me)) {
+		return OPERATOR_CANCELLED;
 	}
 
 	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-
-	BKE_mesh_end_editmesh(obedit->data, em);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
+	
 	return OPERATOR_FINISHED;
 }
 
 void UV_OT_reset(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Reset";
-	ot->idname= "UV_OT_reset";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "Reset";
+	ot->idname = "UV_OT_reset";
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* api callbacks */
-	ot->exec= reset_exec;
-	ot->poll= ED_operator_uvmap;
+	ot->exec = reset_exec;
+	ot->poll = ED_operator_uvmap;
 }
 
 /****************** Sphere Project operator ***************/
@@ -1381,83 +1376,96 @@ static void uv_sphere_project(float target[2], float source[3], float center[3],
 	sub_v3_v3v3(pv, source, center);
 	mul_m4_v3(rotmat, pv);
 
-	map_to_sphere( &target[0], &target[1],pv[0], pv[1], pv[2]);
+	map_to_sphere(&target[0], &target[1], pv[0], pv[1], pv[2]);
 
 	/* split line is always zero */
-	if(target[0] >= 1.0f)
+	if (target[0] >= 1.0f)
 		target[0] -= 1.0f;  
 }
 
-static void uv_map_mirror(EditFace *efa, MTFace *tf)
+static void uv_map_mirror(BMEditMesh *em, BMFace *efa, MTexPoly *UNUSED(tf))
 {
+	BMLoop *l;
+	BMIter liter;
+	MLoopUV *luv;
+	float **uvs = NULL;
+	BLI_array_fixedstack_declare(uvs, BM_NGON_STACK_SIZE, efa->len, __func__);
 	float dx;
-	int nverts, i, mi;
+	int i, mi;
 
-	nverts= (efa->v4)? 4: 3;
+	i = 0;
+	BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+		luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+		uvs[i] = luv->uv;
+		i++;
+	}
 
 	mi = 0;
-	for(i=1; i<nverts; i++)
-		if(tf->uv[i][0] > tf->uv[mi][0])
+	for (i = 1; i < efa->len; i++)
+		if (uvs[i][0] > uvs[mi][0])
 			mi = i;
 
-	for(i=0; i<nverts; i++) {
-		if(i != mi) {
-			dx = tf->uv[mi][0] - tf->uv[i][0];
-			if(dx > 0.5f) tf->uv[i][0] += 1.0f;
+	for (i = 0; i < efa->len; i++) {
+		if (i != mi) {
+			dx = uvs[mi][0] - uvs[i][0];
+			if (dx > 0.5f) uvs[i][0] += 1.0f;
 		} 
 	} 
+
+	BLI_array_fixedstack_free(uvs);
 }
 
 static int sphere_project_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	EditFace *efa;
-	MTFace *tf;
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	MTexPoly *tf;
+	MLoopUV *luv;
 	float center[3], rotmat[4][4];
 
 	/* add uvs if they don't exist yet */
-	if(!ED_uvedit_ensure_uvs(C, scene, obedit)) {
-		BKE_mesh_end_editmesh(obedit->data, em);
+	if (!ED_uvedit_ensure_uvs(C, scene, obedit)) {
 		return OPERATOR_CANCELLED;
 	}
 
 	uv_map_transform(C, op, center, rotmat);
 
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		if(efa->f & SELECT) {
-			tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
+	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+		if (!BM_elem_flag_test(efa, BM_ELEM_SELECT))
+			continue;
 
-			uv_sphere_project(tf->uv[0], efa->v1->co, center, rotmat);
-			uv_sphere_project(tf->uv[1], efa->v2->co, center, rotmat);
-			uv_sphere_project(tf->uv[2], efa->v3->co, center, rotmat);
-			if(efa->v4)
-				uv_sphere_project(tf->uv[3], efa->v4->co, center, rotmat);
+		BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+			luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
 
-			uv_map_mirror(efa, tf);
+			uv_sphere_project(luv->uv, l->v->co, center, rotmat);
 		}
+
+		tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
+		uv_map_mirror(em, efa, tf);
 	}
 
 	uv_map_clip_correct(em, op);
 
 	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
 	return OPERATOR_FINISHED;
 }
 
 void UV_OT_sphere_project(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Sphere Projection";
-	ot->idname= "UV_OT_sphere_project";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "Sphere Projection";
+	ot->idname = "UV_OT_sphere_project";
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* api callbacks */
-	ot->exec= sphere_project_exec;
-	ot->poll= ED_operator_uvmap;
+	ot->exec = sphere_project_exec;
+	ot->poll = ED_operator_uvmap;
 
 	/* properties */
 	uv_transform_properties(ot, 0);
@@ -1473,63 +1481,64 @@ static void uv_cylinder_project(float target[2], float source[3], float center[3
 	sub_v3_v3v3(pv, source, center);
 	mul_m4_v3(rotmat, pv);
 
-	map_to_tube( &target[0], &target[1],pv[0], pv[1], pv[2]);
+	map_to_tube(&target[0], &target[1], pv[0], pv[1], pv[2]);
 
 	/* split line is always zero */
-	if(target[0] >= 1.0f)
+	if (target[0] >= 1.0f)
 		target[0] -= 1.0f;  
 }
 
 static int cylinder_project_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	EditFace *efa;
-	MTFace *tf;
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	MTexPoly *tf;
+	MLoopUV *luv;
 	float center[3], rotmat[4][4];
 
 	/* add uvs if they don't exist yet */
-	if(!ED_uvedit_ensure_uvs(C, scene, obedit)) {
-		BKE_mesh_end_editmesh(obedit->data, em);
+	if (!ED_uvedit_ensure_uvs(C, scene, obedit)) {
 		return OPERATOR_CANCELLED;
 	}
 
 	uv_map_transform(C, op, center, rotmat);
 
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		if(efa->f & SELECT) {
-			tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-
-			uv_cylinder_project(tf->uv[0], efa->v1->co, center, rotmat);
-			uv_cylinder_project(tf->uv[1], efa->v2->co, center, rotmat);
-			uv_cylinder_project(tf->uv[2], efa->v3->co, center, rotmat);
-			if(efa->v4)
-				uv_cylinder_project(tf->uv[3], efa->v4->co, center, rotmat);
+	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+		tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
+		if (!BM_elem_flag_test(efa, BM_ELEM_SELECT))
+			continue;
+		
+		BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+			luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
 
-			uv_map_mirror(efa, tf);
+			uv_cylinder_project(luv->uv, l->v->co, center, rotmat);
 		}
+
+		uv_map_mirror(em, efa, tf);
 	}
 
 	uv_map_clip_correct(em, op);
 
 	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
 	return OPERATOR_FINISHED;
 }
 
 void UV_OT_cylinder_project(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Cylinder Projection";
-	ot->idname= "UV_OT_cylinder_project";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "Cylinder Projection";
+	ot->idname = "UV_OT_cylinder_project";
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* api callbacks */
-	ot->exec= cylinder_project_exec;
-	ot->poll= ED_operator_uvmap;
+	ot->exec = cylinder_project_exec;
+	ot->poll = ED_operator_uvmap;
 
 	/* properties */
 	uv_transform_properties(ot, 1);
@@ -1540,79 +1549,76 @@ void UV_OT_cylinder_project(wmOperatorType *ot)
 
 static int cube_project_exec(bContext *C, wmOperator *op)
 {
-	Scene *scene= CTX_data_scene(C);
-	Object *obedit= CTX_data_edit_object(C);
-	EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data);
-	EditFace *efa;
-	MTFace *tf;
-	float no[3], cube_size, *loc, dx, dy;
+	Scene *scene = CTX_data_scene(C);
+	Object *obedit = CTX_data_edit_object(C);
+	BMEditMesh *em = BMEdit_FromObject(obedit);
+	BMFace *efa;
+	BMLoop *l;
+	BMIter iter, liter;
+	/* MTexPoly *tf; */ /* UNUSED */
+	MLoopUV *luv;
+	float cube_size, *loc, dx, dy;
 	int cox, coy;
 
 	/* add uvs if they don't exist yet */
-	if(!ED_uvedit_ensure_uvs(C, scene, obedit)) {
-		BKE_mesh_end_editmesh(obedit->data, em);
+	if (!ED_uvedit_ensure_uvs(C, scene, obedit)) {
 		return OPERATOR_CANCELLED;
 	}
 
-	loc= obedit->obmat[3];
-	cube_size= RNA_float_get(op->ptr, "cube_size");
+	loc = obedit->obmat[3];
+	cube_size = RNA_float_get(op->ptr, "cube_size");
 
 	/* choose x,y,z axis for projection depending on the largest normal
 	 * component, but clusters all together around the center of map. */
 
-	for(efa= em->faces.first; efa; efa= efa->next) {
-		if(efa->f & SELECT) {
-			tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
-			normal_tri_v3( no,efa->v1->co, efa->v2->co, efa->v3->co);
-
-			axis_dominant_v3(&cox, &coy, no);
-
-			tf->uv[0][0]= 0.5f+0.5f*cube_size*(loc[cox] + efa->v1->co[cox]);
-			tf->uv[0][1]= 0.5f+0.5f*cube_size*(loc[coy] + efa->v1->co[coy]);
-			dx = floor(tf->uv[0][0]);
-			dy = floor(tf->uv[0][1]);
-			tf->uv[0][0] -= dx;
-			tf->uv[0][1] -= dy;
-			tf->uv[1][0]= 0.5f+0.5f*cube_size*(loc[cox] + efa->v2->co[cox]);
-			tf->uv[1][1]= 0.5f+0.5f*cube_size*(loc[coy] + efa->v2->co[coy]);
-			tf->uv[1][0] -= dx;
-			tf->uv[1][1] -= dy;
-			tf->uv[2][0]= 0.5f+0.5f*cube_size*(loc[cox] + efa->v3->co[cox]);
-			tf->uv[2][1]= 0.5f+0.5f*cube_size*(loc[coy] + efa->v3->co[coy]);
-			tf->uv[2][0] -= dx;
-			tf->uv[2][1] -= dy;
-
-			if(efa->v4) {
-				tf->uv[3][0]= 0.5f+0.5f*cube_size*(loc[cox] + efa->v4->co[cox]);
-				tf->uv[3][1]= 0.5f+0.5f*cube_size*(loc[coy] + efa->v4->co[coy]);
-				tf->uv[3][0] -= dx;
-				tf->uv[3][1] -= dy;
+	BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
+		int first = 1;
+
+		/* tf = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY); */ /* UNUSED */
+		if (!BM_elem_flag_test(efa, BM_ELEM_SELECT))
+			continue;
+
+		axis_dominant_v3(&cox, &coy, efa->no);
+
+		dx = dy = 0;
+		BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
+			luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
+
+			luv->uv[0] = 0.5f + 0.5f * cube_size * (loc[cox] + l->v->co[cox]);
+			luv->uv[1] = 0.5f + 0.5f * cube_size * (loc[coy] + l->v->co[coy]);
+			
+			if (first) {
+				dx = floor(luv->uv[0]);
+				dy = floor(luv->uv[1]);
+				first = 0;
 			}
+			
+
+			luv->uv[0] -= dx;
+			luv->uv[1] -= dy;
 		}
 	}
 
 	uv_map_clip_correct(em, op);
 
 	DAG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 
-	BKE_mesh_end_editmesh(obedit->data, em);
 	return OPERATOR_FINISHED;
 }
 
 void UV_OT_cube_project(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Cube Projection";
-	ot->idname= "UV_OT_cube_project";
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->name = "Cube Projection";
+	ot->idname = "UV_OT_cube_project";
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* api callbacks */
-	ot->exec= cube_project_exec;
-	ot->poll= ED_operator_uvmap;
+	ot->exec = cube_project_exec;
+	ot->poll = ED_operator_uvmap;
 
 	/* properties */
-	RNA_def_float(ot->srna, "cube_size", 1.0f, 0.0f, FLT_MAX, "Cube Size",
-	              "Size of the cube to project on", 0.001f, 100.0f);
+	RNA_def_float(ot->srna, "cube_size", 1.0f, 0.0f, FLT_MAX, "Cube Size", "Size of the cube to project on", 0.001f, 100.0f);
 	uv_map_clip_correct_properties(ot);
 }
diff --git a/source/blender/gpu/GPU_buffers.h b/source/blender/gpu/GPU_buffers.h
index a72c79a..cee9039 100644
--- a/source/blender/gpu/GPU_buffers.h
+++ b/source/blender/gpu/GPU_buffers.h
@@ -40,7 +40,9 @@
 #endif
 
 struct DerivedMesh;
+struct DMFlagMat;
 struct DMGridData;
+struct CustomData;
 struct GHash;
 struct DMGridData;
 struct GPUVertPointLink;
@@ -61,20 +63,20 @@ typedef struct GPUBufferMaterial {
 } GPUBufferMaterial;
 
 /* meshes are split up by material since changing materials requires
-   GL state changes that can't occur in the middle of drawing an
-   array.
-
-   some simplifying assumptions are made:
-   * all quads are treated as two triangles.
-   * no vertex sharing is used; each triangle gets its own copy of the
-     vertices it uses (this makes it easy to deal with a vertex used
-     by faces with different properties, such as smooth/solid shading,
-     different MCols, etc.)
-
-   to avoid confusion between the original MVert vertices and the
-   arrays of OpenGL vertices, the latter are referred to here and in
-   the source as `points'. similarly, the OpenGL triangles generated
-   for MFaces are referred to as triangles rather than faces.
+ * GL state changes that can't occur in the middle of drawing an
+ * array.
+ *
+ * some simplifying assumptions are made:
+ * - all quads are treated as two triangles.
+ * - no vertex sharing is used; each triangle gets its own copy of the
+ *   vertices it uses (this makes it easy to deal with a vertex used
+ *   by faces with different properties, such as smooth/solid shading,
+ *   different MCols, etc.)
+ *
+ * to avoid confusion between the original MVert vertices and the
+ * arrays of OpenGL vertices, the latter are referred to here and in
+ * the source as `points'. similarly, the OpenGL triangles generated
+ * for MFaces are referred to as triangles rather than faces.
  */
 typedef struct GPUDrawObject {
 	GPUBuffer *points;
@@ -106,7 +108,7 @@ typedef struct GPUDrawObject {
 	int totedge;
 
 	/* if there was a failure allocating some buffer, use old
-	   rendering code */
+	 * rendering code */
 	int legacy;
 } GPUDrawObject;
 
@@ -122,17 +124,16 @@ 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 );
-void GPU_interleaved_setup( GPUBuffer *buffer, int data[] );
+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 );
 
@@ -142,9 +143,7 @@ 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 );
-/* upload four unsigned chars, representing RGBA colors, for each vertex. Resets dm->drawObject->colType to -1 */
-void GPU_color4_upload( struct DerivedMesh *dm, unsigned char *data );
+void GPU_color3_upload(struct DerivedMesh *dm, unsigned char *data );
 /* switch color rendering on=1/off=0 */
 void GPU_color_switch( int mode );
 
@@ -155,21 +154,27 @@ void GPU_buffer_draw_elements( GPUBuffer *elements, unsigned int mode, int start
 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;
-GPU_Buffers *GPU_build_mesh_buffers(struct GHash *map, struct MVert *mvert,
-			struct MFace *mface, int *face_indices,
-			int totface, int *vert_indices, int uniq_verts,
-			int totvert);
+
+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);
-GPU_Buffers *GPU_build_grid_buffers(struct DMGridData **grids,
-	int *grid_indices, int totgrid, int gridsize);
+
+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 DMGridData **grids,
-	int *grid_indices, int totgrid, int gridsize, int smooth);
-void GPU_draw_buffers(GPU_Buffers *buffers);
+							 const struct DMFlagMat *grid_flag_mats,
+							 int *grid_indices, int totgrid, int gridsize);
+
+void GPU_draw_buffers(GPU_Buffers *buffers, DMSetMaterial setMaterial);
+
 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 f73bd40..8997669 100644
--- a/source/blender/gpu/GPU_draw.h
+++ b/source/blender/gpu/GPU_draw.h
@@ -29,8 +29,8 @@
  *  \ingroup gpu
  */
 
-#ifndef GPU_GAME_H
-#define GPU_GAME_H
+#ifndef __GPU_DRAW_H__
+#define __GPU_DRAW_H__
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h
index 9fb0dd1..5f541e2 100644
--- a/source/blender/gpu/GPU_extensions.h
+++ b/source/blender/gpu/GPU_extensions.h
@@ -29,8 +29,8 @@
  *  \ingroup gpu
  */
 
-#ifndef GPU_EXTENSIONS_H
-#define GPU_EXTENSIONS_H
+#ifndef __GPU_EXTENSIONS_H__
+#define __GPU_EXTENSIONS_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -92,18 +92,18 @@ typedef enum GPUDriverType {
 int GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver);
 
 /* GPU Texture
-   - always returns unsigned char RGBA textures
-   - if texture with non square dimensions is created, depending on the
-	 graphics card capabilities the texture may actually be stored in a
-	 larger texture with power of two dimensions. the actual dimensions
-	 may be queried with GPU_texture_opengl_width/height. GPU_texture_coord_2f
-	 calls glTexCoord2f with the coordinates adjusted for this.
-   - can use reference counting:
-	   - reference counter after GPU_texture_create is 1
-	   - GPU_texture_ref increases by one
-	   - GPU_texture_free decreases by one, and frees if 0
-	- if created with from_blender, will not free the texture
-*/
+ * - always returns unsigned char RGBA textures
+ * - if texture with non square dimensions is created, depending on the
+ *   graphics card capabilities the texture may actually be stored in a
+ *   larger texture with power of two dimensions. the actual dimensions
+ *   may be queried with GPU_texture_opengl_width/height. GPU_texture_coord_2f
+ *   calls glTexCoord2f with the coordinates adjusted for this.
+ * - can use reference counting:
+ *     - reference counter after GPU_texture_create is 1
+ *     - GPU_texture_ref increases by one
+ *     - GPU_texture_free decreases by one, and frees if 0
+ *  - if created with from_blender, will not free the texture
+ */
 
 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]);
@@ -126,11 +126,11 @@ int GPU_texture_opengl_height(GPUTexture *tex);
 int GPU_texture_opengl_bindcode(GPUTexture *tex);
 
 /* GPU Framebuffer
-   - this is a wrapper for an OpenGL framebuffer object (FBO). in practice
-	 multiple FBO's may be created, to get around limitations on the number
-	 of attached textures and the dimension requirements.
-   - after any of the GPU_framebuffer_* functions, GPU_framebuffer_restore must
-	 be called before rendering to the window framebuffer again */
+ * - this is a wrapper for an OpenGL framebuffer object (FBO). in practice
+ *   multiple FBO's may be created, to get around limitations on the number
+ *   of attached textures and the dimension requirements.
+ * - after any of the GPU_framebuffer_* functions, GPU_framebuffer_restore must
+ *   be called before rendering to the window framebuffer again */
 
 GPUFrameBuffer *GPU_framebuffer_create(void);
 int GPU_framebuffer_texture_attach(GPUFrameBuffer *fb, GPUTexture *tex, char err_out[256]);
@@ -142,8 +142,8 @@ void GPU_framebuffer_free(GPUFrameBuffer *fb);
 void GPU_framebuffer_restore(void);
 
 /* GPU OffScreen
-   - wrapper around framebuffer and texture for simple offscreen drawing 
-   - changes size if graphics card can't support it */
+ * - wrapper around framebuffer and texture for simple offscreen drawing
+ * - changes size if graphics card can't support it */
 
 GPUOffScreen *GPU_offscreen_create(int width, int height, char err_out[256]);
 void GPU_offscreen_free(GPUOffScreen *ofs);
@@ -152,8 +152,8 @@ void GPU_offscreen_unbind(GPUOffScreen *ofs);
 void GPU_offscreen_read_pixels(GPUOffScreen *ofs, int type, void *pixels);
 
 /* GPU Shader
-   - only for fragment shaders now
-   - must call texture bind before setting a texture as uniform! */
+ * - only for fragment shaders now
+ * - must call texture bind before setting a texture as uniform! */
 
 GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, const char *libcode); /*GPUShader *lib);*/
 /*GPUShader *GPU_shader_create_lib(const char *code);*/
diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h
index 5689f02..33c5d47 100644
--- a/source/blender/gpu/GPU_material.h
+++ b/source/blender/gpu/GPU_material.h
@@ -29,8 +29,8 @@
  *  \ingroup gpu
  */
 
-#ifndef __GPU_MATERIAL__
-#define __GPU_MATERIAL__
+#ifndef __GPU_MATERIAL_H__
+#define __GPU_MATERIAL_H__
 
 #include "DNA_listBase.h"
 
@@ -46,7 +46,6 @@ struct Lamp;
 struct Image;
 struct bNode;
 struct LinkNode;
-struct LinkInOutsMuteNode;
 struct Scene;
 struct GPUVertexAttribs;
 struct GPUNode;
@@ -116,7 +115,6 @@ GPUNodeLink *GPU_builtin(GPUBuiltin builtin);
 
 int GPU_link(GPUMaterial *mat, const char *name, ...);
 int GPU_stack_link(GPUMaterial *mat, const char *name, GPUNodeStack *in, GPUNodeStack *out, ...);
-int GPU_stack_link_mute(GPUMaterial *mat, const char *name, struct LinkInOutsMuteNode *mlnk);
 
 void GPU_material_output_link(GPUMaterial *material, GPUNodeLink *link);
 void GPU_material_enable_alpha(GPUMaterial *material);
@@ -238,5 +236,5 @@ int GPU_lamp_shadow_layer(GPULamp *lamp);
 }
 #endif
 
-#endif /*__GPU_MATERIAL__*/
+#endif /*__GPU_MATERIAL_H__*/
 
diff --git a/source/blender/gpu/SConscript b/source/blender/gpu/SConscript
index ee4491c..11b0ee5 100644
--- a/source/blender/gpu/SConscript
+++ b/source/blender/gpu/SConscript
@@ -8,11 +8,12 @@ defs = [ 'GLEW_STATIC' ]
 incs = '../blenlib ../blenkernel ../makesdna ../makesrna ../include ../blenloader ../nodes ../nodes/intern'
 incs += ' #/extern/glew/include #intern/guardedalloc #intern/smoke/extern ../imbuf .'
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
 
 incs += ' ' + env['BF_OPENGL_INC']
 
-defs.append('WITH_SMOKE')  # TODO, make optional
+if env['WITH_BF_SMOKE']:
+    defs.append('WITH_SMOKE')
 
 env.BlenderLib ( 'bf_gpu', sources, Split(incs), defines = defs, libtype=['core','player'], priority=[160,110] )
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 99dd398..1dee327 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -38,6 +38,7 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "BLI_bitmap.h"
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
 #include "BLI_ghash.h"
@@ -46,6 +47,8 @@
 #include "DNA_meshdata_types.h"
 
 #include "BKE_DerivedMesh.h"
+#include "BKE_paint.h"
+#include "BKE_subsurf.h"
 
 #include "DNA_userdef_types.h"
 
@@ -70,15 +73,15 @@ static GPUBufferState GLStates = 0;
 static GPUAttrib attribData[MAX_GPU_ATTRIB_DATA] = { { -1, 0, 0 } };
 
 /* stores recently-deleted buffers so that new buffers won't have to
-   be recreated as often
-
-   only one instance of this pool is created, stored in
-   gpu_buffer_pool
-
-   note that the number of buffers in the pool is usually limited to
-   MAX_FREE_GPU_BUFFERS, but this limit may be exceeded temporarily
-   when a GPUBuffer is released outside the main thread; due to OpenGL
-   restrictions it cannot be immediately released
+ * be recreated as often
+ *
+ * only one instance of this pool is created, stored in
+ * gpu_buffer_pool
+ *
+ * note that the number of buffers in the pool is usually limited to
+ * MAX_FREE_GPU_BUFFERS, but this limit may be exceeded temporarily
+ * when a GPUBuffer is released outside the main thread; due to OpenGL
+ * restrictions it cannot be immediately released
  */
 typedef struct GPUBufferPool {
 	/* number of allocated buffers stored */
@@ -95,7 +98,7 @@ static GPUBufferPool *gpu_buffer_pool_new(void)
 	GPUBufferPool *pool;
 
 	/* enable VBOs if supported */
-	if(useVBOs == -1)
+	if (useVBOs == -1)
 		useVBOs = (GLEW_ARB_vertex_buffer_object ? 1 : 0);
 
 	pool = MEM_callocN(sizeof(GPUBufferPool), "GPUBuffer");
@@ -112,15 +115,15 @@ static void gpu_buffer_pool_remove_index(GPUBufferPool *pool, int index)
 {
 	int i;
 
-	if(!pool || index < 0 || index >= pool->totbuf)
+	if (!pool || index < 0 || index >= pool->totbuf)
 		return;
 
 	/* shift entries down, overwriting the buffer at `index' */
-	for(i = index; i < pool->totbuf - 1; i++)
+	for (i = index; i < pool->totbuf - 1; i++)
 		pool->buffers[i] = pool->buffers[i+1];
 
 	/* clear the last entry */
-	if(pool->totbuf > 0)
+	if (pool->totbuf > 0)
 		pool->buffers[pool->totbuf - 1] = NULL;
 
 	pool->totbuf--;
@@ -131,15 +134,15 @@ static void gpu_buffer_pool_delete_last(GPUBufferPool *pool)
 {
 	GPUBuffer *last;
 
-	if(pool->totbuf <= 0)
+	if (pool->totbuf <= 0)
 		return;
 
 	/* get the last entry */
-	if(!(last = pool->buffers[pool->totbuf - 1]))
+	if (!(last = pool->buffers[pool->totbuf - 1]))
 		return;
 
 	/* delete the buffer's data */
-	if(useVBOs)
+	if (useVBOs)
 		glDeleteBuffersARB(1, &last->id);
 	else
 		MEM_freeN(last->pointer);
@@ -151,13 +154,13 @@ static void gpu_buffer_pool_delete_last(GPUBufferPool *pool)
 }
 
 /* free a GPUBufferPool; also frees the data in the pool's
-   GPUBuffers */
+ * GPUBuffers */
 static void gpu_buffer_pool_free(GPUBufferPool *pool)
 {
-	if(!pool)
+	if (!pool)
 		return;
 	
-	while(pool->totbuf)
+	while (pool->totbuf)
 		gpu_buffer_pool_delete_last(pool);
 
 	MEM_freeN(pool->buffers);
@@ -168,7 +171,7 @@ static GPUBufferPool *gpu_buffer_pool = NULL;
 static GPUBufferPool *gpu_get_global_buffer_pool(void)
 {
 	/* initialize the pool */
-	if(!gpu_buffer_pool)
+	if (!gpu_buffer_pool)
 		gpu_buffer_pool = gpu_buffer_pool_new();
 
 	return gpu_buffer_pool;
@@ -181,7 +184,7 @@ void GPU_global_buffer_pool_free(void)
 }
 
 /* get a GPUBuffer of at least `size' bytes; uses one from the buffer
-   pool if possible, otherwise creates a new one */
+ * pool if possible, otherwise creates a new one */
 GPUBuffer *GPU_buffer_alloc(int size)
 {
 	GPUBufferPool *pool;
@@ -191,36 +194,36 @@ GPUBuffer *GPU_buffer_alloc(int size)
 	pool = gpu_get_global_buffer_pool();
 
 	/* not sure if this buffer pool code has been profiled much,
-	   seems to me that the graphics driver and system memory
-	   management might do this stuff anyway. --nicholas
-	*/
+	 * seems to me that the graphics driver and system memory
+	 * management might do this stuff anyway. --nicholas
+	 */
 
 	/* check the global buffer pool for a recently-deleted buffer
-	   that is at least as big as the request, but not more than
-	   twice as big */
-	for(i = 0; i < pool->totbuf; i++) {
+	 * that is at least as big as the request, but not more than
+	 * twice as big */
+	for (i = 0; i < pool->totbuf; i++) {
 		bufsize = pool->buffers[i]->size;
 
 		/* check for an exact size match */
-		if(bufsize == size) {
+		if (bufsize == size) {
 			bestfit = i;
 			break;
 		}
 		/* smaller buffers won't fit data and buffers at least
-		   twice as big are a waste of memory */
-		else if(bufsize > size && size > (bufsize / 2)) {
+		 * twice as big are a waste of memory */
+		else if (bufsize > size && size > (bufsize / 2)) {
 			/* is it closer to the required size than the
-			   last appropriate buffer found. try to save
-			   memory */
-			if(bestfit == -1 || pool->buffers[bestfit]->size > bufsize) {
+			 * last appropriate buffer found. try to save
+			 * memory */
+			if (bestfit == -1 || pool->buffers[bestfit]->size > bufsize) {
 				bestfit = i;
 			}
 		}
 	}
 
 	/* if an acceptable buffer was found in the pool, remove it
-	   from the pool and return it */
-	if(bestfit != -1) {
+	 * from the pool and return it */
+	if (bestfit != -1) {
 		buf = pool->buffers[bestfit];
 		gpu_buffer_pool_remove_index(pool, bestfit);
 		return buf;
@@ -230,9 +233,9 @@ GPUBuffer *GPU_buffer_alloc(int size)
 	buf = MEM_callocN(sizeof(GPUBuffer), "GPUBuffer");
 	buf->size = size;
 
-	if(useVBOs == 1) {
+	if (useVBOs == 1) {
 		/* create a new VBO and initialize it to the requested
-		   size */
+		 * size */
 		glGenBuffersARB(1, &buf->id);
 		glBindBufferARB(GL_ARRAY_BUFFER_ARB, buf->id);
 		glBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_STATIC_DRAW_ARB);
@@ -242,14 +245,14 @@ GPUBuffer *GPU_buffer_alloc(int size)
 		buf->pointer = MEM_mallocN(size, "GPUBuffer.pointer");
 		
 		/* purpose of this seems to be dealing with
-		   out-of-memory errors? looks a bit iffy to me
-		   though, at least on Linux I expect malloc() would
-		   just overcommit. --nicholas */
-		while(!buf->pointer && pool->totbuf > 0) {
+		 * out-of-memory errors? looks a bit iffy to me
+		 * though, at least on Linux I expect malloc() would
+		 * just overcommit. --nicholas */
+		while (!buf->pointer && pool->totbuf > 0) {
 			gpu_buffer_pool_delete_last(pool);
 			buf->pointer = MEM_mallocN(size, "GPUBuffer.pointer");
 		}
-		if(!buf->pointer)
+		if (!buf->pointer)
 			return NULL;
 	}
 
@@ -257,32 +260,32 @@ GPUBuffer *GPU_buffer_alloc(int size)
 }
 
 /* release a GPUBuffer; does not free the actual buffer or its data,
-   but rather moves it to the pool of recently-free'd buffers for
-   possible re-use*/
+ * but rather moves it to the pool of recently-freed buffers for
+ * possible re-use*/
 void GPU_buffer_free(GPUBuffer *buffer)
 {
 	GPUBufferPool *pool;
 	int i;
 
-	if(!buffer)
+	if (!buffer)
 		return;
 
 	pool = gpu_get_global_buffer_pool();
 
 	/* free the last used buffer in the queue if no more space, but only
-	   if we are in the main thread. for e.g. rendering or baking it can
-	   happen that we are in other thread and can't call OpenGL, in that
-	   case cleanup will be done GPU_buffer_pool_free_unused */
-	if(BLI_thread_is_main()) {
+	 * if we are in the main thread. for e.g. rendering or baking it can
+	 * happen that we are in other thread and can't call OpenGL, in that
+	 * case cleanup will be done GPU_buffer_pool_free_unused */
+	if (BLI_thread_is_main()) {
 		/* in main thread, safe to decrease size of pool back
-		   down to MAX_FREE_GPU_BUFFERS */
-		while(pool->totbuf >= MAX_FREE_GPU_BUFFERS)
+		 * down to MAX_FREE_GPU_BUFFERS */
+		while (pool->totbuf >= MAX_FREE_GPU_BUFFERS)
 			gpu_buffer_pool_delete_last(pool);
 	}
 	else {
 		/* outside of main thread, can't safely delete the
-		   buffer, so increase pool size */
-		if(pool->maxsize == pool->totbuf) {
+		 * buffer, so increase pool size */
+		if (pool->maxsize == pool->totbuf) {
 			pool->maxsize += MAX_FREE_GPU_BUFFERS;
 			pool->buffers = MEM_reallocN(pool->buffers,
 						     sizeof(GPUBuffer*) * pool->maxsize);
@@ -290,7 +293,7 @@ void GPU_buffer_free(GPUBuffer *buffer)
 	}
 
 	/* shift pool entries up by one */
-	for(i = pool->totbuf; i > 0; i--)
+	for (i = pool->totbuf; i > 0; i--)
 		pool->buffers[i] = pool->buffers[i-1];
 
 	/* insert the buffer into the beginning of the pool */
@@ -305,7 +308,7 @@ typedef struct GPUVertPointLink {
 } GPUVertPointLink;
 
 /* add a new point to the list of points related to a particular
-   vertex */
+ * vertex */
 static void gpu_drawobject_add_vert_point(GPUDrawObject *gdo, int vert_index, int point_index)
 {
 	GPUVertPointLink *lnk;
@@ -313,9 +316,9 @@ static void gpu_drawobject_add_vert_point(GPUDrawObject *gdo, int vert_index, in
 	lnk = &gdo->vert_points[vert_index];
 
 	/* if first link is in use, add a new link at the end */
-	if(lnk->point_index != -1) {
+	if (lnk->point_index != -1) {
 		/* get last link */
-		for(; lnk->next; lnk = lnk->next);
+		for (; lnk->next; lnk = lnk->next);
 
 		/* add a new link from the pool */
 		lnk = lnk->next = &gdo->vert_points_mem[gdo->vert_points_usage];
@@ -326,20 +329,20 @@ static void gpu_drawobject_add_vert_point(GPUDrawObject *gdo, int vert_index, in
 }
 
 /* update the vert_points and triangle_to_mface fields with a new
-   triangle */
+ * triangle */
 static void gpu_drawobject_add_triangle(GPUDrawObject *gdo,
 					int base_point_index,
 					int face_index,
 					int v1, int v2, int v3)
 {
 	int i, v[3] = {v1, v2, v3};
-	for(i = 0; i < 3; i++)
+	for (i = 0; i < 3; i++)
 		gpu_drawobject_add_vert_point(gdo, v[i], base_point_index + i);
 	gdo->triangle_to_mface[base_point_index / 3] = face_index;
 }
 
 /* for each vertex, build a list of points related to it; these lists
-   are stored in an array sized to the number of vertices */
+ * are stored in an array sized to the number of vertices */
 static void gpu_drawobject_init_vert_points(GPUDrawObject *gdo, MFace *f, int totface)
 {
 	GPUBufferMaterial *mat;
@@ -353,15 +356,15 @@ static void gpu_drawobject_init_vert_points(GPUDrawObject *gdo, MFace *f, int to
 	gdo->vert_points_usage = 0;
 
 	/* build a map from the original material indices to the new
-	   GPUBufferMaterial indices */
-	for(i = 0; i < gdo->totmaterial; i++)
+	 * GPUBufferMaterial indices */
+	for (i = 0; i < gdo->totmaterial; i++)
 		mat_orig_to_new[gdo->materials[i].mat_nr] = i;
 
 	/* -1 indicates the link is not yet used */
-	for(i = 0; i < gdo->totvert; i++)
+	for (i = 0; i < gdo->totvert; i++)
 		gdo->vert_points[i].point_index = -1;
 
-	for(i = 0; i < totface; i++, f++) {
+	for (i = 0; i < totface; i++, f++) {
 		mat = &gdo->materials[mat_orig_to_new[f->mat_nr]];
 
 		/* add triangle */
@@ -370,7 +373,7 @@ static void gpu_drawobject_init_vert_points(GPUDrawObject *gdo, MFace *f, int to
 		mat->totpoint += 3;
 
 		/* add second triangle for quads */
-		if(f->v4) {
+		if (f->v4) {
 			gpu_drawobject_add_triangle(gdo, mat->start + mat->totpoint,
 						    i, f->v3, f->v4, f->v1);
 			mat->totpoint += 3;
@@ -378,8 +381,8 @@ static void gpu_drawobject_init_vert_points(GPUDrawObject *gdo, MFace *f, int to
 	}
 
 	/* map any unused vertices to loose points */
-	for(i = 0; i < gdo->totvert; i++) {
-		if(gdo->vert_points[i].point_index == -1) {
+	for (i = 0; i < gdo->totvert; i++) {
+		if (gdo->vert_points[i].point_index == -1) {
 			gdo->vert_points[i].point_index = gdo->tot_triangle_point + gdo->tot_loose_point;
 			gdo->tot_loose_point++;
 		}
@@ -387,7 +390,7 @@ static void gpu_drawobject_init_vert_points(GPUDrawObject *gdo, MFace *f, int to
 }
 
 /* see GPUDrawObject's structure definition for a description of the
-   data being initialized here */
+ * data being initialized here */
 GPUDrawObject *GPU_drawobject_new( DerivedMesh *dm )
 {
 	GPUDrawObject *gdo;
@@ -395,13 +398,13 @@ GPUDrawObject *GPU_drawobject_new( DerivedMesh *dm )
 	int points_per_mat[MAX_MATERIALS];
 	int i, curmat, curpoint, totface;
 
-	mface = dm->getFaceArray(dm);
-	totface= dm->getNumFaces(dm);
+	mface = dm->getTessFaceArray(dm);
+	totface= dm->getNumTessFaces(dm);
 
 	/* get the number of points used by each material, treating
-	   each quad as two triangles */
+	 * each quad as two triangles */
 	memset(points_per_mat, 0, sizeof(int)*MAX_MATERIALS);
-	for(i = 0; i < totface; i++)
+	for (i = 0; i < totface; i++)
 		points_per_mat[mface[i].mat_nr] += mface[i].v4 ? 6 : 3;
 
 	/* create the GPUDrawObject */
@@ -410,8 +413,8 @@ GPUDrawObject *GPU_drawobject_new( DerivedMesh *dm )
 	gdo->totedge = dm->getNumEdges(dm);
 
 	/* count the number of materials used by this DerivedMesh */
-	for(i = 0; i < MAX_MATERIALS; i++) {
-		if(points_per_mat[i] > 0)
+	for (i = 0; i < MAX_MATERIALS; i++) {
+		if (points_per_mat[i] > 0)
 			gdo->totmaterial++;
 	}
 
@@ -420,8 +423,8 @@ GPUDrawObject *GPU_drawobject_new( DerivedMesh *dm )
 				     "GPUDrawObject.materials");
 
 	/* initialize the materials array */
-	for(i = 0, curmat = 0, curpoint = 0; i < MAX_MATERIALS; i++) {
-		if(points_per_mat[i] > 0) {
+	for (i = 0, curmat = 0, curpoint = 0; i < MAX_MATERIALS; i++) {
+		if (points_per_mat[i] > 0) {
 			gdo->materials[curmat].start = curpoint;
 			gdo->materials[curmat].totpoint = 0;
 			gdo->materials[curmat].mat_nr = i;
@@ -446,7 +449,7 @@ void GPU_drawobject_free(DerivedMesh *dm)
 {
 	GPUDrawObject *gdo;
 
-	if(!dm || !(gdo = dm->drawObject))
+	if (!dm || !(gdo = dm->drawObject))
 		return;
 
 	MEM_freeN(gdo->materials);
@@ -483,50 +486,50 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object,
 	pool = gpu_get_global_buffer_pool();
 
 	/* alloc a GPUBuffer; fall back to legacy mode on failure */
-	if(!(buffer = GPU_buffer_alloc(size)))
+	if (!(buffer = GPU_buffer_alloc(size)))
 		dm->drawObject->legacy = 1;
 
 	/* nothing to do for legacy mode */
-	if(dm->drawObject->legacy)
+	if (dm->drawObject->legacy)
 		return NULL;
 
 	cur_index_per_mat = MEM_mallocN(sizeof(int)*object->totmaterial,
 					"GPU_buffer_setup.cur_index_per_mat");
-	for(i = 0; i < object->totmaterial; i++) {
+	for (i = 0; i < object->totmaterial; i++) {
 		/* for each material, the current index to copy data to */
 		cur_index_per_mat[i] = object->materials[i].start * vector_size;
 
 		/* map from original material index to new
-		   GPUBufferMaterial index */
+		 * GPUBufferMaterial index */
 		mat_orig_to_new[object->materials[i].mat_nr] = i;
 	}
 
-	if(useVBOs) {
+	if (useVBOs) {
 		success = 0;
 
-		while(!success) {
+		while (!success) {
 			/* bind the buffer and discard previous data,
-			   avoids stalling gpu */
+			 * avoids stalling gpu */
 			glBindBufferARB(target, buffer->id);
 			glBufferDataARB(target, buffer->size, NULL, GL_STATIC_DRAW_ARB);
 
 			/* attempt to map the buffer */
-			if(!(varray = glMapBufferARB(target, GL_WRITE_ONLY_ARB))) {
+			if (!(varray = glMapBufferARB(target, GL_WRITE_ONLY_ARB))) {
 				/* failed to map the buffer; delete it */
 				GPU_buffer_free(buffer);
 				gpu_buffer_pool_delete_last(pool);
 				buffer= NULL;
 
 				/* try freeing an entry from the pool
-				   and reallocating the buffer */
-				if(pool->totbuf > 0) {
+				 * and reallocating the buffer */
+				if (pool->totbuf > 0) {
 					gpu_buffer_pool_delete_last(pool);
 					buffer = GPU_buffer_alloc(size);
 				}
 
 				/* allocation still failed; fall back
-				   to legacy mode */
-				if(!buffer) {
+				 * to legacy mode */
+				if (!buffer) {
 					dm->drawObject->legacy = 1;
 					success = 1;
 				}
@@ -537,10 +540,10 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object,
 		}
 
 		/* check legacy fallback didn't happen */
-		if(dm->drawObject->legacy == 0) {
+		if (dm->drawObject->legacy == 0) {
 			uploaded = GL_FALSE;
 			/* attempt to upload the data to the VBO */
-			while(uploaded == GL_FALSE) {
+			while (uploaded == GL_FALSE) {
 				(*copy_f)(dm, varray, cur_index_per_mat, mat_orig_to_new, user);
 				/* glUnmapBuffer returns GL_FALSE if
 				 * the data store is corrupted; retry
@@ -552,7 +555,7 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object,
 	}
 	else {
 		/* VBO not supported, use vertex array fallback */
-		if(buffer->pointer) {
+		if (buffer->pointer) {
 			varray = buffer->pointer;
 			(*copy_f)(dm, varray, cur_index_per_mat, mat_orig_to_new, user);
 		}
@@ -573,10 +576,10 @@ static void GPU_buffer_copy_vertex(DerivedMesh *dm, float *varray, int *index, i
 	int i, j, start, totface;
 
 	mvert = dm->getVertArray(dm);
-	f = dm->getFaceArray(dm);
+	f = dm->getTessFaceArray(dm);
 
-	totface= dm->getNumFaces(dm);
-	for(i = 0; i < totface; i++, f++) {
+	totface= dm->getNumTessFaces(dm);
+	for (i = 0; i < totface; i++, f++) {
 		start = index[mat_orig_to_new[f->mat_nr]];
 
 		/* v1 v2 v3 */
@@ -585,7 +588,7 @@ static void GPU_buffer_copy_vertex(DerivedMesh *dm, float *varray, int *index, i
 		copy_v3_v3(&varray[start+6], mvert[f->v3].co);
 		index[mat_orig_to_new[f->mat_nr]] += 9;
 
-		if(f->v4) {
+		if (f->v4) {
 			/* v3 v4 v1 */
 			copy_v3_v3(&varray[start+9], mvert[f->v3].co);
 			copy_v3_v3(&varray[start+12], mvert[f->v4].co);
@@ -596,8 +599,8 @@ static void GPU_buffer_copy_vertex(DerivedMesh *dm, float *varray, int *index, i
 
 	/* copy loose points */
 	j = dm->drawObject->tot_triangle_point*3;
-	for(i = 0; i < dm->drawObject->totvert; i++) {
-		if(dm->drawObject->vert_points[i].point_index >= dm->drawObject->tot_triangle_point) {
+	for (i = 0; i < dm->drawObject->totvert; i++) {
+		if (dm->drawObject->vert_points[i].point_index >= dm->drawObject->tot_triangle_point) {
 			copy_v3_v3(&varray[j],mvert[i].co);
 			j+=3;
 		}
@@ -610,36 +613,36 @@ static void GPU_buffer_copy_normal(DerivedMesh *dm, float *varray, int *index, i
 	int start;
 	float f_no[3];
 
-	float *nors= dm->getFaceDataArray(dm, CD_NORMAL);
+	float *nors= dm->getTessFaceDataArray(dm, CD_NORMAL);
 	MVert *mvert = dm->getVertArray(dm);
-	MFace *f = dm->getFaceArray(dm);
+	MFace *f = dm->getTessFaceArray(dm);
 
-	totface= dm->getNumFaces(dm);
-	for(i = 0; i < totface; i++, f++) {
+	totface= dm->getNumTessFaces(dm);
+	for (i = 0; i < totface; i++, f++) {
 		const int smoothnormal = (f->flag & ME_SMOOTH);
 
 		start = index[mat_orig_to_new[f->mat_nr]];
 		index[mat_orig_to_new[f->mat_nr]] += f->v4 ? 18 : 9;
 
-		if(smoothnormal) {
+		if (smoothnormal) {
 			/* copy vertex normal */
 			normal_short_to_float_v3(&varray[start], mvert[f->v1].no);
 			normal_short_to_float_v3(&varray[start+3], mvert[f->v2].no);
 			normal_short_to_float_v3(&varray[start+6], mvert[f->v3].no);
 
-			if(f->v4) {
+			if (f->v4) {
 				normal_short_to_float_v3(&varray[start+9], mvert[f->v3].no);
 				normal_short_to_float_v3(&varray[start+12], mvert[f->v4].no);
 				normal_short_to_float_v3(&varray[start+15], mvert[f->v1].no);
 			}
 		}
-		else if(nors) {
+		else if (nors) {
 			/* copy cached face normal */
 			copy_v3_v3(&varray[start], &nors[i*3]);
 			copy_v3_v3(&varray[start+3], &nors[i*3]);
 			copy_v3_v3(&varray[start+6], &nors[i*3]);
 
-			if(f->v4) {
+			if (f->v4) {
 				copy_v3_v3(&varray[start+9], &nors[i*3]);
 				copy_v3_v3(&varray[start+12], &nors[i*3]);
 				copy_v3_v3(&varray[start+15], &nors[i*3]);
@@ -647,7 +650,7 @@ static void GPU_buffer_copy_normal(DerivedMesh *dm, float *varray, int *index, i
 		}
 		else {
 			/* calculate face normal */
-			if(f->v4)
+			if (f->v4)
 				normal_quad_v3(f_no, mvert[f->v1].co, mvert[f->v2].co, mvert[f->v3].co, mvert[f->v4].co);
 			else
 				normal_tri_v3(f_no, mvert[f->v1].co, mvert[f->v2].co, mvert[f->v3].co);
@@ -656,7 +659,7 @@ static void GPU_buffer_copy_normal(DerivedMesh *dm, float *varray, int *index, i
 			copy_v3_v3(&varray[start+3], f_no);
 			copy_v3_v3(&varray[start+6], f_no);
 
-			if(f->v4) {
+			if (f->v4) {
 				copy_v3_v3(&varray[start+9], f_no);
 				copy_v3_v3(&varray[start+12], f_no);
 				copy_v3_v3(&varray[start+15], f_no);
@@ -673,12 +676,12 @@ static void GPU_buffer_copy_uv(DerivedMesh *dm, float *varray, int *index, int *
 	MTFace *mtface;
 	MFace *f;
 
-	if(!(mtface = DM_get_face_data_layer(dm, CD_MTFACE)))
+	if (!(mtface = DM_get_tessface_data_layer(dm, CD_MTFACE)))
 		return;
-	f = dm->getFaceArray(dm);
+	f = dm->getTessFaceArray(dm);
 		
-	totface = dm->getNumFaces(dm);
-	for(i = 0; i < totface; i++, f++) {
+	totface = dm->getNumTessFaces(dm);
+	for (i = 0; i < totface; i++, f++) {
 		start = index[mat_orig_to_new[f->mat_nr]];
 
 		/* v1 v2 v3 */
@@ -687,7 +690,7 @@ static void GPU_buffer_copy_uv(DerivedMesh *dm, float *varray, int *index, int *
 		copy_v2_v2(&varray[start+4],mtface[i].uv[2]);
 		index[mat_orig_to_new[f->mat_nr]] += 6;
 
-		if(f->v4) {
+		if (f->v4) {
 			/* v3 v4 v1 */
 			copy_v2_v2(&varray[start+6],mtface[i].uv[2]);
 			copy_v2_v2(&varray[start+8],mtface[i].uv[3]);
@@ -703,10 +706,10 @@ static void GPU_buffer_copy_color3(DerivedMesh *dm, float *varray_, int *index,
 	int i, totface;
 	char *varray = (char *)varray_;
 	char *mcol = (char *)user;
-	MFace *f = dm->getFaceArray(dm);
+	MFace *f = dm->getTessFaceArray(dm);
 
-	totface= dm->getNumFaces(dm);
-	for(i=0; i < totface; i++, f++) {
+	totface= dm->getNumTessFaces(dm);
+	for (i=0; i < totface; i++, f++) {
 		int start = index[mat_orig_to_new[f->mat_nr]];
 
 		/* v1 v2 v3 */
@@ -715,7 +718,7 @@ static void GPU_buffer_copy_color3(DerivedMesh *dm, float *varray_, int *index,
 		copy_v3_v3_char(&varray[start+6], &mcol[i*12+6]);
 		index[mat_orig_to_new[f->mat_nr]] += 9;
 
-		if(f->v4) {
+		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]);
@@ -738,10 +741,10 @@ static void GPU_buffer_copy_mcol(DerivedMesh *dm, float *varray_, int *index, in
 	int i, totface;
 	unsigned char *varray = (unsigned char *)varray_;
 	unsigned char *mcol = (unsigned char *)user;
-	MFace *f = dm->getFaceArray(dm);
+	MFace *f = dm->getTessFaceArray(dm);
 
-	totface= dm->getNumFaces(dm);
-	for(i=0; i < totface; i++, f++) {
+	totface= dm->getNumTessFaces(dm);
+	for (i=0; i < totface; i++, f++) {
 		int start = index[mat_orig_to_new[f->mat_nr]];
 
 		/* v1 v2 v3 */
@@ -750,7 +753,7 @@ static void GPU_buffer_copy_mcol(DerivedMesh *dm, float *varray_, int *index, in
 		copy_mcol_uc3(&varray[start+6], &mcol[i*16+8]);
 		index[mat_orig_to_new[f->mat_nr]] += 9;
 
-		if(f->v4) {
+		if (f->v4) {
 			/* v3 v4 v1 */
 			copy_mcol_uc3(&varray[start+9], &mcol[i*16+8]);
 			copy_mcol_uc3(&varray[start+12], &mcol[i*16+12]);
@@ -769,7 +772,7 @@ static void GPU_buffer_copy_edge(DerivedMesh *dm, float *varray_, int *UNUSED(in
 	medge = dm->getEdgeArray(dm);
 	totedge = dm->getNumEdges(dm);
 
-	for(i = 0; i < totedge; i++, medge++) {
+	for (i = 0; i < totedge; i++, medge++) {
 		varray[i*2] = dm->drawObject->vert_points[medge->v1].point_index;
 		varray[i*2+1] = dm->drawObject->vert_points[medge->v2].point_index;
 	}
@@ -777,15 +780,15 @@ static void GPU_buffer_copy_edge(DerivedMesh *dm, float *varray_, int *UNUSED(in
 
 static void GPU_buffer_copy_uvedge(DerivedMesh *dm, float *varray, int *UNUSED(index), int *UNUSED(mat_orig_to_new), void *UNUSED(user))
 {
-	MTFace *tf = DM_get_face_data_layer(dm, CD_MTFACE);
+	MTFace *tf = DM_get_tessface_data_layer(dm, CD_MTFACE);
 	int i, j=0;
 
-	if(!tf)
+	if (!tf)
 		return;
 
-	for(i = 0; i < dm->numFaceData; i++, tf++) {
+	for (i = 0; i < dm->numTessFaceData; i++, tf++) {
 		MFace mf;
-		dm->getFace(dm,i,&mf);
+		dm->getTessFace(dm,i,&mf);
 
 		copy_v2_v2(&varray[j],tf->uv[0]);
 		copy_v2_v2(&varray[j+2],tf->uv[1]);
@@ -793,11 +796,12 @@ static void GPU_buffer_copy_uvedge(DerivedMesh *dm, float *varray, int *UNUSED(i
 		copy_v2_v2(&varray[j+4],tf->uv[1]);
 		copy_v2_v2(&varray[j+6],tf->uv[2]);
 
-		if(!mf.v4) {
+		if (!mf.v4) {
 			copy_v2_v2(&varray[j+8],tf->uv[2]);
 			copy_v2_v2(&varray[j+10],tf->uv[0]);
 			j+=12;
-		} else {
+		}
+		else {
 			copy_v2_v2(&varray[j+8],tf->uv[2]);
 			copy_v2_v2(&varray[j+10],tf->uv[3]);
 
@@ -809,20 +813,20 @@ 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_WEIGHT_MCOL, or CD_MCOL */
+ * 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_face_data_layer(dm, type);
-	if(!c) {
-		type = CD_WEIGHT_MCOL;
-		c = DM_get_face_data_layer(dm, type);
-		if(!c) {
+	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_face_data_layer(dm, type);
+			c = DM_get_tessface_data_layer(dm, type);
 		}
 	}
 
@@ -891,11 +895,11 @@ static int gpu_buffer_size_from_type(DerivedMesh *dm, GPUBufferType type)
 		return sizeof(int)*2*dm->drawObject->totedge;
 	case GPU_BUFFER_UVEDGE:
 		/* each face gets 3 points, 3 edges per triangle, and
-		   each edge has its own, non-shared coords, so each
-		   tri corner needs minimum of 4 floats, quads used
-		   less so here we can over allocate and assume all
-		   tris. */
-		return sizeof(float) * dm->drawObject->tot_triangle_point;
+		 * each edge has its own, non-shared coords, so each
+		 * tri corner needs minimum of 4 floats, quads used
+		 * less so here we can over allocate and assume all
+		 * tris. */
+		return sizeof(float) * 4 * dm->drawObject->tot_triangle_point;
 	default:
 		return -1;
 	}
@@ -911,12 +915,12 @@ static GPUBuffer *gpu_buffer_setup_type(DerivedMesh *dm, GPUBufferType type)
 	ts = &gpu_buffer_type_settings[type];
 
 	/* special handling for MCol and UV buffers */
-	if(type == GPU_BUFFER_COLOR) {
-		if(!(user_data = gpu_buffer_color_type(dm)))
+	if (type == GPU_BUFFER_COLOR) {
+		if (!(user_data = gpu_buffer_color_type(dm)))
 			return NULL;
 	}
-	else if(type == GPU_BUFFER_UV) {
-		if(!DM_get_face_data_layer(dm, CD_MTFACE))
+	else if (type == GPU_BUFFER_UV) {
+		if (!DM_get_tessface_data_layer(dm, CD_MTFACE))
 			return NULL;
 	}
 
@@ -928,16 +932,16 @@ static GPUBuffer *gpu_buffer_setup_type(DerivedMesh *dm, GPUBufferType type)
 }
 
 /* get the buffer of `type', initializing the GPUDrawObject and
-   buffer if needed */
+ * buffer if needed */
 static GPUBuffer *gpu_buffer_setup_common(DerivedMesh *dm, GPUBufferType type)
 {
 	GPUBuffer **buf;
 	
-	if(!dm->drawObject)
+	if (!dm->drawObject)
 		dm->drawObject = GPU_drawobject_new(dm);
 
 	buf = gpu_drawobject_buffer_from_type(dm->drawObject, type);
-	if(!(*buf))
+	if (!(*buf))
 		*buf = gpu_buffer_setup_type(dm, type);
 
 	return *buf;
@@ -945,11 +949,11 @@ static GPUBuffer *gpu_buffer_setup_common(DerivedMesh *dm, GPUBufferType type)
 
 void GPU_vertex_setup(DerivedMesh *dm)
 {
-	if(!gpu_buffer_setup_common(dm, GPU_BUFFER_VERTEX))
+	if (!gpu_buffer_setup_common(dm, GPU_BUFFER_VERTEX))
 		return;
 
 	glEnableClientState(GL_VERTEX_ARRAY);
-	if(useVBOs) {
+	if (useVBOs) {
 		glBindBufferARB(GL_ARRAY_BUFFER_ARB, dm->drawObject->points->id);
 		glVertexPointer(3, GL_FLOAT, 0, 0);
 	}
@@ -962,11 +966,11 @@ void GPU_vertex_setup(DerivedMesh *dm)
 
 void GPU_normal_setup(DerivedMesh *dm)
 {
-	if(!gpu_buffer_setup_common(dm, GPU_BUFFER_NORMAL))
+	if (!gpu_buffer_setup_common(dm, GPU_BUFFER_NORMAL))
 		return;
 
 	glEnableClientState(GL_NORMAL_ARRAY);
-	if(useVBOs) {
+	if (useVBOs) {
 		glBindBufferARB(GL_ARRAY_BUFFER_ARB, dm->drawObject->normals->id);
 		glNormalPointer(GL_FLOAT, 0, 0);
 	}
@@ -979,11 +983,11 @@ void GPU_normal_setup(DerivedMesh *dm)
 
 void GPU_uv_setup(DerivedMesh *dm)
 {
-	if(!gpu_buffer_setup_common(dm, GPU_BUFFER_UV))
+	if (!gpu_buffer_setup_common(dm, GPU_BUFFER_UV))
 		return;
 
 	glEnableClientState(GL_TEXTURE_COORD_ARRAY);
-	if(useVBOs) {
+	if (useVBOs) {
 		glBindBufferARB(GL_ARRAY_BUFFER_ARB, dm->drawObject->uv->id);
 		glTexCoordPointer(2, GL_FLOAT, 0, 0);
 	}
@@ -996,11 +1000,11 @@ void GPU_uv_setup(DerivedMesh *dm)
 
 void GPU_color_setup(DerivedMesh *dm)
 {
-	if(!gpu_buffer_setup_common(dm, GPU_BUFFER_COLOR))
+	if (!gpu_buffer_setup_common(dm, GPU_BUFFER_COLOR))
 		return;
 
 	glEnableClientState(GL_COLOR_ARRAY);
-	if(useVBOs) {
+	if (useVBOs) {
 		glBindBufferARB(GL_ARRAY_BUFFER_ARB, dm->drawObject->colors->id);
 		glColorPointer(3, GL_UNSIGNED_BYTE, 0, 0);
 	}
@@ -1013,14 +1017,14 @@ void GPU_color_setup(DerivedMesh *dm)
 
 void GPU_edge_setup(DerivedMesh *dm)
 {
-	if(!gpu_buffer_setup_common(dm, GPU_BUFFER_EDGE))
+	if (!gpu_buffer_setup_common(dm, GPU_BUFFER_EDGE))
 		return;
 
-	if(!gpu_buffer_setup_common(dm, GPU_BUFFER_VERTEX))
+	if (!gpu_buffer_setup_common(dm, GPU_BUFFER_VERTEX))
 		return;
 
 	glEnableClientState(GL_VERTEX_ARRAY);
-	if(useVBOs) {
+	if (useVBOs) {
 		glBindBufferARB(GL_ARRAY_BUFFER_ARB, dm->drawObject->points->id);
 		glVertexPointer(3, GL_FLOAT, 0, 0);
 	}
@@ -1030,7 +1034,7 @@ void GPU_edge_setup(DerivedMesh *dm)
 	
 	GLStates |= GPU_BUFFER_VERTEX_STATE;
 
-	if(useVBOs)
+	if (useVBOs)
 		glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, dm->drawObject->edges->id);
 
 	GLStates |= GPU_BUFFER_ELEMENT_STATE;
@@ -1038,11 +1042,11 @@ void GPU_edge_setup(DerivedMesh *dm)
 
 void GPU_uvedge_setup(DerivedMesh *dm)
 {
-	if(!gpu_buffer_setup_common(dm, GPU_BUFFER_UVEDGE))
+	if (!gpu_buffer_setup_common(dm, GPU_BUFFER_UVEDGE))
 		return;
 
 	glEnableClientState(GL_VERTEX_ARRAY);
-	if(useVBOs) {
+	if (useVBOs) {
 		glBindBufferARB(GL_ARRAY_BUFFER_ARB, dm->drawObject->uvedges->id);
 		glVertexPointer(2, GL_FLOAT, 0, 0);
 	}
@@ -1075,9 +1079,9 @@ int GPU_attrib_element_size(GPUAttrib data[], int numdata)
 {
 	int i, elementsize = 0;
 
-	for(i = 0; i < numdata; i++) {
+	for (i = 0; i < numdata; i++) {
 		int typesize = GPU_typesize(data[i].type);
-		if(typesize != 0)
+		if (typesize != 0)
 			elementsize += typesize*data[i].size;
 	}
 	return elementsize;
@@ -1089,8 +1093,8 @@ void GPU_interleaved_attrib_setup(GPUBuffer *buffer, GPUAttrib data[], int numda
 	int elementsize;
 	intptr_t offset = 0;
 
-	for(i = 0; i < MAX_GPU_ATTRIB_DATA; i++) {
-		if(attribData[i].index != -1) {
+	for (i = 0; i < MAX_GPU_ATTRIB_DATA; i++) {
+		if (attribData[i].index != -1) {
 			glDisableVertexAttribArrayARB(attribData[i].index);
 		}
 		else
@@ -1098,9 +1102,9 @@ void GPU_interleaved_attrib_setup(GPUBuffer *buffer, GPUAttrib data[], int numda
 	}
 	elementsize = GPU_attrib_element_size(data, numdata);
 
-	if(useVBOs) {
+	if (useVBOs) {
 		glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffer->id);
-		for(i = 0; i < numdata; i++) {
+		for (i = 0; i < numdata; i++) {
 			glEnableVertexAttribArrayARB(data[i].index);
 			glVertexAttribPointerARB(data[i].index, data[i].size, data[i].type,
 						 GL_FALSE, elementsize, (void *)offset);
@@ -1113,7 +1117,7 @@ void GPU_interleaved_attrib_setup(GPUBuffer *buffer, GPUAttrib data[], int numda
 		attribData[numdata].index = -1;
 	}
 	else {
-		for(i = 0; i < numdata; i++) {
+		for (i = 0; i < numdata; i++) {
 			glEnableVertexAttribArrayARB(data[i].index);
 			glVertexAttribPointerARB(data[i].index, data[i].size, data[i].type,
 						 GL_FALSE, elementsize, (char *)buffer->pointer + offset);
@@ -1127,16 +1131,16 @@ void GPU_buffer_unbind(void)
 {
 	int i;
 
-	if(GLStates & GPU_BUFFER_VERTEX_STATE)
+	if (GLStates & GPU_BUFFER_VERTEX_STATE)
 		glDisableClientState(GL_VERTEX_ARRAY);
-	if(GLStates & GPU_BUFFER_NORMAL_STATE)
+	if (GLStates & GPU_BUFFER_NORMAL_STATE)
 		glDisableClientState(GL_NORMAL_ARRAY);
-	if(GLStates & GPU_BUFFER_TEXCOORD_STATE)
+	if (GLStates & GPU_BUFFER_TEXCOORD_STATE)
 		glDisableClientState(GL_TEXTURE_COORD_ARRAY);
-	if(GLStates & GPU_BUFFER_COLOR_STATE)
+	if (GLStates & GPU_BUFFER_COLOR_STATE)
 		glDisableClientState(GL_COLOR_ARRAY);
-	if(GLStates & GPU_BUFFER_ELEMENT_STATE) {
-		if(useVBOs) {
+	if (GLStates & GPU_BUFFER_ELEMENT_STATE) {
+		if (useVBOs) {
 			glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
 		}
 	}
@@ -1144,24 +1148,24 @@ void GPU_buffer_unbind(void)
 	              GPU_BUFFER_TEXCOORD_STATE | GPU_BUFFER_COLOR_STATE |
 	              GPU_BUFFER_ELEMENT_STATE);
 
-	for(i = 0; i < MAX_GPU_ATTRIB_DATA; i++) {
-		if(attribData[i].index != -1) {
+	for (i = 0; i < MAX_GPU_ATTRIB_DATA; i++) {
+		if (attribData[i].index != -1) {
 			glDisableVertexAttribArrayARB(attribData[i].index);
 		}
 		else
 			break;
 	}
 
-	if(useVBOs)
+	if (useVBOs)
 		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 */
+ * 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)
+	if (dm->drawObject == 0)
 		dm->drawObject = GPU_drawobject_new(dm);
 	GPU_buffer_free(dm->drawObject->colors);
 
@@ -1170,41 +1174,29 @@ void GPU_color3_upload(DerivedMesh *dm, unsigned char *data)
 						  GL_ARRAY_BUFFER_ARB, data, GPU_buffer_copy_color3);
 }
 
-/* this is used only in cdDM_drawFacesColored, which I think is no
-   longer used, so can probably remove this --nicholas */
-void GPU_color4_upload(DerivedMesh *UNUSED(dm), unsigned char *UNUSED(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_color4);*/
-}
-
 void GPU_color_switch(int mode)
 {
-	if(mode) {
-		if(!(GLStates & GPU_BUFFER_COLOR_STATE))
+	if (mode) {
+		if (!(GLStates & GPU_BUFFER_COLOR_STATE))
 			glEnableClientState(GL_COLOR_ARRAY);
 		GLStates |= GPU_BUFFER_COLOR_STATE;
 	}
 	else {
-		if(GLStates & GPU_BUFFER_COLOR_STATE)
+		if (GLStates & GPU_BUFFER_COLOR_STATE)
 			glDisableClientState(GL_COLOR_ARRAY);
 		GLStates &= (!GPU_BUFFER_COLOR_STATE);
 	}
 }
 
 /* return 1 if drawing should be done using old immediate-mode
-   code, 0 otherwise */
+ * code, 0 otherwise */
 int GPU_buffer_legacy(DerivedMesh *dm)
 {
 	int test= (U.gameflags & USER_DISABLE_VBO);
-	if(test)
+	if (test)
 		return 1;
 
-	if(dm->drawObject == 0)
+	if (dm->drawObject == 0)
 		dm->drawObject = GPU_drawobject_new(dm);
 	return dm->drawObject->legacy;
 }
@@ -1213,10 +1205,10 @@ void *GPU_buffer_lock(GPUBuffer *buffer)
 {
 	float *varray;
 
-	if(!buffer)
+	if (!buffer)
 		return 0;
 
-	if(useVBOs) {
+	if (useVBOs) {
 		glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffer->id);
 		varray = glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
 		return varray;
@@ -1230,10 +1222,10 @@ void *GPU_buffer_lock_stream(GPUBuffer *buffer)
 {
 	float *varray;
 
-	if(!buffer)
+	if (!buffer)
 		return 0;
 
-	if(useVBOs) {
+	if (useVBOs) {
 		glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffer->id);
 		/* discard previous data, avoid stalling gpu */
 		glBufferDataARB(GL_ARRAY_BUFFER_ARB, buffer->size, 0, GL_STREAM_DRAW_ARB);
@@ -1247,10 +1239,10 @@ void *GPU_buffer_lock_stream(GPUBuffer *buffer)
 
 void GPU_buffer_unlock(GPUBuffer *buffer)
 {
-	if(useVBOs) {
-		if(buffer) {
+	if (useVBOs) {
+		if (buffer) {
 			/* note: this operation can fail, could return
-			   an error code from this function? */
+			 * an error code from this function? */
 			glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
 		}
 		glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
@@ -1268,7 +1260,7 @@ void GPU_buffer_draw_elements(GPUBuffer *elements, unsigned int mode, int start,
 
 
 /* XXX: the rest of the code in this file is used for optimized PBVH
-   drawing and doesn't interact at all with the buffer code above */
+ * drawing and doesn't interact at all with the buffer code above */
 
 /* Convenience struct for building the VBO. */
 typedef struct {
@@ -1289,9 +1281,12 @@ struct GPU_Buffers {
 
 	/* grid pointers */
 	DMGridData **grids;
+	const DMFlagMat *grid_flag_mats;
+	const BLI_bitmap *grid_hidden;
 	int *grid_indices;
 	int totgrid;
 	int gridsize;
+	int has_hidden;
 
 	unsigned int tot_tri, tot_quad;
 };
@@ -1302,7 +1297,7 @@ void GPU_update_mesh_buffers(GPU_Buffers *buffers, MVert *mvert,
 	VertexBufferFormat *vert_data;
 	int i;
 
-	if(buffers->vert_buf) {
+	if (buffers->vert_buf) {
 		/* Build VBO */
 		glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffers->vert_buf);
 		glBufferDataARB(GL_ARRAY_BUFFER_ARB,
@@ -1310,8 +1305,8 @@ void GPU_update_mesh_buffers(GPU_Buffers *buffers, MVert *mvert,
 		                NULL, GL_STATIC_DRAW_ARB);
 		vert_data = glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
 
-		if(vert_data) {
-			for(i = 0; i < totvert; ++i) {
+		if (vert_data) {
+			for (i = 0; i < totvert; ++i) {
 				MVert *v = mvert + vert_indices[i];
 				VertexBufferFormat *out = vert_data + i;
 
@@ -1332,10 +1327,10 @@ void GPU_update_mesh_buffers(GPU_Buffers *buffers, MVert *mvert,
 	buffers->mvert = mvert;
 }
 
-GPU_Buffers *GPU_build_mesh_buffers(GHash *map, MVert *mvert, MFace *mface,
-			int *face_indices, int totface,
-			int *vert_indices, int tot_uniq_verts,
-			int totvert)
+GPU_Buffers *GPU_build_mesh_buffers(int (*face_vert_indices)[4],
+									MFace *mface, MVert *mvert,
+									int *face_indices,
+									int totface)
 {
 	GPU_Buffers *buffers;
 	unsigned short *tri_data;
@@ -1344,14 +1339,17 @@ GPU_Buffers *GPU_build_mesh_buffers(GHash *map, MVert *mvert, MFace *mface,
 	buffers = MEM_callocN(sizeof(GPU_Buffers), "GPU_Buffers");
 	buffers->index_type = GL_UNSIGNED_SHORT;
 
-	/* Count the number of triangles */
-	for(i = 0, tottri = 0; i < totface; ++i)
-		tottri += mface[face_indices[i]].v4 ? 2 : 1;
+	/* Count the number of visible triangles */
+	for (i = 0, tottri = 0; i < totface; ++i) {
+		const MFace *f = &mface[face_indices[i]];
+		if (!paint_is_face_hidden(f, mvert))
+			tottri += f->v4 ? 2 : 1;
+	}
 	
-	if(GLEW_ARB_vertex_buffer_object && !(U.gameflags & USER_DISABLE_VBO))
+	if (GLEW_ARB_vertex_buffer_object && !(U.gameflags & USER_DISABLE_VBO))
 		glGenBuffersARB(1, &buffers->index_buf);
 
-	if(buffers->index_buf) {
+	if (buffers->index_buf) {
 		/* Generate index buffer object */
 		glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, buffers->index_buf);
 		glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB,
@@ -1359,34 +1357,27 @@ GPU_Buffers *GPU_build_mesh_buffers(GHash *map, MVert *mvert, MFace *mface,
 
 		/* Fill the triangle buffer */
 		tri_data = glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
-		if(tri_data) {
-			for(i = 0; i < totface; ++i) {
-				MFace *f = mface + face_indices[i];
+		if (tri_data) {
+			for (i = 0; i < totface; ++i) {
+				const MFace *f = mface + face_indices[i];
 				int v[3];
 
-				v[0]= f->v1;
-				v[1]= f->v2;
-				v[2]= f->v3;
-
-				for(j = 0; j < (f->v4 ? 2 : 1); ++j) {
-					for(k = 0; k < 3; ++k) {
-						void *value, *key = SET_INT_IN_POINTER(v[k]);
-						int vbo_index;
+				/* Skip hidden faces */
+				if (paint_is_face_hidden(f, mvert))
+					continue;
 
-						value = BLI_ghash_lookup(map, key);
-						vbo_index = GET_INT_FROM_POINTER(value);
-
-						if(vbo_index < 0) {
-							vbo_index = -vbo_index +
-								tot_uniq_verts - 1;
-						}
+				v[0]= 0;
+				v[1]= 1;
+				v[2]= 2;
 
-						*tri_data = vbo_index;
+				for (j = 0; j < (f->v4 ? 2 : 1); ++j) {
+					for (k = 0; k < 3; ++k) {
+						*tri_data = face_vert_indices[i][v[k]];
 						++tri_data;
 					}
-					v[0] = f->v4;
-					v[1] = f->v1;
-					v[2] = f->v3;
+					v[0] = 3;
+					v[1] = 0;
+					v[2] = 2;
 				}
 			}
 			glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB);
@@ -1399,9 +1390,8 @@ GPU_Buffers *GPU_build_mesh_buffers(GHash *map, MVert *mvert, MFace *mface,
 		glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
 	}
 
-	if(buffers->index_buf)
+	if (buffers->index_buf)
 		glGenBuffersARB(1, &buffers->vert_buf);
-	GPU_update_mesh_buffers(buffers, mvert, vert_indices, totvert);
 
 	buffers->tot_tri = tottri;
 
@@ -1413,7 +1403,7 @@ GPU_Buffers *GPU_build_mesh_buffers(GHash *map, MVert *mvert, MFace *mface,
 }
 
 void GPU_update_grid_buffers(GPU_Buffers *buffers, DMGridData **grids,
-	int *grid_indices, int totgrid, int gridsize, int smooth)
+	const DMFlagMat *grid_flag_mats, int *grid_indices, int totgrid, int gridsize)
 {
 	DMGridData *vert_data;
 	int i, j, k, totvert;
@@ -1421,28 +1411,33 @@ void GPU_update_grid_buffers(GPU_Buffers *buffers, DMGridData **grids,
 	totvert= gridsize*gridsize*totgrid;
 
 	/* Build VBO */
-	if(buffers->vert_buf) {
+	if (buffers->vert_buf) {
+		int smooth = grid_flag_mats[grid_indices[0]].flag & ME_SMOOTH;
+
 		glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffers->vert_buf);
 		glBufferDataARB(GL_ARRAY_BUFFER_ARB,
 		                sizeof(DMGridData) * totvert,
 		                NULL, GL_STATIC_DRAW_ARB);
 		vert_data = glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
-		if(vert_data) {
-			for(i = 0; i < totgrid; ++i) {
+		if (vert_data) {
+			for (i = 0; i < totgrid; ++i) {
 				DMGridData *grid= grids[grid_indices[i]];
 				memcpy(vert_data, grid, sizeof(DMGridData)*gridsize*gridsize);
 
-				if(!smooth) {
+				if (!smooth) {
 					/* for flat shading, recalc normals and set the last vertex of
-					   each quad in the index buffer to have the flat normal as
-					   that is what opengl will use */
-					for(j = 0; j < gridsize-1; ++j) {
-						for(k = 0; k < gridsize-1; ++k) {
-							normal_quad_v3(vert_data[(j+1)*gridsize + (k+1)].no,
-								vert_data[(j+1)*gridsize + k].co,
-								vert_data[(j+1)*gridsize + k+1].co,
-								vert_data[j*gridsize + k+1].co,
-								vert_data[j*gridsize + k].co);
+					 * each quad in the index buffer to have the flat normal as
+					 * that is what opengl will use */
+					for (j = 0; j < gridsize-1; ++j) {
+						for (k = 0; k < gridsize-1; ++k) {
+							float fno[3];
+							normal_quad_v3(fno,
+								grid[(j+1)*gridsize + k].co,
+								grid[(j+1)*gridsize + k+1].co,
+								grid[j*gridsize + k+1].co,
+								grid[j*gridsize + k].co);
+
+							copy_v3_v3(vert_data[(j+1)*gridsize + (k+1)].no, fno);
 						}
 					}
 				}
@@ -1462,114 +1457,356 @@ void GPU_update_grid_buffers(GPU_Buffers *buffers, DMGridData **grids,
 	buffers->grid_indices = grid_indices;
 	buffers->totgrid = totgrid;
 	buffers->gridsize = gridsize;
+	buffers->grid_flag_mats = grid_flag_mats;
 
 	//printf("node updated %p\n", buffers);
 }
 
-GPU_Buffers *GPU_build_grid_buffers(DMGridData **UNUSED(grids), int *UNUSED(grid_indices),
-				int totgrid, int gridsize)
+/* Returns the number of visible quads in the nodes' grids. */
+static int gpu_count_grid_quads(BLI_bitmap *grid_hidden,
+								int *grid_indices, int totgrid,
+								int gridsize)
+{
+	int gridarea = (gridsize-1) * (gridsize-1);
+	int i, x, y, totquad;
+
+	/* grid hidden layer is present, so have to check each grid for
+	 * visiblity */
+
+	for (i = 0, totquad = 0; i < totgrid; i++) {
+		const BLI_bitmap gh = grid_hidden[grid_indices[i]];
+
+		if (gh) {
+			/* grid hidden are present, have to check each element */
+			for (y = 0; y < gridsize-1; y++) {
+				for (x = 0; x < gridsize-1; x++) {
+					if (!paint_is_grid_face_hidden(gh, gridsize, x, y))
+						totquad++;
+				}
+			}
+		}
+		else
+			totquad += gridarea;
+	}
+
+	return totquad;
+}
+
+/* Build the element array buffer of grid indices using either
+ * unsigned shorts or unsigned ints. */
+#define FILL_QUAD_BUFFER(type_, tot_quad_, buffer_)                     \
+	{                                                                   \
+		type_ *quad_data;                                               \
+		int offset = 0;                                                 \
+		int i, j, k;                                                    \
+		                                                                \
+		glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB,                    \
+						sizeof(type_) * (tot_quad_) * 4, NULL,          \
+						GL_STATIC_DRAW_ARB);                            \
+		                                                                \
+		/* Fill the quad buffer */                                      \
+		quad_data = glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB,         \
+								   GL_WRITE_ONLY_ARB);                  \
+		if (quad_data) {                                                \
+			for (i = 0; i < totgrid; ++i) {								\
+				BLI_bitmap gh = NULL;									\
+				if (grid_hidden)										\
+					gh = grid_hidden[(grid_indices)[i]];				\
+																		\
+				for (j = 0; j < gridsize-1; ++j) {                      \
+					for (k = 0; k < gridsize-1; ++k) {                  \
+						/* Skip hidden grid face */						\
+						if (gh &&										\
+						   paint_is_grid_face_hidden(gh,				\
+													 gridsize, k, j))	\
+							continue;									\
+																		\
+						*(quad_data++)= offset + j*gridsize + k+1;      \
+						*(quad_data++)= offset + j*gridsize + k;        \
+						*(quad_data++)= offset + (j+1)*gridsize + k;    \
+						*(quad_data++)= offset + (j+1)*gridsize + k+1;  \
+					}                                                   \
+				}                                                       \
+																		\
+				offset += gridsize*gridsize;                            \
+			}                                                           \
+			glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB);              \
+		}                                                               \
+		else {                                                          \
+			glDeleteBuffersARB(1, &(buffer_));							\
+			(buffer_) = 0;												\
+		}                                                               \
+	}
+/* end FILL_QUAD_BUFFER */
+
+static GLuint gpu_get_grid_buffer(int gridsize, GLenum *index_type, unsigned *totquad)
+{
+	static int prev_gridsize = -1;
+	static GLenum prev_index_type = 0;
+	static GLuint buffer = 0;
+	static unsigned prev_totquad;
+
+	/* used in the FILL_QUAD_BUFFER macro */
+	const BLI_bitmap *grid_hidden = NULL;
+	int *grid_indices = NULL;
+	int totgrid = 1;
+
+	/* VBO is disabled; delete the previous buffer (if it exists) and
+	 * return an invalid handle */
+	if (!GLEW_ARB_vertex_buffer_object || (U.gameflags & USER_DISABLE_VBO)) {
+		if (buffer)
+			glDeleteBuffersARB(1, &buffer);
+		return 0;
+	}
+
+	/* VBO is already built */
+	if (buffer && prev_gridsize == gridsize) {
+		*index_type = prev_index_type;
+		*totquad = prev_totquad;
+		return buffer;
+	}
+
+	/* Build new VBO */
+	glGenBuffersARB(1, &buffer);
+	if (buffer) {
+		*totquad= (gridsize-1)*(gridsize-1);
+
+		glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, buffer);
+
+		if (gridsize * gridsize < USHRT_MAX) {
+			*index_type = GL_UNSIGNED_SHORT;
+			FILL_QUAD_BUFFER(unsigned short, *totquad, buffer);
+		}
+		else {
+			*index_type = GL_UNSIGNED_INT;
+			FILL_QUAD_BUFFER(unsigned int, *totquad, buffer);
+		}
+
+		glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
+	}
+
+	prev_gridsize = gridsize;
+	prev_index_type = *index_type;
+	prev_totquad = *totquad;
+	return buffer;
+}
+
+GPU_Buffers *GPU_build_grid_buffers(int *grid_indices, int totgrid,
+									BLI_bitmap *grid_hidden, int gridsize)
 {
 	GPU_Buffers *buffers;
-	int i, j, k, totquad, offset= 0;
+	int totquad;
+	int fully_visible_totquad = (gridsize-1) * (gridsize-1) * totgrid;
 
 	buffers = MEM_callocN(sizeof(GPU_Buffers), "GPU_Buffers");
+	buffers->grid_hidden = grid_hidden;
+	buffers->gridsize = gridsize;
+	buffers->totgrid = totgrid;
 
 	/* Count the number of quads */
-	totquad= (gridsize-1)*(gridsize-1)*totgrid;
+	totquad= gpu_count_grid_quads(grid_hidden, grid_indices, totgrid, gridsize);
 
-	/* Generate index buffer object */
-	if(GLEW_ARB_vertex_buffer_object && !(U.gameflags & USER_DISABLE_VBO))
+	if (totquad == fully_visible_totquad) {
+		buffers->index_buf = gpu_get_grid_buffer(gridsize, &buffers->index_type, &buffers->tot_quad);
+		buffers->has_hidden = 0;
+	}
+	else if (GLEW_ARB_vertex_buffer_object && !(U.gameflags & USER_DISABLE_VBO)) {
+		/* Build new VBO */
 		glGenBuffersARB(1, &buffers->index_buf);
+		if (buffers->index_buf) {
+			buffers->tot_quad= totquad;
 
-	if(buffers->index_buf) {
-		glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, buffers->index_buf);
+			glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, buffers->index_buf);
 
-		if(totquad < USHRT_MAX) {
-			unsigned short *quad_data;
-
-			buffers->index_type = GL_UNSIGNED_SHORT;
-			glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB,
-					 sizeof(unsigned short) * totquad * 4, NULL, GL_STATIC_DRAW_ARB);
-
-			/* Fill the quad buffer */
-			quad_data = glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
-			if(quad_data) {
-				for(i = 0; i < totgrid; ++i) {
-					for(j = 0; j < gridsize-1; ++j) {
-						for(k = 0; k < gridsize-1; ++k) {
-							*(quad_data++)= offset + j*gridsize + k+1;
-							*(quad_data++)= offset + j*gridsize + k;
-							*(quad_data++)= offset + (j+1)*gridsize + k;
-							*(quad_data++)= offset + (j+1)*gridsize + k+1;
-						}
-					}
-
-					offset += gridsize*gridsize;
-				}
-				glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB);
+			if (totgrid * gridsize * gridsize < USHRT_MAX) {
+				buffers->index_type = GL_UNSIGNED_SHORT;
+				FILL_QUAD_BUFFER(unsigned short, totquad, buffers->index_buf);
 			}
 			else {
-				glDeleteBuffersARB(1, &buffers->index_buf);
-				buffers->index_buf = 0;
+				buffers->index_type = GL_UNSIGNED_INT;
+				FILL_QUAD_BUFFER(unsigned int, totquad, buffers->index_buf);
+			}
+
+			glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
+		}
+
+		buffers->has_hidden = 1;
+	}
+
+	/* Build coord/normal VBO */
+	if (buffers->index_buf)
+		glGenBuffersARB(1, &buffers->vert_buf);
+
+	return buffers;
+}
+
+#undef FILL_QUAD_BUFFER
+
+static void gpu_draw_buffers_legacy_mesh(GPU_Buffers *buffers, int smooth)
+{
+	const MVert *mvert = buffers->mvert;
+	int i, j;
+
+	for (i = 0; i < buffers->totface; ++i) {
+		MFace *f = buffers->mface + buffers->face_indices[i];
+		int S = f->v4 ? 4 : 3;
+		unsigned int *fv = &f->v1;
+
+		if (paint_is_face_hidden(f, buffers->mvert))
+			continue;
+
+		glBegin((f->v4)? GL_QUADS: GL_TRIANGLES);
+
+		if (smooth) {
+			for (j = 0; j < S; j++) {
+				glNormal3sv(mvert[fv[j]].no);
+				glVertex3fv(mvert[fv[j]].co);
 			}
 		}
 		else {
-			unsigned int *quad_data;
-
-			buffers->index_type = GL_UNSIGNED_INT;
-			glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB,
-					 sizeof(unsigned int) * totquad * 4, NULL, GL_STATIC_DRAW_ARB);
-
-			/* Fill the quad buffer */
-			quad_data = glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
-
-			if(quad_data) {
-				for(i = 0; i < totgrid; ++i) {
-					for(j = 0; j < gridsize-1; ++j) {
-						for(k = 0; k < gridsize-1; ++k) {
-							*(quad_data++)= offset + j*gridsize + k+1;
-							*(quad_data++)= offset + j*gridsize + k;
-							*(quad_data++)= offset + (j+1)*gridsize + k;
-							*(quad_data++)= offset + (j+1)*gridsize + k+1;
+			float fno[3];
+
+			/* calculate face normal */
+			if (f->v4) {
+				normal_quad_v3(fno, mvert[fv[0]].co, mvert[fv[1]].co,
+							   mvert[fv[2]].co, mvert[fv[3]].co);
+			}
+			else
+				normal_tri_v3(fno, mvert[fv[0]].co, mvert[fv[1]].co, mvert[fv[2]].co);
+			glNormal3fv(fno);
+			
+			for (j = 0; j < S; j++)
+				glVertex3fv(mvert[fv[j]].co);
+		}
+		
+		glEnd();
+	}
+}
+
+static void gpu_draw_buffers_legacy_grids(GPU_Buffers *buffers, int smooth)
+{
+	int i, j, x, y, gridsize = buffers->gridsize;
+
+	for (i = 0; i < buffers->totgrid; ++i) {
+		int g = buffers->grid_indices[i];
+		const DMGridData *grid = buffers->grids[g];
+		BLI_bitmap gh = buffers->grid_hidden[g];
+
+		/* TODO: could use strips with hiding as well */
+
+		if (gh) {
+			glBegin(GL_QUADS);
+			
+			for (y = 0; y < gridsize-1; y++) {
+				for (x = 0; x < gridsize-1; x++) {
+					const DMGridData *e[4] = {
+						&grid[y*gridsize + x],
+						&grid[(y+1)*gridsize + x],
+						&grid[(y+1)*gridsize + x+1],
+						&grid[y*gridsize + x+1]
+					};
+
+					/* skip face if any of its corners are hidden */
+					if (paint_is_grid_face_hidden(gh, gridsize, x, y))
+						continue;
+
+					if (smooth) {
+						for (j = 0; j < 4; j++) {
+							glNormal3fv(e[j]->no);
+							glVertex3fv(e[j]->co);
 						}
 					}
+					else {
+						float fno[3];
+						normal_quad_v3(fno, e[0]->co, e[1]->co, e[2]->co, e[3]->co);
+						glNormal3fv(fno);
 
-					offset += gridsize*gridsize;
+						for (j = 0; j < 4; j++)
+							glVertex3fv(e[j]->co);
+					}
 				}
-				glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB);
 			}
-			else {
-				glDeleteBuffersARB(1, &buffers->index_buf);
-				buffers->index_buf = 0;
+
+			glEnd();
+		}
+		else if (smooth) {
+			for (y = 0; y < gridsize-1; y++) {
+				glBegin(GL_QUAD_STRIP);
+				for (x = 0; x < gridsize; x++) {
+					const DMGridData *a = &grid[y*gridsize + x];
+					const DMGridData *b = &grid[(y+1)*gridsize + x];
+
+					glNormal3fv(a->no);
+					glVertex3fv(a->co);
+					glNormal3fv(b->no);
+					glVertex3fv(b->co);
+				}
+				glEnd();
 			}
 		}
+		else {
+			for (y = 0; y < gridsize-1; y++) {
+				glBegin(GL_QUAD_STRIP);
+				for (x = 0; x < gridsize; x++) {
+					const DMGridData *a = &grid[y*gridsize + x];
+					const DMGridData *b = &grid[(y+1)*gridsize + x];
+
+					if (x > 0) {
+						const DMGridData *c = &grid[y*gridsize + x-1];
+						const DMGridData *d = &grid[(y+1)*gridsize + x-1];
+						float fno[3];
+						normal_quad_v3(fno, d->co, b->co, a->co, c->co);
+						glNormal3fv(fno);
+					}
 
-		glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
+					glVertex3fv(a->co);
+					glVertex3fv(b->co);
+				}
+				glEnd();
+			}
+		}
 	}
+}
 
-	/* Build VBO */
-	if(buffers->index_buf)
-		glGenBuffersARB(1, &buffers->vert_buf);
+void GPU_draw_buffers(GPU_Buffers *buffers, DMSetMaterial setMaterial)
+{
+	int smooth = 0;
 
-	buffers->tot_quad = totquad;
+	if (buffers->totface) {
+		const MFace *f = &buffers->mface[buffers->face_indices[0]];
+		if (!setMaterial(f->mat_nr + 1, NULL))
+			return;
 
-	return buffers;
-}
+		smooth = f->flag & ME_SMOOTH;
+		glShadeModel(smooth ? GL_SMOOTH: GL_FLAT);
+	}
+	else if (buffers->totgrid) {
+		const DMFlagMat *f = &buffers->grid_flag_mats[buffers->grid_indices[0]];
+		if (!setMaterial(f->mat_nr + 1, NULL))
+			return;
 
-void GPU_draw_buffers(GPU_Buffers *buffers)
-{
-	if(buffers->vert_buf && buffers->index_buf) {
+		smooth = f->flag & ME_SMOOTH;
+		glShadeModel(smooth ? GL_SMOOTH: GL_FLAT);
+	}
+
+	if (buffers->vert_buf && buffers->index_buf) {
 		glEnableClientState(GL_VERTEX_ARRAY);
 		glEnableClientState(GL_NORMAL_ARRAY);
 
 		glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffers->vert_buf);
 		glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, buffers->index_buf);
 
-		if(buffers->tot_quad) {
-			glVertexPointer(3, GL_FLOAT, sizeof(DMGridData), (void*)offsetof(DMGridData, co));
-			glNormalPointer(GL_FLOAT, sizeof(DMGridData), (void*)offsetof(DMGridData, no));
+		if (buffers->tot_quad) {
+			unsigned offset = 0;
+			int i, last = buffers->has_hidden ? 1 : buffers->totgrid;
+			for (i = 0; i < last; i++) {
+				glVertexPointer(3, GL_FLOAT, sizeof(DMGridData), offset + (char*)offsetof(DMGridData, co));
+				glNormalPointer(GL_FLOAT, sizeof(DMGridData), offset + (char*)offsetof(DMGridData, no));
+				
+				glDrawElements(GL_QUADS, buffers->tot_quad * 4, buffers->index_type, 0);
 
-			glDrawElements(GL_QUADS, buffers->tot_quad * 4, buffers->index_type, 0);
+				offset += buffers->gridsize * buffers->gridsize * sizeof(DMGridData);
+			}
 		}
 		else {
 			glVertexPointer(3, GL_FLOAT, sizeof(VertexBufferFormat), (void*)offsetof(VertexBufferFormat, co));
@@ -1584,56 +1821,21 @@ void GPU_draw_buffers(GPU_Buffers *buffers)
 		glDisableClientState(GL_VERTEX_ARRAY);
 		glDisableClientState(GL_NORMAL_ARRAY);
 	}
-	else if(buffers->totface) {
-		/* fallback if we are out of memory */
-		int i;
-
-		for(i = 0; i < buffers->totface; ++i) {
-			MFace *f = buffers->mface + buffers->face_indices[i];
-
-			glBegin((f->v4)? GL_QUADS: GL_TRIANGLES);
-			glNormal3sv(buffers->mvert[f->v1].no);
-			glVertex3fv(buffers->mvert[f->v1].co);
-			glNormal3sv(buffers->mvert[f->v2].no);
-			glVertex3fv(buffers->mvert[f->v2].co);
-			glNormal3sv(buffers->mvert[f->v3].no);
-			glVertex3fv(buffers->mvert[f->v3].co);
-			if(f->v4) {
-				glNormal3sv(buffers->mvert[f->v4].no);
-				glVertex3fv(buffers->mvert[f->v4].co);
-			}
-			glEnd();
-		}
+	/* fallbacks if we are out of memory or VBO is disabled */
+	else if (buffers->totface) {
+		gpu_draw_buffers_legacy_mesh(buffers, smooth);
 	}
-	else if(buffers->totgrid) {
-		int i, x, y, gridsize = buffers->gridsize;
-
-		for(i = 0; i < buffers->totgrid; ++i) {
-			DMGridData *grid = buffers->grids[buffers->grid_indices[i]];
-
-			for(y = 0; y < gridsize-1; y++) {
-				glBegin(GL_QUAD_STRIP);
-				for(x = 0; x < gridsize; x++) {
-					DMGridData *a = &grid[y*gridsize + x];
-					DMGridData *b = &grid[(y+1)*gridsize + x];
-
-					glNormal3fv(a->no);
-					glVertex3fv(a->co);
-					glNormal3fv(b->no);
-					glVertex3fv(b->co);
-				}
-				glEnd();
-			}
-		}
+	else if (buffers->totgrid) {
+		gpu_draw_buffers_legacy_grids(buffers, smooth);
 	}
 }
 
 void GPU_free_buffers(GPU_Buffers *buffers)
 {
-	if(buffers) {
-		if(buffers->vert_buf)
+	if (buffers) {
+		if (buffers->vert_buf)
 			glDeleteBuffersARB(1, &buffers->vert_buf);
-		if(buffers->index_buf)
+		if (buffers->index_buf && (buffers->tot_tri || buffers->has_hidden))
 			glDeleteBuffersARB(1, &buffers->index_buf);
 
 		MEM_freeN(buffers);
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index 203fd00..fc3878e 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -72,13 +72,13 @@ static const char* GPU_DATATYPE_STR[17] = {"", "float", "vec2", "vec3", "vec4",
  * These are stored in a hash for lookup when creating a material. */
 
 static GHash *FUNCTION_HASH= NULL;
-/*static char *FUNCTION_PROTOTYPES= NULL;
-static GPUShader *FUNCTION_LIB= NULL;*/
+/* static char *FUNCTION_PROTOTYPES= NULL;
+ * static GPUShader *FUNCTION_LIB= NULL;*/
 
 static int gpu_str_prefix(const char *str, const char *prefix)
 {
-	while(*str && *prefix) {
-		if(*str != *prefix)
+	while (*str && *prefix) {
+		if (*str != *prefix)
 			return 0;
 
 		str++;
@@ -93,11 +93,11 @@ static char *gpu_str_skip_token(char *str, char *token, int max)
 	int len = 0;
 
 	/* skip a variable/function name */
-	while(*str) {
-		if(ELEM7(*str, ' ', '(', ')', ',', '\t', '\n', '\r'))
+	while (*str) {
+		if (ELEM7(*str, ' ', '(', ')', ',', '\t', '\n', '\r'))
 			break;
 		else {
-			if(token && len < max-1) {
+			if (token && len < max-1) {
 				*token= *str;
 				token++;
 				len++;
@@ -106,13 +106,13 @@ static char *gpu_str_skip_token(char *str, char *token, int max)
 		}
 	}
 
-	if(token)
+	if (token)
 		*token= '\0';
 
 	/* skip the next special characters:
 	 * note the missing ')' */
-	while(*str) {
-		if(ELEM6(*str, ' ', '(', ',', '\t', '\n', '\r'))
+	while (*str) {
+		if (ELEM6(*str, ' ', '(', ',', '\t', '\n', '\r'))
 			str++;
 		else
 			break;
@@ -126,38 +126,38 @@ static void gpu_parse_functions_string(GHash *hash, char *code)
 	GPUFunction *function;
 	int i, type, qual;
 
-	while((code = strstr(code, "void "))) {
+	while ((code = strstr(code, "void "))) {
 		function = MEM_callocN(sizeof(GPUFunction), "GPUFunction");
 
 		code = gpu_str_skip_token(code, NULL, 0);
 		code = gpu_str_skip_token(code, function->name, MAX_FUNCTION_NAME);
 
 		/* get parameters */
-		while(*code && *code != ')') {
+		while (*code && *code != ')') {
 			/* test if it's an input or output */
 			qual = FUNCTION_QUAL_IN;
-			if(gpu_str_prefix(code, "out "))
+			if (gpu_str_prefix(code, "out "))
 				qual = FUNCTION_QUAL_OUT;
-			if(gpu_str_prefix(code, "inout "))
+			if (gpu_str_prefix(code, "inout "))
 				qual = FUNCTION_QUAL_INOUT;
-			if((qual != FUNCTION_QUAL_IN) || gpu_str_prefix(code, "in "))
+			if ((qual != FUNCTION_QUAL_IN) || gpu_str_prefix(code, "in "))
 				code = gpu_str_skip_token(code, NULL, 0);
 
 			/* test for type */
 			type= 0;
-			for(i=1; i<=16; i++) {
-				if(GPU_DATATYPE_STR[i] && gpu_str_prefix(code, GPU_DATATYPE_STR[i])) {
+			for (i=1; i<=16; i++) {
+				if (GPU_DATATYPE_STR[i] && gpu_str_prefix(code, GPU_DATATYPE_STR[i])) {
 					type= i;
 					break;
 				}
 			}
 
-			if(!type && gpu_str_prefix(code, "sampler2DShadow"))
+			if (!type && gpu_str_prefix(code, "sampler2DShadow"))
 				type= GPU_SHADOW2D;
-			if(!type && gpu_str_prefix(code, "sampler2D"))
+			if (!type && gpu_str_prefix(code, "sampler2D"))
 				type= GPU_TEX2D;
 
-			if(type) {
+			if (type) {
 				/* add paramater */
 				code = gpu_str_skip_token(code, NULL, 0);
 				code = gpu_str_skip_token(code, NULL, 0);
@@ -171,7 +171,7 @@ static void gpu_parse_functions_string(GHash *hash, char *code)
 			}
 		}
 
-		if(function->name[0] == '\0' || function->totparam == 0) {
+		if (function->name[0] == '\0' || function->totparam == 0) {
 			fprintf(stderr, "GPU functions parse error.\n");
 			MEM_freeN(function);
 			break;
@@ -194,27 +194,27 @@ static char *gpu_generate_function_prototyps(GHash *hash)
 	 * generated code, to avoid have to add the actual code & recompile all */
 	ghi = BLI_ghashIterator_new(hash);
 
-	for(; !BLI_ghashIterator_isDone(ghi); BLI_ghashIterator_step(ghi)) {
+	for (; !BLI_ghashIterator_isDone(ghi); BLI_ghashIterator_step(ghi)) {
 		name = BLI_ghashIterator_getValue(ghi);
 		function = BLI_ghashIterator_getValue(ghi);
 
 		BLI_dynstr_appendf(ds, "void %s(", name);
-		for(a=0; a<function->totparam; a++) {
-			if(function->paramqual[a] == FUNCTION_QUAL_OUT)
+		for (a=0; a<function->totparam; a++) {
+			if (function->paramqual[a] == FUNCTION_QUAL_OUT)
 				BLI_dynstr_append(ds, "out ");
-			else if(function->paramqual[a] == FUNCTION_QUAL_INOUT)
+			else if (function->paramqual[a] == FUNCTION_QUAL_INOUT)
 				BLI_dynstr_append(ds, "inout ");
 
-			if(function->paramtype[a] == GPU_TEX2D)
+			if (function->paramtype[a] == GPU_TEX2D)
 				BLI_dynstr_append(ds, "sampler2D");
-			else if(function->paramtype[a] == GPU_SHADOW2D)
+			else if (function->paramtype[a] == GPU_SHADOW2D)
 				BLI_dynstr_append(ds, "sampler2DShadow");
 			else
 				BLI_dynstr_append(ds, GPU_DATATYPE_STR[function->paramtype[a]]);
 				
 			//BLI_dynstr_appendf(ds, " param%d", a);
 			
-			if(a != function->totparam-1)
+			if (a != function->totparam-1)
 				BLI_dynstr_append(ds, ", ");
 		}
 		BLI_dynstr_append(ds, ");\n");
@@ -231,7 +231,7 @@ static char *gpu_generate_function_prototyps(GHash *hash)
 
 GPUFunction *GPU_lookup_function(const char *name)
 {
-	if(!FUNCTION_HASH) {
+	if (!FUNCTION_HASH) {
 		FUNCTION_HASH = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "GPU_lookup_function gh");
 		gpu_parse_functions_string(FUNCTION_HASH, glsl_material_library);
 		/*FUNCTION_PROTOTYPES = gpu_generate_function_prototyps(FUNCTION_HASH);
@@ -250,24 +250,24 @@ void GPU_codegen_exit(void)
 {
 	extern Material defmaterial;    // render module abuse...
 
-	if(defmaterial.gpumaterial.first)
+	if (defmaterial.gpumaterial.first)
 		GPU_material_free(&defmaterial);
 
-	if(FUNCTION_HASH) {
+	if (FUNCTION_HASH) {
 		BLI_ghash_free(FUNCTION_HASH, NULL, (GHashValFreeFP)MEM_freeN);
 		FUNCTION_HASH = NULL;
 	}
 
-	if(glsl_material_library) {
+	if (glsl_material_library) {
 		MEM_freeN(glsl_material_library);
 		glsl_material_library = NULL;
 	}
 
-	/*if(FUNCTION_PROTOTYPES) {
+	/*if (FUNCTION_PROTOTYPES) {
 		MEM_freeN(FUNCTION_PROTOTYPES);
 		FUNCTION_PROTOTYPES = NULL;
 	}*/
-	/*if(FUNCTION_LIB) {
+	/*if (FUNCTION_LIB) {
 		GPU_shader_free(FUNCTION_LIB);
 		FUNCTION_LIB = NULL;
 	}*/
@@ -324,9 +324,9 @@ static void codegen_print_datatype(DynStr *ds, int type, float *data)
 
 	BLI_dynstr_appendf(ds, "%s(", GPU_DATATYPE_STR[type]);
 
-	for(i=0; i<type; i++) {
+	for (i=0; i<type; i++) {
 		BLI_dynstr_appendf(ds, "%f", data[i]);
-		if(i == type-1)
+		if (i == type-1)
 			BLI_dynstr_append(ds, ")");
 		else
 			BLI_dynstr_append(ds, ", ");
@@ -337,7 +337,7 @@ static int codegen_input_has_texture(GPUInput *input)
 {
 	if (input->link)
 		return 0;
-	else if(input->ima)
+	else if (input->ima)
 		return 1;
 	else
 		return input->tex != NULL;
@@ -345,21 +345,21 @@ static int codegen_input_has_texture(GPUInput *input)
 
 const char *GPU_builtin_name(GPUBuiltin builtin)
 {
-	if(builtin == GPU_VIEW_MATRIX)
+	if (builtin == GPU_VIEW_MATRIX)
 		return "unfviewmat";
-	else if(builtin == GPU_OBJECT_MATRIX)
+	else if (builtin == GPU_OBJECT_MATRIX)
 		return "unfobmat";
-	else if(builtin == GPU_INVERSE_VIEW_MATRIX)
+	else if (builtin == GPU_INVERSE_VIEW_MATRIX)
 		return "unfinvviewmat";
-	else if(builtin == GPU_INVERSE_OBJECT_MATRIX)
+	else if (builtin == GPU_INVERSE_OBJECT_MATRIX)
 		return "unfinvobmat";
-	else if(builtin == GPU_VIEW_POSITION)
+	else if (builtin == GPU_VIEW_POSITION)
 		return "varposition";
-	else if(builtin == GPU_VIEW_NORMAL)
+	else if (builtin == GPU_VIEW_NORMAL)
 		return "varnormal";
-	else if(builtin == GPU_OBCOLOR)
+	else if (builtin == GPU_OBCOLOR)
 		return "unfobcolor";
-	else if(builtin == GPU_AUTO_BUMPSCALE)
+	else if (builtin == GPU_AUTO_BUMPSCALE)
 		return "unfobautobumpscale";
 	else
 		return "";
@@ -388,7 +388,7 @@ static void codegen_set_unique_ids(ListBase *nodes)
 				((input->source == GPU_SOURCE_TEX) || (input->source == GPU_SOURCE_TEX_PIXEL))) {
 				if (input->link) {
 					/* input is texture from buffer, assign only one texid per
-					   buffer to avoid sampling the same texture twice */
+					 * buffer to avoid sampling the same texture twice */
 					if (!BLI_ghash_haskey(bindhash, input->link)) {
 						input->texid = texid++;
 						input->bindtex = 1;
@@ -397,9 +397,9 @@ static void codegen_set_unique_ids(ListBase *nodes)
 					else
 						input->texid = GET_INT_FROM_POINTER(BLI_ghash_lookup(bindhash, input->link));
 				}
-				else if(input->ima) {
+				else if (input->ima) {
 					/* input is texture from image, assign only one texid per
-					   buffer to avoid sampling the same texture twice */
+					 * buffer to avoid sampling the same texture twice */
 					if (!BLI_ghash_haskey(bindhash, input->ima)) {
 						input->texid = texid++;
 						input->bindtex = 1;
@@ -421,7 +421,7 @@ static void codegen_set_unique_ids(ListBase *nodes)
 
 				/* make sure this pixel is defined exactly once */
 				if (input->source == GPU_SOURCE_TEX_PIXEL) {
-					if(input->ima) {
+					if (input->ima) {
 						if (!BLI_ghash_haskey(definehash, input->ima)) {
 							input->definetex = 1;
 							BLI_ghash_insert(definehash, input->ima, SET_INT_IN_POINTER(input->texid));
@@ -463,13 +463,13 @@ static void codegen_print_uniforms_functions(DynStr *ds, ListBase *nodes)
 						(input->textype == GPU_TEX2D)? "sampler2D": "sampler2DShadow",
 						input->texid);
 			}
-			else if(input->source == GPU_SOURCE_BUILTIN) {
+			else if (input->source == GPU_SOURCE_BUILTIN) {
 				/* only define each builting uniform/varying once */
-				if(!(builtins & input->builtin)) {
+				if (!(builtins & input->builtin)) {
 					builtins |= input->builtin;
 					name = GPU_builtin_name(input->builtin);
 
-					if(gpu_str_prefix(name, "unf")) {
+					if (gpu_str_prefix(name, "unf")) {
 						BLI_dynstr_appendf(ds, "uniform %s %s;\n",
 							GPU_DATATYPE_STR[input->type], name);
 					}
@@ -480,7 +480,7 @@ static void codegen_print_uniforms_functions(DynStr *ds, ListBase *nodes)
 				}
 			}
 			else if (input->source == GPU_SOURCE_VEC_UNIFORM) {
-				if(input->dynamicvec) {
+				if (input->dynamicvec) {
 					/* only create uniforms for dynamic vectors */
 					BLI_dynstr_appendf(ds, "uniform %s unf%d;\n",
 						GPU_DATATYPE_STR[input->type], input->id);
@@ -549,10 +549,10 @@ static void codegen_call_functions(DynStr *ds, ListBase *nodes, GPUOutput *final
 				codegen_convert_datatype(ds, input->link->output->type, input->type,
 					"tmp", input->link->output->id);
 			}
-			else if(input->source == GPU_SOURCE_BUILTIN)
+			else if (input->source == GPU_SOURCE_BUILTIN)
 				BLI_dynstr_appendf(ds, "%s", GPU_builtin_name(input->builtin));
-			else if(input->source == GPU_SOURCE_VEC_UNIFORM) {
-				if(input->dynamicvec)
+			else if (input->source == GPU_SOURCE_VEC_UNIFORM) {
+				if (input->dynamicvec)
 					BLI_dynstr_appendf(ds, "unf%d", input->id);
 				else
 					BLI_dynstr_appendf(ds, "cons%d", input->id);
@@ -587,7 +587,7 @@ static char *code_generate_fragment(ListBase *nodes, GPUOutput *output, const ch
 	codegen_set_unique_ids(nodes);
 	codegen_print_uniforms_functions(ds, nodes);
 
-	//if(G.f & G_DEBUG)
+	//if (G.debug & G_DEBUG)
 	//	BLI_dynstr_appendf(ds, "/* %s */\n", name);
 
 	BLI_dynstr_append(ds, "void main(void)\n");
@@ -602,7 +602,7 @@ static char *code_generate_fragment(ListBase *nodes, GPUOutput *output, const ch
 	code = BLI_dynstr_get_cstring(ds);
 	BLI_dynstr_free(ds);
 
-	//if(G.f & G_DEBUG) printf("%s\n", code);
+	//if (G.debug & G_DEBUG) printf("%s\n", code);
 
 	return code;
 }
@@ -631,8 +631,7 @@ static char *code_generate_vertex(ListBase *nodes)
 	for (node=nodes->first; node; node=node->next)
 		for (input=node->inputs.first; input; input=input->next)
 			if (input->source == GPU_SOURCE_ATTRIB && input->attribfirst) {
-				if(input->attribtype == CD_TANGENT) /* silly exception */
-				{
+				if (input->attribtype == CD_TANGENT) { /* silly exception */
 					BLI_dynstr_appendf(ds, "\tvar%d.xyz = normalize((gl_ModelViewMatrix * vec4(att%d.xyz, 0)).xyz);\n", input->attribid, input->attribid);
 					BLI_dynstr_appendf(ds, "\tvar%d.w = att%d.w;\n", input->attribid, input->attribid);
 				}
@@ -646,7 +645,7 @@ static char *code_generate_vertex(ListBase *nodes)
 
 	BLI_dynstr_free(ds);
 
-	//if(G.f & G_DEBUG) printf("%s\n", code);
+	//if (G.debug & G_DEBUG) printf("%s\n", code);
 
 	return code;
 }
@@ -661,12 +660,12 @@ void GPU_code_generate_glsl_lib(void)
 	DynStr *ds;
 
 	/* only initialize the library once */
-	if(glsl_material_library)
+	if (glsl_material_library)
 		return;
 
 	ds = BLI_dynstr_new();
 
-	if(GPU_bicubic_bump_support()){
+	if (GPU_bicubic_bump_support()) {
 		BLI_dynstr_append(ds, "/* These are needed for high quality bump mapping */\n"
 				"#version 130\n"
 				"#extension GL_ARB_texture_query_lod: enable\n"
@@ -698,7 +697,7 @@ static void GPU_nodes_extract_dynamic_inputs(GPUPass *pass, ListBase *nodes)
 
 	memset(inputs, 0, sizeof(*inputs));
 
-	if(!shader)
+	if (!shader)
 		return;
 
 	GPU_shader_bind(shader);
@@ -710,7 +709,7 @@ static void GPU_nodes_extract_dynamic_inputs(GPUPass *pass, ListBase *nodes)
 
 			/* attributes don't need to be bound, they already have
 			 * an id that the drawing functions will use */
-			if(input->source == GPU_SOURCE_ATTRIB ||
+			if (input->source == GPU_SOURCE_ATTRIB ||
 			   input->source == GPU_SOURCE_BUILTIN)
 				continue;
 
@@ -722,18 +721,18 @@ static void GPU_nodes_extract_dynamic_inputs(GPUPass *pass, ListBase *nodes)
 			/* pass non-dynamic uniforms to opengl */
 			extract = 0;
 
-			if(input->ima || input->tex) {
+			if (input->ima || input->tex) {
 				if (input->bindtex)
 					extract = 1;
 			}
-			else if(input->dynamicvec)
+			else if (input->dynamicvec)
 				extract = 1;
 
-			if(extract)
+			if (extract)
 				input->shaderloc = GPU_shader_get_uniform(shader, input->shadername);
 
 			/* extract nodes */
-			if(extract) {
+			if (extract) {
 				BLI_remlink(&node->inputs, input);
 				BLI_addtail(inputs, input);
 			}
@@ -759,7 +758,7 @@ void GPU_pass_bind(GPUPass *pass, double time, int mipmap)
 		if (input->ima)
 			input->tex = GPU_texture_from_blender(input->ima, input->iuser, time, mipmap);
 
-		if(input->tex && input->bindtex) {
+		if (input->tex && input->bindtex) {
 			GPU_texture_bind(input->tex, input->texid);
 			GPU_shader_uniform_texture(shader, input->shaderloc, input->tex);
 		}
@@ -777,7 +776,7 @@ void GPU_pass_update_uniforms(GPUPass *pass)
 
 	/* pass dynamic inputs to opengl, others were removed */
 	for (input=inputs->first; input; input=input->next)
-		if(!(input->ima || input->tex))
+		if (!(input->ima || input->tex))
 			GPU_shader_uniform_vector(shader, input->shaderloc, input->type, 1,
 				input->dynamicvec);
 }
@@ -792,7 +791,7 @@ void GPU_pass_unbind(GPUPass *pass)
 		return;
 
 	for (input=inputs->first; input; input=input->next) {
-		if(input->tex && input->bindtex)
+		if (input->tex && input->bindtex)
 			GPU_texture_unbind(input->tex);
 
 		if (input->ima)
@@ -849,14 +848,14 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, int type)
 	GPUNode *outnode;
 	const char *name;
 
-	if(link->output) {
+	if (link->output) {
 		outnode = link->output->node;
 		name = outnode->name;
 
-		if(strcmp(name, "set_value")==0 || strcmp(name, "set_rgb")==0) {
+		if (strcmp(name, "set_value")==0 || strcmp(name, "set_rgb")==0) {
 			input = MEM_dupallocN(outnode->inputs.first);
 			input->type = type;
-			if(input->link)
+			if (input->link)
 				input->link->users++;
 			BLI_addtail(&node->inputs, input);
 			return;
@@ -866,7 +865,7 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, int type)
 	input = MEM_callocN(sizeof(GPUInput), "GPUInput");
 	input->node = node;
 
-	if(link->builtin) {
+	if (link->builtin) {
 		/* builtin uniform */
 		input->type = type;
 		input->source = GPU_SOURCE_BUILTIN;
@@ -874,14 +873,14 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, int type)
 
 		MEM_freeN(link);
 	}
-	else if(link->output) {
+	else if (link->output) {
 		/* link to a node output */
 		input->type = type;
 		input->source = GPU_SOURCE_TEX_PIXEL;
 		input->link = link;
 		link->users++;
 	}
-	else if(link->dynamictex) {
+	else if (link->dynamictex) {
 		/* dynamic texture, GPUTexture is updated/deleted externally */
 		input->type = type;
 		input->source = GPU_SOURCE_TEX;
@@ -893,7 +892,7 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, int type)
 		input->dynamicdata = link->ptr2;
 		MEM_freeN(link);
 	}
-	else if(link->texture) {
+	else if (link->texture) {
 		/* small texture created on the fly, like for colorbands */
 		input->type = GPU_VEC4;
 		input->source = GPU_SOURCE_TEX;
@@ -906,7 +905,7 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, int type)
 		MEM_freeN(link->ptr1);
 		MEM_freeN(link);
 	}
-	else if(link->image) {
+	else if (link->image) {
 		/* blender image */
 		input->type = GPU_VEC4;
 		input->source = GPU_SOURCE_TEX;
@@ -917,7 +916,7 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, int type)
 		input->textype = GPU_TEX2D;
 		MEM_freeN(link);
 	}
-	else if(link->attribtype) {
+	else if (link->attribtype) {
 		/* vertex attribute */
 		input->type = type;
 		input->source = GPU_SOURCE_ATTRIB;
@@ -932,7 +931,7 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, int type)
 		input->source = GPU_SOURCE_VEC_UNIFORM;
 
 		memcpy(input->vec, link->ptr1, type*sizeof(float));
-		if(link->dynamic) {
+		if (link->dynamic) {
 			input->dynamicvec= link->ptr1;
 			input->dynamictype= link->dynamictype;
 			input->dynamicdata= link->ptr2;
@@ -947,7 +946,7 @@ static void gpu_node_input_socket(GPUNode *node, GPUNodeStack *sock)
 {
 	GPUNodeLink *link;
 
-	if(sock->link) {
+	if (sock->link) {
 		gpu_node_input_link(node, sock->link, sock->type);
 	}
 	else {
@@ -969,8 +968,8 @@ static void GPU_node_output(GPUNode *node, int type, const char *UNUSED(name), G
 		output->link->output = output;
 
 		/* note: the caller owns the reference to the linkfer, GPUOutput
-		   merely points to it, and if the node is destroyed it will
-		   set that pointer to NULL */
+		 * merely points to it, and if the node is destroyed it will
+		 * set that pointer to NULL */
 	}
 
 	BLI_addtail(&node->outputs, output);
@@ -980,10 +979,10 @@ static void GPU_inputs_free(ListBase *inputs)
 {
 	GPUInput *input;
 
-	for(input=inputs->first; input; input=input->next) {
-		if(input->link)
+	for (input=inputs->first; input; input=input->next) {
+		if (input->link)
 			GPU_node_link_free(input->link);
-		else if(input->tex && !input->dynamictex)
+		else if (input->tex && !input->dynamictex)
 			GPU_texture_free(input->tex);
 	}
 
@@ -1030,16 +1029,16 @@ static void gpu_nodes_get_vertex_attributes(ListBase *nodes, GPUVertexAttribs *a
 
 	memset(attribs, 0, sizeof(*attribs));
 
-	for(node=nodes->first; node; node=node->next) {
-		for(input=node->inputs.first; input; input=input->next) {
-			if(input->source == GPU_SOURCE_ATTRIB) {
-				for(a=0; a<attribs->totlayer; a++) {
-					if(attribs->layer[a].type == input->attribtype &&
+	for (node=nodes->first; node; node=node->next) {
+		for (input=node->inputs.first; input; input=input->next) {
+			if (input->source == GPU_SOURCE_ATTRIB) {
+				for (a=0; a<attribs->totlayer; a++) {
+					if (attribs->layer[a].type == input->attribtype &&
 						strcmp(attribs->layer[a].name, input->attribname) == 0)
 						break;
 				}
 
-				if(a == attribs->totlayer && a < GPU_MAX_ATTRIB) {
+				if (a == attribs->totlayer && a < GPU_MAX_ATTRIB) {
 					input->attribid = attribs->totlayer++;
 					input->attribfirst = 1;
 
@@ -1062,9 +1061,9 @@ static void gpu_nodes_get_builtin_flag(ListBase *nodes, int *builtin)
 	
 	*builtin= 0;
 
-	for(node=nodes->first; node; node=node->next)
-		for(input=node->inputs.first; input; input=input->next)
-			if(input->source == GPU_SOURCE_BUILTIN)
+	for (node=nodes->first; node; node=node->next)
+		for (input=node->inputs.first; input; input=input->next)
+			if (input->source == GPU_SOURCE_BUILTIN)
 				*builtin |= input->builtin;
 }
 
@@ -1164,7 +1163,7 @@ int GPU_link(GPUMaterial *mat, const char *name, ...)
 	int i;
 
 	function = GPU_lookup_function(name);
-	if(!function) {
+	if (!function) {
 		fprintf(stderr, "GPU failed to find function %s\n", name);
 		return 0;
 	}
@@ -1172,8 +1171,8 @@ int GPU_link(GPUMaterial *mat, const char *name, ...)
 	node = GPU_node_begin(name);
 
 	va_start(params, name);
-	for(i=0; i<function->totparam; i++) {
-		if(function->paramqual[i] != FUNCTION_QUAL_IN) {
+	for (i=0; i<function->totparam; i++) {
+		if (function->paramqual[i] != FUNCTION_QUAL_IN) {
 			linkptr= va_arg(params, GPUNodeLink**);
 			GPU_node_output(node, function->paramtype[i], "", linkptr);
 		}
@@ -1200,7 +1199,7 @@ int GPU_stack_link(GPUMaterial *mat, const char *name, GPUNodeStack *in, GPUNode
 	int i, totin, totout;
 
 	function = GPU_lookup_function(name);
-	if(!function) {
+	if (!function) {
 		fprintf(stderr, "GPU failed to find function %s\n", name);
 		return 0;
 	}
@@ -1209,24 +1208,24 @@ int GPU_stack_link(GPUMaterial *mat, const char *name, GPUNodeStack *in, GPUNode
 	totin = 0;
 	totout = 0;
 
-	if(in) {
-		for(i = 0; in[i].type != GPU_NONE; i++) {
+	if (in) {
+		for (i = 0; in[i].type != GPU_NONE; i++) {
 			gpu_node_input_socket(node, &in[i]);
 			totin++;
 		}
 	}
 	
-	if(out) {
-		for(i = 0; out[i].type != GPU_NONE; i++) {
+	if (out) {
+		for (i = 0; out[i].type != GPU_NONE; i++) {
 			GPU_node_output(node, out[i].type, out[i].name, &out[i].link);
 			totout++;
 		}
 	}
 
 	va_start(params, out);
-	for(i=0; i<function->totparam; i++) {
-		if(function->paramqual[i] != FUNCTION_QUAL_IN) {
-			if(totout == 0) {
+	for (i=0; i<function->totparam; i++) {
+		if (function->paramqual[i] != FUNCTION_QUAL_IN) {
+			if (totout == 0) {
 				linkptr= va_arg(params, GPUNodeLink**);
 				GPU_node_output(node, function->paramtype[i], "", linkptr);
 			}
@@ -1234,9 +1233,9 @@ int GPU_stack_link(GPUMaterial *mat, const char *name, GPUNodeStack *in, GPUNode
 				totout--;
 		}
 		else {
-			if(totin == 0) {
+			if (totin == 0) {
 				link= va_arg(params, GPUNodeLink*);
-				if(link->socket)
+				if (link->socket)
 					gpu_node_input_socket(node, link->socket);
 				else
 					gpu_node_input_link(node, link, function->paramtype[i]);
@@ -1254,42 +1253,17 @@ int GPU_stack_link(GPUMaterial *mat, const char *name, GPUNodeStack *in, GPUNode
 	return 1;
 }
 
-int GPU_stack_link_mute(GPUMaterial *mat, const char *name, LinkInOutsMuteNode *mlnk)
-{
-	GPUNode *node;
-	GPUFunction *function;
-	int i;
-
-	function = GPU_lookup_function(name);
-	if(!function) {
-		fprintf(stderr, "GPU failed to find function %s\n", name);
-		return 0;
-	}
-
-	for(i = 0; i < mlnk->num_outs; i++) {
-		node = GPU_node_begin(name);
-		gpu_node_input_socket(node, (GPUNodeStack*)mlnk->in);
-		GPU_node_output(node, ((GPUNodeStack*)mlnk->outs+i)->type, ((GPUNodeStack*)mlnk->outs+i)->name,
-		                &((GPUNodeStack*)mlnk->outs+i)->link);
-		GPU_node_end(node);
-
-		gpu_material_add_node(mat, node);
-	}
-
-	return 1;
-}
-
 int GPU_link_changed(GPUNodeLink *link)
 {
 	GPUNode *node;
 	GPUInput *input;
 	const char *name;
 
-	if(link->output) {
+	if (link->output) {
 		node = link->output->node;
 		name = node->name;
 
-		if(strcmp(name, "set_value")==0 || strcmp(name, "set_rgb")==0) {
+		if (strcmp(name, "set_value")==0 || strcmp(name, "set_rgb")==0) {
 			input = node->inputs.first;
 			return (input->link != NULL);
 		}
@@ -1307,16 +1281,16 @@ static void gpu_nodes_tag(GPUNodeLink *link)
 	GPUNode *node;
 	GPUInput *input;
 
-	if(!link->output)
+	if (!link->output)
 		return;
 
 	node = link->output->node;
-	if(node->tag)
+	if (node->tag)
 		return;
 	
 	node->tag= 1;
-	for(input=node->inputs.first; input; input=input->next)
-		if(input->link)
+	for (input=node->inputs.first; input; input=input->next)
+		if (input->link)
 			gpu_nodes_tag(input->link);
 }
 
@@ -1324,15 +1298,15 @@ static void gpu_nodes_prune(ListBase *nodes, GPUNodeLink *outlink)
 {
 	GPUNode *node, *next;
 
-	for(node=nodes->first; node; node=node->next)
+	for (node=nodes->first; node; node=node->next)
 		node->tag= 0;
 
 	gpu_nodes_tag(outlink);
 
-	for(node=nodes->first; node; node=next) {
+	for (node=nodes->first; node; node=next) {
 		next = node->next;
 
-		if(!node->tag) {
+		if (!node->tag) {
 			BLI_remlink(nodes, node);
 			GPU_node_free(node);
 		}
@@ -1345,7 +1319,7 @@ GPUPass *GPU_generate_pass(ListBase *nodes, GPUNodeLink *outlink, GPUVertexAttri
 	GPUPass *pass;
 	char *vertexcode, *fragmentcode;
 
-	/*if(!FUNCTION_LIB) {
+	/*if (!FUNCTION_LIB) {
 		GPU_nodes_free(nodes);
 		return NULL;
 	}*/
diff --git a/source/blender/gpu/intern/gpu_codegen.h b/source/blender/gpu/intern/gpu_codegen.h
index 85bf652..db334b8 100644
--- a/source/blender/gpu/intern/gpu_codegen.h
+++ b/source/blender/gpu/intern/gpu_codegen.h
@@ -61,10 +61,10 @@ typedef struct GPUFunction {
 GPUFunction *GPU_lookup_function(const char *name);
 
 /* Pass Generation
-   - Takes a list of nodes and a desired output, and makes a pass. This
-	 will take ownership of the nodes and free them early if unused or
-	 at the end if used.
-*/
+ *  - Takes a list of nodes and a desired output, and makes a pass. This
+ *    will take ownership of the nodes and free them early if unused or
+ *    at the end if used.
+ */
 
 typedef enum GPUDataSource {
 	GPU_SOURCE_VEC_UNIFORM,
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 7a61ee2..01f000e 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -154,28 +154,28 @@ void GPU_render_text(MTFace *tface, int mode,
 			uv[2][1] = (tface->uv[2][1] - centery) * sizey + transy;
 			
 			glBegin(GL_POLYGON);
-			if(glattrib >= 0) glVertexAttrib2fvARB(glattrib, uv[0]);
+			if (glattrib >= 0) glVertexAttrib2fvARB(glattrib, uv[0]);
 			else glTexCoord2fv(uv[0]);
-			if(col) gpu_mcol(col[0]);
+			if (col) gpu_mcol(col[0]);
 			glVertex3f(sizex * v1[0] + movex, sizey * v1[1] + movey, v1[2]);
 			
-			if(glattrib >= 0) glVertexAttrib2fvARB(glattrib, uv[1]);
+			if (glattrib >= 0) glVertexAttrib2fvARB(glattrib, uv[1]);
 			else glTexCoord2fv(uv[1]);
-			if(col) gpu_mcol(col[1]);
+			if (col) gpu_mcol(col[1]);
 			glVertex3f(sizex * v2[0] + movex, sizey * v2[1] + movey, v2[2]);
 
-			if(glattrib >= 0) glVertexAttrib2fvARB(glattrib, uv[2]);
+			if (glattrib >= 0) glVertexAttrib2fvARB(glattrib, uv[2]);
 			else glTexCoord2fv(uv[2]);
-			if(col) gpu_mcol(col[2]);
+			if (col) gpu_mcol(col[2]);
 			glVertex3f(sizex * v3[0] + movex, sizey * v3[1] + movey, v3[2]);
 
-			if(v4) {
+			if (v4) {
 				uv[3][0] = (tface->uv[3][0] - centerx) * sizex + transx;
 				uv[3][1] = (tface->uv[3][1] - centery) * sizey + transy;
 
-				if(glattrib >= 0) glVertexAttrib2fvARB(glattrib, uv[3]);
+				if (glattrib >= 0) glVertexAttrib2fvARB(glattrib, uv[3]);
 				else glTexCoord2fv(uv[3]);
-				if(col) gpu_mcol(col[3]);
+				if (col) gpu_mcol(col[3]);
 				glVertex3f(sizex * v4[0] + movex, sizey * v4[1] + movey, v4[2]);
 			}
 			glEnd();
@@ -193,9 +193,11 @@ static int is_pow2_limit(int num)
 {
 	/* take texture clamping into account */
 
-	/* XXX: texturepaint not global!
+	/* XXX: texturepaint not global! */
+#if 0
 	if (G.f & G_TEXTUREPAINT)
 		return 1;*/
+#endif
 
 	if (U.glreslimit != 0 && num > U.glreslimit)
 		return 0;
@@ -205,10 +207,12 @@ static int is_pow2_limit(int num)
 
 static int smaller_pow2_limit(int num)
 {
-	/* XXX: texturepaint not global!
+	/* XXX: texturepaint not global! */
+#if 0
 	if (G.f & G_TEXTUREPAINT)
 		return 1;*/
-	
+#endif
+
 	/* take texture clamping into account */
 	if (U.glreslimit != 0 && num > U.glreslimit)
 		return U.glreslimit;
@@ -259,16 +263,16 @@ static GLenum gpu_get_mipmap_filter(int mag)
 {
 	/* linearmipmap is off by default *when mipmapping is off,
 	 * use unfiltered display */
-	if(mag) {
-		if(GTS.linearmipmap || GTS.domipmap)
+	if (mag) {
+		if (GTS.linearmipmap || GTS.domipmap)
 			return GL_LINEAR;
 		else
 			return GL_NEAREST;
 	}
 	else {
-		if(GTS.linearmipmap)
+		if (GTS.linearmipmap)
 			return GL_LINEAR_MIPMAP_LINEAR;
-		else if(GTS.domipmap)
+		else if (GTS.domipmap)
 			return GL_LINEAR_MIPMAP_NEAREST;
 		else
 			return GL_NEAREST;
@@ -278,8 +282,7 @@ static GLenum gpu_get_mipmap_filter(int mag)
 /* Anisotropic filtering settings */
 void GPU_set_anisotropic(float value)
 {
-	if (GTS.anisotropic != value)
-	{
+	if (GTS.anisotropic != value) {
 		GPU_free_images();
 
 		/* Clamp value to the maximum value the graphics card supports */
@@ -302,10 +305,10 @@ static void gpu_make_repbind(Image *ima)
 	ImBuf *ibuf;
 	
 	ibuf = BKE_image_get_ibuf(ima, NULL);
-	if(ibuf==NULL)
+	if (ibuf==NULL)
 		return;
 
-	if(ima->repbind) {
+	if (ima->repbind) {
 		glDeleteTextures(ima->totbind, (GLuint *)ima->repbind);
 		MEM_freeN(ima->repbind);
 		ima->repbind= NULL;
@@ -314,19 +317,19 @@ static void gpu_make_repbind(Image *ima)
 
 	ima->totbind= ima->xrep*ima->yrep;
 
-	if(ima->totbind>1)
+	if (ima->totbind>1)
 		ima->repbind= MEM_callocN(sizeof(int)*ima->totbind, "repbind");
 }
 
 static void gpu_clear_tpage(void)
 {
-	if(GTS.lasttface==NULL)
+	if (GTS.lasttface==NULL)
 		return;
 	
 	GTS.lasttface= NULL;
 	GTS.curtile= 0;
 	GTS.curima= NULL;
-	if(GTS.curtilemode!=0) {
+	if (GTS.curtilemode!=0) {
 		glMatrixMode(GL_TEXTURE);
 		glLoadIdentity();
 		glMatrixMode(GL_MODELVIEW);
@@ -345,17 +348,17 @@ static void gpu_clear_tpage(void)
 
 static void gpu_set_alpha_blend(GPUBlendMode alphablend)
 {
-	if(alphablend == GPU_BLEND_SOLID) {
+	if (alphablend == GPU_BLEND_SOLID) {
 		glDisable(GL_BLEND);
 		glDisable(GL_ALPHA_TEST);
 		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 	}
-	else if(alphablend==GPU_BLEND_ADD) {
+	else if (alphablend==GPU_BLEND_ADD) {
 		glEnable(GL_BLEND);
 		glBlendFunc(GL_ONE, GL_ONE);
 		glDisable(GL_ALPHA_TEST);
 	}
-	else if(ELEM(alphablend, GPU_BLEND_ALPHA, GPU_BLEND_ALPHA_SORT)) {
+	else if (ELEM(alphablend, GPU_BLEND_ALPHA, GPU_BLEND_ALPHA_SORT)) {
 		glEnable(GL_BLEND);
 		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 		
@@ -363,7 +366,7 @@ static void gpu_set_alpha_blend(GPUBlendMode alphablend)
 		 * turn off alpha test in this case */
 
 		/* added after 2.45 to clip alpha */
-		if(U.glalphaclip == 1.0f) {
+		if (U.glalphaclip == 1.0f) {
 			glDisable(GL_ALPHA_TEST);
 		}
 		else {
@@ -371,7 +374,7 @@ static void gpu_set_alpha_blend(GPUBlendMode alphablend)
 			glAlphaFunc(GL_GREATER, U.glalphaclip);
 		}
 	}
-	else if(alphablend==GPU_BLEND_CLIP) {
+	else if (alphablend==GPU_BLEND_CLIP) {
 		glDisable(GL_BLEND); 
 		glEnable(GL_ALPHA_TEST);
 		glAlphaFunc(GL_GREATER, 0.5f);
@@ -381,7 +384,7 @@ static void gpu_set_alpha_blend(GPUBlendMode alphablend)
 static void gpu_verify_alpha_blend(int alphablend)
 {
 	/* verify alpha blending modes */
-	if(GTS.alphablend == alphablend)
+	if (GTS.alphablend == alphablend)
 		return;
 
 	gpu_set_alpha_blend(alphablend);
@@ -424,83 +427,83 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
 	GTS.tileYRep = 0;
 
 	/* setting current tile according to frame */
-	if(ima && (ima->tpageflag & IMA_TWINANIM))
+	if (ima && (ima->tpageflag & IMA_TWINANIM))
 		GTS.tile= ima->lastframe;
 	else
 		GTS.tile= tftile;
 
 	GTS.tile = MAX2(0, GTS.tile);
 
-	if(ima) {
+	if (ima) {
 		GTS.tileXRep = ima->xrep;
 		GTS.tileYRep = ima->yrep;
 	}
 
 	/* if same image & tile, we're done */
-	if(compare && ima == GTS.curima && GTS.curtile == GTS.tile &&
+	if (compare && ima == GTS.curima && GTS.curtile == GTS.tile &&
 	   GTS.tilemode == GTS.curtilemode && GTS.curtileXRep == GTS.tileXRep &&
 	   GTS.curtileYRep == GTS.tileYRep)
 		return (ima != NULL);
 
 	/* if tiling mode or repeat changed, change texture matrix to fit */
-	if(GTS.tilemode!=GTS.curtilemode || GTS.curtileXRep!=GTS.tileXRep ||
+	if (GTS.tilemode!=GTS.curtilemode || GTS.curtileXRep!=GTS.tileXRep ||
 	   GTS.curtileYRep != GTS.tileYRep) {
 
 		glMatrixMode(GL_TEXTURE);
 		glLoadIdentity();
 
-		if(ima && (ima->tpageflag & IMA_TILES))
+		if (ima && (ima->tpageflag & IMA_TILES))
 			glScalef(ima->xrep, ima->yrep, 1.0);
 
 		glMatrixMode(GL_MODELVIEW);
 	}
 
 	/* check if we have a valid image */
-	if(ima==NULL || ima->ok==0)
+	if (ima==NULL || ima->ok==0)
 		return 0;
 
 	/* check if we have a valid image buffer */
 	ibuf= BKE_image_get_ibuf(ima, iuser);
 
-	if(ibuf==NULL)
+	if (ibuf==NULL)
 		return 0;
 
-	if(ibuf->rect_float) {
-		if(U.use_16bit_textures) {
+	if (ibuf->rect_float) {
+		if (U.use_16bit_textures) {
 			/* use high precision textures. This is relatively harmless because OpenGL gives us
-			   a high precision format only if it is available */
+			 * a high precision format only if it is available */
 			use_high_bit_depth = TRUE;
 		}
 
 		/* TODO unneeded when float images are correctly treated as linear always */
-		if(ibuf->profile == IB_PROFILE_LINEAR_RGB)
+		if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
 			do_color_management = TRUE;
 
-		if(ibuf->rect==NULL)
+		if (ibuf->rect==NULL)
 			IMB_rect_from_float(ibuf);
 	}
 
 	/* currently, tpage refresh is used by ima sequences */
-	if(ima->tpageflag & IMA_TPAGE_REFRESH) {
+	if (ima->tpageflag & IMA_TPAGE_REFRESH) {
 		GPU_free_image(ima);
 		ima->tpageflag &= ~IMA_TPAGE_REFRESH;
 	}
 	
-	if(GTS.tilemode) {
+	if (GTS.tilemode) {
 		/* tiled mode */
-		if(ima->repbind==NULL) gpu_make_repbind(ima);
-		if(GTS.tile>=ima->totbind) GTS.tile= 0;
+		if (ima->repbind==NULL) gpu_make_repbind(ima);
+		if (GTS.tile>=ima->totbind) GTS.tile= 0;
 		
 		/* this happens when you change repeat buttons */
-		if(ima->repbind) bind= &ima->repbind[GTS.tile];
+		if (ima->repbind) bind= &ima->repbind[GTS.tile];
 		else bind= &ima->bindcode;
 		
-		if(*bind==0) {
+		if (*bind==0) {
 			
 			texwindx= ibuf->x/ima->xrep;
 			texwindy= ibuf->y/ima->yrep;
 			
-			if(GTS.tile>=ima->xrep*ima->yrep)
+			if (GTS.tile>=ima->xrep*ima->yrep)
 				GTS.tile= ima->xrep*ima->yrep-1;
 	
 			texwinsy= GTS.tile / ima->xrep;
@@ -512,8 +515,8 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
 			tpx= texwindx;
 			tpy= texwindy;
 
-			if(use_high_bit_depth) {
-				if(do_color_management) {
+			if (use_high_bit_depth) {
+				if (do_color_management) {
 					srgb_frect = MEM_mallocN(ibuf->x*ibuf->y*sizeof(float)*4, "floar_buf_col_cor");
 					IMB_buffer_float_from_float(srgb_frect, ibuf->rect_float,
 						ibuf->channels, IB_PROFILE_SRGB, ibuf->profile, 0,
@@ -533,12 +536,12 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
 		/* regular image mode */
 		bind= &ima->bindcode;
 
-		if(*bind==0) {
+		if (*bind==0) {
 			tpx= ibuf->x;
 			tpy= ibuf->y;
 			rect= ibuf->rect;
-			if(use_high_bit_depth) {
-				if(do_color_management) {
+			if (use_high_bit_depth) {
+				if (do_color_management) {
 					frect = srgb_frect = MEM_mallocN(ibuf->x*ibuf->y*sizeof(*srgb_frect)*4, "floar_buf_col_cor");
 					IMB_buffer_float_from_float(srgb_frect, ibuf->rect_float,
 							ibuf->channels, IB_PROFILE_SRGB, ibuf->profile, 0,
@@ -552,7 +555,7 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
 		}
 	}
 
-	if(*bind != 0) {
+	if (*bind != 0) {
 		/* enable opengl drawing with textures */
 		glBindTexture(GL_TEXTURE_2D, *bind);
 		return *bind;
@@ -563,7 +566,7 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
 
 	/* for tiles, copy only part of image into buffer */
 	if (GTS.tilemode) {
-		if(use_high_bit_depth) {
+		if (use_high_bit_depth) {
 			float *frectrow, *ftilerectrow;
 
 			ftilerect= MEM_mallocN(rectw*recth*sizeof(*ftilerect), "tilerect");
@@ -594,12 +597,12 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
 	}
 
 	/* scale if not a power of two. this is not strictly necessary for newer 
-	   GPUs (OpenGL version >= 2.0) since they support non-power-of-two-textures */
+	 * GPUs (OpenGL version >= 2.0) since they support non-power-of-two-textures */
 	if (!is_pow2_limit(rectw) || !is_pow2_limit(recth)) {
 		rectw= smaller_pow2_limit(rectw);
 		recth= smaller_pow2_limit(recth);
 		
-		if(use_high_bit_depth) {
+		if (use_high_bit_depth) {
 			fscalerect= MEM_mallocN(rectw*recth*sizeof(*fscalerect)*4, "fscalerect");
 			gluScaleImage(GL_RGBA, tpx, tpy, GL_FLOAT, frect, rectw, recth, GL_FLOAT, fscalerect);
 
@@ -618,7 +621,7 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
 	glBindTexture( GL_TEXTURE_2D, *bind);
 
 	if (!(gpu_get_mipmap() && mipmap)) {
-		if(use_high_bit_depth)
+		if (use_high_bit_depth)
 			glTexImage2D(GL_TEXTURE_2D, 0,  GL_RGBA16,  rectw, recth, 0, GL_RGBA, GL_FLOAT, frect);
 		else
 			glTexImage2D(GL_TEXTURE_2D, 0,  GL_RGBA,  rectw, recth, 0, GL_RGBA, GL_UNSIGNED_BYTE, rect);
@@ -626,7 +629,7 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
 	}
 	else {
-		if(use_high_bit_depth)
+		if (use_high_bit_depth)
 			gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA16, rectw, recth, GL_RGBA, GL_FLOAT, frect);
 		else
 			gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, rectw, recth, GL_RGBA, GL_UNSIGNED_BYTE, rect);
@@ -674,7 +677,7 @@ int GPU_set_tpage(MTFace *tface, int mipmap, int alphablend)
 	Image *ima;
 	
 	/* check if we need to clear the state */
-	if(tface==NULL) {
+	if (tface==NULL) {
 		gpu_clear_tpage();
 		return 0;
 	}
@@ -685,7 +688,7 @@ int GPU_set_tpage(MTFace *tface, int mipmap, int alphablend)
 	gpu_verify_alpha_blend(alphablend);
 	gpu_verify_reflection(ima);
 
-	if(GPU_verify_image(ima, NULL, tface->tile, 1, mipmap)) {
+	if (GPU_verify_image(ima, NULL, tface->tile, 1, mipmap)) {
 		GTS.curtile= GTS.tile;
 		GTS.curima= GTS.ima;
 		GTS.curtilemode= GTS.tilemode;
@@ -715,20 +718,20 @@ int GPU_set_tpage(MTFace *tface, int mipmap, int alphablend)
 }
 
 /* these two functions are called on entering and exiting texture paint mode,
-   temporary disabling/enabling mipmapping on all images for quick texture
-   updates with glTexSubImage2D. images that didn't change don't have to be
-   re-uploaded to OpenGL */
+ * temporary disabling/enabling mipmapping on all images for quick texture
+ * updates with glTexSubImage2D. images that didn't change don't have to be
+ * re-uploaded to OpenGL */
 void GPU_paint_set_mipmap(int mipmap)
 {
 	Image* ima;
 	
-	if(!GTS.domipmap)
+	if (!GTS.domipmap)
 		return;
 
-	if(mipmap) {
-		for(ima=G.main->image.first; ima; ima=ima->id.next) {
-			if(ima->bindcode) {
-				if(ima->tpageflag & IMA_MIPMAP_COMPLETE) {
+	if (mipmap) {
+		for (ima=G.main->image.first; ima; ima=ima->id.next) {
+			if (ima->bindcode) {
+				if (ima->tpageflag & IMA_MIPMAP_COMPLETE) {
 					glBindTexture(GL_TEXTURE_2D, ima->bindcode);
 					glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gpu_get_mipmap_filter(0));
 					glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
@@ -742,8 +745,8 @@ void GPU_paint_set_mipmap(int mipmap)
 
 	}
 	else {
-		for(ima=G.main->image.first; ima; ima=ima->id.next) {
-			if(ima->bindcode) {
+		for (ima=G.main->image.first; ima; ima=ima->id.next) {
+			if (ima->bindcode) {
 				glBindTexture(GL_TEXTURE_2D, ima->bindcode);
 				glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 				glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
@@ -776,7 +779,7 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h, int mipmap)
 		glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skip_rows);
 
 		/* if color correction is needed, we must update the part that needs updating. */
-		if(ibuf->rect_float && (!U.use_16bit_textures || (ibuf->profile == IB_PROFILE_LINEAR_RGB))) {
+		if (ibuf->rect_float && (!U.use_16bit_textures || (ibuf->profile == IB_PROFILE_LINEAR_RGB))) {
 			float *buffer = MEM_mallocN(w*h*sizeof(float)*4, "temp_texpaint_float_buf");
 			IMB_partial_rect_from_float(ibuf, buffer, x, y, w, h);
 
@@ -786,7 +789,7 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h, int mipmap)
 
 			MEM_freeN(buffer);
 
-			if(ima->tpageflag & IMA_MIPMAP_COMPLETE)
+			if (ima->tpageflag & IMA_MIPMAP_COMPLETE)
 				ima->tpageflag &= ~IMA_MIPMAP_COMPLETE;
 
 			return;
@@ -798,7 +801,7 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h, int mipmap)
 		glPixelStorei(GL_UNPACK_SKIP_PIXELS, x);
 		glPixelStorei(GL_UNPACK_SKIP_ROWS, y);
 
-		if(ibuf->rect_float)
+		if (ibuf->rect_float)
 			glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, GL_RGBA,
 				GL_FLOAT, ibuf->rect_float);
 		else
@@ -809,7 +812,7 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h, int mipmap)
 		glPixelStorei(GL_UNPACK_SKIP_PIXELS, skip_pixels);
 		glPixelStorei(GL_UNPACK_SKIP_ROWS, skip_rows);
 
-		if(ima->tpageflag & IMA_MIPMAP_COMPLETE)
+		if (ima->tpageflag & IMA_MIPMAP_COMPLETE)
 			ima->tpageflag &= ~IMA_MIPMAP_COMPLETE;
 	}
 }
@@ -818,15 +821,15 @@ void GPU_update_images_framechange(void)
 {
 	Image *ima;
 	
-	for(ima=G.main->image.first; ima; ima=ima->id.next) {
-		if(ima->tpageflag & IMA_TWINANIM) {
-			if(ima->twend >= ima->xrep*ima->yrep)
+	for (ima=G.main->image.first; ima; ima=ima->id.next) {
+		if (ima->tpageflag & IMA_TWINANIM) {
+			if (ima->twend >= ima->xrep*ima->yrep)
 				ima->twend= ima->xrep*ima->yrep-1;
 		
 			/* check: is bindcode not in the array? free. (to do) */
 			
 			ima->lastframe++;
-			if(ima->lastframe > ima->twend)
+			if (ima->lastframe > ima->twend)
 				ima->lastframe= ima->twsta;
 		}
 	}
@@ -847,8 +850,8 @@ int GPU_update_image_time(Image *ima, double time)
 	if (ima->lastupdate > (float)time)
 		ima->lastupdate=(float)time;
 
-	if(ima->tpageflag & IMA_TWINANIM) {
-		if(ima->twend >= ima->xrep*ima->yrep) ima->twend= ima->xrep*ima->yrep-1;
+	if (ima->tpageflag & IMA_TWINANIM) {
+		if (ima->twend >= ima->xrep*ima->yrep) ima->twend= ima->xrep*ima->yrep-1;
 		
 		/* check: is the bindcode not in the array? Then free. (still to do) */
 		
@@ -859,8 +862,8 @@ int GPU_update_image_time(Image *ima, double time)
 
 		newframe = ima->lastframe+inc;
 
-		if(newframe > (int)ima->twend) {
-			if(ima->twend-ima->twsta != 0)
+		if (newframe > (int)ima->twend) {
+			if (ima->twend-ima->twsta != 0)
 				newframe = (int)ima->twsta-1 + (newframe-ima->twend)%(ima->twend-ima->twsta);
 			else
 				newframe = ima->twsta;
@@ -875,13 +878,12 @@ int GPU_update_image_time(Image *ima, double time)
 
 void GPU_free_smoke(SmokeModifierData *smd)
 {
-	if(smd->type & MOD_SMOKE_TYPE_DOMAIN && smd->domain)
-	{
-		if(smd->domain->tex)
+	if (smd->type & MOD_SMOKE_TYPE_DOMAIN && smd->domain) {
+		if (smd->domain->tex)
 			GPU_texture_free(smd->domain->tex);
 		smd->domain->tex = NULL;
 
-		if(smd->domain->tex_shadow)
+		if (smd->domain->tex_shadow)
 			GPU_texture_free(smd->domain->tex_shadow);
 		smd->domain->tex_shadow = NULL;
 	}
@@ -890,9 +892,9 @@ void GPU_free_smoke(SmokeModifierData *smd)
 void GPU_create_smoke(SmokeModifierData *smd, int highres)
 {
 #ifdef WITH_SMOKE
-	if(smd->type & MOD_SMOKE_TYPE_DOMAIN && !smd->domain->tex && !highres)
+	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)
+	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));
 
 	smd->domain->tex_shadow = GPU_texture_create_3D(smd->domain->res[0], smd->domain->res[1], smd->domain->res[2], smd->domain->shadow);
@@ -918,13 +920,13 @@ void GPU_free_unused_buffers(void)
 {
 	Image *ima;
 
-	if(!BLI_thread_is_main())
+	if (!BLI_thread_is_main())
 		return;
 
 	BLI_lock_thread(LOCK_OPENGL);
 
 	/* images */
-	for(ima=image_free_queue.first; ima; ima=ima->id.next)
+	for (ima=image_free_queue.first; ima; ima=ima->id.next)
 		GPU_free_image(ima);
 
 	BLI_freelistN(&image_free_queue);
@@ -938,25 +940,25 @@ void GPU_free_unused_buffers(void)
 
 void GPU_free_image(Image *ima)
 {
-	if(!BLI_thread_is_main()) {
+	if (!BLI_thread_is_main()) {
 		gpu_queue_image_for_free(ima);
 		return;
 	}
 
 	/* free regular image binding */
-	if(ima->bindcode) {
+	if (ima->bindcode) {
 		glDeleteTextures(1, (GLuint *)&ima->bindcode);
 		ima->bindcode= 0;
 	}
 
 	/* free glsl image binding */
-	if(ima->gputexture) {
+	if (ima->gputexture) {
 		GPU_texture_free(ima->gputexture);
 		ima->gputexture= NULL;
 	}
 
 	/* free repeated image binding */
-	if(ima->repbind) {
+	if (ima->repbind) {
 		glDeleteTextures(ima->totbind, (GLuint *)ima->repbind);
 	
 		MEM_freeN(ima->repbind);
@@ -970,8 +972,8 @@ void GPU_free_images(void)
 {
 	Image* ima;
 
-	if(G.main)
-		for(ima=G.main->image.first; ima; ima=ima->id.next)
+	if (G.main)
+		for (ima=G.main->image.first; ima; ima=ima->id.next)
 			GPU_free_image(ima);
 }
 
@@ -980,9 +982,9 @@ void GPU_free_images_anim(void)
 {
 	Image* ima;
 
-	if(G.main)
-		for(ima=G.main->image.first; ima; ima=ima->id.next)
-			if(ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE))
+	if (G.main)
+		for (ima=G.main->image.first; ima; ima=ima->id.next)
+			if (ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE))
 				GPU_free_image(ima);
 }
 
@@ -1023,11 +1025,11 @@ static struct GPUMaterialState {
 /* fixed function material, alpha handed by caller */
 static void gpu_material_to_fixed(GPUMaterialFixed *smat, const Material *bmat, const int gamma, const Object *ob, const int new_shading_nodes)
 {
-	if(new_shading_nodes || bmat->mode & MA_SHLESS) {
+	if (new_shading_nodes || bmat->mode & MA_SHLESS) {
 		copy_v3_v3(smat->diff, &bmat->r);
 		smat->diff[3]= 1.0;
 
-		if(gamma)
+		if (gamma)
 			linearrgb_to_srgb_v3_v3(smat->diff, smat->diff);
 
 		zero_v4(smat->spec);
@@ -1037,14 +1039,14 @@ static void gpu_material_to_fixed(GPUMaterialFixed *smat, const Material *bmat,
 		mul_v3_v3fl(smat->diff, &bmat->r, bmat->ref + bmat->emit);
 		smat->diff[3]= 1.0; /* caller may set this to bmat->alpha */
 
-		if(bmat->shade_flag & MA_OBCOLOR)
+		if (bmat->shade_flag & MA_OBCOLOR)
 			mul_v3_v3(smat->diff, ob->col);
 		
 		mul_v3_v3fl(smat->spec, &bmat->specr, bmat->spec);
 		smat->spec[3]= 1.0; /* always 1 */
 		smat->hard= CLAMPIS(bmat->har, 0, 128);
 
-		if(gamma) {
+		if (gamma) {
 			linearrgb_to_srgb_v3_v3(smat->diff, smat->diff);
 			linearrgb_to_srgb_v3_v3(smat->spec, smat->spec);
 		}	
@@ -1053,10 +1055,10 @@ static void gpu_material_to_fixed(GPUMaterialFixed *smat, const Material *bmat,
 
 static Material *gpu_active_node_material(Material *ma)
 {
-	if(ma && ma->use_nodes && ma->nodetree) {
+	if (ma && ma->use_nodes && ma->nodetree) {
 		bNode *node= nodeGetActiveID(ma->nodetree, ID_MA);
 
-		if(node)
+		if (node)
 			return (Material *)node->id;
 		else
 			return NULL;
@@ -1088,16 +1090,16 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O
 	GMS.gviewinv= rv3d->viewinv;
 
 	/* alpha pass setup. there's various cases to handle here:
-	   * object transparency on: only solid materials draw in the first pass,
-	   and only transparent in the second 'alpha' pass.
-	   * object transparency off: for glsl we draw both in a single pass, and
-	   for solid we don't use transparency at all. */
+	 * - object transparency on: only solid materials draw in the first pass,
+	 * and only transparent in the second 'alpha' pass.
+	 * - object transparency off: for glsl we draw both in a single pass, and
+	 * for solid we don't use transparency at all. */
 	GMS.use_alpha_pass = (do_alpha_after != NULL);
 	GMS.is_alpha_pass = (v3d && v3d->transp);
-	if(GMS.use_alpha_pass)
+	if (GMS.use_alpha_pass)
 		*do_alpha_after = 0;
 	
-	if(GMS.totmat > FIXEDMAT) {
+	if (GMS.totmat > FIXEDMAT) {
 		GMS.matbuf= MEM_callocN(sizeof(GPUMaterialFixed)*GMS.totmat, "GMS.matbuf");
 		GMS.gmatbuf= MEM_callocN(sizeof(*GMS.gmatbuf)*GMS.totmat, "GMS.matbuf");
 		GMS.alphablend= MEM_callocN(sizeof(*GMS.alphablend)*GMS.totmat, "GMS.matbuf");
@@ -1109,13 +1111,13 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O
 	}
 
 	/* no materials assigned? */
-	if(ob->totcol==0) {
+	if (ob->totcol==0) {
 		gpu_material_to_fixed(&GMS.matbuf[0], &defmaterial, 0, ob, new_shading_nodes);
 
 		/* do material 1 too, for displists! */
 		memcpy(&GMS.matbuf[1], &GMS.matbuf[0], sizeof(GPUMaterialFixed));
 
-		if(glsl) {
+		if (glsl) {
 			GMS.gmatbuf[0]= &defmaterial;
 			GPU_material_from_blender(GMS.gscene, &defmaterial);
 		}
@@ -1124,16 +1126,16 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O
 	}
 	
 	/* setup materials */
-	for(a=1; a<=ob->totcol; a++) {
+	for (a=1; a<=ob->totcol; a++) {
 		/* find a suitable material */
 		ma= give_current_material(ob, a);
-		if(!glsl && !new_shading_nodes) ma= gpu_active_node_material(ma);
-		if(ma==NULL) ma= &defmaterial;
+		if (!glsl && !new_shading_nodes) ma= gpu_active_node_material(ma);
+		if (ma==NULL) ma= &defmaterial;
 
 		/* create glsl material if requested */
 		gpumat = (glsl)? GPU_material_from_blender(GMS.gscene, ma): NULL;
 
-		if(gpumat) {
+		if (gpumat) {
 			/* do glsl only if creating it succeed, else fallback */
 			GMS.gmatbuf[a]= ma;
 			alphablend = GPU_material_alpha_blend(gpumat, ob->col);
@@ -1142,7 +1144,7 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O
 			/* fixed function opengl materials */
 			gpu_material_to_fixed(&GMS.matbuf[a], ma, gamma, ob, new_shading_nodes);
 
-			if(GMS.use_alpha_pass) {
+			if (GMS.use_alpha_pass) {
 				GMS.matbuf[a].diff[3]= ma->alpha;
 				alphablend = (ma->alpha == 1.0f)? GPU_BLEND_SOLID: GPU_BLEND_ALPHA;
 			}
@@ -1154,8 +1156,8 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O
 
 		/* setting do_alpha_after = 1 indicates this object needs to be
 		 * drawn in a second alpha pass for improved blending */
-		if(do_alpha_after && !GMS.is_alpha_pass)
-			if(ELEM3(alphablend, GPU_BLEND_ALPHA, GPU_BLEND_ADD, GPU_BLEND_ALPHA_SORT))
+		if (do_alpha_after && !GMS.is_alpha_pass)
+			if (ELEM3(alphablend, GPU_BLEND_ALPHA, GPU_BLEND_ADD, GPU_BLEND_ALPHA_SORT))
 				*do_alpha_after= 1;
 
 		GMS.alphablend[a]= alphablend;
@@ -1172,7 +1174,7 @@ int GPU_enable_material(int nr, void *attribs)
 	GPUBlendMode alphablend;
 
 	/* no GPU_begin_object_materials, use default material */
-	if(!GMS.matbuf) {
+	if (!GMS.matbuf) {
 		float diff[4], spec[4];
 
 		memset(&GMS, 0, sizeof(GMS));
@@ -1191,19 +1193,19 @@ int GPU_enable_material(int nr, void *attribs)
 	}
 
 	/* prevent index to use un-initialized array items */
-	if(nr>=GMS.totmat)
+	if (nr>=GMS.totmat)
 		nr= 0;
 
-	if(gattribs)
+	if (gattribs)
 		memset(gattribs, 0, sizeof(*gattribs));
 
 	/* keep current material */
-	if(nr==GMS.lastmatnr)
+	if (nr==GMS.lastmatnr)
 		return GMS.lastretval;
 
 	/* unbind glsl material */
-	if(GMS.gboundmat) {
-		if(GMS.is_alpha_pass) glDepthMask(0);
+	if (GMS.gboundmat) {
+		if (GMS.is_alpha_pass) glDepthMask(0);
 		GPU_material_unbind(GPU_material_from_blender(GMS.gscene, GMS.gboundmat));
 		GMS.gboundmat= NULL;
 	}
@@ -1212,19 +1214,19 @@ int GPU_enable_material(int nr, void *attribs)
 	GMS.lastmatnr = nr;
 	GMS.lastretval = 1;
 
-	if(GMS.use_alpha_pass) {
+	if (GMS.use_alpha_pass) {
 		GMS.lastretval = ELEM(GMS.alphablend[nr], GPU_BLEND_SOLID, GPU_BLEND_CLIP);
-		if(GMS.is_alpha_pass)
+		if (GMS.is_alpha_pass)
 			GMS.lastretval = !GMS.lastretval;
 	}
 	else
 		GMS.lastretval = !GMS.is_alpha_pass;
 
-	if(GMS.lastretval) {
+	if (GMS.lastretval) {
 		/* for alpha pass, use alpha blend */
 		alphablend = GMS.alphablend[nr];
 
-		if(gattribs && GMS.gmatbuf[nr]) {
+		if (gattribs && GMS.gmatbuf[nr]) {
 			/* bind glsl material and get attributes */
 			Material *mat = GMS.gmatbuf[nr];
 			float auto_bump_scale;
@@ -1238,11 +1240,11 @@ int GPU_enable_material(int nr, void *attribs)
 			GMS.gboundmat= mat;
 
 			/* for glsl use alpha blend mode, unless it's set to solid and
-			   we are already drawing in an alpha pass */
-			if(mat->game.alpha_blend != GPU_BLEND_SOLID)
+			 * we are already drawing in an alpha pass */
+			if (mat->game.alpha_blend != GPU_BLEND_SOLID)
 				alphablend= mat->game.alpha_blend;
 
-			if(GMS.is_alpha_pass) glDepthMask(1);
+			if (GMS.is_alpha_pass) glDepthMask(1);
 		}
 		else {
 			/* or do fixed function opengl material */
@@ -1260,7 +1262,7 @@ int GPU_enable_material(int nr, void *attribs)
 
 void GPU_set_material_alpha_blend(int alphablend)
 {
-	if(GMS.lastalphablend == alphablend)
+	if (GMS.lastalphablend == alphablend)
 		return;
 	
 	gpu_set_alpha_blend(alphablend);
@@ -1277,8 +1279,8 @@ void GPU_disable_material(void)
 	GMS.lastmatnr= -1;
 	GMS.lastretval= 1;
 
-	if(GMS.gboundmat) {
-		if(GMS.is_alpha_pass) glDepthMask(0);
+	if (GMS.gboundmat) {
+		if (GMS.is_alpha_pass) glDepthMask(0);
 		GPU_material_unbind(GPU_material_from_blender(GMS.gscene, GMS.gboundmat));
 		GMS.gboundmat= NULL;
 	}
@@ -1290,7 +1292,7 @@ void GPU_end_object_materials(void)
 {
 	GPU_disable_material();
 
-	if(GMS.matbuf && GMS.matbuf != GMS.matbuf_fixed) {
+	if (GMS.matbuf && GMS.matbuf != GMS.matbuf_fixed) {
 		MEM_freeN(GMS.matbuf);
 		MEM_freeN(GMS.gmatbuf);
 		MEM_freeN(GMS.alphablend);
@@ -1301,8 +1303,7 @@ void GPU_end_object_materials(void)
 	GMS.alphablend= NULL;
 
 	/* resetting the texture matrix after the glScale needed for tiled textures */
-	if(GTS.tilemode)
-	{
+	if (GTS.tilemode) {
 		glMatrixMode(GL_TEXTURE);
 		glLoadIdentity();
 		glMatrixMode(GL_MODELVIEW);
@@ -1317,7 +1318,7 @@ int GPU_default_lights(void)
 	int a, count = 0;
 	
 	/* initialize */
-	if(U.light[0].flag==0 && U.light[1].flag==0 && U.light[2].flag==0) {
+	if (U.light[0].flag==0 && U.light[1].flag==0 && U.light[2].flag==0) {
 		U.light[0].flag= 1;
 		U.light[0].vec[0]= -0.3; U.light[0].vec[1]= 0.3; U.light[0].vec[2]= 0.9;
 		U.light[0].col[0]= 0.8; U.light[0].col[1]= 0.8; U.light[0].col[2]= 0.8;
@@ -1339,9 +1340,9 @@ int GPU_default_lights(void)
 
 	glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_FALSE);
 
-	for(a=0; a<8; a++) {
-		if(a<3) {
-			if(U.light[a].flag) {
+	for (a=0; a<8; a++) {
+		if (a<3) {
+			if (U.light[a].flag) {
 				glEnable(GL_LIGHT0+a);
 
 				normalize_v3_v3(position, U.light[a].vec);
@@ -1385,7 +1386,7 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[][4
 	float position[4], direction[4], energy[4];
 	
 	/* disable all lights */
-	for(count=0; count<8; count++)
+	for (count=0; count<8; count++)
 		glDisable(GL_LIGHT0+count);
 	
 	/* view direction for specular is not compute correct by default in
@@ -1394,11 +1395,11 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[][4
 
 	count= 0;
 	
-	for(base=scene->base.first; base; base=base->next) {
-		if(base->object->type!=OB_LAMP)
+	for (base=scene->base.first; base; base=base->next) {
+		if (base->object->type!=OB_LAMP)
 			continue;
 
-		if(!(base->lay & lay) || !(base->lay & ob->lay))
+		if (!(base->lay & lay) || !(base->lay & ob->lay))
 			continue;
 
 		la= base->object->data;
@@ -1409,7 +1410,7 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[][4
 		
 		where_is_object_simul(scene, base->object);
 		
-		if(la->type==LA_SUN) {
+		if (la->type==LA_SUN) {
 			/* sun lamp */
 			copy_v3_v3(direction, base->object->obmat[2]);
 			direction[3]= 0.0;
@@ -1426,7 +1427,7 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[][4
 			glLightf(GL_LIGHT0+count, GL_LINEAR_ATTENUATION, la->att1/la->dist);
 			glLightf(GL_LIGHT0+count, GL_QUADRATIC_ATTENUATION, la->att2/(la->dist*la->dist));
 			
-			if(la->type==LA_SPOT) {
+			if (la->type==LA_SPOT) {
 				/* spot lamp */
 				negate_v3_v3(direction, base->object->obmat[2]);
 				glLightfv(GL_LIGHT0+count, GL_SPOT_DIRECTION, direction);
@@ -1448,7 +1449,7 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[][4
 		glPopMatrix();					
 		
 		count++;
-		if(count==8)
+		if (count==8)
 			break;
 	}
 
@@ -1510,9 +1511,9 @@ void GPU_state_init(void)
 	glDepthRange(0.0, 1.0);
 	
 	a= 0;
-	for(x=0; x<32; x++) {
-		for(y=0; y<4; y++) {
-			if( (x) & 1) pat[a++]= 0x88;
+	for (x=0; x<32; x++) {
+		for (y=0; y<4; y++) {
+			if ( (x) & 1) pat[a++]= 0x88;
 			else pat[a++]= 0x22;
 		}
 	}
@@ -1528,8 +1529,8 @@ void GPU_state_init(void)
 	glDisable(GL_CULL_FACE);
 
 	/* calling this makes drawing very slow when AA is not set up in ghost
-	   on Linux/NVIDIA.
-	glDisable(GL_MULTISAMPLE); */
+	 * on Linux/NVIDIA. */
+	// glDisable(GL_MULTISAMPLE);
 }
 
 /* debugging aid */
@@ -1542,7 +1543,7 @@ static void gpu_get_print(const char *name, GLenum type)
 	glGetFloatv(type, value);
 
 	printf("%s: ", name);
-	for(a=0; a<16; a++)
+	for (a=0; a<16; a++)
 		printf("%.2f ", value[a]);
 	printf("\n");
 }
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index a3e3eb1..6c30c95 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -51,19 +51,21 @@
 #include <stdio.h>
 #include <string.h>
 
-#include "BLI_winstuff.h"
+#ifdef WIN32
+#  include "BLI_winstuff.h"
+#endif
 
 /* Extensions support */
 
 /* extensions used:
-	- texture border clamp: 1.3 core
-	- fragement shader: 2.0 core
-	- framebuffer object: ext specification
-	- multitexture 1.3 core
-	- arb non power of two: 2.0 core
-	- pixel buffer objects? 2.1 core
-	- arb draw buffers? 2.0 core
-*/
+ * - texture border clamp: 1.3 core
+ * - fragment shader: 2.0 core
+ * - framebuffer object: ext specification
+ * - multitexture 1.3 core
+ * - arb non power of two: 2.0 core
+ * - pixel buffer objects? 2.1 core
+ * - arb draw buffers? 2.0 core
+ */
 
 static struct GPUGlobal {
 	GLint maxtextures;
@@ -99,7 +101,7 @@ void GPU_extensions_init(void)
 	const char *vendor, *renderer;
 
 	/* can't avoid calling this multiple times, see wm_window_add_ghostwindow */
-	if(gpu_extensions_init) return;
+	if (gpu_extensions_init) return;
 	gpu_extensions_init= 1;
 
 	glewInit();
@@ -123,38 +125,38 @@ void GPU_extensions_init(void)
 	vendor = (const char*)glGetString(GL_VENDOR);
 	renderer = (const char*)glGetString(GL_RENDERER);
 
-	if(strstr(vendor, "ATI")) {
+	if (strstr(vendor, "ATI")) {
 		GG.device = GPU_DEVICE_ATI;
 		GG.driver = GPU_DRIVER_OFFICIAL;
 	}
-	else if(strstr(vendor, "NVIDIA")) {
+	else if (strstr(vendor, "NVIDIA")) {
 		GG.device = GPU_DEVICE_NVIDIA;
 		GG.driver = GPU_DRIVER_OFFICIAL;
 	}
-	else if(strstr(vendor, "Intel") ||
+	else if (strstr(vendor, "Intel") ||
 	        /* src/mesa/drivers/dri/intel/intel_context.c */
 	        strstr(renderer, "Mesa DRI Intel") ||
 		strstr(renderer, "Mesa DRI Mobile Intel")) {
 		GG.device = GPU_DEVICE_INTEL;
 		GG.driver = GPU_DRIVER_OFFICIAL;
 	}
-	else if(strstr(renderer, "Mesa DRI R") || (strstr(renderer, "Gallium ") && strstr(renderer, " on ATI "))) {
+	else if (strstr(renderer, "Mesa DRI R") || (strstr(renderer, "Gallium ") && strstr(renderer, " on ATI "))) {
 		GG.device = GPU_DEVICE_ATI;
 		GG.driver = GPU_DRIVER_OPENSOURCE;
 	}
-	else if(strstr(renderer, "Nouveau") || strstr(vendor, "nouveau")) {
+	else if (strstr(renderer, "Nouveau") || strstr(vendor, "nouveau")) {
 		GG.device = GPU_DEVICE_NVIDIA;
 		GG.driver = GPU_DRIVER_OPENSOURCE;
 	}
-	else if(strstr(vendor, "Mesa")) {
+	else if (strstr(vendor, "Mesa")) {
 		GG.device = GPU_DEVICE_SOFTWARE;
 		GG.driver = GPU_DRIVER_SOFTWARE;
 	}
-	else if(strstr(vendor, "Microsoft")) {
+	else if (strstr(vendor, "Microsoft")) {
 		GG.device = GPU_DEVICE_SOFTWARE;
 		GG.driver = GPU_DRIVER_SOFTWARE;
 	}
-	else if(strstr(renderer, "Apple Software Renderer")) {
+	else if (strstr(renderer, "Apple Software Renderer")) {
 		GG.device = GPU_DEVICE_SOFTWARE;
 		GG.driver = GPU_DRIVER_SOFTWARE;
 	}
@@ -163,12 +165,12 @@ void GPU_extensions_init(void)
 		GG.driver = GPU_DRIVER_ANY;
 	}
 
-	if(GG.device == GPU_DEVICE_ATI) {
+	if (GG.device == GPU_DEVICE_ATI) {
 		/* ATI 9500 to X2300 cards support NPoT textures poorly
 		 * Incomplete list http://dri.freedesktop.org/wiki/ATIRadeon
 		 * New IDs from MESA's src/gallium/drivers/r300/r300_screen.c
 		 */
-		if(strstr(renderer, "R3") || strstr(renderer, "RV3") ||
+		if (strstr(renderer, "R3") || strstr(renderer, "RV3") ||
 		   strstr(renderer, "R4") || strstr(renderer, "RV4") ||
 		   strstr(renderer, "RS4") || strstr(renderer, "RC4") ||
 		   strstr(renderer, "R5") || strstr(renderer, "RV5") ||
@@ -179,12 +181,16 @@ void GPU_extensions_init(void)
 			GG.npotdisabled = 1;
 	}
 
-	GG.os = GPU_OS_UNIX;
+	/* make sure double side isn't used by default and only getting enabled in places where it's
+	 * really needed to prevent different unexpected behaviors like with intel gme965 card (sergey) */
+	glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
+
 #ifdef _WIN32
 	GG.os = GPU_OS_WIN;
-#endif
-#ifdef __APPLE__
+#elif defined(__APPLE__)
 	GG.os = GPU_OS_MAC;
+#else
+	GG.os = GPU_OS_UNIX;
 #endif
 }
 
@@ -201,7 +207,7 @@ int GPU_glsl_support(void)
 
 int GPU_non_power_of_two_support(void)
 {
-	if(GG.npotdisabled)
+	if (GG.npotdisabled)
 		return 0;
 
 	return GLEW_ARB_texture_non_power_of_two;
@@ -216,7 +222,7 @@ int GPU_print_error(const char *str)
 {
 	GLenum errCode;
 
-	if (G.f & G_DEBUG) {
+	if (G.debug & G_DEBUG) {
 		if ((errCode = glGetError()) != GL_NO_ERROR) {
 			fprintf(stderr, "%s opengl error: %s\n", str, gluErrorString(errCode));
 			return 1;
@@ -256,7 +262,7 @@ static void GPU_print_framebuffer_error(GLenum status, char err_out[256])
 			break;
 	}
 
-	if(err_out) {
+	if (err_out) {
 		BLI_snprintf(err_out, 256, "GPUFrameBuffer: framebuffer incomplete error %d '%s'",
 			(int)status, err);
 	}
@@ -314,7 +320,7 @@ static GPUTexture *GPU_texture_create_nD(int w, int h, int n, float *fpixels, in
 	GLenum type, format, internalformat;
 	void *pixels = NULL;
 
-	if(depth && !GLEW_ARB_depth_texture)
+	if (depth && !GLEW_ARB_depth_texture)
 		return NULL;
 
 	tex = MEM_callocN(sizeof(GPUTexture), "GPUTexture");
@@ -328,7 +334,7 @@ static GPUTexture *GPU_texture_create_nD(int w, int h, int n, float *fpixels, in
 	glGenTextures(1, &tex->bindcode);
 
 	if (!tex->bindcode) {
-		if(err_out) {
+		if (err_out) {
 			BLI_snprintf(err_out, 256, "GPUTexture: texture create failed: %d",
 				(int)glGetError());
 		}
@@ -348,7 +354,7 @@ static GPUTexture *GPU_texture_create_nD(int w, int h, int n, float *fpixels, in
 	tex->number = 0;
 	glBindTexture(tex->target, tex->bindcode);
 
-	if(depth) {
+	if (depth) {
 		type = GL_UNSIGNED_BYTE;
 		format = GL_DEPTH_COMPONENT;
 		internalformat = GL_DEPTH_COMPONENT;
@@ -392,7 +398,7 @@ static GPUTexture *GPU_texture_create_nD(int w, int h, int n, float *fpixels, in
 	if (pixels)
 		MEM_freeN(pixels);
 
-	if(depth) {
+	if (depth) {
 		glTexParameteri(tex->target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
 		glTexParameteri(tex->target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 		glTexParameteri(tex->target, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE);
@@ -429,7 +435,7 @@ GPUTexture *GPU_texture_create_3D(int w, int h, int depth, float *fpixels)
 	void *pixels = NULL;
 	float vfBorderColor[4] = {0.0f, 0.0f, 0.0f, 0.0f};
 
-	if(!GLEW_VERSION_1_2)
+	if (!GLEW_VERSION_1_2)
 		return NULL;
 
 	tex = MEM_callocN(sizeof(GPUTexture), "GPUTexture");
@@ -472,7 +478,7 @@ GPUTexture *GPU_texture_create_3D(int w, int h, int depth, float *fpixels)
 	GPU_print_error("3D glTexImage3D");
 
 	if (fpixels) {
-		if(!GPU_non_power_of_two_support() && (w != tex->w || h != tex->h || depth != tex->depth)) {
+		if (!GPU_non_power_of_two_support() && (w != tex->w || h != tex->h || depth != tex->depth)) {
 			/* clear first to avoid unitialized pixels */
 			float *zero= MEM_callocN(sizeof(float)*tex->w*tex->h*tex->depth, "zero");
 			glTexSubImage3D(tex->target, 0, 0, 0, 0, tex->w, tex->h, tex->depth, format, type, zero);
@@ -512,13 +518,13 @@ GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, double time,
 	GPU_update_image_time(ima, time);
 	bindcode = GPU_verify_image(ima, iuser, 0, 0, mipmap);
 
-	if(ima->gputexture) {
+	if (ima->gputexture) {
 		ima->gputexture->bindcode = bindcode;
 		glBindTexture(GL_TEXTURE_2D, lastbindcode);
 		return ima->gputexture;
 	}
 
-	if(!bindcode) {
+	if (!bindcode) {
 		glBindTexture(GL_TEXTURE_2D, lastbindcode);
 		return NULL;
 	}
@@ -589,7 +595,7 @@ void GPU_texture_bind(GPUTexture *tex, int number)
 		return;
 	}
 
-	if(number == -1)
+	if (number == -1)
 		return;
 
 	GPU_print_error("Pre Texture Bind");
@@ -614,7 +620,7 @@ void GPU_texture_unbind(GPUTexture *tex)
 		return;
 	}
 
-	if(tex->number == -1)
+	if (tex->number == -1)
 		return;
 	
 	GPU_print_error("Pre Texture Unbind");
@@ -710,7 +716,7 @@ int GPU_framebuffer_texture_attach(GPUFrameBuffer *fb, GPUTexture *tex, char err
 	GLenum status;
 	GLenum attachment;
 
-	if(tex->depth)
+	if (tex->depth)
 		attachment = GL_DEPTH_ATTACHMENT_EXT;
 	else
 		attachment = GL_COLOR_ATTACHMENT0_EXT;
@@ -721,7 +727,7 @@ int GPU_framebuffer_texture_attach(GPUFrameBuffer *fb, GPUTexture *tex, char err
 	glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attachment, 
 		tex->target, tex->bindcode, 0);
 
-	if(tex->depth) {
+	if (tex->depth) {
 		glDrawBuffer(GL_NONE);
 		glReadBuffer(GL_NONE);
 	}
@@ -738,7 +744,7 @@ int GPU_framebuffer_texture_attach(GPUFrameBuffer *fb, GPUTexture *tex, char err
 		return 0;
 	}
 
-	if(tex->depth)
+	if (tex->depth)
 		fb->depthtex = tex;
 	else
 		fb->colortex = tex;
@@ -752,15 +758,15 @@ void GPU_framebuffer_texture_detach(GPUFrameBuffer *fb, GPUTexture *tex)
 {
 	GLenum attachment;
 
-	if(!tex->fb)
+	if (!tex->fb)
 		return;
 
-	if(GG.currentfb != tex->fb->object) {
+	if (GG.currentfb != tex->fb->object) {
 		glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, tex->fb->object);
 		GG.currentfb = tex->fb->object;
 	}
 
-	if(tex->depth) {
+	if (tex->depth) {
 		fb->depthtex = NULL;
 		attachment = GL_DEPTH_ATTACHMENT_EXT;
 	}
@@ -813,12 +819,12 @@ void GPU_framebuffer_texture_unbind(GPUFrameBuffer *UNUSED(fb), GPUTexture *UNUS
 
 void GPU_framebuffer_free(GPUFrameBuffer *fb)
 {
-	if(fb->depthtex)
+	if (fb->depthtex)
 		GPU_framebuffer_texture_detach(fb, fb->depthtex);
-	if(fb->colortex)
+	if (fb->colortex)
 		GPU_framebuffer_texture_detach(fb, fb->colortex);
 
-	if(fb->object) {
+	if (fb->object) {
 		glDeleteFramebuffersEXT(1, &fb->object);
 
 		if (GG.currentfb == fb->object) {
@@ -846,7 +852,7 @@ struct GPUOffScreen {
 	GPUTexture *depth;
 
 	/* requested width/height, may be smaller than actual texture size due
-	   to missing non-power of two support, so we compensate for that */
+	 * to missing non-power of two support, so we compensate for that */
 	int w, h;
 };
 
@@ -859,29 +865,29 @@ GPUOffScreen *GPU_offscreen_create(int width, int height, char err_out[256])
 	ofs->h= height;
 
 	ofs->fb = GPU_framebuffer_create();
-	if(!ofs->fb) {
+	if (!ofs->fb) {
 		GPU_offscreen_free(ofs);
 		return NULL;
 	}
 
 	ofs->depth = GPU_texture_create_depth(width, height, err_out);
-	if(!ofs->depth) {
+	if (!ofs->depth) {
 		GPU_offscreen_free(ofs);
 		return NULL;
 	}
 
-	if(!GPU_framebuffer_texture_attach(ofs->fb, ofs->depth, err_out)) {
+	if (!GPU_framebuffer_texture_attach(ofs->fb, ofs->depth, err_out)) {
 		GPU_offscreen_free(ofs);
 		return NULL;
 	}
 
 	ofs->color = GPU_texture_create_2D(width, height, NULL, err_out);
-	if(!ofs->color) {
+	if (!ofs->color) {
 		GPU_offscreen_free(ofs);
 		return NULL;
 	}
 
-	if(!GPU_framebuffer_texture_attach(ofs->fb, ofs->color, err_out)) {
+	if (!GPU_framebuffer_texture_attach(ofs->fb, ofs->color, err_out)) {
 		GPU_offscreen_free(ofs);
 		return NULL;
 	}
@@ -893,11 +899,11 @@ GPUOffScreen *GPU_offscreen_create(int width, int height, char err_out[256])
 
 void GPU_offscreen_free(GPUOffScreen *ofs)
 {
-	if(ofs->fb)
+	if (ofs->fb)
 		GPU_framebuffer_free(ofs->fb);
-	if(ofs->color)
+	if (ofs->color)
 		GPU_texture_free(ofs->color);
-	if(ofs->depth)
+	if (ofs->depth)
 		GPU_texture_free(ofs->depth);
 	
 	MEM_freeN(ofs);
@@ -938,7 +944,7 @@ static void shader_print_errors(const char *task, char *log, const char *code)
 
 	fprintf(stderr, "GPUShader: %s error:\n", task);
 
-	if(G.f & G_DEBUG) {
+	if (G.debug & G_DEBUG) {
 		c = code;
 		while ((c < end) && (pos = strchr(c, '\n'))) {
 			fprintf(stderr, "%2d  ", line);
@@ -967,9 +973,9 @@ GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, /*GPU
 
 	shader = MEM_callocN(sizeof(GPUShader), "GPUShader");
 
-	if(vertexcode)
+	if (vertexcode)
 		shader->vertex = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);
-	if(fragcode)
+	if (fragcode)
 		shader->fragment = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
 	shader->object = glCreateProgramObjectARB();
 
@@ -981,7 +987,7 @@ GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, /*GPU
 		return NULL;
 	}
 
-	if(vertexcode) {
+	if (vertexcode) {
 		glAttachObjectARB(shader->object, shader->vertex);
 		glShaderSourceARB(shader->vertex, 1, (const char**)&vertexcode, NULL);
 
@@ -997,10 +1003,10 @@ GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, /*GPU
 		}
 	}
 
-	if(fragcode) {
+	if (fragcode) {
 		count = 0;
-		if(libcode) fragsource[count++] = libcode;
-		if(fragcode) fragsource[count++] = fragcode;
+		if (libcode) fragsource[count++] = libcode;
+		if (fragcode) fragsource[count++] = fragcode;
 
 		glAttachObjectARB(shader->object, shader->fragment);
 		glShaderSourceARB(shader->fragment, count, fragsource, NULL);
@@ -1017,8 +1023,10 @@ GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, /*GPU
 		}
 	}
 
-	/*if(lib && lib->lib)
-		glAttachObjectARB(shader->object, lib->lib);*/
+#if 0
+	if (lib && lib->lib)
+		glAttachObjectARB(shader->object, lib->lib);
+#endif
 
 	glLinkProgramARB(shader->object);
 	glGetObjectParameterivARB(shader->object, GL_OBJECT_LINK_STATUS_ARB, &status);
@@ -1107,7 +1115,7 @@ int GPU_shader_get_uniform(GPUShader *shader, const char *name)
 
 void GPU_shader_uniform_vector(GPUShader *UNUSED(shader), int location, int length, int arraysize, float *value)
 {
-	if(location == -1)
+	if (location == -1)
 		return;
 
 	GPU_print_error("Pre Uniform Vector");
@@ -1131,10 +1139,10 @@ void GPU_shader_uniform_texture(GPUShader *UNUSED(shader), int location, GPUText
 		return;
 	}
 		
-	if(tex->number == -1)
+	if (tex->number == -1)
 		return;
 
-	if(location == -1)
+	if (location == -1)
 		return;
 
 	GPU_print_error("Pre Uniform Texture");
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index ef2abb2..ab5f204 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -157,13 +157,13 @@ static void gpu_material_set_attrib_id(GPUMaterial *material)
 
 	attribs= &material->attribs;
 	pass= material->pass;
-	if(!pass) {
+	if (!pass) {
 		attribs->totlayer = 0;
 		return;
 	}
 	
 	shader= GPU_pass_shader(pass);
-	if(!shader) {
+	if (!shader) {
 		attribs->totlayer = 0;
 		return;
 	}
@@ -172,11 +172,11 @@ static void gpu_material_set_attrib_id(GPUMaterial *material)
 	 * in case the attrib does not get a valid index back, it was probably
 	 * removed by the glsl compiler by dead code elimination */
 
-	for(a=0, b=0; a<attribs->totlayer; a++) {
+	for (a=0, b=0; a<attribs->totlayer; a++) {
 		BLI_snprintf(name, sizeof(name), "att%d", attribs->layer[a].attribid);
 		attribs->layer[a].glindex = GPU_shader_get_attribute(shader, name);
 
-		if(attribs->layer[a].glindex >= 0) {
+		if (attribs->layer[a].glindex >= 0) {
 			attribs->layer[b] = attribs->layer[a];
 			b++;
 		}
@@ -195,24 +195,24 @@ static int GPU_material_construct_end(GPUMaterial *material)
 		material->pass = GPU_generate_pass(&material->nodes, outlink,
 			&material->attribs, &material->builtins, material->ma->id.name);
 
-		if(!material->pass)
+		if (!material->pass)
 			return 0;
 
 		gpu_material_set_attrib_id(material);
 		
 		shader = GPU_pass_shader(material->pass);
 
-		if(material->builtins & GPU_VIEW_MATRIX)
+		if (material->builtins & GPU_VIEW_MATRIX)
 			material->viewmatloc = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_VIEW_MATRIX));
-		if(material->builtins & GPU_INVERSE_VIEW_MATRIX)
+		if (material->builtins & GPU_INVERSE_VIEW_MATRIX)
 			material->invviewmatloc = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_INVERSE_VIEW_MATRIX));
-		if(material->builtins & GPU_OBJECT_MATRIX)
+		if (material->builtins & GPU_OBJECT_MATRIX)
 			material->obmatloc = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_OBJECT_MATRIX));
-		if(material->builtins & GPU_INVERSE_OBJECT_MATRIX)
+		if (material->builtins & GPU_INVERSE_OBJECT_MATRIX)
 			material->invobmatloc = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_INVERSE_OBJECT_MATRIX));
-		if(material->builtins & GPU_OBCOLOR)
+		if (material->builtins & GPU_OBCOLOR)
 			material->obcolloc = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_OBCOLOR));
-		if(material->builtins & GPU_AUTO_BUMPSCALE)
+		if (material->builtins & GPU_AUTO_BUMPSCALE)
 			material->obautobumpscaleloc = GPU_shader_get_uniform(shader, GPU_builtin_name(GPU_AUTO_BUMPSCALE));
 		return 1;
 	}
@@ -225,18 +225,18 @@ void GPU_material_free(Material *ma)
 	LinkData *link;
 	LinkData *nlink, *mlink, *next;
 
-	for(link=ma->gpumaterial.first; link; link=link->next) {
+	for (link=ma->gpumaterial.first; link; link=link->next) {
 		GPUMaterial *material = link->data;
 
-		if(material->pass)
+		if (material->pass)
 			GPU_pass_free(material->pass);
 
-		for(nlink=material->lamps.first; nlink; nlink=nlink->next) {
+		for (nlink=material->lamps.first; nlink; nlink=nlink->next) {
 			GPULamp *lamp = nlink->data;
 
-			for(mlink=lamp->materials.first; mlink; mlink=next) {
+			for (mlink=lamp->materials.first; mlink; mlink=next) {
 				next = mlink->next;
-				if(mlink->data == ma)
+				if (mlink->data == ma)
 					BLI_freelinkN(&lamp->materials, mlink);
 			}
 		}
@@ -251,15 +251,15 @@ void GPU_material_free(Material *ma)
 
 void GPU_material_bind(GPUMaterial *material, int oblay, int viewlay, double time, int mipmap)
 {
-	if(material->pass) {
+	if (material->pass) {
 		LinkData *nlink;
 		GPULamp *lamp;
 
 		/* handle layer lamps */
-		for(nlink=material->lamps.first; nlink; nlink=nlink->next) {
+		for (nlink=material->lamps.first; nlink; nlink=nlink->next) {
 			lamp= nlink->data;
 
-			if(!lamp->hide && (lamp->lay & viewlay) && (!(lamp->mode & LA_LAYER) || (lamp->lay & oblay))) {
+			if (!lamp->hide && (lamp->lay & viewlay) && (!(lamp->mode & LA_LAYER) || (lamp->lay & oblay))) {
 				lamp->dynenergy = lamp->energy;
 				copy_v3_v3(lamp->dyncol, lamp->col);
 			}
@@ -276,53 +276,53 @@ void GPU_material_bind(GPUMaterial *material, int oblay, int viewlay, double tim
 
 void GPU_material_bind_uniforms(GPUMaterial *material, float obmat[][4], float viewmat[][4], float viewinv[][4], float obcol[4], float autobumpscale)
 {
-	if(material->pass) {
+	if (material->pass) {
 		GPUShader *shader = GPU_pass_shader(material->pass);
 		LinkData *nlink;
 		GPULamp *lamp;
 		float invmat[4][4], col[4];
 
 		/* handle builtins */
-		if(material->builtins & GPU_VIEW_MATRIX) {
+		if (material->builtins & GPU_VIEW_MATRIX) {
 			GPU_shader_uniform_vector(shader, material->viewmatloc, 16, 1, (float*)viewmat);
 		}
-		if(material->builtins & GPU_INVERSE_VIEW_MATRIX) {
+		if (material->builtins & GPU_INVERSE_VIEW_MATRIX) {
 			GPU_shader_uniform_vector(shader, material->invviewmatloc, 16, 1, (float*)viewinv);
 		}
-		if(material->builtins & GPU_OBJECT_MATRIX) {
+		if (material->builtins & GPU_OBJECT_MATRIX) {
 			GPU_shader_uniform_vector(shader, material->obmatloc, 16, 1, (float*)obmat);
 		}
-		if(material->builtins & GPU_INVERSE_OBJECT_MATRIX) {
+		if (material->builtins & GPU_INVERSE_OBJECT_MATRIX) {
 			invert_m4_m4(invmat, obmat);
 			GPU_shader_uniform_vector(shader, material->invobmatloc, 16, 1, (float*)invmat);
 		}
-		if(material->builtins & GPU_OBCOLOR) {
+		if (material->builtins & GPU_OBCOLOR) {
 			copy_v4_v4(col, obcol);
 			CLAMP(col[3], 0.0f, 1.0f);
 			GPU_shader_uniform_vector(shader, material->obcolloc, 4, 1, col);
 		}
-		if(material->builtins & GPU_AUTO_BUMPSCALE) {
+		if (material->builtins & GPU_AUTO_BUMPSCALE) {
 			GPU_shader_uniform_vector(shader, material->obautobumpscaleloc, 1, 1, &autobumpscale);
 		}
 		/* update lamps */
-		for(nlink=material->lamps.first; nlink; nlink=nlink->next) {
+		for (nlink=material->lamps.first; nlink; nlink=nlink->next) {
 			lamp= nlink->data;
 
-			if(material->dynproperty & DYN_LAMP_VEC) {
+			if (material->dynproperty & DYN_LAMP_VEC) {
 				copy_v3_v3(lamp->dynvec, lamp->vec);
 				normalize_v3(lamp->dynvec);
 				negate_v3(lamp->dynvec);
 				mul_mat3_m4_v3(viewmat, lamp->dynvec);
 			}
 
-			if(material->dynproperty & DYN_LAMP_CO) {
+			if (material->dynproperty & DYN_LAMP_CO) {
 				copy_v3_v3(lamp->dynco, lamp->co);
 				mul_m4_v3(viewmat, lamp->dynco);
 			}
 
-			if(material->dynproperty & DYN_LAMP_IMAT)
+			if (material->dynproperty & DYN_LAMP_IMAT)
 				mult_m4_m4m4(lamp->dynimat, lamp->imat, viewinv);
-			if(material->dynproperty & DYN_LAMP_PERSMAT)
+			if (material->dynproperty & DYN_LAMP_PERSMAT)
 				mult_m4_m4m4(lamp->dynpersmat, lamp->persmat, viewinv);
 		}
 
@@ -350,7 +350,7 @@ void GPU_material_vertex_attributes(GPUMaterial *material, GPUVertexAttribs *att
 
 void GPU_material_output_link(GPUMaterial *material, GPUNodeLink *link)
 {
-	if(!material->outlink)
+	if (!material->outlink)
 		material->outlink= link;
 }
 
@@ -361,7 +361,7 @@ void GPU_material_enable_alpha(GPUMaterial *material)
 
 GPUBlendMode GPU_material_alpha_blend(GPUMaterial *material, float obcol[4])
 {
-	if(material->alpha || (material->obcolalpha && obcol[3] < 1.0f))
+	if (material->alpha || (material->obcolalpha && obcol[3] < 1.0f))
 		return GPU_BLEND_ALPHA;
 	else
 		return GPU_BLEND_SOLID;
@@ -385,7 +385,7 @@ static GPUNodeLink *lamp_get_visibility(GPUMaterial *mat, GPULamp *lamp, GPUNode
 	GPUNodeLink *visifac, *inpr;
 
 	/* from get_lamp_visibility */
-	if(lamp->type==LA_SUN || lamp->type==LA_HEMI) {
+	if (lamp->type==LA_SUN || lamp->type==LA_HEMI) {
 		mat->dynproperty |= DYN_LAMP_VEC;
 		GPU_link(mat, "lamp_visibility_sun_hemi", GPU_dynamic_uniform(lamp->dynvec, GPU_DYNAMIC_LAMP_DYNVEC, lamp->ob), lv, dist, &visifac);
 		return visifac;
@@ -394,7 +394,7 @@ static GPUNodeLink *lamp_get_visibility(GPUMaterial *mat, GPULamp *lamp, GPUNode
 		mat->dynproperty |= DYN_LAMP_CO;
 		GPU_link(mat, "lamp_visibility_other", GPU_builtin(GPU_VIEW_POSITION), GPU_dynamic_uniform(lamp->dynco, GPU_DYNAMIC_LAMP_DYNCO, lamp->ob), lv, dist, &visifac);
 
-		if(lamp->type==LA_AREA)
+		if (lamp->type==LA_AREA)
 			return visifac;
 
 		switch(lamp->falloff_type)
@@ -421,11 +421,11 @@ static GPUNodeLink *lamp_get_visibility(GPUMaterial *mat, GPULamp *lamp, GPUNode
 				break;
 		}
 
-		if(lamp->mode & LA_SPHERE)
+		if (lamp->mode & LA_SPHERE)
 			GPU_link(mat, "lamp_visibility_sphere", GPU_uniform(&lamp->dist), *dist, visifac, &visifac);
 
-		if(lamp->type == LA_SPOT) {
-			if(lamp->mode & LA_SQUARE) {
+		if (lamp->type == LA_SPOT) {
+			if (lamp->mode & LA_SQUARE) {
 				mat->dynproperty |= DYN_LAMP_VEC|DYN_LAMP_IMAT;
 				GPU_link(mat, "lamp_visibility_spot_square", GPU_dynamic_uniform(lamp->dynvec, GPU_DYNAMIC_LAMP_DYNVEC, lamp->ob), GPU_dynamic_uniform((float*)lamp->dynimat, GPU_DYNAMIC_LAMP_DYNIMAT, lamp->ob), *lv, &inpr);
 			}
@@ -511,9 +511,9 @@ static void ramp_diffuse_result(GPUShadeInput *shi, GPUNodeLink **diff)
 	GPUMaterial *mat= shi->gpumat;
 	GPUNodeLink *fac;
 
-	if(!(mat->scene->gm.flag & GAME_GLSL_NO_RAMPS)) {
-		if(ma->ramp_col) {
-			if(ma->rampin_col==MA_RAMP_IN_RESULT) {
+	if (!(mat->scene->gm.flag & GAME_GLSL_NO_RAMPS)) {
+		if (ma->ramp_col) {
+			if (ma->rampin_col==MA_RAMP_IN_RESULT) {
 				GPU_link(mat, "ramp_rgbtobw", *diff, &fac);
 				
 				/* colorband + blend */
@@ -527,10 +527,10 @@ static void add_to_diffuse(GPUMaterial *mat, Material *ma, GPUShadeInput *shi, G
 {
 	GPUNodeLink *fac, *tmp, *addcol;
 	
-	if(!(mat->scene->gm.flag & GAME_GLSL_NO_RAMPS) &&
+	if (!(mat->scene->gm.flag & GAME_GLSL_NO_RAMPS) &&
 	   ma->ramp_col && (ma->mode & MA_RAMP_COL)) {
 		/* MA_RAMP_IN_RESULT is exceptional */
-		if(ma->rampin_col==MA_RAMP_IN_RESULT) {
+		if (ma->rampin_col==MA_RAMP_IN_RESULT) {
 			addcol = shi->rgb;
 		}
 		else {
@@ -567,7 +567,7 @@ static void ramp_spec_result(GPUShadeInput *shi, GPUNodeLink **spec)
 	GPUMaterial *mat= shi->gpumat;
 	GPUNodeLink *fac;
 
-	if(!(mat->scene->gm.flag & GAME_GLSL_NO_RAMPS) &&
+	if (!(mat->scene->gm.flag & GAME_GLSL_NO_RAMPS) &&
 	   ma->ramp_spec && ma->rampin_spec==MA_RAMP_IN_RESULT) {
 		GPU_link(mat, "ramp_rgbtobw", *spec, &fac);
 		
@@ -585,7 +585,7 @@ static void do_specular_ramp(GPUShadeInput *shi, GPUNodeLink *is, GPUNodeLink *t
 	*spec = shi->specrgb;
 
 	/* MA_RAMP_IN_RESULT is exception */
-	if(ma->ramp_spec && (ma->rampin_spec!=MA_RAMP_IN_RESULT)) {
+	if (ma->ramp_spec && (ma->rampin_spec!=MA_RAMP_IN_RESULT)) {
 		
 		/* input */
 		switch(ma->rampin_spec) {
@@ -623,7 +623,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
 	GPUNodeLink *outcol, *specfac, *t, *shadfac= NULL;
 	float one = 1.0f;
 
-	if((lamp->mode & LA_ONLYSHADOW) && !(ma->mode & MA_SHADOW))
+	if ((lamp->mode & LA_ONLYSHADOW) && !(ma->mode & MA_SHADOW))
 		return;
 	
 	vn= shi->vn;
@@ -631,19 +631,19 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
 
 	visifac= lamp_get_visibility(mat, lamp, &lv, &dist);
 
-	/*if(ma->mode & MA_TANGENT_V)
+	/*if (ma->mode & MA_TANGENT_V)
 		GPU_link(mat, "shade_tangent_v", lv, GPU_attribute(CD_TANGENT, ""), &vn);*/
 	
 	GPU_link(mat, "shade_inp", vn, lv, &inp);
 
-	if(lamp->mode & LA_NO_DIFF) {
+	if (lamp->mode & LA_NO_DIFF) {
 		GPU_link(mat, "shade_is_no_diffuse", &is);
 	}
-	else if(lamp->type == LA_HEMI) {
+	else if (lamp->type == LA_HEMI) {
 		GPU_link(mat, "shade_is_hemi", inp, &is);
 	}
 	else {
-		if(lamp->type == LA_AREA) {
+		if (lamp->type == LA_AREA) {
 			float area[4][4]= {{0.0f}}, areasize= 0.0f;
 
 			mat->dynproperty |= DYN_LAMP_VEC|DYN_LAMP_CO;
@@ -653,34 +653,35 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
 
 		is= inp; /* Lambert */
 
-		if(!(mat->scene->gm.flag & GAME_GLSL_NO_SHADERS)) {
-			if(ma->diff_shader==MA_DIFF_ORENNAYAR)
+		if (!(mat->scene->gm.flag & GAME_GLSL_NO_SHADERS)) {
+			if (ma->diff_shader==MA_DIFF_ORENNAYAR)
 				GPU_link(mat, "shade_diffuse_oren_nayer", inp, vn, lv, view, GPU_uniform(&ma->roughness), &is);
-			else if(ma->diff_shader==MA_DIFF_TOON)
+			else if (ma->diff_shader==MA_DIFF_TOON)
 				GPU_link(mat, "shade_diffuse_toon", vn, lv, view, GPU_uniform(&ma->param[0]), GPU_uniform(&ma->param[1]), &is);
-			else if(ma->diff_shader==MA_DIFF_MINNAERT)
+			else if (ma->diff_shader==MA_DIFF_MINNAERT)
 				GPU_link(mat, "shade_diffuse_minnaert", inp, vn, view, GPU_uniform(&ma->darkness), &is);
-			else if(ma->diff_shader==MA_DIFF_FRESNEL)
+			else if (ma->diff_shader==MA_DIFF_FRESNEL)
 				GPU_link(mat, "shade_diffuse_fresnel", vn, lv, view, GPU_uniform(&ma->param[0]), GPU_uniform(&ma->param[1]), &is);
 		}
 	}
 
-	if(!(mat->scene->gm.flag & GAME_GLSL_NO_SHADERS))
-		if(ma->shade_flag & MA_CUBIC)
+	if (!(mat->scene->gm.flag & GAME_GLSL_NO_SHADERS))
+		if (ma->shade_flag & MA_CUBIC)
 			GPU_link(mat, "shade_cubic", is, &is);
 	
 	i = is;
 	GPU_link(mat, "shade_visifac", i, visifac, shi->refl, &i);
 
+#if 0
+	if (ma->mode & MA_TANGENT_VN)
+		GPU_link(mat, "shade_tangent_v_spec", GPU_attribute(CD_TANGENT, ""), &vn);
+#endif
 
-	/*if(ma->mode & MA_TANGENT_VN)
-		GPU_link(mat, "shade_tangent_v_spec", GPU_attribute(CD_TANGENT, ""), &vn);*/
-
-	/* this replaces if(i > 0.0) conditional until that is supported */
+	/* this replaces if (i > 0.0) conditional until that is supported */
 	// done in shade_visifac now, GPU_link(mat, "mtex_value_clamp_positive", i, &i);
 
-	if((ma->mode & MA_SHADOW) && GPU_lamp_has_shadow_buffer(lamp)) {
-		if(!(mat->scene->gm.flag & GAME_GLSL_NO_SHADOWS)) {
+	if ((ma->mode & MA_SHADOW) && GPU_lamp_has_shadow_buffer(lamp)) {
+		if (!(mat->scene->gm.flag & GAME_GLSL_NO_SHADOWS)) {
 			mat->dynproperty |= DYN_LAMP_PERSMAT;
 
 			GPU_link(mat, "test_shadowbuf",
@@ -689,15 +690,15 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
 				GPU_dynamic_uniform((float*)lamp->dynpersmat, GPU_DYNAMIC_LAMP_DYNPERSMAT, lamp->ob),
 				GPU_uniform(&lamp->bias), inp, &shadfac);
 			
-			if(lamp->mode & LA_ONLYSHADOW) {
+			if (lamp->mode & LA_ONLYSHADOW) {
 				GPU_link(mat, "shade_only_shadow", i, shadfac,
 					GPU_dynamic_uniform(&lamp->dynenergy, GPU_DYNAMIC_LAMP_DYNENERGY, lamp->ob), &shadfac);
 				
-				if(!(lamp->mode & LA_NO_DIFF))
+				if (!(lamp->mode & LA_NO_DIFF))
 					GPU_link(mat, "shade_only_shadow_diffuse", shadfac, shi->rgb,
 						shr->diff, &shr->diff);
 
-				if(!(lamp->mode & LA_NO_SPEC))
+				if (!(lamp->mode & LA_NO_SPEC))
 					GPU_link(mat, "shade_only_shadow_specular", shadfac, shi->specrgb,
 						shr->spec, &shr->spec);
 				
@@ -709,7 +710,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
 			GPU_link(mat, "math_multiply", i, shadfac, &i);
 		}
 	}
-	else if((mat->scene->gm.flag & GAME_GLSL_NO_SHADOWS) && (lamp->mode & LA_ONLYSHADOW)) {
+	else if ((mat->scene->gm.flag & GAME_GLSL_NO_SHADOWS) && (lamp->mode & LA_ONLYSHADOW)) {
 		add_user_list(&mat->lamps, lamp);
 		add_user_list(&lamp->materials, shi->gpumat->ma);
 		return;
@@ -717,40 +718,40 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
 	else
 		GPU_link(mat, "set_value", GPU_uniform(&one), &shadfac);
 
-	if(GPU_link_changed(shi->refl) || ma->ref != 0.0f) {
-		if(!(lamp->mode & LA_NO_DIFF)) {
+	if (GPU_link_changed(shi->refl) || ma->ref != 0.0f) {
+		if (!(lamp->mode & LA_NO_DIFF)) {
 			GPUNodeLink *rgb;
 			GPU_link(mat, "shade_mul_value", i, GPU_dynamic_uniform(lamp->dyncol, GPU_DYNAMIC_LAMP_DYNCOL, lamp->ob), &rgb);
 			add_to_diffuse(mat, ma, shi, is, rgb, &shr->diff);
 		}
 	}
 
-	if(mat->scene->gm.flag & GAME_GLSL_NO_SHADERS);
-	else if(!(lamp->mode & LA_NO_SPEC) && !(lamp->mode & LA_ONLYSHADOW) &&
+	if (mat->scene->gm.flag & GAME_GLSL_NO_SHADERS);
+	else if (!(lamp->mode & LA_NO_SPEC) && !(lamp->mode & LA_ONLYSHADOW) &&
 	   (GPU_link_changed(shi->spec) || ma->spec != 0.0f)) {
-		if(lamp->type == LA_HEMI) {
+		if (lamp->type == LA_HEMI) {
 			GPU_link(mat, "shade_hemi_spec", vn, lv, view, GPU_uniform(&ma->spec), shi->har, visifac, &t);
 			GPU_link(mat, "shade_add_spec", t, GPU_dynamic_uniform(lamp->dyncol, GPU_DYNAMIC_LAMP_DYNCOL, lamp->ob), shi->specrgb, &outcol);
 			GPU_link(mat, "shade_add_clamped", shr->spec, outcol, &shr->spec);
 		}
 		else {
-			if(ma->spec_shader==MA_SPEC_PHONG)
+			if (ma->spec_shader==MA_SPEC_PHONG)
 				GPU_link(mat, "shade_phong_spec", vn, lv, view, shi->har, &specfac);
-			else if(ma->spec_shader==MA_SPEC_COOKTORR)
+			else if (ma->spec_shader==MA_SPEC_COOKTORR)
 				GPU_link(mat, "shade_cooktorr_spec", vn, lv, view, shi->har, &specfac);
-			else if(ma->spec_shader==MA_SPEC_BLINN)
+			else if (ma->spec_shader==MA_SPEC_BLINN)
 				GPU_link(mat, "shade_blinn_spec", vn, lv, view, GPU_uniform(&ma->refrac), shi->har, &specfac);
-			else if(ma->spec_shader==MA_SPEC_WARDISO)
+			else if (ma->spec_shader==MA_SPEC_WARDISO)
 				GPU_link(mat, "shade_wardiso_spec", vn, lv, view, GPU_uniform(&ma->rms), &specfac);
 			else
 				GPU_link(mat, "shade_toon_spec", vn, lv, view, GPU_uniform(&ma->param[2]), GPU_uniform(&ma->param[3]), &specfac);
 
-			if(lamp->type==LA_AREA)
+			if (lamp->type==LA_AREA)
 				GPU_link(mat, "shade_spec_area_inp", specfac, inp, &specfac);
 
 			GPU_link(mat, "shade_spec_t", shadfac, shi->spec, visifac, specfac, &t);
 
-			if(ma->mode & MA_RAMP_SPEC) {
+			if (ma->mode & MA_RAMP_SPEC) {
 				GPUNodeLink *spec;
 				do_specular_ramp(shi, specfac, t, &spec);
 				GPU_link(mat, "shade_add_spec", t, GPU_dynamic_uniform(lamp->dyncol, GPU_DYNAMIC_LAMP_DYNCOL, lamp->ob), spec, &outcol);
@@ -774,12 +775,12 @@ static void material_lights(GPUShadeInput *shi, GPUShadeResult *shr)
 	Scene *sce_iter;
 	GPULamp *lamp;
 	
-	for(SETLOOPER(shi->gpumat->scene, sce_iter, base)) {
+	for (SETLOOPER(shi->gpumat->scene, sce_iter, base)) {
 		ob= base->object;
 
-		if(ob->type==OB_LAMP) {
+		if (ob->type==OB_LAMP) {
 			lamp = GPU_lamp_from_blender(shi->gpumat->scene, ob, NULL);
-			if(lamp)
+			if (lamp)
 				shade_one_light(shi, shr, lamp);
 		}
 
@@ -787,14 +788,14 @@ static void material_lights(GPUShadeInput *shi, GPUShadeResult *shr)
 			DupliObject *dob;
 			ListBase *lb = object_duplilist(shi->gpumat->scene, ob);
 			
-			for(dob=lb->first; dob; dob=dob->next) {
+			for (dob=lb->first; dob; dob=dob->next) {
 				Object *ob_iter = dob->ob;
 
-				if(ob_iter->type==OB_LAMP) {
+				if (ob_iter->type==OB_LAMP) {
 					copy_m4_m4(ob_iter->obmat, dob->mat);
 
 					lamp = GPU_lamp_from_blender(shi->gpumat->scene, ob_iter, ob);
-					if(lamp)
+					if (lamp)
 						shade_one_light(shi, shr, lamp);
 				}
 			}
@@ -923,33 +924,33 @@ static void do_material_tex(GPUShadeInput *shi)
 	orn= texco_norm;
 
 	/* go over texture slots */
-	for(tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
+	for (tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
 		/* separate tex switching */
-		if(ma->septex & (1<<tex_nr)) continue;
+		if (ma->septex & (1<<tex_nr)) continue;
 		
-		if(ma->mtex[tex_nr]) {
+		if (ma->mtex[tex_nr]) {
 			mtex= ma->mtex[tex_nr];
 			
 			tex= mtex->tex;
-			if(tex == NULL) continue;
+			if (tex == NULL) continue;
 
 			/* which coords */
-			if(mtex->texco==TEXCO_ORCO)
+			if (mtex->texco==TEXCO_ORCO)
 				texco= texco_orco;
-			else if(mtex->texco==TEXCO_OBJECT)
+			else if (mtex->texco==TEXCO_OBJECT)
 				texco= texco_object;
-			else if(mtex->texco==TEXCO_NORM)
+			else if (mtex->texco==TEXCO_NORM)
 				texco= orn;
-			else if(mtex->texco==TEXCO_TANGENT)
+			else if (mtex->texco==TEXCO_TANGENT)
 				texco= texco_object;
-			else if(mtex->texco==TEXCO_GLOB)
+			else if (mtex->texco==TEXCO_GLOB)
 				texco= texco_global;
-			else if(mtex->texco==TEXCO_REFL) {
+			else if (mtex->texco==TEXCO_REFL) {
 				GPU_link(mat, "texco_refl", shi->vn, shi->view, &shi->ref);
 				texco= shi->ref;
 			}
-			else if(mtex->texco==TEXCO_UV) {
-				if(1) { //!(texco_uv && strcmp(mtex->uvname, lastuvname) == 0)) {
+			else if (mtex->texco==TEXCO_UV) {
+				if (1) { //!(texco_uv && strcmp(mtex->uvname, lastuvname) == 0)) {
 					GPU_link(mat, "texco_uv", GPU_attribute(CD_MTFACE, mtex->uvname), &texco_uv);
 					/*lastuvname = mtex->uvname;*/ /*UNUSED*/
 				}
@@ -959,133 +960,132 @@ static void do_material_tex(GPUShadeInput *shi)
 				continue;
 
 			/* in case of uv, this would just undo a multiplication in texco_uv */
-			if(mtex->texco != TEXCO_UV)
+			if (mtex->texco != TEXCO_UV)
 				GPU_link(mat, "mtex_2d_mapping", texco, &texco);
 
-			if(mtex->size[0] != 1.0f || mtex->size[1] != 1.0f || mtex->size[2] != 1.0f)
+			if (mtex->size[0] != 1.0f || mtex->size[1] != 1.0f || mtex->size[2] != 1.0f)
 				GPU_link(mat, "mtex_mapping_size", texco, GPU_uniform(mtex->size), &texco);
 
 			ofs[0] = mtex->ofs[0] + 0.5f - 0.5f*mtex->size[0];
 			ofs[1] = mtex->ofs[1] + 0.5f - 0.5f*mtex->size[1];
 			ofs[2] = 0.0f;
-			if(ofs[0] != 0.0f || ofs[1] != 0.0f || ofs[2] != 0.0f)
+			if (ofs[0] != 0.0f || ofs[1] != 0.0f || ofs[2] != 0.0f)
 				GPU_link(mat, "mtex_mapping_ofs", texco, GPU_uniform(ofs), &texco);
 
 			talpha = 0;
 
-			if(tex && tex->type == TEX_IMAGE && tex->ima) {
+			if (tex && tex->type == TEX_IMAGE && tex->ima) {
 				GPU_link(mat, "mtex_image", texco, GPU_image(tex->ima, &tex->iuser), &tin, &trgb);
 				rgbnor= TEX_RGB;
 
-				if(tex->imaflag & TEX_USEALPHA)
+				if (tex->imaflag & TEX_USEALPHA)
 					talpha= 1;
 			}
 			else continue;
 
 			/* texture output */
-			if((rgbnor & TEX_RGB) && (mtex->texflag & MTEX_RGBTOINT)) {
+			if ((rgbnor & TEX_RGB) && (mtex->texflag & MTEX_RGBTOINT)) {
 				GPU_link(mat, "mtex_rgbtoint", trgb, &tin);
 				rgbnor -= TEX_RGB;
 			}
 
-			if(mtex->texflag & MTEX_NEGATIVE) {
-				if(rgbnor & TEX_RGB)
+			if (mtex->texflag & MTEX_NEGATIVE) {
+				if (rgbnor & TEX_RGB)
 					GPU_link(mat, "mtex_rgb_invert", trgb, &trgb);
 				else
 					GPU_link(mat, "mtex_value_invert", tin, &tin);
 			}
 
-			if(mtex->texflag & MTEX_STENCIL) {
-				if(rgbnor & TEX_RGB)
+			if (mtex->texflag & MTEX_STENCIL) {
+				if (rgbnor & TEX_RGB)
 					GPU_link(mat, "mtex_rgb_stencil", stencil, trgb, &stencil, &trgb);
 				else
 					GPU_link(mat, "mtex_value_stencil", stencil, tin, &stencil, &tin);
 			}
 
 			/* mapping */
-			if(mtex->mapto & (MAP_COL+MAP_COLSPEC)) {
+			if (mtex->mapto & (MAP_COL+MAP_COLSPEC)) {
 				/* stencil maps on the texture control slider, not texture intensity value */
-				if((rgbnor & TEX_RGB)==0) {
+				if ((rgbnor & TEX_RGB)==0) {
 					GPU_link(mat, "set_rgb", GPU_uniform(&mtex->r), &tcol);
 				}
 				else {
 					GPU_link(mat, "set_rgba", trgb, &tcol);
 
-					if(mtex->mapto & MAP_ALPHA)
+					if (mtex->mapto & MAP_ALPHA)
 						GPU_link(mat, "set_value", stencil, &tin);
-					else if(talpha)
+					else if (talpha)
 						GPU_link(mat, "mtex_alpha_from_col", trgb, &tin);
 					else
 						GPU_link(mat, "set_value_one", &tin);
 				}
 
-				if(tex->type==TEX_IMAGE)
-					if(gpu_do_color_management(mat))
+				if (tex->type==TEX_IMAGE)
+					if (gpu_do_color_management(mat))
 						GPU_link(mat, "srgb_to_linearrgb", tcol, &tcol);
 				
-				if(mtex->mapto & MAP_COL) {
+				if (mtex->mapto & MAP_COL) {
 					GPUNodeLink *colfac;
 
-					if(mtex->colfac == 1.0f) colfac = stencil;
+					if (mtex->colfac == 1.0f) colfac = stencil;
 					else GPU_link(mat, "math_multiply", GPU_uniform(&mtex->colfac), stencil, &colfac);
 
 					texture_rgb_blend(mat, tcol, shi->rgb, tin, colfac, mtex->blendtype, &shi->rgb);
 				}
 				
-				if(!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && (mtex->mapto & MAP_COLSPEC)) {
+				if (!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && (mtex->mapto & MAP_COLSPEC)) {
 					GPUNodeLink *colspecfac;
 
-					if(mtex->colspecfac == 1.0f) colspecfac = stencil;
+					if (mtex->colspecfac == 1.0f) colspecfac = stencil;
 					else GPU_link(mat, "math_multiply", GPU_uniform(&mtex->colspecfac), stencil, &colspecfac);
 
 					texture_rgb_blend(mat, tcol, shi->specrgb, tin, colspecfac, mtex->blendtype, &shi->specrgb);
 				}
 			}
 
-			if(!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && (mtex->mapto & MAP_NORM)) {
-				if(tex->type==TEX_IMAGE) {
+			if (!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && (mtex->mapto & MAP_NORM)) {
+				if (tex->type==TEX_IMAGE) {
 					found_deriv_map = tex->imaflag & TEX_DERIVATIVEMAP;
 
-					if(tex->imaflag & TEX_NORMALMAP) {
+					if (tex->imaflag & TEX_NORMALMAP) {
 						/* normalmap image */
 						GPU_link(mat, "mtex_normal", texco, GPU_image(tex->ima, &tex->iuser), &tnor );
 						
-						if(mtex->norfac < 0.0f)
+						if (mtex->norfac < 0.0f)
 							GPU_link(mat, "mtex_negate_texnormal", tnor, &tnor);
 
-						if(mtex->normapspace == MTEX_NSPACE_TANGENT)
-						{
-							if(iFirstTimeNMap!=0)
-							{
+						if (mtex->normapspace == MTEX_NSPACE_TANGENT) {
+							if (iFirstTimeNMap != 0) {
 								// use unnormalized normal (this is how we bake it - closer to gamedev)
 								GPUNodeLink *vNegNorm;
 								GPU_link(mat, "vec_math_negate", GPU_builtin(GPU_VIEW_NORMAL), &vNegNorm);
 								GPU_link(mat, "mtex_nspace_tangent", GPU_attribute(CD_TANGENT, ""), vNegNorm, tnor, &newnor);
 								iFirstTimeNMap = 0;
 							}
-							else	// otherwise use accumulated perturbations
-							{
+							else { /* otherwise use accumulated perturbations */
 								GPU_link(mat, "mtex_nspace_tangent", GPU_attribute(CD_TANGENT, ""), shi->vn, tnor, &newnor);
 							}
 						}
-						else
+						else {
 							newnor = tnor;
+						}
 						
-						norfac = MIN2(fabsf(mtex->norfac), 1.0f);
+						norfac = minf(fabsf(mtex->norfac), 1.0f);
 						
-						if(norfac == 1.0f && !GPU_link_changed(stencil)) {
+						if (norfac == 1.0f && !GPU_link_changed(stencil)) {
 							shi->vn = newnor;
 						}
 						else {
 							tnorfac = GPU_uniform(&norfac);
 	
-							if(GPU_link_changed(stencil))
+							if (GPU_link_changed(stencil))
 								GPU_link(mat, "math_multiply", tnorfac, stencil, &tnorfac);
 	
 							GPU_link(mat, "mtex_blend_normal", tnorfac, shi->vn, newnor, &shi->vn);
 						}
 						
-					} else if( (mtex->texflag & (MTEX_3TAP_BUMP|MTEX_5TAP_BUMP|MTEX_BICUBIC_BUMP)) || found_deriv_map) {
+					}
+					else if ( (mtex->texflag & (MTEX_3TAP_BUMP|MTEX_5TAP_BUMP|MTEX_BICUBIC_BUMP)) || found_deriv_map) {
 						/* ntap bumpmap image */
 						int iBumpSpace;
 						float ima_x, ima_y;
@@ -1099,16 +1099,16 @@ static void do_material_tex(GPUShadeInput *shi)
 						GPUNodeLink *dBs, *dBt, *fDet;
 
 						hScale = 0.1;		// compatibility adjustment factor for all bumpspace types
-						if( mtex->texflag & MTEX_BUMP_TEXTURESPACE )
+						if ( mtex->texflag & MTEX_BUMP_TEXTURESPACE )
 							hScale = 13.0f;		// factor for scaling texspace bumps
-						else if(found_deriv_map!=0)
+						else if (found_deriv_map!=0)
 							hScale = 1.0f;
 
 						// resolve texture resolution
-						if( (mtex->texflag & MTEX_BUMP_TEXTURESPACE) || found_deriv_map ) {
+						if ( (mtex->texflag & MTEX_BUMP_TEXTURESPACE) || found_deriv_map ) {
 							ImBuf *ibuf= BKE_image_get_ibuf(tex->ima, &tex->iuser);
 							ima_x= 512.0f; ima_y= 512.f;		// prevent calling textureSize, glsl 1.3 only
-							if(ibuf) {
+							if (ibuf) {
 								ima_x= ibuf->x;
 								ima_y= ibuf->y;
 								aspect = ((float) ima_y) / ima_x;
@@ -1120,21 +1120,20 @@ static void do_material_tex(GPUShadeInput *shi)
 						// to inverting the bump map. Should this ever change
 						// this negate must be removed.
 						norfac = -hScale * mtex->norfac;
-						if(found_deriv_map)
-						{
+						if (found_deriv_map) {
 							float fVirtDim = sqrtf(fabsf(ima_x*mtex->size[0]*ima_y*mtex->size[1]));
 							norfac /= MAX2(fVirtDim, FLT_EPSILON);
 						}
 
 						tnorfac = GPU_uniform(&norfac);
 
-						if(found_deriv_map)
+						if (found_deriv_map)
 							GPU_link(mat, "math_multiply", tnorfac, GPU_builtin(GPU_AUTO_BUMPSCALE), &tnorfac);
 						
-						if(GPU_link_changed(stencil))
+						if (GPU_link_changed(stencil))
 							GPU_link(mat, "math_multiply", tnorfac, stencil, &tnorfac);
 						
-						if( !init_done ) {
+						if ( !init_done ) {
 							// copy shi->vn to vNorg and vNacc, set magnitude to 1
 							GPU_link(mat, "mtex_bump_normals_init", shi->vn, &vNorg, &vNacc, &fPrevMagnitude);
 							iBumpSpacePrev = 0;
@@ -1142,17 +1141,17 @@ static void do_material_tex(GPUShadeInput *shi)
 						}
 						
 						// find current bump space
-						if( mtex->texflag & MTEX_BUMP_OBJECTSPACE )
+						if ( mtex->texflag & MTEX_BUMP_OBJECTSPACE )
 							iBumpSpace = 1;
-						else if( mtex->texflag & MTEX_BUMP_TEXTURESPACE )
+						else if ( mtex->texflag & MTEX_BUMP_TEXTURESPACE )
 							iBumpSpace = 2;
 						else
 							iBumpSpace = 4; // ViewSpace
 						
 						// re-initialize if bump space changed
-						if( iBumpSpacePrev != iBumpSpace ) {
+						if ( iBumpSpacePrev != iBumpSpace ) {
 							
-							if( mtex->texflag & MTEX_BUMP_OBJECTSPACE ) 
+							if ( mtex->texflag & MTEX_BUMP_OBJECTSPACE )
 								GPU_link( mat, "mtex_bump_init_objspace",
 										  surf_pos, vNorg, 
 								          GPU_builtin(GPU_VIEW_MATRIX), GPU_builtin(GPU_INVERSE_VIEW_MATRIX), GPU_builtin(GPU_OBJECT_MATRIX),  GPU_builtin(GPU_INVERSE_OBJECT_MATRIX), 
@@ -1160,7 +1159,7 @@ static void do_material_tex(GPUShadeInput *shi)
 										  &fPrevMagnitude, &vNacc, 
 								          &vR1, &vR2, &fDet );
 								
-							else if( mtex->texflag & MTEX_BUMP_TEXTURESPACE )
+							else if ( mtex->texflag & MTEX_BUMP_TEXTURESPACE )
 								GPU_link( mat, "mtex_bump_init_texturespace",
 										  surf_pos, vNorg, 
 								          fPrevMagnitude, vNacc,
@@ -1178,25 +1177,26 @@ static void do_material_tex(GPUShadeInput *shi)
 						}
 						
 						
-						if(found_deriv_map) {
+						if (found_deriv_map) {
 							GPU_link( mat, "mtex_bump_deriv", 
 							          texco, GPU_image(tex->ima, &tex->iuser), GPU_uniform(&ima_x), GPU_uniform(&ima_y), tnorfac,
 							          &dBs, &dBt );
 						}
-						else if( mtex->texflag & MTEX_3TAP_BUMP )
+						else if ( mtex->texflag & MTEX_3TAP_BUMP )
 							GPU_link( mat, "mtex_bump_tap3", 
 							          texco, GPU_image(tex->ima, &tex->iuser), tnorfac,
 							          &dBs, &dBt );
-						else if( mtex->texflag & MTEX_5TAP_BUMP )
+						else if ( mtex->texflag & MTEX_5TAP_BUMP )
 							GPU_link( mat, "mtex_bump_tap5",
 							          texco, GPU_image(tex->ima, &tex->iuser), tnorfac,
 							          &dBs, &dBt );
-						else if( mtex->texflag & MTEX_BICUBIC_BUMP ){
-							if(GPU_bicubic_bump_support()){
+						else if ( mtex->texflag & MTEX_BICUBIC_BUMP ) {
+							if (GPU_bicubic_bump_support()) {
 								GPU_link( mat, "mtex_bump_bicubic",
 										texco, GPU_image(tex->ima, &tex->iuser), tnorfac,
 										&dBs, &dBt );
-							}else{
+							}
+							else {
 								GPU_link( mat, "mtex_bump_tap5",
 										texco, GPU_image(tex->ima, &tex->iuser), tnorfac,
 										&dBs, &dBt );
@@ -1204,14 +1204,15 @@ static void do_material_tex(GPUShadeInput *shi)
 						}
 						
 						
-						if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) {
+						if ( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) {
 							float imag_tspace_dimension_y = aspect*imag_tspace_dimension_x;
 							GPU_link( mat, "mtex_bump_apply_texspace",
 							          fDet, dBs, dBt, vR1, vR2, 
 							          GPU_image(tex->ima, &tex->iuser), texco,
 									  GPU_uniform(&imag_tspace_dimension_x), GPU_uniform(&imag_tspace_dimension_y), vNacc,
 							          &vNacc, &shi->vn );
-						} else
+						}
+						else
 							GPU_link( mat, "mtex_bump_apply",
 							          fDet, dBs, dBt, vR1, vR2, vNacc,
 							          &vNacc, &shi->vn );
@@ -1222,64 +1223,64 @@ static void do_material_tex(GPUShadeInput *shi)
 				GPU_link(mat, "vec_math_negate", shi->vn, &orn);
 			}
 
-			if((mtex->mapto & MAP_VARS)) {
-				if(rgbnor & TEX_RGB) {
-					if(talpha)
+			if ((mtex->mapto & MAP_VARS)) {
+				if (rgbnor & TEX_RGB) {
+					if (talpha)
 						GPU_link(mat, "mtex_alpha_from_col", trgb, &tin);
 					else
 						GPU_link(mat, "mtex_rgbtoint", trgb, &tin);
 				}
 
-				if(!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_REF) {
+				if (!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_REF) {
 					GPUNodeLink *difffac;
 
-					if(mtex->difffac == 1.0f) difffac = stencil;
+					if (mtex->difffac == 1.0f) difffac = stencil;
 					else GPU_link(mat, "math_multiply", GPU_uniform(&mtex->difffac), stencil, &difffac);
 
 					texture_value_blend(mat, GPU_uniform(&mtex->def_var), shi->refl, tin, difffac, mtex->blendtype, &shi->refl);
 					GPU_link(mat, "mtex_value_clamp_positive", shi->refl, &shi->refl);
 				}
-				if(!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_SPEC) {
+				if (!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_SPEC) {
 					GPUNodeLink *specfac;
 
-					if(mtex->specfac == 1.0f) specfac = stencil;
+					if (mtex->specfac == 1.0f) specfac = stencil;
 					else GPU_link(mat, "math_multiply", GPU_uniform(&mtex->specfac), stencil, &specfac);
 
 					texture_value_blend(mat, GPU_uniform(&mtex->def_var), shi->spec, tin, specfac, mtex->blendtype, &shi->spec);
 					GPU_link(mat, "mtex_value_clamp_positive", shi->spec, &shi->spec);
 				}
-				if(!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_EMIT) {
+				if (!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_EMIT) {
 					GPUNodeLink *emitfac;
 
-					if(mtex->emitfac == 1.0f) emitfac = stencil;
+					if (mtex->emitfac == 1.0f) emitfac = stencil;
 					else GPU_link(mat, "math_multiply", GPU_uniform(&mtex->emitfac), stencil, &emitfac);
 
 					texture_value_blend(mat, GPU_uniform(&mtex->def_var), shi->emit, tin, emitfac, mtex->blendtype, &shi->emit);
 					GPU_link(mat, "mtex_value_clamp_positive", shi->emit, &shi->emit);
 				}
-				if(!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_HAR) {
+				if (!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_HAR) {
 					GPUNodeLink *hardfac;
 
-					if(mtex->hardfac == 1.0f) hardfac = stencil;
+					if (mtex->hardfac == 1.0f) hardfac = stencil;
 					else GPU_link(mat, "math_multiply", GPU_uniform(&mtex->hardfac), stencil, &hardfac);
 
 					GPU_link(mat, "mtex_har_divide", shi->har, &shi->har);
 					texture_value_blend(mat, GPU_uniform(&mtex->def_var), shi->har, tin, hardfac, mtex->blendtype, &shi->har);
 					GPU_link(mat, "mtex_har_multiply_clamp", shi->har, &shi->har);
 				}
-				if(mtex->mapto & MAP_ALPHA) {
+				if (mtex->mapto & MAP_ALPHA) {
 					GPUNodeLink *alphafac;
 
-					if(mtex->alphafac == 1.0f) alphafac = stencil;
+					if (mtex->alphafac == 1.0f) alphafac = stencil;
 					else GPU_link(mat, "math_multiply", GPU_uniform(&mtex->alphafac), stencil, &alphafac);
 
 					texture_value_blend(mat, GPU_uniform(&mtex->def_var), shi->alpha, tin, alphafac, mtex->blendtype, &shi->alpha);
 					GPU_link(mat, "mtex_value_clamp", shi->alpha, &shi->alpha);
 				}
-				if(!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_AMB) {
+				if (!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && mtex->mapto & MAP_AMB) {
 					GPUNodeLink *ambfac;
 
-					if(mtex->ambfac == 1.0f) ambfac = stencil;
+					if (mtex->ambfac == 1.0f) ambfac = stencil;
 					else GPU_link(mat, "math_multiply", GPU_uniform(&mtex->ambfac), stencil, &ambfac);
 
 					texture_value_blend(mat, GPU_uniform(&mtex->def_var), shi->amb, tin, ambfac, mtex->blendtype, &shi->amb);
@@ -1310,7 +1311,7 @@ void GPU_shadeinput_set(GPUMaterial *mat, Material *ma, GPUShadeInput *shi)
 	GPU_link(mat, "set_value", GPU_uniform(&ma->amb), &shi->amb);
 	GPU_link(mat, "shade_view", GPU_builtin(GPU_VIEW_POSITION), &shi->view);
 	GPU_link(mat, "vcol_attribute", GPU_attribute(CD_MCOL, ""), &shi->vcol);
-	if(gpu_do_color_management(mat))
+	if (gpu_do_color_management(mat))
 		GPU_link(mat, "srgb_to_linearrgb", shi->vcol, &shi->vcol);
 	GPU_link(mat, "texco_refl", shi->vn, shi->view, &shi->ref);
 }
@@ -1325,23 +1326,23 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr)
 
 	memset(shr, 0, sizeof(*shr));
 
-	if(ma->mode & MA_VERTEXCOLP)
+	if (ma->mode & MA_VERTEXCOLP)
 		shi->rgb = shi->vcol;
 
 	do_material_tex(shi);
 
-	if((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP))
+	if ((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP))
 		GPU_material_enable_alpha(mat);
 
-	if((mat->scene->gm.flag & GAME_GLSL_NO_LIGHTS) || (ma->mode & MA_SHLESS)) {
+	if ((mat->scene->gm.flag & GAME_GLSL_NO_LIGHTS) || (ma->mode & MA_SHLESS)) {
 		shr->combined = shi->rgb;
 		shr->alpha = shi->alpha;
 		GPU_link(mat, "set_rgb", shi->rgb, &shr->diff);
 		GPU_link(mat, "set_rgb_zero", &shr->spec);
 	}
 	else {
-		if(GPU_link_changed(shi->emit) || ma->emit != 0.0f) {
-			if((ma->mode & (MA_VERTEXCOL|MA_VERTEXCOLP))== MA_VERTEXCOL) {
+		if (GPU_link_changed(shi->emit) || ma->emit != 0.0f) {
+			if ((ma->mode & (MA_VERTEXCOL|MA_VERTEXCOLP))== MA_VERTEXCOL) {
 				GPU_link(mat, "shade_add", shi->emit, shi->vcol, &emit);
 				GPU_link(mat, "shade_mul", emit, shi->rgb, &shr->diff);
 			}
@@ -1358,9 +1359,9 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr)
 		shr->combined = shr->diff;
 		shr->alpha = shi->alpha;
 
-		if(world) {
+		if (world) {
 			/* exposure correction */
-			if(world->exp!=0.0f || world->range!=1.0f) {
+			if (world->exp!=0.0f || world->range!=1.0f) {
 				linfac= 1.0f + powf((2.0f*world->exp + 0.5f), -10);
 				logfac= logf((linfac-1.0f)/linfac)/world->range;
 
@@ -1374,26 +1375,26 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr)
 			}
 
 			/* ambient color */
-			if(world->ambr!=0.0f || world->ambg!=0.0f || world->ambb!=0.0f) {
-				if(GPU_link_changed(shi->amb) || ma->amb != 0.0f)
+			if (world->ambr!=0.0f || world->ambg!=0.0f || world->ambb!=0.0f) {
+				if (GPU_link_changed(shi->amb) || ma->amb != 0.0f)
 					GPU_link(mat, "shade_maddf", shr->combined, GPU_uniform(&ma->amb),
 						GPU_uniform(&world->ambr), &shr->combined);
 			}
 		}
 
-		if(ma->mode & MA_RAMP_COL) ramp_diffuse_result(shi, &shr->combined);
-		if(ma->mode & MA_RAMP_SPEC) ramp_spec_result(shi, &shr->spec);
+		if (ma->mode & MA_RAMP_COL) ramp_diffuse_result(shi, &shr->combined);
+		if (ma->mode & MA_RAMP_SPEC) ramp_spec_result(shi, &shr->spec);
 
-		if(GPU_link_changed(shi->spec) || ma->spec != 0.0f)
+		if (GPU_link_changed(shi->spec) || ma->spec != 0.0f)
 			GPU_link(mat, "shade_add", shr->combined, shr->spec, &shr->combined);
 	}
 
 	GPU_link(mat, "mtex_alpha_to_col", shr->combined, shr->alpha, &shr->combined);
 
-	if(ma->shade_flag & MA_OBCOLOR)
+	if (ma->shade_flag & MA_OBCOLOR)
 		GPU_link(mat, "shade_obcolor", shr->combined, GPU_builtin(GPU_OBCOLOR), &shr->combined);
 
-	if(world && (world->mode & WO_MIST) && !(ma->mode & MA_NOMIST)) {
+	if (world && (world->mode & WO_MIST) && !(ma->mode & MA_NOMIST)) {
 		misttype = world->mistype;
 
 		GPU_link(mat, "shade_mist_factor", GPU_builtin(GPU_VIEW_POSITION),
@@ -1404,15 +1405,15 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr)
 			GPU_uniform(&world->horr), &shr->combined);
 	}
 
-	if(!((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP))) {
-		if(world && (GPU_link_changed(shr->alpha) || ma->alpha != 1.0f))
+	if (!((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP))) {
+		if (world && (GPU_link_changed(shr->alpha) || ma->alpha != 1.0f))
 			GPU_link(mat, "shade_world_mix", GPU_uniform(&world->horr),
 				shr->combined, &shr->combined);
 
 		GPU_link(mat, "shade_alpha_opaque", shr->combined, &shr->combined);
 	}
 
-	if(ma->shade_flag & MA_OBCOLOR) {
+	if (ma->shade_flag & MA_OBCOLOR) {
 		mat->obcolalpha = 1;
 		GPU_link(mat, "shade_alpha_obcolor", shr->combined, GPU_builtin(GPU_OBCOLOR), &shr->combined);
 	}
@@ -1435,15 +1436,15 @@ GPUMaterial *GPU_material_from_blender(Scene *scene, Material *ma)
 	GPUNodeLink *outlink;
 	LinkData *link;
 
-	for(link=ma->gpumaterial.first; link; link=link->next)
-		if(((GPUMaterial*)link->data)->scene == scene)
+	for (link=ma->gpumaterial.first; link; link=link->next)
+		if (((GPUMaterial*)link->data)->scene == scene)
 			return link->data;
 
 	/* allocate material */
 	mat = GPU_material_construct_begin(ma);
 	mat->scene = scene;
 
-	if(!(scene->gm.flag & GAME_GLSL_NO_NODES) && ma->nodetree && ma->use_nodes) {
+	if (!(scene->gm.flag & GAME_GLSL_NO_NODES) && ma->nodetree && ma->use_nodes) {
 		/* create nodes */
 		ntreeGPUMaterialNodes(ma->nodetree, mat);
 	}
@@ -1453,9 +1454,9 @@ GPUMaterial *GPU_material_from_blender(Scene *scene, Material *ma)
 		GPU_material_output_link(mat, outlink);
 	}
 
-	if(!scene_use_new_shading_nodes(scene)) {
-		if(gpu_do_color_management(mat))
-			if(mat->outlink)
+	if (!scene_use_new_shading_nodes(scene)) {
+		if (gpu_do_color_management(mat))
+			if (mat->outlink)
 				GPU_link(mat, "linearrgb_to_srgb", mat->outlink, &mat->outlink);
 	}
 
@@ -1463,8 +1464,8 @@ GPUMaterial *GPU_material_from_blender(Scene *scene, Material *ma)
 	GPU_material_construct_end(mat);
 
 	/* note that even if building the shader fails in some way, we still keep
-	   it to avoid trying to compile again and again, and simple do not use
-	   the actual shader on drawing */
+	 * it to avoid trying to compile again and again, and simple do not use
+	 * the actual shader on drawing */
 
 	link = MEM_callocN(sizeof(LinkData), "GPUMaterialLink");
 	link->data = mat;
@@ -1479,12 +1480,12 @@ void GPU_materials_free(void)
 	Material *ma;
 	extern Material defmaterial;
 
-	for(ma=G.main->mat.first; ma; ma=ma->id.next)
+	for (ma=G.main->mat.first; ma; ma=ma->id.next)
 		GPU_material_free(ma);
 
 	GPU_material_free(&defmaterial);
 
-	for(ob=G.main->object.first; ob; ob=ob->id.next)
+	for (ob=G.main->object.first; ob; ob=ob->id.next)
 		GPU_lamp_free(ob);
 }
 
@@ -1509,7 +1510,7 @@ void GPU_lamp_update(GPULamp *lamp, int lay, int hide, float obmat[][4])
 void GPU_lamp_update_colors(GPULamp *lamp, float r, float g, float b, float energy)
 {
 	lamp->energy = energy;
-	if(lamp->mode & LA_NEG) lamp->energy= -lamp->energy;
+	if (lamp->mode & LA_NEG) lamp->energy= -lamp->energy;
 
 	lamp->col[0]= r* lamp->energy;
 	lamp->col[1]= g* lamp->energy;
@@ -1530,7 +1531,7 @@ static void gpu_lamp_from_blender(Scene *scene, Object *ob, Object *par, Lamp *l
 	lamp->type = la->type;
 
 	lamp->energy = la->energy;
-	if(lamp->mode & LA_NEG) lamp->energy= -lamp->energy;
+	if (lamp->mode & LA_NEG) lamp->energy= -lamp->energy;
 
 	lamp->col[0]= la->r*lamp->energy;
 	lamp->col[1]= la->g*lamp->energy;
@@ -1539,8 +1540,8 @@ static void gpu_lamp_from_blender(Scene *scene, Object *ob, Object *par, Lamp *l
 	GPU_lamp_update(lamp, ob->lay, (ob->restrictflag & OB_RESTRICT_RENDER), ob->obmat);
 
 	lamp->spotsi= la->spotsize;
-	if(lamp->mode & LA_HALO)
-		if(lamp->spotsi > 170.0f)
+	if (lamp->mode & LA_HALO)
+		if (lamp->spotsi > 170.0f)
 			lamp->spotsi = 170.0f;
 	lamp->spotsi= cosf((float)M_PI*lamp->spotsi/360.0f);
 	lamp->spotbl= (1.0f - lamp->spotsi)*la->spotblend;
@@ -1572,11 +1573,11 @@ static void gpu_lamp_from_blender(Scene *scene, Object *ob, Object *par, Lamp *l
 
 static void gpu_lamp_shadow_free(GPULamp *lamp)
 {
-	if(lamp->tex) {
+	if (lamp->tex) {
 		GPU_texture_free(lamp->tex);
 		lamp->tex= NULL;
 	}
-	if(lamp->fb) {
+	if (lamp->fb) {
 		GPU_framebuffer_free(lamp->fb);
 		lamp->fb= NULL;
 	}
@@ -1588,10 +1589,10 @@ GPULamp *GPU_lamp_from_blender(Scene *scene, Object *ob, Object *par)
 	GPULamp *lamp;
 	LinkData *link;
 
-	for(link=ob->gpulamp.first; link; link=link->next) {
+	for (link=ob->gpulamp.first; link; link=link->next) {
 		lamp = (GPULamp*)link->data;
 
-		if(lamp->par == par && lamp->scene == scene)
+		if (lamp->par == par && lamp->scene == scene)
 			return link->data;
 	}
 
@@ -1604,21 +1605,21 @@ GPULamp *GPU_lamp_from_blender(Scene *scene, Object *ob, Object *par)
 	la = ob->data;
 	gpu_lamp_from_blender(scene, ob, par, la, lamp);
 
-	if(la->type==LA_SPOT && (la->mode & LA_SHAD_BUF)) {
+	if (la->type==LA_SPOT && (la->mode & LA_SHAD_BUF)) {
 		/* opengl */
 		lamp->fb = GPU_framebuffer_create();
-		if(!lamp->fb) {
+		if (!lamp->fb) {
 			gpu_lamp_shadow_free(lamp);
 			return lamp;
 		}
 
 		lamp->tex = GPU_texture_create_depth(lamp->size, lamp->size, NULL);
-		if(!lamp->tex) {
+		if (!lamp->tex) {
 			gpu_lamp_shadow_free(lamp);
 			return lamp;
 		}
 
-		if(!GPU_framebuffer_texture_attach(lamp->fb, lamp->tex, NULL)) {
+		if (!GPU_framebuffer_texture_attach(lamp->fb, lamp->tex, NULL)) {
 			gpu_lamp_shadow_free(lamp);
 			return lamp;
 		}
@@ -1636,15 +1637,15 @@ void GPU_lamp_free(Object *ob)
 	LinkData *nlink;
 	Material *ma;
 
-	for(link=ob->gpulamp.first; link; link=link->next) {
+	for (link=ob->gpulamp.first; link; link=link->next) {
 		lamp = link->data;
 
-		while(lamp->materials.first) {
+		while (lamp->materials.first) {
 			nlink = lamp->materials.first;
 			ma = nlink->data;
 			BLI_freelinkN(&lamp->materials, nlink);
 
-			if(ma->gpumaterial.first)
+			if (ma->gpumaterial.first)
 				GPU_material_free(ma);
 		}
 
@@ -1707,7 +1708,7 @@ void GPU_lamp_shadow_buffer_unbind(GPULamp *lamp)
 
 int GPU_lamp_shadow_layer(GPULamp *lamp)
 {
-	if(lamp->fb && lamp->tex && (lamp->mode & (LA_LAYER|LA_LAYER_SHADOW)))
+	if (lamp->fb && lamp->tex && (lamp->mode & (LA_LAYER|LA_LAYER_SHADOW)))
 		return lamp->lay;
 	else
 		return -1;
@@ -1740,19 +1741,19 @@ GPUShaderExport *GPU_shader_export(struct Scene *scene, struct Material *ma)
 	GLint lastbindcode;
 	int i, liblen, fraglen;
 
-	if(!GPU_glsl_support())
+	if (!GPU_glsl_support())
 		return NULL;
 
 	mat = GPU_material_from_blender(scene, ma);
 	pass = (mat)? mat->pass: NULL;
 
-	if(pass && pass->fragmentcode && pass->vertexcode) {
+	if (pass && pass->fragmentcode && pass->vertexcode) {
 		shader = MEM_callocN(sizeof(GPUShaderExport), "GPUShaderExport");
 
-		for(input = pass->inputs.first; input; input = input->next) {
+		for (input = pass->inputs.first; input; input = input->next) {
 			uniform = MEM_callocN(sizeof(GPUInputUniform), "GPUInputUniform");
 
-			if(input->ima) {
+			if (input->ima) {
 				/* image sampler uniform */
 				uniform->type = GPU_DYNAMIC_SAMPLER_2DIMAGE;
 				uniform->datatype = GPU_DATA_1I;
@@ -1760,7 +1761,7 @@ GPUShaderExport *GPU_shader_export(struct Scene *scene, struct Material *ma)
 				uniform->texnumber = input->texid;
 				BLI_strncpy(uniform->varname, input->shadername, sizeof(uniform->varname));
 			}
-			else if(input->tex) {
+			else if (input->tex) {
 				/* generated buffer */
 				uniform->texnumber = input->texid;
 				uniform->datatype = GPU_DATA_1I;
@@ -1772,7 +1773,7 @@ GPUShaderExport *GPU_shader_export(struct Scene *scene, struct Material *ma)
 					uniform->lamp = input->dynamicdata;
 					break;
 				case GPU_TEX2D:
-					if(GPU_texture_opengl_bindcode(input->tex)) {
+					if (GPU_texture_opengl_bindcode(input->tex)) {
 						uniform->type = GPU_DYNAMIC_SAMPLER_2DBUFFER;
 						glGetIntegerv(GL_TEXTURE_BINDING_2D, &lastbindcode);
 						glBindTexture(GL_TEXTURE_2D, GPU_texture_opengl_bindcode(input->tex));
@@ -1808,19 +1809,19 @@ GPUShaderExport *GPU_shader_export(struct Scene *scene, struct Material *ma)
 					break;
 				}
 
-				if(uniform->type >= GPU_DYNAMIC_LAMP_FIRST && uniform->type <= GPU_DYNAMIC_LAMP_LAST)
+				if (uniform->type >= GPU_DYNAMIC_LAMP_FIRST && uniform->type <= GPU_DYNAMIC_LAMP_LAST)
 					uniform->lamp = input->dynamicdata;
 			}
 
-			if(uniform->type != GPU_DYNAMIC_NONE)
+			if (uniform->type != GPU_DYNAMIC_NONE)
 				BLI_addtail(&shader->uniforms, uniform);
 			else
 				MEM_freeN(uniform);
 		}
 
 		/* process builtin uniform */
-		for(i=0; builtins[i].gputype; i++) {
-			if(mat->builtins & builtins[i].gputype) {
+		for (i=0; builtins[i].gputype; i++) {
+			if (mat->builtins & builtins[i].gputype) {
 				uniform = MEM_callocN(sizeof(GPUInputUniform), "GPUInputUniform");
 				uniform->type = builtins[i].dynamictype;
 				uniform->datatype = builtins[i].datatype;
@@ -1829,18 +1830,18 @@ GPUShaderExport *GPU_shader_export(struct Scene *scene, struct Material *ma)
 			}
 		}
 
-		// now link fragement shader with library shader
-		// TBD: remove the function that are not used in the main function
+		/* now link fragment shader with library shader */
+		/* TBD: remove the function that are not used in the main function */
 		liblen = (pass->libcode) ? strlen(pass->libcode) : 0;
 		fraglen = strlen(pass->fragmentcode);
 		shader->fragment = (char *)MEM_mallocN(liblen+fraglen+1, "GPUFragShader");
-		if(pass->libcode)
+		if (pass->libcode)
 			memcpy(shader->fragment, pass->libcode, liblen);
 		memcpy(&shader->fragment[liblen], pass->fragmentcode, fraglen);
 		shader->fragment[liblen+fraglen] = 0;
 
 		// export the attribute
-		for(i=0; i<mat->attribs.totlayer; i++) {
+		for (i=0; i<mat->attribs.totlayer; i++) {
 			attribute = MEM_callocN(sizeof(GPUInputAttribute), "GPUInputAttribute");
 			attribute->type = mat->attribs.layer[i].type;
 			attribute->number = mat->attribs.layer[i].glindex;
@@ -1863,7 +1864,7 @@ GPUShaderExport *GPU_shader_export(struct Scene *scene, struct Material *ma)
 				break;
 			}
 
-			if(attribute->datatype != GPU_DATA_NONE)
+			if (attribute->datatype != GPU_DATA_NONE)
 				BLI_addtail(&shader->attributes, attribute);
 			else
 				MEM_freeN(attribute);
@@ -1880,19 +1881,19 @@ void GPU_free_shader_export(GPUShaderExport *shader)
 {
 	GPUInputUniform *uniform;
 
-	if(shader == NULL)
+	if (shader == NULL)
 		return;
 
-	for(uniform = shader->uniforms.first; uniform; uniform=uniform->next)
-		if(uniform->texpixels)
+	for (uniform = shader->uniforms.first; uniform; uniform=uniform->next)
+		if (uniform->texpixels)
 			MEM_freeN(uniform->texpixels);
 
 	BLI_freelistN(&shader->uniforms);
 	BLI_freelistN(&shader->attributes);
 
-	if(shader->vertex)
+	if (shader->vertex)
 		MEM_freeN(shader->vertex);
-	if(shader->fragment)
+	if (shader->fragment)
 		MEM_freeN(shader->fragment);
 
 	MEM_freeN(shader);
diff --git a/source/blender/gpu/intern/gpu_shader_material.glsl b/source/blender/gpu/intern/gpu_shader_material.glsl
index c6e25d0..2ac99e2 100644
--- a/source/blender/gpu/intern/gpu_shader_material.glsl
+++ b/source/blender/gpu/intern/gpu_shader_material.glsl
@@ -368,26 +368,6 @@ void set_rgba_zero(out vec4 outval)
 	outval = vec4(0.0);
 }
 
-void copy_raw(vec4 val, out vec4 outval)
-{
-	outval = val;
-}
-
-void copy_raw(vec3 val, out vec3 outval)
-{
-	outval = val;
-}
-
-void copy_raw(vec2 val, out vec2 outval)
-{
-	outval = val;
-}
-
-void copy_raw(float val, out float outval)
-{
-	outval = val;
-}
-
 void mix_blend(float fac, vec4 col1, vec4 col2, out vec4 outcol)
 {
 	fac = clamp(fac, 0.0, 1.0);
@@ -2103,9 +2083,10 @@ void node_tex_environment(vec3 co, sampler2D ima, out vec4 color)
 	color = texture2D(ima, vec2(u, v));
 }
 
-void node_tex_image(vec3 co, sampler2D ima, out vec4 color)
+void node_tex_image(vec3 co, sampler2D ima, out vec4 color, out float alpha)
 {
 	color = texture2D(ima, co.xy);
+	alpha = color.a;
 }
 
 void node_tex_magic(vec3 p, float scale, float distortion, out vec4 color, out float fac)
diff --git a/source/blender/gpu/intern/gpu_shader_material.glsl.c b/source/blender/gpu/intern/gpu_shader_material.glsl.c
index 8334356..a6d962a 100644
--- a/source/blender/gpu/intern/gpu_shader_material.glsl.c
+++ b/source/blender/gpu/intern/gpu_shader_material.glsl.c
@@ -1,1517 +1,1510 @@
 /* DataToC output of file <gpu_shader_material_glsl> */
 
-int datatoc_gpu_shader_material_glsl_size= 49606;
+int datatoc_gpu_shader_material_glsl_size= 49395;
 char datatoc_gpu_shader_material_glsl[]= {
- 10,102,108,111, 97,116,
- 32,101,120,112, 95, 98,108,101,110,100,101,114, 40,102,108,111, 97,116, 32,102, 41, 10,123, 10,  9,114,101,116,117,114,110, 32,
-112,111,119, 40, 50, 46, 55, 49, 56, 50, 56, 49, 56, 50, 56, 52, 54, 44, 32,102, 41, 59, 10,125, 10, 10,118,111,105,100, 32,114,
-103, 98, 95,116,111, 95,104,115,118, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,
- 99,111,108, 41, 10,123, 10,  9,102,108,111, 97,116, 32, 99,109, 97,120, 44, 32, 99,109,105,110, 44, 32,104, 44, 32,115, 44, 32,
-118, 44, 32, 99,100,101,108,116, 97, 59, 10,  9,118,101, 99, 51, 32, 99, 59, 10, 10,  9, 99,109, 97,120, 32, 61, 32,109, 97,120,
- 40,114,103, 98, 91, 48, 93, 44, 32,109, 97,120, 40,114,103, 98, 91, 49, 93, 44, 32,114,103, 98, 91, 50, 93, 41, 41, 59, 10,  9,
- 99,109,105,110, 32, 61, 32,109,105,110, 40,114,103, 98, 91, 48, 93, 44, 32,109,105,110, 40,114,103, 98, 91, 49, 93, 44, 32,114,
-103, 98, 91, 50, 93, 41, 41, 59, 10,  9, 99,100,101,108,116, 97, 32, 61, 32, 99,109, 97,120, 45, 99,109,105,110, 59, 10, 10,  9,
-118, 32, 61, 32, 99,109, 97,120, 59, 10,  9,105,102, 32, 40, 99,109, 97,120, 33, 61, 48, 46, 48, 41, 10,  9,  9,115, 32, 61, 32,
- 99,100,101,108,116, 97, 47, 99,109, 97,120, 59, 10,  9,101,108,115,101, 32,123, 10,  9,  9,115, 32, 61, 32, 48, 46, 48, 59, 10,
-  9,  9,104, 32, 61, 32, 48, 46, 48, 59, 10,  9,125, 10, 10,  9,105,102, 32, 40,115, 32, 61, 61, 32, 48, 46, 48, 41, 32,123, 10,
-  9,  9,104, 32, 61, 32, 48, 46, 48, 59, 10,  9,125, 10,  9,101,108,115,101, 32,123, 10,  9,  9, 99, 32, 61, 32, 40,118,101, 99,
- 51, 40, 99,109, 97,120, 44, 32, 99,109, 97,120, 44, 32, 99,109, 97,120, 41, 32, 45, 32,114,103, 98, 46,120,121,122, 41, 47, 99,
-100,101,108,116, 97, 59, 10, 10,  9,  9,105,102, 32, 40,114,103, 98, 46,120, 61, 61, 99,109, 97,120, 41, 32,104, 32, 61, 32, 99,
- 91, 50, 93, 32, 45, 32, 99, 91, 49, 93, 59, 10,  9,  9,101,108,115,101, 32,105,102, 32, 40,114,103, 98, 46,121, 61, 61, 99,109,
- 97,120, 41, 32,104, 32, 61, 32, 50, 46, 48, 32, 43, 32, 99, 91, 48, 93, 32, 45, 32, 32, 99, 91, 50, 93, 59, 10,  9,  9,101,108,
-115,101, 32,104, 32, 61, 32, 52, 46, 48, 32, 43, 32, 99, 91, 49, 93, 32, 45, 32, 99, 91, 48, 93, 59, 10, 10,  9,  9,104, 32, 47,
- 61, 32, 54, 46, 48, 59, 10, 10,  9,  9,105,102, 32, 40,104, 60, 48, 46, 48, 41, 10,  9,  9,  9,104, 32, 43, 61, 32, 49, 46, 48,
- 59, 10,  9,125, 10, 10,  9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,104, 44, 32,115, 44, 32,118, 44, 32,114,103,
- 98, 46,119, 41, 59, 10,125, 10, 10,118,111,105,100, 32,104,115,118, 95,116,111, 95,114,103, 98, 40,118,101, 99, 52, 32,104,115,
-118, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,102,108,111, 97,116, 32,105, 44, 32,
-102, 44, 32,112, 44, 32,113, 44, 32,116, 44, 32,104, 44, 32,115, 44, 32,118, 59, 10,  9,118,101, 99, 51, 32,114,103, 98, 59, 10,
- 10,  9,104, 32, 61, 32,104,115,118, 91, 48, 93, 59, 10,  9,115, 32, 61, 32,104,115,118, 91, 49, 93, 59, 10,  9,118, 32, 61, 32,
-104,115,118, 91, 50, 93, 59, 10, 10,  9,105,102, 40,115, 61, 61, 48, 46, 48, 41, 32,123, 10,  9,  9,114,103, 98, 32, 61, 32,118,
-101, 99, 51, 40,118, 44, 32,118, 44, 32,118, 41, 59, 10,  9,125, 10,  9,101,108,115,101, 32,123, 10,  9,  9,105,102, 40,104, 61,
- 61, 49, 46, 48, 41, 10,  9,  9,  9,104, 32, 61, 32, 48, 46, 48, 59, 10,  9,  9, 10,  9,  9,104, 32, 42, 61, 32, 54, 46, 48, 59,
- 10,  9,  9,105, 32, 61, 32,102,108,111,111,114, 40,104, 41, 59, 10,  9,  9,102, 32, 61, 32,104, 32, 45, 32,105, 59, 10,  9,  9,
-114,103, 98, 32, 61, 32,118,101, 99, 51, 40,102, 44, 32,102, 44, 32,102, 41, 59, 10,  9,  9,112, 32, 61, 32,118, 42, 40, 49, 46,
- 48, 45,115, 41, 59, 10,  9,  9,113, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42,102, 41, 41, 59, 10,  9,  9,116, 32, 61,
- 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42, 40, 49, 46, 48, 45,102, 41, 41, 41, 59, 10,  9,  9, 10,  9,  9,105,102, 32, 40,105,
- 32, 61, 61, 32, 48, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,116, 44, 32,112, 41, 59, 10,  9,  9,
-101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 49, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,113, 44,
- 32,118, 44, 32,112, 41, 59, 10,  9,  9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 50, 46, 48, 41, 32,114,103, 98,
- 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,118, 44, 32,116, 41, 59, 10,  9,  9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61,
- 61, 32, 51, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,113, 44, 32,118, 41, 59, 10,  9,  9,101,108,
-115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 52, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,116, 44, 32,112,
- 44, 32,118, 41, 59, 10,  9,  9,101,108,115,101, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,112, 44, 32,113, 41,
- 59, 10,  9,125, 10, 10,  9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,114,103, 98, 44, 32,104,115,118, 46,119, 41,
- 59, 10,125, 10, 10,102,108,111, 97,116, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40,102,108,111,
- 97,116, 32, 99, 41, 10,123, 10,  9,105,102, 40, 99, 32, 60, 32, 48, 46, 48, 52, 48, 52, 53, 41, 10,  9,  9,114,101,116,117,114,
-110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, 32, 40, 49, 46, 48, 47, 49, 50, 46, 57, 50,
- 41, 59, 10,  9,101,108,115,101, 10,  9,  9,114,101,116,117,114,110, 32,112,111,119, 40, 40, 99, 32, 43, 32, 48, 46, 48, 53, 53,
- 41, 42, 40, 49, 46, 48, 47, 49, 46, 48, 53, 53, 41, 44, 32, 50, 46, 52, 41, 59, 10,125, 10, 10,102,108,111, 97,116, 32,108,105,
-110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40,102,108,111, 97,116, 32, 99, 41, 10,123, 10,  9,105,102, 40, 99,
- 32, 60, 32, 48, 46, 48, 48, 51, 49, 51, 48, 56, 41, 10,  9,  9,114,101,116,117,114,110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41,
- 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, 32, 49, 50, 46, 57, 50, 59, 10,  9,101,108,115,101, 10,  9,  9,114,101,116,117,114,110,
- 32, 49, 46, 48, 53, 53, 32, 42, 32,112,111,119, 40, 99, 44, 32, 49, 46, 48, 47, 50, 46, 52, 41, 32, 45, 32, 48, 46, 48, 53, 53,
- 59, 10,125, 10, 10,118,111,105,100, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40,118,101, 99, 52,
- 32, 99,111,108, 95,102,114,111,109, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 95,116,111, 41, 10,123, 10,  9, 99,
-111,108, 95,116,111, 46,114, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,
-102,114,111,109, 46,114, 41, 59, 10,  9, 99,111,108, 95,116,111, 46,103, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,
-101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,103, 41, 59, 10,  9, 99,111,108, 95,116,111, 46, 98, 32, 61, 32,
-115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46, 98, 41, 59, 10,  9,
- 99,111,108, 95,116,111, 46, 97, 32, 61, 32, 99,111,108, 95,102,114,111,109, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,108,
-105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 95,102,114,111,109, 44, 32,
-111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 95,116,111, 41, 10,123, 10,  9, 99,111,108, 95,116,111, 46,114, 32, 61, 32,108,
-105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,114, 41, 59, 10,  9, 99,
-111,108, 95,116,111, 46,103, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,
-102,114,111,109, 46,103, 41, 59, 10,  9, 99,111,108, 95,116,111, 46, 98, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,
-111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46, 98, 41, 59, 10,  9, 99,111,108, 95,116,111, 46, 97, 32, 61, 32,
- 99,111,108, 95,102,114,111,109, 46, 97, 59, 10,125, 10, 10, 35,100,101,102,105,110,101, 32, 77, 95, 80, 73, 32, 51, 46, 49, 52,
- 49, 53, 57, 50, 54, 53, 51, 53, 56, 57, 55, 57, 51, 50, 51, 56, 52, 54, 10, 35,100,101,102,105,110,101, 32, 77, 95, 49, 95, 80,
- 73, 32, 48, 46, 51, 49, 56, 51, 48, 57, 56, 56, 54, 49, 56, 51, 55, 57, 48, 54, 57, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42,
- 42, 42, 42, 32, 83, 72, 65, 68, 69, 82, 32, 78, 79, 68, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
- 47, 10, 10,118,111,105,100, 32,118, 99,111,108, 95, 97,116,116,114,105, 98,117,116,101, 40,118,101, 99, 52, 32, 97,116,116,118,
- 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,118, 99,111,108, 41, 10,123, 10,  9,118, 99,111,108, 32, 61, 32,118,101,
- 99, 52, 40, 97,116,116,118, 99,111,108, 46,120, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,121, 47, 50, 53,
- 53, 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,122, 47, 50, 53, 53, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,
-111,105,100, 32,117,118, 95, 97,116,116,114,105, 98,117,116,101, 40,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,111,117,116,
- 32,118,101, 99, 51, 32,117,118, 41, 10,123, 10,  9,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 42, 50, 46, 48,
- 32, 45, 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100,
- 32,103,101,111,109, 40,118,101, 99, 51, 32, 99,111, 44, 32,118,101, 99, 51, 32,110,111,114, 44, 32,109, 97,116, 52, 32,118,105,
-101,119,105,110,118,109, 97,116, 44, 32,118,101, 99, 51, 32, 97,116,116,111,114, 99,111, 44, 32,118,101, 99, 50, 32, 97,116,116,
-117,118, 44, 32,118,101, 99, 52, 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,103,108,111, 98, 97,
-108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,108,111, 99, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,105,101,119,
- 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,114, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 44, 32,111,117,
-116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,118, 99,111,108, 44, 32,111,117,
-116, 32,102,108,111, 97,116, 32,118, 99,111,108, 95, 97,108,112,104, 97, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102,114,
-111,110,116, 98, 97, 99,107, 41, 10,123, 10,  9,108,111, 99, 97,108, 32, 61, 32, 99,111, 59, 10,  9,118,105,101,119, 32, 61, 32,
-110,111,114,109, 97,108,105,122,101, 40,108,111, 99, 97,108, 41, 59, 10,  9,103,108,111, 98, 97,108, 32, 61, 32, 40,118,105,101,
-119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40,108,111, 99, 97,108, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10,  9,
-111,114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,111, 59, 10,  9,117,118, 95, 97,116,116,114,105, 98,117,116,101, 40, 97,116,
-116,117,118, 44, 32,117,118, 41, 59, 10,  9,110,111,114,109, 97,108, 32, 61, 32, 45,110,111,114,109, 97,108,105,122,101, 40,110,
-111,114, 41, 59,  9, 47, 42, 32, 98,108,101,110,100,101,114, 32,114,101,110,100,101,114, 32,110,111,114,109, 97,108, 32,105,115,
- 32,110,101,103, 97,116,101,100, 32, 42, 47, 10,  9,118, 99,111,108, 95, 97,116,116,114,105, 98,117,116,101, 40, 97,116,116,118,
- 99,111,108, 44, 32,118, 99,111,108, 41, 59, 10,  9,118, 99,111,108, 95, 97,108,112,104, 97, 32, 61, 32, 97,116,116,118, 99,111,
-108, 46, 97, 59, 10,  9,102,114,111,110,116, 98, 97, 99,107, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109,
- 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,109, 97,116, 52, 32,109, 97,116, 44, 32,118,101, 99, 51, 32,
-109,105,110,118,101, 99, 44, 32,118,101, 99, 51, 32,109, 97,120,118,101, 99, 44, 32,102,108,111, 97,116, 32,100,111,109,105,110,
- 44, 32,102,108,111, 97,116, 32,100,111,109, 97,120, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 41, 10,
-123, 10,  9,111,117,116,118,101, 99, 32, 61, 32, 40,109, 97,116, 32, 42, 32,118,101, 99, 52, 40,118,101, 99, 44, 32, 49, 46, 48,
- 41, 41, 46,120,121,122, 59, 10,  9,105,102, 40,100,111,109,105,110, 32, 61, 61, 32, 49, 46, 48, 41, 10,  9,  9,111,117,116,118,
-101, 99, 32, 61, 32,109, 97,120, 40,111,117,116,118,101, 99, 44, 32,109,105,110,118,101, 99, 41, 59, 10,  9,105,102, 40,100,111,
-109, 97,120, 32, 61, 61, 32, 49, 46, 48, 41, 10,  9,  9,111,117,116,118,101, 99, 32, 61, 32,109,105,110, 40,111,117,116,118,101,
- 99, 44, 32,109, 97,120,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32, 99, 97,109,101,114, 97, 40,118,101, 99, 51, 32,
- 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,105,101,119, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,
-111,117,116,100,101,112,116,104, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,100,105,115,116, 41, 10,123, 10,  9,
-111,117,116,100,101,112,116,104, 32, 61, 32, 97, 98,115, 40, 99,111, 46,122, 41, 59, 10,  9,111,117,116,100,105,115,116, 32, 61,
- 32,108,101,110,103,116,104, 40, 99,111, 41, 59, 10,  9,111,117,116,118,105,101,119, 32, 61, 32,110,111,114,109, 97,108,105,122,
-101, 40, 99,111, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,100,100, 40,102,108,111, 97,116, 32,118, 97,
-108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108,
- 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 43, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,
-105,100, 32,109, 97,116,104, 95,115,117, 98,116,114, 97, 99,116, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111,
- 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,
-116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 45, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104,
- 95,109,117,108,116,105,112,108,121, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50,
- 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32,
-118, 97,108, 49, 32, 42, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,100,105,118,105,100,101,
- 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111,
- 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,105,102, 32, 40,118, 97,108, 50, 32, 61, 61, 32, 48, 46, 48, 41, 10,  9,
-  9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,  9,101,108,115,101, 10,  9,  9,111,117,116,118, 97,108, 32, 61, 32,
-118, 97,108, 49, 32, 47, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,115,105,110,101, 40,102,
-108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,
-117,116,118, 97,108, 32, 61, 32,115,105,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 99,
-111,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,
-108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32, 99,111,115, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100,
- 32,109, 97,116,104, 95,116, 97,110,103,101,110,116, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111,
- 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32,116, 97,110, 40,118, 97,108, 41, 59,
- 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,115,105,110, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,
-116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,105,102, 32, 40,118, 97,108, 32, 60, 61, 32, 49, 46,
- 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48, 41, 10,  9,  9,111,117,116,118, 97,108, 32, 61, 32, 97,115,105,
-110, 40,118, 97,108, 41, 59, 10,  9,101,108,115,101, 10,  9,  9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10,
- 10,118,111,105,100, 32,109, 97,116,104, 95, 97, 99,111,115, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,
-108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,105,102, 32, 40,118, 97,108, 32, 60, 61, 32, 49, 46, 48, 32, 38,
- 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48, 41, 10,  9,  9,111,117,116,118, 97,108, 32, 61, 32, 97, 99,111,115, 40,118,
- 97,108, 41, 59, 10,  9,101,108,115,101, 10,  9,  9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,
-105,100, 32,109, 97,116,104, 95, 97,116, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,
-116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32, 97,116, 97,110, 40,118, 97,108, 41, 59,
- 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,112,111,119, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,
-111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,105,
-102, 32, 40,118, 97,108, 49, 32, 62, 61, 32, 48, 46, 48, 41, 10,  9,  9,111,117,116,118, 97,108, 32, 61, 32,112,111,119, 40,118,
- 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,  9,101,108,115,101, 10,  9,  9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48,
- 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,108,111,103, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,
-108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,
-105,102, 40,118, 97,108, 49, 32, 62, 32, 48, 46, 48, 32, 32, 38, 38, 32,118, 97,108, 50, 32, 62, 32, 48, 46, 48, 41, 10,  9,  9,
-111,117,116,118, 97,108, 61, 32,108,111,103, 50, 40,118, 97,108, 49, 41, 32, 47, 32,108,111,103, 50, 40,118, 97,108, 50, 41, 59,
- 10,  9,101,108,115,101, 10,  9,  9,111,117,116,118, 97,108, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,
-116,104, 95,109, 97,120, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,
-117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32,109, 97,120,
- 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109,105,110, 40,102,
-108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116,
- 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32,109,105,110, 40,118, 97,108, 49, 44, 32,118,
- 97,108, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,114,111,117,110,100, 40,102,108,111, 97,116, 32,118,
- 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 61,
- 32,102,108,111,111,114, 40,118, 97,108, 32, 43, 32, 48, 46, 53, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,
-108,101,115,115, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50,
- 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,105,102, 40,118, 97,108, 49, 32, 60,
- 32,118, 97,108, 50, 41, 10,  9,  9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 59, 10,  9,101,108,115,101, 10,  9,  9,111,
-117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,103,114,101, 97,116,101,
-114, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,
-117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,105,102, 40,118, 97,108, 49, 32, 62, 32,118, 97,
-108, 50, 41, 10,  9,  9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 59, 10,  9,101,108,115,101, 10,  9,  9,111,117,116,118,
- 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,115,113,117,101,101,122,101, 40,102,108,111, 97,116, 32,
-118, 97,108, 44, 32,102,108,111, 97,116, 32,119,105,100,116,104, 44, 32,102,108,111, 97,116, 32, 99,101,110,116,101,114, 44, 32,
-111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32, 49, 46,
- 48, 47, 40, 49, 46, 48, 32, 43, 32,112,111,119, 40, 50, 46, 55, 49, 56, 50, 56, 49, 56, 51, 44, 32, 45, 40, 40,118, 97,108, 45,
- 99,101,110,116,101,114, 41, 42,119,105,100,116,104, 41, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,
-116,104, 95, 97,100,100, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99,
- 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,
-117,116,118,101, 99, 32, 61, 32,118, 49, 32, 43, 32,118, 50, 59, 10,  9,111,117,116,118, 97,108, 32, 61, 32, 40, 97, 98,115, 40,
-111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 49, 93, 41, 32, 43, 32, 97, 98,
-115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47, 51, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109,
- 97,116,104, 95,115,117, 98, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101,
- 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,
-111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 45, 32,118, 50, 59, 10,  9,111,117,116,118, 97,108, 32, 61, 32, 40, 97, 98,115,
- 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 49, 93, 41, 32, 43, 32, 97,
- 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47, 51, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,
-109, 97,116,104, 95, 97,118,101,114, 97,103,101, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,
-117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108,
- 41, 10,123, 10,  9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 43, 32,118, 50, 59, 10,  9,111,117,116,118, 97,108, 32, 61,
- 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10,  9,111,117,116,118,101, 99, 32, 61, 32,110,111,114,109, 97,
-108,105,122,101, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,100,
-111,116, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,
-116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118,101,
- 99, 32, 61, 32,118,101, 99, 51, 40, 48, 44, 32, 48, 44, 32, 48, 41, 59, 10,  9,111,117,116,118, 97,108, 32, 61, 32,100,111,116,
- 40,118, 49, 44, 32,118, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 99,114,111,115,115,
- 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,
-101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118,101, 99, 32,
- 61, 32, 99,114,111,115,115, 40,118, 49, 44, 32,118, 50, 41, 59, 10,  9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,
-104, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,110,111,114,109,
- 97,108,105,122,101, 40,118,101, 99, 51, 32,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,
-117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,
-103,116,104, 40,118, 41, 59, 10,  9,111,117,116,118,101, 99, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,118, 41, 59, 10,
-125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,110,101,103, 97,116,101, 40,118,101, 99, 51, 32,118, 44, 32,
-111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, 41, 10,123, 10,  9,111,117,116,118, 32, 61, 32, 45,118, 59, 10,125, 10, 10,
-118,111,105,100, 32,110,111,114,109, 97,108, 40,118,101, 99, 51, 32,100,105,114, 44, 32,118,101, 99, 51, 32,110,111,114, 44, 32,
-111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,100,111,
-116, 41, 10,123, 10,  9,111,117,116,110,111,114, 32, 61, 32,110,111,114, 59, 10,  9,111,117,116,100,111,116, 32, 61, 32, 45,100,
-111,116, 40,100,105,114, 44, 32,110,111,114, 41, 59, 10,125, 10, 10,118,111,105,100, 32, 99,117,114,118,101,115, 95,118,101, 99,
- 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 51, 32,118,101, 99, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,
- 99,117,114,118,101,109, 97,112, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10,  9,111,117,
-116,118,101, 99, 46,120, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99,
- 50, 40, 40,118,101, 99, 46,120, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 44, 32, 48, 46, 48, 41, 41, 46,120, 59, 10,  9,111,
-117,116,118,101, 99, 46,121, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101,
- 99, 50, 40, 40,118,101, 99, 46,121, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 44, 32, 48, 46, 48, 41, 41, 46,121, 59, 10,  9,
-111,117,116,118,101, 99, 46,122, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,
-101, 99, 50, 40, 40,118,101, 99, 46,122, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 44, 32, 48, 46, 48, 41, 41, 46,122, 59, 10,
- 10,  9,105,102, 32, 40,102, 97, 99, 32, 33, 61, 32, 49, 46, 48, 41, 10,  9,  9,111,117,116,118,101, 99, 32, 61, 32, 40,111,117,
-116,118,101, 99, 42,102, 97, 99, 41, 32, 43, 32, 40,118,101, 99, 42, 40, 49, 46, 48, 45,102, 97, 99, 41, 41, 59, 10, 10,125, 10,
- 10,118,111,105,100, 32, 99,117,114,118,101,115, 95,114,103, 98, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52,
- 32, 99,111,108, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32,111,117,116, 32,118,101,
- 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,111,117,116, 99,111,108, 46,114, 32, 61, 32,116,101,120,116,117,114,101,
- 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,
-101,109, 97,112, 44, 32,118,101, 99, 50, 40, 99,111,108, 46,114, 44, 32, 48, 46, 48, 41, 41, 46, 97, 44, 32, 48, 46, 48, 41, 41,
- 46,114, 59, 10,  9,111,117,116, 99,111,108, 46,103, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109,
- 97,112, 44, 32,118,101, 99, 50, 40,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99,
- 50, 40, 99,111,108, 46,103, 44, 32, 48, 46, 48, 41, 41, 46, 97, 44, 32, 48, 46, 48, 41, 41, 46,103, 59, 10,  9,111,117,116, 99,
-111,108, 46, 98, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40,
-116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 99,111,108, 46, 98, 44, 32,
- 48, 46, 48, 41, 41, 46, 97, 44, 32, 48, 46, 48, 41, 41, 46, 98, 59, 10, 10,  9,105,102, 32, 40,102, 97, 99, 32, 33, 61, 32, 49,
- 46, 48, 41, 10,  9,  9,111,117,116, 99,111,108, 32, 61, 32, 40,111,117,116, 99,111,108, 42,102, 97, 99, 41, 32, 43, 32, 40, 99,
-111,108, 42, 40, 49, 46, 48, 45,102, 97, 99, 41, 41, 59, 10, 10,  9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 46,
- 97, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,
-111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32,118, 97,
-108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 40,118,101, 99, 51, 32, 99,111,108, 44, 32,111,117,116,
- 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 59, 10,125,
- 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 97, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101,
- 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 59, 10,125, 10, 10,118,
-111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 95,122,101,114,111, 40,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,
-118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,
-116, 95,118, 97,108,117,101, 95,111,110,101, 40,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,
-  9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 95,122,
-101,114,111, 40,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61,
- 32,118,101, 99, 51, 40, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 97, 95,122,101,114,
-111, 40,111,117,116, 32,118,101, 99, 52, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32,118,
-101, 99, 52, 40, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32, 99,111,112,121, 95,114, 97,119, 40,118,101, 99, 52, 32,
-118, 97,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32,
- 61, 32,118, 97,108, 59, 10,125, 10, 10,118,111,105,100, 32, 99,111,112,121, 95,114, 97,119, 40,118,101, 99, 51, 32,118, 97,108,
- 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32,118,
- 97,108, 59, 10,125, 10, 10,118,111,105,100, 32, 99,111,112,121, 95,114, 97,119, 40,118,101, 99, 50, 32,118, 97,108, 44, 32,111,
-117,116, 32,118,101, 99, 50, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 59,
- 10,125, 10, 10,118,111,105,100, 32, 99,111,112,121, 95,114, 97,119, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116,
- 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 59, 10,
-125, 10, 10,118,111,105,100, 32,109,105,120, 95, 98,108,101,110,100, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99,
- 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,
-111,108, 41, 10,123, 10,  9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48,
- 41, 59, 10,  9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 99,111,108, 50, 44, 32,102, 97, 99,
- 41, 59, 10,  9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,
-105,120, 95, 97,100,100, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99,
- 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,102, 97, 99, 32,
- 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,111,117,116, 99,111,108, 32,
- 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 99,111,108, 49, 32, 43, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10,  9,
-111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,109,
-117,108,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,
+ 10,102,108,111, 97,116, 32,101,120,112, 95, 98,108,101,110,100,101,114, 40,
+102,108,111, 97,116, 32,102, 41, 10,123, 10,  9,114,101,116,117,114,110, 32,112,111,119, 40, 50, 46, 55, 49, 56, 50, 56, 49, 56,
+ 50, 56, 52, 54, 44, 32,102, 41, 59, 10,125, 10, 10,118,111,105,100, 32,114,103, 98, 95,116,111, 95,104,115,118, 40,118,101, 99,
+ 52, 32,114,103, 98, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,102,108,111, 97,116,
+ 32, 99,109, 97,120, 44, 32, 99,109,105,110, 44, 32,104, 44, 32,115, 44, 32,118, 44, 32, 99,100,101,108,116, 97, 59, 10,  9,118,
+101, 99, 51, 32, 99, 59, 10, 10,  9, 99,109, 97,120, 32, 61, 32,109, 97,120, 40,114,103, 98, 91, 48, 93, 44, 32,109, 97,120, 40,
+114,103, 98, 91, 49, 93, 44, 32,114,103, 98, 91, 50, 93, 41, 41, 59, 10,  9, 99,109,105,110, 32, 61, 32,109,105,110, 40,114,103,
+ 98, 91, 48, 93, 44, 32,109,105,110, 40,114,103, 98, 91, 49, 93, 44, 32,114,103, 98, 91, 50, 93, 41, 41, 59, 10,  9, 99,100,101,
+108,116, 97, 32, 61, 32, 99,109, 97,120, 45, 99,109,105,110, 59, 10, 10,  9,118, 32, 61, 32, 99,109, 97,120, 59, 10,  9,105,102,
+ 32, 40, 99,109, 97,120, 33, 61, 48, 46, 48, 41, 10,  9,  9,115, 32, 61, 32, 99,100,101,108,116, 97, 47, 99,109, 97,120, 59, 10,
+  9,101,108,115,101, 32,123, 10,  9,  9,115, 32, 61, 32, 48, 46, 48, 59, 10,  9,  9,104, 32, 61, 32, 48, 46, 48, 59, 10,  9,125,
+ 10, 10,  9,105,102, 32, 40,115, 32, 61, 61, 32, 48, 46, 48, 41, 32,123, 10,  9,  9,104, 32, 61, 32, 48, 46, 48, 59, 10,  9,125,
+ 10,  9,101,108,115,101, 32,123, 10,  9,  9, 99, 32, 61, 32, 40,118,101, 99, 51, 40, 99,109, 97,120, 44, 32, 99,109, 97,120, 44,
+ 32, 99,109, 97,120, 41, 32, 45, 32,114,103, 98, 46,120,121,122, 41, 47, 99,100,101,108,116, 97, 59, 10, 10,  9,  9,105,102, 32,
+ 40,114,103, 98, 46,120, 61, 61, 99,109, 97,120, 41, 32,104, 32, 61, 32, 99, 91, 50, 93, 32, 45, 32, 99, 91, 49, 93, 59, 10,  9,
+  9,101,108,115,101, 32,105,102, 32, 40,114,103, 98, 46,121, 61, 61, 99,109, 97,120, 41, 32,104, 32, 61, 32, 50, 46, 48, 32, 43,
+ 32, 99, 91, 48, 93, 32, 45, 32, 32, 99, 91, 50, 93, 59, 10,  9,  9,101,108,115,101, 32,104, 32, 61, 32, 52, 46, 48, 32, 43, 32,
+ 99, 91, 49, 93, 32, 45, 32, 99, 91, 48, 93, 59, 10, 10,  9,  9,104, 32, 47, 61, 32, 54, 46, 48, 59, 10, 10,  9,  9,105,102, 32,
+ 40,104, 60, 48, 46, 48, 41, 10,  9,  9,  9,104, 32, 43, 61, 32, 49, 46, 48, 59, 10,  9,125, 10, 10,  9,111,117,116, 99,111,108,
+ 32, 61, 32,118,101, 99, 52, 40,104, 44, 32,115, 44, 32,118, 44, 32,114,103, 98, 46,119, 41, 59, 10,125, 10, 10,118,111,105,100,
+ 32,104,115,118, 95,116,111, 95,114,103, 98, 40,118,101, 99, 52, 32,104,115,118, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,
+117,116, 99,111,108, 41, 10,123, 10,  9,102,108,111, 97,116, 32,105, 44, 32,102, 44, 32,112, 44, 32,113, 44, 32,116, 44, 32,104,
+ 44, 32,115, 44, 32,118, 59, 10,  9,118,101, 99, 51, 32,114,103, 98, 59, 10, 10,  9,104, 32, 61, 32,104,115,118, 91, 48, 93, 59,
+ 10,  9,115, 32, 61, 32,104,115,118, 91, 49, 93, 59, 10,  9,118, 32, 61, 32,104,115,118, 91, 50, 93, 59, 10, 10,  9,105,102, 40,
+115, 61, 61, 48, 46, 48, 41, 32,123, 10,  9,  9,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,118, 44, 32,118, 41, 59,
+ 10,  9,125, 10,  9,101,108,115,101, 32,123, 10,  9,  9,105,102, 40,104, 61, 61, 49, 46, 48, 41, 10,  9,  9,  9,104, 32, 61, 32,
+ 48, 46, 48, 59, 10,  9,  9, 10,  9,  9,104, 32, 42, 61, 32, 54, 46, 48, 59, 10,  9,  9,105, 32, 61, 32,102,108,111,111,114, 40,
+104, 41, 59, 10,  9,  9,102, 32, 61, 32,104, 32, 45, 32,105, 59, 10,  9,  9,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,102, 44,
+ 32,102, 44, 32,102, 41, 59, 10,  9,  9,112, 32, 61, 32,118, 42, 40, 49, 46, 48, 45,115, 41, 59, 10,  9,  9,113, 32, 61, 32,118,
+ 42, 40, 49, 46, 48, 45, 40,115, 42,102, 41, 41, 59, 10,  9,  9,116, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42, 40, 49,
+ 46, 48, 45,102, 41, 41, 41, 59, 10,  9,  9, 10,  9,  9,105,102, 32, 40,105, 32, 61, 61, 32, 48, 46, 48, 41, 32,114,103, 98, 32,
+ 61, 32,118,101, 99, 51, 40,118, 44, 32,116, 44, 32,112, 41, 59, 10,  9,  9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61,
+ 32, 49, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,113, 44, 32,118, 44, 32,112, 41, 59, 10,  9,  9,101,108,115,
+101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 50, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,118, 44,
+ 32,116, 41, 59, 10,  9,  9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 51, 46, 48, 41, 32,114,103, 98, 32, 61, 32,
+118,101, 99, 51, 40,112, 44, 32,113, 44, 32,118, 41, 59, 10,  9,  9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 52,
+ 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,116, 44, 32,112, 44, 32,118, 41, 59, 10,  9,  9,101,108,115,101, 32,
+114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,112, 44, 32,113, 41, 59, 10,  9,125, 10, 10,  9,111,117,116, 99,111,108,
+ 32, 61, 32,118,101, 99, 52, 40,114,103, 98, 44, 32,104,115,118, 46,119, 41, 59, 10,125, 10, 10,102,108,111, 97,116, 32,115,114,
+103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40,102,108,111, 97,116, 32, 99, 41, 10,123, 10,  9,105,102, 40, 99,
+ 32, 60, 32, 48, 46, 48, 52, 48, 52, 53, 41, 10,  9,  9,114,101,116,117,114,110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, 63, 32,
+ 48, 46, 48, 58, 32, 99, 32, 42, 32, 40, 49, 46, 48, 47, 49, 50, 46, 57, 50, 41, 59, 10,  9,101,108,115,101, 10,  9,  9,114,101,
+116,117,114,110, 32,112,111,119, 40, 40, 99, 32, 43, 32, 48, 46, 48, 53, 53, 41, 42, 40, 49, 46, 48, 47, 49, 46, 48, 53, 53, 41,
+ 44, 32, 50, 46, 52, 41, 59, 10,125, 10, 10,102,108,111, 97,116, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,
+103, 98, 40,102,108,111, 97,116, 32, 99, 41, 10,123, 10,  9,105,102, 40, 99, 32, 60, 32, 48, 46, 48, 48, 51, 49, 51, 48, 56, 41,
+ 10,  9,  9,114,101,116,117,114,110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, 32, 49, 50,
+ 46, 57, 50, 59, 10,  9,101,108,115,101, 10,  9,  9,114,101,116,117,114,110, 32, 49, 46, 48, 53, 53, 32, 42, 32,112,111,119, 40,
+ 99, 44, 32, 49, 46, 48, 47, 50, 46, 52, 41, 32, 45, 32, 48, 46, 48, 53, 53, 59, 10,125, 10, 10,118,111,105,100, 32,115,114,103,
+ 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 95,102,114,111,109, 44, 32,111,117,
+116, 32,118,101, 99, 52, 32, 99,111,108, 95,116,111, 41, 10,123, 10,  9, 99,111,108, 95,116,111, 46,114, 32, 61, 32,115,114,103,
+ 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,114, 41, 59, 10,  9, 99,111,108,
+ 95,116,111, 46,103, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,
+111,109, 46,103, 41, 59, 10,  9, 99,111,108, 95,116,111, 46, 98, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,
+114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46, 98, 41, 59, 10,  9, 99,111,108, 95,116,111, 46, 97, 32, 61, 32, 99,111,
+108, 95,102,114,111,109, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,
+114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 95,102,114,111,109, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 95,
+116,111, 41, 10,123, 10,  9, 99,111,108, 95,116,111, 46,114, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,
+114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,114, 41, 59, 10,  9, 99,111,108, 95,116,111, 46,103, 32, 61, 32,108,105,110,
+101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,103, 41, 59, 10,  9, 99,111,108,
+ 95,116,111, 46, 98, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,
+111,109, 46, 98, 41, 59, 10,  9, 99,111,108, 95,116,111, 46, 97, 32, 61, 32, 99,111,108, 95,102,114,111,109, 46, 97, 59, 10,125,
+ 10, 10, 35,100,101,102,105,110,101, 32, 77, 95, 80, 73, 32, 51, 46, 49, 52, 49, 53, 57, 50, 54, 53, 51, 53, 56, 57, 55, 57, 51,
+ 50, 51, 56, 52, 54, 10, 35,100,101,102,105,110,101, 32, 77, 95, 49, 95, 80, 73, 32, 48, 46, 51, 49, 56, 51, 48, 57, 56, 56, 54,
+ 49, 56, 51, 55, 57, 48, 54, 57, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 83, 72, 65, 68, 69, 82, 32, 78, 79,
+ 68, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100, 32,118, 99,111,108, 95,
+ 97,116,116,114,105, 98,117,116,101, 40,118,101, 99, 52, 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52,
+ 32,118, 99,111,108, 41, 10,123, 10,  9,118, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 97,116,116,118, 99,111,108, 46,120, 47,
+ 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,121, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,
+122, 47, 50, 53, 53, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,117,118, 95, 97,116,116,114,105, 98,
+117,116,101, 40,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 41, 10,123, 10,  9,
+117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 42, 50, 46, 48, 32, 45, 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32,
+ 49, 46, 48, 41, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,103,101,111,109, 40,118,101, 99, 51, 32, 99,111,
+ 44, 32,118,101, 99, 51, 32,110,111,114, 44, 32,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, 44, 32,118,101, 99,
+ 51, 32, 97,116,116,111,114, 99,111, 44, 32,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,118,101, 99, 52, 32, 97,116,116,118,
+ 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,103,108,111, 98, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,108,
+111, 99, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,114,
+ 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108,
+ 44, 32,111,117,116, 32,118,101, 99, 52, 32,118, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 99,111,108, 95,
+ 97,108,112,104, 97, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102,114,111,110,116, 98, 97, 99,107, 41, 10,123, 10,  9,108,
+111, 99, 97,108, 32, 61, 32, 99,111, 59, 10,  9,118,105,101,119, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108,111, 99,
+ 97,108, 41, 59, 10,  9,103,108,111, 98, 97,108, 32, 61, 32, 40,118,105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40,
+108,111, 99, 97,108, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10,  9,111,114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,
+111, 59, 10,  9,117,118, 95, 97,116,116,114,105, 98,117,116,101, 40, 97,116,116,117,118, 44, 32,117,118, 41, 59, 10,  9,110,111,
+114,109, 97,108, 32, 61, 32, 45,110,111,114,109, 97,108,105,122,101, 40,110,111,114, 41, 59,  9, 47, 42, 32, 98,108,101,110,100,
+101,114, 32,114,101,110,100,101,114, 32,110,111,114,109, 97,108, 32,105,115, 32,110,101,103, 97,116,101,100, 32, 42, 47, 10,  9,
+118, 99,111,108, 95, 97,116,116,114,105, 98,117,116,101, 40, 97,116,116,118, 99,111,108, 44, 32,118, 99,111,108, 41, 59, 10,  9,
+118, 99,111,108, 95, 97,108,112,104, 97, 32, 61, 32, 97,116,116,118, 99,111,108, 46, 97, 59, 10,  9,102,114,111,110,116, 98, 97,
+ 99,107, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,
+101, 99, 44, 32,109, 97,116, 52, 32,109, 97,116, 44, 32,118,101, 99, 51, 32,109,105,110,118,101, 99, 44, 32,118,101, 99, 51, 32,
+109, 97,120,118,101, 99, 44, 32,102,108,111, 97,116, 32,100,111,109,105,110, 44, 32,102,108,111, 97,116, 32,100,111,109, 97,120,
+ 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10,  9,111,117,116,118,101, 99, 32, 61, 32, 40,
+109, 97,116, 32, 42, 32,118,101, 99, 52, 40,118,101, 99, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10,  9,105,102, 40,100,
+111,109,105,110, 32, 61, 61, 32, 49, 46, 48, 41, 10,  9,  9,111,117,116,118,101, 99, 32, 61, 32,109, 97,120, 40,111,117,116,118,
+101, 99, 44, 32,109,105,110,118,101, 99, 41, 59, 10,  9,105,102, 40,100,111,109, 97,120, 32, 61, 61, 32, 49, 46, 48, 41, 10,  9,
+  9,111,117,116,118,101, 99, 32, 61, 32,109,105,110, 40,111,117,116,118,101, 99, 44, 32,109, 97,120,118,101, 99, 41, 59, 10,125,
+ 10, 10,118,111,105,100, 32, 99, 97,109,101,114, 97, 40,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,
+111,117,116,118,105,101,119, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,100,101,112,116,104, 44, 32,111,117,116,
+ 32,102,108,111, 97,116, 32,111,117,116,100,105,115,116, 41, 10,123, 10,  9,111,117,116,100,101,112,116,104, 32, 61, 32, 97, 98,
+115, 40, 99,111, 46,122, 41, 59, 10,  9,111,117,116,100,105,115,116, 32, 61, 32,108,101,110,103,116,104, 40, 99,111, 41, 59, 10,
+  9,111,117,116,118,105,101,119, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 41, 59, 10,125, 10, 10,118,111,105,
+100, 32,109, 97,116,104, 95, 97,100,100, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108,
+ 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61,
+ 32,118, 97,108, 49, 32, 43, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,115,117, 98,116,114,
+ 97, 99,116, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,
+102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 45,
+ 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109,117,108,116,105,112,108,121, 40,102,108,111,
+ 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,
+117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 42, 32,118, 97,108, 50, 59, 10,
+125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,100,105,118,105,100,101, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,
+102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,
+  9,105,102, 32, 40,118, 97,108, 50, 32, 61, 61, 32, 48, 46, 48, 41, 10,  9,  9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48,
+ 59, 10,  9,101,108,115,101, 10,  9,  9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 47, 32,118, 97,108, 50, 59, 10,
+125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116,
+ 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32,115,105,110, 40,118,
+ 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 99,111,115,105,110,101, 40,102,108,111, 97,116, 32,118,
+ 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32,
+ 61, 32, 99,111,115, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,116, 97,110,103,101,110,116,
+ 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,
+  9,111,117,116,118, 97,108, 32, 61, 32,116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104,
+ 95, 97,115,105,110, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,
+108, 41, 10,123, 10,  9,105,102, 32, 40,118, 97,108, 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45,
+ 49, 46, 48, 41, 10,  9,  9,111,117,116,118, 97,108, 32, 61, 32, 97,115,105,110, 40,118, 97,108, 41, 59, 10,  9,101,108,115,101,
+ 10,  9,  9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97, 99,
+111,115, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,
+123, 10,  9,105,102, 32, 40,118, 97,108, 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48,
+ 41, 10,  9,  9,111,117,116,118, 97,108, 32, 61, 32, 97, 99,111,115, 40,118, 97,108, 41, 59, 10,  9,101,108,115,101, 10,  9,  9,
+111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,116, 97,110, 40,
+102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,
+111,117,116,118, 97,108, 32, 61, 32, 97,116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104,
+ 95,112,111,119, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116,
+ 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,105,102, 32, 40,118, 97,108, 49, 32, 62, 61, 32, 48, 46,
+ 48, 41, 10,  9,  9,111,117,116,118, 97,108, 32, 61, 32,112,111,119, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,  9,
+101,108,115,101, 10,  9,  9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,
+104, 95,108,111,103, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,
+116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,105,102, 40,118, 97,108, 49, 32, 62, 32, 48, 46, 48,
+ 32, 32, 38, 38, 32,118, 97,108, 50, 32, 62, 32, 48, 46, 48, 41, 10,  9,  9,111,117,116,118, 97,108, 61, 32,108,111,103, 50, 40,
+118, 97,108, 49, 41, 32, 47, 32,108,111,103, 50, 40,118, 97,108, 50, 41, 59, 10,  9,101,108,115,101, 10,  9,  9,111,117,116,118,
+ 97,108, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109, 97,120, 40,102,108,111, 97,116, 32,
+118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118,
+ 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32,109, 97,120, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59,
+ 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109,105,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,
+111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,
+117,116,118, 97,108, 32, 61, 32,109,105,110, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10,118,111,105,100,
+ 32,109, 97,116,104, 95,114,111,117,110,100, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116,
+ 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 61, 32,102,108,111,111,114, 40,118, 97,108, 32, 43, 32,
+ 48, 46, 53, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,108,101,115,115, 95,116,104, 97,110, 40,102,108,111,
+ 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,
+117,116,118, 97,108, 41, 10,123, 10,  9,105,102, 40,118, 97,108, 49, 32, 60, 32,118, 97,108, 50, 41, 10,  9,  9,111,117,116,118,
+ 97,108, 32, 61, 32, 49, 46, 48, 59, 10,  9,101,108,115,101, 10,  9,  9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,
+125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,103,114,101, 97,116,101,114, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,
+118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118,
+ 97,108, 41, 10,123, 10,  9,105,102, 40,118, 97,108, 49, 32, 62, 32,118, 97,108, 50, 41, 10,  9,  9,111,117,116,118, 97,108, 32,
+ 61, 32, 49, 46, 48, 59, 10,  9,101,108,115,101, 10,  9,  9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,
+118,111,105,100, 32,115,113,117,101,101,122,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,102,108,111, 97,116, 32,119,105,
+100,116,104, 44, 32,102,108,111, 97,116, 32, 99,101,110,116,101,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,
+118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 47, 40, 49, 46, 48, 32, 43, 32,112,111,119, 40,
+ 50, 46, 55, 49, 56, 50, 56, 49, 56, 51, 44, 32, 45, 40, 40,118, 97,108, 45, 99,101,110,116,101,114, 41, 42,119,105,100,116,104,
+ 41, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,100,100, 40,118,101, 99, 51, 32,118,
+ 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116,
+ 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 43, 32,
+118, 50, 59, 10,  9,111,117,116,118, 97,108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32,
+ 97, 98,115, 40,111,117,116,118,101, 99, 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41,
+ 47, 51, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,115,117, 98, 40,118,101, 99, 51, 32,
+118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,
+116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 45,
+ 32,118, 50, 59, 10,  9,111,117,116,118, 97,108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43,
+ 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41,
+ 41, 47, 51, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,118,101,114, 97,103,101, 40,
+118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101,
+ 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118,101, 99, 32, 61,
+ 32,118, 49, 32, 43, 32,118, 50, 59, 10,  9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101,
+ 99, 41, 59, 10,  9,111,117,116,118,101, 99, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,111,117,116,118,101, 99, 41, 59,
+ 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,100,111,116, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,
+101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111,
+ 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 51, 40, 48, 44, 32, 48,
+ 44, 32, 48, 41, 59, 10,  9,111,117,116,118, 97,108, 32, 61, 32,100,111,116, 40,118, 49, 44, 32,118, 50, 41, 59, 10,125, 10, 10,
+118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 99,114,111,115,115, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99,
+ 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116,
+ 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118,101, 99, 32, 61, 32, 99,114,111,115,115, 40,118, 49, 44, 32,118,
+ 50, 41, 59, 10,  9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10,
+ 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,110,111,114,109, 97,108,105,122,101, 40,118,101, 99, 51, 32,118, 44,
+ 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118,
+ 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,118, 41, 59, 10,  9,111,117,116,118,
+101, 99, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,118, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109,
+ 97,116,104, 95,110,101,103, 97,116,101, 40,118,101, 99, 51, 32,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,
+ 41, 10,123, 10,  9,111,117,116,118, 32, 61, 32, 45,118, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,114,109, 97,108, 40,118,
+101, 99, 51, 32,100,105,114, 44, 32,118,101, 99, 51, 32,110,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,
+111,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,100,111,116, 41, 10,123, 10,  9,111,117,116,110,111,114, 32,
+ 61, 32,110,111,114, 59, 10,  9,111,117,116,100,111,116, 32, 61, 32, 45,100,111,116, 40,100,105,114, 44, 32,110,111,114, 41, 59,
+ 10,125, 10, 10,118,111,105,100, 32, 99,117,114,118,101,115, 95,118,101, 99, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,
+101, 99, 51, 32,118,101, 99, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32,111,117,116,
+ 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10,  9,111,117,116,118,101, 99, 46,120, 32, 61, 32,116,101,120,116,
+117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 40,118,101, 99, 46,120, 32, 43, 32, 49, 46,
+ 48, 41, 42, 48, 46, 53, 44, 32, 48, 46, 48, 41, 41, 46,120, 59, 10,  9,111,117,116,118,101, 99, 46,121, 32, 61, 32,116,101,120,
+116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 40,118,101, 99, 46,121, 32, 43, 32, 49,
+ 46, 48, 41, 42, 48, 46, 53, 44, 32, 48, 46, 48, 41, 41, 46,121, 59, 10,  9,111,117,116,118,101, 99, 46,122, 32, 61, 32,116,101,
+120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 40,118,101, 99, 46,122, 32, 43, 32,
+ 49, 46, 48, 41, 42, 48, 46, 53, 44, 32, 48, 46, 48, 41, 41, 46,122, 59, 10, 10,  9,105,102, 32, 40,102, 97, 99, 32, 33, 61, 32,
+ 49, 46, 48, 41, 10,  9,  9,111,117,116,118,101, 99, 32, 61, 32, 40,111,117,116,118,101, 99, 42,102, 97, 99, 41, 32, 43, 32, 40,
+118,101, 99, 42, 40, 49, 46, 48, 45,102, 97, 99, 41, 41, 59, 10, 10,125, 10, 10,118,111,105,100, 32, 99,117,114,118,101,115, 95,
+114,103, 98, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,115, 97,109,112,108,101,114,
+ 50, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,
+  9,111,117,116, 99,111,108, 46,114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,
+118,101, 99, 50, 40,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 99,111,
+108, 46,114, 44, 32, 48, 46, 48, 41, 41, 46, 97, 44, 32, 48, 46, 48, 41, 41, 46,114, 59, 10,  9,111,117,116, 99,111,108, 46,103,
+ 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40,116,101,120,116,
+117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 99,111,108, 46,103, 44, 32, 48, 46, 48, 41,
+ 41, 46, 97, 44, 32, 48, 46, 48, 41, 41, 46,103, 59, 10,  9,111,117,116, 99,111,108, 46, 98, 32, 61, 32,116,101,120,116,117,114,
+101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,
+118,101,109, 97,112, 44, 32,118,101, 99, 50, 40, 99,111,108, 46, 98, 44, 32, 48, 46, 48, 41, 41, 46, 97, 44, 32, 48, 46, 48, 41,
+ 41, 46, 98, 59, 10, 10,  9,105,102, 32, 40,102, 97, 99, 32, 33, 61, 32, 49, 46, 48, 41, 10,  9,  9,111,117,116, 99,111,108, 32,
+ 61, 32, 40,111,117,116, 99,111,108, 42,102, 97, 99, 41, 32, 43, 32, 40, 99,111,108, 42, 40, 49, 46, 48, 45,102, 97, 99, 41, 41,
+ 59, 10, 10,  9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,
+116, 95,118, 97,108,117,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,
+118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,
+116, 95,114,103, 98, 40,118,101, 99, 51, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41,
+ 10,123, 10,  9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103,
+ 98, 97, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,
+  9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101,
+ 95,122,101,114,111, 40,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,
+108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 95,111,110,101, 40,111,
+117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48,
+ 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 95,122,101,114,111, 40,111,117,116, 32,118,101, 99, 51, 32,
+111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 41, 59, 10,125,
+ 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 97, 95,122,101,114,111, 40,111,117,116, 32,118,101, 99, 52, 32,111,117,
+116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32,118,101, 99, 52, 40, 48, 46, 48, 41, 59, 10,125, 10, 10,
+118,111,105,100, 32,109,105,120, 95, 98,108,101,110,100, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,
+111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41,
+ 10,123, 10,  9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,
+  9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10,
+  9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,
+ 97,100,100, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,
 111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,102, 97, 99, 32, 61, 32, 99,
 108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,111,117,116, 99,111,108, 32, 61, 32,109,
-105,120, 40, 99,111,108, 49, 44, 32, 99,111,108, 49, 32, 42, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10,  9,111,117,116,
- 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115, 99,114,101,
-101,110, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,
-108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,102, 97, 99, 32, 61, 32, 99,108,
- 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 32,
- 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10,  9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 49, 46, 48,
- 41, 32, 45, 32, 40,118,101, 99, 52, 40,102, 97, 99,109, 41, 32, 43, 32,102, 97, 99, 42, 40,118,101, 99, 52, 40, 49, 46, 48, 41,
- 32, 45, 32, 99,111,108, 50, 41, 41, 42, 40,118,101, 99, 52, 40, 49, 46, 48, 41, 32, 45, 32, 99,111,108, 49, 41, 59, 10,  9,111,
-117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,111,118,
-101,114,108, 97,121, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52,
- 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,102, 97, 99, 32, 61,
- 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,102,108,111, 97,116, 32,102, 97,
- 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10,  9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59,
- 10, 10,  9,105,102, 40,111,117,116, 99,111,108, 46,114, 32, 60, 32, 48, 46, 53, 41, 10,  9,  9,111,117,116, 99,111,108, 46,114,
- 32, 42, 61, 32,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 99,111,108, 50, 46,114, 59, 10,  9,101,108,115,101,
- 10,  9,  9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,
-102, 97, 99, 42, 40, 49, 46, 48, 32, 45, 32, 99,111,108, 50, 46,114, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,
-108, 46,114, 41, 59, 10, 10,  9,105,102, 40,111,117,116, 99,111,108, 46,103, 32, 60, 32, 48, 46, 53, 41, 10,  9,  9,111,117,116,
- 99,111,108, 46,103, 32, 42, 61, 32,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10,
-  9,101,108,115,101, 10,  9,  9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43,
- 32, 50, 46, 48, 42,102, 97, 99, 42, 40, 49, 46, 48, 32, 45, 32, 99,111,108, 50, 46,103, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,
-111,117,116, 99,111,108, 46,103, 41, 59, 10, 10,  9,105,102, 40,111,117,116, 99,111,108, 46, 98, 32, 60, 32, 48, 46, 53, 41, 10,
-  9,  9,111,117,116, 99,111,108, 46, 98, 32, 42, 61, 32,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 99,111,108,
- 50, 46, 98, 59, 10,  9,101,108,115,101, 10,  9,  9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102,
- 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 40, 49, 46, 48, 32, 45, 32, 99,111,108, 50, 46, 98, 41, 41, 42, 40, 49,
- 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46, 98, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115,117, 98, 40,
+105,120, 40, 99,111,108, 49, 44, 32, 99,111,108, 49, 32, 43, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10,  9,111,117,116,
+ 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,109,117,108,116,
+ 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50,
+ 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,102, 97, 99, 32, 61, 32, 99,108, 97,109,
+112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40,
+ 99,111,108, 49, 44, 32, 99,111,108, 49, 32, 42, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10,  9,111,117,116, 99,111,108,
+ 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115, 99,114,101,101,110, 40,
 102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44,
  32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112,
- 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,
-111,108, 49, 44, 32, 99,111,108, 49, 32, 45, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10,  9,111,117,116, 99,111,108, 46,
- 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,100,105,118, 40,102,108,111, 97,
-116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116,
- 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99,
- 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45,
- 32,102, 97, 99, 59, 10, 10,  9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10,  9,105,102, 40, 99,111,108, 50,
- 46,114, 32, 33, 61, 32, 48, 46, 48, 41, 32,111,117,116, 99,111,108, 46,114, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,
-108, 46,114, 32, 43, 32,102, 97, 99, 42,111,117,116, 99,111,108, 46,114, 47, 99,111,108, 50, 46,114, 59, 10,  9,105,102, 40, 99,
-111,108, 50, 46,103, 32, 33, 61, 32, 48, 46, 48, 41, 32,111,117,116, 99,111,108, 46,103, 32, 61, 32,102, 97, 99,109, 42,111,117,
-116, 99,111,108, 46,103, 32, 43, 32,102, 97, 99, 42,111,117,116, 99,111,108, 46,103, 47, 99,111,108, 50, 46,103, 59, 10,  9,105,
-102, 40, 99,111,108, 50, 46, 98, 32, 33, 61, 32, 48, 46, 48, 41, 32,111,117,116, 99,111,108, 46, 98, 32, 61, 32,102, 97, 99,109,
- 42,111,117,116, 99,111,108, 46, 98, 32, 43, 32,102, 97, 99, 42,111,117,116, 99,111,108, 46, 98, 47, 99,111,108, 50, 46, 98, 59,
- 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,100,105,102,102, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99,
- 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,
-111,108, 41, 10,123, 10,  9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48,
- 41, 59, 10,  9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 97, 98,115, 40, 99,111,108, 49, 32,
- 45, 32, 99,111,108, 50, 41, 44, 32,102, 97, 99, 41, 59, 10,  9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46,
- 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,100, 97,114,107, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,
-101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,
-116, 99,111,108, 41, 10,123, 10,  9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49,
- 46, 48, 41, 59, 10,  9,111,117,116, 99,111,108, 46,114,103, 98, 32, 61, 32,109,105,110, 40, 99,111,108, 49, 46,114,103, 98, 44,
- 32, 99,111,108, 50, 46,114,103, 98, 42,102, 97, 99, 41, 59, 10,  9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49,
- 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,108,105,103,104,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44,
- 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,
-111,117,116, 99,111,108, 41, 10,123, 10,  9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44,
- 32, 49, 46, 48, 41, 59, 10,  9,111,117,116, 99,111,108, 46,114,103, 98, 32, 61, 32,109, 97,120, 40, 99,111,108, 49, 46,114,103,
- 98, 44, 32, 99,111,108, 50, 46,114,103, 98, 42,102, 97, 99, 41, 59, 10,  9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,
-108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,100,111,100,103,101, 40,102,108,111, 97,116, 32,102, 97,
- 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99,
- 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46,
- 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10,  9,105,102, 40,111,117,
-116, 99,111,108, 46,114, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10,  9,  9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, 49,
- 46, 48, 32, 45, 32,102, 97, 99, 42, 99,111,108, 50, 46,114, 59, 10,  9,  9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48,
- 41, 10,  9,  9,  9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48, 59, 10,  9,  9,101,108,115,101, 32,105,102, 40, 40,
-116,109,112, 32, 61, 32,111,117,116, 99,111,108, 46,114, 47,116,109,112, 41, 32, 62, 32, 49, 46, 48, 41, 10,  9,  9,  9,111,117,
-116, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48, 59, 10,  9,  9,101,108,115,101, 10,  9,  9,  9,111,117,116, 99,111,108, 46,114,
- 32, 61, 32,116,109,112, 59, 10,  9,125, 10,  9,105,102, 40,111,117,116, 99,111,108, 46,103, 32, 33, 61, 32, 48, 46, 48, 41, 32,
-123, 10,  9,  9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 42, 99,111,108, 50, 46,103,
- 59, 10,  9,  9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10,  9,  9,  9,111,117,116, 99,111,108, 46,103, 32, 61,
- 32, 49, 46, 48, 59, 10,  9,  9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32,111,117,116, 99,111,108, 46,103, 47,
-116,109,112, 41, 32, 62, 32, 49, 46, 48, 41, 10,  9,  9,  9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 59, 10,  9,
-  9,101,108,115,101, 10,  9,  9,  9,111,117,116, 99,111,108, 46,103, 32, 61, 32,116,109,112, 59, 10,  9,125, 10,  9,105,102, 40,
-111,117,116, 99,111,108, 46, 98, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10,  9,  9,102,108,111, 97,116, 32,116,109,112, 32, 61,
- 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 42, 99,111,108, 50, 46, 98, 59, 10,  9,  9,105,102, 40,116,109,112, 32, 60, 61, 32, 48,
- 46, 48, 41, 10,  9,  9,  9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 59, 10,  9,  9,101,108,115,101, 32,105,102,
- 40, 40,116,109,112, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 47,116,109,112, 41, 32, 62, 32, 49, 46, 48, 41, 10,  9,  9,  9,
-111,117,116, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 59, 10,  9,  9,101,108,115,101, 10,  9,  9,  9,111,117,116, 99,111,108,
- 46, 98, 32, 61, 32,116,109,112, 59, 10,  9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, 98,117,114,110, 40,102,108,
-111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,
-117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102,
- 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,102,108,111, 97,116, 32,116,109,112, 44, 32,102, 97, 99,109, 32,
+ 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49,
+ 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10,  9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 49, 46, 48, 41, 32, 45,
+ 32, 40,118,101, 99, 52, 40,102, 97, 99,109, 41, 32, 43, 32,102, 97, 99, 42, 40,118,101, 99, 52, 40, 49, 46, 48, 41, 32, 45, 32,
+ 99,111,108, 50, 41, 41, 42, 40,118,101, 99, 52, 40, 49, 46, 48, 41, 32, 45, 32, 99,111,108, 49, 41, 59, 10,  9,111,117,116, 99,
+111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,111,118,101,114,108,
+ 97,121, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,
+108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,102, 97, 99, 32, 61, 32, 99,108,
+ 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 32,
  61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10,  9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10,  9,
-116,109,112, 32, 61, 32,102, 97, 99,109, 32, 43, 32,102, 97, 99, 42, 99,111,108, 50, 46,114, 59, 10,  9,105,102, 40,116,109,112,
- 32, 60, 61, 32, 48, 46, 48, 41, 10,  9,  9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 48, 46, 48, 59, 10,  9,101,108,115,101,
- 32,105,102, 40, 40,116,109,112, 32, 61, 32, 40, 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,
-114, 41, 47,116,109,112, 41, 41, 32, 60, 32, 48, 46, 48, 41, 10,  9,  9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 48, 46, 48,
- 59, 10,  9,101,108,115,101, 32,105,102, 40,116,109,112, 32, 62, 32, 49, 46, 48, 41, 10,  9,  9,111,117,116, 99,111,108, 46,114,
- 32, 61, 32, 49, 46, 48, 59, 10,  9,101,108,115,101, 10,  9,  9,111,117,116, 99,111,108, 46,114, 32, 61, 32,116,109,112, 59, 10,
- 10,  9,116,109,112, 32, 61, 32,102, 97, 99,109, 32, 43, 32,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10,  9,105,102, 40,116,
-109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10,  9,  9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 48, 46, 48, 59, 10,  9,101,108,
-115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32, 40, 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,
-108, 46,103, 41, 47,116,109,112, 41, 41, 32, 60, 32, 48, 46, 48, 41, 10,  9,  9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 48,
- 46, 48, 59, 10,  9,101,108,115,101, 32,105,102, 40,116,109,112, 32, 62, 32, 49, 46, 48, 41, 10,  9,  9,111,117,116, 99,111,108,
- 46,103, 32, 61, 32, 49, 46, 48, 59, 10,  9,101,108,115,101, 10,  9,  9,111,117,116, 99,111,108, 46,103, 32, 61, 32,116,109,112,
- 59, 10, 10,  9,116,109,112, 32, 61, 32,102, 97, 99,109, 32, 43, 32,102, 97, 99, 42, 99,111,108, 50, 46, 98, 59, 10,  9,105,102,
- 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10,  9,  9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 48, 46, 48, 59, 10,  9,
-101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32, 40, 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116,
- 99,111,108, 46, 98, 41, 47,116,109,112, 41, 41, 32, 60, 32, 48, 46, 48, 41, 10,  9,  9,111,117,116, 99,111,108, 46, 98, 32, 61,
- 32, 48, 46, 48, 59, 10,  9,101,108,115,101, 32,105,102, 40,116,109,112, 32, 62, 32, 49, 46, 48, 41, 10,  9,  9,111,117,116, 99,
-111,108, 46, 98, 32, 61, 32, 49, 46, 48, 59, 10,  9,101,108,115,101, 10,  9,  9,111,117,116, 99,111,108, 46, 98, 32, 61, 32,116,
-109,112, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,104,117,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,
-101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,
-116, 99,111,108, 41, 10,123, 10,  9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49,
- 46, 48, 41, 59, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10,  9,
-111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10,  9,118,101, 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 44,
- 32,116,109,112, 59, 10,  9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10,
-  9,105,102, 40,104,115,118, 50, 46,121, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10,  9,  9,114,103, 98, 95,116,111, 95,104,115,
-118, 40,111,117,116, 99,111,108, 44, 32,104,115,118, 41, 59, 10,  9,  9,104,115,118, 46,120, 32, 61, 32,104,115,118, 50, 46,120,
- 59, 10,  9,  9,104,115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32,116,109,112, 41, 59, 32, 10, 10,  9,  9,111,117,
-116, 99,111,108, 32, 61, 32,109,105,120, 40,111,117,116, 99,111,108, 44, 32,116,109,112, 44, 32,102, 97, 99, 41, 59, 10,  9,  9,
-111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,  9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,
-120, 95,115, 97,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52,
- 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,102, 97, 99, 32, 61,
- 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,102,108,111, 97,116, 32,102, 97,
- 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10,  9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59,
- 10, 10,  9,118,101, 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 59, 10,  9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,
-117,116, 99,111,108, 44, 32,104,115,118, 41, 59, 10, 10,  9,105,102, 40,104,115,118, 46,121, 32, 33, 61, 32, 48, 46, 48, 41, 32,
-123, 10,  9,  9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10,  9,  9,104,
-115,118, 46,121, 32, 61, 32,102, 97, 99,109, 42,104,115,118, 46,121, 32, 43, 32,102, 97, 99, 42,104,115,118, 50, 46,121, 59, 10,
-  9,  9,104,115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32,111,117,116, 99,111,108, 41, 59, 10,  9,125, 10,125, 10,
- 10,118,111,105,100, 32,109,105,120, 95,118, 97,108, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,
-108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,
-123, 10,  9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,
-102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10,  9,118,101, 99, 52, 32,104,
-115,118, 44, 32,104,115,118, 50, 59, 10,  9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 49, 44, 32,104,115,118, 41,
- 59, 10,  9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10,  9,104,115,118,
- 46,122, 32, 61, 32,102, 97, 99,109, 42,104,115,118, 46,122, 32, 43, 32,102, 97, 99, 42,104,115,118, 50, 46,122, 59, 10,  9,104,
-115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,
-109,105,120, 95, 99,111,108,111,114, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,
-118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,102,
- 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,102,108,111, 97,
-116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10,  9,111,117,116, 99,111,108, 32, 61, 32, 99,
-111,108, 49, 59, 10, 10,  9,118,101, 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 44, 32,116,109,112, 59, 10,  9,114,103, 98,
- 95,116,111, 95,104,115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10,  9,105,102, 40,104,115,118, 50, 46,121,
- 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10,  9,  9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,117,116, 99,111,108, 44, 32,
-104,115,118, 41, 59, 10,  9,  9,104,115,118, 46,120, 32, 61, 32,104,115,118, 50, 46,120, 59, 10,  9,  9,104,115,118, 46,121, 32,
- 61, 32,104,115,118, 50, 46,121, 59, 10,  9,  9,104,115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32,116,109,112, 41,
- 59, 32, 10, 10,  9,  9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40,111,117,116, 99,111,108, 44, 32,116,109,112, 44, 32,
-102, 97, 99, 41, 59, 10,  9,  9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,  9,125, 10,125, 10,
- 10,118,111,105,100, 32,109,105,120, 95,115,111,102,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,
+105,102, 40,111,117,116, 99,111,108, 46,114, 32, 60, 32, 48, 46, 53, 41, 10,  9,  9,111,117,116, 99,111,108, 46,114, 32, 42, 61,
+ 32,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 99,111,108, 50, 46,114, 59, 10,  9,101,108,115,101, 10,  9,  9,
+111,117,116, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,
+ 42, 40, 49, 46, 48, 32, 45, 32, 99,111,108, 50, 46,114, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114,
+ 41, 59, 10, 10,  9,105,102, 40,111,117,116, 99,111,108, 46,103, 32, 60, 32, 48, 46, 53, 41, 10,  9,  9,111,117,116, 99,111,108,
+ 46,103, 32, 42, 61, 32,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10,  9,101,108,
+115,101, 10,  9,  9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46,
+ 48, 42,102, 97, 99, 42, 40, 49, 46, 48, 32, 45, 32, 99,111,108, 50, 46,103, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116,
+ 99,111,108, 46,103, 41, 59, 10, 10,  9,105,102, 40,111,117,116, 99,111,108, 46, 98, 32, 60, 32, 48, 46, 53, 41, 10,  9,  9,111,
+117,116, 99,111,108, 46, 98, 32, 42, 61, 32,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 99,111,108, 50, 46, 98,
+ 59, 10,  9,101,108,115,101, 10,  9,  9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109,
+ 32, 43, 32, 50, 46, 48, 42,102, 97, 99, 42, 40, 49, 46, 48, 32, 45, 32, 99,111,108, 50, 46, 98, 41, 41, 42, 40, 49, 46, 48, 32,
+ 45, 32,111,117,116, 99,111,108, 46, 98, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115,117, 98, 40,102,108,111,
+ 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,
+116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97,
+ 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49,
+ 44, 32, 99,111,108, 49, 32, 45, 32, 99,111,108, 50, 44, 32,102, 97, 99, 41, 59, 10,  9,111,117,116, 99,111,108, 46, 97, 32, 61,
+ 32, 99,111,108, 49, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,100,105,118, 40,102,108,111, 97,116, 32,102,
+ 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101,
+ 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48,
+ 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97,
+ 99, 59, 10, 10,  9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10,  9,105,102, 40, 99,111,108, 50, 46,114, 32,
+ 33, 61, 32, 48, 46, 48, 41, 32,111,117,116, 99,111,108, 46,114, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,114,
+ 32, 43, 32,102, 97, 99, 42,111,117,116, 99,111,108, 46,114, 47, 99,111,108, 50, 46,114, 59, 10,  9,105,102, 40, 99,111,108, 50,
+ 46,103, 32, 33, 61, 32, 48, 46, 48, 41, 32,111,117,116, 99,111,108, 46,103, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,
+108, 46,103, 32, 43, 32,102, 97, 99, 42,111,117,116, 99,111,108, 46,103, 47, 99,111,108, 50, 46,103, 59, 10,  9,105,102, 40, 99,
+111,108, 50, 46, 98, 32, 33, 61, 32, 48, 46, 48, 41, 32,111,117,116, 99,111,108, 46, 98, 32, 61, 32,102, 97, 99,109, 42,111,117,
+116, 99,111,108, 46, 98, 32, 43, 32,102, 97, 99, 42,111,117,116, 99,111,108, 46, 98, 47, 99,111,108, 50, 46, 98, 59, 10,125, 10,
+ 10,118,111,105,100, 32,109,105,120, 95,100,105,102,102, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,
 111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41,
  10,123, 10,  9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,
-  9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10,  9,118,101, 99, 52, 32,
-111,110,101, 61, 32,118,101, 99, 52, 40, 49, 46, 48, 41, 59, 10,  9,118,101, 99, 52, 32,115, 99,114, 61, 32,111,110,101, 32, 45,
- 32, 40,111,110,101, 32, 45, 32, 99,111,108, 50, 41, 42, 40,111,110,101, 32, 45, 32, 99,111,108, 49, 41, 59, 10,  9,111,117,116,
- 99,111,108, 32, 61, 32,102, 97, 99,109, 42, 99,111,108, 49, 32, 43, 32,102, 97, 99, 42, 40, 40,111,110,101, 32, 45, 32, 99,111,
-108, 49, 41, 42, 99,111,108, 50, 42, 99,111,108, 49, 32, 43, 32, 99,111,108, 49, 42,115, 99,114, 41, 59, 10,125, 10, 10,118,111,
-105,100, 32,109,105,120, 95,108,105,110,101, 97,114, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,
-108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,
-123, 10,  9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 10,
-  9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10,  9,105,102, 40, 99,111,108, 50, 46,114, 32, 62, 32, 48, 46,
- 53, 41, 10,  9,  9,111,117,116, 99,111,108, 46,114, 61, 32, 99,111,108, 49, 46,114, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48,
- 42, 40, 99,111,108, 50, 46,114, 32, 45, 32, 48, 46, 53, 41, 41, 59, 10,  9,101,108,115,101, 10,  9,  9,111,117,116, 99,111,108,
- 46,114, 61, 32, 99,111,108, 49, 46,114, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,114, 41, 32, 45,
- 32, 49, 46, 48, 41, 59, 10, 10,  9,105,102, 40, 99,111,108, 50, 46,103, 32, 62, 32, 48, 46, 53, 41, 10,  9,  9,111,117,116, 99,
-111,108, 46,103, 61, 32, 99,111,108, 49, 46,103, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,103, 32,
- 45, 32, 48, 46, 53, 41, 41, 59, 10,  9,101,108,115,101, 10,  9,  9,111,117,116, 99,111,108, 46,103, 61, 32, 99,111,108, 49, 46,
-103, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,103, 41, 32, 45, 32, 49, 46, 48, 41, 59, 10, 10,  9,
-105,102, 40, 99,111,108, 50, 46, 98, 32, 62, 32, 48, 46, 53, 41, 10,  9,  9,111,117,116, 99,111,108, 46, 98, 61, 32, 99,111,108,
- 49, 46, 98, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46, 98, 32, 45, 32, 48, 46, 53, 41, 41, 59, 10,
-  9,101,108,115,101, 10,  9,  9,111,117,116, 99,111,108, 46, 98, 61, 32, 99,111,108, 49, 46, 98, 32, 43, 32,102, 97, 99, 42, 40,
- 50, 46, 48, 42, 40, 99,111,108, 50, 46, 98, 41, 32, 45, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118, 97,108,
-116,111,114,103, 98, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32, 99,111,108,111,114,
-109, 97,112, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,
-111,117,116, 97,108,112,104, 97, 41, 10,123, 10,  9,111,117,116, 99,111,108, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40,
- 99,111,108,111,114,109, 97,112, 44, 32,118,101, 99, 50, 40,102, 97, 99, 44, 32, 48, 46, 48, 41, 41, 59, 10,  9,111,117,116, 97,
-108,112,104, 97, 32, 61, 32,111,117,116, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,114,103, 98,116,111, 98,119,
- 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 32, 32,
- 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32, 99,111,108,111,114, 46,114, 42, 48, 46, 51, 53, 32, 43, 32, 99,111,108,111,
-114, 46,103, 42, 48, 46, 52, 53, 32, 43, 32, 99,111,108,111,114, 46, 98, 42, 48, 46, 50, 59, 32, 47, 42, 32,107,101,101,112, 32,
-116,104,101,115,101, 32,102, 97, 99,116,111,114,115, 32,105,110, 32,115,121,110, 99, 32,119,105,116,104, 32,116,101,120,116,117,
-114,101, 46,104, 58, 82, 71, 66, 84, 79, 66, 87, 32, 42, 47, 10,125, 10, 10,118,111,105,100, 32,105,110,118,101,114,116, 40,102,
-108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,
- 99,111,108, 41, 10,123, 10,  9,111,117,116, 99,111,108, 46,120,121,122, 32, 61, 32,109,105,120, 40, 99,111,108, 46,120,121,122,
- 44, 32,118,101, 99, 51, 40, 49, 46, 48, 44, 32, 49, 46, 48, 44, 32, 49, 46, 48, 41, 32, 45, 32, 99,111,108, 46,120,121,122, 44,
- 32,102, 97, 99, 41, 59, 10,  9,111,117,116, 99,111,108, 46,119, 32, 61, 32, 99,111,108, 46,119, 59, 10,125, 10, 10,118,111,105,
-100, 32,104,117,101, 95,115, 97,116, 40,102,108,111, 97,116, 32,104,117,101, 44, 32,102,108,111, 97,116, 32,115, 97,116, 44, 32,
-102,108,111, 97,116, 32,118, 97,108,117,101, 44, 32,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108,
- 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,118,101, 99, 52, 32,104,115,118, 59, 10,
- 10,  9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 44, 32,104,115,118, 41, 59, 10, 10,  9,104,115,118, 91, 48, 93,
- 32, 43, 61, 32, 40,104,117,101, 32, 45, 32, 48, 46, 53, 41, 59, 10,  9,105,102, 40,104,115,118, 91, 48, 93, 62, 49, 46, 48, 41,
- 32,104,115,118, 91, 48, 93, 45, 61, 49, 46, 48, 59, 32,101,108,115,101, 32,105,102, 40,104,115,118, 91, 48, 93, 60, 48, 46, 48,
- 41, 32,104,115,118, 91, 48, 93, 43, 61, 32, 49, 46, 48, 59, 10,  9,104,115,118, 91, 49, 93, 32, 42, 61, 32,115, 97,116, 59, 10,
-  9,105,102, 40,104,115,118, 91, 49, 93, 62, 49, 46, 48, 41, 32,104,115,118, 91, 49, 93, 61, 32, 49, 46, 48, 59, 32,101,108,115,
-101, 32,105,102, 40,104,115,118, 91, 49, 93, 60, 48, 46, 48, 41, 32,104,115,118, 91, 49, 93, 61, 32, 48, 46, 48, 59, 10,  9,104,
-115,118, 91, 50, 93, 32, 42, 61, 32,118, 97,108,117,101, 59, 10,  9,105,102, 40,104,115,118, 91, 50, 93, 62, 49, 46, 48, 41, 32,
-104,115,118, 91, 50, 93, 61, 32, 49, 46, 48, 59, 32,101,108,115,101, 32,105,102, 40,104,115,118, 91, 50, 93, 60, 48, 46, 48, 41,
- 32,104,115,118, 91, 50, 93, 61, 32, 48, 46, 48, 59, 10, 10,  9,104,115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32,
-111,117,116, 99,111,108, 41, 59, 10, 10,  9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 44, 32,111,117,116,
- 99,111,108, 44, 32,102, 97, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,112, 97,114, 97,116,101, 95,114,103, 98, 40,
-118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,114, 44, 32,111,117,116, 32,102,108,111, 97,116,
- 32,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, 98, 41, 10,123, 10,  9,114, 32, 61, 32, 99,111,108, 46,114, 59, 10,  9,
-103, 32, 61, 32, 99,111,108, 46,103, 59, 10,  9, 98, 32, 61, 32, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32, 99,
-111,109, 98,105,110,101, 95,114,103, 98, 40,102,108,111, 97,116, 32,114, 44, 32,102,108,111, 97,116, 32,103, 44, 32,102,108,111,
- 97,116, 32, 98, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 41, 10,123, 10,  9, 99,111,108, 32, 61, 32,118,101, 99,
- 52, 40,114, 44, 32,103, 44, 32, 98, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,111,117,116,112,117,116, 95,
-110,111,100,101, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,102,108,111, 97,116, 32, 97,108,112,104, 97, 44, 32,111,117,116, 32,
-118,101, 99, 52, 32,111,117,116,114,103, 98, 41, 10,123, 10,  9,111,117,116,114,103, 98, 32, 61, 32,118,101, 99, 52, 40,114,103,
- 98, 46,114,103, 98, 44, 32, 97,108,112,104, 97, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 84,
- 69, 88, 84, 85, 82, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100, 32,116,
-101,120,116,117,114,101, 95,102,108,105,112, 95, 98,108,101,110,100, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,
-118,101, 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10,  9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 46,121,120,122,
- 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95, 98,108,101,110,100, 95,108,105,110, 40,118,101, 99, 51,
- 32,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,
-108, 32, 61, 32, 40, 49, 46, 48, 43,118,101, 99, 46,120, 41, 47, 50, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,
-116,117,114,101, 95, 98,108,101,110,100, 95,113,117, 97,100, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,102,108,
-111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32,109, 97,120, 40, 40, 49, 46, 48,
- 43,118,101, 99, 46,120, 41, 47, 50, 46, 48, 44, 32, 48, 46, 48, 41, 59, 10,  9,111,117,116,118, 97,108, 32, 42, 61, 32,111,117,
-116,118, 97,108, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95,119,111,111,100, 95,115,105,110, 40,118,
-101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 97,108,117,101, 44, 32,111,117,116, 32,118,101,
- 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 41, 10,123, 10,  9,102,108,
-111, 97,116, 32, 97, 32, 61, 32,115,113,114,116, 40,118,101, 99, 46,120, 42,118,101, 99, 46,120, 32, 43, 32,118,101, 99, 46,121,
- 42,118,101, 99, 46,121, 32, 43, 32,118,101, 99, 46,122, 42,118,101, 99, 46,122, 41, 42, 50, 48, 46, 48, 59, 10,  9,102,108,111,
- 97,116, 32,119,105, 32, 61, 32, 48, 46, 53, 32, 43, 32, 48, 46, 53, 42,115,105,110, 40, 97, 41, 59, 10, 10,  9,118, 97,108,117,
-101, 32, 61, 32,119,105, 59, 10,  9, 99,111,108,111,114, 32, 61, 32,118,101, 99, 52, 40,119,105, 44, 32,119,105, 44, 32,119,105,
- 44, 32, 49, 46, 48, 41, 59, 10,  9,110,111,114,109, 97,108, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 44, 32, 48, 46, 48, 44,
- 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95,105,109, 97,103,101, 40,118,101, 99,
- 51, 32,118,101, 99, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,
-118, 97,108,117,101, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,
-110,111,114,109, 97,108, 41, 10,123, 10,  9, 99,111,108,111,114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97,
- 44, 32, 40,118,101, 99, 46,120,121, 32, 43, 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, 41, 42, 48, 46, 53, 41,
- 59, 10,  9,118, 97,108,117,101, 32, 61, 32, 49, 46, 48, 59, 10, 10,  9,110,111,114,109, 97,108, 46,120, 32, 61, 32, 50, 46, 48,
- 42, 40, 99,111,108,111,114, 46,114, 32, 45, 32, 48, 46, 53, 41, 59, 10,  9,110,111,114,109, 97,108, 46,121, 32, 61, 32, 50, 46,
- 48, 42, 40, 48, 46, 53, 32, 45, 32, 99,111,108,111,114, 46,103, 41, 59, 10,  9,110,111,114,109, 97,108, 46,122, 32, 61, 32, 50,
- 46, 48, 42, 40, 99,111,108,111,114, 46, 98, 32, 45, 32, 48, 46, 53, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42,
- 42, 42, 42, 42, 42, 32, 77, 84, 69, 88, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,
-111,105,100, 32,116,101,120, 99,111, 95,111,114, 99,111, 40,118,101, 99, 51, 32, 97,116,116,111,114, 99,111, 44, 32,111,117,116,
- 32,118,101, 99, 51, 32,111,114, 99,111, 41, 10,123, 10,  9,111,114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,111, 59, 10,125,
- 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,117,118, 40,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,111,117,116, 32,
-118,101, 99, 51, 32,117,118, 41, 10,123, 10,  9, 47, 42, 32,100,105,115, 97, 98,108,101,100, 32,102,111,114, 32,110,111,119, 44,
- 32,119,111,114,107,115, 32,116,111,103,101,116,104,101,114, 32,119,105,116,104, 32,108,101, 97,118,105,110,103, 32,111,117,116,
- 32,109,116,101,120, 95, 50,100, 95,109, 97,112,112,105,110,103, 10,  9, 32, 32, 32,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,
-116,116,117,118, 42, 50, 46, 48, 32, 45, 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, 44, 32, 48, 46, 48, 41, 59,
- 32, 42, 47, 10,  9,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,
-111,105,100, 32,116,101,120, 99,111, 95,110,111,114,109, 40,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,
-118,101, 99, 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10,123, 10,  9, 47, 42, 32, 99,111,114,114,101,115,112,111,110,100,
-115, 32,116,111, 32,115,104,105, 45, 62,111,114,110, 44, 32,119,104,105, 99,104, 32,105,115, 32,110,101,103, 97,116,101,100, 32,
-115,111, 32, 99, 97,110, 99,101,108,115, 10,  9, 32, 32, 32,111,117,116, 32, 98,108,101,110,100,101,114, 32,110,111,114,109, 97,
-108, 32,110,101,103, 97,116,105,111,110, 32, 42, 47, 10,  9,111,117,116,110,111,114,109, 97,108, 32, 61, 32,110,111,114,109, 97,
-108,105,122,101, 40,110,111,114,109, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,116, 97,110,103,
-101,110,116, 40,118,101, 99, 52, 32,116, 97,110,103,101,110,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,116, 97,
-110,103,101,110,116, 41, 10,123, 10,  9,111,117,116,116, 97,110,103,101,110,116, 32, 61, 32,110,111,114,109, 97,108,105,122,101,
- 40,116, 97,110,103,101,110,116, 46,120,121,122, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,103,108,111,
- 98, 97,108, 40,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, 44, 32,118,101, 99, 51, 32, 99,111, 44, 32,111,117,
-116, 32,118,101, 99, 51, 32,103,108,111, 98, 97,108, 41, 10,123, 10,  9,103,108,111, 98, 97,108, 32, 61, 32, 40,118,105,101,119,
-105,110,118,109, 97,116, 42,118,101, 99, 52, 40, 99,111, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10,125, 10, 10,118,111,
-105,100, 32,116,101,120, 99,111, 95,111, 98,106,101, 99,116, 40,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, 44,
- 32,109, 97,116, 52, 32,111, 98,105,110,118,109, 97,116, 44, 32,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99,
- 51, 32,111, 98,106,101, 99,116, 41, 10,123, 10,  9,111, 98,106,101, 99,116, 32, 61, 32, 40,111, 98,105,110,118,109, 97,116, 42,
- 40,118,105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40, 99,111, 44, 32, 49, 46, 48, 41, 41, 41, 46,120,121,122, 59,
- 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,114,101,102,108, 40,118,101, 99, 51, 32,118,110, 44, 32,118,101, 99,
- 51, 32,118,105,101,119, 44, 32,111,117,116, 32,118,101, 99, 51, 32,114,101,102, 41, 10,123, 10,  9,114,101,102, 32, 61, 32,118,
-105,101,119, 32, 45, 32, 50, 46, 48, 42,100,111,116, 40,118,110, 44, 32,118,105,101,119, 41, 42,118,110, 59, 10,125, 10, 10,118,
-111,105,100, 32,115,104, 97,100,101, 95,110,111,114,109, 40,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,
-118,101, 99, 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10,123, 10,  9, 47, 42, 32, 98,108,101,110,100,101,114, 32,114,101,
-110,100,101,114, 32,110,111,114,109, 97,108, 32,105,115, 32,110,101,103, 97,116,101,100, 32, 42, 47, 10,  9,111,117,116,110,111,
-114,109, 97,108, 32, 61, 32, 45,110,111,114,109, 97,108,105,122,101, 40,110,111,114,109, 97,108, 41, 59, 10,125, 10, 10,118,111,
-105,100, 32,109,116,101,120, 95,114,103, 98, 95, 98,108,101,110,100, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,
-101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97,
- 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10,  9,102,108,111, 97,116, 32,102, 97, 99,
-109, 59, 10, 10,  9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10,  9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102,
- 97, 99,116, 59, 10, 10,  9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,102, 97, 99,
-109, 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,109,117,108, 40,118,
-101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102,
- 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41,
- 10,123, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10,  9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10,
-  9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,103, 59, 10, 10,  9,105,110, 99,111,108, 32, 61, 32, 40,102, 97, 99,
-109, 32, 43, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 41, 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100,
- 32,109,116,101,120, 95,114,103, 98, 95,115, 99,114,101,101,110, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101,
- 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,
-103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109,
- 59, 10, 10,  9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10,  9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97,
- 99,103, 59, 10, 10,  9,105,110, 99,111,108, 32, 61, 32,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32, 40,118,101, 99, 51, 40,
-102, 97, 99,109, 41, 32, 43, 32,102, 97, 99,116, 42, 40,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32,116,101,120, 99,111,108,
- 41, 41, 42, 40,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100,
- 32,109,116,101,120, 95,114,103, 98, 95,111,118,101,114,108, 97,121, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,
-101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97,
- 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10,  9,102,108,111, 97,116, 32,102, 97, 99,
-109, 59, 10, 10,  9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10,  9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102,
- 97, 99,103, 59, 10, 10,  9,105,102, 40,111,117,116, 99,111,108, 46,114, 32, 60, 32, 48, 46, 53, 41, 10,  9,  9,105,110, 99,111,
-108, 46,114, 32, 61, 32,111,117,116, 99,111,108, 46,114, 42, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42,
-116,101,120, 99,111,108, 46,114, 41, 59, 10,  9,101,108,115,101, 10,  9,  9,105,110, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48,
- 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,
-108, 46,114, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114, 41, 59, 10, 10,  9,105,102, 40,111,117,116,
- 99,111,108, 46,103, 32, 60, 32, 48, 46, 53, 41, 10,  9,  9,105,110, 99,111,108, 46,103, 32, 61, 32,111,117,116, 99,111,108, 46,
-103, 42, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,103, 41, 59, 10,  9,101,
-108,115,101, 10,  9,  9,105,110, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46,
- 48, 42,102, 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,108, 46,103, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,
-111,117,116, 99,111,108, 46,103, 41, 59, 10, 10,  9,105,102, 40,111,117,116, 99,111,108, 46, 98, 32, 60, 32, 48, 46, 53, 41, 10,
-  9,  9,105,110, 99,111,108, 46, 98, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 42, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48,
- 42,102, 97, 99,116, 42,116,101,120, 99,111,108, 46, 98, 41, 59, 10,  9,101,108,115,101, 10,  9,  9,105,110, 99,111,108, 46, 98,
- 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42, 40, 49, 46, 48, 32, 45,
- 32,116,101,120, 99,111,108, 46, 98, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46, 98, 41, 59, 10,125, 10,
- 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115,117, 98, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,
-118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102,
- 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10,  9,105,110, 99,111,108, 32, 61, 32,
- 45,102, 97, 99,116, 42,102, 97, 99,103, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,
-111,105,100, 32,109,116,101,120, 95,114,103, 98, 95, 97,100,100, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101,
- 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,
-103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10,  9,105,110, 99,111,108, 32, 61, 32,102, 97,
- 99,116, 42,102, 97, 99,103, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100,
- 32,109,116,101,120, 95,114,103, 98, 95,100,105,118, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,
+  9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 49, 44, 32, 97, 98,115, 40, 99,111,108, 49, 32, 45, 32, 99,
+111,108, 50, 41, 44, 32,102, 97, 99, 41, 59, 10,  9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,
+125, 10, 10,118,111,105,100, 32,109,105,120, 95,100, 97,114,107, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52,
+ 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,
+108, 41, 10,123, 10,  9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41,
+ 59, 10,  9,111,117,116, 99,111,108, 46,114,103, 98, 32, 61, 32,109,105,110, 40, 99,111,108, 49, 46,114,103, 98, 44, 32, 99,111,
+108, 50, 46,114,103, 98, 42,102, 97, 99, 41, 59, 10,  9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59,
+ 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,108,105,103,104,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101,
+ 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,
+ 99,111,108, 41, 10,123, 10,  9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46,
+ 48, 41, 59, 10,  9,111,117,116, 99,111,108, 46,114,103, 98, 32, 61, 32,109, 97,120, 40, 99,111,108, 49, 46,114,103, 98, 44, 32,
+ 99,111,108, 50, 46,114,103, 98, 42,102, 97, 99, 41, 59, 10,  9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46,
+ 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,100,111,100,103,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,
+118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,
+117,116, 99,111,108, 41, 10,123, 10,  9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32,
+ 49, 46, 48, 41, 59, 10,  9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10,  9,105,102, 40,111,117,116, 99,111,
+108, 46,114, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10,  9,  9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, 49, 46, 48, 32,
+ 45, 32,102, 97, 99, 42, 99,111,108, 50, 46,114, 59, 10,  9,  9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10,  9,
+  9,  9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48, 59, 10,  9,  9,101,108,115,101, 32,105,102, 40, 40,116,109,112,
+ 32, 61, 32,111,117,116, 99,111,108, 46,114, 47,116,109,112, 41, 32, 62, 32, 49, 46, 48, 41, 10,  9,  9,  9,111,117,116, 99,111,
+108, 46,114, 32, 61, 32, 49, 46, 48, 59, 10,  9,  9,101,108,115,101, 10,  9,  9,  9,111,117,116, 99,111,108, 46,114, 32, 61, 32,
+116,109,112, 59, 10,  9,125, 10,  9,105,102, 40,111,117,116, 99,111,108, 46,103, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10,  9,
+  9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10,  9,
+  9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41, 10,  9,  9,  9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46,
+ 48, 59, 10,  9,  9,101,108,115,101, 32,105,102, 40, 40,116,109,112, 32, 61, 32,111,117,116, 99,111,108, 46,103, 47,116,109,112,
+ 41, 32, 62, 32, 49, 46, 48, 41, 10,  9,  9,  9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 59, 10,  9,  9,101,108,
+115,101, 10,  9,  9,  9,111,117,116, 99,111,108, 46,103, 32, 61, 32,116,109,112, 59, 10,  9,125, 10,  9,105,102, 40,111,117,116,
+ 99,111,108, 46, 98, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10,  9,  9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32, 49, 46,
+ 48, 32, 45, 32,102, 97, 99, 42, 99,111,108, 50, 46, 98, 59, 10,  9,  9,105,102, 40,116,109,112, 32, 60, 61, 32, 48, 46, 48, 41,
+ 10,  9,  9,  9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 59, 10,  9,  9,101,108,115,101, 32,105,102, 40, 40,116,
+109,112, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 47,116,109,112, 41, 32, 62, 32, 49, 46, 48, 41, 10,  9,  9,  9,111,117,116,
+ 99,111,108, 46, 98, 32, 61, 32, 49, 46, 48, 59, 10,  9,  9,101,108,115,101, 10,  9,  9,  9,111,117,116, 99,111,108, 46, 98, 32,
+ 61, 32,116,109,112, 59, 10,  9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95, 98,117,114,110, 40,102,108,111, 97,116,
+ 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,
+118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44,
+ 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,102,108,111, 97,116, 32,116,109,112, 44, 32,102, 97, 99,109, 32, 61, 32, 49,
+ 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10,  9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10,  9,116,109,112,
+ 32, 61, 32,102, 97, 99,109, 32, 43, 32,102, 97, 99, 42, 99,111,108, 50, 46,114, 59, 10,  9,105,102, 40,116,109,112, 32, 60, 61,
+ 32, 48, 46, 48, 41, 10,  9,  9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 48, 46, 48, 59, 10,  9,101,108,115,101, 32,105,102,
+ 40, 40,116,109,112, 32, 61, 32, 40, 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114, 41, 47,
+116,109,112, 41, 41, 32, 60, 32, 48, 46, 48, 41, 10,  9,  9,111,117,116, 99,111,108, 46,114, 32, 61, 32, 48, 46, 48, 59, 10,  9,
+101,108,115,101, 32,105,102, 40,116,109,112, 32, 62, 32, 49, 46, 48, 41, 10,  9,  9,111,117,116, 99,111,108, 46,114, 32, 61, 32,
+ 49, 46, 48, 59, 10,  9,101,108,115,101, 10,  9,  9,111,117,116, 99,111,108, 46,114, 32, 61, 32,116,109,112, 59, 10, 10,  9,116,
+109,112, 32, 61, 32,102, 97, 99,109, 32, 43, 32,102, 97, 99, 42, 99,111,108, 50, 46,103, 59, 10,  9,105,102, 40,116,109,112, 32,
+ 60, 61, 32, 48, 46, 48, 41, 10,  9,  9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 48, 46, 48, 59, 10,  9,101,108,115,101, 32,
+105,102, 40, 40,116,109,112, 32, 61, 32, 40, 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,103,
+ 41, 47,116,109,112, 41, 41, 32, 60, 32, 48, 46, 48, 41, 10,  9,  9,111,117,116, 99,111,108, 46,103, 32, 61, 32, 48, 46, 48, 59,
+ 10,  9,101,108,115,101, 32,105,102, 40,116,109,112, 32, 62, 32, 49, 46, 48, 41, 10,  9,  9,111,117,116, 99,111,108, 46,103, 32,
+ 61, 32, 49, 46, 48, 59, 10,  9,101,108,115,101, 10,  9,  9,111,117,116, 99,111,108, 46,103, 32, 61, 32,116,109,112, 59, 10, 10,
+  9,116,109,112, 32, 61, 32,102, 97, 99,109, 32, 43, 32,102, 97, 99, 42, 99,111,108, 50, 46, 98, 59, 10,  9,105,102, 40,116,109,
+112, 32, 60, 61, 32, 48, 46, 48, 41, 10,  9,  9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 48, 46, 48, 59, 10,  9,101,108,115,
+101, 32,105,102, 40, 40,116,109,112, 32, 61, 32, 40, 49, 46, 48, 32, 45, 32, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108,
+ 46, 98, 41, 47,116,109,112, 41, 41, 32, 60, 32, 48, 46, 48, 41, 10,  9,  9,111,117,116, 99,111,108, 46, 98, 32, 61, 32, 48, 46,
+ 48, 59, 10,  9,101,108,115,101, 32,105,102, 40,116,109,112, 32, 62, 32, 49, 46, 48, 41, 10,  9,  9,111,117,116, 99,111,108, 46,
+ 98, 32, 61, 32, 49, 46, 48, 59, 10,  9,101,108,115,101, 10,  9,  9,111,117,116, 99,111,108, 46, 98, 32, 61, 32,116,109,112, 59,
+ 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,104,117,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52,
+ 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,
+108, 41, 10,123, 10,  9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41,
+ 59, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10,  9,111,117,116,
+ 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10,  9,118,101, 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 44, 32,116,109,
+112, 59, 10,  9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10,  9,105,102,
+ 40,104,115,118, 50, 46,121, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10,  9,  9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,
+117,116, 99,111,108, 44, 32,104,115,118, 41, 59, 10,  9,  9,104,115,118, 46,120, 32, 61, 32,104,115,118, 50, 46,120, 59, 10,  9,
+  9,104,115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32,116,109,112, 41, 59, 32, 10, 10,  9,  9,111,117,116, 99,111,
+108, 32, 61, 32,109,105,120, 40,111,117,116, 99,111,108, 44, 32,116,109,112, 44, 32,102, 97, 99, 41, 59, 10,  9,  9,111,117,116,
+ 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,  9,125, 10,125, 10, 10,118,111,105,100, 32,109,105,120, 95,115,
+ 97,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,
+108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,102, 97, 99, 32, 61, 32, 99,108,
+ 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 32,
+ 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10,  9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10,  9,
+118,101, 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 59, 10,  9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,117,116, 99,
+111,108, 44, 32,104,115,118, 41, 59, 10, 10,  9,105,102, 40,104,115,118, 46,121, 32, 33, 61, 32, 48, 46, 48, 41, 32,123, 10,  9,
+  9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10,  9,  9,104,115,118, 46,
+121, 32, 61, 32,102, 97, 99,109, 42,104,115,118, 46,121, 32, 43, 32,102, 97, 99, 42,104,115,118, 50, 46,121, 59, 10,  9,  9,104,
+115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32,111,117,116, 99,111,108, 41, 59, 10,  9,125, 10,125, 10, 10,118,111,
+105,100, 32,109,105,120, 95,118, 97,108, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44,
+ 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,
+102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,102,108,111,
+ 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10,  9,118,101, 99, 52, 32,104,115,118, 44,
+ 32,104,115,118, 50, 59, 10,  9,114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 49, 44, 32,104,115,118, 41, 59, 10,  9,
+114,103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10,  9,104,115,118, 46,122, 32,
+ 61, 32,102, 97, 99,109, 42,104,115,118, 46,122, 32, 43, 32,102, 97, 99, 42,104,115,118, 50, 46,122, 59, 10,  9,104,115,118, 95,
+116,111, 95,114,103, 98, 40,104,115,118, 44, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,105,120,
+ 95, 99,111,108,111,114, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99,
+ 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,102, 97, 99, 32,
+ 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,102,108,111, 97,116, 32,102,
+ 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10,  9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49,
+ 59, 10, 10,  9,118,101, 99, 52, 32,104,115,118, 44, 32,104,115,118, 50, 44, 32,116,109,112, 59, 10,  9,114,103, 98, 95,116,111,
+ 95,104,115,118, 40, 99,111,108, 50, 44, 32,104,115,118, 50, 41, 59, 10, 10,  9,105,102, 40,104,115,118, 50, 46,121, 32, 33, 61,
+ 32, 48, 46, 48, 41, 32,123, 10,  9,  9,114,103, 98, 95,116,111, 95,104,115,118, 40,111,117,116, 99,111,108, 44, 32,104,115,118,
+ 41, 59, 10,  9,  9,104,115,118, 46,120, 32, 61, 32,104,115,118, 50, 46,120, 59, 10,  9,  9,104,115,118, 46,121, 32, 61, 32,104,
+115,118, 50, 46,121, 59, 10,  9,  9,104,115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32,116,109,112, 41, 59, 32, 10,
+ 10,  9,  9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40,111,117,116, 99,111,108, 44, 32,116,109,112, 44, 32,102, 97, 99,
+ 41, 59, 10,  9,  9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 49, 46, 97, 59, 10,  9,125, 10,125, 10, 10,118,111,
+105,100, 32,109,105,120, 95,115,111,102,116, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49,
+ 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,
+  9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,102,108,
+111, 97,116, 32,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99, 59, 10, 10,  9,118,101, 99, 52, 32,111,110,101,
+ 61, 32,118,101, 99, 52, 40, 49, 46, 48, 41, 59, 10,  9,118,101, 99, 52, 32,115, 99,114, 61, 32,111,110,101, 32, 45, 32, 40,111,
+110,101, 32, 45, 32, 99,111,108, 50, 41, 42, 40,111,110,101, 32, 45, 32, 99,111,108, 49, 41, 59, 10,  9,111,117,116, 99,111,108,
+ 32, 61, 32,102, 97, 99,109, 42, 99,111,108, 49, 32, 43, 32,102, 97, 99, 42, 40, 40,111,110,101, 32, 45, 32, 99,111,108, 49, 41,
+ 42, 99,111,108, 50, 42, 99,111,108, 49, 32, 43, 32, 99,111,108, 49, 42,115, 99,114, 41, 59, 10,125, 10, 10,118,111,105,100, 32,
+109,105,120, 95,108,105,110,101, 97,114, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44,
+ 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,
+102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10, 10,  9,111,117,
+116, 99,111,108, 32, 61, 32, 99,111,108, 49, 59, 10, 10,  9,105,102, 40, 99,111,108, 50, 46,114, 32, 62, 32, 48, 46, 53, 41, 10,
+  9,  9,111,117,116, 99,111,108, 46,114, 61, 32, 99,111,108, 49, 46,114, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,
+111,108, 50, 46,114, 32, 45, 32, 48, 46, 53, 41, 41, 59, 10,  9,101,108,115,101, 10,  9,  9,111,117,116, 99,111,108, 46,114, 61,
+ 32, 99,111,108, 49, 46,114, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,114, 41, 32, 45, 32, 49, 46,
+ 48, 41, 59, 10, 10,  9,105,102, 40, 99,111,108, 50, 46,103, 32, 62, 32, 48, 46, 53, 41, 10,  9,  9,111,117,116, 99,111,108, 46,
+103, 61, 32, 99,111,108, 49, 46,103, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,103, 32, 45, 32, 48,
+ 46, 53, 41, 41, 59, 10,  9,101,108,115,101, 10,  9,  9,111,117,116, 99,111,108, 46,103, 61, 32, 99,111,108, 49, 46,103, 32, 43,
+ 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46,103, 41, 32, 45, 32, 49, 46, 48, 41, 59, 10, 10,  9,105,102, 40,
+ 99,111,108, 50, 46, 98, 32, 62, 32, 48, 46, 53, 41, 10,  9,  9,111,117,116, 99,111,108, 46, 98, 61, 32, 99,111,108, 49, 46, 98,
+ 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48, 42, 40, 99,111,108, 50, 46, 98, 32, 45, 32, 48, 46, 53, 41, 41, 59, 10,  9,101,108,
+115,101, 10,  9,  9,111,117,116, 99,111,108, 46, 98, 61, 32, 99,111,108, 49, 46, 98, 32, 43, 32,102, 97, 99, 42, 40, 50, 46, 48,
+ 42, 40, 99,111,108, 50, 46, 98, 41, 32, 45, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118, 97,108,116,111,114,
+103, 98, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32, 99,111,108,111,114,109, 97,112,
+ 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,
+ 97,108,112,104, 97, 41, 10,123, 10,  9,111,117,116, 99,111,108, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,111,108,
+111,114,109, 97,112, 44, 32,118,101, 99, 50, 40,102, 97, 99, 44, 32, 48, 46, 48, 41, 41, 59, 10,  9,111,117,116, 97,108,112,104,
+ 97, 32, 61, 32,111,117,116, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,114,103, 98,116,111, 98,119, 40,118,101,
+ 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 32, 32, 10,123, 10,
+  9,111,117,116,118, 97,108, 32, 61, 32, 99,111,108,111,114, 46,114, 42, 48, 46, 51, 53, 32, 43, 32, 99,111,108,111,114, 46,103,
+ 42, 48, 46, 52, 53, 32, 43, 32, 99,111,108,111,114, 46, 98, 42, 48, 46, 50, 59, 32, 47, 42, 32,107,101,101,112, 32,116,104,101,
+115,101, 32,102, 97, 99,116,111,114,115, 32,105,110, 32,115,121,110, 99, 32,119,105,116,104, 32,116,101,120,116,117,114,101, 46,
+104, 58, 82, 71, 66, 84, 79, 66, 87, 32, 42, 47, 10,125, 10, 10,118,111,105,100, 32,105,110,118,101,114,116, 40,102,108,111, 97,
+116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108,
+ 41, 10,123, 10,  9,111,117,116, 99,111,108, 46,120,121,122, 32, 61, 32,109,105,120, 40, 99,111,108, 46,120,121,122, 44, 32,118,
+101, 99, 51, 40, 49, 46, 48, 44, 32, 49, 46, 48, 44, 32, 49, 46, 48, 41, 32, 45, 32, 99,111,108, 46,120,121,122, 44, 32,102, 97,
+ 99, 41, 59, 10,  9,111,117,116, 99,111,108, 46,119, 32, 61, 32, 99,111,108, 46,119, 59, 10,125, 10, 10,118,111,105,100, 32,104,
+117,101, 95,115, 97,116, 40,102,108,111, 97,116, 32,104,117,101, 44, 32,102,108,111, 97,116, 32,115, 97,116, 44, 32,102,108,111,
+ 97,116, 32,118, 97,108,117,101, 44, 32,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,111,
+117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,118,101, 99, 52, 32,104,115,118, 59, 10, 10,  9,114,
+103, 98, 95,116,111, 95,104,115,118, 40, 99,111,108, 44, 32,104,115,118, 41, 59, 10, 10,  9,104,115,118, 91, 48, 93, 32, 43, 61,
+ 32, 40,104,117,101, 32, 45, 32, 48, 46, 53, 41, 59, 10,  9,105,102, 40,104,115,118, 91, 48, 93, 62, 49, 46, 48, 41, 32,104,115,
+118, 91, 48, 93, 45, 61, 49, 46, 48, 59, 32,101,108,115,101, 32,105,102, 40,104,115,118, 91, 48, 93, 60, 48, 46, 48, 41, 32,104,
+115,118, 91, 48, 93, 43, 61, 32, 49, 46, 48, 59, 10,  9,104,115,118, 91, 49, 93, 32, 42, 61, 32,115, 97,116, 59, 10,  9,105,102,
+ 40,104,115,118, 91, 49, 93, 62, 49, 46, 48, 41, 32,104,115,118, 91, 49, 93, 61, 32, 49, 46, 48, 59, 32,101,108,115,101, 32,105,
+102, 40,104,115,118, 91, 49, 93, 60, 48, 46, 48, 41, 32,104,115,118, 91, 49, 93, 61, 32, 48, 46, 48, 59, 10,  9,104,115,118, 91,
+ 50, 93, 32, 42, 61, 32,118, 97,108,117,101, 59, 10,  9,105,102, 40,104,115,118, 91, 50, 93, 62, 49, 46, 48, 41, 32,104,115,118,
+ 91, 50, 93, 61, 32, 49, 46, 48, 59, 32,101,108,115,101, 32,105,102, 40,104,115,118, 91, 50, 93, 60, 48, 46, 48, 41, 32,104,115,
+118, 91, 50, 93, 61, 32, 48, 46, 48, 59, 10, 10,  9,104,115,118, 95,116,111, 95,114,103, 98, 40,104,115,118, 44, 32,111,117,116,
+ 99,111,108, 41, 59, 10, 10,  9,111,117,116, 99,111,108, 32, 61, 32,109,105,120, 40, 99,111,108, 44, 32,111,117,116, 99,111,108,
+ 44, 32,102, 97, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,112, 97,114, 97,116,101, 95,114,103, 98, 40,118,101, 99,
+ 52, 32, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,103, 44,
+ 32,111,117,116, 32,102,108,111, 97,116, 32, 98, 41, 10,123, 10,  9,114, 32, 61, 32, 99,111,108, 46,114, 59, 10,  9,103, 32, 61,
+ 32, 99,111,108, 46,103, 59, 10,  9, 98, 32, 61, 32, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32, 99,111,109, 98,
+105,110,101, 95,114,103, 98, 40,102,108,111, 97,116, 32,114, 44, 32,102,108,111, 97,116, 32,103, 44, 32,102,108,111, 97,116, 32,
+ 98, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 41, 10,123, 10,  9, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,114,
+ 44, 32,103, 44, 32, 98, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,111,117,116,112,117,116, 95,110,111,100,
+101, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,102,108,111, 97,116, 32, 97,108,112,104, 97, 44, 32,111,117,116, 32,118,101, 99,
+ 52, 32,111,117,116,114,103, 98, 41, 10,123, 10,  9,111,117,116,114,103, 98, 32, 61, 32,118,101, 99, 52, 40,114,103, 98, 46,114,
+103, 98, 44, 32, 97,108,112,104, 97, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 84, 69, 88, 84,
+ 85, 82, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100, 32,116,101,120,116,
+117,114,101, 95,102,108,105,112, 95, 98,108,101,110,100, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,118,101, 99,
+ 51, 32,111,117,116,118,101, 99, 41, 10,123, 10,  9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 46,121,120,122, 59, 10,125,
+ 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95, 98,108,101,110,100, 95,108,105,110, 40,118,101, 99, 51, 32,118,101,
+ 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61,
+ 32, 40, 49, 46, 48, 43,118,101, 99, 46,120, 41, 47, 50, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,
+101, 95, 98,108,101,110,100, 95,113,117, 97,100, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116,
+ 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32,109, 97,120, 40, 40, 49, 46, 48, 43,118,101,
+ 99, 46,120, 41, 47, 50, 46, 48, 44, 32, 48, 46, 48, 41, 59, 10,  9,111,117,116,118, 97,108, 32, 42, 61, 32,111,117,116,118, 97,
+108, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95,119,111,111,100, 95,115,105,110, 40,118,101, 99, 51,
+ 32,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 97,108,117,101, 44, 32,111,117,116, 32,118,101, 99, 52, 32,
+ 99,111,108,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 41, 10,123, 10,  9,102,108,111, 97,116,
+ 32, 97, 32, 61, 32,115,113,114,116, 40,118,101, 99, 46,120, 42,118,101, 99, 46,120, 32, 43, 32,118,101, 99, 46,121, 42,118,101,
+ 99, 46,121, 32, 43, 32,118,101, 99, 46,122, 42,118,101, 99, 46,122, 41, 42, 50, 48, 46, 48, 59, 10,  9,102,108,111, 97,116, 32,
+119,105, 32, 61, 32, 48, 46, 53, 32, 43, 32, 48, 46, 53, 42,115,105,110, 40, 97, 41, 59, 10, 10,  9,118, 97,108,117,101, 32, 61,
+ 32,119,105, 59, 10,  9, 99,111,108,111,114, 32, 61, 32,118,101, 99, 52, 40,119,105, 44, 32,119,105, 44, 32,119,105, 44, 32, 49,
+ 46, 48, 41, 59, 10,  9,110,111,114,109, 97,108, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 44, 32, 48, 46, 48, 44, 32, 48, 46,
+ 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120,116,117,114,101, 95,105,109, 97,103,101, 40,118,101, 99, 51, 32,118,
+101, 99, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 97,108,
+117,101, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,
+109, 97,108, 41, 10,123, 10,  9, 99,111,108,111,114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 40,
+118,101, 99, 46,120,121, 32, 43, 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, 41, 42, 48, 46, 53, 41, 59, 10,  9,
+118, 97,108,117,101, 32, 61, 32, 49, 46, 48, 59, 10, 10,  9,110,111,114,109, 97,108, 46,120, 32, 61, 32, 50, 46, 48, 42, 40, 99,
+111,108,111,114, 46,114, 32, 45, 32, 48, 46, 53, 41, 59, 10,  9,110,111,114,109, 97,108, 46,121, 32, 61, 32, 50, 46, 48, 42, 40,
+ 48, 46, 53, 32, 45, 32, 99,111,108,111,114, 46,103, 41, 59, 10,  9,110,111,114,109, 97,108, 46,122, 32, 61, 32, 50, 46, 48, 42,
+ 40, 99,111,108,111,114, 46, 98, 32, 45, 32, 48, 46, 53, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
+ 42, 42, 32, 77, 84, 69, 88, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100,
+ 32,116,101,120, 99,111, 95,111,114, 99,111, 40,118,101, 99, 51, 32, 97,116,116,111,114, 99,111, 44, 32,111,117,116, 32,118,101,
+ 99, 51, 32,111,114, 99,111, 41, 10,123, 10,  9,111,114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,111, 59, 10,125, 10, 10,118,
+111,105,100, 32,116,101,120, 99,111, 95,117,118, 40,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,111,117,116, 32,118,101, 99,
+ 51, 32,117,118, 41, 10,123, 10,  9, 47, 42, 32,100,105,115, 97, 98,108,101,100, 32,102,111,114, 32,110,111,119, 44, 32,119,111,
+114,107,115, 32,116,111,103,101,116,104,101,114, 32,119,105,116,104, 32,108,101, 97,118,105,110,103, 32,111,117,116, 32,109,116,
+101,120, 95, 50,100, 95,109, 97,112,112,105,110,103, 10,  9, 32, 32, 32,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,
+118, 42, 50, 46, 48, 32, 45, 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, 44, 32, 48, 46, 48, 41, 59, 32, 42, 47,
+ 10,  9,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100,
+ 32,116,101,120, 99,111, 95,110,111,114,109, 40,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99,
+ 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10,123, 10,  9, 47, 42, 32, 99,111,114,114,101,115,112,111,110,100,115, 32,116,
+111, 32,115,104,105, 45, 62,111,114,110, 44, 32,119,104,105, 99,104, 32,105,115, 32,110,101,103, 97,116,101,100, 32,115,111, 32,
+ 99, 97,110, 99,101,108,115, 10,  9, 32, 32, 32,111,117,116, 32, 98,108,101,110,100,101,114, 32,110,111,114,109, 97,108, 32,110,
+101,103, 97,116,105,111,110, 32, 42, 47, 10,  9,111,117,116,110,111,114,109, 97,108, 32, 61, 32,110,111,114,109, 97,108,105,122,
+101, 40,110,111,114,109, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,116, 97,110,103,101,110,116,
+ 40,118,101, 99, 52, 32,116, 97,110,103,101,110,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,116, 97,110,103,101,
+110,116, 41, 10,123, 10,  9,111,117,116,116, 97,110,103,101,110,116, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,116, 97,
+110,103,101,110,116, 46,120,121,122, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,120, 99,111, 95,103,108,111, 98, 97,108,
+ 40,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, 44, 32,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,
+101, 99, 51, 32,103,108,111, 98, 97,108, 41, 10,123, 10,  9,103,108,111, 98, 97,108, 32, 61, 32, 40,118,105,101,119,105,110,118,
+109, 97,116, 42,118,101, 99, 52, 40, 99,111, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10,125, 10, 10,118,111,105,100, 32,
+116,101,120, 99,111, 95,111, 98,106,101, 99,116, 40,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, 44, 32,109, 97,
+116, 52, 32,111, 98,105,110,118,109, 97,116, 44, 32,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,
+ 98,106,101, 99,116, 41, 10,123, 10,  9,111, 98,106,101, 99,116, 32, 61, 32, 40,111, 98,105,110,118,109, 97,116, 42, 40,118,105,
+101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40, 99,111, 44, 32, 49, 46, 48, 41, 41, 41, 46,120,121,122, 59, 10,125, 10,
+ 10,118,111,105,100, 32,116,101,120, 99,111, 95,114,101,102,108, 40,118,101, 99, 51, 32,118,110, 44, 32,118,101, 99, 51, 32,118,
+105,101,119, 44, 32,111,117,116, 32,118,101, 99, 51, 32,114,101,102, 41, 10,123, 10,  9,114,101,102, 32, 61, 32,118,105,101,119,
+ 32, 45, 32, 50, 46, 48, 42,100,111,116, 40,118,110, 44, 32,118,105,101,119, 41, 42,118,110, 59, 10,125, 10, 10,118,111,105,100,
+ 32,115,104, 97,100,101, 95,110,111,114,109, 40,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99,
+ 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10,123, 10,  9, 47, 42, 32, 98,108,101,110,100,101,114, 32,114,101,110,100,101,
+114, 32,110,111,114,109, 97,108, 32,105,115, 32,110,101,103, 97,116,101,100, 32, 42, 47, 10,  9,111,117,116,110,111,114,109, 97,
+108, 32, 61, 32, 45,110,111,114,109, 97,108,105,122,101, 40,110,111,114,109, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,
+109,116,101,120, 95,114,103, 98, 95, 98,108,101,110,100, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51,
+ 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44,
+ 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10,
+ 10,  9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10,  9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116,
+ 59, 10, 10,  9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,102, 97, 99,109, 42,111,
+117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,109,117,108, 40,118,101, 99, 51,
+ 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116,
+ 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10,
+  9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10,  9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10,  9,102, 97,
+ 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,103, 59, 10, 10,  9,105,110, 99,111,108, 32, 61, 32, 40,102, 97, 99,109, 32, 43,
+ 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 41, 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,
+101,120, 95,114,103, 98, 95,115, 99,114,101,101,110, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,
 116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,
 111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10,
-  9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10,  9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59,
- 10, 10,  9,105,102, 40,116,101,120, 99,111,108, 46,114, 32, 33, 61, 32, 48, 46, 48, 41, 32,105,110, 99,111,108, 46,114, 32, 61,
- 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,114, 32, 43, 32,102, 97, 99,116, 42,111,117,116, 99,111,108, 46,114, 47,116,
-101,120, 99,111,108, 46,114, 59, 10,  9,105,102, 40,116,101,120, 99,111,108, 46,103, 32, 33, 61, 32, 48, 46, 48, 41, 32,105,110,
- 99,111,108, 46,103, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,103, 32, 43, 32,102, 97, 99,116, 42,111,117,116,
- 99,111,108, 46,103, 47,116,101,120, 99,111,108, 46,103, 59, 10,  9,105,102, 40,116,101,120, 99,111,108, 46, 98, 32, 33, 61, 32,
- 48, 46, 48, 41, 32,105,110, 99,111,108, 46, 98, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46, 98, 32, 43, 32,102,
- 97, 99,116, 42,111,117,116, 99,111,108, 46, 98, 47,116,101,120, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,
-116,101,120, 95,114,103, 98, 95,100,105,102,102, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,
-101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,
-117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10,  9,
-102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10,  9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10,
- 10,  9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 32, 43, 32,102, 97, 99,116, 42, 97, 98,115,
- 40,116,101,120, 99,111,108, 32, 45, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,
-114,103, 98, 95,100, 97,114,107, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,
-108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,
-101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 44, 32, 99,111,108, 59, 10, 10,
-  9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10,  9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59,
- 10, 10,  9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,114, 59, 10,  9,105,102, 40, 99,111,108, 32,
- 60, 32,111,117,116, 99,111,108, 46,114, 41, 32,105,110, 99,111,108, 46,114, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,
-105,110, 99,111,108, 46,114, 32, 61, 32,111,117,116, 99,111,108, 46,114, 59, 10,  9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,
-116,101,120, 99,111,108, 46,103, 59, 10,  9,105,102, 40, 99,111,108, 32, 60, 32,111,117,116, 99,111,108, 46,103, 41, 32,105,110,
- 99,111,108, 46,103, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46,103, 32, 61, 32,111,117,116, 99,
-111,108, 46,103, 59, 10,  9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46, 98, 59, 10,  9,105,102, 40,
- 99,111,108, 32, 60, 32,111,117,116, 99,111,108, 46, 98, 41, 32,105,110, 99,111,108, 46, 98, 32, 61, 32, 99,111,108, 59, 32,101,
-108,115,101, 32,105,110, 99,111,108, 46, 98, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32,
-109,116,101,120, 95,114,103, 98, 95,108,105,103,104,116, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51,
+  9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10,  9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,103, 59,
+ 10, 10,  9,105,110, 99,111,108, 32, 61, 32,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32, 40,118,101, 99, 51, 40,102, 97, 99,
+109, 41, 32, 43, 32,102, 97, 99,116, 42, 40,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32,116,101,120, 99,111,108, 41, 41, 42,
+ 40,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,
+101,120, 95,114,103, 98, 95,111,118,101,114,108, 97,121, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51,
  32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44,
- 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 44, 32,
- 99,111,108, 59, 10, 10,  9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10,  9,102, 97, 99,109, 32, 61, 32, 49, 46, 48,
- 45,102, 97, 99,116, 59, 10, 10,  9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,114, 59, 10,  9,105,
-102, 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108, 46,114, 41, 32,105,110, 99,111,108, 46,114, 32, 61, 32, 99,111,108, 59,
- 32,101,108,115,101, 32,105,110, 99,111,108, 46,114, 32, 61, 32,111,117,116, 99,111,108, 46,114, 59, 10,  9, 99,111,108, 32, 61,
- 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,103, 59, 10,  9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108,
- 46,103, 41, 32,105,110, 99,111,108, 46,103, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46,103, 32,
- 61, 32,111,117,116, 99,111,108, 46,103, 59, 10,  9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46, 98,
- 59, 10,  9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108, 46, 98, 41, 32,105,110, 99,111,108, 46, 98, 32, 61, 32,
- 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46, 98, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 59, 10,125, 10,
- 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,104,117,101, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,
-118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102,
- 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10,  9,118,101, 99, 52, 32, 99,111,108,
- 59, 10, 10,  9,109,105,120, 95,104,117,101, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,
-111,108, 44, 32, 49, 46, 48, 41, 44, 32,118,101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108,
- 41, 59, 10,  9,105,110, 99,111,108, 46,114,103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100,
- 32,109,116,101,120, 95,114,103, 98, 95,115, 97,116, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,
+ 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10,
+ 10,  9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10,  9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,103,
+ 59, 10, 10,  9,105,102, 40,111,117,116, 99,111,108, 46,114, 32, 60, 32, 48, 46, 53, 41, 10,  9,  9,105,110, 99,111,108, 46,114,
+ 32, 61, 32,111,117,116, 99,111,108, 46,114, 42, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42,116,101,120,
+ 99,111,108, 46,114, 41, 59, 10,  9,101,108,115,101, 10,  9,  9,105,110, 99,111,108, 46,114, 32, 61, 32, 49, 46, 48, 32, 45, 32,
+ 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,108, 46,114,
+ 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46,114, 41, 59, 10, 10,  9,105,102, 40,111,117,116, 99,111,108,
+ 46,103, 32, 60, 32, 48, 46, 53, 41, 10,  9,  9,105,110, 99,111,108, 46,103, 32, 61, 32,111,117,116, 99,111,108, 46,103, 42, 40,
+102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,103, 41, 59, 10,  9,101,108,115,101,
+ 10,  9,  9,105,110, 99,111,108, 46,103, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102,
+ 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,108, 46,103, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116,
+ 99,111,108, 46,103, 41, 59, 10, 10,  9,105,102, 40,111,117,116, 99,111,108, 46, 98, 32, 60, 32, 48, 46, 53, 41, 10,  9,  9,105,
+110, 99,111,108, 46, 98, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 42, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97,
+ 99,116, 42,116,101,120, 99,111,108, 46, 98, 41, 59, 10,  9,101,108,115,101, 10,  9,  9,105,110, 99,111,108, 46, 98, 32, 61, 32,
+ 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32, 50, 46, 48, 42,102, 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,
+120, 99,111,108, 46, 98, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108, 46, 98, 41, 59, 10,125, 10, 10,118,111,
+105,100, 32,109,116,101,120, 95,114,103, 98, 95,115,117, 98, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99,
+ 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103,
+ 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10,  9,105,110, 99,111,108, 32, 61, 32, 45,102, 97,
+ 99,116, 42,102, 97, 99,103, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100,
+ 32,109,116,101,120, 95,114,103, 98, 95, 97,100,100, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,
 116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,
-111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10,  9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10,  9,109,
-105,120, 95,115, 97,116, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44, 32, 49,
- 46, 48, 41, 44, 32,118,101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10,  9,105,
-110, 99,111,108, 46,114,103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120,
- 95,114,103, 98, 95,118, 97,108, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,
-108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,
-101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10,  9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10,  9,109,105,120, 95,118, 97,
-108, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32,
-118,101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10,  9,105,110, 99,111,108, 46,
-114,103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,
- 99,111,108,111,114, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,
+111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10,  9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,
+102, 97, 99,103, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,
+101,120, 95,114,103, 98, 95,100,105,118, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120,
+ 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116,
+ 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10,  9,102, 97,
+ 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10,  9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10,  9,
+105,102, 40,116,101,120, 99,111,108, 46,114, 32, 33, 61, 32, 48, 46, 48, 41, 32,105,110, 99,111,108, 46,114, 32, 61, 32,102, 97,
+ 99,109, 42,111,117,116, 99,111,108, 46,114, 32, 43, 32,102, 97, 99,116, 42,111,117,116, 99,111,108, 46,114, 47,116,101,120, 99,
+111,108, 46,114, 59, 10,  9,105,102, 40,116,101,120, 99,111,108, 46,103, 32, 33, 61, 32, 48, 46, 48, 41, 32,105,110, 99,111,108,
+ 46,103, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46,103, 32, 43, 32,102, 97, 99,116, 42,111,117,116, 99,111,108,
+ 46,103, 47,116,101,120, 99,111,108, 46,103, 59, 10,  9,105,102, 40,116,101,120, 99,111,108, 46, 98, 32, 33, 61, 32, 48, 46, 48,
+ 41, 32,105,110, 99,111,108, 46, 98, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 46, 98, 32, 43, 32,102, 97, 99,116,
+ 42,111,117,116, 99,111,108, 46, 98, 47,116,101,120, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120,
+ 95,114,103, 98, 95,100,105,102,102, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,
+111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,
+118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10, 10,  9,102, 97, 99,
+116, 32, 42, 61, 32,102, 97, 99,103, 59, 10,  9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10,  9,105,
+110, 99,111,108, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 32, 43, 32,102, 97, 99,116, 42, 97, 98,115, 40,116,101,
+120, 99,111,108, 32, 45, 32,111,117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98,
+ 95,100, 97,114,107, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,
 102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51,
- 32,105,110, 99,111,108, 41, 10,123, 10,  9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10,  9,109,105,120, 95, 99,111,108,111,114,
- 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32,118,
-101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10,  9,105,110, 99,111,108, 46,114,
-103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101,
- 95,118, 97,114,115, 40,105,110,111,117,116, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97,
- 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 97, 99,109, 41, 10,123, 10,  9,102, 97, 99,116, 32, 42, 61, 32, 97,
- 98,115, 40,102, 97, 99,103, 41, 59, 10,  9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10,  9,105,102,
- 40,102, 97, 99,103, 32, 60, 32, 48, 46, 48, 41, 32,123, 10,  9,  9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32,102, 97, 99,
-116, 59, 10,  9,  9,102, 97, 99,116, 32, 61, 32,102, 97, 99,109, 59, 10,  9,  9,102, 97, 99,109, 32, 61, 32,116,109,112, 59, 10,
-  9,125, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 98,108,101,110,100, 40,102,108,111, 97,
-116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97,
- 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41,
- 10,123, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10,  9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115,
- 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10,  9,105,110, 99,111,108, 32, 61, 32,102, 97,
- 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100,
- 32,109,116,101,120, 95,118, 97,108,117,101, 95,109,117,108, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,
-111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97,
- 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10,  9,102,108,111, 97,116, 32,102, 97,
- 99,109, 59, 10,  9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44,
- 32,102, 97, 99,109, 41, 59, 10, 10,  9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99,103, 59, 10,  9,105,110,
- 99,111,108, 32, 61, 32, 40,102, 97, 99,109, 32, 43, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 41, 42,111,117,116, 99,111,
-108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,115, 99,114,101,101,110, 40,102,108,111,
- 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102,
- 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108,
- 41, 10,123, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10,  9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,
-115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10,  9,102, 97, 99,109, 32, 61, 32, 49, 46,
- 48, 32, 45, 32,102, 97, 99,103, 59, 10,  9,105,110, 99,111,108, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43,
- 32,102, 97, 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,108, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116,
- 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,115,117, 98, 40,102,108,111,
- 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102,
- 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108,
- 41, 10,123, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10,  9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,
-115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10,  9,102, 97, 99,116, 32, 61, 32, 45,102,
- 97, 99,116, 59, 10,  9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,
-111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 97,100,100, 40,102,108,111, 97,116,
- 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,
-116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,
-123, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10,  9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,
-102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10,  9,102, 97, 99,116, 32, 61, 32,102, 97, 99,116,
+ 32,105,110, 99,111,108, 41, 10,123, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 44, 32, 99,111,108, 59, 10, 10,  9,102, 97,
+ 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10,  9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10,  9,
+ 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,114, 59, 10,  9,105,102, 40, 99,111,108, 32, 60, 32,111,
+117,116, 99,111,108, 46,114, 41, 32,105,110, 99,111,108, 46,114, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,
+111,108, 46,114, 32, 61, 32,111,117,116, 99,111,108, 46,114, 59, 10,  9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120,
+ 99,111,108, 46,103, 59, 10,  9,105,102, 40, 99,111,108, 32, 60, 32,111,117,116, 99,111,108, 46,103, 41, 32,105,110, 99,111,108,
+ 46,103, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46,103, 32, 61, 32,111,117,116, 99,111,108, 46,
+103, 59, 10,  9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46, 98, 59, 10,  9,105,102, 40, 99,111,108,
+ 32, 60, 32,111,117,116, 99,111,108, 46, 98, 41, 32,105,110, 99,111,108, 46, 98, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101,
+ 32,105,110, 99,111,108, 46, 98, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,
+120, 95,114,103, 98, 95,108,105,103,104,116, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,
+120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,
+116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 44, 32, 99,111,108,
+ 59, 10, 10,  9,102, 97, 99,116, 32, 42, 61, 32,102, 97, 99,103, 59, 10,  9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97,
+ 99,116, 59, 10, 10,  9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46,114, 59, 10,  9,105,102, 40, 99,
+111,108, 32, 62, 32,111,117,116, 99,111,108, 46,114, 41, 32,105,110, 99,111,108, 46,114, 32, 61, 32, 99,111,108, 59, 32,101,108,
+115,101, 32,105,110, 99,111,108, 46,114, 32, 61, 32,111,117,116, 99,111,108, 46,114, 59, 10,  9, 99,111,108, 32, 61, 32,102, 97,
+ 99,116, 42,116,101,120, 99,111,108, 46,103, 59, 10,  9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108, 46,103, 41,
+ 32,105,110, 99,111,108, 46,103, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46,103, 32, 61, 32,111,
+117,116, 99,111,108, 46,103, 59, 10,  9, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 46, 98, 59, 10,  9,
+105,102, 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108, 46, 98, 41, 32,105,110, 99,111,108, 46, 98, 32, 61, 32, 99,111,108,
+ 59, 32,101,108,115,101, 32,105,110, 99,111,108, 46, 98, 32, 61, 32,111,117,116, 99,111,108, 46, 98, 59, 10,125, 10, 10,118,111,
+105,100, 32,109,116,101,120, 95,114,103, 98, 95,104,117,101, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99,
+ 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103,
+ 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10,  9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10,
+  9,109,105,120, 95,104,117,101, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44,
+ 32, 49, 46, 48, 41, 44, 32,118,101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10,
+  9,105,110, 99,111,108, 46,114,103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,
+101,120, 95,114,103, 98, 95,115, 97,116, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120,
+ 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116,
+ 32,118,101, 99, 51, 32,105,110, 99,111,108, 41, 10,123, 10,  9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10,  9,109,105,120, 95,
+115, 97,116, 40,102, 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44, 32, 49, 46, 48, 41,
+ 44, 32,118,101, 99, 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10,  9,105,110, 99,111,
+108, 46,114,103, 98, 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103,
+ 98, 95,118, 97,108, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,
+102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51,
+ 32,105,110, 99,111,108, 41, 10,123, 10,  9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10,  9,109,105,120, 95,118, 97,108, 40,102,
+ 97, 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32,118,101, 99,
+ 52, 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10,  9,105,110, 99,111,108, 46,114,103, 98,
+ 32, 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95, 99,111,108,
+111,114, 40,118,101, 99, 51, 32,111,117,116, 99,111,108, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111,108, 44, 32,102,108,111,
+ 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110,
+ 99,111,108, 41, 10,123, 10,  9,118,101, 99, 52, 32, 99,111,108, 59, 10, 10,  9,109,105,120, 95, 99,111,108,111,114, 40,102, 97,
+ 99,116, 42,102, 97, 99,103, 44, 32,118,101, 99, 52, 40,111,117,116, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32,118,101, 99, 52,
+ 40,116,101,120, 99,111,108, 44, 32, 49, 46, 48, 41, 44, 32, 99,111,108, 41, 59, 10,  9,105,110, 99,111,108, 46,114,103, 98, 32,
+ 61, 32, 99,111,108, 46,114,103, 98, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,
+114,115, 40,105,110,111,117,116, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44,
+ 32,111,117,116, 32,102,108,111, 97,116, 32,102, 97, 99,109, 41, 10,123, 10,  9,102, 97, 99,116, 32, 42, 61, 32, 97, 98,115, 40,
+102, 97, 99,103, 41, 59, 10,  9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 45,102, 97, 99,116, 59, 10, 10,  9,105,102, 40,102, 97,
+ 99,103, 32, 60, 32, 48, 46, 48, 41, 32,123, 10,  9,  9,102,108,111, 97,116, 32,116,109,112, 32, 61, 32,102, 97, 99,116, 59, 10,
+  9,  9,102, 97, 99,116, 32, 61, 32,102, 97, 99,109, 59, 10,  9,  9,102, 97, 99,109, 32, 61, 32,116,109,112, 59, 10,  9,125, 10,
+125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 98,108,101,110,100, 40,102,108,111, 97,116, 32,111,
+117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44,
+ 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10,
+  9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10,  9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97,
+ 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10,  9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,
+116,101,120, 99,111,108, 32, 43, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,
+101,120, 95,118, 97,108,117,101, 95,109,117,108, 40,102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116,
+ 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44,
+ 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 59,
+ 10,  9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97,
+ 99,109, 41, 59, 10, 10,  9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45, 32,102, 97, 99,103, 59, 10,  9,105,110, 99,111,108,
+ 32, 61, 32, 40,102, 97, 99,109, 32, 43, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 41, 42,111,117,116, 99,111,108, 59, 10,
+125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,115, 99,114,101,101,110, 40,102,108,111, 97,116, 32,
+111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116,
+ 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123,
+ 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10,  9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102,
+ 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10,  9,102, 97, 99,109, 32, 61, 32, 49, 46, 48, 32, 45,
+ 32,102, 97, 99,103, 59, 10,  9,105,110, 99,111,108, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40,102, 97, 99,109, 32, 43, 32,102, 97,
+ 99,116, 42, 40, 49, 46, 48, 32, 45, 32,116,101,120, 99,111,108, 41, 41, 42, 40, 49, 46, 48, 32, 45, 32,111,117,116, 99,111,108,
+ 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,115,117, 98, 40,102,108,111, 97,116, 32,
+111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116,
+ 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123,
+ 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10,  9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102,
+ 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10,  9,102, 97, 99,116, 32, 61, 32, 45,102, 97, 99,116,
  59, 10,  9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,111,108, 59,
- 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,100,105,118, 40,102,108,111, 97,116, 32,111,117,
+ 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 97,100,100, 40,102,108,111, 97,116, 32,111,117,
 116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,
 102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10,  9,
 102,108,111, 97,116, 32,102, 97, 99,109, 59, 10,  9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,
-116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10,  9,105,102, 40,116,101,120, 99,111,108, 32, 33, 61, 32, 48,
- 46, 48, 41, 10,  9,  9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 32, 43, 32,102, 97, 99,116,
- 42,111,117,116, 99,111,108, 47,116,101,120, 99,111,108, 59, 10,  9,101,108,115,101, 10,  9,  9,105,110, 99,111,108, 32, 61, 32,
- 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,100,105,102,102, 40,102,108,111,
+116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10,  9,102, 97, 99,116, 32, 61, 32,102, 97, 99,116, 59, 10,  9,
+105,110, 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 32, 43, 32,111,117,116, 99,111,108, 59, 10,125, 10,
+ 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,100,105,118, 40,102,108,111, 97,116, 32,111,117,116, 99,111,
+108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116, 44, 32,102,108,111,
+ 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123, 10,  9,102,108,111,
+ 97,116, 32,102, 97, 99,109, 59, 10,  9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102, 97, 99,116, 44, 32,
+102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10,  9,105,102, 40,116,101,120, 99,111,108, 32, 33, 61, 32, 48, 46, 48, 41,
+ 10,  9,  9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,109, 42,111,117,116, 99,111,108, 32, 43, 32,102, 97, 99,116, 42,111,117,
+116, 99,111,108, 47,116,101,120, 99,111,108, 59, 10,  9,101,108,115,101, 10,  9,  9,105,110, 99,111,108, 32, 61, 32, 48, 46, 48,
+ 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,100,105,102,102, 40,102,108,111, 97,116, 32,
+111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 97, 99,116,
+ 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108, 41, 10,123,
+ 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10,  9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,115, 40,102,
+ 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10,  9,105,110, 99,111,108, 32, 61, 32,102, 97, 99,109,
+ 42,111,117,116, 99,111,108, 32, 43, 32,102, 97, 99,116, 42, 97, 98,115, 40,116,101,120, 99,111,108, 32, 45, 32,111,117,116, 99,
+111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,100, 97,114,107, 40,102,108,111,
+ 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102,
+ 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108,
+ 41, 10,123, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10,  9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,
+115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10,  9,102,108,111, 97,116, 32, 99,111,108,
+ 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 59, 10,  9,105,102, 40, 99,111,108, 32, 60, 32,111,117,116, 99,111,108,
+ 41, 32,105,110, 99,111,108, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 32, 61, 32,111,117,116, 99,
+111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,108,105,103,104,116, 40,102,108,111,
  97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,116, 32,102,
  97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110, 99,111,108,
  41, 10,123, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10,  9,109,116,101,120, 95,118, 97,108,117,101, 95,118, 97,114,
-115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10,  9,105,110, 99,111,108, 32, 61, 32,102,
- 97, 99,109, 42,111,117,116, 99,111,108, 32, 43, 32,102, 97, 99,116, 42, 97, 98,115, 40,116,101,120, 99,111,108, 32, 45, 32,111,
-117,116, 99,111,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,100, 97,114,107, 40,
-102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,
-116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110,
- 99,111,108, 41, 10,123, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10,  9,109,116,101,120, 95,118, 97,108,117,101, 95,
-118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10,  9,102,108,111, 97,116, 32,
- 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 59, 10,  9,105,102, 40, 99,111,108, 32, 60, 32,111,117,116,
- 99,111,108, 41, 32,105,110, 99,111,108, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 32, 61, 32,111,
-117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,108,105,103,104,116, 40,
-102,108,111, 97,116, 32,111,117,116, 99,111,108, 44, 32,102,108,111, 97,116, 32,116,101,120, 99,111,108, 44, 32,102,108,111, 97,
-116, 32,102, 97, 99,116, 44, 32,102,108,111, 97,116, 32,102, 97, 99,103, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110,
- 99,111,108, 41, 10,123, 10,  9,102,108,111, 97,116, 32,102, 97, 99,109, 59, 10,  9,109,116,101,120, 95,118, 97,108,117,101, 95,
-118, 97,114,115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10,  9,102,108,111, 97,116, 32,
- 99,111,108, 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 59, 10,  9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116,
- 99,111,108, 41, 32,105,110, 99,111,108, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 32, 61, 32,111,
-117,116, 99,111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 99,108, 97,109,112, 95,
-112,111,115,105,116,105,118,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,
-116,102, 97, 99, 41, 10,123, 10,  9,111,117,116,102, 97, 99, 32, 61, 32,109, 97,120, 40,102, 97, 99, 44, 32, 48, 46, 48, 41, 59,
- 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 99,108, 97,109,112, 40,102,108,111, 97,116, 32,
-102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,102, 97, 99, 41, 10,123, 10,  9,111,117,116,102, 97, 99,
- 32, 61, 32, 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100,
- 32,109,116,101,120, 95,104, 97,114, 95,100,105,118,105,100,101, 40,102,108,111, 97,116, 32,104, 97,114, 44, 32,111,117,116, 32,
-102,108,111, 97,116, 32,111,117,116,104, 97,114, 41, 10,123, 10,  9,111,117,116,104, 97,114, 32, 61, 32,104, 97,114, 47, 49, 50,
- 56, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,104, 97,114, 95,109,117,108,116,105,112,108,121, 95, 99,
-108, 97,109,112, 40,102,108,111, 97,116, 32,104, 97,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,104, 97,114,
- 41, 10,123, 10,  9,104, 97,114, 32, 42, 61, 32, 49, 50, 56, 46, 48, 59, 10, 10,  9,105,102, 40,104, 97,114, 32, 60, 32, 49, 46,
- 48, 41, 32,111,117,116,104, 97,114, 32, 61, 32, 49, 46, 48, 59, 10,  9,101,108,115,101, 32,105,102, 40,104, 97,114, 32, 62, 32,
- 53, 49, 49, 46, 48, 41, 32,111,117,116,104, 97,114, 32, 61, 32, 53, 49, 49, 46, 48, 59, 10,  9,101,108,115,101, 32,111,117,116,
-104, 97,114, 32, 61, 32,104, 97,114, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 97,108,112,104, 97, 95,102,114,
-111,109, 95, 99,111,108, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, 97,108,112,104, 97,
- 41, 10,123, 10,  9, 97,108,112,104, 97, 32, 61, 32, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120,
- 95, 97,108,112,104, 97, 95,116,111, 95, 99,111,108, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,102,108,111, 97,116, 32, 97,108,
-112,104, 97, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,111,117,116, 99,111,108, 32,
- 61, 32,118,101, 99, 52, 40, 99,111,108, 46,114,103, 98, 44, 32, 97,108,112,104, 97, 41, 59, 10,125, 10, 10,118,111,105,100, 32,
-109,116,101,120, 95,114,103, 98,116,111,105,110,116, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,102,108,111, 97,
-116, 32,105,110,116,101,110,115,105,116,121, 41, 10,123, 10,  9,105,110,116,101,110,115,105,116,121, 32, 61, 32,100,111,116, 40,
-118,101, 99, 51, 40, 48, 46, 51, 53, 44, 32, 48, 46, 52, 53, 44, 32, 48, 46, 50, 41, 44, 32,114,103, 98, 46,114,103, 98, 41, 59,
- 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,105,110,118,101,114,116, 40,102,108,111, 97,116,
- 32,105,110,118, 97,108,117,101, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108,117,101, 41, 10,123, 10,
-  9,111,117,116,118, 97,108,117,101, 32, 61, 32, 49, 46, 48, 32, 45, 32,105,110,118, 97,108,117,101, 59, 10,125, 10, 10,118,111,
-105,100, 32,109,116,101,120, 95,114,103, 98, 95,105,110,118,101,114,116, 40,118,101, 99, 52, 32,105,110,114,103, 98, 44, 32,111,
-117,116, 32,118,101, 99, 52, 32,111,117,116,114,103, 98, 41, 10,123, 10,  9,111,117,116,114,103, 98, 32, 61, 32,118,101, 99, 52,
- 40,118,101, 99, 51, 40, 49, 46, 48, 41, 32, 45, 32,105,110,114,103, 98, 46,114,103, 98, 44, 32,105,110,114,103, 98, 46, 97, 41,
- 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,115,116,101,110, 99,105,108, 40,102,108,111,
- 97,116, 32,115,116,101,110, 99,105,108, 44, 32,102,108,111, 97,116, 32,105,110,116,101,110,115,105,116,121, 44, 32,111,117,116,
- 32,102,108,111, 97,116, 32,111,117,116,115,116,101,110, 99,105,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,
-105,110,116,101,110,115,105,116,121, 41, 10,123, 10,  9,102,108,111, 97,116, 32,102, 97, 99,116, 32, 61, 32,105,110,116,101,110,
-115,105,116,121, 59, 10,  9,111,117,116,105,110,116,101,110,115,105,116,121, 32, 61, 32,105,110,116,101,110,115,105,116,121, 42,
-115,116,101,110, 99,105,108, 59, 10,  9,111,117,116,115,116,101,110, 99,105,108, 32, 61, 32,115,116,101,110, 99,105,108, 42,102,
- 97, 99,116, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115,116,101,110, 99,105,108, 40,102,108,
-111, 97,116, 32,115,116,101,110, 99,105,108, 44, 32,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,102,108,111, 97,116,
- 32,111,117,116,115,116,101,110, 99,105,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,114,103, 98, 41, 10,123, 10,
-  9,102,108,111, 97,116, 32,102, 97, 99,116, 32, 61, 32,114,103, 98, 46, 97, 59, 10,  9,111,117,116,114,103, 98, 32, 61, 32,118,
-101, 99, 52, 40,114,103, 98, 46,114,103, 98, 44, 32,114,103, 98, 46, 97, 42,115,116,101,110, 99,105,108, 41, 59, 10,  9,111,117,
-116,115,116,101,110, 99,105,108, 32, 61, 32,115,116,101,110, 99,105,108, 42,102, 97, 99,116, 59, 10,125, 10, 10,118,111,105,100,
- 32,109,116,101,120, 95,109, 97,112,112,105,110,103, 95,111,102,115, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,118,101,
- 99, 51, 32,111,102,115, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,116,101,120, 99,111, 41, 10,123, 10,  9,111,117,
-116,116,101,120, 99,111, 32, 61, 32,116,101,120, 99,111, 32, 43, 32,111,102,115, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,
-101,120, 95,109, 97,112,112,105,110,103, 95,115,105,122,101, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,118,101, 99, 51,
- 32,115,105,122,101, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,116,101,120, 99,111, 41, 10,123, 10,  9,111,117,116,
-116,101,120, 99,111, 32, 61, 32,115,105,122,101, 42,116,101,120, 99,111, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120,
- 95, 50,100, 95,109, 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,
-117,116,118,101, 99, 41, 10,123, 10,  9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 51, 40,118,101, 99, 46,120,121, 42, 48,
- 46, 53, 32, 43, 32,118,101, 99, 50, 40, 48, 46, 53, 44, 32, 48, 46, 53, 41, 44, 32,118,101, 99, 46,122, 41, 59, 10,125, 10, 10,
-118,111,105,100, 32,109,116,101,120, 95,105,109, 97,103,101, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,
-108,101,114, 50, 68, 32,105,109, 97, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 97,108,117,101, 44, 32,111,117,116, 32,
-118,101, 99, 52, 32, 99,111,108,111,114, 41, 10,123, 10,  9, 99,111,108,111,114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68,
- 40,105,109, 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 59, 10,  9,118, 97,108,117,101, 32, 61, 32, 49, 46, 48, 59, 10,125,
- 10, 10,118,111,105,100, 32,109,116,101,120, 95,110,111,114,109, 97,108, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115,
- 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 41, 10,123,
- 10,  9, 47, 47, 32, 84,104,101, 32,105,110,118,101,114,116, 32,111,102, 32,116,104,101, 32,114,101,100, 32, 99,104, 97,110,110,
-101,108, 32,105,115, 32,116,111, 32,109, 97,107,101, 10,  9, 47, 47, 32,116,104,101, 32,110,111,114,109, 97,108, 32,109, 97,112,
- 32, 99,111,109,112,108,105, 97,110,116, 32,119,105,116,104, 32,116,104,101, 32,111,117,116,115,105,100,101, 32,119,111,114,108,
-100, 46, 10,  9, 47, 47, 32, 73,116, 32,110,101,101,100,115, 32,116,111, 32, 98,101, 32,100,111,110,101, 32, 98,101, 99, 97,117,
-115,101, 32,105,110, 32, 66,108,101,110,100,101,114, 10,  9, 47, 47, 32,116,104,101, 32,110,111,114,109, 97,108, 32,117,115,101,
-100, 32,112,111,105,110,116,115, 32,105,110,119, 97,114,100, 46, 10,  9, 47, 47, 32, 83,104,111,117,108,100, 32,116,104,105,115,
- 32,101,118,101,114, 32, 99,104, 97,110,103,101, 32,116,104,105,115, 32,110,101,103, 97,116,101, 32,109,117,115,116, 32, 98,101,
- 32,114,101,109,111,118,101,100, 46, 10, 32, 32, 32, 32,118,101, 99, 52, 32, 99,111,108,111,114, 32, 61, 32,116,101,120,116,117,
-114,101, 50, 68, 40,105,109, 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 59, 10,  9,110,111,114,109, 97,108, 32, 61, 32, 50,
- 46, 48, 42, 40,118,101, 99, 51, 40, 45, 99,111,108,111,114, 46,114, 44, 32, 99,111,108,111,114, 46,103, 44, 32, 99,111,108,111,
-114, 46, 98, 41, 32, 45, 32,118,101, 99, 51, 40, 45, 48, 46, 53, 44, 32, 48, 46, 53, 44, 32, 48, 46, 53, 41, 41, 59, 10,125, 10,
- 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,110,111,114,109, 97,108,115, 95,105,110,105,116, 40, 32,118,101,
- 99, 51, 32,118, 78, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78,111,114,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,
-118, 78, 97, 99, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 32,
- 41, 10,123, 10,  9,118, 78,111,114,103, 32, 61, 32,118, 78, 59, 10,  9,118, 78, 97, 99, 99, 32, 61, 32,118, 78, 59, 10,  9,102,
- 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10, 47, 42, 42, 32,104,101,108,112,
-101,114, 32,109,101,116,104,111,100, 32,116,111, 32,101,120,116,114, 97, 99,116, 32,116,104,101, 32,117,112,112,101,114, 32,108,
-101,102,116, 32, 51,120, 51, 32,109, 97,116,114,105,120, 32,102,114,111,109, 32, 97, 32, 52,120, 52, 32,109, 97,116,114,105,120,
- 32, 42, 47, 10,109, 97,116, 51, 32,116,111, 95,109, 97,116, 51, 40,109, 97,116, 52, 32,109, 52, 41, 10,123, 10,  9,109, 97,116,
- 51, 32,109, 51, 59, 10,  9,109, 51, 91, 48, 93, 32, 61, 32,109, 52, 91, 48, 93, 46,120,121,122, 59, 10,  9,109, 51, 91, 49, 93,
- 32, 61, 32,109, 52, 91, 49, 93, 46,120,121,122, 59, 10,  9,109, 51, 91, 50, 93, 32, 61, 32,109, 52, 91, 50, 93, 46,120,121,122,
- 59, 10,  9,114,101,116,117,114,110, 32,109, 51, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,
-105,110,105,116, 95,111, 98,106,115,112, 97, 99,101, 40, 32,118,101, 99, 51, 32,115,117,114,102, 95,112,111,115, 44, 32,118,101,
- 99, 51, 32,115,117,114,102, 95,110,111,114,109, 44, 10,  9,  9,  9,  9,  9,  9,  9, 32, 32,109, 97,116, 52, 32,109, 86,105,101,
-119, 44, 32,109, 97,116, 52, 32,109, 86,105,101,119, 73,110,118, 44, 32,109, 97,116, 52, 32,109, 79, 98,106, 44, 32,109, 97,116,
- 52, 32,109, 79, 98,106, 73,110,118, 44, 32, 10,  9,  9,  9,  9,  9,  9,  9, 32, 32,102,108,111, 97,116, 32,102, 80,114,101,118,
- 77, 97,103,110,105,116,117,100,101, 95,105,110, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10,  9,  9,  9,
-  9,  9,  9,  9, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,
-117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, 32, 10,  9,  9,  9,  9,  9,  9,  9,
- 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,111,117,
-116, 32,102,108,111, 97,116, 32,102, 68,101,116, 32, 41, 32, 10,123, 10,  9,109, 97,116, 51, 32,111, 98,106, 50,118,105,101,119,
- 32, 61, 32,116,111, 95,109, 97,116, 51, 40,103,108, 95, 77,111,100,101,108, 86,105,101,119, 77, 97,116,114,105,120, 41, 59, 10,
-  9,109, 97,116, 51, 32,118,105,101,119, 50,111, 98,106, 32, 61, 32,116,111, 95,109, 97,116, 51, 40,103,108, 95, 77,111,100,101,
-108, 86,105,101,119, 77, 97,116,114,105,120, 73,110,118,101,114,115,101, 41, 59, 10,  9, 10,  9,118,101, 99, 51, 32,118, 83,105,
-103,109, 97, 83, 32, 61, 32,118,105,101,119, 50,111, 98,106, 32, 42, 32,100, 70,100,120, 40, 32,115,117,114,102, 95,112,111,115,
- 32, 41, 59, 10,  9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 84, 32, 61, 32,118,105,101,119, 50,111, 98,106, 32, 42, 32,100,
- 70,100,121, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10,  9,118,101, 99, 51, 32,118, 78, 32, 61, 32,110,111,114,109,
- 97,108,105,122,101, 40, 32,115,117,114,102, 95,110,111,114,109, 32, 42, 32,111, 98,106, 50,118,105,101,119, 32, 41, 59, 10, 10,
-  9,118, 82, 49, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 83,105,103,109, 97, 84, 44, 32,118, 78, 32, 41, 59, 10,  9,118, 82,
- 50, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 78, 44, 32,118, 83,105,103,109, 97, 83, 32, 41, 32, 59, 10,  9,102, 68,101,116,
- 32, 61, 32,100,111,116, 32, 40, 32,118, 83,105,103,109, 97, 83, 44, 32,118, 82, 49, 32, 41, 59, 10,  9, 10,  9, 47, 42, 32,112,
-114,101,116,114, 97,110,115,102,111,114,109, 32,118, 78, 97, 99, 99, 32, 40,105,110, 32,109,116,101,120, 95, 98,117,109,112, 95,
- 97,112,112,108,121, 41, 32,117,115,105,110,103, 32,116,104,101, 32,105,110,118,101,114,115,101, 32,116,114, 97,110,115,112,111,
-115,101,100, 32, 42, 47, 10,  9,118, 82, 49, 32, 61, 32,118, 82, 49, 32, 42, 32,118,105,101,119, 50,111, 98,106, 59, 10,  9,118,
- 82, 50, 32, 61, 32,118, 82, 50, 32, 42, 32,118,105,101,119, 50,111, 98,106, 59, 10,  9,118, 78, 32, 61, 32,118, 78, 32, 42, 32,
-118,105,101,119, 50,111, 98,106, 59, 10,  9, 10,  9,102,108,111, 97,116, 32,102, 77, 97,103,110,105,116,117,100,101, 32, 61, 32,
- 97, 98,115, 40,102, 68,101,116, 41, 32, 42, 32,108,101,110,103,116,104, 40,118, 78, 41, 59, 10,  9,118, 78, 97, 99, 99, 95,111,
-117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, 42, 32, 40,102, 77, 97,103,110,105,116,117,100,101, 32, 47, 32,102, 80,
-114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 41, 59, 10,  9,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,
-101, 95,111,117,116, 32, 61, 32,102, 77, 97,103,110,105,116,117,100,101, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120,
- 95, 98,117,109,112, 95,105,110,105,116, 95,116,101,120,116,117,114,101,115,112, 97, 99,101, 40, 32,118,101, 99, 51, 32,115,117,
-114,102, 95,112,111,115, 44, 32,118,101, 99, 51, 32,115,117,114,102, 95,110,111,114,109, 44, 32, 10,  9,  9,  9,  9,  9,  9,  9,
-  9, 32, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 44, 32,118,101, 99, 51,
- 32,118, 78, 97, 99, 99, 95,105,110, 44, 10,  9,  9,  9,  9,  9,  9,  9,  9, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,102,
- 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99,
- 99, 95,111,117,116, 44, 32, 10,  9,  9,  9,  9,  9,  9,  9,  9, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,
-111,117,116, 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 68,101,116, 32, 41, 32, 10,
-123, 10,  9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 83, 32, 61, 32,100, 70,100,120, 40, 32,115,117,114,102, 95,112,111,115,
- 32, 41, 59, 10,  9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 84, 32, 61, 32,100, 70,100,121, 40, 32,115,117,114,102, 95,112,
-111,115, 32, 41, 59, 10,  9,118,101, 99, 51, 32,118, 78, 32, 61, 32,115,117,114,102, 95,110,111,114,109, 59, 32, 47, 42, 32,110,
-111,114,109, 97,108,105,122,101,100, 32,105,110,116,101,114,112,111,108, 97,116,101,100, 32,118,101,114,116,101,120, 32,110,111,
-114,109, 97,108, 32, 42, 47, 10,  9, 10,  9,118, 82, 49, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32, 99,114,111,115,
-115, 40, 32,118, 83,105,103,109, 97, 84, 44, 32,118, 78, 32, 41, 32, 41, 59, 10,  9,118, 82, 50, 32, 61, 32,110,111,114,109, 97,
-108,105,122,101, 40, 32, 99,114,111,115,115, 40, 32,118, 78, 44, 32,118, 83,105,103,109, 97, 83, 32, 41, 32, 41, 59, 10,  9,102,
- 68,101,116, 32, 61, 32,115,105,103,110, 40, 32,100,111,116, 40,118, 83,105,103,109, 97, 83, 44, 32,118, 82, 49, 41, 32, 41, 59,
- 10,  9, 10,  9,102,108,111, 97,116, 32,102, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 97, 98,115, 40,102, 68,101,116, 41,
- 59, 10,  9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, 42, 32, 40,102, 77, 97,103,110,
-105,116,117,100,101, 32, 47, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 41, 59, 10,  9,102, 80,114,
-101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 32, 61, 32,102, 77, 97,103,110,105,116,117,100,101, 59, 10,125, 10,
- 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,105,110,105,116, 95,118,105,101,119,115,112, 97, 99,101, 40, 32,
-118,101, 99, 51, 32,115,117,114,102, 95,112,111,115, 44, 32,118,101, 99, 51, 32,115,117,114,102, 95,110,111,114,109, 44, 32, 10,
-  9,  9,  9,  9,  9,  9,  9, 32, 32, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,
-110, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10,  9,  9,  9,  9,  9,  9,  9, 32, 32, 32,111,117,116, 32,
-102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 44, 32,111,117,116, 32,118,101,
- 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, 32, 10,  9,  9,  9,  9,  9,  9,  9, 32, 32, 32,111,117,116, 32,118,101, 99,
- 51, 32,118, 82, 49, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102,
- 68,101,116, 32, 41, 32, 10,123, 10,  9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 83, 32, 61, 32,100, 70,100,120, 40, 32,115,
-117,114,102, 95,112,111,115, 32, 41, 59, 10,  9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 84, 32, 61, 32,100, 70,100,121, 40,
- 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10,  9,118,101, 99, 51, 32,118, 78, 32, 61, 32,115,117,114,102, 95,110,111,114,
-109, 59, 32, 47, 42, 32,110,111,114,109, 97,108,105,122,101,100, 32,105,110,116,101,114,112,111,108, 97,116,101,100, 32,118,101,
-114,116,101,120, 32,110,111,114,109, 97,108, 32, 42, 47, 10,  9, 10,  9,118, 82, 49, 32, 61, 32, 99,114,111,115,115, 40, 32,118,
- 83,105,103,109, 97, 84, 44, 32,118, 78, 32, 41, 59, 10,  9,118, 82, 50, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 78, 44, 32,
-118, 83,105,103,109, 97, 83, 32, 41, 32, 59, 10,  9,102, 68,101,116, 32, 61, 32,100,111,116, 32, 40, 32,118, 83,105,103,109, 97,
- 83, 44, 32,118, 82, 49, 32, 41, 59, 10,  9, 10,  9,102,108,111, 97,116, 32,102, 77, 97,103,110,105,116,117,100,101, 32, 61, 32,
- 97, 98,115, 40,102, 68,101,116, 41, 59, 10,  9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110,
- 32, 42, 32, 40,102, 77, 97,103,110,105,116,117,100,101, 32, 47, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,
-105,110, 41, 59, 10,  9,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 32, 61, 32,102, 77, 97,103,110,
-105,116,117,100,101, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,116, 97,112, 51, 40, 32,118,
-101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,102,108,111, 97,116, 32,
-104, 83, 99, 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,111,117,
-116, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,116, 32, 41, 32, 10,123, 10,
-  9,118,101, 99, 50, 32, 83, 84,108,108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 59, 10,  9,118,101, 99, 50, 32, 83, 84,108,
-114, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32,100, 70,100,120, 40,116,101,120, 99,111, 46,120,121, 41, 32, 59, 10,
-  9,118,101, 99, 50, 32, 83, 84,117,108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32,100, 70,100,121, 40,116,101,120,
- 99,111, 46,120,121, 41, 32, 59, 10,  9, 10,  9,102,108,111, 97,116, 32, 72,108,108, 44, 72,108,114, 44, 72,117,108, 59, 10,  9,
-114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,108,108, 41, 44, 32, 72,
-108,108, 32, 41, 59, 10,  9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83,
- 84,108,114, 41, 44, 32, 72,108,114, 32, 41, 59, 10,  9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68,
- 40,105,109, 97, 44, 32, 83, 84,117,108, 41, 44, 32, 72,117,108, 32, 41, 59, 10,  9, 10,  9,100, 66,115, 32, 61, 32,104, 83, 99,
- 97,108,101, 32, 42, 32, 40, 72,108,114, 32, 45, 32, 72,108,108, 41, 59, 10,  9,100, 66,116, 32, 61, 32,104, 83, 99, 97,108,101,
- 32, 42, 32, 40, 72,117,108, 32, 45, 32, 72,108,108, 41, 59, 10,125, 10, 10, 35,105,102,100,101,102, 32, 66, 85, 77, 80, 95, 66,
- 73, 67, 85, 66, 73, 67, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95, 98,105, 99,117, 98,105, 99, 40, 32,
-118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,102,108,111, 97,116,
- 32,104, 83, 99, 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,111,
-117,116, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,116, 32, 41, 32, 10,123,
- 10,  9,102,108,111, 97,116, 32, 72,108, 59, 10,  9,102,108,111, 97,116, 32, 72,114, 59, 10,  9,102,108,111, 97,116, 32, 72,100,
- 59, 10,  9,102,108,111, 97,116, 32, 72,117, 59, 10,  9, 10,  9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100, 70,100,
-120, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10,  9,118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100,121, 40,
-116,101,120, 99,111, 46,120,121, 41, 59, 10, 32, 10,  9,118,101, 99, 50, 32, 83, 84,108, 32, 61, 32,116,101,120, 99,111, 46,120,
-121, 32, 45, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,120, 32, 59, 10,  9,118,101, 99, 50, 32, 83, 84,114, 32, 61, 32,116,101,
-120, 99,111, 46,120,121, 32, 43, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,120, 32, 59, 10,  9,118,101, 99, 50, 32, 83, 84,100,
- 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 45, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,121, 32, 59, 10,  9,118,101, 99,
- 50, 32, 83, 84,117, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,121, 32, 59,
- 10,  9, 10,  9,114,103, 98,116,111, 98,119, 40,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,108, 41, 44,
- 32, 72,108, 41, 59, 10,  9,114,103, 98,116,111, 98,119, 40,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,
-114, 41, 44, 32, 72,114, 41, 59, 10,  9,114,103, 98,116,111, 98,119, 40,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44,
- 32, 83, 84,100, 41, 44, 32, 72,100, 41, 59, 10,  9,114,103, 98,116,111, 98,119, 40,116,101,120,116,117,114,101, 50, 68, 40,105,
-109, 97, 44, 32, 83, 84,117, 41, 44, 32, 72,117, 41, 59, 10,  9, 10,  9,118,101, 99, 50, 32,100, 72,100,120,121, 32, 61, 32,118,
-101, 99, 50, 40, 72,114, 32, 45, 32, 72,108, 44, 32, 72,117, 32, 45, 32, 72,100, 41, 59, 10,  9,102,108,111, 97,116, 32,102, 66,
-108,101,110,100, 32, 61, 32, 99,108, 97,109,112, 40, 49, 46, 48, 45,116,101,120,116,117,114,101, 81,117,101,114,121, 76, 79, 68,
- 40,105,109, 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 46,120, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,105,
-102, 40,102, 66,108,101,110,100, 33, 61, 48, 46, 48, 41, 10,  9,123, 10,  9,  9, 47, 47, 32,116,104,101, 32,100,101,114,105,118,
- 97,116,105,118,101, 32,111,102, 32,116,104,101, 32, 98,105, 99,117, 98,105, 99, 32,115, 97,109,112,108,105,110,103, 32,111,102,
- 32,108,101,118,101,108, 32, 48, 10,  9,  9,105,118,101, 99, 50, 32,118, 68,105,109, 59, 10,  9,  9,118, 68,105,109, 32, 61, 32,
-116,101,120,116,117,114,101, 83,105,122,101, 40,105,109, 97, 44, 32, 48, 41, 59, 10, 10,  9,  9, 47, 47, 32,116, 97,107,105,110,
-103, 32,116,104,101, 32,102,114, 97, 99,116, 32,112, 97,114,116, 32,111,102, 32,116,104,101, 32,116,101,120,116,117,114,101, 32,
- 99,111,111,114,100,105,110, 97,116,101, 32,105,115, 32, 97, 32,104, 97,114,100, 99,111,100,101,100, 32,119,114, 97,112, 32,109,
-111,100,101, 46, 10,  9,  9, 47, 47, 32,116,104,105,115, 32,105,115, 32, 97, 99, 99,101,112,116, 97, 98,108,101, 32, 97,115, 32,
-116,101,120,116,117,114,101,115, 32,117,115,101, 32,119,114, 97,112, 32,109,111,100,101, 32,101,120, 99,108,117,115,105,118,101,
-108,121, 32,105,110, 32, 51, 68, 32,118,105,101,119, 32,101,108,115,101,119,104,101,114,101, 32,105,110, 32, 98,108,101,110,100,
-101,114, 46, 32, 10,  9,  9, 47, 47, 32,116,104,105,115, 32,105,115, 32,100,111,110,101, 32,115,111, 32,116,104, 97,116, 32,119,
-101, 32, 99, 97,110, 32,115,116,105,108,108, 32,103,101,116, 32, 97, 32,118, 97,108,105,100, 32,116,101,120,101,108, 32,119,105,
-116,104, 32,117,118,115, 32,111,117,116,115,105,100,101, 32,116,104,101, 32, 48, 44, 49, 32,114, 97,110,103,101, 10,  9,  9, 47,
- 47, 32, 98,121, 32,116,101,120,101,108, 70,101,116, 99,104, 32, 98,101,108,111,119, 44, 32, 97,115, 32, 99,111,111,114,100,105,
-110, 97,116,101,115, 32, 97,114,101, 32, 99,108, 97,109,112,101,100, 32,119,104,101,110, 32,117,115,105,110,103, 32,116,104,105,
-115, 32,102,117,110, 99,116,105,111,110, 46, 10,  9,  9,118,101, 99, 50, 32,102, 84,101,120, 76,111, 99, 32, 61, 32,118, 68,105,
-109, 42,102,114, 97, 99,116, 40,116,101,120, 99,111, 46,120,121, 41, 32, 45, 32,118,101, 99, 50, 40, 48, 46, 53, 44, 32, 48, 46,
- 53, 41, 59, 10,  9,  9,105,118,101, 99, 50, 32,105, 84,101,120, 76,111, 99, 32, 61, 32,105,118,101, 99, 50, 40,102,108,111,111,
-114, 40,102, 84,101,120, 76,111, 99, 41, 41, 59, 10,  9,  9,118,101, 99, 50, 32,116, 32, 61, 32, 99,108, 97,109,112, 40,102, 84,
-101,120, 76,111, 99, 32, 45, 32,105, 84,101,120, 76,111, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59,  9,  9, 47, 47, 32,
-115, 97,116, 32,106,117,115,116, 32,116,111, 32, 98,101, 32,112,101,100, 97,110,116,105, 99, 10, 10, 47, 42, 42, 42, 42, 42, 42,
+115, 40,102, 97, 99,116, 44, 32,102, 97, 99,103, 44, 32,102, 97, 99,109, 41, 59, 10, 10,  9,102,108,111, 97,116, 32, 99,111,108,
+ 32, 61, 32,102, 97, 99,116, 42,116,101,120, 99,111,108, 59, 10,  9,105,102, 40, 99,111,108, 32, 62, 32,111,117,116, 99,111,108,
+ 41, 32,105,110, 99,111,108, 32, 61, 32, 99,111,108, 59, 32,101,108,115,101, 32,105,110, 99,111,108, 32, 61, 32,111,117,116, 99,
+111,108, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 99,108, 97,109,112, 95,112,111,115,
+105,116,105,118,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,102, 97,
+ 99, 41, 10,123, 10,  9,111,117,116,102, 97, 99, 32, 61, 32,109, 97,120, 40,102, 97, 99, 44, 32, 48, 46, 48, 41, 59, 10,125, 10,
+ 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95, 99,108, 97,109,112, 40,102,108,111, 97,116, 32,102, 97, 99,
+ 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,102, 97, 99, 41, 10,123, 10,  9,111,117,116,102, 97, 99, 32, 61, 32,
+ 99,108, 97,109,112, 40,102, 97, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,
+101,120, 95,104, 97,114, 95,100,105,118,105,100,101, 40,102,108,111, 97,116, 32,104, 97,114, 44, 32,111,117,116, 32,102,108,111,
+ 97,116, 32,111,117,116,104, 97,114, 41, 10,123, 10,  9,111,117,116,104, 97,114, 32, 61, 32,104, 97,114, 47, 49, 50, 56, 46, 48,
+ 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,104, 97,114, 95,109,117,108,116,105,112,108,121, 95, 99,108, 97,109,
+112, 40,102,108,111, 97,116, 32,104, 97,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,104, 97,114, 41, 10,123,
+ 10,  9,104, 97,114, 32, 42, 61, 32, 49, 50, 56, 46, 48, 59, 10, 10,  9,105,102, 40,104, 97,114, 32, 60, 32, 49, 46, 48, 41, 32,
+111,117,116,104, 97,114, 32, 61, 32, 49, 46, 48, 59, 10,  9,101,108,115,101, 32,105,102, 40,104, 97,114, 32, 62, 32, 53, 49, 49,
+ 46, 48, 41, 32,111,117,116,104, 97,114, 32, 61, 32, 53, 49, 49, 46, 48, 59, 10,  9,101,108,115,101, 32,111,117,116,104, 97,114,
+ 32, 61, 32,104, 97,114, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 97,108,112,104, 97, 95,102,114,111,109, 95,
+ 99,111,108, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, 97,108,112,104, 97, 41, 10,123,
+ 10,  9, 97,108,112,104, 97, 32, 61, 32, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 97,108,
+112,104, 97, 95,116,111, 95, 99,111,108, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,102,108,111, 97,116, 32, 97,108,112,104, 97,
+ 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,111,117,116, 99,111,108, 32, 61, 32,118,
+101, 99, 52, 40, 99,111,108, 46,114,103, 98, 44, 32, 97,108,112,104, 97, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,
+120, 95,114,103, 98,116,111,105,110,116, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,
+110,116,101,110,115,105,116,121, 41, 10,123, 10,  9,105,110,116,101,110,115,105,116,121, 32, 61, 32,100,111,116, 40,118,101, 99,
+ 51, 40, 48, 46, 51, 53, 44, 32, 48, 46, 52, 53, 44, 32, 48, 46, 50, 41, 44, 32,114,103, 98, 46,114,103, 98, 41, 59, 10,125, 10,
+ 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,105,110,118,101,114,116, 40,102,108,111, 97,116, 32,105,110,
+118, 97,108,117,101, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108,117,101, 41, 10,123, 10,  9,111,117,
+116,118, 97,108,117,101, 32, 61, 32, 49, 46, 48, 32, 45, 32,105,110,118, 97,108,117,101, 59, 10,125, 10, 10,118,111,105,100, 32,
+109,116,101,120, 95,114,103, 98, 95,105,110,118,101,114,116, 40,118,101, 99, 52, 32,105,110,114,103, 98, 44, 32,111,117,116, 32,
+118,101, 99, 52, 32,111,117,116,114,103, 98, 41, 10,123, 10,  9,111,117,116,114,103, 98, 32, 61, 32,118,101, 99, 52, 40,118,101,
+ 99, 51, 40, 49, 46, 48, 41, 32, 45, 32,105,110,114,103, 98, 46,114,103, 98, 44, 32,105,110,114,103, 98, 46, 97, 41, 59, 10,125,
+ 10, 10,118,111,105,100, 32,109,116,101,120, 95,118, 97,108,117,101, 95,115,116,101,110, 99,105,108, 40,102,108,111, 97,116, 32,
+115,116,101,110, 99,105,108, 44, 32,102,108,111, 97,116, 32,105,110,116,101,110,115,105,116,121, 44, 32,111,117,116, 32,102,108,
+111, 97,116, 32,111,117,116,115,116,101,110, 99,105,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,105,110,116,
+101,110,115,105,116,121, 41, 10,123, 10,  9,102,108,111, 97,116, 32,102, 97, 99,116, 32, 61, 32,105,110,116,101,110,115,105,116,
+121, 59, 10,  9,111,117,116,105,110,116,101,110,115,105,116,121, 32, 61, 32,105,110,116,101,110,115,105,116,121, 42,115,116,101,
+110, 99,105,108, 59, 10,  9,111,117,116,115,116,101,110, 99,105,108, 32, 61, 32,115,116,101,110, 99,105,108, 42,102, 97, 99,116,
+ 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,114,103, 98, 95,115,116,101,110, 99,105,108, 40,102,108,111, 97,116,
+ 32,115,116,101,110, 99,105,108, 44, 32,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,
+116,115,116,101,110, 99,105,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,114,103, 98, 41, 10,123, 10,  9,102,108,
+111, 97,116, 32,102, 97, 99,116, 32, 61, 32,114,103, 98, 46, 97, 59, 10,  9,111,117,116,114,103, 98, 32, 61, 32,118,101, 99, 52,
+ 40,114,103, 98, 46,114,103, 98, 44, 32,114,103, 98, 46, 97, 42,115,116,101,110, 99,105,108, 41, 59, 10,  9,111,117,116,115,116,
+101,110, 99,105,108, 32, 61, 32,115,116,101,110, 99,105,108, 42,102, 97, 99,116, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,
+101,120, 95,109, 97,112,112,105,110,103, 95,111,102,115, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,118,101, 99, 51, 32,
+111,102,115, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,116,101,120, 99,111, 41, 10,123, 10,  9,111,117,116,116,101,
+120, 99,111, 32, 61, 32,116,101,120, 99,111, 32, 43, 32,111,102,115, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,
+109, 97,112,112,105,110,103, 95,115,105,122,101, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,118,101, 99, 51, 32,115,105,
+122,101, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,116,101,120, 99,111, 41, 10,123, 10,  9,111,117,116,116,101,120,
+ 99,111, 32, 61, 32,115,105,122,101, 42,116,101,120, 99,111, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 50,100,
+ 95,109, 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,
+101, 99, 41, 10,123, 10,  9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 51, 40,118,101, 99, 46,120,121, 42, 48, 46, 53, 32,
+ 43, 32,118,101, 99, 50, 40, 48, 46, 53, 44, 32, 48, 46, 53, 41, 44, 32,118,101, 99, 46,122, 41, 59, 10,125, 10, 10,118,111,105,
+100, 32,109,116,101,120, 95,105,109, 97,103,101, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114,
+ 50, 68, 32,105,109, 97, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118, 97,108,117,101, 44, 32,111,117,116, 32,118,101, 99,
+ 52, 32, 99,111,108,111,114, 41, 10,123, 10,  9, 99,111,108,111,114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109,
+ 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 59, 10,  9,118, 97,108,117,101, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,
+111,105,100, 32,109,116,101,120, 95,110,111,114,109, 97,108, 40,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,
+108,101,114, 50, 68, 32,105,109, 97, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 41, 10,123, 10,  9, 47,
+ 47, 32, 84,104,101, 32,105,110,118,101,114,116, 32,111,102, 32,116,104,101, 32,114,101,100, 32, 99,104, 97,110,110,101,108, 32,
+105,115, 32,116,111, 32,109, 97,107,101, 10,  9, 47, 47, 32,116,104,101, 32,110,111,114,109, 97,108, 32,109, 97,112, 32, 99,111,
+109,112,108,105, 97,110,116, 32,119,105,116,104, 32,116,104,101, 32,111,117,116,115,105,100,101, 32,119,111,114,108,100, 46, 10,
+  9, 47, 47, 32, 73,116, 32,110,101,101,100,115, 32,116,111, 32, 98,101, 32,100,111,110,101, 32, 98,101, 99, 97,117,115,101, 32,
+105,110, 32, 66,108,101,110,100,101,114, 10,  9, 47, 47, 32,116,104,101, 32,110,111,114,109, 97,108, 32,117,115,101,100, 32,112,
+111,105,110,116,115, 32,105,110,119, 97,114,100, 46, 10,  9, 47, 47, 32, 83,104,111,117,108,100, 32,116,104,105,115, 32,101,118,
+101,114, 32, 99,104, 97,110,103,101, 32,116,104,105,115, 32,110,101,103, 97,116,101, 32,109,117,115,116, 32, 98,101, 32,114,101,
+109,111,118,101,100, 46, 10, 32, 32, 32, 32,118,101, 99, 52, 32, 99,111,108,111,114, 32, 61, 32,116,101,120,116,117,114,101, 50,
+ 68, 40,105,109, 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 59, 10,  9,110,111,114,109, 97,108, 32, 61, 32, 50, 46, 48, 42,
+ 40,118,101, 99, 51, 40, 45, 99,111,108,111,114, 46,114, 44, 32, 99,111,108,111,114, 46,103, 44, 32, 99,111,108,111,114, 46, 98,
+ 41, 32, 45, 32,118,101, 99, 51, 40, 45, 48, 46, 53, 44, 32, 48, 46, 53, 44, 32, 48, 46, 53, 41, 41, 59, 10,125, 10, 10,118,111,
+105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,110,111,114,109, 97,108,115, 95,105,110,105,116, 40, 32,118,101, 99, 51, 32,
+118, 78, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78,111,114,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97,
+ 99, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 32, 41, 10,123,
+ 10,  9,118, 78,111,114,103, 32, 61, 32,118, 78, 59, 10,  9,118, 78, 97, 99, 99, 32, 61, 32,118, 78, 59, 10,  9,102, 80,114,101,
+118, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10, 47, 42, 42, 32,104,101,108,112,101,114, 32,
+109,101,116,104,111,100, 32,116,111, 32,101,120,116,114, 97, 99,116, 32,116,104,101, 32,117,112,112,101,114, 32,108,101,102,116,
+ 32, 51,120, 51, 32,109, 97,116,114,105,120, 32,102,114,111,109, 32, 97, 32, 52,120, 52, 32,109, 97,116,114,105,120, 32, 42, 47,
+ 10,109, 97,116, 51, 32,116,111, 95,109, 97,116, 51, 40,109, 97,116, 52, 32,109, 52, 41, 10,123, 10,  9,109, 97,116, 51, 32,109,
+ 51, 59, 10,  9,109, 51, 91, 48, 93, 32, 61, 32,109, 52, 91, 48, 93, 46,120,121,122, 59, 10,  9,109, 51, 91, 49, 93, 32, 61, 32,
+109, 52, 91, 49, 93, 46,120,121,122, 59, 10,  9,109, 51, 91, 50, 93, 32, 61, 32,109, 52, 91, 50, 93, 46,120,121,122, 59, 10,  9,
+114,101,116,117,114,110, 32,109, 51, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,105,110,105,
+116, 95,111, 98,106,115,112, 97, 99,101, 40, 32,118,101, 99, 51, 32,115,117,114,102, 95,112,111,115, 44, 32,118,101, 99, 51, 32,
+115,117,114,102, 95,110,111,114,109, 44, 10,  9,  9,  9,  9,  9,  9,  9, 32, 32,109, 97,116, 52, 32,109, 86,105,101,119, 44, 32,
+109, 97,116, 52, 32,109, 86,105,101,119, 73,110,118, 44, 32,109, 97,116, 52, 32,109, 79, 98,106, 44, 32,109, 97,116, 52, 32,109,
+ 79, 98,106, 73,110,118, 44, 32, 10,  9,  9,  9,  9,  9,  9,  9, 32, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,
+110,105,116,117,100,101, 95,105,110, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10,  9,  9,  9,  9,  9,  9,
+  9, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 44,
+ 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, 32, 10,  9,  9,  9,  9,  9,  9,  9, 32, 32,111,
+117,116, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,111,117,116, 32,102,
+108,111, 97,116, 32,102, 68,101,116, 32, 41, 32, 10,123, 10,  9,109, 97,116, 51, 32,111, 98,106, 50,118,105,101,119, 32, 61, 32,
+116,111, 95,109, 97,116, 51, 40,103,108, 95, 77,111,100,101,108, 86,105,101,119, 77, 97,116,114,105,120, 41, 59, 10,  9,109, 97,
+116, 51, 32,118,105,101,119, 50,111, 98,106, 32, 61, 32,116,111, 95,109, 97,116, 51, 40,103,108, 95, 77,111,100,101,108, 86,105,
+101,119, 77, 97,116,114,105,120, 73,110,118,101,114,115,101, 41, 59, 10,  9, 10,  9,118,101, 99, 51, 32,118, 83,105,103,109, 97,
+ 83, 32, 61, 32,118,105,101,119, 50,111, 98,106, 32, 42, 32,100, 70,100,120, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59,
+ 10,  9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 84, 32, 61, 32,118,105,101,119, 50,111, 98,106, 32, 42, 32,100, 70,100,121,
+ 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59, 10,  9,118,101, 99, 51, 32,118, 78, 32, 61, 32,110,111,114,109, 97,108,105,
+122,101, 40, 32,115,117,114,102, 95,110,111,114,109, 32, 42, 32,111, 98,106, 50,118,105,101,119, 32, 41, 59, 10, 10,  9,118, 82,
+ 49, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 83,105,103,109, 97, 84, 44, 32,118, 78, 32, 41, 59, 10,  9,118, 82, 50, 32, 61,
+ 32, 99,114,111,115,115, 40, 32,118, 78, 44, 32,118, 83,105,103,109, 97, 83, 32, 41, 32, 59, 10,  9,102, 68,101,116, 32, 61, 32,
+100,111,116, 32, 40, 32,118, 83,105,103,109, 97, 83, 44, 32,118, 82, 49, 32, 41, 59, 10,  9, 10,  9, 47, 42, 32,112,114,101,116,
+114, 97,110,115,102,111,114,109, 32,118, 78, 97, 99, 99, 32, 40,105,110, 32,109,116,101,120, 95, 98,117,109,112, 95, 97,112,112,
+108,121, 41, 32,117,115,105,110,103, 32,116,104,101, 32,105,110,118,101,114,115,101, 32,116,114, 97,110,115,112,111,115,101,100,
+ 32, 42, 47, 10,  9,118, 82, 49, 32, 61, 32,118, 82, 49, 32, 42, 32,118,105,101,119, 50,111, 98,106, 59, 10,  9,118, 82, 50, 32,
+ 61, 32,118, 82, 50, 32, 42, 32,118,105,101,119, 50,111, 98,106, 59, 10,  9,118, 78, 32, 61, 32,118, 78, 32, 42, 32,118,105,101,
+119, 50,111, 98,106, 59, 10,  9, 10,  9,102,108,111, 97,116, 32,102, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 97, 98,115,
+ 40,102, 68,101,116, 41, 32, 42, 32,108,101,110,103,116,104, 40,118, 78, 41, 59, 10,  9,118, 78, 97, 99, 99, 95,111,117,116, 32,
+ 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, 42, 32, 40,102, 77, 97,103,110,105,116,117,100,101, 32, 47, 32,102, 80,114,101,118,
+ 77, 97,103,110,105,116,117,100,101, 95,105,110, 41, 59, 10,  9,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,
+117,116, 32, 61, 32,102, 77, 97,103,110,105,116,117,100,101, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,
+109,112, 95,105,110,105,116, 95,116,101,120,116,117,114,101,115,112, 97, 99,101, 40, 32,118,101, 99, 51, 32,115,117,114,102, 95,
+112,111,115, 44, 32,118,101, 99, 51, 32,115,117,114,102, 95,110,111,114,109, 44, 32, 10,  9,  9,  9,  9,  9,  9,  9,  9, 32, 32,
+102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 44, 32,118,101, 99, 51, 32,118, 78,
+ 97, 99, 99, 95,105,110, 44, 10,  9,  9,  9,  9,  9,  9,  9,  9, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 80,114,101,
+118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,
+117,116, 44, 32, 10,  9,  9,  9,  9,  9,  9,  9,  9, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,111,117,116,
+ 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 68,101,116, 32, 41, 32, 10,123, 10,  9,
+118,101, 99, 51, 32,118, 83,105,103,109, 97, 83, 32, 61, 32,100, 70,100,120, 40, 32,115,117,114,102, 95,112,111,115, 32, 41, 59,
+ 10,  9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 84, 32, 61, 32,100, 70,100,121, 40, 32,115,117,114,102, 95,112,111,115, 32,
+ 41, 59, 10,  9,118,101, 99, 51, 32,118, 78, 32, 61, 32,115,117,114,102, 95,110,111,114,109, 59, 32, 47, 42, 32,110,111,114,109,
+ 97,108,105,122,101,100, 32,105,110,116,101,114,112,111,108, 97,116,101,100, 32,118,101,114,116,101,120, 32,110,111,114,109, 97,
+108, 32, 42, 47, 10,  9, 10,  9,118, 82, 49, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32, 99,114,111,115,115, 40, 32,
+118, 83,105,103,109, 97, 84, 44, 32,118, 78, 32, 41, 32, 41, 59, 10,  9,118, 82, 50, 32, 61, 32,110,111,114,109, 97,108,105,122,
+101, 40, 32, 99,114,111,115,115, 40, 32,118, 78, 44, 32,118, 83,105,103,109, 97, 83, 32, 41, 32, 41, 59, 10,  9,102, 68,101,116,
+ 32, 61, 32,115,105,103,110, 40, 32,100,111,116, 40,118, 83,105,103,109, 97, 83, 44, 32,118, 82, 49, 41, 32, 41, 59, 10,  9, 10,
+  9,102,108,111, 97,116, 32,102, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 97, 98,115, 40,102, 68,101,116, 41, 59, 10,  9,
+118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, 42, 32, 40,102, 77, 97,103,110,105,116,117,
+100,101, 32, 47, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 41, 59, 10,  9,102, 80,114,101,118, 77,
+ 97,103,110,105,116,117,100,101, 95,111,117,116, 32, 61, 32,102, 77, 97,103,110,105,116,117,100,101, 59, 10,125, 10, 10,118,111,
+105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,105,110,105,116, 95,118,105,101,119,115,112, 97, 99,101, 40, 32,118,101, 99,
+ 51, 32,115,117,114,102, 95,112,111,115, 44, 32,118,101, 99, 51, 32,115,117,114,102, 95,110,111,114,109, 44, 32, 10,  9,  9,  9,
+  9,  9,  9,  9, 32, 32, 32,102,108,111, 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 44, 32,
+118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10,  9,  9,  9,  9,  9,  9,  9, 32, 32, 32,111,117,116, 32,102,108,111,
+ 97,116, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,
+118, 78, 97, 99, 99, 95,111,117,116, 44, 32, 10,  9,  9,  9,  9,  9,  9,  9, 32, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118,
+ 82, 49, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 68,101,116,
+ 32, 41, 32, 10,123, 10,  9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 83, 32, 61, 32,100, 70,100,120, 40, 32,115,117,114,102,
+ 95,112,111,115, 32, 41, 59, 10,  9,118,101, 99, 51, 32,118, 83,105,103,109, 97, 84, 32, 61, 32,100, 70,100,121, 40, 32,115,117,
+114,102, 95,112,111,115, 32, 41, 59, 10,  9,118,101, 99, 51, 32,118, 78, 32, 61, 32,115,117,114,102, 95,110,111,114,109, 59, 32,
+ 47, 42, 32,110,111,114,109, 97,108,105,122,101,100, 32,105,110,116,101,114,112,111,108, 97,116,101,100, 32,118,101,114,116,101,
+120, 32,110,111,114,109, 97,108, 32, 42, 47, 10,  9, 10,  9,118, 82, 49, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 83,105,103,
+109, 97, 84, 44, 32,118, 78, 32, 41, 59, 10,  9,118, 82, 50, 32, 61, 32, 99,114,111,115,115, 40, 32,118, 78, 44, 32,118, 83,105,
+103,109, 97, 83, 32, 41, 32, 59, 10,  9,102, 68,101,116, 32, 61, 32,100,111,116, 32, 40, 32,118, 83,105,103,109, 97, 83, 44, 32,
+118, 82, 49, 32, 41, 59, 10,  9, 10,  9,102,108,111, 97,116, 32,102, 77, 97,103,110,105,116,117,100,101, 32, 61, 32, 97, 98,115,
+ 40,102, 68,101,116, 41, 59, 10,  9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, 42, 32,
+ 40,102, 77, 97,103,110,105,116,117,100,101, 32, 47, 32,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,105,110, 41,
+ 59, 10,  9,102, 80,114,101,118, 77, 97,103,110,105,116,117,100,101, 95,111,117,116, 32, 61, 32,102, 77, 97,103,110,105,116,117,
+100,101, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,116, 97,112, 51, 40, 32,118,101, 99, 51,
+ 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,102,108,111, 97,116, 32,104, 83, 99,
+ 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,111,117,116, 32,102,
+108,111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,116, 32, 41, 32, 10,123, 10,  9,118,101,
+ 99, 50, 32, 83, 84,108,108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 59, 10,  9,118,101, 99, 50, 32, 83, 84,108,114, 32, 61,
+ 32,116,101,120, 99,111, 46,120,121, 32, 43, 32,100, 70,100,120, 40,116,101,120, 99,111, 46,120,121, 41, 32, 59, 10,  9,118,101,
+ 99, 50, 32, 83, 84,117,108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32,100, 70,100,121, 40,116,101,120, 99,111, 46,
+120,121, 41, 32, 59, 10,  9, 10,  9,102,108,111, 97,116, 32, 72,108,108, 44, 72,108,114, 44, 72,117,108, 59, 10,  9,114,103, 98,
+116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,108,108, 41, 44, 32, 72,108,108, 32,
+ 41, 59, 10,  9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,108,114,
+ 41, 44, 32, 72,108,114, 32, 41, 59, 10,  9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109,
+ 97, 44, 32, 83, 84,117,108, 41, 44, 32, 72,117,108, 32, 41, 59, 10,  9, 10,  9,100, 66,115, 32, 61, 32,104, 83, 99, 97,108,101,
+ 32, 42, 32, 40, 72,108,114, 32, 45, 32, 72,108,108, 41, 59, 10,  9,100, 66,116, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32,
+ 40, 72,117,108, 32, 45, 32, 72,108,108, 41, 59, 10,125, 10, 10, 35,105,102,100,101,102, 32, 66, 85, 77, 80, 95, 66, 73, 67, 85,
+ 66, 73, 67, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95, 98,105, 99,117, 98,105, 99, 40, 32,118,101, 99,
+ 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,102,108,111, 97,116, 32,104, 83,
+ 99, 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,111,117,116, 32,
+102,108,111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,116, 32, 41, 32, 10,123, 10,  9,102,
+108,111, 97,116, 32, 72,108, 59, 10,  9,102,108,111, 97,116, 32, 72,114, 59, 10,  9,102,108,111, 97,116, 32, 72,100, 59, 10,  9,
+102,108,111, 97,116, 32, 72,117, 59, 10,  9, 10,  9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100, 70,100,120, 40,116,
+101,120, 99,111, 46,120,121, 41, 59, 10,  9,118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100,121, 40,116,101,120,
+ 99,111, 46,120,121, 41, 59, 10, 32, 10,  9,118,101, 99, 50, 32, 83, 84,108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 45,
+ 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,120, 32, 59, 10,  9,118,101, 99, 50, 32, 83, 84,114, 32, 61, 32,116,101,120, 99,111,
+ 46,120,121, 32, 43, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,120, 32, 59, 10,  9,118,101, 99, 50, 32, 83, 84,100, 32, 61, 32,
+116,101,120, 99,111, 46,120,121, 32, 45, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,121, 32, 59, 10,  9,118,101, 99, 50, 32, 83,
+ 84,117, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,121, 32, 59, 10,  9, 10,
+  9,114,103, 98,116,111, 98,119, 40,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,108, 41, 44, 32, 72,108,
+ 41, 59, 10,  9,114,103, 98,116,111, 98,119, 40,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,114, 41, 44,
+ 32, 72,114, 41, 59, 10,  9,114,103, 98,116,111, 98,119, 40,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,
+100, 41, 44, 32, 72,100, 41, 59, 10,  9,114,103, 98,116,111, 98,119, 40,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44,
+ 32, 83, 84,117, 41, 44, 32, 72,117, 41, 59, 10,  9, 10,  9,118,101, 99, 50, 32,100, 72,100,120,121, 32, 61, 32,118,101, 99, 50,
+ 40, 72,114, 32, 45, 32, 72,108, 44, 32, 72,117, 32, 45, 32, 72,100, 41, 59, 10,  9,102,108,111, 97,116, 32,102, 66,108,101,110,
+100, 32, 61, 32, 99,108, 97,109,112, 40, 49, 46, 48, 45,116,101,120,116,117,114,101, 81,117,101,114,121, 76, 79, 68, 40,105,109,
+ 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 46,120, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,105,102, 40,102,
+ 66,108,101,110,100, 33, 61, 48, 46, 48, 41, 10,  9,123, 10,  9,  9, 47, 47, 32,116,104,101, 32,100,101,114,105,118, 97,116,105,
+118,101, 32,111,102, 32,116,104,101, 32, 98,105, 99,117, 98,105, 99, 32,115, 97,109,112,108,105,110,103, 32,111,102, 32,108,101,
+118,101,108, 32, 48, 10,  9,  9,105,118,101, 99, 50, 32,118, 68,105,109, 59, 10,  9,  9,118, 68,105,109, 32, 61, 32,116,101,120,
+116,117,114,101, 83,105,122,101, 40,105,109, 97, 44, 32, 48, 41, 59, 10, 10,  9,  9, 47, 47, 32,116, 97,107,105,110,103, 32,116,
+104,101, 32,102,114, 97, 99,116, 32,112, 97,114,116, 32,111,102, 32,116,104,101, 32,116,101,120,116,117,114,101, 32, 99,111,111,
+114,100,105,110, 97,116,101, 32,105,115, 32, 97, 32,104, 97,114,100, 99,111,100,101,100, 32,119,114, 97,112, 32,109,111,100,101,
+ 46, 10,  9,  9, 47, 47, 32,116,104,105,115, 32,105,115, 32, 97, 99, 99,101,112,116, 97, 98,108,101, 32, 97,115, 32,116,101,120,
+116,117,114,101,115, 32,117,115,101, 32,119,114, 97,112, 32,109,111,100,101, 32,101,120, 99,108,117,115,105,118,101,108,121, 32,
+105,110, 32, 51, 68, 32,118,105,101,119, 32,101,108,115,101,119,104,101,114,101, 32,105,110, 32, 98,108,101,110,100,101,114, 46,
+ 32, 10,  9,  9, 47, 47, 32,116,104,105,115, 32,105,115, 32,100,111,110,101, 32,115,111, 32,116,104, 97,116, 32,119,101, 32, 99,
+ 97,110, 32,115,116,105,108,108, 32,103,101,116, 32, 97, 32,118, 97,108,105,100, 32,116,101,120,101,108, 32,119,105,116,104, 32,
+117,118,115, 32,111,117,116,115,105,100,101, 32,116,104,101, 32, 48, 44, 49, 32,114, 97,110,103,101, 10,  9,  9, 47, 47, 32, 98,
+121, 32,116,101,120,101,108, 70,101,116, 99,104, 32, 98,101,108,111,119, 44, 32, 97,115, 32, 99,111,111,114,100,105,110, 97,116,
+101,115, 32, 97,114,101, 32, 99,108, 97,109,112,101,100, 32,119,104,101,110, 32,117,115,105,110,103, 32,116,104,105,115, 32,102,
+117,110, 99,116,105,111,110, 46, 10,  9,  9,118,101, 99, 50, 32,102, 84,101,120, 76,111, 99, 32, 61, 32,118, 68,105,109, 42,102,
+114, 97, 99,116, 40,116,101,120, 99,111, 46,120,121, 41, 32, 45, 32,118,101, 99, 50, 40, 48, 46, 53, 44, 32, 48, 46, 53, 41, 59,
+ 10,  9,  9,105,118,101, 99, 50, 32,105, 84,101,120, 76,111, 99, 32, 61, 32,105,118,101, 99, 50, 40,102,108,111,111,114, 40,102,
+ 84,101,120, 76,111, 99, 41, 41, 59, 10,  9,  9,118,101, 99, 50, 32,116, 32, 61, 32, 99,108, 97,109,112, 40,102, 84,101,120, 76,
+111, 99, 32, 45, 32,105, 84,101,120, 76,111, 99, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59,  9,  9, 47, 47, 32,115, 97,116,
+ 32,106,117,115,116, 32,116,111, 32, 98,101, 32,112,101,100, 97,110,116,105, 99, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42,
  42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
  42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
- 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 10, 32, 42, 32, 84,104,105,115, 32, 98,108,
-111, 99,107, 32,119,105,108,108, 32,114,101,112,108, 97, 99,101, 32,116,104,101, 32,111,110,101, 32, 98,101,108,111,119, 32,119,
-104,101,110, 32,111,110,101, 32, 99,104, 97,110,110,101,108, 32,116,101,120,116,117,114,101,115, 32, 97,114,101, 32,112,114,111,
-112,101,114,108,121, 32,115,117,112,112,111,114,116,101,100, 46, 32, 42, 10, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
+ 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 10, 32, 42, 32, 84,104,105,115, 32, 98,108,111, 99,107,
+ 32,119,105,108,108, 32,114,101,112,108, 97, 99,101, 32,116,104,101, 32,111,110,101, 32, 98,101,108,111,119, 32,119,104,101,110,
+ 32,111,110,101, 32, 99,104, 97,110,110,101,108, 32,116,101,120,116,117,114,101,115, 32, 97,114,101, 32,112,114,111,112,101,114,
+108,121, 32,115,117,112,112,111,114,116,101,100, 46, 32, 42, 10, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
  42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
  42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
- 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 10,  9,  9,118,101, 99, 52, 32,118, 83, 97,109,112,108,101,115, 85,
- 76, 32, 61, 32,116,101,120,116,117,114,101, 71, 97,116,104,101,114, 40,105,109, 97, 44, 32, 40,105, 84,101,120, 76,111, 99, 43,
-105,118,101, 99, 50, 40, 45, 49, 44, 45, 49, 41, 32, 43, 32,118,101, 99, 50, 40, 48, 46, 53, 44, 48, 46, 53, 41, 41, 47,118, 68,
-105,109, 32, 41, 59, 10,  9,  9,118,101, 99, 52, 32,118, 83, 97,109,112,108,101,115, 85, 82, 32, 61, 32,116,101,120,116,117,114,
-101, 71, 97,116,104,101,114, 40,105,109, 97, 44, 32, 40,105, 84,101,120, 76,111, 99, 43,105,118,101, 99, 50, 40, 49, 44, 45, 49,
- 41, 32, 43, 32,118,101, 99, 50, 40, 48, 46, 53, 44, 48, 46, 53, 41, 41, 47,118, 68,105,109, 32, 41, 59, 10,  9,  9,118,101, 99,
- 52, 32,118, 83, 97,109,112,108,101,115, 76, 76, 32, 61, 32,116,101,120,116,117,114,101, 71, 97,116,104,101,114, 40,105,109, 97,
- 44, 32, 40,105, 84,101,120, 76,111, 99, 43,105,118,101, 99, 50, 40, 45, 49, 44, 49, 41, 32, 43, 32,118,101, 99, 50, 40, 48, 46,
- 53, 44, 48, 46, 53, 41, 41, 47,118, 68,105,109, 32, 41, 59, 10,  9,  9,118,101, 99, 52, 32,118, 83, 97,109,112,108,101,115, 76,
- 82, 32, 61, 32,116,101,120,116,117,114,101, 71, 97,116,104,101,114, 40,105,109, 97, 44, 32, 40,105, 84,101,120, 76,111, 99, 43,
-105,118,101, 99, 50, 40, 49, 44, 49, 41, 32, 43, 32,118,101, 99, 50, 40, 48, 46, 53, 44, 48, 46, 53, 41, 41, 47,118, 68,105,109,
- 32, 41, 59, 10, 10,  9,  9,109, 97,116, 52, 32, 72, 32, 61, 32,109, 97,116, 52, 40,118, 83, 97,109,112,108,101,115, 85, 76, 46,
-119, 44, 32,118, 83, 97,109,112,108,101,115, 85, 76, 46,120, 44, 32,118, 83, 97,109,112,108,101,115, 76, 76, 46,119, 44, 32,118,
- 83, 97,109,112,108,101,115, 76, 76, 46,120, 44, 10,  9,  9,  9,  9,  9,118, 83, 97,109,112,108,101,115, 85, 76, 46,122, 44, 32,
-118, 83, 97,109,112,108,101,115, 85, 76, 46,121, 44, 32,118, 83, 97,109,112,108,101,115, 76, 76, 46,122, 44, 32,118, 83, 97,109,
-112,108,101,115, 76, 76, 46,121, 44, 10,  9,  9,  9,  9,  9,118, 83, 97,109,112,108,101,115, 85, 82, 46,119, 44, 32,118, 83, 97,
-109,112,108,101,115, 85, 82, 46,120, 44, 32,118, 83, 97,109,112,108,101,115, 76, 82, 46,119, 44, 32,118, 83, 97,109,112,108,101,
-115, 76, 82, 46,120, 44, 10,  9,  9,  9,  9,  9,118, 83, 97,109,112,108,101,115, 85, 82, 46,122, 44, 32,118, 83, 97,109,112,108,
-101,115, 85, 82, 46,121, 44, 32,118, 83, 97,109,112,108,101,115, 76, 82, 46,122, 44, 32,118, 83, 97,109,112,108,101,115, 76, 82,
- 46,121, 41, 59, 10, 42, 47,  9, 10,  9,  9,105,118,101, 99, 50, 32,105, 84,101,120, 76,111, 99, 77,111,100, 32, 61, 32,105, 84,
-101,120, 76,111, 99, 32, 43, 32,105,118,101, 99, 50, 40, 45, 49, 44, 32, 45, 49, 41, 59, 10, 10,  9,  9,109, 97,116, 52, 32, 72,
- 59, 10,  9,  9, 10,  9,  9,102,111,114, 40,105,110,116, 32,105, 32, 61, 32, 48, 59, 32,105, 32, 60, 32, 52, 59, 32,105, 43, 43,
- 41,123, 10,  9,  9,  9,102,111,114, 40,105,110,116, 32,106, 32, 61, 32, 48, 59, 32,106, 32, 60, 32, 52, 59, 32,106, 43, 43, 41,
-123, 10,  9,  9,  9,  9,105,118,101, 99, 50, 32,105, 84,101,120, 84,109,112, 32, 61, 32,105, 84,101,120, 76,111, 99, 77,111,100,
- 32, 43, 32,105,118,101, 99, 50, 40,105, 44,106, 41, 59, 10,  9,  9,  9,  9, 10,  9,  9,  9,  9, 47, 47, 32,119,114, 97,112, 32,
-116,101,120,116,117,114,101, 32, 99,111,111,114,100,105,110, 97,116,101,115, 32,109, 97,110,117, 97,108,108,121, 32,102,111,114,
- 32,116,101,120,101,108, 70,101,116, 99,104, 32,116,111, 32,119,111,114,107, 32,111,110, 32,117,118,115, 32,111,105,116,115,105,
-100,101, 32,116,104,101, 32, 48, 44, 49, 32,114, 97,110,103,101, 46, 10,  9,  9,  9,  9, 47, 47, 32,116,104,105,115, 32,105,115,
- 32,103,117, 97,114, 97,110,116,101,101,100, 32,116,111, 32,119,111,114,107, 32,115,105,110, 99,101, 32,119,101, 32,116, 97,107,
-101, 32,116,104,101, 32,102,114, 97, 99,116,105,111,110, 97,108, 32,112, 97,114,116, 32,111,102, 32,116,104,101, 32,117,118, 32,
- 97, 98,111,118,101, 46, 10,  9,  9,  9,  9,105, 84,101,120, 84,109,112, 46,120, 32, 61, 32, 40,105, 84,101,120, 84,109,112, 46,
-120, 32, 60, 32, 48, 41, 63, 32,105, 84,101,120, 84,109,112, 46,120, 32, 43, 32,118, 68,105,109, 46,120, 32, 58, 32, 40, 40,105,
- 84,101,120, 84,109,112, 46,120, 32, 62, 61, 32,118, 68,105,109, 46,120, 41, 63, 32,105, 84,101,120, 84,109,112, 46,120, 32, 45,
- 32,118, 68,105,109, 46,120, 32, 58, 32,105, 84,101,120, 84,109,112, 46,120, 41, 59, 10,  9,  9,  9,  9,105, 84,101,120, 84,109,
-112, 46,121, 32, 61, 32, 40,105, 84,101,120, 84,109,112, 46,121, 32, 60, 32, 48, 41, 63, 32,105, 84,101,120, 84,109,112, 46,121,
- 32, 43, 32,118, 68,105,109, 46,121, 32, 58, 32, 40, 40,105, 84,101,120, 84,109,112, 46,121, 32, 62, 61, 32,118, 68,105,109, 46,
-121, 41, 63, 32,105, 84,101,120, 84,109,112, 46,121, 32, 45, 32,118, 68,105,109, 46,121, 32, 58, 32,105, 84,101,120, 84,109,112,
- 46,121, 41, 59, 10, 10,  9,  9,  9,  9,114,103, 98,116,111, 98,119, 40,116,101,120,101,108, 70,101,116, 99,104, 40,105,109, 97,
- 44, 32,105, 84,101,120, 84,109,112, 44, 32, 48, 41, 44, 32, 72, 91,105, 93, 91,106, 93, 41, 59, 10,  9,  9,  9,125, 10,  9,  9,
-125, 10,  9,  9, 10,  9,  9,102,108,111, 97,116, 32,120, 32, 61, 32,116, 46,120, 44, 32,121, 32, 61, 32,116, 46,121, 59, 10,  9,
-  9,102,108,111, 97,116, 32,120, 50, 32, 61, 32,120, 32, 42, 32,120, 44, 32,120, 51, 32, 61, 32,120, 50, 32, 42, 32,120, 44, 32,
-121, 50, 32, 61, 32,121, 32, 42, 32,121, 44, 32,121, 51, 32, 61, 32,121, 50, 32, 42, 32,121, 59, 10, 10,  9,  9,118,101, 99, 52,
- 32, 88, 32, 61, 32,118,101, 99, 52, 40, 45, 48, 46, 53, 42, 40,120, 51, 43,120, 41, 43,120, 50, 44,  9,  9, 49, 46, 53, 42,120,
- 51, 45, 50, 46, 53, 42,120, 50, 43, 49, 44,  9, 45, 49, 46, 53, 42,120, 51, 43, 50, 42,120, 50, 43, 48, 46, 53, 42,120, 44,  9,
-  9, 48, 46, 53, 42, 40,120, 51, 45,120, 50, 41, 41, 59, 10,  9,  9,118,101, 99, 52, 32, 89, 32, 61, 32,118,101, 99, 52, 40, 45,
- 48, 46, 53, 42, 40,121, 51, 43,121, 41, 43,121, 50, 44,  9,  9, 49, 46, 53, 42,121, 51, 45, 50, 46, 53, 42,121, 50, 43, 49, 44,
-  9, 45, 49, 46, 53, 42,121, 51, 43, 50, 42,121, 50, 43, 48, 46, 53, 42,121, 44,  9,  9, 48, 46, 53, 42, 40,121, 51, 45,121, 50,
- 41, 41, 59, 10,  9,  9,118,101, 99, 52, 32,100, 88, 32, 61, 32,118,101, 99, 52, 40, 45, 49, 46, 53, 42,120, 50, 43, 50, 42,120,
- 45, 48, 46, 53, 44,  9,  9, 52, 46, 53, 42,120, 50, 45, 53, 42,120, 44,  9,  9,  9, 45, 52, 46, 53, 42,120, 50, 43, 52, 42,120,
- 43, 48, 46, 53, 44,  9,  9, 49, 46, 53, 42,120, 50, 45,120, 41, 59, 10,  9,  9,118,101, 99, 52, 32,100, 89, 32, 61, 32,118,101,
- 99, 52, 40, 45, 49, 46, 53, 42,121, 50, 43, 50, 42,121, 45, 48, 46, 53, 44,  9,  9, 52, 46, 53, 42,121, 50, 45, 53, 42,121, 44,
-  9,  9,  9, 45, 52, 46, 53, 42,121, 50, 43, 52, 42,121, 43, 48, 46, 53, 44,  9,  9, 49, 46, 53, 42,121, 50, 45,121, 41, 59, 10,
-  9, 10,  9,  9, 47, 47, 32, 99,111,109,112,108,101,116,101, 32,100,101,114,105,118, 97,116,105,118,101, 32,105,110, 32,110,111,
-114,109, 97,108,105,122,101,100, 32, 99,111,111,114,100,105,110, 97,116,101,115, 32, 40,109,117,108, 32, 98,121, 32,118, 68,105,
-109, 41, 10,  9,  9,118,101, 99, 50, 32,100, 72,100, 83, 84, 32, 61, 32,118, 68,105,109, 32, 42, 32,118,101, 99, 50, 40,100,111,
-116, 40, 89, 44, 32, 72, 32, 42, 32,100, 88, 41, 44, 32,100,111,116, 40,100, 89, 44, 32, 72, 32, 42, 32, 88, 41, 41, 59, 10, 10,
-  9,  9, 47, 47, 32,116,114, 97,110,115,102,111,114,109, 32,100,101,114,105,118, 97,116,105,118,101, 32,116,111, 32,115, 99,114,
-101,101,110, 45,115,112, 97, 99,101, 10,  9,  9,118,101, 99, 50, 32,100, 72,100,120,121, 95, 98,105, 99,117, 98,105, 99, 32, 61,
- 32,118,101, 99, 50, 40, 32,100, 72,100, 83, 84, 46,120, 32, 42, 32, 84,101,120, 68,120, 46,120, 32, 43, 32,100, 72,100, 83, 84,
- 46,121, 32, 42, 32, 84,101,120, 68,120, 46,121, 44, 10,  9,  9,  9,  9,  9,  9,  9,  9, 32, 32, 32,100, 72,100, 83, 84, 46,120,
- 32, 42, 32, 84,101,120, 68,121, 46,120, 32, 43, 32,100, 72,100, 83, 84, 46,121, 32, 42, 32, 84,101,120, 68,121, 46,121, 32, 41,
- 59, 10, 10,  9,  9, 47, 47, 32, 98,108,101,110,100, 32, 98,101,116,119,101,101,110, 32,116,104,101, 32,116,119,111, 10,  9,  9,
-100, 72,100,120,121, 32, 61, 32,100, 72,100,120,121, 42, 40, 49, 45,102, 66,108,101,110,100, 41, 32, 43, 32,100, 72,100,120,121,
- 95, 98,105, 99,117, 98,105, 99, 42,102, 66,108,101,110,100, 59, 10,  9,125, 10, 10,  9,100, 66,115, 32, 61, 32,104, 83, 99, 97,
-108,101, 32, 42, 32,100, 72,100,120,121, 46,120, 59, 10,  9,100, 66,116, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32,100, 72,
-100,120,121, 46,121, 59, 10,125, 10, 10, 35,101,110,100,105,102, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112,
- 95,116, 97,112, 53, 40, 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97,
- 44, 32,102,108,111, 97,116, 32,104, 83, 99, 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
- 32, 32, 32, 32, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100,
- 66,116, 32, 41, 32, 10,123, 10,  9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100, 70,100,120, 40,116,101,120, 99,111,
+ 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 10,  9,  9,118,101, 99, 52, 32,118, 83, 97,109,112,108,101,115, 85, 76, 32, 61,
+ 32,116,101,120,116,117,114,101, 71, 97,116,104,101,114, 40,105,109, 97, 44, 32, 40,105, 84,101,120, 76,111, 99, 43,105,118,101,
+ 99, 50, 40, 45, 49, 44, 45, 49, 41, 32, 43, 32,118,101, 99, 50, 40, 48, 46, 53, 44, 48, 46, 53, 41, 41, 47,118, 68,105,109, 32,
+ 41, 59, 10,  9,  9,118,101, 99, 52, 32,118, 83, 97,109,112,108,101,115, 85, 82, 32, 61, 32,116,101,120,116,117,114,101, 71, 97,
+116,104,101,114, 40,105,109, 97, 44, 32, 40,105, 84,101,120, 76,111, 99, 43,105,118,101, 99, 50, 40, 49, 44, 45, 49, 41, 32, 43,
+ 32,118,101, 99, 50, 40, 48, 46, 53, 44, 48, 46, 53, 41, 41, 47,118, 68,105,109, 32, 41, 59, 10,  9,  9,118,101, 99, 52, 32,118,
+ 83, 97,109,112,108,101,115, 76, 76, 32, 61, 32,116,101,120,116,117,114,101, 71, 97,116,104,101,114, 40,105,109, 97, 44, 32, 40,
+105, 84,101,120, 76,111, 99, 43,105,118,101, 99, 50, 40, 45, 49, 44, 49, 41, 32, 43, 32,118,101, 99, 50, 40, 48, 46, 53, 44, 48,
+ 46, 53, 41, 41, 47,118, 68,105,109, 32, 41, 59, 10,  9,  9,118,101, 99, 52, 32,118, 83, 97,109,112,108,101,115, 76, 82, 32, 61,
+ 32,116,101,120,116,117,114,101, 71, 97,116,104,101,114, 40,105,109, 97, 44, 32, 40,105, 84,101,120, 76,111, 99, 43,105,118,101,
+ 99, 50, 40, 49, 44, 49, 41, 32, 43, 32,118,101, 99, 50, 40, 48, 46, 53, 44, 48, 46, 53, 41, 41, 47,118, 68,105,109, 32, 41, 59,
+ 10, 10,  9,  9,109, 97,116, 52, 32, 72, 32, 61, 32,109, 97,116, 52, 40,118, 83, 97,109,112,108,101,115, 85, 76, 46,119, 44, 32,
+118, 83, 97,109,112,108,101,115, 85, 76, 46,120, 44, 32,118, 83, 97,109,112,108,101,115, 76, 76, 46,119, 44, 32,118, 83, 97,109,
+112,108,101,115, 76, 76, 46,120, 44, 10,  9,  9,  9,  9,  9,118, 83, 97,109,112,108,101,115, 85, 76, 46,122, 44, 32,118, 83, 97,
+109,112,108,101,115, 85, 76, 46,121, 44, 32,118, 83, 97,109,112,108,101,115, 76, 76, 46,122, 44, 32,118, 83, 97,109,112,108,101,
+115, 76, 76, 46,121, 44, 10,  9,  9,  9,  9,  9,118, 83, 97,109,112,108,101,115, 85, 82, 46,119, 44, 32,118, 83, 97,109,112,108,
+101,115, 85, 82, 46,120, 44, 32,118, 83, 97,109,112,108,101,115, 76, 82, 46,119, 44, 32,118, 83, 97,109,112,108,101,115, 76, 82,
+ 46,120, 44, 10,  9,  9,  9,  9,  9,118, 83, 97,109,112,108,101,115, 85, 82, 46,122, 44, 32,118, 83, 97,109,112,108,101,115, 85,
+ 82, 46,121, 44, 32,118, 83, 97,109,112,108,101,115, 76, 82, 46,122, 44, 32,118, 83, 97,109,112,108,101,115, 76, 82, 46,121, 41,
+ 59, 10, 42, 47,  9, 10,  9,  9,105,118,101, 99, 50, 32,105, 84,101,120, 76,111, 99, 77,111,100, 32, 61, 32,105, 84,101,120, 76,
+111, 99, 32, 43, 32,105,118,101, 99, 50, 40, 45, 49, 44, 32, 45, 49, 41, 59, 10, 10,  9,  9,109, 97,116, 52, 32, 72, 59, 10,  9,
+  9, 10,  9,  9,102,111,114, 40,105,110,116, 32,105, 32, 61, 32, 48, 59, 32,105, 32, 60, 32, 52, 59, 32,105, 43, 43, 41,123, 10,
+  9,  9,  9,102,111,114, 40,105,110,116, 32,106, 32, 61, 32, 48, 59, 32,106, 32, 60, 32, 52, 59, 32,106, 43, 43, 41,123, 10,  9,
+  9,  9,  9,105,118,101, 99, 50, 32,105, 84,101,120, 84,109,112, 32, 61, 32,105, 84,101,120, 76,111, 99, 77,111,100, 32, 43, 32,
+105,118,101, 99, 50, 40,105, 44,106, 41, 59, 10,  9,  9,  9,  9, 10,  9,  9,  9,  9, 47, 47, 32,119,114, 97,112, 32,116,101,120,
+116,117,114,101, 32, 99,111,111,114,100,105,110, 97,116,101,115, 32,109, 97,110,117, 97,108,108,121, 32,102,111,114, 32,116,101,
+120,101,108, 70,101,116, 99,104, 32,116,111, 32,119,111,114,107, 32,111,110, 32,117,118,115, 32,111,105,116,115,105,100,101, 32,
+116,104,101, 32, 48, 44, 49, 32,114, 97,110,103,101, 46, 10,  9,  9,  9,  9, 47, 47, 32,116,104,105,115, 32,105,115, 32,103,117,
+ 97,114, 97,110,116,101,101,100, 32,116,111, 32,119,111,114,107, 32,115,105,110, 99,101, 32,119,101, 32,116, 97,107,101, 32,116,
+104,101, 32,102,114, 97, 99,116,105,111,110, 97,108, 32,112, 97,114,116, 32,111,102, 32,116,104,101, 32,117,118, 32, 97, 98,111,
+118,101, 46, 10,  9,  9,  9,  9,105, 84,101,120, 84,109,112, 46,120, 32, 61, 32, 40,105, 84,101,120, 84,109,112, 46,120, 32, 60,
+ 32, 48, 41, 63, 32,105, 84,101,120, 84,109,112, 46,120, 32, 43, 32,118, 68,105,109, 46,120, 32, 58, 32, 40, 40,105, 84,101,120,
+ 84,109,112, 46,120, 32, 62, 61, 32,118, 68,105,109, 46,120, 41, 63, 32,105, 84,101,120, 84,109,112, 46,120, 32, 45, 32,118, 68,
+105,109, 46,120, 32, 58, 32,105, 84,101,120, 84,109,112, 46,120, 41, 59, 10,  9,  9,  9,  9,105, 84,101,120, 84,109,112, 46,121,
+ 32, 61, 32, 40,105, 84,101,120, 84,109,112, 46,121, 32, 60, 32, 48, 41, 63, 32,105, 84,101,120, 84,109,112, 46,121, 32, 43, 32,
+118, 68,105,109, 46,121, 32, 58, 32, 40, 40,105, 84,101,120, 84,109,112, 46,121, 32, 62, 61, 32,118, 68,105,109, 46,121, 41, 63,
+ 32,105, 84,101,120, 84,109,112, 46,121, 32, 45, 32,118, 68,105,109, 46,121, 32, 58, 32,105, 84,101,120, 84,109,112, 46,121, 41,
+ 59, 10, 10,  9,  9,  9,  9,114,103, 98,116,111, 98,119, 40,116,101,120,101,108, 70,101,116, 99,104, 40,105,109, 97, 44, 32,105,
+ 84,101,120, 84,109,112, 44, 32, 48, 41, 44, 32, 72, 91,105, 93, 91,106, 93, 41, 59, 10,  9,  9,  9,125, 10,  9,  9,125, 10,  9,
+  9, 10,  9,  9,102,108,111, 97,116, 32,120, 32, 61, 32,116, 46,120, 44, 32,121, 32, 61, 32,116, 46,121, 59, 10,  9,  9,102,108,
+111, 97,116, 32,120, 50, 32, 61, 32,120, 32, 42, 32,120, 44, 32,120, 51, 32, 61, 32,120, 50, 32, 42, 32,120, 44, 32,121, 50, 32,
+ 61, 32,121, 32, 42, 32,121, 44, 32,121, 51, 32, 61, 32,121, 50, 32, 42, 32,121, 59, 10, 10,  9,  9,118,101, 99, 52, 32, 88, 32,
+ 61, 32,118,101, 99, 52, 40, 45, 48, 46, 53, 42, 40,120, 51, 43,120, 41, 43,120, 50, 44,  9,  9, 49, 46, 53, 42,120, 51, 45, 50,
+ 46, 53, 42,120, 50, 43, 49, 44,  9, 45, 49, 46, 53, 42,120, 51, 43, 50, 42,120, 50, 43, 48, 46, 53, 42,120, 44,  9,  9, 48, 46,
+ 53, 42, 40,120, 51, 45,120, 50, 41, 41, 59, 10,  9,  9,118,101, 99, 52, 32, 89, 32, 61, 32,118,101, 99, 52, 40, 45, 48, 46, 53,
+ 42, 40,121, 51, 43,121, 41, 43,121, 50, 44,  9,  9, 49, 46, 53, 42,121, 51, 45, 50, 46, 53, 42,121, 50, 43, 49, 44,  9, 45, 49,
+ 46, 53, 42,121, 51, 43, 50, 42,121, 50, 43, 48, 46, 53, 42,121, 44,  9,  9, 48, 46, 53, 42, 40,121, 51, 45,121, 50, 41, 41, 59,
+ 10,  9,  9,118,101, 99, 52, 32,100, 88, 32, 61, 32,118,101, 99, 52, 40, 45, 49, 46, 53, 42,120, 50, 43, 50, 42,120, 45, 48, 46,
+ 53, 44,  9,  9, 52, 46, 53, 42,120, 50, 45, 53, 42,120, 44,  9,  9,  9, 45, 52, 46, 53, 42,120, 50, 43, 52, 42,120, 43, 48, 46,
+ 53, 44,  9,  9, 49, 46, 53, 42,120, 50, 45,120, 41, 59, 10,  9,  9,118,101, 99, 52, 32,100, 89, 32, 61, 32,118,101, 99, 52, 40,
+ 45, 49, 46, 53, 42,121, 50, 43, 50, 42,121, 45, 48, 46, 53, 44,  9,  9, 52, 46, 53, 42,121, 50, 45, 53, 42,121, 44,  9,  9,  9,
+ 45, 52, 46, 53, 42,121, 50, 43, 52, 42,121, 43, 48, 46, 53, 44,  9,  9, 49, 46, 53, 42,121, 50, 45,121, 41, 59, 10,  9, 10,  9,
+  9, 47, 47, 32, 99,111,109,112,108,101,116,101, 32,100,101,114,105,118, 97,116,105,118,101, 32,105,110, 32,110,111,114,109, 97,
+108,105,122,101,100, 32, 99,111,111,114,100,105,110, 97,116,101,115, 32, 40,109,117,108, 32, 98,121, 32,118, 68,105,109, 41, 10,
+  9,  9,118,101, 99, 50, 32,100, 72,100, 83, 84, 32, 61, 32,118, 68,105,109, 32, 42, 32,118,101, 99, 50, 40,100,111,116, 40, 89,
+ 44, 32, 72, 32, 42, 32,100, 88, 41, 44, 32,100,111,116, 40,100, 89, 44, 32, 72, 32, 42, 32, 88, 41, 41, 59, 10, 10,  9,  9, 47,
+ 47, 32,116,114, 97,110,115,102,111,114,109, 32,100,101,114,105,118, 97,116,105,118,101, 32,116,111, 32,115, 99,114,101,101,110,
+ 45,115,112, 97, 99,101, 10,  9,  9,118,101, 99, 50, 32,100, 72,100,120,121, 95, 98,105, 99,117, 98,105, 99, 32, 61, 32,118,101,
+ 99, 50, 40, 32,100, 72,100, 83, 84, 46,120, 32, 42, 32, 84,101,120, 68,120, 46,120, 32, 43, 32,100, 72,100, 83, 84, 46,121, 32,
+ 42, 32, 84,101,120, 68,120, 46,121, 44, 10,  9,  9,  9,  9,  9,  9,  9,  9, 32, 32, 32,100, 72,100, 83, 84, 46,120, 32, 42, 32,
+ 84,101,120, 68,121, 46,120, 32, 43, 32,100, 72,100, 83, 84, 46,121, 32, 42, 32, 84,101,120, 68,121, 46,121, 32, 41, 59, 10, 10,
+  9,  9, 47, 47, 32, 98,108,101,110,100, 32, 98,101,116,119,101,101,110, 32,116,104,101, 32,116,119,111, 10,  9,  9,100, 72,100,
+120,121, 32, 61, 32,100, 72,100,120,121, 42, 40, 49, 45,102, 66,108,101,110,100, 41, 32, 43, 32,100, 72,100,120,121, 95, 98,105,
+ 99,117, 98,105, 99, 42,102, 66,108,101,110,100, 59, 10,  9,125, 10, 10,  9,100, 66,115, 32, 61, 32,104, 83, 99, 97,108,101, 32,
+ 42, 32,100, 72,100,120,121, 46,120, 59, 10,  9,100, 66,116, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32,100, 72,100,120,121,
+ 46,121, 59, 10,125, 10, 10, 35,101,110,100,105,102, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95,116, 97,
+112, 53, 40, 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,102,
+108,111, 97,116, 32,104, 83, 99, 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,116, 32,
+ 41, 32, 10,123, 10,  9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100, 70,100,120, 40,116,101,120, 99,111, 46,120,121,
+ 41, 59, 10,  9,118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100,121, 40,116,101,120, 99,111, 46,120,121, 41, 59,
+ 10, 10,  9,118,101, 99, 50, 32, 83, 84, 99, 32, 61, 32,116,101,120, 99,111, 46,120,121, 59, 10,  9,118,101, 99, 50, 32, 83, 84,
+108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 45, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,120, 32, 59, 10,  9,118,101,
+ 99, 50, 32, 83, 84,114, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,120, 32,
+ 59, 10,  9,118,101, 99, 50, 32, 83, 84,100, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 45, 32, 48, 46, 53, 32, 42, 32, 84,
+101,120, 68,121, 32, 59, 10,  9,118,101, 99, 50, 32, 83, 84,117, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32, 48, 46,
+ 53, 32, 42, 32, 84,101,120, 68,121, 32, 59, 10,  9, 10,  9,102,108,111, 97,116, 32, 72, 99, 44, 72,108, 44, 72,114, 44, 72,100,
+ 44, 72,117, 59, 10,  9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,
+ 99, 41, 44, 32, 72, 99, 32, 41, 59, 10,  9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109,
+ 97, 44, 32, 83, 84,108, 41, 44, 32, 72,108, 32, 41, 59, 10,  9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101,
+ 50, 68, 40,105,109, 97, 44, 32, 83, 84,114, 41, 44, 32, 72,114, 32, 41, 59, 10,  9,114,103, 98,116,111, 98,119, 40, 32,116,101,
+120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,100, 41, 44, 32, 72,100, 32, 41, 59, 10,  9,114,103, 98,116,111, 98,
+119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,117, 41, 44, 32, 72,117, 32, 41, 59, 10,  9, 10,
+  9,100, 66,115, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,114, 32, 45, 32, 72,108, 41, 59, 10,  9,100, 66,116, 32,
+ 61, 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,117, 32, 45, 32, 72,100, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,
+101,120, 95, 98,117,109,112, 95,100,101,114,105,118, 40, 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,109,112,108,
+101,114, 50, 68, 32,105,109, 97, 44, 32,102,108,111, 97,116, 32,105,109, 97, 95,120, 44, 32,102,108,111, 97,116, 32,105,109, 97,
+ 95,121, 44, 32,102,108,111, 97,116, 32,104, 83, 99, 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,111, 97,116,
+ 32,100, 66,116, 32, 41, 32, 10,123, 10,  9,102,108,111, 97,116, 32,115, 32, 61, 32, 49, 46, 48, 59,  9,  9, 47, 47, 32,110,101,
+103, 97,116,101, 32,116,104,105,115, 32,105,102, 32,102,108,105,112,112,101,100, 32,116,101,120,116,117,114,101, 32, 99,111,111,
+114,100,105,110, 97,116,101, 10,  9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100, 70,100,120, 40,116,101,120, 99,111,
  46,120,121, 41, 59, 10,  9,118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100,121, 40,116,101,120, 99,111, 46,120,
-121, 41, 59, 10, 10,  9,118,101, 99, 50, 32, 83, 84, 99, 32, 61, 32,116,101,120, 99,111, 46,120,121, 59, 10,  9,118,101, 99, 50,
- 32, 83, 84,108, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 45, 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,120, 32, 59, 10,
-  9,118,101, 99, 50, 32, 83, 84,114, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43, 32, 48, 46, 53, 32, 42, 32, 84,101,120,
- 68,120, 32, 59, 10,  9,118,101, 99, 50, 32, 83, 84,100, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 45, 32, 48, 46, 53, 32,
- 42, 32, 84,101,120, 68,121, 32, 59, 10,  9,118,101, 99, 50, 32, 83, 84,117, 32, 61, 32,116,101,120, 99,111, 46,120,121, 32, 43,
- 32, 48, 46, 53, 32, 42, 32, 84,101,120, 68,121, 32, 59, 10,  9, 10,  9,102,108,111, 97,116, 32, 72, 99, 44, 72,108, 44, 72,114,
- 44, 72,100, 44, 72,117, 59, 10,  9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44,
- 32, 83, 84, 99, 41, 44, 32, 72, 99, 32, 41, 59, 10,  9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68,
- 40,105,109, 97, 44, 32, 83, 84,108, 41, 44, 32, 72,108, 32, 41, 59, 10,  9,114,103, 98,116,111, 98,119, 40, 32,116,101,120,116,
-117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,114, 41, 44, 32, 72,114, 32, 41, 59, 10,  9,114,103, 98,116,111, 98,119, 40,
- 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,100, 41, 44, 32, 72,100, 32, 41, 59, 10,  9,114,103, 98,
-116,111, 98,119, 40, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 83, 84,117, 41, 44, 32, 72,117, 32, 41, 59,
- 10,  9, 10,  9,100, 66,115, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,114, 32, 45, 32, 72,108, 41, 59, 10,  9,100,
- 66,116, 32, 61, 32,104, 83, 99, 97,108,101, 32, 42, 32, 40, 72,117, 32, 45, 32, 72,100, 41, 59, 10,125, 10, 10,118,111,105,100,
- 32,109,116,101,120, 95, 98,117,109,112, 95,100,101,114,105,118, 40, 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,115, 97,
-109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,102,108,111, 97,116, 32,105,109, 97, 95,120, 44, 32,102,108,111, 97,116, 32,
-105,109, 97, 95,121, 44, 32,102,108,111, 97,116, 32,104, 83, 99, 97,108,101, 44, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
- 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,111,117,116, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,111,117,116, 32,102,108,
-111, 97,116, 32,100, 66,116, 32, 41, 32, 10,123, 10,  9,102,108,111, 97,116, 32,115, 32, 61, 32, 49, 46, 48, 59,  9,  9, 47, 47,
- 32,110,101,103, 97,116,101, 32,116,104,105,115, 32,105,102, 32,102,108,105,112,112,101,100, 32,116,101,120,116,117,114,101, 32,
- 99,111,111,114,100,105,110, 97,116,101, 10,  9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100, 70,100,120, 40,116,101,
-120, 99,111, 46,120,121, 41, 59, 10,  9,118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100,121, 40,116,101,120, 99,
-111, 46,120,121, 41, 59, 10,  9, 10,  9, 47, 47, 32,116,104,105,115, 32,118, 97,114,105, 97,110,116, 32,117,115,105,110,103, 32,
- 97, 32,100,101,114,105,118, 97,116,105,118,101, 32,109, 97,112, 32,105,115, 32,100,101,115, 99,114,105, 98,101,100, 32,104,101,
-114,101, 10,  9, 47, 47, 32,104,116,116,112, 58, 47, 47,109,109,105,107,107,101,108,115,101,110, 51,100, 46, 98,108,111,103,115,
-112,111,116, 46, 99,111,109, 47, 50, 48, 49, 49, 47, 48, 55, 47,100,101,114,105,118, 97,116,105,118,101, 45,109, 97,112,115, 46,
-104,116,109,108, 10,  9,118,101, 99, 50, 32,100,105,109, 32, 61, 32,118,101, 99, 50, 40,105,109, 97, 95,120, 44, 32,105,109, 97,
- 95,121, 41, 59, 10,  9,118,101, 99, 50, 32,100, 66,100,117,118, 32, 61, 32,104, 83, 99, 97,108,101, 42,100,105,109, 42, 40, 50,
- 46, 48, 42,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 46,120,121, 45, 49,
- 46, 48, 41, 59, 10,  9, 10,  9,100, 66,115, 32, 61, 32,100, 66,100,117,118, 46,120, 42, 84,101,120, 68,120, 46,120, 32, 43, 32,
-115, 42,100, 66,100,117,118, 46,121, 42, 84,101,120, 68,120, 46,121, 59, 10,  9,100, 66,116, 32, 61, 32,100, 66,100,117,118, 46,
-120, 42, 84,101,120, 68,121, 46,120, 32, 43, 32,115, 42,100, 66,100,117,118, 46,121, 42, 84,101,120, 68,121, 46,121, 59, 10,125,
- 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95, 97,112,112,108,121, 40, 32,102,108,111, 97,116, 32,102, 68,
-101,116, 44, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,102,108,111, 97,116, 32,100, 66,116, 44, 32,118,101, 99, 51, 32,118,
- 82, 49, 44, 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10,  9,  9,  9,
-  9,  9, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51,
- 32,112,101,114,116,117,114, 98,101,100, 95,110,111,114,109, 32, 41, 32, 10,123, 10,  9,118,101, 99, 51, 32,118, 83,117,114,102,
- 71,114, 97,100, 32, 61, 32,115,105,103,110, 40,102, 68,101,116, 41, 32, 42, 32, 40, 32,100, 66,115, 32, 42, 32,118, 82, 49, 32,
- 43, 32,100, 66,116, 32, 42, 32,118, 82, 50, 32, 41, 59, 10,  9, 10,  9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78,
- 97, 99, 99, 95,105,110, 32, 45, 32,118, 83,117,114,102, 71,114, 97,100, 59, 10,  9,112,101,114,116,117,114, 98,101,100, 95,110,
-111,114,109, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32,118, 78, 97, 99, 99, 95,111,117,116, 32, 41, 59, 10,125, 10,
- 10,118,111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95, 97,112,112,108,121, 95,116,101,120,115,112, 97, 99,101, 40, 32,
-102,108,111, 97,116, 32,102, 68,101,116, 44, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,102,108,111, 97,116, 32,100, 66,116,
- 44, 32,118,101, 99, 51, 32,118, 82, 49, 44, 32,118,101, 99, 51, 32,118, 82, 50, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
- 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,
-109, 97, 44, 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,102,108,111, 97,116, 32,105,109, 97, 95,120, 44, 32,102,108,111,
- 97,116, 32,105,109, 97, 95,121, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10,  9,  9,  9,  9,  9,  9,  9,
- 32, 32, 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,
-112,101,114,116,117,114, 98,101,100, 95,110,111,114,109, 32, 41, 32, 10,123, 10,  9,118,101, 99, 50, 32, 84,101,120, 68,120, 32,
- 61, 32,100, 70,100,120, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10,  9,118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,
-100, 70,100,121, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10, 10,  9,118,101, 99, 51, 32,118, 83,117,114,102, 71,114, 97,100,
- 32, 61, 32,115,105,103,110, 40,102, 68,101,116, 41, 32, 42, 32, 40, 32, 10,  9, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-100, 66,115, 32, 47, 32,108,101,110,103,116,104, 40, 32,118,101, 99, 50, 40,105,109, 97, 95,120, 42, 84,101,120, 68,120, 46,120,
- 44, 32,105,109, 97, 95,121, 42, 84,101,120, 68,120, 46,121, 41, 32, 41, 32, 42, 32,118, 82, 49, 32, 43, 32, 10,  9, 32, 32, 32,
- 32, 32, 32, 32, 32, 32, 32, 32, 32,100, 66,116, 32, 47, 32,108,101,110,103,116,104, 40, 32,118,101, 99, 50, 40,105,109, 97, 95,
-120, 42, 84,101,120, 68,121, 46,120, 44, 32,105,109, 97, 95,121, 42, 84,101,120, 68,121, 46,121, 41, 32, 41, 32, 42, 32,118, 82,
- 50, 32, 41, 59, 10,  9,  9,  9,  9, 10,  9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110, 32,
- 45, 32,118, 83,117,114,102, 71,114, 97,100, 59, 10,  9,112,101,114,116,117,114, 98,101,100, 95,110,111,114,109, 32, 61, 32,110,
-111,114,109, 97,108,105,122,101, 40, 32,118, 78, 97, 99, 99, 95,111,117,116, 32, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,
-116,101,120, 95,110,101,103, 97,116,101, 95,116,101,120,110,111,114,109, 97,108, 40,118,101, 99, 51, 32,110,111,114,109, 97,108,
- 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10,123, 10,  9,111,117,116,110,111,114,109,
- 97,108, 32, 61, 32,118,101, 99, 51, 40, 45,110,111,114,109, 97,108, 46,120, 44, 32, 45,110,111,114,109, 97,108, 46,121, 44, 32,
-110,111,114,109, 97,108, 46,122, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,110,115,112, 97, 99,101, 95,116,
- 97,110,103,101,110,116, 40,118,101, 99, 52, 32,116, 97,110,103,101,110,116, 44, 32,118,101, 99, 51, 32,110,111,114,109, 97,108,
- 44, 32,118,101, 99, 51, 32,116,101,120,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,
-114,109, 97,108, 41, 10,123, 10,  9,118,101, 99, 51, 32, 66, 32, 61, 32,116, 97,110,103,101,110,116, 46,119, 32, 42, 32, 99,114,
-111,115,115, 40,110,111,114,109, 97,108, 44, 32,116, 97,110,103,101,110,116, 46,120,121,122, 41, 59, 10, 10,  9,111,117,116,110,
-111,114,109, 97,108, 32, 61, 32,116,101,120,110,111,114,109, 97,108, 46,120, 42,116, 97,110,103,101,110,116, 46,120,121,122, 32,
- 43, 32,116,101,120,110,111,114,109, 97,108, 46,121, 42, 66, 32, 43, 32,116,101,120,110,111,114,109, 97,108, 46,122, 42,110,111,
-114,109, 97,108, 59, 10,  9,111,117,116,110,111,114,109, 97,108, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,111,117,116,
-110,111,114,109, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,108,101,110,100, 95,110,111,114,109,
- 97,108, 40,102,108,111, 97,116, 32,110,111,114,102, 97, 99, 44, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,118,101,
- 99, 51, 32,110,101,119,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114,109, 97,108,
- 41, 10,123, 10,  9,111,117,116,110,111,114,109, 97,108, 32, 61, 32, 40, 49, 46, 48, 32, 45, 32,110,111,114,102, 97, 99, 41, 42,
-110,111,114,109, 97,108, 32, 43, 32,110,111,114,102, 97, 99, 42,110,101,119,110,111,114,109, 97,108, 59, 10,  9,111,117,116,110,
-111,114,109, 97,108, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,111,117,116,110,111,114,109, 97,108, 41, 59, 10,125, 10,
- 10, 47, 42, 42, 42, 42, 42, 42, 42, 32, 77, 65, 84, 69, 82, 73, 65, 76, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,
-111,105,100, 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,115,117,110, 95,104,101,109,105, 40,118,101, 99,
- 51, 32,108, 97,109,112,118,101, 99, 44, 32,111,117,116, 32,118,101, 99, 51, 32,108,118, 44, 32,111,117,116, 32,102,108,111, 97,
-116, 32,100,105,115,116, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 41, 10,123, 10,  9,108,118,
- 32, 61, 32,108, 97,109,112,118,101, 99, 59, 10,  9,100,105,115,116, 32, 61, 32, 49, 46, 48, 59, 10,  9,118,105,115,105,102, 97,
- 99, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121,
- 95,111,116,104,101,114, 40,118,101, 99, 51, 32, 99,111, 44, 32,118,101, 99, 51, 32,108, 97,109,112, 99,111, 44, 32,111,117,116,
- 32,118,101, 99, 51, 32,108,118, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,111,117,116, 32,102,108,
-111, 97,116, 32,118,105,115,105,102, 97, 99, 41, 10,123, 10,  9,108,118, 32, 61, 32, 99,111, 32, 45, 32,108, 97,109,112, 99,111,
- 59, 10,  9,100,105,115,116, 32, 61, 32,108,101,110,103,116,104, 40,108,118, 41, 59, 10,  9,108,118, 32, 61, 32,110,111,114,109,
- 97,108,105,122,101, 40,108,118, 41, 59, 10,  9,118,105,115,105,102, 97, 99, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,
-105,100, 32,108, 97,109,112, 95,102, 97,108,108,111,102,102, 95,105,110,118,108,105,110,101, 97,114, 40,102,108,111, 97,116, 32,
-108, 97,109,112,100,105,115,116, 44, 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,
-118,105,115,105,102, 97, 99, 41, 10,123, 10,  9,118,105,115,105,102, 97, 99, 32, 61, 32,108, 97,109,112,100,105,115,116, 47, 40,
-108, 97,109,112,100,105,115,116, 32, 43, 32,100,105,115,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,102,
- 97,108,108,111,102,102, 95,105,110,118,115,113,117, 97,114,101, 40,102,108,111, 97,116, 32,108, 97,109,112,100,105,115,116, 44,
- 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 41, 10,
-123, 10,  9,118,105,115,105,102, 97, 99, 32, 61, 32,108, 97,109,112,100,105,115,116, 47, 40,108, 97,109,112,100,105,115,116, 32,
- 43, 32,100,105,115,116, 42,100,105,115,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,102, 97,108,108,111,
-102,102, 95,115,108,105,100,101,114,115, 40,102,108,111, 97,116, 32,108, 97,109,112,100,105,115,116, 44, 32,102,108,111, 97,116,
- 32,108,100, 49, 44, 32,102,108,111, 97,116, 32,108,100, 50, 44, 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,111,117,116,
- 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 41, 10,123, 10,  9,102,108,111, 97,116, 32,108, 97,109,112,100,105,115,
-116,107,119, 32, 61, 32,108, 97,109,112,100,105,115,116, 42,108, 97,109,112,100,105,115,116, 59, 10, 10,  9,118,105,115,105,102,
- 97, 99, 32, 61, 32,108, 97,109,112,100,105,115,116, 47, 40,108, 97,109,112,100,105,115,116, 32, 43, 32,108,100, 49, 42,100,105,
-115,116, 41, 59, 10,  9,118,105,115,105,102, 97, 99, 32, 42, 61, 32,108, 97,109,112,100,105,115,116,107,119, 47, 40,108, 97,109,
-112,100,105,115,116,107,119, 32, 43, 32,108,100, 50, 42,100,105,115,116, 42,100,105,115,116, 41, 59, 10,125, 10, 10,118,111,105,
-100, 32,108, 97,109,112, 95,102, 97,108,108,111,102,102, 95, 99,117,114,118,101, 40,102,108,111, 97,116, 32,108, 97,109,112,100,
-105,115,116, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32,102,108,111, 97,116, 32,100,
-105,115,116, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 41, 10,123, 10,  9,118,105,115,105,102,
- 97, 99, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40,100,105,
-115,116, 47,108, 97,109,112,100,105,115,116, 44, 32, 48, 46, 48, 41, 41, 46,120, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,
-109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,115,112,104,101,114,101, 40,102,108,111, 97,116, 32,108, 97,109,112,100,
-105,115,116, 44, 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,
-111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118,105,115,105,102, 97, 99, 41, 10,123, 10,  9,102,108,111, 97,116, 32,116,
- 61, 32,108, 97,109,112,100,105,115,116, 32, 45, 32,100,105,115,116, 59, 10, 10,  9,111,117,116,118,105,115,105,102, 97, 99, 61,
- 32,118,105,115,105,102, 97, 99, 42,109, 97,120, 40,116, 44, 32, 48, 46, 48, 41, 47,108, 97,109,112,100,105,115,116, 59, 10,125,
- 10, 10,118,111,105,100, 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,115,112,111,116, 95,115,113,117, 97,
-114,101, 40,118,101, 99, 51, 32,108, 97,109,112,118,101, 99, 44, 32,109, 97,116, 52, 32,108, 97,109,112,105,109, 97,116, 44, 32,
-118,101, 99, 51, 32,108,118, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110,112,114, 41, 10,123, 10,  9,105,102, 40,100,
-111,116, 40,108,118, 44, 32,108, 97,109,112,118,101, 99, 41, 32, 62, 32, 48, 46, 48, 41, 32,123, 10,  9,  9,118,101, 99, 51, 32,
-108,118,114,111,116, 32, 61, 32, 40,108, 97,109,112,105,109, 97,116, 42,118,101, 99, 52, 40,108,118, 44, 32, 48, 46, 48, 41, 41,
- 46,120,121,122, 59, 10,  9,  9,102,108,111, 97,116, 32,120, 32, 61, 32,109, 97,120, 40, 97, 98,115, 40,108,118,114,111,116, 46,
-120, 47,108,118,114,111,116, 46,122, 41, 44, 32, 97, 98,115, 40,108,118,114,111,116, 46,121, 47,108,118,114,111,116, 46,122, 41,
- 41, 59, 10, 10,  9,  9,105,110,112,114, 32, 61, 32, 49, 46, 48, 47,115,113,114,116, 40, 49, 46, 48, 32, 43, 32,120, 42,120, 41,
- 59, 10,  9,125, 10,  9,101,108,115,101, 10,  9,  9,105,110,112,114, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100,
- 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,115,112,111,116, 95, 99,105,114, 99,108,101, 40,118,101, 99,
- 51, 32,108, 97,109,112,118,101, 99, 44, 32,118,101, 99, 51, 32,108,118, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110,
-112,114, 41, 10,123, 10,  9,105,110,112,114, 32, 61, 32,100,111,116, 40,108,118, 44, 32,108, 97,109,112,118,101, 99, 41, 59, 10,
-125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,115,112,111,116, 40,102,108,111,
- 97,116, 32,115,112,111,116,115,105, 44, 32,102,108,111, 97,116, 32,115,112,111,116, 98,108, 44, 32,102,108,111, 97,116, 32,105,
-110,112,114, 44, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,
-116,118,105,115,105,102, 97, 99, 41, 10,123, 10,  9,102,108,111, 97,116, 32,116, 32, 61, 32,115,112,111,116,115,105, 59, 10, 10,
-  9,105,102, 40,105,110,112,114, 32, 60, 61, 32,116, 41, 32,123, 10,  9,  9,111,117,116,118,105,115,105,102, 97, 99, 32, 61, 32,
- 48, 46, 48, 59, 10,  9,125, 10,  9,101,108,115,101, 32,123, 10,  9,  9,116, 32, 61, 32,105,110,112,114, 32, 45, 32,116, 59, 10,
- 10,  9,  9, 47, 42, 32,115,111,102,116, 32, 97,114,101, 97, 32, 42, 47, 10,  9,  9,105,102, 40,115,112,111,116, 98,108, 32, 33,
- 61, 32, 48, 46, 48, 41, 10,  9,  9,  9,105,110,112,114, 32, 42, 61, 32,115,109,111,111,116,104,115,116,101,112, 40, 48, 46, 48,
- 44, 32, 49, 46, 48, 44, 32,116, 47,115,112,111,116, 98,108, 41, 59, 10, 10,  9,  9,111,117,116,118,105,115,105,102, 97, 99, 32,
- 61, 32,118,105,115,105,102, 97, 99, 42,105,110,112,114, 59, 10,  9,125, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,
-118,105,115,105, 98,105,108,105,116,121, 95, 99,108, 97,109,112, 40,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,
-111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118,105,115,105,102, 97, 99, 41, 10,123, 10,  9,111,117,116,118,105,115,105,
-102, 97, 99, 32, 61, 32, 40,118,105,115,105,102, 97, 99, 32, 60, 32, 48, 46, 48, 48, 49, 41, 63, 32, 48, 46, 48, 58, 32,118,105,
-115,105,102, 97, 99, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,118,105,101,119, 40,118,101, 99, 51, 32, 99,
-111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,105,101,119, 41, 10,123, 10,  9, 47, 42, 32,104, 97,110,100,108,101, 32,112,
-101,114,115,112,101, 99,116,105,118,101, 47,111,114,116,104,111,103,114, 97,112,104,105, 99, 32, 42, 47, 10,  9,118,105,101,119,
- 32, 61, 32, 40,103,108, 95, 80,114,111,106,101, 99,116,105,111,110, 77, 97,116,114,105,120, 91, 51, 93, 91, 51, 93, 32, 61, 61,
- 32, 48, 46, 48, 41, 63, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 41, 58, 32,118,101, 99, 51, 40, 48, 46, 48, 44, 32,
- 48, 46, 48, 44, 32, 45, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,116, 97,110,103,101,110,
-116, 95,118, 40,118,101, 99, 51, 32,108,118, 44, 32,118,101, 99, 51, 32,116, 97,110,103, 44, 32,111,117,116, 32,118,101, 99, 51,
- 32,118,110, 41, 10,123, 10,  9,118,101, 99, 51, 32, 99, 32, 61, 32, 99,114,111,115,115, 40,108,118, 44, 32,116, 97,110,103, 41,
- 59, 10,  9,118,101, 99, 51, 32,118,110,111,114, 32, 61, 32, 99,114,111,115,115, 40, 99, 44, 32,116, 97,110,103, 41, 59, 10, 10,
-  9,118,110, 32, 61, 32, 45,110,111,114,109, 97,108,105,122,101, 40,118,110,111,114, 41, 59, 10,125, 10, 10,118,111,105,100, 32,
-115,104, 97,100,101, 95,105,110,112, 40,118,101, 99, 51, 32,118,110, 44, 32,118,101, 99, 51, 32,108,118, 44, 32,111,117,116, 32,
-102,108,111, 97,116, 32,105,110,112, 41, 10,123, 10,  9,105,110,112, 32, 61, 32,100,111,116, 40,118,110, 44, 32,108,118, 41, 59,
- 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,105,115, 95,110,111, 95,100,105,102,102,117,115,101, 40,111,117,116,
- 32,102,108,111, 97,116, 32,105,115, 41, 10,123, 10,  9,105,115, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,
-115,104, 97,100,101, 95,105,115, 95,104,101,109,105, 40,102,108,111, 97,116, 32,105,110,112, 44, 32,111,117,116, 32,102,108,111,
- 97,116, 32,105,115, 41, 10,123, 10,  9,105,115, 32, 61, 32, 48, 46, 53, 42,105,110,112, 32, 43, 32, 48, 46, 53, 59, 10,125, 10,
- 10,102,108,111, 97,116, 32, 97,114,101, 97, 95,108, 97,109,112, 95,101,110,101,114,103,121, 40,109, 97,116, 52, 32, 97,114,101,
- 97, 44, 32,118,101, 99, 51, 32, 99,111, 44, 32,118,101, 99, 51, 32,118,110, 41, 10,123, 10,  9,118,101, 99, 51, 32,118,101, 99,
- 91, 52, 93, 44, 32, 99, 91, 52, 93, 59, 10,  9,102,108,111, 97,116, 32,114, 97,100, 91, 52, 93, 44, 32,102, 97, 99, 59, 10,  9,
- 10,  9,118,101, 99, 91, 48, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 32, 45, 32, 97,114,101, 97, 91, 48,
- 93, 46,120,121,122, 41, 59, 10,  9,118,101, 99, 91, 49, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 32, 45,
- 32, 97,114,101, 97, 91, 49, 93, 46,120,121,122, 41, 59, 10,  9,118,101, 99, 91, 50, 93, 32, 61, 32,110,111,114,109, 97,108,105,
-122,101, 40, 99,111, 32, 45, 32, 97,114,101, 97, 91, 50, 93, 46,120,121,122, 41, 59, 10,  9,118,101, 99, 91, 51, 93, 32, 61, 32,
-110,111,114,109, 97,108,105,122,101, 40, 99,111, 32, 45, 32, 97,114,101, 97, 91, 51, 93, 46,120,121,122, 41, 59, 10, 10,  9, 99,
- 91, 48, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,114,111,115,115, 40,118,101, 99, 91, 48, 93, 44, 32,118,101,
- 99, 91, 49, 93, 41, 41, 59, 10,  9, 99, 91, 49, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,114,111,115,115, 40,
-118,101, 99, 91, 49, 93, 44, 32,118,101, 99, 91, 50, 93, 41, 41, 59, 10,  9, 99, 91, 50, 93, 32, 61, 32,110,111,114,109, 97,108,
-105,122,101, 40, 99,114,111,115,115, 40,118,101, 99, 91, 50, 93, 44, 32,118,101, 99, 91, 51, 93, 41, 41, 59, 10,  9, 99, 91, 51,
- 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,114,111,115,115, 40,118,101, 99, 91, 51, 93, 44, 32,118,101, 99, 91,
- 48, 93, 41, 41, 59, 10, 10,  9,114, 97,100, 91, 48, 93, 32, 61, 32, 97, 99,111,115, 40,100,111,116, 40,118,101, 99, 91, 48, 93,
- 44, 32,118,101, 99, 91, 49, 93, 41, 41, 59, 10,  9,114, 97,100, 91, 49, 93, 32, 61, 32, 97, 99,111,115, 40,100,111,116, 40,118,
-101, 99, 91, 49, 93, 44, 32,118,101, 99, 91, 50, 93, 41, 41, 59, 10,  9,114, 97,100, 91, 50, 93, 32, 61, 32, 97, 99,111,115, 40,
-100,111,116, 40,118,101, 99, 91, 50, 93, 44, 32,118,101, 99, 91, 51, 93, 41, 41, 59, 10,  9,114, 97,100, 91, 51, 93, 32, 61, 32,
- 97, 99,111,115, 40,100,111,116, 40,118,101, 99, 91, 51, 93, 44, 32,118,101, 99, 91, 48, 93, 41, 41, 59, 10, 10,  9,102, 97, 99,
- 61, 32, 32,114, 97,100, 91, 48, 93, 42,100,111,116, 40,118,110, 44, 32, 99, 91, 48, 93, 41, 59, 10,  9,102, 97, 99, 43, 61, 32,
-114, 97,100, 91, 49, 93, 42,100,111,116, 40,118,110, 44, 32, 99, 91, 49, 93, 41, 59, 10,  9,102, 97, 99, 43, 61, 32,114, 97,100,
- 91, 50, 93, 42,100,111,116, 40,118,110, 44, 32, 99, 91, 50, 93, 41, 59, 10,  9,102, 97, 99, 43, 61, 32,114, 97,100, 91, 51, 93,
- 42,100,111,116, 40,118,110, 44, 32, 99, 91, 51, 93, 41, 59, 10, 10,  9,114,101,116,117,114,110, 32,109, 97,120, 40,102, 97, 99,
- 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,105,110,112, 95, 97,114,101, 97, 40,118,
-101, 99, 51, 32,112,111,115,105,116,105,111,110, 44, 32,118,101, 99, 51, 32,108, 97,109,112, 99,111, 44, 32,118,101, 99, 51, 32,
-108, 97,109,112,118,101, 99, 44, 32,118,101, 99, 51, 32,118,110, 44, 32,109, 97,116, 52, 32, 97,114,101, 97, 44, 32,102,108,111,
- 97,116, 32, 97,114,101, 97,115,105,122,101, 44, 32,102,108,111, 97,116, 32,107, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,
-105,110,112, 41, 10,123, 10,  9,118,101, 99, 51, 32, 99,111, 32, 61, 32,112,111,115,105,116,105,111,110, 59, 10,  9,118,101, 99,
- 51, 32,118,101, 99, 32, 61, 32, 99,111, 32, 45, 32,108, 97,109,112, 99,111, 59, 10, 10,  9,105,102, 40,100,111,116, 40,118,101,
- 99, 44, 32,108, 97,109,112,118,101, 99, 41, 32, 60, 32, 48, 46, 48, 41, 32,123, 10,  9,  9,105,110,112, 32, 61, 32, 48, 46, 48,
- 59, 10,  9,125, 10,  9,101,108,115,101, 32,123, 10,  9,  9,102,108,111, 97,116, 32,105,110,116,101,110,115, 32, 61, 32, 97,114,
-101, 97, 95,108, 97,109,112, 95,101,110,101,114,103,121, 40, 97,114,101, 97, 44, 32, 99,111, 44, 32,118,110, 41, 59, 10, 10,  9,
-  9,105,110,112, 32, 61, 32,112,111,119, 40,105,110,116,101,110,115, 42, 97,114,101, 97,115,105,122,101, 44, 32,107, 41, 59, 10,
-  9,125, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,100,105,102,102,117,115,101, 95,111,114,101,110, 95,110, 97,
-121,101,114, 40,102,108,111, 97,116, 32,110,108, 44, 32,118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101,
- 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,115, 41,
- 10,123, 10,  9,118,101, 99, 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,118, 32, 43, 32,108, 41, 59, 10,  9,
-102,108,111, 97,116, 32,110,104, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,104, 41, 44, 32, 48, 46, 48, 41, 59, 10,
-  9,102,108,111, 97,116, 32,110,118, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,118, 41, 44, 32, 48, 46, 48, 41, 59,
- 10,  9,102,108,111, 97,116, 32,114,101, 97,108,110,108, 32, 61, 32,100,111,116, 40,110, 44, 32,108, 41, 59, 10, 10,  9,105,102,
- 40,114,101, 97,108,110,108, 32, 60, 32, 48, 46, 48, 41, 32,123, 10,  9,  9,105,115, 32, 61, 32, 48, 46, 48, 59, 10,  9,125, 10,
-  9,101,108,115,101, 32,105,102, 40,110,108, 32, 60, 32, 48, 46, 48, 41, 32,123, 10,  9,  9,105,115, 32, 61, 32, 48, 46, 48, 59,
- 10,  9,125, 10,  9,101,108,115,101, 32,123, 10,  9,  9,102,108,111, 97,116, 32,118,104, 32, 61, 32,109, 97,120, 40,100,111,116,
- 40,118, 44, 32,104, 41, 44, 32, 48, 46, 48, 41, 59, 10,  9,  9,102,108,111, 97,116, 32, 76,105,116, 95, 65, 32, 61, 32, 97, 99,
-111,115, 40,114,101, 97,108,110,108, 41, 59, 10,  9,  9,102,108,111, 97,116, 32, 86,105,101,119, 95, 65, 32, 61, 32, 97, 99,111,
-115, 40,110,118, 41, 59, 10, 10,  9,  9,118,101, 99, 51, 32, 76,105,116, 95, 66, 32, 61, 32,110,111,114,109, 97,108,105,122,101,
- 40,108, 32, 45, 32,114,101, 97,108,110,108, 42,110, 41, 59, 10,  9,  9,118,101, 99, 51, 32, 86,105,101,119, 95, 66, 32, 61, 32,
-110,111,114,109, 97,108,105,122,101, 40,118, 32, 45, 32,110,118, 42,110, 41, 59, 10, 10,  9,  9,102,108,111, 97,116, 32,116, 32,
- 61, 32,109, 97,120, 40,100,111,116, 40, 76,105,116, 95, 66, 44, 32, 86,105,101,119, 95, 66, 41, 44, 32, 48, 46, 48, 41, 59, 10,
- 10,  9,  9,102,108,111, 97,116, 32, 97, 44, 32, 98, 59, 10, 10,  9,  9,105,102, 40, 76,105,116, 95, 65, 32, 62, 32, 86,105,101,
-119, 95, 65, 41, 32,123, 10,  9,  9,  9, 97, 32, 61, 32, 76,105,116, 95, 65, 59, 10,  9,  9,  9, 98, 32, 61, 32, 86,105,101,119,
- 95, 65, 59, 10,  9,  9,125, 10,  9,  9,101,108,115,101, 32,123, 10,  9,  9,  9, 97, 32, 61, 32, 86,105,101,119, 95, 65, 59, 10,
-  9,  9,  9, 98, 32, 61, 32, 76,105,116, 95, 65, 59, 10,  9,  9,125, 10, 10,  9,  9,102,108,111, 97,116, 32, 65, 32, 61, 32, 49,
- 46, 48, 32, 45, 32, 40, 48, 46, 53, 42, 40, 40,114,111,117,103,104, 42,114,111,117,103,104, 41, 47, 40, 40,114,111,117,103,104,
- 42,114,111,117,103,104, 41, 32, 43, 32, 48, 46, 51, 51, 41, 41, 41, 59, 10,  9,  9,102,108,111, 97,116, 32, 66, 32, 61, 32, 48,
- 46, 52, 53, 42, 40, 40,114,111,117,103,104, 42,114,111,117,103,104, 41, 47, 40, 40,114,111,117,103,104, 42,114,111,117,103,104,
- 41, 32, 43, 32, 48, 46, 48, 57, 41, 41, 59, 10, 10,  9,  9, 98, 32, 42, 61, 32, 48, 46, 57, 53, 59, 10,  9,  9,105,115, 32, 61,
- 32,110,108, 42, 40, 65, 32, 43, 32, 40, 66, 32, 42, 32,116, 32, 42, 32,115,105,110, 40, 97, 41, 32, 42, 32,116, 97,110, 40, 98,
- 41, 41, 41, 59, 10,  9,125, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,100,105,102,102,117,115,101, 95,116,111,
-111,110, 40,118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116,
- 32,115,105,122,101, 44, 32,102,108,111, 97,116, 32,116,115,109,111,111,116,104, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,
-105,115, 41, 10,123, 10,  9,102,108,111, 97,116, 32,114,115,108,116, 32, 61, 32,100,111,116, 40,110, 44, 32,108, 41, 59, 10,  9,
-102,108,111, 97,116, 32, 97,110,103, 32, 61, 32, 97, 99,111,115, 40,114,115,108,116, 41, 59, 10, 10,  9,105,102, 40, 97,110,103,
- 32, 60, 32,115,105,122,101, 41, 32,105,115, 32, 61, 32, 49, 46, 48, 59, 10,  9,101,108,115,101, 32,105,102, 40, 97,110,103, 32,
- 62, 32, 40,115,105,122,101, 32, 43, 32,116,115,109,111,111,116,104, 41, 32,124,124, 32,116,115,109,111,111,116,104, 32, 61, 61,
- 32, 48, 46, 48, 41, 32,105,115, 32, 61, 32, 48, 46, 48, 59, 10,  9,101,108,115,101, 32,105,115, 32, 61, 32, 49, 46, 48, 32, 45,
- 32, 40, 40, 97,110,103, 32, 45, 32,115,105,122,101, 41, 47,116,115,109,111,111,116,104, 41, 59, 10,125, 10, 10,118,111,105,100,
- 32,115,104, 97,100,101, 95,100,105,102,102,117,115,101, 95,109,105,110,110, 97,101,114,116, 40,102,108,111, 97,116, 32,110,108,
- 44, 32,118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,100, 97,114,107,110,101,115,115,
- 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,115, 41, 10,123, 10,  9,105,102, 40,110,108, 32, 60, 61, 32, 48, 46, 48, 41,
- 32,123, 10,  9,  9,105,115, 32, 61, 32, 48, 46, 48, 59, 10,  9,125, 10,  9,101,108,115,101, 32,123, 10,  9,  9,102,108,111, 97,
-116, 32,110,118, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,118, 41, 44, 32, 48, 46, 48, 41, 59, 10, 10,  9,  9,105,
-102, 40,100, 97,114,107,110,101,115,115, 32, 60, 61, 32, 49, 46, 48, 41, 10,  9,  9,  9,105,115, 32, 61, 32,110,108, 42,112,111,
-119, 40,109, 97,120, 40,110,118, 42,110,108, 44, 32, 48, 46, 49, 41, 44, 32,100, 97,114,107,110,101,115,115, 32, 45, 32, 49, 46,
- 48, 41, 59, 10,  9,  9,101,108,115,101, 10,  9,  9,  9,105,115, 32, 61, 32,110,108, 42,112,111,119, 40, 49, 46, 48, 48, 48, 49,
- 32, 45, 32,110,118, 44, 32,100, 97,114,107,110,101,115,115, 32, 45, 32, 49, 46, 48, 41, 59, 10,  9,125, 10,125, 10, 10,102,108,
-111, 97,116, 32,102,114,101,115,110,101,108, 95,102, 97, 99, 40,118,101, 99, 51, 32,118,105,101,119, 44, 32,118,101, 99, 51, 32,
-118,110, 44, 32,102,108,111, 97,116, 32,103,114, 97,100, 44, 32,102,108,111, 97,116, 32,102, 97, 99, 41, 10,123, 10,  9,102,108,
-111, 97,116, 32,116, 49, 44, 32,116, 50, 59, 10,  9,102,108,111, 97,116, 32,102,102, 97, 99, 59, 10, 10,  9,105,102, 40,102, 97,
- 99, 61, 61, 48, 46, 48, 41, 32,123, 10,  9,  9,102,102, 97, 99, 32, 61, 32, 49, 46, 48, 59, 10,  9,125, 10,  9,101,108,115,101,
- 32,123, 10,  9,  9,116, 49, 61, 32,100,111,116, 40,118,105,101,119, 44, 32,118,110, 41, 59, 10,  9,  9,105,102, 40,116, 49, 62,
- 48, 46, 48, 41, 32, 32,116, 50, 61, 32, 49, 46, 48, 43,116, 49, 59, 10,  9,  9,101,108,115,101, 32,116, 50, 61, 32, 49, 46, 48,
- 45,116, 49, 59, 10, 10,  9,  9,116, 50, 61, 32,103,114, 97,100, 32, 43, 32, 40, 49, 46, 48, 45,103,114, 97,100, 41, 42,112,111,
-119, 40,116, 50, 44, 32,102, 97, 99, 41, 59, 10, 10,  9,  9,105,102, 40,116, 50, 60, 48, 46, 48, 41, 32,102,102, 97, 99, 32, 61,
- 32, 48, 46, 48, 59, 10,  9,  9,101,108,115,101, 32,105,102, 40,116, 50, 62, 49, 46, 48, 41, 32,102,102, 97, 99, 32, 61, 32, 49,
- 46, 48, 59, 10,  9,  9,101,108,115,101, 32,102,102, 97, 99, 32, 61, 32,116, 50, 59, 10,  9,125, 10, 10,  9,114,101,116,117,114,
-110, 32,102,102, 97, 99, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,100,105,102,102,117,115,101, 95,102,114,
-101,115,110,101,108, 40,118,101, 99, 51, 32,118,110, 44, 32,118,101, 99, 51, 32,108,118, 44, 32,118,101, 99, 51, 32,118,105,101,
-119, 44, 32,102,108,111, 97,116, 32,102, 97, 99, 95,105, 44, 32,102,108,111, 97,116, 32,102, 97, 99, 44, 32,111,117,116, 32,102,
-108,111, 97,116, 32,105,115, 41, 10,123, 10,  9,105,115, 32, 61, 32,102,114,101,115,110,101,108, 95,102, 97, 99, 40,108,118, 44,
- 32,118,110, 44, 32,102, 97, 99, 95,105, 44, 32,102, 97, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,
- 99,117, 98,105, 99, 40,102,108,111, 97,116, 32,105,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,105,115, 41,
- 10,123, 10,  9,105,102, 40,105,115, 62, 48, 46, 48, 32, 38, 38, 32,105,115, 60, 49, 46, 48, 41, 10,  9,  9,111,117,116,105,115,
- 61, 32,115,109,111,111,116,104,115,116,101,112, 40, 48, 46, 48, 44, 32, 49, 46, 48, 44, 32,105,115, 41, 59, 10,  9,101,108,115,
-101, 10,  9,  9,111,117,116,105,115, 61, 32,105,115, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,118,105,115,
-105,102, 97, 99, 40,102,108,111, 97,116, 32,105, 44, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,102,108,111,
- 97,116, 32,114,101,102,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,105, 41, 10,123, 10,  9, 47, 42,105,102,
- 40,105, 32, 62, 32, 48, 46, 48, 41, 42, 47, 10,  9,  9,111,117,116,105, 32, 61, 32,109, 97,120, 40,105, 42,118,105,115,105,102,
- 97, 99, 42,114,101,102,108, 44, 32, 48, 46, 48, 41, 59, 10,  9, 47, 42,101,108,115,101, 10,  9,  9,111,117,116,105, 32, 61, 32,
-105, 59, 42, 47, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,116, 97,110,103,101,110,116, 95,118, 95,115,112,101,
- 99, 40,118,101, 99, 51, 32,116, 97,110,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,110, 41, 10,123, 10,  9,118,110, 32,
- 61, 32,116, 97,110,103, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 97,100,100, 95,116,111, 95,100,105,102,
-102,117,115,101, 40,102,108,111, 97,116, 32,105, 44, 32,118,101, 99, 51, 32,108, 97,109,112, 99,111,108, 44, 32,118,101, 99, 51,
- 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,105,102, 40,105, 32, 62,
- 32, 48, 46, 48, 41, 10,  9,  9,111,117,116, 99,111,108, 32, 61, 32,105, 42,108, 97,109,112, 99,111,108, 42, 99,111,108, 59, 10,
-  9,101,108,115,101, 10,  9,  9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 44, 32, 48, 46, 48, 44, 32,
- 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,104,101,109,105, 95,115,112,101, 99, 40,118,101,
- 99, 51, 32,118,110, 44, 32,118,101, 99, 51, 32,108,118, 44, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,102,108,111, 97,116,
- 32,115,112,101, 99, 44, 32,102,108,111, 97,116, 32,104, 97,114,100, 44, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99,
- 44, 32,111,117,116, 32,102,108,111, 97,116, 32,116, 41, 10,123, 10,  9,108,118, 32, 43, 61, 32,118,105,101,119, 59, 10,  9,108,
-118, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108,118, 41, 59, 10, 10,  9,116, 32, 61, 32,100,111,116, 40,118,110, 44,
- 32,108,118, 41, 59, 10,  9,116, 32, 61, 32, 48, 46, 53, 42,116, 32, 43, 32, 48, 46, 53, 59, 10, 10,  9,116, 32, 61, 32,118,105,
-115,105,102, 97, 99, 42,115,112,101, 99, 42,112,111,119, 40,116, 44, 32,104, 97,114,100, 41, 59, 10,125, 10, 10,118,111,105,100,
- 32,115,104, 97,100,101, 95,112,104,111,110,103, 95,115,112,101, 99, 40,118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108,
- 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,104, 97,114,100, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,
-115,112,101, 99,102, 97, 99, 41, 10,123, 10,  9,118,101, 99, 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108,
- 32, 43, 32,118, 41, 59, 10,  9,102,108,111, 97,116, 32,114,115,108,116, 32, 61, 32,109, 97,120, 40,100,111,116, 40,104, 44, 32,
-110, 41, 44, 32, 48, 46, 48, 41, 59, 10, 10,  9,115,112,101, 99,102, 97, 99, 32, 61, 32,112,111,119, 40,114,115,108,116, 44, 32,
-104, 97,114,100, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 99,111,111,107,116,111,114,114, 95,115,112,
-101, 99, 40,118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116,
- 32,104, 97,114,100, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 41, 10,123, 10,  9,118,101, 99,
- 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,118, 32, 43, 32,108, 41, 59, 10,  9,102,108,111, 97,116, 32,110,
-104, 32, 61, 32,100,111,116, 40,110, 44, 32,104, 41, 59, 10, 10,  9,105,102, 40,110,104, 32, 60, 32, 48, 46, 48, 41, 32,123, 10,
-  9,  9,115,112,101, 99,102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10,  9,125, 10,  9,101,108,115,101, 32,123, 10,  9,  9,102,108,
-111, 97,116, 32,110,118, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,118, 41, 44, 32, 48, 46, 48, 41, 59, 10,  9,  9,
-102,108,111, 97,116, 32,105, 32, 61, 32,112,111,119, 40,110,104, 44, 32,104, 97,114,100, 41, 59, 10, 10,  9,  9,105, 32, 61, 32,
-105, 47, 40, 48, 46, 49, 43,110,118, 41, 59, 10,  9,  9,115,112,101, 99,102, 97, 99, 32, 61, 32,105, 59, 10,  9,125, 10,125, 10,
- 10,118,111,105,100, 32,115,104, 97,100,101, 95, 98,108,105,110,110, 95,115,112,101, 99, 40,118,101, 99, 51, 32,110, 44, 32,118,
-101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,114,101,102,114, 97, 99, 44, 32,102,108,111,
- 97,116, 32,115,112,101, 99, 95,112,111,119,101,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99,
- 41, 10,123, 10,  9,105,102, 40,114,101,102,114, 97, 99, 32, 60, 32, 49, 46, 48, 41, 32,123, 10,  9,  9,115,112,101, 99,102, 97,
- 99, 32, 61, 32, 48, 46, 48, 59, 10,  9,125, 10,  9,101,108,115,101, 32,105,102, 40,115,112,101, 99, 95,112,111,119,101,114, 32,
- 61, 61, 32, 48, 46, 48, 41, 32,123, 10,  9,  9,115,112,101, 99,102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10,  9,125, 10,  9,101,
-108,115,101, 32,123, 10,  9,  9,105,102, 40,115,112,101, 99, 95,112,111,119,101,114, 60, 49, 48, 48, 46, 48, 41, 10,  9,  9,  9,
-115,112,101, 99, 95,112,111,119,101,114, 61, 32,115,113,114,116, 40, 49, 46, 48, 47,115,112,101, 99, 95,112,111,119,101,114, 41,
- 59, 10,  9,  9,101,108,115,101, 10,  9,  9,  9,115,112,101, 99, 95,112,111,119,101,114, 61, 32, 49, 48, 46, 48, 47,115,112,101,
- 99, 95,112,111,119,101,114, 59, 10, 10,  9,  9,118,101, 99, 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,118,
- 32, 43, 32,108, 41, 59, 10,  9,  9,102,108,111, 97,116, 32,110,104, 32, 61, 32,100,111,116, 40,110, 44, 32,104, 41, 59, 10,  9,
-  9,105,102, 40,110,104, 32, 60, 32, 48, 46, 48, 41, 32,123, 10,  9,  9,  9,115,112,101, 99,102, 97, 99, 32, 61, 32, 48, 46, 48,
- 59, 10,  9,  9,125, 10,  9,  9,101,108,115,101, 32,123, 10,  9,  9,  9,102,108,111, 97,116, 32,110,118, 32, 61, 32,109, 97,120,
- 40,100,111,116, 40,110, 44, 32,118, 41, 44, 32, 48, 46, 48, 49, 41, 59, 10,  9,  9,  9,102,108,111, 97,116, 32,110,108, 32, 61,
- 32,100,111,116, 40,110, 44, 32,108, 41, 59, 10,  9,  9,  9,105,102, 40,110,108, 32, 60, 61, 32, 48, 46, 48, 49, 41, 32,123, 10,
-  9,  9,  9,  9,115,112,101, 99,102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10,  9,  9,  9,125, 10,  9,  9,  9,101,108,115,101, 32,
-123, 10,  9,  9,  9,  9,102,108,111, 97,116, 32,118,104, 32, 61, 32,109, 97,120, 40,100,111,116, 40,118, 44, 32,104, 41, 44, 32,
- 48, 46, 48, 49, 41, 59, 10, 10,  9,  9,  9,  9,102,108,111, 97,116, 32, 97, 32, 61, 32, 49, 46, 48, 59, 10,  9,  9,  9,  9,102,
-108,111, 97,116, 32, 98, 32, 61, 32, 40, 50, 46, 48, 42,110,104, 42,110,118, 41, 47,118,104, 59, 10,  9,  9,  9,  9,102,108,111,
- 97,116, 32, 99, 32, 61, 32, 40, 50, 46, 48, 42,110,104, 42,110,108, 41, 47,118,104, 59, 10, 10,  9,  9,  9,  9,102,108,111, 97,
-116, 32,103, 32, 61, 32, 48, 46, 48, 59, 10, 10,  9,  9,  9,  9,105,102, 40, 97, 32, 60, 32, 98, 32, 38, 38, 32, 97, 32, 60, 32,
- 99, 41, 32,103, 32, 61, 32, 97, 59, 10,  9,  9,  9,  9,101,108,115,101, 32,105,102, 40, 98, 32, 60, 32, 97, 32, 38, 38, 32, 98,
- 32, 60, 32, 99, 41, 32,103, 32, 61, 32, 98, 59, 10,  9,  9,  9,  9,101,108,115,101, 32,105,102, 40, 99, 32, 60, 32, 97, 32, 38,
- 38, 32, 99, 32, 60, 32, 98, 41, 32,103, 32, 61, 32, 99, 59, 10, 10,  9,  9,  9,  9,102,108,111, 97,116, 32,112, 32, 61, 32,115,
-113,114,116, 40, 40, 40,114,101,102,114, 97, 99, 32, 42, 32,114,101,102,114, 97, 99, 41, 43, 40,118,104, 42,118,104, 41, 45, 49,
- 46, 48, 41, 41, 59, 10,  9,  9,  9,  9,102,108,111, 97,116, 32,102, 32, 61, 32, 40, 40, 40,112, 45,118,104, 41, 42, 40,112, 45,
-118,104, 41, 41, 47, 40, 40,112, 43,118,104, 41, 42, 40,112, 43,118,104, 41, 41, 41, 42, 40, 49, 46, 48, 43, 40, 40, 40, 40,118,
-104, 42, 40,112, 43,118,104, 41, 41, 45, 49, 46, 48, 41, 42, 40, 40,118,104, 42, 40,112, 43,118,104, 41, 41, 45, 49, 46, 48, 41,
- 41, 47, 40, 40, 40,118,104, 42, 40,112, 45,118,104, 41, 41, 43, 49, 46, 48, 41, 42, 40, 40,118,104, 42, 40,112, 45,118,104, 41,
- 41, 43, 49, 46, 48, 41, 41, 41, 41, 59, 10,  9,  9,  9,  9,102,108,111, 97,116, 32, 97,110,103, 32, 61, 32, 97, 99,111,115, 40,
-110,104, 41, 59, 10, 10,  9,  9,  9,  9,115,112,101, 99,102, 97, 99, 32, 61, 32,109, 97,120, 40,102, 42,103, 42,101,120,112, 95,
- 98,108,101,110,100,101,114, 40, 40, 45, 40, 97,110,103, 42, 97,110,103, 41, 47, 40, 50, 46, 48, 42,115,112,101, 99, 95,112,111,
-119,101,114, 42,115,112,101, 99, 95,112,111,119,101,114, 41, 41, 41, 44, 32, 48, 46, 48, 41, 59, 10,  9,  9,  9,125, 10,  9,  9,
-125, 10,  9,125, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,119, 97,114,100,105,115,111, 95,115,112,101, 99, 40,
-118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,114,109,
-115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 41, 10,123, 10,  9,118,101, 99, 51, 32,104, 32,
- 61, 32,110,111,114,109, 97,108,105,122,101, 40,108, 32, 43, 32,118, 41, 59, 10,  9,102,108,111, 97,116, 32,110,104, 32, 61, 32,
-109, 97,120, 40,100,111,116, 40,110, 44, 32,104, 41, 44, 32, 48, 46, 48, 48, 49, 41, 59, 10,  9,102,108,111, 97,116, 32,110,118,
- 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,118, 41, 44, 32, 48, 46, 48, 48, 49, 41, 59, 10,  9,102,108,111, 97,116,
- 32,110,108, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,108, 41, 44, 32, 48, 46, 48, 48, 49, 41, 59, 10,  9,102,108,
-111, 97,116, 32, 97,110,103,108,101, 32, 61, 32,116, 97,110, 40, 97, 99,111,115, 40,110,104, 41, 41, 59, 10,  9,102,108,111, 97,
-116, 32, 97,108,112,104, 97, 32, 61, 32,109, 97,120, 40,114,109,115, 44, 32, 48, 46, 48, 48, 49, 41, 59, 10, 10,  9,115,112,101,
- 99,102, 97, 99, 61, 32,110,108, 32, 42, 32, 40, 49, 46, 48, 47, 40, 52, 46, 48, 42, 77, 95, 80, 73, 42, 97,108,112,104, 97, 42,
- 97,108,112,104, 97, 41, 41, 42, 40,101,120,112, 95, 98,108,101,110,100,101,114, 40, 45, 40, 97,110,103,108,101, 42, 97,110,103,
-108,101, 41, 47, 40, 97,108,112,104, 97, 42, 97,108,112,104, 97, 41, 41, 47, 40,115,113,114,116, 40,110,118, 42,110,108, 41, 41,
- 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,116,111,111,110, 95,115,112,101, 99, 40,118,101, 99, 51, 32,
-110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,115,105,122,101, 44, 32,102,
-108,111, 97,116, 32,116,115,109,111,111,116,104, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 41,
- 10,123, 10,  9,118,101, 99, 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108, 32, 43, 32,118, 41, 59, 10,  9,
-102,108,111, 97,116, 32,114,115,108,116, 32, 61, 32,100,111,116, 40,104, 44, 32,110, 41, 59, 10,  9,102,108,111, 97,116, 32, 97,
-110,103, 32, 61, 32, 97, 99,111,115, 40,114,115,108,116, 41, 59, 10, 10,  9,105,102, 40, 97,110,103, 32, 60, 32,115,105,122,101,
- 41, 32,114,115,108,116, 32, 61, 32, 49, 46, 48, 59, 10,  9,101,108,115,101, 32,105,102, 40, 97,110,103, 32, 62, 61, 32, 40,115,
-105,122,101, 32, 43, 32,116,115,109,111,111,116,104, 41, 32,124,124, 32,116,115,109,111,111,116,104, 32, 61, 61, 32, 48, 46, 48,
- 41, 32,114,115,108,116, 32, 61, 32, 48, 46, 48, 59, 10,  9,101,108,115,101, 32,114,115,108,116, 32, 61, 32, 49, 46, 48, 32, 45,
- 32, 40, 40, 97,110,103, 32, 45, 32,115,105,122,101, 41, 47,116,115,109,111,111,116,104, 41, 59, 10, 10,  9,115,112,101, 99,102,
- 97, 99, 32, 61, 32,114,115,108,116, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,115,112,101, 99, 95, 97,114,
-101, 97, 95,105,110,112, 40,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 44, 32,102,108,111, 97,116, 32,105,110,112, 44,
- 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,115,112,101, 99,102, 97, 99, 41, 10,123, 10,  9,111,117,116,115,112,101,
- 99,102, 97, 99, 32, 61, 32,115,112,101, 99,102, 97, 99, 42,105,110,112, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,
-101, 95,115,112,101, 99, 95,116, 40,102,108,111, 97,116, 32,115,104, 97,100,102, 97, 99, 44, 32,102,108,111, 97,116, 32,115,112,
-101, 99, 44, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99,
- 44, 32,111,117,116, 32,102,108,111, 97,116, 32,116, 41, 10,123, 10,  9,116, 32, 61, 32,115,104, 97,100,102, 97, 99, 42,115,112,
-101, 99, 42,118,105,115,105,102, 97, 99, 42,115,112,101, 99,102, 97, 99, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,
-101, 95, 97,100,100, 95,115,112,101, 99, 40,102,108,111, 97,116, 32,116, 44, 32,118,101, 99, 51, 32,108, 97,109,112, 99,111,108,
- 44, 32,118,101, 99, 51, 32,115,112,101, 99, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41,
- 10,123, 10,  9,111,117,116, 99,111,108, 32, 61, 32,116, 42,108, 97,109,112, 99,111,108, 42,115,112,101, 99, 99,111,108, 59, 10,
-125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 97,100,100, 40,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99,
- 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,111,117,116, 99,
-111,108, 32, 61, 32, 99,111,108, 49, 32, 43, 32, 99,111,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,
-109, 97,100,100, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,
+121, 41, 59, 10,  9, 10,  9, 47, 47, 32,116,104,105,115, 32,118, 97,114,105, 97,110,116, 32,117,115,105,110,103, 32, 97, 32,100,
+101,114,105,118, 97,116,105,118,101, 32,109, 97,112, 32,105,115, 32,100,101,115, 99,114,105, 98,101,100, 32,104,101,114,101, 10,
+  9, 47, 47, 32,104,116,116,112, 58, 47, 47,109,109,105,107,107,101,108,115,101,110, 51,100, 46, 98,108,111,103,115,112,111,116,
+ 46, 99,111,109, 47, 50, 48, 49, 49, 47, 48, 55, 47,100,101,114,105,118, 97,116,105,118,101, 45,109, 97,112,115, 46,104,116,109,
+108, 10,  9,118,101, 99, 50, 32,100,105,109, 32, 61, 32,118,101, 99, 50, 40,105,109, 97, 95,120, 44, 32,105,109, 97, 95,121, 41,
+ 59, 10,  9,118,101, 99, 50, 32,100, 66,100,117,118, 32, 61, 32,104, 83, 99, 97,108,101, 42,100,105,109, 42, 40, 50, 46, 48, 42,
+116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32,116,101,120, 99,111, 46,120,121, 41, 46,120,121, 45, 49, 46, 48, 41,
+ 59, 10,  9, 10,  9,100, 66,115, 32, 61, 32,100, 66,100,117,118, 46,120, 42, 84,101,120, 68,120, 46,120, 32, 43, 32,115, 42,100,
+ 66,100,117,118, 46,121, 42, 84,101,120, 68,120, 46,121, 59, 10,  9,100, 66,116, 32, 61, 32,100, 66,100,117,118, 46,120, 42, 84,
+101,120, 68,121, 46,120, 32, 43, 32,115, 42,100, 66,100,117,118, 46,121, 42, 84,101,120, 68,121, 46,121, 59, 10,125, 10, 10,118,
+111,105,100, 32,109,116,101,120, 95, 98,117,109,112, 95, 97,112,112,108,121, 40, 32,102,108,111, 97,116, 32,102, 68,101,116, 44,
+ 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,102,108,111, 97,116, 32,100, 66,116, 44, 32,118,101, 99, 51, 32,118, 82, 49, 44,
+ 32,118,101, 99, 51, 32,118, 82, 50, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10,  9,  9,  9,  9,  9, 32,
+ 32,111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,112,101,
+114,116,117,114, 98,101,100, 95,110,111,114,109, 32, 41, 32, 10,123, 10,  9,118,101, 99, 51, 32,118, 83,117,114,102, 71,114, 97,
+100, 32, 61, 32,115,105,103,110, 40,102, 68,101,116, 41, 32, 42, 32, 40, 32,100, 66,115, 32, 42, 32,118, 82, 49, 32, 43, 32,100,
+ 66,116, 32, 42, 32,118, 82, 50, 32, 41, 59, 10,  9, 10,  9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99,
+ 95,105,110, 32, 45, 32,118, 83,117,114,102, 71,114, 97,100, 59, 10,  9,112,101,114,116,117,114, 98,101,100, 95,110,111,114,109,
+ 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 32,118, 78, 97, 99, 99, 95,111,117,116, 32, 41, 59, 10,125, 10, 10,118,111,
+105,100, 32,109,116,101,120, 95, 98,117,109,112, 95, 97,112,112,108,121, 95,116,101,120,115,112, 97, 99,101, 40, 32,102,108,111,
+ 97,116, 32,102, 68,101,116, 44, 32,102,108,111, 97,116, 32,100, 66,115, 44, 32,102,108,111, 97,116, 32,100, 66,116, 44, 32,118,
+101, 99, 51, 32,118, 82, 49, 44, 32,118,101, 99, 51, 32,118, 82, 50, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44,
+ 32,118,101, 99, 51, 32,116,101,120, 99,111, 44, 32,102,108,111, 97,116, 32,105,109, 97, 95,120, 44, 32,102,108,111, 97,116, 32,
+105,109, 97, 95,121, 44, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,105,110, 44, 10,  9,  9,  9,  9,  9,  9,  9, 32, 32, 32,
+111,117,116, 32,118,101, 99, 51, 32,118, 78, 97, 99, 99, 95,111,117,116, 44, 32,111,117,116, 32,118,101, 99, 51, 32,112,101,114,
+116,117,114, 98,101,100, 95,110,111,114,109, 32, 41, 32, 10,123, 10,  9,118,101, 99, 50, 32, 84,101,120, 68,120, 32, 61, 32,100,
+ 70,100,120, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10,  9,118,101, 99, 50, 32, 84,101,120, 68,121, 32, 61, 32,100, 70,100,
+121, 40,116,101,120, 99,111, 46,120,121, 41, 59, 10, 10,  9,118,101, 99, 51, 32,118, 83,117,114,102, 71,114, 97,100, 32, 61, 32,
+115,105,103,110, 40,102, 68,101,116, 41, 32, 42, 32, 40, 32, 10,  9, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,100, 66,115,
+ 32, 47, 32,108,101,110,103,116,104, 40, 32,118,101, 99, 50, 40,105,109, 97, 95,120, 42, 84,101,120, 68,120, 46,120, 44, 32,105,
+109, 97, 95,121, 42, 84,101,120, 68,120, 46,121, 41, 32, 41, 32, 42, 32,118, 82, 49, 32, 43, 32, 10,  9, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32,100, 66,116, 32, 47, 32,108,101,110,103,116,104, 40, 32,118,101, 99, 50, 40,105,109, 97, 95,120, 42, 84,
+101,120, 68,121, 46,120, 44, 32,105,109, 97, 95,121, 42, 84,101,120, 68,121, 46,121, 41, 32, 41, 32, 42, 32,118, 82, 50, 32, 41,
+ 59, 10,  9,  9,  9,  9, 10,  9,118, 78, 97, 99, 99, 95,111,117,116, 32, 61, 32,118, 78, 97, 99, 99, 95,105,110, 32, 45, 32,118,
+ 83,117,114,102, 71,114, 97,100, 59, 10,  9,112,101,114,116,117,114, 98,101,100, 95,110,111,114,109, 32, 61, 32,110,111,114,109,
+ 97,108,105,122,101, 40, 32,118, 78, 97, 99, 99, 95,111,117,116, 32, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120,
+ 95,110,101,103, 97,116,101, 95,116,101,120,110,111,114,109, 97,108, 40,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,
+117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10,123, 10,  9,111,117,116,110,111,114,109, 97,108, 32,
+ 61, 32,118,101, 99, 51, 40, 45,110,111,114,109, 97,108, 46,120, 44, 32, 45,110,111,114,109, 97,108, 46,121, 44, 32,110,111,114,
+109, 97,108, 46,122, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95,110,115,112, 97, 99,101, 95,116, 97,110,103,
+101,110,116, 40,118,101, 99, 52, 32,116, 97,110,103,101,110,116, 44, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,118,
+101, 99, 51, 32,116,101,120,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114,109, 97,
+108, 41, 10,123, 10,  9,118,101, 99, 51, 32, 66, 32, 61, 32,116, 97,110,103,101,110,116, 46,119, 32, 42, 32, 99,114,111,115,115,
+ 40,110,111,114,109, 97,108, 44, 32,116, 97,110,103,101,110,116, 46,120,121,122, 41, 59, 10, 10,  9,111,117,116,110,111,114,109,
+ 97,108, 32, 61, 32,116,101,120,110,111,114,109, 97,108, 46,120, 42,116, 97,110,103,101,110,116, 46,120,121,122, 32, 43, 32,116,
+101,120,110,111,114,109, 97,108, 46,121, 42, 66, 32, 43, 32,116,101,120,110,111,114,109, 97,108, 46,122, 42,110,111,114,109, 97,
+108, 59, 10,  9,111,117,116,110,111,114,109, 97,108, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,111,117,116,110,111,114,
+109, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109,116,101,120, 95, 98,108,101,110,100, 95,110,111,114,109, 97,108, 40,
+102,108,111, 97,116, 32,110,111,114,102, 97, 99, 44, 32,118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,118,101, 99, 51, 32,
+110,101,119,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114,109, 97,108, 41, 10,123,
+ 10,  9,111,117,116,110,111,114,109, 97,108, 32, 61, 32, 40, 49, 46, 48, 32, 45, 32,110,111,114,102, 97, 99, 41, 42,110,111,114,
+109, 97,108, 32, 43, 32,110,111,114,102, 97, 99, 42,110,101,119,110,111,114,109, 97,108, 59, 10,  9,111,117,116,110,111,114,109,
+ 97,108, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,111,117,116,110,111,114,109, 97,108, 41, 59, 10,125, 10, 10, 47, 42,
+ 42, 42, 42, 42, 42, 42, 32, 77, 65, 84, 69, 82, 73, 65, 76, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100,
+ 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,115,117,110, 95,104,101,109,105, 40,118,101, 99, 51, 32,108,
+ 97,109,112,118,101, 99, 44, 32,111,117,116, 32,118,101, 99, 51, 32,108,118, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100,
+105,115,116, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 41, 10,123, 10,  9,108,118, 32, 61, 32,
+108, 97,109,112,118,101, 99, 59, 10,  9,100,105,115,116, 32, 61, 32, 49, 46, 48, 59, 10,  9,118,105,115,105,102, 97, 99, 32, 61,
+ 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,111,116,
+104,101,114, 40,118,101, 99, 51, 32, 99,111, 44, 32,118,101, 99, 51, 32,108, 97,109,112, 99,111, 44, 32,111,117,116, 32,118,101,
+ 99, 51, 32,108,118, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,111,117,116, 32,102,108,111, 97,116,
+ 32,118,105,115,105,102, 97, 99, 41, 10,123, 10,  9,108,118, 32, 61, 32, 99,111, 32, 45, 32,108, 97,109,112, 99,111, 59, 10,  9,
+100,105,115,116, 32, 61, 32,108,101,110,103,116,104, 40,108,118, 41, 59, 10,  9,108,118, 32, 61, 32,110,111,114,109, 97,108,105,
+122,101, 40,108,118, 41, 59, 10,  9,118,105,115,105,102, 97, 99, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,
+108, 97,109,112, 95,102, 97,108,108,111,102,102, 95,105,110,118,108,105,110,101, 97,114, 40,102,108,111, 97,116, 32,108, 97,109,
+112,100,105,115,116, 44, 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118,105,115,
+105,102, 97, 99, 41, 10,123, 10,  9,118,105,115,105,102, 97, 99, 32, 61, 32,108, 97,109,112,100,105,115,116, 47, 40,108, 97,109,
+112,100,105,115,116, 32, 43, 32,100,105,115,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,102, 97,108,108,
+111,102,102, 95,105,110,118,115,113,117, 97,114,101, 40,102,108,111, 97,116, 32,108, 97,109,112,100,105,115,116, 44, 32,102,108,
+111, 97,116, 32,100,105,115,116, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 41, 10,123, 10,  9,
+118,105,115,105,102, 97, 99, 32, 61, 32,108, 97,109,112,100,105,115,116, 47, 40,108, 97,109,112,100,105,115,116, 32, 43, 32,100,
+105,115,116, 42,100,105,115,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,102, 97,108,108,111,102,102, 95,
+115,108,105,100,101,114,115, 40,102,108,111, 97,116, 32,108, 97,109,112,100,105,115,116, 44, 32,102,108,111, 97,116, 32,108,100,
+ 49, 44, 32,102,108,111, 97,116, 32,108,100, 50, 44, 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,111,117,116, 32,102,108,
+111, 97,116, 32,118,105,115,105,102, 97, 99, 41, 10,123, 10,  9,102,108,111, 97,116, 32,108, 97,109,112,100,105,115,116,107,119,
+ 32, 61, 32,108, 97,109,112,100,105,115,116, 42,108, 97,109,112,100,105,115,116, 59, 10, 10,  9,118,105,115,105,102, 97, 99, 32,
+ 61, 32,108, 97,109,112,100,105,115,116, 47, 40,108, 97,109,112,100,105,115,116, 32, 43, 32,108,100, 49, 42,100,105,115,116, 41,
+ 59, 10,  9,118,105,115,105,102, 97, 99, 32, 42, 61, 32,108, 97,109,112,100,105,115,116,107,119, 47, 40,108, 97,109,112,100,105,
+115,116,107,119, 32, 43, 32,108,100, 50, 42,100,105,115,116, 42,100,105,115,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,108,
+ 97,109,112, 95,102, 97,108,108,111,102,102, 95, 99,117,114,118,101, 40,102,108,111, 97,116, 32,108, 97,109,112,100,105,115,116,
+ 44, 32,115, 97,109,112,108,101,114, 50, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32,102,108,111, 97,116, 32,100,105,115,116,
+ 44, 32,111,117,116, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 41, 10,123, 10,  9,118,105,115,105,102, 97, 99, 32,
+ 61, 32,116,101,120,116,117,114,101, 50, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,118,101, 99, 50, 40,100,105,115,116, 47,
+108, 97,109,112,100,105,115,116, 44, 32, 48, 46, 48, 41, 41, 46,120, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,
+118,105,115,105, 98,105,108,105,116,121, 95,115,112,104,101,114,101, 40,102,108,111, 97,116, 32,108, 97,109,112,100,105,115,116,
+ 44, 32,102,108,111, 97,116, 32,100,105,115,116, 44, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,111,117,116,
+ 32,102,108,111, 97,116, 32,111,117,116,118,105,115,105,102, 97, 99, 41, 10,123, 10,  9,102,108,111, 97,116, 32,116, 61, 32,108,
+ 97,109,112,100,105,115,116, 32, 45, 32,100,105,115,116, 59, 10, 10,  9,111,117,116,118,105,115,105,102, 97, 99, 61, 32,118,105,
+115,105,102, 97, 99, 42,109, 97,120, 40,116, 44, 32, 48, 46, 48, 41, 47,108, 97,109,112,100,105,115,116, 59, 10,125, 10, 10,118,
+111,105,100, 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,115,112,111,116, 95,115,113,117, 97,114,101, 40,
+118,101, 99, 51, 32,108, 97,109,112,118,101, 99, 44, 32,109, 97,116, 52, 32,108, 97,109,112,105,109, 97,116, 44, 32,118,101, 99,
+ 51, 32,108,118, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110,112,114, 41, 10,123, 10,  9,105,102, 40,100,111,116, 40,
+108,118, 44, 32,108, 97,109,112,118,101, 99, 41, 32, 62, 32, 48, 46, 48, 41, 32,123, 10,  9,  9,118,101, 99, 51, 32,108,118,114,
+111,116, 32, 61, 32, 40,108, 97,109,112,105,109, 97,116, 42,118,101, 99, 52, 40,108,118, 44, 32, 48, 46, 48, 41, 41, 46,120,121,
+122, 59, 10,  9,  9,102,108,111, 97,116, 32,120, 32, 61, 32,109, 97,120, 40, 97, 98,115, 40,108,118,114,111,116, 46,120, 47,108,
+118,114,111,116, 46,122, 41, 44, 32, 97, 98,115, 40,108,118,114,111,116, 46,121, 47,108,118,114,111,116, 46,122, 41, 41, 59, 10,
+ 10,  9,  9,105,110,112,114, 32, 61, 32, 49, 46, 48, 47,115,113,114,116, 40, 49, 46, 48, 32, 43, 32,120, 42,120, 41, 59, 10,  9,
+125, 10,  9,101,108,115,101, 10,  9,  9,105,110,112,114, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,108, 97,
+109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,115,112,111,116, 95, 99,105,114, 99,108,101, 40,118,101, 99, 51, 32,108,
+ 97,109,112,118,101, 99, 44, 32,118,101, 99, 51, 32,108,118, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110,112,114, 41,
+ 10,123, 10,  9,105,110,112,114, 32, 61, 32,100,111,116, 40,108,118, 44, 32,108, 97,109,112,118,101, 99, 41, 59, 10,125, 10, 10,
+118,111,105,100, 32,108, 97,109,112, 95,118,105,115,105, 98,105,108,105,116,121, 95,115,112,111,116, 40,102,108,111, 97,116, 32,
+115,112,111,116,115,105, 44, 32,102,108,111, 97,116, 32,115,112,111,116, 98,108, 44, 32,102,108,111, 97,116, 32,105,110,112,114,
+ 44, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118,105,
+115,105,102, 97, 99, 41, 10,123, 10,  9,102,108,111, 97,116, 32,116, 32, 61, 32,115,112,111,116,115,105, 59, 10, 10,  9,105,102,
+ 40,105,110,112,114, 32, 60, 61, 32,116, 41, 32,123, 10,  9,  9,111,117,116,118,105,115,105,102, 97, 99, 32, 61, 32, 48, 46, 48,
+ 59, 10,  9,125, 10,  9,101,108,115,101, 32,123, 10,  9,  9,116, 32, 61, 32,105,110,112,114, 32, 45, 32,116, 59, 10, 10,  9,  9,
+ 47, 42, 32,115,111,102,116, 32, 97,114,101, 97, 32, 42, 47, 10,  9,  9,105,102, 40,115,112,111,116, 98,108, 32, 33, 61, 32, 48,
+ 46, 48, 41, 10,  9,  9,  9,105,110,112,114, 32, 42, 61, 32,115,109,111,111,116,104,115,116,101,112, 40, 48, 46, 48, 44, 32, 49,
+ 46, 48, 44, 32,116, 47,115,112,111,116, 98,108, 41, 59, 10, 10,  9,  9,111,117,116,118,105,115,105,102, 97, 99, 32, 61, 32,118,
+105,115,105,102, 97, 99, 42,105,110,112,114, 59, 10,  9,125, 10,125, 10, 10,118,111,105,100, 32,108, 97,109,112, 95,118,105,115,
+105, 98,105,108,105,116,121, 95, 99,108, 97,109,112, 40,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,111,117,116,
+ 32,102,108,111, 97,116, 32,111,117,116,118,105,115,105,102, 97, 99, 41, 10,123, 10,  9,111,117,116,118,105,115,105,102, 97, 99,
+ 32, 61, 32, 40,118,105,115,105,102, 97, 99, 32, 60, 32, 48, 46, 48, 48, 49, 41, 63, 32, 48, 46, 48, 58, 32,118,105,115,105,102,
+ 97, 99, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,118,105,101,119, 40,118,101, 99, 51, 32, 99,111, 44, 32,
+111,117,116, 32,118,101, 99, 51, 32,118,105,101,119, 41, 10,123, 10,  9, 47, 42, 32,104, 97,110,100,108,101, 32,112,101,114,115,
+112,101, 99,116,105,118,101, 47,111,114,116,104,111,103,114, 97,112,104,105, 99, 32, 42, 47, 10,  9,118,105,101,119, 32, 61, 32,
+ 40,103,108, 95, 80,114,111,106,101, 99,116,105,111,110, 77, 97,116,114,105,120, 91, 51, 93, 91, 51, 93, 32, 61, 61, 32, 48, 46,
+ 48, 41, 63, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 41, 58, 32,118,101, 99, 51, 40, 48, 46, 48, 44, 32, 48, 46, 48,
+ 44, 32, 45, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,116, 97,110,103,101,110,116, 95,118,
+ 40,118,101, 99, 51, 32,108,118, 44, 32,118,101, 99, 51, 32,116, 97,110,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,110,
+ 41, 10,123, 10,  9,118,101, 99, 51, 32, 99, 32, 61, 32, 99,114,111,115,115, 40,108,118, 44, 32,116, 97,110,103, 41, 59, 10,  9,
+118,101, 99, 51, 32,118,110,111,114, 32, 61, 32, 99,114,111,115,115, 40, 99, 44, 32,116, 97,110,103, 41, 59, 10, 10,  9,118,110,
+ 32, 61, 32, 45,110,111,114,109, 97,108,105,122,101, 40,118,110,111,114, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,
+100,101, 95,105,110,112, 40,118,101, 99, 51, 32,118,110, 44, 32,118,101, 99, 51, 32,108,118, 44, 32,111,117,116, 32,102,108,111,
+ 97,116, 32,105,110,112, 41, 10,123, 10,  9,105,110,112, 32, 61, 32,100,111,116, 40,118,110, 44, 32,108,118, 41, 59, 10,125, 10,
+ 10,118,111,105,100, 32,115,104, 97,100,101, 95,105,115, 95,110,111, 95,100,105,102,102,117,115,101, 40,111,117,116, 32,102,108,
+111, 97,116, 32,105,115, 41, 10,123, 10,  9,105,115, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,
+100,101, 95,105,115, 95,104,101,109,105, 40,102,108,111, 97,116, 32,105,110,112, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,
+105,115, 41, 10,123, 10,  9,105,115, 32, 61, 32, 48, 46, 53, 42,105,110,112, 32, 43, 32, 48, 46, 53, 59, 10,125, 10, 10,102,108,
+111, 97,116, 32, 97,114,101, 97, 95,108, 97,109,112, 95,101,110,101,114,103,121, 40,109, 97,116, 52, 32, 97,114,101, 97, 44, 32,
+118,101, 99, 51, 32, 99,111, 44, 32,118,101, 99, 51, 32,118,110, 41, 10,123, 10,  9,118,101, 99, 51, 32,118,101, 99, 91, 52, 93,
+ 44, 32, 99, 91, 52, 93, 59, 10,  9,102,108,111, 97,116, 32,114, 97,100, 91, 52, 93, 44, 32,102, 97, 99, 59, 10,  9, 10,  9,118,
+101, 99, 91, 48, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 32, 45, 32, 97,114,101, 97, 91, 48, 93, 46,120,
+121,122, 41, 59, 10,  9,118,101, 99, 91, 49, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 32, 45, 32, 97,114,
+101, 97, 91, 49, 93, 46,120,121,122, 41, 59, 10,  9,118,101, 99, 91, 50, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,
+ 99,111, 32, 45, 32, 97,114,101, 97, 91, 50, 93, 46,120,121,122, 41, 59, 10,  9,118,101, 99, 91, 51, 93, 32, 61, 32,110,111,114,
+109, 97,108,105,122,101, 40, 99,111, 32, 45, 32, 97,114,101, 97, 91, 51, 93, 46,120,121,122, 41, 59, 10, 10,  9, 99, 91, 48, 93,
+ 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,114,111,115,115, 40,118,101, 99, 91, 48, 93, 44, 32,118,101, 99, 91, 49,
+ 93, 41, 41, 59, 10,  9, 99, 91, 49, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,114,111,115,115, 40,118,101, 99,
+ 91, 49, 93, 44, 32,118,101, 99, 91, 50, 93, 41, 41, 59, 10,  9, 99, 91, 50, 93, 32, 61, 32,110,111,114,109, 97,108,105,122,101,
+ 40, 99,114,111,115,115, 40,118,101, 99, 91, 50, 93, 44, 32,118,101, 99, 91, 51, 93, 41, 41, 59, 10,  9, 99, 91, 51, 93, 32, 61,
+ 32,110,111,114,109, 97,108,105,122,101, 40, 99,114,111,115,115, 40,118,101, 99, 91, 51, 93, 44, 32,118,101, 99, 91, 48, 93, 41,
+ 41, 59, 10, 10,  9,114, 97,100, 91, 48, 93, 32, 61, 32, 97, 99,111,115, 40,100,111,116, 40,118,101, 99, 91, 48, 93, 44, 32,118,
+101, 99, 91, 49, 93, 41, 41, 59, 10,  9,114, 97,100, 91, 49, 93, 32, 61, 32, 97, 99,111,115, 40,100,111,116, 40,118,101, 99, 91,
+ 49, 93, 44, 32,118,101, 99, 91, 50, 93, 41, 41, 59, 10,  9,114, 97,100, 91, 50, 93, 32, 61, 32, 97, 99,111,115, 40,100,111,116,
+ 40,118,101, 99, 91, 50, 93, 44, 32,118,101, 99, 91, 51, 93, 41, 41, 59, 10,  9,114, 97,100, 91, 51, 93, 32, 61, 32, 97, 99,111,
+115, 40,100,111,116, 40,118,101, 99, 91, 51, 93, 44, 32,118,101, 99, 91, 48, 93, 41, 41, 59, 10, 10,  9,102, 97, 99, 61, 32, 32,
+114, 97,100, 91, 48, 93, 42,100,111,116, 40,118,110, 44, 32, 99, 91, 48, 93, 41, 59, 10,  9,102, 97, 99, 43, 61, 32,114, 97,100,
+ 91, 49, 93, 42,100,111,116, 40,118,110, 44, 32, 99, 91, 49, 93, 41, 59, 10,  9,102, 97, 99, 43, 61, 32,114, 97,100, 91, 50, 93,
+ 42,100,111,116, 40,118,110, 44, 32, 99, 91, 50, 93, 41, 59, 10,  9,102, 97, 99, 43, 61, 32,114, 97,100, 91, 51, 93, 42,100,111,
+116, 40,118,110, 44, 32, 99, 91, 51, 93, 41, 59, 10, 10,  9,114,101,116,117,114,110, 32,109, 97,120, 40,102, 97, 99, 44, 32, 48,
+ 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,105,110,112, 95, 97,114,101, 97, 40,118,101, 99, 51,
+ 32,112,111,115,105,116,105,111,110, 44, 32,118,101, 99, 51, 32,108, 97,109,112, 99,111, 44, 32,118,101, 99, 51, 32,108, 97,109,
+112,118,101, 99, 44, 32,118,101, 99, 51, 32,118,110, 44, 32,109, 97,116, 52, 32, 97,114,101, 97, 44, 32,102,108,111, 97,116, 32,
+ 97,114,101, 97,115,105,122,101, 44, 32,102,108,111, 97,116, 32,107, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,110,112,
+ 41, 10,123, 10,  9,118,101, 99, 51, 32, 99,111, 32, 61, 32,112,111,115,105,116,105,111,110, 59, 10,  9,118,101, 99, 51, 32,118,
+101, 99, 32, 61, 32, 99,111, 32, 45, 32,108, 97,109,112, 99,111, 59, 10, 10,  9,105,102, 40,100,111,116, 40,118,101, 99, 44, 32,
+108, 97,109,112,118,101, 99, 41, 32, 60, 32, 48, 46, 48, 41, 32,123, 10,  9,  9,105,110,112, 32, 61, 32, 48, 46, 48, 59, 10,  9,
+125, 10,  9,101,108,115,101, 32,123, 10,  9,  9,102,108,111, 97,116, 32,105,110,116,101,110,115, 32, 61, 32, 97,114,101, 97, 95,
+108, 97,109,112, 95,101,110,101,114,103,121, 40, 97,114,101, 97, 44, 32, 99,111, 44, 32,118,110, 41, 59, 10, 10,  9,  9,105,110,
+112, 32, 61, 32,112,111,119, 40,105,110,116,101,110,115, 42, 97,114,101, 97,115,105,122,101, 44, 32,107, 41, 59, 10,  9,125, 10,
+125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,100,105,102,102,117,115,101, 95,111,114,101,110, 95,110, 97,121,101,114,
+ 40,102,108,111, 97,116, 32,110,108, 44, 32,118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,
+118, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,115, 41, 10,123, 10,
+  9,118,101, 99, 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,118, 32, 43, 32,108, 41, 59, 10,  9,102,108,111,
+ 97,116, 32,110,104, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,104, 41, 44, 32, 48, 46, 48, 41, 59, 10,  9,102,108,
+111, 97,116, 32,110,118, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,118, 41, 44, 32, 48, 46, 48, 41, 59, 10,  9,102,
+108,111, 97,116, 32,114,101, 97,108,110,108, 32, 61, 32,100,111,116, 40,110, 44, 32,108, 41, 59, 10, 10,  9,105,102, 40,114,101,
+ 97,108,110,108, 32, 60, 32, 48, 46, 48, 41, 32,123, 10,  9,  9,105,115, 32, 61, 32, 48, 46, 48, 59, 10,  9,125, 10,  9,101,108,
+115,101, 32,105,102, 40,110,108, 32, 60, 32, 48, 46, 48, 41, 32,123, 10,  9,  9,105,115, 32, 61, 32, 48, 46, 48, 59, 10,  9,125,
+ 10,  9,101,108,115,101, 32,123, 10,  9,  9,102,108,111, 97,116, 32,118,104, 32, 61, 32,109, 97,120, 40,100,111,116, 40,118, 44,
+ 32,104, 41, 44, 32, 48, 46, 48, 41, 59, 10,  9,  9,102,108,111, 97,116, 32, 76,105,116, 95, 65, 32, 61, 32, 97, 99,111,115, 40,
+114,101, 97,108,110,108, 41, 59, 10,  9,  9,102,108,111, 97,116, 32, 86,105,101,119, 95, 65, 32, 61, 32, 97, 99,111,115, 40,110,
+118, 41, 59, 10, 10,  9,  9,118,101, 99, 51, 32, 76,105,116, 95, 66, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108, 32,
+ 45, 32,114,101, 97,108,110,108, 42,110, 41, 59, 10,  9,  9,118,101, 99, 51, 32, 86,105,101,119, 95, 66, 32, 61, 32,110,111,114,
+109, 97,108,105,122,101, 40,118, 32, 45, 32,110,118, 42,110, 41, 59, 10, 10,  9,  9,102,108,111, 97,116, 32,116, 32, 61, 32,109,
+ 97,120, 40,100,111,116, 40, 76,105,116, 95, 66, 44, 32, 86,105,101,119, 95, 66, 41, 44, 32, 48, 46, 48, 41, 59, 10, 10,  9,  9,
+102,108,111, 97,116, 32, 97, 44, 32, 98, 59, 10, 10,  9,  9,105,102, 40, 76,105,116, 95, 65, 32, 62, 32, 86,105,101,119, 95, 65,
+ 41, 32,123, 10,  9,  9,  9, 97, 32, 61, 32, 76,105,116, 95, 65, 59, 10,  9,  9,  9, 98, 32, 61, 32, 86,105,101,119, 95, 65, 59,
+ 10,  9,  9,125, 10,  9,  9,101,108,115,101, 32,123, 10,  9,  9,  9, 97, 32, 61, 32, 86,105,101,119, 95, 65, 59, 10,  9,  9,  9,
+ 98, 32, 61, 32, 76,105,116, 95, 65, 59, 10,  9,  9,125, 10, 10,  9,  9,102,108,111, 97,116, 32, 65, 32, 61, 32, 49, 46, 48, 32,
+ 45, 32, 40, 48, 46, 53, 42, 40, 40,114,111,117,103,104, 42,114,111,117,103,104, 41, 47, 40, 40,114,111,117,103,104, 42,114,111,
+117,103,104, 41, 32, 43, 32, 48, 46, 51, 51, 41, 41, 41, 59, 10,  9,  9,102,108,111, 97,116, 32, 66, 32, 61, 32, 48, 46, 52, 53,
+ 42, 40, 40,114,111,117,103,104, 42,114,111,117,103,104, 41, 47, 40, 40,114,111,117,103,104, 42,114,111,117,103,104, 41, 32, 43,
+ 32, 48, 46, 48, 57, 41, 41, 59, 10, 10,  9,  9, 98, 32, 42, 61, 32, 48, 46, 57, 53, 59, 10,  9,  9,105,115, 32, 61, 32,110,108,
+ 42, 40, 65, 32, 43, 32, 40, 66, 32, 42, 32,116, 32, 42, 32,115,105,110, 40, 97, 41, 32, 42, 32,116, 97,110, 40, 98, 41, 41, 41,
+ 59, 10,  9,125, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,100,105,102,102,117,115,101, 95,116,111,111,110, 40,
+118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,115,105,
+122,101, 44, 32,102,108,111, 97,116, 32,116,115,109,111,111,116,104, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,105,115, 41,
+ 10,123, 10,  9,102,108,111, 97,116, 32,114,115,108,116, 32, 61, 32,100,111,116, 40,110, 44, 32,108, 41, 59, 10,  9,102,108,111,
+ 97,116, 32, 97,110,103, 32, 61, 32, 97, 99,111,115, 40,114,115,108,116, 41, 59, 10, 10,  9,105,102, 40, 97,110,103, 32, 60, 32,
+115,105,122,101, 41, 32,105,115, 32, 61, 32, 49, 46, 48, 59, 10,  9,101,108,115,101, 32,105,102, 40, 97,110,103, 32, 62, 32, 40,
+115,105,122,101, 32, 43, 32,116,115,109,111,111,116,104, 41, 32,124,124, 32,116,115,109,111,111,116,104, 32, 61, 61, 32, 48, 46,
+ 48, 41, 32,105,115, 32, 61, 32, 48, 46, 48, 59, 10,  9,101,108,115,101, 32,105,115, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40, 40,
+ 97,110,103, 32, 45, 32,115,105,122,101, 41, 47,116,115,109,111,111,116,104, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104,
+ 97,100,101, 95,100,105,102,102,117,115,101, 95,109,105,110,110, 97,101,114,116, 40,102,108,111, 97,116, 32,110,108, 44, 32,118,
+101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,100, 97,114,107,110,101,115,115, 44, 32,111,
+117,116, 32,102,108,111, 97,116, 32,105,115, 41, 10,123, 10,  9,105,102, 40,110,108, 32, 60, 61, 32, 48, 46, 48, 41, 32,123, 10,
+  9,  9,105,115, 32, 61, 32, 48, 46, 48, 59, 10,  9,125, 10,  9,101,108,115,101, 32,123, 10,  9,  9,102,108,111, 97,116, 32,110,
+118, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,118, 41, 44, 32, 48, 46, 48, 41, 59, 10, 10,  9,  9,105,102, 40,100,
+ 97,114,107,110,101,115,115, 32, 60, 61, 32, 49, 46, 48, 41, 10,  9,  9,  9,105,115, 32, 61, 32,110,108, 42,112,111,119, 40,109,
+ 97,120, 40,110,118, 42,110,108, 44, 32, 48, 46, 49, 41, 44, 32,100, 97,114,107,110,101,115,115, 32, 45, 32, 49, 46, 48, 41, 59,
+ 10,  9,  9,101,108,115,101, 10,  9,  9,  9,105,115, 32, 61, 32,110,108, 42,112,111,119, 40, 49, 46, 48, 48, 48, 49, 32, 45, 32,
+110,118, 44, 32,100, 97,114,107,110,101,115,115, 32, 45, 32, 49, 46, 48, 41, 59, 10,  9,125, 10,125, 10, 10,102,108,111, 97,116,
+ 32,102,114,101,115,110,101,108, 95,102, 97, 99, 40,118,101, 99, 51, 32,118,105,101,119, 44, 32,118,101, 99, 51, 32,118,110, 44,
+ 32,102,108,111, 97,116, 32,103,114, 97,100, 44, 32,102,108,111, 97,116, 32,102, 97, 99, 41, 10,123, 10,  9,102,108,111, 97,116,
+ 32,116, 49, 44, 32,116, 50, 59, 10,  9,102,108,111, 97,116, 32,102,102, 97, 99, 59, 10, 10,  9,105,102, 40,102, 97, 99, 61, 61,
+ 48, 46, 48, 41, 32,123, 10,  9,  9,102,102, 97, 99, 32, 61, 32, 49, 46, 48, 59, 10,  9,125, 10,  9,101,108,115,101, 32,123, 10,
+  9,  9,116, 49, 61, 32,100,111,116, 40,118,105,101,119, 44, 32,118,110, 41, 59, 10,  9,  9,105,102, 40,116, 49, 62, 48, 46, 48,
+ 41, 32, 32,116, 50, 61, 32, 49, 46, 48, 43,116, 49, 59, 10,  9,  9,101,108,115,101, 32,116, 50, 61, 32, 49, 46, 48, 45,116, 49,
+ 59, 10, 10,  9,  9,116, 50, 61, 32,103,114, 97,100, 32, 43, 32, 40, 49, 46, 48, 45,103,114, 97,100, 41, 42,112,111,119, 40,116,
+ 50, 44, 32,102, 97, 99, 41, 59, 10, 10,  9,  9,105,102, 40,116, 50, 60, 48, 46, 48, 41, 32,102,102, 97, 99, 32, 61, 32, 48, 46,
+ 48, 59, 10,  9,  9,101,108,115,101, 32,105,102, 40,116, 50, 62, 49, 46, 48, 41, 32,102,102, 97, 99, 32, 61, 32, 49, 46, 48, 59,
+ 10,  9,  9,101,108,115,101, 32,102,102, 97, 99, 32, 61, 32,116, 50, 59, 10,  9,125, 10, 10,  9,114,101,116,117,114,110, 32,102,
+102, 97, 99, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,100,105,102,102,117,115,101, 95,102,114,101,115,110,
+101,108, 40,118,101, 99, 51, 32,118,110, 44, 32,118,101, 99, 51, 32,108,118, 44, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,
+102,108,111, 97,116, 32,102, 97, 99, 95,105, 44, 32,102,108,111, 97,116, 32,102, 97, 99, 44, 32,111,117,116, 32,102,108,111, 97,
+116, 32,105,115, 41, 10,123, 10,  9,105,115, 32, 61, 32,102,114,101,115,110,101,108, 95,102, 97, 99, 40,108,118, 44, 32,118,110,
+ 44, 32,102, 97, 99, 95,105, 44, 32,102, 97, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 99,117, 98,
+105, 99, 40,102,108,111, 97,116, 32,105,115, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,105,115, 41, 10,123, 10,
+  9,105,102, 40,105,115, 62, 48, 46, 48, 32, 38, 38, 32,105,115, 60, 49, 46, 48, 41, 10,  9,  9,111,117,116,105,115, 61, 32,115,
+109,111,111,116,104,115,116,101,112, 40, 48, 46, 48, 44, 32, 49, 46, 48, 44, 32,105,115, 41, 59, 10,  9,101,108,115,101, 10,  9,
+  9,111,117,116,105,115, 61, 32,105,115, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,118,105,115,105,102, 97,
+ 99, 40,102,108,111, 97,116, 32,105, 44, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,102,108,111, 97,116, 32,
+114,101,102,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,105, 41, 10,123, 10,  9, 47, 42,105,102, 40,105, 32,
+ 62, 32, 48, 46, 48, 41, 42, 47, 10,  9,  9,111,117,116,105, 32, 61, 32,109, 97,120, 40,105, 42,118,105,115,105,102, 97, 99, 42,
+114,101,102,108, 44, 32, 48, 46, 48, 41, 59, 10,  9, 47, 42,101,108,115,101, 10,  9,  9,111,117,116,105, 32, 61, 32,105, 59, 42,
+ 47, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,116, 97,110,103,101,110,116, 95,118, 95,115,112,101, 99, 40,118,
+101, 99, 51, 32,116, 97,110,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,110, 41, 10,123, 10,  9,118,110, 32, 61, 32,116,
+ 97,110,103, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 97,100,100, 95,116,111, 95,100,105,102,102,117,115,
+101, 40,102,108,111, 97,116, 32,105, 44, 32,118,101, 99, 51, 32,108, 97,109,112, 99,111,108, 44, 32,118,101, 99, 51, 32, 99,111,
+108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,105,102, 40,105, 32, 62, 32, 48, 46,
+ 48, 41, 10,  9,  9,111,117,116, 99,111,108, 32, 61, 32,105, 42,108, 97,109,112, 99,111,108, 42, 99,111,108, 59, 10,  9,101,108,
+115,101, 10,  9,  9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 44, 32, 48, 46, 48, 44, 32, 48, 46, 48,
+ 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,104,101,109,105, 95,115,112,101, 99, 40,118,101, 99, 51, 32,
+118,110, 44, 32,118,101, 99, 51, 32,108,118, 44, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,102,108,111, 97,116, 32,115,112,
+101, 99, 44, 32,102,108,111, 97,116, 32,104, 97,114,100, 44, 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,111,
+117,116, 32,102,108,111, 97,116, 32,116, 41, 10,123, 10,  9,108,118, 32, 43, 61, 32,118,105,101,119, 59, 10,  9,108,118, 32, 61,
+ 32,110,111,114,109, 97,108,105,122,101, 40,108,118, 41, 59, 10, 10,  9,116, 32, 61, 32,100,111,116, 40,118,110, 44, 32,108,118,
+ 41, 59, 10,  9,116, 32, 61, 32, 48, 46, 53, 42,116, 32, 43, 32, 48, 46, 53, 59, 10, 10,  9,116, 32, 61, 32,118,105,115,105,102,
+ 97, 99, 42,115,112,101, 99, 42,112,111,119, 40,116, 44, 32,104, 97,114,100, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104,
+ 97,100,101, 95,112,104,111,110,103, 95,115,112,101, 99, 40,118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,
+101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,104, 97,114,100, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,115,112,101,
+ 99,102, 97, 99, 41, 10,123, 10,  9,118,101, 99, 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108, 32, 43, 32,
+118, 41, 59, 10,  9,102,108,111, 97,116, 32,114,115,108,116, 32, 61, 32,109, 97,120, 40,100,111,116, 40,104, 44, 32,110, 41, 44,
+ 32, 48, 46, 48, 41, 59, 10, 10,  9,115,112,101, 99,102, 97, 99, 32, 61, 32,112,111,119, 40,114,115,108,116, 44, 32,104, 97,114,
+100, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 99,111,111,107,116,111,114,114, 95,115,112,101, 99, 40,
+118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,104, 97,
+114,100, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 41, 10,123, 10,  9,118,101, 99, 51, 32,104,
+ 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,118, 32, 43, 32,108, 41, 59, 10,  9,102,108,111, 97,116, 32,110,104, 32, 61,
+ 32,100,111,116, 40,110, 44, 32,104, 41, 59, 10, 10,  9,105,102, 40,110,104, 32, 60, 32, 48, 46, 48, 41, 32,123, 10,  9,  9,115,
+112,101, 99,102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10,  9,125, 10,  9,101,108,115,101, 32,123, 10,  9,  9,102,108,111, 97,116,
+ 32,110,118, 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,118, 41, 44, 32, 48, 46, 48, 41, 59, 10,  9,  9,102,108,111,
+ 97,116, 32,105, 32, 61, 32,112,111,119, 40,110,104, 44, 32,104, 97,114,100, 41, 59, 10, 10,  9,  9,105, 32, 61, 32,105, 47, 40,
+ 48, 46, 49, 43,110,118, 41, 59, 10,  9,  9,115,112,101, 99,102, 97, 99, 32, 61, 32,105, 59, 10,  9,125, 10,125, 10, 10,118,111,
+105,100, 32,115,104, 97,100,101, 95, 98,108,105,110,110, 95,115,112,101, 99, 40,118,101, 99, 51, 32,110, 44, 32,118,101, 99, 51,
+ 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,114,101,102,114, 97, 99, 44, 32,102,108,111, 97,116, 32,
+115,112,101, 99, 95,112,111,119,101,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 41, 10,123,
+ 10,  9,105,102, 40,114,101,102,114, 97, 99, 32, 60, 32, 49, 46, 48, 41, 32,123, 10,  9,  9,115,112,101, 99,102, 97, 99, 32, 61,
+ 32, 48, 46, 48, 59, 10,  9,125, 10,  9,101,108,115,101, 32,105,102, 40,115,112,101, 99, 95,112,111,119,101,114, 32, 61, 61, 32,
+ 48, 46, 48, 41, 32,123, 10,  9,  9,115,112,101, 99,102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10,  9,125, 10,  9,101,108,115,101,
+ 32,123, 10,  9,  9,105,102, 40,115,112,101, 99, 95,112,111,119,101,114, 60, 49, 48, 48, 46, 48, 41, 10,  9,  9,  9,115,112,101,
+ 99, 95,112,111,119,101,114, 61, 32,115,113,114,116, 40, 49, 46, 48, 47,115,112,101, 99, 95,112,111,119,101,114, 41, 59, 10,  9,
+  9,101,108,115,101, 10,  9,  9,  9,115,112,101, 99, 95,112,111,119,101,114, 61, 32, 49, 48, 46, 48, 47,115,112,101, 99, 95,112,
+111,119,101,114, 59, 10, 10,  9,  9,118,101, 99, 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,118, 32, 43, 32,
+108, 41, 59, 10,  9,  9,102,108,111, 97,116, 32,110,104, 32, 61, 32,100,111,116, 40,110, 44, 32,104, 41, 59, 10,  9,  9,105,102,
+ 40,110,104, 32, 60, 32, 48, 46, 48, 41, 32,123, 10,  9,  9,  9,115,112,101, 99,102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10,  9,
+  9,125, 10,  9,  9,101,108,115,101, 32,123, 10,  9,  9,  9,102,108,111, 97,116, 32,110,118, 32, 61, 32,109, 97,120, 40,100,111,
+116, 40,110, 44, 32,118, 41, 44, 32, 48, 46, 48, 49, 41, 59, 10,  9,  9,  9,102,108,111, 97,116, 32,110,108, 32, 61, 32,100,111,
+116, 40,110, 44, 32,108, 41, 59, 10,  9,  9,  9,105,102, 40,110,108, 32, 60, 61, 32, 48, 46, 48, 49, 41, 32,123, 10,  9,  9,  9,
+  9,115,112,101, 99,102, 97, 99, 32, 61, 32, 48, 46, 48, 59, 10,  9,  9,  9,125, 10,  9,  9,  9,101,108,115,101, 32,123, 10,  9,
+  9,  9,  9,102,108,111, 97,116, 32,118,104, 32, 61, 32,109, 97,120, 40,100,111,116, 40,118, 44, 32,104, 41, 44, 32, 48, 46, 48,
+ 49, 41, 59, 10, 10,  9,  9,  9,  9,102,108,111, 97,116, 32, 97, 32, 61, 32, 49, 46, 48, 59, 10,  9,  9,  9,  9,102,108,111, 97,
+116, 32, 98, 32, 61, 32, 40, 50, 46, 48, 42,110,104, 42,110,118, 41, 47,118,104, 59, 10,  9,  9,  9,  9,102,108,111, 97,116, 32,
+ 99, 32, 61, 32, 40, 50, 46, 48, 42,110,104, 42,110,108, 41, 47,118,104, 59, 10, 10,  9,  9,  9,  9,102,108,111, 97,116, 32,103,
+ 32, 61, 32, 48, 46, 48, 59, 10, 10,  9,  9,  9,  9,105,102, 40, 97, 32, 60, 32, 98, 32, 38, 38, 32, 97, 32, 60, 32, 99, 41, 32,
+103, 32, 61, 32, 97, 59, 10,  9,  9,  9,  9,101,108,115,101, 32,105,102, 40, 98, 32, 60, 32, 97, 32, 38, 38, 32, 98, 32, 60, 32,
+ 99, 41, 32,103, 32, 61, 32, 98, 59, 10,  9,  9,  9,  9,101,108,115,101, 32,105,102, 40, 99, 32, 60, 32, 97, 32, 38, 38, 32, 99,
+ 32, 60, 32, 98, 41, 32,103, 32, 61, 32, 99, 59, 10, 10,  9,  9,  9,  9,102,108,111, 97,116, 32,112, 32, 61, 32,115,113,114,116,
+ 40, 40, 40,114,101,102,114, 97, 99, 32, 42, 32,114,101,102,114, 97, 99, 41, 43, 40,118,104, 42,118,104, 41, 45, 49, 46, 48, 41,
+ 41, 59, 10,  9,  9,  9,  9,102,108,111, 97,116, 32,102, 32, 61, 32, 40, 40, 40,112, 45,118,104, 41, 42, 40,112, 45,118,104, 41,
+ 41, 47, 40, 40,112, 43,118,104, 41, 42, 40,112, 43,118,104, 41, 41, 41, 42, 40, 49, 46, 48, 43, 40, 40, 40, 40,118,104, 42, 40,
+112, 43,118,104, 41, 41, 45, 49, 46, 48, 41, 42, 40, 40,118,104, 42, 40,112, 43,118,104, 41, 41, 45, 49, 46, 48, 41, 41, 47, 40,
+ 40, 40,118,104, 42, 40,112, 45,118,104, 41, 41, 43, 49, 46, 48, 41, 42, 40, 40,118,104, 42, 40,112, 45,118,104, 41, 41, 43, 49,
+ 46, 48, 41, 41, 41, 41, 59, 10,  9,  9,  9,  9,102,108,111, 97,116, 32, 97,110,103, 32, 61, 32, 97, 99,111,115, 40,110,104, 41,
+ 59, 10, 10,  9,  9,  9,  9,115,112,101, 99,102, 97, 99, 32, 61, 32,109, 97,120, 40,102, 42,103, 42,101,120,112, 95, 98,108,101,
+110,100,101,114, 40, 40, 45, 40, 97,110,103, 42, 97,110,103, 41, 47, 40, 50, 46, 48, 42,115,112,101, 99, 95,112,111,119,101,114,
+ 42,115,112,101, 99, 95,112,111,119,101,114, 41, 41, 41, 44, 32, 48, 46, 48, 41, 59, 10,  9,  9,  9,125, 10,  9,  9,125, 10,  9,
+125, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,119, 97,114,100,105,115,111, 95,115,112,101, 99, 40,118,101, 99,
+ 51, 32,110, 44, 32,118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,114,109,115, 44, 32,
+111,117,116, 32,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 41, 10,123, 10,  9,118,101, 99, 51, 32,104, 32, 61, 32,110,
+111,114,109, 97,108,105,122,101, 40,108, 32, 43, 32,118, 41, 59, 10,  9,102,108,111, 97,116, 32,110,104, 32, 61, 32,109, 97,120,
+ 40,100,111,116, 40,110, 44, 32,104, 41, 44, 32, 48, 46, 48, 48, 49, 41, 59, 10,  9,102,108,111, 97,116, 32,110,118, 32, 61, 32,
+109, 97,120, 40,100,111,116, 40,110, 44, 32,118, 41, 44, 32, 48, 46, 48, 48, 49, 41, 59, 10,  9,102,108,111, 97,116, 32,110,108,
+ 32, 61, 32,109, 97,120, 40,100,111,116, 40,110, 44, 32,108, 41, 44, 32, 48, 46, 48, 48, 49, 41, 59, 10,  9,102,108,111, 97,116,
+ 32, 97,110,103,108,101, 32, 61, 32,116, 97,110, 40, 97, 99,111,115, 40,110,104, 41, 41, 59, 10,  9,102,108,111, 97,116, 32, 97,
+108,112,104, 97, 32, 61, 32,109, 97,120, 40,114,109,115, 44, 32, 48, 46, 48, 48, 49, 41, 59, 10, 10,  9,115,112,101, 99,102, 97,
+ 99, 61, 32,110,108, 32, 42, 32, 40, 49, 46, 48, 47, 40, 52, 46, 48, 42, 77, 95, 80, 73, 42, 97,108,112,104, 97, 42, 97,108,112,
+104, 97, 41, 41, 42, 40,101,120,112, 95, 98,108,101,110,100,101,114, 40, 45, 40, 97,110,103,108,101, 42, 97,110,103,108,101, 41,
+ 47, 40, 97,108,112,104, 97, 42, 97,108,112,104, 97, 41, 41, 47, 40,115,113,114,116, 40,110,118, 42,110,108, 41, 41, 41, 59, 10,
+125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,116,111,111,110, 95,115,112,101, 99, 40,118,101, 99, 51, 32,110, 44, 32,
+118,101, 99, 51, 32,108, 44, 32,118,101, 99, 51, 32,118, 44, 32,102,108,111, 97,116, 32,115,105,122,101, 44, 32,102,108,111, 97,
+116, 32,116,115,109,111,111,116,104, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 41, 10,123, 10,
+  9,118,101, 99, 51, 32,104, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108, 32, 43, 32,118, 41, 59, 10,  9,102,108,111,
+ 97,116, 32,114,115,108,116, 32, 61, 32,100,111,116, 40,104, 44, 32,110, 41, 59, 10,  9,102,108,111, 97,116, 32, 97,110,103, 32,
+ 61, 32, 97, 99,111,115, 40,114,115,108,116, 41, 59, 10, 10,  9,105,102, 40, 97,110,103, 32, 60, 32,115,105,122,101, 41, 32,114,
+115,108,116, 32, 61, 32, 49, 46, 48, 59, 10,  9,101,108,115,101, 32,105,102, 40, 97,110,103, 32, 62, 61, 32, 40,115,105,122,101,
+ 32, 43, 32,116,115,109,111,111,116,104, 41, 32,124,124, 32,116,115,109,111,111,116,104, 32, 61, 61, 32, 48, 46, 48, 41, 32,114,
+115,108,116, 32, 61, 32, 48, 46, 48, 59, 10,  9,101,108,115,101, 32,114,115,108,116, 32, 61, 32, 49, 46, 48, 32, 45, 32, 40, 40,
+ 97,110,103, 32, 45, 32,115,105,122,101, 41, 47,116,115,109,111,111,116,104, 41, 59, 10, 10,  9,115,112,101, 99,102, 97, 99, 32,
+ 61, 32,114,115,108,116, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,115,112,101, 99, 95, 97,114,101, 97, 95,
+105,110,112, 40,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 44, 32,102,108,111, 97,116, 32,105,110,112, 44, 32,111,117,
+116, 32,102,108,111, 97,116, 32,111,117,116,115,112,101, 99,102, 97, 99, 41, 10,123, 10,  9,111,117,116,115,112,101, 99,102, 97,
+ 99, 32, 61, 32,115,112,101, 99,102, 97, 99, 42,105,110,112, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,115,
+112,101, 99, 95,116, 40,102,108,111, 97,116, 32,115,104, 97,100,102, 97, 99, 44, 32,102,108,111, 97,116, 32,115,112,101, 99, 44,
+ 32,102,108,111, 97,116, 32,118,105,115,105,102, 97, 99, 44, 32,102,108,111, 97,116, 32,115,112,101, 99,102, 97, 99, 44, 32,111,
+117,116, 32,102,108,111, 97,116, 32,116, 41, 10,123, 10,  9,116, 32, 61, 32,115,104, 97,100,102, 97, 99, 42,115,112,101, 99, 42,
+118,105,115,105,102, 97, 99, 42,115,112,101, 99,102, 97, 99, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 97,
+100,100, 95,115,112,101, 99, 40,102,108,111, 97,116, 32,116, 44, 32,118,101, 99, 51, 32,108, 97,109,112, 99,111,108, 44, 32,118,
+101, 99, 51, 32,115,112,101, 99, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41, 10,123, 10,
+  9,111,117,116, 99,111,108, 32, 61, 32,116, 42,108, 97,109,112, 99,111,108, 42,115,112,101, 99, 99,111,108, 59, 10,125, 10, 10,
+118,111,105,100, 32,115,104, 97,100,101, 95, 97,100,100, 40,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,
 111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,111,117,116, 99,111,108, 32,
- 61, 32, 99,111,108, 32, 43, 32, 99,111,108, 49, 42, 99,111,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101,
- 95, 97,100,100, 95, 99,108, 97,109,112,101,100, 40,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108,
- 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,111,117,116, 99,111,108, 32, 61, 32,
- 99,111,108, 49, 32, 43, 32,109, 97,120, 40, 99,111,108, 50, 44, 32,118,101, 99, 52, 40, 48, 46, 48, 44, 32, 48, 46, 48, 44, 32,
- 48, 46, 48, 44, 32, 48, 46, 48, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,109, 97,100,100, 95, 99,
-108, 97,109,112,101,100, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52,
- 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,111,117,116, 99,111,
-108, 32, 61, 32, 99,111,108, 32, 43, 32,109, 97,120, 40, 99,111,108, 49, 42, 99,111,108, 50, 44, 32,118,101, 99, 52, 40, 48, 46,
- 48, 44, 32, 48, 46, 48, 44, 32, 48, 46, 48, 44, 32, 48, 46, 48, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,
-101, 95,109, 97,100,100,102, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 44, 32,118,101, 99, 52, 32,
- 99,111,108, 49, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,111,117,116, 99,111,108,
- 32, 61, 32, 99,111,108, 32, 43, 32,102, 42, 99,111,108, 49, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,109,
-117,108, 40,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99,
- 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 42, 99,111,108, 50, 59,
- 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,109,117,108, 95,118, 97,108,117,101, 40,102,108,111, 97,116, 32,102,
- 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123,
- 10,  9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 42,102, 97, 99, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,
-101, 95,111, 98, 99,111,108,111,114, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,118,101, 99, 52, 32,111, 98, 99,111,108, 44, 32,
-111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99,
- 52, 40, 99,111,108, 46,114,103, 98, 42,111, 98, 99,111,108, 46,114,103, 98, 44, 32, 99,111,108, 46, 97, 41, 59, 10,125, 10, 10,
-118,111,105,100, 32,114, 97,109,112, 95,114,103, 98,116,111, 98,119, 40,118,101, 99, 51, 32, 99,111,108,111,114, 44, 32,111,117,
-116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32, 99,111,108,111,
-114, 46,114, 42, 48, 46, 51, 32, 43, 32, 99,111,108,111,114, 46,103, 42, 48, 46, 53, 56, 32, 43, 32, 99,111,108,111,114, 46, 98,
- 42, 48, 46, 49, 50, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,111,110,108,121, 95,115,104, 97,100,111,119,
- 40,102,108,111, 97,116, 32,105, 44, 32,102,108,111, 97,116, 32,115,104, 97,100,102, 97, 99, 44, 32,102,108,111, 97,116, 32,101,
-110,101,114,103,121, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,115,104, 97,100,102, 97, 99, 41, 10,123, 10,  9,
-111,117,116,115,104, 97,100,102, 97, 99, 32, 61, 32,105, 42,101,110,101,114,103,121, 42, 40, 49, 46, 48, 32, 45, 32,115,104, 97,
-100,102, 97, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,111,110,108,121, 95,115,104, 97,100,111,119,
- 95,100,105,102,102,117,115,101, 40,102,108,111, 97,116, 32,115,104, 97,100,102, 97, 99, 44, 32,118,101, 99, 51, 32,114,103, 98,
- 44, 32,118,101, 99, 52, 32,100,105,102,102, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,100,105,102,102, 41, 10,123,
- 10,  9,111,117,116,100,105,102,102, 32, 61, 32,100,105,102,102, 32, 45, 32,118,101, 99, 52, 40,114,103, 98, 42,115,104, 97,100,
-102, 97, 99, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,111,110,108,121, 95,115,104,
- 97,100,111,119, 95,115,112,101, 99,117,108, 97,114, 40,102,108,111, 97,116, 32,115,104, 97,100,102, 97, 99, 44, 32,118,101, 99,
- 51, 32,115,112,101, 99,114,103, 98, 44, 32,118,101, 99, 52, 32,115,112,101, 99, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,
-117,116,115,112,101, 99, 41, 10,123, 10,  9,111,117,116,115,112,101, 99, 32, 61, 32,115,112,101, 99, 32, 45, 32,118,101, 99, 52,
- 40,115,112,101, 99,114,103, 98, 42,115,104, 97,100,102, 97, 99, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,
-116,101,115,116, 95,115,104, 97,100,111,119, 98,117,102, 40,118,101, 99, 51, 32,114, 99,111, 44, 32,115, 97,109,112,108,101,114,
- 50, 68, 83,104, 97,100,111,119, 32,115,104, 97,100,111,119,109, 97,112, 44, 32,109, 97,116, 52, 32,115,104, 97,100,111,119,112,
-101,114,115,109, 97,116, 44, 32,102,108,111, 97,116, 32,115,104, 97,100,111,119, 98,105, 97,115, 44, 32,102,108,111, 97,116, 32,
-105,110,112, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,114,101,115,117,108,116, 41, 10,123, 10,  9,105,102, 40,105,110,112,
- 32, 60, 61, 32, 48, 46, 48, 41, 32,123, 10,  9,  9,114,101,115,117,108,116, 32, 61, 32, 48, 46, 48, 59, 10,  9,125, 10,  9,101,
-108,115,101, 32,123, 10,  9,  9,118,101, 99, 52, 32, 99,111, 32, 61, 32,115,104, 97,100,111,119,112,101,114,115,109, 97,116, 42,
-118,101, 99, 52, 40,114, 99,111, 44, 32, 49, 46, 48, 41, 59, 10, 10,  9,  9, 47, 47,102,108,111, 97,116, 32, 98,105, 97,115, 32,
- 61, 32, 40, 49, 46, 53, 32, 45, 32,105,110,112, 42,105,110,112, 41, 42,115,104, 97,100,111,119, 98,105, 97,115, 59, 10,  9,  9,
- 99,111, 46,122, 32, 45, 61, 32,115,104, 97,100,111,119, 98,105, 97,115, 42, 99,111, 46,119, 59, 10, 10,  9,  9,114,101,115,117,
-108,116, 32, 61, 32,115,104, 97,100,111,119, 50, 68, 80,114,111,106, 40,115,104, 97,100,111,119,109, 97,112, 44, 32, 99,111, 41,
- 46,120, 59, 10,  9,125, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,101,120,112,111,115,117,114,101, 95, 99,111,
-114,114,101, 99,116, 40,118,101, 99, 51, 32, 99,111,108, 44, 32,102,108,111, 97,116, 32,108,105,110,102, 97, 99, 44, 32,102,108,
-111, 97,116, 32,108,111,103,102, 97, 99, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,
-111,117,116, 99,111,108, 32, 61, 32,108,105,110,102, 97, 99, 42, 40, 49, 46, 48, 32, 45, 32,101,120,112, 40, 99,111,108, 42,108,
-111,103,102, 97, 99, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,109,105,115,116, 95,102, 97, 99,116,
-111,114, 40,118,101, 99, 51, 32, 99,111, 44, 32,102,108,111, 97,116, 32,109,105,115,116,115,116, 97, 44, 32,102,108,111, 97,116,
- 32,109,105,115,116,100,105,115,116, 44, 32,102,108,111, 97,116, 32,109,105,115,116,116,121,112,101, 44, 32,102,108,111, 97,116,
- 32,109,105,115,105, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,102, 97, 99, 41, 10,123, 10,  9,102,108,111, 97,
-116, 32,102, 97, 99, 44, 32,122, 99,111,114, 59, 10, 10,  9,122, 99,111,114, 32, 61, 32, 40,103,108, 95, 80,114,111,106,101, 99,
-116,105,111,110, 77, 97,116,114,105,120, 91, 51, 93, 91, 51, 93, 32, 61, 61, 32, 48, 46, 48, 41, 63, 32,108,101,110,103,116,104,
- 40, 99,111, 41, 58, 32, 45, 99,111, 91, 50, 93, 59, 10,  9, 10,  9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40, 40,122, 99,
-111,114, 45,109,105,115,116,115,116, 97, 41, 47,109,105,115,116,100,105,115,116, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59,
- 10,  9,105,102, 40,109,105,115,116,116,121,112,101, 32, 61, 61, 32, 48, 46, 48, 41, 32,102, 97, 99, 32, 42, 61, 32,102, 97, 99,
- 59, 10,  9,101,108,115,101, 32,105,102, 40,109,105,115,116,116,121,112,101, 32, 61, 61, 32, 49, 46, 48, 41, 59, 10,  9,101,108,
-115,101, 32,102, 97, 99, 32, 61, 32,115,113,114,116, 40,102, 97, 99, 41, 59, 10, 10,  9,111,117,116,102, 97, 99, 32, 61, 32, 49,
- 46, 48, 32, 45, 32, 40, 49, 46, 48, 45,102, 97, 99, 41, 42, 40, 49, 46, 48, 45,109,105,115,105, 41, 59, 10,125, 10, 10,118,111,
-105,100, 32,115,104, 97,100,101, 95,119,111,114,108,100, 95,109,105,120, 40,118,101, 99, 51, 32,104,111,114, 44, 32,118,101, 99,
- 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,102,108,111, 97,116,
- 32,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40, 99,111,108, 46, 97, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,
-111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,109,105,120, 40,104,111,114, 44, 32, 99,111,108, 46,114,103, 98, 44, 32,
-102, 97, 99, 41, 44, 32, 99,111,108, 46, 97, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 97,108,112,104,
- 97, 95,111,112, 97,113,117,101, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,
-111,108, 41, 10,123, 10,  9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 99,111,108, 46,114,103, 98, 44, 32, 49, 46,
- 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 97,108,112,104, 97, 95,111, 98, 99,111,108,111,114, 40,
-118,101, 99, 52, 32, 99,111,108, 44, 32,118,101, 99, 52, 32,111, 98, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,
-117,116, 99,111,108, 41, 10,123, 10,  9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 99,111,108, 46,114,103, 98, 44,
- 32, 99,111,108, 46, 97, 42,111, 98, 99,111,108, 46, 97, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
- 32, 78, 69, 87, 32, 83, 72, 65, 68, 69, 82, 32, 85, 84, 73, 76, 73, 84, 73, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
- 42, 42, 42, 42, 47, 10, 10,102,108,111, 97,116, 32,102,114,101,115,110,101,108, 95,100,105,101,108,101, 99,116,114,105, 99, 40,
-118,101, 99, 51, 32, 73,110, 99,111,109,105,110,103, 44, 32,118,101, 99, 51, 32, 78,111,114,109, 97,108, 44, 32,102,108,111, 97,
-116, 32,101,116, 97, 41, 10,123, 10, 32, 32, 32, 32, 47, 42, 32, 99,111,109,112,117,116,101, 32,102,114,101,115,110,101,108, 32,
-114,101,102,108,101, 99,116, 97,110, 99,101, 32,119,105,116,104,111,117,116, 32,101,120,112,108,105, 99,105,116,108,121, 32, 99,
-111,109,112,117,116,105,110,103, 10, 32, 32, 32, 32, 32, 32, 32,116,104,101, 32,114,101,102,114, 97, 99,116,101,100, 32,100,105,
-114,101, 99,116,105,111,110, 32, 42, 47, 10, 32, 32, 32, 32,102,108,111, 97,116, 32, 99, 32, 61, 32, 97, 98,115, 40,100,111,116,
- 40, 73,110, 99,111,109,105,110,103, 44, 32, 78,111,114,109, 97,108, 41, 41, 59, 10, 32, 32, 32, 32,102,108,111, 97,116, 32,103,
- 32, 61, 32,101,116, 97, 32, 42, 32,101,116, 97, 32, 45, 32, 49, 46, 48, 32, 43, 32, 99, 32, 42, 32, 99, 59, 10, 32, 32, 32, 32,
-102,108,111, 97,116, 32,114,101,115,117,108,116, 59, 10, 10, 32, 32, 32, 32,105,102, 40,103, 32, 62, 32, 48, 46, 48, 41, 32,123,
- 10, 32, 32, 32, 32, 32, 32, 32, 32,103, 32, 61, 32,115,113,114,116, 40,103, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32,102,108,
-111, 97,116, 32, 65, 32, 61, 40,103, 32, 45, 32, 99, 41, 47, 40,103, 32, 43, 32, 99, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32,
-102,108,111, 97,116, 32, 66, 32, 61, 40, 99, 32, 42, 40,103, 32, 43, 32, 99, 41, 45, 32, 49, 46, 48, 41, 47, 40, 99, 32, 42, 40,
-103, 32, 45, 32, 99, 41, 43, 32, 49, 46, 48, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,115,117,108,116, 32, 61, 32, 48,
- 46, 53, 32, 42, 32, 65, 32, 42, 32, 65, 32, 42, 40, 49, 46, 48, 32, 43, 32, 66, 32, 42, 32, 66, 41, 59, 10, 32, 32, 32, 32,125,
- 10, 32, 32, 32, 32,101,108,115,101, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,115,117,108,116, 32, 61, 32, 49, 46, 48, 59, 32,
- 32, 47, 42, 32, 84, 73, 82, 32, 40,110,111, 32,114,101,102,114, 97, 99,116,101,100, 32, 99,111,109,112,111,110,101,110,116, 41,
- 32, 42, 47, 10, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,114,101,115,117,108,116, 59, 10,125, 10, 10,102,108,111, 97,116,
- 32,104,121,112,111,116, 40,102,108,111, 97,116, 32,120, 44, 32,102,108,111, 97,116, 32,121, 41, 10,123, 10,  9,114,101,116,117,
-114,110, 32,115,113,114,116, 40,120, 42,120, 32, 43, 32,121, 42,121, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42,
- 42, 42, 42, 32, 78, 69, 87, 32, 83, 72, 65, 68, 69, 82, 32, 78, 79, 68, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
- 42, 42, 42, 42, 47, 10, 10, 35,100,101,102,105,110,101, 32, 78, 85, 77, 95, 76, 73, 71, 72, 84, 83, 32, 51, 10, 10, 47, 42, 32,
- 98,115,100,102,115, 32, 42, 47, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95,100,105,102,102,117,115,101,
- 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104,110,101,115,115, 44, 32,118,101,
- 99, 51, 32, 78, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10,  9, 47, 42, 32, 97,109, 98,
-105,101,110,116, 32,108,105,103,104,116, 32, 42, 47, 10,  9,118,101, 99, 51, 32, 76, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 50,
- 41, 59, 10, 10,  9, 47, 42, 32,100,105,114,101, 99,116,105,111,110, 97,108, 32,108,105,103,104,116,115, 32, 42, 47, 10,  9,102,
-111,114, 40,105,110,116, 32,105, 32, 61, 32, 48, 59, 32,105, 32, 60, 32, 78, 85, 77, 95, 76, 73, 71, 72, 84, 83, 59, 32,105, 43,
- 43, 41, 32,123, 10,  9,  9,118,101, 99, 51, 32,108,105,103,104,116, 95,112,111,115,105,116,105,111,110, 32, 61, 32,103,108, 95,
- 76,105,103,104,116, 83,111,117,114, 99,101, 91,105, 93, 46,112,111,115,105,116,105,111,110, 46,120,121,122, 59, 10,  9,  9,118,
-101, 99, 51, 32,108,105,103,104,116, 95,100,105,102,102,117,115,101, 32, 61, 32,103,108, 95, 76,105,103,104,116, 83,111,117,114,
- 99,101, 91,105, 93, 46,100,105,102,102,117,115,101, 46,114,103, 98, 59, 10, 10,  9,  9,102,108,111, 97,116, 32, 98,115,100,102,
- 32, 61, 32,109, 97,120, 40,100,111,116, 40, 78, 44, 32,108,105,103,104,116, 95,112,111,115,105,116,105,111,110, 41, 44, 32, 48,
- 46, 48, 41, 59, 10,  9,  9, 76, 32, 43, 61, 32,108,105,103,104,116, 95,100,105,102,102,117,115,101, 42, 98,115,100,102, 59, 10,
-  9,125, 10, 10,  9,114,101,115,117,108,116, 32, 61, 32,118,101, 99, 52, 40, 76, 42, 99,111,108,111,114, 46,114,103, 98, 44, 32,
- 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95,103,108,111,115,115,121, 40,118,
-101, 99, 52, 32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104,110,101,115,115, 44, 32,118,101, 99, 51,
- 32, 78, 44, 32,118,101, 99, 51, 32, 73, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10,  9,
- 47, 42, 32, 97,109, 98,105,101,110,116, 32,108,105,103,104,116, 32, 42, 47, 10,  9,118,101, 99, 51, 32, 76, 32, 61, 32,118,101,
- 99, 51, 40, 48, 46, 50, 41, 59, 10, 10,  9, 47, 42, 32,100,105,114,101, 99,116,105,111,110, 97,108, 32,108,105,103,104,116,115,
- 32, 42, 47, 10,  9,102,111,114, 40,105,110,116, 32,105, 32, 61, 32, 48, 59, 32,105, 32, 60, 32, 78, 85, 77, 95, 76, 73, 71, 72,
- 84, 83, 59, 32,105, 43, 43, 41, 32,123, 10,  9,  9,118,101, 99, 51, 32,108,105,103,104,116, 95,112,111,115,105,116,105,111,110,
- 32, 61, 32,103,108, 95, 76,105,103,104,116, 83,111,117,114, 99,101, 91,105, 93, 46,112,111,115,105,116,105,111,110, 46,120,121,
-122, 59, 10,  9,  9,118,101, 99, 51, 32, 72, 32, 61, 32,103,108, 95, 76,105,103,104,116, 83,111,117,114, 99,101, 91,105, 93, 46,
-104, 97,108,102, 86,101, 99,116,111,114, 46,120,121,122, 59, 10,  9,  9,118,101, 99, 51, 32,108,105,103,104,116, 95,100,105,102,
-102,117,115,101, 32, 61, 32,103,108, 95, 76,105,103,104,116, 83,111,117,114, 99,101, 91,105, 93, 46,100,105,102,102,117,115,101,
- 46,114,103, 98, 59, 10,  9,  9,118,101, 99, 51, 32,108,105,103,104,116, 95,115,112,101, 99,117,108, 97,114, 32, 61, 32,103,108,
- 95, 76,105,103,104,116, 83,111,117,114, 99,101, 91,105, 93, 46,115,112,101, 99,117,108, 97,114, 46,114,103, 98, 59, 10, 10,  9,
-  9, 47, 42, 32,119,101, 32,109,105,120, 32,105,110, 32,115,111,109,101, 32,100,105,102,102,117,115,101, 32,115,111, 32,108,111,
-119, 32,114,111,117,103,104,110,101,115,115, 32,115,116,105,108,108, 32,115,104,111,119,115, 32,117,112, 32, 42, 47, 10,  9,  9,
-102,108,111, 97,116, 32, 98,115,100,102, 32, 61, 32, 48, 46, 53, 42,112,111,119, 40,109, 97,120, 40,100,111,116, 40, 78, 44, 32,
- 72, 41, 44, 32, 48, 46, 48, 41, 44, 32, 49, 46, 48, 47,114,111,117,103,104,110,101,115,115, 41, 59, 10,  9,  9, 98,115,100,102,
- 32, 43, 61, 32, 48, 46, 53, 42,109, 97,120, 40,100,111,116, 40, 78, 44, 32,108,105,103,104,116, 95,112,111,115,105,116,105,111,
-110, 41, 44, 32, 48, 46, 48, 41, 59, 10,  9,  9, 76, 32, 43, 61, 32,108,105,103,104,116, 95,115,112,101, 99,117,108, 97,114, 42,
- 98,115,100,102, 59, 10,  9,125, 10, 10,  9,114,101,115,117,108,116, 32, 61, 32,118,101, 99, 52, 40, 76, 42, 99,111,108,111,114,
- 46,114,103, 98, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95, 97,110,
-105,115,111,116,114,111,112,105, 99, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,114,111,117,103,
-104,110,101,115,115, 85, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104,110,101,115,115, 86, 44, 32,118,101, 99, 51, 32, 78,
- 44, 32,118,101, 99, 51, 32, 73, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10,  9,110,111,
-100,101, 95, 98,115,100,102, 95,100,105,102,102,117,115,101, 40, 99,111,108,111,114, 44, 32, 48, 46, 48, 44, 32, 78, 44, 32,114,
-101,115,117,108,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95,103,108, 97,115,115, 40,
-118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104,110,101,115,115, 44, 32,102,108,111,
- 97,116, 32,105,111,114, 44, 32,118,101, 99, 51, 32, 78, 44, 32,118,101, 99, 51, 32, 73, 44, 32,111,117,116, 32,118,101, 99, 52,
- 32,114,101,115,117,108,116, 41, 10,123, 10,  9,110,111,100,101, 95, 98,115,100,102, 95,100,105,102,102,117,115,101, 40, 99,111,
-108,111,114, 44, 32, 48, 46, 48, 44, 32, 78, 44, 32,114,101,115,117,108,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,
-100,101, 95, 98,115,100,102, 95,116,114, 97,110,115,108,117, 99,101,110,116, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,
-118,101, 99, 51, 32, 78, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10,  9,110,111,100,101,
- 95, 98,115,100,102, 95,100,105,102,102,117,115,101, 40, 99,111,108,111,114, 44, 32, 48, 46, 48, 44, 32, 78, 44, 32,114,101,115,
-117,108,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95,116,114, 97,110,115,112, 97,114,
-101,110,116, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41,
- 10,123, 10,  9, 47, 42, 32,116,104,105,115, 32,105,115,110, 39,116, 32,114,105,103,104,116, 32, 42, 47, 10,  9,114,101,115,117,
-108,116, 46,114, 32, 61, 32, 99,111,108,111,114, 46,114, 59, 10,  9,114,101,115,117,108,116, 46,103, 32, 61, 32, 99,111,108,111,
-114, 46,103, 59, 10,  9,114,101,115,117,108,116, 46, 98, 32, 61, 32, 99,111,108,111,114, 46, 98, 59, 10,  9,114,101,115,117,108,
-116, 46, 97, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95,118,101,108,
-118,101,116, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,115,105,103,109, 97, 44, 32,118,101, 99,
+ 61, 32, 99,111,108, 49, 32, 43, 32, 99,111,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,109, 97,100,
+100, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50,
+ 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,111,117,116, 99,111,108, 32, 61, 32, 99,
+111,108, 32, 43, 32, 99,111,108, 49, 42, 99,111,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 97,100,
+100, 95, 99,108, 97,109,112,101,100, 40,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,
+111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108,
+ 49, 32, 43, 32,109, 97,120, 40, 99,111,108, 50, 44, 32,118,101, 99, 52, 40, 48, 46, 48, 44, 32, 48, 46, 48, 44, 32, 48, 46, 48,
+ 44, 32, 48, 46, 48, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,109, 97,100,100, 95, 99,108, 97,109,
+112,101,100, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,
+108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,111,117,116, 99,111,108, 32, 61,
+ 32, 99,111,108, 32, 43, 32,109, 97,120, 40, 99,111,108, 49, 42, 99,111,108, 50, 44, 32,118,101, 99, 52, 40, 48, 46, 48, 44, 32,
+ 48, 46, 48, 44, 32, 48, 46, 48, 44, 32, 48, 46, 48, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,109,
+ 97,100,100,102, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,102,108,111, 97,116, 32,102, 44, 32,118,101, 99, 52, 32, 99,111,108,
+ 49, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,111,117,116, 99,111,108, 32, 61, 32,
+ 99,111,108, 32, 43, 32,102, 42, 99,111,108, 49, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,109,117,108, 40,
+118,101, 99, 52, 32, 99,111,108, 49, 44, 32,118,101, 99, 52, 32, 99,111,108, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,
+117,116, 99,111,108, 41, 10,123, 10,  9,111,117,116, 99,111,108, 32, 61, 32, 99,111,108, 49, 42, 99,111,108, 50, 59, 10,125, 10,
+ 10,118,111,105,100, 32,115,104, 97,100,101, 95,109,117,108, 95,118, 97,108,117,101, 40,102,108,111, 97,116, 32,102, 97, 99, 44,
+ 32,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,111,
+117,116, 99,111,108, 32, 61, 32, 99,111,108, 42,102, 97, 99, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,111,
+ 98, 99,111,108,111,114, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,118,101, 99, 52, 32,111, 98, 99,111,108, 44, 32,111,117,116,
+ 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 99,
+111,108, 46,114,103, 98, 42,111, 98, 99,111,108, 46,114,103, 98, 44, 32, 99,111,108, 46, 97, 41, 59, 10,125, 10, 10,118,111,105,
+100, 32,114, 97,109,112, 95,114,103, 98,116,111, 98,119, 40,118,101, 99, 51, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,102,
+108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10,  9,111,117,116,118, 97,108, 32, 61, 32, 99,111,108,111,114, 46,114,
+ 42, 48, 46, 51, 32, 43, 32, 99,111,108,111,114, 46,103, 42, 48, 46, 53, 56, 32, 43, 32, 99,111,108,111,114, 46, 98, 42, 48, 46,
+ 49, 50, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,111,110,108,121, 95,115,104, 97,100,111,119, 40,102,108,
+111, 97,116, 32,105, 44, 32,102,108,111, 97,116, 32,115,104, 97,100,102, 97, 99, 44, 32,102,108,111, 97,116, 32,101,110,101,114,
+103,121, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,115,104, 97,100,102, 97, 99, 41, 10,123, 10,  9,111,117,116,
+115,104, 97,100,102, 97, 99, 32, 61, 32,105, 42,101,110,101,114,103,121, 42, 40, 49, 46, 48, 32, 45, 32,115,104, 97,100,102, 97,
+ 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,111,110,108,121, 95,115,104, 97,100,111,119, 95,100,105,
+102,102,117,115,101, 40,102,108,111, 97,116, 32,115,104, 97,100,102, 97, 99, 44, 32,118,101, 99, 51, 32,114,103, 98, 44, 32,118,
+101, 99, 52, 32,100,105,102,102, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,100,105,102,102, 41, 10,123, 10,  9,111,
+117,116,100,105,102,102, 32, 61, 32,100,105,102,102, 32, 45, 32,118,101, 99, 52, 40,114,103, 98, 42,115,104, 97,100,102, 97, 99,
+ 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,111,110,108,121, 95,115,104, 97,100,111,
+119, 95,115,112,101, 99,117,108, 97,114, 40,102,108,111, 97,116, 32,115,104, 97,100,102, 97, 99, 44, 32,118,101, 99, 51, 32,115,
+112,101, 99,114,103, 98, 44, 32,118,101, 99, 52, 32,115,112,101, 99, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116,115,
+112,101, 99, 41, 10,123, 10,  9,111,117,116,115,112,101, 99, 32, 61, 32,115,112,101, 99, 32, 45, 32,118,101, 99, 52, 40,115,112,
+101, 99,114,103, 98, 42,115,104, 97,100,102, 97, 99, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,116,101,115,
+116, 95,115,104, 97,100,111,119, 98,117,102, 40,118,101, 99, 51, 32,114, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 83,
+104, 97,100,111,119, 32,115,104, 97,100,111,119,109, 97,112, 44, 32,109, 97,116, 52, 32,115,104, 97,100,111,119,112,101,114,115,
+109, 97,116, 44, 32,102,108,111, 97,116, 32,115,104, 97,100,111,119, 98,105, 97,115, 44, 32,102,108,111, 97,116, 32,105,110,112,
+ 44, 32,111,117,116, 32,102,108,111, 97,116, 32,114,101,115,117,108,116, 41, 10,123, 10,  9,105,102, 40,105,110,112, 32, 60, 61,
+ 32, 48, 46, 48, 41, 32,123, 10,  9,  9,114,101,115,117,108,116, 32, 61, 32, 48, 46, 48, 59, 10,  9,125, 10,  9,101,108,115,101,
+ 32,123, 10,  9,  9,118,101, 99, 52, 32, 99,111, 32, 61, 32,115,104, 97,100,111,119,112,101,114,115,109, 97,116, 42,118,101, 99,
+ 52, 40,114, 99,111, 44, 32, 49, 46, 48, 41, 59, 10, 10,  9,  9, 47, 47,102,108,111, 97,116, 32, 98,105, 97,115, 32, 61, 32, 40,
+ 49, 46, 53, 32, 45, 32,105,110,112, 42,105,110,112, 41, 42,115,104, 97,100,111,119, 98,105, 97,115, 59, 10,  9,  9, 99,111, 46,
+122, 32, 45, 61, 32,115,104, 97,100,111,119, 98,105, 97,115, 42, 99,111, 46,119, 59, 10, 10,  9,  9,114,101,115,117,108,116, 32,
+ 61, 32,115,104, 97,100,111,119, 50, 68, 80,114,111,106, 40,115,104, 97,100,111,119,109, 97,112, 44, 32, 99,111, 41, 46,120, 59,
+ 10,  9,125, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,101,120,112,111,115,117,114,101, 95, 99,111,114,114,101,
+ 99,116, 40,118,101, 99, 51, 32, 99,111,108, 44, 32,102,108,111, 97,116, 32,108,105,110,102, 97, 99, 44, 32,102,108,111, 97,116,
+ 32,108,111,103,102, 97, 99, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,111,117,116,
+ 99,111,108, 32, 61, 32,108,105,110,102, 97, 99, 42, 40, 49, 46, 48, 32, 45, 32,101,120,112, 40, 99,111,108, 42,108,111,103,102,
+ 97, 99, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95,109,105,115,116, 95,102, 97, 99,116,111,114, 40,
+118,101, 99, 51, 32, 99,111, 44, 32,102,108,111, 97,116, 32,109,105,115,116,115,116, 97, 44, 32,102,108,111, 97,116, 32,109,105,
+115,116,100,105,115,116, 44, 32,102,108,111, 97,116, 32,109,105,115,116,116,121,112,101, 44, 32,102,108,111, 97,116, 32,109,105,
+115,105, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,102, 97, 99, 41, 10,123, 10,  9,102,108,111, 97,116, 32,102,
+ 97, 99, 44, 32,122, 99,111,114, 59, 10, 10,  9,122, 99,111,114, 32, 61, 32, 40,103,108, 95, 80,114,111,106,101, 99,116,105,111,
+110, 77, 97,116,114,105,120, 91, 51, 93, 91, 51, 93, 32, 61, 61, 32, 48, 46, 48, 41, 63, 32,108,101,110,103,116,104, 40, 99,111,
+ 41, 58, 32, 45, 99,111, 91, 50, 93, 59, 10,  9, 10,  9,102, 97, 99, 32, 61, 32, 99,108, 97,109,112, 40, 40,122, 99,111,114, 45,
+109,105,115,116,115,116, 97, 41, 47,109,105,115,116,100,105,115,116, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,105,
+102, 40,109,105,115,116,116,121,112,101, 32, 61, 61, 32, 48, 46, 48, 41, 32,102, 97, 99, 32, 42, 61, 32,102, 97, 99, 59, 10,  9,
+101,108,115,101, 32,105,102, 40,109,105,115,116,116,121,112,101, 32, 61, 61, 32, 49, 46, 48, 41, 59, 10,  9,101,108,115,101, 32,
+102, 97, 99, 32, 61, 32,115,113,114,116, 40,102, 97, 99, 41, 59, 10, 10,  9,111,117,116,102, 97, 99, 32, 61, 32, 49, 46, 48, 32,
+ 45, 32, 40, 49, 46, 48, 45,102, 97, 99, 41, 42, 40, 49, 46, 48, 45,109,105,115,105, 41, 59, 10,125, 10, 10,118,111,105,100, 32,
+115,104, 97,100,101, 95,119,111,114,108,100, 95,109,105,120, 40,118,101, 99, 51, 32,104,111,114, 44, 32,118,101, 99, 52, 32, 99,
+111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10,  9,102,108,111, 97,116, 32,102, 97,
+ 99, 32, 61, 32, 99,108, 97,109,112, 40, 99,111,108, 46, 97, 44, 32, 48, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,  9,111,117,116,
+ 99,111,108, 32, 61, 32,118,101, 99, 52, 40,109,105,120, 40,104,111,114, 44, 32, 99,111,108, 46,114,103, 98, 44, 32,102, 97, 99,
+ 41, 44, 32, 99,111,108, 46, 97, 41, 59, 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 97,108,112,104, 97, 95,111,
+112, 97,113,117,101, 40,118,101, 99, 52, 32, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41,
+ 10,123, 10,  9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 99,111,108, 46,114,103, 98, 44, 32, 49, 46, 48, 41, 59,
+ 10,125, 10, 10,118,111,105,100, 32,115,104, 97,100,101, 95, 97,108,112,104, 97, 95,111, 98, 99,111,108,111,114, 40,118,101, 99,
+ 52, 32, 99,111,108, 44, 32,118,101, 99, 52, 32,111, 98, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,
+111,108, 41, 10,123, 10,  9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 99,111,108, 46,114,103, 98, 44, 32, 99,111,
+108, 46, 97, 42,111, 98, 99,111,108, 46, 97, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 78, 69,
+ 87, 32, 83, 72, 65, 68, 69, 82, 32, 85, 84, 73, 76, 73, 84, 73, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
+ 42, 47, 10, 10,102,108,111, 97,116, 32,102,114,101,115,110,101,108, 95,100,105,101,108,101, 99,116,114,105, 99, 40,118,101, 99,
+ 51, 32, 73,110, 99,111,109,105,110,103, 44, 32,118,101, 99, 51, 32, 78,111,114,109, 97,108, 44, 32,102,108,111, 97,116, 32,101,
+116, 97, 41, 10,123, 10, 32, 32, 32, 32, 47, 42, 32, 99,111,109,112,117,116,101, 32,102,114,101,115,110,101,108, 32,114,101,102,
+108,101, 99,116, 97,110, 99,101, 32,119,105,116,104,111,117,116, 32,101,120,112,108,105, 99,105,116,108,121, 32, 99,111,109,112,
+117,116,105,110,103, 10, 32, 32, 32, 32, 32, 32, 32,116,104,101, 32,114,101,102,114, 97, 99,116,101,100, 32,100,105,114,101, 99,
+116,105,111,110, 32, 42, 47, 10, 32, 32, 32, 32,102,108,111, 97,116, 32, 99, 32, 61, 32, 97, 98,115, 40,100,111,116, 40, 73,110,
+ 99,111,109,105,110,103, 44, 32, 78,111,114,109, 97,108, 41, 41, 59, 10, 32, 32, 32, 32,102,108,111, 97,116, 32,103, 32, 61, 32,
+101,116, 97, 32, 42, 32,101,116, 97, 32, 45, 32, 49, 46, 48, 32, 43, 32, 99, 32, 42, 32, 99, 59, 10, 32, 32, 32, 32,102,108,111,
+ 97,116, 32,114,101,115,117,108,116, 59, 10, 10, 32, 32, 32, 32,105,102, 40,103, 32, 62, 32, 48, 46, 48, 41, 32,123, 10, 32, 32,
+ 32, 32, 32, 32, 32, 32,103, 32, 61, 32,115,113,114,116, 40,103, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32,102,108,111, 97,116,
+ 32, 65, 32, 61, 40,103, 32, 45, 32, 99, 41, 47, 40,103, 32, 43, 32, 99, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32,102,108,111,
+ 97,116, 32, 66, 32, 61, 40, 99, 32, 42, 40,103, 32, 43, 32, 99, 41, 45, 32, 49, 46, 48, 41, 47, 40, 99, 32, 42, 40,103, 32, 45,
+ 32, 99, 41, 43, 32, 49, 46, 48, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,115,117,108,116, 32, 61, 32, 48, 46, 53, 32,
+ 42, 32, 65, 32, 42, 32, 65, 32, 42, 40, 49, 46, 48, 32, 43, 32, 66, 32, 42, 32, 66, 41, 59, 10, 32, 32, 32, 32,125, 10, 32, 32,
+ 32, 32,101,108,115,101, 10, 32, 32, 32, 32, 32, 32, 32, 32,114,101,115,117,108,116, 32, 61, 32, 49, 46, 48, 59, 32, 32, 47, 42,
+ 32, 84, 73, 82, 32, 40,110,111, 32,114,101,102,114, 97, 99,116,101,100, 32, 99,111,109,112,111,110,101,110,116, 41, 32, 42, 47,
+ 10, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,114,101,115,117,108,116, 59, 10,125, 10, 10,102,108,111, 97,116, 32,104,121,
+112,111,116, 40,102,108,111, 97,116, 32,120, 44, 32,102,108,111, 97,116, 32,121, 41, 10,123, 10,  9,114,101,116,117,114,110, 32,
+115,113,114,116, 40,120, 42,120, 32, 43, 32,121, 42,121, 41, 59, 10,125, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
+ 32, 78, 69, 87, 32, 83, 72, 65, 68, 69, 82, 32, 78, 79, 68, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
+ 42, 47, 10, 10, 35,100,101,102,105,110,101, 32, 78, 85, 77, 95, 76, 73, 71, 72, 84, 83, 32, 51, 10, 10, 47, 42, 32, 98,115,100,
+102,115, 32, 42, 47, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95,100,105,102,102,117,115,101, 40,118,101,
+ 99, 52, 32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104,110,101,115,115, 44, 32,118,101, 99, 51, 32,
+ 78, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10,  9, 47, 42, 32, 97,109, 98,105,101,110,
+116, 32,108,105,103,104,116, 32, 42, 47, 10,  9,118,101, 99, 51, 32, 76, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 50, 41, 59, 10,
+ 10,  9, 47, 42, 32,100,105,114,101, 99,116,105,111,110, 97,108, 32,108,105,103,104,116,115, 32, 42, 47, 10,  9,102,111,114, 40,
+105,110,116, 32,105, 32, 61, 32, 48, 59, 32,105, 32, 60, 32, 78, 85, 77, 95, 76, 73, 71, 72, 84, 83, 59, 32,105, 43, 43, 41, 32,
+123, 10,  9,  9,118,101, 99, 51, 32,108,105,103,104,116, 95,112,111,115,105,116,105,111,110, 32, 61, 32,103,108, 95, 76,105,103,
+104,116, 83,111,117,114, 99,101, 91,105, 93, 46,112,111,115,105,116,105,111,110, 46,120,121,122, 59, 10,  9,  9,118,101, 99, 51,
+ 32,108,105,103,104,116, 95,100,105,102,102,117,115,101, 32, 61, 32,103,108, 95, 76,105,103,104,116, 83,111,117,114, 99,101, 91,
+105, 93, 46,100,105,102,102,117,115,101, 46,114,103, 98, 59, 10, 10,  9,  9,102,108,111, 97,116, 32, 98,115,100,102, 32, 61, 32,
+109, 97,120, 40,100,111,116, 40, 78, 44, 32,108,105,103,104,116, 95,112,111,115,105,116,105,111,110, 41, 44, 32, 48, 46, 48, 41,
+ 59, 10,  9,  9, 76, 32, 43, 61, 32,108,105,103,104,116, 95,100,105,102,102,117,115,101, 42, 98,115,100,102, 59, 10,  9,125, 10,
+ 10,  9,114,101,115,117,108,116, 32, 61, 32,118,101, 99, 52, 40, 76, 42, 99,111,108,111,114, 46,114,103, 98, 44, 32, 49, 46, 48,
+ 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95,103,108,111,115,115,121, 40,118,101, 99, 52,
+ 32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104,110,101,115,115, 44, 32,118,101, 99, 51, 32, 78, 44,
+ 32,118,101, 99, 51, 32, 73, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10,  9, 47, 42, 32,
+ 97,109, 98,105,101,110,116, 32,108,105,103,104,116, 32, 42, 47, 10,  9,118,101, 99, 51, 32, 76, 32, 61, 32,118,101, 99, 51, 40,
+ 48, 46, 50, 41, 59, 10, 10,  9, 47, 42, 32,100,105,114,101, 99,116,105,111,110, 97,108, 32,108,105,103,104,116,115, 32, 42, 47,
+ 10,  9,102,111,114, 40,105,110,116, 32,105, 32, 61, 32, 48, 59, 32,105, 32, 60, 32, 78, 85, 77, 95, 76, 73, 71, 72, 84, 83, 59,
+ 32,105, 43, 43, 41, 32,123, 10,  9,  9,118,101, 99, 51, 32,108,105,103,104,116, 95,112,111,115,105,116,105,111,110, 32, 61, 32,
+103,108, 95, 76,105,103,104,116, 83,111,117,114, 99,101, 91,105, 93, 46,112,111,115,105,116,105,111,110, 46,120,121,122, 59, 10,
+  9,  9,118,101, 99, 51, 32, 72, 32, 61, 32,103,108, 95, 76,105,103,104,116, 83,111,117,114, 99,101, 91,105, 93, 46,104, 97,108,
+102, 86,101, 99,116,111,114, 46,120,121,122, 59, 10,  9,  9,118,101, 99, 51, 32,108,105,103,104,116, 95,100,105,102,102,117,115,
+101, 32, 61, 32,103,108, 95, 76,105,103,104,116, 83,111,117,114, 99,101, 91,105, 93, 46,100,105,102,102,117,115,101, 46,114,103,
+ 98, 59, 10,  9,  9,118,101, 99, 51, 32,108,105,103,104,116, 95,115,112,101, 99,117,108, 97,114, 32, 61, 32,103,108, 95, 76,105,
+103,104,116, 83,111,117,114, 99,101, 91,105, 93, 46,115,112,101, 99,117,108, 97,114, 46,114,103, 98, 59, 10, 10,  9,  9, 47, 42,
+ 32,119,101, 32,109,105,120, 32,105,110, 32,115,111,109,101, 32,100,105,102,102,117,115,101, 32,115,111, 32,108,111,119, 32,114,
+111,117,103,104,110,101,115,115, 32,115,116,105,108,108, 32,115,104,111,119,115, 32,117,112, 32, 42, 47, 10,  9,  9,102,108,111,
+ 97,116, 32, 98,115,100,102, 32, 61, 32, 48, 46, 53, 42,112,111,119, 40,109, 97,120, 40,100,111,116, 40, 78, 44, 32, 72, 41, 44,
+ 32, 48, 46, 48, 41, 44, 32, 49, 46, 48, 47,114,111,117,103,104,110,101,115,115, 41, 59, 10,  9,  9, 98,115,100,102, 32, 43, 61,
+ 32, 48, 46, 53, 42,109, 97,120, 40,100,111,116, 40, 78, 44, 32,108,105,103,104,116, 95,112,111,115,105,116,105,111,110, 41, 44,
+ 32, 48, 46, 48, 41, 59, 10,  9,  9, 76, 32, 43, 61, 32,108,105,103,104,116, 95,115,112,101, 99,117,108, 97,114, 42, 98,115,100,
+102, 59, 10,  9,125, 10, 10,  9,114,101,115,117,108,116, 32, 61, 32,118,101, 99, 52, 40, 76, 42, 99,111,108,111,114, 46,114,103,
+ 98, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95, 97,110,105,115,111,
+116,114,111,112,105, 99, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104,110,101,
+115,115, 85, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104,110,101,115,115, 86, 44, 32,118,101, 99, 51, 32, 78, 44, 32,118,
+101, 99, 51, 32, 73, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10,  9,110,111,100,101, 95,
+ 98,115,100,102, 95,100,105,102,102,117,115,101, 40, 99,111,108,111,114, 44, 32, 48, 46, 48, 44, 32, 78, 44, 32,114,101,115,117,
+108,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95,103,108, 97,115,115, 40,118,101, 99,
+ 52, 32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,114,111,117,103,104,110,101,115,115, 44, 32,102,108,111, 97,116, 32,
+105,111,114, 44, 32,118,101, 99, 51, 32, 78, 44, 32,118,101, 99, 51, 32, 73, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,
+115,117,108,116, 41, 10,123, 10,  9,110,111,100,101, 95, 98,115,100,102, 95,100,105,102,102,117,115,101, 40, 99,111,108,111,114,
+ 44, 32, 48, 46, 48, 44, 32, 78, 44, 32,114,101,115,117,108,116, 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95,
+ 98,115,100,102, 95,116,114, 97,110,115,108,117, 99,101,110,116, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,118,101, 99,
  51, 32, 78, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10,  9,110,111,100,101, 95, 98,115,
 100,102, 95,100,105,102,102,117,115,101, 40, 99,111,108,111,114, 44, 32, 48, 46, 48, 44, 32, 78, 44, 32,114,101,115,117,108,116,
- 41, 59, 10,125, 10, 10, 47, 42, 32,101,109,105,115,115,105,111,110, 32, 42, 47, 10, 10,118,111,105,100, 32,110,111,100,101, 95,
-101,109,105,115,115,105,111,110, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,115,116,114,101,110,
-103,116,104, 44, 32,118,101, 99, 51, 32, 78, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10,
-  9,114,101,115,117,108,116, 32, 61, 32, 99,111,108,111,114, 42,115,116,114,101,110,103,116,104, 59, 10,125, 10, 10, 47, 42, 32,
- 99,108,111,115,117,114,101,115, 32, 42, 47, 10, 10,118,111,105,100, 32,110,111,100,101, 95,109,105,120, 95,115,104, 97,100,101,
-114, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32,115,104, 97,100,101,114, 49, 44, 32,118,101, 99, 52, 32,
-115,104, 97,100,101,114, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,115,104, 97,100,101,114, 41, 10,123, 10,  9,115,104, 97,
-100,101,114, 32, 61, 32,109,105,120, 40,115,104, 97,100,101,114, 49, 44, 32,115,104, 97,100,101,114, 50, 44, 32,102, 97, 99, 41,
- 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 97,100,100, 95,115,104, 97,100,101,114, 40,118,101, 99, 52, 32,115,
-104, 97,100,101,114, 49, 44, 32,118,101, 99, 52, 32,115,104, 97,100,101,114, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,115,
-104, 97,100,101,114, 41, 10,123, 10,  9,115,104, 97,100,101,114, 32, 61, 32,115,104, 97,100,101,114, 49, 32, 43, 32,115,104, 97,
-100,101,114, 50, 59, 10,125, 10, 10, 47, 42, 32,102,114,101,115,110,101,108, 32, 42, 47, 10, 10,118,111,105,100, 32,110,111,100,
-101, 95,102,114,101,115,110,101,108, 40,102,108,111, 97,116, 32,105,111,114, 44, 32,118,101, 99, 51, 32, 78, 44, 32,118,101, 99,
- 51, 32, 73, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,114,101,115,117,108,116, 41, 10,123, 10,  9,102,108,111, 97,116, 32,
-101,116, 97, 32, 61, 32,109, 97,120, 40,105,111,114, 44, 32, 48, 46, 48, 48, 48, 48, 49, 41, 59, 10,  9,114,101,115,117,108,116,
- 32, 61, 32,102,114,101,115,110,101,108, 95,100,105,101,108,101, 99,116,114,105, 99, 40, 73, 44, 32, 78, 44, 32,101,116, 97, 41,
- 59, 32, 47, 47, 98, 97, 99,107,102, 97, 99,105,110,103, 40, 41, 63, 32, 49, 46, 48, 47,101,116, 97, 58, 32,101,116, 97, 41, 59,
- 10,125, 10, 10, 47, 42, 32,103,101,111,109,101,116,114,121, 32, 42, 47, 10, 10,118,111,105,100, 32,110,111,100,101, 95,103,101,
-111,109,101,116,114,121, 40,118,101, 99, 51, 32, 73, 44, 32,118,101, 99, 51, 32, 78, 44, 32,109, 97,116, 52, 32,116,111,119,111,
-114,108,100, 44, 10,  9,111,117,116, 32,118,101, 99, 51, 32,112,111,115,105,116,105,111,110, 44, 32,111,117,116, 32,118,101, 99,
- 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,116, 97,110,103,101,110,116, 44, 10,  9,111,117,116,
- 32,118,101, 99, 51, 32,116,114,117,101, 95,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,
-109,105,110,103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,112, 97,114, 97,109,101,116,114,105, 99, 44, 10,  9,111,117,116, 32,
-102,108,111, 97,116, 32, 98, 97, 99,107,102, 97, 99,105,110,103, 41, 10,123, 10,  9,112,111,115,105,116,105,111,110, 32, 61, 32,
- 40,116,111,119,111,114,108,100, 42,118,101, 99, 52, 40, 73, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10,  9,110,111,114,
-109, 97,108, 32, 61, 32, 78, 59, 10,  9,116, 97,110,103,101,110,116, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 41, 59, 10,  9,
-116,114,117,101, 95,110,111,114,109, 97,108, 32, 61, 32, 78, 59, 10,  9,105,110, 99,111,109,105,110,103, 32, 61, 32, 73, 59, 10,
-  9,112, 97,114, 97,109,101,116,114,105, 99, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 41, 59, 10,  9, 98, 97, 99,107,102, 97,
- 99,105,110,103, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95,116,101,120, 95, 99,111,111,
-114,100, 40,118,101, 99, 51, 32, 73, 44, 32,118,101, 99, 51, 32, 78, 44, 32,109, 97,116, 52, 32,116,111,119,111,114,108,100, 44,
- 10,  9,118,101, 99, 51, 32, 97,116,116,114, 95,111,114, 99,111, 44, 32,118,101, 99, 51, 32, 97,116,116,114, 95,117,118, 44, 10,
-  9,111,117,116, 32,118,101, 99, 51, 32,103,101,110,101,114, 97,116,101,100, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118,
- 44, 32,111,117,116, 32,118,101, 99, 51, 32,111, 98,106,101, 99,116, 44, 10,  9,111,117,116, 32,118,101, 99, 51, 32, 99, 97,109,
-101,114, 97, 44, 32,111,117,116, 32,118,101, 99, 51, 32,119,105,110,100,111,119, 44, 32,111,117,116, 32,118,101, 99, 51, 32,114,
-101,102,108,101, 99,116,105,111,110, 41, 10,123, 10,  9,103,101,110,101,114, 97,116,101,100, 32, 61, 32, 97,116,116,114, 95,111,
-114, 99,111, 59, 10,  9,117,118, 32, 61, 32, 97,116,116,114, 95,117,118, 59, 10,  9,111, 98,106,101, 99,116, 32, 61, 32, 73, 59,
- 10,  9, 99, 97,109,101,114, 97, 32, 61, 32, 73, 59, 10,  9,119,105,110,100,111,119, 32, 61, 32,103,108, 95, 70,114, 97,103, 67,
-111,111,114,100, 46,120,121,122, 59, 10,  9,114,101,102,108,101, 99,116,105,111,110, 32, 61, 32,114,101,102,108,101, 99,116, 40,
- 78, 44, 32, 73, 41, 59, 10, 10,125, 10, 10, 47, 42, 32,116,101,120,116,117,114,101,115, 32, 42, 47, 10, 10,118,111,105,100, 32,
-110,111,100,101, 95,116,101,120, 95,103,114, 97,100,105,101,110,116, 40,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,
-101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 97, 99, 41, 10,123, 10,  9, 99,111,108,
-111,114, 32, 61, 32,118,101, 99, 52, 40, 49, 46, 48, 41, 59, 10,  9,102, 97, 99, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,
-111,105,100, 32,110,111,100,101, 95,116,101,120, 95, 99,104,101, 99,107,101,114, 40,118,101, 99, 51, 32, 99,111, 44, 32,118,101,
- 99, 52, 32, 99,111,108,111,114, 49, 44, 32,118,101, 99, 52, 32, 99,111,108,111,114, 50, 44, 32,102,108,111, 97,116, 32,115, 99,
- 97,108,101, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102,
- 97, 99, 41, 10,123, 10,  9, 99,111,108,111,114, 32, 61, 32,118,101, 99, 52, 40, 49, 46, 48, 41, 59, 10,  9,102, 97, 99, 32, 61,
- 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95,116,101,120, 95, 99,108,111,117,100,115, 40,118,101,
- 99, 51, 32, 99,111, 44, 32,102,108,111, 97,116, 32,115,105,122,101, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108,111,
-114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 97, 99, 41, 10,123, 10,  9, 99,111,108,111,114, 32, 61, 32,118,101, 99,
- 52, 40, 49, 46, 48, 41, 59, 10,  9,102, 97, 99, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101,
- 95,116,101,120, 95,101,110,118,105,114,111,110,109,101,110,116, 40,118,101, 99, 51, 32, 99,111, 44, 32,115, 97,109,112,108,101,
-114, 50, 68, 32,105,109, 97, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108,111,114, 41, 10,123, 10,  9,102,108,111, 97,
-116, 32,117, 32, 61, 32, 40, 97,116, 97,110, 40, 99,111, 46,121, 44, 32, 99,111, 46,120, 41, 32, 43, 32, 77, 95, 80, 73, 41, 47,
- 40, 50, 46, 48, 42, 77, 95, 80, 73, 41, 59, 10,  9,102,108,111, 97,116, 32,118, 32, 61, 32, 97,116, 97,110, 40, 99,111, 46,122,
- 44, 32,104,121,112,111,116, 40, 99,111, 46,120, 44, 32, 99,111, 46,121, 41, 41, 47, 77, 95, 80, 73, 32, 43, 32, 48, 46, 53, 59,
- 10, 10,  9, 99,111,108,111,114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32,118,101, 99, 50, 40,117,
- 44, 32,118, 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95,116,101,120, 95,105,109, 97,103,101, 40,118,101,
- 99, 51, 32, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,
-111,108,111,114, 41, 10,123, 10,  9, 99,111,108,111,114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32,
- 99,111, 46,120,121, 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95,116,101,120, 95,109, 97,103,105, 99, 40,118,
+ 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95,116,114, 97,110,115,112, 97,114,101,110,116,
+ 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10,
+  9, 47, 42, 32,116,104,105,115, 32,105,115,110, 39,116, 32,114,105,103,104,116, 32, 42, 47, 10,  9,114,101,115,117,108,116, 46,
+114, 32, 61, 32, 99,111,108,111,114, 46,114, 59, 10,  9,114,101,115,117,108,116, 46,103, 32, 61, 32, 99,111,108,111,114, 46,103,
+ 59, 10,  9,114,101,115,117,108,116, 46, 98, 32, 61, 32, 99,111,108,111,114, 46, 98, 59, 10,  9,114,101,115,117,108,116, 46, 97,
+ 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95, 98,115,100,102, 95,118,101,108,118,101,116,
+ 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,115,105,103,109, 97, 44, 32,118,101, 99, 51, 32, 78,
+ 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10,  9,110,111,100,101, 95, 98,115,100,102, 95,
+100,105,102,102,117,115,101, 40, 99,111,108,111,114, 44, 32, 48, 46, 48, 44, 32, 78, 44, 32,114,101,115,117,108,116, 41, 59, 10,
+125, 10, 10, 47, 42, 32,101,109,105,115,115,105,111,110, 32, 42, 47, 10, 10,118,111,105,100, 32,110,111,100,101, 95,101,109,105,
+115,115,105,111,110, 40,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,102,108,111, 97,116, 32,115,116,114,101,110,103,116,104,
+ 44, 32,118,101, 99, 51, 32, 78, 44, 32,111,117,116, 32,118,101, 99, 52, 32,114,101,115,117,108,116, 41, 10,123, 10,  9,114,101,
+115,117,108,116, 32, 61, 32, 99,111,108,111,114, 42,115,116,114,101,110,103,116,104, 59, 10,125, 10, 10, 47, 42, 32, 99,108,111,
+115,117,114,101,115, 32, 42, 47, 10, 10,118,111,105,100, 32,110,111,100,101, 95,109,105,120, 95,115,104, 97,100,101,114, 40,102,
+108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32,115,104, 97,100,101,114, 49, 44, 32,118,101, 99, 52, 32,115,104, 97,
+100,101,114, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,115,104, 97,100,101,114, 41, 10,123, 10,  9,115,104, 97,100,101,114,
+ 32, 61, 32,109,105,120, 40,115,104, 97,100,101,114, 49, 44, 32,115,104, 97,100,101,114, 50, 44, 32,102, 97, 99, 41, 59, 10,125,
+ 10, 10,118,111,105,100, 32,110,111,100,101, 95, 97,100,100, 95,115,104, 97,100,101,114, 40,118,101, 99, 52, 32,115,104, 97,100,
+101,114, 49, 44, 32,118,101, 99, 52, 32,115,104, 97,100,101,114, 50, 44, 32,111,117,116, 32,118,101, 99, 52, 32,115,104, 97,100,
+101,114, 41, 10,123, 10,  9,115,104, 97,100,101,114, 32, 61, 32,115,104, 97,100,101,114, 49, 32, 43, 32,115,104, 97,100,101,114,
+ 50, 59, 10,125, 10, 10, 47, 42, 32,102,114,101,115,110,101,108, 32, 42, 47, 10, 10,118,111,105,100, 32,110,111,100,101, 95,102,
+114,101,115,110,101,108, 40,102,108,111, 97,116, 32,105,111,114, 44, 32,118,101, 99, 51, 32, 78, 44, 32,118,101, 99, 51, 32, 73,
+ 44, 32,111,117,116, 32,102,108,111, 97,116, 32,114,101,115,117,108,116, 41, 10,123, 10,  9,102,108,111, 97,116, 32,101,116, 97,
+ 32, 61, 32,109, 97,120, 40,105,111,114, 44, 32, 48, 46, 48, 48, 48, 48, 49, 41, 59, 10,  9,114,101,115,117,108,116, 32, 61, 32,
+102,114,101,115,110,101,108, 95,100,105,101,108,101, 99,116,114,105, 99, 40, 73, 44, 32, 78, 44, 32,101,116, 97, 41, 59, 32, 47,
+ 47, 98, 97, 99,107,102, 97, 99,105,110,103, 40, 41, 63, 32, 49, 46, 48, 47,101,116, 97, 58, 32,101,116, 97, 41, 59, 10,125, 10,
+ 10, 47, 42, 32,103,101,111,109,101,116,114,121, 32, 42, 47, 10, 10,118,111,105,100, 32,110,111,100,101, 95,103,101,111,109,101,
+116,114,121, 40,118,101, 99, 51, 32, 73, 44, 32,118,101, 99, 51, 32, 78, 44, 32,109, 97,116, 52, 32,116,111,119,111,114,108,100,
+ 44, 10,  9,111,117,116, 32,118,101, 99, 51, 32,112,111,115,105,116,105,111,110, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110,
+111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,116, 97,110,103,101,110,116, 44, 10,  9,111,117,116, 32,118,101,
+ 99, 51, 32,116,114,117,101, 95,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,105,110, 99,111,109,105,110,
+103, 44, 32,111,117,116, 32,118,101, 99, 51, 32,112, 97,114, 97,109,101,116,114,105, 99, 44, 10,  9,111,117,116, 32,102,108,111,
+ 97,116, 32, 98, 97, 99,107,102, 97, 99,105,110,103, 41, 10,123, 10,  9,112,111,115,105,116,105,111,110, 32, 61, 32, 40,116,111,
+119,111,114,108,100, 42,118,101, 99, 52, 40, 73, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10,  9,110,111,114,109, 97,108,
+ 32, 61, 32, 78, 59, 10,  9,116, 97,110,103,101,110,116, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 41, 59, 10,  9,116,114,117,
+101, 95,110,111,114,109, 97,108, 32, 61, 32, 78, 59, 10,  9,105,110, 99,111,109,105,110,103, 32, 61, 32, 73, 59, 10,  9,112, 97,
+114, 97,109,101,116,114,105, 99, 32, 61, 32,118,101, 99, 51, 40, 48, 46, 48, 41, 59, 10,  9, 98, 97, 99,107,102, 97, 99,105,110,
+103, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95,116,101,120, 95, 99,111,111,114,100, 40,
+118,101, 99, 51, 32, 73, 44, 32,118,101, 99, 51, 32, 78, 44, 32,109, 97,116, 52, 32,116,111,119,111,114,108,100, 44, 10,  9,118,
+101, 99, 51, 32, 97,116,116,114, 95,111,114, 99,111, 44, 32,118,101, 99, 51, 32, 97,116,116,114, 95,117,118, 44, 10,  9,111,117,
+116, 32,118,101, 99, 51, 32,103,101,110,101,114, 97,116,101,100, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 44, 32,111,
+117,116, 32,118,101, 99, 51, 32,111, 98,106,101, 99,116, 44, 10,  9,111,117,116, 32,118,101, 99, 51, 32, 99, 97,109,101,114, 97,
+ 44, 32,111,117,116, 32,118,101, 99, 51, 32,119,105,110,100,111,119, 44, 32,111,117,116, 32,118,101, 99, 51, 32,114,101,102,108,
+101, 99,116,105,111,110, 41, 10,123, 10,  9,103,101,110,101,114, 97,116,101,100, 32, 61, 32, 97,116,116,114, 95,111,114, 99,111,
+ 59, 10,  9,117,118, 32, 61, 32, 97,116,116,114, 95,117,118, 59, 10,  9,111, 98,106,101, 99,116, 32, 61, 32, 73, 59, 10,  9, 99,
+ 97,109,101,114, 97, 32, 61, 32, 73, 59, 10,  9,119,105,110,100,111,119, 32, 61, 32,103,108, 95, 70,114, 97,103, 67,111,111,114,
+100, 46,120,121,122, 59, 10,  9,114,101,102,108,101, 99,116,105,111,110, 32, 61, 32,114,101,102,108,101, 99,116, 40, 78, 44, 32,
+ 73, 41, 59, 10, 10,125, 10, 10, 47, 42, 32,116,101,120,116,117,114,101,115, 32, 42, 47, 10, 10,118,111,105,100, 32,110,111,100,
+101, 95,116,101,120, 95,103,114, 97,100,105,101,110,116, 40,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 52,
+ 32, 99,111,108,111,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 97, 99, 41, 10,123, 10,  9, 99,111,108,111,114, 32,
+ 61, 32,118,101, 99, 52, 40, 49, 46, 48, 41, 59, 10,  9,102, 97, 99, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100,
+ 32,110,111,100,101, 95,116,101,120, 95, 99,104,101, 99,107,101,114, 40,118,101, 99, 51, 32, 99,111, 44, 32,118,101, 99, 52, 32,
+ 99,111,108,111,114, 49, 44, 32,118,101, 99, 52, 32, 99,111,108,111,114, 50, 44, 32,102,108,111, 97,116, 32,115, 99, 97,108,101,
+ 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,102, 97, 99, 41,
+ 10,123, 10,  9, 99,111,108,111,114, 32, 61, 32,118,101, 99, 52, 40, 49, 46, 48, 41, 59, 10,  9,102, 97, 99, 32, 61, 32, 49, 46,
+ 48, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95,116,101,120, 95, 99,108,111,117,100,115, 40,118,101, 99, 51, 32,
+ 99,111, 44, 32,102,108,111, 97,116, 32,115,105,122,101, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,
+111,117,116, 32,102,108,111, 97,116, 32,102, 97, 99, 41, 10,123, 10,  9, 99,111,108,111,114, 32, 61, 32,118,101, 99, 52, 40, 49,
+ 46, 48, 41, 59, 10,  9,102, 97, 99, 32, 61, 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95,116,101,
+120, 95,101,110,118,105,114,111,110,109,101,110,116, 40,118,101, 99, 51, 32, 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68,
+ 32,105,109, 97, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108,111,114, 41, 10,123, 10,  9,102,108,111, 97,116, 32,117,
+ 32, 61, 32, 40, 97,116, 97,110, 40, 99,111, 46,121, 44, 32, 99,111, 46,120, 41, 32, 43, 32, 77, 95, 80, 73, 41, 47, 40, 50, 46,
+ 48, 42, 77, 95, 80, 73, 41, 59, 10,  9,102,108,111, 97,116, 32,118, 32, 61, 32, 97,116, 97,110, 40, 99,111, 46,122, 44, 32,104,
+121,112,111,116, 40, 99,111, 46,120, 44, 32, 99,111, 46,121, 41, 41, 47, 77, 95, 80, 73, 32, 43, 32, 48, 46, 53, 59, 10, 10,  9,
+ 99,111,108,111,114, 32, 61, 32,116,101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32,118,101, 99, 50, 40,117, 44, 32,118,
+ 41, 41, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95,116,101,120, 95,105,109, 97,103,101, 40,118,101, 99, 51, 32,
+ 99,111, 44, 32,115, 97,109,112,108,101,114, 50, 68, 32,105,109, 97, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108,111,
+114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, 97,108,112,104, 97, 41, 10,123, 10,  9, 99,111,108,111,114, 32, 61, 32,116,
+101,120,116,117,114,101, 50, 68, 40,105,109, 97, 44, 32, 99,111, 46,120,121, 41, 59, 10,  9, 97,108,112,104, 97, 32, 61, 32, 99,
+111,108,111,114, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,100,101, 95,116,101,120, 95,109, 97,103,105, 99, 40,118,
 101, 99, 51, 32,112, 44, 32,102,108,111, 97,116, 32,115, 99, 97,108,101, 44, 32,102,108,111, 97,116, 32,100,105,115,116,111,114,
 116,105,111,110, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108,111,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,
 102, 97, 99, 41, 10,123, 10,  9, 99,111,108,111,114, 32, 61, 32,118,101, 99, 52, 40, 49, 46, 48, 41, 59, 10,  9,102, 97, 99, 32,
diff --git a/source/blender/ikplugin/BIK_api.h b/source/blender/ikplugin/BIK_api.h
index 4b90b25..cbc6485 100644
--- a/source/blender/ikplugin/BIK_api.h
+++ b/source/blender/ikplugin/BIK_api.h
@@ -31,8 +31,8 @@
  */
 
 
-#ifndef BIK_API_H
-#define BIK_API_H
+#ifndef __BIK_API_H__
+#define __BIK_API_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -92,5 +92,5 @@ int BIK_get_solver_param(struct bPose *pose, struct bPoseChannel *pchan, int id,
 }
 #endif
 
-#endif // BIK_API_H
+#endif // __BIK_API_H__
 
diff --git a/source/blender/ikplugin/intern/ikplugin_api.h b/source/blender/ikplugin/intern/ikplugin_api.h
index b1e7232..77c9622 100644
--- a/source/blender/ikplugin/intern/ikplugin_api.h
+++ b/source/blender/ikplugin/intern/ikplugin_api.h
@@ -31,8 +31,8 @@
  */
 
 
-#ifndef IKPLUGIN_API_H
-#define IKPLUGIN_API_H
+#ifndef __IKPLUGIN_API_H__
+#define __IKPLUGIN_API_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -60,5 +60,5 @@ typedef struct IKPlugin IKPlugin;
 }
 #endif
 
-#endif // IKPLUGIN_API_H
+#endif // __IKPLUGIN_API_H__
 
diff --git a/source/blender/ikplugin/intern/iksolver_plugin.c b/source/blender/ikplugin/intern/iksolver_plugin.c
index 34656da..8d4d01b 100644
--- a/source/blender/ikplugin/intern/iksolver_plugin.c
+++ b/source/blender/ikplugin/intern/iksolver_plugin.c
@@ -65,8 +65,8 @@ static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_t
 	int a, t, segcount= 0, size, newsize, *oldparent, parent;
 
 	/* find IK constraint, and validate it */
-	for(con= pchan_tip->constraints.first; con; con= con->next) {
-		if(con->type==CONSTRAINT_TYPE_KINEMATIC) {
+	for (con= pchan_tip->constraints.first; con; con= con->next) {
+		if (con->type==CONSTRAINT_TYPE_KINEMATIC) {
 			data=(bKinematicConstraint*)con->data;
 			if (data->flag & CONSTRAINT_IK_AUTO) break;
 			if (data->tar==NULL) continue;
@@ -74,36 +74,36 @@ static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_t
 			if ((con->flag & (CONSTRAINT_DISABLE|CONSTRAINT_OFF))==0 && (con->enforce != 0.0f)) break;
 		}
 	}
-	if(con==NULL) return;
+	if (con==NULL) return;
 	
 	/* exclude tip from chain? */
-	if(!(data->flag & CONSTRAINT_IK_TIP))
+	if (!(data->flag & CONSTRAINT_IK_TIP))
 		pchan_tip= pchan_tip->parent;
 	
 	/* Find the chain's root & count the segments needed */
-	for (curchan = pchan_tip; curchan; curchan=curchan->parent){
+	for (curchan = pchan_tip; curchan; curchan=curchan->parent) {
 		pchan_root = curchan;
 		
 		curchan->flag |= POSE_CHAIN;	// don't forget to clear this
 		chanlist[segcount]=curchan;
 		segcount++;
 		
-		if(segcount==data->rootbone || segcount>255) break; // 255 is weak
+		if (segcount==data->rootbone || segcount>255) break; // 255 is weak
 	}
 	if (!segcount) return;
 
 	/* setup the chain data */
 	
 	/* we make tree-IK, unless all existing targets are in this chain */
-	for(tree= pchan_root->iktree.first; tree; tree= tree->next) {
-		for(target= tree->targets.first; target; target= target->next) {
+	for (tree= pchan_root->iktree.first; tree; tree= tree->next) {
+		for (target= tree->targets.first; target; target= target->next) {
 			curchan= tree->pchan[target->tip];
-			if(curchan->flag & POSE_CHAIN)
+			if (curchan->flag & POSE_CHAIN)
 				curchan->flag &= ~POSE_CHAIN;
 			else
 				break;
 		}
-		if(target) break;
+		if (target) break;
 	}
 
 	/* create a target */
@@ -111,7 +111,7 @@ static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_t
 	target->con= con;
 	pchan_tip->flag &= ~POSE_CHAIN;
 
-	if(tree==NULL) {
+	if (tree==NULL) {
 		/* make new tree */
 		tree= MEM_callocN(sizeof(PoseTree), "posetree");
 
@@ -123,7 +123,7 @@ static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_t
 		
 		tree->pchan= MEM_callocN(segcount*sizeof(void*), "ik tree pchan");
 		tree->parent= MEM_callocN(segcount*sizeof(int), "ik tree parent");
-		for(a=0; a<segcount; a++) {
+		for (a=0; a<segcount; a++) {
 			tree->pchan[a]= chanlist[segcount-a-1];
 			tree->parent[a]= a-1;
 		}
@@ -144,19 +144,19 @@ static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_t
 			for (;t<tree->totchannel && tree->pchan[t]!=chanlist[segcount-a-1];t++);
 			if (t>=tree->totchannel)
 				break;
-			for(; a<size && t<tree->totchannel && tree->pchan[t]==chanlist[segcount-a-1]; a++, t++);
+			for (; a<size && t<tree->totchannel && tree->pchan[t]==chanlist[segcount-a-1]; a++, t++);
 		}
 
 		segcount= segcount-a;
 		target->tip= tree->totchannel + segcount - 1;
 
 		if (segcount > 0) {
-			for(parent = a - 1; parent < tree->totchannel; parent++)
-				if(tree->pchan[parent] == chanlist[segcount-1]->parent)
+			for (parent = a - 1; parent < tree->totchannel; parent++)
+				if (tree->pchan[parent] == chanlist[segcount-1]->parent)
 					break;
 			
 			/* shouldn't happen, but could with dependency cycles */
-			if(parent == tree->totchannel)
+			if (parent == tree->totchannel)
 				parent = a - 1;
 
 			/* resize array */
@@ -172,7 +172,7 @@ static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_t
 			MEM_freeN(oldparent);
 
 			/* add new pose channels at the end, in reverse order */
-			for(a=0; a<segcount; a++) {
+			for (a=0; a<segcount; a++) {
 				tree->pchan[tree->totchannel+a]= chanlist[segcount-a-1];
 				tree->parent[tree->totchannel+a]= tree->totchannel+a-1;
 			}
@@ -230,7 +230,7 @@ static void where_is_ik_bone(bPoseChannel *pchan, float ik_mat[][3])   // nr = t
 
 
 /* called from within the core where_is_pose loop, all animsystems and constraints
-were executed & assigned. Now as last we do an IK pass */
+ * were executed & assigned. Now as last we do an IK pass */
 static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
 {
 	float R_parmat[3][3], identity[3][3];
@@ -256,20 +256,20 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
 	
 	iktree= MEM_mallocN(sizeof(void*)*tree->totchannel, "ik tree");
 
-	for(a=0; a<tree->totchannel; a++) {
+	for (a=0; a<tree->totchannel; a++) {
 		pchan= tree->pchan[a];
 		bone= pchan->bone;
 		
 		/* set DoF flag */
 		flag= 0;
-		if(!(pchan->ikflag & BONE_IK_NO_XDOF) && !(pchan->ikflag & BONE_IK_NO_XDOF_TEMP))
+		if (!(pchan->ikflag & BONE_IK_NO_XDOF) && !(pchan->ikflag & BONE_IK_NO_XDOF_TEMP))
 			flag |= IK_XDOF;
-		if(!(pchan->ikflag & BONE_IK_NO_YDOF) && !(pchan->ikflag & BONE_IK_NO_YDOF_TEMP))
+		if (!(pchan->ikflag & BONE_IK_NO_YDOF) && !(pchan->ikflag & BONE_IK_NO_YDOF_TEMP))
 			flag |= IK_YDOF;
-		if(!(pchan->ikflag & BONE_IK_NO_ZDOF) && !(pchan->ikflag & BONE_IK_NO_ZDOF_TEMP))
+		if (!(pchan->ikflag & BONE_IK_NO_ZDOF) && !(pchan->ikflag & BONE_IK_NO_ZDOF_TEMP))
 			flag |= IK_ZDOF;
 		
-		if(tree->stretch && (pchan->ikstretch > 0.0f)) {
+		if (tree->stretch && (pchan->ikstretch > 0.0f)) {
 			flag |= IK_TRANS_YDOF;
 			hasstretch = 1;
 		}
@@ -277,7 +277,7 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
 		seg= iktree[a]= IK_CreateSegment(flag);
 		
 		/* find parent */
-		if(a == 0)
+		if (a == 0)
 			parent= NULL;
 		else
 			parent= iktree[tree->parent[a]];
@@ -334,7 +334,7 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
 		IK_SetStiffness(seg, IK_Y, pchan->stiffness[1]);
 		IK_SetStiffness(seg, IK_Z, pchan->stiffness[2]);
 		
-		if(tree->stretch && (pchan->ikstretch > 0.0f)) {
+		if (tree->stretch && (pchan->ikstretch > 0.0f)) {
 			float ikstretch = pchan->ikstretch*pchan->ikstretch;
 			IK_SetStiffness(seg, IK_TRANS_Y, MIN2(1.0f-ikstretch, 0.99f));
 			IK_SetLimit(seg, IK_TRANS_Y, 0.001, 1e10);
@@ -347,11 +347,15 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
 
 	/* first set the goal inverse transform, assuming the root of tree was done ok! */
 	pchan= tree->pchan[0];
-	if (pchan->parent)
+	if (pchan->parent) {
 		/* transform goal by parent mat, so this rotation is not part of the
-		   segment's basis. otherwise rotation limits do not work on the
-		   local transform of the segment itself. */
+		 * segment's basis. otherwise rotation limits do not work on the
+		 * local transform of the segment itself. */
 		copy_m4_m4(rootmat, pchan->parent->pose_mat);
+		/* However, we do not want to get (i.e. reverse) parent's scale, as it generates [#31008]
+		 * kind of nasty bugs... */
+		normalize_m4(rootmat);
+	}
 	else
 		unit_m4(rootmat);
 	copy_v3_v3(rootmat[3], pchan->pose_head);
@@ -377,10 +381,10 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
 		copy_m3_m4(goalrot, goal);
 		
 		/* same for pole vector target */
-		if(data->poletar) {
+		if (data->poletar) {
 			get_constraint_target_matrix(scene, target->con, 1, CONSTRAINT_OBTYPE_OBJECT, ob, rootmat, 1.0);
 			
-			if(data->flag & CONSTRAINT_IK_SETANGLE) {
+			if (data->flag & CONSTRAINT_IK_SETANGLE) {
 				/* don't solve IK when we are setting the pole angle */
 				break;
 			}
@@ -395,7 +399,7 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
 				resultblend= 1;
 				resultinf= target->con->enforce;
 				
-				if(data->flag & CONSTRAINT_IK_GETANGLE) {
+				if (data->flag & CONSTRAINT_IK_GETANGLE) {
 					poleangledata= data;
 					data->flag &= ~CONSTRAINT_IK_GETANGLE;
 				}
@@ -429,14 +433,14 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
 		
 		iktarget= iktree[target->tip];
 		
-		if(data->weight != 0.0f) {
-			if(poleconstrain)
+		if (data->weight != 0.0f) {
+			if (poleconstrain)
 				IK_SolverSetPoleVectorConstraint(solver, iktarget, goalpos,
 					polepos, data->poleangle, (poleangledata == data));
 			IK_SolverAddGoal(solver, iktarget, goalpos, data->weight);
 		}
-		if((data->flag & CONSTRAINT_IK_ROT) && (data->orientweight != 0.0f))
-			if((data->flag & CONSTRAINT_IK_AUTO)==0)
+		if ((data->flag & CONSTRAINT_IK_ROT) && (data->orientweight != 0.0f))
+			if ((data->flag & CONSTRAINT_IK_AUTO)==0)
 				IK_SolverAddGoalOrientation(solver, iktarget, goalrot,
 					data->orientweight);
 	}
@@ -444,27 +448,27 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
 	/* solve */
 	IK_Solve(solver, 0.0f, tree->iterations);
 
-	if(poleangledata)
+	if (poleangledata)
 		poleangledata->poleangle= IK_SolverGetPoleAngle(solver);
 
 	IK_FreeSolver(solver);
 
 	/* gather basis changes */
 	tree->basis_change= MEM_mallocN(sizeof(float[3][3])*tree->totchannel, "ik basis change");
-	if(hasstretch)
+	if (hasstretch)
 		ikstretch= MEM_mallocN(sizeof(float)*tree->totchannel, "ik stretch");
 	
-	for(a=0; a<tree->totchannel; a++) {
+	for (a=0; a<tree->totchannel; a++) {
 		IK_GetBasisChange(iktree[a], tree->basis_change[a]);
 		
-		if(hasstretch) {
+		if (hasstretch) {
 			/* have to compensate for scaling received from parent */
 			float parentstretch, stretch;
 			
 			pchan= tree->pchan[a];
 			parentstretch= (tree->parent[a] >= 0)? ikstretch[tree->parent[a]]: 1.0f;
 			
-			if(tree->stretch && (pchan->ikstretch > 0.0f)) {
+			if (tree->stretch && (pchan->ikstretch > 0.0f)) {
 				float trans[3], length;
 				
 				IK_GetTranslationChange(iktree[a], trans);
@@ -482,7 +486,7 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
 			mul_v3_fl(tree->basis_change[a][2], stretch);
 		}
 
-		if(resultblend && resultinf!=1.0f) {
+		if (resultblend && resultinf!=1.0f) {
 			unit_m3(identity);
 			blend_m3_m3m3(tree->basis_change[a], identity,
 				tree->basis_change[a], resultinf);
@@ -492,15 +496,15 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
 	}
 	
 	MEM_freeN(iktree);
-	if(ikstretch) MEM_freeN(ikstretch);
+	if (ikstretch) MEM_freeN(ikstretch);
 }
 
 static void free_posetree(PoseTree *tree)
 {
 	BLI_freelistN(&tree->targets);
-	if(tree->pchan) MEM_freeN(tree->pchan);
-	if(tree->parent) MEM_freeN(tree->parent);
-	if(tree->basis_change) MEM_freeN(tree->basis_change);
+	if (tree->pchan) MEM_freeN(tree->pchan);
+	if (tree->parent) MEM_freeN(tree->parent);
+	if (tree->basis_change) MEM_freeN(tree->basis_change);
 	MEM_freeN(tree);
 }
 
@@ -511,8 +515,8 @@ void iksolver_initialize_tree(struct Scene *UNUSED(scene), struct Object *ob, fl
 {
 	bPoseChannel *pchan;
 	
-	for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
-		if(pchan->constflag & PCHAN_HAS_IK) // flag is set on editing constraints
+	for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+		if (pchan->constflag & PCHAN_HAS_IK) // flag is set on editing constraints
 			initialize_posetree(ob, pchan);	// will attach it to root!
 	}
 	ob->pose->flag &= ~POSE_WAS_REBUILT;
@@ -520,7 +524,7 @@ void iksolver_initialize_tree(struct Scene *UNUSED(scene), struct Object *ob, fl
 
 void iksolver_execute_tree(struct Scene *scene, struct Object *ob,  struct bPoseChannel *pchan, float ctime)
 {
-	while(pchan->iktree.first) {
+	while (pchan->iktree.first) {
 		PoseTree *tree= pchan->iktree.first;
 		int a;
 		
@@ -529,8 +533,8 @@ void iksolver_execute_tree(struct Scene *scene, struct Object *ob,  struct bPose
 			return;
 		
 		/* 4. walk over the tree for regular solving */
-		for(a=0; a<tree->totchannel; a++) {
-			if(!(tree->pchan[a]->flag & POSE_DONE))	// successive trees can set the flag
+		for (a=0; a<tree->totchannel; a++) {
+			if (!(tree->pchan[a]->flag & POSE_DONE))	// successive trees can set the flag
 				where_is_pose_bone(scene, ob, tree->pchan[a], ctime, 1);
 			// tell blender that this channel was controlled by IK, it's cleared on each where_is_pose()
 			tree->pchan[a]->flag |= POSE_CHAIN;
@@ -539,12 +543,12 @@ void iksolver_execute_tree(struct Scene *scene, struct Object *ob,  struct bPose
 		execute_posetree(scene, ob, tree);
 		
 		/* 6. apply the differences to the channels, 
-			  we need to calculate the original differences first */
-		for(a=0; a<tree->totchannel; a++) {
+		 *    we need to calculate the original differences first */
+		for (a=0; a<tree->totchannel; a++) {
 			make_dmats(tree->pchan[a]);
 		}
 		
-		for(a=0; a<tree->totchannel; a++) {
+		for (a=0; a<tree->totchannel; a++) {
 			/* sets POSE_DONE */
 			where_is_ik_bone(tree->pchan[a], tree->basis_change[a]);
 		}
diff --git a/source/blender/ikplugin/intern/iksolver_plugin.h b/source/blender/ikplugin/intern/iksolver_plugin.h
index 885383a..dd00c5f 100644
--- a/source/blender/ikplugin/intern/iksolver_plugin.h
+++ b/source/blender/ikplugin/intern/iksolver_plugin.h
@@ -31,8 +31,8 @@
  */
 
 
-#ifndef IKSOLVER_PLUGIN_H
-#define IKSOLVER_PLUGIN_H
+#ifndef __IKSOLVER_PLUGIN_H__
+#define __IKSOLVER_PLUGIN_H__
 
 #include "ikplugin_api.h"
 
@@ -47,5 +47,5 @@ void iksolver_execute_tree(struct Scene *scene, struct Object *ob,  struct bPose
 }
 #endif
 
-#endif // IKSOLVER_PLUGIN_H
+#endif // __IKSOLVER_PLUGIN_H__
 
diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp
index f605441..ccfe2ea 100644
--- a/source/blender/ikplugin/intern/itasc_plugin.cpp
+++ b/source/blender/ikplugin/intern/itasc_plugin.cpp
@@ -90,8 +90,6 @@ typedef float Vector3[3];
 typedef float Vector4[4];
 struct IK_Target;
 typedef void (*ErrorCallback)(const iTaSC::ConstraintValues* values, unsigned int nvalues, IK_Target* iktarget);
-// For some reason, gcc doesn't find the declaration of this function in linux
-void KDL::SetToZero(JntArray& array);
 
 // one structure for each target in the scene
 struct IK_Target
@@ -200,7 +198,7 @@ struct IK_Scene
 		// delete scene first
 		if (scene)
 			delete scene;
-		for(std::vector<IK_Target*>::iterator it = targets.begin();	it != targets.end(); ++it)
+		for (std::vector<IK_Target*>::iterator it = targets.begin();	it != targets.end(); ++it)
 			delete (*it);
 		targets.clear();
 		if (channels)
@@ -247,21 +245,21 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co
 	data=(bKinematicConstraint*)con->data;
 	
 	/* exclude tip from chain? */
-	if(!(data->flag & CONSTRAINT_IK_TIP))
+	if (!(data->flag & CONSTRAINT_IK_TIP))
 		pchan_tip= pchan_tip->parent;
 	
 	rootbone = data->rootbone;
 	/* Find the chain's root & count the segments needed */
-	for (curchan = pchan_tip; curchan; curchan=curchan->parent){
+	for (curchan = pchan_tip; curchan; curchan=curchan->parent) {
 		pchan_root = curchan;
 		
 		if (++segcount > 255)		// 255 is weak
 			break;
 
-		if(segcount==rootbone){
+		if (segcount==rootbone) {
 			// reached this end of the chain but if the chain is overlapping with a 
 			// previous one, we must go back up to the root of the other chain
-			if ((curchan->flag & POSE_CHAIN) && curchan->iktree.first == NULL){
+			if ((curchan->flag & POSE_CHAIN) && curchan->iktree.first == NULL) {
 				rootbone++;
 				continue;
 			}
@@ -270,7 +268,7 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co
 
 		if (curchan->iktree.first != NULL)
 			// Oh oh, there is already a chain starting from this channel and our chain is longer... 
-			// Should handle this by moving the previous chain up to the begining of our chain
+			// Should handle this by moving the previous chain up to the beginning of our chain
 			// For now we just stop here
 			break;
 	}
@@ -291,7 +289,7 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co
 	// by contruction there can be only one tree per channel and each channel can be part of at most one tree.
 	tree = (PoseTree*)pchan_root->iktree.first;
 
-	if(tree==NULL) {
+	if (tree==NULL) {
 		/* make new tree */
 		tree= (PoseTree*)MEM_callocN(sizeof(PoseTree), "posetree");
 
@@ -301,7 +299,7 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co
 		
 		tree->pchan= (bPoseChannel**)MEM_callocN(segcount*sizeof(void*), "ik tree pchan");
 		tree->parent= (int*)MEM_callocN(segcount*sizeof(int), "ik tree parent");
-		for(a=0; a<segcount; a++) {
+		for (a=0; a<segcount; a++) {
 			tree->pchan[a]= chanlist[segcount-a-1];
 			tree->parent[a]= a-1;
 		}
@@ -324,19 +322,19 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co
 			for (;t<tree->totchannel && tree->pchan[t]!=chanlist[segcount-a-1];t++);
 			if (t>=tree->totchannel)
 				break;
-			for(; a<size && t<tree->totchannel && tree->pchan[t]==chanlist[segcount-a-1]; a++, t++);
+			for (; a<size && t<tree->totchannel && tree->pchan[t]==chanlist[segcount-a-1]; a++, t++);
 		}
 
 		segcount= segcount-a;
 		target->tip= tree->totchannel + segcount - 1;
 
 		if (segcount > 0) {
-			for(parent = a - 1; parent < tree->totchannel; parent++)
-				if(tree->pchan[parent] == chanlist[segcount-1]->parent)
+			for (parent = a - 1; parent < tree->totchannel; parent++)
+				if (tree->pchan[parent] == chanlist[segcount-1]->parent)
 					break;
 			
 			/* shouldn't happen, but could with dependency cycles */
-			if(parent == tree->totchannel)
+			if (parent == tree->totchannel)
 				parent = a - 1;
 
 			/* resize array */
@@ -352,7 +350,7 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co
 			MEM_freeN(oldparent);
 
 			/* add new pose channels at the end, in reverse order */
-			for(a=0; a<segcount; a++) {
+			for (a=0; a<segcount; a++) {
 				tree->pchan[tree->totchannel+a]= chanlist[segcount-a-1];
 				tree->parent[tree->totchannel+a]= tree->totchannel+a-1;
 			}
@@ -403,8 +401,8 @@ int initialize_scene(Object *ob, bPoseChannel *pchan_tip)
 
 	/* find all IK constraints and validate them */
 	treecount = 0;
-	for(con= (bConstraint *)pchan_tip->constraints.first; con; con= (bConstraint *)con->next) {
-		if(con->type==CONSTRAINT_TYPE_KINEMATIC) {
+	for (con= (bConstraint *)pchan_tip->constraints.first; con; con= (bConstraint *)con->next) {
+		if (con->type==CONSTRAINT_TYPE_KINEMATIC) {
 			if (constraint_valid(con))
 				treecount += initialize_chain(ob, pchan_tip, con);
 		}
@@ -430,13 +428,14 @@ static double EulerAngleFromMatrix(const KDL::Rotation& R, int axis)
 
 	if (t > 16.0*KDL::epsilon) {
 		if (axis == 0) return -KDL::atan2(R(1,2), R(2,2));
-        else if(axis == 1) return KDL::atan2(-R(0,2), t);
-        else return -KDL::atan2(R(0,1), R(0,0));
-    } else {
+		else if (axis == 1) return KDL::atan2(-R(0,2), t);
+		else return -KDL::atan2(R(0,1), R(0,0));
+	}
+	else {
 		if (axis == 0) return -KDL::atan2(-R(2,1), R(1,1));
-        else if(axis == 1) return KDL::atan2(-R(0,2), t);
-        else return 0.0f;
-    }
+		else if (axis == 1) return KDL::atan2(-R(0,2), t);
+		else return 0.0f;
+	}
 }
 
 static double ComputeTwist(const KDL::Rotation& R)
@@ -475,27 +474,29 @@ static void RemoveEulerAngleFromMatrix(KDL::Rotation& R, double angle, int axis)
 static void GetEulerXZY(const KDL::Rotation& R, double& X,double& Z,double& Y)
 {
 	if (fabs(R(0,1)) > 1.0 - KDL::epsilon ) {
-        X = -KDL::sign(R(0,1)) * KDL::atan2(R(1,2), R(1,0));
-        Z = -KDL::sign(R(0,1)) * KDL::PI / 2;
-        Y = 0.0 ;
-    } else {
-        X = KDL::atan2(R(2,1), R(1,1));
-        Z = KDL::atan2(-R(0,1), KDL::sqrt( KDL::sqr(R(0,0)) + KDL::sqr(R(0,2))));
-        Y = KDL::atan2(R(0,2), R(0,0));
-    }
+		X = -KDL::sign(R(0,1)) * KDL::atan2(R(1,2), R(1,0));
+		Z = -KDL::sign(R(0,1)) * KDL::PI / 2;
+		Y = 0.0;
+	}
+	else {
+		X = KDL::atan2(R(2,1), R(1,1));
+		Z = KDL::atan2(-R(0,1), KDL::sqrt( KDL::sqr(R(0,0)) + KDL::sqr(R(0,2))));
+		Y = KDL::atan2(R(0,2), R(0,0));
+	}
 }
 
 static void GetEulerXYZ(const KDL::Rotation& R, double& X,double& Y,double& Z)
 {
 	if (fabs(R(0,2)) > 1.0 - KDL::epsilon ) {
-        X = KDL::sign(R(0,2)) * KDL::atan2(-R(1,0), R(1,1));
-        Y = KDL::sign(R(0,2)) * KDL::PI / 2;
-        Z = 0.0 ;
-    } else {
-        X = KDL::atan2(-R(1,2), R(2,2));
-        Y = KDL::atan2(R(0,2), KDL::sqrt( KDL::sqr(R(0,0)) + KDL::sqr(R(0,1))));
-        Z = KDL::atan2(-R(0,1), R(0,0));
-    }
+		X = KDL::sign(R(0,2)) * KDL::atan2(-R(1,0), R(1,1));
+		Y = KDL::sign(R(0,2)) * KDL::PI / 2;
+		Z = 0.0;
+	}
+	else {
+		X = KDL::atan2(-R(1,2), R(2,2));
+		Y = KDL::atan2(R(0,2), KDL::sqrt( KDL::sqr(R(0,0)) + KDL::sqr(R(0,1))));
+		Z = KDL::atan2(-R(0,1), R(0,0));
+	}
 }
 #endif
 
@@ -693,7 +694,8 @@ static bool copypose_callback(const iTaSC::Timestamp& timestamp, iTaSC::Constrai
 			values->action = iTaSC::ACT_ALPHA;
 			values++;
 		}
-	} else {
+	}
+	else {
 		if (iktarget->controlType & iTaSC::CopyPose::CTL_POSITION) {
 			// update error
 			values->alpha = condata->weight;
@@ -747,7 +749,8 @@ static bool distance_callback(const iTaSC::Timestamp& timestamp, iTaSC::Constrai
 	// update weight according to mode
 	if (iktarget->blenderConstraint->flag & CONSTRAINT_OFF) {
 		values->alpha = 0.0;
-	} else {
+	}
+	else {
 		switch (condata->mode) {
 		case LIMITDIST_INSIDE:
 			values->alpha = (values->values[0].y > condata->dist) ? condata->weight : 0.0;
@@ -870,7 +873,7 @@ static int convert_channels(IK_Scene *ikscene, PoseTree *tree)
 	int a, flag, njoint;
 
 	njoint = 0;
-	for(a=0, ikchan = ikscene->channels; a<ikscene->numchan; ++a, ++ikchan) {
+	for (a=0, ikchan = ikscene->channels; a<ikscene->numchan; ++a, ++ikchan) {
 		pchan= tree->pchan[a];
 		ikchan->pchan = pchan;
 		ikchan->parent = (a>0) ? tree->parent[a] : -1;
@@ -878,47 +881,46 @@ static int convert_channels(IK_Scene *ikscene, PoseTree *tree)
 		
 		/* set DoF flag */
 		flag = 0;
-		if(!(pchan->ikflag & BONE_IK_NO_XDOF) && !(pchan->ikflag & BONE_IK_NO_XDOF_TEMP) && 
+		if (!(pchan->ikflag & BONE_IK_NO_XDOF) && !(pchan->ikflag & BONE_IK_NO_XDOF_TEMP) && 
 			(!(pchan->ikflag & BONE_IK_XLIMIT) || pchan->limitmin[0]<0.f || pchan->limitmax[0]>0.f))
 			flag |= IK_XDOF;
-		if(!(pchan->ikflag & BONE_IK_NO_YDOF) && !(pchan->ikflag & BONE_IK_NO_YDOF_TEMP) &&
+		if (!(pchan->ikflag & BONE_IK_NO_YDOF) && !(pchan->ikflag & BONE_IK_NO_YDOF_TEMP) &&
 			(!(pchan->ikflag & BONE_IK_YLIMIT) || pchan->limitmin[1]<0.f || pchan->limitmax[1]>0.f))
 			flag |= IK_YDOF;
-		if(!(pchan->ikflag & BONE_IK_NO_ZDOF) && !(pchan->ikflag & BONE_IK_NO_ZDOF_TEMP) &&
+		if (!(pchan->ikflag & BONE_IK_NO_ZDOF) && !(pchan->ikflag & BONE_IK_NO_ZDOF_TEMP) &&
 			(!(pchan->ikflag & BONE_IK_ZLIMIT) || pchan->limitmin[2]<0.f || pchan->limitmax[2]>0.f))
 			flag |= IK_ZDOF;
 		
-		if(tree->stretch && (pchan->ikstretch > 0.0)) {
+		if (tree->stretch && (pchan->ikstretch > 0.0)) {
 			flag |= IK_TRANSY;
 		}
 		/*
-		Logic to create the segments:
-		RX,RY,RZ = rotational joints with no length
-		RY(tip) = rotational joints with a fixed length arm = (0,length,0)
-		TY = translational joint on Y axis
-		F(pos) = fixed joint with an arm at position pos 
-		Conversion rule of the above flags:
-		-   ==> F(tip)
-		X   ==> RX(tip)
-		Y   ==> RY(tip)
-		Z   ==> RZ(tip)
-		XY  ==> RX+RY(tip)
-		XZ  ==> RX+RZ(tip)
-		YZ  ==> RZ+RY(tip)
-		XYZ ==> full spherical unless there are limits, in which case RX+RZ+RY(tip)
-		In case of stretch, tip=(0,0,0) and there is an additional TY joint
-		The frame at last of these joints represents the tail of the bone. 
-		The head is computed by a reverse translation on Y axis of the bone length
-		or in case of TY joint, by the frame at previous joint.
-		In case of separation of bones, there is an additional F(head) joint
-
-		Computing rest pose and length is complicated: the solver works in world space
-		Here is the logic:
-		rest position is computed only from bone->bone_mat.
-		bone length is computed from bone->length multiplied by the scaling factor of
-		the armature. Non-uniform scaling will give bad result!
-
-		*/
+		 * Logic to create the segments:
+		 * RX,RY,RZ = rotational joints with no length
+		 * RY(tip) = rotational joints with a fixed length arm = (0,length,0)
+		 * TY = translational joint on Y axis
+		 * F(pos) = fixed joint with an arm at position pos
+		 * Conversion rule of the above flags:
+		 * -   ==> F(tip)
+		 * X   ==> RX(tip)
+		 * Y   ==> RY(tip)
+		 * Z   ==> RZ(tip)
+		 * XY  ==> RX+RY(tip)
+		 * XZ  ==> RX+RZ(tip)
+		 * YZ  ==> RZ+RY(tip)
+		 * XYZ ==> full spherical unless there are limits, in which case RX+RZ+RY(tip)
+		 * In case of stretch, tip=(0,0,0) and there is an additional TY joint
+		 * The frame at last of these joints represents the tail of the bone.
+		 * The head is computed by a reverse translation on Y axis of the bone length
+		 * or in case of TY joint, by the frame at previous joint.
+		 * In case of separation of bones, there is an additional F(head) joint
+		 *
+		 * Computing rest pose and length is complicated: the solver works in world space
+		 * Here is the logic:
+		 * rest position is computed only from bone->bone_mat.
+		 * bone length is computed from bone->length multiplied by the scaling factor of
+		 * the armature. Non-uniform scaling will give bad result!
+		 */
 		switch (flag & (IK_XDOF|IK_YDOF|IK_ZDOF))
 		{
 		default:
@@ -992,14 +994,15 @@ static void convert_pose(IK_Scene *ikscene)
 	// assume uniform scaling and take Y scale as general scale for the armature
 	scale = len_v3(ikscene->blArmature->obmat[1]);
 	rot = &ikscene->jointArray(0);
-	for(joint=a=0, ikchan = ikscene->channels; a<ikscene->numchan && joint<ikscene->numjoint; ++a, ++ikchan) {
+	for (joint=a=0, ikchan = ikscene->channels; a<ikscene->numchan && joint<ikscene->numjoint; ++a, ++ikchan) {
 		pchan= ikchan->pchan;
 		bone= pchan->bone;
 		
 		if (pchan->parent) {
 			unit_m4(bmat);
 			mul_m4_m4m3(bmat, pchan->parent->pose_mat, bone->bone_mat);
-		} else {
+		}
+		else {
 			copy_m4_m4(bmat, bone->arm_mat);
 		}
 		invert_m4_m4(rmat, bmat);
@@ -1029,10 +1032,10 @@ static void rest_pose(IK_Scene *ikscene)
 	// assume uniform scaling and take Y scale as general scale for the armature
 	scale = len_v3(ikscene->blArmature->obmat[1]);
 	// rest pose is 0 
-	KDL::SetToZero(ikscene->jointArray);
+	SetToZero(ikscene->jointArray);
 	// except for transY joints
 	rot = &ikscene->jointArray(0);
-	for(joint=a=0, ikchan = ikscene->channels; a<ikscene->numchan && joint<ikscene->numjoint; ++a, ++ikchan) {
+	for (joint=a=0, ikchan = ikscene->channels; a<ikscene->numchan && joint<ikscene->numjoint; ++a, ++ikchan) {
 		pchan= ikchan->pchan;
 		bone= pchan->bone;
 
@@ -1079,7 +1082,8 @@ static IK_Scene* convert_tree(Scene *blscene, Object *ob, bPoseChannel *pchan)
 	if (!ikparam) {
 		// you must have our own copy
 		ikparam = &DefIKParam;
-	} else if (ingame) {
+	}
+	else if (ingame) {
 		// tweak the param when in game to have efficient stepping
 		// using fixed substep is not effecient since frames in the GE are often
 		// shorter than in animation => move to auto step automatically and set
@@ -1123,12 +1127,13 @@ static IK_Scene* convert_tree(Scene *blscene, Object *ob, bPoseChannel *pchan)
 		// in the GE, set the initial joint angle to match the current pose
 		// this will update the jointArray in ikscene
 		convert_pose(ikscene);
-	} else {
+	}
+	else {
 		// in Blender, the rest pose is always 0 for joints
 		rest_pose(ikscene);
 	}
 	rot = &ikscene->jointArray(0);
-	for(a=0, ikchan = ikscene->channels; a<tree->totchannel; ++a, ++ikchan) {
+	for (a=0, ikchan = ikscene->channels; a<tree->totchannel; ++a, ++ikchan) {
 		pchan= ikchan->pchan;
 		bone= pchan->bone;
 
@@ -1396,7 +1401,8 @@ static IK_Scene* convert_tree(Scene *blscene, Object *ob, bPoseChannel *pchan)
 		// move to the tail and scale to get rest pose of armature base
 		copy_v3_v3(baseFrame[3], pchan->bone->arm_tail);
 		invert_m4_m4(invBaseFrame, baseFrame);
-	} else {
+	}
+	else {
 		unit_m4(invBaseFrame);
 	}
 	// finally add the constraint
@@ -1494,7 +1500,7 @@ static void create_scene(Scene *scene, Object *ob)
 	bPoseChannel *pchan;
 
 	// create the IK scene
-	for(pchan= (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) {
+	for (pchan= (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) {
 		// by construction there is only one tree
 		PoseTree *tree = (PoseTree*)pchan->iktree.first;
 		if (tree) {
@@ -1509,9 +1515,9 @@ static void create_scene(Scene *scene, Object *ob)
 			while(tree) {
 				BLI_remlink(&pchan->iktree, tree);
 				BLI_freelistN(&tree->targets);
-				if(tree->pchan) MEM_freeN(tree->pchan);
-				if(tree->parent) MEM_freeN(tree->parent);
-				if(tree->basis_change) MEM_freeN(tree->basis_change);
+				if (tree->pchan) MEM_freeN(tree->pchan);
+				if (tree->parent) MEM_freeN(tree->parent);
+				if (tree->basis_change) MEM_freeN(tree->basis_change);
 				MEM_freeN(tree);
 				tree = (PoseTree*)pchan->iktree.first;
 			}
@@ -1522,7 +1528,7 @@ static void create_scene(Scene *scene, Object *ob)
 static void init_scene(Object *ob)
 {
 	if (ob->pose->ikdata) {
-		for(IK_Scene* scene = ((IK_Data*)ob->pose->ikdata)->first;
+		for (IK_Scene* scene = ((IK_Data*)ob->pose->ikdata)->first;
 			scene != NULL;
 			scene = scene->next) {
 			scene->channels[0].pchan->flag |= POSE_IKTREE;
@@ -1541,9 +1547,10 @@ static void execute_scene(Scene* blscene, IK_Scene* ikscene, bItasc* ikparam, fl
 			ikchan->pchan->flag |= (POSE_DONE|POSE_CHAIN);
 			ikchan->jointValid = 0;
 		}
-	} else {
+	}
+	else {
 		// in animation mode, we must get the bone position from action and constraints
-		for(i=0, ikchan=ikscene->channels; i<ikscene->numchan; i++, ++ikchan) {
+		for (i=0, ikchan=ikscene->channels; i<ikscene->numchan; i++, ++ikchan) {
 			if (!(ikchan->pchan->flag & POSE_DONE))
 				where_is_pose_bone(blscene, ikscene->blArmature, ikchan->pchan, ctime, 1);
 			// tell blender that this channel was controlled by IK, it's cleared on each where_is_pose()
@@ -1592,7 +1599,8 @@ static void execute_scene(Scene* blscene, IK_Scene* ikscene, bItasc* ikparam, fl
 			// the cache is empty before this time, reiterate
 			if (ikparam->flag & ITASC_INITIAL_REITERATION)
 				reiterate = true;
-		} else {
+		}
+		else {
 			// can take the cache as a start point.
 			sts -= cts;
 			timestep = sts/1000.0;
@@ -1703,8 +1711,8 @@ void itasc_initialize_tree(struct Scene *scene, Object *ob, float ctime)
 	itasc_clear_data(ob->pose);
 	// we should handle all the constraint and mark them all disabled
 	// for blender but we'll start with the IK constraint alone
-	for(pchan= (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) {
-		if(pchan->constflag & PCHAN_HAS_IK)
+	for (pchan= (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) {
+		if (pchan->constflag & PCHAN_HAS_IK)
 			count += initialize_scene(ob, pchan);
 	}
 	// if at least one tree, create the scenes from the PoseTree stored in the channels 
@@ -1783,7 +1791,8 @@ void itasc_update_param(struct bPose *pose)
 				ikscene->scene->setParam(iTaSC::Scene::MAX_TIMESTEP, ikparam->maxstep);
 				ikscene->solver->setParam(iTaSC::Solver::DLS_QMAX, ikparam->maxvel);
 				ikscene->armature->setControlParameter(CONSTRAINT_ID_ALL, iTaSC::Armature::ID_JOINT, iTaSC::ACT_FEEDBACK, ikparam->feedback);
-			} else {
+			}
+			else {
 				// in animation mode timestep is 1s by convention => 
 				// qmax becomes radiant and feedback becomes fraction of error gap corrected in one iteration
 				ikscene->scene->setParam(iTaSC::Scene::MIN_TIMESTEP, 1.0);
diff --git a/source/blender/ikplugin/intern/itasc_plugin.h b/source/blender/ikplugin/intern/itasc_plugin.h
index 1d6acb2..0d5fde0 100644
--- a/source/blender/ikplugin/intern/itasc_plugin.h
+++ b/source/blender/ikplugin/intern/itasc_plugin.h
@@ -31,8 +31,8 @@
  */
 
 
-#ifndef ITASC_PLUGIN_H
-#define ITASC_PLUGIN_H
+#ifndef __ITASC_PLUGIN_H__
+#define __ITASC_PLUGIN_H__
 
 #include "ikplugin_api.h"
 
@@ -52,5 +52,5 @@ void itasc_test_constraint(struct Object *ob, struct bConstraint *cons);
 }
 #endif
 
-#endif // ITASC_PLUGIN_H
+#endif // __ITASC_PLUGIN_H__
 
diff --git a/source/blender/imbuf/CMakeLists.txt b/source/blender/imbuf/CMakeLists.txt
index 4c8a79e..aa44545 100644
--- a/source/blender/imbuf/CMakeLists.txt
+++ b/source/blender/imbuf/CMakeLists.txt
@@ -104,6 +104,10 @@ set(SRC
 
 if(WITH_IMAGE_OPENEXR)
 	add_definitions(-DWITH_OPENEXR)
+else()
+	list(APPEND SRC
+		intern/openexr/openexr_stub.cpp
+	)
 endif()
 
 if(WITH_IMAGE_TIFF)
@@ -176,4 +180,10 @@ if(WITH_IMAGE_HDR)
 	add_definitions(-DWITH_HDR)
 endif()
 
+if(WIN32)
+	list(APPEND INC
+		../../../intern/utfconv
+	)
+endif()
+
 blender_add_lib(bf_imbuf "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h
index 07f1b9e..a0c737b 100644
--- a/source/blender/imbuf/IMB_imbuf.h
+++ b/source/blender/imbuf/IMB_imbuf.h
@@ -30,33 +30,32 @@
  */
 
 /**
- * @file IMB_imbuf.h
- * @brief IMage Buffer module.
+ * \brief IMage Buffer module.
  *
  * This module offers import/export of several graphical file formats.
- * @ingroup imbuf
+ * \ingroup imbuf
  *
- * @page IMB Imbuf module external interface
+ * \page IMB Imbuf module external interface
  *
  *
- * @section about About the IMB module
+ * \section about About the IMB module
  *
  * External interface of the IMage Buffer module. This module offers
  * import/export of several graphical file formats. It offers the
  * ImBuf type as a common structure to refer to different graphical
  * file formats, and to enable a uniform way of handling them.
  *
- * @section issues Known issues with IMB
+ * \section issues Known issues with IMB
  *
  * - imbuf is written in C.
  * - Endianness issues are dealt with internally.
  * - File I/O must be done externally. The module uses FILE*'s to
  *   direct input/output.
  * - Platform dependency is limited. Some minor patches for
- *   amiga and Irix are present. A 'posix-compliancy-patch'
+ *   amiga and Irix are present. A 'posix-compliance-patch'
  *   provides the interface to windows.
  *
- * @section dependencies Dependencies
+ * \section dependencies Dependencies
  *
  * IMB needs:
  * - \ref DNA module
@@ -64,60 +63,60 @@
  *     management.
  * - \ref blenlib module
  *     blenlib handles guarded memory management in blender-style.
- *     BLI_winstuff.h makes a few windows specific behaviours
+ *     BLI_winstuff.h makes a few windows specific behaviors
  *     posix-compliant.
  */
 
-#ifndef IMB_IMBUF_H
-#define IMB_IMBUF_H
+#ifndef __IMB_IMBUF_H__
+#define __IMB_IMBUF_H__
 
 /**
  *
- * @attention defined in ???
+ * \attention defined in ???
  */
 struct ImBuf;
 
 /**
  *
- * @attention defined in ???
+ * \attention defined in ???
  */
 struct anim;
 
 /**
  *
- * @attention Defined in allocimbuf.c
+ * \attention Defined in allocimbuf.c
  */
 void IMB_init(void);
 void IMB_exit(void);
 
 /**
  *
- * @attention Defined in readimage.c
+ * \attention Defined in readimage.c
  */
 struct ImBuf *IMB_ibImageFromMemory(unsigned char *mem, size_t size,
                                     int flags, const char *descr);
 
 /**
  *
- * @attention Defined in readimage.c
+ * \attention Defined in readimage.c
  */
 struct ImBuf *IMB_testiffname(const char *filepath, int flags);
 
 /**
  *
- * @attention Defined in readimage.c
+ * \attention Defined in readimage.c
  */
 struct ImBuf *IMB_loadiffname(const char *filepath, int flags);
 
 /**
  *
- * @attention Defined in allocimbuf.c
+ * \attention Defined in allocimbuf.c
  */
 void IMB_freeImBuf(struct ImBuf *ibuf);
 
 /**
  *
- * @attention Defined in allocimbuf.c
+ * \attention Defined in allocimbuf.c
  */
 struct ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y,
                              unsigned char d, unsigned int flags);
@@ -128,7 +127,7 @@ struct ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y,
  * (to delete an imbuf you have to call freeImBuf as many times as it
  * is referenced)
  *
- * @attention Defined in allocimbuf.c
+ * \attention Defined in allocimbuf.c
  */
 
 void IMB_refImBuf(struct ImBuf *ibuf);
@@ -136,20 +135,20 @@ struct ImBuf * IMB_makeSingleUser(struct ImBuf *ibuf);
 
 /**
  *
- * @attention Defined in allocimbuf.c
+ * \attention Defined in allocimbuf.c
  */
 struct ImBuf *IMB_dupImBuf(struct ImBuf *ibuf1);
 
 /**
  *
- * @attention Defined in allocimbuf.c
+ * \attention Defined in allocimbuf.c
  */
 short addzbufImBuf(struct ImBuf *ibuf);
 short addzbuffloatImBuf(struct ImBuf *ibuf);
 
 /**
  *
- * @attention Defined in rectop.c
+ * \attention Defined in rectop.c
  */
 
 typedef enum IMB_BlendMode {
@@ -181,25 +180,24 @@ void IMB_rectblend(struct ImBuf *dbuf, struct ImBuf *sbuf, int destx,
 
 /**
  *
- * @attention Defined in indexer.c
+ * \attention Defined in indexer.c
  */
 
 typedef enum IMB_Timecode_Type {
 	IMB_TC_NONE       = 0, /* don't use timecode files at all */
-	IMB_TC_RECORD_RUN = 1, /* use images in the order as they are recorded 
-				  (currently, this is the only one implemented
-				  and is a sane default)
-			       */
+
+	IMB_TC_RECORD_RUN = 1, /* use images in the order as they are recorded
+	                        * (currently, this is the only one implemented
+	                        * and is a sane default) */
+
 	IMB_TC_FREE_RUN   = 2, /* use global timestamp written by recording
-				  device (prosumer camcorders e.g. can do
-				  that) */
-	IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN = 4, 
-                               /* interpolate a global timestamp using the
-				  record date and time written by recording
-				  device (*every* consumer camcorder can do
-				  that :) )*/
+                            * device (prosumer camcorders e.g. can do that) */
+	IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN = 4, /* interpolate a global timestamp using the
+	                                            * record date and time written by recording
+	                                            * device (*every* consumer camcorder can do
+	                                            * that :) )*/
 	IMB_TC_RECORD_RUN_NO_GAPS = 8,
-	IMB_TC_MAX_SLOT   = 8
+	IMB_TC_MAX_SLOT   = 4
 } IMB_Timecode_Type;
 
 typedef enum IMB_Proxy_Size {
@@ -217,15 +215,21 @@ void IMB_anim_set_index_dir(struct anim * anim, const char * dir);
 int IMB_anim_index_get_frame_index(struct anim * anim, IMB_Timecode_Type tc,
                                    int position);
 
+struct IndexBuildContext;
+
+/* prepare context for proxies/imecodes builder */
+struct IndexBuildContext *IMB_anim_index_rebuild_context(struct anim *anim, IMB_Timecode_Type tcs_in_use,
+                                                         IMB_Proxy_Size proxy_sizes_in_use, int quality);
+
 /* will rebuild all used indices and proxies at once */
-void IMB_anim_index_rebuild(struct anim * anim, 
-                            IMB_Timecode_Type build_tcs,
-                            IMB_Proxy_Size build_preview_sizes,
-                            int build_quality,
+void IMB_anim_index_rebuild(struct IndexBuildContext *context,
                             short *stop, short *do_update, float *progress);
 
+/* finish rebuilding proxises/timecodes and free temporary contexts used */
+void IMB_anim_index_rebuild_finish(struct IndexBuildContext *context, short stop);
+
 /**
- * Return the length (in frames) of the given @a anim.
+ * Return the length (in frames) of the given \a anim.
  */
 int IMB_anim_get_duration(struct anim *anim, IMB_Timecode_Type tc);
 
@@ -239,15 +243,16 @@ int IMB_anim_get_fps(struct anim * anim,
 
 /**
  *
- * @attention Defined in anim_movie.c
+ * \attention Defined in anim_movie.c
  */
 struct anim *IMB_open_anim(const char *name, int ib_flags, int streamindex);
 void IMB_close_anim(struct anim *anim);
+void IMB_close_anim_proxies(struct anim *anim);
 
 
 /**
  *
- * @attention Defined in anim_movie.c
+ * \attention Defined in anim_movie.c
  */
 
 int ismovie(const char *filepath);
@@ -256,7 +261,7 @@ int IMB_anim_get_preseek(struct anim *anim);
 
 /**
  *
- * @attention Defined in anim_movie.c
+ * \attention Defined in anim_movie.c
  */
 
 struct ImBuf *IMB_anim_absolute(
@@ -266,20 +271,20 @@ struct ImBuf *IMB_anim_absolute(
 
 /**
  *
- * @attention Defined in anim_movie.c
+ * \attention Defined in anim_movie.c
  * fetches a define previewframe, usually half way into the movie
  */
 struct ImBuf *IMB_anim_previewframe(struct anim *anim);
 
 /**
  *
- * @attention Defined in anim_movie.c
+ * \attention Defined in anim_movie.c
  */
 void IMB_free_anim(struct anim *anim);
 
 /**
  *
- * @attention Defined in filter.c
+ * \attention Defined in filter.c
  */
 
 #define FILTER_MASK_NULL		0
@@ -297,7 +302,7 @@ struct ImBuf *IMB_getmipmap(struct ImBuf *ibuf, int level);
 
 /**
  *
- * @attention Defined in cache.c
+ * \attention Defined in cache.c
  */
 
 void IMB_tile_cache_params(int totthread, int maxmem);
@@ -306,70 +311,63 @@ void IMB_tiles_to_rect(struct ImBuf *ibuf);
 
 /**
  *
- * @attention Defined in filter.c
+ * \attention Defined in filter.c
  */
 void IMB_filtery(struct ImBuf *ibuf);
 
 /**
  *
- * @attention Defined in scaling.c
+ * \attention Defined in scaling.c
  */
 struct ImBuf *IMB_onehalf(struct ImBuf *ibuf1);
 
 /**
  *
- * @attention Defined in scaling.c
+ * \attention Defined in scaling.c
  */
 struct ImBuf *IMB_scaleImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int newy);
 
 /**
  *
- * @attention Defined in scaling.c
+ * \attention Defined in scaling.c
  */
 struct ImBuf *IMB_scalefastImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int newy);
 
 /**
  *
- * @attention Defined in writeimage.c
+ * \attention Defined in writeimage.c
  */
 short IMB_saveiff(struct ImBuf *ibuf, const char *filepath, int flags);
 
 /**
- * Encodes a png image from an ImBuf
  *
- * @attention Defined in png_encode.c
- */
-short IMB_png_encode(struct ImBuf *ibuf, int file, int flags);
-
-/**
- *
- * @attention Defined in util.c
+ * \attention Defined in util.c
  */
 int IMB_ispic(const char *name);
 
 /**
  *
- * @attention Defined in util.c
+ * \attention Defined in util.c
  */
 int IMB_isanim(const char *name);
 
 /**
  *
- * @attention Defined in util.c
+ * \attention Defined in util.c
  */
 int imb_get_anim_type(const char *name);
 
 /**
  *
- * @attention Defined in divers.c
+ * \attention Defined in divers.c
  */
 void IMB_de_interlace(struct ImBuf *ibuf);
 void IMB_interlace(struct ImBuf *ibuf);
 
 /* create char buffer, color corrected if necessary, for ImBufs that lack one */ 
 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 */ 
+/* 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_float_from_rect(struct ImBuf *ibuf);
 void IMB_float_from_rect_simple(struct ImBuf *ibuf); /* no profile conversion */
@@ -377,6 +375,7 @@ void IMB_float_from_rect_simple(struct ImBuf *ibuf); /* no profile conversion */
 void IMB_convert_profile(struct ImBuf *ibuf, int profile);
 float *IMB_float_profile_ensure(struct ImBuf *ibuf, int profile, int *alloc);
 void IMB_color_to_bw(struct ImBuf *ibuf);
+void IMB_saturation(struct ImBuf *ibuf, float sat);
 
 /* converting pixel buffers */
 void IMB_buffer_byte_from_float(unsigned char *rect_to, const float *rect_from,
@@ -397,21 +396,13 @@ void IMB_buffer_float_clamp(float *buf, int width, int height);
  * Change the ordering of the color bytes pointed to by rect from
  * rgba to abgr. size * 4 color bytes are reordered.
  *
- * @attention Defined in imageprocess.c
+ * \attention Defined in imageprocess.c
  */
 void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf);
 
 /**
- * Change the ordering of the color bytes pointed to by rect from
- * rgba to abgr. size * 4 color bytes are reordered.
- *
- * @attention Defined in imageprocess.c
- */
-void IMB_convert_bgra_to_rgba(int size, unsigned int *rect);
-
-/**
  *
- * @attention defined in imageprocess.c
+ * \attention defined in imageprocess.c
  */
 void bicubic_interpolation(struct ImBuf *in, struct ImBuf *out, float u, float v, int xout, int yout);
 void neareast_interpolation(struct ImBuf *in, struct ImBuf *out, float u, float v, int xout, int yout);
@@ -424,51 +415,51 @@ void bilinear_interpolation_color_wrap(struct ImBuf *in, unsigned char *col, flo
 
 /**
  *
- * @attention defined in readimage.c
- * @deprecated Only here for backwards compatibility of the
- * @deprecated plugin system.
+ * \attention defined in readimage.c
+ * \deprecated Only here for backwards compatibility of the
+ * \deprecated plugin system.
  */  
 struct ImBuf *IMB_loadifffile(int file, int flags, const char *descr);
 
 /**
  *
- * @attention defined in scaling.c
+ * \attention defined in scaling.c
  */
 struct ImBuf *IMB_half_x(struct ImBuf *ibuf1);
 
 /**
  *
- * @attention defined in scaling.c
+ * \attention defined in scaling.c
  */
 struct ImBuf *IMB_double_fast_x(struct ImBuf *ibuf1);
 
 /**
  *
- * @attention defined in scaling.c
+ * \attention defined in scaling.c
  */
 struct ImBuf *IMB_double_x(struct ImBuf *ibuf1);
 
 /**
  *
- * @attention defined in scaling.c
+ * \attention defined in scaling.c
  */
 struct ImBuf *IMB_half_y(struct ImBuf *ibuf1);
 
 /**
  *
- * @attention defined in scaling.c
+ * \attention defined in scaling.c
  */
 struct ImBuf *IMB_double_fast_y(struct ImBuf *ibuf1);
 
 /**
  *
- * @attention defined in scaling.c
+ * \attention defined in scaling.c
  */
 struct ImBuf *IMB_double_y(struct ImBuf *ibuf1);
 
 /**
  *
- * @attention Defined in rotate.c
+ * \attention Defined in rotate.c
  */
 void IMB_flipx(struct ImBuf *ibuf);
 void IMB_flipy(struct ImBuf *ibuf);
@@ -479,14 +470,14 @@ void IMB_premultiply_alpha(struct ImBuf *ibuf);
 
 /**
  *
- * @attention Defined in allocimbuf.c
+ * \attention Defined in allocimbuf.c
  */
 void IMB_freezbufImBuf(struct ImBuf *ibuf);
 void IMB_freezbuffloatImBuf(struct ImBuf *ibuf);
 
 /**
  *
- * @attention Defined in rectop.c
+ * \attention Defined in rectop.c
  */
 void IMB_rectfill(struct ImBuf *drect, const float col[4]);
 void IMB_rectfill_area(struct ImBuf *ibuf, float *col, int x1, int y1, int x2, int y2);
diff --git a/source/blender/imbuf/IMB_imbuf_types.h b/source/blender/imbuf/IMB_imbuf_types.h
index cb5d672..076f518 100644
--- a/source/blender/imbuf/IMB_imbuf_types.h
+++ b/source/blender/imbuf/IMB_imbuf_types.h
@@ -44,8 +44,8 @@
  * \todo Clean up includes.
  */
 
-#ifndef IMB_IMBUF_TYPES_H
-#define IMB_IMBUF_TYPES_H
+#ifndef __IMB_IMBUF_TYPES_H__
+#define __IMB_IMBUF_TYPES_H__
 
 struct ImMetaData;
 
@@ -84,8 +84,8 @@ typedef struct ImBuf {
 	/* pixels */
 	unsigned int *rect;		/* pixel values stored here */
 	float *rect_float;		/* floating point Rect equivalent
-							Linear RGB color space - may need gamma correction to 
-							sRGB when generating 8bit representations */
+	                         * Linear RGB color space - may need gamma correction to
+	                         * sRGB when generating 8bit representations */
 
 	/* resolution - pixels per meter */
 	double ppm[2];
diff --git a/source/blender/imbuf/IMB_moviecache.h b/source/blender/imbuf/IMB_moviecache.h
index 309c6ee..f6927d4 100644
--- a/source/blender/imbuf/IMB_moviecache.h
+++ b/source/blender/imbuf/IMB_moviecache.h
@@ -24,8 +24,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef IMB_MOVIECACHE_H
-#define IMB_MOVIECACHE_H
+#ifndef __IMB_MOVIECACHE_H__
+#define __IMB_MOVIECACHE_H__
 
 /** \file IMB_moviecache.h
  *  \ingroup imbuf
@@ -36,8 +36,8 @@
 #include "BLI_ghash.h"
 
 /* Cache system for movie data - now supports stoting ImBufs only
-   Supposed to provide unified cache system for movie clips, sequencer and
-   other movie-related areas */
+ * Supposed to provide unified cache system for movie clips, sequencer and
+ * other movie-related areas */
 
 struct ImBuf;
 struct MovieCache;
diff --git a/source/blender/imbuf/IMB_thumbs.h b/source/blender/imbuf/IMB_thumbs.h
index ad62000..76c09ec 100644
--- a/source/blender/imbuf/IMB_thumbs.h
+++ b/source/blender/imbuf/IMB_thumbs.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef _IMB_THUMBS_H
-#define _IMB_THUMBS_H
+#ifndef __IMB_THUMBS_H__
+#define __IMB_THUMBS_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -57,7 +57,7 @@ typedef enum ThumbSource {
 	THB_SOURCE_BLEND
 } ThumbSource;
 
-/* dont generate thumbs for images bigger then this (100mb) */
+/* don't generate thumbs for images bigger then this (100mb) */
 #define THUMB_SIZE_MAX (100 * 1024*1024)
 
 // IB_metadata
@@ -85,5 +85,5 @@ void IMB_overlayblend_thumb(unsigned int *thumb, int width, int height, float as
 }
 #endif /* __cplusplus */
 
-#endif /* _IMB_THUMBS_H */
+#endif /* __IMB_THUMBS_H__ */
 
diff --git a/source/blender/imbuf/SConscript b/source/blender/imbuf/SConscript
index eae9665..a103011 100644
--- a/source/blender/imbuf/SConscript
+++ b/source/blender/imbuf/SConscript
@@ -15,11 +15,14 @@ incs += ' ' + env['BF_ZLIB_INC']
 
 defs = []
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
+    incs += ' ../../../intern/utfconv'
 
 if env['WITH_BF_OPENEXR']:
     defs.append('WITH_OPENEXR')
+else:
+    sources.append(os.path.join('intern', 'openexr', 'openexr_stub.cpp'))
 
 if env['WITH_BF_TIFF']:
     defs.append('WITH_TIFF')
diff --git a/source/blender/imbuf/intern/IMB_allocimbuf.h b/source/blender/imbuf/intern/IMB_allocimbuf.h
index c2f1d2a..27be9ea 100644
--- a/source/blender/imbuf/intern/IMB_allocimbuf.h
+++ b/source/blender/imbuf/intern/IMB_allocimbuf.h
@@ -33,19 +33,13 @@
  * \ingroup imbuf
  * \brief Header file for allocimbuf.c
  */
-#ifndef IMB_ALLOCIMBUF_H
-#define IMB_ALLOCIMBUF_H
+#ifndef __IMB_ALLOCIMBUF_H__
+#define __IMB_ALLOCIMBUF_H__
 
 struct ImBuf;
 
-short imb_addplanesImBuf(struct ImBuf *ibuf);
-
 short imb_addencodedbufferImBuf(struct ImBuf *ibuf);
 short imb_enlargeencodedbufferImBuf(struct ImBuf *ibuf);
 
-void imb_freeplanesImBuf(struct ImBuf *ibuf);
-
-short imb_addcmapImBuf(struct ImBuf *ibuf);
-
 #endif
 
diff --git a/source/blender/imbuf/intern/IMB_anim.h b/source/blender/imbuf/intern/IMB_anim.h
index a9f020c..8724f38 100644
--- a/source/blender/imbuf/intern/IMB_anim.h
+++ b/source/blender/imbuf/intern/IMB_anim.h
@@ -33,8 +33,8 @@
  */
 
 
-#ifndef IMB_ANIM_H
-#define IMB_ANIM_H
+#ifndef __IMB_ANIM_H__
+#define __IMB_ANIM_H__
 
 #ifdef _WIN32
 #  define INC_OLE2
@@ -50,10 +50,7 @@
 
 #  undef AVIIF_KEYFRAME // redefined in AVI_avi.h
 #  undef AVIIF_LIST // redefined in AVI_avi.h
-
-#  define FIXCC(fcc)  if (fcc == 0)	fcc = mmioFOURCC('N', 'o', 'n', 'e'); \
-		if (fcc == BI_RLE8) fcc = mmioFOURCC('R', 'l', 'e', '8');
-#endif
+#endif /* _WIN32 */
 
 #include <sys/types.h>
 #include <ctype.h>
diff --git a/source/blender/imbuf/intern/IMB_filetype.h b/source/blender/imbuf/intern/IMB_filetype.h
index 4cd10ad..74d0a92 100644
--- a/source/blender/imbuf/intern/IMB_filetype.h
+++ b/source/blender/imbuf/intern/IMB_filetype.h
@@ -25,8 +25,8 @@
  */
 
 
-#ifndef IMB_FILETYPE_H
-#define IMB_FILETYPE_H
+#ifndef __IMB_FILETYPE_H__
+#define __IMB_FILETYPE_H__
 
 /* Generic File Type */
 
@@ -117,7 +117,6 @@ struct ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags);
 void imb_loadtiletiff(struct ImBuf *ibuf, unsigned char *mem, size_t size,
 	int tx, int ty, unsigned int *rect);
 int imb_savetiff(struct ImBuf *ibuf, const char *name, int flags);
-void *libtiff_findsymbol(char *name);
 
-#endif	/* IMB_FILETYPE_H */
+#endif	/* __IMB_FILETYPE_H__ */
 
diff --git a/source/blender/imbuf/intern/IMB_filter.h b/source/blender/imbuf/intern/IMB_filter.h
index 29e6c49..6199cc1 100644
--- a/source/blender/imbuf/intern/IMB_filter.h
+++ b/source/blender/imbuf/intern/IMB_filter.h
@@ -33,8 +33,8 @@
  * \brief Function declarations for filter.c
  */
 
-#ifndef IMB_FILTER_H
-#define IMB_FILTER_H
+#ifndef __IMB_FILTER_H__
+#define __IMB_FILTER_H__
 
 struct ImBuf;
 
diff --git a/source/blender/imbuf/intern/IMB_indexer.h b/source/blender/imbuf/intern/IMB_indexer.h
index f9d9020..dc16b4d 100644
--- a/source/blender/imbuf/intern/IMB_indexer.h
+++ b/source/blender/imbuf/intern/IMB_indexer.h
@@ -22,8 +22,8 @@
  */
 
 
-#ifndef IMB_INDEXER_H
-#define IMB_INDEXER_H
+#ifndef __IMB_INDEXER_H__
+#define __IMB_INDEXER_H__
 
 #ifdef WIN32
 #  include <io.h>
@@ -33,26 +33,24 @@
 #include <stdio.h>
 #include "BKE_utildefines.h"
 #include "IMB_anim.h"
-
 /*
-  separate animation index files to solve the following problems:
-
-  a) different timecodes within one file (like DTS/PTS, Timecode-Track, 
-     "implicit" timecodes within DV-files and HDV-files etc.)
-  b) seeking difficulties within ffmpeg for files with timestamp holes
-  c) broken files that miss several frames / have varying framerates
-  d) use proxies accordingly
-
-  ... we need index files, that provide us with 
-  
-  the binary(!) position, where we have to seek into the file *and*
-  the continuous frame number (ignoring the holes) starting from the 
-  beginning of the file, so that we know, which proxy frame to serve.
-
-  This index has to be only built once for a file and is written into
-  the BL_proxy directory structure for later reuse in different blender files.
-
-*/
+ * separate animation index files to solve the following problems:
+ *
+ * a) different timecodes within one file (like DTS/PTS, Timecode-Track,
+ *    "implicit" timecodes within DV-files and HDV-files etc.)
+ * b) seeking difficulties within ffmpeg for files with timestamp holes
+ * c) broken files that miss several frames / have varying framerates
+ * d) use proxies accordingly
+ *
+ * ... we need index files, that provide us with
+ *
+ * the binary(!) position, where we have to seek into the file *and*
+ * the continuous frame number (ignoring the holes) starting from the
+ * beginning of the file, so that we know, which proxy frame to serve.
+ *
+ * This index has to be only built once for a file and is written into
+ * the BL_proxy directory structure for later reuse in different blender files.
+ */
 
 typedef struct anim_index_entry {
 	int frameno;
diff --git a/source/blender/imbuf/intern/IMB_metadata.h b/source/blender/imbuf/intern/IMB_metadata.h
index 0f57b8f..336a5f9 100644
--- a/source/blender/imbuf/intern/IMB_metadata.h
+++ b/source/blender/imbuf/intern/IMB_metadata.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef _IMB_IMGINFO_H
-#define _IMB_IMGINFO_H
+#ifndef __IMB_METADATA_H__
+#define __IMB_METADATA_H__
 
 struct ImBuf;
 
@@ -42,42 +42,42 @@ typedef struct ImMetaData {
 	int len;
 } ImMetaData;
 
-/** The metadata is a list of key/value pairs (both char*) that can me 
-	saved in the header of several image formats.
-	Apart from some common keys like 
-	'Software' and 'Description' (png standard) we'll use keys within the 
-	Blender namespace, so should be called 'Blender::StampInfo' or 'Blender::FrameNum'
-	etc... 
-*/
+/** The metadata is a list of key/value pairs (both char*) that can me
+ * saved in the header of several image formats.
+ * Apart from some common keys like
+ * 'Software' and 'Description' (png standard) we'll use keys within the
+ * Blender namespace, so should be called 'Blender::StampInfo' or 'Blender::FrameNum'
+ * etc...
+ */
 
 
 /* free blender ImMetaData struct */
 void IMB_metadata_free(struct ImBuf* img);
 
 /** read the field from the image info into the field 
- *  @param img - the ImBuf that contains the image data
- *  @param key - the key of the field
- *  @param value - the data in the field, first one found with key is returned, 
-				  memory has to be allocated by user.
- *  @param len - length of value buffer allocated by user.
- *  @return    - 1 (true) if ImageInfo present and value for the key found, 0 (false) otherwise
+ *  \param img - the ImBuf that contains the image data
+ *  \param key - the key of the field
+ *  \param value - the data in the field, first one found with key is returned, 
+ *                 memory has to be allocated by user.
+ *  \param len - length of value buffer allocated by user.
+ *  \return    - 1 (true) if ImageInfo present and value for the key found, 0 (false) otherwise
  */
 int IMB_metadata_get_field(struct ImBuf* img, const char* key, char* value, int len);
 
 /** set user data in the ImMetaData struct, which has to be allocated with IMB_metadata_create
  *  before calling this function.
- *  @param img - the ImBuf that contains the image data
- *  @param key - the key of the field
- *  @param value - the data to be written to the field. zero terminated string
- *  @return    - 1 (true) if ImageInfo present, 0 (false) otherwise
+ *  \param img - the ImBuf that contains the image data
+ *  \param key - the key of the field
+ *  \param value - the data to be written to the field. zero terminated string
+ *  \return    - 1 (true) if ImageInfo present, 0 (false) otherwise
  */
-int IMB_metadata_add_field(struct ImBuf* img, const char* key, const char* field);
+int IMB_metadata_add_field(struct ImBuf* img, const char* key, const char* value);
 
 /** delete the key/field par in the ImMetaData struct.
- * @param img - the ImBuf that contains the image data
- * @param key - the key of the field
- * @return - 1 (true) if delete the key/field, 0 (false) otherwise
+ * \param img - the ImBuf that contains the image data
+ * \param key - the key of the field
+ * \return - 1 (true) if delete the key/field, 0 (false) otherwise
  */
 int IMB_metadata_del_field(struct ImBuf *img, const char *key);
 
-#endif /* _IMB_IMGINFO_H */
+#endif /* __IMB_METADATA_H__ */
diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c
index d85251a..2cfdd7b 100644
--- a/source/blender/imbuf/intern/allocimbuf.c
+++ b/source/blender/imbuf/intern/allocimbuf.c
@@ -51,8 +51,8 @@ void imb_freemipmapImBuf(ImBuf *ibuf)
 {
 	int a;
 	
-	for(a=1; a<ibuf->miptot; a++) {
-		if(ibuf->mipmap[a-1])
+	for (a=1; a<ibuf->miptot; a++) {
+		if (ibuf->mipmap[a-1])
 			IMB_freeImBuf(ibuf->mipmap[a-1]);
 		ibuf->mipmap[a-1]= NULL;
 	}
@@ -63,9 +63,9 @@ void imb_freemipmapImBuf(ImBuf *ibuf)
 /* any free rect frees mipmaps to be sure, creation is in render on first request */
 void imb_freerectfloatImBuf(ImBuf *ibuf)
 {
-	if(ibuf==NULL) return;
+	if (ibuf==NULL) return;
 	
-	if(ibuf->rect_float && (ibuf->mall & IB_rectfloat)) {
+	if (ibuf->rect_float && (ibuf->mall & IB_rectfloat)) {
 		MEM_freeN(ibuf->rect_float);
 		ibuf->rect_float=NULL;
 	}
@@ -79,9 +79,9 @@ void imb_freerectfloatImBuf(ImBuf *ibuf)
 /* any free rect frees mipmaps to be sure, creation is in render on first request */
 void imb_freerectImBuf(ImBuf *ibuf)
 {
-	if(ibuf==NULL) return;
+	if (ibuf==NULL) return;
 
-	if(ibuf->rect && (ibuf->mall & IB_rect))
+	if (ibuf->rect && (ibuf->mall & IB_rect))
 		MEM_freeN(ibuf->rect);
 	ibuf->rect= NULL;
 	
@@ -94,12 +94,12 @@ void imb_freetilesImBuf(ImBuf *ibuf)
 {
 	int tx, ty;
 
-	if(ibuf==NULL) return;
+	if (ibuf==NULL) return;
 
-	if(ibuf->tiles && (ibuf->mall & IB_tiles)) {
-		for(ty=0; ty<ibuf->ytiles; ty++) {
-			for(tx=0; tx<ibuf->xtiles; tx++) {
-				if(ibuf->tiles[ibuf->xtiles*ty + tx]) {
+	if (ibuf->tiles && (ibuf->mall & IB_tiles)) {
+		for (ty=0; ty<ibuf->ytiles; ty++) {
+			for (tx=0; tx<ibuf->xtiles; tx++) {
+				if (ibuf->tiles[ibuf->xtiles*ty + tx]) {
 					imb_tile_cache_tile_free(ibuf, tx, ty);
 					MEM_freeN(ibuf->tiles[ibuf->xtiles*ty + tx]);
 				}
@@ -115,9 +115,9 @@ void imb_freetilesImBuf(ImBuf *ibuf)
 
 static void freeencodedbufferImBuf(ImBuf *ibuf)
 {
-	if(ibuf==NULL) return;
+	if (ibuf==NULL) return;
 
-	if(ibuf->encodedbuffer && (ibuf->mall & IB_mem))
+	if (ibuf->encodedbuffer && (ibuf->mall & IB_mem))
 		MEM_freeN(ibuf->encodedbuffer);
 
 	ibuf->encodedbuffer = NULL;
@@ -128,9 +128,9 @@ static void freeencodedbufferImBuf(ImBuf *ibuf)
 
 void IMB_freezbufImBuf(ImBuf *ibuf)
 {
-	if(ibuf==NULL) return;
+	if (ibuf==NULL) return;
 
-	if(ibuf->zbuf && (ibuf->mall & IB_zbuf))
+	if (ibuf->zbuf && (ibuf->mall & IB_zbuf))
 		MEM_freeN(ibuf->zbuf);
 
 	ibuf->zbuf= NULL;
@@ -139,9 +139,9 @@ void IMB_freezbufImBuf(ImBuf *ibuf)
 
 void IMB_freezbuffloatImBuf(ImBuf *ibuf)
 {
-	if(ibuf==NULL) return;
+	if (ibuf==NULL) return;
 
-	if(ibuf->zbuf_float && (ibuf->mall & IB_zbuffloat))
+	if (ibuf->zbuf_float && (ibuf->mall & IB_zbuffloat))
 		MEM_freeN(ibuf->zbuf_float);
 
 	ibuf->zbuf_float= NULL;
@@ -150,8 +150,8 @@ void IMB_freezbuffloatImBuf(ImBuf *ibuf)
 
 void IMB_freeImBuf(ImBuf *ibuf)
 {
-	if(ibuf) {
-		if(ibuf->refcounter > 0) {
+	if (ibuf) {
+		if (ibuf->refcounter > 0) {
 			ibuf->refcounter--;
 		}
 		else {
@@ -189,12 +189,12 @@ short addzbufImBuf(ImBuf *ibuf)
 {
 	int size;
 	
-	if(ibuf==NULL) return FALSE;
+	if (ibuf==NULL) return FALSE;
 	
 	IMB_freezbufImBuf(ibuf);
 	
 	size = ibuf->x *ibuf->y *sizeof(unsigned int);
-	if((ibuf->zbuf = MEM_mapallocN(size, "addzbufImBuf"))) {
+	if ((ibuf->zbuf = MEM_mapallocN(size, "addzbufImBuf"))) {
 		ibuf->mall |= IB_zbuf;
 		ibuf->flags |= IB_zbuf;
 		return TRUE;
@@ -207,12 +207,12 @@ short addzbuffloatImBuf(ImBuf *ibuf)
 {
 	int size;
 	
-	if(ibuf==NULL) return FALSE;
+	if (ibuf==NULL) return FALSE;
 	
 	IMB_freezbuffloatImBuf(ibuf);
 	
 	size = ibuf->x *ibuf->y *sizeof(float);
-	if((ibuf->zbuf_float = MEM_mapallocN(size, "addzbuffloatImBuf"))) {
+	if ((ibuf->zbuf_float = MEM_mapallocN(size, "addzbuffloatImBuf"))) {
 		ibuf->mall |= IB_zbuffloat;
 		ibuf->flags |= IB_zbuffloat;
 		return TRUE;
@@ -224,16 +224,16 @@ short addzbuffloatImBuf(ImBuf *ibuf)
 
 short imb_addencodedbufferImBuf(ImBuf *ibuf)
 {
-	if(ibuf==NULL) return FALSE;
+	if (ibuf==NULL) return FALSE;
 
 	freeencodedbufferImBuf(ibuf);
 
-	if(ibuf->encodedbuffersize == 0) 
+	if (ibuf->encodedbuffersize == 0)
 		ibuf->encodedbuffersize = 10000;
 
 	ibuf->encodedsize = 0;
 
-	if((ibuf->encodedbuffer = MEM_mallocN(ibuf->encodedbuffersize, "addencodedbufferImBuf"))) {
+	if ((ibuf->encodedbuffer = MEM_mallocN(ibuf->encodedbuffersize, "addencodedbufferImBuf"))) {
 		ibuf->mall |= IB_mem;
 		ibuf->flags |= IB_mem;
 		return TRUE;
@@ -248,22 +248,23 @@ short imb_enlargeencodedbufferImBuf(ImBuf *ibuf)
 	unsigned int newsize, encodedsize;
 	void *newbuffer;
 
-	if(ibuf==NULL) return FALSE;
+	if (ibuf==NULL) return FALSE;
 
-	if(ibuf->encodedbuffersize < ibuf->encodedsize) {
+	if (ibuf->encodedbuffersize < ibuf->encodedsize) {
 		printf("imb_enlargeencodedbufferImBuf: error in parameters\n");
 		return FALSE;
 	}
 
 	newsize = 2 *ibuf->encodedbuffersize;
-	if(newsize < 10000) newsize = 10000;
+	if (newsize < 10000) newsize = 10000;
 
 	newbuffer = MEM_mallocN(newsize, "enlargeencodedbufferImBuf");
-	if(newbuffer == NULL) return FALSE;
+	if (newbuffer == NULL) return FALSE;
 
-	if(ibuf->encodedbuffer) {
+	if (ibuf->encodedbuffer) {
 		memcpy(newbuffer, ibuf->encodedbuffer, ibuf->encodedsize);
-	} else {
+	}
+	else {
 		ibuf->encodedsize = 0;
 	}
 
@@ -284,16 +285,16 @@ short imb_addrectfloatImBuf(ImBuf *ibuf)
 {
 	int size;
 	
-	if(ibuf==NULL) return FALSE;
+	if (ibuf==NULL) return FALSE;
 	
-	if(ibuf->rect_float)
+	if (ibuf->rect_float)
 		imb_freerectfloatImBuf(ibuf); /* frees mipmap too, hrm */
 	
 	size = ibuf->x *ibuf->y;
 	size = size *4 *sizeof(float);
 	ibuf->channels= 4;
 	
-	if((ibuf->rect_float = MEM_mapallocN(size, "imb_addrectfloatImBuf"))) {
+	if ((ibuf->rect_float = MEM_mapallocN(size, "imb_addrectfloatImBuf"))) {
 		ibuf->mall |= IB_rectfloat;
 		ibuf->flags |= IB_rectfloat;
 		return TRUE;
@@ -307,20 +308,20 @@ short imb_addrectImBuf(ImBuf *ibuf)
 {
 	int size;
 
-	if(ibuf==NULL) return FALSE;
+	if (ibuf==NULL) return FALSE;
 	
 	/* don't call imb_freerectImBuf, it frees mipmaps, this call is used only too give float buffers display */
-	if(ibuf->rect && (ibuf->mall & IB_rect))
+	if (ibuf->rect && (ibuf->mall & IB_rect))
 		MEM_freeN(ibuf->rect);
 	ibuf->rect= NULL;
 	
 	size = ibuf->x*ibuf->y;
 	size = size*sizeof(unsigned int);
 
-	if((ibuf->rect = MEM_mapallocN(size, "imb_addrectImBuf"))) {
+	if ((ibuf->rect = MEM_mapallocN(size, "imb_addrectImBuf"))) {
 		ibuf->mall |= IB_rect;
 		ibuf->flags |= IB_rect;
-		if(ibuf->planes > 32) return (addzbufImBuf(ibuf));
+		if (ibuf->planes > 32) return (addzbufImBuf(ibuf));
 		else return TRUE;
 	}
 
@@ -329,10 +330,10 @@ short imb_addrectImBuf(ImBuf *ibuf)
 
 short imb_addtilesImBuf(ImBuf *ibuf)
 {
-	if(ibuf==NULL) return FALSE;
+	if (ibuf==NULL) return FALSE;
 
-	if(!ibuf->tiles)
-		if((ibuf->tiles = MEM_callocN(sizeof(unsigned int*)*ibuf->xtiles*ibuf->ytiles, "imb_tiles")))
+	if (!ibuf->tiles)
+		if ((ibuf->tiles = MEM_callocN(sizeof(unsigned int*)*ibuf->xtiles*ibuf->ytiles, "imb_tiles")))
 			ibuf->mall |= IB_tiles;
 
 	return (ibuf->tiles != NULL);
@@ -344,7 +345,7 @@ ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, uchar planes, unsigned int
 
 	ibuf = MEM_callocN(sizeof(ImBuf), "ImBuf_struct");
 
-	if(ibuf) {
+	if (ibuf) {
 		ibuf->x= x;
 		ibuf->y= y;
 		ibuf->planes= planes;
@@ -352,29 +353,29 @@ ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, uchar planes, unsigned int
 		ibuf->channels= 4;	/* float option, is set to other values when buffers get assigned */
 		ibuf->ppm[0]= ibuf->ppm[1]= 150.0 / 0.0254; /* 150dpi -> pixels-per-meter */
 		
-		if(flags & IB_rect) {
-			if(imb_addrectImBuf(ibuf)==FALSE) {
+		if (flags & IB_rect) {
+			if (imb_addrectImBuf(ibuf)==FALSE) {
 				IMB_freeImBuf(ibuf);
 				return NULL;
 			}
 		}
 		
-		if(flags & IB_rectfloat) {
-			if(imb_addrectfloatImBuf(ibuf)==FALSE) {
+		if (flags & IB_rectfloat) {
+			if (imb_addrectfloatImBuf(ibuf)==FALSE) {
 				IMB_freeImBuf(ibuf);
 				return NULL;
 			}
 		}
 		
-		if(flags & IB_zbuf) {
-			if(addzbufImBuf(ibuf)==FALSE) {
+		if (flags & IB_zbuf) {
+			if (addzbufImBuf(ibuf)==FALSE) {
 				IMB_freeImBuf(ibuf);
 				return NULL;
 			}
 		}
 		
-		if(flags & IB_zbuffloat) {
-			if(addzbuffloatImBuf(ibuf)==FALSE) {
+		if (flags & IB_zbuffloat) {
+			if (addzbuffloatImBuf(ibuf)==FALSE) {
 				IMB_freeImBuf(ibuf);
 				return NULL;
 			}
@@ -390,27 +391,27 @@ ImBuf *IMB_dupImBuf(ImBuf *ibuf1)
 	int flags = 0;
 	int a, x, y;
 	
-	if(ibuf1 == NULL) return NULL;
+	if (ibuf1 == NULL) return NULL;
 
-	if(ibuf1->rect) flags |= IB_rect;
-	if(ibuf1->rect_float) flags |= IB_rectfloat;
+	if (ibuf1->rect) flags |= IB_rect;
+	if (ibuf1->rect_float) flags |= IB_rectfloat;
 
 	x = ibuf1->x;
 	y = ibuf1->y;
-	if(ibuf1->flags & IB_fields) y *= 2;
+	if (ibuf1->flags & IB_fields) y *= 2;
 	
 	ibuf2 = IMB_allocImBuf(x, y, ibuf1->planes, flags);
-	if(ibuf2 == NULL) return NULL;
+	if (ibuf2 == NULL) return NULL;
 
-	if(flags & IB_rect)
+	if (flags & IB_rect)
 		memcpy(ibuf2->rect, ibuf1->rect, x *y *sizeof(int));
 	
-	if(flags & IB_rectfloat)
+	if (flags & IB_rectfloat)
 		memcpy(ibuf2->rect_float, ibuf1->rect_float, ibuf1->channels *x *y *sizeof(float));
 
-	if(ibuf1->encodedbuffer) {
+	if (ibuf1->encodedbuffer) {
 		ibuf2->encodedbuffersize = ibuf1->encodedbuffersize;
-		if(imb_addencodedbufferImBuf(ibuf2) == FALSE) {
+		if (imb_addencodedbufferImBuf(ibuf2) == FALSE) {
 			IMB_freeImBuf(ibuf2);
 			return NULL;
 		}
@@ -427,7 +428,7 @@ ImBuf *IMB_dupImBuf(ImBuf *ibuf1)
 	tbuf.encodedbuffer = ibuf2->encodedbuffer;
 	tbuf.zbuf= NULL;
 	tbuf.zbuf_float= NULL;
-	for(a=0; a<IB_MIPMAP_LEVELS; a++)
+	for (a=0; a<IB_MIPMAP_LEVELS; a++)
 		tbuf.mipmap[a]= NULL;
 	
 	// set malloc flag
@@ -464,7 +465,7 @@ static MEM_CacheLimiterC **get_imbuf_cache_limiter(void)
 {
 	static MEM_CacheLimiterC *c = NULL;
 
-	if(!c)
+	if (!c)
 		c = new_MEM_CacheLimiter(imbuf_cache_destructor, NULL);
 
 	return &c;
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index a090337..0c8f932 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -45,8 +45,12 @@
 #undef AVIIF_KEYFRAME // redefined in AVI_avi.h
 #undef AVIIF_LIST // redefined in AVI_avi.h
 
-#define FIXCC(fcc)  if (fcc == 0)	fcc = mmioFOURCC('N', 'o', 'n', 'e'); \
-		if (fcc == BI_RLE8) fcc = mmioFOURCC('R', 'l', 'e', '8');
+#define FIXCC(fcc) \
+	{ \
+		if (fcc == 0)       { fcc = mmioFOURCC('N', 'o', 'n', 'e'); } \
+		if (fcc == BI_RLE8) { fcc = mmioFOURCC('R', 'l', 'e', '8'); } \
+	}
+
 #endif
 
 #include <sys/types.h>
@@ -61,7 +65,7 @@
 #endif
 
 #include "BLI_blenlib.h" /* BLI_remlink BLI_filesize BLI_addtail
-							BLI_countlist BLI_stringdec */
+                          * BLI_countlist BLI_stringdec */
 #include "BLI_utildefines.h"
 #include "BLI_math_base.h"
 
@@ -135,21 +139,23 @@ static int an_stringdec(const char *string, char* head, char *tail, unsigned sho
 	len=strlen(string);
 	nume = len;
 
-	for(i=len-1;i>=0;i--){
+	for (i=len-1;i>=0;i--) {
 		if (string[i]==PATHSEPERATOR) break;
 		if (isdigit(string[i])) {
-			if (found){
+			if (found) {
 				nums=i;
-			} else{
+			}
+			else {
 				nume=i;
 				nums=i;
 				found=TRUE;
 			}
-		} else{
+		}
+		else {
 			if (found) break;
 		}
 	}
-	if (found){
+	if (found) {
 		strcpy(tail ,&string[nume+1]);
 		strcpy(head, string);
 		head[nums]= '\0';
@@ -188,7 +194,7 @@ static void free_anim_avi (struct anim *anim)
 		anim->pgf = NULL;
 	}
 
-	for (i = 0; i < anim->avistreams; i++){
+	for (i = 0; i < anim->avistreams; i++) {
 		AVIStreamRelease(anim->pavi[i]);
 	}
 	anim->avistreams = 0;
@@ -241,6 +247,13 @@ void IMB_close_anim(struct anim * anim)
 	IMB_free_anim(anim);
 }
 
+void IMB_close_anim_proxies(struct anim *anim)
+{
+	if (anim == NULL)
+		return;
+
+	IMB_free_indices(anim);
+}
 
 struct anim * IMB_open_anim( const char * name, int ib_flags, int streamindex)
 {
@@ -311,7 +324,8 @@ static int startavi (struct anim *anim)
 						lpbi = (LPBITMAPINFOHEADER)abFormat;
 						anim->avi->header->Height = lpbi->biHeight;
 						anim->avi->header->Width = lpbi->biWidth;
-					} else {
+					}
+					else {
 						FIXCC(avis.fccHandler);
 						FIXCC(avis.fccType);
 						printf("Can't find AVI decoder for type : %4.4hs/%4.4hs\n",
@@ -329,11 +343,13 @@ static int startavi (struct anim *anim)
 			//
 			if ((anim->avistreams == 0) || (firstvideo == -1)) {
 				avierror = AVI_ERROR_FORMAT;
-			} else {
+			}
+			else {
 				avierror = AVI_ERROR_NONE;
 				anim->firstvideo = firstvideo;
 			}
-		} else {
+		}
+		else {
 			AVIFileExit();
 		}
 	}
@@ -382,7 +398,8 @@ static ImBuf * avi_fetchibuf (struct anim *anim, int position)
 //Oh brother...
 			}
 		}
-	} else {
+	}
+	else {
 #else
 	if (1) {
 #endif
@@ -438,11 +455,11 @@ static int startffmpeg(struct anim * anim)
 
 	do_init_ffmpeg();
 
-	if(av_open_input_file(&pFormatCtx, anim->name, NULL, 0, NULL)!=0) {
+	if (av_open_input_file(&pFormatCtx, anim->name, NULL, 0, NULL)!=0) {
 		return -1;
 	}
 
-	if(av_find_stream_info(pFormatCtx)<0) {
+	if (av_find_stream_info(pFormatCtx)<0) {
 		av_close_input_file(pFormatCtx);
 		return -1;
 	}
@@ -453,7 +470,7 @@ static int startffmpeg(struct anim * anim)
 	/* Find the video stream */
 	videoStream = -1;
 
-	for(i = 0; i < pFormatCtx->nb_streams; i++)
+	for (i = 0; i < pFormatCtx->nb_streams; i++)
 		if (pFormatCtx->streams[i]->codec->codec_type
 		   == AVMEDIA_TYPE_VIDEO) {
 			if (streamcount > 0) {
@@ -464,7 +481,7 @@ static int startffmpeg(struct anim * anim)
 			break;
 		}
 
-	if(videoStream==-1) {
+	if (videoStream==-1) {
 		av_close_input_file(pFormatCtx);
 		return -1;
 	}
@@ -473,14 +490,14 @@ static int startffmpeg(struct anim * anim)
 
 	/* Find the decoder for the video stream */
 	pCodec = avcodec_find_decoder(pCodecCtx->codec_id);
-	if(pCodec == NULL) {
+	if (pCodec == NULL) {
 		av_close_input_file(pFormatCtx);
 		return -1;
 	}
 
 	pCodecCtx->workaround_bugs = 1;
 
-	if(avcodec_open(pCodecCtx, pCodec) < 0) {
+	if (avcodec_open(pCodecCtx, pCodec) < 0) {
 		av_close_input_file(pFormatCtx);
 		return -1;
 	}
@@ -550,7 +567,8 @@ static int startffmpeg(struct anim * anim)
 
 	if (pCodecCtx->has_b_frames) {
 		anim->preseek = 25; /* FIXME: detect gopsize ... */
-	} else {
+	}
+	else {
 		anim->preseek = 0;
 	}
 	
@@ -584,7 +602,7 @@ static int startffmpeg(struct anim * anim)
 		srcRange = srcRange || anim->pCodecCtx->color_range == AVCOL_RANGE_JPEG;
 		inv_table = sws_getCoefficients(anim->pCodecCtx->colorspace);
 
-		if(sws_setColorspaceDetails(anim->img_convert_ctx, (int *)inv_table, srcRange,
+		if (sws_setColorspaceDetails(anim->img_convert_ctx, (int *)inv_table, srcRange,
 			table, dstRange, brightness, contrast, saturation)) {
 
 			printf("Warning: Could not set libswscale colorspace details.\n");
@@ -599,10 +617,10 @@ static int startffmpeg(struct anim * anim)
 }
 
 /* postprocess the image in anim->pFrame and do color conversion
-   and deinterlacing stuff.
-
-   Output is anim->last_frame
-*/
+ * and deinterlacing stuff.
+ *
+ * Output is anim->last_frame
+ */
 
 static void ffmpeg_postprocess(struct anim * anim)
 {
@@ -617,9 +635,10 @@ static void ffmpeg_postprocess(struct anim * anim)
 	}
 
 	/* This means the data wasnt read properly, 
-	   this check stops crashing */
-	if (input->data[0]==0 && input->data[1]==0 
-	    && input->data[2]==0 && input->data[3]==0){
+	 * this check stops crashing */
+	if (input->data[0]==0 && input->data[1]==0 &&
+	    input->data[2]==0 && input->data[3]==0)
+	{
 		fprintf(stderr, "ffmpeg_fetchibuf: "
 			"data not read properly...\n");
 		return;
@@ -642,7 +661,8 @@ static void ffmpeg_postprocess(struct anim * anim)
 			    anim->pCodecCtx->height)
 		    < 0) {
 			filter_y = TRUE;
-		} else {
+		}
+		else {
 			input = anim->pFrameDeinterlaced;
 		}
 	}
@@ -697,7 +717,8 @@ static void ffmpeg_postprocess(struct anim * anim)
 			}
 			top -= 8 * w;
 		}
-	} else {
+	}
+	else {
 		int * dstStride   = anim->pFrameRGB->linesize;
 		uint8_t** dst     = anim->pFrameRGB->data;
 		int dstStride2[4] = { -dstStride[0], 0, 0, 0 };
@@ -731,7 +752,7 @@ static int ffmpeg_decode_video_frame(struct anim * anim)
 		anim->next_packet.stream_index = -1;
 	}
 	
-	while((rval = av_read_frame(anim->pFormatCtx, &anim->next_packet)) >= 0) {
+	while ((rval = av_read_frame(anim->pFormatCtx, &anim->next_packet)) >= 0) {
 		av_log(anim->pFormatCtx, 
 		       AV_LOG_DEBUG, 
 		       "%sREAD: strID=%d (VID: %d) dts=%lld pts=%lld "
@@ -817,7 +838,8 @@ static void ffmpeg_decode_video_frame_scan(
 	if (anim->next_pts == pts_to_search) {
 		av_log(anim->pFormatCtx,
 		       AV_LOG_DEBUG, "SCAN HAPPY: we found our PTS!\n");
-	} else {
+	}
+	else {
 		av_log(anim->pFormatCtx,
 		       AV_LOG_ERROR, "SCAN UNHAPPY: PTS not matched!\n");
 	}
@@ -896,7 +918,8 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
 			tc_index, anim->curposition);
 		pts_to_search =	IMB_indexer_get_pts(
 			tc_index, new_frame_index);
-	} else {
+	}
+	else {
 		pts_to_search = (long long) 
 			floor(((double) position) 
 			      / pts_time_base / frame_rate + 0.5);
@@ -913,7 +936,7 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
 	       (long long int)pts_to_search,pts_time_base, frame_rate, st_time);
 
 	if (anim->last_frame && 
-	    anim->last_pts <= pts_to_search && anim->next_pts > pts_to_search){
+	    anim->last_pts <= pts_to_search && anim->next_pts > pts_to_search) {
 		av_log(anim->pFormatCtx, AV_LOG_DEBUG, 
 		       "FETCH: frame repeat: last: %lld next: %lld\n",
 		       (long long int)anim->last_pts, 
@@ -923,15 +946,17 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
 		return anim->last_frame;
 	}
 	 
-	if (position > anim->curposition + 1 
-	    && anim->preseek 
-	    && !tc_index
-	    && position - (anim->curposition + 1) < anim->preseek) {
+	if (position > anim->curposition + 1 &&
+	    anim->preseek &&
+	    !tc_index &&
+	    position - (anim->curposition + 1) < anim->preseek)
+	{
 		av_log(anim->pFormatCtx, AV_LOG_DEBUG, 
 		       "FETCH: within preseek interval (no index)\n");
 
 		ffmpeg_decode_video_frame_scan(anim, pts_to_search);
-	} else if (tc_index && 
+	}
+	else if (tc_index &&
 		   IMB_indexer_can_scan(tc_index, old_frame_index,
 					new_frame_index)) {
 
@@ -940,7 +965,8 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
 		       "(index tells us)\n");
 
 		ffmpeg_decode_video_frame_scan(anim, pts_to_search);
-	} else if (position != anim->curposition + 1) { 
+	}
+	else if (position != anim->curposition + 1) {
 		long long pos;
 		int ret;
 
@@ -965,14 +991,16 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
 						    -1,
 						    pos, AVSEEK_FLAG_BYTE);
 				av_update_cur_dts(anim->pFormatCtx, v_st, dts);
-			} else {
+			}
+			else {
 				av_log(anim->pFormatCtx, AV_LOG_DEBUG, 
 				       "... using DTS pos\n");
 				ret = av_seek_frame(anim->pFormatCtx, 
 						    anim->videoStream, 
 						    dts, AVSEEK_FLAG_BACKWARD);
 			}
-		} else {
+		}
+		else {
 			pos = (long long) (position - anim->preseek) 
 				* AV_TIME_BASE / frame_rate;
 
@@ -1017,10 +1045,12 @@ static ImBuf * ffmpeg_fetchibuf(struct anim * anim, int position,
 		if (ret >= 0) {
 			ffmpeg_decode_video_frame_scan(anim, pts_to_search);
 		}
-	} else if (position == 0 && anim->curposition == -1) {
+	}
+	else if (position == 0 && anim->curposition == -1) {
 		/* first frame without seeking special case... */
 		ffmpeg_decode_video_frame(anim);
-	} else {
+	}
+	else {
 		av_log(anim->pFormatCtx, AV_LOG_DEBUG, 
 		       "FETCH: no seek necessary, just continue...\n");
 	}
diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c
index 77fc6bd..06e1d75 100644
--- a/source/blender/imbuf/intern/bmp.c
+++ b/source/blender/imbuf/intern/bmp.c
@@ -40,11 +40,11 @@
 #include "IMB_filetype.h"
 
 /* some code copied from article on microsoft.com, copied
-  here for enhanced BMP support in the future
-  http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0197/mfcp1/mfcp1.htm&nav=/msj/0197/newnav.htm
-*/
+ * here for enhanced BMP support in the future
+ * http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0197/mfcp1/mfcp1.htm&nav=/msj/0197/newnav.htm
+ */
 
-typedef struct BMPINFOHEADER{
+typedef struct BMPINFOHEADER {
 	unsigned int	biSize;
 	unsigned int	biWidth;
 	unsigned int	biHeight;
@@ -78,7 +78,8 @@ static int checkbmp(unsigned char *mem)
 		if ((mem[0] == 'B') && (mem[1] == 'M')) {
 			/* skip fileheader */
 			mem += BMP_FILEHEADER_SIZE;
-		} else {
+		}
+		else {
 		}
 
 		/* for systems where an int needs to be 4 bytes aligned */
@@ -129,13 +130,17 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags)
 	y = LITTLE_LONG(bmi.biHeight);
 	depth = LITTLE_SHORT(bmi.biBitCount);
 
-	/* printf("skip: %d, x: %d y: %d, depth: %d (%x)\n", skip, x, y, 
-		depth, bmi.biBitCount); */
-	/* printf("skip: %d, x: %d y: %d, depth: %d (%x)\n", skip, x, y, 
-		depth, bmi.biBitCount); */
+#if 0
+	printf("skip: %d, x: %d y: %d, depth: %d (%x)\n", skip, x, y,
+	       depth, bmi.biBitCount);
+	printf("skip: %d, x: %d y: %d, depth: %d (%x)\n", skip, x, y,
+	       depth, bmi.biBitCount);
+#endif
+
 	if (flags & IB_test) {
 		ibuf = IMB_allocImBuf(x, y, depth, 0);
-	} else {
+	}
+	else {
 		ibuf = IMB_allocImBuf(x, y, depth, IB_rect);
 		bmp = mem + skip;
 		rect = (unsigned char *) ibuf->rect;
@@ -151,7 +156,8 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags)
 				rect += 4; bmp += 2;
 			}
 
-		} else if (depth == 24) {
+		}
+		else if (depth == 24) {
 			for (i = y; i > 0; i--) {
 				int j;
 				for (j = x ; j > 0; j--) {
@@ -165,7 +171,8 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags)
 				/* for 24-bit images, rows are padded to multiples of 4 */
 				bmp += x % 4;	
 			}
-		} else if (depth == 32) {
+		}
+		else if (depth == 32) {
 			for (i = x * y; i > 0; i--) {
 				rect[0] = bmp[2];
 				rect[1] = bmp[1];
@@ -213,7 +220,7 @@ int imb_savebmp(struct ImBuf *ibuf, const char *name, int flags)
 	bytesize = (ibuf->x * 3 + extrabytes) * ibuf->y;
 
 	data = (uchar *) ibuf->rect;
-	ofile = fopen(name,"wb");
+	ofile = BLI_fopen(name,"wb");
 		if (!ofile) return 0;
 
 	putShortLSB(19778,ofile); /* "BM" */
diff --git a/source/blender/imbuf/intern/cache.c b/source/blender/imbuf/intern/cache.c
index 7213979..ba9b118 100644
--- a/source/blender/imbuf/intern/cache.c
+++ b/source/blender/imbuf/intern/cache.c
@@ -40,13 +40,13 @@
 #include "imbuf.h"
 
 /* We use a two level cache here. A per-thread cache with limited number of
-   tiles. This can be accessed without locking and so is hoped to lead to most
-   tile access being lock-free. The global cache is shared between all threads
-   and requires slow locking to access, and contains all tiles.
-   
-   The per-thread cache should be big enough that one might hope to not fall
-   back to the global cache every pixel, but not to big to keep too many tiles
-   locked and using memory. */
+ * tiles. This can be accessed without locking and so is hoped to lead to most
+ * tile access being lock-free. The global cache is shared between all threads
+ * and requires slow locking to access, and contains all tiles.
+ *
+ * The per-thread cache should be big enough that one might hope to not fall
+ * back to the global cache every pixel, but not to big to keep too many tiles
+ * locked and using memory. */
 
 #define IB_THREAD_CACHE_SIZE	100
 
@@ -106,8 +106,8 @@ static int imb_global_tile_cmp(const void *a_p, const void *b_p)
 	const ImGlobalTile *a= a_p;
 	const ImGlobalTile *b= b_p;
 
-	if(a->ibuf == b->ibuf && a->tx == b->tx && a->ty == b->ty) return 0;
-	else if(a->ibuf < b->ibuf || a->tx < b->tx || a->ty < b->ty) return -1;
+	if (a->ibuf == b->ibuf && a->tx == b->tx && a->ty == b->ty) return 0;
+	else if (a->ibuf < b->ibuf || a->tx < b->tx || a->ty < b->ty) return -1;
 	else return 1;
 }
 
@@ -123,8 +123,8 @@ static int imb_thread_tile_cmp(const void *a_p, const void *b_p)
 	const ImThreadTile *a= a_p;
 	const ImThreadTile *b= b_p;
 
-	if(a->ibuf == b->ibuf && a->tx == b->tx && a->ty == b->ty) return 0;
-	else if(a->ibuf < b->ibuf || a->tx < b->tx || a->ty < b->ty) return -1;
+	if (a->ibuf == b->ibuf && a->tx == b->tx && a->ty == b->ty) return 0;
+	else if (a->ibuf < b->ibuf || a->tx < b->tx || a->ty < b->ty) return -1;
 	else return 1;
 }
 
@@ -164,9 +164,9 @@ void imb_tile_cache_tile_free(ImBuf *ibuf, int tx, int ty)
 	lookuptile.ty = ty;
 	gtile= BLI_ghash_lookup(GLOBAL_CACHE.tilehash, &lookuptile);
 
-	if(gtile) {
+	if (gtile) {
 		/* in case another thread is loading this */
-		while(gtile->loading)
+		while (gtile->loading)
 			;
 
 		BLI_ghash_remove(GLOBAL_CACHE.tilehash, gtile, NULL, NULL);
@@ -189,7 +189,7 @@ static void imb_thread_cache_init(ImThreadTileCache *cache)
 	cache->tilehash= BLI_ghash_new(imb_thread_tile_hash, imb_thread_tile_cmp, "imb_thread_cache_init gh");
 
 	/* pre-allocate all thread local tiles in unused list */
-	for(a=0; a<IB_THREAD_CACHE_SIZE; a++) {
+	for (a=0; a<IB_THREAD_CACHE_SIZE; a++) {
 		ttile= BLI_memarena_alloc(GLOBAL_CACHE.memarena, sizeof(ImThreadTile));
 		BLI_addtail(&cache->unused, ttile);
 	}
@@ -207,7 +207,7 @@ void imb_tile_cache_init(void)
 	BLI_mutex_init(&GLOBAL_CACHE.mutex);
 
 	/* initialize for one thread, for places that access textures
-	   outside of rendering (displace modifier, painting, ..) */
+	 * outside of rendering (displace modifier, painting, ..) */
 	IMB_tile_cache_params(0, 0);
 
 	GLOBAL_CACHE.initialized = 1;
@@ -218,17 +218,17 @@ void imb_tile_cache_exit(void)
 	ImGlobalTile *gtile;
 	int a;
 
-	if(GLOBAL_CACHE.initialized) {
-		for(gtile=GLOBAL_CACHE.tiles.first; gtile; gtile=gtile->next)
+	if (GLOBAL_CACHE.initialized) {
+		for (gtile=GLOBAL_CACHE.tiles.first; gtile; gtile=gtile->next)
 			imb_global_cache_tile_unload(gtile);
 
-		for(a=0; a<GLOBAL_CACHE.totthread; a++)
+		for (a=0; a<GLOBAL_CACHE.totthread; a++)
 			imb_thread_cache_exit(&GLOBAL_CACHE.thread_cache[a]);
 
-		if(GLOBAL_CACHE.memarena)
+		if (GLOBAL_CACHE.memarena)
 			BLI_memarena_free(GLOBAL_CACHE.memarena);
 
-		if(GLOBAL_CACHE.tilehash)
+		if (GLOBAL_CACHE.tilehash)
 			BLI_ghash_free(GLOBAL_CACHE.tilehash, NULL, NULL);
 
 		BLI_mutex_end(&GLOBAL_CACHE.mutex);
@@ -246,7 +246,7 @@ void IMB_tile_cache_params(int totthread, int maxmem)
 	totthread++;
 
 	/* lazy initialize cache */
-	if(GLOBAL_CACHE.totthread == totthread && GLOBAL_CACHE.maxmem == maxmem)
+	if (GLOBAL_CACHE.totthread == totthread && GLOBAL_CACHE.maxmem == maxmem)
 		return;
 
 	imb_tile_cache_exit();
@@ -261,7 +261,7 @@ void IMB_tile_cache_params(int totthread, int maxmem)
 	GLOBAL_CACHE.maxmem= maxmem*1024*1024;
 
 	GLOBAL_CACHE.totthread= totthread;
-	for(a=0; a<totthread; a++)
+	for (a=0; a<totthread; a++)
 		imb_thread_cache_init(&GLOBAL_CACHE.thread_cache[a]);
 
 	BLI_mutex_init(&GLOBAL_CACHE.mutex);
@@ -275,7 +275,7 @@ static ImGlobalTile *imb_global_cache_get_tile(ImBuf *ibuf, int tx, int ty, ImGl
 
 	BLI_mutex_lock(&GLOBAL_CACHE.mutex);
 
-	if(replacetile)
+	if (replacetile)
 		replacetile->refcount--;
 
 	/* find tile in global cache */
@@ -284,29 +284,29 @@ static ImGlobalTile *imb_global_cache_get_tile(ImBuf *ibuf, int tx, int ty, ImGl
 	lookuptile.ty = ty;
 	gtile= BLI_ghash_lookup(GLOBAL_CACHE.tilehash, &lookuptile);
 	
-	if(gtile) {
+	if (gtile) {
 		/* found tile. however it may be in the process of being loaded
-		   by another thread, in that case we do stupid busy loop waiting
-		   for the other thread to load the tile */
+		 * by another thread, in that case we do stupid busy loop waiting
+		 * for the other thread to load the tile */
 		gtile->refcount++;
 
 		BLI_mutex_unlock(&GLOBAL_CACHE.mutex);
 
-		while(gtile->loading)
+		while (gtile->loading)
 			;
 	}
 	else {
 		/* not found, let's load it from disk */
 
 		/* first check if we hit the memory limit */
-		if(GLOBAL_CACHE.maxmem && GLOBAL_CACHE.totmem > GLOBAL_CACHE.maxmem) {
+		if (GLOBAL_CACHE.maxmem && GLOBAL_CACHE.totmem > GLOBAL_CACHE.maxmem) {
 			/* find an existing tile to unload */
-			for(gtile=GLOBAL_CACHE.tiles.last; gtile; gtile=gtile->prev)
-				if(gtile->refcount == 0 && gtile->loading == 0)
+			for (gtile=GLOBAL_CACHE.tiles.last; gtile; gtile=gtile->prev)
+				if (gtile->refcount == 0 && gtile->loading == 0)
 					break;
 		}
 
-		if(gtile) {
+		if (gtile) {
 			/* found a tile to unload */
 			imb_global_cache_tile_unload(gtile);
 			BLI_ghash_remove(GLOBAL_CACHE.tilehash, gtile, NULL, NULL);
@@ -314,7 +314,7 @@ static ImGlobalTile *imb_global_cache_get_tile(ImBuf *ibuf, int tx, int ty, ImGl
 		}
 		else {
 			/* allocate a new tile or reuse unused */
-			if(GLOBAL_CACHE.unused.first) {
+			if (GLOBAL_CACHE.unused.first) {
 				gtile= GLOBAL_CACHE.unused.first;
 				BLI_remlink(&GLOBAL_CACHE.unused, gtile);
 			}
@@ -356,9 +356,9 @@ static unsigned int *imb_thread_cache_get_tile(ImThreadTileCache *cache, ImBuf *
 	int toffs= ibuf->xtiles*ty + tx;
 
 	/* test if it is already in our thread local cache */
-	if((ttile=cache->tiles.first)) {
+	if ((ttile=cache->tiles.first)) {
 		/* check last used tile before going to hash */
-		if(ttile->ibuf == ibuf && ttile->tx == tx && ttile->ty == ty)
+		if (ttile->ibuf == ibuf && ttile->tx == tx && ttile->ty == ty)
 			return ibuf->tiles[toffs];
 
 		/* find tile in hash */
@@ -366,7 +366,7 @@ static unsigned int *imb_thread_cache_get_tile(ImThreadTileCache *cache, ImBuf *
 		lookuptile.tx = tx;
 		lookuptile.ty = ty;
 
-		if((ttile=BLI_ghash_lookup(cache->tilehash, &lookuptile))) {
+		if ((ttile=BLI_ghash_lookup(cache->tilehash, &lookuptile))) {
 			BLI_remlink(&cache->tiles, ttile);
 			BLI_addhead(&cache->tiles, ttile);
 
@@ -375,7 +375,7 @@ static unsigned int *imb_thread_cache_get_tile(ImThreadTileCache *cache, ImBuf *
 	}
 
 	/* not found, have to do slow lookup in global cache */
-	if(cache->unused.first == NULL) {
+	if (cache->unused.first == NULL) {
 		ttile= cache->tiles.last;
 		replacetile= ttile->global;
 		BLI_remlink(&cache->tiles, ttile);
@@ -412,12 +412,12 @@ void IMB_tiles_to_rect(ImBuf *ibuf)
 	unsigned int *to, *from;
 	int a, tx, ty, y, w, h;
 
-	for(a=0; a<ibuf->miptot; a++) {
+	for (a=0; a<ibuf->miptot; a++) {
 		mipbuf= IMB_getmipmap(ibuf, a);
 
 		/* don't call imb_addrectImBuf, it frees all mipmaps */
-		if(!mipbuf->rect) {
-			if((mipbuf->rect = MEM_mapallocN(ibuf->x*ibuf->y*sizeof(unsigned int), "imb_addrectImBuf"))) {
+		if (!mipbuf->rect) {
+			if ((mipbuf->rect = MEM_mapallocN(ibuf->x*ibuf->y*sizeof(unsigned int), "imb_addrectImBuf"))) {
 				mipbuf->mall |= IB_rect;
 				mipbuf->flags |= IB_rect;
 			}
@@ -425,10 +425,10 @@ void IMB_tiles_to_rect(ImBuf *ibuf)
 				break;
 		}
 
-		for(ty=0; ty<mipbuf->ytiles; ty++) {
-			for(tx=0; tx<mipbuf->xtiles; tx++) {
+		for (ty=0; ty<mipbuf->ytiles; ty++) {
+			for (tx=0; tx<mipbuf->xtiles; tx++) {
 				/* acquire tile through cache, this assumes cache is initialized,
-				   which it is always now but it's a weak assumption ... */
+				 * which it is always now but it's a weak assumption ... */
 				gtile= imb_global_cache_get_tile(mipbuf, tx, ty, NULL);
 
 				/* setup pointers */
@@ -439,7 +439,7 @@ void IMB_tiles_to_rect(ImBuf *ibuf)
 				w= (tx == mipbuf->xtiles-1)? mipbuf->x - tx*mipbuf->tilex: mipbuf->tilex;
 				h= (ty == mipbuf->ytiles-1)? mipbuf->y - ty*mipbuf->tiley: mipbuf->tiley;
 
-				for(y=0; y<h; y++) {
+				for (y=0; y<h; y++) {
 					memcpy(to, from, sizeof(unsigned int)*w);
 					from += mipbuf->tilex;
 					to += mipbuf->x;
diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c
index af964bb..a7d168d 100644
--- a/source/blender/imbuf/intern/cineon/cineon_dpx.c
+++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c
@@ -72,7 +72,7 @@ static struct ImBuf *imb_load_dpx_cineon(unsigned char *mem, int use_cineon, int
 	int width, height, depth;
 	float *frow;
 
-	logImageSetVerbose((G.f & G_DEBUG) ? 1:0);
+	logImageSetVerbose((G.debug & G_DEBUG) ? 1:0);
 	
 	image = logImageOpenFromMem(mem, size, use_cineon);
 	
@@ -149,12 +149,12 @@ static int imb_save_dpx_cineon(ImBuf *ibuf, const char *filename, int use_cineon
 		return 0;
 	}
 	
-	logImageSetVerbose((G.f & G_DEBUG) ? 1: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) {
+	if (logImageSetByteConversion(logImage, &conversion)==0) {
 		printf("error setting args\n");
 	}
 
@@ -184,7 +184,7 @@ static int imb_save_dpx_cineon(ImBuf *ibuf, const char *filename, int use_cineon
 
 	MEM_freeN(line);
 	
-	if(is_alloc) {
+	if (is_alloc) {
 		MEM_freeN(fbuf);
 	}
 	
@@ -204,7 +204,7 @@ int imb_is_cineon(unsigned char *buf)
 
 ImBuf *imb_loadcineon(unsigned char *mem, size_t size, int flags)
 {
-	if(imb_is_cineon(mem))
+	if (imb_is_cineon(mem))
 		return imb_load_dpx_cineon(mem, 1, size, flags);
 	return NULL;
 }
@@ -221,7 +221,7 @@ int imb_is_dpx(unsigned char *buf)
 
 ImBuf *imb_loaddpx(unsigned char *mem, size_t size, int flags)
 {
-	if(imb_is_dpx(mem))
+	if (imb_is_dpx(mem))
 		return imb_load_dpx_cineon(mem, 0, size, flags);
 	return NULL;
 }
diff --git a/source/blender/imbuf/intern/cineon/cineonfile.h b/source/blender/imbuf/intern/cineon/cineonfile.h
index 896e0af..ea321c8 100644
--- a/source/blender/imbuf/intern/cineon/cineonfile.h
+++ b/source/blender/imbuf/intern/cineon/cineonfile.h
@@ -26,8 +26,8 @@
  *
  */
 
-#ifndef _CINEON_FILE_H_
-#define _CINEON_FILE_H_
+#ifndef __CINEONFILE_H__
+#define __CINEONFILE_H__
 
 #include "logImageCore.h"
 
@@ -130,4 +130,4 @@ typedef struct {
 }
 #endif
 
-#endif /* _CINEON_FILE_H_ */
+#endif /* __CINEONFILE_H__ */
diff --git a/source/blender/imbuf/intern/cineon/cineonlib.c b/source/blender/imbuf/intern/cineon/cineonlib.c
index b4da39a..ae9f8e0 100644
--- a/source/blender/imbuf/intern/cineon/cineonlib.c
+++ b/source/blender/imbuf/intern/cineon/cineonlib.c
@@ -38,6 +38,7 @@
 #include <string.h>			 /* memset */
 
 #include "BLI_utildefines.h"
+#include "BLI_fileops.h"
 
 #include "cin_debug_stuff.h"
 #include "logmemfile.h"
@@ -135,7 +136,8 @@ fillCineonImageInfo(CineonFile* cineon, CineonImageInformation* imageInfo) {
 	if (cineon->depth == 1) {
 		fillCineonChannelInfo(cineon, &imageInfo->channel[0], 0);
 
-	} else if (cineon->depth == 3) {
+	}
+	else if (cineon->depth == 3) {
 		fillCineonChannelInfo(cineon, &imageInfo->channel[0], 1);
 		fillCineonChannelInfo(cineon, &imageInfo->channel[1], 2);
 		fillCineonChannelInfo(cineon, &imageInfo->channel[2], 3);
@@ -214,7 +216,8 @@ dumpCineonFormatInfo(CineonFormatInformation* formatInfo) {
 	d_printf("Packing %d,", formatInfo->packing);
 	if (formatInfo->packing & 0x80) { 
 		d_printf(" multi pixel,");
-	} else {
+	}
+	else {
 		d_printf(" single pixel,");
 	}
 	switch (formatInfo->packing & 0x7F) {
@@ -230,13 +233,15 @@ dumpCineonFormatInfo(CineonFormatInformation* formatInfo) {
 	d_printf("Sign %d,", formatInfo->signage);
 	if (formatInfo->signage) { 
 		d_printf(" signed\n");
-	} else {
+	}
+	else {
 		d_printf(" unsigned\n");
 	}
 	d_printf("Sense %d,", formatInfo->signage);
 	if (formatInfo->signage) { 
 		d_printf(" negative\n");
-	} else {
+	}
+	else {
 		d_printf(" positive\n");
 	}
 	d_printf("End of line padding %ld\n", (intptr_t)ntohl(formatInfo->line_padding));
@@ -335,10 +340,11 @@ cineonGetRowBytes(CineonFile* cineon, unsigned short* row, int 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");
-	}
+		if (verbose) {
+			d_printf("Couldn't read line %d length %d\n", y, cineon->lineBufferLength * 4);
+			perror("cineonGetRowBytes");
+		}
+
 		return 1;
 	}
 
@@ -360,7 +366,7 @@ cineonGetRowBytes(CineonFile* cineon, unsigned short* row, int y) {
 
 	/* extract required pixels */
 	for (pixelIndex = 0; pixelIndex < numPixels; ++pixelIndex) {
-		if(cineon->params.doLogarithm)
+		if (cineon->params.doLogarithm)
 			row[pixelIndex] = cineon->lut10_16[cineon->pixelBuffer[pixelIndex]];
 		else
 			row[pixelIndex] = cineon->pixelBuffer[pixelIndex] << 6;
@@ -379,7 +385,7 @@ cineonSetRowBytes(CineonFile* cineon, const unsigned short* row, int y) {
 
 	/* put new pixels into pixelBuffer */
 	for (pixelIndex = 0; pixelIndex < numPixels; ++pixelIndex) {
-		if(cineon->params.doLogarithm)
+		if (cineon->params.doLogarithm)
 			cineon->pixelBuffer[pixelIndex] = cineon->lut16_16[row[pixelIndex]];
 		else
 			cineon->pixelBuffer[pixelIndex] = row[pixelIndex] >> 6;
@@ -522,7 +528,7 @@ cineonOpen(const char* filename) {
 	cineon->memcursor = 0;
 	cineon->membuffersize = 0;
 	
-	cineon->file = fopen(filename, "rb");
+	cineon->file = BLI_fopen(filename, "rb");
 	if (cineon->file == 0) {
 		if (verbose) d_printf("Failed to open file \"%s\".\n", filename);
 		cineonClose(cineon);
@@ -602,7 +608,8 @@ int cineonIsMemFileCineon(unsigned char *mem)
 	
 	if (num != ntohl(CINEON_FILE_MAGIC)) {
 		return 0;
-	} else return 1;
+	}
+	else return 1;
 }
 
 CineonFile* 
@@ -726,7 +733,7 @@ cineonCreate(const char* filename, int width, int height, int depth) {
 	cineon->lineBuffer = 0;
 	cineon->pixelBuffer = 0;
 
-	cineon->file = fopen(filename, "wb");
+	cineon->file = BLI_fopen(filename, "wb");
 	if (cineon->file == 0) {
 		if (verbose) d_printf("Couldn't open file %s\n", filename);
 		cineonClose(cineon);
@@ -761,7 +768,8 @@ cineonCreate(const char* filename, int width, int height, int depth) {
 	shortFilename = strrchr(filename, '/');
 	if (shortFilename == 0) {
 		shortFilename = filename;
-	} else {
+	}
+	else {
 		++shortFilename;
 	}
 
diff --git a/source/blender/imbuf/intern/cineon/cineonlib.h b/source/blender/imbuf/intern/cineon/cineonlib.h
index c24503e..48b5a00 100644
--- a/source/blender/imbuf/intern/cineon/cineonlib.h
+++ b/source/blender/imbuf/intern/cineon/cineonlib.h
@@ -23,8 +23,8 @@
  *
  */
 
-#ifndef _CINEON_LIB_H_
-#define _CINEON_LIB_H_
+#ifndef __CINEONLIB_H__
+#define __CINEONLIB_H__
 
 #include "logImageCore.h"
 
@@ -49,10 +49,6 @@ int cineonGetSize(const CineonFile* cineon, int* xsize, int* ysize, int* channel
 CineonFile* cineonCreate(const char* filename, int xsize, int ysize, int channels);
 int cineonIsMemFileCineon(unsigned char *mem);
 
-/* get / set header block NYI */
-int cineonGetHeader(CineonFile*, int*, void**);
-int cineonSetHeader(CineonFile*, int, void*);
-
 /* 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);
@@ -68,4 +64,4 @@ void cineonClose(CineonFile* cineon);
 }
 #endif
 
-#endif /* _CINEON_LIB_H_ */
+#endif /* __CINEONLIB_H__ */
diff --git a/source/blender/imbuf/intern/cineon/dpxfile.h b/source/blender/imbuf/intern/cineon/dpxfile.h
index abb11ec..dc8fc0b 100644
--- a/source/blender/imbuf/intern/cineon/dpxfile.h
+++ b/source/blender/imbuf/intern/cineon/dpxfile.h
@@ -26,8 +26,8 @@
  *
  */
 
-#ifndef _DPX_FILE_H_
-#define _DPX_FILE_H_
+#ifndef __DPXFILE_H__
+#define __DPXFILE_H__
 
 #include "logImageCore.h"
 
@@ -124,4 +124,4 @@ typedef struct {
 }
 #endif
 
-#endif /* _DPX_FILE_H_ */
+#endif /* __DPXFILE_H__ */
diff --git a/source/blender/imbuf/intern/cineon/dpxlib.c b/source/blender/imbuf/intern/cineon/dpxlib.c
index a63a2ea..c9b9901 100644
--- a/source/blender/imbuf/intern/cineon/dpxlib.c
+++ b/source/blender/imbuf/intern/cineon/dpxlib.c
@@ -38,6 +38,7 @@
 #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) {
@@ -141,7 +142,8 @@ fillDpxImageInfo(
 	if (dpx->depth == 1) {
 		fillDpxChannelInfo(dpx, &imageInfo->channel[0], 0);
 
-	} else if (dpx->depth == 3) {
+	}
+	else if (dpx->depth == 3) {
 		fillDpxChannelInfo(dpx, &imageInfo->channel[0], 50);
 	}
 }
@@ -269,7 +271,8 @@ dpxGetRowBytes(DpxFile* dpx, unsigned short* row, int y) {
 			dpx->pixelBuffer[pixelIndex+2] = t & 0x3ff;
 			pixelIndex += 3;
 		}
-	} else /* if (dpx->depth == 3) */ {
+	}
+	else /* if (dpx->depth == 3) */ {
 		for (longIndex = 0; longIndex < readLongs; ++longIndex) {
 			unsigned int t = ntohl(dpx->lineBuffer[longIndex]);
 			t = t >> 2;
@@ -285,7 +288,7 @@ dpxGetRowBytes(DpxFile* dpx, unsigned short* row, int y) {
 
 	/* extract required pixels */
 	for (pixelIndex = 0; pixelIndex < numPixels; ++pixelIndex) {
-		if(dpx->params.doLogarithm)
+		if (dpx->params.doLogarithm)
 			row[pixelIndex] = dpx->lut10_16[dpx->pixelBuffer[pixelIndex]];
 		else
 			row[pixelIndex] = dpx->pixelBuffer[pixelIndex] << 6;
@@ -328,7 +331,7 @@ dpxSetRowBytes(DpxFile* dpx, const unsigned short* row, int y) {
 
 	/* put new pixels into pixelBuffer */
 	for (pixelIndex = 0; pixelIndex < numPixels; ++pixelIndex) {
-		if(dpx->params.doLogarithm)
+		if (dpx->params.doLogarithm)
 			dpx->pixelBuffer[dpx->pixelBufferUsed + pixelIndex] = dpx->lut16_16[row[pixelIndex]];
 		else
 			dpx->pixelBuffer[dpx->pixelBufferUsed + pixelIndex] = row[pixelIndex] >> 6;
@@ -350,7 +353,8 @@ dpxSetRowBytes(DpxFile* dpx, const unsigned short* row, int y) {
 			dpx->lineBuffer[longIndex] = htonl(t);
 			pixelIndex += 3;
 		}
-	} else {
+	}
+	else {
 		for (longIndex = 0; longIndex < writeLongs; ++longIndex) {
 			unsigned int t = dpx->pixelBuffer[pixelIndex+2] << 2 |
 					(dpx->pixelBuffer[pixelIndex+1] << 12) |
@@ -401,7 +405,7 @@ intern_dpxOpen(int mode, const char* bytestuff, int bufsize) {
 
 	if (mode == LFREALFILE) {
 		filename = bytestuff;
-		dpx->file = fopen(filename, "rb");
+		dpx->file = BLI_fopen(filename, "rb");
 		if (dpx->file == 0) {	
 			if (verbose) d_printf("Failed to open file \"%s\".\n", filename);
 			dpxClose(dpx);
@@ -410,7 +414,8 @@ intern_dpxOpen(int mode, const char* bytestuff, int bufsize) {
 		dpx->membuffer = 0;
 		dpx->memcursor = 0;
 		dpx->membuffersize = 0;
-	} else if (mode == LFMEMFILE) {
+	}
+	else if (mode == LFMEMFILE) {
 		dpx->membuffer = (unsigned char *)bytestuff;
 		dpx->memcursor = (unsigned char *)bytestuff;
 		dpx->membuffersize = bufsize;
@@ -589,7 +594,7 @@ dpxCreate(const char* filename, int width, int height, int depth) {
 	dpx->lineBuffer = 0;
 	dpx->pixelBuffer = 0;
 
-	dpx->file = fopen(filename, "wb");
+	dpx->file = BLI_fopen(filename, "wb");
 	if (dpx->file == 0) {
 		if (verbose) d_printf("Couldn't open file %s\n", filename);
 		dpxClose(dpx);
@@ -624,7 +629,8 @@ dpxCreate(const char* filename, int width, int height, int depth) {
 	shortFilename = strrchr(filename, '/');
 	if (shortFilename == 0) {
 		shortFilename = filename;
-	} else {
+	}
+	else {
 		++shortFilename;
 	}
 	initDpxMainHeader(dpx, &header, shortFilename);
@@ -687,7 +693,7 @@ dpxDump(const char* filename) {
 	DpxMainHeader header;
 	FILE* file;
 
-	file = fopen(filename, "rb");
+	file = BLI_fopen(filename, "rb");
 	if (file == 0) {
 		d_printf("Failed to open file \"%s\".\n", filename);
 		return;
diff --git a/source/blender/imbuf/intern/cineon/dpxlib.h b/source/blender/imbuf/intern/cineon/dpxlib.h
index 1607de3..b09c699 100644
--- a/source/blender/imbuf/intern/cineon/dpxlib.h
+++ b/source/blender/imbuf/intern/cineon/dpxlib.h
@@ -22,8 +22,8 @@
  *
  */
 
-#ifndef _DPX_LIB_H_
-#define _DPX_LIB_H_
+#ifndef __DPXLIB_H__
+#define __DPXLIB_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -56,4 +56,4 @@ void dpxDump(const char* filename);
 }
 #endif
 
-#endif /* _DPX_LIB_H_ */
+#endif /* __DPXLIB_H__ */
diff --git a/source/blender/imbuf/intern/cineon/logImageCore.h b/source/blender/imbuf/intern/cineon/logImageCore.h
index cbc7cb9..c859262 100644
--- a/source/blender/imbuf/intern/cineon/logImageCore.h
+++ b/source/blender/imbuf/intern/cineon/logImageCore.h
@@ -27,8 +27,8 @@
  *
  */
 
-#ifndef _LOG_IMAGE_CORE_H_
-#define _LOG_IMAGE_CORE_H_
+#ifndef __LOGIMAGECORE_H__
+#define __LOGIMAGECORE_H__
 
 #include <stdio.h>
 #include "logImageLib.h"
@@ -119,4 +119,4 @@ R32 reverseR32(R32 value);
 }
 #endif
 
-#endif /* _LOG_IMAGE_CORE_H_ */
+#endif /* __LOGIMAGECORE_H__ */
diff --git a/source/blender/imbuf/intern/cineon/logImageLib.c b/source/blender/imbuf/intern/cineon/logImageLib.c
index 6c330fb..f97df00 100644
--- a/source/blender/imbuf/intern/cineon/logImageLib.c
+++ b/source/blender/imbuf/intern/cineon/logImageLib.c
@@ -36,6 +36,7 @@
 #include <netinet/in.h>	 /* htonl() */
 #endif
 #include <string.h>			 /* memset */
+#include "BLI_fileops.h"
 
 #define MIN_GAMMA 0.01
 #define MAX_GAMMA 99.9
@@ -44,43 +45,51 @@
 #define DEFAULT_WHITE_POINT 685
 
 void
-logImageSetVerbose(int verbosity) {
+logImageSetVerbose(int verbosity)
+{
 	cineonSetVerbose(verbosity);
 	dpxSetVerbose(verbosity);
 }
 
 LogImageFile*
-logImageOpen(const char* filename, int cineon) {
+logImageOpen(const char* filename, int cineon)
+{
 	if (cineon) {
 		return cineonOpen(filename);
-	} else {
+	}
+	else {
 		return dpxOpen(filename);
 	}
 	return 0;
 }
 
 LogImageFile*
-logImageOpenFromMem(unsigned char *buffer, unsigned int size, int cineon) {
+logImageOpenFromMem(unsigned char *buffer, unsigned int size, int cineon)
+{
 	if (cineon) {
 		return cineonOpenFromMem(buffer, size);
-	} else {
+	}
+	else {
 		return dpxOpenFromMem(buffer, size);
 	}
 	return 0;
 }
 
 LogImageFile*
-logImageCreate(const char* filename, int cineon, int width, int height, int depth) {
+logImageCreate(const char* filename, int cineon, int width, int height, int depth)
+{
 	if (cineon) {
 		return cineonCreate(filename, width, height, depth);
-	} else {
+	}
+	else {
 		return dpxCreate(filename, width, height, depth);
 	}
 	return 0;
 }
 
 int
-logImageGetSize(const LogImageFile* logImage, int* width, int* height, int* depth) {
+logImageGetSize(const LogImageFile* logImage, int* width, int* height, int* depth)
+{
 	*width = logImage->width;
 	*height = logImage->height;
 	*depth = logImage->depth;
@@ -88,7 +97,8 @@ logImageGetSize(const LogImageFile* logImage, int* width, int* height, int* dept
 }
 
 int
-logImageGetByteConversionDefaults(LogImageByteConversionParameters* params) {
+logImageGetByteConversionDefaults(LogImageByteConversionParameters* params)
+{
 	params->gamma = DEFAULT_GAMMA;
 	params->blackPoint = DEFAULT_BLACK_POINT;
 	params->whitePoint = DEFAULT_WHITE_POINT;
@@ -97,7 +107,8 @@ logImageGetByteConversionDefaults(LogImageByteConversionParameters* params) {
 }
 
 int
-logImageGetByteConversion(const LogImageFile* logImage, LogImageByteConversionParameters* params) {
+logImageGetByteConversion(const LogImageFile* logImage, LogImageByteConversionParameters* params)
+{
 	params->gamma = logImage->params.gamma;
 	params->blackPoint = logImage->params.blackPoint;
 	params->whitePoint = logImage->params.whitePoint;
@@ -106,7 +117,8 @@ logImageGetByteConversion(const LogImageFile* logImage, LogImageByteConversionPa
 }
 
 int
-logImageSetByteConversion(LogImageFile* logImage, const LogImageByteConversionParameters* params) {
+logImageSetByteConversion(LogImageFile* logImage, const LogImageByteConversionParameters* params)
+{
 	if ((params->gamma >= MIN_GAMMA) &&
 			(params->gamma <= MAX_GAMMA) &&
 			(params->blackPoint >= 0) &&
@@ -123,26 +135,30 @@ logImageSetByteConversion(LogImageFile* logImage, const LogImageByteConversionPa
 }
 
 int
-logImageGetRowBytes(LogImageFile* logImage, unsigned short* row, int y) {
+logImageGetRowBytes(LogImageFile* logImage, unsigned short* row, int y)
+{
 	return logImage->getRow(logImage, row, y);
 }
 
 int
-logImageSetRowBytes(LogImageFile* logImage, const unsigned short* row, int y) {
+logImageSetRowBytes(LogImageFile* logImage, const unsigned short* row, int y)
+{
 	return logImage->setRow(logImage, row, y);
 }
 
 void
-logImageClose(LogImageFile* logImage) {
+logImageClose(LogImageFile* logImage)
+{
 	logImage->close(logImage);
 }
 
 void
-logImageDump(const char* filename) {
+logImageDump(const char* filename)
+{
 
 	U32 magic;
 
-	FILE* foo = fopen(filename, "rb");
+	FILE* foo = BLI_fopen(filename, "rb");
 	if (foo == 0) {
 		return;
 	}
@@ -158,7 +174,8 @@ logImageDump(const char* filename) {
 #if 0
 		cineonDump(filename);
 #endif
-	} else if (magic == ntohl(DPX_FILE_MAGIC)) {
+	}
+	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 9f6d3ad..669e25d 100644
--- a/source/blender/imbuf/intern/cineon/logImageLib.h
+++ b/source/blender/imbuf/intern/cineon/logImageLib.h
@@ -22,8 +22,8 @@
  *
  */
 
-#ifndef _LOG_IMAGE_LIB_H_
-#define _LOG_IMAGE_LIB_H_
+#ifndef __LOGIMAGELIB_H__
+#define __LOGIMAGELIB_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -62,10 +62,6 @@ 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);
 
-/* get / set header block NYI */
-int logImageGetHeader(LogImageFile*, int*, void**);
-int logImageSetHeader(LogImageFile*, int, void*);
-
 /* byte conversion routines for mapping logImage (usually) 10 bit values to 8 bit */
 /* see Kodak docs for details... */
 
@@ -87,4 +83,4 @@ void logImageDump(const char* filename);
 }
 #endif
 
-#endif /* _LOG_IMAGE_LIB_H_ */
+#endif /* __LOGIMAGELIB_H__ */
diff --git a/source/blender/imbuf/intern/cineon/logmemfile.c b/source/blender/imbuf/intern/cineon/logmemfile.c
index d3a3277..3db4241 100644
--- a/source/blender/imbuf/intern/cineon/logmemfile.c
+++ b/source/blender/imbuf/intern/cineon/logmemfile.c
@@ -39,10 +39,12 @@ int logimage_fseek(void* logfile, intptr_t offsett, int origin)
 		if (origin==SEEK_SET) {
 			if (offset > file->membuffersize) return 1;
 			file->memcursor = file->membuffer + offset;
-		} else if (origin==SEEK_END) {
+		}
+		else if (origin==SEEK_END) {
 			if (offset > file->membuffersize) return 1;
 			file->memcursor = (file->membuffer + file->membuffersize) - offset;
-		} else if (origin==SEEK_CUR) {
+		}
+		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;
@@ -68,8 +70,8 @@ int logimage_fread(void *buffer, unsigned int size, unsigned int count, void *lo
 	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*). */
+		/* 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++) {
diff --git a/source/blender/imbuf/intern/cineon/logmemfile.h b/source/blender/imbuf/intern/cineon/logmemfile.h
index 36f9502..2611463 100644
--- a/source/blender/imbuf/intern/cineon/logmemfile.h
+++ b/source/blender/imbuf/intern/cineon/logmemfile.h
@@ -22,11 +22,11 @@
  *
  */
  
-#ifndef _LOGMEMFILE_H
-#define _LOGMEMFILE_H
+#ifndef __LOGMEMFILE_H__
+#define __LOGMEMFILE_H__
 
 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 */
+#endif /* __LOGMEMFILE_H__ */
diff --git a/source/blender/imbuf/intern/dds/BlockDXT.cpp b/source/blender/imbuf/intern/dds/BlockDXT.cpp
index 2ea2552..f5e9e53 100644
--- a/source/blender/imbuf/intern/dds/BlockDXT.cpp
+++ b/source/blender/imbuf/intern/dds/BlockDXT.cpp
@@ -90,7 +90,7 @@ uint BlockDXT1::evaluatePalette(Color32 color_array[4]) const
 //	c.u |= (c.u >> 6) & 0x000300;
 //	color_array[1].u = c.u;
 	
-	if( col0.u > col1.u ) {
+	if ( col0.u > col1.u ) {
 		// Four-color block: derive the other two colors.
 		color_array[2].r = (2 * color_array[0].r + color_array[1].r) / 3;
 		color_array[2].g = (2 * color_array[0].g + color_array[1].g) / 3;
@@ -135,27 +135,27 @@ uint BlockDXT1::evaluatePaletteNV5x(Color32 color_array[4]) const
 	color_array[1].b = (3 * col1.b * 22) / 8;
 	color_array[1].a = 0xFF;
 	
-    int gdiff = color_array[1].g - color_array[0].g;
+	int gdiff = color_array[1].g - color_array[0].g;
 
-	if( col0.u > col1.u ) {
+	if ( col0.u > col1.u ) {
 		// Four-color block: derive the other two colors.
-        color_array[2].r = ((2 * col0.r + col1.r) * 22) / 8;
-        color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 80) / 256;
-        color_array[2].b = ((2 * col0.b + col1.b) * 22) / 8;
+		color_array[2].r = ((2 * col0.r + col1.r) * 22) / 8;
+		color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 80) / 256;
+		color_array[2].b = ((2 * col0.b + col1.b) * 22) / 8;
 		color_array[2].a = 0xFF;
 		
-        color_array[3].r = ((2 * col1.r + col0.r) * 22) / 8;
-        color_array[3].g = (256 * color_array[1].g - gdiff / 4 + 128 - gdiff * 80) / 256;
-        color_array[3].b = ((2 * col1.b + col0.b) * 22) / 8;
+		color_array[3].r = ((2 * col1.r + col0.r) * 22) / 8;
+		color_array[3].g = (256 * color_array[1].g - gdiff / 4 + 128 - gdiff * 80) / 256;
+		color_array[3].b = ((2 * col1.b + col0.b) * 22) / 8;
 		color_array[3].a = 0xFF;
 
 		return 4;
 	}
 	else {
 		// Three-color block: derive the other color.
-        color_array[2].r = ((col0.r + col1.r) * 33) / 8;
-        color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 128) / 256;
-        color_array[2].b = ((col0.b + col1.b) * 33) / 8;
+		color_array[2].r = ((col0.r + col1.r) * 33) / 8;
+		color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 128) / 256;
+		color_array[2].b = ((col0.b + col1.b) * 33) / 8;
 		color_array[2].a = 0xFF;
 		
 		// Set all components to 0 to match DXT specs.
@@ -227,8 +227,8 @@ void BlockDXT1::decodeBlock(ColorBlock * block) const
 	evaluatePalette(color_array);
 	
 	// Write color block.
-	for( uint j = 0; j < 4; j++ ) {
-		for( uint i = 0; i < 4; i++ ) {
+	for ( uint j = 0; j < 4; j++ ) {
+		for ( uint i = 0; i < 4; i++ ) {
 			uint idx = (row[j] >> (2 * i)) & 3;
 			block->color(i, j) = color_array[idx];
 		}
@@ -242,8 +242,8 @@ void BlockDXT1::decodeBlockNV5x(ColorBlock * block) const
 	evaluatePaletteNV5x(color_array);
 
 	// Write color block.
-	for( uint j = 0; j < 4; j++ ) {
-		for( uint i = 0; i < 4; i++ ) {
+	for ( uint j = 0; j < 4; j++ ) {
+		for ( uint i = 0; i < 4; i++ ) {
 			uint idx = (row[j] >> (2 * i)) & 3;
 			block->color(i, j) = color_array[idx];
 		}
@@ -253,7 +253,7 @@ void BlockDXT1::decodeBlockNV5x(ColorBlock * block) const
 void BlockDXT1::setIndices(int * idx)
 {
 	indices = 0;
-	for(uint i = 0; i < 16; i++) {
+	for (uint i = 0; i < 16; i++) {
 		indices |= (idx[i] & 3) << (2 * i);
 	}
 }
@@ -423,7 +423,7 @@ void AlphaBlockDXT5::decodeBlock(ColorBlock * block) const
 	uint8 index_array[16];
 	indices(index_array);
 	
-	for(uint i = 0; i < 16; i++) {
+	for (uint i = 0; i < 16; i++) {
 		block->color(i).a = alpha_array[index_array[i]];
 	}
 }
@@ -496,7 +496,7 @@ void BlockATI1::decodeBlock(ColorBlock * block) const
 	uint8 index_array[16];
 	alpha.indices(index_array);
 	
-	for(uint i = 0; i < 16; i++) {
+	for (uint i = 0; i < 16; i++) {
 		Color32 & c = block->color(i);
 		c.b = c.g = c.r = alpha_array[index_array[i]];
 		c.a = 255;
@@ -525,7 +525,7 @@ void BlockATI2::decodeBlock(ColorBlock * block) const
 	x.evaluatePalette(alpha_array);
 	x.indices(index_array);
 	
-	for(uint i = 0; i < 16; i++) {
+	for (uint i = 0; i < 16; i++) {
 		Color32 & c = block->color(i);
 		c.r = alpha_array[index_array[i]];
 	}
@@ -533,7 +533,7 @@ void BlockATI2::decodeBlock(ColorBlock * block) const
 	y.evaluatePalette(alpha_array);
 	y.indices(index_array);
 	
-	for(uint i = 0; i < 16; i++) {
+	for (uint i = 0; i < 16; i++) {
 		Color32 & c = block->color(i);
 		c.g = alpha_array[index_array[i]];
 		c.b = 0;
@@ -587,8 +587,8 @@ void BlockCTX1::decodeBlock(ColorBlock * block) const
 	evaluatePalette(color_array);
 	
 	// Write color block.
-	for( uint j = 0; j < 4; j++ ) {
-		for( uint i = 0; i < 4; i++ ) {
+	for ( uint j = 0; j < 4; j++ ) {
+		for ( uint i = 0; i < 4; i++ ) {
 			uint idx = (row[j] >> (2 * i)) & 3;
 			block->color(i, j) = color_array[idx];
 		}
@@ -598,7 +598,7 @@ void BlockCTX1::decodeBlock(ColorBlock * block) const
 void BlockCTX1::setIndices(int * idx)
 {
 	indices = 0;
-	for(uint i = 0; i < 16; i++) {
+	for (uint i = 0; i < 16; i++) {
 		indices |= (idx[i] & 3) << (2 * i);
 	}
 }
diff --git a/source/blender/imbuf/intern/dds/BlockDXT.h b/source/blender/imbuf/intern/dds/BlockDXT.h
index cdf839c..c6712f4 100644
--- a/source/blender/imbuf/intern/dds/BlockDXT.h
+++ b/source/blender/imbuf/intern/dds/BlockDXT.h
@@ -55,8 +55,8 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 // OTHER DEALINGS IN THE SOFTWARE.
 
-#ifndef _DDS_BLOCKDXT_H
-#define _DDS_BLOCKDXT_H
+#ifndef __BLOCKDXT_H__
+#define __BLOCKDXT_H__
 
 #include <Common.h>
 #include <Color.h>
@@ -271,4 +271,4 @@ void mem_read(Stream & mem, BlockATI1 & block);
 void mem_read(Stream & mem, BlockATI2 & block);
 void mem_read(Stream & mem, BlockCTX1 & block);
 
-#endif // _DDS_BLOCKDXT_H
+#endif // __BLOCKDXT_H__
diff --git a/source/blender/imbuf/intern/dds/Color.h b/source/blender/imbuf/intern/dds/Color.h
index b23a5a3..17de0a5 100644
--- a/source/blender/imbuf/intern/dds/Color.h
+++ b/source/blender/imbuf/intern/dds/Color.h
@@ -34,8 +34,8 @@
 
 // This code is in the public domain -- castanyo at yahoo.es
 
-#ifndef _DDS_COLOR_H
-#define _DDS_COLOR_H
+#ifndef __COLOR_H__
+#define __COLOR_H__
 
 /// 32 bit color stored as BGRA.
 class Color32
@@ -96,4 +96,4 @@ public:
 	};
 };
 
-#endif // _DDS_COLOR_H
+#endif // __COLOR_H__
diff --git a/source/blender/imbuf/intern/dds/ColorBlock.cpp b/source/blender/imbuf/intern/dds/ColorBlock.cpp
index b0c4d0a..42ef799 100644
--- a/source/blender/imbuf/intern/dds/ColorBlock.cpp
+++ b/source/blender/imbuf/intern/dds/ColorBlock.cpp
@@ -59,7 +59,7 @@ ColorBlock::ColorBlock()
 /// Init the color block from an array of colors.
 ColorBlock::ColorBlock(const uint * linearImage)
 {
-	for(uint i = 0; i < 16; i++) {
+	for (uint i = 0; i < 16; i++) {
 		color(i) = Color32(linearImage[i]);
 	}
 }
@@ -67,7 +67,7 @@ ColorBlock::ColorBlock(const uint * linearImage)
 /// Init the color block with the contents of the given block.
 ColorBlock::ColorBlock(const ColorBlock & block)
 {
-	for(uint i = 0; i < 16; i++) {
+	for (uint i = 0; i < 16; i++) {
 		color(i) = block.color(i);
 	}
 }
@@ -81,7 +81,7 @@ ColorBlock::ColorBlock(const Image * img, uint x, uint y)
 
 void ColorBlock::init(const Image * img, uint x, uint y)
 {
-    init(img->width(), img->height(), (const uint *)img->pixels(), x, y);
+	init(img->width(), img->height(), (const uint *)img->pixels(), x, y);
 }
 
 void ColorBlock::init(uint w, uint h, const uint * data, uint x, uint y)
@@ -89,34 +89,34 @@ void ColorBlock::init(uint w, uint h, const uint * data, uint x, uint y)
 	const uint bw = min(w - x, 4U);
 	const uint bh = min(h - y, 4U);
 
-    // Blocks that are smaller than 4x4 are handled by repeating the pixels.
-    // @@ Thats only correct when block size is 1, 2 or 4, but not with 3. :(
-    // @@ Ideally we should zero the weights of the pixels out of range.
+	// Blocks that are smaller than 4x4 are handled by repeating the pixels.
+	// @@ Thats only correct when block size is 1, 2 or 4, but not with 3. :(
+	// @@ Ideally we should zero the weights of the pixels out of range.
 
-    for (uint i = 0; i < 4; i++)
-    {
-        const int by = i % bh;
+	for (uint i = 0; i < 4; i++)
+	{
+		const int by = i % bh;
 
-        for (uint e = 0; e < 4; e++)
-        {
-            const int bx = e % bw;
-            const uint idx = (y + by) * w + x + bx;
+		for (uint e = 0; e < 4; e++)
+		{
+			const int bx = e % bw;
+			const uint idx = (y + by) * w + x + bx;
 
-            color(e, i).u = data[idx];
-        }
-    }
+			color(e, i).u = data[idx];
+		}
+	}
 }
 
 void ColorBlock::init(uint w, uint h, const float * data, uint x, uint y)
 {
-    const uint bw = min(w - x, 4U);
-    const uint bh = min(h - y, 4U);
+	const uint bw = min(w - x, 4U);
+	const uint bh = min(h - y, 4U);
 
 	// Blocks that are smaller than 4x4 are handled by repeating the pixels.
 	// @@ Thats only correct when block size is 1, 2 or 4, but not with 3. :(
-    // @@ Ideally we should zero the weights of the pixels out of range.
+	// @@ Ideally we should zero the weights of the pixels out of range.
 
-    uint srcPlane = w * h;
+	uint srcPlane = w * h;
 
 	for (uint i = 0; i < 4; i++)
 	{
@@ -125,13 +125,13 @@ void ColorBlock::init(uint w, uint h, const float * data, uint x, uint y)
 		for (uint e = 0; e < 4; e++)
 		{
 			const uint bx = e % bw;
-            const uint idx = ((y + by) * w + x + bx);
+			const uint idx = ((y + by) * w + x + bx);
 			
 			Color32 & c = color(e, i);
-            c.r = uint8(255 * clamp(data[idx + 0 * srcPlane], 0.0f, 1.0f)); // @@ Is this the right way to quantize floats to bytes?
-            c.g = uint8(255 * clamp(data[idx + 1 * srcPlane], 0.0f, 1.0f));
-            c.b = uint8(255 * clamp(data[idx + 2 * srcPlane], 0.0f, 1.0f));
-            c.a = uint8(255 * clamp(data[idx + 3 * srcPlane], 0.0f, 1.0f));
+			c.r = uint8(255 * clamp(data[idx + 0 * srcPlane], 0.0f, 1.0f)); // @@ Is this the right way to quantize floats to bytes?
+			c.g = uint8(255 * clamp(data[idx + 1 * srcPlane], 0.0f, 1.0f));
+			c.b = uint8(255 * clamp(data[idx + 2 * srcPlane], 0.0f, 1.0f));
+			c.a = uint8(255 * clamp(data[idx + 3 * srcPlane], 0.0f, 1.0f));
 		}
 	}
 }
@@ -181,7 +181,7 @@ bool ColorBlock::isSingleColorNoAlpha() const
 {
 	Color32 c;
 	int i;
-	for(i = 0; i < 16; i++)
+	for (i = 0; i < 16; i++)
 	{
         if (m_color[i].a != 0) c = m_color[i];
 	}
@@ -189,7 +189,7 @@ bool ColorBlock::isSingleColorNoAlpha() const
 	Color32 mask(0xFF, 0xFF, 0xFF, 0x00);
 	uint u = c.u & mask.u;
 
-	for(; i < 16; i++)
+	for (; i < 16; i++)
 	{
 		if (u != (m_color[i].u & mask.u))
 		{
@@ -207,16 +207,16 @@ bool ColorBlock::isSingleColorNoAlpha() const
 	uint count = 0;
 
 	// @@ This does not have to be o(n^2)
-	for(int i = 0; i < 16; i++)
+	for (int i = 0; i < 16; i++)
 	{
 		bool unique = true;
-		for(int j = 0; j < i; j++) {
-			if( m_color[i] != m_color[j] ) {
+		for (int j = 0; j < i; j++) {
+			if ( m_color[i] != m_color[j] ) {
 				unique = false;
 			}
 		}
 		
-		if( unique ) {
+		if ( unique ) {
 			count++;
 		}
 	}
@@ -230,7 +230,7 @@ Color32 ColorBlock::averageColor() const
 	uint r, g, b, a;
 	r = g = b = a = 0;
 
-	for(uint i = 0; i < 16; i++) {
+	for (uint i = 0; i < 16; i++) {
 		r += m_color[i].r;
 		g += m_color[i].g;
 		b += m_color[i].b;
@@ -258,10 +258,10 @@ void ColorBlock::diameterRange(Color32 * start, Color32 * end) const
 	Color32 c0, c1;
 	uint best_dist = 0;
 	
-	for(int i = 0; i < 16; i++) {
+	for (int i = 0; i < 16; i++) {
 		for (int j = i+1; j < 16; j++) {
 			uint dist = colorDistance(m_color[i], m_color[j]);
-			if( dist > best_dist ) {
+			if ( dist > best_dist ) {
 				best_dist = dist;
 				c0 = m_color[i];
 				c1 = m_color[j];
@@ -281,7 +281,7 @@ void ColorBlock::luminanceRange(Color32 * start, Color32 * end) const
 	
 	maxLuminance = minLuminance = colorLuminance(m_color[0]);
 	
-	for(uint i = 1; i < 16; i++)
+	for (uint i = 1; i < 16; i++)
 	{
 		uint luminance = colorLuminance(m_color[i]);
 		
@@ -305,7 +305,7 @@ void ColorBlock::boundsRange(Color32 * start, Color32 * end) const
 	Color32 minColor(255, 255, 255);
 	Color32 maxColor(0, 0, 0);
 
-	for(uint i = 0; i < 16; i++)
+	for (uint i = 0; i < 16; i++)
 	{
 		if (m_color[i].r < minColor.r) { minColor.r = m_color[i].r; }
 		if (m_color[i].g < minColor.g) { minColor.g = m_color[i].g; }
@@ -339,7 +339,7 @@ void ColorBlock::boundsRangeAlpha(Color32 * start, Color32 * end) const
 	Color32 minColor(255, 255, 255, 255);
 	Color32 maxColor(0, 0, 0, 0);
 
-	for(uint i = 0; i < 16; i++)
+	for (uint i = 0; i < 16; i++)
 	{
 		if (m_color[i].r < minColor.r) { minColor.r = m_color[i].r; }
 		if (m_color[i].g < minColor.g) { minColor.g = m_color[i].g; }
@@ -377,14 +377,14 @@ void ColorBlock::boundsRangeAlpha(Color32 * start, Color32 * end) const
 void ColorBlock::sortColorsByAbsoluteValue()
 {
 	// Dummy selection sort.
-	for( uint a = 0; a < 16; a++ ) {
+	for ( uint a = 0; a < 16; a++ ) {
 		uint max = a;
 		Color16 cmax(m_color[a]);
 		
-		for( uint b = a+1; b < 16; b++ ) {
+		for ( uint b = a+1; b < 16; b++ ) {
 			Color16 cb(m_color[b]);
 			
-			if( cb.u > cmax.u ) {
+			if ( cb.u > cmax.u ) {
 				max = b;
 				cmax = cb;
 			}
@@ -404,16 +404,16 @@ void ColorBlock::computeRange(Vector3::Arg axis, Color32 * start, Color32 * end)
 	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++)
+	for (uint i = 1; i < 16; i++)
 	{
 		const Vector3 vec(m_color[i].r, m_color[i].g, m_color[i].b);
 		
 		float val = dot(vec, axis);
-		if( val < min ) {
+		if ( val < min ) {
 			mini = i;
 			min = val;
 		}
-		else if( val > max ) {
+		else if ( val > max ) {
 			maxi = i;
 			max = val;
 		}
@@ -429,16 +429,16 @@ void ColorBlock::sortColors(const Vector3 & axis)
 {
 	float luma_array[16];
 	
-	for(uint i = 0; i < 16; i++) {
+	for (uint i = 0; i < 16; i++) {
 		const Vector3 vec(m_color[i].r, m_color[i].g, m_color[i].b);
 		luma_array[i] = dot(vec, axis);
 	}
 	
 	// Dummy selection sort.
-	for( uint a = 0; a < 16; a++ ) {
+	for ( uint a = 0; a < 16; a++ ) {
 		uint min = a;
-		for( uint b = a+1; b < 16; b++ ) {
-			if( luma_array[b] < luma_array[min] ) {
+		for ( uint b = a+1; b < 16; b++ ) {
+			if ( luma_array[b] < luma_array[min] ) {
 				min = b;
 			}
 		}
@@ -454,7 +454,7 @@ float ColorBlock::volume() const
 	Box bounds;
 	bounds.clearBounds();
 	
-	for(int i = 0; i < 16; i++) {
+	for (int i = 0; i < 16; i++) {
 		const Vector3 point(m_color[i].r, m_color[i].g, m_color[i].b);
 		bounds.addPointToBounds(point);
 	}
diff --git a/source/blender/imbuf/intern/dds/ColorBlock.h b/source/blender/imbuf/intern/dds/ColorBlock.h
index eb483f5..e72b625 100644
--- a/source/blender/imbuf/intern/dds/ColorBlock.h
+++ b/source/blender/imbuf/intern/dds/ColorBlock.h
@@ -34,8 +34,8 @@
 
 // This code is in the public domain -- castanyo at yahoo.es
 
-#ifndef _DDS_COLORBLOCK_H
-#define _DDS_COLORBLOCK_H
+#ifndef __COLORBLOCK_H__
+#define __COLORBLOCK_H__
 
 #include <Color.h>
 #include <Image.h>
@@ -104,4 +104,4 @@ inline Color32 & ColorBlock::color(uint x, uint y)
 	return m_color[y * 4 + x];
 }
 
-#endif // _DDS_COLORBLOCK_H
+#endif // __COLORBLOCK_H__
diff --git a/source/blender/imbuf/intern/dds/Common.h b/source/blender/imbuf/intern/dds/Common.h
index 8c307e3..4e3e3e0 100644
--- a/source/blender/imbuf/intern/dds/Common.h
+++ b/source/blender/imbuf/intern/dds/Common.h
@@ -25,8 +25,8 @@
  */
 
 
-#ifndef _DDS_COMMON_H
-#define _DDS_COMMON_H
+#ifndef __COMMON_H__
+#define __COMMON_H__
 
 #ifndef min
 #define min(a,b) ((a) <= (b) ? (a) : (b))
diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
index f98f37e..e287465 100644
--- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
+++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
@@ -803,7 +803,7 @@ void DDSHeader::swapBytes()
 	this->depth = POSH_LittleU32(this->depth);
 	this->mipmapcount = POSH_LittleU32(this->mipmapcount);
 	
-	for(int i = 0; i < 11; i++) {
+	for (int i = 0; i < 11; i++) {
 		this->reserved[i] = POSH_LittleU32(this->reserved[i]);
 	}
 
@@ -899,7 +899,7 @@ bool DirectDrawSurface::isValid() const
 	}
 	
 	const uint required = (DDSD_WIDTH|DDSD_HEIGHT/*|DDSD_CAPS|DDSD_PIXELFORMAT*/);
-	if( (header.flags & required) != required ) {
+	if ( (header.flags & required) != required ) {
 		return false;
 	}
 	
@@ -909,7 +909,7 @@ bool DirectDrawSurface::isValid() const
 
 	/* in some files DDSCAPS_TEXTURE is missing: silently ignore */
 	/*
-	if( !(header.caps.caps1 & DDSCAPS_TEXTURE) ) {
+	if ( !(header.caps.caps1 & DDSCAPS_TEXTURE) ) {
 		return false;
 	}
 	*/
diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.h b/source/blender/imbuf/intern/dds/DirectDrawSurface.h
index 8b8388c..23c8bbf 100644
--- a/source/blender/imbuf/intern/dds/DirectDrawSurface.h
+++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.h
@@ -55,8 +55,8 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 // OTHER DEALINGS IN THE SOFTWARE.
 
-#ifndef _DDS_DIRECTDRAWSURFACE_H
-#define _DDS_DIRECTDRAWSURFACE_H
+#ifndef __DIRECTDRAWSURFACE_H__
+#define __DIRECTDRAWSURFACE_H__
 
 #include <Common.h>
 #include <Stream.h>
@@ -198,4 +198,4 @@ void mem_read(Stream & mem, DDSCaps & caps);
 void mem_read(Stream & mem, DDSHeader & header);
 void mem_read(Stream & mem, DDSHeader10 & header);
 
-#endif // _DDS_DIRECTDRAWSURFACE_H
+#endif // __DIRECTDRAWSURFACE_H__
diff --git a/source/blender/imbuf/intern/dds/Image.h b/source/blender/imbuf/intern/dds/Image.h
index e932e11..5dcf301 100644
--- a/source/blender/imbuf/intern/dds/Image.h
+++ b/source/blender/imbuf/intern/dds/Image.h
@@ -34,8 +34,8 @@
 
 // This code is in the public domain -- castanyo at yahoo.es
 
-#ifndef _DDS_IMAGE_H
-#define _DDS_IMAGE_H
+#ifndef __IMAGE_H__
+#define __IMAGE_H__
 
 #include <Common.h>
 #include <Color.h>
@@ -55,12 +55,12 @@ public:
 	~Image();
 	
 	void allocate(uint w, uint h);
-	/*
+#if 0
 	bool load(const char * name);
 	
 	void wrap(void * data, uint w, uint h);
 	void unwrap();
-	*/
+#endif
 	
 	uint width() const;
 	uint height() const;
@@ -101,4 +101,4 @@ inline Color32 & Image::pixel(uint x, uint y)
 	return pixel(y * width() + x);
 }
 
-#endif // _DDS_IMAGE_H
+#endif // __IMAGE_H__
diff --git a/source/blender/imbuf/intern/dds/PixelFormat.h b/source/blender/imbuf/intern/dds/PixelFormat.h
index c76c799..3c5cb34 100644
--- a/source/blender/imbuf/intern/dds/PixelFormat.h
+++ b/source/blender/imbuf/intern/dds/PixelFormat.h
@@ -55,15 +55,15 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 // OTHER DEALINGS IN THE SOFTWARE.
 
-#ifndef _DDS_PIXELFORMAT_H
-#define _DDS_PIXELFORMAT_H
+#ifndef __PIXELFORMAT_H__
+#define __PIXELFORMAT_H__
 
 #include <Common.h>
 
 	namespace PixelFormat
 	{
 
-		// Convert component @a c having @a inbits to the returned value having @a outbits.
+		// Convert component \a c having \a inbits to the returned value having \a outbits.
 		inline uint convert(uint c, uint inbits, uint outbits)
 		{
 			if (inbits == 0)
diff --git a/source/blender/imbuf/intern/dds/Stream.h b/source/blender/imbuf/intern/dds/Stream.h
index 1c789ac..9f513ca 100644
--- a/source/blender/imbuf/intern/dds/Stream.h
+++ b/source/blender/imbuf/intern/dds/Stream.h
@@ -27,8 +27,8 @@
 
 /* simple memory stream functions with buffer overflow check */
 
-#ifndef _STREAM_H
-#define _STREAM_H
+#ifndef __STREAM_H__
+#define __STREAM_H__
 
 struct Stream
 {
@@ -45,5 +45,5 @@ unsigned int mem_read(Stream & mem, unsigned short & i);
 unsigned int mem_read(Stream & mem, unsigned char & i);
 unsigned int mem_read(Stream & mem, unsigned char *i, unsigned int cnt);
 
-#endif // _STREAM_H
+#endif // __STREAM_H__
 
diff --git a/source/blender/imbuf/intern/dds/dds_api.cpp b/source/blender/imbuf/intern/dds/dds_api.cpp
index b7a3d0e..071d94c 100644
--- a/source/blender/imbuf/intern/dds/dds_api.cpp
+++ b/source/blender/imbuf/intern/dds/dds_api.cpp
@@ -81,13 +81,13 @@ struct ImBuf *imb_load_dds(unsigned char *mem, size_t size, int flags)
 	Color32 pixel;
 	Color32 *pixels = 0;
 
-	if(!imb_is_a_dds(mem))
+	if (!imb_is_a_dds(mem))
 		return (0);
 
 	/* check if DDS is valid and supported */
 	if (!dds.isValid()) {
 		/* no need to print error here, just testing if it is a DDS */
-		if(flags & IB_test)
+		if (flags & IB_test)
 			return (0);
 
 		printf("DDS: not valid; header follows\n");
diff --git a/source/blender/imbuf/intern/dds/dds_api.h b/source/blender/imbuf/intern/dds/dds_api.h
index e477a4b..5892578 100644
--- a/source/blender/imbuf/intern/dds/dds_api.h
+++ b/source/blender/imbuf/intern/dds/dds_api.h
@@ -25,8 +25,8 @@
  */
 
 
-#ifndef _DDS_API_H
-#define _DDS_API_H
+#ifndef __DDS_API_H__
+#define __DDS_API_H__
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c
index d9ec3bf..8f8c631 100644
--- a/source/blender/imbuf/intern/divers.c
+++ b/source/blender/imbuf/intern/divers.c
@@ -118,7 +118,7 @@ DitherContext *create_dither_context(int w, float factor)
 	di->error_buf= MEM_callocN(4*(w+1)*sizeof(int), "dithering error");
 	di->e= di->error_buf;
 
-	for(i=0; i<4; ++i)
+	for (i=0; i<4; ++i)
 		di->v[i]= di->v0[i]= di->v1[i]= 1024.0f*(BLI_frand()-0.5f);
 
 	return di;
@@ -134,7 +134,7 @@ static void dither_finish_row(DitherContext *di)
 {
 	int i;
 
-	for(i=0; i<4; i++)
+	for (i=0; i<4; i++)
 		di->v[i]= di->v0[i]= di->v1[i] = 0;
 
 	di->e= di->error_buf;
@@ -200,114 +200,114 @@ void IMB_buffer_byte_from_float(uchar *rect_to, const float *rect_from,
 	BLI_assert(profile_from != IB_PROFILE_NONE);
 
 	BLI_init_srgb_conversion();
-	if(dither)
+	if (dither)
 		di= create_dither_context(width, dither);
 
-	for(y = 0; y < height; y++) {
-		if(channels_from == 1) {
+	for (y = 0; y < height; y++) {
+		if (channels_from == 1) {
 		/* single channel input */
 			const float *from = rect_from + stride_from*y;
 			uchar *to = rect_to + stride_to*y*4;
 
-			for(x = 0; x < width; x++, from++, to+=4)
+			for (x = 0; x < width; x++, from++, to+=4)
 				to[0] = to[1] = to[2] = to[3] = FTOCHAR(from[0]);
 		}
-		else if(channels_from == 3) {
+		else if (channels_from == 3) {
 		/* RGB input */
 			const float *from = rect_from + stride_from*y*3;
 			uchar *to = rect_to + stride_to*y*4;
 
-			if(profile_to == profile_from) {
+			if (profile_to == profile_from) {
 				/* no color space conversion */
-				for(x = 0; x < width; x++, from+=3, to+=4) {
+				for (x = 0; x < width; x++, from+=3, to+=4) {
 					rgb_float_to_uchar(to, from);
 					to[3] = 255;
 				}
 			}
-			else if(profile_to == IB_PROFILE_SRGB) {
+			else if (profile_to == IB_PROFILE_SRGB) {
 				/* convert from linear to sRGB */
-				for(x = 0; x < width; x++, from+=3, to+=4) {
+				for (x = 0; x < width; x++, from+=3, to+=4) {
 					linearrgb_to_srgb_v3_v3(tmp, from);
 					rgb_float_to_uchar(to, tmp);
 					to[3] = 255;
 				}
 			}
-			else if(profile_to == IB_PROFILE_LINEAR_RGB) {
+			else if (profile_to == IB_PROFILE_LINEAR_RGB) {
 				/* convert from sRGB to linear */
-				for(x = 0; x < width; x++, from+=3, to+=4) {
+				for (x = 0; x < width; x++, from+=3, to+=4) {
 					srgb_to_linearrgb_v3_v3(tmp, from);
 					rgb_float_to_uchar(to, tmp);
 					to[3] = 255;
 				}
 			}
 		}
-		else if(channels_from == 4) {
+		else if (channels_from == 4) {
 		/* RGBA input */
 			const float *from = rect_from + stride_from*y*4;
 			uchar *to = rect_to + stride_to*y*4;
 
-			if(profile_to == profile_from) {
+			if (profile_to == profile_from) {
 				/* no color space conversion */
-				if(dither) {
-					for(x = 0; x < width; x++, from+=4, to+=4)
+				if (dither) {
+					for (x = 0; x < width; x++, from+=4, to+=4)
 						float_to_byte_dither_v4(to, from, di);
 				}
 				else {
-					for(x = 0; x < width; x++, from+=4, to+=4)
+					for (x = 0; x < width; x++, from+=4, to+=4)
 						rgba_float_to_uchar(to, from);
 				}
 			}
-			else if(profile_to == IB_PROFILE_SRGB) {
+			else if (profile_to == IB_PROFILE_SRGB) {
 				/* convert from linear to sRGB */
 				unsigned short us[4];
 
-				if(dither && predivide) {
-					for(x = 0; x < width; x++, from+=4, to+=4) {
+				if (dither && predivide) {
+					for (x = 0; x < width; x++, from+=4, to+=4) {
 						linearrgb_to_srgb_ushort4_predivide(us, from);
 						ushort_to_byte_dither_v4(to, us, di);
 					}
 				}
-				else if(dither) {
-					for(x = 0; x < width; x++, from+=4, to+=4) {
+				else if (dither) {
+					for (x = 0; x < width; x++, from+=4, to+=4) {
 						linearrgb_to_srgb_ushort4(us, from);
 						ushort_to_byte_dither_v4(to, us, di);
 					}
 				}
-				else if(predivide) {
-					for(x = 0; x < width; x++, from+=4, to+=4) {
+				else if (predivide) {
+					for (x = 0; x < width; x++, from+=4, to+=4) {
 						linearrgb_to_srgb_ushort4_predivide(us, from);
 						ushort_to_byte_v4(to, us);
 					}
 				}
 				else {
-					for(x = 0; x < width; x++, from+=4, to+=4) {
+					for (x = 0; x < width; x++, from+=4, to+=4) {
 						linearrgb_to_srgb_ushort4(us, from);
 						ushort_to_byte_v4(to, us);
 					}
 				}
 			}
-			else if(profile_to == IB_PROFILE_LINEAR_RGB) {
+			else if (profile_to == IB_PROFILE_LINEAR_RGB) {
 				/* convert from sRGB to linear */
-				if(dither && predivide) {
-					for(x = 0; x < width; x++, from+=4, to+=4) {
+				if (dither && predivide) {
+					for (x = 0; x < width; x++, from+=4, to+=4) {
 						srgb_to_linearrgb_predivide_v4(tmp, from);
 						float_to_byte_dither_v4(to, tmp, di);
 					}
 				}
-				else if(dither) {
-					for(x = 0; x < width; x++, from+=4, to+=4) {
+				else if (dither) {
+					for (x = 0; x < width; x++, from+=4, to+=4) {
 						srgb_to_linearrgb_v4(tmp, from);
 						float_to_byte_dither_v4(to, tmp, di);
 					}
 				}
-				else if(predivide) {
-					for(x = 0; x < width; x++, from+=4, to+=4) {
+				else if (predivide) {
+					for (x = 0; x < width; x++, from+=4, to+=4) {
 						srgb_to_linearrgb_predivide_v4(tmp, from);
 						rgba_float_to_uchar(to, tmp);
 					}
 				}
 				else {
-					for(x = 0; x < width; x++, from+=4, to+=4) {
+					for (x = 0; x < width; x++, from+=4, to+=4) {
 						srgb_to_linearrgb_v4(tmp, from);
 						rgba_float_to_uchar(to, tmp);
 					}
@@ -315,11 +315,11 @@ void IMB_buffer_byte_from_float(uchar *rect_to, const float *rect_from,
 			}
 		}
 
-		if(dither)
+		if (dither)
 			dither_finish_row(di);
 	}
 
-	if(dither)
+	if (dither)
 		clear_dither_context(di);
 }
 
@@ -338,38 +338,38 @@ void IMB_buffer_float_from_byte(float *rect_to, const uchar *rect_from,
 	BLI_init_srgb_conversion();
 
 	/* RGBA input */
-	for(y = 0; y < height; y++) {
+	for (y = 0; y < height; y++) {
 		const uchar *from = rect_from + stride_from*y*4;
 		float *to = rect_to + stride_to*y*4;
 
-		if(profile_to == profile_from) {
+		if (profile_to == profile_from) {
 			/* no color space conversion */
-			for(x = 0; x < width; x++, from+=4, to+=4)
+			for (x = 0; x < width; x++, from+=4, to+=4)
 				rgba_uchar_to_float(to, from);
 		}
-		else if(profile_to == IB_PROFILE_LINEAR_RGB) {
+		else if (profile_to == IB_PROFILE_LINEAR_RGB) {
 			/* convert sRGB to linear */
-			if(predivide) {
-				for(x = 0; x < width; x++, from+=4, to+=4) {
+			if (predivide) {
+				for (x = 0; x < width; x++, from+=4, to+=4) {
 					srgb_to_linearrgb_uchar4_predivide(to, from);
 				}
 			}
 			else {
-				for(x = 0; x < width; x++, from+=4, to+=4) {
+				for (x = 0; x < width; x++, from+=4, to+=4) {
 					srgb_to_linearrgb_uchar4(to, from);
 				}
 			}
 		}
-		else if(profile_to == IB_PROFILE_SRGB) {
+		else if (profile_to == IB_PROFILE_SRGB) {
 			/* convert linear to sRGB */
-			if(predivide) {
-				for(x = 0; x < width; x++, from+=4, to+=4) {
+			if (predivide) {
+				for (x = 0; x < width; x++, from+=4, to+=4) {
 					rgba_uchar_to_float(tmp, from);
 					linearrgb_to_srgb_predivide_v4(to, tmp);
 				}
 			}
 			else {
-				for(x = 0; x < width; x++, from+=4, to+=4) {
+				for (x = 0; x < width; x++, from+=4, to+=4) {
 					rgba_uchar_to_float(tmp, from);
 					linearrgb_to_srgb_v4(to, tmp);
 				}
@@ -389,74 +389,74 @@ void IMB_buffer_float_from_float(float *rect_to, const float *rect_from,
 	BLI_assert(profile_to != IB_PROFILE_NONE);
 	BLI_assert(profile_from != IB_PROFILE_NONE);
 
-	if(channels_from==1) {
+	if (channels_from==1) {
 		/* single channel input */
-		for(y = 0; y < height; y++) {
+		for (y = 0; y < height; y++) {
 			const float *from = rect_from + stride_from*y;
 			float *to = rect_to + stride_to*y*4;
 
-			for(x = 0; x < width; x++, from++, to+=4)
+			for (x = 0; x < width; x++, from++, to+=4)
 				to[0] = to[1] = to[2] = to[3] = from[0];
 		}
 	}
-	else if(channels_from == 3) {
+	else if (channels_from == 3) {
 		/* RGB input */
-		for(y = 0; y < height; y++) {
+		for (y = 0; y < height; y++) {
 			const float *from = rect_from + stride_from*y*3;
 			float *to = rect_to + stride_to*y*4;
 
-			if(profile_to == profile_from) {
+			if (profile_to == profile_from) {
 				/* no color space conversion */
-				for(x = 0; x < width; x++, from+=3, to+=4) {
+				for (x = 0; x < width; x++, from+=3, to+=4) {
 					copy_v3_v3(to, from);
 					to[3] = 1.0f;
 				}
 			}
-			else if(profile_to == IB_PROFILE_LINEAR_RGB) {
+			else if (profile_to == IB_PROFILE_LINEAR_RGB) {
 				/* convert from sRGB to linear */
-				for(x = 0; x < width; x++, from+=3, to+=4) {
+				for (x = 0; x < width; x++, from+=3, to+=4) {
 					srgb_to_linearrgb_v3_v3(to, from);
 					to[3] = 1.0f;
 				}
 			}
-			else if(profile_to == IB_PROFILE_SRGB) {
+			else if (profile_to == IB_PROFILE_SRGB) {
 				/* convert from linear to sRGB */
-				for(x = 0; x < width; x++, from+=3, to+=4) {
+				for (x = 0; x < width; x++, from+=3, to+=4) {
 					linearrgb_to_srgb_v3_v3(to, from);
 					to[3] = 1.0f;
 				}
 			}
 		}
 	}
-	else if(channels_from == 4) {
+	else if (channels_from == 4) {
 		/* RGBA input */
-		for(y = 0; y < height; y++) {
+		for (y = 0; y < height; y++) {
 			const float *from = rect_from + stride_from*y*4;
 			float *to = rect_to + stride_to*y*4;
 
-			if(profile_to == profile_from) {
+			if (profile_to == profile_from) {
 				/* same profile, copy */
 				memcpy(to, from, sizeof(float)*4*width);
 			}
-			else if(profile_to == IB_PROFILE_LINEAR_RGB) {
+			else if (profile_to == IB_PROFILE_LINEAR_RGB) {
 				/* convert to sRGB to linear */
-				if(predivide) {
-					for(x = 0; x < width; x++, from+=4, to+=4)
+				if (predivide) {
+					for (x = 0; x < width; x++, from+=4, to+=4)
 						srgb_to_linearrgb_predivide_v4(to, from);
 				}
 				else {
-					for(x = 0; x < width; x++, from+=4, to+=4)
+					for (x = 0; x < width; x++, from+=4, to+=4)
 						srgb_to_linearrgb_v4(to, from);
 				}
 			}
-			else if(profile_to == IB_PROFILE_SRGB) {
+			else if (profile_to == IB_PROFILE_SRGB) {
 				/* convert from linear to sRGB */
-				if(predivide) {
-					for(x = 0; x < width; x++, from+=4, to+=4)
+				if (predivide) {
+					for (x = 0; x < width; x++, from+=4, to+=4)
 						linearrgb_to_srgb_predivide_v4(to, from);
 				}
 				else {
-					for(x = 0; x < width; x++, from+=4, to+=4)
+					for (x = 0; x < width; x++, from+=4, to+=4)
 						linearrgb_to_srgb_v4(to, from);
 				}
 			}
@@ -477,42 +477,42 @@ void IMB_buffer_byte_from_byte(uchar *rect_to, const uchar *rect_from,
 	BLI_assert(profile_from != IB_PROFILE_NONE);
 
 	/* always RGBA input */
-	for(y = 0; y < height; y++) {
+	for (y = 0; y < height; y++) {
 		const uchar *from = rect_from + stride_from*y*4;
 		uchar *to = rect_to + stride_to*y*4;
 
-		if(profile_to == profile_from) {
+		if (profile_to == profile_from) {
 			/* same profile, copy */
 			memcpy(to, from, sizeof(uchar)*4*width);
 		}
-		else if(profile_to == IB_PROFILE_LINEAR_RGB) {
+		else if (profile_to == IB_PROFILE_LINEAR_RGB) {
 			/* convert to sRGB to linear */
-			if(predivide) {
-				for(x = 0; x < width; x++, from+=4, to+=4) {
+			if (predivide) {
+				for (x = 0; x < width; x++, from+=4, to+=4) {
 					rgba_uchar_to_float(tmp, from);
 					srgb_to_linearrgb_predivide_v4(tmp, tmp);
 					rgba_float_to_uchar(to, tmp);
 				}
 			}
 			else {
-				for(x = 0; x < width; x++, from+=4, to+=4) {
+				for (x = 0; x < width; x++, from+=4, to+=4) {
 					rgba_uchar_to_float(tmp, from);
 					srgb_to_linearrgb_v4(tmp, tmp);
 					rgba_float_to_uchar(to, tmp);
 				}
 			}
 		}
-		else if(profile_to == IB_PROFILE_SRGB) {
+		else if (profile_to == IB_PROFILE_SRGB) {
 			/* convert from linear to sRGB */
-			if(predivide) {
-				for(x = 0; x < width; x++, from+=4, to+=4) {
+			if (predivide) {
+				for (x = 0; x < width; x++, from+=4, to+=4) {
 					rgba_uchar_to_float(tmp, from);
 					linearrgb_to_srgb_predivide_v4(tmp, tmp);
 					rgba_float_to_uchar(to, tmp);
 				}
 			}
 			else {
-				for(x = 0; x < width; x++, from+=4, to+=4) {
+				for (x = 0; x < width; x++, from+=4, to+=4) {
 					rgba_uchar_to_float(tmp, from);
 					linearrgb_to_srgb_v4(tmp, tmp);
 					rgba_float_to_uchar(to, tmp);
@@ -530,17 +530,17 @@ void IMB_rect_from_float(ImBuf *ibuf)
 	int profile_from;
 
 	/* verify we have a float buffer */
-	if(ibuf->rect_float==NULL)
+	if (ibuf->rect_float==NULL)
 		return;
 
 	/* create byte rect if it didn't exist yet */
-	if(ibuf->rect==NULL)
+	if (ibuf->rect==NULL)
 		imb_addrectImBuf(ibuf);
 
 	/* determine profiles */
-	if(ibuf->profile == IB_PROFILE_LINEAR_RGB)
+	if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
 		profile_from = IB_PROFILE_LINEAR_RGB;
-	else if(ELEM(ibuf->profile, IB_PROFILE_SRGB, IB_PROFILE_NONE))
+	else if (ELEM(ibuf->profile, IB_PROFILE_SRGB, IB_PROFILE_NONE))
 		profile_from = IB_PROFILE_SRGB;
 	else
 		BLI_assert(0);
@@ -563,17 +563,17 @@ void IMB_partial_rect_from_float(ImBuf *ibuf, float *buffer, int x, int y, int w
 	int profile_from;
 
 	/* verify we have a float buffer */
-	if(ibuf->rect_float==NULL || buffer==NULL)
+	if (ibuf->rect_float==NULL || buffer==NULL)
 		return;
 
 	/* create byte rect if it didn't exist yet */
-	if(ibuf->rect==NULL)
+	if (ibuf->rect==NULL)
 		imb_addrectImBuf(ibuf);
 
 	/* determine profiles */
-	if(ibuf->profile == IB_PROFILE_LINEAR_RGB)
+	if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
 		profile_from = IB_PROFILE_LINEAR_RGB;
-	else if(ELEM(ibuf->profile, IB_PROFILE_SRGB, IB_PROFILE_NONE))
+	else if (ELEM(ibuf->profile, IB_PROFILE_SRGB, IB_PROFILE_NONE))
 		profile_from = IB_PROFILE_SRGB;
 	else
 		BLI_assert(0);
@@ -600,15 +600,15 @@ void IMB_float_from_rect(ImBuf *ibuf)
 	int profile_from;
 
 	/* verify if we byte and float buffers */
-	if(ibuf->rect==NULL)
+	if (ibuf->rect==NULL)
 		return;
 
-	if(ibuf->rect_float==NULL)
-		if(imb_addrectfloatImBuf(ibuf) == 0)
+	if (ibuf->rect_float==NULL)
+		if (imb_addrectfloatImBuf(ibuf) == 0)
 			return;
 	
 	/* determine profiles */
-	if(ibuf->profile == IB_PROFILE_NONE)
+	if (ibuf->profile == IB_PROFILE_NONE)
 		profile_from = IB_PROFILE_LINEAR_RGB;
 	else
 		profile_from = IB_PROFILE_SRGB;
@@ -624,7 +624,7 @@ void IMB_float_from_rect_simple(ImBuf *ibuf)
 {
 	int predivide= (ibuf->flags & IB_cm_predivide);
 
-	if(ibuf->rect_float==NULL)
+	if (ibuf->rect_float==NULL)
 		imb_addrectfloatImBuf(ibuf);
 
 	IMB_buffer_float_from_byte(ibuf->rect_float, (uchar*)ibuf->rect,
@@ -637,22 +637,22 @@ void IMB_convert_profile(ImBuf *ibuf, int profile)
 	int predivide= (ibuf->flags & IB_cm_predivide);
 	int profile_from, profile_to;
 
-	if(ibuf->profile == profile)
+	if (ibuf->profile == profile)
 		return;
 
 	/* determine profiles */
-	if(ibuf->profile == IB_PROFILE_LINEAR_RGB)
+	if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
 		profile_from = IB_PROFILE_LINEAR_RGB;
-	else if(ELEM(ibuf->profile, IB_PROFILE_SRGB, IB_PROFILE_NONE))
+	else if (ELEM(ibuf->profile, IB_PROFILE_SRGB, IB_PROFILE_NONE))
 		profile_from = IB_PROFILE_SRGB;
 	else {
 		BLI_assert(0);
 		profile_from = IB_PROFILE_SRGB; /* dummy, should never happen */
 	}
 
-	if(profile == IB_PROFILE_LINEAR_RGB)
+	if (profile == IB_PROFILE_LINEAR_RGB)
 		profile_to = IB_PROFILE_LINEAR_RGB;
-	else if(ELEM(profile, IB_PROFILE_SRGB, IB_PROFILE_NONE))
+	else if (ELEM(profile, IB_PROFILE_SRGB, IB_PROFILE_NONE))
 		profile_to = IB_PROFILE_SRGB;
 	else {
 		BLI_assert(0);
@@ -660,13 +660,13 @@ void IMB_convert_profile(ImBuf *ibuf, int profile)
 	}
 	
 	/* do conversion */
-	if(ibuf->rect_float) {
+	if (ibuf->rect_float) {
 		IMB_buffer_float_from_float(ibuf->rect_float, ibuf->rect_float,
 			4, profile_to, profile_from, predivide,
 			ibuf->x, ibuf->y, ibuf->x, ibuf->x);
 	}
 
-	if(ibuf->rect) {
+	if (ibuf->rect) {
 		IMB_buffer_byte_from_byte((uchar*)ibuf->rect, (uchar*)ibuf->rect,
 			profile_to, profile_from, predivide,
 			ibuf->x, ibuf->y, ibuf->x, ibuf->x);
@@ -684,21 +684,21 @@ float *IMB_float_profile_ensure(ImBuf *ibuf, int profile, int *alloc)
 	int profile_from, profile_to;
 
 	/* determine profiles */
-	if(ibuf->profile == IB_PROFILE_NONE)
+	if (ibuf->profile == IB_PROFILE_NONE)
 		profile_from = IB_PROFILE_LINEAR_RGB;
 	else
 		profile_from = IB_PROFILE_SRGB;
 
-	if(profile == IB_PROFILE_NONE)
+	if (profile == IB_PROFILE_NONE)
 		profile_to = IB_PROFILE_LINEAR_RGB;
 	else
 		profile_to = IB_PROFILE_SRGB;
 	
-	if(profile_from == profile_to) {
+	if (profile_from == profile_to) {
 		/* simple case, just allocate the buffer and return */
 		*alloc= 0;
 
-		if(ibuf->rect_float == NULL)
+		if (ibuf->rect_float == NULL)
 			IMB_float_from_rect(ibuf);
 
 		return ibuf->rect_float;
@@ -708,7 +708,7 @@ float *IMB_float_profile_ensure(ImBuf *ibuf, int profile, int *alloc)
 		float *fbuf= MEM_mallocN(ibuf->x * ibuf->y * sizeof(float) * 4, "IMB_float_profile_ensure");
 		*alloc= 1;
 
-		if(ibuf->rect_float == NULL) {
+		if (ibuf->rect_float == NULL) {
 			IMB_buffer_float_from_byte(fbuf, (uchar*)ibuf->rect,
 				profile_to, profile_from, predivide,
 				ibuf->x, ibuf->y, ibuf->x, ibuf->x);
@@ -732,20 +732,48 @@ void IMB_color_to_bw(ImBuf *ibuf)
 	uchar *rct= (uchar*)ibuf->rect;
 	int i;
 
-	if(rctf) {
-		for(i = ibuf->x * ibuf->y; i > 0; i--, rctf+=4)
+	if (rctf) {
+		for (i = ibuf->x * ibuf->y; i > 0; i--, rctf+=4)
 			rctf[0]= rctf[1]= rctf[2]= rgb_to_grayscale(rctf);
 	}
 
-	if(rct) {
-		for(i = ibuf->x * ibuf->y; i > 0; i--, rct+=4)
+	if (rct) {
+		for (i = ibuf->x * ibuf->y; i > 0; i--, rct+=4)
 			rct[0]= rct[1]= rct[2]= rgb_to_grayscale_byte(rct);
 	}
 }
 
-void IMB_buffer_float_clamp(float *buf, int width, int height){
+void IMB_buffer_float_clamp(float *buf, int width, int height)
+{
 	int i, total = width*height*4;
-	for(i = 0; i < total; i++){
+	for (i = 0; i < total; i++) {
 		buf[i] = MIN2(1.0, buf[i]);
 	}
 }
+
+/**************************** alter saturation *****************************/
+
+void IMB_saturation(ImBuf * ibuf, float sat)
+{
+	int i;
+	unsigned char *rct= (unsigned char *)ibuf->rect;
+	float *rctf= ibuf->rect_float;
+	float hsv[3];
+
+	if (rct) {
+		float rgb[3];
+		for (i = ibuf->x * ibuf->y; i > 0; i--, rct+=4) {
+			rgb_uchar_to_float(rgb, rct);
+			rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
+			hsv_to_rgb(hsv[0], hsv[1] * sat, hsv[2], rgb, rgb+1, rgb+2);
+			rgb_float_to_uchar(rct, rgb);
+		}
+	}
+
+	if (rctf) {
+		for (i = ibuf->x * ibuf->y; i > 0; i--, rctf+=4) {
+			rgb_to_hsv(rctf[0], rctf[1], rctf[2], hsv, hsv+1, hsv+2);
+			hsv_to_rgb(hsv[0], hsv[1] * sat, hsv[2], rctf, rctf+1, rctf+2);
+		}
+	}
+}
diff --git a/source/blender/imbuf/intern/filetype.c b/source/blender/imbuf/intern/filetype.c
index c03736f..59c1016 100644
--- a/source/blender/imbuf/intern/filetype.c
+++ b/source/blender/imbuf/intern/filetype.c
@@ -77,7 +77,7 @@ ImFileType IMB_FILE_TYPES[]= {
 	{NULL, NULL, imb_is_a_hdr, imb_ftype_default, imb_loadhdr, imb_savehdr, NULL, IM_FTYPE_FLOAT, RADHDR},
 #endif
 #ifdef WITH_OPENEXR
-	{NULL, NULL, imb_is_a_openexr, imb_ftype_default, imb_load_openexr, imb_save_openexr, NULL, IM_FTYPE_FLOAT, OPENEXR},
+	{imb_initopenexr, NULL, imb_is_a_openexr, imb_ftype_default, imb_load_openexr, imb_save_openexr, NULL, IM_FTYPE_FLOAT, OPENEXR},
 #endif
 #ifdef WITH_OPENJPEG
 	{NULL, NULL, imb_is_a_jp2, imb_ftype_default, imb_jp2_decode, imb_savejp2, NULL, IM_FTYPE_FLOAT, JP2},
@@ -94,8 +94,8 @@ void imb_filetypes_init(void)
 {
 	ImFileType *type;
 
-	for(type=IMB_FILE_TYPES; type->is_a; type++)
-		if(type->init)
+	for (type=IMB_FILE_TYPES; type->is_a; type++)
+		if (type->init)
 			type->init();
 }
 
@@ -103,8 +103,8 @@ void imb_filetypes_exit(void)
 {
 	ImFileType *type;
 
-	for(type=IMB_FILE_TYPES; type->is_a; type++)
-		if(type->exit)
+	for (type=IMB_FILE_TYPES; type->is_a; type++)
+		if (type->exit)
 			type->exit();
 }
 
diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c
index 29da797..0e6567d 100644
--- a/source/blender/imbuf/intern/filter.c
+++ b/source/blender/imbuf/intern/filter.c
@@ -54,10 +54,10 @@ static void filtrow(unsigned char *point, int x)
 {
 	unsigned int c1,c2,c3,error;
 
-	if (x>1){
+	if (x>1) {
 		c1 = c2 = *point;
 		error = 2;
-		for(x--;x>0;x--){
+		for (x--;x>0;x--) {
 			c3 = point[4];
 			c1 += (c2<<1) + c3 + error;
 			error = c1 & 3;
@@ -74,9 +74,9 @@ static void filtrowf(float *point, int x)
 {
 	float c1,c2,c3;
 	
-	if (x>1){
+	if (x>1) {
 		c1 = c2 = *point;
-		for(x--;x>0;x--){
+		for (x--;x>0;x--) {
 			c3 = point[4];
 			c1 += (c2 * 2) + c3;
 			*point = 0.25f*c1;
@@ -95,11 +95,11 @@ static void filtcolum(unsigned char *point, int y, int skip)
 	unsigned int c1,c2,c3,error;
 	unsigned char *point2;
 
-	if (y>1){
+	if (y>1) {
 		c1 = c2 = *point;
 		point2 = point;
 		error = 2;
-		for(y--;y>0;y--){
+		for (y--;y>0;y--) {
 			point2 += skip;
 			c3 = *point2;
 			c1 += (c2<<1) + c3 +error;
@@ -117,10 +117,10 @@ static void filtcolumf(float *point, int y, int skip)
 {
 	float c1,c2,c3, *point2;
 	
-	if (y>1){
+	if (y>1) {
 		c1 = c2 = *point;
 		point2 = point;
-		for(y--;y>0;y--){
+		for (y--;y>0;y--) {
 			point2 += skip;
 			c3 = *point2;
 			c1 += (c2 * 2) + c3;
@@ -146,7 +146,7 @@ void IMB_filtery(struct ImBuf *ibuf)
 	y = ibuf->y;
 	skip = x<<2;
 
-	for (;x>0;x--){
+	for (;x>0;x--) {
 		if (point) {
 			if (ibuf->planes > 24) filtcolum(point,y,skip);
 			point++;
@@ -184,7 +184,7 @@ void imb_filterx(struct ImBuf *ibuf)
 	y = ibuf->y;
 	skip = (x<<2) - 3;
 
-	for (;y>0;y--){
+	for (;y>0;y--) {
 		if (point) {
 			if (ibuf->planes > 24) filtrow(point,x);
 			point++;
@@ -216,7 +216,7 @@ void IMB_filterN(ImBuf *out, ImBuf *in)
 	
 	rowlen= in->x;
 	
-	for(y=0; y<in->y; y++) {
+	for (y=0; y<in->y; y++) {
 		/* setup rows */
 		row2= (char*)(in->rect + y*rowlen);
 		row1= (y == 0)? row2: row2 - 4*rowlen;
@@ -224,8 +224,8 @@ void IMB_filterN(ImBuf *out, ImBuf *in)
 		
 		cp= (char *)(out->rect + y*rowlen);
 		
-		for(x=0; x<rowlen; x++) {
-			if(x == 0) {
+		for (x=0; x<rowlen; x++) {
+			if (x == 0) {
 				r11 = row1;
 				r21 = row1;
 				r31 = row1;
@@ -236,7 +236,7 @@ void IMB_filterN(ImBuf *out, ImBuf *in)
 				r31 = row1-4;
 			}
 
-			if(x == rowlen-1) {
+			if (x == rowlen-1) {
 				r13 = row1;
 				r23 = row1;
 				r33 = row1;
@@ -273,26 +273,27 @@ void IMB_mask_filter_extend(char *mask, int width, int height)
 	/* make a copy, to prevent flooding */
 	temprect= MEM_dupallocN(mask);
 
-	for(y=1; y<=height; y++) {
+	for (y=1; y<=height; y++) {
 		/* setup rows */
 		row1= (char *)(temprect + (y-2)*rowlen);
 		row2= row1 + rowlen;
 		row3= row2 + rowlen;
-		if(y==1)
+		if (y==1)
 			row1= row2;
-		else if(y==height)
+		else if (y==height)
 			row3= row2;
 
-		for(x=0; x<rowlen; x++) {
+		for (x=0; x<rowlen; x++) {
 			if (mask[((y-1)*rowlen)+x]==0) {
 				if (*row1 || *row2 || *row3 || *(row1+1) || *(row3+1) ) {
 					mask[((y-1)*rowlen)+x] = FILTER_MASK_MARGIN;
-				} else if((x!=rowlen-1) && (*(row1+2) || *(row2+2) || *(row3+2)) ) {
+				}
+				else if ((x!=rowlen-1) && (*(row1+2) || *(row2+2) || *(row3+2)) ) {
 					mask[((y-1)*rowlen)+x] = FILTER_MASK_MARGIN;
 				}
 			}
 
-			if(x!=0) {
+			if (x!=0) {
 				row1++; row2++; row3++;
 			}
 		}
@@ -305,18 +306,19 @@ void IMB_mask_clear(ImBuf *ibuf, char *mask, int val)
 {
 	int x,y;
 	if (ibuf->rect_float) {
-		for(x=0; x<ibuf->x; x++) {
-			for(y=0; y<ibuf->y; y++) {
+		for (x=0; x<ibuf->x; x++) {
+			for (y=0; y<ibuf->y; y++) {
 				if (mask[ibuf->x*y + x] == val) {
 					float *col= ibuf->rect_float + 4*(ibuf->x*y + x);
 					col[0] = col[1] = col[2] = col[3] = 0.0f;
 				}
 			}
 		}
-	} else {
+	}
+	else {
 		/* char buffer */
-		for(x=0; x<ibuf->x; x++) {
-			for(y=0; y<ibuf->y; y++) {
+		for (x=0; x<ibuf->x; x++) {
+			for (y=0; y<ibuf->y; y++) {
 				if (mask[ibuf->x*y + x] == val) {
 					char *col= (char *)(ibuf->rect + ibuf->x*y + x);
 					col[0] = col[1] = col[2] = col[3] = 0;
@@ -328,7 +330,7 @@ void IMB_mask_clear(ImBuf *ibuf, char *mask, int val)
 
 static int filter_make_index(const int x, const int y, const int w, const int h)
 {
-	if(x<0 || x>=w || y<0 || y>=h) return -1;	/* return bad index */
+	if (x<0 || x>=w || y<0 || y>=h) return -1;	/* return bad index */
 	else return y*w+x;
 }
 
@@ -336,13 +338,13 @@ static int check_pixel_assigned(const void *buffer, const char *mask, const int
 {
 	int res = 0;
 
-	if(index>=0) {
+	if (index>=0) {
 		const int alpha_index = depth*index+(depth-1);
 
-		if(mask!=NULL) {
+		if (mask!=NULL) {
 			res = mask[index]!=0 ? 1 : 0;
 		}
-		else if( (is_float && ((const float *) buffer)[alpha_index]!=0.0f) ||
+		else if ( (is_float && ((const float *) buffer)[alpha_index]!=0.0f) ||
 				(!is_float && ((const unsigned char *) buffer)[alpha_index]!=0) ) {
 			res=1;
 		}
@@ -372,26 +374,29 @@ void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter)
 
 	/* build a weights buffer */
 	n= 1;
-	/*k= 0;
-	for(i = -n; i <= n; i++)
-		for(j = -n; j <= n; j++)
+
+#if 0
+	k= 0;
+	for (i = -n; i <= n; i++)
+		for (j = -n; j <= n; j++)
 			weight[k++] = sqrt((float) i * i + j * j);
-			*/
+#endif
+
 	weight[0]=1; weight[1]=2; weight[2]=1;
 	weight[3]=2; weight[4]=0; weight[5]=2;
 	weight[6]=1; weight[7]=2; weight[8]=1;
 
 	/* run passes */
-	for(r = 0; cannot_early_out == 1 && r < filter; r++) {
+	for (r = 0; cannot_early_out == 1 && r < filter; r++) {
 		int x, y;
 		cannot_early_out = 0;
 
-		for(y= 0; y<height; y++) {
-			for(x= 0; x<width; x++) {
+		for (y= 0; y<height; y++) {
+			for (x= 0; x<width; x++) {
 				const int index= filter_make_index(x, y, width, height);
 
 				/* only update unassigned pixels */
-				if(!check_pixel_assigned(srcbuf, srcmask, index, depth, is_float)) {
+				if (!check_pixel_assigned(srcbuf, srcmask, index, depth, is_float)) {
 					float tmp[4];
 					float wsum=0;
 					float acc[4]={0,0,0,0};
@@ -401,24 +406,24 @@ void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter)
 						check_pixel_assigned(srcbuf, srcmask, filter_make_index(x+1, y, width, height), depth, is_float) ||
 						check_pixel_assigned(srcbuf, srcmask, filter_make_index(x, y-1, width, height), depth, is_float) ||
 						check_pixel_assigned(srcbuf, srcmask, filter_make_index(x, y+1, width, height), depth, is_float)) {
-						for(i= -n; i<=n; i++) {
-							for(j=-n; j<=n; j++) {
-								if(i != 0 || j != 0) {
+						for (i= -n; i<=n; i++) {
+							for (j=-n; j<=n; j++) {
+								if (i != 0 || j != 0) {
 									const int tmpindex= filter_make_index(x+i, y+j, width, height);
 
-									if(check_pixel_assigned(srcbuf, srcmask, tmpindex, depth, is_float))	{ 
-										if(is_float) {
-											for(c=0; c<depth; c++)
+									if (check_pixel_assigned(srcbuf, srcmask, tmpindex, depth, is_float))	{
+										if (is_float) {
+											for (c=0; c<depth; c++)
 												tmp[c] = ((const float *) srcbuf)[depth*tmpindex+c];
 										}
 										else {
-											for(c=0; c<depth; c++)
+											for (c=0; c<depth; c++)
 												tmp[c] = (float) ((const unsigned char *) srcbuf)[depth*tmpindex+c];
 										}
 
 										wsum+= weight[k];
 
-										for(c=0; c<depth; c++)
+										for (c=0; c<depth; c++)
 											acc[c]+= weight[k] * tmp[c];
 									}
 								}
@@ -426,21 +431,21 @@ void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter)
 							}
 						}
 
-						if(wsum!=0) {
-							for(c=0; c<depth; c++)
+						if (wsum!=0) {
+							for (c=0; c<depth; c++)
 								acc[c]/= wsum;
 
-							if(is_float) {
-								for(c=0; c<depth; c++)
+							if (is_float) {
+								for (c=0; c<depth; c++)
 									((float *) dstbuf)[depth*index+c] = acc[c];
 							}
 							else {
-								for(c=0; c<depth; c++) {
+								for (c=0; c<depth; c++) {
 									((unsigned char *) dstbuf)[depth*index+c]= acc[c] > 255 ? 255 : (acc[c] < 0 ? 0 : ((unsigned char) (acc[c]+0.5f)));
 								}
 							}
 
-							if(dstmask!=NULL) dstmask[index]=FILTER_MASK_MARGIN;	/* assigned */
+							if (dstmask!=NULL) dstmask[index]=FILTER_MASK_MARGIN;	/* assigned */
 							cannot_early_out = 1;
 						}
 					}
@@ -450,12 +455,12 @@ void IMB_filter_extend(struct ImBuf *ibuf, char *mask, int filter)
 
 		/* keep the original buffer up to date. */
 		memcpy(srcbuf, dstbuf, bsize);
-		if(dstmask!=NULL) memcpy(srcmask, dstmask, width*height);
+		if (dstmask!=NULL) memcpy(srcmask, dstmask, width*height);
 	}
 
 	/* free memory */
 	MEM_freeN(dstbuf);
-	if(dstmask!=NULL) MEM_freeN(dstmask);
+	if (dstmask!=NULL) MEM_freeN(dstmask);
 }
 
 /* threadsafe version, only recreates existing maps */
@@ -466,11 +471,11 @@ void IMB_remakemipmap(ImBuf *ibuf, int use_filter)
 	
 	ibuf->miptot= 1;
 	
-	while(curmap < IB_MIPMAP_LEVELS) {
+	while (curmap < IB_MIPMAP_LEVELS) {
 		
-		if(ibuf->mipmap[curmap]) {
+		if (ibuf->mipmap[curmap]) {
 			
-			if(use_filter) {
+			if (use_filter) {
 				ImBuf *nbuf= IMB_allocImBuf(hbuf->x, hbuf->y, 32, IB_rect);
 				IMB_filterN(nbuf, hbuf);
 				imb_onehalf_no_alloc(ibuf->mipmap[curmap], nbuf);
@@ -482,10 +487,10 @@ void IMB_remakemipmap(ImBuf *ibuf, int use_filter)
 		
 		ibuf->miptot= curmap+2;
 		hbuf= ibuf->mipmap[curmap];
-		if(hbuf)
+		if (hbuf)
 			hbuf->miplevel= curmap+1;
 		
-		if(!hbuf || (hbuf->x <= 2 && hbuf->y <= 2))
+		if (!hbuf || (hbuf->x <= 2 && hbuf->y <= 2))
 			break;
 		
 		curmap++;
@@ -502,8 +507,8 @@ void IMB_makemipmap(ImBuf *ibuf, int use_filter)
 	
 	ibuf->miptot= 1;
 
-	while(curmap < IB_MIPMAP_LEVELS) {
-		if(use_filter) {
+	while (curmap < IB_MIPMAP_LEVELS) {
+		if (use_filter) {
 			ImBuf *nbuf= IMB_allocImBuf(hbuf->x, hbuf->y, 32, IB_rect);
 			IMB_filterN(nbuf, hbuf);
 			ibuf->mipmap[curmap] = IMB_onehalf(nbuf);
@@ -516,7 +521,7 @@ void IMB_makemipmap(ImBuf *ibuf, int use_filter)
 		hbuf= ibuf->mipmap[curmap];
 		hbuf->miplevel= curmap+1;
 
-		if(hbuf->x <= 2 && hbuf->y <= 2)
+		if (hbuf->x <= 2 && hbuf->y <= 2)
 			break;
 
 		curmap++;
@@ -534,18 +539,18 @@ void IMB_premultiply_rect(unsigned int *rect, char planes, int w, int h)
 	char *cp;
 	int x, y, val;
 
-	if(planes == 24) {	/* put alpha at 255 */
+	if (planes == 24) {	/* put alpha at 255 */
 		cp= (char *)(rect);
 
-		for(y=0; y<h; y++)
-			for(x=0; x<w; x++, cp+=4)
+		for (y=0; y<h; y++)
+			for (x=0; x<w; x++, cp+=4)
 				cp[3]= 255;
 	}
 	else {
 		cp= (char *)(rect);
 
-		for(y=0; y<h; y++) {
-			for(x=0; x<w; x++, cp+=4) {
+		for (y=0; y<h; y++) {
+			for (x=0; x<w; x++, cp+=4) {
 				val= cp[3];
 				cp[0]= (cp[0]*val)>>8;
 				cp[1]= (cp[1]*val)>>8;
@@ -560,17 +565,17 @@ void IMB_premultiply_rect_float(float *rect_float, char planes, int w, int h)
 	float val, *cp;
 	int x, y;
 
-	if(planes==24) {	/* put alpha at 1.0 */
+	if (planes==24) {	/* put alpha at 1.0 */
 		cp= rect_float;
 
-		for(y=0; y<h; y++)
-			for(x=0; x<w; x++, cp+=4)
+		for (y=0; y<h; y++)
+			for (x=0; x<w; x++, cp+=4)
 				cp[3]= 1.0;
 	}
 	else {
 		cp= rect_float;
-		for(y=0; y<h; y++) {
-			for(x=0; x<w; x++, cp+=4) {
+		for (y=0; y<h; y++) {
+			for (x=0; x<w; x++, cp+=4) {
 				val= cp[3];
 				cp[0]= cp[0]*val;
 				cp[1]= cp[1]*val;
@@ -583,13 +588,13 @@ void IMB_premultiply_rect_float(float *rect_float, char planes, int w, int h)
 
 void IMB_premultiply_alpha(ImBuf *ibuf)
 {
-	if(ibuf==NULL)
+	if (ibuf==NULL)
 		return;
 
-	if(ibuf->rect)
+	if (ibuf->rect)
 		IMB_premultiply_rect(ibuf->rect, ibuf->planes, ibuf->x, ibuf->y);
 
-	if(ibuf->rect_float)
+	if (ibuf->rect_float)
 		IMB_premultiply_rect_float(ibuf->rect_float, ibuf->planes, ibuf->x, ibuf->y);
 }
 
diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c
index 9dad21a..ba165d5 100644
--- a/source/blender/imbuf/intern/imageprocess.c
+++ b/source/blender/imbuf/intern/imageprocess.c
@@ -42,12 +42,14 @@
 
 #include <stdlib.h>
 
+#include "BLI_utildefines.h"
+
 #include "IMB_imbuf_types.h"
 #include "IMB_imbuf.h"
-#include "math.h"
+#include <math.h>
 
 /* This define should be relocated to a global header some where  Kent Mein 
-I stole it from util.h in the plugins api */
+ * I stole it from util.h in the plugins api */
 #define MAX2(x,y)                ( (x)>(y) ? (x) : (y) )
 
 /* Only this one is used liberally here, and in imbuf */
@@ -60,7 +62,7 @@ void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf)
 	if (ibuf->rect) {
 		size = ibuf->x * ibuf->y;
 
-		while(size-- > 0) {
+		while (size-- > 0) {
 			rt= cp[0];
 			cp[0]= cp[3];
 			cp[3]= rt;
@@ -74,7 +76,7 @@ void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf)
 	if (ibuf->rect_float) {
 		size = ibuf->x * ibuf->y;
 
-		while(size-- > 0) {
+		while (size-- > 0) {
 			rtf= cpf[0];
 			cpf[0]= cpf[3];
 			cpf[3]= rtf;
@@ -98,16 +100,15 @@ static void pixel_from_buffer(struct ImBuf *ibuf, unsigned char **outI, float **
 }
 
 /**************************************************************************
-*                            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 */
+ *                            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)
 {
@@ -134,6 +135,10 @@ void bicubic_interpolation_color(struct ImBuf *in, unsigned char *outI, float *o
 	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);
@@ -151,33 +156,31 @@ void bicubic_interpolation_color(struct ImBuf *in, unsigned char *outI, float *o
 	wy[2] = P(b-  1);
 	wy[3] = P(b-  2);
 	
-	for(n= -1; n<= 2; n++){
+	for (n= -1; n<= 2; n++) {
 		x1= i+n;
-		if (x1>0 && x1 < in->x) {
-			wx = P(n-a);
-			for(m= -1; m<= 2; m++){
-				y1= j+m;
-				if (y1>0 && y1<in->y) {
-					/* 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;
-					}
-				}
+		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;
 			}
 		}
 	}
@@ -186,8 +189,8 @@ void bicubic_interpolation_color(struct ImBuf *in, unsigned char *outI, float *o
 	
 #if 0 
 	/* older, slower function, works the same as above */
-	for(n= -1; n<= 2; n++){
-		for(m= -1; m<= 2; m++){
+	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) {
@@ -335,11 +338,11 @@ void bilinear_interpolation_color_wrap(struct ImBuf *in, unsigned char *outI, fl
 	if (x2<0 || x1>in->x-1 || y2<0 || y1>in->y-1) return;
 	
 	/* wrap interpolation pixels - main difference from bilinear_interpolation_color  */
-	if(x1<0)x1= in->x+x1;
-	if(y1<0)y1= in->y+y1;
+	if (x1<0)x1= in->x+x1;
+	if (y1<0)y1= in->y+y1;
 	
-	if(x2>=in->x)x2= x2-in->x;
-	if(y2>=in->y)y2= y2-in->y;
+	if (x2>=in->x)x2= x2-in->x;
+	if (y2>=in->y)y2= y2-in->y;
 
 	if (outF) {
 		// sample including outside of edges of image 
@@ -420,7 +423,8 @@ void neareast_interpolation_color(struct ImBuf *in, unsigned char *outI, float *
 			outF[2]= 0.0f;
 			outF[3]= 0.0f;
 		}
-	} else {
+	}
+	else {
 		dataI= (unsigned char *)in->rect + in->x * y1 * 4 + 4*x1;
 		if (outI) {
 			outI[0]= dataI[0];
diff --git a/source/blender/imbuf/intern/imbuf.h b/source/blender/imbuf/intern/imbuf.h
index c1afecf..2125583 100644
--- a/source/blender/imbuf/intern/imbuf.h
+++ b/source/blender/imbuf/intern/imbuf.h
@@ -35,8 +35,8 @@
  */
 
 
-#ifndef IMBUF_H
-#define IMBUF_H
+#ifndef __IMBUF_H__
+#define __IMBUF_H__
 
 #include <stdlib.h>
 #include <sys/types.h>
@@ -78,5 +78,5 @@ typedef unsigned char uchar;
 #define TRUE 1
 #define FALSE 0
 
-#endif	/* IMBUF_H */
+#endif	/* __IMBUF_H__ */
 
diff --git a/source/blender/imbuf/intern/imbuf_cocoa.m b/source/blender/imbuf/intern/imbuf_cocoa.m
index b79b135..db7f934 100644
--- a/source/blender/imbuf/intern/imbuf_cocoa.m
+++ b/source/blender/imbuf/intern/imbuf_cocoa.m
@@ -53,12 +53,12 @@
  * Loads any Core Graphics supported type
  * Currently is : TIFF, BMP, JPEG, GIF, PNG, DIB, ICO, and various RAW formats
  *
- * @param mem:   Memory containing the bitmap image
- * @param size:  Size of the mem buffer.
- * @param flags: If flags has IB_test set then the file is not actually loaded,
+ * \param mem:   Memory containing the bitmap image
+ * \param size:  Size of the mem buffer.
+ * \param flags: If flags has IB_test set then the file is not actually loaded,
  *                but all other operations take place.
  *
- * @return: A newly allocated ImBuf structure if successful, otherwise NULL.
+ * \return: A newly allocated ImBuf structure if successful, otherwise NULL.
  */
 struct ImBuf *imb_cocoaLoadImage(unsigned char *mem, int size, int flags)
 {
@@ -197,11 +197,11 @@ struct ImBuf *imb_cocoaLoadImage(unsigned char *mem, int size, int flags)
  *
  * Accepted formats: TIFF, GIF, BMP, PNG, JPEG, JPEG2000
  *
- * @param ibuf:  Image buffer.
- * @param name:  Name of the image file to create.
- * @param flags: Currently largely ignored.
+ * \param ibuf:  Image buffer.
+ * \param name:  Name of the image file to create.
+ * \param flags: Currently largely ignored.
  *
- * @return: 1 if the function is successful, 0 on failure.
+ * \return: 1 if the function is successful, 0 on failure.
  */
 
 #define FTOUSHORT(val) ((val >= 1.0f-0.5f/65535)? 65535: (val <= 0.0f)? 0: (unsigned short)(val*65535.0f + 0.5f))
diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c
index e1481d2..b566d97 100644
--- a/source/blender/imbuf/intern/indexer.c
+++ b/source/blender/imbuf/intern/indexer.c
@@ -61,14 +61,6 @@ static int tc_types[] = { IMB_TC_RECORD_RUN,
 
 #define INDEX_FILE_VERSION 1
 
-/* ---------------------------------------------------------------------- 
-   - special indexers
-   ---------------------------------------------------------------------- 
- */
-
-extern void IMB_indexer_dv_new(anim_index_builder * idx);
-
-
 /* ----------------------------------------------------------------------
    - time code index functions
    ---------------------------------------------------------------------- */
@@ -89,7 +81,7 @@ anim_index_builder * IMB_index_builder_create(const char * name)
 
 	BLI_make_existing_file(rv->temp_name);
 
-	rv->fp = fopen(rv->temp_name, "wb");
+	rv->fp = BLI_fopen(rv->temp_name, "wb");
 
 	if (!rv->fp) {
 		fprintf(stderr, "Couldn't open index target: %s! "
@@ -130,7 +122,8 @@ void IMB_index_builder_proc_frame(anim_index_builder * fp,
 		e.pts = pts;
 
 		fp->proc_frame(fp, buffer, data_size, &e);
-	} else {
+	}
+	else {
 		IMB_index_builder_add_entry(fp, frameno, seek_pos,
 					    seek_pos_dts, pts);
 	}
@@ -146,8 +139,10 @@ void IMB_index_builder_finish(anim_index_builder * fp, int rollback)
 	
 	if (rollback) {
 		unlink(fp->temp_name);
-	} else {
-		rename(fp->temp_name, fp->name);
+	}
+	else {
+		unlink(fp->name);
+		BLI_rename(fp->temp_name, fp->name);
 	}
 
 	MEM_freeN(fp);
@@ -157,7 +152,7 @@ struct anim_index * IMB_indexer_open(const char * name)
 {
 	char header[13];
 	struct anim_index * idx;
-	FILE * fp = fopen(name, "rb");
+	FILE * fp = BLI_fopen(name, "rb");
 	int i;
 
 	if (!fp) {
@@ -267,14 +262,16 @@ int IMB_indexer_get_frame_index(struct anim_index * idx, int frameno)
 			first = middle;
 			++first;
 			len = len - half - 1;
-		} else {
+		}
+		else {
 			len = half;
 		}
 	}
 
 	if (first == idx->num_entries) {
 		return idx->num_entries - 1;
-	} else {
+	}
+	else {
 		return first;
 	}
 }
@@ -303,7 +300,7 @@ int IMB_indexer_can_scan(struct anim_index * idx,
 			 int old_frame_index, int new_frame_index)
 {
 	/* makes only sense, if it is the same I-Frame and we are not
-	   trying to run backwards in time... */
+	 * trying to run backwards in time... */
 	return (IMB_indexer_get_seek_pos(idx, old_frame_index)
 		== IMB_indexer_get_seek_pos(idx, new_frame_index) && 
 		old_frame_index < new_frame_index);
@@ -368,7 +365,8 @@ static void get_index_dir(struct anim * anim, char * index_dir)
 		BLI_splitdirstring(index_dir, fname);
 		BLI_join_dirfile(index_dir, FILE_MAXDIR, index_dir, "BL_proxy");
 		BLI_join_dirfile(index_dir, FILE_MAXDIR, index_dir, fname);
-	} else {
+	}
+	else {
 		BLI_strncpy(index_dir, anim->index_dir, FILE_MAXDIR);
 	}
 }
@@ -429,6 +427,15 @@ static void get_tc_filename(struct anim * anim, IMB_Timecode_Type tc,
 }
 
 /* ----------------------------------------------------------------------
+   - common rebuilder structures
+   ---------------------------------------------------------------------- */
+
+typedef struct IndexBuildContext {
+	int anim_type;
+} IndexBuildContext;
+
+
+/* ----------------------------------------------------------------------
    - ffmpeg rebuilder
    ---------------------------------------------------------------------- */
 
@@ -459,12 +466,13 @@ static int round_up(int x, int mod)
 static struct proxy_output_ctx * alloc_proxy_output_ffmpeg(
 	struct anim * anim,
 	AVStream * st, int proxy_size, int width, int height,
-	int UNUSED(quality))
+	int quality)
 {
 	struct proxy_output_ctx * rv = MEM_callocN(
 		sizeof(struct proxy_output_ctx), "alloc_proxy_output");
 	
 	char fname[FILE_MAX];
+	int ffmpeg_quality;
 
 	// JPEG requires this
 	width = round_up(width, 8);
@@ -502,7 +510,8 @@ static struct proxy_output_ctx * alloc_proxy_output_ffmpeg(
 
 	if (rv->codec->pix_fmts) {
 		rv->c->pix_fmt = rv->codec->pix_fmts[0];
-	} else {
+	}
+	else {
 		rv->c->pix_fmt = PIX_FMT_YUVJ420P;
 	}
 
@@ -514,6 +523,12 @@ static struct proxy_output_ctx * alloc_proxy_output_ffmpeg(
 	rv->c->time_base.num = 1;
 	rv->st->time_base = rv->c->time_base;
 
+	/* there's no  way to set JPEG quality in the same way as in AVI JPEG and image sequence,
+	 * but this seems to be giving expected quality result */
+	ffmpeg_quality = (int)(1.0f + 30.0f * (1.0f - (float)quality / 100.0f) + 0.5f);
+	av_set_int(rv->c, "qmin", ffmpeg_quality);
+	av_set_int(rv->c, "qmax", ffmpeg_quality);
+
 	if (rv->of->flags & AVFMT_GLOBALHEADER) {
 		rv->c->flags |= CODEC_FLAG_GLOBAL_HEADER;
 	}
@@ -624,7 +639,8 @@ static int add_to_proxy_output_ffmpeg(
 		}
 
 		return 1;
-	} else {
+	}
+	else {
 		return 0;
 	}
 }
@@ -641,7 +657,7 @@ static void free_proxy_output_ffmpeg(struct proxy_output_ctx * ctx,
 	}
 
 	if (!rollback) {
-		while (add_to_proxy_output_ffmpeg(ctx, NULL)) ;
+		while (add_to_proxy_output_ffmpeg(ctx, NULL)) {}
 	}
 
 	avcodec_flush_buffers(ctx->c);
@@ -677,111 +693,111 @@ static void free_proxy_output_ffmpeg(struct proxy_output_ctx * ctx,
 
 	if (rollback) {
 		unlink(fname_tmp);
-	} else {
+	}
+	else {
 		get_proxy_filename(ctx->anim, ctx->proxy_size, 
 		                   fname, FALSE);
-		rename(fname_tmp, fname);
+		unlink(fname);
+		BLI_rename(fname_tmp, fname);
 	}
 	
 	MEM_freeN(ctx);
 }
 
-
-static int index_rebuild_ffmpeg(struct anim * anim, 
-				IMB_Timecode_Type tcs_in_use,
-				IMB_Proxy_Size proxy_sizes_in_use,
-				int quality,
-				short *stop, short *do_update, 
-				float *progress)
-{
-	int i, videoStream;
-	unsigned long long seek_pos = 0;
-	unsigned long long last_seek_pos = 0;
-	unsigned long long seek_pos_dts = 0;
-	unsigned long long seek_pos_pts = 0;
-	unsigned long long last_seek_pos_dts = 0;
-	unsigned long long start_pts = 0;
-	double frame_rate;
-	double pts_time_base;
-	int frameno = 0, frameno_gapless = 0;
-	int start_pts_set = FALSE;
+typedef struct FFmpegIndexBuilderContext {
+	int anim_type;
 
 	AVFormatContext *iFormatCtx;
 	AVCodecContext *iCodecCtx;
 	AVCodec *iCodec;
 	AVStream *iStream;
-	AVFrame* in_frame = 0;
-	AVPacket next_packet;
-	int streamcount;
+	int videoStream;
+
+	int num_proxy_sizes;
+	int num_indexers;
 
 	struct proxy_output_ctx * proxy_ctx[IMB_PROXY_MAX_SLOT];
 	anim_index_builder * indexer [IMB_TC_MAX_SLOT];
 
+	IMB_Timecode_Type tcs_in_use;
+	IMB_Proxy_Size proxy_sizes_in_use;
+} FFmpegIndexBuilderContext;
+
+static IndexBuildContext *index_ffmpeg_create_context(struct anim *anim, IMB_Timecode_Type tcs_in_use,
+                                                      IMB_Proxy_Size proxy_sizes_in_use, int quality)
+{
+	FFmpegIndexBuilderContext *context = MEM_callocN(sizeof(FFmpegIndexBuilderContext), "FFmpeg index builder context");
 	int num_proxy_sizes = IMB_PROXY_MAX_SLOT;
 	int num_indexers = IMB_TC_MAX_SLOT;
-	uint64_t stream_size;
+	int i, streamcount;
 
-	memset(proxy_ctx, 0, sizeof(proxy_ctx));
-	memset(indexer, 0, sizeof(indexer));
+	context->tcs_in_use = tcs_in_use;
+	context->proxy_sizes_in_use = proxy_sizes_in_use;
+	context->num_proxy_sizes = IMB_PROXY_MAX_SLOT;
+	context->num_indexers = IMB_TC_MAX_SLOT;
 
-	if(av_open_input_file(&iFormatCtx, anim->name, NULL, 0, NULL) != 0) {
-		return 0;
+	memset(context->proxy_ctx, 0, sizeof(context->proxy_ctx));
+	memset(context->indexer, 0, sizeof(context->indexer));
+
+	if (av_open_input_file(&context->iFormatCtx, anim->name, NULL, 0, NULL) != 0) {
+		MEM_freeN(context);
+		return NULL;
 	}
 
-	if (av_find_stream_info(iFormatCtx) < 0) {
-		av_close_input_file(iFormatCtx);
-		return 0;
+	if (av_find_stream_info(context->iFormatCtx) < 0) {
+		av_close_input_file(context->iFormatCtx);
+		MEM_freeN(context);
+		return NULL;
 	}
 
 	streamcount = anim->streamindex;
 
 	/* Find the video stream */
-	videoStream = -1;
-	for (i = 0; i < iFormatCtx->nb_streams; i++)
-		if(iFormatCtx->streams[i]->codec->codec_type
+	context->videoStream = -1;
+	for (i = 0; i < context->iFormatCtx->nb_streams; i++)
+		if (context->iFormatCtx->streams[i]->codec->codec_type
 		   == AVMEDIA_TYPE_VIDEO) {
 			if (streamcount > 0) {
 				streamcount--;
 				continue;
 			}
-			videoStream = i;
+			context->videoStream = i;
 			break;
 		}
 
-	if (videoStream == -1) {
-		av_close_input_file(iFormatCtx);
-		return 0;
+	if (context->videoStream == -1) {
+		av_close_input_file(context->iFormatCtx);
+		MEM_freeN(context);
+		return NULL;
 	}
 
-	iStream = iFormatCtx->streams[videoStream];
-	iCodecCtx = iStream->codec;
+	context->iStream = context->iFormatCtx->streams[context->videoStream];
+	context->iCodecCtx = context->iStream->codec;
 
-	iCodec = avcodec_find_decoder(iCodecCtx->codec_id);
-	
-	if (iCodec == NULL) {
-		av_close_input_file(iFormatCtx);
-		return 0;
-	}
+	context->iCodec = avcodec_find_decoder(context->iCodecCtx->codec_id);
 
-	iCodecCtx->workaround_bugs = 1;
-
-	if (avcodec_open(iCodecCtx, iCodec) < 0) {
-		av_close_input_file(iFormatCtx);
-		return 0;
+	if (context->iCodec == NULL) {
+		av_close_input_file(context->iFormatCtx);
+		MEM_freeN(context);
+		return NULL;
 	}
 
-	in_frame = avcodec_alloc_frame();
+	context->iCodecCtx->workaround_bugs = 1;
 
-	stream_size = avio_size(iFormatCtx->pb);
+	if (avcodec_open(context->iCodecCtx, context->iCodec) < 0) {
+		av_close_input_file(context->iFormatCtx);
+		MEM_freeN(context);
+		return NULL;
+	}
 
 	for (i = 0; i < num_proxy_sizes; i++) {
 		if (proxy_sizes_in_use & proxy_sizes[i]) {
-			proxy_ctx[i] = alloc_proxy_output_ffmpeg(
-				anim, iStream, proxy_sizes[i],
-				iCodecCtx->width * proxy_fac[i],
-				iCodecCtx->height * proxy_fac[i],
+			context->proxy_ctx[i] = alloc_proxy_output_ffmpeg(
+				anim, context->iStream, proxy_sizes[i],
+				context->iCodecCtx->width * proxy_fac[i],
+				context->iCodecCtx->height * proxy_fac[i],
 				quality);
-			if (!proxy_ctx[i]) {
+			if (!context->proxy_ctx[i]) {
 				proxy_sizes_in_use &= ~proxy_sizes[i];
 			}
 		}
@@ -793,17 +809,61 @@ static int index_rebuild_ffmpeg(struct anim * anim,
 
 			get_tc_filename(anim, tc_types[i], fname);
 
-			indexer[i] = IMB_index_builder_create(fname);
-			if (!indexer[i]) {
+			context->indexer[i] = IMB_index_builder_create(fname);
+			if (!context->indexer[i]) {
 				tcs_in_use &= ~tc_types[i];
 			}
 		}
 	}
 
-	frame_rate = av_q2d(iStream->r_frame_rate);
-	pts_time_base = av_q2d(iStream->time_base);
+	return (IndexBuildContext *)context;
+}
+
+static void index_rebuild_ffmpeg_finish(FFmpegIndexBuilderContext *context, int stop)
+{
+	int i;
+
+	for (i = 0; i < context->num_indexers; i++) {
+		if (context->tcs_in_use & tc_types[i]) {
+			IMB_index_builder_finish(context->indexer[i], stop);
+		}
+	}
+
+	for (i = 0; i < context->num_proxy_sizes; i++) {
+		if (context->proxy_sizes_in_use & proxy_sizes[i]) {
+			free_proxy_output_ffmpeg(context->proxy_ctx[i], stop);
+		}
+	}
+
+	MEM_freeN(context);
+}
+
+static int index_rebuild_ffmpeg(FFmpegIndexBuilderContext *context,
+                                short *stop, short *do_update, float *progress)
+{
+	int i;
+	unsigned long long seek_pos = 0;
+	unsigned long long last_seek_pos = 0;
+	unsigned long long seek_pos_dts = 0;
+	unsigned long long seek_pos_pts = 0;
+	unsigned long long last_seek_pos_dts = 0;
+	unsigned long long start_pts = 0;
+	double frame_rate;
+	double pts_time_base;
+	int frameno = 0, frameno_gapless = 0;
+	int start_pts_set = FALSE;
+	AVFrame* in_frame = 0;
+	AVPacket next_packet;
+	uint64_t stream_size;
+
+	in_frame = avcodec_alloc_frame();
+
+	stream_size = avio_size(context->iFormatCtx->pb);
+
+	frame_rate = av_q2d(context->iStream->r_frame_rate);
+	pts_time_base = av_q2d(context->iStream->time_base);
 
-	while(av_read_frame(iFormatCtx, &next_packet) >= 0) {
+	while (av_read_frame(context->iFormatCtx, &next_packet) >= 0) {
 		int frame_finished = 0;
 		float next_progress =  (float)((int)floor(((double) next_packet.pos) * 100 /
 		                                   ((double) stream_size)+0.5)) / 100;
@@ -818,7 +878,7 @@ static int index_rebuild_ffmpeg(struct anim * anim,
 			break;
 		}
 
-		if (next_packet.stream_index == videoStream) {
+		if (next_packet.stream_index == context->videoStream) {
 			if (next_packet.flags & AV_PKT_FLAG_KEY) {
 				last_seek_pos = seek_pos;
 				last_seek_pos_dts = seek_pos_dts;
@@ -828,7 +888,7 @@ static int index_rebuild_ffmpeg(struct anim * anim,
 			}
 
 			avcodec_decode_video2(
-				iCodecCtx, in_frame, &frame_finished, 
+				context->iCodecCtx, in_frame, &frame_finished,
 				&next_packet);
 		}
 
@@ -836,11 +896,11 @@ static int index_rebuild_ffmpeg(struct anim * anim,
 			unsigned long long s_pos = seek_pos;
 			unsigned long long s_dts = seek_pos_dts;
 			unsigned long long pts 
-				= av_get_pts_from_frame(iFormatCtx, in_frame);
+				= av_get_pts_from_frame(context->iFormatCtx, in_frame);
 
-			for (i = 0; i < num_proxy_sizes; i++) {
+			for (i = 0; i < context->num_proxy_sizes; i++) {
 				add_to_proxy_output_ffmpeg(
-					proxy_ctx[i], in_frame);
+					context->proxy_ctx[i], in_frame);
 			}
 
 			if (!start_pts_set) {
@@ -863,15 +923,15 @@ static int index_rebuild_ffmpeg(struct anim * anim,
 				s_dts = last_seek_pos_dts;
 			}
 
-			for (i = 0; i < num_indexers; i++) {
-				if (tcs_in_use & tc_types[i]) {
+			for (i = 0; i < context->num_indexers; i++) {
+				if (context->tcs_in_use & tc_types[i]) {
 					int tc_frameno = frameno;
 
-					if(tc_types[i] == IMB_TC_RECORD_RUN_NO_GAPS)
+					if (tc_types[i] == IMB_TC_RECORD_RUN_NO_GAPS)
 						tc_frameno = frameno_gapless;
 
 					IMB_index_builder_proc_frame(
-						indexer[i], 
+						context->indexer[i],
 						next_packet.data, 
 						next_packet.size,
 						tc_frameno,
@@ -884,18 +944,6 @@ static int index_rebuild_ffmpeg(struct anim * anim,
 		av_free_packet(&next_packet);
 	}
 
-	for (i = 0; i < num_indexers; i++) {
-		if (tcs_in_use & tc_types[i]) {
-			IMB_index_builder_finish(indexer[i], *stop);
-		}
-	}
-
-	for (i = 0; i < num_proxy_sizes; i++) {
-		if (proxy_sizes_in_use & proxy_sizes[i]) {
-			free_proxy_output_ffmpeg(proxy_ctx[i], *stop);
-		}
-	}
-
 	av_free(in_frame);
 
 	return 1;
@@ -907,6 +955,14 @@ static int index_rebuild_ffmpeg(struct anim * anim,
    - internal AVI (fallback) rebuilder
    ---------------------------------------------------------------------- */
 
+typedef struct FallbackIndexBuilderContext {
+	int anim_type;
+
+	struct anim *anim;
+	AviMovie *proxy_ctx[IMB_PROXY_MAX_SLOT];
+	IMB_Proxy_Size proxy_sizes_in_use;
+} FallbackIndexBuilderContext;
+
 static AviMovie * alloc_proxy_output_avi(
 	struct anim * anim, char * filename, int width, int height,
 	int quality)
@@ -946,20 +1002,11 @@ static AviMovie * alloc_proxy_output_avi(
 	return avi;
 }
 
-static void index_rebuild_fallback(struct anim * anim,
-				   IMB_Timecode_Type UNUSED(tcs_in_use),
-				   IMB_Proxy_Size proxy_sizes_in_use,
-				   int quality,
-				   short *stop, short *do_update, 
-				   float *progress)
+static IndexBuildContext *index_fallback_create_context(struct anim *anim, IMB_Timecode_Type UNUSED(tcs_in_use),
+                                                        IMB_Proxy_Size proxy_sizes_in_use, int quality)
 {
-	int cnt = IMB_anim_get_duration(anim, IMB_TC_NONE);
-	int i, pos;
-	AviMovie * proxy_ctx[IMB_PROXY_MAX_SLOT];
-	char fname[FILE_MAX];
-	char fname_tmp[FILE_MAX];
-	
-	memset(proxy_ctx, 0, sizeof(proxy_ctx));
+	FallbackIndexBuilderContext *context;
+	int i;
 
 	/* since timecode indices only work with ffmpeg right now,
 	   don't know a sensible fallback here...
@@ -967,28 +1014,68 @@ static void index_rebuild_fallback(struct anim * anim,
 	   so no proxies, no game to play...
 	*/
 	if (proxy_sizes_in_use == IMB_PROXY_NONE) {
-		return;
+		return NULL;
 	}
 
+	context = MEM_callocN(sizeof(FallbackIndexBuilderContext), "fallback index builder context");
+
+	context->anim = anim;
+	context->proxy_sizes_in_use = proxy_sizes_in_use;
+
+	memset(context->proxy_ctx, 0, sizeof(context->proxy_ctx));
+
 	for (i = 0; i < IMB_PROXY_MAX_SLOT; i++) {
-		if (proxy_sizes_in_use & proxy_sizes[i]) {
+		if (context->proxy_sizes_in_use & proxy_sizes[i]) {
 			char fname[FILE_MAX];
 
 			get_proxy_filename(anim, proxy_sizes[i], fname, TRUE);
 			BLI_make_existing_file(fname);
 
-			proxy_ctx[i] = alloc_proxy_output_avi(
-				anim, fname,
-				anim->x * proxy_fac[i],
-				anim->y * proxy_fac[i],
-				quality);
+			context->proxy_ctx[i] = alloc_proxy_output_avi(anim, fname,
+				anim->x * proxy_fac[i], anim->y * proxy_fac[i], quality);
+		}
+	}
+
+	return (IndexBuildContext *)context;
+}
+
+static void index_rebuild_fallback_finish(FallbackIndexBuilderContext *context, int stop)
+{
+	struct anim *anim = context->anim;
+	char fname[FILE_MAX];
+	char fname_tmp[FILE_MAX];
+	int i;
+
+	for (i = 0; i < IMB_PROXY_MAX_SLOT; i++) {
+		if (context->proxy_sizes_in_use & proxy_sizes[i]) {
+			AVI_close_compress(context->proxy_ctx[i]);
+			MEM_freeN(context->proxy_ctx[i]);
+
+			get_proxy_filename(anim, proxy_sizes[i], fname_tmp, TRUE);
+			get_proxy_filename(anim, proxy_sizes[i], fname, FALSE);
+
+			if (stop) {
+				unlink(fname_tmp);
+			}
+			else {
+				unlink(fname);
+				rename(fname_tmp, fname);
+			}
 		}
 	}
+}
+
+static void index_rebuild_fallback(FallbackIndexBuilderContext *context,
+                                   short *stop, short *do_update, float *progress)
+{
+	int cnt = IMB_anim_get_duration(context->anim, IMB_TC_NONE);
+	int i, pos;
+	struct anim *anim = context->anim;
 
 	for (pos = 0; pos < cnt; pos++) {
-		struct ImBuf * ibuf = IMB_anim_absolute(
-			anim, pos, IMB_TC_NONE, IMB_PROXY_NONE);
-		int next_progress = (int) ((double) pos / (double) cnt);
+		struct ImBuf *ibuf = IMB_anim_absolute(anim, pos, IMB_TC_NONE, IMB_PROXY_NONE);
+		struct ImBuf *tmp_ibuf = IMB_dupImBuf(ibuf);
+		float next_progress = (float) pos / (float) cnt;
 
 		if (*progress != next_progress) {
 			*progress = next_progress;
@@ -999,19 +1086,20 @@ static void index_rebuild_fallback(struct anim * anim,
 			break;
 		}
 
-		IMB_flipy(ibuf);
+		IMB_flipy(tmp_ibuf);
 
 		for (i = 0; i < IMB_PROXY_MAX_SLOT; i++) {
-			if (proxy_sizes_in_use & proxy_sizes[i]) {
+			if (context->proxy_sizes_in_use & proxy_sizes[i]) {
 				int x = anim->x * proxy_fac[i];
 				int y = anim->y * proxy_fac[i];
 
-				struct ImBuf * s_ibuf = IMB_scalefastImBuf(
-					ibuf, x, y);
+				struct ImBuf * s_ibuf = IMB_dupImBuf(tmp_ibuf);
+
+				IMB_scalefastImBuf(s_ibuf, x, y);
 
 				IMB_convert_rgba_to_abgr(s_ibuf);
 	
-				AVI_write_frame (proxy_ctx[i], pos, 
+				AVI_write_frame (context->proxy_ctx[i], pos, 
 						 AVI_FORMAT_RGB32, 
 						 s_ibuf->rect, x * y * 4);
 
@@ -1021,24 +1109,9 @@ static void index_rebuild_fallback(struct anim * anim,
 				IMB_freeImBuf(s_ibuf);
 			}
 		}
-	}
 
-	for (i = 0; i < IMB_PROXY_MAX_SLOT; i++) {
-		if (proxy_sizes_in_use & proxy_sizes[i]) {
-			AVI_close_compress (proxy_ctx[i]);
-			MEM_freeN (proxy_ctx[i]);
-
-			get_proxy_filename(anim, proxy_sizes[i], 
-					   fname_tmp, TRUE);
-			get_proxy_filename(anim, proxy_sizes[i], 
-					   fname, FALSE);
-
-			if (*stop) {
-				unlink(fname_tmp);
-			} else {
-				rename(fname_tmp, fname);
-			}
-		}
+		IMB_freeImBuf(tmp_ibuf);
+		IMB_freeImBuf(ibuf);
 	}
 }
 
@@ -1046,25 +1119,58 @@ static void index_rebuild_fallback(struct anim * anim,
    - public API
    ---------------------------------------------------------------------- */
 
-void IMB_anim_index_rebuild(struct anim * anim, IMB_Timecode_Type tcs_in_use,
-			    IMB_Proxy_Size proxy_sizes_in_use,
-			    int quality,
-			    short *stop, short *do_update, float *progress)
+IndexBuildContext *IMB_anim_index_rebuild_context(struct anim *anim, IMB_Timecode_Type tcs_in_use,
+                                                         IMB_Proxy_Size proxy_sizes_in_use, int quality)
 {
+	IndexBuildContext *context = NULL;
+
 	switch (anim->curtype) {
 #ifdef WITH_FFMPEG
 	case ANIM_FFMPEG:
-		index_rebuild_ffmpeg(anim, tcs_in_use, proxy_sizes_in_use,
-				     quality, stop, do_update, progress);
+		context = index_ffmpeg_create_context(anim, tcs_in_use, proxy_sizes_in_use, quality);
 		break;
 #endif
 	default:
-		index_rebuild_fallback(anim, tcs_in_use, proxy_sizes_in_use,
-				       quality, stop, do_update, progress);
+		context = index_fallback_create_context(anim, tcs_in_use, proxy_sizes_in_use, quality);
 		break;
 	}
+
+	if (context)
+		context->anim_type = anim->curtype;
+
+	return context;
 }
 
+void IMB_anim_index_rebuild(struct IndexBuildContext *context,
+                            short *stop, short *do_update, float *progress)
+{
+	switch (context->anim_type) {
+#ifdef WITH_FFMPEG
+	case ANIM_FFMPEG:
+		index_rebuild_ffmpeg((FFmpegIndexBuilderContext*)context, stop, do_update, progress);
+		break;
+#endif
+	default:
+		index_rebuild_fallback((FallbackIndexBuilderContext*)context, stop, do_update, progress);
+		break;
+	}
+}
+
+void IMB_anim_index_rebuild_finish(IndexBuildContext *context, short stop)
+{
+	switch (context->anim_type) {
+#ifdef WITH_FFMPEG
+	case ANIM_FFMPEG:
+		index_rebuild_ffmpeg_finish((FFmpegIndexBuilderContext*)context, stop);
+		break;
+#endif
+	default:
+		index_rebuild_fallback_finish((FallbackIndexBuilderContext*)context, stop);
+		break;
+	}
+}
+
+
 void IMB_free_indices(struct anim * anim)
 {
 	int i;
diff --git a/source/blender/imbuf/intern/indexer_dv.c b/source/blender/imbuf/intern/indexer_dv.c
index 4ccd8ec..f0c38f6 100644
--- a/source/blender/imbuf/intern/indexer_dv.c
+++ b/source/blender/imbuf/intern/indexer_dv.c
@@ -139,7 +139,8 @@ static void parse_packet(indexer_dv_context * This, unsigned char * p)
 			This->rec_curr_year = parse_bcd(&b, 8);
 			if (This->rec_curr_year < 25) {
 				This->rec_curr_year += 2000;
-			} else {
+			}
+			else {
 				This->rec_curr_year += 1900;
 			}
 			This->got_record_date = 1;
@@ -201,7 +202,7 @@ static void parse_audio_headers(
 {
 	int i;
 
-	for(i = 0; i < 9; i++) {
+	for (i = 0; i < 9; i++) {
 		if (target[3] != 0xff) {
 			parse_packet(This, target + 3);
 		}
@@ -238,7 +239,8 @@ static void inc_frame(int * frame, time_t * t, int isPAL)
 	if (isPAL && *frame >= 25) {
 		(*t)++;
 		*frame = 0;
-	} else if (!isPAL && *frame >= 30) {
+	}
+	else if (!isPAL && *frame >= 30) {
 		(*t)++;
 		*frame = 0;
 	}
@@ -308,7 +310,8 @@ static void proc_frame(indexer_dv_context * This,
 	if (This->ref_time_read < 0) {
 		This->ref_time_read = This->ref_time_read_new;
 		This->curr_frame = 0;
-	} else {
+	}
+	else {
 		if (This->ref_time_read_new - This->ref_time_read == 1) {
 			This->curr_frame = 0;
 			This->ref_time_read = This->ref_time_read_new;
@@ -316,9 +319,11 @@ static void proc_frame(indexer_dv_context * This,
 				fill_gap(This, isPAL);
 				This->gap_frame = -1;
 			}
-		} else if (This->ref_time_read_new  == This->ref_time_read) {
+		}
+		else if (This->ref_time_read_new  == This->ref_time_read) {
 			// do nothing
-		} else {
+		}
+		else {
 			This->gap_start = This->ref_time_read;
 			This->gap_frame = This->curr_frame;
 			This->ref_time_read = This->ref_time_read_new;
@@ -347,7 +352,8 @@ static void indexer_dv_proc_frame(anim_index_builder * idx,
 	if (This->curr_frame >= 0) {
 		write_index(This, entry);
 		inc_frame(&This->curr_frame, &This->ref_time_read, isPAL);
-	} else {
+	}
+	else {
 		This->backbuffer[This->fsize++] = *entry;
 		if (This->fsize >= 31) {
 			int i;
diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c
index 83351b5..e775d0f 100644
--- a/source/blender/imbuf/intern/iris.c
+++ b/source/blender/imbuf/intern/iris.c
@@ -196,7 +196,7 @@ static int writetab(FILE *outf, unsigned int *tab, int len)
 {
 	int r = 0;
 
-	while(len) {
+	while (len) {
 		r = putlong(outf,*tab++);
 		len -= 4;
 	}
@@ -205,7 +205,7 @@ static int writetab(FILE *outf, unsigned int *tab, int len)
 
 static void readtab(FILE *inf, unsigned int *tab, int len)
 {
-	while(len) {
+	while (len) {
 		*tab++ = getlong(inf);
 		len -= 4;
 	}
@@ -216,13 +216,13 @@ static void test_endian_zbuf(struct ImBuf *ibuf)
 	int len;
 	int *zval;
 	
-	if( BIG_LONG(1) == 1 ) return;
-	if(ibuf->zbuf == NULL) return;
+	if ( BIG_LONG(1) == 1 ) return;
+	if (ibuf->zbuf == NULL) return;
 	
 	len= ibuf->x*ibuf->y;
 	zval= ibuf->zbuf;
 	
-	while(len--) {
+	while (len--) {
 		zval[0]= BIG_LONG(zval[0]);
 		zval++;
 	}
@@ -262,7 +262,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
 
 	(void)size; /* unused */
 	
-	if(!imb_is_a_iris(mem)) return NULL;
+	if (!imb_is_a_iris(mem)) return NULL;
 
 	/*printf("new iris\n");*/
 	
@@ -270,14 +270,14 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
 	file_offset = 0;
 	
 	readheader(inf, &image);
-	if(image.imagic != IMAGIC) {
+	if (image.imagic != IMAGIC) {
 		fprintf(stderr,"longimagedata: bad magic number in image file\n");
 		return(NULL);
 	}
 	
 	rle = ISRLE(image.type);
 	bpp = BPP(image.type);
-	if(bpp != 1 && bpp != 2) {
+	if (bpp != 1 && bpp != 2) {
 		fprintf(stderr,"longimagedata: image must have 1 or 2 byte per pix chan\n");
 		return(NULL);
 	}
@@ -313,7 +313,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
 				}
 				cur = starttab[y+z*ysize];
 			}
-			if(badorder)
+			if (badorder)
 				break;
 		}
 	
@@ -325,9 +325,9 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
 			zbase = (unsigned int *)ibuf->zbuf;
 			
 			if (badorder) {
-				for(z=0; z<zsize; z++) {
+				for (z=0; z<zsize; z++) {
 					lptr = base;
-					for(y=0; y<ysize; y++) {
+					for (y=0; y<ysize; y++) {
 						file_offset = starttab[y+z*ysize];
 						
 						rledat = file_data + file_offset;
@@ -337,20 +337,21 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
 						lptr += xsize;
 					}
 				}
-			} else {
+			}
+			else {
 				lptr = base;
 				zptr = zbase;
-				for(y=0; y<ysize; y++) {
+				for (y=0; y<ysize; y++) {
 				
-					for(z=0; z<zsize; z++) {
+					for (z=0; z<zsize; z++) {
 						
 						file_offset = starttab[y+z*ysize];
 
 						rledat = file_data + file_offset;
 						file_offset += lengthtab[y+z*ysize];
 						
-						if(z<4) expandrow((uchar *)lptr, rledat, 3-z);
-						else if(z<8) expandrow((uchar *)zptr, rledat, 7-z);
+						if (z<4) expandrow((uchar *)lptr, rledat, 3-z);
+						else if (z<8) expandrow((uchar *)zptr, rledat, 7-z);
 					}
 					lptr += xsize;
 					zptr += xsize;
@@ -358,16 +359,17 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
 			}
 			
 
-		} else {	/* bpp == 2 */
+		}
+		else {	/* bpp == 2 */
 			
 			ibuf = IMB_allocImBuf(xsize, ysize, 32, (flags & IB_rect)|IB_rectfloat);
 			
 			fbase = ibuf->rect_float;
 			
 			if (badorder) {
-				for(z=0; z<zsize; z++) {
+				for (z=0; z<zsize; z++) {
 					fptr = fbase;
-					for(y=0; y<ysize; y++) {
+					for (y=0; y<ysize; y++) {
 						file_offset = starttab[y+z*ysize];
 						
 						rledat = file_data + file_offset;
@@ -377,12 +379,13 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
 						fptr += xsize * 4;
 					}
 				}
-			} else {
+			}
+			else {
 				fptr = fbase;
 
-				for(y=0; y<ysize; y++) {
+				for (y=0; y<ysize; y++) {
 				
-					for(z=0; z<zsize; z++) {
+					for (z=0; z<zsize; z++) {
 						
 						file_offset = starttab[y+z*ysize];
 
@@ -400,7 +403,8 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
 		MEM_freeN(starttab);
 		MEM_freeN(lengthtab);	
 
-	} else {
+	}
+	else {
 		if (bpp == 1) {
 			
 			ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect);
@@ -412,12 +416,12 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
 			file_offset = 512;
 			rledat = file_data + file_offset;
 			
-			for(z = 0; z < zsize; z++) {
+			for (z = 0; z < zsize; z++) {
 				
-				if(z<4) lptr = base;
-				else if(z<8) lptr= zbase;
+				if (z<4) lptr = base;
+				else if (z<8) lptr= zbase;
 				
-				for(y = 0; y < ysize; y++) {
+				for (y = 0; y < ysize; y++) {
 
 					interleaverow((uchar *)lptr, rledat, 3-z, xsize);
 					rledat += xsize;
@@ -426,7 +430,8 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
 				}
 			}
 			
-		} else {	/* bpp == 2 */
+		}
+		else {	/* bpp == 2 */
 			
 			ibuf = IMB_allocImBuf(xsize, ysize, 32, (flags & IB_rect)|IB_rectfloat);
 
@@ -435,11 +440,11 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
 			file_offset = 512;
 			rledat = file_data + file_offset;
 			
-			for(z = 0; z < zsize; z++) {
+			for (z = 0; z < zsize; z++) {
 				
 				fptr = fbase;
 				
-				for(y = 0; y < ysize; y++) {
+				for (y = 0; y < ysize; y++) {
 
 					interleaverow2(fptr, rledat, 3-z, xsize);
 					rledat += xsize * 2;
@@ -455,14 +460,15 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
 	if (bpp == 1) {
 		uchar * rect;
 		
-		if (image.zsize == 1){
+		if (image.zsize == 1) {
 			rect = (uchar *) ibuf->rect;
 			for (x = ibuf->x * ibuf->y; x > 0; x--) {
 				rect[0] = 255;
 				rect[1] = rect[2] = rect[3];
 				rect += 4;
 			}
-		} else if (image.zsize == 2){
+		}
+		else if (image.zsize == 2) {
 			/* grayscale with alpha */
 			rect = (uchar *) ibuf->rect;
 			for (x = ibuf->x * ibuf->y; x > 0; x--) {
@@ -470,7 +476,8 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
 				rect[1] = rect[2] = rect[3];
 				rect += 4;
 			}
-		} else if (image.zsize == 3){
+		}
+		else if (image.zsize == 3) {
 			/* add alpha */
 			rect = (uchar *) ibuf->rect;
 			for (x = ibuf->x * ibuf->y; x > 0; x--) {
@@ -479,16 +486,18 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
 			}
 		}
 		
-	} else {	/* bpp == 2 */
+	}
+	else {	/* bpp == 2 */
 		
-		if (image.zsize == 1){
+		if (image.zsize == 1) {
 			fbase = ibuf->rect_float;
 			for (x = ibuf->x * ibuf->y; x > 0; x--) {
 				fbase[0] = 1;
 				fbase[1] = fbase[2] = fbase[3];
 				fbase += 4;
 			}
-		} else if (image.zsize == 2){
+		}
+		else if (image.zsize == 2) {
 			/* grayscale with alpha */
 			fbase = ibuf->rect_float;
 			for (x = ibuf->x * ibuf->y; x > 0; x--) {
@@ -496,7 +505,8 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
 				fbase[1] = fbase[2] = fbase[3];
 				fbase += 4;
 			}
-		} else if (image.zsize == 3){
+		}
+		else if (image.zsize == 3) {
 			/* add alpha */
 			fbase = ibuf->rect_float;
 			for (x = ibuf->x * ibuf->y; x > 0; x--) {
@@ -530,7 +540,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
 static void interleaverow(unsigned char *lptr, unsigned char *cptr, int z, int n)
 {
 	lptr += z;
-	while(n--) {
+	while (n--) {
 		*lptr = *cptr++;
 		lptr += 4;
 	}
@@ -539,7 +549,7 @@ static void interleaverow(unsigned char *lptr, unsigned char *cptr, int z, int n
 static void interleaverow2(float *lptr, unsigned char *cptr, int z, int n)
 {
 	lptr += z;
-	while(n--) {
+	while (n--) {
 		*lptr = ((cptr[0]<<8) | (cptr[1]<<0)) / (float)0xFFFF;		
 		cptr += 2;
 		lptr += 4;
@@ -552,14 +562,14 @@ static void expandrow2(float *optr, unsigned char *iptr, int z)
 	float pixel_f;
 
 	optr += z;
-	while(1) {
+	while (1) {
 		pixel = (iptr[0]<<8) | (iptr[1]<<0);
 		iptr += 2;
 		
 		if ( !(count = (pixel & 0x7f)) )
 			return;
-		if(pixel & 0x80) {
-			while(count>=8) {
+		if (pixel & 0x80) {
+			while (count>=8) {
 				optr[0*4] = ((iptr[0]<<8) | (iptr[1]<<0))/(float)0xFFFF;
 				optr[1*4] = ((iptr[2]<<8) | (iptr[3]<<0))/(float)0xFFFF;
 				optr[2*4] = ((iptr[4]<<8) | (iptr[5]<<0))/(float)0xFFFF;
@@ -572,16 +582,17 @@ static void expandrow2(float *optr, unsigned char *iptr, int z)
 				iptr += 8*2;
 				count -= 8;
 			}
-			while(count--) {
+			while (count--) {
 				*optr = ((iptr[0]<<8) | (iptr[1]<<0))/(float)0xFFFF;
 				iptr+=2;
 				optr+=4;
 			}
-		} else {
+		}
+		else {
 			pixel_f = ((iptr[0]<<8) | (iptr[1]<<0))/(float)0xFFFF;
 			iptr += 2;
 
-			while(count>=8) {
+			while (count>=8) {
 				optr[0*4] = pixel_f;
 				optr[1*4] = pixel_f;
 				optr[2*4] = pixel_f;
@@ -593,7 +604,7 @@ static void expandrow2(float *optr, unsigned char *iptr, int z)
 				optr += 8*4;
 				count -= 8;
 			}
-			while(count--) {
+			while (count--) {
 				*optr = pixel_f;
 				optr+=4;
 			}
@@ -606,12 +617,12 @@ static void expandrow(unsigned char *optr, unsigned char *iptr, int z)
 	unsigned char pixel, count;
 
 	optr += z;
-	while(1) {
+	while (1) {
 		pixel = *iptr++;
 		if ( !(count = (pixel & 0x7f)) )
 			return;
-		if(pixel & 0x80) {
-			while(count>=8) {
+		if (pixel & 0x80) {
+			while (count>=8) {
 				optr[0*4] = iptr[0];
 				optr[1*4] = iptr[1];
 				optr[2*4] = iptr[2];
@@ -624,13 +635,14 @@ static void expandrow(unsigned char *optr, unsigned char *iptr, int z)
 				iptr += 8;
 				count -= 8;
 			}
-			while(count--) {
+			while (count--) {
 				*optr = *iptr++;
 				optr+=4;
 			}
-		} else {
+		}
+		else {
 			pixel = *iptr++;
-			while(count>=8) {
+			while (count>=8) {
 				optr[0*4] = pixel;
 				optr[1*4] = pixel;
 				optr[2*4] = pixel;
@@ -642,7 +654,7 @@ static void expandrow(unsigned char *optr, unsigned char *iptr, int z)
 				optr += 8*4;
 				count -= 8;
 			}
-			while(count--) {
+			while (count--) {
 				*optr = pixel;
 				optr+=4;
 			}
@@ -674,8 +686,8 @@ static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, cons
 	int rlebuflen, goodwrite;
 
 	goodwrite = 1;
-	outf = fopen(name, "wb");
-	if(!outf) return 0;
+	outf = BLI_fopen(name, "wb");
+	if (!outf) return 0;
 
 	tablen = ysize*zsize*sizeof(int);
 
@@ -689,7 +701,7 @@ static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, cons
 	memset(image, 0, sizeof(IMAGE));
 	image->imagic = IMAGIC;
 	image->type = RLE(1);
-	if(zsize>1)
+	if (zsize>1)
 		image->dim = 3;
 	else
 		image->dim = 2;
@@ -710,14 +722,14 @@ static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, cons
 				len = compressrow((uchar *)lumbuf,rlebuf,CHANOFFSET(z),xsize);
 			}
 			else {
-				if(z<4) {
+				if (z<4) {
 					len = compressrow((uchar *)lptr, rlebuf,CHANOFFSET(z),xsize);
 				}
-				else if(z<8 && zptr) {
+				else if (z<8 && zptr) {
 					len = compressrow((uchar *)zptr, rlebuf,CHANOFFSET(z-4),xsize);
 				}
 			}
-			if(len>rlebuflen) {
+			if (len>rlebuflen) {
 				fprintf(stderr,"output_iris: rlebuf is too small - bad poop\n");
 				exit(1);
 			}
@@ -727,7 +739,7 @@ static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, cons
 			pos += len;
 		}
 		lptr += xsize;
-		if(zptr) zptr += xsize;
+		if (zptr) zptr += xsize;
 	}
 
 	fseek(outf,512,SEEK_SET);
@@ -739,7 +751,7 @@ static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, cons
 	MEM_freeN(rlebuf);
 	MEM_freeN(lumbuf);
 	fclose(outf);
-	if(goodwrite)
+	if (goodwrite)
 		return 1;
 	else {
 		fprintf(stderr,"output_iris: not enough space for image!!\n");
@@ -752,7 +764,7 @@ static int output_iris(unsigned int *lptr, int xsize, int ysize, int zsize, cons
 static void lumrow(unsigned char *rgbptr, unsigned char *lumptr, int n)
 {
 	lumptr += CHANOFFSET(0);
-	while(n--) {
+	while (n--) {
 		*lumptr = ILUM(rgbptr[OFFSET_R],rgbptr[OFFSET_G],rgbptr[OFFSET_B]);
 		lumptr += 4;
 		rgbptr += 4;
@@ -770,18 +782,18 @@ static int compressrow(unsigned char *lbuf, unsigned char *rlebuf, int z, int cn
 	ibufend = iptr+cnt*4;
 	optr = rlebuf;
 
-	while(iptr<ibufend) {
+	while (iptr<ibufend) {
 		sptr = iptr;
 		iptr += 8;
-		while((iptr<ibufend)&& ((iptr[-8]!=iptr[-4])||(iptr[-4]!=iptr[0])))
+		while ((iptr<ibufend)&& ((iptr[-8]!=iptr[-4])||(iptr[-4]!=iptr[0])))
 			iptr+=4;
 		iptr -= 8;
 		count = (iptr-sptr)/4;
-		while(count) {
+		while (count) {
 			todo = count>126 ? 126:count;
 			count -= todo;
 			*optr++ = 0x80|todo;
-			while(todo>8) {
+			while (todo>8) {
 				optr[0] = sptr[0*4];
 				optr[1] = sptr[1*4];
 				optr[2] = sptr[2*4];
@@ -795,7 +807,7 @@ static int compressrow(unsigned char *lbuf, unsigned char *rlebuf, int z, int cn
 				sptr += 8*4;
 				todo -= 8;
 			}
-			while(todo--) {
+			while (todo--) {
 				*optr++ = *sptr;
 				sptr += 4;
 			}
@@ -803,10 +815,10 @@ static int compressrow(unsigned char *lbuf, unsigned char *rlebuf, int z, int cn
 		sptr = iptr;
 		cc = *iptr;
 		iptr += 4;
-		while( (iptr<ibufend) && (*iptr == cc) )
+		while ( (iptr<ibufend) && (*iptr == cc) )
 			iptr += 4;
 		count = (iptr-sptr)/4;
-		while(count) {
+		while (count) {
 			todo = count>126 ? 126:count;
 			count -= todo;
 			*optr++ = todo;
diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c
index f8082c9..6abfbdb 100644
--- a/source/blender/imbuf/intern/jp2.c
+++ b/source/blender/imbuf/intern/jp2.c
@@ -43,7 +43,7 @@
 static char JP2_HEAD[]= {0x0, 0x0, 0x0, 0x0C, 0x6A, 0x50, 0x20, 0x20, 0x0D, 0x0A, 0x87, 0x0A};
 
 /* We only need this because of how the presets are set */
-typedef struct img_folder{
+typedef struct img_folder {
 	/** The directory path of the folder containing input images*/
 	char *imgdirpath;
 	/** Output format*/
@@ -54,7 +54,7 @@ typedef struct img_folder{
 	char set_out_format;
 	/** User specified rate stored in case of cinema option*/
 	float *rates;
-}img_fol_t;
+} img_fol_t;
 
 static int check_jp2(unsigned char *mem) /* J2K_CFMT */
 {
@@ -68,24 +68,24 @@ int imb_is_a_jp2(unsigned char *buf)
 
 
 /**
-sample error callback expecting a FILE* client object
-*/
+ * sample error callback expecting a FILE* client object
+ */
 static void error_callback(const char *msg, void *client_data)
 {
 	FILE *stream = (FILE*)client_data;
 	fprintf(stream, "[ERROR] %s", msg);
 }
 /**
-sample warning callback expecting a FILE* client object
-*/
+ * sample warning callback expecting a FILE* client object
+ */
 static void warning_callback(const char *msg, void *client_data)
 {
 	FILE *stream = (FILE*)client_data;
 	fprintf(stream, "[WARNING] %s", msg);
 }
 /**
-sample debug callback expecting no client object
-*/
+ * sample debug callback expecting no client object
+ */
 static void info_callback(const char *msg, void *client_data)
 {
 	(void)client_data;
@@ -146,7 +146,7 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags)
 	/* decode the stream and fill the image structure */
 	image = opj_decode(dinfo, cio);
 	
-	if(!image) {
+	if (!image) {
 		fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
 		opj_destroy_decompress(dinfo);
 		opj_cio_close(cio);
@@ -157,8 +157,7 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags)
 	opj_cio_close(cio);
 
 
-	if((image->numcomps * image->x1 * image->y1) == 0)
-	{
+	if ((image->numcomps * image->x1 * image->y1) == 0) {
 		fprintf(stderr,"\nError: invalid raw image parameters\n");
 		return NULL;
 	}
@@ -196,7 +195,7 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags)
 	ibuf= IMB_allocImBuf(w, h, planes, use_float ? IB_rectfloat : IB_rect);
 	
 	if (ibuf==NULL) {
-		if(dinfo)
+		if (dinfo)
 			opj_destroy_decompress(dinfo);
 		return NULL;
 	}
@@ -218,7 +217,8 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags)
 				else
 					rect_float[3]= 1.0f;
 			}
-		} else {
+		}
+		else {
 			/* rgb or rgba 12bits+ */
 			for (i = 0; i < w * h; i++, rect_float+=4) {
 				index = w * h - ((i) / (w) + 1) * w + (i) % (w);
@@ -234,7 +234,8 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags)
 			}
 		}
 		
-	} else {
+	}
+	else {
 		unsigned char *rect= (unsigned char *)ibuf->rect;
 
 		if (image->numcomps < 3) {
@@ -249,7 +250,8 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags)
 				else
 					rect[3]= 255;
 			}
-		} else {
+		}
+		else {
 			/* 8bit rgb or rgba */
 			for (i = 0; i < w * h; i++, rect+=4) {
 				int index = w * h - ((i) / (w) + 1) * w + (i) % (w);
@@ -267,7 +269,7 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags)
 	}
 	
 	/* free remaining structures */
-	if(dinfo) {
+	if (dinfo) {
 		opj_destroy_decompress(dinfo);
 	}
 	
@@ -293,11 +295,11 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags)
 
 
 /*
-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
-*/
+ * 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
+ */
 
 /* ****************************** COPIED FROM image_to_j2k.c */
 
@@ -329,7 +331,7 @@ static int initialise_4K_poc(opj_poc_t *POC, int numres)
 
 static void cinema_parameters(opj_cparameters_t *parameters)
 {
-	parameters->tile_size_on = false;
+	parameters->tile_size_on = 0; /* FALSE */
 	parameters->cp_tdx=1;
 	parameters->cp_tdy=1;
 	
@@ -366,13 +368,13 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *imag
 	int i;
 	float temp_rate;
 
-	switch (parameters->cp_cinema){
+	switch (parameters->cp_cinema) {
 	case CINEMA2K_24:
 	case CINEMA2K_48:
-		if(parameters->numresolution > 6){
+		if (parameters->numresolution > 6) {
 			parameters->numresolution = 6;
 		}
-		if (!((image->comps[0].w == 2048) || (image->comps[0].h == 1080))){
+		if (!((image->comps[0].w == 2048) || (image->comps[0].h == 1080))) {
 			fprintf(stdout,"Image coordinates %d x %d is not 2K compliant.\nJPEG Digital Cinema Profile-3 "
 				"(2K profile) compliance requires that at least one of coordinates match 2048 x 1080\n",
 				image->comps[0].w,image->comps[0].h);
@@ -381,15 +383,16 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *imag
 	break;
 	
 	case CINEMA4K_24:
-		if(parameters->numresolution < 1){
-				parameters->numresolution = 1;
-			}else if(parameters->numresolution > 7){
-				parameters->numresolution = 7;
-			}
-		if (!((image->comps[0].w == 4096) || (image->comps[0].h == 2160))){
-			fprintf(stdout,"Image coordinates %d x %d is not 4K compliant.\nJPEG Digital Cinema Profile-4" 
-				"(4K profile) compliance requires that at least one of coordinates match 4096 x 2160\n",
-				image->comps[0].w,image->comps[0].h);
+		if (parameters->numresolution < 1) {
+			parameters->numresolution = 1;
+		}
+		else if (parameters->numresolution > 7) {
+			parameters->numresolution = 7;
+		}
+		if (!((image->comps[0].w == 4096) || (image->comps[0].h == 2160))) {
+			fprintf(stdout,"Image coordinates %d x %d is not 4K compliant.\nJPEG Digital Cinema Profile-4"
+					"(4K profile) compliance requires that at least one of coordinates match 4096 x 2160\n",
+					image->comps[0].w,image->comps[0].h);
 			parameters->cp_rsiz = STD_RSIZ;
 		}
 		parameters->numpocs = initialise_4K_poc(parameters->POC,parameters->numresolution);
@@ -399,21 +402,23 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *imag
 		break;
 	}
 
-	switch (parameters->cp_cinema){
+	switch (parameters->cp_cinema) {
 	case CINEMA2K_24:
 	case CINEMA4K_24:
-		for(i=0 ; i<parameters->tcp_numlayers ; i++){
-			temp_rate = 0 ;
-			if (img_fol->rates[i]== 0){
+		for (i=0 ; i<parameters->tcp_numlayers ; i++) {
+			temp_rate = 0;
+			if (img_fol->rates[i]== 0) {
 				parameters->tcp_rates[0]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/ 
 					(CINEMA_24_CS * 8 * image->comps[0].dx * image->comps[0].dy);
-			}else{
+			}
+			else {
 				temp_rate =((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/ 
 					(img_fol->rates[i] * 8 * image->comps[0].dx * image->comps[0].dy);
-				if (temp_rate > CINEMA_24_CS ){
+				if (temp_rate > CINEMA_24_CS ) {
 					parameters->tcp_rates[i]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/ 
 						(CINEMA_24_CS * 8 * image->comps[0].dx * image->comps[0].dy);
-				}else{
+				}
+				else {
 					parameters->tcp_rates[i]= img_fol->rates[i];
 				}
 			}
@@ -422,18 +427,20 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *imag
 		break;
 		
 	case CINEMA2K_48:
-		for(i=0 ; i<parameters->tcp_numlayers ; i++){
-			temp_rate = 0 ;
-			if (img_fol->rates[i]== 0){
+		for (i=0 ; i<parameters->tcp_numlayers ; i++) {
+			temp_rate = 0;
+			if (img_fol->rates[i]== 0) {
 				parameters->tcp_rates[0]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/ 
 					(CINEMA_48_CS * 8 * image->comps[0].dx * image->comps[0].dy);
-			}else{
+			}
+			else {
 				temp_rate =((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/ 
 					(img_fol->rates[i] * 8 * image->comps[0].dx * image->comps[0].dy);
-				if (temp_rate > CINEMA_48_CS ){
+				if (temp_rate > CINEMA_48_CS ) {
 					parameters->tcp_rates[0]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/ 
 						(CINEMA_48_CS * 8 * image->comps[0].dx * image->comps[0].dy);
-				}else{
+				}
+				else {
 					parameters->tcp_rates[i]= img_fol->rates[i];
 				}
 			}
@@ -478,9 +485,9 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
 				parameters->cp_cinema= CINEMA2K_24;
 			}
 		}
-		if (parameters->cp_cinema){
+		if (parameters->cp_cinema) {
 			img_fol.rates = (float*)MEM_mallocN(parameters->tcp_numlayers * sizeof(float), "jp2_rates");
-			for(i=0; i< parameters->tcp_numlayers; i++){
+			for (i=0; i< parameters->tcp_numlayers; i++) {
 				img_fol.rates[i] = parameters->tcp_rates[i];
 			}
 			cinema_parameters(parameters);
@@ -509,7 +516,7 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
 	
 	/* initialize image components */
 	memset(&cmptparm[0], 0, 4 * sizeof(opj_image_cmptparm_t));
-	for(i = 0; i < numcomps; i++) {
+	for (i = 0; i < numcomps; i++) {
 		cmptparm[i].prec = prec;
 		cmptparm[i].bpp = prec;
 		cmptparm[i].sgnd = 0;
@@ -520,7 +527,7 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
 	}
 	/* create the image */
 	image = opj_image_create(numcomps, &cmptparm[0], color_space);
-	if(!image) {
+	if (!image) {
 		printf("Error: opj_image_create() failed\n");
 		return NULL;
 	}
@@ -546,9 +553,9 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
 		
 		switch (prec) {
 		case 8: /* Convert blenders float color channels to 8,12 or 16bit ints */
-			for(y=h-1; y>=0; y--) {
+			for (y=h-1; y>=0; y--) {
 				y_row = y*w;
-				for(x=0; x<w; x++, rect_float+=4) {
+				for (x=0; x<w; x++, rect_float+=4) {
 					i = y_row + x;
 					
 					if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
@@ -566,9 +573,9 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
 			break;
 			
 		case 12:
-			for(y=h-1; y>=0; y--) {
+			for (y=h-1; y>=0; y--) {
 				y_row = y*w;
-				for(x=0; x<w; x++, rect_float+=4) {
+				for (x=0; x<w; x++, rect_float+=4) {
 					i = y_row + x;
 					
 					if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
@@ -585,9 +592,9 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
 			}
 			break;
 		case 16:
-			for(y=h-1; y>=0; y--) {
+			for (y=h-1; y>=0; y--) {
 				y_row = y*w;
-				for(x=0; x<w; x++, rect_float+=4) {
+				for (x=0; x<w; x++, rect_float+=4) {
 					i = y_row + x;
 					
 					if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
@@ -604,13 +611,14 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
 			}
 			break;
 		}
-	} else {
+	}
+	else {
 		/* just use rect*/
 		switch (prec) {
 		case 8:
-			for(y=h-1; y>=0; y--) {
+			for (y=h-1; y>=0; y--) {
 				y_row = y*w;
-				for(x=0; x<w; x++, rect+=4) {
+				for (x=0; x<w; x++, rect+=4) {
 					i = y_row + x;
 				
 					image->comps[0].data[i] = rect[0];
@@ -623,9 +631,9 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
 			break;
 			
 		case 12: /* Up Sampling, a bit pointless but best write the bit depth requested */
-			for(y=h-1; y>=0; y--) {
+			for (y=h-1; y>=0; y--) {
 				y_row = y*w;
-				for(x=0; x<w; x++, rect+=4) {
+				for (x=0; x<w; x++, rect+=4) {
 					i = y_row + x;
 				
 					image->comps[0].data[i]= UPSAMPLE_8_TO_12(rect[0]);
@@ -637,9 +645,9 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
 			}
 			break;
 		case 16:
-			for(y=h-1; y>=0; y--) {
+			for (y=h-1; y>=0; y--) {
 				y_row = y*w;
-				for(x=0; x<w; x++, rect+=4) {
+				for (x=0; x<w; x++, rect+=4) {
 					i = y_row + x;
 				
 					image->comps[0].data[i]= UPSAMPLE_8_TO_16(rect[0]);
@@ -656,7 +664,7 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
 	/* Decide if MCT should be used */
 	parameters->tcp_mct = image->numcomps == 3 ? 1 : 0;
 	
-	if(parameters->cp_cinema){
+	if (parameters->cp_cinema) {
 		cinema_setup_encoder(parameters,image,&img_fol);
 	}
 	
@@ -680,9 +688,9 @@ int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags)
 	(void)flags; /* unused */
 	
 	/*
-	configure the event callbacks (not required)
-	setting of each callback is optionnal
-	*/
+	 * configure the event callbacks (not required)
+	 * setting of each callback is optionnal
+	 */
 	memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
 	event_mgr.error_handler = error_callback;
 	event_mgr.warning_handler = warning_callback;
@@ -693,7 +701,7 @@ int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags)
 	
 	/* compression ratio */
 	/* invert range, from 10-100, 100-1
-	* where jpeg see's 1 and highest quality (lossless) and 100 is very low quality*/
+	 * where jpeg see's 1 and highest quality (lossless) and 100 is very low quality*/
 	parameters.tcp_rates[0]= ((100-quality)/90.0f*99.0f) + 1;
 
 	
@@ -732,7 +740,7 @@ int imb_savejp2(struct ImBuf *ibuf, const char *name, int flags)
 		codestream_length = cio_tell(cio);
 
 		/* write the buffer to disk */
-		f = fopen(name, "wb");
+		f = BLI_fopen(name, "wb");
 		
 		if (!f) {
 			fprintf(stderr, "failed to open %s for writing\n", name);
diff --git a/source/blender/imbuf/intern/jpeg.c b/source/blender/imbuf/intern/jpeg.c
index a43a867..3f3ebc5 100644
--- a/source/blender/imbuf/intern/jpeg.c
+++ b/source/blender/imbuf/intern/jpeg.c
@@ -66,14 +66,14 @@ static ImBuf * ibJpegImageFromCinfo(struct jpeg_decompress_struct * cinfo, int f
 
 /*
  * In principle there are 4 jpeg formats.
- * 
+ *
  * 1. jpeg - standard printing, u & v at quarter of resulution
  * 2. jvid - standaard video, u & v half resolution, frame not interlaced
-
-type 3 is unsupported as of jul 05 2000 Frank.
-
+ *
+ * type 3 is unsupported as of jul 05 2000 Frank.
+ *
  * 3. jstr - as 2, but written in 2 separate fields
-
+ *
  * 4. jmax - no scaling in the components
  */
 
@@ -142,8 +142,8 @@ static boolean fill_input_buffer(j_decompress_ptr cinfo)
 	my_src_ptr src = (my_src_ptr) cinfo->src;
 
 	/* Since we have given all we have got already
-	* we simply fake an end of file
-	*/
+	 * we simply fake an end of file
+	 */
 
 	src->pub.next_input_byte = src->terminal;
 	src->pub.bytes_in_buffer = 2;
@@ -158,7 +158,7 @@ static void skip_input_data(j_decompress_ptr cinfo, long num_bytes)
 {
 	my_src_ptr src = (my_src_ptr) cinfo->src;
 
-	if(num_bytes > 0) {
+	if (num_bytes > 0) {
 		// prevent skipping over file end
 		size_t skip_size = (size_t)num_bytes <= src->pub.bytes_in_buffer ? num_bytes : src->pub.bytes_in_buffer;
 
@@ -177,8 +177,7 @@ static void memory_source(j_decompress_ptr cinfo, unsigned char *buffer, size_t
 {
 	my_src_ptr src;
 
-	if (cinfo->src == NULL)
-	{	/* first time for this JPEG object? */
+	if (cinfo->src == NULL) { /* first time for this JPEG object? */
 		cinfo->src = (struct jpeg_source_mgr *)(*cinfo->mem->alloc_small)
 			((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof(my_source_mgr));
 	}
@@ -187,7 +186,7 @@ static void memory_source(j_decompress_ptr cinfo, unsigned char *buffer, size_t
 	src->pub.init_source		= init_source;
 	src->pub.fill_input_buffer	= fill_input_buffer;
 	src->pub.skip_input_data	= skip_input_data;
-	src->pub.resync_to_restart	= jpeg_resync_to_restart; 
+	src->pub.resync_to_restart	= jpeg_resync_to_restart;
 	src->pub.term_source		= term_source;
 
 	src->pub.bytes_in_buffer	= size;
@@ -329,7 +328,7 @@ static ImBuf * ibJpegImageFromCinfo(struct jpeg_decompress_struct * cinfo, int f
 							rect[0] = rect[1] = rect[2] = *buffer++;
 							rect += 4;
 						}
-							break;
+						break;
 					case 3:
 						for (x=ibuf->x; x >0; x--) {
 							rect[3] = 255;
@@ -338,7 +337,7 @@ static ImBuf * ibJpegImageFromCinfo(struct jpeg_decompress_struct * cinfo, int f
 							rect[2] = *buffer++;
 							rect += 4;
 						}
-							break;
+						break;
 					case 4:
 						for (x=ibuf->x; x >0; x--) {
 							r = *buffer++;
@@ -361,7 +360,7 @@ static ImBuf * ibJpegImageFromCinfo(struct jpeg_decompress_struct * cinfo, int f
 							if (b & 0xffffff00) {
 								if (b < 0) b = 0;
 								else b = 255;
-							}							
+							}
 							
 							rect[3] = 255 - k;
 							rect[2] = b;
@@ -373,8 +372,8 @@ static ImBuf * ibJpegImageFromCinfo(struct jpeg_decompress_struct * cinfo, int f
 			}
 
 			marker= cinfo->marker_list;
-			while(marker) {
-				if(marker->marker != JPEG_COM)
+			while (marker) {
+				if (marker->marker != JPEG_COM)
 					goto next_stamp_marker;
 
 				/*
@@ -386,7 +385,7 @@ static ImBuf * ibJpegImageFromCinfo(struct jpeg_decompress_struct * cinfo, int f
 				 * That is why we need split it to the
 				 * common key/value here.
 				 */
-				if(strncmp((char *) marker->data, "Blender", 7)) {
+				if (strncmp((char *) marker->data, "Blender", 7)) {
 					/*
 					 * Maybe the file have text that
 					 * we don't know "what it's", in that
@@ -406,7 +405,7 @@ static ImBuf * ibJpegImageFromCinfo(struct jpeg_decompress_struct * cinfo, int f
 				/*
 				 * A little paranoid, but the file maybe
 				 * is broken... and a "extra" check is better
-				 * that a segfaul ;)
+				 * then segfault ;)
 				 */
 				if (!key) {
 					MEM_freeN(str);
@@ -433,7 +432,7 @@ next_stamp_marker:
 		}
 		
 		jpeg_destroy((j_common_ptr) cinfo);
-		if(ibuf) {
+		if (ibuf) {
 			ibuf->ftype = ibuf_ftype;
 			ibuf->profile = IB_PROFILE_SRGB;
 		}
@@ -448,7 +447,7 @@ ImBuf * imb_load_jpeg (unsigned char * buffer, size_t size, int flags)
 	struct my_error_mgr jerr;
 	ImBuf * ibuf;
 
-	if(!imb_is_a_jpeg(buffer)) return NULL;
+	if (!imb_is_a_jpeg(buffer)) return NULL;
 	
 	cinfo->err = jpeg_std_error(&jerr.pub);
 	jerr.pub.error_exit = jpeg_error;
@@ -489,11 +488,11 @@ static void write_jpeg(struct jpeg_compress_struct * cinfo, struct ImBuf * ibuf)
 	memcpy(neogeo + 6, &ibuf_ftype, 4);
 	jpeg_write_marker(cinfo, 0xe1, (JOCTET*) neogeo, 10);
 
-	if(ibuf->metadata) {
+	if (ibuf->metadata) {
 		/* key + max value + "Blender" */
 		text= MEM_mallocN(530, "stamp info read");
 		iptr= ibuf->metadata;
-		while(iptr) {
+		while (iptr) {
 			if (!strcmp (iptr->key, "None")) {
 				jpeg_write_marker(cinfo, JPEG_COM, (JOCTET *) iptr->value, strlen (iptr->value) + 1);
 				goto next_stamp_info;
@@ -521,31 +520,31 @@ next_stamp_info:
 					 cinfo->input_components *
 					 cinfo->image_width, "jpeg row_pointer");
 
-	for(y = ibuf->y - 1; y >= 0; y--){
+	for (y = ibuf->y - 1; y >= 0; y--) {
 		rect = (uchar *) (ibuf->rect + y * ibuf->x);
 		buffer = row_pointer[0];
 
-		switch(cinfo->in_color_space){
-		case JCS_RGB:
-			for (x = 0; x < ibuf->x; x++) {
-				*buffer++ = rect[0];
-				*buffer++ = rect[1];
-				*buffer++ = rect[2];
-				rect += 4;
-			}
-			break;
-		case JCS_GRAYSCALE:
-			for (x = 0; x < ibuf->x; x++) {
-				*buffer++ = rect[0];
-				rect += 4;
-			}
-			break;
-		case JCS_UNKNOWN:
-			memcpy(buffer, rect, 4 * ibuf->x);
-			break;
-			/* default was missing... intentional ? */
-		default:
-			; /* do nothing */
+		switch(cinfo->in_color_space) {
+			case JCS_RGB:
+				for (x = 0; x < ibuf->x; x++) {
+					*buffer++ = rect[0];
+					*buffer++ = rect[1];
+					*buffer++ = rect[2];
+					rect += 4;
+				}
+				break;
+			case JCS_GRAYSCALE:
+				for (x = 0; x < ibuf->x; x++) {
+					*buffer++ = rect[0];
+					rect += 4;
+				}
+				break;
+			case JCS_UNKNOWN:
+				memcpy(buffer, rect, 4 * ibuf->x);
+				break;
+				/* default was missing... intentional ? */
+			default:
+				; /* do nothing */
 		}
 
 		jpeg_write_scanlines(cinfo, row_pointer, 1);
@@ -578,19 +577,19 @@ static int init_jpeg(FILE * outfile, struct jpeg_compress_struct * cinfo, struct
 
 	if (ibuf->planes == 32) cinfo->in_color_space = JCS_UNKNOWN;
 #endif
-	switch(cinfo->in_color_space){
-	case JCS_RGB:
-		cinfo->input_components = 3;
-		break;
-	case JCS_GRAYSCALE:
-		cinfo->input_components = 1;
-		break;
-	case JCS_UNKNOWN:
-		cinfo->input_components = 4;
-		break;
-		/* default was missing... intentional ? */
-	default:
-		; /* do nothing */
+	switch(cinfo->in_color_space) {
+		case JCS_RGB:
+			cinfo->input_components = 3;
+			break;
+		case JCS_GRAYSCALE:
+			cinfo->input_components = 1;
+			break;
+		case JCS_UNKNOWN:
+			cinfo->input_components = 4;
+			break;
+			/* default was missing... intentional ? */
+		default:
+			; /* do nothing */
 	}
 	jpeg_set_defaults(cinfo);
 	
@@ -609,7 +608,7 @@ static int save_stdjpeg(const char *name, struct ImBuf *ibuf)
 	struct jpeg_compress_struct _cinfo, *cinfo = &_cinfo;
 	struct my_error_mgr jerr;
 
-	if ((outfile = fopen(name, "wb")) == NULL) return 0;
+	if ((outfile = BLI_fopen(name, "wb")) == NULL) return 0;
 	jpeg_default_quality = 75;
 
 	cinfo->err = jpeg_std_error(&jerr.pub);
@@ -643,7 +642,7 @@ static int save_vidjpeg(const char *name, struct ImBuf *ibuf)
 	struct jpeg_compress_struct _cinfo, *cinfo = &_cinfo;
 	struct my_error_mgr jerr;
 
-	if ((outfile = fopen(name, "wb")) == NULL) return 0;
+	if ((outfile = BLI_fopen(name, "wb")) == NULL) return 0;
 	jpeg_default_quality = 90;
 
 	cinfo->err = jpeg_std_error(&jerr.pub);
@@ -693,8 +692,8 @@ static int save_jstjpeg(const char *name, struct ImBuf *ibuf)
 	IMB_rectcpy(tbuf, ibuf, 0, 0, 0, 0, ibuf->x, ibuf->y);
 	sprintf(fieldname, "%s.jf0", name);
 
-	returnval = save_vidjpeg(fieldname, tbuf) ;
-		if (returnval == 1) {
+	returnval = save_vidjpeg(fieldname, tbuf);
+	if (returnval == 1) {
 		IMB_rectcpy(tbuf, ibuf, 0, 0, tbuf->x, 0, ibuf->x, ibuf->y);
 		sprintf(fieldname, "%s.jf1", name);
 		returnval = save_vidjpeg(fieldname, tbuf);
@@ -713,7 +712,7 @@ static int save_maxjpeg(const char *name, struct ImBuf *ibuf)
 	struct jpeg_compress_struct _cinfo, *cinfo = &_cinfo;
 	struct my_error_mgr jerr;
 
-	if ((outfile = fopen(name, "wb")) == NULL) return 0;
+	if ((outfile = BLI_fopen(name, "wb")) == NULL) return 0;
 	jpeg_default_quality = 100;
 
 	cinfo->err = jpeg_std_error(&jerr.pub);
diff --git a/source/blender/imbuf/intern/metadata.c b/source/blender/imbuf/intern/metadata.c
index e6b6e9a..0da7358 100644
--- a/source/blender/imbuf/intern/metadata.c
+++ b/source/blender/imbuf/intern/metadata.c
@@ -84,7 +84,7 @@ int IMB_metadata_get_field(struct ImBuf* img, const char* key, char* field, int
 	return retval;
 }
 
-int IMB_metadata_add_field(struct ImBuf* img, const char* key, const char* field)
+int IMB_metadata_add_field(struct ImBuf* img, const char* key, const char* value)
 {
 	ImMetaData *info;
 	ImMetaData *last;
@@ -95,7 +95,8 @@ int IMB_metadata_add_field(struct ImBuf* img, const char* key, const char* field
 	if (!img->metadata) {
 		img->metadata = MEM_callocN(sizeof(ImMetaData), "ImMetaData");
 		info = img->metadata;
-	} else {
+	}
+	else {
 		info = img->metadata;
 		last = info;
 		while (info) {
@@ -106,7 +107,7 @@ int IMB_metadata_add_field(struct ImBuf* img, const char* key, const char* field
 		last->next = info;
 	}
 	info->key = BLI_strdup(key);
-	info->value = BLI_strdup(field);
+	info->value = BLI_strdup(value);
 	return 1;
 }
 
diff --git a/source/blender/imbuf/intern/moviecache.c b/source/blender/imbuf/intern/moviecache.c
index fd0a037..8b18be8 100644
--- a/source/blender/imbuf/intern/moviecache.c
+++ b/source/blender/imbuf/intern/moviecache.c
@@ -77,29 +77,29 @@ typedef struct MovieCacheItem {
 
 static unsigned int moviecache_hashhash(const void *keyv)
 {
-	MovieCacheKey *key= (MovieCacheKey*)keyv;
+	MovieCacheKey *key = (MovieCacheKey*)keyv;
 
 	return key->cache_owner->hashfp(key->userkey);
 }
 
 static int moviecache_hashcmp(const void *av, const void *bv)
 {
-	const MovieCacheKey *a= (MovieCacheKey*)av;
-	const MovieCacheKey *b= (MovieCacheKey*)bv;
+	const MovieCacheKey *a = (MovieCacheKey*)av;
+	const MovieCacheKey *b = (MovieCacheKey*)bv;
 
 	return a->cache_owner->cmpfp(a->userkey, b->userkey);
 }
 
 static void moviecache_keyfree(void *val)
 {
-	MovieCacheKey *key= (MovieCacheKey*)val;
+	MovieCacheKey *key = (MovieCacheKey*)val;
 
 	BLI_mempool_free(key->cache_owner->keys_pool, key);
 }
 
 static void moviecache_valfree(void *val)
 {
-	MovieCacheItem *item= (MovieCacheItem*)val;
+	MovieCacheItem *item = (MovieCacheItem*)val;
 
 	if (item->ibuf) {
 		MEM_CacheLimiter_unmanage(item->c_handle);
@@ -114,13 +114,13 @@ static void check_unused_keys(MovieCache *cache)
 	GHashIterator *iter;
 
 	iter= BLI_ghashIterator_new(cache->hash);
-	while(!BLI_ghashIterator_isDone(iter)) {
-		MovieCacheKey *key= BLI_ghashIterator_getKey(iter);
-		MovieCacheItem *item= BLI_ghashIterator_getValue(iter);
+	while (!BLI_ghashIterator_isDone(iter)) {
+		MovieCacheKey *key = BLI_ghashIterator_getKey(iter);
+		MovieCacheItem *item = BLI_ghashIterator_getValue(iter);
 
 		BLI_ghashIterator_step(iter);
 
-		if(!item->ibuf)
+		if (!item->ibuf)
 			BLI_ghash_remove(cache->hash, key, moviecache_keyfree, moviecache_valfree);
 	}
 
@@ -129,20 +129,20 @@ static void check_unused_keys(MovieCache *cache)
 
 static int compare_int(const void *av, const void *bv)
 {
-	const int *a= (int *)av;
-	const int *b= (int *)bv;
-	return *a-*b;
+	const int *a = (int *)av;
+	const int *b = (int *)bv;
+	return *a - *b;
 }
 
 static void IMB_moviecache_destructor(void *p)
 {
-	MovieCacheItem *item= (MovieCacheItem *) p;
+	MovieCacheItem *item = (MovieCacheItem *) p;
 
 	if (item && item->ibuf) {
 		IMB_freeImBuf(item->ibuf);
 
-		item->ibuf= NULL;
-		item->c_handle= NULL;
+		item->ibuf = NULL;
+		item->c_handle = NULL;
 	}
 }
 
@@ -150,27 +150,27 @@ static void IMB_moviecache_destructor(void *p)
 static size_t IMB_get_size_in_memory(ImBuf *ibuf)
 {
 	int a;
-	size_t size= 0, channel_size= 0;
+	size_t size = 0, channel_size = 0;
 
-	size+= sizeof(ImBuf);
+	size += sizeof(ImBuf);
 
-	if(ibuf->rect)
-		channel_size+= sizeof(char);
+	if (ibuf->rect)
+		channel_size += sizeof(char);
 
-	if(ibuf->rect_float)
-		channel_size+= sizeof(float);
+	if (ibuf->rect_float)
+		channel_size += sizeof(float);
 
-	size+= channel_size*ibuf->x*ibuf->y*ibuf->channels;
+	 size += channel_size * ibuf->x * ibuf->y * ibuf->channels;
 
-	if(ibuf->miptot) {
-		for(a= 0; a<ibuf->miptot; a++) {
-			if(ibuf->mipmap[a])
-				size+= IMB_get_size_in_memory(ibuf->mipmap[a]);
+	if (ibuf->miptot) {
+		for (a = 0; a < ibuf->miptot; a++) {
+			if (ibuf->mipmap[a])
+				size += IMB_get_size_in_memory(ibuf->mipmap[a]);
 		}
 	}
 
-	if(ibuf->tiles) {
-		size+= sizeof(unsigned int)*ibuf->ytiles*ibuf->xtiles;
+	if (ibuf->tiles) {
+		size += sizeof(unsigned int)*ibuf->ytiles*ibuf->xtiles;
 	}
 
 	return size;
@@ -178,23 +178,23 @@ static size_t IMB_get_size_in_memory(ImBuf *ibuf)
 
 static size_t get_item_size (void *p)
 {
-	size_t size= sizeof(MovieCacheItem);
-	MovieCacheItem *item= (MovieCacheItem *) p;
+	size_t size = sizeof(MovieCacheItem);
+	MovieCacheItem *item = (MovieCacheItem *) p;
 
-	if(item->ibuf)
-		size+= IMB_get_size_in_memory(item->ibuf);
+	if (item->ibuf)
+		size += IMB_get_size_in_memory(item->ibuf);
 
 	return size;
 }
 
 void IMB_moviecache_init(void)
 {
-	limitor= new_MEM_CacheLimiter(IMB_moviecache_destructor, get_item_size);
+	limitor = new_MEM_CacheLimiter(IMB_moviecache_destructor, get_item_size);
 }
 
 void IMB_moviecache_destruct(void)
 {
-	if(limitor)
+	if (limitor)
 		delete_MEM_CacheLimiter(limitor);
 }
 
@@ -203,17 +203,17 @@ struct MovieCache *IMB_moviecache_create(int keysize, GHashHashFP hashfp, GHashC
 {
 	MovieCache *cache;
 
-	cache= MEM_callocN(sizeof(MovieCache), "MovieCache");
-	cache->keys_pool= BLI_mempool_create(sizeof(MovieCacheKey), 64, 64, FALSE, FALSE);
-	cache->items_pool= BLI_mempool_create(sizeof(MovieCacheItem), 64, 64, FALSE, FALSE);
-	cache->userkeys_pool= BLI_mempool_create(keysize, 64, 64, FALSE, FALSE);
-	cache->hash= BLI_ghash_new(moviecache_hashhash, moviecache_hashcmp, "MovieClip ImBuf cache hash");
+	cache = MEM_callocN(sizeof(MovieCache), "MovieCache");
+	cache->keys_pool = BLI_mempool_create(sizeof(MovieCacheKey), 64, 64, 0);
+	cache->items_pool = BLI_mempool_create(sizeof(MovieCacheItem), 64, 64, 0);
+	cache->userkeys_pool = BLI_mempool_create(keysize, 64, 64, 0);
+	cache->hash = BLI_ghash_new(moviecache_hashhash, moviecache_hashcmp, "MovieClip ImBuf cache hash");
 
-	cache->keysize= keysize;
-	cache->hashfp= hashfp;
-	cache->cmpfp= cmpfp;
-	cache->getdatafp= getdatafp;
-	cache->proxy= -1;
+	cache->keysize = keysize;
+	cache->hashfp = hashfp;
+	cache->cmpfp = cmpfp;
+	cache->getdatafp = getdatafp;
+	cache->proxy = -1;
 
 	return cache;
 }
@@ -223,26 +223,26 @@ void IMB_moviecache_put(MovieCache *cache, void *userkey, ImBuf *ibuf)
 	MovieCacheKey *key;
 	MovieCacheItem *item;
 
-	if(!limitor)
+	if (!limitor)
 		IMB_moviecache_init();
 
 	IMB_refImBuf(ibuf);
 
-	key= BLI_mempool_alloc(cache->keys_pool);
-	key->cache_owner= cache;
-	key->userkey= BLI_mempool_alloc(cache->userkeys_pool);
+	key = BLI_mempool_alloc(cache->keys_pool);
+	key->cache_owner = cache;
+	key->userkey = BLI_mempool_alloc(cache->userkeys_pool);
 	memcpy(key->userkey, userkey, cache->keysize);
 
-	item= BLI_mempool_alloc(cache->items_pool);
-	item->ibuf= ibuf;
-	item->cache_owner= cache;
-	item->last_access= cache->curtime++;
-	item->c_handle= NULL;
+	item = BLI_mempool_alloc(cache->items_pool);
+	item->ibuf = ibuf;
+	item->cache_owner = cache;
+	item->last_access = cache->curtime++;
+	item->c_handle = NULL;
 
 	BLI_ghash_remove(cache->hash, key, moviecache_keyfree, moviecache_valfree);
 	BLI_ghash_insert(cache->hash, key, item);
 
-	item->c_handle= MEM_CacheLimiter_insert(limitor, item);
+	item->c_handle = MEM_CacheLimiter_insert(limitor, item);
 
 	MEM_CacheLimiter_ref(item->c_handle);
 	MEM_CacheLimiter_enforce_limits(limitor);
@@ -251,7 +251,7 @@ void IMB_moviecache_put(MovieCache *cache, void *userkey, ImBuf *ibuf)
 	/* cache limiter can't remove unused keys which points to destoryed values */
 	check_unused_keys(cache);
 
-	if(cache->points) {
+	if (cache->points) {
 		MEM_freeN(cache->points);
 		cache->points= NULL;
 	}
@@ -262,14 +262,14 @@ ImBuf* IMB_moviecache_get(MovieCache *cache, void *userkey)
 	MovieCacheKey key;
 	MovieCacheItem *item;
 
-	key.cache_owner= cache;
-	key.userkey= userkey;
-	item= (MovieCacheItem*)BLI_ghash_lookup(cache->hash, &key);
+	key.cache_owner = cache;
+	key.userkey = userkey;
+	item = (MovieCacheItem*)BLI_ghash_lookup(cache->hash, &key);
 
-	if(item) {
-		item->last_access= cache->curtime++;
+	if (item) {
+		item->last_access = cache->curtime++;
 
-		if(item->ibuf) {
+		if (item->ibuf) {
 			MEM_CacheLimiter_touch(item->c_handle);
 			IMB_refImBuf(item->ibuf);
 
@@ -288,7 +288,7 @@ void IMB_moviecache_free(MovieCache *cache)
 	BLI_mempool_destroy(cache->items_pool);
 	BLI_mempool_destroy(cache->userkeys_pool);
 
-	if(cache->points)
+	if (cache->points)
 		MEM_freeN(cache->points);
 
 	MEM_freeN(cache);
@@ -297,40 +297,41 @@ void IMB_moviecache_free(MovieCache *cache)
 /* get segments of cached frames. useful for debugging cache policies */
 void IMB_moviecache_get_cache_segments(MovieCache *cache, int proxy, int render_flags, int *totseg_r, int **points_r)
 {
-	*totseg_r= 0;
-	*points_r= NULL;
+	*totseg_r = 0;
+	*points_r = NULL;
 
-	if(!cache->getdatafp)
+	if (!cache->getdatafp)
 		return;
 
-	if(cache->proxy!=proxy || cache->render_flags!=render_flags) {
-		if(cache->points)
+	if (cache->proxy != proxy || cache->render_flags != render_flags) {
+		if (cache->points)
 			MEM_freeN(cache->points);
 
-		cache->points= NULL;
+		cache->points = NULL;
 	}
 
-	if(cache->points) {
-		*totseg_r= cache->totseg;
-		*points_r= cache->points;
-	} else {
-		int totframe= BLI_ghash_size(cache->hash);
-		int *frames= MEM_callocN(totframe*sizeof(int), "movieclip cache frames");
-		int a, totseg= 0;
+	if (cache->points) {
+		*totseg_r = cache->totseg;
+		*points_r = cache->points;
+	}
+	else {
+		int totframe = BLI_ghash_size(cache->hash);
+		int *frames = MEM_callocN(totframe*sizeof(int), "movieclip cache frames");
+		int a, totseg = 0;
 		GHashIterator *iter;
 
-		iter= BLI_ghashIterator_new(cache->hash);
+		iter = BLI_ghashIterator_new(cache->hash);
 		a= 0;
-		while(!BLI_ghashIterator_isDone(iter)) {
-			MovieCacheKey *key= BLI_ghashIterator_getKey(iter);
-			MovieCacheItem *item= BLI_ghashIterator_getValue(iter);
+		while (!BLI_ghashIterator_isDone(iter)) {
+			MovieCacheKey *key = BLI_ghashIterator_getKey(iter);
+			MovieCacheItem *item = BLI_ghashIterator_getValue(iter);
 			int framenr, curproxy, curflags;
 
-			if(item->ibuf) {
+			if (item->ibuf) {
 				cache->getdatafp(key->userkey, &framenr, &curproxy, &curflags);
 
-				if(curproxy==proxy && curflags==render_flags)
-					frames[a++]= framenr;
+				if (curproxy == proxy && curflags == render_flags)
+					frames[a++] = framenr;
 			}
 
 			BLI_ghashIterator_step(iter);
@@ -341,40 +342,40 @@ void IMB_moviecache_get_cache_segments(MovieCache *cache, int proxy, int render_
 		qsort(frames, totframe, sizeof(int), compare_int);
 
 		/* count */
-		for(a= 0; a<totframe; a++) {
-			if(a && frames[a]-frames[a-1]!=1)
+		for (a = 0; a < totframe; a++) {
+			if (a && frames[a] - frames[a - 1] != 1)
 				totseg++;
 
-			if(a==totframe-1)
+			if (a == totframe - 1)
 				totseg++;
 		}
 
-		if(totseg) {
+		if (totseg) {
 			int b, *points;
 
-			points= MEM_callocN(2*sizeof(int)*totseg, "movieclip cache segments");
+			points = MEM_callocN(2*sizeof(int)*totseg, "movieclip cache segments");
 
 			/* fill */
-			for(a= 0, b= 0; a<totframe; a++) {
-				if(a==0)
-					points[b++]= frames[a];
+			for (a = 0, b = 0; a < totframe; a++) {
+				if (a == 0)
+					points[b++] = frames[a];
 
-				if(a && frames[a]-frames[a-1]!=1) {
-					points[b++]= frames[a-1];
-					points[b++]= frames[a];
+				if (a && frames[a] - frames[a - 1] != 1) {
+					points[b++] = frames[a - 1];
+					points[b++] = frames[a];
 				}
 
-				if(a==totframe-1)
-					points[b++]= frames[a];
+				if (a == totframe - 1)
+					points[b++] = frames[a];
 			}
 
-			*totseg_r= totseg;
-			*points_r= points;
+			*totseg_r = totseg;
+			*points_r = points;
 
-			cache->totseg= totseg;
-			cache->points= points;
-			cache->proxy= proxy;
-			cache->render_flags= render_flags;
+			cache->totseg = totseg;
+			cache->points = points;
+			cache->proxy = proxy;
+			cache->render_flags = render_flags;
 		}
 
 		MEM_freeN(frames);
diff --git a/source/blender/imbuf/intern/openexr/SConscript b/source/blender/imbuf/intern/openexr/SConscript
index 082bb82..e590077 100644
--- a/source/blender/imbuf/intern/openexr/SConscript
+++ b/source/blender/imbuf/intern/openexr/SConscript
@@ -15,4 +15,7 @@ incs += Split(env['BF_OPENEXR_INC'])
 
 defs = ['WITH_OPENEXR']
 
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+    incs.append(env['BF_PTHREADS_INC'])
+
 env.BlenderLib ('bf_imbuf_openexr', source_files, incs, defs, libtype=['core','player'], priority = [225,180])
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index a5a9427..ff3a816 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -1,8 +1,4 @@
-/** \file blender/imbuf/intern/openexr/openexr_api.cpp
- *  \ingroup openexr
- */
 /*
-*
  * ***** BEGIN GPLLICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -29,10 +25,15 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
+/** \file blender/imbuf/intern/openexr/openexr_api.cpp
+ *  \ingroup openexr
+ */
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <stddef.h>
 #include <string>
+#include <set>
 
 
 #include <openexr_api.h>
@@ -51,6 +52,7 @@ _CRTIMP void __cdecl _invalid_parameter_noinfo(void)
 
 #include "BLI_blenlib.h"
 #include "BLI_math_color.h"
+#include "BLI_threads.h"
 
 #include "IMB_imbuf_types.h"
 #include "IMB_imbuf.h"
@@ -93,12 +95,12 @@ _CRTIMP void __cdecl _invalid_parameter_noinfo(void)
 using namespace Imf;
 using namespace Imath;
 
-class Mem_IStream: public IStream
+class Mem_IStream: public Imf::IStream
 {
 public:
 	
 	Mem_IStream (unsigned char *exrbuf, size_t exrsize):
-	    IStream("dummy"), _exrpos (0), _exrsize(exrsize)  { _exrbuf = exrbuf; }
+	    IStream("dummy"), _exrpos (0), _exrsize(exrsize) { _exrbuf = exrbuf; }
 	
 	virtual bool	read (char c[], int n);
 	virtual Int64	tellg ();
@@ -187,7 +189,7 @@ static void openexr_header_metadata(Header *header, struct ImBuf *ibuf)
 {
 	ImMetaData* info;
 
-	for(info= ibuf->metadata; info; info= info->next)
+	for (info= ibuf->metadata; info; info= info->next)
 		header->insert(info->key, StringAttribute(info->value));
 }
 
@@ -211,7 +213,7 @@ static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags
 		if (ibuf->planes==32 && channels >= 4)
 			header.channels().insert ("A", Channel (HALF));
 		if (write_zbuf)		// z we do as float always
-			header.channels().insert ("Z", Channel (FLOAT));
+			header.channels().insert ("Z", Channel (Imf::FLOAT));
 		
 		FrameBuffer frameBuffer;			
 		OutputFile *file = new OutputFile(name, header);			
@@ -229,46 +231,29 @@ static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags
 		if (ibuf->planes==32 && channels >= 4)
 			frameBuffer.insert ("A", Slice (HALF, (char *) &pixels[0].a, xstride, ystride));
 		if (write_zbuf)
-			frameBuffer.insert ("Z", Slice (FLOAT, (char *)(ibuf->zbuf_float + (height-1)*width),
+			frameBuffer.insert ("Z", Slice (Imf::FLOAT, (char *)(ibuf->zbuf_float + (height-1)*width),
 											sizeof(float), sizeof(float) * -width));
-		if(ibuf->rect_float) {
+		if (ibuf->rect_float) {
 			float *from;
 
-			if(ibuf->profile == IB_PROFILE_LINEAR_RGB) {
-				for (int i = ibuf->y-1; i >= 0; i--)
-				{
-					from= ibuf->rect_float + channels*i*width;
+			for (int i = ibuf->y-1; i >= 0; i--)
+			{
+				from= ibuf->rect_float + channels*i*width;
 
-					for (int j = ibuf->x; j > 0; j--)
-					{
-						to->r = from[0];
-						to->g = from[1];
-						to->b = from[2];
-						to->a = (channels >= 4)? from[3]: 1.0f;
-						to++; from += 4;
-					}
-				}
-			}
-			else {
-				for (int i = ibuf->y-1; i >= 0; i--)
+				for (int j = ibuf->x; j > 0; j--)
 				{
-					from= ibuf->rect_float + channels*i*width;
-
-					for (int j = ibuf->x; j > 0; j--)
-					{
-						to->r = srgb_to_linearrgb(from[0]);
-						to->g = srgb_to_linearrgb(from[1]);
-						to->b = srgb_to_linearrgb(from[2]);
-						to->a = (channels >= 4)? from[3]: 1.0f;
-						to++; from += 4;
-					}
+					to->r = from[0];
+					to->g = from[1];
+					to->b = from[2];
+					to->a = (channels >= 4)? from[3]: 1.0f;
+					to++; from += 4;
 				}
 			}
 		}
 		else {
 			unsigned char *from;
 
-			if(ibuf->profile == IB_PROFILE_LINEAR_RGB) {
+			if (ibuf->profile == IB_PROFILE_LINEAR_RGB) {
 				for (int i = ibuf->y-1; i >= 0; i--)
 				{
 					from= (unsigned char *)ibuf->rect + channels*i*width;
@@ -332,13 +317,13 @@ static int imb_save_openexr_float(struct ImBuf *ibuf, const char *name, int flag
 		openexr_header_compression(&header, ibuf->ftype & OPENEXR_COMPRESS);
 		openexr_header_metadata(&header, ibuf);
 		
-		header.channels().insert ("R", Channel (FLOAT));
-		header.channels().insert ("G", Channel (FLOAT));
-		header.channels().insert ("B", Channel (FLOAT));
+		header.channels().insert ("R", Channel (Imf::FLOAT));
+		header.channels().insert ("G", Channel (Imf::FLOAT));
+		header.channels().insert ("B", Channel (Imf::FLOAT));
 		if (ibuf->planes==32 && channels >= 4)
-			header.channels().insert ("A", Channel (FLOAT));
+			header.channels().insert ("A", Channel (Imf::FLOAT));
 		if (write_zbuf)
-			header.channels().insert ("Z", Channel (FLOAT));
+			header.channels().insert ("Z", Channel (Imf::FLOAT));
 		
 		FrameBuffer frameBuffer;			
 		OutputFile *file = new OutputFile(name, header);			
@@ -350,15 +335,15 @@ static int imb_save_openexr_float(struct ImBuf *ibuf, const char *name, int flag
 		rect[0]= ibuf->rect_float + channels*(height-1)*width;
 		rect[1]= rect[0]+1;
 		rect[2]= rect[0]+2;
-		rect[3]= (channels >= 4)? rect[0]+3:rect[0]; /* red as alpha, is this needed since alpha isnt written? */
+		rect[3]= (channels >= 4)? rect[0]+3:rect[0]; /* red as alpha, is this needed since alpha isn't written? */
 
-		frameBuffer.insert ("R", Slice (FLOAT,  (char *)rect[0], xstride, ystride));
-		frameBuffer.insert ("G", Slice (FLOAT,  (char *)rect[1], xstride, ystride));
-		frameBuffer.insert ("B", Slice (FLOAT,  (char *)rect[2], xstride, ystride));
+		frameBuffer.insert ("R", Slice (Imf::FLOAT,  (char *)rect[0], xstride, ystride));
+		frameBuffer.insert ("G", Slice (Imf::FLOAT,  (char *)rect[1], xstride, ystride));
+		frameBuffer.insert ("B", Slice (Imf::FLOAT,  (char *)rect[2], xstride, ystride));
 		if (ibuf->planes==32 && channels >= 4)
-			frameBuffer.insert ("A", Slice (FLOAT,  (char *)rect[3], xstride, ystride));
+			frameBuffer.insert ("A", Slice (Imf::FLOAT,  (char *)rect[3], xstride, ystride));
 		if (write_zbuf)
-			frameBuffer.insert ("Z", Slice (FLOAT, (char *) (ibuf->zbuf_float + (height-1)*width),
+			frameBuffer.insert ("Z", Slice (Imf::FLOAT, (char *) (ibuf->zbuf_float + (height-1)*width),
 											sizeof(float), sizeof(float) * -width));
 		file->setFrameBuffer (frameBuffer);				  
 		file->writePixels (height);					  
@@ -401,11 +386,11 @@ int imb_save_openexr(struct ImBuf *ibuf, const char *name, int flags)
 /* ********************* Nicer API, MultiLayer and with Tile file support ************************************ */
 
 /* naming rules:
-   - parse name from right to left
-   - last character is channel ID, 1 char like 'A' 'R' 'G' 'B' 'X' 'Y' 'Z' 'W' 'U' 'V'
-   - separated with a dot; the Pass name (like "Depth", "Color", "Diffuse" or "Combined")
-   - separated with a dot: the Layer name (like "Lamp1" or "Walls" or "Characters")
-*/
+ * - parse name from right to left
+ * - last character is channel ID, 1 char like 'A' 'R' 'G' 'B' 'X' 'Y' 'Z' 'W' 'U' 'V'
+ * - separated with a dot; the Pass name (like "Depth", "Color", "Diffuse" or "Combined")
+ * - separated with a dot: the Layer name (like "Lamp1" or "Walls" or "Characters")
+ */
 
 static ListBase exrhandles= {NULL, NULL};
 
@@ -468,7 +453,7 @@ void IMB_exr_add_channel(void *handle, const char *layname, const char *passname
 	
 	echan= (ExrChannel *)MEM_callocN(sizeof(ExrChannel), "exr tile channel");
 	
-	if(layname) {
+	if (layname) {
 		char lay[EXR_LAY_MAXNAME+1], pass[EXR_PASS_MAXNAME+1];
 		BLI_strncpy(lay, layname, EXR_LAY_MAXNAME);
 		BLI_strncpy(pass, passname, EXR_PASS_MAXNAME);
@@ -496,8 +481,8 @@ int IMB_exr_begin_write(void *handle, const char *filename, int width, int heigh
 	data->width= width;
 	data->height= height;
 	
-	for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next)
-		header.channels().insert (echan->name, Channel (FLOAT));
+	for (echan= (ExrChannel *)data->channels.first; echan; echan= echan->next)
+		header.channels().insert (echan->name, Channel (Imf::FLOAT));
 	
 	openexr_header_compression(&header, compress);
 	// openexr_header_metadata(&header, ibuf); // no imbuf. cant write
@@ -505,7 +490,7 @@ int IMB_exr_begin_write(void *handle, const char *filename, int width, int heigh
 	
 	header.insert ("BlenderMultiChannel", StringAttribute ("Blender V2.55.1 and newer"));
 
-	/* avoid crash/abort when we dont have permission to write here */
+	/* avoid crash/abort when we don't have permission to write here */
 	try {
 		data->ofile = new OutputFile(filename, header);
 	}
@@ -529,8 +514,8 @@ void IMB_exrtile_begin_write(void *handle, const char *filename, int mipmap, int
 	data->height= height;
 	data->mipmap= mipmap;
 	
-	for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next)
-		header.channels().insert (echan->name, Channel (FLOAT));
+	for (echan= (ExrChannel *)data->channels.first; echan; echan= echan->next)
+		header.channels().insert (echan->name, Channel (Imf::FLOAT));
 	
 	header.setTileDescription (TileDescription (tilex, tiley, (mipmap)? MIPMAP_LEVELS: ONE_LEVEL));
 	header.lineOrder() = RANDOM_Y;
@@ -546,9 +531,9 @@ int IMB_exr_begin_read(void *handle, const char *filename, int *width, int *heig
 {
 	ExrHandle *data= (ExrHandle *)handle;
 	
-	if(BLI_exists(filename) && BLI_file_size(filename)>32) {	/* 32 is arbitrary, but zero length files crashes exr */
+	if (BLI_exists(filename) && BLI_file_size(filename)>32) {	/* 32 is arbitrary, but zero length files crashes exr */
 		data->ifile = new InputFile(filename);
-		if(data->ifile) {
+		if (data->ifile) {
 			Box2i dw = data->ifile->header().dataWindow();
 			data->width= *width  = dw.max.x - dw.min.x + 1;
 			data->height= *height = dw.max.y - dw.min.y + 1;
@@ -571,7 +556,7 @@ void IMB_exr_set_channel(void *handle, const char *layname, const char *passname
 	ExrChannel *echan;
 	char name[EXR_TOT_MAXNAME + 1];
 	
-	if(layname) {
+	if (layname) {
 		char lay[EXR_LAY_MAXNAME+1], pass[EXR_PASS_MAXNAME+1];
 		BLI_strncpy(lay, layname, EXR_LAY_MAXNAME);
 		BLI_strncpy(pass, passname, EXR_PASS_MAXNAME);
@@ -583,7 +568,7 @@ void IMB_exr_set_channel(void *handle, const char *layname, const char *passname
 
 	echan= (ExrChannel *)BLI_findstring(&data->channels, name, offsetof(ExrChannel, name));
 
-	if(echan) {
+	if (echan) {
 		echan->xstride= xstride;
 		echan->ystride= ystride;
 		echan->rect= rect;
@@ -604,10 +589,10 @@ void IMB_exrtile_write_channels(void *handle, int partx, int party, int level)
 	FrameBuffer frameBuffer;
 	ExrChannel *echan;
 	
-	for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) {
+	for (echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) {
 		float *rect= echan->rect - echan->xstride*partx - echan->ystride*party;
 
-		frameBuffer.insert (echan->name, Slice (FLOAT,  (char *)rect, 
+		frameBuffer.insert (echan->name, Slice (Imf::FLOAT,  (char *)rect,
 							echan->xstride*sizeof(float), echan->ystride*sizeof(float)));
 	}
 	
@@ -628,12 +613,12 @@ void IMB_exr_write_channels(void *handle)
 	FrameBuffer frameBuffer;
 	ExrChannel *echan;
 	
-	if(data->channels.first) {
-		for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) {
+	if (data->channels.first) {
+		for (echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) {
 			/* last scanline, stride negative */
 			float *rect = echan->rect + echan->xstride*(data->height-1)*data->width;
 			
-			frameBuffer.insert (echan->name, Slice (FLOAT,  (char *)rect, 
+			frameBuffer.insert (echan->name, Slice (Imf::FLOAT,  (char *)rect,
 													echan->xstride*sizeof(float), -echan->ystride*sizeof(float)));
 		}
 		
@@ -660,14 +645,14 @@ void IMB_exr_read_channels(void *handle)
 	const StringAttribute *ta = data->ifile->header().findTypedAttribute <StringAttribute> ("BlenderMultiChannel");
 	short flip = (ta && strncmp(ta->value().c_str(), "Blender V2.43", 13)==0); /* 'previous multilayer attribute, flipped */
 	
-	for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) {
+	for (echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) {
 		
-		if(echan->rect) {
-			if(flip)
-				frameBuffer.insert (echan->name, Slice (FLOAT,  (char *)echan->rect, 
+		if (echan->rect) {
+			if (flip)
+				frameBuffer.insert (echan->name, Slice (Imf::FLOAT,  (char *)echan->rect,
 											echan->xstride*sizeof(float), echan->ystride*sizeof(float)));
 			else
-				frameBuffer.insert (echan->name, Slice (FLOAT,  (char *)(echan->rect + echan->xstride*(data->height-1)*data->width), 
+				frameBuffer.insert (echan->name, Slice (Imf::FLOAT,  (char *)(echan->rect + echan->xstride*(data->height-1)*data->width),
 											echan->xstride*sizeof(float), -echan->ystride*sizeof(float)));
 		}
 		else 
@@ -693,15 +678,15 @@ void IMB_exr_multilayer_convert(void *handle, void *base,
 	ExrLayer *lay;
 	ExrPass *pass;
 
-	if(data->layers.first==NULL) {
+	if (data->layers.first==NULL) {
 		printf("cannot convert multilayer, no layers in handle\n");
 		return;
 	}
 
-	for(lay= (ExrLayer *)data->layers.first; lay; lay= lay->next) {
+	for (lay= (ExrLayer *)data->layers.first; lay; lay= lay->next) {
 		void *laybase= addlayer(base, lay->name);
-		if(laybase) {
-			for(pass= (ExrPass *)lay->passes.first; pass; pass= pass->next) {
+		if (laybase) {
+			for (pass= (ExrPass *)lay->passes.first; pass; pass= pass->next) {
 				addpass(base, laybase, pass->name, pass->rect, pass->totchan, pass->chan_id);
 				pass->rect= NULL;
 			}
@@ -716,11 +701,11 @@ void IMB_exr_close(void *handle)
 	ExrLayer *lay;
 	ExrPass *pass;
 	
-	if(data->ifile)
+	if (data->ifile)
 		delete data->ifile;
-	else if(data->ofile)
+	else if (data->ofile)
 		delete data->ofile;
-	else if(data->tofile)
+	else if (data->tofile)
 		delete data->tofile;
 	
 	data->ifile= NULL;
@@ -729,9 +714,9 @@ void IMB_exr_close(void *handle)
 	
 	BLI_freelistN(&data->channels);
 	
-	for(lay= (ExrLayer *)data->layers.first; lay; lay= lay->next) {
-		for(pass= (ExrPass *)lay->passes.first; pass; pass= pass->next)
-			if(pass->rect)
+	for (lay= (ExrLayer *)data->layers.first; lay; lay= lay->next) {
+		for (pass= (ExrPass *)lay->passes.first; pass; pass= pass->next)
+			if (pass->rect)
 				MEM_freeN(pass->rect);
 		BLI_freelistN(&lay->passes);
 	}
@@ -747,11 +732,11 @@ static int imb_exr_split_channel_name(ExrChannel *echan, char *layname, char *pa
 {
 	int plen, len= strlen(echan->name);
 	
-	if(len < 4) {
+	if (len < 4) {
 		printf("multilayer read: name too short: %s\n", echan->name);
 		return 0;
 	}
-	if(echan->name[len-2]!='.') {
+	if (echan->name[len-2]!='.') {
 		printf("multilayer read: name has no Channel: %s\n", echan->name);
 		return 0;
 	}
@@ -759,19 +744,19 @@ static int imb_exr_split_channel_name(ExrChannel *echan, char *layname, char *pa
 	
 	len-= 3;
 	while(len>=0) {
-		if(echan->name[len]=='.')
+		if (echan->name[len]=='.')
 			break;
 		len--;
 	}
 	BLI_strncpy(passname, echan->name+len+1, EXR_PASS_MAXNAME);
 	plen= strlen(passname);
-	if(plen < 3) {
+	if (plen < 3) {
 		printf("multilayer read: should not happen: %s\n", echan->name);
 		return 0;
 	}
 	passname[plen-2]= 0;
 	
-	if(len<1)
+	if (len<1)
 		layname[0]= 0;
 	else {
 		BLI_strncpy(layname, echan->name, EXR_LAY_MAXNAME);
@@ -785,7 +770,7 @@ static ExrLayer *imb_exr_get_layer(ListBase *lb, char *layname)
 {
 	ExrLayer *lay= (ExrLayer *)BLI_findstring(lb, layname, offsetof(ExrLayer, name));
 
-	if(lay==NULL) {
+	if (lay==NULL) {
 		lay= (ExrLayer *)MEM_callocN(sizeof(ExrLayer), "exr layer");
 		BLI_addtail(lb, lay);
 		BLI_strncpy(lay->name, layname, EXR_LAY_MAXNAME);
@@ -798,10 +783,10 @@ static ExrPass *imb_exr_get_pass(ListBase *lb, char *passname)
 {
 	ExrPass *pass= (ExrPass *)BLI_findstring(lb, passname, offsetof(ExrPass, name));
 	
-	if(pass==NULL) {
+	if (pass==NULL) {
 		pass= (ExrPass *)MEM_callocN(sizeof(ExrPass), "exr pass");
 
-		if(strcmp(passname, "Combined")==0)
+		if (strcmp(passname, "Combined")==0)
 			BLI_addhead(lb, pass);
 		else
 			BLI_addtail(lb, pass);
@@ -833,29 +818,29 @@ static ExrHandle *imb_exr_begin_read_mem(InputFile *file, int width, int height)
 	
 	/* now try to sort out how to assign memory to the channels */
 	/* first build hierarchical layer list */
-	for(echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) {
-		if( imb_exr_split_channel_name(echan, layname, passname) ) {
+	for (echan= (ExrChannel *)data->channels.first; echan; echan= echan->next) {
+		if ( imb_exr_split_channel_name(echan, layname, passname) ) {
 			ExrLayer *lay= imb_exr_get_layer(&data->layers, layname);
 			ExrPass *pass= imb_exr_get_pass(&lay->passes, passname);
 			
 			pass->chan[pass->totchan]= echan;
 			pass->totchan++;
-			if(pass->totchan>=EXR_PASS_MAXCHAN)
+			if (pass->totchan>=EXR_PASS_MAXCHAN)
 				break;
 		}
 	}
-	if(echan) {
+	if (echan) {
 		printf("error, too many channels in one pass: %s\n", echan->name);
 		IMB_exr_close(data);
 		return NULL;
 	}
 	
 	/* with some heuristics, try to merge the channels in buffers */
-	for(lay= (ExrLayer *)data->layers.first; lay; lay= lay->next) {
-		for(pass= (ExrPass *)lay->passes.first; pass; pass= pass->next) {
-			if(pass->totchan) {
+	for (lay= (ExrLayer *)data->layers.first; lay; lay= lay->next) {
+		for (pass= (ExrPass *)lay->passes.first; pass; pass= pass->next) {
+			if (pass->totchan) {
 				pass->rect= (float *)MEM_mapallocN(width*height*pass->totchan*sizeof(float), "pass rect");
-				if(pass->totchan==1) {
+				if (pass->totchan==1) {
 					echan= pass->chan[0];
 					echan->rect= pass->rect;
 					echan->xstride= 1;
@@ -868,14 +853,14 @@ static ExrHandle *imb_exr_begin_read_mem(InputFile *file, int width, int height)
 					memset(lookup, 0, sizeof(lookup));
 						   
 					/* we can have RGB(A), XYZ(W), UVA */
-					if(pass->totchan==3 || pass->totchan==4) {
-						if(pass->chan[0]->chan_id=='B' || pass->chan[1]->chan_id=='B' ||  pass->chan[2]->chan_id=='B') {
+					if (pass->totchan==3 || pass->totchan==4) {
+						if (pass->chan[0]->chan_id=='B' || pass->chan[1]->chan_id=='B' ||  pass->chan[2]->chan_id=='B') {
 							lookup[(unsigned int)'R']= 0;
 							lookup[(unsigned int)'G']= 1;
 							lookup[(unsigned int)'B']= 2;
 							lookup[(unsigned int)'A']= 3;
 						}
-						else if(pass->chan[0]->chan_id=='Y' || pass->chan[1]->chan_id=='Y' ||  pass->chan[2]->chan_id=='Y') {
+						else if (pass->chan[0]->chan_id=='Y' || pass->chan[1]->chan_id=='Y' ||  pass->chan[2]->chan_id=='Y') {
 							lookup[(unsigned int)'X']= 0;
 							lookup[(unsigned int)'Y']= 1;
 							lookup[(unsigned int)'Z']= 2;
@@ -886,7 +871,7 @@ static ExrHandle *imb_exr_begin_read_mem(InputFile *file, int width, int height)
 							lookup[(unsigned int)'V']= 1;
 							lookup[(unsigned int)'A']= 2;
 						}
-						for(a=0; a<pass->totchan; a++) {
+						for (a=0; a<pass->totchan; a++) {
 							echan= pass->chan[a];
 							echan->rect= pass->rect + lookup[(unsigned int)echan->chan_id];
 							echan->xstride= pass->totchan;
@@ -895,7 +880,7 @@ static ExrHandle *imb_exr_begin_read_mem(InputFile *file, int width, int height)
 						}
 					}
 					else { /* unknown */
-						for(a=0; a<pass->totchan; a++) {
+						for (a=0; a<pass->totchan; a++) {
 							echan= pass->chan[a];
 							echan->rect= pass->rect + a;
 							echan->xstride= pass->totchan;
@@ -945,8 +930,8 @@ static const char *exr_rgba_channelname(InputFile *file, const char *chan)
 		/* const Channel &channel = i.channel(); */ /* Not used yet */
 		const char *str= i.name();
 		int len= strlen(str);
-		if(len) {
-			if(BLI_strcasecmp(chan, str+len-1)==0) {
+		if (len) {
+			if (BLI_strcasecmp(chan, str+len-1)==0) {
 				return str;
 			}
 		}
@@ -961,12 +946,17 @@ static int exr_has_zbuffer(InputFile *file)
 	return !(file->header().channels().findChannel("Z") == NULL);
 }
 
-static int exr_is_renderresult(InputFile *file)
+static int exr_is_multilayer(InputFile *file)
 {
 	const StringAttribute *comments= file->header().findTypedAttribute<StringAttribute>("BlenderMultiChannel");
-	if(comments)
-//		if(comments->value() == "Blender MultiChannel")
+	const ChannelList &channels = file->header().channels();
+	std::set <std::string> layerNames;
+
+	channels.layers(layerNames);
+
+	if (comments || layerNames.size()>1)
 			return 1;
+
 	return 0;
 }
 
@@ -990,13 +980,13 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags)
 		//printf("OpenEXR-load: image data window %d %d %d %d\n", 
 		//	   dw.min.x, dw.min.y, dw.max.x, dw.max.y);
 
-		if(0) // debug
+		if (0) // debug
 			exr_print_filecontents(file);
 		
-		is_multi= exr_is_renderresult(file);
+		is_multi= exr_is_multilayer(file);
 		
 		/* do not make an ibuf when */
-		if(is_multi && !(flags & IB_test) && !(flags & IB_multilayer)) 
+		if (is_multi && !(flags & IB_test) && !(flags & IB_multilayer)) 
 		{
 			printf("Error: can't process EXR multilayer file\n");
 		}
@@ -1010,14 +1000,13 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags)
 			
 			if (!(flags & IB_test))
 			{
-				if(is_multi) /* only enters with IB_multilayer flag set */
+				if (is_multi) /* only enters with IB_multilayer flag set */
 				{
 					/* constructs channels for reading, allocates memory in channels */
 					ExrHandle *handle= imb_exr_begin_read_mem(file, width, height);
-					if(handle) {
+					if (handle) {
 						IMB_exr_read_channels(handle);
 						ibuf->userdata= handle;			/* potential danger, the caller has to check for this! */
-						return ibuf;
 					}
 				}
 				else {
@@ -1034,23 +1023,23 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags)
 					first+= 4*(height-1)*width;
 					
 					frameBuffer.insert ( exr_rgba_channelname(file, "R"), 
-										Slice (FLOAT,  (char *) first, xstride, ystride));
+										Slice (Imf::FLOAT,  (char *) first, xstride, ystride));
 					frameBuffer.insert ( exr_rgba_channelname(file, "G"), 
-										Slice (FLOAT,  (char *) (first+1), xstride, ystride));
+										Slice (Imf::FLOAT,  (char *) (first+1), xstride, ystride));
 					frameBuffer.insert ( exr_rgba_channelname(file, "B"), 
-										Slice (FLOAT,  (char *) (first+2), xstride, ystride));
+										Slice (Imf::FLOAT,  (char *) (first+2), xstride, ystride));
 																			
 					frameBuffer.insert ( exr_rgba_channelname(file, "A"), 
-										Slice (FLOAT,  (char *) (first+3), xstride, ystride, 1, 1, 1.0f)); /* 1.0 is fill value */
+										Slice (Imf::FLOAT,  (char *) (first+3), xstride, ystride, 1, 1, 1.0f)); /* 1.0 is fill value */
 
-					if(exr_has_zbuffer(file)) 
+					if (exr_has_zbuffer(file)) 
 					{
 						float *firstz;
 						
 						addzbuffloatImBuf(ibuf);
 						firstz= ibuf->zbuf_float - (dw.min.x - dw.min.y*width);
 						firstz+= (height-1)*width;
-						frameBuffer.insert ("Z", Slice (FLOAT,  (char *)firstz , sizeof(float), -width*sizeof(float)));
+						frameBuffer.insert ("Z", Slice (Imf::FLOAT,  (char *)firstz , sizeof(float), -width*sizeof(float)));
 					}
 					
 					file->setFrameBuffer (frameBuffer);
@@ -1063,13 +1052,14 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags)
 					//
 					// Disabling this because the sequencer frees immediate.
 					//
-					// if(flag & IM_rect)
+					// if (flag & IM_rect)
 					//     IMB_rect_from_float(ibuf);
+					
+					/* file is no longer needed */
+					delete file;
 				}
 			}
-			
 		}
-		delete file;
 		return(ibuf);
 	}
 	catch (const std::exception &exc)
@@ -1083,5 +1073,11 @@ struct ImBuf *imb_load_openexr(unsigned char *mem, size_t size, int flags)
 	
 }
 
+void imb_initopenexr(void)
+{
+	int num_threads = BLI_system_thread_count();
+
+	setGlobalThreadCount(num_threads);
+}
 
 } // export "C"
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.h b/source/blender/imbuf/intern/openexr/openexr_api.h
index 8567673..d12fe2f 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.h
+++ b/source/blender/imbuf/intern/openexr/openexr_api.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef _OPENEXR_API_H
-#define _OPENEXR_API_H
+#ifndef __OPENEXR_API_H__
+#define __OPENEXR_API_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -39,11 +39,13 @@ extern "C" {
   
 #include <stdio.h>
   
-  /**
+/**
  * Test presence of OpenEXR file.
- * @param mem pointer to loaded OpenEXR bitstream
+ * \param mem pointer to loaded OpenEXR bitstream
  */
-  
+
+void		imb_initopenexr					(void);
+
 int		imb_is_a_openexr			(unsigned char *mem);
 	
 int		imb_save_openexr			(struct ImBuf *ibuf, const char *name, int flags);
diff --git a/source/blender/imbuf/intern/openexr/openexr_multi.h b/source/blender/imbuf/intern/openexr/openexr_multi.h
index abb675e..88d8b09 100644
--- a/source/blender/imbuf/intern/openexr/openexr_multi.h
+++ b/source/blender/imbuf/intern/openexr/openexr_multi.h
@@ -30,20 +30,23 @@
  */
 
 
-#ifndef _OPENEXR_MULTI_H
-#define _OPENEXR_MULTI_H
+#ifndef __OPENEXR_MULTI_H__
+#define __OPENEXR_MULTI_H__
 
 /* 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! */
+ * This api also supports max 8 channels per pass now. easy to fix! */
 #define EXR_LAY_MAXNAME		19
 #define EXR_PASS_MAXNAME	11
 #define EXR_TOT_MAXNAME		32
 #define EXR_PASS_MAXCHAN	8
 
 
-#ifdef WITH_OPENEXR
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void *	IMB_exr_get_handle			(void);
 void	IMB_exr_add_channel			(void *handle, const char *layname, const char *passname, int xstride, int ystride, float *rect);
 
@@ -64,36 +67,8 @@ void    IMB_exr_multilayer_convert	(void *handle, void *base,
 
 void	IMB_exr_close				(void *handle);
 
-
-#else
-
-/* ugly... but we only use it on pipeline.c, render module, now */
-
-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; }
-
-void	IMB_exr_set_channel			(void *handle, 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_multilayer_convert	(void *handle, void *base,  
-									 void * (*addlayer)(void *base, char *str), 
-									 void (*addpass)(void *base, void *lay, char *str, float *rect, int totchan, char *chan_id))
-									{
-										(void)handle; (void)base; (void)addlayer; (void)addpass;
-									}
-
-void	IMB_exr_close				(void *handle) { (void)handle; }
-
+#ifdef __cplusplus
+} // extern "C"
 #endif
 
-
-
 #endif /* __OPENEXR_MULTI_H */
diff --git a/source/blender/imbuf/intern/openexr/openexr_stub.cpp b/source/blender/imbuf/intern/openexr/openexr_stub.cpp
new file mode 100644
index 0000000..e896fc5
--- /dev/null
+++ b/source/blender/imbuf/intern/openexr/openexr_stub.cpp
@@ -0,0 +1,57 @@
+/*
+ * ***** BEGIN GPLLICENSE 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 by Gernot Ziegler <gz at lysator.liu.se>.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Austin Benesh, Ton Roosendaal (float, half, speedup, cleanup...).
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/imbuf/intern/openexr/openexr_stub.cpp
+ *  \ingroup openexr
+ */
+
+#include "openexr_api.h"
+#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; }
+
+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_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, char *str), 
+									 void (*addpass)(void *base, void *lay, char *str, float *rect, int totchan, char *chan_id))
+									{
+										(void)handle; (void)base; (void)addlayer; (void)addpass;
+									}
+
+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 74047ae..74e1a40 100644
--- a/source/blender/imbuf/intern/png.c
+++ b/source/blender/imbuf/intern/png.c
@@ -49,7 +49,7 @@ typedef struct PNGReadStruct {
 	unsigned char *data;
 	unsigned int size;
 	unsigned int seek;
-}PNGReadStruct;
+} PNGReadStruct;
 
 static void ReadData( png_structp png_ptr, png_bytep data, png_size_t length);
 static void WriteData( png_structp png_ptr, png_bytep data, png_size_t length);
@@ -114,7 +114,7 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags)
 	compression= compression < 0 ? 0 : (compression > 9 ? 9 : compression);
 
 	/* for prints */
-	if(flags & IB_mem)
+	if (flags & IB_mem)
 		name= "<memory>";
 
 	bytesperpixel = (ibuf->planes + 7) >> 3;
@@ -195,7 +195,7 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags)
 		                 Flush);
 	}
 	else {
-		fp = fopen(name, "wb");
+		fp = BLI_fopen(name, "wb");
 		if (!fp) {
 			png_destroy_write_struct(&png_ptr, &info_ptr);
 			MEM_freeN(pixels);
@@ -205,15 +205,15 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags)
 		png_init_io(png_ptr, fp);
 	}
 
-	/*
+#if 0
 	png_set_filter(png_ptr, 0,
-		PNG_FILTER_NONE  | PNG_FILTER_VALUE_NONE |
-		PNG_FILTER_SUB   | PNG_FILTER_VALUE_SUB  |
-		PNG_FILTER_UP    | PNG_FILTER_VALUE_UP   |
-		PNG_FILTER_AVG   | PNG_FILTER_VALUE_AVG  |
-		PNG_FILTER_PAETH | PNG_FILTER_VALUE_PAETH|
-		PNG_ALL_FILTERS);
-	*/
+	               PNG_FILTER_NONE  | PNG_FILTER_VALUE_NONE |
+	               PNG_FILTER_SUB   | PNG_FILTER_VALUE_SUB  |
+	               PNG_FILTER_UP    | PNG_FILTER_VALUE_UP   |
+	               PNG_FILTER_AVG   | PNG_FILTER_VALUE_AVG  |
+	               PNG_FILTER_PAETH | PNG_FILTER_VALUE_PAETH|
+	               PNG_ALL_FILTERS);
+#endif
 
 	png_set_compression_level(png_ptr, compression);
 
@@ -256,7 +256,7 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags)
 
 	}
 
-	if(ibuf->ppm[0] > 0.0 && ibuf->ppm[1] > 0.0) {
+	if (ibuf->ppm[0] > 0.0 && ibuf->ppm[1] > 0.0) {
 		png_set_pHYs(png_ptr, info_ptr, (unsigned int)(ibuf->ppm[0] + 0.5), (unsigned int)(ibuf->ppm[1] + 0.5), PNG_RESOLUTION_METER);
 	}
 
@@ -366,7 +366,8 @@ struct ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags)
 		png_set_palette_to_rgb(png_ptr);
 		if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
 			bytesperpixel = 4;
-		} else {
+		}
+		else {
 			bytesperpixel = 3;
 		}
 		break;
@@ -392,8 +393,8 @@ struct ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags)
 			int unit_type;
 			png_uint_32 xres, yres;
 
-			if(png_get_pHYs(png_ptr, info_ptr, &xres, &yres, &unit_type))
-			if(unit_type == PNG_RESOLUTION_METER) {
+			if (png_get_pHYs(png_ptr, info_ptr, &xres, &yres, &unit_type))
+			if (unit_type == PNG_RESOLUTION_METER) {
 				ibuf->ppm[0]= xres;
 				ibuf->ppm[1]= yres;
 			}
@@ -470,7 +471,7 @@ struct ImBuf *imb_loadpng(unsigned char *mem, size_t size, int flags)
 		if (flags & IB_metadata) {
 			png_text* text_chunks;
 			int count = png_get_text(png_ptr, info_ptr, &text_chunks, NULL);
-			for(i = 0; i < count; i++) {
+			for (i = 0; i < count; i++) {
 				IMB_metadata_add_field(ibuf, text_chunks[i].key, text_chunks[i].text);
 				ibuf->flags |= IB_metadata;				
 			 }
diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c
index ec63a93..524f96b 100644
--- a/source/blender/imbuf/intern/radiance_hdr.c
+++ b/source/blender/imbuf/intern/radiance_hdr.c
@@ -30,12 +30,12 @@
  */
 
 /* ----------------------------------------------------------------------
-  Radiance High Dynamic Range image file IO
-  For description and code for reading/writing of radiance hdr files 
-	by Greg Ward, refer to:
-  http://radsite.lbl.gov/radiance/refer/Notes/picture_format.html
-----------------------------------------------------------------------
-*/
+ * Radiance High Dynamic Range image file IO
+ * For description and code for reading/writing of radiance hdr files
+ * by Greg Ward, refer to:
+ * http://radsite.lbl.gov/radiance/refer/Notes/picture_format.html
+ * ----------------------------------------------------------------------
+ */
 
 #ifdef WIN32
 #  include <io.h>
@@ -43,7 +43,7 @@
 
 #include "MEM_guardedalloc.h"
 
-#include "BLI_blenlib.h"
+#include "BLI_fileops.h"
 
 #include "imbuf.h"
 
@@ -183,8 +183,7 @@ struct ImBuf *imb_loadhdr(unsigned char *mem, size_t size, int flags)
 	unsigned char* ptr;
 	char oriY[80], oriX[80];
 
-	if (imb_is_a_hdr((void*)mem))
-	{
+	if (imb_is_a_hdr((void *)mem)) {
 		/* find empty line, next line is resolution info */
 		for (x=1;x<size;x++) {
 			if ((mem[x-1]=='\n') && (mem[x]=='\n')) {
@@ -263,7 +262,8 @@ static int fwritecolrs(FILE* file, int width, int channels, unsigned char* ibufs
 			fcol[RED] = fpscan[j];
 			fcol[GRN] = (channels >= 2)? fpscan[j+1]: fpscan[j];
 			fcol[BLU] = (channels >= 3)? fpscan[j+2]: fpscan[j];
-		} else {
+		}
+		else {
 			fcol[RED] = (float)ibufscan[j] / 255.f;
 			fcol[GRN] = (float)((channels >= 2)? ibufscan[j+1]: ibufscan[j]) / 255.f;
 			fcol[BLU] = (float)((channels >= 3)? ibufscan[j+2]: ibufscan[j]) / 255.f;
@@ -333,7 +333,7 @@ static void writeHeader(FILE *file, int width, int height)
 
 int imb_savehdr(struct ImBuf *ibuf, const char *name, int flags)
 {
-	FILE* file = fopen(name, "wb");
+	FILE* file = BLI_fopen(name, "wb");
 	float *fp= NULL;
 	int y, width=ibuf->x, height=ibuf->y;
 	unsigned char *cp= NULL;
@@ -344,9 +344,9 @@ int imb_savehdr(struct ImBuf *ibuf, const char *name, int flags)
 
 	writeHeader(file, width, height);
 
-	if(ibuf->rect)
+	if (ibuf->rect)
 		cp= (unsigned char *)ibuf->rect + ibuf->channels*(height-1)*width;
-	if(ibuf->rect_float)
+	if (ibuf->rect_float)
 		fp= ibuf->rect_float + ibuf->channels*(height-1)*width;
 	
 	for (y=height-1;y>=0;y--) {
@@ -355,8 +355,8 @@ int imb_savehdr(struct ImBuf *ibuf, const char *name, int flags)
 			printf("HDR write error\n");
 			return 0;
 		}
-		if(cp) cp-= ibuf->channels*width;
-		if(fp) fp-= ibuf->channels*width;
+		if (cp) cp-= ibuf->channels*width;
+		if (fp) fp-= ibuf->channels*width;
 	}
 
 	fclose(file);
diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c
index c2f73ef..61f90f7 100644
--- a/source/blender/imbuf/intern/readimage.c
+++ b/source/blender/imbuf/intern/readimage.c
@@ -55,16 +55,16 @@ ImBuf *IMB_ibImageFromMemory(unsigned char *mem, size_t size, int flags, const c
 	ImBuf *ibuf;
 	ImFileType *type;
 
-	if(mem == NULL) {
+	if (mem == NULL) {
 		fprintf(stderr, "%s: NULL pointer\n", __func__);
 		return NULL;
 	}
 
-	for(type=IMB_FILE_TYPES; type->is_a; type++) {
-		if(type->load) {
+	for (type=IMB_FILE_TYPES; type->is_a; type++) {
+		if (type->load) {
 			ibuf= type->load(mem, size, flags);
-			if(ibuf) {
-				if(flags & IB_premul) {
+			if (ibuf) {
+				if (flags & IB_premul) {
 					IMB_premultiply_alpha(ibuf);
 					ibuf->flags |= IB_premul;
 				}
@@ -85,19 +85,19 @@ ImBuf *IMB_loadifffile(int file, int flags, const char *descr)
 	unsigned char *mem;
 	size_t size;
 
-	if(file == -1) return NULL;
+	if (file == -1) return NULL;
 
 	size= BLI_file_descriptor_size(file);
 
 	mem= mmap(NULL, size, PROT_READ, MAP_SHARED, file, 0);
-	if(mem==(unsigned char*)-1) {
+	if (mem==(unsigned char*)-1) {
 		fprintf(stderr, "%s: couldn't get mapping %s\n", __func__, descr);
 		return NULL;
 	}
 
 	ibuf= IMB_ibImageFromMemory(mem, size, flags, descr);
 
-	if(munmap(mem, size))
+	if (munmap(mem, size))
 		fprintf(stderr, "%s: couldn't unmap file %s\n", __func__, descr);
 
 	return ibuf;
@@ -106,12 +106,12 @@ ImBuf *IMB_loadifffile(int file, int flags, const char *descr)
 static void imb_cache_filename(char *filename, const char *name, int flags)
 {
 	/* read .tx instead if it exists and is not older */
-	if(flags & IB_tilecache) {
+	if (flags & IB_tilecache) {
 		BLI_strncpy(filename, name, IB_FILENAME_SIZE);
-		if(!BLI_replace_extension(filename, IB_FILENAME_SIZE, ".tx"))
+		if (!BLI_replace_extension(filename, IB_FILENAME_SIZE, ".tx"))
 			return;
 
-		if(BLI_file_older(name, filename))
+		if (BLI_file_older(name, filename))
 			return;
 	}
 
@@ -126,17 +126,17 @@ ImBuf *IMB_loadiffname(const char *filepath, int flags)
 
 	imb_cache_filename(filepath_tx, filepath, flags);
 
-	file = open(filepath_tx, O_BINARY|O_RDONLY);
-	if(file < 0) return NULL;
+	file = BLI_open(filepath_tx, O_BINARY|O_RDONLY, 0);
+	if (file < 0) return NULL;
 
 	ibuf= IMB_loadifffile(file, flags, filepath_tx);
 
-	if(ibuf) {
+	if (ibuf) {
 		BLI_strncpy(ibuf->name, filepath, sizeof(ibuf->name));
 		BLI_strncpy(ibuf->cachename, filepath_tx, sizeof(ibuf->cachename));
-		for(a=1; a<ibuf->miptot; a++)
+		for (a=1; a<ibuf->miptot; a++)
 			BLI_strncpy(ibuf->mipmap[a-1]->cachename, filepath_tx, sizeof(ibuf->cachename));
-		if(flags & IB_fields) IMB_de_interlace(ibuf);
+		if (flags & IB_fields) IMB_de_interlace(ibuf);
 	}
 
 	close(file);
@@ -152,12 +152,12 @@ ImBuf *IMB_testiffname(const char *filepath, int flags)
 
 	imb_cache_filename(filepath_tx, filepath, flags);
 
-	file = open(filepath_tx,O_BINARY|O_RDONLY);
-	if(file < 0) return NULL;
+	file = BLI_open(filepath_tx,O_BINARY|O_RDONLY,0);
+	if (file < 0) return NULL;
 
 	ibuf=IMB_loadifffile(file, flags|IB_test|IB_multilayer, filepath_tx);
 
-	if(ibuf) {
+	if (ibuf) {
 		BLI_strncpy(ibuf->name, filepath, sizeof(ibuf->name));
 		BLI_strncpy(ibuf->cachename, filepath_tx, sizeof(ibuf->cachename));
 	}
@@ -173,21 +173,21 @@ static void imb_loadtilefile(ImBuf *ibuf, int file, int tx, int ty, unsigned int
 	unsigned char *mem;
 	size_t size;
 
-	if(file == -1) return;
+	if (file == -1) return;
 
 	size= BLI_file_descriptor_size(file);
 
 	mem= mmap(NULL, size, PROT_READ, MAP_SHARED, file, 0);
-	if(mem==(unsigned char*)-1) {
+	if (mem==(unsigned char*)-1) {
 		fprintf(stderr, "Couldn't get memory mapping for %s\n", ibuf->cachename);
 		return;
 	}
 
-	for(type=IMB_FILE_TYPES; type->is_a; type++)
-		if(type->load_tile && type->ftype(type, ibuf))
+	for (type=IMB_FILE_TYPES; type->is_a; type++)
+		if (type->load_tile && type->ftype(type, ibuf))
 			type->load_tile(ibuf, mem, size, tx, ty, rect);
 
-	if(munmap(mem, size))
+	if (munmap(mem, size))
 		fprintf(stderr, "Couldn't unmap memory for %s.\n", ibuf->cachename);
 }
 
@@ -195,8 +195,8 @@ void imb_loadtile(ImBuf *ibuf, int tx, int ty, unsigned int *rect)
 {
 	int file;
 
-	file = open(ibuf->cachename, O_BINARY|O_RDONLY);
-	if(file < 0) return;
+	file = BLI_open(ibuf->cachename, O_BINARY|O_RDONLY, 0);
+	if (file < 0) return;
 
 	imb_loadtilefile(ibuf, file, tx, ty, rect);
 
diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c
index 97b94ae..6ea84fd 100644
--- a/source/blender/imbuf/intern/rectop.c
+++ b/source/blender/imbuf/intern/rectop.c
@@ -47,8 +47,8 @@
 static void blend_color_mix(char *cp, char *cp1, char *cp2, int fac)
 {
 	/* this and other blending modes previously used >>8 instead of /255. both
-	   are not equivalent (>>8 is /256), and the former results in rounding
-	   errors that can turn colors black fast after repeated blending */
+	 * are not equivalent (>>8 is /256), and the former results in rounding
+	 * errors that can turn colors black fast after repeated blending */
 	int mfac= 255-fac;
 
 	cp[0]= (mfac*cp1[0]+fac*cp2[0])/255;
@@ -61,11 +61,11 @@ static void blend_color_add(char *cp, char *cp1, char *cp2, int fac)
 	int temp;
 
 	temp= cp1[0] + ((fac*cp2[0])/255);
-	if(temp>254) cp[0]= 255; else cp[0]= temp;
+	if (temp>254) cp[0]= 255; else cp[0]= temp;
 	temp= cp1[1] + ((fac*cp2[1])/255);
-	if(temp>254) cp[1]= 255; else cp[1]= temp;
+	if (temp>254) cp[1]= 255; else cp[1]= temp;
 	temp= cp1[2] + ((fac*cp2[2])/255);
-	if(temp>254) cp[2]= 255; else cp[2]= temp;
+	if (temp>254) cp[2]= 255; else cp[2]= temp;
 }
 
 static void blend_color_sub(char *cp, char *cp1, char *cp2, int fac)
@@ -73,11 +73,11 @@ static void blend_color_sub(char *cp, char *cp1, char *cp2, int fac)
 	int temp;
 
 	temp= cp1[0] - ((fac*cp2[0])/255);
-	if(temp<0) cp[0]= 0; else cp[0]= temp;
+	if (temp<0) cp[0]= 0; else cp[0]= temp;
 	temp= cp1[1] - ((fac*cp2[1])/255);
-	if(temp<0) cp[1]= 0; else cp[1]= temp;
+	if (temp<0) cp[1]= 0; else cp[1]= temp;
 	temp= cp1[2] - ((fac*cp2[2])/255);
-	if(temp<0) cp[2]= 0; else cp[2]= temp;
+	if (temp<0) cp[2]= 0; else cp[2]= temp;
 }
 
 static void blend_color_mul(char *cp, char *cp1, char *cp2, int fac)
@@ -92,8 +92,8 @@ static void blend_color_mul(char *cp, char *cp1, char *cp2, int fac)
 
 static void blend_color_lighten(char *cp, char *cp1, char *cp2, int fac)
 {
-	/* See if are lighter, if so mix, else dont do anything.
-	if the paint col is darker then the original, then ignore */
+	/* See if are lighter, if so mix, else don't do anything.
+	 * if the paint col is darker then the original, then ignore */
 	if (cp1[0]+cp1[1]+cp1[2] > cp2[0]+cp2[1]+cp2[2]) {
 		cp[0]= cp1[0];
 		cp[1]= cp1[1];
@@ -105,8 +105,8 @@ static void blend_color_lighten(char *cp, char *cp1, char *cp2, int fac)
 
 static void blend_color_darken(char *cp, char *cp1, char *cp2, int fac)
 {
-	/* See if were darker, if so mix, else dont do anything.
-	if the paint col is brighter then the original, then ignore */
+	/* See if were darker, if so mix, else don't do anything.
+	 * if the paint col is brighter then the original, then ignore */
 	if (cp1[0]+cp1[1]+cp1[2] < cp2[0]+cp2[1]+cp2[2]) {
 		cp[0]= cp1[0];
 		cp[1]= cp1[1];
@@ -201,8 +201,8 @@ static void blend_color_mul_float(float *cp, float *cp1, float *cp2, float fac)
 
 static void blend_color_lighten_float(float *cp, float *cp1, float *cp2, float fac)
 {
-	/* See if are lighter, if so mix, else dont do anything.
-	if the pafloat col is darker then the original, then ignore */
+	/* See if are lighter, if so mix, else don't do anything.
+	 * if the pafloat col is darker then the original, then ignore */
 	if (cp1[0]+cp1[1]+cp1[2] > cp2[0]+cp2[1]+cp2[2]) {
 		cp[0]= cp1[0];
 		cp[1]= cp1[1];
@@ -214,8 +214,8 @@ static void blend_color_lighten_float(float *cp, float *cp1, float *cp2, float f
 
 static void blend_color_darken_float(float *cp, float *cp1, float *cp2, float fac)
 {
-	/* See if were darker, if so mix, else dont do anything.
-	if the pafloat col is brighter then the original, then ignore */
+	/* See if were darker, if so mix, else don't do anything.
+	 * if the pafloat col is brighter then the original, then ignore */
 	if (cp1[0]+cp1[1]+cp1[2] < cp2[0]+cp2[1]+cp2[2]) {
 		cp[0]= cp1[0];
 		cp[1]= cp1[1];
@@ -348,7 +348,8 @@ void IMB_rectblend(struct ImBuf *dbuf, struct ImBuf *sbuf, int destx,
 		if (do_char) srect = sbuf->rect + srcy * sbuf->x + srcx;
 		if (do_float) srectf = sbuf->rect_float + (srcy * sbuf->x + srcx)*4;
 		srcskip = sbuf->x;
-	} else {
+	}
+	else {
 		srect = drect;
 		srectf = drectf;
 		srcskip = destskip;
@@ -452,7 +453,7 @@ void IMB_rectfill(struct ImBuf *drect, const float col[4])
 {
 	int num;
 
-	if(drect->rect) {
+	if (drect->rect) {
 		unsigned int *rrect = drect->rect;
 		char ccol[4];
 		
@@ -466,7 +467,7 @@ void IMB_rectfill(struct ImBuf *drect, const float col[4])
 			*rrect++ = *((unsigned int*)ccol);
 	}
 	
-	if(drect->rect_float) {
+	if (drect->rect_float) {
 		float *rrectf = drect->rect_float;
 		
 		num = drect->x * drect->y;
@@ -514,7 +515,8 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
 			chr = FTOCHAR(col[0]);
 			chg = FTOCHAR(col[1]);
 			chb = FTOCHAR(col[2]);
-		} else {
+		}
+		else {
 			fr = col[0]*a;
 			fg = col[1]*a;
 			fb = col[2]*a;
@@ -528,7 +530,8 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
 						pixel[1] = chg;
 						pixel[2] = chb;
 						pixel[3] = 255;
-					} else {
+					}
+					else {
 						int alphatest;
 						pixel[0] = (char)((fr + ((float)pixel[0]*aich))*255.0f);
 						pixel[1] = (char)((fg + ((float)pixel[1]*aich))*255.0f);
@@ -550,7 +553,8 @@ void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height,
 					pixel[1] = col[1];
 					pixel[2] = col[2];
 					pixel[3] = 1.0f;
-				} else {
+				}
+				else {
 					float alphatest;
 					pixel[0] = (col[0]*a) + (pixel[0]*ai);
 					pixel[1] = (col[1]*a) + (pixel[1]*ai);
diff --git a/source/blender/imbuf/intern/rotate.c b/source/blender/imbuf/intern/rotate.c
index 7ca7445..8914d4e 100644
--- a/source/blender/imbuf/intern/rotate.c
+++ b/source/blender/imbuf/intern/rotate.c
@@ -62,7 +62,7 @@ void IMB_flipy(struct ImBuf * ibuf)
 	
 		y >>= 1;
 
-		for(;y>0;y--) {
+		for (;y>0;y--) {
 			memcpy(line, top, x*sizeof(int));
 			memcpy(top, bottom, x*sizeof(int));
 			memcpy(bottom, line, x*sizeof(int));
@@ -85,7 +85,7 @@ void IMB_flipy(struct ImBuf * ibuf)
 
 		y >>= 1;
 
-		for(;y>0;y--) {
+		for (;y>0;y--) {
 			memcpy(linef, topf, 4*x*sizeof(float));
 			memcpy(topf, bottomf, 4*x*sizeof(float));
 			memcpy(bottomf, linef, 4*x*sizeof(float));
@@ -108,16 +108,16 @@ void IMB_flipx(struct ImBuf * ibuf)
 	y = ibuf->y;
 
 	if (ibuf->rect) {
-		for(yi=y-1;yi>=0;yi--) {
-			for(xr=x-1, xl=0; xr>=xl; xr--, xl++) {
+		for (yi=y-1;yi>=0;yi--) {
+			for (xr=x-1, xl=0; xr>=xl; xr--, xl++) {
 				SWAP(unsigned int, ibuf->rect[(x*yi)+xr], ibuf->rect[(x*yi)+xl]);
 			}
 		}
 	}
 	
 	if (ibuf->rect_float) {
-		for(yi=y-1;yi>=0;yi--) {
-			for(xr=x-1, xl=0; xr>=xl; xr--, xl++) {
+		for (yi=y-1;yi>=0;yi--) {
+			for (xr=x-1, xl=0; xr>=xl; xr--, xl++) {
 				memcpy(&px_f, &ibuf->rect_float[((x*yi)+xr)*4], 4*sizeof(float));
 				memcpy(&ibuf->rect_float[((x*yi)+xr)*4], &ibuf->rect_float[((x*yi)+xl)*4], 4*sizeof(float));
 				memcpy(&ibuf->rect_float[((x*yi)+xl)*4], &px_f, 4*sizeof(float));
diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c
index 4ee4aa2..a7b994b 100644
--- a/source/blender/imbuf/intern/scaling.c
+++ b/source/blender/imbuf/intern/scaling.c
@@ -76,18 +76,18 @@ struct ImBuf *IMB_half_x(struct ImBuf *ibuf1)
 	_p1f = ibuf1->rect_float;
 	destf= ibuf2->rect_float;
 
-	for(y=ibuf2->y;y>0;y--){
+	for (y=ibuf2->y;y>0;y--) {
 		p1 = _p1;
 		p1f = _p1f;
-		for(x = ibuf2->x ; x>0 ; x--){
+		for (x = ibuf2->x; x>0; x--) {
 			if (do_rect) {
-				a = *(p1++) ;
-				b = *(p1++) ;
-				g = *(p1++) ;
+				a = *(p1++);
+				b = *(p1++);
+				g = *(p1++);
 				r = *(p1++);
-				a += *(p1++) ;
-				b += *(p1++) ;
-				g += *(p1++) ;
+				a += *(p1++);
+				b += *(p1++);
+				g += *(p1++);
 				r += *(p1++);
 				*(dest++) = a >> 1;
 				*(dest++) = b >> 1;
@@ -136,17 +136,17 @@ struct ImBuf *IMB_double_fast_x(struct ImBuf *ibuf1)
 	p1f = (float *)ibuf1->rect_float;
 	destf = (float *)ibuf2->rect_float;
 
-	for(i = ibuf1->y * ibuf1->x ; i>0 ; i--) {
+	for (i = ibuf1->y * ibuf1->x; i > 0; i--) {
 		if (do_rect) {
 			col = *p1++;
 			*dest++ = col;
 			*dest++ = col;
 		}
 		if (do_float) {
-			destf[0]= destf[4] =p1f[0];
-			destf[1]= destf[5] =p1f[1];
-			destf[2]= destf[6] =p1f[2];
-			destf[3]= destf[7] =p1f[3];
+			destf[0]= destf[4] = p1f[0];
+			destf[1]= destf[5] = p1f[1];
+			destf[2]= destf[6] = p1f[2];
+			destf[3]= destf[7] = p1f[3];
 			destf+= 8;
 			p1f+= 4;
 		}
@@ -195,7 +195,7 @@ struct ImBuf *IMB_half_y(struct ImBuf *ibuf1)
 	_p1f = (float *) ibuf1->rect_float;
 	destf= (float *) ibuf2->rect_float;
 
-	for(y=ibuf2->y ; y>0 ; y--){
+	for (y=ibuf2->y; y>0; y--) {
 		if (do_rect) {
 			p1 = _p1;
 			p2 = _p1 + (ibuf1->x << 2);
@@ -204,15 +204,15 @@ struct ImBuf *IMB_half_y(struct ImBuf *ibuf1)
 			p1f = _p1f;
 			p2f = _p1f + (ibuf1->x << 2);
 		}
-		for(x = ibuf2->x ; x>0 ; x--){
+		for (x = ibuf2->x; x > 0; x--) {
 			if (do_rect) {
-				a = *(p1++) ;
-				b = *(p1++) ;
-				g = *(p1++) ;
+				a = *(p1++);
+				b = *(p1++);
+				g = *(p1++);
 				r = *(p1++);
-				a += *(p2++) ;
-				b += *(p2++) ;
-				g += *(p2++) ;
+				a += *(p2++);
+				b += *(p2++);
+				g += *(p2++);
 				r += *(p2++);
 				*(dest++) = a >> 1;
 				*(dest++) = b >> 1;
@@ -220,13 +220,13 @@ struct ImBuf *IMB_half_y(struct ImBuf *ibuf1)
 				*(dest++) = r >> 1;
 			}
 			if (do_float) {
-				af = *(p1f++) ;
-				bf = *(p1f++) ;
-				gf = *(p1f++) ;
+				af = *(p1f++);
+				bf = *(p1f++);
+				gf = *(p1f++);
 				rf = *(p1f++);
-				af += *(p2f++) ;
-				bf += *(p2f++) ;
-				gf += *(p2f++) ;
+				af += *(p2f++);
+				bf += *(p2f++);
+				gf += *(p2f++);
 				rf += *(p2f++);
 				*(destf++) = 0.5f*af;
 				*(destf++) = 0.5f*bf;
@@ -263,15 +263,15 @@ struct ImBuf *IMB_double_fast_y(struct ImBuf *ibuf1)
 	p1f = (float *) ibuf1->rect_float;
 	dest1f= (float *) ibuf2->rect_float;
 
-	for(y = ibuf1->y ; y>0 ; y--){
+	for (y = ibuf1->y; y > 0; y--) {
 		if (do_rect) {
 			dest2 = dest1 + ibuf2->x;
-			for(x = ibuf2->x ; x>0 ; x--) *dest1++ = *dest2++ = *p1++;
+			for (x = ibuf2->x; x > 0; x--) *dest1++ = *dest2++ = *p1++;
 			dest1 = dest2;
 		}
 		if (do_float) {
 			dest2f = dest1f + (4*ibuf2->x);
-			for(x = ibuf2->x*4 ; x>0 ; x--) *dest1f++ = *dest2f++ = *p1f++;
+			for (x = ibuf2->x * 4; x > 0; x--) *dest1f++ = *dest2f++ = *p1f++;
 			dest1f = dest2f;
 		}
 	}
@@ -301,7 +301,7 @@ void imb_onehalf_no_alloc(struct ImBuf *ibuf2, struct ImBuf *ibuf1)
 	const short do_rect= (ibuf1->rect != NULL);
 	const short do_float= (ibuf1->rect_float != NULL) && (ibuf2->rect_float != NULL);
 
-	if(do_rect && (ibuf2->rect == NULL)) {
+	if (do_rect && (ibuf2->rect == NULL)) {
 		imb_addrectImBuf(ibuf2);
 	}
 
@@ -310,10 +310,10 @@ void imb_onehalf_no_alloc(struct ImBuf *ibuf2, struct ImBuf *ibuf1)
 	p1 = (uchar *) ibuf1->rect;
 	dest=(uchar *) ibuf2->rect;
 
-	for(y=ibuf2->y;y>0;y--){
+	for (y=ibuf2->y;y>0;y--) {
 		if (do_rect) p2 = p1 + (ibuf1->x << 2);
 		if (do_float) p2f = p1f + (ibuf1->x << 2);
-		for(x=ibuf2->x;x>0;x--){
+		for (x=ibuf2->x;x>0;x--) {
 			if (do_rect) {
 				dest[0] = (p1[0] + p2[0] + p1[4] + p2[4]) >> 2;
 				dest[1] = (p1[1] + p2[1] + p1[5] + p2[5]) >> 2;
@@ -323,7 +323,7 @@ void imb_onehalf_no_alloc(struct ImBuf *ibuf2, struct ImBuf *ibuf1)
 				p2 += 8; 
 				dest += 4;
 			}
-			if (do_float){ 
+			if (do_float) {
 				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]);
@@ -335,7 +335,7 @@ void imb_onehalf_no_alloc(struct ImBuf *ibuf2, struct ImBuf *ibuf1)
 		}
 		if (do_rect) p1=p2;
 		if (do_float) p1f=p2f;
-		if(ibuf1->x & 1) {
+		if (ibuf1->x & 1) {
 			if (do_rect) p1+=4;
 			if (do_float) p1f+=4;
 		}
@@ -567,7 +567,8 @@ static void q_scale_byte(unsigned char* in, unsigned char* out, int in_width,
 	if (dst_width > in_width && dst_height > in_height) {
 		enlarge_picture_byte(in, out, in_width, in_height,
 					 dst_width, dst_height);
-	} else if (dst_width < in_width && dst_height < in_height) {
+	}
+	else if (dst_width < in_width && dst_height < in_height) {
 		shrink_picture_byte(in, out, in_width, in_height,
 					dst_width, dst_height);
 	}
@@ -767,33 +768,34 @@ static void q_scale_float(float* in, float* out, int in_width,
 	if (dst_width > in_width && dst_height > in_height) {
 		enlarge_picture_float(in, out, in_width, in_height,
 					  dst_width, dst_height);
-	} else if (dst_width < in_width && dst_height < in_height) {
+	}
+	else if (dst_width < in_width && dst_height < in_height) {
 		shrink_picture_float(in, out, in_width, in_height,
 					 dst_width, dst_height);
 	}
 }
 
-/* q_scale_linear_interpolation (derived from ppmqscale, http://libdv.sf.net)
-
-   q stands for quick _and_ quality :)
-
-   only handles common cases when we either
-
-   scale  both, x and y or
-   shrink both, x and y
-
-   but that is pretty fast:
-   * does only blit once instead of two passes like the old code
-	 (fewer cache misses)
-   * uses fixed point integer arithmetic for byte buffers
-   * doesn't branch in tight loops
-
-   Should be comparable in speed to the ImBuf ..._fast functions at least 
-   for byte-buffers.
-
-   NOTE: disabled, due to inacceptable inaccuracy and quality loss, see bug #18609 (ton)
-
-*/
+/**
+ * q_scale_linear_interpolation (derived from ppmqscale, http://libdv.sf.net)
+ *
+ * q stands for quick _and_ quality :)
+ *
+ * only handles common cases when we either
+ *
+ * scale  both, x and y or
+ * shrink both, x and y
+ *
+ * but that is pretty fast:
+ * - does only blit once instead of two passes like the old code
+ *   (fewer cache misses)
+ * - uses fixed point integer arithmetic for byte buffers
+ * - doesn't branch in tight loops
+ *
+ * Should be comparable in speed to the ImBuf ..._fast functions at least
+ * for byte-buffers.
+ *
+ * NOTE: disabled, due to inacceptable inaccuracy and quality loss, see bug #18609 (ton)
+ */
 static int q_scale_linear_interpolation(
 	struct ImBuf *ibuf, int newx, int newy)
 {
@@ -869,12 +871,12 @@ static struct ImBuf *scaledownx(struct ImBuf *ibuf, int newx)
 		newrectf = _newrectf;
 	}
 		
-	for (y = ibuf->y; y>0 ; y--) {
+	for (y = ibuf->y; y > 0; y--) {
 		sample = 0.0f;
 		val[0]=  val[1]= val[2]= val[3]= 0.0f;
 		valf[0]=valf[1]=valf[2]=valf[3]= 0.0f;
 
-		for (x = newx ; x>0 ; x--) {
+		for (x = newx; x > 0; x--) {
 			if (do_rect) {
 				nval[0] = - val[0] * sample;
 				nval[1] = - val[1] * sample;
@@ -890,7 +892,7 @@ static struct ImBuf *scaledownx(struct ImBuf *ibuf, int newx)
 			
 			sample += add;
 
-			while (sample >= 1.0f){
+			while (sample >= 1.0f) {
 				sample -= 1.0f;
 				
 				if (do_rect) {
@@ -991,7 +993,7 @@ static struct ImBuf *scaledowny(struct ImBuf *ibuf, int newy)
 	add = (ibuf->y - 0.01) / newy;
 	skipx = 4 * ibuf->x;
 
-	for (x = skipx - 4; x>=0 ; x-= 4) {
+	for (x = skipx - 4; x >= 0; x -= 4) {
 		if (do_rect) {
 			rect = ((uchar *) ibuf->rect) + x;
 			newrect = _newrect + x;
@@ -1005,7 +1007,7 @@ static struct ImBuf *scaledowny(struct ImBuf *ibuf, int newy)
 		val[0]=  val[1]= val[2]= val[3]= 0.0f;
 		valf[0]=valf[1]=valf[2]=valf[3]= 0.0f;
 
-		for (y = newy ; y>0 ; y--) {
+		for (y = newy; y > 0; y--) {
 			if (do_rect) {
 				nval[0] = - val[0] * sample;
 				nval[1] = - val[1] * sample;
@@ -1132,93 +1134,93 @@ static struct ImBuf *scaleupx(struct ImBuf *ibuf, int newx)
 	newrect = _newrect;
 	newrectf = _newrectf;
 
-	for (y = ibuf->y; y>0 ; y--){
+	for (y = ibuf->y; y > 0; y--) {
 
 		sample = 0;
 		
 		if (do_rect) {
-			val_a = rect[0] ;
+			val_a = rect[0];
 			nval_a = rect[4];
-			diff_a = nval_a - val_a ;
+			diff_a = nval_a - val_a;
 			val_a += 0.5f;
 
-			val_b = rect[1] ;
+			val_b = rect[1];
 			nval_b = rect[5];
-			diff_b = nval_b - val_b ;
+			diff_b = nval_b - val_b;
 			val_b += 0.5f;
 
-			val_g = rect[2] ;
+			val_g = rect[2];
 			nval_g = rect[6];
-			diff_g = nval_g - val_g ;
+			diff_g = nval_g - val_g;
 			val_g += 0.5f;
 
-			val_r = rect[3] ;
+			val_r = rect[3];
 			nval_r = rect[7];
-			diff_r = nval_r - val_r ;
+			diff_r = nval_r - val_r;
 			val_r += 0.5f;
 
 			rect += 8;
 		}
 		if (do_float) {
-			val_af = rectf[0] ;
+			val_af = rectf[0];
 			nval_af = rectf[4];
 			diff_af = nval_af - val_af;
 	
-			val_bf = rectf[1] ;
+			val_bf = rectf[1];
 			nval_bf = rectf[5];
 			diff_bf = nval_bf - val_bf;
 
-			val_gf = rectf[2] ;
+			val_gf = rectf[2];
 			nval_gf = rectf[6];
 			diff_gf = nval_gf - val_gf;
 
-			val_rf = rectf[3] ;
+			val_rf = rectf[3];
 			nval_rf = rectf[7];
 			diff_rf = nval_rf - val_rf;
 
 			rectf += 8;
 		}
-		for (x = newx ; x>0 ; x--){
-			if (sample >= 1.0f){
+		for (x = newx; x > 0; x--) {
+			if (sample >= 1.0f) {
 				sample -= 1.0f;
 
 				if (do_rect) {
-					val_a = nval_a ;
-					nval_a = rect[0] ;
-					diff_a = nval_a - val_a ;
+					val_a = nval_a;
+					nval_a = rect[0];
+					diff_a = nval_a - val_a;
 					val_a += 0.5f;
 
-					val_b = nval_b ;
-					nval_b = rect[1] ;
-					diff_b = nval_b - val_b ;
+					val_b = nval_b;
+					nval_b = rect[1];
+					diff_b = nval_b - val_b;
 					val_b += 0.5f;
 
-					val_g = nval_g ;
-					nval_g = rect[2] ;
-					diff_g = nval_g - val_g ;
+					val_g = nval_g;
+					nval_g = rect[2];
+					diff_g = nval_g - val_g;
 					val_g += 0.5f;
 
-					val_r = nval_r ;
-					nval_r = rect[3] ;
-					diff_r = nval_r - val_r ;
+					val_r = nval_r;
+					nval_r = rect[3];
+					diff_r = nval_r - val_r;
 					val_r += 0.5f;
 					rect += 4;
 				}
 				if (do_float) {
-					val_af = nval_af ;
-					nval_af = rectf[0] ;
-					diff_af = nval_af - val_af ;
+					val_af = nval_af;
+					nval_af = rectf[0];
+					diff_af = nval_af - val_af;
 	
-					val_bf = nval_bf ;
-					nval_bf = rectf[1] ;
-					diff_bf = nval_bf - val_bf ;
+					val_bf = nval_bf;
+					nval_bf = rectf[1];
+					diff_bf = nval_bf - val_bf;
 
-					val_gf = nval_gf ;
-					nval_gf = rectf[2] ;
-					diff_gf = nval_gf - val_gf ;
+					val_gf = nval_gf;
+					nval_gf = rectf[2];
+					diff_gf = nval_gf - val_gf;
 
-					val_rf = nval_rf ;
-					nval_rf = rectf[3] ;
+					val_rf = nval_rf;
+					nval_rf = rectf[3];
 					diff_rf = nval_rf - val_rf;
 					rectf += 4;
 				}
@@ -1300,31 +1302,31 @@ static struct ImBuf *scaleupy(struct ImBuf *ibuf, int newy)
 	newrect = _newrect;
 	newrectf = _newrectf;
 
-	for (x = ibuf->x; x>0 ; x--){
+	for (x = ibuf->x; x > 0; x--) {
 
 		sample = 0;
 		if (do_rect) {
 			rect = ((uchar *)ibuf->rect) + 4*(x-1);
 			newrect = _newrect + 4*(x-1);
 
-			val_a = rect[0] ;
+			val_a = rect[0];
 			nval_a = rect[skipx];
-			diff_a = nval_a - val_a ;
+			diff_a = nval_a - val_a;
 			val_a += 0.5f;
 
-			val_b = rect[1] ;
+			val_b = rect[1];
 			nval_b = rect[skipx+1];
-			diff_b = nval_b - val_b ;
+			diff_b = nval_b - val_b;
 			val_b += 0.5f;
 
-			val_g = rect[2] ;
+			val_g = rect[2];
 			nval_g = rect[skipx+2];
-			diff_g = nval_g - val_g ;
+			diff_g = nval_g - val_g;
 			val_g += 0.5f;
 
-			val_r = rect[3] ;
+			val_r = rect[3];
 			nval_r = rect[skipx+4];
-			diff_r = nval_r - val_r ;
+			diff_r = nval_r - val_r;
 			val_r += 0.5f;
 
 			rect += 2*skipx;
@@ -1333,66 +1335,66 @@ static struct ImBuf *scaleupy(struct ImBuf *ibuf, int newy)
 			rectf = ((float *)ibuf->rect_float) + 4*(x-1);
 			newrectf = _newrectf + 4*(x-1);
 
-			val_af = rectf[0] ;
+			val_af = rectf[0];
 			nval_af = rectf[skipx];
 			diff_af = nval_af - val_af;
 	
-			val_bf = rectf[1] ;
+			val_bf = rectf[1];
 			nval_bf = rectf[skipx+1];
 			diff_bf = nval_bf - val_bf;
 
-			val_gf = rectf[2] ;
+			val_gf = rectf[2];
 			nval_gf = rectf[skipx+2];
 			diff_gf = nval_gf - val_gf;
 
-			val_rf = rectf[3] ;
+			val_rf = rectf[3];
 			nval_rf = rectf[skipx+3];
 			diff_rf = nval_rf - val_rf;
 
 			rectf += 2*skipx;
 		}
 		
-		for (y = newy ; y>0 ; y--){
-			if (sample >= 1.0f){
+		for (y = newy; y > 0; y--) {
+			if (sample >= 1.0f) {
 				sample -= 1.0f;
 
 				if (do_rect) {
-					val_a = nval_a ;
-					nval_a = rect[0] ;
-					diff_a = nval_a - val_a ;
+					val_a = nval_a;
+					nval_a = rect[0];
+					diff_a = nval_a - val_a;
 					val_a += 0.5f;
 
-					val_b = nval_b ;
-					nval_b = rect[1] ;
-					diff_b = nval_b - val_b ;
+					val_b = nval_b;
+					nval_b = rect[1];
+					diff_b = nval_b - val_b;
 					val_b += 0.5f;
 
-					val_g = nval_g ;
-					nval_g = rect[2] ;
-					diff_g = nval_g - val_g ;
+					val_g = nval_g;
+					nval_g = rect[2];
+					diff_g = nval_g - val_g;
 					val_g += 0.5f;
 
-					val_r = nval_r ;
-					nval_r = rect[3] ;
-					diff_r = nval_r - val_r ;
+					val_r = nval_r;
+					nval_r = rect[3];
+					diff_r = nval_r - val_r;
 					val_r += 0.5f;
 					rect += skipx;
 				}
 				if (do_float) {
-					val_af = nval_af ;
-					nval_af = rectf[0] ;
-					diff_af = nval_af - val_af ;
+					val_af = nval_af;
+					nval_af = rectf[0];
+					diff_af = nval_af - val_af;
 	
-					val_bf = nval_bf ;
-					nval_bf = rectf[1] ;
-					diff_bf = nval_bf - val_bf ;
+					val_bf = nval_bf;
+					nval_bf = rectf[1];
+					diff_bf = nval_bf - val_bf;
 
-					val_gf = nval_gf ;
-					nval_gf = rectf[2] ;
-					diff_gf = nval_gf - val_gf ;
+					val_gf = nval_gf;
+					nval_gf = rectf[2];
+					diff_gf = nval_gf - val_gf;
 
-					val_rf = nval_rf ;
-					nval_rf = rectf[3] ;
+					val_rf = nval_rf;
+					nval_rf = rectf[3];
 					diff_rf = nval_rf - val_rf;
 					rectf += skipx;
 				}
@@ -1448,12 +1450,12 @@ static void scalefast_Z_ImBuf(ImBuf *ibuf, int newx, int newy)
 
 		newrect = _newrect;
 	
-		for (y = newy; y > 0 ; y--){
+		for (y = newy; y > 0; y--) {
 			rect = (unsigned int*) ibuf->zbuf;
 			rect += (ofsy >> 16) * ibuf->x;
 			ofsy += stepy;
 			ofsx = 32768;
-			for (x = newx ; x > 0 ; x--){
+			for (x = newx; x > 0; x--) {
 				*newrect++ = rect[ofsx >> 16];
 				ofsx += stepx;
 			}
@@ -1473,7 +1475,7 @@ struct ImBuf *IMB_scaleImBuf(struct ImBuf * ibuf, unsigned int newx, unsigned in
 	if (newx == ibuf->x && newy == ibuf->y) { return ibuf; }
 
 	/* scaleup / scaledown functions below change ibuf->x and ibuf->y
-	   so we first scale the Z-buffer (if any) */
+	 * so we first scale the Z-buffer (if any) */
 	scalefast_Z_ImBuf(ibuf, newx, newy);
 
 	/* try to scale common cases in a fast way */
@@ -1511,7 +1513,7 @@ struct ImBuf *IMB_scalefastImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned
 	
 	if (newx == ibuf->x && newy == ibuf->y) return(ibuf);
 	
-	if(do_rect) {
+	if (do_rect) {
 		_newrect = MEM_mallocN(newx * newy * sizeof(int), "scalefastimbuf");
 		if (_newrect==NULL) return(ibuf);
 		newrect = _newrect;
@@ -1530,8 +1532,8 @@ struct ImBuf *IMB_scalefastImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned
 	stepy = (65536.0 * (ibuf->y - 1.0) / (newy - 1.0)) + 0.5;
 	ofsy = 32768;
 
-	for (y = newy; y > 0 ; y--){
-		if(do_rect) {
+	for (y = newy; y > 0; y--) {
+		if (do_rect) {
 			rect = ibuf->rect;
 			rect += (ofsy >> 16) * ibuf->x;
 		}
@@ -1543,7 +1545,7 @@ struct ImBuf *IMB_scalefastImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned
 		ofsx = 32768;
 		
 		if (do_rect) {
-			for (x = newx ; x>0 ; x--){
+			for (x = newx; x>0; x--) {
 				*newrect++ = rect[ofsx >> 16];
 				ofsx += stepx;
 			}
@@ -1551,7 +1553,7 @@ struct ImBuf *IMB_scalefastImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned
 
 		if (do_float) {
 			ofsx = 32768;
-			for (x = newx ; x>0 ; x--){
+			for (x = newx; x>0; x--) {
 				*newrectf++ = rectf[ofsx >> 16];
 				ofsx += stepx;
 			}
diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c
index 895f922..7aceb69 100644
--- a/source/blender/imbuf/intern/targa.c
+++ b/source/blender/imbuf/intern/targa.c
@@ -126,18 +126,18 @@ static short makebody_tga(ImBuf * ibuf, FILE * file, int (*out)(unsigned int, FI
 		last = *rect++;
 		this = *rect++;
 		copy = last^this;
-		while (bytes > 0){
-			if (copy){
-				do{
+		while (bytes > 0) {
+			if (copy) {
+				do {
 					last = this;
 					this = *rect++;
-					if (last == this){
-						if (this == rect[-3]){	/* three the same? */
+					if (last == this) {
+						if (this == rect[-3]) {	/* three the same? */
 							bytes --;		/* set bytes */
 							break;
 						}
 					}
-				}while (--bytes != 0);
+				} while (--bytes != 0);
 
 				copy = rect-rectstart;
 				copy --;
@@ -146,22 +146,23 @@ static short makebody_tga(ImBuf * ibuf, FILE * file, int (*out)(unsigned int, FI
 				temp = rect;
 				rect = rectstart;
 
-				while (copy){
+				while (copy) {
 					last = copy;
 					if (copy>=128) last = 128;
 					copy -= last;
 					if (fputc(last-1,file) == EOF) return(0);
-					do{
+					do {
 						if (out(*rect++,file) == EOF) return(0);
-					}while(--last != 0);
+					} while (--last != 0);
 				}
 				rectstart = rect;
 				rect = temp;
 				last = this;
 
 				copy = FALSE;
-			} else {
-				while (*rect++ == this){		/* seek for first different byte */
+			}
+			else {
+				while (*rect++ == this) {		/* seek for first different byte */
 					if (--bytes == 0) break;	/* oor end of line */
 				}
 				rect --;
@@ -170,14 +171,16 @@ static short makebody_tga(ImBuf * ibuf, FILE * file, int (*out)(unsigned int, FI
 				bytes --;
 				this = *rect++;
 
-				while (copy){
-					if (copy>128){
+				while (copy) {
+					if (copy>128) {
 						if (fputc(255,file) == EOF) return(0);
 						copy -= 128;
-					} else {
-						if (copy == 1){
+					}
+					else {
+						if (copy == 1) {
 							if (fputc(0,file) == EOF) return(0);
-						} else if (fputc(127 + copy,file) == EOF) return(0);
+						}
+						else if (fputc(127 + copy,file) == EOF) return(0);
 						copy = 0;
 					}
 					if (out(last,file) == EOF) return(0);
@@ -201,28 +204,31 @@ static int dumptarga(struct ImBuf * ibuf, FILE * file)
 	rect = (uchar *) ibuf->rect;
 
 	if (ibuf->planes <= 8) {
-		while(size > 0){
+		while (size > 0) {
 			if (putc(*rect, file) == EOF) return (0);
 			size--;
 			rect += 4;
 		}
-	} else if (ibuf->planes <= 16) {
-		while(size > 0){
+	}
+	else if (ibuf->planes <= 16) {
+		while (size > 0) {
 			putc(rect[0], file);
 			if (putc(rect[1], file) == EOF) return (0);
 			size--;
 			rect += 4;
 		}
-	} else if (ibuf->planes <= 24) {
-		while(size > 0){
+	}
+	else if (ibuf->planes <= 24) {
+		while (size > 0) {
 			putc(rect[2], file);
 			putc(rect[1], file);
 			if (putc(rect[0], file) == EOF) return (0);
 			size--;
 			rect += 4;
 		}
-	} else if (ibuf->planes <= 32) {
-		while(size > 0){
+	}
+	else if (ibuf->planes <= 32) {
+		while (size > 0) {
 			putc(rect[2], file);
 			putc(rect[1], file);
 			putc(rect[0], file);
@@ -230,7 +236,8 @@ static int dumptarga(struct ImBuf * ibuf, FILE * file)
 			size--;
 			rect += 4;
 		}
-	} else return (0);
+	}
+	else return (0);
 	
 	return (1);
 }
@@ -245,9 +252,10 @@ int imb_savetarga(struct ImBuf * ibuf, const char *name, int flags)
 	(void)flags; /* unused */
 
 	buf[16] = (ibuf->planes + 0x7 ) & ~0x7;
-	if (ibuf->planes > 8 ){
+	if (ibuf->planes > 8 ) {
 		buf[2] = 10;
-	} else{
+	}
+	else {
 		buf[2] = 11;
 	}
 
@@ -268,7 +276,7 @@ int imb_savetarga(struct ImBuf * ibuf, const char *name, int flags)
 	if (ibuf->planes==32) {
 		buf[17] |= 0x08;
 	}
-	fildes = fopen(name,"wb");
+	fildes = BLI_fopen(name,"wb");
 		if (!fildes) return 0;
 
 	if (fwrite(buf, 1, 18,fildes) != 18) {
@@ -278,8 +286,9 @@ int imb_savetarga(struct ImBuf * ibuf, const char *name, int flags)
 
 	if (ibuf->ftype == RAWTGA) {
 		ok = dumptarga(ibuf, fildes);
-	} else {		
-		switch((ibuf->planes + 7) >> 3){
+	}
+	else {
+		switch((ibuf->planes + 7) >> 3) {
 		case 1:
 			ok = makebody_tga(ibuf, fildes, tga_out1);
 			break;
@@ -317,7 +326,7 @@ static int checktarga(TARGA *tga, unsigned char *mem)
 	tga->imgdes = mem[17];
 
 	if (tga->maptyp > 1) return(0);
-	switch (tga->imgtyp){
+	switch (tga->imgtyp) {
 	case 1:			/* raw cmap */
 	case 2:			/* raw rgb */
 	case 3:			/* raw b&w */
@@ -346,7 +355,7 @@ int imb_is_a_targa(unsigned char *buf)
 static void complete_partial_load(struct ImBuf *ibuf, unsigned int *rect)
 {
 	int size = (ibuf->x * ibuf->y) - (rect - ibuf->rect);
-	if(size) {
+	if (size) {
 		printf("decodetarga: incomplete file, %.1f%% missing\n", 100*((float)size / (ibuf->x * ibuf->y)));
 
 		/* not essential but makes displaying partially rendered TGA's less ugly  */
@@ -375,18 +384,18 @@ static void decodetarga(struct ImBuf *ibuf, unsigned char *mem, size_t mem_size,
 	cp[0] = 0xff;
 	cp[1] = cp[2] = 0;
 
-	while(size > 0){
+	while (size > 0) {
 		count = *mem++;
 
-		if(mem>mem_end)
+		if (mem>mem_end)
 			goto partial_load;
 
 		if (count >= 128) {
 			/*if (count == 128) printf("TARGA: 128 in file !\n");*/
 			count -= 127;
 
-			if (psize & 2){
-				if (psize & 1){
+			if (psize & 2) {
+				if (psize & 1) {
 					/* order = bgra */
 					cp[0] = mem[3];
 					cp[1] = mem[0];
@@ -394,19 +403,22 @@ static void decodetarga(struct ImBuf *ibuf, unsigned char *mem, size_t mem_size,
 					cp[3] = mem[2];
 					/*col = (mem[3] << 24) + (mem[0] << 16) + (mem[1] << 8) + mem[2];*/
 					mem += 4;
-				} else{
+				}
+				else {
 					cp[1] = mem[0];
 					cp[2] = mem[1];
 					cp[3] = mem[2];
 					/*col = 0xff000000 + (mem[0] << 16) + (mem[1] << 8) + mem[2];*/
 					mem += 3;
 				}
-			} else{
-				if (psize & 1){
+			}
+			else {
+				if (psize & 1) {
 					cp[0] = mem[0];
 					cp[1] = mem[1];
 					mem += 2;
-				} else{
+				}
+				else {
 					col = *mem++;
 				}
 			}
@@ -418,13 +430,14 @@ static void decodetarga(struct ImBuf *ibuf, unsigned char *mem, size_t mem_size,
 					count--;
 				}
 			}
-		} else{
+		}
+		else {
 			count ++;
 			size -= count;
 			if (size >= 0) {
-				while (count > 0){
-					if (psize & 2){
-						if (psize & 1){
+				while (count > 0) {
+					if (psize & 2) {
+						if (psize & 1) {
 							/* order = bgra */
 							cp[0] = mem[3];
 							cp[1] = mem[0];
@@ -432,30 +445,33 @@ static void decodetarga(struct ImBuf *ibuf, unsigned char *mem, size_t mem_size,
 							cp[3] = mem[2];
 							/*col = (mem[3] << 24) + (mem[0] << 16) + (mem[1] << 8) + mem[2];*/
 							mem += 4;
-						} else{
+						}
+						else {
 							cp[1] = mem[0];
 							cp[2] = mem[1];
 							cp[3] = mem[2];
 							/*col = 0xff000000 + (mem[0] << 16) + (mem[1] << 8) + mem[2];*/
 							mem += 3;
 						}
-					} else{
-						if (psize & 1){
+					}
+					else {
+						if (psize & 1) {
 							cp[0] = mem[0];
 							cp[1] = mem[1];
 							mem += 2;
-						} else{
+						}
+						else {
 							col = *mem++;
 						}
 					}
 					*rect++ = col;
 					count --;
 
-					if(mem>mem_end)
+					if (mem>mem_end)
 						goto partial_load;
 				}
 
-				if(mem>mem_end)
+				if (mem>mem_end)
 					goto partial_load;
 			}
 		}
@@ -486,12 +502,12 @@ static void ldtarga(struct ImBuf * ibuf,unsigned char * mem, size_t mem_size, in
 	cp[0] = 0xff;
 	cp[1] = cp[2] = 0;
 
-	while(size > 0){
-		if(mem>mem_end)
+	while (size > 0) {
+		if (mem>mem_end)
 			goto partial_load;
 
-		if (psize & 2){
-			if (psize & 1){
+		if (psize & 2) {
+			if (psize & 1) {
 				/* order = bgra */
 				cp[0] = mem[3];
 				cp[1] = mem[0];
@@ -499,7 +515,8 @@ static void ldtarga(struct ImBuf * ibuf,unsigned char * mem, size_t mem_size, in
 				cp[3] = mem[2];
 				/*col = (mem[3] << 24) + (mem[0] << 16) + (mem[1] << 8) + mem[2];*/
 				mem += 4;
-			} else{
+			}
+			else {
 				/* set alpha for 24 bits colors */
 				cp[1] = mem[0];
 				cp[2] = mem[1];
@@ -507,12 +524,14 @@ static void ldtarga(struct ImBuf * ibuf,unsigned char * mem, size_t mem_size, in
 				/*col = 0xff000000 + (mem[0] << 16) + (mem[1] << 8) + mem[2];*/
 				mem += 3;
 			}
-		} else{
-			if (psize & 1){
+		}
+		else {
+			if (psize & 1) {
 				cp[0] = mem[0];
 				cp[1] = mem[1];
 				mem += 2;
-			} else{
+			}
+			else {
 				col = *mem++;
 			}
 		}
@@ -547,7 +566,7 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags)
 	cp[0] = 0xff;
 	cp[1] = cp[2] = 0;
 	
-	if (tga.mapsize){
+	if (tga.mapsize) {
 		/* load color map */
 		/*mincol = tga.maporig;*/ /*UNUSED*/
 		maxcol = tga.mapsize;
@@ -592,13 +611,13 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags)
 	if (flags & IB_test) return (ibuf);
 
 	if (tga.imgtyp != 1 && tga.imgtyp != 9) { /* happens sometimes (beuh) */
-		if(cmap) {
+		if (cmap) {
 			MEM_freeN(cmap); 
 			cmap= NULL;
 		}
 	}
 
-	switch(tga.imgtyp){
+	switch(tga.imgtyp) {
 	case 1:
 	case 2:
 	case 3:
@@ -617,10 +636,10 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags)
 		break;
 	}
 	
-	if(cmap) {
+	if (cmap) {
 		/* apply color map */
 		rect = ibuf->rect;
-		for(size = ibuf->x * ibuf->y; size>0; --size, ++rect) {
+		for (size = ibuf->x * ibuf->y; size>0; --size, ++rect) {
 			col = *rect;
 			if (col >= 0 && col < maxcol) *rect = cmap[col];
 		}
@@ -630,7 +649,7 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags)
 	
 	if (tga.pixsize == 16) {
 		rect = ibuf->rect;
-		for (size = ibuf->x * ibuf->y; size > 0; --size, ++rect){
+		for (size = ibuf->x * ibuf->y; size > 0; --size, ++rect) {
 			col = *rect;
 			cp = (uchar*)rect; 
 			mem = (uchar*)&col;
@@ -646,14 +665,14 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags)
 		ibuf->planes = 24;
 	}
 	
-	if (tga.imgtyp == 3 || tga.imgtyp == 11){
+	if (tga.imgtyp == 3 || tga.imgtyp == 11) {
 		uchar *crect;
 		unsigned int *lrect, col;
 		
 		crect = (uchar *) ibuf->rect;
 		lrect = (unsigned int *) ibuf->rect;
 		
-		for (size = ibuf->x * ibuf->y; size > 0; size --){
+		for (size = ibuf->x * ibuf->y; size > 0; size --) {
 			col = *lrect++;
 			
 			crect[0] = 255;
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c
index 808bcbe..5d64e1b 100644
--- a/source/blender/imbuf/intern/thumbs.c
+++ b/source/blender/imbuf/intern/thumbs.c
@@ -53,16 +53,18 @@
 #include <stdio.h>
 
 #ifdef WIN32
-#include <windows.h> /* need to include windows.h so _WIN32_IE is defined  */
-#ifndef _WIN32_IE
-#define _WIN32_IE 0x0400 /* minimal requirements for SHGetSpecialFolderPath on MINGW MSVC has this defined already */
-#endif
-#include <shlobj.h> /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff because 'near' is disabled through BLI_windstuff */
-#include <process.h> /* getpid */
-#include <direct.h> /* chdir */
-#include "BLI_winstuff.h"
+#  include <windows.h> /* need to include windows.h so _WIN32_IE is defined  */
+#  ifndef _WIN32_IE
+#    define _WIN32_IE 0x0400 /* minimal requirements for SHGetSpecialFolderPath on MINGW MSVC has this defined already */
+#  endif
+#  include <shlobj.h>  /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff
+                        * because 'near' is disabled through BLI_windstuff */
+#  include <process.h> /* getpid */
+#  include <direct.h> /* chdir */
+#  include "BLI_winstuff.h"
+#  include "utfconv.h"
 #else
-#include <unistd.h>
+#  include <unistd.h>
 #endif
 
 #define URI_MAX FILE_MAX*3 + 8
@@ -70,8 +72,12 @@
 static int get_thumb_dir( char* dir , ThumbSize size)
 {
 #ifdef WIN32
+	wchar_t dir_16 [MAX_PATH];
 	/* yes, applications shouldn't store data there, but so does GIMP :)*/
-	SHGetSpecialFolderPath(0, dir, CSIDL_PROFILE, 0);
+	SHGetSpecialFolderPathW(0, dir_16, CSIDL_PROFILE, 0);
+	conv_utf_16_to_8(dir_16,dir,FILE_MAX);
+
+
 #else
 	const char* home = getenv("HOME");
 	if (!home) return 0;
@@ -144,7 +150,8 @@ static void escape_uri_string (const char *string, char* escaped_string, int len
 			*q++ = '%'; /* means hex coming */
 			*q++ = hex[c >> 4];
 			*q++ = hex[c & 15];
-		} else {
+		}
+		else {
 			*q++ = *p;
 		}
 	}
@@ -167,7 +174,7 @@ static void to_hex_char(char* hexbytes, const unsigned char* bytes, int len)
 
 /** ----- end of adapted code from glib --- */
 
-static int uri_from_filename( const char *path, char *uri )
+static int uri_from_filename(const char *path, char *uri)
 {
 	char orig_uri[URI_MAX];	
 	const char* dirstart = path;
@@ -216,6 +223,8 @@ static void thumbname_from_uri(const char* uri, char* thumb, const int thumb_len
 	to_hex_char(hexdigest, digest, 16);
 	hexdigest[32] = '\0';
 	BLI_snprintf(thumb, thumb_len, "%s.png", hexdigest);
+
+	// printf("%s: '%s' --> '%s'\n", __func__, uri, thumb);
 }
 
 static int thumbpath_from_uri(const char* uri, char* path, const int path_len, ThumbSize size)
@@ -251,8 +260,8 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im
 	char tpath[FILE_MAX];
 	char tdir[FILE_MAX];
 	char temp[FILE_MAX];
-	char mtime[40]= "0"; /* incase we can't stat the file */
-	char cwidth[40]= "0"; /* incase images have no data */
+	char mtime[40]= "0"; /* in case we can't stat the file */
+	char cwidth[40]= "0"; /* in case images have no data */
 	char cheight[40]= "0";
 	char thumb[40];
 	short tsize = 128;
@@ -275,9 +284,9 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im
 	}
 
 	/* exception, skip images over 100mb */
-	if(source == THB_SOURCE_IMAGE) {
+	if (source == THB_SOURCE_IMAGE) {
 		const size_t size= BLI_file_size(path);
-		if(size != -1 && size > THUMB_SIZE_MAX) {
+		if (size != -1 && size > THUMB_SIZE_MAX) {
 			// printf("file too big: %d, skipping %s\n", (int)size, path);
 			return NULL;
 		}
@@ -295,12 +304,13 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im
 		if (size == THB_FAIL) {
 			img = IMB_allocImBuf(1,1,32, IB_rect | IB_metadata);
 			if (!img) return NULL;
-		} else {
+		}
+		else {
 			if (THB_SOURCE_IMAGE == source || THB_SOURCE_BLEND == source) {
 				
 				/* only load if we didnt give an image */
-				if(img==NULL) {
-					if(THB_SOURCE_BLEND == source) {
+				if (img==NULL) {
+					if (THB_SOURCE_BLEND == source) {
 						img = IMB_loadblend_thumb(path);
 					}
 					else {
@@ -314,14 +324,16 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im
 					BLI_snprintf(cwidth, sizeof(cwidth), "%d", img->x);
 					BLI_snprintf(cheight, sizeof(cheight), "%d", img->y);
 				}
-			} else if (THB_SOURCE_MOVIE == source) {
+			}
+			else if (THB_SOURCE_MOVIE == source) {
 				struct anim * anim = NULL;
 				anim = IMB_open_anim(path, IB_rect | IB_metadata, 0);
 				if (anim != NULL) {
 					img = IMB_anim_absolute(anim, 0, IMB_TC_NONE, IMB_PROXY_NONE);
 					if (img == NULL) {
 						printf("not an anim; %s\n", path);
-					} else {
+					}
+					else {
 						IMB_freeImBuf(img);
 						img = IMB_anim_previewframe(anim);						
 					}
@@ -344,8 +356,8 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im
 			ey = (short)scaledy;
 			
 			/* save some time by only scaling byte buf */
-			if(img->rect_float) {
-				if(img->rect == NULL) {
+			if (img->rect_float) {
+				if (img->rect == NULL) {
 					IMB_rect_from_float(img);
 				}
 
@@ -368,7 +380,9 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im
 		if (IMB_saveiff(img, temp, IB_rect | IB_metadata)) {
 #ifndef WIN32
 			chmod(temp, S_IRUSR | S_IWUSR);
-#endif	
+#endif
+			// printf("%s saving thumb: '%s'\n", __func__, tpath);
+
 			BLI_rename(temp, tpath);
 		}
 
@@ -431,14 +445,21 @@ ImBuf* IMB_thumb_manage(const char* path, ThumbSize size, ThumbSource source)
 	if (thumbpath_from_uri(uri, thumb, sizeof(thumb), THB_FAIL)) {
 		/* failure thumb exists, don't try recreating */
 		if (BLI_exists(thumb)) {
-			return NULL;
+			/* clear out of date fail case */
+			if (BLI_file_older(thumb, path)) {
+				BLI_delete(thumb, 0, 0);
+			}
+			else {
+				return NULL;
+			}
 		}
 	}
 
 	if (thumbpath_from_uri(uri, thumb, sizeof(thumb), size)) {
 		if (BLI_path_ncmp(path, thumb, sizeof(thumb)) == 0) {
 			img = IMB_loadiffname(path, IB_rect);
-		} else {
+		}
+		else {
 			img = IMB_loadiffname(thumb, IB_rect | IB_metadata);
 			if (img) {
 				char mtime[40];
@@ -446,7 +467,8 @@ ImBuf* IMB_thumb_manage(const char* path, ThumbSize size, ThumbSource source)
 					/* illegal thumb, forget it! */
 					IMB_freeImBuf(img);
 					img = NULL;
-				} else {
+				}
+				else {
 					time_t t = atol(mtime);
 					if (st.st_mtime != t) {
 						/* recreate all thumbs */
@@ -456,7 +478,7 @@ ImBuf* IMB_thumb_manage(const char* path, ThumbSize size, ThumbSource source)
 						IMB_thumb_delete(path, THB_LARGE);
 						IMB_thumb_delete(path, THB_FAIL);
 						img = IMB_thumb_create(path, size, source, NULL);
-						if(!img){
+						if (!img) {
 							/* thumb creation failed, write fail thumb */
 							img = IMB_thumb_create(path, THB_FAIL, source, NULL);
 							if (img) {
@@ -467,9 +489,10 @@ ImBuf* IMB_thumb_manage(const char* path, ThumbSize size, ThumbSource source)
 						}
 					}
 				}
-			} else {
+			}
+			else {
 				img = IMB_thumb_create(path, size, source, NULL);
-				if(!img){
+				if (!img) {
 					/* thumb creation failed, write fail thumb */
 					img = IMB_thumb_create(path, THB_FAIL, source, NULL);
 					if (img) {
diff --git a/source/blender/imbuf/intern/thumbs_blend.c b/source/blender/imbuf/intern/thumbs_blend.c
index 149b5fb..2d477a5 100644
--- a/source/blender/imbuf/intern/thumbs_blend.c
+++ b/source/blender/imbuf/intern/thumbs_blend.c
@@ -30,6 +30,7 @@
 #include "zlib.h"
 
 #include "BLI_utildefines.h"
+#include "BLI_fileops.h"
 
 #include "BKE_utildefines.h"
 #include "BKE_global.h"
@@ -41,7 +42,7 @@
 #include "MEM_guardedalloc.h"
 
 /* extracts the thumbnail from between the 'REND' and the 'GLOB'
- * chunks of the header, dont use typical blend loader because its too slow */
+ * chunks of the header, don't use typical blend loader because its too slow */
 
 static ImBuf *loadblend_thumb(gzFile gzfile)
 {
@@ -49,34 +50,34 @@ static ImBuf *loadblend_thumb(gzFile gzfile)
 	int bhead[24/sizeof(int)]; /* max size on 64bit */
 	char endian, pointer_size;
 	char endian_switch;
-	int sizeof_bhead ;
+	int sizeof_bhead;
 
 	/* read the blend file header */
-	if(gzread(gzfile, buf, 12) != 12)
+	if (gzread(gzfile, buf, 12) != 12)
 		return NULL;
-	if(strncmp(buf, "BLENDER", 7))
+	if (strncmp(buf, "BLENDER", 7))
 		return NULL;
 
-	if(buf[7]=='-')
+	if (buf[7]=='-')
 		pointer_size= 8;
-	else if(buf[7]=='_')
+	else if (buf[7]=='_')
 		pointer_size= 4;
 	else
 		return NULL;
 
 	sizeof_bhead = 16 + pointer_size;
 
-	if(buf[8]=='V')
+	if (buf[8]=='V')
 		endian= B_ENDIAN; /* big: PPC */
-	else if(buf[8]=='v')
+	else if (buf[8]=='v')
 		endian= L_ENDIAN; /* little: x86 */
 	else
 		return NULL;
 
 	endian_switch = ((ENDIAN_ORDER != endian)) ? 1 : 0;
 
-	while(gzread(gzfile, bhead, sizeof_bhead) == sizeof_bhead) {
-		if(endian_switch)
+	while (gzread(gzfile, bhead, sizeof_bhead) == sizeof_bhead) {
+		if (endian_switch)
 			SWITCH_INT(bhead[1]); /* length */
 
 		if (bhead[0]==REND) {
@@ -88,14 +89,14 @@ static ImBuf *loadblend_thumb(gzFile gzfile)
 	}
 
 	/* using 'TEST' since new names segfault when loading in old blenders */
-	if(bhead[0] == TEST) {
+	if (bhead[0] == TEST) {
 		ImBuf *img= NULL;
 		int size[2];
 
-		if(gzread(gzfile, size, sizeof(size)) != sizeof(size))
+		if (gzread(gzfile, size, sizeof(size)) != sizeof(size))
 			return NULL;
 
-		if(endian_switch) {
+		if (endian_switch) {
 			SWITCH_INT(size[0]);
 			SWITCH_INT(size[1]);
 		}
@@ -103,13 +104,13 @@ static ImBuf *loadblend_thumb(gzFile gzfile)
 		bhead[1] -= sizeof(int) * 2;
 
 		/* inconsistent image size, quit early */
-		if(bhead[1] != size[0] * size[1] * sizeof(int))
+		if (bhead[1] != size[0] * size[1] * sizeof(int))
 			return NULL;
 	
 		/* finally malloc and read the data */
 		img= IMB_allocImBuf(size[0], size[1], 32, IB_rect | IB_metadata);
 	
-		if(gzread(gzfile, img->rect, bhead[1]) != bhead[1]) {
+		if (gzread(gzfile, img->rect, bhead[1]) != bhead[1]) {
 			IMB_freeImBuf(img);
 			img= NULL;
 		}
@@ -123,9 +124,8 @@ static ImBuf *loadblend_thumb(gzFile gzfile)
 ImBuf *IMB_loadblend_thumb(const char *path)
 {
 	gzFile gzfile;
-
 	/* not necessarily a gzip */
-	gzfile = gzopen(path, "rb");
+	gzfile = BLI_gzopen(path, "rb");
 
 	if (NULL == gzfile ) {
 		return NULL;
@@ -151,7 +151,7 @@ void IMB_overlayblend_thumb(unsigned int *thumb, int width, int height, float as
 	int margin_r = width - MARGIN;
 	int margin_t = height - MARGIN;
 
-	if(aspect < 1.0f) {
+	if (aspect < 1.0f) {
 		margin_l= (int)((width - ((float)width * aspect)) / 2.0f);
 		margin_l += MARGIN;
 		CLAMP(margin_l, MARGIN, (width/2));
@@ -168,18 +168,19 @@ void IMB_overlayblend_thumb(unsigned int *thumb, int width, int height, float as
 		int x, y;
 		int stride_x= (margin_r - margin_l) - 2;
 		
-		for(y=0; y < height; y++) {
-			for(x=0; x < width; x++, px+=4) {
+		for (y=0; y < height; y++) {
+			for (x=0; x < width; x++, px+=4) {
 				int hline= 0, vline= 0;
-				if((x > margin_l && x < margin_r) && (y > margin_b && y < margin_t)) {
+				if ((x > margin_l && x < margin_r) && (y > margin_b && y < margin_t)) {
 					/* interior. skip */
 					x  += stride_x;
 					px += stride_x * 4;
-				} else if(	(hline=(((x == margin_l || x == margin_r)) && y >= margin_b && y <= margin_t)) ||
-							(vline=(((y == margin_b || y == margin_t)) && x >= margin_l && x <= margin_r))
-				) {
+				}
+				else if ((hline=(((x == margin_l || x == margin_r)) && y >= margin_b && y <= margin_t)) ||
+				        (vline=(((y == margin_b || y == margin_t)) && x >= margin_l && x <= margin_r)))
+				{
 					/* dashed line */
-					if((hline && y % 2) || (vline && x % 2)) {
+					if ((hline && y % 2) || (vline && x % 2)) {
 						px[0]= px[1]= px[2]= 0;
 						px[3] = 255;
 					}
diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c
index 6fe2a3b..08b2e60 100644
--- a/source/blender/imbuf/intern/tiff.c
+++ b/source/blender/imbuf/intern/tiff.c
@@ -85,7 +85,7 @@ typedef struct ImbTIFFMemFile {
 	toff_t offset;		/* Current offset within the file.      */
 	tsize_t size;		/* Size of the TIFF file.               */
 } ImbTIFFMemFile;
-#define IMB_TIFF_GET_MEMFILE(x) ((ImbTIFFMemFile*)(x));
+#define IMB_TIFF_GET_MEMFILE(x) ((ImbTIFFMemFile*)(x))
 
 
 
@@ -113,11 +113,11 @@ static int imb_tiff_DummyMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize)
 /**
  * Reads data from an in-memory TIFF file.
  *
- * @param handle: Handle of the TIFF file (pointer to ImbTIFFMemFile).
- * @param data:   Buffer to contain data (treat as void*).
- * @param n:      Number of bytes to read.
+ * \param handle: Handle of the TIFF file (pointer to ImbTIFFMemFile).
+ * \param data:   Buffer to contain data (treat as void*).
+ * \param n:      Number of bytes to read.
  *
- * @return: Number of bytes actually read.
+ * \return: Number of bytes actually read.
  * 	 0 = EOF.
  */
 static tsize_t imb_tiff_ReadProc(thandle_t handle, tdata_t data, tsize_t n)
@@ -128,23 +128,23 @@ static tsize_t imb_tiff_ReadProc(thandle_t handle, tdata_t data, tsize_t n)
 
 	/* get the pointer to the in-memory file */
 	mfile = IMB_TIFF_GET_MEMFILE(handle);
-	if(!mfile || !mfile->mem) {
+	if (!mfile || !mfile->mem) {
 		fprintf(stderr, "imb_tiff_ReadProc: !mfile || !mfile->mem!\n");
 		return 0;
 	}
 
 	/* find the actual number of bytes to read (copy) */
 	nCopy = n;
-	if((tsize_t)mfile->offset >= mfile->size)
+	if ((tsize_t)mfile->offset >= mfile->size)
 		nRemaining = 0;
 	else
 		nRemaining = mfile->size - mfile->offset;
 	
-	if(nCopy > nRemaining)
+	if (nCopy > nRemaining)
 		nCopy = nRemaining;
 	
 	/* on EOF, return immediately and read (copy) nothing */
-	if(nCopy <= 0)
+	if (nCopy <= 0)
 		return (0);
 
 	/* all set -> do the read (copy) */
@@ -177,15 +177,15 @@ static tsize_t imb_tiff_WriteProc(thandle_t handle, tdata_t data, tsize_t n)
 /**
  * Seeks to a new location in an in-memory TIFF file.
  *
- * @param handle: Handle of the TIFF file (pointer to ImbTIFFMemFile).
- * @param ofs:    Offset value (interpreted according to whence below).
- * @param whence: This can be one of three values:
+ * \param handle: Handle of the TIFF file (pointer to ImbTIFFMemFile).
+ * \param ofs:    Offset value (interpreted according to whence below).
+ * \param whence: This can be one of three values:
  * 	SEEK_SET - The offset is set to ofs bytes.
  * 	SEEK_CUR - The offset is set to its current location plus ofs bytes.
  * 	SEEK_END - (This is unsupported and will return -1, indicating an
  * 	            error).
  *
- * @return: Resulting offset location within the file, measured in bytes from
+ * \return: Resulting offset location within the file, measured in bytes from
  *          the beginning of the file.  (-1) indicates an error.
  */
 static toff_t imb_tiff_SeekProc(thandle_t handle, toff_t ofs, int whence)
@@ -195,7 +195,7 @@ static toff_t imb_tiff_SeekProc(thandle_t handle, toff_t ofs, int whence)
 
 	/* get the pointer to the in-memory file */
 	mfile = IMB_TIFF_GET_MEMFILE(handle);
-	if(!mfile || !mfile->mem) {
+	if (!mfile || !mfile->mem) {
 		fprintf(stderr, "imb_tiff_SeekProc: !mfile || !mfile->mem!\n");
 		return (-1);
 	}
@@ -231,9 +231,9 @@ static toff_t imb_tiff_SeekProc(thandle_t handle, toff_t ofs, int whence)
  *       are made to access the file after that point.  However, no such
  *       attempts should ever be made (in theory).
  *
- * @param handle: Handle of the TIFF file (pointer to ImbTIFFMemFile).
+ * \param handle: Handle of the TIFF file (pointer to ImbTIFFMemFile).
  *
- * @return: 0
+ * \return: 0
  */
 static int imb_tiff_CloseProc(thandle_t handle)
 {
@@ -241,7 +241,7 @@ static int imb_tiff_CloseProc(thandle_t handle)
 
 	/* get the pointer to the in-memory file */
 	mfile = IMB_TIFF_GET_MEMFILE(handle);
-	if(!mfile || !mfile->mem) {
+	if (!mfile || !mfile->mem) {
 		fprintf(stderr,"imb_tiff_CloseProc: !mfile || !mfile->mem!\n");
 		return (0);
 	}
@@ -259,7 +259,7 @@ static int imb_tiff_CloseProc(thandle_t handle)
 /**
  * Returns the size of an in-memory TIFF file in bytes.
  *
- * @return: Size of file (in bytes).
+ * \return: Size of file (in bytes).
  */
 static toff_t imb_tiff_SizeProc(thandle_t handle)
 {
@@ -267,7 +267,7 @@ static toff_t imb_tiff_SizeProc(thandle_t handle)
 
 	/* get the pointer to the in-memory file */
 	mfile = IMB_TIFF_GET_MEMFILE(handle);
-	if(!mfile || !mfile->mem) {
+	if (!mfile || !mfile->mem) {
 		fprintf(stderr,"imb_tiff_SizeProc: !mfile || !mfile->mem!\n");
 		return (0);
 	}
@@ -361,7 +361,7 @@ static void imb_read_tiff_resolution(ImBuf *ibuf, TIFF *image)
 	TIFFGetFieldDefaulted(image, TIFFTAG_XRESOLUTION, &xres);
 	TIFFGetFieldDefaulted(image, TIFFTAG_YRESOLUTION, &yres);
 
-	if(unit == RESUNIT_CENTIMETER) {
+	if (unit == RESUNIT_CENTIMETER) {
 		ibuf->ppm[0]= (double)xres * 100.0;
 		ibuf->ppm[1]= (double)yres * 100.0;
 	}
@@ -397,10 +397,12 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul)
 	if (bitspersample == 32) {
 		ib_flag = IB_rectfloat;
 		fbuf = (float *)_TIFFmalloc(scanline);
-	} else if (bitspersample == 16) {
+	}
+	else if (bitspersample == 16) {
 		ib_flag = IB_rectfloat;
 		sbuf = (unsigned short *)_TIFFmalloc(scanline);
-	} else {
+	}
+	else {
 		ib_flag = IB_rect;
 	}
 	
@@ -419,13 +421,15 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul)
 				success |= TIFFReadScanline(image, fbuf, row, 0);
 				scanline_contig_32bit(tmpibuf->rect_float+ib_offset, fbuf, ibuf->x, spp);
 				
-			} else if (bitspersample == 16) {
+			}
+			else if (bitspersample == 16) {
 				success |= TIFFReadScanline(image, sbuf, row, 0);
 				scanline_contig_16bit(tmpibuf->rect_float+ib_offset, sbuf, ibuf->x, spp);
 			}
 		}
 	/* separate channels: RRRGGGBBB */
-	} else if (config == PLANARCONFIG_SEPARATE) {
+	}
+	else if (config == PLANARCONFIG_SEPARATE) {
 		
 		/* imbufs always have 4 channels of data, so we iterate over all of them
 		 * but only fill in from the TIFF scanline where necessary. */
@@ -435,14 +439,15 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul)
 				
 				if (bitspersample == 32) {
 					if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */
-						memset(fbuf, 1.0, sizeof(fbuf));
+						fill_vn_fl(fbuf, ibuf->x, 1.0f);
 					else
 						success |= TIFFReadScanline(image, fbuf, row, chan);
 					scanline_separate_32bit(tmpibuf->rect_float+ib_offset, fbuf, ibuf->x, chan);
 					
-				} else if (bitspersample == 16) {
+				}
+				else if (bitspersample == 16) {
 					if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */
-						memset(sbuf, 65535, sizeof(sbuf));
+						fill_vn_ushort(sbuf, ibuf->x, 65535);
 					else
 						success |= TIFFReadScanline(image, sbuf, row, chan);
 					scanline_separate_16bit(tmpibuf->rect_float+ib_offset, sbuf, ibuf->x, chan);
@@ -457,14 +462,14 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul)
 	else if (bitspersample == 16)
 		_TIFFfree(sbuf);
 
-	if(success) {
+	if (success) {
 		ibuf->profile = (bitspersample==32)?IB_PROFILE_LINEAR_RGB:IB_PROFILE_SRGB;
 
 //		Code seems to be not needed for 16 bits tif, on PPC G5 OSX (ton)
-		if(bitspersample < 16)
-			if(ENDIAN_ORDER == B_ENDIAN)
+		if (bitspersample < 16)
+			if (ENDIAN_ORDER == B_ENDIAN)
 				IMB_convert_rgba_to_abgr(tmpibuf);
-		if(premul) {
+		if (premul) {
 			IMB_premultiply_alpha(tmpibuf);
 			ibuf->flags |= IB_premul;
 		}
@@ -487,7 +492,7 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul)
 
 void imb_inittiff(void)
 {
-	if (!(G.f & G_DEBUG))
+	if (!(G.debug & G_DEBUG))
 		TIFFSetErrorHandler(NULL);
 }
 
@@ -495,12 +500,12 @@ void imb_inittiff(void)
  * Loads a TIFF file.
  *
  *
- * @param mem:   Memory containing the TIFF file.
- * @param size:  Size of the mem buffer.
- * @param flags: If flags has IB_test set then the file is not actually loaded,
+ * \param mem:   Memory containing the TIFF file.
+ * \param size:  Size of the mem buffer.
+ * \param flags: If flags has IB_test set then the file is not actually loaded,
  *                but all other operations take place.
  *
- * @return: A newly allocated ImBuf structure if successful, otherwise NULL.
+ * \return: A newly allocated ImBuf structure if successful, otherwise NULL.
  */
 ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags)
 {
@@ -514,16 +519,16 @@ ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags)
 	int ib_depth;
 
 	/* check whether or not we have a TIFF file */
-	if(size < IMB_TIFF_NCB) {
+	if (size < IMB_TIFF_NCB) {
 		fprintf(stderr, "imb_loadtiff: size < IMB_TIFF_NCB\n");
 		return NULL;
 	}
-	if(imb_is_a_tiff(mem) == 0)
+	if (imb_is_a_tiff(mem) == 0)
 		return NULL;
 
 	image = imb_tiff_client_open(&memFile, mem, size);
 
-	if(image == NULL) {
+	if (image == NULL) {
 		printf("imb_loadtiff: could not open TIFF IO layer.\n");
 		return NULL;
 	}
@@ -536,7 +541,7 @@ ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags)
 	ib_depth = (spp==3)?24:32;
 	
 	ibuf = IMB_allocImBuf(width, height, ib_depth, 0);
-	if(ibuf) {
+	if (ibuf) {
 		ibuf->ftype = TIF;
 	}
 	else {
@@ -548,26 +553,26 @@ ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags)
 	}
 
 	/* if testing, we're done */
-	if(flags & IB_test) {
+	if (flags & IB_test) {
 		TIFFClose(image);
 		return ibuf;
 	}
 
 	/* detect if we are reading a tiled/mipmapped texture, in that case
-	   we don't read pixels but leave it to the cache to load tiles */
-	if(flags & IB_tilecache) {
+	 * we don't read pixels but leave it to the cache to load tiles */
+	if (flags & IB_tilecache) {
 		format= NULL;
 		TIFFGetField(image, TIFFTAG_PIXAR_TEXTUREFORMAT, &format);
 
-		if(format && strcmp(format, "Plain Texture")==0 && TIFFIsTiled(image)) {
+		if (format && strcmp(format, "Plain Texture")==0 && TIFFIsTiled(image)) {
 			int numlevel = TIFFNumberOfDirectories(image);
 
 			/* create empty mipmap levels in advance */
-			for(level=0; level<numlevel; level++) {
-				if(!TIFFSetDirectory(image, level))
+			for (level=0; level<numlevel; level++) {
+				if (!TIFFSetDirectory(image, level))
 					break;
 
-				if(level > 0) {
+				if (level > 0) {
 					width= (width > 1)? width/2: 1;
 					height= (height > 1)? height/2: 1;
 
@@ -576,7 +581,7 @@ ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags)
 					hbuf->ftype= ibuf->ftype;
 					ibuf->mipmap[level-1] = hbuf;
 
-					if(flags & IB_premul)
+					if (flags & IB_premul)
 						hbuf->flags |= IB_premul;
 				}
 				else
@@ -598,7 +603,7 @@ ImBuf *imb_loadtiff(unsigned char *mem, size_t size, int flags)
 	}
 
 	/* read pixels */
-	if(!(ibuf->flags & IB_tilecache) && !imb_read_tiff_pixels(ibuf, image, 0)) {
+	if (!(ibuf->flags & IB_tilecache) && !imb_read_tiff_pixels(ibuf, image, 0)) {
 		fprintf(stderr, "imb_loadtiff: Failed to read tiff image.\n");
 		TIFFClose(image);
 		return NULL;
@@ -619,23 +624,23 @@ void imb_loadtiletiff(ImBuf *ibuf, unsigned char *mem, size_t size, int tx, int
 
 	image = imb_tiff_client_open(&memFile, mem, size);
 
-	if(image == NULL) {
+	if (image == NULL) {
 		printf("imb_loadtiff: could not open TIFF IO layer for loading mipmap level.\n");
 		return;
 	}
 
-	if(TIFFSetDirectory(image, ibuf->miplevel)) { /* allocate the image buffer */
+	if (TIFFSetDirectory(image, ibuf->miplevel)) { /* allocate the image buffer */
 		TIFFGetField(image, TIFFTAG_IMAGEWIDTH,  &width);
 		TIFFGetField(image, TIFFTAG_IMAGELENGTH, &height);
 
-		if(width == ibuf->x && height == ibuf->y) {
-			if(rect) {
+		if (width == ibuf->x && height == ibuf->y) {
+			if (rect) {
 				/* tiff pixels are bottom to top, tiles are top to bottom */
-				if(TIFFReadRGBATile(image, tx*ibuf->tilex, (ibuf->ytiles - 1 - ty)*ibuf->tiley, rect) == 1) {
-					if(ibuf->tiley > ibuf->y)
+				if (TIFFReadRGBATile(image, tx*ibuf->tilex, (ibuf->ytiles - 1 - ty)*ibuf->tiley, rect) == 1) {
+					if (ibuf->tiley > ibuf->y)
 						memmove(rect, rect+ibuf->tilex*(ibuf->tiley - ibuf->y), sizeof(int)*ibuf->tilex*ibuf->y);
 
-					if(ibuf->flags & IB_premul)
+					if (ibuf->flags & IB_premul)
 						IMB_premultiply_rect(rect, 32, ibuf->tilex, ibuf->tiley);
 				}
 				else
@@ -661,11 +666,11 @@ void imb_loadtiletiff(ImBuf *ibuf, unsigned char *mem, size_t size, int tx, int
  * Blender by setting "Premul" alpha handling.  Other alpha conventions are
  * not strictly correct, but are permitted anyhow.
  *
- * @param ibuf:  Image buffer.
- * @param name:  Name of the TIFF file to create.
- * @param flags: Currently largely ignored.
+ * \param ibuf:  Image buffer.
+ * \param name:  Name of the TIFF file to create.
+ * \param flags: Currently largely ignored.
  *
- * @return: 1 if the function is successful, 0 on failure.
+ * \return: 1 if the function is successful, 0 on failure.
  */
 
 int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
@@ -686,20 +691,20 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
 	 * the TIFF writer supports 1, 3 or 4 bytes per pixel, corresponding
 	 * to gray, RGB, RGBA respectively. */
 	samplesperpixel = (uint16)((ibuf->planes + 7) >> 3);
-	if((samplesperpixel > 4) || (samplesperpixel == 2)) {
+	if ((samplesperpixel > 4) || (samplesperpixel == 2)) {
 		fprintf(stderr,
 			"imb_savetiff: unsupported number of bytes per " 
 			"pixel: %d\n", samplesperpixel);
 		return (0);
 	}
 
-	if((ibuf->ftype & TIF_16BIT) && ibuf->rect_float)
+	if ((ibuf->ftype & TIF_16BIT) && ibuf->rect_float)
 		bitspersample = 16;
 	else
 		bitspersample = 8;
 
 	/* open TIFF file for writing */
-	if(flags & IB_mem) {
+	if (flags & IB_mem) {
 		/* bork at the creation of a TIFF in memory */
 		fprintf(stderr,
 			"imb_savetiff: creation of in-memory TIFF files is " 
@@ -710,7 +715,7 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
 		/* create image as a file */
 		image = TIFFOpen(name, "w");
 	}
-	if(image == NULL) {
+	if (image == NULL) {
 		fprintf(stderr,
 			"imb_savetiff: could not open TIFF for writing.\n");
 		return (0);
@@ -718,14 +723,14 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
 
 	/* allocate array for pixel data */
 	npixels = ibuf->x * ibuf->y;
-	if(bitspersample == 16)
+	if (bitspersample == 16)
 		pixels16 = (unsigned short*)_TIFFmalloc(npixels *
 			samplesperpixel * sizeof(unsigned short));
 	else
 		pixels = (unsigned char*)_TIFFmalloc(npixels *
 			samplesperpixel * sizeof(unsigned char));
 
-	if(pixels == NULL && pixels16 == NULL) {
+	if (pixels == NULL && pixels16 == NULL) {
 		fprintf(stderr,
 			"imb_savetiff: could not allocate pixels array.\n");
 		TIFFClose(image);
@@ -733,7 +738,7 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
 	}
 
 	/* setup pointers */
-	if(bitspersample == 16) {
+	if (bitspersample == 16) {
 		fromf = ibuf->rect_float;
 		to16   = pixels16;
 	}
@@ -746,31 +751,31 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
 	TIFFSetField(image, TIFFTAG_BITSPERSAMPLE, bitspersample);
 	TIFFSetField(image, TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);
 
-	if(samplesperpixel == 4) {
+	if (samplesperpixel == 4) {
 		/* RGBA images */
 		TIFFSetField(image, TIFFTAG_EXTRASAMPLES, 1,
 				extraSampleTypes);
 		TIFFSetField(image, TIFFTAG_PHOTOMETRIC, 
 				PHOTOMETRIC_RGB);
 	}
-	else if(samplesperpixel == 3) {
+	else if (samplesperpixel == 3) {
 		/* RGB images */
 		TIFFSetField(image, TIFFTAG_PHOTOMETRIC,
 				PHOTOMETRIC_RGB);
 	}
-	else if(samplesperpixel == 1) {
+	else if (samplesperpixel == 1) {
 		/* greyscale images, 1 channel */
 		TIFFSetField(image, TIFFTAG_PHOTOMETRIC,
 				PHOTOMETRIC_MINISBLACK);
 	}
 
 	/* copy pixel data.  While copying, we flip the image vertically. */
-	for(x = 0; x < ibuf->x; x++) {
-		for(y = 0; y < ibuf->y; y++) {
+	for (x = 0; x < ibuf->x; x++) {
+		for (y = 0; y < ibuf->y; y++) {
 			from_i = 4*(y*ibuf->x+x);
 			to_i   = samplesperpixel*((ibuf->y-y-1)*ibuf->x+x);
 
-			if(pixels16) {
+			if (pixels16) {
 				/* convert from float source */
 				float rgb[3];
 				
@@ -790,7 +795,7 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
 				}
 			}
 			else {
-				for(i = 0; i < samplesperpixel; i++, to_i++, from_i++)
+				for (i = 0; i < samplesperpixel; i++, to_i++, from_i++)
 					to[to_i] = from[from_i];
 			}
 		}
@@ -805,7 +810,7 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
 	TIFFSetField(image, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
 
 
-	if(ibuf->ppm[0] > 0.0 && ibuf->ppm[1] > 0.0) {
+	if (ibuf->ppm[0] > 0.0 && ibuf->ppm[1] > 0.0) {
 		xres= (float)(ibuf->ppm[0] * 0.0254);
 		yres= (float)(ibuf->ppm[1] * 0.0254);
 	}
@@ -816,20 +821,20 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
 	TIFFSetField(image, TIFFTAG_XRESOLUTION,     xres);
 	TIFFSetField(image, TIFFTAG_YRESOLUTION,     yres);
 	TIFFSetField(image, TIFFTAG_RESOLUTIONUNIT,  RESUNIT_INCH);
-	if(TIFFWriteEncodedStrip(image, 0,
+	if (TIFFWriteEncodedStrip(image, 0,
 			(bitspersample == 16)? (unsigned char*)pixels16: pixels,
 			ibuf->x*ibuf->y*samplesperpixel*bitspersample/8) == -1) {
 		fprintf(stderr,
 			"imb_savetiff: Could not write encoded TIFF.\n");
 		TIFFClose(image);
-		if(pixels) _TIFFfree(pixels);
-		if(pixels16) _TIFFfree(pixels16);
+		if (pixels) _TIFFfree(pixels);
+		if (pixels16) _TIFFfree(pixels16);
 		return (1);
 	}
 
 	/* close the TIFF file */
 	TIFFClose(image);
-	if(pixels) _TIFFfree(pixels);
-	if(pixels16) _TIFFfree(pixels16);
+	if (pixels) _TIFFfree(pixels);
+	if (pixels16) _TIFFfree(pixels16);
 	return (1);
 }
diff --git a/source/blender/imbuf/intern/util.c b/source/blender/imbuf/intern/util.c
index 47dad37..b5fdb89 100644
--- a/source/blender/imbuf/intern/util.c
+++ b/source/blender/imbuf/intern/util.c
@@ -152,17 +152,17 @@ static int IMB_ispic_name(const char *name)
 	struct stat st;
 	int fp, buf[10];
 
-	if(UTIL_DEBUG) printf("IMB_ispic_name: loading %s\n", name);
+	if (UTIL_DEBUG) printf("IMB_ispic_name: loading %s\n", name);
 	
-	if(stat(name,&st) == -1)
+	if (stat(name,&st) == -1)
 		return FALSE;
-	if(((st.st_mode) & S_IFMT) != S_IFREG)
+	if (((st.st_mode) & S_IFMT) != S_IFREG)
 		return FALSE;
 
-	if((fp = open(name,O_BINARY|O_RDONLY)) < 0)
+	if ((fp = BLI_open(name,O_BINARY|O_RDONLY, 0)) < 0)
 		return FALSE;
 
-	if(read(fp, buf, 32) != 32) {
+	if (read(fp, buf, 32) != 32) {
 		close(fp);
 		return FALSE;
 	}
@@ -170,11 +170,11 @@ static int IMB_ispic_name(const char *name)
 	close(fp);
 
 	/* XXX move this exception */
-	if((BIG_LONG(buf[0]) & 0xfffffff0) == 0xffd8ffe0)
+	if ((BIG_LONG(buf[0]) & 0xfffffff0) == 0xffd8ffe0)
 		return JPG;
 
-	for(type=IMB_FILE_TYPES; type->is_a; type++)
-		if(type->is_a((uchar*)buf))
+	for (type=IMB_FILE_TYPES; type->is_a; type++)
+		if (type->is_a((uchar*)buf))
 			return type->filetype;
 
 	return FALSE;
@@ -182,13 +182,13 @@ static int IMB_ispic_name(const char *name)
 
 int IMB_ispic(const char *filename)
 {
-	if(U.uiflag & USER_FILTERFILEEXTS) {
-		if(	(BLI_testextensie_array(filename, imb_ext_image)) ||
+	if (U.uiflag & USER_FILTERFILEEXTS) {
+		if (	(BLI_testextensie_array(filename, imb_ext_image)) ||
 			(G.have_quicktime && BLI_testextensie_array(filename, imb_ext_image_qt))
 		) {
 			return IMB_ispic_name(filename);
 		}
-		else  {
+		else {
 			return FALSE;
 		}
 	}
@@ -215,12 +215,10 @@ static int isqtime (const char *name)
 
 void silence_log_ffmpeg(int quiet)
 {
-	if (quiet)
-	{
+	if (quiet) {
 		av_log_set_level(AV_LOG_QUIET);
 	}
-	else
-	{
+	else {
 		av_log_set_level(AV_LOG_DEBUG);
 	}
 }
@@ -233,10 +231,10 @@ void do_init_ffmpeg(void)
 		ffmpeg_init = 1;
 		av_register_all();
 		avdevice_register_all();
-		
-		if ((G.f & G_DEBUG) == 0) {
+		if ((G.debug & G_DEBUG_FFMPEG) == 0) {
 			silence_log_ffmpeg(1);
-		} else {
+		}
+		else {
 			silence_log_ffmpeg(0);
 		}
 	}
@@ -252,7 +250,7 @@ static int isffmpeg (const char *filename)
 
 	do_init_ffmpeg();
 
-	if( BLI_testextensie(filename, ".swf") ||
+	if ( BLI_testextensie(filename, ".swf") ||
 		BLI_testextensie(filename, ".jpg") ||
 		BLI_testextensie(filename, ".png") ||
 		BLI_testextensie(filename, ".dds") ||
@@ -262,24 +260,24 @@ static int isffmpeg (const char *filename)
 		BLI_testextensie(filename, ".cin") ||
 		BLI_testextensie(filename, ".wav")) return 0;
 
-	if(av_open_input_file(&pFormatCtx, filename, NULL, 0, NULL)!=0) {
-		if(UTIL_DEBUG) fprintf(stderr, "isffmpeg: av_open_input_file failed\n");
+	if (av_open_input_file(&pFormatCtx, filename, NULL, 0, NULL)!=0) {
+		if (UTIL_DEBUG) fprintf(stderr, "isffmpeg: av_open_input_file failed\n");
 		return 0;
 	}
 
-	if(av_find_stream_info(pFormatCtx)<0) {
-		if(UTIL_DEBUG) fprintf(stderr, "isffmpeg: av_find_stream_info failed\n");
+	if (av_find_stream_info(pFormatCtx)<0) {
+		if (UTIL_DEBUG) fprintf(stderr, "isffmpeg: av_find_stream_info failed\n");
 		av_close_input_file(pFormatCtx);
 		return 0;
 	}
 
-	if(UTIL_DEBUG) av_dump_format(pFormatCtx, 0, filename, 0);
+	if (UTIL_DEBUG) av_dump_format(pFormatCtx, 0, filename, 0);
 
 
 		/* Find the first video stream */
 	videoStream=-1;
-	for(i=0; i<pFormatCtx->nb_streams; i++)
-		if(pFormatCtx->streams[i] &&
+	for (i=0; i<pFormatCtx->nb_streams; i++)
+		if (pFormatCtx->streams[i] &&
 		   pFormatCtx->streams[i]->codec && 
 		  (pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO))
 		{
@@ -287,7 +285,7 @@ static int isffmpeg (const char *filename)
 			break;
 		}
 
-	if(videoStream==-1) {
+	if (videoStream==-1) {
 		av_close_input_file(pFormatCtx);
 		return 0;
 	}
@@ -296,12 +294,12 @@ static int isffmpeg (const char *filename)
 
 		/* Find the decoder for the video stream */
 	pCodec=avcodec_find_decoder(pCodecCtx->codec_id);
-	if(pCodec==NULL) {
+	if (pCodec==NULL) {
 		av_close_input_file(pFormatCtx);
 		return 0;
 	}
 
-	if(avcodec_open(pCodecCtx, pCodec)<0) {
+	if (avcodec_open(pCodecCtx, pCodec)<0) {
 		av_close_input_file(pFormatCtx);
 		return 0;
 	}
@@ -331,7 +329,7 @@ int imb_get_anim_type(const char * name)
 	int type;
 	struct stat st;
 
-	if(UTIL_DEBUG) printf("in getanimtype: %s\n", name);
+	if (UTIL_DEBUG) printf("in getanimtype: %s\n", name);
 
 #ifndef _WIN32
 #	ifdef WITH_QUICKTIME
@@ -364,39 +362,47 @@ int imb_get_anim_type(const char * name)
 	if (isredcode(name)) return (ANIM_REDCODE);
 #endif
 	type = IMB_ispic(name);
-	if (type) return(ANIM_SEQUENCE);
-	return(0);
+	if (type) {
+		return ANIM_SEQUENCE;
+	}
+
+	return ANIM_NONE;
 }
  
 int IMB_isanim(const char *filename)
 {
 	int type;
 	
-	if(U.uiflag & USER_FILTERFILEEXTS) {
-		if (G.have_quicktime){
-			if(		BLI_testextensie(filename, ".avi")
-				||	BLI_testextensie(filename, ".flc")
-				||	BLI_testextensie(filename, ".dv")
-				||	BLI_testextensie(filename, ".r3d")
-				||	BLI_testextensie(filename, ".mov")
-				||	BLI_testextensie(filename, ".movie")
-				||	BLI_testextensie(filename, ".mv")) {
+	if (U.uiflag & USER_FILTERFILEEXTS) {
+		if (G.have_quicktime) {
+			if (BLI_testextensie(filename, ".avi")   ||
+			    BLI_testextensie(filename, ".flc")   ||
+			    BLI_testextensie(filename, ".dv")    ||
+			    BLI_testextensie(filename, ".r3d")   ||
+			    BLI_testextensie(filename, ".mov")   ||
+			    BLI_testextensie(filename, ".movie") ||
+			    BLI_testextensie(filename, ".mv"))
+			{
 				type = imb_get_anim_type(filename);
-			} else {
+			}
+			else {
 				return(FALSE);			
 			}
-		} else { // no quicktime
-			if(		BLI_testextensie(filename, ".avi")
-				||	BLI_testextensie(filename, ".dv")
-				||	BLI_testextensie(filename, ".r3d")
-				||	BLI_testextensie(filename, ".mv")) {
+		}
+		else { /* no quicktime */
+			if (BLI_testextensie(filename, ".avi") ||
+			    BLI_testextensie(filename, ".dv")  ||
+			    BLI_testextensie(filename, ".r3d") ||
+			    BLI_testextensie(filename, ".mv"))
+			{
 				type = imb_get_anim_type(filename);
 			}
-			else  {
+			else {
 				return(FALSE);
 			}
 		}
-	} else { // no FILTERFILEEXTS
+	}
+	else { /* no FILTERFILEEXTS */
 		type = imb_get_anim_type(filename);
 	}
 	
diff --git a/source/blender/imbuf/intern/writeimage.c b/source/blender/imbuf/intern/writeimage.c
index 8fbed6d..60fc7db 100644
--- a/source/blender/imbuf/intern/writeimage.c
+++ b/source/blender/imbuf/intern/writeimage.c
@@ -44,13 +44,13 @@ short IMB_saveiff(struct ImBuf *ibuf, const char *name, int flags)
 {
 	ImFileType *type;
 
-	if(ibuf == NULL) return (FALSE);
+	if (ibuf == NULL) return (FALSE);
 	ibuf->flags = flags;
 
-	for(type=IMB_FILE_TYPES; type->is_a; type++) {
-		if(type->save && type->ftype(type, ibuf)) {
-			if(!(type->flag & IM_FTYPE_FLOAT)) {
-				if(ibuf->rect==NULL && ibuf->rect_float)
+	for (type=IMB_FILE_TYPES; type->is_a; type++) {
+		if (type->save && type->ftype(type, ibuf)) {
+			if (!(type->flag & IM_FTYPE_FLOAT)) {
+				if (ibuf->rect==NULL && ibuf->rect_float)
 					IMB_rect_from_float(ibuf);
 			}
 			return type->save(ibuf, name, flags);
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index cb7b8d1..1737f3b 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -30,8 +30,8 @@
  *  \brief ID and Library types, which are fundamental for sdna.
  */
 
-#ifndef DNA_ID_H
-#define DNA_ID_H
+#ifndef __DNA_ID_H__
+#define __DNA_ID_H__
 
 #include "DNA_listBase.h"
 
@@ -54,15 +54,14 @@ typedef struct IDProperty {
 	char type, subtype;
 	short flag;
 	char name[64];	/* MAX_IDPROP_NAME */
-	int saved; /*saved is used to indicate if this struct has been saved yet.
-				seemed like a good idea as a pad var was needed anyway :)*/
+	int saved; /* saved is used to indicate if this struct has been saved yet.
+	            * seemed like a good idea as a pad var was needed anyway :)*/
 	IDPropertyData data;	/* note, alignment for 64 bits */
 	int len; /* array length, also (this is important!) string length + 1.
 	          * the idea is to be able to reuse array realloc functions on strings.*/
 	/* totallen is total length of allocated array/string, including a buffer.
 	 * Note that the buffering is mild; the code comes from python's list implementation.*/
-	int totallen; /*strings and arrays are both buffered, though the buffer isn't
-					saved.*/
+	int totallen; /*strings and arrays are both buffered, though the buffer isn't saved.*/
 } IDProperty;
 
 #define MAX_IDPROP_NAME	64
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index e582d07..43474d7 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -29,8 +29,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_ACTION_TYPES_H
-#define DNA_ACTION_TYPES_H
+#ifndef __DNA_ACTION_TYPES_H__
+#define __DNA_ACTION_TYPES_H__
 
 #include "DNA_listBase.h"
 #include "DNA_ID.h"
@@ -219,14 +219,15 @@ typedef struct bPoseChannel {
 	short 		pad;
 	
 	float		chan_mat[4][4];		/* matrix result of loc/quat/size , and where we put deform in, see next line */
-	float		pose_mat[4][4];		/* constraints accumulate here. in the end, pose_mat = bone->arm_mat * chan_mat */
+	float		pose_mat[4][4];		/* constraints accumulate here. in the end, pose_mat = bone->arm_mat * chan_mat
+	                                 * this matrix is object space */
 	float		constinv[4][4];		/* inverse result of constraints.
 	                                 * doesn't include effect of restposition, parent, and local transform*/
 	
 	float		pose_head[3];		/* actually pose_mat[3] */
 	float		pose_tail[3];		/* also used for drawing help lines... */
 	
-	float		limitmin[3], limitmax[3];	/* DOF constraint */
+	float		limitmin[3], limitmax[3];	/* DOF constraint, note! - these are stored in degrees, not radians */
 	float		stiffness[3];				/* DOF stiffness */
 	float		ikstretch;
 	float		ikrotweight;		/* weight of joint rotation constraint */
@@ -416,7 +417,7 @@ typedef enum eItasc_Solver {
 /* Groups -------------------------------------- */
 
 /* Action-Channel Group (agrp)
-
+ *
  * These are stored as a list per-Action, and are only used to 
  * group that Action's channels in an Animation Editor. 
  *
@@ -511,7 +512,7 @@ typedef enum eAction_Flags {
 /* Storage for Dopesheet/Grease-Pencil Editor data */
 typedef struct bDopeSheet {
 	ID 		*source;			/* currently ID_SCE (for Dopesheet), and ID_SC (for Grease Pencil) */
-	ListBase chanbase;			/* cache for channels (only initialised when pinned) */  // XXX not used!
+	ListBase chanbase;			/* cache for channels (only initialized when pinned) */  // XXX not used!
 	
 	struct Group *filter_grp;	/* object group for ADS_FILTER_ONLYOBGROUP filtering option */
 	char searchstr[64];			/* string to search for in displayed names of F-Curves for ADS_FILTER_BY_FCU_NAME filtering option */
diff --git a/source/blender/makesdna/DNA_actuator_types.h b/source/blender/makesdna/DNA_actuator_types.h
index 3be4653..f4e0645 100644
--- a/source/blender/makesdna/DNA_actuator_types.h
+++ b/source/blender/makesdna/DNA_actuator_types.h
@@ -29,8 +29,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_ACTUATOR_TYPES_H
-#define DNA_ACTUATOR_TYPES_H
+#ifndef __DNA_ACTUATOR_TYPES_H__
+#define __DNA_ACTUATOR_TYPES_H__
 
 struct Object;
 struct Mesh;
@@ -138,7 +138,7 @@ typedef struct bCameraActuator {
 	float damping;
 	short pad1, axis;
 	float pad2;
-} bCameraActuator ;
+} bCameraActuator;
 
 typedef struct bConstraintActuator {
 	short type, mode;
@@ -199,7 +199,7 @@ typedef struct bTwoDFilterActuator {
 	/* Tells what type of 2D Filter */
 	short type;
 	/* (flag == 0) means 2D filter is activate and
-	   (flag != 0) means 2D filter is inactive */
+	 * (flag != 0) means 2D filter is inactive */
 	short flag;
 	int   int_arg;
 	/* a float argument */
@@ -224,6 +224,8 @@ typedef struct bArmatureActuator {
 	char constraint[64];	/* MAX_NAME */
 	int type;		/* 0=run, 1=enable, 2=disable, 3=set target, 4=set weight */
 	float weight;
+	float influence;
+	float pad;
 	struct Object *target;
 	struct Object *subtarget;
 } bArmatureActuator;
@@ -511,8 +513,9 @@ typedef struct bActuator {
 #define ACT_ARM_DISABLE		2
 #define ACT_ARM_SETTARGET	3
 #define ACT_ARM_SETWEIGHT	4
-/* update this define if more type are addedd */
-#define ACT_ARM_MAXTYPE		4
+#define ACT_ARM_SETINFLUENCE	5
+/* update this define if more types are added */
+#define ACT_ARM_MAXTYPE		5
 
 /* stateactuator->type */
 #define ACT_STATE_SET		0
diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h
index 2233da8..fd4b86a 100644
--- a/source/blender/makesdna/DNA_anim_types.h
+++ b/source/blender/makesdna/DNA_anim_types.h
@@ -27,8 +27,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_ANIM_TYPES_H
-#define DNA_ANIM_TYPES_H
+#ifndef __DNA_ANIM_TYPES_H__
+#define __DNA_ANIM_TYPES_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -373,7 +373,7 @@ typedef struct ChannelDriver {
 	 * which relates the target 'variables' in some way to yield a single usable value
 	 */
 	char expression[256];	/* expression to compile for evaluation */
-	void *expr_comp; 		/* PyObject - compiled expression, dont save this */
+	void *expr_comp; 		/* PyObject - compiled expression, don't save this */
 	
 	float curval;		/* result of previous evaluation */
 	float influence;	/* influence of driver on result */ // XXX to be implemented... this is like the constraint influence setting
@@ -408,7 +408,7 @@ typedef enum eDriver_Flags {
 	//DRIVER_FLAG_LAYERING	= (1<<2),
 		/* use when the expression needs to be recompiled */
 	DRIVER_FLAG_RECOMPILE	= (1<<3),
-		/* the names are cached so they dont need have python unicode versions created each time */
+		/* the names are cached so they don't need have python unicode versions created each time */
 	DRIVER_FLAG_RENAMEVAR	= (1<<4),
 		/* intermediate values of driver should be shown in the UI for debugging purposes */
 	DRIVER_FLAG_SHOWDEBUG	= (1<<5)
@@ -528,7 +528,7 @@ typedef struct AnimMapPair {
 
 /* Retargetting Information for Actions 
  *
- * This should only be used if it is strictly necessary (i.e. user will need to explictly 
+ * This should only be used if it is strictly necessary (i.e. user will need to explicitly 
  * add this when they find that some channels do not match, or motion is not going to right 
  * places). When executing an action, this will be checked to see if it provides any useful
  * remaps for the given paths.
@@ -559,7 +559,7 @@ typedef struct NlaStrip {
 	
 	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 correspondance of action with context) */
+	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 */
@@ -661,7 +661,7 @@ typedef enum eNlaStrip_Type {
 
 /* NLA Track (nlt)
  *
- * A track groups a bunch of 'strips', which should form a continous set of 
+ * A track groups a bunch of 'strips', which should form a continuous set of 
  * motion, on top of which other such groups can be layered. This should allow
  * for animators to work in a non-destructive manner, layering tweaks, etc. over
  * 'rough' blocks of their work.
@@ -752,7 +752,7 @@ typedef enum eKSP_Grouping {
  * be keyframed together, providing a convenient way for animators
  * to insert keyframes without resorting to Auto-Keyframing.
  *
- * A few 'generic' (non-absolute and dependant on templates) KeyingSets 
+ * A few 'generic' (non-absolute and dependent on templates) KeyingSets 
  * are defined 'built-in' to facilitate easy animating for the casual
  * animator without the need to add extra steps to the rigging process.
  */
@@ -761,7 +761,9 @@ typedef struct KeyingSet {
 	
 	ListBase paths;			/* (KS_Path) paths to keyframe to */
 	
+	char idname[64];		/* unique name (for search, etc.) */
 	char name[64];			/* user-viewable name for KeyingSet (for menus, etc.) */
+	char description[240];	/* (RNA_DYN_DESCR_MAX) short help text. */
 	char typeinfo[64];		/* name of the typeinfo data used for the relative paths */
 	
 	short flag;				/* settings for KeyingSet */
@@ -909,4 +911,4 @@ typedef struct IdAdtTemplate {
 };
 #endif
 
-#endif /* DNA_ANIM_TYPES_H */
+#endif /* __DNA_ANIM_TYPES_H__ */
diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h
index 33f9656..ea564e8 100644
--- a/source/blender/makesdna/DNA_armature_types.h
+++ b/source/blender/makesdna/DNA_armature_types.h
@@ -27,8 +27,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_ARMATURE_TYPES_H
-#define DNA_ARMATURE_TYPES_H
+#ifndef __DNA_ARMATURE_TYPES_H__
+#define __DNA_ARMATURE_TYPES_H__
 
 #include "DNA_listBase.h"
 #include "DNA_ID.h"
@@ -36,13 +36,13 @@
 struct AnimData;
 
 /* this system works on different transformation space levels;
-
-1) Bone Space;		with each Bone having own (0,0,0) origin
-2) Armature Space;  the rest position, in Object space, Bones Spaces are applied hierarchical
-3) Pose Space;		the animation position, in Object space
-4) World Space;		Object matrix applied to Pose or Armature space
-
-*/
+ *
+ * 1) Bone Space;      with each Bone having own (0,0,0) origin
+ * 2) Armature Space;  the rest position, in Object space, Bones Spaces are applied hierarchical
+ * 3) Pose Space;      the animation position, in Object space
+ * 4) World Space;     Object matrix applied to Pose or Armature space
+ *
+ */
 
 typedef struct Bone {
 	struct Bone		*next, *prev;	/*	Next/prev elements within this list	*/
@@ -113,7 +113,7 @@ typedef struct bArmature {
 } bArmature;
 
 /* armature->flag */
-/* dont use bit 7, was saved in files to disable stuff */
+/* 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 */
@@ -182,7 +182,7 @@ typedef enum eBone_Flag {
 	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 dependancies */
+	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 */
diff --git a/source/blender/makesdna/DNA_boid_types.h b/source/blender/makesdna/DNA_boid_types.h
index 53ff517..09221c4 100644
--- a/source/blender/makesdna/DNA_boid_types.h
+++ b/source/blender/makesdna/DNA_boid_types.h
@@ -30,8 +30,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_BOID_TYPES_H
-#define DNA_BOID_TYPES_H
+#ifndef __DNA_BOID_TYPES_H__
+#define __DNA_BOID_TYPES_H__
 
 #include "DNA_listBase.h"
 
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 690c3c9..0d06b55 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -29,8 +29,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_BRUSH_TYPES_H
-#define DNA_BRUSH_TYPES_H
+#ifndef __DNA_BRUSH_TYPES_H__
+#define __DNA_BRUSH_TYPES_H__
 
 
 #include "DNA_ID.h"
@@ -102,58 +102,65 @@ typedef struct Brush {
 } Brush;
 
 /* Brush.flag */
-#define BRUSH_AIRBRUSH		(1<<0)
-#define BRUSH_TORUS		(1<<1)
-#define BRUSH_ALPHA_PRESSURE	(1<<2)
-#define BRUSH_SIZE_PRESSURE	(1<<3)
-#define BRUSH_JITTER_PRESSURE	(1<<4) /* was BRUSH_RAD_PRESSURE */
-#define BRUSH_SPACING_PRESSURE	(1<<5)
-#define BRUSH_FIXED_TEX		(1<<6)
-#define BRUSH_RAKE		(1<<7)
-#define BRUSH_ANCHORED		(1<<8)
-#define BRUSH_DIR_IN		(1<<9)
-#define BRUSH_SPACE		(1<<10)
-#define BRUSH_SMOOTH_STROKE	(1<<11)
-#define BRUSH_PERSISTENT	(1<<12)
-#define BRUSH_ACCUMULATE	(1<<13)
-#define BRUSH_LOCK_ALPHA	(1<<14)
-#define BRUSH_ORIGINAL_NORMAL	(1<<15)
-#define BRUSH_OFFSET_PRESSURE	(1<<16)
-#define BRUSH_SPACE_ATTEN	(1<<18)
-#define BRUSH_ADAPTIVE_SPACE	(1<<19)
-#define BRUSH_LOCK_SIZE		(1<<20)
-#define BRUSH_TEXTURE_OVERLAY	(1<<21)
-#define BRUSH_EDGE_TO_EDGE	(1<<22)
-#define BRUSH_RESTORE_MESH	(1<<23)
-#define BRUSH_INVERSE_SMOOTH_PRESSURE (1<<24)
-#define BRUSH_RANDOM_ROTATION (1<<25)
-#define BRUSH_PLANE_TRIM (1<<26)
-#define BRUSH_FRONTFACE (1<<27)
-#define BRUSH_CUSTOM_ICON (1<<28)
-
-/* temporary flag which sets up autmatically for correct
- * brush drawing when inverted modal operator is running */
-#define BRUSH_INVERTED (1<<29)
+typedef enum BrushFlags {
+	BRUSH_AIRBRUSH = (1<<0),
+	BRUSH_TORUS = (1<<1),
+	BRUSH_ALPHA_PRESSURE = (1<<2),
+	BRUSH_SIZE_PRESSURE = (1<<3),
+	BRUSH_JITTER_PRESSURE = (1<<4),
+	BRUSH_SPACING_PRESSURE = (1<<5),
+	BRUSH_FIXED_TEX = (1<<6),
+	BRUSH_RAKE = (1<<7),
+	BRUSH_ANCHORED = (1<<8),
+	BRUSH_DIR_IN = (1<<9),
+	BRUSH_SPACE = (1<<10),
+	BRUSH_SMOOTH_STROKE = (1<<11),
+	BRUSH_PERSISTENT = (1<<12),
+	BRUSH_ACCUMULATE = (1<<13),
+	BRUSH_LOCK_ALPHA = (1<<14),
+	BRUSH_ORIGINAL_NORMAL = (1<<15),
+	BRUSH_OFFSET_PRESSURE = (1<<16),
+	BRUSH_SPACE_ATTEN = (1<<18),
+	BRUSH_ADAPTIVE_SPACE = (1<<19),
+	BRUSH_LOCK_SIZE = (1<<20),
+	BRUSH_TEXTURE_OVERLAY = (1<<21),
+	BRUSH_EDGE_TO_EDGE = (1<<22),
+	BRUSH_RESTORE_MESH = (1<<23),
+	BRUSH_INVERSE_SMOOTH_PRESSURE = (1<<24),
+	BRUSH_RANDOM_ROTATION = (1<<25),
+	BRUSH_PLANE_TRIM = (1<<26),
+	BRUSH_FRONTFACE = (1<<27),
+	BRUSH_CUSTOM_ICON = (1<<28),
+
+	/* temporary flag which sets up automatically for correct brush
+	 * drawing when inverted modal operator is running */
+	BRUSH_INVERTED = (1<<29)
+} BrushFlags;
 
 /* Brush.sculpt_tool */
-#define SCULPT_TOOL_DRAW        1
-#define SCULPT_TOOL_SMOOTH      2
-#define SCULPT_TOOL_PINCH       3
-#define SCULPT_TOOL_INFLATE     4
-#define SCULPT_TOOL_GRAB        5
-#define SCULPT_TOOL_LAYER       6
-#define SCULPT_TOOL_FLATTEN     7
-#define SCULPT_TOOL_CLAY        8
-#define SCULPT_TOOL_FILL        9
-#define SCULPT_TOOL_SCRAPE     10
-#define SCULPT_TOOL_NUDGE      11
-#define SCULPT_TOOL_THUMB      12
-#define SCULPT_TOOL_SNAKE_HOOK 13
-#define SCULPT_TOOL_ROTATE     14
-//#define SCULPT_TOOL_WAX        15 // XXX: reuse this slot later
-#define SCULPT_TOOL_CREASE     16
-#define SCULPT_TOOL_BLOB       17
-#define SCULPT_TOOL_CLAY_TUBES 18
+typedef enum BrushSculptTool {
+	SCULPT_TOOL_DRAW = 1,
+	SCULPT_TOOL_SMOOTH = 2,
+	SCULPT_TOOL_PINCH = 3,
+	SCULPT_TOOL_INFLATE = 4,
+	SCULPT_TOOL_GRAB = 5,
+	SCULPT_TOOL_LAYER = 6,
+	SCULPT_TOOL_FLATTEN = 7,
+	SCULPT_TOOL_CLAY = 8,
+	SCULPT_TOOL_FILL = 9,
+	SCULPT_TOOL_SCRAPE = 10,
+	SCULPT_TOOL_NUDGE = 11,
+	SCULPT_TOOL_THUMB = 12,
+	SCULPT_TOOL_SNAKE_HOOK = 13,
+	SCULPT_TOOL_ROTATE = 14,
+	
+	/* slot 15 is free for use */
+	/* SCULPT_TOOL_ = 15, */
+	
+	SCULPT_TOOL_CREASE = 16,
+	SCULPT_TOOL_BLOB = 17,
+	SCULPT_TOOL_CLAY_STRIPS = 18
+} BrushSculptTool;
 
 /* ImagePaintSettings.tool */
 #define PAINT_TOOL_DRAW		0
diff --git a/source/blender/makesdna/DNA_camera_types.h b/source/blender/makesdna/DNA_camera_types.h
index a46be73..112247f 100644
--- a/source/blender/makesdna/DNA_camera_types.h
+++ b/source/blender/makesdna/DNA_camera_types.h
@@ -29,8 +29,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_CAMERA_TYPES_H
-#define DNA_CAMERA_TYPES_H
+#ifndef __DNA_CAMERA_TYPES_H__
+#define __DNA_CAMERA_TYPES_H__
 
 #include "DNA_defs.h"
 
@@ -58,8 +58,8 @@ typedef struct Camera {
 	float shiftx, shifty;
 	
 	/* yafray: dof params */
-	/* qdn: yafray var 'YF_dofdist' now enabled for defocus composit node as well.
-			The name was not changed so that no other files need to be modified */
+	/* qdn: yafray var 'YF_dofdist' now enabled for defocus composite node as well.
+	 * The name was not changed so that no other files need to be modified */
 	float YF_dofdist;
 
 	struct Ipo *ipo  DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */
diff --git a/source/blender/makesdna/DNA_cloth_types.h b/source/blender/makesdna/DNA_cloth_types.h
index 1079f1d..fd8b08e 100644
--- a/source/blender/makesdna/DNA_cloth_types.h
+++ b/source/blender/makesdna/DNA_cloth_types.h
@@ -29,20 +29,20 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_CLOTH_TYPES_H
-#define DNA_CLOTH_TYPES_H
+#ifndef __DNA_CLOTH_TYPES_H__
+#define __DNA_CLOTH_TYPES_H__
 
 /**
-* This struct contains all the global data required to run a simulation.
-* At the time of this writing, this structure contains data appropriate
-* to run a simulation as described in Deformation Constraints in a
-* Mass-Spring Model to Describe Rigid Cloth Behavior by Xavier Provot.
-*
-* I've tried to keep similar, if not exact names for the variables as
-* are presented in the paper.  Where I've changed the concept slightly,
-* as in stepsPerFrame comapred to the time step in the paper, I've used
-* variables with different names to minimize confusion.
-**/
+ * This struct contains all the global data required to run a simulation.
+ * At the time of this writing, this structure contains data appropriate
+ * to run a simulation as described in Deformation Constraints in a
+ * Mass-Spring Model to Describe Rigid Cloth Behavior by Xavier Provot.
+ *
+ * I've tried to keep similar, if not exact names for the variables as
+ * are presented in the paper.  Where I've changed the concept slightly,
+ * as in stepsPerFrame comapred to the time step in the paper, I've used
+ * variables with different names to minimize confusion.
+ */
 
 typedef struct ClothSimSettings
 {
diff --git a/source/blender/makesdna/DNA_color_types.h b/source/blender/makesdna/DNA_color_types.h
index f5762f8..676389f 100644
--- a/source/blender/makesdna/DNA_color_types.h
+++ b/source/blender/makesdna/DNA_color_types.h
@@ -29,8 +29,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_COLOR_TYPES_H
-#define DNA_COLOR_TYPES_H
+#ifndef __DNA_COLOR_TYPES_H__
+#define __DNA_COLOR_TYPES_H__
 
 #include "DNA_vec_types.h"
 
diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h
index fdc493d..7a2d292 100644
--- a/source/blender/makesdna/DNA_constraint_types.h
+++ b/source/blender/makesdna/DNA_constraint_types.h
@@ -30,8 +30,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_CONSTRAINT_TYPES_H
-#define DNA_CONSTRAINT_TYPES_H
+#ifndef __DNA_CONSTRAINT_TYPES_H__
+#define __DNA_CONSTRAINT_TYPES_H__
 
 #include "DNA_defs.h"
 #include "DNA_ID.h"
diff --git a/source/blender/makesdna/DNA_controller_types.h b/source/blender/makesdna/DNA_controller_types.h
index 51ab29d..bdfedb5 100644
--- a/source/blender/makesdna/DNA_controller_types.h
+++ b/source/blender/makesdna/DNA_controller_types.h
@@ -29,8 +29,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_CONTROLLER_TYPES_H
-#define DNA_CONTROLLER_TYPES_H
+#ifndef __DNA_CONTROLLER_TYPES_H__
+#define __DNA_CONTROLLER_TYPES_H__
 
 struct bActuator;
 struct Text;
diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h
index 455738c..c9d8047 100644
--- a/source/blender/makesdna/DNA_curve_types.h
+++ b/source/blender/makesdna/DNA_curve_types.h
@@ -29,8 +29,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_CURVE_TYPES_H
-#define DNA_CURVE_TYPES_H
+#ifndef __DNA_CURVE_TYPES_H__
+#define __DNA_CURVE_TYPES_H__
 
 #include "DNA_defs.h"
 #include "DNA_listBase.h"
@@ -92,16 +92,16 @@ typedef struct BevPoint {
  */
 /* note: alfa location in struct is abused by Key system */
 /* vec in BezTriple looks like this:
-	vec[0][0]=x location of handle 1
-	vec[0][1]=y location of handle 1
-	vec[0][2]=z location of handle 1 (not used for FCurve Points(2d))
-	vec[1][0]=x location of control point
-	vec[1][1]=y location of control point
-	vec[1][2]=z location of control point
-	vec[2][0]=x location of handle 2
-	vec[2][1]=y location of handle 2
-	vec[2][2]=z location of handle 2 (not used for FCurve Points(2d))
-*/
+ * - vec[0][0]=x location of handle 1
+ * - vec[0][1]=y location of handle 1
+ * - vec[0][2]=z location of handle 1 (not used for FCurve Points(2d))
+ * - vec[1][0]=x location of control point
+ * - vec[1][1]=y location of control point
+ * - vec[1][2]=z location of control point
+ * - vec[2][0]=x location of handle 2
+ * - vec[2][1]=y location of handle 2
+ * - vec[2][2]=z location of handle 2 (not used for FCurve Points(2d))
+ */
 typedef struct BezTriple {
 	float vec[3][3];
 	float alfa, weight, radius;	/* alfa: tilt in 3D View, weight: used for softbody goal weight, radius: for bevel tapering */
@@ -125,7 +125,7 @@ typedef struct Nurb {
 	short mat_nr;		/* index into material list */
 	short hide, flag;
 	short pntsu, pntsv;		/* number of points in the U or V directions */
-	short resolu, resolv;	/* tesselation resolution in the U or V directions */
+	short resolu, resolv;	/* tessellation resolution in the U or V directions */
 	short orderu, orderv;
 	short flagu, flagv;
 	
diff --git a/source/blender/makesdna/DNA_customdata_types.h b/source/blender/makesdna/DNA_customdata_types.h
index a4bb571..9898f97 100644
--- a/source/blender/makesdna/DNA_customdata_types.h
+++ b/source/blender/makesdna/DNA_customdata_types.h
@@ -29,8 +29,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_CUSTOMDATA_TYPES_H
-#define DNA_CUSTOMDATA_TYPES_H
+#ifndef __DNA_CUSTOMDATA_TYPES_H__
+#define __DNA_CUSTOMDATA_TYPES_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -47,7 +47,7 @@ typedef struct CustomDataLayer {
 	int active_rnd; /* number of the layer to render*/
 	int active_clone; /* number of the layer to render*/
 	int active_mask; /* number of the layer to render*/
-	char pad[4];
+	int uid;        /* shape keyblock unique id reference*/
 	char name[64];  /* layer name, MAX_CUSTOMDATA_LAYER_AAME */
 	void *data;     /* layer data */
 } CustomDataLayer;
@@ -59,15 +59,16 @@ typedef struct CustomDataExternal {
 } CustomDataExternal;
 
 /** structure which stores custom element data associated with mesh elements
- * (vertices, edges or faces). The custom data is organised into a series of
+ * (vertices, edges or faces). The custom data is organized into a series of
  * layers, each with a data type (e.g. MTFace, MDeformVert, etc.). */
 typedef struct CustomData {
 	CustomDataLayer *layers;      /* CustomDataLayers, ordered by type */
-	int typemap[32];              /* runtime only! - maps types to indices of first layer of that type,
+	int typemap[34];              /* runtime only! - maps types to indices of first layer of that type,
 	                               * MUST be >= CD_NUMTYPES, but we cant use a define here.
 	                               * Correct size is ensured in CustomData_update_typemap assert() */
+
 	int totlayer, maxlayer;       /* number of layers, size of layers array */
-	int totsize, pad;             /* in editmode, total size of all data layers */
+	int totsize, pad2;             /* in editmode, total size of all data layers */
 	void *pool;                   /* Bmesh: Memory pool for allocation of blocks */
 	CustomDataExternal *external; /* external file storing customdata layers */
 } CustomData;
@@ -93,14 +94,12 @@ typedef struct CustomData {
 #define CD_MLOOPCOL		17
 #define CD_TANGENT		18
 #define CD_MDISPS		19
-#define CD_WEIGHT_MCOL	20 /* for displaying weightpaint colors */
+#define CD_PREVIEW_MCOL	20 /* for displaying weightpaint colors */
 #define CD_ID_MCOL		21
 #define CD_TEXTURE_MCOL	22
 #define CD_CLOTH_ORCO	23
 #define CD_RECAST		24
 
-#ifdef USE_BMESH_FORWARD_COMPAT
-
 /* BMESH ONLY START */
 #define CD_MPOLY		25
 #define CD_MLOOP		26
@@ -108,16 +107,12 @@ typedef struct CustomData {
 #define CD_SHAPEKEY		28
 #define CD_BWEIGHT		29
 #define CD_CREASE		30
-#define CD_WEIGHT_MLOOPCOL	31
+#define CD_ORIGSPACE_MLOOP	31
+#define CD_PREVIEW_MLOOPCOL	32
+#define CD_BM_ELEM_PYPTR	33
 /* BMESH ONLY END */
 
-#define CD_NUMTYPES		32
-
-#else
-
-#define CD_NUMTYPES		25
-
-#endif
+#define CD_NUMTYPES		34
 
 /* Bits for CustomDataMask */
 #define CD_MASK_MVERT		(1 << CD_MVERT)
@@ -140,12 +135,10 @@ typedef struct CustomData {
 #define CD_MASK_MLOOPCOL	(1 << CD_MLOOPCOL)
 #define CD_MASK_TANGENT		(1 << CD_TANGENT)
 #define CD_MASK_MDISPS		(1 << CD_MDISPS)
-#define CD_MASK_WEIGHT_MCOL	(1 << CD_WEIGHT_MCOL)
+#define CD_MASK_PREVIEW_MCOL	(1 << CD_PREVIEW_MCOL)
 #define CD_MASK_CLOTH_ORCO	(1 << CD_CLOTH_ORCO)
 #define CD_MASK_RECAST		(1 << CD_RECAST)
 
-#ifdef USE_BMESH_FORWARD_COMPAT
-
 /* BMESH ONLY START */
 #define CD_MASK_MPOLY		(1 << CD_MPOLY)
 #define CD_MASK_MLOOP		(1 << CD_MLOOP)
@@ -153,11 +146,11 @@ typedef struct CustomData {
 #define CD_MASK_SHAPEKEY	(1 << CD_SHAPEKEY)
 #define CD_MASK_BWEIGHT		(1 << CD_BWEIGHT)
 #define CD_MASK_CREASE		(1 << CD_CREASE)
-#define CD_MASK_WEIGHT_MLOOPCOL (1 << CD_WEIGHT_MLOOPCOL)
+#define CD_MASK_ORIGSPACE_MLOOP	(1 << CD_ORIGSPACE_MLOOP)
+#define CD_MASK_PREVIEW_MLOOPCOL (1LL << CD_PREVIEW_MLOOPCOL)
+#define CD_MASK_BM_ELEM_PYPTR (1LL << CD_BM_ELEM_PYPTR)
 /* BMESH ONLY END */
 
-#endif
-
 /* CustomData.flag */
 
 /* indicates layer should not be copied by CustomData_from_template or
diff --git a/source/blender/makesdna/DNA_defs.h b/source/blender/makesdna/DNA_defs.h
index 46d7fc2..762e027 100644
--- a/source/blender/makesdna/DNA_defs.h
+++ b/source/blender/makesdna/DNA_defs.h
@@ -24,8 +24,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_DEFS_H
-#define DNA_DEFS_H
+#ifndef __DNA_DEFS_H__
+#define __DNA_DEFS_H__
 
 /* makesdna ignores */
 #ifdef DNA_DEPRECATED_ALLOW
@@ -45,9 +45,10 @@
 /* hrmf, we need a better include then this */
 #include "../blenloader/BLO_sys_types.h" /* needed for int64_t only! */
 
-#define USE_BMESH_FORWARD_COMPAT
+/* Must not be defined for BMesh, as this guards code for pre-BMesh code to load BMesh .blend files */
+/* #define USE_BMESH_FORWARD_COMPAT */
 
 /* non-id name variables should use this length */
 #define MAX_NAME 64
 
-#endif /* DNA_DEFS_H */
+#endif /* __DNA_DEFS_H__ */
diff --git a/source/blender/makesdna/DNA_documentation.h b/source/blender/makesdna/DNA_documentation.h
index c1d6ee4..0dd7f37 100644
--- a/source/blender/makesdna/DNA_documentation.h
+++ b/source/blender/makesdna/DNA_documentation.h
@@ -60,14 +60,14 @@
  *
  * DNA has no external dependencies (except for a few system
  * includes).
-
+ *
  * \section dnanote NOTE
-
+ *
  * PLEASE READ INSTRUCTIONS ABOUT ADDING VARIABLES IN 'DNA' STRUCTS IN
  *
  * intern/dna_genfile.c
  * (ton)
-
+ *
  */
 
 
diff --git a/source/blender/makesdna/DNA_dynamicpaint_types.h b/source/blender/makesdna/DNA_dynamicpaint_types.h
index 2345b8d..ca1b1bf 100644
--- a/source/blender/makesdna/DNA_dynamicpaint_types.h
+++ b/source/blender/makesdna/DNA_dynamicpaint_types.h
@@ -25,8 +25,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_DYNAMICPAINT_TYPES_H
-#define DNA_DYNAMICPAINT_TYPES_H
+#ifndef __DNA_DYNAMICPAINT_TYPES_H__
+#define __DNA_DYNAMICPAINT_TYPES_H__
 
 #include "DNA_listBase.h"
 struct CurveMapping;
@@ -159,7 +159,7 @@ typedef struct DynamicPaintCanvasSettings {
 #define MOD_DPAINT_PART_RAD (1<<0) /* use particle radius */
 #define MOD_DPAINT_USE_MATERIAL (1<<1) /* use object material */
 #define MOD_DPAINT_ABS_ALPHA (1<<2) /* don't increase alpha unless
-									paint alpha is higher than existing */
+                                     * paint alpha is higher than existing */
 #define MOD_DPAINT_ERASE (1<<3) /* removes paint */
 
 #define MOD_DPAINT_RAMP_ALPHA (1<<4) /* only read falloff ramp alpha */
diff --git a/source/blender/makesdna/DNA_effect_types.h b/source/blender/makesdna/DNA_effect_types.h
index ddff22a..7ca3bbe 100644
--- a/source/blender/makesdna/DNA_effect_types.h
+++ b/source/blender/makesdna/DNA_effect_types.h
@@ -29,8 +29,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_EFFECT_TYPES_H
-#define DNA_EFFECT_TYPES_H
+#ifndef __DNA_EFFECT_TYPES_H__
+#define __DNA_EFFECT_TYPES_H__
 
 /* don't forget, new effects also in writefile.c for dna!!! */
 
diff --git a/source/blender/makesdna/DNA_fileglobal_types.h b/source/blender/makesdna/DNA_fileglobal_types.h
index ed9f3ce..7e81041 100644
--- a/source/blender/makesdna/DNA_fileglobal_types.h
+++ b/source/blender/makesdna/DNA_fileglobal_types.h
@@ -29,14 +29,14 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_FILEGLOBAL_TYPES_H
-#define DNA_FILEGLOBAL_TYPES_H
+#ifndef __DNA_FILEGLOBAL_TYPES_H__
+#define __DNA_FILEGLOBAL_TYPES_H__
 
 struct bScreen;
 struct Scene;
 
 /**
- * FileGlobal stores a part of the current user-unterface settings at
+ * FileGlobal stores a part of the current user-interface settings at
  * the moment of saving, and the file-specific settings.
  */
 typedef struct FileGlobal {
diff --git a/source/blender/makesdna/DNA_genfile.h b/source/blender/makesdna/DNA_genfile.h
index 2264e82..20f7bb4 100644
--- a/source/blender/makesdna/DNA_genfile.h
+++ b/source/blender/makesdna/DNA_genfile.h
@@ -30,8 +30,8 @@
  *  \brief blenloader genfile private function prototypes
  */
 
-#ifndef DNA_GENFILE_H
-#define DNA_GENFILE_H
+#ifndef __DNA_GENFILE_H__
+#define __DNA_GENFILE_H__
 
 struct SDNA;
 
@@ -70,4 +70,4 @@ int DNA_elem_offset(struct SDNA *sdna, const char *stype, const char *vartype, c
 
 int DNA_elem_type_size(const eSDNA_Type elem_nr);
 
-#endif
+#endif /* __DNA_GENFILE_H__ */
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 71f0dbb..3de5372 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -27,8 +27,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_GPENCIL_TYPES_H
-#define DNA_GPENCIL_TYPES_H
+#ifndef __DNA_GPENCIL_TYPES_H__
+#define __DNA_GPENCIL_TYPES_H__
 
 #include "DNA_listBase.h"
 #include "DNA_ID.h"
@@ -132,7 +132,7 @@ typedef struct bGPdata {
 	int flag;				/* settings for this datablock */
 	
 	/* not-saved stroke buffer data (only used during paint-session) 
-	 * 	- buffer must be initialised before use, but freed after 
+	 * 	- buffer must be initialized before use, but freed after 
 	 *	  whole paint operation is over
 	 */
 	short sbuffer_size;			/* number of elements currently in cache */
@@ -160,4 +160,4 @@ typedef struct bGPdata {
 
 #define GP_DATA_DEPTH_STROKE_ENDPOINTS (1<<7)
 
-#endif /*  DNA_GPENCIL_TYPES_H */
+#endif /*  __DNA_GPENCIL_TYPES_H__ */
diff --git a/source/blender/makesdna/DNA_group_types.h b/source/blender/makesdna/DNA_group_types.h
index ab42086..8aa6de4 100644
--- a/source/blender/makesdna/DNA_group_types.h
+++ b/source/blender/makesdna/DNA_group_types.h
@@ -32,8 +32,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_GROUP_TYPES_H
-#define DNA_GROUP_TYPES_H
+#ifndef __DNA_GROUP_TYPES_H__
+#define __DNA_GROUP_TYPES_H__
 
 #include "DNA_listBase.h"
 #include "DNA_ID.h"
diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h
index 8f6cc5b..de2c991 100644
--- a/source/blender/makesdna/DNA_image_types.h
+++ b/source/blender/makesdna/DNA_image_types.h
@@ -29,8 +29,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_IMAGE_TYPES_H
-#define DNA_IMAGE_TYPES_H
+#ifndef __DNA_IMAGE_TYPES_H__
+#define __DNA_IMAGE_TYPES_H__
 
 #include "DNA_ID.h"
 
diff --git a/source/blender/makesdna/DNA_ipo_types.h b/source/blender/makesdna/DNA_ipo_types.h
index 201ea89..e3ab6b4 100644
--- a/source/blender/makesdna/DNA_ipo_types.h
+++ b/source/blender/makesdna/DNA_ipo_types.h
@@ -33,8 +33,8 @@
  *   etc. are only still maintained to provide backwards compatibility for old files.
  */
  
-#ifndef DNA_IPO_TYPES_H
-#define DNA_IPO_TYPES_H
+#ifndef __DNA_IPO_TYPES_H__
+#define __DNA_IPO_TYPES_H__
 
 #include "DNA_listBase.h"
 #include "DNA_curve_types.h"
diff --git a/source/blender/makesdna/DNA_key_types.h b/source/blender/makesdna/DNA_key_types.h
index b64389a..8494e66 100644
--- a/source/blender/makesdna/DNA_key_types.h
+++ b/source/blender/makesdna/DNA_key_types.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef DNA_KEY_TYPES_H
-#define DNA_KEY_TYPES_H
+#ifndef __DNA_KEY_TYPES_H__
+#define __DNA_KEY_TYPES_H__
 
 /** \file DNA_key_types.h
  *  \ingroup DNA
@@ -40,57 +40,95 @@ struct Ipo;
 
 typedef struct KeyBlock {
 	struct KeyBlock *next, *prev;
+
+	float pos;         /* point in time   (Key->type == KEY_NORMAL) only,
+	                    * for historic reasons this is relative to (Key->ctime / 100),
+	                    * so this value increments by 0.1f per frame. */
+	float curval;      /* influence (typically [0 - 1] but can be more), (Key->type == KEY_RELATIVE) only.*/
+
+	short type;        /* interpolation type (Key->type == KEY_NORMAL) only. */
+	short pad1;
+
+	short relative;    /* relative == 0 means first key is reference, otherwise the index of Key->blocks */
+	short flag;
+
+	int totelem;       /* total number if items in the keyblock (compare with mesh/curve verts to check we match) */
+	int uid;           /* for meshes only, match the unique number with the customdata layer */
 	
-	float pos;
-	float curval;
-	short type, adrcode, relative, flag;	/* relative == 0 means first key is reference */
-	int totelem, pad2;
-	
-	void *data;
-	float *weights;
-	char  name[64];	/* MAX_NAME */
-	char vgroup[64];	/* MAX_VGROUP_NAME */
+	void  *data;       /* array of shape key values, size is (Key->elemsize * KeyBlock->totelem) */
+	float *weights;    /* store an aligned array of weights from 'vgroup' */
+	char   name[64];   /* MAX_NAME (unique name, user assigned) */
+	char   vgroup[64]; /* MAX_VGROUP_NAME (optional vertex group), array gets allocated into 'weights' when set */
 
+	/* ranges, for RNA and UI only to clamp 'curval' */
 	float slidermin;
 	float slidermax;
+
 } KeyBlock;
 
 
 typedef struct Key {
 	ID id;
 	struct AnimData *adt;	/* animation data (must be immediately after id for utilities to use it) */ 
-	
+
+	/* commonly called 'Basis', (Key->type == KEY_RELATIVE) only.
+	 * Looks like this is  _always_ 'key->block.first',
+	 * perhaps later on it could be defined as some other KeyBlock - campbell */
 	KeyBlock *refkey;
-	char elemstr[64];	/* MAX_NAME */
-	int elemsize;
-	float curval  DNA_DEPRECATED;
+
+	/* this is not a regular string, although it is \0 terminated
+	 * this is an array of (element_array_size, element_type) pairs
+	 * (each one char) used for calculating shape key-blocks */
+	char elemstr[32];
+	int elemsize;  /* size of each element in #KeyBlock.data, use for allocation and stride */
+	int pad;
 	
-	ListBase block;
+	ListBase block;  /* list of KeyBlock's */
 	struct Ipo *ipo  DNA_DEPRECATED;  /* old animation system, deprecated for 2.5 */
-	
+
 	ID *from;
 
-	short type, totkey;
-	short slurph, flag;
+	short type;    /* absolute or relative shape key */
+	short totkey;  /* (totkey == BLI_countlist(&key->block)) */
+	short slurph;  /* quaint feature to delay moving points based on their order (Key->type == KEY_NORMAL) only */
+	short flag;
+
+	/* only used when (Key->type == KEY_NORMAL), this value is used as a time slider,
+	 * rather then using the scenes time, this value can be animated to give greater control */
+	float ctime;
+
+	/* can never be 0, this is used for detecting old data */
+	int uidgen; /* current free uid for keyblocks */
 } Key;
 
 /* **************** KEY ********************* */
 
-/* key->type */
-#define KEY_NORMAL      0
-#define KEY_RELATIVE    1
+/* Key->type: KeyBlocks are interpreted as... */
+enum {
+	/* Sequencial positions over time (using KeyBlock->pos and Key->ctime) */
+	KEY_NORMAL      = 0,
+
+	/* States to blend between (default) */
+	KEY_RELATIVE    = 1
+};
 
-/* key->flag */
-#define KEY_DS_EXPAND	1
+/* Key->flag */
+enum {
+	KEY_DS_EXPAND   = 1
+};
 
-/* keyblock->type */
-#define KEY_LINEAR      0
-#define KEY_CARDINAL    1
-#define KEY_BSPLINE     2
+/* KeyBlock->type */
+enum {
+	KEY_LINEAR      = 0,
+	KEY_CARDINAL    = 1,
+	KEY_BSPLINE     = 2
+};
 
-/* keyblock->flag */
-#define KEYBLOCK_MUTE			(1<<0)
-#define KEYBLOCK_SEL			(1<<1)
-#define KEYBLOCK_LOCKED			(1<<2)
+/* KeyBlock->flag */
+enum {
+	KEYBLOCK_MUTE       = (1 << 0),
+	KEYBLOCK_SEL        = (1 << 1),
+	KEYBLOCK_LOCKED     = (1 << 2)
+};
 
-#endif
+#endif /* __DNA_KEY_TYPES_H__  */
diff --git a/source/blender/makesdna/DNA_lamp_types.h b/source/blender/makesdna/DNA_lamp_types.h
index 18fbde8..8cf3814 100644
--- a/source/blender/makesdna/DNA_lamp_types.h
+++ b/source/blender/makesdna/DNA_lamp_types.h
@@ -29,8 +29,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_LAMP_TYPES_H
-#define DNA_LAMP_TYPES_H
+#ifndef __DNA_LAMP_TYPES_H__
+#define __DNA_LAMP_TYPES_H__
 
 #include "DNA_defs.h"
 #include "DNA_ID.h"
@@ -206,5 +206,5 @@ typedef struct Lamp {
 #define LAMAP_SHAD		2
 
 
-#endif /* DNA_LAMP_TYPES_H */
+#endif /* __DNA_LAMP_TYPES_H__ */
 
diff --git a/source/blender/makesdna/DNA_lattice_types.h b/source/blender/makesdna/DNA_lattice_types.h
index 0a73ed5..1b4bd53 100644
--- a/source/blender/makesdna/DNA_lattice_types.h
+++ b/source/blender/makesdna/DNA_lattice_types.h
@@ -29,8 +29,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_LATTICE_TYPES_H
-#define DNA_LATTICE_TYPES_H
+#ifndef __DNA_LATTICE_TYPES_H__
+#define __DNA_LATTICE_TYPES_H__
 
 #include "DNA_defs.h"
 #include "DNA_ID.h"
diff --git a/source/blender/makesdna/DNA_listBase.h b/source/blender/makesdna/DNA_listBase.h
index 99ad6f4..d0e7a2f 100644
--- a/source/blender/makesdna/DNA_listBase.h
+++ b/source/blender/makesdna/DNA_listBase.h
@@ -33,8 +33,8 @@
  *         library system.
  */
 
-#ifndef DNA_LISTBASE_H
-#define DNA_LISTBASE_H
+#ifndef __DNA_LISTBASE_H__
+#define __DNA_LISTBASE_H__
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h
index eacc1b2..2b3719a 100644
--- a/source/blender/makesdna/DNA_material_types.h
+++ b/source/blender/makesdna/DNA_material_types.h
@@ -29,8 +29,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_MATERIAL_TYPES_H
-#define DNA_MATERIAL_TYPES_H
+#ifndef __DNA_MATERIAL_TYPES_H__
+#define __DNA_MATERIAL_TYPES_H__
 
 #include "DNA_defs.h"
 #include "DNA_ID.h"
@@ -136,7 +136,7 @@ typedef struct Material {
 	short diff_shader, spec_shader;
 	float roughness, refrac;
 	/* XXX param[4] needs review and improvement (shader system as whole anyway)
-	   This is nasty reused variable for different goals and not easy to RNAify nicely. -jesterKing */
+	 * This is nasty reused variable for different goals and not easy to RNAify nicely. -jesterKing */
 	float param[4];		/* size, smooth, size, smooth, for toonshader, 0 (fac) and 1 (fresnel) also for fresnel shader */
 	float rms;
 	float darkness;
@@ -168,7 +168,7 @@ typedef struct Material {
 	float sss_front, sss_back;
 	short sss_flag, sss_preset;
 
-	int mapto_textured;	/* render-time cache to optimise texture lookups */
+	int mapto_textured;	/* render-time cache to optimize texture lookups */
 	short shadowonly_flag;  /* "shadowsonly" type */
 	short index;            /* custom index for render passes */
 
@@ -206,7 +206,7 @@ typedef struct Material {
 /* maximum number of materials per material array.
  * (on object, mesh, lamp, etc.). limited by
  * short mat_nr in verts, faces.
- * -1 becayse for active material we store the index + 1 */
+ * -1 because for active material we store the index + 1 */
 #define MAXMAT			(32767-1)
 
 /* material_type */
diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h
index 1dc9619..5d55bb8 100644
--- a/source/blender/makesdna/DNA_mesh_types.h
+++ b/source/blender/makesdna/DNA_mesh_types.h
@@ -29,8 +29,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_MESH_TYPES_H
-#define DNA_MESH_TYPES_H
+#ifndef __DNA_MESH_TYPES_H__
+#define __DNA_MESH_TYPES_H__
 
 #include "DNA_defs.h"
 #include "DNA_listBase.h"
@@ -39,25 +39,24 @@
 
 #include "DNA_defs.h" /* USE_BMESH_FORWARD_COMPAT */
 
+struct AnimData;
 struct DerivedMesh;
 struct Ipo;
 struct Key;
-struct Material;
-struct MVert;
+struct MCol;
 struct MEdge;
 struct MFace;
-struct MCol;
-struct MSticky;
-struct Mesh;
-struct OcInfo;
-struct MPoly;
-struct MTexPoly;
 struct MLoop;
-struct MLoopUV;
 struct MLoopCol;
+struct MLoopUV;
+struct MPoly;
+struct MSticky;
+struct MTexPoly;
+struct MVert;
+struct Material;
+struct Mesh;
 struct Multires;
-struct EditMesh;
-struct AnimData;
+struct OcInfo;
 
 typedef struct Mesh {
 	ID id;
@@ -68,8 +67,8 @@ typedef struct Mesh {
 	struct Ipo *ipo  DNA_DEPRECATED;  /* old animation system, deprecated for 2.5 */
 	struct Key *key;
 	struct Material **mat;
+	struct MSelect *mselect;
 
-/*#ifdef USE_BMESH_FORWARD_COMPAT*/ /* XXX - ifdefs dont work here! */
 /* BMESH ONLY */
 	/*new face structures*/
 	struct MPoly *mpoly;
@@ -78,36 +77,35 @@ typedef struct Mesh {
 	struct MLoopUV *mloopuv;
 	struct MLoopCol *mloopcol;
 /* END BMESH ONLY */
-/*#endif*/
 
-	struct MFace *mface;	/* array of mesh object mode faces */
-	struct MTFace *mtface;	/* store face UV's and texture here */
+	/* mface stores the tessellation (triangulation) of the mesh,
+	 * real faces are now stored in nface.*/
+	struct MFace *mface;	/* array of mesh object mode faces for tessellation */
+	struct MTFace *mtface;	/* store tessellation face UV's and texture here */
 	struct TFace *tface;	/* depecrated, use mtface */
 	struct MVert *mvert;	/* array of verts */
 	struct MEdge *medge;	/* array of edges */
 	struct MDeformVert *dvert;	/* deformgroup vertices */
-	struct MCol *mcol;		/* array of colors, this must be the number of faces * 4 */
+
+	/* array of colors for the tessellated faces, must be number of tessellated
+	 * faces * 4 in length */
+	struct MCol *mcol;		
 	struct MSticky *msticky;
 	struct Mesh *texcomesh;
-	struct MSelect *mselect;
 	
-	struct EditMesh *edit_mesh;	/* not saved in file! */
+	struct BMEditMesh *edit_btmesh;	/* not saved in file! */
 
 	struct CustomData vdata, edata, fdata;
 
-/*#ifdef USE_BMESH_FORWARD_COMPAT*/ /* XXX - ifdefs dont work here! */
 /* BMESH ONLY */
 	struct CustomData pdata, ldata;
 /* END BMESH ONLY */
-/*#endif*/
 
 	int totvert, totedge, totface, totselect;
 
-/*#ifdef USE_BMESH_FORWARD_COMPAT*/
 /* BMESH ONLY */
 	int totpoly, totloop;
 /* END BMESH ONLY */
-/*#endif*/ /* XXX - ifdefs dont work here! */
 
 	/* the last selected vertex/edge/face are used for the active face however
 	 * this means the active face must always be selected, this is to keep track
@@ -144,7 +142,7 @@ typedef struct TFace {
 /* **************** MESH ********************* */
 
 /* texflag */
-#define AUTOSPACE	1
+#define ME_AUTOSPACE	1
 
 /* me->editflag */
 #define ME_EDIT_MIRROR_X (1 << 0)
@@ -196,27 +194,6 @@ typedef struct TFace {
 /* debug only option */
 #define ME_DRAWEXTRA_INDICES (1 << 13)
 
-/* old global flags:
-#define G_DRAWEDGES		(1 << 18)
-#define G_DRAWFACES		(1 <<  7)
-#define G_DRAWNORMALS	(1 <<  6)
-#define G_DRAW_VNORMALS	(1 << 14)
-
-#define G_ALLEDGES		(1 << 11)
-#define G_HIDDENEDGES   (1 << 21)
-
-#define G_DRAWCREASES	(1 << 19)
-#define G_DRAWSEAMS     (1 << 20)
-#define G_DRAWSHARP     (1 << 28)
-#define G_DRAWBWEIGHTS	(1 << 31)
-
-#define G_DRAW_EDGELEN  (1 << 22) 
-#define G_DRAW_FACEAREA (1 << 23)
-#define G_DRAW_EDGEANG  (1 << 24)
-*/
-
-
-
 /* Subsurf Type */
 #define ME_CC_SUBSURF 		0
 #define ME_SIMPLE_SUBSURF 	1
@@ -226,9 +203,13 @@ typedef struct TFace {
 /* this is so we can save bmesh files that load in trunk, ignoring NGons
  * will eventually be removed */
 
-#if 0 /* enable in bmesh branch only for now */
 #define USE_BMESH_SAVE_AS_COMPAT
-#endif
+#define USE_BMESH_SAVE_WITHOUT_MFACE
+
+/* enable this to calculate mpoly normal layer and face origindex mapping */
+// #define USE_BMESH_MPOLY_NORMALS
 
+/* enable this so meshes get tessfaces calculated by default */
+// #define USE_TESSFACE_DEFAULT
 
 #endif
diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h
index ce9d153..89ed3ba 100644
--- a/source/blender/makesdna/DNA_meshdata_types.h
+++ b/source/blender/makesdna/DNA_meshdata_types.h
@@ -29,8 +29,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_MESHDATA_TYPES_H
-#define DNA_MESHDATA_TYPES_H
+#ifndef __DNA_MESHDATA_TYPES_H__
+#define __DNA_MESHDATA_TYPES_H__
 
 #include "DNA_customdata_types.h"
 #include "DNA_listBase.h"
@@ -38,6 +38,7 @@
 struct Bone;
 struct Image;
 
+/*tessellation face, see MLoop/MPoly for the real face data*/
 typedef struct MFace {
 	unsigned int v1, v2, v3, v4;
 	short mat_nr;
@@ -67,16 +68,15 @@ typedef struct MVert {
 	char flag, bweight;
 } MVert;
 
-/* at the moment alpha is abused for vertex painting
- * and not used for transperency, note that red and blue are swapped */
+/* tessellation vertex color data.
+ * 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;	
 } MCol;
 
-#ifdef USE_BMESH_FORWARD_COMPAT
-
-/*new face structure, replaces MFace, which is now
-  only used for storing tesselations.*/
+/* new face structure, replaces MFace, which is now
+ * only used for storing tessellations.*/
 typedef struct MPoly {
 	/* offset into loop array and number of loops in the face */
 	int loopstart;
@@ -85,30 +85,67 @@ typedef struct MPoly {
 	char flag, pad;
 } MPoly;
 
-/*the e here is because we want to move away from
-  relying on edge hashes.*/
+/* the e here is because we want to move away from
+ * relying on edge hashes.*/
 typedef struct MLoop {
 	unsigned int v; /*vertex index*/
 	unsigned int e; /*edge index*/
 } MLoop;
 
-#endif /* USE_BMESH_FORWARD_COMPAT */
-
-/*bmesh custom data stuff*/
 typedef struct MTexPoly {
 	struct Image *tpage;
 	char flag, transp;
 	short mode,tile,unwrap;
 } MTexPoly;
 
+/* can copy from/to MTexPoly/MTFace */
+#define ME_MTEXFACE_CPY(dst, src)   \
+{                                   \
+	(dst)->tpage  = (src)->tpage;   \
+	(dst)->flag   = (src)->flag;    \
+	(dst)->transp = (src)->transp;  \
+	(dst)->mode   = (src)->mode;    \
+	(dst)->tile   = (src)->tile;    \
+	(dst)->unwrap = (src)->unwrap;  \
+}
+
 typedef struct MLoopUV {
 	float uv[2];
+	int flag;
 } MLoopUV;
 
+/*mloopuv->flag*/
+#define MLOOPUV_EDGESEL	1
+#define MLOOPUV_VERTSEL	2
+#define MLOOPUV_PINNED	4
+
+/* at the moment alpha is abused for vertex painting
+ * and not used for transparency, note that red and blue are swapped */
 typedef struct MLoopCol {
-	char a, r, g, b;
+	char r, g, b, a;
 } MLoopCol;
 
+#define MESH_MLOOPCOL_FROM_MCOL(_mloopcol, _mcol) \
+{                                                 \
+	MLoopCol   *mloopcol__tmp = _mloopcol;        \
+	const MCol *mcol__tmp     = _mcol;            \
+	mloopcol__tmp->r = mcol__tmp->b;              \
+	mloopcol__tmp->g = mcol__tmp->g;              \
+	mloopcol__tmp->b = mcol__tmp->r;              \
+	mloopcol__tmp->a = mcol__tmp->a;              \
+} (void)0
+
+
+#define MESH_MLOOPCOL_TO_MCOL(_mloopcol, _mcol) \
+{                                               \
+	const MLoopCol *mloopcol__tmp = _mloopcol;  \
+	MCol           *mcol__tmp     = _mcol;      \
+	mcol__tmp->b = mloopcol__tmp->r;            \
+	mcol__tmp->g = mloopcol__tmp->g;            \
+	mcol__tmp->r = mloopcol__tmp->b;            \
+	mcol__tmp->a = mloopcol__tmp->a;            \
+} (void)0
+
 typedef struct MSticky {
 	float co[2];
 } MSticky;
@@ -118,6 +155,7 @@ typedef struct MSelect {
 	int type; /* EDITVERT/EDITEDGE/EDITFACE */
 } MSelect;
 
+/*tessellation uv face data*/
 typedef struct MTFace {
 	float uv[4][2];
 	struct Image *tpage;
@@ -140,11 +178,21 @@ typedef struct OrigSpaceFace {
 	float uv[4][2];
 } OrigSpaceFace;
 
+typedef struct OrigSpaceLoop {
+	float uv[2];
+} OrigSpaceLoop;
+
 typedef struct MDisps {
 	/* Strange bug in SDNA: if disps pointer comes first, it fails to see totdisp */
 	int totdisp;
-	char pad[4];
+	int level;
 	float (*disps)[3];
+	
+	/* Used for hiding parts of a multires mesh. Essentially the multires
+	   equivalent of MVert.flag's ME_HIDE bit.
+	
+	   This is a bitmap, keep in sync with type used in BLI_bitmap.h */
+	unsigned int *hidden;
 } MDisps;
 
 /** Multires structs kept for compatibility with old files **/
@@ -209,7 +257,7 @@ typedef struct MRecast {
 /* medge->flag (1=SELECT)*/
 #define ME_EDGEDRAW			(1<<1)
 #define ME_SEAM				(1<<2)
-#define ME_FGON				(1<<3)
+#define ME_FGON				(1<<3) /* no longer used (now we have ngons), only defined so we can clear it */
 						/* reserve 16 for ME_HIDE */
 #define ME_EDGERENDER		(1<<5)
 #define ME_LOOSEEDGE		(1<<7)
@@ -231,7 +279,16 @@ typedef struct MRecast {
 /* flag (mface) */
 #define ME_SMOOTH			1
 #define ME_FACE_SEL			2
-						/* flag ME_HIDE==16 is used here too */ 
+/* flag ME_HIDE==16 is used here too */ 
+
+#define ME_POLY_LOOP_PREV(mloop, mp, i)  (&(mloop)[(mp)->loopstart + (((i) + (mp)->totloop - 1) % (mp)->totloop)])
+#define ME_POLY_LOOP_NEXT(mloop, mp, i)  (&(mloop)[(mp)->loopstart + (((i) + 1) % (mp)->totloop)])
+
+/* mselect->type */
+#define ME_VSEL	0
+#define ME_ESEL 1
+#define ME_FSEL 2
+
 /* mtface->flag */
 #define TF_SELECT	1 /* use MFace hide flag (after 2.43), should be able to reuse after 2.44 */
 #define TF_ACTIVE	2 /* deprecated! */
diff --git a/source/blender/makesdna/DNA_meta_types.h b/source/blender/makesdna/DNA_meta_types.h
index 863e2b2..2912650 100644
--- a/source/blender/makesdna/DNA_meta_types.h
+++ b/source/blender/makesdna/DNA_meta_types.h
@@ -29,8 +29,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_META_TYPES_H
-#define DNA_META_TYPES_H
+#ifndef __DNA_META_TYPES_H__
+#define __DNA_META_TYPES_H__
 
 #include "DNA_listBase.h"
 #include "DNA_ID.h"
@@ -87,8 +87,8 @@ typedef struct MetaBall {
 	float wiresize, rendersize; /* display and render res */
 	
 	/* bias elements to have an offset volume.
-	mother ball changes will effect other objects thresholds,
-	but these may also have their own thresh as an offset */
+	 * mother ball changes will effect other objects thresholds,
+	 * but these may also have their own thresh as an offset */
 	float thresh;
 
 	/* used in editmode */
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index dca401f..30280e9 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -22,8 +22,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_MODIFIER_TYPES_H
-#define DNA_MODIFIER_TYPES_H
+#ifndef __DNA_MODIFIER_TYPES_H__
+#define __DNA_MODIFIER_TYPES_H__
 
 #include "DNA_defs.h"
 #include "DNA_listBase.h"
@@ -135,6 +135,8 @@ typedef struct LatticeModifierData {
 
 	struct Object *object;
 	char name[64];			/* optional vertexgroup name, MAX_VGROUP_NAME */
+	float strength;
+	char pad[4];
 } LatticeModifierData;
 
 typedef struct CurveModifierData {
@@ -191,33 +193,33 @@ typedef struct ArrayModifierData {
 	/* the object to use for object offset */
 	struct Object *offset_ob;
 	/* a constant duplicate offset;
-	   1 means the duplicates are 1 unit apart
-	*/
+	 * 1 means the duplicates are 1 unit apart
+	 */
 	float offset[3];
 	/* a scaled factor for duplicate offsets;
-	   1 means the duplicates are 1 object-width apart
-	*/
+	 * 1 means the duplicates are 1 object-width apart
+	 */
 	float scale[3];
 	/* the length over which to distribute the duplicates */
 	float length;
 	/* the limit below which to merge vertices in adjacent duplicates */
 	float merge_dist;
 	/* determines how duplicate count is calculated; one of:
-		  MOD_ARR_FIXEDCOUNT -> fixed
-		  MOD_ARR_FITLENGTH  -> calculated to fit a set length
-		  MOD_ARR_FITCURVE   -> calculated to fit the length of a Curve object
-	*/
+	 * - MOD_ARR_FIXEDCOUNT -> fixed
+	 * - MOD_ARR_FITLENGTH  -> calculated to fit a set length
+	 * - MOD_ARR_FITCURVE   -> calculated to fit the length of a Curve object
+	 */
 	int fit_type;
 	/* flags specifying how total offset is calculated; binary OR of:
-		 MOD_ARR_OFF_CONST    -> total offset += offset
-		 MOD_ARR_OFF_RELATIVE -> total offset += relative * object width
-		 MOD_ARR_OFF_OBJ      -> total offset += offset_ob's matrix
-	   total offset is the sum of the individual enabled offsets
-	*/
+	 * - MOD_ARR_OFF_CONST    -> total offset += offset
+	 * - MOD_ARR_OFF_RELATIVE -> total offset += relative * object width
+	 * - MOD_ARR_OFF_OBJ      -> total offset += offset_ob's matrix
+	 * total offset is the sum of the individual enabled offsets
+	 */
 	int offset_type;
 	/* general flags:
-		  MOD_ARR_MERGE -> merge vertices in adjacent duplicates
-	*/
+	 * MOD_ARR_MERGE -> merge vertices in adjacent duplicates
+	 */
 	int flags;
 	/* the number of duplicates to generate for MOD_ARR_FIXEDCOUNT */
 	int count;
@@ -676,6 +678,7 @@ typedef struct ShrinkwrapModifierData {
 #define MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS		(1<<2)
 #define MOD_SHRINKWRAP_PROJECT_OVER_NORMAL			0	/* projection over normal is used if no axis is selected */
 
+
 typedef struct SimpleDeformModifierData {
 	ModifierData modifier;
 
@@ -810,7 +813,6 @@ typedef struct OceanModifierData {
 
 typedef struct WarpModifierData {
 	ModifierData modifier;
-
 	/* keep in sync with MappingInfoModifierData */
 	struct Tex *texture;
 	struct Object *map_object;
@@ -896,7 +898,7 @@ typedef struct WeightVGEditModifierData {
 typedef struct WeightVGMixModifierData {
 	ModifierData modifier;
 
-	/* XXX Note: I tried to keep everything logically ordered – provided the
+	/* XXX Note: I tried to keep everything logically ordered - provided the
 	 *           alignment constraints... */
 
 	char	defgrp_name_a[64];      /* Name of vertex group to modify/weight. MAX_VGROUP_NAME. */
@@ -1045,7 +1047,7 @@ typedef struct RemeshModifierData {
 	ModifierData modifier;
 
 	/* floodfill option, controls how small components can be
-	   before they are removed */
+	 * before they are removed */
 	float threshold;
 
 	/* ratio between size of model and grid */
diff --git a/source/blender/makesdna/DNA_movieclip_types.h b/source/blender/makesdna/DNA_movieclip_types.h
index 80728cd..ed7310f 100644
--- a/source/blender/makesdna/DNA_movieclip_types.h
+++ b/source/blender/makesdna/DNA_movieclip_types.h
@@ -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.
  *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * The Original Code is Copyright (C) 2011 Blender Foundation.
  * All rights reserved.
  *
  * The Original Code is: all of this file.
@@ -32,13 +32,14 @@
  *  \author Sergey Sharybin
  */
 
-#ifndef DNA_MOVIECLIP_TYPES_H
-#define DNA_MOVIECLIP_TYPES_H
+#ifndef __DNA_MOVIECLIP_TYPES_H__
+#define __DNA_MOVIECLIP_TYPES_H__
 
 #include "DNA_ID.h"
 #include "DNA_tracking_types.h"
 
 struct anim;
+struct AnimData;
 struct bGPdata;
 struct ImBuf;
 struct MovieClipProxy;
@@ -61,6 +62,7 @@ typedef struct MovieClipProxy {
 
 typedef struct MovieClip {
 	ID id;
+	struct AnimData *adt;	/* animation data (must be immediately after id for utilities to use it) */
 
 	char name[1024];		/* file path, 1024 = FILE_MAX */
 
@@ -76,11 +78,13 @@ typedef struct MovieClip {
 
 	struct MovieTracking tracking;		/* data for SfM tracking */
 	void *tracking_context;				/* context of tracking job
-										   used to synchronize data like framenumber
-										   in SpaceClip clip user */
+										 * used to synchronize data like framenumber
+										 * in SpaceClip clip user */
 
 	struct MovieClipProxy proxy;		/* proxy to clip data */
-	int flag, pad;
+	int flag;
+
+	int len;	/* lenght of movie */
 } MovieClip;
 
 typedef struct MovieClipScopes {
diff --git a/source/blender/makesdna/DNA_nla_types.h b/source/blender/makesdna/DNA_nla_types.h
index a28097e..43b52ed 100644
--- a/source/blender/makesdna/DNA_nla_types.h
+++ b/source/blender/makesdna/DNA_nla_types.h
@@ -29,8 +29,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_NLA_TYPES_H
-#define DNA_NLA_TYPES_H
+#ifndef __DNA_NLA_TYPES_H__
+#define __DNA_NLA_TYPES_H__
 
 #include "DNA_listBase.h"
 
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 33ac759..1abce52 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -29,8 +29,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_NODE_TYPES_H
-#define DNA_NODE_TYPES_H
+#ifndef __DNA_NODE_TYPES_H__
+#define __DNA_NODE_TYPES_H__
 
 #include "DNA_ID.h"
 #include "DNA_vec_types.h"
@@ -77,7 +77,7 @@ typedef struct bNodeSocket {
 	
 	short type, flag;
 	short limit;				/* max. number of links */
-	short pad1;
+	short struct_type;			/* optional identifier for RNA struct subtype */
 	
 	float locx, locy;
 	
@@ -112,6 +112,10 @@ typedef struct bNodeSocket {
 #define SOCK_INT			6
 #define NUM_SOCKET_TYPES	7	/* must be last! */
 
+/* sock->struct_type */
+#define SOCK_STRUCT_NONE				0	/* default, type is defined by sock->type only */
+#define SOCK_STRUCT_OUTPUT_FILE			1	/* file output node socket */
+
 /* socket side (input/output) */
 #define SOCK_IN		1
 #define SOCK_OUT	2
@@ -132,7 +136,8 @@ typedef struct bNodeSocket {
 	/* hide socket value, if it gets auto default */
 #define SOCK_HIDE_VALUE			128
 	/* socket hidden automatically, to distinguish from manually hidden */
-#define SOCK_AUTO_HIDDEN		256
+	/* DEPRECATED, only kept here to avoid reusing the flag */
+#define SOCK_AUTO_HIDDEN__DEPRECATED	256
 
 typedef struct bNodePreview {
 	unsigned char *rect;
@@ -189,7 +194,7 @@ typedef struct bNode {
 #define NODE_GROUP_EDIT		128
 	/* free test flag, undefined */
 #define NODE_TEST			256
-	/* composite: don't do node but pass on buffer(s) */
+	/* node is disabled */
 #define NODE_MUTED			512
 #define NODE_CUSTOM_NAME	1024	/* deprecated! */
 	/* group node types: use const outputs by default */
@@ -234,7 +239,7 @@ typedef struct bNodeTree {
 	
 	int type, init;					/* set init on fileread */
 	int cur_index;					/* sockets in groups have unique identifiers, adding new sockets always 
-									   will increase this counter */
+									 * will increase this counter */
 	int flag;
 	int update;						/* update flags */
 	
@@ -354,6 +359,21 @@ typedef struct NodeImageFile {
 	int sfra, efra;
 } NodeImageFile;
 
+/* XXX first struct fields should match NodeImageFile to ensure forward compatibility */
+typedef struct NodeImageMultiFile {
+	char base_path[1024];	/* 1024 = FILE_MAX */
+	ImageFormatData format;
+	int sfra DNA_DEPRECATED, efra DNA_DEPRECATED;	/* XXX old frame rand values from NodeImageFile for forward compatibility */
+	int active_input;		/* selected input in details view list */
+	int pad;
+} NodeImageMultiFile;
+typedef struct NodeImageMultiFileSocket {
+	short use_render_format  DNA_DEPRECATED;
+	short use_node_format;	/* use overall node image format */
+	int pad2;
+	ImageFormatData format;
+} NodeImageMultiFileSocket;
+
 typedef struct NodeChroma {
 	float t1,t2,t3;
 	float fsize,fstrength,falpha;
@@ -456,7 +476,7 @@ typedef struct NodeTexChecker {
 
 typedef struct NodeTexEnvironment {
 	NodeTexBase base;
-	int color_space, pad;
+	int color_space, projection;
 } NodeTexEnvironment;
 
 typedef struct NodeTexGradient {
@@ -563,8 +583,12 @@ typedef struct TexNodeOutput {
 #define SHD_WAVE_TRI	2
 
 /* image/environment texture */
-#define SHD_COLORSPACE_LINEAR	0
-#define SHD_COLORSPACE_SRGB		1
+#define SHD_COLORSPACE_NONE		0
+#define SHD_COLORSPACE_COLOR	1
+
+/* environment texture */
+#define SHD_PROJ_EQUIRECTANGULAR	0
+#define SHD_PROJ_MIRROR_BALL		1
 
 /* blur node */
 #define CMP_NODE_BLUR_ASPECT_NONE		0
diff --git a/source/blender/makesdna/DNA_object_fluidsim.h b/source/blender/makesdna/DNA_object_fluidsim.h
index 0651f07..a55b7b1 100644
--- a/source/blender/makesdna/DNA_object_fluidsim.h
+++ b/source/blender/makesdna/DNA_object_fluidsim.h
@@ -31,10 +31,11 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_OBJECT_FLUIDSIM_H
-#define DNA_OBJECT_FLUIDSIM_H
+#ifndef __DNA_OBJECT_FLUIDSIM_H__
+#define __DNA_OBJECT_FLUIDSIM_H__
 
 #include "DNA_ID.h"
+#include "DNA_defs.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -66,7 +67,7 @@ typedef struct FluidsimSettings {
 
 	/* fluid properties */
 	float viscosityValue;
-	short viscosityMode;
+	short viscosityMode DNA_DEPRECATED;
 	short viscosityExponent;
 	/* gravity strength */
 	float grav[3];
diff --git a/source/blender/makesdna/DNA_object_force.h b/source/blender/makesdna/DNA_object_force.h
index 70aeaaa..6fefd2d 100644
--- a/source/blender/makesdna/DNA_object_force.h
+++ b/source/blender/makesdna/DNA_object_force.h
@@ -31,8 +31,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_OBJECT_FORCE_H
-#define DNA_OBJECT_FORCE_H
+#ifndef __DNA_OBJECT_FORCE_H__
+#define __DNA_OBJECT_FORCE_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -130,7 +130,7 @@ typedef struct EffectorWeights {
  * - to add new data types update:
  *		* BKE_ptcache_data_size()
  *		* ptcache_file_init_pointers()
-*/
+ */
 #define BPHYS_DATA_INDEX		0
 #define BPHYS_DATA_LOCATION		1
 #define BPHYS_DATA_SMOKE_LOW	1
@@ -276,9 +276,10 @@ typedef struct SoftBody {
 	
 	/* general options */
 	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 
-								rather find them by name tag to find it -> jow20090613 */
+	char  namedVG_Mass[64]; /* MAX_VGROUP_NAME */
+	                        /* along with it introduce mass painting
+	                         * starting to fix old bug .. nastyness 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 */
 	float rklimit;		/* error limit for ODE solver */
@@ -291,17 +292,19 @@ typedef struct SoftBody {
 	float maxgoal;
 	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 
-								rather find them by name tag to find it -> jow20090613 */
+	char  namedVG_Softgoal[64]; /* MAX_VGROUP_NAME */
+	                            /* starting to fix old bug .. nastyness that VG are indexes
+	                             * rather find them by name tag to find it -> jow20090613 */
   
 	short fuzzyness;      /* */
 	
 	/* springs */
 	float inspring;		/* softbody inner springs */
 	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
-	                               rather find them by name tag to find it -> jow20090613 */
+	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
+	                             * rather find them by name tag to find it -> jow20090613 */
 	
 	/* baking */
 	int sfra, efra;
@@ -325,7 +328,7 @@ typedef struct SoftBody {
 		choke,
 		solver_ID,
 		plastic,springpreload
-		;   
+		;
 
 	struct SBScratch *scratch;	/* scratch pad/cache on live time not saved in file */
 	float shearstiff;
@@ -398,7 +401,7 @@ typedef struct SoftBody {
 #define PTCACHE_FRAMES_SKIPPED		256
 #define PTCACHE_EXTERNAL			512
 #define PTCACHE_READ_INFO			1024
-/* dont use the filename of the blendfile the data is linked from (write a local cache) */
+/* don't use the filename of the blendfile the data is linked from (write a local cache) */
 #define PTCACHE_IGNORE_LIBPATH		2048
 /* high resolution cache is saved for smoke for backwards compatibility, so set this flag to know it's a "fake" cache */
 #define PTCACHE_FAKE_SMOKE			(1<<12)
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index b8580b4..86a2bb6 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -30,8 +30,8 @@
  *  \brief Object is a sort of wrapper for general info.
  */
 
-#ifndef DNA_OBJECT_TYPES_H
-#define DNA_OBJECT_TYPES_H
+#ifndef __DNA_OBJECT_TYPES_H__
+#define __DNA_OBJECT_TYPES_H__
 
 #include "DNA_defs.h"
 #include "DNA_listBase.h"
@@ -136,7 +136,7 @@ typedef struct Object {
 
 	/* materials */
 	struct Material **mat;	/* material slots */
-	char *matbits;			/* a boolean field, with each byte 1 if corrusponding material is linked to object */
+	char *matbits;			/* a boolean field, with each byte 1 if corresponding material is linked to object */
 	int totcol;				/* copy of mesh or curve or meta */
 	int actcol;				/* currently selected material in the UI */
 	
@@ -353,7 +353,7 @@ typedef struct DupliObject {
 #define OB_NO_CONSTRAINTS	8192 /* runtime constraints disable */
 
 /* (short) ipoflag */
-/* XXX: many old flags for features removed due to incompatability 
+/* XXX: many old flags for features removed due to incompatibility
  * with new system and/or other design issues were here 
  */
 	/* for stride/path editing (XXX: NEEDS REVIEW) */
@@ -439,13 +439,14 @@ typedef struct DupliObject {
 // #define OB_RADIO			2048	/* deprecated */
 #define OB_FROMGROUP		4096
 
+/* WARNING - when adding flags check on PSYS_RECALC */
 /* ob->recalc (flag bits!) */
-#define OB_RECALC_OB		1
-#define OB_RECALC_DATA		2
-		/* time flag is set when time changes need recalc, so baked systems can ignore it */
-#define OB_RECALC_TIME		4
-		/* only use for matching any flag, NOT as an argument since more flags may be added. */
-#define OB_RECALC_ALL		(OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME)
+#define OB_RECALC_OB        (1 << 0)
+#define OB_RECALC_DATA      (1 << 1)
+/* time flag is set when time changes need recalc, so baked systems can ignore it */
+#define OB_RECALC_TIME      (1 << 2)
+/* only use for matching any flag, NOT as an argument since more flags may be added. */
+#define OB_RECALC_ALL       (OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME)
 
 /* controller state */
 #define OB_MAX_STATES		30
diff --git a/source/blender/makesdna/DNA_outliner_types.h b/source/blender/makesdna/DNA_outliner_types.h
index ee3903c..17124a7 100644
--- a/source/blender/makesdna/DNA_outliner_types.h
+++ b/source/blender/makesdna/DNA_outliner_types.h
@@ -29,8 +29,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_OUTLINER_TYPES_H
-#define DNA_OUTLINER_TYPES_H
+#ifndef __DNA_OUTLINER_TYPES_H__
+#define __DNA_OUTLINER_TYPES_H__
 
 #include "DNA_listBase.h"
 
diff --git a/source/blender/makesdna/DNA_packedFile_types.h b/source/blender/makesdna/DNA_packedFile_types.h
index 91134c2..339ac0f 100644
--- a/source/blender/makesdna/DNA_packedFile_types.h
+++ b/source/blender/makesdna/DNA_packedFile_types.h
@@ -31,8 +31,8 @@
  *  \since 12-oct-2000 nzc
  */
 
-#ifndef DNA_PACKEDFILE_TYPES_H
-#define DNA_PACKEDFILE_TYPES_H
+#ifndef __DNA_PACKEDFILE_TYPES_H__
+#define __DNA_PACKEDFILE_TYPES_H__
 
 typedef struct PackedFile {
 	int size;
diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h
index 4c3279c..58ffcf6 100644
--- a/source/blender/makesdna/DNA_particle_types.h
+++ b/source/blender/makesdna/DNA_particle_types.h
@@ -29,8 +29,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_PARTICLE_TYPES_H
-#define DNA_PARTICLE_TYPES_H
+#ifndef __DNA_PARTICLE_TYPES_H__
+#define __DNA_PARTICLE_TYPES_H__
 
 #include "DNA_defs.h"
 #include "DNA_ID.h"
@@ -321,7 +321,7 @@ typedef struct ParticleSystem
 #define PART_TRAND			128	
 #define PART_EDISTR			256	/* particle/face from face areas */
 
-//#define PART_STICKY			512	/*collided particles can stick to collider*/
+#define PART_ROTATIONS		512	/* calculate particle rotations (and store them in pointcache) */
 #define PART_DIE_ON_COL		(1<<12)
 #define PART_SIZE_DEFL		(1<<13) /* swept sphere deflections */
 #define PART_ROT_DYN		(1<<14)	/* dynamic rotation */
@@ -463,8 +463,13 @@ typedef struct ParticleSystem
 #define PART_ROT_OB_Z		8
 
 /* part->avemode */
-#define PART_AVE_SPIN		1
+#define PART_AVE_VELOCITY	1
 #define PART_AVE_RAND		2
+#define PART_AVE_HORIZONTAL	3
+#define PART_AVE_VERTICAL	4
+#define PART_AVE_GLOBAL_X	5
+#define PART_AVE_GLOBAL_Y	6
+#define PART_AVE_GLOBAL_Z	7
 
 /* part->reactevent */
 #define PART_EVENT_DEATH	0
@@ -476,13 +481,13 @@ typedef struct ParticleSystem
 #define PART_CHILD_FACES		2
 
 /* psys->recalc */
-/* starts from 8 so that the first bits can be ob->recalc */
-#define PSYS_RECALC_REDO	8	/* only do pathcache etc */
-#define PSYS_RECALC_RESET	16	/* reset everything including pointcache */
-#define PSYS_RECALC_TYPE	32	/* handle system type change */
-#define PSYS_RECALC_CHILD	64	/* only child settings changed */
-#define PSYS_RECALC_PHYS	128	/* physics type changed */
-#define PSYS_RECALC			248
+/* starts from (1 << 3) so that the first bits can be ob->recalc */
+#define PSYS_RECALC_REDO   (1 << 3) /* only do pathcache etc */
+#define PSYS_RECALC_RESET  (1 << 4) /* reset everything including pointcache */
+#define PSYS_RECALC_TYPE   (1 << 5) /* handle system type change */
+#define PSYS_RECALC_CHILD  (1 << 6) /* only child settings changed */
+#define PSYS_RECALC_PHYS   (1 << 7) /* physics type changed */
+#define PSYS_RECALC        (PSYS_RECALC_REDO | PSYS_RECALC_RESET | PSYS_RECALC_TYPE | PSYS_RECALC_CHILD | PSYS_RECALC_PHYS)
 
 /* psys->flag */
 #define PSYS_CURRENT		1
@@ -498,7 +503,8 @@ typedef struct ParticleSystem
 #define PSYS_KEYED			1024
 #define PSYS_EDITED			2048
 //#define PSYS_PROTECT_CACHE	4096 /* deprecated */
-#define PSYS_DISABLED		8192
+#define PSYS_DISABLED			8192
+#define PSYS_OB_ANIM_RESTORE	16384 /* runtime flag */
 
 /* pars->flag */
 #define PARS_UNEXIST		1
diff --git a/source/blender/makesdna/DNA_property_types.h b/source/blender/makesdna/DNA_property_types.h
index a36e362..55fa50e 100644
--- a/source/blender/makesdna/DNA_property_types.h
+++ b/source/blender/makesdna/DNA_property_types.h
@@ -36,8 +36,8 @@
  *             hierarchy here is a bit strange, and not desirable.
  */
 
-#ifndef DNA_PROPERTY_TYPES_H
-#define DNA_PROPERTY_TYPES_H
+#ifndef __DNA_PROPERTY_TYPES_H__
+#define __DNA_PROPERTY_TYPES_H__
 
 /* ********************* PROPERTY ************************ */
 
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 1f42118..d2df799 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -29,8 +29,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_SCENE_TYPES_H
-#define DNA_SCENE_TYPES_H
+#ifndef __DNA_SCENE_TYPES_H__
+#define __DNA_SCENE_TYPES_H__
 
 #include "DNA_defs.h"
 
@@ -249,7 +249,7 @@ typedef struct ImageFormatData {
 	char depth;    /* bits per channel, R_IMF_CHAN_DEPTH_8 -> 32,
 	                * not a flag, only set 1 at a time */
 
-	char planes  ; /* - R_IMF_PLANES_BW, R_IMF_PLANES_RGB, R_IMF_PLANES_RGBA */
+	char planes;   /* - R_IMF_PLANES_BW, R_IMF_PLANES_RGB, R_IMF_PLANES_RGBA */
 	char flag;     /* generic options for all image types, alpha zbuffer */
 
 	char quality;  /* (0 - 100), eg: jpeg quality */
@@ -614,7 +614,7 @@ typedef struct GameData {
 	/*
 	 * bit 3: (gameengine): Activity culling is enabled.
 	 * bit 5: (gameengine) : enable Bullet DBVT tree for view frustrum culling
-	*/
+	 */
 	int flag;
 	short mode, matmode;
 	short occlusionRes;		/* resolution of occlusion Z buffer in pixel */
@@ -640,10 +640,6 @@ typedef struct GameData {
 
 /* physicsEngine */
 #define WOPHY_NONE		0
-#define WOPHY_ENJI		1
-#define WOPHY_SUMO		2
-#define WOPHY_DYNAMO	3
-#define WOPHY_ODE		4
 #define WOPHY_BULLET	5
 
 /* obstacleSimulation */
@@ -837,11 +833,12 @@ typedef struct TransformOrientation {
 } TransformOrientation;
 
 /* *************************************************************** */
-/* Unified Paint Settings */
+/* Unified Paint Settings
+ */
 
 /* These settings can override the equivalent fields in the active
-   Brush for any paint mode; the flag field controls whether these
-   values are used */
+ * Brush for any paint mode; the flag field controls whether these
+ * values are used */
 typedef struct UnifiedPaintSettings {
 	/* unified radius of brush in pixels */
 	int size;
@@ -861,12 +858,12 @@ typedef enum {
 	UNIFIED_PAINT_ALPHA = (1<<1),
 
 	/* only used if unified size is enabled, mirros the brush flags
-	   BRUSH_LOCK_SIZE and BRUSH_SIZE_PRESSURE */
+	 * BRUSH_LOCK_SIZE and BRUSH_SIZE_PRESSURE */
 	UNIFIED_PAINT_BRUSH_LOCK_SIZE = (1<<2),
 	UNIFIED_PAINT_BRUSH_SIZE_PRESSURE   = (1<<3),
 
 	/* only used if unified alpha is enabled, mirrors the brush flag
-	   BRUSH_ALPHA_PRESSURE */
+	 * BRUSH_ALPHA_PRESSURE */
 	UNIFIED_PAINT_BRUSH_ALPHA_PRESSURE  = (1<<4)
 } UnifiedPaintSettingsFlags;
 
@@ -884,7 +881,7 @@ typedef struct ToolSettings {
 
 	/* Subdivide Settings */
 	short cornertype;
-	short editbutflag;
+	short pad3;
 	/*Triangle to Quad conversion threshold*/
 	float jointrilimit;
 	/* Editmode Tools */
@@ -942,11 +939,11 @@ typedef struct ToolSettings {
 
 	/* Auto-Keying Mode */
 	short autokey_mode, autokey_flag;	/* defines in DNA_userdef_types.h */
-	
+
 	/* Multires */
 	char multires_subdiv_type;
 	char pad2[5];
-	
+
 	/* Skeleton generation */
 	short skgen_resolution;
 	float skgen_threshold_internal;
@@ -964,7 +961,7 @@ typedef struct ToolSettings {
 	char  skgen_postpro_passes;
 	char  skgen_subdivisions[3];
 	char  skgen_multi_level;
-	
+
 	/* Skeleton Sketching */
 	struct Object *skgen_template;
 	char bone_sketching;
@@ -995,7 +992,7 @@ typedef struct ToolSettings {
 	int uv_sculpt_tool;
 	int uv_relax_method;
 	/* XXX: these sculpt_paint_* fields are deprecated, use the
-	   unified_paint_settings field instead! */
+	 * unified_paint_settings field instead! */
 	short sculpt_paint_settings DNA_DEPRECATED;	short pad1;
 	int sculpt_paint_unified_size DNA_DEPRECATED;
 	float sculpt_paint_unified_unprojected_radius DNA_DEPRECATED;
@@ -1024,7 +1021,7 @@ typedef struct UnitSettings {
 	/* Display/Editing unit options for each scene */
 	float scale_length; /* maybe have other unit conversions? */
 	char system; /* imperial, metric etc */
-	char system_rotation; /* not implimented as a propper unit system yet */
+	char system_rotation; /* not implemented as a propper unit system yet */
 	short flag;
 } UnitSettings;
 
@@ -1086,7 +1083,7 @@ typedef struct Scene {
 	
 	void *fps_info;					/* (runtime) info/cache used for presenting playback framerate info to the user */
 	
-	/* none of the dependancy graph  vars is mean to be saved */
+	/* none of the dependency graph  vars is mean to be saved */
 	struct  DagForest *theDag;
 	short dagisvalid, dagflags;
 	short recalc;				/* recalc = counterpart of ob->recalc */
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index 504c8da..75d9b91 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -27,8 +27,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_SCREEN_TYPES_H
-#define DNA_SCREEN_TYPES_H
+#ifndef __DNA_SCREEN_TYPES_H__
+#define __DNA_SCREEN_TYPES_H__
 
 #include "DNA_listBase.h"
 #include "DNA_view2d_types.h"
diff --git a/source/blender/makesdna/DNA_sdna_types.h b/source/blender/makesdna/DNA_sdna_types.h
index 462ff8c..ec02db1 100644
--- a/source/blender/makesdna/DNA_sdna_types.h
+++ b/source/blender/makesdna/DNA_sdna_types.h
@@ -29,8 +29,8 @@
  * \ingroup DNA
  */
 
-#ifndef DNA_SDNA_H
-#define DNA_SDNA_H
+#ifndef __DNA_SDNA_TYPES_H__
+#define __DNA_SDNA_TYPES_H__
 
 #
 #
@@ -48,14 +48,14 @@ typedef struct SDNA {
 	short *typelens;	/* type lengths */
 
 	int nr_structs;		/* number of struct types */
-	short **structs;	/* sp= structs[a] is the address of a struct definintion
-						   sp[0] is struct type number, sp[1] amount of members
-
-						   (sp[2], sp[3]), (sp[4], sp[5]), .. are the member
-						   type and name numbers respectively */
+	short **structs;	/* sp = structs[a] is the address of a struct definintion
+	                     * sp[0] is struct type number, sp[1] amount of members
+	                     *
+	                     * (sp[2], sp[3]), (sp[4], sp[5]), .. are the member
+	                     * type and name numbers respectively */
 
 	struct GHash *structs_map; /* ghash for faster lookups,
-								  requires WITH_DNA_GHASH to be used for now */
+	                            * requires WITH_DNA_GHASH to be used for now */
 
 		/* wrong place for this really, its a simple
 		 * cache for findstruct_nr.
diff --git a/source/blender/makesdna/DNA_sensor_types.h b/source/blender/makesdna/DNA_sensor_types.h
index 80f19b3..05927e3 100644
--- a/source/blender/makesdna/DNA_sensor_types.h
+++ b/source/blender/makesdna/DNA_sensor_types.h
@@ -31,8 +31,8 @@
  *  \author nzc
  */
 
-#ifndef DNA_SENSOR_TYPES_H
-#define DNA_SENSOR_TYPES_H
+#ifndef __DNA_SENSOR_TYPES_H__
+#define __DNA_SENSOR_TYPES_H__
 
 struct Object;
 struct Material;
diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h
index 20399e5..0a516c9 100644
--- a/source/blender/makesdna/DNA_sequence_types.h
+++ b/source/blender/makesdna/DNA_sequence_types.h
@@ -30,8 +30,8 @@
  *  \author nzc
  */
 
-#ifndef DNA_SEQUENCE_TYPES_H
-#define DNA_SEQUENCE_TYPES_H
+#ifndef __DNA_SEQUENCE_TYPES_H__
+#define __DNA_SEQUENCE_TYPES_H__
 
 #include "DNA_defs.h"
 #include "DNA_listBase.h"
@@ -40,6 +40,7 @@
 struct Ipo;
 struct Scene;
 struct bSound;
+struct MovieClip;
 
 /* strlens; 256= FILE_MAXFILE, 768= FILE_MAXDIR */
 
@@ -88,9 +89,11 @@ typedef struct StripProxy {
 
 typedef struct Strip {
 	struct Strip *next, *prev;
-	int rt, len, us, done;
+	int us, done;
 	int startstill, endstill;
-	StripElem *stripdata;
+	StripElem *stripdata;  /* only used as an array in IMAGE sequences(!),
+	                        * and as a 1-element array in MOVIE sequences,
+	                        * NULL for all other strip-types */
 	char dir[768];
 	StripProxy *proxy;
 	StripCrop *crop;
@@ -130,17 +133,18 @@ typedef struct Sequence {
 	char name[64]; /* SEQ_NAME_MAXSTR - name, set by default and needs to be unique, for RNA paths */
 
 	int flag, type;	/*flags bitmap (see below) and the type of sequence*/
-	int len; /* the length of the contense of this strip - before handles are applied */
+	int len; /* the length of the contents of this strip - before handles are applied */
 	int start, startofs, endofs;
 	int startstill, endstill;
 	int machine, depth; /*machine - the strip channel, depth - the depth in the sequence when dealing with metastrips */
 	int startdisp, enddisp;	/*starting and ending points in the sequence*/
 	float sat;
 	float mul, handsize;
-					/* is sfra needed anymore? - it looks like its only used in one place */
-	int sfra;		/* starting frame according to the timeline of the scene. */
-	int anim_preseek;
-	int streamindex;   /* streamindex for movie or sound files with several streams */
+
+	short anim_preseek;
+	short streamindex;   /* streamindex for movie or sound files with several streams */
+	int multicam_source;  /* for multicam source selection */
+	int clip_flag;          /* MOVIECLIP render flags */
 
 	Strip *strip;
 
@@ -148,7 +152,9 @@ typedef struct Sequence {
 	struct Scene *scene;
 	struct Object *scene_camera; /* override scene camera */
 
-	struct anim *anim;
+	struct anim *anim;      /* for MOVIE strips */
+	struct MovieClip *clip; /* for MOVIECLIP strips */
+
 	float effect_fader;
 	float speed_fader;
 
@@ -164,8 +170,6 @@ typedef struct Sequence {
 	float volume;
 
 	float pitch, pan;	/* pitch (-0.1..10), pan -2..2 */
-	int scenenr;          /* for scene selection */
-	int multicam_source;  /* for multicam source selection */
 	float strobe;
 
 	void *effectdata;	/* Struct pointer for effect settings */
@@ -173,9 +177,12 @@ typedef struct Sequence {
 	int anim_startofs;    /* only use part of animation file */
 	int anim_endofs;      /* is subtle different to startofs / endofs */
 
+
 	int blend_mode;
 	float blend_opacity;
 
+			/* is sfra needed anymore? - it looks like its only used in one place */
+	int sfra, pad;	/* starting frame according to the timeline of the scene. */
 } Sequence;
 
 typedef struct MetaStack {
@@ -292,7 +299,7 @@ typedef struct SpeedControlVars {
 /* convenience define for all selection flags */
 #define SEQ_ALLSEL	(SELECT+SEQ_LEFTSEL+SEQ_RIGHTSEL)
 
-/* deprecated, dont use a flag anymore*/
+/* deprecated, don't use a flag anymore*/
 /*#define SEQ_ACTIVE                            1048576*/
 
 #define SEQ_COLOR_BALANCE_INVERSE_GAIN 1
@@ -321,6 +328,7 @@ typedef struct SpeedControlVars {
 #define SEQ_RAM_SOUND		4
 #define SEQ_HD_SOUND            5
 #define SEQ_SOUND		4
+#define SEQ_MOVIECLIP           6
 
 #define SEQ_EFFECT		8
 #define SEQ_CROSS		8
@@ -346,6 +354,9 @@ typedef struct SpeedControlVars {
 
 #define STRIPELEM_PREVIEW_DONE  1
 
+#define SEQ_MOVIECLIP_RENDER_UNDISTORTED (1<<0)
+#define SEQ_MOVIECLIP_RENDER_STABILIZED  (1<<1)
+
 #define SEQ_BLEND_REPLACE      0
 /* all other BLEND_MODEs are simple SEQ_EFFECT ids and therefore identical
  * to the table above. (Only those effects that handle _exactly_ two inputs,
diff --git a/source/blender/makesdna/DNA_smoke_types.h b/source/blender/makesdna/DNA_smoke_types.h
index 753f137..26b3a3e 100644
--- a/source/blender/makesdna/DNA_smoke_types.h
+++ b/source/blender/makesdna/DNA_smoke_types.h
@@ -29,8 +29,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_SMOKE_TYPES_H
-#define DNA_SMOKE_TYPES_H
+#ifndef __DNA_SMOKE_TYPES_H__
+#define __DNA_SMOKE_TYPES_H__
 
 /* flags */
 #define MOD_SMOKE_HIGHRES (1<<1) /* enable high resolution */
@@ -109,8 +109,8 @@ typedef struct SmokeDomainSettings {
 
 /* 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_INITVELOCITY (1<<2) /* passes particles speed to the smoke */
+#define MOD_SMOKE_FLOW_INIT  (1 << 3) /* is the flow object already initialized? */
 
 
 typedef struct SmokeFlowSettings {
@@ -128,11 +128,10 @@ typedef struct SmokeFlowSettings {
 	int flags; /* absolute emission etc*/
 } SmokeFlowSettings;
 
-/*
-	struct BVHTreeFromMesh *bvh;
-	float mat[4][4];
-	float mat_old[4][4];
-	*/
+
+// struct BVHTreeFromMesh *bvh;
+// float mat[4][4];
+// float mat_old[4][4];
 
 /* collision objects (filled with smoke) */
 typedef struct SmokeCollSettings {
diff --git a/source/blender/makesdna/DNA_sound_types.h b/source/blender/makesdna/DNA_sound_types.h
index 1dab9ef..6f67f1f 100644
--- a/source/blender/makesdna/DNA_sound_types.h
+++ b/source/blender/makesdna/DNA_sound_types.h
@@ -30,8 +30,8 @@
  *  \author nzc
  */
 
-#ifndef DNA_SOUND_TYPES_H
-#define DNA_SOUND_TYPES_H
+#ifndef __DNA_SOUND_TYPES_H__
+#define __DNA_SOUND_TYPES_H__
 
 #include "DNA_listBase.h"
 #include "DNA_ID.h"
@@ -75,8 +75,9 @@ typedef struct bSound {
 	int flags;
 	int pad;
 
-/**	currently	int type;
-	struct bSound *child_sound;*/
+	/* unused currently
+	int type;
+	struct bSound *child_sound; */
 
 	/**
 	 * The audaspace handle for cache.
@@ -94,17 +95,19 @@ typedef struct bSound {
 	 */
 	void *playback_handle;
 
-/**	XXX unused currently	// SOUND_TYPE_LIMITER
-	float start, end;*/
+	/* XXX unused currently	(SOUND_TYPE_LIMITER) */
+	/* float start, end; */
 } bSound;
 
-/* XXX unused currently
+/* XXX unused currently */
+#if 0
 typedef enum eSound_Type {
 	SOUND_TYPE_INVALID = -1,
 	SOUND_TYPE_FILE = 0,
 	SOUND_TYPE_BUFFER,
 	SOUND_TYPE_LIMITER
-} eSound_Type;*/
+} eSound_Type;
+#endif
 
 /* spacesound->flag */
 #define SND_DRAWFRAMES	1
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 64d858b..1938c63 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -30,8 +30,8 @@
  *  \author nzc
  */
 
-#ifndef DNA_SPACE_TYPES_H
-#define DNA_SPACE_TYPES_H
+#ifndef __DNA_SPACE_TYPES_H__
+#define __DNA_SPACE_TYPES_H__
 
 #include "DNA_defs.h"
 #include "DNA_listBase.h"
@@ -215,10 +215,10 @@ typedef struct SpaceFile {
 	ListBase *folders_next; /* holds the list of next directories (pushed from previous) to show */
 
 	/* operator that is invoking fileselect 
-	   op->exec() will be called on the 'Load' button.
-	   if operator provides op->cancel(), then this will be invoked
-	   on the cancel button.
-	*/
+	 * op->exec() will be called on the 'Load' button.
+	 * if operator provides op->cancel(), then this will be invoked
+	 * on the cancel button.
+	 */
 	struct wmOperator *op; 
 
 	struct wmTimer *smoothscroll_timer;
@@ -348,7 +348,7 @@ typedef struct Script {
 	char scriptname[1024]; /* 1024 = FILE_MAX */
 	char scriptarg[256]; /* 1024 = FILE_MAX */
 } Script;
-#define SCRIPT_SET_NULL(_script) _script->py_draw = _script->py_event = _script->py_button = _script->py_browsercallback = _script->py_globaldict = NULL; _script->flags = 0;
+#define SCRIPT_SET_NULL(_script) _script->py_draw = _script->py_event = _script->py_button = _script->py_browsercallback = _script->py_globaldict = NULL; _script->flags = 0
 
 typedef struct SpaceScript {
 	SpaceLink *next, *prev;
@@ -516,11 +516,13 @@ typedef struct SpaceClip {
 	/* current stabilization data */
 	float loc[2], scale, angle;	/* pre-composed stabilization data */
 	int pad;
-	float stabmat[4][4], unistabmat[4][4];		/* current stabilization matrix and the same matrix in unified space,
-												   defined when drawing and used for mouse position calculation */
+	float stabmat[4][4], unistabmat[4][4];  /* current stabilization matrix and the same matrix in unified space,
+	                                         * defined when drawing and used for mouse position calculation */
 
 	/* movie postprocessing */
-	int postproc_flag, pad2;
+	int postproc_flag;
+
+	int runtime_flag;			/* different runtime flags */
 } SpaceClip;
 
 /* view3d  Now in DNA_view3d_types.h */
@@ -633,7 +635,7 @@ enum FileSortTypeE {
 
 /* filesel types */
 #define FILE_UNIX			8
-#define FILE_BLENDER		8 /* dont display relative paths */
+#define FILE_BLENDER		8 /* don't display relative paths */
 #define FILE_SPECIAL		9
 
 #define FILE_LOADLIB		1
@@ -691,7 +693,7 @@ enum FileSortTypeE {
 
 /* SpaceImage->sticky
  * Note DISABLE should be 0, however would also need to re-arrange icon order,
- * also, sticky loc is the default mode so this means we dont need to 'do_versons' */
+ * also, sticky loc is the default mode so this means we don't need to 'do_versons' */
 #define SI_STICKY_LOC		0
 #define SI_STICKY_DISABLE	1
 #define SI_STICKY_VERTEX	2
@@ -703,7 +705,7 @@ enum FileSortTypeE {
 #define SI_DRAWTOOL		(1<<3)
 #define SI_NO_DRAWFACES	(1<<4)
 #define SI_DRAWSHADOW   (1<<5)
-#define SI_SELACTFACE   (1<<6)	/* deprecated */
+/* #define SI_SELACTFACE   (1<<6) */ /* deprecated */
 #define SI_DEPRECATED2	(1<<7)
 #define SI_DEPRECATED3  (1<<8)	/* stick UV selection to mesh vertex (UVs wont always be touching) */
 #define SI_COORDFLOATS  (1<<9)
@@ -864,7 +866,7 @@ enum {
 /* sseq->flag */
 #define SEQ_DRAWFRAMES   1
 #define SEQ_MARKER_TRANS 2
-#define SEQ_DRAW_COLOR_SEPERATED     4
+#define SEQ_DRAW_COLOR_SEPARATED     4
 #define SEQ_DRAW_SAFE_MARGINS        8
 #define SEQ_DRAW_GPENCIL			16
 #define SEQ_NO_DRAW_CFRANUM			32
@@ -912,6 +914,9 @@ enum {
 #define SC_VIEW_CLIP		0
 #define SC_VIEW_GRAPH		1
 
+/* SpaceClip->runtime_flag */
+#define SC_GRAPH_BOTTOM		(1<<0)
+
 /* space types, moved from DNA_screen_types.h */
 /* Do NOT change order, append on end. types are hardcoded needed */
 enum {
diff --git a/source/blender/makesdna/DNA_speaker_types.h b/source/blender/makesdna/DNA_speaker_types.h
index 2e8227f..8ad9878 100644
--- a/source/blender/makesdna/DNA_speaker_types.h
+++ b/source/blender/makesdna/DNA_speaker_types.h
@@ -24,8 +24,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_SPEAKER_TYPES_H
-#define DNA_SPEAKER_TYPES_H
+#ifndef __DNA_SPEAKER_TYPES_H__
+#define __DNA_SPEAKER_TYPES_H__
 
 #include "DNA_ID.h"
 
@@ -64,5 +64,5 @@ typedef struct Speaker {
 #define SPK_MUTED       (1<<1)
 #define SPK_RELATIVE    (1<<2)
 
-#endif /* DNA_SPEAKER_TYPES_H */
+#endif /* __DNA_SPEAKER_TYPES_H__ */
 
diff --git a/source/blender/makesdna/DNA_text_types.h b/source/blender/makesdna/DNA_text_types.h
index 67f3c52..cf26dae 100644
--- a/source/blender/makesdna/DNA_text_types.h
+++ b/source/blender/makesdna/DNA_text_types.h
@@ -30,8 +30,8 @@
  *  \author nzc
  */
 
-#ifndef DNA_TEXT_TYPES_H
-#define DNA_TEXT_TYPES_H
+#ifndef __DNA_TEXT_TYPES_H__
+#define __DNA_TEXT_TYPES_H__
 
 #include "DNA_listBase.h"
 #include "DNA_ID.h"
diff --git a/source/blender/makesdna/DNA_texture_types.h b/source/blender/makesdna/DNA_texture_types.h
index de844fd..c026c20 100644
--- a/source/blender/makesdna/DNA_texture_types.h
+++ b/source/blender/makesdna/DNA_texture_types.h
@@ -31,8 +31,8 @@
  *  \author nzc
  */
 
-#ifndef DNA_TEXTURE_TYPES_H
-#define DNA_TEXTURE_TYPES_H
+#ifndef __DNA_TEXTURE_TYPES_H__
+#define __DNA_TEXTURE_TYPES_H__
 
 #include "DNA_defs.h"
 #include "DNA_ID.h"
@@ -97,9 +97,9 @@ typedef struct MTex {
 #ifndef DNA_USHORT_FIX
 #define DNA_USHORT_FIX
 /**
- * @deprecated This typedef serves to avoid badly typed functions when
- * @deprecated compiling while delivering a proper dna.c. Do not use
- * @deprecated it in any case.
+ * \deprecated This typedef serves to avoid badly typed functions when
+ * \deprecated compiling while delivering a proper dna.c. Do not use
+ * \deprecated it in any case.
  */
 typedef unsigned short dna_ushort_fix;
 #endif
@@ -232,7 +232,7 @@ typedef struct Tex {
 	/* newnoise: distorted noise amount, musgrave & voronoi ouput scale */
 	float dist_amount, ns_outscale;
 
-	/* newnoise: voronoi nearest neighbour weights, minkovsky exponent, distance metric & color type */
+	/* newnoise: voronoi nearest neighbor weights, minkovsky exponent, distance metric & color type */
 	float vn_w1;
 	float vn_w2;
 	float vn_w3;
diff --git a/source/blender/makesdna/DNA_tracking_types.h b/source/blender/makesdna/DNA_tracking_types.h
index 1b41131..9c0f630 100644
--- a/source/blender/makesdna/DNA_tracking_types.h
+++ b/source/blender/makesdna/DNA_tracking_types.h
@@ -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.
  *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * The Original Code is Copyright (C) 2011 Blender Foundation.
  * All rights reserved.
  *
  * The Original Code is: all of this file.
@@ -32,8 +32,8 @@
  *  \author Sergey Sharybin
  */
 
-#ifndef DNA_TRACKING_TYPES_H
-#define DNA_TRACKING_TYPES_H
+#ifndef __DNA_TRACKING_TYPES_H__
+#define __DNA_TRACKING_TYPES_H__
 
 #include "DNA_listBase.h"
 
@@ -159,8 +159,10 @@ typedef struct MovieTrackingStabilization {
 
 	float locinf, scaleinf, rotinf;	/* influence on location, scale and rotation */
 
+	int filter;		/* filter used for pixel interpolation */
+
 	/* some pre-computing run-time variables */
-	int ok, pad;				/* are precomputed values and scaled buf relevant? */
+	int ok;						/* are precomputed values and scaled buf relevant? */
 	float scale;				/* autoscale factor */
 
 	struct ImBuf *scaleibuf;	/* currently scaled ibuf */
@@ -216,6 +218,7 @@ enum {
 #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)
 
 /* MovieTrackingTrack->flag */
 #define TRACK_HAS_BUNDLE	(1<<1)
@@ -258,6 +261,11 @@ enum {
 #define TRACKING_AUTOSCALE			(1<<1)
 #define TRACKING_STABILIZE_ROTATION	(1<<2)
 
+/* MovieTrackingStrabilization->filter */
+#define TRACKING_FILTER_NEAREAST	0
+#define TRACKING_FILTER_BILINEAR	1
+#define TRACKING_FILTER_BICUBIC		2
+
 /* MovieTrackingReconstruction->flag */
 #define TRACKING_RECONSTRUCTED	(1<<0)
 
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 405e1e3..40c4a7f 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -31,8 +31,8 @@
  *  \author nzc
  */
 
-#ifndef DNA_USERDEF_TYPES_H
-#define DNA_USERDEF_TYPES_H
+#ifndef __DNA_USERDEF_TYPES_H__
+#define __DNA_USERDEF_TYPES_H__
 
 #include "DNA_listBase.h"
 #include "DNA_texture_types.h" /* ColorBand */
@@ -151,7 +151,7 @@ typedef struct ThemeUI {
 	uiWidgetColors wcol_regular, wcol_tool, wcol_text;
 	uiWidgetColors wcol_radio, wcol_option, wcol_toggle;
 	uiWidgetColors wcol_num, wcol_numslider;
-	uiWidgetColors wcol_menu, wcol_pulldown, wcol_menu_back, wcol_menu_item;
+	uiWidgetColors wcol_menu, wcol_pulldown, wcol_menu_back, wcol_menu_item, wcol_tooltip;
 	uiWidgetColors wcol_box, wcol_scroll, wcol_progress, wcol_list_item;
 	
 	uiWidgetStateColors wcol_state;
@@ -205,7 +205,7 @@ typedef struct ThemeSpace {
 	char grid[4]; 
 	
 	char wire[4], select[4];
-	char lamp[4], speaker[4], pad2[4];
+	char lamp[4], speaker[4], empty[4],camera[4], pad[8];
 	char active[4], group[4], group_active[4], transform[4];
 	char vertex[4], vertex_select[4];
 	char edge[4], edge_select[4];
@@ -236,7 +236,7 @@ typedef struct ThemeSpace {
 	char syntaxl[4], syntaxn[4], syntaxb[4]; // syntax for textwindow and nodes
 	char syntaxv[4], syntaxc[4];
 	
-	char movie[4], image[4], scene[4], audio[4];		// for sequence editor
+	char movie[4], movieclip[4], image[4], scene[4], audio[4];		// for sequence editor
 	char effect[4], plugin[4], transition[4], meta[4];
 	char editmesh_active[4]; 
 
@@ -422,6 +422,9 @@ typedef struct UserDef {
 
 	int compute_device_type;
 	int compute_device_id;
+	
+	float fcu_inactive_alpha;	/* opacity of inactive F-Curves in F-Curve Editor */
+	float pad;
 } UserDef;
 
 extern UserDef U; /* from blenkernel blender.c */
@@ -510,6 +513,7 @@ extern UserDef U; /* from blenkernel blender.c */
 #define USER_SPLASH_DISABLE		(1 << 27)
 #define USER_HIDE_RECENT		(1 << 28)
 #define USER_SHOW_THUMBNAILS	(1 << 29)
+#define USER_QUIT_PROMPT		(1 << 30)
 
 /* Auto-Keying mode */
 	/* AUTOKEY_ON is a bitflag */
@@ -617,13 +621,13 @@ extern UserDef U; /* from blenkernel blender.c */
 #define NDOF_SHOULD_ZOOM    (1 << 4)
 #define NDOF_SHOULD_ROTATE  (1 << 5)
 /* orbit navigation modes
- * only two options, so it's sort of a hyrbrid bool/enum
+ * only two options, so it's sort of a hybrid bool/enum
  * if ((U.ndof_flag & NDOF_ORBIT_MODE) == NDOF_OM_OBJECT)... */
-/*
-#define NDOF_ORBIT_MODE     (1 << 6)
-#define NDOF_OM_TARGETCAMERA 0
-#define NDOF_OM_OBJECT      NDOF_ORBIT_MODE
-*/
+
+// #define NDOF_ORBIT_MODE     (1 << 6)
+// #define NDOF_OM_TARGETCAMERA 0
+// #define NDOF_OM_OBJECT      NDOF_ORBIT_MODE
+
 /* actually... users probably don't care about what the mode
  * is called, just that it feels right */
 /* zoom is up/down if this flag is set (otherwise forward/backward) */
diff --git a/source/blender/makesdna/DNA_vec_types.h b/source/blender/makesdna/DNA_vec_types.h
index 10135ba..1420ca4 100644
--- a/source/blender/makesdna/DNA_vec_types.h
+++ b/source/blender/makesdna/DNA_vec_types.h
@@ -32,8 +32,8 @@
  *  \author nzc
  */
 
-#ifndef DNA_VEC_TYPES_H
-#define DNA_VEC_TYPES_H
+#ifndef __DNA_VEC_TYPES_H__
+#define __DNA_VEC_TYPES_H__
 
 /* types */
 
@@ -60,11 +60,11 @@ typedef struct vec2d {
 typedef struct vec3i {
 	int x, y, z;
 } vec3i;
-
+*/
 typedef struct vec3f {
 	float x, y, z;
 } vec3f;
-
+/*
 typedef struct vec3d {
 	double x, y, z;
 } vec3d;
diff --git a/source/blender/makesdna/DNA_vfont_types.h b/source/blender/makesdna/DNA_vfont_types.h
index d6168af..299a654 100644
--- a/source/blender/makesdna/DNA_vfont_types.h
+++ b/source/blender/makesdna/DNA_vfont_types.h
@@ -31,8 +31,8 @@
  *  \author nzc
  */
 
-#ifndef DNA_VFONT_TYPES_H
-#define DNA_VFONT_TYPES_H
+#ifndef __DNA_VFONT_TYPES_H__
+#define __DNA_VFONT_TYPES_H__
 
 #include "DNA_ID.h"
 
diff --git a/source/blender/makesdna/DNA_view2d_types.h b/source/blender/makesdna/DNA_view2d_types.h
index 0581cad..9c4abfb 100644
--- a/source/blender/makesdna/DNA_view2d_types.h
+++ b/source/blender/makesdna/DNA_view2d_types.h
@@ -29,8 +29,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_VIEW2D_TYPES_H
-#define DNA_VIEW2D_TYPES_H
+#ifndef __DNA_VIEW2D_TYPES_H__
+#define __DNA_VIEW2D_TYPES_H__
 
 #include "DNA_vec_types.h"
 
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index 58c3f09..fb4d420 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -29,8 +29,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_VIEW3D_TYPES_H
-#define DNA_VIEW3D_TYPES_H
+#ifndef __DNA_VIEW3D_TYPES_H__
+#define __DNA_VIEW3D_TYPES_H__
 
 struct ViewDepths;
 struct Object;
@@ -94,42 +94,45 @@ typedef struct RegionView3D {
 	float viewmatob[4][4];
 	float persmatob[4][4];
 
-	/* transform widget matrix */
-	float twmat[4][4];
 
-	float viewquat[4];			/* view rotation, must be kept normalized */
-	float dist;					/* distance from 'ofs' along -viewinv[2] vector, where result is negative as is 'ofs' */
-	float zfac;					/* initgrabz() result */
-	float camdx, camdy;			/* camera view offsets, 1.0 = viewplane moves entire width/height */
-	float pixsize;				/* runtime only */
-	float ofs[3];				/* view center & orbit pivot, negative of worldspace location,
-								 * also matches -viewinv[3][0:3] in ortho mode.*/
-	short camzoom;				/* viewport zoom on the camera frame, see BKE_screen_view3d_zoom_to_fac */
-	short twdrawflag;
-	char is_persp;				/* check if persp/ortho view, since 'persp' cant be used for this since
-								 * it can have cameras assigned as well. (only set in setwinmatrixview3d) */
-	char pad[3];
-	
-	short rflag, viewlock;
-	short persp;
-	short view;
-	
 	/* user defined clipping planes */
 	float clip[6][4];
 	float clip_local[6][4]; /* clip in object space, means we can test for clipping in editmode without first going into worldspace */
-	struct BoundBox *clipbb;	
-	
+	struct BoundBox *clipbb;
+
 	struct bGPdata *gpd;		/* Grease-Pencil Data (annotation layers) */
-	
+
 	struct RegionView3D *localvd; /* allocated backup of its self while in localview */
 	struct RenderInfo *ri;
 	struct RenderEngine *render_engine;
 	struct ViewDepths *depths;
-	
+
 	/* animated smooth view */
 	struct SmoothViewStore *sms;
 	struct wmTimer *smooth_timer;
+
+
+	/* transform widget matrix */
+	float twmat[4][4];
+
+	float viewquat[4];			/* view rotation, must be kept normalized */
+	float dist;					/* distance from 'ofs' along -viewinv[2] vector, where result is negative as is 'ofs' */
+	float zfac;					/* initgrabz() result */
+	float camdx, camdy;			/* camera view offsets, 1.0 = viewplane moves entire width/height */
+	float pixsize;				/* runtime only */
+	float ofs[3];				/* view center & orbit pivot, negative of worldspace location,
+								 * also matches -viewinv[3][0:3] in ortho mode.*/
+	float camzoom;				/* viewport zoom on the camera frame, see BKE_screen_view3d_zoom_to_fac */
+	char is_persp;				/* check if persp/ortho view, since 'persp' cant be used for this since
+								 * it can have cameras assigned as well. (only set in setwinmatrixview3d) */
+	char persp;
+	char view;
+	char viewlock;
+
+	short twdrawflag;
+	short rflag;
 	
+
 	/* last view */
 	float lviewquat[4];
 	short lpersp, lview; /* lpersp can never be set to 'RV3D_CAMOB' */
@@ -137,11 +140,10 @@ typedef struct RegionView3D {
 	
 	float twangle[3];
 
+
 	/* active rotation from NDOF or elsewhere */
 	float rot_angle;
 	float rot_axis[3];
-	
-	char pad2[4];
 
 } RegionView3D;
 
@@ -312,6 +314,7 @@ typedef struct View3D {
 #define V3D_BGPIC_EXPANDED		2
 #define V3D_BGPIC_CAMERACLIP	4
 #define V3D_BGPIC_DISABLED		8
+#define V3D_BGPIC_FOREGROUND		16
 
 /* BGPic->source */
 /* may want to use 1 for select ?*/
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index 156d2eb..5a49e45 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -28,8 +28,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_WINDOWMANAGER_TYPES_H
-#define DNA_WINDOWMANAGER_TYPES_H
+#ifndef __DNA_WINDOWMANAGER_TYPES_H__
+#define __DNA_WINDOWMANAGER_TYPES_H__
 
 #include "DNA_listBase.h"
 #include "DNA_vec_types.h"
@@ -85,7 +85,7 @@ enum ReportListFlags {
 	RPT_PRINT = 1,
 	RPT_STORE = 2,
 	RPT_FREE = 4,
-	RPT_OP_HOLD = 8 /* dont move them into the operator global list (caller will use) */
+	RPT_OP_HOLD = 8 /* don't move them into the operator global list (caller will use) */
 };
 #
 #
@@ -98,7 +98,7 @@ typedef struct Report {
 	const char *message;
 } Report;
 
-/* saved in the wm, dont remove */
+/* saved in the wm, don't remove */
 typedef struct ReportList {
 	ListBase list;
 	int printlevel; /* ReportType */
@@ -159,7 +159,7 @@ typedef struct wmWindowManager {
 typedef struct wmWindow {
 	struct wmWindow *next, *prev;
 	
-	void *ghostwin;		/* dont want to include ghost.h stuff */
+	void *ghostwin;		/* don't want to include ghost.h stuff */
 	
 	int winid;		/* winid also in screens, is for retrieving this window after read */
 
@@ -197,7 +197,7 @@ typedef struct wmWindow {
 	ListBase gesture;		/* gesture stuff */
 } wmWindow;
 
-/* should be somthing like DNA_EXCLUDE 
+/* should be something like DNA_EXCLUDE 
  * but the preprocessor first removes all comments, spaces etc */
 
 #
@@ -222,6 +222,7 @@ typedef struct wmKeyMapItem {
 	IDProperty *properties;			/* operator properties, assigned to ptr->data and can be written to a file */
 	
 	/* modal */
+	char propvalue_str[64];			/* runtime temporary storage for loading */
 	short propvalue;				/* if used, the item is from modal map */
 
 	/* event */
@@ -338,4 +339,4 @@ typedef struct wmOperator {
 /* wmOperator flag */
 #define OP_GRAB_POINTER			1
 
-#endif /* DNA_WINDOWMANAGER_TYPES_H */
+#endif /* __DNA_WINDOWMANAGER_TYPES_H__ */
diff --git a/source/blender/makesdna/DNA_world_types.h b/source/blender/makesdna/DNA_world_types.h
index a04ea89..b3c1040 100644
--- a/source/blender/makesdna/DNA_world_types.h
+++ b/source/blender/makesdna/DNA_world_types.h
@@ -29,8 +29,8 @@
  *  \ingroup DNA
  */
 
-#ifndef DNA_WORLD_TYPES_H
-#define DNA_WORLD_TYPES_H
+#ifndef __DNA_WORLD_TYPES_H__
+#define __DNA_WORLD_TYPES_H__
 
 #include "DNA_defs.h"
 #include "DNA_ID.h"
@@ -66,7 +66,7 @@ typedef struct World {
 	/**
 	 * 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 isnt useful either.
+	 * file, but allocating 8 bytes for temp mem isn't useful either.
 	 */
 	float exposure, exp, range;	
 	float linfac, logfac;
diff --git a/source/blender/makesdna/intern/SConscript b/source/blender/makesdna/intern/SConscript
index 8185676..c1e6eb5 100644
--- a/source/blender/makesdna/intern/SConscript
+++ b/source/blender/makesdna/intern/SConscript
@@ -18,7 +18,7 @@ dna = env.Clone()
 makesdna_tool.Append(CCFLAGS = '-DBASE_HEADER="\\"source/blender/makesdna/\\"" ')
 
 makesdna_tool.Append (CPPPATH = ['#/intern/guardedalloc',
-                                 '../../makesdna', '../../blenloader'])
+                                 '../../makesdna', '../../blenloader', '../../bmesh'])
 
 if env['OURPLATFORM'] == 'linuxcross':
     USE_WINE = True # when cross compiling on linux 64bit this is useful
@@ -57,7 +57,7 @@ dna.Depends ('dna.c', makesdna)
 dna.Depends ('dna.c', header_files)
 
 if env['OURPLATFORM'] != 'linuxcross':
-    if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'):
+    if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'win64-mingw'):
         dna.Command ('dna.c', '', "\"" + root_build_dir+os.sep+"makesdna\" $TARGET")
     else:
         dna.Command ('dna.c', '', "\"" + root_build_dir+os.sep+"makesdna\" $TARGET")
diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c
index 5b115a4..ef7a274 100644
--- a/source/blender/makesdna/intern/dna_genfile.c
+++ b/source/blender/makesdna/intern/dna_genfile.c
@@ -42,6 +42,7 @@
 #include "MEM_guardedalloc.h" // for MEM_freeN MEM_mallocN MEM_callocN
 
 #ifdef WITH_DNA_GHASH
+#  include "BLI_utildefines.h"
 #  include "BLI_ghash.h"
 #endif
 
@@ -50,90 +51,90 @@
 
 
 /* gcc 4.1 on mingw was complaining that __int64 was already defined
-actually is saw the line below as typedef long long long long... 
-Anyhow, since its already defined, its safe to do an ifndef here- Campbell */
+ * actually is saw the line below as typedef long long long long...
+ * Anyhow, since its already defined, its safe to do an ifndef here- Campbell */
 #ifdef FREE_WINDOWS
-#ifndef __int64
+#  ifndef __int64
 typedef long long __int64;
-#endif
+#  endif
 #endif
 
 /*
  * - please note: no builtin security to detect input of double structs
  * - 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
-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.
-
-Create a structDNA: only needed when one of the input include (.h) files change.
-File Syntax:
-	SDNA (4 bytes) (magic number)
-	NAME (4 bytes)
-	<nr> (4 bytes) amount of names (int)
-	<string> 
-	<string>
-	...
-	...
-	TYPE (4 bytes)
-	<nr> amount of types (int)
-	<string>
-	<string>
-	...
-	...
-	TLEN (4 bytes)
-	<len> (short) the lengths of types
-	<len>
-	...
-	...
-	STRC (4 bytes)
-	<nr> amount of structs (int)
-	<typenr><nr_of_elems> <typenr><namenr> <typenr><namenr> ...
-	
-!!Remember to read/write integer and short aligned!!
-
- While writing a file, the names of a struct is indicated with a type number,
- to be found with: type= findstruct_nr(SDNA *, char *)
- The value of 'type' corresponds with the the index within the structs array
-
- For the moment: the complete DNA file is included in a .blend file. For
- the future we can think of smarter methods, like only included the used
- structs. Only needed to keep a file short though...
-
-ALLOWED AND TESTED CHANGES IN STRUCTS:
- - type change (a char to float will be divided by 255)
- - location within a struct (everthing can be randomly mixed up)
- - struct within struct (within struct etc), this is recursive
- - adding new elements, will be default initialized zero
- - remving elements
- - change of array sizes
- - change of a pointer type: when the name doesn't change the contents is copied
-
-NOT YET:
- - array (vec[3]) to float struct (vec3f)
-
-DONE:
- - endian compatibility
- - pointer conversion (32-64 bits)
-
-IMPORTANT:
- - do not use #defines in structs for array lengths, this cannot be read by the dna functions
- - do not use uint, but unsigned int instead, ushort and ulong are allowed
- - only use a long in Blender if you want this to be the size of a pointer. so it is
-   32 bits or 64 bits, dependant at the cpu architecture
- - chars are always unsigned
- - aligment of variables has to be done in such a way, that any system does
-   not create 'padding' (gaps) in structures. So make sure that:
-   - short: 2 aligned
-   - int: 4 aligned
-   - float: 4 aligned
-   - double: 8 aligned
-   - long: 8 aligned
-   - struct: 8 aligned
- - the sdna functions have several error prints builtin, always check blender running from a console.
- 
-*/
+ *
+ * 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
+ * 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.
+ *
+ * Create a structDNA: only needed when one of the input include (.h) files change.
+ * File Syntax:
+ *     SDNA (4 bytes) (magic number)
+ *     NAME (4 bytes)
+ *     <nr> (4 bytes) amount of names (int)
+ *     <string>
+ *     <string>
+ *     ...
+ *     ...
+ *     TYPE (4 bytes)
+ *     <nr> amount of types (int)
+ *     <string>
+ *     <string>
+ *     ...
+ *     ...
+ *     TLEN (4 bytes)
+ *     <len> (short) the lengths of types
+ *     <len>
+ *     ...
+ *     ...
+ *     STRC (4 bytes)
+ *     <nr> amount of structs (int)
+ *     <typenr><nr_of_elems> <typenr><namenr> <typenr><namenr> ...
+ *
+ * !!Remember to read/write integer and short aligned!!
+ *
+ *  While writing a file, the names of a struct is indicated with a type number,
+ *  to be found with: type= findstruct_nr(SDNA *, char *)
+ *  The value of 'type' corresponds with the the index within the structs array
+ *
+ *  For the moment: the complete DNA file is included in a .blend file. For
+ *  the future we can think of smarter methods, like only included the used
+ *  structs. Only needed to keep a file short though...
+ *
+ * ALLOWED AND TESTED CHANGES IN STRUCTS:
+ *  - type change (a char to float will be divided by 255)
+ *  - location within a struct (everthing can be randomly mixed up)
+ *  - struct within struct (within struct etc), this is recursive
+ *  - adding new elements, will be default initialized zero
+ *  - remving elements
+ *  - change of array sizes
+ *  - change of a pointer type: when the name doesn't change the contents is copied
+ *
+ * NOT YET:
+ *  - array (vec[3]) to float struct (vec3f)
+ *
+ * DONE:
+ *  - endian compatibility
+ *  - pointer conversion (32-64 bits)
+ *
+ * IMPORTANT:
+ *  - do not use #defines in structs for array lengths, this cannot be read by the dna functions
+ *  - do not use uint, but unsigned int instead, ushort and ulong are allowed
+ *  - only use a long in Blender if you want this to be the size of a pointer. so it is
+ *    32 bits or 64 bits, dependent at the cpu architecture
+ *  - chars are always unsigned
+ *  - aligment of variables has to be done in such a way, that any system does
+ *    not create 'padding' (gaps) in structures. So make sure that:
+ *    - short: 2 aligned
+ *    - int: 4 aligned
+ *    - float: 4 aligned
+ *    - double: 8 aligned
+ *    - long: 8 aligned
+ *    - struct: 8 aligned
+ *  - the sdna functions have several error prints builtin, always check blender running from a console.
+ *
+ */
 
 /* local */
 static int le_int(int temp);
@@ -177,11 +178,11 @@ int DNA_elem_array_size(const char *astr, int len)
 
 	memcpy(str, astr, len+1);
 
-	for(a=0; a<len; a++) {
-		if( str[a]== '[' ) {
+	for (a=0; a<len; a++) {
+		if ( str[a]== '[' ) {
 			cp= &(str[a+1]);
 		}
-		else if( str[a]==']' && cp) {
+		else if ( str[a]==']' && cp) {
 			str[a]= 0;
 			mul*= atoi(cp);
 		}
@@ -225,17 +226,17 @@ static int elementsize(SDNA *sdna, short type, short name)
 	
 	namelen= strlen(cp);
 	/* is it a pointer or function pointer? */
-	if(ispointer(cp)) {
+	if (ispointer(cp)) {
 		/* has the naam an extra length? (array) */
 		mul= 1;
-		if( cp[namelen-1]==']') mul= DNA_elem_array_size(cp, namelen);
+		if ( cp[namelen-1]==']') mul= DNA_elem_array_size(cp, namelen);
 		
 		len= sdna->pointerlen*mul;
 	}
-	else if( sdna->typelens[type] ) {
+	else if ( sdna->typelens[type] ) {
 		/* has the naam an extra length? (array) */
 		mul= 1;
-		if( cp[namelen-1]==']') mul= DNA_elem_array_size(cp, namelen);
+		if ( cp[namelen-1]==']') mul= DNA_elem_array_size(cp, namelen);
 		
 		len= mul*sdna->typelens[type];
 		
@@ -257,7 +258,7 @@ static void printstruct(SDNA *sdna, short strnr)
 	nr= sp[1];
 	sp+= 2;
 	
-	for(b=0; b< nr; b++, sp+= 2) {
+	for (b=0; b< nr; b++, sp+= 2) {
 		printf("   %s %s\n", sdna->types[sp[0]], sdna->names[sp[1]]);
 	}
 }
@@ -269,11 +270,11 @@ static short *findstruct_name(SDNA *sdna, const char *str)
 	short *sp= NULL;
 
 
-	for(a=0; a<sdna->nr_structs; a++) {
+	for (a=0; a<sdna->nr_structs; a++) {
 
 		sp= sdna->structs[a];
 		
-		if(strcmp( sdna->types[ sp[0] ], str )==0) return sp;
+		if (strcmp( sdna->types[ sp[0] ], str )==0) return sp;
 	}
 	
 	return NULL;
@@ -283,9 +284,9 @@ int DNA_struct_find_nr(SDNA *sdna, const char *str)
 {
 	short *sp= NULL;
 
-	if(sdna->lastfind<sdna->nr_structs) {
+	if (sdna->lastfind<sdna->nr_structs) {
 		sp= sdna->structs[sdna->lastfind];
-		if(strcmp( sdna->types[ sp[0] ], str )==0) return sdna->lastfind;
+		if (strcmp( sdna->types[ sp[0] ], str )==0) return sdna->lastfind;
 	}
 
 #ifdef WITH_DNA_GHASH
@@ -294,11 +295,11 @@ int DNA_struct_find_nr(SDNA *sdna, const char *str)
 	{
 		int a;
 
-		for(a=0; a<sdna->nr_structs; a++) {
+		for (a=0; a<sdna->nr_structs; a++) {
 
 			sp= sdna->structs[a];
 
-			if(strcmp( sdna->types[ sp[0] ], str )==0) {
+			if (strcmp( sdna->types[ sp[0] ], str )==0) {
 				sdna->lastfind= a;
 				return a;
 			}
@@ -324,16 +325,16 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
 	data= (int *)sdna->data;
 
 	strcpy(str, "SDNA");
-	if( *data == *verg ) {
+	if ( *data == *verg ) {
 	
 		data++;
 		
 		/* load names array */
 		strcpy(str, "NAME");
-		if( *data == *verg ) {
+		if ( *data == *verg ) {
 			data++;
 			
-			if(do_endian_swap) sdna->nr_names= le_int(*data);
+			if (do_endian_swap) sdna->nr_names= le_int(*data);
 			else sdna->nr_names= *data;
 			
 			data++;
@@ -346,20 +347,20 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
 		
 		nr= 0;
 		cp= (char *)data;
-		while(nr<sdna->nr_names) {
+		while (nr<sdna->nr_names) {
 			sdna->names[nr]= cp;
 
 			/* "float gravity [3]" was parsed wrong giving both "gravity" and
-			   "[3]"  members. we rename "[3]", and later set the type of
-			   "gravity" to "void" so the offsets work out correct */
-			if(*cp == '[' && strcmp(cp, "[3]")==0) {
-				if(nr && strcmp(sdna->names[nr-1], "Cvi") == 0) {
+			 * "[3]"  members. we rename "[3]", and later set the type of
+			 * "gravity" to "void" so the offsets work out correct */
+			if (*cp == '[' && strcmp(cp, "[3]")==0) {
+				if (nr && strcmp(sdna->names[nr-1], "Cvi") == 0) {
 					sdna->names[nr]= "gravity[3]";
 					gravity_fix= nr;
 				}
 			}
 
-			while( *cp) cp++;
+			while ( *cp) cp++;
 			cp++;
 			nr++;
 		}
@@ -370,10 +371,10 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
 		/* load type names array */
 		data= (int *)cp;
 		strcpy(str, "TYPE");
-		if( *data == *verg ) {
+		if ( *data == *verg ) {
 			data++;
 			
-			if(do_endian_swap) sdna->nr_types= le_int(*data);
+			if (do_endian_swap) sdna->nr_types= le_int(*data);
 			else sdna->nr_types= *data;
 			
 			data++;
@@ -386,18 +387,18 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
 		
 		nr= 0;
 		cp= (char *)data;
-		while(nr<sdna->nr_types) {
+		while (nr<sdna->nr_types) {
 			sdna->types[nr]= cp;
 			
-			/* this is a patch, to change struct names without a confict with SDNA */
+			/* this is a patch, to change struct names without a conflict with SDNA */
 			/* be careful to use it, in this case for a system-struct (opengl/X) */
 			
-			if( *cp == 'b') {
+			if ( *cp == 'b') {
 				/* struct Screen was already used by X, 'bScreen' replaces the old IrisGL 'Screen' struct */
-				if( strcmp("bScreen", cp)==0 ) sdna->types[nr]= cp+1;
+				if ( strcmp("bScreen", cp)==0 ) sdna->types[nr]= cp+1;
 			}
 			
-			while( *cp) cp++;
+			while ( *cp) cp++;
 			cp++;
 			nr++;
 		}
@@ -408,16 +409,16 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
 		/* load typelen array */
 		data= (int *)cp;
 		strcpy(str, "TLEN");
-		if( *data == *verg ) {
+		if ( *data == *verg ) {
 			data++;
 			sp= (short *)data;
 			sdna->typelens= sp;
 			
-			if(do_endian_swap) {
+			if (do_endian_swap) {
 				short a, *spo= sp;
 				
 				a= sdna->nr_types;
-				while(a--) {
+				while (a--) {
 					spo[0]= le_short(spo[0]);
 					spo++;
 				}
@@ -429,15 +430,15 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
 			printf("TLEN error in SDNA file\n");
 			return;
 		}
-		if(sdna->nr_types & 1) sp++;	/* prevent BUS error */
+		if (sdna->nr_types & 1) sp++;	/* prevent BUS error */
 
 		/* load struct array */
 		data= (int *)sp;
 		strcpy(str, "STRC");
-		if( *data == *verg ) {
+		if ( *data == *verg ) {
 			data++;
 			
-			if(do_endian_swap) sdna->nr_structs= le_int(*data);
+			if (do_endian_swap) sdna->nr_structs= le_int(*data);
 			else sdna->nr_structs= *data;
 			
 			data++;
@@ -450,10 +451,10 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
 		
 		nr= 0;
 		sp= (short *)data;
-		while(nr<sdna->nr_structs) {
+		while (nr<sdna->nr_structs) {
 			sdna->structs[nr]= sp;
 			
-			if(do_endian_swap) {
+			if (do_endian_swap) {
 				short a;
 				
 				sp[0]= le_short(sp[0]);
@@ -461,7 +462,7 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
 				
 				a= sp[1];
 				sp+= 2;
-				while(a--) {
+				while (a--) {
 					sp[0]= le_short(sp[0]);
 					sp[1]= le_short(sp[1]);
 					sp+= 2;
@@ -480,17 +481,17 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
 		
 		sdna->pointerlen= sdna->typelens[ sp[0] ]/2;
 
-		if(sp[1]!=2 || (sdna->pointerlen!=4 && sdna->pointerlen!=8)) {
+		if (sp[1]!=2 || (sdna->pointerlen!=4 && sdna->pointerlen!=8)) {
 			printf("ListBase struct error! Needs it to calculate pointerize.\n");
 			exit(0);
 			/* well, at least sizeof(ListBase) is error proof! (ton) */
 		}
 		
 		/* second part of gravity problem, setting "gravity" type to void */
-		if(gravity_fix > -1) {
-			for(nr=0; nr<sdna->nr_structs; nr++) {
+		if (gravity_fix > -1) {
+			for (nr=0; nr<sdna->nr_structs; nr++) {
 				sp= sdna->structs[nr];
-				if(strcmp(sdna->types[sp[0]], "ClothSimSettings") == 0)
+				if (strcmp(sdna->types[sp[0]], "ClothSimSettings") == 0)
 					sp[10]= SDNA_TYPE_VOID;
 			}
 		}
@@ -499,7 +500,7 @@ static void init_structDNA(SDNA *sdna, int do_endian_swap)
 		/* create a ghash lookup to speed up */
 		sdna->structs_map= BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "init_structDNA gh");
 
-		for(nr = 0; nr < sdna->nr_structs; nr++) {
+		for (nr = 0; nr < sdna->nr_structs; nr++) {
 			sp= sdna->structs[nr];
 			BLI_ghash_insert(sdna->structs_map, (void *)sdna->types[sp[0]], (void *)(nr + 1));
 		}
@@ -536,15 +537,15 @@ static void recurs_test_compflags(SDNA *sdna, char *compflags, int structnr)
 	sp= sdna->structs[structnr];
 	typenr= sp[0];
 	
-	for(a=0; a<sdna->nr_structs; a++) {
-		if(a!=structnr && compflags[a]==1) {
+	for (a=0; a<sdna->nr_structs; a++) {
+		if (a!=structnr && compflags[a]==1) {
 			sp= sdna->structs[a];
 			elems= sp[1];
 			sp+= 2;
-			for(b=0; b<elems; b++, sp+=2) {
-				if(sp[0]==typenr) {
+			for (b=0; b<elems; b++, sp+=2) {
+				if (sp[0]==typenr) {
 					cp= sdna->names[ sp[1] ];
-					if(!ispointer(cp)) {
+					if (!ispointer(cp)) {
 						compflags[a]= 2;
 						recurs_test_compflags(sdna, compflags, a);
 					}
@@ -577,7 +578,7 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna)
 	const char *str1, *str2;
 	char *compflags;
 	
-	if(sdna->nr_structs==0) {
+	if (sdna->nr_structs==0) {
 		printf("error: file without SDNA\n");
 		return NULL;
 	}
@@ -588,42 +589,42 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna)
 	 * the structs in 'newsdna'
 	 */
 	
-	for(a=0; a<sdna->nr_structs; a++) {
+	for (a=0; a<sdna->nr_structs; a++) {
 		spold= sdna->structs[a];
 		
 		/* search for type in cur */
 		spcur= findstruct_name(newsdna, sdna->types[spold[0]]);
 		
-		if(spcur) {
+		if (spcur) {
 			compflags[a]= 2;
 			
 			/* compare length and amount of elems */
-			if( spcur[1] == spold[1]) {
-				if( newsdna->typelens[spcur[0]] == sdna->typelens[spold[0]] ) {
+			if ( spcur[1] == spold[1]) {
+				if ( newsdna->typelens[spcur[0]] == sdna->typelens[spold[0]] ) {
 
 					/* same length, same amount of elems, now per type and name */
 					b= spold[1];
 					spold+= 2;
 					spcur+= 2;
-					while(b > 0) {
+					while (b > 0) {
 						str1= newsdna->types[spcur[0]];
 						str2= sdna->types[spold[0]];
-						if(strcmp(str1, str2)!=0) break;
+						if (strcmp(str1, str2)!=0) break;
 
 						str1= newsdna->names[spcur[1]];
 						str2= sdna->names[spold[1]];
-						if(strcmp(str1, str2)!=0) break;
+						if (strcmp(str1, str2)!=0) break;
 
 						/* same type and same name, now pointersize */
-						if(ispointer(str1)) {
-							if(sdna->pointerlen!=newsdna->pointerlen) break;
+						if (ispointer(str1)) {
+							if (sdna->pointerlen!=newsdna->pointerlen) break;
 						}
 
 						b--;
 						spold+= 2;
 						spcur+= 2;
 					}
-					if(b==0) compflags[a]= 1;
+					if (b==0) compflags[a]= 1;
 
 				}
 			}
@@ -639,18 +640,18 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna)
 	/* Because structs can be inside structs, we recursively
 	 * set flags when a struct is altered
 	 */
-	for(a=0; a<sdna->nr_structs; a++) {
-		if(compflags[a]==2) recurs_test_compflags(sdna, compflags, a);
+	for (a=0; a<sdna->nr_structs; a++) {
+		if (compflags[a]==2) recurs_test_compflags(sdna, compflags, a);
 	}
 	
-/*
-	for(a=0; a<sdna->nr_structs; a++) {
-		if(compflags[a]==2) {
+#if 0
+	for (a=0; a<sdna->nr_structs; a++) {
+		if (compflags[a]==2) {
 			spold= sdna->structs[a];
 			printf("changed: %s\n", sdna->types[ spold[0] ]);
 		}
 	}
-*/
+#endif
 
 	return compflags;
 }
@@ -658,16 +659,16 @@ char *DNA_struct_get_compareflags(SDNA *sdna, SDNA *newsdna)
 static eSDNA_Type sdna_type_nr(const char *dna_type)
 {
 	if     ((strcmp(dna_type, "char")==0) || (strcmp(dna_type, "const char")==0))         return SDNA_TYPE_CHAR;
-	else if((strcmp(dna_type, "uchar")==0) || (strcmp(dna_type, "unsigned char")==0))     return SDNA_TYPE_UCHAR;
-	else if( strcmp(dna_type, "short")==0)                                                return SDNA_TYPE_SHORT;
-	else if((strcmp(dna_type, "ushort")==0)||(strcmp(dna_type, "unsigned short")==0))     return SDNA_TYPE_USHORT;
-	else if( strcmp(dna_type, "int")==0)                                                  return SDNA_TYPE_INT;
-	else if( strcmp(dna_type, "long")==0)                                                 return SDNA_TYPE_LONG;
-	else if((strcmp(dna_type, "ulong")==0)||(strcmp(dna_type, "unsigned long")==0))       return SDNA_TYPE_ULONG;
-	else if( strcmp(dna_type, "float")==0)                                                return SDNA_TYPE_FLOAT;
-	else if( strcmp(dna_type, "double")==0)                                               return SDNA_TYPE_DOUBLE;
-	else if( strcmp(dna_type, "int64_t")==0)                                              return SDNA_TYPE_INT64;
-	else if( strcmp(dna_type, "uint64_t")==0)                                             return SDNA_TYPE_UINT64;
+	else if ((strcmp(dna_type, "uchar")==0) || (strcmp(dna_type, "unsigned char")==0))     return SDNA_TYPE_UCHAR;
+	else if ( strcmp(dna_type, "short")==0)                                                return SDNA_TYPE_SHORT;
+	else if ((strcmp(dna_type, "ushort")==0)||(strcmp(dna_type, "unsigned short")==0))     return SDNA_TYPE_USHORT;
+	else if ( strcmp(dna_type, "int")==0)                                                  return SDNA_TYPE_INT;
+	else if ( strcmp(dna_type, "long")==0)                                                 return SDNA_TYPE_LONG;
+	else if ((strcmp(dna_type, "ulong")==0)||(strcmp(dna_type, "unsigned long")==0))       return SDNA_TYPE_ULONG;
+	else if ( strcmp(dna_type, "float")==0)                                                return SDNA_TYPE_FLOAT;
+	else if ( strcmp(dna_type, "double")==0)                                               return SDNA_TYPE_DOUBLE;
+	else if ( strcmp(dna_type, "int64_t")==0)                                              return SDNA_TYPE_INT64;
+	else if ( strcmp(dna_type, "uint64_t")==0)                                             return SDNA_TYPE_UINT64;
 	else                                                                                  return -1; /* invalid! */
 }
 
@@ -690,7 +691,7 @@ static void cast_elem(const char *ctype, const char *otype, const char *name, ch
 	oldlen= DNA_elem_type_size(otypenr);
 	curlen= DNA_elem_type_size(ctypenr);
 
-	while(arrlen>0) {
+	while (arrlen>0) {
 		switch(otypenr) {
 		case SDNA_TYPE_CHAR:
 			val= *olddata; break;
@@ -732,10 +733,10 @@ static void cast_elem(const char *ctype, const char *otype, const char *name, ch
 		case SDNA_TYPE_ULONG:
 			*( (unsigned int *)curdata)= val; break;
 		case SDNA_TYPE_FLOAT:
-			if(otypenr<2) val/= 255;
+			if (otypenr<2) val/= 255;
 			*( (float *)curdata)= val; break;
 		case SDNA_TYPE_DOUBLE:
-			if(otypenr<2) val/= 255;
+			if (otypenr<2) val/= 255;
 			*( (double *)curdata)= val; break;
 		case SDNA_TYPE_INT64:
 			*( (int64_t *)curdata)= val; break;
@@ -760,12 +761,12 @@ static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata
 	
 	arrlen= DNA_elem_array_size(name, strlen(name));
 	
-	while(arrlen>0) {
+	while (arrlen>0) {
 	
-		if(curlen==oldlen) {
+		if (curlen==oldlen) {
 			memcpy(curdata, olddata, curlen);
 		}
-		else if(curlen==4 && oldlen==8) {
+		else if (curlen==4 && oldlen==8) {
 #ifdef WIN32			
 			lval= *( (__int64 *)olddata );
 #else
@@ -773,7 +774,7 @@ static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata
 #endif
 			*((int *)curdata) = lval>>3;		/* is of course gambling! */
 		}
-		else if(curlen==8 && oldlen==4) {
+		else if (curlen==8 && oldlen==4) {
 #ifdef WIN32
 			 *( (__int64 *)curdata ) = *((int *)olddata);
 #else
@@ -782,7 +783,7 @@ static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata
 		}
 		else {
 			/* for debug */
-			printf("errpr: illegal pointersize! \n");
+			printf("errpr: illegal pointersize!\n");
 		}
 		
 		olddata+= oldlen;
@@ -798,10 +799,10 @@ static int elem_strcmp(const char *name, const char *oname)
 	
 	/* strcmp without array part */
 	
-	while(1) {
-		if(name[a] != oname[a]) return 1;
-		if(name[a]=='[') break;
-		if(name[a]==0) break;
+	while (1) {
+		if (name[a] != oname[a]) return 1;
+		if (name[a]=='[') break;
+		if (name[a]==0) break;
 		a++;
 	}
 	return 0;
@@ -817,16 +818,16 @@ static char *find_elem(SDNA *sdna, const char *type, const char *name, short *ol
 	/* in old is the old struct */
 	elemcount= old[1];
 	old+= 2;
-	for(a=0; a<elemcount; a++, old+=2) {
+	for (a=0; a<elemcount; a++, old+=2) {
 	
 		otype= sdna->types[old[0]];
 		oname= sdna->names[old[1]];
 		
 		len= elementsize(sdna, old[0], old[1]);
 		
-		if( elem_strcmp(name, oname)==0 ) {	/* naam equal */
-			if( strcmp(type, otype)==0 ) {	/* type equal */
-				if(sppo) *sppo= old;
+		if ( elem_strcmp(name, oname)==0 ) {	/* naam equal */
+			if ( strcmp(type, otype)==0 ) {	/* type equal */
+				if (sppo) *sppo= old;
 				return olddata;
 			}
 			
@@ -842,14 +843,14 @@ static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna,
                              char *type, const char *name, char *curdata, short *old, char *olddata)
 {
 	/* rules: test for NAME:
-			- name equal:
-				- cast type
-			- name partially equal (array differs)
-				- type equal: memcpy
-				- types casten
-	   (nzc 2-4-2001 I want the 'unsigned' bit to be parsed as well. Where
-	   can I force this?)
-	*/	
+	 * 		- name equal:
+	 * 			- cast type
+	 * 		- name partially equal (array differs)
+	 * 			- type equal: memcpy
+	 * 			- types casten
+	 * (nzc 2-4-2001 I want the 'unsigned' bit to be parsed as well. Where
+	 * can I force this?)
+	 */
 	int a, elemcount, len, array, oldsize, cursize, mul;
 	char *otype;
 	const char *oname, *cp;
@@ -857,53 +858,53 @@ static void reconstruct_elem(SDNA *newsdna, SDNA *oldsdna,
 	/* is 'name' an array? */
 	cp= name;
 	array= 0;
-	while( *cp && *cp!='[') {
+	while ( *cp && *cp!='[') {
 		cp++; array++;
 	}
-	if( *cp!= '[' ) array= 0;
+	if ( *cp!= '[' ) array= 0;
 	
 	/* in old is the old struct */
 	elemcount= old[1];
 	old+= 2;
-	for(a=0; a<elemcount; a++, old+=2) {
+	for (a=0; a<elemcount; a++, old+=2) {
 		otype= oldsdna->types[old[0]];
 		oname= oldsdna->names[old[1]];
 		len= elementsize(oldsdna, old[0], old[1]);
 		
-		if( strcmp(name, oname)==0 ) {	/* name equal */
+		if ( strcmp(name, oname)==0 ) {	/* name equal */
 			
-			if(ispointer(name)) {	/* pointer of functionpointer afhandelen */
+			if (ispointer(name)) {	/* pointer of functionpointer afhandelen */
 				cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, name, curdata, olddata);
 			}
-			else if( strcmp(type, otype)==0 ) {	/* type equal */
+			else if ( strcmp(type, otype)==0 ) {	/* type equal */
 				memcpy(curdata, olddata, len);
 			}
 			else cast_elem(type, otype, name, curdata, olddata);
 
 			return;
 		}
-		else if(array) {		/* name is an array */
+		else if (array) {		/* name is an array */
 
-			if(oname[array]=='[' && strncmp(name, oname, array)==0 ) {			/* basis equal */
+			if (oname[array]=='[' && strncmp(name, oname, array)==0 ) {			/* basis equal */
 				
 				cursize= DNA_elem_array_size(name, strlen(name));
 				oldsize= DNA_elem_array_size(oname, strlen(oname));
 
-				if(ispointer(name)) {		/* handle pointer or functionpointer */
-					if(cursize>oldsize) cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, oname, curdata, olddata);
+				if (ispointer(name)) {		/* handle pointer or functionpointer */
+					if (cursize>oldsize) cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, oname, curdata, olddata);
 					else cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, name, curdata, olddata);
 				}
-				else if(name[0]=='*' || strcmp(type, otype)==0 ) {	/* type equal */
+				else if (name[0]=='*' || strcmp(type, otype)==0 ) {	/* type equal */
 					mul= len/oldsize;
 					mul*= (cursize < oldsize)? cursize: oldsize;
 					memcpy(curdata, olddata, mul);
 					
 					/* terminate strings */
-					if(oldsize > cursize && strcmp(type, "char")==0)
+					if (oldsize > cursize && strcmp(type, "char")==0)
 						curdata[mul-1]= 0;
 				}
 				else {
-					if(cursize>oldsize) cast_elem(type, otype, oname, curdata, olddata);
+					if (cursize>oldsize) cast_elem(type, otype, oname, curdata, olddata);
 					else cast_elem(type, otype, name, curdata, olddata);
 				}
 				return;
@@ -925,10 +926,10 @@ static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna,
 	char *type, *cpo, *cpc;
 	const char *name, *nameo;
 
-	if(oldSDNAnr== -1) return;
-	if(curSDNAnr== -1) return;
+	if (oldSDNAnr== -1) return;
+	if (curSDNAnr== -1) return;
 
-	if( compflags[oldSDNAnr]==1 ) {		/* if recursive: test for equal */
+	if ( compflags[oldSDNAnr]==1 ) {		/* if recursive: test for equal */
 	
 		spo= oldsdna->structs[oldSDNAnr];
 		elen= oldsdna->typelens[ spo[0] ];
@@ -946,19 +947,19 @@ static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna,
 
 	spc+= 2;
 	cpc= cur;
-	for(a=0; a<elemcount; a++, spc+=2) {
+	for (a=0; a<elemcount; a++, spc+=2) {
 		type= newsdna->types[spc[0]];
 		name= newsdna->names[spc[1]];
 		
 		elen= elementsize(newsdna, spc[0], spc[1]);
 
 		/* test: is type a struct? */
-		if(spc[0]>=firststructtypenr  &&  !ispointer(name)) {
+		if (spc[0]>=firststructtypenr  &&  !ispointer(name)) {
 		
 			/* where does the old struct data start (and is there an old one?) */
 			cpo= find_elem(oldsdna, type, name, spo, data, &sppo);
 			
-			if(cpo) {
+			if (cpo) {
 				oldSDNAnr= DNA_struct_find_nr(oldsdna, type);
 				curSDNAnr= DNA_struct_find_nr(newsdna, type);
 				
@@ -972,14 +973,14 @@ static void reconstruct_struct(SDNA *newsdna, SDNA *oldsdna,
 				elen/= mul;
 				eleno/= mulo;
 				
-				while(mul--) {
+				while (mul--) {
 					reconstruct_struct(newsdna, oldsdna, compflags, oldSDNAnr, cpo, curSDNAnr, cpc);
 					cpo+= eleno;
 					cpc+= elen;
 					
 					/* new struct array larger than old */
 					mulo--;
-					if(mulo<=0) break;
+					if (mulo<=0) break;
 				}
 			}
 			else cpc+= elen;
@@ -1003,7 +1004,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
 	char *type, *cpo, *cur, cval;
 	const char *name;
 
-	if(oldSDNAnr== -1) return;
+	if (oldSDNAnr== -1) return;
 	firststructtypenr= *(oldsdna->structs[0]);
 	
 	spo= spc= oldsdna->structs[oldSDNAnr];
@@ -1013,7 +1014,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
 	spc+= 2;
 	cur= data;
 	
-	for(a=0; a<elemcount; a++, spc+=2) {
+	for (a=0; a<elemcount; a++, spc+=2) {
 		type= oldsdna->types[spc[0]];
 		name= oldsdna->names[spc[1]];
 		
@@ -1021,16 +1022,16 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
 		elen= elementsize(oldsdna, spc[0], spc[1]);
 
 		/* test: is type a struct? */
-		if(spc[0]>=firststructtypenr  &&  !ispointer(name)) {
+		if (spc[0]>=firststructtypenr  &&  !ispointer(name)) {
 			/* where does the old data start (is there one?) */
 			cpo= find_elem(oldsdna, type, name, spo, data, NULL);
-			if(cpo) {
+			if (cpo) {
 				oldSDNAnr= DNA_struct_find_nr(oldsdna, type);
 				
 				mul= DNA_elem_array_size(name, strlen(name));
 				elena= elen/mul;
 
-				while(mul--) {
+				while (mul--) {
 					DNA_struct_switch_endian(oldsdna, oldSDNAnr, cpo);
 					cpo += elena;
 				}
@@ -1038,12 +1039,12 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
 		}
 		else {
 			
-			if(ispointer(name)) {
-				if(oldsdna->pointerlen==8) {
+			if (ispointer(name)) {
+				if (oldsdna->pointerlen==8) {
 					
 					mul= DNA_elem_array_size(name, strlen(name));
 					cpo= cur;
-					while(mul--) {
+					while (mul--) {
 						cval= cpo[0]; cpo[0]= cpo[7]; cpo[7]= cval;
 						cval= cpo[1]; cpo[1]= cpo[6]; cpo[6]= cval;
 						cval= cpo[2]; cpo[2]= cpo[5]; cpo[5]= cval;
@@ -1062,17 +1063,17 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
 					
 					/* exception: variable called blocktype/ipowin: derived from ID_  */
 					skip= 0;
-					if(name[0]=='b' && name[1]=='l') {
-						if(strcmp(name, "blocktype")==0) skip= 1;
+					if (name[0]=='b' && name[1]=='l') {
+						if (strcmp(name, "blocktype")==0) skip= 1;
 					}
-					else if(name[0]=='i' && name[1]=='p') {
-						if(strcmp(name, "ipowin")==0) skip= 1;
+					else if (name[0]=='i' && name[1]=='p') {
+						if (strcmp(name, "ipowin")==0) skip= 1;
 					}
 					
-					if(skip==0) {
+					if (skip==0) {
 						mul= DNA_elem_array_size(name, strlen(name));
 						cpo= cur;
-						while(mul--) {
+						while (mul--) {
 							cval= cpo[0];
 							cpo[0]= cpo[1];
 							cpo[1]= cval;
@@ -1088,7 +1089,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
 
 					mul= DNA_elem_array_size(name, strlen(name));
 					cpo= cur;
-					while(mul--) {
+					while (mul--) {
 						cval= cpo[0];
 						cpo[0]= cpo[3];
 						cpo[3]= cval;
@@ -1103,7 +1104,7 @@ void DNA_struct_switch_endian(SDNA *oldsdna, int oldSDNAnr, char *data)
 				{
 					mul= DNA_elem_array_size(name, strlen(name));
 					cpo= cur;
-					while(mul--) {
+					while (mul--) {
 						cval= cpo[0]; cpo[0]= cpo[7]; cpo[7]= cval;
 						cval= cpo[1]; cpo[1]= cpo[6]; cpo[6]= cval;
 						cval= cpo[2]; cpo[2]= cpo[5]; cpo[5]= cval;
@@ -1131,18 +1132,18 @@ void *DNA_struct_reconstruct(SDNA *newsdna, SDNA *oldsdna, char *compflags, int
 	curSDNAnr= DNA_struct_find_nr(newsdna, type);
 
 	/* init data and alloc */
-	if(curSDNAnr >= 0) {
+	if (curSDNAnr >= 0) {
 		spc= newsdna->structs[curSDNAnr];
 		curlen= newsdna->typelens[ spc[0] ];
 	}
-	if(curlen==0) {
+	if (curlen==0) {
 		return NULL;
 	}
 
 	cur= MEM_callocN( blocks*curlen, "reconstruct");
 	cpc= cur;
 	cpo= data;
-	for(a=0; a<blocks; a++) {
+	for (a=0; a<blocks; a++) {
 		reconstruct_struct(newsdna, oldsdna, compflags, oldSDNAnr, cpo, curSDNAnr, cpc);
 		cpc+= curlen;
 		cpo+= oldlen;
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index 2fa5277..f67fff4 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -46,9 +46,7 @@
  * There is a facility to get verbose output from sdna. Search for
  * \ref debugSDNA. This int can be set to 0 (no output) to some int. Higher
  * numbers give more output.
- * */
-
-#define DNA_VERSION_DATE "FIXME-DNA_VERSION_DATE"
+ */
 
 #include <string.h>
 #include <stdlib.h>
@@ -148,9 +146,9 @@ static char **types, *typedata;		/* at address types[a] is string a */
 static short *typelens;				/* at typelens[a] is de length of type a */
 static short *alphalens;			/* contains sizes as they are calculated on the DEC Alpha (64 bits), infact any 64bit system */
 static short **structs, *structdata;/* at sp= structs[a] is the first address of a struct definition
-                                       sp[0] is type number
-                                       sp[1] is amount of elements
-                                       sp[2] sp[3] is typenr,  namenr (etc) */
+                                     * sp[0] is type number
+                                     * sp[1] is amount of elements
+                                     * sp[2] sp[3] is typenr,  namenr (etc) */
 /**
  * Variable to control debug output of makesdna.
  * debugSDNA:
@@ -229,11 +227,19 @@ static int add_type(const char *str, int len)
 	int nr;
 	char *cp;
 	
-	if(str[0]==0) return -1;
+	/* first do validity check */
+	if (str[0]==0) {
+		return -1;
+	}
+	else if (strchr(str, '*')) {
+		/* note: this is valid C syntax but we can't parse, complain!
+		 * 'struct SomeStruct* somevar;' <-- correct but we cant handle right now. */
+		return -1;
+	}
 	
 	/* search through type array */
-	for(nr=0; nr<nr_types; nr++) {
-		if(strcmp(str, types[nr])==0) {
+	for (nr=0; nr<nr_types; nr++) {
+		if (strcmp(str, types[nr])==0) {
 			if (len) {
 				typelens[nr]= len;
 				alphalens[nr] = len;
@@ -243,7 +249,7 @@ static int add_type(const char *str, int len)
 	}
 	
 	/* append new type */
-	if(nr_types==0) cp= typedata;
+	if (nr_types==0) cp= typedata;
 	else {
 		cp= types[nr_types-1]+strlen(types[nr_types-1])+1;
 	}
@@ -252,7 +258,7 @@ static int add_type(const char *str, int len)
 	typelens[nr_types]= len;
 	alphalens[nr_types]= len;
 	
-	if(nr_types>=maxnr) {
+	if (nr_types>=maxnr) {
 		printf("too many types\n");
 		return nr_types-1;
 	}
@@ -279,13 +285,13 @@ static int add_name(const char *str)
 
 	additional_slen_offset = 0;
 	
-	if(str[0]==0 /*  || (str[1]==0) */) return -1;
+	if (str[0]==0 /*  || (str[1]==0) */) return -1;
 
 	if (str[0] == '(' && str[1] == '*') {
 		/* we handle function pointer and special array cases here, e.g.
-		   void (*function)(...) and float (*array)[..]. the array case
-		   name is still converted to (array*)() though because it is that
-		   way in old dna too, and works correct with elementsize() */
+		 * void (*function)(...) and float (*array)[..]. the array case
+		 * name is still converted to (array*)() though because it is that
+		 * way in old dna too, and works correct with elementsize() */
 		int isfuncptr = (strchr(str+1, '(')) != NULL;
 
 		if (debugSDNA > 3) printf("\t\t\t\t*** Function pointer or multidim array pointer found\n");
@@ -306,16 +312,16 @@ static int add_name(const char *str)
 
 		j++; /* j beyond closing brace ? */
 		while ((str[j] != 0) && (str[j] != ')' )) {
-			if (debugSDNA > 3) printf("seen %c ( %d) \n", str[j], str[j]);
+			if (debugSDNA > 3) printf("seen %c ( %d)\n", str[j], str[j]);
 			j++;
 		}
-		if (debugSDNA > 3) printf("seen %c ( %d) \n"
+		if (debugSDNA > 3) printf("seen %c ( %d)\n"
 		                          "special after offset%d\n",
 		                          str[j], str[j], j);
 				
 		if (!isfuncptr) {
 			/* multidimensional array pointer case */
-			if(str[j] == 0) {
+			if (str[j] == 0) {
 				if (debugSDNA > 3) printf("offsetting for multidim array pointer\n");
 			}
 			else
@@ -331,10 +337,12 @@ static int add_name(const char *str)
 			}
 			if (debugSDNA > 3) printf("extra offset %d\n", k);
 			additional_slen_offset = k;
-		} else if (str[j] == ')' ) {
+		}
+		else if (str[j] == ')' ) {
 			if (debugSDNA > 3) printf("offsetting for brace\n");
 			; /* don't get extra offset */
-		} else {
+		}
+		else {
 			printf("Error during tokening function pointer argument list\n");
 		}
 				
@@ -352,8 +360,9 @@ static int add_name(const char *str)
 		 * */
 		buf[i] = 0;
 		if (debugSDNA > 3) printf("Name before chomping: %s\n", buf); 
-		if ( (strncmp(buf,"(*headdraw", 10) == 0)
-			|| (strncmp(buf,"(*windraw", 9) == 0) ) {
+		if ((strncmp(buf,"(*headdraw", 10) == 0) ||
+		    (strncmp(buf,"(*windraw", 9) == 0) )
+		{
 			buf[i] = ')';
 			buf[i+1] = '(';
 			buf[i+2] = 'v'; 
@@ -362,7 +371,8 @@ static int add_name(const char *str)
 			buf[i+5] = 'd';
 			buf[i+6] = ')';
 			buf[i+7] = 0;
-		} else {
+		}
+		else {
 			buf[i] = ')';
 			buf[i+1] = '(';
 			buf[i+2] = ')';
@@ -371,27 +381,28 @@ static int add_name(const char *str)
 		/* now precede with buf*/
 		if (debugSDNA > 3)  printf("\t\t\t\t\tProposing fp name %s\n", buf);
 		name = buf;
-	} else {
+	}
+	else {
 		/* normal field: old code */
 		name = str;
 	}
 	
 	/* search name array */
-	for(nr=0; nr<nr_names; nr++) {
-		if(strcmp(name, names[nr])==0) {
+	for (nr=0; nr<nr_names; nr++) {
+		if (strcmp(name, names[nr])==0) {
 			return nr;
 		}
 	}
 	
 	/* append new type */
-	if(nr_names==0) cp= namedata;
+	if (nr_names==0) cp= namedata;
 	else {
 		cp= names[nr_names-1]+strlen(names[nr_names-1])+1;
 	}
 	strcpy(cp, name);
 	names[nr_names]= cp;
 	
-	if(nr_names>=maxnr) {
+	if (nr_names>=maxnr) {
 		printf("too many names\n");
 		return nr_names-1;
 	}
@@ -405,7 +416,7 @@ static short *add_struct(int namecode)
 	int len;
 	short *sp;
 
-	if(nr_structs==0) {
+	if (nr_structs==0) {
 		structs[0]= structdata;
 	}
 	else {
@@ -417,7 +428,7 @@ static short *add_struct(int namecode)
 	sp= structs[nr_structs];
 	sp[0]= namecode;
 	
-	if(nr_structs>=maxnr) {
+	if (nr_structs>=maxnr) {
 		printf("too many structs\n");
 		return sp;
 	}
@@ -443,10 +454,11 @@ static int preprocess_include(char *maindata, int len)
 	cp= temp;
 	a= len;
 	comment = 0;
-	while(a--) {
-		if(cp[0]=='/' && cp[1]=='/') {
+	while (a--) {
+		if (cp[0]=='/' && cp[1]=='/') {
 			comment = 1;
-		} else if (*cp<32) {
+		}
+		else if (*cp<32) {
 			comment = 0;
 		}
 		if (comment || *cp<32 || *cp>128 ) *cp= 32;
@@ -460,21 +472,21 @@ static int preprocess_include(char *maindata, int len)
 	newlen= 0;
 	comment= 0;
 	a= len;
-	while(a--) {
+	while (a--) {
 		
-		if(cp[0]=='/' && cp[1]=='*') {
+		if (cp[0]=='/' && cp[1]=='*') {
 			comment= 1;
 			cp[0]=cp[1]= 32;
 		}
-		if(cp[0]=='*' && cp[1]=='/') {
+		if (cp[0]=='*' && cp[1]=='/') {
 			comment= 0;
 			cp[0]=cp[1]= 32;
 		}
 
 		/* do not copy when: */
-		if(comment);
-		else if( cp[0]==' ' && cp[1]==' ' );
-		else if( cp[-1]=='*' && cp[0]==' ' );	/* pointers with a space */
+		if (comment);
+		else if ( cp[0]==' ' && cp[1]==' ' );
+		else if ( cp[-1]=='*' && cp[0]==' ' );	/* pointers with a space */
 
 		/* skip special keywords */
 		else if (strncmp("DNA_DEPRECATED", cp, 14)==0) {
@@ -533,8 +545,8 @@ static void *read_file_data(char *filename, int *len_r)
 static int convert_include(char *filename)
 {
 	/* read include file, skip structs with a '#' before it.
-	   store all data in temporal arrays.
-	*/
+	 * store all data in temporal arrays.
+	 */
 	int filelen, count, overslaan, slen, type, name, strct;
 	short *structpoin, *sp;
 	char *maindata, *mainend, *md, *md1;
@@ -551,29 +563,33 @@ static int convert_include(char *filename)
 	/* we look for '{' and then back to 'struct' */
 	count= 0;
 	overslaan= 0;
-	while(count<filelen) {
+	while (count<filelen) {
 		
 		/* code for skipping a struct: two hashes on 2 lines. (preprocess added a space) */
-		if(md[0]=='#' && md[1]==' ' && md[2]=='#') {
+		if (md[0]=='#' && md[1]==' ' && md[2]=='#') {
 			overslaan= 1;
 		}
 		
-		if(md[0]=='{') {
+		if (md[0]=='{') {
 			md[0]= 0;
-			if(overslaan) {
+			if (overslaan) {
 				overslaan= 0;
 			}
 			else {
-				if(md[-1]==' ') md[-1]= 0;
+				if (md[-1]==' ') md[-1]= 0;
 				md1= md-2;
-				while( *md1!=32) md1--;		/* to beginning of word */
+				while ( *md1!=32) md1--;		/* to beginning of word */
 				md1++;
 				
 				/* we've got a struct name when... */
-				if( strncmp(md1-7, "struct", 6)==0 ) {
+				if ( strncmp(md1-7, "struct", 6)==0 ) {
+
+					strct = add_type(md1, 0);
+					if (strct == -1) {
+						printf("File '%s' contains struct we cant parse \"%s\"\n", filename, md1);
+						return 1;
+					}
 
-					
-					strct= add_type(md1, 0);
 					structpoin= add_struct(strct);
 					sp= structpoin+2;
 
@@ -581,26 +597,30 @@ static int convert_include(char *filename)
 
 					/* first lets make it all nice strings */
 					md1= md+1;
-					while(*md1 != '}') {
-						if(md1>mainend) break;
+					while (*md1 != '}') {
+						if (md1>mainend) break;
 						
-						if(*md1==',' || *md1==' ') *md1= 0;
+						if (*md1==',' || *md1==' ') *md1= 0;
 						md1++;
 					}
 					
 					/* read types and names until first character that is not '}' */
 					md1= md+1;
-					while( *md1 != '}' ) {
-						if(md1>mainend) break;
+					while ( *md1 != '}' ) {
+						if (md1>mainend) break;
 						
 						/* skip when it says 'struct' or 'unsigned' or 'const' */
-						if(*md1) {
-							if( strncmp(md1, "struct", 6)==0 ) md1+= 7;
-							if( strncmp(md1, "unsigned", 8)==0 ) md1+= 9;
-							if( strncmp(md1, "const", 5)==0 ) md1+= 6;
+						if (*md1) {
+							if ( strncmp(md1, "struct", 6)==0 ) md1+= 7;
+							if ( strncmp(md1, "unsigned", 8)==0 ) md1+= 9;
+							if ( strncmp(md1, "const", 5)==0 ) md1+= 6;
 							
 							/* we've got a type! */
 							type= add_type(md1, 0);
+							if (type == -1) {
+								printf("File '%s' contains struct we can't parse \"%s\"\n", filename, md1);
+								return 1;
+							}
 
 							if (debugSDNA > 1) printf("\t|\t|\tfound type %s (", md1);
 
@@ -608,15 +628,15 @@ static int convert_include(char *filename)
 
 							
 							/* read until ';' */
-							while( *md1 != ';' ) {
-								if(md1>mainend) break;
+							while ( *md1 != ';' ) {
+								if (md1>mainend) break;
 								
-								if(*md1) {
+								if (*md1) {
 									/* We've got a name. slen needs
 									 * correction for function
 									 * pointers! */
 									slen= (int) strlen(md1);
-									if( md1[slen-1]==';' ) {
+									if ( md1[slen-1]==';' ) {
 										md1[slen-1]= 0;
 
 
@@ -674,11 +694,11 @@ static int arraysize(char *astr, int len)
 
 	memcpy(str, astr, len+1);
 	
-	for(a=0; a<len; a++) {
-		if( str[a]== '[' ) {
+	for (a=0; a<len; a++) {
+		if ( str[a]== '[' ) {
 			cp= &(str[a+1]);
 		}
-		else if( str[a]==']' && cp) {
+		else if ( str[a]==']' && cp) {
 			str[a]= 0;
 			/* if 'cp' is a preprocessor definition, it will evaluate to 0,
 			 * the caller needs to check for this case and throw an error */
@@ -696,17 +716,17 @@ static int calculate_structlens(int firststruct)
 	char *cp;
 	int has_pointer, dna_error = 0;
 		
-	while(unknown) {
+	while (unknown) {
 		lastunknown= unknown;
 		unknown= 0;
 		
 		/* check all structs... */
-		for(a=0; a<nr_structs; a++) {
+		for (a=0; a<nr_structs; a++) {
 			structpoin= structs[a];
 			structtype= structpoin[0];
 
 			/* when length is not known... */
-			if(typelens[structtype]==0) {
+			if (typelens[structtype]==0) {
 				
 				sp= structpoin+2;
 				len= 0;
@@ -714,17 +734,17 @@ static int calculate_structlens(int firststruct)
 				has_pointer = 0;
 				
 				/* check all elements in struct */
-				for(b=0; b<structpoin[1]; b++, sp+=2) {
+				for (b=0; b<structpoin[1]; b++, sp+=2) {
 					type= sp[0];
 					cp= names[sp[1]];
 
 					namelen= (int) strlen(cp);
 					/* is it a pointer or function pointer? */
-					if(cp[0]=='*' || cp[1]=='*') {
+					if (cp[0]=='*' || cp[1]=='*') {
 						has_pointer = 1;
 						/* has the name an extra length? (array) */
 						mul= 1;
-						if( cp[namelen-1]==']') mul= arraysize(cp, namelen);
+						if ( cp[namelen-1]==']') mul= arraysize(cp, namelen);
 
 						if (mul == 0) {
 							printf("Zero array size found or could not parse %s: '%.*s'\n", types[structtype], namelen + 1, cp);
@@ -732,12 +752,13 @@ static int calculate_structlens(int firststruct)
 						}
 
 						/* 4-8 aligned/ */
-						if(sizeof(void *) == 4) {
+						if (sizeof(void *) == 4) {
 							if (len % 4) {
 								printf("Align pointer error in struct (len4): %s %s\n", types[structtype], cp);
 								dna_error = 1;
 							}
-						} else {
+						}
+						else {
 							if (len % 8) {
 								printf("Align pointer error in struct (len8): %s %s\n", types[structtype], cp);
 								dna_error = 1;
@@ -752,14 +773,16 @@ static int calculate_structlens(int firststruct)
 						len += sizeof(void *) * mul;
 						alphalen += 8 * mul;
 
-					} else if(cp[0]=='[') {
+					}
+					else if (cp[0]=='[') {
 						/* parsing can cause names "var" and "[3]" to be found for "float var [3]" ... */
 						printf("Parse error in struct, invalid member name: %s %s\n", types[structtype], cp);
 						dna_error = 1;
-					} else if( typelens[type] ) {
+					}
+					else if ( typelens[type] ) {
 						/* has the name an extra length? (array) */
 						mul= 1;
-						if( cp[namelen-1]==']') mul= arraysize(cp, namelen);
+						if ( cp[namelen-1]==']') mul= arraysize(cp, namelen);
 
 						if (mul == 0) {
 							printf("Zero array size found or could not parse %s: '%.*s'\n", types[structtype], namelen + 1, cp);
@@ -767,19 +790,19 @@ static int calculate_structlens(int firststruct)
 						}
 
 						/* struct alignment */
-						if(type >= firststruct) {
-							if(sizeof(void *)==8 && (len % 8) ) {
+						if (type >= firststruct) {
+							if (sizeof(void *)==8 && (len % 8) ) {
 								printf("Align struct error: %s %s\n", types[structtype],cp);
 								dna_error = 1;
 							}
 						}
 						
 						/* 2-4 aligned/ */
-						if(typelens[type]>3 && (len % 4) ) {
+						if (typelens[type]>3 && (len % 4) ) {
 							printf("Align 4 error in struct: %s %s (add %d padding bytes)\n", types[structtype], cp, len%4);
 							dna_error = 1;
 						}
-						else if(typelens[type]==2 && (len % 2) ) {
+						else if (typelens[type]==2 && (len % 2) ) {
 							printf("Align 2 error in struct: %s %s (add %d padding bytes)\n", types[structtype], cp, len%2);
 							dna_error = 1;
 						}
@@ -787,7 +810,8 @@ static int calculate_structlens(int firststruct)
 						len += mul*typelens[type];
 						alphalen += mul * alphalens[type];
 						
-					} else {
+					}
+					else {
 						len= 0;
 						alphalen = 0;
 						break;
@@ -796,7 +820,8 @@ static int calculate_structlens(int firststruct)
 				
 				if (len==0) {
 					unknown++;
-				} else {
+				}
+				else {
 					typelens[structtype]= len;
 					alphalens[structtype]= alphalen;
 					// two ways to detect if a struct contains a pointer:
@@ -808,7 +833,7 @@ static int calculate_structlens(int firststruct)
 						}
 					}
 					
-					if(len % 4) {
+					if (len % 4) {
 						printf("Sizeerror 4 in struct: %s (add %d bytes)\n", types[structtype], len%4);
 						dna_error = 1;
 					}
@@ -817,35 +842,35 @@ static int calculate_structlens(int firststruct)
 			}
 		}
 		
-		if(unknown==lastunknown) break;
+		if (unknown==lastunknown) break;
 	}
 	
-	if(unknown) {
+	if (unknown) {
 		printf("ERROR: still %d structs unknown\n", unknown);
 
 		if (debugSDNA) {
-			printf("*** Known structs : \n");
+			printf("*** Known structs :\n");
 			
-			for(a=0; a<nr_structs; a++) {
+			for (a=0; a<nr_structs; a++) {
 				structpoin= structs[a];
 				structtype= structpoin[0];
 				
 				/* length unknown */
-				if(typelens[structtype]!=0) {
+				if (typelens[structtype]!=0) {
 					printf("  %s\n", types[structtype]);
 				}
 			}
 		}
 
 			
-		printf("*** Unknown structs : \n");
+		printf("*** Unknown structs :\n");
 			
-		for(a=0; a<nr_structs; a++) {
+		for (a=0; a<nr_structs; a++) {
 			structpoin= structs[a];
 			structtype= structpoin[0];
 
-			/* length unkown yet */
-			if(typelens[structtype]==0) {
+			/* length unknown yet */
+			if (typelens[structtype]==0) {
 				printf("  %s\n", types[structtype]);
 			}
 		}
@@ -882,12 +907,12 @@ void printStructLenghts(void)
 	short *structpoin;
 	printf("\n\n*** All detected structs:\n");
 
-	while(unknown) {
+	while (unknown) {
 		/*lastunknown= unknown;*/ /*UNUSED*/
 		unknown= 0;
 		
 		/* check all structs... */
-		for(a=0; a<nr_structs; a++) {
+		for (a=0; a<nr_structs; a++) {
 			structpoin= structs[a];
 			structtype= structpoin[0];
 			printf("\t%s\t:%d\n", types[structtype], typelens[structtype]);
@@ -911,7 +936,6 @@ static int make_structDNA(char *baseDirectory, FILE *file)
 	if (debugSDNA > -1) {
 		fflush(stdout);
 		printf("Running makesdna at debug level %d\n", debugSDNA);
-		printf("\tProgram version: %s\n", DNA_VERSION_DATE);
 	}
 		
 	/* the longest known struct is 50k, so we assume 100k is sufficent! */
@@ -965,31 +989,30 @@ static int make_structDNA(char *baseDirectory, FILE *file)
 	}
 
 	/* FOR DEBUG */
-	if (debugSDNA > 1)
-	{
+	if (debugSDNA > 1) {
 		int a,b;
 /*  		short *elem; */
 		short num_types;
 
 		printf("nr_names %d nr_types %d nr_structs %d\n", nr_names, nr_types, nr_structs);
-		for(a=0; a<nr_names; a++) { 
-			printf(" %s \n", names[a]);
+		for (a=0; a<nr_names; a++) { 
+			printf(" %s\n", names[a]);
 		}
 		printf("\n");
 		
 		sp= typelens;
-		for(a=0; a<nr_types; a++, sp++) { 
+		for (a=0; a<nr_types; a++, sp++) { 
 			printf(" %s %d\n", types[a], *sp);
 		}
 		printf("\n");
 		
-		for(a=0; a<nr_structs; a++) {
+		for (a=0; a<nr_structs; a++) {
 			sp= structs[a];
 			printf(" struct %s elems: %d size: %d\n", types[sp[0]], sp[1],typelens[sp[0]]);
 			num_types  = sp[1];
 			sp+= 2;
 			/* ? num_types was elem? */
-			for(b=0; b< num_types; b++, sp+= 2) {
+			for (b=0; b< num_types; b++, sp+= 2) {
 				printf("   %s %s\n", types[sp[0]], names[sp[1]]);
 			}
 		}
@@ -999,7 +1022,7 @@ static int make_structDNA(char *baseDirectory, FILE *file)
 
 	if (debugSDNA > -1) printf("Writing file ... ");
 		
-	if(nr_names==0 || nr_structs==0);
+	if (nr_names==0 || nr_structs==0);
 	else {
 		strcpy(str, "SDNA");
 		dna_write(file, str, 4);
@@ -1036,7 +1059,7 @@ static int make_structDNA(char *baseDirectory, FILE *file)
 		dna_write(file, str, 4);
 		
 		len= 2*nr_types;
-		if(nr_types & 1) len+= 2;
+		if (nr_types & 1) len+= 2;
 		dna_write(file, typelens, len);
 		
 		/* WRITE STRUCTS */
@@ -1059,7 +1082,7 @@ static int make_structDNA(char *baseDirectory, FILE *file)
 			int a;
 			
 			fp= fopen("padding.c", "w");
-			if(fp==NULL);
+			if (fp==NULL);
 			else {
 
 				// add all include files defined in the global array
@@ -1067,12 +1090,12 @@ static int make_structDNA(char *baseDirectory, FILE *file)
 					fprintf(fp, "#include \"%s%s\"\n", baseDirectory, includefiles[i]);
 				}
 
-				fprintf(fp, "main(){\n");
+				fprintf(fp, "main() {\n");
 				sp = typelens;
 				sp += firststruct;
-				for(a=firststruct; a<nr_types; a++, sp++) { 
-					if(*sp) {
-						fprintf(fp, "\tif(sizeof(struct %s) - %d) printf(\"ALIGN ERROR:", types[a], *sp);
+				for (a=firststruct; a<nr_types; a++, sp++) { 
+					if (*sp) {
+						fprintf(fp, "\tif (sizeof(struct %s) - %d) printf(\"ALIGN ERROR:", types[a], *sp);
 						fprintf(fp, "%%d %s %d ", types[a], *sp);
 						fprintf(fp, "\\n\",  sizeof(struct %s) - %d);\n", types[a], *sp);
 					}
@@ -1120,17 +1143,20 @@ int main(int argc, char ** argv)
 	if (argc!=2 && argc!=3) {
 		printf("Usage: %s outfile.c [base directory]\n", argv[0]);
 		return_status = 1;
-	} else {
+	}
+	else {
 		file = fopen(argv[1], "w");
 		if (!file) {
 			printf ("Unable to open file: %s\n", argv[1]);
 			return_status = 1;
-		} else {
+		}
+		else {
 			char baseDirectory[256];
 
 			if (argc==3) {
 				strcpy(baseDirectory, argv[2]);
-			} else {
+			}
+			else {
 				strcpy(baseDirectory, BASE_HEADER);
 			}
 
@@ -1140,7 +1166,8 @@ int main(int argc, char ** argv)
 				fclose(file);
 				make_bad_file(argv[1], __LINE__);
 				return_status = 1;
-			} else {
+			}
+			else {
 				fprintf(file, "};\n");
 				fprintf(file, "int DNAlen= sizeof(DNAstr);\n");
 	
@@ -1153,7 +1180,7 @@ int main(int argc, char ** argv)
 	return(return_status);
 }
 
-// include files for automatic dependancies
+/* include files for automatic dependencies */
 #include "DNA_listBase.h"
 #include "DNA_vec_types.h"
 #include "DNA_ID.h"
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 4551094..da73a25 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -20,8 +20,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef RNA_ACCESS_H
-#define RNA_ACCESS_H
+#ifndef __RNA_ACCESS_H__
+#define __RNA_ACCESS_H__
 
 /** \file RNA_access.h
  *  \ingroup RNA
@@ -308,9 +308,12 @@ extern StructRNA RNA_Menu;
 extern StructRNA RNA_Mesh;
 extern StructRNA RNA_MeshColor;
 extern StructRNA RNA_MeshColorLayer;
+extern StructRNA RNA_MeshLoopColorLayer;
 extern StructRNA RNA_MeshDeformModifier;
 extern StructRNA RNA_MeshEdge;
-extern StructRNA RNA_MeshFace;
+extern StructRNA RNA_MeshPolygon;
+extern StructRNA RNA_MeshTessFace;
+extern StructRNA RNA_MeshLoop;
 extern StructRNA RNA_MeshFloatProperty;
 extern StructRNA RNA_MeshFloatPropertyLayer;
 extern StructRNA RNA_MeshIntProperty;
@@ -320,6 +323,8 @@ extern StructRNA RNA_MeshStringProperty;
 extern StructRNA RNA_MeshStringPropertyLayer;
 extern StructRNA RNA_MeshTextureFace;
 extern StructRNA RNA_MeshTextureFaceLayer;
+extern StructRNA RNA_MeshTexturePoly;
+extern StructRNA RNA_MeshTexturePolyLayer;
 extern StructRNA RNA_MeshVertex;
 extern StructRNA RNA_MessageSensor;
 extern StructRNA RNA_MetaBall;
@@ -331,6 +336,7 @@ extern StructRNA RNA_MotionPath;
 extern StructRNA RNA_MotionPathVert;
 extern StructRNA RNA_MouseSensor;
 extern StructRNA RNA_MovieSequence;
+extern StructRNA RNA_MovieClipSequence;
 extern StructRNA RNA_MovieTrackingObject;
 extern StructRNA RNA_MulticamSequence;
 extern StructRNA RNA_MultiresModifier;
@@ -342,6 +348,7 @@ extern StructRNA RNA_NlaTrack;
 extern StructRNA RNA_Node;
 extern StructRNA RNA_NodeForLoop;
 extern StructRNA RNA_NodeGroup;
+extern StructRNA RNA_NodeImageFileSocket;
 extern StructRNA RNA_NodeLink;
 extern StructRNA RNA_NodeSocket;
 extern StructRNA RNA_NodeSocketPanel;
@@ -895,11 +902,11 @@ void RNA_collection_clear(PointerRNA *ptr, const char *name);
 #define RNA_BEGIN(sptr, itemptr, propname)                                    \
 	{                                                                         \
 		CollectionPropertyIterator rna_macro_iter;                            \
-		for(RNA_collection_begin(sptr, propname, &rna_macro_iter);            \
-		    rna_macro_iter.valid;                                             \
-		    RNA_property_collection_next(&rna_macro_iter))                    \
+		for (RNA_collection_begin(sptr, propname, &rna_macro_iter);           \
+		     rna_macro_iter.valid;                                            \
+		     RNA_property_collection_next(&rna_macro_iter))                   \
 		{                                                                     \
-			PointerRNA itemptr= rna_macro_iter.ptr;
+			PointerRNA itemptr = rna_macro_iter.ptr;
 
 #define RNA_END                                                               \
 		}                                                                     \
@@ -909,11 +916,11 @@ void RNA_collection_clear(PointerRNA *ptr, const char *name);
 #define RNA_PROP_BEGIN(sptr, itemptr, prop)                                   \
 	{                                                                         \
 		CollectionPropertyIterator rna_macro_iter;                            \
-		for(RNA_property_collection_begin(sptr, prop, &rna_macro_iter);       \
-			rna_macro_iter.valid;                                             \
-			RNA_property_collection_next(&rna_macro_iter))                    \
+		for (RNA_property_collection_begin(sptr, prop, &rna_macro_iter);      \
+		     rna_macro_iter.valid;                                            \
+		     RNA_property_collection_next(&rna_macro_iter))                   \
 		{                                                                     \
-			PointerRNA itemptr= rna_macro_iter.ptr;
+			PointerRNA itemptr = rna_macro_iter.ptr;
 
 #define RNA_PROP_END                                                          \
 		}                                                                     \
@@ -923,14 +930,14 @@ void RNA_collection_clear(PointerRNA *ptr, const char *name);
 #define RNA_STRUCT_BEGIN(sptr, prop)                                          \
 	{                                                                         \
 		CollectionPropertyIterator rna_macro_iter;                            \
-		for(RNA_property_collection_begin(                                    \
-					sptr,                                                     \
-					RNA_struct_iterator_property(sptr->type),                 \
-					&rna_macro_iter);                                         \
-			rna_macro_iter.valid;                                             \
-			RNA_property_collection_next(&rna_macro_iter))                    \
+		for (RNA_property_collection_begin(                                   \
+		             sptr,                                                    \
+		             RNA_struct_iterator_property(sptr->type),                \
+		             &rna_macro_iter);                                        \
+		     rna_macro_iter.valid;                                            \
+		     RNA_property_collection_next(&rna_macro_iter))                   \
 		{                                                                     \
-			PropertyRNA *prop= rna_macro_iter.ptr.data;
+			PropertyRNA *prop = rna_macro_iter.ptr.data;
 
 #define RNA_STRUCT_END                                                        \
 		}                                                                     \
@@ -945,6 +952,13 @@ int RNA_property_is_idprop(PropertyRNA *prop);
 /* python compatible string representation of this property, (must be freed!) */
 char *RNA_property_as_string(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop);
 char *RNA_pointer_as_string(struct bContext *C, PointerRNA *ptr);
+char *RNA_pointer_as_string_keywords_ex(struct bContext *C, PointerRNA *ptr, PointerRNA *ptr_default,
+                                        const short skip_optional_value, const short all_args,
+                                        PropertyRNA *iterprop);
+char *RNA_pointer_as_string_keywords(struct bContext *C, PointerRNA *ptr, PointerRNA *ptr_default,
+                                     const short skip_optional_value, const short all_args);
+char *RNA_function_as_string_keywords(struct bContext *C, FunctionRNA *func, PointerRNA *ptr_default,
+                                     const short as_function, const short all_args);
 
 /* Function */
 
@@ -1017,4 +1031,4 @@ __attribute__ ((format (printf, 1, 2)))
 }
 #endif
 
-#endif /* RNA_ACCESS_H */
+#endif /* __RNA_ACCESS_H__ */
diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h
index 4fb0822..9939d08 100644
--- a/source/blender/makesrna/RNA_define.h
+++ b/source/blender/makesrna/RNA_define.h
@@ -20,8 +20,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef RNA_DEFINE_H
-#define RNA_DEFINE_H
+#ifndef __RNA_DEFINE_H__
+#define __RNA_DEFINE_H__
 
 /** \file RNA_define.h
  *  \ingroup RNA
@@ -66,6 +66,8 @@ void RNA_def_struct_ui_icon(StructRNA *srna, int icon);
 void RNA_struct_free_extension(StructRNA *srna, ExtensionRNA *ext);
 void RNA_struct_free(BlenderRNA *brna, StructRNA *srna);
 
+void RNA_def_struct_translation_context(StructRNA *srna, const char *context);
+
 /* Compact Property Definitions */
 
 typedef void StructOrFunctionRNA;
@@ -100,10 +102,10 @@ PropertyRNA *RNA_def_float_rotation(StructOrFunctionRNA *cont, const char *ident
 	float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax);
 PropertyRNA *RNA_def_float_array(StructOrFunctionRNA *cont, const char *identifier, int len, const float *default_value,
 	float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax);
-	/*
-PropertyRNA *RNA_def_float_dynamic_array(StructOrFunctionRNA *cont, const char *identifier, float hardmin, float hardmax,
-	const char *ui_name, const char *ui_description, float softmin, float softmax, unsigned int dimension, unsigned short dim_size[]);
-	*/
+
+//PropertyRNA *RNA_def_float_dynamic_array(StructOrFunctionRNA *cont, const char *identifier, float hardmin, float hardmax,
+//	const char *ui_name, const char *ui_description, float softmin, float softmax, unsigned int dimension, unsigned short dim_size[]);
+
 PropertyRNA *RNA_def_float_percentage(StructOrFunctionRNA *cont, const char *identifier, float default_value, float hardmin, float hardmax,
 	const char *ui_name, const char *ui_description, float softmin, float softmax);
 PropertyRNA *RNA_def_float_factor(StructOrFunctionRNA *cont, const char *identifier, float default_value, float hardmin, float hardmax,
@@ -218,5 +220,5 @@ const char *RNA_property_typename(PropertyType type);
 }
 #endif
 
-#endif /* RNA_DEFINE_H */
+#endif /* __RNA_DEFINE_H__ */
 
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index 7291760..afa6a6e 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -20,8 +20,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef RNA_ENUM_TYPES_H
-#define RNA_ENUM_TYPES_H
+#ifndef __RNA_ENUM_TYPES_H__
+#define __RNA_ENUM_TYPES_H__
 
 /** \file RNA_enum_types.h
  *  \ingroup RNA
@@ -129,12 +129,15 @@ EnumPropertyItem *rna_Actuator_type_itemf(struct bContext *C, struct PointerRNA
 /* Generic functions, return an enum from library data, index is the position
  * in the linked list can add more for different types as needed */
 EnumPropertyItem *RNA_action_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
-EnumPropertyItem *RNA_action_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
+// EnumPropertyItem *RNA_action_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
 EnumPropertyItem *RNA_group_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
 EnumPropertyItem *RNA_group_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
 EnumPropertyItem *RNA_image_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
 EnumPropertyItem *RNA_image_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
 EnumPropertyItem *RNA_scene_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
 EnumPropertyItem *RNA_scene_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
+EnumPropertyItem *RNA_movieclip_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
+EnumPropertyItem *RNA_movieclip_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
 
-#endif /* RNA_ENUM_TYPES_H */
+
+#endif /* __RNA_ENUM_TYPES_H__ */
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
index 8586911..c3beffb 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -27,8 +27,8 @@
 
 #include "BLO_sys_types.h"
 
-#ifndef RNA_TYPES_H
-#define RNA_TYPES_H
+#ifndef __RNA_TYPES_H__
+#define __RNA_TYPES_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -91,12 +91,14 @@ typedef enum PropertyUnit {
 	PROP_UNIT_ACCELERATION = (8<<16)	/* m/(s^2) */
 } PropertyUnit;
 
-#define RNA_SUBTYPE_UNIT(subtype) ((subtype) & 0x00FF0000)
-#define RNA_SUBTYPE_VALUE(subtype) ((subtype) & ~0x00FF0000)
-#define RNA_SUBTYPE_UNIT_VALUE(subtype) ((subtype)>>16)
+#define RNA_SUBTYPE_UNIT(subtype)       ((subtype) &  0x00FF0000)
+#define RNA_SUBTYPE_VALUE(subtype)      ((subtype) & ~0x00FF0000)
+#define RNA_SUBTYPE_UNIT_VALUE(subtype) ((subtype) >> 16)
 
 #define RNA_ENUM_BITFLAG_SIZE 32
 
+#define RNA_TRANSLATION_PREC_DEFAULT 5
+
 /* also update enums in bpy_props.c when adding items here
  * watch it: these values are written to files as part of
  * node socket button subtypes!
@@ -152,9 +154,9 @@ typedef enum PropertyFlag {
 	 * for editing. */
 	PROP_LIB_EXCEPTION = 1<<16,
 
-	/* animateable means the property can be driven by some
+	/* animatable means the property can be driven by some
 	 * other input, be it animation curves, expressions, ..
-	 * properties are animateable by default except for pointers
+	 * properties are animatable by default except for pointers
 	 * and collections */
 	PROP_ANIMATABLE = 1<<1,
 
@@ -180,6 +182,9 @@ typedef enum PropertyFlag {
 	/* disallow assigning a variable to its self, eg an object tracking its self
 	 * only apply this to types that are derived from an ID ()*/
 	PROP_ID_SELF_CHECK = 1<<20,
+	/* use for...
+	 * - pointers: in the UI and python so unsetting or setting to None won't work
+	 * - strings: so our internal generated get/length/set functions know to do NULL checks before access [#30865] */
 	PROP_NEVER_NULL = 1<<18,
 	/* currently only used for UI, this is similar to PROP_NEVER_NULL
 	 * except that the value may be NULL at times, used for ObData, where an Empty's will be NULL
@@ -191,7 +196,7 @@ typedef enum PropertyFlag {
 	 * this exposes the flag as multiple options in python and the UI.
 	 *
 	 * note: these can't be animated so use with care.
-	  */
+	 */
 	PROP_ENUM_FLAG = 1<<21,
 
 	/* need context for update function */
@@ -341,8 +346,10 @@ typedef enum StructFlag {
 typedef int (*StructValidateFunc)(struct PointerRNA *ptr, void *data, int *have_function);
 typedef int (*StructCallbackFunc)(struct bContext *C, struct PointerRNA *ptr, struct FunctionRNA *func, ParameterList *list);
 typedef void (*StructFreeFunc)(void *data);
-typedef struct StructRNA *(*StructRegisterFunc)(struct Main *bmain, struct ReportList *reports, void *data,
-	const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free);
+typedef struct StructRNA *(*StructRegisterFunc)(
+        struct Main *bmain, struct ReportList *reports, void *data, const char *identifier,
+        StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free);
+
 typedef void (*StructUnregisterFunc)(struct Main *bmain, struct StructRNA *type);
 typedef void **(*StructInstanceFunc)(PointerRNA *ptr);
 
@@ -371,4 +378,4 @@ typedef struct ExtensionRNA {
 }
 #endif
 
-#endif /* RNA_TYPES_H */
+#endif /* __RNA_TYPES_H__ */
diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript
index e1475a9..2bafc58 100644
--- a/source/blender/makesrna/SConscript
+++ b/source/blender/makesrna/SConscript
@@ -12,6 +12,9 @@ incs += ' ../render/extern/include #/intern/cycles/blender'
 incs += ' ../nodes'
 incs += ' #/extern/glew/include'
 
+incs += ' ../bmesh'
+
+
 defs = []
 
 if env['WITH_BF_OPENEXR']:
@@ -32,6 +35,9 @@ if env['WITH_BF_CINEON']:
 if env['WITH_BF_HDR']:
     defs.append('WITH_HDR')
 
+if env['WITH_BF_FRAMESERVER']:
+    defs.append('WITH_FRAMESERVER')
+
 if env['WITH_BF_FFMPEG']:
     defs.append('WITH_FFMPEG')
     incs += ' ' + env['BF_FFMPEG_INC']
@@ -62,7 +68,7 @@ if env['OURPLATFORM'] == 'linux':
     cflags='-pthread'
     incs += ' ../../../extern/binreloc/include'
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
 
 if env['WITH_BF_INTERNATIONAL']:
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index 5bbdac6..6f8e765 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -240,6 +240,7 @@ blender_include_dirs(
 	../../blenkernel
 	../../blenloader
 	../../blenlib
+	../../bmesh
 	../../blenfont
 	../../gpu
 	../../imbuf
@@ -279,6 +280,7 @@ set(SRC
 	rna_internal.h
 	rna_internal_types.h
 	rna_nodetree_types.h
+	rna_mesh_utils.h
 )
 
 blender_add_lib(bf_rna "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript
index 26fa793..99fab18 100644
--- a/source/blender/makesrna/intern/SConscript
+++ b/source/blender/makesrna/intern/SConscript
@@ -32,7 +32,7 @@ defs = []
 incs = '#/intern/guardedalloc ../../blenlib ../../blenkernel ../../blenloader'
 incs += ' ../../imbuf ../../makesdna ../../makesrna ../../ikplugin'
 incs += ' ../../windowmanager ../../editors/include ../../blenfont'
-incs += ' ../../render/extern/include'
+incs += ' ../../render/extern/include ../../bmesh'
 incs += ' #/intern/audaspace/intern #/intern/cycles/blender'
 incs += ' #/extern/glew/include '
 
@@ -54,7 +54,8 @@ if env['WITH_BF_CINEON']:
 if env['WITH_BF_HDR']:
     defs.append('WITH_HDR')
 
-defs.append('WITH_FRAMESERVER')  # TODO, make optional
+if env['WITH_BF_FRAMESERVER']:
+    defs.append('WITH_FRAMESERVER')
 
 if env['WITH_BF_FFMPEG']:
     defs.append('WITH_FFMPEG')
@@ -95,7 +96,7 @@ if env['OURPLATFORM'] == 'linux':
     cflags='-pthread'
     incs += ' ../../../extern/binreloc/include'
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
 
 if env['WITH_BF_INTERNATIONAL']:
@@ -159,7 +160,7 @@ rna.Depends (generated_files, makesrna)
 build_dir = root_build_dir + os.sep +'source' + os.sep + 'blender' + os.sep + 'makesrna' + os.sep + 'intern' + os.sep
     
 if env['OURPLATFORM'] != 'linuxcross':
-    if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'):
+    if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'win64-mingw'):
         rna.Command (generated_files, '', "\"" + root_build_dir+os.sep+"makesrna.exe\" \""  + build_dir )
     else:
         rna.Command (generated_files, '', "\"" + root_build_dir+os.sep+"makesrna\" \""  + build_dir + '"' )
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 8258ef5..e083a69 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -40,8 +40,6 @@
 
 #include "rna_internal.h"
 
-#define RNA_VERSION_DATE "FIXME-RNA_VERSION_DATE"
-
 #ifdef _WIN32
 #  ifndef snprintf
 #    define snprintf _snprintf
@@ -62,45 +60,45 @@
 static int file_older(const char *file1, const char *file2)
 {
 	struct stat st1, st2;
-	// printf("compare: %s %s\n", file1, file2);
+	/* printf("compare: %s %s\n", file1, file2); */
 
-	if(stat(file1, &st1)) return 0;
-	if(stat(file2, &st2)) return 0;
+	if (stat(file1, &st1)) return 0;
+	if (stat(file2, &st2)) return 0;
 
 	return (st1.st_mtime < st2.st_mtime);
 }
-static const char *makesrna_path= NULL;
+static const char *makesrna_path = NULL;
 
 static int replace_if_different(char *tmpfile, const char *dep_files[])
 {
-	// return 0; // use for testing had edited rna
+	/* return 0;  *//* use for testing had edited rna */
 
 #define REN_IF_DIFF                                                           \
 	{                                                                         \
-		FILE *file_test= fopen(orgfile, "rb");                                \
-		if(file_test) {                                                       \
+		FILE *file_test = fopen(orgfile, "rb");                               \
+		if (file_test) {                                                      \
 			fclose(file_test);                                                \
-			if(fp_org) fclose(fp_org);                                        \
-			if(fp_new) fclose(fp_new);                                        \
-			if(remove(orgfile) != 0) {                                        \
+			if (fp_org) fclose(fp_org);                                       \
+			if (fp_new) fclose(fp_new);                                       \
+			if (remove(orgfile) != 0) {                                       \
 				fprintf(stderr, "%s:%d, Remove Error (%s): \"%s\"\n",         \
 				        __FILE__, __LINE__, strerror(errno), orgfile);        \
 				return -1;                                                    \
 			}                                                                 \
 		}                                                                     \
 	}                                                                         \
-	if(rename(tmpfile, orgfile) != 0) {                                       \
+	if (rename(tmpfile, orgfile) != 0) {                                      \
 		fprintf(stderr, "%s:%d, Rename Error (%s): \"%s\" -> \"%s\"\n",       \
 		        __FILE__, __LINE__, strerror(errno), tmpfile, orgfile);       \
 		return -1;                                                            \
 	}                                                                         \
 	remove(tmpfile);                                                          \
-	return 1;                                                                 \
+	return 1                                                                  \
 
 /* end REN_IF_DIFF */
 
 
-	FILE *fp_new= NULL, *fp_org= NULL;
+	FILE *fp_new = NULL, *fp_org = NULL;
 	int len_new, len_org;
 	char *arr_new, *arr_org;
 	int cmp;
@@ -110,40 +108,40 @@ static int replace_if_different(char *tmpfile, const char *dep_files[])
 	strcpy(orgfile, tmpfile);
 	orgfile[strlen(orgfile) - strlen(TMP_EXT)] = '\0'; /* strip '.tmp' */
 
-	fp_org= fopen(orgfile, "rb");
+	fp_org = fopen(orgfile, "rb");
 
-	if(fp_org==NULL) {
+	if (fp_org == NULL) {
 		REN_IF_DIFF;
 	}
 
 
-	/* XXX, trick to work around dependancy problem
+	/* XXX, trick to work around dependency problem
 	 * assumes dep_files is in the same dir as makesrna.c, which is true for now. */
 
-	if(1) {
+	if (1) {
 		/* first check if makesrna.c is newer then generated files
 		 * for development on makesrna.c you may want to disable this */
-		if(file_older(orgfile, __FILE__)) {
+		if (file_older(orgfile, __FILE__)) {
 			REN_IF_DIFF;
 		}
 
-		if(file_older(orgfile, makesrna_path)) {
+		if (file_older(orgfile, makesrna_path)) {
 			REN_IF_DIFF;
 		}
 
 		/* now check if any files we depend on are newer then any generated files */
-		if(dep_files) {
+		if (dep_files) {
 			int pass;
-			for(pass=0; dep_files[pass]; pass++) {
-				char from_path[4096]= __FILE__;
+			for (pass = 0; dep_files[pass]; pass++) {
+				char from_path[4096] = __FILE__;
 				char *p1, *p2;
 
 				/* dir only */
-				p1= strrchr(from_path, '/');
-				p2= strrchr(from_path, '\\');
+				p1 = strrchr(from_path, '/');
+				p2 = strrchr(from_path, '\\');
 				strcpy((p1 > p2 ? p1 : p2)+1, dep_files[pass]);
 				/* account for build deps, if makesrna.c (this file) is newer */
-				if(file_older(orgfile, from_path)) {
+				if (file_older(orgfile, from_path)) {
 					REN_IF_DIFF;
 				}
 			}
@@ -152,9 +150,9 @@ static int replace_if_different(char *tmpfile, const char *dep_files[])
 	/* XXX end dep trick */
 
 
-	fp_new= fopen(tmpfile, "rb");
+	fp_new = fopen(tmpfile, "rb");
 
-	if(fp_new==NULL) {
+	if (fp_new == NULL) {
 		/* shouldn't happen, just to be safe */
 		fprintf(stderr, "%s:%d, open error: \"%s\"\n", __FILE__, __LINE__, tmpfile);
 		fclose(fp_org);
@@ -165,30 +163,30 @@ static int replace_if_different(char *tmpfile, const char *dep_files[])
 	fseek(fp_org, 0L, SEEK_END); len_org = ftell(fp_org); fseek(fp_org, 0L, SEEK_SET);
 
 
-	if(len_new != len_org) {
+	if (len_new != len_org) {
 		fclose(fp_new);
 		fclose(fp_org);
 		REN_IF_DIFF;
 	}
 
 	/* now compare the files... */
-	arr_new= MEM_mallocN(sizeof(char)*len_new, "rna_cmp_file_new");
-	arr_org= MEM_mallocN(sizeof(char)*len_org, "rna_cmp_file_org");
+	arr_new = MEM_mallocN(sizeof(char)*len_new, "rna_cmp_file_new");
+	arr_org = MEM_mallocN(sizeof(char)*len_org, "rna_cmp_file_org");
 
-	if(fread(arr_new, sizeof(char), len_new, fp_new) != len_new)
+	if (fread(arr_new, sizeof(char), len_new, fp_new) != len_new)
 		fprintf(stderr, "%s:%d, error reading file %s for comparison.\n", __FILE__, __LINE__, tmpfile);
-	if(fread(arr_org, sizeof(char), len_org, fp_org) != len_org)
+	if (fread(arr_org, sizeof(char), len_org, fp_org) != len_org)
 		fprintf(stderr, "%s:%d, error reading file %s for comparison.\n", __FILE__, __LINE__, orgfile);
 
 	fclose(fp_new);
 	fclose(fp_org);
 
-	cmp= memcmp(arr_new, arr_org, len_new);
+	cmp = memcmp(arr_new, arr_org, len_new);
 
 	MEM_freeN(arr_new);
 	MEM_freeN(arr_org);
 
-	if(cmp) {
+	if (cmp) {
 		REN_IF_DIFF;
 	}
 	else {
@@ -203,9 +201,9 @@ static int replace_if_different(char *tmpfile, const char *dep_files[])
 
 static const char *rna_safe_id(const char *id)
 {
-	if(strcmp(id, "default") == 0)
+	if (strcmp(id, "default") == 0)
 		return "default_value";
-	else if(strcmp(id, "operator") == 0)
+	else if (strcmp(id, "operator") == 0)
 		return "operator_value";
 
 	return id;
@@ -215,38 +213,38 @@ static const char *rna_safe_id(const char *id)
 
 static int cmp_struct(const void *a, const void *b)
 {
-	const StructRNA *structa= *(const StructRNA**)a;
-	const StructRNA *structb= *(const StructRNA**)b;
+	const StructRNA *structa = *(const StructRNA**)a;
+	const StructRNA *structb = *(const StructRNA**)b;
 
 	return strcmp(structa->identifier, structb->identifier);
 }
 
 static int cmp_property(const void *a, const void *b)
 {
-	const PropertyRNA *propa= *(const PropertyRNA**)a;
-	const PropertyRNA *propb= *(const PropertyRNA**)b;
+	const PropertyRNA *propa = *(const PropertyRNA**)a;
+	const PropertyRNA *propb = *(const PropertyRNA**)b;
 
-	if(strcmp(propa->identifier, "rna_type") == 0) return -1;
-	else if(strcmp(propb->identifier, "rna_type") == 0) return 1;
+	if (strcmp(propa->identifier, "rna_type") == 0) return -1;
+	else if (strcmp(propb->identifier, "rna_type") == 0) return 1;
 
-	if(strcmp(propa->identifier, "name") == 0) return -1;
-	else if(strcmp(propb->identifier, "name") == 0) return 1;
+	if (strcmp(propa->identifier, "name") == 0) return -1;
+	else if (strcmp(propb->identifier, "name") == 0) return 1;
 
 	return strcmp(propa->name, propb->name);
 }
 
 static int cmp_def_struct(const void *a, const void *b)
 {
-	const StructDefRNA *dsa= *(const StructDefRNA**)a;
-	const StructDefRNA *dsb= *(const StructDefRNA**)b;
+	const StructDefRNA *dsa = *(const StructDefRNA**)a;
+	const StructDefRNA *dsb = *(const StructDefRNA**)b;
 
 	return cmp_struct(&dsa->srna, &dsb->srna);
 }
 
 static int cmp_def_property(const void *a, const void *b)
 {
-	const PropertyDefRNA *dpa= *(const PropertyDefRNA**)a;
-	const PropertyDefRNA *dpb= *(const PropertyDefRNA**)b;
+	const PropertyDefRNA *dpa = *(const PropertyDefRNA**)a;
+	const PropertyDefRNA *dpb = *(const PropertyDefRNA**)b;
 
 	return cmp_property(&dpa->prop, &dpb->prop);
 }
@@ -257,22 +255,22 @@ static void rna_sortlist(ListBase *listbase, int(*cmp)(const void*, const void*)
 	void **array;
 	int a, size;
 	
-	if(listbase->first == listbase->last)
+	if (listbase->first == listbase->last)
 		return;
 
-	for(size=0, link=listbase->first; link; link=link->next)
+	for (size = 0, link = listbase->first; link; link = link->next)
 		size++;
 
-	array= MEM_mallocN(sizeof(void*)*size, "rna_sortlist");
-	for(a=0, link=listbase->first; link; link=link->next, a++)
-		array[a]= link;
+	array = MEM_mallocN(sizeof(void*)*size, "rna_sortlist");
+	for (a = 0, link = listbase->first; link; link = link->next, a++)
+		array[a] = link;
 
 	qsort(array, size, sizeof(void*), cmp);
 
-	listbase->first= listbase->last= NULL;
-	for(a=0; a<size; a++) {
-		link= array[a];
-		link->next= link->prev= NULL;
+	listbase->first = listbase->last = NULL;
+	for (a = 0; a<size; a++) {
+		link = array[a];
+		link->next = link->prev = NULL;
 		rna_addtail(listbase, link);
 	}
 
@@ -286,18 +284,18 @@ static void rna_print_c_string(FILE *f, const char *str)
 	static const char *escape[] = {"\''", "\"\"", "\??", "\\\\","\aa", "\bb", "\ff", "\nn", "\rr", "\tt", "\vv", NULL};
 	int i, j;
 
-	if(!str) {
+	if (!str) {
 		fprintf(f, "NULL");
 		return;
 	}
 
 	fprintf(f, "\"");
-	for(i=0; str[i]; i++) {
-		for(j=0; escape[j]; j++)
-			if(str[i] == escape[j][0])
+	for (i = 0; str[i]; i++) {
+		for (j = 0; escape[j]; j++)
+			if (str[i] == escape[j][0])
 				break;
 
-		if(escape[j]) fprintf(f, "\\%c", escape[j][1]);
+		if (escape[j]) fprintf(f, "\\%c", escape[j][1]);
 		else fprintf(f, "%c", str[i]);
 	}
 	fprintf(f, "\"");
@@ -305,8 +303,9 @@ static void rna_print_c_string(FILE *f, const char *str)
 
 static void rna_print_data_get(FILE *f, PropertyDefRNA *dp)
 {
-	if(dp->dnastructfromname && dp->dnastructfromprop)
-		fprintf(f, "	%s *data= (%s*)(((%s*)ptr->data)->%s);\n", dp->dnastructname, dp->dnastructname, dp->dnastructfromname, dp->dnastructfromprop);
+	if (dp->dnastructfromname && dp->dnastructfromprop)
+		fprintf(f, "	%s *data= (%s*)(((%s*)ptr->data)->%s);\n", dp->dnastructname, dp->dnastructname,
+		        dp->dnastructfromname, dp->dnastructfromprop);
 	else
 		fprintf(f, "	%s *data= (%s*)(ptr->data);\n", dp->dnastructname, dp->dnastructname);
 }
@@ -323,11 +322,11 @@ static char *rna_alloc_function_name(const char *structname, const char *propnam
 	char *result;
 
 	snprintf(buffer, sizeof(buffer), "%s_%s_%s", structname, propname, type);
-	result= MEM_callocN(sizeof(char)*strlen(buffer)+1, "rna_alloc_function_name");
+	result = MEM_callocN(sizeof(char)*strlen(buffer)+1, "rna_alloc_function_name");
 	strcpy(result, buffer);
 
-	alloc= MEM_callocN(sizeof(AllocDefRNA), "AllocDefRNA");
-	alloc->mem= result;
+	alloc = MEM_callocN(sizeof(AllocDefRNA), "AllocDefRNA");
+	alloc->mem = result;
 	rna_addtail(&DefRNA.allocs, alloc);
 
 	return result;
@@ -337,8 +336,8 @@ static StructRNA *rna_find_struct(const char *identifier)
 {
 	StructDefRNA *ds;
 
-	for(ds=DefRNA.structs.first; ds; ds=ds->cont.next)
-		if(strcmp(ds->srna->identifier, identifier)==0)
+	for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
+		if (strcmp(ds->srna->identifier, identifier) == 0)
 			return ds->srna;
 
 	return NULL;
@@ -348,8 +347,8 @@ static const char *rna_find_type(const char *type)
 {
 	StructDefRNA *ds;
 
-	for(ds=DefRNA.structs.first; ds; ds=ds->cont.next)
-		if(ds->dnaname && strcmp(ds->dnaname, type)==0)
+	for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
+		if (ds->dnaname && strcmp(ds->dnaname, type) == 0)
 			return ds->srna->identifier;
 
 	return NULL;
@@ -359,8 +358,8 @@ static const char *rna_find_dna_type(const char *type)
 {
 	StructDefRNA *ds;
 
-	for(ds=DefRNA.structs.first; ds; ds=ds->cont.next)
-		if(strcmp(ds->srna->identifier, type)==0)
+	for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
+		if (strcmp(ds->srna->identifier, type) == 0)
 			return ds->dnaname;
 
 	return NULL;
@@ -368,7 +367,7 @@ static const char *rna_find_dna_type(const char *type)
 
 static const char *rna_type_type_name(PropertyRNA *prop)
 {
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_BOOLEAN:
 		case PROP_INT:
 		case PROP_ENUM:
@@ -376,7 +375,7 @@ static const char *rna_type_type_name(PropertyRNA *prop)
 		case PROP_FLOAT:
 			return "float";
 		case PROP_STRING:
-			if(prop->flag & PROP_THICK_WRAP) {
+			if (prop->flag & PROP_THICK_WRAP) {
 				return "char*";
 			}
 			else {
@@ -391,9 +390,9 @@ static const char *rna_type_type(PropertyRNA *prop)
 {
 	const char *type;
 
-	type= rna_type_type_name(prop);
+	type = rna_type_type_name(prop);
 
-	if(type)
+	if (type)
 		return type;
 
 	return "PointerRNA";
@@ -403,9 +402,9 @@ static const char *rna_type_struct(PropertyRNA *prop)
 {
 	const char *type;
 
-	type= rna_type_type_name(prop);
+	type = rna_type_type_name(prop);
 
-	if(type)
+	if (type)
 		return "";
 
 	return "struct ";
@@ -415,16 +414,16 @@ static const char *rna_parameter_type_name(PropertyRNA *parm)
 {
 	const char *type;
 
-	type= rna_type_type_name(parm);
+	type = rna_type_type_name(parm);
 
-	if(type)
+	if (type)
 		return type;
 
-	switch(parm->type) {
+	switch (parm->type) {
 		case PROP_POINTER:  {
-			PointerPropertyRNA *pparm= (PointerPropertyRNA*)parm;
+			PointerPropertyRNA *pparm = (PointerPropertyRNA*)parm;
 
-			if(parm->flag & PROP_RNAPTR)
+			if (parm->flag & PROP_RNAPTR)
 				return "PointerRNA";
 			else
 				return rna_find_dna_type((const char *)pparm->type);
@@ -439,12 +438,12 @@ static const char *rna_parameter_type_name(PropertyRNA *parm)
 
 static int rna_enum_bitmask(PropertyRNA *prop)
 {
-	EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
-	int a, mask= 0;
+	EnumPropertyRNA *eprop = (EnumPropertyRNA*)prop;
+	int a, mask = 0;
 
-	if(eprop->item) {
-		for(a=0; a<eprop->totitem; a++)
-			if(eprop->item[a].identifier[0])
+	if (eprop->item) {
+		for (a = 0; a<eprop->totitem; a++)
+			if (eprop->item[a].identifier[0])
 				mask |= eprop->item[a].value;
 	}
 	
@@ -454,7 +453,7 @@ static int rna_enum_bitmask(PropertyRNA *prop)
 static int rna_color_quantize(PropertyRNA *prop, PropertyDefRNA *dp)
 {
 	return ( (prop->type == PROP_FLOAT) &&
-	         (prop->subtype==PROP_COLOR || prop->subtype==PROP_COLOR_GAMMA) &&
+	         (prop->subtype == PROP_COLOR || prop->subtype == PROP_COLOR_GAMMA) &&
 	         (IS_DNATYPE_FLOAT_COMPAT(dp->dnatype) == 0) );
 }
 
@@ -465,52 +464,55 @@ static const char *rna_function_string(void *func)
 
 static void rna_float_print(FILE *f, float num)
 {
-	if(num == -FLT_MAX) fprintf(f, "-FLT_MAX");
-	else if(num == FLT_MAX) fprintf(f, "FLT_MAX");
-	else if((int)num == num) fprintf(f, "%.1ff", num);
+	if (num == -FLT_MAX) fprintf(f, "-FLT_MAX");
+	else if (num == FLT_MAX) fprintf(f, "FLT_MAX");
+	else if ((int)num == num) fprintf(f, "%.1ff", num);
 	else fprintf(f, "%.10ff", num);
 }
 
 static void rna_int_print(FILE *f, int num)
 {
-	if(num == INT_MIN) fprintf(f, "INT_MIN");
-	else if(num == INT_MAX) fprintf(f, "INT_MAX");
+	if (num == INT_MIN) fprintf(f, "INT_MIN");
+	else if (num == INT_MAX) fprintf(f, "INT_MAX");
 	else fprintf(f, "%d", num);
 }
 
-static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
+static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
+                                       const char *manualfunc)
 {
 	char *func;
 
-	if(prop->flag & PROP_IDPROPERTY && manualfunc==NULL)
+	if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL)
 		return NULL;
 
-	if(!manualfunc) {
-		if(!dp->dnastructname || !dp->dnaname) {
+	if (!manualfunc) {
+		if (!dp->dnastructname || !dp->dnaname) {
 			fprintf(stderr, "%s (0): %s.%s has no valid dna info.\n",
 			        __func__, srna->identifier, prop->identifier);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 			return NULL;
 		}
 
 		/* typecheck,  */
-		if(dp->dnatype && *dp->dnatype) {
+		if (dp->dnatype && *dp->dnatype) {
 
-			if(prop->type == PROP_FLOAT) {
-				if(IS_DNATYPE_FLOAT_COMPAT(dp->dnatype) == 0) {
-					if(prop->subtype != PROP_COLOR_GAMMA) { /* colors are an exception. these get translated */
+			if (prop->type == PROP_FLOAT) {
+				if (IS_DNATYPE_FLOAT_COMPAT(dp->dnatype) == 0) {
+					if (prop->subtype != PROP_COLOR_GAMMA) { /* colors are an exception. these get translated */
 						fprintf(stderr, "%s (1): %s.%s is a '%s' but wrapped as type '%s'.\n",
-						        __func__, srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type));
-						DefRNA.error= 1;
+						        __func__, srna->identifier, prop->identifier, dp->dnatype,
+						        RNA_property_typename(prop->type));
+						DefRNA.error = 1;
 						return NULL;
 					}
 				}
 			}
-			else if(prop->type == PROP_INT || prop->type == PROP_BOOLEAN || prop->type == PROP_ENUM) {
-				if(IS_DNATYPE_INT_COMPAT(dp->dnatype) == 0) {
+			else if (prop->type == PROP_INT || prop->type == PROP_BOOLEAN || prop->type == PROP_ENUM) {
+				if (IS_DNATYPE_INT_COMPAT(dp->dnatype) == 0) {
 					fprintf(stderr, "%s (2): %s.%s is a '%s' but wrapped as type '%s'.\n",
-					        __func__, srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type));
-					DefRNA.error= 1;
+					        __func__, srna->identifier, prop->identifier, dp->dnatype,
+					        RNA_property_typename(prop->type));
+					DefRNA.error = 1;
 					return NULL;
 				}
 			}
@@ -518,29 +520,38 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
 
 	}
 
-	func= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get");
+	func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get");
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_STRING: {
-			StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
+			StringPropertyRNA *sprop = (StringPropertyRNA*)prop;
 			fprintf(f, "void %s(PointerRNA *ptr, char *value)\n", func);
 			fprintf(f, "{\n");
-			if(manualfunc) {
+			if (manualfunc) {
 				fprintf(f, "	%s(ptr, value);\n", manualfunc);
 			}
 			else {
-				const PropertySubType subtype= prop->subtype;
-				const char *string_copy_func= (subtype==PROP_FILEPATH ||
-				                               subtype==PROP_DIRPATH  ||
-				                               subtype==PROP_FILENAME ||
-				                               subtype==PROP_BYTESTRING) ?
+				const PropertySubType subtype = prop->subtype;
+				const char *string_copy_func = (subtype == PROP_FILEPATH ||
+				                               subtype == PROP_DIRPATH  ||
+				                               subtype == PROP_FILENAME ||
+				                               subtype == PROP_BYTESTRING) ?
 				            "BLI_strncpy" : "BLI_strncpy_utf8";
 
 				rna_print_data_get(f, dp);
-				if(sprop->maxlength)
+
+				if (!(prop->flag & PROP_NEVER_NULL)) {
+					fprintf(f, "	if (data->%s == NULL) {\n", dp->dnaname);
+					fprintf(f, "		*value = '\\0';\n");
+					fprintf(f, "		return;\n");
+					fprintf(f, "	}\n");
+				}
+
+				if (sprop->maxlength)
 					fprintf(f, "	%s(value, data->%s, %d);\n", string_copy_func, dp->dnaname, sprop->maxlength);
 				else
-					fprintf(f, "	%s(value, data->%s, sizeof(data->%s));\n", string_copy_func, dp->dnaname, dp->dnaname);
+					fprintf(f, "	%s(value, data->%s, sizeof(data->%s));\n", string_copy_func,
+					        dp->dnaname, dp->dnaname);
 			}
 			fprintf(f, "}\n\n");
 			break;
@@ -548,80 +559,99 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
 		case PROP_POINTER: {
 			fprintf(f, "PointerRNA %s(PointerRNA *ptr)\n", func);
 			fprintf(f, "{\n");
-			if(manualfunc) {
+			if (manualfunc) {
 				fprintf(f, "	return %s(ptr);\n", manualfunc);
 			}
 			else {
-				PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
+				PointerPropertyRNA *pprop = (PointerPropertyRNA*)prop;
 				rna_print_data_get(f, dp);
-				if(dp->dnapointerlevel == 0)
-					fprintf(f, "	return rna_pointer_inherit_refine(ptr, &RNA_%s, &data->%s);\n", (const char*)pprop->type, dp->dnaname);
+				if (dp->dnapointerlevel == 0)
+					fprintf(f, "	return rna_pointer_inherit_refine(ptr, &RNA_%s, &data->%s);\n",
+					        (const char*)pprop->type, dp->dnaname);
 				else
-					fprintf(f, "	return rna_pointer_inherit_refine(ptr, &RNA_%s, data->%s);\n", (const char*)pprop->type, dp->dnaname);
+					fprintf(f, "	return rna_pointer_inherit_refine(ptr, &RNA_%s, data->%s);\n",
+					        (const char*)pprop->type, dp->dnaname);
 			}
 			fprintf(f, "}\n\n");
 			break;
 		}
 		case PROP_COLLECTION: {
-			CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
+			CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)prop;
 
 			fprintf(f, "static PointerRNA %s(CollectionPropertyIterator *iter)\n", func);
 			fprintf(f, "{\n");
-			if(manualfunc) {
-				if(strcmp(manualfunc, "rna_iterator_listbase_get") == 0 ||
-				   strcmp(manualfunc, "rna_iterator_array_get") == 0 ||
-				   strcmp(manualfunc, "rna_iterator_array_dereference_get") == 0)
-					fprintf(f, "	return rna_pointer_inherit_refine(&iter->parent, &RNA_%s, %s(iter));\n", (cprop->item_type)? (const char*)cprop->item_type: "UnknownType", manualfunc);
-				else
+			if (manualfunc) {
+				if (strcmp(manualfunc, "rna_iterator_listbase_get") == 0 ||
+				    strcmp(manualfunc, "rna_iterator_array_get") == 0 ||
+				    strcmp(manualfunc, "rna_iterator_array_dereference_get") == 0)
+				{
+					fprintf(f, "	return rna_pointer_inherit_refine(&iter->parent, &RNA_%s, %s(iter));\n",
+					        (cprop->item_type) ? (const char *)cprop->item_type: "UnknownType", manualfunc);
+				}
+				else {
 					fprintf(f, "	return %s(iter);\n", manualfunc);
+				}
 			}
 			fprintf(f, "}\n\n");
 			break;
 		}
 		default:
-			if(prop->arraydimension) {
-				if(prop->flag & PROP_DYNAMIC)
+			if (prop->arraydimension) {
+				if (prop->flag & PROP_DYNAMIC)
 					fprintf(f, "void %s(PointerRNA *ptr, %s values[])\n", func, rna_type_type(prop));
 				else
-					fprintf(f, "void %s(PointerRNA *ptr, %s values[%u])\n", func, rna_type_type(prop), prop->totarraylength);
+					fprintf(f, "void %s(PointerRNA *ptr, %s values[%u])\n", func, rna_type_type(prop),
+					        prop->totarraylength);
 				fprintf(f, "{\n");
 
-				if(manualfunc) {
+				if (manualfunc) {
 					fprintf(f, "	%s(ptr, values);\n", manualfunc);
 				}
 				else {
 					rna_print_data_get(f, dp);
 
-					if(prop->flag & PROP_DYNAMIC) {
-						char *lenfunc= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get_length");
+					if (prop->flag & PROP_DYNAMIC) {
+						char *lenfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier),
+						                                        "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", (dp->booleannegative)? "!": "", dp->dnaname, dp->booleanbit);
-						else
-							fprintf(f, "		values[i]= (%s)%s((&data->%s)[i]);\n", rna_type_type(prop), (dp->booleannegative)? "!": "", dp->dnaname);
+					if (dp->dnaarraylength == 1) {
+						if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
+							fprintf(f, "		values[i]= %s((data->%s & (%d<<i)) != 0);\n",
+							        (dp->booleannegative)? "!": "", dp->dnaname, dp->booleanbit);
+						}
+						else {
+							fprintf(f, "		values[i]= (%s)%s((&data->%s)[i]);\n",
+							        rna_type_type(prop), (dp->booleannegative)? "!": "", dp->dnaname);
+						}
 					}
 					else {
-						if(prop->type == PROP_BOOLEAN && dp->booleanbit) {
-							fprintf(f, "		values[i]= %s((data->%s[i] & ", (dp->booleannegative)? "!": "", dp->dnaname);
+						if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
+							fprintf(f, "		values[i]= %s((data->%s[i] & ", (dp->booleannegative)? "!": "",
+							        dp->dnaname);
 							rna_int_print(f, dp->booleanbit);
 							fprintf(f, ") != 0);\n");
 						}
-						else if(rna_color_quantize(prop, dp))
-							fprintf(f, "		values[i]= (%s)(data->%s[i]*(1.0f/255.0f));\n", rna_type_type(prop), dp->dnaname);
-						else if(dp->dnatype)
-							fprintf(f, "		values[i]= (%s)%s(((%s*)data->%s)[i]);\n", rna_type_type(prop), (dp->booleannegative)? "!": "", dp->dnatype, dp->dnaname);
-						else
-							fprintf(f, "		values[i]= (%s)%s((data->%s)[i]);\n", rna_type_type(prop), (dp->booleannegative)? "!": "", dp->dnaname);
+						else if (rna_color_quantize(prop, dp)) {
+							fprintf(f, "		values[i]= (%s)(data->%s[i]*(1.0f/255.0f));\n",
+							        rna_type_type(prop), dp->dnaname);
+						}
+						else if (dp->dnatype) {
+							fprintf(f, "		values[i]= (%s)%s(((%s*)data->%s)[i]);\n",
+							        rna_type_type(prop), (dp->booleannegative)? "!": "", dp->dnatype, dp->dnaname);
+						}
+						else {
+							fprintf(f, "		values[i]= (%s)%s((data->%s)[i]);\n",
+							        rna_type_type(prop), (dp->booleannegative)? "!": "", dp->dnaname);
+						}
 					}
 					fprintf(f, "	}\n");
 				}
@@ -631,23 +661,24 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
 				fprintf(f, "%s %s(PointerRNA *ptr)\n", rna_type_type(prop), func);
 				fprintf(f, "{\n");
 
-				if(manualfunc) {
+				if (manualfunc) {
 					fprintf(f, "	return %s(ptr);\n", manualfunc);
 				}
 				else {
 					rna_print_data_get(f, dp);
-					if(prop->type == PROP_BOOLEAN && dp->booleanbit) {
+					if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
 						fprintf(f, "	return %s(((data->%s) & ", (dp->booleannegative)? "!": "", dp->dnaname);
 						rna_int_print(f, dp->booleanbit);
 						fprintf(f, ") != 0);\n");
 					}
-					else if(prop->type == PROP_ENUM && dp->enumbitflags) {
+					else if (prop->type == PROP_ENUM && dp->enumbitflags) {
 						fprintf(f, "	return ((data->%s) & ", dp->dnaname);
 						rna_int_print(f, rna_enum_bitmask(prop));
 						fprintf(f, ");\n");
 					}
 					else
-						fprintf(f, "	return (%s)%s(data->%s);\n", rna_type_type(prop), (dp->booleannegative)? "!": "", dp->dnaname);
+						fprintf(f, "	return (%s)%s(data->%s);\n", rna_type_type(prop),
+						        (dp->booleannegative)? "!": "", dp->dnaname);
 				}
 
 				fprintf(f, "}\n\n");
@@ -661,31 +692,34 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
 /* defined min/max variables to be used by rna_clamp_value() */
 static void rna_clamp_value_range(FILE *f, PropertyRNA *prop)
 {
-	if(prop->type == PROP_FLOAT) {
-		FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
-		if(fprop->range) {
-			fprintf(f, "	float prop_clamp_min, prop_clamp_max;\n");
-			fprintf(f, "	%s(ptr, &prop_clamp_min, &prop_clamp_max);\n", rna_function_string(fprop->range));
+	if (prop->type == PROP_FLOAT) {
+		FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
+		if (fprop->range) {
+			fprintf(f,
+			        "	float prop_clamp_min = -FLT_MAX, prop_clamp_max = FLT_MAX, prop_soft_min, prop_soft_max;\n");
+			fprintf(f, "	%s(ptr, &prop_clamp_min, &prop_clamp_max, &prop_soft_min, &prop_soft_max);\n",
+			        rna_function_string(fprop->range));
 		}
 	}
-	else if(prop->type == PROP_INT) {
-		IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
-		if(iprop->range) {
-			fprintf(f, "	int prop_clamp_min, prop_clamp_max;\n");
-			fprintf(f, "	%s(ptr, &prop_clamp_min, &prop_clamp_max);\n", rna_function_string(iprop->range));
+	else if (prop->type == PROP_INT) {
+		IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
+		if (iprop->range) {
+			fprintf(f, "	int prop_clamp_min = INT_MIN, prop_clamp_max = INT_MAX, prop_soft_min, prop_soft_max;\n");
+			fprintf(f, "	%s(ptr, &prop_clamp_min, &prop_clamp_max, &prop_soft_min, &prop_soft_max);\n",
+			        rna_function_string(iprop->range));
 		}
 	}
 }
 
 static void rna_clamp_value(FILE *f, PropertyRNA *prop, int array)
 {
-	if(prop->type == PROP_INT) {
-		IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
+	if (prop->type == PROP_INT) {
+		IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
 
-		if(iprop->hardmin != INT_MIN || iprop->hardmax != INT_MAX) {
-			if(array) fprintf(f, "CLAMPIS(values[i], ");
+		if (iprop->hardmin != INT_MIN || iprop->hardmax != INT_MAX) {
+			if (array) fprintf(f, "CLAMPIS(values[i], ");
 			else fprintf(f, "CLAMPIS(value, ");
-			if(iprop->range) {
+			if (iprop->range) {
 				fprintf(f, "prop_clamp_min, prop_clamp_max);");
 			}
 			else {
@@ -695,13 +729,13 @@ static void rna_clamp_value(FILE *f, PropertyRNA *prop, int array)
 			return;
 		}
 	}
-	else if(prop->type == PROP_FLOAT) {
-		FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
+	else if (prop->type == PROP_FLOAT) {
+		FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
 
-		if(fprop->hardmin != -FLT_MAX || fprop->hardmax != FLT_MAX) {
-			if(array) fprintf(f, "CLAMPIS(values[i], ");
+		if (fprop->hardmin != -FLT_MAX || fprop->hardmax != FLT_MAX) {
+			if (array) fprintf(f, "CLAMPIS(values[i], ");
 			else fprintf(f, "CLAMPIS(value, ");
-			if(fprop->range) {
+			if (fprop->range) {
 				fprintf(f, "prop_clamp_min, prop_clamp_max);");
 			}
 			else {
@@ -712,55 +746,64 @@ static void rna_clamp_value(FILE *f, PropertyRNA *prop, int array)
 		}
 	}
 
-	if(array)
+	if (array)
 		fprintf(f, "values[i];\n");
 	else
 		fprintf(f, "value;\n");
 }
 
-static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
+static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
+                                       const char *manualfunc)
 {
 	char *func;
 
-	if(!(prop->flag & PROP_EDITABLE))
+	if (!(prop->flag & PROP_EDITABLE))
 		return NULL;
-	if(prop->flag & PROP_IDPROPERTY && manualfunc==NULL)
+	if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL)
 		return NULL;
 
-	if(!manualfunc) {
-		if(!dp->dnastructname || !dp->dnaname) {
-			if(prop->flag & PROP_EDITABLE) {
+	if (!manualfunc) {
+		if (!dp->dnastructname || !dp->dnaname) {
+			if (prop->flag & PROP_EDITABLE) {
 				fprintf(stderr, "%s: %s.%s has no valid dna info.\n",
 				        __func__, srna->identifier, prop->identifier);
-				DefRNA.error= 1;
+				DefRNA.error = 1;
 			}
 			return NULL;
 		}
 	}
 
-	func= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "set");
+	func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "set");
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_STRING: {
-			StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
+			StringPropertyRNA *sprop = (StringPropertyRNA*)prop;
 			fprintf(f, "void %s(PointerRNA *ptr, const char *value)\n", func);
 			fprintf(f, "{\n");
-			if(manualfunc) {
+			if (manualfunc) {
 				fprintf(f, "	%s(ptr, value);\n", manualfunc);
 			}
 			else {
-				const PropertySubType subtype= prop->subtype;
-				const char *string_copy_func= (subtype==PROP_FILEPATH ||
-				                               subtype==PROP_DIRPATH  ||
-				                               subtype==PROP_FILENAME ||
-				                               subtype==PROP_BYTESTRING) ?
+				const PropertySubType subtype = prop->subtype;
+				const char *string_copy_func = (subtype == PROP_FILEPATH ||
+				                               subtype == PROP_DIRPATH  ||
+				                               subtype == PROP_FILENAME ||
+				                               subtype == PROP_BYTESTRING) ?
 				            "BLI_strncpy" : "BLI_strncpy_utf8";
 
 				rna_print_data_get(f, dp);
-				if(sprop->maxlength)
+
+				if (!(prop->flag & PROP_NEVER_NULL)) {
+					fprintf(f, "	if (data->%s == NULL) {\n", dp->dnaname);
+					fprintf(f, "		return;\n");
+					fprintf(f, "	}\n");
+				}
+
+				if (sprop->maxlength)
 					fprintf(f, "	%s(data->%s, value, %d);\n", string_copy_func, dp->dnaname, sprop->maxlength);
 				else
-					fprintf(f, "	%s(data->%s, value, sizeof(data->%s));\n", string_copy_func, dp->dnaname, dp->dnaname);
+					fprintf(f, "	%s(data->%s, value, sizeof(data->%s));\n", string_copy_func,
+					        dp->dnaname, dp->dnaname);
 			}
 			fprintf(f, "}\n\n");
 			break;
@@ -768,28 +811,28 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
 		case PROP_POINTER: {
 			fprintf(f, "void %s(PointerRNA *ptr, PointerRNA value)\n", func);
 			fprintf(f, "{\n");
-			if(manualfunc) {
+			if (manualfunc) {
 				fprintf(f, "	%s(ptr, value);\n", manualfunc);
 			}
 			else {
 				rna_print_data_get(f, dp);
 
-				if(prop->flag & PROP_ID_SELF_CHECK) {
+				if (prop->flag & PROP_ID_SELF_CHECK) {
 					rna_print_id_get(f, dp);
-					fprintf(f, "	if(id==value.data) return;\n\n");
+					fprintf(f, "	if (id==value.data) return;\n\n");
 				}
 
-				if(prop->flag & PROP_ID_REFCOUNT) {
-					fprintf(f, "\n	if(data->%s)\n", dp->dnaname);
+				if (prop->flag & PROP_ID_REFCOUNT) {
+					fprintf(f, "\n	if (data->%s)\n", dp->dnaname);
 					fprintf(f, "		id_us_min((ID*)data->%s);\n", dp->dnaname);
-					fprintf(f, "	if(value.data)\n");
+					fprintf(f, "	if (value.data)\n");
 					fprintf(f, "		id_us_plus((ID*)value.data);\n\n");
 				}
 				else {
-					PointerPropertyRNA *pprop= (PointerPropertyRNA*)dp->prop;
-					StructRNA *type= rna_find_struct((const char*)pprop->type);
-					if(type && (type->flag & STRUCT_ID)) {
-						fprintf(f, "	if(value.data)\n");
+					PointerPropertyRNA *pprop = (PointerPropertyRNA*)dp->prop;
+					StructRNA *type = rna_find_struct((const char*)pprop->type);
+					if (type && (type->flag & STRUCT_ID)) {
+						fprintf(f, "	if (value.data)\n");
 						fprintf(f, "		id_lib_extern((ID*)value.data);\n\n");
 					}
 				}
@@ -801,60 +844,65 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
 			break;
 		}
 		default:
-			if(prop->arraydimension) {
-				if(prop->flag & PROP_DYNAMIC)
+			if (prop->arraydimension) {
+				if (prop->flag & PROP_DYNAMIC)
 					fprintf(f, "void %s(PointerRNA *ptr, const %s values[])\n", func, rna_type_type(prop));
 				else
-					fprintf(f, "void %s(PointerRNA *ptr, const %s values[%u])\n", func, rna_type_type(prop), prop->totarraylength);
+					fprintf(f, "void %s(PointerRNA *ptr, const %s values[%u])\n", func,
+					        rna_type_type(prop), prop->totarraylength);
 				fprintf(f, "{\n");
 
-				if(manualfunc) {
+				if (manualfunc) {
 					fprintf(f, "	%s(ptr, values);\n", manualfunc);
 				}
 				else {
 					rna_print_data_get(f, dp);
 
-					if(prop->flag & PROP_DYNAMIC) {
-						char *lenfunc= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "set_length");
+					if (prop->flag & PROP_DYNAMIC) {
+						char *lenfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier),
+						                                        "set_length");
 						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);
+					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);
 						}
 						else {
-							fprintf(f, "		(&data->%s)[i]= %s", dp->dnaname, (dp->booleannegative)? "!": "");
+							fprintf(f, "		(&data->%s)[i]= %s", dp->dnaname, (dp->booleannegative) ? "!" : "");
 							rna_clamp_value(f, prop, 1);
 						}
 					}
 					else {
-						if(prop->type == PROP_BOOLEAN && dp->booleanbit) {
-							fprintf(f, "		if(%svalues[i]) data->%s[i] |= ", (dp->booleannegative)? "!": "", dp->dnaname);
+						if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
+							fprintf(f, "		if (%svalues[i]) data->%s[i] |= ", (dp->booleannegative) ? "!" : "",
+							        dp->dnaname);
 							rna_int_print(f, dp->booleanbit);
 							fprintf(f, ";\n");
 							fprintf(f, "		else data->%s[i] &= ~", dp->dnaname);
 							rna_int_print(f, dp->booleanbit);
 							fprintf(f, ";\n");
 						}
-						else if(rna_color_quantize(prop, dp)) {
+						else if (rna_color_quantize(prop, dp)) {
 							fprintf(f, "		data->%s[i]= FTOCHAR(values[i]);\n", dp->dnaname);
 						}
 						else {
-							if(dp->dnatype)
-								fprintf(f, "		((%s*)data->%s)[i]= %s", dp->dnatype, dp->dnaname, (dp->booleannegative)? "!": "");
+							if (dp->dnatype)
+								fprintf(f, "		((%s*)data->%s)[i]= %s", dp->dnatype, dp->dnaname,
+								        (dp->booleannegative) ? "!" : "");
 							else
-								fprintf(f, "		(data->%s)[i]= %s", dp->dnaname, (dp->booleannegative)? "!": "");
+								fprintf(f, "		(data->%s)[i]= %s", dp->dnaname, (dp->booleannegative) ? "!" : "");
 							rna_clamp_value(f, prop, 1);
 						}
 					}
@@ -866,20 +914,20 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
 				fprintf(f, "void %s(PointerRNA *ptr, %s value)\n", func, rna_type_type(prop));
 				fprintf(f, "{\n");
 
-				if(manualfunc) {
+				if (manualfunc) {
 					fprintf(f, "	%s(ptr, value);\n", manualfunc);
 				}
 				else {
 					rna_print_data_get(f, dp);
-					if(prop->type == PROP_BOOLEAN && dp->booleanbit) {
-						fprintf(f, "	if(%svalue) data->%s |= ", (dp->booleannegative)? "!": "", dp->dnaname);
+					if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
+						fprintf(f, "	if (%svalue) data->%s |= ", (dp->booleannegative) ? "!" : "", dp->dnaname);
 						rna_int_print(f, dp->booleanbit);
 						fprintf(f, ";\n");
 						fprintf(f, "	else data->%s &= ~", dp->dnaname);
 						rna_int_print(f, dp->booleanbit);
 						fprintf(f, ";\n");
 					}
-					else if(prop->type == PROP_ENUM && dp->enumbitflags) {
+					else if (prop->type == PROP_ENUM && dp->enumbitflags) {
 						fprintf(f, "	data->%s &= ~", dp->dnaname);
 						rna_int_print(f, rna_enum_bitmask(prop));
 						fprintf(f, ";\n");
@@ -887,7 +935,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
 					}
 					else {
 						rna_clamp_value_range(f, prop);
-						fprintf(f, "	data->%s= %s", dp->dnaname, (dp->booleannegative)? "!": "");
+						fprintf(f, "	data->%s= %s", dp->dnaname, (dp->booleannegative) ? "!" : "");
 						rna_clamp_value(f, prop, 0);
 					}
 				}
@@ -899,56 +947,60 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
 	return func;
 }
 
-static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
+static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
+                                          const char *manualfunc)
 {
-	char *func= NULL;
+	char *func = NULL;
 
-	if(prop->flag & PROP_IDPROPERTY && manualfunc==NULL)
+	if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL)
 		return NULL;
 
-	if(prop->type == PROP_STRING) {
-		if(!manualfunc) {
-			if(!dp->dnastructname || !dp->dnaname) {
+	if (prop->type == PROP_STRING) {
+		if (!manualfunc) {
+			if (!dp->dnastructname || !dp->dnaname) {
 				fprintf(stderr, "%s: %s.%s has no valid dna info.\n",
 				        __func__, srna->identifier, prop->identifier);
-				DefRNA.error= 1;
+				DefRNA.error = 1;
 				return NULL;
 			}
 		}
 
-		func= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "length");
+		func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "length");
 
 		fprintf(f, "int %s(PointerRNA *ptr)\n", func);
 		fprintf(f, "{\n");
-		if(manualfunc) {
+		if (manualfunc) {
 			fprintf(f, "	return %s(ptr);\n", manualfunc);
 		}
 		else {
 			rna_print_data_get(f, dp);
+			if (!(prop->flag & PROP_NEVER_NULL)) {
+				fprintf(f, "	if (data->%s == NULL) return 0;\n", dp->dnaname);
+			}
 			fprintf(f, "	return strlen(data->%s);\n", dp->dnaname);
 		}
 		fprintf(f, "}\n\n");
 	}
-	else if(prop->type == PROP_COLLECTION) {
-		if(!manualfunc) {
-			if(prop->type == PROP_COLLECTION && (!(dp->dnalengthname || dp->dnalengthfixed)|| !dp->dnaname)) {
+	else if (prop->type == PROP_COLLECTION) {
+		if (!manualfunc) {
+			if (prop->type == PROP_COLLECTION && (!(dp->dnalengthname || dp->dnalengthfixed)|| !dp->dnaname)) {
 				fprintf(stderr, "%s: %s.%s has no valid dna info.\n",
 				        __func__, srna->identifier, prop->identifier);
-				DefRNA.error= 1;
+				DefRNA.error = 1;
 				return NULL;
 			}
 		}
 
-		func= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "length");
+		func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "length");
 
 		fprintf(f, "int %s(PointerRNA *ptr)\n", func);
 		fprintf(f, "{\n");
-		if(manualfunc) {
+		if (manualfunc) {
 			fprintf(f, "	return %s(ptr);\n", manualfunc);
 		}
 		else {
 			rna_print_data_get(f, dp);
-			if(dp->dnalengthname)
+			if (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);
@@ -959,57 +1011,60 @@ static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA
 	return func;
 }
 
-static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
+static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
+                                         const char *manualfunc)
 {
 	char *func, *getfunc;
 
-	if(prop->flag & PROP_IDPROPERTY && manualfunc==NULL)
+	if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL)
 		return NULL;
 
-	if(!manualfunc) {
-		if(!dp->dnastructname || !dp->dnaname) {
+	if (!manualfunc) {
+		if (!dp->dnastructname || !dp->dnaname) {
 			fprintf(stderr, "%s: %s.%s has no valid dna info.\n",
 			        __func__, srna->identifier, prop->identifier);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 			return NULL;
 		}
 	}
 
-	func= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "begin");
+	func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "begin");
 
 	fprintf(f, "void %s(CollectionPropertyIterator *iter, PointerRNA *ptr)\n", func);
 	fprintf(f, "{\n");
 
-	if(!manualfunc)
+	if (!manualfunc)
 		rna_print_data_get(f, dp);
 
 	fprintf(f, "\n	memset(iter, 0, sizeof(*iter));\n");
 	fprintf(f, "	iter->parent= *ptr;\n");
 	fprintf(f, "	iter->prop= (PropertyRNA*)&rna_%s_%s;\n", srna->identifier, prop->identifier);
 
-	if(dp->dnalengthname || dp->dnalengthfixed) {
-		if(manualfunc) {
+	if (dp->dnalengthname || dp->dnalengthfixed) {
+		if (manualfunc) {
 			fprintf(f, "\n	%s(iter, ptr);\n", manualfunc);
 		}
 		else {
-			if(dp->dnalengthname)
-				fprintf(f, "\n	rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), data->%s, 0, NULL);\n", dp->dnaname, dp->dnaname, dp->dnalengthname);
+			if (dp->dnalengthname)
+				fprintf(f, "\n	rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), data->%s, 0, NULL);\n",
+				        dp->dnaname, dp->dnaname, dp->dnalengthname);
 			else
-				fprintf(f, "\n	rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), %d, 0, NULL);\n", dp->dnaname, dp->dnaname, dp->dnalengthfixed);
+				fprintf(f, "\n	rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), %d, 0, NULL);\n",
+				        dp->dnaname, dp->dnaname, dp->dnalengthfixed);
 		}
 	}
 	else {
-		if(manualfunc)
+		if (manualfunc)
 			fprintf(f, "\n	%s(iter, ptr);\n", manualfunc);
-		else if(dp->dnapointerlevel == 0)
+		else if (dp->dnapointerlevel == 0)
 			fprintf(f, "\n	rna_iterator_listbase_begin(iter, &data->%s, NULL);\n", dp->dnaname);
 		else
 			fprintf(f, "\n	rna_iterator_listbase_begin(iter, data->%s, NULL);\n", dp->dnaname);
 	}
 
-	getfunc= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get");
+	getfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get");
 
-	fprintf(f, "\n	if(iter->valid)\n");
+	fprintf(f, "\n	if (iter->valid)\n");
 	fprintf(f, "		iter->ptr= %s(iter);\n", getfunc);
 
 	fprintf(f, "}\n\n");
@@ -1018,31 +1073,32 @@ static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *
 	return func;
 }
 
-static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc, const char *nextfunc)
+static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
+                                              const char *manualfunc, const char *nextfunc)
 {
 	/* note on indices, this is for external functions and ignores skipped values.
 	 * so the the index can only be checked against the length when there is no 'skip' funcion. */
 	char *func;
 
-	if(prop->flag & PROP_IDPROPERTY && manualfunc==NULL)
+	if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL)
 		return NULL;
 
-	if(!manualfunc) {
-		if(!dp->dnastructname || !dp->dnaname)
+	if (!manualfunc) {
+		if (!dp->dnastructname || !dp->dnaname)
 			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;
 	}
 
-	func= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "lookup_int");
+	func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "lookup_int");
 
 	fprintf(f, "int %s(PointerRNA *ptr, int index, PointerRNA *r_ptr)\n", func);
 	fprintf(f, "{\n");
 
-	if(manualfunc) {
+	if (manualfunc) {
 		fprintf(f, "\n	return %s(ptr, index, r_ptr);\n", manualfunc);
 		fprintf(f, "}\n\n");
 		return func;
@@ -1052,19 +1108,19 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property
 	fprintf(f, "	CollectionPropertyIterator iter;\n\n");
 
 	fprintf(f, "	%s_%s_begin(&iter, ptr);\n\n", srna->identifier, rna_safe_id(prop->identifier));
-	fprintf(f, "	if(iter.valid){\n");
+	fprintf(f, "	if (iter.valid) {\n");
 
-	if(strcmp(nextfunc, "rna_iterator_array_next") == 0) {
+	if (strcmp(nextfunc, "rna_iterator_array_next") == 0) {
 		fprintf(f, "		ArrayIterator *internal= iter.internal;\n");
-		fprintf(f, "		if(index < 0 || index >= internal->length) {\n");
+		fprintf(f, "		if (index < 0 || index >= internal->length) {\n");
 		fprintf(f, "#ifdef __GNUC__\n");
 		fprintf(f, "			printf(\"Array iterator out of range: %%s (index %%d)\\n\", __func__, index);\n");
 		fprintf(f, "#else\n");
 		fprintf(f, "			printf(\"Array iterator out of range: (index %%d)\\n\", index);\n");
 		fprintf(f, "#endif\n");
 		fprintf(f, "		}\n");
-		fprintf(f, "		else if(internal->skip) {\n");
-		fprintf(f, "			while(index-- > 0 && iter.valid) {\n");
+		fprintf(f, "		else if (internal->skip) {\n");
+		fprintf(f, "			while (index-- > 0 && iter.valid) {\n");
 		fprintf(f, "				rna_iterator_array_next(&iter);\n");
 		fprintf(f, "			}\n");
 		fprintf(f, "			found= (index == -1 && iter.valid);\n");
@@ -1074,22 +1130,22 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property
 		fprintf(f, "			found= 1;\n");
 		fprintf(f, "		}\n");
 	}
-	else if(strcmp(nextfunc, "rna_iterator_listbase_next") == 0) {
+	else if (strcmp(nextfunc, "rna_iterator_listbase_next") == 0) {
 		fprintf(f, "		ListBaseIterator *internal= iter.internal;\n");
-		fprintf(f, "		if(internal->skip) {\n");
-		fprintf(f, "			while(index-- > 0 && iter.valid) {\n");
+		fprintf(f, "		if (internal->skip) {\n");
+		fprintf(f, "			while (index-- > 0 && iter.valid) {\n");
 		fprintf(f, "				rna_iterator_listbase_next(&iter);\n");
 		fprintf(f, "			}\n");
 		fprintf(f, "			found= (index == -1 && iter.valid);\n");
 		fprintf(f, "		}\n");
 		fprintf(f, "		else {\n");
-		fprintf(f, "			while(index-- > 0 && internal->link)\n");
+		fprintf(f, "			while (index-- > 0 && internal->link)\n");
 		fprintf(f, "				internal->link= internal->link->next;\n");
 		fprintf(f, "			found= (index == -1 && internal->link);\n");
 		fprintf(f, "		}\n");
 	}
 
-	fprintf(f, "		if(found) *r_ptr = %s_%s_get(&iter);\n", srna->identifier, rna_safe_id(prop->identifier));
+	fprintf(f, "		if (found) *r_ptr = %s_%s_get(&iter);\n", srna->identifier, rna_safe_id(prop->identifier));
 	fprintf(f, "	}\n\n");
 	fprintf(f, "	%s_%s_end(&iter);\n\n", srna->identifier, rna_safe_id(prop->identifier));
 
@@ -1097,17 +1153,20 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property
 
 #if 0
 	rna_print_data_get(f, dp);
-	item_type= (cprop->item_type)? (const char*)cprop->item_type: "UnknownType";
+	item_type = (cprop->item_type)? (const char*)cprop->item_type: "UnknownType";
 
-	if(dp->dnalengthname || dp->dnalengthfixed) {
-		if(dp->dnalengthname)
-			fprintf(f, "\n	rna_array_lookup_int(ptr, &RNA_%s, data->%s, sizeof(data->%s[0]), data->%s, index);\n", item_type, dp->dnaname, dp->dnaname, dp->dnalengthname);
+	if (dp->dnalengthname || dp->dnalengthfixed) {
+		if (dp->dnalengthname)
+			fprintf(f, "\n	rna_array_lookup_int(ptr, &RNA_%s, data->%s, sizeof(data->%s[0]), data->%s, index);\n",
+			        item_type, dp->dnaname, dp->dnaname, dp->dnalengthname);
 		else
-			fprintf(f, "\n	rna_array_lookup_int(ptr, &RNA_%s, data->%s, sizeof(data->%s[0]), %d, index);\n", item_type, dp->dnaname, dp->dnaname, dp->dnalengthfixed);
+			fprintf(f, "\n	rna_array_lookup_int(ptr, &RNA_%s, data->%s, sizeof(data->%s[0]), %d, index);\n",
+			        item_type, dp->dnaname, dp->dnaname, dp->dnalengthfixed);
 	}
 	else {
-		if(dp->dnapointerlevel == 0)
-			fprintf(f, "\n	return rna_listbase_lookup_int(ptr, &RNA_%s, &data->%s, index);\n", item_type, dp->dnaname);
+		if (dp->dnapointerlevel == 0)
+			fprintf(f, "\n	return rna_listbase_lookup_int(ptr, &RNA_%s, &data->%s, index);\n",
+			        item_type, dp->dnaname);
 		else
 			fprintf(f, "\n	return rna_listbase_lookup_int(ptr, &RNA_%s, data->%s, index);\n", item_type, dp->dnaname);
 	}
@@ -1118,25 +1177,26 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property
 	return func;
 }
 
-static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
+static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
+                                        const char *manualfunc)
 {
 	char *func, *getfunc;
 
-	if(prop->flag & PROP_IDPROPERTY && manualfunc==NULL)
+	if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL)
 		return NULL;
 
-	if(!manualfunc)
+	if (!manualfunc)
 		return NULL;
 
-	func= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "next");
+	func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "next");
 
 	fprintf(f, "void %s(CollectionPropertyIterator *iter)\n", func);
 	fprintf(f, "{\n");
 	fprintf(f, "	%s(iter);\n", manualfunc);
 
-	getfunc= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get");
+	getfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get");
 
-	fprintf(f, "\n	if(iter->valid)\n");
+	fprintf(f, "\n	if (iter->valid)\n");
 	fprintf(f, "		iter->ptr= %s(iter);\n", getfunc);
 
 	fprintf(f, "}\n\n");
@@ -1144,18 +1204,19 @@ static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *p
 	return func;
 }
 
-static char *rna_def_property_end_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
+static char *rna_def_property_end_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
+                                       const char *manualfunc)
 {
 	char *func;
 
-	if(prop->flag & PROP_IDPROPERTY && manualfunc==NULL)
+	if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL)
 		return NULL;
 
-	func= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "end");
+	func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "end");
 
 	fprintf(f, "void %s(CollectionPropertyIterator *iter)\n", func);
 	fprintf(f, "{\n");
-	if(manualfunc)
+	if (manualfunc)
 		fprintf(f, "	%s(iter);\n", manualfunc);
 	fprintf(f, "}\n\n");
 
@@ -1164,36 +1225,36 @@ static char *rna_def_property_end_func(FILE *f, StructRNA *srna, PropertyRNA *pr
 
 static void rna_set_raw_property(PropertyDefRNA *dp, PropertyRNA *prop)
 {
-	if(dp->dnapointerlevel != 0)
+	if (dp->dnapointerlevel != 0)
 		return;
-	if(!dp->dnatype || !dp->dnaname || !dp->dnastructname)
+	if (!dp->dnatype || !dp->dnaname || !dp->dnastructname)
 		return;
 	
-	if(strcmp(dp->dnatype, "char") == 0) {
-		prop->rawtype= PROP_RAW_CHAR;
+	if (strcmp(dp->dnatype, "char") == 0) {
+		prop->rawtype = PROP_RAW_CHAR;
 		prop->flag |= PROP_RAW_ACCESS;
 	}
-	else if(strcmp(dp->dnatype, "short") == 0) {
-		prop->rawtype= PROP_RAW_SHORT;
+	else if (strcmp(dp->dnatype, "short") == 0) {
+		prop->rawtype = PROP_RAW_SHORT;
 		prop->flag |= PROP_RAW_ACCESS;
 	}
-	else if(strcmp(dp->dnatype, "int") == 0) {
-		prop->rawtype= PROP_RAW_INT;
+	else if (strcmp(dp->dnatype, "int") == 0) {
+		prop->rawtype = PROP_RAW_INT;
 		prop->flag |= PROP_RAW_ACCESS;
 	}
-	else if(strcmp(dp->dnatype, "float") == 0) {
-		prop->rawtype= PROP_RAW_FLOAT;
+	else if (strcmp(dp->dnatype, "float") == 0) {
+		prop->rawtype = PROP_RAW_FLOAT;
 		prop->flag |= PROP_RAW_ACCESS;
 	}
-	else if(strcmp(dp->dnatype, "double") == 0) {
-		prop->rawtype= PROP_RAW_DOUBLE;
+	else if (strcmp(dp->dnatype, "double") == 0) {
+		prop->rawtype = PROP_RAW_DOUBLE;
 		prop->flag |= PROP_RAW_ACCESS;
 	}
 }
 
 static void rna_set_raw_offset(FILE *f, StructRNA *srna, PropertyRNA *prop)
 {
-	PropertyDefRNA *dp= rna_find_struct_property_def(srna, prop);
+	PropertyDefRNA *dp = rna_find_struct_property_def(srna, prop);
 
 	fprintf(f, "\toffsetof(%s, %s), %d", dp->dnastructname, dp->dnaname, prop->rawtype);
 }
@@ -1202,132 +1263,133 @@ static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
 {
 	PropertyRNA *prop;
 
-	prop= dp->prop;
+	prop = dp->prop;
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_BOOLEAN: {
-			BoolPropertyRNA *bprop= (BoolPropertyRNA*)prop;
+			BoolPropertyRNA *bprop = (BoolPropertyRNA*)prop;
 
-			if(!prop->arraydimension) {
-				if(!bprop->get && !bprop->set && !dp->booleanbit)
+			if (!prop->arraydimension) {
+				if (!bprop->get && !bprop->set && !dp->booleanbit)
 					rna_set_raw_property(dp, prop);
 
-				bprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)bprop->get);
-				bprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)bprop->set);
+				bprop->get = (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)bprop->get);
+				bprop->set = (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)bprop->set);
 			}
 			else {
-				bprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)bprop->getarray);
-				bprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)bprop->setarray);
+				bprop->getarray = (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)bprop->getarray);
+				bprop->setarray = (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)bprop->setarray);
 			}
 			break;
 		}
 		case PROP_INT: {
-			IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
+			IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
 
-			if(!prop->arraydimension) {
-				if(!iprop->get && !iprop->set)
+			if (!prop->arraydimension) {
+				if (!iprop->get && !iprop->set)
 					rna_set_raw_property(dp, prop);
 
-				iprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)iprop->get);
-				iprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)iprop->set);
+				iprop->get = (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)iprop->get);
+				iprop->set = (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)iprop->set);
 			}
 			else {
-				if(!iprop->getarray && !iprop->setarray)
+				if (!iprop->getarray && !iprop->setarray)
 					rna_set_raw_property(dp, prop);
 
-				iprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)iprop->getarray);
-				iprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)iprop->setarray);
+				iprop->getarray = (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)iprop->getarray);
+				iprop->setarray = (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)iprop->setarray);
 			}
 			break;
 		}
 		case PROP_FLOAT: {
-			FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
+			FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
 
-			if(!prop->arraydimension) {
-				if(!fprop->get && !fprop->set)
+			if (!prop->arraydimension) {
+				if (!fprop->get && !fprop->set)
 					rna_set_raw_property(dp, prop);
 
-				fprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)fprop->get);
-				fprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)fprop->set);
+				fprop->get = (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)fprop->get);
+				fprop->set = (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)fprop->set);
 			}
 			else {
-				if(!fprop->getarray && !fprop->setarray)
+				if (!fprop->getarray && !fprop->setarray)
 					rna_set_raw_property(dp, prop);
 
-				fprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)fprop->getarray);
-				fprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)fprop->setarray);
+				fprop->getarray = (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)fprop->getarray);
+				fprop->setarray = (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)fprop->setarray);
 			}
 			break;
 		}
 		case PROP_ENUM: {
-			EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
+			EnumPropertyRNA *eprop = (EnumPropertyRNA*)prop;
 
-			eprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)eprop->get);
-			eprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)eprop->set);
+			eprop->get = (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)eprop->get);
+			eprop->set = (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)eprop->set);
 			break;
 		}
 		case PROP_STRING: {
-			StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
+			StringPropertyRNA *sprop = (StringPropertyRNA*)prop;
 
-			sprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)sprop->get);
-			sprop->length= (void*)rna_def_property_length_func(f, srna, prop, dp, (const char*)sprop->length);
-			sprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)sprop->set);
+			sprop->get = (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)sprop->get);
+			sprop->length = (void*)rna_def_property_length_func(f, srna, prop, dp, (const char*)sprop->length);
+			sprop->set = (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)sprop->set);
 			break;
 		}
 		case PROP_POINTER: {
-			PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
+			PointerPropertyRNA *pprop = (PointerPropertyRNA*)prop;
 
-			pprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)pprop->get);
-			pprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)pprop->set);
-			if(!pprop->type) {
+			pprop->get = (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)pprop->get);
+			pprop->set = (void*)rna_def_property_set_func(f, srna, prop, dp, (const char*)pprop->set);
+			if (!pprop->type) {
 				fprintf(stderr, "%s: %s.%s, pointer must have a struct type.\n",
 				        __func__, srna->identifier, prop->identifier);
-				DefRNA.error= 1;
+				DefRNA.error = 1;
 			}
 			break;
 		}
 		case PROP_COLLECTION: {
-			CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
-			const char *nextfunc= (const char*)cprop->next;
+			CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)prop;
+			const char *nextfunc = (const char*)cprop->next;
 
-			if(dp->dnatype && strcmp(dp->dnatype, "ListBase")==0);
-			else if(dp->dnalengthname || dp->dnalengthfixed)
-				cprop->length= (void*)rna_def_property_length_func(f, srna, prop, dp, (const char*)cprop->length);
+			if (dp->dnatype && strcmp(dp->dnatype, "ListBase") == 0);
+			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 */
-			if(cprop->next && cprop->get)
-				if(strcmp((const char*)cprop->next, "rna_iterator_array_next") == 0 &&
+			if (cprop->next && cprop->get)
+				if (strcmp((const char*)cprop->next, "rna_iterator_array_next") == 0 &&
 				   strcmp((const char*)cprop->get, "rna_iterator_array_get") == 0)
 					prop->flag |= PROP_RAW_ARRAY;
 
-			cprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)cprop->get);
-			cprop->begin= (void*)rna_def_property_begin_func(f, srna, prop, dp, (const char*)cprop->begin);
-			cprop->next= (void*)rna_def_property_next_func(f, srna, prop, dp, (const char*)cprop->next);
-			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->get = (void*)rna_def_property_get_func(f, srna, prop, dp, (const char*)cprop->get);
+			cprop->begin = (void*)rna_def_property_begin_func(f, srna, prop, dp, (const char*)cprop->begin);
+			cprop->next = (void*)rna_def_property_next_func(f, srna, prop, dp, (const char*)cprop->next);
+			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);
 
-			if(!(prop->flag & PROP_IDPROPERTY)) {
-				if(!cprop->begin) {
+			if (!(prop->flag & PROP_IDPROPERTY)) {
+				if (!cprop->begin) {
 					fprintf(stderr, "%s: %s.%s, collection must have a begin function.\n",
 					        __func__, srna->identifier, prop->identifier);
-					DefRNA.error= 1;
+					DefRNA.error = 1;
 				}
-				if(!cprop->next) {
+				if (!cprop->next) {
 					fprintf(stderr, "%s: %s.%s, collection must have a next function.\n",
 					        __func__, srna->identifier, prop->identifier);
-					DefRNA.error= 1;
+					DefRNA.error = 1;
 				}
-				if(!cprop->get) {
+				if (!cprop->get) {
 					fprintf(stderr, "%s: %s.%s, collection must have a get function.\n",
 					        __func__, srna->identifier, prop->identifier);
-					DefRNA.error= 1;
+					DefRNA.error = 1;
 				}
 			}
-			if(!cprop->item_type) {
+			if (!cprop->item_type) {
 				fprintf(stderr, "%s: %s.%s, collection must have a struct type.\n",
 				        __func__, srna->identifier, prop->identifier);
-				DefRNA.error= 1;
+				DefRNA.error = 1;
 			}
 			break;
 		}
@@ -1339,89 +1401,90 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR
 	PropertyRNA *prop;
 	char *func;
 
-	prop= dp->prop;
+	prop = dp->prop;
 
-	if(prop->flag & (PROP_IDPROPERTY|PROP_BUILTIN))
+	if (prop->flag & (PROP_IDPROPERTY|PROP_BUILTIN))
 		return;
 
-	func= rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "");
+	func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "");
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_BOOLEAN:
 		case PROP_INT: {
-			if(!prop->arraydimension) {
+			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) {
+			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->arraylength); */
 			}
 			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;
 		}
 		case PROP_FLOAT: {
-			if(!prop->arraydimension) {
+			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) {
+			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->arraylength); */
 			}
 			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[]);\n", func); */
 			}
 			break;
 		}
 		case PROP_ENUM: {
-			EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
+			EnumPropertyRNA *eprop = (EnumPropertyRNA*)prop;
 			int i;
 
-			if(eprop->item) {
+			if (eprop->item) {
 				fprintf(f, "enum {\n");
 
-				for(i=0; i<eprop->totitem; i++)
-					if(eprop->item[i].identifier[0])
-						fprintf(f, "\t%s_%s_%s = %d,\n", srna->identifier, prop->identifier, eprop->item[i].identifier, eprop->item[i].value);
+				for (i = 0; i<eprop->totitem; i++)
+					if (eprop->item[i].identifier[0])
+						fprintf(f, "\t%s_%s_%s = %d,\n", srna->identifier, prop->identifier,
+						        eprop->item[i].identifier, eprop->item[i].value);
 
 				fprintf(f, "};\n\n");
 			}
 
 			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;
 		}
 		case PROP_STRING: {
-			StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
+			StringPropertyRNA *sprop = (StringPropertyRNA*)prop;
 
-			if(sprop->maxlength) {
+			if (sprop->maxlength) {
 				fprintf(f, "#define %s_%s_MAX %d\n\n", srna->identifier, prop->identifier, sprop->maxlength);
 			}
 			
 			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;
 		}
 		case PROP_POINTER: {
 			fprintf(f, "PointerRNA %sget(PointerRNA *ptr);\n", func);
-			//fprintf(f, "void %sset(PointerRNA *ptr, PointerRNA value);\n", func);
+			/*fprintf(f, "void %sset(PointerRNA *ptr, PointerRNA value);\n", func); */
 			break;
 		}
 		case PROP_COLLECTION: {
 			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);
+			/*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); */
 			break;
 		}
 	}
@@ -1433,50 +1496,51 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property
 {
 	PropertyRNA *prop;
 
-	prop= dp->prop;
+	prop = dp->prop;
 
-	if(prop->flag & (PROP_IDPROPERTY|PROP_BUILTIN))
+	if (prop->flag & (PROP_IDPROPERTY|PROP_BUILTIN))
 		return;
 	
-	if(prop->name && prop->description && prop->description[0] != '\0')
+	if (prop->name && prop->description && prop->description[0] != '\0')
 		fprintf(f, "\t/* %s: %s */\n", prop->name, prop->description);
-	else if(prop->name)
+	else if (prop->name)
 		fprintf(f, "\t/* %s */\n", prop->name);
 	else
 		fprintf(f, "\t/* */\n");
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_BOOLEAN: {
-			if(!prop->arraydimension)
+			if (!prop->arraydimension)
 				fprintf(f, "\tinline bool %s(void);", rna_safe_id(prop->identifier));
-			else if(prop->totarraylength)
+			else if (prop->totarraylength)
 				fprintf(f, "\tinline Array<int, %u> %s(void);", prop->totarraylength, rna_safe_id(prop->identifier));
 			break;
 		}
 		case PROP_INT: {
-			if(!prop->arraydimension)
+			if (!prop->arraydimension)
 				fprintf(f, "\tinline int %s(void);", rna_safe_id(prop->identifier));
-			else if(prop->totarraylength)
+			else if (prop->totarraylength)
 				fprintf(f, "\tinline Array<int, %u> %s(void);", prop->totarraylength, rna_safe_id(prop->identifier));
 			break;
 		}
 		case PROP_FLOAT: {
-			if(!prop->arraydimension)
+			if (!prop->arraydimension)
 				fprintf(f, "\tinline float %s(void);", rna_safe_id(prop->identifier));
-			else if(prop->totarraylength)
+			else if (prop->totarraylength)
 				fprintf(f, "\tinline Array<float, %u> %s(void);", prop->totarraylength, rna_safe_id(prop->identifier));
 			break;
 		}
 		case PROP_ENUM: {
-			EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
+			EnumPropertyRNA *eprop = (EnumPropertyRNA*)prop;
 			int i;
 
-			if(eprop->item) {
+			if (eprop->item) {
 				fprintf(f, "\tenum %s_enum {\n", rna_safe_id(prop->identifier));
 
-				for(i=0; i<eprop->totitem; i++)
-					if(eprop->item[i].identifier[0])
-						fprintf(f, "\t\t%s_%s = %d,\n", rna_safe_id(prop->identifier), eprop->item[i].identifier, eprop->item[i].value);
+				for (i = 0; i<eprop->totitem; i++)
+					if (eprop->item[i].identifier[0])
+						fprintf(f, "\t\t%s_%s = %d,\n", rna_safe_id(prop->identifier), eprop->item[i].identifier,
+						        eprop->item[i].value);
 
 				fprintf(f, "\t};\n");
 			}
@@ -1489,21 +1553,23 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property
 			break;
 		}
 		case PROP_POINTER: {
-			PointerPropertyRNA *pprop= (PointerPropertyRNA*)dp->prop;
+			PointerPropertyRNA *pprop = (PointerPropertyRNA*)dp->prop;
 
-			if(pprop->type)
+			if (pprop->type)
 				fprintf(f, "\tinline %s %s(void);", (const char*)pprop->type, rna_safe_id(prop->identifier));
 			else
 				fprintf(f, "\tinline %s %s(void);", "UnknownType", rna_safe_id(prop->identifier));
 			break;
 		}
 		case PROP_COLLECTION: {
-			CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)dp->prop;
+			CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)dp->prop;
 
-			if(cprop->item_type)
-				fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (const char*)cprop->item_type, srna->identifier, rna_safe_id(prop->identifier));
+			if (cprop->item_type)
+				fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (const char*)cprop->item_type, srna->identifier,
+				        rna_safe_id(prop->identifier));
 			else
-				fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, rna_safe_id(prop->identifier));
+				fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier,
+				        rna_safe_id(prop->identifier));
 			break;
 		}
 	}
@@ -1515,35 +1581,39 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe
 {
 	PropertyRNA *prop;
 
-	prop= dp->prop;
+	prop = dp->prop;
 
-	if(prop->flag & (PROP_IDPROPERTY|PROP_BUILTIN))
+	if (prop->flag & (PROP_IDPROPERTY|PROP_BUILTIN))
 		return;
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_BOOLEAN: {
-			if(!prop->arraydimension)
+			if (!prop->arraydimension)
 				fprintf(f, "\tBOOLEAN_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
-			else if(prop->totarraylength)
-				fprintf(f, "\tBOOLEAN_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier));
+			else if (prop->totarraylength)
+				fprintf(f, "\tBOOLEAN_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength,
+				        rna_safe_id(prop->identifier));
 			break;
 		}
 		case PROP_INT: {
-			if(!prop->arraydimension)
+			if (!prop->arraydimension)
 				fprintf(f, "\tINT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
-			else if(prop->totarraylength)
-				fprintf(f, "\tINT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier));
+			else if (prop->totarraylength)
+				fprintf(f, "\tINT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength,
+				        rna_safe_id(prop->identifier));
 			break;
 		}
 		case PROP_FLOAT: {
-			if(!prop->arraydimension)
+			if (!prop->arraydimension)
 				fprintf(f, "\tFLOAT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
-			else if(prop->totarraylength)
-				fprintf(f, "\tFLOAT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength, rna_safe_id(prop->identifier));
+			else if (prop->totarraylength)
+				fprintf(f, "\tFLOAT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength,
+				        rna_safe_id(prop->identifier));
 			break;
 		}
 		case PROP_ENUM: {
-			fprintf(f, "\tENUM_PROPERTY(%s_enum, %s, %s)", rna_safe_id(prop->identifier), srna->identifier, rna_safe_id(prop->identifier));
+			fprintf(f, "\tENUM_PROPERTY(%s_enum, %s, %s)", rna_safe_id(prop->identifier), srna->identifier,
+			        rna_safe_id(prop->identifier));
 
 			break;
 		}
@@ -1552,21 +1622,26 @@ static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDe
 			break;
 		}
 		case PROP_POINTER: {
-			PointerPropertyRNA *pprop= (PointerPropertyRNA*)dp->prop;
+			PointerPropertyRNA *pprop = (PointerPropertyRNA*)dp->prop;
 
-			if(pprop->type)
-				fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", (const char*)pprop->type, srna->identifier, rna_safe_id(prop->identifier));
+			if (pprop->type)
+				fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", (const char*)pprop->type, srna->identifier,
+				        rna_safe_id(prop->identifier));
 			else
-				fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, rna_safe_id(prop->identifier));
+				fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier,
+				        rna_safe_id(prop->identifier));
 			break;
 		}
 		case PROP_COLLECTION: {
-			/*CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)dp->prop;
+#if 0
+			CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)dp->prop;
 
-			if(cprop->type)
-				fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (const char*)cprop->type, srna->identifier, prop->identifier);
+			if (cprop->type)
+				fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", (const char*)cprop->type, srna->identifier,
+				        prop->identifier);
 			else
-				fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, prop->identifier);*/
+				fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier, prop->identifier);
+#endif
 			break;
 		}
 	}
@@ -1582,16 +1657,16 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
 	PropertyType type;
 	const char *funcname, *valstr;
 	const char *ptrstr;
-	const short has_data= (dfunc->cont.properties.first != NULL);
+	const short has_data = (dfunc->cont.properties.first != NULL);
 	int flag, pout, cptr, first;
 
-	srna= dsrna->srna;
-	func= dfunc->func;
+	srna = dsrna->srna;
+	func = dfunc->func;
 
-	if(!dfunc->call)
+	if (!dfunc->call)
 		return;
 
-	funcname= rna_alloc_function_name(srna->identifier, func->identifier, "call");
+	funcname = rna_alloc_function_name(srna->identifier, func->identifier, "call");
 
 	/* function definition */
 	fprintf(f, "void %s(bContext *C, ReportList *reports, PointerRNA *_ptr, ParameterList *_parms)", funcname);
@@ -1599,156 +1674,160 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
 
 	/* variable definitions */
 	
-	if(func->flag & FUNC_USE_SELF_ID) {
+	if (func->flag & FUNC_USE_SELF_ID) {
 		fprintf(f, "\tstruct ID *_selfid;\n");
 	}
 
-	if((func->flag & FUNC_NO_SELF)==0) {
-		if(dsrna->dnaname) fprintf(f, "\tstruct %s *_self;\n", dsrna->dnaname);
+	if ((func->flag & FUNC_NO_SELF) == 0) {
+		if (dsrna->dnaname) fprintf(f, "\tstruct %s *_self;\n", dsrna->dnaname);
 		else fprintf(f, "\tstruct %s *_self;\n", srna->identifier);
 	}
 
-	dparm= dfunc->cont.properties.first;
-	for(; dparm; dparm= dparm->next) {
+	dparm = dfunc->cont.properties.first;
+	for (; dparm; dparm = dparm->next) {
 		type = dparm->prop->type;
 		flag = dparm->prop->flag;
 		pout = (flag & PROP_OUTPUT);
 		cptr = ((type == PROP_POINTER) && !(flag & PROP_RNAPTR));
 
-		if(dparm->prop==func->c_ret)
-			ptrstr= cptr || dparm->prop->arraydimension ? "*" : "";
+		if (dparm->prop == func->c_ret)
+			ptrstr = cptr || dparm->prop->arraydimension ? "*" : "";
 		/* XXX only arrays and strings are allowed to be dynamic, is this checked anywhere? */
 		else if (cptr || (flag & PROP_DYNAMIC))
-			ptrstr= pout ? "**" : "*";
+			ptrstr = pout ? "**" : "*";
 		/* 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= "*";
-		/* PROP_THICK_WRAP strings are pre-allocated on the ParameterList stack, but type name for string props is already char*, so leave empty */
+			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))
-			ptrstr= "";
+			ptrstr = "";
 		else
-			ptrstr= pout ? "*" : "";
+			ptrstr = pout ? "*" : "";
 
 		/* for dynamic parameters we pass an additional int for the length of the parameter */
 		if (flag & PROP_DYNAMIC)
 			fprintf(f, "\tint %s%s_len;\n", pout ? "*" : "", dparm->prop->identifier);
 		
-		fprintf(f, "\t%s%s %s%s;\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, dparm->prop->identifier);
+		fprintf(f, "\t%s%s %s%s;\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop),
+		        ptrstr, dparm->prop->identifier);
 	}
 
-	if(has_data) {
+	if (has_data) {
 		fprintf(f, "\tchar *_data");
-		if(func->c_ret) fprintf(f, ", *_retdata");
+		if (func->c_ret) fprintf(f, ", *_retdata");
 		fprintf(f, ";\n");
 		fprintf(f, "\t\n");
 	}
 
 	/* assign self */
-	if(func->flag & FUNC_USE_SELF_ID) {
+	if (func->flag & FUNC_USE_SELF_ID) {
 		fprintf(f, "\t_selfid= (struct ID*)_ptr->id.data;\n");
 	}
 	
-	if((func->flag & FUNC_NO_SELF)==0) {
-		if(dsrna->dnaname) fprintf(f, "\t_self= (struct %s *)_ptr->data;\n", dsrna->dnaname);
+	if ((func->flag & FUNC_NO_SELF) == 0) {
+		if (dsrna->dnaname) fprintf(f, "\t_self= (struct %s *)_ptr->data;\n", dsrna->dnaname);
 		else fprintf(f, "\t_self= (struct %s *)_ptr->data;\n", srna->identifier);
 	}
 
-	if(has_data) {
+	if (has_data) {
 		fprintf(f, "\t_data= (char *)_parms->data;\n");
 	}
 
-	dparm= dfunc->cont.properties.first;
-	for(; dparm; dparm= dparm->next) {
+	dparm = dfunc->cont.properties.first;
+	for (; dparm; dparm = dparm->next) {
 		type = dparm->prop->type;
 		flag = dparm->prop->flag;
 		pout = (flag & PROP_OUTPUT);
 		cptr = ((type == PROP_POINTER) && !(flag & PROP_RNAPTR));
 
-		if(dparm->prop==func->c_ret)
+		if (dparm->prop == func->c_ret)
 			fprintf(f, "\t_retdata= _data;\n");
-		else  {
+		else {
 			const char *data_str;
 			if (cptr || (flag & PROP_DYNAMIC)) {
-				ptrstr= "**";
-				valstr= "*";
+				ptrstr = "**";
+				valstr = "*";
 			}
 			else if (type == PROP_POINTER || dparm->prop->arraydimension) {
-				ptrstr= "*";
-				valstr= "";
+				ptrstr = "*";
+				valstr = "";
 			}
 			else if (type == PROP_STRING && (flag & PROP_THICK_WRAP)) {
-				ptrstr= "";
-				valstr= "";
+				ptrstr = "";
+				valstr = "";
 			}
 			else {
-				ptrstr= "*";
-				valstr= "*";
+				ptrstr = "*";
+				valstr = "*";
 			}
 
-			/* this must be kept in sync with RNA_parameter_length_get_data, we could just call the function directly, but this is faster */
+			/* this must be kept in sync with RNA_parameter_length_get_data,
+			 * we could just call the function directly, but this is faster */
 			if (flag & PROP_DYNAMIC) {
 				fprintf(f, "\t%s_len= %s((int *)_data);\n", dparm->prop->identifier, pout ? "" : "*");
-				data_str= "(&(((char *)_data)[sizeof(void *)]))";
+				data_str = "(&(((char *)_data)[sizeof(void *)]))";
 			}
 			else {
-				data_str= "_data";
+				data_str = "_data";
 			}
 			fprintf(f, "\t%s= ", dparm->prop->identifier);
 
 			if (!pout)
 				fprintf(f, "%s", valstr);
 
-			fprintf(f, "((%s%s%s)%s);\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, data_str);
+			fprintf(f, "((%s%s%s)%s);\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop),
+			        ptrstr, data_str);
 		}
 
-		if(dparm->next)
+		if (dparm->next)
 			fprintf(f, "\t_data+= %d;\n", rna_parameter_size_alloc(dparm->prop));
 	}
 
-	if(dfunc->call) {
+	if (dfunc->call) {
 		fprintf(f, "\t\n");
 		fprintf(f, "\t");
-		if(func->c_ret) fprintf(f, "%s= ", func->c_ret->identifier);
+		if (func->c_ret) fprintf(f, "%s= ", func->c_ret->identifier);
 		fprintf(f, "%s(", dfunc->call);
 
-		first= 1;
+		first = 1;
 
-		if(func->flag & FUNC_USE_SELF_ID) {
+		if (func->flag & FUNC_USE_SELF_ID) {
 			fprintf(f, "_selfid");
-			first= 0;
+			first = 0;
 		}
 
-		if((func->flag & FUNC_NO_SELF)==0) {
-			if(!first) fprintf(f, ", ");
+		if ((func->flag & FUNC_NO_SELF) == 0) {
+			if (!first) fprintf(f, ", ");
 			fprintf(f, "_self");
-			first= 0;
+			first = 0;
 		}
 
-		if(func->flag & FUNC_USE_MAIN) {
-			if(!first) fprintf(f, ", ");
-			first= 0;
+		if (func->flag & FUNC_USE_MAIN) {
+			if (!first) fprintf(f, ", ");
+			first = 0;
 			fprintf(f, "CTX_data_main(C)"); /* may have direct access later */
 		}
 
-		if(func->flag & FUNC_USE_CONTEXT) {
-			if(!first) fprintf(f, ", ");
-			first= 0;
+		if (func->flag & FUNC_USE_CONTEXT) {
+			if (!first) fprintf(f, ", ");
+			first = 0;
 			fprintf(f, "C");
 		}
 
-		if(func->flag & FUNC_USE_REPORTS) {
-			if(!first) fprintf(f, ", ");
-			first= 0;
+		if (func->flag & FUNC_USE_REPORTS) {
+			if (!first) fprintf(f, ", ");
+			first = 0;
 			fprintf(f, "reports");
 		}
 
-		dparm= dfunc->cont.properties.first;
-		for(; dparm; dparm= dparm->next) {
-			if(dparm->prop==func->c_ret)
+		dparm = dfunc->cont.properties.first;
+		for (; dparm; dparm = dparm->next) {
+			if (dparm->prop == func->c_ret)
 				continue;
 
-			if(!first) fprintf(f, ", ");
-			first= 0;
+			if (!first) fprintf(f, ", ");
+			first = 0;
 
 			if (dparm->prop->flag & PROP_DYNAMIC)
 				fprintf(f, "%s_len, %s", dparm->prop->identifier, dparm->prop->identifier);
@@ -1758,16 +1837,18 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
 
 		fprintf(f, ");\n");
 
-		if(func->c_ret) {
-			dparm= rna_find_parameter_def(func->c_ret);
-			ptrstr= (((dparm->prop->type == PROP_POINTER) && !(dparm->prop->flag & PROP_RNAPTR)) || (dparm->prop->arraydimension))? "*": "";
-			fprintf(f, "\t*((%s%s%s*)_retdata)= %s;\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, func->c_ret->identifier);
+		if (func->c_ret) {
+			dparm = rna_find_parameter_def(func->c_ret);
+			ptrstr = (((dparm->prop->type == PROP_POINTER) && !(dparm->prop->flag & PROP_RNAPTR)) ||
+			          (dparm->prop->arraydimension)) ? "*" : "";
+			fprintf(f, "\t*((%s%s%s*)_retdata)= %s;\n", rna_type_struct(dparm->prop),
+			        rna_parameter_type_name(dparm->prop), ptrstr, func->c_ret->identifier);
 		}
 	}
 
 	fprintf(f, "}\n\n");
 
-	dfunc->gencall= funcname;
+	dfunc->gencall = funcname;
 }
 
 static void rna_auto_types(void)
@@ -1775,34 +1856,34 @@ static void rna_auto_types(void)
 	StructDefRNA *ds;
 	PropertyDefRNA *dp;
 
-	for(ds=DefRNA.structs.first; ds; ds=ds->cont.next) {
+	for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
 		/* DNA name for Screen is patched in 2.5, we do the reverse here .. */
-		if(ds->dnaname && strcmp(ds->dnaname, "Screen") == 0)
-			ds->dnaname= "bScreen";
+		if (ds->dnaname && strcmp(ds->dnaname, "Screen") == 0)
+			ds->dnaname = "bScreen";
 
-		for(dp=ds->cont.properties.first; dp; dp=dp->next) {
-			if(dp->dnastructname && strcmp(dp->dnastructname, "Screen") == 0)
-				dp->dnastructname= "bScreen";
+		for (dp = ds->cont.properties.first; dp; dp = dp->next) {
+			if (dp->dnastructname && strcmp(dp->dnastructname, "Screen") == 0)
+				dp->dnastructname = "bScreen";
 
-			if(dp->dnatype) {
-				if(dp->prop->type == PROP_POINTER) {
-					PointerPropertyRNA *pprop= (PointerPropertyRNA*)dp->prop;
+			if (dp->dnatype) {
+				if (dp->prop->type == PROP_POINTER) {
+					PointerPropertyRNA *pprop = (PointerPropertyRNA*)dp->prop;
 					StructRNA *type;
 
-					if(!pprop->type && !pprop->get)
-						pprop->type= (StructRNA*)rna_find_type(dp->dnatype);
+					if (!pprop->type && !pprop->get)
+						pprop->type = (StructRNA*)rna_find_type(dp->dnatype);
 
-					if(pprop->type) {
-						type= rna_find_struct((const char*)pprop->type);
-						if(type && (type->flag & STRUCT_ID_REFCOUNT))
+					if (pprop->type) {
+						type = rna_find_struct((const char*)pprop->type);
+						if (type && (type->flag & STRUCT_ID_REFCOUNT))
 							pprop->property.flag |= PROP_ID_REFCOUNT;
 					}
 				}
-				else if(dp->prop->type== PROP_COLLECTION) {
-					CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)dp->prop;
+				else if (dp->prop->type == PROP_COLLECTION) {
+					CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)dp->prop;
 
-					if(!cprop->item_type && !cprop->get && strcmp(dp->dnatype, "ListBase")==0)
-						cprop->item_type= (StructRNA*)rna_find_type(dp->dnatype);
+					if (!cprop->item_type && !cprop->get && strcmp(dp->dnatype, "ListBase") == 0)
+						cprop->item_type = (StructRNA*)rna_find_type(dp->dnatype);
 				}
 			}
 		}
@@ -1817,16 +1898,16 @@ static void rna_sort(BlenderRNA *brna)
 	rna_sortlist(&brna->structs, cmp_struct);
 	rna_sortlist(&DefRNA.structs, cmp_def_struct);
 
-	for(srna=brna->structs.first; srna; srna=srna->cont.next)
+	for (srna = brna->structs.first; srna; srna = srna->cont.next)
 		rna_sortlist(&srna->cont.properties, cmp_property);
 
-	for(ds=DefRNA.structs.first; ds; ds=ds->cont.next)
+	for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
 		rna_sortlist(&ds->cont.properties, cmp_def_property);
 }
 
 static const char *rna_property_structname(PropertyType type)
 {
-	switch(type) {
+	switch (type) {
 		case PROP_BOOLEAN: return "BoolPropertyRNA";
 		case PROP_INT: return "IntPropertyRNA";
 		case PROP_FLOAT: return "FloatPropertyRNA";
@@ -1840,7 +1921,7 @@ static const char *rna_property_structname(PropertyType type)
 
 static const char *rna_property_subtypename(PropertySubType type)
 {
-	switch(type) {
+	switch (type) {
 		case PROP_NONE: return "PROP_NONE";
 		case PROP_FILEPATH: return "PROP_FILEPATH";
 		case PROP_FILENAME: return "PROP_FILENAME";
@@ -1868,8 +1949,8 @@ static const char *rna_property_subtypename(PropertySubType type)
 		case PROP_LAYER: return "PROP_LAYER";
 		case PROP_LAYER_MEMBER: return "PROP_LAYER_MEMBER";
 		default: {
-			/* incase we dont have a type preset that includes the subtype */
-			if(RNA_SUBTYPE_UNIT(type)) {
+			/* in case we don't have a type preset that includes the subtype */
+			if (RNA_SUBTYPE_UNIT(type)) {
 				return rna_property_subtypename(type & ~RNA_SUBTYPE_UNIT(type));
 			}
 			else {
@@ -1881,7 +1962,7 @@ static const char *rna_property_subtypename(PropertySubType type)
 
 static const char *rna_property_subtype_unit(PropertySubType type)
 {
-	switch(RNA_SUBTYPE_UNIT(type)) {
+	switch (RNA_SUBTYPE_UNIT(type)) {
 		case PROP_UNIT_NONE:		return "PROP_UNIT_NONE";
 		case PROP_UNIT_LENGTH:		return "PROP_UNIT_LENGTH";
 		case PROP_UNIT_AREA:		return "PROP_UNIT_AREA";
@@ -1899,7 +1980,7 @@ static void rna_generate_prototypes(BlenderRNA *brna, FILE *f)
 {
 	StructRNA *srna;
 
-	for(srna=brna->structs.first; srna; srna=srna->cont.next)
+	for (srna = brna->structs.first; srna; srna = srna->cont.next)
 		fprintf(f, "extern StructRNA RNA_%s;\n", srna->identifier);
 	fprintf(f, "\n");
 }
@@ -1910,12 +1991,12 @@ static void rna_generate_blender(BlenderRNA *brna, FILE *f)
 
 	fprintf(f, "BlenderRNA BLENDER_RNA = {");
 
-	srna= brna->structs.first;
-	if(srna) fprintf(f, "{&RNA_%s, ", srna->identifier);
+	srna = brna->structs.first;
+	if (srna) fprintf(f, "{&RNA_%s, ", srna->identifier);
 	else fprintf(f, "{NULL, ");
 
-	srna= brna->structs.last;
-	if(srna) fprintf(f, "&RNA_%s}", srna->identifier);
+	srna = brna->structs.last;
+	if (srna) fprintf(f, "&RNA_%s}", srna->identifier);
 	else fprintf(f, "NULL}");
 
 	fprintf(f, "};\n\n");
@@ -1926,19 +2007,21 @@ static void rna_generate_property_prototypes(BlenderRNA *brna, StructRNA *srna,
 	PropertyRNA *prop;
 	StructRNA *base;
 
-	base= srna->base;
+	base = srna->base;
 	while (base) {
 		fprintf(f, "\n");
-		for(prop=base->cont.properties.first; prop; prop=prop->next)
-			fprintf(f, "%s%s rna_%s_%s;\n", "extern ", rna_property_structname(prop->type), base->identifier, prop->identifier);
-		base= base->base;
+		for (prop = base->cont.properties.first; prop; prop = prop->next)
+			fprintf(f, "%s%s rna_%s_%s;\n", "extern ", rna_property_structname(prop->type),
+			        base->identifier, prop->identifier);
+		base = base->base;
 	}
 
-	if(srna->cont.properties.first)
+	if (srna->cont.properties.first)
 		fprintf(f, "\n");
 
-	for(prop=srna->cont.properties.first; prop; prop=prop->next)
-		fprintf(f, "%s%s rna_%s_%s;\n", (prop->flag & PROP_EXPORT)? "": "", rna_property_structname(prop->type), srna->identifier, prop->identifier);
+	for (prop = srna->cont.properties.first; prop; prop = prop->next)
+		fprintf(f, "%s%s rna_%s_%s;\n", (prop->flag & PROP_EXPORT)? "": "", rna_property_structname(prop->type),
+		        srna->identifier, prop->identifier);
 	fprintf(f, "\n");
 }
 
@@ -1946,10 +2029,11 @@ static void rna_generate_parameter_prototypes(BlenderRNA *brna, StructRNA *srna,
 {
 	PropertyRNA *parm;
 
-	for(parm= func->cont.properties.first; parm; parm= parm->next)
-		fprintf(f, "%s%s rna_%s_%s_%s;\n", "extern ", rna_property_structname(parm->type), srna->identifier, func->identifier, parm->identifier);
+	for (parm = func->cont.properties.first; parm; parm = parm->next)
+		fprintf(f, "%s%s rna_%s_%s_%s;\n", "extern ", rna_property_structname(parm->type), srna->identifier,
+		        func->identifier, parm->identifier);
 
-	if(func->cont.properties.first)
+	if (func->cont.properties.first)
 		fprintf(f, "\n");
 }
 
@@ -1958,25 +2042,25 @@ static void rna_generate_function_prototypes(BlenderRNA *brna, StructRNA *srna,
 	FunctionRNA *func;
 	StructRNA *base;
 
-	base= srna->base;
+	base = srna->base;
 	while (base) {
-		for(func= base->functions.first; func; func= func->cont.next) {
+		for (func = base->functions.first; func; func = func->cont.next) {
 			fprintf(f, "%s%s rna_%s_%s_func;\n", "extern ", "FunctionRNA", base->identifier, func->identifier);
 			rna_generate_parameter_prototypes(brna, base, func, f);
 		}
 
-		if(base->functions.first)
+		if (base->functions.first)
 			fprintf(f, "\n");
 
-		base= base->base;
+		base = base->base;
 	}
 
-	for(func= srna->functions.first; func; func= func->cont.next) {
+	for (func = srna->functions.first; func; func = func->cont.next) {
 		fprintf(f, "%s%s rna_%s_%s_func;\n", "extern ", "FunctionRNA", srna->identifier, func->identifier);
 		rna_generate_parameter_prototypes(brna, srna, func, f);
 	}
 
-	if(srna->functions.first)
+	if (srna->functions.first)
 		fprintf(f, "\n");
 }
 
@@ -1989,15 +2073,15 @@ static void rna_generate_static_parameter_prototypes(BlenderRNA *brna, StructRNA
 	int flag, pout, cptr, first;
 	const char *ptrstr;
 
-	dsrna= rna_find_struct_def(srna);
-	func= dfunc->func;
+	dsrna = rna_find_struct_def(srna);
+	func = dfunc->func;
 
 	/* return type */
-	for(dparm= dfunc->cont.properties.first; dparm; dparm= dparm->next) {
-		if(dparm->prop==func->c_ret) {
-			if(dparm->prop->arraydimension)
+	for (dparm = dfunc->cont.properties.first; dparm; dparm = dparm->next) {
+		if (dparm->prop == func->c_ret) {
+			if (dparm->prop->arraydimension)
 				fprintf(f, "XXX no array return types yet"); /* XXX not supported */
-			else if(dparm->prop->type == PROP_POINTER && !(dparm->prop->flag & PROP_RNAPTR))
+			else if (dparm->prop->type == PROP_POINTER && !(dparm->prop->flag & PROP_RNAPTR))
 				fprintf(f, "%s%s *", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop));
 			else
 				fprintf(f, "%s%s ", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop));
@@ -2007,74 +2091,76 @@ static void rna_generate_static_parameter_prototypes(BlenderRNA *brna, StructRNA
 	}
 
 	/* void if nothing to return */
-	if(!dparm)
+	if (!dparm)
 		fprintf(f, "void ");
 
 	/* function name */
 	fprintf(f, "%s(", dfunc->call);
 
-	first= 1;
+	first = 1;
 
 	/* self, context and reports parameters */
-	if(func->flag & FUNC_USE_SELF_ID) {
+	if (func->flag & FUNC_USE_SELF_ID) {
 		fprintf(f, "struct ID *_selfid");
-		first= 0;		
+		first = 0;
 	}
 	
-	if((func->flag & FUNC_NO_SELF)==0) {
-		if(!first) fprintf(f, ", ");
-		if(dsrna->dnaname) fprintf(f, "struct %s *_self", dsrna->dnaname);
+	if ((func->flag & FUNC_NO_SELF) == 0) {
+		if (!first) fprintf(f, ", ");
+		if (dsrna->dnaname) fprintf(f, "struct %s *_self", dsrna->dnaname);
 		else fprintf(f, "struct %s *_self", srna->identifier);
-		first= 0;
+		first = 0;
 	}
 
-	if(func->flag & FUNC_USE_MAIN) {
-		if(!first) fprintf(f, ", ");
-		first= 0;
+	if (func->flag & FUNC_USE_MAIN) {
+		if (!first) fprintf(f, ", ");
+		first = 0;
 		fprintf(f, "Main *bmain");
 	}
 
-	if(func->flag & FUNC_USE_CONTEXT) {
-		if(!first) fprintf(f, ", ");
-		first= 0;
+	if (func->flag & FUNC_USE_CONTEXT) {
+		if (!first) fprintf(f, ", ");
+		first = 0;
 		fprintf(f, "bContext *C");
 	}
 
-	if(func->flag & FUNC_USE_REPORTS) {
-		if(!first) fprintf(f, ", ");
-		first= 0;
+	if (func->flag & FUNC_USE_REPORTS) {
+		if (!first) fprintf(f, ", ");
+		first = 0;
 		fprintf(f, "ReportList *reports");
 	}
 
 	/* defined parameters */
-	for(dparm= dfunc->cont.properties.first; dparm; dparm= dparm->next) {
+	for (dparm = dfunc->cont.properties.first; dparm; dparm = dparm->next) {
 		type = dparm->prop->type;
 		flag = dparm->prop->flag;
 		pout = (flag & PROP_OUTPUT);
 		cptr = ((type == PROP_POINTER) && !(flag & PROP_RNAPTR));
 
-		if(dparm->prop==func->c_ret)
+		if (dparm->prop == func->c_ret)
 			continue;
 
 		if (cptr || (flag & PROP_DYNAMIC))
-			ptrstr= pout ? "**" : "*";
+			ptrstr = pout ? "**" : "*";
 		else if (type == PROP_POINTER || dparm->prop->arraydimension)
-			ptrstr= "*";
+			ptrstr = "*";
 		else if (type == PROP_STRING && (flag & PROP_THICK_WRAP))
-			ptrstr= "";
+			ptrstr = "";
 		else
-			ptrstr= pout ? "*" : "";
+			ptrstr = pout ? "*" : "";
 
-		if(!first) fprintf(f, ", ");
-		first= 0;
+		if (!first) fprintf(f, ", ");
+		first = 0;
 
 		if (flag & PROP_DYNAMIC)
 			fprintf(f, "int %s%s_len, ", pout ? "*" : "", dparm->prop->identifier);
 
-		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);
+		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);
 		else
-			fprintf(f, "%s%s %s%s", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, dparm->prop->identifier);
+			fprintf(f, "%s%s %s%s", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop),
+			        ptrstr, dparm->prop->identifier);
 
 	}
 
@@ -2085,15 +2171,15 @@ static void rna_generate_static_function_prototypes(BlenderRNA *brna, StructRNA
 {
 	FunctionRNA *func;
 	FunctionDefRNA *dfunc;
-	int first= 1;
+	int first = 1;
 
-	for(func= srna->functions.first; func; func= func->cont.next) {
-		dfunc= rna_find_function_def(func);
+	for (func = srna->functions.first; func; func = func->cont.next) {
+		dfunc = rna_find_function_def(func);
 
-		if(dfunc->call) {
-			if(first) {
+		if (dfunc->call) {
+			if (first) {
 				fprintf(f, "/* Repeated prototypes to detect errors */\n\n");
-				first= 0;
+				first = 0;
 			}
 
 			rna_generate_static_parameter_prototypes(brna, srna, dfunc, f);
@@ -2103,45 +2189,46 @@ static void rna_generate_static_function_prototypes(BlenderRNA *brna, StructRNA
 	fprintf(f, "\n");
 }
 
-static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, PropertyRNA *prop) 
+static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, PropertyRNA *prop)
 {
-	char *strnest= "", *errnest= "";
-	int len, freenest= 0;
+	char *strnest = "", *errnest = "";
+	int len, freenest = 0;
 	
-	if(nest != NULL) {
-		len= strlen(nest);
+	if (nest != NULL) {
+		len = strlen(nest);
 
-		strnest= MEM_mallocN(sizeof(char)*(len+2), "rna_generate_property -> strnest");
-		errnest= MEM_mallocN(sizeof(char)*(len+2), "rna_generate_property -> errnest");
+		strnest = MEM_mallocN(sizeof(char)*(len+2), "rna_generate_property -> strnest");
+		errnest = MEM_mallocN(sizeof(char)*(len+2), "rna_generate_property -> errnest");
 
 		strcpy(strnest, "_"); strcat(strnest, nest);
 		strcpy(errnest, "."); strcat(errnest, nest);
 
-		freenest= 1;
+		freenest = 1;
 	}
 
-	switch(prop->type) {
+	switch (prop->type) {
 			case PROP_ENUM: {
-				EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
-				int i, defaultfound= 0, totflag= 0;
+				EnumPropertyRNA *eprop = (EnumPropertyRNA*)prop;
+				int i, defaultfound = 0, totflag = 0;
 
-				if(eprop->item) {
-					fprintf(f, "static EnumPropertyItem rna_%s%s_%s_items[%d] = {\n\t", srna->identifier, strnest, prop->identifier, eprop->totitem+1);
+				if (eprop->item) {
+					fprintf(f, "static EnumPropertyItem rna_%s%s_%s_items[%d] = {\n\t", srna->identifier,
+					        strnest, prop->identifier, eprop->totitem+1);
 
-					for(i=0; i<eprop->totitem; i++) {
+					for (i = 0; i<eprop->totitem; i++) {
 						fprintf(f, "{%d, ", eprop->item[i].value);
 						rna_print_c_string(f, eprop->item[i].identifier); fprintf(f, ", ");
 						fprintf(f, "%d, ", eprop->item[i].icon);
 						rna_print_c_string(f, eprop->item[i].name); fprintf(f, ", ");
 						rna_print_c_string(f, eprop->item[i].description); fprintf(f, "},\n\t");
 
-						if(eprop->item[i].identifier[0]) {
-							if(prop->flag & PROP_ENUM_FLAG) {
+						if (eprop->item[i].identifier[0]) {
+							if (prop->flag & PROP_ENUM_FLAG) {
 								totflag |= eprop->item[i].value;
 							}
 							else {
-								if(eprop->defaultvalue == eprop->item[i].value) {
-									defaultfound= 1;
+								if (eprop->defaultvalue == eprop->item[i].value) {
+									defaultfound = 1;
 								}
 							}
 						}
@@ -2149,41 +2236,43 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
 
 					fprintf(f, "{0, NULL, 0, NULL, NULL}\n};\n\n");
 
-					if(prop->flag & PROP_ENUM_FLAG) {
-						if(eprop->defaultvalue & ~totflag) {
+					if (prop->flag & PROP_ENUM_FLAG) {
+						if (eprop->defaultvalue & ~totflag) {
 							fprintf(stderr, "%s: %s%s.%s, enum default includes unused bits (%d).\n",
-							        __func__, srna->identifier, errnest, prop->identifier, eprop->defaultvalue & ~totflag);
-							DefRNA.error= 1;
+							        __func__, srna->identifier, errnest, prop->identifier,
+							        eprop->defaultvalue & ~totflag);
+							DefRNA.error = 1;
 						}
 					}
 					else {
-						if(!defaultfound) {
+						if (!defaultfound) {
 							fprintf(stderr, "%s: %s%s.%s, enum default is not in items.\n",
 							        __func__, srna->identifier, errnest, prop->identifier);
-							DefRNA.error= 1;
+							DefRNA.error = 1;
 						}
 					}
 				}
 				else {
 					fprintf(stderr, "%s: %s%s.%s, enum must have items defined.\n",
 					        __func__, srna->identifier, errnest, prop->identifier);
-					DefRNA.error= 1;
+					DefRNA.error = 1;
 				}
 				break;
 			}
 			case PROP_BOOLEAN: {
-				BoolPropertyRNA *bprop= (BoolPropertyRNA*)prop;
+				BoolPropertyRNA *bprop = (BoolPropertyRNA*)prop;
 				unsigned int i;
 
-				if(prop->arraydimension && prop->totarraylength) {
-					fprintf(f, "static int rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength);
+				if (prop->arraydimension && prop->totarraylength) {
+					fprintf(f, "static int rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest,
+					        prop->identifier, prop->totarraylength);
 
-					for(i=0; i<prop->totarraylength; i++) {
-						if(bprop->defaultarray)
+					for (i = 0; i<prop->totarraylength; i++) {
+						if (bprop->defaultarray)
 							fprintf(f, "%d", bprop->defaultarray[i]);
 						else
 							fprintf(f, "%d", bprop->defaultvalue);
-						if(i != prop->totarraylength-1)
+						if (i != prop->totarraylength-1)
 							fprintf(f, ",\n\t");
 					}
 
@@ -2192,18 +2281,19 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
 				break;
 			}
 			case PROP_INT: {
-				IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
+				IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
 				unsigned int i;
 
-				if(prop->arraydimension && prop->totarraylength) {
-					fprintf(f, "static int rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength);
+				if (prop->arraydimension && prop->totarraylength) {
+					fprintf(f, "static int rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest,
+					        prop->identifier, prop->totarraylength);
 
-					for(i=0; i<prop->totarraylength; i++) {
-						if(iprop->defaultarray)
+					for (i = 0; i<prop->totarraylength; i++) {
+						if (iprop->defaultarray)
 							fprintf(f, "%d", iprop->defaultarray[i]);
 						else
 							fprintf(f, "%d", iprop->defaultvalue);
-						if(i != prop->totarraylength-1)
+						if (i != prop->totarraylength-1)
 							fprintf(f, ",\n\t");
 					}
 
@@ -2212,18 +2302,19 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
 				break;
 			}
 			case PROP_FLOAT: {
-				FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
+				FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
 				unsigned int i;
 
-				if(prop->arraydimension && prop->totarraylength) {
-					fprintf(f, "static float rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength);
+				if (prop->arraydimension && prop->totarraylength) {
+					fprintf(f, "static float rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest,
+					        prop->identifier, prop->totarraylength);
 
-					for(i=0; i<prop->totarraylength; i++) {
-						if(fprop->defaultarray)
+					for (i = 0; i<prop->totarraylength; i++) {
+						if (fprop->defaultarray)
 							rna_float_print(f, fprop->defaultarray[i]);
 						else
 							rna_float_print(f, fprop->defaultvalue);
-						if(i != prop->totarraylength-1)
+						if (i != prop->totarraylength-1)
 							fprintf(f, ",\n\t");
 					}
 
@@ -2235,11 +2326,14 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
 				break;
 	}
 
-	fprintf(f, "%s%s rna_%s%s_%s = {\n", (prop->flag & PROP_EXPORT)? "": "", rna_property_structname(prop->type), srna->identifier, strnest, prop->identifier);
+	fprintf(f, "%s%s rna_%s%s_%s = {\n",
+	        (prop->flag & PROP_EXPORT) ? "": "",
+	        rna_property_structname(prop->type),
+	        srna->identifier, strnest, prop->identifier);
 
-	if(prop->next) fprintf(f, "\t{(PropertyRNA*)&rna_%s%s_%s, ", srna->identifier, strnest, prop->next->identifier);
+	if (prop->next) fprintf(f, "\t{(PropertyRNA*)&rna_%s%s_%s, ", srna->identifier, strnest, prop->next->identifier);
 	else fprintf(f, "\t{NULL, ");
-	if(prop->prev) fprintf(f, "(PropertyRNA*)&rna_%s%s_%s,\n", srna->identifier, strnest, prop->prev->identifier);
+	if (prop->prev) fprintf(f, "(PropertyRNA*)&rna_%s%s_%s,\n", srna->identifier, strnest, prop->prev->identifier);
 	else fprintf(f, "NULL,\n");
 	fprintf(f, "\t%d, ", prop->magic);
 	rna_print_c_string(f, prop->identifier);
@@ -2248,42 +2342,73 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
 	rna_print_c_string(f, prop->description); fprintf(f, ",\n\t");
 	fprintf(f, "%d,\n", prop->icon);
 	rna_print_c_string(f, prop->translation_context); fprintf(f, ",\n\t");
-	fprintf(f, "\t%s, %s|%s, %s, %u, {%u, %u, %u}, %u,\n", RNA_property_typename(prop->type), rna_property_subtypename(prop->subtype), rna_property_subtype_unit(prop->subtype), rna_function_string(prop->getlength), prop->arraydimension, prop->arraylength[0], prop->arraylength[1], prop->arraylength[2], prop->totarraylength);
-	fprintf(f, "\t%s%s, %d, %s, %s,\n", (prop->flag & PROP_CONTEXT_UPDATE)? "(UpdateFunc)": "", rna_function_string(prop->update), prop->noteflag, rna_function_string(prop->editable), rna_function_string(prop->itemeditable));
-
-	if(prop->flag & PROP_RAW_ACCESS) rna_set_raw_offset(f, srna, prop);
+	fprintf(f, "\t%s, %s|%s, %s, %u, {%u, %u, %u}, %u,\n",
+	        RNA_property_typename(prop->type),
+	        rna_property_subtypename(prop->subtype),
+	        rna_property_subtype_unit(prop->subtype),
+	        rna_function_string(prop->getlength),
+	        prop->arraydimension,
+	        prop->arraylength[0],
+	        prop->arraylength[1],
+	        prop->arraylength[2],
+	        prop->totarraylength);
+	fprintf(f, "\t%s%s, %d, %s, %s,\n",
+	        (prop->flag & PROP_CONTEXT_UPDATE) ? "(UpdateFunc)": "",
+	        rna_function_string(prop->update),
+	        prop->noteflag,
+	        rna_function_string(prop->editable),
+	        rna_function_string(prop->itemeditable));
+
+	if (prop->flag & PROP_RAW_ACCESS) rna_set_raw_offset(f, srna, prop);
 	else fprintf(f, "\t0, -1");
 
 	/* our own type - collections/arrays only */
-	if(prop->srna) fprintf(f, ", &RNA_%s", (const char*)prop->srna);
+	if (prop->srna) fprintf(f, ", &RNA_%s", (const char*)prop->srna);
 	else fprintf(f, ", NULL");
 
 	fprintf(f, "},\n");
 
-	switch(prop->type) {
+	switch (prop->type) {
 			case PROP_BOOLEAN: {
-				BoolPropertyRNA *bprop= (BoolPropertyRNA*)prop;
-				fprintf(f, "\t%s, %s, %s, %s, %d, ", rna_function_string(bprop->get), rna_function_string(bprop->set), rna_function_string(bprop->getarray), rna_function_string(bprop->setarray), bprop->defaultvalue);
-				if(prop->arraydimension && prop->totarraylength) fprintf(f, "rna_%s%s_%s_default\n", srna->identifier, strnest, prop->identifier);
+				BoolPropertyRNA *bprop = (BoolPropertyRNA*)prop;
+				fprintf(f, "\t%s, %s, %s, %s, %d, ",
+				        rna_function_string(bprop->get),
+				        rna_function_string(bprop->set),
+				        rna_function_string(bprop->getarray),
+				        rna_function_string(bprop->setarray),
+				        bprop->defaultvalue);
+				if (prop->arraydimension && prop->totarraylength)
+					fprintf(f, "rna_%s%s_%s_default\n", srna->identifier, strnest, prop->identifier);
 				else fprintf(f, "NULL\n");
 				break;
 			}
 			case PROP_INT: {
-				IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
-				fprintf(f, "\t%s, %s, %s, %s, %s,\n\t", rna_function_string(iprop->get), rna_function_string(iprop->set), rna_function_string(iprop->getarray), rna_function_string(iprop->setarray), rna_function_string(iprop->range));
+				IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
+				fprintf(f, "\t%s, %s, %s, %s, %s,\n\t",
+				        rna_function_string(iprop->get),
+				        rna_function_string(iprop->set),
+				        rna_function_string(iprop->getarray),
+				        rna_function_string(iprop->setarray),
+				        rna_function_string(iprop->range));
 				rna_int_print(f, iprop->softmin); fprintf(f, ", ");
 				rna_int_print(f, iprop->softmax); fprintf(f, ", ");
 				rna_int_print(f, iprop->hardmin); fprintf(f, ", ");
 				rna_int_print(f, iprop->hardmax); fprintf(f, ", ");
 				rna_int_print(f, iprop->step); fprintf(f, ", ");
 				rna_int_print(f, iprop->defaultvalue); fprintf(f, ", ");
-				if(prop->arraydimension && prop->totarraylength) fprintf(f, "rna_%s%s_%s_default\n", srna->identifier, strnest, prop->identifier);
+				if (prop->arraydimension && prop->totarraylength)
+					fprintf(f, "rna_%s%s_%s_default\n", srna->identifier, strnest, prop->identifier);
 				else fprintf(f, "NULL\n");
 				break;
 			}
 			case PROP_FLOAT: {
-				FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
-				fprintf(f, "\t%s, %s, %s, %s, %s, ", rna_function_string(fprop->get), rna_function_string(fprop->set), rna_function_string(fprop->getarray), rna_function_string(fprop->setarray), rna_function_string(fprop->range));
+				FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
+				fprintf(f, "\t%s, %s, %s, %s, %s, ",
+				        rna_function_string(fprop->get),
+				        rna_function_string(fprop->set),
+				        rna_function_string(fprop->getarray),
+				        rna_function_string(fprop->setarray),
+				        rna_function_string(fprop->range));
 				rna_float_print(f, fprop->softmin); fprintf(f, ", ");
 				rna_float_print(f, fprop->softmax); fprintf(f, ", ");
 				rna_float_print(f, fprop->hardmin); fprintf(f, ", ");
@@ -2291,20 +2416,28 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
 				rna_float_print(f, fprop->step); fprintf(f, ", ");
 				rna_int_print(f, (int)fprop->precision); fprintf(f, ", ");
 				rna_float_print(f, fprop->defaultvalue); fprintf(f, ", ");
-				if(prop->arraydimension && prop->totarraylength) fprintf(f, "rna_%s%s_%s_default\n", srna->identifier, strnest, prop->identifier);
+				if (prop->arraydimension && prop->totarraylength)
+					fprintf(f, "rna_%s%s_%s_default\n", srna->identifier, strnest, prop->identifier);
 				else fprintf(f, "NULL\n");
 				break;
 			}
 			case PROP_STRING: {
-				StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
-				fprintf(f, "\t%s, %s, %s, %d, ", rna_function_string(sprop->get), rna_function_string(sprop->length), rna_function_string(sprop->set), sprop->maxlength);
+				StringPropertyRNA *sprop = (StringPropertyRNA*)prop;
+				fprintf(f, "\t%s, %s, %s, %d, ",
+				        rna_function_string(sprop->get),
+				        rna_function_string(sprop->length),
+				        rna_function_string(sprop->set),
+				        sprop->maxlength);
 				rna_print_c_string(f, sprop->defaultvalue); fprintf(f, "\n");
 				break;
 			}
 			case PROP_ENUM: {
-				EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
-				fprintf(f, "\t%s, %s, %s, NULL, ", rna_function_string(eprop->get), rna_function_string(eprop->set), rna_function_string(eprop->itemf));
-				if(eprop->item)
+				EnumPropertyRNA *eprop = (EnumPropertyRNA*)prop;
+				fprintf(f, "\t%s, %s, %s, NULL, ",
+				        rna_function_string(eprop->get),
+				        rna_function_string(eprop->set),
+				        rna_function_string(eprop->itemf));
+				if (eprop->item)
 					fprintf(f, "rna_%s%s_%s_items, ", srna->identifier, strnest, prop->identifier);
 				else
 					fprintf(f, "NULL, ");
@@ -2312,16 +2445,27 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
 				break;
 			}
 			case PROP_POINTER: {
-				PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
-				fprintf(f, "\t%s, %s, %s, %s,", rna_function_string(pprop->get), rna_function_string(pprop->set), rna_function_string(pprop->typef), rna_function_string(pprop->poll));
-				if(pprop->type) fprintf(f, "&RNA_%s\n", (const char*)pprop->type);
+				PointerPropertyRNA *pprop = (PointerPropertyRNA*)prop;
+				fprintf(f, "\t%s, %s, %s, %s,", rna_function_string(pprop->get),
+				        rna_function_string(pprop->set),
+				        rna_function_string(pprop->typef),
+				        rna_function_string(pprop->poll));
+				if (pprop->type) fprintf(f, "&RNA_%s\n", (const char*)pprop->type);
 				else fprintf(f, "NULL\n");
 				break;
 			}
 			case PROP_COLLECTION: {
-				CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
-				fprintf(f, "\t%s, %s, %s, %s, %s, %s, %s, %s, ", rna_function_string(cprop->begin), rna_function_string(cprop->next), rna_function_string(cprop->end), rna_function_string(cprop->get), rna_function_string(cprop->length), rna_function_string(cprop->lookupint), rna_function_string(cprop->lookupstring), rna_function_string(cprop->assignint));
-				if(cprop->item_type) fprintf(f, "&RNA_%s\n", (const char*)cprop->item_type);
+				CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)prop;
+				fprintf(f, "\t%s, %s, %s, %s, %s, %s, %s, %s, ",
+				        rna_function_string(cprop->begin),
+				        rna_function_string(cprop->next),
+				        rna_function_string(cprop->end),
+				        rna_function_string(cprop->get),
+				        rna_function_string(cprop->length),
+				        rna_function_string(cprop->lookupint),
+				        rna_function_string(cprop->lookupstring),
+				        rna_function_string(cprop->assignint));
+				if (cprop->item_type) fprintf(f, "&RNA_%s\n", (const char*)cprop->item_type);
 				else fprintf(f, "NULL\n");
 				break;
 			}
@@ -2329,7 +2473,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
 
 	fprintf(f, "};\n\n");
 
-	if(freenest) {
+	if (freenest) {
 		MEM_freeN(strnest);
 		MEM_freeN(errnest);
 	}
@@ -2344,28 +2488,34 @@ static void rna_generate_struct(BlenderRNA *brna, StructRNA *srna, FILE *f)
 
 	fprintf(f, "/* %s */\n", srna->name);
 
-	for(prop= srna->cont.properties.first; prop; prop= prop->next)
+	for (prop = srna->cont.properties.first; prop; prop = prop->next)
 		rna_generate_property(f, srna, NULL, prop);
 
-	for(func= srna->functions.first; func; func= func->cont.next) {
-		for(parm= func->cont.properties.first; parm; parm= parm->next)
+	for (func = srna->functions.first; func; func = func->cont.next) {
+		for (parm = func->cont.properties.first; parm; parm = parm->next)
 			rna_generate_property(f, srna, func->identifier, parm);
 
 		fprintf(f, "%s%s rna_%s_%s_func = {\n", "", "FunctionRNA", srna->identifier, func->identifier);
 
-		if(func->cont.next) fprintf(f, "\t{(FunctionRNA*)&rna_%s_%s_func, ", srna->identifier, ((FunctionRNA*)func->cont.next)->identifier);
-		else fprintf(f, "\t{NULL, ");
-		if(func->cont.prev) fprintf(f, "(FunctionRNA*)&rna_%s_%s_func,\n", srna->identifier, ((FunctionRNA*)func->cont.prev)->identifier);
-		else fprintf(f, "NULL,\n");
+		if (func->cont.next)
+			fprintf(f, "\t{(FunctionRNA*)&rna_%s_%s_func, ", srna->identifier,
+			        ((FunctionRNA*)func->cont.next)->identifier);
+		else
+			fprintf(f, "\t{NULL, ");
+		if (func->cont.prev)
+			fprintf(f, "(FunctionRNA*)&rna_%s_%s_func,\n", srna->identifier,
+			        ((FunctionRNA*)func->cont.prev)->identifier);
+		else
+			fprintf(f, "NULL,\n");
 
 		fprintf(f, "\tNULL,\n");
 
-		parm= func->cont.properties.first;
-		if(parm) fprintf(f, "\t{(PropertyRNA*)&rna_%s_%s_%s, ", srna->identifier, func->identifier, parm->identifier);
+		parm = func->cont.properties.first;
+		if (parm) fprintf(f, "\t{(PropertyRNA*)&rna_%s_%s_%s, ", srna->identifier, func->identifier, parm->identifier);
 		else fprintf(f, "\t{NULL, ");
 
-		parm= func->cont.properties.last;
-		if(parm) fprintf(f, "(PropertyRNA*)&rna_%s_%s_%s}},\n", srna->identifier, func->identifier, parm->identifier);
+		parm = func->cont.properties.last;
+		if (parm) fprintf(f, "(PropertyRNA*)&rna_%s_%s_%s}},\n", srna->identifier, func->identifier, parm->identifier);
 		else fprintf(f, "NULL}},\n");
 
 		fprintf(f, "\t");
@@ -2373,12 +2523,14 @@ static void rna_generate_struct(BlenderRNA *brna, StructRNA *srna, FILE *f)
 		fprintf(f, ", %d, ", func->flag);
 		rna_print_c_string(f, func->description); fprintf(f, ",\n");
 
-		dfunc= rna_find_function_def(func);
-		if(dfunc->gencall) fprintf(f, "\t%s,\n", dfunc->gencall);
+		dfunc = rna_find_function_def(func);
+		if (dfunc->gencall) fprintf(f, "\t%s,\n", dfunc->gencall);
 		else fprintf(f, "\tNULL,\n");
 
-		if(func->c_ret) fprintf(f, "\t(PropertyRNA*)&rna_%s_%s_%s\n", srna->identifier, func->identifier, func->c_ret->identifier);
-		else fprintf(f, "\tNULL\n");
+		if (func->c_ret)
+			fprintf(f, "\t(PropertyRNA*)&rna_%s_%s_%s\n", srna->identifier, func->identifier, func->c_ret->identifier);
+		else
+			fprintf(f, "\tNULL\n");
 
 		fprintf(f, "};\n");
 		fprintf(f, "\n");
@@ -2386,19 +2538,19 @@ static void rna_generate_struct(BlenderRNA *brna, StructRNA *srna, FILE *f)
 
 	fprintf(f, "StructRNA RNA_%s = {\n", srna->identifier);
 
-	if(srna->cont.next) fprintf(f, "\t{(ContainerRNA *)&RNA_%s, ", ((StructRNA*)srna->cont.next)->identifier);
+	if (srna->cont.next) fprintf(f, "\t{(ContainerRNA *)&RNA_%s, ", ((StructRNA*)srna->cont.next)->identifier);
 	else fprintf(f, "\t{NULL, ");
-	if(srna->cont.prev) fprintf(f, "(ContainerRNA *)&RNA_%s,\n", ((StructRNA*)srna->cont.prev)->identifier);
+	if (srna->cont.prev) fprintf(f, "(ContainerRNA *)&RNA_%s,\n", ((StructRNA*)srna->cont.prev)->identifier);
 	else fprintf(f, "NULL,\n");
 
 	fprintf(f, "\tNULL,\n");
 
-	prop= srna->cont.properties.first;
-	if(prop) fprintf(f, "\t{(PropertyRNA*)&rna_%s_%s, ", srna->identifier, prop->identifier);
+	prop = srna->cont.properties.first;
+	if (prop) fprintf(f, "\t{(PropertyRNA*)&rna_%s_%s, ", srna->identifier, prop->identifier);
 	else fprintf(f, "\t{NULL, ");
 
-	prop= srna->cont.properties.last;
-	if(prop) fprintf(f, "(PropertyRNA*)&rna_%s_%s}},\n", srna->identifier, prop->identifier);
+	prop = srna->cont.properties.last;
+	if (prop) fprintf(f, "(PropertyRNA*)&rna_%s_%s}},\n", srna->identifier, prop->identifier);
 	else fprintf(f, "NULL}},\n");
 	fprintf(f, "\t");
 	rna_print_c_string(f, srna->identifier);
@@ -2407,28 +2559,30 @@ static void rna_generate_struct(BlenderRNA *brna, StructRNA *srna, FILE *f)
 	rna_print_c_string(f, srna->name);
 	fprintf(f, ", ");
 	rna_print_c_string(f, srna->description);
+	fprintf(f, ", ");
+	rna_print_c_string(f, srna->translation_context);
 	fprintf(f, ",\n\t%d,\n", srna->icon);
 
-	prop= srna->nameproperty;
-	if(prop) {
-		base= srna;
-		while (base->base && base->base->nameproperty==prop)
-			base= base->base;
+	prop = srna->nameproperty;
+	if (prop) {
+		base = srna;
+		while (base->base && base->base->nameproperty == prop)
+			base = base->base;
 
 		fprintf(f, "\t(PropertyRNA*)&rna_%s_%s, ", base->identifier, prop->identifier);
 	}
 	else fprintf(f, "\tNULL, ");
 
-	prop= srna->iteratorproperty;
-	base= srna;
-	while (base->base && base->base->iteratorproperty==prop)
-		base= base->base;
+	prop = srna->iteratorproperty;
+	base = srna;
+	while (base->base && base->base->iteratorproperty == prop)
+		base = base->base;
 	fprintf(f, "(PropertyRNA*)&rna_%s_rna_properties,\n", base->identifier);
 
-	if(srna->base) fprintf(f, "\t&RNA_%s,\n", srna->base->identifier);
+	if (srna->base) fprintf(f, "\t&RNA_%s,\n", srna->base->identifier);
 	else fprintf(f, "\tNULL,\n");
 
-	if(srna->nested) fprintf(f, "\t&RNA_%s,\n", srna->nested->identifier);
+	if (srna->nested) fprintf(f, "\t&RNA_%s,\n", srna->nested->identifier);
 	else fprintf(f, "\tNULL,\n");
 
 	fprintf(f, "\t%s,\n", rna_function_string(srna->refine));
@@ -2438,18 +2592,18 @@ static void rna_generate_struct(BlenderRNA *brna, StructRNA *srna, FILE *f)
 	fprintf(f, "\t%s,\n", rna_function_string(srna->instance));
 	fprintf(f, "\t%s,\n", rna_function_string(srna->idproperties));
 
-	if(srna->reg && !srna->refine) {
+	if (srna->reg && !srna->refine) {
 		fprintf(stderr, "%s: %s has a register function, must also have refine function.\n",
 		        __func__, srna->identifier);
-		DefRNA.error= 1;
+		DefRNA.error = 1;
 	}
 
-	func= srna->functions.first;
-	if(func) fprintf(f, "\t{(FunctionRNA*)&rna_%s_%s_func, ", srna->identifier, func->identifier);
+	func = srna->functions.first;
+	if (func) fprintf(f, "\t{(FunctionRNA*)&rna_%s_%s_func, ", srna->identifier, func->identifier);
 	else fprintf(f, "\t{NULL, ");
 
-	func= srna->functions.last;
-	if(func) fprintf(f, "(FunctionRNA*)&rna_%s_%s_func}\n", srna->identifier, func->identifier);
+	func = srna->functions.last;
+	if (func) fprintf(f, "(FunctionRNA*)&rna_%s_%s_func}\n", srna->identifier, func->identifier);
 	else fprintf(f, "NULL}\n");
 
 	fprintf(f, "};\n");
@@ -2463,7 +2617,7 @@ typedef struct RNAProcessItem {
 	void (*define)(BlenderRNA *brna);
 } RNAProcessItem;
 
-static RNAProcessItem PROCESS_ITEMS[]= {
+static RNAProcessItem PROCESS_ITEMS[] = {
 	{"rna_rna.c", NULL, RNA_def_rna},
 	{"rna_ID.c", NULL, RNA_def_ID},
 	{"rna_texture.c", "rna_texture_api.c", RNA_def_texture},
@@ -2520,7 +2674,7 @@ static RNAProcessItem PROCESS_ITEMS[]= {
 	{"rna_userdef.c", NULL, RNA_def_userdef},
 	{"rna_vfont.c", NULL, RNA_def_vfont},
 	{"rna_wm.c", "rna_wm_api.c", RNA_def_wm},
-	{"rna_world.c", NULL, RNA_def_world},	
+	{"rna_world.c", NULL, RNA_def_world},
 	{"rna_movieclip.c", NULL, RNA_def_movieclip},
 	{"rna_tracking.c", NULL, RNA_def_tracking},
 	{NULL, NULL}};
@@ -2531,9 +2685,11 @@ static void rna_generate(BlenderRNA *brna, FILE *f, const char *filename, const
 	PropertyDefRNA *dp;
 	FunctionDefRNA *dfunc;
 	
-	fprintf(f, "\n/* Automatically generated struct definitions for the Data API.\n"
-				 "   Do not edit manually, changes will be overwritten.           */\n\n"
-				  "#define RNA_RUNTIME\n\n");
+	fprintf(f,
+	        "\n"
+	        "/* Automatically generated struct definitions for the Data API.\n"
+	        " * Do not edit manually, changes will be overwritten.           */\n\n"
+	        "#define RNA_RUNTIME\n\n");
 
 	fprintf(f, "#include <float.h>\n");
 	fprintf(f, "#include <stdio.h>\n");
@@ -2559,38 +2715,38 @@ static void rna_generate(BlenderRNA *brna, FILE *f, const char *filename, const
 	rna_generate_prototypes(brna, f);
 
 	fprintf(f, "#include \"%s\"\n", filename);
-	if(api_filename)
+	if (api_filename)
 		fprintf(f, "#include \"%s\"\n", api_filename);
 	fprintf(f, "\n");
 
 	fprintf(f, "/* Autogenerated Functions */\n\n");
 
-	for(ds=DefRNA.structs.first; ds; ds=ds->cont.next) {
-		if(!filename || ds->filename == filename) {
+	for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
+		if (!filename || ds->filename == filename) {
 			rna_generate_property_prototypes(brna, ds->srna, f);
 			rna_generate_function_prototypes(brna, ds->srna, f);
 		}
 	}
 
-	for(ds=DefRNA.structs.first; ds; ds=ds->cont.next)
-		if(!filename || ds->filename == filename)
-			for(dp=ds->cont.properties.first; dp; dp=dp->next)
+	for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
+		if (!filename || ds->filename == filename)
+			for (dp = ds->cont.properties.first; dp; dp = dp->next)
 				rna_def_property_funcs(f, ds->srna, dp);
 
-	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 (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
+		if (!filename || ds->filename == filename) {
+			for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next)
 				rna_def_function_funcs(f, ds, dfunc);
 
 			rna_generate_static_function_prototypes(brna, ds->srna, f);
 		}
 	}
 
-	for(ds=DefRNA.structs.first; ds; ds=ds->cont.next)
-		if(!filename || ds->filename == filename)
+	for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
+		if (!filename || ds->filename == filename)
 			rna_generate_struct(brna, ds->srna, f);
 
-	if(strcmp(filename, "rna_ID.c") == 0) {
+	if (strcmp(filename, "rna_ID.c") == 0) {
 		/* this is ugly, but we cannot have c files compiled for both
 		 * makesrna and blender with some build systems at the moment */
 		fprintf(f, "#include \"rna_define.c\"\n\n");
@@ -2608,8 +2764,9 @@ static void rna_generate_header(BlenderRNA *brna, FILE *f)
 	fprintf(f, "\n#ifndef __RNA_BLENDER_H__\n");
 	fprintf(f, "#define __RNA_BLENDER_H__\n\n");
 
-	fprintf(f, "/* Automatically generated function declarations for the Data API.\n"
-				 "   Do not edit manually, changes will be overwritten.              */\n\n");
+	fprintf(f,
+	        "/* Automatically generated function declarations for the Data API.\n"
+	        " * Do not edit manually, changes will be overwritten.              */\n\n");
 
 	fprintf(f, "#include \"RNA_types.h\"\n\n");
 
@@ -2618,7 +2775,8 @@ static void rna_generate_header(BlenderRNA *brna, FILE *f)
 	fprintf(f, "#define FOREACH_BEGIN(property, sptr, itemptr) \\\n");
 	fprintf(f, "	{ \\\n");
 	fprintf(f, "		CollectionPropertyIterator rna_macro_iter; \\\n");
-	fprintf(f, "		for(property##_begin(&rna_macro_iter, sptr); rna_macro_iter.valid; property##_next(&rna_macro_iter)) { \\\n");
+	fprintf(f, "		for (property##_begin(&rna_macro_iter, sptr); rna_macro_iter.valid; "
+	           "property##_next(&rna_macro_iter)) { \\\n");
 	fprintf(f, "			itemptr= rna_macro_iter.ptr;\n\n");
 
 	fprintf(f, "#define FOREACH_END(property) \\\n");
@@ -2626,18 +2784,18 @@ static void rna_generate_header(BlenderRNA *brna, FILE *f)
 	fprintf(f, "		property##_end(&rna_macro_iter); \\\n");
 	fprintf(f, "	}\n\n");
 
-	for(ds=DefRNA.structs.first; ds; ds=ds->cont.next) {
-		srna= ds->srna;
+	for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
+		srna = ds->srna;
 
 		fprintf(f, "/**************** %s ****************/\n\n", srna->name);
 
-		while(srna) {
+		while (srna) {
 			fprintf(f, "extern StructRNA RNA_%s;\n", srna->identifier);
-			srna= srna->base;
+			srna = srna->base;
 		}
 		fprintf(f, "\n");
 
-		for(dp=ds->cont.properties.first; dp; dp=dp->next)
+		for (dp = ds->cont.properties.first; dp; dp = dp->next)
 			rna_def_property_funcs_header(f, ds->srna, dp);
 	}
 
@@ -2711,7 +2869,8 @@ static const char *cpp_classes = ""
 "\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"
+"	const Array<T, Tsize>& operator=(const Array<T, Tsize>& other) { memcpy(data, other.data, sizeof(T)*Tsize); "
+"return *this; }\n"
 "\n"
 "	operator T*() { return data; }\n"
 "};\n"
@@ -2724,7 +2883,7 @@ static const char *cpp_classes = ""
 "class CollectionIterator {\n"
 "public:\n"
 "	CollectionIterator() : t(iter.ptr), init(false) { iter.valid= false; }\n"
-"	~CollectionIterator(void) { if(init) Tend(&iter); };\n"
+"	~CollectionIterator(void) { if (init) Tend(&iter); };\n"
 "\n"
 "	operator bool(void)\n"
 "	{ return iter.valid != 0; }\n"
@@ -2732,14 +2891,17 @@ static const char *cpp_classes = ""
 "\n"
 "	T& operator*(void) { return t; }\n"
 "	T* operator->(void) { return &t; }\n"
-"	bool operator==(const CollectionIterator<T, Tbegin, Tnext, Tend>& other) { return iter.valid == other.iter.valid; }\n"
-"	bool operator!=(const CollectionIterator<T, Tbegin, Tnext, Tend>& other) { return iter.valid != other.iter.valid; }\n"
+"	bool operator==(const CollectionIterator<T, Tbegin, Tnext, Tend>& other) "
+"{ return iter.valid == other.iter.valid; }\n"
+"	bool operator!=(const CollectionIterator<T, Tbegin, Tnext, Tend>& other) "
+"{ return iter.valid != other.iter.valid; }\n"
 "\n"
 "	void begin(const Pointer& ptr)\n"
-"	{ if(init) Tend(&iter); Tbegin(&iter, (PointerRNA*)&ptr.ptr); t = T(iter.ptr); init = true; }\n"
+"	{ if (init) Tend(&iter); Tbegin(&iter, (PointerRNA*)&ptr.ptr); t = T(iter.ptr); init = true; }\n"
 "\n"
 "private:\n"
-"	const CollectionIterator<T, Tbegin, Tnext, Tend>& operator=(const CollectionIterator<T, Tbegin, Tnext, Tend>& copy) {}\n"
+"	const CollectionIterator<T, Tbegin, Tnext, Tend>& operator="
+"(const CollectionIterator<T, Tbegin, Tnext, Tend>& copy) {}\n"
 ""
 "	CollectionPropertyIterator iter;\n"
 "	T t;\n"
@@ -2770,8 +2932,9 @@ static void rna_generate_header_cpp(BlenderRNA *brna, FILE *f)
 	fprintf(f, "\n#ifndef __RNA_BLENDER_CPP_H__\n");
 	fprintf(f, "#define __RNA_BLENDER_CPP_H__\n\n");
 
-	fprintf(f, "/* Automatically generated classes for the Data API.\n"
-				 "   Do not edit manually, changes will be overwritten. */\n\n");
+	fprintf(f,
+	        "/* Automatically generated classes for the Data API.\n"
+	        " * Do not edit manually, changes will be overwritten. */\n\n");
 	
 	fprintf(f, "#include \"RNA_blender.h\"\n");
 	fprintf(f, "#include \"RNA_types.h\"\n");
@@ -2781,25 +2944,26 @@ static void rna_generate_header_cpp(BlenderRNA *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");
 
-	for(ds=DefRNA.structs.first; ds; ds=ds->cont.next) {
-		srna= ds->srna;
+	for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
+		srna = ds->srna;
 
 		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) :\n\t\t%s(ptr)", 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, "\t%s(const PointerRNA& ptr) :\n\t\t%s(ptr)", 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)", dp->prop->identifier);
 		fprintf(f, "\n\t\t{}\n\n");
 
-		for(dp=ds->cont.properties.first; dp; dp=dp->next)
+		for (dp = ds->cont.properties.first; dp; dp = dp->next)
 			rna_def_property_funcs_header_cpp(f, ds->srna, dp);
 		fprintf(f, "};\n\n");
 	}
@@ -2807,8 +2971,8 @@ static void rna_generate_header_cpp(BlenderRNA *brna, FILE *f)
 
 	fprintf(f, "/**************** Implementation ****************/\n");
 
-	for(ds=DefRNA.structs.first; ds; ds=ds->cont.next) {
-		for(dp=ds->cont.properties.first; dp; dp=dp->next)
+	for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
+		for (dp = ds->cont.properties.first; dp; dp = dp->next)
 			rna_def_property_funcs_impl_cpp(f, ds->srna, dp);
 
 		fprintf(f, "\n");
@@ -2819,7 +2983,7 @@ static void rna_generate_header_cpp(BlenderRNA *brna, FILE *f)
 
 static void make_bad_file(const char *file, int line)
 {
-	FILE *fp= fopen(file, "w");
+	FILE *fp = fopen(file, "w");
 	fprintf(fp, "#error \"Error! can't make correct RNA file from %s:%d, STUPID!\"\n", __FILE__, line);
 	fclose(fp);
 }
@@ -2834,15 +2998,15 @@ static int rna_preprocess(const char *outfile)
 	const char *deps[3]; /* expand as needed */
 
 	/* define rna */
-	brna= RNA_create();
+	brna = RNA_create();
 
-	for(i=0; PROCESS_ITEMS[i].filename; i++) {
-		if(PROCESS_ITEMS[i].define) {
+	for (i = 0; PROCESS_ITEMS[i].filename; i++) {
+		if (PROCESS_ITEMS[i].define) {
 			PROCESS_ITEMS[i].define(brna);
 
-			for(ds=DefRNA.structs.first; ds; ds=ds->cont.next)
-				if(!ds->filename)
-					ds->filename= PROCESS_ITEMS[i].filename;
+			for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
+				if (!ds->filename)
+					ds->filename = PROCESS_ITEMS[i].filename;
 		}
 	}
 
@@ -2853,22 +3017,22 @@ static int rna_preprocess(const char *outfile)
 	strcpy(deffile, outfile);
 	strcat(deffile, "RNA_blender_cpp.h" TMP_EXT);
 
-	status= (DefRNA.error != 0);
+	status = (DefRNA.error != 0);
 
-	if(status) {
+	if (status) {
 		make_bad_file(deffile, __LINE__);
 	}
 	else {
 		file = fopen(deffile, "w");
 
-		if(!file) {
+		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);
+			status = (DefRNA.error != 0);
 		}
 	}
 
@@ -2877,33 +3041,33 @@ static int rna_preprocess(const char *outfile)
 	rna_sort(brna);
 
 	/* create rna_gen_*.c files */
-	for(i=0; PROCESS_ITEMS[i].filename; i++) {
+	for (i = 0; PROCESS_ITEMS[i].filename; i++) {
 		strcpy(deffile, outfile);
 		strcat(deffile, PROCESS_ITEMS[i].filename);
 		deffile[strlen(deffile)-2] = '\0';
 		strcat(deffile, "_gen.c" TMP_EXT);
 
-		if(status) {
+		if (status) {
 			make_bad_file(deffile, __LINE__);
 		}
 		else {
 			file = fopen(deffile, "w");
 
-			if(!file) {
+			if (!file) {
 				fprintf(stderr, "Unable to open file: %s\n", deffile);
 				status = 1;
 			}
 			else {
 				rna_generate(brna, file, PROCESS_ITEMS[i].filename, PROCESS_ITEMS[i].api_filename);
 				fclose(file);
-				status= (DefRNA.error != 0);
+				status = (DefRNA.error != 0);
 			}
 		}
 
 		/* avoid unneeded rebuilds */
-		deps[0]= PROCESS_ITEMS[i].filename;
-		deps[1]= PROCESS_ITEMS[i].api_filename;
-		deps[2]= NULL;
+		deps[0] = PROCESS_ITEMS[i].filename;
+		deps[1] = PROCESS_ITEMS[i].api_filename;
+		deps[2] = NULL;
 
 		replace_if_different(deffile, deps);
 	}
@@ -2912,20 +3076,20 @@ static int rna_preprocess(const char *outfile)
 	strcpy(deffile, outfile);
 	strcat(deffile, "RNA_blender.h" TMP_EXT);
 
-	if(status) {
+	if (status) {
 		make_bad_file(deffile, __LINE__);
 	}
 	else {
 		file = fopen(deffile, "w");
 
-		if(!file) {
+		if (!file) {
 			fprintf(stderr, "Unable to open file: %s\n", deffile);
 			status = 1;
 		}
 		else {
 			rna_generate_header(brna, file);
 			fclose(file);
-			status= (DefRNA.error != 0);
+			status = (DefRNA.error != 0);
 		}
 	}
 
@@ -2948,18 +3112,18 @@ int main(int argc, char **argv)
 {
 	int totblock, return_status = 0;
 
-	if(argc<2) {
+	if (argc<2) {
 		fprintf(stderr, "Usage: %s outdirectory/\n", argv[0]);
 		return_status = 1;
 	}
 	else {
-		fprintf(stderr, "Running makesrna, program versions %s\n",  RNA_VERSION_DATE);
-		makesrna_path= argv[0];
-		return_status= rna_preprocess(argv[1]);
+		fprintf(stderr, "Running makesrna");
+		makesrna_path = argv[0];
+		return_status = rna_preprocess(argv[1]);
 	}
 
-	totblock= MEM_get_memory_blocks_in_use();
-	if(totblock!=0) {
+	totblock = MEM_get_memory_blocks_in_use();
+	if (totblock != 0) {
 		fprintf(stderr, "Error Totblock: %d\n",totblock);
 		MEM_set_error_callback(mem_error_cb);
 		MEM_printmemlist();
@@ -2967,5 +3131,3 @@ int main(int argc, char **argv)
 
 	return return_status;
 }
-
-
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index de0cd6d..6992d99 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -40,7 +40,7 @@
 
 #include "rna_internal.h"
 
-/* enum of ID-block types 
+/* enum of ID-block types
  * NOTE: need to keep this in line with the other defines for these
  */
 EnumPropertyItem id_type_items[] = {
@@ -84,30 +84,30 @@ EnumPropertyItem id_type_items[] = {
 /* name functions that ignore the first two ID characters */
 void rna_ID_name_get(PointerRNA *ptr, char *value)
 {
-	ID *id= (ID*)ptr->data;
+	ID *id = (ID*)ptr->data;
 	BLI_strncpy(value, id->name+2, sizeof(id->name)-2);
 }
 
 int rna_ID_name_length(PointerRNA *ptr)
 {
-	ID *id= (ID*)ptr->data;
+	ID *id = (ID*)ptr->data;
 	return strlen(id->name+2);
 }
 
 void rna_ID_name_set(PointerRNA *ptr, const char *value)
 {
-	ID *id= (ID*)ptr->data;
+	ID *id = (ID*)ptr->data;
 	BLI_strncpy_utf8(id->name+2, value, sizeof(id->name)-2);
 	test_idbutton(id->name+2);
 }
 
 static int rna_ID_name_editable(PointerRNA *ptr)
 {
-	ID *id= (ID*)ptr->data;
+	ID *id = (ID*)ptr->data;
 	
 	if (GS(id->name) == ID_VF) {
-		VFont *vf= (VFont *)id;
-		if (strcmp(vf->name, FO_BUILTIN_NAME)==0)
+		VFont *vf = (VFont *)id;
+		if (strcmp(vf->name, FO_BUILTIN_NAME) == 0)
 			return 0;
 	}
 	
@@ -116,41 +116,41 @@ static int rna_ID_name_editable(PointerRNA *ptr)
 
 short RNA_type_to_ID_code(StructRNA *type)
 {
-	if(RNA_struct_is_a(type, &RNA_Action)) return ID_AC;
-	if(RNA_struct_is_a(type, &RNA_Armature)) return ID_AR;
-	if(RNA_struct_is_a(type, &RNA_Brush)) return ID_BR;
-	if(RNA_struct_is_a(type, &RNA_Camera)) return ID_CA;
-	if(RNA_struct_is_a(type, &RNA_Curve)) return ID_CU;
-	if(RNA_struct_is_a(type, &RNA_GreasePencil)) return ID_GD;
-	if(RNA_struct_is_a(type, &RNA_Group)) return ID_GR;
-	if(RNA_struct_is_a(type, &RNA_Image)) return ID_IM;
-	if(RNA_struct_is_a(type, &RNA_Key)) return ID_KE;
-	if(RNA_struct_is_a(type, &RNA_Lamp)) return ID_LA;
-	if(RNA_struct_is_a(type, &RNA_Library)) return ID_LI;
-	if(RNA_struct_is_a(type, &RNA_Lattice)) return ID_LT;
-	if(RNA_struct_is_a(type, &RNA_Material)) return ID_MA;
-	if(RNA_struct_is_a(type, &RNA_MetaBall)) return ID_MB;
-	if(RNA_struct_is_a(type, &RNA_NodeTree)) return ID_NT;
-	if(RNA_struct_is_a(type, &RNA_Mesh)) return ID_ME;
-	if(RNA_struct_is_a(type, &RNA_Object)) return ID_OB;
-	if(RNA_struct_is_a(type, &RNA_ParticleSettings)) return ID_PA;
-	if(RNA_struct_is_a(type, &RNA_Scene)) return ID_SCE;
-	if(RNA_struct_is_a(type, &RNA_Screen)) return ID_SCR;
-	if(RNA_struct_is_a(type, &RNA_Speaker)) return ID_SPK;
-	if(RNA_struct_is_a(type, &RNA_Sound)) return ID_SO;
-	if(RNA_struct_is_a(type, &RNA_Text)) return ID_TXT;
-	if(RNA_struct_is_a(type, &RNA_Texture)) return ID_TE;
-	if(RNA_struct_is_a(type, &RNA_VectorFont)) return ID_VF;
-	if(RNA_struct_is_a(type, &RNA_World)) return ID_WO;
-	if(RNA_struct_is_a(type, &RNA_WindowManager)) return ID_WM;
-	if(RNA_struct_is_a(type, &RNA_MovieClip)) return ID_MC;
+	if (RNA_struct_is_a(type, &RNA_Action)) return ID_AC;
+	if (RNA_struct_is_a(type, &RNA_Armature)) return ID_AR;
+	if (RNA_struct_is_a(type, &RNA_Brush)) return ID_BR;
+	if (RNA_struct_is_a(type, &RNA_Camera)) return ID_CA;
+	if (RNA_struct_is_a(type, &RNA_Curve)) return ID_CU;
+	if (RNA_struct_is_a(type, &RNA_GreasePencil)) return ID_GD;
+	if (RNA_struct_is_a(type, &RNA_Group)) return ID_GR;
+	if (RNA_struct_is_a(type, &RNA_Image)) return ID_IM;
+	if (RNA_struct_is_a(type, &RNA_Key)) return ID_KE;
+	if (RNA_struct_is_a(type, &RNA_Lamp)) return ID_LA;
+	if (RNA_struct_is_a(type, &RNA_Library)) return ID_LI;
+	if (RNA_struct_is_a(type, &RNA_Lattice)) return ID_LT;
+	if (RNA_struct_is_a(type, &RNA_Material)) return ID_MA;
+	if (RNA_struct_is_a(type, &RNA_MetaBall)) return ID_MB;
+	if (RNA_struct_is_a(type, &RNA_NodeTree)) return ID_NT;
+	if (RNA_struct_is_a(type, &RNA_Mesh)) return ID_ME;
+	if (RNA_struct_is_a(type, &RNA_Object)) return ID_OB;
+	if (RNA_struct_is_a(type, &RNA_ParticleSettings)) return ID_PA;
+	if (RNA_struct_is_a(type, &RNA_Scene)) return ID_SCE;
+	if (RNA_struct_is_a(type, &RNA_Screen)) return ID_SCR;
+	if (RNA_struct_is_a(type, &RNA_Speaker)) return ID_SPK;
+	if (RNA_struct_is_a(type, &RNA_Sound)) return ID_SO;
+	if (RNA_struct_is_a(type, &RNA_Text)) return ID_TXT;
+	if (RNA_struct_is_a(type, &RNA_Texture)) return ID_TE;
+	if (RNA_struct_is_a(type, &RNA_VectorFont)) return ID_VF;
+	if (RNA_struct_is_a(type, &RNA_World)) return ID_WO;
+	if (RNA_struct_is_a(type, &RNA_WindowManager)) return ID_WM;
+	if (RNA_struct_is_a(type, &RNA_MovieClip)) return ID_MC;
 
 	return 0;
 }
 
 StructRNA *ID_code_to_RNA_type(short idcode)
 {
-	switch(idcode) {
+	switch (idcode) {
 		case ID_AC: return &RNA_Action;
 		case ID_AR: return &RNA_Armature;
 		case ID_BR: return &RNA_Brush;
@@ -185,7 +185,7 @@ StructRNA *ID_code_to_RNA_type(short idcode)
 
 StructRNA *rna_ID_refine(PointerRNA *ptr)
 {
-	ID *id= (ID*)ptr->data;
+	ID *id = (ID*)ptr->data;
 
 	return ID_code_to_RNA_type(GS(id->name));
 }
@@ -197,13 +197,13 @@ IDProperty *rna_ID_idprops(PointerRNA *ptr, int create)
 
 void rna_ID_fake_user_set(PointerRNA *ptr, int value)
 {
-	ID *id= (ID*)ptr->data;
+	ID *id = (ID*)ptr->data;
 
-	if(value && !(id->flag & LIB_FAKEUSER)) {
+	if (value && !(id->flag & LIB_FAKEUSER)) {
 		id->flag |= LIB_FAKEUSER;
 		id_us_plus(id);
 	}
-	else if(!value && (id->flag & LIB_FAKEUSER)) {
+	else if (!value && (id->flag & LIB_FAKEUSER)) {
 		id->flag &= ~LIB_FAKEUSER;
 		id_us_min(id);
 	}
@@ -219,7 +219,9 @@ void rna_PropertyGroup_unregister(Main *UNUSED(bmain), StructRNA *type)
 	RNA_struct_free(&BLENDER_RNA, type);
 }
 
-StructRNA *rna_PropertyGroup_register(Main *UNUSED(bmain), ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc UNUSED(call), StructFreeFunc UNUSED(free))
+StructRNA *rna_PropertyGroup_register(Main *UNUSED(bmain), ReportList *reports, void *data, const char *identifier,
+                                      StructValidateFunc validate, StructCallbackFunc UNUSED(call),
+                                      StructFreeFunc UNUSED(free))
 {
 	PointerRNA dummyptr;
 
@@ -227,19 +229,20 @@ StructRNA *rna_PropertyGroup_register(Main *UNUSED(bmain), ReportList *reports,
 	RNA_pointer_create(NULL, &RNA_PropertyGroup, NULL, &dummyptr);
 
 	/* validate the python class */
-	if(validate(&dummyptr, data, NULL) != 0)
+	if (validate(&dummyptr, data, NULL) != 0)
 		return NULL;
 
 	/* note: it looks like there is no length limit on the srna id since its
 	 * just a char pointer, but take care here, also be careful that python
 	 * 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);
+	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);
 		return NULL;
 	}
 
-	return RNA_def_struct(&BLENDER_RNA, identifier, "PropertyGroup");  // XXX
+	return RNA_def_struct(&BLENDER_RNA, identifier, "PropertyGroup");  /* XXX */
 }
 
 StructRNA* rna_PropertyGroup_refine(PointerRNA *ptr)
@@ -251,8 +254,8 @@ ID *rna_ID_copy(ID *id)
 {
 	ID *newid;
 
-	if(id_copy(id, &newid, 0)) {
-		if(newid) id_us_min(newid);
+	if (id_copy(id, &newid, 0)) {
+		if (newid) id_us_min(newid);
 		return newid;
 	}
 	
@@ -262,31 +265,35 @@ ID *rna_ID_copy(ID *id)
 static void rna_ID_update_tag(ID *id, ReportList *reports, int flag)
 {
 	/* XXX, new function for this! */
-	/*if (ob->type == OB_FONT) {
+#if 0
+	if (ob->type == OB_FONT) {
 		Curve *cu = ob->data;
 		freedisplist(&cu->disp);
 		BKE_text_to_curve(sce, ob, CU_LEFT);
-	}*/
+	}
+#endif
 
-	if(flag == 0) {
+	if (flag == 0) {
 		/* pass */
 	}
 	else {
 		/* ensure flag us correct for the type */
-		switch(GS(id->name)) {
+		switch (GS(id->name)) {
 		case ID_OB:
-			if(flag & ~(OB_RECALC_ALL)) {
+			if (flag & ~(OB_RECALC_ALL)) {
 				BKE_report(reports, RPT_ERROR, "'refresh' incompatible with Object ID type");
 				return;
 			}
 			break;
 		/* Could add particle updates later */
-/*		case ID_PA:
-			if(flag & ~(OB_RECALC_ALL|PSYS_RECALC)) {
+#if 0
+		case ID_PA:
+			if (flag & ~(OB_RECALC_ALL|PSYS_RECALC)) {
 				BKE_report(reports, RPT_ERROR, "'refresh' incompatible with ParticleSettings ID type");
 				return;
 			}
-			break; */
+			break;
+#endif
 		default:
 			BKE_report(reports, RPT_ERROR, "This ID type is not compatible with any 'refresh' options");
 			return;
@@ -298,28 +305,28 @@ static void rna_ID_update_tag(ID *id, ReportList *reports, int flag)
 
 void rna_ID_user_clear(ID *id)
 {
-	id->us= 0; /* dont save */
+	id->us = 0; /* don't save */
 	id->flag &= ~LIB_FAKEUSER;
 }
 
 static void rna_IDPArray_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	IDProperty *prop= (IDProperty *)ptr->data;
+	IDProperty *prop = (IDProperty *)ptr->data;
 	rna_iterator_array_begin(iter, IDP_IDPArray(prop), sizeof(IDProperty), prop->len, 0, NULL);
 }
 
 static int rna_IDPArray_length(PointerRNA *ptr)
 {
-	IDProperty *prop= (IDProperty *)ptr->data;
+	IDProperty *prop = (IDProperty *)ptr->data;
 	return prop->len;
 }
 
 int rna_IDMaterials_assign_int(PointerRNA *ptr, int key, const PointerRNA *assign_ptr)
 {
-	ID *id=           ptr->id.data;
-	short *totcol= give_totcolp_id(id);
-	Material *mat_id= assign_ptr->id.data;
-	if(totcol && (key >= 0 && key < *totcol)) {
+	ID *id =           ptr->id.data;
+	short *totcol = give_totcolp_id(id);
+	Material *mat_id = assign_ptr->id.data;
+	if (totcol && (key >= 0 && key < *totcol)) {
 		assign_material_id(id, mat_id, key + 1);
 		return 1;
 	}
@@ -330,7 +337,7 @@ int rna_IDMaterials_assign_int(PointerRNA *ptr, int key, const PointerRNA *assig
 
 void rna_Library_filepath_set(PointerRNA *ptr, const char *value)
 {
-	Library *lib= (Library*)ptr->data;
+	Library *lib = (Library*)ptr->data;
 	BKE_library_filepath_set(lib, value);
 }
 
@@ -343,56 +350,57 @@ static void rna_def_ID_properties(BlenderRNA *brna)
 
 	/* this is struct is used for holding the virtual
 	 * PropertyRNA's for ID properties */
-	srna= RNA_def_struct(brna, "PropertyGroupItem", NULL);
+	srna = RNA_def_struct(brna, "PropertyGroupItem", NULL);
 	RNA_def_struct_sdna(srna, "IDProperty");
 	RNA_def_struct_ui_text(srna, "ID Property", "Property that stores arbitrary, user defined properties");
 	
 	/* IDP_STRING */
-	prop= RNA_def_property(srna, "string", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "string", PROP_STRING, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
 
 	/* IDP_INT */
-	prop= RNA_def_property(srna, "int", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "int", PROP_INT, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
 
-	prop= RNA_def_property(srna, "int_array", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "int_array", PROP_INT, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
 	RNA_def_property_array(prop, 1);
 
 	/* IDP_FLOAT */
-	prop= RNA_def_property(srna, "float", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "float", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
 
-	prop= RNA_def_property(srna, "float_array", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "float_array", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
 	RNA_def_property_array(prop, 1);
 
 	/* IDP_DOUBLE */
-	prop= RNA_def_property(srna, "double", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "double", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
 
-	prop= RNA_def_property(srna, "double_array", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "double_array", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
 	RNA_def_property_array(prop, 1);
 
 	/* IDP_GROUP */
-	prop= RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "PropertyGroup");
 
-	prop= RNA_def_property(srna, "collection", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "collection", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
 	RNA_def_property_struct_type(prop, "PropertyGroup");
 
-	prop= RNA_def_property(srna, "idp_array", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "idp_array", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "PropertyGroup");
-	RNA_def_property_collection_funcs(prop, "rna_IDPArray_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_IDPArray_length", NULL, NULL, NULL);
+	RNA_def_property_collection_funcs(prop, "rna_IDPArray_begin", "rna_iterator_array_next", "rna_iterator_array_end",
+	                                  "rna_iterator_array_get", "rna_IDPArray_length", NULL, NULL, NULL);
 	RNA_def_property_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
 
-	// never tested, maybe its useful to have this?
+	/* never tested, maybe its useful to have this? */
 #if 0
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Name", "Unique name used in the code and scripting");
@@ -404,7 +412,7 @@ static void rna_def_ID_properties(BlenderRNA *brna)
 	/* ID property groups > level 0, since level 0 group is merged
 	 * with native RNA properties. the builtin_properties will take
 	 * care of the properties here */
-	srna= RNA_def_struct(brna, "PropertyGroup", NULL);
+	srna = RNA_def_struct(brna, "PropertyGroup", NULL);
 	RNA_def_struct_sdna(srna, "IDPropertyGroup");
 	RNA_def_struct_ui_text(srna, "ID Property Group", "Group of ID properties");
 	RNA_def_struct_idprops_func(srna, "rna_PropertyGroup_idprops");
@@ -412,11 +420,11 @@ static void rna_def_ID_properties(BlenderRNA *brna)
 	RNA_def_struct_refine_func(srna, "rna_PropertyGroup_refine");
 
 	/* important so python types can have their name used in list views
-	 * however this isnt prefect because it overrides how python would set the name
+	 * however this isn't prefect because it overrides how python would set the name
 	 * when we only really want this so RNA_def_struct_name_property() is set to something useful */
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EXPORT|PROP_IDPROPERTY);
-	//RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+	/*RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
 	RNA_def_property_ui_text(prop, "Name", "Unique name used in the code and scripting");
 	RNA_def_struct_name_property(srna, prop);
 }
@@ -429,21 +437,21 @@ static void rna_def_ID_materials(BlenderRNA *brna)
 	PropertyRNA *parm;
 	
 	/* for mesh/mball/curve materials */
-	srna= RNA_def_struct(brna, "IDMaterials", NULL);
+	srna = RNA_def_struct(brna, "IDMaterials", NULL);
 	RNA_def_struct_sdna(srna, "ID");
 	RNA_def_struct_ui_text(srna, "ID Materials", "Collection of materials");
 
-	func= RNA_def_function(srna, "append", "material_append_id");
+	func = RNA_def_function(srna, "append", "material_append_id");
 	RNA_def_function_ui_description(func, "Add a new material to the data block");
-	parm= RNA_def_pointer(func, "material", "Material", "", "Material to add");
+	parm = RNA_def_pointer(func, "material", "Material", "", "Material to add");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	
-	func= RNA_def_function(srna, "pop", "material_pop_id");
+	func = RNA_def_function(srna, "pop", "material_pop_id");
 	RNA_def_function_ui_description(func, "Remove a material from the data block");
-	parm= RNA_def_int(func, "index", 0, 0, MAXMAT, "", "Index of material to remove", 0, MAXMAT);
+	parm = RNA_def_int(func, "index", 0, 0, MAXMAT, "", "Index of material to remove", 0, MAXMAT);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_boolean(func, "update_data", 0, "", "Update data by re-adjusting the material slots assigned");
-	parm= RNA_def_pointer(func, "material", "Material", "", "Material to remove");
+	parm = RNA_def_pointer(func, "material", "Material", "", "Material to remove");
 	RNA_def_function_return(func, parm);
 }
 
@@ -459,13 +467,15 @@ static void rna_def_ID(BlenderRNA *brna)
 		{OB_RECALC_TIME, "TIME", 0, "Time", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "ID", NULL);
-	RNA_def_struct_ui_text(srna, "ID", "Base type for datablocks, defining a unique name, linking from other libraries and garbage collection");
+	srna = RNA_def_struct(brna, "ID", NULL);
+	RNA_def_struct_ui_text(srna, "ID",
+	                       "Base type for datablocks, defining a unique name, linking from other libraries "
+	                       "and garbage collection");
 	RNA_def_struct_flag(srna, STRUCT_ID|STRUCT_ID_REFCOUNT);
 	RNA_def_struct_refine_func(srna, "rna_ID_refine");
 	RNA_def_struct_idprops_func(srna, "rna_ID_idprops");
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Name", "Unique datablock ID name");
 	RNA_def_property_string_funcs(prop, "rna_ID_name_get", "rna_ID_name_length", "rna_ID_name_set");
 	RNA_def_property_string_maxlength(prop, MAX_ID_NAME-2);
@@ -473,55 +483,55 @@ static void rna_def_ID(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_ID|NA_RENAME, NULL);
 	RNA_def_struct_name_property(srna, prop);
 
-	prop= RNA_def_property(srna, "users", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "users", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "us");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Users", "Number of times this datablock is referenced");
 
-	prop= RNA_def_property(srna, "use_fake_user", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_fake_user", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_FAKEUSER);
 	RNA_def_property_ui_text(prop, "Fake User", "Save this datablock even if it has no users");
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_ID_fake_user_set");
 
-	prop= RNA_def_property(srna, "tag", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "tag", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_DOIT);
 	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
 	RNA_def_property_ui_text(prop, "Tag", "Tools can use this to tag data (initial state is undefined)");
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_ID_RECALC);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Is Updated", "Datablock is tagged for recalculation");
 
-	prop= RNA_def_property(srna, "is_updated_data", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated_data", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_ID_RECALC_DATA);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Is Updated Data", "Datablock data is tagged for recalculation");
 
-	prop= RNA_def_property(srna, "library", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "library", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "lib");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Library", "Library file the datablock is linked from");
 
 	/* functions */
-	func= RNA_def_function(srna, "copy", "rna_ID_copy");
+	func = RNA_def_function(srna, "copy", "rna_ID_copy");
 	RNA_def_function_ui_description(func, "Create a copy of this datablock (not supported for all datablocks)");
-	parm= RNA_def_pointer(func, "id", "ID", "", "New copy of the ID");
+	parm = RNA_def_pointer(func, "id", "ID", "", "New copy of the ID");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "user_clear", "rna_ID_user_clear");
+	func = RNA_def_function(srna, "user_clear", "rna_ID_user_clear");
 	RNA_def_function_ui_description(func, "Clear the user count of a datablock so its not saved, "
 	                                      "on reload the data will be removed");
 
-	func= RNA_def_function(srna, "animation_data_create", "BKE_id_add_animdata");
+	func = RNA_def_function(srna, "animation_data_create", "BKE_id_add_animdata");
 	RNA_def_function_ui_description(func, "Create animation data to this ID, note that not all ID types support this");
-	parm= RNA_def_pointer(func, "anim_data", "AnimData", "", "New animation data or NULL");
+	parm = RNA_def_pointer(func, "anim_data", "AnimData", "", "New animation data or NULL");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "animation_data_clear", "BKE_free_animdata");
+	func = RNA_def_function(srna, "animation_data_clear", "BKE_free_animdata");
 	RNA_def_function_ui_description(func, "Clear animation on this this ID");
 
-	func= RNA_def_function(srna, "update_tag", "rna_ID_update_tag");
+	func = RNA_def_function(srna, "update_tag", "rna_ID_update_tag");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Tag the ID to update its display data");
 	RNA_def_enum_flag(func, "refresh", update_flag_items, 0, "", "Type of updates to perform");
@@ -532,29 +542,29 @@ static void rna_def_library(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "Library", "ID");
+	srna = RNA_def_struct(brna, "Library", "ID");
 	RNA_def_struct_ui_text(srna, "Library", "External .blend file from which data is linked");
 	RNA_def_struct_ui_icon(srna, ICON_LIBRARY_DATA_DIRECT);
 
-	prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+	prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
 	RNA_def_property_string_sdna(prop, NULL, "name");
 	RNA_def_property_ui_text(prop, "File Path", "Path to the library .blend file");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Library_filepath_set");
 	
-	prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Library");
-	RNA_def_property_ui_text(prop, "Parent", "");	
+	RNA_def_property_ui_text(prop, "Parent", "");
 }
 void RNA_def_ID(BlenderRNA *brna)
 {
 	StructRNA *srna;
 
 	/* built-in unknown type */
-	srna= RNA_def_struct(brna, "UnknownType", NULL);
+	srna = RNA_def_struct(brna, "UnknownType", NULL);
 	RNA_def_struct_ui_text(srna, "Unknown Type", "Stub RNA type used for pointers to unknown or internal data");
 
 	/* built-in any type */
-	srna= RNA_def_struct(brna, "AnyType", NULL);
+	srna = RNA_def_struct(brna, "AnyType", NULL);
 	RNA_def_struct_ui_text(srna, "Any Type", "RNA type used for pointers to any possible data");
 
 	rna_def_ID(brna);
@@ -564,4 +574,3 @@ void RNA_def_ID(BlenderRNA *brna)
 }
 
 #endif
-
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 5339ee5..3200b27 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -63,7 +63,7 @@
 
 #include "rna_internal.h"
 
-const PointerRNA PointerRNA_NULL= {{NULL}};
+const PointerRNA PointerRNA_NULL = {{NULL}};
 
 /* Init/Exit */
 
@@ -72,12 +72,12 @@ void RNA_init(void)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	for(srna=BLENDER_RNA.structs.first; srna; srna=srna->cont.next) {
-		if(!srna->cont.prophash) {
-			srna->cont.prophash= BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "RNA_init gh");
+	for (srna = BLENDER_RNA.structs.first; srna; srna = srna->cont.next) {
+		if (!srna->cont.prophash) {
+			srna->cont.prophash = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "RNA_init gh");
 
-			for(prop=srna->cont.properties.first; prop; prop=prop->next)
-				if(!(prop->flag & PROP_BUILTIN))
+			for (prop = srna->cont.properties.first; prop; prop = prop->next)
+				if (!(prop->flag & PROP_BUILTIN))
 					BLI_ghash_insert(srna->cont.prophash, (void*)prop->identifier, prop);
 		}
 	}
@@ -89,10 +89,10 @@ void RNA_exit(void)
 	
 	RNA_property_update_cache_free();
 	
-	for(srna=BLENDER_RNA.structs.first; srna; srna=srna->cont.next) {
-		if(srna->cont.prophash) {
+	for (srna = BLENDER_RNA.structs.first; srna; srna = srna->cont.next) {
+		if (srna->cont.prophash) {
 			BLI_ghash_free(srna->cont.prophash, NULL, NULL);
-			srna->cont.prophash= NULL;
+			srna->cont.prophash = NULL;
 		}
 	}
 
@@ -103,95 +103,95 @@ void RNA_exit(void)
 
 void RNA_main_pointer_create(struct Main *main, PointerRNA *r_ptr)
 {
-	r_ptr->id.data= NULL;
-	r_ptr->type= &RNA_BlendData;
-	r_ptr->data= main;
+	r_ptr->id.data = NULL;
+	r_ptr->type = &RNA_BlendData;
+	r_ptr->data = main;
 }
 
 void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
 {
-	StructRNA *type, *idtype= NULL;
+	StructRNA *type, *idtype = NULL;
 
-	if(id) {
-		PointerRNA tmp= {{NULL}};
-		tmp.data= id;
-		idtype= rna_ID_refine(&tmp);
+	if (id) {
+		PointerRNA tmp = {{NULL}};
+		tmp.data = id;
+		idtype = rna_ID_refine(&tmp);
 		
-		while(idtype->refine) {
-			type= idtype->refine(&tmp);
+		while (idtype->refine) {
+			type = idtype->refine(&tmp);
 
-			if(type == idtype)
+			if (type == idtype)
 				break;
 			else
-				idtype= type;
+				idtype = type;
 		}
 	}
 	
-	r_ptr->id.data= id;
-	r_ptr->type= idtype;
-	r_ptr->data= id;
+	r_ptr->id.data = id;
+	r_ptr->type = idtype;
+	r_ptr->data = id;
 }
 
 void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
 {
 #if 0 /* UNUSED */
-	StructRNA *idtype= NULL;
+	StructRNA *idtype = NULL;
 
-	if(id) {
-		PointerRNA tmp= {{0}};
-		tmp.data= id;
-		idtype= rna_ID_refine(&tmp);
+	if (id) {
+		PointerRNA tmp = {{0}};
+		tmp.data = id;
+		idtype = rna_ID_refine(&tmp);
 	}
 #endif
 
-	r_ptr->id.data= id;
-	r_ptr->type= type;
-	r_ptr->data= data;
+	r_ptr->id.data = id;
+	r_ptr->type = type;
+	r_ptr->data = data;
 
-	if(data) {
-		while(r_ptr->type && r_ptr->type->refine) {
-			StructRNA *rtype= r_ptr->type->refine(r_ptr);
+	if (data) {
+		while (r_ptr->type && r_ptr->type->refine) {
+			StructRNA *rtype = r_ptr->type->refine(r_ptr);
 
-			if(rtype == r_ptr->type)
+			if (rtype == r_ptr->type)
 				break;
 			else
-				r_ptr->type= rtype;
+				r_ptr->type = rtype;
 		}
 	}
 }
 
 static void rna_pointer_inherit_id(StructRNA *type, PointerRNA *parent, PointerRNA *ptr)
 {
-	if(type && type->flag & STRUCT_ID) {
-		ptr->id.data= ptr->data;
+	if (type && type->flag & STRUCT_ID) {
+		ptr->id.data = ptr->data;
 	}
 	else {
-		ptr->id.data= parent->id.data;
+		ptr->id.data = parent->id.data;
 	}
 }
 
 void RNA_blender_rna_pointer_create(PointerRNA *r_ptr)
 {
-	r_ptr->id.data= NULL;
-	r_ptr->type= &RNA_BlenderRNA;
-	r_ptr->data= &BLENDER_RNA;
+	r_ptr->id.data = NULL;
+	r_ptr->type = &RNA_BlenderRNA;
+	r_ptr->data = &BLENDER_RNA;
 }
 
 PointerRNA rna_pointer_inherit_refine(PointerRNA *ptr, StructRNA *type, void *data)
 {
-	if(data) {
+	if (data) {
 		PointerRNA result;
-		result.data= data;
-		result.type= type;
+		result.data = data;
+		result.type = type;
 		rna_pointer_inherit_id(type, ptr, &result);
 
-		while(result.type->refine) {
-			type= result.type->refine(&result);
+		while (result.type->refine) {
+			type = result.type->refine(&result);
 
-			if(type == result.type)
+			if (type == result.type)
 				break;
 			else
-				result.type= type;
+				result.type = type;
 		}
 		return result;
 	}
@@ -203,8 +203,8 @@ PointerRNA rna_pointer_inherit_refine(PointerRNA *ptr, StructRNA *type, void *da
 /**/
 void RNA_pointer_recast(PointerRNA *ptr, PointerRNA *r_ptr)
 {
-#if 0 // works but this case if covered by more general code below.
-	if(RNA_struct_is_ID(ptr->type)) {
+#if 0 /* works but this case if covered by more general code below. */
+	if (RNA_struct_is_ID(ptr->type)) {
 		/* simple case */
 		RNA_id_pointer_create(ptr->id.data, r_ptr);
 	}
@@ -213,12 +213,12 @@ void RNA_pointer_recast(PointerRNA *ptr, PointerRNA *r_ptr)
 	{
 		StructRNA *base;
 		PointerRNA t_ptr;
-		*r_ptr= *ptr; /* initialize as the same incase cant recast */
+		*r_ptr = *ptr; /* initialize as the same in case cant recast */
 
-		for(base=ptr->type->base; base; base=base->base) {
-			t_ptr= rna_pointer_inherit_refine(ptr, base, ptr->data);
-			if(t_ptr.type && t_ptr.type != ptr->type) {
-				*r_ptr= t_ptr;
+		for (base = ptr->type->base; base; base = base->base) {
+			t_ptr = rna_pointer_inherit_refine(ptr, base, ptr->data);
+			if (t_ptr.type && t_ptr.type != ptr->type) {
+				*r_ptr = t_ptr;
 			}
 		}
 	}
@@ -237,14 +237,14 @@ IDProperty *rna_idproperty_ui(PropertyRNA *prop)
 {
 	IDProperty *idprop;
 
-	for(idprop= ((IDProperty *)prop)->prev; idprop; idprop= idprop->prev) {
-		if (strcmp(RNA_IDP_UI, idprop->name)==0)
+	for (idprop = ((IDProperty *)prop)->prev; idprop; idprop = idprop->prev) {
+		if (strcmp(RNA_IDP_UI, idprop->name) == 0)
 			break;
 	}
 
-	if(idprop==NULL) {
-		for(idprop= ((IDProperty *)prop)->next; idprop; idprop= idprop->next) {
-			if (strcmp(RNA_IDP_UI, idprop->name)==0)
+	if (idprop == NULL) {
+		for (idprop = ((IDProperty *)prop)->next; idprop; idprop = idprop->next) {
+			if (strcmp(RNA_IDP_UI, idprop->name) == 0)
 				break;
 		}
 	}
@@ -258,9 +258,9 @@ IDProperty *rna_idproperty_ui(PropertyRNA *prop)
 
 IDProperty *RNA_struct_idprops(PointerRNA *ptr, int create)
 {
-	StructRNA *type= ptr->type;
+	StructRNA *type = ptr->type;
 
-	if(type && type->idproperties)
+	if (type && type->idproperties)
 		return type->idproperties(ptr, create);
 	
 	return NULL;
@@ -273,9 +273,9 @@ int RNA_struct_idprops_check(StructRNA *srna)
 
 static IDProperty *rna_idproperty_find(PointerRNA *ptr, const char *name)
 {
-	IDProperty *group= RNA_struct_idprops(ptr, 0);
+	IDProperty *group = RNA_struct_idprops(ptr, 0);
 
-	if(group)
+	if (group)
 		return IDP_GetPropertyFromGroup(group, name);
 
 	return NULL;
@@ -283,14 +283,14 @@ static IDProperty *rna_idproperty_find(PointerRNA *ptr, const char *name)
 
 static int rna_ensure_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
 {
-	if(prop->magic == RNA_MAGIC) {
+	if (prop->magic == RNA_MAGIC) {
 		int arraylen[RNA_MAX_ARRAY_DIMENSION];
 		return (prop->getlength && ptr->data)? prop->getlength(ptr, arraylen): prop->totarraylength;
 	}
 	else {
-		IDProperty *idprop= (IDProperty*)prop;
+		IDProperty *idprop = (IDProperty*)prop;
 
-		if(idprop->type == IDP_ARRAY)
+		if (idprop->type == IDP_ARRAY)
 			return idprop->len;
 		else
 			return 0;
@@ -299,11 +299,11 @@ static int rna_ensure_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
 
 static int rna_ensure_property_array_check(PropertyRNA *prop)
 {
-	if(prop->magic == RNA_MAGIC) {
+	if (prop->magic == RNA_MAGIC) {
 		return (prop->getlength || prop->totarraylength) ? 1:0;
 	}
 	else {
-		IDProperty *idprop= (IDProperty*)prop;
+		IDProperty *idprop = (IDProperty*)prop;
 
 		return idprop->type == IDP_ARRAY ? 1:0;
 	}
@@ -311,19 +311,19 @@ static int rna_ensure_property_array_check(PropertyRNA *prop)
 
 static void rna_ensure_property_multi_array_length(PointerRNA *ptr, PropertyRNA *prop, int length[])
 {
-	if(prop->magic == RNA_MAGIC) {
-		if(prop->getlength)
+	if (prop->magic == RNA_MAGIC) {
+		if (prop->getlength)
 			prop->getlength(ptr, length);
 		else
 			memcpy(length, prop->arraylength, prop->arraydimension*sizeof(int));
 	}
 	else {
-		IDProperty *idprop= (IDProperty*)prop;
+		IDProperty *idprop = (IDProperty*)prop;
 
-		if(idprop->type == IDP_ARRAY)
-			length[0]= idprop->len;
+		if (idprop->type == IDP_ARRAY)
+			length[0] = idprop->len;
 		else
-			length[0]= 0;
+			length[0] = 0;
 	}
 }
 
@@ -334,36 +334,36 @@ static int rna_idproperty_verify_valid(PointerRNA *ptr, PropertyRNA *prop, IDPro
 	 * rna property access is type safe, e.g. if you defined the rna
 	 * to have a certain array length you can count on that staying so */
 	
-	switch(idprop->type) {
+	switch (idprop->type) {
 		case IDP_IDPARRAY:
-			if(prop->type != PROP_COLLECTION)
+			if (prop->type != PROP_COLLECTION)
 				return 0;
 			break;
 		case IDP_ARRAY:
-			if(rna_ensure_property_array_length(ptr, prop) != idprop->len)
+			if (rna_ensure_property_array_length(ptr, prop) != idprop->len)
 				return 0;
 
-			if(idprop->subtype == IDP_FLOAT && prop->type != PROP_FLOAT)
+			if (idprop->subtype == IDP_FLOAT && prop->type != PROP_FLOAT)
 				return 0;
-			if(idprop->subtype == IDP_INT && !ELEM3(prop->type, PROP_BOOLEAN, PROP_INT, PROP_ENUM))
+			if (idprop->subtype == IDP_INT && !ELEM3(prop->type, PROP_BOOLEAN, PROP_INT, PROP_ENUM))
 				return 0;
 
 			break;
 		case IDP_INT:
-			if(!ELEM3(prop->type, PROP_BOOLEAN, PROP_INT, PROP_ENUM))
+			if (!ELEM3(prop->type, PROP_BOOLEAN, PROP_INT, PROP_ENUM))
 				return 0;
 			break;
 		case IDP_FLOAT:
 		case IDP_DOUBLE:
-			if(prop->type != PROP_FLOAT)
+			if (prop->type != PROP_FLOAT)
 				return 0;
 			break;
 		case IDP_STRING:
-			if(prop->type != PROP_STRING)
+			if (prop->type != PROP_STRING)
 				return 0;
 			break;
 		case IDP_GROUP:
-			if(prop->type != PROP_POINTER)
+			if (prop->type != PROP_POINTER)
 				return 0;
 			break;
 		default:
@@ -398,12 +398,12 @@ IDProperty *rna_idproperty_check(PropertyRNA **prop, PointerRNA *ptr)
 	 * we look up an IDP PropertyRNA based on the type, and set the data
 	 * pointer to the IDProperty. */
 
-	if((*prop)->magic == RNA_MAGIC) {
-		if((*prop)->flag & PROP_IDPROPERTY) {
-			IDProperty *idprop= rna_idproperty_find(ptr, (*prop)->identifier);
+	if ((*prop)->magic == RNA_MAGIC) {
+		if ((*prop)->flag & PROP_IDPROPERTY) {
+			IDProperty *idprop = rna_idproperty_find(ptr, (*prop)->identifier);
 
-			if(idprop && !rna_idproperty_verify_valid(ptr, *prop, idprop)) {
-				IDProperty *group= RNA_struct_idprops(ptr, 0);
+			if (idprop && !rna_idproperty_verify_valid(ptr, *prop, idprop)) {
+				IDProperty *group = RNA_struct_idprops(ptr, 0);
 
 				IDP_RemFromGroup(group, idprop);
 				IDP_FreeProperty(idprop);
@@ -418,12 +418,12 @@ IDProperty *rna_idproperty_check(PropertyRNA **prop, PointerRNA *ptr)
 	}
 
 	{
-		IDProperty *idprop= (IDProperty*)(*prop);
+		IDProperty *idprop = (IDProperty*)(*prop);
 
-		if(idprop->type == IDP_ARRAY)
-			*prop= arraytypemap[(int)(idprop->subtype)];
-		else 
-			*prop= typemap[(int)(idprop->type)];
+		if (idprop->type == IDP_ARRAY)
+			*prop = arraytypemap[(int)(idprop->subtype)];
+		else
+			*prop = typemap[(int)(idprop->type)];
 
 		return idprop;
 	}
@@ -433,22 +433,22 @@ static PropertyRNA *rna_ensure_property(PropertyRNA *prop)
 {
 	/* the quick version if we don't need the idproperty */
 
-	if(prop->magic == RNA_MAGIC)
+	if (prop->magic == RNA_MAGIC)
 		return prop;
 
 	{
-		IDProperty *idprop= (IDProperty*)prop;
+		IDProperty *idprop = (IDProperty*)prop;
 
-		if(idprop->type == IDP_ARRAY)
+		if (idprop->type == IDP_ARRAY)
 			return arraytypemap[(int)(idprop->subtype)];
-		else 
+		else
 			return typemap[(int)(idprop->type)];
 	}
 }
 
 static const char *rna_ensure_property_identifier(PropertyRNA *prop)
 {
-	if(prop->magic == RNA_MAGIC)
+	if (prop->magic == RNA_MAGIC)
 		return prop->identifier;
 	else
 		return ((IDProperty*)prop)->name;
@@ -456,51 +456,37 @@ static const char *rna_ensure_property_identifier(PropertyRNA *prop)
 
 static const char *rna_ensure_property_description(PropertyRNA *prop)
 {
-	const char *description= NULL;
+	const char *description = NULL;
 
-	if(prop->magic == RNA_MAGIC)
-		description= prop->description;
+	if (prop->magic == RNA_MAGIC)
+		description = prop->description;
 	else {
 		/* attempt to get the local ID values */
-		IDProperty *idp_ui= rna_idproperty_ui(prop);
+		IDProperty *idp_ui = rna_idproperty_ui(prop);
 
-		if(idp_ui) {
-			IDProperty *item= IDP_GetPropertyTypeFromGroup(idp_ui, "description", IDP_STRING);
-			if(item)
-				description= IDP_String(item);
+		if (idp_ui) {
+			IDProperty *item = IDP_GetPropertyTypeFromGroup(idp_ui, "description", IDP_STRING);
+			if (item)
+				description = IDP_String(item);
 		}
 
-		if(description == NULL)
-			description= ((IDProperty*)prop)->name; /* XXX - not correct */
+		if (description == NULL)
+			description = ((IDProperty*)prop)->name; /* XXX - not correct */
 	}
 
-#ifdef WITH_INTERNATIONAL
-	if(description && (U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_TOOLTIPS))
-		description= BLF_gettext(description);
-#endif
-
-	return description;
+	return TIP_(description);
 }
 
 static const char *rna_ensure_property_name(PropertyRNA *prop)
 {
 	const char *name;
 
-	if(prop->magic == RNA_MAGIC)
-		name= prop->name;
+	if (prop->magic == RNA_MAGIC)
+		name = prop->name;
 	else
-		name= ((IDProperty*)prop)->name;
-
-#ifdef WITH_INTERNATIONAL
-	if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_IFACE)) {
-		if(prop->translation_context)
-			name = BLF_pgettext(prop->translation_context, name);
-		else
-			name = BLF_gettext(name);
-	}
-#endif
+		name = ((IDProperty*)prop)->name;
 
-	return name;
+	return CTX_IFACE_(prop->translation_context, name);
 }
 
 /* Structs */
@@ -510,7 +496,7 @@ StructRNA *RNA_struct_find(const char *identifier)
 	StructRNA *type;
 	if (identifier) {
 		for (type = BLENDER_RNA.structs.first; type; type = type->cont.next)
-			if (strcmp(type->identifier, identifier)==0)
+			if (strcmp(type->identifier, identifier) == 0)
 				return type;
 	}
 	return NULL;
@@ -523,12 +509,12 @@ const char *RNA_struct_identifier(StructRNA *type)
 
 const char *RNA_struct_ui_name(StructRNA *type)
 {
-	return type->name;
+	return CTX_IFACE_(type->translation_context, type->name);
 }
 
 int RNA_struct_ui_icon(StructRNA *type)
 {
-	if(type)
+	if (type)
 		return type->icon;
 	else
 		return ICON_DOT;
@@ -536,7 +522,7 @@ int RNA_struct_ui_icon(StructRNA *type)
 
 const char *RNA_struct_ui_description(StructRNA *type)
 {
-	return type->description;
+	return TIP_(type->description);
 }
 
 PropertyRNA *RNA_struct_name_property(StructRNA *type)
@@ -572,11 +558,11 @@ int RNA_struct_idprops_register_check(StructRNA *type)
 /* remove an id-property */
 int RNA_struct_idprops_unset(PointerRNA *ptr, const char *identifier)
 {
-	IDProperty *group= RNA_struct_idprops(ptr, 0);
+	IDProperty *group = RNA_struct_idprops(ptr, 0);
 
-	if(group) {
-		IDProperty *idp= IDP_GetPropertyFromGroup(group, identifier);
-		if(idp) {
+	if (group) {
+		IDProperty *idp = IDP_GetPropertyFromGroup(group, identifier);
+		if (idp) {
 			IDP_RemFromGroup(group, idp);
 			IDP_FreeProperty(idp);
 			MEM_freeN(idp);
@@ -591,12 +577,12 @@ int RNA_struct_is_a(StructRNA *type, StructRNA *srna)
 {
 	StructRNA *base;
 
-	if(!type)
+	if (!type)
 		return 0;
 
 	/* ptr->type is always maximally refined */
-	for(base=type; base; base=base->base)
-		if(base == srna)
+	for (base = type; base; base = base->base)
+		if (base == srna)
 			return 1;
 	
 	return 0;
@@ -604,19 +590,20 @@ int RNA_struct_is_a(StructRNA *type, StructRNA *srna)
 
 PropertyRNA *RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
 {
-	if(identifier[0]=='[' && identifier[1]=='"') { // "  (dummy comment to avoid confusing some function lists in text editors)
+	if (identifier[0] =='[' && identifier[1] =='"') { /* "  (dummy comment to avoid confusing some
+	                                                   * function lists in text editors) */
 		/* id prop lookup, not so common */
-		PropertyRNA *r_prop= NULL;
+		PropertyRNA *r_prop = NULL;
 		PointerRNA r_ptr; /* only support single level props */
-		if(RNA_path_resolve(ptr, identifier, &r_ptr, &r_prop) && r_ptr.type==ptr->type && r_ptr.data==ptr->data)
+		if (RNA_path_resolve(ptr, identifier, &r_ptr, &r_prop) && r_ptr.type == ptr->type && r_ptr.data == ptr->data)
 			return r_prop;
 	}
 	else {
 		/* most common case */
-		PropertyRNA *iterprop= RNA_struct_iterator_property(ptr->type);
+		PropertyRNA *iterprop = RNA_struct_iterator_property(ptr->type);
 		PointerRNA propptr;
 
-		if(RNA_property_collection_lookup_string(ptr, iterprop, identifier, &propptr))
+		if (RNA_property_collection_lookup_string(ptr, iterprop, identifier, &propptr))
 			return propptr.data;
 	}
 	
@@ -626,12 +613,12 @@ PropertyRNA *RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
 /* Find the property which uses the given nested struct */
 PropertyRNA *RNA_struct_find_nested(PointerRNA *ptr, StructRNA *srna)
 {
-	PropertyRNA *prop= NULL;
+	PropertyRNA *prop = NULL;
 
 	RNA_STRUCT_BEGIN(ptr, iprop) {
 		/* This assumes that there can only be one user of this nested struct */
 		if (RNA_property_pointer_type(ptr, iprop) == srna) {
-			prop= iprop;
+			prop = iprop;
 			break;
 		}
 	}
@@ -646,14 +633,14 @@ int RNA_struct_contains_property(PointerRNA *ptr, PropertyRNA *prop_test)
 
 	/* validate the RNA is ok */
 	PropertyRNA *iterprop;
-	int found= FALSE;
+	int found = FALSE;
 
-	iterprop= RNA_struct_iterator_property(ptr->type);
+	iterprop = RNA_struct_iterator_property(ptr->type);
 
 	RNA_PROP_BEGIN(ptr, itemptr, iterprop) {
 		/* PropertyRNA *prop= itemptr.data; */
-		if(prop_test == (PropertyRNA *)itemptr.data) {
-			found= TRUE;
+		if (prop_test == (PropertyRNA *)itemptr.data) {
+			found = TRUE;
 			break;
 		}
 	}
@@ -678,9 +665,9 @@ FunctionRNA *RNA_struct_find_function(PointerRNA *ptr, const char *identifier)
 #if 1
 	FunctionRNA *func;
 	StructRNA *type;
-	for(type= ptr->type; type; type= type->base) {
-		func= (FunctionRNA *)BLI_findstring_ptr(&type->functions, identifier, offsetof(FunctionRNA, identifier));
-		if(func) {
+	for (type = ptr->type; type; type = type->base) {
+		func = (FunctionRNA *)BLI_findstring_ptr(&type->functions, identifier, offsetof(FunctionRNA, identifier));
+		if (func) {
 			return func;
 		}
 	}
@@ -693,13 +680,13 @@ FunctionRNA *RNA_struct_find_function(PointerRNA *ptr, const char *identifier)
 	FunctionRNA *func;
 
 	RNA_pointer_create(NULL, &RNA_Struct, ptr->type, &tptr);
-	iterprop= RNA_struct_find_property(&tptr, "functions");
+	iterprop = RNA_struct_find_property(&tptr, "functions");
 
-	func= NULL;
+	func = NULL;
 
 	RNA_PROP_BEGIN(&tptr, funcptr, iterprop) {
-		if(strcmp(identifier, RNA_function_identifier(funcptr.data)) == 0) {
-			func= funcptr.data;
+		if (strcmp(identifier, RNA_function_identifier(funcptr.data)) == 0) {
+			func = funcptr.data;
 			break;
 		}
 	}
@@ -722,21 +709,21 @@ StructRegisterFunc RNA_struct_register(StructRNA *type)
 StructUnregisterFunc RNA_struct_unregister(StructRNA *type)
 {
 	do {
-		if(type->unreg)
+		if (type->unreg)
 			return type->unreg;
-	} while((type=type->base));
+	} while ((type = type->base));
 
 	return NULL;
 }
 
 void **RNA_struct_instance(PointerRNA *ptr)
 {
-	StructRNA *type= ptr->type;
+	StructRNA *type = ptr->type;
 
 	do {
-		if(type->instance)
+		if (type->instance)
 			return type->instance(ptr);
-	} while((type=type->base));
+	} while ((type = type->base));
 
 	return NULL;
 }
@@ -748,7 +735,7 @@ void *RNA_struct_py_type_get(StructRNA *srna)
 
 void RNA_struct_py_type_set(StructRNA *srna, void *py_type)
 {
-	srna->py_type= py_type;
+	srna->py_type = py_type;
 }
 
 void *RNA_struct_blender_type_get(StructRNA *srna)
@@ -758,14 +745,14 @@ void *RNA_struct_blender_type_get(StructRNA *srna)
 
 void RNA_struct_blender_type_set(StructRNA *srna, void *blender_type)
 {
-	srna->blender_type= blender_type;
+	srna->blender_type = blender_type;
 }
 
 char *RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen, int *r_len)
 {
 	PropertyRNA *nameprop;
 
-	if(ptr->data && (nameprop = RNA_struct_name_property(ptr->type)))
+	if (ptr->data && (nameprop = RNA_struct_name_property(ptr->type)))
 		return RNA_property_string_get_alloc(ptr, nameprop, fixedbuf, fixedlen, r_len);
 
 	return NULL;
@@ -821,9 +808,9 @@ int RNA_property_array_check(PropertyRNA *prop)
 /* used by BPY to make an array from the python object */
 int RNA_property_array_dimension(PointerRNA *ptr, PropertyRNA *prop, int length[])
 {
-	PropertyRNA *rprop= rna_ensure_property(prop);
+	PropertyRNA *rprop = rna_ensure_property(prop);
 
-	if(length)
+	if (length)
 			rna_ensure_property_multi_array_length(ptr, prop, length);
 
 	return rprop->arraydimension;
@@ -841,16 +828,16 @@ int RNA_property_multi_array_length(PointerRNA *ptr, PropertyRNA *prop, int dim)
 
 char RNA_property_array_item_char(PropertyRNA *prop, int index)
 {
-	const char *vectoritem= "XYZW";
-	const char *quatitem= "WXYZ";
-	const char *coloritem= "RGBA";
-	PropertySubType subtype= rna_ensure_property(prop)->subtype;
+	const char *vectoritem = "XYZW";
+	const char *quatitem = "WXYZ";
+	const char *coloritem = "RGBA";
+	PropertySubType subtype = rna_ensure_property(prop)->subtype;
 
 	/* get string to use for array index */
 	if ((index < 4) && ELEM(subtype, PROP_QUATERNION, PROP_AXISANGLE)) {
 		return quatitem[index];
 	}
-	else if((index < 4) && ELEM8(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_XYZ_LENGTH,
+	else if ((index < 4) && ELEM8(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_XYZ_LENGTH,
 	                                      PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION, PROP_COORDS))
 	{
 		return vectoritem[index];
@@ -864,7 +851,7 @@ char RNA_property_array_item_char(PropertyRNA *prop, int index)
 
 int RNA_property_array_item_index(PropertyRNA *prop, char name)
 {
-	PropertySubType subtype= rna_ensure_property(prop)->subtype;
+	PropertySubType subtype = rna_ensure_property(prop)->subtype;
 
 	/* get index based on string name/alias */
 	/* maybe a function to find char index in string would be better than all the switches */
@@ -880,7 +867,7 @@ int RNA_property_array_item_index(PropertyRNA *prop, char name)
 				return 3;
 		}
 	}
-	else if(ELEM6(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ,
+	else if (ELEM6(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ,
 	                       PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION))
 	{
 		switch (name) {
@@ -913,142 +900,157 @@ int RNA_property_array_item_index(PropertyRNA *prop, char name)
 
 void RNA_property_int_range(PointerRNA *ptr, PropertyRNA *prop, int *hardmin, int *hardmax)
 {
-	IntPropertyRNA *iprop= (IntPropertyRNA*)rna_ensure_property(prop);
+	IntPropertyRNA *iprop = (IntPropertyRNA*)rna_ensure_property(prop);
+	int softmin, softmax;
 
-	if(prop->magic != RNA_MAGIC) {
+	if (prop->magic != RNA_MAGIC) {
 		/* attempt to get the local ID values */
-		IDProperty *idp_ui= rna_idproperty_ui(prop);
+		IDProperty *idp_ui = rna_idproperty_ui(prop);
 
-		if(idp_ui) {
+		if (idp_ui) {
 			IDProperty *item;
 
-			item= IDP_GetPropertyTypeFromGroup(idp_ui, "min", IDP_INT);
-			*hardmin= item ? IDP_Int(item) : INT_MIN;
+			item = IDP_GetPropertyTypeFromGroup(idp_ui, "min", IDP_INT);
+			*hardmin = item ? IDP_Int(item) : INT_MIN;
 
-			item= IDP_GetPropertyTypeFromGroup(idp_ui, "max", IDP_INT);
-			*hardmax= item ? IDP_Int(item) : INT_MAX;
+			item = IDP_GetPropertyTypeFromGroup(idp_ui, "max", IDP_INT);
+			*hardmax = item ? IDP_Int(item) : INT_MAX;
 
 			return;
 		}
 	}
 
-	if(iprop->range) {
-		iprop->range(ptr, hardmin, hardmax);
+	if (iprop->range) {
+		*hardmin = INT_MIN;
+		*hardmax = INT_MAX;
+
+		iprop->range(ptr, hardmin, hardmax, &softmin, &softmax);
 	}
 	else {
-		*hardmin= iprop->hardmin;
-		*hardmax= iprop->hardmax;
+		*hardmin = iprop->hardmin;
+		*hardmax = iprop->hardmax;
 	}
 }
 
 void RNA_property_int_ui_range(PointerRNA *ptr, PropertyRNA *prop, int *softmin, int *softmax, int *step)
 {
-	IntPropertyRNA *iprop= (IntPropertyRNA*)rna_ensure_property(prop);
+	IntPropertyRNA *iprop = (IntPropertyRNA*)rna_ensure_property(prop);
 	int hardmin, hardmax;
 	
-	if(prop->magic != RNA_MAGIC) {
+	if (prop->magic != RNA_MAGIC) {
 		/* attempt to get the local ID values */
-		IDProperty *idp_ui= rna_idproperty_ui(prop);
+		IDProperty *idp_ui = rna_idproperty_ui(prop);
 
-		if(idp_ui) {
+		if (idp_ui) {
 			IDProperty *item;
 
-			item= IDP_GetPropertyTypeFromGroup(idp_ui, "soft_min", IDP_INT);
-			*softmin= item ? IDP_Int(item) : INT_MIN;
+			item = IDP_GetPropertyTypeFromGroup(idp_ui, "soft_min", IDP_INT);
+			*softmin = item ? IDP_Int(item) : INT_MIN;
 
-			item= IDP_GetPropertyTypeFromGroup(idp_ui, "soft_max", IDP_INT);
-			*softmax= item ? IDP_Int(item) : INT_MAX;
+			item = IDP_GetPropertyTypeFromGroup(idp_ui, "soft_max", IDP_INT);
+			*softmax = item ? IDP_Int(item) : INT_MAX;
 
-			item= IDP_GetPropertyTypeFromGroup(idp_ui, "step", IDP_INT);
-			*step= item ? IDP_Int(item) : 1;
+			item = IDP_GetPropertyTypeFromGroup(idp_ui, "step", IDP_INT);
+			*step = item ? IDP_Int(item) : 1;
 
 			return;
 		}
 	}
 
-	if(iprop->range) {
-		iprop->range(ptr, &hardmin, &hardmax);
-		*softmin= MAX2(iprop->softmin, hardmin);
-		*softmax= MIN2(iprop->softmax, hardmax);
-	}
-	else {
-		*softmin= iprop->softmin;
-		*softmax= iprop->softmax;
+	*softmin = iprop->softmin;
+	*softmax = iprop->softmax;
+
+	if (iprop->range) {
+		hardmin = INT_MIN;
+		hardmax = INT_MAX;
+
+		iprop->range(ptr, &hardmin, &hardmax, softmin, softmax);
+
+		*softmin = MAX2(*softmin, hardmin);
+		*softmax = MIN2(*softmax, hardmax);
 	}
 
-	*step= iprop->step;
+	*step = iprop->step;
 }
 
 void RNA_property_float_range(PointerRNA *ptr, PropertyRNA *prop, float *hardmin, float *hardmax)
 {
-	FloatPropertyRNA *fprop= (FloatPropertyRNA*)rna_ensure_property(prop);
+	FloatPropertyRNA *fprop = (FloatPropertyRNA*)rna_ensure_property(prop);
+	float softmin, softmax;
 
-	if(prop->magic != RNA_MAGIC) {
+	if (prop->magic != RNA_MAGIC) {
 		/* attempt to get the local ID values */
-		IDProperty *idp_ui= rna_idproperty_ui(prop);
+		IDProperty *idp_ui = rna_idproperty_ui(prop);
 
-		if(idp_ui) {
+		if (idp_ui) {
 			IDProperty *item;
 
-			item= IDP_GetPropertyTypeFromGroup(idp_ui, "min", IDP_DOUBLE);
-			*hardmin= item ? (float)IDP_Double(item) : FLT_MIN;
+			item = IDP_GetPropertyTypeFromGroup(idp_ui, "min", IDP_DOUBLE);
+			*hardmin = item ? (float)IDP_Double(item) : FLT_MIN;
 
-			item= IDP_GetPropertyTypeFromGroup(idp_ui, "max", IDP_DOUBLE);
-			*hardmax= item ? (float)IDP_Double(item) : FLT_MAX;
+			item = IDP_GetPropertyTypeFromGroup(idp_ui, "max", IDP_DOUBLE);
+			*hardmax = item ? (float)IDP_Double(item) : FLT_MAX;
 
 			return;
 		}
 	}
 
-	if(fprop->range) {
-		fprop->range(ptr, hardmin, hardmax);
+	if (fprop->range) {
+		*hardmin = -FLT_MAX;
+		*hardmax = FLT_MAX;
+
+		fprop->range(ptr, hardmin, hardmax, &softmin, &softmax);
 	}
 	else {
-		*hardmin= fprop->hardmin;
-		*hardmax= fprop->hardmax;
+		*hardmin = fprop->hardmin;
+		*hardmax = fprop->hardmax;
 	}
 }
 
-void RNA_property_float_ui_range(PointerRNA *ptr, PropertyRNA *prop, float *softmin, float *softmax, float *step, float *precision)
+void RNA_property_float_ui_range(PointerRNA *ptr, PropertyRNA *prop, float *softmin, float *softmax,
+                                 float *step, float *precision)
 {
-	FloatPropertyRNA *fprop= (FloatPropertyRNA*)rna_ensure_property(prop);
+	FloatPropertyRNA *fprop = (FloatPropertyRNA*)rna_ensure_property(prop);
 	float hardmin, hardmax;
 
-	if(prop->magic != RNA_MAGIC) {
+	if (prop->magic != RNA_MAGIC) {
 		/* attempt to get the local ID values */
-		IDProperty *idp_ui= rna_idproperty_ui(prop);
+		IDProperty *idp_ui = rna_idproperty_ui(prop);
 
-		if(idp_ui) {
+		if (idp_ui) {
 			IDProperty *item;
 
-			item= IDP_GetPropertyTypeFromGroup(idp_ui, "soft_min", IDP_DOUBLE);
-			*softmin= item ? (float)IDP_Double(item) : FLT_MIN;
+			item = IDP_GetPropertyTypeFromGroup(idp_ui, "soft_min", IDP_DOUBLE);
+			*softmin = item ? (float)IDP_Double(item) : FLT_MIN;
 
-			item= IDP_GetPropertyTypeFromGroup(idp_ui, "soft_max", IDP_DOUBLE);
-			*softmax= item ? (float)IDP_Double(item) : FLT_MAX;
+			item = IDP_GetPropertyTypeFromGroup(idp_ui, "soft_max", IDP_DOUBLE);
+			*softmax = item ? (float)IDP_Double(item) : FLT_MAX;
 
-			item= IDP_GetPropertyTypeFromGroup(idp_ui, "step", IDP_DOUBLE);
-			*step= item ? (float)IDP_Double(item) : 1.0f;
+			item = IDP_GetPropertyTypeFromGroup(idp_ui, "step", IDP_DOUBLE);
+			*step = item ? (float)IDP_Double(item) : 1.0f;
 
-			item= IDP_GetPropertyTypeFromGroup(idp_ui, "precision", IDP_DOUBLE);
-			*precision= item ? (float)IDP_Double(item) : 3.0f;
+			item = IDP_GetPropertyTypeFromGroup(idp_ui, "precision", IDP_DOUBLE);
+			*precision = item ? (float)IDP_Double(item) : 3.0f;
 
 			return;
 		}
 	}
 
-	if(fprop->range) {
-		fprop->range(ptr, &hardmin, &hardmax);
-		*softmin= MAX2(fprop->softmin, hardmin);
-		*softmax= MIN2(fprop->softmax, hardmax);
-	}
-	else {
-		*softmin= fprop->softmin;
-		*softmax= fprop->softmax;
+	*softmin = fprop->softmin;
+	*softmax = fprop->softmax;
+
+	if (fprop->range) {
+		hardmin = -FLT_MAX;
+		hardmax = FLT_MAX;
+
+		fprop->range(ptr, &hardmin, &hardmax, softmin, softmax);
+
+		*softmin = MAX2(*softmin, hardmin);
+		*softmax = MIN2(*softmax, hardmax);
 	}
 
-	*step= fprop->step;
-	*precision= (float)fprop->precision;
+	*step = fprop->step;
+	*precision = (float)fprop->precision;
 }
 
 int RNA_property_float_clamp(PointerRNA *ptr, PropertyRNA *prop, float *value)
@@ -1057,12 +1059,12 @@ int RNA_property_float_clamp(PointerRNA *ptr, PropertyRNA *prop, float *value)
 
 	RNA_property_float_range(ptr, prop, &min, &max);
 
-	if(*value < min) {
-		*value= min;
+	if (*value < min) {
+		*value = min;
 		return -1;
 	}
-	else if(*value > max) {
-		*value= max;
+	else if (*value > max) {
+		*value = max;
 		return 1;
 	}
 	else {
@@ -1076,12 +1078,12 @@ int RNA_property_int_clamp(PointerRNA *ptr, PropertyRNA *prop, int *value)
 
 	RNA_property_int_range(ptr, prop, &min, &max);
 
-	if(*value < min) {
-		*value= min;
+	if (*value < min) {
+		*value = min;
 		return -1;
 	}
-	else if(*value > max) {
-		*value= max;
+	else if (*value > max) {
+		*value = max;
 		return 1;
 	}
 	else {
@@ -1093,26 +1095,26 @@ int RNA_property_int_clamp(PointerRNA *ptr, PropertyRNA *prop, int *value)
  * '0' used when their is no maximum */
 int RNA_property_string_maxlength(PropertyRNA *prop)
 {
-	StringPropertyRNA *sprop= (StringPropertyRNA*)rna_ensure_property(prop);
+	StringPropertyRNA *sprop = (StringPropertyRNA*)rna_ensure_property(prop);
 	return sprop->maxlength;
 }
 
 StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop)
 {
-	prop= rna_ensure_property(prop);
+	prop = rna_ensure_property(prop);
 
-	if(prop->type == PROP_POINTER) {
-		PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
+	if (prop->type == PROP_POINTER) {
+		PointerPropertyRNA *pprop = (PointerPropertyRNA*)prop;
 
-		if(pprop->typef)
+		if (pprop->typef)
 			return pprop->typef(ptr);
-		else if(pprop->type)
+		else if (pprop->type)
 			return pprop->type;
 	}
-	else if(prop->type == PROP_COLLECTION) {
-		CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
+	else if (prop->type == PROP_COLLECTION) {
+		CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)prop;
 
-		if(cprop->item_type)
+		if (cprop->item_type)
 			return cprop->item_type;
 	}
 	/* ignore other types, RNA_struct_find_nested calls with unchecked props */
@@ -1122,11 +1124,11 @@ StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop)
 
 int RNA_property_pointer_poll(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *value)
 {
-	prop= rna_ensure_property(prop);
+	prop = rna_ensure_property(prop);
 
-	if(prop->type == PROP_POINTER) {
-		PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
-		if(pprop->poll)
+	if (prop->type == PROP_POINTER) {
+		PointerPropertyRNA *pprop = (PointerPropertyRNA*)prop;
+		if (pprop->poll)
 			return pprop->poll(ptr, *value);
 
 		return 1;
@@ -1147,102 +1149,106 @@ EnumPropertyItem DummyRNA_DEFAULT_items[] = {
 	{0, NULL, 0, NULL, NULL}
 };
 
-void RNA_property_enum_items(bContext *C, PointerRNA *ptr, PropertyRNA *prop, EnumPropertyItem **item, int *totitem, int *free)
+void RNA_property_enum_items(bContext *C, PointerRNA *ptr, PropertyRNA *prop, EnumPropertyItem **item,
+                             int *totitem, int *free)
 {
-	EnumPropertyRNA *eprop= (EnumPropertyRNA*)rna_ensure_property(prop);
+	EnumPropertyRNA *eprop = (EnumPropertyRNA*)rna_ensure_property(prop);
 
-	*free= 0;
+	*free = 0;
 
-	if(eprop->itemf && (C != NULL || (prop->flag & PROP_ENUM_NO_CONTEXT))) {
-		int tot= 0;
+	if (eprop->itemf && (C != NULL || (prop->flag & PROP_ENUM_NO_CONTEXT))) {
+		int tot = 0;
 
 		if (prop->flag & PROP_ENUM_NO_CONTEXT)
-			*item= eprop->itemf(NULL, ptr, prop, free);
+			*item = eprop->itemf(NULL, ptr, prop, free);
 		else
-			*item= eprop->itemf(C, ptr, prop, free);
+			*item = eprop->itemf(C, ptr, prop, free);
 
-		if(totitem) {
-			if(*item) {
-				for( ; (*item)[tot].identifier; tot++);
+		if (totitem) {
+			if (*item) {
+				for ( ; (*item)[tot].identifier; tot++);
 			}
 
-			*totitem= tot;
+			*totitem = tot;
 		}
 
 	}
 	else {
-		*item= eprop->item;
-		if(totitem)
-			*totitem= eprop->totitem;
+		*item = eprop->item;
+		if (totitem)
+			*totitem = eprop->totitem;
 	}
 }
 
-void RNA_property_enum_items_gettexted(bContext *C, PointerRNA *ptr, PropertyRNA *prop, EnumPropertyItem **item, int *totitem, int *free)
+void RNA_property_enum_items_gettexted(bContext *C, PointerRNA *ptr, PropertyRNA *prop,
+                                       EnumPropertyItem **item, int *totitem, int *free)
 {
 	RNA_property_enum_items(C, ptr, prop, item, totitem, free);
 
 #ifdef WITH_INTERNATIONAL
-	if((U.transopts&USER_DOTRANSLATE) && (U.transopts&USER_TR_IFACE)) {
+	/* Note: keep directly using BLF_gettext here, has we have already done tests like BLF_translate_iface... */
+	if (BLF_translate_iface()) {
 		int i;
 		EnumPropertyItem *nitem;
 
-		if(*free) {
-			nitem= *item;
-		} else {
-			int totitem= 0;
+		if (*free) {
+			nitem = *item;
+		}
+		else {
+			int totitem = 0;
 
 			/* count */
-			for(i=0; (*item)[i].identifier; i++)
+			for (i = 0; (*item)[i].identifier; i++)
 				totitem++;
 
-			nitem= MEM_callocN(sizeof(EnumPropertyItem)*(totitem+1), "enum_items_gettexted");
+			nitem = MEM_callocN(sizeof(EnumPropertyItem)*(totitem+1), "enum_items_gettexted");
 
-			for(i=0; (*item)[i].identifier; i++)
-				nitem[i]= (*item)[i];
+			for (i = 0; (*item)[i].identifier; i++)
+				nitem[i] = (*item)[i];
 
-			*free= 1;
+			*free = 1;
 		}
 
-		for(i=0; nitem[i].identifier; i++) {
-			if( nitem[i].name ) {
-				if(prop->translation_context)
+		for (i = 0; nitem[i].identifier; i++) {
+			if ( nitem[i].name ) {
+				if (prop->translation_context)
 					nitem[i].name = BLF_pgettext(prop->translation_context, nitem[i].name);
 				else
 					nitem[i].name = BLF_gettext(nitem[i].name);
 			}
-			if( nitem[i].description )
+			if ( nitem[i].description )
 				nitem[i].description = BLF_gettext(nitem[i].description);
 		}
 
-		*item= nitem;
+		*item = nitem;
 	}
 #endif
 }
 
 
 int RNA_property_enum_value(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *value)
-{	
+{
 	EnumPropertyItem *item, *item_array;
 	int free, found;
 
 	RNA_property_enum_items(C, ptr, prop, &item_array, NULL, &free);
 
-	if(item_array) {
-		for(item= item_array; item->identifier; item++) {
-			if(item->identifier[0] && strcmp(item->identifier, identifier)==0) {
+	if (item_array) {
+		for (item = item_array; item->identifier; item++) {
+			if (item->identifier[0] && strcmp(item->identifier, identifier) == 0) {
 				*value = item->value;
 				break;
 			}
 		}
 
-		found= (item->identifier != NULL); /* could be alloc'd, assign before free */
+		found = (item->identifier != NULL); /* could be alloc'd, assign before free */
 
-		if(free) {
+		if (free) {
 			MEM_freeN(item_array);
 		}
 	}
 	else {
-		found= 0;
+		found = 0;
 	}
 	return found;
 }
@@ -1250,7 +1256,7 @@ int RNA_property_enum_value(bContext *C, PointerRNA *ptr, PropertyRNA *prop, con
 int RNA_enum_identifier(EnumPropertyItem *item, const int value, const char **identifier)
 {
 	for (; item->identifier; item++) {
-		if(item->identifier[0] && item->value==value) {
+		if (item->identifier[0] && item->value == value) {
 			*identifier = item->identifier;
 			return 1;
 		}
@@ -1260,20 +1266,20 @@ int RNA_enum_identifier(EnumPropertyItem *item, const int value, const char **id
 
 int RNA_enum_bitflag_identifiers(EnumPropertyItem *item, const int value, const char **identifier)
 {
-	int index= 0;
+	int index = 0;
 	for (; item->identifier; item++) {
-		if(item->identifier[0] && item->value & value) {
+		if (item->identifier[0] && item->value & value) {
 			identifier[index++] = item->identifier;
 		}
 	}
-	identifier[index]= NULL;
+	identifier[index] = NULL;
 	return index;
 }
 
 int RNA_enum_name(EnumPropertyItem *item, const int value, const char **name)
 {
 	for (; item->identifier; item++) {
-		if(item->identifier[0] && item->value==value) {
+		if (item->identifier[0] && item->value == value) {
 			*name = item->name;
 			return 1;
 		}
@@ -1284,7 +1290,7 @@ int RNA_enum_name(EnumPropertyItem *item, const int value, const char **name)
 int RNA_enum_description(EnumPropertyItem *item, const int value, const char **description)
 {
 	for (; item->identifier; item++) {
-		if(item->identifier[0] && item->value==value) {
+		if (item->identifier[0] && item->value == value) {
 			*description = item->description;
 			return 1;
 		}
@@ -1292,15 +1298,16 @@ int RNA_enum_description(EnumPropertyItem *item, const int value, const char **d
 	return 0;
 }
 
-int RNA_property_enum_identifier(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier)
-{	
-	EnumPropertyItem *item= NULL;
+int RNA_property_enum_identifier(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value,
+                                 const char **identifier)
+{
+	EnumPropertyItem *item = NULL;
 	int result, free;
 	
 	RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
-	if(item) {
-		result= RNA_enum_identifier(item, value, identifier);
-		if(free)
+	if (item) {
+		result = RNA_enum_identifier(item, value, identifier);
+		if (free)
 			MEM_freeN(item);
 
 		return result;
@@ -1309,14 +1316,14 @@ int RNA_property_enum_identifier(bContext *C, PointerRNA *ptr, PropertyRNA *prop
 }
 
 int RNA_property_enum_name(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **name)
-{	
-	EnumPropertyItem *item= NULL;
+{
+	EnumPropertyItem *item = NULL;
 	int result, free;
 	
 	RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
-	if(item) {
-		result= RNA_enum_name(item, value, name);
-		if(free)
+	if (item) {
+		result = RNA_enum_name(item, value, name);
+		if (free)
 			MEM_freeN(item);
 		
 		return result;
@@ -1324,15 +1331,16 @@ int RNA_property_enum_name(bContext *C, PointerRNA *ptr, PropertyRNA *prop, cons
 	return 0;
 }
 
-int RNA_property_enum_bitflag_identifiers(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier)
+int RNA_property_enum_bitflag_identifiers(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value,
+                                          const char **identifier)
 {
-	EnumPropertyItem *item= NULL;
+	EnumPropertyItem *item = NULL;
 	int result, free;
 
 	RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
-	if(item) {
-		result= RNA_enum_bitflag_identifiers(item, value, identifier);
-		if(free)
+	if (item) {
+		result = RNA_enum_bitflag_identifiers(item, value, identifier);
+		if (free)
 			MEM_freeN(item);
 
 		return result;
@@ -1357,11 +1365,11 @@ int RNA_property_ui_icon(PropertyRNA *prop)
 
 int RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop)
 {
-	ID *id= ptr->id.data;
+	ID *id = ptr->id.data;
 	int flag;
 
-	prop= rna_ensure_property(prop);
-	flag= prop->editable ? prop->editable(ptr) : prop->flag;
+	prop = rna_ensure_property(prop);
+	flag = prop->editable ? prop->editable(ptr) : prop->flag;
 	return (flag & PROP_EDITABLE) && (!id || !id->lib || (prop->flag & PROP_LIB_EXCEPTION));
 }
 
@@ -1369,8 +1377,8 @@ int RNA_property_editable_flag(PointerRNA *ptr, PropertyRNA *prop)
 {
 	int flag;
 
-	prop= rna_ensure_property(prop);
-	flag= prop->editable ? prop->editable(ptr) : prop->flag;
+	prop = rna_ensure_property(prop);
+	flag = prop->editable ? prop->editable(ptr) : prop->flag;
 	return (flag & PROP_EDITABLE);
 }
 
@@ -1380,17 +1388,17 @@ int RNA_property_editable_index(PointerRNA *ptr, PropertyRNA *prop, int index)
 	ID *id;
 	int flag;
 
-	prop= rna_ensure_property(prop);
+	prop = rna_ensure_property(prop);
 
-	flag= prop->flag;
+	flag = prop->flag;
 	
-	if(prop->editable)
+	if (prop->editable)
 		flag &= prop->editable(ptr);
 
 	if (prop->itemeditable)
 		flag &= prop->itemeditable(ptr, index);
 
-	id= ptr->id.data;
+	id = ptr->id.data;
 
 	return (flag & PROP_EDITABLE) && (!id || !id->lib || (prop->flag & PROP_LIB_EXCEPTION));
 }
@@ -1401,9 +1409,9 @@ int RNA_property_animateable(PointerRNA *ptr, PropertyRNA *prop)
 	if (!id_type_can_have_animdata(ptr->id.data))
 		return 0;
 	
-	prop= rna_ensure_property(prop);
+	prop = rna_ensure_property(prop);
 
-	if(!(prop->flag & PROP_ANIMATABLE))
+	if (!(prop->flag & PROP_ANIMATABLE))
 		return 0;
 
 	return (prop->flag & PROP_EDITABLE);
@@ -1418,20 +1426,24 @@ int RNA_property_animated(PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop))
 
 
 /* this function is to check if its possible to create a valid path from the ID
- * its slow so dont call in a loop */
+ * its slow so don't call in a loop */
 int RNA_property_path_from_ID_check(PointerRNA *ptr, PropertyRNA *prop)
 {
-	char *path= RNA_path_from_ID_to_property(ptr, prop);
-	int ret= 0;
+	char *path = RNA_path_from_ID_to_property(ptr, prop);
+	int ret = 0;
 
-	if(path) {
+	if (path) {
 		PointerRNA id_ptr;
 		PointerRNA r_ptr;
 		PropertyRNA *r_prop;
 
 		RNA_id_pointer_create(ptr->id.data, &id_ptr);
-		RNA_path_resolve(&id_ptr, path, &r_ptr, &r_prop);
-		ret= (prop == r_prop);
+		if (RNA_path_resolve(&id_ptr, path, &r_ptr, &r_prop) == TRUE) {
+			ret = (prop == r_prop);
+		}
+		else {
+			ret = FALSE;
+		}
 		MEM_freeN(path);
 	}
 
@@ -1442,15 +1454,15 @@ int RNA_property_path_from_ID_check(PointerRNA *ptr, PropertyRNA *prop)
 static void rna_property_update(bContext *C, Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop)
 {
 	int is_rna = (prop->magic == RNA_MAGIC);
-	prop= rna_ensure_property(prop);
+	prop = rna_ensure_property(prop);
 
-	if(is_rna) {
-		if(prop->update) {
+	if (is_rna) {
+		if (prop->update) {
 			/* ideally no context would be needed for update, but there's some
-			   parts of the code that need it still, so we have this exception */
-			if(prop->flag & PROP_CONTEXT_UPDATE) {
-				if(C) {
-					if(prop->flag & PROP_CONTEXT_PROPERTY_UPDATE) {
+			 * parts of the code that need it still, so we have this exception */
+			if (prop->flag & PROP_CONTEXT_UPDATE) {
+				if (C) {
+					if (prop->flag & PROP_CONTEXT_PROPERTY_UPDATE) {
 						((ContextPropUpdateFunc)prop->update)(C, ptr, prop);
 					}
 					else {
@@ -1461,11 +1473,11 @@ static void rna_property_update(bContext *C, Main *bmain, Scene *scene, PointerR
 			else
 				prop->update(bmain, scene, ptr);
 		}
-		if(prop->noteflag)
+		if (prop->noteflag)
 			WM_main_add_notifier(prop->noteflag, ptr->id.data);
 	}
 	
-	if(!is_rna || (prop->flag & PROP_IDPROPERTY)) {
+	if (!is_rna || (prop->flag & PROP_IDPROPERTY)) {
 		/* WARNING! This is so property drivers update the display!
 		 * not especially nice  */
 		DAG_id_tag_update(ptr->id.data, OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME);
@@ -1475,7 +1487,7 @@ static void rna_property_update(bContext *C, Main *bmain, Scene *scene, PointerR
 
 /* must keep in sync with 'rna_property_update'
  * note, its possible this returns a false positive in the case of PROP_CONTEXT_UPDATE
- * but this isnt likely to be a performance problem. */
+ * but this isn't likely to be a performance problem. */
 int RNA_property_update_check(PropertyRNA *prop)
 {
 	return (prop->magic != RNA_MAGIC || prop->update || prop->noteflag);
@@ -1530,7 +1542,7 @@ void RNA_property_update_cache_add(PointerRNA *ptr, PropertyRNA *prop)
 	if (ELEM(NULL, ptr, prop))
 		return;
 		
-	prop= rna_ensure_property(prop);
+	prop = rna_ensure_property(prop);
 	
 	/* we can only handle update calls with no context args for now (makes animsys updates easier) */
 	if ((is_rna == 0) || (prop->update == NULL) || (prop->flag & PROP_CONTEXT_UPDATE))
@@ -1568,7 +1580,7 @@ void RNA_property_update_cache_flush(Main *bmain, Scene *scene)
 {
 	tRnaUpdateCacheElem *uce;
 	
-	// TODO: should we check that bmain and scene are valid? The above stuff doesn't!
+	/* TODO: should we check that bmain and scene are valid? The above stuff doesn't! */
 	
 	/* execute the cached updates */
 	for (uce = rna_updates_cache.first; uce; uce = uce->next) {
@@ -1602,15 +1614,15 @@ void RNA_property_update_cache_free(void)
 
 int RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
 {
-	BoolPropertyRNA *bprop= (BoolPropertyRNA*)prop;
+	BoolPropertyRNA *bprop = (BoolPropertyRNA*)prop;
 	IDProperty *idprop;
 
 	BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
 	BLI_assert(RNA_property_array_check(prop) == 0);
 
-	if((idprop=rna_idproperty_check(&prop, ptr)))
+	if ((idprop = rna_idproperty_check(&prop, ptr)))
 		return IDP_Int(idprop);
-	else if(bprop->get)
+	else if (bprop->get)
 		return bprop->get(ptr);
 	else
 		return bprop->defaultvalue;
@@ -1618,52 +1630,52 @@ int RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
 
 void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value)
 {
-	BoolPropertyRNA *bprop= (BoolPropertyRNA*)prop;
+	BoolPropertyRNA *bprop = (BoolPropertyRNA*)prop;
 	IDProperty *idprop;
 
 	BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
 	BLI_assert(RNA_property_array_check(prop) == 0);
 
-	/* just incase other values are passed */
-	if(value) value= 1;
+	/* just in case other values are passed */
+	if (value) value = 1;
 
-	if((idprop=rna_idproperty_check(&prop, ptr))) {
-		IDP_Int(idprop)= value;
+	if ((idprop = rna_idproperty_check(&prop, ptr))) {
+		IDP_Int(idprop) = value;
 		rna_idproperty_touch(idprop);
 	}
-	else if(bprop->set)
+	else if (bprop->set)
 		bprop->set(ptr, value);
-	else if(prop->flag & PROP_EDITABLE) {
+	else if (prop->flag & PROP_EDITABLE) {
 		IDPropertyTemplate val = {0};
 		IDProperty *group;
 
-		val.i= value;
+		val.i = value;
 
-		group= RNA_struct_idprops(ptr, 1);
-		if(group)
+		group = RNA_struct_idprops(ptr, 1);
+		if (group)
 			IDP_AddToGroup(group, IDP_New(IDP_INT, &val, prop->identifier));
 	}
 }
 
 void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values)
 {
-	BoolPropertyRNA *bprop= (BoolPropertyRNA*)prop;
+	BoolPropertyRNA *bprop = (BoolPropertyRNA*)prop;
 	IDProperty *idprop;
 
 	BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
 	BLI_assert(RNA_property_array_check(prop) != 0);
 
-	if((idprop=rna_idproperty_check(&prop, ptr))) {
-		if(prop->arraydimension == 0)
-			values[0]= RNA_property_boolean_get(ptr, prop);
+	if ((idprop = rna_idproperty_check(&prop, ptr))) {
+		if (prop->arraydimension == 0)
+			values[0] = RNA_property_boolean_get(ptr, prop);
 		else
 			memcpy(values, IDP_Array(idprop), sizeof(int)*idprop->len);
 	}
-	else if(prop->arraydimension == 0)
-		values[0]= RNA_property_boolean_get(ptr, prop);
-	else if(bprop->getarray)
+	else if (prop->arraydimension == 0)
+		values[0] = RNA_property_boolean_get(ptr, prop);
+	else if (bprop->getarray)
 		bprop->getarray(ptr, values);
-	else if(bprop->defaultarray)
+	else if (bprop->defaultarray)
 		memcpy(values, bprop->defaultarray, sizeof(int)*prop->totarraylength);
 	else
 		memset(values, 0, sizeof(int)*prop->totarraylength);
@@ -1672,21 +1684,21 @@ void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *val
 int RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
 {
 	int tmp[RNA_MAX_ARRAY_LENGTH];
-	int len= rna_ensure_property_array_length(ptr, prop);
+	int len = rna_ensure_property_array_length(ptr, prop);
 
 	BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
 	BLI_assert(RNA_property_array_check(prop) != 0);
 
-	if(len <= RNA_MAX_ARRAY_LENGTH) {
+	if (len <= RNA_MAX_ARRAY_LENGTH) {
 		RNA_property_boolean_get_array(ptr, prop, tmp);
 		return tmp[index];
 	}
 	else {
 		int *tmparray, value;
 
-		tmparray= MEM_callocN(sizeof(int)*len, "RNA_property_boolean_get_index");
+		tmparray = MEM_callocN(sizeof(int)*len, "RNA_property_boolean_get_index");
 		RNA_property_boolean_get_array(ptr, prop, tmparray);
-		value= tmparray[index];
+		value = tmparray[index];
 		MEM_freeN(tmparray);
 
 		return value;
@@ -1695,34 +1707,34 @@ int RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index
 
 void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *values)
 {
-	BoolPropertyRNA *bprop= (BoolPropertyRNA*)prop;
+	BoolPropertyRNA *bprop = (BoolPropertyRNA*)prop;
 	IDProperty *idprop;
 
 	BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
 	BLI_assert(RNA_property_array_check(prop) != 0);
 
-	if((idprop=rna_idproperty_check(&prop, ptr))) {
-		if(prop->arraydimension == 0)
-			IDP_Int(idprop)= values[0];
+	if ((idprop = rna_idproperty_check(&prop, ptr))) {
+		if (prop->arraydimension == 0)
+			IDP_Int(idprop) = values[0];
 		else
 			memcpy(IDP_Array(idprop), values, sizeof(int)*idprop->len);
 
 		rna_idproperty_touch(idprop);
 	}
-	else if(prop->arraydimension == 0)
+	else if (prop->arraydimension == 0)
 		RNA_property_boolean_set(ptr, prop, values[0]);
-	else if(bprop->setarray)
+	else if (bprop->setarray)
 		bprop->setarray(ptr, values);
-	else if(prop->flag & PROP_EDITABLE) {
+	else if (prop->flag & PROP_EDITABLE) {
 		IDPropertyTemplate val = {0};
 		IDProperty *group;
 
-		val.array.len= prop->totarraylength;
-		val.array.type= IDP_INT;
+		val.array.len = prop->totarraylength;
+		val.array.type = IDP_INT;
 
-		group= RNA_struct_idprops(ptr, 1);
-		if(group) {
-			idprop= IDP_New(IDP_ARRAY, &val, prop->identifier);
+		group = RNA_struct_idprops(ptr, 1);
+		if (group) {
+			idprop = IDP_New(IDP_ARRAY, &val, prop->identifier);
 			IDP_AddToGroup(group, idprop);
 			memcpy(IDP_Array(idprop), values, sizeof(int)*idprop->len);
 		}
@@ -1732,22 +1744,22 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const in
 void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int value)
 {
 	int tmp[RNA_MAX_ARRAY_LENGTH];
-	int len= rna_ensure_property_array_length(ptr, prop);
+	int len = rna_ensure_property_array_length(ptr, prop);
 
 	BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
 	BLI_assert(RNA_property_array_check(prop) != 0);
 
-	if(len <= RNA_MAX_ARRAY_LENGTH) {
+	if (len <= RNA_MAX_ARRAY_LENGTH) {
 		RNA_property_boolean_get_array(ptr, prop, tmp);
-		tmp[index]= value;
+		tmp[index] = value;
 		RNA_property_boolean_set_array(ptr, prop, tmp);
 	}
 	else {
 		int *tmparray;
 
-		tmparray= MEM_callocN(sizeof(int)*len, "RNA_property_boolean_get_index");
+		tmparray = MEM_callocN(sizeof(int)*len, "RNA_property_boolean_get_index");
 		RNA_property_boolean_get_array(ptr, prop, tmparray);
-		tmparray[index]= value;
+		tmparray[index] = value;
 		RNA_property_boolean_set_array(ptr, prop, tmparray);
 		MEM_freeN(tmparray);
 	}
@@ -1755,7 +1767,7 @@ void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int inde
 
 int RNA_property_boolean_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
 {
-	BoolPropertyRNA *bprop= (BoolPropertyRNA*)prop;
+	BoolPropertyRNA *bprop = (BoolPropertyRNA*)prop;
 
 	BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
 	BLI_assert(RNA_property_array_check(prop) == 0);
@@ -1765,14 +1777,14 @@ int RNA_property_boolean_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
 
 void RNA_property_boolean_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *prop, int *values)
 {
-	BoolPropertyRNA *bprop= (BoolPropertyRNA*)prop;
+	BoolPropertyRNA *bprop = (BoolPropertyRNA*)prop;
 	
 	BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
 	BLI_assert(RNA_property_array_check(prop) != 0);
 
-	if(prop->arraydimension == 0)
-		values[0]= bprop->defaultvalue;
-	else if(bprop->defaultarray)
+	if (prop->arraydimension == 0)
+		values[0] = bprop->defaultvalue;
+	else if (bprop->defaultarray)
 		memcpy(values, bprop->defaultarray, sizeof(int)*prop->totarraylength);
 	else
 		memset(values, 0, sizeof(int)*prop->totarraylength);
@@ -1781,21 +1793,21 @@ void RNA_property_boolean_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA
 int RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index)
 {
 	int tmp[RNA_MAX_ARRAY_LENGTH];
-	int len= rna_ensure_property_array_length(ptr, prop);
+	int len = rna_ensure_property_array_length(ptr, prop);
 
 	BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
 	BLI_assert(RNA_property_array_check(prop) != 0);
 
-	if(len <= RNA_MAX_ARRAY_LENGTH) {
+	if (len <= RNA_MAX_ARRAY_LENGTH) {
 		RNA_property_boolean_get_default_array(ptr, prop, tmp);
 		return tmp[index];
 	}
 	else {
 		int *tmparray, value;
 
-		tmparray= MEM_callocN(sizeof(int)*len, "RNA_property_boolean_get_default_index");
+		tmparray = MEM_callocN(sizeof(int)*len, "RNA_property_boolean_get_default_index");
 		RNA_property_boolean_get_default_array(ptr, prop, tmparray);
-		value= tmparray[index];
+		value = tmparray[index];
 		MEM_freeN(tmparray);
 
 		return value;
@@ -1804,15 +1816,15 @@ int RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, i
 
 int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
 {
-	IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
+	IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
 	IDProperty *idprop;
 
 	BLI_assert(RNA_property_type(prop) == PROP_INT);
 	BLI_assert(RNA_property_array_check(prop) == 0);
 
-	if((idprop=rna_idproperty_check(&prop, ptr)))
+	if ((idprop = rna_idproperty_check(&prop, ptr)))
 		return IDP_Int(idprop);
-	else if(iprop->get)
+	else if (iprop->get)
 		return iprop->get(ptr);
 	else
 		return iprop->defaultvalue;
@@ -1820,7 +1832,7 @@ int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
 
 void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
 {
-	IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
+	IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
 	IDProperty *idprop;
 
 	BLI_assert(RNA_property_type(prop) == PROP_INT);
@@ -1828,43 +1840,43 @@ void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
 	/* useful to check on bad values but set function should clamp */
 	/* BLI_assert(RNA_property_int_clamp(ptr, prop, &value) == 0); */
 
-	if((idprop=rna_idproperty_check(&prop, ptr))) {
-		IDP_Int(idprop)= value;
+	if ((idprop = rna_idproperty_check(&prop, ptr))) {
+		IDP_Int(idprop) = value;
 		rna_idproperty_touch(idprop);
 	}
-	else if(iprop->set)
+	else if (iprop->set)
 		iprop->set(ptr, value);
-	else if(prop->flag & PROP_EDITABLE) {
+	else if (prop->flag & PROP_EDITABLE) {
 		IDPropertyTemplate val = {0};
 		IDProperty *group;
 
-		val.i= value;
+		val.i = value;
 
-		group= RNA_struct_idprops(ptr, 1);
-		if(group)
+		group = RNA_struct_idprops(ptr, 1);
+		if (group)
 			IDP_AddToGroup(group, IDP_New(IDP_INT, &val, prop->identifier));
 	}
 }
 
 void RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values)
 {
-	IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
+	IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
 	IDProperty *idprop;
 
 	BLI_assert(RNA_property_type(prop) == PROP_INT);
 	BLI_assert(RNA_property_array_check(prop) != 0);
 
-	if((idprop=rna_idproperty_check(&prop, ptr))) {
-		if(prop->arraydimension == 0)
-			values[0]= RNA_property_int_get(ptr, prop);
+	if ((idprop = rna_idproperty_check(&prop, ptr))) {
+		if (prop->arraydimension == 0)
+			values[0] = RNA_property_int_get(ptr, prop);
 		else
 			memcpy(values, IDP_Array(idprop), sizeof(int)*idprop->len);
 	}
-	else if(prop->arraydimension == 0)
-		values[0]= RNA_property_int_get(ptr, prop);
-	else if(iprop->getarray)
+	else if (prop->arraydimension == 0)
+		values[0] = RNA_property_int_get(ptr, prop);
+	else if (iprop->getarray)
 		iprop->getarray(ptr, values);
-	else if(iprop->defaultarray)
+	else if (iprop->defaultarray)
 		memcpy(values, iprop->defaultarray, sizeof(int)*prop->totarraylength);
 	else
 		memset(values, 0, sizeof(int)*prop->totarraylength);
@@ -1872,36 +1884,36 @@ void RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values)
 
 void RNA_property_int_get_array_range(PointerRNA *ptr, PropertyRNA *prop, int values[2])
 {
-	const int array_len= RNA_property_array_length(ptr, prop);
+	const int array_len = RNA_property_array_length(ptr, prop);
 
-	if(array_len <= 0) {
-		values[0]= 0;
-		values[1]= 0;
+	if (array_len <= 0) {
+		values[0] = 0;
+		values[1] = 0;
 	}
 	else if (array_len == 1) {
 		RNA_property_int_get_array(ptr, prop, values);
-		values[1]= values[0];
+		values[1] = values[0];
 	}
 	else {
 		int arr_stack[32];
 		int *arr;
 		int i;
 
-		if(array_len > 32) {
-			arr= MEM_mallocN(sizeof(int) * array_len, "RNA_property_int_get_array_range");
+		if (array_len > 32) {
+			arr = MEM_mallocN(sizeof(int) * array_len, "RNA_property_int_get_array_range");
 		}
 		else {
-			arr= arr_stack;
+			arr = arr_stack;
 		}
 
 		RNA_property_int_get_array(ptr, prop, arr);
-		values[0]= values[1]= arr[0];
-		for(i= 1; i < array_len; i++) {
-			values[0]= MIN2(values[0], arr[i]);
-			values[1]= MAX2(values[1], arr[i]);
+		values[0] = values[1] = arr[0];
+		for (i = 1; i < array_len; i++) {
+			values[0] = MIN2(values[0], arr[i]);
+			values[1] = MAX2(values[1], arr[i]);
 		}
 
-		if(arr != arr_stack) {
+		if (arr != arr_stack) {
 			MEM_freeN(arr);
 		}
 	}
@@ -1910,21 +1922,21 @@ void RNA_property_int_get_array_range(PointerRNA *ptr, PropertyRNA *prop, int va
 int RNA_property_int_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
 {
 	int tmp[RNA_MAX_ARRAY_LENGTH];
-	int len= rna_ensure_property_array_length(ptr, prop);
+	int len = rna_ensure_property_array_length(ptr, prop);
 
 	BLI_assert(RNA_property_type(prop) == PROP_INT);
 	BLI_assert(RNA_property_array_check(prop) != 0);
 
-	if(len <= RNA_MAX_ARRAY_LENGTH) {
+	if (len <= RNA_MAX_ARRAY_LENGTH) {
 		RNA_property_int_get_array(ptr, prop, tmp);
 		return tmp[index];
 	}
 	else {
 		int *tmparray, value;
 
-		tmparray= MEM_callocN(sizeof(int)*len, "RNA_property_int_get_index");
+		tmparray = MEM_callocN(sizeof(int)*len, "RNA_property_int_get_index");
 		RNA_property_int_get_array(ptr, prop, tmparray);
-		value= tmparray[index];
+		value = tmparray[index];
 		MEM_freeN(tmparray);
 
 		return value;
@@ -1933,34 +1945,34 @@ int RNA_property_int_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
 
 void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *values)
 {
-	IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
+	IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
 	IDProperty *idprop;
 
 	BLI_assert(RNA_property_type(prop) == PROP_INT);
 	BLI_assert(RNA_property_array_check(prop) != 0);
 
-	if((idprop=rna_idproperty_check(&prop, ptr))) {
-		if(prop->arraydimension == 0)
-			IDP_Int(idprop)= values[0];
+	if ((idprop = rna_idproperty_check(&prop, ptr))) {
+		if (prop->arraydimension == 0)
+			IDP_Int(idprop) = values[0];
 		else
 			memcpy(IDP_Array(idprop), values, sizeof(int)*idprop->len);
 
 		rna_idproperty_touch(idprop);
 	}
-	else if(prop->arraydimension == 0)
+	else if (prop->arraydimension == 0)
 		RNA_property_int_set(ptr, prop, values[0]);
-	else if(iprop->setarray)
+	else if (iprop->setarray)
 		iprop->setarray(ptr, values);
-	else if(prop->flag & PROP_EDITABLE) {
+	else if (prop->flag & PROP_EDITABLE) {
 		IDPropertyTemplate val = {0};
 		IDProperty *group;
 
-		val.array.len= prop->totarraylength;
-		val.array.type= IDP_INT;
+		val.array.len = prop->totarraylength;
+		val.array.type = IDP_INT;
 
-		group= RNA_struct_idprops(ptr, 1);
-		if(group) {
-			idprop= IDP_New(IDP_ARRAY, &val, prop->identifier);
+		group = RNA_struct_idprops(ptr, 1);
+		if (group) {
+			idprop = IDP_New(IDP_ARRAY, &val, prop->identifier);
 			IDP_AddToGroup(group, idprop);
 			memcpy(IDP_Array(idprop), values, sizeof(int)*idprop->len);
 		}
@@ -1970,22 +1982,22 @@ void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *v
 void RNA_property_int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int value)
 {
 	int tmp[RNA_MAX_ARRAY_LENGTH];
-	int len= rna_ensure_property_array_length(ptr, prop);
+	int len = rna_ensure_property_array_length(ptr, prop);
 
 	BLI_assert(RNA_property_type(prop) == PROP_INT);
 	BLI_assert(RNA_property_array_check(prop) != 0);
 
-	if(len <= RNA_MAX_ARRAY_LENGTH) {
+	if (len <= RNA_MAX_ARRAY_LENGTH) {
 		RNA_property_int_get_array(ptr, prop, tmp);
-		tmp[index]= value;
+		tmp[index] = value;
 		RNA_property_int_set_array(ptr, prop, tmp);
 	}
 	else {
 		int *tmparray;
 
-		tmparray= MEM_callocN(sizeof(int)*len, "RNA_property_int_get_index");
+		tmparray = MEM_callocN(sizeof(int)*len, "RNA_property_int_get_index");
 		RNA_property_int_get_array(ptr, prop, tmparray);
-		tmparray[index]= value;
+		tmparray[index] = value;
 		RNA_property_int_set_array(ptr, prop, tmparray);
 		MEM_freeN(tmparray);
 	}
@@ -1993,20 +2005,20 @@ void RNA_property_int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, i
 
 int RNA_property_int_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
 {
-	IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
+	IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
 	return iprop->defaultvalue;
 }
 
 void RNA_property_int_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *prop, int *values)
 {
-	IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
+	IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
 	
 	BLI_assert(RNA_property_type(prop) == PROP_INT);
 	BLI_assert(RNA_property_array_check(prop) != 0);
 
-	if(prop->arraydimension == 0)
-		values[0]= iprop->defaultvalue;
-	else if(iprop->defaultarray)
+	if (prop->arraydimension == 0)
+		values[0] = iprop->defaultvalue;
+	else if (iprop->defaultarray)
 		memcpy(values, iprop->defaultarray, sizeof(int)*prop->totarraylength);
 	else
 		memset(values, 0, sizeof(int)*prop->totarraylength);
@@ -2015,18 +2027,18 @@ void RNA_property_int_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *pr
 int RNA_property_int_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index)
 {
 	int tmp[RNA_MAX_ARRAY_LENGTH];
-	int len= rna_ensure_property_array_length(ptr, prop);
+	int len = rna_ensure_property_array_length(ptr, prop);
 
-	if(len <= RNA_MAX_ARRAY_LENGTH) {
+	if (len <= RNA_MAX_ARRAY_LENGTH) {
 		RNA_property_int_get_default_array(ptr, prop, tmp);
 		return tmp[index];
 	}
 	else {
 		int *tmparray, value;
 
-		tmparray= MEM_callocN(sizeof(int)*len, "RNA_property_int_get_default_index");
+		tmparray = MEM_callocN(sizeof(int)*len, "RNA_property_int_get_default_index");
 		RNA_property_int_get_default_array(ptr, prop, tmparray);
-		value= tmparray[index];
+		value = tmparray[index];
 		MEM_freeN(tmparray);
 
 		return value;
@@ -2035,19 +2047,19 @@ int RNA_property_int_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int i
 
 float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
 {
-	FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
+	FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
 	IDProperty *idprop;
 
 	BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
 	BLI_assert(RNA_property_array_check(prop) == 0);
 
-	if((idprop=rna_idproperty_check(&prop, ptr))) {
-		if(idprop->type == IDP_FLOAT)
+	if ((idprop = rna_idproperty_check(&prop, ptr))) {
+		if (idprop->type == IDP_FLOAT)
 			return IDP_Float(idprop);
 		else
 			return (float)IDP_Double(idprop);
 	}
-	else if(fprop->get)
+	else if (fprop->get)
 		return fprop->get(ptr);
 	else
 		return fprop->defaultvalue;
@@ -2055,7 +2067,7 @@ float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
 
 void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
 {
-	FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
+	FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
 	IDProperty *idprop;
 
 	BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
@@ -2063,54 +2075,54 @@ void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
 	/* useful to check on bad values but set function should clamp */
 	/* BLI_assert(RNA_property_float_clamp(ptr, prop, &value) == 0); */
 
-	if((idprop=rna_idproperty_check(&prop, ptr))) {
-		if(idprop->type == IDP_FLOAT)
-			IDP_Float(idprop)= value;
+	if ((idprop = rna_idproperty_check(&prop, ptr))) {
+		if (idprop->type == IDP_FLOAT)
+			IDP_Float(idprop) = value;
 		else
-			IDP_Double(idprop)= value;
+			IDP_Double(idprop) = value;
 
 		rna_idproperty_touch(idprop);
 	}
-	else if(fprop->set) {
+	else if (fprop->set) {
 		fprop->set(ptr, value);
 	}
-	else if(prop->flag & PROP_EDITABLE) {
+	else if (prop->flag & PROP_EDITABLE) {
 		IDPropertyTemplate val = {0};
 		IDProperty *group;
 
-		val.f= value;
+		val.f = value;
 
-		group= RNA_struct_idprops(ptr, 1);
-		if(group)
+		group = RNA_struct_idprops(ptr, 1);
+		if (group)
 			IDP_AddToGroup(group, IDP_New(IDP_FLOAT, &val, prop->identifier));
 	}
 }
 
 void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *values)
 {
-	FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
+	FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
 	IDProperty *idprop;
 	int i;
 
 	BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
 	BLI_assert(RNA_property_array_check(prop) != 0);
 
-	if((idprop=rna_idproperty_check(&prop, ptr))) {
-		if(prop->arraydimension == 0)
-			values[0]= RNA_property_float_get(ptr, prop);
-		else if(idprop->subtype == IDP_FLOAT) {
+	if ((idprop = rna_idproperty_check(&prop, ptr))) {
+		if (prop->arraydimension == 0)
+			values[0] = RNA_property_float_get(ptr, prop);
+		else if (idprop->subtype == IDP_FLOAT) {
 			memcpy(values, IDP_Array(idprop), sizeof(float)*idprop->len);
 		}
 		else {
-			for(i=0; i<idprop->len; i++)
-				values[i]=  (float)(((double*)IDP_Array(idprop))[i]);
+			for (i = 0; i<idprop->len; i++)
+				values[i] =  (float)(((double*)IDP_Array(idprop))[i]);
 		}
 	}
-	else if(prop->arraydimension == 0)
-		values[0]= RNA_property_float_get(ptr, prop);
-	else if(fprop->getarray)
+	else if (prop->arraydimension == 0)
+		values[0] = RNA_property_float_get(ptr, prop);
+	else if (fprop->getarray)
 		fprop->getarray(ptr, values);
-	else if(fprop->defaultarray)
+	else if (fprop->defaultarray)
 		memcpy(values, fprop->defaultarray, sizeof(float)*prop->totarraylength);
 	else
 		memset(values, 0, sizeof(float)*prop->totarraylength);
@@ -2118,36 +2130,36 @@ void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *val
 
 void RNA_property_float_get_array_range(PointerRNA *ptr, PropertyRNA *prop, float values[2])
 {
-	const int array_len= RNA_property_array_length(ptr, prop);
+	const int array_len = RNA_property_array_length(ptr, prop);
 
-	if(array_len <= 0) {
-		values[0]= 0.0f;
-		values[1]= 0.0f;
+	if (array_len <= 0) {
+		values[0] = 0.0f;
+		values[1] = 0.0f;
 	}
 	else if (array_len == 1) {
 		RNA_property_float_get_array(ptr, prop, values);
-		values[1]= values[0];
+		values[1] = values[0];
 	}
 	else {
 		float arr_stack[32];
 		float *arr;
 		int i;
 
-		if(array_len > 32) {
-			arr= MEM_mallocN(sizeof(float) * array_len, "RNA_property_float_get_array_range");
+		if (array_len > 32) {
+			arr = MEM_mallocN(sizeof(float) * array_len, "RNA_property_float_get_array_range");
 		}
 		else {
-			arr= arr_stack;
+			arr = arr_stack;
 		}
 
 		RNA_property_float_get_array(ptr, prop, arr);
-		values[0]= values[1]= arr[0];
-		for(i= 1; i < array_len; i++) {
-			values[0]= MIN2(values[0], arr[i]);
-			values[1]= MAX2(values[1], arr[i]);
+		values[0] = values[1] = arr[0];
+		for (i = 1; i < array_len; i++) {
+			values[0] = MIN2(values[0], arr[i]);
+			values[1] = MAX2(values[1], arr[i]);
 		}
 
-		if(arr != arr_stack) {
+		if (arr != arr_stack) {
 			MEM_freeN(arr);
 		}
 	}
@@ -2156,21 +2168,21 @@ void RNA_property_float_get_array_range(PointerRNA *ptr, PropertyRNA *prop, floa
 float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
 {
 	float tmp[RNA_MAX_ARRAY_LENGTH];
-	int len= rna_ensure_property_array_length(ptr, prop);
+	int len = rna_ensure_property_array_length(ptr, prop);
 
 	BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
 	BLI_assert(RNA_property_array_check(prop) != 0);
 
-	if(len <= RNA_MAX_ARRAY_LENGTH) {
+	if (len <= RNA_MAX_ARRAY_LENGTH) {
 		RNA_property_float_get_array(ptr, prop, tmp);
 		return tmp[index];
 	}
 	else {
 		float *tmparray, value;
 
-		tmparray= MEM_callocN(sizeof(float)*len, "RNA_property_float_get_index");
+		tmparray = MEM_callocN(sizeof(float)*len, "RNA_property_float_get_index");
 		RNA_property_float_get_array(ptr, prop, tmparray);
-		value= tmparray[index];
+		value = tmparray[index];
 		MEM_freeN(tmparray);
 
 		return value;
@@ -2180,45 +2192,45 @@ float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index
 
 void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const float *values)
 {
-	FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
+	FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
 	IDProperty *idprop;
 	int i;
 
 	BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
 	BLI_assert(RNA_property_array_check(prop) != 0);
 
-	if((idprop=rna_idproperty_check(&prop, ptr))) {
-		if(prop->arraydimension == 0) {
-			if(idprop->type == IDP_FLOAT)
-				IDP_Float(idprop)= values[0];
+	if ((idprop = rna_idproperty_check(&prop, ptr))) {
+		if (prop->arraydimension == 0) {
+			if (idprop->type == IDP_FLOAT)
+				IDP_Float(idprop) = values[0];
 			else
-				IDP_Double(idprop)= values[0];
+				IDP_Double(idprop) = values[0];
 		}
-		else if(idprop->subtype == IDP_FLOAT) {
+		else if (idprop->subtype == IDP_FLOAT) {
 			memcpy(IDP_Array(idprop), values, sizeof(float)*idprop->len);
 		}
 		else {
-			for(i=0; i<idprop->len; i++)
-				((double*)IDP_Array(idprop))[i]= values[i];
+			for (i = 0; i<idprop->len; i++)
+				((double*)IDP_Array(idprop))[i] = values[i];
 		}
 
 		rna_idproperty_touch(idprop);
 	}
-	else if(prop->arraydimension == 0)
+	else if (prop->arraydimension == 0)
 		RNA_property_float_set(ptr, prop, values[0]);
-	else if(fprop->setarray) {
+	else if (fprop->setarray) {
 		fprop->setarray(ptr, values);
 	}
-	else if(prop->flag & PROP_EDITABLE) {
+	else if (prop->flag & PROP_EDITABLE) {
 		IDPropertyTemplate val = {0};
 		IDProperty *group;
 
-		val.array.len= prop->totarraylength;
-		val.array.type= IDP_FLOAT;
+		val.array.len = prop->totarraylength;
+		val.array.type = IDP_FLOAT;
 
-		group= RNA_struct_idprops(ptr, 1);
-		if(group) {
-			idprop= IDP_New(IDP_ARRAY, &val, prop->identifier);
+		group = RNA_struct_idprops(ptr, 1);
+		if (group) {
+			idprop = IDP_New(IDP_ARRAY, &val, prop->identifier);
 			IDP_AddToGroup(group, idprop);
 			memcpy(IDP_Array(idprop), values, sizeof(float)*idprop->len);
 		}
@@ -2228,22 +2240,22 @@ void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const floa
 void RNA_property_float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, float value)
 {
 	float tmp[RNA_MAX_ARRAY_LENGTH];
-	int len= rna_ensure_property_array_length(ptr, prop);
+	int len = rna_ensure_property_array_length(ptr, prop);
 
 	BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
 	BLI_assert(RNA_property_array_check(prop) != 0);
 
-	if(len <= RNA_MAX_ARRAY_LENGTH) {
+	if (len <= RNA_MAX_ARRAY_LENGTH) {
 		RNA_property_float_get_array(ptr, prop, tmp);
-		tmp[index]= value;
+		tmp[index] = value;
 		RNA_property_float_set_array(ptr, prop, tmp);
 	}
 	else {
 		float *tmparray;
 
-		tmparray= MEM_callocN(sizeof(float)*len, "RNA_property_float_get_index");
+		tmparray = MEM_callocN(sizeof(float)*len, "RNA_property_float_get_index");
 		RNA_property_float_get_array(ptr, prop, tmparray);
-		tmparray[index]= value;
+		tmparray[index] = value;
 		RNA_property_float_set_array(ptr, prop, tmparray);
 		MEM_freeN(tmparray);
 	}
@@ -2251,7 +2263,7 @@ void RNA_property_float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index,
 
 float RNA_property_float_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
 {
-	FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
+	FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
 
 	BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
 	BLI_assert(RNA_property_array_check(prop) == 0);
@@ -2261,14 +2273,14 @@ float RNA_property_float_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
 
 void RNA_property_float_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *prop, float *values)
 {
-	FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
+	FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
 	
 	BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
 	BLI_assert(RNA_property_array_check(prop) != 0);
 
-	if(prop->arraydimension == 0)
-		values[0]= fprop->defaultvalue;
-	else if(fprop->defaultarray)
+	if (prop->arraydimension == 0)
+		values[0] = fprop->defaultvalue;
+	else if (fprop->defaultarray)
 		memcpy(values, fprop->defaultarray, sizeof(float)*prop->totarraylength);
 	else
 		memset(values, 0, sizeof(float)*prop->totarraylength);
@@ -2277,21 +2289,21 @@ void RNA_property_float_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *
 float RNA_property_float_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index)
 {
 	float tmp[RNA_MAX_ARRAY_LENGTH];
-	int len= rna_ensure_property_array_length(ptr, prop);
+	int len = rna_ensure_property_array_length(ptr, prop);
 
 	BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
 	BLI_assert(RNA_property_array_check(prop) != 0);
 
-	if(len <= RNA_MAX_ARRAY_LENGTH) {
+	if (len <= RNA_MAX_ARRAY_LENGTH) {
 		RNA_property_float_get_default_array(ptr, prop, tmp);
 		return tmp[index];
 	}
 	else {
 		float *tmparray, value;
 
-		tmparray= MEM_callocN(sizeof(float)*len, "RNA_property_float_get_default_index");
+		tmparray = MEM_callocN(sizeof(float)*len, "RNA_property_float_get_default_index");
 		RNA_property_float_get_default_array(ptr, prop, tmparray);
-		value= tmparray[index];
+		value = tmparray[index];
 		MEM_freeN(tmparray);
 
 		return value;
@@ -2300,23 +2312,23 @@ float RNA_property_float_get_default_index(PointerRNA *ptr, PropertyRNA *prop, i
 
 void RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop, char *value)
 {
-	StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
+	StringPropertyRNA *sprop = (StringPropertyRNA*)prop;
 	IDProperty *idprop;
 
 	BLI_assert(RNA_property_type(prop) == PROP_STRING);
 
-	if((idprop=rna_idproperty_check(&prop, ptr))) {
+	if ((idprop = rna_idproperty_check(&prop, ptr))) {
 		/* editing bytes is not 100% supported
 		 * since they can contain NIL chars */
 		if (idprop->subtype == IDP_STRING_SUB_BYTE) {
 			memcpy(value, IDP_String(idprop), idprop->len);
-			value[idprop->len]= '\0';
+			value[idprop->len] = '\0';
 		}
 		else {
 			memcpy(value, IDP_String(idprop), idprop->len);
 		}
 	}
-	else if(sprop->get) {
+	else if (sprop->get) {
 		sprop->get(ptr, value);
 	}
 	else {
@@ -2332,16 +2344,16 @@ char *RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop,
 
 	BLI_assert(RNA_property_type(prop) == PROP_STRING);
 
-	length= RNA_property_string_length(ptr, prop);
+	length = RNA_property_string_length(ptr, prop);
 
-	if(length+1 < fixedlen)
-		buf= fixedbuf;
+	if (length+1 < fixedlen)
+		buf = fixedbuf;
 	else
-		buf= MEM_mallocN(sizeof(char)*(length+1), "RNA_string_get_alloc");
+		buf = MEM_mallocN(sizeof(char)*(length+1), "RNA_string_get_alloc");
 
 #ifndef NDEBUG
 	/* safety check to ensure the string is actually set */
-	buf[length]= 255;
+	buf[length] = 255;
 #endif
 
 	RNA_property_string_get(ptr, prop, buf);
@@ -2351,7 +2363,7 @@ char *RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop,
 #endif
 
 	if (r_len) {
-		*r_len= length;
+		*r_len = length;
 	}
 
 	return buf;
@@ -2360,12 +2372,12 @@ char *RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop,
 /* this is the length without \0 terminator */
 int RNA_property_string_length(PointerRNA *ptr, PropertyRNA *prop)
 {
-	StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
+	StringPropertyRNA *sprop = (StringPropertyRNA*)prop;
 	IDProperty *idprop;
 
 	BLI_assert(RNA_property_type(prop) == PROP_STRING);
 
-	if((idprop=rna_idproperty_check(&prop, ptr))) {
+	if ((idprop = rna_idproperty_check(&prop, ptr))) {
 		if (idprop->subtype == IDP_STRING_SUB_BYTE) {
 			return idprop->len;
 		}
@@ -2377,7 +2389,7 @@ int RNA_property_string_length(PointerRNA *ptr, PropertyRNA *prop)
 			return idprop->len - 1;
 		}
 	}
-	else if(sprop->length)
+	else if (sprop->length)
 		return sprop->length(ptr);
 	else
 		return strlen(sprop->defaultvalue);
@@ -2385,30 +2397,30 @@ int RNA_property_string_length(PointerRNA *ptr, PropertyRNA *prop)
 
 void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *value)
 {
-	StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
+	StringPropertyRNA *sprop = (StringPropertyRNA*)prop;
 	IDProperty *idprop;
 
 	BLI_assert(RNA_property_type(prop) == PROP_STRING);
 
-	if((idprop=rna_idproperty_check(&prop, ptr))) {
+	if ((idprop = rna_idproperty_check(&prop, ptr))) {
 		/* both IDP_STRING_SUB_BYTE / IDP_STRING_SUB_UTF8 */
 		IDP_AssignString(idprop, value, RNA_property_string_maxlength(prop) - 1);
 		rna_idproperty_touch(idprop);
 	}
-	else if(sprop->set)
+	else if (sprop->set)
 		sprop->set(ptr, value); /* set function needs to clamp its self */
-	else if(prop->flag & PROP_EDITABLE) {
+	else if (prop->flag & PROP_EDITABLE) {
 		IDProperty *group;
 
-		group= RNA_struct_idprops(ptr, 1);
-		if(group)
+		group = RNA_struct_idprops(ptr, 1);
+		if (group)
 			IDP_AddToGroup(group, IDP_NewString(value, prop->identifier, RNA_property_string_maxlength(prop) - 1));
 	}
 }
 
 void RNA_property_string_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop, char *value)
 {
-	StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
+	StringPropertyRNA *sprop = (StringPropertyRNA*)prop;
 
 	BLI_assert(RNA_property_type(prop) == PROP_STRING);
 
@@ -2422,12 +2434,12 @@ char *RNA_property_string_get_default_alloc(PointerRNA *ptr, PropertyRNA *prop,
 
 	BLI_assert(RNA_property_type(prop) == PROP_STRING);
 
-	length= RNA_property_string_default_length(ptr, prop);
+	length = RNA_property_string_default_length(ptr, prop);
 
-	if(length+1 < fixedlen)
-		buf= fixedbuf;
+	if (length+1 < fixedlen)
+		buf = fixedbuf;
 	else
-		buf= MEM_callocN(sizeof(char)*(length+1), "RNA_string_get_alloc");
+		buf = MEM_callocN(sizeof(char)*(length+1), "RNA_string_get_alloc");
 
 	RNA_property_string_get_default(ptr, prop, buf);
 
@@ -2437,7 +2449,7 @@ char *RNA_property_string_get_default_alloc(PointerRNA *ptr, PropertyRNA *prop,
 /* this is the length without \0 terminator */
 int RNA_property_string_default_length(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
 {
-	StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
+	StringPropertyRNA *sprop = (StringPropertyRNA*)prop;
 
 	BLI_assert(RNA_property_type(prop) == PROP_STRING);
 
@@ -2446,14 +2458,14 @@ int RNA_property_string_default_length(PointerRNA *UNUSED(ptr), PropertyRNA *pro
 
 int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
 {
-	EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
+	EnumPropertyRNA *eprop = (EnumPropertyRNA*)prop;
 	IDProperty *idprop;
 
 	BLI_assert(RNA_property_type(prop) == PROP_ENUM);
 
-	if((idprop=rna_idproperty_check(&prop, ptr)))
+	if ((idprop = rna_idproperty_check(&prop, ptr)))
 		return IDP_Int(idprop);
-	else if(eprop->get)
+	else if (eprop->get)
 		return eprop->get(ptr);
 	else
 		return eprop->defaultvalue;
@@ -2461,33 +2473,33 @@ int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
 
 void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value)
 {
-	EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
+	EnumPropertyRNA *eprop = (EnumPropertyRNA*)prop;
 	IDProperty *idprop;
 
 	BLI_assert(RNA_property_type(prop) == PROP_ENUM);
 
-	if((idprop=rna_idproperty_check(&prop, ptr))) {
-		IDP_Int(idprop)= value;
+	if ((idprop = rna_idproperty_check(&prop, ptr))) {
+		IDP_Int(idprop) = value;
 		rna_idproperty_touch(idprop);
 	}
-	else if(eprop->set) {
+	else if (eprop->set) {
 		eprop->set(ptr, value);
 	}
-	else if(prop->flag & PROP_EDITABLE) {
+	else if (prop->flag & PROP_EDITABLE) {
 		IDPropertyTemplate val = {0};
 		IDProperty *group;
 
-		val.i= value;
+		val.i = value;
 
-		group= RNA_struct_idprops(ptr, 1);
-		if(group)
+		group = RNA_struct_idprops(ptr, 1);
+		if (group)
 			IDP_AddToGroup(group, IDP_New(IDP_INT, &val, prop->identifier));
 	}
 }
 
 int RNA_property_enum_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
 {
-	EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
+	EnumPropertyRNA *eprop = (EnumPropertyRNA*)prop;
 
 	BLI_assert(RNA_property_type(prop) == PROP_ENUM);
 
@@ -2496,7 +2508,7 @@ int RNA_property_enum_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
 
 void *RNA_property_enum_py_data_get(PropertyRNA *prop)
 {
-	EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
+	EnumPropertyRNA *eprop = (EnumPropertyRNA*)prop;
 
 	BLI_assert(RNA_property_type(prop) == PROP_ENUM);
 
@@ -2505,23 +2517,23 @@ void *RNA_property_enum_py_data_get(PropertyRNA *prop)
 
 PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
 {
-	PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
+	PointerPropertyRNA *pprop = (PointerPropertyRNA*)prop;
 	IDProperty *idprop;
 
 	BLI_assert(RNA_property_type(prop) == PROP_POINTER);
 
-	if((idprop=rna_idproperty_check(&prop, ptr))) {
-		pprop= (PointerPropertyRNA*)prop;
+	if ((idprop = rna_idproperty_check(&prop, ptr))) {
+		pprop = (PointerPropertyRNA*)prop;
 
 		/* for groups, data is idprop itself */
 		return rna_pointer_inherit_refine(ptr, pprop->type, idprop);
 	}
-	else if(pprop->get) {
+	else if (pprop->get) {
 		return pprop->get(ptr);
 	}
-	else if(prop->flag & PROP_IDPROPERTY) {
+	else if (prop->flag & PROP_IDPROPERTY) {
 		/* XXX temporary hack to add it automatically, reading should
-		   never do any write ops, to ensure thread safety etc .. */
+		 * never do any write ops, to ensure thread safety etc .. */
 		RNA_property_pointer_add(ptr, prop);
 		return RNA_property_pointer_get(ptr, prop);
 	}
@@ -2536,14 +2548,14 @@ void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr
 
 	BLI_assert(RNA_property_type(prop) == PROP_POINTER);
 
-	if((/*idprop=*/ rna_idproperty_check(&prop, ptr))) {
+	if ((/*idprop=*/ rna_idproperty_check(&prop, ptr))) {
 		/* not supported */
 		/* rna_idproperty_touch(idprop); */
 	}
 	else {
-		PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
+		PointerPropertyRNA *pprop = (PointerPropertyRNA*)prop;
 
-		if(		pprop->set &&
+		if (		pprop->set &&
 				!((prop->flag & PROP_NEVER_NULL) && ptr_value.data == NULL) &&
 				!((prop->flag & PROP_ID_SELF_CHECK) && ptr->id.data == ptr_value.id.data)
 		) {
@@ -2554,11 +2566,11 @@ void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr
 
 PointerRNA RNA_property_pointer_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop))
 {
-	//PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
+	/*PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop; */
 
-	// BLI_assert(RNA_property_type(prop) == PROP_POINTER);
+	/* BLI_assert(RNA_property_type(prop) == PROP_POINTER); */
 
-	return PointerRNA_NULL; // FIXME: there has to be a way...
+	return PointerRNA_NULL; /* FIXME: there has to be a way... */
 }
 
 void RNA_property_pointer_add(PointerRNA *ptr, PropertyRNA *prop)
@@ -2567,17 +2579,17 @@ void RNA_property_pointer_add(PointerRNA *ptr, PropertyRNA *prop)
 
 	BLI_assert(RNA_property_type(prop) == PROP_POINTER);
 
-	if((/*idprop=*/rna_idproperty_check(&prop, ptr))) {
+	if ((/*idprop=*/rna_idproperty_check(&prop, ptr))) {
 		/* already exists */
 	}
-	else if(prop->flag & PROP_IDPROPERTY) {
+	else if (prop->flag & PROP_IDPROPERTY) {
 		IDPropertyTemplate val = {0};
 		IDProperty *group;
 
-		val.i= 0;
+		val.i = 0;
 
-		group= RNA_struct_idprops(ptr, 1);
-		if(group)
+		group = RNA_struct_idprops(ptr, 1);
+		if (group)
 			IDP_AddToGroup(group, IDP_New(IDP_GROUP, &val, prop->identifier));
 	}
 	else
@@ -2590,10 +2602,10 @@ void RNA_property_pointer_remove(PointerRNA *ptr, PropertyRNA *prop)
 
 	BLI_assert(RNA_property_type(prop) == PROP_POINTER);
 
-	if((idprop=rna_idproperty_check(&prop, ptr))) {
-		group= RNA_struct_idprops(ptr, 0);
+	if ((idprop = rna_idproperty_check(&prop, ptr))) {
+		group = RNA_struct_idprops(ptr, 0);
 		
-		if(group) {
+		if (group) {
 			IDP_RemFromGroup(group, idprop);
 			IDP_FreeProperty(idprop);
 			MEM_freeN(idprop);
@@ -2605,10 +2617,10 @@ void RNA_property_pointer_remove(PointerRNA *ptr, PropertyRNA *prop)
 
 static void rna_property_collection_get_idp(CollectionPropertyIterator *iter)
 {
-	CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)iter->prop;
+	CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)iter->prop;
 
-	iter->ptr.data= rna_iterator_array_get(iter);
-	iter->ptr.type= cprop->item_type;
+	iter->ptr.data = rna_iterator_array_get(iter);
+	iter->ptr.type = cprop->item_type;
 	rna_pointer_inherit_id(cprop->item_type, &iter->parent, &iter->ptr);
 }
 
@@ -2620,34 +2632,34 @@ void RNA_property_collection_begin(PointerRNA *ptr, PropertyRNA *prop, Collectio
 
 	memset(iter, 0, sizeof(*iter));
 
-	if((idprop=rna_idproperty_check(&prop, ptr)) || (prop->flag & PROP_IDPROPERTY)) {
-		iter->parent= *ptr;
-		iter->prop= prop;
+	if ((idprop = rna_idproperty_check(&prop, ptr)) || (prop->flag & PROP_IDPROPERTY)) {
+		iter->parent = *ptr;
+		iter->prop = prop;
 
-		if(idprop)
+		if (idprop)
 			rna_iterator_array_begin(iter, IDP_IDPArray(idprop), sizeof(IDProperty), idprop->len, 0, NULL);
 		else
 			rna_iterator_array_begin(iter, NULL, sizeof(IDProperty), 0, 0, NULL);
 
-		if(iter->valid)
+		if (iter->valid)
 			rna_property_collection_get_idp(iter);
 
-		iter->idprop= 1;
+		iter->idprop = 1;
 	}
 	else {
-		CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
+		CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)prop;
 		cprop->begin(iter, ptr);
 	}
 }
 
 void RNA_property_collection_next(CollectionPropertyIterator *iter)
 {
-	CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)rna_ensure_property(iter->prop);
+	CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)rna_ensure_property(iter->prop);
 
-	if(iter->idprop) {
+	if (iter->idprop) {
 		rna_iterator_array_next(iter);
 
-		if(iter->valid)
+		if (iter->valid)
 			rna_property_collection_get_idp(iter);
 	}
 	else
@@ -2656,9 +2668,9 @@ void RNA_property_collection_next(CollectionPropertyIterator *iter)
 
 void RNA_property_collection_end(CollectionPropertyIterator *iter)
 {
-	CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)rna_ensure_property(iter->prop);
+	CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)rna_ensure_property(iter->prop);
 
-	if(iter->idprop)
+	if (iter->idprop)
 		rna_iterator_array_end(iter);
 	else
 		cprop->end(iter);
@@ -2666,23 +2678,23 @@ void RNA_property_collection_end(CollectionPropertyIterator *iter)
 
 int RNA_property_collection_length(PointerRNA *ptr, PropertyRNA *prop)
 {
-	CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
+	CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)prop;
 	IDProperty *idprop;
 
 	BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
 
-	if((idprop=rna_idproperty_check(&prop, ptr))) {
+	if ((idprop = rna_idproperty_check(&prop, ptr))) {
 		return idprop->len;
 	}
-	else if(cprop->length) {
+	else if (cprop->length) {
 		return cprop->length(ptr);
 	}
 	else {
 		CollectionPropertyIterator iter;
-		int length= 0;
+		int length = 0;
 
 		RNA_property_collection_begin(ptr, prop, &iter);
-		for(; iter.valid; RNA_property_collection_next(&iter))
+		for (; iter.valid; RNA_property_collection_next(&iter))
 			length++;
 		RNA_property_collection_end(&iter);
 
@@ -2693,39 +2705,39 @@ int RNA_property_collection_length(PointerRNA *ptr, PropertyRNA *prop)
 void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr)
 {
 	IDProperty *idprop;
-//	CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
+/*	CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; */
 
 	BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
 
-	if((idprop=rna_idproperty_check(&prop, ptr))) {
+	if ((idprop = rna_idproperty_check(&prop, ptr))) {
 		IDPropertyTemplate val = {0};
 		IDProperty *item;
 
-		item= IDP_New(IDP_GROUP, &val, "");
+		item = IDP_New(IDP_GROUP, &val, "");
 		IDP_AppendArray(idprop, item);
-		// 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(item);
 	}
-	else if(prop->flag & PROP_IDPROPERTY) {
+	else if (prop->flag & PROP_IDPROPERTY) {
 		IDProperty *group, *item;
 		IDPropertyTemplate val = {0};
 
-		group= RNA_struct_idprops(ptr, 1);
-		if(group) {
-			idprop= IDP_NewIDPArray(prop->identifier);
+		group = RNA_struct_idprops(ptr, 1);
+		if (group) {
+			idprop = IDP_NewIDPArray(prop->identifier);
 			IDP_AddToGroup(group, idprop);
 
-			item= IDP_New(IDP_GROUP, &val, "");
+			item = IDP_New(IDP_GROUP, &val, "");
 			IDP_AppendArray(idprop, item);
-			// 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(item);
 		}
 	}
 
 	/* py api calls directly */
 #if 0
-	else if(cprop->add){
-		if(!(cprop->add->flag & FUNC_USE_CONTEXT)) { /* XXX check for this somewhere else */
+	else if (cprop->add) {
+		if (!(cprop->add->flag & FUNC_USE_CONTEXT)) { /* XXX check for this somewhere else */
 			ParameterList params;
 			RNA_parameter_list_create(&params, ptr, cprop->add);
 			RNA_function_call(NULL, NULL, ptr, cprop->add, &params);
@@ -2736,12 +2748,12 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA
 		printf("%s %s.%s: not implemented for this property.\n", __func__, ptr->type->identifier, prop->identifier);*/
 #endif
 
-	if(r_ptr) {
-		if(idprop) {
-			CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
+	if (r_ptr) {
+		if (idprop) {
+			CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)prop;
 
-			r_ptr->data= IDP_GetIndexArray(idprop, idprop->len-1);
-			r_ptr->type= cprop->item_type;
+			r_ptr->data = IDP_GetIndexArray(idprop, idprop->len-1);
+			r_ptr->type = cprop->item_type;
 			rna_pointer_inherit_id(NULL, ptr, r_ptr);
 		}
 		else
@@ -2752,19 +2764,19 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA
 int RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key)
 {
 	IDProperty *idprop;
-//	CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
+/*	CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; */
 
 	BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
 
-	if((idprop=rna_idproperty_check(&prop, ptr))) {
+	if ((idprop = rna_idproperty_check(&prop, ptr))) {
 		IDProperty tmp, *array;
 		int len;
 
-		len= idprop->len;
-		array= IDP_IDPArray(idprop);
+		len = idprop->len;
+		array = IDP_IDPArray(idprop);
 
-		if(key >= 0 && key < len) {
-			if(key+1 < len) {
+		if (key >= 0 && key < len) {
+			if (key+1 < len) {
 				/* move element to be removed to the back */
 				memcpy(&tmp, &array[key], sizeof(IDProperty));
 				memmove(array+key, array+key+1, sizeof(IDProperty)*(len-(key+1)));
@@ -2776,13 +2788,13 @@ int RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key)
 
 		return 1;
 	}
-	else if(prop->flag & PROP_IDPROPERTY)
+	else if (prop->flag & PROP_IDPROPERTY)
 		return 1;
 
 	/* py api calls directly */
 #if 0
-	else if(cprop->remove){
-		if(!(cprop->remove->flag & FUNC_USE_CONTEXT)) { /* XXX check for this somewhere else */
+	else if (cprop->remove) {
+		if (!(cprop->remove->flag & FUNC_USE_CONTEXT)) { /* XXX check for this somewhere else */
 			ParameterList params;
 			RNA_parameter_list_create(&params, ptr, cprop->remove);
 			RNA_function_call(NULL, NULL, ptr, cprop->remove, &params);
@@ -2803,16 +2815,16 @@ int RNA_property_collection_move(PointerRNA *ptr, PropertyRNA *prop, int key, in
 
 	BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
 
-	if((idprop=rna_idproperty_check(&prop, ptr))) {
+	if ((idprop = rna_idproperty_check(&prop, ptr))) {
 		IDProperty tmp, *array;
 		int len;
 
-		len= idprop->len;
-		array= IDP_IDPArray(idprop);
+		len = idprop->len;
+		array = IDP_IDPArray(idprop);
 
-		if(key >= 0 && key < len && pos >= 0 && pos < len && key != pos) {
+		if (key >= 0 && key < len && pos >= 0 && pos < len && key != pos) {
 			memcpy(&tmp, &array[key], sizeof(IDProperty));
-			if(pos < key)
+			if (pos < key)
 				memmove(array+pos+1, array+pos, sizeof(IDProperty)*(key - pos));
 			else
 				memmove(array+key, array+key+1, sizeof(IDProperty)*(pos - key));
@@ -2821,7 +2833,7 @@ int RNA_property_collection_move(PointerRNA *ptr, PropertyRNA *prop, int key, in
 
 		return 1;
 	}
-	else if(prop->flag & PROP_IDPROPERTY)
+	else if (prop->flag & PROP_IDPROPERTY)
 		return 1;
 
 	return 0;
@@ -2833,19 +2845,19 @@ void RNA_property_collection_clear(PointerRNA *ptr, PropertyRNA *prop)
 
 	BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
 
-	if((idprop=rna_idproperty_check(&prop, ptr)))
+	if ((idprop = rna_idproperty_check(&prop, ptr)))
 		IDP_ResizeIDPArray(idprop, 0);
 }
 
 int RNA_property_collection_lookup_index(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *t_ptr)
 {
 	CollectionPropertyIterator iter;
-	int index= 0;
+	int index = 0;
 	
 	BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
 
 	RNA_property_collection_begin(ptr, prop, &iter);
-	for(index=0; iter.valid; RNA_property_collection_next(&iter), index++) {
+	for (index = 0; iter.valid; RNA_property_collection_next(&iter), index++) {
 		if (iter.ptr.data == t_ptr->data)
 			break;
 	}
@@ -2860,11 +2872,11 @@ int RNA_property_collection_lookup_index(PointerRNA *ptr, PropertyRNA *prop, Poi
 
 int RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int key, PointerRNA *r_ptr)
 {
-	CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)rna_ensure_property(prop);
+	CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)rna_ensure_property(prop);
 
 	BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
 
-	if(cprop->lookupint) {
+	if (cprop->lookupint) {
 		/* we have a callback defined, use it */
 		return cprop->lookupint(ptr, key, r_ptr);
 	}
@@ -2874,15 +2886,15 @@ int RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int k
 		int i;
 
 		RNA_property_collection_begin(ptr, prop, &iter);
-		for(i=0; iter.valid; RNA_property_collection_next(&iter), i++) {
-			if(i == key) {
-				*r_ptr= iter.ptr;
+		for (i = 0; iter.valid; RNA_property_collection_next(&iter), i++) {
+			if (i == key) {
+				*r_ptr = iter.ptr;
 				break;
 			}
 		}
 		RNA_property_collection_end(&iter);
 
-		if(!iter.valid)
+		if (!iter.valid)
 			memset(r_ptr, 0, sizeof(*r_ptr));
 
 		return iter.valid;
@@ -2891,11 +2903,11 @@ int RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int k
 
 int RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, const char *key, PointerRNA *r_ptr)
 {
-	CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)rna_ensure_property(prop);
+	CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)rna_ensure_property(prop);
 
 	BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
 
-	if(cprop->lookupstring) {
+	if (cprop->lookupstring) {
 		/* we have a callback defined, use it */
 		return cprop->lookupstring(ptr, key, r_ptr);
 	}
@@ -2904,32 +2916,32 @@ int RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, co
 		CollectionPropertyIterator iter;
 		PropertyRNA *nameprop;
 		char name[256], *nameptr;
-		int found= 0;
-		int keylen= strlen(key);
+		int found = 0;
+		int keylen = strlen(key);
 		int namelen;
 
 		RNA_property_collection_begin(ptr, prop, &iter);
-		for(; iter.valid; RNA_property_collection_next(&iter)) {
-			if(iter.ptr.data && iter.ptr.type->nameproperty) {
-				nameprop= iter.ptr.type->nameproperty;
+		for (; iter.valid; RNA_property_collection_next(&iter)) {
+			if (iter.ptr.data && iter.ptr.type->nameproperty) {
+				nameprop = iter.ptr.type->nameproperty;
 
-				nameptr= RNA_property_string_get_alloc(&iter.ptr, nameprop, name, sizeof(name), &namelen);
+				nameptr = RNA_property_string_get_alloc(&iter.ptr, nameprop, name, sizeof(name), &namelen);
 
-				if((keylen == namelen) && (strcmp(nameptr, key) == 0)) {
-					*r_ptr= iter.ptr;
-					found= 1;
+				if ((keylen == namelen) && (strcmp(nameptr, key) == 0)) {
+					*r_ptr = iter.ptr;
+					found = 1;
 				}
 
-				if((char *)&name != nameptr)
+				if ((char *)&name != nameptr)
 					MEM_freeN(nameptr);
 
-				if(found)
+				if (found)
 					break;
 			}
 		}
 		RNA_property_collection_end(&iter);
 
-		if(!iter.valid)
+		if (!iter.valid)
 			memset(r_ptr, 0, sizeof(*r_ptr));
 
 		return iter.valid;
@@ -2939,11 +2951,11 @@ int RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, co
 /* zero return is an assignment error */
 int RNA_property_collection_assign_int(PointerRNA *ptr, PropertyRNA *prop, const int key, const PointerRNA *assign_ptr)
 {
-	CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)rna_ensure_property(prop);
+	CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)rna_ensure_property(prop);
 
 	BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
 
-	if(cprop->assignint) {
+	if (cprop->assignint) {
 		/* we have a callback defined, use it */
 		return cprop->assignint(ptr, key, assign_ptr);
 	}
@@ -2955,7 +2967,7 @@ int RNA_property_collection_type_get(PointerRNA *ptr, PropertyRNA *prop, Pointer
 {
 	BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
 
-	*r_ptr= *ptr;
+	*r_ptr = *ptr;
 	return ((r_ptr->type = rna_ensure_property(prop)->srna) ? 1:0);
 }
 
@@ -2967,26 +2979,26 @@ int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, Proper
 
 	BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
 
-	if(!(prop->flag & PROP_RAW_ARRAY) || !(itemprop->flag & PROP_RAW_ACCESS))
+	if (!(prop->flag & PROP_RAW_ARRAY) || !(itemprop->flag & PROP_RAW_ACCESS))
 		return 0;
 
 	RNA_property_collection_begin(ptr, prop, &iter);
 
-	if(iter.valid) {
+	if (iter.valid) {
 		/* get data from array iterator and item property */
-		internal= iter.internal;
-		arrayp= (iter.valid)? iter.ptr.data: NULL;
+		internal = iter.internal;
+		arrayp = (iter.valid)? iter.ptr.data: NULL;
 
-		if(internal->skip || !RNA_property_editable(&iter.ptr, itemprop)) {
+		if (internal->skip || !RNA_property_editable(&iter.ptr, itemprop)) {
 			/* we might skip some items, so it's not a proper array */
 			RNA_property_collection_end(&iter);
 			return 0;
 		}
 
-		array->array= arrayp + itemprop->rawoffset;
-		array->stride= internal->itemsize;
-		array->len= ((char*)internal->endptr - arrayp)/internal->itemsize;
-		array->type= itemprop->rawtype;
+		array->array = arrayp + itemprop->rawoffset;
+		array->stride = internal->itemsize;
+		array->len = ((char*)internal->endptr - arrayp)/internal->itemsize;
+		array->type = itemprop->rawtype;
 	}
 	else
 		memset(array, 0, sizeof(RawArray));
@@ -2998,7 +3010,7 @@ int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, Proper
 
 #define RAW_GET(dtype, var, raw, a)                                           \
 {                                                                             \
-	switch(raw.type) {                                                        \
+	switch (raw.type) {                                                       \
 		case PROP_RAW_CHAR: var = (dtype)((char*)raw.array)[a]; break;        \
 		case PROP_RAW_SHORT: var = (dtype)((short*)raw.array)[a]; break;      \
 		case PROP_RAW_INT: var = (dtype)((int*)raw.array)[a]; break;          \
@@ -3010,7 +3022,7 @@ int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, Proper
 
 #define RAW_SET(dtype, raw, a, var)                                           \
 {                                                                             \
-	switch(raw.type) {                                                        \
+	switch (raw.type) {                                                       \
 		case PROP_RAW_CHAR: ((char*)raw.array)[a] = (char)var; break;         \
 		case PROP_RAW_SHORT: ((short*)raw.array)[a] = (short)var; break;      \
 		case PROP_RAW_INT: ((int*)raw.array)[a] = (int)var; break;            \
@@ -3022,7 +3034,7 @@ int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, Proper
 
 int RNA_raw_type_sizeof(RawPropertyType type)
 {
-	switch(type) {
+	switch (type) {
 		case PROP_RAW_CHAR: return sizeof(char);
 		case PROP_RAW_SHORT: return sizeof(short);
 		case PROP_RAW_INT: return sizeof(int);
@@ -3032,64 +3044,66 @@ int RNA_raw_type_sizeof(RawPropertyType type)
 	}
 }
 
-static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *prop, const char *propname, void *inarray, RawPropertyType intype, int inlen, int set)
+static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *prop, const char *propname,
+                          void *inarray, RawPropertyType intype, int inlen, int set)
 {
 	StructRNA *ptype;
 	PointerRNA itemptr;
 	PropertyRNA *itemprop, *iprop;
-	PropertyType itemtype=0;
+	PropertyType itemtype = 0;
 	RawArray in;
-	int itemlen= 0;
+	int itemlen = 0;
 
 	/* initialize in array, stride assumed 0 in following code */
-	in.array= inarray;
-	in.type= intype;
-	in.len= inlen;
-	in.stride= 0;
+	in.array = inarray;
+	in.type = intype;
+	in.len = inlen;
+	in.stride = 0;
 
-	ptype= RNA_property_pointer_type(ptr, prop);
+	ptype = RNA_property_pointer_type(ptr, prop);
 
 	/* try to get item property pointer */
 	RNA_pointer_create(NULL, ptype, NULL, &itemptr);
-	itemprop= RNA_struct_find_property(&itemptr, propname);
+	itemprop = RNA_struct_find_property(&itemptr, propname);
 
-	if(itemprop) {
+	if (itemprop) {
 		/* we have item property pointer */
 		RawArray out;
 
 		/* check type */
-		itemtype= RNA_property_type(itemprop);
+		itemtype = RNA_property_type(itemprop);
 
-		if(!ELEM3(itemtype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) {
+		if (!ELEM3(itemtype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) {
 			BKE_report(reports, RPT_ERROR, "Only boolean, int and float properties supported");
 			return 0;
 		}
 
 		/* check item array */
-		itemlen= RNA_property_array_length(&itemptr, itemprop);
+		itemlen = RNA_property_array_length(&itemptr, itemprop);
 
 		/* try to access as raw array */
-		if(RNA_property_collection_raw_array(ptr, prop, itemprop, &out)) {
+		if (RNA_property_collection_raw_array(ptr, prop, itemprop, &out)) {
 			int arraylen = (itemlen == 0) ? 1 : itemlen;
-			if(in.len != arraylen*out.len) {
-				BKE_reportf(reports, RPT_ERROR, "Array length mismatch (expected %d, got %d)", out.len*arraylen, in.len);
+			if (in.len != arraylen*out.len) {
+				BKE_reportf(reports, RPT_ERROR, "Array length mismatch (expected %d, got %d)",
+				            out.len * arraylen, in.len);
 				return 0;
 			}
 			
 			/* matching raw types */
-			if(out.type == in.type) {
-				void *inp= in.array;
-				void *outp= out.array;
+			if (out.type == in.type) {
+				void *inp = in.array;
+				void *outp = out.array;
 				int a, size;
 
-				size= RNA_raw_type_sizeof(out.type) * arraylen;
+				size = RNA_raw_type_sizeof(out.type) * arraylen;
 
-				for(a=0; a<out.len; a++) {
-					if(set) memcpy(outp, inp, size);
+				for (a = 0; a<out.len; a++) {
+					if (set) memcpy(outp, inp, size);
 					else memcpy(inp, outp, size);
 
-					inp= (char*)inp + size;
-					outp= (char*)outp + out.stride;
+					inp = (char*)inp + size;
+					outp = (char*)outp + out.stride;
 				}
 
 				return 1;
@@ -3101,9 +3115,9 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
 	}
 
 	{
-		void *tmparray= NULL;
-		int tmplen= 0;
-		int err= 0, j, a= 0;
+		void *tmparray = NULL;
+		int tmplen = 0;
+		int err = 0, j, a = 0;
 		int needconv = 1;
 
 		if (((itemtype == PROP_BOOLEAN || itemtype == PROP_INT) && in.type == PROP_RAW_INT) ||
@@ -3114,44 +3128,44 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
 		/* no item property pointer, can still be id property, or
 		 * property of a type derived from the collection pointer type */
 		RNA_PROP_BEGIN(ptr, itemptr, prop) {
-			if(itemptr.data) {
-				if(itemprop) {
+			if (itemptr.data) {
+				if (itemprop) {
 					/* we got the property already */
-					iprop= itemprop;
+					iprop = itemprop;
 				}
 				else {
 					/* not yet, look it up and verify if it is valid */
-					iprop= RNA_struct_find_property(&itemptr, propname);
+					iprop = RNA_struct_find_property(&itemptr, propname);
 
-					if(iprop) {
-						itemlen= RNA_property_array_length(&itemptr, iprop);
-						itemtype= RNA_property_type(iprop);
+					if (iprop) {
+						itemlen = RNA_property_array_length(&itemptr, iprop);
+						itemtype = RNA_property_type(iprop);
 					}
 					else {
 						BKE_reportf(reports, RPT_ERROR, "Property named %s not found", propname);
-						err= 1;
+						err = 1;
 						break;
 					}
 
-					if(!ELEM3(itemtype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) {
+					if (!ELEM3(itemtype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) {
 						BKE_report(reports, RPT_ERROR, "Only boolean, int and float properties supported");
-						err= 1;
+						err = 1;
 						break;
 					}
 				}
 
 				/* editable check */
-				if(!set || RNA_property_editable(&itemptr, iprop)) {
-					if(a+itemlen > in.len) {
+				if (!set || RNA_property_editable(&itemptr, iprop)) {
+					if (a+itemlen > in.len) {
 						BKE_reportf(reports, RPT_ERROR, "Array length mismatch (got %d, expected more)", in.len);
-						err= 1;
+						err = 1;
 						break;
 					}
 
-					if(itemlen == 0) {
+					if (itemlen == 0) {
 						/* handle conversions */
-						if(set) {
-							switch(itemtype) {
+						if (set) {
+							switch (itemtype) {
 								case PROP_BOOLEAN: {
 									int b;
 									RAW_GET(int, b, in, a);
@@ -3175,19 +3189,19 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
 							}
 						}
 						else {
-							switch(itemtype) {
+							switch (itemtype) {
 								case PROP_BOOLEAN: {
-									int b= RNA_property_boolean_get(&itemptr, iprop);
+									int b = RNA_property_boolean_get(&itemptr, iprop);
 									RAW_SET(int, in, a, b);
 									break;
 								}
 								case PROP_INT: {
-									int i= RNA_property_int_get(&itemptr, iprop);
+									int i = RNA_property_int_get(&itemptr, iprop);
 									RAW_SET(int, in, a, i);
 									break;
 								}
 								case PROP_FLOAT: {
-									float f= RNA_property_float_get(&itemptr, iprop);
+									float f = RNA_property_float_get(&itemptr, iprop);
 									RAW_SET(float, in, a, f);
 									break;
 								}
@@ -3199,32 +3213,32 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
 					}
 					else if (needconv == 1) {
 						/* allocate temporary array if needed */
-						if(tmparray && tmplen != itemlen) {
+						if (tmparray && tmplen != itemlen) {
 							MEM_freeN(tmparray);
-							tmparray= NULL;
+							tmparray = NULL;
 						}
-						if(!tmparray) {
-							tmparray= MEM_callocN(sizeof(float)*itemlen, "RNA tmparray\n");
-							tmplen= itemlen;
+						if (!tmparray) {
+							tmparray = MEM_callocN(sizeof(float)*itemlen, "RNA tmparray\n");
+							tmplen = itemlen;
 						}
 
 						/* handle conversions */
-						if(set) {
-							switch(itemtype) {
+						if (set) {
+							switch (itemtype) {
 								case PROP_BOOLEAN: {
-									for(j=0; j<itemlen; j++, a++)
+									for (j = 0; j<itemlen; j++, a++)
 										RAW_GET(int, ((int*)tmparray)[j], in, a);
 									RNA_property_boolean_set_array(&itemptr, iprop, tmparray);
 									break;
 								}
 								case PROP_INT: {
-									for(j=0; j<itemlen; j++, a++)
+									for (j = 0; j<itemlen; j++, a++)
 										RAW_GET(int, ((int*)tmparray)[j], in, a);
 									RNA_property_int_set_array(&itemptr, iprop, tmparray);
 									break;
 								}
 								case PROP_FLOAT: {
-									for(j=0; j<itemlen; j++, a++)
+									for (j = 0; j<itemlen; j++, a++)
 										RAW_GET(float, ((float*)tmparray)[j], in, a);
 									RNA_property_float_set_array(&itemptr, iprop, tmparray);
 									break;
@@ -3234,22 +3248,22 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
 							}
 						}
 						else {
-							switch(itemtype) {
+							switch (itemtype) {
 								case PROP_BOOLEAN: {
 									RNA_property_boolean_get_array(&itemptr, iprop, tmparray);
-									for(j=0; j<itemlen; j++, a++)
+									for (j = 0; j<itemlen; j++, a++)
 										RAW_SET(int, in, a, ((int*)tmparray)[j]);
 									break;
 								}
 								case PROP_INT: {
 									RNA_property_int_get_array(&itemptr, iprop, tmparray);
-									for(j=0; j<itemlen; j++, a++)
+									for (j = 0; j<itemlen; j++, a++)
 										RAW_SET(int, in, a, ((int*)tmparray)[j]);
 									break;
 								}
 								case PROP_FLOAT: {
 									RNA_property_float_get_array(&itemptr, iprop, tmparray);
-									for(j=0; j<itemlen; j++, a++)
+									for (j = 0; j<itemlen; j++, a++)
 										RAW_SET(float, in, a, ((float*)tmparray)[j]);
 									break;
 								}
@@ -3259,8 +3273,8 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
 						}
 					}
 					else {
-						if(set) {
-							switch(itemtype) {
+						if (set) {
+							switch (itemtype) {
 								case PROP_BOOLEAN: {
 									RNA_property_boolean_set_array(&itemptr, iprop, &((int*)in.array)[a]);
 									a += itemlen;
@@ -3281,7 +3295,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
 							}
 						}
 						else {
-							switch(itemtype) {
+							switch (itemtype) {
 								case PROP_BOOLEAN: {
 									RNA_property_boolean_get_array(&itemptr, iprop, &((int*)in.array)[a]);
 									a += itemlen;
@@ -3307,7 +3321,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro
 		}
 		RNA_PROP_END;
 
-		if(tmparray)
+		if (tmparray)
 			MEM_freeN(tmparray);
 
 		return !err;
@@ -3334,12 +3348,14 @@ RawPropertyType RNA_property_raw_type(PropertyRNA *prop)
 	return prop->rawtype;
 }
 
-int RNA_property_collection_raw_get(ReportList *reports, PointerRNA *ptr, PropertyRNA *prop, const char *propname, void *array, RawPropertyType type, int len)
+int RNA_property_collection_raw_get(ReportList *reports, PointerRNA *ptr, PropertyRNA *prop, const char *propname,
+                                    void *array, RawPropertyType type, int len)
 {
 	return rna_raw_access(reports, ptr, prop, propname, array, type, len, 0);
 }
 
-int RNA_property_collection_raw_set(ReportList *reports, PointerRNA *ptr, PropertyRNA *prop, const char *propname, void *array, RawPropertyType type, int len)
+int RNA_property_collection_raw_set(ReportList *reports, PointerRNA *ptr, PropertyRNA *prop, const char *propname,
+                                    void *array, RawPropertyType type, int len)
 {
 	return rna_raw_access(reports, ptr, prop, propname, array, type, len, 1);
 }
@@ -3350,36 +3366,36 @@ void rna_iterator_listbase_begin(CollectionPropertyIterator *iter, ListBase *lb,
 {
 	ListBaseIterator *internal;
 
-	internal= MEM_callocN(sizeof(ListBaseIterator), "ListBaseIterator");
-	internal->link= (lb)? lb->first: NULL;
-	internal->skip= skip;
+	internal = MEM_callocN(sizeof(ListBaseIterator), "ListBaseIterator");
+	internal->link = (lb)? lb->first: NULL;
+	internal->skip = skip;
 
-	iter->internal= internal;
-	iter->valid= (internal->link != NULL);
+	iter->internal = internal;
+	iter->valid = (internal->link != NULL);
 
-	if(skip && iter->valid && skip(iter, internal->link))
+	if (skip && iter->valid && skip(iter, internal->link))
 		rna_iterator_listbase_next(iter);
 }
 
 void rna_iterator_listbase_next(CollectionPropertyIterator *iter)
 {
-	ListBaseIterator *internal= iter->internal;
+	ListBaseIterator *internal = iter->internal;
 
-	if(internal->skip) {
+	if (internal->skip) {
 		do {
-			internal->link= internal->link->next;
-			iter->valid= (internal->link != NULL);
-		} while(iter->valid && internal->skip(iter, internal->link));
+			internal->link = internal->link->next;
+			iter->valid = (internal->link != NULL);
+		} while (iter->valid && internal->skip(iter, internal->link));
 	}
 	else {
-		internal->link= internal->link->next;
-		iter->valid= (internal->link != NULL);
+		internal->link = internal->link->next;
+		iter->valid = (internal->link != NULL);
 	}
 }
 
 void *rna_iterator_listbase_get(CollectionPropertyIterator *iter)
 {
-	ListBaseIterator *internal= iter->internal;
+	ListBaseIterator *internal = iter->internal;
 
 	return internal->link;
 }
@@ -3387,67 +3403,68 @@ void *rna_iterator_listbase_get(CollectionPropertyIterator *iter)
 void rna_iterator_listbase_end(CollectionPropertyIterator *iter)
 {
 	MEM_freeN(iter->internal);
-	iter->internal= NULL;
+	iter->internal = NULL;
 }
 
 PointerRNA rna_listbase_lookup_int(PointerRNA *ptr, StructRNA *type, struct ListBase *lb, int index)
 {
-	void *data= BLI_findlink(lb, index);
+	void *data = BLI_findlink(lb, index);
 	return rna_pointer_inherit_refine(ptr, type, data);
 }
 
-void rna_iterator_array_begin(CollectionPropertyIterator *iter, void *ptr, int itemsize, int length, int free_ptr, IteratorSkipFunc skip)
+void rna_iterator_array_begin(CollectionPropertyIterator *iter, void *ptr, int itemsize, int length,
+                              int free_ptr, IteratorSkipFunc skip)
 {
 	ArrayIterator *internal;
 
-	if(ptr == NULL)
-		length= 0;
+	if (ptr == NULL)
+		length = 0;
 	else if (length == 0) {
-		ptr= NULL;
-		itemsize= 0;
+		ptr = NULL;
+		itemsize = 0;
 	}
 
-	internal= MEM_callocN(sizeof(ArrayIterator), "ArrayIterator");
-	internal->ptr= ptr;
-	internal->free_ptr= free_ptr ? ptr:NULL;
-	internal->endptr= ((char*)ptr)+length*itemsize;
-	internal->itemsize= itemsize;
-	internal->skip= skip;
-	internal->length= length;
+	internal = MEM_callocN(sizeof(ArrayIterator), "ArrayIterator");
+	internal->ptr = ptr;
+	internal->free_ptr = free_ptr ? ptr:NULL;
+	internal->endptr = ((char*)ptr)+length*itemsize;
+	internal->itemsize = itemsize;
+	internal->skip = skip;
+	internal->length = length;
 	
-	iter->internal= internal;
-	iter->valid= (internal->ptr != internal->endptr);
+	iter->internal = internal;
+	iter->valid = (internal->ptr != internal->endptr);
 
-	if(skip && iter->valid && skip(iter, internal->ptr))
+	if (skip && iter->valid && skip(iter, internal->ptr))
 		rna_iterator_array_next(iter);
 }
 
 void rna_iterator_array_next(CollectionPropertyIterator *iter)
 {
-	ArrayIterator *internal= iter->internal;
+	ArrayIterator *internal = iter->internal;
 
-	if(internal->skip) {
+	if (internal->skip) {
 		do {
 			internal->ptr += internal->itemsize;
-			iter->valid= (internal->ptr != internal->endptr);
-		} while(iter->valid && internal->skip(iter, internal->ptr));
+			iter->valid = (internal->ptr != internal->endptr);
+		} while (iter->valid && internal->skip(iter, internal->ptr));
 	}
 	else {
 		internal->ptr += internal->itemsize;
-		iter->valid= (internal->ptr != internal->endptr);
+		iter->valid = (internal->ptr != internal->endptr);
 	}
 }
 
 void *rna_iterator_array_get(CollectionPropertyIterator *iter)
 {
-	ArrayIterator *internal= iter->internal;
+	ArrayIterator *internal = iter->internal;
 
 	return internal->ptr;
 }
 
 void *rna_iterator_array_dereference_get(CollectionPropertyIterator *iter)
 {
-	ArrayIterator *internal= iter->internal;
+	ArrayIterator *internal = iter->internal;
 
 	/* for ** arrays */
 	return *(void**)(internal->ptr);
@@ -3455,19 +3472,19 @@ void *rna_iterator_array_dereference_get(CollectionPropertyIterator *iter)
 
 void rna_iterator_array_end(CollectionPropertyIterator *iter)
 {
-	ArrayIterator *internal= iter->internal;
+	ArrayIterator *internal = iter->internal;
 	
-	if(internal->free_ptr) {
+	if (internal->free_ptr) {
 		MEM_freeN(internal->free_ptr);
-		internal->free_ptr= NULL;
+		internal->free_ptr = NULL;
 	}
 	MEM_freeN(iter->internal);
-	iter->internal= NULL;
+	iter->internal = NULL;
 }
 
 PointerRNA rna_array_lookup_int(PointerRNA *ptr, StructRNA *type, void *data, int itemsize, int length, int index)
 {
-	if(index < 0 || index >= length)
+	if (index < 0 || index >= length)
 		return PointerRNA_NULL;
 
 	return rna_pointer_inherit_refine(ptr, type, ((char*)data) + index*itemsize);
@@ -3479,37 +3496,37 @@ static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int
 {
 	const char *p;
 	char *buf;
-	char quote= '\0';
+	char quote = '\0';
 	int i, j, len, escape;
 
-	len= 0;
+	len = 0;
 
-	if(bracket) {
+	if (bracket) {
 		/* get data between [], check escaping ] with \] */
-		if(**path == '[') (*path)++;
+		if (**path == '[') (*path)++;
 		else return NULL;
 
-		p= *path;
+		p = *path;
 
 		/* 2 kinds of lookups now, quoted or unquoted */
-		quote= *p;
+		quote = *p;
 
-		if(quote != '"') /* " - this comment is hack for Aligorith's text editor's sanity */
-			quote= 0;
+		if (quote != '"') /* " - this comment is hack for Aligorith's text editor's sanity */
+			quote = 0;
 
-		if(quote==0) {
-			while(*p && (*p != ']')) {
+		if (quote == 0) {
+			while (*p && (*p != ']')) {
 				len++;
 				p++;
 			}
 		}
 		else {
-			escape= 0;
+			escape = 0;
 			/* skip the first quote */
 			len++;
 			p++;
-			while(*p && (*p != quote || escape)) {
-				escape= (*p == '\\');
+			while (*p && (*p != quote || escape)) {
+				escape = (*p == '\\');
 				len++;
 				p++;
 			}
@@ -3519,57 +3536,57 @@ static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int
 			p++;
 		}
 
-		if(*p != ']') return NULL;
+		if (*p != ']') return NULL;
 	}
 	else {
 		/* get data until . or [ */
-		p= *path;
+		p = *path;
 
-		while(*p && *p != '.' && *p != '[') {
+		while (*p && *p != '.' && *p != '[') {
 			len++;
 			p++;
 		}
 	}
 	
 	/* empty, return */
-	if(len == 0)
+	if (len == 0)
 		return NULL;
 	
 	/* try to use fixed buffer if possible */
-	if(len+1 < fixedlen)
-		buf= fixedbuf;
+	if (len+1 < fixedlen)
+		buf = fixedbuf;
 	else
-		buf= MEM_callocN(sizeof(char)*(len+1), "rna_path_token");
+		buf = MEM_callocN(sizeof(char)*(len+1), "rna_path_token");
 
 	/* copy string, taking into account escaped ] */
-	if(bracket) {
-		for(p=*path, i=0, j=0; i<len; i++, p++) {
-			if(*p == '\\' && *(p+1) == quote);
-			else buf[j++]= *p;
+	if (bracket) {
+		for (p = *path, i = 0, j = 0; i<len; i++, p++) {
+			if (*p == '\\' && *(p+1) == quote);
+			else buf[j++] = *p;
 		}
 
-		buf[j]= 0;
+		buf[j] = 0;
 	}
 	else {
 		memcpy(buf, *path, sizeof(char)*len);
-		buf[len]= '\0';
+		buf[len] = '\0';
 	}
 
 	/* set path to start of next token */
-	if(*p == ']') p++;
-	if(*p == '.') p++;
-	*path= p;
+	if (*p == ']') p++;
+	if (*p == '.') p++;
+	*path = p;
 
 	return buf;
 }
 
 static int rna_token_strip_quotes(char *token)
 {
-	if(token[0]=='"') {
+	if (token[0] =='"') {
 		int len = strlen(token);
-		if (len >= 2 && token[len-1]=='"') {
+		if (len >= 2 && token[len-1] =='"') {
 			/* strip away "" */
-			token[len-1]= '\0';
+			token[len-1] = '\0';
 			return 1;
 		}
 	}
@@ -3589,80 +3606,80 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr,
 	char fixedbuf[256], *token;
 	int type, intkey;
 
-	prop= NULL;
-	curptr= *ptr;
+	prop = NULL;
+	curptr = *ptr;
 
-	if(path==NULL || *path=='\0')
+	if (path == NULL || *path =='\0')
 		return 0;
 
-	while(*path) {
-		int use_id_prop = (*path=='[') ? 1:0;
+	while (*path) {
+		int use_id_prop = (*path =='[') ? 1:0;
 		/* custom property lookup ?
 		 * C.object["someprop"]
 		 */
 
 		/* look up property name in current struct */
-		token= rna_path_token(&path, fixedbuf, sizeof(fixedbuf), use_id_prop);
+		token = rna_path_token(&path, fixedbuf, sizeof(fixedbuf), use_id_prop);
 
-		if(!token)
+		if (!token)
 			return 0;
 
-		if(use_id_prop) { /* look up property name in current struct */
-			IDProperty *group= RNA_struct_idprops(&curptr, 0);
-			if(group && rna_token_strip_quotes(token))
-				prop= (PropertyRNA *)IDP_GetPropertyFromGroup(group, token+1);
+		if (use_id_prop) { /* look up property name in current struct */
+			IDProperty *group = RNA_struct_idprops(&curptr, 0);
+			if (group && rna_token_strip_quotes(token))
+				prop = (PropertyRNA *)IDP_GetPropertyFromGroup(group, token+1);
 		}
 		else {
-			prop= RNA_struct_find_property(&curptr, token);
+			prop = RNA_struct_find_property(&curptr, token);
 		}
 
-		if(token != fixedbuf)
+		if (token != fixedbuf)
 			MEM_freeN(token);
 
-		if(!prop)
+		if (!prop)
 			return 0;
 
-		type= RNA_property_type(prop);
+		type = RNA_property_type(prop);
 
 		/* now look up the value of this property if it is a pointer or
 		 * collection, otherwise return the property rna so that the
 		 * caller can read the value of the property itself */
 		switch (type) {
 		case PROP_POINTER:
-			nextptr= RNA_property_pointer_get(&curptr, prop);
+			nextptr = RNA_property_pointer_get(&curptr, prop);
 
-			if(nextptr.data) {
-				curptr= nextptr;
-				prop= NULL; /* now we have a PointerRNA, the prop is our parent so forget it */
-				if(index) *index= -1;
+			if (nextptr.data) {
+				curptr = nextptr;
+				prop = NULL; /* now we have a PointerRNA, the prop is our parent so forget it */
+				if (index) *index = -1;
 			}
 			else
 				return 0;
 
 			break;
 		case PROP_COLLECTION:
-			if(*path) {
-				if(*path == '[') {
+			if (*path) {
+				if (*path == '[') {
 					/* resolve the lookup with [] brackets */
-					token= rna_path_token(&path, fixedbuf, sizeof(fixedbuf), 1);
+					token = rna_path_token(&path, fixedbuf, sizeof(fixedbuf), 1);
 	
-					if(!token)
+					if (!token)
 						return 0;
 	
 					/* check for "" to see if it is a string */
-					if(rna_token_strip_quotes(token)) {
+					if (rna_token_strip_quotes(token)) {
 						RNA_property_collection_lookup_string(&curptr, prop, token+1, &nextptr);
 					}
 					else {
 						/* otherwise do int lookup */
-						intkey= atoi(token);
-						if(intkey==0 && (token[0] != '0' || token[1] != '\0')) {
+						intkey = atoi(token);
+						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(token != fixedbuf) {
+					if (token != fixedbuf) {
 						MEM_freeN(token);
 					}
 				}
@@ -3672,15 +3689,15 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr,
 					/* ensure we quit on invalid values */
 					nextptr.data = NULL;
 
-					if(RNA_property_collection_type_get(&curptr, prop, &c_ptr)) {
-						nextptr= c_ptr;
+					if (RNA_property_collection_type_get(&curptr, prop, &c_ptr)) {
+						nextptr = c_ptr;
 					}
 				}
 
-				if(nextptr.data) {
-					curptr= nextptr;
-					prop= NULL;  /* now we have a PointerRNA, the prop is our parent so forget it */
-					if(index) *index= -1;
+				if (nextptr.data) {
+					curptr = nextptr;
+					prop = NULL;  /* now we have a PointerRNA, the prop is our parent so forget it */
+					if (index) *index = -1;
 				}
 				else
 					return 0;
@@ -3688,38 +3705,38 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr,
 			
 			break;
 		default:
-			if (index==NULL)
+			if (index == NULL)
 				break;
 
-			*index= -1;
+			*index = -1;
 
 			if (*path) {
-				int index_arr[RNA_MAX_ARRAY_DIMENSION]= {0};
+				int index_arr[RNA_MAX_ARRAY_DIMENSION] = {0};
 				int len[RNA_MAX_ARRAY_DIMENSION];
-				const int dim= RNA_property_array_dimension(&curptr, prop, len);
+				const int dim = RNA_property_array_dimension(&curptr, prop, len);
 				int i, temp_index;
 
-				for(i=0; i<dim; i++) {
-					temp_index= -1; 
+				for (i = 0; i<dim; i++) {
+					temp_index = -1;
 
 					/* multi index resolve */
-					if (*path=='[') {
-						token= rna_path_token(&path, fixedbuf, sizeof(fixedbuf), 1);
+					if (*path =='[') {
+						token = rna_path_token(&path, fixedbuf, sizeof(fixedbuf), 1);
 	
-						if(token==NULL) {
+						if (token == NULL) {
 							/* invalid syntax blah[] */
 							return 0;
 						}
 						/* check for "" to see if it is a string */
-						else if(rna_token_strip_quotes(token)) {
-							temp_index= RNA_property_array_item_index(prop, *(token+1));
+						else if (rna_token_strip_quotes(token)) {
+							temp_index = RNA_property_array_item_index(prop, *(token+1));
 						}
 						else {
 							/* otherwise do int lookup */
-							temp_index= atoi(token);
+							temp_index = atoi(token);
 
-							if(temp_index==0 && (token[0] != '0' || token[1] != '\0')) {
-								if(token != fixedbuf) {
+							if (temp_index == 0 && (token[0] != '0' || token[1] != '\0')) {
+								if (token != fixedbuf) {
 									MEM_freeN(token);
 								}
 
@@ -3727,49 +3744,49 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr,
 							}
 						}
 					}
-					else if(dim==1) {
+					else if (dim == 1) {
 						/* location.x || scale.X, single dimension arrays only */
-						token= rna_path_token(&path, fixedbuf, sizeof(fixedbuf), 0);
-						if(token==NULL) {
+						token = rna_path_token(&path, fixedbuf, sizeof(fixedbuf), 0);
+						if (token == NULL) {
 							/* invalid syntax blah.. */
 							return 0;
 						}
-						temp_index= RNA_property_array_item_index(prop, *token);
+						temp_index = RNA_property_array_item_index(prop, *token);
 					}
 	
-					if(token != fixedbuf) {
+					if (token != fixedbuf) {
 						MEM_freeN(token);
 					}
 					
 					/* out of range */
-					if(temp_index < 0 || temp_index >= len[i])
+					if (temp_index < 0 || temp_index >= len[i])
 						return 0;
 
-					index_arr[i]= temp_index;
+					index_arr[i] = temp_index;
 					/* end multi index resolve */
 				}
 
 				/* arrays always contain numbers so further values are not valid */
-				if(*path) {
+				if (*path) {
 					return 0;
 				}
 				else {
-					int totdim= 1;
-					int flat_index= 0;
+					int totdim = 1;
+					int flat_index = 0;
 
-					for(i=dim-1; i>=0; i--) {
+					for (i = dim-1; i >= 0; i--) {
 						flat_index += index_arr[i] * totdim;
 						totdim *= len[i];
 					}
 
-					*index= flat_index;
+					*index = flat_index;
 				}
 			}
 		}
 	}
 
-	*r_ptr= curptr;
-	*r_prop= prop;
+	*r_ptr = curptr;
+	*r_prop = prop;
 
 	return 1;
 }
@@ -3781,32 +3798,32 @@ char *RNA_path_append(const char *path, PointerRNA *UNUSED(ptr), PropertyRNA *pr
 	const char *s;
 	char appendstr[128], *result;
 	
-	dynstr= BLI_dynstr_new();
+	dynstr = BLI_dynstr_new();
 
 	/* add .identifier */
-	if(path) {
+	if (path) {
 		BLI_dynstr_append(dynstr, (char*)path);
-		if(*path)
+		if (*path)
 			BLI_dynstr_append(dynstr, ".");
 	}
 
 	BLI_dynstr_append(dynstr, RNA_property_identifier(prop));
 
-	if(RNA_property_type(prop) == PROP_COLLECTION) {
+	if (RNA_property_type(prop) == PROP_COLLECTION) {
 		/* add ["strkey"] or [intkey] */
 		BLI_dynstr_append(dynstr, "[");
 
-		if(strkey) {
+		if (strkey) {
 			BLI_dynstr_append(dynstr, "\"");
-			for(s=strkey; *s; s++) {
-				if(*s == '[') {
-					appendstr[0]= '\\';
-					appendstr[1]= *s;
-					appendstr[2]= 0;
+			for (s = strkey; *s; s++) {
+				if (*s == '[') {
+					appendstr[0] = '\\';
+					appendstr[1] = *s;
+					appendstr[2] = 0;
 				}
 				else {
-					appendstr[0]= *s;
-					appendstr[1]= 0;
+					appendstr[0] = *s;
+					appendstr[1] = 0;
 				}
 				BLI_dynstr_append(dynstr, appendstr);
 			}
@@ -3820,7 +3837,7 @@ char *RNA_path_append(const char *path, PointerRNA *UNUSED(ptr), PropertyRNA *pr
 		BLI_dynstr_append(dynstr, "]");
 	}
 
-	result= BLI_dynstr_get_cstring(dynstr);
+	result = BLI_dynstr_get_cstring(dynstr);
 	BLI_dynstr_free(dynstr);
 
 	return result;
@@ -3833,42 +3850,42 @@ char *RNA_path_back(const char *path)
 	char *result, *token;
 	int i;
 
-	if(!path)
+	if (!path)
 		return NULL;
 
-	previous= NULL;
-	current= path;
+	previous = NULL;
+	current = path;
 
 	/* parse token by token until the end, then we back up to the previous
 	 * position and strip of the next token to get the path one step back */
-	while(*current) {
-		token= rna_path_token(&current, fixedbuf, sizeof(fixedbuf), 0);
+	while (*current) {
+		token = rna_path_token(&current, fixedbuf, sizeof(fixedbuf), 0);
 
-		if(!token)
+		if (!token)
 			return NULL;
-		if(token != fixedbuf)
+		if (token != fixedbuf)
 			MEM_freeN(token);
 
 		/* in case of collection we also need to strip off [] */
-		token= rna_path_token(&current, fixedbuf, sizeof(fixedbuf), 1);
-		if(token && token != fixedbuf)
+		token = rna_path_token(&current, fixedbuf, sizeof(fixedbuf), 1);
+		if (token && token != fixedbuf)
 			MEM_freeN(token);
 		
-		if(!*current)
+		if (!*current)
 			break;
 
-		previous= current;
+		previous = current;
 	}
 
-	if(!previous)
+	if (!previous)
 		return NULL;
 
 	/* copy and strip off last token */
-	i= previous - path;
-	result= BLI_strdup(path);
+	i = previous - path;
+	result = BLI_strdup(path);
 
-	if(i > 0 && result[i-1] == '.') i--;
-	result[i]= 0;
+	if (i > 0 && result[i-1] == '.') i--;
+	result[i] = 0;
 
 	return result;
 }
@@ -3885,42 +3902,42 @@ typedef struct IDP_Chain {
 
 static char *rna_idp_path_create(IDP_Chain *child_link)
 {
-	DynStr *dynstr= BLI_dynstr_new();
+	DynStr *dynstr = BLI_dynstr_new();
 	char *path;
-	short first= TRUE;
+	short first = TRUE;
 
-	int tot= 0;
-	IDP_Chain *link= child_link;
+	int tot = 0;
+	IDP_Chain *link = child_link;
 
 	/* reverse the list */
 	IDP_Chain *link_prev;
-	link_prev= NULL;
-	while(link) {
-		IDP_Chain *link_next= link->up;
-		link->up= link_prev;
-		link_prev= link;
-		link= link_next;
+	link_prev = NULL;
+	while (link) {
+		IDP_Chain *link_next = link->up;
+		link->up = link_prev;
+		link_prev = link;
+		link = link_next;
 		tot++;
 	}
 
-	for(link= link_prev; link; link= link->up) {
+	for (link = link_prev; link; link = link->up) {
 		/* pass */
-		if(link->index >= 0) {
+		if (link->index >= 0) {
 			BLI_dynstr_appendf(dynstr, first ? "%s[%d]" : ".%s[%d]", link->name, link->index);
 		}
 		else {
 			BLI_dynstr_appendf(dynstr, first ? "%s" : ".%s", link->name);
 		}
 
-		first= FALSE;
+		first = FALSE;
 	}
 
-	path= BLI_dynstr_get_cstring(dynstr);
+	path = BLI_dynstr_get_cstring(dynstr);
 	BLI_dynstr_free(dynstr);
 
-	if(*path=='\0') {
+	if (*path =='\0') {
 		MEM_freeN(path);
-		path= NULL;
+		path = NULL;
 	}
 
 	return path;
@@ -3928,7 +3945,7 @@ static char *rna_idp_path_create(IDP_Chain *child_link)
 
 static char *rna_idp_path(PointerRNA *ptr, IDProperty *haystack, IDProperty *needle, IDP_Chain *parent_link)
 {
-	char *path= NULL;
+	char *path = NULL;
 	IDP_Chain link;
 
 	IDProperty *iter;
@@ -3936,50 +3953,50 @@ static char *rna_idp_path(PointerRNA *ptr, IDProperty *haystack, IDProperty *nee
 
 	BLI_assert(haystack->type == IDP_GROUP);
 
-	link.up= parent_link;
-	link.name= NULL;
-	link.index= -1;
+	link.up = parent_link;
+	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;
-			path= rna_idp_path_create(&link);
+	for (i = 0, iter = haystack->data.group.first; iter; iter = iter->next, i++) {
+		if (needle == iter) {  /* found! */
+			link.name = iter->name;
+			path = rna_idp_path_create(&link);
 			break;
 		}
 		else {
-			if(iter->type == IDP_GROUP) {
+			if (iter->type == IDP_GROUP) {
 				/* ensure this is RNA */
-				PointerRNA child_ptr= RNA_pointer_get(ptr, iter->name);
-				if(child_ptr.type) {
-					link.name= iter->name;
-					if((path= rna_idp_path(&child_ptr, iter, needle, &link))) {
+				PointerRNA child_ptr = RNA_pointer_get(ptr, iter->name);
+				if (child_ptr.type) {
+					link.name = iter->name;
+					if ((path = rna_idp_path(&child_ptr, iter, needle, &link))) {
 						break;
 					}
 				}
 			}
 			else if (iter->type == IDP_IDPARRAY) {
-				PropertyRNA *prop= RNA_struct_find_property(ptr, iter->name);
-				if(prop && prop->type == PROP_COLLECTION) {
-					IDProperty *array= IDP_IDPArray(iter);
-					if(needle >= array && needle < (iter->len + array)) { /* found! */
-						link.name= iter->name;
-						link.index= (int)(needle - array);
-						path= rna_idp_path_create(&link);
+				PropertyRNA *prop = RNA_struct_find_property(ptr, iter->name);
+				if (prop && prop->type == PROP_COLLECTION) {
+					IDProperty *array = IDP_IDPArray(iter);
+					if (needle >= array && needle < (iter->len + array)) { /* found! */
+						link.name = iter->name;
+						link.index = (int)(needle - array);
+						path = rna_idp_path_create(&link);
 						break;
 					}
 					else {
 						int i;
-						link.name= iter->name;
-						for(i= 0; i < iter->len; i++, array++) {
+						link.name = iter->name;
+						for (i = 0; i < iter->len; i++, array++) {
 							PointerRNA child_ptr;
-							if(RNA_property_collection_lookup_int(ptr, prop, i, &child_ptr)) {
-								link.index= i;
-								if((path= rna_idp_path(&child_ptr, array, needle, &link))) {
+							if (RNA_property_collection_lookup_int(ptr, prop, i, &child_ptr)) {
+								link.index = i;
+								if ((path = rna_idp_path(&child_ptr, array, needle, &link))) {
 									break;
 								}
 							}
 						}
-						if(path)
+						if (path)
 							break;
 					}
 				}
@@ -3999,12 +4016,13 @@ static char *rna_path_from_ID_to_idpgroup(PointerRNA *ptr)
 	BLI_assert(ptr->id.data != NULL);
 
 	/* TODO, Support Bones/PoseBones. no pointers stored to the bones from here, only the ID. See example in [#25746]
-	 * unless this is added only way to find this is to also search all bones and pose bones of an armature or object */
+	 *       Unless this is added only way to find this is to also search all bones and pose bones
+	 *       of an armature or object */
 	RNA_id_pointer_create(ptr->id.data, &id_ptr);
 
-	haystack= RNA_struct_idprops(&id_ptr, FALSE);
-	if(haystack) { /* can fail when called on bones */
-		needle= ptr->data;
+	haystack = RNA_struct_idprops(&id_ptr, FALSE);
+	if (haystack) { /* can fail when called on bones */
+		needle = ptr->data;
 		return rna_idp_path(&id_ptr, haystack, needle, NULL);
 	}
 	else {
@@ -4014,30 +4032,30 @@ static char *rna_path_from_ID_to_idpgroup(PointerRNA *ptr)
 
 char *RNA_path_from_ID_to_struct(PointerRNA *ptr)
 {
-	char *ptrpath=NULL;
+	char *ptrpath = NULL;
 
-	if(!ptr->id.data || !ptr->data)
+	if (!ptr->id.data || !ptr->data)
 		return NULL;
 	
-	if(!RNA_struct_is_ID(ptr->type)) {
-		if(ptr->type->path) {
+	if (!RNA_struct_is_ID(ptr->type)) {
+		if (ptr->type->path) {
 			/* if type has a path to some ID, use it */
-			ptrpath= ptr->type->path(ptr);
+			ptrpath = ptr->type->path(ptr);
 		}
-		else if(ptr->type->nested && RNA_struct_is_ID(ptr->type->nested)) {
+		else if (ptr->type->nested && RNA_struct_is_ID(ptr->type->nested)) {
 			PointerRNA parentptr;
 			PropertyRNA *userprop;
 			
-			/* find the property in the struct we're nested in that references this struct, and 
+			/* find the property in the struct we're nested in that references this struct, and
 			 * use its identifier as the first part of the path used...
 			 */
 			RNA_id_pointer_create(ptr->id.data, &parentptr);
-			userprop= RNA_struct_find_nested(&parentptr, ptr->type); 
+			userprop = RNA_struct_find_nested(&parentptr, ptr->type);
 			
-			if(userprop)
-				ptrpath= BLI_strdup(RNA_property_identifier(userprop));
+			if (userprop)
+				ptrpath = BLI_strdup(RNA_property_identifier(userprop));
 			else
-				return NULL; // can't do anything about this case yet...
+				return NULL; /* can't do anything about this case yet... */
 		}
 		else if (RNA_struct_is_a(ptr->type, &RNA_PropertyGroup)) {
 			/* special case, easier to deal with here then in ptr->type->path() */
@@ -4056,23 +4074,23 @@ char *RNA_path_from_ID_to_property(PointerRNA *ptr, PropertyRNA *prop)
 	const char *propname;
 	char *ptrpath, *path;
 
-	if(!ptr->id.data || !ptr->data || !prop)
+	if (!ptr->id.data || !ptr->data || !prop)
 		return NULL;
 	
 	/* path from ID to the struct holding this property */
-	ptrpath= RNA_path_from_ID_to_struct(ptr);
+	ptrpath = RNA_path_from_ID_to_struct(ptr);
 
-	propname= RNA_property_identifier(prop);
+	propname = RNA_property_identifier(prop);
 
-	if(ptrpath) {
-		path= BLI_sprintfN(is_rna ? "%s.%s":"%s[\"%s\"]", ptrpath, propname);
+	if (ptrpath) {
+		path = BLI_sprintfN(is_rna ? "%s.%s":"%s[\"%s\"]", ptrpath, propname);
 		MEM_freeN(ptrpath);
 	}
 	else {
-		if(is_rna)
-			path= BLI_strdup(propname);
+		if (is_rna)
+			path = BLI_strdup(propname);
 		else
-			path= BLI_sprintfN("[\"%s\"]", propname);
+			path = BLI_sprintfN("[\"%s\"]", propname);
 	}
 
 	return path;
@@ -4082,9 +4100,9 @@ char *RNA_path_from_ID_to_property(PointerRNA *ptr, PropertyRNA *prop)
 
 int RNA_boolean_get(PointerRNA *ptr, const char *name)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop) {
+	if (prop) {
 		return RNA_property_boolean_get(ptr, prop);
 	}
 	else {
@@ -4095,9 +4113,9 @@ int RNA_boolean_get(PointerRNA *ptr, const char *name)
 
 void RNA_boolean_set(PointerRNA *ptr, const char *name, int value)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop)
+	if (prop)
 		RNA_property_boolean_set(ptr, prop, value);
 	else
 		printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4105,9 +4123,9 @@ void RNA_boolean_set(PointerRNA *ptr, const char *name, int value)
 
 void RNA_boolean_get_array(PointerRNA *ptr, const char *name, int *values)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop)
+	if (prop)
 		RNA_property_boolean_get_array(ptr, prop, values);
 	else
 		printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4115,9 +4133,9 @@ void RNA_boolean_get_array(PointerRNA *ptr, const char *name, int *values)
 
 void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const int *values)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop)
+	if (prop)
 		RNA_property_boolean_set_array(ptr, prop, values);
 	else
 		printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4125,9 +4143,9 @@ void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const int *values)
 
 int RNA_int_get(PointerRNA *ptr, const char *name)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop) {
+	if (prop) {
 		return RNA_property_int_get(ptr, prop);
 	}
 	else {
@@ -4138,9 +4156,9 @@ int RNA_int_get(PointerRNA *ptr, const char *name)
 
 void RNA_int_set(PointerRNA *ptr, const char *name, int value)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop)
+	if (prop)
 		RNA_property_int_set(ptr, prop, value);
 	else
 		printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4148,9 +4166,9 @@ void RNA_int_set(PointerRNA *ptr, const char *name, int value)
 
 void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop)
+	if (prop)
 		RNA_property_int_get_array(ptr, prop, values);
 	else
 		printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4158,9 +4176,9 @@ void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values)
 
 void RNA_int_set_array(PointerRNA *ptr, const char *name, const int *values)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop)
+	if (prop)
 		RNA_property_int_set_array(ptr, prop, values);
 	else
 		printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4168,9 +4186,9 @@ void RNA_int_set_array(PointerRNA *ptr, const char *name, const int *values)
 
 float RNA_float_get(PointerRNA *ptr, const char *name)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop) {
+	if (prop) {
 		return RNA_property_float_get(ptr, prop);
 	}
 	else {
@@ -4181,9 +4199,9 @@ float RNA_float_get(PointerRNA *ptr, const char *name)
 
 void RNA_float_set(PointerRNA *ptr, const char *name, float value)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop)
+	if (prop)
 		RNA_property_float_set(ptr, prop, value);
 	else
 		printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4191,9 +4209,9 @@ void RNA_float_set(PointerRNA *ptr, const char *name, float value)
 
 void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop)
+	if (prop)
 		RNA_property_float_get_array(ptr, prop, values);
 	else
 		printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4201,9 +4219,9 @@ void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
 
 void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop)
+	if (prop)
 		RNA_property_float_set_array(ptr, prop, values);
 	else
 		printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4211,9 +4229,9 @@ void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
 
 int RNA_enum_get(PointerRNA *ptr, const char *name)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop) {
+	if (prop) {
 		return RNA_property_enum_get(ptr, prop);
 	}
 	else {
@@ -4224,9 +4242,9 @@ int RNA_enum_get(PointerRNA *ptr, const char *name)
 
 void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop)
+	if (prop)
 		RNA_property_enum_set(ptr, prop, value);
 	else
 		printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4234,11 +4252,11 @@ void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
 
 void RNA_enum_set_identifier(PointerRNA *ptr, const char *name, const char *id)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop) {
+	if (prop) {
 		int value;
-		if(RNA_property_enum_value(NULL, ptr, prop, id, &value))
+		if (RNA_property_enum_value(NULL, ptr, prop, id, &value))
 			RNA_property_enum_set(ptr, prop, value);
 		else
 			printf("%s: %s.%s has no enum id '%s'.\n", __func__, ptr->type->identifier, name, id);
@@ -4250,18 +4268,18 @@ void RNA_enum_set_identifier(PointerRNA *ptr, const char *name, const char *id)
 
 int RNA_enum_is_equal(bContext *C, PointerRNA *ptr, const char *name, const char *enumname)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 	EnumPropertyItem *item;
 	int free;
 
-	if(prop) {
+	if (prop) {
 		RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
 
-		for(; item->identifier; item++)
-			if(strcmp(item->identifier, enumname) == 0)
+		for (; item->identifier; item++)
+			if (strcmp(item->identifier, enumname) == 0)
 				return (item->value == RNA_property_enum_get(ptr, prop));
 
-		if(free)
+		if (free)
 			MEM_freeN(item);
 
 		printf("%s: %s.%s item %s not found.\n", __func__, ptr->type->identifier, name, enumname);
@@ -4275,9 +4293,9 @@ int RNA_enum_is_equal(bContext *C, PointerRNA *ptr, const char *name, const char
 
 int RNA_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int *value)
 {
-	for( ; item->identifier; item++) {
-		if(strcmp(item->identifier, identifier)==0) {
-			*value= item->value;
+	for ( ; item->identifier; item++) {
+		if (strcmp(item->identifier, identifier) == 0) {
+			*value = item->value;
 			return 1;
 		}
 	}
@@ -4287,9 +4305,9 @@ int RNA_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int *
 
 int	RNA_enum_id_from_value(EnumPropertyItem *item, int value, const char **identifier)
 {
-	for( ; item->identifier; item++) {
-		if(item->value==value) {
-			*identifier= item->identifier;
+	for ( ; item->identifier; item++) {
+		if (item->value == value) {
+			*identifier = item->identifier;
 			return 1;
 		}
 	}
@@ -4299,8 +4317,8 @@ int	RNA_enum_id_from_value(EnumPropertyItem *item, int value, const char **ident
 
 int RNA_enum_icon_from_value(EnumPropertyItem *item, int value, int *icon)
 {
-	for( ; item->identifier; item++) {
-		if(item->value==value) {
+	for ( ; item->identifier; item++) {
+		if (item->value == value) {
 			*icon = item->icon;
 			return 1;
 		}
@@ -4311,22 +4329,22 @@ int RNA_enum_icon_from_value(EnumPropertyItem *item, int value, int *icon)
 
 void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop) {
+	if (prop) {
 		RNA_property_string_get(ptr, prop, value);
 	}
 	else {
 		printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
-		value[0]= '\0';
+		value[0] = '\0';
 	}
 }
 
 char *RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, int fixedlen)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop) {
+	if (prop) {
 		return RNA_property_string_get_alloc(ptr, prop, fixedbuf, fixedlen, NULL); /* TODO, pass length */
 	}
 	else {
@@ -4337,9 +4355,9 @@ char *RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, in
 
 int RNA_string_length(PointerRNA *ptr, const char *name)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop) {
+	if (prop) {
 		return RNA_property_string_length(ptr, prop);
 	}
 	else {
@@ -4350,9 +4368,9 @@ int RNA_string_length(PointerRNA *ptr, const char *name)
 
 void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop)
+	if (prop)
 		RNA_property_string_set(ptr, prop, value);
 	else
 		printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4360,9 +4378,9 @@ void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
 
 PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop) {
+	if (prop) {
 		return RNA_property_pointer_get(ptr, prop);
 	}
 	else {
@@ -4374,9 +4392,9 @@ PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
 
 void RNA_pointer_set(PointerRNA *ptr, const char *name, PointerRNA ptr_value)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop) {
+	if (prop) {
 		RNA_property_pointer_set(ptr, prop, ptr_value);
 	}
 	else {
@@ -4386,9 +4404,9 @@ void RNA_pointer_set(PointerRNA *ptr, const char *name, PointerRNA ptr_value)
 
 void RNA_pointer_add(PointerRNA *ptr, const char *name)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop)
+	if (prop)
 		RNA_property_pointer_add(ptr, prop);
 	else
 		printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4396,9 +4414,9 @@ void RNA_pointer_add(PointerRNA *ptr, const char *name)
 
 void RNA_collection_begin(PointerRNA *ptr, const char *name, CollectionPropertyIterator *iter)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop)
+	if (prop)
 		RNA_property_collection_begin(ptr, prop, iter);
 	else
 		printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4406,9 +4424,9 @@ void RNA_collection_begin(PointerRNA *ptr, const char *name, CollectionPropertyI
 
 void RNA_collection_add(PointerRNA *ptr, const char *name, PointerRNA *r_value)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop)
+	if (prop)
 		RNA_property_collection_add(ptr, prop, r_value);
 	else
 		printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4416,9 +4434,9 @@ void RNA_collection_add(PointerRNA *ptr, const char *name, PointerRNA *r_value)
 
 void RNA_collection_clear(PointerRNA *ptr, const char *name)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop)
+	if (prop)
 		RNA_property_collection_clear(ptr, prop);
 	else
 		printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
@@ -4426,9 +4444,9 @@ void RNA_collection_clear(PointerRNA *ptr, const char *name)
 
 int RNA_collection_length(PointerRNA *ptr, const char *name)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, name);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, name);
 
-	if(prop) {
+	if (prop) {
 		return RNA_property_collection_length(ptr, prop);
 	}
 	else {
@@ -4439,7 +4457,7 @@ int RNA_collection_length(PointerRNA *ptr, const char *name)
 
 int RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
 {
-	if(prop->flag & PROP_IDPROPERTY) {
+	if (prop->flag & PROP_IDPROPERTY) {
 		IDProperty *idprop = rna_idproperty_find(ptr, prop->identifier);
 		return ((idprop != NULL) && !(idprop->flag & IDP_FLAG_GHOST));
 	}
@@ -4450,9 +4468,9 @@ int RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
 
 int RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, identifier);
+	PropertyRNA *prop = RNA_struct_find_property(ptr, identifier);
 
-	if(prop) {
+	if (prop) {
 		return RNA_property_is_set(ptr, prop);
 	}
 	else {
@@ -4464,7 +4482,7 @@ int RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
 
 int RNA_property_is_idprop(PropertyRNA *prop)
 {
-	return (prop->magic!=RNA_MAGIC);
+	return (prop->magic != RNA_MAGIC);
 }
 
 /* string representation of a property, python
@@ -4472,7 +4490,7 @@ int RNA_property_is_idprop(PropertyRNA *prop)
  * context may be NULL */
 char *RNA_pointer_as_string(bContext *C, PointerRNA *ptr)
 {
-	DynStr *dynstr= BLI_dynstr_new();
+	DynStr *dynstr = BLI_dynstr_new();
 	char *cstring;
 	
 	const char *propname;
@@ -4483,12 +4501,12 @@ char *RNA_pointer_as_string(bContext *C, PointerRNA *ptr)
 	RNA_STRUCT_BEGIN(ptr, prop) {
 		propname = RNA_property_identifier(prop);
 		
-		if(strcmp(propname, "rna_type")==0)
+		if (strcmp(propname, "rna_type") == 0)
 			continue;
 		
-		if(first_time==0)
+		if (first_time == 0)
 			BLI_dynstr_append(dynstr, ", ");
-		first_time= 0;
+		first_time = 0;
 		
 		cstring = RNA_property_as_string(C, ptr, prop);
 		BLI_dynstr_appendf(dynstr, "\"%s\":%s", propname, cstring);
@@ -4496,7 +4514,7 @@ char *RNA_pointer_as_string(bContext *C, PointerRNA *ptr)
 	}
 	RNA_STRUCT_END;
 
-	BLI_dynstr_append(dynstr, "}");	
+	BLI_dynstr_append(dynstr, "}");
 	
 	
 	cstring = BLI_dynstr_get_cstring(dynstr);
@@ -4504,56 +4522,169 @@ char *RNA_pointer_as_string(bContext *C, PointerRNA *ptr)
 	return cstring;
 }
 
+
+/* context and ptr_default can be NULL */
+char *RNA_pointer_as_string_keywords_ex(bContext *C, PointerRNA *ptr, PointerRNA *ptr_default,
+                                        const short as_function, const short all_args,
+                                        PropertyRNA *iterprop)
+{
+	const char *arg_name = NULL;
+
+	PropertyRNA *prop;
+
+	DynStr *dynstr = BLI_dynstr_new();
+	char *cstring, *buf;
+	int first_iter = TRUE, ok = TRUE;
+	int flag;
+
+	/* only to get the orginal props for comparisons */
+	PropertyRNA *prop_default;
+	char *buf_default;
+
+	RNA_PROP_BEGIN(ptr, propptr, iterprop) {
+		prop = propptr.data;
+
+		flag = RNA_property_flag(prop);
+
+		if (as_function && (flag & PROP_OUTPUT)) {
+			continue;
+		}
+
+		arg_name = RNA_property_identifier(prop);
+
+		if (strcmp(arg_name, "rna_type") == 0) {
+			continue;
+		}
+
+		if (as_function && (flag & PROP_REQUIRED)) {
+			/* required args don't have useful defaults */
+			BLI_dynstr_appendf(dynstr, first_iter ? "%s":", %s", arg_name);
+			first_iter = FALSE;
+		}
+		else {
+			if (as_function && RNA_property_type(prop) == PROP_POINTER) {
+				/* don't expand pointers for functions */
+				if (flag & PROP_NEVER_NULL) {
+					/* we cant really do the right thing here. arg=arg?, hrmf! */
+					buf = BLI_strdup(arg_name);
+				}
+				else {
+					buf = BLI_strdup("None");
+				}
+			}
+			else {
+				buf = RNA_property_as_string(C, ptr, prop);
+			}
+
+			ok = TRUE;
+
+			if (all_args == FALSE && ptr_default) {
+				/* not verbose, so only add in attributes that use non-default values
+				 * slow but good for tooltips */
+				prop_default = RNA_struct_find_property(ptr_default, arg_name);
+
+				if (prop_default) {
+					buf_default = RNA_property_as_string(C, ptr_default, prop_default);
+
+					if (strcmp(buf, buf_default) == 0)
+						ok = FALSE; /* values match, don't bother printing */
+
+					MEM_freeN(buf_default);
+				}
+			}
+			if (ok) {
+				BLI_dynstr_appendf(dynstr, first_iter ? "%s=%s":", %s=%s", arg_name, buf);
+				first_iter = FALSE;
+			}
+
+			MEM_freeN(buf);
+		}
+	}
+	RNA_PROP_END;
+
+	cstring = BLI_dynstr_get_cstring(dynstr);
+	BLI_dynstr_free(dynstr);
+	return cstring;
+}
+
+char *RNA_pointer_as_string_keywords(bContext *C, PointerRNA *ptr, PointerRNA *ptr_default,
+                                     const short as_function, const short all_args)
+{
+	PropertyRNA *iterprop;
+
+	iterprop = RNA_struct_iterator_property(ptr->type);
+
+	return RNA_pointer_as_string_keywords_ex(C, ptr, ptr_default, as_function, all_args,
+	                                         iterprop);
+}
+
+char *RNA_function_as_string_keywords(bContext *C, FunctionRNA *func, PointerRNA *ptr_default,
+                                     const short as_function, const short all_args)
+{
+	PointerRNA funcptr;
+	PropertyRNA *iterprop;
+
+	RNA_pointer_create(NULL, &RNA_Function, func, &funcptr);
+
+	iterprop = RNA_struct_find_property(&funcptr, "parameters");
+
+	RNA_struct_iterator_property(funcptr.type);
+
+	return RNA_pointer_as_string_keywords_ex(C, &funcptr, ptr_default, as_function, all_args,
+	                                         iterprop);
+}
+
 char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
 {
 	int type = RNA_property_type(prop);
 	int len = RNA_property_array_length(ptr, prop);
 	int i;
 
-	DynStr *dynstr= BLI_dynstr_new();
+	DynStr *dynstr = BLI_dynstr_new();
 	char *cstring;
 	
 
 	/* see if we can coorce into a python type - PropertyType */
 	switch (type) {
 	case PROP_BOOLEAN:
-		if(len==0) {
+		if (len == 0) {
 			BLI_dynstr_append(dynstr, RNA_property_boolean_get(ptr, prop) ? "True" : "False");
 		}
 		else {
 			BLI_dynstr_append(dynstr, "(");
-			for(i=0; i<len; i++) {
-				BLI_dynstr_appendf(dynstr, i?", %s":"%s", RNA_property_boolean_get_index(ptr, prop, i) ? "True" : "False");
+			for (i = 0; i<len; i++) {
+				BLI_dynstr_appendf(dynstr, i ? ", %s" : "%s",
+				                   RNA_property_boolean_get_index(ptr, prop, i) ? "True" : "False");
 			}
-			if(len==1)
+			if (len == 1)
 				BLI_dynstr_append(dynstr, ","); /* otherwise python wont see it as a tuple */
 			BLI_dynstr_append(dynstr, ")");
 		}
 		break;
 	case PROP_INT:
-		if(len==0) {
+		if (len == 0) {
 			BLI_dynstr_appendf(dynstr, "%d", RNA_property_int_get(ptr, prop));
 		}
 		else {
 			BLI_dynstr_append(dynstr, "(");
-			for(i=0; i<len; i++) {
+			for (i = 0; i<len; i++) {
 				BLI_dynstr_appendf(dynstr, i?", %d":"%d", RNA_property_int_get_index(ptr, prop, i));
 			}
-			if(len==1)
+			if (len == 1)
 				BLI_dynstr_append(dynstr, ","); /* otherwise python wont see it as a tuple */
 			BLI_dynstr_append(dynstr, ")");
 		}
 		break;
 	case PROP_FLOAT:
-		if(len==0) {
+		if (len == 0) {
 			BLI_dynstr_appendf(dynstr, "%g", RNA_property_float_get(ptr, prop));
 		}
 		else {
 			BLI_dynstr_append(dynstr, "(");
-			for(i=0; i<len; i++) {
+			for (i = 0; i<len; i++) {
 				BLI_dynstr_appendf(dynstr, i?", %g":"%g", RNA_property_float_get_index(ptr, prop, i));
 			}
-			if(len==1)
+			if (len == 1)
 				BLI_dynstr_append(dynstr, ","); /* otherwise python wont see it as a tuple */
 			BLI_dynstr_append(dynstr, ")");
 		}
@@ -4564,9 +4695,9 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
 		char *buf;
 		int length;
 
-		length= RNA_property_string_length(ptr, prop);
-		buf= MEM_mallocN(sizeof(char)*(length+1), "RNA_property_as_string");
-		buf_esc= MEM_mallocN(sizeof(char)*(length*2+1), "RNA_property_as_string esc");
+		length = RNA_property_string_length(ptr, prop);
+		buf = MEM_mallocN(sizeof(char)*(length+1), "RNA_property_as_string");
+		buf_esc = MEM_mallocN(sizeof(char)*(length*2+1), "RNA_property_as_string esc");
 		RNA_property_string_get(ptr, prop, buf);
 		BLI_strescape(buf_esc, buf, length*2+1);
 		MEM_freeN(buf);
@@ -4576,35 +4707,41 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
 	}
 	case PROP_ENUM:
 	{
-		/* string arrays dont exist */
+		/* string arrays don't exist */
 		const char *identifier;
 		int val = RNA_property_enum_get(ptr, prop);
 
-		if(RNA_property_flag(prop) & PROP_ENUM_FLAG) {
+		if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
 			/* represent as a python set */
-			EnumPropertyItem *item= NULL;
-			int free;
-
-			BLI_dynstr_append(dynstr, "{");
-
-			RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
-			if(item) {
-				short is_first= TRUE;
-				for (; item->identifier; item++) {
-					if(item->identifier[0] && item->value & val) {
-						BLI_dynstr_appendf(dynstr, is_first ? "'%s'" : ", '%s'", item->identifier);
-						is_first= FALSE;
+			if (val) {
+				EnumPropertyItem *item = NULL;
+				int free;
+
+				BLI_dynstr_append(dynstr, "{");
+
+				RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
+				if (item) {
+					short is_first = TRUE;
+					for (; item->identifier; item++) {
+						if (item->identifier[0] && item->value & val) {
+							BLI_dynstr_appendf(dynstr, is_first ? "'%s'" : ", '%s'", item->identifier);
+							is_first = FALSE;
+						}
 					}
-				}
 
-				if(free) {
-					MEM_freeN(item);
+					if (free) {
+						MEM_freeN(item);
+					}
 				}
-			}
 
-			BLI_dynstr_append(dynstr, "}");
+				BLI_dynstr_append(dynstr, "}");
+			}
+			else {
+				/* annoying exception, don't confuse with dictionary syntax above: {} */
+				BLI_dynstr_append(dynstr, "set()");
+			}
 		}
-		else if(RNA_property_enum_identifier(C, ptr, prop, val, &identifier)) {
+		else if (RNA_property_enum_identifier(C, ptr, prop, val, &identifier)) {
 			BLI_dynstr_appendf(dynstr, "'%s'", identifier);
 		}
 		else {
@@ -4614,8 +4751,8 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
 	}
 	case PROP_POINTER:
 	{
-		PointerRNA tptr= RNA_property_pointer_get(ptr, prop);
-		cstring= RNA_pointer_as_string(C, &tptr);
+		PointerRNA tptr = RNA_property_pointer_get(ptr, prop);
+		cstring = RNA_pointer_as_string(C, &tptr);
 		BLI_dynstr_append(dynstr, cstring);
 		MEM_freeN(cstring);
 		break;
@@ -4626,15 +4763,16 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
 		CollectionPropertyIterator collect_iter;
 		BLI_dynstr_append(dynstr, "[");
 		
-		for(RNA_property_collection_begin(ptr, prop, &collect_iter); collect_iter.valid; RNA_property_collection_next(&collect_iter)) {
-			PointerRNA itemptr= collect_iter.ptr;
+		for (RNA_property_collection_begin(ptr, prop, &collect_iter); collect_iter.valid;
+		     RNA_property_collection_next(&collect_iter)) {
+			PointerRNA itemptr = collect_iter.ptr;
 			
-			if(first_time==0)
+			if (first_time == 0)
 				BLI_dynstr_append(dynstr, ", ");
-			first_time= 0;
+			first_time = 0;
 			
 			/* now get every prop of the collection */
-			cstring= RNA_pointer_as_string(C, &itemptr);
+			cstring = RNA_pointer_as_string(C, &itemptr);
 			BLI_dynstr_append(dynstr, cstring);
 			MEM_freeN(cstring);
 		}
@@ -4696,58 +4834,58 @@ ParameterList *RNA_parameter_list_create(ParameterList *parms, PointerRNA *UNUSE
 {
 	PropertyRNA *parm;
 	void *data;
-	int alloc_size= 0, size;
+	int alloc_size = 0, size;
 
-	parms->arg_count= 0;
-	parms->ret_count= 0;
+	parms->arg_count = 0;
+	parms->ret_count = 0;
 
 	/* allocate data */
-	for(parm= func->cont.properties.first; parm; parm= parm->next) {
+	for (parm = func->cont.properties.first; parm; parm = parm->next) {
 		alloc_size += rna_parameter_size_alloc(parm);
 
-		if(parm->flag & PROP_OUTPUT)
+		if (parm->flag & PROP_OUTPUT)
 			parms->ret_count++;
 		else
 			parms->arg_count++;
 	}
 
-	parms->data= MEM_callocN(alloc_size, "RNA_parameter_list_create");
-	parms->func= func;
-	parms->alloc_size= alloc_size;
+	parms->data = MEM_callocN(alloc_size, "RNA_parameter_list_create");
+	parms->func = func;
+	parms->alloc_size = alloc_size;
 
 	/* set default values */
-	data= parms->data;
+	data = parms->data;
 
-	for(parm= func->cont.properties.first; parm; parm= parm->next) {
-		size= rna_parameter_size(parm);
+	for (parm = func->cont.properties.first; parm; parm = parm->next) {
+		size = rna_parameter_size(parm);
 
 		/* set length to 0, these need to be set later, see bpy_array.c's py_to_array */
 		if (parm->flag & PROP_DYNAMIC) {
-			ParameterDynAlloc *data_alloc= data;
-			data_alloc->array_tot= 0;
-			data_alloc->array= NULL;
+			ParameterDynAlloc *data_alloc = data;
+			data_alloc->array_tot = 0;
+			data_alloc->array = NULL;
 		}
 		
-		if(!(parm->flag & PROP_REQUIRED) && !(parm->flag & PROP_DYNAMIC)) {
-			switch(parm->type) {
+		if (!(parm->flag & PROP_REQUIRED) && !(parm->flag & PROP_DYNAMIC)) {
+			switch (parm->type) {
 				case PROP_BOOLEAN:
-					if(parm->arraydimension) memcpy(data, ((BoolPropertyRNA*)parm)->defaultarray, size);
+					if (parm->arraydimension) memcpy(data, ((BoolPropertyRNA*)parm)->defaultarray, size);
 					else memcpy(data, &((BoolPropertyRNA*)parm)->defaultvalue, size);
 					break;
 				case PROP_INT:
-					if(parm->arraydimension) memcpy(data, ((IntPropertyRNA*)parm)->defaultarray, size);
+					if (parm->arraydimension) memcpy(data, ((IntPropertyRNA*)parm)->defaultarray, size);
 					else memcpy(data, &((IntPropertyRNA*)parm)->defaultvalue, size);
 					break;
 				case PROP_FLOAT:
-					if(parm->arraydimension) memcpy(data, ((FloatPropertyRNA*)parm)->defaultarray, size);
+					if (parm->arraydimension) memcpy(data, ((FloatPropertyRNA*)parm)->defaultarray, size);
 					else memcpy(data, &((FloatPropertyRNA*)parm)->defaultvalue, size);
 					break;
 				case PROP_ENUM:
 					memcpy(data, &((EnumPropertyRNA*)parm)->defaultvalue, size);
 					break;
 				case PROP_STRING: {
-					const char *defvalue= ((StringPropertyRNA*)parm)->defaultvalue;
-					if(defvalue && defvalue[0]) {
+					const char *defvalue = ((StringPropertyRNA*)parm)->defaultvalue;
+					if (defvalue && defvalue[0]) {
 						/* causes bug [#29988], possibly this is only correct for thick wrapped
 						 * need to look further into it - campbell */
 #if 0
@@ -4764,7 +4902,7 @@ ParameterList *RNA_parameter_list_create(ParameterList *parms, PointerRNA *UNUSE
 			}
 		}
 
-		data= ((char*)data) + rna_parameter_size_alloc(parm);
+		data = ((char*)data) + rna_parameter_size_alloc(parm);
 	}
 
 	return parms;
@@ -4775,24 +4913,24 @@ void RNA_parameter_list_free(ParameterList *parms)
 	PropertyRNA *parm;
 	int tot;
 
-	parm= parms->func->cont.properties.first;
-	for(tot= 0; parm; parm= parm->next) {
-		if(parm->type == PROP_COLLECTION)
+	parm = parms->func->cont.properties.first;
+	for (tot = 0; parm; parm = parm->next) {
+		if (parm->type == PROP_COLLECTION)
 			BLI_freelistN((ListBase*)((char*)parms->data+tot));
 		else if (parm->flag & PROP_DYNAMIC) {
 			/* for dynamic arrays and strings, data is a pointer to an array */
-			ParameterDynAlloc *data_alloc= (void *)(((char *)parms->data) + tot);
-			if(data_alloc->array)
+			ParameterDynAlloc *data_alloc = (void *)(((char *)parms->data) + tot);
+			if (data_alloc->array)
 				MEM_freeN(data_alloc->array);
 		}
 
-		tot+= rna_parameter_size_alloc(parm);
+		tot += rna_parameter_size_alloc(parm);
 	}
 
 	MEM_freeN(parms->data);
-	parms->data= NULL;
+	parms->data = NULL;
 
-	parms->func= NULL;
+	parms->func = NULL;
 }
 
 int  RNA_parameter_list_size(ParameterList *parms)
@@ -4815,26 +4953,26 @@ void RNA_parameter_list_begin(ParameterList *parms, ParameterIterator *iter)
 	/* may be useful but unused now */
 	/* RNA_pointer_create(NULL, &RNA_Function, parms->func, &iter->funcptr); */ /*UNUSED*/
 
-	iter->parms= parms;
-	iter->parm= parms->func->cont.properties.first;
-	iter->valid= iter->parm != NULL;
-	iter->offset= 0;
+	iter->parms = parms;
+	iter->parm = parms->func->cont.properties.first;
+	iter->valid = iter->parm != NULL;
+	iter->offset = 0;
 
-	if(iter->valid) {
-		iter->size= rna_parameter_size_alloc(iter->parm);
-		iter->data= (((char*)iter->parms->data)); /* +iter->offset, always 0 */
+	if (iter->valid) {
+		iter->size = rna_parameter_size_alloc(iter->parm);
+		iter->data = (((char*)iter->parms->data)); /* +iter->offset, always 0 */
 	}
 }
 
 void RNA_parameter_list_next(ParameterIterator *iter)
 {
-	iter->offset+= iter->size;
-	iter->parm= iter->parm->next;
-	iter->valid= iter->parm != NULL;
+	iter->offset += iter->size;
+	iter->parm = iter->parm->next;
+	iter->valid = iter->parm != NULL;
 
-	if(iter->valid) {
-		iter->size= rna_parameter_size_alloc(iter->parm);
-		iter->data= (((char*)iter->parms->data)+iter->offset);
+	if (iter->valid) {
+		iter->size = rna_parameter_size_alloc(iter->parm);
+		iter->data = (((char*)iter->parms->data)+iter->offset);
 	}
 }
 
@@ -4849,14 +4987,14 @@ void RNA_parameter_get(ParameterList *parms, PropertyRNA *parm, void **value)
 
 	RNA_parameter_list_begin(parms, &iter);
 
-	for(; iter.valid; RNA_parameter_list_next(&iter))
-		if(iter.parm==parm) 
+	for (; iter.valid; RNA_parameter_list_next(&iter))
+		if (iter.parm == parm)
 			break;
 
-	if(iter.valid)
-		*value= iter.data;
+	if (iter.valid)
+		*value = iter.data;
 	else
-		*value= NULL;
+		*value = NULL;
 
 	RNA_parameter_list_end(&iter);
 }
@@ -4865,12 +5003,12 @@ void RNA_parameter_get_lookup(ParameterList *parms, const char *identifier, void
 {
 	PropertyRNA *parm;
 
-	parm= parms->func->cont.properties.first;
-	for(; parm; parm= parm->next)
-		if(strcmp(RNA_property_identifier(parm), identifier)==0)
+	parm = parms->func->cont.properties.first;
+	for (; parm; parm = parm->next)
+		if (strcmp(RNA_property_identifier(parm), identifier) == 0)
 			break;
 
-	if(parm)
+	if (parm)
 		RNA_parameter_get(parms, parm, value);
 }
 
@@ -4880,11 +5018,11 @@ void RNA_parameter_set(ParameterList *parms, PropertyRNA *parm, const void *valu
 
 	RNA_parameter_list_begin(parms, &iter);
 
-	for(; iter.valid; RNA_parameter_list_next(&iter))
-		if(iter.parm==parm) 
+	for (; iter.valid; RNA_parameter_list_next(&iter))
+		if (iter.parm == parm)
 			break;
 
-	if(iter.valid)
+	if (iter.valid)
 		memcpy(iter.data, value, iter.size);
 
 	RNA_parameter_list_end(&iter);
@@ -4894,28 +5032,28 @@ void RNA_parameter_set_lookup(ParameterList *parms, const char *identifier, cons
 {
 	PropertyRNA *parm;
 
-	parm= parms->func->cont.properties.first;
-	for(; parm; parm= parm->next)
-		if(strcmp(RNA_property_identifier(parm), identifier)==0)
+	parm = parms->func->cont.properties.first;
+	for (; parm; parm = parm->next)
+		if (strcmp(RNA_property_identifier(parm), identifier) == 0)
 			break;
 
-	if(parm)
+	if (parm)
 		RNA_parameter_set(parms, parm, value);
 }
 
 int RNA_parameter_length_get(ParameterList *parms, PropertyRNA *parm)
 {
 	ParameterIterator iter;
-	int len= 0;
+	int len = 0;
 
 	RNA_parameter_list_begin(parms, &iter);
 
-	for(; iter.valid; RNA_parameter_list_next(&iter))
-		if(iter.parm==parm)
+	for (; iter.valid; RNA_parameter_list_next(&iter))
+		if (iter.parm == parm)
 			break;
 
-	if(iter.valid)
-		len= RNA_parameter_length_get_data(parms, parm, iter.data);
+	if (iter.valid)
+		len = RNA_parameter_length_get_data(parms, parm, iter.data);
 
 	RNA_parameter_list_end(&iter);
 
@@ -4928,11 +5066,11 @@ void RNA_parameter_length_set(ParameterList *parms, PropertyRNA *parm, int lengt
 
 	RNA_parameter_list_begin(parms, &iter);
 
-	for(; iter.valid; RNA_parameter_list_next(&iter))
-		if(iter.parm==parm)
+	for (; iter.valid; RNA_parameter_list_next(&iter))
+		if (iter.parm == parm)
 			break;
 
-	if(iter.valid)
+	if (iter.valid)
 		RNA_parameter_length_set_data(parms, parm, iter.data, length);
 
 	RNA_parameter_list_end(&iter);
@@ -4945,12 +5083,12 @@ int RNA_parameter_length_get_data(ParameterList *UNUSED(parms), PropertyRNA *UNU
 
 void RNA_parameter_length_set_data(ParameterList *UNUSED(parms), PropertyRNA *UNUSED(parm), void *data, int length)
 {
-	*((int *)data)= length;
+	*((int *)data) = length;
 }
 
 int RNA_function_call(bContext *C, ReportList *reports, PointerRNA *ptr, FunctionRNA *func, ParameterList *parms)
 {
-	if(func->call) {
+	if (func->call) {
 		func->call(C, reports, ptr, parms);
 
 		return 0;
@@ -4959,45 +5097,48 @@ int RNA_function_call(bContext *C, ReportList *reports, PointerRNA *ptr, Functio
 	return -1;
 }
 
-int RNA_function_call_lookup(bContext *C, ReportList *reports, PointerRNA *ptr, const char *identifier, ParameterList *parms)
+int RNA_function_call_lookup(bContext *C, ReportList *reports, PointerRNA *ptr, const char *identifier,
+                             ParameterList *parms)
 {
 	FunctionRNA *func;
 
-	func= RNA_struct_find_function(ptr, identifier);
+	func = RNA_struct_find_function(ptr, identifier);
 
-	if(func)
+	if (func)
 		return RNA_function_call(C, reports, ptr, func, parms);
 
 	return -1;
 }
 
-int RNA_function_call_direct(bContext *C, ReportList *reports, PointerRNA *ptr, FunctionRNA *func, const char *format, ...)
+int RNA_function_call_direct(bContext *C, ReportList *reports, PointerRNA *ptr, FunctionRNA *func,
+                             const char *format, ...)
 {
 	va_list args;
 	int ret;
 
 	va_start(args, format);
 
-	ret= RNA_function_call_direct_va(C, reports, ptr, func, format, args);
+	ret = RNA_function_call_direct_va(C, reports, ptr, func, format, args);
 
 	va_end(args);
 
 	return ret;
 }
 
-int RNA_function_call_direct_lookup(bContext *C, ReportList *reports, PointerRNA *ptr, const char *identifier, const char *format, ...)
+int RNA_function_call_direct_lookup(bContext *C, ReportList *reports, PointerRNA *ptr, const char *identifier,
+                                    const char *format, ...)
 {
 	FunctionRNA *func;
 
-	func= RNA_struct_find_function(ptr, identifier);
+	func = RNA_struct_find_function(ptr, identifier);
 
-	if(func) {
+	if (func) {
 		va_list args;
 		int ret;
 
 		va_start(args, format);
 
-		ret= RNA_function_call_direct_va(C, reports, ptr, func, format, args);
+		ret = RNA_function_call_direct_va(C, reports, ptr, func, format, args);
 
 		va_end(args);
 
@@ -5010,15 +5151,15 @@ int RNA_function_call_direct_lookup(bContext *C, ReportList *reports, PointerRNA
 static int rna_function_format_array_length(const char *format, int ofs, int flen)
 {
 	char lenbuf[16];
-	int idx= 0;
+	int idx = 0;
 
-	if (format[ofs++]=='[')
-		for (; ofs<flen && format[ofs]!=']' && idx<sizeof(*lenbuf)-1; idx++, ofs++)
-			lenbuf[idx]= format[ofs];
+	if (format[ofs++] =='[')
+		for (; ofs<flen && format[ofs] !=']' && idx<sizeof(*lenbuf)-1; idx++, ofs++)
+			lenbuf[idx] = format[ofs];
 
-	if (ofs<flen && format[ofs+1]==']') {
+	if (ofs<flen && format[ofs+1] ==']') {
 		/* XXX put better error reporting for ofs>=flen or idx over lenbuf capacity */
-		lenbuf[idx]= '\0';
+		lenbuf[idx] = '\0';
 		return atoi(lenbuf);
 	}
 
@@ -5034,13 +5175,13 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
 	switch (type) {
 	case PROP_BOOLEAN:
 		{
-			if (ftype!='b') {
+			if (ftype !='b') {
 				fprintf(stderr, "%s.%s: wrong type for parameter %s, a boolean was expected\n", tid, fid, pid);
 				return -1;
 			}
 
-			if (len==0)
-				*((int*)dest)= *((int*)src);
+			if (len == 0)
+				*((int*)dest) = *((int*)src);
 			else
 				memcpy(dest, src, len*sizeof(int));
 
@@ -5048,13 +5189,13 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
 		}
 	case PROP_INT:
 		{
-			if (ftype!='i') {
+			if (ftype !='i') {
 				fprintf(stderr, "%s.%s: wrong type for parameter %s, an integer was expected\n", tid, fid, pid);
 				return -1;
 			}
 
-			if (len==0)
-				*((int*)dest)= *((int*)src);
+			if (len == 0)
+				*((int*)dest) = *((int*)src);
 			else
 				memcpy(dest, src, len*sizeof(int));
 
@@ -5062,13 +5203,13 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
 		}
 	case PROP_FLOAT:
 		{
-			if (ftype!='f') {
+			if (ftype !='f') {
 				fprintf(stderr, "%s.%s: wrong type for parameter %s, a float was expected\n", tid, fid, pid);
 				return -1;
 			}
 
-			if (len==0)
-				*((float*)dest)= *((float*)src);
+			if (len == 0)
+				*((float*)dest) = *((float*)src);
 			else
 				memcpy(dest, src, len*sizeof(float));
 
@@ -5076,23 +5217,23 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
 		}
 	case PROP_STRING:
 		{
-			if (ftype!='s') {
+			if (ftype !='s') {
 				fprintf(stderr, "%s.%s: wrong type for parameter %s, a string was expected\n", tid, fid, pid);
 				return -1;
 			}
 
-			*((char**)dest)= *((char**)src);
+			*((char**)dest) = *((char**)src);
 
 			break;
 		}
 	case PROP_ENUM:
 		{
-			if (ftype!='e') {
+			if (ftype !='e') {
 				fprintf(stderr, "%s.%s: wrong type for parameter %s, an enum was expected\n", tid, fid, pid);
 				return -1;
 			}
 
-			*((int*)dest)= *((int*)src);
+			*((int*)dest) = *((int*)src);
 
 			break;
 		}
@@ -5100,26 +5241,26 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
 		{
 			StructRNA *ptype;
 
-			if (ftype!='O') {
+			if (ftype !='O') {
 				fprintf(stderr, "%s.%s: wrong type for parameter %s, an object was expected\n", tid, fid, pid);
 				return -1;
 			}
 
-			ptype= RNA_property_pointer_type(ptr, prop);
+			ptype = RNA_property_pointer_type(ptr, prop);
 
-			if(prop->flag & PROP_RNAPTR) {
-				*((PointerRNA*)dest)= *((PointerRNA*)src);
+			if (prop->flag & PROP_RNAPTR) {
+				*((PointerRNA*)dest) = *((PointerRNA*)src);
 				break;
 			 }
 			
-			if (ptype!=srna && !RNA_struct_is_a(srna, ptype)) {
+			if (ptype != srna && !RNA_struct_is_a(srna, ptype)) {
 				fprintf(stderr, "%s.%s: wrong type for parameter %s, "
 				        "an object of type %s was expected, passed an object of type %s\n",
 				        tid, fid, pid, RNA_struct_identifier(ptype), RNA_struct_identifier(srna));
 				return -1;
 			}
  
-			*((void**)dest)= *((void**)src);
+			*((void**)dest) = *((void**)src);
 
 			break;
 		}
@@ -5130,16 +5271,16 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
 			Link *link;
 			CollectionPointerLink *clink;
 
-			if (ftype!='C') {
+			if (ftype !='C') {
 				fprintf(stderr, "%s.%s: wrong type for parameter %s, a collection was expected\n", tid, fid, pid);
 				return -1;
 			}
 
-			lb= (ListBase *)src;
-			clb= (ListBase *)dest;
-			ptype= RNA_property_pointer_type(ptr, prop);
+			lb = (ListBase *)src;
+			clb = (ListBase *)dest;
+			ptype = RNA_property_pointer_type(ptr, prop);
 			
-			if (ptype!=srna && !RNA_struct_is_a(srna, ptype)) {
+			if (ptype != srna && !RNA_struct_is_a(srna, ptype)) {
 				fprintf(stderr, "%s.%s: wrong type for parameter %s, "
 				        "a collection of objects of type %s was expected, "
 				        "passed a collection of objects of type %s\n",
@@ -5147,17 +5288,17 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
 				return -1;
 			}
 
-			for (link= lb->first; link; link= link->next) {
-				clink= MEM_callocN(sizeof(CollectionPointerLink), "CCollectionPointerLink");
+			for (link = lb->first; link; link = link->next) {
+				clink = MEM_callocN(sizeof(CollectionPointerLink), "CCollectionPointerLink");
 				RNA_pointer_create(NULL, srna, link, &clink->ptr);
 				BLI_addtail(clb, clink);
 			}
 
 			break;
 		}
-	default: 
+	default:
 		{
-			if (len==0)
+			if (len == 0)
 				fprintf(stderr, "%s.%s: unknown type for parameter %s\n", tid, fid, pid);
 			else
 				fprintf(stderr, "%s.%s: unknown array type for parameter %s\n", tid, fid, pid);
@@ -5169,45 +5310,46 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
 	return 0;
 }
 
-int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *ptr, FunctionRNA *func, const char *format, va_list args)
+int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *ptr, FunctionRNA *func,
+                                const char *format, va_list args)
 {
 	PointerRNA funcptr;
 	ParameterList parms;
 	ParameterIterator iter;
 	PropertyRNA *pret, *parm;
 	PropertyType type;
-	int i, ofs, flen, flag, len, alen, err= 0;
-	const char *tid, *fid, *pid=NULL;
+	int i, ofs, flen, flag, len, alen, err = 0;
+	const char *tid, *fid, *pid = NULL;
 	char ftype;
-	void **retdata=NULL;
+	void **retdata = NULL;
 
 	RNA_pointer_create(NULL, &RNA_Function, func, &funcptr);
 
-	tid= RNA_struct_identifier(ptr->type);
-	fid= RNA_function_identifier(func);
-	pret= func->c_ret;
-	flen= strlen(format);
+	tid = RNA_struct_identifier(ptr->type);
+	fid = RNA_function_identifier(func);
+	pret = func->c_ret;
+	flen = strlen(format);
 
 	RNA_parameter_list_create(&parms, ptr, func);
 	RNA_parameter_list_begin(&parms, &iter);
 
-	for(i= 0, ofs= 0; iter.valid; RNA_parameter_list_next(&iter), i++) {
-		parm= iter.parm;
-		flag= RNA_property_flag(parm);
+	for (i = 0, ofs = 0; iter.valid; RNA_parameter_list_next(&iter), i++) {
+		parm = iter.parm;
+		flag = RNA_property_flag(parm);
 
-		if(parm==pret) {
-			retdata= iter.data;
+		if (parm == pret) {
+			retdata = iter.data;
 			continue;
 		}
 		else if (flag & PROP_OUTPUT) {
 			continue;
 		}
 
-		pid= RNA_property_identifier(parm);
+		pid = RNA_property_identifier(parm);
 
-		if (ofs>=flen || format[ofs]=='N') {
+		if (ofs >= flen || format[ofs] =='N') {
 			if (flag & PROP_REQUIRED) {
-				err= -1;
+				err = -1;
 				fprintf(stderr, "%s.%s: missing required parameter %s\n", tid, fid, pid);
 				break;
 			}
@@ -5215,13 +5357,13 @@ int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *pt
 			continue;
 		}
 
-		type= RNA_property_type(parm);
-		ftype= format[ofs++];
-		len= RNA_property_array_length(&funcptr, parm);
-		alen= rna_function_format_array_length(format, ofs, flen);
+		type = RNA_property_type(parm);
+		ftype = format[ofs++];
+		len = RNA_property_array_length(&funcptr, parm);
+		alen = rna_function_format_array_length(format, ofs, flen);
 
-		if (len!=alen) {
-			err= -1;
+		if (len != alen) {
+			err = -1;
 			fprintf(stderr, "%s.%s: for parameter %s, "
 			        "was expecting an array of %i elements, "
 			        "passed %i elements instead\n",
@@ -5234,62 +5376,68 @@ int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *pt
 		case PROP_INT:
 		case PROP_ENUM:
 			{
-				int arg= va_arg(args, int);
-				err= rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg, NULL, tid, fid, pid);
+				int arg = va_arg(args, int);
+				err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg,
+				                                   NULL, tid, fid, pid);
 				break;
 			}
 		case PROP_FLOAT:
 			{
-				double arg= va_arg(args, double);
-				err= rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg, NULL, tid, fid, pid);
+				double arg = va_arg(args, double);
+				err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg,
+				                                   NULL, tid, fid, pid);
 				break;
 			}
 		case PROP_STRING:
 			{
-				char *arg= va_arg(args, char*);
-				err= rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg, NULL, tid, fid, pid);
+				char *arg = va_arg(args, char*);
+				err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg,
+				                                   NULL, tid, fid, pid);
 				break;
 			}
 		case PROP_POINTER:
 			{
-				StructRNA *srna= va_arg(args, StructRNA*);
-				void *arg= va_arg(args, void*);
-				err= rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg, srna, tid, fid, pid);
+				StructRNA *srna = va_arg(args, StructRNA*);
+				void *arg = va_arg(args, void*);
+				err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg,
+				                                   srna, tid, fid, pid);
 				break;
 			}
 		case PROP_COLLECTION:
 			{
-				StructRNA *srna= va_arg(args, StructRNA*);
-				ListBase *arg= va_arg(args, ListBase*);
-				err= rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg, srna, tid, fid, pid);
+				StructRNA *srna = va_arg(args, StructRNA*);
+				ListBase *arg = va_arg(args, ListBase*);
+				err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg,
+				                                   srna, tid, fid, pid);
 				break;
 			}
 		default:
 			{
 				/* handle errors */
-				err= rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, NULL, NULL, tid, fid, pid);
+				err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, NULL,
+				                                   NULL, tid, fid, pid);
 				break;
 			}
 		}
 
-		if (err!=0)
+		if (err != 0)
 			break;
 	}
 
-	if (err==0)
-		err= RNA_function_call(C, reports, ptr, func, &parms);
+	if (err == 0)
+		err = RNA_function_call(C, reports, ptr, func, &parms);
 
 	/* XXX throw error when more parameters than those needed are passed or leave silent? */
-	if (err==0 && pret && ofs<flen && format[ofs++]=='R') {
-		parm= pret;
+	if (err == 0 && pret && ofs<flen && format[ofs++] =='R') {
+		parm = pret;
 
-		type= RNA_property_type(parm);
-		ftype= format[ofs++];
-		len= RNA_property_array_length(&funcptr, parm);
-		alen= rna_function_format_array_length(format, ofs, flen);
+		type = RNA_property_type(parm);
+		ftype = format[ofs++];
+		len = RNA_property_array_length(&funcptr, parm);
+		alen = rna_function_format_array_length(format, ofs, flen);
 
-		if (len!=alen) {
-			err= -1;
+		if (len != alen) {
+			err = -1;
 			fprintf(stderr, "%s.%s: for return parameter %s, "
 			        "was expecting an array of %i elements, passed %i elements instead\n",
 			        tid, fid, pid, len, alen);
@@ -5300,40 +5448,46 @@ int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *pt
 			case PROP_INT:
 			case PROP_ENUM:
 				{
-					int *arg= va_arg(args, int*);
-					err= rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata, NULL, tid, fid, pid);
+					int *arg = va_arg(args, int*);
+					err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
+					                                   NULL, tid, fid, pid);
 					break;
 				}
 			case PROP_FLOAT:
 				{
-					float *arg= va_arg(args, float*);
-					err= rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata, NULL, tid, fid, pid);
+					float *arg = va_arg(args, float*);
+					err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
+					                                   NULL, tid, fid, pid);
 					break;
 				}
 			case PROP_STRING:
 				{
-					char **arg= va_arg(args, char**);
-					err= rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata, NULL, tid, fid, pid);
+					char **arg = va_arg(args, char**);
+					err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
+					                                   NULL, tid, fid, pid);
 					break;
 				}
 			case PROP_POINTER:
 				{
-					StructRNA *srna= va_arg(args, StructRNA*);
-					void **arg= va_arg(args, void**);
-					err= rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata, srna, tid, fid, pid);
+					StructRNA *srna = va_arg(args, StructRNA*);
+					void **arg = va_arg(args, void**);
+					err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
+					                                   srna, tid, fid, pid);
 					break;
 				}
 			case PROP_COLLECTION:
 				{
-					StructRNA *srna= va_arg(args, StructRNA*);
-					ListBase **arg= va_arg(args, ListBase**);
-					err= rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata, srna, tid, fid, pid);
+					StructRNA *srna = va_arg(args, StructRNA*);
+					ListBase **arg = va_arg(args, ListBase**);
+					err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
+					                                   srna, tid, fid, pid);
 					break;
-				}			
+				}
 			default:
 				{
 					/* handle errors */
-					err= rna_function_parameter_parse(&funcptr, parm, type, ftype, len, NULL, NULL, NULL, tid, fid, pid);
+					err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, NULL, NULL,
+					                                   NULL, tid, fid, pid);
 					break;
 				}
 			}
@@ -5351,9 +5505,9 @@ int RNA_function_call_direct_va_lookup(bContext *C, ReportList *reports, Pointer
 {
 	FunctionRNA *func;
 
-	func= RNA_struct_find_function(ptr, identifier);
+	func = RNA_struct_find_function(ptr, identifier);
 
-	if(func)
+	if (func)
 		return RNA_function_call_direct_va(C, reports, ptr, func, format, args);
 
 	return 0;
@@ -5364,14 +5518,14 @@ int RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index)
 	int len;
 
 	/* get the length of the array to work with */
-	len= RNA_property_array_length(ptr, prop);
+	len = RNA_property_array_length(ptr, prop);
 	
 	/* get and set the default values as appropriate for the various types */
 	switch (RNA_property_type(prop)) {
 		case PROP_BOOLEAN:
 			if (len) {
 				if (index == -1) {
-					int *tmparray= MEM_callocN(sizeof(int)*len, "reset_defaults - boolean");
+					int *tmparray = MEM_callocN(sizeof(int)*len, "reset_defaults - boolean");
 					
 					RNA_property_boolean_get_default_array(ptr, prop, tmparray);
 					RNA_property_boolean_set_array(ptr, prop, tmparray);
@@ -5379,19 +5533,19 @@ int RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index)
 					MEM_freeN(tmparray);
 				}
 				else {
-					int value= RNA_property_boolean_get_default_index(ptr, prop, index);
+					int value = RNA_property_boolean_get_default_index(ptr, prop, index);
 					RNA_property_boolean_set_index(ptr, prop, index, value);
 				}
 			}
 			else {
-				int value= RNA_property_boolean_get_default(ptr, prop);
+				int value = RNA_property_boolean_get_default(ptr, prop);
 				RNA_property_boolean_set(ptr, prop, value);
 			}
 			return 1;
 		case PROP_INT:
 			if (len) {
 				if (index == -1) {
-					int *tmparray= MEM_callocN(sizeof(int)*len, "reset_defaults - int");
+					int *tmparray = MEM_callocN(sizeof(int)*len, "reset_defaults - int");
 					
 					RNA_property_int_get_default_array(ptr, prop, tmparray);
 					RNA_property_int_set_array(ptr, prop, tmparray);
@@ -5399,19 +5553,19 @@ int RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index)
 					MEM_freeN(tmparray);
 				}
 				else {
-					int value= RNA_property_int_get_default_index(ptr, prop, index);
+					int value = RNA_property_int_get_default_index(ptr, prop, index);
 					RNA_property_int_set_index(ptr, prop, index, value);
 				}
 			}
 			else {
-				int value= RNA_property_int_get_default(ptr, prop);
+				int value = RNA_property_int_get_default(ptr, prop);
 				RNA_property_int_set(ptr, prop, value);
 			}
 			return 1;
 		case PROP_FLOAT:
 			if (len) {
 				if (index == -1) {
-					float *tmparray= MEM_callocN(sizeof(float)*len, "reset_defaults - float");
+					float *tmparray = MEM_callocN(sizeof(float)*len, "reset_defaults - float");
 					
 					RNA_property_float_get_default_array(ptr, prop, tmparray);
 					RNA_property_float_set_array(ptr, prop, tmparray);
@@ -5419,25 +5573,25 @@ int RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index)
 					MEM_freeN(tmparray);
 				}
 				else {
-					float value= RNA_property_float_get_default_index(ptr, prop, index);
+					float value = RNA_property_float_get_default_index(ptr, prop, index);
 					RNA_property_float_set_index(ptr, prop, index, value);
 				}
 			}
 			else {
-				float value= RNA_property_float_get_default(ptr, prop);
+				float value = RNA_property_float_get_default(ptr, prop);
 				RNA_property_float_set(ptr, prop, value);
 			}
 			return 1;
 		case PROP_ENUM:
 		{
-			int value= RNA_property_enum_get_default(ptr, prop);
+			int value = RNA_property_enum_get_default(ptr, prop);
 			RNA_property_enum_set(ptr, prop, value);
 			return 1;
 		}
 		
 		case PROP_STRING:
 		{
-			char *value= RNA_property_string_get_default_alloc(ptr, prop, NULL, 0);
+			char *value = RNA_property_string_get_default_alloc(ptr, prop, NULL, 0);
 			RNA_property_string_set(ptr, prop, value);
 			MEM_freeN(value);
 			return 1;
@@ -5445,13 +5599,13 @@ int RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index)
 		
 		case PROP_POINTER:
 		{
-			PointerRNA value= RNA_property_pointer_get_default(ptr, prop);
+			PointerRNA value = RNA_property_pointer_get_default(ptr, prop);
 			RNA_property_pointer_set(ptr, prop, value);
 			return 1;
 		}
 		
-		default: 
-			// FIXME: are there still any cases that haven't been handled? comment out "default" block to check :)
+		default:
+			/* FIXME: are there still any cases that haven't been handled? comment out "default" block to check :) */
 			return 0;
 	}
 }
@@ -5461,10 +5615,10 @@ int RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, i
 	int len, fromlen;
 
 	/* get the length of the array to work with */
-	len= RNA_property_array_length(ptr, prop);
-	fromlen= RNA_property_array_length(ptr, prop);
+	len = RNA_property_array_length(ptr, prop);
+	fromlen = RNA_property_array_length(ptr, prop);
 
-	if(len != fromlen)
+	if (len != fromlen)
 		return 0;
 	
 	/* get and set the default values as appropriate for the various types */
@@ -5472,7 +5626,7 @@ int RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, i
 		case PROP_BOOLEAN:
 			if (len) {
 				if (index == -1) {
-					int *tmparray= MEM_callocN(sizeof(int)*len, "copy - boolean");
+					int *tmparray = MEM_callocN(sizeof(int)*len, "copy - boolean");
 					
 					RNA_property_boolean_get_array(fromptr, prop, tmparray);
 					RNA_property_boolean_set_array(ptr, prop, tmparray);
@@ -5480,19 +5634,19 @@ int RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, i
 					MEM_freeN(tmparray);
 				}
 				else {
-					int value= RNA_property_boolean_get_index(fromptr, prop, index);
+					int value = RNA_property_boolean_get_index(fromptr, prop, index);
 					RNA_property_boolean_set_index(ptr, prop, index, value);
 				}
 			}
 			else {
-				int value= RNA_property_boolean_get(fromptr, prop);
+				int value = RNA_property_boolean_get(fromptr, prop);
 				RNA_property_boolean_set(ptr, prop, value);
 			}
 			return 1;
 		case PROP_INT:
 			if (len) {
 				if (index == -1) {
-					int *tmparray= MEM_callocN(sizeof(int)*len, "copy - int");
+					int *tmparray = MEM_callocN(sizeof(int)*len, "copy - int");
 					
 					RNA_property_int_get_array(fromptr, prop, tmparray);
 					RNA_property_int_set_array(ptr, prop, tmparray);
@@ -5500,19 +5654,19 @@ int RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, i
 					MEM_freeN(tmparray);
 				}
 				else {
-					int value= RNA_property_int_get_index(fromptr, prop, index);
+					int value = RNA_property_int_get_index(fromptr, prop, index);
 					RNA_property_int_set_index(ptr, prop, index, value);
 				}
 			}
 			else {
-				int value= RNA_property_int_get(fromptr, prop);
+				int value = RNA_property_int_get(fromptr, prop);
 				RNA_property_int_set(ptr, prop, value);
 			}
 			return 1;
 		case PROP_FLOAT:
 			if (len) {
 				if (index == -1) {
-					float *tmparray= MEM_callocN(sizeof(float)*len, "copy - float");
+					float *tmparray = MEM_callocN(sizeof(float)*len, "copy - float");
 					
 					RNA_property_float_get_array(fromptr, prop, tmparray);
 					RNA_property_float_set_array(ptr, prop, tmparray);
@@ -5520,30 +5674,30 @@ int RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, i
 					MEM_freeN(tmparray);
 				}
 				else {
-					float value= RNA_property_float_get_index(fromptr, prop, index);
+					float value = RNA_property_float_get_index(fromptr, prop, index);
 					RNA_property_float_set_index(ptr, prop, index, value);
 				}
 			}
 			else {
-				float value= RNA_property_float_get(fromptr, prop);
+				float value = RNA_property_float_get(fromptr, prop);
 				RNA_property_float_set(ptr, prop, value);
 			}
 			return 1;
 		case PROP_ENUM:
 		{
-			int value= RNA_property_enum_get(fromptr, prop);
+			int value = RNA_property_enum_get(fromptr, prop);
 			RNA_property_enum_set(ptr, prop, value);
 			return 1;
 		}
 		case PROP_POINTER:
 		{
-			PointerRNA value= RNA_property_pointer_get(fromptr, prop);
+			PointerRNA value = RNA_property_pointer_get(fromptr, prop);
 			RNA_property_pointer_set(ptr, prop, value);
 			return 1;
 		}
 		case PROP_STRING:
 		{
-			char *value= RNA_property_string_get_alloc(fromptr, prop, NULL, 0, NULL);
+			char *value = RNA_property_string_get_alloc(fromptr, prop, NULL, 0, NULL);
 			RNA_property_string_set(ptr, prop, value);
 			MEM_freeN(value);
 			return 1;
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index 82a7d27..1159a1b 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -50,17 +50,17 @@
 
 static void rna_ActionGroup_channels_next(CollectionPropertyIterator *iter)
 {
-	ListBaseIterator *internal= iter->internal;
-	FCurve *fcu= (FCurve*)internal->link;
-	bActionGroup *grp= fcu->grp;
+	ListBaseIterator *internal = iter->internal;
+	FCurve *fcu = (FCurve*)internal->link;
+	bActionGroup *grp = fcu->grp;
 	
 	/* only continue if the next F-Curve (if existant) belongs in the same group */
 	if ((fcu->next) && (fcu->next->grp == grp))
-		internal->link= (Link*)fcu->next;
+		internal->link = (Link*)fcu->next;
 	else
-		internal->link= NULL;
+		internal->link = NULL;
 		
-	iter->valid= (internal->link != NULL);
+	iter->valid = (internal->link != NULL);
 }
 
 static bActionGroup *rna_Action_groups_new(bAction *act, const char name[])
@@ -79,8 +79,8 @@ static void rna_Action_groups_remove(bAction *act, ReportList *reports, bActionG
 	}
 
 	/* 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;
+	for (fcu = agrp->channels.first; (fcu) && (fcu->grp == agrp); fcu = fcn) {
+		fcn = fcu->next;
 		
 		/* remove from group */
 		action_groups_remove_channel(act, fcu);
@@ -90,12 +90,13 @@ static void rna_Action_groups_remove(bAction *act, ReportList *reports, bActionG
 	}
 	
 	/* XXX, invalidates PyObject */
-	MEM_freeN(agrp); 
+	MEM_freeN(agrp);
 }
 
-static FCurve *rna_Action_fcurve_new(bAction *act, ReportList *reports, const char *data_path, int index, const char *group)
+static FCurve *rna_Action_fcurve_new(bAction *act, ReportList *reports, const char *data_path,
+                                     int index, const char *group)
 {
-	if (group && group[0]=='\0') group= NULL;
+	if (group && group[0] =='\0') group = NULL;
 
 	if (data_path[0] == '\0') {
 		BKE_report(reports, RPT_ERROR, "F-Curve data path empty, invalid argument");
@@ -104,7 +105,8 @@ static FCurve *rna_Action_fcurve_new(bAction *act, ReportList *reports, const ch
 
 	/* annoying, check if this exists */
 	if (verify_fcurve(act, group, data_path, index, 0)) {
-		BKE_reportf(reports, RPT_ERROR, "F-Curve '%s[%d]' already exists in action '%s'", data_path, index, act->id.name+2);
+		BKE_reportf(reports, RPT_ERROR, "F-Curve '%s[%d]' already exists in action '%s'", data_path,
+		            index, act->id.name+2);
 		return NULL;
 	}
 	return verify_fcurve(act, group, data_path, index, 1);
@@ -114,7 +116,8 @@ static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, FCurve *
 {
 	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'", fcu->grp->name, act->id.name+2);
+			BKE_reportf(reports, RPT_ERROR, "F-Curve's ActionGroup '%s' not found in action '%s'",
+			            fcu->grp->name, act->id.name+2);
 			return;
 		}
 		
@@ -135,8 +138,8 @@ static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, FCurve *
 static TimeMarker *rna_Action_pose_markers_new(bAction *act, const char name[])
 {
 	TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
-	marker->flag= 1;
-	marker->frame= 1;
+	marker->flag = 1;
+	marker->frame = 1;
 	BLI_strncpy_utf8(marker->name, name, sizeof(marker->name));
 	BLI_addtail(&act->markers, marker);
 	return marker;
@@ -155,35 +158,35 @@ static void rna_Action_pose_markers_remove(bAction *act, ReportList *reports, Ti
 
 static PointerRNA rna_Action_active_pose_marker_get(PointerRNA *ptr)
 {
-	bAction *act= (bAction*)ptr->data;
+	bAction *act = (bAction*)ptr->data;
 	return rna_pointer_inherit_refine(ptr, &RNA_TimelineMarker, BLI_findlink(&act->markers, act->active_marker-1));
 }
 
 static void rna_Action_active_pose_marker_set(PointerRNA *ptr, PointerRNA value)
 {
-	bAction *act= (bAction*)ptr->data;
-	act->active_marker= BLI_findindex(&act->markers, value.data) + 1;
+	bAction *act = (bAction*)ptr->data;
+	act->active_marker = BLI_findindex(&act->markers, value.data) + 1;
 }
 
 static int rna_Action_active_pose_marker_index_get(PointerRNA *ptr)
 {
-	bAction *act= (bAction*)ptr->data;
+	bAction *act = (bAction*)ptr->data;
 	return MAX2(act->active_marker-1, 0);
 }
 
 static void rna_Action_active_pose_marker_index_set(PointerRNA *ptr, int value)
 {
-	bAction *act= (bAction*)ptr->data;
-	act->active_marker= value+1;
+	bAction *act = (bAction*)ptr->data;
+	act->active_marker = value+1;
 }
 
-static void rna_Action_active_pose_marker_index_range(PointerRNA *ptr, int *min, int *max)
+static void rna_Action_active_pose_marker_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
 {
-	bAction *act= (bAction*)ptr->data;
+	bAction *act = (bAction*)ptr->data;
 
-	*min= 0;
-	*max= BLI_countlist(&act->markers)-1;
-	*max= MAX2(0, *max);
+	*min = 0;
+	*max = BLI_countlist(&act->markers)-1;
+	*max = MAX2(0, *max);
 }
 
 
@@ -202,7 +205,7 @@ int rna_Action_id_poll(PointerRNA *ptr, PointerRNA value)
 	bAction *act = (bAction *)value.id.data;
 	
 	if (act) {
-		/* there can still be actions that will have undefined id-root 
+		/* there can still be actions that will have undefined id-root
 		 * (i.e. floating "action-library" members) which we will not
 		 * be able to resolve an idroot for automatically, so let these through
 		 */
@@ -222,7 +225,7 @@ int rna_Action_actedit_assign_poll(PointerRNA *ptr, PointerRNA value)
 	bAction *act = (bAction *)value.id.data;
 	
 	if (act) {
-		/* there can still be actions that will have undefined id-root 
+		/* there can still be actions that will have undefined id-root
 		 * (i.e. floating "action-library" members) which we will not
 		 * be able to resolve an idroot for automatically, so let these through
 		 */
@@ -251,173 +254,181 @@ static void rna_def_dopesheet(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "DopeSheet", NULL);
+	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");
 	
 	/* Source of DopeSheet data */
-	// XXX: make this obsolete?
-	prop= RNA_def_property(srna, "source", PROP_POINTER, PROP_NONE);
+	/* 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)");
+	RNA_def_property_ui_text(prop, "Source",
+	                         "ID-Block representing source data, currently ID_SCE (for Dopesheet), "
+	                         "and ID_SC (for Grease Pencil)");
 	
 	/* Show datablock filters */
-	prop= RNA_def_property(srna, "show_datablock_filters", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_datablock_filters", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ADS_FLAG_SHOW_DBFILTERS);
-	RNA_def_property_ui_text(prop, "Show Datablock Filters", "Show options for whether channels related to certain types of data are included");
+	RNA_def_property_ui_text(prop, "Show Datablock Filters",
+	                         "Show options for whether channels related to certain types of data are included");
 	RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, -1);
 	RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN, NULL);
 	
 	/* General Filtering Settings */
-	prop= RNA_def_property(srna, "show_only_selected", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_only_selected", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_ONLYSEL);
 	RNA_def_property_ui_text(prop, "Only Selected", "Only include channels relating to selected objects and data");
 	RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 0);
 	RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "show_hidden", PROP_BOOLEAN, PROP_NONE);
+	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_icon(prop, ICON_GHOST_ENABLED, 0);
 	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);
+	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");
+	RNA_def_property_ui_text(prop, "Only Objects in 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);
+	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_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
 	
 	/* FCurve Display Name Search Settings */
-	prop= RNA_def_property(srna, "show_only_matching_fcurves", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_only_matching_fcurves", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_BY_FCU_NAME);
-	RNA_def_property_ui_text(prop, "Only Matching F-Curves", "Only include F-Curves with names containing search text");
+	RNA_def_property_ui_text(prop, "Only Matching F-Curves",
+	                         "Only include F-Curves with names containing search text");
 	RNA_def_property_ui_icon(prop, ICON_VIEWZOOM, 0);
 	RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "filter_fcurve_name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "filter_fcurve_name", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "searchstr");
 	RNA_def_property_ui_text(prop, "F-Curve Name Filter", "F-Curve live filtering string");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
 	
 	/* NLA Specific Settings */
-	prop= RNA_def_property(srna, "show_missing_nla", PROP_BOOLEAN, PROP_NONE);
+	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)");
+	RNA_def_property_ui_text(prop, "Include Missing NLA",
+	                         "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);
+	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_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);
+	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)");
+	RNA_def_property_ui_text(prop, "Collapse Summary",
+	                         "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);
 	
 	
 	/* General DataType Filtering Settings */
-	prop= RNA_def_property(srna, "show_transforms", PROP_BOOLEAN, PROP_NONE);
+	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)");
-	RNA_def_property_ui_icon(prop, ICON_MANIPUL, 0); // XXX?
+	RNA_def_property_ui_text(prop, "Display 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);
+	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_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);
+	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_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);
+	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_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);
+	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_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);
+	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_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);
+	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_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);
+	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_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);
+	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_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);
+	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_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);
+	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_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);
+	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_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);
+	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_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);
+	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_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);
+	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_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);
+	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_icon(prop, ICON_SPEAKER, 0);
@@ -429,11 +440,11 @@ static void rna_def_action_group(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "ActionGroup", NULL);
+	srna = RNA_def_struct(brna, "ActionGroup", NULL);
 	RNA_def_struct_sdna(srna, "bActionGroup");
 	RNA_def_struct_ui_text(srna, "Action Group", "Groups of F-Curves");
 	
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Name", "");
 	RNA_def_struct_name_property(srna, prop);
 	RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
@@ -442,34 +453,34 @@ static void rna_def_action_group(BlenderRNA *brna)
 	 * defined like a standard ListBase. Adding/removing channels from this list needs
 	 * extreme care, otherwise the F-Curve list running through adjacent groups does
 	 * not match up with the one stored in the Action, resulting in curves which do not
-	 * show up in animation editors. In extreme cases, animation may also selectively 
-	 * fail to play back correctly. 
+	 * show up in animation editors. In extreme cases, animation may also selectively
+	 * fail to play back correctly.
 	 *
 	 * If such changes are required, these MUST go through the API functions for manipulating
 	 * these F-Curve groupings. Also, note that groups only apply in actions ONLY.
 	 */
-	prop= RNA_def_property(srna, "channels", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "channels", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "channels", NULL);
 	RNA_def_property_struct_type(prop, "FCurve");
 	RNA_def_property_collection_funcs(prop, 0, "rna_ActionGroup_channels_next", NULL, NULL, NULL, NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Channels", "F-Curves in this group");
 	
-	prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+	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_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_SELECTED, NULL);
 	
-	prop= RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
+	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_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
 	
-	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, "flag", AGRP_EXPANDED);
 	RNA_def_property_ui_text(prop, "Expanded", "Action Group is expanded");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "custom_color", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "custom_color", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "customCol");
 	RNA_def_property_ui_text(prop, "Custom Color", "Index of custom color set");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
@@ -484,23 +495,23 @@ static void rna_def_action_groups(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, "ActionGroups");
-	srna= RNA_def_struct(brna, "ActionGroups", NULL);
+	srna = RNA_def_struct(brna, "ActionGroups", NULL);
 	RNA_def_struct_sdna(srna, "bAction");
 	RNA_def_struct_ui_text(srna, "Action Groups", "Collection of action groups");
 
-	func= RNA_def_function(srna, "new", "rna_Action_groups_new");
+	func = RNA_def_function(srna, "new", "rna_Action_groups_new");
 	RNA_def_function_ui_description(func, "Add a keyframe to the curve");
-	parm= RNA_def_string(func, "name", "Group", 0, "", "New name for the action group");
+	parm = RNA_def_string(func, "name", "Group", 0, "", "New name for the action group");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	parm= RNA_def_pointer(func, "action_group", "ActionGroup", "", "Newly created action group");
+	parm = RNA_def_pointer(func, "action_group", "ActionGroup", "", "Newly created action group");
 	RNA_def_function_return(func, parm);
 
 
-	func= RNA_def_function(srna, "remove", "rna_Action_groups_remove");
+	func = RNA_def_function(srna, "remove", "rna_Action_groups_remove");
 	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");
+	parm = RNA_def_pointer(func, "action_group", "ActionGroup", "", "Action group to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 }
 
@@ -512,26 +523,26 @@ static void rna_def_action_fcurves(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, "ActionFCurves");
-	srna= RNA_def_struct(brna, "ActionFCurves", NULL);
+	srna = RNA_def_struct(brna, "ActionFCurves", NULL);
 	RNA_def_struct_sdna(srna, "bAction");
 	RNA_def_struct_ui_text(srna, "Action F-Curves", "Collection of action F-Curves");
 
-	func= RNA_def_function(srna, "new", "rna_Action_fcurve_new");
+	func = RNA_def_function(srna, "new", "rna_Action_fcurve_new");
 	RNA_def_function_ui_description(func, "Add a keyframe to the F-Curve");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
-	parm= RNA_def_string(func, "data_path", "", 0, "Data Path", "F-Curve data path to use");
+	parm = RNA_def_string(func, "data_path", "", 0, "Data Path", "F-Curve data path to use");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Array index", 0, INT_MAX);
 	RNA_def_string(func, "action_group", "", 0, "Action Group", "Acton group to add this F-Curve into");
 
-	parm= RNA_def_pointer(func, "fcurve", "FCurve", "", "Newly created F-Curve");
+	parm = RNA_def_pointer(func, "fcurve", "FCurve", "", "Newly created F-Curve");
 	RNA_def_function_return(func, parm);
 
 
-	func= RNA_def_function(srna, "remove", "rna_Action_fcurve_remove");
+	func = RNA_def_function(srna, "remove", "rna_Action_fcurve_remove");
 	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");
+	parm = RNA_def_pointer(func, "fcurve", "FCurve", "", "F-Curve to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 }
 
@@ -544,33 +555,35 @@ static void rna_def_action_pose_markers(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, "ActionPoseMarkers");
-	srna= RNA_def_struct(brna, "ActionPoseMarkers", NULL);
+	srna = RNA_def_struct(brna, "ActionPoseMarkers", NULL);
 	RNA_def_struct_sdna(srna, "bAction");
 	RNA_def_struct_ui_text(srna, "Action Pose Markers", "Collection of timeline markers");
 
-	func= RNA_def_function(srna, "new", "rna_Action_pose_markers_new");
+	func = RNA_def_function(srna, "new", "rna_Action_pose_markers_new");
 	RNA_def_function_ui_description(func, "Add a pose marker to the action");
-	parm= RNA_def_string(func, "name", "Marker", 0, "", "New name for the marker (not unique)");
+	parm = RNA_def_string(func, "name", "Marker", 0, "", "New name for the marker (not unique)");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	parm= RNA_def_pointer(func, "marker", "TimelineMarker", "", "Newly created marker");
+	parm = RNA_def_pointer(func, "marker", "TimelineMarker", "", "Newly created marker");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_Action_pose_markers_remove");
+	func = RNA_def_function(srna, "remove", "rna_Action_pose_markers_remove");
 	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");
+	parm = RNA_def_pointer(func, "marker", "TimelineMarker", "", "Timeline marker to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 	
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+	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_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");
 	
-	prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "active_marker");
-	RNA_def_property_int_funcs(prop, "rna_Action_active_pose_marker_index_get", "rna_Action_active_pose_marker_index_set", "rna_Action_active_pose_marker_index_range");
+	RNA_def_property_int_funcs(prop, "rna_Action_active_pose_marker_index_get",
+	                           "rna_Action_active_pose_marker_index_set", "rna_Action_active_pose_marker_index_range");
 	RNA_def_property_ui_text(prop, "Active Pose Marker Index", "Index of active pose marker");
 }
 
@@ -579,40 +592,44 @@ static void rna_def_action(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "Action", "ID");
+	srna = RNA_def_struct(brna, "Action", "ID");
 	RNA_def_struct_sdna(srna, "bAction");
 	RNA_def_struct_ui_text(srna, "Action", "A collection of F-Curves for animation");
 	RNA_def_struct_ui_icon(srna, ICON_ACTION);
 	
 	/* collections */
-	prop= RNA_def_property(srna, "fcurves", PROP_COLLECTION, PROP_NONE);
+	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_action_fcurves(brna, prop);
 	
-	prop= RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "groups", NULL);
 	RNA_def_property_struct_type(prop, "ActionGroup");
 	RNA_def_property_ui_text(prop, "Groups", "Convenient groupings of F-Curves");
 	rna_def_action_groups(brna, prop);
 	
-	prop= RNA_def_property(srna, "pose_markers", PROP_COLLECTION, PROP_NONE);
+	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_action_pose_markers(brna, prop);
 	
 	/* properties */
-	prop= RNA_def_float_vector(srna, "frame_range" , 2 , NULL , 0, 0, "Frame Range" , "The final frame range of all F-Curves within this action" , 0 , 0);
+	prop = RNA_def_float_vector(srna, "frame_range" , 2 , NULL , 0, 0, "Frame Range" ,
+	                            "The final frame range of all F-Curves within this action" , 0 , 0);
 	RNA_def_property_float_funcs(prop, "rna_Action_frame_range_get" , NULL, NULL);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	
-	/* special "type" limiter - should not really be edited in general, but is still available/editable in 'emergencies' */
-	prop= RNA_def_property(srna, "id_root", PROP_ENUM, PROP_NONE);
+	/* special "type" limiter - should not really be edited in general,
+	 * but is still available/editable in 'emergencies' */
+	prop = RNA_def_property(srna, "id_root", PROP_ENUM, PROP_NONE);
 	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");
+	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");
 	
 	/* API calls */
 	RNA_api_action(srna);
diff --git a/source/blender/makesrna/intern/rna_action_api.c b/source/blender/makesrna/intern/rna_action_api.c
index 07c42cf..7e95aaa 100644
--- a/source/blender/makesrna/intern/rna_action_api.c
+++ b/source/blender/makesrna/intern/rna_action_api.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
@@ -18,7 +18,7 @@
  * The Original Code is Copyright (C) 2009 Blender Foundation.
  * All rights reserved.
  *
- * 
+ *
  * Contributor(s): Arystanbek Dyussenov
  *
  * ***** END GPL LICENSE BLOCK *****
diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c
index 6098e88..e564c03 100644
--- a/source/blender/makesrna/intern/rna_actuator.c
+++ b/source/blender/makesrna/intern/rna_actuator.c
@@ -34,14 +34,14 @@
 #include "DNA_constraint_types.h"
 #include "DNA_object_types.h"
 #include "DNA_actuator_types.h"
-#include "DNA_scene_types.h" // for MAXFRAME
+#include "DNA_scene_types.h" /* for MAXFRAME */
 
 #include "WM_types.h"
 
 #include "BLI_utildefines.h"
 
 /* Always keep in alphabetical order */
-EnumPropertyItem actuator_type_items[] ={
+EnumPropertyItem actuator_type_items[] = {
 	{ACT_ACTION, "ACTION", 0, "Action", ""},
 	{ACT_ARMATURE, "ARMATURE", 0, "Armature", ""},
 	{ACT_CAMERA, "CAMERA", 0, "Camera", ""},
@@ -67,9 +67,9 @@ EnumPropertyItem actuator_type_items[] ={
 
 static StructRNA* rna_Actuator_refine(struct PointerRNA *ptr)
 {
-	bActuator *actuator= (bActuator*)ptr->data;
+	bActuator *actuator = (bActuator*)ptr->data;
 
-	switch(actuator->type) {
+	switch (actuator->type) {
 		case ACT_ACTION:
 			return &RNA_ActionActuator;
 		case ACT_OBJECT:
@@ -111,21 +111,21 @@ static StructRNA* rna_Actuator_refine(struct PointerRNA *ptr)
 
 void rna_Actuator_name_set(PointerRNA *ptr, const char *value)
 {
-	bActuator *act= (bActuator *)ptr->data;
+	bActuator *act = (bActuator *)ptr->data;
 
 	BLI_strncpy_utf8(act->name, value, sizeof(act->name));
 
 	if (ptr->id.data) {
-		Object *ob= (Object *)ptr->id.data;
+		Object *ob = (Object *)ptr->id.data;
 		BLI_uniquename(&ob->actuators, act, "Actuator", '.', offsetof(bActuator, name), sizeof(act->name));
 	}
 }
 
 static void rna_Actuator_type_set(struct PointerRNA *ptr, int value)
 {
-	bActuator *act= (bActuator *)ptr->data;
-	if (value != act->type)
-	{
+	bActuator *act = (bActuator *)ptr->data;
+
+	if (value != act->type) {
 		act->type = value;
 		init_actuator(act);
 	}
@@ -133,10 +133,10 @@ static void rna_Actuator_type_set(struct PointerRNA *ptr, int value)
 
 static void rna_ConstraintActuator_type_set(struct PointerRNA *ptr, int value)
 {
-	bActuator *act= (bActuator *)ptr->data;
-	bConstraintActuator *ca= act->data;
-	if (value != ca->type)
-	{
+	bActuator *act = (bActuator *)ptr->data;
+	bConstraintActuator *ca = act->data;
+
+	if (value != ca->type) {
 		ca->type = value;
 		switch (ca->type) {
 		case ACT_CONST_TYPE_ORI:
@@ -160,12 +160,12 @@ static float rna_ConstraintActuator_limitmin_get(struct PointerRNA *ptr)
 	bConstraintActuator *ca = act->data;
 	float *fp;
 
-	if(ca->flag & ACT_CONST_LOCX) fp= ca->minloc;
-	else if(ca->flag & ACT_CONST_LOCY) fp= ca->minloc+1;
-	else if(ca->flag & ACT_CONST_LOCZ) fp= ca->minloc+2;
-	else if(ca->flag & ACT_CONST_ROTX) fp= ca->minrot;
-	else if(ca->flag & ACT_CONST_ROTY) fp= ca->minrot+1;
-	else fp= ca->minrot+2;
+	if (ca->flag & ACT_CONST_LOCX) fp = ca->minloc;
+	else if (ca->flag & ACT_CONST_LOCY) fp = ca->minloc+1;
+	else if (ca->flag & ACT_CONST_LOCZ) fp = ca->minloc+2;
+	else if (ca->flag & ACT_CONST_ROTX) fp = ca->minrot;
+	else if (ca->flag & ACT_CONST_ROTY) fp = ca->minrot+1;
+	else fp = ca->minrot+2;
 
 	return *fp;
 }
@@ -176,12 +176,12 @@ static void rna_ConstraintActuator_limitmin_set(struct PointerRNA *ptr, float va
 	bConstraintActuator *ca = act->data;
 	float *fp;
 
-	if(ca->flag & ACT_CONST_LOCX) fp= ca->minloc;
-	else if(ca->flag & ACT_CONST_LOCY) fp= ca->minloc+1;
-	else if(ca->flag & ACT_CONST_LOCZ) fp= ca->minloc+2;
-	else if(ca->flag & ACT_CONST_ROTX) fp= ca->minrot;
-	else if(ca->flag & ACT_CONST_ROTY) fp= ca->minrot+1;
-	else fp= ca->minrot+2;
+	if (ca->flag & ACT_CONST_LOCX) fp = ca->minloc;
+	else if (ca->flag & ACT_CONST_LOCY) fp = ca->minloc+1;
+	else if (ca->flag & ACT_CONST_LOCZ) fp = ca->minloc+2;
+	else if (ca->flag & ACT_CONST_ROTX) fp = ca->minrot;
+	else if (ca->flag & ACT_CONST_ROTY) fp = ca->minrot+1;
+	else fp = ca->minrot+2;
 
 	*fp = value;
 }
@@ -192,12 +192,12 @@ static float rna_ConstraintActuator_limitmax_get(struct PointerRNA *ptr)
 	bConstraintActuator *ca = act->data;
 	float *fp;
 
-	if(ca->flag & ACT_CONST_LOCX) fp= ca->maxloc;
-	else if(ca->flag & ACT_CONST_LOCY) fp= ca->maxloc+1;
-	else if(ca->flag & ACT_CONST_LOCZ) fp= ca->maxloc+2;
-	else if(ca->flag & ACT_CONST_ROTX) fp= ca->maxrot;
-	else if(ca->flag & ACT_CONST_ROTY) fp= ca->maxrot+1;
-	else fp= ca->maxrot+2;
+	if (ca->flag & ACT_CONST_LOCX) fp = ca->maxloc;
+	else if (ca->flag & ACT_CONST_LOCY) fp = ca->maxloc+1;
+	else if (ca->flag & ACT_CONST_LOCZ) fp = ca->maxloc+2;
+	else if (ca->flag & ACT_CONST_ROTX) fp = ca->maxrot;
+	else if (ca->flag & ACT_CONST_ROTY) fp = ca->maxrot+1;
+	else fp = ca->maxrot+2;
 
 	return *fp;
 }
@@ -208,12 +208,12 @@ static void rna_ConstraintActuator_limitmax_set(struct PointerRNA *ptr, float va
 	bConstraintActuator *ca = act->data;
 	float *fp;
 
-	if(ca->flag & ACT_CONST_LOCX) fp= ca->maxloc;
-	else if(ca->flag & ACT_CONST_LOCY) fp= ca->maxloc+1;
-	else if(ca->flag & ACT_CONST_LOCZ) fp= ca->maxloc+2;
-	else if(ca->flag & ACT_CONST_ROTX) fp= ca->maxrot;
-	else if(ca->flag & ACT_CONST_ROTY) fp= ca->maxrot+1;
-	else fp= ca->maxrot+2;
+	if (ca->flag & ACT_CONST_LOCX) fp = ca->maxloc;
+	else if (ca->flag & ACT_CONST_LOCY) fp = ca->maxloc+1;
+	else if (ca->flag & ACT_CONST_LOCZ) fp = ca->maxloc+2;
+	else if (ca->flag & ACT_CONST_ROTX) fp = ca->maxrot;
+	else if (ca->flag & ACT_CONST_ROTY) fp = ca->maxrot+1;
+	else fp = ca->maxrot+2;
 
 	*fp = value;
 }
@@ -224,9 +224,9 @@ static float rna_ConstraintActuator_distance_get(struct PointerRNA *ptr)
 	bConstraintActuator *ca = act->data;
 	float *fp;
 
-	if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->minloc;
-	else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->minloc+1;
-	else fp= ca->minloc+2;
+	if (ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp = ca->minloc;
+	else if (ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp = ca->minloc+1;
+	else fp = ca->minloc+2;
 
 	return *fp;
 }
@@ -237,9 +237,9 @@ static void rna_ConstraintActuator_distance_set(struct PointerRNA *ptr, float va
 	bConstraintActuator *ca = act->data;
 	float *fp;
 
-	if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->minloc;
-	else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->minloc+1;
-	else fp= ca->minloc+2;
+	if (ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp = ca->minloc;
+	else if (ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp = ca->minloc+1;
+	else fp = ca->minloc+2;
 
 	*fp = value;
 }
@@ -250,9 +250,9 @@ static float rna_ConstraintActuator_range_get(struct PointerRNA *ptr)
 	bConstraintActuator *ca = act->data;
 	float *fp;
 
-	if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->maxloc;
-	else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->maxloc+1;
-	else fp= ca->maxloc+2;
+	if (ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp = ca->maxloc;
+	else if (ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp = ca->maxloc+1;
+	else fp = ca->maxloc+2;
 
 	return *fp;
 }
@@ -263,9 +263,9 @@ static void rna_ConstraintActuator_range_set(struct PointerRNA *ptr, float value
 	bConstraintActuator *ca = act->data;
 	float *fp;
 
-	if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->maxloc;
-	else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->maxloc+1;
-	else fp= ca->maxloc+2;
+	if (ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp = ca->maxloc;
+	else if (ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp = ca->maxloc+1;
+	else fp = ca->maxloc+2;
 
 	*fp = value;
 }
@@ -276,9 +276,9 @@ static float rna_ConstraintActuator_fhheight_get(struct PointerRNA *ptr)
 	bConstraintActuator *ca = act->data;
 	float *fp;
 
-	if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->minloc;
-	else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->minloc+1;
-	else fp= ca->minloc+2;
+	if (ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp = ca->minloc;
+	else if (ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp = ca->minloc+1;
+	else fp = ca->minloc+2;
 
 	return *fp;
 }
@@ -289,9 +289,9 @@ static void rna_ConstraintActuator_fhheight_set(struct PointerRNA *ptr, float va
 	bConstraintActuator *ca = act->data;
 	float *fp;
 
-	if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->minloc;
-	else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->minloc+1;
-	else fp= ca->minloc+2;
+	if (ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp = ca->minloc;
+	else if (ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp = ca->minloc+1;
+	else fp = ca->minloc+2;
 
 	*fp = value;
 }
@@ -302,9 +302,9 @@ static float rna_ConstraintActuator_spring_get(struct PointerRNA *ptr)
 	bConstraintActuator *ca = act->data;
 	float *fp;
 
-	if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->maxloc;
-	else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->maxloc+1;
-	else fp= ca->maxloc+2;
+	if (ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp = ca->maxloc;
+	else if (ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp = ca->maxloc+1;
+	else fp = ca->maxloc+2;
 
 	return *fp;
 }
@@ -315,14 +315,14 @@ static void rna_ConstraintActuator_spring_set(struct PointerRNA *ptr, float valu
 	bConstraintActuator *ca = act->data;
 	float *fp;
 
-	if(ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp= ca->maxloc;
-	else if(ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp= ca->maxloc+1;
-	else fp= ca->maxloc+2;
+	if (ca->mode & (ACT_CONST_DIRPX|ACT_CONST_DIRNX)) fp = ca->maxloc;
+	else if (ca->mode & (ACT_CONST_DIRPY|ACT_CONST_DIRNY)) fp = ca->maxloc+1;
+	else fp = ca->maxloc+2;
 
 	*fp = value;
 }
 /* ConstraintActuator uses the same property for Material and Property.
-   Therefore we need to clear the property when "use_material_detect" mode changes */
+ * Therefore we need to clear the property when "use_material_detect" mode changes */
 static void rna_Actuator_constraint_detect_material_set(struct PointerRNA *ptr, int value)
 {
 	bActuator *act = (bActuator*)ptr->data;
@@ -341,11 +341,13 @@ static void rna_ActionActuator_add_set(struct PointerRNA *ptr, int value)
 	bActuator *act = (bActuator *)ptr->data;
 	bActionActuator *aa = act->data;
 
-	if(value == 1){
+	if (value == 1) {
 		aa->flag &= ~ACT_IPOFORCE;
 		aa->flag |= ACT_IPOADD;
-	}else
+	}
+	else {
 		aa->flag &= ~ACT_IPOADD;
+	}
 }
 
 static void rna_ActionActuator_force_set(struct PointerRNA *ptr, int value)
@@ -353,19 +355,20 @@ static void rna_ActionActuator_force_set(struct PointerRNA *ptr, int value)
 	bActuator *act = (bActuator *)ptr->data;
 	bActionActuator *aa = act->data;
 
-	if(value == 1){
+	if (value == 1) {
 		aa->flag &= ~ACT_IPOADD;
 		aa->flag |= ACT_IPOFORCE;
-	}else
+	}
+	else {
 		aa->flag &= ~ACT_IPOFORCE;
+	}
 }
 
 static void rna_ObjectActuator_type_set(struct PointerRNA *ptr, int value)
 {
-	bActuator *act= (bActuator *)ptr->data;
+	bActuator *act = (bActuator *)ptr->data;
 	bObjectActuator *oa = act->data;
-	if (value != oa->type)
-	{
+	if (value != oa->type) {
 		oa->type = value;
 		switch (oa->type) {
 		case ACT_OBJECT_NORMAL:
@@ -400,18 +403,18 @@ static void rna_StateActuator_state_set(PointerRNA *ptr, const int *values)
 	bActuator *act = (bActuator*)ptr->data;
 	bStateActuator *sa = act->data;
 
-	int i, tot= 0;
+	int i, tot = 0;
 
 	/* ensure we always have some state selected */
-	for(i=0; i<OB_MAX_STATES; i++)
-		if(values[i])
+	for (i = 0; i<OB_MAX_STATES; i++)
+		if (values[i])
 			tot++;
 	
-	if(tot==0)
+	if (tot == 0)
 		return;
 
-	for(i=0; i<OB_MAX_STATES; i++) {
-		if(values[i]) sa->mask |= (1<<i);
+	for (i = 0; i<OB_MAX_STATES; i++) {
+		if (values[i]) sa->mask |= (1<<i);
 		else sa->mask &= ~(1<<i);
 	}
 }
@@ -419,19 +422,20 @@ static void rna_StateActuator_state_set(PointerRNA *ptr, const int *values)
 /* Always keep in alphabetical order */
 EnumPropertyItem *rna_Actuator_type_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
 {
-	EnumPropertyItem *item= NULL;
-	Object *ob= NULL;
-	int totitem= 0;
+	EnumPropertyItem *item = NULL;
+	Object *ob = NULL;
+	int totitem = 0;
 	
-	if (ptr->type==&RNA_Actuator || RNA_struct_is_a(ptr->type, &RNA_Actuator)){
+	if (ptr->type == &RNA_Actuator || RNA_struct_is_a(ptr->type, &RNA_Actuator)) {
 		ob = (Object *)ptr->id.data;
-	} else {
+	}
+	else {
 		/* can't use ob from ptr->id.data because that enum is also used by operators */
 		ob = CTX_data_active_object(C);
 	}
 	
 	if (ob != NULL) {
-		if (ob->type==OB_ARMATURE) {
+		if (ob->type == OB_ARMATURE) {
 			RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_ARMATURE);
 		}
 	}
@@ -455,32 +459,32 @@ EnumPropertyItem *rna_Actuator_type_itemf(bContext *C, PointerRNA *ptr, Property
 	RNA_enum_items_add_value(&item, &totitem, actuator_type_items, ACT_VISIBILITY);
 	
 	RNA_enum_item_end(&item, &totitem);
-	*free= 1;
+	*free = 1;
 	
 	return item;
 }
 
 static void rna_Actuator_Armature_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	bActuator *act= (bActuator *)ptr->data;
+	bActuator *act = (bActuator *)ptr->data;
 	bArmatureActuator *aa = act->data;
 	Object *ob = (Object *)ptr->id.data;
 
-	char *posechannel= aa->posechannel;
-	char *constraint= aa->constraint;
+	char *posechannel = aa->posechannel;
+	char *constraint = aa->constraint;
 
 	/* check that bone exist in the active object */
 	if (ob->type == OB_ARMATURE && ob->pose) {
 		bPoseChannel *pchan;
 		bPose *pose = ob->pose;
-		for (pchan=pose->chanbase.first; pchan; pchan=pchan->next) {
+		for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
 			if (!strcmp(pchan->name, posechannel)) {
 				/* found it, now look for constraint channel */
 				bConstraint *con;
-				for (con=pchan->constraints.first; con; con=con->next) {
+				for (con = pchan->constraints.first; con; con = con->next) {
 					if (!strcmp(con->name, constraint)) {
 						/* found it, all ok */
-						return;						
+						return;
 					}
 				}
 				/* didn't find constraint, make empty */
@@ -500,7 +504,7 @@ static void rna_SteeringActuator_navmesh_set(PointerRNA *ptr, PointerRNA value)
 	bSteeringActuator *sa = (bSteeringActuator*) act->data;
 
 	Object* obj = value.data;
-	if (obj && obj->body_type==OB_BODY_TYPE_NAVMESH)
+	if (obj && obj->body_type == OB_BODY_TYPE_NAVMESH)
 		sa->navmesh = obj;
 	else
 		sa->navmesh = NULL;
@@ -530,29 +534,29 @@ void rna_def_actuator(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "Actuator", NULL);
+	srna = RNA_def_struct(brna, "Actuator", NULL);
 	RNA_def_struct_ui_text(srna, "Actuator", "Actuator to apply actions in the game engine");
 	RNA_def_struct_sdna(srna, "bActuator");
 	RNA_def_struct_refine_func(srna, "rna_Actuator_refine");
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Name", "");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Actuator_name_set");
 	RNA_def_struct_name_property(srna, prop);
 
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_items(prop, actuator_type_items);
 	RNA_def_property_enum_funcs(prop, NULL, "rna_Actuator_type_set", "rna_Actuator_type_itemf");
 	RNA_def_property_ui_text(prop, "Type", "");
 
-	prop= RNA_def_property(srna, "pin", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "pin", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_PIN);
 	RNA_def_property_ui_text(prop, "Pinned", "Display when not linked to a visible states controller");
 	RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	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, "flag", ACT_SHOW);
 	RNA_def_property_ui_text(prop, "Expanded", "Set actuator expanded in the user interface");
 	RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
@@ -565,7 +569,7 @@ static void rna_def_action_actuator(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static EnumPropertyItem prop_type_items[] ={
+	static EnumPropertyItem prop_type_items[] = {
 		{ACT_ACTION_PLAY, "PLAY", 0, "Play", ""},
 		{ACT_ACTION_PINGPONG, "PINGPONG", 0, "Ping Pong", ""},
 		{ACT_ACTION_FLIPPER, "FLIPPER", 0, "Flipper", ""},
@@ -577,17 +581,17 @@ static void rna_def_action_actuator(BlenderRNA *brna)
 #endif
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "ActionActuator", "Actuator");
+	srna = RNA_def_struct(brna, "ActionActuator", "Actuator");
 	RNA_def_struct_ui_text(srna, "Action Actuator", "Actuator to control the object movement");
 	RNA_def_struct_sdna_from(srna, "bActionActuator", "data");
 
-	prop= RNA_def_property(srna, "play_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "play_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_ui_text(prop, "Action Type", "Action playback type");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "act");
 	RNA_def_property_struct_type(prop, "Action");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
@@ -596,79 +600,87 @@ static void rna_def_action_actuator(BlenderRNA *brna)
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_Actuator_action_action_set", NULL, NULL);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_continue_last_frame", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_continue_last_frame", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "end_reset", 1);
-	RNA_def_property_ui_text(prop, "Continue", "Restore last frame when switching on/off, otherwise play from the start each time");
+	RNA_def_property_ui_text(prop, "Continue",
+	                         "Restore last frame when switching on/off, otherwise play from the start each time");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 	
-	prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "name");
 	RNA_def_property_ui_text(prop, "Property", "Use this property to define the Action position");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "sta");
 	RNA_def_property_ui_range(prop, 0.0, MAXFRAME, 100, 2);
 	RNA_def_property_ui_text(prop, "Start Frame", "");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "end");
 	RNA_def_property_ui_range(prop, 0.0, MAXFRAME, 100, 2);
 	RNA_def_property_ui_text(prop, "End Frame", "");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "frame_blend_in", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_blend_in", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "blendin");
 	RNA_def_property_range(prop, 0, 32767);
 	RNA_def_property_ui_text(prop, "Blendin", "Number of frames of motion blending");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "priority", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "priority", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, 0, 100);
-	RNA_def_property_ui_text(prop, "Priority", "Execution priority - lower numbers will override actions with higher numbers (with 2 or more actions at once, the overriding channels must be lower in the stack)");
+	RNA_def_property_ui_text(prop, "Priority",
+	                         "Execution priority - lower numbers will override actions with higher numbers "
+	                         "(with 2 or more actions at once, the overriding channels must be lower in the stack)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "layer", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "layer", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, 0, 7); /* This should match BL_ActionManager::MAX_ACTION_LAYERS - 1 */
 	RNA_def_property_ui_text(prop, "Layer", "The animation layer to play the action on");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "layer_weight", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "layer_weight", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0, 1.0);
-	RNA_def_property_ui_text(prop, "Layer Weight", "How much of the previous layer to blend into this one (0 = add mode)");
+	RNA_def_property_ui_text(prop, "Layer Weight",
+	                         "How much of the previous layer to blend into this one (0 = add mode)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "frame_property", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_property", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "frameProp");
 	RNA_def_property_ui_text(prop, "Frame Property", "Assign the action's current frame number to this property");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* booleans */
-	prop= RNA_def_property(srna, "use_additive", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_additive", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOADD);
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_ActionActuator_add_set");
-	RNA_def_property_ui_text(prop, "Add", "Action is added to the current loc/rot/scale in global or local coordinate according to Local flag");
+	RNA_def_property_ui_text(prop, "Add",
+	                         "Action is added to the current loc/rot/scale in global or local coordinate according to "
+	                         "Local flag");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_force", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_force", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOFORCE);
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_ActionActuator_force_set");
-	RNA_def_property_ui_text(prop, "Force", "Apply Action as a global or local force depending on the local option (dynamic objects only)");
+	RNA_def_property_ui_text(prop, "Force",
+	                         "Apply Action as a global or local force depending on the local option "
+	                         "(dynamic objects only)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 	
-	prop= RNA_def_property(srna, "use_local", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_local", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOLOCAL);
 	RNA_def_property_ui_text(prop, "L", "Let the Action act in local coordinates, used in Force and Add mode");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "apply_to_children", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "apply_to_children", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_IPOCHILD);
 	RNA_def_property_ui_text(prop, "Child", "Update Action on all children Objects as well");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
-	prop= RNA_def_property(srna, "stride_length", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "stride_length", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "stridelength");
 	RNA_def_property_range(prop, 0.0, 2500.0);
 	RNA_def_property_ui_text(prop, "Cycle", "Distance covered by a single cycle of the action");
@@ -681,128 +693,132 @@ static void rna_def_object_actuator(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA* prop;
 
-	static EnumPropertyItem prop_type_items[] ={
+	static EnumPropertyItem prop_type_items[] = {
 		{ACT_OBJECT_NORMAL, "OBJECT_NORMAL", 0, "Simple Motion", ""},
 		{ACT_OBJECT_SERVO, "OBJECT_SERVO", 0, "Servo Control", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "ObjectActuator", "Actuator");
+	srna = RNA_def_struct(brna, "ObjectActuator", "Actuator");
 	RNA_def_struct_ui_text(srna, "Motion Actuator", "Actuator to control the object movement");
 	RNA_def_struct_sdna_from(srna, "bObjectActuator", "data");
 
 
-	prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_enum_funcs(prop, NULL, "rna_ObjectActuator_type_set", NULL);
 	RNA_def_property_ui_text(prop, "Motion Type", "Specify the motion system");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 	
-	prop= RNA_def_property(srna, "reference_object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "reference_object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_pointer_sdna(prop, NULL, "reference");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "Reference Object", "Reference object for velocity calculation, leave empty for world reference");
+	RNA_def_property_ui_text(prop, "Reference Object",
+	                         "Reference object for velocity calculation, leave empty for world reference");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 	
-	prop= RNA_def_property(srna, "damping", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "damping", PROP_INT, PROP_NONE);
 	RNA_def_property_ui_range(prop, 0, 1000, 1, 1);
 	RNA_def_property_ui_text(prop, "Damping Frames", "Number of frames to reach the target velocity");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "proportional_coefficient", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "proportional_coefficient", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "forcerot[0]");
 	RNA_def_property_ui_range(prop, 0.0, 200.0, 10, 2);
 	RNA_def_property_ui_text(prop, "Proportional Coefficient", "Typical value is 60x integral coefficient");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "integral_coefficient", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "integral_coefficient", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "forcerot[1]");
 	RNA_def_property_ui_range(prop, 0.0, 3.0, 10, 2);
 	RNA_def_property_float_funcs(prop, NULL, "rna_ObjectActuator_integralcoefficient_set", NULL);
-	RNA_def_property_ui_text(prop, "Integral Coefficient", "Low value (0.01) for slow response, high value (0.5) for fast response");
+	RNA_def_property_ui_text(prop, "Integral Coefficient",
+	                         "Low value (0.01) for slow response, high value (0.5) for fast response");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "derivate_coefficient", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "derivate_coefficient", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "forcerot[2]");
 	RNA_def_property_ui_range(prop, -100.0, 100.0, 10, 2);
 	RNA_def_property_ui_text(prop, "Derivate Coefficient", "Not required, high values can cause instability");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* Servo Limit */
-	prop= RNA_def_property(srna, "force_max_x", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "force_max_x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "dloc[0]");
 	RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Max", "Upper limit for X force");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "force_min_x", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "force_min_x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "drot[0]");
 	RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Min", "Lower limit for X force");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "force_max_y", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "force_max_y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "dloc[1]");
 	RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Max", "Upper limit for Y force");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "force_min_y", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "force_min_y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "drot[1]");
 	RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Min", "Lower limit for Y force");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "force_max_z", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "force_max_z", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "dloc[2]");
 	RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Max", "Upper limit for Z force");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "force_min_z", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "force_min_z", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "drot[2]");
 	RNA_def_property_ui_range(prop, -100.0, 100.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Min", "Lower limit for Z force");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* floats 3 Arrays*/
-	prop= RNA_def_property(srna, "offset_location", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "offset_location", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "dloc");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2);
 	RNA_def_property_ui_text(prop, "Loc", "Location");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "offset_rotation", PROP_FLOAT, PROP_EULER);
+	prop = RNA_def_property(srna, "offset_rotation", PROP_FLOAT, PROP_EULER);
 	RNA_def_property_float_sdna(prop, NULL, "drot");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2);
 	RNA_def_property_ui_text(prop, "Rot", "Rotation");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "force", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "force", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "forceloc");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2);
 	RNA_def_property_ui_text(prop, "Force", "Force");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "torque", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "torque", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "forcerot");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2);
 	RNA_def_property_ui_text(prop, "Torque", "Torque");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "linear_velocity", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "linear_velocity", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "linearvelocity");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2);
-	RNA_def_property_ui_text(prop, "Linear Velocity", "Linear velocity (in Servo mode it sets the target relative linear velocity, it will be achieved by automatic application of force - Null velocity is a valid target)");
+	RNA_def_property_ui_text(prop, "Linear Velocity",
+	                         "Linear velocity (in Servo mode it sets the target relative linear velocity, it will be "
+	                         "achieved by automatic application of force - Null velocity is a valid target)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "angularvelocity");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2);
@@ -810,52 +826,52 @@ static void rna_def_object_actuator(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 	
 	/* booleans */
-	prop= RNA_def_property(srna, "use_local_location", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_local_location", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_DLOC_LOCAL);
 	RNA_def_property_ui_text(prop, "L", "Location is defined in local coordinates");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_local_rotation", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_local_rotation", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_DROT_LOCAL);
 	RNA_def_property_ui_text(prop, "L", "Rotation is defined in local coordinates");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_local_force", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_local_force", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_FORCE_LOCAL);
 	RNA_def_property_ui_text(prop, "L", "Force is defined in local coordinates");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_local_torque", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_local_torque", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_TORQUE_LOCAL);
 	RNA_def_property_ui_text(prop, "L", "Torque is defined in local coordinates");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_local_linear_velocity", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_local_linear_velocity", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_LIN_VEL_LOCAL);
 	RNA_def_property_ui_text(prop, "L", "Velocity is defined in local coordinates");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_local_angular_velocity", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_local_angular_velocity", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_ANG_VEL_LOCAL);
 	RNA_def_property_ui_text(prop, "L", "Angular velocity is defined in local coordinates");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_add_linear_velocity", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_add_linear_velocity", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_ADD_LIN_VEL);
 	RNA_def_property_ui_text(prop, "Add", "Toggles between ADD and SET linV");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_servo_limit_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_servo_limit_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SERVO_LIMIT_X);
 	RNA_def_property_ui_text(prop, "X", "Set limit to force along the X axis");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_servo_limit_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_servo_limit_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SERVO_LIMIT_Y);
 	RNA_def_property_ui_text(prop, "Y", "Set limit to force along the Y axis");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_servo_limit_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_servo_limit_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SERVO_LIMIT_Z);
 	RNA_def_property_ui_text(prop, "Z", "Set limit to force along the Z axis");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -866,18 +882,18 @@ static void rna_def_camera_actuator(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static EnumPropertyItem prop_axis_items[] ={
+	static EnumPropertyItem prop_axis_items[] = {
 		{OB_POSX, "POS_X", 0, "+X", "Camera tries to get behind the X axis"},
 		{OB_POSY, "POS_Y", 0, "+Y", "Camera tries to get behind the Y axis"},
 		{OB_NEGX, "NEG_X", 0, "-X", "Camera tries to get behind the -X axis"},
 		{OB_NEGY, "NEG_Y", 0, "-Y", "Camera tries to get behind the -Y axis"},
 		{0, NULL, 0, NULL, NULL}};
 	
-	srna= RNA_def_struct(brna, "CameraActuator", "Actuator");
+	srna = RNA_def_struct(brna, "CameraActuator", "Actuator");
 	RNA_def_struct_ui_text(srna, "Camera Actuator", "");
 	RNA_def_struct_sdna_from(srna, "bCameraActuator", "data");
 
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_pointer_sdna(prop, NULL, "ob");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
@@ -885,22 +901,22 @@ static void rna_def_camera_actuator(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* floats */
-	prop= RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_ui_range(prop, 0.0, 20.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Height", "");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_ui_range(prop, 0.0, 20.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Min", "");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_ui_range(prop, 0.0, 20.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Max", "");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "damping");
 	RNA_def_property_range(prop, 0, 10.0);
 	RNA_def_property_ui_range(prop, 0, 5.0, 1, 2);
@@ -908,7 +924,7 @@ static void rna_def_camera_actuator(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* +x/+y/-x/-y */
-	prop= RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "axis");
 	RNA_def_property_enum_items(prop, prop_axis_items);
 	RNA_def_property_ui_text(prop, "Axis", "Axis the Camera will try to get behind");
@@ -920,7 +936,7 @@ static void rna_def_sound_actuator(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static EnumPropertyItem prop_type_items[] ={
+	static EnumPropertyItem prop_type_items[] = {
 		{ACT_SND_PLAY_STOP_SOUND, "PLAYSTOP", 0, "Play Stop", ""},
 		{ACT_SND_PLAY_END_SOUND, "PLAYEND", 0, "Play End", ""},
 		{ACT_SND_LOOP_STOP_SOUND, "LOOPSTOP", 0, "Loop Stop", ""},
@@ -930,84 +946,86 @@ static void rna_def_sound_actuator(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}
 	};
 	
-	srna= RNA_def_struct(brna, "SoundActuator", "Actuator");
+	srna = RNA_def_struct(brna, "SoundActuator", "Actuator");
 	RNA_def_struct_ui_text(srna, "Sound Actuator", "Actuator to handle sound");
 	RNA_def_struct_sdna_from(srna, "bSoundActuator", "data");
 
-	prop= RNA_def_property(srna, "sound", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "sound", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Sound");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_struct_ui_text(srna, "Sound", "Sound file");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_ui_text(prop, "Play Mode", "");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
 	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_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE);
+	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_update(prop, NC_LOGIC, NULL);
 	
 	/* floats - 3D Parameters */
-	prop= RNA_def_property(srna, "gain_3d_min", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "gain_3d_min", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "sound3D.min_gain");
 	RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Minimum Gain", "The minimum gain of the sound, no matter how far it is away");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "gain_3d_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "gain_3d_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "sound3D.max_gain");
 	RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Maximum Gain", "The maximum gain of the sound, no matter how near it is");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "distance_3d_reference", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "distance_3d_reference", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "sound3D.reference_distance");
 	RNA_def_property_ui_range(prop, 0.0, FLT_MAX, 1, 2);
 	RNA_def_property_ui_text(prop, "Reference Distance", "The distance where the sound has a gain of 1.0");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 	
-	prop= RNA_def_property(srna, "distance_3d_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "distance_3d_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "sound3D.max_distance");
 	RNA_def_property_ui_range(prop, 0.0, FLT_MAX, 1, 2);
 	RNA_def_property_ui_text(prop, "Maximum Distance", "The maximum distance at which you can hear the sound");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "rolloff_factor_3d", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "rolloff_factor_3d", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "sound3D.rolloff_factor");
 	RNA_def_property_ui_range(prop, 0.0, 5.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Rolloff", "The influence factor on volume depending on distance");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "cone_outer_gain_3d", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "cone_outer_gain_3d", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "sound3D.cone_outer_gain");
 	RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
-	RNA_def_property_ui_text(prop, "Cone Outer Gain", "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)");
+	RNA_def_property_ui_text(prop, "Cone Outer Gain",
+	                         "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)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "cone_outer_angle_3d", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "cone_outer_angle_3d", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "sound3D.cone_outer_angle");
 	RNA_def_property_ui_range(prop, 0.0, 360.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Cone Outer Angle", "The angle of the outer cone");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "cone_inner_angle_3d", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "cone_inner_angle_3d", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "sound3D.cone_inner_angle");
 	RNA_def_property_ui_range(prop, 0.0, 360.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Cone Inner Angle", "The angle of the inner cone");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 	
 	/* booleans */
-	prop= RNA_def_property(srna, "use_sound_3d", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_sound_3d", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_SND_3D_SOUND);
 	RNA_def_property_ui_text(prop, "3D Sound", "Enable/Disable 3D Sound");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -1018,7 +1036,7 @@ static void rna_def_property_actuator(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static EnumPropertyItem prop_type_items[] ={
+	static EnumPropertyItem prop_type_items[] = {
 		{ACT_PROP_ASSIGN, "ASSIGN", 0, "Assign", ""},
 		{ACT_PROP_ADD, "ADD", 0, "Add", ""},
 		{ACT_PROP_COPY, "COPY", 0, "Copy", ""},
@@ -1026,35 +1044,35 @@ static void rna_def_property_actuator(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}
 	};
 
-	srna= RNA_def_struct(brna, "PropertyActuator", "Actuator");
+	srna = RNA_def_struct(brna, "PropertyActuator", "Actuator");
 	RNA_def_struct_ui_text(srna, "Property Actuator", "Actuator to handle properties");
 	RNA_def_struct_sdna_from(srna, "bPropertyActuator", "data");
 
-	prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_ui_text(prop, "Mode", "");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "name");
 	RNA_def_property_ui_text(prop, "Property", "The name of the property");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "value", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "value", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Value", "The name of the property or the value to use (use \"\" around strings)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* Copy Mode */
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_pointer_sdna(prop, NULL, "ob");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Object", "Copy from this Object");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	//XXX add even magic'er property lookup (need to look for the property list of the target object)
-	prop= RNA_def_property(srna, "object_property", PROP_STRING, PROP_NONE);
+	/*XXX add even magic'er property lookup (need to look for the property list of the target object) */
+	prop = RNA_def_property(srna, "object_property", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "value");
 	RNA_def_property_ui_text(prop, "Property Name", "Copy this property");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -1065,7 +1083,7 @@ static void rna_def_constraint_actuator(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static EnumPropertyItem prop_type_items[] ={
+	static EnumPropertyItem prop_type_items[] = {
 		{ACT_CONST_TYPE_LOC, "LOC", 0, "Location Constraint", ""},
 		{ACT_CONST_TYPE_DIST, "DIST", 0, "Distance Constraint", ""},
 		{ACT_CONST_TYPE_ORI, "ORI", 0, "Orientation Constraint", ""},
@@ -1073,7 +1091,7 @@ static void rna_def_constraint_actuator(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}
 	};
 
-	static EnumPropertyItem prop_limit_items[] ={
+	static EnumPropertyItem prop_limit_items[] = {
 		{ACT_CONST_NONE, "NONE", 0, "None", ""},
 		{ACT_CONST_LOCX, "LOCX", 0, "Loc X", ""},
 		{ACT_CONST_LOCY, "LOCY", 0, "Loc Y", ""},
@@ -1081,7 +1099,7 @@ static void rna_def_constraint_actuator(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}
 	};
 
-	static EnumPropertyItem prop_direction_items[] ={
+	static EnumPropertyItem prop_direction_items[] = {
 		{ACT_CONST_NONE, "NONE", 0, "None", ""},
 		{ACT_CONST_DIRPX, "DIRPX", 0, "X axis", ""},
 		{ACT_CONST_DIRPY, "DIRPY", 0, "Y axis", ""},
@@ -1092,7 +1110,7 @@ static void rna_def_constraint_actuator(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}
 	};
 
-	static EnumPropertyItem prop_direction_pos_items[] ={
+	static EnumPropertyItem prop_direction_pos_items[] = {
 		{ACT_CONST_NONE, "NONE", 0, "None", ""},
 		{ACT_CONST_DIRPX, "DIRPX", 0, "X axis", ""},
 		{ACT_CONST_DIRPY, "DIRPY", 0, "Y axis", ""},
@@ -1100,172 +1118,182 @@ static void rna_def_constraint_actuator(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}
 	};
 
-	srna= RNA_def_struct(brna, "ConstraintActuator", "Actuator");
+	srna = RNA_def_struct(brna, "ConstraintActuator", "Actuator");
 	RNA_def_struct_ui_text(srna, "Constraint Actuator", "Actuator to handle Constraints");
 	RNA_def_struct_sdna_from(srna, "bConstraintActuator", "data");
 
-	prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_enum_funcs(prop, NULL, "rna_ConstraintActuator_type_set", NULL);
 	RNA_def_property_ui_text(prop, "Constraints Mode", "The type of the constraint");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "limit", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "limit", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, prop_limit_items);
 	RNA_def_property_ui_text(prop, "Limit", "");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "mode");
 	RNA_def_property_enum_items(prop, prop_direction_items);
 	RNA_def_property_ui_text(prop, "Direction", "Direction of the ray");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "direction_axis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "direction_axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "mode");
 	RNA_def_property_enum_items(prop, prop_direction_items);
 	RNA_def_property_ui_text(prop, "Direction", "Select the axis to be aligned along the reference direction");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* ACT_CONST_TYPE_LOC */
-	prop= RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE);
-	RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_limitmin_get", "rna_ConstraintActuator_limitmin_set", NULL);
+	prop = RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_limitmin_get",
+	                             "rna_ConstraintActuator_limitmin_set", NULL);
 	RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2);
 	RNA_def_property_ui_text(prop, "Min", "");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE);
-	RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_limitmax_get", "rna_ConstraintActuator_limitmax_set", NULL);
+	prop = RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_limitmax_get",
+	                             "rna_ConstraintActuator_limitmax_set", NULL);
 	RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2);
 	RNA_def_property_ui_text(prop, "Max", "");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "damping", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "damping", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "damp");
 	RNA_def_property_ui_range(prop, 0, 100, 1, 1);
 	RNA_def_property_ui_text(prop, "Damping", "Damping factor: time constant (in frame) of low pass filter");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* ACT_CONST_TYPE_DIST */
-	prop= RNA_def_property(srna, "range", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "range", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_range_get", "rna_ConstraintActuator_range_set", NULL);
 	RNA_def_property_ui_range(prop, 0.f, 2000.f, 1, 2);
 	RNA_def_property_ui_text(prop, "Range", "Maximum length of ray");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
-	RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_distance_get", "rna_ConstraintActuator_distance_set", NULL);
+	prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_distance_get",
+	                             "rna_ConstraintActuator_distance_set", NULL);
 	RNA_def_property_ui_range(prop, -2000.f, 2000.f, 1, 2);
 	RNA_def_property_ui_text(prop, "Distance", "Keep this distance to target");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	//XXX to use a pointer or add a material lookup
-	prop= RNA_def_property(srna, "material", PROP_STRING, PROP_NONE);
+	/*XXX to use a pointer or add a material lookup */
+	prop = RNA_def_property(srna, "material", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "matprop");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Material", "Ray detects only Objects with this material");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	//XXX add magic property lookup
-	prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
+	/*XXX add magic property lookup */
+	prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "matprop");
 	RNA_def_property_ui_text(prop, "Property", "Ray detects only Objects with this property");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "time", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "time", PROP_INT, PROP_NONE);
 	RNA_def_property_ui_range(prop, 0, 1000, 1, 2);
 	RNA_def_property_ui_text(prop, "Time", "Maximum activation time in frame, 0 for unlimited");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "damping_rotation", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "damping_rotation", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "rotdamp");
 	RNA_def_property_ui_range(prop, 0, 100, 1, 1);
 	RNA_def_property_ui_text(prop, "RotDamp", "Use a different damping for orientation");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* ACT_CONST_TYPE_ORI */
-	prop= RNA_def_property(srna, "direction_axis_pos", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "direction_axis_pos", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "mode");
 	RNA_def_property_enum_items(prop, prop_direction_pos_items);
 	RNA_def_property_ui_text(prop, "Direction", "Select the axis to be aligned along the reference direction");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "rotation_max", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "rotation_max", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "maxrot");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_range(prop, -2000.0, 2000.0, 10, 2);
 	RNA_def_property_ui_text(prop, "Reference Direction", "Reference Direction");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	//XXX TODO - use radians internally then change to PROP_ANGLE
-	prop= RNA_def_property(srna, "angle_min", PROP_FLOAT, PROP_NONE);
+	/*XXX TODO - use radians internally then change to PROP_ANGLE */
+	prop = RNA_def_property(srna, "angle_min", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "minloc[0]");
 	RNA_def_property_range(prop, 0.0, 180.0);
-	RNA_def_property_ui_text(prop, "Min Angle", "Minimum angle (in degree) to maintain with target direction (no correction is done if angle with target direction is between min and max)");
+	RNA_def_property_ui_text(prop, "Min Angle",
+	                         "Minimum angle (in degree) to maintain with target direction "
+	                         "(no correction is done if angle with target direction is between min and max)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	//XXX TODO - use radians internally then change to PROP_ANGLE
-	prop= RNA_def_property(srna, "angle_max", PROP_FLOAT, PROP_NONE);
+	/*XXX TODO - use radians internally then change to PROP_ANGLE */
+	prop = RNA_def_property(srna, "angle_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "maxloc[0]");
 	RNA_def_property_range(prop, 0.0, 180.0);
-	RNA_def_property_ui_text(prop, "Max Angle", "Maximum angle (in degree) allowed with target direction (no correction is done if angle with target direction is between min and max)");
+	RNA_def_property_ui_text(prop, "Max Angle",
+	                         "Maximum angle (in degree) allowed with target direction "
+	                         "(no correction is done if angle with target direction is between min and max)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* ACT_CONST_TYPE_FH */
-	prop= RNA_def_property(srna, "fh_height", PROP_FLOAT, PROP_NONE);
-	RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_fhheight_get", "rna_ConstraintActuator_fhheight_set", NULL);
+	prop = RNA_def_property(srna, "fh_height", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_fhheight_get",
+	                             "rna_ConstraintActuator_fhheight_set", NULL);
 	RNA_def_property_ui_range(prop, 0.01, 2000.0, 10, 2);
 	RNA_def_property_ui_text(prop, "Distance", "Height of the force field area");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "fh_force", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "fh_force", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_funcs(prop, "rna_ConstraintActuator_spring_get", "rna_ConstraintActuator_spring_set", NULL);
 	RNA_def_property_ui_range(prop, 0.0, 1.0, 10, 2);
 	RNA_def_property_ui_text(prop, "Force", "Spring force within the force field area");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "fh_damping", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "fh_damping", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "maxrot[0]");
 	RNA_def_property_ui_range(prop, 0.0, 1.0, 10, 2);
 	RNA_def_property_ui_text(prop, "Damping", "Damping factor of the force field spring");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* booleans */
-	prop= RNA_def_property(srna, "use_force_distance", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_force_distance", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_DISTANCE);
 	RNA_def_property_ui_text(prop, "Force Distance", "Force distance of object to point of impact of ray");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_local", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_local", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_LOCAL);
 	RNA_def_property_ui_text(prop, "L", "Set ray along object's axis or global axis");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_NORMAL);
-	RNA_def_property_ui_text(prop, "N", "Set object axis along (local axis) or parallel (global axis) to the normal at hit position");
+	RNA_def_property_ui_text(prop, "N",
+	                         "Set object axis along (local axis) or parallel (global axis) to the normal at "
+	                         "hit position");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_persistent", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_persistent", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_PERMANENT);
 	RNA_def_property_ui_text(prop, "PER", "Persistent actuator: stays active even if ray does not reach target");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	//XXX to use an enum instead of a flag if possible
-	prop= RNA_def_property(srna, "use_material_detect", PROP_BOOLEAN, PROP_NONE);
+	/*XXX to use an enum instead of a flag if possible */
+	prop = RNA_def_property(srna, "use_material_detect", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_MATERIAL);
 	RNA_def_property_ui_text(prop, "M/P", "Detect material instead of property");
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_Actuator_constraint_detect_material_set");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_fh_paralel_axis", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_fh_paralel_axis", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_DOROTFH);
 	RNA_def_property_ui_text(prop, "Rot Fh", "Keep object axis parallel to normal");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_fh_normal", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_fh_normal", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_CONST_NORMAL);
 	RNA_def_property_ui_text(prop, "N", "Add a horizontal spring force on slopes");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -1276,7 +1304,7 @@ static void rna_def_edit_object_actuator(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static EnumPropertyItem prop_dyn_items[] ={
+	static EnumPropertyItem prop_dyn_items[] = {
 		{ACT_EDOB_RESTORE_DYN, "RESTOREDYN", 0, "Restore Dynamics", ""},
 		{ACT_EDOB_SUSPEND_DYN, "SUSPENDDYN", 0, "Suspend Dynamics", ""},
 		{ACT_EDOB_ENABLE_RB, "ENABLERIGIDBODY", 0, "Enable Rigid Body", ""},
@@ -1284,7 +1312,7 @@ static void rna_def_edit_object_actuator(BlenderRNA *brna)
 		{ACT_EDOB_SET_MASS, "SETMASS", 0, "Set Mass", ""},
 		{0, NULL, 0, NULL, NULL} };
 
-	static EnumPropertyItem prop_type_items[] ={
+	static EnumPropertyItem prop_type_items[] = {
 	{ACT_EDOB_ADD_OBJECT, "ADDOBJECT", 0, "Add Object", ""},
 	{ACT_EDOB_END_OBJECT, "ENDOBJECT", 0, "End Object", ""},
 	{ACT_EDOB_REPLACE_MESH, "REPLACEMESH", 0, "Replace Mesh", ""},
@@ -1292,64 +1320,65 @@ static void rna_def_edit_object_actuator(BlenderRNA *brna)
 	{ACT_EDOB_DYNAMICS, "DYNAMICS", 0, "Dynamics", ""},
 	{0, NULL, 0, NULL, NULL} };
 
-	srna= RNA_def_struct(brna, "EditObjectActuator", "Actuator");
+	srna = RNA_def_struct(brna, "EditObjectActuator", "Actuator");
 	RNA_def_struct_ui_text(srna, "Edit Object Actuator", "Actuator used to edit objects");
 	RNA_def_struct_sdna_from(srna, "bEditObjectActuator", "data");
 
-	prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_ui_text(prop, "Edit Object", "The mode of the actuator");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "dynamic_operation", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "dynamic_operation", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "dyn_operation");
 	RNA_def_property_enum_items(prop, prop_dyn_items);
 	RNA_def_property_ui_text(prop, "Dynamic Operation", "");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_pointer_sdna(prop, NULL, "ob");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Object", "Add this Object and all its children (can't be on a visible layer)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "track_object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "track_object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_pointer_sdna(prop, NULL, "ob");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Object", "Track to this Object");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 	
-	prop= RNA_def_property(srna, "mesh", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "mesh", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Mesh");
 	RNA_def_property_pointer_sdna(prop, NULL, "me");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "Mesh", "Replace the existing, when left blank 'Phys' will remake the existing physics mesh");
+	RNA_def_property_ui_text(prop, "Mesh",
+	                         "Replace the existing, when left blank 'Phys' will remake the existing physics mesh");
 	/* note: custom set function is ONLY to avoid rna setting a user for this. */
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_Actuator_editobject_mesh_set", NULL, NULL);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "time", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "time", PROP_INT, PROP_NONE);
 	RNA_def_property_ui_range(prop, 0, 2000, 1, 1);
 	RNA_def_property_ui_text(prop, "Time", "Duration the new Object lives or the track takes");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_ui_range(prop, 0, 10000, 1, 2);
 	RNA_def_property_ui_text(prop, "Mass", "The mass of the object");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* floats 3 Arrays*/
-	prop= RNA_def_property(srna, "linear_velocity", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "linear_velocity", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "linVelocity");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_range(prop, -100.0, 100.0, 10, 2);
 	RNA_def_property_ui_text(prop, "Linear Velocity", "Velocity upon creation");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "angVelocity");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 2);
@@ -1357,27 +1386,28 @@ static void rna_def_edit_object_actuator(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* booleans */
-	prop= RNA_def_property(srna, "use_local_linear_velocity", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_local_linear_velocity", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "localflag", ACT_EDOB_LOCAL_LINV);
 	RNA_def_property_ui_text(prop, "L", "Apply the transformation locally");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_local_angular_velocity", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_local_angular_velocity", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "localflag", ACT_EDOB_LOCAL_ANGV);
 	RNA_def_property_ui_text(prop, "L", "Apply the rotation locally");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_replace_display_mesh", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_replace_display_mesh", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ACT_EDOB_REPLACE_MESH_NOGFX);
 	RNA_def_property_ui_text(prop, "Gfx", "Replace the display mesh");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_replace_physics_mesh", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_replace_physics_mesh", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_EDOB_REPLACE_MESH_PHYS);
-	RNA_def_property_ui_text(prop, "Phys", "Replace the physics mesh (triangle bounds only - compound shapes not supported)");
+	RNA_def_property_ui_text(prop, "Phys",
+	                         "Replace the physics mesh (triangle bounds only - compound shapes not supported)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_3d_tracking", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_3d_tracking", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_TRACK_3D);
 	RNA_def_property_ui_text(prop, "3D", "Enable 3D tracking");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -1388,7 +1418,7 @@ static void rna_def_scene_actuator(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static EnumPropertyItem prop_type_items[] ={
+	static EnumPropertyItem prop_type_items[] = {
 		{ACT_SCENE_RESTART, "RESTART", 0, "Restart", ""},
 		{ACT_SCENE_SET, "SET", 0, "Set Scene", ""},
 		{ACT_SCENE_CAMERA, "CAMERA", 0, "Set Camera", ""},
@@ -1397,45 +1427,45 @@ static void rna_def_scene_actuator(BlenderRNA *brna)
 		{ACT_SCENE_REMOVE, "REMOVE", 0, "Remove Scene", ""},
 		{ACT_SCENE_SUSPEND, "SUSPEND", 0, "Suspend Scene", ""},
 		{ACT_SCENE_RESUME, "RESUME", 0, "Resume Scene", ""},
-		{0, NULL, 0, NULL, NULL}};	
+		{0, NULL, 0, NULL, NULL}};
 		
-	srna= RNA_def_struct(brna, "SceneActuator", "Actuator");
+	srna = RNA_def_struct(brna, "SceneActuator", "Actuator");
 	RNA_def_struct_ui_text(srna, "Scene Actuator", "");
 	RNA_def_struct_sdna_from(srna, "bSceneActuator", "data");
 
-	prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_ui_text(prop, "Mode", "");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 	
-	//XXX filter only camera objects
-	prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
+	/*XXX filter only camera objects */
+	prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Camera Object", "Set this Camera (leave empty to refer to self object)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Scene");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Scene", "Scene to be added/removed/paused/resumed");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* XXX no need for those tooltips. to remove soon
-	Originally we had different 'scene' tooltips for different values of 'type'.
-	They were:
-	ACT_SCENE_RESTART	""
-	ACT_SCENE_CAMERA	""
-	ACT_SCENE_SET		"Set this Scene"
-	ACT_SCENE_ADD_FRONT	"Add an Overlay Scene"
-	ACT_SCENE_ADD_BACK	"Add a Background Scene"
-	ACT_SCENE_REMOVE	"Remove a Scene"
-	ACT_SCENE_SUSPEND	"Pause a Scene"
-	ACT_SCENE_RESUME	"Unpause a Scene"
-
-	It can be done in the ui script if still needed.
-	*/
+	 * Originally we had different 'scene' tooltips for different values of 'type'.
+	 * They were:
+	 * ACT_SCENE_RESTART	""
+	 * ACT_SCENE_CAMERA	""
+	 * ACT_SCENE_SET		"Set this Scene"
+	 * ACT_SCENE_ADD_FRONT	"Add an Overlay Scene"
+	 * ACT_SCENE_ADD_BACK	"Add a Background Scene"
+	 * ACT_SCENE_REMOVE	"Remove a Scene"
+	 * ACT_SCENE_SUSPEND	"Pause a Scene"
+	 * ACT_SCENE_RESUME	"Unpause a Scene"
+	 *
+	 * It can be done in the ui script if still needed.
+	 */
 	
 }
 
@@ -1444,7 +1474,7 @@ static void rna_def_random_actuator(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static EnumPropertyItem prop_distribution_items[] ={
+	static EnumPropertyItem prop_distribution_items[] = {
 		{ACT_RANDOM_BOOL_CONST, "BOOL_CONSTANT", 0, "Bool Constant", ""},
 		{ACT_RANDOM_BOOL_UNIFORM, "BOOL_UNIFORM", 0, "Bool Uniform", ""},
 		{ACT_RANDOM_BOOL_BERNOUILLI, "BOOL_BERNOUILLI", 0, "Bool Bernoulli", ""},
@@ -1455,24 +1485,26 @@ static void rna_def_random_actuator(BlenderRNA *brna)
 		{ACT_RANDOM_FLOAT_UNIFORM, "FLOAT_UNIFORM", 0, "Float Uniform", ""},
 		{ACT_RANDOM_FLOAT_NORMAL, "FLOAT_NORMAL", 0, "Float Normal", ""},
 		{ACT_RANDOM_FLOAT_NEGATIVE_EXPONENTIAL, "FLOAT_NEGATIVE_EXPONENTIAL", 0, "Float Neg. Exp.", ""},
-		{0, NULL, 0, NULL, NULL}};	
+		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "RandomActuator", "Actuator");
+	srna = RNA_def_struct(brna, "RandomActuator", "Actuator");
 	RNA_def_struct_ui_text(srna, "Random Actuator", "");
 	RNA_def_struct_sdna_from(srna, "bRandomActuator", "data");
 
-	prop= RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
 	RNA_def_property_ui_range(prop, 0, 1000, 1, 1);
 	RNA_def_property_range(prop, 0, MAXFRAME);
-	RNA_def_property_ui_text(prop, "Seed", "Initial seed of the random generator, use Python for more freedom (choose 0 for not random)");
+	RNA_def_property_ui_text(prop, "Seed",
+	                         "Initial seed of the random generator, use Python for more freedom "
+	                         "(choose 0 for not random)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "propname");
 	RNA_def_property_ui_text(prop, "Property", "Assign the random value to this property");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, prop_distribution_items);
 	RNA_def_property_ui_text(prop, "Distribution", "Choose the type of distribution");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -1481,83 +1513,83 @@ static void rna_def_random_actuator(BlenderRNA *brna)
 	/* int_arg_1, int_arg_2, float_arg_1, float_arg_2 */
 
 	/* ACT_RANDOM_BOOL_CONST */
-	prop= RNA_def_property(srna, "use_always_true", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_always_true", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "int_arg_1", 1);
 	RNA_def_property_ui_text(prop, "Always True", "Always false or always true");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* ACT_RANDOM_BOOL_UNIFORM */
-	// label => "Choose between true and false, 50% chance each"
+	/* label => "Choose between true and false, 50% chance each" */
 
 	/* ACT_RANDOM_BOOL_BERNOUILLI */
-	prop= RNA_def_property(srna, "chance", PROP_FLOAT, PROP_PERCENTAGE);
+	prop = RNA_def_property(srna, "chance", PROP_FLOAT, PROP_PERCENTAGE);
 	RNA_def_property_float_sdna(prop, NULL, "float_arg_1");
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_text(prop, "Chance", "Pick a number between 0 and 1, success if it's below this value");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* ACT_RANDOM_INT_CONST */
-	prop= RNA_def_property(srna, "int_value", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "int_value", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "int_arg_1");
 	RNA_def_property_ui_range(prop, -1000, 1000, 1, 1);
 	RNA_def_property_ui_text(prop, "Value", "Always return this number");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* ACT_RANDOM_INT_UNIFORM */
-	prop= RNA_def_property(srna, "int_min", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "int_min", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "int_arg_1");
 	RNA_def_property_range(prop, -1000, 1000);
 	RNA_def_property_ui_text(prop, "Min", "Choose a number from a range: lower boundary of the range");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "int_max", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "int_max", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "int_arg_2");
 	RNA_def_property_range(prop, -1000, 1000);
 	RNA_def_property_ui_text(prop, "Max", "Choose a number from a range: upper boundary of the range");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* ACT_RANDOM_INT_POISSON */
-	prop= RNA_def_property(srna, "int_mean", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "int_mean", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "float_arg_1");
 	RNA_def_property_range(prop, 0.01, 100.0);
 	RNA_def_property_ui_text(prop, "Mean", "Expected mean value of the distribution");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* ACT_RANDOM_FLOAT_CONST */
-	prop= RNA_def_property(srna, "float_value", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "float_value", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "float_arg_1");
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_text(prop, "Value", "Always return this number");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* ACT_RANDOM_FLOAT_UNIFORM */
-	prop= RNA_def_property(srna, "float_min", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "float_min", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "float_arg_1");
 	RNA_def_property_range(prop, -1000.0, 1000.0);
 	RNA_def_property_ui_text(prop, "Min", "Choose a number from a range: lower boundary of the range");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "float_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "float_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "float_arg_2");
 	RNA_def_property_range(prop, -1000.0, 1000.0);
 	RNA_def_property_ui_text(prop, "Max", "Choose a number from a range: upper boundary of the range");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* ACT_RANDOM_FLOAT_NORMAL */
-	prop= RNA_def_property(srna, "float_mean", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "float_mean", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "float_arg_1");
 	RNA_def_property_range(prop, -1000.0, 1000.0);
 	RNA_def_property_ui_text(prop, "Mean", "A normal distribution: mean of the distribution");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "standard_derivation", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "standard_derivation", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "float_arg_2");
 	RNA_def_property_range(prop, -1000.0, 1000.0);
 	RNA_def_property_ui_text(prop, "SD", "A normal distribution: standard deviation of the distribution");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* ACT_RANDOM_FLOAT_NEGATIVE_EXPONENTIAL */
-	prop= RNA_def_property(srna, "half_life_time", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "half_life_time", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "float_arg_1");
 	RNA_def_property_range(prop, -1000.0, 1000.0);
 	RNA_def_property_ui_text(prop, "Half-Life Time", "Negative exponential dropoff");
@@ -1569,37 +1601,38 @@ static void rna_def_message_actuator(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static EnumPropertyItem prop_body_type_items[] ={
+	static EnumPropertyItem prop_body_type_items[] = {
 		{ACT_MESG_MESG, "TEXT", 0, "Text", ""},
 		{ACT_MESG_PROP, "PROPERTY", 0, "Property", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "MessageActuator", "Actuator");
+	srna = RNA_def_struct(brna, "MessageActuator", "Actuator");
 	RNA_def_struct_ui_text(srna, "Message Actuator", "");
 	RNA_def_struct_sdna_from(srna, "bMessageActuator", "data");
 
-	prop= RNA_def_property(srna, "to_property", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "to_property", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "toPropName");
-	RNA_def_property_ui_text(prop, "To", "Optional, send message to objects with this name only, or empty to broadcast");
+	RNA_def_property_ui_text(prop, "To",
+	                         "Optional, send message to objects with this name only, or empty to broadcast");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "subject", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "subject", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Subject", "Optional, message subject (this is what can be filtered on)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "body_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "body_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "bodyType");
 	RNA_def_property_enum_items(prop, prop_body_type_items);
 	RNA_def_property_ui_text(prop, "Body", "Toggle message type: either Text or a PropertyName");
 
 	/* ACT_MESG_MESG */
-	prop= RNA_def_property(srna, "body_message", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "body_message", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "body");
 	RNA_def_property_ui_text(prop, "Body", "Optional, message body Text");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 	
 	/* ACT_MESG_PROP */
-	prop= RNA_def_property(srna, "body_property", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "body_property", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "body");
 	RNA_def_property_ui_text(prop, "Prop Name", "The message body will be set by the Property Value");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -1610,11 +1643,11 @@ static void rna_def_game_actuator(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static EnumPropertyItem prop_type_items[] ={
-//		{ACT_GAME_LOAD, "LOAD", 0, "Load Game", ""},
-//		{ACT_GAME_START, "START", 0, "Start Loaded Game", ""},	
-//		keeping the load/start hacky for compatibility with 2.49
-//		ideally we could use ACT_GAME_START again and do a do_version()
+	static EnumPropertyItem prop_type_items[] = {
+/*		{ACT_GAME_LOAD, "LOAD", 0, "Load Game", ""}, */
+/*		{ACT_GAME_START, "START", 0, "Start Loaded Game", ""},	 */
+/*		keeping the load/start hacky for compatibility with 2.49 */
+/*		ideally we could use ACT_GAME_START again and do a do_version() */
 
 		{ACT_GAME_LOAD, "START", 0, "Start Game From File", ""},
 		{ACT_GAME_RESTART, "RESTART", 0, "Restart Game", ""},
@@ -1623,21 +1656,23 @@ static void rna_def_game_actuator(BlenderRNA *brna)
 		{ACT_GAME_LOADCFG, "LOADCFG", 0, "Load bge.logic.globalDict", ""},
 		{0, NULL, 0, NULL, NULL}};
 	
-	srna= RNA_def_struct(brna, "GameActuator", "Actuator");
+	srna = RNA_def_struct(brna, "GameActuator", "Actuator");
 	RNA_def_struct_ui_text(srna, "Game Actuator", "");
 	RNA_def_struct_sdna_from(srna, "bGameActuator", "data");
 
-	prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_ui_text(prop, "Game", "");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* ACT_GAME_LOAD */
-	prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH);
-	RNA_def_property_ui_text(prop, "File", "Load this blend file, use the \"//\" prefix for a path relative to the current blend file");
+	prop = RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH);
+	RNA_def_property_ui_text(prop, "File",
+	                         "Load this blend file, use the \"//\" prefix for a path relative to the current "
+	                         "blend file");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
-	//XXX to do: an operator that calls file_browse with relative_path on and blender filtering active
+	/*XXX to do: an operator that calls file_browse with relative_path on and blender filtering active */
 }
 
 static void rna_def_visibility_actuator(BlenderRNA *brna)
@@ -1645,23 +1680,28 @@ static void rna_def_visibility_actuator(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "VisibilityActuator", "Actuator");
+	srna = RNA_def_struct(brna, "VisibilityActuator", "Actuator");
 	RNA_def_struct_ui_text(srna, "Visibility Actuator", "Actuator to set visibility and occlusion of the object");
 	RNA_def_struct_sdna_from(srna, "bVisibilityActuator", "data");
 
-	prop= RNA_def_property(srna, "use_visible", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_visible", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ACT_VISIBILITY_INVISIBLE);
-	RNA_def_property_ui_text(prop, "Visible", "Set the objects visible (initialized from the object render restriction toggle in physics button)");
+	RNA_def_property_ui_text(prop, "Visible",
+	                         "Set the objects visible (initialized from the object render restriction toggle in "
+	                         "physics button)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_occlusion", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_occlusion", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_VISIBILITY_OCCLUSION);
-	RNA_def_property_ui_text(prop, "Occlusion", "Set the object to occlude objects behind it (initialized from the object type in physics button)");
+	RNA_def_property_ui_text(prop, "Occlusion",
+	                         "Set the object to occlude objects behind it (initialized from the object type in "
+	                         "physics button)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "apply_to_children", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "apply_to_children", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_VISIBILITY_RECURSIVE);
-	RNA_def_property_ui_text(prop, "Children", "Set all the children of this object to the same visibility/occlusion recursively");
+	RNA_def_property_ui_text(prop, "Children",
+	                         "Set all the children of this object to the same visibility/occlusion recursively");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 }
 
@@ -1670,7 +1710,7 @@ static void rna_def_twodfilter_actuator(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static EnumPropertyItem prop_type_items[] ={
+	static EnumPropertyItem prop_type_items[] = {
 		{ACT_2DFILTER_ENABLED, "ENABLE", 0, "Enable Filter", ""},
 		{ACT_2DFILTER_DISABLED, "DISABLE", 0, "Disable Filter", ""},
 		{ACT_2DFILTER_NOFILTER, "REMOVE", 0, "Remove Filter", ""},
@@ -1686,40 +1726,40 @@ static void rna_def_twodfilter_actuator(BlenderRNA *brna)
 		{ACT_2DFILTER_SEPIA, "SEPIA", 0, "Sepia", ""},
 		{ACT_2DFILTER_INVERT, "INVERT", 0, "Invert", ""},
 		{ACT_2DFILTER_CUSTOMFILTER, "CUSTOMFILTER", 0, "Custom Filter", ""},
-//		{ACT_2DFILTER_NUMBER_OF_FILTERS, "", 0, "Do not use it. Sentinel", ""},
+/*		{ACT_2DFILTER_NUMBER_OF_FILTERS, "", 0, "Do not use it. Sentinel", ""}, */
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "Filter2DActuator", "Actuator");
+	srna = RNA_def_struct(brna, "Filter2DActuator", "Actuator");
 	RNA_def_struct_ui_text(srna, "Filter 2D Actuator", "Actuator to apply screen graphic effects");
 	RNA_def_struct_sdna_from(srna, "bTwoDFilterActuator", "data");
 
-	prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_ui_text(prop, "Filter 2D Type", "");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "glsl_shader", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "glsl_shader", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "text");
 	RNA_def_property_struct_type(prop, "Text");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Script", "");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "filter_pass", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "filter_pass", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "int_arg");
 	RNA_def_property_ui_text(prop, "Pass Number", "Set filter order");
-	RNA_def_property_range(prop, 0, 99); //MAX_RENDER_PASS-1
+	RNA_def_property_range(prop, 0, 99); /*MAX_RENDER_PASS-1 */
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "motion_blur_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "motion_blur_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "float_arg");
 	RNA_def_property_ui_text(prop, "Value", "Motion blur factor");
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 	
 	/* booleans */
-	prop= RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", 1);
 	RNA_def_property_ui_text(prop, "Enable", "Enable/Disable Motion Blur");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -1730,22 +1770,22 @@ static void rna_def_parent_actuator(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	static EnumPropertyItem prop_type_items[] ={
+	static EnumPropertyItem prop_type_items[] = {
 		{ACT_PARENT_SET, "SETPARENT", 0, "Set Parent", ""},
 		{ACT_PARENT_REMOVE, "REMOVEPARENT", 0, "Remove Parent", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "ParentActuator", "Actuator");
+	srna = RNA_def_struct(brna, "ParentActuator", "Actuator");
 	RNA_def_struct_ui_text(srna, "Parent Actuator", "");
 	RNA_def_struct_sdna_from(srna, "bParentActuator", "data");
 
-	prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_ui_text(prop, "Scene", "");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 	
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_pointer_sdna(prop, NULL, "ob");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
@@ -1753,12 +1793,14 @@ static void rna_def_parent_actuator(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* booleans */
-	prop= RNA_def_property(srna, "use_compound", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_compound", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ACT_PARENT_COMPOUND);
-	RNA_def_property_ui_text(prop, "Compound", "Add this object shape to the parent shape (only if the parent shape is already compound)");
+	RNA_def_property_ui_text(prop, "Compound",
+	                         "Add this object shape to the parent shape "
+	                         "(only if the parent shape is already compound)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_ghost", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_ghost", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ACT_PARENT_GHOST);
 	RNA_def_property_ui_text(prop, "Ghost", "Make this object ghost while parented");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -1769,7 +1811,7 @@ static void rna_def_shape_action_actuator(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static EnumPropertyItem prop_type_items[] ={
+	static EnumPropertyItem prop_type_items[] = {
 		{ACT_ACTION_PLAY, "PLAY", 0, "Play", ""},
 		{ACT_ACTION_PINGPONG, "PINGPONG", 0, "Ping Pong", ""},
 		{ACT_ACTION_FLIPPER, "FLIPPER", 0, "Flipper", ""},
@@ -1781,17 +1823,17 @@ static void rna_def_shape_action_actuator(BlenderRNA *brna)
 #endif
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "ShapeActionActuator", "Actuator");
+	srna = RNA_def_struct(brna, "ShapeActionActuator", "Actuator");
 	RNA_def_struct_ui_text(srna, "Shape Action Actuator", "Actuator to control shape key animations");
 	RNA_def_struct_sdna_from(srna, "bActionActuator", "data");
 
-	prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_ui_text(prop, "Action Type", "Action playback type");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "act");
 	RNA_def_property_struct_type(prop, "Action");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
@@ -1800,46 +1842,49 @@ static void rna_def_shape_action_actuator(BlenderRNA *brna)
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_Actuator_action_action_set", NULL, NULL);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_continue_last_frame", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_continue_last_frame", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "end_reset", 1);
-	RNA_def_property_ui_text(prop, "Continue", "Restore last frame when switching on/off, otherwise play from the start each time");
+	RNA_def_property_ui_text(prop, "Continue",
+	                         "Restore last frame when switching on/off, otherwise play from the start each time");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 	
-	prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "name");
 	RNA_def_property_ui_text(prop, "Property", "Use this property to define the Action position");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "sta");
 	RNA_def_property_ui_range(prop, 0.0, MAXFRAME, 100, 2);
 	RNA_def_property_ui_text(prop, "Start Frame", "");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "end");
 	RNA_def_property_ui_range(prop, 0.0, MAXFRAME, 100, 2);
 	RNA_def_property_ui_text(prop, "End Frame", "");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "frame_blend_in", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_blend_in", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "blendin");
 	RNA_def_property_range(prop, 0, 32767);
 	RNA_def_property_ui_text(prop, "Blendin", "Number of frames of motion blending");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "priority", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "priority", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, 0, 100);
-	RNA_def_property_ui_text(prop, "Priority", "Execution priority - lower numbers will override actions with higher numbers (with 2 or more actions at once, the overriding channels must be lower in the stack)");
+	RNA_def_property_ui_text(prop, "Priority",
+	                         "Execution priority - lower numbers will override actions with higher numbers "
+	                         "(with 2 or more actions at once, the overriding channels must be lower in the stack)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "frame_property", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_property", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "frameProp");
 	RNA_def_property_ui_text(prop, "Frame Property", "Assign the action's current frame number to this property");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 #ifdef __NLA_ACTION_BY_MOTION_ACTUATOR
-	prop= RNA_def_property(srna, "stride_length", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "stride_length", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "stridelength");
 	RNA_def_property_range(prop, 0.0, 2500.0);
 	RNA_def_property_ui_text(prop, "Cycle", "Distance covered by a single cycle of the action");
@@ -1852,24 +1897,24 @@ static void rna_def_state_actuator(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static EnumPropertyItem prop_type_items[] ={
+	static EnumPropertyItem prop_type_items[] = {
 		{ACT_STATE_SET, "SET", 0, "Set State", ""},
 		{ACT_STATE_ADD, "ADD", 0, "Add State", ""},
 		{ACT_STATE_REMOVE, "REMOVE", 0, "Remove State", ""},
 		{ACT_STATE_CHANGE, "CHANGE", 0, "Change State", ""},
 		{0, NULL, 0, NULL, NULL}};
 	
-	srna= RNA_def_struct(brna, "StateActuator", "Actuator");
+	srna = RNA_def_struct(brna, "StateActuator", "Actuator");
 	RNA_def_struct_ui_text(srna, "State Actuator", "Actuator to handle states");
 	RNA_def_struct_sdna_from(srna, "bStateActuator", "data");
 
-	prop= RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_ui_text(prop, "Operation", "Select the bit operation on object state mask");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	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_boolean_sdna(prop, NULL, "mask", 1);
 	RNA_def_property_array(prop, OB_MAX_STATES);
 	RNA_def_property_ui_text(prop, "State", "");
@@ -1881,52 +1926,61 @@ static void rna_def_armature_actuator(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA* prop;
 
-	static EnumPropertyItem prop_type_items[] ={
+	static EnumPropertyItem prop_type_items[] = {
 		{ACT_ARM_RUN, "RUN", 0, "Run Armature", ""},
 		{ACT_ARM_ENABLE, "ENABLE", 0, "Enable", ""},
 		{ACT_ARM_DISABLE, "DISABLE", 0, "Disable", ""},
 		{ACT_ARM_SETTARGET, "SETTARGET", 0, "Set Target", ""},
 		{ACT_ARM_SETWEIGHT, "SETWEIGHT", 0, "Set Weight", ""},
+		{ACT_ARM_SETINFLUENCE, "SETINFLUENCE", 0, "Set Influence", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "ArmatureActuator", "Actuator");
+	srna = RNA_def_struct(brna, "ArmatureActuator", "Actuator");
 	RNA_def_struct_ui_text(srna, "Armature Actuator", "");
 	RNA_def_struct_sdna_from(srna, "bArmatureActuator", "data");
 
-	prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_ui_text(prop, "Constraint Type", "");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "bone", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "bone", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "posechannel");
 	RNA_def_property_ui_text(prop, "Bone", "Bone on which the constraint is defined");
 	RNA_def_property_update(prop, NC_LOGIC, "rna_Actuator_Armature_update");
 
-	prop= RNA_def_property(srna, "constraint", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "constraint", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "constraint");
 	RNA_def_property_ui_text(prop, "Constraint", "Name of the constraint to control");
 	RNA_def_property_update(prop, NC_LOGIC, "rna_Actuator_Armature_update");
 
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Target", "Set this object as the target of the constraint");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "secondary_target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "secondary_target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "subtarget");
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "Secondary Target", "Set this object as the secondary target of the constraint (only IK polar target at the moment)");
+	RNA_def_property_ui_text(prop, "Secondary Target",
+	                         "Set this object as the secondary target of the constraint "
+	                         "(only IK polar target at the moment)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "weight");
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_text(prop, "Weight", "Weight of this constraint");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
+
+	prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "influence");
+	RNA_def_property_range(prop, 0.0, 1.0);
+	RNA_def_property_ui_text(prop, "Influence", "Influence of this constraint");
+	RNA_def_property_update(prop, NC_LOGIC, NULL);
 }
 
 static void rna_def_steering_actuator(BlenderRNA *brna)
@@ -1934,13 +1988,13 @@ static void rna_def_steering_actuator(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static EnumPropertyItem prop_type_items[] ={
+	static EnumPropertyItem prop_type_items[] = {
 		{ACT_STEERING_SEEK, "SEEK", 0, "Seek", ""},
 		{ACT_STEERING_FLEE, "FLEE", 0, "Flee", ""},
 		{ACT_STEERING_PATHFOLLOWING, "PATHFOLLOWING", 0, "Path following", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	static EnumPropertyItem facingaxis_items[] ={
+	static EnumPropertyItem facingaxis_items[] = {
 		{1, "X", 0, "X", ""},
 		{2, "Y", 0, "Y", ""},
 		{3, "Z", 0, "Z", ""},
@@ -1949,64 +2003,64 @@ static void rna_def_steering_actuator(BlenderRNA *brna)
 		{6, "NEG_Z", 0, "-Z", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "SteeringActuator", "Actuator");
+	srna = RNA_def_struct(brna, "SteeringActuator", "Actuator");
 	RNA_def_struct_ui_text(srna, "Steering Actuator", "");
 	RNA_def_struct_sdna_from(srna, "bSteeringActuator", "data");
 
-	prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_ui_text(prop, "Behavior", "");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "velocity");
 	RNA_def_property_range(prop, 0.0, 1000.0);
 	RNA_def_property_ui_text(prop, "Velocity", "Velocity magnitude");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "acceleration", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "acceleration", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "acceleration");
 	RNA_def_property_range(prop, 0.0, 1000.0);
 	RNA_def_property_ui_text(prop, "Acceleration", "Max acceleration");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "turn_speed", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "turn_speed", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "turnspeed");
 	RNA_def_property_range(prop, 0.0, 720.0);
 	RNA_def_property_ui_text(prop, "Turn Speed", "Max turn speed");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "dist");
 	RNA_def_property_range(prop, 0.0, 1000.0);
 	RNA_def_property_ui_text(prop, "Dist", "Relax distance");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_pointer_sdna(prop, NULL, "target");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Target Object", "Target object");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "self_terminated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "self_terminated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_STEERING_SELFTERMINATED);
 	RNA_def_property_ui_text(prop, "Self Terminated", "Terminate when target is reached");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "show_visualization", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_visualization", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_STEERING_ENABLEVISUALIZATION);
 	RNA_def_property_ui_text(prop, "Visualize", "Enable debug visualization");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "update_period", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "update_period", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "updateTime");
 	RNA_def_property_ui_range(prop, -1, 100000, 1, 1);
 	RNA_def_property_ui_text(prop, "Update period", "Path update period");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "navmesh", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "navmesh", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_pointer_sdna(prop, NULL, "navmesh");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
@@ -2014,18 +2068,18 @@ static void rna_def_steering_actuator(BlenderRNA *brna)
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_SteeringActuator_navmesh_set", NULL, NULL);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "facing", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "facing", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_STEERING_AUTOMATICFACING);
 	RNA_def_property_ui_text(prop, "Facing", "Enable automatic facing");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "facing_axis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "facing_axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "facingaxis");
 	RNA_def_property_enum_items(prop, facingaxis_items);
 	RNA_def_property_ui_text(prop, "Axis", "Axis for automatic facing");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "normal_up", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "normal_up", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ACT_STEERING_NORMALUP);
 	RNA_def_property_ui_text(prop, "N", "Use normal of the navmesh to set \"UP\" vector");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -2056,4 +2110,3 @@ void RNA_def_actuator(BlenderRNA *brna)
 }
 
 #endif
-
diff --git a/source/blender/makesrna/intern/rna_actuator_api.c b/source/blender/makesrna/intern/rna_actuator_api.c
index dd289c2..68b2c4f 100644
--- a/source/blender/makesrna/intern/rna_actuator_api.c
+++ b/source/blender/makesrna/intern/rna_actuator_api.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
@@ -18,7 +18,7 @@
  * The Original Code is Copyright (C) 2010 Blender Foundation.
  * All rights reserved.
  *
- * 
+ *
  * Contributor(s):
  *
  * ***** END GPL LICENSE BLOCK *****
@@ -58,15 +58,15 @@ void RNA_api_actuator(StructRNA *srna)
 	FunctionRNA *func;
 	PropertyRNA *parm;
 
-	func= RNA_def_function(srna, "link", "rna_Actuator_link");
+	func = RNA_def_function(srna, "link", "rna_Actuator_link");
 	RNA_def_function_ui_description(func, "Link the actuator to a controller");
-	parm= RNA_def_pointer(func, "controller", "Controller", "", "Controller to link to"); 
+	parm = RNA_def_pointer(func, "controller", "Controller", "", "Controller to link to");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_property_update(parm, NC_LOGIC, NULL);
 
-	func= RNA_def_function(srna, "unlink", "rna_Actuator_unlink");
+	func = RNA_def_function(srna, "unlink", "rna_Actuator_unlink");
 	RNA_def_function_ui_description(func, "Unlink the actuator from a controller");
-	parm= RNA_def_pointer(func, "controller", "Controller", "", "Controller to unlink from"); 
+	parm = RNA_def_pointer(func, "controller", "Controller", "", "Controller to unlink from");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_property_update(parm, NC_LOGIC, NULL);
 }
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index 21e99d3..94ea790 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -60,7 +60,7 @@ EnumPropertyItem keyingset_path_grouping_items[] = {
 
 static int rna_AnimData_action_editable(PointerRNA *ptr)
 {
-	AnimData *adt= (AnimData *)ptr->data;
+	AnimData *adt = (AnimData *)ptr->data;
 	
 	/* active action is only editable when it is not a tweaking strip */
 	if ((adt->flag & ADT_NLA_EDIT_ON) || (adt->actstrip) || (adt->tmpact))
@@ -89,7 +89,7 @@ static int RKS_POLL_rna_internal(KeyingSetInfo *ksi, bContext *C)
 	int ok;
 
 	RNA_pointer_create(NULL, ksi->ext.srna, ksi, &ptr);
-	func= &rna_KeyingSetInfo_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
+	func = &rna_KeyingSetInfo_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
 
 	RNA_parameter_list_create(&list, &ptr, func);
 		/* hook up arguments */
@@ -101,7 +101,7 @@ static int RKS_POLL_rna_internal(KeyingSetInfo *ksi, bContext *C)
 		
 		/* read the result */
 		RNA_parameter_get_lookup(&list, "ok", &ret);
-		ok= *(int*)ret;
+		ok = *(int*)ret;
 	RNA_parameter_list_free(&list);
 	
 	return ok;
@@ -117,7 +117,7 @@ static void RKS_ITER_rna_internal(KeyingSetInfo *ksi, bContext *C, KeyingSet *ks
 	FunctionRNA *func;
 
 	RNA_pointer_create(NULL, ksi->ext.srna, ksi, &ptr);
-	func= &rna_KeyingSetInfo_iterator_func; /* RNA_struct_find_function(&ptr, "poll"); */
+	func = &rna_KeyingSetInfo_iterator_func; /* RNA_struct_find_function(&ptr, "poll"); */
 
 	RNA_parameter_list_create(&list, &ptr, func);
 		/* hook up arguments */
@@ -140,7 +140,7 @@ static void RKS_GEN_rna_internal(KeyingSetInfo *ksi, bContext *C, KeyingSet *ks,
 	FunctionRNA *func;
 
 	RNA_pointer_create(NULL, ksi->ext.srna, ksi, &ptr);
-	func= &rna_KeyingSetInfo_generate_func; /* RNA_struct_find_generate(&ptr, "poll"); */
+	func = &rna_KeyingSetInfo_generate_func; /* RNA_struct_find_generate(&ptr, "poll"); */
 
 	RNA_parameter_list_create(&list, &ptr, func);
 		/* hook up arguments */
@@ -156,16 +156,16 @@ static void RKS_GEN_rna_internal(KeyingSetInfo *ksi, bContext *C, KeyingSet *ks,
 
 /* ------ */
 
-// XXX: the exact purpose of this is not too clear... maybe we want to revise this at some point?
+/* XXX: the exact purpose of this is not too clear... maybe we want to revise this at some point? */
 static StructRNA *rna_KeyingSetInfo_refine(PointerRNA *ptr)
 {
-	KeyingSetInfo *ksi= (KeyingSetInfo *)ptr->data;
+	KeyingSetInfo *ksi = (KeyingSetInfo *)ptr->data;
 	return (ksi->ext.srna)? ksi->ext.srna: &RNA_KeyingSetInfo;
 }
 
 static void rna_KeyingSetInfo_unregister(Main *bmain, StructRNA *type)
 {
-	KeyingSetInfo *ksi= RNA_struct_blender_type_get(type);
+	KeyingSetInfo *ksi = RNA_struct_blender_type_get(type);
 
 	if (ksi == NULL)
 		return;
@@ -178,7 +178,8 @@ static void rna_KeyingSetInfo_unregister(Main *bmain, StructRNA *type)
 	ANIM_keyingset_info_unregister(bmain, ksi);
 }
 
-static StructRNA *rna_KeyingSetInfo_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_KeyingSetInfo_register(Main *bmain, ReportList *reports, void *data, const char *identifier,
+                                             StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
 {
 	KeyingSetInfo dummyksi = {NULL};
 	KeyingSetInfo *ksi;
@@ -186,7 +187,7 @@ static StructRNA *rna_KeyingSetInfo_register(Main *bmain, ReportList *reports, v
 	int have_function[3];
 
 	/* setup dummy type info to store static properties in */
-	// TODO: perhaps we want to get users to register as if they're using 'KeyingSet' directly instead?
+	/* TODO: perhaps we want to get users to register as if they're using 'KeyingSet' directly instead? */
 	RNA_pointer_create(NULL, &RNA_KeyingSetInfo, &dummyksi, &dummyptr);
 	
 	/* validate the python class */
@@ -194,7 +195,8 @@ static StructRNA *rna_KeyingSetInfo_register(Main *bmain, ReportList *reports, v
 		return NULL;
 	
 	if (strlen(identifier) >= sizeof(dummyksi.idname)) {
-		BKE_reportf(reports, RPT_ERROR, "Registering keying set info class: '%s' is too long, maximum length is %d", identifier, (int)sizeof(dummyksi.idname));
+		BKE_reportf(reports, RPT_ERROR, "Registering keying set info class: '%s' is too long, maximum length is %d",
+		            identifier, (int)sizeof(dummyksi.idname));
 		return NULL;
 	}
 	
@@ -204,21 +206,21 @@ static StructRNA *rna_KeyingSetInfo_register(Main *bmain, ReportList *reports, v
 		rna_KeyingSetInfo_unregister(bmain, ksi->ext.srna);
 	
 	/* create a new KeyingSetInfo type */
-	ksi= MEM_callocN(sizeof(KeyingSetInfo), "python keying set info");
+	ksi = MEM_callocN(sizeof(KeyingSetInfo), "python keying set info");
 	memcpy(ksi, &dummyksi, sizeof(KeyingSetInfo));
 	
 	/* set RNA-extensions info */
-	ksi->ext.srna= RNA_def_struct(&BLENDER_RNA, ksi->idname, "KeyingSetInfo"); 
-	ksi->ext.data= data;
-	ksi->ext.call= call;
-	ksi->ext.free= free;
+	ksi->ext.srna = RNA_def_struct(&BLENDER_RNA, ksi->idname, "KeyingSetInfo");
+	ksi->ext.data = data;
+	ksi->ext.call = call;
+	ksi->ext.free = free;
 	RNA_struct_blender_type_set(ksi->ext.srna, ksi);
 	
 	/* set callbacks */
-	// NOTE: we really should have all of these... 
-	ksi->poll= (have_function[0])? RKS_POLL_rna_internal: NULL;
-	ksi->iter= (have_function[1])? RKS_ITER_rna_internal: NULL;
-	ksi->generate= (have_function[2])? RKS_GEN_rna_internal: NULL;
+	/* NOTE: we really should have all of these...  */
+	ksi->poll = (have_function[0])? RKS_POLL_rna_internal: NULL;
+	ksi->iter = (have_function[1])? RKS_ITER_rna_internal: NULL;
+	ksi->generate = (have_function[2])? RKS_GEN_rna_internal: NULL;
 	
 	/* add and register with other info as needed */
 	ANIM_keyingset_info_register(ksi);
@@ -231,39 +233,39 @@ static StructRNA *rna_KeyingSetInfo_register(Main *bmain, ReportList *reports, v
 
 static StructRNA *rna_ksPath_id_typef(PointerRNA *ptr)
 {
-	KS_Path *ksp= (KS_Path*)ptr->data;
+	KS_Path *ksp = (KS_Path*)ptr->data;
 	return ID_code_to_RNA_type(ksp->idtype);
 }
 
 static int rna_ksPath_id_editable(PointerRNA *ptr)
 {
-	KS_Path *ksp= (KS_Path*)ptr->data;
+	KS_Path *ksp = (KS_Path*)ptr->data;
 	return (ksp->idtype)? PROP_EDITABLE : 0;
 }
 
 static void rna_ksPath_id_type_set(PointerRNA *ptr, int value)
 {
-	KS_Path *data= (KS_Path*)(ptr->data);
+	KS_Path *data = (KS_Path*)(ptr->data);
 	
 	/* set the driver type, then clear the id-block if the type is invalid */
-	data->idtype= value;
+	data->idtype = value;
 	if ((data->id) && (GS(data->id->name) != data->idtype))
-		data->id= NULL;
+		data->id = NULL;
 }
 
 static void rna_ksPath_RnaPath_get(PointerRNA *ptr, char *value)
 {
-	KS_Path *ksp= (KS_Path *)ptr->data;
+	KS_Path *ksp = (KS_Path *)ptr->data;
 
 	if (ksp->rna_path)
 		strcpy(value, ksp->rna_path);
 	else
-		value[0]= '\0';
+		value[0] = '\0';
 }
 
 static int rna_ksPath_RnaPath_length(PointerRNA *ptr)
 {
-	KS_Path *ksp= (KS_Path *)ptr->data;
+	KS_Path *ksp = (KS_Path *)ptr->data;
 	
 	if (ksp->rna_path)
 		return strlen(ksp->rna_path);
@@ -273,22 +275,22 @@ static int rna_ksPath_RnaPath_length(PointerRNA *ptr)
 
 static void rna_ksPath_RnaPath_set(PointerRNA *ptr, const char *value)
 {
-	KS_Path *ksp= (KS_Path *)ptr->data;
+	KS_Path *ksp = (KS_Path *)ptr->data;
 
 	if (ksp->rna_path)
 		MEM_freeN(ksp->rna_path);
 	
 	if (value[0])
-		ksp->rna_path= BLI_strdup(value);
-	else 
-		ksp->rna_path= NULL;
+		ksp->rna_path = BLI_strdup(value);
+	else
+		ksp->rna_path = NULL;
 }
 
 /* ****************************** */
 
 static int rna_KeyingSet_active_ksPath_editable(PointerRNA *ptr)
 {
-	KeyingSet *ks= (KeyingSet *)ptr->data;
+	KeyingSet *ks = (KeyingSet *)ptr->data;
 	
 	/* only editable if there are some paths to change to */
 	return (ks->paths.first != NULL);
@@ -296,52 +298,52 @@ static int rna_KeyingSet_active_ksPath_editable(PointerRNA *ptr)
 
 static PointerRNA rna_KeyingSet_active_ksPath_get(PointerRNA *ptr)
 {
-	KeyingSet *ks= (KeyingSet *)ptr->data;
+	KeyingSet *ks = (KeyingSet *)ptr->data;
 	return rna_pointer_inherit_refine(ptr, &RNA_KeyingSetPath, BLI_findlink(&ks->paths, ks->active_path-1));
 }
 
 static void rna_KeyingSet_active_ksPath_set(PointerRNA *ptr, PointerRNA value)
 {
-	KeyingSet *ks= (KeyingSet *)ptr->data;
-	KS_Path *ksp= (KS_Path*)value.data;
-	ks->active_path= BLI_findindex(&ks->paths, ksp) + 1;
+	KeyingSet *ks = (KeyingSet *)ptr->data;
+	KS_Path *ksp = (KS_Path*)value.data;
+	ks->active_path = BLI_findindex(&ks->paths, ksp) + 1;
 }
 
 static int rna_KeyingSet_active_ksPath_index_get(PointerRNA *ptr)
 {
-	KeyingSet *ks= (KeyingSet *)ptr->data;
+	KeyingSet *ks = (KeyingSet *)ptr->data;
 	return MAX2(ks->active_path-1, 0);
 }
 
 static void rna_KeyingSet_active_ksPath_index_set(PointerRNA *ptr, int value)
 {
-	KeyingSet *ks= (KeyingSet *)ptr->data;
-	ks->active_path= value+1;
+	KeyingSet *ks = (KeyingSet *)ptr->data;
+	ks->active_path = value+1;
 }
 
-static void rna_KeyingSet_active_ksPath_index_range(PointerRNA *ptr, int *min, int *max)
+static void rna_KeyingSet_active_ksPath_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
 {
-	KeyingSet *ks= (KeyingSet *)ptr->data;
+	KeyingSet *ks = (KeyingSet *)ptr->data;
 
-	*min= 0;
-	*max= BLI_countlist(&ks->paths)-1;
-	*max= MAX2(0, *max);
+	*min = 0;
+	*max = BLI_countlist(&ks->paths)-1;
+	*max = MAX2(0, *max);
 }
 
 static PointerRNA rna_KeyingSet_typeinfo_get(PointerRNA *ptr)
 {
-	KeyingSet *ks= (KeyingSet *)ptr->data;
+	KeyingSet *ks = (KeyingSet *)ptr->data;
 	KeyingSetInfo *ksi = NULL;
 	
 	/* keying set info is only for builtin Keying Sets */
-	if ((ks->flag & KEYINGSET_ABSOLUTE)==0)
+	if ((ks->flag & KEYINGSET_ABSOLUTE) == 0)
 		ksi = ANIM_keyingset_info_find_named(ks->typeinfo);
 	return rna_pointer_inherit_refine(ptr, &RNA_KeyingSetInfo, ksi);
 }
 
 
 
-static KS_Path *rna_KeyingSet_paths_add(KeyingSet *keyingset, ReportList *reports, 
+static KS_Path *rna_KeyingSet_paths_add(KeyingSet *keyingset, ReportList *reports,
 		ID *id, const char rna_path[], int index, int group_method, const char group_name[])
 {
 	KS_Path *ksp = NULL;
@@ -355,8 +357,8 @@ static KS_Path *rna_KeyingSet_paths_add(KeyingSet *keyingset, ReportList *report
 	
 	/* if data is valid, call the API function for this */
 	if (keyingset) {
-		ksp= BKE_keyingset_add_path(keyingset, id, group_name, rna_path, index, flag, group_method);
-		keyingset->active_path= BLI_countlist(&keyingset->paths); 
+		ksp = BKE_keyingset_add_path(keyingset, id, group_name, rna_path, index, flag, group_method);
+		keyingset->active_path = BLI_countlist(&keyingset->paths);
 	}
 	else {
 		BKE_report(reports, RPT_ERROR, "Keying Set Path could not be added");
@@ -374,7 +376,7 @@ static void rna_KeyingSet_paths_remove(KeyingSet *keyingset, ReportList *reports
 		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
+		/* TODO: we should get more fancy and actually check if it was removed, but this will do for now */
 		keyingset->active_path = 0;
 	}
 	else {
@@ -389,8 +391,8 @@ static void rna_KeyingSet_paths_clear(KeyingSet *keyingset, ReportList *reports)
 		KS_Path *ksp, *kspn;
 		
 		/* free each path as we go to avoid looping twice */
-		for (ksp= keyingset->paths.first; ksp; ksp= kspn) {
-			kspn= ksp->next;
+		for (ksp = keyingset->paths.first; ksp; ksp = kspn) {
+			kspn = ksp->next;
 			BKE_keyingset_free_path(keyingset, ksp);
 		}
 			
@@ -421,15 +423,15 @@ static void rna_NlaTrack_remove(AnimData *adt, bContext *C, NlaTrack *track)
 
 static PointerRNA rna_NlaTrack_active_get(PointerRNA *ptr)
 {
-	AnimData *adt= (AnimData*)ptr->data;
-	NlaTrack *track= BKE_nlatrack_find_active(&adt->nla_tracks);
+	AnimData *adt = (AnimData*)ptr->data;
+	NlaTrack *track = BKE_nlatrack_find_active(&adt->nla_tracks);
 	return rna_pointer_inherit_refine(ptr, &RNA_NlaTrack, track);
 }
 
 static void rna_NlaTrack_active_set(PointerRNA *ptr, PointerRNA value)
 {
-	AnimData *adt= (AnimData*)ptr->data;
-	NlaTrack *track= (NlaTrack*)value.data;
+	AnimData *adt = (AnimData*)ptr->data;
+	NlaTrack *track = (NlaTrack*)value.data;
 	BKE_nlatrack_set_active(&adt->nla_tracks, track);
 }
 
@@ -445,7 +447,7 @@ static FCurve *rna_Driver_from_existing(AnimData *adt, bContext *C, FCurve *src_
 		/* just make a copy of the existing one and add to self */
 		FCurve *new_fcu = copy_fcurve(src_driver);
 		
-		// XXX: if we impose any ordering on these someday, this will be problematic
+		/* XXX: if we impose any ordering on these someday, this will be problematic */
 		BLI_addtail(&adt->drivers, new_fcu);
 		return new_fcu;
 	}
@@ -459,12 +461,16 @@ static void rna_def_common_keying_flags(StructRNA *srna, short reg)
 	PropertyRNA *prop;
 
 	static EnumPropertyItem keying_flag_items[] = {
-			{INSERTKEY_NEEDED, "INSERTKEY_NEEDED", 0, "Insert Keyframes - Only Needed", "Only insert keyframes where they're needed in the relevant F-Curves"},
-			{INSERTKEY_MATRIX, "INSERTKEY_VISUAL", 0, "Insert Keyframes - Visual", "Insert keyframes based on 'visual transforms'"},
-			{INSERTKEY_XYZ2RGB, "INSERTKEY_XYZ_TO_RGB", 0, "F-Curve Colors - XYZ to RGB", "Color for newly added transformation F-Curves (Location, Rotation, Scale) and also Color is based on the transform axis"},
+			{INSERTKEY_NEEDED, "INSERTKEY_NEEDED", 0, "Insert Keyframes - Only Needed",
+			                   "Only insert keyframes where they're needed in the relevant F-Curves"},
+			{INSERTKEY_MATRIX, "INSERTKEY_VISUAL", 0, "Insert Keyframes - Visual",
+			                   "Insert keyframes based on 'visual transforms'"},
+			{INSERTKEY_XYZ2RGB, "INSERTKEY_XYZ_TO_RGB", 0, "F-Curve Colors - XYZ to RGB",
+			                    "Color for newly added transformation F-Curves (Location, Rotation, Scale) "
+			                    "and also Color is based on the transform axis"},
 			{0, NULL, 0, NULL, NULL}};
 
-	prop= RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "keyingflag");
 	RNA_def_property_enum_items(prop, keying_flag_items);
 	RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL|PROP_ENUM_FLAG);
@@ -473,6 +479,13 @@ static void rna_def_common_keying_flags(StructRNA *srna, short reg)
 
 /* --- */
 
+/* To avoid repeating it twice! */
+#define KEYINGSET_IDNAME_DOC "If this is set, the Keying Set gets a custom ID, otherwise it takes " \
+                             "the name of the class used to define the Keying Set (for example, "   \
+                             "if the class name is \"BUILTIN_KSI_location\", and bl_idname is not " \
+                             "set by the script, then bl_idname = \"BUILTIN_KSI_location\")"
+
+
 static void rna_def_keyingset_info(BlenderRNA *brna)
 {
 	StructRNA *srna;
@@ -480,7 +493,7 @@ static void rna_def_keyingset_info(BlenderRNA *brna)
 	FunctionRNA *func;
 	PropertyRNA *parm;
 	
-	srna= RNA_def_struct(brna, "KeyingSetInfo", NULL);
+	srna = RNA_def_struct(brna, "KeyingSetInfo", NULL);
 	RNA_def_struct_sdna(srna, "KeyingSetInfo");
 	RNA_def_struct_ui_text(srna, "Keying Set Info", "Callback function defines for builtin Keying Sets");
 	RNA_def_struct_refine_func(srna, "rna_KeyingSetInfo_refine");
@@ -488,50 +501,56 @@ static void rna_def_keyingset_info(BlenderRNA *brna)
 	
 	/* Properties --------------------- */
 	
-	RNA_define_verify_sdna(0); // not in sdna
-		
-	prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+	RNA_define_verify_sdna(0); /* not in sdna */
+	
+	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);
-		
-	/* Name */
-	prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE);
+	RNA_def_property_ui_text(prop, "ID Name", KEYINGSET_IDNAME_DOC);
+	
+	prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "name");
-	RNA_def_property_ui_text(prop, "Name", "");
+	RNA_def_property_ui_text(prop, "UI Name", "");
 	RNA_def_struct_name_property(srna, prop);
 	RNA_def_property_flag(prop, PROP_REGISTER);
 	
+	prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATE);
+	RNA_def_property_string_sdna(prop, NULL, "description");
+	RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
+	RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+	RNA_def_property_ui_text(prop, "Description", "A short description of the keying set");
+	
 	rna_def_common_keying_flags(srna, 1); /* '1' arg here is to indicate that we need these to be set on registering */
 	
 	RNA_define_verify_sdna(1);
 	
 	/* Function Callbacks ------------- */
 		/* poll */
-	func= RNA_def_function(srna, "poll", NULL);
+	func = RNA_def_function(srna, "poll", NULL);
 	RNA_def_function_ui_description(func, "Test if Keying Set can be used or not");
 	RNA_def_function_flag(func, FUNC_REGISTER);
 	RNA_def_function_return(func, RNA_def_boolean(func, "ok", 1, "", ""));
-	parm= RNA_def_pointer(func, "context", "Context", "", "");
+	parm = RNA_def_pointer(func, "context", "Context", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	
 		/* iterator */
-	func= RNA_def_function(srna, "iterator", NULL);
+	func = RNA_def_function(srna, "iterator", NULL);
 	RNA_def_function_ui_description(func, "Call generate() on the structs which have properties to be keyframed");
 	RNA_def_function_flag(func, FUNC_REGISTER);
-	parm= RNA_def_pointer(func, "context", "Context", "", "");
+	parm = RNA_def_pointer(func, "context", "Context", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_pointer(func, "ks", "KeyingSet", "", "");
+	parm = RNA_def_pointer(func, "ks", "KeyingSet", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	
 		/* generate */
-	func= RNA_def_function(srna, "generate", NULL);
+	func = RNA_def_function(srna, "generate", NULL);
 	RNA_def_function_ui_description(func, "Add Paths to the Keying Set to keyframe the properties of the given data");
 	RNA_def_function_flag(func, FUNC_REGISTER);
-	parm= RNA_def_pointer(func, "context", "Context", "", "");
+	parm = RNA_def_pointer(func, "context", "Context", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_pointer(func, "ks", "KeyingSet", "", "");
+	parm = RNA_def_pointer(func, "ks", "KeyingSet", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_pointer(func, "data", "AnyType", "", ""); 
+	parm = RNA_def_pointer(func, "data", "AnyType", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
 }
 
@@ -540,56 +559,61 @@ static void rna_def_keyingset_path(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "KeyingSetPath", NULL);
+	srna = RNA_def_struct(brna, "KeyingSetPath", NULL);
 	RNA_def_struct_sdna(srna, "KS_Path");
 	RNA_def_struct_ui_text(srna, "Keying Set Path", "Path to a setting for use in a Keying Set");
 	
 	/* ID */
-	prop= RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "ID");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_editable_func(prop, "rna_ksPath_id_editable");
 	RNA_def_property_pointer_funcs(prop, NULL, NULL, "rna_ksPath_id_typef", NULL);
-	RNA_def_property_ui_text(prop, "ID-Block", "ID-Block that keyframes for Keying Set should be added to (for Absolute Keying Sets only)");
-	RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET|NA_EDITED, NULL); // XXX: maybe a bit too noisy
+	RNA_def_property_ui_text(prop, "ID-Block",
+	                         "ID-Block that keyframes for Keying Set should be added to "
+	                         "(for Absolute Keying Sets only)");
+	RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET|NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
 	
-	prop= RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "idtype");
 	RNA_def_property_enum_items(prop, id_type_items);
 	RNA_def_property_enum_default(prop, ID_OB);
 	RNA_def_property_enum_funcs(prop, NULL, "rna_ksPath_id_type_set", NULL);
 	RNA_def_property_ui_text(prop, "ID Type", "Type of ID-block that can be used");
-	RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET|NA_EDITED, NULL); // XXX: maybe a bit too noisy
+	RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET|NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
 	
 	/* Group */
-	prop= RNA_def_property(srna, "group", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "group", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Group Name", "Name of Action Group to assign setting(s) for this path to");
-	RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET|NA_EDITED, NULL); // XXX: maybe a bit too noisy
+	RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET|NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
 	
 	/* Grouping */
-	prop= RNA_def_property(srna, "group_method", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "group_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "groupmode");
 	RNA_def_property_enum_items(prop, keyingset_path_grouping_items);
 	RNA_def_property_ui_text(prop, "Grouping Method", "Method used to define which Group-name to use");
-	RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET|NA_EDITED, NULL); // XXX: maybe a bit too noisy
+	RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET|NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
 	
 	/* Path + Array Index */
-	prop= RNA_def_property(srna, "data_path", PROP_STRING, PROP_NONE);
-	RNA_def_property_string_funcs(prop, "rna_ksPath_RnaPath_get", "rna_ksPath_RnaPath_length", "rna_ksPath_RnaPath_set");
+	prop = RNA_def_property(srna, "data_path", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_funcs(prop, "rna_ksPath_RnaPath_get", "rna_ksPath_RnaPath_length",
+	                              "rna_ksPath_RnaPath_set");
 	RNA_def_property_ui_text(prop, "Data Path", "Path to property setting");
-	RNA_def_struct_name_property(srna, prop); // XXX this is the best indicator for now...
+	RNA_def_struct_name_property(srna, prop); /* XXX this is the best indicator for now... */
 	RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET|NA_EDITED, NULL);
 
 	/* called 'index' when given as function arg */
-	prop= RNA_def_property(srna, "array_index", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "array_index", PROP_INT, PROP_NONE);
 	RNA_def_property_ui_text(prop, "RNA Array Index", "Index to the specific setting if applicable");
-	RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET|NA_EDITED, NULL); // XXX: maybe a bit too noisy
+	RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET|NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
 	
 	/* Flags */
-	prop= RNA_def_property(srna, "use_entire_array", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_entire_array", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", KSP_FLAG_WHOLE_ARRAY);
-	RNA_def_property_ui_text(prop, "Entire Array", "When an 'array/vector' type is chosen (Location, Rotation, Color, etc.), entire array is to be used");
-	RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET|NA_EDITED, NULL); // XXX: maybe a bit too noisy
+	RNA_def_property_ui_text(prop, "Entire Array",
+	                         "When an 'array/vector' type is chosen (Location, Rotation, Color, etc.), "
+	                         "entire array is to be used");
+	RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET|NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
 	
 	/* Keyframing Settings */
 	rna_def_common_keying_flags(srna, 0);
@@ -607,23 +631,24 @@ static void rna_def_keyingset_paths(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "KeyingSetPaths");
-	srna= RNA_def_struct(brna, "KeyingSetPaths", NULL);
+	srna = RNA_def_struct(brna, "KeyingSetPaths", NULL);
 	RNA_def_struct_sdna(srna, "KeyingSet");
 	RNA_def_struct_ui_text(srna, "Keying set paths", "Collection of keying set paths");
 
 	
 	/* Add Path */
-	func= RNA_def_function(srna, "add", "rna_KeyingSet_paths_add");
+	func = RNA_def_function(srna, "add", "rna_KeyingSet_paths_add");
 	RNA_def_function_ui_description(func, "Add a new path for the Keying Set");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 		/* return arg */
-	parm= RNA_def_pointer(func, "ksp", "KeyingSetPath", "New Path", "Path created and added to the Keying Set");
+	parm = RNA_def_pointer(func, "ksp", "KeyingSetPath", "New Path", "Path created and added to the Keying Set");
 		RNA_def_function_return(func, parm);
 		/* ID-block for target */
-	parm= RNA_def_pointer(func, "target_id", "ID", "Target ID", "ID-Datablock for the destination"); 
+	parm = RNA_def_pointer(func, "target_id", "ID", "Target ID", "ID-Datablock for the destination");
 		RNA_def_property_flag(parm, PROP_REQUIRED);
 		/* rna-path */
-	parm= RNA_def_string(func, "data_path", "", 256, "Data-Path", "RNA-Path to destination property"); // xxx hopefully this is long enough
+		/* XXX hopefully this is long enough */
+	parm = RNA_def_string(func, "data_path", "", 256, "Data-Path", "RNA-Path to destination property");
 		RNA_def_property_flag(parm, PROP_REQUIRED);
 		/* index (defaults to -1 for entire array) */
 	RNA_def_int(func, "index", -1, -1, INT_MAX, "Index",
@@ -637,29 +662,31 @@ static void rna_def_keyingset_paths(BlenderRNA *brna, PropertyRNA *cprop)
 
 
 	/* Remove Path */
-	func= RNA_def_function(srna, "remove", "rna_KeyingSet_paths_remove");
+	func = RNA_def_function(srna, "remove", "rna_KeyingSet_paths_remove");
 	RNA_def_function_ui_description(func, "Remove the given path from the Keying Set");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 		/* path to remove */
-	parm= RNA_def_pointer(func, "path", "KeyingSetPath", "Path", ""); 
+	parm = RNA_def_pointer(func, "path", "KeyingSetPath", "Path", "");
 		RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
 
 	/* Remove All Paths */
-	func= RNA_def_function(srna, "clear", "rna_KeyingSet_paths_clear");
+	func = RNA_def_function(srna, "clear", "rna_KeyingSet_paths_clear");
 	RNA_def_function_ui_description(func, "Remove all the paths from the Keying Set");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "KeyingSetPath");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_editable_func(prop, "rna_KeyingSet_active_ksPath_editable");
-	RNA_def_property_pointer_funcs(prop, "rna_KeyingSet_active_ksPath_get", "rna_KeyingSet_active_ksPath_set", NULL, NULL);
+	RNA_def_property_pointer_funcs(prop, "rna_KeyingSet_active_ksPath_get",
+	                               "rna_KeyingSet_active_ksPath_set", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
 
-	prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "active_path");
-	RNA_def_property_int_funcs(prop, "rna_KeyingSet_active_ksPath_index_get", "rna_KeyingSet_active_ksPath_index_set", "rna_KeyingSet_active_ksPath_index_range");
+	RNA_def_property_int_funcs(prop, "rna_KeyingSet_active_ksPath_index_get", "rna_KeyingSet_active_ksPath_index_set",
+	                           "rna_KeyingSet_active_ksPath_index_range");
 	RNA_def_property_ui_text(prop, "Active Path Index", "Current Keying Set index");
 }
 
@@ -668,34 +695,49 @@ static void rna_def_keyingset(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "KeyingSet", NULL);
+	srna = RNA_def_struct(brna, "KeyingSet", NULL);
 	RNA_def_struct_ui_text(srna, "Keying Set", "Settings that should be keyframed together");
 	
-	/* Name */
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
-	RNA_def_property_ui_text(prop, "Name", "");
+	/* 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);
+	
+	prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_sdna(prop, NULL, "name");
+	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");
+	RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
+	RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+	RNA_def_property_ui_text(prop, "Description", "A short description of the keying set");
 	
 	/* KeyingSetInfo (Type Info) for Builtin Sets only  */
-	prop= RNA_def_property(srna, "type_info", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "type_info", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "KeyingSetInfo");
 	RNA_def_property_pointer_funcs(prop, "rna_KeyingSet_typeinfo_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Type Info", "Callback function defines for built-in Keying Sets");
 	
 	/* Paths */
-	prop= RNA_def_property(srna, "paths", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "paths", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "paths", NULL);
 	RNA_def_property_struct_type(prop, "KeyingSetPath");
 	RNA_def_property_ui_text(prop, "Paths", "Keying Set Paths to define settings that get keyframed together");
 	rna_def_keyingset_paths(brna, prop);
 
 	/* Flags */
-	prop= RNA_def_property(srna, "is_path_absolute", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_path_absolute", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYINGSET_ABSOLUTE);
-	RNA_def_property_ui_text(prop, "Absolute", "Keying Set defines specific paths/settings to be keyframed (i.e. is not reliant on context info)");	
+	RNA_def_property_ui_text(prop, "Absolute",
+	                         "Keying Set defines specific paths/settings to be keyframed "
+	                         "(i.e. is not reliant on context info)");
 	
 	/* Keyframing Flags */
 	rna_def_common_keying_flags(srna, 0);
@@ -705,6 +747,7 @@ static void rna_def_keyingset(BlenderRNA *brna)
 	RNA_api_keyingset(srna);
 }
 
+#undef KEYINGSET_IDNAME_DOC
 /* --- */
 
 static void rna_api_animdata_nla_tracks(BlenderRNA *brna, PropertyRNA *cprop)
@@ -716,7 +759,7 @@ static void rna_api_animdata_nla_tracks(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 	
 	RNA_def_property_srna(cprop, "NlaTracks");
-	srna= RNA_def_struct(brna, "NlaTracks", NULL);
+	srna = RNA_def_struct(brna, "NlaTracks", NULL);
 	RNA_def_struct_sdna(srna, "AnimData");
 	RNA_def_struct_ui_text(srna, "NLA Tracks", "Collection of NLA Tracks");
 	
@@ -734,7 +777,7 @@ static void rna_api_animdata_nla_tracks(BlenderRNA *brna, PropertyRNA *cprop)
 	parm = RNA_def_pointer(func, "track", "NlaTrack", "", "NLA Track to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "NlaTrack");
 	RNA_def_property_pointer_funcs(prop, "rna_NlaTrack_active_get", "rna_NlaTrack_active_set", NULL, NULL);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
@@ -749,10 +792,10 @@ static void rna_api_animdata_drivers(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *parm;
 	FunctionRNA *func;
 
-	// PropertyRNA *prop;
+	/* PropertyRNA *prop; */
 	
 	RNA_def_property_srna(cprop, "AnimDataDrivers");
-	srna= RNA_def_struct(brna, "AnimDataDrivers", NULL);
+	srna = RNA_def_struct(brna, "AnimDataDrivers", NULL);
 	RNA_def_struct_sdna(srna, "AnimData");
 	RNA_def_struct_ui_text(srna, "Drivers", "Collection of Driver F-Curves");
 	
@@ -769,10 +812,10 @@ void rna_def_animdata_common(StructRNA *srna)
 {
 	PropertyRNA *prop;
 	
-	prop= RNA_def_property(srna, "animation_data", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "animation_data", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "adt");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "Animation Data", "Animation data for this datablock");	
+	RNA_def_property_ui_text(prop, "Animation Data", "Animation data for this datablock");
 }
 
 void rna_def_animdata(BlenderRNA *brna)
@@ -780,11 +823,11 @@ void rna_def_animdata(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "AnimData", NULL);
+	srna = RNA_def_struct(brna, "AnimData", NULL);
 	RNA_def_struct_ui_text(srna, "Animation Data", "Animation data for datablock");
 	
 	/* NLA */
-	prop= RNA_def_property(srna, "nla_tracks", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "nla_tracks", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "nla_tracks", NULL);
 	RNA_def_property_struct_type(prop, "NlaTrack");
 	RNA_def_property_ui_text(prop, "NLA Tracks", "NLA Tracks (i.e. Animation Layers)");
@@ -792,35 +835,39 @@ void rna_def_animdata(BlenderRNA *brna)
 	rna_api_animdata_nla_tracks(brna, prop);
 	
 	/* Active Action */
-	prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
-	RNA_def_property_flag(prop, PROP_EDITABLE); /* this flag as well as the dynamic test must be defined for this to be editable... */
+	prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
+		/* this flag as well as the dynamic test must be defined for this to be editable... */
+	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_AnimData_action_set", NULL, "rna_Action_id_poll");
 	RNA_def_property_editable_func(prop, "rna_AnimData_action_editable");
 	RNA_def_property_ui_text(prop, "Action", "Active Action for this datablock");
 	RNA_def_property_update(prop, NC_ANIMATION, NULL); /* this will do? */
 
 	/* Active Action Settings */
-	prop= RNA_def_property(srna, "action_extrapolation", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "action_extrapolation", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "act_extendmode");
 	RNA_def_property_enum_items(prop, nla_mode_extend_items);
-	RNA_def_property_ui_text(prop, "Action Extrapolation", "Action to take for gaps past the Active Action's range (when evaluating with NLA)");
+	RNA_def_property_ui_text(prop, "Action Extrapolation",
+	                         "Action to take for gaps past the Active Action's range (when evaluating with NLA)");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
-	prop= RNA_def_property(srna, "action_blend_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "action_blend_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "act_blendmode");
 	RNA_def_property_enum_items(prop, nla_mode_blend_items);
-	RNA_def_property_ui_text(prop, "Action Blending", "Method used for combining Active Action's result with result of NLA stack");
+	RNA_def_property_ui_text(prop, "Action Blending",
+	                         "Method used for combining Active Action's result with result of NLA stack");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
-	prop= RNA_def_property(srna, "action_influence", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "action_influence", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "act_influence");
 	RNA_def_property_float_default(prop, 1.0f);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
-	RNA_def_property_ui_text(prop, "Action Influence", "Amount the Active Action contributes to the result of the NLA stack");
+	RNA_def_property_ui_text(prop, "Action Influence",
+	                         "Amount the Active Action contributes to the result of the NLA stack");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
 	/* Drivers */
-	prop= RNA_def_property(srna, "drivers", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "drivers", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "drivers", NULL);
 	RNA_def_property_struct_type(prop, "FCurve");
 	RNA_def_property_ui_text(prop, "Drivers", "The Drivers/Expressions for this datablock");
@@ -828,7 +875,7 @@ void rna_def_animdata(BlenderRNA *brna)
 	rna_api_animdata_drivers(brna, prop);
 	
 	/* General Settings */
-	prop= RNA_def_property(srna, "use_nla", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_nla", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ADT_NLA_EVAL_OFF);
 	RNA_def_property_ui_text(prop, "NLA Evaluation Enabled", "NLA stack is evaluated when evaluating this block");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
diff --git a/source/blender/makesrna/intern/rna_animation_api.c b/source/blender/makesrna/intern/rna_animation_api.c
index 714a74e..c3c4a13 100644
--- a/source/blender/makesrna/intern/rna_animation_api.c
+++ b/source/blender/makesrna/intern/rna_animation_api.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
@@ -18,7 +18,7 @@
  * The Original Code is Copyright (C) 2009 Blender Foundation.
  * All rights reserved.
  *
- * 
+ *
  * Contributor(s): Joshua Leung
  *
  * ***** END GPL LICENSE BLOCK *****
@@ -49,7 +49,7 @@
 
 static void rna_KeyingSet_context_refresh(KeyingSet *ks, bContext *C, ReportList *reports)
 {
-	// TODO: enable access to providing a list of overrides (dsources)?
+	/* TODO: enable access to providing a list of overrides (dsources)? */
 	int success = ANIM_validate_keyingset(C, NULL, ks);
 	
 	if (success != 0) {
@@ -70,13 +70,14 @@ static void rna_KeyingSet_context_refresh(KeyingSet *ks, bContext *C, ReportList
 void RNA_api_keyingset(StructRNA *srna)
 {
 	FunctionRNA *func;
-	//PropertyRNA *parm;
+	/*PropertyRNA *parm; */
 	
 	/* validate relative Keying Set (used to ensure paths are ok for context) */
-	func= RNA_def_function(srna, "refresh", "rna_KeyingSet_context_refresh");
-	RNA_def_function_ui_description(func, "Refresh Keying Set to ensure that it is valid for the current context. Call before each use of one");
+	func = RNA_def_function(srna, "refresh", "rna_KeyingSet_context_refresh");
+	RNA_def_function_ui_description(func,
+	                                "Refresh Keying Set to ensure that it is valid for the current context "
+	                                "(call before each use of one)");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
 }
 
 #endif
-
diff --git a/source/blender/makesrna/intern/rna_animviz.c b/source/blender/makesrna/intern/rna_animviz.c
index 29133db..f706530 100644
--- a/source/blender/makesrna/intern/rna_animviz.c
+++ b/source/blender/makesrna/intern/rna_animviz.c
@@ -53,35 +53,35 @@ static PointerRNA rna_AnimViz_motion_paths_get(PointerRNA *ptr)
 
 static void rna_AnimViz_ghost_start_frame_set(PointerRNA *ptr, int value)
 {
-	bAnimVizSettings *data= (bAnimVizSettings*)ptr->data;
+	bAnimVizSettings *data = (bAnimVizSettings*)ptr->data;
 	
 	CLAMP(value, 1, data->ghost_ef);
-	data->ghost_sf= value;
+	data->ghost_sf = value;
 }
 
 static void rna_AnimViz_ghost_end_frame_set(PointerRNA *ptr, int value)
 {
-	bAnimVizSettings *data= (bAnimVizSettings*)ptr->data;
+	bAnimVizSettings *data = (bAnimVizSettings*)ptr->data;
 	
 	CLAMP(value, data->ghost_sf, (int)(MAXFRAMEF/2));
-	data->ghost_ef= value;
+	data->ghost_ef = value;
 }
 
 static void rna_AnimViz_path_start_frame_set(PointerRNA *ptr, int value)
 {
-	bAnimVizSettings *data= (bAnimVizSettings*)ptr->data;
+	bAnimVizSettings *data = (bAnimVizSettings*)ptr->data;
 	
 	CLAMP(value, 1, data->path_ef-1);
-	data->path_sf= value;
+	data->path_sf = value;
 }
 
 static void rna_AnimViz_path_end_frame_set(PointerRNA *ptr, int value)
 {
-	bAnimVizSettings *data= (bAnimVizSettings*)ptr->data;
+	bAnimVizSettings *data = (bAnimVizSettings*)ptr->data;
 	
-	// XXX: watchit! Path Start > MAXFRAME/2 could be a problem...
+	/* XXX: watchit! Path Start > MAXFRAME/2 could be a problem... */
 	CLAMP(value, data->path_sf+1, (int)(MAXFRAMEF/2));
-	data->path_ef= value;
+	data->path_ef = value;
 }
 
 #else
@@ -90,9 +90,9 @@ void rna_def_motionpath_common(StructRNA *srna)
 {
 	PropertyRNA *prop;
 	
-	prop= RNA_def_property(srna, "motion_path", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "motion_path", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "mpath");
-	RNA_def_property_ui_text(prop, "Motion Path", "Motion Path for this element");	
+	RNA_def_property_ui_text(prop, "Motion Path", "Motion Path for this element");
 }
 
 static void rna_def_animviz_motionpath_vert(BlenderRNA *brna)
@@ -100,15 +100,15 @@ static void rna_def_animviz_motionpath_vert(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "MotionPathVert", NULL);
+	srna = RNA_def_struct(brna, "MotionPathVert", NULL);
 	RNA_def_struct_sdna(srna, "bMotionPathVert");
 	RNA_def_struct_ui_text(srna, "Motion Path Cache Point", "Cached location on path");
 	
-	prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Coordinates", "");
 	
-	prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOTIONPATH_VERT_SEL);
 	RNA_def_property_ui_text(prop, "Select", "Path point is selected for editing");
 }
@@ -118,38 +118,39 @@ static void rna_def_animviz_motion_path(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "MotionPath", NULL);
+	srna = RNA_def_struct(brna, "MotionPath", NULL);
 	RNA_def_struct_sdna(srna, "bMotionPath");
 	RNA_def_struct_ui_text(srna, "Motion Path", "Cache of the worldspace positions of an element over a frame range");
 	
 	/* Collections */
-	prop= RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "points", "length");
 	RNA_def_property_struct_type(prop, "MotionPathVert");
 	RNA_def_property_ui_text(prop, "Motion Path Points", "Cached positions per frame");
 	
 	/* Playback Ranges */
-	prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "start_frame");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Start Frame", "Starting frame of the stored range");
 	
-	prop= RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "end_frame");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "End Frame", "End frame of the stored range");
 	
-	prop= RNA_def_property(srna, "length", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "length", PROP_INT, PROP_TIME);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Length", "Number of frames cached");
 	
 	/* Settings */
-	prop= RNA_def_property(srna, "use_bone_head", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_bone_head", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOTIONPATH_FLAG_BHEAD);
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE); // xxx
-	RNA_def_property_ui_text(prop, "Use Bone Heads", "For PoseBone paths, use the bone head location when calculating this path");
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* xxx */
+	RNA_def_property_ui_text(prop, "Use Bone Heads",
+	                         "For PoseBone paths, use the bone head location when calculating this path");
 	
-	prop= RNA_def_property(srna, "is_modified", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_modified", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOTIONPATH_FLAG_EDIT);
 	RNA_def_property_ui_text(prop, "Edit Path", "Path is being edited");
 }
@@ -169,54 +170,64 @@ static void rna_def_animviz_ghosts(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}};
 	
 	
-	srna= RNA_def_struct(brna, "AnimVizOnionSkinning", NULL);
+	srna = RNA_def_struct(brna, "AnimVizOnionSkinning", NULL);
 	RNA_def_struct_sdna(srna, "bAnimVizSettings");
 	RNA_def_struct_nested(brna, srna, "AnimViz");
 	RNA_def_struct_ui_text(srna, "Onion Skinning Settings", "Onion Skinning settings for animation visualisation");
 
 	/* Enums */
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "ghost_type");
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_ui_text(prop, "Type", "Method used for determining what ghosts get drawn");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
 	
 	/* Settings */
-	prop= RNA_def_property(srna, "show_only_selected", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_only_selected", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ghost_flag", GHOST_FLAG_ONLYSEL);
-	RNA_def_property_ui_text(prop, "On Selected Bones Only", "For Pose-Mode drawing, only draw ghosts for selected bones");
+	RNA_def_property_ui_text(prop, "On Selected Bones Only",
+	                         "For Pose-Mode drawing, only draw ghosts for selected bones");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
 	
-	prop= RNA_def_property(srna, "frame_step", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_step", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "ghost_step");
 	RNA_def_property_range(prop, 1, 20);
-	RNA_def_property_ui_text(prop, "Frame Step", "Number of frames between ghosts shown (not for 'On Keyframes' Onion-skinning method)");
+	RNA_def_property_ui_text(prop, "Frame Step",
+	                         "Number of frames between ghosts shown (not for 'On Keyframes' Onion-skinning method)");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
 	
 	/* Playback Ranges */
-	prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "ghost_sf");
 	RNA_def_property_int_funcs(prop, NULL, "rna_AnimViz_ghost_start_frame_set", NULL);
-	RNA_def_property_ui_text(prop, "Start Frame", "Starting frame of range of Ghosts to display (not for 'Around Current Frame' Onion-skinning method)");
+	RNA_def_property_ui_text(prop, "Start Frame",
+	                         "Starting frame of range of Ghosts to display "
+	                         "(not for 'Around Current Frame' Onion-skinning method)");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
 	
-	prop= RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "ghost_ef");
 	RNA_def_property_int_funcs(prop, NULL, "rna_AnimViz_ghost_end_frame_set", NULL);
-	RNA_def_property_ui_text(prop, "End Frame", "End frame of range of Ghosts to display (not for 'Around Current Frame' Onion-skinning method)");
+	RNA_def_property_ui_text(prop, "End Frame",
+	                         "End frame of range of Ghosts to display "
+	                         "(not for 'Around Current Frame' Onion-skinning method)");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
 	
 	/* Around Current Ranges */
-	prop= RNA_def_property(srna, "frame_before", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_before", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "ghost_bc");
 	RNA_def_property_range(prop, 0, 30);
-	RNA_def_property_ui_text(prop, "Before Current", "Number of frames to show before the current frame (only for 'Around Current Frame' Onion-skinning method)");
+	RNA_def_property_ui_text(prop, "Before Current",
+	                         "Number of frames to show before the current frame "
+	                         "(only for 'Around Current Frame' Onion-skinning method)");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
 	
-	prop= RNA_def_property(srna, "frame_after", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_after", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "ghost_ac");
 	RNA_def_property_range(prop, 0, 30);
-	RNA_def_property_ui_text(prop, "After Current", "Number of frames to show after the current frame (only for 'Around Current Frame' Onion-skinning method)");
+	RNA_def_property_ui_text(prop, "After Current",
+	                         "Number of frames to show after the current frame "
+	                         "(only for 'Around Current Frame' Onion-skinning method)");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
 }
 
@@ -225,85 +236,97 @@ static void rna_def_animviz_paths(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	static const EnumPropertyItem prop_type_items[]= {
-		{MOTIONPATH_TYPE_ACFRA, "CURRENT_FRAME", 0, "Around Frame", "Display Paths of poses within a fixed number of frames around the current frame"},
+	static const EnumPropertyItem prop_type_items[] = {
+		{MOTIONPATH_TYPE_ACFRA, "CURRENT_FRAME", 0, "Around Frame",
+		                        "Display Paths of poses within a fixed number of frames around the current frame"},
 		{MOTIONPATH_TYPE_RANGE, "RANGE", 0, "In Range", "Display Paths of poses within specified range"},
 		{0, NULL, 0, NULL, NULL}};
-	static const EnumPropertyItem prop_location_items[]= {
+	static const EnumPropertyItem prop_location_items[] = {
 		{MOTIONPATH_BAKE_HEADS, "HEADS", 0, "Heads", "Calculate bone paths from heads"},
 		{0, "TAILS", 0, "Tails", "Calculate bone paths from tails"},
 		{0, NULL, 0, NULL, NULL}};
 	
-	srna= RNA_def_struct(brna, "AnimVizMotionPaths", NULL);
+	srna = RNA_def_struct(brna, "AnimVizMotionPaths", NULL);
 	RNA_def_struct_sdna(srna, "bAnimVizSettings");
 	RNA_def_struct_nested(brna, srna, "AnimViz");
 	RNA_def_struct_ui_text(srna, "Motion Path Settings", "Motion Path settings for animation visualisation");
 	
 	/* Enums */
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "path_type");
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_ui_text(prop, "Paths Type", "Type of range to show for Motion Paths");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
 	
-	prop= RNA_def_property(srna, "bake_location", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "bake_location", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "path_bakeflag");
 	RNA_def_property_enum_items(prop, prop_location_items);
 	RNA_def_property_ui_text(prop, "Bake Location", "When calculating Bone Paths, use Head or Tips");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
 	
 	/* Settings */
-	prop= RNA_def_property(srna, "show_frame_numbers", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_frame_numbers", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "path_viewflag", MOTIONPATH_VIEW_FNUMS);
 	RNA_def_property_ui_text(prop, "Show Frame Numbers", "Show frame numbers on Motion Paths");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
 	
-	prop= RNA_def_property(srna, "show_keyframe_highlight", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_keyframe_highlight", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "path_viewflag", MOTIONPATH_VIEW_KFRAS);
 	RNA_def_property_ui_text(prop, "Highlight Keyframes", "Emphasize position of keyframes on Motion Paths");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
 	
-	prop= RNA_def_property(srna, "show_keyframe_numbers", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_keyframe_numbers", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "path_viewflag", MOTIONPATH_VIEW_KFNOS);
 	RNA_def_property_ui_text(prop, "Show Keyframe Numbers", "Show frame numbers of Keyframes on Motion Paths");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
 	
-	prop= RNA_def_property(srna, "show_keyframe_action_all", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_keyframe_action_all", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "path_viewflag", MOTIONPATH_VIEW_KFACT);
-	RNA_def_property_ui_text(prop, "All Action Keyframes", "For bone motion paths, search whole Action for keyframes instead of in group with matching name only (is slower)");
+	RNA_def_property_ui_text(prop, "All Action Keyframes",
+	                         "For bone motion paths, search whole Action for keyframes instead of in group"
+	                         " with matching name only (is slower)");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
 	
-	prop= RNA_def_property(srna, "frame_step", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_step", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "path_step");
 	RNA_def_property_range(prop, 1, 100);
-	RNA_def_property_ui_text(prop, "Frame Step", "Number of frames between paths shown (not for 'On Keyframes' Onion-skinning method)");
+	RNA_def_property_ui_text(prop, "Frame Step",
+	                         "Number of frames between paths shown (not for 'On Keyframes' Onion-skinning method)");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
 	
 	
 	/* Playback Ranges */
-	prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "path_sf");
 	RNA_def_property_int_funcs(prop, NULL, "rna_AnimViz_path_start_frame_set", NULL);
-	RNA_def_property_ui_text(prop, "Start Frame", "Starting frame of range of paths to display/calculate (not for 'Around Current Frame' Onion-skinning method)");
+	RNA_def_property_ui_text(prop, "Start Frame",
+	                         "Starting frame of range of paths to display/calculate "
+	                         "(not for 'Around Current Frame' Onion-skinning method)");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
 	
-	prop= RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "path_ef");
 	RNA_def_property_int_funcs(prop, NULL, "rna_AnimViz_path_end_frame_set", NULL);
-	RNA_def_property_ui_text(prop, "End Frame", "End frame of range of paths to display/calculate (not for 'Around Current Frame' Onion-skinning method)");
+	RNA_def_property_ui_text(prop, "End Frame",
+	                         "End frame of range of paths to display/calculate "
+	                         "(not for 'Around Current Frame' Onion-skinning method)");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
 	
 	/* Around Current Ranges */
-	prop= RNA_def_property(srna, "frame_before", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_before", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "path_bc");
 	RNA_def_property_range(prop, 1, MAXFRAMEF/2);
-	RNA_def_property_ui_text(prop, "Before Current", "Number of frames to show before the current frame (only for 'Around Current Frame' Onion-skinning method)");
+	RNA_def_property_ui_text(prop, "Before Current",
+	                         "Number of frames to show before the current frame "
+	                         "(only for 'Around Current Frame' Onion-skinning method)");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
 	
-	prop= RNA_def_property(srna, "frame_after", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_after", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "path_ac");
 	RNA_def_property_range(prop, 1, MAXFRAMEF/2);
-	RNA_def_property_ui_text(prop, "After Current", "Number of frames to show after the current frame (only for 'Around Current Frame' Onion-skinning method)");
+	RNA_def_property_ui_text(prop, "After Current",
+	                         "Number of frames to show after the current frame "
+	                         "(only for 'Around Current Frame' Onion-skinning method)");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
 }
 
@@ -313,10 +336,10 @@ void rna_def_animviz_common(StructRNA *srna)
 {
 	PropertyRNA *prop;
 	
-	prop= RNA_def_property(srna, "animation_visualisation", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "animation_visualisation", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "avs");
-	RNA_def_property_ui_text(prop, "Animation Visualisation", "Animation data for this datablock");	
+	RNA_def_property_ui_text(prop, "Animation Visualisation", "Animation data for this datablock");
 }
 
 static void rna_def_animviz(BlenderRNA *brna)
@@ -324,19 +347,19 @@ static void rna_def_animviz(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "AnimViz", NULL);
+	srna = RNA_def_struct(brna, "AnimViz", NULL);
 	RNA_def_struct_sdna(srna, "bAnimVizSettings");
 	RNA_def_struct_ui_text(srna, "Animation Visualisation", "Settings for the visualisation of motion");
 	
 	/* onion-skinning settings (nested struct) */
-	prop= RNA_def_property(srna, "onion_skin_frames", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "onion_skin_frames", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "AnimVizOnionSkinning");
 	RNA_def_property_pointer_funcs(prop, "rna_AnimViz_onion_skinning_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Onion Skinning", "Onion Skinning (ghosting) settings for visualisation");
 	
 	/* motion path settings (nested struct) */
-	prop= RNA_def_property(srna, "motion_path", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "motion_path", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "AnimVizMotionPaths");
 	RNA_def_property_pointer_funcs(prop, "rna_AnimViz_motion_paths_get", NULL, NULL, NULL);
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c
index 18ba393..79b7765 100644
--- a/source/blender/makesrna/intern/rna_armature.c
+++ b/source/blender/makesrna/intern/rna_armature.c
@@ -52,49 +52,49 @@
 
 static void rna_Armature_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	ID *id= ptr->id.data;
+	ID *id = ptr->id.data;
 
 	DAG_id_tag_update(id, 0);
 	WM_main_add_notifier(NC_GEOM|ND_DATA, id);
-	//WM_main_add_notifier(NC_OBJECT|ND_POSE, NULL);
+	/*WM_main_add_notifier(NC_OBJECT|ND_POSE, NULL); */
 }
 
 
 static void rna_Armature_act_bone_set(PointerRNA *ptr, PointerRNA value)
 {
-	bArmature *arm= (bArmature*)ptr->data;
+	bArmature *arm = (bArmature*)ptr->data;
 
-	if(value.id.data==NULL && value.data==NULL) {
-		arm->act_bone= NULL;
+	if (value.id.data == NULL && value.data == NULL) {
+		arm->act_bone = NULL;
 	}
 	else {
-		if(value.id.data != arm) {
+		if (value.id.data != arm) {
 			Object *ob = (Object *)value.id.data;
 			
-			if(GS(ob->id.name)!=ID_OB || (ob->data != arm)) {
+			if (GS(ob->id.name) != ID_OB || (ob->data != arm)) {
 				printf("ERROR: armature set active bone - new active doesn't come from this armature\n");
 				return;
 			}
 		}
 		
-		arm->act_bone= value.data;
+		arm->act_bone = value.data;
 		arm->act_bone->flag |= BONE_SELECTED;
 	}
 }
 
 static void rna_Armature_act_edit_bone_set(PointerRNA *ptr, PointerRNA value)
 {
-	bArmature *arm= (bArmature*)ptr->data;
+	bArmature *arm = (bArmature*)ptr->data;
 
-	if(value.id.data==NULL && value.data==NULL) {
-		arm->act_edbone= NULL;
+	if (value.id.data == NULL && value.data == NULL) {
+		arm->act_edbone = NULL;
 	}
 	else {
-		if(value.id.data != arm) {
+		if (value.id.data != arm) {
 			/* raise an error! */
 		}
 		else {
-			arm->act_edbone= value.data;
+			arm->act_edbone = value.data;
 			((EditBone *)arm->act_edbone)->flag |= BONE_SELECTED;
 		}
 	}
@@ -102,7 +102,7 @@ static void rna_Armature_act_edit_bone_set(PointerRNA *ptr, PointerRNA value)
 
 EditBone *rna_Armature_edit_bone_new(bArmature *arm, ReportList *reports, const char *name)
 {
-	if(arm->edbo==NULL) {
+	if (arm->edbo == NULL) {
 		BKE_reportf(reports, RPT_ERROR, "Armature '%s' not in editmode, cant add an editbone", arm->id.name+2);
 		return NULL;
 	}
@@ -111,12 +111,12 @@ EditBone *rna_Armature_edit_bone_new(bArmature *arm, ReportList *reports, const
 
 void rna_Armature_edit_bone_remove(bArmature *arm, ReportList *reports, EditBone *ebone)
 {
-	if(arm->edbo==NULL) {
+	if (arm->edbo == NULL) {
 		BKE_reportf(reports, RPT_ERROR, "Armature '%s' not in editmode, cant remove an editbone", arm->id.name+2);
 		return;
 	}
 
-	if(BLI_findindex(arm->edbo, ebone) == -1) {
+	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);
 		return;
 	}
@@ -126,13 +126,13 @@ void rna_Armature_edit_bone_remove(bArmature *arm, ReportList *reports, EditBone
 
 static void rna_Armature_update_layers(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	bArmature *arm= ptr->id.data;
+	bArmature *arm = ptr->id.data;
 	Object *ob;
 
 	/* proxy lib exception, store it here so we can restore layers on file
 	   load, since it would otherwise get lost due to being linked data */
-	for(ob = bmain->object.first; ob; ob=ob->id.next)
-		if(ob->data == arm && ob->pose)
+	for (ob = bmain->object.first; ob; ob = ob->id.next)
+		if (ob->data == arm && ob->pose)
 			ob->pose->proxy_layer = arm->layer;
 
 	WM_main_add_notifier(NC_GEOM|ND_DATA, arm);
@@ -140,7 +140,7 @@ static void rna_Armature_update_layers(Main *bmain, Scene *UNUSED(scene), Pointe
 
 static void rna_Armature_redraw_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	ID *id= ptr->id.data;
+	ID *id = ptr->id.data;
 
 	WM_main_add_notifier(NC_GEOM|ND_DATA, id);
 }
@@ -165,11 +165,11 @@ static char *rna_Bone_path(PointerRNA *ptr)
 
 static IDProperty *rna_Bone_idprops(PointerRNA *ptr, int create)
 {
-	Bone *bone= ptr->data;
+	Bone *bone = ptr->data;
 
-	if(create && !bone->prop) {
+	if (create && !bone->prop) {
 		IDPropertyTemplate val = {0};
-		bone->prop= IDP_New(IDP_GROUP, &val, "RNA_Bone ID properties");
+		bone->prop = IDP_New(IDP_GROUP, &val, "RNA_Bone ID properties");
 	}
 
 	return bone->prop;
@@ -177,11 +177,11 @@ static IDProperty *rna_Bone_idprops(PointerRNA *ptr, int create)
 
 static IDProperty *rna_EditBone_idprops(PointerRNA *ptr, int create)
 {
-	EditBone *ebone= ptr->data;
+	EditBone *ebone = ptr->data;
 
-	if(create && !ebone->prop) {
+	if (create && !ebone->prop) {
 		IDPropertyTemplate val = {0};
-		ebone->prop= IDP_New(IDP_GROUP, &val, "RNA_EditBone ID properties");
+		ebone->prop = IDP_New(IDP_GROUP, &val, "RNA_EditBone ID properties");
 	}
 
 	return ebone->prop;
@@ -189,67 +189,75 @@ static IDProperty *rna_EditBone_idprops(PointerRNA *ptr, int create)
 
 static void rna_bone_layer_set(int *layer, const int *values)
 {
-	int i, tot= 0;
+	int i, tot = 0;
 
 	/* ensure we always have some layer selected */
-	for(i=0; i<32; i++)
-		if(values[i])
+	for (i = 0; i<32; i++)
+		if (values[i])
 			tot++;
 	
-	if(tot==0)
+	if (tot == 0)
 		return;
 
-	for(i=0; i<32; i++) {
-		if(values[i]) *layer |= (1<<i);
+	for (i = 0; i<32; i++) {
+		if (values[i]) *layer |= (1<<i);
 		else *layer &= ~(1<<i);
 	}
 }
 
 static void rna_Bone_layer_set(PointerRNA *ptr, const int *values)
 {
-	Bone *bone= (Bone*)ptr->data;
+	Bone *bone = (Bone*)ptr->data;
 	rna_bone_layer_set(&bone->layer, values);
 }
 
 static void rna_Armature_layer_set(PointerRNA *ptr, const int *values)
 {
-	bArmature *arm= (bArmature*)ptr->data;
-	int i, tot= 0;
+	bArmature *arm = (bArmature*)ptr->data;
+	int i, tot = 0;
 
 	/* ensure we always have some layer selected */
-	for(i=0; i<32; i++)
-		if(values[i])
+	for (i = 0; i<32; i++)
+		if (values[i])
 			tot++;
 	
-	if(tot==0)
+	if (tot == 0)
 		return;
 
-	for(i=0; i<32; i++) {
-		if(values[i]) arm->layer |= (1<<i);
+	for (i = 0; i<32; i++) {
+		if (values[i]) arm->layer |= (1<<i);
 		else arm->layer &= ~(1<<i);
 	}
 }
 
-// XXX depreceated.... old armature only animviz
+/* XXX depreceated.... old armature only animviz */
 static void rna_Armature_ghost_start_frame_set(PointerRNA *ptr, int value)
 {
-	bArmature *data= (bArmature*)ptr->data;
-	CLAMP(value, 1, data->ghostef);
-	data->ghostsf= value;
+	bArmature *data = (bArmature*)ptr->data;
+	CLAMP(value, 1, (int)(MAXFRAMEF/2));
+	data->ghostsf = value;
+
+	if (data->ghostsf >= data->ghostef) {
+		data->ghostef = MIN2(data->ghostsf, (int)(MAXFRAMEF/2));
+	}
 }
 
 static void rna_Armature_ghost_end_frame_set(PointerRNA *ptr, int value)
 {
-	bArmature *data= (bArmature*)ptr->data;
-	CLAMP(value, data->ghostsf, (int)(MAXFRAMEF/2));
-	data->ghostef= value;
+	bArmature *data = (bArmature*)ptr->data;
+	CLAMP(value, 1, (int)(MAXFRAMEF/2));
+	data->ghostef = value;
+
+	if (data->ghostsf >= data->ghostef) {
+		data->ghostsf = MAX2(data->ghostef, 1);
+	}
 }
-// XXX depreceated... old armature only animviz
+/* XXX depreceated... old armature only animviz */
 
 static void rna_EditBone_name_set(PointerRNA *ptr, const char *value)
 {
-	bArmature *arm= (bArmature*)ptr->id.data;
-	EditBone *ebone= (EditBone*)ptr->data;
+	bArmature *arm = (bArmature*)ptr->id.data;
+	EditBone *ebone = (EditBone*)ptr->data;
 	char oldname[sizeof(ebone->name)], newname[sizeof(ebone->name)];
 	
 	/* need to be on the stack */
@@ -261,8 +269,8 @@ static void rna_EditBone_name_set(PointerRNA *ptr, const char *value)
 
 static void rna_Bone_name_set(PointerRNA *ptr, const char *value)
 {
-	bArmature *arm= (bArmature*)ptr->id.data;
-	Bone *bone= (Bone*)ptr->data;
+	bArmature *arm = (bArmature*)ptr->id.data;
+	Bone *bone = (Bone*)ptr->data;
 	char oldname[sizeof(bone->name)], newname[sizeof(bone->name)];
 	
 	/* need to be on the stack */
@@ -274,21 +282,21 @@ static void rna_Bone_name_set(PointerRNA *ptr, const char *value)
 
 static void rna_EditBone_layer_set(PointerRNA *ptr, const int values[])
 {
-	EditBone *data= (EditBone*)(ptr->data);
+	EditBone *data = (EditBone*)(ptr->data);
 	rna_bone_layer_set(&data->layer, values);
 }
 
 static void rna_EditBone_connected_check(EditBone *ebone)
 {
-	if(ebone->parent) {
-		if(ebone->flag & BONE_CONNECTED) {
+	if (ebone->parent) {
+		if (ebone->flag & BONE_CONNECTED) {
 			/* Attach this bone to its parent */
 			copy_v3_v3(ebone->head, ebone->parent->tail);
 
-			if(ebone->flag & BONE_ROOTSEL)
+			if (ebone->flag & BONE_ROOTSEL)
 				ebone->parent->flag |= BONE_TIPSEL;
 		}
-		else if(!(ebone->parent->flag & BONE_ROOTSEL)) {
+		else if (!(ebone->parent->flag & BONE_ROOTSEL)) {
 			ebone->parent->flag &= ~BONE_TIPSEL;
 		}
 	}
@@ -296,9 +304,9 @@ static void rna_EditBone_connected_check(EditBone *ebone)
 
 static void rna_EditBone_connected_set(PointerRNA *ptr, int value)
 {
-	EditBone *ebone= (EditBone*)(ptr->data);
+	EditBone *ebone = (EditBone*)(ptr->data);
 
-	if(value) ebone->flag |= BONE_CONNECTED;
+	if (value) ebone->flag |= BONE_CONNECTED;
 	else ebone->flag &= ~BONE_CONNECTED;
 
 	rna_EditBone_connected_check(ebone);
@@ -306,17 +314,17 @@ static void rna_EditBone_connected_set(PointerRNA *ptr, int value)
 
 static PointerRNA rna_EditBone_parent_get(PointerRNA *ptr)
 {
-	EditBone *data= (EditBone*)(ptr->data);
+	EditBone *data = (EditBone*)(ptr->data);
 	return rna_pointer_inherit_refine(ptr, &RNA_EditBone, data->parent);
 }
 
 static void rna_EditBone_parent_set(PointerRNA *ptr, PointerRNA value)
 {
-	EditBone *ebone= (EditBone*)(ptr->data);
-	EditBone *pbone, *parbone= (EditBone*)value.data;
+	EditBone *ebone = (EditBone*)(ptr->data);
+	EditBone *pbone, *parbone = (EditBone*)value.data;
 
-	if(parbone == NULL) {
-		if(ebone->parent && !(ebone->parent->flag & BONE_ROOTSEL))
+	if (parbone == NULL) {
+		if (ebone->parent && !(ebone->parent->flag & BONE_ROOTSEL))
 			ebone->parent->flag &= ~BONE_TIPSEL;
 
 		ebone->parent = NULL;
@@ -324,15 +332,15 @@ static void rna_EditBone_parent_set(PointerRNA *ptr, PointerRNA value)
 	}
 	else {
 		/* within same armature */
-		if(value.id.data != ptr->id.data)
+		if (value.id.data != ptr->id.data)
 			return;
 
 		/* make sure this is a valid child */
-		if(parbone == ebone)
+		if (parbone == ebone)
 			return;
 			
-		for(pbone= parbone->parent; pbone; pbone=pbone->parent)
-			if(pbone == ebone)
+		for (pbone = parbone->parent; pbone; pbone = pbone->parent)
+			if (pbone == ebone)
 				return;
 
 		ebone->parent = parbone;
@@ -342,7 +350,7 @@ static void rna_EditBone_parent_set(PointerRNA *ptr, PointerRNA value)
 
 static void rna_EditBone_matrix_get(PointerRNA *ptr, float *values)
 {
-	EditBone *ebone= (EditBone*)(ptr->data);
+	EditBone *ebone = (EditBone*)(ptr->data);
 
 	float	delta[3], tmat[3][3], mat[4][4];
 
@@ -357,35 +365,35 @@ static void rna_EditBone_matrix_get(PointerRNA *ptr, float *values)
 
 static void rna_Armature_editbone_transform_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	bArmature *arm= (bArmature*)ptr->id.data;
-	EditBone *ebone= (EditBone*)ptr->data;
+	bArmature *arm = (bArmature*)ptr->id.data;
+	EditBone *ebone = (EditBone*)ptr->data;
 	EditBone *child, *eboflip;
 	
 	/* update our parent */
-	if(ebone->parent && ebone->flag & BONE_CONNECTED)
+	if (ebone->parent && ebone->flag & BONE_CONNECTED)
 		copy_v3_v3(ebone->parent->tail, ebone->head);
 
 	/* update our children if necessary */
-	for(child = arm->edbo->first; child; child=child->next)
-		if(child->parent == ebone && (child->flag & BONE_CONNECTED))
+	for (child = arm->edbo->first; child; child = child->next)
+		if (child->parent == ebone && (child->flag & BONE_CONNECTED))
 			copy_v3_v3(child->head, ebone->tail);
 
-	if(arm->flag & ARM_MIRROR_EDIT) {
-		eboflip= ED_armature_bone_get_mirrored(arm->edbo, ebone);
+	if (arm->flag & ARM_MIRROR_EDIT) {
+		eboflip = ED_armature_bone_get_mirrored(arm->edbo, ebone);
 
-		if(eboflip) {
-			eboflip->roll= -ebone->roll;
+		if (eboflip) {
+			eboflip->roll = -ebone->roll;
 
-			eboflip->head[0]= -ebone->head[0];
-			eboflip->tail[0]= -ebone->tail[0];
+			eboflip->head[0] = -ebone->head[0];
+			eboflip->tail[0] = -ebone->tail[0];
 			
 			/* update our parent */
-			if(eboflip->parent && eboflip->flag & BONE_CONNECTED)
+			if (eboflip->parent && eboflip->flag & BONE_CONNECTED)
 				copy_v3_v3(eboflip->parent->tail, eboflip->head);
 			
 			/* update our children if necessary */
-			for(child = arm->edbo->first; child; child=child->next)
-				if(child->parent == eboflip && (child->flag & BONE_CONNECTED))
+			for (child = arm->edbo->first; child; child = child->next)
+				if (child->parent == eboflip && (child->flag & BONE_CONNECTED))
 					copy_v3_v3 (child->head, eboflip->tail);
 		}
 	}
@@ -395,174 +403,177 @@ static void rna_Armature_editbone_transform_update(Main *bmain, Scene *scene, Po
 
 static void rna_Armature_bones_next(CollectionPropertyIterator *iter)
 {
-	ListBaseIterator *internal= iter->internal;
-	Bone *bone= (Bone*)internal->link;
+	ListBaseIterator *internal = iter->internal;
+	Bone *bone = (Bone*)internal->link;
 
-	if(bone->childbase.first)
-		internal->link= (Link*)bone->childbase.first;
-	else if(bone->next)
-		internal->link= (Link*)bone->next;
+	if (bone->childbase.first)
+		internal->link = (Link*)bone->childbase.first;
+	else if (bone->next)
+		internal->link = (Link*)bone->next;
 	else {
-		internal->link= NULL;
+		internal->link = NULL;
 
 		do {
-			bone= bone->parent;
-			if(bone && bone->next) {
-				internal->link= (Link*)bone->next;
+			bone = bone->parent;
+			if (bone && bone->next) {
+				internal->link = (Link*)bone->next;
 				break;
 			}
-		} while(bone);
+		} while (bone);
 	}
 
-	iter->valid= (internal->link != NULL);
+	iter->valid = (internal->link != NULL);
 }
 
 #else
 
-static int rna_matrix_dimsize_4x4[]= {4, 4};
-static int rna_matrix_dimsize_3x3[]= {3, 3};
+static int rna_matrix_dimsize_4x4[] = {4, 4};
+static int rna_matrix_dimsize_3x3[] = {3, 3};
 
 static void rna_def_bone_common(StructRNA *srna, int editbone)
 {
 	PropertyRNA *prop;
 
 	/* strings */
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "name");
 	RNA_def_property_ui_text(prop, "Name", "");
 	RNA_def_struct_name_property(srna, prop);
-	if(editbone) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_EditBone_name_set");
+	if (editbone) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_EditBone_name_set");
 	else RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Bone_name_set");
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 
 	/* flags */
-	prop= RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
+	prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
 	RNA_def_property_boolean_sdna(prop, NULL, "layer", 1);
 	RNA_def_property_array(prop, 32);
-	if(editbone) RNA_def_property_boolean_funcs(prop, NULL, "rna_EditBone_layer_set");
+	if (editbone) RNA_def_property_boolean_funcs(prop, NULL, "rna_EditBone_layer_set");
 	else RNA_def_property_boolean_funcs(prop, NULL, "rna_Bone_layer_set");
 	RNA_def_property_ui_text(prop, "Layers", "Layers bone exists in");
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 
-	prop= RNA_def_property(srna, "use_connect", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_connect", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_CONNECTED);
-	if(editbone) RNA_def_property_boolean_funcs(prop, NULL, "rna_EditBone_connected_set");
+	if (editbone) RNA_def_property_boolean_funcs(prop, NULL, "rna_EditBone_connected_set");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Connected", "When bone has a parent, bone's head is stuck to the parent's tail");
 	RNA_def_property_update(prop, 0, "rna_Armature_update_data");
 	
-	prop= RNA_def_property(srna, "use_inherit_rotation", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_inherit_rotation", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_HINGE);
 	RNA_def_property_ui_text(prop, "Inherit Rotation", "Bone inherits rotation or scale from parent bone");
 	RNA_def_property_update(prop, 0, "rna_Armature_update_data");
 	
-	prop= RNA_def_property(srna, "use_envelope_multiply", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_envelope_multiply", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_MULT_VG_ENV);
 	RNA_def_property_ui_text(prop, "Multiply Vertex Group with Envelope",
 	                         "When deforming bone, multiply effects of Vertex Group weights with Envelope influence");
 	RNA_def_property_update(prop, 0, "rna_Armature_update_data");
 	
-	prop= RNA_def_property(srna, "use_deform", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_deform", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_DEFORM);
 	RNA_def_property_ui_text(prop, "Deform", "Bone does not deform any geometry");
 	RNA_def_property_update(prop, 0, "rna_Armature_update_data");
 	
-	prop= RNA_def_property(srna, "use_inherit_scale", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_inherit_scale", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Inherit Scale", "Bone inherits scaling from parent bone");
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_SCALE);
 	RNA_def_property_update(prop, 0, "rna_Armature_update_data");
 
-	prop= RNA_def_property(srna, "use_local_location", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_local_location", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Local Location", "Bone location is set in local space");
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_LOCAL_LOCATION);
 	RNA_def_property_update(prop, 0, "rna_Armature_update_data");
 	
-	prop= RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_DRAWWIRE);
 	RNA_def_property_ui_text(prop, "Draw Wire",
 	                         "Bone is always drawn as Wireframe regardless of viewport draw mode "
 	                         "(useful for non-obstructive custom bone shapes)");
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 	
-	prop= RNA_def_property(srna, "use_cyclic_offset", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_cyclic_offset", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_CYCLICOFFSET);
-	RNA_def_property_ui_text(prop, "Cyclic Offset", "When bone doesn't have a parent, it receives cyclic offset effects");
+	RNA_def_property_ui_text(prop, "Cyclic Offset",
+	                         "When bone doesn't have a parent, it receives cyclic offset effects");
 	RNA_def_property_update(prop, 0, "rna_Armature_update_data");
 	
-	prop= RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_UNSELECTABLE);
 	RNA_def_property_ui_text(prop, "Selectable", "Bone is able to be selected");
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 
 	/* Number values */
 		/* envelope deform settings */
-	prop= RNA_def_property(srna, "envelope_distance", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "envelope_distance", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "dist");
 	RNA_def_property_range(prop, 0.0f, 1000.0f);
 	RNA_def_property_ui_text(prop, "Envelope Deform Distance", "Bone deformation distance (for Envelope deform only)");
 	RNA_def_property_update(prop, 0, "rna_Armature_update_data");
 	
-	prop= RNA_def_property(srna, "envelope_weight", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "envelope_weight", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "weight");
 	RNA_def_property_range(prop, 0.0f, 1000.0f);
 	RNA_def_property_ui_text(prop, "Envelope Deform Weight", "Bone deformation weight (for Envelope deform only)");
 	RNA_def_property_update(prop, 0, "rna_Armature_update_data");
 	
-	prop= RNA_def_property(srna, "head_radius", PROP_FLOAT, PROP_UNSIGNED);
-	if(editbone) RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
+	prop = RNA_def_property(srna, "head_radius", PROP_FLOAT, PROP_UNSIGNED);
+	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");
-	//RNA_def_property_range(prop, 0, 1000);  // 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)");
 	
-	prop= RNA_def_property(srna, "tail_radius", PROP_FLOAT, PROP_UNSIGNED);
-	if(editbone) RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
+	prop = RNA_def_property(srna, "tail_radius", PROP_FLOAT, PROP_UNSIGNED);
+	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");
-	//RNA_def_property_range(prop, 0, 1000);  // 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)");
 	
 		/* b-bones deform settings */
-	prop= RNA_def_property(srna, "bbone_segments", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "bbone_segments", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "segments");
 	RNA_def_property_range(prop, 1, 32);
 	RNA_def_property_ui_text(prop, "B-Bone Segments", "Number of subdivisions of bone (for B-Bones only)");
 	RNA_def_property_update(prop, 0, "rna_Armature_update_data");
 	
-	prop= RNA_def_property(srna, "bbone_in", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "bbone_in", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "ease1");
 	RNA_def_property_range(prop, 0.0f, 2.0f);
 	RNA_def_property_ui_text(prop, "B-Bone Ease In", "Length of first Bezier Handle (for B-Bones only)");
 	RNA_def_property_update(prop, 0, "rna_Armature_update_data");
 	
-	prop= RNA_def_property(srna, "bbone_out", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "bbone_out", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "ease2");
 	RNA_def_property_range(prop, 0.0f, 2.0f);
 	RNA_def_property_ui_text(prop, "B-Bone Ease Out", "Length of second Bezier Handle (for B-Bones only)");
 	RNA_def_property_update(prop, 0, "rna_Armature_update_data");
 
-	prop= RNA_def_property(srna, "bbone_x", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "bbone_x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "xwidth");
 	RNA_def_property_range(prop, 0.0f, 1000.0f);
 	RNA_def_property_ui_text(prop, "B-Bone Display X Width", "B-Bone X size");
 	RNA_def_property_update(prop, 0, "rna_Armature_update_data");
 	
-	prop= RNA_def_property(srna, "bbone_z", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "bbone_z", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "zwidth");
 	RNA_def_property_range(prop, 0.0f, 1000.0f);
 	RNA_def_property_ui_text(prop, "B-Bone Display Z Width", "B-Bone Z size");
 	RNA_def_property_update(prop, 0, "rna_Armature_update_data");
 }
 
-// err... bones should not be directly edited (only editbones should be...)
+/* err... bones should not be directly edited (only editbones should be...) */
 static void rna_def_bone(BlenderRNA *brna)
 {
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "Bone", NULL);
+	srna = RNA_def_struct(brna, "Bone", NULL);
 	RNA_def_struct_ui_text(srna, "Bone", "Bone in an Armature datablock");
 	RNA_def_struct_ui_icon(srna, ICON_BONE_DATA);
 	RNA_def_struct_path_func(srna, "rna_Bone_path");
@@ -570,80 +581,86 @@ static void rna_def_bone(BlenderRNA *brna)
 	
 	/* pointers/collections */
 		/* parent (pointer) */
-	prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Bone");
 	RNA_def_property_pointer_sdna(prop, NULL, "parent");
 	RNA_def_property_ui_text(prop, "Parent", "Parent bone (in same Armature)");
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 	
 		/* children (collection) */
-	prop= RNA_def_property(srna, "children", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "children", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "childbase", NULL);
 	RNA_def_property_struct_type(prop, "Bone");
 	RNA_def_property_ui_text(prop, "Children", "Bones which are children of this bone");
 
 	rna_def_bone_common(srna, 0);
 
-		// XXX should we define this in PoseChannel wrapping code instead? but PoseChannels directly get some of their flags from here...
-	prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+		/* XXX should we define this in PoseChannel wrapping code instead?
+		 *     But PoseChannels directly get some of their flags from here... */
+	prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_HIDDEN_P);
-	RNA_def_property_ui_text(prop, "Hide", "Bone is not visible when it is not in Edit Mode (i.e. in Object or Pose Modes)");
+	RNA_def_property_ui_text(prop, "Hide",
+	                         "Bone is not visible when it is not in Edit Mode (i.e. in Object or Pose Modes)");
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 
-	prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_SELECTED);
 	RNA_def_property_ui_text(prop, "Select", "");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 	
-	prop= RNA_def_property(srna, "select_head", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select_head", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_ROOTSEL);
 	RNA_def_property_ui_text(prop, "Select Head", "");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 	
-	prop= RNA_def_property(srna, "select_tail", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select_tail", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_TIPSEL);
 	RNA_def_property_ui_text(prop, "Select Tail", "");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 
 	/* XXX better matrix descriptions possible (Arystan) */
-	prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
+	prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
 	RNA_def_property_float_sdna(prop, NULL, "bone_mat");
 	RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_3x3);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Bone Matrix", "3x3 bone matrix");
 
-	prop= RNA_def_property(srna, "matrix_local", PROP_FLOAT, PROP_MATRIX);
+	prop = RNA_def_property(srna, "matrix_local", PROP_FLOAT, PROP_MATRIX);
 	RNA_def_property_float_sdna(prop, NULL, "arm_mat");
 	RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Bone Armature-Relative Matrix", "4x4 bone matrix relative to armature");
 
-	prop= RNA_def_property(srna, "tail", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "tail", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "tail");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Tail", "Location of tail end of the bone");
+	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
 
-	prop= RNA_def_property(srna, "tail_local", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "tail_local", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "arm_tail");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Armature-Relative Tail", "Location of tail end of the bone relative to armature");
+	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
 
-	prop= RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "head");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Head", "Location of head end of the bone relative to its parent");
+	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
 
-	prop= RNA_def_property(srna, "head_local", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "head_local", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "arm_head");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Armature-Relative Head", "Location of head end of the bone relative to armature");
+	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
 
 	RNA_api_bone(srna);
 }
@@ -653,36 +670,36 @@ static void rna_def_edit_bone(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "EditBone", NULL);
+	srna = RNA_def_struct(brna, "EditBone", NULL);
 	RNA_def_struct_sdna(srna, "EditBone");
 	RNA_def_struct_idprops_func(srna, "rna_EditBone_idprops");
 	RNA_def_struct_ui_text(srna, "Edit Bone", "Editmode bone in an Armature datablock");
 	RNA_def_struct_ui_icon(srna, ICON_BONE_DATA);
 	
-	RNA_define_verify_sdna(0); // not in sdna
+	RNA_define_verify_sdna(0); /* not in sdna */
 
-	prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "EditBone");
 	RNA_def_property_pointer_funcs(prop, "rna_EditBone_parent_get", "rna_EditBone_parent_set", NULL, NULL);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Parent", "Parent edit bone (in same Armature)");
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 	
-	prop= RNA_def_property(srna, "roll", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "roll", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "roll");
 	RNA_def_property_ui_range(prop, -M_PI * 2, M_PI * 2, 0.1, 2);
 	RNA_def_property_ui_text(prop, "Roll", "Bone rotation around head-tail axis");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
 
-	prop= RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "head");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Head", "Location of head end of the bone");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
 
-	prop= RNA_def_property(srna, "tail", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "tail", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "tail");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Tail", "Location of tail end of the bone");
@@ -691,44 +708,45 @@ static void rna_def_edit_bone(BlenderRNA *brna)
 
 	rna_def_bone_common(srna, 1);
 
-	prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_HIDDEN_A);
 	RNA_def_property_ui_text(prop, "Hide", "Bone is not visible when in Edit Mode");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 
-	prop= RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_EDITMODE_LOCKED);
 	RNA_def_property_ui_text(prop, "Lock", "Bone is not able to be transformed when in Edit Mode");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 
-	prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_SELECTED);
 	RNA_def_property_ui_text(prop, "Select", "");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 
-	prop= RNA_def_property(srna, "select_head", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select_head", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_ROOTSEL);
 	RNA_def_property_ui_text(prop, "Head Select", "");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 	
-	prop= RNA_def_property(srna, "select_tail", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select_tail", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_TIPSEL);
 	RNA_def_property_ui_text(prop, "Tail Select", "");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 
 	/* calculated and read only, not actual data access */
-	prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
-	//RNA_def_property_float_sdna(prop, NULL, ""); // doesnt access any real data
+	prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
+	/*RNA_def_property_float_sdna(prop, NULL, "");  *//* doesnt access any real data */
 	RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_flag(prop, PROP_THICK_WRAP); /* no reference to original data */
 	RNA_def_property_ui_text(prop, "Editbone Matrix", "Read-only matrix calculated from the roll (armature space)");
-	RNA_def_property_float_funcs(prop, "rna_EditBone_matrix_get", NULL, NULL); // TODO - this could be made writable also
+		/* TODO - this could be made writable also */
+	RNA_def_property_float_funcs(prop, "rna_EditBone_matrix_get", NULL, NULL);
 
 	RNA_api_armature_edit_bone(srna);
 
@@ -742,16 +760,16 @@ static void rna_def_armature_bones(BlenderRNA *brna, PropertyRNA *cprop)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-//	FunctionRNA *func;
-//	PropertyRNA *parm;
+/*	FunctionRNA *func; */
+/*	PropertyRNA *parm; */
 
 	RNA_def_property_srna(cprop, "ArmatureBones");
-	srna= RNA_def_struct(brna, "ArmatureBones", NULL);
+	srna = RNA_def_struct(brna, "ArmatureBones", NULL);
 	RNA_def_struct_sdna(srna, "bArmature");
 	RNA_def_struct_ui_text(srna, "Armature Bones", "Collection of armature bones");
 
 
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Bone");
 	RNA_def_property_pointer_sdna(prop, NULL, "act_bone");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
@@ -759,7 +777,7 @@ static void rna_def_armature_bones(BlenderRNA *brna, PropertyRNA *cprop)
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_Armature_act_bone_set", NULL, NULL);
 
 	/* todo, redraw */
-//		RNA_def_property_collection_active(prop, prop_act);
+/*		RNA_def_property_collection_active(prop, prop_act); */
 }
 
 /* armature.bones.* */
@@ -772,38 +790,38 @@ static void rna_def_armature_edit_bones(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, "ArmatureEditBones");
-	srna= RNA_def_struct(brna, "ArmatureEditBones", NULL);
+	srna = RNA_def_struct(brna, "ArmatureEditBones", NULL);
 	RNA_def_struct_sdna(srna, "bArmature");
 	RNA_def_struct_ui_text(srna, "Armature EditBones", "Collection of armature edit bones");
 
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "EditBone");
 	RNA_def_property_pointer_sdna(prop, NULL, "act_edbone");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Active EditBone", "Armatures active edit bone");
-	//RNA_def_property_update(prop, 0, "rna_Armature_act_editbone_update");
+	/*RNA_def_property_update(prop, 0, "rna_Armature_act_editbone_update"); */
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_Armature_act_edit_bone_set", NULL, NULL);
 
 	/* todo, redraw */
-//		RNA_def_property_collection_active(prop, prop_act);
+/*		RNA_def_property_collection_active(prop, prop_act); */
 
 	/* add target */
-	func= RNA_def_function(srna, "new", "rna_Armature_edit_bone_new");
+	func = RNA_def_function(srna, "new", "rna_Armature_edit_bone_new");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Add a new bone");
-	parm= RNA_def_string(func, "name", "Object", 0, "", "New name for the bone");
+	parm = RNA_def_string(func, "name", "Object", 0, "", "New name for the bone");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
 	/* return type */
-	parm= RNA_def_pointer(func, "bone", "EditBone", "", "Newly created edit bone");
+	parm = RNA_def_pointer(func, "bone", "EditBone", "", "Newly created edit bone");
 	RNA_def_function_return(func, parm);
 
 	/* remove target */
-	func= RNA_def_function(srna, "remove", "rna_Armature_edit_bone_remove");
+	func = RNA_def_function(srna, "remove", "rna_Armature_edit_bone_remove");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	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");
+	parm = RNA_def_pointer(func, "bone", "EditBone", "", "EditBone to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 }
 
@@ -816,7 +834,8 @@ static void rna_def_armature(BlenderRNA *brna)
 		{ARM_OCTA, "OCTAHEDRAL", 0, "Octahedral", "Display bones as octahedral shape (default)"},
 		{ARM_LINE, "STICK", 0, "Stick", "Display bones as simple 2D lines with dots"},
 		{ARM_B_BONE, "BBONE", 0, "B-Bone", "Display bones as boxes, showing subdivision and B-Splines"},
-		{ARM_ENVELOPE, "ENVELOPE", 0, "Envelope", "Display bones as extruded spheres, showing deformation influence volume"},
+		{ARM_ENVELOPE, "ENVELOPE", 0, "Envelope",
+		               "Display bones as extruded spheres, showing deformation influence volume"},
 		{ARM_WIRE, "WIRE", 0, "Wire", "Display bones as thin wires, showing subdivision and B-Splines"},
 		{0, NULL, 0, NULL, NULL}};
 	static EnumPropertyItem prop_vdeformer[] = {
@@ -829,12 +848,12 @@ static void rna_def_armature(BlenderRNA *brna)
 		{ARM_GHOST_RANGE, "RANGE", 0, "In Range", "Display Ghosts of poses within specified range"},
 		{ARM_GHOST_KEYS, "KEYS", 0, "On Keyframes", "Display Ghosts of poses on Keyframes"},
 		{0, NULL, 0, NULL, NULL}};
-	static const EnumPropertyItem prop_pose_position_items[]= {
+	static const EnumPropertyItem prop_pose_position_items[] = {
 		{0, "POSE", 0, "Pose Position", "Show armature in posed state"},
 		{ARM_RESTPOS, "REST", 0, "Rest Position", "Show Armature in binding pose state (no posing possible)"},
 		{0, NULL, 0, NULL, NULL}};
 	
-	srna= RNA_def_struct(brna, "Armature", "ID");
+	srna = RNA_def_struct(brna, "Armature", "ID");
 	RNA_def_struct_ui_text(srna, "Armature",
 	                       "Armature datablock containing a hierarchy of bones, usually used for rigging characters");
 	RNA_def_struct_ui_icon(srna, ICON_ARMATURE_DATA);
@@ -844,53 +863,53 @@ static void rna_def_armature(BlenderRNA *brna)
 	rna_def_animdata_common(srna);
 	
 	/* Collections */
-	prop= RNA_def_property(srna, "bones", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "bones", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "bonebase", NULL);
 	RNA_def_property_collection_funcs(prop, 0, "rna_Armature_bones_next", NULL, NULL, NULL, NULL, NULL, NULL);
 	RNA_def_property_struct_type(prop, "Bone");
 	RNA_def_property_ui_text(prop, "Bones", "");
 	rna_def_armature_bones(brna, prop);
 
-	prop= RNA_def_property(srna, "edit_bones", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "edit_bones", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "edbo", NULL);
 	RNA_def_property_struct_type(prop, "EditBone");
 	RNA_def_property_ui_text(prop, "Edit Bones", "");
 	rna_def_armature_edit_bones(brna, prop);
 
 	/* Enum values */
-	prop= RNA_def_property(srna, "pose_position", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "pose_position", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, prop_pose_position_items);
 	RNA_def_property_ui_text(prop, "Pose Position", "Show armature in binding pose or final posed state");
 	RNA_def_property_update(prop, 0, "rna_Armature_update_data");
 	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
 	
-	prop= RNA_def_property(srna, "draw_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "draw_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "drawtype");
 	RNA_def_property_enum_items(prop, prop_drawtype_items);
 	RNA_def_property_ui_text(prop, "Draw Type", "");
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
 
-	prop= RNA_def_property(srna, "deform_method", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "deform_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "gevertdeformer");
 	RNA_def_property_enum_items(prop, prop_vdeformer);
 	RNA_def_property_ui_text(prop, "Vertex Deformer", "");
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
 	
-// XXX depreceated ....... old animviz for armatures only
-	prop= RNA_def_property(srna, "ghost_type", PROP_ENUM, PROP_NONE);
+/* XXX depreceated ....... old animviz for armatures only */
+	prop = RNA_def_property(srna, "ghost_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "ghosttype");
 	RNA_def_property_enum_items(prop, prop_ghost_type_items);
 	RNA_def_property_ui_text(prop, "Ghost Type", "Method of Onion-skinning for active Action");
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
-// XXX depreceated ....... old animviz for armatures only	
+/* XXX depreceated ....... old animviz for armatures only	 */
 
 	/* Boolean values */
 		/* layer */
-	prop= RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
+	prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
 	RNA_def_property_boolean_sdna(prop, NULL, "layer", 1);
 	RNA_def_property_array(prop, 32);
 	RNA_def_property_ui_text(prop, "Visible Layers", "Armature layer visibility");
@@ -899,86 +918,90 @@ static void rna_def_armature(BlenderRNA *brna)
 	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
 	
 		/* layer protection */
-	prop= RNA_def_property(srna, "layers_protected", PROP_BOOLEAN, PROP_LAYER);
+	prop = RNA_def_property(srna, "layers_protected", PROP_BOOLEAN, PROP_LAYER);
 	RNA_def_property_boolean_sdna(prop, NULL, "layer_protected", 1);
 	RNA_def_property_array(prop, 32);
 	RNA_def_property_ui_text(prop, "Layer Proxy Protection",
-	                         "Protected layers in Proxy Instances are restored to Proxy settings on file reload and undo");
+	                         "Protected layers in Proxy Instances are restored to Proxy settings "
+	                         "on file reload and undo");
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 		
 		/* flag */
-	prop= RNA_def_property(srna, "show_axes", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_axes", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_DRAWAXES);
 	RNA_def_property_ui_text(prop, "Draw Axes", "Draw bone axes");
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
 	
-	prop= RNA_def_property(srna, "show_names", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_names", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_DRAWNAMES);
 	RNA_def_property_ui_text(prop, "Draw Names", "Draw bone names");
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
 	
-	prop= RNA_def_property(srna, "use_deform_delay", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_deform_delay", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_DELAYDEFORM);
 	RNA_def_property_ui_text(prop, "Delay Deform", "Don't deform children when manipulating bones in Pose Mode");
 	RNA_def_property_update(prop, 0, "rna_Armature_update_data");
 	
-	prop= RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_MIRROR_EDIT);
 	RNA_def_property_ui_text(prop, "X-Axis Mirror", "Apply changes to matching bone on opposite side of X-Axis");
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
 	
-	prop= RNA_def_property(srna, "use_auto_ik", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_auto_ik", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_AUTO_IK);
-	RNA_def_property_ui_text(prop, "Auto IK", "Add temporaral IK constraints while grabbing bones in Pose Mode");
+	RNA_def_property_ui_text(prop, "Auto IK", "Add temporary IK constraints while grabbing bones in Pose Mode");
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
 	
-	prop= RNA_def_property(srna, "show_bone_custom_shapes", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_bone_custom_shapes", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ARM_NO_CUSTOM);
 	RNA_def_property_ui_text(prop, "Draw Custom Bone Shapes", "Draw bones with their custom shapes");
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 	
-	prop= RNA_def_property(srna, "show_group_colors", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_group_colors", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_COL_CUSTOM);
 	RNA_def_property_ui_text(prop, "Draw Bone Group Colors", "Draw bone group colors");
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 	
-// XXX depreceated ....... old animviz for armatures only
-	prop= RNA_def_property(srna, "show_only_ghost_selected", PROP_BOOLEAN, PROP_NONE);
+/* XXX depreceated ....... old animviz for armatures only */
+	prop = RNA_def_property(srna, "show_only_ghost_selected", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_GHOST_ONLYSEL);
 	RNA_def_property_ui_text(prop, "Draw Ghosts on Selected Bones Only", "");
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
-// XXX depreceated ....... old animviz for armatures only
+/* XXX depreceated ....... old animviz for armatures only */
 	
 		/* deformflag */
-	prop= RNA_def_property(srna, "use_deform_vertex_groups", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_deform_vertex_groups", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_VGROUP);
 	RNA_def_property_ui_text(prop, "Deform Vertex Groups", "Enable Vertex Groups when defining deform");
 	RNA_def_property_update(prop, 0, "rna_Armature_update_data");
 	
-	prop= RNA_def_property(srna, "use_deform_envelopes", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_deform_envelopes", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_ENVELOPE);
 	RNA_def_property_ui_text(prop, "Deform Envelopes", "Enable Bone Envelopes when defining deform");
 	RNA_def_property_update(prop, 0, "rna_Armature_update_data");
 	
-	prop= RNA_def_property(srna, "use_deform_preserve_volume", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_deform_preserve_volume", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_QUATERNION);
 	RNA_def_property_ui_text(prop, "Use Dual Quaternion Deformation", "Enable deform rotation with Quaternions");
 	RNA_def_property_update(prop, 0, "rna_Armature_update_data");
 	
-	//prop= RNA_def_property(srna, "deform_invert_vertexgroups", PROP_BOOLEAN, PROP_NONE);
-	//RNA_def_property_boolean_negative_sdna(prop, NULL, "deformflag", ARM_DEF_INVERT_VGROUP);
-	//RNA_def_property_ui_text(prop, "Invert Vertex Group Influence", "Invert Vertex Group influence (only for Modifiers)");
-	//RNA_def_property_update(prop, 0, "rna_Armature_update_data");
-	
+#if 0
+	prop = RNA_def_property(srna, "deform_invert_vertexgroups", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_negative_sdna(prop, NULL, "deformflag", ARM_DEF_INVERT_VGROUP);
+	RNA_def_property_ui_text(prop, "Invert Vertex Group Influence",
+	                         "Invert Vertex Group influence (only for Modifiers)");
+	RNA_def_property_update(prop, 0, "rna_Armature_update_data");
+#endif
+
 	/* Number fields */
-// XXX depreceated ....... old animviz for armatures only
+/* XXX depreceated ....... old animviz for armatures only */
 		/* ghost/onionskining settings */
-	prop= RNA_def_property(srna, "ghost_step", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "ghost_step", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "ghostep");
 	RNA_def_property_range(prop, 0, 30);
 	RNA_def_property_ui_text(prop, "Ghosting Step",
@@ -987,7 +1010,7 @@ static void rna_def_armature(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
 	
-	prop= RNA_def_property(srna, "ghost_size", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "ghost_size", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "ghostsize");
 	RNA_def_property_range(prop, 1, 20);
 	RNA_def_property_ui_text(prop, "Ghosting Frame Step",
@@ -995,7 +1018,7 @@ static void rna_def_armature(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
 	
-	prop= RNA_def_property(srna, "ghost_frame_start", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "ghost_frame_start", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "ghostsf");
 	RNA_def_property_int_funcs(prop, NULL, "rna_Armature_ghost_start_frame_set", NULL);
 	RNA_def_property_ui_text(prop, "Ghosting Start Frame",
@@ -1004,14 +1027,15 @@ static void rna_def_armature(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
 	
-	prop= RNA_def_property(srna, "ghost_frame_end", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "ghost_frame_end", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "ghostef");
 	RNA_def_property_int_funcs(prop, NULL, "rna_Armature_ghost_end_frame_set", NULL);
 	RNA_def_property_ui_text(prop, "Ghosting End Frame",
-	                         "End frame of range of Ghosts to display (not for 'Around Current Frame' Onion-skinning method)");
+	                         "End frame of range of Ghosts to display "
+	                         "(not for 'Around Current Frame' Onion-skinning method)");
 	RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
 	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
-// XXX depreceated ....... old animviz for armatures only	
+/* XXX depreceated ....... old animviz for armatures only */
 }
 
 void RNA_def_armature(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_armature_api.c b/source/blender/makesrna/intern/rna_armature_api.c
index fa07948..4a872dc 100644
--- a/source/blender/makesrna/intern/rna_armature_api.c
+++ b/source/blender/makesrna/intern/rna_armature_api.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
@@ -18,7 +18,7 @@
  * The Original Code is Copyright (C) 2009 Blender Foundation.
  * All rights reserved.
  *
- * 
+ *
  * Contributor(s): Campbell Barton
  *
  * ***** END GPL LICENSE BLOCK *****
@@ -44,13 +44,14 @@
 
 void rna_EditBone_align_roll(EditBone *ebo, float no[3])
 {
-	ebo->roll= ED_rollBoneToVector(ebo, no, FALSE);
+	ebo->roll = ED_rollBoneToVector(ebo, no, FALSE);
 }
 
 float rna_Bone_do_envelope(Bone *bone, float *vec)
 {
 	float scale = (bone->flag & BONE_MULT_VG_ENV) == BONE_MULT_VG_ENV ? bone->weight : 1.0f;
-	return distfactor_to_bone(vec, bone->arm_head, bone->arm_tail, bone->rad_head * scale, bone->rad_tail * scale, bone->dist * scale);
+	return distfactor_to_bone(vec, bone->arm_head, bone->arm_tail, bone->rad_head * scale,
+	                          bone->rad_tail * scale, bone->dist * scale);
 }
 
 #else
@@ -60,10 +61,10 @@ void RNA_api_armature_edit_bone(StructRNA *srna)
 	FunctionRNA *func;
 	PropertyRNA *parm;
 
-	func= RNA_def_function(srna, "align_roll", "rna_EditBone_align_roll");
+	func = RNA_def_function(srna, "align_roll", "rna_EditBone_align_roll");
 	RNA_def_function_ui_description(func, "Align the bone to a localspace roll so the Z axis "
 	                                "points in the direction of the vector given");
-	parm= RNA_def_float_vector(func, "vector", 3, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
+	parm = RNA_def_float_vector(func, "vector", 3, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 }
 
@@ -72,13 +73,13 @@ void RNA_api_bone(StructRNA *srna)
 	PropertyRNA *parm;
 	FunctionRNA *func;
 
-	func= RNA_def_function(srna, "evaluate_envelope", "rna_Bone_do_envelope");
+	func = RNA_def_function(srna, "evaluate_envelope", "rna_Bone_do_envelope");
 	RNA_def_function_ui_description(func, "Calculate bone envelope at given point");
-	parm= RNA_def_float_vector_xyz(func, "point", 3, NULL, -FLT_MAX, FLT_MAX, "Point",
+	parm = RNA_def_float_vector_xyz(func, "point", 3, NULL, -FLT_MAX, FLT_MAX, "Point",
 	                               "Position in 3d space to evaluate", -FLT_MAX, FLT_MAX);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return value */
-	parm= RNA_def_float(func, "factor", 0, -FLT_MAX, FLT_MAX, "Factor", "Envelope factor", -FLT_MAX, FLT_MAX);
+	parm = RNA_def_float(func, "factor", 0, -FLT_MAX, FLT_MAX, "Factor", "Envelope factor", -FLT_MAX, FLT_MAX);
 	RNA_def_function_return(func, parm);
 }
 
diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c
index 702f068..ce9edc1 100644
--- a/source/blender/makesrna/intern/rna_boid.c
+++ b/source/blender/makesrna/intern/rna_boid.c
@@ -46,23 +46,31 @@
 #include "WM_api.h"
 #include "WM_types.h"
 
-EnumPropertyItem boidrule_type_items[] ={
+EnumPropertyItem boidrule_type_items[] = {
 	{eBoidRuleType_Goal, "GOAL", 0, "Goal", "Go to assigned object or loudest assigned signal source"},
 	{eBoidRuleType_Avoid, "AVOID", 0, "Avoid", "Get away from assigned object or loudest assigned signal source"},
-	{eBoidRuleType_AvoidCollision, "AVOID_COLLISION", 0, "Avoid Collision", "Manoeuvre to avoid collisions with other boids and deflector objects in near future"},
+	{eBoidRuleType_AvoidCollision, "AVOID_COLLISION", 0, "Avoid Collision",
+	                               "Manoeuvre to avoid collisions with other boids and deflector objects in "
+	                               "near future"},
 	{eBoidRuleType_Separate, "SEPARATE", 0, "Separate", "Keep from going through other boids"},
 	{eBoidRuleType_Flock, "FLOCK", 0, "Flock", "Move to center of neighbors and match their velocity"},
 	{eBoidRuleType_FollowLeader, "FOLLOW_LEADER", 0, "Follow Leader", "Follow a boid or assigned object"},
 	{eBoidRuleType_AverageSpeed, "AVERAGE_SPEED", 0, "Average Speed", "Maintain speed, flight level or wander"},
 	{eBoidRuleType_Fight, "FIGHT", 0, "Fight", "Go to closest enemy and attack when in range"},
-	//{eBoidRuleType_Protect, "PROTECT", 0, "Protect", "Go to enemy closest to target and attack when in range"},
-	//{eBoidRuleType_Hide, "HIDE", 0, "Hide", "Find a deflector move to it's other side from closest enemy"},
-	//{eBoidRuleType_FollowPath, "FOLLOW_PATH", 0, "Follow Path", "Move along a assigned curve or closest curve in a group"},
-	//{eBoidRuleType_FollowWall, "FOLLOW_WALL", 0, "Follow Wall", "Move next to a deflector object's in direction of it's tangent"},
+#if 0
+	{eBoidRuleType_Protect, "PROTECT", 0, "Protect", "Go to enemy closest to target and attack when in range"},
+	{eBoidRuleType_Hide, "HIDE", 0, "Hide", "Find a deflector move to it's other side from closest enemy"},
+	{eBoidRuleType_FollowPath, "FOLLOW_PATH", 0, "Follow Path",
+	                           "Move along a assigned curve or closest curve in a group"},
+	{eBoidRuleType_FollowWall, "FOLLOW_WALL", 0, "Follow Wall",
+	                           "Move next to a deflector object's in direction of it's tangent"},
+#endif
 	{0, NULL, 0, NULL, NULL}};
 
-EnumPropertyItem boidruleset_type_items[] ={
-	{eBoidRulesetType_Fuzzy, "FUZZY", 0, "Fuzzy", "Rules are gone through top to bottom. Only the first rule that effect above fuzziness threshold is evaluated"},
+EnumPropertyItem boidruleset_type_items[] = {
+	{eBoidRulesetType_Fuzzy, "FUZZY", 0, "Fuzzy",
+	                         "Rules are gone through top to bottom (only the first rule which effect is above "
+	                         "fuzziness threshold is evaluated)"},
 	{eBoidRulesetType_Random, "RANDOM", 0, "Random", "A random rule is selected for each boid"},
 	{eBoidRulesetType_Average, "AVERAGE", 0, "Average", "All rules are averaged"},
 	{0, NULL, 0, NULL, NULL}};
@@ -76,7 +84,7 @@ EnumPropertyItem boidruleset_type_items[] ={
 
 static void rna_Boids_reset(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	if(ptr->type==&RNA_ParticleSystem) {
+	if (ptr->type == &RNA_ParticleSystem) {
 		ParticleSystem *psys = (ParticleSystem*)ptr->data;
 		
 		psys->recalc = PSYS_RECALC_RESET;
@@ -90,7 +98,7 @@ static void rna_Boids_reset(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRN
 }
 static void rna_Boids_reset_deps(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	if(ptr->type==&RNA_ParticleSystem) {
+	if (ptr->type == &RNA_ParticleSystem) {
 		ParticleSystem *psys = (ParticleSystem*)ptr->data;
 		
 		psys->recalc = PSYS_RECALC_RESET;
@@ -107,9 +115,9 @@ static void rna_Boids_reset_deps(Main *bmain, Scene *scene, PointerRNA *ptr)
 
 static StructRNA* rna_BoidRule_refine(struct PointerRNA *ptr)
 {
-	BoidRule *rule= (BoidRule*)ptr->data;
+	BoidRule *rule = (BoidRule*)ptr->data;
 
-	switch(rule->type) {
+	switch (rule->type) {
 		case eBoidRuleType_Goal:
 			return &RNA_BoidRuleGoal;
 		case eBoidRuleType_Avoid:
@@ -129,36 +137,36 @@ static StructRNA* rna_BoidRule_refine(struct PointerRNA *ptr)
 
 static char *rna_BoidRule_path(PointerRNA *ptr)
 {
-	return BLI_sprintfN("rules[\"%s\"]", ((BoidRule*)ptr->data)->name);  // XXX not unique
+	return BLI_sprintfN("rules[\"%s\"]", ((BoidRule*)ptr->data)->name);  /* XXX not unique */
 }
 
 static PointerRNA rna_BoidState_active_boid_rule_get(PointerRNA *ptr)
 {
-	BoidState *state= (BoidState*)ptr->data;
+	BoidState *state = (BoidState*)ptr->data;
 	BoidRule *rule = (BoidRule*)state->rules.first;
 
-	for(; rule; rule=rule->next) {
-		if(rule->flag & BOIDRULE_CURRENT)
+	for (; rule; rule = rule->next) {
+		if (rule->flag & BOIDRULE_CURRENT)
 			return rna_pointer_inherit_refine(ptr, &RNA_BoidRule, rule);
 	}
 	return rna_pointer_inherit_refine(ptr, &RNA_BoidRule, NULL);
 }
-static void rna_BoidState_active_boid_rule_index_range(PointerRNA *ptr, int *min, int *max)
+static void rna_BoidState_active_boid_rule_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
 {
-	BoidState *state= (BoidState*)ptr->data;
-	*min= 0;
-	*max= BLI_countlist(&state->rules)-1;
-	*max= MAX2(0, *max);
+	BoidState *state = (BoidState*)ptr->data;
+	*min = 0;
+	*max = BLI_countlist(&state->rules)-1;
+	*max = MAX2(0, *max);
 }
 
 static int rna_BoidState_active_boid_rule_index_get(PointerRNA *ptr)
 {
-	BoidState *state= (BoidState*)ptr->data;
+	BoidState *state = (BoidState*)ptr->data;
 	BoidRule *rule = (BoidRule*)state->rules.first;
-	int i=0;
+	int i = 0;
 
-	for(; rule; rule=rule->next, i++) {
-		if(rule->flag & BOIDRULE_CURRENT)
+	for (; rule; rule = rule->next, i++) {
+		if (rule->flag & BOIDRULE_CURRENT)
 			return i;
 	}
 	return 0;
@@ -166,12 +174,12 @@ static int rna_BoidState_active_boid_rule_index_get(PointerRNA *ptr)
 
 static void rna_BoidState_active_boid_rule_index_set(struct PointerRNA *ptr, int value)
 {
-	BoidState *state= (BoidState*)ptr->data;
+	BoidState *state = (BoidState*)ptr->data;
 	BoidRule *rule = (BoidRule*)state->rules.first;
-	int i=0;
+	int i = 0;
 
-	for(; rule; rule=rule->next, i++) {
-		if(i==value)
+	for (; rule; rule = rule->next, i++) {
+		if (i == value)
 			rule->flag |= BOIDRULE_CURRENT;
 		else
 			rule->flag &= ~BOIDRULE_CURRENT;
@@ -180,7 +188,7 @@ static void rna_BoidState_active_boid_rule_index_set(struct PointerRNA *ptr, int
 
 static int particle_id_check(PointerRNA *ptr)
 {
-	ID *id= ptr->id.data;
+	ID *id = ptr->id.data;
 
 	return (GS(id->name) == ID_PA);
 }
@@ -189,7 +197,7 @@ static char *rna_BoidSettings_path(PointerRNA *ptr)
 {
 	BoidSettings *boids = (BoidSettings *)ptr->data;
 	
-	if(particle_id_check(ptr)) {
+	if (particle_id_check(ptr)) {
 		ParticleSettings *part = (ParticleSettings*)ptr->id.data;
 		
 		if (part->boids == boids)
@@ -200,31 +208,32 @@ static char *rna_BoidSettings_path(PointerRNA *ptr)
 
 static PointerRNA rna_BoidSettings_active_boid_state_get(PointerRNA *ptr)
 {
-	BoidSettings *boids= (BoidSettings*)ptr->data;
+	BoidSettings *boids = (BoidSettings*)ptr->data;
 	BoidState *state = (BoidState*)boids->states.first;
 
-	for(; state; state=state->next) {
-		if(state->flag & BOIDSTATE_CURRENT)
+	for (; state; state = state->next) {
+		if (state->flag & BOIDSTATE_CURRENT)
 			return rna_pointer_inherit_refine(ptr, &RNA_BoidState, state);
 	}
 	return rna_pointer_inherit_refine(ptr, &RNA_BoidState, NULL);
 }
-static void rna_BoidSettings_active_boid_state_index_range(PointerRNA *ptr, int *min, int *max)
+static void rna_BoidSettings_active_boid_state_index_range(PointerRNA *ptr, int *min, int *max,
+                                                           int *softmin, int *softmax)
 {
-	BoidSettings *boids= (BoidSettings*)ptr->data;
-	*min= 0;
-	*max= BLI_countlist(&boids->states)-1;
-	*max= MAX2(0, *max);
+	BoidSettings *boids = (BoidSettings*)ptr->data;
+	*min = 0;
+	*max = BLI_countlist(&boids->states)-1;
+	*max = MAX2(0, *max);
 }
 
 static int rna_BoidSettings_active_boid_state_index_get(PointerRNA *ptr)
 {
-	BoidSettings *boids= (BoidSettings*)ptr->data;
+	BoidSettings *boids = (BoidSettings*)ptr->data;
 	BoidState *state = (BoidState*)boids->states.first;
-	int i=0;
+	int i = 0;
 
-	for(; state; state=state->next, i++) {
-		if(state->flag & BOIDSTATE_CURRENT)
+	for (; state; state = state->next, i++) {
+		if (state->flag & BOIDSTATE_CURRENT)
 			return i;
 	}
 	return 0;
@@ -232,12 +241,12 @@ static int rna_BoidSettings_active_boid_state_index_get(PointerRNA *ptr)
 
 static void rna_BoidSettings_active_boid_state_index_set(struct PointerRNA *ptr, int value)
 {
-	BoidSettings *boids= (BoidSettings*)ptr->data;
+	BoidSettings *boids = (BoidSettings*)ptr->data;
 	BoidState *state = (BoidState*)boids->states.first;
-	int i=0;
+	int i = 0;
 
-	for(; state; state=state->next, i++) {
-		if(i==value)
+	for (; state; state = state->next, i++) {
+		if (i == value)
 			state->flag |= BOIDSTATE_CURRENT;
 		else
 			state->flag &= ~BOIDSTATE_CURRENT;
@@ -251,17 +260,17 @@ static void rna_def_boidrule_goal(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "BoidRuleGoal", "BoidRule");
+	srna = RNA_def_struct(brna, "BoidRuleGoal", "BoidRule");
 	RNA_def_struct_ui_text(srna, "Goal", "");
 	RNA_def_struct_sdna(srna, "BoidRuleGoalAvoid");
 
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "ob");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Object", "Goal object");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset_deps");
 
-	prop= RNA_def_property(srna, "use_predict", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_predict", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "options", BRULE_GOAL_AVOID_PREDICT);
 	RNA_def_property_ui_text(prop, "Predict", "Predict target movement");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
@@ -272,22 +281,22 @@ static void rna_def_boidrule_avoid(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "BoidRuleAvoid", "BoidRule");
+	srna = RNA_def_struct(brna, "BoidRuleAvoid", "BoidRule");
 	RNA_def_struct_ui_text(srna, "Avoid", "");
 	RNA_def_struct_sdna(srna, "BoidRuleGoalAvoid");
 
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "ob");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Object", "Object to avoid");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset_deps");
 
-	prop= RNA_def_property(srna, "use_predict", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_predict", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "options", BRULE_GOAL_AVOID_PREDICT);
 	RNA_def_property_ui_text(prop, "Predict", "Predict target movement");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "fear_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "fear_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 100.0f);
 	RNA_def_property_ui_text(prop, "Fear factor", "Avoid object if danger from it is above this threshold");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
@@ -298,20 +307,20 @@ static void rna_def_boidrule_avoid_collision(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "BoidRuleAvoidCollision", "BoidRule");
+	srna = RNA_def_struct(brna, "BoidRuleAvoidCollision", "BoidRule");
 	RNA_def_struct_ui_text(srna, "Avoid Collision", "");
 
-	prop= RNA_def_property(srna, "use_avoid", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_avoid", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "options", BRULE_ACOLL_WITH_BOIDS);
 	RNA_def_property_ui_text(prop, "Boids", "Avoid collision with other boids");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "use_avoid_collision", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_avoid_collision", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "options", BRULE_ACOLL_WITH_DEFLECTORS);
 	RNA_def_property_ui_text(prop, "Deflectors", "Avoid collision with deflector objects");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "look_ahead", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "look_ahead", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 100.0f);
 	RNA_def_property_ui_text(prop, "Look ahead", "Time to look ahead in seconds");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
@@ -322,27 +331,27 @@ static void rna_def_boidrule_follow_leader(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "BoidRuleFollowLeader", "BoidRule");
+	srna = RNA_def_struct(brna, "BoidRuleFollowLeader", "BoidRule");
 	RNA_def_struct_ui_text(srna, "Follow Leader", "");
 
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "ob");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Object", "Follow this object instead of a boid");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset_deps");
 
-	prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 100.0f);
 	RNA_def_property_ui_text(prop, "Distance", "Distance behind leader to follow");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "queue_count", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "queue_count", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "queue_size");
 	RNA_def_property_range(prop, 0.0f, 100.0f);
 	RNA_def_property_ui_text(prop, "Queue Size", "How many boids in a line");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "use_line", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_line", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "options", BRULE_LEADER_IN_LINE);
 	RNA_def_property_ui_text(prop, "Line", "Follow leader in a line");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
@@ -353,20 +362,20 @@ static void rna_def_boidrule_average_speed(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "BoidRuleAverageSpeed", "BoidRule");
+	srna = RNA_def_struct(brna, "BoidRuleAverageSpeed", "BoidRule");
 	RNA_def_struct_ui_text(srna, "Average Speed", "");
 
-	prop= RNA_def_property(srna, "wander", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "wander", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Wander", "How fast velocity's direction is randomized");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "level", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "level", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Level", "How much velocity's z-component is kept constant");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "speed", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "speed", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Speed", "Percentage of maximum speed");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
@@ -377,15 +386,15 @@ static void rna_def_boidrule_fight(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "BoidRuleFight", "BoidRule");
+	srna = RNA_def_struct(brna, "BoidRuleFight", "BoidRule");
 	RNA_def_struct_ui_text(srna, "Fight", "");
 
-	prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 100.0f);
 	RNA_def_property_ui_text(prop, "Fight Distance", "Attack boids at max this distance");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "flee_distance", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "flee_distance", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 100.0f);
 	RNA_def_property_ui_text(prop, "Flee Distance", "Flee to this distance");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
@@ -397,37 +406,37 @@ static void rna_def_boidrule(BlenderRNA *brna)
 	PropertyRNA *prop;
 	
 	/* data */
-	srna= RNA_def_struct(brna, "BoidRule", NULL);
+	srna = RNA_def_struct(brna, "BoidRule", NULL);
 	RNA_def_struct_ui_text(srna , "Boid Rule", "");
 	RNA_def_struct_refine_func(srna, "rna_BoidRule_refine");
 	RNA_def_struct_path_func(srna, "rna_BoidRule_path");
 	
 	/* strings */
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Name", "Boid rule name");
 	RNA_def_struct_name_property(srna, prop);
 	
 	/* enums */
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, boidrule_type_items);
 	RNA_def_property_ui_text(prop, "Type", "");
 	
 	/* flags */
-	prop= RNA_def_property(srna, "use_in_air", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_in_air", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BOIDRULE_IN_AIR);
 	RNA_def_property_ui_text(prop, "In Air", "Use rule when boid is flying");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 	
-	prop= RNA_def_property(srna, "use_on_land", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_on_land", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BOIDRULE_ON_LAND);
 	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);
-	//RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Expanded);
-	//RNA_def_property_ui_text(prop, "Expanded", "Set modifier expanded in the user interface");
+	/*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"); */
 
 	/* types */
 	rna_def_boidrule_goal(brna);
@@ -446,39 +455,41 @@ static void rna_def_boidstate(BlenderRNA *brna)
 	srna = RNA_def_struct(brna, "BoidState", NULL);
 	RNA_def_struct_ui_text(srna, "Boid State", "Boid state for boid physics");
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Name", "Boid state name");
 	RNA_def_struct_name_property(srna, prop);
 
-	prop= RNA_def_property(srna, "ruleset_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "ruleset_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, boidruleset_type_items);
 	RNA_def_property_ui_text(prop, "Rule Evaluation", "How the rules in the list are evaluated");
 
-	prop= RNA_def_property(srna, "rules", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "rules", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "BoidRule");
 	RNA_def_property_ui_text(prop, "Boid Rules", "");
 
-	prop= RNA_def_property(srna, "active_boid_rule", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active_boid_rule", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "BoidRule");
 	RNA_def_property_pointer_funcs(prop, "rna_BoidState_active_boid_rule_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Active Boid Rule", "");
 
-	prop= RNA_def_property(srna, "active_boid_rule_index", PROP_INT, PROP_UNSIGNED);
-	RNA_def_property_int_funcs(prop, "rna_BoidState_active_boid_rule_index_get", "rna_BoidState_active_boid_rule_index_set", "rna_BoidState_active_boid_rule_index_range");
+	prop = RNA_def_property(srna, "active_boid_rule_index", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_int_funcs(prop, "rna_BoidState_active_boid_rule_index_get",
+	                           "rna_BoidState_active_boid_rule_index_set",
+	                           "rna_BoidState_active_boid_rule_index_range");
 	RNA_def_property_ui_text(prop, "Active Boid Rule Index", "");
 
-	prop= RNA_def_property(srna, "rule_fuzzy", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "rule_fuzzy", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "rule_fuzziness");
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_text(prop, "Rule Fuzziness", "");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0, 100.0);
 	RNA_def_property_ui_text(prop, "Volume", "");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0, 10.0);
 	RNA_def_property_ui_text(prop, "Falloff", "");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
@@ -492,144 +503,150 @@ static void rna_def_boid_settings(BlenderRNA *brna)
 	RNA_def_struct_path_func(srna, "rna_BoidSettings_path");
 	RNA_def_struct_ui_text(srna, "Boid Settings", "Settings for boid physics");
 
-	prop= RNA_def_property(srna, "land_smooth", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "land_smooth", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "landing_smoothness");
 	RNA_def_property_range(prop, 0.0, 10.0);
 	RNA_def_property_ui_text(prop, "Landing Smoothness", "How smoothly the boids land");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "bank", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "bank", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "banking");
 	RNA_def_property_range(prop, 0.0, 2.0);
 	RNA_def_property_ui_text(prop, "Banking", "Amount of rotation around velocity vector on turns");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "pitch");
 	RNA_def_property_range(prop, 0.0, 2.0);
 	RNA_def_property_ui_text(prop, "Pitch", "Amount of rotation around side vector");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0, 2.0);
 	RNA_def_property_ui_text(prop, "Height", "Boid height relative to particle size");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
 	/* states */
-	prop= RNA_def_property(srna, "states", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "states", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "BoidState");
 	RNA_def_property_ui_text(prop, "Boid States", "");
 
-	prop= RNA_def_property(srna, "active_boid_state", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active_boid_state", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "BoidRule");
 	RNA_def_property_pointer_funcs(prop, "rna_BoidSettings_active_boid_state_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Active Boid Rule", "");
 
-	prop= RNA_def_property(srna, "active_boid_state_index", PROP_INT, PROP_UNSIGNED);
-	RNA_def_property_int_funcs(prop, "rna_BoidSettings_active_boid_state_index_get", "rna_BoidSettings_active_boid_state_index_set", "rna_BoidSettings_active_boid_state_index_range");
+	prop = RNA_def_property(srna, "active_boid_state_index", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_int_funcs(prop, "rna_BoidSettings_active_boid_state_index_get",
+	                           "rna_BoidSettings_active_boid_state_index_set",
+	                           "rna_BoidSettings_active_boid_state_index_range");
 	RNA_def_property_ui_text(prop, "Active Boid State Index", "");
 
 	/* character properties */
-	prop= RNA_def_property(srna, "health", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "health", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0, 100.0);
 	RNA_def_property_ui_text(prop, "Health", "Initial boid health when born");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0, 100.0);
 	RNA_def_property_ui_text(prop, "Strength", "Maximum caused damage on attack per second");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "aggression", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "aggression", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0, 100.0);
 	RNA_def_property_ui_text(prop, "Aggression", "Boid will fight this times stronger enemy");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "accuracy", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "accuracy", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_text(prop, "Accuracy", "Accuracy of attack");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "range", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "range", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0, 100.0);
 	RNA_def_property_ui_text(prop, "Range", "Maximum distance from which a boid can attack");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
 	/* physical properties */
-	prop= RNA_def_property(srna, "air_speed_min", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "air_speed_min", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "air_min_speed");
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_text(prop, "Min Air Speed", "Minimum speed in air (relative to maximum speed)");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "air_speed_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "air_speed_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "air_max_speed");
 	RNA_def_property_range(prop, 0.0, 100.0);
 	RNA_def_property_ui_text(prop, "Max Air Speed", "Maximum speed in air");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "air_acc_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "air_acc_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "air_max_acc");
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_text(prop, "Max Air Acceleration", "Maximum acceleration in air (relative to maximum speed)");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "air_ave_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "air_ave_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "air_max_ave");
 	RNA_def_property_range(prop, 0.0, 1.0);
-	RNA_def_property_ui_text(prop, "Max Air Angular Velocity", "Maximum angular velocity in air (relative to 180 degrees)");
+	RNA_def_property_ui_text(prop, "Max Air Angular Velocity",
+	                         "Maximum angular velocity in air (relative to 180 degrees)");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "air_personal_space", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "air_personal_space", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0, 10.0);
 	RNA_def_property_ui_text(prop, "Air Personal Space", "Radius of boids personal space in air (% of particle size)");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "land_jump_speed", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "land_jump_speed", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0, 100.0);
 	RNA_def_property_ui_text(prop, "Jump Speed", "Maximum speed for jumping");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "land_speed_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "land_speed_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "land_max_speed");
 	RNA_def_property_range(prop, 0.0, 100.0);
 	RNA_def_property_ui_text(prop, "Max Land Speed", "Maximum speed on land");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "land_acc_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "land_acc_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "land_max_acc");
 	RNA_def_property_range(prop, 0.0, 1.0);
-	RNA_def_property_ui_text(prop, "Max Land Acceleration", "Maximum acceleration on land (relative to maximum speed)");
+	RNA_def_property_ui_text(prop, "Max Land Acceleration",
+	                         "Maximum acceleration on land (relative to maximum speed)");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "land_ave_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "land_ave_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "land_max_ave");
 	RNA_def_property_range(prop, 0.0, 1.0);
-	RNA_def_property_ui_text(prop, "Max Land Angular Velocity", "Maximum angular velocity on land (relative to 180 degrees)");
+	RNA_def_property_ui_text(prop, "Max Land Angular Velocity",
+	                         "Maximum angular velocity on land (relative to 180 degrees)");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "land_personal_space", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "land_personal_space", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0, 10.0);
-	RNA_def_property_ui_text(prop, "Land Personal Space", "Radius of boids personal space on land (% of particle size)");
+	RNA_def_property_ui_text(prop, "Land Personal Space",
+	                         "Radius of boids personal space on land (% of particle size)");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "land_stick_force", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "land_stick_force", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0, 1000.0);
 	RNA_def_property_ui_text(prop, "Land Stick Force", "How strong a force must be to start effecting a boid on land");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
 	/* options */
-	prop= RNA_def_property(srna, "use_flight", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_flight", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "options", BOID_ALLOW_FLIGHT);
 	RNA_def_property_ui_text(prop, "Allow Flight", "Allow boids to move in air");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "use_land", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_land", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "options", BOID_ALLOW_LAND);
 	RNA_def_property_ui_text(prop, "Allow Land", "Allow boids to move on land");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
 
-	prop= RNA_def_property(srna, "use_climb", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_climb", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "options", BOID_ALLOW_CLIMB);
 	RNA_def_property_ui_text(prop, "Allow Climbing", "Allow boids to climb goal objects");
 	RNA_def_property_update(prop, 0, "rna_Boids_reset");
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index c1f8724..5093c1a 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -43,7 +43,7 @@
 
 #include "WM_types.h"
 
-static EnumPropertyItem prop_direction_items[]= {
+static EnumPropertyItem prop_direction_items[] = {
 	{0, "ADD", 0, "Add", "Add effect of brush"},
 	{BRUSH_DIR_IN, "SUBTRACT", 0, "Subtract", "Subtract effect of brush"},
 	{0, NULL, 0, NULL, NULL}};
@@ -51,6 +51,7 @@ static EnumPropertyItem prop_direction_items[]= {
 EnumPropertyItem brush_sculpt_tool_items[] = {
 	{SCULPT_TOOL_BLOB, "BLOB", ICON_BRUSH_BLOB, "Blob", ""},
 	{SCULPT_TOOL_CLAY, "CLAY", ICON_BRUSH_CLAY, "Clay", ""},
+	{SCULPT_TOOL_CLAY_STRIPS, "CLAY_STRIPS", ICON_BRUSH_CLAY_STRIPS, "Clay Strips", ""},
 	{SCULPT_TOOL_CREASE, "CREASE",ICON_BRUSH_CREASE, "Crease", ""},
 	{SCULPT_TOOL_DRAW, "DRAW", ICON_BRUSH_SCULPT_DRAW, "Draw", ""},
 	{SCULPT_TOOL_FILL, "FILL", ICON_BRUSH_FILL, "Fill", ""},
@@ -100,14 +101,134 @@ EnumPropertyItem brush_image_tool_items[] = {
 
 #include "WM_api.h"
 
+static int rna_SculptCapabilities_has_accumulate_get(PointerRNA *ptr)
+{
+	Brush *br = (Brush*)ptr->data;
+	return ELEM6(br->sculpt_tool,
+				 SCULPT_TOOL_BLOB, SCULPT_TOOL_CLAY, SCULPT_TOOL_CREASE,
+				 SCULPT_TOOL_DRAW, SCULPT_TOOL_INFLATE, SCULPT_TOOL_LAYER);
+}
+
+static int rna_SculptCapabilities_has_auto_smooth_get(PointerRNA *ptr)
+{
+	Brush *br = (Brush*)ptr->data;
+	return br->sculpt_tool != SCULPT_TOOL_SMOOTH;
+}
+
+static int rna_SculptCapabilities_has_height_get(PointerRNA *ptr)
+{
+	Brush *br = (Brush*)ptr->data;
+	return br->sculpt_tool == SCULPT_TOOL_LAYER;
+}
+
+static int rna_SculptCapabilities_has_jitter_get(PointerRNA *ptr)
+{
+	Brush *br = (Brush*)ptr->data;
+	return (!(br->flag & BRUSH_ANCHORED) &&
+			!(br->flag & BRUSH_RESTORE_MESH) &&
+			!ELEM4(br->sculpt_tool,
+				   SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE,
+				   SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB));
+}
+
+static int rna_SculptCapabilities_has_normal_weight_get(PointerRNA *ptr)
+{
+	Brush *br = (Brush*)ptr->data;
+	return ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK);
+}
+
+static int rna_SculptCapabilities_has_persistence_get(PointerRNA *ptr)
+{
+	Brush *br = (Brush*)ptr->data;
+	return br->sculpt_tool == SCULPT_TOOL_LAYER;
+}
+
+static int rna_SculptCapabilities_has_pinch_factor_get(PointerRNA *ptr)
+{
+	Brush *br = (Brush*)ptr->data;
+	return ELEM(br->sculpt_tool, SCULPT_TOOL_BLOB, SCULPT_TOOL_CREASE);
+}
+
+static int rna_SculptCapabilities_has_plane_offset_get(PointerRNA *ptr)
+{
+	Brush *br = (Brush*)ptr->data;
+	return ELEM5(br->sculpt_tool, SCULPT_TOOL_CLAY, SCULPT_TOOL_CLAY_STRIPS,
+				 SCULPT_TOOL_FILL, SCULPT_TOOL_FLATTEN, SCULPT_TOOL_SCRAPE);
+}
+
+static int rna_SculptCapabilities_has_random_texture_angle_get(PointerRNA *ptr)
+{
+	Brush *br = (Brush*)ptr->data;
+	return ((br->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) &&
+			!(br->flag & BRUSH_ANCHORED) &&
+			!ELEM4(br->sculpt_tool,
+				   SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE,
+				   SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB));
+}
+
+static int rna_SculptCapabilities_has_sculpt_plane_get(PointerRNA *ptr)
+{
+	Brush *br = (Brush*)ptr->data;
+	return !ELEM3(br->sculpt_tool, SCULPT_TOOL_INFLATE, SCULPT_TOOL_PINCH,
+				  SCULPT_TOOL_SMOOTH);
+}
+
+static int rna_SculptCapabilities_has_secondary_color_get(PointerRNA *ptr)
+{
+	Brush *br = (Brush*)ptr->data;
+	return ELEM10(br->sculpt_tool,
+				  SCULPT_TOOL_BLOB, SCULPT_TOOL_CLAY, SCULPT_TOOL_CLAY_STRIPS,
+				  SCULPT_TOOL_CREASE, SCULPT_TOOL_DRAW, SCULPT_TOOL_FILL,
+				  SCULPT_TOOL_FLATTEN, SCULPT_TOOL_INFLATE, SCULPT_TOOL_PINCH,
+				  SCULPT_TOOL_SCRAPE);
+}
+
+static int rna_SculptCapabilities_has_smooth_stroke_get(PointerRNA *ptr)
+{
+	Brush *br = (Brush*)ptr->data;
+	return (!(br->flag & BRUSH_ANCHORED) &&
+			!(br->flag & BRUSH_RESTORE_MESH) &&
+			!ELEM4(br->sculpt_tool,
+				   SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE,
+				   SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB));
+}
+
+static int rna_SculptCapabilities_has_space_attenuation_get(PointerRNA *ptr)
+{
+	Brush *br = (Brush*)ptr->data;
+	return ((br->flag & BRUSH_SPACE) &&
+			!ELEM4(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE,
+			   SCULPT_TOOL_SMOOTH, SCULPT_TOOL_SNAKE_HOOK));
+}
+
+static int rna_SculptCapabilities_has_spacing_get(PointerRNA *ptr)
+{
+	Brush *br = (Brush*)ptr->data;
+	return (!(br->flag & BRUSH_ANCHORED) &&
+			!ELEM4(br->sculpt_tool,
+				   SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE,
+				   SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB));
+}
+
+static int rna_SculptCapabilities_has_strength_get(PointerRNA *ptr)
+{
+	Brush *br = (Brush*)ptr->data;
+	return !ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK);
+}
+
+static PointerRNA rna_Brush_sculpt_capabilities_get(PointerRNA *ptr)
+{
+	return rna_pointer_inherit_refine(ptr, &RNA_SculptCapabilities, ptr->id.data);
+}
+
 static void rna_Brush_reset_icon(Brush *br, const char *UNUSED(type))
 {
 	ID *id = &br->id;
 
-	if(br->flag & BRUSH_CUSTOM_ICON)
+	if (br->flag & BRUSH_CUSTOM_ICON)
 		return;
 
-	if(id->icon_id >= BIFICONID_LAST) {
+	if (id->icon_id >= BIFICONID_LAST) {
 		BKE_icon_delete(id);
 		BKE_previewimg_free_id(id);
 	}
@@ -117,44 +238,44 @@ static void rna_Brush_reset_icon(Brush *br, const char *UNUSED(type))
 
 static void rna_Brush_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	Brush *br= (Brush*)ptr->data;
+	Brush *br = (Brush*)ptr->data;
 	WM_main_add_notifier(NC_BRUSH|NA_EDITED, br);
-	//WM_main_add_notifier(NC_SPACE|ND_SPACE_VIEW3D, NULL);
+	/*WM_main_add_notifier(NC_SPACE|ND_SPACE_VIEW3D, NULL); */
 }
 
 static void rna_Brush_sculpt_tool_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Brush *br= (Brush*)ptr->data;
+	Brush *br = (Brush*)ptr->data;
 	rna_Brush_reset_icon(br, "sculpt");
 	rna_Brush_update(bmain, scene, ptr);
 }
  
 static void rna_Brush_vertex_tool_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Brush *br= (Brush*)ptr->data;
+	Brush *br = (Brush*)ptr->data;
 	rna_Brush_reset_icon(br, "vertex_paint");
 	rna_Brush_update(bmain, scene, ptr);
 }
  
 static void rna_Brush_imagepaint_tool_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Brush *br= (Brush*)ptr->data;
+	Brush *br = (Brush*)ptr->data;
 	rna_Brush_reset_icon(br, "image_paint");
 	rna_Brush_update(bmain, scene, ptr);
 }
 
 static void rna_Brush_icon_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	Brush *br= (Brush*)ptr->data;
+	Brush *br = (Brush*)ptr->data;
 
-	if(br->icon_imbuf) {
+	if (br->icon_imbuf) {
 		IMB_freeImBuf(br->icon_imbuf);
-		br->icon_imbuf= NULL;
+		br->icon_imbuf = NULL;
 	}
 
 	br->id.icon_id = 0;
 
-	if(br->flag & BRUSH_CUSTOM_ICON) {
+	if (br->flag & BRUSH_CUSTOM_ICON) {
 		BKE_previewimg_get(&br->id);
 		BKE_icon_changed(BKE_icon_getid(&br->id));
 	}
@@ -169,7 +290,7 @@ static void rna_Brush_set_size(PointerRNA *ptr, int value)
 	/* scale unprojected radius so it stays consistent with brush size */
 	brush_scale_unprojected_radius(&brush->unprojected_radius,
 								   value, brush->size);
-	brush->size= value;
+	brush->size = value;
 }
 
 static void rna_Brush_set_unprojected_radius(PointerRNA *ptr, float value)
@@ -178,40 +299,41 @@ static void rna_Brush_set_unprojected_radius(PointerRNA *ptr, float value)
 
 	/* scale brush size so it stays consistent with unprojected_radius */
 	brush_scale_size(&brush->size, value, brush->unprojected_radius);
-	brush->unprojected_radius= value;
+	brush->unprojected_radius = value;
 }
 
-static EnumPropertyItem *rna_Brush_direction_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
+static EnumPropertyItem *rna_Brush_direction_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+                                                   PropertyRNA *UNUSED(prop), int *UNUSED(free))
 {
-	static EnumPropertyItem prop_default_items[]= {
+	static EnumPropertyItem prop_default_items[] = {
 		{0, NULL, 0, NULL, NULL}};
 
-	static EnumPropertyItem prop_flatten_contrast_items[]= {
+	static EnumPropertyItem prop_flatten_contrast_items[] = {
 		{0, "FLATTEN", 0, "Flatten", "Add effect of brush"},
 		{BRUSH_DIR_IN, "CONTRAST", 0, "Contrast", "Subtract effect of brush"},
 		{0, NULL, 0, NULL, NULL}};
 
-	static EnumPropertyItem prop_fill_deepen_items[]= {
+	static EnumPropertyItem prop_fill_deepen_items[] = {
 		{0, "FILL", 0, "Fill", "Add effect of brush"},
 		{BRUSH_DIR_IN, "DEEPEN", 0, "Deepen", "Subtract effect of brush"},
 		{0, NULL, 0, NULL, NULL}};
 
-	static EnumPropertyItem prop_scrape_peaks_items[]= {
+	static EnumPropertyItem prop_scrape_peaks_items[] = {
 		{0, "SCRAPE", 0, "Scrape", "Add effect of brush"},
 		{BRUSH_DIR_IN, "PEAKS", 0, "Peaks", "Subtract effect of brush"},
 		{0, NULL, 0, NULL, NULL}};
 
-	static EnumPropertyItem prop_pinch_magnify_items[]= {
+	static EnumPropertyItem prop_pinch_magnify_items[] = {
 		{0, "PINCH", 0, "Pinch", "Add effect of brush"},
 		{BRUSH_DIR_IN, "MAGNIFY", 0, "Magnify", "Subtract effect of brush"},
 		{0, NULL, 0, NULL, NULL}};
 
-	static EnumPropertyItem prop_inflate_deflate_items[]= {
+	static EnumPropertyItem prop_inflate_deflate_items[] = {
 		{0, "INFLATE", 0, "Inflate", "Add effect of brush"},
 		{BRUSH_DIR_IN, "DEFLATE", 0, "Deflate", "Subtract effect of brush"},
 		{0, NULL, 0, NULL, NULL}};
 
-	Brush *me= (Brush*)(ptr->data);
+	Brush *me = (Brush*)(ptr->data);
 
 	switch (me->sculpt_tool) {
 		case SCULPT_TOOL_DRAW:
@@ -254,23 +376,62 @@ static void rna_def_brush_texture_slot(BlenderRNA *brna)
 		{MTEX_MAP_MODE_3D, "3D", 0, "3D", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "BrushTextureSlot", "TextureSlot");
+	srna = RNA_def_struct(brna, "BrushTextureSlot", "TextureSlot");
 	RNA_def_struct_sdna(srna, "MTex");
 	RNA_def_struct_ui_text(srna, "Brush Texture Slot", "Texture slot for textures in a Brush datablock");
 
-	prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "rot");
 	RNA_def_property_range(prop, 0, M_PI*2);
 	RNA_def_property_ui_text(prop, "Angle", "Brush texture rotation");
 	RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
 
-	prop= RNA_def_property(srna, "map_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "map_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "brush_map_mode");
 	RNA_def_property_enum_items(prop, prop_map_mode_items);
 	RNA_def_property_ui_text(prop, "Mode", "");
 	RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
 }
 
+static void rna_def_sculpt_capabilities(BlenderRNA *brna)
+{
+	StructRNA *srna;
+	PropertyRNA *prop;
+
+	srna = RNA_def_struct(brna, "SculptCapabilities", NULL);
+	RNA_def_struct_sdna(srna, "Brush");
+	RNA_def_struct_nested(brna, srna, "Brush");
+	RNA_def_struct_ui_text(srna, "Sculpt Capabilities",
+						   "Read-only indications of which brush operations "
+						   "are supported by the current sculpt tool");
+
+#define BRUSH_CAPABILITY(prop_name_, ui_name_)							\
+	prop = RNA_def_property(srna, #prop_name_,							\
+							PROP_BOOLEAN, PROP_NONE);					\
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE);					\
+	RNA_def_property_boolean_funcs(prop, "rna_SculptCapabilities_"		\
+								   #prop_name_ "_get", NULL);			\
+	RNA_def_property_ui_text(prop, ui_name_, NULL)
+
+	BRUSH_CAPABILITY(has_accumulate, "Has Accumulate");
+	BRUSH_CAPABILITY(has_auto_smooth, "Has Auto Smooth");
+	BRUSH_CAPABILITY(has_height, "Has Height");
+	BRUSH_CAPABILITY(has_jitter, "Has Jitter");
+	BRUSH_CAPABILITY(has_normal_weight, "Has Crease/Pinch Factor");
+	BRUSH_CAPABILITY(has_persistence, "Has Persistence");
+	BRUSH_CAPABILITY(has_pinch_factor, "Has Pinch Factor");
+	BRUSH_CAPABILITY(has_plane_offset, "Has Plane Offset");
+	BRUSH_CAPABILITY(has_random_texture_angle, "Has Random Texture Angle");
+	BRUSH_CAPABILITY(has_sculpt_plane, "Has Sculpt Plane");
+	BRUSH_CAPABILITY(has_secondary_color, "Has Secondary Color");
+	BRUSH_CAPABILITY(has_smooth_stroke, "Has Smooth Stroke");
+	BRUSH_CAPABILITY(has_space_attenuation, "Has Space Attenuation");
+	BRUSH_CAPABILITY(has_spacing, "Has Spacing");
+	BRUSH_CAPABILITY(has_strength, "Has Strength");
+
+#undef SCULPT_CAPABILITY
+}
+
 static void rna_def_brush(BlenderRNA *brna)
 {
 	StructRNA *srna;
@@ -314,393 +475,407 @@ static void rna_def_brush(BlenderRNA *brna)
 		{SCULPT_DISP_DIR_Z, "Z", 0, "Z Plane", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "Brush", "ID");
+	srna = RNA_def_struct(brna, "Brush", "ID");
 	RNA_def_struct_ui_text(srna, "Brush", "Brush datablock for storing brush settings for painting and sculpting");
 	RNA_def_struct_ui_icon(srna, ICON_BRUSH_DATA);
 
 	/* enums */
-	prop= RNA_def_property(srna, "blend", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "blend", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, prop_blend_items);
 	RNA_def_property_ui_text(prop, "Blending mode", "Brush blending mode");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "sculpt_tool", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "sculpt_tool", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, brush_sculpt_tool_items);
 	RNA_def_property_ui_text(prop, "Sculpt Tool", "");
 	RNA_def_property_update(prop, 0, "rna_Brush_sculpt_tool_update");
 
-	prop= RNA_def_property(srna, "vertex_tool", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "vertex_tool", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "vertexpaint_tool");
 	RNA_def_property_enum_items(prop, brush_vertex_tool_items);
 	RNA_def_property_ui_text(prop, "Vertex/Weight Paint Tool", "");
 	RNA_def_property_update(prop, 0, "rna_Brush_vertex_tool_update");
 	
-	prop= RNA_def_property(srna, "image_tool", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "image_tool", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "imagepaint_tool");
 	RNA_def_property_enum_items(prop, brush_image_tool_items);
 	RNA_def_property_ui_text(prop, "Image Paint Tool", "");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_Brush_imagepaint_tool_update");
 
-	prop= RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, prop_direction_items);
 	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Brush_direction_itemf");
 	RNA_def_property_ui_text(prop, "Direction", "");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "stroke_method", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "stroke_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, brush_stroke_method_items);
 	RNA_def_property_ui_text(prop, "Stroke Method", "");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "texture_angle_source_random", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "texture_angle_source_random", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, texture_angle_source_items);
 	RNA_def_property_ui_text(prop, "Texture Angle Source", "");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "texture_angle_source_no_random", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "texture_angle_source_no_random", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, texture_angle_source_no_random_items);
 	RNA_def_property_ui_text(prop, "Texture Angle Source", "");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "sculpt_plane", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "sculpt_plane", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, brush_sculpt_plane_items);
 	RNA_def_property_ui_text(prop, "Sculpt Plane", "");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 	
 	/* number values */
-	prop= RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE);
 	RNA_def_property_int_funcs(prop, NULL, "rna_Brush_set_size", NULL);
 	RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS*10);
 	RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, 0);
 	RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 	
-	prop= RNA_def_property(srna, "unprojected_radius", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "unprojected_radius", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_funcs(prop, NULL, "rna_Brush_set_unprojected_radius", NULL);
 	RNA_def_property_range(prop, 0.001, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.001, 1, 0, 0);
 	RNA_def_property_ui_text(prop, "Unprojected Radius", "Radius of brush in Blender units");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "jitter", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "jitter", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "jitter");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Jitter", "Jitter the position of the brush while painting");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "spacing", PROP_INT, PROP_PERCENTAGE);
+	prop = RNA_def_property(srna, "spacing", PROP_INT, PROP_PERCENTAGE);
 	RNA_def_property_int_sdna(prop, NULL, "spacing");
 	RNA_def_property_range(prop, 1, 1000);
 	RNA_def_property_ui_range(prop, 1, 500, 5, 0);
 	RNA_def_property_ui_text(prop, "Spacing", "Spacing between brush daubs as a percentage of brush diameter");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "smooth_stroke_radius", PROP_INT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "smooth_stroke_radius", PROP_INT, PROP_DISTANCE);
 	RNA_def_property_range(prop, 10, 200);
 	RNA_def_property_ui_text(prop, "Smooth Stroke Radius", "Minimum distance from last point before stroke continues");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "smooth_stroke_factor", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "smooth_stroke_factor", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_range(prop, 0.5, 0.99);
 	RNA_def_property_ui_text(prop, "Smooth Stroke Factor", "Higher values give a smoother stroke");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 	
-	prop= RNA_def_property(srna, "rate", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "rate", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "rate");
 	RNA_def_property_range(prop, 0.0001f , 10000.0f);
 	RNA_def_property_ui_range(prop, 0.01f, 1.0f, 1, 3);
 	RNA_def_property_ui_text(prop, "Rate", "Interval between paints for Airbrush");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 	
-	prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_float_sdna(prop, NULL, "rgb");
 	RNA_def_property_ui_text(prop, "Color", "");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 	
-	prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "alpha");
 	RNA_def_property_float_default(prop, 0.5f);
 	RNA_def_property_range(prop, 0.0f, 10.0f);
-	RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 0.001);
+	RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
 	RNA_def_property_ui_text(prop, "Strength", "How powerful the effect of the brush is when applied");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "plane_offset", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "plane_offset", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "plane_offset");
 	RNA_def_property_float_default(prop, 0);
 	RNA_def_property_range(prop, -2.0f, 2.0f);
-	RNA_def_property_ui_range(prop, -0.5f, 0.5f, 0.001, 0.001);
-	RNA_def_property_ui_text(prop, "Plane Offset", "Adjust plane on which the brush acts towards or away from the object surface");
+	RNA_def_property_ui_range(prop, -0.5f, 0.5f, 0.001, 3);
+	RNA_def_property_ui_text(prop, "Plane Offset",
+	                         "Adjust plane on which the brush acts towards or away from the object surface");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "plane_trim", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "plane_trim", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "plane_trim");
 	RNA_def_property_float_default(prop, 0.5f);
 	RNA_def_property_range(prop, 0, 1.0f);
-	RNA_def_property_ui_text(prop, "Plane Trim", "If a vertex is further away from offset plane than this, then it is not affected");
+	RNA_def_property_ui_text(prop, "Plane Trim",
+	                         "If a vertex is further away from offset plane than this, then it is not affected");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "height");
 	RNA_def_property_float_default(prop, 0.5f);
 	RNA_def_property_range(prop, 0, 1.0f);
 	RNA_def_property_ui_text(prop, "Brush Height", "Affectable height of brush (layer height for layer tool, i.e.)");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "texture_sample_bias", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "texture_sample_bias", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "texture_sample_bias");
 	RNA_def_property_float_default(prop, 0);
 	RNA_def_property_range(prop, -1, 1);
 	RNA_def_property_ui_text(prop, "Texture Sample Bias", "Value added to texture samples");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "normal_weight", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "normal_weight", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "normal_weight");
 	RNA_def_property_float_default(prop, 0);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Normal Weight", "How much grab will pull vertexes out of surface during a grab");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "crease_pinch_factor", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "crease_pinch_factor", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "crease_pinch_factor");
 	RNA_def_property_float_default(prop, 2.0f/3.0f);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Crease Brush Pinch Factor", "How much the crease brush pinches");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "auto_smooth_factor", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "auto_smooth_factor", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "autosmooth_factor");
 	RNA_def_property_float_default(prop, 0);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
-	RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 0.001);
+	RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
 	RNA_def_property_ui_text(prop, "Autosmooth", "Amount of smoothing to automatically apply to each stroke");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
 	/* flag */
-	prop= RNA_def_property(srna, "use_airbrush", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_airbrush", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_AIRBRUSH);
 	RNA_def_property_ui_text(prop, "Airbrush", "Keep applying paint effect while holding mouse (spray)");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 	
-	prop= RNA_def_property(srna, "use_original_normal", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_original_normal", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ORIGINAL_NORMAL);
-	RNA_def_property_ui_text(prop, "Original Normal", "When locked keep using normal of surface where stroke was initiated");
+	RNA_def_property_ui_text(prop, "Original Normal",
+	                         "When locked keep using normal of surface where stroke was initiated");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 	
-	prop= RNA_def_property(srna, "use_wrap", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_wrap", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_TORUS);
 	RNA_def_property_ui_text(prop, "Wrap", "Enable torus wrapping while painting");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 	
-	prop= RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ALPHA_PRESSURE);
 	RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
 	RNA_def_property_ui_text(prop, "Strength Pressure", "Enable tablet pressure sensitivity for strength");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 	
-	prop= RNA_def_property(srna, "use_offset_pressure", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_offset_pressure", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_OFFSET_PRESSURE);
 	RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
 	RNA_def_property_ui_text(prop, "Plane Offset Pressure", "Enable tablet pressure sensitivity for offset");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "use_pressure_size", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pressure_size", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SIZE_PRESSURE);
 	RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
 	RNA_def_property_ui_text(prop, "Size Pressure", "Enable tablet pressure sensitivity for size");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 	
-	prop= RNA_def_property(srna, "use_pressure_jitter", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pressure_jitter", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_JITTER_PRESSURE);
 	RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
 	RNA_def_property_ui_text(prop, "Jitter Pressure", "Enable tablet pressure sensitivity for jitter");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "use_pressure_spacing", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pressure_spacing", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SPACING_PRESSURE);
 	RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
 	RNA_def_property_ui_text(prop, "Spacing Pressure", "Enable tablet pressure sensitivity for spacing");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "use_inverse_smooth_pressure", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_inverse_smooth_pressure", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_INVERSE_SMOOTH_PRESSURE);
 	RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
 	RNA_def_property_ui_text(prop, "Inverse Smooth Pressure", "Lighter pressure causes more smoothing to be applied");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 	
-	prop= RNA_def_property(srna, "use_rake", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_rake", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_RAKE);
 	RNA_def_property_ui_text(prop, "Rake", "Rotate the brush texture to match the stroke direction");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "use_random_rotation", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_random_rotation", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_RANDOM_ROTATION);
 	RNA_def_property_ui_text(prop, "Random Rotation", "Rotate the brush texture at random");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "use_plane_trim", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_plane_trim", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_PLANE_TRIM);
 	RNA_def_property_ui_text(prop, "Use Plane Trim", "Enable Plane Trim");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "use_frontface", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_frontface", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_FRONTFACE);
 	RNA_def_property_ui_text(prop, "Use Front-Face", "Brush only affects vertexes that face the viewer");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "use_anchor", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_anchor", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ANCHORED);
 	RNA_def_property_ui_text(prop, "Anchored", "Keep the brush anchored to the initial location");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "use_space", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_space", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SPACE);
 	RNA_def_property_ui_text(prop, "Space", "Limit brush application to the distance specified by spacing");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "use_smooth_stroke", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_smooth_stroke", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SMOOTH_STROKE);
 	RNA_def_property_ui_text(prop, "Smooth Stroke", "Brush lags behind mouse and follows a smoother path");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "use_persistent", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_persistent", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_PERSISTENT);
 	RNA_def_property_ui_text(prop, "Persistent", "Sculpt on a persistent layer of the mesh");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "use_accumulate", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_accumulate", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ACCUMULATE);
 	RNA_def_property_ui_text(prop, "Accumulate", "Accumulate stroke daubs on top of each other");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 	
-	prop= RNA_def_property(srna, "use_space_atten", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_space_attenuation", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SPACE_ATTEN);
-	RNA_def_property_ui_text(prop, "Use Automatic Strength Adjustment", "Automatically adjust strength to give consistent results for different spacings");
+	RNA_def_property_ui_text(prop, "Use Automatic Strength Adjustment",
+	                         "Automatically adjust strength to give consistent results for different spacings");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
 	/* adaptive space is not implemented yet */
-	prop= RNA_def_property(srna, "use_adaptive_space", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_adaptive_space", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ADAPTIVE_SPACE);
-	RNA_def_property_ui_text(prop, "Adaptive Spacing", "Space daubs according to surface orientation instead of screen space");
+	RNA_def_property_ui_text(prop, "Adaptive Spacing",
+	                         "Space daubs according to surface orientation instead of screen space");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "use_locked_size", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_locked_size", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_LOCK_SIZE);
-	RNA_def_property_ui_text(prop, "Use Blender Units", "When locked brush stays same size relative to object; when unlocked brush size is given in pixels");
+	RNA_def_property_ui_text(prop, "Use Blender Units",
+	                         "When locked brush stays same size relative to object; when unlocked brush size is "
+	                         "given in pixels");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "use_texture_overlay", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_texture_overlay", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_TEXTURE_OVERLAY);
 	RNA_def_property_ui_text(prop, "Use Texture Overlay", "Show texture in viewport");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "use_edge_to_edge", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_edge_to_edge", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_EDGE_TO_EDGE);
 	RNA_def_property_ui_text(prop, "Edge-to-edge", "Drag anchor brush from edge-to-edge");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "use_restore_mesh", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_restore_mesh", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_RESTORE_MESH);
 	RNA_def_property_ui_text(prop, "Restore Mesh", "Allow a single dot to be carefully positioned");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "use_fixed_texture", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_fixed_texture", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_FIXED_TEX);
 	RNA_def_property_ui_text(prop, "Fixed Texture", "Keep texture origin in fixed position");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 	
 	/* only for projection paint, TODO, other paint modes */
-	prop= RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BRUSH_LOCK_ALPHA);
 	RNA_def_property_ui_text(prop, "Alpha", "When this is disabled, lock alpha while painting");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_ui_text(prop, "Curve", "Editable falloff curve");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
 	/* paint mode flags */
-	prop= RNA_def_property(srna, "use_paint_sculpt", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_paint_sculpt", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_SCULPT);
 	RNA_def_property_ui_text(prop, "Use Sculpt", "Use this brush in sculpt mode");
 
-	prop= RNA_def_property(srna, "use_paint_vertex", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_paint_vertex", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_VERTEX_PAINT);
 	RNA_def_property_ui_text(prop, "Use Vertex", "Use this brush in vertex paint mode");
 
-	prop= RNA_def_property(srna, "use_paint_weight", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_paint_weight", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_WEIGHT_PAINT);
-	RNA_def_property_ui_text(prop, "Use Weight", "Use this brush in weight paint mode");	
+	RNA_def_property_ui_text(prop, "Use Weight", "Use this brush in weight paint mode");
 
-	prop= RNA_def_property(srna, "use_paint_image", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_paint_image", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_TEXTURE_PAINT);
-	RNA_def_property_ui_text(prop, "Use Texture", "Use this brush in texture paint mode");	
+	RNA_def_property_ui_text(prop, "Use Texture", "Use this brush in texture paint mode");
 
 	/* texture */
-	prop= RNA_def_property(srna, "texture_slot", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "texture_slot", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "BrushTextureSlot");
 	RNA_def_property_pointer_sdna(prop, NULL, "mtex");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Texture Slot", "");
 	
-	prop= RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "mtex.tex");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Texture", "");
 	RNA_def_property_update(prop, NC_TEXTURE, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "texture_overlay_alpha", PROP_INT, PROP_PERCENTAGE);
+	prop = RNA_def_property(srna, "texture_overlay_alpha", PROP_INT, PROP_PERCENTAGE);
 	RNA_def_property_int_sdna(prop, NULL, "texture_overlay_alpha");
 	RNA_def_property_range(prop, 1, 100);
 	RNA_def_property_ui_text(prop, "Texture Overlay Alpha", "");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "cursor_color_add", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "cursor_color_add", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "add_col");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Add Color", "Color of cursor when adding");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "cursor_color_subtract", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "cursor_color_subtract", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "sub_col");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Subtract Color", "Color of cursor when subtracting");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "use_custom_icon", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_custom_icon", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_CUSTOM_ICON);
 	RNA_def_property_ui_text(prop, "Custom Icon", "Set the brush icon from an image file");
 	RNA_def_property_update(prop, 0, "rna_Brush_icon_update");
 
-	prop= RNA_def_property(srna, "icon_filepath", PROP_STRING, PROP_FILEPATH);
+	prop = RNA_def_property(srna, "icon_filepath", PROP_STRING, PROP_FILEPATH);
 	RNA_def_property_string_sdna(prop, NULL, "icon_filepath");
 	RNA_def_property_ui_text(prop, "Brush Icon Filepath", "File path to brush icon");
 	RNA_def_property_update(prop, 0, "rna_Brush_icon_update");
 
 	/* clone tool */
-	prop= RNA_def_property(srna, "clone_image", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "clone_image", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "clone.image");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Clone Image", "Image for clone tool");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_Brush_update");
 	
-	prop= RNA_def_property(srna, "clone_alpha", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "clone_alpha", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "clone.alpha");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Clone Alpha", "Opacity of clone image display");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_Brush_update");
 
-	prop= RNA_def_property(srna, "clone_offset", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "clone_offset", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "clone.offset");
 	RNA_def_property_ui_text(prop, "Clone Offset", "");
 	RNA_def_property_ui_range(prop, -1.0f , 1.0f, 10.0f, 3);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_Brush_update");
+
+	/* brush capabilities (mode-dependent) */
+	prop = RNA_def_property(srna, "sculpt_capabilities", PROP_POINTER, PROP_NONE);
+	RNA_def_property_flag(prop, PROP_NEVER_NULL);
+	RNA_def_property_struct_type(prop, "SculptCapabilities");
+	RNA_def_property_pointer_funcs(prop, "rna_Brush_sculpt_capabilities_get", NULL, NULL, NULL);
+	RNA_def_property_ui_text(prop, "Sculpt Capabilities", "Brush's capabilities in sculpt mode");
 }
 
 
@@ -719,47 +894,49 @@ static void rna_def_operator_stroke_element(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "OperatorStrokeElement", "PropertyGroup");
+	srna = RNA_def_struct(brna, "OperatorStrokeElement", "PropertyGroup");
 	RNA_def_struct_ui_text(srna, "Operator Stroke Element", "");
 
-	prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_flag(prop, PROP_IDPROPERTY);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Location", "");
 
-	prop= RNA_def_property(srna, "mouse", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "mouse", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_flag(prop, PROP_IDPROPERTY);
 	RNA_def_property_array(prop, 2);
 	RNA_def_property_ui_text(prop, "Mouse", "");
 
-	prop= RNA_def_property(srna, "pressure", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "pressure", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_IDPROPERTY);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Pressure", "Tablet pressure");
 
-	prop= RNA_def_property(srna, "pen_flip", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "pen_flip", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_IDPROPERTY);
 	RNA_def_property_ui_text(prop, "Flip", "");
 
-	// used in uv painting
-	prop= RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
+	/* used in uv painting */
+	prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
 	RNA_def_property_flag(prop, PROP_IDPROPERTY);
 	RNA_def_property_ui_text(prop, "Time", "");
 	
 	/* used for Grease Pencil sketching sessions */
-	prop= RNA_def_property(srna, "is_start", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_start", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_IDPROPERTY);
 	RNA_def_property_ui_text(prop, "Is Stroke Start", "");
 
 	/* XXX: Tool (this will be for pressing a modifier key for a different brush,
-			e.g. switching to a Smooth brush in the middle of the stroke */
+	 *      e.g. switching to a Smooth brush in the middle of the stroke */
 
-	// XXX: i don't think blender currently supports the ability to properly do a remappable modifier in the middle of a stroke
+	/* XXX: i don't think blender currently supports the ability to properly do a remappable modifier
+	 *      in the middle of a stroke */
 }
 
 void RNA_def_brush(BlenderRNA *brna)
 {
 	rna_def_brush(brna);
+	rna_def_sculpt_capabilities(brna);
 	rna_def_brush_texture_slot(brna);
 	rna_def_operator_stroke_element(brna);
 }
diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c
index 6f6a4ba..180479d 100644
--- a/source/blender/makesrna/intern/rna_camera.c
+++ b/source/blender/makesrna/intern/rna_camera.c
@@ -45,45 +45,45 @@
 
 static float rna_Camera_angle_get(PointerRNA *ptr)
 {
-	Camera *cam= ptr->id.data;
-	float sensor= camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y);
+	Camera *cam = ptr->id.data;
+	float sensor = camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y);
 	return focallength_to_fov(cam->lens, sensor);
 }
 
 static void rna_Camera_angle_set(PointerRNA *ptr, float value)
 {
-	Camera *cam= ptr->id.data;
-	float sensor= camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y);
-	cam->lens= fov_to_focallength(value, sensor);
+	Camera *cam = ptr->id.data;
+	float sensor = camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y);
+	cam->lens = fov_to_focallength(value, sensor);
 }
 
 static float rna_Camera_angle_x_get(PointerRNA *ptr)
 {
-	Camera *cam= ptr->id.data;
+	Camera *cam = ptr->id.data;
 	return focallength_to_fov(cam->lens, cam->sensor_x);
 }
 
 static void rna_Camera_angle_x_set(PointerRNA *ptr, float value)
 {
-	Camera *cam= ptr->id.data;
-	cam->lens= fov_to_focallength(value, cam->sensor_x);
+	Camera *cam = ptr->id.data;
+	cam->lens = fov_to_focallength(value, cam->sensor_x);
 }
 
 static float rna_Camera_angle_y_get(PointerRNA *ptr)
 {
-	Camera *cam= ptr->id.data;
+	Camera *cam = ptr->id.data;
 	return focallength_to_fov(cam->lens, cam->sensor_y);
 }
 
 static void rna_Camera_angle_y_set(PointerRNA *ptr, float value)
 {
-	Camera *cam= ptr->id.data;
-	cam->lens= fov_to_focallength(value, cam->sensor_y);
+	Camera *cam = ptr->id.data;
+	cam->lens = fov_to_focallength(value, cam->sensor_y);
 }
 
 static void rna_Camera_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	Camera *camera= (Camera*)ptr->id.data;
+	Camera *camera = (Camera*)ptr->id.data;
 
 	DAG_id_tag_update(&camera->id, 0);
 }
@@ -118,24 +118,24 @@ void RNA_def_camera(BlenderRNA *brna)
 		{CAMERA_SENSOR_FIT_VERT, "VERTICAL", 0, "Vertical", "Fit to the sensor height"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "Camera", "ID");
+	srna = RNA_def_struct(brna, "Camera", "ID");
 	RNA_def_struct_ui_text(srna, "Camera", "Camera datablock for storing camera settings");
 	RNA_def_struct_ui_icon(srna, ICON_CAMERA_DATA);
 
 	/* Enums */
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_ui_text(prop, "Type", "Camera types");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update");
 
-	prop= RNA_def_property(srna, "show_guide", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "show_guide", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "dtx");
 	RNA_def_property_enum_items(prop, prop_draw_type_extra_items);
 	RNA_def_property_flag(prop, PROP_ENUM_FLAG);
 	RNA_def_property_ui_text(prop, "Composition Guides",  "Draw overlay");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
-	prop= RNA_def_property(srna, "sensor_fit", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "sensor_fit", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "sensor_fit");
 	RNA_def_property_enum_items(prop, sensor_fit_items);
 	RNA_def_property_ui_text(prop, "Sensor Fit", "Method to fit image and field of view angle inside the sensor");
@@ -143,142 +143,144 @@ void RNA_def_camera(BlenderRNA *brna)
 
 	/* Number values */
 
-	prop= RNA_def_property(srna, "passepartout_alpha", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "passepartout_alpha", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "passepartalpha");
 	RNA_def_property_ui_text(prop, "Passepartout Alpha", "Opacity (alpha) of the darkened overlay in Camera view");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
-	prop= RNA_def_property(srna, "angle_x", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "angle_x", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_range(prop, M_PI * (0.367/180.0), M_PI * (172.847/180.0));
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Horizontal FOV", "Camera lens horizontal field of view in degrees");
 	RNA_def_property_float_funcs(prop, "rna_Camera_angle_x_get", "rna_Camera_angle_x_set", NULL);
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update");
 
-	prop= RNA_def_property(srna, "angle_y", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "angle_y", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_range(prop, M_PI * (0.367/180.0), M_PI * (172.847/180.0));
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Vertical FOV", "Camera lens vertical field of view in degrees");
 	RNA_def_property_float_funcs(prop, "rna_Camera_angle_y_get", "rna_Camera_angle_y_set", NULL);
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update");
 
-	prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_range(prop, M_PI * (0.367/180.0), M_PI * (172.847/180.0));
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Field of View", "Camera lens field of view in degrees");
 	RNA_def_property_float_funcs(prop, "rna_Camera_angle_get", "rna_Camera_angle_set", NULL);
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update");
 
-	prop= RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "clipsta");
 	RNA_def_property_range(prop, 0.001f, FLT_MAX);
 	RNA_def_property_ui_text(prop, "Clip Start", "Camera near clipping distance");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
-	prop= RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "clipend");
 	RNA_def_property_range(prop, 1.0f, FLT_MAX);
 	RNA_def_property_ui_text(prop, "Clip End", "Camera far clipping distance");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
-	prop= RNA_def_property(srna, "lens", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "lens", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "lens");
 	RNA_def_property_range(prop, 1.0f, 5000.0f);
 	RNA_def_property_ui_text(prop, "Focal Length", "Perspective Camera lens value in millimeters");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update");
 
-	prop= RNA_def_property(srna, "sensor_width", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "sensor_width", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "sensor_x");
 	RNA_def_property_range(prop, 1.0f, FLT_MAX);
 	RNA_def_property_ui_range(prop, 1.0f, 100.f, 1, 2);
 	RNA_def_property_ui_text(prop, "Sensor Width", "Horizontal size of the image sensor area in millimeters");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update");
 
-	prop= RNA_def_property(srna, "sensor_height", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "sensor_height", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "sensor_y");
 	RNA_def_property_range(prop, 1.0f, FLT_MAX);
 	RNA_def_property_ui_range(prop, 1.0f, 100.f, 1, 2);
 	RNA_def_property_ui_text(prop, "Sensor Height", "Vertical size of the image sensor area in millimeters");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update");
 
-	prop= RNA_def_property(srna, "ortho_scale", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "ortho_scale", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "ortho_scale");
 	RNA_def_property_range(prop, 0.01f, 4000.0f);
 	RNA_def_property_ui_text(prop, "Orthographic Scale", "Orthographic Camera scale (similar to zoom)");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update");
 
-	prop= RNA_def_property(srna, "draw_size", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "draw_size", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "drawsize");
 	RNA_def_property_range(prop, 0.01f, 1000.0f);
 	RNA_def_property_ui_range(prop, 0.01, 100, 1, 2);
 	RNA_def_property_ui_text(prop, "Draw Size", "Apparent size of the Camera object in the 3D View");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
-	prop= RNA_def_property(srna, "shift_x", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "shift_x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "shiftx");
 	RNA_def_property_range(prop, -10.0f, 10.0f);
 	RNA_def_property_ui_range(prop, -2.0, 2.0, 1, 3);
 	RNA_def_property_ui_text(prop, "Shift X", "Perspective Camera horizontal shift");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update");
 
-	prop= RNA_def_property(srna, "shift_y", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "shift_y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "shifty");
 	RNA_def_property_range(prop, -10.0f, 10.0f);
 	RNA_def_property_ui_range(prop, -2.0, 2.0, 1, 3);
 	RNA_def_property_ui_text(prop, "Shift Y", "Perspective Camera vertical shift");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_update");
 
-	prop= RNA_def_property(srna, "dof_distance", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "dof_distance", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "YF_dofdist");
 	RNA_def_property_range(prop, 0.0f, 5000.0f);
 	RNA_def_property_ui_text(prop, "DOF Distance", "Distance to the focus point for depth of field");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
 	/* flag */
-	prop= RNA_def_property(srna, "show_limits", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_limits", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWLIMITS);
 	RNA_def_property_ui_text(prop, "Show Limits", "Draw the clipping range and focus point on the camera");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
-	prop= RNA_def_property(srna, "show_mist", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_mist", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWMIST);
 	RNA_def_property_ui_text(prop, "Show Mist", "Draw a line from the Camera to indicate the mist area");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
-	prop= RNA_def_property(srna, "show_passepartout", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_passepartout", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWPASSEPARTOUT);
-	RNA_def_property_ui_text(prop, "Show Passepartout", "Show a darkened overlay outside the image area in Camera view");
+	RNA_def_property_ui_text(prop, "Show Passepartout",
+	                         "Show a darkened overlay outside the image area in Camera view");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
-	prop= RNA_def_property(srna, "show_title_safe", PROP_BOOLEAN, PROP_NONE);
+	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_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
-	prop= RNA_def_property(srna, "show_name", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_name", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWNAME);
 	RNA_def_property_ui_text(prop, "Show Name", "Show the active Camera's name in Camera view");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
-	prop= RNA_def_property(srna, "show_sensor", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_sensor", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWSENSOR);
 	RNA_def_property_ui_text(prop, "Show Sensor Size", "Show sensor size (film gate) in Camera view");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
-	prop= RNA_def_property(srna, "lens_unit", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "lens_unit", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, prop_lens_unit_items);
 	RNA_def_property_ui_text(prop, "Lens Unit", "Unit to edit lens in for the user interface");
 
-	prop= RNA_def_property(srna, "use_panorama", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_panorama", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_PANORAMA);
-	RNA_def_property_ui_text(prop, "Panorama", "Render the scene with a cylindrical camera for pseudo-fisheye lens effects");
+	RNA_def_property_ui_text(prop, "Panorama",
+	                         "Render the scene with a cylindrical camera for pseudo-fisheye lens effects");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
 	/* pointers */
 	rna_def_animdata_common(srna);
 
-	prop= RNA_def_property(srna, "dof_object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "dof_object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_pointer_sdna(prop, NULL, "dof_ob");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
@@ -290,4 +292,3 @@ void RNA_def_camera(BlenderRNA *brna)
 }
 
 #endif
-
diff --git a/source/blender/makesrna/intern/rna_camera_api.c b/source/blender/makesrna/intern/rna_camera_api.c
index 2af0524..14391e7 100644
--- a/source/blender/makesrna/intern/rna_camera_api.c
+++ b/source/blender/makesrna/intern/rna_camera_api.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
@@ -61,25 +61,25 @@ void RNA_api_camera(StructRNA *srna)
 	FunctionRNA *func;
 	PropertyRNA *parm;
 
-	func= RNA_def_function(srna, "view_frame", "rna_camera_view_frame");
+	func = RNA_def_function(srna, "view_frame", "rna_camera_view_frame");
 	RNA_def_function_ui_description(func, "Return 4 points for the cameras frame (before object transformation)");
 
 	RNA_def_pointer(func, "scene", "Scene", "", "Scene to use for aspect calculation, when omitted 1:1 aspect is used");
 
 	/* return location and normal */
-	parm= RNA_def_float_vector(func, "result_1", 3, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
+	parm = RNA_def_float_vector(func, "result_1", 3, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
 	RNA_def_property_flag(parm, PROP_THICK_WRAP);
 	RNA_def_function_output(func, parm);
 
-	parm= RNA_def_float_vector(func, "result_2", 3, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
+	parm = RNA_def_float_vector(func, "result_2", 3, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
 	RNA_def_property_flag(parm, PROP_THICK_WRAP);
 	RNA_def_function_output(func, parm);
 
-	parm= RNA_def_float_vector(func, "result_3", 3, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
+	parm = RNA_def_float_vector(func, "result_3", 3, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
 	RNA_def_property_flag(parm, PROP_THICK_WRAP);
 	RNA_def_function_output(func, parm);
 
-	parm= RNA_def_float_vector(func, "result_4", 3, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
+	parm = RNA_def_float_vector(func, "result_4", 3, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
 	RNA_def_property_flag(parm, PROP_THICK_WRAP);
 	RNA_def_function_output(func, parm);
 }
diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c
index 1327a20..2f6a31f 100644
--- a/source/blender/makesrna/intern/rna_cloth.c
+++ b/source/blender/makesrna/intern/rna_cloth.c
@@ -49,7 +49,7 @@
 
 static void rna_cloth_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 	WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob);
@@ -57,8 +57,8 @@ static void rna_cloth_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerR
 
 static void rna_cloth_pinning_changed(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
-//	ClothSimSettings *settings = (ClothSimSettings*)ptr->data;
+	Object *ob = (Object*)ptr->id.data;
+/*	ClothSimSettings *settings = (ClothSimSettings*)ptr->data; */
 	ClothModifierData *clmd = (ClothModifierData*)modifiers_findByType(ob, eModifierType_Cloth);
 
 	cloth_free_modifier(clmd);
@@ -69,7 +69,7 @@ static void rna_cloth_pinning_changed(Main *UNUSED(bmain), Scene *UNUSED(scene),
 
 static void rna_cloth_reset(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 	ClothSimSettings *settings = (ClothSimSettings*)ptr->data;
 
 	settings->reset = 1;
@@ -84,7 +84,7 @@ static void rna_ClothSettings_max_bend_set(struct PointerRNA *ptr, float value)
 	ClothSimSettings *settings = (ClothSimSettings*)ptr->data;
 	
 	/* check for clipping */
-	if(value < settings->bending)
+	if (value < settings->bending)
 		value = settings->bending;
 	
 	settings->max_bend = value;
@@ -95,7 +95,7 @@ static void rna_ClothSettings_max_struct_set(struct PointerRNA *ptr, float value
 	ClothSimSettings *settings = (ClothSimSettings*)ptr->data;
 	
 	/* check for clipping */
-	if(value < settings->structural)
+	if (value < settings->structural)
 		value = settings->structural;
 	
 	settings->max_struct = value;
@@ -103,104 +103,104 @@ static void rna_ClothSettings_max_struct_set(struct PointerRNA *ptr, float value
 
 static void rna_ClothSettings_mass_vgroup_get(PointerRNA *ptr, char *value)
 {
-	ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
+	ClothSimSettings *sim = (ClothSimSettings*)ptr->data;
 	rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_mass);
 }
 
 static int rna_ClothSettings_mass_vgroup_length(PointerRNA *ptr)
 {
-	ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
+	ClothSimSettings *sim = (ClothSimSettings*)ptr->data;
 	return rna_object_vgroup_name_index_length(ptr, sim->vgroup_mass);
 }
 
 static void rna_ClothSettings_mass_vgroup_set(PointerRNA *ptr, const char *value)
 {
-	ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
+	ClothSimSettings *sim = (ClothSimSettings*)ptr->data;
 	rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_mass);
 }
 
 static void rna_ClothSettings_struct_vgroup_get(PointerRNA *ptr, char *value)
 {
-	ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
+	ClothSimSettings *sim = (ClothSimSettings*)ptr->data;
 	rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_struct);
 }
 
 static int rna_ClothSettings_struct_vgroup_length(PointerRNA *ptr)
 {
-	ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
+	ClothSimSettings *sim = (ClothSimSettings*)ptr->data;
 	return rna_object_vgroup_name_index_length(ptr, sim->vgroup_struct);
 }
 
 static void rna_ClothSettings_struct_vgroup_set(PointerRNA *ptr, const char *value)
 {
-	ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
+	ClothSimSettings *sim = (ClothSimSettings*)ptr->data;
 	rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_struct);
 }
 
 static void rna_ClothSettings_bend_vgroup_get(PointerRNA *ptr, char *value)
 {
-	ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
+	ClothSimSettings *sim = (ClothSimSettings*)ptr->data;
 	rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_bend);
 }
 
 static int rna_ClothSettings_bend_vgroup_length(PointerRNA *ptr)
 {
-	ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
+	ClothSimSettings *sim = (ClothSimSettings*)ptr->data;
 	return rna_object_vgroup_name_index_length(ptr, sim->vgroup_bend);
 }
 
 static void rna_ClothSettings_bend_vgroup_set(PointerRNA *ptr, const char *value)
 {
-	ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
+	ClothSimSettings *sim = (ClothSimSettings*)ptr->data;
 	rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_bend);
 }
 
 static PointerRNA rna_ClothSettings_rest_shape_key_get(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
-	ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
+	Object *ob = (Object*)ptr->id.data;
+	ClothSimSettings *sim = (ClothSimSettings*)ptr->data;
 
 	return rna_object_shapekey_index_get(ob->data, sim->shapekey_rest);
 }
 
 static void rna_ClothSettings_rest_shape_key_set(PointerRNA *ptr, PointerRNA value)
 {
-	Object *ob= (Object*)ptr->id.data;
-	ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
+	Object *ob = (Object*)ptr->id.data;
+	ClothSimSettings *sim = (ClothSimSettings*)ptr->data;
 
-	sim->shapekey_rest= rna_object_shapekey_index_set(ob->data, value, sim->shapekey_rest);
+	sim->shapekey_rest = rna_object_shapekey_index_set(ob->data, value, sim->shapekey_rest);
 }
 
 static void rna_ClothSettings_gravity_get(PointerRNA *ptr, float *values)
 {
-	ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
+	ClothSimSettings *sim = (ClothSimSettings*)ptr->data;
 
-	values[0]= sim->gravity[0];
-	values[1]= sim->gravity[1];
-	values[2]= sim->gravity[2];
+	values[0] = sim->gravity[0];
+	values[1] = sim->gravity[1];
+	values[2] = sim->gravity[2];
 }
 
 static void rna_ClothSettings_gravity_set(PointerRNA *ptr, const float *values)
 {
-	ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
+	ClothSimSettings *sim = (ClothSimSettings*)ptr->data;
 
-	sim->gravity[0]= values[0];
-	sim->gravity[1]= values[1];
-	sim->gravity[2]= values[2];
+	sim->gravity[0] = values[0];
+	sim->gravity[1] = values[1];
+	sim->gravity[2] = values[2];
 }
 
 static char *rna_ClothSettings_path(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
-	ModifierData *md= modifiers_findByType(ob, eModifierType_Cloth);
+	Object *ob = (Object*)ptr->id.data;
+	ModifierData *md = modifiers_findByType(ob, eModifierType_Cloth);
 
 	return md ? BLI_sprintfN("modifiers[\"%s\"].settings", md->name) : NULL;
 }
 
 static char *rna_ClothCollisionSettings_path(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
-	ModifierData *md= modifiers_findByType(ob, eModifierType_Cloth);
+	Object *ob = (Object*)ptr->id.data;
+	ModifierData *md = modifiers_findByType(ob, eModifierType_Cloth);
 
 	return md ? BLI_sprintfN("modifiers[\"%s\"].collision_settings", md->name) : NULL;
 }
@@ -219,43 +219,46 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
 	
 	/* goal */
 	
-	prop= RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "mingoal");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
-	RNA_def_property_ui_text(prop, "Goal Minimum", "Goal minimum, vertex group weights are scaled to match this range");
+	RNA_def_property_ui_text(prop, "Goal Minimum",
+	                         "Goal minimum, vertex group weights are scaled to match this range");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 
-	prop= RNA_def_property(srna, "goal_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "goal_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "maxgoal");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
-	RNA_def_property_ui_text(prop, "Goal Maximum", "Goal maximum, vertex group weights are scaled to match this range");
+	RNA_def_property_ui_text(prop, "Goal Maximum",
+	                         "Goal maximum, vertex group weights are scaled to match this range");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 
-	prop= RNA_def_property(srna, "goal_default", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "goal_default", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "defgoal");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
-	RNA_def_property_ui_text(prop, "Goal Default", "Default Goal (vertex target position) value, when no Vertex Group used");
+	RNA_def_property_ui_text(prop, "Goal Default",
+	                         "Default Goal (vertex target position) value, when no Vertex Group used");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 	
-	prop= RNA_def_property(srna, "goal_spring", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "goal_spring", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "goalspring");
 	RNA_def_property_range(prop, 0.0f, 0.999f);
 	RNA_def_property_ui_text(prop, "Goal Stiffness", "Goal (vertex target position) spring stiffness");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 	
-	prop= RNA_def_property(srna, "goal_friction", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "goal_friction", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "goalfrict");
 	RNA_def_property_range(prop, 0.0f, 50.0f);
 	RNA_def_property_ui_text(prop, "Goal Damping", "Goal (vertex target position) friction");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 
-	prop= RNA_def_property(srna, "internal_friction", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "internal_friction", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "velocity_smooth");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Internal Friction", "");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 
-	prop= RNA_def_property(srna, "collider_friction", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "collider_friction", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "collider_friction");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Collider Friction", "");
@@ -263,18 +266,18 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
 
 	/* mass */
 
-	prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Mass", "Mass of cloth material");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 
-	prop= RNA_def_property(srna, "vertex_group_mass", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "vertex_group_mass", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_funcs(prop, "rna_ClothSettings_mass_vgroup_get", "rna_ClothSettings_mass_vgroup_length",
 	                              "rna_ClothSettings_mass_vgroup_set");
 	RNA_def_property_ui_text(prop, "Mass Vertex Group", "Vertex Group for pinning of vertices");
 	RNA_def_property_update(prop, 0, "rna_cloth_pinning_changed");
 	
-	prop= RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
+	prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_range(prop, -100.0, 100.0);
 	RNA_def_property_float_funcs(prop, "rna_ClothSettings_gravity_get", "rna_ClothSettings_gravity_set", NULL);
@@ -283,13 +286,13 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
 
 	/* various */
 
-	prop= RNA_def_property(srna, "air_damping", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "air_damping", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "Cvi");
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Air Damping", "Air has normally some thickness which slows falling things down");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 
-	prop= RNA_def_property(srna, "vel_damping", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "vel_damping", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "vel_damping");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Velocity Damping",
@@ -297,19 +300,19 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
 	                         "(1.0 = no damping, 0.0 = fully dampened)");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 
-	prop= RNA_def_property(srna, "use_pin_cloth", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pin_cloth", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_GOAL);
 	RNA_def_property_ui_text(prop, "Pin Cloth", "Enable pinning of cloth vertices to other objects/positions");
 	RNA_def_property_update(prop, 0, "rna_cloth_pinning_changed");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 
-	prop= RNA_def_property(srna, "pin_stiffness", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "pin_stiffness", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "goalspring");
 	RNA_def_property_range(prop, 0.0f, 50.0);
 	RNA_def_property_ui_text(prop, "Pin Stiffness", "Pin (vertex target position) spring stiffness");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 
-	prop= RNA_def_property(srna, "quality", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "quality", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "stepsPerFrame");
 	RNA_def_property_range(prop, 4, 80);
 	RNA_def_property_ui_text(prop, "Quality",
@@ -318,70 +321,74 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
 
 	/* springs */
 
-	prop= RNA_def_property(srna, "use_stiffness_scale", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_stiffness_scale", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_SCALING);
 	RNA_def_property_ui_text(prop, "Stiffness Scaling",
 	                         "If enabled, stiffness can be scaled along a weight painted vertex group");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	
-	prop= RNA_def_property(srna, "spring_damping", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "spring_damping", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "Cdis");
 	RNA_def_property_range(prop, 0.0f, 50.0f);
-	RNA_def_property_ui_text(prop, "Spring Damping", "Damping of cloth velocity (higher = more smooth, less jiggling)");
+	RNA_def_property_ui_text(prop, "Spring Damping",
+	                         "Damping of cloth velocity (higher = more smooth, less jiggling)");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 	
-	prop= RNA_def_property(srna, "structural_stiffness", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "structural_stiffness", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "structural");
 	RNA_def_property_range(prop, 0.0f, 10000.0f);
 	RNA_def_property_ui_text(prop, "Structural Stiffness", "Overall stiffness of structure");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 
-	prop= RNA_def_property(srna, "structural_stiffness_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "structural_stiffness_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "max_struct");
 	RNA_def_property_range(prop, 0.0f, 10000.0f);
 	RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_max_struct_set", NULL);
 	RNA_def_property_ui_text(prop, "Structural Stiffness Maximum", "Maximum structural stiffness value");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 
-	prop= RNA_def_property(srna, "vertex_group_structural_stiffness", PROP_STRING, PROP_NONE);
-	RNA_def_property_string_funcs(prop, "rna_ClothSettings_struct_vgroup_get", "rna_ClothSettings_struct_vgroup_length",
+	prop = RNA_def_property(srna, "vertex_group_structural_stiffness", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_funcs(prop, "rna_ClothSettings_struct_vgroup_get",
+	                              "rna_ClothSettings_struct_vgroup_length",
 	                              "rna_ClothSettings_struct_vgroup_set");
 	RNA_def_property_ui_text(prop, "Structural Stiffness Vertex Group",
 	                         "Vertex group for fine control over structural stiffness");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 
-	prop= RNA_def_property(srna, "bending_stiffness", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "bending_stiffness", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "bending");
 	RNA_def_property_range(prop, 0.0f, 10000.0f);
-	RNA_def_property_ui_text(prop, "Bending Stiffness", "Wrinkle coefficient (higher = less smaller but more big wrinkles)");
+	RNA_def_property_ui_text(prop, "Bending Stiffness",
+	                         "Wrinkle coefficient (higher = less smaller but more big wrinkles)");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 
-	prop= RNA_def_property(srna, "bending_stiffness_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "bending_stiffness_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "max_bend");
 	RNA_def_property_range(prop, 0.0f, 10000.0f);
 	RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_max_bend_set", NULL);
 	RNA_def_property_ui_text(prop, "Bending Stiffness Maximum", "Maximum bending stiffness value");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 
-	prop= RNA_def_property(srna, "vertex_group_bending", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "vertex_group_bending", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_funcs(prop, "rna_ClothSettings_bend_vgroup_get", "rna_ClothSettings_bend_vgroup_length",
 	                              "rna_ClothSettings_bend_vgroup_set");
-	RNA_def_property_ui_text(prop, "Bending Stiffness Vertex Group", "Vertex group for fine control over bending stiffness");
+	RNA_def_property_ui_text(prop, "Bending Stiffness Vertex Group",
+	                         "Vertex group for fine control over bending stiffness");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 
-	prop= RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "EffectorWeights");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Effector Weights", "");
 
-	prop= RNA_def_property(srna, "pre_roll", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "pre_roll", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "preroll");
 	RNA_def_property_range(prop, 0, 200);
 	RNA_def_property_ui_text(prop, "Pre Roll", "Simulation starts on this frame");
 	RNA_def_property_update(prop, 0, "rna_cloth_reset");
 
-	prop= RNA_def_property(srna, "rest_shape_key", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "rest_shape_key", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "ShapeKey");
 	RNA_def_property_pointer_funcs(prop, "rna_ClothSettings_rest_shape_key_get",
@@ -440,19 +447,19 @@ static void rna_def_cloth_collision_settings(BlenderRNA *brna)
 
 	/* general collision */
 
-	prop= RNA_def_property(srna, "use_collision", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_collision", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_COLLSETTINGS_FLAG_ENABLED);
 	RNA_def_property_ui_text(prop, "Enable Collision", "Enable collisions with other objects");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 
-	prop= RNA_def_property(srna, "repel_force", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "repel_force", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "repel_force");
 	RNA_def_property_range(prop, 0.0f, 20.0f);
 	RNA_def_property_float_default(prop, 1.0f);
 	RNA_def_property_ui_text(prop, "Repulsion Force", "Repulsion force to apply on cloth when close to colliding");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 
-	prop= RNA_def_property(srna, "distance_repel", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "distance_repel", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "distance_repel");
 	RNA_def_property_range(prop, 0.001f, 10.0f);
 	RNA_def_property_float_default(prop, 0.005f);
@@ -460,19 +467,19 @@ static void rna_def_cloth_collision_settings(BlenderRNA *brna)
 	                         "Maximum distance to apply repulsion force, must be greater than minimum distance");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 	
-	prop= RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "epsilon");
 	RNA_def_property_range(prop, 0.001f, 1.0f);
 	RNA_def_property_ui_text(prop, "Minimum Distance",
 	                         "Minimum distance between collision objects before collision response takes in");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 
-	prop= RNA_def_property(srna, "friction", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "friction", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 80.0f);
 	RNA_def_property_ui_text(prop, "Friction", "Friction force if a collision happened (higher = less movement)");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 
-	prop= RNA_def_property(srna, "collision_quality", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "collision_quality", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "loop_count");
 	RNA_def_property_range(prop, 1, 20);
 	RNA_def_property_ui_text(prop, "Collision Quality",
@@ -481,30 +488,31 @@ static void rna_def_cloth_collision_settings(BlenderRNA *brna)
 
 	/* self collision */
 
-	prop= RNA_def_property(srna, "use_self_collision", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_self_collision", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_COLLSETTINGS_FLAG_SELF);
 	RNA_def_property_ui_text(prop, "Enable Self Collision", "Enable self collisions");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 	
-	prop= RNA_def_property(srna, "self_distance_min", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "self_distance_min", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "selfepsilon");
 	RNA_def_property_range(prop, 0.5f, 1.0f);
 	RNA_def_property_ui_text(prop, "Self Minimum Distance", "0.5 means no distance at all, 1.0 is maximum distance");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 	
-	prop= RNA_def_property(srna, "self_friction", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "self_friction", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 80.0f);
 	RNA_def_property_ui_text(prop, "Self Friction", "Friction/damping with self contact");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 
-	prop= RNA_def_property(srna, "self_collision_quality", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "self_collision_quality", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "self_loop_count");
 	RNA_def_property_range(prop, 1, 10);
 	RNA_def_property_ui_text(prop, "Self Collision Quality",
-	                         "How many self collision iterations should be done (higher is better quality but slower)");
+	                         "How many self collision iterations should be done "
+	                         "(higher is better quality but slower)");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
 
-	prop= RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Collision Group", "Limit colliders to this Group");
 	RNA_def_property_update(prop, 0, "rna_cloth_update");
@@ -517,4 +525,3 @@ void RNA_def_cloth(BlenderRNA *brna)
 }
 
 #endif
-
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c
index 60144e0..ed2283d 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -55,11 +55,11 @@
 
 static int rna_CurveMapping_curves_length(PointerRNA *ptr)
 {
-	CurveMapping *cumap= (CurveMapping*)ptr->data;
+	CurveMapping *cumap = (CurveMapping*)ptr->data;
 	int len;
 
-	for(len=0; len<CM_TOT; len++)
-		if(!cumap->cm[len].curve)
+	for (len = 0; len<CM_TOT; len++)
+		if (!cumap->cm[len].curve)
 			break;
 	
 	return len;
@@ -67,16 +67,16 @@ static int rna_CurveMapping_curves_length(PointerRNA *ptr)
 
 static void rna_CurveMapping_curves_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	CurveMapping *cumap= (CurveMapping*)ptr->data;
+	CurveMapping *cumap = (CurveMapping*)ptr->data;
 
 	rna_iterator_array_begin(iter, cumap->cm, sizeof(CurveMap), rna_CurveMapping_curves_length(ptr), 0, NULL);
 }
 
 static void rna_CurveMapping_clip_set(PointerRNA *ptr, int value)
 {
-	CurveMapping *cumap= (CurveMapping*)ptr->data;
+	CurveMapping *cumap = (CurveMapping*)ptr->data;
 
-	if(value) cumap->flag |= CUMA_DO_CLIP;
+	if (value) cumap->flag |= CUMA_DO_CLIP;
 	else cumap->flag &= ~CUMA_DO_CLIP;
 
 	curvemapping_changed(cumap, 0);
@@ -84,52 +84,52 @@ static void rna_CurveMapping_clip_set(PointerRNA *ptr, int value)
 
 static void rna_CurveMapping_black_level_set(PointerRNA *ptr, const float *values)
 {
-	CurveMapping *cumap= (CurveMapping*)ptr->data;
-	cumap->black[0]= values[0];
-	cumap->black[1]= values[1];
-	cumap->black[2]= values[2];
+	CurveMapping *cumap = (CurveMapping*)ptr->data;
+	cumap->black[0] = values[0];
+	cumap->black[1] = values[1];
+	cumap->black[2] = values[2];
 	curvemapping_set_black_white(cumap, NULL, NULL);
 }
 
 static void rna_CurveMapping_white_level_set(PointerRNA *ptr, const float *values)
 {
-	CurveMapping *cumap= (CurveMapping*)ptr->data;
-	cumap->white[0]= values[0];
-	cumap->white[1]= values[1];
-	cumap->white[2]= values[2];
+	CurveMapping *cumap = (CurveMapping*)ptr->data;
+	cumap->white[0] = values[0];
+	cumap->white[1] = values[1];
+	cumap->white[2] = values[2];
 	curvemapping_set_black_white(cumap, NULL, NULL);
 }
 
-static void rna_CurveMapping_clipminx_range(PointerRNA *ptr, float *min, float *max)
+static void rna_CurveMapping_clipminx_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
 {
-	CurveMapping *cumap= (CurveMapping*)ptr->data;
+	CurveMapping *cumap = (CurveMapping*)ptr->data;
 
-	*min= -100.0f;
-	*max= cumap->clipr.xmax;
+	*min = -100.0f;
+	*max = cumap->clipr.xmax;
 }
 
-static void rna_CurveMapping_clipminy_range(PointerRNA *ptr, float *min, float *max)
+static void rna_CurveMapping_clipminy_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
 {
-	CurveMapping *cumap= (CurveMapping*)ptr->data;
+	CurveMapping *cumap = (CurveMapping*)ptr->data;
 
-	*min= -100.0f;
-	*max= cumap->clipr.ymax;
+	*min = -100.0f;
+	*max = cumap->clipr.ymax;
 }
 
-static void rna_CurveMapping_clipmaxx_range(PointerRNA *ptr, float *min, float *max)
+static void rna_CurveMapping_clipmaxx_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
 {
-	CurveMapping *cumap= (CurveMapping*)ptr->data;
+	CurveMapping *cumap = (CurveMapping*)ptr->data;
 
-	*min= cumap->clipr.xmin;
-	*max= 100.0f;
+	*min = cumap->clipr.xmin;
+	*max = 100.0f;
 }
 
-static void rna_CurveMapping_clipmaxy_range(PointerRNA *ptr, float *min, float *max)
+static void rna_CurveMapping_clipmaxy_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
 {
-	CurveMapping *cumap= (CurveMapping*)ptr->data;
+	CurveMapping *cumap = (CurveMapping*)ptr->data;
 
-	*min= cumap->clipr.ymin;
-	*max= 100.0f;
+	*min = cumap->clipr.ymin;
+	*max = 100.0f;
 }
 
 
@@ -137,14 +137,14 @@ static char *rna_ColorRamp_path(PointerRNA *ptr)
 {
 	/* handle the cases where a single datablock may have 2 ramp types */
 	if (ptr->id.data) {
-		ID *id= ptr->id.data;
+		ID *id = ptr->id.data;
 		
 		switch (GS(id->name)) {
-			case ID_MA:	/* material has 2 cases - diffuse and specular */ 
+			case ID_MA:	/* material has 2 cases - diffuse and specular */
 			{
-				Material *ma= (Material*)id;
+				Material *ma = (Material*)id;
 				
-				if (ptr->data == ma->ramp_col) 
+				if (ptr->data == ma->ramp_col)
 					return BLI_strdup("diffuse_ramp");
 				else if (ptr->data == ma->ramp_spec)
 					return BLI_strdup("specular_ramp");
@@ -164,32 +164,32 @@ static char *rna_ColorRampElement_path(PointerRNA *ptr)
 	char *path = NULL;
 	int index;
 	
-	/* helper macro for use here to try and get the path 
+	/* helper macro for use here to try and get the path
 	 *	- this calls the standard code for getting a path to a texture...
 	 */
 
 #define COLRAMP_GETPATH                                                       \
 {                                                                             \
-	prop= RNA_struct_find_property(&ramp_ptr, "elements");                    \
+	prop = RNA_struct_find_property(&ramp_ptr, "elements");                   \
 	if (prop) {                                                               \
-		index= RNA_property_collection_lookup_index(&ramp_ptr, prop, ptr);    \
+		index = RNA_property_collection_lookup_index(&ramp_ptr, prop, ptr);   \
 		if (index >= 0) {                                                     \
-			char *texture_path= rna_ColorRamp_path(&ramp_ptr);                \
-			path= BLI_sprintfN("%s.elements[%d]", texture_path, index);       \
+			char *texture_path = rna_ColorRamp_path(&ramp_ptr);               \
+			path = BLI_sprintfN("%s.elements[%d]", texture_path, index);      \
 			MEM_freeN(texture_path);                                          \
 		}                                                                     \
 	}                                                                         \
 }
 
 	/* determine the path from the ID-block to the ramp */
-	// FIXME: this is a very slow way to do it, but it will have to suffice...
+	/* FIXME: this is a very slow way to do it, but it will have to suffice... */
 	if (ptr->id.data) {
-		ID *id= ptr->id.data;
+		ID *id = ptr->id.data;
 		
 		switch (GS(id->name)) {
 			case ID_MA: /* 2 cases for material - diffuse and spec */
 			{
-				Material *ma= (Material *)id;
+				Material *ma = (Material *)id;
 				
 				/* try diffuse first */
 				if (ma->ramp_col) {
@@ -204,13 +204,13 @@ static char *rna_ColorRampElement_path(PointerRNA *ptr)
 			}
 				break;
 				
-				// TODO: node trees need special attention
-			case ID_NT: 
+				/* TODO: node trees need special attention */
+			case ID_NT:
 			{
 				bNodeTree *ntree = (bNodeTree *)id;
 				bNode *node;
 				
-				for(node=ntree->nodes.first; node; node=node->next) {
+				for (node = ntree->nodes.first; node; node = node->next) {
 					if (ELEM3(node->type, SH_NODE_VALTORGB, CMP_NODE_VALTORGB, TEX_NODE_VALTORGB)) {
 						RNA_pointer_create(id, &RNA_ColorRamp, node->storage, &ramp_ptr);
 						COLRAMP_GETPATH;
@@ -239,12 +239,12 @@ static char *rna_ColorRampElement_path(PointerRNA *ptr)
 static void rna_ColorRamp_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
 {
 	if (ptr->id.data) {
-		ID *id= ptr->id.data;
+		ID *id = ptr->id.data;
 		
 		switch (GS(id->name)) {
 			case ID_MA:
 			{
-				Material *ma= ptr->id.data;
+				Material *ma = ptr->id.data;
 				
 				DAG_id_tag_update(&ma->id, 0);
 				WM_main_add_notifier(NC_MATERIAL|ND_SHADING_DRAW, ma);
@@ -255,7 +255,7 @@ static void rna_ColorRamp_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *
 				bNodeTree *ntree = (bNodeTree *)id;
 				bNode *node;
 
-				for(node=ntree->nodes.first; node; node=node->next) {
+				for (node = ntree->nodes.first; node; node = node->next) {
 					if (ELEM3(node->type, SH_NODE_VALTORGB, CMP_NODE_VALTORGB, TEX_NODE_VALTORGB)) {
 						ED_node_generic_update(bmain, ntree, node);
 					}
@@ -264,7 +264,7 @@ static void rna_ColorRamp_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *
 				break;
 			case ID_TE:
 			{
-				Tex *tex= ptr->id.data;
+				Tex *tex = ptr->id.data;
 
 				DAG_id_tag_update(&tex->id, 0);
 				WM_main_add_notifier(NC_TEXTURE, tex);
@@ -276,16 +276,16 @@ static void rna_ColorRamp_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *
 	}
 }
 
-static void rna_ColorRamp_eval(struct ColorBand *coba, float position, float color[4])
+void rna_ColorRamp_eval(struct ColorBand *coba, float position, float color[4])
 {
 	do_colorband(coba, position, color);
 }
 
 static CBData *rna_ColorRampElement_new(struct ColorBand *coba, ReportList *reports, float position)
 {
-	CBData *element= colorband_element_add(coba, position);
+	CBData *element = colorband_element_add(coba, position);
 
-	if(element==NULL)
+	if (element == NULL)
 		BKE_reportf(reports, RPT_ERROR, "Unable to add element to colorband (limit %d)", MAXCOLORBAND);
 
 	return element;
@@ -294,14 +294,14 @@ static CBData *rna_ColorRampElement_new(struct ColorBand *coba, ReportList *repo
 static void rna_ColorRampElement_remove(struct ColorBand *coba, ReportList *reports, CBData *element)
 {
 	int index = (int)(element - coba->data);
-	if(colorband_element_remove(coba, index) == 0)
+	if (colorband_element_remove(coba, index) == 0)
 		BKE_report(reports, RPT_ERROR, "Element not found in element collection or last element");
 
 }
 
 static void rna_Scopes_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	Scopes *s= (Scopes*)ptr->data;
+	Scopes *s = (Scopes*)ptr->data;
 	s->ok = 0;
 }
 
@@ -317,24 +317,24 @@ static void rna_def_curvemappoint(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}
 	};
 
-	srna= RNA_def_struct(brna, "CurveMapPoint", NULL);
+	srna = RNA_def_struct(brna, "CurveMapPoint", NULL);
 	RNA_def_struct_ui_text(srna, "CurveMapPoint", "Point of a curve used for a curve mapping");
 
 	/* not editable for now, need to have CurveMapping to do curvemapping_changed */
 
-	prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "x");
 	RNA_def_property_array(prop, 2);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Location", "X/Y coordinates of the curve point");
 
-	prop= RNA_def_property(srna, "handle_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "handle_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, prop_handle_type_items);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Handle Type", "Curve interpolation at this point: Bezier or vector");
 
-	prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CUMA_SELECT);
 	RNA_def_property_ui_text(prop, "Select", "Selection state of the curve point");
 }
@@ -349,18 +349,18 @@ static void rna_def_curvemap(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}
 	};
 
-	srna= RNA_def_struct(brna, "CurveMap", NULL);
+	srna = RNA_def_struct(brna, "CurveMap", NULL);
 	RNA_def_struct_ui_text(srna, "CurveMap", "Curve in a curve mapping");
 
 	/* not editable for now, need to have CurveMapping to do curvemapping_changed */
 
-	prop= RNA_def_property(srna, "extend", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "extend", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, prop_extend_items);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Extend", "Extrapolate the curve or extend it horizontally");
 
-	prop= RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "curve", "totpoint");
 	RNA_def_property_struct_type(prop, "CurveMapPoint");
 	RNA_def_property_ui_text(prop, "Points", "");
@@ -371,50 +371,54 @@ static void rna_def_curvemapping(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "CurveMapping", NULL);
-	RNA_def_struct_ui_text(srna, "CurveMapping", "Curve mapping to map color, vector and scalar values to other values using a user defined curve");
+	srna = RNA_def_struct(brna, "CurveMapping", NULL);
+	RNA_def_struct_ui_text(srna, "CurveMapping",
+	                       "Curve mapping to map color, vector and scalar values to other values using "
+	                       "a user defined curve");
 	
-	prop= RNA_def_property(srna, "use_clip", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_clip", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CUMA_DO_CLIP);
 	RNA_def_property_ui_text(prop, "Clip", "Force the curve view to fit a defined boundary");
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_CurveMapping_clip_set");
 
-	prop= RNA_def_property(srna, "clip_min_x", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "clip_min_x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "clipr.xmin");
 	RNA_def_property_range(prop, -100.0f, 100.0f);
 	RNA_def_property_ui_text(prop, "Clip Min X", "");
 	RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipminx_range");
 
-	prop= RNA_def_property(srna, "clip_min_y", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "clip_min_y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "clipr.ymin");
 	RNA_def_property_range(prop, -100.0f, 100.0f);
 	RNA_def_property_ui_text(prop, "Clip Min Y", "");
 	RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipminy_range");
 
-	prop= RNA_def_property(srna, "clip_max_x", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "clip_max_x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "clipr.xmax");
 	RNA_def_property_range(prop, -100.0f, 100.0f);
 	RNA_def_property_ui_text(prop, "Clip Max X", "");
 	RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipmaxx_range");
 
-	prop= RNA_def_property(srna, "clip_max_y", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "clip_max_y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "clipr.ymax");
 	RNA_def_property_range(prop, -100.0f, 100.0f);
 	RNA_def_property_ui_text(prop, "Clip Max Y", "");
 	RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipmaxy_range");
 
-	prop= RNA_def_property(srna, "curves", PROP_COLLECTION, PROP_NONE);
-	RNA_def_property_collection_funcs(prop, "rna_CurveMapping_curves_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_CurveMapping_curves_length", NULL, NULL, NULL);
+	prop = RNA_def_property(srna, "curves", PROP_COLLECTION, PROP_NONE);
+	RNA_def_property_collection_funcs(prop, "rna_CurveMapping_curves_begin", "rna_iterator_array_next",
+	                                  "rna_iterator_array_end", "rna_iterator_array_get",
+	                                  "rna_CurveMapping_curves_length", NULL, NULL, NULL);
 	RNA_def_property_struct_type(prop, "CurveMap");
 	RNA_def_property_ui_text(prop, "Curves", "");
 
-	prop= RNA_def_property(srna, "black_level", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "black_level", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "black");
 	RNA_def_property_range(prop, -1000.0f, 1000.0f);
 	RNA_def_property_ui_text(prop, "Black Level", "For RGB curves, the color that black is mapped to");
 	RNA_def_property_float_funcs(prop, NULL, "rna_CurveMapping_black_level_set", NULL);
 
-	prop= RNA_def_property(srna, "white_level", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "white_level", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "white");
 	RNA_def_property_range(prop, -1000.0f, 1000.0f);
 	RNA_def_property_ui_text(prop, "White Level", "For RGB curves, the color that white is mapped to");
@@ -426,18 +430,18 @@ static void rna_def_color_ramp_element(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "ColorRampElement", NULL);
+	srna = RNA_def_struct(brna, "ColorRampElement", NULL);
 	RNA_def_struct_sdna(srna, "CBData");
 	RNA_def_struct_path_func(srna, "rna_ColorRampElement_path");
 	RNA_def_struct_ui_text(srna, "Color Ramp Element", "Element defining a color at a position in the color ramp");
 	
-	prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "r");
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "Color", "Set color of selected color stop");
 	RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
 	
-	prop= RNA_def_property(srna, "position", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "position", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "pos");
 	RNA_def_property_range(prop, 0, 1);
 	RNA_def_property_ui_text(prop, "Position", "Set position of selected color stop");
@@ -451,7 +455,7 @@ static void rna_def_color_ramp_element_api(BlenderRNA *brna, PropertyRNA *cprop)
 	FunctionRNA *func;
 
 	RNA_def_property_srna(cprop, "ColorRampElements");
-	srna= RNA_def_struct(brna, "ColorRampElements", NULL);
+	srna = RNA_def_struct(brna, "ColorRampElements", NULL);
 	RNA_def_struct_sdna(srna, "ColorBand");
 	RNA_def_struct_path_func(srna, "rna_ColorRampElement_path");
 	RNA_def_struct_ui_text(srna, "Color Ramp Elements", "Collection of Color Ramp Elements");
@@ -460,16 +464,16 @@ static void rna_def_color_ramp_element_api(BlenderRNA *brna, PropertyRNA *cprop)
 	func = RNA_def_function(srna, "new", "rna_ColorRampElement_new");
 	RNA_def_function_ui_description(func, "Add element to ColorRamp");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
-	parm= RNA_def_float(func, "position", 0.0f, 0.0f, 1.0f, "Position", "Position to add element", 0.0f, 1.0f);
+	parm = RNA_def_float(func, "position", 0.0f, 0.0f, 1.0f, "Position", "Position to add element", 0.0f, 1.0f);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_pointer(func, "element", "ColorRampElement", "", "New element");
+	parm = RNA_def_pointer(func, "element", "ColorRampElement", "", "New element");
 	RNA_def_function_return(func, parm);
 
 	func = RNA_def_function(srna, "remove", "rna_ColorRampElement_remove");
 	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");
+	parm = RNA_def_pointer(func, "element", "ColorRampElement", "", "Element to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 }
 
@@ -487,26 +491,26 @@ static void rna_def_color_ramp(BlenderRNA *brna)
 		{4, "CONSTANT", 0, "Constant", ""},
 		{0, NULL, 0, NULL, NULL}};
 	
-	srna= RNA_def_struct(brna, "ColorRamp", NULL);
+	srna = RNA_def_struct(brna, "ColorRamp", NULL);
 	RNA_def_struct_sdna(srna, "ColorBand");
 	RNA_def_struct_path_func(srna, "rna_ColorRamp_path");
 	RNA_def_struct_ui_text(srna, "Color Ramp", "Color ramp mapping a scalar value to a color");
 	
-	prop= RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_COLOR);
+	prop = RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_COLOR);
 	RNA_def_property_collection_sdna(prop, NULL, "data", "tot");
 	RNA_def_property_struct_type(prop, "ColorRampElement");
 	RNA_def_property_ui_text(prop, "Elements", "");
 	RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
 	rna_def_color_ramp_element_api(brna, prop);
 
-	prop= RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "ipotype");
 	RNA_def_property_enum_items(prop, prop_interpolation_items);
 	RNA_def_property_ui_text(prop, "Interpolation", "");
 	RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
 
-#if 0 // use len(elements)
-	prop= RNA_def_property(srna, "total", PROP_INT, PROP_NONE);
+#if 0 /* use len(elements) */
+	prop = RNA_def_property(srna, "total", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "tot");
 	/* needs a function to do the right thing when adding elements like colorband_add_cb() */
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -517,10 +521,11 @@ static void rna_def_color_ramp(BlenderRNA *brna)
 	
 	func = RNA_def_function(srna, "evaluate", "rna_ColorRamp_eval");
 	RNA_def_function_ui_description(func, "Evaluate ColorRamp");
-	prop= RNA_def_float(func, "position", 1.0f, 0.0f, 1.0f, "Position", "Evaluate ColorRamp at position", 0.0f, 1.0f);
+	prop = RNA_def_float(func, "position", 1.0f, 0.0f, 1.0f, "Position", "Evaluate ColorRamp at position", 0.0f, 1.0f);
 	RNA_def_property_flag(prop, PROP_REQUIRED);
 	/* return */
-	prop = RNA_def_float_color(func, "color", 4, NULL, -FLT_MAX, FLT_MAX, "Color", "Color at given position", -FLT_MAX, FLT_MAX);
+	prop = RNA_def_float_color(func, "color", 4, NULL, -FLT_MAX, FLT_MAX, "Color", "Color at given position",
+	                           -FLT_MAX, FLT_MAX);
 	RNA_def_property_flag(prop, PROP_THICK_WRAP);
 	RNA_def_function_output(func, prop);
 }
@@ -538,10 +543,10 @@ static void rna_def_histogram(BlenderRNA *brna)
 		{HISTO_MODE_B, "B", ICON_COLOR, "Blue", ""},
 		{0, NULL, 0, NULL, NULL}};
 		
-	srna= RNA_def_struct(brna, "Histogram", NULL);
+	srna = RNA_def_struct(brna, "Histogram", NULL);
 	RNA_def_struct_ui_text(srna, "Histogram", "Statistical view of the levels of color in an image");
 	
-	prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "mode");
 	RNA_def_property_enum_items(prop, prop_mode_items);
 	RNA_def_property_ui_text(prop, "Mode", "Channels to display when drawing the histogram");
@@ -561,38 +566,38 @@ static void rna_def_scopes(BlenderRNA *brna)
 		{SCOPES_WAVEFRM_YCC_JPEG, "YCBCRJPG", ICON_COLOR, "YCbCr (Jpeg)", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "Scopes", NULL);
+	srna = RNA_def_struct(brna, "Scopes", NULL);
 	RNA_def_struct_ui_text(srna, "Scopes", "Scopes for statistical view of an image");
 	
-	prop= RNA_def_property(srna, "use_full_resolution", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_full_resolution", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, "Scopes", "sample_full", 1);
 	RNA_def_property_ui_text(prop, "Full Sample", "Sample every pixel of the image");
 	RNA_def_property_update(prop, 0, "rna_Scopes_update");
 	
-	prop= RNA_def_property(srna, "accuracy", PROP_FLOAT, PROP_PERCENTAGE);
+	prop = RNA_def_property(srna, "accuracy", PROP_FLOAT, PROP_PERCENTAGE);
 	RNA_def_property_float_sdna(prop, "Scopes", "accuracy");
 	RNA_def_property_range(prop, 0.0, 100.0);
 	RNA_def_property_ui_range(prop, 0.0, 100.0, 10, 1);
 	RNA_def_property_ui_text(prop, "Accuracy", "Proportion of original image source pixel lines to sample");
 	RNA_def_property_update(prop, 0, "rna_Scopes_update");
 
-	prop= RNA_def_property(srna, "histogram", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "histogram", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, "Scopes", "hist");
 	RNA_def_property_struct_type(prop, "Histogram");
 	RNA_def_property_ui_text(prop, "Histogram", "Histogram for viewing image statistics");
 
-	prop= RNA_def_property(srna, "waveform_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "waveform_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, "Scopes", "wavefrm_mode");
 	RNA_def_property_enum_items(prop, prop_wavefrm_mode_items);
 	RNA_def_property_ui_text(prop, "Waveform Mode", "");
 	RNA_def_property_update(prop, 0, "rna_Scopes_update");
 
-	prop= RNA_def_property(srna, "waveform_alpha", PROP_FLOAT, PROP_PERCENTAGE);
+	prop = RNA_def_property(srna, "waveform_alpha", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, "Scopes", "wavefrm_alpha");
 	RNA_def_property_range(prop, 0, 1);
 	RNA_def_property_ui_text(prop, "Waveform Opacity", "Opacity of the points");
 
-	prop= RNA_def_property(srna, "vectorscope_alpha", PROP_FLOAT, PROP_PERCENTAGE);
+	prop = RNA_def_property(srna, "vectorscope_alpha", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, "Scopes", "vecscope_alpha");
 	RNA_def_property_range(prop, 0, 1);
 	RNA_def_property_ui_text(prop, "Vectorscope Opacity", "Opacity of the points");
@@ -611,4 +616,3 @@ void RNA_def_color(BlenderRNA *brna)
 }
 
 #endif
-
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 8a1c56a..6d67f0c 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -33,6 +33,8 @@
 
 #include "BLI_math.h"
 
+#include "BLF_translation.h"
+
 #include "DNA_action_types.h"
 #include "DNA_constraint_types.h"
 #include "DNA_modifier_types.h"
@@ -42,12 +44,12 @@
 #include "ED_object.h"
 #include "WM_types.h"
 
-EnumPropertyItem constraint_type_items[] ={
-	{0, "", 0, "Motion Tracking", ""},
+EnumPropertyItem constraint_type_items[] = {
+	{0, "", 0, N_("Motion Tracking"), ""},
 	{CONSTRAINT_TYPE_CAMERASOLVER, "CAMERA_SOLVER", ICON_CONSTRAINT_DATA, "Camera Solver", ""},
 	{CONSTRAINT_TYPE_OBJECTSOLVER, "OBJECT_SOLVER", ICON_CONSTRAINT_DATA, "Object Solver", ""},
 	{CONSTRAINT_TYPE_FOLLOWTRACK, "FOLLOW_TRACK", ICON_CONSTRAINT_DATA, "Follow Track", ""},
-	{0, "", 0, "Transform", ""},
+	{0, "", 0, N_("Transform"), ""},
 	{CONSTRAINT_TYPE_LOCLIKE, "COPY_LOCATION", ICON_CONSTRAINT_DATA, "Copy Location", ""},
 	{CONSTRAINT_TYPE_ROTLIKE, "COPY_ROTATION", ICON_CONSTRAINT_DATA, "Copy Rotation", ""},
 	{CONSTRAINT_TYPE_SIZELIKE, "COPY_SCALE", ICON_CONSTRAINT_DATA, "Copy Scale", ""},
@@ -58,15 +60,18 @@ EnumPropertyItem constraint_type_items[] ={
 	{CONSTRAINT_TYPE_SIZELIMIT, "LIMIT_SCALE", ICON_CONSTRAINT_DATA, "Limit Scale", ""},
 	{CONSTRAINT_TYPE_SAMEVOL, "MAINTAIN_VOLUME", ICON_CONSTRAINT_DATA, "Maintain Volume", ""},
 	{CONSTRAINT_TYPE_TRANSFORM, "TRANSFORM", ICON_CONSTRAINT_DATA, "Transformation", ""},
-	{0, "", 0, "Tracking", ""},
+	{0, "", 0, N_("Tracking"), ""},
 	{CONSTRAINT_TYPE_CLAMPTO, "CLAMP_TO", ICON_CONSTRAINT_DATA, "Clamp To", ""},
-	{CONSTRAINT_TYPE_DAMPTRACK, "DAMPED_TRACK", ICON_CONSTRAINT_DATA, "Damped Track", "Tracking by taking the shortest path"},
+	{CONSTRAINT_TYPE_DAMPTRACK, "DAMPED_TRACK", ICON_CONSTRAINT_DATA, "Damped Track",
+	                            "Tracking by taking the shortest path"},
 	{CONSTRAINT_TYPE_KINEMATIC, "IK", ICON_CONSTRAINT_DATA, "Inverse Kinematics", ""},
-	{CONSTRAINT_TYPE_LOCKTRACK, "LOCKED_TRACK", ICON_CONSTRAINT_DATA, "Locked Track", "Tracking along a single axis"},
+	{CONSTRAINT_TYPE_LOCKTRACK, "LOCKED_TRACK", ICON_CONSTRAINT_DATA, "Locked Track",
+	                            "Tracking along a single axis"},
 	{CONSTRAINT_TYPE_SPLINEIK, "SPLINE_IK", ICON_CONSTRAINT_DATA, "Spline IK", ""},
 	{CONSTRAINT_TYPE_STRETCHTO, "STRETCH_TO",ICON_CONSTRAINT_DATA, "Stretch To", ""},
-	{CONSTRAINT_TYPE_TRACKTO, "TRACK_TO", ICON_CONSTRAINT_DATA, "Track To", "Legacy tracking constraint prone to twisting artifacts"},
-	{0, "", 0, "Relationship", ""},
+	{CONSTRAINT_TYPE_TRACKTO, "TRACK_TO", ICON_CONSTRAINT_DATA, "Track To",
+	                          "Legacy tracking constraint prone to twisting artifacts"},
+	{0, "", 0, N_("Relationship"), ""},
 	{CONSTRAINT_TYPE_ACTION, "ACTION", ICON_CONSTRAINT_DATA, "Action", ""},
 	{CONSTRAINT_TYPE_CHILDOF, "CHILD_OF", ICON_CONSTRAINT_DATA, "Child Of", ""},
 	{CONSTRAINT_TYPE_MINMAX, "FLOOR", ICON_CONSTRAINT_DATA, "Floor", ""},
@@ -78,24 +83,39 @@ EnumPropertyItem constraint_type_items[] ={
 	{0, NULL, 0, NULL, NULL}};
 
 static EnumPropertyItem target_space_pchan_items[] = {
-	{CONSTRAINT_SPACE_WORLD,    "WORLD", 0, "World Space", "The transformation of the target is evaluated relative to the world coordinate system"},
-	{CONSTRAINT_SPACE_POSE,     "POSE", 0, "Pose Space", "The transformation of the target is only evaluated in the Pose Space, the target armature object transformation is ignored"},
-	{CONSTRAINT_SPACE_PARLOCAL, "LOCAL_WITH_PARENT", 0, "Local With Parent", "The transformation of the target bone is evaluated relative its local coordinate system, with the parent transformation added"},
-	{CONSTRAINT_SPACE_LOCAL,    "LOCAL", 0, "Local Space", "The transformation of the target is evaluated relative to its local coordinate system"},
+	{CONSTRAINT_SPACE_WORLD,    "WORLD", 0, "World Space",
+	                            "The transformation of the target is evaluated relative to the world "
+	                            "coordinate system"},
+	{CONSTRAINT_SPACE_POSE,     "POSE", 0, "Pose Space",
+	                            "The transformation of the target is only evaluated in the Pose Space, "
+	                            "the target armature object transformation is ignored"},
+	{CONSTRAINT_SPACE_PARLOCAL, "LOCAL_WITH_PARENT", 0, "Local With Parent",
+	                            "The transformation of the target bone is evaluated relative its local "
+	                            "coordinate system, with the parent transformation added"},
+	{CONSTRAINT_SPACE_LOCAL,    "LOCAL", 0, "Local Space",
+	                            "The transformation of the target is evaluated relative to its local "
+	                            "coordinate system"},
 	{0, NULL, 0, NULL, NULL}};
 
 static EnumPropertyItem owner_space_pchan_items[] = {
-	{CONSTRAINT_SPACE_WORLD,    "WORLD", 0, "World Space", "The constraint is applied relative to the world coordinate system"},
-	{CONSTRAINT_SPACE_POSE,     "POSE", 0, "Pose Space", "The constraint is applied in Pose Space, the object transformation is ignored"},
-	{CONSTRAINT_SPACE_PARLOCAL, "LOCAL_WITH_PARENT", 0, "Local With Parent", "The constraint is applied relative to the local coordinate system of the object, with the parent transformation added"},
-	{CONSTRAINT_SPACE_LOCAL,    "LOCAL", 0, "Local Space", "The constraint is applied relative to the local coordinate sytem of the object"},
+	{CONSTRAINT_SPACE_WORLD,    "WORLD", 0, "World Space",
+	                            "The constraint is applied relative to the world coordinate system"},
+	{CONSTRAINT_SPACE_POSE,     "POSE", 0, "Pose Space",
+	                            "The constraint is applied in Pose Space, the object transformation is ignored"},
+	{CONSTRAINT_SPACE_PARLOCAL, "LOCAL_WITH_PARENT", 0, "Local With Parent",
+	                            "The constraint is applied relative to the local coordinate system of the object, "
+	                            "with the parent transformation added"},
+	{CONSTRAINT_SPACE_LOCAL,    "LOCAL", 0, "Local Space",
+	                            "The constraint is applied relative to the local coordinate sytem of the object"},
 	{0, NULL, 0, NULL, NULL}};
 
 #ifdef RNA_RUNTIME
 
 static EnumPropertyItem space_object_items[] = {
-	{CONSTRAINT_SPACE_WORLD, "WORLD", 0, "World Space", "The transformation of the target is evaluated relative to the world coordinate system"},
-	{CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space", "The transformation of the target is evaluated relative to its local coordinate system"},
+	{CONSTRAINT_SPACE_WORLD, "WORLD", 0, "World Space",
+	                         "The transformation of the target is evaluated relative to the world coordinate system"},
+	{CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space",
+	                         "The transformation of the target is evaluated relative to its local coordinate system"},
 	{0, NULL, 0, NULL, NULL}};
 
 #include "BKE_animsys.h"
@@ -107,9 +127,9 @@ static EnumPropertyItem space_object_items[] = {
 
 static StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr)
 {
-	bConstraint *con= (bConstraint*)ptr->data;
+	bConstraint *con = (bConstraint*)ptr->data;
 
-	switch(con->type) {
+	switch (con->type) {
 		case CONSTRAINT_TYPE_CHILDOF:
 			return &RNA_ChildOfConstraint;
 		case CONSTRAINT_TYPE_TRACKTO:
@@ -139,7 +159,7 @@ static StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr)
 		case CONSTRAINT_TYPE_RIGIDBODYJOINT:
 			return &RNA_RigidBodyJointConstraint;
 		case CONSTRAINT_TYPE_CLAMPTO:
-			return &RNA_ClampToConstraint;			
+			return &RNA_ClampToConstraint;
 		case CONSTRAINT_TYPE_TRANSFORM:
 			return &RNA_TransformConstraint;
 		case CONSTRAINT_TYPE_ROTLIMIT:
@@ -173,7 +193,7 @@ static StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr)
 
 static void rna_Constraint_name_set(PointerRNA *ptr, const char *value)
 {
-	bConstraint *con= ptr->data;
+	bConstraint *con = ptr->data;
 	char oldname[sizeof(con->name)];
 	
 	/* make a copy of the old name first */
@@ -184,29 +204,30 @@ static void rna_Constraint_name_set(PointerRNA *ptr, const char *value)
 	
 	/* make sure name is unique */
 	if (ptr->id.data) {
-		Object *ob= ptr->id.data;
+		Object *ob = ptr->id.data;
 		ListBase *list = get_constraint_lb(ob, con, NULL);
 		
 		/* if we have the list, check for unique name, otherwise give up */
 		if (list)
-			unique_constraint_name(con, list); 
+			unique_constraint_name(con, list);
 	}
 	
 	/* fix all the animation data which may link to this */
-	BKE_all_animdata_fix_paths_rename("constraints", oldname, con->name);
+	BKE_all_animdata_fix_paths_rename(NULL, "constraints", oldname, con->name);
 }
 
 static char *rna_Constraint_path(PointerRNA *ptr)
 {
-	Object *ob= ptr->id.data;
-	bConstraint *con= ptr->data;
+	Object *ob = ptr->id.data;
+	bConstraint *con = ptr->data;
 	bPoseChannel *pchan;
 	ListBase *lb = get_constraint_lb(ob, con, &pchan);
 
-	if(lb == NULL)
-		printf("rna_Constraint_path: internal error, constraint '%s' not found in object '%s'\n", con->name, ob->id.name);
+	if (lb == NULL)
+		printf("rna_Constraint_path: internal error, constraint '%s' not found in object '%s'\n",
+		       con->name, ob->id.name);
 
-	if(pchan) {
+	if (pchan) {
 		return BLI_sprintfN("pose.bones[\"%s\"].constraints[\"%s\"]", pchan->name, con->name);
 	}
 	
@@ -225,9 +246,9 @@ static void rna_Constraint_dependency_update(Main *bmain, Scene *scene, PointerR
 
 static void rna_Constraint_influence_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Object *ob= ptr->id.data;
+	Object *ob = ptr->id.data;
 
-	if(ob->pose)
+	if (ob->pose)
 		ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
 	
 	rna_Constraint_update(bmain, scene, ptr);
@@ -239,8 +260,8 @@ static void rna_Constraint_ik_type_set(struct PointerRNA *ptr, int value)
 	bKinematicConstraint *ikdata = con->data;
 
 	if (ikdata->type != value) {
-		// the type of IK constraint has changed, set suitable default values
-		// in case constraints reuse same fields incompatible
+		/* the type of IK constraint has changed, set suitable default values */
+		/* in case constraints reuse same fields incompatible */
 		switch (value) {
 		case CONSTRAINT_IK_COPYPOSE:
 			break;
@@ -251,88 +272,91 @@ static void rna_Constraint_ik_type_set(struct PointerRNA *ptr, int value)
 	}
 }
 
-static EnumPropertyItem *rna_Constraint_owner_space_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
+static EnumPropertyItem *rna_Constraint_owner_space_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+                                                          PropertyRNA *UNUSED(prop), int *UNUSED(free))
 {
-	Object *ob= (Object*)ptr->id.data;
-	bConstraint *con= (bConstraint*)ptr->data;
+	Object *ob = (Object*)ptr->id.data;
+	bConstraint *con = (bConstraint*)ptr->data;
 	
-	if(BLI_findindex(&ob->constraints, con) == -1)
+	if (BLI_findindex(&ob->constraints, con) == -1)
 		return owner_space_pchan_items;
 	else /* object */
 		return space_object_items;
 }
 
-static EnumPropertyItem *rna_Constraint_target_space_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
+static EnumPropertyItem *rna_Constraint_target_space_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+                                                           PropertyRNA *UNUSED(prop), int *UNUSED(free))
 {
-	bConstraint *con= (bConstraint*)ptr->data;
-	bConstraintTypeInfo *cti= constraint_get_typeinfo(con);
+	bConstraint *con = (bConstraint*)ptr->data;
+	bConstraintTypeInfo *cti = constraint_get_typeinfo(con);
 	ListBase targets = {NULL, NULL};
 	bConstraintTarget *ct;
 	
-	if(cti && cti->get_constraint_targets) {
+	if (cti && cti->get_constraint_targets) {
 		cti->get_constraint_targets(con, &targets);
 		
-		for(ct=targets.first; ct; ct= ct->next)
-			if(ct->tar && ct->tar->type == OB_ARMATURE)
+		for (ct = targets.first; ct; ct = ct->next)
+			if (ct->tar && ct->tar->type == OB_ARMATURE)
 				break;
 		
-		if(cti->flush_constraint_targets)
+		if (cti->flush_constraint_targets)
 			cti->flush_constraint_targets(con, &targets, 1);
 
-		if(ct)
+		if (ct)
 			return target_space_pchan_items;
 	}
 
 	return space_object_items;
 }
 
-static void rna_ActionConstraint_minmax_range(PointerRNA *ptr, float *min, float *max)
+static void rna_ActionConstraint_minmax_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
 {
-	bConstraint *con= (bConstraint*)ptr->data;
+	bConstraint *con = (bConstraint*)ptr->data;
 	bActionConstraint *acon = (bActionConstraint *)con->data;
 
 	/* 0, 1, 2 = magic numbers for rotX, rotY, rotZ */
 	if (ELEM3(acon->type, 0, 1, 2)) {
-		*min= -180.0f;
-		*max= 180.0f;
-	} else {
-		*min= -1000.f;
-		*max= 1000.f;
+		*min = -180.0f;
+		*max = 180.0f;
+	}
+	else {
+		*min = -1000.f;
+		*max = 1000.f;
 	}
 }
 
 static int rna_SplineIKConstraint_joint_bindings_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
 {
-	bConstraint *con= (bConstraint*)ptr->data;
-	bSplineIKConstraint *ikData= (bSplineIKConstraint *)con->data;
+	bConstraint *con = (bConstraint*)ptr->data;
+	bSplineIKConstraint *ikData = (bSplineIKConstraint *)con->data;
 
 	if (ikData)
-		length[0]= ikData->numpoints;
+		length[0] = ikData->numpoints;
 	else
-		length[0]= 256; /* for raw_access, untested */
+		length[0] = 256; /* for raw_access, untested */
 
 	return length[0];
 }
 
 static void rna_SplineIKConstraint_joint_bindings_get(PointerRNA *ptr, float *values)
 {
-	bConstraint *con= (bConstraint*)ptr->data;
-	bSplineIKConstraint *ikData= (bSplineIKConstraint *)con->data;
+	bConstraint *con = (bConstraint*)ptr->data;
+	bSplineIKConstraint *ikData = (bSplineIKConstraint *)con->data;
 	
 	memcpy(values, ikData->points, ikData->numpoints * sizeof(float));
 }
 
 static void rna_SplineIKConstraint_joint_bindings_set(PointerRNA *ptr, const float *values)
 {
-	bConstraint *con= (bConstraint*)ptr->data;
-	bSplineIKConstraint *ikData= (bSplineIKConstraint *)con->data;
+	bConstraint *con = (bConstraint*)ptr->data;
+	bSplineIKConstraint *ikData = (bSplineIKConstraint *)con->data;
 	
 	memcpy(ikData->points, values, ikData->numpoints * sizeof(float));
 }
 
 static int rna_Constraint_cameraObject_poll(PointerRNA *ptr, PointerRNA value)
 {
-	Object *ob= (Object*)value.data;
+	Object *ob = (Object*)value.data;
 
 	if (ob) {
 		if (ob->type == OB_CAMERA && ob != (Object*)ptr->id.data) {
@@ -345,39 +369,41 @@ static int rna_Constraint_cameraObject_poll(PointerRNA *ptr, PointerRNA value)
 
 static void rna_Constraint_followTrack_camera_set(PointerRNA *ptr, PointerRNA value)
 {
-	bConstraint *con= (bConstraint*)ptr->data;
-	bFollowTrackConstraint *data= (bFollowTrackConstraint*)con->data;
-	Object *ob= (Object*)value.data;
+	bConstraint *con = (bConstraint*)ptr->data;
+	bFollowTrackConstraint *data = (bFollowTrackConstraint*)con->data;
+	Object *ob = (Object*)value.data;
 
 	if (ob) {
 		if (ob->type == OB_CAMERA && ob != (Object*)ptr->id.data) {
-			data->camera= ob;
+			data->camera = ob;
 		}
-	} else {
-		data->camera= NULL;
+	}
+	else {
+		data->camera = NULL;
 	}
 }
 
 static void rna_Constraint_followTrack_depthObject_set(PointerRNA *ptr, PointerRNA value)
 {
-	bConstraint *con= (bConstraint*)ptr->data;
-	bFollowTrackConstraint *data= (bFollowTrackConstraint*)con->data;
-	Object *ob= (Object*)value.data;
+	bConstraint *con = (bConstraint*)ptr->data;
+	bFollowTrackConstraint *data = (bFollowTrackConstraint*)con->data;
+	Object *ob = (Object*)value.data;
 
 	if (ob) {
 		if (ob->type == OB_MESH && ob != (Object*)ptr->id.data) {
-			data->depth_ob= ob;
+			data->depth_ob = ob;
 		}
-	} else {
-		data->depth_ob= NULL;
+	}
+	else {
+		data->depth_ob = NULL;
 	}
 }
 
 static int rna_Constraint_followTrack_depthObject_poll(PointerRNA *ptr, PointerRNA value)
 {
-	Object *ob= (Object*)value.data;
+	Object *ob = (Object*)value.data;
 
-	if(ob) {
+	if (ob) {
 		if (ob->type == OB_MESH && ob != (Object*)ptr->id.data) {
 			return 1;
 		}
@@ -388,25 +414,32 @@ static int rna_Constraint_followTrack_depthObject_poll(PointerRNA *ptr, PointerR
 
 static void rna_Constraint_objectSolver_camera_set(PointerRNA *ptr, PointerRNA value)
 {
-	bConstraint *con= (bConstraint*)ptr->data;
-	bObjectSolverConstraint *data= (bObjectSolverConstraint*)con->data;
-	Object *ob= (Object*)value.data;
+	bConstraint *con = (bConstraint*)ptr->data;
+	bObjectSolverConstraint *data = (bObjectSolverConstraint*)con->data;
+	Object *ob = (Object*)value.data;
 
 	if (ob) {
 		if (ob->type == OB_CAMERA && ob != (Object*)ptr->id.data) {
-			data->camera= ob;
+			data->camera = ob;
 		}
-	} else {
-		data->camera= NULL;
+	}
+	else {
+		data->camera = NULL;
 	}
 }
 
 #else
 
 EnumPropertyItem constraint_distance_items[] = {
-	{LIMITDIST_INSIDE, "LIMITDIST_INSIDE", 0, "Inside", "The object is constrained inside a virtual sphere around the target object, with a radius defined by the limit distance"},
-	{LIMITDIST_OUTSIDE, "LIMITDIST_OUTSIDE", 0, "Outside", "The object is constrained outside a virtual sphere around the target object, with a radius defined by the limit distance"},
-	{LIMITDIST_ONSURFACE, "LIMITDIST_ONSURFACE", 0, "On Surface", "The object is constrained on the surface of a virtual sphere around the target object, with a radius defined by the limit distance"},
+	{LIMITDIST_INSIDE, "LIMITDIST_INSIDE", 0, "Inside",
+	                   "The object is constrained inside a virtual sphere around the target object, "
+	                   "with a radius defined by the limit distance"},
+	{LIMITDIST_OUTSIDE, "LIMITDIST_OUTSIDE", 0, "Outside",
+	                    "The object is constrained outside a virtual sphere around the target object, "
+	                    "with a radius defined by the limit distance"},
+	{LIMITDIST_ONSURFACE, "LIMITDIST_ONSURFACE", 0, "On Surface",
+	                      "The object is constrained on the surface of a virtual sphere around the target object, "
+	                      "with a radius defined by the limit distance"},
 	{0, NULL, 0, NULL, NULL}
 };
 
@@ -416,91 +449,91 @@ static void rna_def_constrainttarget(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "ConstraintTarget", NULL);
+	srna = RNA_def_struct(brna, "ConstraintTarget", NULL);
 	RNA_def_struct_ui_text(srna, "Constraint Target", "Target object for multi-target constraints");
 	RNA_def_struct_sdna(srna, "bConstraintTarget");
 
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "tar");
 	RNA_def_property_ui_text(prop, "Target", "Target Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "subtarget");
 	RNA_def_property_ui_text(prop, "Sub-Target", "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	// space, flag and type still to do 
+	/* space, flag and type still to do  */
 }
 
 static void rna_def_constraint_childof(BlenderRNA *brna)
 {
-	static int rna_matrix_dimsize_4x4[]= {4, 4};
+	static int rna_matrix_dimsize_4x4[] = {4, 4};
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "ChildOfConstraint", "Constraint"); 
-	RNA_def_struct_ui_text(srna, "Child Of Constraint", "Create constraint-based parent-child relationship"); 
-	RNA_def_struct_sdna_from(srna, "bChildOfConstraint", "data"); 
+	srna = RNA_def_struct(brna, "ChildOfConstraint", "Constraint");
+	RNA_def_struct_ui_text(srna, "Child Of Constraint", "Create constraint-based parent-child relationship");
+	RNA_def_struct_sdna_from(srna, "bChildOfConstraint", "data");
 
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "tar");
 	RNA_def_property_ui_text(prop, "Target", "Target Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "subtarget");
 	RNA_def_property_ui_text(prop, "Sub-Target", "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "use_location_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_location_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_LOCX);
 	RNA_def_property_ui_text(prop, "Location X", "Use X Location of Parent");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_location_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_location_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_LOCY);
 	RNA_def_property_ui_text(prop, "Location Y", "Use Y Location of Parent");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_location_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_location_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_LOCZ);
 	RNA_def_property_ui_text(prop, "Location Z", "Use Z Location of Parent");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_rotation_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_rotation_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_ROTX);
 	RNA_def_property_ui_text(prop, "Rotation X", "Use X Rotation of Parent");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_rotation_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_rotation_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_ROTY);
 	RNA_def_property_ui_text(prop, "Rotation Y", "Use Y Rotation of Parent");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_rotation_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_rotation_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_ROTZ);
 	RNA_def_property_ui_text(prop, "Rotation Z", "Use Z Rotation of Parent");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_scale_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_scale_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_SIZEX);
 	RNA_def_property_ui_text(prop, "Scale X", "Use X Scale of Parent");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_scale_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_scale_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_SIZEY);
 	RNA_def_property_ui_text(prop, "Scale Y", "Use Y Scale of Parent");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_scale_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_scale_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_SIZEZ);
 	RNA_def_property_ui_text(prop, "Scale Z", "Use Z Scale of Parent");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 	
-	prop= RNA_def_property(srna, "inverse_matrix", PROP_FLOAT, PROP_MATRIX);
+	prop = RNA_def_property(srna, "inverse_matrix", PROP_FLOAT, PROP_MATRIX);
 	RNA_def_property_float_sdna(prop, NULL, "invmat");
 	RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
@@ -513,31 +546,31 @@ static void rna_def_constraint_python(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "PythonConstraint", "Constraint");
+	srna = RNA_def_struct(brna, "PythonConstraint", "Constraint");
 	RNA_def_struct_ui_text(srna, "Python Constraint", "Use Python script for constraint evaluation");
 	RNA_def_struct_sdna_from(srna, "bPythonConstraint", "data");
 
-	prop= RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "targets", NULL);
 	RNA_def_property_struct_type(prop, "ConstraintTarget");
 	RNA_def_property_ui_text(prop, "Targets", "Target Objects");
 
-	prop= RNA_def_property(srna, "target_count", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "target_count", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "tarnum");
 	RNA_def_property_ui_text(prop, "Number of Targets", "Usually only 1-3 are needed");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Script", "The text object that contains the Python script");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_targets", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_targets", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PYCON_USETARGETS);
 	RNA_def_property_ui_text(prop, "Use Targets", "Use the targets indicated in the constraint panel");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "has_script_error", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "has_script_error", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PYCON_SCRIPTERROR);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Script Error", "The linked Python script has thrown an error");
@@ -548,146 +581,147 @@ static void rna_def_constraint_kinematic(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static EnumPropertyItem constraint_ik_axisref_items[] ={
+	static EnumPropertyItem constraint_ik_axisref_items[] = {
 		{0, "BONE", 0, "Bone", ""},
 		{CONSTRAINT_IK_TARGETAXIS, "TARGET", 0, "Target", ""},
 		{0, NULL, 0, NULL, NULL},
 	};
 
-	static EnumPropertyItem constraint_ik_type_items[] ={
+	static EnumPropertyItem constraint_ik_type_items[] = {
 		{CONSTRAINT_IK_COPYPOSE, "COPY_POSE", 0, "Copy Pose", ""},
 		{CONSTRAINT_IK_DISTANCE, "DISTANCE", 0, "Distance", ""},
 		{0, NULL, 0, NULL, NULL},
 	};
 
-	srna= RNA_def_struct(brna, "KinematicConstraint", "Constraint");
+	srna = RNA_def_struct(brna, "KinematicConstraint", "Constraint");
 	RNA_def_struct_ui_text(srna, "Kinematic Constraint", "Inverse Kinematics");
 	RNA_def_struct_sdna_from(srna, "bKinematicConstraint", "data");
 
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "tar");
 	RNA_def_property_ui_text(prop, "Target", "Target Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "subtarget");
 	RNA_def_property_ui_text(prop, "Sub-Target", "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, 1, 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");
 
-	prop= RNA_def_property(srna, "pole_target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "pole_target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "poletar");
 	RNA_def_property_ui_text(prop, "Pole Target", "Object for pole rotation");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "pole_subtarget", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "pole_subtarget", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "polesubtarget");
 	RNA_def_property_ui_text(prop, "Pole Sub-Target", "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "pole_angle", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "pole_angle", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "poleangle");
 	RNA_def_property_range(prop, -M_PI, M_PI);
 	RNA_def_property_ui_text(prop, "Pole Angle", "Pole rotation offset");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.01, 1.f);
 	RNA_def_property_ui_text(prop, "Weight", "For Tree-IK: Weight of position control for this target");
 
-	prop= RNA_def_property(srna, "orient_weight", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "orient_weight", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "orientweight");
 	RNA_def_property_range(prop, 0.01, 1.f);
 	RNA_def_property_ui_text(prop, "Orientation Weight", "For Tree-IK: Weight of orientation control for this target");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "chain_count", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "chain_count", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "rootbone");
 	RNA_def_property_range(prop, 0, 255);
 	RNA_def_property_ui_text(prop, "Chain Length", "How many bones are included in the IK effect - 0 uses all bones");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "use_tail", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_tail", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_TIP);
 	RNA_def_property_ui_text(prop, "Use Tail", "Include bone's tail as last element in chain");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "reference_axis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "reference_axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, constraint_ik_axisref_items);
-	RNA_def_property_ui_text(prop, "Axis Reference", "Constraint axis Lock options relative to Bone or Target reference");
+	RNA_def_property_ui_text(prop, "Axis Reference",
+	                         "Constraint axis Lock options relative to Bone or Target reference");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "use_location", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_location", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_POS);
 	RNA_def_property_ui_text(prop, "Position", "Chain follows position of target");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "lock_location_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_location_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_POS_X);
 	RNA_def_property_ui_text(prop, "Lock X Pos", "Constraint position along X axis");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "lock_location_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_location_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_POS_Y);
 	RNA_def_property_ui_text(prop, "Lock Y Pos", "Constraint position along Y axis");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "lock_location_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_location_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_POS_Z);
 	RNA_def_property_ui_text(prop, "Lock Z Pos", "Constraint position along Z axis");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "use_rotation", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_rotation", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_ROT);
 	RNA_def_property_ui_text(prop, "Rotation", "Chain follows rotation of target");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "lock_rotation_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_rotation_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_ROT_X);
 	RNA_def_property_ui_text(prop, "Lock X Rot", "Constraint rotation along X axis");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "lock_rotation_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_rotation_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_ROT_Y);
 	RNA_def_property_ui_text(prop, "Lock Y Rot", "Constraint rotation along Y axis");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "lock_rotation_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_rotation_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_ROT_Z);
 	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);
+	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);
+	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");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "ik_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "ik_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_funcs(prop, NULL, "rna_Constraint_ik_type_set", NULL);
 	RNA_def_property_enum_items(prop, constraint_ik_type_items);
 	RNA_def_property_ui_text(prop, "IK Type", "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "limit_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "limit_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "mode");
 	RNA_def_property_enum_items(prop, constraint_distance_items);
 	RNA_def_property_ui_text(prop, "Limit Mode", "Distances in relation to sphere of influence to allow");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "dist");
 	RNA_def_property_range(prop, 0.0, 100.f);
 	RNA_def_property_ui_text(prop, "Distance", "Radius of limiting sphere");
@@ -714,40 +748,40 @@ static void rna_def_constraint_track_to(BlenderRNA *brna)
 		{TRACK_Z, "UP_Z", 0, "Z", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "TrackToConstraint", "Constraint");
+	srna = RNA_def_struct(brna, "TrackToConstraint", "Constraint");
 	RNA_def_struct_ui_text(srna, "Track To Constraint", "Aim the constrained object toward the target");
 
-	prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
 	RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
 	RNA_def_struct_sdna_from(srna, "bTrackToConstraint", "data");
 
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "tar");
 	RNA_def_property_ui_text(prop, "Target", "Target Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "subtarget");
 	RNA_def_property_ui_text(prop, "Sub-Target", "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "reserved1");
 	RNA_def_property_enum_items(prop, track_items);
 	RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "reserved2");
 	RNA_def_property_enum_items(prop, up_items);
 	RNA_def_property_ui_text(prop, "Up Axis", "Axis that points upward");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_target_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_target_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", TARGET_Z_UP);
 	RNA_def_property_ui_text(prop, "Target Z", "Target's Z axis, not World Z axis, will constraint the Up direction");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
@@ -758,59 +792,59 @@ static void rna_def_constraint_locate_like(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "CopyLocationConstraint", "Constraint");
+	srna = RNA_def_struct(brna, "CopyLocationConstraint", "Constraint");
 	RNA_def_struct_ui_text(srna, "Copy Location Constraint", "Copy the location of the target");
 
-	prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
 	RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
 	RNA_def_struct_sdna_from(srna, "bLocateLikeConstraint", "data");
 
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "tar");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Target", "Target Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "subtarget");
 	RNA_def_property_ui_text(prop, "Sub-Target", "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_X);
 	RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X location");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Y);
 	RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y location");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Z);
 	RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z location");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "invert_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_X_INVERT);
 	RNA_def_property_ui_text(prop, "Invert X", "Invert the X location");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "invert_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Y_INVERT);
 	RNA_def_property_ui_text(prop, "Invert Y", "Invert the Y location");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Z_INVERT);
 	RNA_def_property_ui_text(prop, "Invert Z", "Invert the Z location");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_OFFSET);
 	RNA_def_property_ui_text(prop, "Offset", "Add original location into copied location");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
@@ -821,52 +855,52 @@ static void rna_def_constraint_rotate_like(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "CopyRotationConstraint", "Constraint");
+	srna = RNA_def_struct(brna, "CopyRotationConstraint", "Constraint");
 	RNA_def_struct_ui_text(srna, "Copy Rotation Constraint", "Copy the rotation of the target");
 	RNA_def_struct_sdna_from(srna, "bRotateLikeConstraint", "data");
 
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "tar");
 	RNA_def_property_ui_text(prop, "Target", "Target Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "subtarget");
 	RNA_def_property_ui_text(prop, "Sub-Target", "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_X);
 	RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X rotation");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Y);
 	RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y rotation");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Z);
 	RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z rotation");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "invert_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_X_INVERT);
 	RNA_def_property_ui_text(prop, "Invert X", "Invert the X rotation");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "invert_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Y_INVERT);
 	RNA_def_property_ui_text(prop, "Invert Y", "Invert the Y rotation");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Z_INVERT);
 	RNA_def_property_ui_text(prop, "Invert Z", "Invert the Z rotation");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_OFFSET);
 	RNA_def_property_ui_text(prop, "Offset", "Add original rotation into copied rotation");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
@@ -877,38 +911,38 @@ static void rna_def_constraint_size_like(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "CopyScaleConstraint", "Constraint");
+	srna = RNA_def_struct(brna, "CopyScaleConstraint", "Constraint");
 	RNA_def_struct_ui_text(srna, "Copy Scale Constraint", "Copy the scale of the target");
 	RNA_def_struct_sdna_from(srna, "bSizeLikeConstraint", "data");
 
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "tar");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Target", "Target Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "subtarget");
 	RNA_def_property_ui_text(prop, "Sub-Target", "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_X);
 	RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X scale");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_Y);
 	RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y scale");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_Z);
 	RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z scale");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_OFFSET);
 	RNA_def_property_ui_text(prop, "Offset", "Add original scale into copied scale");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
@@ -925,17 +959,18 @@ static void rna_def_constraint_same_volume(BlenderRNA *brna)
 	{SAMEVOL_Z, "SAMEVOL_Z", 0, "Z", ""},
 	{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "MaintainVolumeConstraint", "Constraint");
-	RNA_def_struct_ui_text(srna, "Maintain Volume Constraint", "Maintain a constant volume along a single scaling axis");
+	srna = RNA_def_struct(brna, "MaintainVolumeConstraint", "Constraint");
+	RNA_def_struct_ui_text(srna, "Maintain Volume Constraint",
+	                       "Maintain a constant volume along a single scaling axis");
 	RNA_def_struct_sdna_from(srna, "bSameVolumeConstraint", "data");
 
-	prop= RNA_def_property(srna, "free_axis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "free_axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, volume_items);
 	RNA_def_property_ui_text(prop, "Free Axis", "The free scaling axis of the object");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "volume", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_range(prop, 0.001, 100.f);
 	RNA_def_property_ui_text(prop, "Volume", "Volume of the bone at rest");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
@@ -947,23 +982,23 @@ static void rna_def_constraint_transform_like(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "CopyTransformsConstraint", "Constraint");
+	srna = RNA_def_struct(brna, "CopyTransformsConstraint", "Constraint");
 	RNA_def_struct_ui_text(srna, "Copy Transforms Constraint", "Copy all the transforms of the target");
 	
-	prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
 	RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
 	RNA_def_struct_sdna_from(srna, "bTransLikeConstraint", "data");
 
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "tar");
 	RNA_def_property_ui_text(prop, "Target", "Target Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "subtarget");
 	RNA_def_property_ui_text(prop, "Sub-Target", "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
@@ -983,38 +1018,38 @@ static void rna_def_constraint_minmax(BlenderRNA *brna)
 		{TRACK_nZ, "FLOOR_NEGATIVE_Z", 0, "-Z", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "FloorConstraint", "Constraint");
+	srna = RNA_def_struct(brna, "FloorConstraint", "Constraint");
 	RNA_def_struct_ui_text(srna, "Floor Constraint", "Use the target object for location limitation");
 	RNA_def_struct_sdna_from(srna, "bMinMaxConstraint","data");
 
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "tar");
 	RNA_def_property_ui_text(prop, "Target", "Target Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "subtarget");
 	RNA_def_property_ui_text(prop, "Sub-Target", "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "floor_location", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "floor_location", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "minmaxflag");
 	RNA_def_property_enum_items(prop, minmax_items);
 	RNA_def_property_ui_text(prop, "Floor Location", "Location of target that object will not pass through");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_sticky", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_sticky", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MINMAX_STICKY);
 	RNA_def_property_ui_text(prop, "Sticky", "Immobilize object while constrained");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_rotation", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_rotation", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MINMAX_USEROT);
 	RNA_def_property_ui_text(prop, "Use Rotation", "Use the target's rotation to determine floor");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_range(prop, 0.0, 100.f);
 	RNA_def_property_ui_text(prop, "Offset", "Offset of floor from object origin");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
@@ -1037,53 +1072,54 @@ static void rna_def_constraint_action(BlenderRNA *brna)
 		{12, "SCALE_Z", 0, "Z Scale", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "ActionConstraint", "Constraint");
+	srna = RNA_def_struct(brna, "ActionConstraint", "Constraint");
 	RNA_def_struct_ui_text(srna, "Action Constraint", "Map an action to the transform axes of a bone");
 	RNA_def_struct_sdna_from(srna, "bActionConstraint", "data");
 
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "tar");
 	RNA_def_property_ui_text(prop, "Target", "Target Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "subtarget");
 	RNA_def_property_ui_text(prop, "Sub-Target", "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "transform_channel", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "transform_channel", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, transform_channel_items);
-	RNA_def_property_ui_text(prop, "Transform Channel", "Transformation channel from the target that is used to key the Action");
+	RNA_def_property_ui_text(prop, "Transform Channel",
+	                         "Transformation channel from the target that is used to key the Action");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "act");
 	RNA_def_property_ui_text(prop, "Action", "The constraining action");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "start");
 	RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
 	RNA_def_property_ui_text(prop, "Start Frame", "First frame of the Action to use");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "end");
 	RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
 	RNA_def_property_ui_text(prop, "End Frame", "Last frame of the Action to use");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "max");
 	RNA_def_property_range(prop, -1000.f, 1000.f);
 	RNA_def_property_ui_text(prop, "Maximum", "Maximum value for target channel range");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 	RNA_def_property_float_funcs(prop, NULL, NULL, "rna_ActionConstraint_minmax_range");
 
-	prop= RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "min");
 	RNA_def_property_range(prop, -1000.f, 1000.f);
 	RNA_def_property_ui_text(prop, "Minimum", "Minimum value for target channel range");
@@ -1111,34 +1147,35 @@ static void rna_def_constraint_locked_track(BlenderRNA *brna)
 		{TRACK_Z, "LOCK_Z", 0, "Z", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "LockedTrackConstraint", "Constraint");
-	RNA_def_struct_ui_text(srna, "Locked Track Constraint", "Point toward the target along the track axis, while locking the other axis");
+	srna = RNA_def_struct(brna, "LockedTrackConstraint", "Constraint");
+	RNA_def_struct_ui_text(srna, "Locked Track Constraint",
+	                       "Point toward the target along the track axis, while locking the other axis");
 	
-	prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
 	RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 	
 	RNA_def_struct_sdna_from(srna, "bLockTrackConstraint", "data");
 
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "tar");
 	RNA_def_property_ui_text(prop, "Target", "Target Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "subtarget");
 	RNA_def_property_ui_text(prop, "Sub-Target", "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "trackflag");
 	RNA_def_property_enum_items(prop, locktrack_items);
 	RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "lock_axis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "lockflag");
 	RNA_def_property_enum_items(prop, lock_items);
 	RNA_def_property_ui_text(prop, "Locked Axis", "Axis that points upward");
@@ -1165,51 +1202,53 @@ static void rna_def_constraint_follow_path(BlenderRNA *brna)
 		{TRACK_Z, "UP_Z", 0, "Z", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "FollowPathConstraint", "Constraint");
+	srna = RNA_def_struct(brna, "FollowPathConstraint", "Constraint");
 	RNA_def_struct_ui_text(srna, "Follow Path Constraint", "Lock motion to the target path");
 	RNA_def_struct_sdna_from(srna, "bFollowPathConstraint", "data");
 
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "tar");
 	RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Curve_object_poll");
 	RNA_def_property_ui_text(prop, "Target", "Target Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TIME);
+	prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TIME);
 	RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
 	RNA_def_property_ui_text(prop, "Offset", "Offset from the position corresponding to the time frame");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 	
-	prop= RNA_def_property(srna, "offset_factor", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "offset_factor", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "offset_fac");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Offset Factor", "Percentage value defining target position along length of bone");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "forward_axis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "forward_axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "trackflag");
 	RNA_def_property_enum_items(prop, forwardpath_items);
 	RNA_def_property_ui_text(prop, "Forward Axis", "Axis that points forward along the path");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "upflag");
 	RNA_def_property_enum_items(prop, pathup_items);
 	RNA_def_property_ui_text(prop, "Up Axis", "Axis that points upward");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_curve_follow", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_curve_follow", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "followflag", FOLLOWPATH_FOLLOW);
 	RNA_def_property_ui_text(prop, "Follow Curve", "Object will follow the heading and banking of the curve");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 	
-	prop= RNA_def_property(srna, "use_fixed_location", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_fixed_location", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "followflag", FOLLOWPATH_STATIC);
-	RNA_def_property_ui_text(prop, "Fixed Position", "Object will stay locked to a single point somewhere along the length of the curve regardless of time");
+	RNA_def_property_ui_text(prop, "Fixed Position",
+	                         "Object will stay locked to a single point somewhere along the length of the curve "
+	                         "regardless of time");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "followflag", FOLLOWPATH_RADIUS);
 	RNA_def_property_ui_text(prop, "Curve Radius", "Object is scaled by the curve radius");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
@@ -1232,46 +1271,46 @@ static void rna_def_constraint_stretch_to(BlenderRNA *brna)
 		{PLANE_Z, "PLANE_Z", 0, "Z", "Keep Z Axis"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "StretchToConstraint", "Constraint");
+	srna = RNA_def_struct(brna, "StretchToConstraint", "Constraint");
 	RNA_def_struct_ui_text(srna, "Stretch To Constraint", "Stretch to meet the target object");
 
-	prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
 	RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
 	RNA_def_struct_sdna_from(srna, "bStretchToConstraint", "data");
 
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "tar");
 	RNA_def_property_ui_text(prop, "Target", "Target Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 	
-	prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "subtarget");
 	RNA_def_property_ui_text(prop, "Sub-Target", "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "volume", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "volume", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "volmode");
 	RNA_def_property_enum_items(prop, volume_items);
 	RNA_def_property_ui_text(prop, "Maintain Volume", "Maintain the object's volume as it stretches");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "keep_axis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "keep_axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "plane");
 	RNA_def_property_enum_items(prop, plane_items);
 	RNA_def_property_ui_text(prop, "Keep Axis", "Axis to maintain during stretch");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "orglength");
 	RNA_def_property_range(prop, 0.0, 100.f);
 	RNA_def_property_ui_text(prop, "Original Length", "Length at rest position");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "bulge", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "bulge", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0, 100.f);
 	RNA_def_property_ui_text(prop, "Volume Variation", "Factor between volume variation and stretching");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
@@ -1285,73 +1324,75 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna)
 	static EnumPropertyItem pivot_items[] = {
 		{CONSTRAINT_RB_BALL, "BALL", 0, "Ball", "Allow rotations around all axes"},
 		{CONSTRAINT_RB_HINGE, "HINGE", 0, "Hinge", "Work in one plane, allow rotations around one axis only"},
-		{CONSTRAINT_RB_CONETWIST, "CONE_TWIST", 0, "Cone Twist", "Allow rotations around all axes with limits for the cone and twist axes"},
-		{CONSTRAINT_RB_GENERIC6DOF, "GENERIC_6_DOF", 0, "Generic 6 DoF", "No constraints by default, limits can be set individually"},
+		{CONSTRAINT_RB_CONETWIST, "CONE_TWIST", 0, "Cone Twist",
+		                          "Allow rotations around all axes with limits for the cone and twist axes"},
+		{CONSTRAINT_RB_GENERIC6DOF, "GENERIC_6_DOF", 0, "Generic 6 DoF",
+		                            "No constraints by default, limits can be set individually"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "RigidBodyJointConstraint", "Constraint");
+	srna = RNA_def_struct(brna, "RigidBodyJointConstraint", "Constraint");
 	RNA_def_struct_ui_text(srna, "Rigid Body Joint Constraint", "For use with the Game Engine");
 	RNA_def_struct_sdna_from(srna, "bRigidBodyJointConstraint", "data");
 
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "tar");
 	RNA_def_property_ui_text(prop, "Target", "Target Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "child", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "child", PROP_POINTER, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Child Object", "Child object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "pivot_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "pivot_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, pivot_items);
 	RNA_def_property_ui_text(prop, "Pivot Type", "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "pivot_x", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "pivot_x", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "pivX");
 	RNA_def_property_range(prop, -1000.0, 1000.f);
 	RNA_def_property_ui_text(prop, "Pivot X", "Offset pivot on X");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "pivot_y", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "pivot_y", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "pivY");
 	RNA_def_property_range(prop, -1000.0, 1000.f);
 	RNA_def_property_ui_text(prop, "Pivot Y", "Offset pivot on Y");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "pivot_z", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "pivot_z", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "pivZ");
 	RNA_def_property_range(prop, -1000.0, 1000.f);
 	RNA_def_property_ui_text(prop, "Pivot Z", "Offset pivot on Z");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "axis_x", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "axis_x", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "axX");
 	RNA_def_property_range(prop, -M_PI*2, M_PI*2);
 	RNA_def_property_ui_text(prop, "Axis X", "Rotate pivot on X axis in degrees");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "axis_y", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "axis_y", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "axY");
 	RNA_def_property_range(prop, -M_PI*2, M_PI*2);
 	RNA_def_property_ui_text(prop, "Axis Y", "Rotate pivot on Y axis in degrees");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "axis_z", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "axis_z", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "axZ");
 	RNA_def_property_range(prop, -M_PI*2, M_PI*2);
 	RNA_def_property_ui_text(prop, "Axis Z", "Rotate pivot on Z axis in degrees");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_linked_collision", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_linked_collision", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_DISABLE_LINKED_COLLISION);
 	RNA_def_property_ui_text(prop, "Disable Linked Collision", "Disable collision between linked bodies");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "show_pivot", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_pivot", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_DRAW_PIVOT);
 	RNA_def_property_ui_text(prop, "Draw Pivot", "Display the pivot point and rotation in 3D view");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
@@ -1359,88 +1400,88 @@ static void rna_def_constraint_rigid_body_joint(BlenderRNA *brna)
 	
 	/* Limits */
 	/* Limit Min/Max */
-	prop= RNA_def_property(srna, "limit_min_x", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "limit_min_x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "minLimit[0]");
 	RNA_def_property_ui_text(prop, "Minimum Limit X", "");
 
-	prop= RNA_def_property(srna, "limit_min_y", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "limit_min_y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "minLimit[1]");
 	RNA_def_property_ui_text(prop, "Minimum Limit Y", "");
 
-	prop= RNA_def_property(srna, "limit_min_z", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "limit_min_z", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "minLimit[2]");
 	RNA_def_property_ui_text(prop, "Minimum Limit Z", "");
 
-	prop= RNA_def_property(srna, "limit_max_x", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "limit_max_x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "maxLimit[0]");
 	RNA_def_property_ui_text(prop, "Maximum Limit X", "");
 
-	prop= RNA_def_property(srna, "limit_max_y", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "limit_max_y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "maxLimit[1]");
 	RNA_def_property_ui_text(prop, "Maximum Limit Y", "");
 
-	prop= RNA_def_property(srna, "limit_max_z", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "limit_max_z", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "maxLimit[2]");
 	RNA_def_property_ui_text(prop, "Maximum Limit Z", "");
 
 	/* Limit Min/Max for angle */
-	prop= RNA_def_property(srna, "limit_angle_min_x", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "limit_angle_min_x", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "minLimit[3]");
 	RNA_def_property_range(prop, -M_PI*2, M_PI*2);
 	RNA_def_property_ui_text(prop, "Minimum Angular Limit X", "");
 
-	prop= RNA_def_property(srna, "limit_angle_min_y", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "limit_angle_min_y", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "minLimit[4]");
 	RNA_def_property_range(prop, -M_PI*2, M_PI*2);
 	RNA_def_property_ui_text(prop, "Minimum Angular Limit Y", "");
 
-	prop= RNA_def_property(srna, "limit_angle_min_z", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "limit_angle_min_z", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "minLimit[5]");
 	RNA_def_property_range(prop, -M_PI*2, M_PI*2);
 	RNA_def_property_ui_text(prop, "Minimum Angular Limit Z", "");
 
-	prop= RNA_def_property(srna, "limit_angle_max_x", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "limit_angle_max_x", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "maxLimit[3]");
 	RNA_def_property_range(prop, -M_PI*2, M_PI*2);
 	RNA_def_property_ui_text(prop, "Maximum Angular Limit X", "");
 	
-	prop= RNA_def_property(srna, "limit_angle_max_y", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "limit_angle_max_y", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "maxLimit[4]");
 	RNA_def_property_range(prop, -M_PI*2, M_PI*2);
 	RNA_def_property_ui_text(prop, "Maximum Angular Limit Y", "");
 
-	prop= RNA_def_property(srna, "limit_angle_max_z", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "limit_angle_max_z", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "maxLimit[5]");
 	RNA_def_property_range(prop, -M_PI*2, M_PI*2);
 	RNA_def_property_ui_text(prop, "Maximum Angular Limit Z", "");
 
 	/* Limit Booleans */
-	prop= RNA_def_property(srna, "use_limit_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_limit_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", 1);
 	RNA_def_property_ui_text(prop, "Limit X", "Use minimum/maximum X limit");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 	
-	prop= RNA_def_property(srna, "use_limit_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_limit_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", 2);
 	RNA_def_property_ui_text(prop, "Limit Y", "Use minimum/maximum y limit");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 	
-	prop= RNA_def_property(srna, "use_limit_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_limit_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", 4);
 	RNA_def_property_ui_text(prop, "Limit Z", "Use minimum/maximum z limit");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_angular_limit_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_angular_limit_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", 8);
 	RNA_def_property_ui_text(prop, "Angular X Limit", "Use minimum/maximum X angular limit");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 	
-	prop= RNA_def_property(srna, "use_angular_limit_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_angular_limit_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", 16);
 	RNA_def_property_ui_text(prop, "Angular Y Limit", "Use minimum/maximum Y angular limit");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 	
-	prop= RNA_def_property(srna, "use_angular_limit_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_angular_limit_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", 32);
 	RNA_def_property_ui_text(prop, "Angular Z Limit", "Use minimum/maximum Z angular limit");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
@@ -1458,24 +1499,25 @@ static void rna_def_constraint_clamp_to(BlenderRNA *brna)
 		{CLAMPTO_Z, "CLAMPTO_Z", 0, "Z", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "ClampToConstraint", "Constraint");
-	RNA_def_struct_ui_text(srna, "Clamp To Constraint", "Constrains an object's location to the nearest point along the target path");
+	srna = RNA_def_struct(brna, "ClampToConstraint", "Constraint");
+	RNA_def_struct_ui_text(srna, "Clamp To Constraint",
+	                       "Constrain an object's location to the nearest point along the target path");
 	RNA_def_struct_sdna_from(srna, "bClampToConstraint", "data");
 
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "tar");
 	RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Curve_object_poll");
 	RNA_def_property_ui_text(prop, "Target", "Target Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "main_axis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "main_axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, clamp_items);
 	RNA_def_property_ui_text(prop, "Main Axis", "Main axis of movement");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag2", CLAMPTO_CYCLIC);
 	RNA_def_property_ui_text(prop, "Cyclic", "Treat curve as cyclic curve (no clamping to curve bounding box)");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
@@ -1498,123 +1540,123 @@ static void rna_def_constraint_transform(BlenderRNA *brna)
 		{2, "Z", 0, "Z", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "TransformConstraint", "Constraint");
-	RNA_def_struct_ui_text(srna, "Transformation Constraint", "Maps transformations of the target to the object");
+	srna = RNA_def_struct(brna, "TransformConstraint", "Constraint");
+	RNA_def_struct_ui_text(srna, "Transformation Constraint", "Map transformations of the target to the object");
 	RNA_def_struct_sdna_from(srna, "bTransformConstraint", "data");
 
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "tar");
 	RNA_def_property_ui_text(prop, "Target", "Target Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "subtarget");
 	RNA_def_property_ui_text(prop, "Sub-Target", "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "map_from", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "map_from", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "from");
 	RNA_def_property_enum_items(prop, transform_items);
 	RNA_def_property_ui_text(prop, "Map From", "The transformation type to use from the target");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "map_to", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "map_to", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "to");
 	RNA_def_property_enum_items(prop, transform_items);
 	RNA_def_property_ui_text(prop, "Map To", "The transformation type to affect of the constrained object");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "map_to_x_from", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "map_to_x_from", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "map[0]");
 	RNA_def_property_enum_items(prop, axis_map_items);
 	RNA_def_property_ui_text(prop, "Map To X From", "The source axis constrained object's X axis uses");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "map_to_y_from", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "map_to_y_from", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "map[1]");
 	RNA_def_property_enum_items(prop, axis_map_items);
 	RNA_def_property_ui_text(prop, "Map To Y From", "The source axis constrained object's Y axis uses");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "map_to_z_from", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "map_to_z_from", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "map[2]");
 	RNA_def_property_enum_items(prop, axis_map_items);
 	RNA_def_property_ui_text(prop, "Map To Z From", "The source axis constrained object's Z axis uses");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_motion_extrapolate", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_motion_extrapolate", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "expo", CLAMPTO_CYCLIC);
 	RNA_def_property_ui_text(prop, "Extrapolate Motion", "Extrapolate ranges");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "from_min_x", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "from_min_x", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "from_min[0]");
 	RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
 	RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "from_min_y", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "from_min_y", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "from_min[1]");
 	RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
 	RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "from_min_z", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "from_min_z", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "from_min[2]");
 	RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
 	RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "from_max_x", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "from_max_x", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "from_max[0]");
 	RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
 	RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "from_max_y", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "from_max_y", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "from_max[1]");
 	RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
 	RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "from_max_z", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "from_max_z", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "from_max[2]");
 	RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
 	RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "to_min_x", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "to_min_x", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "to_min[0]");
 	RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
 	RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "to_min_y", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "to_min_y", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "to_min[1]");
 	RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
 	RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "to_min_z", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "to_min_z", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "to_min[2]");
 	RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
 	RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "to_max_x", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "to_max_x", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "to_max[0]");
 	RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
 	RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "to_max_y", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "to_max_y", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "to_max[1]");
 	RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
 	RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "to_max_z", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "to_max_z", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "to_max[2]");
 	RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
 	RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion");
@@ -1626,77 +1668,77 @@ static void rna_def_constraint_location_limit(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "LimitLocationConstraint", "Constraint");
+	srna = RNA_def_struct(brna, "LimitLocationConstraint", "Constraint");
 	RNA_def_struct_ui_text(srna, "Limit Location Constraint", "Limit the location of the constrained object");
 	RNA_def_struct_sdna_from(srna, "bLocLimitConstraint", "data");
 
-	prop= RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMIN);
 	RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMIN);
 	RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_min_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_min_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMIN);
 	RNA_def_property_ui_text(prop, "Minimum Z", "Use the minimum Z value");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMAX);
 	RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMAX);
 	RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_max_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_max_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMAX);
 	RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "xmin");
 	RNA_def_property_range(prop, -1000.0, 1000.f);
 	RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "ymin");
 	RNA_def_property_range(prop, -1000.0, 1000.f);
 	RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "zmin");
 	RNA_def_property_range(prop, -1000.0, 1000.f);
 	RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "xmax");
 	RNA_def_property_range(prop, -1000.0, 1000.f);
 	RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "ymax");
 	RNA_def_property_range(prop, -1000.0, 1000.f);
 	RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "zmax");
 	RNA_def_property_range(prop, -1000.0, 1000.f);
 	RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag2", LIMIT_TRANSFORM);
 	RNA_def_property_ui_text(prop, "For Transform", "Transforms are affected by this constraint as well");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
@@ -1707,62 +1749,62 @@ static void rna_def_constraint_rotation_limit(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "LimitRotationConstraint", "Constraint");
+	srna = RNA_def_struct(brna, "LimitRotationConstraint", "Constraint");
 	RNA_def_struct_ui_text(srna, "Limit Rotation Constraint", "Limit the rotation of the constrained object");
 	RNA_def_struct_sdna_from(srna, "bRotLimitConstraint", "data");
 
-	prop= RNA_def_property(srna, "use_limit_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_limit_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XROT);
 	RNA_def_property_ui_text(prop, "Limit X", "Use the minimum X value");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_limit_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_limit_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YROT);
 	RNA_def_property_ui_text(prop, "Limit Y", "Use the minimum Y value");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_limit_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_limit_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZROT);
 	RNA_def_property_ui_text(prop, "Limit Z", "Use the minimum Z value");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "xmin");
 	RNA_def_property_range(prop, -1000.0, 1000.f);
 	RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "ymin");
 	RNA_def_property_range(prop, -1000.0, 1000.f);
 	RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "zmin");
 	RNA_def_property_range(prop, -1000.0, 1000.f);
 	RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "xmax");
 	RNA_def_property_range(prop, -1000.0, 1000.f);
 	RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "ymax");
 	RNA_def_property_range(prop, -1000.0, 1000.f);
 	RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "zmax");
 	RNA_def_property_range(prop, -1000.0, 1000.f);
 	RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag2", LIMIT_TRANSFORM);
 	RNA_def_property_ui_text(prop, "For Transform", "Transforms are affected by this constraint as well");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
@@ -1773,77 +1815,77 @@ static void rna_def_constraint_size_limit(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "LimitScaleConstraint", "Constraint");
+	srna = RNA_def_struct(brna, "LimitScaleConstraint", "Constraint");
 	RNA_def_struct_ui_text(srna, "Limit Size Constraint", "Limit the scaling of the constrained object");
 	RNA_def_struct_sdna_from(srna, "bSizeLimitConstraint", "data");
 
-	prop= RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMIN);
 	RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMIN);
 	RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_min_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_min_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMIN);
 	RNA_def_property_ui_text(prop, "Minimum Z", "Use the minimum Z value");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMAX);
 	RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMAX);
 	RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_max_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_max_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMAX);
 	RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "xmin");
 	RNA_def_property_range(prop, -1000.0, 1000.f);
 	RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "ymin");
 	RNA_def_property_range(prop, -1000.0, 1000.f);
 	RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "zmin");
 	RNA_def_property_range(prop, -1000.0, 1000.f);
 	RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "xmax");
 	RNA_def_property_range(prop, -1000.0, 1000.f);
 	RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "ymax");
 	RNA_def_property_range(prop, -1000.0, 1000.f);
 	RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "zmax");
 	RNA_def_property_range(prop, -1000.0, 1000.f);
 	RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag2", LIMIT_TRANSFORM);
 	RNA_def_property_ui_text(prop, "For Transform", "Transforms are affected by this constraint as well");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
@@ -1854,40 +1896,40 @@ static void rna_def_constraint_distance_limit(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "LimitDistanceConstraint", "Constraint");
+	srna = RNA_def_struct(brna, "LimitDistanceConstraint", "Constraint");
 	RNA_def_struct_ui_text(srna, "Limit Distance Constraint", "Limit the distance from target object");
 	
-	prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
 	RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 	
 	RNA_def_struct_sdna_from(srna, "bDistLimitConstraint", "data");
 
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "tar");
 	RNA_def_property_ui_text(prop, "Target", "Target Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "subtarget");
 	RNA_def_property_ui_text(prop, "Sub-Target", "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "dist");
 	RNA_def_property_range(prop, 0.0, 100.f);
 	RNA_def_property_ui_text(prop, "Distance", "Radius of limiting sphere");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
-	prop= RNA_def_property(srna, "limit_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "limit_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "mode");
 	RNA_def_property_enum_items(prop, constraint_distance_items);
 	RNA_def_property_ui_text(prop, "Limit Mode", "Distances in relation to sphere of influence to allow");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 	
-	prop= RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMITDIST_TRANSFORM);
 	RNA_def_property_ui_text(prop, "For Transform", "Transforms are affected by this constraint as well");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
@@ -1899,45 +1941,48 @@ static void rna_def_constraint_shrinkwrap(BlenderRNA *brna)
 	PropertyRNA *prop;
 	
 	static EnumPropertyItem type_items[] = {
-		{MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACE", 0, "Nearest Surface Point", "Shrink the location to the nearest target surface"},
-		{MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project", "Shrink the location to the nearest target surface along a given axis"},
-		{MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex", "Shrink the location to the nearest target vertex"},
+		{MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACE", 0, "Nearest Surface Point",
+		                                 "Shrink the location to the nearest target surface"},
+		{MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project",
+		                         "Shrink the location to the nearest target surface along a given axis"},
+		{MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex",
+		                                "Shrink the location to the nearest target vertex"},
 		{0, NULL, 0, NULL, NULL}};
 	
-	srna= RNA_def_struct(brna, "ShrinkwrapConstraint", "Constraint"); 
-	RNA_def_struct_ui_text(srna, "Shrinkwrap Constraint", "Create constraint-based shrinkwrap relationship"); 
+	srna = RNA_def_struct(brna, "ShrinkwrapConstraint", "Constraint");
+	RNA_def_struct_ui_text(srna, "Shrinkwrap Constraint", "Create constraint-based shrinkwrap relationship");
 	RNA_def_struct_sdna_from(srna, "bShrinkwrapConstraint", "data");
 	
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "target"); /* TODO, mesh type */
 	RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Mesh_object_poll");
 	RNA_def_property_ui_text(prop, "Target", "Target Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 	
-	prop= RNA_def_property(srna, "shrinkwrap_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "shrinkwrap_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "shrinkType");
 	RNA_def_property_enum_items(prop, type_items);
 	RNA_def_property_ui_text(prop, "Shrinkwrap Type", "Select type of shrinkwrap algorithm for target position");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 	
-	prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "dist");
 	RNA_def_property_range(prop, 0.0, 100.f);
 	RNA_def_property_ui_text(prop, "Distance", "Distance to Target");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 	
-	prop= RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_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, "Axis X", "Projection over X Axis");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 	
-	prop= RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS);
 	RNA_def_property_ui_text(prop, "Axis Y", "Projection over Y Axis");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 	
-	prop= RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS);
 	RNA_def_property_ui_text(prop, "Axis Z", "Projection over Z Axis");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
@@ -1957,28 +2002,29 @@ static void rna_def_constraint_damped_track(BlenderRNA *brna)
 		{TRACK_nZ, "TRACK_NEGATIVE_Z", 0, "-Z", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "DampedTrackConstraint", "Constraint");
-	RNA_def_struct_ui_text(srna, "Damped Track Constraint", "Point toward target by taking the shortest rotation path");
+	srna = RNA_def_struct(brna, "DampedTrackConstraint", "Constraint");
+	RNA_def_struct_ui_text(srna, "Damped Track Constraint",
+	                       "Point toward target by taking the shortest rotation path");
 	
-	prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
 	RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 	
 	RNA_def_struct_sdna_from(srna, "bDampTrackConstraint", "data");
 
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "tar");
 	RNA_def_property_ui_text(prop, "Target", "Target Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "subtarget");
 	RNA_def_property_ui_text(prop, "Sub-Target", "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
-	prop= RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "trackflag");
 	RNA_def_property_enum_items(prop, damptrack_items);
 	RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
@@ -1992,62 +2038,73 @@ static void rna_def_constraint_spline_ik(BlenderRNA *brna)
 	
 	static EnumPropertyItem splineik_xz_scale_mode[] = {
 		{CONSTRAINT_SPLINEIK_XZS_NONE, "NONE", 0, "None", "Don't scale the X and Z axes (Default)"},
-		{CONSTRAINT_SPLINEIK_XZS_ORIGINAL, "BONE_ORIGINAL", 0, "Bone Original", "Use the original scaling of the bones"},
-		{CONSTRAINT_SPLINEIK_XZS_VOLUMETRIC, "VOLUME_PRESERVE", 0, "Volume Preservation", "Scale of the X and Z axes is the inverse of the Y-Scale"},
+		{CONSTRAINT_SPLINEIK_XZS_ORIGINAL, "BONE_ORIGINAL", 0, "Bone Original",
+		                                   "Use the original scaling of the bones"},
+		{CONSTRAINT_SPLINEIK_XZS_VOLUMETRIC, "VOLUME_PRESERVE", 0, "Volume Preservation",
+		                                     "Scale of the X and Z axes is the inverse of the Y-Scale"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "SplineIKConstraint", "Constraint");
+	srna = RNA_def_struct(brna, "SplineIKConstraint", "Constraint");
 	RNA_def_struct_ui_text(srna, "Spline IK Constraint", "Align 'n' bones along a curve");
 	RNA_def_struct_sdna_from(srna, "bSplineIKConstraint", "data");
 	
 	/* target chain */
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "tar");
 	RNA_def_property_ui_text(prop, "Target", "Curve that controls this relationship");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 	
-	prop= RNA_def_property(srna, "chain_count", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "chain_count", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "chainlen");
-	RNA_def_property_range(prop, 1, 255); // TODO: this should really check the max length of the chain the constraint is attached to
+		/* TODO: this should really check the max length of the chain the constraint is attached to */
+	RNA_def_property_range(prop, 1, 255);
 	RNA_def_property_ui_text(prop, "Chain Length", "How many bones are included in the chain");
-	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update"); // XXX: this update goes wrong... needs extra flush?
+		/* XXX: this update goes wrong... needs extra flush? */
+	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 	
 	/* direct access to bindings */
-	// NOTE: only to be used by experienced users
-	prop= RNA_def_property(srna, "joint_bindings", PROP_FLOAT, PROP_FACTOR);
-	RNA_def_property_array(prop, 32); // XXX this is the maximum value allowed - why? 
+	/* NOTE: only to be used by experienced users */
+	prop = RNA_def_property(srna, "joint_bindings", PROP_FLOAT, PROP_FACTOR);
+	RNA_def_property_array(prop, 32); /* XXX this is the maximum value allowed - why?  */
 	RNA_def_property_flag(prop, PROP_DYNAMIC);
 	RNA_def_property_dynamic_array_funcs(prop, "rna_SplineIKConstraint_joint_bindings_get_length");
-	RNA_def_property_float_funcs(prop, "rna_SplineIKConstraint_joint_bindings_get", "rna_SplineIKConstraint_joint_bindings_set", NULL);
-	RNA_def_property_ui_text(prop, "Joint Bindings", "(EXPERIENCED USERS ONLY) The relative positions of the joints along the chain as percentages");
+	RNA_def_property_float_funcs(prop, "rna_SplineIKConstraint_joint_bindings_get",
+	                             "rna_SplineIKConstraint_joint_bindings_set", NULL);
+	RNA_def_property_ui_text(prop, "Joint Bindings",
+	                         "(EXPERIENCED USERS ONLY) The relative positions of the joints along the chain, "
+	                         "as percentages");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 	
 	/* settings */
-	prop= RNA_def_property(srna, "use_chain_offset", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_chain_offset", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_NO_ROOT);
 	RNA_def_property_ui_text(prop, "Chain Offset", "Offset the entire chain relative to the root joint");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 	
-	prop= RNA_def_property(srna, "use_even_divisions", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_even_divisions", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_EVENSPLITS);
-	RNA_def_property_ui_text(prop, "Even Divisions", "Ignore the relative lengths of the bones when fitting to the curve");
+	RNA_def_property_ui_text(prop, "Even Divisions",
+	                         "Ignore the relative lengths of the bones when fitting to the curve");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 	
-	prop= RNA_def_property(srna, "use_y_stretch", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_y_stretch", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_SCALE_LIMITED);
 	RNA_def_property_ui_text(prop, "Y Stretch", "Stretch the Y axis of the bones to fit the curve");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 	
-	prop= RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_NO_CURVERAD);
-	RNA_def_property_ui_text(prop, "Use Curve Radius", "Average radius of the endpoints is used to tweak the X and Z Scaling of the bones, on top of XZ Scale mode");
+	RNA_def_property_ui_text(prop, "Use Curve Radius",
+	                         "Average radius of the endpoints is used to tweak the X and Z Scaling of the bones, "
+	                         "on top of XZ Scale mode");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 	
-	prop= RNA_def_property(srna, "xz_scale_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "xz_scale_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "xzScaleMode");
 	RNA_def_property_enum_items(prop, splineik_xz_scale_mode);
-	RNA_def_property_ui_text(prop, "XZ Scale Mode", "Method used for determining the scaling of the X and Z axes of the bones");
+	RNA_def_property_ui_text(prop, "XZ Scale Mode",
+	                         "Method used for determining the scaling of the X and Z axes of the bones");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 }
 
@@ -2058,18 +2115,21 @@ static void rna_def_constraint_pivot(BlenderRNA *brna)
 
 	static EnumPropertyItem pivot_rotAxis_items[] = {
 		{PIVOTCON_AXIS_NONE, "ALWAYS_ACTIVE", 0, "Always", "Use the pivot point in every rotation"},
-		{PIVOTCON_AXIS_X_NEG, "NX", 0, "-X Rot", "Use the pivot point in the negative rotation range around the X-axis"},
-		{PIVOTCON_AXIS_Y_NEG, "NY", 0, "-Y Rot", "Use the pivot point in the negative rotation range around the Y-axis"},
-		{PIVOTCON_AXIS_Z_NEG, "NZ", 0, "-Z Rot", "Use the pivot point in the negative rotation range around the Z-axis"},
+		{PIVOTCON_AXIS_X_NEG, "NX", 0, "-X Rot",
+		                      "Use the pivot point in the negative rotation range around the X-axis"},
+		{PIVOTCON_AXIS_Y_NEG, "NY", 0, "-Y Rot",
+		                      "Use the pivot point in the negative rotation range around the Y-axis"},
+		{PIVOTCON_AXIS_Z_NEG, "NZ", 0, "-Z Rot",
+		                      "Use the pivot point in the negative rotation range around the Z-axis"},
 		{PIVOTCON_AXIS_X, "X", 0, "X Rot", "Use the pivot point in the positive rotation range around the X-axis"},
 		{PIVOTCON_AXIS_Y, "Y", 0, "Y Rot", "Use the pivot point in the positive rotation range around the Y-axis"},
 		{PIVOTCON_AXIS_Z, "Z", 0, "Z Rot", "Use the pivot point in the positive rotation range around the Z-axis"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "PivotConstraint", "Constraint");
+	srna = RNA_def_struct(brna, "PivotConstraint", "Constraint");
 	RNA_def_struct_ui_text(srna, "Pivot Constraint", "Rotate around a different point");
 	
-	prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
 	RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
@@ -2077,30 +2137,33 @@ static void rna_def_constraint_pivot(BlenderRNA *brna)
 	RNA_def_struct_sdna_from(srna, "bPivotConstraint", "data");
 	
 	/* target-defined pivot */
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "tar");
 	RNA_def_property_ui_text(prop, "Target", "Target Object, defining the position of the pivot when defined");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 	
-	prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "subtarget");
 	RNA_def_property_ui_text(prop, "Sub-Target", "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 	
 	/* pivot offset */
-	prop= RNA_def_property(srna, "use_relative_location", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_relative_location", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PIVOTCON_FLAG_OFFSET_ABS);
-	RNA_def_property_ui_text(prop, "Use Relative Offset", "Offset will be an absolute point in space instead of relative to the target");
+	RNA_def_property_ui_text(prop, "Use Relative Offset",
+	                         "Offset will be an absolute point in space instead of relative to the target");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 	
-	prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "offset");
-	RNA_def_property_ui_text(prop, "Offset", "Offset of pivot from target (when set), or from owner's location (when Fixed Position is off), or the absolute pivot point");
+	RNA_def_property_ui_text(prop, "Offset",
+	                         "Offset of pivot from target (when set), or from owner's location "
+	                         "(when Fixed Position is off), or the absolute pivot point");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 	
 	/* rotation-based activation */
-	prop= RNA_def_property(srna, "rotation_range", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "rotation_range", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "rotAxis");
 	RNA_def_property_enum_items(prop, pivot_rotAxis_items);
 	RNA_def_property_ui_text(prop, "Enabled Rotation Range", "Rotation range on which pivoting should occur");
@@ -2112,56 +2175,60 @@ static void rna_def_constraint_follow_track(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "FollowTrackConstraint", "Constraint");
+	srna = RNA_def_struct(brna, "FollowTrackConstraint", "Constraint");
 	RNA_def_struct_ui_text(srna, "Follow Track Constraint", "Lock motion to the target motion track");
 	RNA_def_struct_sdna_from(srna, "bFollowTrackConstraint", "data");
 
 	/* movie clip */
-	prop= RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "clip");
 	RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
 	/* track */
-	prop= RNA_def_property(srna, "track", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "track", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "track");
 	RNA_def_property_ui_text(prop, "Track", "Movie tracking track to follow");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
 	/* use default clip */
-	prop= RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", FOLLOWTRACK_ACTIVECLIP);
 	RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
 	/* use 3d position */
-	prop= RNA_def_property(srna, "use_3d_position", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_3d_position", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", FOLLOWTRACK_USE_3D_POSITION);
 	RNA_def_property_ui_text(prop, "3D Position", "Use 3D position of track to parent to");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
 	/* object */
-	prop= RNA_def_property(srna, "object", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "object");
 	RNA_def_property_ui_text(prop, "Object", "Movie tracking object to follow (if empty, camera object is used)");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
 	/* camera */
-	prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "camera");
-	RNA_def_property_ui_text(prop, "Camera", "Camera to which motion is parented (if empty active scene camera is used)");
+	RNA_def_property_ui_text(prop, "Camera",
+	                         "Camera to which motion is parented (if empty active scene camera is used)");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
-	RNA_def_property_pointer_funcs(prop, NULL, "rna_Constraint_followTrack_camera_set", NULL, "rna_Constraint_cameraObject_poll");
+	RNA_def_property_pointer_funcs(prop, NULL, "rna_Constraint_followTrack_camera_set", NULL,
+	                               "rna_Constraint_cameraObject_poll");
 
 	/* depth object */
-	prop= RNA_def_property(srna, "depth_object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "depth_object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "depth_ob");
-	RNA_def_property_ui_text(prop, "Depth Object", "Object used to define depth in camera space by projecting onto surface of this object");
+	RNA_def_property_ui_text(prop, "Depth Object",
+	                         "Object used to define depth in camera space by projecting onto surface of this object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
-	RNA_def_property_pointer_funcs(prop, NULL, "rna_Constraint_followTrack_depthObject_set", NULL, "rna_Constraint_followTrack_depthObject_poll");
+	RNA_def_property_pointer_funcs(prop, NULL, "rna_Constraint_followTrack_depthObject_set", NULL,
+	                               "rna_Constraint_followTrack_depthObject_poll");
 }
 
 static void rna_def_constraint_camera_solver(BlenderRNA *brna)
@@ -2169,19 +2236,19 @@ static void rna_def_constraint_camera_solver(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "CameraSolverConstraint", "Constraint");
+	srna = RNA_def_struct(brna, "CameraSolverConstraint", "Constraint");
 	RNA_def_struct_ui_text(srna, "Camera Solver Constraint", "Lock motion to the reconstructed camera movement");
 	RNA_def_struct_sdna_from(srna, "bCameraSolverConstraint", "data");
 
 	/* movie clip */
-	prop= RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "clip");
 	RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
 	/* use default clip */
-	prop= RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CAMERASOLVER_ACTIVECLIP);
 	RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
@@ -2192,36 +2259,38 @@ static void rna_def_constraint_object_solver(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "ObjectSolverConstraint", "Constraint");
+	srna = RNA_def_struct(brna, "ObjectSolverConstraint", "Constraint");
 	RNA_def_struct_ui_text(srna, "Object Solver Constraint", "Lock motion to the reconstructed object movement");
 	RNA_def_struct_sdna_from(srna, "bObjectSolverConstraint", "data");
 
 	/* movie clip */
-	prop= RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "clip");
 	RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
 	/* use default clip */
-	prop= RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CAMERASOLVER_ACTIVECLIP);
 	RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
 
 	/* object */
-	prop= RNA_def_property(srna, "object", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "object");
 	RNA_def_property_ui_text(prop, "Object", "Movie tracking object to follow");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
 
 	/* camera */
-	prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "camera");
-	RNA_def_property_ui_text(prop, "Camera", "Camera to which motion is parented (if empty active scene camera is used)");
+	RNA_def_property_ui_text(prop, "Camera",
+	                         "Camera to which motion is parented (if empty active scene camera is used)");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
-	RNA_def_property_pointer_funcs(prop, NULL, "rna_Constraint_objectSolver_camera_set", NULL, "rna_Constraint_cameraObject_poll");
+	RNA_def_property_pointer_funcs(prop, NULL, "rna_Constraint_objectSolver_camera_set", NULL,
+	                               "rna_Constraint_cameraObject_poll");
 }
 
 /* base struct for constraints */
@@ -2231,80 +2300,83 @@ void RNA_def_constraint(BlenderRNA *brna)
 	PropertyRNA *prop;
 	
 	/* data */
-	srna= RNA_def_struct(brna, "Constraint", NULL );
+	srna = RNA_def_struct(brna, "Constraint", NULL );
 	RNA_def_struct_ui_text(srna, "Constraint", "Constraint modifying the transformation of objects and bones");
 	RNA_def_struct_refine_func(srna, "rna_ConstraintType_refine");
 	RNA_def_struct_path_func(srna, "rna_Constraint_path");
 	RNA_def_struct_sdna(srna, "bConstraint");
 	
 	/* strings */
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Constraint_name_set");
 	RNA_def_property_ui_text(prop, "Name", "Constraint name");
 	RNA_def_struct_name_property(srna, prop);
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT|NA_RENAME, NULL);
 	
 	/* enums */
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, constraint_type_items);
 	RNA_def_property_ui_text(prop, "Type", "");
 
-	prop= RNA_def_property(srna, "owner_space", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "owner_space", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "ownspace");
 	RNA_def_property_enum_items(prop, owner_space_pchan_items);
 	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Constraint_owner_space_itemf");
 	RNA_def_property_ui_text(prop, "Owner Space", "Space that owner is evaluated in");
 
-	prop= RNA_def_property(srna, "target_space", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "target_space", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "tarspace");
 	RNA_def_property_enum_items(prop, target_space_pchan_items);
 	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Constraint_target_space_itemf");
 	RNA_def_property_ui_text(prop, "Target Space", "Space that target is evaluated in");
 
 	/* flags */
-	prop= RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_OFF);
 	RNA_def_property_ui_text(prop, "Disable", "Enable/Disable Constraint");
 	
-	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, "flag", CONSTRAINT_EXPAND);
 	RNA_def_property_ui_text(prop, "Expanded", "Constraint's panel is expanded in UI");
 	RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
 
-		// XXX this is really an internal flag, but it may be useful for some tools to be able to access this...
-	prop= RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
+		/* XXX this is really an internal flag, but it may be useful for some tools to be able to access this... */
+	prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_DISABLE);
 	RNA_def_property_ui_text(prop, "Valid", "Constraint has valid settings and can be evaluated");
 	
-		// TODO: setting this to true must ensure that all others in stack are turned off too...
-	prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
+		/* TODO: setting this to true must ensure that all others in stack are turned off too... */
+	prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_ACTIVE);
 	RNA_def_property_ui_text(prop, "Active", "Constraint is the one being edited ");
 	
-	prop= RNA_def_property(srna, "is_proxy_local", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_proxy_local", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_PROXY_LOCAL);
-	RNA_def_property_ui_text(prop, "Proxy Local", "Constraint was added in this proxy instance (i.e. did not belong to source Armature)");
+	RNA_def_property_ui_text(prop, "Proxy Local",
+	                         "Constraint was added in this proxy instance (i.e. did not belong to source Armature)");
 	
 	/* values */
-	prop= RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "enforce");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Influence", "Amount of influence constraint will have on the final solution");
 	RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_influence_update");
 
 	/* readonly values */
-	prop= RNA_def_property(srna, "error_location", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "error_location", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "lin_error");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "Lin error", "Amount of residual error in Blender space unit for constraints that work on position");
+	RNA_def_property_ui_text(prop, "Lin error",
+	                         "Amount of residual error in Blender space unit for constraints that work on position");
 
-	prop= RNA_def_property(srna, "error_rotation", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "error_rotation", PROP_FLOAT, PROP_NONE);
 	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");
+	RNA_def_property_ui_text(prop, "Rot error",
+	                         "Amount of residual error in radiant for constraints that work on orientation");
 
 	/* pointers */
 	rna_def_constrainttarget(brna);
@@ -2340,4 +2412,3 @@ void RNA_def_constraint(BlenderRNA *brna)
 }
 
 #endif
-
diff --git a/source/blender/makesrna/intern/rna_context.c b/source/blender/makesrna/intern/rna_context.c
index 043645a..bd149b1 100644
--- a/source/blender/makesrna/intern/rna_context.c
+++ b/source/blender/makesrna/intern/rna_context.c
@@ -41,25 +41,25 @@
 
 static PointerRNA rna_Context_manager_get(PointerRNA *ptr)
 {
-	bContext *C= (bContext*)ptr->data;
+	bContext *C = (bContext*)ptr->data;
 	return rna_pointer_inherit_refine(ptr, &RNA_WindowManager, CTX_wm_manager(C));
 }
 
 static PointerRNA rna_Context_window_get(PointerRNA *ptr)
 {
-	bContext *C= (bContext*)ptr->data;
+	bContext *C = (bContext*)ptr->data;
 	return rna_pointer_inherit_refine(ptr, &RNA_Window, CTX_wm_window(C));
 }
 
 static PointerRNA rna_Context_screen_get(PointerRNA *ptr)
 {
-	bContext *C= (bContext*)ptr->data;
+	bContext *C = (bContext*)ptr->data;
 	return rna_pointer_inherit_refine(ptr, &RNA_Screen, CTX_wm_screen(C));
 }
 
 static PointerRNA rna_Context_area_get(PointerRNA *ptr)
 {
-	bContext *C= (bContext*)ptr->data;
+	bContext *C = (bContext*)ptr->data;
 	PointerRNA newptr;
 	RNA_pointer_create((ID*)CTX_wm_screen(C), &RNA_Area, CTX_wm_area(C), &newptr);
 	return newptr;
@@ -67,7 +67,7 @@ static PointerRNA rna_Context_area_get(PointerRNA *ptr)
 
 static PointerRNA rna_Context_space_data_get(PointerRNA *ptr)
 {
-	bContext *C= (bContext*)ptr->data;
+	bContext *C = (bContext*)ptr->data;
 	PointerRNA newptr;
 	RNA_pointer_create((ID*)CTX_wm_screen(C), &RNA_Space, CTX_wm_space_data(C), &newptr);
 	return newptr;
@@ -75,7 +75,7 @@ static PointerRNA rna_Context_space_data_get(PointerRNA *ptr)
 
 static PointerRNA rna_Context_region_get(PointerRNA *ptr)
 {
-	bContext *C= (bContext*)ptr->data;
+	bContext *C = (bContext*)ptr->data;
 	PointerRNA newptr;
 	RNA_pointer_create((ID*)CTX_wm_screen(C), &RNA_Region, CTX_wm_region(C), &newptr);
 	return newptr;
@@ -83,10 +83,10 @@ static PointerRNA rna_Context_region_get(PointerRNA *ptr)
 
 static PointerRNA rna_Context_region_data_get(PointerRNA *ptr)
 {
-	bContext *C= (bContext*)ptr->data;
+	bContext *C = (bContext*)ptr->data;
 
 	/* only exists for one space still, no generic system yet */
-	if(CTX_wm_view3d(C)) {
+	if (CTX_wm_view3d(C)) {
 		PointerRNA newptr;
 		RNA_pointer_create((ID*)CTX_wm_screen(C), &RNA_RegionView3D, CTX_wm_region_data(C), &newptr);
 		return newptr;
@@ -97,20 +97,20 @@ static PointerRNA rna_Context_region_data_get(PointerRNA *ptr)
 
 static PointerRNA rna_Context_main_get(PointerRNA *ptr)
 {
-	bContext *C= (bContext*)ptr->data;
+	bContext *C = (bContext*)ptr->data;
 	return rna_pointer_inherit_refine(ptr, &RNA_BlendData, CTX_data_main(C));
 }
 
 static PointerRNA rna_Context_scene_get(PointerRNA *ptr)
 {
-	bContext *C= (bContext*)ptr->data;
+	bContext *C = (bContext*)ptr->data;
 	return rna_pointer_inherit_refine(ptr, &RNA_Scene, CTX_data_scene(C));
 }
 
 static PointerRNA rna_Context_tool_settings_get(PointerRNA *ptr)
 {
-	bContext *C= (bContext*)ptr->data;
-	ptr->id.data= CTX_data_scene(C);
+	bContext *C = (bContext*)ptr->data;
+	ptr->id.data = CTX_data_scene(C);
 	return rna_pointer_inherit_refine(ptr, &RNA_ToolSettings, CTX_data_tool_settings(C));
 }
 
@@ -123,7 +123,7 @@ static PointerRNA rna_Context_user_preferences_get(PointerRNA *UNUSED(ptr))
 
 static int rna_Context_mode_get(PointerRNA *ptr)
 {
-	bContext *C= (bContext*)ptr->data;
+	bContext *C = (bContext*)ptr->data;
 	return CTX_data_mode_enum(C);
 }
 
@@ -139,7 +139,7 @@ void RNA_def_context(BlenderRNA *brna)
 		{CTX_MODE_EDIT_CURVE, "EDIT_CURVE", 0, "Curve Edit", ""},
 		{CTX_MODE_EDIT_SURFACE, "EDIT_SURFACE", 0, "Surface Edit", ""},
 		{CTX_MODE_EDIT_TEXT, "EDIT_TEXT", 0, "Edit Edit", ""},
-		{CTX_MODE_EDIT_ARMATURE, "EDIT_ARMATURE", 0, "Armature Edit", ""}, // PARSKEL reuse will give issues
+		{CTX_MODE_EDIT_ARMATURE, "EDIT_ARMATURE", 0, "Armature Edit", ""}, /* PARSKEL reuse will give issues */
 		{CTX_MODE_EDIT_METABALL, "EDIT_METABALL", 0, "Metaball Edit", ""},
 		{CTX_MODE_EDIT_LATTICE, "EDIT_LATTICE", 0, "Lattice Edit", ""},
 		{CTX_MODE_POSE, "POSE", 0, "Pose ", ""},
@@ -151,68 +151,68 @@ void RNA_def_context(BlenderRNA *brna)
 		{CTX_MODE_OBJECT, "OBJECT", 0, "Object", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "Context", NULL);
+	srna = RNA_def_struct(brna, "Context", NULL);
 	RNA_def_struct_ui_text(srna, "Context", "Current windowmanager and data context");
 	RNA_def_struct_sdna(srna, "bContext");
 
 	/* WM */
-	prop= RNA_def_property(srna, "window_manager", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "window_manager", PROP_POINTER, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "WindowManager");
 	RNA_def_property_pointer_funcs(prop, "rna_Context_manager_get", NULL, NULL, NULL);
 
-	prop= RNA_def_property(srna, "window", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "window", PROP_POINTER, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "Window");
 	RNA_def_property_pointer_funcs(prop, "rna_Context_window_get", NULL, NULL, NULL);
 
-	prop= RNA_def_property(srna, "screen", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "screen", PROP_POINTER, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "Screen");
 	RNA_def_property_pointer_funcs(prop, "rna_Context_screen_get", NULL, NULL, NULL);
 
-	prop= RNA_def_property(srna, "area", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "area", PROP_POINTER, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "Area");
 	RNA_def_property_pointer_funcs(prop, "rna_Context_area_get", NULL, NULL, NULL);
 
-	prop= RNA_def_property(srna, "space_data", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "space_data", PROP_POINTER, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "Space");
 	RNA_def_property_pointer_funcs(prop, "rna_Context_space_data_get", NULL, NULL, NULL);
 
-	prop= RNA_def_property(srna, "region", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "region", PROP_POINTER, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "Region");
 	RNA_def_property_pointer_funcs(prop, "rna_Context_region_get", NULL, NULL, NULL);
 
-	prop= RNA_def_property(srna, "region_data", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "region_data", PROP_POINTER, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "RegionView3D");
 	RNA_def_property_pointer_funcs(prop, "rna_Context_region_data_get", NULL, NULL, NULL);
 
 	/* Data */
-	prop= RNA_def_property(srna, "blend_data", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "blend_data", PROP_POINTER, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "BlendData");
 	RNA_def_property_pointer_funcs(prop, "rna_Context_main_get", NULL, NULL, NULL);
 
-	prop= RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "Scene");
 	RNA_def_property_pointer_funcs(prop, "rna_Context_scene_get", NULL, NULL, NULL);
 
-	prop= RNA_def_property(srna, "tool_settings", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "tool_settings", PROP_POINTER, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "ToolSettings");
 	RNA_def_property_pointer_funcs(prop, "rna_Context_tool_settings_get", NULL, NULL, NULL);
 
-	prop= RNA_def_property(srna, "user_preferences", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "user_preferences", PROP_POINTER, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "UserPreferences");
 	RNA_def_property_pointer_funcs(prop, "rna_Context_user_preferences_get", NULL, NULL, NULL);
 
-	prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, mode_items);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_enum_funcs(prop, "rna_Context_mode_get", NULL, NULL);
diff --git a/source/blender/makesrna/intern/rna_controller.c b/source/blender/makesrna/intern/rna_controller.c
index 7dfb359..fa18c92 100644
--- a/source/blender/makesrna/intern/rna_controller.c
+++ b/source/blender/makesrna/intern/rna_controller.c
@@ -34,7 +34,7 @@
 #include "DNA_object_types.h"
 #include "DNA_controller_types.h"
 
-EnumPropertyItem controller_type_items[] ={
+EnumPropertyItem controller_type_items[] = {
 	{CONT_LOGIC_AND, "LOGIC_AND", 0, "And", "Logic And"},
 	{CONT_LOGIC_OR, "LOGIC_OR", 0, "Or", "Logic Or"},
 	{CONT_LOGIC_NAND, "LOGIC_NAND", 0, "Nand", "Logic Nand"},
@@ -52,9 +52,9 @@ EnumPropertyItem controller_type_items[] ={
 
 static struct StructRNA* rna_Controller_refine(struct PointerRNA *ptr)
 {
-	bController *controller= (bController*)ptr->data;
+	bController *controller = (bController*)ptr->data;
 
-	switch(controller->type) {
+	switch (controller->type) {
 	case CONT_LOGIC_AND:
 		return &RNA_AndController;
 	case CONT_LOGIC_OR:
@@ -78,21 +78,21 @@ static struct StructRNA* rna_Controller_refine(struct PointerRNA *ptr)
 
 void rna_Constroller_name_set(PointerRNA *ptr, const char *value)
 {
-	bController *cont= (bController *)ptr->data;
+	bController *cont = (bController *)ptr->data;
 
 	BLI_strncpy_utf8(cont->name, value, sizeof(cont->name));
 
 	if (ptr->id.data) {
-		Object *ob= (Object *)ptr->id.data;
+		Object *ob = (Object *)ptr->id.data;
 		BLI_uniquename(&ob->controllers, cont, "Controller", '.', offsetof(bController, name), sizeof(cont->name));
 	}
 }
 
 static void rna_Controller_type_set(struct PointerRNA *ptr, int value)
 {
-	bController *cont= (bController *)ptr->data;
-	if (value != cont->type)
-	{
+	bController *cont = (bController *)ptr->data;
+
+	if (value != cont->type) {
 		cont->type = value;
 		init_controller(cont);
 	}
@@ -100,13 +100,12 @@ static void rna_Controller_type_set(struct PointerRNA *ptr, int value)
 
 static void rna_Controller_mode_set(struct PointerRNA *ptr, int value)
 {
-	bController *cont= (bController *)ptr->data;
-	bPythonCont *pycon= (bPythonCont *)cont->data;
+	bController *cont = (bController *)ptr->data;
+	bPythonCont *pycon = (bPythonCont *)cont->data;
 
-	// if mode changed and previous mode were Script
-	if (value != pycon->mode && pycon->mode == CONT_PY_SCRIPT)
-	{
-		// clear script to avoid it to get linked with the controller
+	/* if mode changed and previous mode were Script */
+	if (value != pycon->mode && pycon->mode == CONT_PY_SCRIPT) {
+		/* clear script to avoid it to get linked with the controller */
 		pycon->text = NULL;
 	}
 	pycon->mode = value;
@@ -114,10 +113,10 @@ static void rna_Controller_mode_set(struct PointerRNA *ptr, int value)
 
 static int rna_Controller_state_number_get(struct PointerRNA *ptr)
 {
-	bController *cont= (bController *)ptr->data;
+	bController *cont = (bController *)ptr->data;
 	int bit;
 
-	for (bit=0; bit<32; bit++) {
+	for (bit = 0; bit<32; bit++) {
 		if (cont->state_mask & (1<<bit))
 			return bit+1;
 	}
@@ -126,7 +125,7 @@ static int rna_Controller_state_number_get(struct PointerRNA *ptr)
 
 static void rna_Controller_state_number_set(struct PointerRNA *ptr, const int value)
 {
-	bController *cont= (bController *)ptr->data;
+	bController *cont = (bController *)ptr->data;
 	if (value < 1 || value > OB_MAX_STATES)
 		return;
 
@@ -148,33 +147,33 @@ static int rna_Controller_actuators_length(PointerRNA *ptr)
 #if 0 /* editable is set to false, comment for now. */
 static void rna_Controller_state_get(PointerRNA *ptr, int *values)
 {
-	bController *cont= (bController *)ptr->data;
+	bController *cont = (bController *)ptr->data;
 	int i;
 
 	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] = (cont->state_mask & (1<<i));
 }
 
 static void rna_Controller_state_set(PointerRNA *ptr, const int *values)
 {
-	bController *cont= (bController *)ptr->data;
-	int i, tot= 0;
+	bController *cont = (bController *)ptr->data;
+	int i, tot = 0;
 
 	/* ensure we always have some state selected */
-	for(i=0; i<OB_MAX_STATES; i++)
-		if(values[i])
+	for (i = 0; i<OB_MAX_STATES; i++)
+		if (values[i])
 			tot++;
 	
-	if(tot==0)
+	if (tot == 0)
 		return;
 
 	/* only works for one state at once */
-	if(tot>1)
+	if (tot>1)
 		return;
 
-	for(i=0; i<OB_MAX_STATES; i++) {
-		if(values[i]) cont->state_mask |= (1<<i);
+	for (i = 0; i<OB_MAX_STATES; i++) {
+		if (values[i]) cont->state_mask |= (1<<i);
 		else cont->state_mask &= ~(1<<i);
 	}
 }
@@ -187,62 +186,67 @@ void RNA_def_controller(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static EnumPropertyItem python_controller_modes[] ={
+	static EnumPropertyItem python_controller_modes[] = {
 		{CONT_PY_SCRIPT, "SCRIPT", 0, "Script", ""},
 		{CONT_PY_MODULE, "MODULE", 0, "Module", ""},
 		{0, NULL, 0, NULL, NULL}};
 
 	/* Controller */
-	srna= RNA_def_struct(brna, "Controller", NULL);
+	srna = RNA_def_struct(brna, "Controller", NULL);
 	RNA_def_struct_sdna(srna, "bController");
 	RNA_def_struct_refine_func(srna, "rna_Controller_refine");
-	RNA_def_struct_ui_text(srna, "Controller", "Game engine logic brick to process events, connecting sensors to actuators");
+	RNA_def_struct_ui_text(srna, "Controller",
+	                       "Game engine logic brick to process events, connecting sensors to actuators");
 
 	RNA_api_controller(srna);
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Name", "");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Constroller_name_set");
 	RNA_def_struct_name_property(srna, prop);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_funcs(prop, NULL, "rna_Controller_type_set", NULL);
 	RNA_def_property_enum_items(prop, controller_type_items);
 	RNA_def_property_ui_text(prop, "Type", "");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	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, "flag", CONT_SHOW);
 	RNA_def_property_ui_text(prop, "Expanded", "Set controller expanded in the user interface");
-	RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);	
+	RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_priority", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_priority", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CONT_PRIO);
-	RNA_def_property_ui_text(prop, "Priority", "Mark controller for execution before all non-marked controllers (good for startup scripts)");
+	RNA_def_property_ui_text(prop, "Priority",
+	                         "Mark controller for execution before all non-marked controllers "
+	                         "(good for startup scripts)");
 	RNA_def_property_ui_icon(prop, ICON_BOOKMARKS, 1);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "actuators", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "actuators", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "links", NULL);
 	RNA_def_property_struct_type(prop, "Actuator");
 	RNA_def_property_ui_text(prop, "Actuators", "The list containing the actuators connected to the controller");
-	RNA_def_property_collection_funcs(prop, "rna_Controller_actuators_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_dereference_get", "rna_Controller_actuators_length", NULL, NULL, NULL);
+	RNA_def_property_collection_funcs(prop, "rna_Controller_actuators_begin", "rna_iterator_array_next",
+	                                  "rna_iterator_array_end", "rna_iterator_array_dereference_get",
+	                                  "rna_Controller_actuators_length", NULL, NULL, NULL);
 
 	/* State */
 	
-	// array of OB_MAX_STATES
-	//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)");
-	//RNA_def_property_boolean_funcs(prop, "rna_Controller_state_get", "rna_Controller_state_set");
-	//RNA_def_property_update(prop, NC_LOGIC, NULL);
-
-	// number of the state
-	prop= RNA_def_property(srna, "states", PROP_INT, PROP_UNSIGNED);
+	/* array of OB_MAX_STATES */
+	/*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)"); */
+	/*RNA_def_property_boolean_funcs(prop, "rna_Controller_state_get", "rna_Controller_state_set"); */
+	/*RNA_def_property_update(prop, NC_LOGIC, NULL); */
+
+	/* number of the state */
+	prop = RNA_def_property(srna, "states", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "state_mask");
 	RNA_def_property_range(prop, 1, OB_MAX_STATES);
 	RNA_def_property_ui_text(prop, "", "Set Controller state index (1 to 30)");
@@ -250,60 +254,64 @@ void RNA_def_controller(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* Expression Controller */
-	srna= RNA_def_struct(brna, "ExpressionController", "Controller");
+	srna = RNA_def_struct(brna, "ExpressionController", "Controller");
 	RNA_def_struct_sdna_from(srna, "bExpressionCont", "data");
-	RNA_def_struct_ui_text(srna, "Expression Controller", "Controller passing on events based on the evaluation of an expression");
+	RNA_def_struct_ui_text(srna, "Expression Controller",
+	                       "Controller passing on events based on the evaluation of an expression");
 
-	prop= RNA_def_property(srna, "expression", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "expression", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "str");
 	RNA_def_property_ui_text(prop, "Expression", "");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* Python Controller */
-	srna= RNA_def_struct(brna, "PythonController", "Controller" );
+	srna = RNA_def_struct(brna, "PythonController", "Controller" );
 	RNA_def_struct_sdna_from(srna, "bPythonCont", "data");
 	RNA_def_struct_ui_text(srna, "Python Controller", "Controller executing a python script");
 
-	prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, python_controller_modes);
 	RNA_def_property_enum_funcs(prop, NULL, "rna_Controller_mode_set", NULL);
 	RNA_def_property_ui_text(prop, "Execution Method", "Python script type (textblock or module - faster)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Text");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Text", "Text datablock with the python script");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "module", PROP_STRING, PROP_NONE);
-	RNA_def_property_ui_text(prop, "Module", "Module name and function to run, e.g. \"someModule.main\" (internal texts and external python files can be used)");
+	prop = RNA_def_property(srna, "module", PROP_STRING, PROP_NONE);
+	RNA_def_property_ui_text(prop, "Module",
+	                         "Module name and function to run, e.g. \"someModule.main\" "
+	                         "(internal texts and external python files can be used)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_debug", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_debug", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CONT_PY_DEBUG);
-	RNA_def_property_ui_text(prop, "D", "Continuously reload the module from disk for editing external modules without restarting");
+	RNA_def_property_ui_text(prop, "D",
+	                         "Continuously reload the module from disk for editing external modules "
+	                         "without restarting");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* Other Controllers */
-	srna= RNA_def_struct(brna, "AndController", "Controller");
+	srna = RNA_def_struct(brna, "AndController", "Controller");
 	RNA_def_struct_ui_text(srna, "And Controller", "Controller passing on events based on a logical AND operation");
 	
-	srna= RNA_def_struct(brna, "OrController", "Controller");
+	srna = RNA_def_struct(brna, "OrController", "Controller");
 	RNA_def_struct_ui_text(srna, "Or Controller", "Controller passing on events based on a logical OR operation");
 	
-	srna= RNA_def_struct(brna, "NorController", "Controller");
+	srna = RNA_def_struct(brna, "NorController", "Controller");
 	RNA_def_struct_ui_text(srna, "Nor Controller", "Controller passing on events based on a logical NOR operation");
 	
-	srna= RNA_def_struct(brna, "NandController", "Controller");
+	srna = RNA_def_struct(brna, "NandController", "Controller");
 	RNA_def_struct_ui_text(srna, "Nand Controller", "Controller passing on events based on a logical NAND operation");
 	
-	srna= RNA_def_struct(brna, "XorController", "Controller");
+	srna = RNA_def_struct(brna, "XorController", "Controller");
 	RNA_def_struct_ui_text(srna, "Xor Controller", "Controller passing on events based on a logical XOR operation");
 	
-	srna= RNA_def_struct(brna, "XnorController", "Controller");
+	srna = RNA_def_struct(brna, "XnorController", "Controller");
 	RNA_def_struct_ui_text(srna, "Xnor Controller", "Controller passing on events based on a logical XNOR operation");
 }
 
 #endif
-
diff --git a/source/blender/makesrna/intern/rna_controller_api.c b/source/blender/makesrna/intern/rna_controller_api.c
index 5f766e2..6fe90e1 100644
--- a/source/blender/makesrna/intern/rna_controller_api.c
+++ b/source/blender/makesrna/intern/rna_controller_api.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
@@ -18,7 +18,7 @@
  * The Original Code is Copyright (C) 2010 Blender Foundation.
  * All rights reserved.
  *
- * 
+ *
  * Contributor(s):
  *
  * ***** END GPL LICENSE BLOCK *****
@@ -44,17 +44,17 @@
 
 static void rna_Controller_link(bController *cont, bSensor *sens, bActuator *act)
 {
-	if(sens)
+	if (sens)
 		link_logicbricks((void **)&cont, (void ***)&(sens->links), &sens->totlinks, sizeof(bController *));
-	if(act)
+	if (act)
 		link_logicbricks((void **)&act, (void ***)&(cont->links), &cont->totlinks, sizeof(bActuator *));
 }
 
 static void rna_Controller_unlink(bController *cont, bSensor *sens, bActuator *act)
 {
-	if(sens)
+	if (sens)
 		unlink_logicbricks((void **)&cont, (void ***)&(sens->links), &sens->totlinks);
-	if(act)
+	if (act)
 		unlink_logicbricks((void **)&act, (void ***)&(cont->links), &cont->totlinks);
 }
 
@@ -65,18 +65,18 @@ void RNA_api_controller(StructRNA *srna)
 	FunctionRNA *func;
 	PropertyRNA *parm;
 
-	func= RNA_def_function(srna, "link", "rna_Controller_link");
+	func = RNA_def_function(srna, "link", "rna_Controller_link");
 	RNA_def_function_ui_description(func, "Link the controller with a sensor/actuator");
-	parm= RNA_def_pointer(func, "sensor", "Sensor", "", "Sensor to link the controller to"); 
+	parm = RNA_def_pointer(func, "sensor", "Sensor", "", "Sensor to link the controller to");
 	RNA_def_property_update(parm, NC_LOGIC, NULL);
-	parm= RNA_def_pointer(func, "actuator", "Actuator", "", "Actuator to link the controller to"); 
+	parm = RNA_def_pointer(func, "actuator", "Actuator", "", "Actuator to link the controller to");
 	RNA_def_property_update(parm, NC_LOGIC, NULL);
 
-	func= RNA_def_function(srna, "unlink", "rna_Controller_unlink");
+	func = RNA_def_function(srna, "unlink", "rna_Controller_unlink");
 	RNA_def_function_ui_description(func, "Unlink the controller from a sensor/actuator");
-	parm= RNA_def_pointer(func, "sensor", "Sensor", "", "Sensor to unlink the controller from"); 
+	parm = RNA_def_pointer(func, "sensor", "Sensor", "", "Sensor to unlink the controller from");
 	RNA_def_property_update(parm, NC_LOGIC, NULL);
-	parm= RNA_def_pointer(func, "actuator", "Actuator", "", "Actuator to unlink the controller from"); 
+	parm = RNA_def_pointer(func, "actuator", "Actuator", "", "Actuator to unlink the controller from");
 	RNA_def_property_update(parm, NC_LOGIC, NULL);
 }
 
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index 088f2db..97cf73a 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -72,14 +72,14 @@ EnumPropertyItem curve_type_items[] = {
 	{CU_NURBS, "NURBS", 0, "Ease", ""},
 	{0, NULL, 0, NULL, NULL}};
 
-static const EnumPropertyItem curve3d_fill_mode_items[]= {
+static const EnumPropertyItem curve3d_fill_mode_items[] = {
 	{0, "FULL", 0, "Full", ""},
 	{CU_BACK, "BACK", 0, "Back", ""},
 	{CU_FRONT, "FRONT", 0, "Front", ""},
 	{CU_FRONT|CU_BACK, "HALF", 0, "Half", ""},
 	{0, NULL, 0, NULL, NULL}};
 
-static const EnumPropertyItem curve2d_fill_mode_items[]= {
+static const EnumPropertyItem curve2d_fill_mode_items[] = {
 	{0, "NONE", 0, "None", ""},
 	{CU_BACK, "BACK", 0, "Back", ""},
 	{CU_FRONT, "FRONT", 0, "Front", ""},
@@ -105,31 +105,31 @@ static const EnumPropertyItem curve2d_fill_mode_items[]= {
 /* highly irritating but from RNA we cant know this */
 static Nurb *curve_nurb_from_point(Curve *cu, const void *point, int *nu_index, int *pt_index)
 {
-	ListBase *nurbs= BKE_curve_nurbs(cu);
+	ListBase *nurbs = BKE_curve_nurbs(cu);
 	Nurb *nu;
-	int i= 0;
+	int i = 0;
 
-	for(nu= nurbs->first; nu; nu= nu->next, i++) {
-		if(nu->type == CU_BEZIER) {
-			if(point >= (void *)nu->bezt && point < (void *)(nu->bezt + nu->pntsu)) {
+	for (nu = nurbs->first; nu; nu = nu->next, i++) {
+		if (nu->type == CU_BEZIER) {
+			if (point >= (void *)nu->bezt && point < (void *)(nu->bezt + nu->pntsu)) {
 				break;
 			}
 		}
 		else {
-			if(point >= (void *)nu->bp && point < (void *)(nu->bp + (nu->pntsu * nu->pntsv))) {
+			if (point >= (void *)nu->bp && point < (void *)(nu->bp + (nu->pntsu * nu->pntsv))) {
 				break;
 			}
 		}
 	}
 
-	if(nu) {
-		if(nu_index) {
-			*nu_index= i;
+	if (nu) {
+		if (nu_index) {
+			*nu_index = i;
 		}
 	
-		if(pt_index) {
-			if(nu->type == CU_BEZIER)	*pt_index= (int)((BezTriple *)point - nu->bezt);
-			else						*pt_index= (int)((BPoint *)point - nu->bp);
+		if (pt_index) {
+			if (nu->type == CU_BEZIER)	*pt_index = (int)((BezTriple *)point - nu->bezt);
+			else						*pt_index = (int)((BPoint *)point - nu->bp);
 		}
 	}
 
@@ -138,71 +138,71 @@ static Nurb *curve_nurb_from_point(Curve *cu, const void *point, int *nu_index,
 
 static StructRNA *rna_Curve_refine(PointerRNA *ptr)
 {
-	Curve *cu= (Curve*)ptr->data;
-	short obtype= curve_type(cu);
+	Curve *cu = (Curve*)ptr->data;
+	short obtype = curve_type(cu);
 	
-	if(obtype == OB_FONT) return &RNA_TextCurve;
-	else if(obtype == OB_SURF) return &RNA_SurfaceCurve;
+	if (obtype == OB_FONT) return &RNA_TextCurve;
+	else if (obtype == OB_SURF) return &RNA_SurfaceCurve;
 	else return &RNA_Curve;
 }
 
 static void rna_BezTriple_handle1_get(PointerRNA *ptr, float *values)
 {
-	BezTriple *bt= (BezTriple*)ptr->data;
+	BezTriple *bt = (BezTriple*)ptr->data;
 
-	values[0]= bt->vec[0][0];
-	values[1]= bt->vec[0][1];
-	values[2]= bt->vec[0][2];
+	values[0] = bt->vec[0][0];
+	values[1] = bt->vec[0][1];
+	values[2] = bt->vec[0][2];
 }
 
 static void rna_BezTriple_handle1_set(PointerRNA *ptr, const float *values)
 {
-	BezTriple *bt= (BezTriple*)ptr->data;
+	BezTriple *bt = (BezTriple*)ptr->data;
 
-	bt->vec[0][0]= values[0];
-	bt->vec[0][1]= values[1];
-	bt->vec[0][2]= values[2];
+	bt->vec[0][0] = values[0];
+	bt->vec[0][1] = values[1];
+	bt->vec[0][2] = values[2];
 }
 
 static void rna_BezTriple_handle2_get(PointerRNA *ptr, float *values)
 {
-	BezTriple *bt= (BezTriple*)ptr->data;
+	BezTriple *bt = (BezTriple*)ptr->data;
 
-	values[0]= bt->vec[2][0];
-	values[1]= bt->vec[2][1];
-	values[2]= bt->vec[2][2];
+	values[0] = bt->vec[2][0];
+	values[1] = bt->vec[2][1];
+	values[2] = bt->vec[2][2];
 }
 
 static void rna_BezTriple_handle2_set(PointerRNA *ptr, const float *values)
 {
-	BezTriple *bt= (BezTriple*)ptr->data;
+	BezTriple *bt = (BezTriple*)ptr->data;
 
-	bt->vec[2][0]= values[0];
-	bt->vec[2][1]= values[1];
-	bt->vec[2][2]= values[2];
+	bt->vec[2][0] = values[0];
+	bt->vec[2][1] = values[1];
+	bt->vec[2][2] = values[2];
 }
 
 static void rna_BezTriple_ctrlpoint_get(PointerRNA *ptr, float *values)
 {
-	BezTriple *bt= (BezTriple*)ptr->data;
+	BezTriple *bt = (BezTriple*)ptr->data;
 
-	values[0]= bt->vec[1][0];
-	values[1]= bt->vec[1][1];
-	values[2]= bt->vec[1][2];
+	values[0] = bt->vec[1][0];
+	values[1] = bt->vec[1][1];
+	values[2] = bt->vec[1][2];
 }
 
 static void rna_BezTriple_ctrlpoint_set(PointerRNA *ptr, const float *values)
 {
-	BezTriple *bt= (BezTriple*)ptr->data;
+	BezTriple *bt = (BezTriple*)ptr->data;
 
-	bt->vec[1][0]= values[0];
-	bt->vec[1][1]= values[1];
-	bt->vec[1][2]= values[2];
+	bt->vec[1][0] = values[0];
+	bt->vec[1][1] = values[1];
+	bt->vec[1][2] = values[2];
 }
 
 static void rna_Curve_texspace_set(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	Curve *cu= (Curve*)ptr->data;
+	Curve *cu = (Curve*)ptr->data;
 	
 	if (cu->texflag & CU_AUTOSPACE)
 		tex_space_curve(cu);
@@ -210,13 +210,13 @@ static void rna_Curve_texspace_set(Main *UNUSED(bmain), Scene *UNUSED(scene), Po
 
 static int rna_Curve_texspace_editable(PointerRNA *ptr)
 {
-	Curve *cu= (Curve*)ptr->data;
+	Curve *cu = (Curve*)ptr->data;
 	return (cu->texflag & CU_AUTOSPACE)? 0: PROP_EDITABLE;
 }
 
 static void rna_Curve_texspace_loc_get(PointerRNA *ptr, float *values)
 {
-	Curve *cu= (Curve *)ptr->data;
+	Curve *cu = (Curve *)ptr->data;
 	
 	if (!cu->bb)
 		tex_space_curve(cu);
@@ -226,14 +226,14 @@ static void rna_Curve_texspace_loc_get(PointerRNA *ptr, float *values)
 
 static void rna_Curve_texspace_loc_set(PointerRNA *ptr, const float *values)
 {
-	Curve *cu= (Curve *)ptr->data;
+	Curve *cu = (Curve *)ptr->data;
 	
 	copy_v3_v3(cu->loc, values);
 }
 
 static void rna_Curve_texspace_size_get(PointerRNA *ptr, float *values)
 {
-	Curve *cu= (Curve *)ptr->data;
+	Curve *cu = (Curve *)ptr->data;
 	
 	if (!cu->bb)
 		tex_space_curve(cu);
@@ -243,40 +243,41 @@ static void rna_Curve_texspace_size_get(PointerRNA *ptr, float *values)
 
 static void rna_Curve_texspace_size_set(PointerRNA *ptr, const float *values)
 {
-	Curve *cu= (Curve *)ptr->data;
+	Curve *cu = (Curve *)ptr->data;
 	
 	copy_v3_v3(cu->size, values);
 }
 
-static void rna_Curve_material_index_range(PointerRNA *ptr, int *min, int *max)
+static void rna_Curve_material_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
 {
-	Curve *cu= (Curve*)ptr->id.data;
-	*min= 0;
-	*max= cu->totcol-1;
-	*max= MAX2(0, *max);
+	Curve *cu = (Curve*)ptr->id.data;
+	*min = 0;
+	*max = cu->totcol-1;
+	*max = MAX2(0, *max);
 }
 
-static void rna_Curve_active_textbox_index_range(PointerRNA *ptr, int *min, int *max)
+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);
+	Curve *cu = (Curve*)ptr->id.data;
+	*min = 0;
+	*max = cu->totbox-1;
+	*max = MAX2(0, *max);
 }
 
 
 static void rna_Curve_dimension_set(PointerRNA *ptr, int value)
 {
-	Curve *cu= (Curve*)ptr->id.data;
-	if(value==CU_3D) cu->flag |=  CU_3D;
+	Curve *cu = (Curve*)ptr->id.data;
+	if (value == CU_3D) cu->flag |=  CU_3D;
 	else cu->flag &= ~CU_3D;
 
 	update_curve_dimension(cu);
 }
 
-static EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
+static EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+                                                   PropertyRNA *UNUSED(prop), int *UNUSED(free))
 {
-	Curve *cu= (Curve*)ptr->id.data;
+	Curve *cu = (Curve*)ptr->id.data;
 
 	/* cast to quiet warning it IS a const still */
 	return (EnumPropertyItem *)((cu->flag & CU_3D) ? curve3d_fill_mode_items : curve2d_fill_mode_items);
@@ -284,21 +285,22 @@ static EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C), PointerR
 
 static int rna_Nurb_length(PointerRNA *ptr)
 {
-	Nurb *nu= (Nurb*)ptr->data;
-	if(nu->type == CU_BEZIER) return 0;
+	Nurb *nu = (Nurb*)ptr->data;
+	if (nu->type == CU_BEZIER) return 0;
 	return nu->pntsv>0 ? nu->pntsu*nu->pntsv : nu->pntsu;
 }
 
 static void rna_Nurb_type_set(PointerRNA *ptr, int value)
 {
-	Nurb *nu= (Nurb*)ptr->data;
+	Nurb *nu = (Nurb*)ptr->data;
 	ED_nurb_set_spline_type(nu, value);
 }
 
 static void rna_BPoint_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Nurb *nu= (Nurb*)ptr->data;
-	rna_iterator_array_begin(iter, (void*)nu->bp, sizeof(BPoint), nu->pntsv>0 ? nu->pntsu*nu->pntsv : nu->pntsu, 0, NULL);
+	Nurb *nu = (Nurb*)ptr->data;
+	rna_iterator_array_begin(iter, (void*)nu->bp, sizeof(BPoint),
+	                         nu->pntsv > 0 ? nu->pntsu*nu->pntsv : nu->pntsu, 0, NULL);
 }
 
 static void rna_Curve_update_data_id(Main *UNUSED(bmain), Scene *UNUSED(scene), ID *id)
@@ -320,10 +322,10 @@ static void rna_Curve_update_deps(Main *bmain, Scene *scene, PointerRNA *ptr)
 
 static void rna_Curve_update_points(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Curve *cu= (Curve*)ptr->id.data;
-	Nurb *nu= curve_nurb_from_point(cu, ptr->data, NULL, NULL);
+	Curve *cu = (Curve*)ptr->id.data;
+	Nurb *nu = curve_nurb_from_point(cu, ptr->data, NULL, NULL);
 
-	if(nu)
+	if (nu)
 		calchandlesNurb(nu);
 
 	rna_Curve_update_data(bmain, scene, ptr);
@@ -331,10 +333,10 @@ static void rna_Curve_update_points(Main *bmain, Scene *scene, PointerRNA *ptr)
 
 static PointerRNA rna_Curve_bevelObject_get(PointerRNA *ptr)
 {
-	Curve *cu= (Curve*)ptr->id.data;
-	Object *ob= cu->bevobj;
+	Curve *cu = (Curve*)ptr->id.data;
+	Object *ob = cu->bevobj;
 
-	if(ob)
+	if (ob)
 		return rna_pointer_inherit_refine(ptr, &RNA_Object, ob);
 
 	return rna_pointer_inherit_refine(ptr, NULL, NULL);
@@ -342,8 +344,8 @@ static PointerRNA rna_Curve_bevelObject_get(PointerRNA *ptr)
 
 static void rna_Curve_bevelObject_set(PointerRNA *ptr, PointerRNA value)
 {
-	Curve *cu= (Curve*)ptr->id.data;
-	Object *ob= (Object*)value.data;
+	Curve *cu = (Curve*)ptr->id.data;
+	Object *ob = (Object*)value.data;
 
 	if (ob) {
 		/* if bevel object has got the save curve, as object, for which it's */
@@ -351,15 +353,16 @@ static void rna_Curve_bevelObject_set(PointerRNA *ptr, PointerRNA value)
 		if (ob->type == OB_CURVE && ob->data != cu) {
 			cu->bevobj = ob;
 		}
-	} else {
+	}
+	else {
 		cu->bevobj = NULL;
 	}
 }
 
 static int rna_Curve_otherObject_poll(PointerRNA *ptr, PointerRNA value)
 {
-	Curve *cu= (Curve*)ptr->id.data;
-	Object *ob= (Object*)value.data;
+	Curve *cu = (Curve*)ptr->id.data;
+	Object *ob = (Object*)value.data;
 
 	if (ob) {
 		if (ob->type == OB_CURVE && ob->data != cu) {
@@ -372,10 +375,10 @@ static int rna_Curve_otherObject_poll(PointerRNA *ptr, PointerRNA value)
 
 static PointerRNA rna_Curve_taperObject_get(PointerRNA *ptr)
 {
-	Curve *cu= (Curve*)ptr->id.data;
-	Object *ob= cu->taperobj;
+	Curve *cu = (Curve*)ptr->id.data;
+	Object *ob = cu->taperobj;
 
-	if(ob)
+	if (ob)
 		return rna_pointer_inherit_refine(ptr, &RNA_Object, ob);
 
 	return rna_pointer_inherit_refine(ptr, NULL, NULL);
@@ -383,8 +386,8 @@ static PointerRNA rna_Curve_taperObject_get(PointerRNA *ptr)
 
 static void rna_Curve_taperObject_set(PointerRNA *ptr, PointerRNA value)
 {
-	Curve *cu= (Curve*)ptr->id.data;
-	Object *ob= (Object*)value.data;
+	Curve *cu = (Curve*)ptr->id.data;
+	Object *ob = (Object*)value.data;
 
 	if (ob) {
 		/* if taper object has got the save curve, as object, for which it's */
@@ -392,20 +395,21 @@ static void rna_Curve_taperObject_set(PointerRNA *ptr, PointerRNA value)
 		if (ob->type == OB_CURVE && ob->data != cu) {
 			cu->taperobj = ob;
 		}
-	} else {
+	}
+	else {
 		cu->taperobj = NULL;
 	}
 }
 
 static void rna_Curve_resolution_u_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Curve *cu= (Curve*)ptr->id.data;
-	ListBase *nurbs= BKE_curve_nurbs(cu);
-	Nurb *nu= nurbs->first;
+	Curve *cu = (Curve*)ptr->id.data;
+	ListBase *nurbs = BKE_curve_nurbs(cu);
+	Nurb *nu = nurbs->first;
 
-	while(nu) {
-		nu->resolu= cu->resolu;
-		nu= nu->next;
+	while (nu) {
+		nu->resolu = cu->resolu;
+		nu = nu->next;
 	}
 	
 	rna_Curve_update_data(bmain, scene, ptr);
@@ -413,14 +417,14 @@ static void rna_Curve_resolution_u_update_data(Main *bmain, Scene *scene, Pointe
 
 static void rna_Curve_resolution_v_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Curve *cu= (Curve*)ptr->id.data;
-	ListBase *nurbs= BKE_curve_nurbs(cu);
-	Nurb *nu=nurbs->first;
+	Curve *cu = (Curve*)ptr->id.data;
+	ListBase *nurbs = BKE_curve_nurbs(cu);
+	Nurb *nu = nurbs->first;
 
 
-	while(nu) {
-		nu->resolv= cu->resolv;
-		nu= nu->next;
+	while (nu) {
+		nu->resolv = cu->resolv;
+		nu = nu->next;
 	}
 
 	rna_Curve_update_data(bmain, scene, ptr);
@@ -428,54 +432,58 @@ static void rna_Curve_resolution_v_update_data(Main *bmain, Scene *scene, Pointe
 
 static float rna_Curve_offset_get(PointerRNA *ptr)
 {
-	Curve *cu= (Curve*)ptr->id.data;
+	Curve *cu = (Curve*)ptr->id.data;
 	return cu->width - 1.0f;
 }
 
 static void rna_Curve_offset_set(PointerRNA *ptr, float value)
 {
-	Curve *cu= (Curve*)ptr->id.data;
-	cu->width= 1.0f + value;
+	Curve *cu = (Curve*)ptr->id.data;
+	cu->width = 1.0f + value;
 }
 
 /* name functions that ignore the first two ID characters */
 void rna_Curve_body_get(PointerRNA *ptr, char *value)
 {
-	Curve *cu= (Curve*)ptr->id.data;
+	Curve *cu = (Curve*)ptr->id.data;
 	BLI_strncpy(value, cu->str, cu->len+1);
 }
 
 int rna_Curve_body_length(PointerRNA *ptr)
 {
-	Curve *cu= (Curve*)ptr->id.data;
+	Curve *cu = (Curve*)ptr->id.data;
 	return cu->len;
 }
 
 /* TODO - check UTF & python play nice */
 void rna_Curve_body_set(PointerRNA *ptr, const char *value)
 {
-	int len= strlen(value);
-	Curve *cu= (Curve*)ptr->id.data;
+	int len = strlen(value);
+	Curve *cu = (Curve*)ptr->id.data;
 
-	cu->len= cu->pos = len;
+	cu->len = cu->pos = len;
 
-	if(cu->str)		MEM_freeN(cu->str);
-	if(cu->strinfo)	MEM_freeN(cu->strinfo);
+	if (cu->str)
+		MEM_freeN(cu->str);
+	if (cu->strinfo)
+		MEM_freeN(cu->strinfo);
 
 	cu->str = MEM_callocN(len + sizeof(wchar_t), "str");
-	cu->strinfo = MEM_callocN( (len+4) *sizeof(CharInfo), "strinfo"); /* don't know why this is +4, just duplicating load_editText() */
+	/* don't know why this is +4, just duplicating load_editText() */
+	cu->strinfo = MEM_callocN((len+4) *sizeof(CharInfo), "strinfo");
 
-	//BLI_strncpy_wchar_as_utf8(cu->str, value, len+1); // value is not wchar_t
+	/*BLI_strncpy_wchar_as_utf8(cu->str, value, len+1);  *//* value is not wchar_t */
 	BLI_strncpy(cu->str, value, len+1);
 }
 
 static void rna_Nurb_update_cyclic_u(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Nurb *nu= (Nurb*)ptr->data;
+	Nurb *nu = (Nurb*)ptr->data;
 
-	if(nu->type == CU_BEZIER) {
+	if (nu->type == CU_BEZIER) {
 		calchandlesNurb(nu);
-	} else {
+	}
+	else {
 		nurbs_knot_calc_u(nu);
 	}
 
@@ -484,7 +492,7 @@ static void rna_Nurb_update_cyclic_u(Main *bmain, Scene *scene, PointerRNA *ptr)
 
 static void rna_Nurb_update_cyclic_v(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Nurb *nu= (Nurb*)ptr->data;
+	Nurb *nu = (Nurb*)ptr->data;
 
 	nurbs_knot_calc_v(nu);
 
@@ -493,7 +501,7 @@ static void rna_Nurb_update_cyclic_v(Main *bmain, Scene *scene, PointerRNA *ptr)
 
 static void rna_Nurb_update_knot_u(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Nurb *nu= (Nurb*)ptr->data;
+	Nurb *nu = (Nurb*)ptr->data;
 
 	clamp_nurb_order_u(nu);
 	nurbs_knot_calc_u(nu);
@@ -503,7 +511,7 @@ static void rna_Nurb_update_knot_u(Main *bmain, Scene *scene, PointerRNA *ptr)
 
 static void rna_Nurb_update_knot_v(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Nurb *nu= (Nurb*)ptr->data;
+	Nurb *nu = (Nurb*)ptr->data;
 
 	clamp_nurb_order_v(nu);
 	nurbs_knot_calc_v(nu);
@@ -513,12 +521,13 @@ 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) {
+	if (nu->type == CU_BEZIER) {
 		BKE_report(reports, RPT_ERROR, "Bezier spline can't have points added");
 	}
-	else if(number==0) {
-		// do nothing
-	} else {
+	else if (number == 0) {
+		/* do nothing */
+	}
+	else {
 
 		addNurbPoints(nu, number);
 
@@ -531,12 +540,13 @@ static void rna_Curve_spline_points_add(ID *id, Nurb *nu, ReportList *reports, i
 
 static void rna_Curve_spline_bezpoints_add(ID *id, Nurb *nu, ReportList *reports, int number)
 {
-	if(nu->type != CU_BEZIER) {
+	if (nu->type != CU_BEZIER) {
 		BKE_report(reports, RPT_ERROR, "Only Bezier splines can be added");
 	}
-	else if(number==0) {
-		// do nothing
-	} else {
+	else if (number == 0) {
+		/* do nothing */
+	}
+	else {
 		addNurbPointsBezier(nu, number);
 
 		/* update */
@@ -548,26 +558,26 @@ static void rna_Curve_spline_bezpoints_add(ID *id, Nurb *nu, ReportList *reports
 
 static Nurb *rna_Curve_spline_new(Curve *cu, int type)
 {
-	Nurb *nu= ( Nurb * ) MEM_callocN( sizeof( Nurb ), "spline.new" );
+	Nurb *nu = (Nurb *) MEM_callocN( sizeof( Nurb ), "spline.new" );
 
-	if(type==CU_BEZIER) {
-		BezTriple *bezt= (BezTriple *)MEM_callocN(sizeof(BezTriple), "spline.new.bezt");
-		bezt->radius= 1.0;
-		nu->bezt= bezt;
+	if (type == CU_BEZIER) {
+		BezTriple *bezt = (BezTriple *)MEM_callocN(sizeof(BezTriple), "spline.new.bezt");
+		bezt->radius = 1.0;
+		nu->bezt = bezt;
 	}
 	else {
-		BPoint *bp= (BPoint *)MEM_callocN(sizeof(BPoint), "spline.new.bp");
-		bp->radius= 1.0f;
-		nu->bp= bp;
+		BPoint *bp = (BPoint *)MEM_callocN(sizeof(BPoint), "spline.new.bp");
+		bp->radius = 1.0f;
+		nu->bp = bp;
 	}
 
-	nu->type= type;
-	nu->pntsu= 1;
-	nu->pntsv= 1;
+	nu->type = type;
+	nu->pntsu = 1;
+	nu->pntsv = 1;
 
-	nu->orderu= nu->orderv= 4;
-	nu->resolu= nu->resolv= 12;
-	nu->flag= CU_SMOOTH;
+	nu->orderu = nu->orderv = 4;
+	nu->resolu = nu->resolv = 12;
+	nu->flag = CU_SMOOTH;
 
 	BLI_addtail(BKE_curve_nurbs(cu), nu);
 
@@ -576,12 +586,12 @@ static Nurb *rna_Curve_spline_new(Curve *cu, int type)
 
 static void rna_Curve_spline_remove(Curve *cu, ReportList *reports, Nurb *nu)
 {
-	int found= 0;
-	ListBase *nurbs= BKE_curve_nurbs(cu);
+	int found = 0;
+	ListBase *nurbs = BKE_curve_nurbs(cu);
 
-	found= BLI_remlink_safe(nurbs, nu);
+	found = BLI_remlink_safe(nurbs, nu);
 
-	if(!found) {
+	if (!found) {
 		BKE_reportf(reports, RPT_ERROR, "Curve \"%s\" does not contain spline given", cu->id.name+2);
 		return;
 	}
@@ -595,7 +605,7 @@ static void rna_Curve_spline_remove(Curve *cu, ReportList *reports, Nurb *nu)
 
 static void rna_Curve_spline_clear(Curve *cu)
 {
-	ListBase *nurbs= BKE_curve_nurbs(cu);
+	ListBase *nurbs = BKE_curve_nurbs(cu);
 
 	freeNurblist(nurbs);
 
@@ -605,14 +615,14 @@ static void rna_Curve_spline_clear(Curve *cu)
 
 static PointerRNA rna_Curve_active_spline_get(PointerRNA *ptr)
 {
-	Curve *cu= (Curve*)ptr->data;
+	Curve *cu = (Curve*)ptr->data;
 	Nurb *nu;
-	ListBase *nurbs= BKE_curve_nurbs(cu);
+	ListBase *nurbs = BKE_curve_nurbs(cu);
 
-	// for curve outside editmode will set to -1,  should be changed to be allowed outside of editmode.
-	nu= BLI_findlink(nurbs, cu->actnu);
+	/* for curve outside editmode will set to -1,  should be changed to be allowed outside of editmode. */
+	nu = BLI_findlink(nurbs, cu->actnu);
 
-	if(nu)
+	if (nu)
 		return rna_pointer_inherit_refine(ptr, &RNA_Spline, nu);
 
 	return rna_pointer_inherit_refine(ptr, NULL, NULL);
@@ -620,23 +630,23 @@ static PointerRNA rna_Curve_active_spline_get(PointerRNA *ptr)
 
 static void rna_Curve_active_spline_set(PointerRNA *ptr, PointerRNA value)
 {
-	Curve *cu= (Curve*)ptr->data;
-	Nurb *nu= value.data;
-	ListBase *nubase= BKE_curve_nurbs(cu);
+	Curve *cu = (Curve*)ptr->data;
+	Nurb *nu = value.data;
+	ListBase *nubase = BKE_curve_nurbs(cu);
 
 	/* -1 is ok for an unset index */
-	if(nu==NULL)
-		cu->actnu= -1;
+	if (nu == NULL)
+		cu->actnu = -1;
 	else
-		cu->actnu= BLI_findindex(nubase, nu);
+		cu->actnu = BLI_findindex(nubase, nu);
 }
 
 static char *rna_Curve_spline_path(PointerRNA *ptr)
 {
-	Curve *cu= (Curve*)ptr->id.data;
-	ListBase *nubase= BKE_curve_nurbs(cu);
-	Nurb *nu= ptr->data;
-	int index= BLI_findindex(nubase, nu);
+	Curve *cu = (Curve*)ptr->id.data;
+	ListBase *nubase = BKE_curve_nurbs(cu);
+	Nurb *nu = ptr->data;
+	int index = BLI_findindex(nubase, nu);
 
 	if (index >= 0)
 		return BLI_sprintfN("splines[%d]", index);
@@ -647,20 +657,20 @@ static char *rna_Curve_spline_path(PointerRNA *ptr)
 /* use for both bezier and nurbs */
 static char *rna_Curve_spline_point_path(PointerRNA *ptr)
 {
-	Curve *cu= (Curve*)ptr->id.data;
+	Curve *cu = (Curve*)ptr->id.data;
 	Nurb *nu;
-	void *point= ptr->data;
+	void *point = ptr->data;
 	int nu_index, pt_index;
 
-	nu= curve_nurb_from_point(cu, point, &nu_index, &pt_index);
+	nu = curve_nurb_from_point(cu, point, &nu_index, &pt_index);
 
 	if (nu) {
-		if(nu->type == CU_BEZIER) {
+		if (nu->type == CU_BEZIER) {
 			return BLI_sprintfN("splines[%d].bezier_points[%d]", nu_index, pt_index);
 		}
 		else {
 			return BLI_sprintfN("splines[%d].points[%d]", nu_index, pt_index);
-		}	
+		}
 	}
 	else {
 		return BLI_strdup("");
@@ -670,9 +680,9 @@ static char *rna_Curve_spline_point_path(PointerRNA *ptr)
 
 static char *rna_TextBox_path(PointerRNA *ptr)
 {
-	Curve *cu= (Curve*)ptr->id.data;
-	TextBox *tb= ptr->data;
-	int index= (int)(tb - cu->tb);
+	Curve *cu = (Curve*)ptr->id.data;
+	TextBox *tb = ptr->data;
+	int index = (int)(tb - cu->tb);
 
 	if (index >= 0 && index < cu->totbox)
 		return BLI_sprintfN("text_boxes[%d]", index);
@@ -682,7 +692,7 @@ static char *rna_TextBox_path(PointerRNA *ptr)
 
 static void rna_Curve_splines_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Curve *cu= (Curve*)ptr->id.data;
+	Curve *cu = (Curve*)ptr->id.data;
 	rna_iterator_listbase_begin(iter, BKE_curve_nurbs(cu), NULL);
 }
 
@@ -693,47 +703,48 @@ static void rna_def_bpoint(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "SplinePoint", NULL);
+	srna = RNA_def_struct(brna, "SplinePoint", NULL);
 	RNA_def_struct_sdna(srna, "BPoint");
 	RNA_def_struct_ui_text(srna, "SplinePoint", "Spline point without handles");
 
 	/* Boolean values */
-	prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "f1", 0);
 	RNA_def_property_ui_text(prop, "Select", "Selection status");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "hide", 0);
 	RNA_def_property_ui_text(prop, "Hide", "Visibility status");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
 	/* Vector value */
-	prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_float_sdna(prop, NULL, "vec");
 	RNA_def_property_ui_text(prop, "Point", "Point coordinates");
+	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "vec[3]");
 	RNA_def_property_ui_text(prop, "Weight", "NURBS weight");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
 	/* Number values */
-	prop= RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "alfa");
 	/*RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);*/
 	RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3D View");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "weight_softbody", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "weight_softbody", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "weight");
 	RNA_def_property_range(prop, 0.01f, 100.0f);
 	RNA_def_property_ui_text(prop, "Weight", "Softbody goal weight");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "radius");
 	RNA_def_property_range(prop, 0.0f, FLT_MAX);
 	RNA_def_property_ui_text(prop, "Bevel Radius", "Radius for bevelling");
@@ -747,76 +758,79 @@ static void rna_def_beztriple(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "BezierSplinePoint", NULL);
+	srna = RNA_def_struct(brna, "BezierSplinePoint", NULL);
 	RNA_def_struct_sdna(srna, "BezTriple");
 	RNA_def_struct_ui_text(srna, "Bezier Curve Point", "Bezier curve point with two handles");
 
 	/* Boolean values */
-	prop= RNA_def_property(srna, "select_left_handle", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select_left_handle", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "f1", 0);
 	RNA_def_property_ui_text(prop, "Handle 1 selected", "Handle 1 selection status");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "select_right_handle", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select_right_handle", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "f3", 0);
 	RNA_def_property_ui_text(prop, "Handle 2 selected", "Handle 2 selection status");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "select_control_point", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select_control_point", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "f2", 0);
 	RNA_def_property_ui_text(prop, "Control Point selected", "Control point selection status");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "hide", 0);
 	RNA_def_property_ui_text(prop, "Hide", "Visibility status");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
 	/* Enums */
-	prop= RNA_def_property(srna, "handle_left_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "handle_left_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "h1");
 	RNA_def_property_enum_items(prop, beztriple_handle_type_items);
 	RNA_def_property_ui_text(prop, "Handle 1 Type", "Handle types");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_points");
 
-	prop= RNA_def_property(srna, "handle_right_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "handle_right_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "h2");
 	RNA_def_property_enum_items(prop, beztriple_handle_type_items);
 	RNA_def_property_ui_text(prop, "Handle 2 Type", "Handle types");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_points");
 
 	/* Vector values */
-	prop= RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_float_funcs(prop, "rna_BezTriple_handle1_get", "rna_BezTriple_handle1_set", NULL);
 	RNA_def_property_ui_text(prop, "Handle 1", "Coordinates of the first handle");
+	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
 	RNA_def_property_update(prop, 0, "rna_Curve_update_points");
 
-	prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_float_funcs(prop, "rna_BezTriple_ctrlpoint_get", "rna_BezTriple_ctrlpoint_set", NULL);
 	RNA_def_property_ui_text(prop, "Control Point", "Coordinates of the control point");
+	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
 	RNA_def_property_update(prop, 0, "rna_Curve_update_points");
 
-	prop= RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_float_funcs(prop, "rna_BezTriple_handle2_get", "rna_BezTriple_handle2_set", NULL);
 	RNA_def_property_ui_text(prop, "Handle 2", "Coordinates of the second handle");
+	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
 	RNA_def_property_update(prop, 0, "rna_Curve_update_points");
 
 	/* Number values */
-	prop= RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "alfa");
 	/*RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);*/
 	RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3D View");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.01f, 100.0f);
 	RNA_def_property_ui_text(prop, "Weight", "Softbody goal weight");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "radius");
 	RNA_def_property_range(prop, 0.0f, FLT_MAX);
 	RNA_def_property_ui_text(prop, "Bevel Radius", "Radius for bevelling");
@@ -830,41 +844,47 @@ static void rna_def_path(BlenderRNA *brna, StructRNA *srna)
 	PropertyRNA *prop;
 	
 	/* number values */
-	prop= RNA_def_property(srna, "path_duration", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "path_duration", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "pathlen");
 	RNA_def_property_range(prop, 1, MAXFRAME);
-	RNA_def_property_ui_text(prop, "Path Length", "The number of frames that are needed to traverse the path, defining the maximum value for the 'Evaluation Time' setting");
+	RNA_def_property_ui_text(prop, "Path Length",
+	                         "The number of frames that are needed to traverse the path, "
+	                         "defining the maximum value for the 'Evaluation Time' setting");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
 	/* flags */
-	prop= RNA_def_property(srna, "use_path", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_path", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_PATH);
 	RNA_def_property_ui_text(prop, "Path", "Enable the curve to become a translation path");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
-	prop= RNA_def_property(srna, "use_path_follow", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_path_follow", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FOLLOW);
 	RNA_def_property_ui_text(prop, "Follow", "Make curve path children to rotate along the path");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
-	prop= RNA_def_property(srna, "use_stretch", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_stretch", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_STRETCH);
-	RNA_def_property_ui_text(prop, "Stretch", "Option for curve-deform: make deformed child to stretch along entire path");
+	RNA_def_property_ui_text(prop, "Stretch", "Option for curve-deform: "
+	                         "make deformed child to stretch along entire path");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "use_deform_bounds", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_deform_bounds", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CU_DEFORM_BOUNDS_OFF);
-	RNA_def_property_ui_text(prop, "Bounds Clamp", "Use the mesh bounds to clamp the deformation");
-	RNA_def_property_update(prop, 0, "rna_Curve_update_data");	
+	RNA_def_property_ui_text(prop, "Bounds Clamp", "Option for curve-deform: "
+	                         "Use the mesh bounds to clamp the deformation");
+	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "use_time_offset", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_time_offset", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_OFFS_PATHDIST);
-	RNA_def_property_ui_text(prop, "Offset Path Distance", "Children will use TimeOffs value as path distance offset");
+	RNA_def_property_ui_text(prop, "Offset Path Distance",
+	                         "Children will use TimeOffs value as path distance offset");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "use_radius", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_radius", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_PATH_RADIUS);
-	RNA_def_property_ui_text(prop, "Radius", "Option for paths: apply the curve radius with path following it and deforming");
+	RNA_def_property_ui_text(prop, "Radius", "Option for paths and curve-deform: "
+	                         "apply the curve radius with path following it and deforming");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 }
 
@@ -873,7 +893,7 @@ static void rna_def_nurbs(BlenderRNA *brna, StructRNA *srna)
 	PropertyRNA *prop;
 	
 	/* flags */
-	prop= RNA_def_property(srna, "use_uv_as_generated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_uv_as_generated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_UV_ORCO);
 	RNA_def_property_ui_text(prop, "Use UV for Mapping", "Uses the UV values as Generated textured coordinates");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
@@ -892,141 +912,144 @@ static void rna_def_font(BlenderRNA *brna, StructRNA *srna)
 		{0, NULL, 0, NULL, NULL}};
 		
 	/* Enums */
-	prop= RNA_def_property(srna, "align", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "align", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "spacemode");
 	RNA_def_property_enum_items(prop, prop_align_items);
 	RNA_def_property_ui_text(prop, "Text Align", "Text align from the object center");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
 	/* number values */
-	prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "fsize");
 	RNA_def_property_range(prop, 0.0001f, 10000.0f);
 	RNA_def_property_ui_range(prop, 0.01, 10, 1, 3);
 	RNA_def_property_ui_text(prop, "Font size", "");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
-	prop= RNA_def_property(srna, "small_caps_scale", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "small_caps_scale", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "smallcaps_scale");
 	RNA_def_property_ui_range(prop, 0, 1.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Small Caps", "Scale of small capitals");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "space_line", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "space_line", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "linedist");
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Distance between lines of text", "");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
-	prop= RNA_def_property(srna, "space_word", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "space_word", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "wordspace");
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Spacing between words", "");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
-	prop= RNA_def_property(srna, "space_character", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "space_character", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "spacing");
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Global spacing between characters", "");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
-	prop= RNA_def_property(srna, "shear", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "shear", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "shear");
 	RNA_def_property_range(prop, -1.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Shear", "Italic angle of the characters");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
-	prop= RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "xof");
 	RNA_def_property_range(prop, -50.0f, 50.0f);
 	RNA_def_property_ui_text(prop, "X Offset", "Horizontal offset from the object origin");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
-	prop= RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "yof");
 	RNA_def_property_range(prop, -50.0f, 50.0f);
 	RNA_def_property_ui_text(prop, "Y Offset", "Vertical offset from the object origin");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
-	prop= RNA_def_property(srna, "underline_position", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "underline_position", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "ulpos");
 	RNA_def_property_range(prop, -0.2f, 0.8f);
 	RNA_def_property_ui_text(prop, "Underline Position", "Vertical position of underline");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
-	prop= RNA_def_property(srna, "underline_height", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "underline_height", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "ulheight");
 	RNA_def_property_range(prop, -0.2f, 0.8f);
 	RNA_def_property_ui_text(prop, "Underline Thickness", "");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
-	prop= RNA_def_property(srna, "text_boxes", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "text_boxes", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "tb", "totbox");
 	RNA_def_property_struct_type(prop, "TextBox");
 	RNA_def_property_ui_text(prop, "Textboxes", "");
 
-	prop= RNA_def_property(srna, "active_textbox", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "active_textbox", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "actbox");
 	RNA_def_property_ui_text(prop, "The active text box", "");
 	RNA_def_property_int_funcs(prop, NULL, NULL, "rna_Curve_active_textbox_index_range");
 	
 	/* strings */
-	prop= RNA_def_property(srna, "family", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "family", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_maxlength(prop, MAX_ID_NAME-2);
-	RNA_def_property_ui_text(prop, "Object Font", "Use Blender Objects as font characters (give font objects a common name followed by the character they represent, eg. familya, familyb, etc, and turn on Verts Duplication)");
+	RNA_def_property_ui_text(prop, "Object Font",
+	                         "Use Blender Objects as font characters (give font objects a common name "
+	                         "followed by the character they represent, eg. familya, familyb, etc, "
+	                         "and turn on Verts Duplication)");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
-	prop= RNA_def_property(srna, "body", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "body", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "str");
 	RNA_def_property_ui_text(prop, "Body Text", "Content of this text object");
 	RNA_def_property_string_funcs(prop, "rna_Curve_body_get", "rna_Curve_body_length", "rna_Curve_body_set");
 	RNA_def_property_string_maxlength(prop, 8192); /* note that originally str did not have a limit! */
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "body_format", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "body_format", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "strinfo", "len");
 	RNA_def_property_struct_type(prop, "TextCharacterFormat");
 	RNA_def_property_ui_text(prop, "Character Info", "Stores the style of each character");
 	
 	/* pointers */
-	prop= RNA_def_property(srna, "follow_curve", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "follow_curve", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "textoncurve");
 	RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Curve_otherObject_poll");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Text on Curve", "Curve deforming text object");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_deps");
 	
-	prop= RNA_def_property(srna, "font", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "font", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "vfont");
 	RNA_def_property_ui_text(prop, "Font", "");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "font_bold", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "font_bold", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "vfontb");
 	RNA_def_property_ui_text(prop, "Font Bold", "");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "font_italic", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "font_italic", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "vfonti");
 	RNA_def_property_ui_text(prop, "Font Italic", "");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "font_bold_italic", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "font_bold_italic", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "vfontbi");
 	RNA_def_property_ui_text(prop, "Font Bold Italic", "");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "edit_format", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "edit_format", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "curinfo");
 	RNA_def_property_ui_text(prop, "Edit Format", "Editing settings character formatting");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
 	/* flags */
-	prop= RNA_def_property(srna, "use_fast_edit", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_fast_edit", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FAST);
 	RNA_def_property_ui_text(prop, "Fast Editing", "Don't fill polygons while editing");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
@@ -1037,29 +1060,29 @@ static void rna_def_textbox(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "TextBox", NULL);
+	srna = RNA_def_struct(brna, "TextBox", NULL);
 	RNA_def_struct_ui_text(srna, "Text Box", "Text bounding box for layout");
 	
 	/* number values */
-	prop= RNA_def_property(srna, "x", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "x");
 	RNA_def_property_range(prop, -50.0f, 50.0f);
 	RNA_def_property_ui_text(prop, "Textbox X Offset", "");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
-	prop= RNA_def_property(srna, "y", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "y");
 	RNA_def_property_range(prop, -50.0f, 50.0f);
 	RNA_def_property_ui_text(prop, "Textbox Y Offset", "");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "width", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "w");
 	RNA_def_property_range(prop, 0.0f, 50.0f);
 	RNA_def_property_ui_text(prop, "Textbox Width", "");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "h");
 	RNA_def_property_range(prop, 0.0f, 50.0f);
 	RNA_def_property_ui_text(prop, "Textbox Height", "");
@@ -1073,22 +1096,22 @@ static void rna_def_charinfo(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "TextCharacterFormat", NULL);
+	srna = RNA_def_struct(brna, "TextCharacterFormat", NULL);
 	RNA_def_struct_sdna(srna, "CharInfo");
 	RNA_def_struct_ui_text(srna, "Text Character Format", "Text character formatting settings");
 	
 	/* flags */
-	prop= RNA_def_property(srna, "use_bold", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_bold", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_CHINFO_BOLD);
 	RNA_def_property_ui_text(prop, "Bold", "");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
-	prop= RNA_def_property(srna, "use_italic", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_italic", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_CHINFO_ITALIC);
 	RNA_def_property_ui_text(prop, "Italic", "");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
-	prop= RNA_def_property(srna, "use_underline", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_underline", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_CHINFO_UNDERLINE);
 	RNA_def_property_ui_text(prop, "Underline", "");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
@@ -1099,7 +1122,7 @@ static void rna_def_charinfo(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Wrap", "");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data"); */
 
-	prop= RNA_def_property(srna, "use_small_caps", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_small_caps", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_CHINFO_SMALLCAPS);
 	RNA_def_property_ui_text(prop, "Small Caps", "");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
@@ -1109,7 +1132,7 @@ static void rna_def_surface(BlenderRNA *brna)
 {
 	StructRNA *srna;
 	
-	srna= RNA_def_struct(brna, "SurfaceCurve", "Curve");
+	srna = RNA_def_struct(brna, "SurfaceCurve", "Curve");
 	RNA_def_struct_sdna(srna, "Curve");
 	RNA_def_struct_ui_text(srna, "Surface Curve", "Curve datablock used for storing surfaces");
 	RNA_def_struct_ui_icon(srna, ICON_SURFACE_DATA);
@@ -1121,7 +1144,7 @@ static void rna_def_text(BlenderRNA *brna)
 {
 	StructRNA *srna;
 	
-	srna= RNA_def_struct(brna, "TextCurve", "Curve");
+	srna = RNA_def_struct(brna, "TextCurve", "Curve");
 	RNA_def_struct_sdna(srna, "Curve");
 	RNA_def_struct_ui_text(srna, "Text Curve", "Curve datablock used for storing text");
 	RNA_def_struct_ui_icon(srna, ICON_FONT_DATA);
@@ -1135,17 +1158,17 @@ static void rna_def_text(BlenderRNA *brna)
 static void rna_def_curve_spline_points(BlenderRNA *brna, PropertyRNA *cprop)
 {
 	StructRNA *srna;
-	//PropertyRNA *prop;
+	/*PropertyRNA *prop; */
 
 	FunctionRNA *func;
-	//PropertyRNA *parm;
+	/*PropertyRNA *parm; */
 
 	RNA_def_property_srna(cprop, "SplinePoints");
-	srna= RNA_def_struct(brna, "SplinePoints", NULL);
+	srna = RNA_def_struct(brna, "SplinePoints", NULL);
 	RNA_def_struct_sdna(srna, "Nurb");
 	RNA_def_struct_ui_text(srna, "Spline Points", "Collection of spline points");
 
-	func= RNA_def_function(srna, "add", "rna_Curve_spline_points_add");
+	func = RNA_def_function(srna, "add", "rna_Curve_spline_points_add");
 	RNA_def_function_ui_description(func, "Add a number of points to this spline");
 	RNA_def_function_flag(func, FUNC_USE_SELF_ID|FUNC_USE_REPORTS);
 	RNA_def_int(func, "count", 1, 1, INT_MAX, "Number", "Number of points to add to the spline", 1, INT_MAX);
@@ -1162,28 +1185,28 @@ static void rna_def_curve_spline_points(BlenderRNA *brna, PropertyRNA *cprop)
 static void rna_def_curve_spline_bezpoints(BlenderRNA *brna, PropertyRNA *cprop)
 {
 	StructRNA *srna;
-	//PropertyRNA *prop;
+	/*PropertyRNA *prop; */
 
 	FunctionRNA *func;
-	//PropertyRNA *parm;
+	/*PropertyRNA *parm; */
 
 	RNA_def_property_srna(cprop, "SplineBezierPoints");
-	srna= RNA_def_struct(brna, "SplineBezierPoints", NULL);
+	srna = RNA_def_struct(brna, "SplineBezierPoints", NULL);
 	RNA_def_struct_sdna(srna, "Nurb");
 	RNA_def_struct_ui_text(srna, "Spline Bezier Points", "Collection of spline bezirt points");
 
-	func= RNA_def_function(srna, "add", "rna_Curve_spline_bezpoints_add");
+	func = RNA_def_function(srna, "add", "rna_Curve_spline_bezpoints_add");
 	RNA_def_function_ui_description(func, "Add a number of points to this spline");
 	RNA_def_function_flag(func, FUNC_USE_SELF_ID|FUNC_USE_REPORTS);
 	RNA_def_int(func, "count", 1, INT_MIN, 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");
 	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);
-	*/
+#endif
 }
 
 /* curve.splines */
@@ -1196,27 +1219,27 @@ static void rna_def_curve_splines(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, "CurveSplines");
-	srna= RNA_def_struct(brna, "CurveSplines", NULL);
+	srna = RNA_def_struct(brna, "CurveSplines", NULL);
 	RNA_def_struct_sdna(srna, "Curve");
 	RNA_def_struct_ui_text(srna, "Curve Splines", "Collection of curve splines");
 
-	func= RNA_def_function(srna, "new", "rna_Curve_spline_new");
+	func = RNA_def_function(srna, "new", "rna_Curve_spline_new");
 	RNA_def_function_ui_description(func, "Add a new spline to the curve");
-	parm= RNA_def_enum(func, "type", curve_type_items, CU_POLY, "", "type for the new spline");
+	parm = RNA_def_enum(func, "type", curve_type_items, CU_POLY, "", "type for the new spline");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_pointer(func, "spline", "Spline", "", "The newly created spline");
+	parm = RNA_def_pointer(func, "spline", "Spline", "", "The newly created spline");
 	RNA_def_function_return(func, parm);
 
-	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");
+	parm = RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "clear", "rna_Curve_spline_clear");
+	func = RNA_def_function(srna, "clear", "rna_Curve_spline_clear");
 	RNA_def_function_ui_description(func, "Remove all spline from a curve");
 
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_pointer_funcs(prop, "rna_Curve_active_spline_get", "rna_Curve_active_spline_set", NULL, NULL);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
@@ -1238,40 +1261,43 @@ static void rna_def_curve(BlenderRNA *brna)
 			{CU_TWIST_TANGENT, "TANGENT", 0, "Tangent", "Use the tangent to calculate twist"},
 			{0, NULL, 0, NULL, NULL}};
 
-	static const EnumPropertyItem curve_axis_items[]= {
+	static const EnumPropertyItem curve_axis_items[] = {
 		{0, "2D", 0, "2D", "Clamp the Z axis of the curve"},
-		{CU_3D, "3D", 0, "3D", "Allow editing on the Z axis of this curve, also allows tilt and curve radius to be used"},
+		{CU_3D, "3D", 0, "3D",
+		        "Allow editing on the Z axis of this curve, also allows tilt and curve radius to be used"},
 		{0, NULL, 0, NULL, NULL}};
 			
-	srna= RNA_def_struct(brna, "Curve", "ID");
+	srna = RNA_def_struct(brna, "Curve", "ID");
 	RNA_def_struct_ui_text(srna, "Curve", "Curve datablock storing curves, splines and NURBS");
 	RNA_def_struct_ui_icon(srna, ICON_CURVE_DATA);
 	RNA_def_struct_refine_func(srna, "rna_Curve_refine");
 	
 	rna_def_animdata_common(srna);
 
-	prop= RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "key");
 	RNA_def_property_ui_text(prop, "Shape Keys", "");
 
 
-	prop= RNA_def_property(srna, "splines", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "splines", PROP_COLLECTION, PROP_NONE);
 #if 0
 	RNA_def_property_collection_sdna(prop, NULL, "nurb", NULL);
 #else
 	/* this way we get editmode nurbs too, keyframe in editmode */
-	RNA_def_property_collection_funcs(prop, "rna_Curve_splines_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL);
+	RNA_def_property_collection_funcs(prop, "rna_Curve_splines_begin", "rna_iterator_listbase_next",
+	                                  "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+	                                  NULL, NULL, NULL, NULL);
 #endif
 	RNA_def_property_struct_type(prop, "Spline");
 	RNA_def_property_ui_text(prop, "Splines", "Collection of splines in this curve data object");
 	rna_def_curve_splines(brna, prop);
 
-	prop= RNA_def_property(srna, "show_handles", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_handles", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "drawflag", CU_HIDE_HANDLES);
 	RNA_def_property_ui_text(prop, "Draw Handles", "Display Bezier handles in editmode");
 	RNA_def_property_update(prop, NC_GEOM|ND_DATA, NULL);
 
-	prop= RNA_def_property(srna, "show_normal_face", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_normal_face", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "drawflag", CU_HIDE_NORMALS);
 	RNA_def_property_ui_text(prop, "Draw Normals", "Display 3D curve normals in editmode");
 	RNA_def_property_update(prop, NC_GEOM|ND_DATA, NULL);
@@ -1279,156 +1305,166 @@ static void rna_def_curve(BlenderRNA *brna)
 	rna_def_path(brna, srna);
 	
 	/* Number values */
-	prop= RNA_def_property(srna, "bevel_resolution", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "bevel_resolution", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "bevresol");
 	RNA_def_property_range(prop, 0, 32);
 	RNA_def_property_ui_range(prop, 0, 32, 1.0, 0);
-	RNA_def_property_ui_text(prop, "Bevel Resolution", "Bevel resolution when depth is non-zero and no specific bevel object has been defined");
+	RNA_def_property_ui_text(prop, "Bevel Resolution",
+	                         "Bevel resolution when depth is non-zero and no specific bevel object has been defined");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
-	prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE|PROP_UNIT_LENGTH);
+	prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE|PROP_UNIT_LENGTH);
 	RNA_def_property_float_sdna(prop, NULL, "width");
 	RNA_def_property_ui_range(prop, -1.0, 1.0, 0.1, 3);
 	RNA_def_property_float_funcs(prop, "rna_Curve_offset_get", "rna_Curve_offset_set", NULL);
 	RNA_def_property_ui_text(prop, "Offset", "Offset the curve to adjust the width of a text");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
-	prop= RNA_def_property(srna, "extrude", PROP_FLOAT, PROP_NONE|PROP_UNIT_LENGTH);
+	prop = RNA_def_property(srna, "extrude", PROP_FLOAT, PROP_NONE|PROP_UNIT_LENGTH);
 	RNA_def_property_float_sdna(prop, NULL, "ext1");
 	RNA_def_property_ui_range(prop, 0, 100.0, 0.1, 3);
 	RNA_def_property_range(prop, 0.0, FLT_MAX);
 	RNA_def_property_ui_text(prop, "Extrude", "Amount of curve extrusion when not using a bevel object");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
-	prop= RNA_def_property(srna, "bevel_depth", PROP_FLOAT, PROP_NONE|PROP_UNIT_LENGTH);
+	prop = RNA_def_property(srna, "bevel_depth", PROP_FLOAT, PROP_NONE|PROP_UNIT_LENGTH);
 	RNA_def_property_float_sdna(prop, NULL, "ext2");
 	RNA_def_property_ui_range(prop, 0, 100.0, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Bevel Depth", "Bevel depth when not using a bevel object");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
-	prop= RNA_def_property(srna, "resolution_u", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "resolution_u", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "resolu");
 	RNA_def_property_range(prop, 1, SHRT_MAX);
 	RNA_def_property_ui_range(prop, 1, 64, 1, 0);
 	RNA_def_property_ui_text(prop, "Resolution U", "Surface resolution in U direction");
 	RNA_def_property_update(prop, 0, "rna_Curve_resolution_u_update_data");
 	
-	prop= RNA_def_property(srna, "resolution_v", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "resolution_v", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "resolv");
 	RNA_def_property_ui_range(prop, 1, 64, 1, 0);
 	RNA_def_property_range(prop, 1, SHRT_MAX);
 	RNA_def_property_ui_text(prop, "Resolution V", "Surface resolution in V direction");
 	RNA_def_property_update(prop, 0, "rna_Curve_resolution_v_update_data");
 	
-	prop= RNA_def_property(srna, "render_resolution_u", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "render_resolution_u", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "resolu_ren");
 	RNA_def_property_range(prop, 0, SHRT_MAX);
 	RNA_def_property_ui_range(prop, 0, 64, 1, 0);
-	RNA_def_property_ui_text(prop, "Render Resolution U", "Surface resolution in U direction used while rendering (zero skips this property)");
+	RNA_def_property_ui_text(prop, "Render Resolution U",
+	                         "Surface resolution in U direction used while rendering (zero skips this property)");
 	
-	prop= RNA_def_property(srna, "render_resolution_v", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "render_resolution_v", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "resolv_ren");
 	RNA_def_property_ui_range(prop, 0, 64, 1, 0);
 	RNA_def_property_range(prop, 0, SHRT_MAX);
-	RNA_def_property_ui_text(prop, "Render Resolution V", "Surface resolution in V direction used while rendering (zero skips this property)");
+	RNA_def_property_ui_text(prop, "Render Resolution V",
+	                         "Surface resolution in V direction used while rendering (zero skips this property)");
 	
 	
-	prop= RNA_def_property(srna, "eval_time", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "eval_time", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "ctime");
-	RNA_def_property_ui_text(prop, "Evaluation Time", "Parametric position along the length of the curve that Objects 'following' it should be at (position is evaluated by dividing by the 'Path Length' value)");
+	RNA_def_property_ui_text(prop, "Evaluation Time",
+	                         "Parametric position along the length of the curve that Objects 'following' it should be "
+	                         "at (position is evaluated by dividing by the 'Path Length' value)");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
 	/* pointers */
-	prop= RNA_def_property(srna, "bevel_object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "bevel_object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_pointer_sdna(prop, NULL, "bevobj");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Bevel Object", "Curve object name that defines the bevel shape");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_deps");
-	RNA_def_property_pointer_funcs(prop, "rna_Curve_bevelObject_get", "rna_Curve_bevelObject_set", NULL, "rna_Curve_otherObject_poll");
+	RNA_def_property_pointer_funcs(prop, "rna_Curve_bevelObject_get", "rna_Curve_bevelObject_set", NULL,
+	                               "rna_Curve_otherObject_poll");
 
-	prop= RNA_def_property(srna, "taper_object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "taper_object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_pointer_sdna(prop, NULL, "taperobj");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Taper Object", "Curve object name that defines the taper (width)");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_deps");
-	RNA_def_property_pointer_funcs(prop, "rna_Curve_taperObject_get", "rna_Curve_taperObject_set", NULL, "rna_Curve_otherObject_poll");
+	RNA_def_property_pointer_funcs(prop, "rna_Curve_taperObject_get", "rna_Curve_taperObject_set", NULL,
+	                               "rna_Curve_otherObject_poll");
 
 	/* Flags */
 
-	prop= RNA_def_property(srna, "dimensions", PROP_ENUM, PROP_NONE); /* as an enum */
+	prop = RNA_def_property(srna, "dimensions", PROP_ENUM, PROP_NONE); /* as an enum */
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, curve_axis_items);
 	RNA_def_property_enum_funcs(prop, NULL, "rna_Curve_dimension_set", NULL);
 	RNA_def_property_ui_text(prop, "Dimensions", "Select 2D or 3D curve type");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
-	prop= RNA_def_property(srna, "fill_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "fill_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, curve3d_fill_mode_items);
 	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Curve_fill_mode_itemf");
 	RNA_def_property_ui_text(prop, "Fill Mode", "Mode of filling curve");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "twist_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "twist_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "twist_mode");
 	RNA_def_property_enum_items(prop, curve_twist_mode_items);
 	RNA_def_property_ui_text(prop, "Twist Method", "The type of tilt calculation for 3D Curves");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	// XXX - would be nice to have a better way to do this, only add for testing.
-	prop= RNA_def_property(srna, "twist_smooth", PROP_FLOAT, PROP_NONE);
+	/* XXX - would be nice to have a better way to do this, only add for testing. */
+	prop = RNA_def_property(srna, "twist_smooth", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "twist_smooth");
 	RNA_def_property_ui_range(prop, 0, 100.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Twist Smooth", "Smoothing iteration for tangents");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "use_fill_deform", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_fill_deform", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_DEFORM_FILL);
 	RNA_def_property_ui_text(prop, "Fill Deformed", "Fill curve after applying shape keys and all modifiers");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "use_fill_caps", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_fill_caps", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FILL_CAPS);
 	RNA_def_property_ui_text(prop, "Fill Caps", "Fill caps for bevelled curves");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
 	/* texture space */
-	prop= RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "texflag", CU_AUTOSPACE);
-	RNA_def_property_ui_text(prop, "Auto Texture Space", "Adjust active object's texture space automatically when transforming object");
+	RNA_def_property_ui_text(prop, "Auto Texture Space",
+	                         "Adjust active object's texture space automatically when transforming object");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Curve_texspace_set");
 
-	prop= RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space location");
+	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
 	RNA_def_property_editable_func(prop, "rna_Curve_texspace_editable");
-	RNA_def_property_float_funcs(prop, "rna_Curve_texspace_loc_get", "rna_Curve_texspace_loc_set", NULL);	
+	RNA_def_property_float_funcs(prop, "rna_Curve_texspace_loc_get", "rna_Curve_texspace_loc_set", NULL);
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
-	prop= RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space size");
 	RNA_def_property_editable_func(prop, "rna_Curve_texspace_editable");
 	RNA_def_property_float_funcs(prop, "rna_Curve_texspace_size_get", "rna_Curve_texspace_size_set", NULL);
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
-	/* not supported yet
+	/* not supported yet */
+#if 0
 	prop= RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER);
 	RNA_def_property_float(prop, NULL, "rot");
 	RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation");
 	RNA_def_property_editable_func(prop, texspace_editable);
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-	*/
+#endif
 	
-	prop= RNA_def_property(srna, "use_uv_as_generated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_uv_as_generated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_UV_ORCO);
 	RNA_def_property_ui_text(prop, "Use UV for mapping", "Uses the UV values as Generated textured coordinates");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
 	/* materials */
-	prop= RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
 	RNA_def_property_struct_type(prop, "Material");
 	RNA_def_property_ui_text(prop, "Materials", "");
@@ -1448,135 +1484,151 @@ static void rna_def_curve_nurb(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "Spline", NULL);
+	srna = RNA_def_struct(brna, "Spline", NULL);
 	RNA_def_struct_sdna(srna, "Nurb");
-	RNA_def_struct_ui_text(srna, "Spline", "Element of a curve, either NURBS, Bezier or Polyline or a character with text objects");
+	RNA_def_struct_ui_text(srna, "Spline",
+	                       "Element of a curve, either NURBS, Bezier or Polyline or a character with text objects");
 
-	prop= RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "bp", NULL);
 	RNA_def_property_struct_type(prop, "SplinePoint");
-	RNA_def_property_collection_funcs(prop, "rna_BPoint_array_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_Nurb_length", NULL, NULL, NULL);
+	RNA_def_property_collection_funcs(prop, "rna_BPoint_array_begin", "rna_iterator_array_next",
+	                                  "rna_iterator_array_end", "rna_iterator_array_get", "rna_Nurb_length",
+	                                  NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Points", "Collection of points that make up this poly or nurbs spline");
 	rna_def_curve_spline_points(brna, prop);
 
-	prop= RNA_def_property(srna, "bezier_points", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "bezier_points", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "BezierSplinePoint");
 	RNA_def_property_collection_sdna(prop, NULL, "bezt", "pntsu");
 	RNA_def_property_ui_text(prop, "Bezier Points", "Collection of points for Bezier curves only");
 	rna_def_curve_spline_bezpoints(brna, prop);
 
 	
-	prop= RNA_def_property(srna, "tilt_interpolation", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "tilt_interpolation", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "tilt_interp");
 	RNA_def_property_enum_items(prop, spline_interpolation_items);
 	RNA_def_property_ui_text(prop, "Tilt Interpolation", "The type of tilt interpolation for 3D, Bezier curves");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "radius_interpolation", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "radius_interpolation", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "radius_interp");
 	RNA_def_property_enum_items(prop, spline_interpolation_items);
 	RNA_def_property_ui_text(prop, "Radius Interpolation", "The type of radius interpolation for Bezier curves");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, curve_type_items);
 	RNA_def_property_enum_funcs(prop, NULL, "rna_Nurb_type_set", NULL);
 	RNA_def_property_ui_text(prop, "Type", "The interpolation type for this curve element");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "point_count_u", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "point_count_u", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/
 	RNA_def_property_int_sdna(prop, NULL, "pntsu");
 	RNA_def_property_ui_text(prop, "Points U", "Total number points for the curve or surface in the U direction");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "point_count_v", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "point_count_v", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/
 	RNA_def_property_int_sdna(prop, NULL, "pntsv");
 	RNA_def_property_ui_text(prop, "Points V", "Total number points for the surface on the V direction");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
 
-	prop= RNA_def_property(srna, "order_u", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "order_u", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "orderu");
 	RNA_def_property_range(prop, 2, 6);
-	RNA_def_property_ui_text(prop, "Order U", "NURBS order in the U direction (for splines and surfaces, higher values let points influence a greater area)");
+	RNA_def_property_ui_text(prop, "Order U",
+	                         "NURBS order in the U direction (for splines and surfaces, higher values "
+	                         "let points influence a greater area)");
 	RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
 
-	prop= RNA_def_property(srna, "order_v", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "order_v", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "orderv");
 	RNA_def_property_range(prop, 2, 6);
-	RNA_def_property_ui_text(prop, "Order V", "NURBS order in the V direction (for surfaces only, higher values let points influence a greater area)");
+	RNA_def_property_ui_text(prop, "Order V",
+	                         "NURBS order in the V direction (for surfaces only, higher values "
+	                         "let points influence a greater area)");
 	RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
 
 
-	prop= RNA_def_property(srna, "resolution_u", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "resolution_u", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "resolu");
 	RNA_def_property_range(prop, 1, SHRT_MAX);
 	RNA_def_property_ui_range(prop, 1, 64, 1, 0);
 	RNA_def_property_ui_text(prop, "Resolution U", "Curve or Surface subdivisions per segment");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "resolution_v", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "resolution_v", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "resolv");
 	RNA_def_property_range(prop, 1, SHRT_MAX);
 	RNA_def_property_ui_range(prop, 1, 64, 1, 0);
 	RNA_def_property_ui_text(prop, "Resolution V", "Surface subdivisions per segment");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "use_cyclic_u", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_cyclic_u", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_CYCLIC);
 	RNA_def_property_ui_text(prop, "Cyclic U", "Make this curve or surface a closed loop in the U direction");
 	RNA_def_property_update(prop, 0, "rna_Nurb_update_cyclic_u");
 
-	prop= RNA_def_property(srna, "use_cyclic_v", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_cyclic_v", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_CYCLIC);
 	RNA_def_property_ui_text(prop, "Cyclic V", "Make this surface a closed loop in the V direction");
 	RNA_def_property_update(prop, 0, "rna_Nurb_update_cyclic_v");
 
 
 	/* Note, endpoint and bezier flags should never be on at the same time! */
-	prop= RNA_def_property(srna, "use_endpoint_u", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_endpoint_u", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_ENDPOINT);
-	RNA_def_property_ui_text(prop, "Endpoint U", "Make this nurbs curve or surface meet the endpoints in the U direction (Cyclic U must be disabled)");
+	RNA_def_property_ui_text(prop, "Endpoint U",
+	                         "Make this nurbs curve or surface meet the endpoints in the U direction "
+	                         "(Cyclic U must be disabled)");
 	RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
 
-	prop= RNA_def_property(srna, "use_endpoint_v", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_endpoint_v", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_ENDPOINT);
-	RNA_def_property_ui_text(prop, "Endpoint V", "Make this nurbs surface meet the endpoints in the V direction (Cyclic V must be disabled)");
+	RNA_def_property_ui_text(prop, "Endpoint V",
+	                         "Make this nurbs surface meet the endpoints in the V direction "
+	                         "(Cyclic V must be disabled)");
 	RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
 
-	prop= RNA_def_property(srna, "use_bezier_u", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_bezier_u", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_BEZIER);
-	RNA_def_property_ui_text(prop, "Bezier U", "Make this nurbs curve or surface act like a Bezier spline in the U direction (Order U must be 3 or 4, Cyclic U must be disabled)");
+	RNA_def_property_ui_text(prop, "Bezier U",
+	                         "Make this nurbs curve or surface act like a Bezier spline in the U direction "
+	                         "(Order U must be 3 or 4, Cyclic U must be disabled)");
 	RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
 
-	prop= RNA_def_property(srna, "use_bezier_v", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_bezier_v", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_BEZIER);
-	RNA_def_property_ui_text(prop, "Bezier V", "Make this nurbs surface act like a Bezier spline in the V direction (Order V must be 3 or 4, Cyclic V must be disabled)");
+	RNA_def_property_ui_text(prop, "Bezier V",
+	                         "Make this nurbs surface act like a Bezier spline in the V direction "
+	                         "(Order V must be 3 or 4, Cyclic V must be disabled)");
 	RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
 
 
-	prop= RNA_def_property(srna, "use_smooth", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_smooth", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_SMOOTH);
 	RNA_def_property_ui_text(prop, "Smooth", "Smooth the normals of the surface or beveled curve");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "hide", 1);
 	RNA_def_property_ui_text(prop, "Hide", "Hide this curve in editmode");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
-	prop= RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "mat_nr");
 	RNA_def_property_ui_text(prop, "Material Index", "");
 	RNA_def_property_int_funcs(prop, NULL, NULL, "rna_Curve_material_index_range");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 	
-	prop= RNA_def_property(srna, "character_index", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "character_index", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "charidx");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/
-	RNA_def_property_ui_text(prop, "Character Index", "Location of this character in the text data (only for text curves)");
+	RNA_def_property_ui_text(prop, "Character Index",
+	                         "Location of this character in the text data (only for text curves)");
 	RNA_def_property_update(prop, 0, "rna_Curve_update_data");
 
 	RNA_def_struct_path_func(srna, "rna_Curve_spline_path");
@@ -1595,4 +1647,3 @@ void RNA_def_curve(BlenderRNA *brna)
 }
 
 #endif
-
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index 53944f7..4c2af85 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -58,9 +58,9 @@ BlenderDefRNA DefRNA = {NULL, {NULL, NULL}, {NULL, NULL}, NULL, 0, 0, 0, 1};
 /* pedantic check for '.', do this since its a hassle for translators */
 #ifndef NDEBUG
 #  define DESCR_CHECK(description, id1, id2)                                  \
-	if(description && (description)[0]) {                                     \
+	if (description && (description)[0]) {                                    \
 		int i = strlen(description);                                          \
-		if((description)[i - 1] == '.') {                                     \
+		if ((description)[i - 1] == '.') {                                    \
 			fprintf(stderr, "%s: '%s' '%s' description ends with a '.' !\n",  \
 			        __func__, id1 ? id1 : "", id2 ? id2 : "");                \
 		}                                                                     \
@@ -72,7 +72,7 @@ BlenderDefRNA DefRNA = {NULL, {NULL, NULL}, {NULL, NULL}, NULL, 0, 0, 0, 1};
 
 void rna_addtail(ListBase *listbase, void *vlink)
 {
-	Link *link= vlink;
+	Link *link = vlink;
 
 	link->next = NULL;
 	link->prev = listbase->last;
@@ -84,7 +84,7 @@ void rna_addtail(ListBase *listbase, void *vlink)
 
 static void rna_remlink(ListBase *listbase, void *vlink)
 {
-	Link *link= vlink;
+	Link *link = vlink;
 
 	if (link->next) link->next->prev = link->prev;
 	if (link->prev) link->prev->next = link->next;
@@ -97,9 +97,9 @@ PropertyDefRNA *rna_findlink(ListBase *listbase, const char *identifier)
 {
 	Link *link;
 
-	for(link=listbase->first; link; link=link->next) {
-		PropertyRNA *prop= ((PropertyDefRNA *)link)->prop;
-		if(prop && (strcmp(prop->identifier, identifier)==0)) {
+	for (link = listbase->first; link; link = link->next) {
+		PropertyRNA *prop = ((PropertyDefRNA *)link)->prop;
+		if (prop && (strcmp(prop->identifier, identifier) == 0)) {
 			return (PropertyDefRNA *)link;
 		}
 	}
@@ -117,27 +117,27 @@ void rna_freelistN(ListBase *listbase)
 {
 	Link *link, *next;
 	
-	for(link=listbase->first; link; link=next) {
-		next= link->next;
+	for (link = listbase->first; link; link = next) {
+		next = link->next;
 		MEM_freeN(link);
 	}
 	
-	listbase->first= listbase->last= NULL;
+	listbase->first = listbase->last = NULL;
 }
 
 StructDefRNA *rna_find_struct_def(StructRNA *srna)
 {
 	StructDefRNA *dsrna;
 
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		/* we should never get here */
 		fprintf(stderr, "%s: only at preprocess time.\n", __func__);
 		return NULL;
 	}
 
-	dsrna= DefRNA.structs.last;
-	for (; dsrna; dsrna= dsrna->cont.prev)
-		if (dsrna->srna==srna)
+	dsrna = DefRNA.structs.last;
+	for (; dsrna; dsrna = dsrna->cont.prev)
+		if (dsrna->srna == srna)
 			return dsrna;
 
 	return NULL;
@@ -148,23 +148,23 @@ PropertyDefRNA *rna_find_struct_property_def(StructRNA *srna, PropertyRNA *prop)
 	StructDefRNA *dsrna;
 	PropertyDefRNA *dprop;
 
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		/* we should never get here */
 		fprintf(stderr, "%s: only at preprocess time.\n", __func__);
 		return NULL;
 	}
 
-	dsrna= rna_find_struct_def(srna);
-	dprop= dsrna->cont.properties.last;
-	for (; dprop; dprop= dprop->prev)
-		if (dprop->prop==prop)
+	dsrna = rna_find_struct_def(srna);
+	dprop = dsrna->cont.properties.last;
+	for (; dprop; dprop = dprop->prev)
+		if (dprop->prop == prop)
 			return dprop;
 
-	dsrna= DefRNA.structs.last;
-	for (; dsrna; dsrna= dsrna->cont.prev) {
-		dprop= dsrna->cont.properties.last;
-		for (; dprop; dprop= dprop->prev)
-			if (dprop->prop==prop)
+	dsrna = DefRNA.structs.last;
+	for (; dsrna; dsrna = dsrna->cont.prev) {
+		dprop = dsrna->cont.properties.last;
+		for (; dprop; dprop = dprop->prev)
+			if (dprop->prop == prop)
 				return dprop;
 	}
 
@@ -176,17 +176,17 @@ static PropertyDefRNA *rna_find_property_def(PropertyRNA *prop)
 {
 	PropertyDefRNA *dprop;
 
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		/* we should never get here */
 		fprintf(stderr, "%s: only at preprocess time.\n", __func__);
 		return NULL;
 	}
 
-	dprop= rna_find_struct_property_def(DefRNA.laststruct, prop);
+	dprop = rna_find_struct_property_def(DefRNA.laststruct, prop);
 	if (dprop)
 		return dprop;
 
-	dprop= rna_find_parameter_def(prop);
+	dprop = rna_find_parameter_def(prop);
 	if (dprop)
 		return dprop;
 
@@ -199,23 +199,23 @@ FunctionDefRNA *rna_find_function_def(FunctionRNA *func)
 	StructDefRNA *dsrna;
 	FunctionDefRNA *dfunc;
 
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		/* we should never get here */
 		fprintf(stderr, "%s: only at preprocess time.\n", __func__);
 		return NULL;
 	}
 
-	dsrna= rna_find_struct_def(DefRNA.laststruct);
-	dfunc= dsrna->functions.last;
-	for (; dfunc; dfunc= dfunc->cont.prev)
-		if (dfunc->func==func)
+	dsrna = rna_find_struct_def(DefRNA.laststruct);
+	dfunc = dsrna->functions.last;
+	for (; dfunc; dfunc = dfunc->cont.prev)
+		if (dfunc->func == func)
 			return dfunc;
 
-	dsrna= DefRNA.structs.last;
-	for (; dsrna; dsrna= dsrna->cont.prev) {
-		dfunc= dsrna->functions.last;
-		for (; dfunc; dfunc= dfunc->cont.prev)
-			if (dfunc->func==func)
+	dsrna = DefRNA.structs.last;
+	for (; dsrna; dsrna = dsrna->cont.prev) {
+		dfunc = dsrna->functions.last;
+		for (; dfunc; dfunc = dfunc->cont.prev)
+			if (dfunc->func == func)
 				return dfunc;
 	}
 
@@ -228,28 +228,28 @@ PropertyDefRNA *rna_find_parameter_def(PropertyRNA *parm)
 	FunctionDefRNA *dfunc;
 	PropertyDefRNA *dparm;
 
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		/* we should never get here */
 		fprintf(stderr, "%s: only at preprocess time.\n", __func__);
 		return NULL;
 	}
 
-	dsrna= rna_find_struct_def(DefRNA.laststruct);
-	dfunc= dsrna->functions.last;
-	for (; dfunc; dfunc= dfunc->cont.prev) {
-		dparm= dfunc->cont.properties.last;
-		for (; dparm; dparm= dparm->prev)
-			if (dparm->prop==parm)
+	dsrna = rna_find_struct_def(DefRNA.laststruct);
+	dfunc = dsrna->functions.last;
+	for (; dfunc; dfunc = dfunc->cont.prev) {
+		dparm = dfunc->cont.properties.last;
+		for (; dparm; dparm = dparm->prev)
+			if (dparm->prop == parm)
 				return dparm;
 	}
 
-	dsrna= DefRNA.structs.last;
-	for (; dsrna; dsrna= dsrna->cont.prev) {
-		dfunc= dsrna->functions.last;
-		for (; dfunc; dfunc= dfunc->cont.prev) {
-			dparm= dfunc->cont.properties.last;
-			for (; dparm; dparm= dparm->prev)
-				if (dparm->prop==parm)
+	dsrna = DefRNA.structs.last;
+	for (; dsrna; dsrna = dsrna->cont.prev) {
+		dfunc = dsrna->functions.last;
+		for (; dfunc; dfunc = dfunc->cont.prev) {
+			dparm = dfunc->cont.properties.last;
+			for (; dparm; dparm = dparm->prev)
+				if (dparm->prop == parm)
 					return dparm;
 		}
 	}
@@ -262,18 +262,18 @@ static ContainerDefRNA *rna_find_container_def(ContainerRNA *cont)
 	StructDefRNA *ds;
 	FunctionDefRNA *dfunc;
 
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		/* we should never get here */
 		fprintf(stderr, "%s: only at preprocess time.\n", __func__);
 		return NULL;
 	}
 
-	ds= rna_find_struct_def((StructRNA*)cont);
-	if(ds)
+	ds = rna_find_struct_def((StructRNA*)cont);
+	if (ds)
 		return &ds->cont;
 
-	dfunc= rna_find_function_def((FunctionRNA*)cont);
-	if(dfunc)
+	dfunc = rna_find_function_def((FunctionRNA*)cont);
+	if (dfunc)
 		return &dfunc->cont;
 
 	return NULL;
@@ -290,23 +290,23 @@ typedef struct DNAStructMember {
 
 static int rna_member_cmp(const char *name, const char *oname)
 {
-	int a=0;
+	int a = 0;
 	
 	/* compare without pointer or array part */
-	while(name[0]=='*')
+	while (name[0] =='*')
 		name++;
-	while(oname[0]=='*')
+	while (oname[0] =='*')
 		oname++;
 	
-	while(1) {
-		if(name[a]=='[' && oname[a]==0) return 1;
-		if(name[a]=='[' && oname[a]=='[') return 1;
-		if(name[a]==0) break;
-		if(name[a] != oname[a]) return 0;
+	while (1) {
+		if (name[a] =='[' && oname[a] == 0) return 1;
+		if (name[a] =='[' && oname[a] =='[') return 1;
+		if (name[a] == 0) break;
+		if (name[a] != oname[a]) return 0;
 		a++;
 	}
-	if(name[a]==0 && oname[a] == '.') return 2;
-	if(name[a]==0 && oname[a] == '-' && oname[a+1] == '>') return 3;
+	if (name[a] == 0 && oname[a] == '.') return 2;
+	if (name[a] == 0 && oname[a] == '-' && oname[a+1] == '>') return 3;
 
 	return (name[a] == oname[a]);
 }
@@ -317,52 +317,52 @@ static int rna_find_sdna_member(SDNA *sdna, const char *structname, const char *
 	short *sp;
 	int a, b, structnr, totmember, cmp;
 
-	structnr= DNA_struct_find_nr(sdna, structname);
-	if(structnr == -1)
+	structnr = DNA_struct_find_nr(sdna, structname);
+	if (structnr == -1)
 		return 0;
 
-	sp= sdna->structs[structnr];
-	totmember= sp[1];
-	sp+= 2;
+	sp = sdna->structs[structnr];
+	totmember = sp[1];
+	sp += 2;
 
-	for(a=0; a<totmember; a++, sp+=2) {
-		dnaname= sdna->names[sp[1]];
+	for (a = 0; a<totmember; a++, sp += 2) {
+		dnaname = sdna->names[sp[1]];
 
-		cmp= rna_member_cmp(dnaname, membername);
+		cmp = rna_member_cmp(dnaname, membername);
 
-		if(cmp == 1) {
-			smember->type= sdna->types[sp[0]];
-			smember->name= dnaname;
+		if (cmp == 1) {
+			smember->type = sdna->types[sp[0]];
+			smember->name = dnaname;
 
-			if(strstr(membername, "["))
-				smember->arraylength= 0;
+			if (strstr(membername, "["))
+				smember->arraylength = 0;
 			else
-				smember->arraylength= DNA_elem_array_size(smember->name, strlen(smember->name));
+				smember->arraylength = DNA_elem_array_size(smember->name, strlen(smember->name));
 
-			smember->pointerlevel= 0;
-			for(b=0; dnaname[b] == '*'; b++)
+			smember->pointerlevel = 0;
+			for (b = 0; dnaname[b] == '*'; b++)
 				smember->pointerlevel++;
 
 			return 1;
 		}
-		else if(cmp == 2) {
-			smember->type= "";
-			smember->name= dnaname;
-			smember->pointerlevel= 0;
-			smember->arraylength= 0;
+		else if (cmp == 2) {
+			smember->type = "";
+			smember->name = dnaname;
+			smember->pointerlevel = 0;
+			smember->arraylength = 0;
 
-			membername= strstr(membername, ".") + strlen(".");
+			membername = strstr(membername, ".") + strlen(".");
 			rna_find_sdna_member(sdna, sdna->types[sp[0]], membername, smember);
 
 			return 1;
 		}
-		else if(cmp == 3) {
-			smember->type= "";
-			smember->name= dnaname;
-			smember->pointerlevel= 0;
-			smember->arraylength= 0;
+		else if (cmp == 3) {
+			smember->type = "";
+			smember->name = dnaname;
+			smember->pointerlevel = 0;
+			smember->arraylength = 0;
 
-			membername= strstr(membername, "->") + strlen("->");
+			membername = strstr(membername, "->") + strlen("->");
 			rna_find_sdna_member(sdna, sdna->types[sp[0]], membername, smember);
 
 			return 1;
@@ -374,18 +374,16 @@ static int rna_find_sdna_member(SDNA *sdna, const char *structname, const char *
 
 static int rna_validate_identifier(const char *identifier, char *error, int property)
 {
-	int a=0;
+	int a = 0;
 	
-	/*  list from http://docs.python.org/reference/lexical_analysis.html#id5 */
+	/*  list from http://docs.python.org/py3k/reference/lexical_analysis.html#keywords */
 	static const char *kwlist[] = {
+		/* "False", "None", "True", */
 		"and", "as", "assert", "break",
-		"class", "continue", "def", "del",
-		"elif", "else", "except", "exec",
-		"finally", "for", "from", "global",
-		"if", "import", "in", "is",
-		"lambda", "not", "or", "pass",
-		"print", "raise", "return", "try",
-		"while", "with", "yield", NULL
+		"class", "continue", "def", "del", "elif", "else", "except",
+		"finally", "for", "from", "global", "if", "import", "in",
+		"is", "lambda", "nonlocal", "not", "or", "pass", "raise",
+		"return", "try", "while", "with", "yield", NULL
 	};
 	
 	
@@ -394,44 +392,44 @@ static int rna_validate_identifier(const char *identifier, char *error, int prop
 		return 0;
 	}
 	
-	for(a=0; identifier[a]; a++) {
-		if(DefRNA.preprocess && property) {
-			if(isalpha(identifier[a]) && isupper(identifier[a])) {
+	for (a = 0; identifier[a]; a++) {
+		if (DefRNA.preprocess && property) {
+			if (isalpha(identifier[a]) && isupper(identifier[a])) {
 				strcpy(error, "property names must contain lower case characters only");
 				return 0;
 			}
 		}
 		
-		if (identifier[a]=='_') {
+		if (identifier[a] =='_') {
 			continue;
 		}
 
-		if (identifier[a]==' ') {
+		if (identifier[a] ==' ') {
 			strcpy(error, "spaces are not okay in identifier names");
 			return 0;
 		}
 
-		if (isalnum(identifier[a])==0) {
+		if (isalnum(identifier[a]) == 0) {
 			strcpy(error, "one of the characters failed an isalnum() check and is not an underscore");
 			return 0;
 		}
 	}
 	
-	for(a=0; kwlist[a]; a++) {
+	for (a = 0; kwlist[a]; a++) {
 		if (strcmp(identifier, kwlist[a]) == 0) {
 			strcpy(error, "this keyword is reserved by python");
 			return 0;
 		}
 	}
 
-	if(property) {
+	if (property) {
 		static const char *kwlist_prop[] = {
 			/* not keywords but reserved all the same because py uses */
 			"keys", "values", "items", "get",
 			NULL
 		};
 
-		for(a=0; kwlist_prop[a]; a++) {
+		for (a = 0; kwlist_prop[a]; a++) {
 			if (strcmp(identifier, kwlist_prop[a]) == 0) {
 				strcpy(error, "this keyword is reserved by python");
 				return 0;
@@ -448,12 +446,12 @@ BlenderRNA *RNA_create(void)
 {
 	BlenderRNA *brna;
 
-	brna= MEM_callocN(sizeof(BlenderRNA), "BlenderRNA");
+	brna = MEM_callocN(sizeof(BlenderRNA), "BlenderRNA");
 
-	DefRNA.sdna= DNA_sdna_from_data(DNAstr,  DNAlen, 0);
-	DefRNA.structs.first= DefRNA.structs.last= NULL;
-	DefRNA.error= 0;
-	DefRNA.preprocess= 1;
+	DefRNA.sdna = DNA_sdna_from_data(DNAstr,  DNAlen, 0);
+	DefRNA.structs.first = DefRNA.structs.last = NULL;
+	DefRNA.error = 0;
+	DefRNA.preprocess = 1;
 
 	return brna;
 }
@@ -464,12 +462,12 @@ void RNA_define_free(BlenderRNA *UNUSED(brna))
 	FunctionDefRNA *dfunc;
 	AllocDefRNA *alloc;
 
-	for(alloc=DefRNA.allocs.first; alloc; alloc=alloc->next)
+	for (alloc = DefRNA.allocs.first; alloc; alloc = alloc->next)
 		MEM_freeN(alloc->mem);
 	rna_freelistN(&DefRNA.allocs);
 
-	for(ds=DefRNA.structs.first; ds; ds=ds->cont.next) {
-		for (dfunc= ds->functions.first; dfunc; dfunc= dfunc->cont.next)
+	for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
+		for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next)
 			rna_freelistN(&dfunc->cont.properties);
 
 		rna_freelistN(&ds->cont.properties);
@@ -478,17 +476,17 @@ void RNA_define_free(BlenderRNA *UNUSED(brna))
 
 	rna_freelistN(&DefRNA.structs);
 
-	if(DefRNA.sdna) {
+	if (DefRNA.sdna) {
 		DNA_sdna_free(DefRNA.sdna);
-		DefRNA.sdna= NULL;
+		DefRNA.sdna = NULL;
 	}
 
-	DefRNA.error= 0;
+	DefRNA.error = 0;
 }
 
 void RNA_define_verify_sdna(int verify)
 {
-	DefRNA.verify= verify;
+	DefRNA.verify = verify;
 }
 
 void RNA_struct_free_extension(StructRNA *srna, ExtensionRNA *ext)
@@ -497,7 +495,7 @@ void RNA_struct_free_extension(StructRNA *srna, ExtensionRNA *ext)
 	ext->free(ext->data);			/* decref's the PyObject that the srna owns */
 	RNA_struct_blender_type_set(srna, NULL); /* this gets accessed again - XXX fixme */
 	RNA_struct_py_type_set(srna, NULL);	/* NULL the srna's value so RNA_struct_free wont complain of a leak */
-#endif	
+#endif
 }
 
 void RNA_struct_free(BlenderRNA *brna, StructRNA *srna)
@@ -508,42 +506,42 @@ void RNA_struct_free(BlenderRNA *brna, StructRNA *srna)
 	PropertyRNA *parm, *nextparm;
 
 	/*
-	if(srna->flag & STRUCT_RUNTIME) {
-		if(RNA_struct_py_type_get(srna)) {
+	if (srna->flag & STRUCT_RUNTIME) {
+		if (RNA_struct_py_type_get(srna)) {
 			fprintf(stderr, "%s '%s' freed while holding a python reference\n", __func__, srna->identifier);
 		}
 	} */
 
-	for(prop=srna->cont.properties.first; prop; prop=nextprop) {
-		nextprop= prop->next;
+	for (prop = srna->cont.properties.first; prop; prop = nextprop) {
+		nextprop = prop->next;
 
 		RNA_def_property_free_pointers(prop);
 
-		if(prop->flag & PROP_RUNTIME)
+		if (prop->flag & PROP_RUNTIME)
 			rna_freelinkN(&srna->cont.properties, prop);
 	}
 
-	for(func=srna->functions.first; func; func=nextfunc) {
-		nextfunc= func->cont.next;
+	for (func = srna->functions.first; func; func = nextfunc) {
+		nextfunc = func->cont.next;
 
-		for(parm=func->cont.properties.first; parm; parm=nextparm) {
-			nextparm= parm->next;
+		for (parm = func->cont.properties.first; parm; parm = nextparm) {
+			nextparm = parm->next;
 
 			RNA_def_property_free_pointers(parm);
 
-			if(parm->flag & PROP_RUNTIME)
+			if (parm->flag & PROP_RUNTIME)
 				rna_freelinkN(&func->cont.properties, parm);
 		}
 
 		RNA_def_func_free_pointers(func);
 
-		if(func->flag & FUNC_RUNTIME)
+		if (func->flag & FUNC_RUNTIME)
 			rna_freelinkN(&srna->functions, func);
 	}
 
 	RNA_def_struct_free_pointers(srna);
 
-	if(srna->flag & STRUCT_RUNTIME)
+	if (srna->flag & STRUCT_RUNTIME)
 		rna_freelinkN(&brna->structs, srna);
 
 #endif
@@ -554,11 +552,11 @@ void RNA_free(BlenderRNA *brna)
 	StructRNA *srna, *nextsrna;
 	FunctionRNA *func;
 
-	if(DefRNA.preprocess) {
+	if (DefRNA.preprocess) {
 		RNA_define_free(brna);
 
-		for(srna=brna->structs.first; srna; srna=srna->cont.next) {
-			for (func= srna->functions.first; func; func= func->cont.next)
+		for (srna = brna->structs.first; srna; srna = srna->cont.next) {
+			for (func = srna->functions.first; func; func = func->cont.next)
 				rna_freelistN(&func->cont.properties);
 
 			rna_freelistN(&srna->cont.properties);
@@ -570,8 +568,8 @@ void RNA_free(BlenderRNA *brna)
 		MEM_freeN(brna);
 	}
 	else {
-		for(srna=brna->structs.first; srna; srna=nextsrna) {
-			nextsrna= srna->cont.next;
+		for (srna = brna->structs.first; srna; srna = nextsrna) {
+			nextsrna = srna->cont.next;
 			RNA_struct_free(brna, srna);
 		}
 	}
@@ -579,7 +577,7 @@ void RNA_free(BlenderRNA *brna)
 
 static size_t rna_property_type_sizeof(PropertyType type)
 {
-	switch(type) {
+	switch (type) {
 		case PROP_BOOLEAN: return sizeof(BoolPropertyRNA);
 		case PROP_INT: return sizeof(IntPropertyRNA);
 		case PROP_FLOAT: return sizeof(FloatPropertyRNA);
@@ -595,8 +593,8 @@ static StructDefRNA *rna_find_def_struct(StructRNA *srna)
 {
 	StructDefRNA *ds;
 
-	for(ds=DefRNA.structs.first; ds; ds=ds->cont.next)
-		if(ds->srna == srna)
+	for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
+		if (ds->srna == srna)
 			return ds;
 
 	return NULL;
@@ -606,112 +604,114 @@ static StructDefRNA *rna_find_def_struct(StructRNA *srna)
 
 StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
 {
-	StructRNA *srna, *srnafrom= NULL;
-	StructDefRNA *ds= NULL, *dsfrom= NULL;
+	StructRNA *srna, *srnafrom = NULL;
+	StructDefRNA *ds = NULL, *dsfrom = NULL;
 	PropertyRNA *prop;
 	
-	if(DefRNA.preprocess) {
+	if (DefRNA.preprocess) {
 		char error[512];
 
 		if (rna_validate_identifier(identifier, error, 0) == 0) {
 			fprintf(stderr, "%s: struct identifier \"%s\" error - %s\n", __func__, identifier, error);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 		}
 	}
 	
-	if(from) {
+	if (from) {
 		/* find struct to derive from */
-		for(srnafrom= brna->structs.first; srnafrom; srnafrom=srnafrom->cont.next)
-			if(strcmp(srnafrom->identifier, from) == 0)
+		for (srnafrom = brna->structs.first; srnafrom; srnafrom = srnafrom->cont.next)
+			if (strcmp(srnafrom->identifier, from) == 0)
 				break;
 
-		if(!srnafrom) {
+		if (!srnafrom) {
 			fprintf(stderr, "%s: struct %s not found to define %s.\n", __func__, from, identifier);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 		}
 	}
 
-	srna= MEM_callocN(sizeof(StructRNA), "StructRNA");
-	DefRNA.laststruct= srna;
+	srna = MEM_callocN(sizeof(StructRNA), "StructRNA");
+	DefRNA.laststruct = srna;
 
-	if(srnafrom) {
+	if (srnafrom) {
 		/* copy from struct to derive stuff, a bit clumsy since we can't
 		 * use MEM_dupallocN, data structs may not be alloced but builtin */
 		memcpy(srna, srnafrom, sizeof(StructRNA));
-		srna->cont.prophash= NULL;
-		srna->cont.properties.first= srna->cont.properties.last= NULL;
-		srna->functions.first= srna->functions.last= NULL;
-		srna->py_type= NULL;
+		srna->cont.prophash = NULL;
+		srna->cont.properties.first = srna->cont.properties.last = NULL;
+		srna->functions.first = srna->functions.last = NULL;
+		srna->py_type = NULL;
 
-		if(DefRNA.preprocess) {
-			srna->base= srnafrom;
-			dsfrom= rna_find_def_struct(srnafrom);
+		if (DefRNA.preprocess) {
+			srna->base = srnafrom;
+			dsfrom = rna_find_def_struct(srnafrom);
 		}
 		else
-			srna->base= srnafrom;
+			srna->base = srnafrom;
 	}
 	
-	srna->identifier= identifier;
-	srna->name= identifier; /* may be overwritten later RNA_def_struct_ui_text */
-	srna->description= "";
+	srna->identifier = identifier;
+	srna->name = identifier; /* may be overwritten later RNA_def_struct_ui_text */
+	srna->description = "";
 	srna->flag |= STRUCT_UNDO;
-	if(!srnafrom)
-		srna->icon= ICON_DOT;
+	if (!srnafrom)
+		srna->icon = ICON_DOT;
 
 	rna_addtail(&brna->structs, srna);
 
-	if(DefRNA.preprocess) {
-		ds= MEM_callocN(sizeof(StructDefRNA), "StructDefRNA");
-		ds->srna= srna;
+	if (DefRNA.preprocess) {
+		ds = MEM_callocN(sizeof(StructDefRNA), "StructDefRNA");
+		ds->srna = srna;
 		rna_addtail(&DefRNA.structs, ds);
 
-		if(dsfrom)
-			ds->dnafromname= dsfrom->dnaname;
+		if (dsfrom)
+			ds->dnafromname = dsfrom->dnaname;
 	}
 
 	/* in preprocess, try to find sdna */
-	if(DefRNA.preprocess)
+	if (DefRNA.preprocess)
 		RNA_def_struct_sdna(srna, srna->identifier);
 	else
 		srna->flag |= STRUCT_RUNTIME;
 
-	if(srnafrom) {
-		srna->nameproperty= srnafrom->nameproperty;
-		srna->iteratorproperty= srnafrom->iteratorproperty;
+	if (srnafrom) {
+		srna->nameproperty = srnafrom->nameproperty;
+		srna->iteratorproperty = srnafrom->iteratorproperty;
 	}
 	else {
 		/* define some builtin properties */
-		prop= RNA_def_property(&srna->cont, "rna_properties", PROP_COLLECTION, PROP_NONE);
+		prop = RNA_def_property(&srna->cont, "rna_properties", PROP_COLLECTION, PROP_NONE);
 		RNA_def_property_flag(prop, PROP_BUILTIN);
 		RNA_def_property_ui_text(prop, "Properties", "RNA property collection");
 
-		if(DefRNA.preprocess) {
+		if (DefRNA.preprocess) {
 			RNA_def_property_struct_type(prop, "Property");
-			RNA_def_property_collection_funcs(prop, "rna_builtin_properties_begin", "rna_builtin_properties_next", "rna_iterator_listbase_end", "rna_builtin_properties_get", NULL, NULL, "rna_builtin_properties_lookup_string", NULL);
+			RNA_def_property_collection_funcs(prop, "rna_builtin_properties_begin", "rna_builtin_properties_next",
+			                                  "rna_iterator_listbase_end", "rna_builtin_properties_get", NULL, NULL,
+			                                  "rna_builtin_properties_lookup_string", NULL);
 		}
 		else {
 #ifdef RNA_RUNTIME
-			CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
-			cprop->begin= rna_builtin_properties_begin;
-			cprop->next= rna_builtin_properties_next;
-			cprop->get= rna_builtin_properties_get;
-			cprop->item_type= &RNA_Property;
+			CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)prop;
+			cprop->begin = rna_builtin_properties_begin;
+			cprop->next = rna_builtin_properties_next;
+			cprop->get = rna_builtin_properties_get;
+			cprop->item_type = &RNA_Property;
 #endif
 		}
 
-		prop= RNA_def_property(&srna->cont, "rna_type", PROP_POINTER, PROP_NONE);
+		prop = RNA_def_property(&srna->cont, "rna_type", PROP_POINTER, PROP_NONE);
 		RNA_def_property_flag(prop, PROP_HIDDEN);
 		RNA_def_property_ui_text(prop, "RNA", "RNA type definition");
 
-		if(DefRNA.preprocess) {
+		if (DefRNA.preprocess) {
 			RNA_def_property_struct_type(prop, "Struct");
 			RNA_def_property_pointer_funcs(prop, "rna_builtin_type_get", NULL, NULL, NULL);
 		}
 		else {
 #ifdef RNA_RUNTIME
-			PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
-			pprop->get= rna_builtin_type_get;
-			pprop->type= &RNA_Struct;
+			PointerPropertyRNA *pprop = (PointerPropertyRNA*)prop;
+			pprop->get = rna_builtin_type_get;
+			pprop->type = &RNA_Struct;
 #endif
 		}
 	}
@@ -723,60 +723,60 @@ void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
 {
 	StructDefRNA *ds;
 
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s: only during preprocessing.\n", __func__);
 		return;
 	}
 
-	ds= rna_find_def_struct(srna);
+	ds = rna_find_def_struct(srna);
 
-	if(!DNA_struct_find_nr(DefRNA.sdna, structname)) {
-		if(!DefRNA.silent) {
+	if (!DNA_struct_find_nr(DefRNA.sdna, structname)) {
+		if (!DefRNA.silent) {
 			fprintf(stderr, "%s: %s not found.\n", __func__, structname);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 		}
 		return;
 	}
 
-	ds->dnaname= structname;
+	ds->dnaname = structname;
 }
 
 void RNA_def_struct_sdna_from(StructRNA *srna, const char *structname, const char *propname)
 {
 	StructDefRNA *ds;
 
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s: only during preprocessing.\n", __func__);
 		return;
 	}
 
-	ds= rna_find_def_struct(srna);
+	ds = rna_find_def_struct(srna);
 
-	if(!ds->dnaname) {
+	if (!ds->dnaname) {
 		fprintf(stderr, "%s: %s base struct must know DNA already.\n", __func__, structname);
 		return;
 	}
 
-	if(!DNA_struct_find_nr(DefRNA.sdna, structname)) {
-		if(!DefRNA.silent) {
+	if (!DNA_struct_find_nr(DefRNA.sdna, structname)) {
+		if (!DefRNA.silent) {
 			fprintf(stderr, "%s: %s not found.\n", __func__, structname);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 		}
 		return;
 	}
 
-	ds->dnafromprop= propname;
-	ds->dnaname= structname;
+	ds->dnafromprop = propname;
+	ds->dnaname = structname;
 }
 
 void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop)
 {
-	if(prop->type != PROP_STRING) {
+	if (prop->type != PROP_STRING) {
 		fprintf(stderr, "%s: \"%s.%s\", must be a string property.\n", __func__, srna->identifier, prop->identifier);
-		DefRNA.error= 1;
+		DefRNA.error = 1;
 	}
 	else
-		srna->nameproperty= prop;
+		srna->nameproperty = prop;
 }
 
 void RNA_def_struct_nested(BlenderRNA *brna, StructRNA *srna, const char *structname)
@@ -784,16 +784,16 @@ void RNA_def_struct_nested(BlenderRNA *brna, StructRNA *srna, const char *struct
 	StructRNA *srnafrom;
 
 	/* find struct to derive from */
-	for(srnafrom= brna->structs.first; srnafrom; srnafrom=srnafrom->cont.next)
-		if(strcmp(srnafrom->identifier, structname) == 0)
+	for (srnafrom = brna->structs.first; srnafrom; srnafrom = srnafrom->cont.next)
+		if (strcmp(srnafrom->identifier, structname) == 0)
 			break;
 
-	if(!srnafrom) {
+	if (!srnafrom) {
 		fprintf(stderr, "%s: struct %s not found for %s.\n", __func__, structname, srna->identifier);
-		DefRNA.error= 1;
+		DefRNA.error = 1;
 	}
 
-	srna->nested= srnafrom;
+	srna->nested = srnafrom;
 }
 
 void RNA_def_struct_flag(StructRNA *srna, int flag)
@@ -808,67 +808,72 @@ void RNA_def_struct_clear_flag(StructRNA *srna, int flag)
 
 void RNA_def_struct_refine_func(StructRNA *srna, const char *refine)
 {
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s: only during preprocessing.\n", __func__);
 		return;
 	}
 
-	if(refine) srna->refine= (StructRefineFunc)refine;
+	if (refine) srna->refine = (StructRefineFunc)refine;
 }
 
 void RNA_def_struct_idprops_func(StructRNA *srna, const char *idproperties)
 {
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s: only during preprocessing.\n", __func__);
 		return;
 	}
 
-	if(idproperties) srna->idproperties= (IDPropertiesFunc)idproperties;
+	if (idproperties) srna->idproperties = (IDPropertiesFunc)idproperties;
 }
 
 void RNA_def_struct_register_funcs(StructRNA *srna, const char *reg, const char *unreg, const char *instance)
 {
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s: only during preprocessing.\n", __func__);
 		return;
 	}
 
-	if(reg) srna->reg= (StructRegisterFunc)reg;
-	if(unreg) srna->unreg= (StructUnregisterFunc)unreg;
-	if(instance) srna->instance= (StructInstanceFunc)instance;
+	if (reg) srna->reg = (StructRegisterFunc)reg;
+	if (unreg) srna->unreg = (StructUnregisterFunc)unreg;
+	if (instance) srna->instance = (StructInstanceFunc)instance;
 }
 
 void RNA_def_struct_path_func(StructRNA *srna, const char *path)
 {
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s: only during preprocessing.\n", __func__);
 		return;
 	}
 
-	if(path) srna->path= (StructPathFunc)path;
+	if (path) srna->path = (StructPathFunc)path;
 }
 
 void RNA_def_struct_identifier(StructRNA *srna, const char *identifier)
 {
-	if(DefRNA.preprocess) {
+	if (DefRNA.preprocess) {
 		fprintf(stderr, "%s: only at runtime.\n", __func__);
 		return;
 	}
 
-	srna->identifier= identifier;
+	srna->identifier = identifier;
 }
 
 void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
 {
 	DESCR_CHECK(description, srna->identifier, NULL);
 
-	srna->name= name;
-	srna->description= description;
+	srna->name = name;
+	srna->description = description;
 }
 
 void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
 {
-	srna->icon= icon;
+	srna->icon = icon;
+}
+
+void RNA_def_struct_translation_context(StructRNA *srna, const char *context)
+{
+	srna->translation_context = context;
 }
 
 /* Property Definition */
@@ -876,74 +881,81 @@ void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
 PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
 {
 	/*StructRNA *srna= DefRNA.laststruct;*/ /* invalid for python defined props */
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	ContainerDefRNA *dcont;
-	PropertyDefRNA *dprop= NULL;
+	PropertyDefRNA *dprop = NULL;
 	PropertyRNA *prop;
 
-	if(DefRNA.preprocess) {
+	if (DefRNA.preprocess) {
 		char error[512];
 		
 		if (rna_validate_identifier(identifier, error, 1) == 0) {
-			fprintf(stderr, "%s: property identifier \"%s.%s\" - %s\n", __func__, CONTAINER_RNA_ID(cont), identifier, error);
-			DefRNA.error= 1;
+			fprintf(stderr, "%s: property identifier \"%s.%s\" - %s\n", __func__,
+			        CONTAINER_RNA_ID(cont), identifier, error);
+			DefRNA.error = 1;
 		}
 		
-		dcont= rna_find_container_def(cont);
+		dcont = rna_find_container_def(cont);
 
 		/* XXX - toto, detect supertype collisions */
-		if(rna_findlink(&dcont->properties, identifier)) {
+		if (rna_findlink(&dcont->properties, identifier)) {
 			fprintf(stderr, "%s: duplicate identifier \"%s.%s\"\n", __func__, CONTAINER_RNA_ID(cont), identifier);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 		}
 
-		dprop= MEM_callocN(sizeof(PropertyDefRNA), "PropertyDefRNA");
+		dprop = MEM_callocN(sizeof(PropertyDefRNA), "PropertyDefRNA");
 		rna_addtail(&dcont->properties, dprop);
 	}
 
-	prop= MEM_callocN(rna_property_type_sizeof(type), "PropertyRNA");
+	prop = MEM_callocN(rna_property_type_sizeof(type), "PropertyRNA");
 
-	switch(type) {
+	switch (type) {
 		case PROP_BOOLEAN:
+			if (DefRNA.preprocess) {
+				if ((subtype & ~(PROP_LAYER_MEMBER)) != PROP_NONE) {
+					fprintf(stderr, "%s: subtype does not apply to 'PROP_BOOLEAN' \"%s.%s\"\n", __func__,
+					        CONTAINER_RNA_ID(cont), identifier);
+					DefRNA.error = 1;
+				}
+			}
 			break;
 		case PROP_INT: {
-			IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
+			IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
 
-			iprop->hardmin= (subtype == PROP_UNSIGNED)? 0: INT_MIN;
-			iprop->hardmax= INT_MAX;
+			iprop->hardmin = (subtype == PROP_UNSIGNED)? 0: INT_MIN;
+			iprop->hardmax = INT_MAX;
 
-			iprop->softmin= (subtype == PROP_UNSIGNED)? 0: -10000; /* rather arbitrary .. */
-			iprop->softmax= 10000;
-			iprop->step= 1;
+			iprop->softmin = (subtype == PROP_UNSIGNED)? 0: -10000; /* rather arbitrary .. */
+			iprop->softmax = 10000;
+			iprop->step = 1;
 			break;
 		}
 		case PROP_FLOAT: {
-			FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
+			FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
 
-			fprop->hardmin= (subtype == PROP_UNSIGNED)? 0.0f: -FLT_MAX;
-			fprop->hardmax= FLT_MAX;
+			fprop->hardmin = (subtype == PROP_UNSIGNED)? 0.0f: -FLT_MAX;
+			fprop->hardmax = FLT_MAX;
 
-			if(ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA)) {
-				fprop->softmin= 0.0f;
-				fprop->softmax= 1.0f;
+			if (ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA)) {
+				fprop->softmin = 0.0f;
+				fprop->softmax = 1.0f;
 			}
-			else if(subtype == PROP_FACTOR) {
-				fprop->softmin= fprop->hardmin= 0.0f;
-				fprop->softmax= fprop->hardmax= 1.0f;
+			else if (subtype == PROP_FACTOR) {
+				fprop->softmin = fprop->hardmin = 0.0f;
+				fprop->softmax = fprop->hardmax = 1.0f;
 			}
 			else {
-				fprop->softmin= (subtype == PROP_UNSIGNED)? 0.0f: -10000.0f; /* rather arbitrary .. */
-				fprop->softmax= 10000.0f;
+				fprop->softmin = (subtype == PROP_UNSIGNED)? 0.0f: -10000.0f; /* rather arbitrary .. */
+				fprop->softmax = 10000.0f;
 			}
-			fprop->step= 10;
-			fprop->precision= 3;
+			fprop->step = 10;
+			fprop->precision = 3;
 			break;
 		}
 		case PROP_STRING: {
-			StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
+			StringPropertyRNA *sprop = (StringPropertyRNA*)prop;
 
-			sprop->defaultvalue= "";
-			sprop->maxlength= 0;
+			sprop->defaultvalue = "";
 			break;
 		}
 		case PROP_ENUM:
@@ -952,77 +964,83 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier
 			break;
 		default:
 			fprintf(stderr, "%s: \"%s.%s\", invalid property type.\n", __func__, CONTAINER_RNA_ID(cont), identifier);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 			return NULL;
 	}
 
-	if(DefRNA.preprocess) {
-		dprop->cont= cont;
-		dprop->prop= prop;
+	if (DefRNA.preprocess) {
+		dprop->cont = cont;
+		dprop->prop = prop;
 	}
 
-	prop->magic= RNA_MAGIC;
-	prop->identifier= identifier;
-	prop->type= type;
-	prop->subtype= subtype;
-	prop->name= identifier;
-	prop->description= "";
+	prop->magic = RNA_MAGIC;
+	prop->identifier = identifier;
+	prop->type = type;
+	prop->subtype = subtype;
+	prop->name = identifier;
+	prop->description = "";
 	/* a priori not raw editable */
 	prop->rawtype = -1;
 
-	if(type != PROP_COLLECTION && type != PROP_POINTER) {
-		prop->flag= PROP_EDITABLE;
+	if (type != PROP_COLLECTION && type != PROP_POINTER) {
+		prop->flag = PROP_EDITABLE;
 	
-		if(type != PROP_STRING)
+		if (type != PROP_STRING)
 			prop->flag |= PROP_ANIMATABLE;
 	}
 
-	if(DefRNA.preprocess) {
-		switch(type) {
+	if (type == PROP_STRING) {
+		/* used so generated 'get/length/set' functions skip a NULL check
+		 * in some cases we want it */
+		RNA_def_property_flag(prop, PROP_NEVER_NULL);
+	}
+
+	if (DefRNA.preprocess) {
+		switch (type) {
 			case PROP_BOOLEAN:
-				DefRNA.silent= 1;
+				DefRNA.silent = 1;
 				RNA_def_property_boolean_sdna(prop, NULL, identifier, 0);
-				DefRNA.silent= 0;
+				DefRNA.silent = 0;
 				break;
 			case PROP_INT: {
-				DefRNA.silent= 1;
+				DefRNA.silent = 1;
 				RNA_def_property_int_sdna(prop, NULL, identifier);
-				DefRNA.silent= 0;
+				DefRNA.silent = 0;
 				break;
 			}
 			case PROP_FLOAT: {
-				DefRNA.silent= 1;
+				DefRNA.silent = 1;
 				RNA_def_property_float_sdna(prop, NULL, identifier);
-				DefRNA.silent= 0;
+				DefRNA.silent = 0;
 				break;
 			}
 			case PROP_STRING: {
-				DefRNA.silent= 1;
+				DefRNA.silent = 1;
 				RNA_def_property_string_sdna(prop, NULL, identifier);
-				DefRNA.silent= 0;
+				DefRNA.silent = 0;
 				break;
 			}
 			case PROP_ENUM:
-				DefRNA.silent= 1;
+				DefRNA.silent = 1;
 				RNA_def_property_enum_sdna(prop, NULL, identifier);
-				DefRNA.silent= 0;
+				DefRNA.silent = 0;
 				break;
 			case PROP_POINTER:
-				DefRNA.silent= 1;
+				DefRNA.silent = 1;
 				RNA_def_property_pointer_sdna(prop, NULL, identifier);
-				DefRNA.silent= 0;
+				DefRNA.silent = 0;
 				break;
 			case PROP_COLLECTION:
-				DefRNA.silent= 1;
+				DefRNA.silent = 1;
 				RNA_def_property_collection_sdna(prop, NULL, identifier, NULL);
-				DefRNA.silent= 0;
+				DefRNA.silent = 0;
 				break;
 		}
 	}
 	else {
 		prop->flag |= PROP_IDPROPERTY|PROP_RUNTIME;
 #ifdef RNA_RUNTIME
-		if(cont->prophash)
+		if (cont->prophash)
 			BLI_ghash_insert(cont->prophash, (void*)prop->identifier, prop);
 #endif
 	}
@@ -1044,76 +1062,82 @@ void RNA_def_property_clear_flag(PropertyRNA *prop, int flag)
 
 void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype)
 {
-	prop->subtype= subtype;
+	prop->subtype = subtype;
 }
 
 void RNA_def_property_array(PropertyRNA *prop, int length)
 {
-	StructRNA *srna= DefRNA.laststruct;
+	StructRNA *srna = DefRNA.laststruct;
 
-	if(length<0) {
-		fprintf(stderr, "%s: \"%s.%s\", array length must be zero of greater.\n", __func__, srna->identifier, prop->identifier);
-		DefRNA.error= 1;
+	if (length<0) {
+		fprintf(stderr, "%s: \"%s.%s\", array length must be zero of greater.\n", __func__,
+		        srna->identifier, prop->identifier);
+		DefRNA.error = 1;
 		return;
 	}
 
-	if(length>RNA_MAX_ARRAY_LENGTH) {
-		fprintf(stderr, "%s: \"%s.%s\", array length must be smaller than %d.\n", __func__, srna->identifier, prop->identifier, RNA_MAX_ARRAY_LENGTH);
-		DefRNA.error= 1;
+	if (length>RNA_MAX_ARRAY_LENGTH) {
+		fprintf(stderr, "%s: \"%s.%s\", array length must be smaller than %d.\n", __func__,
+		        srna->identifier, prop->identifier, RNA_MAX_ARRAY_LENGTH);
+		DefRNA.error = 1;
 		return;
 	}
 
-	if(prop->arraydimension > 1) {
-		fprintf(stderr, "%s: \"%s.%s\", array dimensions has been set to %u but would be overwritten as 1.\n", __func__, srna->identifier, prop->identifier, prop->arraydimension);
-		DefRNA.error= 1;
+	if (prop->arraydimension > 1) {
+		fprintf(stderr, "%s: \"%s.%s\", array dimensions has been set to %u but would be overwritten as 1.\n",
+		        __func__, srna->identifier, prop->identifier, prop->arraydimension);
+		DefRNA.error = 1;
 		return;
 	}
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_BOOLEAN:
 		case PROP_INT:
 		case PROP_FLOAT:
-			prop->arraylength[0]= length;
-			prop->totarraylength= length;
-			prop->arraydimension= 1;
+			prop->arraylength[0] = length;
+			prop->totarraylength = length;
+			prop->arraydimension = 1;
 			break;
 		default:
-			fprintf(stderr, "%s: \"%s.%s\", only boolean/int/float can be array.\n", __func__, srna->identifier, prop->identifier);
-			DefRNA.error= 1;
+			fprintf(stderr, "%s: \"%s.%s\", only boolean/int/float can be array.\n",
+			        __func__, srna->identifier, prop->identifier);
+			DefRNA.error = 1;
 			break;
 	}
 }
 
 void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
 {
-	StructRNA *srna= DefRNA.laststruct;
+	StructRNA *srna = DefRNA.laststruct;
 	int i;
 	
 	if (dimension < 1 || dimension > RNA_MAX_ARRAY_DIMENSION) {
-		fprintf(stderr, "%s: \"%s.%s\", array dimension must be between 1 and %d.\n", __func__, srna->identifier, prop->identifier, RNA_MAX_ARRAY_DIMENSION);
-		DefRNA.error= 1;
+		fprintf(stderr, "%s: \"%s.%s\", array dimension must be between 1 and %d.\n",
+		        __func__, srna->identifier, prop->identifier, RNA_MAX_ARRAY_DIMENSION);
+		DefRNA.error = 1;
 		return;
 	}
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_BOOLEAN:
 		case PROP_INT:
 		case PROP_FLOAT:
 			break;
 		default:
-			fprintf(stderr, "%s: \"%s.%s\", only boolean/int/float can be array.\n", __func__, srna->identifier, prop->identifier);
-			DefRNA.error= 1;
+			fprintf(stderr, "%s: \"%s.%s\", only boolean/int/float can be array.\n",
+			        __func__, srna->identifier, prop->identifier);
+			DefRNA.error = 1;
 			break;
 	}
 
-	prop->arraydimension= dimension;
-	prop->totarraylength= 0;
+	prop->arraydimension = dimension;
+	prop->totarraylength = 0;
 
-	if(length) {
+	if (length) {
 		memcpy(prop->arraylength, length, sizeof(int)*dimension);
 
-		prop->totarraylength= length[0];
-		for(i=1; i<dimension; i++)
+		prop->totarraylength = length[0];
+		for (i = 1; i<dimension; i++)
 			prop->totarraylength *= length[i];
 	}
 	else
@@ -1126,151 +1150,154 @@ void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *d
 {
 	DESCR_CHECK(description, prop->identifier, NULL);
 
-	prop->name= name;
-	prop->description= description;
+	prop->name = name;
+	prop->description = description;
 }
 
 void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
 {
-	prop->icon= icon;
-	if(consecutive)
+	prop->icon = icon;
+	if (consecutive)
 		prop->flag |= PROP_ICONS_CONSECUTIVE;
 }
 
 void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
 {
-	StructRNA *srna= DefRNA.laststruct;
+	StructRNA *srna = DefRNA.laststruct;
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_INT: {
-			IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
-			iprop->softmin= (int)min;
-			iprop->softmax= (int)max;
-			iprop->step= (int)step;
+			IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
+			iprop->softmin = (int)min;
+			iprop->softmax = (int)max;
+			iprop->step = (int)step;
 			break;
 		}
 		case PROP_FLOAT: {
-			FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
-			fprop->softmin= (float)min;
-			fprop->softmax= (float)max;
-			fprop->step= (float)step;
-			fprop->precision= (int)precision;
+			FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
+			fprop->softmin = (float)min;
+			fprop->softmax = (float)max;
+			fprop->step = (float)step;
+			fprop->precision = (int)precision;
 			break;
 		}
 		default:
-			fprintf(stderr, "%s: \"%s.%s\", invalid type for ui range.\n", __func__, srna->identifier, prop->identifier);
-			DefRNA.error= 1;
+			fprintf(stderr, "%s: \"%s.%s\", invalid type for ui range.\n",
+			        __func__, srna->identifier, prop->identifier);
+			DefRNA.error = 1;
 			break;
 	}
 }
 
 void RNA_def_property_range(PropertyRNA *prop, double min, double max)
 {
-	StructRNA *srna= DefRNA.laststruct;
+	StructRNA *srna = DefRNA.laststruct;
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_INT: {
-			IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
-			iprop->hardmin= (int)min;
-			iprop->hardmax= (int)max;
-			iprop->softmin= MAX2((int)min, iprop->hardmin);
-			iprop->softmax= MIN2((int)max, iprop->hardmax);
+			IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
+			iprop->hardmin = (int)min;
+			iprop->hardmax = (int)max;
+			iprop->softmin = MAX2((int)min, iprop->hardmin);
+			iprop->softmax = MIN2((int)max, iprop->hardmax);
 			break;
 		}
 		case PROP_FLOAT: {
-			FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
-			fprop->hardmin= (float)min;
-			fprop->hardmax= (float)max;
-			fprop->softmin= MAX2((float)min, fprop->hardmin);
-			fprop->softmax= MIN2((float)max, fprop->hardmax);
+			FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
+			fprop->hardmin = (float)min;
+			fprop->hardmax = (float)max;
+			fprop->softmin = MAX2((float)min, fprop->hardmin);
+			fprop->softmax = MIN2((float)max, fprop->hardmax);
 			break;
 		}
 		default:
 			fprintf(stderr, "%s: \"%s.%s\", invalid type for range.\n", __func__, srna->identifier, prop->identifier);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 			break;
 	}
 }
 
 void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
 {
-	StructRNA *srna= DefRNA.laststruct;
+	StructRNA *srna = DefRNA.laststruct;
 
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s \"%s.%s\": only during preprocessing.\n", __func__, srna->identifier, prop->identifier);
 		return;
 	}
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_POINTER: {
-			PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
+			PointerPropertyRNA *pprop = (PointerPropertyRNA*)prop;
 			pprop->type = (StructRNA*)type;
 			break;
 		}
 		case PROP_COLLECTION: {
-			CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
+			CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)prop;
 			cprop->item_type = (StructRNA*)type;
 			break;
 		}
 		default:
-			fprintf(stderr, "%s: \"%s.%s\", invalid type for struct type.\n", __func__, srna->identifier, prop->identifier);
-			DefRNA.error= 1;
+			fprintf(stderr, "%s: \"%s.%s\", invalid type for struct type.\n",
+			        __func__, srna->identifier, prop->identifier);
+			DefRNA.error = 1;
 			break;
 	}
 }
 
 void RNA_def_property_struct_runtime(PropertyRNA *prop, StructRNA *type)
 {
-	StructRNA *srna= DefRNA.laststruct;
+	StructRNA *srna = DefRNA.laststruct;
 
-	if(DefRNA.preprocess) {
+	if (DefRNA.preprocess) {
 		fprintf(stderr, "%s: only at runtime.\n", __func__);
 		return;
 	}
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_POINTER: {
-			PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
+			PointerPropertyRNA *pprop = (PointerPropertyRNA*)prop;
 			pprop->type = type;
 
-			if(type && (type->flag & STRUCT_ID_REFCOUNT))
+			if (type && (type->flag & STRUCT_ID_REFCOUNT))
 				prop->flag |= PROP_ID_REFCOUNT;
 
 			break;
 		}
 		case PROP_COLLECTION: {
-			CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
+			CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)prop;
 			cprop->item_type = type;
 			break;
 		}
 		default:
-			fprintf(stderr, "%s: \"%s.%s\", invalid type for struct type.\n", __func__, srna->identifier, prop->identifier);
-			DefRNA.error= 1;
+			fprintf(stderr, "%s: \"%s.%s\", invalid type for struct type.\n",
+			        __func__, srna->identifier, prop->identifier);
+			DefRNA.error = 1;
 			break;
 	}
 }
 
 void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
 {
-	StructRNA *srna= DefRNA.laststruct;
-	int i, defaultfound= 0;
+	StructRNA *srna = DefRNA.laststruct;
+	int i, defaultfound = 0;
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_ENUM: {
-			EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
-			eprop->item= (EnumPropertyItem*)item;
-			eprop->totitem= 0;
-			for(i=0; item[i].identifier; i++) {
+			EnumPropertyRNA *eprop = (EnumPropertyRNA*)prop;
+			eprop->item = (EnumPropertyItem*)item;
+			eprop->totitem = 0;
+			for (i = 0; item[i].identifier; i++) {
 				eprop->totitem++;
 
-				if(item[i].identifier[0] && item[i].value == eprop->defaultvalue)
-					defaultfound= 1;
+				if (item[i].identifier[0] && item[i].value == eprop->defaultvalue)
+					defaultfound = 1;
 			}
 
-			if(!defaultfound) {
-				for(i=0; item[i].identifier; i++) {
-					if(item[i].identifier[0]) {
-						eprop->defaultvalue= item[i].value;
+			if (!defaultfound) {
+				for (i = 0; item[i].identifier; i++) {
+					if (item[i].identifier[0]) {
+						eprop->defaultvalue = item[i].value;
 						break;
 					}
 				}
@@ -1279,185 +1306,188 @@ void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item
 			break;
 		}
 		default:
-			fprintf(stderr, "%s: \"%s.%s\", invalid type for struct type.\n", __func__, srna->identifier, prop->identifier);
-			DefRNA.error= 1;
+			fprintf(stderr, "%s: \"%s.%s\", invalid type for struct type.\n",
+			        __func__, srna->identifier, prop->identifier);
+			DefRNA.error = 1;
 			break;
 	}
 }
 
 void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength)
 {
-	StructRNA *srna= DefRNA.laststruct;
+	StructRNA *srna = DefRNA.laststruct;
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_STRING: {
-			StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
-			sprop->maxlength= maxlength;
+			StringPropertyRNA *sprop = (StringPropertyRNA*)prop;
+			sprop->maxlength = maxlength;
 			break;
 		}
 		default:
 			fprintf(stderr, "%s: \"%s.%s\", type is not string.\n", __func__, srna->identifier, prop->identifier);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 			break;
 	}
 }
 
 void RNA_def_property_boolean_default(PropertyRNA *prop, int value)
 {
-	StructRNA *srna= DefRNA.laststruct;
+	StructRNA *srna = DefRNA.laststruct;
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_BOOLEAN: {
-			BoolPropertyRNA *bprop= (BoolPropertyRNA*)prop;
-			bprop->defaultvalue= value;
+			BoolPropertyRNA *bprop = (BoolPropertyRNA*)prop;
+			bprop->defaultvalue = value;
 			break;
 		}
 		default:
 			fprintf(stderr, "%s: \"%s.%s\", type is not boolean.\n", __func__, srna->identifier, prop->identifier);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 			break;
 	}
 }
 
 void RNA_def_property_boolean_array_default(PropertyRNA *prop, const int *array)
 {
-	StructRNA *srna= DefRNA.laststruct;
+	StructRNA *srna = DefRNA.laststruct;
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_BOOLEAN: {
-			BoolPropertyRNA *bprop= (BoolPropertyRNA*)prop;
-			bprop->defaultarray= array;
+			BoolPropertyRNA *bprop = (BoolPropertyRNA*)prop;
+			bprop->defaultarray = array;
 			break;
 		}
 		default:
 			fprintf(stderr, "%s: \"%s.%s\", type is not boolean.\n", __func__, srna->identifier, prop->identifier);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 			break;
 	}
 }
 
 void RNA_def_property_int_default(PropertyRNA *prop, int value)
 {
-	StructRNA *srna= DefRNA.laststruct;
+	StructRNA *srna = DefRNA.laststruct;
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_INT: {
-			IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
-			iprop->defaultvalue= value;
+			IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
+			iprop->defaultvalue = value;
 			break;
 		}
 		default:
 			fprintf(stderr, "%s: \"%s.%s\", type is not int.\n", __func__, srna->identifier, prop->identifier);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 			break;
 	}
 }
 
 void RNA_def_property_int_array_default(PropertyRNA *prop, const int *array)
 {
-	StructRNA *srna= DefRNA.laststruct;
+	StructRNA *srna = DefRNA.laststruct;
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_INT: {
-			IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
-			iprop->defaultarray= array;
+			IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
+			iprop->defaultarray = array;
 			break;
 		}
 		default:
 			fprintf(stderr, "%s: \"%s.%s\", type is not int.\n", __func__, srna->identifier, prop->identifier);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 			break;
 	}
 }
 
 void RNA_def_property_float_default(PropertyRNA *prop, float value)
 {
-	StructRNA *srna= DefRNA.laststruct;
+	StructRNA *srna = DefRNA.laststruct;
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_FLOAT: {
-			FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
-			fprop->defaultvalue= value;
+			FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
+			fprop->defaultvalue = value;
 			break;
 		}
 		default:
 			fprintf(stderr, "%s: \"%s.%s\", type is not float.\n", __func__, srna->identifier, prop->identifier);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 			break;
 	}
 }
 /* array must remain valid after this function finishes */
 void RNA_def_property_float_array_default(PropertyRNA *prop, const float *array)
 {
-	StructRNA *srna= DefRNA.laststruct;
+	StructRNA *srna = DefRNA.laststruct;
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_FLOAT: {
-			FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
-			fprop->defaultarray= array; /* WARNING, this array must not come from the stack and lost */
+			FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
+			fprop->defaultarray = array; /* WARNING, this array must not come from the stack and lost */
 			break;
 		}
 		default:
 			fprintf(stderr, "%s: \"%s.%s\", type is not float.\n", __func__, srna->identifier, prop->identifier);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 			break;
 	}
 }
 
 void RNA_def_property_string_default(PropertyRNA *prop, const char *value)
 {
-	StructRNA *srna= DefRNA.laststruct;
+	StructRNA *srna = DefRNA.laststruct;
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_STRING: {
-			StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
-			sprop->defaultvalue= value;
+			StringPropertyRNA *sprop = (StringPropertyRNA*)prop;
+			sprop->defaultvalue = value;
 			break;
 		}
 		default:
 			fprintf(stderr, "%s: \"%s.%s\", type is not string.\n", __func__, srna->identifier, prop->identifier);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 			break;
 	}
 }
 
 void RNA_def_property_enum_default(PropertyRNA *prop, int value)
 {
-	StructRNA *srna= DefRNA.laststruct;
-	int i, defaultfound= 0;
+	StructRNA *srna = DefRNA.laststruct;
+	int i, defaultfound = 0;
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_ENUM: {
-			EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
-			eprop->defaultvalue= value;
+			EnumPropertyRNA *eprop = (EnumPropertyRNA*)prop;
+			eprop->defaultvalue = value;
 
-			if(prop->flag & PROP_ENUM_FLAG) {
+			if (prop->flag & PROP_ENUM_FLAG) {
 				/* check all bits are accounted for */
-				int totflag= 0;
-				for(i=0; i<eprop->totitem; i++) {
-					if(eprop->item[i].identifier[0]) {
+				int totflag = 0;
+				for (i = 0; i<eprop->totitem; i++) {
+					if (eprop->item[i].identifier[0]) {
 						totflag |= eprop->item[i].value;
 					}
 				}
 
-				if(eprop->defaultvalue & ~totflag) {
-					fprintf(stderr, "%s: \"%s.%s\", default includes unused bits (%d).\n", __func__, srna->identifier, prop->identifier, eprop->defaultvalue & ~totflag);
-					DefRNA.error= 1;
+				if (eprop->defaultvalue & ~totflag) {
+					fprintf(stderr, "%s: \"%s.%s\", default includes unused bits (%d).\n",
+					        __func__, srna->identifier, prop->identifier, eprop->defaultvalue & ~totflag);
+					DefRNA.error = 1;
 				}
 			}
 			else {
-				for(i=0; i<eprop->totitem; i++) {
-					if(eprop->item[i].identifier[0] && eprop->item[i].value == eprop->defaultvalue)
-						defaultfound= 1;
+				for (i = 0; i<eprop->totitem; i++) {
+					if (eprop->item[i].identifier[0] && eprop->item[i].value == eprop->defaultvalue)
+						defaultfound = 1;
 				}
 
-				if(!defaultfound && eprop->totitem) {
-					if(value == 0) {
-						eprop->defaultvalue= eprop->item[0].value;
+				if (!defaultfound && eprop->totitem) {
+					if (value == 0) {
+						eprop->defaultvalue = eprop->item[0].value;
 					}
 					else {
-						fprintf(stderr, "%s: \"%s.%s\", default is not in items.\n", __func__, srna->identifier, prop->identifier);
-						DefRNA.error= 1;
+						fprintf(stderr, "%s: \"%s.%s\", default is not in items.\n",
+						        __func__, srna->identifier, prop->identifier);
+						DefRNA.error = 1;
 					}
 				}
 			}
@@ -1466,7 +1496,7 @@ void RNA_def_property_enum_default(PropertyRNA *prop, int value)
 		}
 		default:
 			fprintf(stderr, "%s: \"%s.%s\", type is not enum.\n", __func__, srna->identifier, prop->identifier);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 			break;
 	}
 }
@@ -1479,55 +1509,55 @@ static PropertyDefRNA *rna_def_property_sdna(PropertyRNA *prop, const char *stru
 	StructDefRNA *ds;
 	PropertyDefRNA *dp;
 
-	dp= rna_find_struct_property_def(DefRNA.laststruct, prop);
-	if (dp==NULL) return NULL;
+	dp = rna_find_struct_property_def(DefRNA.laststruct, prop);
+	if (dp == NULL) return NULL;
 
-	ds= rna_find_struct_def((StructRNA*)dp->cont);
+	ds = rna_find_struct_def((StructRNA*)dp->cont);
 
-	if(!structname)
-		structname= ds->dnaname;
-	if(!propname)
-		propname= prop->identifier;
+	if (!structname)
+		structname = ds->dnaname;
+	if (!propname)
+		propname = prop->identifier;
 
-	if(!rna_find_sdna_member(DefRNA.sdna, structname, propname, &smember)) {
-		if(DefRNA.silent) {
+	if (!rna_find_sdna_member(DefRNA.sdna, structname, propname, &smember)) {
+		if (DefRNA.silent) {
 			return NULL;
 		}
-		else if(!DefRNA.verify) {
+		else if (!DefRNA.verify) {
 			/* some basic values to survive even with sdna info */
-			dp->dnastructname= structname;
-			dp->dnaname= propname;
-			if(prop->type == PROP_BOOLEAN)
-				dp->dnaarraylength= 1;
-			if(prop->type == PROP_POINTER)
-				dp->dnapointerlevel= 1;
+			dp->dnastructname = structname;
+			dp->dnaname = propname;
+			if (prop->type == PROP_BOOLEAN)
+				dp->dnaarraylength = 1;
+			if (prop->type == PROP_POINTER)
+				dp->dnapointerlevel = 1;
 			return dp;
 		}
 		else {
 			fprintf(stderr, "%s: \"%s.%s\" (identifier \"%s\") not found.\n",
 			        __func__, structname, propname, prop->identifier);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 			return NULL;
 		}
 	}
 
-	if(smember.arraylength > 1) {
-		prop->arraylength[0]= smember.arraylength;
-		prop->totarraylength= smember.arraylength;
-		prop->arraydimension= 1;
+	if (smember.arraylength > 1) {
+		prop->arraylength[0] = smember.arraylength;
+		prop->totarraylength = smember.arraylength;
+		prop->arraydimension = 1;
 	}
 	else {
-		prop->arraydimension= 0;
-		prop->totarraylength= 0;
+		prop->arraydimension = 0;
+		prop->totarraylength = 0;
 	}
 	
-	dp->dnastructname= structname;
-	dp->dnastructfromname= ds->dnafromname;
-	dp->dnastructfromprop= ds->dnafromprop;
-	dp->dnaname= propname;
-	dp->dnatype= smember.type;
-	dp->dnaarraylength= smember.arraylength;
-	dp->dnapointerlevel= smember.pointerlevel;
+	dp->dnastructname = structname;
+	dp->dnastructfromname = ds->dnafromname;
+	dp->dnastructfromprop = ds->dnafromprop;
+	dp->dnaname = propname;
+	dp->dnatype = smember.type;
+	dp->dnaarraylength = smember.arraylength;
+	dp->dnapointerlevel = smember.pointerlevel;
 
 	return dp;
 }
@@ -1535,128 +1565,133 @@ static PropertyDefRNA *rna_def_property_sdna(PropertyRNA *prop, const char *stru
 void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int bit)
 {
 	PropertyDefRNA *dp;
-	StructRNA *srna= DefRNA.laststruct;
+	StructRNA *srna = DefRNA.laststruct;
 	
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s: only during preprocessing.\n", __func__);
 		return;
 	}
 
-	if(prop->type != PROP_BOOLEAN) {
+	if (prop->type != PROP_BOOLEAN) {
 		fprintf(stderr, "%s: \"%s.%s\", type is not boolean.\n", __func__, srna->identifier, prop->identifier);
-		DefRNA.error= 1;
+		DefRNA.error = 1;
 		return;
 	}
 
-	if((dp=rna_def_property_sdna(prop, structname, propname))) {
+	if ((dp = rna_def_property_sdna(prop, structname, propname))) {
 
-		if(DefRNA.silent == 0) {
+		if (DefRNA.silent == 0) {
 			/* error check to ensure floats are not wrapped as ints/bools */
-			if(dp->dnatype && *dp->dnatype && IS_DNATYPE_INT_COMPAT(dp->dnatype) == 0) {
-				fprintf(stderr, "%s: %s.%s is a '%s' but wrapped as type '%s'.\n", __func__, srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type));
-				DefRNA.error= 1;
+			if (dp->dnatype && *dp->dnatype && IS_DNATYPE_INT_COMPAT(dp->dnatype) == 0) {
+				fprintf(stderr, "%s: %s.%s is a '%s' but wrapped as type '%s'.\n",
+				        __func__, srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type));
+				DefRNA.error = 1;
 				return;
 			}
 		}
 
-		dp->booleanbit= bit;
+		dp->booleanbit = bit;
 	}
 }
 
-void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int booleanbit)
+void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname,
+                                            const char *propname, int booleanbit)
 {
 	PropertyDefRNA *dp;
 
 	RNA_def_property_boolean_sdna(prop, structname, propname, booleanbit);
 
-	dp= rna_find_struct_property_def(DefRNA.laststruct, prop);
+	dp = rna_find_struct_property_def(DefRNA.laststruct, prop);
 
-	if(dp)
-		dp->booleannegative= 1;
+	if (dp)
+		dp->booleannegative = 1;
 }
 
 void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
 {
 	PropertyDefRNA *dp;
-	IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
-	StructRNA *srna= DefRNA.laststruct;
+	IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
+	StructRNA *srna = DefRNA.laststruct;
 	
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s: only during preprocessing.\n", __func__);
 		return;
 	}
 
-	if(prop->type != PROP_INT) {
+	if (prop->type != PROP_INT) {
 		fprintf(stderr, "%s: \"%s.%s\", type is not int.\n", __func__, srna->identifier, prop->identifier);
-		DefRNA.error= 1;
+		DefRNA.error = 1;
 		return;
 	}
 
-	if((dp= rna_def_property_sdna(prop, structname, propname))) {
+	if ((dp = rna_def_property_sdna(prop, structname, propname))) {
 
 		/* error check to ensure floats are not wrapped as ints/bools */
-		if(DefRNA.silent == 0) {
-			if(dp->dnatype && *dp->dnatype && IS_DNATYPE_INT_COMPAT(dp->dnatype) == 0) {
-				fprintf(stderr, "%s: %s.%s is a '%s' but wrapped as type '%s'.\n", __func__, srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type));
-				DefRNA.error= 1;
+		if (DefRNA.silent == 0) {
+			if (dp->dnatype && *dp->dnatype && IS_DNATYPE_INT_COMPAT(dp->dnatype) == 0) {
+				fprintf(stderr, "%s: %s.%s is a '%s' but wrapped as type '%s'.\n",
+				        __func__, srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type));
+				DefRNA.error = 1;
 				return;
 			}
 		}
 
 		/* SDNA doesn't pass us unsigned unfortunately .. */
-		if(dp->dnatype && strcmp(dp->dnatype, "char") == 0) {
-			iprop->hardmin= iprop->softmin= CHAR_MIN;
-			iprop->hardmax= iprop->softmax= CHAR_MAX;
+		if (dp->dnatype && strcmp(dp->dnatype, "char") == 0) {
+			iprop->hardmin = iprop->softmin = CHAR_MIN;
+			iprop->hardmax = iprop->softmax = CHAR_MAX;
 		}
-		else if(dp->dnatype && strcmp(dp->dnatype, "short") == 0) {
-			iprop->hardmin= iprop->softmin= SHRT_MIN;
-			iprop->hardmax= iprop->softmax= SHRT_MAX;
+		else if (dp->dnatype && strcmp(dp->dnatype, "short") == 0) {
+			iprop->hardmin = iprop->softmin = SHRT_MIN;
+			iprop->hardmax = iprop->softmax = SHRT_MAX;
 		}
-		else if(dp->dnatype && strcmp(dp->dnatype, "int") == 0) {
-			iprop->hardmin= INT_MIN;
-			iprop->hardmax= INT_MAX;
+		else if (dp->dnatype && strcmp(dp->dnatype, "int") == 0) {
+			iprop->hardmin = INT_MIN;
+			iprop->hardmax = INT_MAX;
 
-			iprop->softmin= -10000; /* rather arbitrary .. */
-			iprop->softmax= 10000;
+			iprop->softmin = -10000; /* rather arbitrary .. */
+			iprop->softmax = 10000;
 		}
 
-		if(prop->subtype == PROP_UNSIGNED || prop->subtype == PROP_PERCENTAGE || prop->subtype == PROP_FACTOR)
-			iprop->hardmin= iprop->softmin= 0;
+		if (prop->subtype == PROP_UNSIGNED || prop->subtype == PROP_PERCENTAGE || prop->subtype == PROP_FACTOR)
+			iprop->hardmin = iprop->softmin = 0;
 	}
 }
 
 void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
 {
 	PropertyDefRNA *dp;
-	FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
-	StructRNA *srna= DefRNA.laststruct;
+	FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
+	StructRNA *srna = DefRNA.laststruct;
 
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s: only during preprocessing.\n", __func__);
 		return;
 	}
 
-	if(prop->type != PROP_FLOAT) {
+	if (prop->type != PROP_FLOAT) {
 		fprintf(stderr, "%s: \"%s.%s\", type is not float.\n", __func__, srna->identifier, prop->identifier);
-		DefRNA.error= 1;
+		DefRNA.error = 1;
 		return;
 	}
 
-	if((dp= rna_def_property_sdna(prop, structname, propname))) {
+	if ((dp = rna_def_property_sdna(prop, structname, propname))) {
 		/* silent is for internal use */
-		if(DefRNA.silent == 0) {
-			if(dp->dnatype && *dp->dnatype && IS_DNATYPE_FLOAT_COMPAT(dp->dnatype) == 0) {
-				if(prop->subtype != PROP_COLOR_GAMMA) { /* colors are an exception. these get translated */
-					fprintf(stderr, "%s: %s.%s is a '%s' but wrapped as type '%s'.\n", __func__, srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type));
-					DefRNA.error= 1;
+		if (DefRNA.silent == 0) {
+			if (dp->dnatype && *dp->dnatype && IS_DNATYPE_FLOAT_COMPAT(dp->dnatype) == 0) {
+				if (prop->subtype != PROP_COLOR_GAMMA) { /* colors are an exception. these get translated */
+					fprintf(stderr, "%s: %s.%s is a '%s' but wrapped as type '%s'.\n",
+					        __func__, srna->identifier, prop->identifier, dp->dnatype,
+					        RNA_property_typename(prop->type));
+					DefRNA.error = 1;
 					return;
 				}
 			}
 		}
 
-		if(dp->dnatype && strcmp(dp->dnatype, "char") == 0) {
-			fprop->hardmin= fprop->softmin= 0.0f;
-			fprop->hardmax= fprop->softmax= 1.0f;
+		if (dp->dnatype && strcmp(dp->dnatype, "char") == 0) {
+			fprop->hardmin = fprop->softmin = 0.0f;
+			fprop->hardmax = fprop->softmax = 1.0f;
 		}
 	}
 
@@ -1666,27 +1701,28 @@ void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, cons
 void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
 {
 	/* PropertyDefRNA *dp; */
-	StructRNA *srna= DefRNA.laststruct;
+	StructRNA *srna = DefRNA.laststruct;
 	
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s: only during preprocessing.\n", __func__);
 		return;
 	}
 
-	if(prop->type != PROP_ENUM) {
+	if (prop->type != PROP_ENUM) {
 		fprintf(stderr, "%s: \"%s.%s\", type is not enum.\n", __func__, srna->identifier, prop->identifier);
-		DefRNA.error= 1;
+		DefRNA.error = 1;
 		return;
 	}
 
-	if(( /* dp= */ rna_def_property_sdna(prop, structname, propname))) {
-		if(prop->arraydimension) {
-			prop->arraydimension= 0;
-			prop->totarraylength= 0;
+	if (( /* dp= */ rna_def_property_sdna(prop, structname, propname))) {
+		if (prop->arraydimension) {
+			prop->arraydimension = 0;
+			prop->totarraylength = 0;
 
-			if(!DefRNA.silent) {
-				fprintf(stderr, "%s: \"%s.%s\", array not supported for enum type.\n", __func__, structname, propname);
-				DefRNA.error= 1;
+			if (!DefRNA.silent) {
+				fprintf(stderr, "%s: \"%s.%s\", array not supported for enum type.\n",
+				        __func__, structname, propname);
+				DefRNA.error = 1;
 			}
 		}
 	}
@@ -1698,34 +1734,34 @@ void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structnam
 
 	RNA_def_property_enum_sdna(prop, structname, propname);
 
-	dp= rna_find_struct_property_def(DefRNA.laststruct, prop);
+	dp = rna_find_struct_property_def(DefRNA.laststruct, prop);
 
-	if(dp)
-		dp->enumbitflags= 1;
+	if (dp)
+		dp->enumbitflags = 1;
 }
 
 void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
 {
 	/* PropertyDefRNA *dp; */
-	StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
-	StructRNA *srna= DefRNA.laststruct;
+	StringPropertyRNA *sprop = (StringPropertyRNA*)prop;
+	StructRNA *srna = DefRNA.laststruct;
 
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s: only during preprocessing.\n", __func__);
 		return;
 	}
 
-	if(prop->type != PROP_STRING) {
+	if (prop->type != PROP_STRING) {
 		fprintf(stderr, "%s: \"%s.%s\", type is not string.\n", __func__, srna->identifier, prop->identifier);
-		DefRNA.error= 1;
+		DefRNA.error = 1;
 		return;
 	}
 
-	if((/* dp= */ rna_def_property_sdna(prop, structname, propname))) {
-		if(prop->arraydimension) {
-			sprop->maxlength= prop->totarraylength;
-			prop->arraydimension= 0;
-			prop->totarraylength= 0;
+	if ((/* dp= */ rna_def_property_sdna(prop, structname, propname))) {
+		if (prop->arraydimension) {
+			sprop->maxlength = prop->totarraylength;
+			prop->arraydimension = 0;
+			prop->totarraylength = 0;
 		}
 	}
 }
@@ -1733,98 +1769,101 @@ void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, con
 void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
 {
 	/* PropertyDefRNA *dp; */
-	StructRNA *srna= DefRNA.laststruct;
+	StructRNA *srna = DefRNA.laststruct;
 	
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s: only during preprocessing.\n", __func__);
 		return;
 	}
 
-	if(prop->type != PROP_POINTER) {
+	if (prop->type != PROP_POINTER) {
 		fprintf(stderr, "%s: \"%s.%s\", type is not pointer.\n", __func__, srna->identifier, prop->identifier);
-		DefRNA.error= 1;
+		DefRNA.error = 1;
 		return;
 	}
 
-	if((/* dp= */ rna_def_property_sdna(prop, structname, propname))) {
-		if(prop->arraydimension) {
-			prop->arraydimension= 0;
-			prop->totarraylength= 0;
+	if ((/* dp= */ rna_def_property_sdna(prop, structname, propname))) {
+		if (prop->arraydimension) {
+			prop->arraydimension = 0;
+			prop->totarraylength = 0;
 
-			if(!DefRNA.silent) {
-				fprintf(stderr, "%s: \"%s.%s\", array not supported for pointer type.\n", __func__, structname, propname);
-				DefRNA.error= 1;
+			if (!DefRNA.silent) {
+				fprintf(stderr, "%s: \"%s.%s\", array not supported for pointer type.\n",
+				        __func__, structname, propname);
+				DefRNA.error = 1;
 			}
 		}
 	}
 }
 
-void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
+void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname,
+                                      const char *lengthpropname)
 {
 	PropertyDefRNA *dp;
-	CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
-	StructRNA *srna= DefRNA.laststruct;
+	CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)prop;
+	StructRNA *srna = DefRNA.laststruct;
 
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s: only during preprocessing.\n", __func__);
 		return;
 	}
 
-	if(prop->type != PROP_COLLECTION) {
+	if (prop->type != PROP_COLLECTION) {
 		fprintf(stderr, "%s: \"%s.%s\", type is not collection.\n", __func__, srna->identifier, prop->identifier);
-		DefRNA.error= 1;
+		DefRNA.error = 1;
 		return;
 	}
 
-	if((dp=rna_def_property_sdna(prop, structname, propname))) {
-		if(prop->arraydimension && !lengthpropname) {
-			prop->arraydimension= 0;
-			prop->totarraylength= 0;
+	if ((dp = rna_def_property_sdna(prop, structname, propname))) {
+		if (prop->arraydimension && !lengthpropname) {
+			prop->arraydimension = 0;
+			prop->totarraylength = 0;
 
-			if(!DefRNA.silent) {
-				fprintf(stderr, "%s: \"%s.%s\", array of collections not supported.\n", __func__, structname, propname);
-				DefRNA.error= 1;
+			if (!DefRNA.silent) {
+				fprintf(stderr, "%s: \"%s.%s\", array of collections not supported.\n",
+				        __func__, structname, propname);
+				DefRNA.error = 1;
 			}
 		}
 
-		if(dp->dnatype && strcmp(dp->dnatype, "ListBase") == 0) {
-			cprop->next= (PropCollectionNextFunc)"rna_iterator_listbase_next";
-			cprop->get= (PropCollectionGetFunc)"rna_iterator_listbase_get";
-			cprop->end= (PropCollectionEndFunc)"rna_iterator_listbase_end";
+		if (dp->dnatype && strcmp(dp->dnatype, "ListBase") == 0) {
+			cprop->next = (PropCollectionNextFunc)"rna_iterator_listbase_next";
+			cprop->get = (PropCollectionGetFunc)"rna_iterator_listbase_get";
+			cprop->end = (PropCollectionEndFunc)"rna_iterator_listbase_end";
 		}
 	}
 
-	if(dp && lengthpropname) {
+	if (dp && lengthpropname) {
 		DNAStructMember smember;
-		StructDefRNA *ds= rna_find_struct_def((StructRNA*)dp->cont);
+		StructDefRNA *ds = rna_find_struct_def((StructRNA*)dp->cont);
 
-		if(!structname)
-			structname= ds->dnaname;
+		if (!structname)
+			structname = ds->dnaname;
 
-		if(lengthpropname[0] == 0 || rna_find_sdna_member(DefRNA.sdna, structname, lengthpropname, &smember)) {
-			if(lengthpropname[0] == 0) {
-				dp->dnalengthfixed= prop->totarraylength;
-				prop->arraydimension= 0;
-				prop->totarraylength= 0;
+		if (lengthpropname[0] == 0 || rna_find_sdna_member(DefRNA.sdna, structname, lengthpropname, &smember)) {
+			if (lengthpropname[0] == 0) {
+				dp->dnalengthfixed = prop->totarraylength;
+				prop->arraydimension = 0;
+				prop->totarraylength = 0;
 			}
 			else {
-				dp->dnalengthstructname= structname;
-				dp->dnalengthname= lengthpropname;
-				prop->totarraylength= 0;
+				dp->dnalengthstructname = structname;
+				dp->dnalengthname = lengthpropname;
+				prop->totarraylength = 0;
 			}
 
-			cprop->next= (PropCollectionNextFunc)"rna_iterator_array_next";
-			cprop->end= (PropCollectionEndFunc)"rna_iterator_array_end";
+			cprop->next = (PropCollectionNextFunc)"rna_iterator_array_next";
+			cprop->end = (PropCollectionEndFunc)"rna_iterator_array_end";
 
-			if(dp->dnapointerlevel >= 2) 
-				cprop->get= (PropCollectionGetFunc)"rna_iterator_array_dereference_get";
+			if (dp->dnapointerlevel >= 2)
+				cprop->get = (PropCollectionGetFunc)"rna_iterator_array_dereference_get";
 			else
-				cprop->get= (PropCollectionGetFunc)"rna_iterator_array_get";
+				cprop->get = (PropCollectionGetFunc)"rna_iterator_array_get";
 		}
 		else {
-			if(!DefRNA.silent) {
+			if (!DefRNA.silent) {
 				fprintf(stderr, "%s: \"%s.%s\" not found.\n", __func__, structname, lengthpropname);
-				DefRNA.error= 1;
+				DefRNA.error = 1;
 			}
 		}
 	}
@@ -1832,471 +1871,477 @@ void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname,
 
 void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
 {
-	prop->translation_context= context;
+	prop->translation_context = context;
 }
 
 /* Functions */
 
 void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
 {
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s: only during preprocessing.\n", __func__);
 		return;
 	}
 
-	if(editable) prop->editable= (EditableFunc)editable;
+	if (editable) prop->editable = (EditableFunc)editable;
 }
 
 void RNA_def_property_editable_array_func(PropertyRNA *prop, const char *editable)
 {
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s: only during preprocessing.\n", __func__);
 		return;
 	}
 
-	if(editable) prop->itemeditable= (ItemEditableFunc)editable;
+	if (editable) prop->itemeditable = (ItemEditableFunc)editable;
 }
 
 void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
 {
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s: only during preprocessing.\n", __func__);
 		return;
 	}
 
-	prop->noteflag= noteflag;
-	prop->update= (UpdateFunc)func;
+	prop->noteflag = noteflag;
+	prop->update = (UpdateFunc)func;
 }
 
 void RNA_def_property_update_runtime(PropertyRNA *prop, void *func)
 {
-	prop->update= func;
+	prop->update = func;
 }
 
 void RNA_def_property_dynamic_array_funcs(PropertyRNA *prop, const char *getlength)
 {
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s: only during preprocessing.\n", __func__);
 		return;
 	}
 
 	if (!(prop->flag & PROP_DYNAMIC)) {
 		fprintf(stderr, "%s: property is a not dynamic array.\n", __func__);
-		DefRNA.error= 1;
+		DefRNA.error = 1;
 		return;
 	}
 
-	if(getlength) prop->getlength= (PropArrayLengthGetFunc)getlength;
+	if (getlength) prop->getlength = (PropArrayLengthGetFunc)getlength;
 }
 
 void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
 {
-	StructRNA *srna= DefRNA.laststruct;
+	StructRNA *srna = DefRNA.laststruct;
 
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s: only during preprocessing.\n", __func__);
 		return;
 	}
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_BOOLEAN: {
-			BoolPropertyRNA *bprop= (BoolPropertyRNA*)prop;
+			BoolPropertyRNA *bprop = (BoolPropertyRNA*)prop;
 
-			if(prop->arraydimension) {
-				if(get) bprop->getarray= (PropBooleanArrayGetFunc)get;
-				if(set) bprop->setarray= (PropBooleanArraySetFunc)set;
+			if (prop->arraydimension) {
+				if (get) bprop->getarray = (PropBooleanArrayGetFunc)get;
+				if (set) bprop->setarray = (PropBooleanArraySetFunc)set;
 			}
 			else {
-				if(get) bprop->get= (PropBooleanGetFunc)get;
-				if(set) bprop->set= (PropBooleanSetFunc)set;
+				if (get) bprop->get = (PropBooleanGetFunc)get;
+				if (set) bprop->set = (PropBooleanSetFunc)set;
 			}
 			break;
 		}
 		default:
 			fprintf(stderr, "%s: \"%s.%s\", type is not boolean.\n", __func__, srna->identifier, prop->identifier);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 			break;
 	}
 }
 
 void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
 {
-	StructRNA *srna= DefRNA.laststruct;
+	StructRNA *srna = DefRNA.laststruct;
 
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s: only during preprocessing.\n", __func__);
 		return;
 	}
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_INT: {
-			IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
+			IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
 
-			if(prop->arraydimension) {
-				if(get) iprop->getarray= (PropIntArrayGetFunc)get;
-				if(set) iprop->setarray= (PropIntArraySetFunc)set;
+			if (prop->arraydimension) {
+				if (get) iprop->getarray = (PropIntArrayGetFunc)get;
+				if (set) iprop->setarray = (PropIntArraySetFunc)set;
 			}
 			else {
-				if(get) iprop->get= (PropIntGetFunc)get;
-				if(set) iprop->set= (PropIntSetFunc)set;
+				if (get) iprop->get = (PropIntGetFunc)get;
+				if (set) iprop->set = (PropIntSetFunc)set;
 			}
-			if(range) iprop->range= (PropIntRangeFunc)range;
+			if (range) iprop->range = (PropIntRangeFunc)range;
 			break;
 		}
 		default:
 			fprintf(stderr, "%s: \"%s.%s\", type is not int.\n", __func__, srna->identifier, prop->identifier);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 			break;
 	}
 }
 
 void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
 {
-	StructRNA *srna= DefRNA.laststruct;
+	StructRNA *srna = DefRNA.laststruct;
 
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s: only during preprocessing.\n", __func__);
 		return;
 	}
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_FLOAT: {
-			FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
+			FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
 
-			if(prop->arraydimension) {
-				if(get) fprop->getarray= (PropFloatArrayGetFunc)get;
-				if(set) fprop->setarray= (PropFloatArraySetFunc)set;
+			if (prop->arraydimension) {
+				if (get) fprop->getarray = (PropFloatArrayGetFunc)get;
+				if (set) fprop->setarray = (PropFloatArraySetFunc)set;
 			}
 			else {
-				if(get) fprop->get= (PropFloatGetFunc)get;
-				if(set) fprop->set= (PropFloatSetFunc)set;
+				if (get) fprop->get = (PropFloatGetFunc)get;
+				if (set) fprop->set = (PropFloatSetFunc)set;
 			}
-			if(range) fprop->range= (PropFloatRangeFunc)range;
+			if (range) fprop->range = (PropFloatRangeFunc)range;
 			break;
 		}
 		default:
 			fprintf(stderr, "%s: \"%s.%s\", type is not float.\n", __func__, srna->identifier, prop->identifier);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 			break;
 	}
 }
 
 void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
 {
-	StructRNA *srna= DefRNA.laststruct;
+	StructRNA *srna = DefRNA.laststruct;
 
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s: only during preprocessing.\n", __func__);
 		return;
 	}
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_ENUM: {
-			EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
+			EnumPropertyRNA *eprop = (EnumPropertyRNA*)prop;
 
-			if(get) eprop->get= (PropEnumGetFunc)get;
-			if(set) eprop->set= (PropEnumSetFunc)set;
-			if(item) eprop->itemf= (PropEnumItemFunc)item;
+			if (get) eprop->get = (PropEnumGetFunc)get;
+			if (set) eprop->set = (PropEnumSetFunc)set;
+			if (item) eprop->itemf = (PropEnumItemFunc)item;
 			break;
 		}
 		default:
 			fprintf(stderr, "%s: \"%s.%s\", type is not enum.\n", __func__, srna->identifier, prop->identifier);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 			break;
 	}
 }
 
 void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
 {
-	StructRNA *srna= DefRNA.laststruct;
+	StructRNA *srna = DefRNA.laststruct;
 
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s: only during preprocessing.\n", __func__);
 		return;
 	}
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_STRING: {
-			StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
+			StringPropertyRNA *sprop = (StringPropertyRNA*)prop;
 
-			if(get) sprop->get= (PropStringGetFunc)get;
-			if(length) sprop->length= (PropStringLengthFunc)length;
-			if(set) sprop->set= (PropStringSetFunc)set;
+			if (get) sprop->get = (PropStringGetFunc)get;
+			if (length) sprop->length = (PropStringLengthFunc)length;
+			if (set) sprop->set = (PropStringSetFunc)set;
 			break;
 		}
 		default:
 			fprintf(stderr, "%s: \"%s.%s\", type is not string.\n", __func__, srna->identifier, prop->identifier);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 			break;
 	}
 }
 
-void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *typef, const char *poll)
+void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set,
+                                    const char *typef, const char *poll)
 {
-	StructRNA *srna= DefRNA.laststruct;
+	StructRNA *srna = DefRNA.laststruct;
 
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s: only during preprocessing.\n", __func__);
 		return;
 	}
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_POINTER: {
-			PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
+			PointerPropertyRNA *pprop = (PointerPropertyRNA*)prop;
 
-			if(get) pprop->get= (PropPointerGetFunc)get;
-			if(set) pprop->set= (PropPointerSetFunc)set;
-			if(typef) pprop->typef= (PropPointerTypeFunc)typef;
-			if(poll) pprop->poll= (PropPointerPollFunc)poll;
+			if (get) pprop->get = (PropPointerGetFunc)get;
+			if (set) pprop->set = (PropPointerSetFunc)set;
+			if (typef) pprop->typef = (PropPointerTypeFunc)typef;
+			if (poll) pprop->poll = (PropPointerPollFunc)poll;
 			break;
 		}
 		default:
 			fprintf(stderr, "%s: \"%s.%s\", type is not pointer.\n", __func__, srna->identifier, prop->identifier);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 			break;
 	}
 }
 
-void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *assignint)
+void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end,
+                                       const char *get, const char *length, const char *lookupint,
+                                       const char *lookupstring, const char *assignint)
 {
-	StructRNA *srna= DefRNA.laststruct;
+	StructRNA *srna = DefRNA.laststruct;
 
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s: only during preprocessing.\n", __func__);
 		return;
 	}
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_COLLECTION: {
-			CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
-
-			if(begin) cprop->begin= (PropCollectionBeginFunc)begin;
-			if(next) cprop->next= (PropCollectionNextFunc)next;
-			if(end) cprop->end= (PropCollectionEndFunc)end;
-			if(get) cprop->get= (PropCollectionGetFunc)get;
-			if(length) cprop->length= (PropCollectionLengthFunc)length;
-			if(lookupint) cprop->lookupint= (PropCollectionLookupIntFunc)lookupint;
-			if(lookupstring) cprop->lookupstring= (PropCollectionLookupStringFunc)lookupstring;
-			if(assignint) cprop->assignint= (PropCollectionAssignIntFunc)assignint;
+			CollectionPropertyRNA *cprop = (CollectionPropertyRNA*)prop;
+
+			if (begin) cprop->begin = (PropCollectionBeginFunc)begin;
+			if (next) cprop->next = (PropCollectionNextFunc)next;
+			if (end) cprop->end = (PropCollectionEndFunc)end;
+			if (get) cprop->get = (PropCollectionGetFunc)get;
+			if (length) cprop->length = (PropCollectionLengthFunc)length;
+			if (lookupint) cprop->lookupint = (PropCollectionLookupIntFunc)lookupint;
+			if (lookupstring) cprop->lookupstring = (PropCollectionLookupStringFunc)lookupstring;
+			if (assignint) cprop->assignint = (PropCollectionAssignIntFunc)assignint;
 			break;
 		}
 		default:
 			fprintf(stderr, "%s: \"%s.%s\", type is not collection.\n", __func__, srna->identifier, prop->identifier);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 			break;
 	}
 }
 
 void RNA_def_property_srna(PropertyRNA *prop, const char *type)
 {
-	prop->srna= (StructRNA*)type;
+	prop->srna = (StructRNA*)type;
 }
 
 void RNA_def_py_data(PropertyRNA *prop, void *py_data)
 {
-	prop->py_data= py_data;
+	prop->py_data = py_data;
 }
 
 /* Compact definitions */
 
-PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, int default_value, const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, int default_value,
+                             const char *ui_name, const char *ui_description)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
-	prop= RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_default(prop, default_value);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 
 	return prop;
 }
 
-PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value, 
-	const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value,
+                                   const char *ui_name, const char *ui_description)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
-	prop= RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_NONE);
-	if(len != 0) RNA_def_property_array(prop, len);
-	if(default_value) RNA_def_property_boolean_array_default(prop, default_value);
+	prop = RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_NONE);
+	if (len != 0) RNA_def_property_array(prop, len);
+	if (default_value) RNA_def_property_boolean_array_default(prop, default_value);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 
 	return prop;
 }
 
-PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value, 
-	const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value,
+                                   const char *ui_name, const char *ui_description)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
-	prop= RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_LAYER);
-	if(len != 0) RNA_def_property_array(prop, len);
-	if(default_value) RNA_def_property_boolean_array_default(prop, default_value);
+	prop = RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_LAYER);
+	if (len != 0) RNA_def_property_array(prop, len);
+	if (default_value) RNA_def_property_boolean_array_default(prop, default_value);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 
 	return prop;
 }
 
-PropertyRNA *RNA_def_boolean_layer_member(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value, 
-	const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_boolean_layer_member(StructOrFunctionRNA *cont_, const char *identifier, int len,
+                                          int *default_value, const char *ui_name, const char *ui_description)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
-	prop= RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_LAYER_MEMBER);
-	if(len != 0) RNA_def_property_array(prop, len);
-	if(default_value) RNA_def_property_boolean_array_default(prop, default_value);
+	prop = RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_LAYER_MEMBER);
+	if (len != 0) RNA_def_property_array(prop, len);
+	if (default_value) RNA_def_property_boolean_array_default(prop, default_value);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 
 	return prop;
 }
 
-PropertyRNA *RNA_def_boolean_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value, 
-	const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_boolean_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value,
+                                    const char *ui_name, const char *ui_description)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
-	prop= RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_XYZ); // XXX
-	if(len != 0) RNA_def_property_array(prop, len);
-	if(default_value) RNA_def_property_boolean_array_default(prop, default_value);
+	prop = RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_XYZ); /* XXX */
+	if (len != 0) RNA_def_property_array(prop, len);
+	if (default_value) RNA_def_property_boolean_array_default(prop, default_value);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 
 	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_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
-	prop= RNA_def_property(cont, identifier, PROP_INT, PROP_NONE);
+	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);
+	if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 	RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
 
 	return prop;
 }
 
-PropertyRNA *RNA_def_int_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const int *default_value, 
-	int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
+PropertyRNA *RNA_def_int_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const int *default_value,
+                                int hardmin, int hardmax, const char *ui_name, const char *ui_description,
+                                int softmin, int softmax)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
-	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);
-	if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
+	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);
+	if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 	RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
 
 	return prop;
 }
 
-PropertyRNA *RNA_def_int_array(StructOrFunctionRNA *cont_, const char *identifier, int len, const int *default_value, 
-	int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
+PropertyRNA *RNA_def_int_array(StructOrFunctionRNA *cont_, const char *identifier, int len, const int *default_value,
+                               int hardmin, int hardmax, const char *ui_name, const char *ui_description,
+                               int softmin, int softmax)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
-	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);
-	if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
+	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);
+	if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 	RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
 
 	return prop;
 }
 
-PropertyRNA *RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, 
-	const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen,
+                            const char *ui_name, const char *ui_description)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
-	prop= RNA_def_property(cont, identifier, PROP_STRING, PROP_NONE);
-	if(maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen);
-	if(default_value) RNA_def_property_string_default(prop, default_value);
+	prop = RNA_def_property(cont, identifier, PROP_STRING, PROP_NONE);
+	if (maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen);
+	if (default_value) RNA_def_property_string_default(prop, default_value);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 
 	return prop;
 }
 
-PropertyRNA *RNA_def_string_file_path(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, 
-	const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_string_file_path(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value,
+                                      int maxlen, const char *ui_name, const char *ui_description)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
-	prop= RNA_def_property(cont, identifier, PROP_STRING, PROP_FILEPATH);
-	if(maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen);
-	if(default_value) RNA_def_property_string_default(prop, default_value);
+	prop = RNA_def_property(cont, identifier, PROP_STRING, PROP_FILEPATH);
+	if (maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen);
+	if (default_value) RNA_def_property_string_default(prop, default_value);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 
 	return prop;
 }
 
-PropertyRNA *RNA_def_string_dir_path(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, 
-	const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_string_dir_path(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value,
+                                     int maxlen, const char *ui_name, const char *ui_description)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
-	prop= RNA_def_property(cont, identifier, PROP_STRING, PROP_DIRPATH);
-	if(maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen);
-	if(default_value) RNA_def_property_string_default(prop, default_value);
+	prop = RNA_def_property(cont, identifier, PROP_STRING, PROP_DIRPATH);
+	if (maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen);
+	if (default_value) RNA_def_property_string_default(prop, default_value);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 
 	return prop;
 }
 
-PropertyRNA *RNA_def_string_file_name(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, 
-	const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_string_file_name(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value,
+                                      int maxlen, const char *ui_name, const char *ui_description)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
-	prop= RNA_def_property(cont, identifier, PROP_STRING, PROP_FILENAME);
-	if(maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen);
-	if(default_value) RNA_def_property_string_default(prop, default_value);
+	prop = RNA_def_property(cont, identifier, PROP_STRING, PROP_FILENAME);
+	if (maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen);
+	if (default_value) RNA_def_property_string_default(prop, default_value);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 
 	return prop;
 }
 
-PropertyRNA *RNA_def_string_translate(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen,
-	const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_string_translate(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value,
+                                      int maxlen, const char *ui_name, const char *ui_description)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 
-	prop= RNA_def_property(cont, identifier, PROP_STRING, PROP_TRANSLATE);
-	if(maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen);
-	if(default_value) RNA_def_property_string_default(prop, default_value);
+	prop = RNA_def_property(cont, identifier, PROP_STRING, PROP_TRANSLATE);
+	if (maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen);
+	if (default_value) RNA_def_property_string_default(prop, default_value);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 
 	return prop;
 }
 
-PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, 
-	const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items,
+                          int default_value, const char *ui_name, const char *ui_description)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 
-	if(!items) {
+	if (!items) {
 		printf("%s: items not allowed to be NULL.\n", __func__);
 		return NULL;
 	}
 	
-	prop= RNA_def_property(cont, identifier, PROP_ENUM, PROP_NONE);
-	if(items) RNA_def_property_enum_items(prop, items);
+	prop = RNA_def_property(cont, identifier, PROP_ENUM, PROP_NONE);
+	if (items) RNA_def_property_enum_items(prop, items);
 	RNA_def_property_enum_default(prop, default_value);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 
@@ -2304,20 +2349,20 @@ PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, co
 }
 
 /* same as above but sets 'PROP_ENUM_FLAG' before setting the default value */
-PropertyRNA *RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value,
-	const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items,
+                               int default_value, const char *ui_name, const char *ui_description)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 
-	if(!items) {
+	if (!items) {
 		printf("%s: items not allowed to be NULL.\n", __func__);
 		return NULL;
 	}
 
-	prop= RNA_def_property(cont, identifier, PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(cont, identifier, PROP_ENUM, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_ENUM_FLAG); /* important to run before default set */
-	if(items) RNA_def_property_enum_items(prop, items);
+	if (items) RNA_def_property_enum_items(prop, items);
 	RNA_def_property_enum_default(prop, default_value);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 
@@ -2326,68 +2371,73 @@ PropertyRNA *RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifie
 
 void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc)
 {
-	EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
-	eprop->itemf= itemfunc;
+	EnumPropertyRNA *eprop = (EnumPropertyRNA*)prop;
+	eprop->itemf = itemfunc;
 }
 
 void RNA_def_enum_py_data(PropertyRNA *prop, void *py_data)
 {
-	EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
-	eprop->py_data= py_data;
+	EnumPropertyRNA *eprop = (EnumPropertyRNA*)prop;
+	eprop->py_data = py_data;
 }
 
-PropertyRNA *RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, 
-	float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
+PropertyRNA *RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value,
+                           float hardmin, float hardmax, const char *ui_name, const char *ui_description,
+                           float softmin, float softmax)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
-	prop= RNA_def_property(cont, identifier, PROP_FLOAT, PROP_NONE);
+	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);
+	if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 	RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
 
 	return prop;
 }
 
-PropertyRNA *RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, 
-	float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
+PropertyRNA *RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, int len,
+                                  const float *default_value, float hardmin, float hardmax, const char *ui_name,
+                                  const char *ui_description, float softmin, float softmax)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
-	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);
-	if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
+	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);
+	if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 	RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
 
 	return prop;
 }
 
-PropertyRNA *RNA_def_float_vector_xyz(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, 
-	float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
+PropertyRNA *RNA_def_float_vector_xyz(StructOrFunctionRNA *cont_, const char *identifier, int len,
+                                      const float *default_value, float hardmin, float hardmax, const char *ui_name,
+                                      const char *ui_description, float softmin, float softmax)
 {
 	PropertyRNA *prop;
 	
-	prop= RNA_def_float_vector(cont_, identifier, len, default_value, hardmin, hardmax, ui_name, ui_description, softmin, softmax);
+	prop = RNA_def_float_vector(cont_, identifier, len, default_value, hardmin, hardmax, ui_name, ui_description,
+	                            softmin, softmax);
 	prop->subtype = PROP_XYZ_LENGTH;
 
 	return prop;
 }
 
-PropertyRNA *RNA_def_float_color(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, 
-	float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
+PropertyRNA *RNA_def_float_color(StructOrFunctionRNA *cont_, const char *identifier, int len,
+                                 const float *default_value, float hardmin, float hardmax, const char *ui_name,
+                                 const char *ui_description, float softmin, float softmax)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
-	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);
-	if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
+	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);
+	if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 	RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
 
@@ -2395,58 +2445,61 @@ PropertyRNA *RNA_def_float_color(StructOrFunctionRNA *cont_, const char *identif
 }
 
 
-PropertyRNA *RNA_def_float_matrix(StructOrFunctionRNA *cont_, const char *identifier, int rows, int columns, const float *default_value, 
-	float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
+PropertyRNA *RNA_def_float_matrix(StructOrFunctionRNA *cont_, const char *identifier, int rows, int columns,
+                                  const float *default_value, float hardmin, float hardmax, const char *ui_name,
+                                  const char *ui_description, float softmin, float softmax)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	int length[2];
 
-	length[0]= rows;
-	length[1]= columns;
+	length[0] = rows;
+	length[1] = columns;
 
-	prop= RNA_def_property(cont, identifier, PROP_FLOAT, PROP_MATRIX);
+	prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_MATRIX);
 	RNA_def_property_multi_array(prop, 2, length);
-	if(default_value) RNA_def_property_float_array_default(prop, default_value);
-	if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
+	if (default_value) RNA_def_property_float_array_default(prop, default_value);
+	if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 	RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
 
 	return prop;
 }
 
-PropertyRNA *RNA_def_float_rotation(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value,
-	float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
+PropertyRNA *RNA_def_float_rotation(StructOrFunctionRNA *cont_, const char *identifier, int len,
+                                    const float *default_value, float hardmin, float hardmax, const char *ui_name,
+                                    const char *ui_description, float softmin, float softmax)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
-	prop= RNA_def_property(cont, identifier, PROP_FLOAT, (len != 0) ? PROP_EULER : PROP_ANGLE);
-	if(len != 0) {
+	prop = RNA_def_property(cont, identifier, PROP_FLOAT, (len != 0) ? PROP_EULER : PROP_ANGLE);
+	if (len != 0) {
 		RNA_def_property_array(prop, len);
-		if(default_value) RNA_def_property_float_array_default(prop, default_value);
+		if (default_value) RNA_def_property_float_array_default(prop, default_value);
 	}
 	else {
 		/* RNA_def_property_float_default must be called outside */
 		BLI_assert(default_value == NULL);
 	}
-	if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
+	if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 	RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
 
 	return prop;
 }
 
-PropertyRNA *RNA_def_float_array(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value,
-	float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
+PropertyRNA *RNA_def_float_array(StructOrFunctionRNA *cont_, const char *identifier, int len,
+                                 const float *default_value, float hardmin, float hardmax, const char *ui_name,
+                                 const char *ui_description, float softmin, float softmax)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
-	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);
-	if(hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
+	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);
+	if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 	RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
 
@@ -2454,14 +2507,15 @@ PropertyRNA *RNA_def_float_array(StructOrFunctionRNA *cont_, const char *identif
 }
 
 PropertyRNA *RNA_def_float_percentage(StructOrFunctionRNA *cont_, const char *identifier, float default_value,
-	float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
+                                      float hardmin, float hardmax, const char *ui_name, const char *ui_description,
+                                      float softmin, float softmax)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
-	prop= RNA_def_property(cont, identifier, PROP_FLOAT, PROP_PERCENTAGE);
+	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);
+	if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 	RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
 
@@ -2469,14 +2523,15 @@ PropertyRNA *RNA_def_float_percentage(StructOrFunctionRNA *cont_, const char *id
 }
 
 PropertyRNA *RNA_def_float_factor(StructOrFunctionRNA *cont_, const char *identifier, float default_value,
-	float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
+                                  float hardmin, float hardmax, const char *ui_name, const char *ui_description,
+                                  float softmin, float softmax)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
-	prop= RNA_def_property(cont, identifier, PROP_FLOAT, PROP_FACTOR);
+	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);
+	if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 	RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
 
@@ -2484,12 +2539,12 @@ PropertyRNA *RNA_def_float_factor(StructOrFunctionRNA *cont_, const char *identi
 }
 
 PropertyRNA *RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type,
-	const char *ui_name, const char *ui_description)
+                             const char *ui_name, const char *ui_description)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
-	prop= RNA_def_property(cont, identifier, PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(cont, identifier, PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, type);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 
@@ -2497,12 +2552,12 @@ PropertyRNA *RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier,
 }
 
 PropertyRNA *RNA_def_pointer_runtime(StructOrFunctionRNA *cont_, const char *identifier, StructRNA *type,
-	const char *ui_name, const char *ui_description)
+                                     const char *ui_name, const char *ui_description)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
-	prop= RNA_def_property(cont, identifier, PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(cont, identifier, PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_runtime(prop, type);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 
@@ -2510,12 +2565,12 @@ PropertyRNA *RNA_def_pointer_runtime(StructOrFunctionRNA *cont_, const char *ide
 }
 
 PropertyRNA *RNA_def_collection(StructOrFunctionRNA *cont_, const char *identifier, const char *type,
-	const char *ui_name, const char *ui_description)
+                                const char *ui_name, const char *ui_description)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
-	prop= RNA_def_property(cont, identifier, PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(cont, identifier, PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, type);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 
@@ -2523,12 +2578,12 @@ PropertyRNA *RNA_def_collection(StructOrFunctionRNA *cont_, const char *identifi
 }
 
 PropertyRNA *RNA_def_collection_runtime(StructOrFunctionRNA *cont_, const char *identifier, StructRNA *type,
-	const char *ui_name, const char *ui_description)
+                                        const char *ui_name, const char *ui_description)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
-	prop= RNA_def_property(cont, identifier, PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(cont, identifier, PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_runtime(prop, type);
 	RNA_def_property_ui_text(prop, ui_name, ui_description);
 
@@ -2543,29 +2598,29 @@ static FunctionRNA *rna_def_function(StructRNA *srna, const char *identifier)
 	StructDefRNA *dsrna;
 	FunctionDefRNA *dfunc;
 
-	if(DefRNA.preprocess) {
+	if (DefRNA.preprocess) {
 		char error[512];
 
 		if (rna_validate_identifier(identifier, error, 0) == 0) {
 			fprintf(stderr, "%s: function identifier \"%s\" - %s\n", __func__, identifier, error);
-			DefRNA.error= 1;
+			DefRNA.error = 1;
 		}
 	}
 
-	func= MEM_callocN(sizeof(FunctionRNA), "FunctionRNA");
-	func->identifier= identifier;
-	func->description= identifier;
+	func = MEM_callocN(sizeof(FunctionRNA), "FunctionRNA");
+	func->identifier = identifier;
+	func->description = identifier;
 
 	rna_addtail(&srna->functions, func);
 
-	if(DefRNA.preprocess) {
-		dsrna= rna_find_struct_def(srna);
-		dfunc= MEM_callocN(sizeof(FunctionDefRNA), "FunctionDefRNA");
+	if (DefRNA.preprocess) {
+		dsrna = rna_find_struct_def(srna);
+		dfunc = MEM_callocN(sizeof(FunctionDefRNA), "FunctionDefRNA");
 		rna_addtail(&dsrna->functions, dfunc);
-		dfunc->func= func;
+		dfunc->func = func;
 	}
 	else
-		func->flag|= FUNC_RUNTIME;
+		func->flag |= FUNC_RUNTIME;
 
 	return func;
 }
@@ -2575,15 +2630,15 @@ FunctionRNA *RNA_def_function(StructRNA *srna, const char *identifier, const cha
 	FunctionRNA *func;
 	FunctionDefRNA *dfunc;
 
-	func= rna_def_function(srna, identifier);
+	func = rna_def_function(srna, identifier);
 
-	if(!DefRNA.preprocess) {
+	if (!DefRNA.preprocess) {
 		fprintf(stderr, "%s: only at preprocess time.\n", __func__);
 		return func;
 	}
 
-	dfunc= rna_find_function_def(func);
-	dfunc->call= call;
+	dfunc = rna_find_function_def(func);
+	dfunc->call = call;
 
 	return func;
 }
@@ -2592,14 +2647,14 @@ FunctionRNA *RNA_def_function_runtime(StructRNA *srna, const char *identifier, C
 {
 	FunctionRNA *func;
 
-	func= rna_def_function(srna, identifier);
+	func = rna_def_function(srna, identifier);
 
-	if(DefRNA.preprocess) {
+	if (DefRNA.preprocess) {
 		fprintf(stderr, "%s: only at runtime.\n", __func__);
 		return func;
 	}
 
-	func->call= call;
+	func->call = call;
 
 
 	return func;
@@ -2609,40 +2664,42 @@ FunctionRNA *RNA_def_function_runtime(StructRNA *srna, const char *identifier, C
 void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
 {
 	if (ret->flag & PROP_DYNAMIC) {
-		fprintf(stderr, "%s: \"%s.%s\", dynamic values are not allowed as strict returns, use RNA_def_function_output instead.\n", __func__, func->identifier, ret->identifier);
+		fprintf(stderr, "%s: \"%s.%s\", dynamic values are not allowed as strict returns, "
+		        "use RNA_def_function_output instead.\n", __func__, func->identifier, ret->identifier);
 		return;
 	}
 	else if (ret->arraydimension) {
-		fprintf(stderr, "%s: \"%s.%s\", arrays are not allowed as strict returns, use RNA_def_function_output instead.\n", __func__, func->identifier, ret->identifier);
+		fprintf(stderr, "%s: \"%s.%s\", arrays are not allowed as strict returns, "
+		        "use RNA_def_function_output instead.\n", __func__, func->identifier, ret->identifier);
 		return;
 	}
 
-	func->c_ret= ret;
+	func->c_ret = ret;
 
 	RNA_def_function_output(func, ret);
 }
 
 void RNA_def_function_output(FunctionRNA *UNUSED(func), PropertyRNA *ret)
 {
-	ret->flag|= PROP_OUTPUT;
+	ret->flag |= PROP_OUTPUT;
 }
 
 void RNA_def_function_flag(FunctionRNA *func, int flag)
 {
-	func->flag|= flag;
+	func->flag |= flag;
 }
 
 void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
 {
-	func->description= description;
+	func->description = description;
 }
 
 int rna_parameter_size(PropertyRNA *parm)
 {
-	PropertyType ptype= parm->type;
-	int len= parm->totarraylength; /* only supports fixed length at the moment */
+	PropertyType ptype = parm->type;
+	int len = parm->totarraylength; /* only supports fixed length at the moment */
 
-	if(len > 0) {
+	if (len > 0) {
 		/* XXX in other parts is mentioned that strings can be dynamic as well */
 		if (parm->flag & PROP_DYNAMIC)
 			return sizeof(void *);
@@ -2666,20 +2723,21 @@ int rna_parameter_size(PropertyRNA *parm)
 			case PROP_FLOAT:
 				return sizeof(float);
 			case PROP_STRING:
-				/* return  valyes dont store a pointer to the original */
-				if(parm->flag & PROP_THICK_WRAP) {
-					StringPropertyRNA *sparm= (StringPropertyRNA*)parm;
+				/* return values don't store a pointer to the original */
+				if (parm->flag & PROP_THICK_WRAP) {
+					StringPropertyRNA *sparm = (StringPropertyRNA*)parm;
 					return sizeof(char) * sparm->maxlength;
-				} else
+				}
+				else
 					return sizeof(char *);
 			case PROP_POINTER: {
 #ifdef RNA_RUNTIME
-				if(parm->flag & PROP_RNAPTR)
+				if (parm->flag & PROP_RNAPTR)
 					return sizeof(PointerRNA);
 				else
 					return sizeof(void *);
 #else
-				if(parm->flag & PROP_RNAPTR)
+				if (parm->flag & PROP_RNAPTR)
 					return sizeof(PointerRNA);
 				else
 					return sizeof(void *);
@@ -2694,13 +2752,13 @@ int rna_parameter_size(PropertyRNA *parm)
 }
 
 /* this function returns the size of the memory allocated for the parameter,
-   useful for instance for memory alignment or for storing additional information */
+ * useful for instance for memory alignment or for storing additional information */
 int rna_parameter_size_alloc(PropertyRNA *parm)
 {
 	int size = rna_parameter_size(parm);
 
 	if (parm->flag & PROP_DYNAMIC)
-		size+= sizeof(((ParameterDynAlloc *)NULL)->array_tot);
+		size += sizeof(((ParameterDynAlloc *)NULL)->array_tot);
 
 	return size;
 }
@@ -2710,21 +2768,21 @@ int rna_parameter_size_alloc(PropertyRNA *parm)
 void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
 {
 	EnumPropertyItem *newitems;
-	int tot= *totitem;
+	int tot = *totitem;
 
-	if(tot == 0) {
-		*items= MEM_callocN(sizeof(EnumPropertyItem)*8, "RNA_enum_items_add");
+	if (tot == 0) {
+		*items = MEM_callocN(sizeof(EnumPropertyItem)*8, "RNA_enum_items_add");
 	}
-	else if(tot >= 8 && (tot&(tot-1)) == 0){
+	else if (tot >= 8 && (tot&(tot-1)) == 0) {
 		/* power of two > 8 */
-		newitems= MEM_callocN(sizeof(EnumPropertyItem)*tot*2, "RNA_enum_items_add");
+		newitems = MEM_callocN(sizeof(EnumPropertyItem)*tot*2, "RNA_enum_items_add");
 		memcpy(newitems, *items, sizeof(EnumPropertyItem)*tot);
 		MEM_freeN(*items);
-		*items= newitems;
+		*items = newitems;
 	}
 
-	(*items)[tot]= *item;
-	*totitem= tot+1;
+	(*items)[tot] = *item;
+	*totitem = tot+1;
 }
 
 void RNA_enum_item_add_separator(EnumPropertyItem **items, int *totitem)
@@ -2735,16 +2793,18 @@ void RNA_enum_item_add_separator(EnumPropertyItem **items, int *totitem)
 
 void RNA_enum_items_add(EnumPropertyItem **items, int *totitem, EnumPropertyItem *item)
 {
-	for(; item->identifier; item++)
+	for (; item->identifier; item++)
 		RNA_enum_item_add(items, totitem, item);
 }
 
 void RNA_enum_items_add_value(EnumPropertyItem **items, int *totitem, EnumPropertyItem *item, int value)
 {
-	for(; item->identifier; item++) {
-		if(item->value == value) {
+	for (; item->identifier; item++) {
+		if (item->value == value) {
 			RNA_enum_item_add(items, totitem, item);
-			break; // break on first match - does this break anything? (is quick hack to get object->parent_type working ok for armature/lattice)
+			/* break on first match - does this break anything?
+			 * (is quick hack to get object->parent_type working ok for armature/lattice) */
+			break;
 		}
 	}
 }
@@ -2760,111 +2820,116 @@ void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
 #ifdef RNA_RUNTIME
 void RNA_def_struct_duplicate_pointers(StructRNA *srna)
 {
-	if(srna->identifier) srna->identifier= BLI_strdup(srna->identifier);
-	if(srna->name) srna->name= BLI_strdup(srna->name);
-	if(srna->description) srna->description= BLI_strdup(srna->description);
+	if (srna->identifier) srna->identifier = BLI_strdup(srna->identifier);
+	if (srna->name) srna->name = BLI_strdup(srna->name);
+	if (srna->description) srna->description = BLI_strdup(srna->description);
 
 	srna->flag |= STRUCT_FREE_POINTERS;
 }
 
 void RNA_def_struct_free_pointers(StructRNA *srna)
 {
-	if(srna->flag & STRUCT_FREE_POINTERS) {
-		if(srna->identifier) MEM_freeN((void*)srna->identifier);
-		if(srna->name) MEM_freeN((void*)srna->name);
-		if(srna->description) MEM_freeN((void*)srna->description);
+	if (srna->flag & STRUCT_FREE_POINTERS) {
+		if (srna->identifier) MEM_freeN((void*)srna->identifier);
+		if (srna->name) MEM_freeN((void*)srna->name);
+		if (srna->description) MEM_freeN((void*)srna->description);
 	}
 }
 
 void RNA_def_func_duplicate_pointers(FunctionRNA *func)
 {
-	if(func->identifier) func->identifier= BLI_strdup(func->identifier);
-	if(func->description) func->description= BLI_strdup(func->description);
+	if (func->identifier) func->identifier = BLI_strdup(func->identifier);
+	if (func->description) func->description = BLI_strdup(func->description);
 
 	func->flag |= FUNC_FREE_POINTERS;
 }
 
 void RNA_def_func_free_pointers(FunctionRNA *func)
 {
-	if(func->flag & FUNC_FREE_POINTERS) {
-		if(func->identifier) MEM_freeN((void*)func->identifier);
-		if(func->description) MEM_freeN((void*)func->description);
+	if (func->flag & FUNC_FREE_POINTERS) {
+		if (func->identifier) MEM_freeN((void*)func->identifier);
+		if (func->description) MEM_freeN((void*)func->description);
 	}
 }
 
 void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA *prop)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	EnumPropertyItem *earray;
 	float *farray;
 	int *iarray;
 	int a;
 
-	/* annoying since we just added this to a hash, could make this add the correct key to the hash in the first place */
-	if(prop->identifier) {
-		if(cont->prophash) {
+	/* annoying since we just added this to a hash, could make this add the correct key to the hash
+	 * in the first place */
+	if (prop->identifier) {
+		if (cont->prophash) {
 			BLI_ghash_remove(cont->prophash, (void*)prop->identifier, NULL, NULL);
-			prop->identifier= BLI_strdup(prop->identifier);
+			prop->identifier = BLI_strdup(prop->identifier);
 			BLI_ghash_insert(cont->prophash, (void*)prop->identifier, prop);
 		}
 		else {
-			prop->identifier= BLI_strdup(prop->identifier);
+			prop->identifier = BLI_strdup(prop->identifier);
 		}
 	}
 
-	if(prop->name) prop->name= BLI_strdup(prop->name);
-	if(prop->description) prop->description= BLI_strdup(prop->description);
+	if (prop->name) prop->name = BLI_strdup(prop->name);
+	if (prop->description) prop->description = BLI_strdup(prop->description);
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_BOOLEAN: {
-			BoolPropertyRNA *bprop= (BoolPropertyRNA*)prop;
+			BoolPropertyRNA *bprop = (BoolPropertyRNA*)prop;
 
-			if(bprop->defaultarray) {
-				iarray= MEM_callocN(sizeof(int)*prop->totarraylength, "RNA_def_property_store");
+			if (bprop->defaultarray) {
+				iarray = MEM_callocN(sizeof(int)*prop->totarraylength, "RNA_def_property_store");
 				memcpy(iarray, bprop->defaultarray, sizeof(int)*prop->totarraylength);
-				bprop->defaultarray= iarray;
+				bprop->defaultarray = iarray;
 			}
 			break;
 		}
 		case PROP_INT: {
-			IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
+			IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
 
-			if(iprop->defaultarray) {
-				iarray= MEM_callocN(sizeof(int)*prop->totarraylength, "RNA_def_property_store");
+			if (iprop->defaultarray) {
+				iarray = MEM_callocN(sizeof(int)*prop->totarraylength, "RNA_def_property_store");
 				memcpy(iarray, iprop->defaultarray, sizeof(int)*prop->totarraylength);
-				iprop->defaultarray= iarray;
+				iprop->defaultarray = iarray;
 			}
 			break;
 		}
 		case PROP_ENUM: {
-			EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
+			EnumPropertyRNA *eprop = (EnumPropertyRNA*)prop;
 
-			if(eprop->item) {
-				earray= MEM_callocN(sizeof(EnumPropertyItem)*(eprop->totitem+1), "RNA_def_property_store"),
+			if (eprop->item) {
+				earray = MEM_callocN(sizeof(EnumPropertyItem)*(eprop->totitem+1), "RNA_def_property_store"),
 				memcpy(earray, eprop->item, sizeof(EnumPropertyItem)*(eprop->totitem+1));
-				eprop->item= earray;
-
-				for(a=0; a<eprop->totitem; a++) {
-					if(eprop->item[a].identifier) eprop->item[a].identifier= BLI_strdup(eprop->item[a].identifier);
-					if(eprop->item[a].name) eprop->item[a].name= BLI_strdup(eprop->item[a].name);
-					if(eprop->item[a].description) eprop->item[a].description= BLI_strdup(eprop->item[a].description);
+				eprop->item = earray;
+
+				for (a = 0; a<eprop->totitem; a++) {
+					if (eprop->item[a].identifier)
+						eprop->item[a].identifier = BLI_strdup(eprop->item[a].identifier);
+					if (eprop->item[a].name)
+						eprop->item[a].name = BLI_strdup(eprop->item[a].name);
+					if (eprop->item[a].description)
+						eprop->item[a].description = BLI_strdup(eprop->item[a].description);
 				}
 			}
 			break;
 		}
 		case PROP_FLOAT: {
-			FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
+			FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
 
-			if(fprop->defaultarray) {
-				farray= MEM_callocN(sizeof(float)*prop->totarraylength, "RNA_def_property_store");
+			if (fprop->defaultarray) {
+				farray = MEM_callocN(sizeof(float)*prop->totarraylength, "RNA_def_property_store");
 				memcpy(farray, fprop->defaultarray, sizeof(float)*prop->totarraylength);
-				fprop->defaultarray= farray;
+				fprop->defaultarray = farray;
 			}
 			break;
 		}
 		case PROP_STRING: {
-			StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
-			if(sprop->defaultvalue) sprop->defaultvalue= BLI_strdup(sprop->defaultvalue);
+			StringPropertyRNA *sprop = (StringPropertyRNA*)prop;
+			if (sprop->defaultvalue)
+				sprop->defaultvalue = BLI_strdup(sprop->defaultvalue);
 			break;
 		}
 		default:
@@ -2876,45 +2941,56 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA
 
 void RNA_def_property_free_pointers(PropertyRNA *prop)
 {
-	if(prop->flag & PROP_FREE_POINTERS) {
+	if (prop->flag & PROP_FREE_POINTERS) {
 		int a;
 
-		if(prop->identifier) MEM_freeN((void*)prop->identifier);
-		if(prop->name) MEM_freeN((void*)prop->name);
-		if(prop->description) MEM_freeN((void*)prop->description);
-		if(prop->py_data) MEM_freeN(prop->py_data);
+		if (prop->identifier)
+			MEM_freeN((void*)prop->identifier);
+		if (prop->name)
+			MEM_freeN((void*)prop->name);
+		if (prop->description)
+			MEM_freeN((void*)prop->description);
+		if (prop->py_data)
+			MEM_freeN(prop->py_data);
 
-		switch(prop->type) {
+		switch (prop->type) {
 			case PROP_BOOLEAN: {
-				BoolPropertyRNA *bprop= (BoolPropertyRNA*)prop;
-				if(bprop->defaultarray) MEM_freeN((void*)bprop->defaultarray);
+				BoolPropertyRNA *bprop = (BoolPropertyRNA*)prop;
+				if (bprop->defaultarray)
+					MEM_freeN((void*)bprop->defaultarray);
 				break;
 			}
 			case PROP_INT: {
-				IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
-				if(iprop->defaultarray) MEM_freeN((void*)iprop->defaultarray);
+				IntPropertyRNA *iprop = (IntPropertyRNA*)prop;
+				if (iprop->defaultarray)
+					MEM_freeN((void*)iprop->defaultarray);
 				break;
 			}
 			case PROP_FLOAT: {
-				FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
-				if(fprop->defaultarray) MEM_freeN((void*)fprop->defaultarray);
+				FloatPropertyRNA *fprop = (FloatPropertyRNA*)prop;
+				if (fprop->defaultarray)
+					MEM_freeN((void*)fprop->defaultarray);
 				break;
 			}
 			case PROP_ENUM: {
-				EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
-
-				for(a=0; a<eprop->totitem; a++) {
-					if(eprop->item[a].identifier) MEM_freeN((void*)eprop->item[a].identifier);
-					if(eprop->item[a].name) MEM_freeN((void*)eprop->item[a].name);
-					if(eprop->item[a].description) MEM_freeN((void*)eprop->item[a].description);
+				EnumPropertyRNA *eprop = (EnumPropertyRNA*)prop;
+
+				for (a = 0; a<eprop->totitem; a++) {
+					if (eprop->item[a].identifier)
+						MEM_freeN((void*)eprop->item[a].identifier);
+					if (eprop->item[a].name)
+						MEM_freeN((void*)eprop->item[a].name);
+					if (eprop->item[a].description)
+						MEM_freeN((void*)eprop->item[a].description);
 				}
 
-				if(eprop->item) MEM_freeN((void*)eprop->item);
+				if (eprop->item) MEM_freeN((void*)eprop->item);
 				break;
 			}
 			case PROP_STRING: {
-				StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
-				if(sprop->defaultvalue) MEM_freeN((void*)sprop->defaultvalue);
+				StringPropertyRNA *sprop = (StringPropertyRNA*)prop;
+				if (sprop->defaultvalue)
+					MEM_freeN((void*)sprop->defaultvalue);
 				break;
 			}
 			default:
@@ -2925,10 +3001,10 @@ void RNA_def_property_free_pointers(PropertyRNA *prop)
 
 static void rna_def_property_free(StructOrFunctionRNA *cont_, PropertyRNA *prop)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	
-	if(prop->flag & PROP_RUNTIME) {
-		if(cont->prophash)
+	if (prop->flag & PROP_RUNTIME) {
+		if (cont->prophash)
 			BLI_ghash_remove(cont->prophash, (void*)prop->identifier, NULL, NULL);
 
 		RNA_def_property_free_pointers(prop);
@@ -2942,12 +3018,12 @@ static void rna_def_property_free(StructOrFunctionRNA *cont_, PropertyRNA *prop)
 /* note: only intended for removing dynamic props */
 int RNA_def_property_free_identifier(StructOrFunctionRNA *cont_, const char *identifier)
 {
-	ContainerRNA *cont= cont_;
+	ContainerRNA *cont = cont_;
 	PropertyRNA *prop;
 	
-	for(prop= cont->properties.first; prop; prop= prop->next) {
-		if(strcmp(prop->identifier, identifier)==0) {
-			if(prop->flag & PROP_RUNTIME) {
+	for (prop = cont->properties.first; prop; prop = prop->next) {
+		if (strcmp(prop->identifier, identifier) == 0) {
+			if (prop->flag & PROP_RUNTIME) {
 				rna_def_property_free(cont_, prop);
 				return 1;
 			}
@@ -2962,7 +3038,7 @@ int RNA_def_property_free_identifier(StructOrFunctionRNA *cont_, const char *ide
 
 const char *RNA_property_typename(PropertyType type)
 {
-	switch(type) {
+	switch (type) {
 		case PROP_BOOLEAN: return "PROP_BOOLEAN";
 		case PROP_INT: return "PROP_INT";
 		case PROP_FLOAT: return "PROP_FLOAT";
diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c
index 9577068..b3e89a4 100644
--- a/source/blender/makesrna/intern/rna_dynamicpaint.c
+++ b/source/blender/makesrna/intern/rna_dynamicpaint.c
@@ -1,4 +1,4 @@
-/**
+/*
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -6,11 +6,25 @@
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
  *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public 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): Miika Hämäläinen
  *
  * ***** END GPL LICENSE BLOCK *****
  */
 
+/** \file blender/makesrna/intern/rna_dynamicpaint.c
+ *  \ingroup RNA
+ */
+
+
 #include <stdlib.h>
 #include <limits.h>
 
@@ -45,7 +59,7 @@ EnumPropertyItem prop_dynamicpaint_type_items[] = {
 static char *rna_DynamicPaintCanvasSettings_path(PointerRNA *ptr)
 {
 	DynamicPaintCanvasSettings *settings = (DynamicPaintCanvasSettings*)ptr->data;
-	ModifierData *md= (ModifierData *)settings->pmd;
+	ModifierData *md = (ModifierData *)settings->pmd;
 
 	return BLI_sprintfN("modifiers[\"%s\"].canvas_settings", md->name);
 }
@@ -53,7 +67,7 @@ static char *rna_DynamicPaintCanvasSettings_path(PointerRNA *ptr)
 static char *rna_DynamicPaintBrushSettings_path(PointerRNA *ptr)
 {
 	DynamicPaintBrushSettings *settings = (DynamicPaintBrushSettings*)ptr->data;
-	ModifierData *md= (ModifierData *)settings->pmd;
+	ModifierData *md = (ModifierData *)settings->pmd;
 
 	return BLI_sprintfN("modifiers[\"%s\"].brush_settings", md->name);
 }
@@ -61,15 +75,15 @@ static char *rna_DynamicPaintBrushSettings_path(PointerRNA *ptr)
 static char *rna_DynamicPaintSurface_path(PointerRNA *ptr)
 {
 	DynamicPaintSurface *surface = (DynamicPaintSurface*)ptr->data;
-	ModifierData *md= (ModifierData *)surface->canvas->pmd;
+	ModifierData *md = (ModifierData *)surface->canvas->pmd;
 
 	return BLI_sprintfN("modifiers[\"%s\"].canvas_settings.canvas_surfaces[\"%s\"]", md->name, surface->name);
 }
 
 
 /*
-*	Surfaces
-*/
+ *	Surfaces
+ */
 
 static void rna_DynamicPaint_redoModifier(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
@@ -102,9 +116,9 @@ static void rna_DynamicPaintSurface_changePreview(Main *bmain, Scene *scene, Poi
 	DynamicPaintSurface *surface = act_surface->canvas->surfaces.first;
 
 	/* since only one color surface can show preview at time
-	*  disable preview on other surfaces*/
-	for(; surface; surface=surface->next) {
-		if(surface != act_surface)
+	 *  disable preview on other surfaces*/
+	for (; surface; surface = surface->next) {
+		if (surface != act_surface)
 			surface->flags &= ~MOD_DPAINT_PREVIEW;
 	}
 	rna_DynamicPaint_redoModifier(bmain, scene, ptr);
@@ -140,12 +154,12 @@ static void rna_DynamicPaint_resetDependancy(Main *bmain, Scene *scene, PointerR
 
 static PointerRNA rna_PaintSurface_active_get(PointerRNA *ptr)
 {
-	DynamicPaintCanvasSettings *canvas= (DynamicPaintCanvasSettings*)ptr->data;
+	DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings*)ptr->data;
 	DynamicPaintSurface *surface = canvas->surfaces.first;
-	int id=0;
+	int id = 0;
 
-	for(; surface; surface=surface->next) {
-		if(id == canvas->active_sur)
+	for (; surface; surface = surface->next) {
+		if (id == canvas->active_sur)
 			return rna_pointer_inherit_refine(ptr, &RNA_DynamicPaintSurface, surface);
 		id++;
 	}
@@ -154,41 +168,41 @@ static PointerRNA rna_PaintSurface_active_get(PointerRNA *ptr)
 
 static void rna_DynamicPaint_surfaces_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	DynamicPaintCanvasSettings *canvas= (DynamicPaintCanvasSettings*)ptr->data;
-	//rna_iterator_array_begin(iter, (void*)canvas->surfaces, sizeof(PaintSurface), canvas->totsur, 0, 0);
+	DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings*)ptr->data;
+	/*rna_iterator_array_begin(iter, (void*)canvas->surfaces, sizeof(PaintSurface), canvas->totsur, 0, 0); */
 	rna_iterator_listbase_begin(iter, &canvas->surfaces, NULL);
 }
 
 static int rna_Surface_active_point_index_get(PointerRNA *ptr)
 {
-	DynamicPaintCanvasSettings *canvas= (DynamicPaintCanvasSettings*)ptr->data;
+	DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings*)ptr->data;
 	return canvas->active_sur;
 }
 
 static void rna_Surface_active_point_index_set(struct PointerRNA *ptr, int value)
 {
-	DynamicPaintCanvasSettings *canvas= (DynamicPaintCanvasSettings*)ptr->data;
+	DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings*)ptr->data;
 	canvas->active_sur = value;
 	return;
 }
 
-static void rna_Surface_active_point_range(PointerRNA *ptr, int *min, int *max)
+static void rna_Surface_active_point_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
 {
-	DynamicPaintCanvasSettings *canvas= (DynamicPaintCanvasSettings*)ptr->data;
+	DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings*)ptr->data;
 
-	*min= 0;
-	*max= BLI_countlist(&canvas->surfaces)-1;
+	*min = 0;
+	*max = BLI_countlist(&canvas->surfaces)-1;
 }
 
 /* uvlayer */
 static void rna_DynamicPaint_uvlayer_set(PointerRNA *ptr, const char *value)
 {
-	DynamicPaintCanvasSettings *canvas= ((DynamicPaintSurface*)ptr->data)->canvas;
+	DynamicPaintCanvasSettings *canvas = ((DynamicPaintSurface*)ptr->data)->canvas;
 	DynamicPaintSurface *surface = canvas->surfaces.first;
-	int id=0;
+	int id = 0;
 
-	for(; surface; surface=surface->next) {
-		if(id == canvas->active_sur) {
+	for (; surface; surface = surface->next) {
+		if (id == canvas->active_sur) {
 			rna_object_uvlayer_name_set(ptr, value, surface->uvlayer_name, sizeof(surface->uvlayer_name));
 			return;
 		}
@@ -199,7 +213,7 @@ static void rna_DynamicPaint_uvlayer_set(PointerRNA *ptr, const char *value)
 /* is point cache used */
 static int rna_DynamicPaint_is_cache_user_get(PointerRNA *ptr)
 {
-	DynamicPaintSurface *surface= (DynamicPaintSurface*)ptr->data;
+	DynamicPaintSurface *surface = (DynamicPaintSurface*)ptr->data;
 
 	return (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ) ?  1 : 0;
 }
@@ -211,13 +225,14 @@ static int rna_DynamicPaint_is_output_exists(DynamicPaintSurface *surface, Objec
 }
 
 
-static EnumPropertyItem *rna_DynamicPaint_surface_type_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
+static EnumPropertyItem *rna_DynamicPaint_surface_type_itemf(bContext *C, PointerRNA *ptr,
+                                                             PropertyRNA *UNUSED(prop), int *free)
 {
-	DynamicPaintSurface *surface= (DynamicPaintSurface*)ptr->data;
+	DynamicPaintSurface *surface = (DynamicPaintSurface*)ptr->data;
 
-	EnumPropertyItem *item= NULL;
-	EnumPropertyItem tmp= {0, "", 0, "", ""};
-	int totitem= 0;
+	EnumPropertyItem *item = NULL;
+	EnumPropertyItem tmp = {0, "", 0, "", ""};
+	int totitem = 0;
 
 	/* Paint type - available for all formats */
 	tmp.value = MOD_DPAINT_SURFACE_T_PAINT;
@@ -265,16 +280,17 @@ static void rna_def_canvas_surfaces(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "DynamicPaintSurfaces");
-	srna= RNA_def_struct(brna, "DynamicPaintSurfaces", NULL);
+	srna = RNA_def_struct(brna, "DynamicPaintSurfaces", NULL);
 	RNA_def_struct_sdna(srna, "DynamicPaintCanvasSettings");
 	RNA_def_struct_ui_text(srna, "Canvas Surfaces", "Collection of Dynamic Paint Canvas surfaces");
 
-	prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-	RNA_def_property_int_funcs(prop, "rna_Surface_active_point_index_get", "rna_Surface_active_point_index_set", "rna_Surface_active_point_range");
+	RNA_def_property_int_funcs(prop, "rna_Surface_active_point_index_get", "rna_Surface_active_point_index_set",
+	                           "rna_Surface_active_point_range");
 	RNA_def_property_ui_text(prop, "Active Point Cache Index", "");
 
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "DynamicPaintSurface");
 	RNA_def_property_pointer_funcs(prop, "rna_PaintSurface_active_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Active Surface", "Active Dynamic Paint surface being displayed");
@@ -291,7 +307,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
 
 	/*  Surface format */
 	static EnumPropertyItem prop_dynamicpaint_surface_format[] = {
-			//{MOD_DPAINT_SURFACE_F_PTEX, "PTEX", ICON_TEXTURE_SHADED, "Ptex", ""},
+			/*{MOD_DPAINT_SURFACE_F_PTEX, "PTEX", ICON_TEXTURE_SHADED, "Ptex", ""}, */
 			{MOD_DPAINT_SURFACE_F_VERTEX, "VERTEX", ICON_OUTLINER_DATA_MESH, "Vertex", ""},
 			{MOD_DPAINT_SURFACE_F_IMAGESEQ, "IMAGE", ICON_FILE_IMAGE, "Image Sequence", ""},
 			{0, NULL, 0, NULL, NULL}};
@@ -316,7 +332,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
 			{0, NULL, 0, NULL, NULL}};
 
 	/*  Effect type
-	*   Only used by ui to view per effect settings */
+	 *   Only used by ui to view per effect settings */
 	static EnumPropertyItem prop_dynamicpaint_effecttype[] = {
 			{1, "SPREAD", 0, "Spread", ""},
 			{2, "DRIP", 0, "Drip", ""},
@@ -340,19 +356,19 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
 
 
 	/* Surface */
-	srna= RNA_def_struct(brna, "DynamicPaintSurface", NULL);
+	srna = RNA_def_struct(brna, "DynamicPaintSurface", NULL);
 	RNA_def_struct_sdna(srna, "DynamicPaintSurface");
 	RNA_def_struct_ui_text(srna, "Paint Surface", "A canvas surface layer");
 	RNA_def_struct_path_func(srna, "rna_DynamicPaintSurface_path");
 
-	prop= RNA_def_property(srna, "surface_format", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "surface_format", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_sdna(prop, NULL, "format");
 	RNA_def_property_enum_items(prop, prop_dynamicpaint_surface_format);
 	RNA_def_property_ui_text(prop, "Format", "Surface Format");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurfaces_changeFormat");
 
-	prop= RNA_def_property(srna, "surface_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "surface_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, prop_dynamicpaint_surface_type);
@@ -360,22 +376,22 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Surface Type", "Surface Type");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_changeType");
 
-	prop= RNA_def_property(srna, "is_active", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_active", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ACTIVE);
 	RNA_def_property_ui_text(prop, "Is Active", "Toggle whether surface is processed or ignored");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
 
-	prop= RNA_def_property(srna, "show_preview", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_preview", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_PREVIEW);
 	RNA_def_property_ui_text(prop, "Show Preview", "Display surface preview in 3D-views");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_changePreview");
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Name", "Surface name");
 	RNA_def_property_update(prop, NC_OBJECT, "rna_DynamicPaintSurface_uniqueName");
 	RNA_def_struct_name_property(srna, prop);
 
-	prop= RNA_def_property(srna, "brush_group", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "brush_group", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Group");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Brush Group", "Only use brush objects from this group");
@@ -383,43 +399,43 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
 
 
 	/*
-	*   Paint, wet and displace
-	*/
+	 *   Paint, wet and displace
+	 */
 
-	prop= RNA_def_property(srna, "use_dissolve", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_dissolve", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DISSOLVE);
 	RNA_def_property_ui_text(prop, "Dissolve", "Enable to make surface changes disappear over time");
 	
-	prop= RNA_def_property(srna, "dissolve_speed", PROP_INT, PROP_NONE);
+	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, 5, 0);
 	RNA_def_property_ui_text(prop, "Dissolve Speed", "Approximately in how many frames should dissolve happen");
 
-	prop= RNA_def_property(srna, "use_drying", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_drying", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_USE_DRYING);
 	RNA_def_property_ui_text(prop, "Dry", "Enable to make surface wetness dry over time");
 	
-	prop= RNA_def_property(srna, "dry_speed", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "dry_speed", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, 1.0, 10000.0);
 	RNA_def_property_ui_range(prop, 1.0, 10000.0, 5, 0);
 	RNA_def_property_ui_text(prop, "Dry Speed", "Approximately in how many frames should drying happen");
 	
 	/*
-	*   Simulation settings
-	*/
-	prop= RNA_def_property(srna, "image_resolution", PROP_INT, PROP_NONE);
+	 *   Simulation settings
+	 */
+	prop = RNA_def_property(srna, "image_resolution", PROP_INT, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 16.0, 4096.0);
 	RNA_def_property_ui_range(prop, 16.0, 4096.0, 1, 0);
 	RNA_def_property_ui_text(prop, "Resolution", "Output image resolution");
 	
-	prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
+	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_DynamicPaint_uvlayer_set");
 	
-	prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "start_frame");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 1.0, 9999.0);
@@ -427,7 +443,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Start Frame", "Simulation start frame");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurfaces_updateFrames");
 	
-	prop= RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "end_frame");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 1.0, 9999.0);
@@ -435,26 +451,26 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "End Frame", "Simulation end frame");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurfaces_updateFrames");
 	
-	prop= RNA_def_property(srna, "frame_substeps", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_substeps", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "substeps");
 	RNA_def_property_range(prop, 0.0, 20.0);
 	RNA_def_property_ui_range(prop, 0.0, 10, 1, 0);
 	RNA_def_property_ui_text(prop, "Sub-Steps", "Do extra frames between scene frames to ensure smooth motion");
 	
-	prop= RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ANTIALIAS);
 	RNA_def_property_ui_text(prop, "Anti-aliasing", "Use 5x multisampling to smoothen paint edges");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
 
-	prop= RNA_def_property(srna, "brush_influence_scale", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "brush_influence_scale", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "influence_scale");
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Influence Scale", "Adjust influence brush objects have on this surface");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
 
-	prop= RNA_def_property(srna, "brush_radius_scale", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "brush_radius_scale", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "radius_scale");
 	RNA_def_property_range(prop, 0.0, 10.0);
 	RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
@@ -462,136 +478,137 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
 
 	/*
-	*	Initial Color
-	*/
+	 *	Initial Color
+	 */
 
-	prop= RNA_def_property(srna, "init_color_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "init_color_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_items(prop, prop_dynamicpaint_init_color_type);
 	RNA_def_property_ui_text(prop, "Initial Color", "");
 	RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW|ND_MODIFIER, "rna_DynamicPaintSurface_initialcolortype");
 
-	prop= RNA_def_property(srna, "init_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "init_color", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "Color", "Initial color of the surface");
 	RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
 
-	prop= RNA_def_property(srna, "init_texture", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "init_texture", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Texture", "");
 	RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
 
-	prop= RNA_def_property(srna, "init_layername", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "init_layername", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Data Layer", "");
 	RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING_DRAW|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
 
 	/*
-	*   Effect Settings
-	*/
-	prop= RNA_def_property(srna, "effect_ui", PROP_ENUM, PROP_NONE);
+	 *   Effect Settings
+	 */
+	prop = RNA_def_property(srna, "effect_ui", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_items(prop, prop_dynamicpaint_effecttype);
 	RNA_def_property_ui_text(prop, "Effect Type", "");
 	
-	prop= RNA_def_property(srna, "use_dry_log", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_dry_log", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DRY_LOG);
 	RNA_def_property_ui_text(prop, "Slow", "Use logarithmic drying (makes high values to dry faster than low values)");
 
-	prop= RNA_def_property(srna, "use_dissolve_log", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_dissolve_log", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DISSOLVE_LOG);
-	RNA_def_property_ui_text(prop, "Slow", "Use logarithmic dissolve (makes high values to fade faster than low values)");
+	RNA_def_property_ui_text(prop, "Slow",
+	                         "Use logarithmic dissolve (makes high values to fade faster than low values)");
 	
-	prop= RNA_def_property(srna, "use_spread", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_spread", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_boolean_sdna(prop, NULL, "effect", MOD_DPAINT_EFFECT_DO_SPREAD);
 	RNA_def_property_ui_text(prop, "Use Spread", "Process spread effect (spread wet paint around surface)");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
 	
-	prop= RNA_def_property(srna, "spread_speed", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "spread_speed", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "spread_speed");
 	RNA_def_property_range(prop, 0.001, 10.0);
 	RNA_def_property_ui_range(prop, 0.01, 5.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Spread Speed", "How fast spread effect moves on the canvas surface");
 
-	prop= RNA_def_property(srna, "color_dry_threshold", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "color_dry_threshold", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "color_dry_threshold");
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Color Dry", "The wetness level when colors start to shift to the background");
 
-	prop= RNA_def_property(srna, "color_spread_speed", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "color_spread_speed", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "color_spread_speed");
 	RNA_def_property_range(prop, 0.0, 2.0);
 	RNA_def_property_ui_range(prop, 0.0, 2.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Color Spread", "How fast colors get mixed within wet paint");
 	
-	prop= RNA_def_property(srna, "use_drip", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_drip", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_boolean_sdna(prop, NULL, "effect", MOD_DPAINT_EFFECT_DO_DRIP);
 	RNA_def_property_ui_text(prop, "Use Drip", "Process drip effect (drip wet paint to gravity direction)");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
 	
-	prop= RNA_def_property(srna, "use_shrink", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_shrink", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_boolean_sdna(prop, NULL, "effect", MOD_DPAINT_EFFECT_DO_SHRINK);
 	RNA_def_property_ui_text(prop, "Use Shrink", "Process shrink effect (shrink paint areas)");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
 	
-	prop= RNA_def_property(srna, "shrink_speed", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "shrink_speed", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "shrink_speed");
 	RNA_def_property_range(prop, 0.001, 10.0);
 	RNA_def_property_ui_range(prop, 0.01, 5.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Shrink Speed", "How fast shrink effect moves on the canvas surface");
 
-	prop= RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "EffectorWeights");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Effector Weights", "");
 
-	prop= RNA_def_property(srna, "drip_velocity", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "drip_velocity", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "drip_vel");
 	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, "Velocity", "How much surface velocity affects dripping");
 
-	prop= RNA_def_property(srna, "drip_acceleration", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "drip_acceleration", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "drip_acc");
 	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, "Acceleration", "How much surface acceleration affects dripping");
 
 	/*
-	*   Output settings
-	*/
-	prop= RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
+	 *   Output settings
+	 */
+	prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_MULALPHA);
 	RNA_def_property_ui_text(prop, "Premultiply alpha", "Multiply color by alpha (recommended for Blender input)");
 	
-	prop= RNA_def_property(srna, "image_output_path", PROP_STRING, PROP_DIRPATH);
+	prop = RNA_def_property(srna, "image_output_path", PROP_STRING, PROP_DIRPATH);
 	RNA_def_property_string_sdna(prop, NULL, "image_output_path");
 	RNA_def_property_ui_text(prop, "Output Path", "Directory to save the textures");
 
 	/* output for primary surface data */
-	prop= RNA_def_property(srna, "output_name_a", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "output_name_a", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "output_name");
 	RNA_def_property_ui_text(prop, "Output Name", "Name used to save output from this surface");
 
-	prop= RNA_def_property(srna, "use_output_a", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_output_a", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_OUT1);
 	RNA_def_property_ui_text(prop, "Use Output", "Save this output layer");
 
 	/* output for secondary sufrace data */
-	prop= RNA_def_property(srna, "output_name_b", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "output_name_b", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "output_name2");
 	RNA_def_property_ui_text(prop, "Output Name", "Name used to save output from this surface");
 
-	prop= RNA_def_property(srna, "use_output_b", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_output_b", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_OUT2);
 	RNA_def_property_ui_text(prop, "Use Output", "Save this output layer");
 
-	prop= RNA_def_property(srna, "preview_id", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "preview_id", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_sdna(prop, NULL, "preview_id");
 	RNA_def_property_enum_items(prop, prop_dynamicpaint_surface_preview);
@@ -601,22 +618,23 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
 	/* to check if output name exists */
 	func = RNA_def_function(srna, "output_exists", "rna_DynamicPaint_is_output_exists");
 	RNA_def_function_ui_description(func, "Checks if surface output layer of given name exists");
-	parm= RNA_def_pointer(func, "object", "Object", "", "");
+	parm = RNA_def_pointer(func, "object", "Object", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
-	parm= RNA_def_int(func, "index", 0, 0, 1, "Index", "", 0, 1);
+	parm = RNA_def_int(func, "index", 0, 0, 1, "Index", "", 0, 1);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_boolean(func, "exists", 0, "", "");
+	parm = RNA_def_boolean(func, "exists", 0, "", "");
 	RNA_def_function_return(func, parm);
 	
-	prop= RNA_def_property(srna, "depth_clamp", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "depth_clamp", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0.00, 50.0);
 	RNA_def_property_ui_range(prop, 0.00, 5.0, 1, 2);
-	RNA_def_property_ui_text(prop, "Max Displace", "Maximum level of depth intersection in object space (use 0.0 to disable)");
+	RNA_def_property_ui_text(prop, "Max Displace",
+	                         "Maximum level of depth intersection in object space (use 0.0 to disable)");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
 
-	prop= RNA_def_property(srna, "displace_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "displace_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "disp_factor");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, -50.0, 50.0);
@@ -624,57 +642,57 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Displace Factor", "Strength of displace when applied to the mesh");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
 	
-	prop= RNA_def_property(srna, "image_fileformat", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "image_fileformat", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_items(prop, prop_dynamicpaint_image_fileformat);
 	RNA_def_property_ui_text(prop, "File Format", "");
 	
-	prop= RNA_def_property(srna, "displace_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "displace_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "disp_type");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_items(prop, prop_dynamicpaint_displace_type);
 	RNA_def_property_ui_text(prop, "Data Type", "");
 
-	prop= RNA_def_property(srna, "use_incremental_displace", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_incremental_displace", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DISP_INCREMENTAL);
 	RNA_def_property_ui_text(prop, "Incremental", "New displace is added cumulatively on top of existing");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaintSurface_reset");
 
 	/* wave simulator settings */
-	prop= RNA_def_property(srna, "wave_damping", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "wave_damping", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_range(prop, 0.01, 1.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Damping", "Wave damping factor");
 
-	prop= RNA_def_property(srna, "wave_speed", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "wave_speed", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.01, 5.0);
 	RNA_def_property_ui_range(prop, 0.20, 4.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Speed", "Wave propogation speed");
 
-	prop= RNA_def_property(srna, "wave_timescale", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "wave_timescale", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.01, 3.0);
 	RNA_def_property_ui_range(prop, 0.01, 1.5, 1, 2);
 	RNA_def_property_ui_text(prop, "Timescale", "Wave time scaling factor");
 
-	prop= RNA_def_property(srna, "wave_spring", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "wave_spring", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_range(prop, 0.01, 1.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Spring", "Spring force that pulls water level back to zero");
 
-	prop= RNA_def_property(srna, "use_wave_open_border", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_wave_open_border", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_WAVE_OPEN_BORDERS);
 	RNA_def_property_ui_text(prop, "Open Borders", "Pass waves through mesh edges");
 
 	
 	/* cache */
-	prop= RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "pointcache");
 	RNA_def_property_ui_text(prop, "Point Cache", "");
 
 	/* is cache used */
-	prop= RNA_def_property(srna, "is_cache_user", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_cache_user", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_DynamicPaint_is_cache_user_get", NULL);
 	RNA_def_property_ui_text(prop, "Use Cache", "");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE|PROP_EDITABLE);
@@ -691,10 +709,12 @@ static void rna_def_dynamic_paint_canvas_settings(BlenderRNA *brna)
 	RNA_def_struct_path_func(srna, "rna_DynamicPaintCanvasSettings_path");
 
 	/*
-	*	Surface Slots
-	*/
-	prop= RNA_def_property(srna, "canvas_surfaces", PROP_COLLECTION, PROP_NONE);
-	RNA_def_property_collection_funcs(prop, "rna_DynamicPaint_surfaces_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL);
+	 *	Surface Slots
+	 */
+	prop = RNA_def_property(srna, "canvas_surfaces", PROP_COLLECTION, PROP_NONE);
+	RNA_def_property_collection_funcs(prop, "rna_DynamicPaint_surfaces_begin", "rna_iterator_listbase_next",
+	                                  "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+	                                  NULL, NULL, NULL, NULL);
 	RNA_def_property_struct_type(prop, "DynamicPaintSurface");
 	RNA_def_property_ui_text(prop, "Paint Surface List", "Paint surface list");
 	rna_def_canvas_surfaces(brna, prop);
@@ -739,89 +759,95 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
 	RNA_def_struct_path_func(srna, "rna_DynamicPaintBrushSettings_path");
 
 	/*
-	*   Paint
-	*/
-	prop= RNA_def_property(srna, "paint_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+	 *   Paint
+	 */
+	prop = RNA_def_property(srna, "paint_color", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "r");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Paint Color", "Color of the paint");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
 
-	prop= RNA_def_property(srna, "paint_alpha", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "paint_alpha", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "alpha");
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 2);
 	RNA_def_property_ui_text(prop, "Paint Alpha", "Paint alpha");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
 	
-	prop= RNA_def_property(srna, "use_material", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_material", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_USE_MATERIAL);
 	RNA_def_property_ui_text(prop, "Use object material", "Use object material to define color and influence");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
 
-	prop= RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "mat");
-	RNA_def_property_ui_text(prop, "Material", "Material to use (if not defined, material linked to the mesh is used)");
+	RNA_def_property_ui_text(prop, "Material",
+	                         "Material to use (if not defined, material linked to the mesh is used)");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
 	
-	prop= RNA_def_property(srna, "use_absolute_alpha", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_absolute_alpha", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ABS_ALPHA);
-	RNA_def_property_ui_text(prop, "Absolute Alpha", "Only increase alpha value if paint alpha is higher than existing");
+	RNA_def_property_ui_text(prop, "Absolute Alpha",
+	                         "Only increase alpha value if paint alpha is higher than existing");
 	
-	prop= RNA_def_property(srna, "paint_wetness", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "paint_wetness", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "wetness");
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 2);
-	RNA_def_property_ui_text(prop, "Paint Wetness", "Paint wetness, visible in wetmap (some effects only affect wet paint)");
+	RNA_def_property_ui_text(prop, "Paint Wetness",
+	                         "Paint wetness, visible in wetmap (some effects only affect wet paint)");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
 	
-	prop= RNA_def_property(srna, "use_paint_erase", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_paint_erase", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ERASE);
 	RNA_def_property_ui_text(prop, "Erase Paint", "Erase / remove paint instead of adding it");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
 
-	prop= RNA_def_property(srna, "wave_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "wave_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_items(prop, prop_dynamicpaint_brush_wave_type);
 	RNA_def_property_ui_text(prop, "Wave Type", "");
 
-	prop= RNA_def_property(srna, "wave_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "wave_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, -2.0, 2.0);
 	RNA_def_property_ui_range(prop, -1.0, 1.0, 5, 2);
 	RNA_def_property_ui_text(prop, "Factor", "Multiplier for wave influence of this brush");
 
-	prop= RNA_def_property(srna, "wave_clamp", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "wave_clamp", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.00, 50.0);
 	RNA_def_property_ui_range(prop, 0.00, 5.0, 1, 2);
-	RNA_def_property_ui_text(prop, "Clamp Waves", "Maximum level of surface intersection used to influence waves (use 0.0 to disable)");
+	RNA_def_property_ui_text(prop, "Clamp Waves",
+	                         "Maximum level of surface intersection used to influence waves (use 0.0 to disable)");
 
-	prop= RNA_def_property(srna, "use_smudge", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_smudge", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DO_SMUDGE);
 	RNA_def_property_ui_text(prop, "Do Smudge", "Make this brush to smudge existing paint as it moves");
 
-	prop= RNA_def_property(srna, "smudge_strength", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "smudge_strength", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 2);
 	RNA_def_property_ui_text(prop, "Smudge Strength", "Smudge effect strength");
 
-	prop= RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "max_velocity");
 	RNA_def_property_range(prop, 0.0001, 10.0);
 	RNA_def_property_ui_range(prop, 0.1, 2.0, 5, 2);
-	RNA_def_property_ui_text(prop, "Max Velocity", "Velocity considered as maximum influence (Blender units per frame)");
+	RNA_def_property_ui_text(prop, "Max Velocity",
+	                         "Velocity considered as maximum influence (Blender units per frame)");
 
-	prop= RNA_def_property(srna, "use_velocity_alpha", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_velocity_alpha", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_VELOCITY_ALPHA);
 	RNA_def_property_ui_text(prop, "Multiply Alpha", "Multiply brush influence by velocity color ramp alpha");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
 
-	prop= RNA_def_property(srna, "use_velocity_depth", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_velocity_depth", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_VELOCITY_DEPTH);
-	RNA_def_property_ui_text(prop, "Multiply Depth", "Multiply brush intersection depth (displace, waves) by velocity ramp alpha");
+	RNA_def_property_ui_text(prop, "Multiply Depth",
+	                         "Multiply brush intersection depth (displace, waves) by velocity ramp alpha");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
 
-	prop= RNA_def_property(srna, "use_velocity_color", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_velocity_color", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_VELOCITY_COLOR);
 	RNA_def_property_ui_text(prop, "Replace Color", "Replace brush color by velocity color ramp");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
@@ -829,58 +855,62 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
 	/*
 	*   Paint Area / Collision
 	*/
-	prop= RNA_def_property(srna, "paint_source", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "paint_source", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_sdna(prop, NULL, "collision");
 	RNA_def_property_enum_items(prop, prop_dynamicpaint_collisiontype);
 	RNA_def_property_ui_text(prop, "Paint Source", "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
 	
-	prop= RNA_def_property(srna, "paint_distance", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "paint_distance", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "paint_distance");
 	RNA_def_property_range(prop, 0.0, 500.0);
 	RNA_def_property_ui_range(prop, 0.0, 500.0, 10, 3);
-	RNA_def_property_ui_text(prop, "Proximity Distance", "Maximum distance from brush to mesh surface to affect paint");
+	RNA_def_property_ui_text(prop, "Proximity Distance",
+	                         "Maximum distance from brush to mesh surface to affect paint");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
 	
-	prop= RNA_def_property(srna, "use_proximity_ramp_alpha", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_proximity_ramp_alpha", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_RAMP_ALPHA);
 	RNA_def_property_ui_text(prop, "Only Use Alpha", "Only read color ramp alpha");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
 	
-	prop= RNA_def_property(srna, "proximity_falloff", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "proximity_falloff", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_sdna(prop, NULL, "proximity_falloff");
 	RNA_def_property_enum_items(prop, prop_dynamicpaint_prox_falloff);
 	RNA_def_property_ui_text(prop, "Falloff", "Proximity falloff type");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
 	
-	prop= RNA_def_property(srna, "use_proximity_project", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_proximity_project", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_PROX_PROJECT);
-	RNA_def_property_ui_text(prop, "Project", "Brush is projected to canvas from defined direction within brush proximity");
+	RNA_def_property_ui_text(prop, "Project",
+	                         "Brush is projected to canvas from defined direction within brush proximity");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
 
-	prop= RNA_def_property(srna, "ray_direction", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "ray_direction", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "ray_dir");
 	RNA_def_property_enum_items(prop, prop_dynamicpaint_brush_ray_dir);
-	RNA_def_property_ui_text(prop, "Ray Direction", "Ray direction to use for projection (if brush object is located in that direction it's painted)");
+	RNA_def_property_ui_text(prop, "Ray Direction",
+	                         "Ray direction to use for projection (if brush object is located in that direction "
+	                         "it's painted)");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
 
-	prop= RNA_def_property(srna, "invert_proximity", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_proximity", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_INVERSE_PROX);
 	RNA_def_property_ui_text(prop, "Inner Proximity", "Proximity falloff is applied inside the volume");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
 
-	prop= RNA_def_property(srna, "use_negative_volume", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_negative_volume", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_NEGATE_VOLUME);
 	RNA_def_property_ui_text(prop, "Negate Volume", "Negate influence inside the volume");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
 	
 
 	/*
-	*   Particle
-	*/
-	prop= RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
+	 *   Particle
+	 */
+	prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "psys");
 	RNA_def_property_struct_type(prop, "ParticleSystem");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
@@ -888,19 +918,19 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_resetDependancy");
 
 	
-	prop= RNA_def_property(srna, "use_particle_radius", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_particle_radius", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_PART_RAD);
 	RNA_def_property_ui_text(prop, "Use Particle Radius", "Use radius from particle settings");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
 	
-	prop= RNA_def_property(srna, "solid_radius", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "solid_radius", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "particle_radius");
 	RNA_def_property_range(prop, 0.01, 10.0);
 	RNA_def_property_ui_range(prop, 0.01, 2.0, 5, 3);
 	RNA_def_property_ui_text(prop, "Solid Radius", "Radius that will be painted solid");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
 
-	prop= RNA_def_property(srna, "smooth_radius", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "smooth_radius", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "particle_smooth");
 	RNA_def_property_range(prop, 0.0, 10.0);
 	RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 0);
@@ -909,15 +939,15 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
 	
 
 	/*
-	* Color ramps
-	*/
-	prop= RNA_def_property(srna, "paint_ramp", PROP_POINTER, PROP_NONE);
+	 * Color ramps
+	 */
+	prop = RNA_def_property(srna, "paint_ramp", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "paint_ramp");
 	RNA_def_property_struct_type(prop, "ColorRamp");
 	RNA_def_property_ui_text(prop, "Paint Color Ramp", "Color ramp used to define proximity falloff");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_DynamicPaint_redoModifier");
 
-	prop= RNA_def_property(srna, "velocity_ramp", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "velocity_ramp", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "vel_ramp");
 	RNA_def_property_struct_type(prop, "ColorRamp");
 	RNA_def_property_ui_text(prop, "Velocity Color Ramp", "Color ramp used to define brush velocity effect");
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 98c6b26..bf5f513 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -56,7 +56,7 @@ EnumPropertyItem fmodifier_type_items[] = {
 	{FMODIFIER_TYPE_CYCLES, "CYCLES", 0, "Cycles", ""},
 	{FMODIFIER_TYPE_NOISE, "NOISE", 0, "Noise", ""},
 	{FMODIFIER_TYPE_FILTER, "FILTER", 0, "Filter", ""},
-	//{FMODIFIER_TYPE_PYTHON, "PYTHON", 0, "Python", ""},	// FIXME: not implemented yet!
+	/*{FMODIFIER_TYPE_PYTHON, "PYTHON", 0, "Python", ""},	 *//* FIXME: not implemented yet! */
 	{FMODIFIER_TYPE_LIMITS, "LIMITS", 0, "Limits", ""},
 	{FMODIFIER_TYPE_STEPPED, "STEPPED", 0, "Stepped Interpolation", ""},
 	{0, NULL, 0, NULL, NULL}};
@@ -74,7 +74,7 @@ EnumPropertyItem beztriple_keyframe_type_items[] = {
 
 static StructRNA *rna_FModifierType_refine(struct PointerRNA *ptr)
 {
-	FModifier *fcm= (FModifier *)ptr->data;
+	FModifier *fcm = (FModifier *)ptr->data;
 
 	switch (fcm->type) {
 		case FMODIFIER_TYPE_GENERATOR:
@@ -87,8 +87,8 @@ static StructRNA *rna_FModifierType_refine(struct PointerRNA *ptr)
 			return &RNA_FModifierCycles;
 		case FMODIFIER_TYPE_NOISE:
 			return &RNA_FModifierNoise;
-		//case FMODIFIER_TYPE_FILTER:
-		//	return &RNA_FModifierFilter;
+		/*case FMODIFIER_TYPE_FILTER: */
+		/*	return &RNA_FModifierFilter; */
 		case FMODIFIER_TYPE_PYTHON:
 			return &RNA_FModifierPython;
 		case FMODIFIER_TYPE_LIMITS:
@@ -108,12 +108,12 @@ static StructRNA *rna_FModifierType_refine(struct PointerRNA *ptr)
 
 static void rna_ChannelDriver_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	ID *id= ptr->id.data;
-	ChannelDriver *driver= ptr->data;
+	ID *id = ptr->id.data;
+	ChannelDriver *driver = ptr->data;
 
 	driver->flag &= ~DRIVER_FLAG_INVALID;
 	
-	// TODO: this really needs an update guard...
+	/* TODO: this really needs an update guard... */
 	DAG_scene_sort(bmain, scene);
 	DAG_id_tag_update(id, OB_RECALC_OB|OB_RECALC_DATA);
 	
@@ -122,7 +122,7 @@ static void rna_ChannelDriver_update_data(Main *bmain, Scene *scene, PointerRNA
 
 static void rna_ChannelDriver_update_expr(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	ChannelDriver *driver= ptr->data;
+	ChannelDriver *driver = ptr->data;
 	driver->flag |= DRIVER_FLAG_RECOMPILE;
 	rna_ChannelDriver_update_data(bmain, scene, ptr);
 }
@@ -132,16 +132,16 @@ static void rna_DriverTarget_update_data(Main *bmain, Scene *scene, PointerRNA *
 	PointerRNA driverptr;
 	ChannelDriver *driver;
 	FCurve *fcu;
-	AnimData *adt= BKE_animdata_from_id(ptr->id.data);
+	AnimData *adt = BKE_animdata_from_id(ptr->id.data);
 
 	/* find the driver this belongs to and update it */
-	for (fcu=adt->drivers.first; fcu; fcu=fcu->next) {
-		driver= fcu->driver;
+	for (fcu = adt->drivers.first; fcu; fcu = fcu->next) {
+		driver = fcu->driver;
 		fcu->flag &= ~FCURVE_DISABLED;
 		
 		if (driver) {
-			// FIXME: need to be able to search targets for required one...
-			//BLI_findindex(&driver->targets, ptr->data) != -1) 
+			/* FIXME: need to be able to search targets for required one... */
+			/*BLI_findindex(&driver->targets, ptr->data) != -1)  */
 			RNA_pointer_create(ptr->id.data, &RNA_Driver, driver, &driverptr);
 			rna_ChannelDriver_update_data(bmain, scene, &driverptr);
 			return;
@@ -151,7 +151,7 @@ static void rna_DriverTarget_update_data(Main *bmain, Scene *scene, PointerRNA *
 
 static void rna_DriverTarget_update_name(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	ChannelDriver *driver= ptr->data;
+	ChannelDriver *driver = ptr->data;
 	rna_DriverTarget_update_data(bmain, scene, ptr);
 
 	driver->flag |= DRIVER_FLAG_RENAMEVAR;
@@ -163,25 +163,25 @@ static void rna_DriverTarget_update_name(Main *bmain, Scene *scene, PointerRNA *
 /* note: this function exists only to avoid id refcounting */
 static void rna_DriverTarget_id_set(PointerRNA *ptr, PointerRNA value)
 {
-	DriverTarget *dtar= (DriverTarget*)ptr->data;
-	dtar->id= value.data;
+	DriverTarget *dtar = (DriverTarget*)ptr->data;
+	dtar->id = value.data;
 }
 
 static StructRNA *rna_DriverTarget_id_typef(PointerRNA *ptr)
 {
-	DriverTarget *dtar= (DriverTarget*)ptr->data;
+	DriverTarget *dtar = (DriverTarget*)ptr->data;
 	return ID_code_to_RNA_type(dtar->idtype);
 }
 
 static int rna_DriverTarget_id_editable(PointerRNA *ptr)
 {
-	DriverTarget *dtar= (DriverTarget*)ptr->data;
+	DriverTarget *dtar = (DriverTarget*)ptr->data;
 	return (dtar->idtype)? PROP_EDITABLE : 0;
 }
 
 static int rna_DriverTarget_id_type_editable(PointerRNA *ptr)
 {
-	DriverTarget *dtar= (DriverTarget*)ptr->data;
+	DriverTarget *dtar = (DriverTarget*)ptr->data;
 	
 	/* when the id-type can only be object, don't allow editing
 	 * otherwise, there may be strange crashes
@@ -191,36 +191,36 @@ static int rna_DriverTarget_id_type_editable(PointerRNA *ptr)
 
 static void rna_DriverTarget_id_type_set(PointerRNA *ptr, int value)
 {
-	DriverTarget *data= (DriverTarget*)(ptr->data);
+	DriverTarget *data = (DriverTarget*)(ptr->data);
 	
 	/* check if ID-type is settable */
 	if ((data->flag & DTAR_FLAG_ID_OB_ONLY) == 0) {
 		/* change ID-type to the new type */
-		data->idtype= value;
+		data->idtype = value;
 	}
 	else {
 		/* make sure ID-type is Object */
-		data->idtype= ID_OB;
+		data->idtype = ID_OB;
 	}
 	
 	/* clear the id-block if the type is invalid */
 	if ((data->id) && (GS(data->id->name) != data->idtype))
-		data->id= NULL;
+		data->id = NULL;
 }
 
 static void rna_DriverTarget_RnaPath_get(PointerRNA *ptr, char *value)
 {
-	DriverTarget *dtar= (DriverTarget *)ptr->data;
+	DriverTarget *dtar = (DriverTarget *)ptr->data;
 
 	if (dtar->rna_path)
 		strcpy(value, dtar->rna_path);
 	else
-		value[0]= '\0';
+		value[0] = '\0';
 }
 
 static int rna_DriverTarget_RnaPath_length(PointerRNA *ptr)
 {
-	DriverTarget *dtar= (DriverTarget *)ptr->data;
+	DriverTarget *dtar = (DriverTarget *)ptr->data;
 	
 	if (dtar->rna_path)
 		return strlen(dtar->rna_path);
@@ -230,21 +230,21 @@ static int rna_DriverTarget_RnaPath_length(PointerRNA *ptr)
 
 static void rna_DriverTarget_RnaPath_set(PointerRNA *ptr, const char *value)
 {
-	DriverTarget *dtar= (DriverTarget *)ptr->data;
+	DriverTarget *dtar = (DriverTarget *)ptr->data;
 	
-	// XXX in this case we need to be very careful, as this will require some new dependencies to be added!
+	/* XXX in this case we need to be very careful, as this will require some new dependencies to be added! */
 	if (dtar->rna_path)
 		MEM_freeN(dtar->rna_path);
 	
 	if (value[0])
-		dtar->rna_path= BLI_strdup(value);
-	else 
-		dtar->rna_path= NULL;
+		dtar->rna_path = BLI_strdup(value);
+	else
+		dtar->rna_path = NULL;
 }
 
 static void rna_DriverVariable_type_set(PointerRNA *ptr, int value)
 {
-	DriverVar *dvar= (DriverVar *)ptr->data;
+	DriverVar *dvar = (DriverVar *)ptr->data;
 	
 	/* call the API function for this */
 	driver_change_variable_type(dvar, value);
@@ -254,67 +254,67 @@ static void rna_DriverVariable_type_set(PointerRNA *ptr, int value)
 
 static void rna_FKeyframe_handle1_get(PointerRNA *ptr, float *values)
 {
-	BezTriple *bezt= (BezTriple*)ptr->data;
+	BezTriple *bezt = (BezTriple*)ptr->data;
 	
-	values[0]= bezt->vec[0][0];
-	values[1]= bezt->vec[0][1];
+	values[0] = bezt->vec[0][0];
+	values[1] = bezt->vec[0][1];
 }
 
 static void rna_FKeyframe_handle1_set(PointerRNA *ptr, const float *values)
 {
-	BezTriple *bezt= (BezTriple*)ptr->data;
+	BezTriple *bezt = (BezTriple*)ptr->data;
 	
-	bezt->vec[0][0]= values[0];
-	bezt->vec[0][1]= values[1];
+	bezt->vec[0][0] = values[0];
+	bezt->vec[0][1] = values[1];
 }
 
 static void rna_FKeyframe_handle2_get(PointerRNA *ptr, float *values)
 {
-	BezTriple *bezt= (BezTriple*)ptr->data;
+	BezTriple *bezt = (BezTriple*)ptr->data;
 	
-	values[0]= bezt->vec[2][0];
-	values[1]= bezt->vec[2][1];
+	values[0] = bezt->vec[2][0];
+	values[1] = bezt->vec[2][1];
 }
 
 static void rna_FKeyframe_handle2_set(PointerRNA *ptr, const float *values)
 {
-	BezTriple *bezt= (BezTriple*)ptr->data;
+	BezTriple *bezt = (BezTriple*)ptr->data;
 	
-	bezt->vec[2][0]= values[0];
-	bezt->vec[2][1]= values[1];
+	bezt->vec[2][0] = values[0];
+	bezt->vec[2][1] = values[1];
 }
 
 static void rna_FKeyframe_ctrlpoint_get(PointerRNA *ptr, float *values)
 {
-	BezTriple *bezt= (BezTriple*)ptr->data;
+	BezTriple *bezt = (BezTriple*)ptr->data;
 	
-	values[0]= bezt->vec[1][0];
-	values[1]= bezt->vec[1][1];
+	values[0] = bezt->vec[1][0];
+	values[1] = bezt->vec[1][1];
 }
 
 static void rna_FKeyframe_ctrlpoint_set(PointerRNA *ptr, const float *values)
 {
-	BezTriple *bezt= (BezTriple*)ptr->data;
+	BezTriple *bezt = (BezTriple*)ptr->data;
 	
-	bezt->vec[1][0]= values[0];
-	bezt->vec[1][1]= values[1];
+	bezt->vec[1][0] = values[0];
+	bezt->vec[1][1] = values[1];
 }
 
 /* ****************************** */
 
 static void rna_FCurve_RnaPath_get(PointerRNA *ptr, char *value)
 {
-	FCurve *fcu= (FCurve *)ptr->data;
+	FCurve *fcu = (FCurve *)ptr->data;
 
 	if (fcu->rna_path)
 		strcpy(value, fcu->rna_path);
 	else
-		value[0]= '\0';
+		value[0] = '\0';
 }
 
 static int rna_FCurve_RnaPath_length(PointerRNA *ptr)
 {
-	FCurve *fcu= (FCurve *)ptr->data;
+	FCurve *fcu = (FCurve *)ptr->data;
 	
 	if (fcu->rna_path)
 		return strlen(fcu->rna_path);
@@ -324,24 +324,24 @@ static int rna_FCurve_RnaPath_length(PointerRNA *ptr)
 
 static void rna_FCurve_RnaPath_set(PointerRNA *ptr, const char *value)
 {
-	FCurve *fcu= (FCurve *)ptr->data;
+	FCurve *fcu = (FCurve *)ptr->data;
 
 	if (fcu->rna_path)
 		MEM_freeN(fcu->rna_path);
 	
 	if (value[0]) {
-		fcu->rna_path= BLI_strdup(value);
+		fcu->rna_path = BLI_strdup(value);
 		fcu->flag &= ~FCURVE_DISABLED;
 	}
-	else 
-		fcu->rna_path= NULL;
+	else
+		fcu->rna_path = NULL;
 }
 
 static void rna_FCurve_group_set(PointerRNA *ptr, PointerRNA value)
 {
 	ID *pid = (ID *)ptr->id.data;
 	ID *vid = (ID *)value.id.data;
-	FCurve *fcu= ptr->data;
+	FCurve *fcu = ptr->data;
 	bAction *act = NULL;
 	
 	/* get action */
@@ -351,11 +351,11 @@ static void rna_FCurve_group_set(PointerRNA *ptr, PointerRNA value)
 	}
 	else if (value.data && (pid != vid)) {
 		/* id's differ, cant do this, should raise an error */
-		printf("ERROR: ID's differ - ptr=%p vs value=%p \n", pid, vid);
+		printf("ERROR: ID's differ - ptr=%p vs value=%p\n", pid, vid);
 		return;
 	}
 	
-	if (GS(pid->name)==ID_AC && GS(vid->name)==ID_AC) {
+	if (GS(pid->name) == ID_AC && GS(vid->name) == ID_AC) {
 		/* the ID given is the action already - usually when F-Curve is obtained from an action's pointer */
 		act = (bAction *)pid;
 	}
@@ -369,10 +369,10 @@ static void rna_FCurve_group_set(PointerRNA *ptr, PointerRNA value)
 	if (fcu->grp == value.data) {
 		/* nothing to do */
 		printf("ERROR: F-Curve already belongs to this group\n");
-		return; 
+		return;
 	}
 	
-	/* can only change group if we have info about the action the F-Curve is in 
+	/* can only change group if we have info about the action the F-Curve is in
 	 * (i.e. for drivers or random F-Curves, this cannot be done)
 	 */
 	if (act == NULL) {
@@ -390,7 +390,7 @@ static void rna_FCurve_group_set(PointerRNA *ptr, PointerRNA value)
 	action_groups_remove_channel(act, fcu);
 	
 	/* add the F-Curve back to the action now in the right place */
-	// TODO: make the api function handle the case where there isn't any group to assign to 
+	/* TODO: make the api function handle the case where there isn't any group to assign to  */
 	if (value.data) {
 		/* add to its group using API function, which makes sure everything goes ok */
 		action_groups_add_channel(act, value.data, fcu);
@@ -409,7 +409,7 @@ DriverVar *rna_Driver_new_variable(ChannelDriver *driver)
 
 void rna_Driver_remove_variable(ChannelDriver *driver, ReportList *reports, DriverVar *dvar)
 {
-	if(BLI_findindex(&driver->variables, dvar) == -1) {
+	if (BLI_findindex(&driver->variables, dvar) == -1) {
 		BKE_report(reports, RPT_ERROR, "Variable does not exist in this driver");
 		return;
 	}
@@ -420,14 +420,14 @@ void rna_Driver_remove_variable(ChannelDriver *driver, ReportList *reports, Driv
 
 static PointerRNA rna_FCurve_active_modifier_get(PointerRNA *ptr)
 {
-	FCurve *fcu= (FCurve*)ptr->data;
-	FModifier *fcm= find_active_fmodifier(&fcu->modifiers);
+	FCurve *fcu = (FCurve*)ptr->data;
+	FModifier *fcm = find_active_fmodifier(&fcu->modifiers);
 	return rna_pointer_inherit_refine(ptr, &RNA_FModifier, fcm);
 }
 
 static void rna_FCurve_active_modifier_set(PointerRNA *ptr, PointerRNA value)
 {
-	FCurve *fcu= (FCurve*)ptr->data;
+	FCurve *fcu = (FCurve*)ptr->data;
 	set_active_fmodifier(&fcu->modifiers, (FModifier *)value.data);
 }
 
@@ -438,7 +438,7 @@ static FModifier *rna_FCurve_modifiers_new(FCurve *fcu, int type)
 
 static void rna_FCurve_modifiers_remove(FCurve *fcu, ReportList *reports, FModifier *fcm)
 {
-	if(BLI_findindex(&fcu->modifiers, fcm) == -1) {
+	if (BLI_findindex(&fcu->modifiers, fcm) == -1) {
 		BKE_reportf(reports, RPT_ERROR, "F-Curve modifier '%s' not found in F-Curve", fcm->name);
 		return;
 	}
@@ -447,46 +447,46 @@ static void rna_FCurve_modifiers_remove(FCurve *fcu, ReportList *reports, FModif
 
 static void rna_FModifier_active_set(PointerRNA *ptr, int UNUSED(value))
 {
-	FModifier *fm= (FModifier*)ptr->data;
+	FModifier *fm = (FModifier*)ptr->data;
 
 	/* don't toggle, always switch on */
 	fm->flag |= FMODIFIER_FLAG_ACTIVE;
 }
 
-static void rna_FModifier_start_frame_range(PointerRNA *ptr, float *min, float *max)
+static void rna_FModifier_start_frame_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
 {
-	FModifier *fcm= (FModifier*)ptr->data;
+	FModifier *fcm = (FModifier*)ptr->data;
 	
-	*min= MINAFRAMEF;
-	*max= (fcm->flag & FMODIFIER_FLAG_RANGERESTRICT)? fcm->efra : MAXFRAMEF;
+	*min = MINAFRAMEF;
+	*max = (fcm->flag & FMODIFIER_FLAG_RANGERESTRICT)? fcm->efra : MAXFRAMEF;
 }
 
-static void rna_FModifier_end_frame_range(PointerRNA *ptr, float *min, float *max)
+static void rna_FModifier_end_frame_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
 {
-	FModifier *fcm= (FModifier*)ptr->data;
+	FModifier *fcm = (FModifier*)ptr->data;
 
-	*min= (fcm->flag & FMODIFIER_FLAG_RANGERESTRICT)? fcm->sfra : MINAFRAMEF;
-	*max= MAXFRAMEF;
+	*min = (fcm->flag & FMODIFIER_FLAG_RANGERESTRICT)? fcm->sfra : MINAFRAMEF;
+	*max = MAXFRAMEF;
 }
 
-static void rna_FModifier_blending_range(PointerRNA *ptr, float *min, float *max)
+static void rna_FModifier_blending_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
 {
-	FModifier *fcm= (FModifier*)ptr->data;
+	FModifier *fcm = (FModifier*)ptr->data;
 
-	*min= 0.0f;
-	*max= fcm->efra - fcm->sfra;
+	*min = 0.0f;
+	*max = fcm->efra - fcm->sfra;
 }
 
 static void rna_FModifier_active_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	FModifier *fm, *fmo= (FModifier*)ptr->data;
+	FModifier *fm, *fmo = (FModifier*)ptr->data;
 
 	/* clear active state of other FModifiers in this list */
-	for (fm=fmo->prev; fm; fm=fm->prev)
+	for (fm = fmo->prev; fm; fm = fm->prev)
 	{
 		fm->flag &= ~FMODIFIER_FLAG_ACTIVE;
 	}
-	for (fm=fmo->next; fm; fm=fm->next)
+	for (fm = fmo->next; fm; fm = fm->next)
 	{
 		fm->flag &= ~FMODIFIER_FLAG_ACTIVE;
 	}
@@ -495,114 +495,116 @@ static void rna_FModifier_active_update(Main *UNUSED(bmain), Scene *UNUSED(scene
 
 static int rna_FModifierGenerator_coefficients_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
 {
-	FModifier *fcm= (FModifier*)ptr->data;
-	FMod_Generator *gen= fcm->data;
+	FModifier *fcm = (FModifier*)ptr->data;
+	FMod_Generator *gen = fcm->data;
 
-	if(gen)
-		length[0]= gen->arraysize;
+	if (gen)
+		length[0] = gen->arraysize;
 	else
-		length[0]= 100; /* for raw_access, untested */
+		length[0] = 100; /* for raw_access, untested */
 
 	return length[0];
 }
 
 static void rna_FModifierGenerator_coefficients_get(PointerRNA *ptr, float *values)
 {
-	FModifier *fcm= (FModifier*)ptr->data;
-	FMod_Generator *gen= fcm->data;
+	FModifier *fcm = (FModifier*)ptr->data;
+	FMod_Generator *gen = fcm->data;
 	memcpy(values, gen->coefficients, gen->arraysize * sizeof(float));
 }
 
 static void rna_FModifierGenerator_coefficients_set(PointerRNA *ptr, const float *values)
 {
-	FModifier *fcm= (FModifier*)ptr->data;
-	FMod_Generator *gen= fcm->data;
+	FModifier *fcm = (FModifier*)ptr->data;
+	FMod_Generator *gen = fcm->data;
 	memcpy(gen->coefficients, values, gen->arraysize * sizeof(float));
 }
 
-static void rna_FModifierLimits_minx_range(PointerRNA *ptr, float *min, float *max)
+static void rna_FModifierLimits_minx_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
 {
-	FModifier *fcm= (FModifier*)ptr->data;
-	FMod_Limits *data= fcm->data;
+	FModifier *fcm = (FModifier*)ptr->data;
+	FMod_Limits *data = fcm->data;
 
-	*min= MINAFRAMEF;
-	*max= (data->flag & FCM_LIMIT_XMAX)? data->rect.xmax : MAXFRAMEF;
+	*min = MINAFRAMEF;
+	*max = (data->flag & FCM_LIMIT_XMAX)? data->rect.xmax : MAXFRAMEF;
 }
 
-static void rna_FModifierLimits_maxx_range(PointerRNA *ptr, float *min, float *max)
+static void rna_FModifierLimits_maxx_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
 {
-	FModifier *fcm= (FModifier*)ptr->data;
-	FMod_Limits *data= fcm->data;
+	FModifier *fcm = (FModifier*)ptr->data;
+	FMod_Limits *data = fcm->data;
 
-	*min= (data->flag & FCM_LIMIT_XMIN)? data->rect.xmin : MINAFRAMEF;
-	*max= MAXFRAMEF;
+	*min = (data->flag & FCM_LIMIT_XMIN)? data->rect.xmin : MINAFRAMEF;
+	*max = MAXFRAMEF;
 }
 
-static void rna_FModifierLimits_miny_range(PointerRNA *ptr, float *min, float *max)
+static void rna_FModifierLimits_miny_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
 {
-	FModifier *fcm= (FModifier*)ptr->data;
-	FMod_Limits *data= fcm->data;
+	FModifier *fcm = (FModifier*)ptr->data;
+	FMod_Limits *data = fcm->data;
 
-	*min= -FLT_MAX;
-	*max= (data->flag & FCM_LIMIT_YMAX)? data->rect.ymax : FLT_MAX;
+	*min = -FLT_MAX;
+	*max = (data->flag & FCM_LIMIT_YMAX)? data->rect.ymax : FLT_MAX;
 }
 
-static void rna_FModifierLimits_maxy_range(PointerRNA *ptr, float *min, float *max)
+static void rna_FModifierLimits_maxy_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
 {
-	FModifier *fcm= (FModifier*)ptr->data;
-	FMod_Limits *data= fcm->data;
+	FModifier *fcm = (FModifier*)ptr->data;
+	FMod_Limits *data = fcm->data;
 
-	*min= (data->flag & FCM_LIMIT_YMIN)? data->rect.ymin : -FLT_MAX;
-	*max= FLT_MAX;
+	*min = (data->flag & FCM_LIMIT_YMIN)? data->rect.ymin : -FLT_MAX;
+	*max = FLT_MAX;
 }
 
 
-static void rna_FModifierStepped_start_frame_range(PointerRNA *ptr, float *min, float *max)
+static void rna_FModifierStepped_start_frame_range(PointerRNA *ptr, float *min, float *max,
+                                                   float *softmin, float *softmax)
 {
-	FModifier *fcm= (FModifier*)ptr->data;
-	FMod_Stepped *data= fcm->data;
+	FModifier *fcm = (FModifier*)ptr->data;
+	FMod_Stepped *data = fcm->data;
 	
-	*min= MINAFRAMEF;
-	*max= (data->flag & FCM_STEPPED_NO_AFTER)? data->end_frame : MAXFRAMEF;
+	*min = MINAFRAMEF;
+	*max = (data->flag & FCM_STEPPED_NO_AFTER)? data->end_frame : MAXFRAMEF;
 }
 
-static void rna_FModifierStepped_end_frame_range(PointerRNA *ptr, float *min, float *max)
+static void rna_FModifierStepped_end_frame_range(PointerRNA *ptr, float *min, float *max,
+                                                 float *softmin, float *softmax)
 {
-	FModifier *fcm= (FModifier*)ptr->data;
-	FMod_Stepped *data= fcm->data;
+	FModifier *fcm = (FModifier*)ptr->data;
+	FMod_Stepped *data = fcm->data;
 
-	*min= (data->flag & FCM_STEPPED_NO_BEFORE)? data->start_frame : MINAFRAMEF;
-	*max= MAXFRAMEF;
+	*min = (data->flag & FCM_STEPPED_NO_BEFORE)? data->start_frame : MINAFRAMEF;
+	*max = MAXFRAMEF;
 }
 
 static BezTriple *rna_FKeyframe_points_insert(FCurve *fcu, float frame, float value, int flag)
 {
-	int index= insert_vert_fcurve(fcu, frame, value, flag);
+	int index = insert_vert_fcurve(fcu, frame, value, flag);
 	return ((fcu->bezt) && (index >= 0))? (fcu->bezt + index) : NULL;
 }
 
 static void rna_FKeyframe_points_add(FCurve *fcu, int tot)
 {
-	if(tot > 0) {
+	if (tot > 0) {
 		BezTriple *bezt;
-		if(fcu->totvert) {
-			BezTriple *nbezt= MEM_callocN(sizeof(BezTriple) * (fcu->totvert + tot), "rna_FKeyframe_points_add");
+		if (fcu->totvert) {
+			BezTriple *nbezt = MEM_callocN(sizeof(BezTriple) * (fcu->totvert + tot), "rna_FKeyframe_points_add");
 			memcpy(nbezt, fcu->bezt, sizeof(BezTriple) * fcu->totvert);
 			MEM_freeN(fcu->bezt);
-			fcu->bezt= nbezt;
+			fcu->bezt = nbezt;
 		}
 		else {
-			fcu->bezt= MEM_callocN(sizeof(BezTriple) * tot, "rna_FKeyframe_points_add");
+			fcu->bezt = MEM_callocN(sizeof(BezTriple) * tot, "rna_FKeyframe_points_add");
 		}
 		
-		bezt= fcu->bezt + fcu->totvert;
+		bezt = fcu->bezt + fcu->totvert;
 		fcu->totvert += tot;
 		
-		while(tot--) {
-			/* defaults, no userprefs gives pradictable results for API */
-			bezt->f1= bezt->f2= bezt->f3= SELECT;
-			bezt->ipo= BEZT_IPO_BEZ;
-			bezt->h1= bezt->h2= HD_AUTO_ANIM;
+		while (tot--) {
+			/* defaults, no userprefs gives predictable results for API */
+			bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
+			bezt->ipo = BEZT_IPO_BEZ;
+			bezt->h1 = bezt->h2 = HD_AUTO_ANIM;
 			bezt++;
 		}
 	}
@@ -610,7 +612,7 @@ 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)
 {
-	int index= (int)(bezt - fcu->bezt);
+	int index = (int)(bezt - fcu->bezt);
 	if (index < 0 || index >= fcu->totvert) {
 		BKE_report(reports, RPT_ERROR, "Keyframe not in F-Curve");
 		return;
@@ -633,37 +635,37 @@ static void rna_def_fmodifier_generator(BlenderRNA *brna)
 	
 	static EnumPropertyItem generator_mode_items[] = {
 		{FCM_GENERATOR_POLYNOMIAL, "POLYNOMIAL", 0, "Expanded Polynomial", ""},
-		{FCM_GENERATOR_POLYNOMIAL_FACTORISED, "POLYNOMIAL_FACTORISED", 0, "Factorised Polynomial", ""},
+		{FCM_GENERATOR_POLYNOMIAL_FACTORISED, "POLYNOMIAL_FACTORISED", 0, "Factorized Polynomial", ""},
 		{0, NULL, 0, NULL, NULL}};
 	
-	srna= RNA_def_struct(brna, "FModifierGenerator", "FModifier");
+	srna = RNA_def_struct(brna, "FModifierGenerator", "FModifier");
 	RNA_def_struct_ui_text(srna, "Generator F-Modifier", "Deterministically generate values for the modified F-Curve");
 	RNA_def_struct_sdna_from(srna, "FMod_Generator", "data");
 	
 	/* define common props */
-	prop= RNA_def_property(srna, "use_additive", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_additive", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_GENERATOR_ADDITIVE);
 	RNA_def_property_ui_text(prop, "Additive",
 	                         "Values generated by this modifier are applied on top of "
 	                         "the existing values instead of overwriting them");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-		// XXX this has a special validation func
-	prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+		/* XXX this has a special validation func */
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, generator_mode_items);
 	RNA_def_property_ui_text(prop, "Mode", "Type of generator to use");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
 	
 	/* order of the polynomial */
-		// XXX this has a special validation func
-	prop= RNA_def_property(srna, "poly_order", PROP_INT, PROP_NONE);
+		/* XXX this has a special validation func */
+	prop = RNA_def_property(srna, "poly_order", PROP_INT, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Polynomial Order",
 	                         "The highest power of 'x' for this polynomial (number of coefficients - 1)");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
 	/* coefficients array */
-	prop= RNA_def_property(srna, "coefficients", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "coefficients", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_array(prop, 32);
 	RNA_def_property_flag(prop, PROP_DYNAMIC);
 	RNA_def_property_dynamic_array_funcs(prop, "rna_FModifierGenerator_coefficients_get_length");
@@ -688,36 +690,36 @@ static void rna_def_fmodifier_function_generator(BlenderRNA *brna)
 		{5, "SINC", 0, "Normalised Sine", "sin(x) / x"},
 		{0, NULL, 0, NULL, NULL}};
 	
-	srna= RNA_def_struct(brna, "FModifierFunctionGenerator", "FModifier");
+	srna = RNA_def_struct(brna, "FModifierFunctionGenerator", "FModifier");
 	RNA_def_struct_ui_text(srna, "Built-In Function F-Modifier", "Generate values using a Built-In Function");
 	RNA_def_struct_sdna_from(srna, "FMod_FunctionGenerator", "data");
 	
 	/* coefficients */
-	prop= RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Amplitude", "Scale factor determining the maximum/minimum values");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "phase_multiplier", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "phase_multiplier", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Phase Multiplier", "Scale factor determining the 'speed' of the function");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "phase_offset", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "phase_offset", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Phase Offset", "Constant factor to offset time by for function");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "value_offset", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "value_offset", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Value Offset", "Constant factor to offset values by");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
 	/* flags */
-	prop= RNA_def_property(srna, "use_additive", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_additive", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_GENERATOR_ADDITIVE);
 	RNA_def_property_ui_text(prop, "Additive",
 	                         "Values generated by this modifier are applied on top of "
 	                         "the existing values instead of overwriting them");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "function_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "function_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_ui_text(prop, "Type", "Type of built-in function to use");
@@ -731,32 +733,32 @@ static void rna_def_fmodifier_envelope_ctrl(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "FModifierEnvelopeControlPoint", NULL);
+	srna = RNA_def_struct(brna, "FModifierEnvelopeControlPoint", NULL);
 	RNA_def_struct_ui_text(srna, "Envelope Control Point", "Control point for envelope F-Modifier");
 	RNA_def_struct_sdna(srna, "FCM_EnvelopeData");
 	
-	/* min/max extents 
+	/* min/max extents
 	 *	- for now, these are allowed to go past each other, so that we can have inverted action
 	 *	- technically, the range is limited by the settings in the envelope-modifier data, not here...
 	 */
-	prop= RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "min");
 	RNA_def_property_ui_text(prop, "Minimum Value", "Lower bound of envelope at this control-point");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "max");
 	RNA_def_property_ui_text(prop, "Maximum Value", "Upper bound of envelope at this control-point");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
 	/* Frame */
-	prop= RNA_def_property(srna, "frame", PROP_FLOAT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame", PROP_FLOAT, PROP_TIME);
 	RNA_def_property_float_sdna(prop, NULL, "time");
 	RNA_def_property_ui_text(prop, "Frame", "Frame this control-point occurs on");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	// TODO:
-	//	- selection flags (not implemented in UI yet though)
+	/* TODO: */
+	/*	- selection flags (not implemented in UI yet though) */
 }
 
 static void rna_def_fmodifier_envelope(BlenderRNA *brna)
@@ -764,28 +766,28 @@ static void rna_def_fmodifier_envelope(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "FModifierEnvelope", "FModifier");
+	srna = RNA_def_struct(brna, "FModifierEnvelope", "FModifier");
 	RNA_def_struct_ui_text(srna, "Envelope F-Modifier", "Scale the values of the modified F-Curve");
 	RNA_def_struct_sdna_from(srna, "FMod_Envelope", "data");
 	
 	/* Collections */
-	prop= RNA_def_property(srna, "control_points", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "control_points", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "data", "totvert");
 	RNA_def_property_struct_type(prop, "FModifierEnvelopeControlPoint");
 	RNA_def_property_ui_text(prop, "Control Points", "Control points defining the shape of the envelope");
 	
 	/* Range Settings */
-	prop= RNA_def_property(srna, "reference_value", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "reference_value", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "midval");
 	RNA_def_property_ui_text(prop, "Reference Value", "Value that envelope's influence is centered around / based on");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "default_min", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "default_min", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "min");
 	RNA_def_property_ui_text(prop, "Default Minimum", "Lower distance from Reference Value for 1:1 default influence");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "default_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "default_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "max");
 	RNA_def_property_ui_text(prop, "Default Maximum", "Upper distance from Reference Value for 1:1 default influence");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
@@ -802,37 +804,40 @@ static void rna_def_fmodifier_cycles(BlenderRNA *brna)
 		{FCM_EXTRAPOLATE_NONE, "NONE", 0, "No Cycles", "Don't do anything"},
 		{FCM_EXTRAPOLATE_CYCLIC, "REPEAT", 0, "Repeat Motion", "Repeat keyframe range as-is"},
 		{FCM_EXTRAPOLATE_CYCLIC_OFFSET, "REPEAT_OFFSET", 0, "Repeat with Offset",
-		                                "Repeat keyframe range, but with offset based on gradient between start and end values"},
+		                                "Repeat keyframe range, but with offset based on gradient between "
+		                                "start and end values"},
 		{FCM_EXTRAPOLATE_MIRROR, "MIRROR", 0, "Repeat Mirrored",
 		                         "Alternate between forward and reverse playback of keyframe range"},
 		{0, NULL, 0, NULL, NULL}};
 	
-	srna= RNA_def_struct(brna, "FModifierCycles", "FModifier");
+	srna = RNA_def_struct(brna, "FModifierCycles", "FModifier");
 	RNA_def_struct_ui_text(srna, "Cycles F-Modifier", "Repeat the values of the modified F-Curve");
 	RNA_def_struct_sdna_from(srna, "FMod_Cycles", "data");
 	
 	/* before */
-	prop= RNA_def_property(srna, "mode_before", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mode_before", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "before_mode");
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_ui_text(prop, "Before Mode", "Cycling mode to use before first keyframe");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "cycles_before", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "cycles_before", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "before_cycles");
-	RNA_def_property_ui_text(prop, "Before Cycles", "Maximum number of cycles to allow before first keyframe (0 = infinite)");
+	RNA_def_property_ui_text(prop, "Before Cycles",
+	                         "Maximum number of cycles to allow before first keyframe (0 = infinite)");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
 	/* after */
-	prop= RNA_def_property(srna, "mode_after", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mode_after", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "after_mode");
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_ui_text(prop, "After Mode", "Cycling mode to use after last keyframe");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "cycles_after", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "cycles_after", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "after_cycles");
-	RNA_def_property_ui_text(prop, "After Cycles", "Maximum number of cycles to allow after last keyframe (0 = infinite)");
+	RNA_def_property_ui_text(prop, "After Cycles",
+	                         "Maximum number of cycles to allow after last keyframe (0 = infinite)");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 }
 
@@ -841,9 +846,9 @@ static void rna_def_fmodifier_cycles(BlenderRNA *brna)
 static void rna_def_fmodifier_python(BlenderRNA *brna)
 {
 	StructRNA *srna;
-	//PropertyRNA *prop;
+	/*PropertyRNA *prop; */
 	
-	srna= RNA_def_struct(brna, "FModifierPython", "FModifier");
+	srna = RNA_def_struct(brna, "FModifierPython", "FModifier");
 	RNA_def_struct_ui_text(srna, "Python F-Modifier", "Perform user-defined operation on the modified F-Curve");
 	RNA_def_struct_sdna_from(srna, "FMod_Python", "data");
 }
@@ -855,49 +860,49 @@ static void rna_def_fmodifier_limits(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "FModifierLimits", "FModifier");
+	srna = RNA_def_struct(brna, "FModifierLimits", "FModifier");
 	RNA_def_struct_ui_text(srna, "Limit F-Modifier", "Limit the time/value ranges of the modified F-Curve");
 	RNA_def_struct_sdna_from(srna, "FMod_Limits", "data");
 	
-	prop= RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_LIMIT_XMIN);
 	RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_LIMIT_YMIN);
 	RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_LIMIT_XMAX);
 	RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_LIMIT_YMAX);
 	RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "rect.xmin");
 	RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifierLimits_minx_range");
 	RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "rect.ymin");
 	RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifierLimits_miny_range");
 	RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "rect.xmax");
 	RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifierLimits_maxx_range");
 	RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "rect.ymax");
 	RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifierLimits_maxy_range");
 	RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
@@ -918,32 +923,33 @@ static void rna_def_fmodifier_noise(BlenderRNA *brna)
 		{FCM_NOISE_MODIF_MULTIPLY, "MULTIPLY", 0, "Multiply", ""},
 		{0, NULL, 0, NULL, NULL}};
 	
-	srna= RNA_def_struct(brna, "FModifierNoise", "FModifier");
+	srna = RNA_def_struct(brna, "FModifierNoise", "FModifier");
 	RNA_def_struct_ui_text(srna, "Noise F-Modifier", "Give randomness to the modified F-Curve");
 	RNA_def_struct_sdna_from(srna, "FMod_Noise", "data");
 	
-	prop= RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "modification");
 	RNA_def_property_enum_items(prop, prop_modification_items);
 	RNA_def_property_ui_text(prop, "Blend Type", "Method of modifying the existing F-Curve");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "size");
 	RNA_def_property_ui_text(prop, "Scale", "Scaling (in time) of the noise");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "strength");
-	RNA_def_property_ui_text(prop, "Strength", "Amplitude of the noise - the amount that it modifies the underlying curve");
+	RNA_def_property_ui_text(prop, "Strength",
+	                         "Amplitude of the noise - the amount that it modifies the underlying curve");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "phase", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "phase", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "phase");
 	RNA_def_property_ui_text(prop, "Phase", "A random seed for the noise effect");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "depth");
 	RNA_def_property_ui_text(prop, "Depth", "Amount of fine level detail present in the noise");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
@@ -957,41 +963,42 @@ static void rna_def_fmodifier_stepped(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "FModifierStepped", "FModifier");
+	srna = RNA_def_struct(brna, "FModifierStepped", "FModifier");
 	RNA_def_struct_ui_text(srna, "Stepped Interpolation F-Modifier",
-	                       "Hold each interpolated value from the F-Curve for several frames without changing the timing");
+	                       "Hold each interpolated value from the F-Curve for several frames without "
+	                       "changing the timing");
 	RNA_def_struct_sdna_from(srna, "FMod_Stepped", "data");
 	
 	/* properties */
-	prop= RNA_def_property(srna, "frame_step", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_step", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "step_size");
 	RNA_def_property_ui_text(prop, "Step Size", "Number of frames to hold each value");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "frame_offset", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_offset", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "offset");
 	RNA_def_property_ui_text(prop, "Offset",
 	                         "Reference number of frames before frames get held "
 	                         "(use to get hold for '1-3' vs '5-7' holding patterns)");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "use_frame_start", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_frame_start", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_STEPPED_NO_BEFORE);
 	RNA_def_property_ui_text(prop, "Use Start Frame", "Restrict modifier to only act after its 'start' frame");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "use_frame_end", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_frame_end", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_STEPPED_NO_AFTER);
 	RNA_def_property_ui_text(prop, "Use End Frame", "Restrict modifier to only act before its 'end' frame");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "start_frame");
 	RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifierStepped_start_frame_range");
 	RNA_def_property_ui_text(prop, "Start Frame", "Frame that modifier's influence starts (if applicable)");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "end_frame");
 	RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifierStepped_end_frame_range");
 	RNA_def_property_ui_text(prop, "End Frame", "Frame that modifier's influence ends (if applicable)");
@@ -1007,43 +1014,43 @@ static void rna_def_fmodifier(BlenderRNA *brna)
 	PropertyRNA *prop;
 	
 	/* base struct definition */
-	srna= RNA_def_struct(brna, "FModifier", NULL);
+	srna = RNA_def_struct(brna, "FModifier", NULL);
 	RNA_def_struct_refine_func(srna, "rna_FModifierType_refine");
 	RNA_def_struct_ui_text(srna, "F-Modifier", "Modifier for values of F-Curve");
 	
-#if 0 // XXX not used yet
+#if 0 /* XXX not used yet */
 	/* name */
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_struct_name_property(srna, prop);
 	RNA_def_property_ui_text(prop, "Name", "Short description of F-Curve Modifier");
-#endif // XXX not used yet
+#endif /* XXX not used yet */
 	
 	/* type */
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_enum_items(prop, fmodifier_type_items);
 	RNA_def_property_ui_text(prop, "Type", "F-Curve Modifier Type");
 	
 	/* settings */
-	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, "flag", FMODIFIER_FLAG_EXPANDED);
 	RNA_def_property_ui_text(prop, "Expanded", "F-Curve Modifier's panel is expanded in UI");
 	RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
 	
-	prop= RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_MUTED);
 	RNA_def_property_ui_text(prop, "Muted", "F-Curve Modifier will not be evaluated");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
 	RNA_def_property_ui_icon(prop, ICON_MUTE_IPO_OFF, 1);
 	
-	prop= RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FMODIFIER_FLAG_DISABLED);
 	RNA_def_property_ui_text(prop, "Disabled", "F-Curve Modifier has invalid settings and will not be evaluated");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
 	
-		// TODO: setting this to true must ensure that all others in stack are turned off too...
-	prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
+		/* TODO: setting this to true must ensure that all others in stack are turned off too... */
+	prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_ACTIVE);
 	RNA_def_property_ui_text(prop, "Active", "F-Curve Modifier is the one being edited ");
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_FModifier_active_set");
@@ -1051,52 +1058,55 @@ static void rna_def_fmodifier(BlenderRNA *brna)
 	RNA_def_property_ui_icon(prop, ICON_RADIOBUT_OFF, 1);
 	
 	/* restricted range */
-	prop= RNA_def_property(srna, "use_restricted_range", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_restricted_range", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_RANGERESTRICT);
 	RNA_def_property_ui_text(prop, "Restrict Frame Range",
 	                         "F-Curve Modifier is only applied for the specified frame range to help "
 	                         "mask off effects in order to chain them");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
-	RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1); // XXX: depends on UI implementation
+	RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1); /* XXX: depends on UI implementation */
 	
-	prop= RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "sfra");
 	RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifier_start_frame_range");
-	RNA_def_property_ui_text(prop, "Start Frame", "Frame that modifier's influence starts (if Restrict Frame Range is in use)");
+	RNA_def_property_ui_text(prop, "Start Frame",
+	                         "Frame that modifier's influence starts (if Restrict Frame Range is in use)");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
 	
-	prop= RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "efra");
 	RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifier_end_frame_range");
-	RNA_def_property_ui_text(prop, "End Frame", "Frame that modifier's influence ends (if Restrict Frame Range is in use)");
+	RNA_def_property_ui_text(prop, "End Frame",
+	                         "Frame that modifier's influence ends (if Restrict Frame Range is in use)");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
 	
-	prop= RNA_def_property(srna, "blend_in", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "blend_in", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "blendin");
 	RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifier_blending_range");
 	RNA_def_property_ui_text(prop, "Blend In", "Number of frames from start frame for influence to take effect");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
 	
-	prop= RNA_def_property(srna, "blend_out", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "blend_out", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "blendout");
 	RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifier_blending_range");
 	RNA_def_property_ui_text(prop, "Blend Out", "Number of frames from end frame for influence to fade out");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
 	
 	/* influence */
-	prop= RNA_def_property(srna, "use_influence", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_influence", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_USEINFLUENCE);
 	RNA_def_property_ui_text(prop, "Use Influence", "F-Curve Modifier's effects will be tempered by a default factor");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
-	RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1); // XXX: depends on UI implementation
+	RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1); /* XXX: depends on UI implementation */
 	
-	prop= RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "influence");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_float_default(prop, 1.0f);
-	RNA_def_property_ui_text(prop, "Influence", "Amount of influence F-Curve Modifier will have when not fading in/out");
+	RNA_def_property_ui_text(prop, "Influence",
+	                         "Amount of influence F-Curve Modifier will have when not fading in/out");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
-}	
+}
 
 /* *********************** */
 
@@ -1122,24 +1132,26 @@ static void rna_def_drivertarget(BlenderRNA *brna)
 		{DTAR_FLAG_LOCALSPACE, "TRANSFORM_SPACE", 0, "Transform Space",
 		                       "Transforms don't include parenting/restpose or constraints"},
 		{DTAR_FLAG_LOCALSPACE|DTAR_FLAG_LOCAL_CONSTS, "LOCAL_SPACE", 0, "Local Space",
-		                                              "Transforms include effects of constraints but not parenting/restpose"},
+		                                              "Transforms include effects of constraints but not "
+		                                              "parenting/restpose"},
 		{0, NULL, 0, NULL, NULL}};
 	
-	srna= RNA_def_struct(brna, "DriverTarget", NULL);
+	srna = RNA_def_struct(brna, "DriverTarget", NULL);
 	RNA_def_struct_ui_text(srna, "Driver Target", "Source of input values for driver variables");
 	
 	/* Target Properties - ID-block to Drive */
-	prop= RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "ID");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_editable_func(prop, "rna_DriverTarget_id_editable");
 	/* note: custom set function is ONLY to avoid rna setting a user for this. */
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_DriverTarget_id_set", "rna_DriverTarget_id_typef", NULL);
 	RNA_def_property_ui_text(prop, "ID",
-	                         "ID-block that the specific property used can be found from (id_type property must be set first)");
+	                         "ID-block that the specific property used can be found from "
+	                         "(id_type property must be set first)");
 	RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");
 	
-	prop= RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "idtype");
 	RNA_def_property_enum_items(prop, id_type_items);
 	RNA_def_property_enum_default(prop, ID_OB);
@@ -1149,24 +1161,24 @@ static void rna_def_drivertarget(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");
 	
 	/* Target Properties - Property to Drive */
-	prop= RNA_def_property(srna, "data_path", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "data_path", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_funcs(prop, "rna_DriverTarget_RnaPath_get", "rna_DriverTarget_RnaPath_length",
 	                              "rna_DriverTarget_RnaPath_set");
 	RNA_def_property_ui_text(prop, "Data Path", "RNA Path (from ID-block) to property used");
 	RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");
 	
-	prop= RNA_def_property(srna, "bone_target", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "bone_target", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "pchan_name");
 	RNA_def_property_ui_text(prop, "Bone Name", "Name of PoseBone to use as target");
 	RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");
 	
-	prop= RNA_def_property(srna, "transform_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "transform_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "transChan");
 	RNA_def_property_enum_items(prop, prop_trans_chan_items);
 	RNA_def_property_ui_text(prop, "Type", "Driver variable type");
 	RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");
 	
-	prop= RNA_def_property(srna, "transform_space", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "transform_space", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, prop_local_space_items);
 	RNA_def_property_ui_text(prop, "Transform Space", "Space in which transforms are used");
@@ -1180,34 +1192,36 @@ static void rna_def_drivervar(BlenderRNA *brna)
 	
 	static EnumPropertyItem prop_type_items[] = {
 		{DVAR_TYPE_SINGLE_PROP, "SINGLE_PROP", 0, "Single Property", "Use the value from some RNA property (Default)"},
-		{DVAR_TYPE_TRANSFORM_CHAN, "TRANSFORMS", 0, "Transform Channel", "Final transformation value of object or bone"},
+		{DVAR_TYPE_TRANSFORM_CHAN, "TRANSFORMS", 0, "Transform Channel",
+		                           "Final transformation value of object or bone"},
 		{DVAR_TYPE_ROT_DIFF, "ROTATION_DIFF", 0, "Rotational Difference", "Use the angle between two bones"},
 		{DVAR_TYPE_LOC_DIFF, "LOC_DIFF", 0, "Distance", "Distance between two bones or objects"},
 		{0, NULL, 0, NULL, NULL}};
 		
 	
-	srna= RNA_def_struct(brna, "DriverVariable", NULL);
+	srna = RNA_def_struct(brna, "DriverVariable", NULL);
 	RNA_def_struct_sdna(srna, "DriverVar");
 	RNA_def_struct_ui_text(srna, "Driver Variable", "Variable from some source/target for driver relationship");
 	
 	/* Variable Name */
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_struct_name_property(srna, prop);
 	RNA_def_property_ui_text(prop, "Name",
 	                         "Name to use in scripted expressions/functions (no spaces or dots are allowed, "
 	                         "and must start with a letter)");
-	RNA_def_property_update(prop, 0, "rna_DriverTarget_update_name"); // XXX
+	RNA_def_property_update(prop, 0, "rna_DriverTarget_update_name"); /* XXX */
 	
 	/* Enums */
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_enum_funcs(prop, NULL, "rna_DriverVariable_type_set", NULL);
 	RNA_def_property_ui_text(prop, "Type", "Driver variable type");
-	RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); // XXX
+	RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); /* XXX */
 	
 	/* Targets */
-	// TODO: for nicer api, only expose the relevant props via subclassing, instead of exposing the collection of targets
-	prop= RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
+	/* TODO: for nicer api, only expose the relevant props via subclassing,
+	 *       instead of exposing the collection of targets */
+	prop = RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "targets", "num_targets");
 	RNA_def_property_struct_type(prop, "DriverTarget");
 	RNA_def_property_ui_text(prop, "Targets", "Sources of input data for evaluating this variable");
@@ -1218,30 +1232,30 @@ static void rna_def_drivervar(BlenderRNA *brna)
 static void rna_def_channeldriver_variables(BlenderRNA *brna, PropertyRNA *cprop)
 {
 	StructRNA *srna;
-//	PropertyRNA *prop;
+/*	PropertyRNA *prop; */
 	
 	FunctionRNA *func;
 	PropertyRNA *parm;
 	
 	RNA_def_property_srna(cprop, "ChannelDriverVariables");
-	srna= RNA_def_struct(brna, "ChannelDriverVariables", NULL);
+	srna = RNA_def_struct(brna, "ChannelDriverVariables", NULL);
 	RNA_def_struct_sdna(srna, "ChannelDriver");
 	RNA_def_struct_ui_text(srna, "ChannelDriver Variables", "Collection of channel driver Variables");
 	
 	
 	/* add variable */
-	func= RNA_def_function(srna, "new", "rna_Driver_new_variable");
+	func = RNA_def_function(srna, "new", "rna_Driver_new_variable");
 	RNA_def_function_ui_description(func, "Add a new variable for the driver");
 		/* return type */
-	parm= RNA_def_pointer(func, "var", "DriverVariable", "", "Newly created Driver Variable");
+	parm = RNA_def_pointer(func, "var", "DriverVariable", "", "Newly created Driver Variable");
 		RNA_def_function_return(func, parm);
 
 	/* remove variable */
-	func= RNA_def_function(srna, "remove", "rna_Driver_remove_variable");
+	func = RNA_def_function(srna, "remove", "rna_Driver_remove_variable");
 	RNA_def_function_ui_description(func, "Remove an existing variable from the driver");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	/* target to remove */
-	parm= RNA_def_pointer(func, "variable", "DriverVariable", "", "Variable to remove from the driver");
+	parm = RNA_def_pointer(func, "variable", "DriverVariable", "", "Variable to remove from the driver");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 }
 
@@ -1258,37 +1272,37 @@ static void rna_def_channeldriver(BlenderRNA *brna)
 		{DRIVER_TYPE_MAX, "MAX", 0, "Maximum Value", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "Driver", NULL);
+	srna = RNA_def_struct(brna, "Driver", NULL);
 	RNA_def_struct_sdna(srna, "ChannelDriver");
 	RNA_def_struct_ui_text(srna, "Driver", "Driver for the value of a setting based on an external value");
 	RNA_def_struct_ui_icon(srna, ICON_DRIVER);
 
 	/* Enums */
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_ui_text(prop, "Type", "Driver type");
 	RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data");
 
 	/* String values */
-	prop= RNA_def_property(srna, "expression", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "expression", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Expression", "Expression to use for Scripted Expression");
 	RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_expr");
 
 	/* Collections */
-	prop= RNA_def_property(srna, "variables", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "variables", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "variables", NULL);
 	RNA_def_property_struct_type(prop, "DriverVariable");
 	RNA_def_property_ui_text(prop, "Variables", "Properties acting as inputs for this driver");
 	rna_def_channeldriver_variables(brna, prop);
 	
 	/* Settings */
-	prop= RNA_def_property(srna, "show_debug_info", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_debug_info", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", DRIVER_FLAG_SHOWDEBUG);
 	RNA_def_property_ui_text(prop, "Show Debug Info",
 	                         "Show intermediate values for the driver calculations to allow debugging of drivers");
 	
 	/* State Info (for Debugging) */
-	prop= RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", DRIVER_FLAG_INVALID);
 	RNA_def_property_ui_text(prop, "Invalid", "Driver could not be evaluated in past, so should be skipped");
 	
@@ -1304,18 +1318,18 @@ static void rna_def_fpoint(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "FCurveSample", NULL);
+	srna = RNA_def_struct(brna, "FCurveSample", NULL);
 	RNA_def_struct_sdna(srna, "FPoint");
 	RNA_def_struct_ui_text(srna, "F-Curve Sample", "Sample point for F-Curve");
 	
 	/* Boolean values */
-	prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", 1);
 	RNA_def_property_ui_text(prop, "Select", "Selection status");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_SELECTED, NULL);
 	
 	/* Vector value */
-	prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
+	prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
 	RNA_def_property_float_sdna(prop, NULL, "vec");
 	RNA_def_property_array(prop, 2);
 	RNA_def_property_ui_text(prop, "Point", "Point coordinates");
@@ -1324,47 +1338,47 @@ static void rna_def_fpoint(BlenderRNA *brna)
 
 
 /* duplicate of BezTriple in rna_curve.c
- * but with F-Curve specific options updates/functionality 
+ * but with F-Curve specific options updates/functionality
  */
 static void rna_def_fkeyframe(BlenderRNA *brna)
 {
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "Keyframe", NULL);
+	srna = RNA_def_struct(brna, "Keyframe", NULL);
 	RNA_def_struct_sdna(srna, "BezTriple");
 	RNA_def_struct_ui_text(srna, "Keyframe", "Bezier curve point with two handles defining a Keyframe on an F-Curve");
 	
 	/* Boolean values */
-	prop= RNA_def_property(srna, "select_left_handle", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select_left_handle", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "f1", 0);
 	RNA_def_property_ui_text(prop, "Handle 1 selected", "Left handle selection status");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_SELECTED, NULL);
 	
-	prop= RNA_def_property(srna, "select_right_handle", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select_right_handle", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "f3", 0);
 	RNA_def_property_ui_text(prop, "Handle 2 selected", "Right handle selection status");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_SELECTED, NULL);
 	
-	prop= RNA_def_property(srna, "select_control_point", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select_control_point", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "f2", 0);
 	RNA_def_property_ui_text(prop, "Select", "Control point selection status");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_SELECTED, NULL);
 	
 	/* Enums */
-	prop= RNA_def_property(srna, "handle_left_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "handle_left_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "h1");
 	RNA_def_property_enum_items(prop, keyframe_handle_type_items);
 	RNA_def_property_ui_text(prop, "Left Handle Type", "Handle types");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
 	
-	prop= RNA_def_property(srna, "handle_right_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "handle_right_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "h2");
 	RNA_def_property_enum_items(prop, keyframe_handle_type_items);
 	RNA_def_property_ui_text(prop, "Right Handle Type", "Handle types");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
 	
-	prop= RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "ipo");
 	RNA_def_property_enum_items(prop, beztriple_interpolation_mode_items);
 	RNA_def_property_ui_text(prop, "Interpolation",
@@ -1372,26 +1386,26 @@ static void rna_def_fkeyframe(BlenderRNA *brna)
 	                         "this Keyframe until the next Keyframe");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
 	
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "hide");
 	RNA_def_property_enum_items(prop, beztriple_keyframe_type_items);
 	RNA_def_property_ui_text(prop, "Type", "Type of keyframe (for visual purposes only)");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
 	
 	/* Vector values */
-	prop= RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
+	prop = RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
 	RNA_def_property_array(prop, 2);
 	RNA_def_property_float_funcs(prop, "rna_FKeyframe_handle1_get", "rna_FKeyframe_handle1_set", NULL);
 	RNA_def_property_ui_text(prop, "Left Handle", "Coordinates of the left handle (before the control point)");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
+	prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
 	RNA_def_property_array(prop, 2);
 	RNA_def_property_float_funcs(prop, "rna_FKeyframe_ctrlpoint_get", "rna_FKeyframe_ctrlpoint_set", NULL);
 	RNA_def_property_ui_text(prop, "Control Point", "Coordinates of the control point");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
+	prop = RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
 	RNA_def_property_array(prop, 2);
 	RNA_def_property_float_funcs(prop, "rna_FKeyframe_handle2_get", "rna_FKeyframe_handle2_set", NULL);
 	RNA_def_property_ui_text(prop, "Right Handle", "Coordinates of the right handle (after the control point)");
@@ -1408,33 +1422,34 @@ static void rna_def_fcurve_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, "FCurveModifiers");
-	srna= RNA_def_struct(brna, "FCurveModifiers", NULL);
+	srna = RNA_def_struct(brna, "FCurveModifiers", NULL);
 	RNA_def_struct_sdna(srna, "FCurve");
 	RNA_def_struct_ui_text(srna, "F-Curve Modifiers", "Collection of F-Curve Modifiers");
 
 
 	/* Collection active property */
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "FModifier");
-	RNA_def_property_pointer_funcs(prop, "rna_FCurve_active_modifier_get", "rna_FCurve_active_modifier_set", NULL, NULL);
+	RNA_def_property_pointer_funcs(prop, "rna_FCurve_active_modifier_get",
+	                               "rna_FCurve_active_modifier_set", NULL, NULL);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Active F-Curve Modifier", "Active F-Curve Modifier");
 
 	/* Constraint collection */
-	func= RNA_def_function(srna, "new", "rna_FCurve_modifiers_new");
+	func = RNA_def_function(srna, "new", "rna_FCurve_modifiers_new");
 	RNA_def_function_ui_description(func, "Add a constraint to this object");
 	/* return type */
-	parm= RNA_def_pointer(func, "fmodifier", "FModifier", "", "New fmodifier");
+	parm = RNA_def_pointer(func, "fmodifier", "FModifier", "", "New fmodifier");
 	RNA_def_function_return(func, parm);
 	/* object to add */
-	parm= RNA_def_enum(func, "type", fmodifier_type_items, 1, "", "Constraint type to add");
+	parm = RNA_def_enum(func, "type", fmodifier_type_items, 1, "", "Constraint type to add");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	func= RNA_def_function(srna, "remove", "rna_FCurve_modifiers_remove");
+	func = RNA_def_function(srna, "remove", "rna_FCurve_modifiers_remove");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	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");
+	parm = RNA_def_pointer(func, "modifier", "FModifier", "", "Removed modifier");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 }
 
@@ -1453,30 +1468,32 @@ static void rna_def_fcurve_keyframe_points(BlenderRNA *brna, PropertyRNA *cprop)
 		{0, NULL, 0, NULL, NULL}};
 
 	RNA_def_property_srna(cprop, "FCurveKeyframePoints");
-	srna= RNA_def_struct(brna, "FCurveKeyframePoints", NULL);
+	srna = RNA_def_struct(brna, "FCurveKeyframePoints", NULL);
 	RNA_def_struct_sdna(srna, "FCurve");
 	RNA_def_struct_ui_text(srna, "Keyframe Points", "Collection of keyframe points");
 
-	func= RNA_def_function(srna, "insert", "rna_FKeyframe_points_insert");
+	func = RNA_def_function(srna, "insert", "rna_FKeyframe_points_insert");
 	RNA_def_function_ui_description(func, "Add a keyframe point to a F-Curve");
-	parm= RNA_def_float(func, "frame", 0.0f, -FLT_MAX, FLT_MAX, "", "X Value of this keyframe point", -FLT_MAX, FLT_MAX);
+	parm = RNA_def_float(func, "frame", 0.0f, -FLT_MAX, FLT_MAX, "",
+	                     "X Value of this keyframe point", -FLT_MAX, FLT_MAX);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_float(func, "value", 0.0f, -FLT_MAX, FLT_MAX, "", "Y Value of this keyframe point", -FLT_MAX, FLT_MAX);
+	parm = RNA_def_float(func, "value", 0.0f, -FLT_MAX, FLT_MAX, "",
+	                     "Y Value of this keyframe point", -FLT_MAX, FLT_MAX);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
 	RNA_def_enum_flag(func, "options", keyframe_flag_items, 0, "", "Keyframe options");
 
-	parm= RNA_def_pointer(func, "keyframe", "Keyframe", "", "Newly created keyframe");
+	parm = RNA_def_pointer(func, "keyframe", "Keyframe", "", "Newly created keyframe");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "add", "rna_FKeyframe_points_add");
+	func = RNA_def_function(srna, "add", "rna_FKeyframe_points_add");
 	RNA_def_function_ui_description(func, "Add a keyframe point to a F-Curve");
 	RNA_def_int(func, "count", 1, 1, INT_MAX, "Number", "Number of points to add to the spline", 1, INT_MAX);
 
-	func= RNA_def_function(srna, "remove", "rna_FKeyframe_points_remove");
+	func = RNA_def_function(srna, "remove", "rna_FKeyframe_points_remove");
 	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");
+	parm = RNA_def_pointer(func, "keyframe", "Keyframe", "", "Keyframe to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 	/* optional */
 	RNA_def_boolean(func, "fast", 0, "Fast", "Fast keyframe removal to avoid recalculating the curve each time");
@@ -1499,23 +1516,24 @@ static void rna_def_fcurve(BlenderRNA *brna)
 		{FCURVE_COLOR_CUSTOM, "CUSTOM", 0, "User Defined", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "FCurve", NULL);
+	srna = RNA_def_struct(brna, "FCurve", NULL);
 	RNA_def_struct_ui_text(srna, "F-Curve", "F-Curve defining values of a period of time");
 	RNA_def_struct_ui_icon(srna, ICON_ANIM_DATA);
 
 	/* Enums */
-	prop= RNA_def_property(srna, "extrapolation", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "extrapolation", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "extend");
 	RNA_def_property_enum_items(prop, prop_mode_extend_items);
 	RNA_def_property_ui_text(prop, "Extrapolation", "");
-	RNA_def_property_update(prop, NC_ANIMATION, NULL);	// XXX need an update callback for this so that animation gets evaluated
+		/* XXX need an update callback for this so that animation gets evaluated */
+	RNA_def_property_update(prop, NC_ANIMATION, NULL);
 
 	/* Pointers */
-	prop= RNA_def_property(srna, "driver", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "driver", PROP_POINTER, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Driver", "Channel Driver (only set for Driver F-Curves)");
 	
-	prop= RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "grp");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Group", "Action Group that this F-Curve belongs to");
@@ -1523,86 +1541,93 @@ static void rna_def_fcurve(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_ANIMATION, NULL);
 
 	/* Path + Array Index */
-	prop= RNA_def_property(srna, "data_path", PROP_STRING, PROP_NONE);
-	RNA_def_property_string_funcs(prop, "rna_FCurve_RnaPath_get", "rna_FCurve_RnaPath_length", "rna_FCurve_RnaPath_set");
+	prop = RNA_def_property(srna, "data_path", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_funcs(prop, "rna_FCurve_RnaPath_get", "rna_FCurve_RnaPath_length",
+	                              "rna_FCurve_RnaPath_set");
 	RNA_def_property_ui_text(prop, "Data Path", "RNA Path to property affected by F-Curve");
-	RNA_def_property_update(prop, NC_ANIMATION, NULL);	// XXX need an update callback for this to that animation gets evaluated
+		/* XXX need an update callback for this to that animation gets evaluated */
+	RNA_def_property_update(prop, NC_ANIMATION, NULL);
 
 	/* called 'index' when given as function arg */
-	prop= RNA_def_property(srna, "array_index", PROP_INT, PROP_NONE);
-	RNA_def_property_ui_text(prop, "RNA Array Index", "Index to the specific property affected by F-Curve if applicable");
-	RNA_def_property_update(prop, NC_ANIMATION, NULL);	// XXX need an update callback for this so that animation gets evaluated
+	prop = RNA_def_property(srna, "array_index", PROP_INT, PROP_NONE);
+	RNA_def_property_ui_text(prop, "RNA Array Index",
+	                         "Index to the specific property affected by F-Curve if applicable");
+		/* XXX need an update callback for this so that animation gets evaluated */
+	RNA_def_property_update(prop, NC_ANIMATION, NULL);
 	
 	/* Color */
-	prop= RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, prop_mode_color_items);
 	RNA_def_property_ui_text(prop, "Color Mode", "Method used to determine color of F-Curve in Graph Editor");
-	RNA_def_property_update(prop, NC_ANIMATION, NULL);	
+	RNA_def_property_update(prop, NC_ANIMATION, NULL);
 	
-	prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Color", "Color of the F-Curve in the Graph Editor");
-	RNA_def_property_update(prop, NC_ANIMATION, NULL);	
+	RNA_def_property_update(prop, NC_ANIMATION, NULL);
 	
 	/* Flags */
-	prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", FCURVE_SELECTED);
 	RNA_def_property_ui_text(prop, "Select", "F-Curve is selected for editing");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_SELECTED, NULL);
 	
-	prop= RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", FCURVE_PROTECTED);
 	RNA_def_property_ui_text(prop, "Lock", "F-Curve's settings cannot be edited");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", FCURVE_MUTED);
 	RNA_def_property_ui_text(prop, "Muted", "F-Curve is not evaluated");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN|NA_EDITED, NULL);
 	
-	prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FCURVE_VISIBLE);
 	RNA_def_property_ui_text(prop, "Hide", "F-Curve and its keyframes are hidden in the Graph Editor graphs");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
 
 	/* State Info (for Debugging) */
-	prop= RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FCURVE_DISABLED);
 	RNA_def_property_ui_text(prop, "Valid",
-	                         "False when F-Curve could not be evaluated in past, so should be skipped when evaluating");
+	                         "False when F-Curve could not be evaluated in past, so should be skipped "
+	                         "when evaluating");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_PROP, NULL);
 	
 	/* Collections */
-	prop= RNA_def_property(srna, "sampled_points", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "sampled_points", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "fpt", "totvert");
 	RNA_def_property_struct_type(prop, "FCurveSample");
 	RNA_def_property_ui_text(prop, "Sampled Points", "Sampled animation data");
 
-	prop= RNA_def_property(srna, "keyframe_points", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "keyframe_points", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "bezt", "totvert");
 	RNA_def_property_struct_type(prop, "Keyframe");
 	RNA_def_property_ui_text(prop, "Keyframes", "User-editable keyframes");
 	rna_def_fcurve_keyframe_points(brna, prop);
 	
-	prop= RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "FModifier");
 	RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting the shape of the F-Curve");
 	rna_def_fcurve_modifiers(brna, prop);
 
 	/* Functions */
-	func= RNA_def_function(srna, "evaluate", "evaluate_fcurve"); /* calls the C/API direct */
+	func = RNA_def_function(srna, "evaluate", "evaluate_fcurve"); /* calls the C/API direct */
 	RNA_def_function_ui_description(func, "Evaluate F-Curve");
-	parm= RNA_def_float(func, "frame", 1.0f, -FLT_MAX, FLT_MAX, "Frame", "Evaluate F-Curve at given frame", -FLT_MAX, FLT_MAX);
+	parm = RNA_def_float(func, "frame", 1.0f, -FLT_MAX, FLT_MAX, "Frame",
+	                     "Evaluate F-Curve at given frame", -FLT_MAX, FLT_MAX);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return value */
-	parm= RNA_def_float(func, "position", 0, -FLT_MAX, FLT_MAX, "Position", "F-Curve position", -FLT_MAX, FLT_MAX);
+	parm = RNA_def_float(func, "position", 0, -FLT_MAX, FLT_MAX, "Position", "F-Curve position", -FLT_MAX, FLT_MAX);
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "range", "rna_fcurve_range");
+	func = RNA_def_function(srna, "range", "rna_fcurve_range");
 	RNA_def_function_ui_description(func, "Get the time extents for F-Curve");
 	/* return value */
-	parm= RNA_def_float_vector(func, "range", 2, NULL, -FLT_MAX, FLT_MAX, "Range", "Min/Max values", -FLT_MAX, FLT_MAX);
+	parm = RNA_def_float_vector(func, "range", 2, NULL, -FLT_MAX, FLT_MAX, "Range",
+	                            "Min/Max values", -FLT_MAX, FLT_MAX);
 	RNA_def_property_flag(parm, PROP_THICK_WRAP);
 	RNA_def_function_output(func, parm);
 }
diff --git a/source/blender/makesrna/intern/rna_fcurve_api.c b/source/blender/makesrna/intern/rna_fcurve_api.c
index 5069875..1f8b827 100644
--- a/source/blender/makesrna/intern/rna_fcurve_api.c
+++ b/source/blender/makesrna/intern/rna_fcurve_api.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
@@ -18,7 +18,7 @@
  * The Original Code is Copyright (C) 2009 Blender Foundation.
  * All rights reserved.
  *
- * 
+ *
  * Contributor(s): Joshua Leung
  *
  * ***** END GPL LICENSE BLOCK *****
@@ -49,8 +49,8 @@
 
 void RNA_api_drivers(StructRNA *srna)
 {
-//	FunctionRNA *func;
-//	PropertyRNA *parm;
+/*	FunctionRNA *func; */
+/*	PropertyRNA *parm; */
 }
 
 #endif
diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c
index c17f23b..a4aac6f 100644
--- a/source/blender/makesrna/intern/rna_fluidsim.c
+++ b/source/blender/makesrna/intern/rna_fluidsim.c
@@ -53,9 +53,9 @@
 
 static StructRNA* rna_FluidSettings_refine(struct PointerRNA *ptr)
 {
-	FluidsimSettings *fss= (FluidsimSettings*)ptr->data;
+	FluidsimSettings *fss = (FluidsimSettings*)ptr->data;
 
-	switch(fss->type) {
+	switch (fss->type) {
 		case OB_FLUIDSIM_DOMAIN:
 			return &RNA_DomainFluidSettings;
 		case OB_FLUIDSIM_FLUID:
@@ -77,7 +77,7 @@ static StructRNA* rna_FluidSettings_refine(struct PointerRNA *ptr)
 
 static void rna_fluid_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	Object *ob= ptr->id.data;
+	Object *ob = ptr->id.data;
 
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 	WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob);
@@ -95,17 +95,17 @@ static int fluidsim_find_lastframe(Object *ob, FluidsimSettings *fss)
 	do {
 		BLI_strncpy(targetFileTest, targetFile, sizeof(targetFileTest));
 		BLI_path_frame(targetFileTest, curFrame++, 0);
-	} while(BLI_exists(targetFileTest));
+	} while (BLI_exists(targetFileTest));
 
 	return curFrame - 1;
 }
 
 static void rna_fluid_find_enframe(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Object *ob= ptr->id.data;
-	FluidsimModifierData *fluidmd= (FluidsimModifierData*)modifiers_findByType(ob, eModifierType_Fluidsim);
+	Object *ob = ptr->id.data;
+	FluidsimModifierData *fluidmd = (FluidsimModifierData*)modifiers_findByType(ob, eModifierType_Fluidsim);
 
-	if(fluidmd->fss->flag & OB_FLUIDSIM_REVERSE) {
+	if (fluidmd->fss->flag & OB_FLUIDSIM_REVERSE) {
 		fluidmd->fss->lastgoodframe = fluidsim_find_lastframe(ob, fluidmd->fss);
 	}
 	else {
@@ -116,46 +116,46 @@ static void rna_fluid_find_enframe(Main *bmain, Scene *scene, PointerRNA *ptr)
 
 static void rna_FluidSettings_update_type(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 	FluidsimModifierData *fluidmd;
 	ParticleSystemModifierData *psmd;
 	ParticleSystem *psys;
 	ParticleSettings *part;
 	
-	fluidmd= (FluidsimModifierData*)modifiers_findByType(ob, eModifierType_Fluidsim);
-	fluidmd->fss->flag &= ~OB_FLUIDSIM_REVERSE; // clear flag
+	fluidmd = (FluidsimModifierData*)modifiers_findByType(ob, eModifierType_Fluidsim);
+	fluidmd->fss->flag &= ~OB_FLUIDSIM_REVERSE; /* clear flag */
 
 	/* remove fluidsim particle system */
-	if(fluidmd->fss->type & OB_FLUIDSIM_PARTICLE) {
-		for(psys=ob->particlesystem.first; psys; psys=psys->next)
-			if(psys->part->type == PART_FLUID)
+	if (fluidmd->fss->type & OB_FLUIDSIM_PARTICLE) {
+		for (psys = ob->particlesystem.first; psys; psys = psys->next)
+			if (psys->part->type == PART_FLUID)
 				break;
 
-		if(ob->type == OB_MESH && !psys) {
+		if (ob->type == OB_MESH && !psys) {
 			/* add particle system */
-			part= psys_new_settings("ParticleSettings", bmain);
-			psys= MEM_callocN(sizeof(ParticleSystem), "particle_system");
+			part = psys_new_settings("ParticleSettings", bmain);
+			psys = MEM_callocN(sizeof(ParticleSystem), "particle_system");
 
-			part->type= PART_FLUID;
-			psys->part= part;
-			psys->pointcache= BKE_ptcache_add(&psys->ptcaches);
+			part->type = PART_FLUID;
+			psys->part = part;
+			psys->pointcache = BKE_ptcache_add(&psys->ptcaches);
 			psys->flag |= PSYS_ENABLED;
 			BLI_strncpy(psys->name, "FluidParticles", sizeof(psys->name));
 			BLI_addtail(&ob->particlesystem,psys);
 
 			/* add modifier */
-			psmd= (ParticleSystemModifierData*)modifier_new(eModifierType_ParticleSystem);
+			psmd = (ParticleSystemModifierData*)modifier_new(eModifierType_ParticleSystem);
 			BLI_strncpy(psmd->modifier.name, "FluidParticleSystem", sizeof(psmd->modifier.name));
-			psmd->psys= psys;
+			psmd->psys = psys;
 			BLI_addtail(&ob->modifiers, psmd);
 			modifier_unique_name(&ob->modifiers, (ModifierData *)psmd);
 		}
 	}
 	else {
-		for(psys=ob->particlesystem.first; psys; psys=psys->next) {
-			if(psys->part->type == PART_FLUID) {
+		for (psys = ob->particlesystem.first; psys; psys = psys->next) {
+			if (psys->part->type == PART_FLUID) {
 				/* clear modifier */
-				psmd= psys_get_modifier(ob, psys);
+				psmd = psys_get_modifier(ob, psys);
 				BLI_remlink(&ob->modifiers, psmd);
 				modifier_free((ModifierData *)psmd);
 
@@ -173,10 +173,10 @@ static void rna_DomainFluidSettings_memory_estimate_get(PointerRNA *ptr, char *v
 {
 #ifndef WITH_MOD_FLUID
 	(void)ptr;
-	value[0]= '\0';
+	value[0] = '\0';
 #else
-	Object *ob= (Object*)ptr->id.data;
-	FluidsimSettings *fss= (FluidsimSettings*)ptr->data;
+	Object *ob = (Object*)ptr->id.data;
+	FluidsimSettings *fss = (FluidsimSettings*)ptr->data;
 
 	fluid_estimate_memory(ob, fss, value);
 #endif
@@ -194,7 +194,7 @@ static int rna_DomainFluidSettings_memory_estimate_length(PointerRNA *UNUSED(ptr
 static char *rna_FluidSettings_path(PointerRNA *ptr)
 {
 	FluidsimSettings *fss = (FluidsimSettings*)ptr->data;
-	ModifierData *md= (ModifierData *)fss->fmd;
+	ModifierData *md = (ModifierData *)fss->fmd;
 
 	return BLI_sprintfN("modifiers[\"%s\"].settings", md->name);
 }
@@ -218,21 +218,26 @@ static void rna_def_fluidsim_slip(StructRNA *srna)
 	PropertyRNA *prop;
 
 	static EnumPropertyItem slip_items[] = {
-		{OB_FSBND_NOSLIP, "NOSLIP", 0, "No Slip", "Obstacle causes zero normal and tangential velocity (=sticky), default for all (only option for moving objects)"},
-		{OB_FSBND_PARTSLIP, "PARTIALSLIP", 0, "Partial Slip", "Mix between no-slip and free-slip (non moving objects only!)"},
-		{OB_FSBND_FREESLIP, "FREESLIP", 0, "Free Slip", "Obstacle only causes zero normal velocity (=not sticky, non moving objects only!)"},
+		{OB_FSBND_NOSLIP, "NOSLIP", 0, "No Slip",
+		                  "Obstacle causes zero normal and tangential velocity (=sticky), default for all "
+		                  "(only option for moving objects)"},
+		{OB_FSBND_PARTSLIP, "PARTIALSLIP", 0, "Partial Slip",
+		                    "Mix between no-slip and free-slip (non moving objects only!)"},
+		{OB_FSBND_FREESLIP, "FREESLIP", 0, "Free Slip",
+		                    "Obstacle only causes zero normal velocity (=not sticky, non moving objects only!)"},
 		{0, NULL, 0, NULL, NULL}};
 
-	prop= RNA_def_property(srna, "slip_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "slip_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "typeFlags");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_items(prop, slip_items);
 	RNA_def_property_ui_text(prop, "Slip Type", "");
 
-	prop= RNA_def_property(srna, "partial_slip_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "partial_slip_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "partSlipValue");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
-	RNA_def_property_ui_text(prop, "Partial Slip Amount", "Amount of mixing between no- and free-slip, 0 is no slip and 1 is free slip");
+	RNA_def_property_ui_text(prop, "Partial Slip Amount",
+	                         "Amount of mixing between no- and free-slip, 0 is no slip and 1 is free slip");
 }
 
 static void rna_def_fluid_mesh_vertices(BlenderRNA *brna)
@@ -240,12 +245,12 @@ static void rna_def_fluid_mesh_vertices(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "FluidMeshVertex", NULL);
+	srna = RNA_def_struct(brna, "FluidMeshVertex", NULL);
 	RNA_def_struct_sdna(srna, "FluidVertexVelocity");
 	RNA_def_struct_ui_text(srna, "Fluid Mesh Vertex", "Vertex of a simulated fluid mesh");
 	RNA_def_struct_ui_icon(srna, ICON_VERTEXSEL);
 
-	prop= RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
+	prop = RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_float_sdna(prop, NULL, "vel");
 	RNA_def_property_ui_text(prop, "Velocity", "");
@@ -264,165 +269,172 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna)
 		{OB_FSDOM_FINAL, "FINAL", 0, "Final", "Display final quality results"},
 		{0, NULL, 0, NULL, NULL}};
 
-	static EnumPropertyItem viscosity_items[] = {
-		{1, "MANUAL", 0, "Manual", "Manual viscosity settings"},
-		{2, "WATER", 0, "Water", "Viscosity of 1.0 * 10^-6"},
-		{3, "OIL", 0, "Oil", "Viscosity of 5.0 * 10^-5"},
-		{4, "HONEY", 0, "Honey", "Viscosity of 2.0 * 10^-3"},
-		{0, NULL, 0, NULL, NULL}};
-
-	srna= RNA_def_struct(brna, "DomainFluidSettings", "FluidSettings");
+	srna = RNA_def_struct(brna, "DomainFluidSettings", "FluidSettings");
 	RNA_def_struct_sdna(srna, "FluidsimSettings");
-	RNA_def_struct_ui_text(srna, "Domain Fluid Simulation Settings", "Fluid simulation settings for the domain of a fluid simulation");
+	RNA_def_struct_ui_text(srna, "Domain Fluid Simulation Settings",
+	                       "Fluid simulation settings for the domain of a fluid simulation");
 
 	/* standard settings */
 
-	prop= RNA_def_property(srna, "resolution", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "resolution", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "resolutionxyz");
 	RNA_def_property_range(prop, 1, 1024);
 	RNA_def_property_ui_text(prop, "Resolution", "Domain resolution in X,Y and Z direction");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 
-	prop= RNA_def_property(srna, "preview_resolution", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "preview_resolution", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "previewresxyz");
 	RNA_def_property_range(prop, 1, 100);
 	RNA_def_property_ui_text(prop, "Preview Resolution", "Preview resolution in X,Y and Z direction");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 
-	prop= RNA_def_property(srna, "viewport_display_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "viewport_display_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "guiDisplayMode");
 	RNA_def_property_enum_items(prop, quality_items);
 	RNA_def_property_ui_text(prop, "Viewport Display Mode", "How to display the mesh in the viewport");
 	RNA_def_property_update(prop, 0, "rna_fluid_update");
 
-	prop= RNA_def_property(srna, "render_display_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "render_display_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "renderDisplayMode");
 	RNA_def_property_enum_items(prop, quality_items);
 	RNA_def_property_ui_text(prop, "Render Display Mode", "How to display the mesh for rendering");
 
-	prop= RNA_def_property(srna, "use_reverse_frames", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_reverse_frames", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_FLUIDSIM_REVERSE);
 	RNA_def_property_ui_text(prop, "Reverse Frames", "Reverse fluid frames");
 	RNA_def_property_update(prop, 0, "rna_fluid_find_enframe");
 
-	prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+	prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
 	RNA_def_property_string_maxlength(prop, FILE_MAX);
 	RNA_def_property_string_sdna(prop, NULL, "surfdataPath");
-	RNA_def_property_ui_text(prop, "Path", "Directory (and/or filename prefix) to store baked fluid simulation files in");
+	RNA_def_property_ui_text(prop, "Path",
+	                         "Directory (and/or filename prefix) to store baked fluid simulation files in");
 	RNA_def_property_update(prop, 0, "rna_fluid_update");
 
-	prop= RNA_def_property(srna, "memory_estimate", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "memory_estimate", PROP_STRING, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_string_funcs(prop, "rna_DomainFluidSettings_memory_estimate_get", "rna_DomainFluidSettings_memory_estimate_length", NULL);
+	RNA_def_property_string_funcs(prop, "rna_DomainFluidSettings_memory_estimate_get",
+	                              "rna_DomainFluidSettings_memory_estimate_length", NULL);
 	RNA_def_property_ui_text(prop, "Memory Estimate", "Estimated amount of memory needed for baking the domain");
 
 	/* advanced settings */
-	prop= RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
+	prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
 	RNA_def_property_float_sdna(prop, NULL, "grav");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_range(prop, -1000.1, 1000.1);
 	RNA_def_property_ui_text(prop, "Gravity", "Gravity in X, Y and Z direction");
 	
-	prop= RNA_def_property(srna, "use_time_override", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_time_override", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_FLUIDSIM_OVERRIDE_TIME);
-	RNA_def_property_ui_text(prop, "Override Time", "Use a custom start and end time (in seconds) instead of the scene's timeline");
+	RNA_def_property_ui_text(prop, "Override Time",
+	                         "Use a custom start and end time (in seconds) instead of the scene's timeline");
 	
-	prop= RNA_def_property(srna, "start_time", PROP_FLOAT, PROP_TIME);
+	prop = RNA_def_property(srna, "start_time", PROP_FLOAT, PROP_TIME);
 	RNA_def_property_float_sdna(prop, NULL, "animStart");
 	RNA_def_property_range(prop, 0, 100);
 	RNA_def_property_ui_text(prop, "Start Time", "Simulation time of the first blender frame (in seconds)");
 	
-	prop= RNA_def_property(srna, "end_time", PROP_FLOAT, PROP_TIME);
+	prop = RNA_def_property(srna, "end_time", PROP_FLOAT, PROP_TIME);
 	RNA_def_property_float_sdna(prop, NULL, "animEnd");
 	RNA_def_property_range(prop, 0, 100);
 	RNA_def_property_ui_text(prop, "End Time", "Simulation time of the last blender frame (in seconds)");
 	
-	prop= RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "frameOffset");
 	RNA_def_property_ui_text(prop, "Cache Offset", "Offset when reading baked cache");
 	RNA_def_property_update(prop, NC_OBJECT, "rna_fluid_update");
 	
-	prop= RNA_def_property(srna, "simulation_scale", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "simulation_scale", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "realsize");
 	RNA_def_property_range(prop, 0.001, 10);
 	RNA_def_property_ui_text(prop, "Real World Size", "Size of the simulation domain in metres");
 	
-	prop= RNA_def_property(srna, "simulation_rate", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "simulation_rate", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "animRate");
 	RNA_def_property_range(prop, 0.0, 100.0);
 	RNA_def_property_ui_text(prop, "Simulation Speed", "Fluid motion rate (0 = stationary, 1 = normal speed)");
-	
-	prop= RNA_def_property(srna, "viscosity_preset", PROP_ENUM, PROP_NONE);
-	RNA_def_property_enum_sdna(prop, NULL, "viscosityMode");
-	RNA_def_property_enum_items(prop, viscosity_items);
-	RNA_def_property_ui_text(prop, "Viscosity Preset", "Set viscosity of the fluid to a preset value, or use manual input");
 
-	prop= RNA_def_property(srna, "viscosity_base", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "viscosity_base", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "viscosityValue");
 	RNA_def_property_range(prop, 0, 10);
-	RNA_def_property_ui_text(prop, "Viscosity Base", "Viscosity setting: value that is multiplied by 10 to the power of (exponent*-1)");
+	RNA_def_property_ui_text(prop, "Viscosity Base",
+	                         "Viscosity setting: value that is multiplied by 10 to the power of (exponent*-1)");
 
-	prop= RNA_def_property(srna, "viscosity_exponent", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "viscosity_exponent", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "viscosityExponent");
 	RNA_def_property_range(prop, 0, 10);
-	RNA_def_property_ui_text(prop, "Viscosity Exponent", "Negative exponent for the viscosity value (to simplify entering small values e.g. 5*10^-6)");
+	RNA_def_property_ui_text(prop, "Viscosity Exponent",
+	                         "Negative exponent for the viscosity value (to simplify entering small values "
+	                         "e.g. 5*10^-6)");
 
-	prop= RNA_def_property(srna, "grid_levels", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "grid_levels", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "maxRefine");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, -1, 4);
 	RNA_def_property_ui_text(prop, "Grid Levels", "Number of coarsened grids to use (-1 for automatic)");
 
-	prop= RNA_def_property(srna, "compressibility", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "compressibility", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "gstar");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0.001, 0.1);
-	RNA_def_property_ui_text(prop, "Compressibility", "Allowed compressibility due to gravitational force for standing fluid (directly affects simulation step size)");
+	RNA_def_property_ui_text(prop, "Compressibility",
+	                         "Allowed compressibility due to gravitational force for standing fluid "
+	                         "(directly affects simulation step size)");
 
 	/* domain boundary settings */
 
 	rna_def_fluidsim_slip(srna);
 
-	prop= RNA_def_property(srna, "surface_smooth", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "surface_smooth", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "surfaceSmoothing");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0.0, 5.0);
-	RNA_def_property_ui_text(prop, "Surface Smoothing", "Amount of surface smoothing (a value of 0 is off, 1 is normal smoothing and more than 1 is extra smoothing)");
+	RNA_def_property_ui_text(prop, "Surface Smoothing",
+	                         "Amount of surface smoothing (a value of 0 is off, 1 is normal smoothing and "
+	                         "more than 1 is extra smoothing)");
 
-	prop= RNA_def_property(srna, "surface_subdivisions", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "surface_subdivisions", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "surfaceSubdivs");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0, 5);
-	RNA_def_property_ui_text(prop, "Surface Subdivisions", "Number of isosurface subdivisions (this is necessary for the inclusion of particles into the surface generation - WARNING: can lead to longer computation times !)");
+	RNA_def_property_ui_text(prop, "Surface Subdivisions",
+	                         "Number of isosurface subdivisions (this is necessary for the inclusion of particles "
+	                         "into the surface generation - WARNING: can lead to longer computation times !)");
 
-	prop= RNA_def_property(srna, "use_speed_vectors", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_speed_vectors", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "domainNovecgen", 0);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Generate Speed Vectors", "Generate speed vectors for vector blur");
 
 	/* no collision object surface */
-	prop= RNA_def_property(srna, "surface_noobs", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "surface_noobs", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "typeFlags", OB_FSSG_NOOBS);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-	RNA_def_property_ui_text(prop, "Hide fluid surface", "");
+	RNA_def_property_ui_text(prop, "Remove air bubbles",
+	                         "Removes the air gap between fluid surface and obstacles - WARNING: Can result "
+	                         "in a dissolving surface in other areas");
 
 	/* particles */
 
-	prop= RNA_def_property(srna, "tracer_particles", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "tracer_particles", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "generateTracers");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0, 10000);
 	RNA_def_property_ui_text(prop, "Tracer Particles", "Number of tracer particles to generate");
 
-	prop= RNA_def_property(srna, "generate_particles", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "generate_particles", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "generateParticles");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0.0, 10.0);
 	RNA_def_property_ui_text(prop, "Generate Particles", "Amount of particles to generate (0=off, 1=normal, >1=more)");
 	
 	/* simulated fluid mesh data */
-	prop= RNA_def_property(srna, "fluid_mesh_vertices", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "fluid_mesh_vertices", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "FluidMeshVertex");
 	RNA_def_property_ui_text(prop, "Fluid Mesh Vertices", "Vertices of the fluid mesh generated by simulation");
-	RNA_def_property_collection_funcs(prop, "rna_FluidMeshVertex_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_FluidMeshVertex_data_length", NULL, NULL, NULL);
+	RNA_def_property_collection_funcs(prop, "rna_FluidMeshVertex_data_begin", "rna_iterator_array_next",
+	                                  "rna_iterator_array_end", "rna_iterator_array_get",
+	                                  "rna_FluidMeshVertex_data_length", NULL, NULL, NULL);
 	rna_def_fluid_mesh_vertices(brna);
 }
 
@@ -436,23 +448,25 @@ static void rna_def_fluidsim_volume(StructRNA *srna)
 		{3, "BOTH", 0, "Both", "Use both the inner volume and the outer shell of the mesh"},
 		{0, NULL, 0, NULL, NULL}};
 
-	prop= RNA_def_property(srna, "volume_initialization", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "volume_initialization", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "volumeInitType");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_items(prop, volume_type_items);
 	RNA_def_property_ui_text(prop, "Volume Initialization", "Volume initialization type");
 
-	prop= RNA_def_property(srna, "use_animated_mesh", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_animated_mesh", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "domainNovecgen", 0);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-	RNA_def_property_ui_text(prop, "Export Animated Mesh", "Export this mesh as an animated one (slower, only use if really necessary [e.g. armatures or parented objects], animated pos/rot/scale F-Curves do not require it)");
+	RNA_def_property_ui_text(prop, "Export Animated Mesh",
+	                         "Export this mesh as an animated one (slower, only use if really necessary [e.g. "
+	                         "armatures or parented objects], animated pos/rot/scale F-Curves do not require it)");
 }
 
 static void rna_def_fluidsim_active(StructRNA *srna)
 {
 	PropertyRNA *prop;
 	
-	prop= RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_FLUIDSIM_ACTIVE);
 	RNA_def_property_ui_text(prop, "Enabled", "Object contributes to the fluid simulation");
 }
@@ -462,14 +476,15 @@ static void rna_def_fluidsim_fluid(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "FluidFluidSettings", "FluidSettings");
+	srna = RNA_def_struct(brna, "FluidFluidSettings", "FluidSettings");
 	RNA_def_struct_sdna(srna, "FluidsimSettings");
-	RNA_def_struct_ui_text(srna, "Fluid Fluid Simulation Settings", "Fluid simulation settings for the fluid in the simulation");
+	RNA_def_struct_ui_text(srna, "Fluid Fluid Simulation Settings",
+	                       "Fluid simulation settings for the fluid in the simulation");
 
 	rna_def_fluidsim_active(srna);
 	rna_def_fluidsim_volume(srna);
 	
-	prop= RNA_def_property(srna, "initial_velocity", PROP_FLOAT, PROP_VELOCITY);
+	prop = RNA_def_property(srna, "initial_velocity", PROP_FLOAT, PROP_VELOCITY);
 	RNA_def_property_float_sdna(prop, NULL, "iniVelx");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_range(prop, -1000.1, 1000.1);
@@ -481,19 +496,23 @@ static void rna_def_fluidsim_obstacle(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "ObstacleFluidSettings", "FluidSettings");
+	srna = RNA_def_struct(brna, "ObstacleFluidSettings", "FluidSettings");
 	RNA_def_struct_sdna(srna, "FluidsimSettings");
-	RNA_def_struct_ui_text(srna, "Obstacle Fluid Simulation Settings", "Fluid simulation settings for obstacles in the simulation");
+	RNA_def_struct_ui_text(srna, "Obstacle Fluid Simulation Settings",
+	                       "Fluid simulation settings for obstacles in the simulation");
 
 	rna_def_fluidsim_active(srna);
 	rna_def_fluidsim_volume(srna);
 	rna_def_fluidsim_slip(srna);
 
-	prop= RNA_def_property(srna, "impact_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "impact_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "surfaceSmoothing");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, -2.0, 10.0);
-	RNA_def_property_ui_text(prop, "Impact Factor", "This is an unphysical value for moving objects - it controls the impact an obstacle has on the fluid, =0 behaves a bit like outflow (deleting fluid), =1 is default, while >1 results in high forces (can be used to tweak total mass)");
+	RNA_def_property_ui_text(prop, "Impact Factor",
+	                         "This is an unphysical value for moving objects - it controls the impact an obstacle "
+	                         "has on the fluid, =0 behaves a bit like outflow (deleting fluid), =1 is default, "
+	                         "while >1 results in high forces (can be used to tweak total mass)");
 }
 
 static void rna_def_fluidsim_inflow(BlenderRNA *brna)
@@ -501,32 +520,35 @@ static void rna_def_fluidsim_inflow(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "InflowFluidSettings", "FluidSettings");
+	srna = RNA_def_struct(brna, "InflowFluidSettings", "FluidSettings");
 	RNA_def_struct_sdna(srna, "FluidsimSettings");
-	RNA_def_struct_ui_text(srna, "Inflow Fluid Simulation Settings", "Fluid simulation settings for objects adding fluids in the simulation");
+	RNA_def_struct_ui_text(srna, "Inflow Fluid Simulation Settings",
+	                       "Fluid simulation settings for objects adding fluids in the simulation");
 
 	rna_def_fluidsim_active(srna);
 	rna_def_fluidsim_volume(srna);
 
-	prop= RNA_def_property(srna, "inflow_velocity", PROP_FLOAT, PROP_VELOCITY);
+	prop = RNA_def_property(srna, "inflow_velocity", PROP_FLOAT, PROP_VELOCITY);
 	RNA_def_property_float_sdna(prop, NULL, "iniVelx");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_range(prop, -1000.1, 1000.1);
 	RNA_def_property_ui_text(prop, "Inflow Velocity", "Initial velocity of fluid");
 
-	prop= RNA_def_property(srna, "use_local_coords", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_local_coords", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_boolean_sdna(prop, NULL, "typeFlags", OB_FSINFLOW_LOCALCOORD);
-	RNA_def_property_ui_text(prop, "Local Coordinates", "Use local coordinates for inflow (e.g. for rotating objects)");
+	RNA_def_property_ui_text(prop, "Local Coordinates",
+	                         "Use local coordinates for inflow (e.g. for rotating objects)");
 }
 
 static void rna_def_fluidsim_outflow(BlenderRNA *brna)
 {
 	StructRNA *srna;
 
-	srna= RNA_def_struct(brna, "OutflowFluidSettings", "FluidSettings");
+	srna = RNA_def_struct(brna, "OutflowFluidSettings", "FluidSettings");
 	RNA_def_struct_sdna(srna, "FluidsimSettings");
-	RNA_def_struct_ui_text(srna, "Outflow Fluid Simulation Settings", "Fluid simulation settings for objects removing fluids from the simulation");
+	RNA_def_struct_ui_text(srna, "Outflow Fluid Simulation Settings",
+	                       "Fluid simulation settings for objects removing fluids from the simulation");
 
 	rna_def_fluidsim_active(srna);
 	rna_def_fluidsim_volume(srna);
@@ -537,33 +559,39 @@ static void rna_def_fluidsim_particle(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "ParticleFluidSettings", "FluidSettings");
+	srna = RNA_def_struct(brna, "ParticleFluidSettings", "FluidSettings");
 	RNA_def_struct_sdna(srna, "FluidsimSettings");
-	RNA_def_struct_ui_text(srna, "Particle Fluid Simulation Settings", "Fluid simulation settings for objects storing fluid particles generated by the simulation");
+	RNA_def_struct_ui_text(srna, "Particle Fluid Simulation Settings",
+	                       "Fluid simulation settings for objects storing fluid particles generated"
+	                       " by the simulation");
 
-	prop= RNA_def_property(srna, "use_drops", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_drops", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "typeFlags", OB_FSPART_DROP);
 	RNA_def_property_ui_text(prop, "Drops", "Show drop particles");
 
-	prop= RNA_def_property(srna, "use_floats", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_floats", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "typeFlags", OB_FSPART_FLOAT);
 	RNA_def_property_ui_text(prop, "Floats", "Show floating foam particles");
 
-	prop= RNA_def_property(srna, "show_tracer", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_tracer", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "typeFlags", OB_FSPART_TRACER);
 	RNA_def_property_ui_text(prop, "Tracer", "Show tracer particles");
 
-	prop= RNA_def_property(srna, "particle_influence", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "particle_influence", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "particleInfSize");
 	RNA_def_property_range(prop, 0.0, 2.0);
-	RNA_def_property_ui_text(prop, "Particle Influence", "Amount of particle size scaling: 0=off (all same size), 1=full (range 0.2-2.0), >1=stronger");
+	RNA_def_property_ui_text(prop, "Particle Influence",
+	                         "Amount of particle size scaling: 0=off (all same size), 1=full (range 0.2-2.0), "
+	                         ">1=stronger");
 
-	prop= RNA_def_property(srna, "alpha_influence", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "alpha_influence", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "particleInfAlpha");
 	RNA_def_property_range(prop, 0.0, 2.0);
-	RNA_def_property_ui_text(prop, "Alpha Influence", "Amount of particle alpha change, inverse of size influence: 0=off (all same alpha), 1=full (large particles get lower alphas, smaller ones higher values)");
+	RNA_def_property_ui_text(prop, "Alpha Influence",
+	                         "Amount of particle alpha change, inverse of size influence: 0=off (all same alpha), "
+	                         "1=full (larger particles get lower alphas, smaller ones higher values)");
 
-	prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+	prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
 	RNA_def_property_string_maxlength(prop, FILE_MAX);
 	RNA_def_property_string_sdna(prop, NULL, "surfdataPath");
 	RNA_def_property_ui_text(prop, "Path", "Directory (and/or filename prefix) to store and load particles from");
@@ -575,49 +603,54 @@ static void rna_def_fluidsim_control(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "ControlFluidSettings", "FluidSettings");
+	srna = RNA_def_struct(brna, "ControlFluidSettings", "FluidSettings");
 	RNA_def_struct_sdna(srna, "FluidsimSettings");
-	RNA_def_struct_ui_text(srna, "Control Fluid Simulation Settings", "Fluid simulation settings for objects controlling the motion of fluid in the simulation");
+	RNA_def_struct_ui_text(srna, "Control Fluid Simulation Settings",
+	                       "Fluid simulation settings for objects controlling the motion of fluid in the simulation");
 
 	rna_def_fluidsim_active(srna);
 	
-	prop= RNA_def_property(srna, "start_time", PROP_FLOAT, PROP_TIME);
+	prop = RNA_def_property(srna, "start_time", PROP_FLOAT, PROP_TIME);
 	RNA_def_property_float_sdna(prop, NULL, "cpsTimeStart");
 	RNA_def_property_range(prop, 0.0, 100.0);
 	RNA_def_property_ui_text(prop, "Start Time", "Time when the control particles are activated");
 	
-	prop= RNA_def_property(srna, "end_time", PROP_FLOAT, PROP_TIME);
+	prop = RNA_def_property(srna, "end_time", PROP_FLOAT, PROP_TIME);
 	RNA_def_property_float_sdna(prop, NULL, "cpsTimeEnd");
 	RNA_def_property_range(prop, 0.0, 100.0);
 	RNA_def_property_ui_text(prop, "End Time", "Time when the control particles are deactivated");
 
-	prop= RNA_def_property(srna, "attraction_strength", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "attraction_strength", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "attractforceStrength");
 	RNA_def_property_range(prop, -10.0, 10.0);
-	RNA_def_property_ui_text(prop, "Attraction Strength", "Force strength for directional attraction towards the control object");
+	RNA_def_property_ui_text(prop, "Attraction Strength",
+	                         "Force strength for directional attraction towards the control object");
 
-	prop= RNA_def_property(srna, "attraction_radius", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "attraction_radius", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "attractforceRadius");
 	RNA_def_property_range(prop, 0.0, 10.0);
 	RNA_def_property_ui_text(prop, "Attraction Radius", "Force field radius around the control object");
 	
-	prop= RNA_def_property(srna, "velocity_strength", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "velocity_strength", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "velocityforceStrength");
 	RNA_def_property_range(prop, 0.0, 10.0);
-	RNA_def_property_ui_text(prop, "Velocity Strength", "Force strength of how much of the control object's velocity is influencing the fluid velocity");
+	RNA_def_property_ui_text(prop, "Velocity Strength",
+	                         "Force strength of how much of the control object's velocity is influencing the "
+	                         "fluid velocity");
 
-	prop= RNA_def_property(srna, "velocity_radius", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "velocity_radius", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "velocityforceRadius");
 	RNA_def_property_range(prop, 0.0, 10.0);
 	RNA_def_property_ui_text(prop, "Velocity Radius", "Force field radius around the control object");
 
-	prop= RNA_def_property(srna, "quality", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "quality", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "cpsQuality");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 5.0, 100.0);
-	RNA_def_property_ui_text(prop, "Quality", "Quality which is used for object sampling (higher = better but slower)");
+	RNA_def_property_ui_text(prop, "Quality",
+	                         "Quality which is used for object sampling (higher = better but slower)");
 
-	prop= RNA_def_property(srna, "use_reverse_frames", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_reverse_frames", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_FLUIDSIM_REVERSE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Reverse Frames", "Reverse control object movement");
@@ -631,31 +664,37 @@ void RNA_def_fluidsim(BlenderRNA *brna)
 
 	static EnumPropertyItem prop_fluid_type_items[] = {
 		{OB_FLUIDSIM_ENABLE, "NONE", 0, "None", ""},
-		{OB_FLUIDSIM_DOMAIN, "DOMAIN", 0, "Domain", "Bounding box of this object represents the computational domain of the fluid simulation"},
+		{OB_FLUIDSIM_DOMAIN, "DOMAIN", 0, "Domain",
+		                     "Bounding box of this object represents the computational domain of the "
+		                     "fluid simulation"},
 		{OB_FLUIDSIM_FLUID, "FLUID", 0, "Fluid", "Object represents a volume of fluid in the simulation"},
 		{OB_FLUIDSIM_OBSTACLE, "OBSTACLE", 0, "Obstacle", "Object is a fixed obstacle"},
 		{OB_FLUIDSIM_INFLOW, "INFLOW", 0, "Inflow", "Object adds fluid to the simulation"},
 		{OB_FLUIDSIM_OUTFLOW, "OUTFLOW", 0, "Outflow", "Object removes fluid from the simulation"},
-		{OB_FLUIDSIM_PARTICLE, "PARTICLE", 0, "Particle", "Object is made a particle system to display particles generated by a fluidsim domain object"},
-		{OB_FLUIDSIM_CONTROL, "CONTROL", 0, "Control", "Object is made a fluid control mesh, which influences the fluid"},
+		{OB_FLUIDSIM_PARTICLE, "PARTICLE", 0, "Particle",
+		                       "Object is made a particle system to display particles generated by a "
+		                       "fluidsim domain object"},
+		{OB_FLUIDSIM_CONTROL, "CONTROL", 0, "Control",
+		                      "Object is made a fluid control mesh, which influences the fluid"},
 		{0, NULL, 0, NULL, NULL}};
 
 
-	srna= RNA_def_struct(brna, "FluidSettings", NULL);
+	srna = RNA_def_struct(brna, "FluidSettings", NULL);
 	RNA_def_struct_sdna(srna, "FluidsimSettings");
 	RNA_def_struct_refine_func(srna, "rna_FluidSettings_refine");
 	RNA_def_struct_path_func(srna, "rna_FluidSettings_path");
-	RNA_def_struct_ui_text(srna, "Fluid Simulation Settings", "Fluid simulation settings for an object taking part in the simulation");
+	RNA_def_struct_ui_text(srna, "Fluid Simulation Settings",
+	                       "Fluid simulation settings for an object taking part in the simulation");
 
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, prop_fluid_type_items);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	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);
-	//RNA_def_property_ui_text(prop, "IPO Curves", "IPO curves used by fluid simulation settings");
+	/*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 eacd814..53ef1bd 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -42,7 +42,7 @@
 
 static int rna_GPencilLayer_active_frame_editable(PointerRNA *ptr)
 {
-	bGPDlayer *gpl= (bGPDlayer *)ptr->data;
+	bGPDlayer *gpl = (bGPDlayer *)ptr->data;
 
 	/* surely there must be other criteria too... */
 	if (gpl->flag & GP_LAYER_LOCKED)
@@ -53,18 +53,18 @@ static int rna_GPencilLayer_active_frame_editable(PointerRNA *ptr)
 
 static PointerRNA rna_GPencil_active_layer_get(PointerRNA *ptr)
 {
-	bGPdata *gpd= ptr->id.data;
+	bGPdata *gpd = ptr->id.data;
 
 	if (GS(gpd->id.name) == ID_GD) { /* why would this ever be not GD */
 		bGPDlayer *gl;
 
-		for (gl= gpd->layers.first; gl; gl= gl->next) {
-			if(gl->flag & GP_LAYER_ACTIVE) {
+		for (gl = gpd->layers.first; gl; gl = gl->next) {
+			if (gl->flag & GP_LAYER_ACTIVE) {
 				break;
 			}
 		}
 
-		if(gl) {
+		if (gl) {
 			return rna_pointer_inherit_refine(ptr, &RNA_GPencilLayer, gl);
 		}
 	}
@@ -74,13 +74,13 @@ static PointerRNA rna_GPencil_active_layer_get(PointerRNA *ptr)
 
 static void rna_GPencil_active_layer_set(PointerRNA *ptr, PointerRNA value)
 {
-	bGPdata *gpd= ptr->id.data;
+	bGPdata *gpd = ptr->id.data;
 
 	if (GS(gpd->id.name) == ID_GD) { /* why would this ever be not GD */
 		bGPDlayer *gl;
 
-		for (gl= gpd->layers.first; gl; gl= gl->next) {
-			if(gl == value.data) {
+		for (gl = gpd->layers.first; gl; gl = gl->next) {
+			if (gl == value.data) {
 				gl->flag |= GP_LAYER_ACTIVE;
 			}
 			else {
@@ -92,8 +92,8 @@ static void rna_GPencil_active_layer_set(PointerRNA *ptr, PointerRNA value)
 
 void rna_GPencilLayer_info_set(PointerRNA *ptr, const char *value)
 {
-	bGPdata *gpd= ptr->id.data;
-	bGPDlayer *gpl= ptr->data;
+	bGPdata *gpd = ptr->id.data;
+	bGPDlayer *gpl = ptr->data;
 
 	/* copy the new name into the name slot */
 	BLI_strncpy_utf8(gpl->info, value, sizeof(gpl->info));
@@ -108,17 +108,17 @@ static void rna_def_gpencil_stroke_point(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "GPencilStrokePoint", NULL);
+	srna = RNA_def_struct(brna, "GPencilStrokePoint", NULL);
 	RNA_def_struct_sdna(srna, "bGPDspoint");
 	RNA_def_struct_ui_text(srna, "Grease Pencil Stroke Point", "Data point for freehand stroke curve");
 	
-	prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "x");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Coordinates", "");
 	RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL);
 	
-	prop= RNA_def_property(srna, "pressure", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "pressure", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "pressure");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Pressure", "Pressure of tablet at point when drawing it");
@@ -130,18 +130,18 @@ static void rna_def_gpencil_stroke(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "GPencilStroke", NULL);
+	srna = RNA_def_struct(brna, "GPencilStroke", NULL);
 	RNA_def_struct_sdna(srna, "bGPDstroke");
 	RNA_def_struct_ui_text(srna, "Grease Pencil Stroke", "Freehand curve defining part of a sketch");
 	
 	/* Points */
-	prop= RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
 	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");
 	
 	/* Flags - Readonly type-info really... */
-	// TODO...
+	/* TODO... */
 }
 
 static void rna_def_gpencil_frame(BlenderRNA *brna)
@@ -149,28 +149,28 @@ static void rna_def_gpencil_frame(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "GPencilFrame", NULL);
+	srna = RNA_def_struct(brna, "GPencilFrame", NULL);
 	RNA_def_struct_sdna(srna, "bGPDframe");
 	RNA_def_struct_ui_text(srna, "Grease Pencil Frame", "Collection of related sketches on a particular frame");
 	
 	/* Strokes */
-	prop= RNA_def_property(srna, "strokes", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "strokes", PROP_COLLECTION, PROP_NONE);
 	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");
 	
 	/* Frame Number */
-	prop= RNA_def_property(srna, "frame_number", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_number", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "framenum");
-	RNA_def_property_range(prop, MINFRAME, MAXFRAME); // XXX note: this cannot occur on the same frame as another sketch
+	RNA_def_property_range(prop, MINFRAME, MAXFRAME); /* XXX note: this cannot occur on the same frame as another sketch */
 	RNA_def_property_ui_text(prop, "Frame Number", "The frame on which this sketch appears");
 	
 	/* Flags */
-	prop= RNA_def_property(srna, "is_edited", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_FRAME_PAINT); // XXX should it be editable?
+	prop = RNA_def_property(srna, "is_edited", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_FRAME_PAINT); /* XXX should it be editable? */
 	RNA_def_property_ui_text(prop, "Paint Lock", "Frame is being edited (painted on)");
 	
-	prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_FRAME_SELECT);
 	RNA_def_property_ui_text(prop, "Select", "Frame is selected for editing in the DopeSheet");
 }
@@ -180,100 +180,102 @@ static void rna_def_gpencil_layer(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "GPencilLayer", NULL);
+	srna = RNA_def_struct(brna, "GPencilLayer", NULL);
 	RNA_def_struct_sdna(srna, "bGPDlayer");
 	RNA_def_struct_ui_text(srna, "Grease Pencil Layer", "Collection of related sketches");
 	
 	/* Name */
-	prop= RNA_def_property(srna, "info", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "info", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Info", "Layer name");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GPencilLayer_info_set");
 	RNA_def_struct_name_property(srna, prop);
 	
 	/* Frames */
-	prop= RNA_def_property(srna, "frames", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "frames", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "frames", NULL);
 	RNA_def_property_struct_type(prop, "GPencilFrame");
 	RNA_def_property_ui_text(prop, "Frames", "Sketches for this layer on different frames");
 	
 	/* Active Frame */
-	prop= RNA_def_property(srna, "active_frame", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active_frame", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "actframe");
 	RNA_def_property_ui_text(prop, "Active Frame", "Frame currently being displayed for this layer");
 	RNA_def_property_editable_func(prop, "rna_GPencilLayer_active_frame_editable");
 	
 	/* Drawing Color */
-	prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Color", "Color for all strokes in this layer");
 	RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL);
 	
-	prop= RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "color[3]");
 	RNA_def_property_range(prop, 0.3, 1.0f);
 	RNA_def_property_ui_text(prop, "Opacity", "Layer Opacity");
 	RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL);
 	
 	/* Line Thickness */
-	prop= RNA_def_property(srna, "line_width", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "line_width", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "thickness");
 	RNA_def_property_range(prop, 1, 10);
 	RNA_def_property_ui_text(prop, "Thickness", "Thickness of strokes (in pixels)");
 	RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL);
 	
 	/* Onion-Skinning */
-	prop= RNA_def_property(srna, "use_onion_skinning", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_onion_skinning", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_ONIONSKIN);
-	RNA_def_property_ui_text(prop, "Use Onion Skinning", "Ghost frames on either side of frame");
+	RNA_def_property_ui_text(prop, "Onion Skinning", "Ghost frames on either side of frame");
 	RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL);
 	
-	prop= RNA_def_property(srna, "ghost_range_max", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "ghost_range_max", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "gstep");
 	RNA_def_property_range(prop, 0, 120);
-	RNA_def_property_ui_text(prop, "Max Ghost Range", "Maximum number of frames on either side of the active frame to show (0 = show the 'first' available sketch on either side)");
+	RNA_def_property_ui_text(prop, "Max Ghost Range",
+	                         "Maximum number of frames on either side of the active frame to show "
+	                         "(0 = show the 'first' available sketch on either side)");
 	RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL);
 	
 	/* Flags */
-	prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_HIDE);
 	RNA_def_property_ui_text(prop, "Hide", "Set layer Visibility");
 	RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL);
 	
-	prop= RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_LOCKED);
 	RNA_def_property_ui_text(prop, "Locked", "Protect layer from further editing and/or frame changes");
 	RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL);
 	
-	prop= RNA_def_property(srna, "lock_frame", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_frame", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_FRAMELOCK);
 	RNA_def_property_ui_text(prop, "Frame Locked", "Lock current frame displayed by layer");
 	RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL);
 
 	/* expose as layers.active */
-	/*
-	prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
+#if 0
+	prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_ACTIVE);
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_GPencilLayer_active_set");
 	RNA_def_property_ui_text(prop, "Active", "Set active layer for editing");
 	RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL);
-	*/
+#endif
 
-	prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_SELECT);
 	RNA_def_property_ui_text(prop, "Select", "Layer is selected for editing in the DopeSheet");
 	RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL);
 	
-		// XXX keep this option?
-	prop= RNA_def_property(srna, "show_points", PROP_BOOLEAN, PROP_NONE);
+		/* XXX keep this option? */
+	prop = RNA_def_property(srna, "show_points", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_DRAWDEBUG);
 	RNA_def_property_ui_text(prop, "Show Points", "Draw the points which make up the strokes (for debugging purposes)");
 	RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL);
 
 	/* X-Ray */
-	prop= RNA_def_property(srna, "show_x_ray", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_x_ray", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_LAYER_NO_XRAY);
-	RNA_def_property_ui_text(prop, "X Ray", "");
+	RNA_def_property_ui_text(prop, "X Ray", "Make the layer draw in front of objects");
 	RNA_def_property_update(prop, NC_SCREEN|ND_GPENCIL, NULL);
 }
 
@@ -282,30 +284,30 @@ static void rna_def_gpencil_layers(BlenderRNA *brna, PropertyRNA *cprop)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-//	FunctionRNA *func;
-//	PropertyRNA *parm;
+/*	FunctionRNA *func; */
+/*	PropertyRNA *parm; */
 
 	RNA_def_property_srna(cprop, "GreasePencilLayers");
-	srna= RNA_def_struct(brna, "GreasePencilLayers", NULL);
+	srna = RNA_def_struct(brna, "GreasePencilLayers", NULL);
 	RNA_def_struct_sdna(srna, "bGPdata");
 	RNA_def_struct_ui_text(srna, "Grease Pencil Layers", "Collection of grease pencil layers");
 
 #if 0
-	func= RNA_def_function(srna, "new", "rna_GPencil_layer_new");
+	func = RNA_def_function(srna, "new", "rna_GPencil_layer_new");
 	RNA_def_function_ui_description(func, "Add a new spline to the curve");
-	parm= RNA_def_enum(func, "type", curve_type_items, CU_POLY, "", "type for the new spline");
+	parm = RNA_def_enum(func, "type", curve_type_items, CU_POLY, "", "type for the new spline");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_pointer(func, "spline", "Spline", "", "The newly created spline");
+	parm = RNA_def_pointer(func, "spline", "Spline", "", "The newly created spline");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_GPencil_layer_remove");
+	func = RNA_def_function(srna, "remove", "rna_GPencil_layer_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");
+	parm = RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 #endif
 
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "GreasePencil");
 	RNA_def_property_pointer_funcs(prop, "rna_GPencil_active_layer_get", "rna_GPencil_active_layer_set", NULL, NULL);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
@@ -324,25 +326,25 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
 		{GP_DATA_VIEWALIGN|GP_DATA_DEPTH_STROKE, "STROKE", 0, "Stroke", "Stick stroke to other strokes"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "GreasePencil", "ID");
+	srna = RNA_def_struct(brna, "GreasePencil", "ID");
 	RNA_def_struct_sdna(srna, "bGPdata");
 	RNA_def_struct_ui_text(srna, "Grease Pencil", "Freehand annotation sketchbook");
 	RNA_def_struct_ui_icon(srna, ICON_GREASEPENCIL);
 	
 	/* Layers */
-	prop= RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "layers", NULL);
 	RNA_def_property_struct_type(prop, "GPencilLayer");
 	RNA_def_property_ui_text(prop, "Layers", "");
 	rna_def_gpencil_layers(brna, prop);
 	
 	/* Flags */
-	prop= RNA_def_property(srna, "draw_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "draw_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, draw_mode_items);
 	RNA_def_property_ui_text(prop, "Draw Mode", "");
 
-	prop= RNA_def_property(srna, "use_stroke_endpoints", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_stroke_endpoints", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_DEPTH_STROKE_ENDPOINTS);
 	RNA_def_property_ui_text(prop, "Only Endpoints", "Only use the first and last parts of the stroke for snapping");
 
diff --git a/source/blender/makesrna/intern/rna_group.c b/source/blender/makesrna/intern/rna_group.c
index 8fa92e7..773daaa 100644
--- a/source/blender/makesrna/intern/rna_group.c
+++ b/source/blender/makesrna/intern/rna_group.c
@@ -45,7 +45,7 @@
 
 static PointerRNA rna_Group_objects_get(CollectionPropertyIterator *iter)
 {
-	ListBaseIterator *internal= iter->internal;
+	ListBaseIterator *internal = iter->internal;
 
 	/* we are actually iterating a GroupObject list, so override get */
 	return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((GroupObject*)internal->link)->ob);
@@ -53,7 +53,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)) {
+	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);
 		return;
 	}
@@ -63,7 +63,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)) {
+	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);
 		return;
 	}
@@ -77,30 +77,30 @@ static void rna_Group_objects_unlink(Group *group, bContext *C, ReportList *repo
 static void rna_def_group_objects(BlenderRNA *brna, PropertyRNA *cprop)
 {
 	StructRNA *srna;
-//	PropertyRNA *prop;
+/*	PropertyRNA *prop; */
 
 	FunctionRNA *func;
 	PropertyRNA *parm;
 	
 	RNA_def_property_srna(cprop, "GroupObjects");
-	srna= RNA_def_struct(brna, "GroupObjects", NULL);
+	srna = RNA_def_struct(brna, "GroupObjects", NULL);
 	RNA_def_struct_sdna(srna, "Group");
 	RNA_def_struct_ui_text(srna, "Group Objects", "Collection of group objects");
 
 	/* add object */
-	func= RNA_def_function(srna, "link", "rna_Group_objects_link");
+	func = RNA_def_function(srna, "link", "rna_Group_objects_link");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Add this object to a group");
 	/* object to add */
-	parm= RNA_def_pointer(func, "object", "Object", "", "Object to add");
+	parm = RNA_def_pointer(func, "object", "Object", "", "Object to add");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
 	/* remove object */
-	func= RNA_def_function(srna, "unlink", "rna_Group_objects_unlink");
+	func = RNA_def_function(srna, "unlink", "rna_Group_objects_unlink");
 	RNA_def_function_ui_description(func, "Remove this object to a group");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
 	/* object to remove */
-	parm= RNA_def_pointer(func, "object", "Object", "", "Object to remove");
+	parm = RNA_def_pointer(func, "object", "Object", "", "Object to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 }
 
@@ -110,23 +110,24 @@ void RNA_def_group(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "Group", "ID");
+	srna = RNA_def_struct(brna, "Group", "ID");
 	RNA_def_struct_ui_text(srna, "Group", "Group of Object datablocks");
 	RNA_def_struct_ui_icon(srna, ICON_GROUP);
-	RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT); /* this is done on save/load in readfile.c, removed if no objects are in the group */
+		/* this is done on save/load in readfile.c, removed if no objects are in the group */
+	RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
 
-	prop= RNA_def_property(srna, "dupli_offset", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "dupli_offset", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "dupli_ofs");
 	RNA_def_property_ui_text(prop, "Dupli Offset", "Offset from the origin to use when instancing as DupliGroup");
-	RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4);
+	RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, RNA_TRANSLATION_PREC_DEFAULT);
 
-	prop= RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER);
+	prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER);
 	RNA_def_property_boolean_sdna(prop, NULL, "layer", 1);
 	RNA_def_property_array(prop, 20);
 	RNA_def_property_ui_text(prop, "Dupli Layers", "Layers visible when this group is instanced as a dupli");
 
 
-	prop= RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "gobject", NULL);
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_ui_text(prop, "Objects", "A collection of this groups objects");
@@ -137,4 +138,3 @@ void RNA_def_group(BlenderRNA *brna)
 }
 
 #endif
-
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index 7059c00..e593929 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -42,10 +42,10 @@
 #include "WM_types.h"
 #include "WM_api.h"
 
-static EnumPropertyItem image_source_items[]= {
+static EnumPropertyItem image_source_items[] = {
 	{IMA_SRC_FILE, "FILE", 0, "Single Image", "Single image file"},
 	{IMA_SRC_SEQUENCE, "SEQUENCE", 0, "Image Sequence", "Multiple image files, as a sequence"},
-	{IMA_SRC_MOVIE, "MOVIE", 0, "Movie File", "Movie file"},
+	{IMA_SRC_MOVIE, "MOVIE", 0, "Movie", "Movie file"},
 	{IMA_SRC_GENERATED, "GENERATED", 0, "Generated", "Generated image"},
 	{IMA_SRC_VIEWER, "VIEWER", 0, "Viewer", "Compositing node viewer"},
 	{0, NULL, 0, NULL, NULL}};
@@ -56,24 +56,24 @@ static EnumPropertyItem image_source_items[]= {
 
 static void rna_Image_animated_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	Image *ima= (Image*)ptr->data;
+	Image *ima = (Image*)ptr->data;
 	int  nr;
 
-	if(ima->flag & IMA_TWINANIM) {
-		nr= ima->xrep*ima->yrep;
-		if(ima->twsta>=nr) ima->twsta= 1;
-		if(ima->twend>=nr) ima->twend= nr-1;
-		if(ima->twsta>ima->twend) ima->twsta= 1;
+	if (ima->flag & IMA_TWINANIM) {
+		nr = ima->xrep*ima->yrep;
+		if (ima->twsta >= nr) ima->twsta = 1;
+		if (ima->twend >= nr) ima->twend = nr-1;
+		if (ima->twsta>ima->twend) ima->twsta = 1;
 	}
 }
 
 static int rna_Image_dirty_get(PointerRNA *ptr)
 {
-	Image *ima= (Image*)ptr->data;
+	Image *ima = (Image*)ptr->data;
 	ImBuf *ibuf;
 
-	for(ibuf=ima->ibufs.first; ibuf; ibuf=ibuf->next)
-		if(ibuf->userflags & IB_BITMAPDIRTY)
+	for (ibuf = ima->ibufs.first; ibuf; ibuf = ibuf->next)
+		if (ibuf->userflags & IB_BITMAPDIRTY)
 			return 1;
 	
 	return 0;
@@ -81,26 +81,26 @@ static int rna_Image_dirty_get(PointerRNA *ptr)
 
 static void rna_Image_source_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	Image *ima= ptr->id.data;
+	Image *ima = ptr->id.data;
 	BKE_image_signal(ima, NULL, IMA_SIGNAL_SRC_CHANGE);
 	DAG_id_tag_update(&ima->id, 0);
 }
 
 static void rna_Image_fields_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	Image *ima= ptr->id.data;
+	Image *ima = ptr->id.data;
 	ImBuf *ibuf;
 	void *lock;
 
-	ibuf= BKE_image_acquire_ibuf(ima, NULL, &lock);
+	ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
 
-	if(ibuf) {
-		short nr= 0;
+	if (ibuf) {
+		short nr = 0;
 
-		if(!(ima->flag & IMA_FIELDS) && (ibuf->flags & IB_fields)) nr= 1;
-		if((ima->flag & IMA_FIELDS) && !(ibuf->flags & IB_fields)) nr= 1;
+		if (!(ima->flag & IMA_FIELDS) && (ibuf->flags & IB_fields)) nr = 1;
+		if ((ima->flag & IMA_FIELDS) && !(ibuf->flags & IB_fields)) nr = 1;
 
-		if(nr)
+		if (nr)
 			BKE_image_signal(ima, NULL, IMA_SIGNAL_FREE);
 	}
 
@@ -109,7 +109,7 @@ static void rna_Image_fields_update(Main *UNUSED(bmain), Scene *UNUSED(scene), P
 
 static void rna_Image_free_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	Image *ima= ptr->id.data;
+	Image *ima = ptr->id.data;
 	BKE_image_signal(ima, NULL, IMA_SIGNAL_FREE);
 	WM_main_add_notifier(NC_IMAGE|NA_EDITED, &ima->id);
 	DAG_id_tag_update(&ima->id, 0);
@@ -118,7 +118,7 @@ static void rna_Image_free_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Poi
 
 static void rna_Image_reload_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	Image *ima= ptr->id.data;
+	Image *ima = ptr->id.data;
 	BKE_image_signal(ima, NULL, IMA_SIGNAL_RELOAD);
 	WM_main_add_notifier(NC_IMAGE|NA_EDITED, &ima->id);
 	DAG_id_tag_update(&ima->id, 0);
@@ -126,13 +126,13 @@ static void rna_Image_reload_update(Main *UNUSED(bmain), Scene *UNUSED(scene), P
 
 static void rna_Image_generated_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	Image *ima= ptr->id.data;
+	Image *ima = ptr->id.data;
 	BKE_image_signal(ima, NULL, IMA_SIGNAL_FREE);
 }
 
 static void rna_ImageUser_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
 {
-	ImageUser *iuser= ptr->data;
+	ImageUser *iuser = ptr->data;
 
 	BKE_image_user_calc_frame(iuser, scene->r.cfra, 0);
 }
@@ -141,9 +141,9 @@ static void rna_ImageUser_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *
 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)) {
+		switch (GS(((ID *)ptr->id.data)->name)) {
 		case ID_TE:
 			return BLI_strdup("image_user");
 		}
@@ -152,13 +152,14 @@ char *rna_ImageUser_path(PointerRNA *ptr)
 	return BLI_strdup("");
 }
 
-static EnumPropertyItem *rna_Image_source_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
+static EnumPropertyItem *rna_Image_source_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+                                                PropertyRNA *UNUSED(prop), int *free)
 {
-	Image *ima= (Image*)ptr->data;
-	EnumPropertyItem *item= NULL;
-	int totitem= 0;
+	Image *ima = (Image*)ptr->data;
+	EnumPropertyItem *item = NULL;
+	int totitem = 0;
 	
-	if(ima->source == IMA_SRC_VIEWER) {
+	if (ima->source == IMA_SRC_VIEWER) {
 		RNA_enum_items_add_value(&item, &totitem, image_source_items, IMA_SRC_VIEWER);
 	}
 	else {
@@ -169,41 +170,41 @@ static EnumPropertyItem *rna_Image_source_itemf(bContext *UNUSED(C), PointerRNA
 	}
 
 	RNA_enum_item_end(&item, &totitem);
-	*free= 1;
+	*free = 1;
 
 	return item;
 }
 
 static int rna_Image_file_format_get(PointerRNA *ptr)
 {
-	Image *image= (Image*)ptr->data;
-	ImBuf *ibuf= BKE_image_get_ibuf(image, NULL);
+	Image *image = (Image*)ptr->data;
+	ImBuf *ibuf = BKE_image_get_ibuf(image, NULL);
 	return BKE_ftype_to_imtype(ibuf ? ibuf->ftype : 0);
 }
 
 static void rna_Image_file_format_set(PointerRNA *ptr, int value)
 {
-	Image *image= (Image*)ptr->data;
-	if(BKE_imtype_is_movie(value) == 0) { /* should be able to throw an error here */
+	Image *image = (Image*)ptr->data;
+	if (BKE_imtype_is_movie(value) == 0) { /* should be able to throw an error here */
 		ImBuf *ibuf;
-		int ftype= BKE_imtype_to_ftype(value);
+		int ftype = BKE_imtype_to_ftype(value);
 
-		/*
+#if 0
 		ibuf= BKE_image_get_ibuf(image, NULL);
-		if(ibuf)
+		if (ibuf)
 			ibuf->ftype= ftype;
-		*/
+#endif
 
 		/* to be safe change all buffer file types */
-		for(ibuf= image->ibufs.first; ibuf; ibuf= ibuf->next) {
-			ibuf->ftype= ftype;
+		for (ibuf = image->ibufs.first; ibuf; ibuf = ibuf->next) {
+			ibuf->ftype = ftype;
 		}
 	}
 }
 
 static int rna_Image_has_data_get(PointerRNA *ptr)
 {
-	Image *im= (Image*)ptr->data;
+	Image *im = (Image*)ptr->data;
 
 	if (im->ibufs.first)
 		return 1;
@@ -213,18 +214,18 @@ static int rna_Image_has_data_get(PointerRNA *ptr)
 
 static void rna_Image_size_get(PointerRNA *ptr,int *values)
 {
-	Image *im= (Image*)ptr->data;
+	Image *im = (Image*)ptr->data;
 	ImBuf *ibuf;
 	void *lock;
 
 	ibuf = BKE_image_acquire_ibuf(im, NULL , &lock);
 	if (ibuf) {
-		values[0]= ibuf->x;
-		values[1]= ibuf->y;
+		values[0] = ibuf->x;
+		values[1] = ibuf->y;
 	}
 	else {
-		values[0]= 0;
-		values[1]= 0;
+		values[0] = 0;
+		values[1] = 0;
 	}
 
 	BKE_image_release_ibuf(im, lock);
@@ -232,18 +233,18 @@ static void rna_Image_size_get(PointerRNA *ptr,int *values)
 
 static void rna_Image_resolution_get(PointerRNA *ptr, float *values)
 {
-	Image *im= (Image*)ptr->data;
+	Image *im = (Image*)ptr->data;
 	ImBuf *ibuf;
 	void *lock;
 
 	ibuf = BKE_image_acquire_ibuf(im, NULL , &lock);
 	if (ibuf) {
-		values[0]= ibuf->ppm[0];
-		values[1]= ibuf->ppm[1];
+		values[0] = ibuf->ppm[0];
+		values[1] = ibuf->ppm[1];
 	}
 	else {
-		values[0]= 0;
-		values[1]= 0;
+		values[0] = 0;
+		values[1] = 0;
 	}
 
 	BKE_image_release_ibuf(im, lock);
@@ -251,14 +252,14 @@ static void rna_Image_resolution_get(PointerRNA *ptr, float *values)
 
 static void rna_Image_resolution_set(PointerRNA *ptr, const float *values)
 {
-	Image *im= (Image*)ptr->data;
+	Image *im = (Image*)ptr->data;
 	ImBuf *ibuf;
 	void *lock;
 
 	ibuf = BKE_image_acquire_ibuf(im, NULL , &lock);
 	if (ibuf) {
-		ibuf->ppm[0]= values[0];
-		ibuf->ppm[1]= values[1];
+		ibuf->ppm[0] = values[0];
+		ibuf->ppm[1] = values[1];
 	}
 
 	BKE_image_release_ibuf(im, lock);
@@ -266,19 +267,19 @@ static void rna_Image_resolution_set(PointerRNA *ptr, const float *values)
 
 static int rna_Image_depth_get(PointerRNA *ptr)
 {
-	Image *im= (Image*)ptr->data;
+	Image *im = (Image*)ptr->data;
 	ImBuf *ibuf;
 	void *lock;
 	int planes;
 	
-	ibuf= BKE_image_acquire_ibuf(im, NULL, &lock);
+	ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
 
-	if(!ibuf)
-		planes= 0;
-	else if(ibuf->rect_float)
-		planes= ibuf->planes * 4;
+	if (!ibuf)
+		planes = 0;
+	else if (ibuf->rect_float)
+		planes = ibuf->planes * 4;
 	else
-		planes= ibuf->planes;
+		planes = ibuf->planes;
 
 	BKE_image_release_ibuf(im, lock);
 
@@ -287,16 +288,16 @@ static int rna_Image_depth_get(PointerRNA *ptr)
 
 static int rna_Image_pixels_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
 {
-	Image *ima= ptr->id.data;
+	Image *ima = ptr->id.data;
 	ImBuf *ibuf;
 	void *lock;
 
-	ibuf= BKE_image_acquire_ibuf(ima, NULL, &lock);
+	ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
 
-	if(ibuf)
-		length[0]= ibuf->x*ibuf->y*ibuf->channels;
+	if (ibuf)
+		length[0] = ibuf->x*ibuf->y*ibuf->channels;
 	else
-		length[0]= 0;
+		length[0] = 0;
 
 	BKE_image_release_ibuf(ima, lock);
 
@@ -305,21 +306,21 @@ static int rna_Image_pixels_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY
 
 static void rna_Image_pixels_get(PointerRNA *ptr, float *values)
 {
-	Image *ima= ptr->id.data;
+	Image *ima = ptr->id.data;
 	ImBuf *ibuf;
 	void *lock;
 	int i, size;
 
-	ibuf= BKE_image_acquire_ibuf(ima, NULL, &lock);
+	ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
 
-	if(ibuf) {
-		size= ibuf->x*ibuf->y*ibuf->channels;
+	if (ibuf) {
+		size = ibuf->x*ibuf->y*ibuf->channels;
 
-		if(ibuf->rect_float) {
+		if (ibuf->rect_float) {
 			memcpy(values, ibuf->rect_float, sizeof(float)*size);
 		}
 		else {
-			for(i = 0; i < size; i++)
+			for (i = 0; i < size; i++)
 				values[i] = ((unsigned char*)ibuf->rect)[i]*(1.0f/255.0f);
 		}
 	}
@@ -329,21 +330,21 @@ static void rna_Image_pixels_get(PointerRNA *ptr, float *values)
 
 static void rna_Image_pixels_set(PointerRNA *ptr, const float *values)
 {
-	Image *ima= ptr->id.data;
+	Image *ima = ptr->id.data;
 	ImBuf *ibuf;
 	void *lock;
 	int i, size;
 
-	ibuf= BKE_image_acquire_ibuf(ima, NULL, &lock);
+	ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
 
-	if(ibuf) {
-		size= ibuf->x*ibuf->y*ibuf->channels;
+	if (ibuf) {
+		size = ibuf->x*ibuf->y*ibuf->channels;
 
-		if(ibuf->rect_float) {
+		if (ibuf->rect_float) {
 			memcpy(ibuf->rect_float, values, sizeof(float)*size);
 		}
 		else {
-			for(i = 0; i < size; i++)
+			for (i = 0; i < size; i++)
 				((unsigned char*)ibuf->rect)[i] = FTOCHAR(values[i]);
 		}
 
@@ -360,51 +361,53 @@ static void rna_def_imageuser(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "ImageUser", NULL);
-	RNA_def_struct_ui_text(srna, "Image User", "Parameters defining how an Image datablock is used by another datablock");
+	srna = RNA_def_struct(brna, "ImageUser", NULL);
+	RNA_def_struct_ui_text(srna, "Image User",
+	                       "Parameters defining how an Image datablock is used by another datablock");
 	RNA_def_struct_path_func(srna, "rna_ImageUser_path");
 
-	prop= RNA_def_property(srna, "use_auto_refresh", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_auto_refresh", PROP_BOOLEAN, PROP_NONE);
 	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");
 
 	/* animation */
-	prop= RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
+	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");
 
-	prop= RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE);
+	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");
 
-	prop= RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "offset");
 	RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
 	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");
 
-	prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "sfra");
 	RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
-	RNA_def_property_ui_text(prop, "Start Frame", "Global starting frame of the movie/sequence, assuming first picture has a #1");
+	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");
 
-	prop= RNA_def_property(srna, "fields_per_frame", PROP_INT, PROP_NONE);
+	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");
 
-	prop= RNA_def_property(srna, "multilayer_layer", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "multilayer_layer", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "layer");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* image_multi_cb */
 	RNA_def_property_ui_text(prop, "Layer", "Layer in multilayer image");
 
-	prop= RNA_def_property(srna, "multilayer_pass", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "multilayer_pass", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "pass");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* image_multi_cb */
 	RNA_def_property_ui_text(prop, "Pass", "Pass in multilayer image");
@@ -414,205 +417,214 @@ static void rna_def_image(BlenderRNA *brna)
 {
 	StructRNA *srna;
 	PropertyRNA *prop;
-	static const EnumPropertyItem prop_type_items[]= {
+	static const EnumPropertyItem prop_type_items[] = {
 		{IMA_TYPE_IMAGE, "IMAGE", 0, "Image", ""},
 		{IMA_TYPE_MULTILAYER, "MULTILAYER", 0, "Multilayer", ""},
 		{IMA_TYPE_UV_TEST, "UV_TEST", 0, "UV Test", ""},
 		{IMA_TYPE_R_RESULT, "RENDER_RESULT", 0, "Render Result", ""},
 		{IMA_TYPE_COMPOSITE, "COMPOSITING", 0, "Compositing", ""},
 		{0, NULL, 0, NULL, NULL}};
-	static const EnumPropertyItem prop_generated_type_items[]= {
+	static const EnumPropertyItem prop_generated_type_items[] = {
 		{0, "BLANK", 0, "Blank", "Generate a blank image"},
 		{1, "UV_GRID", 0, "UV Grid", "Generated grid to test UV mappings"},
 		{2, "COLOR_GRID", 0, "Color Grid", "Generated improved UV grid to test UV mappings"},
 		{0, NULL, 0, NULL, NULL}};
-	static const EnumPropertyItem prop_mapping_items[]= {
+	static const EnumPropertyItem prop_mapping_items[] = {
 		{0, "UV", 0, "UV Coordinates", "Use UV coordinates for mapping the image"},
 		{IMA_REFLECT, "REFLECTION", 0, "Reflection", "Use reflection mapping for mapping the image"},
 		{0, NULL, 0, NULL, NULL}};
-	static const EnumPropertyItem prop_field_order_items[]= {
+	static const EnumPropertyItem prop_field_order_items[] = {
 		{0, "EVEN", 0, "Upper First", "Upper field first"},
 		{IMA_STD_FIELD, "ODD", 0, "Lower First", "Lower field first"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "Image", "ID");
+	srna = RNA_def_struct(brna, "Image", "ID");
 	RNA_def_struct_ui_text(srna, "Image", "Image datablock referencing an external or packed image");
 	RNA_def_struct_ui_icon(srna, ICON_IMAGE_DATA);
 
-	prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+	prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
 	RNA_def_property_string_sdna(prop, NULL, "name");
 	RNA_def_property_ui_text(prop, "File Name", "Image/Movie file name");
 	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_reload_update");
 
 	/* eek. this is horrible but needed so we can save to a new name without blanking the data :( */
-	prop= RNA_def_property(srna, "filepath_raw", PROP_STRING, PROP_FILEPATH);
+	prop = RNA_def_property(srna, "filepath_raw", PROP_STRING, PROP_FILEPATH);
 	RNA_def_property_string_sdna(prop, NULL, "name");
 	RNA_def_property_ui_text(prop, "File Name", "Image/Movie file name (without data refreshing)");
 
-	prop= RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, image_type_items);
 	RNA_def_property_enum_funcs(prop, "rna_Image_file_format_get", "rna_Image_file_format_set", NULL);
 	RNA_def_property_ui_text(prop, "File Format", "Format used for re-saving this file");
 
-	prop= RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, image_source_items);
 	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Image_source_itemf");
 	RNA_def_property_ui_text(prop, "Source", "Where the image comes from");
 	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_source_update");
 
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Type", "How to generate the image");
 	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
 
-	prop= RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
 	RNA_def_property_ui_text(prop, "Packed File", "");
 	
-	prop= RNA_def_property(srna, "field_order", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "field_order", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, prop_field_order_items);
 	RNA_def_property_ui_text(prop, "Field Order", "Order of video fields (select which lines are displayed first)");
 	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
 	
 	/* booleans */
-	prop= RNA_def_property(srna, "use_fields", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_fields", PROP_BOOLEAN, PROP_NONE);
 	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");
 
-	prop= RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
+	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");
 	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_free_update");
 	
-	prop= RNA_def_property(srna, "use_color_unpremultiply", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_color_unpremultiply", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_CM_PREDIVIDE);
-	RNA_def_property_ui_text(prop, "Color Unpremultiply", "For premultiplied alpha images, do color space conversion on colors without alpha, to avoid fringing for images with light backgrounds");
+	RNA_def_property_ui_text(prop, "Color Unpremultiply",
+	                         "For premultiplied alpha images, do color space conversion on colors without alpha, "
+	                         "to avoid fringing for images with light backgrounds");
 	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_free_update");
 
-	prop= RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_Image_dirty_get", NULL);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Dirty", "Image has changed and is not saved");
 
 	/* generated image (image_generated_change_cb) */
-	prop= RNA_def_property(srna, "generated_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "generated_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "gen_type");
 	RNA_def_property_enum_items(prop, prop_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");
 
-	prop= RNA_def_property(srna, "generated_width", PROP_INT, PROP_NONE);
+	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");
 
-	prop= RNA_def_property(srna, "generated_height", PROP_INT, PROP_NONE);
+	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");
 
-	prop= RNA_def_property(srna, "use_generated_float", PROP_BOOLEAN, PROP_NONE);
+	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");
 
 	/* realtime properties */
-	prop= RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, prop_mapping_items);
 	RNA_def_property_ui_text(prop, "Mapping", "Mapping type to use for this image in the game engine");
 	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
 
-	prop= RNA_def_property(srna, "display_aspect", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "display_aspect", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "aspx");
 	RNA_def_property_array(prop, 2);
 	RNA_def_property_range(prop, 0.1f, 5000.0f);
 	RNA_def_property_ui_text(prop, "Display Aspect", "Display Aspect for this image, does not affect rendering");
 	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
 
-	prop= RNA_def_property(srna, "use_animation", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_animation", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "tpageflag", IMA_TWINANIM);
 	RNA_def_property_ui_text(prop, "Animated", "Use as animated texture in the game engine");
 	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_animated_update");
 
-	prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "twsta");
 	RNA_def_property_range(prop, 0, 128);
 	RNA_def_property_ui_text(prop, "Animation Start", "Start frame of an animated texture");
 	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_animated_update");
 
-	prop= RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "twend");
 	RNA_def_property_range(prop, 0, 128);
 	RNA_def_property_ui_text(prop, "Animation End", "End frame of an animated texture");
 	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, "rna_Image_animated_update");
 
-	prop= RNA_def_property(srna, "fps", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "fps", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "animspeed");
 	RNA_def_property_range(prop, 1, 100);
 	RNA_def_property_ui_text(prop, "Animation Speed", "Speed of the animation in frames per second");
 	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
 
-	prop= RNA_def_property(srna, "use_tiles", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_tiles", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "tpageflag", IMA_TILES);
-	RNA_def_property_ui_text(prop, "Tiles", "Use of tilemode for faces (default shift-LMB to pick the tile for selected faces)");
+	RNA_def_property_ui_text(prop, "Tiles",
+	                         "Use of tilemode for faces (default shift-LMB to pick the tile for selected faces)");
 	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
 
-	prop= RNA_def_property(srna, "tiles_x", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "tiles_x", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "xrep");
 	RNA_def_property_range(prop, 1, 16);
 	RNA_def_property_ui_text(prop, "Tiles X", "Degree of repetition in the X direction");
 	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
 
-	prop= RNA_def_property(srna, "tiles_y", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "tiles_y", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "yrep");
 	RNA_def_property_range(prop, 1, 16);
 	RNA_def_property_ui_text(prop, "Tiles Y", "Degree of repetition in the Y direction");
 	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
 
-	prop= RNA_def_property(srna, "use_clamp_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_clamp_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "tpageflag", IMA_CLAMP_U);
 	RNA_def_property_ui_text(prop, "Clamp X", "Disable texture repeating horizontally");
 	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
 
-	prop= RNA_def_property(srna, "use_clamp_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_clamp_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "tpageflag", IMA_CLAMP_V);
 	RNA_def_property_ui_text(prop, "Clamp Y", "Disable texture repeating vertically");
 	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
 
-	prop= RNA_def_property(srna, "bindcode", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "bindcode", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "bindcode");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Bindcode", "OpenGL bindcode");
 	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
 
+	prop = RNA_def_property(srna, "render_slot", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_range(prop, 0, IMA_MAX_RENDER_SLOT - 1);
+	RNA_def_property_ui_text(prop, "Render Slot", "The current render slot displayed, only for viewer type images");
+	RNA_def_property_update(prop, NC_IMAGE|ND_DISPLAY, NULL);
+
 	/*
-	   Image.has_data and Image.depth are temporary,
-	   Update import_obj.py when they are replaced (Arystan)
-	*/
-	prop= RNA_def_property(srna, "has_data", PROP_BOOLEAN, PROP_NONE);
+	 * Image.has_data and Image.depth are temporary,
+	 * Update import_obj.py when they are replaced (Arystan)
+	 */
+	prop = RNA_def_property(srna, "has_data", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_Image_has_data_get", NULL);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Has data", "True if this image has data");
 
-	prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_funcs(prop, "rna_Image_depth_get", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Depth", "Image bit depth");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_int_vector(srna, "size" , 2 , NULL , 0, 0, "Size" , "Width and height in pixels, zero when image data cant be loaded" , 0 , 0);
+	prop = RNA_def_int_vector(srna, "size" , 2 , NULL , 0, 0, "Size" ,
+	                          "Width and height in pixels, zero when image data cant be loaded" , 0 , 0);
 	RNA_def_property_int_funcs(prop, "rna_Image_size_get" , NULL, NULL);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_float_vector(srna, "resolution" , 2 , NULL , 0, 0, "Resolution" , "X/Y pixels per meter" , 0 , 0);
+	prop = RNA_def_float_vector(srna, "resolution" , 2 , NULL , 0, 0, "Resolution" , "X/Y pixels per meter" , 0 , 0);
 	RNA_def_property_float_funcs(prop, "rna_Image_resolution_get" , "rna_Image_resolution_set", NULL);
 
-	prop= RNA_def_property(srna, "pixels", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "pixels", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_DYNAMIC);
 	RNA_def_property_multi_array(prop, 1, NULL);
 	RNA_def_property_ui_text(prop, "Pixels", "Image pixels in floating point values");
@@ -629,4 +641,3 @@ void RNA_def_image(BlenderRNA *brna)
 }
 
 #endif
-
diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c
index b28adea..8594bda 100644
--- a/source/blender/makesrna/intern/rna_image_api.c
+++ b/source/blender/makesrna/intern/rna_image_api.c
@@ -1,11 +1,11 @@
 /*
- * 
+ *
  * ***** 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. 
+ * of the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -19,7 +19,7 @@
  * The Original Code is Copyright (C) 2009 Blender Foundation.
  * All rights reserved.
  *
- * 
+ *
  * Contributor(s): Arystanbek Dyussenov
  *
  * ***** END GPL LICENSE BLOCK *****
@@ -82,41 +82,42 @@ static void rna_Image_save_render(Image *image, bContext *C, ReportList *reports
 		}
 		else {
 			/* temp swap out the color */
-			const unsigned char imb_planes_back= ibuf->planes;
-			const float dither_back= ibuf->dither; 
-			ibuf->planes= scene->r.im_format.planes;
-			ibuf->dither= scene->r.dither_intensity;
+			const unsigned char imb_planes_back = ibuf->planes;
+			const float dither_back = ibuf->dither;
+			ibuf->planes = scene->r.im_format.planes;
+			ibuf->dither = scene->r.dither_intensity;
 			if (!BKE_write_ibuf(ibuf, path, &scene->r.im_format)) {
 				BKE_reportf(reports, RPT_ERROR, "Couldn't write image: %s", path);
 			}
-			ibuf->planes= imb_planes_back;
-			ibuf->dither= dither_back;
+			ibuf->planes = imb_planes_back;
+			ibuf->dither = dither_back;
 		}
 
 		BKE_image_release_ibuf(image, lock);
-	} else {
+	}
+	else {
 		BKE_reportf(reports, RPT_ERROR, "Scene not in context, couldn't get save parameters");
 	}
 }
 
 static void rna_Image_save(Image *image, ReportList *reports)
 {
-	ImBuf *ibuf= BKE_image_get_ibuf(image, NULL);
-	if(ibuf) {
+	ImBuf *ibuf = BKE_image_get_ibuf(image, NULL);
+	if (ibuf) {
 		char filename[FILE_MAX];
 		BLI_strncpy(filename, image->name, sizeof(filename));
 		BLI_path_abs(filename, G.main->name);
 
-		if(image->packedfile) {
+		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);
 			}
 		}
 		else if (IMB_saveiff(ibuf, filename, ibuf->flags)) {
-			image->type= IMA_TYPE_IMAGE;
+			image->type = IMA_TYPE_IMAGE;
 
-			if(image->source==IMA_SRC_GENERATED)
-				image->source= IMA_SRC_FILE;
+			if (image->source == IMA_SRC_GENERATED)
+				image->source = IMA_SRC_FILE;
 
 			ibuf->userflags &= ~IB_BITMAPDIRTY;
 		}
@@ -137,11 +138,11 @@ static void rna_Image_pack(Image *image, ReportList *reports, int as_png)
 		BKE_reportf(reports, RPT_ERROR, "Can't pack edited image from disk, only as internal PNG");
 	}
 	else {
-		if(as_png) {
+		if (as_png) {
 			BKE_image_memorypack(image);
 		}
 		else {
-			image->packedfile= newPackedFile(reports, image->name, ID_BLEND_PATH(G.main, &image->id));
+			image->packedfile = newPackedFile(reports, image->name, ID_BLEND_PATH(G.main, &image->id));
 		}
 	}
 }
@@ -151,7 +152,7 @@ static void rna_Image_unpack(Image *image, ReportList *reports, int method)
 	if (!image->packedfile) {
 		BKE_report(reports, RPT_ERROR, "Image not packed");
 	}
-	else if (image->source==IMA_SRC_SEQUENCE || image->source==IMA_SRC_MOVIE) {
+	else if (image->source == IMA_SRC_SEQUENCE || image->source == IMA_SRC_MOVIE) {
 		BKE_report(reports, RPT_ERROR, "Unpacking movies or image sequences not supported");
 		return;
 	}
@@ -168,9 +169,9 @@ 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_get_ibuf(image, NULL);
 
-	if(ibuf == NULL) {
+	if (ibuf == NULL) {
 		BKE_reportf(reports, RPT_ERROR, "Image \"%s\" does not have any image data", image->id.name+2);
 		return;
 	}
@@ -184,12 +185,12 @@ static int rna_Image_gl_load(Image *image, ReportList *reports, int filter, int
 	unsigned int *bind = &image->bindcode;
 	int error = GL_NO_ERROR;
 
-	if(*bind)
+	if (*bind)
 		return error;
 
-	ibuf= BKE_image_get_ibuf(image, NULL);
+	ibuf = BKE_image_get_ibuf(image, NULL);
 
-	if(ibuf == NULL || ibuf->rect == NULL ) {
+	if (ibuf == NULL || ibuf->rect == NULL ) {
 		BKE_reportf(reports, RPT_ERROR, "Image \"%s\" does not have any image data", image->id.name+2);
 		return (int)GL_INVALID_OPERATION;
 	}
@@ -199,7 +200,7 @@ static int rna_Image_gl_load(Image *image, ReportList *reports, int filter, int
 	glBindTexture(GL_TEXTURE_2D, *bind);
 
 	if (filter != GL_NEAREST && filter != GL_LINEAR)
-		error = (int)gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_INT, ibuf->rect);
+		error = (int)gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
 
 	if (!error) {
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, image->tpageflag & IMA_CLAMP_U ? GL_CLAMP : GL_REPEAT);
@@ -207,7 +208,7 @@ static int rna_Image_gl_load(Image *image, ReportList *reports, int filter, int
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (GLint)filter);
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (GLint)mag);
 		glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ibuf->x, ibuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); 
+		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ibuf->x, ibuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
 		error = (int)glGetError();
 	}
 
@@ -234,35 +235,35 @@ void RNA_api_image(StructRNA *srna)
 	FunctionRNA *func;
 	PropertyRNA *parm;
 
-	func= RNA_def_function(srna, "save_render", "rna_Image_save_render");
+	func = RNA_def_function(srna, "save_render", "rna_Image_save_render");
 	RNA_def_function_ui_description(func, "Save image to a specific path using a scenes render settings");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
-	parm= RNA_def_string_file_path(func, "filepath", "", 0, "", "Save path");
+	parm = RNA_def_string_file_path(func, "filepath", "", 0, "", "Save path");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_pointer(func, "scene", "Scene", "", "Scene to take image parameters from");
 
-	func= RNA_def_function(srna, "save", "rna_Image_save");
+	func = RNA_def_function(srna, "save", "rna_Image_save");
 	RNA_def_function_ui_description(func, "Save image to its source path");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 
-	func= RNA_def_function(srna, "pack", "rna_Image_pack");
+	func = RNA_def_function(srna, "pack", "rna_Image_pack");
 	RNA_def_function_ui_description(func, "Pack an image as embedded data into the .blend file");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_boolean(func, "as_png", 0, "as_png", "Pack the image as PNG (needed for generated/dirty images)");
 
-	func= RNA_def_function(srna, "unpack", "rna_Image_unpack");
+	func = RNA_def_function(srna, "unpack", "rna_Image_unpack");
 	RNA_def_function_ui_description(func, "Save an image packed in the .blend file to disk");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_enum(func, "method", unpack_method_items, PF_USE_LOCAL, "method", "How to unpack");
 
-	func= RNA_def_function(srna, "reload", "rna_Image_reload");
+	func = RNA_def_function(srna, "reload", "rna_Image_reload");
 	RNA_def_function_ui_description(func, "Reload the image from its source path");
 
-	func= RNA_def_function(srna, "update", "rna_Image_update");
+	func = RNA_def_function(srna, "update", "rna_Image_update");
 	RNA_def_function_ui_description(func, "Update the display image from the floating point buffer");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 
-	func= RNA_def_function(srna, "gl_load", "rna_Image_gl_load");
+	func = RNA_def_function(srna, "gl_load", "rna_Image_gl_load");
 	RNA_def_function_ui_description(func, "Load the image into OpenGL graphics memory");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_int(func, "filter", GL_LINEAR_MIPMAP_NEAREST, -INT_MAX, INT_MAX, "Filter",
@@ -270,10 +271,10 @@ void RNA_api_image(StructRNA *srna)
 	RNA_def_int(func, "mag", GL_LINEAR, -INT_MAX, INT_MAX, "Magnification",
 	            "The texture magnification function", -INT_MAX, INT_MAX);
 	/* return value */
-	parm= RNA_def_int(func, "error", 0, -INT_MAX, INT_MAX, "Error", "OpenGL error value", -INT_MAX, INT_MAX);
+	parm = RNA_def_int(func, "error", 0, -INT_MAX, INT_MAX, "Error", "OpenGL error value", -INT_MAX, INT_MAX);
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "gl_free", "rna_Image_gl_free");
+	func = RNA_def_function(srna, "gl_free", "rna_Image_gl_free");
 	RNA_def_function_ui_description(func, "Free the image from OpenGL graphics memory");
 
 	/* TODO, pack/unpack, maybe should be generic functions? */
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index e9f8ecd..155c9c6 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -25,8 +25,8 @@
  */
 
 
-#ifndef RNA_INTERNAL_H
-#define RNA_INTERNAL_H
+#ifndef __RNA_INTERNAL_H__
+#define __RNA_INTERNAL_H__
 
 #include "UI_resources.h"
 
@@ -128,7 +128,6 @@ void RNA_def_armature(struct BlenderRNA *brna);
 void RNA_def_actuator(struct BlenderRNA *brna);
 void RNA_def_boid(struct BlenderRNA *brna);
 void RNA_def_brush(struct BlenderRNA *brna);
-void RNA_def_brushclone(struct BlenderRNA *brna);
 void RNA_def_camera(struct BlenderRNA *brna);
 void RNA_def_cloth(struct BlenderRNA *brna);
 void RNA_def_color(struct BlenderRNA *brna);
@@ -189,7 +188,9 @@ void rna_def_animviz_common(struct StructRNA *srna);
 void rna_def_motionpath_common(struct StructRNA *srna);
 
 void rna_def_texmat_common(struct StructRNA *srna, const char *texspace_editable);
-void rna_def_mtex_common(struct BlenderRNA *brna, struct StructRNA *srna, const char *begin, const char *activeget, const char *activeset, const char *activeeditable, const char *structname, const char *structname_slots, const char *update);
+void rna_def_mtex_common(struct BlenderRNA *brna, struct StructRNA *srna, const char *begin, const char *activeget,
+                         const char *activeset, const char *activeeditable, const char *structname,
+                         const char *structname_slots, const char *update);
 void rna_def_render_layer_common(struct StructRNA *srna, int scene);
 
 void rna_ID_name_get(struct PointerRNA *ptr, char *value);
@@ -200,7 +201,9 @@ struct IDProperty *rna_ID_idprops(struct PointerRNA *ptr, int create);
 void rna_ID_fake_user_set(struct PointerRNA *ptr, int value);
 struct IDProperty *rna_PropertyGroup_idprops(struct PointerRNA *ptr, int create);
 void rna_PropertyGroup_unregister(struct Main *bmain, struct StructRNA *type);
-struct StructRNA *rna_PropertyGroup_register(struct Main *bmain, struct ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free);
+struct StructRNA *rna_PropertyGroup_register(struct Main *bmain, struct ReportList *reports, void *data,
+                                             const char *identifier, StructValidateFunc validate,
+                                             StructCallbackFunc call, StructFreeFunc free);
 struct StructRNA* rna_PropertyGroup_refine(struct PointerRNA *ptr);
 
 void rna_object_vgroup_name_index_get(struct PointerRNA *ptr, char *value, int index);
@@ -247,7 +250,6 @@ void RNA_api_keymap(struct StructRNA *srna);
 void RNA_api_keymaps(struct StructRNA *srna);
 void RNA_api_keymapitem(struct StructRNA *srna);
 void RNA_api_keymapitems(struct StructRNA *srna);
-void RNA_api_area(struct StructRNA *srna);
 void RNA_api_main(struct StructRNA *srna);
 void RNA_api_material(StructRNA *srna);
 void RNA_api_mesh(struct StructRNA *srna);
@@ -340,10 +342,11 @@ PointerRNA rna_listbase_lookup_int(PointerRNA *ptr, StructRNA *type, struct List
 typedef struct ArrayIterator {
 	char *ptr;
 	char *endptr;	/* past the last valid pointer, only for comparisons, ignores skipped values */
-	void *free_ptr; /* will be free'd if set */
+	void *free_ptr; /* will be freed if set */
 	int itemsize;
 
-	/* array length with no skip functins applied, take care not to compare against index from animsys or python indices */
+	/* array length with no skip functins applied, take care not to compare against index from animsys
+	 * or python indices */
 	int length;
 
 	/* optional skip function, when set the array as viewed by rna can contain only a subset of the members.
@@ -351,7 +354,8 @@ typedef struct ArrayIterator {
 	IteratorSkipFunc skip;
 } ArrayIterator;
 
-void rna_iterator_array_begin(struct CollectionPropertyIterator *iter, void *ptr, int itemsize, int length, int free_ptr, IteratorSkipFunc skip);
+void rna_iterator_array_begin(struct CollectionPropertyIterator *iter, void *ptr, int itemsize, int length,
+                              int free_ptr, IteratorSkipFunc skip);
 void rna_iterator_array_next(struct CollectionPropertyIterator *iter);
 void *rna_iterator_array_get(struct CollectionPropertyIterator *iter);
 void *rna_iterator_array_dereference_get(struct CollectionPropertyIterator *iter);
@@ -379,7 +383,7 @@ PointerRNA rna_pointer_inherit_refine(struct PointerRNA *ptr, struct StructRNA *
 int rna_parameter_size(struct PropertyRNA *parm);
 int rna_parameter_size_alloc(struct PropertyRNA *parm);
 
-// XXX, these should not need to be defined here~!
+/* XXX, these should not need to be defined here~! */
 struct MTex *rna_mtex_texture_slots_add(struct ID *self, struct bContext *C, struct ReportList *reports);
 struct MTex *rna_mtex_texture_slots_create(struct ID *self, struct bContext *C, struct ReportList *reports, int index);
 void rna_mtex_texture_slots_clear(struct ID *self, struct bContext *C, struct ReportList *reports, int index);
@@ -387,6 +391,6 @@ void rna_mtex_texture_slots_clear(struct ID *self, struct bContext *C, struct Re
 
 int rna_IDMaterials_assign_int(struct PointerRNA *ptr, int key, const struct PointerRNA *assign_ptr);
 
-#endif /* RNA_INTERNAL_H */
+#endif /* __RNA_INTERNAL_H__ */
 
 
diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h
index 40157d3..ccfb83b 100644
--- a/source/blender/makesrna/intern/rna_internal_types.h
+++ b/source/blender/makesrna/intern/rna_internal_types.h
@@ -25,8 +25,8 @@
  */
 
 
-#ifndef RNA_INTERNAL_TYPES_H
-#define RNA_INTERNAL_TYPES_H
+#ifndef __RNA_INTERNAL_TYPES_H__
+#define __RNA_INTERNAL_TYPES_H__
 
 #include "DNA_listBase.h"
 
@@ -77,18 +77,19 @@ typedef int (*PropIntGetFunc)(struct PointerRNA *ptr);
 typedef void (*PropIntSetFunc)(struct PointerRNA *ptr, int value);
 typedef void (*PropIntArrayGetFunc)(struct PointerRNA *ptr, int *values);
 typedef void (*PropIntArraySetFunc)(struct PointerRNA *ptr, const int *values);
-typedef void (*PropIntRangeFunc)(struct PointerRNA *ptr, int *min, int *max);
+typedef void (*PropIntRangeFunc)(struct PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax);
 typedef float (*PropFloatGetFunc)(struct PointerRNA *ptr);
 typedef void (*PropFloatSetFunc)(struct PointerRNA *ptr, float value);
 typedef void (*PropFloatArrayGetFunc)(struct PointerRNA *ptr, float *values);
 typedef void (*PropFloatArraySetFunc)(struct PointerRNA *ptr, const float *values);
-typedef void (*PropFloatRangeFunc)(struct PointerRNA *ptr, float *min, float *max);
+typedef void (*PropFloatRangeFunc)(struct PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax);
 typedef void (*PropStringGetFunc)(struct PointerRNA *ptr, char *value);
 typedef int (*PropStringLengthFunc)(struct PointerRNA *ptr);
 typedef void (*PropStringSetFunc)(struct PointerRNA *ptr, const char *value);
 typedef int (*PropEnumGetFunc)(struct PointerRNA *ptr);
 typedef void (*PropEnumSetFunc)(struct PointerRNA *ptr, int value);
-typedef EnumPropertyItem *(*PropEnumItemFunc)(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
+typedef EnumPropertyItem *(*PropEnumItemFunc)(struct bContext *C, struct PointerRNA *ptr,
+                                              struct PropertyRNA *prop, int *free);
 typedef PointerRNA (*PropPointerGetFunc)(struct PointerRNA *ptr);
 typedef StructRNA* (*PropPointerTypeFunc)(struct PointerRNA *ptr);
 typedef void (*PropPointerSetFunc)(struct PointerRNA *ptr, const PointerRNA value);
@@ -312,6 +313,8 @@ struct StructRNA {
 	const char *name;
 	/* single line description, displayed in the tooltip for example */
 	const char *description;
+	/* context for translation */
+	const char *translation_context;
 	/* icon ID */
 	int icon;
 	
@@ -331,21 +334,21 @@ struct StructRNA {
 	struct StructRNA *nested;
 
 	/* function to give the more specific type */
-	StructRefineFunc refine; 
+	StructRefineFunc refine;
 
 	/* function to find path to this struct in an ID */
-	StructPathFunc path; 
+	StructPathFunc path;
 
 	/* function to register/unregister subclasses */
-	StructRegisterFunc reg; 
-	StructUnregisterFunc unreg; 
+	StructRegisterFunc reg;
+	StructUnregisterFunc unreg;
 	StructInstanceFunc instance;
 
 	/* callback to get id properties */
 	IDPropertiesFunc idproperties;
 
 	/* functions of this struct */
-	ListBase functions; 
+	ListBase functions;
 };
 
 /* Blender RNA
@@ -358,4 +361,4 @@ struct BlenderRNA {
 
 #define CONTAINER_RNA_ID(cont) (*(const char **)(((ContainerRNA *)(cont))+1))
 
-#endif /* RNA_INTERNAL_TYPES_H */
+#endif /* __RNA_INTERNAL_TYPES_H__ */
diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c
index 08836cc..94120c8 100644
--- a/source/blender/makesrna/intern/rna_key.c
+++ b/source/blender/makesrna/intern/rna_key.c
@@ -33,6 +33,7 @@
 #include "rna_internal.h"
 
 #include "DNA_ID.h"
+#include "DNA_scene_types.h"
 #include "DNA_curve_types.h"
 #include "DNA_key_types.h"
 #include "DNA_lattice_types.h"
@@ -55,7 +56,7 @@
 
 static Key *rna_ShapeKey_find_key(ID *id)
 {
-	switch(GS(id->name)) {
+	switch (GS(id->name)) {
 		case ID_CU: return ((Curve*)id)->key;
 		case ID_KE: return (Key*)id;
 		case ID_LT: return ((Lattice*)id)->key;
@@ -67,7 +68,7 @@ static Key *rna_ShapeKey_find_key(ID *id)
 
 void rna_ShapeKey_name_set(PointerRNA *ptr, const char *value)
 {
-	KeyBlock *kb= ptr->data;
+	KeyBlock *kb = ptr->data;
 	char oldname[sizeof(kb->name)];
 	
 	/* make a copy of the old name first */
@@ -78,64 +79,64 @@ void rna_ShapeKey_name_set(PointerRNA *ptr, const char *value)
 	
 	/* make sure the name is truly unique */
 	if (ptr->id.data) {
-		Key *key= rna_ShapeKey_find_key(ptr->id.data);
+		Key *key = rna_ShapeKey_find_key(ptr->id.data);
 		BLI_uniquename(&key->block, kb, "Key", '.', offsetof(KeyBlock, name), sizeof(kb->name));
 	}
 	
 	/* fix all the animation data which may link to this */
-	BKE_all_animdata_fix_paths_rename("key_blocks", oldname, kb->name);
+	BKE_all_animdata_fix_paths_rename(NULL, "key_blocks", oldname, kb->name);
 }
 
 static void rna_ShapeKey_value_set(PointerRNA *ptr, float value)
 {
-	KeyBlock *data= (KeyBlock*)ptr->data;
+	KeyBlock *data = (KeyBlock*)ptr->data;
 	CLAMP(value, data->slidermin, data->slidermax);
-	data->curval= value;
+	data->curval = value;
 }
 
-static void rna_ShapeKey_value_range(PointerRNA *ptr, float *min, float *max)
+static void rna_ShapeKey_value_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
 {
-	KeyBlock *data= (KeyBlock*)ptr->data;
+	KeyBlock *data = (KeyBlock*)ptr->data;
 
-	*min= data->slidermin;
-	*max= data->slidermax;
+	*min = data->slidermin;
+	*max = data->slidermax;
 }
 
 /* epsilon for how close one end of shapekey range can get to the other */
 #define SHAPEKEY_SLIDER_TOL 0.001f
 
-static void rna_ShapeKey_slider_min_range(PointerRNA *ptr, float *min, float *max)
+static void rna_ShapeKey_slider_min_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
 {
-	KeyBlock *data= (KeyBlock*)ptr->data;
+	KeyBlock *data = (KeyBlock*)ptr->data;
 
-	*min= -10.0f;
-	*max= data->slidermax - SHAPEKEY_SLIDER_TOL;
+	*min = -10.0f;
+	*max = data->slidermax - SHAPEKEY_SLIDER_TOL;
 }
 
 static void rna_ShapeKey_slider_min_set(PointerRNA *ptr, float value)
 {
-	KeyBlock *data= (KeyBlock*)ptr->data;
-	float min, max;
+	KeyBlock *data = (KeyBlock*)ptr->data;
+	float min, max, softmin, softmax;
 	
-	rna_ShapeKey_slider_min_range(ptr, &min, &max);
+	rna_ShapeKey_slider_min_range(ptr, &min, &max, &softmin, &softmax);
 	CLAMP(value, min, max);
 	data->slidermin = value;
 }
 
-static void rna_ShapeKey_slider_max_range(PointerRNA *ptr, float *min, float *max)
+static void rna_ShapeKey_slider_max_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
 {
-	KeyBlock *data= (KeyBlock*)ptr->data;
+	KeyBlock *data = (KeyBlock*)ptr->data;
 
-	*min= data->slidermin + SHAPEKEY_SLIDER_TOL;
-	*max= 10.0f;
+	*min = data->slidermin + SHAPEKEY_SLIDER_TOL;
+	*max = 10.0f;
 }
 
 static void rna_ShapeKey_slider_max_set(PointerRNA *ptr, float value)
 {
-	KeyBlock *data= (KeyBlock*)ptr->data;
-	float min, max;
+	KeyBlock *data = (KeyBlock*)ptr->data;
+	float min, max, softmin, softmax;
 	
-	rna_ShapeKey_slider_max_range(ptr, &min, &max);
+	rna_ShapeKey_slider_max_range(ptr, &min, &max, &softmin, &softmax);
 	CLAMP(value, min, max);
 	data->slidermax = value;
 }
@@ -144,8 +145,8 @@ static void rna_ShapeKey_slider_max_set(PointerRNA *ptr, float value)
 
 PointerRNA rna_object_shapekey_index_get(ID *id, int value)
 {
-	Key *key= rna_ShapeKey_find_key(id);
-	KeyBlock *kb= NULL;
+	Key *key = rna_ShapeKey_find_key(id);
+	KeyBlock *kb = NULL;
 	PointerRNA ptr;
 
 	if (key && value < key->totkey)
@@ -158,7 +159,7 @@ PointerRNA rna_object_shapekey_index_get(ID *id, int value)
 
 int rna_object_shapekey_index_set(ID *id, PointerRNA value, int current)
 {
-	Key *key= rna_ShapeKey_find_key(id);
+	Key *key = rna_ShapeKey_find_key(id);
 
 	if (key) {
 		int a = BLI_findindex(&key->block, value.data);
@@ -170,103 +171,104 @@ int rna_object_shapekey_index_set(ID *id, PointerRNA value, int current)
 
 static PointerRNA rna_ShapeKey_relative_key_get(PointerRNA *ptr)
 {
-	KeyBlock *kb= (KeyBlock*)ptr->data;
+	KeyBlock *kb = (KeyBlock*)ptr->data;
 
 	return rna_object_shapekey_index_get(ptr->id.data, kb->relative);
 }
 
 static void rna_ShapeKey_relative_key_set(PointerRNA *ptr, PointerRNA value)
 {
-	KeyBlock *kb= (KeyBlock*)ptr->data;
+	KeyBlock *kb = (KeyBlock*)ptr->data;
 
-	kb->relative= rna_object_shapekey_index_set(ptr->id.data, value, kb->relative);
+	kb->relative = rna_object_shapekey_index_set(ptr->id.data, value, kb->relative);
 }
 
 static void rna_ShapeKeyPoint_co_get(PointerRNA *ptr, float *values)
 {
-	float *vec= (float*)ptr->data;
+	float *vec = (float*)ptr->data;
 
-	values[0]= vec[0];
-	values[1]= vec[1];
-	values[2]= vec[2];
+	values[0] = vec[0];
+	values[1] = vec[1];
+	values[2] = vec[2];
 }
 
 static void rna_ShapeKeyPoint_co_set(PointerRNA *ptr, const float *values)
 {
-	float *vec= (float*)ptr->data;
+	float *vec = (float*)ptr->data;
 
-	vec[0]= values[0];
-	vec[1]= values[1];
-	vec[2]= values[2];
+	vec[0] = values[0];
+	vec[1] = values[1];
+	vec[2] = values[2];
 }
 
 static float rna_ShapeKeyCurvePoint_tilt_get(PointerRNA *ptr)
 {
-	float *vec= (float*)ptr->data;
+	float *vec = (float*)ptr->data;
 	return vec[3];
 }
 
 static void rna_ShapeKeyCurvePoint_tilt_set(PointerRNA *ptr, float value)
 {
-	float *vec= (float*)ptr->data;
-	vec[3]= value;
+	float *vec = (float*)ptr->data;
+	vec[3] = value;
 }
 
 static void rna_ShapeKeyBezierPoint_co_get(PointerRNA *ptr, float *values)
 {
-	float *vec= (float*)ptr->data;
+	float *vec = (float*)ptr->data;
 
-	values[0]= vec[0+3];
-	values[1]= vec[1+3];
-	values[2]= vec[2+3];
+	values[0] = vec[0+3];
+	values[1] = vec[1+3];
+	values[2] = vec[2+3];
 }
 
 static void rna_ShapeKeyBezierPoint_co_set(PointerRNA *ptr, const float *values)
 {
-	float *vec= (float*)ptr->data;
+	float *vec = (float*)ptr->data;
 
-	vec[0+3]= values[0];
-	vec[1+3]= values[1];
-	vec[2+3]= values[2];
+	vec[0+3] = values[0];
+	vec[1+3] = values[1];
+	vec[2+3] = values[2];
 }
 
 static void rna_ShapeKeyBezierPoint_handle_1_co_get(PointerRNA *ptr, float *values)
 {
-	float *vec= (float*)ptr->data;
+	float *vec = (float*)ptr->data;
 
-	values[0]= vec[0];
-	values[1]= vec[1];
-	values[2]= vec[2];
+	values[0] = vec[0];
+	values[1] = vec[1];
+	values[2] = vec[2];
 }
 
 static void rna_ShapeKeyBezierPoint_handle_1_co_set(PointerRNA *ptr, const float *values)
 {
-	float *vec= (float*)ptr->data;
+	float *vec = (float*)ptr->data;
 
-	vec[0]= values[0];
-	vec[1]= values[1];
-	vec[2]= values[2];
+	vec[0] = values[0];
+	vec[1] = values[1];
+	vec[2] = values[2];
 }
 
 static void rna_ShapeKeyBezierPoint_handle_2_co_get(PointerRNA *ptr, float *values)
 {
-	float *vec= (float*)ptr->data;
+	float *vec = (float*)ptr->data;
 
-	values[0]= vec[6+0];
-	values[1]= vec[6+1];
-	values[2]= vec[6+2];
+	values[0] = vec[6+0];
+	values[1] = vec[6+1];
+	values[2] = vec[6+2];
 }
 
 static void rna_ShapeKeyBezierPoint_handle_2_co_set(PointerRNA *ptr, const float *values)
 {
-	float *vec= (float*)ptr->data;
+	float *vec = (float*)ptr->data;
 
-	vec[6+0]= values[0];
-	vec[6+1]= values[1];
-	vec[6+2]= values[2];
+	vec[6+0] = values[0];
+	vec[6+1] = values[1];
+	vec[6+2] = values[2];
 }
 
-/*static float rna_ShapeKeyBezierPoint_tilt_get(PointerRNA *ptr)
+#if 0
+static float rna_ShapeKeyBezierPoint_tilt_get(PointerRNA *ptr)
 {
 	float *vec= (float*)ptr->data;
 	return vec[10];
@@ -276,21 +278,22 @@ static void rna_ShapeKeyBezierPoint_tilt_set(PointerRNA *ptr, float value)
 {
 	float *vec= (float*)ptr->data;
 	vec[10]= value;
-}*/
+}
+#endif
 
 static void rna_ShapeKey_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Key *key= rna_ShapeKey_find_key(ptr->id.data);
-	KeyBlock *kb= (KeyBlock*)ptr->data;
+	Key *key = rna_ShapeKey_find_key(ptr->id.data);
+	KeyBlock *kb = (KeyBlock*)ptr->data;
 	Curve *cu;
 	Nurb *nu;
-	int tot= kb->totelem, size= key->elemsize;
+	int tot = kb->totelem, size = key->elemsize;
 	
-	if(GS(key->from->name) == ID_CU) {
-		cu= (Curve*)key->from;
-		nu= cu->nurb.first;
+	if (GS(key->from->name) == ID_CU) {
+		cu = (Curve*)key->from;
+		nu = cu->nurb.first;
 		
-		if(nu->bezt) {
+		if (nu->bezt) {
 			tot /= 3;
 			size *= 3;
 		}
@@ -301,17 +304,17 @@ static void rna_ShapeKey_data_begin(CollectionPropertyIterator *iter, PointerRNA
 
 static int rna_ShapeKey_data_length(PointerRNA *ptr)
 {
-	Key *key= rna_ShapeKey_find_key(ptr->id.data);
-	KeyBlock *kb= (KeyBlock*)ptr->data;
+	Key *key = rna_ShapeKey_find_key(ptr->id.data);
+	KeyBlock *kb = (KeyBlock*)ptr->data;
 	Curve *cu;
 	Nurb *nu;
-	int tot= kb->totelem;
+	int tot = kb->totelem;
 	
-	if(GS(key->from->name) == ID_CU) {
-		cu= (Curve*)key->from;
-		nu= cu->nurb.first;
+	if (GS(key->from->name) == ID_CU) {
+		cu = (Curve*)key->from;
+		nu = cu->nurb.first;
 		
-		if(nu->bezt)
+		if (nu->bezt)
 			tot /= 3;
 	}
 	
@@ -320,30 +323,30 @@ static int rna_ShapeKey_data_length(PointerRNA *ptr)
 
 static PointerRNA rna_ShapeKey_data_get(CollectionPropertyIterator *iter)
 {
-	Key *key= rna_ShapeKey_find_key(iter->parent.id.data);
+	Key *key = rna_ShapeKey_find_key(iter->parent.id.data);
 	StructRNA *type;
 	Curve *cu;
 	Nurb *nu;
 	
-	if(GS(key->from->name) == ID_CU) {
-		cu= (Curve*)key->from;
-		nu= cu->nurb.first;
+	if (GS(key->from->name) == ID_CU) {
+		cu = (Curve*)key->from;
+		nu = cu->nurb.first;
 		
-		if(nu->bezt)
-			type= &RNA_ShapeKeyBezierPoint;
+		if (nu->bezt)
+			type = &RNA_ShapeKeyBezierPoint;
 		else
-			type= &RNA_ShapeKeyCurvePoint;
+			type = &RNA_ShapeKeyCurvePoint;
 	}
 	else
-		type= &RNA_ShapeKeyPoint;
+		type = &RNA_ShapeKeyPoint;
 	
 	return rna_pointer_inherit_refine(&iter->parent, type, rna_iterator_array_get(iter));
 }
 
 static char *rna_ShapeKey_path(PointerRNA *ptr)
 {
-	KeyBlock *kb= (KeyBlock *)ptr->data;
-	ID *id= ptr->id.data;
+	KeyBlock *kb = (KeyBlock *)ptr->data;
+	ID *id = ptr->id.data;
 	
 	if ((id) && (GS(id->name) != ID_KE))
 		return BLI_sprintfN("shape_keys.key_blocks[\"%s\"]", kb->name);
@@ -353,11 +356,11 @@ static char *rna_ShapeKey_path(PointerRNA *ptr)
 
 static void rna_Key_update_data(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	Key *key= ptr->id.data;
+	Key *key = ptr->id.data;
 	Object *ob;
 
-	for(ob=bmain->object.first; ob; ob= ob->id.next) {
-		if(ob_get_key(ob) == key) {
+	for (ob = bmain->object.first; ob; ob = ob->id.next) {
+		if (ob_get_key(ob) == key) {
 			DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 			WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob);
 		}
@@ -372,7 +375,7 @@ static KeyBlock *rna_ShapeKeyData_find_keyblock(Key *key, float *point)
 	if (ELEM(NULL, key, point))
 		return NULL;
 	
-	/* we'll need to manually search through the keyblocks and check 
+	/* we'll need to manually search through the keyblocks and check
 	 * if the point is somewhere in the middle of each block's data
 	 */
 	for (kb = key->block.first; kb; kb = kb->next) {
@@ -390,7 +393,7 @@ static KeyBlock *rna_ShapeKeyData_find_keyblock(Key *key, float *point)
 				return kb;
 			}
 			
-			/* determine where end of array is 
+			/* determine where end of array is
 			 *	- elemsize is in bytes, so use char* cast to get array in terms of bytes
 			 */
 			end = (float *)((char *)start + (key->elemsize * kb->totelem));
@@ -408,7 +411,7 @@ static KeyBlock *rna_ShapeKeyData_find_keyblock(Key *key, float *point)
 
 static int rna_ShapeKeyPoint_get_index(Key *key, KeyBlock *kb, float *point)
 {
-	/* if we frame the data array and point pointers as char*, then the difference between 
+	/* if we frame the data array and point pointers as char*, then the difference between
 	 * them will be in bytes. Thus, dividing through by key->elemsize (number of bytes per point)
 	 * gives us the offset of point from start of array.
 	 */
@@ -426,7 +429,7 @@ static char *rna_ShapeKeyPoint_path(PointerRNA *ptr)
 	float *point = (float *)ptr->data;
 	
 	/* if we can get a key block, we can construct a path */
-	kb = rna_ShapeKeyData_find_keyblock(key, point); 
+	kb = rna_ShapeKeyData_find_keyblock(key, point);
 	
 	if (kb) {
 		int index = rna_ShapeKeyPoint_get_index(key, kb, point);
@@ -437,7 +440,7 @@ static char *rna_ShapeKeyPoint_path(PointerRNA *ptr)
 			return BLI_sprintfN("shape_keys.key_blocks[\"%s\"].data[%d]", kb->name, index);
 	}
 	else
-		return NULL; // XXX: there's really no way to resolve this...
+		return NULL; /* XXX: there's really no way to resolve this... */
 }
 
 #else
@@ -447,58 +450,64 @@ static void rna_def_keydata(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "ShapeKeyPoint", NULL);
+	srna = RNA_def_struct(brna, "ShapeKeyPoint", NULL);
 	RNA_def_struct_ui_text(srna, "Shape Key Point", "Point in a shape key");
 	RNA_def_struct_path_func(srna, "rna_ShapeKeyPoint_path");
 
-	prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_float_funcs(prop, "rna_ShapeKeyPoint_co_get", "rna_ShapeKeyPoint_co_set", NULL);
 	RNA_def_property_ui_text(prop, "Location", "");
 	RNA_def_property_update(prop, 0, "rna_Key_update_data");
 
-	srna= RNA_def_struct(brna, "ShapeKeyCurvePoint", NULL);
+	srna = RNA_def_struct(brna, "ShapeKeyCurvePoint", NULL);
 	RNA_def_struct_ui_text(srna, "Shape Key Curve Point", "Point in a shape key for curves");
-	RNA_def_struct_path_func(srna, "rna_ShapeKeyPoint_path"); /* there's nothing type specific here, so this is fine for now */
+		/* there's nothing type specific here, so this is fine for now */
+	RNA_def_struct_path_func(srna, "rna_ShapeKeyPoint_path");
 
-	prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_float_funcs(prop, "rna_ShapeKeyPoint_co_get", "rna_ShapeKeyPoint_co_set", NULL);
 	RNA_def_property_ui_text(prop, "Location", "");
 	RNA_def_property_update(prop, 0, "rna_Key_update_data");
 
-	prop= RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_funcs(prop, "rna_ShapeKeyCurvePoint_tilt_get", "rna_ShapeKeyCurvePoint_tilt_set", NULL);
 	RNA_def_property_ui_text(prop, "Tilt", "");
 	RNA_def_property_update(prop, 0, "rna_Key_update_data");
 
-	srna= RNA_def_struct(brna, "ShapeKeyBezierPoint", NULL);
+	srna = RNA_def_struct(brna, "ShapeKeyBezierPoint", NULL);
 	RNA_def_struct_ui_text(srna, "Shape Key Bezier Point", "Point in a shape key for Bezier curves");
-	RNA_def_struct_path_func(srna, "rna_ShapeKeyPoint_path"); /* there's nothing type specific here, so this is fine for now */
+		/* there's nothing type specific here, so this is fine for now */
+	RNA_def_struct_path_func(srna, "rna_ShapeKeyPoint_path");
 
-	prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_float_funcs(prop, "rna_ShapeKeyBezierPoint_co_get", "rna_ShapeKeyBezierPoint_co_set", NULL);
 	RNA_def_property_ui_text(prop, "Location", "");
 	RNA_def_property_update(prop, 0, "rna_Key_update_data");
 
-	prop= RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_array(prop, 3);
-	RNA_def_property_float_funcs(prop, "rna_ShapeKeyBezierPoint_handle_1_co_get", "rna_ShapeKeyBezierPoint_handle_1_co_set", NULL);
+	RNA_def_property_float_funcs(prop, "rna_ShapeKeyBezierPoint_handle_1_co_get",
+	                             "rna_ShapeKeyBezierPoint_handle_1_co_set", NULL);
 	RNA_def_property_ui_text(prop, "Handle 1 Location", "");
 	RNA_def_property_update(prop, 0, "rna_Key_update_data");
 
-	prop= RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_array(prop, 3);
-	RNA_def_property_float_funcs(prop, "rna_ShapeKeyBezierPoint_handle_2_co_get", "rna_ShapeKeyBezierPoint_handle_2_co_set", NULL);
+	RNA_def_property_float_funcs(prop, "rna_ShapeKeyBezierPoint_handle_2_co_get",
+	                             "rna_ShapeKeyBezierPoint_handle_2_co_set", NULL);
 	RNA_def_property_ui_text(prop, "Handle 2 Location", "");
 	RNA_def_property_update(prop, 0, "rna_Key_update_data");
 
-	/* appears to be unused currently
-	prop= RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_NONE);
+	/* appears to be unused currently */
+#if 0
+	prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_funcs(prop, "rna_ShapeKeyBezierPoint_tilt_get", "rna_ShapeKeyBezierPoint_tilt_set", NULL);
 	RNA_def_property_ui_text(prop, "Tilt", "");
-	RNA_def_property_update(prop, 0, "rna_Key_update_data"); */
+	RNA_def_property_update(prop, 0, "rna_Key_update_data");
+#endif
 }
 
 static void rna_def_keyblock(BlenderRNA *brna)
@@ -512,74 +521,77 @@ static void rna_def_keyblock(BlenderRNA *brna)
 		{KEY_BSPLINE, "KEY_BSPLINE", 0, "BSpline", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "ShapeKey", NULL);
+	srna = RNA_def_struct(brna, "ShapeKey", NULL);
 	RNA_def_struct_ui_text(srna, "Shape Key", "Shape key in a shape keys datablock");
 	RNA_def_struct_sdna(srna, "KeyBlock");
 	RNA_def_struct_path_func(srna, "rna_ShapeKey_path");
 	RNA_def_struct_ui_icon(srna, ICON_SHAPEKEY_DATA);
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Name", "Name of Shape Key");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ShapeKey_name_set");
 	RNA_def_struct_name_property(srna, prop);
 
 	/* keys need to be sorted to edit this */
-	prop= RNA_def_property(srna, "frame", PROP_FLOAT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame", PROP_FLOAT, PROP_TIME);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_float_sdna(prop, NULL, "pos");
 	RNA_def_property_ui_text(prop, "Frame", "Frame for absolute keys");
 	RNA_def_property_update(prop, 0, "rna_Key_update_data");
 	
-	/* for now, this is editable directly, as users can set this even if they're not animating them (to test results) */
-	prop= RNA_def_property(srna, "value", PROP_FLOAT, PROP_FACTOR);
+	/* for now, this is editable directly, as users can set this even if they're not animating them
+	 * (to test results) */
+	prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "curval");
 	RNA_def_property_float_funcs(prop, NULL, "rna_ShapeKey_value_set", "rna_ShapeKey_value_range");
 	RNA_def_property_ui_range(prop, -10.0f, 10.0f, 10, 3);
 	RNA_def_property_ui_text(prop, "Value", "Value of shape key at the current frame");
 	RNA_def_property_update(prop, 0, "rna_Key_update_data");
 
-	prop= RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, prop_keyblock_type_items);
 	RNA_def_property_ui_text(prop, "Interpolation", "Interpolation type");
 	RNA_def_property_update(prop, 0, "rna_Key_update_data");
 
-	prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "vgroup");
 	RNA_def_property_ui_text(prop, "Vertex Group", "Vertex weight group, to blend with basis shape");
 	RNA_def_property_update(prop, 0, "rna_Key_update_data");
 
-	prop= RNA_def_property(srna, "relative_key", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "relative_key", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "ShapeKey");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
-	RNA_def_property_pointer_funcs(prop, "rna_ShapeKey_relative_key_get", "rna_ShapeKey_relative_key_set", NULL, NULL);
+	RNA_def_property_pointer_funcs(prop, "rna_ShapeKey_relative_key_get",
+	                               "rna_ShapeKey_relative_key_set", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Relative Key", "Shape used as a relative key");
 	RNA_def_property_update(prop, 0, "rna_Key_update_data");
 
-	prop= RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYBLOCK_MUTE);
 	RNA_def_property_ui_text(prop, "Mute", "Mute this shape key");
 	RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1);
 	RNA_def_property_update(prop, 0, "rna_Key_update_data");
 
-	prop= RNA_def_property(srna, "slider_min", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "slider_min", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "slidermin");
 	RNA_def_property_range(prop, -10.0f, 10.0f);
 	RNA_def_property_float_funcs(prop, NULL, "rna_ShapeKey_slider_min_set", "rna_ShapeKey_slider_min_range");
 	RNA_def_property_ui_text(prop, "Slider Min", "Minimum for slider");
 
-	prop= RNA_def_property(srna, "slider_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "slider_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "slidermax");
 	RNA_def_property_range(prop, -10.0f, 10.0f);
 	RNA_def_property_float_default(prop, 1.0f);
 	RNA_def_property_float_funcs(prop, NULL, "rna_ShapeKey_slider_max_set", "rna_ShapeKey_slider_max_range");
 	RNA_def_property_ui_text(prop, "Slider Max", "Maximum for slider");
 
-	prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "data", "totelem");
 	RNA_def_property_struct_type(prop, "UnknownType");
 	RNA_def_property_ui_text(prop, "Data", "");
-	RNA_def_property_collection_funcs(prop, "rna_ShapeKey_data_begin", NULL, NULL, "rna_ShapeKey_data_get", "rna_ShapeKey_data_length", NULL, NULL, NULL);
+	RNA_def_property_collection_funcs(prop, "rna_ShapeKey_data_begin", NULL, NULL, "rna_ShapeKey_data_get",
+	                                  "rna_ShapeKey_data_length", NULL, NULL, NULL);
 }
 
 static void rna_def_key(BlenderRNA *brna)
@@ -587,37 +599,46 @@ static void rna_def_key(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "Key", "ID");
+	srna = RNA_def_struct(brna, "Key", "ID");
 	RNA_def_struct_ui_text(srna, "Key", "Shape keys datablock containing different shapes of geometric datablocks");
 	RNA_def_struct_ui_icon(srna, ICON_SHAPEKEY_DATA);
 
-	prop= RNA_def_property(srna, "reference_key", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "reference_key", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_pointer_sdna(prop, NULL, "refkey");
 	RNA_def_property_ui_text(prop, "Reference Key", "");
 
-	prop= RNA_def_property(srna, "key_blocks", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "key_blocks", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "block", NULL);
 	RNA_def_property_struct_type(prop, "ShapeKey");
 	RNA_def_property_ui_text(prop, "Key Blocks", "Shape keys");
 
 	rna_def_animdata_common(srna);
 
-	prop= RNA_def_property(srna, "user", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "user", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "from");
 	RNA_def_property_ui_text(prop, "User", "Datablock using these shape keys");
 
-	prop= RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "type", KEY_RELATIVE);
-	RNA_def_property_ui_text(prop, "Relative", "Make shape keys relative");
+	RNA_def_property_ui_text(prop, "Relative",
+	                         "Make shape keys relative, "
+	                         "otherwise play through shapes as a sequence using the evaluation time");
 	RNA_def_property_update(prop, 0, "rna_Key_update_data");
 
-	prop= RNA_def_property(srna, "slurph", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "eval_time", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "ctime");
+	RNA_def_property_range(prop, MINFRAME, MAXFRAME);
+	RNA_def_property_ui_text(prop, "Evaluation Time", "Evaluation time for absolute shape keys");
+	RNA_def_property_update(prop, 0, "rna_Key_update_data");
+
+	prop = RNA_def_property(srna, "slurph", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "slurph");
 	RNA_def_property_range(prop, -500, 500);
-	RNA_def_property_ui_text(prop, "Slurph", "Create a delay (in frames) in applying keypositions, first vertex goes first");
+	RNA_def_property_ui_text(prop, "Slurph",
+	                         "Create a delay (in frames) in applying keypositions, first vertex goes first");
 	RNA_def_property_update(prop, 0, "rna_Key_update_data");
 }
 
@@ -629,4 +650,3 @@ void RNA_def_key(BlenderRNA *brna)
 }
 
 #endif
-
diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c
index 7de2d55..671bee8 100644
--- a/source/blender/makesrna/intern/rna_lamp.c
+++ b/source/blender/makesrna/intern/rna_lamp.c
@@ -52,10 +52,10 @@
 
 static void rna_Lamp_buffer_size_set(PointerRNA *ptr, int value)
 {
-	Lamp *la= (Lamp*)ptr->data;
+	Lamp *la = (Lamp*)ptr->data;
 
 	CLAMP(value, 512, 10240);
-	la->bufsize= value;
+	la->bufsize = value;
 	la->bufsize &= (~15); /* round to multiple of 16 */
 }
 
@@ -66,31 +66,31 @@ static PointerRNA rna_Lamp_sky_settings_get(PointerRNA *ptr)
 
 static void rna_Lamp_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Lamp *la= (Lamp*)ptr->data;
+	Lamp *la = (Lamp*)ptr->data;
 	rna_iterator_array_begin(iter, (void*)la->mtex, sizeof(MTex*), MAX_MTEX, 0, NULL);
 }
 
 static PointerRNA rna_Lamp_active_texture_get(PointerRNA *ptr)
 {
-	Lamp *la= (Lamp*)ptr->data;
+	Lamp *la = (Lamp*)ptr->data;
 	Tex *tex;
 
-	tex= give_current_lamp_texture(la);
+	tex = give_current_lamp_texture(la);
 	return rna_pointer_inherit_refine(ptr, &RNA_Texture, tex);
 }
 
 static void rna_Lamp_active_texture_set(PointerRNA *ptr, PointerRNA value)
 {
-	Lamp *la= (Lamp*)ptr->data;
+	Lamp *la = (Lamp*)ptr->data;
 
 	set_current_lamp_texture(la, value.data);
 }
 
 static StructRNA* rna_Lamp_refine(struct PointerRNA *ptr)
 {
-	Lamp *la= (Lamp*)ptr->data;
+	Lamp *la = (Lamp*)ptr->data;
 
-	switch(la->type) {
+	switch (la->type) {
 		case LA_LOCAL:
 			return &RNA_PointLamp;
 		case LA_SUN:
@@ -108,10 +108,10 @@ static StructRNA* rna_Lamp_refine(struct PointerRNA *ptr)
 
 static void rna_Lamp_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
 {
-	Lamp *la= ptr->id.data;
+	Lamp *la = ptr->id.data;
 
 	DAG_id_tag_update(&la->id, 0);
-	if(scene->gm.matmode == GAME_MAT_GLSL)
+	if (scene->gm.matmode == GAME_MAT_GLSL)
 		WM_main_add_notifier(NC_LAMP|ND_LIGHTING_DRAW, la);
 	else
 		WM_main_add_notifier(NC_LAMP|ND_LIGHTING, la);
@@ -119,7 +119,7 @@ static void rna_Lamp_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
 
 static void rna_Lamp_draw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	Lamp *la= ptr->id.data;
+	Lamp *la = ptr->id.data;
 
 	DAG_id_tag_update(&la->id, 0);
 	WM_main_add_notifier(NC_LAMP|ND_LIGHTING_DRAW, la);
@@ -127,7 +127,7 @@ static void rna_Lamp_draw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Poin
 
 static void rna_Lamp_sky_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	Lamp *la= ptr->id.data;
+	Lamp *la = ptr->id.data;
 
 	DAG_id_tag_update(&la->id, 0);
 	WM_main_add_notifier(NC_LAMP|ND_SKY, la);
@@ -136,21 +136,21 @@ static void rna_Lamp_sky_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Point
 /* only for rad/deg conversion! can remove later */
 static float rna_Lamp_spot_size_get(PointerRNA *ptr)
 {
-	Lamp *la= ptr->id.data;
+	Lamp *la = ptr->id.data;
 	return DEG2RADF(la->spotsize);
 }
 
 static void rna_Lamp_spot_size_set(PointerRNA *ptr, float value)
 {
-	Lamp *la= ptr->id.data;
-	la->spotsize= RAD2DEGF(value);
+	Lamp *la = ptr->id.data;
+	la->spotsize = RAD2DEGF(value);
 }
 
 static void rna_Lamp_use_nodes_update(Main *blain, Scene *scene, PointerRNA *ptr)
 {
-	Lamp *la= (Lamp*)ptr->data;
+	Lamp *la = (Lamp*)ptr->data;
 
-	if(la->use_nodes && la->nodetree==NULL)
+	if (la->use_nodes && la->nodetree == NULL)
 		ED_node_shader_default(scene, &la->id);
 	
 	rna_Lamp_update(blain, scene, ptr);
@@ -177,38 +177,38 @@ static void rna_def_lamp_mtex(BlenderRNA *brna)
 		{TEXCO_OBJECT, "OBJECT", 0, "Object", "Use linked object's coordinates for texture coordinates"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "LampTextureSlot", "TextureSlot");
+	srna = RNA_def_struct(brna, "LampTextureSlot", "TextureSlot");
 	RNA_def_struct_sdna(srna, "MTex");
 	RNA_def_struct_ui_text(srna, "Lamp Texture Slot", "Texture slot for textures in a Lamp datablock");
 
-	prop= RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "texco");
 	RNA_def_property_enum_items(prop, prop_texture_coordinates_items);
 	RNA_def_property_ui_text(prop, "Texture Coordinates", "");
 
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "object");
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Object", "Object to use for mapping with Object texture coordinates");
 
-	prop= RNA_def_property(srna, "use_map_color", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_color", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", LAMAP_COL);
 	RNA_def_property_ui_text(prop, "Color", "Let the texture affect the basic color of the lamp");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, "use_map_shadow", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_shadow", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", LAMAP_SHAD);
 	RNA_def_property_ui_text(prop, "Shadow", "Let the texture affect the shadow color of the lamp");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, "color_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "color_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "colfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Color Factor", "Amount texture affects color values");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, "shadow_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "shadow_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "shadowfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Shadow Factor", "Amount texture affects shadow");
@@ -226,18 +226,18 @@ static void rna_def_lamp_sky_settings(BlenderRNA *brna)
 		{2, "CIE", 0, "CIE", ""},
 		{0, NULL, 0, NULL, NULL}};
 		
-	srna= RNA_def_struct(brna, "LampSkySettings", NULL);
+	srna = RNA_def_struct(brna, "LampSkySettings", NULL);
 	RNA_def_struct_sdna(srna, "Lamp");
 	RNA_def_struct_nested(brna, srna, "SunLamp");
 	RNA_def_struct_ui_text(srna, "Lamp Sky Settings", "Sky related settings for a sun lamp");
 		
-	prop= RNA_def_property(srna, "sky_color_space", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "sky_color_space", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "sky_colorspace");
 	RNA_def_property_enum_items(prop, prop_skycolorspace_items);
 	RNA_def_property_ui_text(prop, "Sky Color Space", "Color space to use for internal XYZ->RGB color conversion");
 	RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
 
-	prop= RNA_def_property(srna, "sky_blend_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "sky_blend_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "skyblendtype");
 	RNA_def_property_enum_items(prop, ramp_blend_items);
 	RNA_def_property_ui_text(prop, "Sky Blend Mode", "Blend mode for combining sun sky with world sky");
@@ -245,80 +245,81 @@ static void rna_def_lamp_sky_settings(BlenderRNA *brna)
 	
 	/* Number values */
 	
-	prop= RNA_def_property(srna, "horizon_brightness", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "horizon_brightness", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 20.0f);
 	RNA_def_property_ui_text(prop, "Horizon Brightness", "Horizon brightness");
 	RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
 
-	prop= RNA_def_property(srna, "spread", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "spread", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Horizon Spread", "Horizon Spread");
 	RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
 
-	prop= RNA_def_property(srna, "sun_brightness", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "sun_brightness", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Sun Brightness", "Sun brightness");
 	RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
 
-	prop= RNA_def_property(srna, "sun_size", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "sun_size", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Sun Size", "Sun size");
 	RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
 
-	prop= RNA_def_property(srna, "backscattered_light", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "backscattered_light", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, -1.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Backscattered Light", "Backscattered light");
 	RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
 
-	prop= RNA_def_property(srna, "sun_intensity", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "sun_intensity", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Sun Intensity", "Sun intensity");
 	RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
 
-	prop= RNA_def_property(srna, "atmosphere_turbidity", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "atmosphere_turbidity", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "atm_turbidity");
 	RNA_def_property_range(prop, 1.0f, 30.0f);
 	RNA_def_property_ui_range(prop, 2.0f, 10.0f, 1, 2);
 	RNA_def_property_ui_text(prop, "Atmosphere Turbidity", "Sky turbidity");
 	RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
 
-	prop= RNA_def_property(srna, "atmosphere_inscattering", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "atmosphere_inscattering", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "atm_inscattering_factor");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Atmosphere Inscatter", "Scatter contribution factor");
 	RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
 
-	prop= RNA_def_property(srna, "atmosphere_extinction", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "atmosphere_extinction", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "atm_extinction_factor");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Atmosphere Extinction", "Extinction scattering contribution factor");
 	RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
 
-	prop= RNA_def_property(srna, "atmosphere_distance_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "atmosphere_distance_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "atm_distance_factor");
 	RNA_def_property_range(prop, 0.0f, 500.0f);
-	RNA_def_property_ui_text(prop, "Atmosphere Distance Factor", "Multiplier to convert blender units to physical distance");
+	RNA_def_property_ui_text(prop, "Atmosphere Distance Factor",
+	                         "Multiplier to convert blender units to physical distance");
 	RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
 
-	prop= RNA_def_property(srna, "sky_blend", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "sky_blend", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "skyblendfac");
 	RNA_def_property_range(prop, 0.0f, 2.0f);
 	RNA_def_property_ui_text(prop, "Sky Blend", "Blend factor with sky");
 	RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
 
-	prop= RNA_def_property(srna, "sky_exposure", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "sky_exposure", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 20.0f);
 	RNA_def_property_ui_text(prop, "Sky Exposure", "Strength of sky shading exponential exposure correction");
 	RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
 
 	/* boolean */
 	
-	prop= RNA_def_property(srna, "use_sky", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_sky", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "sun_effect_type", LA_SUN_EFFECT_SKY);
 	RNA_def_property_ui_text(prop, "Sky", "Apply sun effect on sky");
 	RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
 
-	prop= RNA_def_property(srna, "use_atmosphere", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_atmosphere", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "sun_effect_type", LA_SUN_EFFECT_AP);
 	RNA_def_property_ui_text(prop, "Atmosphere", "Apply sun effect on atmosphere");
 	RNA_def_property_update(prop, 0, "rna_Lamp_sky_update");
@@ -329,60 +330,61 @@ static void rna_def_lamp(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "Lamp", "ID");
+	srna = RNA_def_struct(brna, "Lamp", "ID");
 	RNA_def_struct_refine_func(srna, "rna_Lamp_refine");
 	RNA_def_struct_ui_text(srna, "Lamp", "Lamp datablock for lighting a scene");
 	RNA_def_struct_ui_icon(srna, ICON_LAMP_DATA);
 
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, lamp_type_items);
 	RNA_def_property_ui_text(prop, "Type", "Type of Lamp");
 	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
 
-	prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "dist");
 	RNA_def_property_range(prop, 0, INT_MAX);
 	RNA_def_property_ui_range(prop, 0, 1000, 1, 3);
-	RNA_def_property_ui_text(prop, "Distance", "Falloff distance - the light is at half the original intensity at this point");
+	RNA_def_property_ui_text(prop, "Distance",
+	                         "Falloff distance - the light is at half the original intensity at this point");
 	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
 
-	prop= RNA_def_property(srna, "energy", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "energy", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_ui_range(prop, 0, 10, 1, 3);
 	RNA_def_property_ui_text(prop, "Energy", "Amount of light that the lamp emits");
 	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
 
-	prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "r");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Color", "Light color");
 	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
 
-	prop= RNA_def_property(srna, "use_own_layer", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_own_layer", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_LAYER);
 	RNA_def_property_ui_text(prop, "Layer", "Illuminate objects only on the same layers the lamp is on");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, "use_negative", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_negative", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_NEG);
 	RNA_def_property_ui_text(prop, "Negative", "Cast negative light");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, "use_specular", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_specular", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "mode", LA_NO_SPEC);
 	RNA_def_property_ui_text(prop, "Specular", "Create specular highlights");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, "use_diffuse", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_diffuse", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "mode", LA_NO_DIFF);
 	RNA_def_property_ui_text(prop, "Diffuse", "Do diffuse shading");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
 	/* nodes */
-	prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
 	RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node based lamps");
 
-	prop= RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the lamp");
@@ -408,28 +410,28 @@ static void rna_def_lamp_falloff(StructRNA *srna)
 		{LA_FALLOFF_SLIDERS, "LINEAR_QUADRATIC_WEIGHTED", 0, "Lin/Quad Weighted", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	prop= RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, prop_fallofftype_items);
 	RNA_def_property_ui_text(prop, "Falloff Type", "Intensity Decay with distance");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 	
-	prop= RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "curfalloff");
 	RNA_def_property_ui_text(prop, "Falloff Curve", "Custom Lamp Falloff Curve");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, "use_sphere", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_sphere", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_SPHERE);
 	RNA_def_property_ui_text(prop, "Sphere", "Set light intensity to zero beyond lamp distance");
 	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
 
-	prop= RNA_def_property(srna, "linear_attenuation", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "linear_attenuation", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "att1");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Linear Attenuation", "Linear distance attenuation");
 	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
 
-	prop= RNA_def_property(srna, "quadratic_attenuation", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "quadratic_attenuation", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "att2");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Quadratic Attenuation", "Quadratic distance attenuation");
@@ -462,56 +464,60 @@ static void rna_def_lamp_shadow(StructRNA *srna, int spot, int area)
 		{LA_SAMP_CONSTANT, "CONSTANT_JITTERED", 0, "Constant Jittered", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	prop= RNA_def_property(srna, "shadow_method", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "shadow_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode");
 	RNA_def_property_enum_items(prop, (spot)? prop_spot_shadow_items: prop_shadow_items);
 	RNA_def_property_ui_text(prop, "Shadow Method", "Method to compute lamp shadow with");
 	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
 
-	prop= RNA_def_property(srna, "shadow_color", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "shadow_color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "shdwr");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Shadow Color", "Color of shadows cast by the lamp");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, "use_only_shadow", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_only_shadow", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_ONLYSHADOW);
 	RNA_def_property_ui_text(prop, "Only Shadow", "Cast shadows only, without illuminating objects");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, "shadow_ray_sample_method", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "shadow_ray_sample_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "ray_samp_method");
 	RNA_def_property_enum_items(prop, (area)? prop_spot_ray_sampling_method_items: prop_ray_sampling_method_items);
-	RNA_def_property_ui_text(prop, "Shadow Ray Sampling Method", "Method for generating shadow samples: Adaptive QMC is fastest, Constant QMC is less noisy but slower");
+	RNA_def_property_ui_text(prop, "Shadow Ray Sampling Method",
+	                         "Method for generating shadow samples: Adaptive QMC is fastest, "
+	                         "Constant QMC is less noisy but slower");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, (area)? "shadow_ray_samples_x": "shadow_ray_samples", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, (area)? "shadow_ray_samples_x": "shadow_ray_samples", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "ray_samp");
 	RNA_def_property_range(prop, 1, 64);
-	RNA_def_property_ui_text(prop, (area)? "Shadow Ray Samples": "Shadow Ray Samples X","Number of samples taken extra (samples x samples)");
+	RNA_def_property_ui_text(prop, (area)? "Shadow Ray Samples": "Shadow Ray Samples X",
+	                         "Number of samples taken extra (samples x samples)");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	if(area) {
-		prop= RNA_def_property(srna, "shadow_ray_samples_y", PROP_INT, PROP_NONE);
+	if (area) {
+		prop = RNA_def_property(srna, "shadow_ray_samples_y", PROP_INT, PROP_NONE);
 		RNA_def_property_int_sdna(prop, NULL, "ray_sampy");
 		RNA_def_property_range(prop, 1, 64);
-		RNA_def_property_ui_text(prop, "Shadow Ray Samples Y", "Number of samples taken extra (samples x samples)");
+		RNA_def_property_ui_text(prop, "Shadow Ray Samples Y",
+		                         "Number of samples taken extra (samples x samples)");
 		RNA_def_property_update(prop, 0, "rna_Lamp_update");
 	}
 
-	prop= RNA_def_property(srna, "shadow_adaptive_threshold", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "shadow_adaptive_threshold", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "adapt_thresh");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Shadow Adaptive Threshold", "Threshold for Adaptive Sampling (Raytraced shadows)");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, "shadow_soft_size", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "shadow_soft_size", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "area_size");
 	RNA_def_property_ui_range(prop, 0, 100, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Shadow Soft Size", "Light size for ray shadow sampling (Raytraced shadows)");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, "use_shadow_layer", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_shadow_layer", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_LAYER_SHADOW);
 	RNA_def_property_ui_text(prop, "Shadow Layer", "Objects on the same layers only cast shadows");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
@@ -521,7 +527,7 @@ static void rna_def_point_lamp(BlenderRNA *brna)
 {
 	StructRNA *srna;
 
-	srna= RNA_def_struct(brna, "PointLamp", "Lamp");
+	srna = RNA_def_struct(brna, "PointLamp", "Lamp");
 	RNA_def_struct_sdna(srna, "Lamp");
 	RNA_def_struct_ui_text(srna, "Point Lamp", "Omnidirectional point lamp");
 	RNA_def_struct_ui_icon(srna, ICON_LAMP_POINT);
@@ -540,47 +546,48 @@ static void rna_def_area_lamp(BlenderRNA *brna)
 		{LA_AREA_RECT, "RECTANGLE", 0, "Rectangle", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "AreaLamp", "Lamp");
+	srna = RNA_def_struct(brna, "AreaLamp", "Lamp");
 	RNA_def_struct_sdna(srna, "Lamp");
 	RNA_def_struct_ui_text(srna, "Area Lamp", "Directional area lamp");
 	RNA_def_struct_ui_icon(srna, ICON_LAMP_AREA);
 
 	rna_def_lamp_shadow(srna, 0, 1);
 
-	prop= RNA_def_property(srna, "use_umbra", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_umbra", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ray_samp_type", LA_SAMP_UMBRA);
 	RNA_def_property_ui_text(prop, "Umbra", "Emphasize parts that are fully shadowed (Constant Jittered sampling)");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, "use_dither", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_dither", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ray_samp_type", LA_SAMP_DITHER);
 	RNA_def_property_ui_text(prop, "Dither", "Use 2x2 dithering for sampling  (Constant Jittered sampling)");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, "use_jitter", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_jitter", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ray_samp_type", LA_SAMP_JITTER);
 	RNA_def_property_ui_text(prop, "Jitter", "Use noise for sampling  (Constant Jittered sampling)");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, "shape", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "shape", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "area_shape");
 	RNA_def_property_enum_items(prop, prop_areashape_items);
 	RNA_def_property_ui_text(prop, "Shape", "Shape of the area lamp");
 	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
 
-	prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "area_size");
 	RNA_def_property_ui_range(prop, 0, 100, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Size", "Size of the area of the area Lamp, X direction size for Rectangle shapes");
 	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
 
-	prop= RNA_def_property(srna, "size_y", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "size_y", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "area_sizey");
 	RNA_def_property_ui_range(prop, 0, 100, 0.1, 3);
-	RNA_def_property_ui_text(prop, "Size Y", "Size of the area of the area Lamp in the Y direction for Rectangle shapes");
+	RNA_def_property_ui_text(prop, "Size Y",
+	                         "Size of the area of the area Lamp in the Y direction for Rectangle shapes");
 	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
 
-	prop= RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "k");
 	RNA_def_property_ui_range(prop, 0.001, 2.0, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Gamma", "Light gamma correction value");
@@ -594,9 +601,14 @@ static void rna_def_spot_lamp(BlenderRNA *brna)
 
 	static EnumPropertyItem prop_shadbuftype_items[] = {
 		{LA_SHADBUF_REGULAR	, "REGULAR", 0, "Classical", "Classic shadow buffer"},
-		{LA_SHADBUF_HALFWAY, "HALFWAY", 0, "Classic-Halfway", "Regular buffer, averaging the closest and 2nd closest Z value to reducing bias artifacts"},
-		{LA_SHADBUF_IRREGULAR, "IRREGULAR", 0, "Irregular", "Irregular buffer produces sharp shadow always, but it doesn't show up for raytracing"},
-		{LA_SHADBUF_DEEP, "DEEP", 0, "Deep", "Deep shadow buffer supports transparency and better filtering, at the cost of more memory usage and processing time"},
+		{LA_SHADBUF_HALFWAY, "HALFWAY", 0, "Classic-Halfway",
+		                     "Regular buffer, averaging the closest and 2nd closest Z value to reducing "
+		                     "bias artifacts"},
+		{LA_SHADBUF_IRREGULAR, "IRREGULAR", 0, "Irregular",
+		                       "Irregular buffer produces sharp shadow always, but it doesn't show up for raytracing"},
+		{LA_SHADBUF_DEEP, "DEEP", 0, "Deep",
+		                  "Deep shadow buffer supports transparency and better filtering, at the cost of "
+		                  "more memory usage and processing time"},
 		{0, NULL, 0, NULL, NULL}};
 
 	static EnumPropertyItem prop_shadbuffiltertype_items[] = {
@@ -611,7 +623,7 @@ static void rna_def_spot_lamp(BlenderRNA *brna)
 		{9, "BUFFERS_9", 0, "9", "Render 9 buffers for better AA, this uses nine times more memory"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "SpotLamp", "Lamp");
+	srna = RNA_def_struct(brna, "SpotLamp", "Lamp");
 	RNA_def_struct_sdna(srna, "Lamp");
 	RNA_def_struct_ui_text(srna, "Spot Lamp", "Directional cone lamp");
 	RNA_def_struct_ui_icon(srna, ICON_LAMP_SPOT);
@@ -619,112 +631,120 @@ static void rna_def_spot_lamp(BlenderRNA *brna)
 	rna_def_lamp_falloff(srna);
 	rna_def_lamp_shadow(srna, 1, 0);
 
-	prop= RNA_def_property(srna, "use_square", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_square", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_SQUARE);
 	RNA_def_property_ui_text(prop, "Square", "Cast a square spot light shape");
 	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
 
-	prop= RNA_def_property(srna, "use_halo", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_halo", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_HALO);
 	RNA_def_property_ui_text(prop, "Halo", "Render spotlight with a volumetric halo");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, "halo_intensity", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "halo_intensity", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "haint");
 	RNA_def_property_ui_range(prop, 0, 5.0, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Halo Intensity", "Brightness of the spotlight's halo cone");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, "halo_step", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "halo_step", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "shadhalostep");
 	RNA_def_property_range(prop, 0, 12);
 	RNA_def_property_ui_text(prop, "Halo Step", "Volumetric halo sampling frequency");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, "shadow_buffer_size", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "shadow_buffer_size", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "bufsize");
 	RNA_def_property_range(prop, 512, 10240);
-	RNA_def_property_ui_text(prop, "Shadow Buffer Size", "Resolution of the shadow buffer, higher values give crisper shadows but use more memory");
+	RNA_def_property_ui_text(prop, "Shadow Buffer Size",
+	                         "Resolution of the shadow buffer, higher values give crisper shadows "
+	                         "but use more memory");
 	RNA_def_property_int_funcs(prop, NULL, "rna_Lamp_buffer_size_set", NULL);
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, "shadow_filter_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "shadow_filter_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "filtertype");
 	RNA_def_property_enum_items(prop, prop_shadbuffiltertype_items);
 	RNA_def_property_ui_text(prop, "Shadow Filter Type", "Type of shadow filter (Buffer Shadows)");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, "shadow_sample_buffers", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "shadow_sample_buffers", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "buffers");
 	RNA_def_property_enum_items(prop, prop_numbuffer_items);
-	RNA_def_property_ui_text(prop, "Shadow Sample Buffers", "Number of shadow buffers to render for better AA, this increases memory usage");
+	RNA_def_property_ui_text(prop, "Shadow Sample Buffers",
+	                         "Number of shadow buffers to render for better AA, this increases memory usage");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, "spot_blend", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "spot_blend", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "spotblend");
 	RNA_def_property_range(prop, 0.0f ,1.0f);
 	RNA_def_property_ui_text(prop, "Spot Blend", "The softness of the spotlight edge");
 	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
 
-	prop= RNA_def_property(srna, "spot_size", PROP_FLOAT, PROP_ANGLE);
-	// RNA_def_property_float_sdna(prop, NULL, "spotsize");
+	prop = RNA_def_property(srna, "spot_size", PROP_FLOAT, PROP_ANGLE);
+	/* RNA_def_property_float_sdna(prop, NULL, "spotsize"); */
 	RNA_def_property_range(prop, M_PI/180.0, M_PI);
 	RNA_def_property_ui_text(prop, "Spot Size", "Angle of the spotlight beam");
-	RNA_def_property_float_funcs(prop, "rna_Lamp_spot_size_get", "rna_Lamp_spot_size_set", NULL); /* only for deg/rad conversion */
+		/* only for deg/rad conversion */
+	RNA_def_property_float_funcs(prop, "rna_Lamp_spot_size_get", "rna_Lamp_spot_size_set", NULL);
 	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
 
-	prop= RNA_def_property(srna, "show_cone", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_cone", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_SHOW_CONE);
-	RNA_def_property_ui_text(prop, "Show Cone", "Draw transparent cone in 3D view to visualize which objects are contained in it");
+	RNA_def_property_ui_text(prop, "Show Cone",
+	                         "Draw transparent cone in 3D view to visualize which objects are contained in it");
 	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
 
-	prop= RNA_def_property(srna, "shadow_buffer_clip_start", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "shadow_buffer_clip_start", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "clipsta");
 	RNA_def_property_range(prop, 0.0f, 9999.0f);
-	RNA_def_property_ui_text(prop, "Shadow Buffer Clip Start", "Shadow map clip start, below which objects will not generate shadows");
+	RNA_def_property_ui_text(prop, "Shadow Buffer Clip Start",
+	                         "Shadow map clip start, below which objects will not generate shadows");
 	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
 
-	prop= RNA_def_property(srna, "shadow_buffer_clip_end", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "shadow_buffer_clip_end", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "clipend");
 	RNA_def_property_range(prop, 0.0f, 9999.0f);
-	RNA_def_property_ui_text(prop, "Shadow Buffer Clip End", "Shadow map clip end, beyond which objects will not generate shadows");
+	RNA_def_property_ui_text(prop, "Shadow Buffer Clip End",
+	                         "Shadow map clip end, beyond which objects will not generate shadows");
 	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
 
-	prop= RNA_def_property(srna, "shadow_buffer_bias", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "shadow_buffer_bias", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "bias");
 	RNA_def_property_range(prop, 0.001f, 5.0f);
 	RNA_def_property_ui_text(prop, "Shadow Buffer Bias", "Shadow buffer sampling bias");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, "shadow_buffer_soft", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "shadow_buffer_soft", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "soft");
 	RNA_def_property_range(prop, 0.0f, 100.0f);
 	RNA_def_property_ui_text(prop, "Shadow Buffer Soft", "Size of shadow buffer sampling area");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, "shadow_buffer_samples", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "shadow_buffer_samples", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "samp");
 	RNA_def_property_range(prop, 1, 16);
 	RNA_def_property_ui_text(prop, "Samples", "Number of shadow buffer samples");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, "shadow_buffer_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "shadow_buffer_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "buftype");
 	RNA_def_property_enum_items(prop, prop_shadbuftype_items);
 	RNA_def_property_ui_text(prop, "Shadow Buffer Type", "Type of shadow buffer");
 	RNA_def_property_update(prop, 0, "rna_Lamp_update");
 
-	prop= RNA_def_property(srna, "use_auto_clip_start", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_auto_clip_start", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "bufflag", LA_SHADBUF_AUTO_START);
-	RNA_def_property_ui_text(prop, "Autoclip Start",  "Automatic calculation of clipping-start, based on visible vertices");
+	RNA_def_property_ui_text(prop, "Autoclip Start",
+	                         "Automatic calculation of clipping-start, based on visible vertices");
 	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
 
-	prop= RNA_def_property(srna, "use_auto_clip_end", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_auto_clip_end", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "bufflag", LA_SHADBUF_AUTO_END);
 	RNA_def_property_ui_text(prop, "Autoclip End", "Automatic calculation of clipping-end, based on visible vertices");
 	RNA_def_property_update(prop, 0, "rna_Lamp_draw_update");
 
-	prop= RNA_def_property(srna, "compression_threshold", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "compression_threshold", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "compressthresh");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Compress", "Deep shadow map compression threshold");
@@ -736,7 +756,7 @@ static void rna_def_sun_lamp(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "SunLamp", "Lamp");
+	srna = RNA_def_struct(brna, "SunLamp", "Lamp");
 	RNA_def_struct_sdna(srna, "Lamp");
 	RNA_def_struct_ui_text(srna, "Sun Lamp", "Constant direction parallel ray lamp");
 	RNA_def_struct_ui_icon(srna, ICON_LAMP_SUN);
@@ -744,7 +764,7 @@ static void rna_def_sun_lamp(BlenderRNA *brna)
 	rna_def_lamp_shadow(srna, 0, 0);
 
 	/* sky */
-	prop= RNA_def_property(srna, "sky", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "sky", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "LampSkySettings");
 	RNA_def_property_pointer_funcs(prop, "rna_Lamp_sky_settings_get", NULL, NULL, NULL);
@@ -757,7 +777,7 @@ static void rna_def_hemi_lamp(BlenderRNA *brna)
 {
 	StructRNA *srna;
 
-	srna= RNA_def_struct(brna, "HemiLamp", "Lamp");
+	srna = RNA_def_struct(brna, "HemiLamp", "Lamp");
 	RNA_def_struct_sdna(srna, "Lamp");
 	RNA_def_struct_ui_text(srna, "Hemi Lamp", "180 degree constant lamp");
 	RNA_def_struct_ui_icon(srna, ICON_LAMP_HEMI);
@@ -775,4 +795,3 @@ void RNA_def_lamp(BlenderRNA *brna)
 }
 
 #endif
-
diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c
index 9fe6b23..5d8d8c7 100644
--- a/source/blender/makesrna/intern/rna_lattice.c
+++ b/source/blender/makesrna/intern/rna_lattice.c
@@ -51,25 +51,25 @@
 
 static void rna_LatticePoint_co_get(PointerRNA *ptr, float *values)
 {
-	Lattice *lt= (Lattice*)ptr->id.data;
-	BPoint *bp= (BPoint*)ptr->data;
-	int a= bp - lt->def;
-	int x= a % lt->pntsu;
-	int y= (a/lt->pntsu) % lt->pntsv;
-	int z= (a/(lt->pntsu*lt->pntsv));
-
-	values[0]= lt->fu + x*lt->du;
-	values[1]= lt->fv + y*lt->dv;
-	values[2]= lt->fw + z*lt->dw;
+	Lattice *lt = (Lattice*)ptr->id.data;
+	BPoint *bp = (BPoint*)ptr->data;
+	int a = bp - lt->def;
+	int x = a % lt->pntsu;
+	int y = (a/lt->pntsu) % lt->pntsv;
+	int z = (a/(lt->pntsu*lt->pntsv));
+
+	values[0] = lt->fu + x*lt->du;
+	values[1] = lt->fv + y*lt->dv;
+	values[2] = lt->fw + z*lt->dw;
 }
 
 static void rna_LatticePoint_groups_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Lattice *lt= (Lattice*)ptr->id.data;
+	Lattice *lt = (Lattice*)ptr->id.data;
 
-	if(lt->dvert) {
-		BPoint *bp= (BPoint*)ptr->data;
-		MDeformVert *dvert= lt->dvert + (bp-lt->def);
+	if (lt->dvert) {
+		BPoint *bp = (BPoint*)ptr->data;
+		MDeformVert *dvert = lt->dvert + (bp-lt->def);
 
 		rna_iterator_array_begin(iter, (void*)dvert->dw, sizeof(MDeformWeight), dvert->totweight, 0, NULL);
 	}
@@ -79,12 +79,12 @@ static void rna_LatticePoint_groups_begin(CollectionPropertyIterator *iter, Poin
 
 static void rna_Lattice_points_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Lattice *lt= (Lattice*)ptr->data;
-	int tot= lt->pntsu*lt->pntsv*lt->pntsw;
+	Lattice *lt = (Lattice*)ptr->data;
+	int tot = lt->pntsu*lt->pntsv*lt->pntsw;
 
-	if(lt->editlatt && lt->editlatt->latt->def)
+	if (lt->editlatt && lt->editlatt->latt->def)
 		rna_iterator_array_begin(iter, (void*)lt->editlatt->latt->def, sizeof(BPoint), tot, 0, NULL);
-	else if(lt->def)
+	else if (lt->def)
 		rna_iterator_array_begin(iter, (void*)lt->def, sizeof(BPoint), tot, 0, NULL);
 	else
 		rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL);
@@ -92,7 +92,7 @@ static void rna_Lattice_points_begin(CollectionPropertyIterator *iter, PointerRN
 
 static void rna_Lattice_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	ID *id= ptr->id.data;
+	ID *id = ptr->id.data;
 
 	DAG_id_tag_update(id, 0);
 	WM_main_add_notifier(NC_GEOM|ND_DATA, id);
@@ -100,29 +100,29 @@ static void rna_Lattice_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), P
 
 static void rna_Lattice_update_size(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Lattice *lt= ptr->id.data;
+	Lattice *lt = ptr->id.data;
 	Object *ob;
 	int newu, newv, neww;
 
 	/* we don't modify the actual pnts, but go through opnts instead */
-	newu= (lt->opntsu > 0)? lt->opntsu: lt->pntsu;
-	newv= (lt->opntsv > 0)? lt->opntsv: lt->pntsv;
-	neww= (lt->opntsw > 0)? lt->opntsw: lt->pntsw;
+	newu = (lt->opntsu > 0)? lt->opntsu: lt->pntsu;
+	newv = (lt->opntsv > 0)? lt->opntsv: lt->pntsv;
+	neww = (lt->opntsw > 0)? lt->opntsw: lt->pntsw;
 
 	/* resizelattice needs an object, any object will have the same result */
-	for(ob=bmain->object.first; ob; ob= ob->id.next) {
-		if(ob->data == lt) {
+	for (ob = bmain->object.first; ob; ob = ob->id.next) {
+		if (ob->data == lt) {
 			resizelattice(lt, newu, newv, neww, ob);
-			if(lt->editlatt)
+			if (lt->editlatt)
 				resizelattice(lt->editlatt->latt, newu, newv, neww, ob);
 			break;
 		}
 	}
 
 	/* otherwise without, means old points are not repositioned */
-	if(!ob) {
+	if (!ob) {
 		resizelattice(lt, newu, newv, neww, NULL);
-		if(lt->editlatt)
+		if (lt->editlatt)
 			resizelattice(lt->editlatt->latt, newu, newv, neww, NULL);
 	}
 
@@ -131,15 +131,15 @@ static void rna_Lattice_update_size(Main *bmain, Scene *scene, PointerRNA *ptr)
 
 static void rna_Lattice_use_outside_set(PointerRNA *ptr, int value)
 {
-	Lattice *lt= ptr->data;
+	Lattice *lt = ptr->data;
 
-	if(value) lt->flag |= LT_OUTSIDE;
+	if (value) lt->flag |= LT_OUTSIDE;
 	else lt->flag &= ~LT_OUTSIDE;
 
 	outside_lattice(lt);
 
-	if(lt->editlatt) {
-		if(value) lt->editlatt->latt->flag |= LT_OUTSIDE;
+	if (lt->editlatt) {
+		if (value) lt->editlatt->latt->flag |= LT_OUTSIDE;
 		else lt->editlatt->latt->flag &= ~LT_OUTSIDE;
 
 		outside_lattice(lt->editlatt->latt);
@@ -148,38 +148,38 @@ static void rna_Lattice_use_outside_set(PointerRNA *ptr, int value)
 
 static int rna_Lattice_size_editable(PointerRNA *ptr)
 {
-	Lattice *lt= (Lattice*)ptr->data;
+	Lattice *lt = (Lattice*)ptr->data;
 
 	return lt->key == NULL;
 }
 
 static void rna_Lattice_points_u_set(PointerRNA *ptr, int value)
 {
-	Lattice *lt= (Lattice*)ptr->data;
+	Lattice *lt = (Lattice*)ptr->data;
 
-	lt->opntsu= CLAMPIS(value, 1, 64);
+	lt->opntsu = CLAMPIS(value, 1, 64);
 }
 
 static void rna_Lattice_points_v_set(PointerRNA *ptr, int value)
 {
-	Lattice *lt= (Lattice*)ptr->data;
+	Lattice *lt = (Lattice*)ptr->data;
 
-	lt->opntsv= CLAMPIS(value, 1, 64);
+	lt->opntsv = CLAMPIS(value, 1, 64);
 }
 
 static void rna_Lattice_points_w_set(PointerRNA *ptr, int value)
 {
-	Lattice *lt= (Lattice*)ptr->data;
+	Lattice *lt = (Lattice*)ptr->data;
 
-	lt->opntsw= CLAMPIS(value, 1, 64);
+	lt->opntsw = CLAMPIS(value, 1, 64);
 }
 
 static void rna_Lattice_vg_name_set(PointerRNA *ptr, const char *value)
 {
-	Lattice *lt= ptr->data;
+	Lattice *lt = ptr->data;
 	BLI_strncpy(lt->vgroup, value, sizeof(lt->vgroup));
 
-	if(lt->editlatt) {
+	if (lt->editlatt) {
 		BLI_strncpy(lt->editlatt->latt->vgroup, value, sizeof(lt->editlatt->latt->vgroup));
 	}
 }
@@ -187,8 +187,8 @@ static void rna_Lattice_vg_name_set(PointerRNA *ptr, const char *value)
 /* annoying, but is a consequence of RNA structures... */
 static char *rna_LatticePoint_path(PointerRNA *ptr)
 {
-	Lattice *lt= (Lattice*)ptr->id.data;
-	void *point= ptr->data;
+	Lattice *lt = (Lattice*)ptr->id.data;
+	void *point = ptr->data;
 	BPoint *points = NULL;
 	
 	if (lt->editlatt && lt->editlatt->latt->def)
@@ -197,7 +197,7 @@ static char *rna_LatticePoint_path(PointerRNA *ptr)
 		points = lt->def;
 	
 	if (points && point) {
-		int tot= lt->pntsu*lt->pntsv*lt->pntsw;
+		int tot = lt->pntsu*lt->pntsv*lt->pntsw;
 		
 		/* only return index if in range */
 		if ((point >= (void *)points) && (point < (void *)(points + tot))) {
@@ -218,25 +218,27 @@ static void rna_def_latticepoint(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "LatticePoint", NULL);
+	srna = RNA_def_struct(brna, "LatticePoint", NULL);
 	RNA_def_struct_sdna(srna, "BPoint");
 	RNA_def_struct_ui_text(srna, "LatticePoint", "Point in the lattice grid");
 	RNA_def_struct_path_func(srna, "rna_LatticePoint_path");
 
-	prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_float_funcs(prop, "rna_LatticePoint_co_get", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Location", "");
 
-	prop= RNA_def_property(srna, "co_deform", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "co_deform", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "vec");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Deformed Location", "");
 	RNA_def_property_update(prop, 0, "rna_Lattice_update_data");
 
-	prop= RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
-	RNA_def_property_collection_funcs(prop, "rna_LatticePoint_groups_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
+	prop = RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
+	RNA_def_property_collection_funcs(prop, "rna_LatticePoint_groups_begin", "rna_iterator_array_next",
+	                                  "rna_iterator_array_end", "rna_iterator_array_get",
+	                                  NULL, NULL, NULL, NULL);
 	RNA_def_property_struct_type(prop, "VertexGroupElement");
 	RNA_def_property_ui_text(prop, "Groups", "Weights for the vertex groups this point is member of");
 }
@@ -252,11 +254,11 @@ static void rna_def_lattice(BlenderRNA *brna)
 		{KEY_BSPLINE, "KEY_BSPLINE", 0, "BSpline", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "Lattice", "ID");
+	srna = RNA_def_struct(brna, "Lattice", "ID");
 	RNA_def_struct_ui_text(srna, "Lattice", "Lattice datablock defining a grid for deforming other objects");
 	RNA_def_struct_ui_icon(srna, ICON_LATTICE_DATA);
 
-	prop= RNA_def_property(srna, "points_u", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "points_u", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "pntsu");
 	RNA_def_property_int_funcs(prop, NULL, "rna_Lattice_points_u_set", NULL);
 	RNA_def_property_range(prop, 1, 64);
@@ -264,7 +266,7 @@ static void rna_def_lattice(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_Lattice_update_size");
 	RNA_def_property_editable_func(prop, "rna_Lattice_size_editable");
 
-	prop= RNA_def_property(srna, "points_v", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "points_v", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "pntsv");
 	RNA_def_property_int_funcs(prop, NULL, "rna_Lattice_points_v_set", NULL);
 	RNA_def_property_range(prop, 1, 64);
@@ -272,7 +274,7 @@ static void rna_def_lattice(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_Lattice_update_size");
 	RNA_def_property_editable_func(prop, "rna_Lattice_size_editable");
 
-	prop= RNA_def_property(srna, "points_w", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "points_w", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "pntsw");
 	RNA_def_property_int_funcs(prop, NULL, "rna_Lattice_points_w_set", NULL);
 	RNA_def_property_range(prop, 1, 64);
@@ -280,43 +282,44 @@ static void rna_def_lattice(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_Lattice_update_size");
 	RNA_def_property_editable_func(prop, "rna_Lattice_size_editable");
 
-	prop= RNA_def_property(srna, "interpolation_type_u", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "interpolation_type_u", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "typeu");
 	RNA_def_property_enum_items(prop, prop_keyblock_type_items);
 	RNA_def_property_ui_text(prop, "Interpolation Type U", "");
 	RNA_def_property_update(prop, 0, "rna_Lattice_update_data");
 
-	prop= RNA_def_property(srna, "interpolation_type_v", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "interpolation_type_v", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "typev");
 	RNA_def_property_enum_items(prop, prop_keyblock_type_items);
 	RNA_def_property_ui_text(prop, "Interpolation Type V", "");
 	RNA_def_property_update(prop, 0, "rna_Lattice_update_data");
 
-	prop= RNA_def_property(srna, "interpolation_type_w", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "interpolation_type_w", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "typew");
 	RNA_def_property_enum_items(prop, prop_keyblock_type_items);
 	RNA_def_property_ui_text(prop, "Interpolation Type W", "");
 	RNA_def_property_update(prop, 0, "rna_Lattice_update_data");
 
-	prop= RNA_def_property(srna, "use_outside", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_outside", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LT_OUTSIDE);
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_Lattice_use_outside_set");
 	RNA_def_property_ui_text(prop, "Outside", "Only draw, and take into account, the outer vertices");
 	RNA_def_property_update(prop, 0, "rna_Lattice_update_data");
 	
-	prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "vgroup");
 	RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group to apply the influence of the lattice");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Lattice_vg_name_set");
 	RNA_def_property_update(prop, 0, "rna_Lattice_update_data");
 
-	prop= RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "key");
 	RNA_def_property_ui_text(prop, "Shape Keys", "");
 
-	prop= RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "LatticePoint");
-	RNA_def_property_collection_funcs(prop, "rna_Lattice_points_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
+	RNA_def_property_collection_funcs(prop, "rna_Lattice_points_begin", "rna_iterator_array_next",
+	                                  "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Points", "Points of the lattice");
 	
 	/* pointers */
@@ -330,4 +333,3 @@ void RNA_def_lattice(BlenderRNA *brna)
 }
 
 #endif
-
diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c
index dc1faa2..e616a63 100644
--- a/source/blender/makesrna/intern/rna_main.c
+++ b/source/blender/makesrna/intern/rna_main.c
@@ -50,9 +50,9 @@ static int rna_Main_is_saved_get(PointerRNA *UNUSED(ptr))
 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;
+	Main *bmain = (Main*)ptr->data;
 	wmWindowManager *wm;
-	for(wm= bmain->wm.first; wm; wm= wm->id.next) {
+	for (wm = bmain->wm.first; wm; wm = wm->id.next) {
 		return !wm->file_saved;
 	}
 
@@ -61,195 +61,195 @@ static int rna_Main_is_dirty_get(PointerRNA *ptr)
 
 static void rna_Main_filepath_get(PointerRNA *ptr, char *value)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	BLI_strncpy(value, bmain->name, sizeof(bmain->name));
 }
 
 static int rna_Main_filepath_length(PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	return strlen(bmain->name);
 }
 
 #if 0
 static void rna_Main_filepath_set(PointerRNA *ptr, const char *value)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	BLI_strncpy(bmain->name, value, sizeof(bmain->name));
 }
 #endif
 
 static void rna_Main_scene_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->scene, NULL);
 }
 
 static void rna_Main_object_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->object, NULL);
 }
 
 static void rna_Main_lamp_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->lamp, NULL);
 }
 
 static void rna_Main_library_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->library, NULL);
 }
 
 static void rna_Main_mesh_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->mesh, NULL);
 }
 
 static void rna_Main_curve_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->curve, NULL);
 }
 
 static void rna_Main_mball_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->mball, NULL);
 }
 
 static void rna_Main_mat_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->mat, NULL);
 }
 
 static void rna_Main_tex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->tex, NULL);
 }
 
 static void rna_Main_image_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->image, NULL);
 }
 
 static void rna_Main_latt_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->latt, NULL);
 }
 
 static void rna_Main_camera_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->camera, NULL);
 }
 
 static void rna_Main_key_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->key, NULL);
 }
 
 static void rna_Main_world_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->world, NULL);
 }
 
 static void rna_Main_screen_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->screen, NULL);
 }
 
 static void rna_Main_script_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->script, NULL);
 }
 
 static void rna_Main_font_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->vfont, NULL);
 }
 
 static void rna_Main_text_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->text, NULL);
 }
 
 static void rna_Main_speaker_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->speaker, NULL);
 }
 
 static void rna_Main_sound_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->sound, NULL);
 }
 
 static void rna_Main_group_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->group, NULL);
 }
 
 static void rna_Main_armature_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->armature, NULL);
 }
 
 static void rna_Main_action_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->action, NULL);
 }
 
 static void rna_Main_nodetree_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->nodetree, NULL);
 }
 
 static void rna_Main_brush_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->brush, NULL);
 }
 
 static void rna_Main_particle_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->particle, NULL);
 }
 
 static void rna_Main_gpencil_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->gpencil, NULL);
 }
 
 static void rna_Main_wm_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->wm, NULL);
 }
 
 static void rna_Main_movieclips_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Main *bmain= (Main*)ptr->data;
+	Main *bmain = (Main*)ptr->data;
 	rna_iterator_listbase_begin(iter, &bmain->movieclip, NULL);
 }
 
@@ -257,8 +257,8 @@ static void rna_Main_movieclips_begin(CollectionPropertyIterator *iter, PointerR
 
 static PointerRNA rna_Test_test_get(PointerRNA *ptr)
 {
-	PointerRNA ret= *ptr;
-	ret.type= &RNA_Test;
+	PointerRNA ret = *ptr;
+	ret.type = &RNA_Test;
 
 	return ret;
 }
@@ -286,17 +286,19 @@ void RNA_def_main(BlenderRNA *brna)
 	CollectionDefFunc *func;
 
 	/* plural must match idtypes in readblenentry.c */
-	MainCollectionDef lists[]= {
+	MainCollectionDef lists[] = {
 		{"cameras", "Camera", "rna_Main_camera_begin", "Cameras", "Camera datablocks", RNA_def_main_cameras},
 		{"scenes", "Scene", "rna_Main_scene_begin", "Scenes", "Scene datablocks", RNA_def_main_scenes},
 		{"objects", "Object", "rna_Main_object_begin", "Objects", "Object datablocks", RNA_def_main_objects},
 		{"materials", "Material", "rna_Main_mat_begin", "Materials", "Material datablocks", RNA_def_main_materials},
-		{"node_groups", "NodeTree", "rna_Main_nodetree_begin", "Node Groups", "Node group datablocks", RNA_def_main_node_groups},
+		{"node_groups", "NodeTree", "rna_Main_nodetree_begin", "Node Groups", "Node group datablocks",
+		                RNA_def_main_node_groups},
 		{"meshes", "Mesh", "rna_Main_mesh_begin", "Meshes", "Mesh datablocks", RNA_def_main_meshes},
 		{"lamps", "Lamp", "rna_Main_lamp_begin", "Lamps", "Lamp datablocks", RNA_def_main_lamps},
 		{"libraries", "Library", "rna_Main_library_begin", "Libraries", "Library datablocks", RNA_def_main_libraries},
 		{"screens", "Screen", "rna_Main_screen_begin", "Screens", "Screen datablocks", RNA_def_main_screens},
-		{"window_managers", "WindowManager", "rna_Main_wm_begin", "Window Managers", "Window manager datablocks", RNA_def_main_window_managers},
+		{"window_managers", "WindowManager", "rna_Main_wm_begin", "Window Managers", "Window manager datablocks",
+		                    RNA_def_main_window_managers},
 		{"images", "Image", "rna_Main_image_begin", "Images", "Image datablocks", RNA_def_main_images},
 		{"lattices", "Lattice", "rna_Main_latt_begin", "Lattices", "Lattice datablocks", RNA_def_main_lattices},
 		{"curves", "Curve", "rna_Main_curve_begin", "Curves", "Curve datablocks", RNA_def_main_curves} ,
@@ -311,45 +313,52 @@ void RNA_def_main(BlenderRNA *brna)
 		{"texts", "Text", "rna_Main_text_begin", "Texts", "Text datablocks", RNA_def_main_texts},
 		{"speakers", "Speaker", "rna_Main_speaker_begin", "Speakers", "Speaker datablocks", RNA_def_main_speakers},
 		{"sounds", "Sound", "rna_Main_sound_begin", "Sounds", "Sound datablocks", RNA_def_main_sounds},
-		{"armatures", "Armature", "rna_Main_armature_begin", "Armatures", "Armature datablocks", RNA_def_main_armatures},
+		{"armatures", "Armature", "rna_Main_armature_begin", "Armatures", "Armature datablocks",
+		              RNA_def_main_armatures},
 		{"actions", "Action", "rna_Main_action_begin", "Actions", "Action datablocks", RNA_def_main_actions},
-		{"particles", "ParticleSettings", "rna_Main_particle_begin", "Particles", "Particle datablocks", RNA_def_main_particles},
-		{"grease_pencil", "GreasePencil", "rna_Main_gpencil_begin", "Grease Pencil", "Grease Pencil datablocks", RNA_def_main_gpencil},
-		{"movieclips", "MovieClip", "rna_Main_movieclips_begin", "Movie Clips", "Movie Clip datablocks", RNA_def_main_movieclips},
+		{"particles", "ParticleSettings", "rna_Main_particle_begin", "Particles", "Particle datablocks",
+		              RNA_def_main_particles},
+		{"grease_pencil", "GreasePencil", "rna_Main_gpencil_begin", "Grease Pencil", "Grease Pencil datablocks",
+		                  RNA_def_main_gpencil},
+		{"movieclips", "MovieClip", "rna_Main_movieclips_begin", "Movie Clips", "Movie Clip datablocks",
+		               RNA_def_main_movieclips},
 		{NULL, NULL, NULL, NULL, NULL, NULL}};
 
 	int i;
 	
-	srna= RNA_def_struct(brna, "BlendData", NULL);
-	RNA_def_struct_ui_text(srna, "Blendfile Data", "Main data structure representing a .blend file and all its datablocks");
+	srna = RNA_def_struct(brna, "BlendData", NULL);
+	RNA_def_struct_ui_text(srna, "Blendfile Data",
+	                       "Main data structure representing a .blend file and all its datablocks");
 	RNA_def_struct_ui_icon(srna, ICON_BLENDER);
 
-	prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+	prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
 	RNA_def_property_string_maxlength(prop, FILE_MAX);
 	RNA_def_property_string_funcs(prop, "rna_Main_filepath_get", "rna_Main_filepath_length", "rna_Main_filepath_set");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Filename", "Path to the .blend file");
 	
-	prop= RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_is_dirty_get", NULL);
 	RNA_def_property_ui_text(prop, "File Has Unsaved Changes", "Have recent edits been saved to disk");
 
-	prop= RNA_def_property(srna, "is_saved", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_saved", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_is_saved_get", NULL);
 	RNA_def_property_ui_text(prop, "File is Saved", "Has the current session been saved to disk as a .blend file");
 
-	for(i=0; lists[i].name; i++)
+	for (i = 0; lists[i].name; i++)
 	{
-		prop= RNA_def_property(srna, lists[i].identifier, PROP_COLLECTION, PROP_NONE);
+		prop = RNA_def_property(srna, lists[i].identifier, PROP_COLLECTION, PROP_NONE);
 		RNA_def_property_struct_type(prop, lists[i].type);
-		RNA_def_property_collection_funcs(prop, lists[i].iter_begin, "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL);
+		RNA_def_property_collection_funcs(prop, lists[i].iter_begin, "rna_iterator_listbase_next",
+		                                  "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+		                                  NULL, NULL, NULL, NULL);
 		RNA_def_property_ui_text(prop, lists[i].name, lists[i].description);
 
 		/* collection functions */
-		func= lists[i].func;
-		if(func)
+		func = lists[i].func;
+		if (func)
 			func(brna, prop);
 	}
 
@@ -359,7 +368,7 @@ void RNA_def_main(BlenderRNA *brna)
 
 	RNA_define_verify_sdna(0);
 
-	prop= RNA_def_property(srna, "test", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "test", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Test");
 	RNA_def_property_pointer_funcs(prop, "rna_Test_test_get", NULL, NULL, NULL);
 
@@ -369,4 +378,3 @@ void RNA_def_main(BlenderRNA *brna)
 }
 
 #endif
-
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index a62da4c..10a45fb 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.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
@@ -18,7 +18,7 @@
  * The Original Code is Copyright (C) 2009 Blender Foundation.
  * All rights reserved.
  *
- * 
+ *
  * Contributor(s): Blender Foundation
  *
  * ***** END GPL LICENSE BLOCK *****
@@ -90,20 +90,15 @@
 
 #include "ED_screen.h"
 
-Tex *rna_Main_add_texture(Main *UNUSED(bmain), const char *name)
-{
-	return add_texture(name);
-}
-
 Camera *rna_Main_cameras_new(Main *UNUSED(bmain), const char *name)
 {
-	ID *id= add_camera(name);
+	ID *id = add_camera(name);
 	id_us_min(id);
 	return (Camera *)id;
 }
 void rna_Main_cameras_remove(Main *bmain, ReportList *reports, struct Camera *camera)
 {
-	if(ID_REAL_USERS(camera) <= 0)
+	if (ID_REAL_USERS(camera) <= 0)
 		free_libblock(&bmain->camera, camera);
 	else
 		BKE_reportf(reports, RPT_ERROR, "Camera \"%s\" must have zero users to be removed, found %d",
@@ -118,20 +113,20 @@ Scene *rna_Main_scenes_new(Main *UNUSED(bmain), const char *name)
 }
 void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports, struct Scene *scene)
 {
-	/* dont call free_libblock(...) directly */
+	/* don't call free_libblock(...) directly */
 	Scene *newscene;
 
-	if(scene->id.prev)
-		newscene= scene->id.prev;
-	else if(scene->id.next)
-		newscene= scene->id.next;
+	if (scene->id.prev)
+		newscene = scene->id.prev;
+	else if (scene->id.next)
+		newscene = scene->id.next;
 	else {
 		BKE_reportf(reports, RPT_ERROR, "Scene \"%s\" is the last, cant ve removed", scene->id.name+2);
 		return;
 	}
 
-	if(CTX_wm_screen(C)->scene == scene)
-		ED_screen_set_scene(C, newscene);
+	if (CTX_wm_screen(C)->scene == scene)
+		ED_screen_set_scene(C, CTX_wm_screen(C), newscene);
 
 	unlink_scene(bmain, scene, newscene);
 }
@@ -139,38 +134,38 @@ void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports, struc
 Object *rna_Main_objects_new(Main *UNUSED(bmain), ReportList *reports, const char *name, ID *data)
 {
 	Object *ob;
-	int type= OB_EMPTY;
-	if(data) {
-		switch(GS(data->name)) {
+	int type = OB_EMPTY;
+	if (data) {
+		switch (GS(data->name)) {
 			case ID_ME:
-				type= OB_MESH;
+				type = OB_MESH;
 				break;
 			case ID_CU:
-				type= curve_type((struct Curve *)data);
+				type = curve_type((struct Curve *)data);
 				break;
 			case ID_MB:
-				type= OB_MBALL;
+				type = OB_MBALL;
 				break;
 			case ID_LA:
-				type= OB_LAMP;
+				type = OB_LAMP;
 				break;
 			case ID_SPK:
-				type= OB_SPEAKER;
+				type = OB_SPEAKER;
 				break;
 			case ID_CA:
-				type= OB_CAMERA;
+				type = OB_CAMERA;
 				break;
 			case ID_LT:
-				type= OB_LATTICE;
+				type = OB_LATTICE;
 				break;
 			case ID_AR:
-				type= OB_ARMATURE;
+				type = OB_ARMATURE;
 				break;
 			default:
 			{
 				const char *idname;
-				if(RNA_enum_id_from_value(id_type_items, GS(data->name), &idname) == 0)
-					idname= "UNKNOWN";
+				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);
 				return NULL;
@@ -180,10 +175,10 @@ Object *rna_Main_objects_new(Main *UNUSED(bmain), ReportList *reports, const cha
 		id_us_plus(data);
 	}
 
-	ob= add_only_object(type, name);
+	ob = add_only_object(type, name);
 	id_us_min(&ob->id);
 
-	ob->data= data;
+	ob->data = data;
 	test_object_materials(ob->data);
 	
 	return ob;
@@ -191,7 +186,7 @@ Object *rna_Main_objects_new(Main *UNUSED(bmain), ReportList *reports, const cha
 
 void rna_Main_objects_remove(Main *bmain, ReportList *reports, struct Object *object)
 {
-	if(ID_REAL_USERS(object) <= 0) {
+	if (ID_REAL_USERS(object) <= 0) {
 		unlink_object(object); /* needed or ID pointers to this are not cleared */
 		free_libblock(&bmain->object, object);
 	}
@@ -203,13 +198,13 @@ void rna_Main_objects_remove(Main *bmain, ReportList *reports, struct Object *ob
 
 struct Material *rna_Main_materials_new(Main *UNUSED(bmain), const char *name)
 {
-	ID *id= (ID *)add_material(name);
+	ID *id = (ID *)add_material(name);
 	id_us_min(id);
 	return (Material *)id;
 }
 void rna_Main_materials_remove(Main *bmain, ReportList *reports, struct Material *material)
 {
-	if(ID_REAL_USERS(material) <= 0)
+	if (ID_REAL_USERS(material) <= 0)
 		free_libblock(&bmain->mat, material);
 	else
 		BKE_reportf(reports, RPT_ERROR, "Material \"%s\" must have zero users to be removed, found %d",
@@ -227,7 +222,7 @@ struct bNodeTree *rna_Main_nodetree_new(Main *UNUSED(bmain), const char *name, i
 }
 void rna_Main_nodetree_remove(Main *bmain, ReportList *reports, struct bNodeTree *tree)
 {
-	if(ID_REAL_USERS(tree) <= 0)
+	if (ID_REAL_USERS(tree) <= 0)
 		free_libblock(&bmain->nodetree, tree);
 	else
 		BKE_reportf(reports, RPT_ERROR, "Node Tree \"%s\" must have zero users to be removed, found %d",
@@ -238,13 +233,13 @@ void rna_Main_nodetree_remove(Main *bmain, ReportList *reports, struct bNodeTree
 
 Mesh *rna_Main_meshes_new(Main *UNUSED(bmain), const char *name)
 {
-	Mesh *me= add_mesh(name);
+	Mesh *me = add_mesh(name);
 	id_us_min(&me->id);
 	return me;
 }
 void rna_Main_meshes_remove(Main *bmain, ReportList *reports, Mesh *mesh)
 {
-	if(ID_REAL_USERS(mesh) <= 0)
+	if (ID_REAL_USERS(mesh) <= 0)
 		free_libblock(&bmain->mesh, mesh);
 	else
 		BKE_reportf(reports, RPT_ERROR, "Mesh \"%s\" must have zero users to be removed, found %d",
@@ -255,14 +250,14 @@ void rna_Main_meshes_remove(Main *bmain, ReportList *reports, Mesh *mesh)
 
 Lamp *rna_Main_lamps_new(Main *UNUSED(bmain), const char *name, int type)
 {
-	Lamp *lamp= add_lamp(name);
-	lamp->type= type;
+	Lamp *lamp = add_lamp(name);
+	lamp->type = type;
 	id_us_min(&lamp->id);
 	return lamp;
 }
 void rna_Main_lamps_remove(Main *bmain, ReportList *reports, Lamp *lamp)
 {
-	if(ID_REAL_USERS(lamp) <= 0)
+	if (ID_REAL_USERS(lamp) <= 0)
 		free_libblock(&bmain->lamp, lamp);
 	else
 		BKE_reportf(reports, RPT_ERROR, "Lamp \"%s\" must have zero users to be removed, found %d",
@@ -273,8 +268,8 @@ void rna_Main_lamps_remove(Main *bmain, ReportList *reports, Lamp *lamp)
 
 Image *rna_Main_images_new(Main *UNUSED(bmain), const char *name, int width, int height, int alpha, int float_buffer)
 {
-	float color[4]= {0.0, 0.0, 0.0, 1.0};
-	Image *image= BKE_add_image_size(width, height, name, alpha ? 32:24, float_buffer, 0, color);
+	float color[4] = {0.0, 0.0, 0.0, 1.0};
+	Image *image = BKE_add_image_size(width, height, name, alpha ? 32:24, float_buffer, 0, color);
 	id_us_min(&image->id);
 	return image;
 }
@@ -282,10 +277,10 @@ Image *rna_Main_images_load(Main *UNUSED(bmain), ReportList *reports, const char
 {
 	Image *ima;
 
-	errno= 0;
-	ima= BKE_add_image_file(filepath);
+	errno = 0;
+	ima = BKE_add_image_file(filepath);
 
-	if(!ima)
+	if (!ima)
 		BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s", filepath,
 		            errno ? strerror(errno) : "Unsupported image format");
 
@@ -293,7 +288,7 @@ Image *rna_Main_images_load(Main *UNUSED(bmain), ReportList *reports, const char
 }
 void rna_Main_images_remove(Main *bmain, ReportList *reports, Image *image)
 {
-	if(ID_REAL_USERS(image) <= 0)
+	if (ID_REAL_USERS(image) <= 0)
 		free_libblock(&bmain->image, image);
 	else
 		BKE_reportf(reports, RPT_ERROR, "Image \"%s\" must have zero users to be removed, found %d",
@@ -304,13 +299,13 @@ void rna_Main_images_remove(Main *bmain, ReportList *reports, Image *image)
 
 Lattice *rna_Main_lattices_new(Main *UNUSED(bmain), const char *name)
 {
-	Lattice *lt= add_lattice(name);
+	Lattice *lt = add_lattice(name);
 	id_us_min(&lt->id);
 	return lt;
 }
 void rna_Main_lattices_remove(Main *bmain, ReportList *reports, struct Lattice *lt)
 {
-	if(ID_REAL_USERS(lt) <= 0)
+	if (ID_REAL_USERS(lt) <= 0)
 		free_libblock(&bmain->latt, lt);
 	else
 		BKE_reportf(reports, RPT_ERROR, "Lattice \"%s\" must have zero users to be removed, found %d",
@@ -319,13 +314,13 @@ void rna_Main_lattices_remove(Main *bmain, ReportList *reports, struct Lattice *
 
 Curve *rna_Main_curves_new(Main *UNUSED(bmain), const char *name, int type)
 {
-	Curve *cu= add_curve(name, type);
+	Curve *cu = add_curve(name, type);
 	id_us_min(&cu->id);
 	return cu;
 }
 void rna_Main_curves_remove(Main *bmain, ReportList *reports, struct Curve *cu)
 {
-	if(ID_REAL_USERS(cu) <= 0)
+	if (ID_REAL_USERS(cu) <= 0)
 		free_libblock(&bmain->curve, cu);
 	else
 		BKE_reportf(reports, RPT_ERROR, "Curve \"%s\" must have zero users to be removed, found %d",
@@ -334,16 +329,16 @@ void rna_Main_curves_remove(Main *bmain, ReportList *reports, struct Curve *cu)
 
 MetaBall *rna_Main_metaballs_new(Main *UNUSED(bmain), const char *name)
 {
-	MetaBall *mb= add_mball(name);
+	MetaBall *mb = add_mball(name);
 	id_us_min(&mb->id);
 	return mb;
 }
 void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, struct MetaBall *mb)
 {
-	if(ID_REAL_USERS(mb) <= 0)
+	if (ID_REAL_USERS(mb) <= 0)
 		free_libblock(&bmain->mball, mb);
 	else
-		BKE_reportf(reports, RPT_ERROR, "MetaBall \"%s\" must have zero users to be removed, found %d",
+		BKE_reportf(reports, RPT_ERROR, "Metaball \"%s\" must have zero users to be removed, found %d",
 		            mb->id.name+2, ID_REAL_USERS(mb));
 }
 
@@ -351,10 +346,10 @@ VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, const char *filepat
 {
 	VFont *font;
 
-	errno= 0;
-	font= load_vfont(bmain, filepath);
+	errno = 0;
+	font = load_vfont(bmain, filepath);
 
-	if(!font)
+	if (!font)
 		BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s", filepath,
 		            errno ? strerror(errno) : "Unsupported font format");
 
@@ -363,7 +358,7 @@ VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, const char *filepat
 }
 void rna_Main_fonts_remove(Main *bmain, ReportList *reports, VFont *vfont)
 {
-	if(ID_REAL_USERS(vfont) <= 0)
+	if (ID_REAL_USERS(vfont) <= 0)
 		free_libblock(&bmain->vfont, vfont);
 	else
 		BKE_reportf(reports, RPT_ERROR, "Font \"%s\" must have zero users to be removed, found %d",
@@ -374,14 +369,14 @@ void rna_Main_fonts_remove(Main *bmain, ReportList *reports, VFont *vfont)
 
 Tex *rna_Main_textures_new(Main *UNUSED(bmain), const char *name, int type)
 {
-	Tex *tex= add_texture(name);
+	Tex *tex = add_texture(name);
 	tex_set_type(tex, type);
 	id_us_min(&tex->id);
 	return tex;
 }
 void rna_Main_textures_remove(Main *bmain, ReportList *reports, struct Tex *tex)
 {
-	if(ID_REAL_USERS(tex) <= 0)
+	if (ID_REAL_USERS(tex) <= 0)
 		free_libblock(&bmain->tex, tex);
 	else
 		BKE_reportf(reports, RPT_ERROR, "Texture \"%s\" must have zero users to be removed, found %d",
@@ -396,7 +391,7 @@ Brush *rna_Main_brushes_new(Main *UNUSED(bmain), const char *name)
 }
 void rna_Main_brushes_remove(Main *bmain, ReportList *reports, struct Brush *brush)
 {
-	if(ID_REAL_USERS(brush) <= 0)
+	if (ID_REAL_USERS(brush) <= 0)
 		free_libblock(&bmain->brush, brush);
 	else
 		BKE_reportf(reports, RPT_ERROR, "Brush \"%s\" must have zero users to be removed, found %d",
@@ -411,7 +406,7 @@ World *rna_Main_worlds_new(Main *UNUSED(bmain), const char *name)
 }
 void rna_Main_worlds_remove(Main *bmain, ReportList *reports, struct World *world)
 {
-	if(ID_REAL_USERS(world) <= 0)
+	if (ID_REAL_USERS(world) <= 0)
 		free_libblock(&bmain->world, world);
 	else
 		BKE_reportf(reports, RPT_ERROR, "World \"%s\" must have zero users to be removed, found %d",
@@ -431,13 +426,13 @@ void rna_Main_groups_remove(Main *bmain, Group *group)
 
 Speaker *rna_Main_speakers_new(Main *UNUSED(bmain), const char *name)
 {
-	Speaker *speaker= add_speaker(name);
+	Speaker *speaker = add_speaker(name);
 	id_us_min(&speaker->id);
 	return speaker;
 }
 void rna_Main_speakers_remove(Main *bmain, ReportList *reports, Speaker *speaker)
 {
-	if(ID_REAL_USERS(speaker) <= 0)
+	if (ID_REAL_USERS(speaker) <= 0)
 		free_libblock(&bmain->speaker, speaker);
 	else
 		BKE_reportf(reports, RPT_ERROR, "Speaker \"%s\" must have zero users to be removed, found %d",
@@ -461,10 +456,10 @@ Text *rna_Main_texts_load(Main *bmain, ReportList *reports, const char *filepath
 {
 	Text *txt;
 
-	errno= 0;
-	txt= add_text(filepath, bmain->name);
+	errno = 0;
+	txt = add_text(filepath, bmain->name);
 
-	if(!txt)
+	if (!txt)
 		BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s", filepath,
 		            errno ? strerror(errno) : "Unable to load text");
 
@@ -473,13 +468,13 @@ Text *rna_Main_texts_load(Main *bmain, ReportList *reports, const char *filepath
 
 bArmature *rna_Main_armatures_new(Main *UNUSED(bmain), const char *name)
 {
-	bArmature *arm= add_armature(name);
+	bArmature *arm = add_armature(name);
 	id_us_min(&arm->id);
 	return arm;
 }
 void rna_Main_armatures_remove(Main *bmain, ReportList *reports, bArmature *arm)
 {
-	if(ID_REAL_USERS(arm) <= 0)
+	if (ID_REAL_USERS(arm) <= 0)
 		free_libblock(&bmain->armature, arm);
 	else
 		BKE_reportf(reports, RPT_ERROR, "Armature \"%s\" must have zero users to be removed, found %d",
@@ -490,14 +485,14 @@ void rna_Main_armatures_remove(Main *bmain, ReportList *reports, bArmature *arm)
 
 bAction *rna_Main_actions_new(Main *UNUSED(bmain), const char *name)
 {
-	bAction *act= add_empty_action(name);
+	bAction *act = add_empty_action(name);
 	id_us_min(&act->id);
 	act->id.flag &= ~LIB_FAKEUSER;
 	return act;
 }
 void rna_Main_actions_remove(Main *bmain, ReportList *reports, bAction *act)
 {
-	if(ID_REAL_USERS(act) <= 0)
+	if (ID_REAL_USERS(act) <= 0)
 		free_libblock(&bmain->action, act);
 	else
 		BKE_reportf(reports, RPT_ERROR, "Action \"%s\" must have zero users to be removed, found %d",
@@ -514,7 +509,7 @@ ParticleSettings *rna_Main_particles_new(Main *bmain, const char *name)
 }
 void rna_Main_particles_remove(Main *bmain, ReportList *reports, ParticleSettings *part)
 {
-	if(ID_REAL_USERS(part) <= 0)
+	if (ID_REAL_USERS(part) <= 0)
 		free_libblock(&bmain->particle, part);
 	else
 		BKE_reportf(reports, RPT_ERROR, "Particle Settings \"%s\" must have zero users to be removed, found %d",
@@ -527,11 +522,12 @@ MovieClip *rna_Main_movieclip_load(Main *UNUSED(bmain), ReportList *reports, con
 {
 	MovieClip *clip;
 
-	errno= 0;
-	clip= BKE_add_movieclip_file(filepath);
+	errno = 0;
+	clip = BKE_add_movieclip_file(filepath);
 
-	if(!clip)
-		BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath, errno ? strerror(errno) : "Unable to load movie clip");
+	if (!clip)
+		BKE_reportf(reports, RPT_ERROR, "Can't read: \"%s\", %s.", filepath,
+		            errno ? strerror(errno) : "Unable to load movie clip");
 
 	return clip;
 }
@@ -605,21 +601,18 @@ static int rna_Main_gpencil_is_updated_get(PointerRNA *ptr) { return DAG_id_type
 
 void RNA_api_main(StructRNA *srna)
 {
-	/*
+#if 0
 	FunctionRNA *func;
 	PropertyRNA *parm;
-	*/
 	/* maybe we want to add functions in 'bpy.data' still?
 	 * for now they are all in collections bpy.data.images.new(...) */
-	/*
 	func= RNA_def_function(srna, "add_image", "rna_Main_add_image");
 	RNA_def_function_ui_description(func, "Add a new image");
 	parm= RNA_def_string_file_path(func, "filepath", "", 0, "", "File path to load image from");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	parm= RNA_def_pointer(func, "image", "Image", "", "New image");
 	RNA_def_function_return(func, parm);
-	*/
-
+#endif
 }
 
 void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop)
@@ -630,29 +623,29 @@ void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "BlendDataCameras");
-	srna= RNA_def_struct(brna, "BlendDataCameras", NULL);
+	srna = RNA_def_struct(brna, "BlendDataCameras", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Cameras", "Collection of cameras");
 
-	func= RNA_def_function(srna, "new", "rna_Main_cameras_new");
+	func = RNA_def_function(srna, "new", "rna_Main_cameras_new");
 	RNA_def_function_ui_description(func, "Add a new camera to the main database");
-	parm= RNA_def_string(func, "name", "Camera", 0, "", "New name for the datablock");
+	parm = RNA_def_string(func, "name", "Camera", 0, "", "New name for the datablock");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_pointer(func, "camera", "Camera", "", "New camera datablock");
+	parm = RNA_def_pointer(func, "camera", "Camera", "", "New camera datablock");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_Main_cameras_remove");
+	func = RNA_def_function(srna, "remove", "rna_Main_cameras_remove");
 	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");
+	parm = RNA_def_pointer(func, "camera", "Camera", "", "Camera to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "tag", "rna_Main_cameras_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_cameras_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_cameras_is_updated_get", NULL);
 }
@@ -665,25 +658,29 @@ void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "BlendDataScenes");
-	srna= RNA_def_struct(brna, "BlendDataScenes", NULL);
+	srna = RNA_def_struct(brna, "BlendDataScenes", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Scenes", "Collection of scenes");
 
-	func= RNA_def_function(srna, "new", "rna_Main_scenes_new");
+	func = RNA_def_function(srna, "new", "rna_Main_scenes_new");
 	RNA_def_function_ui_description(func, "Add a new scene to the main database");
-	parm= RNA_def_string(func, "name", "Scene", 0, "", "New name for the datablock");
+	parm = RNA_def_string(func, "name", "Scene", 0, "", "New name for the datablock");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_pointer(func, "scene", "Scene", "", "New scene datablock");
+	parm = RNA_def_pointer(func, "scene", "Scene", "", "New scene datablock");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_Main_scenes_remove");
+	func = RNA_def_function(srna, "remove", "rna_Main_scenes_remove");
 	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");
+	parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	func = RNA_def_function(srna, "tag", "rna_Main_scenes_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
+	RNA_def_property_flag(parm, PROP_REQUIRED);
+
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_scenes_is_updated_get", NULL);
 }
@@ -696,33 +693,33 @@ void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "BlendDataObjects");
-	srna= RNA_def_struct(brna, "BlendDataObjects", NULL);
+	srna = RNA_def_struct(brna, "BlendDataObjects", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Objects", "Collection of objects");
 
-	func= RNA_def_function(srna, "new", "rna_Main_objects_new");
+	func = RNA_def_function(srna, "new", "rna_Main_objects_new");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Add a new object to the main database");
-	parm= RNA_def_string(func, "name", "Object", 0, "", "New name for the datablock");
+	parm = RNA_def_string(func, "name", "Object", 0, "", "New name for the datablock");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_pointer(func, "object_data", "ID", "", "Object data or None for an empty object");
+	parm = RNA_def_pointer(func, "object_data", "ID", "", "Object data or None for an empty object");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
 	/* return type */
-	parm= RNA_def_pointer(func, "object", "Object", "", "New object datablock");
+	parm = RNA_def_pointer(func, "object", "Object", "", "New object datablock");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_Main_objects_remove");
+	func = RNA_def_function(srna, "remove", "rna_Main_objects_remove");
 	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");
+	parm = RNA_def_pointer(func, "object", "Object", "", "Object to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "tag", "rna_Main_objects_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_objects_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_objects_is_updated_get", NULL);
 }
@@ -735,29 +732,29 @@ void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "BlendDataMaterials");
-	srna= RNA_def_struct(brna, "BlendDataMaterials", NULL);
+	srna = RNA_def_struct(brna, "BlendDataMaterials", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Materials", "Collection of materials");
 
-	func= RNA_def_function(srna, "new", "rna_Main_materials_new");
+	func = RNA_def_function(srna, "new", "rna_Main_materials_new");
 	RNA_def_function_ui_description(func, "Add a new material to the main database");
-	parm= RNA_def_string(func, "name", "Material", 0, "", "New name for the datablock");
+	parm = RNA_def_string(func, "name", "Material", 0, "", "New name for the datablock");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_pointer(func, "material", "Material", "", "New material datablock");
+	parm = RNA_def_pointer(func, "material", "Material", "", "New material datablock");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_Main_materials_remove");
+	func = RNA_def_function(srna, "remove", "rna_Main_materials_remove");
 	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");
+	parm = RNA_def_pointer(func, "material", "Material", "", "Material to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "tag", "rna_Main_materials_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_materials_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_materials_is_updated_get", NULL);
 }
@@ -775,31 +772,31 @@ void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop)
 	{0, NULL, 0, NULL, NULL}};
 
 	RNA_def_property_srna(cprop, "BlendDataNodeTrees");
-	srna= RNA_def_struct(brna, "BlendDataNodeTrees", NULL);
+	srna = RNA_def_struct(brna, "BlendDataNodeTrees", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Node Trees", "Collection of node trees");
 
-	func= RNA_def_function(srna, "new", "rna_Main_nodetree_new");
+	func = RNA_def_function(srna, "new", "rna_Main_nodetree_new");
 	RNA_def_function_ui_description(func, "Add a new node tree to the main database");
-	parm= RNA_def_string(func, "name", "NodeGroup", 0, "", "New name for the datablock");
+	parm = RNA_def_string(func, "name", "NodeGroup", 0, "", "New name for the datablock");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_enum(func, "type", node_nodetree_items, 0, "Type", "The type of node_group to add");
+	parm = RNA_def_enum(func, "type", node_nodetree_items, 0, "Type", "The type of node_group to add");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_pointer(func, "tree", "NodeTree", "", "New node tree datablock");
+	parm = RNA_def_pointer(func, "tree", "NodeTree", "", "New node tree datablock");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_Main_nodetree_remove");
+	func = RNA_def_function(srna, "remove", "rna_Main_nodetree_remove");
 	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");
+	parm = RNA_def_pointer(func, "tree", "NodeTree", "", "Node tree to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "tag", "rna_Main_node_groups_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_node_groups_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_node_groups_is_updated_get", NULL);
 }
@@ -811,29 +808,29 @@ void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "BlendDataMeshes");
-	srna= RNA_def_struct(brna, "BlendDataMeshes", NULL);
+	srna = RNA_def_struct(brna, "BlendDataMeshes", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Meshes", "Collection of meshes");
 
-	func= RNA_def_function(srna, "new", "rna_Main_meshes_new");
+	func = RNA_def_function(srna, "new", "rna_Main_meshes_new");
 	RNA_def_function_ui_description(func, "Add a new mesh to the main database");
-	parm= RNA_def_string(func, "name", "Mesh", 0, "", "New name for the datablock");
+	parm = RNA_def_string(func, "name", "Mesh", 0, "", "New name for the datablock");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_pointer(func, "mesh", "Mesh", "", "New mesh datablock");
+	parm = RNA_def_pointer(func, "mesh", "Mesh", "", "New mesh datablock");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_Main_meshes_remove");
+	func = RNA_def_function(srna, "remove", "rna_Main_meshes_remove");
 	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");
+	parm = RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "tag", "rna_Main_meshes_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_meshes_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_meshes_is_updated_get", NULL);
 }
@@ -845,31 +842,31 @@ void RNA_def_main_lamps(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "BlendDataLamps");
-	srna= RNA_def_struct(brna, "BlendDataLamps", NULL);
+	srna = RNA_def_struct(brna, "BlendDataLamps", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Lamps", "Collection of lamps");
 
-	func= RNA_def_function(srna, "new", "rna_Main_lamps_new");
+	func = RNA_def_function(srna, "new", "rna_Main_lamps_new");
 	RNA_def_function_ui_description(func, "Add a new lamp to the main database");
-	parm= RNA_def_string(func, "name", "Lamp", 0, "", "New name for the datablock");
+	parm = RNA_def_string(func, "name", "Lamp", 0, "", "New name for the datablock");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_enum(func, "type", lamp_type_items, 0, "Type", "The type of texture to add");
+	parm = RNA_def_enum(func, "type", lamp_type_items, 0, "Type", "The type of texture to add");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_pointer(func, "lamp", "Lamp", "", "New lamp datablock");
+	parm = RNA_def_pointer(func, "lamp", "Lamp", "", "New lamp datablock");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_Main_lamps_remove");
+	func = RNA_def_function(srna, "remove", "rna_Main_lamps_remove");
 	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");
+	parm = RNA_def_pointer(func, "lamp", "Lamp", "", "Lamp to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "tag", "rna_Main_lamps_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_lamps_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_lamps_is_updated_get", NULL);
 }
@@ -882,15 +879,15 @@ void RNA_def_main_libraries(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "BlendDataLibraries");
-	srna= RNA_def_struct(brna, "BlendDataLibraries", NULL);
+	srna = RNA_def_struct(brna, "BlendDataLibraries", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Libraries", "Collection of libraries");
 
-	func= RNA_def_function(srna, "tag", "rna_Main_libraries_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_libraries_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_libraries_is_updated_get", NULL);
 }
@@ -903,15 +900,15 @@ void RNA_def_main_screens(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "BlendDataScreens");
-	srna= RNA_def_struct(brna, "BlendDataScreens", NULL);
+	srna = RNA_def_struct(brna, "BlendDataScreens", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Screens", "Collection of screens");
 
-	func= RNA_def_function(srna, "tag", "rna_Main_screens_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_screens_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_screens_is_updated_get", NULL);
 }
@@ -924,15 +921,15 @@ void RNA_def_main_window_managers(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "BlendDataWindowManagers");
-	srna= RNA_def_struct(brna, "BlendDataWindowManagers", NULL);
+	srna = RNA_def_struct(brna, "BlendDataWindowManagers", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Window Managers", "Collection of window managers");
 
-	func= RNA_def_function(srna, "tag", "rna_Main_window_managers_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_window_managers_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_window_managers_is_updated_get", NULL);
 }
@@ -944,44 +941,44 @@ void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "BlendDataImages");
-	srna= RNA_def_struct(brna, "BlendDataImages", NULL);
+	srna = RNA_def_struct(brna, "BlendDataImages", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Images", "Collection of images");
 
-	func= RNA_def_function(srna, "new", "rna_Main_images_new");
+	func = RNA_def_function(srna, "new", "rna_Main_images_new");
 	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");
+	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", 0, 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", 0, 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");
 	/* return type */
-	parm= RNA_def_pointer(func, "image", "Image", "", "New image datablock");
+	parm = RNA_def_pointer(func, "image", "Image", "", "New image datablock");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "load", "rna_Main_images_load");
+	func = RNA_def_function(srna, "load", "rna_Main_images_load");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Load a new image into the main database");
-	parm= RNA_def_string_file_path(func, "filepath", "File Path", 0, "", "path of the file to load");
+	parm = RNA_def_string_file_path(func, "filepath", "File Path", 0, "", "path of the file to load");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_pointer(func, "image", "Image", "", "New image datablock");
+	parm = RNA_def_pointer(func, "image", "Image", "", "New image datablock");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_Main_images_remove");
+	func = RNA_def_function(srna, "remove", "rna_Main_images_remove");
 	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");
+	parm = RNA_def_pointer(func, "image", "Image", "", "Image to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "tag", "rna_Main_images_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_images_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_images_is_updated_get", NULL);
 }
@@ -994,29 +991,29 @@ void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "BlendDataLattices");
-	srna= RNA_def_struct(brna, "BlendDataLattices", NULL);
+	srna = RNA_def_struct(brna, "BlendDataLattices", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Lattices", "Collection of lattices");
 
-	func= RNA_def_function(srna, "new", "rna_Main_lattices_new");
+	func = RNA_def_function(srna, "new", "rna_Main_lattices_new");
 	RNA_def_function_ui_description(func, "Add a new lattice to the main database");
-	parm= RNA_def_string(func, "name", "Lattice", 0, "", "New name for the datablock");
+	parm = RNA_def_string(func, "name", "Lattice", 0, "", "New name for the datablock");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_pointer(func, "lattice", "Lattice", "", "New lattices datablock");
+	parm = RNA_def_pointer(func, "lattice", "Lattice", "", "New lattices datablock");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_Main_lattices_remove");
+	func = RNA_def_function(srna, "remove", "rna_Main_lattices_remove");
 	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");
+	parm = RNA_def_pointer(func, "lattice", "Lattice", "", "Lattice to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "tag", "rna_Main_lattices_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_lattices_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_lattices_is_updated_get", NULL);
 }
@@ -1028,31 +1025,31 @@ void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "BlendDataCurves");
-	srna= RNA_def_struct(brna, "BlendDataCurves", NULL);
+	srna = RNA_def_struct(brna, "BlendDataCurves", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Curves", "Collection of curves");
 
-	func= RNA_def_function(srna, "new", "rna_Main_curves_new");
+	func = RNA_def_function(srna, "new", "rna_Main_curves_new");
 	RNA_def_function_ui_description(func, "Add a new curve to the main database");
-	parm= RNA_def_string(func, "name", "Curve", 0, "", "New name for the datablock");
+	parm = RNA_def_string(func, "name", "Curve", 0, "", "New name for the datablock");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_enum(func, "type", object_type_curve_items, 0, "Type", "The type of curve to add");
+	parm = RNA_def_enum(func, "type", object_type_curve_items, 0, "Type", "The type of curve to add");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_pointer(func, "curve", "Curve", "", "New curve datablock");
+	parm = RNA_def_pointer(func, "curve", "Curve", "", "New curve datablock");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_Main_curves_remove");
+	func = RNA_def_function(srna, "remove", "rna_Main_curves_remove");
 	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");
+	parm = RNA_def_pointer(func, "curve", "Curve", "", "Curve to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "tag", "rna_Main_curves_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_curves_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_curves_is_updated_get", NULL);
 }
@@ -1064,29 +1061,29 @@ void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "BlendDataMetaBalls");
-	srna= RNA_def_struct(brna, "BlendDataMetaBalls", NULL);
+	srna = RNA_def_struct(brna, "BlendDataMetaBalls", NULL);
 	RNA_def_struct_sdna(srna, "Main");
-	RNA_def_struct_ui_text(srna, "Main MetaBalls", "Collection of metaballs");
+	RNA_def_struct_ui_text(srna, "Main Metaballs", "Collection of metaballs");
 
-	func= RNA_def_function(srna, "new", "rna_Main_metaballs_new");
+	func = RNA_def_function(srna, "new", "rna_Main_metaballs_new");
 	RNA_def_function_ui_description(func, "Add a new metaball to the main database");
-	parm= RNA_def_string(func, "name", "MetaBall", 0, "", "New name for the datablock");
+	parm = RNA_def_string(func, "name", "MetaBall", 0, "", "New name for the datablock");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_pointer(func, "metaball", "MetaBall", "", "New metaball datablock");
+	parm = RNA_def_pointer(func, "metaball", "MetaBall", "", "New metaball datablock");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_Main_metaballs_remove");
+	func = RNA_def_function(srna, "remove", "rna_Main_metaballs_remove");
 	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");
+	parm = RNA_def_pointer(func, "metaball", "MetaBall", "", "Metaball to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "tag", "rna_Main_metaballs_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_metaballs_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_metaballs_is_updated_get", NULL);
 }
@@ -1098,30 +1095,30 @@ void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "BlendDataFonts");
-	srna= RNA_def_struct(brna, "BlendDataFonts", NULL);
+	srna = RNA_def_struct(brna, "BlendDataFonts", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Fonts", "Collection of fonts");
 
-	func= RNA_def_function(srna, "load", "rna_Main_fonts_load");
+	func = RNA_def_function(srna, "load", "rna_Main_fonts_load");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Load a new font into the main database");
-	parm= RNA_def_string_file_path(func, "filepath", "File Path", 0, "", "path of the font to load");
+	parm = RNA_def_string_file_path(func, "filepath", "File Path", 0, "", "path of the font to load");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_pointer(func, "vfont", "VectorFont", "", "New font datablock");
+	parm = RNA_def_pointer(func, "vfont", "VectorFont", "", "New font datablock");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_Main_fonts_remove");
+	func = RNA_def_function(srna, "remove", "rna_Main_fonts_remove");
 	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");
+	parm = RNA_def_pointer(func, "vfont", "VectorFont", "", "Font to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "tag", "rna_Main_fonts_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_fonts_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_fonts_is_updated_get", NULL);
 }
@@ -1133,31 +1130,31 @@ void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "BlendDataTextures");
-	srna= RNA_def_struct(brna, "BlendDataTextures", NULL);
+	srna = RNA_def_struct(brna, "BlendDataTextures", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Textures", "Collection of groups");
 
-	func= RNA_def_function(srna, "new", "rna_Main_textures_new");
+	func = RNA_def_function(srna, "new", "rna_Main_textures_new");
 	RNA_def_function_ui_description(func, "Add a new texture to the main database");
-	parm= RNA_def_string(func, "name", "Texture", 0, "", "New name for the datablock");
+	parm = RNA_def_string(func, "name", "Texture", 0, "", "New name for the datablock");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_enum(func, "type", texture_type_items, 0, "Type", "The type of texture to add");
+	parm = RNA_def_enum(func, "type", texture_type_items, 0, "Type", "The type of texture to add");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_pointer(func, "texture", "Texture", "", "New texture datablock");
+	parm = RNA_def_pointer(func, "texture", "Texture", "", "New texture datablock");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_Main_textures_remove");
+	func = RNA_def_function(srna, "remove", "rna_Main_textures_remove");
 	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");
+	parm = RNA_def_pointer(func, "texture", "Texture", "", "Texture to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "tag", "rna_Main_textures_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_textures_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_textures_is_updated_get", NULL);
 }
@@ -1169,29 +1166,29 @@ void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "BlendDataBrushes");
-	srna= RNA_def_struct(brna, "BlendDataBrushes", NULL);
+	srna = RNA_def_struct(brna, "BlendDataBrushes", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Brushes", "Collection of brushes");
 
-	func= RNA_def_function(srna, "new", "rna_Main_brushes_new");
+	func = RNA_def_function(srna, "new", "rna_Main_brushes_new");
 	RNA_def_function_ui_description(func, "Add a new brush to the main database");
-	parm= RNA_def_string(func, "name", "Brush", 0, "", "New name for the datablock");
+	parm = RNA_def_string(func, "name", "Brush", 0, "", "New name for the datablock");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_pointer(func, "brush", "Brush", "", "New brush datablock");
+	parm = RNA_def_pointer(func, "brush", "Brush", "", "New brush datablock");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_Main_brushes_remove");
+	func = RNA_def_function(srna, "remove", "rna_Main_brushes_remove");
 	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");
+	parm = RNA_def_pointer(func, "brush", "Brush", "", "Brush to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "tag", "rna_Main_brushes_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_brushes_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_brushes_is_updated_get", NULL);
 }
@@ -1204,29 +1201,29 @@ void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "BlendDataWorlds");
-	srna= RNA_def_struct(brna, "BlendDataWorlds", NULL);
+	srna = RNA_def_struct(brna, "BlendDataWorlds", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Worlds", "Collection of worlds");
 
-	func= RNA_def_function(srna, "new", "rna_Main_worlds_new");
+	func = RNA_def_function(srna, "new", "rna_Main_worlds_new");
 	RNA_def_function_ui_description(func, "Add a new world to the main database");
-	parm= RNA_def_string(func, "name", "World", 0, "", "New name for the datablock");
+	parm = RNA_def_string(func, "name", "World", 0, "", "New name for the datablock");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_pointer(func, "world", "World", "", "New world datablock");
+	parm = RNA_def_pointer(func, "world", "World", "", "New world datablock");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_Main_worlds_remove");
+	func = RNA_def_function(srna, "remove", "rna_Main_worlds_remove");
 	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");
+	parm = RNA_def_pointer(func, "world", "World", "", "World to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "tag", "rna_Main_worlds_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_worlds_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_worlds_is_updated_get", NULL);
 }
@@ -1239,28 +1236,28 @@ void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "BlendDataGroups");
-	srna= RNA_def_struct(brna, "BlendDataGroups", NULL);
+	srna = RNA_def_struct(brna, "BlendDataGroups", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Groups", "Collection of groups");
 
-	func= RNA_def_function(srna, "new", "rna_Main_groups_new");
+	func = RNA_def_function(srna, "new", "rna_Main_groups_new");
 	RNA_def_function_ui_description(func, "Add a new group to the main database");
-	parm= RNA_def_string(func, "name", "Group", 0, "", "New name for the datablock");
+	parm = RNA_def_string(func, "name", "Group", 0, "", "New name for the datablock");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_pointer(func, "group", "Group", "", "New group datablock");
+	parm = RNA_def_pointer(func, "group", "Group", "", "New group datablock");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_Main_groups_remove");
+	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");
+	parm = RNA_def_pointer(func, "group", "Group", "", "Group to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "tag", "rna_Main_groups_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_groups_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_groups_is_updated_get", NULL);
 }
@@ -1273,29 +1270,29 @@ void RNA_def_main_speakers(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "BlendDataSpeakers");
-	srna= RNA_def_struct(brna, "BlendDataSpeakers", NULL);
+	srna = RNA_def_struct(brna, "BlendDataSpeakers", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Speakers", "Collection of speakers");
 
-	func= RNA_def_function(srna, "new", "rna_Main_speakers_new");
+	func = RNA_def_function(srna, "new", "rna_Main_speakers_new");
 	RNA_def_function_ui_description(func, "Add a new speaker to the main database");
-	parm= RNA_def_string(func, "name", "Speaker", 0, "", "New name for the datablock");
+	parm = RNA_def_string(func, "name", "Speaker", 0, "", "New name for the datablock");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_pointer(func, "speaker", "Speaker", "", "New speaker datablock");
+	parm = RNA_def_pointer(func, "speaker", "Speaker", "", "New speaker datablock");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_Main_speakers_remove");
+	func = RNA_def_function(srna, "remove", "rna_Main_speakers_remove");
 	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");
+	parm = RNA_def_pointer(func, "speaker", "Speaker", "", "Speaker to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "tag", "rna_Main_speakers_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_speakers_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_speakers_is_updated_get", NULL);
 }
@@ -1308,38 +1305,38 @@ void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "BlendDataTexts");
-	srna= RNA_def_struct(brna, "BlendDataTexts", NULL);
+	srna = RNA_def_struct(brna, "BlendDataTexts", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Texts", "Collection of texts");
 
-	func= RNA_def_function(srna, "new", "rna_Main_texts_new");
+	func = RNA_def_function(srna, "new", "rna_Main_texts_new");
 	RNA_def_function_ui_description(func, "Add a new text to the main database");
-	parm= RNA_def_string(func, "name", "Text", 0, "", "New name for the datablock");
+	parm = RNA_def_string(func, "name", "Text", 0, "", "New name for the datablock");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_pointer(func, "text", "Text", "", "New text datablock");
+	parm = RNA_def_pointer(func, "text", "Text", "", "New text datablock");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_Main_texts_remove");
+	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");
+	parm = RNA_def_pointer(func, "text", "Text", "", "Text to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
 	/* load func */
-	func= RNA_def_function(srna, "load", "rna_Main_texts_load");
+	func = RNA_def_function(srna, "load", "rna_Main_texts_load");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Add a new text to the main database from a file");
-	parm= RNA_def_string_file_path(func, "filepath", "Path", FILE_MAX, "", "path for the datablock");
+	parm = RNA_def_string_file_path(func, "filepath", "Path", FILE_MAX, "", "path for the datablock");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_pointer(func, "text", "Text", "", "New text datablock");
+	parm = RNA_def_pointer(func, "text", "Text", "", "New text datablock");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "tag", "rna_Main_texts_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_texts_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_texts_is_updated_get", NULL);
 }
@@ -1352,17 +1349,17 @@ void RNA_def_main_sounds(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "BlendDataSounds");
-	srna= RNA_def_struct(brna, "BlendDataSounds", NULL);
+	srna = RNA_def_struct(brna, "BlendDataSounds", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Sounds", "Collection of sounds");
 
 	/* TODO, 'load' */
 
-	func= RNA_def_function(srna, "tag", "rna_Main_sounds_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_sounds_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_sounds_is_updated_get", NULL);
 }
@@ -1375,29 +1372,29 @@ void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "BlendDataArmatures");
-	srna= RNA_def_struct(brna, "BlendDataArmatures", NULL);
+	srna = RNA_def_struct(brna, "BlendDataArmatures", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Armatures", "Collection of armatures");
 
-	func= RNA_def_function(srna, "new", "rna_Main_armatures_new");
+	func = RNA_def_function(srna, "new", "rna_Main_armatures_new");
 	RNA_def_function_ui_description(func, "Add a new armature to the main database");
-	parm= RNA_def_string(func, "name", "Armature", 0, "", "New name for the datablock");
+	parm = RNA_def_string(func, "name", "Armature", 0, "", "New name for the datablock");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_pointer(func, "armature", "Armature", "", "New armature datablock");
+	parm = RNA_def_pointer(func, "armature", "Armature", "", "New armature datablock");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_Main_armatures_remove");
+	func = RNA_def_function(srna, "remove", "rna_Main_armatures_remove");
 	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");
+	parm = RNA_def_pointer(func, "armature", "Armature", "", "Armature to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "tag", "rna_Main_armatures_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_armatures_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_armatures_is_updated_get", NULL);
 }
@@ -1409,29 +1406,29 @@ void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "BlendDataActions");
-	srna= RNA_def_struct(brna, "BlendDataActions", NULL);
+	srna = RNA_def_struct(brna, "BlendDataActions", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Actions", "Collection of actions");
 
-	func= RNA_def_function(srna, "new", "rna_Main_actions_new");
+	func = RNA_def_function(srna, "new", "rna_Main_actions_new");
 	RNA_def_function_ui_description(func, "Add a new action to the main database");
-	parm= RNA_def_string(func, "name", "Action", 0, "", "New name for the datablock");
+	parm = RNA_def_string(func, "name", "Action", 0, "", "New name for the datablock");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_pointer(func, "action", "Action", "", "New action datablock");
+	parm = RNA_def_pointer(func, "action", "Action", "", "New action datablock");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_Main_actions_remove");
+	func = RNA_def_function(srna, "remove", "rna_Main_actions_remove");
 	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");
+	parm = RNA_def_pointer(func, "action", "Action", "", "Action to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "tag", "rna_Main_actions_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_actions_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_actions_is_updated_get", NULL);
 }
@@ -1443,29 +1440,29 @@ void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "BlendDataParticles");
-	srna= RNA_def_struct(brna, "BlendDataParticles", NULL);
+	srna = RNA_def_struct(brna, "BlendDataParticles", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Particle Settings", "Collection of particle settings");
 
-	func= RNA_def_function(srna, "new", "rna_Main_particles_new");
+	func = RNA_def_function(srna, "new", "rna_Main_particles_new");
 	RNA_def_function_ui_description(func, "Add a new particle settings instance to the main database");
-	parm= RNA_def_string(func, "name", "ParticleSettings", 0, "", "New name for the datablock");
+	parm = RNA_def_string(func, "name", "ParticleSettings", 0, "", "New name for the datablock");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_pointer(func, "particle", "ParticleSettings", "", "New particle settings datablock");
+	parm = RNA_def_pointer(func, "particle", "ParticleSettings", "", "New particle settings datablock");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_Main_particles_remove");
+	func = RNA_def_function(srna, "remove", "rna_Main_particles_remove");
 	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");
+	parm = RNA_def_pointer(func, "particle", "ParticleSettings", "", "Particle Settings to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "tag", "rna_Main_particles_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_particles_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_particles_is_updated_get", NULL);
 }
@@ -1478,15 +1475,15 @@ void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "BlendDataGreasePencils");
-	srna= RNA_def_struct(brna, "BlendDataGreasePencils", NULL);
+	srna = RNA_def_struct(brna, "BlendDataGreasePencils", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Grease Pencils", "Collection of grease pencils");
 
-	func= RNA_def_function(srna, "tag", "rna_Main_gpencil_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_gpencil_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	prop= RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Main_gpencil_is_updated_get", NULL);
 }
@@ -1498,29 +1495,28 @@ void RNA_def_main_movieclips(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, "BlendDataMovieClips");
-	srna= RNA_def_struct(brna, "BlendDataMovieClips", NULL);
+	srna = RNA_def_struct(brna, "BlendDataMovieClips", NULL);
 	RNA_def_struct_sdna(srna, "Main");
 	RNA_def_struct_ui_text(srna, "Main Movie Clips", "Collection of movie clips");
 
-	func= RNA_def_function(srna, "tag", "rna_Main_movieclips_tag");
-	parm= RNA_def_boolean(func, "value", 0, "Value", "");
+	func = RNA_def_function(srna, "tag", "rna_Main_movieclips_tag");
+	parm = RNA_def_boolean(func, "value", 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	func= RNA_def_function(srna, "remove", "rna_Main_movieclips_remove");
+	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");
+	parm = RNA_def_pointer(func, "clip", "MovieClip", "", "Movie clip to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
 	/* load func */
-	func= RNA_def_function(srna, "load", "rna_Main_movieclip_load");
+	func = RNA_def_function(srna, "load", "rna_Main_movieclip_load");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Add a new movie clip to the main database from a file");
-	parm= RNA_def_string_file_path(func, "filepath", "Path", FILE_MAX, "", "path for the datablock");
+	parm = RNA_def_string_file_path(func, "filepath", "Path", FILE_MAX, "", "path for the datablock");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_pointer(func, "clip", "MovieClip", "", "New movie clip datablock");
+	parm = RNA_def_pointer(func, "clip", "MovieClip", "", "New movie clip datablock");
 	RNA_def_function_return(func, parm);
 }
 
 #endif
-
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 21b9c83..7802241 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -49,7 +49,8 @@ static EnumPropertyItem prop_texture_coordinates_items[] = {
 {TEXCO_WINDOW, "WINDOW", 0, "Window", "Use screen coordinates as texture coordinates"},
 {TEXCO_NORM, "NORMAL", 0, "Normal", "Use normal vector as texture coordinates"},
 {TEXCO_REFL, "REFLECTION", 0, "Reflection", "Use reflection vector as texture coordinates"},
-{TEXCO_STRESS, "STRESS", 0, "Stress", "Use the difference of edge lengths compared to original coordinates of the mesh"},
+{TEXCO_STRESS, "STRESS", 0, "Stress",
+               "Use the difference of edge lengths compared to original coordinates of the mesh"},
 {TEXCO_TANGENT, "TANGENT", 0, "Tangent", "Use the optional tangent vector as texture coordinates"},
 {0, NULL, 0, NULL, NULL}};
 
@@ -70,8 +71,8 @@ EnumPropertyItem ramp_blend_items[] = {
 {MA_RAMP_SAT, "SATURATION", 0, "Saturation", ""},
 {MA_RAMP_VAL, "VALUE", 0, "Value", ""},
 {MA_RAMP_COLOR, "COLOR", 0, "Color", ""},
-{MA_RAMP_SOFT, "SOFT_LIGHT", 0, "Soft Light", ""}, 
-{MA_RAMP_LINEAR, "LINEAR_LIGHT", 0, "Linear Light", ""}, 
+{MA_RAMP_SOFT, "SOFT_LIGHT", 0, "Soft Light", ""},
+{MA_RAMP_LINEAR, "LINEAR_LIGHT", 0, "Linear Light", ""},
 {0, NULL, 0, NULL, NULL}};
 
 #ifdef RNA_RUNTIME
@@ -90,7 +91,7 @@ EnumPropertyItem ramp_blend_items[] = {
 
 static void rna_Material_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
 {
-	Material *ma= ptr->id.data;
+	Material *ma = ptr->id.data;
 
 	DAG_id_tag_update(&ma->id, 0);
 	if (scene) {  /* can be NULL, see [#30025] */
@@ -105,7 +106,7 @@ 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)
 {
-	Material *ma= ptr->id.data;
+	Material *ma = ptr->id.data;
 
 	DAG_id_tag_update(&ma->id, 0);
 	WM_main_add_notifier(NC_MATERIAL|ND_SHADING_DRAW, ma);
@@ -143,93 +144,93 @@ static PointerRNA rna_Material_physics_get(PointerRNA *ptr)
 
 static void rna_Material_type_set(PointerRNA *ptr, int value)
 {
-	Material *ma= (Material*)ptr->data;
+	Material *ma = (Material*)ptr->data;
 
-	if(ma->material_type == MA_TYPE_HALO && value != MA_TYPE_HALO)
+	if (ma->material_type == MA_TYPE_HALO && value != MA_TYPE_HALO)
 		ma->mode &= ~(MA_STAR|MA_HALO_XALPHA|MA_ZINV|MA_ENV);
 
-	ma->material_type= value;
+	ma->material_type = value;
 }
 
 static void rna_Material_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Material *ma= (Material*)ptr->data;
+	Material *ma = (Material*)ptr->data;
 	rna_iterator_array_begin(iter, (void*)ma->mtex, sizeof(MTex*), MAX_MTEX, 0, NULL);
 }
 
 static PointerRNA rna_Material_active_texture_get(PointerRNA *ptr)
 {
-	Material *ma= (Material*)ptr->data;
+	Material *ma = (Material*)ptr->data;
 	Tex *tex;
 
-	tex= give_current_material_texture(ma);
+	tex = give_current_material_texture(ma);
 	return rna_pointer_inherit_refine(ptr, &RNA_Texture, tex);
 }
 
 static void rna_Material_active_texture_set(PointerRNA *ptr, PointerRNA value)
 {
-	Material *ma= (Material*)ptr->data;
+	Material *ma = (Material*)ptr->data;
 
 	set_current_material_texture(ma, value.data);
 }
 
 static int rna_Material_active_texture_editable(PointerRNA *ptr)
 {
-	Material *ma= (Material*)ptr->id.data;
+	Material *ma = (Material*)ptr->id.data;
 
 	return has_current_material_texture(ma);
 }
 
 static PointerRNA rna_Material_active_node_material_get(PointerRNA *ptr)
 {
-	Material *ma= give_node_material((Material*)ptr->data);
+	Material *ma = give_node_material((Material*)ptr->data);
 	return rna_pointer_inherit_refine(ptr, &RNA_Material, ma);
 }
 
 static void rna_Material_active_node_material_set(PointerRNA *ptr, PointerRNA value)
 {
-	Material *ma= (Material*)ptr->data;
-	Material *ma_act= value.data;
+	Material *ma = (Material*)ptr->data;
+	Material *ma_act = value.data;
 
 	nodeSetActiveID(ma->nodetree, ID_MA, &ma_act->id);
 }
 
-static void rna_MaterialStrand_start_size_range(PointerRNA *ptr, float *min, float *max)
+static void rna_MaterialStrand_start_size_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
 {
-	Material *ma= (Material*)ptr->id.data;
+	Material *ma = (Material*)ptr->id.data;
 
-	if(ma->mode & MA_STR_B_UNITS) {
-		*min= 0.0001f;
-		*max= 2.0f;
+	if (ma->mode & MA_STR_B_UNITS) {
+		*min = 0.0001f;
+		*max = 2.0f;
 	}
 	else {
-		*min= 0.25f;
-		*max= 20.0f;
+		*min = 0.25f;
+		*max = 20.0f;
 	}
 }
 
-static void rna_MaterialStrand_end_size_range(PointerRNA *ptr, float *min, float *max)
+static void rna_MaterialStrand_end_size_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
 {
-	Material *ma= (Material*)ptr->id.data;
+	Material *ma = (Material*)ptr->id.data;
 
-	if(ma->mode & MA_STR_B_UNITS) {
-		*min= 0.0001f;
-		*max= 1.0f;
+	if (ma->mode & MA_STR_B_UNITS) {
+		*min = 0.0001f;
+		*max = 1.0f;
 	}
 	else {
-		*min= 0.25f;
-		*max= 10.0f;
+		*min = 0.25f;
+		*max = 10.0f;
 	}
 }
 
 static int rna_MaterialTextureSlot_use_get(PointerRNA *ptr)
 {
-	Material *ma= (Material*)ptr->id.data;
-	MTex *mtex= (MTex*)ptr->data;
+	Material *ma = (Material*)ptr->id.data;
+	MTex *mtex = (MTex*)ptr->data;
 	int a;
 
-	for(a=0; a<MAX_MTEX; a++)
-		if(ma->mtex[a] == mtex)
+	for (a = 0; a<MAX_MTEX; a++)
+		if (ma->mtex[a] == mtex)
 			return (ma->septex & (1<<a)) == 0;
 	
 	return 0;
@@ -237,13 +238,13 @@ static int rna_MaterialTextureSlot_use_get(PointerRNA *ptr)
 
 static void rna_MaterialTextureSlot_use_set(PointerRNA *ptr, int value)
 {
-	Material *ma= (Material*)ptr->id.data;
-	MTex *mtex= (MTex*)ptr->data;
+	Material *ma = (Material*)ptr->id.data;
+	MTex *mtex = (MTex*)ptr->data;
 	int a;
 
-	for(a=0; a<MAX_MTEX; a++) {
-		if(ma->mtex[a] == mtex) {
-			if(value)
+	for (a = 0; a<MAX_MTEX; a++) {
+		if (ma->mtex[a] == mtex) {
+			if (value)
 				ma->septex &= ~(1<<a);
 			else
 				ma->septex |= (1<<a);
@@ -253,31 +254,31 @@ static void rna_MaterialTextureSlot_use_set(PointerRNA *ptr, int value)
 
 static void rna_Material_use_diffuse_ramp_set(PointerRNA *ptr, int value)
 {
-	Material *ma= (Material*)ptr->data;
+	Material *ma = (Material*)ptr->data;
 
-	if(value) ma->mode |= MA_RAMP_COL;
+	if (value) ma->mode |= MA_RAMP_COL;
 	else ma->mode &= ~MA_RAMP_COL;
 
-	if((ma->mode & MA_RAMP_COL) && ma->ramp_col == NULL)
-		ma->ramp_col= add_colorband(0);
+	if ((ma->mode & MA_RAMP_COL) && ma->ramp_col == NULL)
+		ma->ramp_col = add_colorband(0);
 }
 
 static void rna_Material_use_specular_ramp_set(PointerRNA *ptr, int value)
 {
-	Material *ma= (Material*)ptr->data;
+	Material *ma = (Material*)ptr->data;
 
-	if(value) ma->mode |= MA_RAMP_SPEC;
+	if (value) ma->mode |= MA_RAMP_SPEC;
 	else ma->mode &= ~MA_RAMP_SPEC;
 
-	if((ma->mode & MA_RAMP_SPEC) && ma->ramp_spec == NULL)
-		ma->ramp_spec= add_colorband(0);
+	if ((ma->mode & MA_RAMP_SPEC) && ma->ramp_spec == NULL)
+		ma->ramp_spec = add_colorband(0);
 }
 
 static void rna_Material_use_nodes_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Material *ma= (Material*)ptr->data;
+	Material *ma = (Material*)ptr->data;
 
-	if(ma->use_nodes && ma->nodetree==NULL)
+	if (ma->use_nodes && ma->nodetree == NULL)
 		ED_node_shader_default(scene, &ma->id);
 	
 	rna_Material_update(bmain, scene, ptr);
@@ -286,15 +287,15 @@ static void rna_Material_use_nodes_update(Main *bmain, Scene *scene, PointerRNA
 static EnumPropertyItem *rna_Material_texture_coordinates_itemf(bContext *UNUSED(C), PointerRNA *ptr,
                                                                 PropertyRNA *UNUSED(prop), int *free)
 {
-	Material *ma= (Material*)ptr->id.data;
-	EnumPropertyItem *item= NULL;
-	int totitem= 0;
+	Material *ma = (Material*)ptr->id.data;
+	EnumPropertyItem *item = NULL;
+	int totitem = 0;
 	
 	RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_GLOB);
 	RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_OBJECT);
 	RNA_enum_items_add_value(&item, &totitem, prop_texture_coordinates_items, TEXCO_ORCO);
 	
-	if(ma->material_type == MA_TYPE_VOLUME) {
+	if (ma->material_type == MA_TYPE_VOLUME) {
 		
 	}
 	else if (ELEM3(ma->material_type, MA_TYPE_SURFACE, MA_TYPE_HALO, MA_TYPE_WIRE)) {
@@ -309,14 +310,14 @@ static EnumPropertyItem *rna_Material_texture_coordinates_itemf(bContext *UNUSED
 	}
 	
 	RNA_enum_item_end(&item, &totitem);
-	*free= 1;
+	*free = 1;
 	
 	return item;
 }
 
 MTex *rna_mtex_texture_slots_add(ID *self_id, struct bContext *C, ReportList *reports)
 {
-	MTex *mtex= add_mtex_id(self_id, -1);
+	MTex *mtex = add_mtex_id(self_id, -1);
 	if (mtex == NULL) {
 		BKE_reportf(reports, RPT_ERROR, "maximum number of textures added %d", MAX_MTEX);
 		return NULL;
@@ -332,12 +333,12 @@ MTex *rna_mtex_texture_slots_create(ID *self_id, struct bContext *C, ReportList
 {
 	MTex *mtex;
 
-	if(index < 0 || index >= MAX_MTEX) {
+	if (index < 0 || index >= MAX_MTEX) {
 		BKE_reportf(reports, RPT_ERROR, "index %d is invalid", index);
 		return NULL;
 	}
 
-	mtex= add_mtex_id(self_id, index);
+	mtex = add_mtex_id(self_id, index);
 
 	/* for redraw only */
 	WM_event_add_notifier(C, NC_TEXTURE, CTX_data_scene(C));
@@ -357,15 +358,15 @@ void rna_mtex_texture_slots_clear(ID *self_id, struct bContext *C, ReportList *r
 		return;
 	}
 	
-	if(index < 0 || index >= MAX_MTEX) {
+	if (index < 0 || index >= MAX_MTEX) {
 		BKE_reportf(reports, RPT_ERROR, "index %d is invalid", index);
 		return;
 	}
 
-	if(mtex_ar[index]) {
+	if (mtex_ar[index]) {
 		id_us_min((ID *)mtex_ar[index]->tex);
 		MEM_freeN(mtex_ar[index]);
-		mtex_ar[index]= NULL;
+		mtex_ar[index] = NULL;
 	}
 
 	/* for redraw only */
@@ -419,8 +420,9 @@ static void rna_def_material_mtex(BlenderRNA *brna)
 		{MTEX_COMPAT_BUMP, "BUMP_COMPATIBLE", 0, "Compatible", ""},
 		{MTEX_3TAP_BUMP, "BUMP_LOW_QUALITY", 0, "Low Quality", "Use 3 tap filtering"},
 		{MTEX_5TAP_BUMP, "BUMP_MEDIUM_QUALITY", 0, "Medium Quality", "Use 5 tap filtering"},
-		{MTEX_BICUBIC_BUMP, "BUMP_BEST_QUALITY", 0, "Best Quality", "Use bicubic filtering (requires OpenGL 3.0+, "
-		                                            "it will fall back on medium setting for other systems)"},
+		{MTEX_BICUBIC_BUMP, "BUMP_BEST_QUALITY", 0,
+		                    "Best Quality", "Use bicubic filtering (requires OpenGL 3.0+, it will fall back on "
+		                    "medium setting for other systems)"},
 		{0, NULL, 0, NULL, NULL}};
 
 	static EnumPropertyItem prop_bump_space_items[] = {
@@ -429,299 +431,300 @@ static void rna_def_material_mtex(BlenderRNA *brna)
 		{MTEX_BUMP_TEXTURESPACE, "BUMP_TEXTURESPACE", 0, "TextureSpace", ""},
 		{0, NULL, 0, NULL, NULL}};
 	
-	srna= RNA_def_struct(brna, "MaterialTextureSlot", "TextureSlot");
+	srna = RNA_def_struct(brna, "MaterialTextureSlot", "TextureSlot");
 	RNA_def_struct_sdna(srna, "MTex");
 	RNA_def_struct_ui_text(srna, "Material Texture Slot", "Texture slot for textures in a Material datablock");
 
-	prop= RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "texco");
 	RNA_def_property_enum_items(prop, prop_texture_coordinates_items);
 	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Material_texture_coordinates_itemf");
 	RNA_def_property_ui_text(prop, "Texture Coordinates", "");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "object");
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Object", "Object to use for mapping with Object texture coordinates");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "uvname");
 	RNA_def_property_ui_text(prop, "UV Map", "UV map to use for mapping with UV texture coordinates");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "use_from_dupli", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_from_dupli", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_DUPLI_MAPTO);
 	RNA_def_property_ui_text(prop, "From Dupli",
-	                         "Dupli's instanced from verts, faces or particles, inherit texture coordinate from their parent");
+	                         "Dupli's instanced from verts, faces or particles, inherit texture coordinate "
+	                         "from their parent");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "use_from_original", PROP_BOOLEAN, PROP_NONE);
+	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",
 	                         "Dupli's derive their object coordinates from the original object's transformation");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "use_map_color_diffuse", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_color_diffuse", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_COL);
 	RNA_def_property_ui_text(prop, "Diffuse Color", "The texture affects basic color of the material");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_map_normal", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_normal", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_NORM);
 	RNA_def_property_ui_text(prop, "Normal", "The texture affects the rendered normal");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_map_color_spec", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_color_spec", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_COLSPEC);
 	RNA_def_property_ui_text(prop, "Specular Color", "The texture affects the specularity color");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_map_mirror", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_mirror", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_COLMIR);
 	RNA_def_property_ui_text(prop, "Mirror", "The texture affects the mirror color");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_map_diffuse", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_diffuse", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_REF);
 	RNA_def_property_ui_text(prop, "Diffuse", "The texture affects the value of diffuse reflectivity");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_map_specular", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_specular", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_SPEC);
 	RNA_def_property_ui_text(prop, "Specular", "The texture affects the value of specular reflectivity");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_map_ambient", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_ambient", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_AMB);
 	RNA_def_property_ui_text(prop, "Ambient", "The texture affects the value of ambient");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_map_hardness", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_hardness", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_HAR);
 	RNA_def_property_ui_text(prop, "Hardness", "The texture affects the hardness value");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_map_raymir", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_raymir", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_RAYMIRR);
 	RNA_def_property_ui_text(prop, "Ray-Mirror", "The texture affects the ray-mirror value");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_map_alpha", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_alpha", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_ALPHA);
 	RNA_def_property_ui_text(prop, "Alpha", "The texture affects the alpha value");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_map_emit", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_emit", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_EMIT);
 	RNA_def_property_ui_text(prop, "Emit", "The texture affects the emit value");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_map_translucency", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_translucency", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_TRANSLU);
 	RNA_def_property_ui_text(prop, "Translucency", "The texture affects the translucency value");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_map_displacement", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_displacement", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_DISPLACE);
 	RNA_def_property_ui_text(prop, "Displacement", "Let the texture displace the surface");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_map_warp", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_warp", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_WARP);
 	RNA_def_property_ui_text(prop, "Warp", "Let the texture warp texture coordinates of next channels");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "projx");
 	RNA_def_property_enum_items(prop, prop_x_mapping_items);
 	RNA_def_property_ui_text(prop, "X Mapping", "");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "mapping_y", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mapping_y", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "projy");
 	RNA_def_property_enum_items(prop, prop_y_mapping_items);
 	RNA_def_property_ui_text(prop, "Y Mapping", "");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "mapping_z", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mapping_z", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "projz");
 	RNA_def_property_enum_items(prop, prop_z_mapping_items);
 	RNA_def_property_ui_text(prop, "Z Mapping", "");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, prop_mapping_items);
 	RNA_def_property_ui_text(prop, "Mapping", "");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "normal_map_space", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "normal_map_space", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "normapspace");
 	RNA_def_property_enum_items(prop, prop_normal_map_space_items);
 	RNA_def_property_ui_text(prop, "Normal Map Space", "Set space of normal map image");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "norfac");
 	RNA_def_property_ui_range(prop, -5, 5, 10, 3);
 	RNA_def_property_ui_text(prop, "Normal Factor", "Amount texture affects normal values");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "displacement_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "displacement_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "dispfac");
 	RNA_def_property_ui_range(prop, -1, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Displacement Factor", "Amount texture displaces the surface");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "warp_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "warp_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "warpfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Warp Factor", "Amount texture affects texture coordinates of next channels");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "specular_color_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "specular_color_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "colspecfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Specular Color Factor", "Amount texture affects specular color");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "diffuse_color_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "diffuse_color_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "colfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Diffuse Color Factor", "Amount texture affects diffuse color");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "mirror_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "mirror_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "mirrfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Mirror Factor", "Amount texture affects mirror color");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "alpha_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "alpha_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "alphafac");
 	RNA_def_property_ui_range(prop, -1, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Alpha Factor", "Amount texture affects alpha");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "diffuse_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "diffuse_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "difffac");
 	RNA_def_property_ui_range(prop, -1, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Diffuse Factor", "Amount texture affects diffuse reflectivity");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "specular_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "specular_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "specfac");
 	RNA_def_property_ui_range(prop, -1, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Specular Factor", "Amount texture affects specular reflectivity");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "emit_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "emit_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "emitfac");
 	RNA_def_property_ui_range(prop, -1, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Emit Factor", "Amount texture affects emission");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "hardness_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "hardness_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "hardfac");
 	RNA_def_property_ui_range(prop, -1, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Hardness Factor", "Amount texture affects hardness");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "raymir_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "raymir_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "raymirrfac");
 	RNA_def_property_ui_range(prop, -1, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Ray Mirror Factor", "Amount texture affects ray mirror");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "translucency_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "translucency_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "translfac");
 	RNA_def_property_ui_range(prop, -1, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Translucency Factor", "Amount texture affects translucency");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "ambient_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "ambient_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "ambfac");
 	RNA_def_property_ui_range(prop, -1, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Ambient Factor", "Amount texture affects ambient");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
 	/* volume material */
-	prop= RNA_def_property(srna, "use_map_color_emission", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_color_emission", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_EMISSION_COL);
 	RNA_def_property_ui_text(prop, "Emission Color", "The texture affects the color of emission");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_map_color_reflection", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_color_reflection", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_REFLECTION_COL);
 	RNA_def_property_ui_text(prop, "Reflection Color", "The texture affects the color of scattered light");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_map_color_transmission", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_color_transmission", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_TRANSMISSION_COL);
 	RNA_def_property_ui_text(prop, "Transmission Color",
 	                         "The texture affects the result color after other light has been scattered/absorbed");
 	RNA_def_property_update(prop, NC_TEXTURE, NULL);
 	
-	prop= RNA_def_property(srna, "use_map_density", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_density", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_DENSITY);
 	RNA_def_property_ui_text(prop, "Density", "The texture affects the volume's density");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_map_emission", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_emission", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_EMISSION);
 	RNA_def_property_ui_text(prop, "Emission", "The texture affects the volume's emission");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_map_scatter", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_scatter", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_SCATTERING);
 	RNA_def_property_ui_text(prop, "Scattering", "The texture affects the volume's scattering");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_map_reflect", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_reflect", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_REFLECTION);
 	RNA_def_property_ui_text(prop, "Reflection", "The texture affects the reflected light's brightness");
 	RNA_def_property_update(prop, NC_TEXTURE, NULL);
 	
-	prop= RNA_def_property(srna, "emission_color_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "emission_color_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "colemitfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Emission Color Factor", "Amount texture affects emission color");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "reflection_color_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "reflection_color_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "colreflfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Reflection Color Factor", "Amount texture affects color of out-scattered light");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "transmission_color_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "transmission_color_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "coltransfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Transmission Color Factor",
 	                         "Amount texture affects result color after light has been scattered/absorbed");
 	RNA_def_property_update(prop, NC_TEXTURE, NULL);
 	
-	prop= RNA_def_property(srna, "density_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "density_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "densfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Density Factor", "Amount texture affects density");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "emission_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "emission_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "emitfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Emission Factor", "Amount texture affects emission");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "scattering_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "scattering_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "scatterfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Scattering Factor", "Amount texture affects scattering");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 								  
-	prop= RNA_def_property(srna, "reflection_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "reflection_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "reflfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Reflection Factor", "Amount texture affects brightness of out-scattered light");
@@ -729,18 +732,18 @@ static void rna_def_material_mtex(BlenderRNA *brna)
 	
 	/* end volume material */
 	
-	prop= RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_MaterialTextureSlot_use_get", "rna_MaterialTextureSlot_use_set");
 	RNA_def_property_ui_text(prop, "Enabled", "Enable this material texture slot");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "bump_method", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "bump_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "texflag");
 	RNA_def_property_enum_items(prop, prop_bump_method_items);
 	RNA_def_property_ui_text(prop, "Bump Method", "Method to use for bump mapping");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "bump_objectspace", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "bump_objectspace", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "texflag");
 	RNA_def_property_enum_items(prop, prop_bump_space_items);
 	RNA_def_property_ui_text(prop, "Bump Space", "Space to apply bump mapping in");
@@ -756,48 +759,50 @@ static void rna_def_material_gamesettings(BlenderRNA *brna)
 		{GEMAT_SOLID, "OPAQUE", 0, "Opaque", "Render color of textured face as color"},
 		{GEMAT_ADD, "ADD", 0, "Add", "Render face transparent and add color of face"},
 		{GEMAT_CLIP, "CLIP", 0, "Alpha Clip", "Use the image alpha values clipped with no blending (binary alpha)"},
-		{GEMAT_ALPHA, "ALPHA", 0, "Alpha Blend", "Render polygon transparent, depending on alpha channel of the texture"},
-		{GEMAT_ALPHA_SORT, "ALPHA_SORT", 0, "Alpha Sort", "Sort faces for correct alpha drawing (slow, use Alpha Clip instead when possible)"},		
+		{GEMAT_ALPHA, "ALPHA", 0, "Alpha Blend",
+		              "Render polygon transparent, depending on alpha channel of the texture"},
+		{GEMAT_ALPHA_SORT, "ALPHA_SORT", 0, "Alpha Sort",
+		                   "Sort faces for correct alpha drawing (slow, use Alpha Clip instead when possible)"},
 		{0, NULL, 0, NULL, NULL}};
 
 	static EnumPropertyItem prop_face_orientation_items[] = {
 		{GEMAT_NORMAL,"NORMAL",0,"Normal","No tranformation"},
 		{GEMAT_HALO, "HALO", 0, "Halo", "Screen aligned billboard"},
 		{GEMAT_BILLBOARD, "BILLBOARD", 0, "Billboard", "Billboard with Z-axis constraint"},
-		{GEMAT_SHADOW, "SHADOW", 0, "Shadow", "Faces are used for shadow"},		
+		{GEMAT_SHADOW, "SHADOW", 0, "Shadow", "Faces are used for shadow"},
 		{0, NULL, 0, NULL, NULL}};
 	
-	srna= RNA_def_struct(brna, "MaterialGameSettings", NULL);
+	srna = RNA_def_struct(brna, "MaterialGameSettings", NULL);
 	RNA_def_struct_sdna(srna, "GameSettings");
 	RNA_def_struct_nested(brna, srna, "Material");
 	RNA_def_struct_ui_text(srna, "Material Game Settings", "Game Engine settings for a Material datablock");
 	
-	prop= RNA_def_property(srna, "use_backface_culling", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_backface_culling", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", GEMAT_BACKCULL); /* use bitflags */
 	RNA_def_property_ui_text(prop, "Backface Culling", "Hide Back of the face in Game Engine ");
 	RNA_def_property_update(prop, 0, "rna_Material_draw_update");
 
-	prop= RNA_def_property(srna, "text", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "text", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", GEMAT_TEXT); /* use bitflags */
 	RNA_def_property_ui_text(prop, "Text", "Use material as text in Game Engine ");
 	RNA_def_property_update(prop, 0, "rna_Material_draw_update");
 
-	prop= RNA_def_property(srna, "invisible", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invisible", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", GEMAT_INVISIBLE); /* use bitflags */
 	RNA_def_property_ui_text(prop, "Invisible", "Make face invisible");
 	RNA_def_property_update(prop, 0, "rna_Material_draw_update");
 
-	prop= RNA_def_property(srna, "alpha_blend", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "alpha_blend", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "alpha_blend");
 	RNA_def_property_enum_items(prop, prop_alpha_blend_items);
 	RNA_def_property_ui_text(prop, "Blend Mode", "Blend Mode for Transparent Faces");
 	RNA_def_property_update(prop, 0, "rna_Material_draw_update");
 
-	prop= RNA_def_property(srna, "face_orientation", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "face_orientation", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, prop_face_orientation_items);
 	RNA_def_property_ui_text(prop, "Face Orientations", "Especial face orientation options");
 
-	prop= RNA_def_property(srna, "physics", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "physics", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GEMAT_NOPHYSICS); /* use bitflags */
 	RNA_def_property_ui_text(prop, "Physics", "Use physics properties of materials ");
 }
@@ -813,91 +818,91 @@ static void rna_def_material_colors(StructRNA *srna)
 		{MA_RAMP_IN_RESULT, "RESULT", 0, "Result", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	prop= RNA_def_property(srna, "diffuse_color", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "diffuse_color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "r");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Diffuse Color", "Diffuse color of the material");
 	RNA_def_property_update(prop, 0, "rna_Material_draw_update");
 	
-	prop= RNA_def_property(srna, "specular_color", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "specular_color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "specr");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Specular Color", "Specular color of the material");
 	RNA_def_property_update(prop, 0, "rna_Material_draw_update");
 	
-	prop= RNA_def_property(srna, "mirror_color", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "mirror_color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "mirr");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Mirror Color", "Mirror color of the material");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Alpha", "Alpha transparency of the material");
 	RNA_def_property_update(prop, 0, "rna_Material_draw_update");
 
-	prop= RNA_def_property(srna, "specular_alpha", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "specular_alpha", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "spectra");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Specular Alpha", "Alpha transparency for specular areas");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
 	/* Color bands */
-	prop= RNA_def_property(srna, "use_diffuse_ramp", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_diffuse_ramp", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_RAMP_COL);
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_Material_use_diffuse_ramp_set");
 	RNA_def_property_ui_text(prop, "Use Diffuse Ramp", "Toggle diffuse ramp operations");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "diffuse_ramp", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "diffuse_ramp", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "ramp_col");
 	RNA_def_property_struct_type(prop, "ColorRamp");
 	RNA_def_property_ui_text(prop, "Diffuse Ramp", "Color ramp used to affect diffuse shading");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "use_specular_ramp", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_specular_ramp", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_RAMP_SPEC);
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_Material_use_specular_ramp_set");
 	RNA_def_property_ui_text(prop, "Use Specular Ramp", "Toggle specular ramp operations");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "specular_ramp", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "specular_ramp", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "ramp_spec");
 	RNA_def_property_struct_type(prop, "ColorRamp");
 	RNA_def_property_ui_text(prop, "Specular Ramp", "Color ramp used to affect specular shading");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "diffuse_ramp_blend", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "diffuse_ramp_blend", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "rampblend_col");
 	RNA_def_property_enum_items(prop, ramp_blend_items);
 	RNA_def_property_ui_text(prop, "Diffuse Ramp Blend", "Blending method of the ramp and the diffuse color");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "specular_ramp_blend", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "specular_ramp_blend", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "rampblend_spec");
 	RNA_def_property_enum_items(prop, ramp_blend_items);
 	RNA_def_property_ui_text(prop, "Specular Ramp Blend", "Blending method of the ramp and the specular color");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "diffuse_ramp_input", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "diffuse_ramp_input", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "rampin_col");
 	RNA_def_property_enum_items(prop, prop_ramp_input_items);
 	RNA_def_property_ui_text(prop, "Diffuse Ramp Input", "How the ramp maps on the surface");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "specular_ramp_input", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "specular_ramp_input", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "rampin_spec");
 	RNA_def_property_enum_items(prop, prop_ramp_input_items);
 	RNA_def_property_ui_text(prop, "Specular Ramp Input", "How the ramp maps on the surface");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "diffuse_ramp_factor", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "diffuse_ramp_factor", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "rampfac_col");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Diffuse Ramp Factor", "Blending factor (also uses alpha in Colorband)");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "specular_ramp_factor", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "specular_ramp_factor", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "rampfac_spec");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Specular Ramp Factor", "Blending factor (also uses alpha in Colorband)");
@@ -916,48 +921,48 @@ static void rna_def_material_diffuse(StructRNA *srna)
 		{MA_DIFF_FRESNEL, "FRESNEL", 0, "Fresnel", "Use a Fresnel shader"},
 		{0, NULL, 0, NULL, NULL}};
 	
-	prop= RNA_def_property(srna, "diffuse_shader", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "diffuse_shader", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "diff_shader");
 	RNA_def_property_enum_items(prop, prop_diff_shader_items);
 	RNA_def_property_ui_text(prop, "Diffuse Shader Model", "");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "diffuse_intensity", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "diffuse_intensity", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "ref");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Diffuse Intensity", "Amount of diffuse reflection");
 	RNA_def_property_update(prop, 0, "rna_Material_draw_update");
 	
-	prop= RNA_def_property(srna, "roughness", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "roughness", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 3.14f);
 	RNA_def_property_ui_text(prop, "Roughness", "Oren-Nayar Roughness");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "diffuse_toon_size", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "diffuse_toon_size", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "param[0]");
 	RNA_def_property_range(prop, 0.0f, 3.14f);
 	RNA_def_property_ui_text(prop, "Diffuse Toon Size", "Size of diffuse toon area");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "diffuse_toon_smooth", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "diffuse_toon_smooth", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "param[1]");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Diffuse Toon Smooth", "Smoothness of diffuse toon area");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "diffuse_fresnel", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "diffuse_fresnel", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "param[1]");
 	RNA_def_property_range(prop, 0.0f, 5.0f);
 	RNA_def_property_ui_text(prop, "Diffuse Fresnel", "Power of Fresnel");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "diffuse_fresnel_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "diffuse_fresnel_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "param[0]");
 	RNA_def_property_range(prop, 0.0f, 5.0f);
 	RNA_def_property_ui_text(prop, "Diffuse Fresnel Factor", "Blending factor of Fresnel");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "darkness", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "darkness", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 2.0f);
 	RNA_def_property_ui_text(prop, "Darkness", "Minnaert darkness");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
@@ -973,55 +978,56 @@ static void rna_def_material_raymirror(BlenderRNA *brna)
 		{MA_RAYMIR_FADETOMAT, "FADE_TO_MATERIAL", 0, "Material", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "MaterialRaytraceMirror", NULL);
+	srna = RNA_def_struct(brna, "MaterialRaytraceMirror", NULL);
 	RNA_def_struct_sdna(srna, "Material");
 	RNA_def_struct_nested(brna, srna, "Material");
 	RNA_def_struct_ui_text(srna, "Material Raytrace Mirror", "Raytraced reflection settings for a Material datablock");
 
-	prop= RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_RAYMIRROR); /* use bitflags */
 	RNA_def_property_ui_text(prop, "Enabled", "Enable raytraced reflections");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 		
-	prop= RNA_def_property(srna, "reflect_factor", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "reflect_factor", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "ray_mirror");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Reflectivity", "Amount of mirror reflection for raytrace");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "fresnel", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "fresnel", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "fresnel_mir");
 	RNA_def_property_range(prop, 0.0f, 5.0f);
 	RNA_def_property_ui_text(prop, "Fresnel", "Power of Fresnel for mirror reflection");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "fresnel_factor", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "fresnel_factor", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "fresnel_mir_i");
 	RNA_def_property_range(prop, 0.0f, 5.0f);
 	RNA_def_property_ui_text(prop, "Fresnel Factor", "Blending factor for Fresnel");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "gloss_factor", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "gloss_factor", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "gloss_mir");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Gloss Amount",
 	                         "The shininess of the reflection (values < 1.0 give diffuse, blurry reflections)");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "gloss_anisotropic", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "gloss_anisotropic", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "aniso_gloss_mir");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Gloss Anisotropy",
-	                         "The shape of the reflection, from 0.0 (circular) to 1.0 (fully stretched along the tangent");
+	                         "The shape of the reflection, from 0.0 (circular) to 1.0 "
+	                         "(fully stretched along the tangent");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 		
-	prop= RNA_def_property(srna, "gloss_samples", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "gloss_samples", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "samp_gloss_mir");
 	RNA_def_property_range(prop, 0, 1024);
 	RNA_def_property_ui_text(prop, "Gloss Samples", "Number of cone samples averaged for blurry reflections");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "gloss_threshold", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "gloss_threshold", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "adapt_thresh_mir");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Gloss Threshold",
@@ -1029,13 +1035,13 @@ static void rna_def_material_raymirror(BlenderRNA *brna)
 	                         "this amount [as a percentage], sampling is stopped)");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "ray_depth");
 	RNA_def_property_ui_range(prop, 0, 100, 1, 3);
 	RNA_def_property_ui_text(prop, "Depth", "Maximum allowed number of light inter-reflections");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "dist_mir");
 	RNA_def_property_range(prop, 0.0f, 10000.0f);
 	RNA_def_property_ui_text(prop, "Maximum Distance",
@@ -1043,7 +1049,7 @@ static void rna_def_material_raymirror(BlenderRNA *brna)
 	                         "range fade to sky color or material color)");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "fade_to", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "fade_to", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "fadeto_mir");
 	RNA_def_property_enum_items(prop, prop_fadeto_mir_items);
 	RNA_def_property_ui_text(prop, "Fade-out Color",
@@ -1057,43 +1063,44 @@ static void rna_def_material_raytra(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "MaterialRaytraceTransparency", NULL);
+	srna = RNA_def_struct(brna, "MaterialRaytraceTransparency", NULL);
 	RNA_def_struct_sdna(srna, "Material");
 	RNA_def_struct_nested(brna, srna, "Material");
-	RNA_def_struct_ui_text(srna, "Material Raytrace Transparency", "Raytraced refraction settings for a Material datablock");
+	RNA_def_struct_ui_text(srna, "Material Raytrace Transparency",
+	                       "Raytraced refraction settings for a Material datablock");
 
-	prop= RNA_def_property(srna, "ior", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "ior", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "ang");
 	RNA_def_property_range(prop, 0.25f, 4.0f);
 	RNA_def_property_ui_text(prop, "IOR", "Angular index of refraction for raytraced refraction");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "fresnel", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "fresnel", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "fresnel_tra");
 	RNA_def_property_range(prop, 0.0f, 5.0f);
 	RNA_def_property_ui_text(prop, "Fresnel", "Power of Fresnel for transparency (Ray or ZTransp)");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "fresnel_factor", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "fresnel_factor", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "fresnel_tra_i");
 	RNA_def_property_range(prop, 1.0f, 5.0f);
 	RNA_def_property_ui_text(prop, "Fresnel Factor", "Blending factor for Fresnel");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "gloss_factor", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "gloss_factor", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "gloss_tra");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Gloss Amount",
 	                         "The clarity of the refraction. Values < 1.0 give diffuse, blurry refractions");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "gloss_samples", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "gloss_samples", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "samp_gloss_tra");
 	RNA_def_property_range(prop, 0, 1024);
 	RNA_def_property_ui_text(prop, "Gloss Samples", "Number of cone samples averaged for blurry refractions");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "gloss_threshold", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "gloss_threshold", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "adapt_thresh_tra");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Gloss Threshold",
@@ -1101,13 +1108,13 @@ static void rna_def_material_raytra(BlenderRNA *brna)
 	                         "this amount (as a percentage), sampling is stopped");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "ray_depth_tra");
 	RNA_def_property_ui_range(prop, 0, 100, 1, 3);
 	RNA_def_property_ui_text(prop, "Depth", "Maximum allowed number of light inter-refractions");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "filter", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "filter", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "filter");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Filter",
@@ -1115,7 +1122,7 @@ static void rna_def_material_raytra(BlenderRNA *brna)
 	                         "transparency (simulating absorption)");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "depth_max", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "depth_max", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "tx_limit");
 	RNA_def_property_range(prop, 0.0f, 100.0f);
 	RNA_def_property_ui_text(prop, "Limit",
@@ -1123,7 +1130,7 @@ static void rna_def_material_raytra(BlenderRNA *brna)
 	                         "before becoming fully filtered (0.0 is disabled)");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "tx_falloff");
 	RNA_def_property_range(prop, 0.1f, 10.0f);
 	RNA_def_property_ui_text(prop, "Falloff", "Falloff power for transmissivity filter effect (1.0 is linear)");
@@ -1146,72 +1153,74 @@ static void rna_def_material_volume(BlenderRNA *brna)
 	static EnumPropertyItem prop_stepsize_items[] = {
 		{MA_VOL_STEP_RANDOMIZED, "RANDOMIZED", 0, "Randomized", ""},
 		{MA_VOL_STEP_CONSTANT, "CONSTANT", 0, "Constant", ""},
-		//{MA_VOL_STEP_ADAPTIVE, "ADAPTIVE", 0, "Adaptive", ""},
+		/*{MA_VOL_STEP_ADAPTIVE, "ADAPTIVE", 0, "Adaptive", ""}, */
 		{0, NULL, 0, NULL, NULL}};
 		
-	srna= RNA_def_struct(brna, "MaterialVolume", NULL);
+	srna = RNA_def_struct(brna, "MaterialVolume", NULL);
 	RNA_def_struct_sdna(srna, "VolumeSettings");
 	RNA_def_struct_nested(brna, srna, "Material");
 	RNA_def_struct_ui_text(srna, "Material Volume", "Volume rendering settings for a Material datablock");
 	
-	prop= RNA_def_property(srna, "step_method", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "step_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "stepsize_type");
 	RNA_def_property_enum_items(prop, prop_stepsize_items);
 	RNA_def_property_ui_text(prop, "Step Calculation", "Method of calculating the steps through the volume");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "step_size", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "step_size", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "stepsize");
 	RNA_def_property_range(prop, 0.0f, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.001f, 1.0f, 1, 3);
 	RNA_def_property_ui_text(prop, "Step Size", "Distance between subsequent volume depth samples");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "light_method", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "light_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "shade_type");
 	RNA_def_property_enum_items(prop, prop_lighting_items);
-	RNA_def_property_ui_text(prop, "Lighting Mode", "Method of shading, attenuating, and scattering light through the volume");
+	RNA_def_property_ui_text(prop, "Lighting Mode",
+	                         "Method of shading, attenuating, and scattering light through the volume");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_external_shadows", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_external_shadows", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "shadeflag", MA_VOL_RECV_EXT_SHADOW); /* use bitflags */
 	RNA_def_property_ui_text(prop, "External Shadows", "Receive shadows from sources outside the volume (temporary)");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_light_cache", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_light_cache", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "shadeflag", MA_VOL_PRECACHESHADING); /* use bitflags */
 	RNA_def_property_ui_text(prop, "Light Cache",
 	                         "Pre-calculate the shading information into a voxel grid, "
 	                         "speeds up shading at slightly less accuracy");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "cache_resolution", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "cache_resolution", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "precache_resolution");
 	RNA_def_property_range(prop, 1, 1024);
 	RNA_def_property_ui_text(prop, "Resolution",
-	                         "Resolution of the voxel grid, low resolutions are faster, high resolutions use more memory");
+	                         "Resolution of the voxel grid, low resolutions are faster, "
+	                         "high resolutions use more memory");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "ms_diffusion", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "ms_diffusion", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "ms_diff");
 	RNA_def_property_range(prop, 0.0f, FLT_MAX);
 	RNA_def_property_ui_text(prop, "Diffusion", "Diffusion factor, the strength of the blurring effect");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "ms_spread", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "ms_spread", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "ms_spread");
 	RNA_def_property_range(prop, 0, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3);
 	RNA_def_property_ui_text(prop, "Spread", "Proportional distance over which the light is diffused");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "ms_intensity", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "ms_intensity", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "ms_intensity");
 	RNA_def_property_range(prop, 0.0f, FLT_MAX);
 	RNA_def_property_ui_text(prop, "Intensity", "Multiplier for multiple scattered light energy");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "depth_threshold", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "depth_threshold", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "depth_cutoff");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Depth Cutoff",
@@ -1219,20 +1228,20 @@ static void rna_def_material_volume(BlenderRNA *brna)
 	                         "higher values give speedups in dense volumes at the expense of accuracy");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "density", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "density", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "density");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Density", "The base density of the volume");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "density_scale", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "density_scale", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "density_scale");
 	RNA_def_property_range(prop, 0.0f, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
 	RNA_def_property_ui_text(prop, "Density Scale", "Multiplier for the material's density");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "scattering", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "scattering", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "scattering");
 	RNA_def_property_range(prop, 0.0f, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1 ,3);
@@ -1241,21 +1250,21 @@ static void rna_def_material_volume(BlenderRNA *brna)
 	                         "the more out-scattering, the shallower the light will penetrate");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "transmission_color", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "transmission_color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "transmission_col");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Transmission Color",
 	                         "Result color of the volume, after other light has been scattered/absorbed");
 	RNA_def_property_update(prop, 0, "rna_Material_draw_update");
 	
-	prop= RNA_def_property(srna, "reflection_color", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "reflection_color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "reflection_col");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Reflection Color",
 	                         "Color of light scattered out of the volume (does not affect transmission)");
 	RNA_def_property_update(prop, 0, "rna_Material_draw_update");
 	
-	prop= RNA_def_property(srna, "reflection", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "reflection", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "reflection");
 	RNA_def_property_range(prop, 0.0f, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1 ,3);
@@ -1263,23 +1272,24 @@ static void rna_def_material_volume(BlenderRNA *brna)
 	                         "Multiplier to make out-scattered light brighter or darker (non-physically correct)");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "emission_color", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "emission_color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "emission_col");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Emission Color", "Color of emitted light");
 	RNA_def_property_update(prop, 0, "rna_Material_draw_update");
 	
-	prop= RNA_def_property(srna, "emission", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "emission", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "emission");
 	RNA_def_property_range(prop, 0.0f, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
 	RNA_def_property_ui_text(prop, "Emission", "Amount of light that gets emitted by the volume");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 		
-	prop= RNA_def_property(srna, "asymmetry", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "asymmetry", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "asymmetry");
 	RNA_def_property_range(prop, -1.0f, 1.0f);
-	RNA_def_property_ui_text(prop, "Asymmetry", "Back scattering (-1.0) to Forward scattering (1.0) and the range in between");
+	RNA_def_property_ui_text(prop, "Asymmetry",
+	                         "Back scattering (-1.0) to Forward scattering (1.0) and the range in between");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 }
 
@@ -1289,124 +1299,124 @@ static void rna_def_material_halo(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "MaterialHalo", NULL);
+	srna = RNA_def_struct(brna, "MaterialHalo", NULL);
 	RNA_def_struct_sdna(srna, "Material");
 	RNA_def_struct_nested(brna, srna, "Material");
 	RNA_def_struct_ui_text(srna, "Material Halo", "Halo particle effect settings for a Material datablock");
 
-	prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "hasize");
 	RNA_def_property_range(prop, 0.0f, 100.0f);
 	RNA_def_property_ui_text(prop, "Size", "Dimension of the halo");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "hardness", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "hardness", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "har");
 	RNA_def_property_range(prop, 0, 127);
 	RNA_def_property_ui_text(prop, "Hardness", "Hardness of the halo");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "add", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "add", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "add");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Add", "Strength of the add effect");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "ring_count", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "ring_count", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "ringc");
 	RNA_def_property_range(prop, 0, 24);
 	RNA_def_property_ui_text(prop, "Rings", "Number of rings rendered over the halo");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "line_count", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "line_count", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "linec");
 	RNA_def_property_range(prop, 0, 250);
 	RNA_def_property_ui_text(prop, "Line Number", "Number of star shaped lines rendered over the halo");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "star_tip_count", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "star_tip_count", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "starc");
 	RNA_def_property_range(prop, 3, 50);
 	RNA_def_property_ui_text(prop, "Star Tips", "Number of points on the star shaped halo");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "seed1");
 	RNA_def_property_range(prop, 0, 255);
 	RNA_def_property_ui_text(prop, "Seed", "Randomize ring dimension and line location");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_flare_mode", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_flare_mode", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_FLARE); /* use bitflags */
 	RNA_def_property_ui_text(prop, "Flare", "Render halo as a lens flare");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "flare_size", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "flare_size", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "flaresize");
 	RNA_def_property_range(prop, 0.1f, 25.0f);
 	RNA_def_property_ui_text(prop, "Flare Size", "Factor by which the flare is larger than the halo");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "flare_subflare_size", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "flare_subflare_size", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "subsize");
 	RNA_def_property_range(prop, 0.1f, 25.0f);
 	RNA_def_property_ui_text(prop, "Flare Subsize", "Dimension of the sub-flares, dots and circles");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "flare_boost", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "flare_boost", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "flareboost");
 	RNA_def_property_range(prop, 0.1f, 10.0f);
 	RNA_def_property_ui_text(prop, "Flare Boost", "Give the flare extra strength");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "flare_seed", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "flare_seed", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "seed2");
 	RNA_def_property_range(prop, 0, 255);
 	RNA_def_property_ui_text(prop, "Flare Seed", "Offset in the flare seed table");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "flare_subflare_count", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "flare_subflare_count", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "flarec");
 	RNA_def_property_range(prop, 1, 32);
 	RNA_def_property_ui_text(prop, "Flares Sub", "Number of sub-flares");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_ring", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_ring", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_RINGS);
 	RNA_def_property_ui_text(prop, "Rings", "Render rings over halo");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_lines", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_lines", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_LINES);
 	RNA_def_property_ui_text(prop, "Lines", "Render star shaped lines over halo");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_star", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_star", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_STAR);
 	RNA_def_property_ui_text(prop, "Star", "Render halo as a star");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_texture", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_texture", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALOTEX);
 	RNA_def_property_ui_text(prop, "Texture", "Give halo a texture");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_vertex_normal", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_vertex_normal", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALOPUNO);
 	RNA_def_property_ui_text(prop, "Vertex Normal", "Use the vertex normal to specify the dimension of the halo");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_extreme_alpha", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_extreme_alpha", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_XALPHA);
 	RNA_def_property_ui_text(prop, "Extreme Alpha", "Use extreme alpha");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_shaded", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_shaded", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_SHADE);
 	RNA_def_property_ui_text(prop, "Shaded", "Let halo receive light and shadows from external objects");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_soft", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_soft", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_HALO_SOFT);
 	RNA_def_property_ui_text(prop, "Soft", "Soften the edges of halos at intersections with other geometry");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
@@ -1417,67 +1427,67 @@ static void rna_def_material_sss(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "MaterialSubsurfaceScattering", NULL);
+	srna = RNA_def_struct(brna, "MaterialSubsurfaceScattering", NULL);
 	RNA_def_struct_sdna(srna, "Material");
 	RNA_def_struct_nested(brna, srna, "Material");
 	RNA_def_struct_ui_text(srna, "Material Subsurface Scattering",
 	                       "Diffuse subsurface scattering settings for a Material datablock");
 
-	prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_COLOR|PROP_UNIT_LENGTH);
+	prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_COLOR|PROP_UNIT_LENGTH);
 	RNA_def_property_float_sdna(prop, NULL, "sss_radius");
 	RNA_def_property_range(prop, 0.001, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.001, 10000, 1, 3);
 	RNA_def_property_ui_text(prop, "Radius", "Mean red/green/blue scattering path length");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "sss_col");
 	RNA_def_property_ui_text(prop, "Color", "Scattering color");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "error_threshold", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "error_threshold", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "sss_error");
 	RNA_def_property_ui_range(prop, 0.0001, 10, 1, 3);
 	RNA_def_property_ui_text(prop, "Error Tolerance", "Error tolerance (low values are slower and higher quality)");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "sss_scale");
 	RNA_def_property_ui_range(prop, 0.001, 1000, 1, 3);
 	RNA_def_property_ui_text(prop, "Scale", "Object scale factor");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "ior", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "ior", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "sss_ior");
 	RNA_def_property_ui_range(prop, 0.1, 2, 1, 3);
 	RNA_def_property_ui_text(prop, "IOR", "Index of refraction (higher values are denser)");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "color_factor", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "color_factor", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "sss_colfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Color Factor", "Blend factor for SSS colors");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "texture_factor", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "texture_factor", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "sss_texfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Texture Factor", "Texture scattering blend factor");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "front", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "front", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "sss_front");
 	RNA_def_property_range(prop, 0, 2);
 	RNA_def_property_ui_text(prop, "Front", "Front scattering weight");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "back", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "back", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "sss_back");
 	RNA_def_property_range(prop, 0, 10);
 	RNA_def_property_ui_text(prop, "Back", "Back scattering weight");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "sss_flag", MA_DIFF_SSS);
 	RNA_def_property_ui_text(prop, "Enabled", "Enable diffuse subsurface scatting effects in a material");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
@@ -1495,13 +1505,13 @@ static void rna_def_material_specularity(StructRNA *srna)
 		{MA_SPEC_WARDISO, "WARDISO", 0, "WardIso", "Use a Ward anisotropic shader"},
 		{0, NULL, 0, NULL, NULL}};
 	
-	prop= RNA_def_property(srna, "specular_shader", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "specular_shader", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "spec_shader");
 	RNA_def_property_enum_items(prop, prop_specular_shader_items);
 	RNA_def_property_ui_text(prop, "Specular Shader Model", "");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "specular_intensity", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "specular_intensity", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "spec");
 	RNA_def_property_range(prop, 0, 1);
 	RNA_def_property_ui_text(prop, "Specular Intensity", "How intense (bright) the specular reflection is");
@@ -1512,31 +1522,31 @@ static void rna_def_material_specularity(StructRNA *srna)
 	 * multiple times, which may give somewhat strange changes in the outliner,
 	 * but in the UI they are never visible at the same time. */
 
-	prop= RNA_def_property(srna, "specular_hardness", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "specular_hardness", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "har");
 	RNA_def_property_range(prop, 1, 511);
 	RNA_def_property_ui_text(prop, "Specular Hardness", "How hard (sharp) the specular reflection is");
 	RNA_def_property_update(prop, 0, "rna_Material_draw_update");
 
-	prop= RNA_def_property(srna, "specular_ior", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "specular_ior", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "refrac");
 	RNA_def_property_range(prop, 1, 10);
 	RNA_def_property_ui_text(prop, "Specular IOR", "Specular index of refraction");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "specular_toon_size", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "specular_toon_size", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "param[2]");
 	RNA_def_property_range(prop, 0.0f, 1.53f);
 	RNA_def_property_ui_text(prop, "Specular Toon Size", "Size of specular toon area");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "specular_toon_smooth", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "specular_toon_smooth", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "param[3]");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Specular Toon Smooth", "Smoothness of specular toon area");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "specular_slope", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "specular_slope", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "rms");
 	RNA_def_property_range(prop, 0, 0.4);
 	RNA_def_property_ui_text(prop, "Specular Slope", "The standard deviation of surface slope");
@@ -1548,67 +1558,67 @@ static void rna_def_material_strand(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "MaterialStrand", NULL);
+	srna = RNA_def_struct(brna, "MaterialStrand", NULL);
 	RNA_def_struct_sdna(srna, "Material");
 	RNA_def_struct_nested(brna, srna, "Material");
 	RNA_def_struct_ui_text(srna, "Material Strand", "Strand settings for a Material datablock");
 
-	prop= RNA_def_property(srna, "use_tangent_shading", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_tangent_shading", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_TANGENT_STR);
 	RNA_def_property_ui_text(prop, "Tangent Shading", "Use direction of strands as normal for tangent-shading");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
 	/* this flag is only set when rendering, not to be edited manually */
-	prop= RNA_def_property(srna, "use_surface_diffuse", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_surface_diffuse", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_STR_SURFDIFF);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Surface Diffuse", "Make diffuse shading more similar to shading the surface");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "blend_distance", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "blend_distance", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "strand_surfnor");
 	RNA_def_property_range(prop, 0, 10);
 	RNA_def_property_ui_text(prop, "Blend Distance", "Worldspace distance over which to blend in the surface normal");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "use_blender_units", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_blender_units", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_STR_B_UNITS);
 	RNA_def_property_ui_text(prop, "Blender Units", "Use Blender units for widths instead of pixels");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "root_size", PROP_FLOAT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "root_size", PROP_FLOAT, PROP_UNSIGNED);
 	RNA_def_property_float_sdna(prop, NULL, "strand_sta");
 	RNA_def_property_float_funcs(prop, NULL, NULL, "rna_MaterialStrand_start_size_range");
 	RNA_def_property_ui_range(prop, 0, 10.0f, 10, 5);
 	RNA_def_property_ui_text(prop, "Root Size", "Start size of strands in pixels or Blender units");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "tip_size", PROP_FLOAT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "tip_size", PROP_FLOAT, PROP_UNSIGNED);
 	RNA_def_property_float_sdna(prop, NULL, "strand_end");
 	RNA_def_property_ui_range(prop, 0, 10.0f, 10, 5);
 	RNA_def_property_float_funcs(prop, NULL, NULL, "rna_MaterialStrand_end_size_range");
 	RNA_def_property_ui_text(prop, "Tip Size", "End size of strands in pixels or Blender units");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "size_min", PROP_FLOAT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "size_min", PROP_FLOAT, PROP_UNSIGNED);
 	RNA_def_property_float_sdna(prop, NULL, "strand_min");
 	RNA_def_property_range(prop, 0.001, 10);
 	RNA_def_property_ui_text(prop, "Minimum Size", "Minimum size of strands in pixels");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "shape", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "shape", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "strand_ease");
 	RNA_def_property_range(prop, -0.9, 0.9);
 	RNA_def_property_ui_text(prop, "Shape", "Positive values make strands rounder, negative ones make strands spiky");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "width_fade", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "width_fade", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "strand_widthfade");
 	RNA_def_property_range(prop, 0, 2);
 	RNA_def_property_ui_text(prop, "Width Fade", "Transparency along the width of the strand");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "strand_uvname");
 	RNA_def_property_ui_text(prop, "UV Map", "Name of UV map to override");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
@@ -1619,39 +1629,40 @@ static void rna_def_material_physics(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "MaterialPhysics", NULL);
+	srna = RNA_def_struct(brna, "MaterialPhysics", NULL);
 	RNA_def_struct_sdna(srna, "Material");
 	RNA_def_struct_nested(brna, srna, "Material");
 	RNA_def_struct_ui_text(srna, "Material Physics", "Physics settings for a Material datablock");
 	
-	prop= RNA_def_property(srna, "friction", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "friction", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "friction");
 	RNA_def_property_range(prop, 0, 100);
 	RNA_def_property_ui_text(prop, "Friction", "Coulomb friction coefficient, when inside the physics distance area");
 
-	prop= RNA_def_property(srna, "elasticity", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "elasticity", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "reflect");
 	RNA_def_property_range(prop, 0, 1);
 	RNA_def_property_ui_text(prop, "Elasticity", "Elasticity of collisions");
 
 	/* FH/Force Field Settings */
-	prop= RNA_def_property(srna, "use_fh_normal", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_fh_normal", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "dynamode", MA_FH_NOR);
 	RNA_def_property_ui_text(prop, "Align to Normal",
-	                         "Align dynamic game objects along the surface normal, when inside the physics distance area");
+	                         "Align dynamic game objects along the surface normal, "
+	                         "when inside the physics distance area");
 
-	prop= RNA_def_property(srna, "fh_force", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "fh_force", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "fh");
 	RNA_def_property_range(prop, 0, 1);
 	RNA_def_property_ui_range(prop, 0.0, 1.0, 10, 2);
 	RNA_def_property_ui_text(prop, "Force", "Upward spring force, when inside the physics distance area");
 	
-	prop= RNA_def_property(srna, "fh_distance", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "fh_distance", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "fhdist");
 	RNA_def_property_range(prop, 0, 20);
 	RNA_def_property_ui_text(prop, "Distance", "Distance of the physics area");
 	
-	prop= RNA_def_property(srna, "fh_damping", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "fh_damping", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "xyfrict");
 	RNA_def_property_range(prop, 0, 1);
 	RNA_def_property_ui_text(prop, "Damping", "Damping of the spring force, when inside the physics distance area");
@@ -1691,213 +1702,216 @@ void RNA_def_material(BlenderRNA *brna)
 		               "Improved shadow only method which also renders lightless areas as shadows"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "Material", "ID");
+	srna = RNA_def_struct(brna, "Material", "ID");
 	RNA_def_struct_ui_text(srna, "Material",
 	                       "Material datablock to define the appearance of geometric objects for rendering");
 	RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA);
 	
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "material_type");
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_ui_text(prop, "Type", "Material type defining how the object is rendered");
 	RNA_def_property_enum_funcs(prop, NULL, "rna_Material_type_set", NULL);
 	RNA_def_property_update(prop, 0, "rna_Material_draw_update");
 
-	prop= RNA_def_property(srna, "use_transparency", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_transparency", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_TRANSP);
 	RNA_def_property_ui_text(prop, "Transparency", "Render material as transparent");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "transparency_method", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "transparency_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode");
 	RNA_def_property_enum_items(prop, transparency_items);
 	RNA_def_property_ui_text(prop, "Transparency Method", "Method to use for rendering transparency");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
 	/* For Preview Render */
-	prop= RNA_def_property(srna, "preview_render_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "preview_render_type", PROP_ENUM, PROP_NONE);
 	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");
 	
-	prop= RNA_def_property(srna, "ambient", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "ambient", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "amb");
 	RNA_def_property_range(prop, 0, 1);
 	RNA_def_property_ui_text(prop, "Ambient", "Amount of global ambient color the material receives");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "emit", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "emit", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0, 2.0f, 1, 2);
 	RNA_def_property_ui_text(prop, "Emit", "Amount of light to emit");
 	RNA_def_property_update(prop, 0, "rna_Material_draw_update");
 
-	prop= RNA_def_property(srna, "translucency", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "translucency", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_range(prop, 0, 1);
 	RNA_def_property_ui_text(prop, "Translucency", "Amount of diffuse shading on the back side");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 		
-	prop= RNA_def_property(srna, "use_cubic", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_cubic", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "shade_flag", MA_CUBIC);
 	RNA_def_property_ui_text(prop, "Cubic Interpolation",
 	                         "Use cubic interpolation for diffuse values, for smoother transitions");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_object_color", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_object_color", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "shade_flag", MA_OBCOLOR);
 	RNA_def_property_ui_text(prop, "Object Color", "Modulate the result with a per-object color");
 	RNA_def_property_update(prop, 0, "rna_Material_draw_update");
 
-	prop= RNA_def_property(srna, "shadow_ray_bias", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "shadow_ray_bias", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "sbias");
 	RNA_def_property_range(prop, 0, 0.25);
 	RNA_def_property_ui_text(prop, "Shadow Ray Bias",
 	                         "Shadow raytracing bias to prevent terminator problems on shadow boundary");
 
-	prop= RNA_def_property(srna, "shadow_buffer_bias", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "shadow_buffer_bias", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "lbias");
 	RNA_def_property_range(prop, 0, 10);
 	RNA_def_property_ui_text(prop, "Shadow Buffer Bias", "Factor to multiply shadow buffer bias with (0 is ignore)");
 
-	prop= RNA_def_property(srna, "shadow_cast_alpha", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "shadow_cast_alpha", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "shad_alpha");
 	RNA_def_property_range(prop, 0.001, 1);
 	RNA_def_property_ui_text(prop, "Shadow Casting Alpha",
 	                         "Shadow casting alpha, in use for Irregular and Deep shadow buffer");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "light_group", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "light_group", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "group");
 	RNA_def_property_struct_type(prop, "Group");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Light Group", "Limit lighting to lamps in this Group");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "index");
 	RNA_def_property_ui_text(prop, "Pass Index", "Index number for the IndexMA render pass");
 	RNA_def_property_update(prop, NC_OBJECT, NULL);
 
 	/* flags */
 	
-	prop= RNA_def_property(srna, "use_light_group_exclusive", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_light_group_exclusive", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_GROUP_NOLAY);
 	RNA_def_property_ui_text(prop, "Light Group Exclusive",
-	                         "Material uses the light group exclusively - these lamps are excluded from other scene lighting");
+	                         "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_raytrace", PROP_BOOLEAN, PROP_NONE);
+	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",
 	                         "Include this material and geometry that uses it in raytracing calculations");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_shadows", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_shadows", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_SHADOW);
 	RNA_def_property_ui_text(prop, "Shadows", "Allow this material to receive shadows");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_shadeless", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_shadeless", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_SHLESS);
 	RNA_def_property_ui_text(prop, "Shadeless", "Make this material insensitive to light or shadow");
 	RNA_def_property_update(prop, 0, "rna_Material_draw_update");
 	
-	prop= RNA_def_property(srna, "use_vertex_color_light", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_vertex_color_light", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_VERTEXCOL);
 	RNA_def_property_ui_text(prop, "Vertex Color Light", "Add vertex colors as additional lighting");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "use_vertex_color_paint", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_vertex_color_paint", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_VERTEXCOLP);
 	RNA_def_property_ui_text(prop, "Vertex Color Paint",
 	                         "Replace object base color with vertex colors (multiply with "
 	                         "'texture face' face assigned textures)");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ZINV);
-	RNA_def_property_ui_text(prop, "Invert Z Depth", "Render material's faces with an inverted Z buffer (scanline only)");
+	RNA_def_property_ui_text(prop, "Invert Z Depth",
+	                         "Render material's faces with an inverted Z buffer (scanline only)");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "offset_z", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "offset_z", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "zoffs");
 	RNA_def_property_ui_text(prop, "Z Offset", "Give faces an artificial offset in the Z buffer for Z transparency");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_sky", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_sky", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ENV);
 	RNA_def_property_ui_text(prop, "Sky",
 	                         "Render this material with zero alpha, with sky background in place (scanline only)");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_only_shadow", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_only_shadow", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ONLYSHADOW);
 	RNA_def_property_ui_text(prop, "Only Shadow",
 	                         "Render shadows as the material's alpha value, making the material "
 	                         "transparent except for shadowed areas");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "shadow_only_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "shadow_only_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "shadowonly_flag");
 	RNA_def_property_enum_items(prop, prop_shadows_only_items);
 	RNA_def_property_ui_text(prop, "Shadow Type", "How to draw shadows");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_face_texture", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_face_texture", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_FACETEXTURE);
 	RNA_def_property_ui_text(prop, "Face Textures",
 	                         "Replace the object's base color with color from UV map image textures");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_face_texture_alpha", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_face_texture_alpha", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_FACETEXTURE_ALPHA);
 	RNA_def_property_ui_text(prop, "Face Textures Alpha",
 	                         "Replace the object's base alpha value with alpha from UV map image textures");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_cast_shadows_only", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_cast_shadows_only", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_ONLYCAST);
 	RNA_def_property_ui_text(prop, "Cast Shadows Only",
 	                         "Make objects with this material appear invisible (not rendered), only casting shadows");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_mist", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_mist", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "mode", MA_NOMIST);
 	RNA_def_property_ui_text(prop, "Use Mist", "Use mist with this material (in world settings)");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_transparent_shadows", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_transparent_shadows", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_SHADOW_TRA);
 	RNA_def_property_ui_text(prop, "Receive Transparent Shadows",
 	                         "Allow this object to receive transparent shadows cast through other objects");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_ray_shadow_bias", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_ray_shadow_bias", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_RAYBIAS);
 	RNA_def_property_ui_text(prop, "Ray Shadow Bias",
-	                         "Prevent raytraced shadow errors on surfaces with smooth shaded normals (terminator problem)");
+	                         "Prevent raytraced shadow errors on surfaces with smooth shaded normals "
+	                         "(terminator problem)");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_full_oversampling", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_full_oversampling", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_FULL_OSA);
 	RNA_def_property_ui_text(prop, "Full Oversampling",
 	                         "Force this material to render full shading/textures for all anti-aliasing samples");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "use_cast_buffer_shadows", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_cast_buffer_shadows", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_SHADBUF);
 	RNA_def_property_ui_text(prop, "Cast Buffer Shadows",
 	                         "Allow this material to cast shadows from shadow buffer lamps");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
-	prop= RNA_def_property(srna, "use_cast_approximate", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_cast_approximate", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "shade_flag", MA_APPROX_OCCLUSION);
 	RNA_def_property_ui_text(prop, "Cast Approximate",
 	                         "Allow this material to cast shadows when using approximate ambient occlusion");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
-	prop= RNA_def_property(srna, "use_tangent_shading", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_tangent_shading", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", MA_TANGENT_V);
 	RNA_def_property_ui_text(prop, "Tangent Shading",
 	                         "Use the material's tangent vector instead of the normal for shading "
@@ -1905,67 +1919,67 @@ void RNA_def_material(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 	
 	/* nested structs */
-	prop= RNA_def_property(srna, "raytrace_mirror", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "raytrace_mirror", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "MaterialRaytraceMirror");
 	RNA_def_property_pointer_funcs(prop, "rna_Material_mirror_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Raytrace Mirror", "Raytraced reflection settings for the material");
 
-	prop= RNA_def_property(srna, "raytrace_transparency", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "raytrace_transparency", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "MaterialRaytraceTransparency");
 	RNA_def_property_pointer_funcs(prop, "rna_Material_transp_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Raytrace Transparency", "Raytraced transparency settings for the material");
 
-	prop= RNA_def_property(srna, "volume", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "volume", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "vol");
 	RNA_def_property_struct_type(prop, "MaterialVolume");
 	RNA_def_property_ui_text(prop, "Volume", "Volume settings for the material");
 
-	prop= RNA_def_property(srna, "halo", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "halo", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "MaterialHalo");
 	RNA_def_property_pointer_funcs(prop, "rna_Material_halo_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Halo", "Halo settings for the material");
 
-	prop= RNA_def_property(srna, "subsurface_scattering", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "subsurface_scattering", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "MaterialSubsurfaceScattering");
 	RNA_def_property_pointer_funcs(prop, "rna_Material_sss_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Subsurface Scattering", "Subsurface scattering settings for the material");
 
-	prop= RNA_def_property(srna, "strand", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "strand", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "MaterialStrand");
 	RNA_def_property_pointer_funcs(prop, "rna_Material_strand_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Strand", "Strand settings for the material");
 	
-	prop= RNA_def_property(srna, "physics", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "physics", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "MaterialPhysics");
 	RNA_def_property_pointer_funcs(prop, "rna_Material_physics_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Physics", "Game physics settings");
 
 	/* game settings */
-	prop= RNA_def_property(srna, "game_settings", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "game_settings", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "game");
 	RNA_def_property_struct_type(prop, "MaterialGameSettings");
 	RNA_def_property_ui_text(prop, "Game Settings", "Game material settings");
 
 	/* nodetree */
-	prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
 	RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node based materials");
 
-	prop= RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the material");
 	RNA_def_property_update(prop, 0, "rna_Material_use_nodes_update");
 
-	prop= RNA_def_property(srna, "active_node_material", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active_node_material", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Material");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_pointer_funcs(prop, "rna_Material_active_node_material_get",
@@ -1980,7 +1994,7 @@ void RNA_def_material(BlenderRNA *brna)
 		"MaterialTextureSlot", "MaterialTextureSlots", "rna_Material_update");
 
 	/* only material has this one */
-	prop= RNA_def_property(srna, "use_textures", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_textures", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "septex", 1);
 	RNA_def_property_array(prop, 18);
 	RNA_def_property_ui_text(prop, "Use Textures", "Enable/Disable each texture");
@@ -2005,7 +2019,8 @@ void RNA_def_material(BlenderRNA *brna)
 }
 
 
-static void rna_def_texture_slots(BlenderRNA *brna, PropertyRNA *cprop, const char *structname, const char *structname_slots)
+static void rna_def_texture_slots(BlenderRNA *brna, PropertyRNA *cprop, const char *structname,
+                                  const char *structname_slots)
 {
 	StructRNA *srna;
 
@@ -2013,26 +2028,26 @@ static void rna_def_texture_slots(BlenderRNA *brna, PropertyRNA *cprop, const ch
 	PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, structname_slots);
-	srna= RNA_def_struct(brna, structname_slots, NULL);
+	srna = RNA_def_struct(brna, structname_slots, NULL);
 	RNA_def_struct_sdna(srna, "ID");
 	RNA_def_struct_ui_text(srna, "Texture Slots", "Collection of texture slots");
 
 	/* functions */
-	func= RNA_def_function(srna, "add", "rna_mtex_texture_slots_add");
+	func = RNA_def_function(srna, "add", "rna_mtex_texture_slots_add");
 	RNA_def_function_flag(func, FUNC_USE_SELF_ID|FUNC_NO_SELF|FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
-	parm= RNA_def_pointer(func, "mtex", structname, "", "The newly initialized mtex");
+	parm = RNA_def_pointer(func, "mtex", structname, "", "The newly initialized mtex");
 	RNA_def_function_return(func, parm);
 	
-	func= RNA_def_function(srna, "create", "rna_mtex_texture_slots_create");
+	func = RNA_def_function(srna, "create", "rna_mtex_texture_slots_create");
 	RNA_def_function_flag(func, FUNC_USE_SELF_ID|FUNC_NO_SELF|FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
-	parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Slot index to initialize", 0, INT_MAX);
+	parm = RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Slot index to initialize", 0, INT_MAX);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_pointer(func, "mtex", structname, "", "The newly initialized mtex");
+	parm = RNA_def_pointer(func, "mtex", structname, "", "The newly initialized mtex");
 	RNA_def_function_return(func, parm);
 	
-	func= RNA_def_function(srna, "clear", "rna_mtex_texture_slots_clear");
+	func = RNA_def_function(srna, "clear", "rna_mtex_texture_slots_clear");
 	RNA_def_function_flag(func, FUNC_USE_SELF_ID|FUNC_NO_SELF|FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
-	parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Slot index to clear", 0, INT_MAX);
+	parm = RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Slot index to clear", 0, INT_MAX);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 }
 
@@ -2043,22 +2058,23 @@ void rna_def_mtex_common(BlenderRNA *brna, StructRNA *srna, const char *begin,
 	PropertyRNA *prop;
 
 	/* mtex */
-	prop= RNA_def_property(srna, "texture_slots", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "texture_slots", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, structname);
-	RNA_def_property_collection_funcs(prop, begin, "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_dereference_get", NULL, NULL, NULL, NULL);
+	RNA_def_property_collection_funcs(prop, begin, "rna_iterator_array_next", "rna_iterator_array_end",
+	                                  "rna_iterator_array_dereference_get", NULL, NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Textures", "Texture slots defining the mapping and influence of textures");
 	rna_def_texture_slots(brna, prop, structname, structname_slots);
 
-	prop= RNA_def_property(srna, "active_texture", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active_texture", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Texture");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
-	if(activeeditable)
+	if (activeeditable)
 		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);
 
-	prop= RNA_def_property(srna, "active_texture_index", PROP_INT, PROP_UNSIGNED);
+	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");
@@ -2066,5 +2082,3 @@ void rna_def_mtex_common(BlenderRNA *brna, StructRNA *srna, const char *begin,
 }
 
 #endif
-
-
diff --git a/source/blender/makesrna/intern/rna_material_api.c b/source/blender/makesrna/intern/rna_material_api.c
index f563f53..e6118f6 100644
--- a/source/blender/makesrna/intern/rna_material_api.c
+++ b/source/blender/makesrna/intern/rna_material_api.c
@@ -6,7 +6,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
@@ -20,7 +20,7 @@
  * The Original Code is Copyright (C) 2009 Blender Foundation.
  * All rights reserved.
  *
- * 
+ *
  * Contributor(s): Blender Foundation
  *
  * ***** END GPL LICENSE BLOCK *****
@@ -44,8 +44,8 @@
 
 void RNA_api_material(StructRNA *srna)
 {
-	// FunctionRNA *func;
-	// PropertyRNA *parm;
+	/* FunctionRNA *func; */
+	/* PropertyRNA *parm; */
 }
 
 #endif
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index f0320d8..0ecfa31 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -8,7 +8,7 @@
  *
  * This program is distributed in the hope 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,6 +20,10 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
+/* note: the original vertex color stuff is now just used for
+ * getting info on the layers themselves, accessing the data is
+ * done through the (not yet written) mpoly interfaces.*/
+
 /** \file blender/makesrna/intern/rna_mesh.c
  *  \ingroup RNA
  */
@@ -27,8 +31,11 @@
 
 #include <stdlib.h>
 
+#include "MEM_guardedalloc.h"
+
 #include "RNA_access.h"
 #include "RNA_define.h"
+#include "RNA_types.h"
 
 #include "rna_internal.h"
 
@@ -39,6 +46,7 @@
 
 #include "WM_types.h"
 
+#include "BLI_array.h"
 #include "BLI_math_base.h"
 #include "BLI_math_rotation.h"
 
@@ -46,45 +54,86 @@
 
 #include "DNA_scene_types.h"
 
-#include "BLI_editVert.h"
 #include "BLI_math.h"
 
 #include "BKE_customdata.h"
 #include "BKE_depsgraph.h"
 #include "BKE_main.h"
 #include "BKE_mesh.h"
-
+#include "BKE_tessmesh.h"
+#include "BKE_report.h"
 
 #include "ED_mesh.h" /* XXX Bad level call */
 
 #include "WM_api.h"
 #include "WM_types.h"
 
-static void rna_Mesh_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+#include "rna_mesh_utils.h"
+
+static Mesh *rna_mesh(PointerRNA *ptr)
+{
+	Mesh *me = (Mesh *)ptr->id.data;
+	return me;
+}
+
+static CustomData *rna_mesh_pdata_helper(Mesh *me)
+{
+	return (me->edit_btmesh) ? &me->edit_btmesh->bm->pdata : &me->pdata;
+}
+
+static CustomData *rna_mesh_ldata_helper(Mesh *me)
+{
+	return (me->edit_btmesh) ? &me->edit_btmesh->bm->ldata : &me->ldata;
+}
+
+static CustomData *rna_mesh_fdata_helper(Mesh *me)
+{
+	return (me->edit_btmesh) ? NULL : &me->fdata;
+}
+
+static CustomData *rna_mesh_pdata(PointerRNA *ptr)
+{
+	Mesh *me = rna_mesh(ptr);
+	return rna_mesh_pdata_helper(me);
+}
+
+static CustomData *rna_mesh_ldata(PointerRNA *ptr)
+{
+	Mesh *me = rna_mesh(ptr);
+	return rna_mesh_ldata_helper(me);
+}
+
+static CustomData *rna_mesh_fdata(PointerRNA *ptr)
+{
+	Mesh *me = rna_mesh(ptr);
+	return rna_mesh_fdata_helper(me);
+}
+
+static void rna_Mesh_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	ID *id= ptr->id.data;
+	ID *id = ptr->id.data;
 
 	/* cheating way for importers to avoid slow updates */
-	if(id->us > 0) {
+	if (id->us > 0) {
 		DAG_id_tag_update(id, 0);
 		WM_main_add_notifier(NC_GEOM|ND_DATA, id);
 	}
 }
 
-static void rna_Mesh_update_select(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_Mesh_update_select(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	ID *id= ptr->id.data;
+	ID *id = ptr->id.data;
 	/* cheating way for importers to avoid slow updates */
-	if(id->us > 0) {
+	if (id->us > 0) {
 		WM_main_add_notifier(NC_GEOM|ND_SELECT, id);
 	}
 }
 
-void rna_Mesh_update_draw(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+void rna_Mesh_update_draw(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	ID *id= ptr->id.data;
+	ID *id = ptr->id.data;
 	/* cheating way for importers to avoid slow updates */
-	if(id->us > 0) {
+	if (id->us > 0) {
 		WM_main_add_notifier(NC_GEOM|ND_DATA, id);
 	}
 }
@@ -109,13 +158,13 @@ void rna_Mesh_update_facemask(Main *bmain, Scene *scene, PointerRNA *ptr)
 }
 static void rna_MeshVertex_normal_get(PointerRNA *ptr, float *value)
 {
-	MVert *mvert= (MVert*)ptr->data;
+	MVert *mvert = (MVert*)ptr->data;
 	normal_short_to_float_v3(value, mvert->no);
 }
 
 static void rna_MeshVertex_normal_set(PointerRNA *ptr, const float *value)
 {
-	MVert *mvert= (MVert*)ptr->data;
+	MVert *mvert = (MVert*)ptr->data;
 	float no[3];
 
 	copy_v3_v3(no, value);
@@ -125,941 +174,912 @@ static void rna_MeshVertex_normal_set(PointerRNA *ptr, const float *value)
 
 static float rna_MeshVertex_bevel_weight_get(PointerRNA *ptr)
 {
-	MVert *mvert= (MVert*)ptr->data;
+	MVert *mvert = (MVert*)ptr->data;
 	return mvert->bweight/255.0f;
 }
 
 static void rna_MeshVertex_bevel_weight_set(PointerRNA *ptr, float value)
 {
-	MVert *mvert= (MVert*)ptr->data;
-	mvert->bweight= (char)(CLAMPIS(value*255.0f, 0, 255));
+	MVert *mvert = (MVert*)ptr->data;
+	mvert->bweight = (char)(CLAMPIS(value*255.0f, 0, 255));
 }
 
 static float rna_MEdge_bevel_weight_get(PointerRNA *ptr)
 {
-	MEdge *medge= (MEdge*)ptr->data;
+	MEdge *medge = (MEdge*)ptr->data;
 	return medge->bweight/255.0f;
 }
 
 static void rna_MEdge_bevel_weight_set(PointerRNA *ptr, float value)
 {
-	MEdge *medge= (MEdge*)ptr->data;
-	medge->bweight= (char)(CLAMPIS(value*255.0f, 0, 255));
+	MEdge *medge = (MEdge*)ptr->data;
+	medge->bweight = (char)(CLAMPIS(value*255.0f, 0, 255));
 }
 
 static float rna_MEdge_crease_get(PointerRNA *ptr)
 {
-	MEdge *medge= (MEdge*)ptr->data;
+	MEdge *medge = (MEdge*)ptr->data;
 	return medge->crease/255.0f;
 }
 
 static void rna_MEdge_crease_set(PointerRNA *ptr, float value)
 {
-	MEdge *medge= (MEdge*)ptr->data;
-	medge->crease= (char)(CLAMPIS(value*255.0f, 0, 255));
-}
-
-static void rna_MeshFace_normal_get(PointerRNA *ptr, float *values)
-{
-	Mesh *me= (Mesh*)ptr->id.data;
-	MFace *mface= (MFace*)ptr->data;
-	
-	if(mface->v4)
-		normal_quad_v3(values,me->mvert[mface->v1].co, me->mvert[mface->v2].co,
-		               me->mvert[mface->v3].co, me->mvert[mface->v4].co);
-	else
-		normal_tri_v3( values,me->mvert[mface->v1].co, me->mvert[mface->v2].co, me->mvert[mface->v3].co);
+	MEdge *medge = (MEdge*)ptr->data;
+	medge->crease = (char)(CLAMPIS(value*255.0f, 0, 255));
 }
 
-static float rna_MeshFace_area_get(PointerRNA *ptr)
+static void rna_MeshPolygon_normal_get(PointerRNA *ptr, float *values)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	MFace *mface= (MFace*)ptr->data;
+	Mesh *me = rna_mesh(ptr);
+	MPoly *mp = (MPoly*)ptr->data;
 
-	if(mface->v4)
-		return area_quad_v3(me->mvert[mface->v1].co, me->mvert[mface->v2].co, me->mvert[mface->v3].co, me->mvert[mface->v4].co);
-	else
-		return area_tri_v3(me->mvert[mface->v1].co, me->mvert[mface->v2].co, me->mvert[mface->v3].co);
+	/* BMESH_TODO: might be faster to look for a CD_NORMALS layer and use that */
+	mesh_calc_poly_normal(mp, me->mloop+mp->loopstart, me->mvert, values);
 }
 
-/* notice red and blue are swapped */
-static void rna_MeshColor_color1_get(PointerRNA *ptr, float *values)
+static float rna_MeshPolygon_area_get(PointerRNA *ptr)
 {
-	MCol *mcol= (MCol*)ptr->data;
+	Mesh *me = (Mesh*)ptr->id.data;
+	MPoly *mp = (MPoly*)ptr->data;
 
-	values[2]= (&mcol[0].r)[0]/255.0f;
-	values[1]= (&mcol[0].r)[1]/255.0f;
-	values[0]= (&mcol[0].r)[2]/255.0f;
+	return mesh_calc_poly_area(mp, me->mloop+mp->loopstart, me->mvert, NULL);
 }
 
-static void rna_MeshColor_color1_set(PointerRNA *ptr, const float *values)
+static void rna_MeshTessFace_normal_get(PointerRNA *ptr, float *values)
 {
-	MCol *mcol= (MCol*)ptr->data;
+	Mesh *me = rna_mesh(ptr);
+	MFace *mface = (MFace*)ptr->data;
 
-	(&mcol[0].r)[2]= (char)(CLAMPIS(values[0]*255.0f, 0, 255));
-	(&mcol[0].r)[1]= (char)(CLAMPIS(values[1]*255.0f, 0, 255));
-	(&mcol[0].r)[0]= (char)(CLAMPIS(values[2]*255.0f, 0, 255));
+	if (mface->v4)
+		normal_quad_v3(values, me->mvert[mface->v1].co, me->mvert[mface->v2].co,
+		               me->mvert[mface->v3].co, me->mvert[mface->v4].co);
+	else
+		normal_tri_v3(values, me->mvert[mface->v1].co, me->mvert[mface->v2].co, me->mvert[mface->v3].co);
 }
 
-static void rna_MeshColor_color2_get(PointerRNA *ptr, float *values)
+static float rna_MeshTessFace_area_get(PointerRNA *ptr)
 {
-	MCol *mcol= (MCol*)ptr->data;
+	Mesh *me = rna_mesh(ptr);
+	MFace *mface = (MFace*)ptr->data;
 
-	values[2]= (&mcol[1].r)[0]/255.0f;
-	values[1]= (&mcol[1].r)[1]/255.0f;
-	values[0]= (&mcol[1].r)[2]/255.0f;
+	if (mface->v4)
+		return area_quad_v3(me->mvert[mface->v1].co, me->mvert[mface->v2].co, me->mvert[mface->v3].co,
+		                    me->mvert[mface->v4].co);
+	else
+		return area_tri_v3(me->mvert[mface->v1].co, me->mvert[mface->v2].co, me->mvert[mface->v3].co);
 }
 
-static void rna_MeshColor_color2_set(PointerRNA *ptr, const float *values)
+static void rna_MeshTextureFace_uv1_get(PointerRNA *ptr, float *values)
 {
-	MCol *mcol= (MCol*)ptr->data;
+	MTFace *mtface = (MTFace*)ptr->data;
 
-	(&mcol[1].r)[2]= (char)(CLAMPIS(values[0]*255.0f, 0, 255));
-	(&mcol[1].r)[1]= (char)(CLAMPIS(values[1]*255.0f, 0, 255));
-	(&mcol[1].r)[0]= (char)(CLAMPIS(values[2]*255.0f, 0, 255));
+	values[0] = mtface->uv[0][0];
+	values[1] = mtface->uv[0][1];
 }
 
-static void rna_MeshColor_color3_get(PointerRNA *ptr, float *values)
+static void rna_MeshTextureFace_uv1_set(PointerRNA *ptr, const float *values)
 {
-	MCol *mcol= (MCol*)ptr->data;
+	MTFace *mtface = (MTFace*)ptr->data;
 
-	values[2]= (&mcol[2].r)[0]/255.0f;
-	values[1]= (&mcol[2].r)[1]/255.0f;
-	values[0]= (&mcol[2].r)[2]/255.0f;
+	mtface->uv[0][0] = values[0];
+	mtface->uv[0][1] = values[1];
 }
 
-static void rna_MeshColor_color3_set(PointerRNA *ptr, const float *values)
+static void rna_MeshTextureFace_uv2_get(PointerRNA *ptr, float *values)
 {
-	MCol *mcol= (MCol*)ptr->data;
+	MTFace *mtface = (MTFace*)ptr->data;
 
-	(&mcol[2].r)[2]= (char)(CLAMPIS(values[0]*255.0f, 0, 255));
-	(&mcol[2].r)[1]= (char)(CLAMPIS(values[1]*255.0f, 0, 255));
-	(&mcol[2].r)[0]= (char)(CLAMPIS(values[2]*255.0f, 0, 255));
+	values[0] = mtface->uv[1][0];
+	values[1] = mtface->uv[1][1];
 }
 
-static void rna_MeshColor_color4_get(PointerRNA *ptr, float *values)
+static void rna_MeshTextureFace_uv2_set(PointerRNA *ptr, const float *values)
 {
-	MCol *mcol= (MCol*)ptr->data;
+	MTFace *mtface = (MTFace*)ptr->data;
 
-	values[2]= (&mcol[3].r)[0]/255.0f;
-	values[1]= (&mcol[3].r)[1]/255.0f;
-	values[0]= (&mcol[3].r)[2]/255.0f;
+	mtface->uv[1][0] = values[0];
+	mtface->uv[1][1] = values[1];
 }
 
-static void rna_MeshColor_color4_set(PointerRNA *ptr, const float *values)
+static void rna_MeshTextureFace_uv3_get(PointerRNA *ptr, float *values)
 {
-	MCol *mcol= (MCol*)ptr->data;
+	MTFace *mtface = (MTFace*)ptr->data;
 
-	(&mcol[3].r)[2]= (char)(CLAMPIS(values[0]*255.0f, 0, 255));
-	(&mcol[3].r)[1]= (char)(CLAMPIS(values[1]*255.0f, 0, 255));
-	(&mcol[3].r)[0]= (char)(CLAMPIS(values[2]*255.0f, 0, 255));
+	values[0] = mtface->uv[2][0];
+	values[1] = mtface->uv[2][1];
 }
 
-static void rna_Mesh_texspace_set(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_MeshTextureFace_uv3_set(PointerRNA *ptr, const float *values)
 {
-	Mesh *me= (Mesh*)ptr->data;
-	
-	if (me->texflag & AUTOSPACE)
-		tex_space_mesh(me);
-}
-
+	MTFace *mtface = (MTFace*)ptr->data;
 
-static int rna_Mesh_texspace_editable(PointerRNA *ptr)
-{
-	Mesh *me= (Mesh*)ptr->data;
-	return (me->texflag & AUTOSPACE)? 0: PROP_EDITABLE;
+	mtface->uv[2][0] = values[0];
+	mtface->uv[2][1] = values[1];
 }
 
-static void rna_Mesh_texspace_loc_get(PointerRNA *ptr, float *values)
+static void rna_MeshTextureFace_uv4_get(PointerRNA *ptr, float *values)
 {
-	Mesh *me= (Mesh *)ptr->data;
-	
-	if (!me->bb)
-		tex_space_mesh(me);
-	
-	copy_v3_v3(values, me->loc);
-}
+	MTFace *mtface = (MTFace*)ptr->data;
 
-static void rna_Mesh_texspace_loc_set(PointerRNA *ptr, const float *values)
-{
-	Mesh *me= (Mesh *)ptr->data;
-	
-	copy_v3_v3(me->loc, values);
+	values[0] = mtface->uv[3][0];
+	values[1] = mtface->uv[3][1];
 }
 
-static void rna_Mesh_texspace_size_get(PointerRNA *ptr, float *values)
+static void rna_MeshTextureFace_uv4_set(PointerRNA *ptr, const float *values)
 {
-	Mesh *me= (Mesh *)ptr->data;
-	
-	if (!me->bb)
-		tex_space_mesh(me);
-	
-	copy_v3_v3(values, me->size);
-}
+	MTFace *mtface = (MTFace*)ptr->data;
 
-static void rna_Mesh_texspace_size_set(PointerRNA *ptr, const float *values)
-{
-	Mesh *me= (Mesh *)ptr->data;
-	
-	copy_v3_v3(me->size, values);
+	mtface->uv[3][0] = values[0];
+	mtface->uv[3][1] = values[1];
 }
 
-static void rna_MeshVertex_groups_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+static int rna_CustomDataData_numverts(PointerRNA *ptr, int type)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-
-	if(me->dvert) {
-		MVert *mvert= (MVert*)ptr->data;
-		MDeformVert *dvert= me->dvert + (mvert-me->mvert);
+	Mesh *me = rna_mesh(ptr);
+	CustomData *fdata = rna_mesh_fdata(ptr);
+	CustomDataLayer *cdl;
+	int a, b;
 
-		rna_iterator_array_begin(iter, (void*)dvert->dw, sizeof(MDeformWeight), dvert->totweight, 0, NULL);
+	for (cdl = fdata->layers, a = 0; a < fdata->totlayer; cdl++, a++) {
+		if (cdl->type == type) {
+			b = ((char *)ptr->data - ((char*)cdl->data)) / CustomData_sizeof(type);
+			if (b >= 0 && b < me->totface) {
+				return (me->mface[b].v4 ? 4 : 3);
+			}
+		}
 	}
-	else
-		rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL);
-}
 
-static void rna_MeshFace_material_index_range(PointerRNA *ptr, int *min, int *max)
-{
-	Mesh *me= (Mesh*)ptr->id.data;
-	*min= 0;
-	*max= me->totcol-1;
-	*max= MAX2(0, *max);
+	return 0;
 }
 
-static CustomData *rna_mesh_fdata(Mesh *me)
+static int rna_MeshTextureFace_uv_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
 {
-	return (me->edit_mesh)? &me->edit_mesh->fdata: &me->fdata;
+	length[0] = rna_CustomDataData_numverts(ptr, CD_MTFACE);
+	length[1] = 2;
+	return length[0]*length[1];
 }
 
-static int rna_CustomDataLayer_length(PointerRNA *ptr, int type)
+static void rna_MeshTextureFace_uv_get(PointerRNA *ptr, float *values)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	CustomData *fdata= rna_mesh_fdata(me);
-	CustomDataLayer *layer;
-	int i, length= 0;
-
-	for(layer=fdata->layers, i=0; i<fdata->totlayer; layer++, i++)
-		if(layer->type == type)
-			length++;
+	MTFace *mtface = (MTFace*)ptr->data;
+	int totvert = rna_CustomDataData_numverts(ptr, CD_MTFACE);
 
-	return length;
+	memcpy(values, mtface->uv, totvert * 2 * sizeof(float));
 }
 
-static int rna_CustomDataLayer_active_get(PointerRNA *ptr, int type, int render)
+static void rna_MeshTextureFace_uv_set(PointerRNA *ptr, const float *values)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	CustomData *fdata= rna_mesh_fdata(me);
-	int n= ((CustomDataLayer*)ptr->data) - fdata->layers;
+	MTFace *mtface = (MTFace*)ptr->data;
+	int totvert = rna_CustomDataData_numverts(ptr, CD_MTFACE);
 
-	if(render) return (n == CustomData_get_render_layer_index(fdata, type));
-	else return (n == CustomData_get_active_layer_index(fdata, type));
+	memcpy(mtface->uv, values, totvert * 2 * sizeof(float));
 }
 
-static int rna_CustomDataLayer_clone_get(PointerRNA *ptr, int type, int UNUSED(render))
+/* notice red and blue are swapped */
+static void rna_MeshColor_color1_get(PointerRNA *ptr, float *values)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	CustomData *fdata= rna_mesh_fdata(me);
-	int n= ((CustomDataLayer*)ptr->data) - fdata->layers;
+	MCol *mcol = (MCol*)ptr->data;
 
-	return (n == CustomData_get_clone_layer_index(fdata, type));
+	values[2] = (&mcol[0].r)[0]/255.0f;
+	values[1] = (&mcol[0].r)[1]/255.0f;
+	values[0] = (&mcol[0].r)[2]/255.0f;
 }
 
-static void rna_CustomDataLayer_active_set(PointerRNA *ptr, int value, int type, int render)
+static void rna_MeshColor_color1_set(PointerRNA *ptr, const float *values)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	CustomData *fdata= rna_mesh_fdata(me);
-	int n= ((CustomDataLayer*)ptr->data) - fdata->layers;
-
-	if(value == 0)
-		return;
+	MCol *mcol = (MCol*)ptr->data;
 
-	if(render) CustomData_set_layer_render_index(fdata, type, n);
-	else CustomData_set_layer_active_index(fdata, type, n);
+	(&mcol[0].r)[2] = (char)(CLAMPIS(values[0]*255.0f, 0, 255));
+	(&mcol[0].r)[1] = (char)(CLAMPIS(values[1]*255.0f, 0, 255));
+	(&mcol[0].r)[0] = (char)(CLAMPIS(values[2]*255.0f, 0, 255));
 }
 
-static void rna_CustomDataLayer_clone_set(PointerRNA *ptr, int value, int type, int UNUSED(render))
+static void rna_MeshColor_color2_get(PointerRNA *ptr, float *values)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	CustomData *fdata= rna_mesh_fdata(me);
-	int n= ((CustomDataLayer*)ptr->data) - fdata->layers;
-
-	if(value == 0)
-		return;
-
-	CustomData_set_layer_clone_index(fdata, type, n);
-}
+	MCol *mcol = (MCol*)ptr->data;
 
-static int rna_uv_texture_check(CollectionPropertyIterator *UNUSED(iter), void *data)
-{
-	CustomDataLayer *layer= (CustomDataLayer*)data;
-	return (layer->type != CD_MTFACE);
+	values[2] = (&mcol[1].r)[0]/255.0f;
+	values[1] = (&mcol[1].r)[1]/255.0f;
+	values[0] = (&mcol[1].r)[2]/255.0f;
 }
 
-static void rna_Mesh_uv_textures_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+static void rna_MeshColor_color2_set(PointerRNA *ptr, const float *values)
 {
-	Mesh *me= (Mesh*)ptr->data;
-	CustomData *fdata= rna_mesh_fdata(me);
-	rna_iterator_array_begin(iter, (void*)fdata->layers, sizeof(CustomDataLayer), fdata->totlayer, 0, rna_uv_texture_check);
-}
+	MCol *mcol = (MCol*)ptr->data;
 
-static int rna_Mesh_uv_textures_length(PointerRNA *ptr)
-{
-	return rna_CustomDataLayer_length(ptr, CD_MTFACE);
+	(&mcol[1].r)[2] = (char)(CLAMPIS(values[0]*255.0f, 0, 255));
+	(&mcol[1].r)[1] = (char)(CLAMPIS(values[1]*255.0f, 0, 255));
+	(&mcol[1].r)[0] = (char)(CLAMPIS(values[2]*255.0f, 0, 255));
 }
 
-static PointerRNA rna_Mesh_active_uv_texture_get(PointerRNA *ptr)
+static void rna_MeshColor_color3_get(PointerRNA *ptr, float *values)
 {
-	Mesh *me= (Mesh*)ptr->data;
-	CustomData *fdata= rna_mesh_fdata(me);
-	int index= CustomData_get_active_layer_index(fdata, CD_MTFACE);
-	CustomDataLayer *cdl= (index == -1)? NULL: &fdata->layers[index];
+	MCol *mcol = (MCol*)ptr->data;
 
-	return rna_pointer_inherit_refine(ptr, &RNA_MeshTextureFaceLayer, cdl);
+	values[2] = (&mcol[2].r)[0]/255.0f;
+	values[1] = (&mcol[2].r)[1]/255.0f;
+	values[0] = (&mcol[2].r)[2]/255.0f;
 }
 
-static PointerRNA rna_Mesh_uv_texture_clone_get(PointerRNA *ptr)
+static void rna_MeshColor_color3_set(PointerRNA *ptr, const float *values)
 {
-	Mesh *me= (Mesh*)ptr->data;
-	CustomData *fdata= rna_mesh_fdata(me);
-	int index= CustomData_get_clone_layer_index(fdata, CD_MTFACE);
-	CustomDataLayer *cdl= (index == -1)? NULL: &fdata->layers[index];
+	MCol *mcol = (MCol*)ptr->data;
 
-	return rna_pointer_inherit_refine(ptr, &RNA_MeshTextureFaceLayer, cdl);
+	(&mcol[2].r)[2] = (char)(CLAMPIS(values[0]*255.0f, 0, 255));
+	(&mcol[2].r)[1] = (char)(CLAMPIS(values[1]*255.0f, 0, 255));
+	(&mcol[2].r)[0] = (char)(CLAMPIS(values[2]*255.0f, 0, 255));
 }
 
-static PointerRNA rna_Mesh_uv_texture_stencil_get(PointerRNA *ptr)
+static void rna_MeshColor_color4_get(PointerRNA *ptr, float *values)
 {
-	Mesh *me= (Mesh*)ptr->data;
-	CustomData *fdata= rna_mesh_fdata(me);
-	int index= CustomData_get_stencil_layer_index(fdata, CD_MTFACE);
-	CustomDataLayer *cdl= (index == -1)? NULL: &fdata->layers[index];
+	MCol *mcol = (MCol*)ptr->data;
 
-	return rna_pointer_inherit_refine(ptr, &RNA_MeshTextureFaceLayer, cdl);
+	values[2] = (&mcol[3].r)[0]/255.0f;
+	values[1] = (&mcol[3].r)[1]/255.0f;
+	values[0] = (&mcol[3].r)[2]/255.0f;
 }
 
-static void rna_Mesh_active_uv_texture_set(PointerRNA *ptr, PointerRNA value)
+static void rna_MeshColor_color4_set(PointerRNA *ptr, const float *values)
 {
-	Mesh *me= (Mesh*)ptr->data;
-	CustomData *fdata= rna_mesh_fdata(me);
-	CustomDataLayer *cdl;
-	int a;
+	MCol *mcol = (MCol*)ptr->data;
 
-	for(cdl=fdata->layers, a=0; a<fdata->totlayer; cdl++, a++) {
-		if(value.data == cdl) {
-			CustomData_set_layer_active_index(fdata, CD_MTFACE, a);
-			mesh_update_customdata_pointers(me);
-			return;
-		}
-	}
+	(&mcol[3].r)[2] = (char)(CLAMPIS(values[0]*255.0f, 0, 255));
+	(&mcol[3].r)[1] = (char)(CLAMPIS(values[1]*255.0f, 0, 255));
+	(&mcol[3].r)[0] = (char)(CLAMPIS(values[2]*255.0f, 0, 255));
 }
 
-static void rna_Mesh_uv_texture_clone_set(PointerRNA *ptr, PointerRNA value)
+static void rna_MeshLoopColor_color_get(PointerRNA *ptr, float *values)
 {
-	Mesh *me= (Mesh*)ptr->data;
-	CustomData *fdata= rna_mesh_fdata(me);
-	CustomDataLayer *cdl;
-	int a;
+	MLoopCol *mcol = (MLoopCol *)ptr->data;
 
-	for(cdl=fdata->layers, a=0; a<fdata->totlayer; cdl++, a++) {
-		if(value.data == cdl) {
-			CustomData_set_layer_clone_index(fdata, CD_MTFACE, a);
-			return;
-		}
-	}
+	values[0] = (&mcol->r)[0] / 255.0f;
+	values[1] = (&mcol->r)[1] / 255.0f;
+	values[2] = (&mcol->r)[2] / 255.0f;
 }
 
-static void rna_Mesh_uv_texture_stencil_set(PointerRNA *ptr, PointerRNA value)
+static void rna_MeshLoopColor_color_set(PointerRNA *ptr, const float *values)
 {
-	Mesh *me= (Mesh*)ptr->data;
-	CustomData *fdata= rna_mesh_fdata(me);
-	CustomDataLayer *cdl;
-	int a;
-
-	for(cdl=fdata->layers, a=0; a<fdata->totlayer; cdl++, a++) {
-		if(value.data == cdl) {
-			CustomData_set_layer_stencil_index(fdata, CD_MTFACE, a);
-			return;
-		}
-	}
-}
+	MLoopCol *mcol = (MLoopCol *)ptr->data;
 
-static int rna_Mesh_active_uv_texture_index_get(PointerRNA *ptr)
-{
-	Mesh *me= (Mesh*)ptr->data;
-	CustomData *fdata= rna_mesh_fdata(me);
-	return CustomData_get_active_layer(fdata, CD_MTFACE);
+	(&mcol->r)[0] = (char)(CLAMPIS(values[0] * 255.0f, 0, 255));
+	(&mcol->r)[1] = (char)(CLAMPIS(values[1] * 255.0f, 0, 255));
+	(&mcol->r)[2] = (char)(CLAMPIS(values[2] * 255.0f, 0, 255));
 }
 
-static int rna_Mesh_uv_texture_clone_index_get(PointerRNA *ptr)
+static int rna_Mesh_texspace_editable(PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->data;
-	CustomData *fdata= rna_mesh_fdata(me);
-	return CustomData_get_clone_layer(fdata, CD_MTFACE);
+	Mesh *me = (Mesh*)ptr->data;
+	return (me->texflag & ME_AUTOSPACE)? 0: PROP_EDITABLE;
 }
 
-static int rna_Mesh_uv_texture_stencil_index_get(PointerRNA *ptr)
+static void rna_MeshVertex_groups_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->data;
-	CustomData *fdata= rna_mesh_fdata(me);
-	return CustomData_get_stencil_layer(fdata, CD_MTFACE);
-}
+	Mesh *me = rna_mesh(ptr);
 
-static void rna_Mesh_active_uv_texture_index_set(PointerRNA *ptr, int value)
-{
-	Mesh *me= (Mesh*)ptr->data;
-	CustomData *fdata= rna_mesh_fdata(me);
+	if (me->dvert) {
+		MVert *mvert = (MVert*)ptr->data;
+		MDeformVert *dvert = me->dvert + (mvert-me->mvert);
 
-	CustomData_set_layer_active(fdata, CD_MTFACE, value);
-	mesh_update_customdata_pointers(me);
+		rna_iterator_array_begin(iter, (void*)dvert->dw, sizeof(MDeformWeight), dvert->totweight, 0, NULL);
+	}
+	else
+		rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL);
 }
 
-static void rna_Mesh_uv_texture_clone_index_set(PointerRNA *ptr, int value)
+static int rna_CustomDataLayer_active_get(PointerRNA *ptr, CustomData *data, int type, int render)
 {
-	Mesh *me= (Mesh*)ptr->data;
-	CustomData *fdata= rna_mesh_fdata(me);
+	int n = ((CustomDataLayer*)ptr->data) - data->layers;
 
-	CustomData_set_layer_clone(fdata, CD_MTFACE, value);
+	if (render) return (n == CustomData_get_render_layer_index(data, type));
+	else return (n == CustomData_get_active_layer_index(data, type));
 }
 
-static void rna_Mesh_uv_texture_stencil_index_set(PointerRNA *ptr, int value)
+static int rna_CustomDataLayer_clone_get(PointerRNA *ptr, CustomData *data, int type, int render)
 {
-	Mesh *me= (Mesh*)ptr->data;
-	CustomData *fdata= rna_mesh_fdata(me);
+	int n = ((CustomDataLayer*)ptr->data) - data->layers;
 
-	CustomData_set_layer_stencil(fdata, CD_MTFACE, value);
+	return (n == CustomData_get_clone_layer_index(data, type));
 }
 
-static void rna_Mesh_active_uv_texture_index_range(PointerRNA *ptr, int *min, int *max)
+static void rna_CustomDataLayer_active_set(PointerRNA *ptr, CustomData *data, int value, int type, int render)
 {
-	Mesh *me= (Mesh*)ptr->data;
-	CustomData *fdata= rna_mesh_fdata(me);
-
-	*min= 0;
-	*max= CustomData_number_of_layers(fdata, CD_MTFACE)-1;
-	*max= MAX2(0, *max);
-}
+	int n = (((CustomDataLayer*)ptr->data) - data->layers) - CustomData_get_layer_index(data, type);
 
-static PointerRNA rna_Mesh_active_mtface_get(PointerRNA *ptr)
-{
-	Mesh *me= (Mesh*)ptr->data;
-	EditMesh *em= BKE_mesh_get_editmesh(me);
-	MTFace *tf;
+	if (value == 0)
+		return;
 
-	if (em && EM_texFaceCheck(em))
-	{
-		tf = EM_get_active_mtface(em, NULL, NULL, 1);
+	if (render) CustomData_set_layer_render(data, type, n);
+	else        CustomData_set_layer_active(data, type, n);
 
-		return rna_pointer_inherit_refine(ptr, &RNA_MeshTextureFace, tf);
+	/* sync loop layer */
+	if (type == CD_MTEXPOLY) {
+		CustomData *ldata = rna_mesh_ldata(ptr);
+		if (render) CustomData_set_layer_render(ldata, CD_MLOOPUV, n);
+		else        CustomData_set_layer_active(ldata, CD_MLOOPUV, n);
 	}
-
-	return rna_pointer_inherit_refine(ptr, &RNA_MeshTextureFace, NULL);
-}
-
-static void rna_MeshTextureFace_uv1_get(PointerRNA *ptr, float *values)
-{
-	MTFace *mtface= (MTFace*)ptr->data;
-	
-	values[0]= mtface->uv[0][0];
-	values[1]= mtface->uv[0][1];
-}
-
-static void rna_MeshTextureFace_uv1_set(PointerRNA *ptr, const float *values)
-{
-	MTFace *mtface= (MTFace*)ptr->data;
-
-	mtface->uv[0][0]= values[0];
-	mtface->uv[0][1]= values[1];
 }
 
-static void rna_MeshTextureFace_uv2_get(PointerRNA *ptr, float *values)
-{
-	MTFace *mtface= (MTFace*)ptr->data;
-
-	values[0]= mtface->uv[1][0];
-	values[1]= mtface->uv[1][1];
-}
-
-static void rna_MeshTextureFace_uv2_set(PointerRNA *ptr, const float *values)
+static void rna_CustomDataLayer_clone_set(PointerRNA *ptr, CustomData *data, int value, int type, int render)
 {
-	MTFace *mtface= (MTFace*)ptr->data;
-
-	mtface->uv[1][0]= values[0];
-	mtface->uv[1][1]= values[1];
-}
-
-static void rna_MeshTextureFace_uv3_get(PointerRNA *ptr, float *values)
-{
-	MTFace *mtface= (MTFace*)ptr->data;
-
-	values[0]= mtface->uv[2][0];
-	values[1]= mtface->uv[2][1];
-}
+	int n = ((CustomDataLayer*)ptr->data) - data->layers;
 
-static void rna_MeshTextureFace_uv3_set(PointerRNA *ptr, const float *values)
-{
-	MTFace *mtface= (MTFace*)ptr->data;
+	if (value == 0)
+		return;
 
-	mtface->uv[2][0]= values[0];
-	mtface->uv[2][1]= values[1];
+	CustomData_set_layer_clone_index(data, type, n);
 }
 
-static void rna_MeshTextureFace_uv4_get(PointerRNA *ptr, float *values)
-{
-	MTFace *mtface= (MTFace*)ptr->data;
-
-	values[0]= mtface->uv[3][0];
-	values[1]= mtface->uv[3][1];
-}
+/* uv_layers */
 
-static void rna_MeshTextureFace_uv4_set(PointerRNA *ptr, const float *values)
-{
-	MTFace *mtface= (MTFace*)ptr->data;
+DEFINE_CUSTOMDATA_LAYER_COLLECTION(uv_layer, ldata, CD_MLOOPUV)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_layer, ldata, CD_MLOOPUV, active, MeshUVLoopLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_layer, ldata, CD_MLOOPUV, clone, MeshUVLoopLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_layer, ldata, CD_MLOOPUV, stencil, MeshUVLoopLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_layer, ldata, CD_MLOOPUV, render, MeshUVLoopLayer)
 
-	mtface->uv[3][0]= values[0];
-	mtface->uv[3][1]= values[1];
-}
+/* MeshUVLoopLayer */
 
-static int rna_CustomDataData_numverts(PointerRNA *ptr, int type)
+static char *rna_MeshUVLoopLayer_path(PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	CustomData *fdata= rna_mesh_fdata(me);
-	CustomDataLayer *cdl;
-	int a, b;
-
-	for(cdl=fdata->layers, a=0; a<fdata->totlayer; cdl++, a++) {
-		if(cdl->type == type) {
-			b= ((char*)ptr->data - ((char*)cdl->data))/CustomData_sizeof(type);
-			if(b >= 0 && b < me->totface)
-				return (me->mface[b].v4? 4: 3);
-		}
-	}
-
-	return 0;
+	return BLI_sprintfN("uv_layers[\"%s\"]", ((CustomDataLayer*)ptr->data)->name);
 }
 
-static int rna_MeshTextureFace_uv_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
+static void rna_MeshUVLoopLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	length[0]= rna_CustomDataData_numverts(ptr, CD_MTFACE);
-	length[1]= 2;
-	return length[0]*length[1];
+	Mesh *me = rna_mesh(ptr);
+	CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
+	rna_iterator_array_begin(iter, layer->data, sizeof(MLoopUV), (me->edit_btmesh) ? 0 : me->totloop, 0, NULL);
 }
 
-static void rna_MeshTextureFace_uv_get(PointerRNA *ptr, float *values)
+static int rna_MeshUVLoopLayer_data_length(PointerRNA *ptr)
 {
-	MTFace *mtface= (MTFace*)ptr->data;
-	int totvert= rna_CustomDataData_numverts(ptr, CD_MTFACE);
-
-	memcpy(values, mtface->uv, totvert * 2 * sizeof(float));
+	Mesh *me = rna_mesh(ptr);
+	return (me->edit_btmesh) ? 0 : me->totloop;
 }
 
-static void rna_MeshTextureFace_uv_set(PointerRNA *ptr, const float *values)
-{
-	MTFace *mtface= (MTFace*)ptr->data;
-	int totvert= rna_CustomDataData_numverts(ptr, CD_MTFACE);
+/* face uv_textures */
 
-	memcpy(mtface->uv, values, totvert * 2 * sizeof(float));
-}
+DEFINE_CUSTOMDATA_LAYER_COLLECTION(tessface_uv_texture, fdata, CD_MTFACE)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(tessface_uv_texture, fdata, CD_MTFACE, active, MeshTextureFaceLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(tessface_uv_texture, fdata, CD_MTFACE, clone, MeshTextureFaceLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(tessface_uv_texture, fdata, CD_MTFACE, stencil, MeshTextureFaceLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(tessface_uv_texture, fdata, CD_MTFACE, render, MeshTextureFaceLayer)
 
 static void rna_MeshTextureFaceLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	CustomDataLayer *layer= (CustomDataLayer*)ptr->data;
-	rna_iterator_array_begin(iter, layer->data, sizeof(MTFace), (me->edit_mesh)? 0: me->totface, 0, NULL);
+	Mesh *me = rna_mesh(ptr);
+	CustomDataLayer *layer = (CustomDataLayer*)ptr->data;
+	rna_iterator_array_begin(iter, layer->data, sizeof(MTFace), (me->edit_btmesh)? 0: me->totface, 0, NULL);
 }
 
 static int rna_MeshTextureFaceLayer_data_length(PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	return (me->edit_mesh)? 0: me->totface;
+	Mesh *me = rna_mesh(ptr);
+	return (me->edit_btmesh)? 0: me->totface;
 }
 
 static int rna_MeshTextureFaceLayer_active_render_get(PointerRNA *ptr)
 {
-	return rna_CustomDataLayer_active_get(ptr, CD_MTFACE, 1);
+	return rna_CustomDataLayer_active_get(ptr, rna_mesh_fdata(ptr), CD_MTFACE, 1);
 }
 
 static int rna_MeshTextureFaceLayer_active_get(PointerRNA *ptr)
 {
-	return rna_CustomDataLayer_active_get(ptr, CD_MTFACE, 0);
+	return rna_CustomDataLayer_active_get(ptr, rna_mesh_fdata(ptr), CD_MTFACE, 0);
 }
 
 static int rna_MeshTextureFaceLayer_clone_get(PointerRNA *ptr)
 {
-	return rna_CustomDataLayer_clone_get(ptr, CD_MTFACE, 0);
+	return rna_CustomDataLayer_clone_get(ptr, rna_mesh_fdata(ptr), CD_MTFACE, 0);
 }
 
 static void rna_MeshTextureFaceLayer_active_render_set(PointerRNA *ptr, int value)
 {
-	rna_CustomDataLayer_active_set(ptr, value, CD_MTFACE, 1);
+	rna_CustomDataLayer_active_set(ptr, rna_mesh_fdata(ptr), value, CD_MTFACE, 1);
 }
 
 static void rna_MeshTextureFaceLayer_active_set(PointerRNA *ptr, int value)
 {
-	rna_CustomDataLayer_active_set(ptr, value, CD_MTFACE, 0);
+	rna_CustomDataLayer_active_set(ptr, rna_mesh_fdata(ptr), value, CD_MTFACE, 0);
 }
 
 static void rna_MeshTextureFaceLayer_clone_set(PointerRNA *ptr, int value)
 {
-	rna_CustomDataLayer_clone_set(ptr, value, CD_MTFACE, 0);
+	rna_CustomDataLayer_clone_set(ptr, rna_mesh_fdata(ptr), value, CD_MTFACE, 0);
 }
 
 static void rna_MeshTextureFaceLayer_name_set(PointerRNA *ptr, const char *value)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	CustomData *fdata= rna_mesh_fdata(me);
-	CustomDataLayer *cdl= (CustomDataLayer*)ptr->data;
+	CustomData *fdata = rna_mesh_fdata(ptr);
+	CustomDataLayer *cdl = (CustomDataLayer*)ptr->data;
 	BLI_strncpy_utf8(cdl->name, value, sizeof(cdl->name));
 	CustomData_set_layer_unique_name(fdata, cdl - fdata->layers);
 }
 
-static int rna_vertex_color_check(CollectionPropertyIterator *UNUSED(iter), void *data)
+/* poly uv_textures */
+
+DEFINE_CUSTOMDATA_LAYER_COLLECTION(uv_texture, pdata, CD_MTEXPOLY)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_texture, pdata, CD_MTEXPOLY, active, MeshTexturePolyLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_texture, pdata, CD_MTEXPOLY, clone, MeshTexturePolyLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_texture, pdata, CD_MTEXPOLY, stencil, MeshTexturePolyLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_texture, pdata, CD_MTEXPOLY, render, MeshTexturePolyLayer)
+
+static void rna_MeshTexturePolyLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	CustomDataLayer *layer= (CustomDataLayer*)data;
-	return (layer->type != CD_MCOL);
+	Mesh *me = rna_mesh(ptr);
+	CustomDataLayer *layer = (CustomDataLayer*)ptr->data;
+	rna_iterator_array_begin(iter, layer->data, sizeof(MTexPoly), (me->edit_btmesh) ? 0 : me->totpoly, 0, NULL);
 }
 
-static void rna_Mesh_vertex_colors_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+static int rna_MeshTexturePolyLayer_data_length(PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->data;
-	CustomData *fdata= rna_mesh_fdata(me);
-	rna_iterator_array_begin(iter, (void*)fdata->layers, sizeof(CustomDataLayer), fdata->totlayer, 0, rna_vertex_color_check);
+	Mesh *me = rna_mesh(ptr);
+	return (me->edit_btmesh) ? 0 : me->totpoly;
 }
 
-static int rna_Mesh_vertex_colors_length(PointerRNA *ptr)
+static int rna_MeshTexturePolyLayer_active_render_get(PointerRNA *ptr)
 {
-	return rna_CustomDataLayer_length(ptr, CD_MCOL);
+	return rna_CustomDataLayer_active_get(ptr, rna_mesh_pdata(ptr), CD_MTEXPOLY, 1);
 }
 
-static PointerRNA rna_Mesh_active_vertex_color_get(PointerRNA *ptr)
+static int rna_MeshTexturePolyLayer_active_get(PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->data;
-	CustomData *fdata= rna_mesh_fdata(me);
-	int index= CustomData_get_active_layer_index(fdata, CD_MCOL);
-	CustomDataLayer *cdl= (index == -1)? NULL: &fdata->layers[index];
-
-	return rna_pointer_inherit_refine(ptr, &RNA_MeshColorLayer, cdl);
+	return rna_CustomDataLayer_active_get(ptr, rna_mesh_pdata(ptr), CD_MTEXPOLY, 0);
 }
 
-static void rna_Mesh_active_vertex_color_set(PointerRNA *ptr, PointerRNA value)
+static int rna_MeshTexturePolyLayer_clone_get(PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->data;
-	CustomData *fdata= rna_mesh_fdata(me);
-	CustomDataLayer *cdl;
-	int a;
-
-	for(cdl=fdata->layers, a=0; a<fdata->totlayer; cdl++, a++) {
-		if(value.data == cdl) {
-			CustomData_set_layer_active_index(fdata, CD_MCOL, a);
-			mesh_update_customdata_pointers(me);
-			return;
-		}
-	}
+	return rna_CustomDataLayer_clone_get(ptr, rna_mesh_pdata(ptr), CD_MTEXPOLY, 0);
 }
 
-static int rna_Mesh_active_vertex_color_index_get(PointerRNA *ptr)
+static void rna_MeshTexturePolyLayer_active_render_set(PointerRNA *ptr, int value)
 {
-	Mesh *me= (Mesh*)ptr->data;
-	CustomData *fdata= rna_mesh_fdata(me);
-	return CustomData_get_active_layer(fdata, CD_MCOL);
+	rna_CustomDataLayer_active_set(ptr, rna_mesh_pdata(ptr), value, CD_MTEXPOLY, 1);
 }
 
-static void rna_Mesh_active_vertex_color_index_set(PointerRNA *ptr, int value)
+static void rna_MeshTexturePolyLayer_active_set(PointerRNA *ptr, int value)
 {
-	Mesh *me= (Mesh*)ptr->data;
-	CustomData *fdata= rna_mesh_fdata(me);
-
-	CustomData_set_layer_active(fdata, CD_MCOL, value);
-	mesh_update_customdata_pointers(me);
+	rna_CustomDataLayer_active_set(ptr, rna_mesh_pdata(ptr), value, CD_MTEXPOLY, 0);
 }
 
-static void rna_Mesh_active_vertex_color_index_range(PointerRNA *ptr, int *min, int *max)
+static void rna_MeshTexturePolyLayer_clone_set(PointerRNA *ptr, int value)
 {
-	Mesh *me= (Mesh*)ptr->data;
-	CustomData *fdata= rna_mesh_fdata(me);
+	rna_CustomDataLayer_clone_set(ptr, rna_mesh_pdata(ptr), value, CD_MTEXPOLY, 0);
+}
 
-	*min= 0;
-	*max= CustomData_number_of_layers(fdata, CD_MCOL)-1;
-	*max= MAX2(0, *max);
+static void rna_MeshTexturePolyLayer_name_set(PointerRNA *ptr, const char *value)
+{
+	CustomData *pdata = rna_mesh_pdata(ptr);
+	CustomDataLayer *cdl = (CustomDataLayer*)ptr->data;
+	BLI_strncpy_utf8(cdl->name, value, sizeof(cdl->name));
+	CustomData_set_layer_unique_name(pdata, cdl - pdata->layers);
 }
 
+/* vertex_color_layers */
+
+DEFINE_CUSTOMDATA_LAYER_COLLECTION(tessface_vertex_color, fdata, CD_MCOL)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(tessface_vertex_color, fdata, CD_MCOL, active, MeshColorLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(tessface_vertex_color, fdata, CD_MCOL, render, MeshColorLayer)
+
 static void rna_MeshColorLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	CustomDataLayer *layer= (CustomDataLayer*)ptr->data;
-	rna_iterator_array_begin(iter, layer->data, sizeof(MCol)*4, (me->edit_mesh)? 0: me->totface, 0, NULL);
+	Mesh *me = rna_mesh(ptr);
+	CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
+	rna_iterator_array_begin(iter, layer->data, sizeof(MCol) * 4, me->totface, 0, NULL);
 }
 
 static int rna_MeshColorLayer_data_length(PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	return (me->edit_mesh)? 0: me->totface;
+	Mesh *me = rna_mesh(ptr);
+	return me->totface;
 }
 
 static int rna_MeshColorLayer_active_render_get(PointerRNA *ptr)
 {
-	return rna_CustomDataLayer_active_get(ptr, CD_MCOL, 1);
+	return rna_CustomDataLayer_active_get(ptr, rna_mesh_fdata(ptr), CD_MCOL, 1);
 }
 
 static int rna_MeshColorLayer_active_get(PointerRNA *ptr)
 {
-	return rna_CustomDataLayer_active_get(ptr, CD_MCOL, 0);
+	return rna_CustomDataLayer_active_get(ptr, rna_mesh_fdata(ptr), CD_MCOL, 0);
 }
 
 static void rna_MeshColorLayer_active_render_set(PointerRNA *ptr, int value)
 {
-	rna_CustomDataLayer_active_set(ptr, value, CD_MCOL, 1);
+	rna_CustomDataLayer_active_set(ptr, rna_mesh_fdata(ptr), value, CD_MCOL, 1);
 }
 
 static void rna_MeshColorLayer_active_set(PointerRNA *ptr, int value)
 {
-	rna_CustomDataLayer_active_set(ptr, value, CD_MCOL, 0);
+	rna_CustomDataLayer_active_set(ptr, rna_mesh_fdata(ptr), value, CD_MCOL, 0);
+}
+
+DEFINE_CUSTOMDATA_LAYER_COLLECTION(vertex_color, ldata, CD_MLOOPCOL)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(vertex_color, ldata, CD_MLOOPCOL, active, MeshLoopColorLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(vertex_color, ldata, CD_MLOOPCOL, render, MeshLoopColorLayer)
+
+static void rna_MeshLoopColorLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+{
+	Mesh *me = rna_mesh(ptr);
+	CustomDataLayer *layer = (CustomDataLayer*)ptr->data;
+	rna_iterator_array_begin(iter, layer->data, sizeof(MLoopCol), me->totloop, 0, NULL);
+}
+
+static int rna_MeshLoopColorLayer_data_length(PointerRNA *ptr)
+{
+	Mesh *me = rna_mesh(ptr);
+	return me->totloop;
 }
 
-static void rna_MeshColorLayer_name_set(PointerRNA *ptr, const char *value)
+static int rna_MeshLoopColorLayer_active_render_get(PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	CustomData *fdata= rna_mesh_fdata(me);
-	CustomDataLayer *cdl= (CustomDataLayer*)ptr->data;
+	return rna_CustomDataLayer_active_get(ptr, rna_mesh_ldata(ptr), CD_MLOOPCOL, 1);
+}
+
+static int rna_MeshLoopColorLayer_active_get(PointerRNA *ptr)
+{
+	return rna_CustomDataLayer_active_get(ptr, rna_mesh_ldata(ptr), CD_MLOOPCOL, 0);
+}
+
+static void rna_MeshLoopColorLayer_active_render_set(PointerRNA *ptr, int value)
+{
+	rna_CustomDataLayer_active_set(ptr, rna_mesh_ldata(ptr), value, CD_MLOOPCOL, 1);
+}
+
+static void rna_MeshLoopColorLayer_active_set(PointerRNA *ptr, int value)
+{
+	rna_CustomDataLayer_active_set(ptr, rna_mesh_ldata(ptr), value, CD_MLOOPCOL, 0);
+}
+
+static void rna_MeshLoopColorLayer_name_set(PointerRNA *ptr, const char *value)
+{
+	/* Mesh *me = rna_mesh(ptr); */ /* UNUSED */
+	/* CustomData *pdata = rna_mesh_pdata(ptr); */ /* UNUSED */
+	CustomDataLayer *cdl = (CustomDataLayer*)ptr->data;
 	BLI_strncpy_utf8(cdl->name, value, sizeof(cdl->name));
-	CustomData_set_layer_unique_name(fdata, cdl - fdata->layers);
+	CustomData_set_layer_unique_name(rna_mesh_ldata(ptr), cdl - rna_mesh_ldata(ptr)->layers);
 }
 
 static void rna_MeshFloatPropertyLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	CustomDataLayer *layer= (CustomDataLayer*)ptr->data;
-	rna_iterator_array_begin(iter, layer->data, sizeof(MFloatProperty), (me->edit_mesh)? 0: me->totface, 0, NULL);
+	Mesh *me = rna_mesh(ptr);
+	CustomDataLayer *layer = (CustomDataLayer*)ptr->data;
+	rna_iterator_array_begin(iter, layer->data, sizeof(MFloatProperty), me->totpoly, 0, NULL);
 }
 
 static int rna_MeshFloatPropertyLayer_data_length(PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	return (me->edit_mesh)? 0: me->totface;
+	Mesh *me = rna_mesh(ptr);
+	return me->totpoly;
 }
 
-static int rna_float_layer_check(CollectionPropertyIterator *UNUSED(iter), void *data)
+static int rna_float_layer_check(CollectionPropertyIterator *iter, void *data)
 {
-	CustomDataLayer *layer= (CustomDataLayer*)data;
+	CustomDataLayer *layer = (CustomDataLayer*)data;
 	return (layer->type != CD_PROP_FLT);
 }
 
-static void rna_Mesh_float_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+static void rna_Mesh_polygon_float_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->data;
-	CustomData *fdata= rna_mesh_fdata(me);
-	rna_iterator_array_begin(iter, (void*)fdata->layers, sizeof(CustomDataLayer), fdata->totlayer, 0, rna_float_layer_check);
+	CustomData *pdata = rna_mesh_pdata(ptr);
+	rna_iterator_array_begin(iter, (void*)pdata->layers, sizeof(CustomDataLayer), pdata->totlayer, 0,
+	                         rna_float_layer_check);
 }
 
-static int rna_Mesh_float_layers_length(PointerRNA *ptr)
+static int rna_Mesh_polygon_float_layers_length(PointerRNA *ptr)
 {
-	return rna_CustomDataLayer_length(ptr, CD_PROP_FLT);
+	return CustomData_number_of_layers(rna_mesh_pdata(ptr), CD_PROP_FLT);
 }
 
-static int rna_int_layer_check(CollectionPropertyIterator *UNUSED(iter), void *data)
+static int rna_int_layer_check(CollectionPropertyIterator *iter, void *data)
 {
-	CustomDataLayer *layer= (CustomDataLayer*)data;
+	CustomDataLayer *layer = (CustomDataLayer*)data;
 	return (layer->type != CD_PROP_INT);
 }
 
 static void rna_MeshIntPropertyLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	CustomDataLayer *layer= (CustomDataLayer*)ptr->data;
-	rna_iterator_array_begin(iter, layer->data, sizeof(MIntProperty), (me->edit_mesh)? 0: me->totface, 0, NULL);
+	Mesh *me = rna_mesh(ptr);
+	CustomDataLayer *layer = (CustomDataLayer*)ptr->data;
+	rna_iterator_array_begin(iter, layer->data, sizeof(MIntProperty), me->totpoly, 0, NULL);
 }
 
 static int rna_MeshIntPropertyLayer_data_length(PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	return (me->edit_mesh)? 0: me->totface;
+	Mesh *me = rna_mesh(ptr);
+	return me->totpoly;
 }
 
-static void rna_Mesh_int_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+static void rna_Mesh_polygon_int_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->data;
-	CustomData *fdata= rna_mesh_fdata(me);
-	rna_iterator_array_begin(iter, (void*)fdata->layers, sizeof(CustomDataLayer), fdata->totlayer, 0, rna_int_layer_check);
+	CustomData *pdata = rna_mesh_pdata(ptr);
+	rna_iterator_array_begin(iter, (void*)pdata->layers, sizeof(CustomDataLayer), pdata->totlayer, 0,
+	                         rna_int_layer_check);
 }
 
-static int rna_Mesh_int_layers_length(PointerRNA *ptr)
+static int rna_Mesh_polygon_int_layers_length(PointerRNA *ptr)
 {
-	return rna_CustomDataLayer_length(ptr, CD_PROP_INT);
+	return CustomData_number_of_layers(rna_mesh_pdata(ptr), CD_PROP_INT);
 }
 
-static int rna_string_layer_check(CollectionPropertyIterator *UNUSED(iter), void *data)
+static int rna_string_layer_check(CollectionPropertyIterator *iter, void *data)
 {
-	CustomDataLayer *layer= (CustomDataLayer*)data;
+	CustomDataLayer *layer = (CustomDataLayer*)data;
 	return (layer->type != CD_PROP_STR);
 }
 
 static void rna_MeshStringPropertyLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	CustomDataLayer *layer= (CustomDataLayer*)ptr->data;
-	rna_iterator_array_begin(iter, layer->data, sizeof(MStringProperty), (me->edit_mesh)? 0: me->totface, 0, NULL);
+	Mesh *me = rna_mesh(ptr);
+	CustomDataLayer *layer = (CustomDataLayer*)ptr->data;
+	rna_iterator_array_begin(iter, layer->data, sizeof(MStringProperty), me->totpoly, 0, NULL);
 }
 
 static int rna_MeshStringPropertyLayer_data_length(PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	return (me->edit_mesh)? 0: me->totface;
+	Mesh *me = rna_mesh(ptr);
+	return me->totpoly;
+}
+
+static void rna_Mesh_polygon_string_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+{
+	CustomData *pdata = rna_mesh_pdata(ptr);
+	rna_iterator_array_begin(iter, (void*)pdata->layers, sizeof(CustomDataLayer), pdata->totlayer, 0,
+	                         rna_string_layer_check);
 }
 
-static void rna_Mesh_string_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+static int rna_Mesh_polygon_string_layers_length(PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->data;
-	CustomData *fdata= rna_mesh_fdata(me);
-	rna_iterator_array_begin(iter, (void*)fdata->layers, sizeof(CustomDataLayer), fdata->totlayer, 0, rna_string_layer_check);
+	return CustomData_number_of_layers(rna_mesh_pdata(ptr), CD_PROP_STR);
 }
 
-static int rna_Mesh_string_layers_length(PointerRNA *ptr)
+static void rna_TexturePoly_image_set(PointerRNA *ptr, PointerRNA value)
 {
-	return rna_CustomDataLayer_length(ptr, CD_PROP_STR);
+	MTexPoly *tf = (MTexPoly*)ptr->data;
+	ID *id = value.data;
+
+	if (id) {
+		/* special exception here, individual faces don't count
+		 * as reference, but we do ensure the refcount is not zero */
+		if (id->us == 0)
+			id_us_plus(id);
+		else
+			id_lib_extern(id);
+	}
+
+	tf->tpage = (struct Image *)id;
 }
 
+/* while this is supposed to be readonly,
+ * keep it to support importers that only make tessfaces */
 static void rna_TextureFace_image_set(PointerRNA *ptr, PointerRNA value)
 {
-	MTFace *tf= (MTFace*)ptr->data;
-	ID *id= value.data;
+	MTFace *tf = (MTFace*)ptr->data;
+	ID *id = value.data;
 
-	if(id) {
+	if (id) {
 		/* special exception here, individual faces don't count
 		 * as reference, but we do ensure the refcount is not zero */
-		if(id->us == 0)
+		if (id->us == 0)
 			id_us_plus(id);
 		else
 			id_lib_extern(id);
 	}
 
-	tf->tpage= (struct Image*)id;
+	tf->tpage = (struct Image *)id;
 }
 
 static void rna_Mesh_auto_smooth_angle_set(PointerRNA *ptr, float value)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	value= RAD2DEGF(value);
+	Mesh *me = rna_mesh(ptr);
+	value = RAD2DEGF(value);
 	CLAMP(value, 1.0f, 80.0f);
-	me->smoothresh= (int)value;
+	me->smoothresh = (int)value;
 }
 
 static float rna_Mesh_auto_smooth_angle_get(PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
+	Mesh *me = rna_mesh(ptr);
 	return DEG2RADF((float)me->smoothresh);
 }
 
-static int rna_MeshFace_verts_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
+static int rna_MeshTessFace_verts_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
 {
-	MFace *face= (MFace*)ptr->data;
+	MFace *face = (MFace*)ptr->data;
 
-	if(face)
-		length[0]= (face->v4)? 4: 3;
+	if (face)
+		length[0] = (face->v4)? 4: 3;
 	else
-		length[0]= 4; // XXX rna_raw_access wants the length of a dummy face. this needs fixing. - Campbell
+		length[0] = 4; /* XXX rna_raw_access wants the length of a dummy face. this needs fixing. - Campbell */
 
 	return length[0];
 }
 
-static void rna_MeshFace_verts_get(PointerRNA *ptr, int *values)
+static void rna_MeshTessFace_verts_get(PointerRNA *ptr, int *values)
 {
-	MFace *face= (MFace*)ptr->data;
+	MFace *face = (MFace*)ptr->data;
 	memcpy(values, &face->v1, (face->v4 ? 4 : 3) * sizeof(int));
 }
 
-static void rna_MeshFace_verts_set(PointerRNA *ptr, const int *values)
+static void rna_MeshTessFace_verts_set(PointerRNA *ptr, const int *values)
 {
-	MFace *face= (MFace*)ptr->data;
+	MFace *face = (MFace*)ptr->data;
 	memcpy(&face->v1, values, (face->v4 ? 4 : 3) * sizeof(int));
 }
 
+/* poly.vertices - this is faked loop access for convenience */
+static int rna_MeshPoly_vertices_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
+{
+	MPoly *mp = (MPoly*)ptr->data;
+	/* note, raw access uses dummy item, this _could_ crash, watch out for this, mface uses it but it cant work here */
+	return (length[0] = mp->totloop);
+}
+
+static void rna_MeshPoly_vertices_get(PointerRNA *ptr, int *values)
+{
+	Mesh *me = rna_mesh(ptr);
+	MPoly *mp = (MPoly*)ptr->data;
+	MLoop *ml = &me->mloop[mp->loopstart];
+	unsigned int i;
+	for (i = mp->totloop; i > 0; i--, values++, ml++) {
+		*values = ml->v;
+	}
+}
+
+static void rna_MeshPoly_vertices_set(PointerRNA *ptr, const int *values)
+{
+	Mesh *me = rna_mesh(ptr);
+	MPoly *mp = (MPoly*)ptr->data;
+	MLoop *ml = &me->mloop[mp->loopstart];
+	unsigned int i;
+	for (i = mp->totloop; i > 0; i--, values++, ml++) {
+		ml->v = *values;
+	}
+}
+
+static void rna_MeshPoly_material_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
+{
+	Mesh *me = rna_mesh(ptr);
+	*min = 0;
+	*max = me->totcol-1;
+	*max = MAX2(0, *max);
+}
+
 static int rna_MeshVertex_index_get(PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	MVert *vert= (MVert*)ptr->data;
+	Mesh *me = rna_mesh(ptr);
+	MVert *vert = (MVert*)ptr->data;
 	return (int)(vert - me->mvert);
 }
 
 static int rna_MeshEdge_index_get(PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	MEdge *edge= (MEdge*)ptr->data;
+	Mesh *me = rna_mesh(ptr);
+	MEdge *edge = (MEdge*)ptr->data;
 	return (int)(edge - me->medge);
 }
 
-static int rna_MeshFace_index_get(PointerRNA *ptr)
+static int rna_MeshTessFace_index_get(PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	MFace *face= (MFace*)ptr->data;
+	Mesh *me = rna_mesh(ptr);
+	MFace *face = (MFace*)ptr->data;
 	return (int)(face - me->mface);
 }
 
+static int rna_MeshPolygon_index_get(PointerRNA *ptr)
+{
+	Mesh *me = rna_mesh(ptr);
+	MPoly *mpoly = (MPoly*)ptr->data;
+	return (int)(mpoly - me->mpoly);
+}
+
+static int rna_MeshLoop_index_get(PointerRNA *ptr)
+{
+	Mesh *me = rna_mesh(ptr);
+	MLoop *mloop = (MLoop*)ptr->data;
+	return (int)(mloop - me->mloop);
+}
+
 /* path construction */
 
 static char *rna_VertexGroupElement_path(PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->id.data; /* XXX not always! */
-	MDeformWeight *dw= (MDeformWeight*)ptr->data;
+	Mesh *me = rna_mesh(ptr); /* XXX not always! */
+	MDeformWeight *dw = (MDeformWeight*)ptr->data;
 	MDeformVert *dvert;
 	int a, b;
-	
-	/* sanity check: make sure that mesh pointer is valid */
-	if (me == NULL) 
-		return NULL;
-	else if (GS(me->id.name) != ID_ME) {
-		/* if object pointer, try to resolve the object's data to mesh pointer */
-		if (GS(me->id.name) == ID_OB) {
-			Object *ob = (Object *)me;
-			
-			if (ob->type == OB_MESH)
-				me = (Mesh *)ob->data;
-			else
-				return NULL; /* nothing can be done */
-		}
-		else
-			return NULL; /* nothing can be done */
-	}
-	
-	for(a=0, dvert=me->dvert; a<me->totvert; a++, dvert++) {
-		for(b=0; b<dvert->totweight; b++) {
-			if(dw == &dvert->dw[b])
-				return BLI_sprintfN("vertices[%d].groups[%d]", a, b);
-		}
-	}
+
+	for (a = 0, dvert = me->dvert; a < me->totvert; a++, dvert++)
+		for (b = 0; b < dvert->totweight; b++)
+			if (dw == &dvert->dw[b])
+				return BLI_sprintfN("verts[%d].groups[%d]", a, b);
 
 	return NULL;
 }
 
-static char *rna_MeshFace_path(PointerRNA *ptr)
+static char *rna_MeshPolygon_path(PointerRNA *ptr)
+{
+	return BLI_sprintfN("polygons[%d]", (int)((MPoly*)ptr->data - rna_mesh(ptr)->mpoly));
+}
+
+static char *rna_MeshTessFace_path(PointerRNA *ptr)
 {
-	return BLI_sprintfN("faces[%d]", (int)((MFace*)ptr->data - ((Mesh*)ptr->id.data)->mface));
+	return BLI_sprintfN("tessfaces[%d]", (int)((MFace *)ptr->data - rna_mesh(ptr)->mface));
 }
 
 static char *rna_MeshEdge_path(PointerRNA *ptr)
 {
-	return BLI_sprintfN("edges[%d]", (int)((MEdge*)ptr->data - ((Mesh*)ptr->id.data)->medge));
+	return BLI_sprintfN("edges[%d]", (int)((MEdge*)ptr->data - rna_mesh(ptr)->medge));
+}
+
+static char *rna_MeshLoop_path(PointerRNA *ptr)
+{
+	return BLI_sprintfN("loops[%d]", (int)((MLoop*)ptr->data - rna_mesh(ptr)->mloop));
 }
 
+
 static char *rna_MeshVertex_path(PointerRNA *ptr)
 {
-	return BLI_sprintfN("vertices[%d]", (int)((MVert*)ptr->data - ((Mesh*)ptr->id.data)->mvert));
+	return BLI_sprintfN("vertices[%d]", (int)((MVert*)ptr->data - rna_mesh(ptr)->mvert));
 }
 
 static char *rna_MeshTextureFaceLayer_path(PointerRNA *ptr)
 {
+	return BLI_sprintfN("tessface_uv_textures[\"%s\"]", ((CustomDataLayer*)ptr->data)->name);
+}
+
+static char *rna_MeshTexturePolyLayer_path(PointerRNA *ptr)
+{
 	return BLI_sprintfN("uv_textures[\"%s\"]", ((CustomDataLayer*)ptr->data)->name);
 }
 
-static char *rna_CustomDataData_path(PointerRNA *ptr, char *collection, int type)
+static char *rna_PolyCustomData_data_path(PointerRNA *ptr, char *collection, int type)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	CustomData *fdata= rna_mesh_fdata(me);
 	CustomDataLayer *cdl;
-	int a, b;
+	Mesh *me = rna_mesh(ptr);
+	CustomData *pdata = rna_mesh_pdata(ptr);
+	int a, b, totpoly = (me->edit_btmesh) ? 0 : me->totpoly;
+
+	for (cdl = pdata->layers, a = 0; a < pdata->totlayer; cdl++, a++) {
+		if (cdl->type == type) {
+			b = ((char*)ptr->data - ((char*)cdl->data))/CustomData_sizeof(type);
+			if (b >= 0 && b < totpoly)
+				return BLI_sprintfN("%s[\"%s\"].data[%d]", collection, cdl->name, b);
+		}
+	}
+
+	return NULL;
+}
+
+static char *rna_LoopCustomData_data_path(PointerRNA *ptr, char *collection, int type)
+{
+	CustomDataLayer *cdl;
+	Mesh *me = rna_mesh(ptr);
+	CustomData *ldata = rna_mesh_ldata(ptr);
+	int a, b, totloop = (me->edit_btmesh) ? 0 : me->totloop;
+
+	for (cdl = ldata->layers, a = 0; a < ldata->totlayer; cdl++, a++) {
+		if (cdl->type == type) {
+			b = ((char*)ptr->data - ((char*)cdl->data))/CustomData_sizeof(type);
+			if (b >= 0 && b < totloop)
+				return BLI_sprintfN("%s[\"%s\"].data[%d]", collection, cdl->name, b);
+		}
+	}
+
+	return NULL;
+}
 
-	for(cdl=fdata->layers, a=0; a<fdata->totlayer; cdl++, a++) {
-		if(cdl->type == type) {
-			b= ((char*)ptr->data - ((char*)cdl->data))/CustomData_sizeof(type);
-			if(b >= 0 && b < me->totface)
+static char *rna_FaceCustomData_data_path(PointerRNA *ptr, char *collection, int type)
+{
+	CustomDataLayer *cdl;
+	Mesh *me = rna_mesh(ptr);
+	CustomData *fdata = rna_mesh_fdata(ptr);
+	int a, b, totloop = (me->edit_btmesh) ? 0 : me->totloop;
+
+	for (cdl = fdata->layers, a = 0; a < fdata->totlayer; cdl++, a++) {
+		if (cdl->type == type) {
+			b = ((char*)ptr->data - ((char*)cdl->data))/CustomData_sizeof(type);
+			if (b >= 0 && b < totloop)
 				return BLI_sprintfN("%s[\"%s\"].data[%d]", collection, cdl->name, b);
 		}
 	}
@@ -1067,24 +1087,39 @@ static char *rna_CustomDataData_path(PointerRNA *ptr, char *collection, int type
 	return NULL;
 }
 
+static char *rna_MeshUVLoop_path(PointerRNA *ptr)
+{
+	return rna_LoopCustomData_data_path(ptr, "uv_layers", CD_MLOOPUV);
+}
+
 static char *rna_MeshTextureFace_path(PointerRNA *ptr)
 {
-	return rna_CustomDataData_path(ptr, "uv_textures", CD_MTFACE);
+	return rna_FaceCustomData_data_path(ptr, "tessface_uv_textures", CD_MTFACE);
+}
+
+static char *rna_MeshTexturePoly_path(PointerRNA *ptr)
+{
+	return rna_PolyCustomData_data_path(ptr, "uv_textures", CD_MTEXPOLY);
 }
 
 static char *rna_MeshColorLayer_path(PointerRNA *ptr)
 {
+	return BLI_sprintfN("tessface_vertex_colors[\"%s\"]", ((CustomDataLayer*)ptr->data)->name);
+}
+
+static char *rna_MeshLoopColorLayer_path(PointerRNA *ptr)
+{
 	return BLI_sprintfN("vertex_colors[\"%s\"]", ((CustomDataLayer*)ptr->data)->name);
 }
 
 static char *rna_MeshColor_path(PointerRNA *ptr)
 {
-	return rna_CustomDataData_path(ptr, "vertex_colors", CD_MCOL);
+	return rna_LoopCustomData_data_path(ptr, "vertex_colors", CD_MLOOPCOL);
 }
 
 static char *rna_MeshSticky_path(PointerRNA *ptr)
 {
-	return BLI_sprintfN("sticky[%d]", (int)((MSticky*)ptr->data - ((Mesh*)ptr->id.data)->msticky));
+	return BLI_sprintfN("sticky[%d]", (int)((MSticky*)ptr->data - rna_mesh(ptr)->msticky));
 }
 
 static char *rna_MeshIntPropertyLayer_path(PointerRNA *ptr)
@@ -1094,7 +1129,7 @@ static char *rna_MeshIntPropertyLayer_path(PointerRNA *ptr)
 
 static char *rna_MeshIntProperty_path(PointerRNA *ptr)
 {
-	return rna_CustomDataData_path(ptr, "layers_int", CD_MCOL);
+	return rna_PolyCustomData_data_path(ptr, "layers_int", CD_PROP_INT);
 }
 
 static char *rna_MeshFloatPropertyLayer_path(PointerRNA *ptr)
@@ -1104,7 +1139,7 @@ static char *rna_MeshFloatPropertyLayer_path(PointerRNA *ptr)
 
 static char *rna_MeshFloatProperty_path(PointerRNA *ptr)
 {
-	return rna_CustomDataData_path(ptr, "layers_float", CD_MCOL);
+	return rna_PolyCustomData_data_path(ptr, "layers_float", CD_PROP_FLT);
 }
 
 static char *rna_MeshStringPropertyLayer_path(PointerRNA *ptr)
@@ -1114,81 +1149,110 @@ static char *rna_MeshStringPropertyLayer_path(PointerRNA *ptr)
 
 static char *rna_MeshStringProperty_path(PointerRNA *ptr)
 {
-	return rna_CustomDataData_path(ptr, "layers_string", CD_MCOL);
+	return rna_PolyCustomData_data_path(ptr, "layers_string", CD_PROP_STR);
 }
 
 static int rna_Mesh_tot_vert_get(PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	return me->edit_mesh ? me->edit_mesh->totvertsel : 0;
+	Mesh *me = rna_mesh(ptr);
+	return me->edit_btmesh ? me->edit_btmesh->bm->totvertsel : 0;
 }
 static int rna_Mesh_tot_edge_get(PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	return me->edit_mesh ? me->edit_mesh->totedgesel: 0;
+	Mesh *me = rna_mesh(ptr);
+	return me->edit_btmesh ? me->edit_btmesh->bm->totedgesel: 0;
 }
 static int rna_Mesh_tot_face_get(PointerRNA *ptr)
 {
-	Mesh *me= (Mesh*)ptr->id.data;
-	return me->edit_mesh ? me->edit_mesh->totfacesel : 0;
+	Mesh *me = rna_mesh(ptr);
+	return me->edit_btmesh ? me->edit_btmesh->bm->totfacesel : 0;
 }
 
 static PointerRNA rna_Mesh_vertex_color_new(struct Mesh *me, struct bContext *C, const char *name)
 {
 	PointerRNA ptr;
+	CustomData *ldata;
+	CustomDataLayer *cdl = NULL;
+	int index = ED_mesh_color_add(C, NULL, NULL, me, name, FALSE);
+
+	if (index != -1) {
+		ldata = rna_mesh_ldata_helper(me);
+		cdl = &ldata->layers[CustomData_get_layer_index_n(ldata, CD_MLOOPCOL, index)];
+	}
+
+	RNA_pointer_create(&me->id, &RNA_MeshLoopColorLayer, cdl, &ptr);
+	return ptr;
+}
+
+static PointerRNA rna_Mesh_tessface_vertex_color_new(struct Mesh *me, struct bContext *C, ReportList *reports,
+                                                     const char *name)
+{
+	PointerRNA ptr;
 	CustomData *fdata;
-	CustomDataLayer *cdl= NULL;
-	int index= ED_mesh_color_add(C, NULL, NULL, me, name, FALSE);
+	CustomDataLayer *cdl = NULL;
+	int index;
+
+	if (me->edit_btmesh) {
+		BKE_report(reports, RPT_ERROR, "Can't add tessface colors's in editmode");
+		return PointerRNA_NULL;
+	}
+
+	if (me->mpoly) {
+		BKE_report(reports, RPT_ERROR, "Can't add tessface colors's when MPoly's exist");
+		return PointerRNA_NULL;
+	}
 
-	if(index != -1) {
-		fdata= rna_mesh_fdata(me);
-		cdl= &fdata->layers[CustomData_get_layer_index_n(fdata, CD_MCOL, index)];
+	index = ED_mesh_color_add(C, NULL, NULL, me, name, FALSE);
+
+	if (index != -1) {
+		fdata = rna_mesh_fdata_helper(me);
+		cdl = &fdata->layers[CustomData_get_layer_index_n(fdata, CD_MCOL, index)];
 	}
 
 	RNA_pointer_create(&me->id, &RNA_MeshColorLayer, cdl, &ptr);
 	return ptr;
 }
 
-static PointerRNA rna_Mesh_int_property_new(struct Mesh *me, struct bContext *C, const char *name)
+static PointerRNA rna_Mesh_polygon_int_property_new(struct Mesh *me, struct bContext *C, const char *name)
 {
 	PointerRNA ptr;
 	CustomDataLayer *cdl = NULL;
 	int index;
 
-	CustomData_add_layer_named(&me->fdata, CD_PROP_INT, CD_DEFAULT, NULL, me->totface, name);
-	index = CustomData_get_named_layer_index(&me->fdata, CD_PROP_INT, name);
+	CustomData_add_layer_named(&me->pdata, CD_PROP_INT, CD_DEFAULT, NULL, me->totpoly, name);
+	index = CustomData_get_named_layer_index(&me->pdata, CD_PROP_INT, name);
 
-	cdl = (index == -1) ? NULL : &(me->fdata.layers[index]);
+	cdl = (index == -1) ? NULL : &(me->pdata.layers[index]);
 
 	RNA_pointer_create(&me->id, &RNA_MeshIntPropertyLayer, cdl, &ptr);
 	return ptr;
 }
 
-static PointerRNA rna_Mesh_float_property_new(struct Mesh *me, struct bContext *C, const char *name)
+static PointerRNA rna_Mesh_polygon_float_property_new(struct Mesh *me, struct bContext *C, const char *name)
 {
 	PointerRNA ptr;
 	CustomDataLayer *cdl = NULL;
 	int index;
 
-	CustomData_add_layer_named(&me->fdata, CD_PROP_FLT, CD_DEFAULT, NULL, me->totface, name);
-	index = CustomData_get_named_layer_index(&me->fdata, CD_PROP_FLT, name);
+	CustomData_add_layer_named(&me->pdata, CD_PROP_FLT, CD_DEFAULT, NULL, me->totpoly, name);
+	index = CustomData_get_named_layer_index(&me->pdata, CD_PROP_FLT, name);
 
-	cdl = (index == -1) ? NULL : &(me->fdata.layers[index]);
+	cdl = (index == -1) ? NULL : &(me->pdata.layers[index]);
 
 	RNA_pointer_create(&me->id, &RNA_MeshFloatPropertyLayer, cdl, &ptr);
 	return ptr;
 }
 
-static PointerRNA rna_Mesh_string_property_new(struct Mesh *me, struct bContext *C, const char *name)
+static PointerRNA rna_Mesh_polygon_string_property_new(struct Mesh *me, struct bContext *C, const char *name)
 {
 	PointerRNA ptr;
 	CustomDataLayer *cdl = NULL;
 	int index;
 
-	CustomData_add_layer_named(&me->fdata, CD_PROP_STR, CD_DEFAULT, NULL, me->totface, name);
-	index = CustomData_get_named_layer_index(&me->fdata, CD_PROP_STR, name);
+	CustomData_add_layer_named(&me->pdata, CD_PROP_STR, CD_DEFAULT, NULL, me->totpoly, name);
+	index = CustomData_get_named_layer_index(&me->pdata, CD_PROP_STR, name);
 
-	cdl = (index == -1) ? NULL : &(me->fdata.layers[index]);
+	cdl = (index == -1) ? NULL : &(me->pdata.layers[index]);
 
 	RNA_pointer_create(&me->id, &RNA_MeshStringPropertyLayer, cdl, &ptr);
 	return ptr;
@@ -1197,13 +1261,45 @@ static PointerRNA rna_Mesh_string_property_new(struct Mesh *me, struct bContext
 static PointerRNA rna_Mesh_uv_texture_new(struct Mesh *me, struct bContext *C, const char *name)
 {
 	PointerRNA ptr;
+	CustomData *pdata;
+	CustomDataLayer *cdl = NULL;
+	int index = ED_mesh_uv_texture_add(C, me, name, FALSE);
+
+	if (index != -1) {
+		pdata = rna_mesh_pdata_helper(me);
+		cdl = &pdata->layers[CustomData_get_layer_index_n(pdata, CD_MTEXPOLY, index)];
+	}
+
+	RNA_pointer_create(&me->id, &RNA_MeshTexturePolyLayer, cdl, &ptr);
+	return ptr;
+}
+
+/* while this is supposed to be readonly,
+ * keep it to support importers that only make tessfaces */
+
+static PointerRNA rna_Mesh_tessface_uv_texture_new(struct Mesh *me, struct bContext *C, ReportList *reports,
+                                                   const char *name)
+{
+	PointerRNA ptr;
 	CustomData *fdata;
-	CustomDataLayer *cdl= NULL;
-	int index= ED_mesh_uv_texture_add(C, me, name, FALSE);
+	CustomDataLayer *cdl = NULL;
+	int index;
+
+	if (me->edit_btmesh) {
+		BKE_report(reports, RPT_ERROR, "Can't add tessface uv's in editmode");
+		return PointerRNA_NULL;
+	}
+
+	if (me->mpoly) {
+		BKE_report(reports, RPT_ERROR, "Can't add tessface uv's when MPoly's exist");
+		return PointerRNA_NULL;
+	}
+
+	index = ED_mesh_uv_texture_add(C, me, name, FALSE);
 
-	if(index != -1) {
-		fdata= rna_mesh_fdata(me);
-		cdl= &fdata->layers[CustomData_get_layer_index_n(fdata, CD_MTFACE, index)];
+	if (index != -1) {
+		fdata = rna_mesh_fdata_helper(me);
+		cdl = &fdata->layers[CustomData_get_layer_index_n(fdata, CD_MTFACE, index)];
 	}
 
 	RNA_pointer_create(&me->id, &RNA_MeshTextureFaceLayer, cdl, &ptr);
@@ -1217,7 +1313,7 @@ static void rna_def_mvert_group(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "VertexGroupElement", NULL);
+	srna = RNA_def_struct(brna, "VertexGroupElement", NULL);
 	RNA_def_struct_sdna(srna, "MDeformWeight");
 	RNA_def_struct_path_func(srna, "rna_VertexGroupElement_path");
 	RNA_def_struct_ui_text(srna, "Vertex Group Element", "Weight value of a vertex in a vertex group");
@@ -1225,13 +1321,13 @@ static void rna_def_mvert_group(BlenderRNA *brna)
 
 	/* we can't point to actual group, it is in the object and so
 	 * there is no unique group to point to, hence the index */
-	prop= RNA_def_property(srna, "group", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "group", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "def_nr");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Group Index", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Weight", "Vertex Weight");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
@@ -1242,45 +1338,45 @@ static void rna_def_mvert(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "MeshVertex", NULL);
+	srna = RNA_def_struct(brna, "MeshVertex", NULL);
 	RNA_def_struct_sdna(srna, "MVert");
 	RNA_def_struct_ui_text(srna, "Mesh Vertex", "Vertex in a Mesh datablock");
 	RNA_def_struct_path_func(srna, "rna_MeshVertex_path");
 	RNA_def_struct_ui_icon(srna, ICON_VERTEXSEL);
 
-	prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_ui_text(prop, "Location", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION);
-	// RNA_def_property_float_sdna(prop, NULL, "no");
+	prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION);
+	/* RNA_def_property_float_sdna(prop, NULL, "no"); */
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_range(prop, -1.0f, 1.0f);
 	RNA_def_property_float_funcs(prop, "rna_MeshVertex_normal_get", "rna_MeshVertex_normal_set", NULL);
 	RNA_def_property_ui_text(prop, "Normal", "Vertex Normal");
 
-	prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
 	RNA_def_property_ui_text(prop, "Select", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
 
-	prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_HIDE);
 	RNA_def_property_ui_text(prop, "Hide", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
 
-	prop= RNA_def_property(srna, "bevel_weight", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "bevel_weight", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_funcs(prop, "rna_MeshVertex_bevel_weight_get", "rna_MeshVertex_bevel_weight_set", NULL);
 	RNA_def_property_ui_text(prop, "Bevel Weight", "Weight used by the Bevel modifier 'Only Vertices' option");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_funcs(prop, "rna_MeshVertex_groups_begin", "rna_iterator_array_next",
 	                                  "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
 	RNA_def_property_struct_type(prop, "VertexGroupElement");
 	RNA_def_property_ui_text(prop, "Groups", "Weights for the vertex groups this vertex is member of");
 
-	prop= RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_int_funcs(prop, "rna_MeshVertex_index_get", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Index", "Index number of the vertex");
@@ -1291,57 +1387,53 @@ static void rna_def_medge(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "MeshEdge", NULL);
+	srna = RNA_def_struct(brna, "MeshEdge", NULL);
 	RNA_def_struct_sdna(srna, "MEdge");
 	RNA_def_struct_ui_text(srna, "Mesh Edge", "Edge in a Mesh datablock");
 	RNA_def_struct_path_func(srna, "rna_MeshEdge_path");
 	RNA_def_struct_ui_icon(srna, ICON_EDGESEL);
 
-	prop= RNA_def_property(srna, "vertices", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "vertices", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "v1");
 	RNA_def_property_array(prop, 2);
 	RNA_def_property_ui_text(prop, "Vertices", "Vertex indices");
-	// XXX allows creating invalid meshes
+	/* XXX allows creating invalid meshes */
 
-	prop= RNA_def_property(srna, "crease", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "crease", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_funcs(prop, "rna_MEdge_crease_get", "rna_MEdge_crease_set", NULL);
 	RNA_def_property_ui_text(prop, "Crease", "Weight used by the Subsurf modifier for creasing");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "bevel_weight", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "bevel_weight", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_funcs(prop, "rna_MEdge_bevel_weight_get", "rna_MEdge_bevel_weight_set", NULL);
 	RNA_def_property_ui_text(prop, "Bevel Weight", "Weight used by the Bevel modifier");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
 	RNA_def_property_ui_text(prop, "Select", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
 
-	prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_HIDE);
 	RNA_def_property_ui_text(prop, "Hide", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
 
-	prop= RNA_def_property(srna, "use_seam", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_seam", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_SEAM);
 	RNA_def_property_ui_text(prop, "Seam", "Seam edge for UV unwrapping");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
 
-	prop= RNA_def_property(srna, "use_edge_sharp", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_edge_sharp", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_SHARP);
 	RNA_def_property_ui_text(prop, "Sharp", "Sharp edge for the EdgeSplit modifier");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "is_loose", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_loose", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_LOOSEEDGE);
 	RNA_def_property_ui_text(prop, "Loose", "Loose edge");
 
-	prop= RNA_def_property(srna, "is_fgon", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_FGON);
-	RNA_def_property_ui_text(prop, "Fgon", "Fgon edge");
-
-	prop= RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_int_funcs(prop, "rna_MeshEdge_index_get", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Index", "Index number of the vertex");
@@ -1352,158 +1444,294 @@ static void rna_def_mface(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "MeshFace", NULL);
+	srna = RNA_def_struct(brna, "MeshTessFace", NULL);
 	RNA_def_struct_sdna(srna, "MFace");
-	RNA_def_struct_ui_text(srna, "Mesh Face", "Face in a Mesh datablock");
-	RNA_def_struct_path_func(srna, "rna_MeshFace_path");
+	RNA_def_struct_ui_text(srna, "Mesh TessFace", "TessFace in a Mesh datablock");
+	RNA_def_struct_path_func(srna, "rna_MeshTessFace_path");
 	RNA_def_struct_ui_icon(srna, ICON_FACESEL);
 
-	// XXX allows creating invalid meshes
-	prop= RNA_def_property(srna, "vertices", PROP_INT, PROP_UNSIGNED);
+	/* XXX allows creating invalid meshes */
+	prop = RNA_def_property(srna, "vertices", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_flag(prop, PROP_DYNAMIC);
-	RNA_def_property_dynamic_array_funcs(prop, "rna_MeshFace_verts_get_length");
-	RNA_def_property_int_funcs(prop, "rna_MeshFace_verts_get", "rna_MeshFace_verts_set", NULL);
+	RNA_def_property_dynamic_array_funcs(prop, "rna_MeshTessFace_verts_get_length");
+	RNA_def_property_int_funcs(prop, "rna_MeshTessFace_verts_get", "rna_MeshTessFace_verts_set", NULL);
 	RNA_def_property_ui_text(prop, "Vertices", "Vertex indices");
 
 	/* leaving this fixed size array for foreach_set used in import scripts */
-	prop= RNA_def_property(srna, "vertices_raw", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "vertices_raw", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "v1");
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "Vertices", "Fixed size vertex indices array");
 
-	prop= RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "mat_nr");
 	RNA_def_property_ui_text(prop, "Material Index", "");
-	RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MeshFace_material_index_range");
+	RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MeshPoly_material_index_range"); /* reuse for tessface is ok */
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_FACE_SEL);
 	RNA_def_property_ui_text(prop, "Select", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
 
-	prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_HIDE);
 	RNA_def_property_ui_text(prop, "Hide", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
 
-	prop= RNA_def_property(srna, "use_smooth", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_smooth", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_SMOOTH);
 	RNA_def_property_ui_text(prop, "Smooth", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-	
-	prop= RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION);
+
+	prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_range(prop, -1.0f, 1.0f);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_float_funcs(prop, "rna_MeshFace_normal_get", NULL, NULL);
+	RNA_def_property_float_funcs(prop, "rna_MeshTessFace_normal_get", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Face normal", "Local space unit length normal vector for this face");
 
-	prop= RNA_def_property(srna, "area", PROP_FLOAT, PROP_UNSIGNED);
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_float_funcs(prop, "rna_MeshFace_area_get", NULL, NULL);
-	RNA_def_property_ui_text(prop, "Face area", "Read only area of the face");
+	prop = RNA_def_property(srna, "area", PROP_FLOAT, PROP_UNSIGNED);
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+	RNA_def_property_float_funcs(prop, "rna_MeshTessFace_area_get", NULL, NULL);
+	RNA_def_property_ui_text(prop, "Face area", "Read only area of the face");
+
+	prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+	RNA_def_property_int_funcs(prop, "rna_MeshTessFace_index_get", NULL, NULL);
+	RNA_def_property_ui_text(prop, "Index", "Index number of the vertex");
+}
+
+
+static void rna_def_mloop(BlenderRNA *brna)
+{
+	StructRNA *srna;
+	PropertyRNA *prop;
+
+	srna = RNA_def_struct(brna, "MeshLoop", NULL);
+	RNA_def_struct_sdna(srna, "MLoop");
+	RNA_def_struct_ui_text(srna, "Mesh Loop", "Loop in a Mesh datablock");
+	RNA_def_struct_path_func(srna, "rna_MeshLoop_path");
+	RNA_def_struct_ui_icon(srna, ICON_EDGESEL);
+
+	prop = RNA_def_property(srna, "vertex_index", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_int_sdna(prop, NULL, "v");
+	RNA_def_property_ui_text(prop, "Vertex", "Vertex index");
+
+	prop = RNA_def_property(srna, "edge_index", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_int_sdna(prop, NULL, "e");
+	RNA_def_property_ui_text(prop, "Edge", "Edge index");
+
+	prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+	RNA_def_property_int_funcs(prop, "rna_MeshLoop_index_get", NULL, NULL);
+	RNA_def_property_ui_text(prop, "Index", "Index number of the loop");
+}
+
+static void rna_def_mpolygon(BlenderRNA *brna)
+{
+	StructRNA *srna;
+	PropertyRNA *prop;
+
+	srna = RNA_def_struct(brna, "MeshPolygon", NULL);
+	RNA_def_struct_sdna(srna, "MPoly");
+	RNA_def_struct_ui_text(srna, "Mesh Polygon", "Polygon in a Mesh datablock");
+	RNA_def_struct_path_func(srna, "rna_MeshPolygon_path");
+	RNA_def_struct_ui_icon(srna, ICON_FACESEL);
+
+	/* Faked, actually access to loop vertex values, don't this way because manually setting up
+	 * vertex/edge per loop is very low level.
+	 * Instead we setup poly sizes, assign indices, then calc edges automatic when creating
+	 * meshes from rna/py. */
+	prop = RNA_def_property(srna, "vertices", PROP_INT, PROP_UNSIGNED);
+	/* Eek, this is still used in some cases but in fact we don't want to use it at all here. */
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_flag(prop, PROP_DYNAMIC);
+	RNA_def_property_dynamic_array_funcs(prop, "rna_MeshPoly_vertices_get_length");
+	RNA_def_property_int_funcs(prop, "rna_MeshPoly_vertices_get", "rna_MeshPoly_vertices_set", NULL);
+	RNA_def_property_ui_text(prop, "Vertices", "Vertex indices");
+
+	/* these are both very low level access */
+	prop = RNA_def_property(srna, "loop_start", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_int_sdna(prop, NULL, "loopstart");
+	RNA_def_property_ui_text(prop, "Loop Start", "");
+	/* also low level */
+	prop = RNA_def_property(srna, "loop_total", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_int_sdna(prop, NULL, "totloop");
+	RNA_def_property_ui_text(prop, "Loop Total", "");
+
+	prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_int_sdna(prop, NULL, "mat_nr");
+	RNA_def_property_ui_text(prop, "Material Index", "");
+	RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MeshPoly_material_index_range");
+	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_FACE_SEL);
+	RNA_def_property_ui_text(prop, "Select", "");
+	RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
+
+	prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_HIDE);
+	RNA_def_property_ui_text(prop, "Hide", "");
+	RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
+
+	prop = RNA_def_property(srna, "use_smooth", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_SMOOTH);
+	RNA_def_property_ui_text(prop, "Smooth", "");
+	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+	prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION);
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_range(prop, -1.0f, 1.0f);
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+	RNA_def_property_float_funcs(prop, "rna_MeshPolygon_normal_get", NULL, NULL);
+	RNA_def_property_ui_text(prop, "Face normal", "Local space unit length normal vector for this polygon");
+
+	prop = RNA_def_property(srna, "area", PROP_FLOAT, PROP_UNSIGNED);
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+	RNA_def_property_float_funcs(prop, "rna_MeshPolygon_area_get", NULL, NULL);
+	RNA_def_property_ui_text(prop, "Face area", "Read only area of the face");
+
+	prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+	RNA_def_property_int_funcs(prop, "rna_MeshPolygon_index_get", NULL, NULL);
+	RNA_def_property_ui_text(prop, "Index", "Index number of the vertex");
+}
+
+/* mesh.loop_uvs */
+static void rna_def_mloopuv(BlenderRNA *brna)
+{
+	StructRNA *srna;
+	PropertyRNA *prop;
+
+	srna = RNA_def_struct(brna, "MeshUVLoopLayer", NULL);
+	RNA_def_struct_sdna(srna, "CustomDataLayer");
+	RNA_def_struct_path_func(srna, "rna_MeshUVLoopLayer_path");
+
+	prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
+	RNA_def_property_struct_type(prop, "MeshUVLoop");
+	RNA_def_property_collection_funcs(prop, "rna_MeshUVLoopLayer_data_begin", "rna_iterator_array_next",
+	                                  "rna_iterator_array_end", "rna_iterator_array_get",
+	                                  "rna_MeshUVLoopLayer_data_length", NULL, NULL, NULL);
+
+	srna = RNA_def_struct(brna, "MeshUVLoop", NULL);
+	RNA_def_struct_sdna(srna, "MLoopUV");
+	RNA_def_struct_path_func(srna, "rna_MeshUVLoop_path");
+
+	prop = RNA_def_property(srna, "uv", PROP_FLOAT, PROP_XYZ);
+	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+	prop = RNA_def_property(srna, "pin_uv", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", MLOOPUV_PINNED);
+	RNA_def_property_ui_text(prop, "UV Pinned", "");
+
+	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", MLOOPUV_VERTSEL);
+	RNA_def_property_ui_text(prop, "UV Select", "");
 
-	prop= RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_int_funcs(prop, "rna_MeshFace_index_get", NULL, NULL);
-	RNA_def_property_ui_text(prop, "Index", "Index number of the vertex");
+	prop = RNA_def_property(srna, "select_edge", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", MLOOPUV_EDGESEL);
+	RNA_def_property_ui_text(prop, "UV Edge Select", "");
 }
 
 static void rna_def_mtface(BlenderRNA *brna)
 {
 	StructRNA *srna;
 	PropertyRNA *prop;
-	const int uv_dim[]= {4, 2};
+	const int uv_dim[] = {4, 2};
 
-	srna= RNA_def_struct(brna, "MeshTextureFaceLayer", NULL);
+	srna = RNA_def_struct(brna, "MeshTextureFaceLayer", NULL);
 	RNA_def_struct_ui_text(srna, "Mesh UV Map", "UV map with assigned image textures in a Mesh datablock");
 	RNA_def_struct_sdna(srna, "CustomDataLayer");
 	RNA_def_struct_path_func(srna, "rna_MeshTextureFaceLayer_path");
 	RNA_def_struct_ui_icon(srna, ICON_GROUP_UVS);
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_struct_name_property(srna, prop);
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshTextureFaceLayer_name_set");
 	RNA_def_property_ui_text(prop, "Name", "Name of UV map");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_active_get", "rna_MeshTextureFaceLayer_active_set");
 	RNA_def_property_ui_text(prop, "Active", "Set the map as active for display and editing");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "active_rnd", 0);
 	RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_active_render_get",
 	                               "rna_MeshTextureFaceLayer_active_render_set");
 	RNA_def_property_ui_text(prop, "Active Render", "Set the map as active for rendering");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "active_clone", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "active_clone", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "active_clone", 0);
 	RNA_def_property_boolean_funcs(prop, "rna_MeshTextureFaceLayer_clone_get", "rna_MeshTextureFaceLayer_clone_set");
 	RNA_def_property_ui_text(prop, "Active Clone", "Set the map as active for cloning");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "MeshTextureFace");
 	RNA_def_property_ui_text(prop, "Data", "");
 	RNA_def_property_collection_funcs(prop, "rna_MeshTextureFaceLayer_data_begin", "rna_iterator_array_next",
 	                                        "rna_iterator_array_end", "rna_iterator_array_get",
 	                                        "rna_MeshTextureFaceLayer_data_length", NULL, NULL, NULL);
 
-	srna= RNA_def_struct(brna, "MeshTextureFace", NULL);
+	srna = RNA_def_struct(brna, "MeshTextureFace", NULL);
 	RNA_def_struct_sdna(srna, "MTFace");
 	RNA_def_struct_ui_text(srna, "Mesh UV Map Face", "UV map and image texture for a face");
 	RNA_def_struct_path_func(srna, "rna_MeshTextureFace_path");
 	RNA_def_struct_ui_icon(srna, ICON_FACESEL_HLT);
 
-	prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "tpage");
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_TextureFace_image_set", NULL, NULL);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Image", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "select_uv", PROP_BOOLEAN, PROP_NONE);
+	/* these are for editing only, access at loops now */
+#if 0
+	prop = RNA_def_property(srna, "select_uv", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TF_SEL1);
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "UV Selected", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
 
-	prop= RNA_def_property(srna, "pin_uv", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "pin_uv", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "unwrap", TF_PIN1);
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "UV Pinned", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
+#endif
 
-	prop= RNA_def_property(srna, "uv1", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "uv1", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_array(prop, 2);
 	RNA_def_property_float_funcs(prop, "rna_MeshTextureFace_uv1_get", "rna_MeshTextureFace_uv1_set", NULL);
 	RNA_def_property_ui_text(prop, "UV 1", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "uv2", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "uv2", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_array(prop, 2);
 	RNA_def_property_float_funcs(prop, "rna_MeshTextureFace_uv2_get", "rna_MeshTextureFace_uv2_set", NULL);
 	RNA_def_property_ui_text(prop, "UV 2", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "uv3", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "uv3", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_array(prop, 2);
 	RNA_def_property_float_funcs(prop, "rna_MeshTextureFace_uv3_get", "rna_MeshTextureFace_uv3_set", NULL);
 	RNA_def_property_ui_text(prop, "UV 3", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "uv4", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "uv4", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_array(prop, 2);
 	RNA_def_property_float_funcs(prop, "rna_MeshTextureFace_uv4_get", "rna_MeshTextureFace_uv4_set", NULL);
 	RNA_def_property_ui_text(prop, "UV 4", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "uv", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "uv", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_multi_array(prop, 2, uv_dim);
 	RNA_def_property_flag(prop, PROP_DYNAMIC);
 	RNA_def_property_dynamic_array_funcs(prop, "rna_MeshTextureFace_uv_get_length");
@@ -1511,24 +1739,102 @@ static void rna_def_mtface(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "UV", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "uv_raw", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "uv_raw", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_multi_array(prop, 2, uv_dim);
 	RNA_def_property_float_sdna(prop, NULL, "uv");
 	RNA_def_property_ui_text(prop, "UV", "Fixed size UV coordinates array");
 
 }
 
+static void rna_def_mtexpoly(BlenderRNA *brna)
+{
+	StructRNA *srna;
+	PropertyRNA *prop;
+#if 0  /* BMESH_TODO: needed later when do another todo */
+	int uv_dim[] = {4, 2};
+#endif
+
+	srna = RNA_def_struct(brna, "MeshTexturePolyLayer", NULL);
+	RNA_def_struct_ui_text(srna, "Mesh UV Map", "UV map with assigned image textures in a Mesh datablock");
+	RNA_def_struct_sdna(srna, "CustomDataLayer");
+	RNA_def_struct_path_func(srna, "rna_MeshTexturePolyLayer_path");
+	RNA_def_struct_ui_icon(srna, ICON_GROUP_UVS);
+
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	RNA_def_struct_name_property(srna, prop);
+	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshTexturePolyLayer_name_set");
+	RNA_def_property_ui_text(prop, "Name", "Name of UV map");
+	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+	prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_funcs(prop, "rna_MeshTexturePolyLayer_active_get", "rna_MeshTexturePolyLayer_active_set");
+	RNA_def_property_ui_text(prop, "Active", "Set the map as active for display and editing");
+	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+	prop = RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "active_rnd", 0);
+	RNA_def_property_boolean_funcs(prop, "rna_MeshTexturePolyLayer_active_render_get",
+	                               "rna_MeshTexturePolyLayer_active_render_set");
+	RNA_def_property_ui_text(prop, "Active Render", "Set the map as active for rendering");
+	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+	prop = RNA_def_property(srna, "active_clone", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "active_clone", 0);
+	RNA_def_property_boolean_funcs(prop, "rna_MeshTexturePolyLayer_clone_get", "rna_MeshTexturePolyLayer_clone_set");
+	RNA_def_property_ui_text(prop, "Active Clone", "Set the map as active for cloning");
+	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+	prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
+	RNA_def_property_struct_type(prop, "MeshTexturePoly");
+	RNA_def_property_ui_text(prop, "Data", "");
+	RNA_def_property_collection_funcs(prop, "rna_MeshTexturePolyLayer_data_begin", "rna_iterator_array_next",
+	                                  "rna_iterator_array_end", "rna_iterator_array_get",
+	                                  "rna_MeshTexturePolyLayer_data_length", NULL, NULL, NULL);
+
+	srna = RNA_def_struct(brna, "MeshTexturePoly", NULL);
+	RNA_def_struct_sdna(srna, "MTexPoly");
+	RNA_def_struct_ui_text(srna, "Mesh UV Map Face", "UV map and image texture for a face");
+	RNA_def_struct_path_func(srna, "rna_MeshTexturePoly_path");
+	RNA_def_struct_ui_icon(srna, ICON_FACESEL_HLT);
+
+	prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
+	RNA_def_property_pointer_sdna(prop, NULL, "tpage");
+	RNA_def_property_pointer_funcs(prop, NULL, "rna_TexturePoly_image_set", NULL, NULL);
+	RNA_def_property_flag(prop, PROP_EDITABLE);
+	RNA_def_property_ui_text(prop, "Image", "");
+	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+#if 0 /* moved to MeshUVLoopLayer */
+	prop = RNA_def_property(srna, "select_uv", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", TF_SEL1);
+	RNA_def_property_array(prop, 4);
+	RNA_def_property_ui_text(prop, "UV Selected", "");
+	RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
+
+	prop = RNA_def_property(srna, "pin_uv", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "unwrap", TF_PIN1);
+	RNA_def_property_array(prop, 4);
+	RNA_def_property_ui_text(prop, "UV Pinned", "");
+	RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
+
+	prop = RNA_def_property(srna, "uv_raw", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_multi_array(prop, 2, uv_dim);
+	RNA_def_property_float_sdna(prop, NULL, "uv");
+	RNA_def_property_ui_text(prop, "UV", "Fixed size UV coordinates array");
+#endif
+}
+
 static void rna_def_msticky(BlenderRNA *brna)
 {
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "MeshSticky", NULL);
+	srna = RNA_def_struct(brna, "MeshSticky", NULL);
 	RNA_def_struct_sdna(srna, "MSticky");
 	RNA_def_struct_ui_text(srna, "Mesh Vertex Sticky Texture Coordinate", "Stricky texture coordinate");
 	RNA_def_struct_path_func(srna, "rna_MeshSticky_path");
 
-	prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_ui_text(prop, "Location", "Sticky texture coordinate location");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 }
@@ -1538,63 +1844,64 @@ static void rna_def_mcol(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "MeshColorLayer", NULL);
+	srna = RNA_def_struct(brna, "MeshColorLayer", NULL);
 	RNA_def_struct_ui_text(srna, "Mesh Vertex Color Layer", "Layer of vertex colors in a Mesh datablock");
 	RNA_def_struct_sdna(srna, "CustomDataLayer");
 	RNA_def_struct_path_func(srna, "rna_MeshColorLayer_path");
 	RNA_def_struct_ui_icon(srna, ICON_GROUP_VCOL);
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_struct_name_property(srna, prop);
-	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshColorLayer_name_set");
+	RNA_def_property_string_funcs(prop, NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Name", "Name of Vertex color layer");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_MeshColorLayer_active_get", "rna_MeshColorLayer_active_set");
 	RNA_def_property_ui_text(prop, "Active", "Sets the layer as active for display and editing");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "active_rnd", 0);
-	RNA_def_property_boolean_funcs(prop, "rna_MeshColorLayer_active_render_get", "rna_MeshColorLayer_active_render_set");
+	RNA_def_property_boolean_funcs(prop, "rna_MeshColorLayer_active_render_get",
+	                               "rna_MeshColorLayer_active_render_set");
 	RNA_def_property_ui_text(prop, "Active Render", "Sets the layer as active for rendering");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "MeshColor");
 	RNA_def_property_ui_text(prop, "Data", "");
 	RNA_def_property_collection_funcs(prop, "rna_MeshColorLayer_data_begin", "rna_iterator_array_next",
 	                                  "rna_iterator_array_end", "rna_iterator_array_get",
 	                                  "rna_MeshColorLayer_data_length", NULL, NULL, NULL);
 
-	srna= RNA_def_struct(brna, "MeshColor", NULL);
+	srna = RNA_def_struct(brna, "MeshColor", NULL);
 	RNA_def_struct_sdna(srna, "MCol");
 	RNA_def_struct_ui_text(srna, "Mesh Vertex Color", "Vertex colors for a face in a Mesh");
 	RNA_def_struct_path_func(srna, "rna_MeshColor_path");
 
-	prop= RNA_def_property(srna, "color1", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "color1", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_float_funcs(prop, "rna_MeshColor_color1_get", "rna_MeshColor_color1_set", NULL);
 	RNA_def_property_ui_text(prop, "Color 1", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "color2", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "color2", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_float_funcs(prop, "rna_MeshColor_color2_get", "rna_MeshColor_color2_set", NULL);
 	RNA_def_property_ui_text(prop, "Color 2", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "color3", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "color3", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_float_funcs(prop, "rna_MeshColor_color3_get", "rna_MeshColor_color3_set", NULL);
 	RNA_def_property_ui_text(prop, "Color 3", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "color4", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "color4", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_float_funcs(prop, "rna_MeshColor_color4_get", "rna_MeshColor_color4_set", NULL);
@@ -1602,116 +1909,209 @@ static void rna_def_mcol(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 }
 
+static void rna_def_mloopcol(BlenderRNA *brna)
+{
+	StructRNA *srna;
+	PropertyRNA *prop;
+
+	srna = RNA_def_struct(brna, "MeshLoopColorLayer", NULL);
+	RNA_def_struct_ui_text(srna, "Mesh Vertex Color Layer", "Layer of vertex colors in a Mesh datablock");
+	RNA_def_struct_sdna(srna, "CustomDataLayer");
+	RNA_def_struct_path_func(srna, "rna_MeshLoopColorLayer_path");
+	RNA_def_struct_ui_icon(srna, ICON_GROUP_VCOL);
+
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	RNA_def_struct_name_property(srna, prop);
+	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshLoopColorLayer_name_set");
+	RNA_def_property_ui_text(prop, "Name", "Name of Vertex color layer");
+	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+	prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_funcs(prop, "rna_MeshLoopColorLayer_active_get", "rna_MeshLoopColorLayer_active_set");
+	RNA_def_property_ui_text(prop, "Active", "Sets the layer as active for display and editing");
+	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+	prop = RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "active_rnd", 0);
+	RNA_def_property_boolean_funcs(prop, "rna_MeshLoopColorLayer_active_render_get",
+	                               "rna_MeshLoopColorLayer_active_render_set");
+	RNA_def_property_ui_text(prop, "Active Render", "Sets the layer as active for rendering");
+	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+	prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
+	RNA_def_property_struct_type(prop, "MeshLoopColor");
+	RNA_def_property_ui_text(prop, "Data", "");
+	RNA_def_property_collection_funcs(prop, "rna_MeshLoopColorLayer_data_begin", "rna_iterator_array_next",
+	                                  "rna_iterator_array_end", "rna_iterator_array_get",
+	                                  "rna_MeshLoopColorLayer_data_length", NULL, NULL, NULL);
+
+
+	srna = RNA_def_struct(brna, "MeshLoopColor", NULL);
+	RNA_def_struct_sdna(srna, "MLoopCol");
+	RNA_def_struct_ui_text(srna, "Mesh Vertex Color", "Vertex loop colors in a Mesh");
+	RNA_def_struct_path_func(srna, "rna_MeshColor_path");
+
+	prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_range(prop, 0.0f, 1.0f);
+	RNA_def_property_float_funcs(prop, "rna_MeshLoopColor_color_get", "rna_MeshLoopColor_color_set", NULL);
+	RNA_def_property_ui_text(prop, "Color", "");
+	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+}
+
 static void rna_def_mproperties(BlenderRNA *brna)
 {
 	StructRNA *srna;
 	PropertyRNA *prop;
 
 	/* Float */
-	srna= RNA_def_struct(brna, "MeshFloatPropertyLayer", NULL);
+	srna = RNA_def_struct(brna, "MeshFloatPropertyLayer", NULL);
 	RNA_def_struct_sdna(srna, "CustomDataLayer");
-	RNA_def_struct_ui_text(srna, "Mesh Float Property Layer", "User defined layer of floating pointer number values");
+	RNA_def_struct_ui_text(srna, "Mesh Float Property Layer", "User defined layer of floating point number values");
 	RNA_def_struct_path_func(srna, "rna_MeshFloatPropertyLayer_path");
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_struct_name_property(srna, prop);
 	RNA_def_property_ui_text(prop, "Name", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "MeshFloatProperty");
 	RNA_def_property_ui_text(prop, "Data", "");
 	RNA_def_property_collection_funcs(prop, "rna_MeshFloatPropertyLayer_data_begin", "rna_iterator_array_next",
 	                                  "rna_iterator_array_end", "rna_iterator_array_get",
 	                                  "rna_MeshFloatPropertyLayer_data_length", NULL, NULL, NULL);
 
-	srna= RNA_def_struct(brna, "MeshFloatProperty", NULL);
+	srna = RNA_def_struct(brna, "MeshFloatProperty", NULL);
 	RNA_def_struct_sdna(srna, "MFloatProperty");
-	RNA_def_struct_ui_text(srna, "Mesh Float Property", "User defined floating point number value in a float properties layer");
+	RNA_def_struct_ui_text(srna, "Mesh Float Property",
+	                       "User defined floating point number value in a float properties layer");
 	RNA_def_struct_path_func(srna, "rna_MeshFloatProperty_path");
 
-	prop= RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "f");
 	RNA_def_property_ui_text(prop, "Value", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
 	/* Int */
-	srna= RNA_def_struct(brna, "MeshIntPropertyLayer", NULL);
+	srna = RNA_def_struct(brna, "MeshIntPropertyLayer", NULL);
 	RNA_def_struct_sdna(srna, "CustomDataLayer");
 	RNA_def_struct_ui_text(srna, "Mesh Int Property Layer", "User defined layer of integer number values");
 	RNA_def_struct_path_func(srna, "rna_MeshIntPropertyLayer_path");
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_struct_name_property(srna, prop);
 	RNA_def_property_ui_text(prop, "Name", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "MeshIntProperty");
 	RNA_def_property_ui_text(prop, "Data", "");
 	RNA_def_property_collection_funcs(prop, "rna_MeshIntPropertyLayer_data_begin", "rna_iterator_array_next",
 	                                  "rna_iterator_array_end", "rna_iterator_array_get",
 	                                  "rna_MeshIntPropertyLayer_data_length", NULL, NULL, NULL);
 
-	srna= RNA_def_struct(brna, "MeshIntProperty", NULL);
+	srna = RNA_def_struct(brna, "MeshIntProperty", NULL);
 	RNA_def_struct_sdna(srna, "MIntProperty");
-	RNA_def_struct_ui_text(srna, "Mesh Int Property", "User defined integer number value in an integer properties layer");
+	RNA_def_struct_ui_text(srna, "Mesh Int Property",
+	                       "User defined integer number value in an integer properties layer");
 	RNA_def_struct_path_func(srna, "rna_MeshIntProperty_path");
 
-	prop= RNA_def_property(srna, "value", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "value", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "i");
 	RNA_def_property_ui_text(prop, "Value", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
 	/* String */
-	srna= RNA_def_struct(brna, "MeshStringPropertyLayer", NULL);
+	srna = RNA_def_struct(brna, "MeshStringPropertyLayer", NULL);
 	RNA_def_struct_sdna(srna, "CustomDataLayer");
 	RNA_def_struct_ui_text(srna, "Mesh String Property Layer", "User defined layer of string text values");
 	RNA_def_struct_path_func(srna, "rna_MeshStringPropertyLayer_path");
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_struct_name_property(srna, prop);
 	RNA_def_property_ui_text(prop, "Name", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "MeshStringProperty");
 	RNA_def_property_ui_text(prop, "Data", "");
 	RNA_def_property_collection_funcs(prop, "rna_MeshStringPropertyLayer_data_begin", "rna_iterator_array_next",
 	                                  "rna_iterator_array_end", "rna_iterator_array_get",
 	                                  "rna_MeshStringPropertyLayer_data_length", NULL, NULL, NULL);
 
-	srna= RNA_def_struct(brna, "MeshStringProperty", NULL);
+	srna = RNA_def_struct(brna, "MeshStringProperty", NULL);
 	RNA_def_struct_sdna(srna, "MStringProperty");
-	RNA_def_struct_ui_text(srna, "Mesh String Property", "User defined string text value in a string properties layer");
+	RNA_def_struct_ui_text(srna, "Mesh String Property",
+	                       "User defined string text value in a string properties layer");
 	RNA_def_struct_path_func(srna, "rna_MeshStringProperty_path");
 
 	/* low level mesh data access, treat as bytes */
-	prop= RNA_def_property(srna, "value", PROP_STRING, PROP_BYTESTRING);
+	prop = RNA_def_property(srna, "value", PROP_STRING, PROP_BYTESTRING);
 	RNA_def_property_string_sdna(prop, NULL, "s");
 	RNA_def_property_ui_text(prop, "Value", "");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 }
 
+void rna_def_texmat_common(StructRNA *srna, const char *texspace_editable)
+{
+	PropertyRNA *prop;
+
+	/* texture space */
+	prop = RNA_def_property(srna, "auto_texspace", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "texflag", ME_AUTOSPACE);
+	RNA_def_property_ui_text(prop, "Auto Texture Space",
+	                         "Adjust active object's texture space automatically when transforming object");
+
+	prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
+	RNA_def_property_float_sdna(prop, NULL, "loc");
+	RNA_def_property_ui_text(prop, "Texure Space Location", "Texture space location");
+	RNA_def_property_editable_func(prop, texspace_editable);
+	RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+
+	prop = RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
+	RNA_def_property_float_sdna(prop, NULL, "size");
+	RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space size");
+	RNA_def_property_editable_func(prop, texspace_editable);
+	RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+
+	/* not supported yet
+	prop = RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER);
+	RNA_def_property_float(prop, NULL, "rot");
+	RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation");
+	RNA_def_property_editable_func(prop, texspace_editable);
+	RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");*/
+
+	/* materials */
+	prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
+	RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
+	RNA_def_property_struct_type(prop, "Material");
+	RNA_def_property_ui_text(prop, "Materials", "");
+	RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
+	RNA_def_property_collection_funcs(prop, 0, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
+}
+
+
+/* scene.objects */
 /* mesh.vertices */
 static void rna_def_mesh_vertices(BlenderRNA *brna, PropertyRNA *cprop)
 {
 	StructRNA *srna;
-//	PropertyRNA *prop;
+/*	PropertyRNA *prop; */
 
 	FunctionRNA *func;
-//	PropertyRNA *parm;
+/*	PropertyRNA *parm; */
 
 	RNA_def_property_srna(cprop, "MeshVertices");
-	srna= RNA_def_struct(brna, "MeshVertices", NULL);
+	srna = RNA_def_struct(brna, "MeshVertices", NULL);
 	RNA_def_struct_sdna(srna, "Mesh");
 	RNA_def_struct_ui_text(srna, "Mesh Vertices", "Collection of mesh vertices");
 
-	func= RNA_def_function(srna, "add", "ED_mesh_vertices_add");
+	func = RNA_def_function(srna, "add", "ED_mesh_vertices_add");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of vertices to add", 0, INT_MAX);
-#if 0 // Remove until BMesh merge
-	func= RNA_def_function(srna, "remove", "ED_mesh_vertices_remove");
+#if 0 /* BMESH_TODO Remove until BMesh merge */
+	func = RNA_def_function(srna, "remove", "ED_mesh_vertices_remove");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of vertices to remove", 0, INT_MAX);
 #endif
@@ -1721,62 +2121,101 @@ static void rna_def_mesh_vertices(BlenderRNA *brna, PropertyRNA *cprop)
 static void rna_def_mesh_edges(BlenderRNA *brna, PropertyRNA *cprop)
 {
 	StructRNA *srna;
-//	PropertyRNA *prop;
+/*	PropertyRNA *prop; */
 
 	FunctionRNA *func;
-//	PropertyRNA *parm;
+/*	PropertyRNA *parm; */
 
 	RNA_def_property_srna(cprop, "MeshEdges");
-	srna= RNA_def_struct(brna, "MeshEdges", NULL);
+	srna = RNA_def_struct(brna, "MeshEdges", NULL);
 	RNA_def_struct_sdna(srna, "Mesh");
 	RNA_def_struct_ui_text(srna, "Mesh Edges", "Collection of mesh edges");
 
-	func= RNA_def_function(srna, "add", "ED_mesh_edges_add");
+	func = RNA_def_function(srna, "add", "ED_mesh_edges_add");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of edges to add", 0, INT_MAX);
-#if 0 // Remove until BMesh merge
-	func= RNA_def_function(srna, "remove", "ED_mesh_edges_remove");
+#if 0 /* BMESH_TODO Remove until BMesh merge */
+	func = RNA_def_function(srna, "remove", "ED_mesh_edges_remove");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of edges to remove", 0, INT_MAX);
 #endif
 }
 
 /* mesh.faces */
-static void rna_def_mesh_faces(BlenderRNA *brna, PropertyRNA *cprop)
+static void rna_def_mesh_tessfaces(BlenderRNA *brna, PropertyRNA *cprop)
 {
 	StructRNA *srna;
 	PropertyRNA *prop;
 
 	FunctionRNA *func;
-	/*PropertyRNA *parm;*/
+/*	PropertyRNA *parm; */
 
-	RNA_def_property_srna(cprop, "MeshFaces");
-	srna= RNA_def_struct(brna, "MeshFaces", NULL);
+	RNA_def_property_srna(cprop, "MeshTessFaces");
+	srna = RNA_def_struct(brna, "MeshTessFaces", NULL);
 	RNA_def_struct_sdna(srna, "Mesh");
 	RNA_def_struct_ui_text(srna, "Mesh Faces", "Collection of mesh faces");
 
-	prop= RNA_def_property(srna, "active", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "act_face");
 	RNA_def_property_ui_text(prop, "Active Face", "The active face for this mesh");
 
-	prop= RNA_def_property(srna, "active_tface", PROP_POINTER, PROP_UNSIGNED);
-	RNA_def_property_struct_type(prop, "MeshTextureFace");
-	RNA_def_property_pointer_funcs(prop, "rna_Mesh_active_mtface_get", NULL, NULL, NULL);
-	RNA_def_property_ui_text(prop, "Active UV Map Face", "Active UV Map Face");
-	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
-	func= RNA_def_function(srna, "add", "ED_mesh_faces_add");
+	func = RNA_def_function(srna, "add", "ED_mesh_tessfaces_add");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of faces to add", 0, INT_MAX);
-#if 0 // Remove until BMesh merge
-	func= RNA_def_function(srna, "remove", "ED_mesh_faces_remove");
+#if 0 /* BMESH_TODO Remove until BMesh merge */
+	func = RNA_def_function(srna, "remove", "ED_mesh_faces_remove");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of faces to remove", 0, INT_MAX);
 #endif
 }
 
+/* mesh.loops */
+static void rna_def_mesh_loops(BlenderRNA *brna, PropertyRNA *cprop)
+{
+	StructRNA *srna;
+
+	/*PropertyRNA *prop;*/
+
+	FunctionRNA *func;
+	/*PropertyRNA *parm;*/
+
+	RNA_def_property_srna(cprop, "MeshLoops");
+	srna = RNA_def_struct(brna, "MeshLoops", NULL);
+	RNA_def_struct_sdna(srna, "Mesh");
+	RNA_def_struct_ui_text(srna, "Mesh Loops", "Collection of mesh loops");
+
+	func = RNA_def_function(srna, "add", "ED_mesh_loops_add");
+	RNA_def_function_flag(func, FUNC_USE_REPORTS);
+	RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of loops to add", 0, INT_MAX);
+}
+
+/* mesh.polygons */
+static void rna_def_mesh_polygons(BlenderRNA *brna, PropertyRNA *cprop)
+{
+	StructRNA *srna;
+
+	PropertyRNA *prop;
+
+	FunctionRNA *func;
+	/* PropertyRNA *parm; */
+
+	RNA_def_property_srna(cprop, "MeshPolygons");
+	srna = RNA_def_struct(brna, "MeshPolygons", NULL);
+	RNA_def_struct_sdna(srna, "Mesh");
+	RNA_def_struct_ui_text(srna, "Mesh Polygons", "Collection of mesh polygons");
+
+	prop = RNA_def_property(srna, "active", PROP_INT, PROP_NONE);
+	RNA_def_property_int_sdna(prop, NULL, "act_face");
+	RNA_def_property_ui_text(prop, "Active Polygon", "The active polygon for this mesh");
+
+	func = RNA_def_function(srna, "add", "ED_mesh_polys_add");
+	RNA_def_function_flag(func, FUNC_USE_REPORTS);
+	RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of polygons to add", 0, INT_MAX);
+}
+
+
 /* mesh.vertex_colors */
-static void rna_def_vertex_colors(BlenderRNA *brna, PropertyRNA *cprop)
+static void rna_def_tessface_vertex_colors(BlenderRNA *brna, PropertyRNA *cprop)
 {
 	StructRNA *srna;
 	PropertyRNA *prop;
@@ -1785,40 +2224,106 @@ static void rna_def_vertex_colors(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, "VertexColors");
-	srna= RNA_def_struct(brna, "VertexColors", NULL);
+	srna = RNA_def_struct(brna, "VertexColors", NULL);
 	RNA_def_struct_sdna(srna, "Mesh");
 	RNA_def_struct_ui_text(srna, "Vertex Colors", "Collection of vertex colors");
-	
-	func= RNA_def_function(srna, "new", "rna_Mesh_vertex_color_new");
+
+	/* eventually deprecate this */
+	func = RNA_def_function(srna, "new", "rna_Mesh_tessface_vertex_color_new");
+	RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+	RNA_def_function_ui_description(func, "Add a vertex color layer to Mesh");
+	RNA_def_string(func, "name", "Col", 0, "", "Vertex color name");
+	parm = RNA_def_pointer(func, "layer", "MeshColorLayer", "", "The newly created layer");
+	RNA_def_property_flag(parm, PROP_RNAPTR);
+	RNA_def_function_return(func, parm);
+
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
+	RNA_def_property_struct_type(prop, "MeshColorLayer");
+	RNA_def_property_pointer_funcs(prop, "rna_Mesh_tessface_vertex_color_active_get",
+	                               "rna_Mesh_tessface_vertex_color_active_set", NULL, NULL);
+	RNA_def_property_ui_text(prop, "Active Vertex Color Layer", "Active vertex color layer");
+	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+	prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_int_funcs(prop, "rna_Mesh_tessface_vertex_color_active_index_get",
+	                           "rna_Mesh_tessface_vertex_color_active_index_set", "rna_Mesh_vertex_color_index_range");
+	RNA_def_property_ui_text(prop, "Active Vertex Color Index", "Active vertex color index");
+	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+}
+
+static void rna_def_loop_colors(BlenderRNA *brna, PropertyRNA *cprop)
+{
+	StructRNA *srna;
+	PropertyRNA *prop;
+
+	FunctionRNA *func;
+	PropertyRNA *parm;
+
+	RNA_def_property_srna(cprop, "LoopColors");
+	srna = RNA_def_struct(brna, "LoopColors", NULL);
+	RNA_def_struct_sdna(srna, "Mesh");
+	RNA_def_struct_ui_text(srna, "Loop Colors", "Collection of vertex colors");
+
+	func = RNA_def_function(srna, "new", "rna_Mesh_vertex_color_new");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
 	RNA_def_function_ui_description(func, "Add a vertex color layer to Mesh");
 	RNA_def_string(func, "name", "Col", 0, "", "Vertex color name");
-	parm= RNA_def_pointer(func, "layer", "MeshColorLayer", "", "The newly created layer");
+	parm = RNA_def_pointer(func, "layer", "MeshLoopColorLayer", "", "The newly created layer");
 	RNA_def_property_flag(parm, PROP_RNAPTR);
 	RNA_def_function_return(func, parm);
-	
+
 /*
-	func= RNA_def_function(srna, "remove", "rna_Mesh_vertex_color_remove");
+	func = RNA_def_function(srna, "remove", "rna_Mesh_vertex_color_remove");
 	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");
+	parm = RNA_def_pointer(func, "layer", "Layer", "", "The layer to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 */
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
-	RNA_def_property_struct_type(prop, "MeshColorLayer");
-	RNA_def_property_pointer_funcs(prop, "rna_Mesh_active_vertex_color_get", "rna_Mesh_active_vertex_color_set", NULL, NULL);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
+	RNA_def_property_struct_type(prop, "MeshLoopColorLayer");
+	RNA_def_property_pointer_funcs(prop, "rna_Mesh_vertex_color_active_get",
+	                               "rna_Mesh_vertex_color_active_set", NULL, NULL);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Active Vertex Color Layer", "Active vertex color layer");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-	
-	prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
-	RNA_def_property_int_funcs(prop, "rna_Mesh_active_vertex_color_index_get", "rna_Mesh_active_vertex_color_index_set", "rna_Mesh_active_vertex_color_index_range");
+
+	prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_int_funcs(prop, "rna_Mesh_vertex_color_active_index_get",
+	                           "rna_Mesh_vertex_color_active_index_set", "rna_Mesh_vertex_color_index_range");
 	RNA_def_property_ui_text(prop, "Active Vertex Color Index", "Active vertex color index");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 }
 
+static void rna_def_uv_layers(BlenderRNA *brna, PropertyRNA *cprop)
+{
+	StructRNA *srna;
+	PropertyRNA *prop;
+
+	/* FunctionRNA *func; */
+	/* PropertyRNA *parm; */
+
+	RNA_def_property_srna(cprop, "UVLoopLayers");
+	srna = RNA_def_struct(brna, "UVLoopLayers", NULL);
+	RNA_def_struct_sdna(srna, "Mesh");
+	RNA_def_struct_ui_text(srna, "UV Loop Layers", "Collection of uv loop layers");
+
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
+	RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
+	RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_layer_active_get",
+	                               "rna_Mesh_uv_layer_active_set", NULL, NULL);
+	RNA_def_property_flag(prop, PROP_EDITABLE);
+	RNA_def_property_ui_text(prop, "Active UV loop layer", "Active UV loop layer");
+	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+	prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_int_funcs(prop, "rna_Mesh_uv_layer_active_index_get",
+	                           "rna_Mesh_uv_layer_active_index_set", "rna_Mesh_uv_layer_index_range");
+	RNA_def_property_ui_text(prop, "Active UV loop layer Index", "Active UV loop layer index");
+	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+}
+
 /* mesh int layers */
-static void rna_def_int_layers(BlenderRNA *brna, PropertyRNA *cprop)
+static void rna_def_polygon_int_layers(BlenderRNA *brna, PropertyRNA *cprop)
 {
 	StructRNA *srna;
 
@@ -1826,21 +2331,21 @@ static void rna_def_int_layers(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, "IntProperties");
-	srna= RNA_def_struct(brna, "IntProperties", NULL);
+	srna = RNA_def_struct(brna, "IntProperties", NULL);
 	RNA_def_struct_sdna(srna, "Mesh");
 	RNA_def_struct_ui_text(srna, "Int Properties", "Collection of int properties");
 
-	func= RNA_def_function(srna, "new", "rna_Mesh_int_property_new");
+	func = RNA_def_function(srna, "new", "rna_Mesh_polygon_int_property_new");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
 	RNA_def_function_ui_description(func, "Add a integer property layer to Mesh");
 	RNA_def_string(func, "name", "Int Prop", 0, "",  "Int property name");
-	parm= RNA_def_pointer(func, "layer", "MeshIntPropertyLayer", "", "The newly created layer");
+	parm = RNA_def_pointer(func, "layer", "MeshIntPropertyLayer", "", "The newly created layer");
 	RNA_def_property_flag(parm, PROP_RNAPTR);
 	RNA_def_function_return(func, parm);
 }
 
 /* mesh float layers */
-static void rna_def_float_layers(BlenderRNA *brna, PropertyRNA *cprop)
+static void rna_def_polygon_float_layers(BlenderRNA *brna, PropertyRNA *cprop)
 {
 	StructRNA *srna;
 
@@ -1848,21 +2353,21 @@ static void rna_def_float_layers(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, "FloatProperties");
-	srna= RNA_def_struct(brna, "FloatProperties", NULL);
+	srna = RNA_def_struct(brna, "FloatProperties", NULL);
 	RNA_def_struct_sdna(srna, "Mesh");
 	RNA_def_struct_ui_text(srna, "Float Properties", "Collection of float properties");
 
-	func= RNA_def_function(srna, "new", "rna_Mesh_float_property_new");
+	func = RNA_def_function(srna, "new", "rna_Mesh_polygon_float_property_new");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
 	RNA_def_function_ui_description(func, "Add a float property layer to Mesh");
 	RNA_def_string(func, "name", "Float Prop", 0, "", "Float property name");
-	parm= RNA_def_pointer(func, "layer", "MeshFloatPropertyLayer", "", "The newly created layer");
+	parm = RNA_def_pointer(func, "layer", "MeshFloatPropertyLayer", "", "The newly created layer");
 	RNA_def_property_flag(parm, PROP_RNAPTR);
 	RNA_def_function_return(func, parm);
 }
 
 /* mesh string layers */
-static void rna_def_string_layers(BlenderRNA *brna, PropertyRNA *cprop)
+static void rna_def_polygon_string_layers(BlenderRNA *brna, PropertyRNA *cprop)
 {
 	StructRNA *srna;
 
@@ -1870,20 +2375,58 @@ static void rna_def_string_layers(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, "StringProperties");
-	srna= RNA_def_struct(brna, "StringProperties", NULL);
+	srna = RNA_def_struct(brna, "StringProperties", NULL);
 	RNA_def_struct_sdna(srna, "Mesh");
 	RNA_def_struct_ui_text(srna, "String Properties", "Collection of string properties");
 
-	func= RNA_def_function(srna, "new", "rna_Mesh_string_property_new");
+	func = RNA_def_function(srna, "new", "rna_Mesh_polygon_string_property_new");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
 	RNA_def_function_ui_description(func, "Add a string property layer to Mesh");
 	RNA_def_string(func, "name", "String Prop", 0, "", "String property name");
-	parm= RNA_def_pointer(func, "layer", "MeshStringPropertyLayer", "", "The newly created layer");
+	parm = RNA_def_pointer(func, "layer", "MeshStringPropertyLayer", "", "The newly created layer");
+	RNA_def_property_flag(parm, PROP_RNAPTR);
+	RNA_def_function_return(func, parm);
+}
+
+/* mesh.tessface_uv_layers */
+static void rna_def_tessface_uv_textures(BlenderRNA *brna, PropertyRNA *cprop)
+{
+	StructRNA *srna;
+	PropertyRNA *prop;
+
+	FunctionRNA *func;
+	PropertyRNA *parm;
+
+	RNA_def_property_srna(cprop, "TessfaceUVTextures");
+	srna = RNA_def_struct(brna, "TessfaceUVTextures", NULL);
+	RNA_def_struct_sdna(srna, "Mesh");
+	RNA_def_struct_ui_text(srna, "UV Maps", "Collection of UV maps for tessellated faces");
+
+	/* eventually deprecate this */
+	func = RNA_def_function(srna, "new", "rna_Mesh_tessface_uv_texture_new");
+	RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+	RNA_def_function_ui_description(func, "Add a UV tessface-texture layer to Mesh (only for meshes with no polygons)");
+	RNA_def_string(func, "name", "UVMap", 0, "", "UV map name");
+	parm = RNA_def_pointer(func, "layer", "MeshTextureFaceLayer", "", "The newly created layer");
 	RNA_def_property_flag(parm, PROP_RNAPTR);
 	RNA_def_function_return(func, parm);
+
+
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
+	RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
+	RNA_def_property_pointer_funcs(prop, "rna_Mesh_tessface_uv_texture_active_get",
+	                               "rna_Mesh_tessface_uv_texture_active_set", NULL, NULL);
+	RNA_def_property_ui_text(prop, "Active UV Map", "Active UV Map");
+	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+	prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_int_funcs(prop, "rna_Mesh_tessface_uv_texture_active_index_get",
+	                           "rna_Mesh_tessface_uv_texture_active_index_set", "rna_Mesh_uv_texture_index_range");
+	RNA_def_property_ui_text(prop, "Active UV Map Index", "Active UV Map index");
+	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 }
 
-/* mesh.uv_layers */
+
 static void rna_def_uv_textures(BlenderRNA *brna, PropertyRNA *cprop)
 {
 	StructRNA *srna;
@@ -1893,35 +2436,36 @@ static void rna_def_uv_textures(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, "UVTextures");
-	srna= RNA_def_struct(brna, "UVTextures", NULL);
+	srna = RNA_def_struct(brna, "UVTextures", NULL);
 	RNA_def_struct_sdna(srna, "Mesh");
 	RNA_def_struct_ui_text(srna, "UV Maps", "Collection of UV maps");
-	
-	func= RNA_def_function(srna, "new", "rna_Mesh_uv_texture_new");
+
+	func = RNA_def_function(srna, "new", "rna_Mesh_uv_texture_new");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
-	RNA_def_function_ui_description(func, "Add a UV texture layer to Mesh");
+	RNA_def_function_ui_description(func, "Add a UV map layer to Mesh");
 	RNA_def_string(func, "name", "UVMap", 0, "", "UV map name");
-	parm= RNA_def_pointer(func, "layer", "MeshTextureFaceLayer", "", "The newly created layer");
+	parm = RNA_def_pointer(func, "layer", "MeshTexturePolyLayer", "", "The newly created layer");
 	RNA_def_property_flag(parm, PROP_RNAPTR);
 	RNA_def_function_return(func, parm);
 
 /*
-	func= RNA_def_function(srna, "remove", "rna_Mesh_uv_layers_remove");
+	func = RNA_def_function(srna, "remove", "rna_Mesh_uv_texture_layers_remove");
 	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");
+	parm = RNA_def_pointer(func, "layer", "Layer", "", "The layer to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 */
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
-	RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
-	RNA_def_property_pointer_funcs(prop, "rna_Mesh_active_uv_texture_get", "rna_Mesh_active_uv_texture_set", NULL, NULL);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
+	RNA_def_property_struct_type(prop, "MeshTexturePolyLayer");
+	RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_texture_active_get",
+	                               "rna_Mesh_uv_texture_active_set", NULL, NULL);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Active UV Map", "Active UV Map");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
-	RNA_def_property_int_funcs(prop, "rna_Mesh_active_uv_texture_index_get",
-	                           "rna_Mesh_active_uv_texture_index_set", "rna_Mesh_active_uv_texture_index_range");
+	prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_int_funcs(prop, "rna_Mesh_uv_texture_active_index_get",
+	                           "rna_Mesh_uv_texture_active_index_set", "rna_Mesh_uv_texture_index_range");
 	RNA_def_property_ui_text(prop, "Active UV Map Index", "Active UV Map index");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 }
@@ -1931,293 +2475,351 @@ static void rna_def_mesh(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "Mesh", "ID");
+	srna = RNA_def_struct(brna, "Mesh", "ID");
 	RNA_def_struct_ui_text(srna, "Mesh", "Mesh datablock defining geometric surfaces");
 	RNA_def_struct_ui_icon(srna, ICON_MESH_DATA);
 
-	prop= RNA_def_property(srna, "vertices", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "vertices", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "mvert", "totvert");
 	RNA_def_property_struct_type(prop, "MeshVertex");
 	RNA_def_property_ui_text(prop, "Vertices", "Vertices of the mesh");
 	rna_def_mesh_vertices(brna, prop);
 
-	prop= RNA_def_property(srna, "edges", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "edges", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "medge", "totedge");
 	RNA_def_property_struct_type(prop, "MeshEdge");
 	RNA_def_property_ui_text(prop, "Edges", "Edges of the mesh");
 	rna_def_mesh_edges(brna, prop);
 
-	prop= RNA_def_property(srna, "faces", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "tessfaces", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "mface", "totface");
-	RNA_def_property_struct_type(prop, "MeshFace");
-	RNA_def_property_ui_text(prop, "Faces", "Faces of the mesh");
-	rna_def_mesh_faces(brna, prop);
-
-	prop= RNA_def_property(srna, "sticky", PROP_COLLECTION, PROP_NONE);
+	RNA_def_property_struct_type(prop, "MeshTessFace");
+	RNA_def_property_ui_text(prop, "TessFaces", "Tessellation faces of the mesh (derived from polygons)");
+	rna_def_mesh_tessfaces(brna, prop);
+
+	prop = RNA_def_property(srna, "loops", PROP_COLLECTION, PROP_NONE);
+	RNA_def_property_collection_sdna(prop, NULL, "mloop", "totloop");
+	RNA_def_property_struct_type(prop, "MeshLoop");
+	RNA_def_property_ui_text(prop, "Loops", "Loops of the mesh (polygon corners)");
+	rna_def_mesh_loops(brna, prop);
+
+	prop = RNA_def_property(srna, "polygons", PROP_COLLECTION, PROP_NONE);
+	RNA_def_property_collection_sdna(prop, NULL, "mpoly", "totpoly");
+	RNA_def_property_struct_type(prop, "MeshPolygon");
+	RNA_def_property_ui_text(prop, "Polygons", "Polygons of the mesh");
+	rna_def_mesh_polygons(brna, prop);
+
+	prop = RNA_def_property(srna, "sticky", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "msticky", "totvert");
 	RNA_def_property_struct_type(prop, "MeshSticky");
 	RNA_def_property_ui_text(prop, "Sticky", "Sticky texture coordinates");
 
 	/* TODO, should this be allowed to be its self? */
-	prop= RNA_def_property(srna, "texture_mesh", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "texture_mesh", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "texcomesh");
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
-	RNA_def_property_ui_text(prop, "Texture Mesh", "Use another mesh for texture indices (vertex indices must be aligned)");
+	RNA_def_property_ui_text(prop, "Texture Mesh",
+	                         "Use another mesh for texture indices (vertex indices must be aligned)");
+
+	/* UV loop layers */
+	prop = RNA_def_property(srna, "uv_layers", PROP_COLLECTION, PROP_NONE);
+	RNA_def_property_collection_sdna(prop, NULL, "ldata.layers", "ldata.totlayer");
+	RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_layers_begin", NULL, NULL, NULL,
+	                                  "rna_Mesh_uv_layers_length", NULL, NULL, NULL);
+	RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
+	RNA_def_property_ui_text(prop, "UV Loop Layers", "All UV loop layers");
+	rna_def_uv_layers(brna, prop);
+
+	prop = RNA_def_property(srna, "uv_layer_clone", PROP_POINTER, PROP_UNSIGNED);
+	RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
+	RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_layer_clone_get",
+	                               "rna_Mesh_uv_layer_clone_set", NULL, NULL);
+	RNA_def_property_flag(prop, PROP_EDITABLE);
+	RNA_def_property_ui_text(prop, "Clone UV loop layer", "UV loop layer to be used as cloning source");
+
+	prop = RNA_def_property(srna, "uv_layer_clone_index", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_int_funcs(prop, "rna_Mesh_uv_layer_clone_index_get",
+	                           "rna_Mesh_uv_layer_clone_index_set", "rna_Mesh_uv_layer_index_range");
+	RNA_def_property_ui_text(prop, "Clone UV loop layer Index", "Clone UV loop layer index");
+
+	prop = RNA_def_property(srna, "uv_layer_stencil", PROP_POINTER, PROP_UNSIGNED);
+	RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
+	RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_layer_stencil_get",
+	                               "rna_Mesh_uv_layer_stencil_set", NULL, NULL);
+	RNA_def_property_flag(prop, PROP_EDITABLE);
+	RNA_def_property_ui_text(prop, "Mask UV loop layer", "UV loop layer to mask the painted area");
+
+	prop = RNA_def_property(srna, "uv_layer_stencil_index", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_int_funcs(prop, "rna_Mesh_uv_layer_stencil_index_get",
+	                           "rna_Mesh_uv_layer_stencil_index_set", "rna_Mesh_uv_layer_index_range");
+	RNA_def_property_ui_text(prop, "Mask UV loop layer Index", "Mask UV loop layer index");
 
-	/* UV textures */
-	prop= RNA_def_property(srna, "uv_textures", PROP_COLLECTION, PROP_NONE);
+	/* Tessellated face UV maps - used by renderers */
+	prop = RNA_def_property(srna, "tessface_uv_textures", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer");
+	RNA_def_property_collection_funcs(prop, "rna_Mesh_tessface_uv_textures_begin", NULL, NULL, NULL,
+	                                  "rna_Mesh_tessface_uv_textures_length", NULL, NULL, NULL);
+	RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
+	RNA_def_property_ui_text(prop, "Tessellated Face UV Maps",
+	                         "All UV maps for tessellated faces (read-only, for use by renderers)");
+	rna_def_tessface_uv_textures(brna, prop);
+
+	/* UV maps */
+	prop = RNA_def_property(srna, "uv_textures", PROP_COLLECTION, PROP_NONE);
+	RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
 	RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_textures_begin", NULL, NULL, NULL,
 	                                  "rna_Mesh_uv_textures_length", NULL, NULL, NULL);
-	RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
-	RNA_def_property_ui_text(prop, "UV Maps", "");
+	RNA_def_property_struct_type(prop, "MeshTexturePolyLayer");
+	RNA_def_property_ui_text(prop, "UV Maps", "All UV maps");
 	rna_def_uv_textures(brna, prop);
 
-	prop= RNA_def_property(srna, "uv_texture_clone", PROP_POINTER, PROP_UNSIGNED);
-	RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
-	RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_texture_clone_get", "rna_Mesh_uv_texture_clone_set", NULL, NULL);
+	prop = RNA_def_property(srna, "uv_texture_clone", PROP_POINTER, PROP_UNSIGNED);
+	RNA_def_property_struct_type(prop, "MeshTexturePolyLayer");
+	RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_texture_clone_get",
+	                               "rna_Mesh_uv_texture_clone_set", NULL, NULL);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Clone UV Map", "UV map to be used as cloning source");
 
-	prop= RNA_def_property(srna, "uv_texture_clone_index", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "uv_texture_clone_index", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_funcs(prop, "rna_Mesh_uv_texture_clone_index_get",
-	                           "rna_Mesh_uv_texture_clone_index_set", "rna_Mesh_active_uv_texture_index_range");
-	RNA_def_property_ui_text(prop, "Clone UV Map Index", "Clone UV texture index");
+	                           "rna_Mesh_uv_texture_clone_index_set", "rna_Mesh_uv_texture_index_range");
+	RNA_def_property_ui_text(prop, "Clone UV Map Index", "Clone UV map index");
 
-	prop= RNA_def_property(srna, "uv_texture_stencil", PROP_POINTER, PROP_UNSIGNED);
-	RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
-	RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_texture_stencil_get", "rna_Mesh_uv_texture_stencil_set", NULL, NULL);
+	prop = RNA_def_property(srna, "uv_texture_stencil", PROP_POINTER, PROP_UNSIGNED);
+	RNA_def_property_struct_type(prop, "MeshTexturePolyLayer");
+	RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_texture_stencil_get",
+	                               "rna_Mesh_uv_texture_stencil_set", NULL, NULL);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Mask UV Map", "UV map to mask the painted area");
 
-	prop= RNA_def_property(srna, "uv_texture_stencil_index", PROP_INT, PROP_UNSIGNED);
-	RNA_def_property_int_funcs(prop, "rna_Mesh_uv_texture_stencil_index_get", "rna_Mesh_uv_texture_stencil_index_set", "rna_Mesh_active_uv_texture_index_range");
+	prop = RNA_def_property(srna, "uv_texture_stencil_index", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_int_funcs(prop, "rna_Mesh_uv_texture_stencil_index_get",
+	                           "rna_Mesh_uv_texture_stencil_index_set", "rna_Mesh_uv_texture_index_range");
 	RNA_def_property_ui_text(prop, "Mask UV Map Index", "Mask UV map index");
 
-	/* Vertex colors */
+	/* Tessellated face colors - used by renderers */
 
-	prop= RNA_def_property(srna, "vertex_colors", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "tessface_vertex_colors", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer");
-	RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_colors_begin", NULL, NULL, NULL,
-	                                  "rna_Mesh_vertex_colors_length", NULL, NULL, NULL);
+	RNA_def_property_collection_funcs(prop, "rna_Mesh_tessface_vertex_colors_begin", NULL, NULL, NULL,
+	                                  "rna_Mesh_tessface_vertex_colors_length", NULL, NULL, NULL);
 	RNA_def_property_struct_type(prop, "MeshColorLayer");
-	RNA_def_property_ui_text(prop, "Vertex Colors", "");
-	rna_def_vertex_colors(brna, prop);
+	RNA_def_property_ui_text(prop, "Tessellated Face Colors",
+	                         "All tessellated face colors (read-only, for use by renderers)");
+	rna_def_tessface_vertex_colors(brna, prop);
 
-	prop= RNA_def_property(srna, "layers_float", PROP_COLLECTION, PROP_NONE);
-	RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer");
-	RNA_def_property_collection_funcs(prop, "rna_Mesh_float_layers_begin", NULL, NULL, NULL,
-	                                  "rna_Mesh_float_layers_length", NULL, NULL, NULL);
+	/* Vertex colors */
+
+	prop = RNA_def_property(srna, "vertex_colors", PROP_COLLECTION, PROP_NONE);
+	RNA_def_property_collection_sdna(prop, NULL, "ldata.layers", "ldata.totlayer");
+	RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_colors_begin", NULL, NULL, NULL,
+	                                  "rna_Mesh_vertex_colors_length", NULL, NULL, NULL);
+	RNA_def_property_struct_type(prop, "MeshLoopColorLayer");
+	RNA_def_property_ui_text(prop, "Vertex Colors", "All vertex colors");
+	rna_def_loop_colors(brna, prop);
+
+	prop = RNA_def_property(srna, "polygon_layers_float", PROP_COLLECTION, PROP_NONE);
+	RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
+	RNA_def_property_collection_funcs(prop, "rna_Mesh_polygon_float_layers_begin", NULL, NULL, NULL,
+	                                  "rna_Mesh_polygon_float_layers_length", NULL, NULL, NULL);
 	RNA_def_property_struct_type(prop, "MeshFloatPropertyLayer");
 	RNA_def_property_ui_text(prop, "Float Property Layers", "");
-	rna_def_float_layers(brna, prop);
+	rna_def_polygon_float_layers(brna, prop);
 
-	prop= RNA_def_property(srna, "layers_int", PROP_COLLECTION, PROP_NONE);
-	RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer");
-	RNA_def_property_collection_funcs(prop, "rna_Mesh_int_layers_begin", NULL, NULL, NULL,
-	                                  "rna_Mesh_int_layers_length", NULL, NULL, NULL);
+	prop = RNA_def_property(srna, "polygon_layers_int", PROP_COLLECTION, PROP_NONE);
+	RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
+	RNA_def_property_collection_funcs(prop, "rna_Mesh_polygon_int_layers_begin", NULL, NULL, NULL,
+	                                  "rna_Mesh_polygon_int_layers_length", NULL, NULL, NULL);
 	RNA_def_property_struct_type(prop, "MeshIntPropertyLayer");
 	RNA_def_property_ui_text(prop, "Int Property Layers", "");
-	rna_def_int_layers(brna, prop);
+	rna_def_polygon_int_layers(brna, prop);
 
-	prop= RNA_def_property(srna, "layers_string", PROP_COLLECTION, PROP_NONE);
-	RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer");
-	RNA_def_property_collection_funcs(prop, "rna_Mesh_string_layers_begin", NULL, NULL, NULL,
-	                                  "rna_Mesh_string_layers_length", NULL, NULL, NULL);
+	prop = RNA_def_property(srna, "polygon_layers_string", PROP_COLLECTION, PROP_NONE);
+	RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
+	RNA_def_property_collection_funcs(prop, "rna_Mesh_polygon_string_layers_begin", NULL, NULL, NULL,
+	                                  "rna_Mesh_polygon_string_layers_length", NULL, NULL, NULL);
 	RNA_def_property_struct_type(prop, "MeshStringPropertyLayer");
 	RNA_def_property_ui_text(prop, "String Property Layers", "");
-	rna_def_string_layers(brna, prop);
+	rna_def_polygon_string_layers(brna, prop);
 
-	prop= RNA_def_property(srna, "use_auto_smooth", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_auto_smooth", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_AUTOSMOOTH);
 	RNA_def_property_ui_text(prop, "Auto Smooth",
-	                         "Treat all set-smoothed faces with angles less than the "
-	                         "specified angle as 'smooth' during render");
+	                         "Treat all set-smoothed faces with angles less than the specified angle "
+	                         "as 'smooth' during render");
 
 #if 1 /* expose as radians */
-	prop= RNA_def_property(srna, "auto_smooth_angle", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "auto_smooth_angle", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_funcs(prop, "rna_Mesh_auto_smooth_angle_get", "rna_Mesh_auto_smooth_angle_set", NULL);
 	RNA_def_property_ui_range(prop, DEG2RAD(1.0), DEG2RAD(80), 1.0, 1);
 #else
-	prop= RNA_def_property(srna, "auto_smooth_angle", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "auto_smooth_angle", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "smoothresh");
 	RNA_def_property_range(prop, 1, 80);
 #endif
 	RNA_def_property_ui_text(prop, "Auto Smooth Angle",
 	                         "Maximum angle between face normals that 'Auto Smooth' will operate on");
 
-	prop= RNA_def_property(srna, "show_double_sided", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_double_sided", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_TWOSIDED);
 	RNA_def_property_ui_text(prop, "Double Sided", "Render/display the mesh with double or single sided lighting");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
-	prop= RNA_def_property(srna, "texco_mesh", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "texco_mesh", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "texcomesh");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Texture Space Mesh", "Derive texture coordinates from another mesh");
 
-	prop= RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "key");
 	RNA_def_property_ui_text(prop, "Shape Keys", "");
-	
+
 	/* texture space */
-	prop= RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "texflag", AUTOSPACE);
+	prop = RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "texflag", ME_AUTOSPACE);
 	RNA_def_property_ui_text(prop, "Auto Texture Space",
 	                         "Adjust active object's texture space automatically when transforming object");
-	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Mesh_texspace_set");
-	
-	prop= RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
+
+	/*prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space location");
 	RNA_def_property_editable_func(prop, "rna_Mesh_texspace_editable");
-	RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_loc_get", "rna_Mesh_texspace_loc_set", NULL);	
-	RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
-	
-	prop= RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
-	RNA_def_property_array(prop, 3);
-	RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space size");
-	RNA_def_property_editable_func(prop, "rna_Mesh_texspace_editable");
-	RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_size_get", "rna_Mesh_texspace_size_set", NULL);
+	RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_loc_get", "rna_Mesh_texspace_loc_set", NULL);
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
-	
+	*/
+
 	/* not supported yet
-	prop= RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER);
+	prop = RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER);
 	RNA_def_property_float(prop, NULL, "rot");
 	RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation");
 	RNA_def_property_editable_func(prop, texspace_editable);
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
 	*/
-	
-	/* materials */
-	prop= RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
-	RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
-	RNA_def_property_struct_type(prop, "Material");
-	RNA_def_property_ui_text(prop, "Materials", "");
-	RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
-	RNA_def_property_collection_funcs(prop, 0, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
 
 	/* Mesh Draw Options for Edit Mode*/
-	
-	prop= RNA_def_property(srna, "show_edges", PROP_BOOLEAN, PROP_NONE);
+
+	prop = RNA_def_property(srna, "show_edges", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEDGES);
-	RNA_def_property_ui_text(prop, "Draw Edges", "Display selected edges using highlights in the 3D view and UV editor");
+	RNA_def_property_ui_text(prop, "Draw Edges", "Display selected edges using hilights in the 3D view and UV editor");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
-	
-	prop= RNA_def_property(srna, "show_all_edges", PROP_BOOLEAN, PROP_NONE);
+
+	prop = RNA_def_property(srna, "show_all_edges", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_ALLEDGES);
 	RNA_def_property_ui_text(prop, "All Edges", "Display all edges for wireframe in all view modes in the 3D view");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
-	prop= RNA_def_property(srna, "show_faces", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_faces", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWFACES);
 	RNA_def_property_ui_text(prop, "Draw Faces", "Display all faces as shades in the 3D view and UV editor");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
-	
-	prop= RNA_def_property(srna, "show_normal_face", PROP_BOOLEAN, PROP_NONE);
+
+	prop = RNA_def_property(srna, "show_normal_face", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWNORMALS);
 	RNA_def_property_ui_text(prop, "Draw Normals", "Display face normals as lines");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
-	
-	prop= RNA_def_property(srna, "show_normal_vertex", PROP_BOOLEAN, PROP_NONE);
+
+	prop = RNA_def_property(srna, "show_normal_vertex", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_VNORMALS);
 	RNA_def_property_ui_text(prop, "Draw Vertex Normals", "Display vertex normals as lines");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
-	
-	prop= RNA_def_property(srna, "show_edge_crease", PROP_BOOLEAN, PROP_NONE);
+
+	prop = RNA_def_property(srna, "show_edge_crease", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWCREASES);
 	RNA_def_property_ui_text(prop, "Draw Creases", "Display creases created for subsurf weighting");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
-	
-	prop= RNA_def_property(srna, "show_edge_bevel_weight", PROP_BOOLEAN, PROP_NONE);
+
+	prop = RNA_def_property(srna, "show_edge_bevel_weight", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWBWEIGHTS);
 	RNA_def_property_ui_text(prop, "Draw Bevel Weights", "Display weights created for the Bevel modifier");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
-	
-	prop= RNA_def_property(srna, "show_edge_seams", PROP_BOOLEAN, PROP_NONE);
+
+	prop = RNA_def_property(srna, "show_edge_seams", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWSEAMS);
 	RNA_def_property_ui_text(prop, "Draw Seams", "Display UV unwrapping seams");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
-	
-	prop= RNA_def_property(srna, "show_edge_sharp", PROP_BOOLEAN, PROP_NONE);
+
+	prop = RNA_def_property(srna, "show_edge_sharp", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWSHARP);
 	RNA_def_property_ui_text(prop, "Draw Sharp", "Display sharp edges, used with the EdgeSplit modifier");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
 
-	prop= RNA_def_property(srna, "show_extra_edge_length", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_extra_edge_length", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_EDGELEN);
 	RNA_def_property_ui_text(prop, "Edge Length",
 	                         "Display selected edge lengths, using global values when set in the transform panel");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
-	
-	prop= RNA_def_property(srna, "show_extra_face_angle", PROP_BOOLEAN, PROP_NONE);
+
+	prop = RNA_def_property(srna, "show_extra_face_angle", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_FACEANG);
-	RNA_def_property_ui_text(prop, "Faces Angles",
-	                         "Display the angles between the selected edges in degrees, using "
-	                         "global values when set in the transform panel");
+	RNA_def_property_ui_text(prop, "Face Angles",
+	                         "Display the angles in the selected edges in degrees, "
+	                         "using global values when set in the transform panel");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
-	
-	prop= RNA_def_property(srna, "show_extra_face_area", PROP_BOOLEAN, PROP_NONE);
+
+	prop = RNA_def_property(srna, "show_extra_face_area", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_FACEAREA);
 	RNA_def_property_ui_text(prop, "Face Area",
-	                         "Display the area of selected faces, using global values when set in the transform panel");
+	                         "Display the area of selected faces, "
+	                         "using global values when set in the transform panel");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
 
-	prop= RNA_def_property(srna, "show_extra_indices", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_extra_indices", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWEXTRA_INDICES);
-	RNA_def_property_ui_text(prop, "Indices", "Displays the index numbers of selected vertices, edges, and faces");
+	RNA_def_property_ui_text(prop, "Indices", "Display the index numbers of selected vertices, edges, and faces");
 	RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
 
 	/* editflag */
-	prop= RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_X);
 	RNA_def_property_ui_text(prop, "X Mirror", "X Axis mirror editing");
 
 	/*
-	prop= RNA_def_property(srna, "use_mirror_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_mirror_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_Y);
 	RNA_def_property_ui_text(prop, "Y Mirror", "Y Axis mirror editing");
 
-	prop= RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_Z);
 	RNA_def_property_ui_text(prop, "Z Mirror", "Z Axis mirror editing");
 	 */
 
-	prop= RNA_def_property(srna, "use_mirror_topology", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_mirror_topology", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_TOPO);
 	RNA_def_property_ui_text(prop, "Topology Mirror",
-	                         "Use topology based mirroring (for when both sides of mesh have matching, unique topology)");
+	                         "Use topology based mirroring "
+	                         "(for when both sides of mesh have matching, unique topology)");
 
-	prop= RNA_def_property(srna, "use_paint_mask", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_paint_mask", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_PAINT_MASK);
 	RNA_def_property_ui_text(prop, "Paint Mask", "Face selection masking for painting");
 	RNA_def_property_ui_icon(prop, ICON_FACESEL_HLT, 0);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_Mesh_update_facemask");
-	
-	prop= RNA_def_property(srna, "use_paint_mask_vertex", PROP_BOOLEAN, PROP_NONE);
+
+	prop = RNA_def_property(srna, "use_paint_mask_vertex", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_VERT_SEL);
 	RNA_def_property_ui_text(prop, "Vertex Selection", "Vertex selection masking for painting (weight paint only)");
 	RNA_def_property_ui_icon(prop, ICON_VERTEXSEL, 0);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_Mesh_update_vertmask");
 
 	/* readonly editmesh info - use for extrude menu */
-	prop= RNA_def_property(srna, "total_vert_sel", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "total_vert_sel", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_funcs(prop, "rna_Mesh_tot_vert_get", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Selected Vert Total", "Selected vertex count in editmode");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "total_edge_sel", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "total_edge_sel", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_funcs(prop, "rna_Mesh_tot_edge_get", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Selected Edge Total", "Selected edge count in editmode");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "total_face_sel", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "total_face_sel", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_funcs(prop, "rna_Mesh_tot_face_get", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Selected Face Total", "Selected face count in editmode");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
 	/* pointers */
 	rna_def_animdata_common(srna);
+	rna_def_texmat_common(srna, "rna_Mesh_texspace_editable");
 
 	RNA_api_mesh(srna);
 }
@@ -2229,9 +2831,14 @@ void RNA_def_mesh(BlenderRNA *brna)
 	rna_def_mvert_group(brna);
 	rna_def_medge(brna);
 	rna_def_mface(brna);
+	rna_def_mloop(brna);
+	rna_def_mpolygon(brna);
+	rna_def_mloopuv(brna);
 	rna_def_mtface(brna);
+	rna_def_mtexpoly(brna);
 	rna_def_msticky(brna);
 	rna_def_mcol(brna);
+	rna_def_mloopcol(brna);
 	rna_def_mproperties(brna);
 }
 
diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c
index 0a93c9b..41b232f 100644
--- a/source/blender/makesrna/intern/rna_mesh_api.c
+++ b/source/blender/makesrna/intern/rna_mesh_api.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
@@ -18,7 +18,7 @@
  * The Original Code is Copyright (C) 2009 Blender Foundation.
  * All rights reserved.
  *
- * 
+ *
  * Contributor(s): Blender Foundation
  *
  * ***** END GPL LICENSE BLOCK *****
@@ -40,7 +40,15 @@
 #include "ED_mesh.h"
 
 #ifdef RNA_RUNTIME
-
+const char *rna_Mesh_unit_test_compare(struct Mesh *mesh, bContext *C, struct Mesh *mesh2)
+{
+	const char *ret = mesh_cmp(mesh, mesh2, FLT_EPSILON*60);
+	
+	if (!ret)
+		ret = "Same";
+	
+	return ret;
+}
 
 #else
 
@@ -49,23 +57,34 @@ void RNA_api_mesh(StructRNA *srna)
 	FunctionRNA *func;
 	PropertyRNA *parm;
 
-	func= RNA_def_function(srna, "transform", "ED_mesh_transform");
+	func = RNA_def_function(srna, "transform", "ED_mesh_transform");
 	RNA_def_function_ui_description(func, "Transform mesh vertices by a matrix");
-	parm= RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
+	parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	func= RNA_def_function(srna, "calc_normals", "ED_mesh_calc_normals");
+	func = RNA_def_function(srna, "calc_normals", "ED_mesh_calc_normals");
 	RNA_def_function_ui_description(func, "Calculate vertex normals");
 
-	func= RNA_def_function(srna, "update", "ED_mesh_update");
+	func = RNA_def_function(srna, "calc_tessface", "ED_mesh_calc_tessface");
+	RNA_def_function_ui_description(func, "Calculate face tessellation (supports editmode too)");
+
+	func = RNA_def_function(srna, "update", "ED_mesh_update");
 	RNA_def_boolean(func, "calc_edges", 0, "Calculate Edges", "Force recalculation of edges");
+	RNA_def_boolean(func, "calc_tessface", 0, "Calculate Tessellation", "Force recalculation of tessellation faces");
+	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_function_flag(func, FUNC_USE_CONTEXT);
+	/* return value */
+	parm = RNA_def_string(func, "result", "nothing", 64, "Return value", "String description of result of comparison");
+	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "validate", "BKE_mesh_validate");
+	func = RNA_def_function(srna, "validate", "BKE_mesh_validate");
 	RNA_def_function_ui_description(func, "validate geometry, return True when the mesh has had "
 	                                      "invalid geometry corrected/removed");
 	RNA_def_boolean(func, "verbose", 0, "Verbose", "Output information about the errors found");
-	parm= RNA_def_boolean(func, "result", 0, "Result", "");
+	parm = RNA_def_boolean(func, "result", 0, "Result", "");
 	RNA_def_function_return(func, parm);
 }
 
diff --git a/source/blender/makesrna/intern/rna_mesh_utils.h b/source/blender/makesrna/intern/rna_mesh_utils.h
new file mode 100644
index 0000000..cfb9f7e
--- /dev/null
+++ b/source/blender/makesrna/intern/rna_mesh_utils.h
@@ -0,0 +1,146 @@
+/*
+ * ***** 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.
+ *
+ * This is a new part of Blender.
+ *
+ * Contributor(s): Andrew Wiggin
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/source/blender/makesrna/intern/rna_mesh_utils.h
+ *  \ingroup RNA
+ */
+ 
+#ifndef __RNA_MESH_UTILS_H__
+#define __RNA_MESH_UTILS_H__
+
+/* Macros to help reduce code clutter in rna_mesh.c */
+
+/* Define the accessors for a basic CustomDataLayer collection */
+#define DEFINE_CUSTOMDATA_LAYER_COLLECTION(collection_name, customdata_type, layer_type)        \
+	/* check */                                                                                 \
+	static int rna_##collection_name##_check(CollectionPropertyIterator *iter, void *data)      \
+	{                                                                                           \
+		CustomDataLayer *layer = (CustomDataLayer *)data;                                       \
+		return (layer->type != layer_type);                                                     \
+	}                                                                                           \
+	/* begin */                                                                                 \
+	static void rna_Mesh_##collection_name##s_begin(CollectionPropertyIterator *iter,           \
+	                                                PointerRNA *ptr)                            \
+	{                                                                                           \
+		CustomData *data = rna_mesh_##customdata_type(ptr);                                     \
+		if (data) {                                                                             \
+			rna_iterator_array_begin(iter,                                                      \
+			                         (void *)data->layers, sizeof(CustomDataLayer),             \
+			                         data->totlayer, 0,                                         \
+			                         rna_##collection_name##_check);                            \
+		}                                                                                       \
+		else {                                                                                  \
+			rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL);                                \
+		}                                                                                       \
+	}                                                                                           \
+	/* length */                                                                                \
+	static int rna_Mesh_##collection_name##s_length(PointerRNA *ptr)                            \
+	{                                                                                           \
+		CustomData *data = rna_mesh_##customdata_type(ptr);                                     \
+		return data ? CustomData_number_of_layers(data, layer_type) : 0;                        \
+	}                                                                                           \
+	/* index range */                                                                           \
+	static void rna_Mesh_##collection_name##_index_range(PointerRNA *ptr, int *min, int *max,   \
+	                                                     int *softmin, int *softmax)            \
+	{                                                                                           \
+		CustomData *data = rna_mesh_##customdata_type(ptr);                                     \
+		*min = 0;                                                                               \
+		*max = data ? CustomData_number_of_layers(data, layer_type) - 1 : 0;                    \
+		*max = MAX2(0, *max);                                                                   \
+	}
+
+/* Define the accessors for special CustomDataLayers in the collection
+ * (active, render, clone, stencil, etc) */
+#define DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(collection_name, customdata_type,         \
+	                                                  layer_type, active_type, layer_rna_type)  \
+	                                                                                            \
+	static PointerRNA rna_Mesh_##collection_name##_##active_type##_get(PointerRNA *ptr)         \
+	{                                                                                           \
+		CustomData *data = rna_mesh_##customdata_type(ptr);                                     \
+		CustomDataLayer *layer;                                                                 \
+		if (data) {                                                                             \
+			int index = CustomData_get_##active_type##_layer_index(data, layer_type);           \
+			layer = (index == -1) ? NULL: &data->layers[index];                                 \
+		}                                                                                       \
+		else {                                                                                  \
+			layer = NULL;                                                                       \
+			}                                                                                   \
+		return rna_pointer_inherit_refine(ptr, &RNA_##layer_rna_type, layer);                   \
+	}                                                                                           \
+	                                                                                            \
+	static void rna_Mesh_##collection_name##_##active_type##_set(PointerRNA *ptr,               \
+	                                                             PointerRNA value)              \
+	{                                                                                           \
+		Mesh *me = rna_mesh(ptr);                                                               \
+		CustomData *data = rna_mesh_##customdata_type(ptr);                                     \
+		int a;                                                                                  \
+		if (data) {                                                                             \
+			CustomDataLayer *layer;                                                             \
+			int layer_index = CustomData_get_layer_index(data, layer_type);                     \
+			for (layer = data->layers + layer_index, a = 0; layer_index + a < data->totlayer; layer++, a++) { \
+				if (value.data == layer) {                                                      \
+					CustomData_set_layer_##active_type(data, layer_type, a);                    \
+					                                                                            \
+					/* keep loops in sync */                                                    \
+					if (layer_type == CD_MTEXPOLY) {                                            \
+						CustomData *ldata = rna_mesh_ldata_helper(me);                          \
+						CustomData_set_layer_##active_type(ldata, CD_MLOOPUV, a);               \
+					}                                                                           \
+					mesh_update_customdata_pointers(me, TRUE);                                  \
+					return;                                                                     \
+				}                                                                               \
+			}                                                                                   \
+		}                                                                                       \
+	}                                                                                           \
+	                                                                                            \
+	static int rna_Mesh_##collection_name##_##active_type##_index_get(PointerRNA *ptr)          \
+	{                                                                                           \
+		CustomData *data = rna_mesh_##customdata_type(ptr);                                     \
+		if (data) {                                                                             \
+			return CustomData_get_##active_type##_layer(data, layer_type);                      \
+		}                                                                                       \
+		else {                                                                                  \
+			return 0;                                                                           \
+		}                                                                                       \
+	}                                                                                           \
+	                                                                                            \
+	static void rna_Mesh_##collection_name##_##active_type##_index_set(PointerRNA *ptr, int value) \
+	{                                                                                           \
+		Mesh *me = rna_mesh(ptr);                                                               \
+		CustomData *data = rna_mesh_##customdata_type(ptr);                                     \
+		if (data) {                                                                             \
+			CustomData_set_layer_##active_type(data, layer_type, value);                        \
+			/* keep loops in sync */                                                            \
+			if (layer_type == CD_MTEXPOLY) {                                                    \
+				CustomData *ldata = rna_mesh_ldata_helper(me);                                  \
+				CustomData_set_layer_##active_type(ldata, CD_MLOOPUV, value);                   \
+			}                                                                                   \
+			mesh_update_customdata_pointers(me, TRUE);                                          \
+		}                                                                                       \
+	}
+
+#endif /* __RNA_MESH_UTILS_H__ */
diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c
index 5f33eac..e8ea19a 100644
--- a/source/blender/makesrna/intern/rna_meta.c
+++ b/source/blender/makesrna/intern/rna_meta.c
@@ -53,13 +53,13 @@
 
 static int rna_Meta_texspace_editable(PointerRNA *ptr)
 {
-	MetaBall *mb= (MetaBall*)ptr->data;
+	MetaBall *mb = (MetaBall*)ptr->data;
 	return (mb->texflag & MB_AUTOSPACE)? 0: PROP_EDITABLE;
 }
 
 static void rna_Meta_texspace_loc_get(PointerRNA *ptr, float *values)
 {
-	MetaBall *mb= (MetaBall*)ptr->data;
+	MetaBall *mb = (MetaBall*)ptr->data;
 	
 	/* tex_space_mball() needs object.. ugh */
 	
@@ -68,14 +68,14 @@ static void rna_Meta_texspace_loc_get(PointerRNA *ptr, float *values)
 
 static void rna_Meta_texspace_loc_set(PointerRNA *ptr, const float *values)
 {
-	MetaBall *mb= (MetaBall*)ptr->data;
+	MetaBall *mb = (MetaBall*)ptr->data;
 	
 	copy_v3_v3(mb->loc, values);
 }
 
 static void rna_Meta_texspace_size_get(PointerRNA *ptr, float *values)
 {
-	MetaBall *mb= (MetaBall*)ptr->data;
+	MetaBall *mb = (MetaBall*)ptr->data;
 	
 	/* tex_space_mball() needs object.. ugh */
 	
@@ -84,7 +84,7 @@ static void rna_Meta_texspace_size_get(PointerRNA *ptr, float *values)
 
 static void rna_Meta_texspace_size_set(PointerRNA *ptr, const float *values)
 {
-	MetaBall *mb= (MetaBall*)ptr->data;
+	MetaBall *mb = (MetaBall*)ptr->data;
 	
 	copy_v3_v3(mb->size, values);
 }
@@ -92,13 +92,13 @@ static void rna_Meta_texspace_size_set(PointerRNA *ptr, const float *values)
 
 static void rna_MetaBall_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	MetaBall *mb= ptr->id.data;
+	MetaBall *mb = ptr->id.data;
 	Object *ob;
 
 	/* cheating way for importers to avoid slow updates */
-	if(mb->id.us > 0) {
-		for(ob=bmain->object.first; ob; ob= ob->id.next)
-			if(ob->data == mb)
+	if (mb->id.us > 0) {
+		for (ob = bmain->object.first; ob; ob = ob->id.next)
+			if (ob->data == mb)
 				copy_mball_properties(scene, ob);
 	
 		DAG_id_tag_update(&mb->id, 0);
@@ -108,17 +108,17 @@ static void rna_MetaBall_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
 
 static void rna_MetaBall_update_rotation(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	MetaElem *ml= ptr->data;
+	MetaElem *ml = ptr->data;
 	normalize_qt(ml->quat);
 	rna_MetaBall_update_data(bmain, scene, ptr);
 }
 
 static MetaElem *rna_MetaBall_elements_new(MetaBall *mb, int type)
 {
-	MetaElem *ml= add_metaball_element(mb, type);
+	MetaElem *ml = add_metaball_element(mb, type);
 
 	/* cheating way for importers to avoid slow updates */
-	if(mb->id.us > 0) {
+	if (mb->id.us > 0) {
 		DAG_id_tag_update(&mb->id, 0);
 		WM_main_add_notifier(NC_GEOM|ND_DATA, &mb->id);
 	}
@@ -128,12 +128,12 @@ static MetaElem *rna_MetaBall_elements_new(MetaBall *mb, int type)
 
 static void rna_MetaBall_elements_remove(MetaBall *mb, ReportList *reports, MetaElem *ml)
 {
-	int found= 0;
+	int found = 0;
 
-	found= BLI_remlink_safe(&mb->elems, ml);
+	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 (!found) {
+		BKE_reportf(reports, RPT_ERROR, "Metaball \"%s\" does not contain spline given", mb->id.name+2);
 		return;
 	}
 
@@ -141,7 +141,7 @@ static void rna_MetaBall_elements_remove(MetaBall *mb, ReportList *reports, Meta
 	/* invalidate pointer!, no can do */
 
 	/* cheating way for importers to avoid slow updates */
-	if(mb->id.us > 0) {
+	if (mb->id.us > 0) {
 		DAG_id_tag_update(&mb->id, 0);
 		WM_main_add_notifier(NC_GEOM|ND_DATA, &mb->id);
 	}
@@ -152,7 +152,7 @@ static void rna_MetaBall_elements_clear(MetaBall *mb)
 	BLI_freelistN(&mb->elems);
 
 	/* cheating way for importers to avoid slow updates */
-	if(mb->id.us > 0) {
+	if (mb->id.us > 0) {
 		DAG_id_tag_update(&mb->id, 0);
 		WM_main_add_notifier(NC_GEOM|ND_DATA, &mb->id);
 	}
@@ -165,66 +165,66 @@ static void rna_def_metaelement(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "MetaElement", NULL);
+	srna = RNA_def_struct(brna, "MetaElement", NULL);
 	RNA_def_struct_sdna(srna, "MetaElem");
-	RNA_def_struct_ui_text(srna, "Meta Element", "Blobby element in a MetaBall datablock");
+	RNA_def_struct_ui_text(srna, "Meta Element", "Blobby element in a Metaball datablock");
 	RNA_def_struct_ui_icon(srna, ICON_OUTLINER_DATA_META);
 
 	/* enums */
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, metaelem_type_items);
 	RNA_def_property_ui_text(prop, "Type", "Metaball types");
 	RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
 	
 	/* number values */
-	prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "x");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Location", "");
 	RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
 
-	prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
+	prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
 	RNA_def_property_float_sdna(prop, NULL, "quat");
 	RNA_def_property_ui_text(prop, "Rotation", "Normalized quaternion rotation");
 	RNA_def_property_update(prop, 0, "rna_MetaBall_update_rotation");
 
-	prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_UNSIGNED|PROP_UNIT_LENGTH);
+	prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_UNSIGNED|PROP_UNIT_LENGTH);
 	RNA_def_property_float_sdna(prop, NULL, "rad");
 	RNA_def_property_ui_text(prop, "Radius", "");
 	RNA_def_property_range(prop, 0.0f, FLT_MAX);
 	RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
 
-	prop= RNA_def_property(srna, "size_x", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "size_x", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "expx");
 	RNA_def_property_range(prop, 0.0f, 20.0f);
 	RNA_def_property_ui_text(prop, "Size X", "Size of element, use of components depends on element type");
 	RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
 
-	prop= RNA_def_property(srna, "size_y", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "size_y", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "expy");
 	RNA_def_property_range(prop, 0.0f, 20.0f);
 	RNA_def_property_ui_text(prop, "Size Y", "Size of element, use of components depends on element type");
 	RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
 
-	prop= RNA_def_property(srna, "size_z", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "size_z", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "expz");
 	RNA_def_property_range(prop, 0.0f, 20.0f);
 	RNA_def_property_ui_text(prop, "Size Z", "Size of element, use of components depends on element type");
 	RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
 	
-	prop= RNA_def_property(srna, "stiffness", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "stiffness", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "s");
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Stiffness", "Stiffness defines how much of the element to fill");
 	RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
 	
 	/* flags */
-	prop= RNA_def_property(srna, "use_negative", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_negative", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MB_NEGATIVE);
 	RNA_def_property_ui_text(prop, "Negative", "Set metaball as negative one");
 	RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
 	
-	prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MB_HIDE);
 	RNA_def_property_ui_text(prop, "Hide", "Hide element");
 	RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
@@ -240,26 +240,26 @@ static void rna_def_metaball_elements(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, "MetaBallElements");
-	srna= RNA_def_struct(brna, "MetaBallElements", NULL);
+	srna = RNA_def_struct(brna, "MetaBallElements", NULL);
 	RNA_def_struct_sdna(srna, "MetaBall");
 	RNA_def_struct_ui_text(srna, "Meta Elements", "Collection of metaball elements");
 
-	func= RNA_def_function(srna, "new", "rna_MetaBall_elements_new");
+	func = RNA_def_function(srna, "new", "rna_MetaBall_elements_new");
 	RNA_def_function_ui_description(func, "Add a new element to the metaball");
 	RNA_def_enum(func, "type", metaelem_type_items, MB_BALL, "", "type for the new meta-element");
-	parm= RNA_def_pointer(func, "element", "MetaElement", "", "The newly created meta-element");
+	parm = RNA_def_pointer(func, "element", "MetaElement", "", "The newly created meta-element");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_MetaBall_elements_remove");
+	func = RNA_def_function(srna, "remove", "rna_MetaBall_elements_remove");
 	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");
+	parm = RNA_def_pointer(func, "element", "MetaElement", "", "The element to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "clear", "rna_MetaBall_elements_clear");
+	func = RNA_def_function(srna, "clear", "rna_MetaBall_elements_clear");
 	RNA_def_function_ui_description(func, "Remove all elements from the metaball");
 
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "lastelem");
 	RNA_def_property_ui_text(prop, "Active Element", "Last selected element");
 }
@@ -275,71 +275,73 @@ static void rna_def_metaball(BlenderRNA *brna)
 		{MB_UPDATE_NEVER, "NEVER", 0, "Never", "While editing, don't update metaball at all"},
 		{0, NULL, 0, NULL, NULL}};
 	
-	srna= RNA_def_struct(brna, "MetaBall", "ID");
+	srna = RNA_def_struct(brna, "MetaBall", "ID");
 	RNA_def_struct_ui_text(srna, "MetaBall", "Metaball datablock to defined blobby surfaces");
 	RNA_def_struct_ui_icon(srna, ICON_META_DATA);
 
-	prop= RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "elems", NULL);
 	RNA_def_property_struct_type(prop, "MetaElement");
 	RNA_def_property_ui_text(prop, "Elements", "Meta elements");
 	rna_def_metaball_elements(brna, prop);
 
 	/* enums */
-	prop= RNA_def_property(srna, "update_method", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "update_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, prop_update_items);
 	RNA_def_property_ui_text(prop, "Update", "Metaball edit update behavior");
 	RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
 	
 	/* number values */
-	prop= RNA_def_property(srna, "resolution", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "resolution", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "wiresize");
 	RNA_def_property_range(prop, 0.050f, 1.0f);
 	RNA_def_property_ui_text(prop, "Wire Size", "Polygonization resolution in the 3D viewport");
 	RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
 	
-	prop= RNA_def_property(srna, "render_resolution", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "render_resolution", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "rendersize");
 	RNA_def_property_range(prop, 0.050f, 1.0f);
 	RNA_def_property_ui_text(prop, "Render Size", "Polygonization resolution in rendering");
 	RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
 	
-	prop= RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "thresh");
 	RNA_def_property_range(prop, 0.0f, 5.0f);
 	RNA_def_property_ui_text(prop, "Threshold", "Influence of meta elements");
 	RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
 
 	/* texture space */
-	prop= RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "texflag", MB_AUTOSPACE);
-	RNA_def_property_ui_text(prop, "Auto Texture Space", "Adjust active object's texture space automatically when transforming object");
+	RNA_def_property_ui_text(prop, "Auto Texture Space",
+	                         "Adjust active object's texture space automatically when transforming object");
 	
-	prop= RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space location");
 	RNA_def_property_editable_func(prop, "rna_Meta_texspace_editable");
-	RNA_def_property_float_funcs(prop, "rna_Meta_texspace_loc_get", "rna_Meta_texspace_loc_set", NULL);	
+	RNA_def_property_float_funcs(prop, "rna_Meta_texspace_loc_get", "rna_Meta_texspace_loc_set", NULL);
 	RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
 	
-	prop= RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space size");
 	RNA_def_property_editable_func(prop, "rna_Meta_texspace_editable");
 	RNA_def_property_float_funcs(prop, "rna_Meta_texspace_size_get", "rna_Meta_texspace_size_set", NULL);
 	RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
 	
-	/* not supported yet
+	/* not supported yet */
+#if 0
 	prop= RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER);
 	RNA_def_property_float(prop, NULL, "rot");
 	RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation");
 	RNA_def_property_editable_func(prop, "rna_Meta_texspace_editable");
 	RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
-	*/
+#endif
 	
 	/* materials */
-	prop= RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
 	RNA_def_property_struct_type(prop, "Material");
 	RNA_def_property_ui_text(prop, "Materials", "");
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 6d16937..ca1b3a8 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -35,6 +35,7 @@
 #include "rna_internal.h"
 
 #include "DNA_armature_types.h"
+#include "DNA_mesh_types.h"
 #include "DNA_modifier_types.h"
 #include "DNA_object_types.h"
 #include "DNA_object_force.h"
@@ -44,6 +45,8 @@
 
 #include "BLI_math.h"
 
+#include "BLF_translation.h"
+
 #include "BKE_animsys.h"
 #include "BKE_bmesh.h" /* For BevelModifierData */
 #include "BKE_dynamicpaint.h"
@@ -53,13 +56,14 @@
 #include "WM_api.h"
 #include "WM_types.h"
 
-EnumPropertyItem modifier_type_items[] ={
-	{0, "", 0, "Modify", ""},
+EnumPropertyItem modifier_type_items[] = {
+	{0, "", 0, N_("Modify"), ""},
 	{eModifierType_UVProject, "UV_PROJECT", ICON_MOD_UVPROJECT, "UV Project", ""},
 	{eModifierType_WeightVGEdit, "VERTEX_WEIGHT_EDIT", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Edit", ""},
 	{eModifierType_WeightVGMix, "VERTEX_WEIGHT_MIX", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Mix", ""},
-	{eModifierType_WeightVGProximity, "VERTEX_WEIGHT_PROXIMITY", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Proximity", ""},
-	{0, "", 0, "Generate", ""},
+	{eModifierType_WeightVGProximity, "VERTEX_WEIGHT_PROXIMITY", ICON_MOD_VERTEX_WEIGHT,
+	                                  "Vertex Weight Proximity", ""},
+	{0, "", 0, N_("Generate"), ""},
 	{eModifierType_Array, "ARRAY", ICON_MOD_ARRAY, "Array", ""},
 	{eModifierType_Bevel, "BEVEL", ICON_MOD_BEVEL, "Bevel", ""},
 	{eModifierType_Boolean, "BOOLEAN", ICON_MOD_BOOLEAN, "Boolean", ""},
@@ -73,7 +77,7 @@ EnumPropertyItem modifier_type_items[] ={
 	{eModifierType_Screw, "SCREW", ICON_MOD_SCREW, "Screw", ""},
 	{eModifierType_Solidify, "SOLIDIFY", ICON_MOD_SOLIDIFY, "Solidify", ""},
 	{eModifierType_Subsurf, "SUBSURF", ICON_MOD_SUBSURF, "Subdivision Surface", ""},
-	{0, "", 0, "Deform", ""},
+	{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", ""},
@@ -86,7 +90,7 @@ EnumPropertyItem modifier_type_items[] ={
 	{eModifierType_Smooth, "SMOOTH", ICON_MOD_SMOOTH, "Smooth", ""},
 	{eModifierType_Warp, "WARP", ICON_MOD_WARP, "Warp", ""},
 	{eModifierType_Wave, "WAVE", ICON_MOD_WAVE, "Wave", ""},
-	{0, "", 0, "Simulate", ""},
+	{0, "", 0, N_("Simulate"), ""},
 	{eModifierType_Cloth, "CLOTH", ICON_MOD_CLOTH, "Cloth", ""},
 	{eModifierType_Collision, "COLLISION", ICON_MOD_PHYSICS, "Collision", ""},
 	{eModifierType_DynamicPaint, "DYNAMIC_PAINT", ICON_MOD_DYNAMICPAINT, "Dynamic Paint", ""},
@@ -113,15 +117,15 @@ EnumPropertyItem modifier_type_items[] ={
 
 static void rna_UVProject_projectors_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	UVProjectModifierData *uvp= (UVProjectModifierData*)ptr->data;
+	UVProjectModifierData *uvp = (UVProjectModifierData*)ptr->data;
 	rna_iterator_array_begin(iter, (void*)uvp->projectors, sizeof(Object*), uvp->num_projectors, 0, NULL);
 }
 
 static StructRNA* rna_Modifier_refine(struct PointerRNA *ptr)
 {
-	ModifierData *md= (ModifierData*)ptr->data;
+	ModifierData *md = (ModifierData*)ptr->data;
 
-	switch(md->type) {
+	switch (md->type) {
 		case eModifierType_Subsurf:
 			return &RNA_SubsurfModifier;
 		case eModifierType_Lattice:
@@ -209,7 +213,7 @@ static StructRNA* rna_Modifier_refine(struct PointerRNA *ptr)
 
 void rna_Modifier_name_set(PointerRNA *ptr, const char *value)
 {
-	ModifierData *md= ptr->data;
+	ModifierData *md = ptr->data;
 	char oldname[sizeof(md->name)];
 	
 	/* make a copy of the old name first */
@@ -220,12 +224,12 @@ void rna_Modifier_name_set(PointerRNA *ptr, const char *value)
 	
 	/* make sure the name is truly unique */
 	if (ptr->id.data) {
-		Object *ob= ptr->id.data;
+		Object *ob = ptr->id.data;
 		modifier_unique_name(&ob->modifiers, md);
 	}
 	
 	/* fix all the animation data which may link to this */
-	BKE_all_animdata_fix_paths_rename("modifiers", oldname, md->name);
+	BKE_all_animdata_fix_paths_rename(NULL, "modifiers", oldname, md->name);
 }
 
 static char *rna_Modifier_path(PointerRNA *ptr)
@@ -247,32 +251,31 @@ static void rna_Modifier_dependency_update(Main *bmain, Scene *scene, PointerRNA
 
 static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	SmokeModifierData *smd= (SmokeModifierData *)ptr->data;
-	Object *ob= (Object*)ptr->id.data;
+	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)
+	/* nothing changed */
+	if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain)
 		return;
 		
-	smokeModifier_free(smd); // XXX TODO: completely free all 3 pointers
-	smokeModifier_createType(smd); // create regarding of selected type
+	smokeModifier_free(smd); /* XXX TODO: completely free all 3 pointers */
+	smokeModifier_createType(smd); /* create regarding of selected type */
 
 	switch (smd->type) {
 		case MOD_SMOKE_TYPE_DOMAIN:
 			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)
+			for (psys = ob->particlesystem.first; psys; psys = psys->next)
+				if (psys->part->type == PART_EMITTER)
 					break;
-			if(ob->type == OB_MESH && !psys) {
+			if (ob->type == OB_MESH && !psys) {
 				/* add particle system */
 				psmd = (ParticleSystemModifierData *)object_add_particle_system(scene, ob, NULL);
-				if(psmd)
-				{
+				if (psmd) {
 					psys = psmd->psys;
 					part = psys->part;
 					part->lifetime = 1.0f;
@@ -285,7 +288,7 @@ static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr)
 					DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
 				}
 			}
-			if(smd->flow)
+			if (smd->flow)
 				smd->flow->psys = psys;
 		case MOD_SMOKE_TYPE_COLL:
 		case 0:
@@ -294,103 +297,103 @@ static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr)
 			break;
 	}
 	
-	// update dependancy since a domain - other type switch could have happened
+	/* update dependency since a domain - other type switch could have happened */
 	rna_Modifier_dependency_update(bmain, scene, ptr);
 }
 
 static void rna_ExplodeModifier_vgroup_get(PointerRNA *ptr, char *value)
 {
-	ExplodeModifierData *emd= (ExplodeModifierData*)ptr->data;
+	ExplodeModifierData *emd = (ExplodeModifierData*)ptr->data;
 	rna_object_vgroup_name_index_get(ptr, value, emd->vgroup);
 }
 
 static int rna_ExplodeModifier_vgroup_length(PointerRNA *ptr)
 {
-	ExplodeModifierData *emd= (ExplodeModifierData*)ptr->data;
+	ExplodeModifierData *emd = (ExplodeModifierData*)ptr->data;
 	return rna_object_vgroup_name_index_length(ptr, emd->vgroup);
 }
 
 static void rna_ExplodeModifier_vgroup_set(PointerRNA *ptr, const char *value)
 {
-	ExplodeModifierData *emd= (ExplodeModifierData*)ptr->data;
+	ExplodeModifierData *emd = (ExplodeModifierData*)ptr->data;
 	rna_object_vgroup_name_index_set(ptr, value, &emd->vgroup);
 }
 
 static void rna_SimpleDeformModifier_vgroup_set(PointerRNA *ptr, const char *value)
 {
-	SimpleDeformModifierData *smd= (SimpleDeformModifierData*)ptr->data;
+	SimpleDeformModifierData *smd = (SimpleDeformModifierData*)ptr->data;
 	rna_object_vgroup_name_set(ptr, value, smd->vgroup_name, sizeof(smd->vgroup_name));
 }
 
 static void rna_ShrinkwrapModifier_vgroup_set(PointerRNA *ptr, const char *value)
 {
-	ShrinkwrapModifierData *smd= (ShrinkwrapModifierData*)ptr->data;
+	ShrinkwrapModifierData *smd = (ShrinkwrapModifierData*)ptr->data;
 	rna_object_vgroup_name_set(ptr, value, smd->vgroup_name, sizeof(smd->vgroup_name));
 }
 
 static void rna_LatticeModifier_vgroup_set(PointerRNA *ptr, const char *value)
 {
-	LatticeModifierData *lmd= (LatticeModifierData*)ptr->data;
+	LatticeModifierData *lmd = (LatticeModifierData*)ptr->data;
 	rna_object_vgroup_name_set(ptr, value, lmd->name, sizeof(lmd->name));
 }
 
 static void rna_ArmatureModifier_vgroup_set(PointerRNA *ptr, const char *value)
 {
-	ArmatureModifierData *lmd= (ArmatureModifierData*)ptr->data;
+	ArmatureModifierData *lmd = (ArmatureModifierData*)ptr->data;
 	rna_object_vgroup_name_set(ptr, value, lmd->defgrp_name, sizeof(lmd->defgrp_name));
 }
 
 static void rna_CurveModifier_vgroup_set(PointerRNA *ptr, const char *value)
 {
-	CurveModifierData *lmd= (CurveModifierData*)ptr->data;
+	CurveModifierData *lmd = (CurveModifierData*)ptr->data;
 	rna_object_vgroup_name_set(ptr, value, lmd->name, sizeof(lmd->name));
 }
 
 static void rna_DisplaceModifier_vgroup_set(PointerRNA *ptr, const char *value)
 {
-	DisplaceModifierData *lmd= (DisplaceModifierData*)ptr->data;
+	DisplaceModifierData *lmd = (DisplaceModifierData*)ptr->data;
 	rna_object_vgroup_name_set(ptr, value, lmd->defgrp_name, sizeof(lmd->defgrp_name));
 }
 
 static void rna_HookModifier_vgroup_set(PointerRNA *ptr, const char *value)
 {
-	HookModifierData *lmd= (HookModifierData*)ptr->data;
+	HookModifierData *lmd = (HookModifierData*)ptr->data;
 	rna_object_vgroup_name_set(ptr, value, lmd->name, sizeof(lmd->name));
 }
 
 static void rna_MaskModifier_vgroup_set(PointerRNA *ptr, const char *value)
 {
-	MaskModifierData *lmd= (MaskModifierData*)ptr->data;
+	MaskModifierData *lmd = (MaskModifierData*)ptr->data;
 	rna_object_vgroup_name_set(ptr, value, lmd->vgroup, sizeof(lmd->vgroup));
 }
 
 static void rna_MeshDeformModifier_vgroup_set(PointerRNA *ptr, const char *value)
 {
-	MeshDeformModifierData *lmd= (MeshDeformModifierData*)ptr->data;
+	MeshDeformModifierData *lmd = (MeshDeformModifierData*)ptr->data;
 	rna_object_vgroup_name_set(ptr, value, lmd->defgrp_name, sizeof(lmd->defgrp_name));
 }
 
 static void rna_SmoothModifier_vgroup_set(PointerRNA *ptr, const char *value)
 {
-	SmoothModifierData *lmd= (SmoothModifierData*)ptr->data;
+	SmoothModifierData *lmd = (SmoothModifierData*)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;
+	WaveModifierData *lmd = (WaveModifierData*)ptr->data;
 	rna_object_vgroup_name_set(ptr, value, lmd->defgrp_name, sizeof(lmd->defgrp_name));
 }
 
 static void rna_CastModifier_vgroup_set(PointerRNA *ptr, const char *value)
 {
-	CastModifierData *lmd= (CastModifierData*)ptr->data;
+	CastModifierData *lmd = (CastModifierData*)ptr->data;
 	rna_object_vgroup_name_set(ptr, value, lmd->defgrp_name, sizeof(lmd->defgrp_name));
 }
 
 static void rna_SolidifyModifier_vgroup_set(PointerRNA *ptr, const char *value)
 {
-	SolidifyModifierData *smd= (SolidifyModifierData*)ptr->data;
+	SolidifyModifierData *smd = (SolidifyModifierData*)ptr->data;
 	rna_object_vgroup_name_set(ptr, value, smd->defgrp_name, sizeof(smd->defgrp_name));
 }
 
@@ -398,15 +401,15 @@ static void rna_WeightVGModifier_vgroup_set(PointerRNA *ptr, const char *value)
 {
 	ModifierData *md = (ModifierData*)ptr->data;
 	if (md->type == eModifierType_WeightVGEdit) {
-		WeightVGEditModifierData *wmd= (WeightVGEditModifierData*)md;
+		WeightVGEditModifierData *wmd = (WeightVGEditModifierData*)md;
 		rna_object_vgroup_name_set(ptr, value, wmd->defgrp_name, sizeof(wmd->defgrp_name));
 	}
 	else if (md->type == eModifierType_WeightVGMix) {
-		WeightVGMixModifierData *wmd= (WeightVGMixModifierData*)md;
+		WeightVGMixModifierData *wmd = (WeightVGMixModifierData*)md;
 		rna_object_vgroup_name_set(ptr, value, wmd->defgrp_name_a, sizeof(wmd->defgrp_name_a));
 	}
 	else if (md->type == eModifierType_WeightVGProximity) {
-		WeightVGProximityModifierData *wmd= (WeightVGProximityModifierData*)md;
+		WeightVGProximityModifierData *wmd = (WeightVGProximityModifierData*)md;
 		rna_object_vgroup_name_set(ptr, value, wmd->defgrp_name, sizeof(wmd->defgrp_name));
 	}
 }
@@ -415,40 +418,40 @@ static void rna_WeightVGModifier_mask_vgroup_set(PointerRNA *ptr, const char *va
 {
 	ModifierData *md = (ModifierData*)ptr->data;
 	if (md->type == eModifierType_WeightVGEdit) {
-		WeightVGEditModifierData *wmd= (WeightVGEditModifierData*)md;
+		WeightVGEditModifierData *wmd = (WeightVGEditModifierData*)md;
 		rna_object_vgroup_name_set(ptr, value, wmd->mask_defgrp_name, sizeof(wmd->mask_defgrp_name));
 	}
 	else if (md->type == eModifierType_WeightVGMix) {
-		WeightVGMixModifierData *wmd= (WeightVGMixModifierData*)md;
+		WeightVGMixModifierData *wmd = (WeightVGMixModifierData*)md;
 		rna_object_vgroup_name_set(ptr, value, wmd->mask_defgrp_name, sizeof(wmd->mask_defgrp_name));
 	}
 	else if (md->type == eModifierType_WeightVGProximity) {
-		WeightVGProximityModifierData *wmd= (WeightVGProximityModifierData*)md;
+		WeightVGProximityModifierData *wmd = (WeightVGProximityModifierData*)md;
 		rna_object_vgroup_name_set(ptr, value, wmd->mask_defgrp_name, sizeof(wmd->mask_defgrp_name));
 	}
 }
 
 static void rna_WeightVGMixModifier_vgroup2_set(PointerRNA *ptr, const char *value)
 {
-	WeightVGMixModifierData *wmd= (WeightVGMixModifierData*)ptr->data;
+	WeightVGMixModifierData *wmd = (WeightVGMixModifierData*)ptr->data;
 	rna_object_vgroup_name_set(ptr, value, wmd->defgrp_name_b, sizeof(wmd->defgrp_name_b));
 }
 
 static void rna_MappingInfo_uvlayer_set(PointerRNA *ptr, const char *value)
 {
-	MappingInfoModifierData *mmd= (MappingInfoModifierData *)ptr->data;
+	MappingInfoModifierData *mmd = (MappingInfoModifierData *)ptr->data;
 	rna_object_uvlayer_name_set(ptr, value, mmd->uvlayer_name, sizeof(mmd->uvlayer_name));
 }
 
 static void rna_UVProjectModifier_uvlayer_set(PointerRNA *ptr, const char *value)
 {
-	UVProjectModifierData *umd= (UVProjectModifierData*)ptr->data;
+	UVProjectModifierData *umd = (UVProjectModifierData*)ptr->data;
 	rna_object_uvlayer_name_set(ptr, value, umd->uvlayer_name, sizeof(umd->uvlayer_name));
 }
 
 static void RNA_WarpModifier_vgroup_set(PointerRNA *ptr, const char *value)
 {
-	WarpModifierData *tmd= (WarpModifierData*)ptr->data;
+	WarpModifierData *tmd = (WarpModifierData*)ptr->data;
 	rna_object_vgroup_name_set(ptr, value, tmd->defgrp_name, sizeof(tmd->defgrp_name));
 }
 
@@ -469,37 +472,37 @@ static void rna_WeightVGModifier_mask_uvlayer_set(PointerRNA *ptr, const char *v
 	}
 }
 
-static void rna_MultiresModifier_level_range(PointerRNA *ptr, int *min, int *max)
+static void rna_MultiresModifier_level_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
 {
 	MultiresModifierData *mmd = (MultiresModifierData*)ptr->data;
 
 	*min = 0;
 	*max = mmd->totlvl; /* intentionally _not_ -1 */
-	*max= MAX2(0, *max);
+	*max = MAX2(0, *max);
 }
 
 static int rna_MultiresModifier_external_get(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
-	Mesh *me= ob->data;
+	Object *ob = (Object*)ptr->id.data;
+	Mesh *me = ob->data;
 
-	return CustomData_external_test(&me->fdata, CD_MDISPS);
+	return CustomData_external_test(&me->ldata, CD_MDISPS);
 }
 
 static void rna_MultiresModifier_filepath_get(PointerRNA *ptr, char *value)
 {
-	Object *ob= (Object*)ptr->id.data;
-	CustomDataExternal *external= ((Mesh*)ob->data)->fdata.external;
+	Object *ob = (Object*)ptr->id.data;
+	CustomDataExternal *external = ((Mesh*)ob->data)->ldata.external;
 
 	BLI_strncpy(value, (external)? external->filename: "", sizeof(external->filename));
 }
 
 static void rna_MultiresModifier_filepath_set(PointerRNA *ptr, const char *value)
 {
-	Object *ob= (Object*)ptr->id.data;
-	CustomDataExternal *external= ((Mesh*)ob->data)->fdata.external;
+	Object *ob = (Object*)ptr->id.data;
+	CustomDataExternal *external = ((Mesh*)ob->data)->ldata.external;
 
-	if(external && strcmp(external->filename, value)) {
+	if (external && strcmp(external->filename, value)) {
 		BLI_strncpy(external->filename, value, sizeof(external->filename));
 		multires_force_external_reload(ob);
 	}
@@ -507,20 +510,20 @@ static void rna_MultiresModifier_filepath_set(PointerRNA *ptr, const char *value
 
 static int rna_MultiresModifier_filepath_length(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
-	CustomDataExternal *external= ((Mesh*)ob->data)->fdata.external;
+	Object *ob = (Object*)ptr->id.data;
+	CustomDataExternal *external = ((Mesh*)ob->data)->ldata.external;
 
 	return strlen((external)? external->filename: "");
 }
 
 static void modifier_object_set(Object *self, Object **ob_p, int type, PointerRNA value)
 {
-	Object *ob= value.data;
+	Object *ob = value.data;
 
-	if(!self || ob != self) {
-		if(!ob || type == OB_EMPTY || ob->type == type) {
+	if (!self || ob != self) {
+		if (!ob || type == OB_EMPTY || ob->type == type) {
 			id_lib_extern((ID *)ob);
-			*ob_p= ob;
+			*ob_p = ob;
 		}
 	}
 }
@@ -567,15 +570,16 @@ static void rna_ShrinkwrapModifier_target_set(PointerRNA *ptr, PointerRNA value)
 
 static int rna_ShrinkwrapModifier_face_cull_get(PointerRNA *ptr)
 {
-	ShrinkwrapModifierData *swm= (ShrinkwrapModifierData*)ptr->data;
+	ShrinkwrapModifierData *swm = (ShrinkwrapModifierData*)ptr->data;
 	return swm->shrinkOpts & (MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE|MOD_SHRINKWRAP_CULL_TARGET_BACKFACE);
 }
 
 static void rna_ShrinkwrapModifier_face_cull_set(struct PointerRNA *ptr, int value)
 {
-	ShrinkwrapModifierData *swm= (ShrinkwrapModifierData*)ptr->data;
+	ShrinkwrapModifierData *swm = (ShrinkwrapModifierData*)ptr->data;
 	
-	swm->shrinkOpts= (swm->shrinkOpts & ~(MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE|MOD_SHRINKWRAP_CULL_TARGET_BACKFACE)) | value;
+	swm->shrinkOpts =
+	    (swm->shrinkOpts & ~(MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE|MOD_SHRINKWRAP_CULL_TARGET_BACKFACE)) | value;
 }
 
 static void rna_MeshDeformModifier_object_set(PointerRNA *ptr, PointerRNA value)
@@ -605,62 +609,62 @@ static int rna_MeshDeformModifier_is_bound_get(PointerRNA *ptr)
 
 static PointerRNA rna_SoftBodyModifier_settings_get(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 	return rna_pointer_inherit_refine(ptr, &RNA_SoftBodySettings, ob->soft);
 }
 
 static PointerRNA rna_SoftBodyModifier_point_cache_get(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 	return rna_pointer_inherit_refine(ptr, &RNA_PointCache, ob->soft->pointcache);
 }
 
 static PointerRNA rna_CollisionModifier_settings_get(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 	return rna_pointer_inherit_refine(ptr, &RNA_CollisionSettings, ob->pd);
 }
 
 static PointerRNA rna_UVProjector_object_get(PointerRNA *ptr)
 {
-	Object **ob= (Object**)ptr->data;
+	Object **ob = (Object**)ptr->data;
 	return rna_pointer_inherit_refine(ptr, &RNA_Object, *ob);
 }
 
 static void rna_UVProjector_object_set(PointerRNA *ptr, PointerRNA value)
 {
-	Object **ob= (Object**)ptr->data;
+	Object **ob = (Object**)ptr->data;
 
-	if(*ob)
+	if (*ob)
 		id_us_min((ID*)*ob);
-	if(value.data)
+	if (value.data)
 		id_us_plus((ID*)value.data);
 
-	*ob= value.data;
+	*ob = value.data;
 }
 
 static void rna_UVProjectModifier_num_projectors_set(PointerRNA *ptr, int value)
 {
-	UVProjectModifierData *md= (UVProjectModifierData*)ptr->data;
+	UVProjectModifierData *md = (UVProjectModifierData*)ptr->data;
 	int a;
 
-	md->num_projectors= CLAMPIS(value, 1, MOD_UVPROJECT_MAX);
-	for(a=md->num_projectors; a<MOD_UVPROJECT_MAX; a++)
-		md->projectors[a]= NULL;
+	md->num_projectors = CLAMPIS(value, 1, MOD_UVPROJECT_MAX);
+	for (a = md->num_projectors; a<MOD_UVPROJECT_MAX; a++)
+		md->projectors[a] = NULL;
 }
 
 static int rna_OceanModifier_is_build_enabled_get(PointerRNA *UNUSED(ptr))
 {
 #ifdef WITH_OCEANSIM
 	return 1;
-#else // WITH_OCEANSIM
+#else /* WITH_OCEANSIM */
 	return 0;
-#endif // WITH_OCEANSIM
+#endif /* WITH_OCEANSIM */
 }
 
 static void rna_OceanModifier_init_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	OceanModifierData *omd= (OceanModifierData*)ptr->data;
+	OceanModifierData *omd = (OceanModifierData*)ptr->data;
 	
 	omd->refresh |= (MOD_OCEAN_REFRESH_RESET|MOD_OCEAN_REFRESH_SIM|MOD_OCEAN_REFRESH_CLEAR_CACHE);
 	
@@ -669,7 +673,7 @@ static void rna_OceanModifier_init_update(Main *bmain, Scene *scene, PointerRNA
 
 static void rna_OceanModifier_sim_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	OceanModifierData *omd= (OceanModifierData*)ptr->data;
+	OceanModifierData *omd = (OceanModifierData*)ptr->data;
 	
 	omd->refresh |= MOD_OCEAN_REFRESH_SIM;
 	
@@ -678,7 +682,7 @@ static void rna_OceanModifier_sim_update(Main *bmain, Scene *scene, PointerRNA *
 
 static void rna_OceanModifier_topology_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	OceanModifierData *omd= (OceanModifierData*)ptr->data;
+	OceanModifierData *omd = (OceanModifierData*)ptr->data;
 	
 	omd->refresh |= MOD_OCEAN_REFRESH_TOPOLOGY;
 	
@@ -687,7 +691,7 @@ static void rna_OceanModifier_topology_update(Main *bmain, Scene *scene, Pointer
 
 static void rna_OceanModifier_ocean_chop_set(PointerRNA *ptr, float value)
 {
-	OceanModifierData *omd= (OceanModifierData*)ptr->data;
+	OceanModifierData *omd = (OceanModifierData*)ptr->data;
 	float old_value = omd->chop_amount;
 	
 	omd->chop_amount = value;
@@ -702,30 +706,30 @@ static void rna_OceanModifier_ocean_chop_set(PointerRNA *ptr, float value)
 
 static float rna_EdgeSplitModifier_split_angle_get(PointerRNA *ptr)
 {
-	EdgeSplitModifierData *md= (EdgeSplitModifierData*)ptr->data;
+	EdgeSplitModifierData *md = (EdgeSplitModifierData*)ptr->data;
 	return DEG2RADF(md->split_angle);
 }
 
 static void rna_EdgeSplitModifier_split_angle_set(PointerRNA *ptr, float value)
 {
-	EdgeSplitModifierData *md= (EdgeSplitModifierData*)ptr->data;
-	value= RAD2DEGF(value);
+	EdgeSplitModifierData *md = (EdgeSplitModifierData*)ptr->data;
+	value = RAD2DEGF(value);
 	CLAMP(value, 0.0f, 180.0f);
-	md->split_angle= (int)value;
+	md->split_angle = (int)value;
 }
 
 static float rna_BevelModifier_angle_limit_get(PointerRNA *ptr)
 {
-	BevelModifierData *md= (BevelModifierData*)ptr->data;
+	BevelModifierData *md = (BevelModifierData*)ptr->data;
 	return DEG2RADF(md->bevel_angle);
 }
 
 static void rna_BevelModifier_angle_limit_set(PointerRNA *ptr, float value)
 {
-	BevelModifierData *md= (BevelModifierData*)ptr->data;
-	value= RAD2DEGF(value);
+	BevelModifierData *md = (BevelModifierData*)ptr->data;
+	value = RAD2DEGF(value);
 	CLAMP(value, 0.0f, 180.0f);
-	md->bevel_angle= (int)value;
+	md->bevel_angle = (int)value;
 }
 
 #else
@@ -737,7 +741,7 @@ static void rna_def_property_subdivision_common(StructRNA *srna, const char type
 		{1, "SIMPLE", 0, "Simple", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	PropertyRNA *prop= RNA_def_property(srna, "subdivision_type", PROP_ENUM, PROP_NONE);
+	PropertyRNA *prop = RNA_def_property(srna, "subdivision_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, type);
 	RNA_def_property_enum_items(prop, prop_subdivision_type_items);
 	RNA_def_property_ui_text(prop, "Subdivision Type", "Select type of subdivision algorithm");
@@ -749,30 +753,30 @@ static void rna_def_modifier_subsurf(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "SubsurfModifier", "Modifier");
+	srna = RNA_def_struct(brna, "SubsurfModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Subsurf Modifier", "Subdivision surface modifier");
 	RNA_def_struct_sdna(srna, "SubsurfModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_SUBSURF);
 
 	rna_def_property_subdivision_common(srna, "subdivType");
 
-	prop= RNA_def_property(srna, "levels", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "levels", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "levels");
 	RNA_def_property_ui_range(prop, 0, 6, 1, 0);
 	RNA_def_property_ui_text(prop, "Levels", "Number of subdivisions to perform");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "render_levels", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "render_levels", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "renderLevels");
 	RNA_def_property_ui_range(prop, 0, 6, 1, 0);
 	RNA_def_property_ui_text(prop, "Render Levels", "Number of subdivisions to perform when rendering");
 
-	prop= RNA_def_property(srna, "show_only_control_edges", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_only_control_edges", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", eSubsurfModifierFlag_ControlEdges);
 	RNA_def_property_ui_text(prop, "Optimal Display", "Skip drawing/rendering of interior subdivided edges");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 	
-	prop= RNA_def_property(srna, "use_subsurf_uv", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_subsurf_uv", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", eSubsurfModifierFlag_SubsurfUv);
 	RNA_def_property_ui_text(prop, "Subdivide UVs", "Use subsurf to subdivide UVs");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -783,30 +787,31 @@ static void rna_def_modifier_generic_map_info(StructRNA *srna)
 	static EnumPropertyItem prop_texture_coordinates_items[] = {
 		{MOD_DISP_MAP_LOCAL, "LOCAL", 0, "Local", "Use the local coordinate system for the texture coordinates"},
 		{MOD_DISP_MAP_GLOBAL, "GLOBAL", 0, "Global", "Use the global coordinate system for the texture coordinates"},
-		{MOD_DISP_MAP_OBJECT, "OBJECT", 0, "Object", "Use the linked object's local coordinate system for the texture coordinates"},
+		{MOD_DISP_MAP_OBJECT, "OBJECT", 0, "Object",
+		                      "Use the linked object's local coordinate system for the texture coordinates"},
 		{MOD_DISP_MAP_UV, "UV", 0, "UV", "Use UV coordinates for the texture coordinates"},
 		{0, NULL, 0, NULL, NULL}};
 
 	PropertyRNA *prop;
 
-	prop= RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Texture", "");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "texmapping");
 	RNA_def_property_enum_items(prop, prop_texture_coordinates_items);
 	RNA_def_property_ui_text(prop, "Texture Coordinates", "");
 	RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
 
-	prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
+	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_MappingInfo_uvlayer_set");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "texture_coords_object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "texture_coords_object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "map_object");
 	RNA_def_property_ui_text(prop, "Texture Coordinate Object", "Object to set the texture coordinates");
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
@@ -829,47 +834,47 @@ static void rna_def_modifier_warp(BlenderRNA *brna)
 		{eWarp_Falloff_Const,	"CONSTANT", ICON_NOCURVE, "Constant", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "WarpModifier", "Modifier");
+	srna = RNA_def_struct(brna, "WarpModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Warp Modifier", "Warp modifier");
 	RNA_def_struct_sdna(srna, "WarpModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_WARP);
 
-	prop= RNA_def_property(srna, "object_from", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object_from", PROP_POINTER, PROP_NONE);
 	RNA_def_property_ui_text(prop, "From", "Object to transform from");
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
 	RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
 
-	prop= RNA_def_property(srna, "object_to", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object_to", PROP_POINTER, PROP_NONE);
 	RNA_def_property_ui_text(prop, "To", "Object to transform to");
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
 	RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
 
-	prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
 	RNA_def_property_ui_range(prop, -100, 100, 10, 2);
 	RNA_def_property_ui_text(prop, "Strength", "");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, prop_falloff_items);
 	RNA_def_property_ui_text(prop, "Falloff Type", "");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_UNSIGNED | PROP_DISTANCE);
+	prop = RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_UNSIGNED | PROP_DISTANCE);
 	RNA_def_property_ui_text(prop, "Radius", "Radius to apply");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "curfalloff");
 	RNA_def_property_ui_text(prop, "Falloff Curve", "Custom Lamp Falloff Curve");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_volume_preserve", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_volume_preserve", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WARP_VOLUME_PRESERVE);
 	RNA_def_property_ui_text(prop, "Preserve Volume", "Preserve volume when rotations are used");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+	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 for modulating the deform");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "RNA_WarpModifier_vgroup_set");
@@ -883,51 +888,53 @@ static void rna_def_modifier_multires(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "MultiresModifier", "Modifier");
+	srna = RNA_def_struct(brna, "MultiresModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Multires Modifier", "Multiresolution mesh modifier");
 	RNA_def_struct_sdna(srna, "MultiresModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_MULTIRES);
 
 	rna_def_property_subdivision_common(srna, "simple");
 
-	prop= RNA_def_property(srna, "levels", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "levels", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "lvl");
 	RNA_def_property_ui_text(prop, "Levels", "Number of subdivisions to use in the viewport");
 	RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MultiresModifier_level_range");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "sculpt_levels", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "sculpt_levels", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "sculptlvl");
 	RNA_def_property_ui_text(prop, "Sculpt Levels", "Number of subdivisions to use in sculpt mode");
 	RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MultiresModifier_level_range");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "render_levels", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "render_levels", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "renderlvl");
 	RNA_def_property_ui_text(prop, "Render Levels", "The subdivision level visible at render time");
 	RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MultiresModifier_level_range");
 
-	prop= RNA_def_property(srna, "total_levels", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "total_levels", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "totlvl");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Total Levels", "Number of subdivisions for which displacements are stored");
 
-	prop= RNA_def_property(srna, "is_external", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_external", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_MultiresModifier_external_get", NULL);
-	RNA_def_property_ui_text(prop, "External", "Store multires displacements outside the .blend file, to save memory");
+	RNA_def_property_ui_text(prop, "External",
+	                         "Store multires displacements outside the .blend file, to save memory");
 
-	prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
-	RNA_def_property_string_funcs(prop, "rna_MultiresModifier_filepath_get", "rna_MultiresModifier_filepath_length", "rna_MultiresModifier_filepath_set");
+	prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+	RNA_def_property_string_funcs(prop, "rna_MultiresModifier_filepath_get", "rna_MultiresModifier_filepath_length",
+	                              "rna_MultiresModifier_filepath_set");
 	RNA_def_property_ui_text(prop, "File Path", "Path to external displacements file");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "show_only_control_edges", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_only_control_edges", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", eMultiresModifierFlag_ControlEdges);
 	RNA_def_property_ui_text(prop, "Optimal Display", "Skip drawing/rendering of interior subdivided edges");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_subsurf_uv", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_subsurf_uv", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flags", eMultiresModifierFlag_PlainUv);
 	RNA_def_property_ui_text(prop, "Subdivide UVs", "Use subsurf to subdivide UVs");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -938,22 +945,29 @@ static void rna_def_modifier_lattice(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "LatticeModifier", "Modifier");
+	srna = RNA_def_struct(brna, "LatticeModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Lattice Modifier", "Lattice deformation modifier");
 	RNA_def_struct_sdna(srna, "LatticeModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_LATTICE);
 
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Object", "Lattice object to deform with");
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_LatticeModifier_object_set", NULL, "rna_Lattice_object_poll");
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
 	RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
 
-	prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "name");
-	RNA_def_property_ui_text(prop, "Vertex Group", "Name of Vertex Group which determines influence of modifier per point");
+	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_LatticeModifier_vgroup_set");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+	
+	prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+	RNA_def_property_ui_range(prop, 0, 1, 10, 2);
+	RNA_def_property_ui_text(prop, "Strength", "Strength of modifier effect");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 }
 
 static void rna_def_modifier_curve(BlenderRNA *brna)
@@ -970,24 +984,25 @@ static void rna_def_modifier_curve(BlenderRNA *brna)
 		{MOD_CURVE_NEGZ, "NEG_Z", 0, "-Z", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "CurveModifier", "Modifier");
+	srna = RNA_def_struct(brna, "CurveModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Curve Modifier", "Curve deformation modifier");
 	RNA_def_struct_sdna(srna, "CurveModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_CURVE);
 
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Object", "Curve object to deform with");
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_CurveModifier_object_set", NULL, "rna_Curve_object_poll");
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
 	RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
 
-	prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "name");
-	RNA_def_property_ui_text(prop, "Vertex Group", "Name of Vertex Group which determines influence of modifier per point");
+	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_CurveModifier_vgroup_set");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "deform_axis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "deform_axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "defaxis");
 	RNA_def_property_enum_items(prop, prop_deform_axis_items);
 	RNA_def_property_ui_text(prop, "Deform Axis", "The axis that the curve deforms along");
@@ -999,29 +1014,29 @@ static void rna_def_modifier_build(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "BuildModifier", "Modifier");
+	srna = RNA_def_struct(brna, "BuildModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Build Modifier", "Build effect modifier");
 	RNA_def_struct_sdna(srna, "BuildModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_BUILD);
 
-	prop= RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_TIME);
 	RNA_def_property_float_sdna(prop, NULL, "start");
 	RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
 	RNA_def_property_ui_text(prop, "Start", "Start frame of the effect");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "frame_duration", PROP_FLOAT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_duration", PROP_FLOAT, PROP_TIME);
 	RNA_def_property_float_sdna(prop, NULL, "length");
 	RNA_def_property_range(prop, 1, MAXFRAMEF);
 	RNA_def_property_ui_text(prop, "Length", "Total time the build effect requires");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_random_order", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_random_order", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "randomize", 1);
 	RNA_def_property_ui_text(prop, "Randomize", "Randomize the faces or edges during build");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, 1, MAXFRAMEF);
 	RNA_def_property_ui_text(prop, "Seed", "Seed for random if used");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -1032,59 +1047,59 @@ static void rna_def_modifier_mirror(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "MirrorModifier", "Modifier");
+	srna = RNA_def_struct(brna, "MirrorModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Mirror Modifier", "Mirroring modifier");
 	RNA_def_struct_sdna(srna, "MirrorModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_MIRROR);
 
-	prop= RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_AXIS_X);
 	RNA_def_property_ui_text(prop, "X", "Enable X axis mirror");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_AXIS_Y);
 	RNA_def_property_ui_text(prop, "Y", "Enable Y axis mirror");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_AXIS_Z);
 	RNA_def_property_ui_text(prop, "Z", "Enable Z axis mirror");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_clip", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_clip", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_CLIPPING);
 	RNA_def_property_ui_text(prop, "Clip", "Prevent vertices from going through the mirror during transform");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_mirror_vertex_groups", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_mirror_vertex_groups", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_VGROUP);
 	RNA_def_property_ui_text(prop, "Mirror Vertex Groups", "Mirror vertex groups (e.g. .R->.L)");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 	
-	prop= RNA_def_property(srna, "use_mirror_merge", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_mirror_merge", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MOD_MIR_NO_MERGE);
 	RNA_def_property_ui_text(prop, "Merge Vertices", "Merge vertices within the merge threshold");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_mirror_u", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_mirror_u", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_MIRROR_U);
 	RNA_def_property_ui_text(prop, "Mirror U", "Mirror the U texture coordinate around the 0.5 point");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_mirror_v", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_mirror_v", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_MIRROR_V);
 	RNA_def_property_ui_text(prop, "Mirror V", "Mirror the V texture coordinate around the 0.5 point");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "merge_threshold", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "merge_threshold", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "tolerance");
 	RNA_def_property_range(prop, 0, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0, 1, 0.01, 6);
 	RNA_def_property_ui_text(prop, "Merge Limit", "Distance from axis within which mirrored vertices are merged");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "mirror_object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "mirror_object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "mirror_ob");
 	RNA_def_property_ui_text(prop, "Mirror Object", "Object to use as mirror");
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
@@ -1096,19 +1111,19 @@ static void rna_def_modifier_decimate(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "DecimateModifier", "Modifier");
+	srna = RNA_def_struct(brna, "DecimateModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Decimate Modifier", "Decimation modifier");
 	RNA_def_struct_sdna(srna, "DecimateModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_DECIM);
 
-	prop= RNA_def_property(srna, "ratio", PROP_FLOAT, PROP_NONE);
+	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_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "face_count", PROP_INT, PROP_NONE);
+	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");
@@ -1119,120 +1134,123 @@ static void rna_def_modifier_wave(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "WaveModifier", "Modifier");
+	srna = RNA_def_struct(brna, "WaveModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Wave Modifier", "Wave effect modifier");
 	RNA_def_struct_sdna(srna, "WaveModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_WAVE);
 
-	prop= RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_X);
 	RNA_def_property_ui_text(prop, "X", "X axis motion");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_Y);
 	RNA_def_property_ui_text(prop, "Y", "Y axis motion");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_CYCL);
 	RNA_def_property_ui_text(prop, "Cyclic", "Cyclic wave effect");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_NORM);
 	RNA_def_property_ui_text(prop, "Normals", "Displace along normals");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_normal_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_normal_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_NORM_X);
 	RNA_def_property_ui_text(prop, "X Normal", "Enable displacement along the X normal");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_normal_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_normal_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_NORM_Y);
 	RNA_def_property_ui_text(prop, "Y Normal", "Enable displacement along the Y normal");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_normal_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_normal_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_NORM_Z);
 	RNA_def_property_ui_text(prop, "Z Normal", "Enable displacement along the Z normal");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "time_offset", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "time_offset", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "timeoffs");
 	RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
-	RNA_def_property_ui_text(prop, "Time Offset", "Either the starting frame (for positive speed) or ending frame (for negative speed.)");
+	RNA_def_property_ui_text(prop, "Time Offset",
+	                         "Either the starting frame (for positive speed) or ending frame (for negative speed.)");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
+	prop = RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
 	RNA_def_property_float_sdna(prop, NULL, "lifetime");
 	RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
 	RNA_def_property_ui_text(prop, "Lifetime",  "Lifetime of the wave in frames, zero means infinite");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "damping_time", PROP_FLOAT, PROP_TIME);
+	prop = RNA_def_property(srna, "damping_time", PROP_FLOAT, PROP_TIME);
 	RNA_def_property_float_sdna(prop, NULL, "damp");
 	RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
 	RNA_def_property_ui_text(prop, "Damping Time",  "Number of frames in which the wave damps out after it dies");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "falloff");
 	RNA_def_property_range(prop, 0, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0, 100, 100, 2);
 	RNA_def_property_ui_text(prop, "Falloff Radius",  "Distance after which it fades out");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "start_position_x", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "start_position_x", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "startx");
 	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
 	RNA_def_property_ui_range(prop, -100, 100, 100, 2);
 	RNA_def_property_ui_text(prop, "Start Position X",  "X coordinate of the start position");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "start_position_y", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "start_position_y", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "starty");
 	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
 	RNA_def_property_ui_range(prop, -100, 100, 100, 2);
 	RNA_def_property_ui_text(prop, "Start Position Y",  "Y coordinate of the start position");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "start_position_object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "start_position_object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "objectcenter");
 	RNA_def_property_ui_text(prop, "Start Position Object", "Object which defines the wave center");
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
 	RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
 
-	prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+	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 for modulating the wave");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WaveModifier_vgroup_set");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "speed", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "speed", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
 	RNA_def_property_ui_range(prop, -1, 1, 10, 2);
 	RNA_def_property_ui_text(prop, "Speed", "Speed of the wave, towards the starting point when negative");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
 	RNA_def_property_ui_range(prop, -2, 2, 10, 2);
 	RNA_def_property_ui_text(prop, "Height", "Height of the wave");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "width", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_range(prop, 0, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0, 5, 10, 2);
 	RNA_def_property_ui_text(prop, "Width", "Distance between the waves");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "narrowness", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "narrowness", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "narrow");
 	RNA_def_property_range(prop, 0, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0, 10, 10, 2);
-	RNA_def_property_ui_text(prop, "Narrowness", "Distance between the top and the base of a wave, the higher the value, the more narrow the wave");
+	RNA_def_property_ui_text(prop, "Narrowness",
+	                         "Distance between the top and the base of a wave, the higher the value, "
+	                         "the more narrow the wave");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
 	rna_def_modifier_generic_map_info(srna);
@@ -1243,44 +1261,46 @@ static void rna_def_modifier_armature(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "ArmatureModifier", "Modifier");
+	srna = RNA_def_struct(brna, "ArmatureModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Armature Modifier", "Armature deformation modifier");
 	RNA_def_struct_sdna(srna, "ArmatureModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_ARMATURE);
 
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Object", "Armature object to deform with");
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_ArmatureModifier_object_set", NULL, "rna_Armature_object_poll");
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
 	RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
 
-	prop= RNA_def_property(srna, "use_bone_envelopes", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_bone_envelopes", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_ENVELOPE);
 	RNA_def_property_ui_text(prop, "Use Bone Envelopes", "Bind Bone envelopes to armature modifier");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_vertex_groups", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_vertex_groups", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_VGROUP);
 	RNA_def_property_ui_text(prop, "Use Vertex Groups", "Bind vertex groups to armature modifier");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 	
-	prop= RNA_def_property(srna, "use_deform_preserve_volume", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_deform_preserve_volume", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_QUATERNION);
 	RNA_def_property_ui_text(prop, "Preserve Volume", "Deform rotation interpolation with quaternions");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_multi_modifier", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_multi_modifier", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "multi", 0);
-	RNA_def_property_ui_text(prop, "Multi Modifier",  "Use same input as previous modifier, and mix results using overall vgroup");
+	RNA_def_property_ui_text(prop, "Multi Modifier",
+	                         "Use same input as previous modifier, and mix results using overall vgroup");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 	
-	prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+	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_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_ArmatureModifier_vgroup_set");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_INVERT_VGROUP);
 	RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -1291,35 +1311,37 @@ static void rna_def_modifier_hook(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "HookModifier", "Modifier");
+	srna = RNA_def_struct(brna, "HookModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Hook Modifier", "Hook modifier to modify the location of vertices");
 	RNA_def_struct_sdna(srna, "HookModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_HOOK);
 
-	prop= RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_range(prop, 0, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0, 100, 100, 2);
 	RNA_def_property_ui_text(prop, "Falloff",  "If not zero, the distance from the hook where influence ends");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "force", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "force", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0, 1);
 	RNA_def_property_ui_text(prop, "Force",  "Relative force of the hook");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Object", "Parent Object for hook, also recalculates and clears offset");
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
 	RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
 	
-	prop= RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "subtarget");
-	RNA_def_property_ui_text(prop, "Sub-Target", "Name of Parent Bone for hook (if applicable), also recalculates and clears offset");
+	RNA_def_property_ui_text(prop, "Sub-Target",
+	                         "Name of Parent Bone for hook (if applicable), also recalculates and clears offset");
 	RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
 
-	prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "name");
-	RNA_def_property_ui_text(prop, "Vertex Group", "Name of Vertex Group which determines influence of modifier per point");
+	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_HookModifier_vgroup_set");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 }
@@ -1329,18 +1351,18 @@ static void rna_def_modifier_softbody(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "SoftBodyModifier", "Modifier");
+	srna = RNA_def_struct(brna, "SoftBodyModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Soft Body Modifier", "Soft body simulation modifier");
 	RNA_def_struct_sdna(srna, "SoftbodyModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_SOFT);
 
-	prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "SoftBodySettings");
 	RNA_def_property_pointer_funcs(prop, "rna_SoftBodyModifier_settings_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Soft Body Settings", "");
 
-	prop= RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "PointCache");
 	RNA_def_property_pointer_funcs(prop, "rna_SoftBodyModifier_point_cache_get", NULL, NULL, NULL);
@@ -1353,23 +1375,24 @@ static void rna_def_modifier_boolean(BlenderRNA *brna)
 	PropertyRNA *prop;
 
 	static EnumPropertyItem prop_operation_items[] = {
-		{eBooleanModifierOp_Intersect, "INTERSECT", 0, "Intersect", "Keep the part of the mesh that intersects with the other selected object"},
+		{eBooleanModifierOp_Intersect, "INTERSECT", 0, "Intersect",
+		                               "Keep the part of the mesh that intersects with the other selected object"},
 		{eBooleanModifierOp_Union, "UNION", 0, "Union", "Combine two meshes in an additive way"},
 		{eBooleanModifierOp_Difference, "DIFFERENCE", 0, "Difference", "Combine two meshes in a subtractive way"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "BooleanModifier", "Modifier");
+	srna = RNA_def_struct(brna, "BooleanModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Boolean Modifier", "Boolean operations modifier");
 	RNA_def_struct_sdna(srna, "BooleanModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_BOOLEAN);
 
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Object", "Mesh object to use for Boolean operation");
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_BooleanModifier_object_set", NULL, "rna_Mesh_object_poll");
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
 	RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
 
-	prop= RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, prop_operation_items);
 	RNA_def_property_ui_text(prop, "Operation", "");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -1382,35 +1405,36 @@ static void rna_def_modifier_array(BlenderRNA *brna)
 
 	static EnumPropertyItem prop_fit_type_items[] = {
 		{MOD_ARR_FIXEDCOUNT, "FIXED_COUNT", 0, "Fixed Count", "Duplicate the object a certain number of times"},
-		{MOD_ARR_FITLENGTH, "FIT_LENGTH", 0, "Fit Length", "Duplicate the object as many times as fits in a certain length"},
+		{MOD_ARR_FITLENGTH, "FIT_LENGTH", 0, "Fit Length",
+		                    "Duplicate the object as many times as fits in a certain length"},
 		{MOD_ARR_FITCURVE, "FIT_CURVE", 0, "Fit Curve", "Fit the duplicated objects to a curve"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "ArrayModifier", "Modifier");
+	srna = RNA_def_struct(brna, "ArrayModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Array Modifier", "Array duplication modifier");
 	RNA_def_struct_sdna(srna, "ArrayModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_ARRAY);
 
 	/* Length parameters */
-	prop= RNA_def_property(srna, "fit_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "fit_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, prop_fit_type_items);
 	RNA_def_property_ui_text(prop, "Fit Type", "Array length calculation method");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "count", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "count", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, 1, INT_MAX);
 	RNA_def_property_ui_range(prop, 1, 1000, 1, 0);
 	RNA_def_property_ui_text(prop, "Count",  "Number of duplicates to make");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "fit_length", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "fit_length", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "length");
 	RNA_def_property_range(prop, 0, INT_MAX);
 	RNA_def_property_ui_range(prop, 0, 10000, 10, 2);
 	RNA_def_property_ui_text(prop, "Length", "Length to fit array within");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "curve_ob");
 	RNA_def_property_ui_text(prop, "Curve", "Curve object to fit array length to");
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_ArrayModifier_curve_set", NULL, "rna_Curve_object_poll");
@@ -1418,38 +1442,41 @@ static void rna_def_modifier_array(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
 
 	/* Offset parameters */
-	prop= RNA_def_property(srna, "use_constant_offset", PROP_BOOLEAN, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "use_constant_offset", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "offset_type", MOD_ARR_OFF_CONST);
-	RNA_def_property_ui_text(prop, "Constant Offset", "Add a constant offset");
+	RNA_def_property_ui_text(prop, "Constant Offset", "Add a constant offset");;
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 	
-	prop= RNA_def_property(srna, "constant_offset_displace", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "constant_offset_displace", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "offset");
 	RNA_def_property_ui_text(prop, "Constant Offset Displacement", "Value for the distance between arrayed items");
+	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_relative_offset", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_relative_offset", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "offset_type", MOD_ARR_OFF_RELATIVE);
 	RNA_def_property_ui_text(prop, "Relative Offset", "Add an offset relative to the object's bounding box");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "relative_offset_displace", PROP_FLOAT, PROP_NONE); /* PROP_TRANSLATION causes units to be used which we dont want */
+		/* PROP_TRANSLATION causes units to be used which we don't want */
+	prop = RNA_def_property(srna, "relative_offset_displace", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "scale");
-	RNA_def_property_ui_text(prop, "Relative Offset Displacement", "The size of the geometry will determine the distance between arrayed items");
+	RNA_def_property_ui_text(prop, "Relative Offset Displacement",
+	                         "The size of the geometry will determine the distance between arrayed items");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
 	/* Vertex merging parameters */
-	prop= RNA_def_property(srna, "use_merge_vertices", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_merge_vertices", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_ARR_MERGE);
 	RNA_def_property_ui_text(prop, "Merge Vertices", "Merge vertices in adjacent duplicates");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_merge_vertices_cap", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_merge_vertices_cap", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_ARR_MERGEFINAL);
 	RNA_def_property_ui_text(prop, "Merge Vertices", "Merge vertices in first and last duplicates");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "merge_threshold", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "merge_threshold", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "merge_dist");
 	RNA_def_property_range(prop, 0, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0, 1, 1, 4);
@@ -1457,25 +1484,27 @@ static void rna_def_modifier_array(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
 	/* Offset object */
-	prop= RNA_def_property(srna, "use_object_offset", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_object_offset", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "offset_type", MOD_ARR_OFF_OBJ);
 	RNA_def_property_ui_text(prop, "Object Offset", "Add another object's transformation to the total offset");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "offset_object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "offset_object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "offset_ob");
-	RNA_def_property_ui_text(prop, "Object Offset", "Use the location and rotation of another object to determine the distance and rotational change between arrayed items");
+	RNA_def_property_ui_text(prop, "Object Offset",
+	                         "Use the location and rotation of another object to determine the distance and "
+	                         "rotational change between arrayed items");
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
 	RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
 	
 	/* Caps */
-	prop= RNA_def_property(srna, "start_cap", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "start_cap", PROP_POINTER, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Start Cap", "Mesh object to use as a start cap");
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_ArrayModifier_start_cap_set", NULL, "rna_Mesh_object_poll");
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "end_cap", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "end_cap", PROP_POINTER, PROP_NONE);
 	RNA_def_property_ui_text(prop, "End Cap", "Mesh object to use as an end cap");
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_ArrayModifier_end_cap_set", NULL, "rna_Mesh_object_poll");
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
@@ -1487,30 +1516,31 @@ static void rna_def_modifier_edgesplit(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "EdgeSplitModifier", "Modifier");
+	srna = RNA_def_struct(brna, "EdgeSplitModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "EdgeSplit Modifier", "Edge splitting modifier to create sharp edges");
 	RNA_def_struct_sdna(srna, "EdgeSplitModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_EDGESPLIT);
 
 #if 1 /* expose as radians */
-	prop= RNA_def_property(srna, "split_angle", PROP_FLOAT, PROP_ANGLE);
-	RNA_def_property_float_funcs(prop, "rna_EdgeSplitModifier_split_angle_get", "rna_EdgeSplitModifier_split_angle_set", NULL);
+	prop = RNA_def_property(srna, "split_angle", PROP_FLOAT, PROP_ANGLE);
+	RNA_def_property_float_funcs(prop, "rna_EdgeSplitModifier_split_angle_get",
+	                             "rna_EdgeSplitModifier_split_angle_set", NULL);
 	RNA_def_property_range(prop, 0, DEG2RAD(180));
 	RNA_def_property_ui_range(prop, 0, DEG2RAD(180), 100, 2);
 #else
-	prop= RNA_def_property(srna, "split_angle", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "split_angle", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0, 180);
 	RNA_def_property_ui_range(prop, 0, 180, 100, 2);
 #endif
 	RNA_def_property_ui_text(prop, "Split Angle", "Angle above which to split edges");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_edge_angle", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_edge_angle", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_EDGESPLIT_FROMANGLE);
 	RNA_def_property_ui_text(prop, "Use Edge Angle", "Split edges with high angle between faces");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_edge_sharp", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_edge_sharp", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_EDGESPLIT_FROMFLAG);
 	RNA_def_property_ui_text(prop, "Use Sharp Edges", "Split edges that are marked as sharp");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -1525,35 +1555,38 @@ static void rna_def_modifier_displace(BlenderRNA *brna)
 		{MOD_DISP_DIR_X, "X", 0, "X", "Use the texture's intensity value to displace in the X direction"},
 		{MOD_DISP_DIR_Y, "Y", 0, "Y", "Use the texture's intensity value to displace in the Y direction"},
 		{MOD_DISP_DIR_Z, "Z", 0, "Z", "Use the texture's intensity value to displace in the Z direction"},
-		{MOD_DISP_DIR_NOR, "NORMAL", 0, "Normal", "Use the texture's intensity value to displace in the normal direction"},
-		{MOD_DISP_DIR_RGB_XYZ, "RGB_TO_XYZ", 0, "RGB to XYZ", "Use the texture's RGB values to displace the mesh in the XYZ direction"},
+		{MOD_DISP_DIR_NOR, "NORMAL", 0, "Normal",
+		                   "Use the texture's intensity value to displace in the normal direction"},
+		{MOD_DISP_DIR_RGB_XYZ, "RGB_TO_XYZ", 0, "RGB to XYZ",
+		                       "Use the texture's RGB values to displace the mesh in the XYZ direction"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "DisplaceModifier", "Modifier");
+	srna = RNA_def_struct(brna, "DisplaceModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Displace Modifier", "Displacement modifier");
 	RNA_def_struct_sdna(srna, "DisplaceModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_DISPLACE);
 
-	prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+	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_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_DisplaceModifier_vgroup_set");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "mid_level", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "mid_level", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "midlevel");
 	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Midlevel", "Material value that gives no displacement");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
 	RNA_def_property_ui_range(prop, -100, 100, 10, 3);
 	RNA_def_property_ui_text(prop, "Strength", "Amount to displace geometry");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, prop_direction_items);
 	RNA_def_property_ui_text(prop, "Direction", "");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -1566,71 +1599,72 @@ static void rna_def_modifier_uvproject(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "UVProjectModifier", "Modifier");
+	srna = RNA_def_struct(brna, "UVProjectModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "UV Project Modifier", "UV projection modifier to set UVs from a projector");
 	RNA_def_struct_sdna(srna, "UVProjectModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_UVPROJECT);
 
-	prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
+	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_UVProjectModifier_uvlayer_set");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "projector_count", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "projector_count", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "num_projectors");
 	RNA_def_property_ui_text(prop, "Number of Projectors", "Number of projectors to use");
 	RNA_def_property_int_funcs(prop, NULL, "rna_UVProjectModifier_num_projectors_set", NULL);
 	RNA_def_property_range(prop, 1, MOD_UVPROJECT_MAX);
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "projectors", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "projectors", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "UVProjector");
-	RNA_def_property_collection_funcs(prop, "rna_UVProject_projectors_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
+	RNA_def_property_collection_funcs(prop, "rna_UVProject_projectors_begin", "rna_iterator_array_next",
+	                                  "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Projectors", "");
 
-	prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Image", "");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "aspect_x", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "aspect_x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "aspectx");
 	RNA_def_property_range(prop, 1, FLT_MAX);
 	RNA_def_property_ui_range(prop, 1, 1000, 1, 3);
 	RNA_def_property_ui_text(prop, "Horizontal Aspect Ratio", "");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "aspect_y", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "aspect_y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "aspecty");
 	RNA_def_property_range(prop, 1, FLT_MAX);
 	RNA_def_property_ui_range(prop, 1, 1000, 1, 3);
 	RNA_def_property_ui_text(prop, "Vertical Aspect Ratio", "");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 	
-	prop= RNA_def_property(srna, "scale_x", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "scale_x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "scalex");
 	RNA_def_property_range(prop, 0, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0, 1000, 1, 3);
 	RNA_def_property_ui_text(prop, "Horizontal Scale", "");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "scale_y", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "scale_y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "scaley");
 	RNA_def_property_range(prop, 0, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0, 1000, 1, 3);
 	RNA_def_property_ui_text(prop, "Vertical Scale", "");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_image_override", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_image_override", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_UVPROJECT_OVERRIDEIMAGE);
 	RNA_def_property_ui_text(prop, "Override Image", "Override faces' current images with the given image");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	srna= RNA_def_struct(brna, "UVProjector", NULL);
+	srna = RNA_def_struct(brna, "UVProjector", NULL);
 	RNA_def_struct_ui_text(srna, "UVProjector", "UV projector used by the UV project modifier");
 
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_pointer_funcs(prop, "rna_UVProjector_object_get", "rna_UVProjector_object_set", NULL, NULL);
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
@@ -1643,42 +1677,43 @@ static void rna_def_modifier_smooth(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "SmoothModifier", "Modifier");
+	srna = RNA_def_struct(brna, "SmoothModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Smooth Modifier", "Smoothing effect modifier");
 	RNA_def_struct_sdna(srna, "SmoothModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_SMOOTH);
 
-	prop= RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SMOOTH_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);
+	prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SMOOTH_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);
+	prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SMOOTH_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, "factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "fac");
 	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
 	RNA_def_property_ui_range(prop, -10, 10, 1, 3);
 	RNA_def_property_ui_text(prop, "Factor", "Strength of modifier effect");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
+	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, 30, 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);
+	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_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_SmoothModifier_vgroup_set");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 }
@@ -1694,68 +1729,71 @@ static void rna_def_modifier_cast(BlenderRNA *brna)
 		{MOD_CAST_TYPE_CUBOID, "CUBOID", 0, "Cuboid", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "CastModifier", "Modifier");
+	srna = RNA_def_struct(brna, "CastModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Cast Modifier", "Modifier to cast to other shapes");
 	RNA_def_struct_sdna(srna, "CastModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_CAST);
 
-	prop= RNA_def_property(srna, "cast_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "cast_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, prop_cast_type_items);
 	RNA_def_property_ui_text(prop, "Cast Type", "Target object shape");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 	
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
-	RNA_def_property_ui_text(prop, "Object", "Control object: if available, its location determines the center of the effect");
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	RNA_def_property_ui_text(prop, "Object",
+	                         "Control object: if available, its location determines the center of the effect");
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_CastModifier_object_set", NULL, NULL);
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
 	RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
 
-	prop= RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_X);
 	RNA_def_property_ui_text(prop, "X", "");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_Y);
 	RNA_def_property_ui_text(prop, "Y", "");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_Z);
 	RNA_def_property_ui_text(prop, "Z", "");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 	
-	prop= RNA_def_property(srna, "use_radius_as_size", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_radius_as_size", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_SIZE_FROM_RADIUS);
 	RNA_def_property_ui_text(prop, "From Radius", "Use radius as size of projection shape (0 = auto)");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 	
-	prop= RNA_def_property(srna, "use_transform", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_transform", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_USE_OB_TRANSFORM);
 	RNA_def_property_ui_text(prop, "Use transform", "Use object transform to control projection shape");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 	
-	prop= RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "fac");
 	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
 	RNA_def_property_ui_range(prop, -10, 10, 5, 2);
 	RNA_def_property_ui_text(prop, "Factor", "");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_range(prop, 0, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0, 100, 5, 2);
-	RNA_def_property_ui_text(prop, "Radius", "Only deform vertices within this distance from the center of the effect (leave as 0 for infinite.)");
+	RNA_def_property_ui_text(prop, "Radius",
+	                         "Only deform vertices within this distance from the center of the effect "
+	                         "(leave as 0 for infinite.)");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0, 100, 5, 2);
 	RNA_def_property_ui_text(prop, "Size", "Size of projection shape (leave as 0 for auto)");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+	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");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_CastModifier_vgroup_set");
@@ -1773,46 +1811,48 @@ static void rna_def_modifier_meshdeform(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}};
 #endif
 
-	srna= RNA_def_struct(brna, "MeshDeformModifier", "Modifier");
+	srna = RNA_def_struct(brna, "MeshDeformModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "MeshDeform Modifier", "Mesh deformation modifier to deform with other meshes");
 	RNA_def_struct_sdna(srna, "MeshDeformModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_MESHDEFORM);
 
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Object", "Mesh object to deform with");
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_MeshDeformModifier_object_set", NULL, NULL);
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
 	RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
 	
-	prop= RNA_def_property(srna, "is_bound", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_bound", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_MeshDeformModifier_is_bound_get", NULL);
 	RNA_def_property_ui_text(prop, "Bound", "Whether geometry has been bound to control cage");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	
-	prop= RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MDEF_INVERT_VGROUP);
 	RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+	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");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshDeformModifier_vgroup_set");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "precision", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "precision", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "gridsize");
 	RNA_def_property_range(prop, 2, 10);
 	RNA_def_property_ui_text(prop, "Precision", "The grid size for binding");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_dynamic_bind", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_dynamic_bind", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MDEF_DYNAMIC_BIND);
-	RNA_def_property_ui_text(prop, "Dynamic", "Recompute binding dynamically on top of other deformers (slower and more memory consuming)");
+	RNA_def_property_ui_text(prop, "Dynamic",
+	                         "Recompute binding dynamically on top of other deformers "
+	                         "(slower and more memory consuming)");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
 #if 0
-	prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, prop_mode_items);
 	RNA_def_property_ui_text(prop, "Mode", "Method of binding vertices are bound to cage mesh");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -1824,12 +1864,12 @@ static void rna_def_modifier_particlesystem(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "ParticleSystemModifier", "Modifier");
+	srna = RNA_def_struct(brna, "ParticleSystemModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "ParticleSystem Modifier", "Particle system simulation modifier");
 	RNA_def_struct_sdna(srna, "ParticleSystemModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_PARTICLES);
 	
-	prop= RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "psys");
 	RNA_def_property_ui_text(prop, "Particle System", "Particle System that this modifier controls");
@@ -1847,76 +1887,76 @@ static void rna_def_modifier_particleinstance(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}
 	};
 
-	srna= RNA_def_struct(brna, "ParticleInstanceModifier", "Modifier");
+	srna = RNA_def_struct(brna, "ParticleInstanceModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "ParticleInstance Modifier", "Particle system instancing modifier");
 	RNA_def_struct_sdna(srna, "ParticleInstanceModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_PARTICLES);
 
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "ob");
 	RNA_def_property_ui_text(prop, "Object", "Object that has the particle system");
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
 	RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
 
-	prop= RNA_def_property(srna, "particle_system_index", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "particle_system_index", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "psys");
 	RNA_def_property_range(prop, 1, 10);
 	RNA_def_property_ui_text(prop, "Particle System Number", "");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "axis");
 	RNA_def_property_enum_items(prop, particleinstance_axis);
 	RNA_def_property_ui_text(prop, "Axis", "Pole axis for rotation");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 	
-	prop= RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Parents);
 	RNA_def_property_ui_text(prop, "Normal", "Create instances from normal particles");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_children", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_children", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Children);
 	RNA_def_property_ui_text(prop, "Children", "Create instances from child particles");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_path", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_path", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Path);
 	RNA_def_property_ui_text(prop, "Path", "Create instances along particle paths");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Unborn);
 	RNA_def_property_ui_text(prop, "Unborn", "Show instances when particles are unborn");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "show_alive", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_alive", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Alive);
 	RNA_def_property_ui_text(prop, "Alive", "Show instances when particles are alive");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "show_dead", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_dead", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Dead);
 	RNA_def_property_ui_text(prop, "Dead", "Show instances when particles are dead");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_preserve_shape", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_preserve_shape", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_KeepShape);
 	RNA_def_property_ui_text(prop, "Keep Shape", "Don't stretch the object");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_size", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_size", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_UseSize);
 	RNA_def_property_ui_text(prop, "Size", "Use particle size to scale the instances");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "position", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "position", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "position");
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_text(prop, "Position", "Position along path");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "random_position", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "random_position", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "random_position");
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_text(prop, "Random Position", "Randomize position along path");
@@ -1928,46 +1968,47 @@ static void rna_def_modifier_explode(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "ExplodeModifier", "Modifier");
+	srna = RNA_def_struct(brna, "ExplodeModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Explode Modifier", "Explosion effect modifier based on a particle system");
 	RNA_def_struct_sdna(srna, "ExplodeModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_EXPLODE);
 
-	prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
-	RNA_def_property_string_funcs(prop, "rna_ExplodeModifier_vgroup_get", "rna_ExplodeModifier_vgroup_length", "rna_ExplodeModifier_vgroup_set");
+	prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_funcs(prop, "rna_ExplodeModifier_vgroup_get", "rna_ExplodeModifier_vgroup_length",
+	                              "rna_ExplodeModifier_vgroup_set");
 	RNA_def_property_ui_text(prop, "Vertex Group", "");
 
-	prop= RNA_def_property(srna, "protect", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "protect", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0, 1);
 	RNA_def_property_ui_text(prop, "Protect", "Clean vertex group edges");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_edge_cut", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_edge_cut", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_EdgeCut);
 	RNA_def_property_ui_text(prop, "Cut Edges", "Cut face edges for nicer shrapnel");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_Unborn);
 	RNA_def_property_ui_text(prop, "Unborn", "Show mesh when particles are unborn");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "show_alive", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_alive", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_Alive);
 	RNA_def_property_ui_text(prop, "Alive", "Show mesh when particles are alive");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "show_dead", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_dead", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_Dead);
 	RNA_def_property_ui_text(prop, "Dead", "Show mesh when particles are dead");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_size", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_size", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_PaSize);
 	RNA_def_property_ui_text(prop, "Size", "Use particle size for the shrapnel");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "particle_uv", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "particle_uv", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "uvname");
 	RNA_def_property_string_maxlength(prop, MAX_CUSTOMDATA_LAYER_NAME);
 	RNA_def_property_ui_text(prop, "Particle UV", "UV map to change with particle age");
@@ -1979,22 +2020,22 @@ static void rna_def_modifier_cloth(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "ClothModifier", "Modifier");
+	srna = RNA_def_struct(brna, "ClothModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Cloth Modifier", "Cloth simulation modifier");
 	RNA_def_struct_sdna(srna, "ClothModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_CLOTH);
 	
-	prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "sim_parms");
 	RNA_def_property_ui_text(prop, "Cloth Settings", "");
 	
-	prop= RNA_def_property(srna, "collision_settings", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "collision_settings", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "coll_parms");
 	RNA_def_property_ui_text(prop, "Cloth Collision Settings", "");
 	
-	prop= RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_ui_text(prop, "Point Cache", "");
 }
@@ -2011,24 +2052,24 @@ static void rna_def_modifier_smoke(BlenderRNA *brna)
 			{MOD_SMOKE_TYPE_COLL, "COLLISION", 0, "Collision", ""},
 			{0, NULL, 0, NULL, NULL}};
 	
-	srna= RNA_def_struct(brna, "SmokeModifier", "Modifier");
+	srna = RNA_def_struct(brna, "SmokeModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Smoke Modifier", "Smoke simulation modifier");
 	RNA_def_struct_sdna(srna, "SmokeModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_SMOKE);
 	
-	prop= RNA_def_property(srna, "domain_settings", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "domain_settings", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "domain");
 	RNA_def_property_ui_text(prop, "Domain Settings", "");
 	
-	prop= RNA_def_property(srna, "flow_settings", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "flow_settings", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "flow");
 	RNA_def_property_ui_text(prop, "Flow Settings", "");
 	
-	prop= RNA_def_property(srna, "coll_settings", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "coll_settings", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "coll");
 	RNA_def_property_ui_text(prop, "Collision Settings", "");
 	
-	prop= RNA_def_property(srna, "smoke_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "smoke_type", PROP_ENUM, PROP_NONE);
 	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", "");
@@ -2040,20 +2081,20 @@ static void rna_def_modifier_dynamic_paint(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "DynamicPaintModifier", "Modifier");
+	srna = RNA_def_struct(brna, "DynamicPaintModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Dynamic Paint Modifier", "Dynamic Paint modifier");
 	RNA_def_struct_sdna(srna, "DynamicPaintModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_DYNAMICPAINT);
 	
-	prop= RNA_def_property(srna, "canvas_settings", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "canvas_settings", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "canvas");
 	RNA_def_property_ui_text(prop, "Canvas Settings", "");
 	
-	prop= RNA_def_property(srna, "brush_settings", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "brush_settings", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "brush");
 	RNA_def_property_ui_text(prop, "Brush Settings", "");
 
-	prop= RNA_def_property(srna, "ui_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "ui_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, prop_dynamicpaint_type_items);
@@ -2065,12 +2106,13 @@ static void rna_def_modifier_collision(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "CollisionModifier", "Modifier");
-	RNA_def_struct_ui_text(srna, "Collision Modifier", "Collision modifier defining modifier stack position used for collision");
+	srna = RNA_def_struct(brna, "CollisionModifier", "Modifier");
+	RNA_def_struct_ui_text(srna, "Collision Modifier",
+	                       "Collision modifier defining modifier stack position used for collision");
 	RNA_def_struct_sdna(srna, "CollisionModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_PHYSICS);
 
-	prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "CollisionSettings");
 	RNA_def_property_pointer_funcs(prop, "rna_CollisionModifier_settings_get", NULL, NULL, NULL);
@@ -2085,7 +2127,9 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
 	static EnumPropertyItem prop_limit_method_items[] = {
 		{0, "NONE", 0, "None", "Bevel the entire mesh by a constant amount"},
 		{BME_BEVEL_ANGLE, "ANGLE", 0, "Angle", "Only bevel edges with sharp enough angles between faces"},
-		{BME_BEVEL_WEIGHT, "WEIGHT", 0, "Weight", "Use bevel weights to determine how much bevel is applied; apply them separately in vert/edge select mode"},
+		{BME_BEVEL_WEIGHT, "WEIGHT", 0, "Weight",
+		                   "Use bevel weights to determine how much bevel is applied; "
+		                   "apply them separately in vert/edge select mode"},
 		{0, NULL, 0, NULL, NULL}};
 
 	static EnumPropertyItem prop_edge_weight_method_items[] = {
@@ -2094,48 +2138,63 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
 		{BME_BEVEL_EMAX, "LARGEST", 0, "Largest", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "BevelModifier", "Modifier");
+	srna = RNA_def_struct(brna, "BevelModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Bevel Modifier", "Bevel modifier to make edges and vertices more rounded");
 	RNA_def_struct_sdna(srna, "BevelModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_BEVEL);
 
-	prop= RNA_def_property(srna, "width", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "value");
 	RNA_def_property_range(prop, 0, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0, 10, 0.1, 4);
 	RNA_def_property_ui_text(prop, "Width", "Bevel value/amount");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_only_vertices", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_only_vertices", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", BME_BEVEL_VERT);
 	RNA_def_property_ui_text(prop, "Only Vertices", "Bevel verts/corners, not edges");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "lim_flags");
 	RNA_def_property_enum_items(prop, prop_limit_method_items);
 	RNA_def_property_ui_text(prop, "Limit Method", "");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "edge_weight_method", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "edge_weight_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "e_flags");
 	RNA_def_property_enum_items(prop, prop_edge_weight_method_items);
 	RNA_def_property_ui_text(prop, "Edge Weight Method", "What edge weight to use for weighting a vertex");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
 #if 1 /* expose as radians */
-	prop= RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_ANGLE);
-	RNA_def_property_float_funcs(prop, "rna_BevelModifier_angle_limit_get", "rna_BevelModifier_angle_limit_set", NULL);
+	prop = RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_ANGLE);
+	RNA_def_property_float_funcs(prop, "rna_BevelModifier_angle_limit_get",
+	                             "rna_BevelModifier_angle_limit_set", NULL);
 	RNA_def_property_range(prop, 0, DEG2RAD(180));
 	RNA_def_property_ui_range(prop, 0, DEG2RAD(180), 100, 2);
 #else
-	prop= RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "bevel_angle");
 	RNA_def_property_range(prop, 0, 180);
 	RNA_def_property_ui_range(prop, 0, 180, 100, 2);
 #endif
 	RNA_def_property_ui_text(prop, "Angle", "Angle above which to bevel edges");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+#ifdef USE_BM_BEVEL_OP_AS_MOD
+	prop = RNA_def_property(srna, "use_even_offset", PROP_BOOLEAN, PROP_NONE); /* name matches solidify */
+	RNA_def_property_boolean_sdna(prop, NULL, "flags", BME_BEVEL_EVEN);
+	RNA_def_property_ui_text(prop, "Even", "Use even bevel distance correction");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+	prop = RNA_def_property(srna, "use_distance_offset", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flags", BME_BEVEL_DIST);
+	RNA_def_property_ui_text(prop, "Distance",
+	                         "Use the width as a distance in rather then a factor of the face size");
+	RNA_def_property_update(prop, 0, "rna_Modifier_update");
+#endif
+
 }
 
 static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
@@ -2144,9 +2203,12 @@ static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
 	PropertyRNA *prop;
 
 	static EnumPropertyItem shrink_type_items[] = {
-		{MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACEPOINT", 0, "Nearest Surface Point", "Shrink the mesh to the nearest target surface"},
-		{MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project", "Shrink the mesh to the nearest target surface along a given axis"},
-		{MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex", "Shrink the mesh to the nearest target vertex"},
+		{MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACEPOINT", 0, "Nearest Surface Point",
+		                                 "Shrink the mesh to the nearest target surface"},
+		{MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project",
+		                         "Shrink the mesh to the nearest target surface along a given axis"},
+		{MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex",
+		                                "Shrink the mesh to the nearest target vertex"},
 		{0, NULL, 0, NULL, NULL}};
 	
 	static EnumPropertyItem shrink_face_cull_items[] = {
@@ -2155,83 +2217,89 @@ static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
 		{MOD_SHRINKWRAP_CULL_TARGET_BACKFACE, "BACK", 0, "Back", "No projection when behind the face"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "ShrinkwrapModifier", "Modifier");
-	RNA_def_struct_ui_text(srna, "Shrinkwrap Modifier", "Shrink wrapping modifier to shrink wrap and object to a target");
+	srna = RNA_def_struct(brna, "ShrinkwrapModifier", "Modifier");
+	RNA_def_struct_ui_text(srna, "Shrinkwrap Modifier",
+	                       "Shrink wrapping modifier to shrink wrap and object to a target");
 	RNA_def_struct_sdna(srna, "ShrinkwrapModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_SHRINKWRAP);
 
-	prop= RNA_def_property(srna, "wrap_method", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "wrap_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "shrinkType");
 	RNA_def_property_enum_items(prop, shrink_type_items);
 	RNA_def_property_ui_text(prop, "Mode", "");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "cull_face", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "cull_face", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "shrinkOpts");
 	RNA_def_property_enum_items(prop, shrink_face_cull_items);
-	RNA_def_property_enum_funcs(prop, "rna_ShrinkwrapModifier_face_cull_get", "rna_ShrinkwrapModifier_face_cull_set", NULL);
-	RNA_def_property_ui_text(prop, "Face Cull", "Stop vertices from projecting to a face on the target when facing towards/away");
+	RNA_def_property_enum_funcs(prop, "rna_ShrinkwrapModifier_face_cull_get",
+	                            "rna_ShrinkwrapModifier_face_cull_set", NULL);
+	RNA_def_property_ui_text(prop, "Face Cull",
+	                         "Stop vertices from projecting to a face on the target when facing towards/away");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Target", "Mesh target to shrink to");
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_ShrinkwrapModifier_target_set", NULL, "rna_Mesh_object_poll");
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
 	RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
 
-	prop= RNA_def_property(srna, "auxiliary_target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "auxiliary_target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "auxTarget");
 	RNA_def_property_ui_text(prop, "Auxiliary Target", "Additional mesh target to shrink to");
-	RNA_def_property_pointer_funcs(prop, NULL, "rna_ShrinkwrapModifier_auxiliary_target_set", NULL, "rna_Mesh_object_poll");
+	RNA_def_property_pointer_funcs(prop, NULL, "rna_ShrinkwrapModifier_auxiliary_target_set", NULL,
+	                               "rna_Mesh_object_poll");
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
 	RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
 
-	prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "vgroup_name");
 	RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ShrinkwrapModifier_vgroup_set");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "keepDist");
 	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
 	RNA_def_property_ui_range(prop, -100, 100, 1, 2);
 	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, "use_project_x", PROP_BOOLEAN, PROP_NONE);
+	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", "");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_project_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_project_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS);
 	RNA_def_property_ui_text(prop, "Y", "");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_project_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_project_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS);
 	RNA_def_property_ui_text(prop, "Z", "");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 	
-	prop= RNA_def_property(srna, "subsurf_levels", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "subsurf_levels", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "subsurfLevels");
 	RNA_def_property_range(prop, 0, 6);
 	RNA_def_property_ui_range(prop, 0, 6, 1, 0);
-	RNA_def_property_ui_text(prop, "Subsurf Levels", "Number of subdivisions that must be performed before extracting vertices' positions and normals");
+	RNA_def_property_ui_text(prop, "Subsurf Levels",
+	                         "Number of subdivisions that must be performed before extracting vertices' "
+	                         "positions and normals");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_negative_direction", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_negative_direction", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "shrinkOpts", MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR);
 	RNA_def_property_ui_text(prop, "Negative", "Allow vertices to move in the negative direction of axis");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_positive_direction", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_positive_direction", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "shrinkOpts", MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR);
 	RNA_def_property_ui_text(prop, "Positive", "Allow vertices to move in the positive direction of axis");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_keep_above_surface", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_keep_above_surface", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "shrinkOpts", MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE);
 	RNA_def_property_ui_text(prop, "Keep Above Surface", "");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -2242,12 +2310,12 @@ static void rna_def_modifier_fluidsim(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "FluidSimulationModifier", "Modifier");
+	srna = RNA_def_struct(brna, "FluidSimulationModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Fluid Simulation Modifier", "Fluid simulation modifier");
 	RNA_def_struct_sdna(srna, "FluidsimModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_FLUIDSIM);
 
-	prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "fss");
 	RNA_def_property_ui_text(prop, "Settings", "Settings for how this object is used in the fluid simulation");
@@ -2263,30 +2331,30 @@ static void rna_def_modifier_mask(BlenderRNA *brna)
 		{MOD_MASK_MODE_ARM, "ARMATURE", 0, "Armature", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "MaskModifier", "Modifier");
+	srna = RNA_def_struct(brna, "MaskModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Mask Modifier", "Mask modifier to hide parts of the mesh");
 	RNA_def_struct_sdna(srna, "MaskModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_MASK);
 
-	prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, modifier_mask_mode_items);
 	RNA_def_property_ui_text(prop, "Mode", "");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "armature", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "armature", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "ob_arm");
 	RNA_def_property_ui_text(prop, "Armature", "Armature to use as source of bones to mask");
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_MaskModifier_armature_set", NULL, "rna_Armature_object_poll");
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
 	RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
 
-	prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "vgroup");
 	RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MaskModifier_vgroup_set");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MASK_INV);
 	RNA_def_property_ui_text(prop, "Invert", "Use vertices that are not part of region defined");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -2301,43 +2369,45 @@ static void rna_def_modifier_simpledeform(BlenderRNA *brna)
 		{MOD_SIMPLEDEFORM_MODE_TWIST, "TWIST", 0, "Twist", "Rotate around the Z axis of the modifier space"},
 		{MOD_SIMPLEDEFORM_MODE_BEND, "BEND", 0, "Bend", "Bend the mesh over the Z axis of the modifier space"},
 		{MOD_SIMPLEDEFORM_MODE_TAPER, "TAPER", 0, "Taper", "Linearly scale along Z axis of the modifier space"},
-		{MOD_SIMPLEDEFORM_MODE_STRETCH, "STRETCH", 0, "Stretch", "Stretch the object along the Z axis of the modifier space"},
+		{MOD_SIMPLEDEFORM_MODE_STRETCH, "STRETCH", 0, "Stretch",
+		                                "Stretch the object along the Z axis of the modifier space"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "SimpleDeformModifier", "Modifier");
-	RNA_def_struct_ui_text(srna, "SimpleDeform Modifier", "Simple deformation modifier to apply effects such as twisting and bending");
+	srna = RNA_def_struct(brna, "SimpleDeformModifier", "Modifier");
+	RNA_def_struct_ui_text(srna, "SimpleDeform Modifier",
+	                       "Simple deformation modifier to apply effects such as twisting and bending");
 	RNA_def_struct_sdna(srna, "SimpleDeformModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_SIMPLEDEFORM);
 
-	prop= RNA_def_property(srna, "deform_method", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "deform_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "mode");
 	RNA_def_property_enum_items(prop, simple_deform_mode_items);
 	RNA_def_property_ui_text(prop, "Mode", "");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "vgroup_name");
 	RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SimpleDeformModifier_vgroup_set");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "origin", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "origin", PROP_POINTER, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Origin", "Origin of modifier space coordinates");
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
 	RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
 
-	prop= RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "originOpts", MOD_SIMPLEDEFORM_ORIGIN_LOCAL);
 	RNA_def_property_ui_text(prop, "Relative", "Set the origin of deform space to be relative to the object");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
 	RNA_def_property_ui_range(prop, -10, 10, 1, 3);
 	RNA_def_property_ui_text(prop, "Factor", "Amount to deform object");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "limits", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "limits", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "limit");
 	RNA_def_property_array(prop, 2);
 	RNA_def_property_range(prop, 0, 1);
@@ -2345,12 +2415,12 @@ static void rna_def_modifier_simpledeform(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Limits", "Lower/Upper limits for deform");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "lock_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "axis", MOD_SIMPLEDEFORM_LOCK_AXIS_X);
 	RNA_def_property_ui_text(prop, "Lock X Axis", "Do not allow tapering along the X axis");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "lock_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "axis", MOD_SIMPLEDEFORM_LOCK_AXIS_Y);
 	RNA_def_property_ui_text(prop, "Lock Y Axis", "Do not allow tapering along the Y axis");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -2360,8 +2430,9 @@ static void rna_def_modifier_surface(BlenderRNA *brna)
 {
 	StructRNA *srna;
 
-	srna= RNA_def_struct(brna, "SurfaceModifier", "Modifier");
-	RNA_def_struct_ui_text(srna, "Surface Modifier", "Surface modifier defining modifier stack position used for surface fields");
+	srna = RNA_def_struct(brna, "SurfaceModifier", "Modifier");
+	RNA_def_struct_ui_text(srna, "Surface Modifier",
+	                       "Surface modifier defining modifier stack position used for surface fields");
 	RNA_def_struct_sdna(srna, "SurfaceModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_PHYSICS);
 }
@@ -2371,87 +2442,93 @@ static void rna_def_modifier_solidify(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "SolidifyModifier", "Modifier");
-	RNA_def_struct_ui_text(srna, "Solidify Modifier", "Create a solid skin by extruding, compensating for sharp angles");
+	srna = RNA_def_struct(brna, "SolidifyModifier", "Modifier");
+	RNA_def_struct_ui_text(srna, "Solidify Modifier",
+	                       "Create a solid skin by extruding, compensating for sharp angles");
 	RNA_def_struct_sdna(srna, "SolidifyModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_SOLIDIFY);
 
-	prop= RNA_def_property(srna, "thickness", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "thickness", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "offset");
 	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
 	RNA_def_property_ui_range(prop, -10, 10, 0.1, 4);
 	RNA_def_property_ui_text(prop, "Thickness", "Thickness of the shell");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "thickness_vertex_group", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "thickness_vertex_group", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "offset_fac_vg");
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
-	RNA_def_property_ui_text(prop, "Vertex Group Factor", "Thickness factor to use for zero vertex group influence");
+	RNA_def_property_ui_text(prop, "Vertex Group Factor",
+	                         "Thickness factor to use for zero vertex group influence");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "offset_fac");
 	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
 	RNA_def_property_ui_range(prop, -1, 1, 0.1, 4);
 	RNA_def_property_ui_text(prop, "Offset", "Offset the thickness from the center");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "edge_crease_inner", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "edge_crease_inner", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "crease_inner");
 	RNA_def_property_range(prop, 0, 1);
 	RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Inner Crease", "Assign a crease to inner edges");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "edge_crease_outer", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "edge_crease_outer", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "crease_outer");
 	RNA_def_property_range(prop, 0, 1);
 	RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Outer Crease", "Assign a crease to outer edges");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "edge_crease_rim", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "edge_crease_rim", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "crease_rim");
 	RNA_def_property_range(prop, 0, 1);
 	RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Rim Crease", "Assign a crease to the edges making up the rim");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "material_offset", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "material_offset", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "mat_ofs");
 	RNA_def_property_range(prop, SHRT_MIN, SHRT_MAX);
 	RNA_def_property_ui_text(prop, "Material Offset", "Offset material index of generated faces");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "material_offset_rim", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "material_offset_rim", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "mat_ofs_rim");
 	RNA_def_property_range(prop, SHRT_MIN, SHRT_MAX);
 	RNA_def_property_ui_text(prop, "Rim Material Offset", "Offset material index of generated rim faces");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+	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");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SolidifyModifier_vgroup_set");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_rim", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_rim", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_RIM);
-	RNA_def_property_ui_text(prop, "Fill Rim", "Create edge loops between the inner and outer surfaces on face edges (slow, disable when not needed)");
+	RNA_def_property_ui_text(prop, "Fill Rim",
+	                         "Create edge loops between the inner and outer surfaces on face edges "
+	                         "(slow, disable when not needed)");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_even_offset", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_even_offset", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_EVEN);
-	RNA_def_property_ui_text(prop, "Even Thickness", "Maintain thickness by adjusting for sharp corners (slow, disable when not needed)");
+	RNA_def_property_ui_text(prop, "Even Thickness",
+	                         "Maintain thickness by adjusting for sharp corners (slow, disable when not needed)");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_quality_normals", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_quality_normals", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_NORMAL_CALC);
-	RNA_def_property_ui_text(prop, "High Quality Normals", "Calculate normals which result in more even thickness (slow, disable when not needed)");
+	RNA_def_property_ui_text(prop, "High Quality Normals",
+	                         "Calculate normals which result in more even thickness (slow, disable when not needed)");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_VGROUP_INV);
 	RNA_def_property_ui_text(prop, "Vertex Group Invert", "Invert the vertex group influence");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -2461,7 +2538,7 @@ static void rna_def_modifier_solidify(BlenderRNA *brna)
 
 static void rna_def_modifier_screw(BlenderRNA *brna)
 {
-	static EnumPropertyItem axis_items[]= {
+	static EnumPropertyItem axis_items[] = {
 		{0, "X", 0, "X Axis", ""},
 		{1, "Y", 0, "Y Axis", ""},
 		{2, "Z", 0, "Z Axis", ""},
@@ -2470,63 +2547,63 @@ static void rna_def_modifier_screw(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "ScrewModifier", "Modifier");
+	srna = RNA_def_struct(brna, "ScrewModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Screw Modifier", "Revolve edges");
 	RNA_def_struct_sdna(srna, "ScrewModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_SCREW);
 
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "ob_axis");
 	RNA_def_property_ui_text(prop, "Object", "Object to define the screw axis");
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
 	RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
 
-	prop= RNA_def_property(srna, "steps", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "steps", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_range(prop, 2, 10000);
 	RNA_def_property_ui_range(prop, 3, 512, 1, 0);
 	RNA_def_property_ui_text(prop, "Steps", "Number of steps in the revolution");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "render_steps", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "render_steps", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_range(prop, 2, 10000);
 	RNA_def_property_ui_range(prop, 2, 512, 1, 0);
 	RNA_def_property_ui_text(prop, "Render Steps", "Number of steps in the revolution");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "iterations", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "iter");
 	RNA_def_property_range(prop, 1, 10000);
 	RNA_def_property_ui_range(prop, 1, 100, 1, 0);
 	RNA_def_property_ui_text(prop, "Iterations", "Number of times to apply the screw operation");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, axis_items);
 	RNA_def_property_ui_text(prop, "Axis", "Screw axis");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_ui_range(prop, 0, -M_PI*2, M_PI*2, 2);
 	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
 	RNA_def_property_ui_text(prop, "Angle", "Angle of revolution");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "screw_offset", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "screw_offset", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "screw_ofs");
 	RNA_def_property_ui_text(prop, "Screw", "Offset the revolution along its axis");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_normal_flip", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_normal_flip", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_NORMAL_FLIP);
 	RNA_def_property_ui_text(prop, "Flip", "Flip normals of lathed faces");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_normal_calculate", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_normal_calculate", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_NORMAL_CALC);
 	RNA_def_property_ui_text(prop, "Calc Order", "Calculate the order of edges (needed for meshes, but not curves)");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_object_screw_offset", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_object_screw_offset", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_OBJECT_OFFSET);
 	RNA_def_property_ui_text(prop, "Object Screw", "Use the distance between the objects to make a screw");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -2559,41 +2636,41 @@ static void rna_def_modifier_weightvg_mask(BlenderRNA *brna, StructRNA *srna)
 
 	PropertyRNA *prop;
 
-	prop= RNA_def_property(srna, "mask_constant", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "mask_constant", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 0);
 	RNA_def_property_ui_text(prop, "Influence", "Global influence of current modifications on vgroup");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "mask_vertex_group", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "mask_vertex_group", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "mask_defgrp_name");
 	RNA_def_property_ui_text(prop, "Mask VGroup", "Masking vertex group name");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGModifier_mask_vgroup_set");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "mask_texture", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "mask_texture", PROP_POINTER, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Masking Tex", "Masking texture");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "mask_tex_use_channel", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mask_tex_use_channel", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, weightvg_mask_tex_used_items);
 	RNA_def_property_ui_text(prop, "Use Channel", "Which texture channel to use for masking");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "mask_tex_mapping", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mask_tex_mapping", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, weightvg_mask_tex_map_items);
 	RNA_def_property_ui_text(prop, "Texture Coordinates", "Which texture coordinates "
 	                                                      "to use for mapping");
 	RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
 
-	prop= RNA_def_property(srna, "mask_tex_uv_layer", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "mask_tex_uv_layer", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "mask_tex_uvlayer_name");
 	RNA_def_property_ui_text(prop, "UV Map", "UV map name");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGModifier_mask_uvlayer_set");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "mask_tex_map_object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "mask_tex_map_object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "mask_tex_map_obj");
 	RNA_def_property_ui_text(prop, "Texture Coordinate Object", "Which object to take texture "
 	                                                            "coordinates from");
@@ -2618,48 +2695,48 @@ static void rna_def_modifier_weightvgedit(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "VertexWeightEditModifier", "Modifier");
+	srna = RNA_def_struct(brna, "VertexWeightEditModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "WeightVG Edit Modifier",
 	                       "Edit the weights of vertices in a group");
 	RNA_def_struct_sdna(srna, "WeightVGEditModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_VERTEX_WEIGHT);
 
-	prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+	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");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGModifier_vgroup_set");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, weightvg_edit_falloff_type_items);
-	RNA_def_property_ui_text(prop, "Falloff Type", "How weights are mapped to there new values");
+	RNA_def_property_ui_text(prop, "Falloff Type", "How weights are mapped to their new values");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_add", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_add", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "edit_flags", MOD_WVG_EDIT_ADD2VG);
 	RNA_def_property_ui_text(prop, "Group Add", "Add vertices with weight over threshold "
 	                                            "to vgroup");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "use_remove", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_remove", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "edit_flags", MOD_WVG_EDIT_REMFVG);
 	RNA_def_property_ui_text(prop, "Group Remove", "Remove vertices with weight below threshold "
 	                                               "from vgroup");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "default_weight", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "default_weight", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0, 1.0f);
 	RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 0);
 	RNA_def_property_ui_text(prop, "Default Weight", "Default weight a vertex will have if "
 	                                                 "it is not in the vgroup");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "map_curve", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "map_curve", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "cmap_curve");
 	RNA_def_property_ui_text(prop, "Mapping Curve", "Custom mapping curve");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "add_threshold", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "add_threshold", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "add_threshold");
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 0);
@@ -2667,7 +2744,7 @@ static void rna_def_modifier_weightvgedit(BlenderRNA *brna)
 	                                                "to be added to the vgroup");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "remove_threshold", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "remove_threshold", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "rem_threshold");
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 0);
@@ -2692,55 +2769,56 @@ static void rna_def_modifier_weightvgmix(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}};
 
 	static EnumPropertyItem weightvg_mix_set_items[] = {
-		{MOD_WVG_SET_ALL,   "ALL",   0, "All", "Affect all vertices (might add some to VGroup A)"},
-		{MOD_WVG_SET_A,     "A",   0, "VGroup A", "Affect vertices in VGroup A"},
-		{MOD_WVG_SET_B,     "B",   0, "VGroup B", "Affect vertices in VGroup B (might add some to VGroup A)"},
-		{MOD_WVG_SET_OR,    "OR", 0, "VGroup A or B", "Affect vertices in at least one of both VGroups (might add some to VGroup A)"},
-		{MOD_WVG_SET_AND,   "AND", 0, "VGroup A and B", "Affect vertices in both groups"},
+		{MOD_WVG_SET_ALL, "ALL", 0, "All", "Affect all vertices (might add some to VGroup A)"},
+		{MOD_WVG_SET_A,   "A",   0, "VGroup A", "Affect vertices in VGroup A"},
+		{MOD_WVG_SET_B,   "B",   0, "VGroup B", "Affect vertices in VGroup B (might add some to VGroup A)"},
+		{MOD_WVG_SET_OR,  "OR",  0, "VGroup A or B",
+		                  "Affect vertices in at least one of both VGroups (might add some to VGroup A)"},
+		{MOD_WVG_SET_AND, "AND", 0, "VGroup A and B", "Affect vertices in both groups"},
 		{0, NULL, 0, NULL, NULL}};
 
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "VertexWeightMixModifier", "Modifier");
+	srna = RNA_def_struct(brna, "VertexWeightMixModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "WeightVG Mix Modifier",
 	                       "Mix the weights of two vertex groups");
 	RNA_def_struct_sdna(srna, "WeightVGMixModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_VERTEX_WEIGHT);
 
-	prop= RNA_def_property(srna, "vertex_group_a", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "vertex_group_a", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "defgrp_name_a");
 	RNA_def_property_ui_text(prop, "Vertex Group A", "First vertex group name");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGModifier_vgroup_set");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "vertex_group_b", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "vertex_group_b", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "defgrp_name_b");
 	RNA_def_property_ui_text(prop, "Vertex Group B", "Second vertex group name");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGMixModifier_vgroup2_set");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "default_weight_a", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "default_weight_a", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0, 1.0f);
 	RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 0);
 	RNA_def_property_ui_text(prop, "Default Weight A", "Default weight a vertex will have if "
 	                                                   "it is not in the first A vgroup");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "default_weight_b", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "default_weight_b", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0, 1.0f);
 	RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 0);
 	RNA_def_property_ui_text(prop, "Default Weight B", "Default weight a vertex will have if "
 	                                                   "it is not in the second B vgroup");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, weightvg_mix_modes_items);
 	RNA_def_property_ui_text(prop, "Mix Mode", "How weights from vgroup B affect weights "
 	                                           "of vgroup A");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "mix_set", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mix_set", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, weightvg_mix_set_items);
 	RNA_def_property_ui_text(prop, "Vertex Set", "Which vertices should be affected");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -2780,26 +2858,26 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "VertexWeightProximityModifier", "Modifier");
+	srna = RNA_def_struct(brna, "VertexWeightProximityModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "WeightVG Proximity Modifier",
 	                       "Set the weights of vertices in a group from a target object's "
 	                       "distance");
 	RNA_def_struct_sdna(srna, "WeightVGProximityModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_VERTEX_WEIGHT);
 
-	prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+	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");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGModifier_vgroup_set");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "proximity_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "proximity_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, weightvg_proximity_modes_items);
 	RNA_def_property_enum_default(prop, MOD_WVG_PROXIMITY_GEOMETRY);
 	RNA_def_property_ui_text(prop, "Proximity Mode", "Which distances to target object to use");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "proximity_geometry", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "proximity_geometry", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "proximity_flags");
 	RNA_def_property_enum_items(prop, proximity_geometry_items);
 	RNA_def_property_flag(prop, PROP_ENUM_FLAG); /* important to run before default set */
@@ -2809,27 +2887,27 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna)
 	                         "as weight");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "proximity_ob_target");
 	RNA_def_property_ui_text(prop, "Target Object", "Object to calculate vertices distances from");
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
 	RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
 
-	prop= RNA_def_property(srna, "min_dist", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "min_dist", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_range(prop, 0.0, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.0, 1000.0, 10, 0);
 	RNA_def_property_ui_text(prop, "Lowest Dist", "Distance mapping to weight 0.0");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "max_dist", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "max_dist", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_range(prop, 0.0, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.0, 1000.0, 10, 0);
 	RNA_def_property_ui_text(prop, "Highest Dist", "Distance mapping to weight 1.0");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, weightvg_proximity_falloff_type_items);
-	RNA_def_property_ui_text(prop, "Falloff Type", "How weights are mapped to there new values");
+	RNA_def_property_ui_text(prop, "Falloff Type", "How weights are mapped to their new values");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
 	/* Common masking properties. */
@@ -2838,50 +2916,57 @@ static void rna_def_modifier_weightvgproximity(BlenderRNA *brna)
 
 static void rna_def_modifier_remesh(BlenderRNA *brna)
 {
-	static EnumPropertyItem mode_items[]= {
+	static EnumPropertyItem mode_items[] = {
 		{MOD_REMESH_CENTROID, "BLOCKS", 0, "Blocks", "Output a blocky surface with no smoothing"},
 		{MOD_REMESH_MASS_POINT, "SMOOTH", 0, "Smooth", "Output a smooth surface with no sharp-features detection"},
-		{MOD_REMESH_SHARP_FEATURES, "SHARP", 0, "Sharp", "Output a surface that reproduces sharp edges and corners from the input mesh"},
+		{MOD_REMESH_SHARP_FEATURES, "SHARP", 0, "Sharp",
+		                            "Output a surface that reproduces sharp edges and corners from the input mesh"},
 		{0, NULL, 0, NULL, NULL}};
 
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "RemeshModifier", "Modifier");
-	RNA_def_struct_ui_text(srna, "Remesh Modifier", "Generate a new surface with regular topology that follows the shape of the input mesh");
+	srna = RNA_def_struct(brna, "RemeshModifier", "Modifier");
+	RNA_def_struct_ui_text(srna, "Remesh Modifier",
+	                       "Generate a new surface with regular topology that follows the shape of the input mesh");
 	RNA_def_struct_sdna(srna, "RemeshModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_REMESH);
 
-	prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, mode_items);
 	RNA_def_property_ui_text(prop, "Mode", "");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_ui_range(prop, 0, 0.99, 0.01, 3);
 	RNA_def_property_range(prop, 0, 0.99);
-	RNA_def_property_ui_text(prop, "Scale", "The ratio of the largest dimension of the model over the size of the grid");
+	RNA_def_property_ui_text(prop, "Scale",
+	                         "The ratio of the largest dimension of the model over the size of the grid");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
 	RNA_def_property_range(prop, 0, 1);
-	RNA_def_property_ui_text(prop, "Threshold", "If removing disconnected pieces, minimum size of components to preserve as a ratio of the number of polygons in the largest component");
+	RNA_def_property_ui_text(prop, "Threshold",
+	                         "If removing disconnected pieces, minimum size of components to preserve as a ratio "
+	                         "of the number of polygons in the largest component");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "octree_depth", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "octree_depth", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "depth");
 	RNA_def_property_range(prop, 1, 10);
 	RNA_def_property_ui_text(prop, "Octree Depth", "Resolution of the octree; higher values give finer details");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "sharpness", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "sharpness", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "hermite_num");
 	RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
-	RNA_def_property_ui_text(prop, "Sharpness", "Tolerance for outliers; lower values filter noise while higher values will reproduce edges closer to the input");
+	RNA_def_property_ui_text(prop, "Sharpness",
+	                         "Tolerance for outliers; lower values filter noise while higher values will reproduce "
+	                         "edges closer to the input");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
-	prop= RNA_def_property(srna, "remove_disconnected_pieces", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "remove_disconnected_pieces", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_REMESH_FLOOD_FILL);
 	RNA_def_property_ui_text(prop, "Remove Disconnected Pieces", "");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -2892,36 +2977,40 @@ static void rna_def_modifier_ocean(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	static EnumPropertyItem geometry_items[]= {
-		{MOD_OCEAN_GEOM_GENERATE, "GENERATE", 0, "Generate", "Generate ocean surface geometry at the specified resolution"},
+	static EnumPropertyItem geometry_items[] = {
+		{MOD_OCEAN_GEOM_GENERATE, "GENERATE", 0, "Generate",
+		                          "Generate ocean surface geometry at the specified resolution"},
 		{MOD_OCEAN_GEOM_DISPLACE, "DISPLACE", 0, "Displace", "Displace existing geometry according to simulation"},
-		//{MOD_OCEAN_GEOM_SIM_ONLY, "SIM_ONLY", 0, "Sim Only", "Leaves geometry unchanged, but still runs simulation (to be used from texture)"},
+#if 0
+		{MOD_OCEAN_GEOM_SIM_ONLY, "SIM_ONLY", 0, "Sim Only",
+		                          "Leaves geometry unchanged, but still runs simulation (to be used from texture)"},
+#endif
 		{0, NULL, 0, NULL, NULL}};
 	
-	srna= RNA_def_struct(brna, "OceanModifier", "Modifier");
+	srna = RNA_def_struct(brna, "OceanModifier", "Modifier");
 	RNA_def_struct_ui_text(srna, "Ocean Modifier", "Simulate an ocean surface");
 	RNA_def_struct_sdna(srna, "OceanModifierData");
 	RNA_def_struct_ui_icon(srna, ICON_MOD_OCEAN);
 	
 	/* General check if blender was built with OceanSim modifier support */
-	prop= RNA_def_property(srna, "is_build_enabled", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_build_enabled", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_OceanModifier_is_build_enabled_get", NULL);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Build Enabled", "True if the OceanSim modifier is enabled in this build");
 	
-	prop= RNA_def_property(srna, "geometry_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "geometry_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "geometry_mode");
 	RNA_def_property_enum_items(prop, geometry_items);
 	RNA_def_property_ui_text(prop, "Geometry", "Method of modifying geometry");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 	
-	prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_UNSIGNED);
 	RNA_def_property_float_sdna(prop, NULL, "size");
 	RNA_def_property_ui_text(prop, "Size", "");
 	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 0);
 	RNA_def_property_update(prop, 0, "rna_OceanModifier_topology_update");
 	
-	prop= RNA_def_property(srna, "repeat_x", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "repeat_x", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "repeat_x");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 1, 1024);
@@ -2929,7 +3018,7 @@ static void rna_def_modifier_ocean(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Repeat X", "Repetitions of the generated surface in X");
 	RNA_def_property_update(prop, 0, "rna_OceanModifier_topology_update");
 	
-	prop= RNA_def_property(srna, "repeat_y", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "repeat_y", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "repeat_y");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 1, 1024);
@@ -2937,19 +3026,20 @@ static void rna_def_modifier_ocean(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Repeat Y", "Repetitions of the generated surface in Y");
 	RNA_def_property_update(prop, 0, "rna_OceanModifier_topology_update");
 
-	prop= RNA_def_property(srna, "use_normals", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_normals", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_OCEAN_GENERATE_NORMALS);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-	RNA_def_property_ui_text(prop, "Generate Normals", "Output normals for bump mapping - disabling can speed up performance if its not needed");
+	RNA_def_property_ui_text(prop, "Generate Normals",
+	                         "Output normals for bump mapping - disabling can speed up performance if its not needed");
 	RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
 	
-	prop= RNA_def_property(srna, "use_foam", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_foam", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_OCEAN_GENERATE_FOAM);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Generate Foam", "Generate foam mask as a vertex color channel");
 	RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
 	
-	prop= RNA_def_property(srna, "resolution", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "resolution", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "resolution");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 1, 1024);
@@ -2957,174 +3047,175 @@ static void rna_def_modifier_ocean(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Resolution", "Resolution of the generated surface");
 	RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
 	
-	prop= RNA_def_property(srna, "spatial_size", PROP_INT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "spatial_size", PROP_INT, PROP_DISTANCE);
 	RNA_def_property_int_sdna(prop, NULL, "spatial_size");
 	RNA_def_property_ui_range(prop, 1, 512, 2, 0);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Spatial Size", "Physical size of the simulation domain (m)");
 	RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
 	
-	prop= RNA_def_property(srna, "wind_velocity", PROP_FLOAT, PROP_VELOCITY);
+	prop = RNA_def_property(srna, "wind_velocity", PROP_FLOAT, PROP_VELOCITY);
 	RNA_def_property_float_sdna(prop, NULL, "wind_velocity");
 	RNA_def_property_ui_text(prop, "Wind Velocity", "Wind speed (m/s)");
 	RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
 	
-	prop= RNA_def_property(srna, "damping", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "damp");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Damping", "Damp reflected waves going in opposite direction to the wind");
 	RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
 	
-	prop= RNA_def_property(srna, "wave_scale_min", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "wave_scale_min", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "smallest_wave");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0.0, FLT_MAX);
 	RNA_def_property_ui_text(prop, "Smallest Wave", "Shortest allowed wavelength (m)");
 	RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
 	
-	prop= RNA_def_property(srna, "wave_alignment", PROP_FLOAT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "wave_alignment", PROP_FLOAT, PROP_UNSIGNED);
 	RNA_def_property_float_sdna(prop, NULL, "wave_alignment");
 	RNA_def_property_range(prop, 0.0, 10.0);
 	RNA_def_property_ui_text(prop, "Wave Alignment", "");
 	RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
 	
-	prop= RNA_def_property(srna, "wave_direction", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "wave_direction", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "wave_direction");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Wave Direction", "");
 	RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
 	
-	prop= RNA_def_property(srna, "wave_scale", PROP_FLOAT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "wave_scale", PROP_FLOAT, PROP_UNSIGNED);
 	RNA_def_property_float_sdna(prop, NULL, "wave_scale");
 	RNA_def_property_ui_text(prop, "Wave Scale", "");
 	RNA_def_property_update(prop, 0, "rna_OceanModifier_sim_update");
 	
-	prop= RNA_def_property(srna, "depth", PROP_FLOAT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "depth", PROP_FLOAT, PROP_UNSIGNED);
 	RNA_def_property_float_sdna(prop, NULL, "depth");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Depth", "");
 	RNA_def_property_ui_range(prop, 0, 250, 1, 0);
 	RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
 	
-	prop= RNA_def_property(srna, "foam_coverage", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "foam_coverage", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "foam_coverage");
 	RNA_def_property_ui_text(prop, "Foam Coverage", "");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 	
-	prop= RNA_def_property(srna, "bake_foam_fade", PROP_FLOAT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "bake_foam_fade", PROP_FLOAT, PROP_UNSIGNED);
 	RNA_def_property_float_sdna(prop, NULL, "foam_fade");
 	RNA_def_property_ui_text(prop, "Foam Fade", "");
 	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 0);
 	RNA_def_property_update(prop, 0, NULL);
 	
-	prop= RNA_def_property(srna, "foam_layer_name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "foam_layer_name", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "foamlayername");
 	RNA_def_property_ui_text(prop, "Foam Layer Name", "Name of the vertex color layer used for foam");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 	
-	prop= RNA_def_property(srna, "choppiness", PROP_FLOAT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "choppiness", PROP_FLOAT, PROP_UNSIGNED);
 	RNA_def_property_float_sdna(prop, NULL, "chop_amount");
 	RNA_def_property_ui_text(prop, "Choppiness", "");
 	RNA_def_property_ui_range(prop, 0.0, 4.0, 3, 0);
 	RNA_def_property_float_funcs(prop, NULL, "rna_OceanModifier_ocean_chop_set", NULL);
 	RNA_def_property_update(prop, 0, "rna_OceanModifier_sim_update");
 	
-	prop= RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
 	RNA_def_property_float_sdna(prop, NULL, "time");
 	RNA_def_property_ui_text(prop, "Time", "");
 	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 0);
 	RNA_def_property_update(prop, 0, "rna_OceanModifier_sim_update");
 	
-	prop= RNA_def_property(srna, "random_seed", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "random_seed", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "seed");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Random Seed", "");
 	RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
 	
-	prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "bakestart");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Bake Start", "");
 	RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
 	
-	prop= RNA_def_property(srna, "frame_end", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "bakeend");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Bake End", "");
 	RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
 	
-	prop= RNA_def_property(srna, "is_cached", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_cached", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "cached", 1);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Ocean is Cached", "Whether the ocean is using cached data or simulating");
 
-	prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_DIRPATH);
+	prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_DIRPATH);
 	RNA_def_property_string_sdna(prop, NULL, "cachepath");
 	RNA_def_property_ui_text(prop, "Cache Path", "Path to a folder to store external baked images");
-	//RNA_def_property_update(prop, 0, "rna_Modifier_update");
-	// XXX how to update?
+	/*RNA_def_property_update(prop, 0, "rna_Modifier_update"); */
+	/* XXX how to update? */
 }
 
-
 void RNA_def_modifier(BlenderRNA *brna)
 {
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
 	/* data */
-	srna= RNA_def_struct(brna, "Modifier", NULL);
+	srna = RNA_def_struct(brna, "Modifier", NULL);
 	RNA_def_struct_ui_text(srna , "Modifier", "Modifier affecting the geometry data of an object");
 	RNA_def_struct_refine_func(srna, "rna_Modifier_refine");
 	RNA_def_struct_path_func(srna, "rna_Modifier_path");
 	RNA_def_struct_sdna(srna, "ModifierData");
 	
 	/* strings */
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Modifier_name_set");
 	RNA_def_property_ui_text(prop, "Name", "Modifier name");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER|NA_RENAME, NULL);
 	RNA_def_struct_name_property(srna, prop);
 	
 	/* enums */
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, modifier_type_items);
 	RNA_def_property_ui_text(prop, "Type", "");
 	
 	/* flags */
-	prop= RNA_def_property(srna, "show_viewport", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_viewport", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Realtime);
-	RNA_def_property_ui_text(prop, "Realtime", "Realtime display of a modifier");
+	RNA_def_property_ui_text(prop, "Realtime", "Display modifier in realtime");
 	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 	RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 0);
 	
-	prop= RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Render);
 	RNA_def_property_ui_text(prop, "Render", "Use modifier during rendering");
 	RNA_def_property_ui_icon(prop, ICON_SCENE, 0);
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, NULL);
 	
-	prop= RNA_def_property(srna, "show_in_editmode", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_in_editmode", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Editmode);
 	RNA_def_property_ui_text(prop, "Editmode", "Use modifier while in the edit mode");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 	RNA_def_property_ui_icon(prop, ICON_EDITMODE_HLT, 0);
 	
-	prop= RNA_def_property(srna, "show_on_cage", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_on_cage", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_OnCage);
 	RNA_def_property_ui_text(prop, "On Cage", "Enable direct editing of modifier control cage");
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 	
-	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");
 	RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
 
-	prop= RNA_def_property(srna, "use_apply_on_spline", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_apply_on_spline", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_ApplyOnSpline);
-	RNA_def_property_ui_text(prop, "Apply on spline", "Apply this and all preceding deformation modifiers on splines' points rather than on filled curve/surface");
+	RNA_def_property_ui_text(prop, "Apply on spline",
+	                         "Apply this and all preceding deformation modifiers on splines' points rather than "
+	                         "on filled curve/surface");
 	RNA_def_property_ui_icon(prop, ICON_SURFACE_DATA, 0);
 	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 
diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c
index 1d79040..ca06793 100644
--- a/source/blender/makesrna/intern/rna_movieclip.c
+++ b/source/blender/makesrna/intern/rna_movieclip.c
@@ -52,7 +52,7 @@
 
 static void rna_MovieClip_reload_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	MovieClip *clip= (MovieClip*)ptr->id.data;
+	MovieClip *clip = (MovieClip*)ptr->id.data;
 
 	BKE_movieclip_reload(clip);
 	DAG_id_tag_update(&clip->id, 0);
@@ -60,10 +60,10 @@ static void rna_MovieClip_reload_update(Main *UNUSED(bmain), Scene *UNUSED(scene
 
 static void rna_MovieClip_size_get(PointerRNA *ptr, int *values)
 {
-	MovieClip *clip= (MovieClip*)ptr->id.data;
+	MovieClip *clip = (MovieClip*)ptr->id.data;
 
-	values[0]= clip->lastsize[0];
-	values[1]= clip->lastsize[1];
+	values[0] = clip->lastsize[0];
+	values[1] = clip->lastsize[1];
 }
 
 #else
@@ -73,12 +73,15 @@ static void rna_def_movieclip_proxy(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static const EnumPropertyItem clip_tc_items[]= {
+	static const EnumPropertyItem clip_tc_items[] = {
 		{IMB_TC_NONE, "NONE", 0, "No TC in use", ""},
 		{IMB_TC_RECORD_RUN, "RECORD_RUN", 0, "Record Run", "Use images in the order they are recorded"},
 		{IMB_TC_FREE_RUN, "FREE_RUN", 0, "Free Run", "Use global timestamp written by recording device"},
-		{IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN, "FREE_RUN_REC_DATE", 0, "Free Run (rec date)", "Interpolate a global timestamp using the record date and time written by recording device"},
-		{IMB_TC_RECORD_RUN_NO_GAPS, "FREE_RUN_NO_GAPS", 0, "Free Run No Gaps", "Record run, but ignore timecode, changes in framerate or dropouts"},
+		{IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN, "FREE_RUN_REC_DATE", 0, "Free Run (rec date)",
+		                                        "Interpolate a global timestamp using the record date and time "
+		                                        "written by recording device"},
+		{IMB_TC_RECORD_RUN_NO_GAPS, "FREE_RUN_NO_GAPS", 0, "Free Run No Gaps",
+		                            "Record run, but ignore timecode, changes in framerate or dropouts"},
 		{0, NULL, 0, NULL, NULL}};
 
 	srna = RNA_def_struct(brna, "MovieClipProxy", NULL);
@@ -86,66 +89,81 @@ static void rna_def_movieclip_proxy(BlenderRNA *brna)
 	RNA_def_struct_sdna(srna, "MovieClipProxy");
 
 	/* build proxy sized */
-	prop= RNA_def_property(srna, "build_25", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "build_25", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_25);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "25%", "Build proxy resolution 25% of the original footage dimension");
 
-	prop= RNA_def_property(srna, "build_50", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "build_50", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_50);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "50%", "Build proxy resolution 50% of the original footage dimension");
 
-	prop= RNA_def_property(srna, "build_75", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "build_75", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_75);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "75%", "Build proxy resolution 75% of the original footage dimension");
 
-	prop= RNA_def_property(srna, "build_100", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "build_100", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_100);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "100%", "Build proxy resolution 100% of the original footage dimension");
 
-	prop= RNA_def_property(srna, "build_undistorted_25", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "build_undistorted_25", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_25);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "25%", "Build proxy resolution 25% of the original undistorted footage dimension");
 
-	prop= RNA_def_property(srna, "build_undistorted_50", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "build_undistorted_50", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_50);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "50%", "Build proxy resolution 50% of the original undistorted footage dimension");
 
-	prop= RNA_def_property(srna, "build_undistorted_75", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "build_undistorted_75", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_75);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "75%", "Build proxy resolution 75% of the original undistorted footage dimension");
 
-	prop= RNA_def_property(srna, "build_undistorted_100", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "build_undistorted_100", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_100);
-	RNA_def_property_ui_text(prop, "100%", "Build proxy resolution 100% of the original undistorted footage dimension");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+	RNA_def_property_ui_text(prop, "100%",
+	                         "Build proxy resolution 100% of the original undistorted footage dimension");
 
 	/* build timecodes */
-	prop= RNA_def_property(srna, "build_record_run", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "build_record_run", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flag", IMB_TC_RECORD_RUN);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Rec Run", "Build record run time code index");
 
-	prop= RNA_def_property(srna, "build_free_run", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "build_free_run", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flag", IMB_TC_FREE_RUN);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Free Run", "Build free run time code index");
 
-	prop= RNA_def_property(srna, "build_free_run_rec_date", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "build_free_run_rec_date", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flag", IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Free Run (Rec Date)", "Build free run time code index using Record Date/Time");
 
 	/* quality of proxied image */
-	prop= RNA_def_property(srna, "quality", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "quality", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "quality");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Quality", "JPEG quality of proxy images");
 	RNA_def_property_ui_range(prop, 1, 100, 1, 0);
 
-	prop= RNA_def_property(srna, "timecode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "timecode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "tc");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_items(prop, clip_tc_items);
 	RNA_def_property_ui_text(prop, "Timecode", "");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
 
 	/* directory */
-	prop= RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
+	prop = RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
 	RNA_def_property_string_sdna(prop, NULL, "dir");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Directory", "Location to store the proxy files");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_MovieClip_reload_update");
 }
@@ -163,24 +181,26 @@ static void rna_def_moviecliUser(BlenderRNA *brna)
 		{MCLIP_PROXY_RENDER_SIZE_FULL, "FULL", 0, "No proxy, full render", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "MovieClipUser", NULL);
-	RNA_def_struct_ui_text(srna, "Movie Clip User", "Parameters defining how a MovieClip datablock is used by another datablock");
+	srna = RNA_def_struct(brna, "MovieClipUser", NULL);
+	RNA_def_struct_ui_text(srna, "Movie Clip User",
+	                       "Parameters defining how a MovieClip datablock is used by another datablock");
 
-	prop= RNA_def_property(srna, "current_frame", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "current_frame", PROP_INT, PROP_TIME);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_int_sdna(prop, NULL, "framenr");
 	RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
 	RNA_def_property_ui_text(prop, "Current Frame", "Current frame number in movie or image sequence");
 
 	/* render size */
-	prop= RNA_def_property(srna, "proxy_render_size", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "proxy_render_size", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "render_size");
 	RNA_def_property_enum_items(prop, clip_render_size_items);
-	RNA_def_property_ui_text(prop, "Proxy render size", "Draw preview using full resolution or different proxy resolutions");
+	RNA_def_property_ui_text(prop, "Proxy render size",
+	                         "Draw preview using full resolution or different proxy resolutions");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
 
 	/* render undistorted */
-	prop= RNA_def_property(srna, "use_render_undistorted", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_render_undistorted", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "render_flag", MCLIP_PROXY_RENDER_UNDISTORT);
 	RNA_def_property_ui_text(prop, "Render Undistorted", "Render preview using undistorted proxy");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
@@ -190,7 +210,7 @@ static void rna_def_movieClipScopes(BlenderRNA *brna)
 {
 	StructRNA *srna;
 
-	srna= RNA_def_struct(brna, "MovieClipScopes", NULL);
+	srna = RNA_def_struct(brna, "MovieClipScopes", NULL);
 	RNA_def_struct_ui_text(srna, "MovieClipScopes", "Scopes for statistical view of a movie clip");
 }
 
@@ -200,37 +220,40 @@ static void rna_def_movieclip(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static EnumPropertyItem clip_source_items[]= {
+	static EnumPropertyItem clip_source_items[] = {
 		{MCLIP_SRC_SEQUENCE, "SEQUENCE", 0, "Image Sequence", "Multiple image files, as a sequence"},
 		{MCLIP_SRC_MOVIE, "MOVIE", 0, "Movie File", "Movie file"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "MovieClip", "ID");
+	srna = RNA_def_struct(brna, "MovieClip", "ID");
 	RNA_def_struct_ui_text(srna, "MovieClip", "MovieClip datablock referencing an external movie file");
 	RNA_def_struct_ui_icon(srna, ICON_SEQUENCE);
 
-	prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+	prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
 	RNA_def_property_string_sdna(prop, NULL, "name");
 	RNA_def_property_ui_text(prop, "File Path", "Filename of the movie or sequence file");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_MovieClip_reload_update");
 
-	prop= RNA_def_property(srna, "tracking", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "tracking", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "MovieTracking");
 
-	prop= RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "MovieClipProxy");
 
 	/* use proxy */
-	prop= RNA_def_property(srna, "use_proxy", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_proxy", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MCLIP_USE_PROXY);
-	RNA_def_property_ui_text(prop, "Use Proxy / Timecode", "Use a preview proxy and/or timecode index for this clip");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+	RNA_def_property_ui_text(prop, "Use Proxy / Timecode",
+	                         "Use a preview proxy and/or timecode index for this clip");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
 
-	prop= RNA_def_int_vector(srna, "size" , 2 , NULL , 0, 0, "Size" , "Width and height in pixels, zero when image data cant be loaded" , 0 , 0);
+	prop = RNA_def_int_vector(srna, "size" , 2 , NULL , 0, 0, "Size",
+	                          "Width and height in pixels, zero when image data cant be loaded" , 0 , 0);
 	RNA_def_property_int_funcs(prop, "rna_MovieClip_size_get" , NULL, NULL);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "display_aspect", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "display_aspect", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "aspx");
 	RNA_def_property_array(prop, 2);
 	RNA_def_property_range(prop, 0.1f, 5000.0f);
@@ -239,19 +262,21 @@ static void rna_def_movieclip(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
 
 	/* source */
-	prop= RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, clip_source_items);
 	RNA_def_property_ui_text(prop, "Source", "Where the clip comes from");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
 	/* custom proxy directory */
-	prop= RNA_def_property(srna, "use_proxy_custom_directory", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_proxy_custom_directory", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MCLIP_USE_PROXY_CUSTOM_DIR);
-	RNA_def_property_ui_text(prop, "Proxy Custom Directory", "Create proxy images in a custom directory (default is movie location)");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+	RNA_def_property_ui_text(prop, "Proxy Custom Directory",
+	                         "Create proxy images in a custom directory (default is movie location)");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_MovieClip_reload_update");
 
 	/* grease pencil */
-	prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "gpd");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "GreasePencil");
diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c
index b2ea4cd..8d262c5 100644
--- a/source/blender/makesrna/intern/rna_nla.c
+++ b/source/blender/makesrna/intern/rna_nla.c
@@ -56,32 +56,32 @@
 
 static void rna_NlaStrip_name_set(PointerRNA *ptr, const char *value)
 {
-	NlaStrip *data= (NlaStrip *)ptr->data;
+	NlaStrip *data = (NlaStrip *)ptr->data;
 	
 	/* copy the name first */
 	BLI_strncpy_utf8(data->name, value, sizeof(data->name));
 	
 	/* validate if there's enough info to do so */
 	if (ptr->id.data) {
-		AnimData *adt= BKE_animdata_from_id(ptr->id.data);
+		AnimData *adt = BKE_animdata_from_id(ptr->id.data);
 		BKE_nlastrip_validate_name(adt, data);
 	}
 }
 
 static char *rna_NlaStrip_path(PointerRNA *ptr)
 {
-	NlaStrip *strip= (NlaStrip *)ptr->data;
-	AnimData *adt= BKE_animdata_from_id(ptr->id.data);
+	NlaStrip *strip = (NlaStrip *)ptr->data;
+	AnimData *adt = BKE_animdata_from_id(ptr->id.data);
 	
 	/* if we're attached to AnimData, try to resolve path back to AnimData */
 	if (adt) {
 		NlaTrack *nlt;
 		NlaStrip *nls;
 		
-		for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next) {
+		for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
 			for (nls = nlt->strips.first; nls; nls = nls->next) {
 				if (nls == strip) {
-					// XXX but if we animate like this, the control will never work...
+					/* XXX but if we animate like this, the control will never work... */
 					return BLI_sprintfN("animation_data.nla_tracks[\"%s\"].strips[\"%s\"]", nlt->name, strip->name);
 				}
 			}
@@ -94,16 +94,16 @@ static char *rna_NlaStrip_path(PointerRNA *ptr)
 
 static void rna_NlaStrip_transform_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	NlaStrip *strip= (NlaStrip*)ptr->data;
+	NlaStrip *strip = (NlaStrip*)ptr->data;
 
 	BKE_nlameta_flush_transforms(strip);
 }
 
 static void rna_NlaStrip_start_frame_set(PointerRNA *ptr, float value)
 {
-	NlaStrip *data= (NlaStrip*)ptr->data;
+	NlaStrip *data = (NlaStrip*)ptr->data;
 	
-	/* clamp value to lie within valid limits 
+	/* clamp value to lie within valid limits
 	 *	- cannot start past the end of the strip + some flexibility threshold
 	 *	- cannot start before the previous strip (if present) ends
 	 *		-> but if it was a transition, we could go up to the start of the strip + some flexibility threshold
@@ -115,7 +115,7 @@ static void rna_NlaStrip_start_frame_set(PointerRNA *ptr, float value)
 			CLAMP(value, data->prev->start+NLASTRIP_MIN_LEN_THRESH, data->end-NLASTRIP_MIN_LEN_THRESH);
 			
 			/* readjust the transition to stick to the endpoints of the action-clips */
-			data->prev->end= value;
+			data->prev->end = value;
 		}
 		else {
 			CLAMP(value, data->prev->end, data->end-NLASTRIP_MIN_LEN_THRESH);
@@ -124,15 +124,15 @@ static void rna_NlaStrip_start_frame_set(PointerRNA *ptr, float value)
 	else {
 		CLAMP(value, MINAFRAME, data->end);
 	}
-	data->start= value;
+	data->start = value;
 }
 
 static void rna_NlaStrip_end_frame_set(PointerRNA *ptr, float value)
 {
-	NlaStrip *data= (NlaStrip*)ptr->data;
+	NlaStrip *data = (NlaStrip*)ptr->data;
 	
 	/* clamp value to lie within valid limits
-	 *	- must not have zero or negative length strip, so cannot start before the first frame 
+	 *	- must not have zero or negative length strip, so cannot start before the first frame
 	 *	  + some minimum-strip-length threshold
 	 *	- cannot end later than the start of the next strip (if present)
 	 *		-> but if it was a transition, we could go up to the start of the end - some flexibility threshold
@@ -143,7 +143,7 @@ static void rna_NlaStrip_end_frame_set(PointerRNA *ptr, float value)
 			CLAMP(value, data->start+NLASTRIP_MIN_LEN_THRESH, data->next->end-NLASTRIP_MIN_LEN_THRESH);
 			
 			/* readjust the transition to stick to the endpoints of the action-clips */
-			data->next->start= value;
+			data->next->start = value;
 		}
 		else {
 			CLAMP(value, data->start+NLASTRIP_MIN_LEN_THRESH, data->next->start);
@@ -152,29 +152,30 @@ static void rna_NlaStrip_end_frame_set(PointerRNA *ptr, float value)
 	else {
 		CLAMP(value, data->start+NLASTRIP_MIN_LEN_THRESH, MAXFRAME);
 	}
-	data->end= value;
+	data->end = value;
 	
 	
 	/* calculate the lengths the strip and its action (if applicable) */
 	if (data->type == NLASTRIP_TYPE_CLIP) {
 		float len, actlen;
 		
-		len= data->end - data->start;
-		actlen= data->actend - data->actstart;
-		if (IS_EQF(actlen, 0.0f)) actlen= 1.0f;
+		len = data->end - data->start;
+		actlen = data->actend - data->actstart;
+		if (IS_EQF(actlen, 0.0f)) actlen = 1.0f;
 		
 		/* now, adjust the 'scale' setting to reflect this (so that this change can be valid) */
-		data->scale= len / ((actlen) * data->repeat);
+		data->scale = len / ((actlen) * data->repeat);
 	}
 }
 
 static void rna_NlaStrip_scale_set(PointerRNA *ptr, float value)
 {
-	NlaStrip *data= (NlaStrip*)ptr->data;
+	NlaStrip *data = (NlaStrip*)ptr->data;
 	
 	/* set scale value */
-	CLAMP(value, 0.0001f, 1000.0f); /* NOTE: these need to be synced with the values in the property definition in rna_def_nlastrip() */
-	data->scale= value;
+		/* NOTE: these need to be synced with the values in the property definition in rna_def_nlastrip() */
+	CLAMP(value, 0.0001f, 1000.0f);
+	data->scale = value;
 	
 	/* adjust the strip extents in response to this */
 	BKE_nlastrip_recalculate_bounds(data);
@@ -182,11 +183,12 @@ static void rna_NlaStrip_scale_set(PointerRNA *ptr, float value)
 
 static void rna_NlaStrip_repeat_set(PointerRNA *ptr, float value)
 {
-	NlaStrip *data= (NlaStrip*)ptr->data;
+	NlaStrip *data = (NlaStrip*)ptr->data;
 	
 	/* set repeat value */
-	CLAMP(value, 0.01f, 1000.0f); /* NOTE: these need to be synced with the values in the property definition in rna_def_nlastrip() */
-	data->repeat= value;
+		/* NOTE: these need to be synced with the values in the property definition in rna_def_nlastrip() */
+	CLAMP(value, 0.01f, 1000.0f);
+	data->repeat = value;
 	
 	/* adjust the strip extents in response to this */
 	BKE_nlastrip_recalculate_bounds(data);
@@ -194,30 +196,30 @@ static void rna_NlaStrip_repeat_set(PointerRNA *ptr, float value)
 
 static void rna_NlaStrip_blend_in_set(PointerRNA *ptr, float value)
 {
-	NlaStrip *data= (NlaStrip*)ptr->data;
+	NlaStrip *data = (NlaStrip*)ptr->data;
 	float len;
 	
 	/* blend-in is limited to the length of the strip, and also cannot overlap with blendout */
-	len= (data->end - data->start) - data->blendout;
+	len = (data->end - data->start) - data->blendout;
 	CLAMP(value, 0, len);
 	
-	data->blendin= value;
+	data->blendin = value;
 }
 
 static void rna_NlaStrip_blend_out_set(PointerRNA *ptr, float value)
 {
-	NlaStrip *data= (NlaStrip*)ptr->data;
+	NlaStrip *data = (NlaStrip*)ptr->data;
 	float len;
 	
 	/* blend-out is limited to the length of the strip */
-	len= (data->end - data->start);
+	len = (data->end - data->start);
 	CLAMP(value, 0, len);
 	
 	/* it also cannot overlap with blendin */
 	if ((len - value) < data->blendin)
-		value= len - data->blendin;
+		value = len - data->blendin;
 	
-	data->blendout= value;
+	data->blendout = value;
 }
 
 static int rna_NlaStrip_action_editable(PointerRNA *ptr)
@@ -245,24 +247,24 @@ static int rna_NlaStrip_action_editable(PointerRNA *ptr)
 
 static void rna_NlaStrip_action_start_frame_set(PointerRNA *ptr, float value)
 {
-	NlaStrip *data= (NlaStrip*)ptr->data;
+	NlaStrip *data = (NlaStrip*)ptr->data;
 	
 	/* prevent start frame from occurring after end of action */
 	CLAMP(value, MINAFRAME, data->actend);
-	data->actstart= value;
+	data->actstart = value;
 	
 	/* adjust the strip extents in response to this */
-	// TODO: should the strip be moved backwards instead as a special case?
+	/* TODO: should the strip be moved backwards instead as a special case? */
 	BKE_nlastrip_recalculate_bounds(data);
 }
 
 static void rna_NlaStrip_action_end_frame_set(PointerRNA *ptr, float value)
 {
-	NlaStrip *data= (NlaStrip*)ptr->data;
+	NlaStrip *data = (NlaStrip*)ptr->data;
 	
 	/* prevent end frame from starting before start of action */
 	CLAMP(value, data->actstart, MAXFRAME);
-	data->actend= value;
+	data->actend = value;
 	
 	/* adjust the strip extents in response to this */
 	BKE_nlastrip_recalculate_bounds(data);
@@ -270,7 +272,7 @@ static void rna_NlaStrip_action_end_frame_set(PointerRNA *ptr, float value)
 
 static void rna_NlaStrip_animated_influence_set(PointerRNA *ptr, int value)
 {
-	NlaStrip *data= (NlaStrip*)ptr->data;
+	NlaStrip *data = (NlaStrip*)ptr->data;
 	
 	if (value) {
 		/* set the flag, then make sure a curve for this exists */
@@ -283,7 +285,7 @@ static void rna_NlaStrip_animated_influence_set(PointerRNA *ptr, int value)
 
 static void rna_NlaStrip_animated_time_set(PointerRNA *ptr, int value)
 {
-	NlaStrip *data= (NlaStrip*)ptr->data;
+	NlaStrip *data = (NlaStrip*)ptr->data;
 	
 	if (value) {
 		/* set the flag, then make sure a curve for this exists */
@@ -294,7 +296,8 @@ static void rna_NlaStrip_animated_time_set(PointerRNA *ptr, int value)
 		data->flag &= ~NLASTRIP_FLAG_USR_TIME;
 }
 
-static NlaStrip *rna_NlaStrip_new(NlaTrack *track, bContext *C, ReportList *reports, const char *UNUSED(name), int start, bAction *action)
+static NlaStrip *rna_NlaStrip_new(NlaTrack *track, bContext *C, ReportList *reports, const char *UNUSED(name),
+                                  int start, bAction *action)
 {
 	NlaStrip *strip = add_nlastrip(action);
 	
@@ -307,12 +310,13 @@ 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_reportf(reports, RPT_ERROR,
+		            "Unable to add strip. Track doesn't have any space to accommodate this new strip");
 		free_nlastrip(NULL, strip);
 		return NULL;
 	}
 	
-	/* create dummy AnimData block so that BKE_nlastrip_validate_name() 
+	/* create dummy AnimData block so that BKE_nlastrip_validate_name()
 	 * can be used to ensure a valid name, as we don't have one here...
 	 * 	- only the nla_tracks list is needed there, which we aim to reverse engineer here...
 	 */
@@ -343,7 +347,7 @@ static NlaStrip *rna_NlaStrip_new(NlaTrack *track, bContext *C, ReportList *repo
 
 static void rna_NlaStrip_remove(NlaTrack *track, bContext *C, ReportList *reports, NlaStrip *strip)
 {
-	if(BLI_findindex(&track->strips, strip) == -1) {
+	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);
 		return;
 	}
@@ -357,14 +361,18 @@ static void rna_NlaStrip_remove(NlaTrack *track, bContext *C, ReportList *report
 
 /* enum defines exported for rna_animation.c */
 EnumPropertyItem nla_mode_blend_items[] = {
-	{NLASTRIP_MODE_REPLACE, "REPLACE", 0, "Replace", "Result strip replaces the accumulated results by amount specified by influence"},
+	{NLASTRIP_MODE_REPLACE, "REPLACE", 0, "Replace",
+	                        "Result strip replaces the accumulated results by amount specified by influence"},
 	{NLASTRIP_MODE_ADD, "ADD", 0, "Add", "Weighted result of strip is added to the accumulated results"},
-	{NLASTRIP_MODE_SUBTRACT, "SUBTRACT", 0, "Subtract", "Weighted result of strip is removed from the accumulated results"},
-	{NLASTRIP_MODE_MULTIPLY, "MULITPLY", 0, "Multiply", "Weighted result of strip is multiplied with the accumulated results"},
+	{NLASTRIP_MODE_SUBTRACT, "SUBTRACT", 0, "Subtract",
+	                         "Weighted result of strip is removed from the accumulated results"},
+	{NLASTRIP_MODE_MULTIPLY, "MULITPLY", 0, "Multiply",
+	                         "Weighted result of strip is multiplied with the accumulated results"},
 	{0, NULL, 0, NULL, NULL}};
 EnumPropertyItem nla_mode_extend_items[] = {
 	{NLASTRIP_EXTEND_NOTHING, "NOTHING", 0, "Nothing", "Strip has no influence past its extents"},
-	{NLASTRIP_EXTEND_HOLD, "HOLD", 0, "Hold", "Hold the first frame if no previous strips in track, and always hold last frame"},
+	{NLASTRIP_EXTEND_HOLD, "HOLD", 0, "Hold",
+	                       "Hold the first frame if no previous strips in track, and always hold last frame"},
 	{NLASTRIP_EXTEND_HOLD_FORWARD, "HOLD_FORWARD", 0, "Hold Forward", "Only hold last frame"},
 	{0, NULL, 0, NULL, NULL}};
 
@@ -382,173 +390,185 @@ static void rna_def_nlastrip(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}};
 	
 	/* struct definition */
-	srna= RNA_def_struct(brna, "NlaStrip", NULL);
+	srna = RNA_def_struct(brna, "NlaStrip", NULL);
 	RNA_def_struct_ui_text(srna, "NLA Strip", "A container referencing an existing Action");
 	RNA_def_struct_path_func(srna, "rna_NlaStrip_path");
-	RNA_def_struct_ui_icon(srna, ICON_NLA); // XXX
+	RNA_def_struct_ui_icon(srna, ICON_NLA); /* XXX */
 	
 	/* name property */
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Name", "");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_NlaStrip_name_set");
 	RNA_def_struct_name_property(srna, prop);
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
 	/* Enums */
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE); // XXX for now, not editable, since this is dangerous
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* XXX for now, not editable, since this is dangerous */
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_ui_text(prop, "Type", "Type of NLA Strip");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
-	prop= RNA_def_property(srna, "extrapolation", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "extrapolation", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "extendmode");
 	RNA_def_property_enum_items(prop, nla_mode_extend_items);
 	RNA_def_property_ui_text(prop, "Extrapolation", "Action to take for gaps past the strip extents");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
-	prop= RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "blendmode");
 	RNA_def_property_enum_items(prop, nla_mode_blend_items);
 	RNA_def_property_ui_text(prop, "Blending", "Method used for combining strip's result with accumulated result");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
 	/* Strip extents */
-	prop= RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_TIME);
 	RNA_def_property_float_sdna(prop, NULL, "start");
 	RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_start_frame_set", NULL);
 	RNA_def_property_ui_text(prop, "Start Frame", "");
 	RNA_def_property_update(prop, 0, "rna_NlaStrip_transform_update");
 	
-	prop= RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_TIME);
 	RNA_def_property_float_sdna(prop, NULL, "end");
 	RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_end_frame_set", NULL);
 	RNA_def_property_ui_text(prop, "End Frame", "");
 	RNA_def_property_update(prop, 0, "rna_NlaStrip_transform_update");
 	
 	/* Blending */
-	prop= RNA_def_property(srna, "blend_in", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "blend_in", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "blendin");
 	RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_blend_in_set", NULL);
 	RNA_def_property_ui_text(prop, "Blend In", "Number of frames at start of strip to fade in influence");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
-	prop= RNA_def_property(srna, "blend_out", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "blend_out", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "blendout");
 	RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_blend_out_set", NULL);
 	RNA_def_property_ui_text(prop, "Blend Out", "");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
-	prop= RNA_def_property(srna, "use_auto_blend", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_auto_blend", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_AUTO_BLENDS);
-	RNA_def_property_ui_text(prop, "Auto Blend In/Out", "Number of frames for Blending In/Out is automatically determined from overlapping strips");
+	RNA_def_property_ui_text(prop, "Auto Blend In/Out",
+	                         "Number of frames for Blending In/Out is automatically determined from "
+	                         "overlapping strips");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
 	/* Action */
-	prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "act");
 	RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Action_id_poll");
-	RNA_def_property_flag(prop, PROP_EDITABLE); 
+	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_editable_func(prop, "rna_NlaStrip_action_editable");
 	RNA_def_property_ui_text(prop, "Action", "Action referenced by this strip");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
 	/* Action extents */
-	prop= RNA_def_property(srna, "action_frame_start", PROP_FLOAT, PROP_TIME);
+	prop = RNA_def_property(srna, "action_frame_start", PROP_FLOAT, PROP_TIME);
 	RNA_def_property_float_sdna(prop, NULL, "actstart");
 	RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_action_start_frame_set", NULL);
 	RNA_def_property_ui_text(prop, "Action Start Frame", "");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
-	prop= RNA_def_property(srna, "action_frame_end", PROP_FLOAT, PROP_TIME);
+	prop = RNA_def_property(srna, "action_frame_end", PROP_FLOAT, PROP_TIME);
 	RNA_def_property_float_sdna(prop, NULL, "actend");
 	RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_action_end_frame_set", NULL);
 	RNA_def_property_ui_text(prop, "Action End Frame", "");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
 	/* Action Reuse */
-	prop= RNA_def_property(srna, "repeat", PROP_FLOAT, PROP_NONE);
-	RNA_def_property_float_sdna(prop, NULL, "repeat"); 
+	prop = RNA_def_property(srna, "repeat", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "repeat");
 	RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_repeat_set", NULL);
-	RNA_def_property_range(prop, 0.1f, 1000.0f); /* these limits have currently be chosen arbitarily, but could be extended (minimum should still be > 0 though) if needed... */
+		/* these limits have currently be chosen arbitarily, but could be extended
+		 * (minimum should still be > 0 though) if needed... */
+	RNA_def_property_range(prop, 0.1f, 1000.0f);
 	RNA_def_property_ui_text(prop, "Repeat", "Number of times to repeat the action range");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
-	prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
-	RNA_def_property_float_sdna(prop, NULL, "scale"); 
+	prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "scale");
 	RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_scale_set", NULL);
-	RNA_def_property_range(prop, 0.0001f, 1000.0f); /* these limits can be extended, but beyond this, we can get some crazy+annoying bugs due to numeric errors */
+		/* these limits can be extended, but beyond this, we can get some crazy+annoying bugs
+		 * due to numeric errors */
+	RNA_def_property_range(prop, 0.0001f, 1000.0f);
 	RNA_def_property_ui_text(prop, "Scale", "Scaling factor for action");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
 	/* Strip's F-Curves */
-	prop= RNA_def_property(srna, "fcurves", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "fcurves", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "FCurve");
 	RNA_def_property_ui_text(prop, "F-Curves", "F-Curves for controlling the strip's influence and timing");
 	
 	/* Strip's F-Modifiers */
-	prop= RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "FModifier");
 	RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting all the F-Curves in the referenced Action");
 	
 	/* Strip's Sub-Strips (for Meta-Strips) */
-	prop= RNA_def_property(srna, "strips", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "strips", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "NlaStrip");
-	RNA_def_property_ui_text(prop, "NLA Strips", "NLA Strips that this strip acts as a container for (if it is of type Meta)");
+	RNA_def_property_ui_text(prop, "NLA Strips",
+	                         "NLA Strips that this strip acts as a container for (if it is of type Meta)");
 	
 	/* Settings - Values necessary for evaluation */
-	prop= RNA_def_property(srna, "influence", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Influence", "Amount the strip contributes to the current result");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
-	prop= RNA_def_property(srna, "strip_time", PROP_FLOAT, PROP_TIME);
+	prop = RNA_def_property(srna, "strip_time", PROP_FLOAT, PROP_TIME);
 	RNA_def_property_ui_text(prop, "Strip Time", "Frame of referenced Action to evaluate");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
-		// TODO: should the animated_influence/time settings be animatable themselves?
-	prop= RNA_def_property(srna, "use_animated_influence", PROP_BOOLEAN, PROP_NONE);
+		/* TODO: should the animated_influence/time settings be animatable themselves? */
+	prop = RNA_def_property(srna, "use_animated_influence", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_USR_INFLUENCE);
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_NlaStrip_animated_influence_set");
-	RNA_def_property_ui_text(prop, "Animated Influence", "Influence setting is controlled by an F-Curve rather than automatically determined");
+	RNA_def_property_ui_text(prop, "Animated Influence",
+	                         "Influence setting is controlled by an F-Curve rather than automatically determined");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
-	prop= RNA_def_property(srna, "use_animated_time", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_animated_time", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_USR_TIME);
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_NlaStrip_animated_time_set");
-	RNA_def_property_ui_text(prop, "Animated Strip Time", "Strip time is controlled by an F-Curve rather than automatically determined");
+	RNA_def_property_ui_text(prop, "Animated Strip Time",
+	                         "Strip time is controlled by an F-Curve rather than automatically determined");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
-	prop= RNA_def_property(srna, "use_animated_time_cyclic", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_animated_time_cyclic", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_USR_TIME_CYCLIC);
 	RNA_def_property_ui_text(prop, "Cyclic Strip Time", "Cycle the animated time within the action start & end");
-	RNA_def_property_update(prop, 0, "rna_NlaStrip_transform_update"); // is there a better update flag?
+	RNA_def_property_update(prop, 0, "rna_NlaStrip_transform_update"); /* is there a better update flag? */
 	
 	/* settings */
-	prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* can be made editable by hooking it up to the necessary NLA API methods */
+	prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
+		/* can be made editable by hooking it up to the necessary NLA API methods */
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_ACTIVE);
 	RNA_def_property_ui_text(prop, "Active", "NLA Strip is active");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
-	prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_SELECT);
 	RNA_def_property_ui_text(prop, "Select", "NLA Strip is selected");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
-	prop= RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_MUTED);
 	RNA_def_property_ui_text(prop, "Muted", "NLA Strip is not evaluated");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
-	prop= RNA_def_property(srna, "use_reverse", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_reverse", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_REVERSE);
-	RNA_def_property_ui_text(prop, "Reversed", "NLA Strip is played back in reverse order (only when timing is automatically determined)");
+	RNA_def_property_ui_text(prop, "Reversed",
+	                         "NLA Strip is played back in reverse order (only when timing is "
+	                         "automatically determined)");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
-	// TODO: 
-	// - sync length
+	/* TODO:  */
+	/* - sync length */
 }
 
 static void rna_api_nlatrack_strips(BlenderRNA *brna, PropertyRNA *cprop)
@@ -558,16 +578,17 @@ static void rna_api_nlatrack_strips(BlenderRNA *brna, PropertyRNA *cprop)
 	FunctionRNA *func;
 
 	RNA_def_property_srna(cprop, "NlaStrips");
-	srna= RNA_def_struct(brna, "NlaStrips", NULL);
+	srna = RNA_def_struct(brna, "NlaStrips", NULL);
 	RNA_def_struct_sdna(srna, "NlaTrack");
 	RNA_def_struct_ui_text(srna, "Nla Strips", "Collection of Nla Strips");
 
 	func = RNA_def_function(srna, "new", "rna_NlaStrip_new");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Add a new Action-Clip strip to the track");
-	parm= RNA_def_string(func, "name", "NlaStrip", 0, "", "Name for the NLA Strips");
+	parm = RNA_def_string(func, "name", "NlaStrip", 0, "", "Name for the NLA Strips");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm = RNA_def_int(func, "start", 0, INT_MIN, INT_MAX, "Start Frame", "Start frame for this strip", INT_MIN, INT_MAX);
+	parm = RNA_def_int(func, "start", 0, INT_MIN, INT_MAX, "Start Frame",
+	                   "Start frame for this strip", INT_MIN, INT_MAX);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	parm = RNA_def_pointer(func, "action", "Action", "", "Action to assign to this strip");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
@@ -587,47 +608,51 @@ static void rna_def_nlatrack(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "NlaTrack", NULL);
+	srna = RNA_def_struct(brna, "NlaTrack", NULL);
 	RNA_def_struct_ui_text(srna, "NLA Track", "A animation layer containing Actions referenced as NLA strips");
 	RNA_def_struct_ui_icon(srna, ICON_NLA);
 	
 	/* strips collection */
-	prop= RNA_def_property(srna, "strips", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "strips", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "NlaStrip");
 	RNA_def_property_ui_text(prop, "NLA Strips", "NLA Strips on this NLA-track");
 
 	rna_api_nlatrack_strips(brna, prop);
 
 	/* name property */
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Name", "");
 	RNA_def_struct_name_property(srna, prop);
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
 	/* settings */
-	prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* can be made editable by hooking it up to the necessary NLA API methods */
+	prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
+		/* can be made editable by hooking it up to the necessary NLA API methods */
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", NLATRACK_ACTIVE);
 	RNA_def_property_ui_text(prop, "Active", "NLA Track is active");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
-	prop= RNA_def_property(srna, "is_solo", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* can be made editable by hooking it up to the necessary NLA API methods */
+	prop = RNA_def_property(srna, "is_solo", PROP_BOOLEAN, PROP_NONE);
+		/* can be made editable by hooking it up to the necessary NLA API methods */
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", NLATRACK_SOLO);
-	RNA_def_property_ui_text(prop, "Solo", "NLA Track is evaluated itself (i.e. active Action and all other NLA Tracks in the same AnimData block are disabled)");
+	RNA_def_property_ui_text(prop, "Solo",
+	                         "NLA Track is evaluated itself (i.e. active Action and all other NLA Tracks in the "
+	                         "same AnimData block are disabled)");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
-	prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", NLATRACK_SELECTED);
 	RNA_def_property_ui_text(prop, "Select", "NLA Track is selected");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 	
-	prop= RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", NLATRACK_MUTED);
 	RNA_def_property_ui_text(prop, "Muted", "NLA Track is not evaluated");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
 
-	prop= RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", NLATRACK_PROTECTED);
 	RNA_def_property_ui_text(prop, "Locked", "NLA Track is locked");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will do? */
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 989202f..a101bca 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -35,6 +35,8 @@
 #include "rna_internal.h"
 #include "rna_internal_types.h"
 
+#include "BLI_listbase.h"
+
 #include "DNA_material_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_node_types.h"
@@ -185,7 +187,7 @@ static StructRNA *rna_Node_refine(struct PointerRNA *ptr)
 {
 	bNode *node = (bNode*)ptr->data;
 
-	switch(node->type) {
+	switch (node->type) {
 		
 		#define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
 			case ID: return &RNA_##Category##StructName;
@@ -206,9 +208,9 @@ static StructRNA *rna_Node_refine(struct PointerRNA *ptr)
 
 static StructRNA *rna_NodeTree_refine(struct PointerRNA *ptr)
 {
-	bNodeTree *ntree= (bNodeTree*)ptr->data;
+	bNodeTree *ntree = (bNodeTree*)ptr->data;
 
-	switch(ntree->type) {
+	switch (ntree->type) {
 		case NTREE_SHADER:
 			return &RNA_ShaderNodeTree;
 		case NTREE_COMPOSIT:
@@ -222,14 +224,14 @@ static StructRNA *rna_NodeTree_refine(struct PointerRNA *ptr)
 
 static char *rna_Node_path(PointerRNA *ptr)
 {
-	bNode *node= (bNode*)ptr->data;
+	bNode *node = (bNode*)ptr->data;
 
 	return BLI_sprintfN("nodes[\"%s\"]", node->name);
 }
 
 static StructRNA *rna_NodeSocket_refine(PointerRNA *ptr)
 {
-	bNodeSocket *sock= (bNodeSocket*)ptr->data;
+	bNodeSocket *sock = (bNodeSocket*)ptr->data;
 	
 	if (sock->default_value) {
 		/* This returns the refined socket type with the full definition
@@ -238,29 +240,33 @@ static StructRNA *rna_NodeSocket_refine(PointerRNA *ptr)
 		
 		#define SUBTYPE(socktype, stypename, id, idname) \
 		{ \
-			bNodeSocketValue##stypename *value= (bNodeSocketValue##stypename*)sock->default_value; \
-			if (value->subtype==PROP_##id) \
+			bNodeSocketValue##stypename *value = (bNodeSocketValue##stypename*)sock->default_value; \
+			if (value->subtype == PROP_##id) \
 				return &RNA_NodeSocket##stypename##idname; \
 		}
 		
-		switch (sock->type) {
-		case SOCK_FLOAT:
-			NODE_DEFINE_SUBTYPES_FLOAT
-			break;
-		case SOCK_INT:
-			NODE_DEFINE_SUBTYPES_INT
-			break;
-		case SOCK_BOOLEAN:
-			return &RNA_NodeSocketBoolean;
-			break;
-		case SOCK_VECTOR:
-			NODE_DEFINE_SUBTYPES_VECTOR
-			break;
-		case SOCK_RGBA:
-			return &RNA_NodeSocketRGBA;
+		switch (sock->struct_type) {
+		case SOCK_STRUCT_NONE:
+			switch (sock->type) {
+			case SOCK_FLOAT:
+				NODE_DEFINE_SUBTYPES_FLOAT
+				break;
+			case SOCK_INT:
+				NODE_DEFINE_SUBTYPES_INT
+				break;
+			case SOCK_BOOLEAN:
+				return &RNA_NodeSocketBoolean;
+			case SOCK_VECTOR:
+				NODE_DEFINE_SUBTYPES_VECTOR
+				break;
+			case SOCK_RGBA:
+				return &RNA_NodeSocketRGBA;
+			case SOCK_SHADER:
+				return &RNA_NodeSocketShader;
+			}
 			break;
-		case SOCK_SHADER:
-			return &RNA_NodeSocketShader;
+		case SOCK_STRUCT_OUTPUT_FILE:
+			return &RNA_NodeImageFileSocket;
 		}
 		
 		#undef SUBTYPE
@@ -271,8 +277,8 @@ static StructRNA *rna_NodeSocket_refine(PointerRNA *ptr)
 
 static char *rna_NodeSocket_path(PointerRNA *ptr)
 {
-	bNodeTree *ntree= (bNodeTree*)ptr->id.data;
-	bNodeSocket *sock= (bNodeSocket*)ptr->data;
+	bNodeTree *ntree = (bNodeTree*)ptr->id.data;
+	bNodeSocket *sock = (bNodeSocket*)ptr->data;
 	bNode *node;
 	int socketindex;
 	
@@ -302,54 +308,36 @@ static char *rna_NodeSocket_path(PointerRNA *ptr)
 /* Button Set Funcs for Matte Nodes */
 static void rna_Matte_t1_set(PointerRNA *ptr, float value)
 {
-	bNode *node= (bNode*)ptr->data;
+	bNode *node = (bNode*)ptr->data;
 	NodeChroma *chroma = node->storage;
 	
 	chroma->t1 = value;
 	
-	if(value < chroma->t2) 
+	if (value < chroma->t2)
 		chroma->t2 = value;
 }
 
 static void rna_Matte_t2_set(PointerRNA *ptr, float value)
 {
-	bNode *node= (bNode*)ptr->data;
+	bNode *node = (bNode*)ptr->data;
 	NodeChroma *chroma = node->storage;
 	
-	if(value > chroma->t1) 
+	if (value > chroma->t1)
 		value = chroma->t1;
 	
 	chroma->t2 = value;
 }
 
-static void rna_Image_start_frame_set(PointerRNA *ptr, int value)
-{
-	bNode *node= (bNode*)ptr->data;
-	NodeImageFile *image = node->storage;
-	
-	CLAMP(value, MINFRAME, image->efra); 
-	image->sfra= value;
-}
-
-static void rna_Image_end_frame_set(PointerRNA *ptr, int value)
-{
-	bNode *node= (bNode*)ptr->data;
-	NodeImageFile *image = node->storage;
-
-	CLAMP(value, image->sfra, MAXFRAME);
-	image->efra= value;
-}
-
 static void rna_Node_scene_set(PointerRNA *ptr, PointerRNA value)
 {
-	bNode *node= (bNode*)ptr->data;
+	bNode *node = (bNode*)ptr->data;
 
 	if (node->id) {
 		id_us_min(node->id);
-		node->id= NULL;
+		node->id = NULL;
 	}
 
-	node->id= value.data;
+	node->id = value.data;
 
 	id_us_plus(node->id);
 }
@@ -363,16 +351,16 @@ static void node_update(Main *bmain, Scene *UNUSED(scene), bNodeTree *ntree, bNo
 
 static void rna_Node_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	bNodeTree *ntree= (bNodeTree*)ptr->id.data;
-	bNode *node= (bNode*)ptr->data;
+	bNodeTree *ntree = (bNodeTree*)ptr->id.data;
+	bNode *node = (bNode*)ptr->data;
 
 	node_update(bmain, scene, ntree, node);
 }
 
-static void rna_Node_image_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Node_tex_image_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	bNodeTree *ntree= (bNodeTree*)ptr->id.data;
-	bNode *node= (bNode*)ptr->data;
+	bNodeTree *ntree = (bNodeTree*)ptr->id.data;
+	bNode *node = (bNode*)ptr->data;
 
 	node_update(bmain, scene, ntree, node);
 	WM_main_add_notifier(NC_IMAGE, NULL);
@@ -380,10 +368,10 @@ static void rna_Node_image_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 
 static void rna_Node_material_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	bNodeTree *ntree= (bNodeTree*)ptr->id.data;
-	bNode *node= (bNode*)ptr->data;
+	bNodeTree *ntree = (bNodeTree*)ptr->id.data;
+	bNode *node = (bNode*)ptr->data;
 
-	if(node->id)
+	if (node->id)
 		nodeSetActive(ntree, node);
 
 	node_update(bmain, scene, ntree, node);
@@ -391,8 +379,8 @@ static void rna_Node_material_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 
 static void rna_NodeGroup_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	bNodeTree *ntree= (bNodeTree*)ptr->id.data;
-	bNode *node= (bNode*)ptr->data;
+	bNodeTree *ntree = (bNodeTree*)ptr->id.data;
+	bNode *node = (bNode*)ptr->data;
 	
 	ntreeUpdateTree((bNodeTree *)node->id);
 	
@@ -401,8 +389,8 @@ static void rna_NodeGroup_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 
 static void rna_Node_name_set(PointerRNA *ptr, const char *value)
 {
-	bNodeTree *ntree= (bNodeTree*)ptr->id.data;
-	bNode *node= (bNode*)ptr->data;
+	bNodeTree *ntree = (bNodeTree*)ptr->id.data;
+	bNode *node = (bNode*)ptr->data;
 	char oldname[sizeof(node->name)];
 	
 	/* make a copy of the old name first */
@@ -413,13 +401,13 @@ static void rna_Node_name_set(PointerRNA *ptr, const char *value)
 	nodeUniqueName(ntree, node);
 	
 	/* fix all the animation data which may link to this */
-	BKE_all_animdata_fix_paths_rename("nodes", oldname, node->name);
+	BKE_all_animdata_fix_paths_rename(NULL, "nodes", oldname, node->name);
 }
 
 static void rna_NodeSocket_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	bNodeTree *ntree= (bNodeTree*)ptr->id.data;
-	bNodeSocket *sock= (bNodeSocket*)ptr->data;
+	bNodeTree *ntree = (bNodeTree*)ptr->id.data;
+	bNodeSocket *sock = (bNodeSocket*)ptr->data;
 	bNode *node;
 	
 	if (nodeFindNode(ntree, sock, &node, NULL, NULL))
@@ -428,8 +416,8 @@ static void rna_NodeSocket_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 
 static void rna_NodeGroupSocket_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	bNodeTree *ntree= (bNodeTree*)ptr->id.data;
-	bNodeSocket *sock= (bNodeSocket*)ptr->data;
+	bNodeTree *ntree = (bNodeTree*)ptr->id.data;
+	bNodeSocket *sock = (bNodeSocket*)ptr->data;
 	bNode *node;
 	
 	ntreeUpdateTree(ntree);
@@ -441,42 +429,42 @@ static void rna_NodeGroupSocket_update(Main *bmain, Scene *scene, PointerRNA *pt
 #if 0 /* UNUSED */
 static void rna_NodeLink_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	bNodeTree *ntree= (bNodeTree*)ptr->id.data;
+	bNodeTree *ntree = (bNodeTree*)ptr->id.data;
 
 	ntree->update |= NTREE_UPDATE_LINKS;
 	ntreeUpdateTree(ntree);
 }
 #endif
 
-static void rna_NodeSocketInt_range(PointerRNA *ptr, int *min, int *max)
+static void rna_NodeSocketInt_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
 {
-	bNodeSocket *sock= (bNodeSocket*)ptr->data;
-	bNodeSocketValueInt *val= (bNodeSocketValueInt*)sock->default_value;
-	*min = val->min;
-	*max = val->max;
+	bNodeSocket *sock = (bNodeSocket*)ptr->data;
+	bNodeSocketValueInt *val = (bNodeSocketValueInt*)sock->default_value;
+	*softmin = val->min;
+	*softmax = val->max;
 }
 
-static void rna_NodeSocketFloat_range(PointerRNA *ptr, float *min, float *max)
+static void rna_NodeSocketFloat_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
 {
-	bNodeSocket *sock= (bNodeSocket*)ptr->data;
-	bNodeSocketValueFloat *val= (bNodeSocketValueFloat*)sock->default_value;
-	*min = val->min;
-	*max = val->max;
+	bNodeSocket *sock = (bNodeSocket*)ptr->data;
+	bNodeSocketValueFloat *val = (bNodeSocketValueFloat*)sock->default_value;
+	*softmin = val->min;
+	*softmax = val->max;
 }
 
-static void rna_NodeSocketVector_range(PointerRNA *ptr, float *min, float *max)
+static void rna_NodeSocketVector_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
 {
-	bNodeSocket *sock= (bNodeSocket*)ptr->data;
-	bNodeSocketValueVector *val= (bNodeSocketValueVector*)sock->default_value;
-	*min = val->min;
-	*max = val->max;
+	bNodeSocket *sock = (bNodeSocket*)ptr->data;
+	bNodeSocketValueVector *val = (bNodeSocketValueVector*)sock->default_value;
+	*softmin = val->min;
+	*softmax = val->max;
 }
 
 static void rna_Node_image_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	bNode *node= (bNode*)ptr->data;
+	bNode *node = (bNode*)ptr->data;
 	Image *ima = (Image *)node->id;
-	ImageUser *iuser= node->storage;
+	ImageUser *iuser = node->storage;
 	
 	BKE_image_multilayer_index(ima->rr, iuser);
 	BKE_image_signal(ima, iuser, IMA_SIGNAL_SRC_CHANGE);
@@ -486,16 +474,16 @@ static void rna_Node_image_layer_update(Main *bmain, Scene *scene, PointerRNA *p
 
 static EnumPropertyItem *renderresult_layers_add_enum(RenderLayer *rl)
 {
-	EnumPropertyItem *item= NULL;
+	EnumPropertyItem *item = NULL;
 	EnumPropertyItem tmp = {0, "", 0, "", ""};
-	int i=0, totitem=0;
+	int i = 0, totitem = 0;
 	
 	while (rl) {
 		tmp.identifier = rl->name;
-		tmp.name= rl->name;
+		tmp.name = rl->name;
 		tmp.value = i++;
 		RNA_enum_item_add(&item, &totitem, &tmp);
-		rl=rl->next;
+		rl = rl->next;
 	}
 	
 	RNA_enum_item_end(&item, &totitem);
@@ -503,11 +491,12 @@ static EnumPropertyItem *renderresult_layers_add_enum(RenderLayer *rl)
 	return item;
 }
 
-static EnumPropertyItem *rna_Node_image_layer_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
+static EnumPropertyItem *rna_Node_image_layer_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+                                                    PropertyRNA *UNUSED(prop), int *free)
 {
-	bNode *node= (bNode*)ptr->data;
+	bNode *node = (bNode*)ptr->data;
 	Image *ima = (Image *)node->id;
-	EnumPropertyItem *item= NULL;
+	EnumPropertyItem *item = NULL;
 	RenderLayer *rl;
 	
 	if (!ima || !(ima->rr)) return NULL;
@@ -515,16 +504,17 @@ static EnumPropertyItem *rna_Node_image_layer_itemf(bContext *UNUSED(C), Pointer
 	rl = ima->rr->layers.first;
 	item = renderresult_layers_add_enum(rl);
 	
-	*free= 1;
+	*free = 1;
 	
 	return item;
 }
 
-static EnumPropertyItem *rna_Node_scene_layer_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
+static EnumPropertyItem *rna_Node_scene_layer_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+                                                    PropertyRNA *UNUSED(prop), int *free)
 {
-	bNode *node= (bNode*)ptr->data;
+	bNode *node = (bNode*)ptr->data;
 	Scene *sce = (Scene *)node->id;
-	EnumPropertyItem *item= NULL;
+	EnumPropertyItem *item = NULL;
 	RenderLayer *rl;
 	
 	if (!sce) return NULL;
@@ -532,49 +522,50 @@ static EnumPropertyItem *rna_Node_scene_layer_itemf(bContext *UNUSED(C), Pointer
 	rl = sce->r.layers.first;
 	item = renderresult_layers_add_enum(rl);
 	
-	*free= 1;
+	*free = 1;
 	
 	return item;
 }
 
-static EnumPropertyItem *rna_Node_channel_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
+static EnumPropertyItem *rna_Node_channel_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+                                                PropertyRNA *UNUSED(prop), int *free)
 {
-	bNode *node= (bNode*)ptr->data;
-	EnumPropertyItem *item= NULL;
+	bNode *node = (bNode*)ptr->data;
+	EnumPropertyItem *item = NULL;
 	EnumPropertyItem tmp = {0, "", 0, "", ""};
-	int totitem=0;
+	int totitem = 0;
 	
-	switch(node->custom1) {
+	switch (node->custom1) {
 		case CMP_NODE_CHANNEL_MATTE_CS_RGB:
-			tmp.identifier= "R"; tmp.name= "R"; tmp.value= 1;
+			tmp.identifier = "R"; tmp.name = "R"; tmp.value = 1;
 			RNA_enum_item_add(&item, &totitem, &tmp);
-			tmp.identifier= "G"; tmp.name= "G"; tmp.value= 2;
+			tmp.identifier = "G"; tmp.name = "G"; tmp.value = 2;
 			RNA_enum_item_add(&item, &totitem, &tmp);
-			tmp.identifier= "B"; tmp.name= "B"; tmp.value= 3;
+			tmp.identifier = "B"; tmp.name = "B"; tmp.value = 3;
 			RNA_enum_item_add(&item, &totitem, &tmp);
 			break;
 		case CMP_NODE_CHANNEL_MATTE_CS_HSV:
-			tmp.identifier= "H"; tmp.name= "H"; tmp.value= 1;
+			tmp.identifier = "H"; tmp.name = "H"; tmp.value = 1;
 			RNA_enum_item_add(&item, &totitem, &tmp);
-			tmp.identifier= "S"; tmp.name= "S"; tmp.value= 2;
+			tmp.identifier = "S"; tmp.name = "S"; tmp.value = 2;
 			RNA_enum_item_add(&item, &totitem, &tmp);
-			tmp.identifier= "V"; tmp.name= "V"; tmp.value= 3;
+			tmp.identifier = "V"; tmp.name = "V"; tmp.value = 3;
 			RNA_enum_item_add(&item, &totitem, &tmp);
 			break;
 		case CMP_NODE_CHANNEL_MATTE_CS_YUV:
-			tmp.identifier= "Y"; tmp.name= "Y"; tmp.value= 1;
+			tmp.identifier = "Y"; tmp.name = "Y"; tmp.value = 1;
 			RNA_enum_item_add(&item, &totitem, &tmp);
-			tmp.identifier= "G"; tmp.name= "U"; tmp.value= 2;
+			tmp.identifier = "G"; tmp.name = "U"; tmp.value = 2;
 			RNA_enum_item_add(&item, &totitem, &tmp);
-			tmp.identifier= "V"; tmp.name= "V"; tmp.value= 3;
+			tmp.identifier = "V"; tmp.name = "V"; tmp.value = 3;
 			RNA_enum_item_add(&item, &totitem, &tmp);
 			break;
 		case CMP_NODE_CHANNEL_MATTE_CS_YCC:
-			tmp.identifier= "Y"; tmp.name= "Y"; tmp.value= 1;
+			tmp.identifier = "Y"; tmp.name = "Y"; tmp.value = 1;
 			RNA_enum_item_add(&item, &totitem, &tmp);
-			tmp.identifier= "CB"; tmp.name= "Cr"; tmp.value= 2;
+			tmp.identifier = "CB"; tmp.name = "Cr"; tmp.value = 2;
 			RNA_enum_item_add(&item, &totitem, &tmp);
-			tmp.identifier= "CR"; tmp.name= "Cb"; tmp.value= 3;
+			tmp.identifier = "CR"; tmp.name = "Cb"; tmp.value = 3;
 			RNA_enum_item_add(&item, &totitem, &tmp);
 			break;
 		default:
@@ -582,12 +573,13 @@ static EnumPropertyItem *rna_Node_channel_itemf(bContext *UNUSED(C), PointerRNA
 	}
 
 	RNA_enum_item_end(&item, &totitem);
-	*free= 1;
+	*free = 1;
 	
 	return item;
 }
 
-static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bContext *UNUSED(C), ReportList *reports, int type, bNodeTree *group)
+static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bContext *C, ReportList *reports,
+                                    int type, bNodeTree *group)
 {
 	bNode *node;
 	bNodeTemplate ntemp;
@@ -599,6 +591,8 @@ static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bContext *UNUSED(C), Repor
 	
 	ntemp.type = type;
 	ntemp.ngroup = group;
+	ntemp.scene = CTX_data_scene(C);
+	ntemp.main = CTX_data_main(C);
 	node = nodeAddNode(ntree, &ntemp);
 	
 	if (node == NULL) {
@@ -616,21 +610,22 @@ static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bContext *UNUSED(C), Repor
 	return node;
 }
 
-static bNode *rna_NodeTree_node_composite_new(bNodeTree *ntree, bContext *C, ReportList *reports, int type, bNodeTree *group)
+static bNode *rna_NodeTree_node_composite_new(bNodeTree *ntree, bContext *C, ReportList *reports,
+                                              int type, bNodeTree *group)
 {
-	/* raises error on failier */
-	bNode *node= rna_NodeTree_node_new(ntree, C, reports, type, group);
+	/* raises error on failure */
+	bNode *node = rna_NodeTree_node_new(ntree, C, reports, type, group);
 	
 	if (node) {
-		if(ELEM4(node->type, CMP_NODE_COMPOSITE, CMP_NODE_DEFOCUS, CMP_NODE_OUTPUT_FILE, CMP_NODE_R_LAYERS)) {
+		if (ELEM4(node->type, CMP_NODE_COMPOSITE, CMP_NODE_DEFOCUS, CMP_NODE_OUTPUT_FILE, CMP_NODE_R_LAYERS)) {
 			/* annoying, find the node tree we are in, scene can be NULL */
 			Scene *scene;
-			for(scene= CTX_data_main(C)->scene.first; scene; scene= scene->id.next) {
-				if(scene->nodetree == ntree) {
+			for (scene = CTX_data_main(C)->scene.first; scene; scene = scene->id.next) {
+				if (scene->nodetree == ntree) {
 					break;
 				}
 			}
-			node->id= (ID *)scene;
+			node->id = (ID *)scene;
 			id_us_plus(node->id);
 		}
 
@@ -641,10 +636,11 @@ static bNode *rna_NodeTree_node_composite_new(bNodeTree *ntree, bContext *C, Rep
 	return node;
 }
 
-static bNode *rna_NodeTree_node_texture_new(bNodeTree *ntree, bContext *C, ReportList *reports, int type, bNodeTree *group)
+static bNode *rna_NodeTree_node_texture_new(bNodeTree *ntree, bContext *C, ReportList *reports,
+                                            int type, bNodeTree *group)
 {
-	/* raises error on failier */
-	bNode *node= rna_NodeTree_node_new(ntree, C, reports, type, group);
+	/* raises error on failure */
+	bNode *node = rna_NodeTree_node_new(ntree, C, reports, type, group);
 
 	if (node) {
 		ntreeTexCheckCyclics(ntree);
@@ -671,17 +667,17 @@ static void rna_NodeTree_node_remove(bNodeTree *ntree, ReportList *reports, bNod
 
 static void rna_NodeTree_node_clear(bNodeTree *ntree)
 {
-	bNode *node= ntree->nodes.first;
+	bNode *node = ntree->nodes.first;
 
-	while(node) {
-		bNode *next_node= node->next;
+	while (node) {
+		bNode *next_node = node->next;
 
 		if (node->id)
 			id_us_min(node->id);
 
 		nodeFreeNode(ntree, node);
 
-		node= next_node;
+		node = next_node;
 	}
 
 	ntreeUpdateTree(ntree); /* update group node socket links*/
@@ -689,14 +685,15 @@ static void rna_NodeTree_node_clear(bNodeTree *ntree)
 	WM_main_add_notifier(NC_NODE|NA_EDITED, ntree);
 }
 
-static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, ReportList *reports, bNodeSocket *in, bNodeSocket *out)
+static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, ReportList *reports,
+                                        bNodeSocket *fromsock, bNodeSocket *tosock)
 {
 	bNodeLink *ret;
-	bNode *fromnode= NULL, *tonode= NULL;
+	bNode *fromnode = NULL, *tonode = NULL;
 	int from_in_out, to_in_out;
 
-	nodeFindNode(ntree, in, &fromnode, NULL, &from_in_out);
-	nodeFindNode(ntree, out, &tonode, NULL, &to_in_out);
+	nodeFindNode(ntree, fromsock, &fromnode, NULL, &from_in_out);
+	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");
@@ -704,17 +701,21 @@ static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, ReportList *reports, b
 	}
 
 	/* unlink node input socket */
-	nodeRemSocketLinks(ntree, out);
+	if (to_in_out == SOCK_IN)
+		nodeRemSocketLinks(ntree, tosock);
+	else
+		nodeRemSocketLinks(ntree, fromsock);
 
-	ret= nodeAddLink(ntree, fromnode, in, tonode, out);
+	ret = nodeAddLink(ntree, fromnode, fromsock, tonode, tosock);
 	
-	if(ret) {
+	if (ret) {
 		nodeUpdate(ntree, tonode);
 
 		ntreeUpdateTree(ntree);
 
 		WM_main_add_notifier(NC_NODE|NA_EDITED, ntree);
 	}
+
 	return ret;
 }
 
@@ -733,14 +734,14 @@ static void rna_NodeTree_link_remove(bNodeTree *ntree, ReportList *reports, bNod
 
 static void rna_NodeTree_link_clear(bNodeTree *ntree)
 {
-	bNodeLink *link= ntree->links.first;
+	bNodeLink *link = ntree->links.first;
 
-	while(link) {
-		bNodeLink *next_link= link->next;
+	while (link) {
+		bNodeLink *next_link = link->next;
 
 		nodeRemLink(ntree, link);
 
-		link= next_link;
+		link = next_link;
 	}
 	ntreeUpdateTree(ntree);
 
@@ -750,7 +751,7 @@ static void rna_NodeTree_link_clear(bNodeTree *ntree)
 static bNodeSocket *rna_NodeTree_input_new(bNodeTree *ntree, ReportList *UNUSED(reports), const char *name, int type)
 {
 	/* XXX should check if tree is a group here! no good way to do this currently. */
-	bNodeSocket *gsock= node_group_add_socket(ntree, name, type, SOCK_IN);
+	bNodeSocket *gsock = node_group_add_socket(ntree, name, type, SOCK_IN);
 	
 	ntree->update |= NTREE_UPDATE_GROUP_IN;
 	ntreeUpdateTree(ntree);
@@ -761,7 +762,7 @@ static bNodeSocket *rna_NodeTree_input_new(bNodeTree *ntree, ReportList *UNUSED(
 static bNodeSocket *rna_NodeTree_output_new(bNodeTree *ntree, ReportList *UNUSED(reports), const char *name, int type)
 {
 	/* XXX should check if tree is a group here! no good way to do this currently. */
-	bNodeSocket *gsock= node_group_add_socket(ntree, name, type, SOCK_OUT);
+	bNodeSocket *gsock = node_group_add_socket(ntree, name, type, SOCK_OUT);
 	
 	ntree->update |= NTREE_UPDATE_GROUP_OUT;
 	ntreeUpdateTree(ntree);
@@ -777,7 +778,7 @@ static bNodeSocket *rna_NodeTree_input_expose(bNodeTree *ntree, ReportList *repo
 	
 	if (!nodeFindNode(ntree, sock, &node, &index, &in_out))
 		BKE_reportf(reports, RPT_ERROR, "Unable to locate socket in nodetree");
-	else if (in_out!=SOCK_IN)
+	else if (in_out != SOCK_IN)
 		BKE_reportf(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. */
@@ -801,7 +802,7 @@ static bNodeSocket *rna_NodeTree_output_expose(bNodeTree *ntree, ReportList *rep
 	
 	if (!nodeFindNode(ntree, sock, &node, &index, &in_out))
 		BKE_reportf(reports, RPT_ERROR, "Unable to locate socket in nodetree");
-	else if (in_out!=SOCK_OUT)
+	else if (in_out != SOCK_OUT)
 		BKE_reportf(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. */
@@ -824,6 +825,16 @@ static void rna_Mapping_Node_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 	rna_Node_update(bmain, scene, ptr);
 }
 
+static PointerRNA rna_CompositNodeOutputMultiFile_active_input_get(PointerRNA *ptr)
+{
+	bNode *node = ptr->data;
+	NodeImageMultiFile *nimf = node->storage;
+	bNodeSocket *sock = BLI_findlink(&node->inputs, nimf->active_input);
+	PointerRNA sock_ptr;
+	RNA_pointer_create((ID*)ptr->id.data, &RNA_NodeSocket, sock, &sock_ptr);
+	return sock_ptr;
+}
+
 #else
 
 static EnumPropertyItem prop_image_layer_items[] = {
@@ -931,15 +942,15 @@ static void alloc_node_type_items(EnumPropertyItem *items, int category)
 	int count = 3;
 	EnumPropertyItem *item  = items;
 	
-	for(i=0; i<MaxNodes; i++)
-		if(nodes[i].defined && nodes[i].category == category)
+	for (i = 0; i<MaxNodes; i++)
+		if (nodes[i].defined && nodes[i].category == category)
 			count++;
 		
 	/*item = items = MEM_callocN(count * sizeof(EnumPropertyItem), "alloc_node_type_items");*/
 	
-	for(i=0; i<MaxNodes; i++) {
+	for (i = 0; i<MaxNodes; i++) {
 		NodeInfo *node = nodes + i;
-		if(node->defined && node->category == category) {
+		if (node->defined && node->category == category) {
 			item->value = i;
 			item->identifier = node->enum_name;
 			item->icon = node->icon;
@@ -1018,7 +1029,7 @@ static void def_whileloop(StructRNA *srna)
 
 static void def_frame(StructRNA *srna)
 {
-//	PropertyRNA *prop;
+/*	PropertyRNA *prop; */
 	
 }
 
@@ -1167,37 +1178,38 @@ static void def_sh_mapping(StructRNA *srna)
 	
 	RNA_def_struct_sdna_from(srna, "TexMapping", "storage");
 
-	prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "translation", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "loc");
 	RNA_def_property_ui_text(prop, "Location", "");
 	RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
 	
-	prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER); /* Not PROP_XYZ, this is now in radians, no more degrees */
+		/* Not PROP_XYZ, this is now in radians, no more degrees */
+	prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER);
 	RNA_def_property_float_sdna(prop, NULL, "rot");
 	RNA_def_property_ui_text(prop, "Rotation", "");
 	RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
 	
-	prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "size");
 	RNA_def_property_ui_text(prop, "Scale", "");
 	RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
 	
-	prop= RNA_def_property(srna, "min", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "min");
 	RNA_def_property_ui_text(prop, "Minimum", "Minimum value for clipping");
 	RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
 	
-	prop= RNA_def_property(srna, "max", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "max");
 	RNA_def_property_ui_text(prop, "Maximum", "Maximum value for clipping");
 	RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
 	
-	prop= RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MIN);
 	RNA_def_property_ui_text(prop, "Has Minimum", "Whether to use minimum clipping value");
 	RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
 	
-	prop= RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MAX);
 	RNA_def_property_ui_text(prop, "Has Maximum", "Whether to use maximum clipping value");
 	RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
@@ -1236,12 +1248,12 @@ static void def_sh_tex(StructRNA *srna)
 {
 	PropertyRNA *prop;
 
-	prop= RNA_def_property(srna, "texture_mapping", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "texture_mapping", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "base.tex_mapping");
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_ui_text(prop, "Texture Mapping", "Texture coordinate mapping settings");
 
-	prop= RNA_def_property(srna, "color_mapping", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "color_mapping", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "base.color_mapping");
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_ui_text(prop, "Color Mapping", "Color mapping settings");
@@ -1265,11 +1277,21 @@ static void def_sh_tex_sky(StructRNA *srna)
 
 static void def_sh_tex_environment(StructRNA *srna)
 {
-	static const EnumPropertyItem prop_color_space_items[]= {
-		{SHD_COLORSPACE_SRGB, "SRGB", 0, "sRGB", "Image is in sRGB color space"},
-		{SHD_COLORSPACE_LINEAR, "LINEAR", 0, "Linear", "Image is in scene linear color space"},
+	static const EnumPropertyItem prop_color_space_items[] = {
+		{SHD_COLORSPACE_COLOR, "COLOR", 0, "Color",
+		                       "Image contains color data, and will be converted to linear color for rendering"},
+		{SHD_COLORSPACE_NONE, "NONE", 0, "Non-Color Data",
+		                      "Image contains non-color data, for example a displacement or normal map, "
+		                      "and will not be converted"},
 		{0, NULL, 0, NULL, NULL}};
 
+	static const EnumPropertyItem prop_projection_items[] = {
+		{SHD_PROJ_EQUIRECTANGULAR, "EQUIRECTANGULAR", 0, "Equirectangular",
+		                           "Equirectangular or latitude-longitude projection"},
+		{SHD_PROJ_MIRROR_BALL, "MIRROR_BALL", 0, "Mirror Ball",
+		                       "Projection from an orthographic photo of a mirror ball"},
+		{0, NULL, 0, NULL, NULL}};
+	
 	PropertyRNA *prop;
 
 	prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
@@ -1277,22 +1299,31 @@ static void def_sh_tex_environment(StructRNA *srna)
 	RNA_def_property_struct_type(prop, "Image");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Image", "");
-	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_image_update");
+	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_tex_image_update");
 
-	RNA_def_struct_sdna_from(srna, "NodeTexImage", "storage");
+	RNA_def_struct_sdna_from(srna, "NodeTexEnvironment", "storage");
 	def_sh_tex(srna);
 
-	prop= RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, prop_color_space_items);
 	RNA_def_property_ui_text(prop, "Color Space", "Image file color space");
 	RNA_def_property_update(prop, 0, "rna_Node_update");
+
+	prop = RNA_def_property(srna, "projection", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_items(prop, prop_projection_items);
+	RNA_def_property_ui_text(prop, "Projection", "Projection of the input image");
+	RNA_def_property_update(prop, 0, "rna_Node_update");
+
 }
 
 static void def_sh_tex_image(StructRNA *srna)
 {
-	static const EnumPropertyItem prop_color_space_items[]= {
-		{SHD_COLORSPACE_LINEAR, "LINEAR", 0, "Linear", "Image is in scene linear color space"},
-		{SHD_COLORSPACE_SRGB, "SRGB", 0, "sRGB", "Image is in sRGB color space"},
+	static const EnumPropertyItem prop_color_space_items[] = {
+		{SHD_COLORSPACE_COLOR, "COLOR", 0, "Color",
+		                       "Image contains color data, and will be converted to linear color for rendering"},
+		{SHD_COLORSPACE_NONE, "NONE", 0, "Non-Color Data",
+		                      "Image contains non-color data, for example a displacement or normal map, "
+		                      "and will not be converted"},
 		{0, NULL, 0, NULL, NULL}};
 
 	PropertyRNA *prop;
@@ -1302,12 +1333,12 @@ static void def_sh_tex_image(StructRNA *srna)
 	RNA_def_property_struct_type(prop, "Image");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Image", "");
-	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_image_update");
+	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_tex_image_update");
 
 	RNA_def_struct_sdna_from(srna, "NodeTexImage", "storage");
 	def_sh_tex(srna);
 
-	prop= RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, prop_color_space_items);
 	RNA_def_property_ui_text(prop, "Color Space", "Image file color space");
 	RNA_def_property_update(prop, 0, "rna_Node_update");
@@ -1321,7 +1352,8 @@ static void def_sh_tex_gradient(StructRNA *srna)
 		{SHD_BLEND_EASING, "EASING", 0, "Easing", "Create a progression easing from one step to the next"},
 		{SHD_BLEND_DIAGONAL, "DIAGONAL", 0, "Diagonal", "Create a diagonal progression"},
 		{SHD_BLEND_SPHERICAL, "SPHERICAL", 0, "Spherical", "Create a spherical progression"},
-		{SHD_BLEND_QUADRATIC_SPHERE, "QUADRATIC_SPHERE", 0, "Quadratic sphere", "Create a quadratic progression in the shape of a sphere"},
+		{SHD_BLEND_QUADRATIC_SPHERE, "QUADRATIC_SPHERE", 0, "Quadratic sphere",
+		                             "Create a quadratic progression in the shape of a sphere"},
 		{SHD_BLEND_RADIAL, "RADIAL", 0, "Radial", "Create a radial progression"},
 		{0, NULL, 0, NULL, NULL}};
 
@@ -1330,7 +1362,7 @@ static void def_sh_tex_gradient(StructRNA *srna)
 	RNA_def_struct_sdna_from(srna, "NodeTexGradient", "storage");
 	def_sh_tex(srna);
 
-	prop= RNA_def_property(srna, "gradient_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "gradient_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, prop_gradient_type);
 	RNA_def_property_ui_text(prop, "Gradient Type", "Style of the color blending");
 	RNA_def_property_update(prop, 0, "rna_Node_update");
@@ -1355,7 +1387,7 @@ static void def_sh_tex_magic(StructRNA *srna)
 	RNA_def_struct_sdna_from(srna, "NodeTexMagic", "storage");
 	def_sh_tex(srna);
 
-	prop= RNA_def_property(srna, "turbulence_depth", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "turbulence_depth", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "depth");
 	RNA_def_property_range(prop, 0, 10);
 	RNA_def_property_ui_text(prop, "Depth", "Level of detail in the added turbulent noise");
@@ -1377,7 +1409,7 @@ static void def_sh_tex_musgrave(StructRNA *srna)
 	RNA_def_struct_sdna_from(srna, "NodeTexMusgrave", "storage");
 	def_sh_tex(srna);
 
-	prop= RNA_def_property(srna, "musgrave_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "musgrave_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "musgrave_type");
 	RNA_def_property_enum_items(prop, prop_musgrave_type);
 	RNA_def_property_ui_text(prop, "Type", "");
@@ -1396,7 +1428,7 @@ static void def_sh_tex_voronoi(StructRNA *srna)
 	RNA_def_struct_sdna_from(srna, "NodeTexVoronoi", "storage");
 	def_sh_tex(srna);
 
-	prop= RNA_def_property(srna, "coloring", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "coloring", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "coloring");
 	RNA_def_property_enum_items(prop, prop_coloring_items);
 	RNA_def_property_ui_text(prop, "Coloring", "");
@@ -1415,7 +1447,7 @@ static void def_sh_tex_wave(StructRNA *srna)
 	RNA_def_struct_sdna_from(srna, "NodeTexWave", "storage");
 	def_sh_tex(srna);
 
-	prop= RNA_def_property(srna, "wave_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "wave_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "wave_type");
 	RNA_def_property_enum_items(prop, prop_wave_type_items);
 	RNA_def_property_ui_text(prop, "Wave Type", "");
@@ -1439,7 +1471,7 @@ static void def_cmp_alpha_over(StructRNA *srna)
 {
 	PropertyRNA *prop;
 	
-	// XXX: Tooltip
+	/* XXX: Tooltip */
 	prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
 	RNA_def_property_ui_text(prop, "Convert Premul", "");
@@ -1632,7 +1664,8 @@ static void def_cmp_vector_blur(StructRNA *srna)
 	prop = RNA_def_property(srna, "speed_min", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "minspeed");
 	RNA_def_property_range(prop, 0, 1024);
-	RNA_def_property_ui_text(prop, "Min Speed", "Minimum speed for a pixel to be blurred (used to separate background from foreground)");
+	RNA_def_property_ui_text(prop, "Min Speed",
+	                         "Minimum speed for a pixel to be blurred (used to separate background from foreground)");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 		
 	prop = RNA_def_property(srna, "speed_max", PROP_INT, PROP_NONE);
@@ -1643,8 +1676,10 @@ static void def_cmp_vector_blur(StructRNA *srna)
 	
 	prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "fac");
-	RNA_def_property_range(prop, 0.0f, 2.0f);
-	RNA_def_property_ui_text(prop, "Blur Factor", "Scaling factor for motion vectors (actually, 'shutter speed', in frames)");
+	RNA_def_property_range(prop, 0.0, 20.0);
+	RNA_def_property_ui_range(prop, 0.0, 2.0, 1.0, 2);
+	RNA_def_property_ui_text(prop, "Blur Factor",
+	                         "Scaling factor for motion vectors (actually, 'shutter speed', in frames)");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 	
 	prop = RNA_def_property(srna, "use_curved", PROP_BOOLEAN, PROP_NONE);
@@ -1676,14 +1711,14 @@ static void def_cmp_image(StructRNA *srna)
 {
 	PropertyRNA *prop;
 	
-	/*
-	 static EnumPropertyItem type_items[] = {
+#if 0
+	static EnumPropertyItem type_items[] = {
 		{IMA_SRC_FILE,      "IMAGE",     0, "Image",     ""},
 		{IMA_SRC_MOVIE,     "MOVIE",     "Movie",     ""},
 		{IMA_SRC_SEQUENCE,  "SEQUENCE",  "Sequence",  ""},
 		{IMA_SRC_GENERATED, "GENERATED", "Generated", ""},
 		{0, NULL, 0, NULL, NULL}};
-	*/
+#endif
 	
 	prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "id");
@@ -1703,13 +1738,16 @@ static void def_cmp_image(StructRNA *srna)
 	prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "sfra");
 	RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
-	RNA_def_property_ui_text(prop, "Start Frame", "Global starting frame of the movie/sequence, assuming first picture has a #1"); /* copied from the rna_image.c */
+		 /* copied from the rna_image.c */
+	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, NC_NODE|NA_EDITED, "rna_Node_update");
 	
 	prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "offset");
 	RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
-	RNA_def_property_ui_text(prop, "Offset", "Offset the number of the frame to use in the animation"); /* copied from the rna_image.c */
+		/* copied from the rna_image.c */
+	RNA_def_property_ui_text(prop, "Offset", "Offset the number of the frame to use in the animation");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 	
 	prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
@@ -1719,10 +1757,11 @@ static void def_cmp_image(StructRNA *srna)
 	
 	prop = RNA_def_property(srna, "use_auto_refresh", PROP_BOOLEAN, PROP_NONE);
 	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"); /* copied from the rna_image.c */
+		/* copied from the rna_image.c */
+	RNA_def_property_ui_text(prop, "Auto-Refresh", "Always refresh image on frame changes");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 	
-	prop= RNA_def_property(srna, "layer", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "layer", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "layer");
 	RNA_def_property_enum_items(prop, prop_image_layer_items);
 	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_image_layer_itemf");
@@ -1742,7 +1781,7 @@ static void def_cmp_render_layers(StructRNA *srna)
 	RNA_def_property_ui_text(prop, "Scene", "");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 	
-	prop= RNA_def_property(srna, "layer", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "layer", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "custom1");
 	RNA_def_property_enum_items(prop, prop_scene_layer_items);
 	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_scene_layer_itemf");
@@ -1750,36 +1789,52 @@ static void def_cmp_render_layers(StructRNA *srna)
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 }
 
-static void def_cmp_output_file(StructRNA *srna)
+static void rna_def_cmp_output_file_socket(BlenderRNA *brna)
 {
+	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	RNA_def_struct_sdna_from(srna, "NodeImageFile", "storage");
+	srna = RNA_def_struct(brna, "NodeImageFileSocket", "NodeSocketRGBA");
+	RNA_def_struct_sdna(srna, "bNodeSocket");
+	RNA_def_struct_path_func(srna, "rna_NodeSocket_path");
+	RNA_def_struct_ui_text(srna, "Node Image File Socket", "Socket data of file output node");
+	RNA_def_struct_ui_icon(srna, ICON_PLUG);
+	RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
 	
-	prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
-	RNA_def_property_string_sdna(prop, NULL, "name");
-	RNA_def_property_ui_text(prop, "File Path", "Output path for the image, same functionality as render output");
-	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+	RNA_def_struct_sdna_from(srna, "NodeImageMultiFileSocket", "storage");
 	
-	prop= RNA_def_property(srna, "image_settings", PROP_POINTER, PROP_NONE);
-	RNA_def_property_flag(prop, PROP_NEVER_NULL);
-	RNA_def_property_pointer_sdna(prop, NULL, "im_format");
+	prop = RNA_def_property(srna, "use_node_format", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "use_node_format", 1);
+	RNA_def_property_ui_text(prop, "Use Node Format", "");
+	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_NodeSocket_update");
+	
+	prop = RNA_def_property(srna, "format", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "ImageFormatSettings");
-	RNA_def_property_ui_text(prop, "Image Format", "");
-
-	prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
-	RNA_def_property_int_sdna(prop, NULL, "sfra");
-	RNA_def_property_int_funcs(prop, NULL, "rna_Image_start_frame_set", NULL);
-	RNA_def_property_range(prop, MINFRAMEF, MAXFRAMEF);
-	RNA_def_property_ui_text(prop, "Start Frame", "");
+}
+static void def_cmp_output_file(StructRNA *srna)
+{
+	PropertyRNA *prop;
+	
+	RNA_def_struct_sdna_from(srna, "NodeImageMultiFile", "storage");
+	
+	prop = RNA_def_property(srna, "base_path", PROP_STRING, PROP_FILEPATH);
+	RNA_def_property_string_sdna(prop, NULL, "base_path");
+	RNA_def_property_ui_text(prop, "Base Path", "Base output path for the image");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 	
-	prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
-	RNA_def_property_int_sdna(prop, NULL, "efra");
-	RNA_def_property_int_funcs(prop, NULL, "rna_Image_end_frame_set", NULL);
-	RNA_def_property_range(prop, MINFRAMEF, MAXFRAMEF);
-	RNA_def_property_ui_text(prop, "End Frame", "");
+	prop = RNA_def_property(srna, "active_input", PROP_POINTER, PROP_NONE);
+	RNA_def_property_pointer_funcs(prop, "rna_CompositNodeOutputMultiFile_active_input_get", NULL, NULL, NULL);
+	RNA_def_property_struct_type(prop, "NodeSocket");
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+	RNA_def_property_ui_text(prop, "Active Input", "Active input in details view list");
+	
+	prop = RNA_def_property(srna, "active_input_index", PROP_INT, PROP_NONE);
+	RNA_def_property_int_sdna(prop, NULL, "active_input");
+	RNA_def_property_ui_text(prop, "Active Input Index", "Active input index in details view list");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+	
+	prop = RNA_def_property(srna, "format", PROP_POINTER, PROP_NONE);
+	RNA_def_property_struct_type(prop, "ImageFormatSettings");
 }
 
 static void def_cmp_dilate_erode(StructRNA *srna)
@@ -2048,7 +2103,7 @@ static void def_cmp_channel_matte(StructRNA *srna)
 	RNA_def_property_ui_text(prop, "Color Space", "");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 	
-	prop= RNA_def_property(srna, "matte_channel", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "matte_channel", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "custom2");
 	RNA_def_property_enum_items(prop, prop_tri_channel_items);
 	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_channel_itemf");
@@ -2146,7 +2201,8 @@ static void def_cmp_double_edge_mask(StructRNA * srna)
 
 	static EnumPropertyItem InnerEdgeMode_items[] = {
 		{0, "ALL", 0, "All", "All pixels on inner mask edge are considered during mask calculation"},
-		{1, "ADJACENT_ONLY", 0, "Adjacent Only", "Only inner mask pixels adjacent to outer mask pixels are considered during mask calculation"},
+		{1, "ADJACENT_ONLY", 0, "Adjacent Only",
+		    "Only inner mask pixels adjacent to outer mask pixels are considered during mask calculation"},
 		{0, NULL, 0, NULL, NULL}
 	};
 
@@ -2196,7 +2252,7 @@ static void def_cmp_defocus(StructRNA *srna)
 	RNA_def_property_ui_text(prop, "Bokeh Type", "");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 
-	/* TODO: angle in degrees */		
+	/* TODO: angle in degrees */
 	prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "rotation");
 	RNA_def_property_range(prop, 0.0f, DEG2RADF(90.0f));
@@ -2212,19 +2268,22 @@ static void def_cmp_defocus(StructRNA *srna)
 	prop = RNA_def_property(srna, "f_stop", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "fstop");
 	RNA_def_property_range(prop, 0.0f, 128.0f);
-	RNA_def_property_ui_text(prop, "fStop", "Amount of focal blur, 128=infinity=perfect focus, half the value doubles the blur radius");
+	RNA_def_property_ui_text(prop, "fStop",
+	                         "Amount of focal blur, 128=infinity=perfect focus, half the value doubles "
+	                         "the blur radius");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 	
 	prop = RNA_def_property(srna, "blur_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "maxblur");
 	RNA_def_property_range(prop, 0.0f, 10000.0f);
-	RNA_def_property_ui_text(prop, "Max Blur", "blur limit, maximum CoC radius, 0=no limit");
+	RNA_def_property_ui_text(prop, "Max Blur", "Blur limit, maximum CoC radius, 0=no limit");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 	
 	prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "bthresh");
 	RNA_def_property_range(prop, 0.0f, 100.0f);
-	RNA_def_property_ui_text(prop, "Threshold", "CoC radius threshold, prevents background bleed on in-focus midground, 0=off");
+	RNA_def_property_ui_text(prop, "Threshold",
+	                         "CoC radius threshold, prevents background bleed on in-focus midground, 0=off");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 	
 	prop = RNA_def_property(srna, "use_preview", PROP_BOOLEAN, PROP_NONE);
@@ -2240,13 +2299,17 @@ static void def_cmp_defocus(StructRNA *srna)
 	
 	prop = RNA_def_property(srna, "use_zbuffer", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "no_zbuf", 1);
-	RNA_def_property_ui_text(prop, "Use Z-Buffer", "Disable when using an image as input instead of actual z-buffer (auto enabled if node not image based, eg. time node)");
+	RNA_def_property_ui_text(prop, "Use Z-Buffer",
+	                         "Disable when using an image as input instead of actual z-buffer "
+	                         "(auto enabled if node not image based, eg. time node)");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 	
 	prop = RNA_def_property(srna, "z_scale", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "scale");
 	RNA_def_property_range(prop, 0.0f, 1000.0f);
-	RNA_def_property_ui_text(prop, "Z-Scale", "Scale the Z input when not using a z-buffer, controls maximum blur designated by the color white or input value 1");
+	RNA_def_property_ui_text(prop, "Z-Scale",
+	                         "Scale the Z input when not using a z-buffer, controls maximum blur designated "
+	                         "by the color white or input value 1");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 }
 
@@ -2405,7 +2468,7 @@ static void def_cmp_bilateral_blur(StructRNA *srna)
 	prop = RNA_def_property(srna, "sigma_space", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "sigma_space");
 	RNA_def_property_range(prop, 0.01f, 30.0f);
-	RNA_def_property_ui_text(prop, "Space Sigma", "");	
+	RNA_def_property_ui_text(prop, "Space Sigma", "");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 }
 
@@ -2454,7 +2517,9 @@ static void def_cmp_glare(StructRNA *srna)
 	prop = RNA_def_property(srna, "quality", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "quality");
 	RNA_def_property_enum_items(prop, quality_items);
-	RNA_def_property_ui_text(prop, "Quality", "If not set to high quality, the effect will be applied to a low-res copy of the source image");
+	RNA_def_property_ui_text(prop, "Quality",
+	                         "If not set to high quality, the effect will be applied to a low-res copy "
+	                         "of the source image");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 	
 	prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
@@ -2466,19 +2531,23 @@ static void def_cmp_glare(StructRNA *srna)
 	prop = RNA_def_property(srna, "color_modulation", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "colmod");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
-	RNA_def_property_ui_text(prop, "Color Modulation", "Amount of Color Modulation, modulates colors of streaks and ghosts for a spectral dispersion effect");
+	RNA_def_property_ui_text(prop, "Color Modulation",
+	                         "Amount of Color Modulation, modulates colors of streaks and ghosts for "
+	                         "a spectral dispersion effect");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 	
 	prop = RNA_def_property(srna, "mix", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "mix");
 	RNA_def_property_range(prop, -1.0f, 1.0f);
-	RNA_def_property_ui_text(prop, "Mix", "-1 is original image only, 0 is exact 50/50 mix, 1 is processed image only");
+	RNA_def_property_ui_text(prop, "Mix",
+	                         "-1 is original image only, 0 is exact 50/50 mix, 1 is processed image only");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 	
 	prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "threshold");
 	RNA_def_property_range(prop, 0.0f, 1000.0f);
-	RNA_def_property_ui_text(prop, "Threshold", "The glare filter will only be applied to pixels brighter than this value");
+	RNA_def_property_ui_text(prop, "Threshold",
+	                         "The glare filter will only be applied to pixels brighter than this value");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 	
 	prop = RNA_def_property(srna, "streaks", PROP_INT, PROP_NONE);
@@ -2507,7 +2576,8 @@ static void def_cmp_glare(StructRNA *srna)
 	prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "size");
 	RNA_def_property_range(prop, 6, 9);
-	RNA_def_property_ui_text(prop, "Size", "Glow/glare size (not actual size; relative to initial size of bright area of pixels)");
+	RNA_def_property_ui_text(prop, "Size",
+	                         "Glow/glare size (not actual size; relative to initial size of bright area of pixels)");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 	
 	/* TODO */
@@ -2539,7 +2609,8 @@ static void def_cmp_tonemap(StructRNA *srna)
 	prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "offset");
 	RNA_def_property_range(prop, 0.001f, 10.0f);
-	RNA_def_property_ui_text(prop, "Offset", "Normally always 1, but can be used as an extra control to alter the brightness curve");
+	RNA_def_property_ui_text(prop, "Offset",
+	                         "Normally always 1, but can be used as an extra control to alter the brightness curve");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 	
 	prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE);
@@ -2581,7 +2652,8 @@ static void def_cmp_lensdist(StructRNA *srna)
 	
 	prop = RNA_def_property(srna, "use_projector", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "proj", 1);
-	RNA_def_property_ui_text(prop, "Projector", "Enable/disable projector mode (the effect is applied in horizontal direction only)");
+	RNA_def_property_ui_text(prop, "Projector",
+	                         "Enable/disable projector mode (the effect is applied in horizontal direction only)");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 	
 	prop = RNA_def_property(srna, "use_jitter", PROP_BOOLEAN, PROP_NONE);
@@ -2591,7 +2663,8 @@ static void def_cmp_lensdist(StructRNA *srna)
 	
 	prop = RNA_def_property(srna, "use_fit", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "fit", 1);
-	RNA_def_property_ui_text(prop, "Fit", "For positive distortion factor only: scale image such that black areas are not visible");
+	RNA_def_property_ui_text(prop, "Fit",
+	                         "For positive distortion factor only: scale image such that black areas are not visible");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 }
 
@@ -2601,8 +2674,8 @@ static void def_cmp_colorbalance(StructRNA *srna)
 	static float default_1[3] = {1.f, 1.f, 1.f};
 	
 	static EnumPropertyItem type_items[] = {
-		{0, "LIFT_GAMMA_GAIN",      0, "Lift/Gamma/Gain",      ""},
-		{1, "OFFSET_POWER_SLOPE",     0, "Offset/Power/Slope (ASC-CDL)",     "ASC-CDL standard color correction"},
+		{0, "LIFT_GAMMA_GAIN", 0, "Lift/Gamma/Gain", ""},
+		{1, "OFFSET_POWER_SLOPE", 0, "Offset/Power/Slope (ASC-CDL)", "ASC-CDL standard color correction"},
 		{0, NULL, 0, NULL, NULL}};
 	
 	prop = RNA_def_property(srna, "correction_method", PROP_ENUM, PROP_NONE);
@@ -2800,13 +2873,14 @@ static void def_tex_image(StructRNA *srna)
 	RNA_def_property_ui_text(prop, "Image", "");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
 	
-	/* is this supposed to be exposed? not sure..
+	/* is this supposed to be exposed? not sure.. */
+#if 0
 	prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "storage");
 	RNA_def_property_struct_type(prop, "ImageUser");
 	RNA_def_property_ui_text(prop, "Settings", "");
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
-	 */
+#endif
 }
 
 static void def_tex_bricks(StructRNA *srna)
@@ -2903,28 +2977,28 @@ static void rna_def_nodetree_link_api(BlenderRNA *brna, PropertyRNA *cprop)
 	FunctionRNA *func;
 
 	RNA_def_property_srna(cprop, "NodeLinks");
-	srna= RNA_def_struct(brna, "NodeLinks", NULL);
+	srna = RNA_def_struct(brna, "NodeLinks", NULL);
 	RNA_def_struct_sdna(srna, "bNodeTree");
 	RNA_def_struct_ui_text(srna, "Node Links", "Collection of Node Links");
 
-	func= RNA_def_function(srna, "new", "rna_NodeTree_link_new");
+	func = RNA_def_function(srna, "new", "rna_NodeTree_link_new");
 	RNA_def_function_ui_description(func, "Add a node link to this node tree");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
-	parm= RNA_def_pointer(func, "input", "NodeSocket", "", "The input socket");
+	parm = RNA_def_pointer(func, "input", "NodeSocket", "", "The input socket");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_pointer(func, "output", "NodeSocket", "", "The output socket");
+	parm = RNA_def_pointer(func, "output", "NodeSocket", "", "The output socket");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return */
-	parm= RNA_def_pointer(func, "link", "NodeLink", "", "New node link");
+	parm = RNA_def_pointer(func, "link", "NodeLink", "", "New node link");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_NodeTree_link_remove");
+	func = RNA_def_function(srna, "remove", "rna_NodeTree_link_remove");
 	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");
+	parm = RNA_def_pointer(func, "link", "NodeLink", "", "The node link to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	func= RNA_def_function(srna, "clear", "rna_NodeTree_link_clear");
+	func = RNA_def_function(srna, "clear", "rna_NodeTree_link_clear");
 	RNA_def_function_ui_description(func, "remove all node links from the node tree");
 }
 
@@ -2935,27 +3009,27 @@ static void rna_def_composite_nodetree_api(BlenderRNA *brna, PropertyRNA *cprop)
 	FunctionRNA *func;
 
 	RNA_def_property_srna(cprop, "CompositorNodes");
-	srna= RNA_def_struct(brna, "CompositorNodes", NULL);
+	srna = RNA_def_struct(brna, "CompositorNodes", NULL);
 	RNA_def_struct_sdna(srna, "bNodeTree");
 	RNA_def_struct_ui_text(srna, "Compositor Nodes", "Collection of Compositor Nodes");
 
-	func= RNA_def_function(srna, "new", "rna_NodeTree_node_composite_new");
+	func = RNA_def_function(srna, "new", "rna_NodeTree_node_composite_new");
 	RNA_def_function_ui_description(func, "Add a node to this node tree");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
-	parm= RNA_def_enum(func, "type", compositor_node_type_items, 0, "Type", "Type of node to add");
+	parm = RNA_def_enum(func, "type", compositor_node_type_items, 0, "Type", "Type of node to add");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_pointer(func, "group", "NodeTree", "", "The group tree");
 	/* return value */
-	parm= RNA_def_pointer(func, "node", "Node", "", "New node");
+	parm = RNA_def_pointer(func, "node", "Node", "", "New node");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_NodeTree_node_remove");
+	func = RNA_def_function(srna, "remove", "rna_NodeTree_node_remove");
 	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");
+	parm = RNA_def_pointer(func, "node", "Node", "", "The node to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	func= RNA_def_function(srna, "clear", "rna_NodeTree_node_clear");
+	func = RNA_def_function(srna, "clear", "rna_NodeTree_node_clear");
 	RNA_def_function_ui_description(func, "Remove all nodes from this node tree");
 }
 
@@ -2966,27 +3040,27 @@ static void rna_def_shader_nodetree_api(BlenderRNA *brna, PropertyRNA *cprop)
 	FunctionRNA *func;
 
 	RNA_def_property_srna(cprop, "ShaderNodes");
-	srna= RNA_def_struct(brna, "ShaderNodes", NULL);
+	srna = RNA_def_struct(brna, "ShaderNodes", NULL);
 	RNA_def_struct_sdna(srna, "bNodeTree");
 	RNA_def_struct_ui_text(srna, "Shader Nodes", "Collection of Shader Nodes");
 
-	func= RNA_def_function(srna, "new", "rna_NodeTree_node_new");
+	func = RNA_def_function(srna, "new", "rna_NodeTree_node_new");
 	RNA_def_function_ui_description(func, "Add a node to this node tree");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
-	parm= RNA_def_enum(func, "type", shader_node_type_items, 0, "Type", "Type of node to add");
+	parm = RNA_def_enum(func, "type", shader_node_type_items, 0, "Type", "Type of node to add");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_pointer(func, "group", "NodeTree", "", "The group tree");
 	/* return value */
-	parm= RNA_def_pointer(func, "node", "Node", "", "New node");
+	parm = RNA_def_pointer(func, "node", "Node", "", "New node");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_NodeTree_node_remove");
+	func = RNA_def_function(srna, "remove", "rna_NodeTree_node_remove");
 	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");
+	parm = RNA_def_pointer(func, "node", "Node", "", "The node to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	func= RNA_def_function(srna, "clear", "rna_NodeTree_node_clear");
+	func = RNA_def_function(srna, "clear", "rna_NodeTree_node_clear");
 	RNA_def_function_ui_description(func, "Remove all nodes from this node tree");
 }
 
@@ -2997,27 +3071,27 @@ static void rna_def_texture_nodetree_api(BlenderRNA *brna, PropertyRNA *cprop)
 	FunctionRNA *func;
 
 	RNA_def_property_srna(cprop, "TextureNodes");
-	srna= RNA_def_struct(brna, "TextureNodes", NULL);
+	srna = RNA_def_struct(brna, "TextureNodes", NULL);
 	RNA_def_struct_sdna(srna, "bNodeTree");
 	RNA_def_struct_ui_text(srna, "Texture Nodes", "Collection of Texture Nodes");
 
-	func= RNA_def_function(srna, "new", "rna_NodeTree_node_texture_new");
+	func = RNA_def_function(srna, "new", "rna_NodeTree_node_texture_new");
 	RNA_def_function_ui_description(func, "Add a node to this node tree");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
-	parm= RNA_def_enum(func, "type", texture_node_type_items, 0, "Type", "Type of node to add");
+	parm = RNA_def_enum(func, "type", texture_node_type_items, 0, "Type", "Type of node to add");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_pointer(func, "group", "NodeTree", "", "The group tree");
 	/* return value */
-	parm= RNA_def_pointer(func, "node", "Node", "", "New node");
+	parm = RNA_def_pointer(func, "node", "Node", "", "New node");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_NodeTree_node_remove");
+	func = RNA_def_function(srna, "remove", "rna_NodeTree_node_remove");
 	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");
+	parm = RNA_def_pointer(func, "node", "Node", "", "The node to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	func= RNA_def_function(srna, "clear", "rna_NodeTree_node_clear");
+	func = RNA_def_function(srna, "clear", "rna_NodeTree_node_clear");
 	RNA_def_function_ui_description(func, "Remove all nodes from this node tree");
 }
 
@@ -3042,7 +3116,7 @@ static void rna_def_node_socket(BlenderRNA *brna)
 
 	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	/* XXX must be editable for group sockets. if necessary use a special rna definition for these */
-//	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+/*	RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
 	RNA_def_property_ui_text(prop, "Name", "Socket name");
 	RNA_def_struct_name_property(srna, prop);
 	RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_NodeGroupSocket_update");
@@ -3050,7 +3124,8 @@ static void rna_def_node_socket(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "group_socket", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "groupsock");
 	RNA_def_property_struct_type(prop, "NodeSocket");
-	RNA_def_property_ui_text(prop, "Group Socket", "For group nodes, the group input or output socket this corresponds to");
+	RNA_def_property_ui_text(prop, "Group Socket",
+	                         "For group nodes, the group input or output socket this corresponds to");
 
 	prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SOCK_COLLAPSED);
@@ -3061,8 +3136,8 @@ static void rna_def_node_socket(BlenderRNA *brna)
 static void rna_def_node_socket_subtype(BlenderRNA *brna, int type, int subtype, const char *name, const char *ui_name)
 {
 	StructRNA *srna;
-	PropertyRNA *prop=NULL;
-	PropertySubType propsubtype= PROP_NONE;
+	PropertyRNA *prop = NULL;
+	PropertySubType propsubtype = PROP_NONE;
 	
 	#define SUBTYPE(socktype, stypename, id, idname)	{ PROP_##id, #socktype "_" #id, 0, #idname, ""},
 	static EnumPropertyItem subtype_items[] = {
@@ -3144,6 +3219,9 @@ static void rna_def_node_socket_subtype(BlenderRNA *brna, int type, int subtype,
 		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) */
+	RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
 }
 
 static void rna_def_node(BlenderRNA *brna)
@@ -3235,28 +3313,29 @@ static void rna_def_group_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int
 	PropertyRNA *parm;
 	FunctionRNA *func;
 
-	RNA_def_property_srna(cprop, (in_out==SOCK_IN ? "GroupInputs" : "GroupOutputs"));
-	srna= RNA_def_struct(brna, (in_out==SOCK_IN ? "GroupInputs" : "GroupOutputs"), NULL);
+	RNA_def_property_srna(cprop, (in_out == SOCK_IN ? "GroupInputs" : "GroupOutputs"));
+	srna = RNA_def_struct(brna, (in_out == SOCK_IN ? "GroupInputs" : "GroupOutputs"), NULL);
 	RNA_def_struct_sdna(srna, "bNodeTree");
 	RNA_def_struct_ui_text(srna, "Group Sockets", "Collection of group sockets");
 
-	func= RNA_def_function(srna, "new", (in_out==SOCK_IN ? "rna_NodeTree_input_new" : "rna_NodeTree_output_new"));
+	func = RNA_def_function(srna, "new", (in_out == SOCK_IN ? "rna_NodeTree_input_new" : "rna_NodeTree_output_new"));
 	RNA_def_function_ui_description(func, "Add a socket to the group tree");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_string(func, "name", "Socket", MAX_NAME, "Name", "Name of the socket");
 	RNA_def_enum(func, "type", node_socket_type_items, SOCK_FLOAT, "Type", "Type of socket");
 	/* return value */
-	parm= RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket");
+	parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "expose", (in_out==SOCK_IN ? "rna_NodeTree_input_expose" : "rna_NodeTree_output_expose"));
+	func = RNA_def_function(srna, "expose",
+	                        (in_out == SOCK_IN ? "rna_NodeTree_input_expose" : "rna_NodeTree_output_expose"));
 	RNA_def_function_ui_description(func, "Expose an internal socket in the group tree");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	RNA_def_pointer(func, "sock", "NodeSocket", "Socket", "Internal node socket to expose");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_boolean(func, "add_link", TRUE, "Add Link", "If TRUE, adds a link to the internal socket");
 	/* return value */
-	parm= RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket");
+	parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket");
 	RNA_def_function_return(func, parm);
 }
 
@@ -3266,7 +3345,8 @@ static void rna_def_nodetree(BlenderRNA *brna)
 	PropertyRNA *prop;
 
 	srna = RNA_def_struct(brna, "NodeTree", "ID");
-	RNA_def_struct_ui_text(srna, "Node Tree", "Node tree consisting of linked nodes used for shading, textures and compositing");
+	RNA_def_struct_ui_text(srna, "Node Tree",
+	                       "Node tree consisting of linked nodes used for shading, textures and compositing");
 	RNA_def_struct_sdna(srna, "bNodeTree");
 	RNA_def_struct_ui_icon(srna, ICON_NODETREE);
 	RNA_def_struct_refine_func(srna, "rna_NodeTree_refine");
@@ -3282,7 +3362,7 @@ static void rna_def_nodetree(BlenderRNA *brna)
 	rna_def_nodetree_link_api(brna, prop);
 
 	/* Grease Pencil */
-	prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "gpd");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "GreasePencil");
@@ -3333,7 +3413,8 @@ static void rna_def_shader_nodetree(BlenderRNA *brna)
 	PropertyRNA *prop;
 
 	srna = RNA_def_struct(brna, "ShaderNodeTree", "NodeTree");
-	RNA_def_struct_ui_text(srna, "Shader Node Tree", "Node tree consisting of linked nodes used for materials (and other shading datablocks)");
+	RNA_def_struct_ui_text(srna, "Shader Node Tree",
+	                       "Node tree consisting of linked nodes used for materials (and other shading datablocks)");
 	RNA_def_struct_sdna(srna, "bNodeTree");
 	RNA_def_struct_ui_icon(srna, ICON_NODETREE);
 
@@ -3369,7 +3450,7 @@ static void define_specific_node(BlenderRNA *brna, int id, void (*func)(StructRN
 {
 	StructRNA *srna = def_node(brna, id);
 	
-	if(func)
+	if (func)
 		func(srna);
 }
 
@@ -3382,7 +3463,8 @@ void RNA_def_nodetree(BlenderRNA *brna)
 	
 	/* Generate RNA definitions for all socket subtypes */
 	#define SUBTYPE(socktype, stypename, id, idname) \
-	rna_def_node_socket_subtype(brna, SOCK_##socktype, PROP_##id, "NodeSocket"#stypename#idname, #idname" "#stypename" Node Socket");
+	rna_def_node_socket_subtype(brna, SOCK_##socktype, PROP_##id, "NodeSocket"#stypename#idname, \
+	                            #idname" "#stypename" Node Socket");
 	NODE_DEFINE_SUBTYPES
 	#undef SUBTYPE
 	rna_def_node_socket_subtype(brna, SOCK_BOOLEAN, 0, "NodeSocketBoolean", "Boolean Node Socket");
@@ -3407,6 +3489,9 @@ void RNA_def_nodetree(BlenderRNA *brna)
 	define_specific_node(brna, NODE_FORLOOP, def_forloop);
 	define_specific_node(brna, NODE_WHILELOOP, def_whileloop);
 	define_specific_node(brna, NODE_FRAME, def_frame);
+	
+	/* special socket types */
+	rna_def_cmp_output_file_socket(brna);
 }
 
 /* clean up macro definition */
diff --git a/source/blender/makesrna/intern/rna_nodetree_types.h b/source/blender/makesrna/intern/rna_nodetree_types.h
index 2284b09..5352bbd 100644
--- a/source/blender/makesrna/intern/rna_nodetree_types.h
+++ b/source/blender/makesrna/intern/rna_nodetree_types.h
@@ -24,6 +24,7 @@
  *  \ingroup RNA
  */
 
+/* intentionally no include guard */
 
 /* Empty definitions for undefined macros to avoid warnings */
 #ifndef DefNode
@@ -36,7 +37,7 @@ DefNode( ShaderNode,     SH_NODE_MATERIAL,        def_sh_material,        "MATER
 DefNode( ShaderNode,     SH_NODE_RGB,             0,                      "RGB",            RGB,              "RGB",               ""              )
 DefNode( ShaderNode,     SH_NODE_VALUE,           0,                      "VALUE",          Value,            "Value",             ""              )
 DefNode( ShaderNode,     SH_NODE_MIX_RGB,         def_mix_rgb,            "MIX_RGB",        MixRGB,           "MixRGB",            ""              )
-DefNode( ShaderNode,     SH_NODE_VALTORGB,        def_colorramp,          "VALTORGB",       ValToRGB,         "Value to RGB",      ""              )
+DefNode( ShaderNode,     SH_NODE_VALTORGB,        def_colorramp,          "VALTORGB",       ValToRGB,         "ColorRamp",      ""              )
 DefNode( ShaderNode,     SH_NODE_RGBTOBW,         0,                      "RGBTOBW",        RGBToBW,          "RGB to BW",         ""              )
 DefNode( ShaderNode,     SH_NODE_TEXTURE,         def_texture,            "TEXTURE",        Texture,          "Texture",           ""              )
 DefNode( ShaderNode,     SH_NODE_NORMAL,          0,                      "NORMAL",         Normal,           "Normal",            ""              )
@@ -93,7 +94,7 @@ DefNode( CompositorNode, CMP_NODE_VIEWER,         0,                      "VIEWE
 DefNode( CompositorNode, CMP_NODE_RGB,            0,                      "RGB",            RGB,              "RGB",               ""              )
 DefNode( CompositorNode, CMP_NODE_VALUE,          0,                      "VALUE",          Value,            "Value",             ""              )
 DefNode( CompositorNode, CMP_NODE_MIX_RGB,        def_mix_rgb,            "MIX_RGB",        MixRGB,           "Mix RGB",           ""              )
-DefNode( CompositorNode, CMP_NODE_VALTORGB,       def_colorramp,          "VALTORGB",       ValToRGB,         "Value to RGB",      ""              )
+DefNode( CompositorNode, CMP_NODE_VALTORGB,       def_colorramp,          "VALTORGB",       ValToRGB,         "ColorRamp",      ""              )
 DefNode( CompositorNode, CMP_NODE_RGBTOBW,        0,                      "RGBTOBW",        RGBToBW,          "RGB to BW",         ""              )
 DefNode( CompositorNode, CMP_NODE_NORMAL,         0,                      "NORMAL",         Normal,           "Normal",            ""              )
 DefNode( CompositorNode, CMP_NODE_CURVE_VEC,      def_vector_curve,       "CURVE_VEC",      CurveVec,         "Vector Curve",      ""              )
@@ -165,7 +166,7 @@ DefNode( TextureNode,    TEX_NODE_BRICKS,         def_tex_bricks,         "BRICK
 DefNode( TextureNode,    TEX_NODE_MATH,           def_math,               "MATH",           Math,             "Math",              ""              )
 DefNode( TextureNode,    TEX_NODE_MIX_RGB,        def_mix_rgb,            "MIX_RGB",        MixRGB,           "Mix RGB",           ""              )
 DefNode( TextureNode,    TEX_NODE_RGBTOBW,        0,                      "RGBTOBW",        RGBToBW,          "RGB to BW",         ""              )
-DefNode( TextureNode,    TEX_NODE_VALTORGB,       def_colorramp,          "VALTORGB",       ValToRGB,         "Value to RGB",      ""              )
+DefNode( TextureNode,    TEX_NODE_VALTORGB,       def_colorramp,          "VALTORGB",       ValToRGB,         "ColorRamp",      ""              )
 DefNode( TextureNode,    TEX_NODE_IMAGE,          def_tex_image,          "IMAGE",          Image,            "Image",             ""              )
 DefNode( TextureNode,    TEX_NODE_CURVE_RGB,      def_rgb_curve,          "CURVE_RGB",      CurveRGB,         "RGB Curve",         ""              )
 DefNode( TextureNode,    TEX_NODE_INVERT,         0,                      "INVERT",         Invert,           "Invert",            ""              )
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 3ec01e5..bd024ba 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -46,6 +46,9 @@
 #include "DNA_scene_types.h"
 #include "DNA_meta_types.h"
 
+#include "BLI_utildefines.h"
+
+#include "BKE_tessmesh.h"
 #include "BKE_group.h" /* needed for object_in_group() */
 
 #include "BLO_sys_types.h" /* needed for intptr_t used in ED_mesh.h */
@@ -70,7 +73,7 @@ static EnumPropertyItem parent_type_items[] = {
 	{PARCURVE, "CURVE", 0, "Curve", "The object is parented to a curve"},
 	{PARKEY, "KEY", 0, "Key", ""},
 	{PARSKEL, "ARMATURE", 0, "Armature", ""},
-	{PARSKEL, "LATTICE", 0, "Lattice", "The object is parented to a lattice"}, // PARSKEL reuse will give issues
+	{PARSKEL, "LATTICE", 0, "Lattice", "The object is parented to a lattice"}, /* PARSKEL reuse will give issues */
 	{PARVERT1, "VERTEX", 0, "Vertex", "The object is parented to a vertex"},
 	{PARVERT3, "VERTEX_3", 0, "3 Vertices", ""},
 	{PARBONE, "BONE", 0, "Bone", "The object is parented to a bone"},
@@ -84,14 +87,14 @@ static EnumPropertyItem collision_bounds_items[] = {
 	{OB_BOUND_CONVEX_HULL, "CONVEX_HULL", 0, "Convex Hull", ""},
 	{OB_BOUND_TRIANGLE_MESH, "TRIANGLE_MESH", 0, "Triangle Mesh", ""},
 	{OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", ""},
-	//{OB_DYN_MESH, "DYNAMIC_MESH", 0, "Dynamic Mesh", ""},
+	/*{OB_DYN_MESH, "DYNAMIC_MESH", 0, "Dynamic Mesh", ""}, */
 	{0, NULL, 0, NULL, NULL}};
 
 EnumPropertyItem metaelem_type_items[] = {
 	{MB_BALL, "BALL", ICON_META_BALL, "Ball", ""},
 	{MB_TUBE, "CAPSULE", ICON_META_CAPSULE, "Capsule", ""},
 	{MB_PLANE, "PLANE", ICON_META_PLANE, "Plane", ""},
-	{MB_ELIPSOID, "ELLIPSOID", ICON_META_ELLIPSOID, "Ellipsoid", ""}, // NOTE: typo at original definition!
+	{MB_ELIPSOID, "ELLIPSOID", ICON_META_ELLIPSOID, "Ellipsoid", ""}, /* NOTE: typo at original definition! */
 	{MB_CUBE, "CUBE", ICON_META_CUBE, "Cube", ""},
 	{0, NULL, 0, NULL, NULL}};
 
@@ -147,8 +150,6 @@ EnumPropertyItem object_type_curve_items[] = {
 #include "BKE_scene.h"
 #include "BKE_deform.h"
 
-#include "BLI_editVert.h" /* for EditMesh->mat_nr */
-
 #include "ED_mesh.h"
 #include "ED_object.h"
 #include "ED_particle.h"
@@ -162,16 +163,16 @@ static void rna_Object_internal_update(Main *UNUSED(bmain), Scene *UNUSED(scene)
 
 static void rna_Object_matrix_world_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	/* dont use compat so we get predictable rotation */
+	/* don't use compat so we get predictable rotation */
 	object_apply_mat4(ptr->id.data, ((Object *)ptr->id.data)->obmat, FALSE, TRUE);
 	rna_Object_internal_update(bmain, scene, ptr);
 }
 
 static void rna_Object_matrix_local_get(PointerRNA *ptr, float values[16])
 {
-	Object *ob= ptr->id.data;
+	Object *ob = ptr->id.data;
 
-	if(ob->parent) {
+	if (ob->parent) {
 		float invmat[4][4]; /* for inverse of parent's matrix */
 		invert_m4_m4(invmat, ob->parent->obmat);
 		mult_m4_m4m4((float(*)[4])values, invmat, ob->obmat);
@@ -183,12 +184,12 @@ static void rna_Object_matrix_local_get(PointerRNA *ptr, float values[16])
 
 static void rna_Object_matrix_local_set(PointerRNA *ptr, const float values[16])
 {
-	Object *ob= ptr->id.data;
+	Object *ob = ptr->id.data;
 
 	/* localspace matrix is truly relative to the parent, but parameters
 	 * stored in object are relative to parentinv matrix.  Undo the parent
 	 * inverse part before updating obmat and calling apply_obmat() */
-	if(ob->parent) {
+	if (ob->parent) {
 		float invmat[4][4];
 		invert_m4_m4(invmat, ob->parentinv);
 		mult_m4_m4m4(ob->obmat, invmat, (float(*)[4])values);
@@ -197,19 +198,19 @@ static void rna_Object_matrix_local_set(PointerRNA *ptr, const float values[16])
 		copy_m4_m4(ob->obmat, (float(*)[4])values);
 	}
 
-	/* dont use compat so we get predictable rotation */
+	/* don't use compat so we get predictable rotation */
 	object_apply_mat4(ob, ob->obmat, FALSE, FALSE);
 }
 
 static void rna_Object_matrix_basis_get(PointerRNA *ptr, float values[16])
 {
-	Object *ob= ptr->id.data;
+	Object *ob = ptr->id.data;
 	object_to_mat4(ob, (float(*)[4])values);
 }
 
 static void rna_Object_matrix_basis_set(PointerRNA *ptr, const float values[16])
 {
-	Object *ob= ptr->id.data;
+	Object *ob = ptr->id.data;
 	object_apply_mat4(ob, (float(*)[4])values, FALSE, FALSE);
 }
 
@@ -221,14 +222,16 @@ void rna_Object_internal_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene),
 
 void rna_Object_active_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Object *ob= ptr->id.data;
+	Object *ob = ptr->id.data;
 
-	if(scene->obedit == ob) {
+	if (scene->obedit == ob) {
 		/* exit/enter editmode to get new shape */
-		switch(ob->type) {
+		switch (ob->type) {
 			case OB_MESH:
-				load_editMesh(scene, ob);
-				make_editMesh(scene, ob);
+				EDBM_mesh_load(ob);
+				EDBM_mesh_make(scene->toolsettings, scene, ob);
+				EDBM_mesh_normals_update(((Mesh*)ob->data)->edit_btmesh);
+				BMEdit_RecalcTessellation(((Mesh*)ob->data)->edit_btmesh);
 				break;
 			case OB_CURVE:
 			case OB_SURF:
@@ -258,7 +261,7 @@ static void rna_Object_dependency_update(Main *bmain, Scene *scene, PointerRNA *
 static void rna_Object_select_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
 {
 	if (scene) {
-		Object *ob= (Object*)ptr->id.data;
+		Object *ob = (Object*)ptr->id.data;
 		short mode = ob->flag & SELECT ? BA_SELECT : BA_DESELECT;
 		ED_base_object_select(object_in_scene(ob, scene), mode);
 	}
@@ -266,7 +269,7 @@ static void rna_Object_select_update(Main *UNUSED(bmain), Scene *scene, PointerR
 
 static void rna_Base_select_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	Base *base= (Base*)ptr->data;
+	Base *base = (Base*)ptr->data;
 	short mode = base->flag & BA_SELECT ? BA_SELECT : BA_DESELECT;
 	ED_base_object_select(base, mode);
 }
@@ -274,13 +277,13 @@ static void rna_Base_select_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Po
 static void rna_Object_layer_update__internal(Main *bmain, Scene *scene, Base *base, Object *ob)
 {
 	/* try to avoid scene sort */
-	if(scene == NULL) {
+	if (scene == NULL) {
 		/* pass - unlikely but when running scripts on startup it happens */
 	}
-	else if((ob->lay & scene->lay) && (base->lay & scene->lay)) {
+	else if ((ob->lay & scene->lay) && (base->lay & scene->lay)) {
 		 /* pass */
 	}
-	else if((ob->lay & scene->lay)==0 && (base->lay & scene->lay)==0) {
+	else if ((ob->lay & scene->lay) == 0 && (base->lay & scene->lay) == 0) {
 		/* pass */
 	}
 	else {
@@ -292,42 +295,42 @@ static void rna_Object_layer_update__internal(Main *bmain, Scene *scene, Base *b
 
 static void rna_Object_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 	Base *base;
 
-	base= scene ? object_in_scene(ob, scene) : NULL;
-	if(!base)
+	base = scene ? object_in_scene(ob, scene) : NULL;
+	if (!base)
 		return;
 	
 	SWAP(int, base->lay, ob->lay);
 
 	rna_Object_layer_update__internal(bmain, scene, base, ob);
-	ob->lay= base->lay;
+	ob->lay = base->lay;
 
 	WM_main_add_notifier(NC_SCENE|ND_LAYER_CONTENT, scene);
 }
 
 static void rna_Base_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Base *base= (Base*)ptr->data;
-	Object *ob= (Object*)base->object;
+	Base *base = (Base*)ptr->data;
+	Object *ob = (Object*)base->object;
 
 	rna_Object_layer_update__internal(bmain, scene, base, ob);
-	ob->lay= base->lay;
+	ob->lay = base->lay;
 
 	WM_main_add_notifier(NC_SCENE|ND_LAYER_CONTENT, scene);
 }
 
 static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value)
 {
-	Object *ob= (Object*)ptr->data;
-	ID *id= value.data;
+	Object *ob = (Object*)ptr->data;
+	ID *id = value.data;
 
 	if (id == NULL || ob->mode & OB_MODE_EDIT)
 		return;
 
 	if (ob->type == OB_EMPTY) {
-		if(ob->data) {
+		if (ob->data) {
 			id_us_min((ID*)ob->data);
 			ob->data = NULL;
 		}
@@ -337,30 +340,30 @@ static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value)
 			ob->data = id;
 		}
 	}
-	else if(ob->type == OB_MESH) {
+	else if (ob->type == OB_MESH) {
 		set_mesh(ob, (Mesh*)id);
 	}
 	else {
-		if(ob->data)
+		if (ob->data)
 			id_us_min((ID*)ob->data);
-		if(id)
+		if (id)
 			id_us_plus(id);
 
-		ob->data= id;
+		ob->data = id;
 		test_object_materials(id);
 
-		if(GS(id->name)==ID_CU)
+		if (GS(id->name) == ID_CU)
 			test_curve_type(ob);
-		else if(ob->type==OB_ARMATURE)
+		else if (ob->type == OB_ARMATURE)
 			armature_rebuild_pose(ob, ob->data);
 	}
 }
 
 static StructRNA *rna_Object_data_typef(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->data;
+	Object *ob = (Object*)ptr->data;
 
-	switch(ob->type) {
+	switch (ob->type) {
 		case OB_EMPTY: return &RNA_Image;
 		case OB_MESH: return &RNA_Mesh;
 		case OB_CURVE: return &RNA_Curve;
@@ -378,15 +381,15 @@ static StructRNA *rna_Object_data_typef(PointerRNA *ptr)
 
 static void rna_Object_parent_set(PointerRNA *ptr, PointerRNA value)
 {
-	Object *ob= (Object*)ptr->data;
-	Object *par= (Object*)value.data;
+	Object *ob = (Object*)ptr->data;
+	Object *par = (Object*)value.data;
 
 	ED_object_parent(ob, par, ob->partype, ob->parsubstr);
 }
 
 static void rna_Object_parent_type_set(PointerRNA *ptr, int value)
 {
-	Object *ob= (Object*)ptr->data;
+	Object *ob = (Object*)ptr->data;
 
 	ED_object_parent(ob, ob->parent, value, ob->parsubstr);
 }
@@ -394,31 +397,33 @@ static void rna_Object_parent_type_set(PointerRNA *ptr, int value)
 static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C), PointerRNA *ptr,
                                                       PropertyRNA *UNUSED(prop), int *free)
 {
-	Object *ob= (Object*)ptr->data;
-	EnumPropertyItem *item= NULL;
-	int totitem= 0;
+	Object *ob = (Object*)ptr->data;
+	EnumPropertyItem *item = NULL;
+	int totitem = 0;
 
 	RNA_enum_items_add_value(&item, &totitem, parent_type_items, PAROBJECT);
 
-	if(ob->parent) {
-		Object *par= ob->parent;
+	if (ob->parent) {
+		Object *par = ob->parent;
 		
-		if(par->type == OB_CURVE)
+		if (par->type == OB_CURVE)
 			RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARCURVE);
-		else if(par->type == OB_LATTICE)
-			RNA_enum_items_add_value(&item, &totitem, &parent_type_items[4], PARSKEL); // special hack: prevents this overriding others
-		else if(par->type == OB_ARMATURE) {
-			RNA_enum_items_add_value(&item, &totitem, &parent_type_items[3], PARSKEL); // special hack: prevents this being overrided
+		else if (par->type == OB_LATTICE)
+			/* special hack: prevents this overriding others */
+			RNA_enum_items_add_value(&item, &totitem, &parent_type_items[4], PARSKEL);
+		else if (par->type == OB_ARMATURE) {
+			/* special hack: prevents this being overrided */
+			RNA_enum_items_add_value(&item, &totitem, &parent_type_items[3], PARSKEL);
 			RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARBONE);
 		}
-		else if(par->type == OB_MESH) {
+		else if (par->type == OB_MESH) {
 			RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARVERT1);
 			RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARVERT3);
 		}
 	}
 
 	RNA_enum_item_end(&item, &totitem);
-	*free= 1;
+	*free = 1;
 
 	return item;
 }
@@ -426,14 +431,14 @@ static EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C), Point
 static EnumPropertyItem *rna_Object_collision_bounds_itemf(bContext *UNUSED(C), PointerRNA *ptr,
                                                            PropertyRNA *UNUSED(prop), int *free)
 {
-	Object *ob= (Object*)ptr->data;
-	EnumPropertyItem *item= NULL;
-	int totitem= 0;
+	Object *ob = (Object*)ptr->data;
+	EnumPropertyItem *item = NULL;
+	int totitem = 0;
 
 	RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_TRIANGLE_MESH);
 	RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CONVEX_HULL);
 
-	if(ob->body_type!=OB_BODY_TYPE_SOFT) {
+	if (ob->body_type != OB_BODY_TYPE_SOFT) {
 		RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CONE);
 		RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CYLINDER);
 		RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_SPHERE);
@@ -442,21 +447,21 @@ static EnumPropertyItem *rna_Object_collision_bounds_itemf(bContext *UNUSED(C),
 	}
 
 	RNA_enum_item_end(&item, &totitem);
-	*free= 1;
+	*free = 1;
 
 	return item;
 }
 
 static void rna_Object_parent_bone_set(PointerRNA *ptr, const char *value)
 {
-	Object *ob= (Object*)ptr->data;
+	Object *ob = (Object*)ptr->data;
 
 	ED_object_parent(ob, ob->parent, ob->partype, value);
 }
 
 static void rna_Object_dup_group_set(PointerRNA *ptr, PointerRNA value)
 {
-	Object *ob= (Object *)ptr->data;
+	Object *ob = (Object *)ptr->data;
 	Group *grp = (Group *)value.data;
 	
 	/* must not let this be set if the object belongs in this group already,
@@ -465,202 +470,204 @@ static void rna_Object_dup_group_set(PointerRNA *ptr, PointerRNA value)
 	if (object_in_group(ob, grp) == 0)
 		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");
+		BKE_report(NULL, RPT_ERROR,
+		           "Cannot set dupli-group as object belongs in group being instanced thus causing a cycle");
 }
 
 void rna_VertexGroup_name_set(PointerRNA *ptr, const char *value)
 {
-	Object *ob= (Object *)ptr->id.data;
-	bDeformGroup *dg= (bDeformGroup *)ptr->data;
+	Object *ob = (Object *)ptr->id.data;
+	bDeformGroup *dg = (bDeformGroup *)ptr->data;
 	BLI_strncpy_utf8(dg->name, value, sizeof(dg->name));
 	defgroup_unique_name(dg, ob);
 }
 
 static int rna_VertexGroup_index_get(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 
 	return BLI_findindex(&ob->defbase, ptr->data);
 }
 
 static PointerRNA rna_Object_active_vertex_group_get(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 	return rna_pointer_inherit_refine(ptr, &RNA_VertexGroup, BLI_findlink(&ob->defbase, ob->actdef-1));
 }
 
 static int rna_Object_active_vertex_group_index_get(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 	return ob->actdef-1;
 }
 
 static void rna_Object_active_vertex_group_index_set(PointerRNA *ptr, int value)
 {
-	Object *ob= (Object*)ptr->id.data;
-	ob->actdef= value+1;
+	Object *ob = (Object*)ptr->id.data;
+	ob->actdef = value+1;
 }
 
-static void rna_Object_active_vertex_group_index_range(PointerRNA *ptr, int *min, int *max)
+static void rna_Object_active_vertex_group_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 
-	*min= 0;
-	*max= BLI_countlist(&ob->defbase)-1;
-	*max= MAX2(0, *max);
+	*min = 0;
+	*max = BLI_countlist(&ob->defbase)-1;
+	*max = MAX2(0, *max);
 }
 
 void rna_object_vgroup_name_index_get(PointerRNA *ptr, char *value, int index)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 	bDeformGroup *dg;
 
-	dg= BLI_findlink(&ob->defbase, index-1);
+	dg = BLI_findlink(&ob->defbase, index-1);
 
-	if(dg) BLI_strncpy(value, dg->name, sizeof(dg->name));
-	else value[0]= '\0';
+	if (dg) BLI_strncpy(value, dg->name, sizeof(dg->name));
+	else value[0] = '\0';
 }
 
 int rna_object_vgroup_name_index_length(PointerRNA *ptr, int index)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 	bDeformGroup *dg;
 
-	dg= BLI_findlink(&ob->defbase, index-1);
+	dg = BLI_findlink(&ob->defbase, index-1);
 	return (dg)? strlen(dg->name): 0;
 }
 
 void rna_object_vgroup_name_index_set(PointerRNA *ptr, const char *value, short *index)
 {
-	Object *ob= (Object*)ptr->id.data;
-	*index= defgroup_name_index(ob, value) + 1;
+	Object *ob = (Object*)ptr->id.data;
+	*index = defgroup_name_index(ob, value) + 1;
 }
 
 void rna_object_vgroup_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
 {
-	Object *ob= (Object*)ptr->id.data;
-	bDeformGroup *dg= defgroup_find_name(ob, value);
-	if(dg) {
+	Object *ob = (Object*)ptr->id.data;
+	bDeformGroup *dg = defgroup_find_name(ob, value);
+	if (dg) {
 		BLI_strncpy(result, value, maxlen); /* no need for BLI_strncpy_utf8, since this matches an existing group */
 		return;
 	}
 
-	result[0]= '\0';
+	result[0] = '\0';
 }
 
 void rna_object_uvlayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 	Mesh *me;
 	CustomDataLayer *layer;
 	int a;
 
-	if(ob->type == OB_MESH && ob->data) {
-		me= (Mesh*)ob->data;
+	if (ob->type == OB_MESH && ob->data) {
+		me = (Mesh*)ob->data;
 
-		for(a=0; a<me->fdata.totlayer; a++) {
-			layer= &me->fdata.layers[a];
+		for (a = 0; a<me->pdata.totlayer; a++) {
+			layer = &me->pdata.layers[a];
 
-			if(layer->type == CD_MTFACE && strcmp(layer->name, value) == 0) {
+			if (layer->type == CD_MTEXPOLY && strcmp(layer->name, value) == 0) {
 				BLI_strncpy(result, value, maxlen);
 				return;
 			}
 		}
 	}
 
-	result[0]= '\0';
+	result[0] = '\0';
 }
 
 void rna_object_vcollayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 	Mesh *me;
 	CustomDataLayer *layer;
 	int a;
 
-	if(ob->type == OB_MESH && ob->data) {
-		me= (Mesh*)ob->data;
+	if (ob->type == OB_MESH && ob->data) {
+		me = (Mesh*)ob->data;
 
-		for(a=0; a<me->fdata.totlayer; a++) {
-			layer= &me->fdata.layers[a];
+		for (a = 0; a<me->fdata.totlayer; a++) {
+			layer = &me->fdata.layers[a];
 
-			if(layer->type == CD_MCOL && strcmp(layer->name, value) == 0) {
+			if (layer->type == CD_MCOL && strcmp(layer->name, value) == 0) {
 				BLI_strncpy(result, value, maxlen);
 				return;
 			}
 		}
 	}
 
-	result[0]= '\0';
+	result[0] = '\0';
 }
 
 static int rna_Object_active_material_index_get(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
-	return MAX2(ob->actcol-1, 0);
+	Object *ob = (Object*)ptr->id.data;
+	return MAX2(ob->actcol - 1, 0);
 }
 
 static void rna_Object_active_material_index_set(PointerRNA *ptr, int value)
 {
-	Object *ob= (Object*)ptr->id.data;
-	ob->actcol= value+1;
+	Object *ob = (Object*)ptr->id.data;
+	ob->actcol = value+1;
 
-	if(ob->type==OB_MESH) {
-		Mesh *me= ob->data;
+	if (ob->type == OB_MESH) {
+		Mesh *me = ob->data;
 
-		if(me->edit_mesh)
-			me->edit_mesh->mat_nr= value;
+		if (me->edit_btmesh)
+			me->edit_btmesh->mat_nr = value;
 	}
 }
 
-static void rna_Object_active_material_index_range(PointerRNA *ptr, int *min, int *max)
+static void rna_Object_active_material_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
 {
-	Object *ob= (Object*)ptr->id.data;
-	*min= 0;
-	*max= MAX2(ob->totcol-1, 0);
+	Object *ob = (Object*)ptr->id.data;
+	*min = 0;
+	*max = MAX2(ob->totcol-1, 0);
 }
 
 /* returns active base material */
 static PointerRNA rna_Object_active_material_get(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 	Material *ma;
 	
-	ma= (ob->totcol)? give_current_material(ob, ob->actcol): NULL;
+	ma = (ob->totcol)? give_current_material(ob, ob->actcol): NULL;
 	return rna_pointer_inherit_refine(ptr, &RNA_Material, ma);
 }
 
 static void rna_Object_active_material_set(PointerRNA *ptr, PointerRNA value)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 
 	DAG_id_tag_update(value.data, 0);
 	assign_material(ob, value.data, ob->actcol);
 }
 
-static void rna_Object_active_particle_system_index_range(PointerRNA *ptr, int *min, int *max)
+static void rna_Object_active_particle_system_index_range(PointerRNA *ptr, int *min, int *max,
+                                                          int *softmin, int *softmax)
 {
-	Object *ob= (Object*)ptr->id.data;
-	*min= 0;
-	*max= BLI_countlist(&ob->particlesystem)-1;
-	*max= MAX2(0, *max);
+	Object *ob = (Object*)ptr->id.data;
+	*min = 0;
+	*max = BLI_countlist(&ob->particlesystem)-1;
+	*max = MAX2(0, *max);
 }
 
 static int rna_Object_active_particle_system_index_get(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 	return psys_get_current_num(ob);
 }
 
 static void rna_Object_active_particle_system_index_set(PointerRNA *ptr, int value)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 	psys_set_current_num(ob, value);
 }
 
 static void rna_Object_particle_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 
 	PE_current_changed(scene, ob);
 }
@@ -668,51 +675,51 @@ static void rna_Object_particle_update(Main *UNUSED(bmain), Scene *scene, Pointe
 /* rotation - axis-angle */
 static void rna_Object_rotation_axis_angle_get(PointerRNA *ptr, float *value)
 {
-	Object *ob= ptr->data;
+	Object *ob = ptr->data;
 	
 	/* for now, assume that rotation mode is axis-angle */
-	value[0]= ob->rotAngle;
+	value[0] = ob->rotAngle;
 	copy_v3_v3(&value[1], ob->rotAxis);
 }
 
 /* rotation - axis-angle */
 static void rna_Object_rotation_axis_angle_set(PointerRNA *ptr, const float *value)
 {
-	Object *ob= ptr->data;
+	Object *ob = ptr->data;
 	
 	/* for now, assume that rotation mode is axis-angle */
-	ob->rotAngle= value[0];
+	ob->rotAngle = value[0];
 	copy_v3_v3(ob->rotAxis, (float *)&value[1]);
 	
-	// TODO: validate axis?
+	/* TODO: validate axis? */
 }
 
 static void rna_Object_rotation_mode_set(PointerRNA *ptr, int value)
 {
-	Object *ob= ptr->data;
+	Object *ob = ptr->data;
 	
 	/* use API Method for conversions... */
 	BKE_rotMode_change_values(ob->quat, ob->rot, ob->rotAxis, &ob->rotAngle, ob->rotmode, (short)value);
 	
 	/* finally, set the new rotation type */
-	ob->rotmode= value;
+	ob->rotmode = value;
 }
 
 static void rna_Object_dimensions_get(PointerRNA *ptr, float *value)
 {
-	Object *ob= ptr->data;
+	Object *ob = ptr->data;
 	object_get_dimensions(ob, value);
 }
 
 static void rna_Object_dimensions_set(PointerRNA *ptr, const float *value)
 {
-	Object *ob= ptr->data;
+	Object *ob = ptr->data;
 	object_set_dimensions(ob, value);
 }
 
 static int rna_Object_location_editable(PointerRNA *ptr, int index)
 {
-	Object *ob= (Object *)ptr->data;
+	Object *ob = (Object *)ptr->data;
 	
 	/* only if the axis in question is locked, not editable... */
 	if ((index == 0) && (ob->protectflag & OB_LOCK_LOCX))
@@ -727,7 +734,7 @@ static int rna_Object_location_editable(PointerRNA *ptr, int index)
 
 static int rna_Object_scale_editable(PointerRNA *ptr, int index)
 {
-	Object *ob= (Object *)ptr->data;
+	Object *ob = (Object *)ptr->data;
 	
 	/* only if the axis in question is locked, not editable... */
 	if ((index == 0) && (ob->protectflag & OB_LOCK_SCALEX))
@@ -742,7 +749,7 @@ static int rna_Object_scale_editable(PointerRNA *ptr, int index)
 
 static int rna_Object_rotation_euler_editable(PointerRNA *ptr, int index)
 {
-	Object *ob= (Object *)ptr->data;
+	Object *ob = (Object *)ptr->data;
 	
 	/* only if the axis in question is locked, not editable... */
 	if ((index == 0) && (ob->protectflag & OB_LOCK_ROTX))
@@ -757,7 +764,7 @@ static int rna_Object_rotation_euler_editable(PointerRNA *ptr, int index)
 
 static int rna_Object_rotation_4d_editable(PointerRNA *ptr, int index)
 {
-	Object *ob= (Object *)ptr->data;
+	Object *ob = (Object *)ptr->data;
 	
 	/* only consider locks if locking components individually... */
 	if (ob->protectflag & OB_LOCK_ROT4D) {
@@ -778,54 +785,54 @@ static int rna_Object_rotation_4d_editable(PointerRNA *ptr, int index)
 
 static PointerRNA rna_MaterialSlot_material_get(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 	Material *ma;
-	int index= (Material**)ptr->data - ob->mat;
+	int index = (Material**)ptr->data - ob->mat;
 
-	ma= give_current_material(ob, index+1);
+	ma = give_current_material(ob, index+1);
 	return rna_pointer_inherit_refine(ptr, &RNA_Material, ma);
 }
 
 static void rna_MaterialSlot_material_set(PointerRNA *ptr, PointerRNA value)
 {
-	Object *ob= (Object*)ptr->id.data;
-	int index= (Material**)ptr->data - ob->mat;
+	Object *ob = (Object*)ptr->id.data;
+	int index = (Material**)ptr->data - ob->mat;
 
 	assign_material(ob, value.data, index+1);
 }
 
 static int rna_MaterialSlot_link_get(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
-	int index= (Material**)ptr->data - ob->mat;
+	Object *ob = (Object*)ptr->id.data;
+	int index = (Material**)ptr->data - ob->mat;
 
 	return ob->matbits[index] != 0;
 }
 
 static void rna_MaterialSlot_link_set(PointerRNA *ptr, int value)
 {
-	Object *ob= (Object*)ptr->id.data;
-	int index= (Material**)ptr->data - ob->mat;
+	Object *ob = (Object*)ptr->id.data;
+	int index = (Material**)ptr->data - ob->mat;
 	
-	if(value) {
-		ob->matbits[index]= 1;
+	if (value) {
+		ob->matbits[index] = 1;
 		/* ob->colbits |= (1<<index); */ /* DEPRECATED */
 	}
 	else {
-		ob->matbits[index]= 0;
+		ob->matbits[index] = 0;
 		/* ob->colbits &= ~(1<<index); */ /* DEPRECATED */
 	}
 }
 
 static int rna_MaterialSlot_name_length(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 	Material *ma;
-	int index= (Material**)ptr->data - ob->mat;
+	int index = (Material**)ptr->data - ob->mat;
 
-	ma= give_current_material(ob, index+1);
+	ma = give_current_material(ob, index+1);
 
-	if(ma)
+	if (ma)
 		return strlen(ma->id.name+2);
 	
 	return 0;
@@ -833,16 +840,16 @@ static int rna_MaterialSlot_name_length(PointerRNA *ptr)
 
 static void rna_MaterialSlot_name_get(PointerRNA *ptr, char *str)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 	Material *ma;
-	int index= (Material**)ptr->data - ob->mat;
+	int index = (Material**)ptr->data - ob->mat;
 
-	ma= give_current_material(ob, index+1);
+	ma = give_current_material(ob, index+1);
 
-	if(ma)
+	if (ma)
 		strcpy(str, ma->id.name+2);
 	else
-		str[0]= '\0';
+		str[0] = '\0';
 }
 
 static void rna_MaterialSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr)
@@ -858,26 +865,33 @@ static void rna_MaterialSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr)
  *  */
 static int rna_GameObjectSettings_physics_type_get(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 
 	/* determine the body_type setting based on flags */
 	if (!(ob->gameflag & OB_COLLISION)) {
 		if (ob->gameflag & OB_OCCLUDER) {
 			ob->body_type = OB_BODY_TYPE_OCCLUDER;
-		} else if (ob->gameflag & OB_NAVMESH){
+		}
+		else if (ob->gameflag & OB_NAVMESH) {
 			ob->body_type = OB_BODY_TYPE_NAVMESH;
-		} else {
+		}
+		else {
 			ob->body_type = OB_BODY_TYPE_NO_COLLISION;
 		}
-	} else if (ob->gameflag & OB_SENSOR) {
+	}
+	else if (ob->gameflag & OB_SENSOR) {
 		ob->body_type = OB_BODY_TYPE_SENSOR;
-	} else if (!(ob->gameflag & OB_DYNAMIC)) {
+	}
+	else if (!(ob->gameflag & OB_DYNAMIC)) {
 		ob->body_type = OB_BODY_TYPE_STATIC;
-	} else if (!(ob->gameflag & (OB_RIGID_BODY|OB_SOFT_BODY))) {
+	}
+	else if (!(ob->gameflag & (OB_RIGID_BODY|OB_SOFT_BODY))) {
 		ob->body_type = OB_BODY_TYPE_DYNAMIC;
-	} else if (ob->gameflag & OB_RIGID_BODY) {
+	}
+	else if (ob->gameflag & OB_RIGID_BODY) {
 		ob->body_type = OB_BODY_TYPE_RIGID;
-	} else {
+	}
+	else {
 		ob->body_type = OB_BODY_TYPE_SOFT;
 		/* create the structure here because we display soft body buttons in the main panel */
 		if (!ob->bsoft)
@@ -889,9 +903,9 @@ static int rna_GameObjectSettings_physics_type_get(PointerRNA *ptr)
 
 static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value)
 {
-	Object *ob= (Object*)ptr->id.data;
-	const int was_navmesh= (ob->gameflag & OB_NAVMESH);
-	ob->body_type= value;
+	Object *ob = (Object*)ptr->id.data;
+	const int was_navmesh = (ob->gameflag & OB_NAVMESH);
+	ob->body_type = value;
 
 	switch (ob->body_type) {
 	case OB_BODY_TYPE_SENSOR:
@@ -934,9 +948,8 @@ static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value)
 		ob->gameflag &= ~(OB_RIGID_BODY|OB_OCCLUDER|OB_SENSOR|OB_NAVMESH);
 
 		/* assume triangle mesh, if no bounds chosen for soft body */
-		if ((ob->gameflag & OB_BOUNDS) && (ob->boundtype<OB_BOUND_TRIANGLE_MESH))
-		{
-			ob->boundtype= OB_BOUND_TRIANGLE_MESH;
+		if ((ob->gameflag & OB_BOUNDS) && (ob->boundtype<OB_BOUND_TRIANGLE_MESH)) {
+			ob->boundtype = OB_BOUND_TRIANGLE_MESH;
 		}
 		/* create a BulletSoftBody structure if not already existing */
 		if (!ob->bsoft)
@@ -956,8 +969,8 @@ static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value)
 
 static PointerRNA rna_Object_active_particle_system_get(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
-	ParticleSystem *psys= psys_get_current(ob);
+	Object *ob = (Object*)ptr->id.data;
+	ParticleSystem *psys = psys_get_current(ob);
 	return rna_pointer_inherit_refine(ptr, &RNA_ParticleSystem, psys);
 }
 
@@ -969,18 +982,18 @@ static PointerRNA rna_Object_game_settings_get(PointerRNA *ptr)
 
 static unsigned int rna_Object_layer_validate__internal(const int *values, unsigned int lay)
 {
-	int i, tot= 0;
+	int i, tot = 0;
 
 	/* ensure we always have some layer selected */
-	for(i=0; i<20; i++)
-		if(values[i])
+	for (i = 0; i<20; i++)
+		if (values[i])
 			tot++;
 
-	if(tot==0)
+	if (tot == 0)
 		return 0;
 
-	for(i=0; i<20; i++) {
-		if(values[i])	lay |= (1<<i);
+	for (i = 0; i<20; i++) {
+		if (values[i])	lay |= (1<<i);
 		else			lay &= ~(1<<i);
 	}
 
@@ -989,151 +1002,151 @@ static unsigned int rna_Object_layer_validate__internal(const int *values, unsig
 
 static void rna_Object_layer_set(PointerRNA *ptr, const int *values)
 {
-	Object *ob= (Object*)ptr->data;
+	Object *ob = (Object*)ptr->data;
 	unsigned int lay;
 
-	lay= rna_Object_layer_validate__internal(values, ob->lay);
-	if(lay)
-		ob->lay= lay;
+	lay = rna_Object_layer_validate__internal(values, ob->lay);
+	if (lay)
+		ob->lay = lay;
 }
 
 static void rna_Base_layer_set(PointerRNA *ptr, const int *values)
 {
-	Base *base= (Base*)ptr->data;
+	Base *base = (Base*)ptr->data;
 
 	unsigned int lay;
-	lay= rna_Object_layer_validate__internal(values, base->lay);
-	if(lay)
-		base->lay= lay;
+	lay = rna_Object_layer_validate__internal(values, base->lay);
+	if (lay)
+		base->lay = lay;
 
 	/* rna_Base_layer_update updates the objects layer */
 }
 
 static void rna_GameObjectSettings_state_get(PointerRNA *ptr, int *values)
 {
-	Object *ob= (Object*)ptr->data;
+	Object *ob = (Object*)ptr->data;
 	int i;
 	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)
 {
-	Object *ob= (Object*)ptr->data;
-	int i, tot= 0;
+	Object *ob = (Object*)ptr->data;
+	int i, tot = 0;
 
 	/* ensure we always have some state selected */
-	for(i=0; i<OB_MAX_STATES; i++)
-		if(values[i])
+	for (i = 0; i<OB_MAX_STATES; i++)
+		if (values[i])
 			tot++;
 	
-	if(tot==0)
+	if (tot == 0)
 		return;
 
-	for(i=0; i<OB_MAX_STATES; i++) {
-		if(values[i]) ob->state |= (1<<i);
+	for (i = 0; i<OB_MAX_STATES; i++) {
+		if (values[i]) ob->state |= (1<<i);
 		else ob->state &= ~(1<<i);
 	}
 }
 
 static void rna_GameObjectSettings_used_state_get(PointerRNA *ptr, int *values)
 {
-	Object *ob= (Object*)ptr->data;
+	Object *ob = (Object*)ptr->data;
 	bController *cont;
 
 	memset(values, 0, sizeof(int)*OB_MAX_STATES);
-	for (cont=ob->controllers.first; cont; cont=cont->next) {
+	for (cont = ob->controllers.first; cont; cont = cont->next) {
 		int i;
 
-		for (i=0; i<OB_MAX_STATES; i++) {
+		for (i = 0; i<OB_MAX_STATES; i++) {
 			if (cont->state_mask & (1<<i))
 				values[i] = 1;
 		}
 	}
 }
 
-static void rna_Object_active_shape_key_index_range(PointerRNA *ptr, int *min, int *max)
+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;
-	Key *key= ob_get_key(ob);
+	Object *ob = (Object*)ptr->id.data;
+	Key *key = ob_get_key(ob);
 
-	*min= 0;
-	if(key) {
-		*max= BLI_countlist(&key->block)-1;
-		if(*max < 0) *max= 0;
+	*min = 0;
+	if (key) {
+		*max = BLI_countlist(&key->block)-1;
+		if (*max < 0) *max = 0;
 	}
 	else {
-		*max= 0;
+		*max = 0;
 	}
 }
 
 static int rna_Object_active_shape_key_index_get(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 
 	return MAX2(ob->shapenr-1, 0);
 }
 
 static void rna_Object_active_shape_key_index_set(PointerRNA *ptr, int value)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 
-	ob->shapenr= value+1;
+	ob->shapenr = value+1;
 }
 
 static PointerRNA rna_Object_active_shape_key_get(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
-	Key *key= ob_get_key(ob);
+	Object *ob = (Object*)ptr->id.data;
+	Key *key = ob_get_key(ob);
 	KeyBlock *kb;
 	PointerRNA keyptr;
 
-	if(key==NULL)
+	if (key == NULL)
 		return PointerRNA_NULL;
 	
-	kb= BLI_findlink(&key->block, ob->shapenr-1);
+	kb = BLI_findlink(&key->block, ob->shapenr-1);
 	RNA_pointer_create((ID *)key, &RNA_ShapeKey, kb, &keyptr);
 	return keyptr;
 }
 
 static PointerRNA rna_Object_field_get(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 
 	/* weak */
-	if(!ob->pd)
-		ob->pd= object_add_collision_fields(0);
+	if (!ob->pd)
+		ob->pd = object_add_collision_fields(0);
 	
 	return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, ob->pd);
 }
 
 static PointerRNA rna_Object_collision_get(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 
-	if(ob->type != OB_MESH)
+	if (ob->type != OB_MESH)
 		return PointerRNA_NULL;
 
 	/* weak */
-	if(!ob->pd)
-		ob->pd= object_add_collision_fields(0);
+	if (!ob->pd)
+		ob->pd = object_add_collision_fields(0);
 	
 	return rna_pointer_inherit_refine(ptr, &RNA_CollisionSettings, ob->pd);
 }
 
 static PointerRNA rna_Object_active_constraint_get(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
-	bConstraint *con= constraints_get_active(&ob->constraints);
+	Object *ob = (Object*)ptr->id.data;
+	bConstraint *con = constraints_get_active(&ob->constraints);
 	return rna_pointer_inherit_refine(ptr, &RNA_Constraint, con);
 }
 
 static void rna_Object_active_constraint_set(PointerRNA *ptr, PointerRNA value)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 	constraints_set_active(&ob->constraints, (bConstraint *)value.data);
 }
 
@@ -1145,7 +1158,7 @@ static bConstraint *rna_Object_constraints_new(Object *object, int type)
 
 static void rna_Object_constraints_remove(Object *object, ReportList *reports, bConstraint *con)
 {
-	if(BLI_findindex(&object->constraints, con) == -1) {
+	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;
 	}
@@ -1166,7 +1179,8 @@ static void rna_Object_constraints_clear(Object *object)
 	WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT|NA_REMOVED, object);
 }
 
-static ModifierData *rna_Object_modifier_new(Object *object, bContext *C, ReportList *reports, const char *name, int type)
+static ModifierData *rna_Object_modifier_new(Object *object, bContext *C, ReportList *reports,
+                                             const char *name, int type)
 {
 	return ED_object_modifier_add(reports, CTX_data_main(C), CTX_data_scene(C), object, name, type);
 }
@@ -1187,9 +1201,9 @@ static void rna_Object_modifier_clear(Object *object, bContext *C)
 
 static void rna_Object_boundbox_get(PointerRNA *ptr, float *values)
 {
-	Object *ob= (Object*)ptr->id.data;
-	BoundBox *bb= object_get_boundbox(ob);
-	if(bb) {
+	Object *ob = (Object*)ptr->id.data;
+	BoundBox *bb = object_get_boundbox(ob);
+	if (bb) {
 		memcpy(values, bb->vec, sizeof(bb->vec));
 	}
 	else {
@@ -1226,12 +1240,12 @@ static void rna_VertexGroup_vertex_add(ID *id, bDeformGroup *def, ReportList *re
 {
 	Object *ob = (Object *)id;
 
-	if(ED_vgroup_object_is_edit_mode(ob)) {
+	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");
 		return;
 	}
 
-	while(index_len--)
+	while (index_len--)
 		ED_vgroup_vert_add(ob, def, *index++, weight, assignmode); /* XXX, not efficient calling within loop*/
 
 	WM_main_add_notifier(NC_GEOM|ND_DATA, (ID *)ob->data);
@@ -1241,12 +1255,12 @@ static void rna_VertexGroup_vertex_remove(ID *id, bDeformGroup *dg, ReportList *
 {
 	Object *ob = (Object *)id;
 
-	if(ED_vgroup_object_is_edit_mode(ob)) {
+	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");
 		return;
 	}
 
-	while(index_len--)
+	while (index_len--)
 		ED_vgroup_vert_remove(ob, dg, *index++);
 
 	WM_main_add_notifier(NC_GEOM|ND_DATA, (ID *)ob->data);
@@ -1256,10 +1270,10 @@ static float rna_VertexGroup_weight(ID *id, bDeformGroup *dg, ReportList *report
 {
 	float weight = ED_vgroup_vert_weight((Object *)id, dg, index);
 
-	if(weight < 0) {
+	if (weight < 0) {
 		BKE_reportf(reports, RPT_ERROR, "Vertex not in group");
 	}
-	return weight;		
+	return weight;
 }
 
 /* generic poll functions */
@@ -1290,7 +1304,7 @@ int rna_Camera_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
 
 #else
 
-static int rna_matrix_dimsize_4x4[]= {4, 4};
+static int rna_matrix_dimsize_4x4[] = {4, 4};
 
 static void rna_def_vertex_group(BlenderRNA *brna)
 {
@@ -1305,51 +1319,53 @@ static void rna_def_vertex_group(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}
 	};
 
-	srna= RNA_def_struct(brna, "VertexGroup", NULL);
+	srna = RNA_def_struct(brna, "VertexGroup", NULL);
 	RNA_def_struct_sdna(srna, "bDeformGroup");
 	RNA_def_struct_ui_text(srna, "Vertex Group", "Group of vertices, used for armature deform and other purposes");
 	RNA_def_struct_ui_icon(srna, ICON_GROUP_VERTEX);
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Name", "Vertex group name");
 	RNA_def_struct_name_property(srna, prop);
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_VertexGroup_name_set");
-	RNA_def_property_update(prop, NC_GEOM|ND_DATA|NA_RENAME, "rna_Object_internal_update_data"); /* update data because modifiers may use [#24761] */
+		/* update data because modifiers may use [#24761] */
+	RNA_def_property_update(prop, NC_GEOM|ND_DATA|NA_RENAME, "rna_Object_internal_update_data");
 	
-	prop= RNA_def_property(srna, "lock_weight", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_weight", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_ui_text(prop, "", "Maintain the relative weights for the group");
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", 0);
-	RNA_def_property_update(prop, NC_GEOM|ND_DATA|NA_RENAME, "rna_Object_internal_update_data"); /* update data because modifiers may use [#24761] */
+		/* update data because modifiers may use [#24761] */
+	RNA_def_property_update(prop, NC_GEOM|ND_DATA|NA_RENAME, "rna_Object_internal_update_data");
 
-	prop= RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_int_funcs(prop, "rna_VertexGroup_index_get", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Index", "Index number of the vertex group");
 
-	func= RNA_def_function(srna, "add", "rna_VertexGroup_vertex_add");
+	func = RNA_def_function(srna, "add", "rna_VertexGroup_vertex_add");
 	RNA_def_function_ui_description(func, "Add vertices to the group");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS|FUNC_USE_SELF_ID);
 	/* TODO, see how array size of 0 works, this shouldnt be used */
-	prop= RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List", 0, 0);
+	prop = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List", 0, 0);
 	RNA_def_property_flag(prop, PROP_DYNAMIC|PROP_REQUIRED);
-	prop= RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight", 0.0f, 1.0f);
+	prop = RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight", 0.0f, 1.0f);
 	RNA_def_property_flag(prop, PROP_REQUIRED);
-	prop= RNA_def_enum(func, "type", assign_mode_items, 0, "", "Vertex assign mode");
+	prop = RNA_def_enum(func, "type", assign_mode_items, 0, "", "Vertex assign mode");
 	RNA_def_property_flag(prop, PROP_REQUIRED);
 
-	func= RNA_def_function(srna, "remove", "rna_VertexGroup_vertex_remove");
+	func = RNA_def_function(srna, "remove", "rna_VertexGroup_vertex_remove");
 	RNA_def_function_ui_description(func, "Remove a vertex from the group");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS|FUNC_USE_SELF_ID);
 	/* TODO, see how array size of 0 works, this shouldnt be used */
-	prop= RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List", 0, 0);
+	prop = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List", 0, 0);
 	RNA_def_property_flag(prop, PROP_DYNAMIC|PROP_REQUIRED);
 
-	func= RNA_def_function(srna, "weight", "rna_VertexGroup_weight");
+	func = RNA_def_function(srna, "weight", "rna_VertexGroup_weight");
 	RNA_def_function_ui_description(func, "Get a vertex weight from the group");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS|FUNC_USE_SELF_ID);
-	prop=RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "The index of the vertex", 0, INT_MAX);
+	prop = RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "The index of the vertex", 0, INT_MAX);
 	RNA_def_property_flag(prop, PROP_REQUIRED);
-	prop= RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight", 0.0f, 1.0f);
+	prop = RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight", 0.0f, 1.0f);
 	RNA_def_function_return(func, prop);
 }
 
@@ -1367,24 +1383,24 @@ static void rna_def_material_slot(BlenderRNA *brna)
 	 * pointer data points to ob->mat + index, and we manually implement
 	 * get/set for the properties. */
 
-	srna= RNA_def_struct(brna, "MaterialSlot", NULL);
+	srna = RNA_def_struct(brna, "MaterialSlot", NULL);
 	RNA_def_struct_ui_text(srna, "Material Slot", "Material slot in an object");
 	RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA);
 
-	prop= RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Material");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_pointer_funcs(prop, "rna_MaterialSlot_material_get", "rna_MaterialSlot_material_set", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Material", "Material datablock used by this material slot");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_MaterialSlot_update");
 
-	prop= RNA_def_property(srna, "link", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "link", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, link_items);
 	RNA_def_property_enum_funcs(prop, "rna_MaterialSlot_link_get", "rna_MaterialSlot_link_set", NULL);
 	RNA_def_property_ui_text(prop, "Link", "Link material to object or the object's data");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_MaterialSlot_update");
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_funcs(prop, "rna_MaterialSlot_name_get", "rna_MaterialSlot_name_length", NULL);
 	RNA_def_property_ui_text(prop, "Name", "Material slot name");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -1403,12 +1419,13 @@ static void rna_def_object_game_settings(BlenderRNA *brna)
 		{OB_BODY_TYPE_RIGID, "RIGID_BODY", 0, "Rigid Body", "Linear and angular physics"},
 		{OB_BODY_TYPE_SOFT, "SOFT_BODY", 0, "Soft Body", "Soft body"},
 		{OB_BODY_TYPE_OCCLUDER, "OCCLUDE", 0, "Occlude", "Occluder for optimizing scene rendering"},
-		{OB_BODY_TYPE_SENSOR, "SENSOR", 0, "Sensor", 
-		                      "Collision Sensor, detects static and dynamic objects but not the other collision sensor objects"},
+		{OB_BODY_TYPE_SENSOR, "SENSOR", 0, "Sensor",
+		                      "Collision Sensor, detects static and dynamic objects but not the other "
+		                      "collision sensor objects"},
 		{OB_BODY_TYPE_NAVMESH, "NAVMESH", 0, "Navigation Mesh", "Navigation mesh"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "GameObjectSettings", NULL);
+	srna = RNA_def_struct(brna, "GameObjectSettings", NULL);
 	RNA_def_struct_sdna(srna, "Object");
 	RNA_def_struct_nested(brna, srna, "Object");
 	RNA_def_struct_ui_text(srna, "Game Object Settings", "Game engine related settings for the object");
@@ -1416,209 +1433,212 @@ static void rna_def_object_game_settings(BlenderRNA *brna)
 
 	/* logic */
 
-	prop= RNA_def_property(srna, "sensors", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "sensors", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Sensor");
 	RNA_def_property_ui_text(prop, "Sensors", "Game engine sensor to detect events");
 
-	prop= RNA_def_property(srna, "controllers", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "controllers", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Controller");
 	RNA_def_property_ui_text(prop, "Controllers",
 	                         "Game engine controllers to process events, connecting sensors to actuators");
 
-	prop= RNA_def_property(srna, "actuators", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "actuators", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Actuator");
 	RNA_def_property_ui_text(prop, "Actuators", "Game engine actuators to act on events");
 
-	prop= RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "prop", NULL);
 	RNA_def_property_struct_type(prop, "GameProperty"); /* rna_property.c */
 	RNA_def_property_ui_text(prop, "Properties", "Game engine properties");
 
-	prop= RNA_def_property(srna, "show_sensors", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_sensors", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWSENS);
 	RNA_def_property_ui_text(prop, "Show Sensors", "Shows sensors for this object in the user interface");
 
-	prop= RNA_def_property(srna, "show_controllers", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_controllers", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWCONT);
 	RNA_def_property_ui_text(prop, "Show Controllers", "Shows controllers for this object in the user interface");
 
-	prop= RNA_def_property(srna, "show_actuators", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_actuators", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWACT);
 	RNA_def_property_ui_text(prop, "Show Actuators", "Shows actuators for this object in the user interface");
 
 	/* physics */
 
-	prop= RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "body_type");
 	RNA_def_property_enum_items(prop, body_type_items);
-	RNA_def_property_enum_funcs(prop, "rna_GameObjectSettings_physics_type_get", "rna_GameObjectSettings_physics_type_set", NULL);
+	RNA_def_property_enum_funcs(prop, "rna_GameObjectSettings_physics_type_get",
+	                            "rna_GameObjectSettings_physics_type_set", NULL);
 	RNA_def_property_ui_text(prop, "Physics Type", "Select the type of physical representation");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_actor", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_actor", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ACTOR);
 	RNA_def_property_ui_text(prop, "Actor", "Object is detected by the Near and Radar sensor");
 
-	prop= RNA_def_property(srna, "use_ghost", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_ghost", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_GHOST);
 	RNA_def_property_ui_text(prop, "Ghost", "Object does not restitute collisions, like a ghost");
 
-	prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.01, 10000.0);
 	RNA_def_property_ui_text(prop, "Mass", "Mass of the object");
 
-	prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE|PROP_UNIT_LENGTH);
+	prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE|PROP_UNIT_LENGTH);
 	RNA_def_property_float_sdna(prop, NULL, "inertia");
-	RNA_def_property_range(prop, 0.01, 10.0);
+	RNA_def_property_range(prop, 0.01f, FLT_MAX);
+	RNA_def_property_ui_range(prop, 0.01f, 10.0f, 1, 3);
 	RNA_def_property_ui_text(prop, "Radius", "Radius of bounding sphere and material physics");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
-	prop= RNA_def_property(srna, "use_sleep", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_sleep", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_COLLISION_RESPONSE);
 	RNA_def_property_ui_text(prop, "No Sleeping", "Disable auto (de)activation in physics simulation");
 
-	prop= RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "damping");
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_text(prop, "Damping", "General movement damping");
 
-	prop= RNA_def_property(srna, "rotation_damping", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "rotation_damping", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "rdamping");
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_text(prop, "Rotation Damping", "General rotation damping");
 
-	prop= RNA_def_property(srna, "velocity_min", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "velocity_min", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "min_vel");
 	RNA_def_property_range(prop, 0.0, 1000.0);
 	RNA_def_property_ui_text(prop, "Velocity Min", "Clamp velocity to this minimum speed (except when totally still)");
 
-	prop= RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "max_vel");
 	RNA_def_property_range(prop, 0.0, 1000.0);
 	RNA_def_property_ui_text(prop, "Velocity Max", "Clamp velocity to this maximum speed");
 
 	/* lock position */
-	prop= RNA_def_property(srna, "lock_location_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_location_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_X_AXIS);
 	RNA_def_property_ui_text(prop, "Lock X Axis", "Disable simulation of linear motion along the X axis");
 	
-	prop= RNA_def_property(srna, "lock_location_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_location_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Y_AXIS);
 	RNA_def_property_ui_text(prop, "Lock Y Axis", "Disable simulation of linear motion along the Y axis");
 	
-	prop= RNA_def_property(srna, "lock_location_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_location_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Z_AXIS);
 	RNA_def_property_ui_text(prop, "Lock Z Axis", "Disable simulation of linear motion along the Z axis");
 	
 	
 	/* lock rotation */
-	prop= RNA_def_property(srna, "lock_rotation_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_rotation_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_X_ROT_AXIS);
 	RNA_def_property_ui_text(prop, "Lock X Rotation Axis", "Disable simulation of angular motion along the X axis");
 	
-	prop= RNA_def_property(srna, "lock_rotation_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_rotation_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Y_ROT_AXIS);
 	RNA_def_property_ui_text(prop, "Lock Y Rotation Axis", "Disable simulation of angular motion along the Y axis");
 	
-	prop= RNA_def_property(srna, "lock_rotation_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_rotation_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gameflag2", OB_LOCK_RIGID_BODY_Z_ROT_AXIS);
 	RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis");
 	
 	/* is this used anywhere ? */
-	prop= RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflag2", OB_NEVER_DO_ACTIVITY_CULLING);
 	RNA_def_property_ui_text(prop, "Lock Z Rotation Axis", "Disable simulation of angular motion along the Z axis");
 	
 
-	prop= RNA_def_property(srna, "use_material_physics_fh", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_material_physics_fh", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_DO_FH);
 	RNA_def_property_ui_text(prop, "Use Material Force Field", "React to force field physics settings in materials");
 
-	prop= RNA_def_property(srna, "use_rotate_from_normal", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_rotate_from_normal", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ROT_FH);
 	RNA_def_property_ui_text(prop, "Rotate From Normal",
 	                         "Use face normal to rotate object, so that it points away from the surface");
 
-	prop= RNA_def_property(srna, "form_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "form_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "formfactor");
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_text(prop, "Form Factor", "Form factor scales the inertia tensor");
 
-	prop= RNA_def_property(srna, "use_anisotropic_friction", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_anisotropic_friction", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_ANISOTROPIC_FRICTION);
 	RNA_def_property_ui_text(prop, "Anisotropic Friction", "Enable anisotropic friction");
 
-	prop= RNA_def_property(srna, "friction_coefficients", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "friction_coefficients", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "anisotropicFriction");
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_text(prop, "Friction Coefficients",
 	                         "Relative friction coefficients in the in the X, Y and Z directions, "
 	                         "when anisotropic friction is enabled");
 
-	prop= RNA_def_property(srna, "use_collision_bounds", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_collision_bounds", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_BOUNDS);
 	RNA_def_property_ui_text(prop, "Use Collision Bounds", "Specify a collision bounds type other than the default");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
-	prop= RNA_def_property(srna, "collision_bounds_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "collision_bounds_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "collision_boundtype");
 	RNA_def_property_enum_items(prop, collision_bounds_items);
 	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Object_collision_bounds_itemf");
 	RNA_def_property_ui_text(prop, "Collision Bounds",  "Select the collision type");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
-	prop= RNA_def_property(srna, "use_collision_compound", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_collision_compound", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_CHILD);
 	RNA_def_property_ui_text(prop, "Collision Compound", "Add children to form a compound collision object");
 
-	prop= RNA_def_property(srna, "collision_margin", PROP_FLOAT, PROP_NONE|PROP_UNIT_LENGTH);
+	prop = RNA_def_property(srna, "collision_margin", PROP_FLOAT, PROP_NONE|PROP_UNIT_LENGTH);
 	RNA_def_property_float_sdna(prop, NULL, "margin");
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_text(prop, "Collision Margin",
-	                         "Extra margin around object for collision detection, small amount required for stability");
+	                         "Extra margin around object for collision detection, small amount required "
+	                         "for stability");
 
-	prop= RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "bsoft");
 	RNA_def_property_ui_text(prop, "Soft Body Settings", "Settings for Bullet soft body simulation");
 
-	prop= RNA_def_property(srna, "use_obstacle_create", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_obstacle_create", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gameflag", OB_HASOBSTACLE);
 	RNA_def_property_ui_text(prop, "Create obstacle", "Create representation for obstacle simulation");
 
-	prop= RNA_def_property(srna, "obstacle_radius", PROP_FLOAT, PROP_NONE|PROP_UNIT_LENGTH);
+	prop = RNA_def_property(srna, "obstacle_radius", PROP_FLOAT, PROP_NONE|PROP_UNIT_LENGTH);
 	RNA_def_property_float_sdna(prop, NULL, "obstacleRad");
 	RNA_def_property_range(prop, 0.0, 1000.0);
 	RNA_def_property_ui_text(prop, "Obstacle Radius", "Radius of object representation in obstacle simulation");
 	
 	/* state */
 
-	prop= RNA_def_property(srna, "states_visible", PROP_BOOLEAN, PROP_LAYER_MEMBER);
+	prop = RNA_def_property(srna, "states_visible", PROP_BOOLEAN, PROP_LAYER_MEMBER);
 	RNA_def_property_boolean_sdna(prop, NULL, "state", 1);
 	RNA_def_property_array(prop, OB_MAX_STATES);
 	RNA_def_property_ui_text(prop, "State", "State determining which controllers are displayed");
 	RNA_def_property_boolean_funcs(prop, "rna_GameObjectSettings_state_get", "rna_GameObjectSettings_state_set");
 
-	prop= RNA_def_property(srna, "used_states", PROP_BOOLEAN, PROP_LAYER_MEMBER);
+	prop = RNA_def_property(srna, "used_states", PROP_BOOLEAN, PROP_LAYER_MEMBER);
 	RNA_def_property_array(prop, OB_MAX_STATES);
 	RNA_def_property_ui_text(prop, "Used State", "States which are being used by controllers");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_GameObjectSettings_used_state_get", NULL);
 	
-	prop= RNA_def_property(srna, "states_initial", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "states_initial", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "init_state", 1);
 	RNA_def_property_array(prop, OB_MAX_STATES);
 	RNA_def_property_ui_text(prop, "Initial State", "Initial state when the game starts");
 
-	prop= RNA_def_property(srna, "show_debug_state", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_debug_state", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_DEBUGSTATE);
 	RNA_def_property_ui_text(prop, "Debug State", "Print state debug info in the game engine");
 	RNA_def_property_ui_icon(prop, ICON_INFO, 0);
 
-	prop= RNA_def_property(srna, "use_all_states", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_all_states", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_ALLSTATE);
 	RNA_def_property_ui_text(prop, "All", "Set all state bits");
 
-	prop= RNA_def_property(srna, "show_state_panel", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_state_panel", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scaflag", OB_SHOWSTATE);
 	RNA_def_property_ui_text(prop, "States", "Show state panel");
 	RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
@@ -1633,37 +1653,38 @@ static void rna_def_object_constraints(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, "ObjectConstraints");
-	srna= RNA_def_struct(brna, "ObjectConstraints", NULL);
+	srna = RNA_def_struct(brna, "ObjectConstraints", NULL);
 	RNA_def_struct_sdna(srna, "Object");
 	RNA_def_struct_ui_text(srna, "Object Constraints", "Collection of object constraints");
 
 
 	/* Collection active property */
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Constraint");
-	RNA_def_property_pointer_funcs(prop, "rna_Object_active_constraint_get", "rna_Object_active_constraint_set", NULL, NULL);
+	RNA_def_property_pointer_funcs(prop, "rna_Object_active_constraint_get",
+	                               "rna_Object_active_constraint_set", NULL, NULL);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Active Constraint", "Active Object constraint");
 
 
 	/* Constraint collection */
-	func= RNA_def_function(srna, "new", "rna_Object_constraints_new");
+	func = RNA_def_function(srna, "new", "rna_Object_constraints_new");
 	RNA_def_function_ui_description(func, "Add a new constraint to this object");
 	/* object to add */
-	parm= RNA_def_enum(func, "type", constraint_type_items, 1, "", "Constraint type to add");
+	parm = RNA_def_enum(func, "type", constraint_type_items, 1, "", "Constraint type to add");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint");
+	parm = RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_Object_constraints_remove");
+	func = RNA_def_function(srna, "remove", "rna_Object_constraints_remove");
 	RNA_def_function_ui_description(func, "Remove a constraint from this object");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	/* constraint to remove */
-	parm= RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint");
+	parm = RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "clear", "rna_Object_constraints_clear");
+	func = RNA_def_function(srna, "clear", "rna_Object_constraints_clear");
 	RNA_def_function_ui_description(func, "Remove all constraint from this object");
 }
 
@@ -1676,46 +1697,46 @@ static void rna_def_object_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, "ObjectModifiers");
-	srna= RNA_def_struct(brna, "ObjectModifiers", NULL);
+	srna = RNA_def_struct(brna, "ObjectModifiers", NULL);
 	RNA_def_struct_sdna(srna, "Object");
 	RNA_def_struct_ui_text(srna, "Object Modifiers", "Collection of object modifiers");
 
 #if 0
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "EditBone");
 	RNA_def_property_pointer_sdna(prop, NULL, "act_edbone");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Active EditBone", "Armatures active edit bone");
-	//RNA_def_property_update(prop, 0, "rna_Armature_act_editbone_update");
+	/*RNA_def_property_update(prop, 0, "rna_Armature_act_editbone_update"); */
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_Armature_act_edit_bone_set", NULL, NULL);
 
 	/* todo, redraw */
-//		RNA_def_property_collection_active(prop, prop_act);
+/*		RNA_def_property_collection_active(prop, prop_act); */
 #endif
 
 	/* add target */
-	func= RNA_def_function(srna, "new", "rna_Object_modifier_new");
+	func = RNA_def_function(srna, "new", "rna_Object_modifier_new");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Add a new modifier");
-	parm= RNA_def_string(func, "name", "Name", 0, "", "New name for the bone");
+	parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the bone");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* modifier to add */
-	parm= RNA_def_enum(func, "type", modifier_type_items, 1, "", "Modifier type to add");
+	parm = RNA_def_enum(func, "type", modifier_type_items, 1, "", "Modifier type to add");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return type */
-	parm= RNA_def_pointer(func, "modifier", "Modifier", "", "Newly created modifier");
+	parm = RNA_def_pointer(func, "modifier", "Modifier", "", "Newly created modifier");
 	RNA_def_function_return(func, parm);
 
 	/* remove target */
-	func= RNA_def_function(srna, "remove", "rna_Object_modifier_remove");
+	func = RNA_def_function(srna, "remove", "rna_Object_modifier_remove");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
 	RNA_def_function_ui_description(func, "Remove an existing modifier from the object");
 	/* target to remove*/
-	parm= RNA_def_pointer(func, "modifier", "Modifier", "", "Modifier to remove");
+	parm = RNA_def_pointer(func, "modifier", "Modifier", "", "Modifier to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
 	/* clear all modifiers */
-	func= RNA_def_function(srna, "clear", "rna_Object_modifier_clear");
+	func = RNA_def_function(srna, "clear", "rna_Object_modifier_clear");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
 	RNA_def_function_ui_description(func, "Remove all modifiers from the object");
 }
@@ -1727,21 +1748,21 @@ static void rna_def_object_particle_systems(BlenderRNA *brna, PropertyRNA *cprop
 	
 	PropertyRNA *prop;
 
-	// FunctionRNA *func;
-	// PropertyRNA *parm;
+	/* FunctionRNA *func; */
+	/* PropertyRNA *parm; */
 
 	RNA_def_property_srna(cprop, "ParticleSystems");
-	srna= RNA_def_struct(brna, "ParticleSystems", NULL);
+	srna = RNA_def_struct(brna, "ParticleSystems", NULL);
 	RNA_def_struct_sdna(srna, "Object");
 	RNA_def_struct_ui_text(srna, "Particle Systems", "Collection of particle systems");
 
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "ParticleSystem");
 	RNA_def_property_pointer_funcs(prop, "rna_Object_active_particle_system_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Active Particle System", "Active particle system being displayed");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 	
-	prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_int_funcs(prop, "rna_Object_active_particle_system_index_get",
 	                           "rna_Object_active_particle_system_index_set",
@@ -1762,38 +1783,39 @@ static void rna_def_object_vertex_groups(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, "VertexGroups");
-	srna= RNA_def_struct(brna, "VertexGroups", NULL);
+	srna = RNA_def_struct(brna, "VertexGroups", NULL);
 	RNA_def_struct_sdna(srna, "Object");
 	RNA_def_struct_ui_text(srna, "Vertex Groups", "Collection of vertex groups");
 
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "VertexGroup");
 	RNA_def_property_pointer_funcs(prop, "rna_Object_active_vertex_group_get",
 	                               "rna_Object_active_vertex_group_set", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Active Vertex Group", "Vertex groups of the object");
 	RNA_def_property_update(prop, NC_GEOM|ND_DATA, "rna_Object_internal_update_data");
 
-	prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_int_sdna(prop, NULL, "actdef");
-	RNA_def_property_int_funcs(prop, "rna_Object_active_vertex_group_index_get", "rna_Object_active_vertex_group_index_set",
+	RNA_def_property_int_funcs(prop, "rna_Object_active_vertex_group_index_get",
+	                           "rna_Object_active_vertex_group_index_set",
 	                           "rna_Object_active_vertex_group_index_range");
 	RNA_def_property_ui_text(prop, "Active Vertex Group Index", "Active index in vertex group array");
 	RNA_def_property_update(prop, NC_GEOM|ND_DATA, "rna_Object_internal_update_data");
 	
-	/* vertex groups */ // add_vertex_group
-	func= RNA_def_function(srna, "new", "rna_Object_vgroup_new");
+	/* vertex groups */ /* add_vertex_group */
+	func = RNA_def_function(srna, "new", "rna_Object_vgroup_new");
 	RNA_def_function_ui_description(func, "Add vertex group to object");
 	RNA_def_string(func, "name", "Group", 0, "", "Vertex group name"); /* optional */
-	parm= RNA_def_pointer(func, "group", "VertexGroup", "", "New vertex group");
+	parm = RNA_def_pointer(func, "group", "VertexGroup", "", "New vertex group");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_Object_vgroup_remove");
+	func = RNA_def_function(srna, "remove", "rna_Object_vgroup_remove");
 	RNA_def_function_ui_description(func, "Delete vertex group from object");
-	parm= RNA_def_pointer(func, "group", "VertexGroup", "", "Vertex group to remove");
+	parm = RNA_def_pointer(func, "group", "VertexGroup", "", "Vertex group to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "clear", "rna_Object_vgroup_clear");
+	func = RNA_def_function(srna, "clear", "rna_Object_vgroup_clear");
 	RNA_def_function_ui_description(func, "Delete all vertex groups from object");
 }
 
@@ -1830,10 +1852,11 @@ static void rna_def_object(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}};
 
 	static EnumPropertyItem drawtype_items[] = {
-		{OB_BOUNDBOX, "BOUNDS", 0, "Bounds", "Draw the bounding box of the object"},
+		{OB_BOUNDBOX, "BOUNDS", 0, "Bounds", "Draw the bounds of the object"},
 		{OB_WIRE, "WIRE", 0, "Wire", "Draw the object as a wireframe"},
 		{OB_SOLID, "SOLID", 0, "Solid", "Draw the object as a solid (if solid drawing is enabled in the viewport)"},
-		{OB_TEXTURE, "TEXTURED", 0, "Textured", "Draw the object with textures (if textures are enabled in the viewport)"},
+		{OB_TEXTURE, "TEXTURED", 0, "Textured",
+		             "Draw the object with textures (if textures are enabled in the viewport)"},
 		{0, NULL, 0, NULL, NULL}};
 
 	static EnumPropertyItem boundtype_items[] = {
@@ -1851,7 +1874,8 @@ static void rna_def_object(BlenderRNA *brna)
 		{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
+	/* 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[] = {
 		{ROT_MODE_QUAT, "QUATERNION", 0, "Quaternion (WXYZ)", "No Gimbal Lock"},
 		{ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order - prone to Gimbal Lock (default)"},
@@ -1867,33 +1891,33 @@ static void rna_def_object(BlenderRNA *brna)
 	static float default_quat[4] = {1,0,0,0};	/* default quaternion values */
 	static float default_axisAngle[4] = {0,0,1,0};	/* default axis-angle rotation values */
 	static float default_scale[3] = {1,1,1}; /* default scale values */
-	static int boundbox_dimsize[]= {8, 3};
+	static int boundbox_dimsize[] = {8, 3};
 
-	srna= RNA_def_struct(brna, "Object", "ID");
+	srna = RNA_def_struct(brna, "Object", "ID");
 	RNA_def_struct_ui_text(srna, "Object", "Object datablock defining an object in a scene");
 	RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
 	RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA);
 
-	prop= RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "ID");
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_data_set", "rna_Object_data_typef", NULL);
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK);
 	RNA_def_property_ui_text(prop, "Data", "Object data");
 	RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
 
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, object_type_items);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Type", "Type of Object");
 
-	prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "mode");
 	RNA_def_property_enum_items(prop, object_mode_items);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Mode", "Object interaction mode");
 
-	prop= RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
+	prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
 	RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
 	RNA_def_property_array(prop, 20);
 	RNA_def_property_ui_text(prop, "Layers", "Layers the object is on");
@@ -1901,48 +1925,50 @@ static void rna_def_object(BlenderRNA *brna)
 	RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_layer_update");
 
-	prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
 	RNA_def_property_ui_text(prop, "Select", "Object selection state");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_select_update");
 
 	/* for data access */
-	prop= RNA_def_property(srna, "bound_box", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "bound_box", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_multi_array(prop, 2, boundbox_dimsize);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_float_funcs(prop, "rna_Object_boundbox_get", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Bounding Box",
-	                         "Object's bounding box in object-space coordinates, all values are -1.0 when not available");
+	                         "Object's bounding box in object-space coordinates, all values are -1.0 when "
+	                         "not available");
 
 	/* parent */
-	prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_parent_set", NULL, NULL);
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
 	RNA_def_property_ui_text(prop, "Parent", "Parent Object");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
 	
-	prop= RNA_def_property(srna, "parent_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "parent_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "partype");
 	RNA_def_property_enum_items(prop, parent_type_items);
 	RNA_def_property_enum_funcs(prop, NULL, "rna_Object_parent_type_set", "rna_Object_parent_type_itemf");
 	RNA_def_property_ui_text(prop, "Parent Type", "Type of parent relation");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
 
-	prop= RNA_def_property(srna, "parent_vertices", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "parent_vertices", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "par1");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Parent Vertices", "Indices of vertices in case of a vertex parenting relation");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
 
-	prop= RNA_def_property(srna, "parent_bone", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "parent_bone", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "parsubstr");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Object_parent_bone_set");
 	RNA_def_property_ui_text(prop, "Parent Bone", "Name of parent bone in case of a bone parenting relation");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
 	
 	/* Track and Up flags */
-	// XXX: these have been saved here for a bit longer (after old track was removed), since some other tools still refer to this
-	prop= RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
+	/* XXX: these have been saved here for a bit longer (after old track was removed),
+	 *      since some other tools still refer to this */
+	prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "trackflag");
 	RNA_def_property_enum_items(prop, track_items);
 	RNA_def_property_ui_text(prop, "Track Axis",
@@ -1950,7 +1976,7 @@ static void rna_def_object(BlenderRNA *brna)
 	                         "parent 'Follow' is enabled)");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
 
-	prop= RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "upflag");
 	RNA_def_property_enum_items(prop, up_items);
 	RNA_def_property_ui_text(prop, "Up Axis",
@@ -1959,27 +1985,29 @@ static void rna_def_object(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
 	
 	/* proxy */
-	prop= RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Proxy", "Library object this proxy object controls");
 
-	prop= RNA_def_property(srna, "proxy_group", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "proxy_group", PROP_POINTER, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Proxy Group", "Library group duplicator object this proxy object controls");
 
 	/* materials */
-	prop= RNA_def_property(srna, "material_slots", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "material_slots", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
 	RNA_def_property_struct_type(prop, "MaterialSlot");
-	RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_iterator_array_get", NULL, NULL, NULL, NULL); /* don't dereference pointer! */
+		/* don't dereference pointer! */
+	RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_iterator_array_get", NULL, NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Material Slots", "Material slots in the object");
 
-	prop= RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Material");
-	RNA_def_property_pointer_funcs(prop, "rna_Object_active_material_get", "rna_Object_active_material_set", NULL, NULL);
+	RNA_def_property_pointer_funcs(prop, "rna_Object_active_material_get",
+	                               "rna_Object_active_material_set", NULL, NULL);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_MaterialSlot_update");
 
-	prop= RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "actcol");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_int_funcs(prop, "rna_Object_active_material_index_get", "rna_Object_active_material_index_set",
@@ -1988,14 +2016,14 @@ static void rna_def_object(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL);
 	
 	/* transform */
-	prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "loc");
 	RNA_def_property_editable_array_func(prop, "rna_Object_location_editable");
-	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
 	RNA_def_property_ui_text(prop, "Location", "Location of the object");
+	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
 	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
 	
-	prop= RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
+	prop = RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
 	RNA_def_property_float_sdna(prop, NULL, "quat");
 	RNA_def_property_editable_array_func(prop, "rna_Object_rotation_4d_editable");
 	RNA_def_property_float_array_default(prop, default_quat);
@@ -2005,28 +2033,29 @@ static void rna_def_object(BlenderRNA *brna)
 		/* XXX: for axis-angle, it would have been nice to have 2 separate fields for UI purposes, but
 		 * having a single one is better for Keyframing and other property-management situations...
 		 */
-	prop= RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
+	prop = RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
 	RNA_def_property_array(prop, 4);
-	RNA_def_property_float_funcs(prop, "rna_Object_rotation_axis_angle_get", "rna_Object_rotation_axis_angle_set", NULL);
+	RNA_def_property_float_funcs(prop, "rna_Object_rotation_axis_angle_get",
+	                             "rna_Object_rotation_axis_angle_set", NULL);
 	RNA_def_property_editable_array_func(prop, "rna_Object_rotation_4d_editable");
 	RNA_def_property_float_array_default(prop, default_axisAngle);
 	RNA_def_property_ui_text(prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
 	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
 	
-	prop= RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
+	prop = RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
 	RNA_def_property_float_sdna(prop, NULL, "rot");
 	RNA_def_property_editable_array_func(prop, "rna_Object_rotation_euler_editable");
 	RNA_def_property_ui_text(prop, "Euler Rotation", "Rotation in Eulers");
 	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
 	
-	prop= RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "rotmode");
-	RNA_def_property_enum_items(prop, prop_rotmode_items); // XXX move to using a single define of this someday
+	RNA_def_property_enum_items(prop, prop_rotmode_items); /* XXX move to using a single define of this someday */
 	RNA_def_property_enum_funcs(prop, NULL, "rna_Object_rotation_mode_set", NULL);
 	RNA_def_property_ui_text(prop, "Rotation Mode", "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
 	
-	prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "size");
 	RNA_def_property_editable_array_func(prop, "rna_Object_scale_editable");
 	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
@@ -2034,7 +2063,7 @@ static void rna_def_object(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Scale", "Scaling of the object");
 	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
 
-	prop= RNA_def_property(srna, "dimensions", PROP_FLOAT, PROP_XYZ_LENGTH);
+	prop = RNA_def_property(srna, "dimensions", PROP_FLOAT, PROP_XYZ_LENGTH);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_float_funcs(prop, "rna_Object_dimensions_get", "rna_Object_dimensions_set", NULL);
 	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
@@ -2043,34 +2072,36 @@ static void rna_def_object(BlenderRNA *brna)
 	
 
 	/* delta transforms */
-	prop= RNA_def_property(srna, "delta_location", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "delta_location", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "dloc");
 	RNA_def_property_ui_text(prop, "Delta Location", "Extra translation added to the location of the object");
+	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
 	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
 	
-	prop= RNA_def_property(srna, "delta_rotation_euler", PROP_FLOAT, PROP_EULER);
+	prop = RNA_def_property(srna, "delta_rotation_euler", PROP_FLOAT, PROP_EULER);
 	RNA_def_property_float_sdna(prop, NULL, "drot");
 	RNA_def_property_ui_text(prop, "Delta Rotation (Euler)",
 	                         "Extra rotation added to the rotation of the object (when using Euler rotations)");
 	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
 	
-	prop= RNA_def_property(srna, "delta_rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
+	prop = RNA_def_property(srna, "delta_rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
 	RNA_def_property_float_sdna(prop, NULL, "dquat");
 	RNA_def_property_float_array_default(prop, default_quat);
 	RNA_def_property_ui_text(prop, "Delta Rotation (Quaternion)",
 	                         "Extra rotation added to the rotation of the object (when using Quaternion rotations)");
 	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
 	
-#if 0 // XXX not supported well yet...
-	prop= RNA_def_property(srna, "delta_rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
-	RNA_def_property_float_sdna(prop, NULL, "dquat"); // FIXME: this is not a single field any more! (drotAxis and drotAngle)
+#if 0 /* XXX not supported well yet... */
+	prop = RNA_def_property(srna, "delta_rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
+		/* FIXME: this is not a single field any more! (drotAxis and drotAngle) */
+	RNA_def_property_float_sdna(prop, NULL, "dquat");
 	RNA_def_property_float_array_default(prop, default_axisAngle);
 	RNA_def_property_ui_text(prop, "Delta Rotation (Axis Angle)",
 	                         "Extra rotation added to the rotation of the object (when using Axis-Angle rotations)");
 	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
 #endif
-	
-	prop= RNA_def_property(srna, "delta_scale", PROP_FLOAT, PROP_XYZ);
+
+	prop = RNA_def_property(srna, "delta_scale", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "dscale");
 	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
 	RNA_def_property_float_array_default(prop, default_scale);
@@ -2078,33 +2109,34 @@ static void rna_def_object(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
 	
 	/* transform locks */
-	prop= RNA_def_property(srna, "lock_location", PROP_BOOLEAN, PROP_XYZ);
+	prop = RNA_def_property(srna, "lock_location", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_LOCX);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Lock Location", "Lock editing of location in the interface");
 	RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
 	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
 
-	prop= RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_XYZ);
+	prop = RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTX);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Lock Rotation", "Lock editing of rotation in the interface");
 	RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
 	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
 	
-		// XXX this is sub-optimal - it really should be included above, but due to technical reasons we can't do this!
-	prop= RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE);
+		/* XXX this is sub-optimal - it really should be included above,
+		 *     but due to technical reasons we can't do this! */
+	prop = RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTW);
 	RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
 	RNA_def_property_ui_text(prop, "Lock Rotation (4D Angle)",
 	                         "Lock editing of 'angle' component of four-component rotations in the interface");
-		// XXX this needs a better name
-	prop= RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE);
+		/* XXX this needs a better name */
+	prop = RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROT4D);
 	RNA_def_property_ui_text(prop, "Lock Rotations (4D)",
 	                         "Lock editing of four component rotations by components (instead of as Eulers)");
 
-	prop= RNA_def_property(srna, "lock_scale", PROP_BOOLEAN, PROP_XYZ);
+	prop = RNA_def_property(srna, "lock_scale", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_SCALEX);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Lock Scale", "Lock editing of scale in the interface");
@@ -2112,21 +2144,21 @@ static void rna_def_object(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
 
 	/* matrix */
-	prop= RNA_def_property(srna, "matrix_world", PROP_FLOAT, PROP_MATRIX);
+	prop = RNA_def_property(srna, "matrix_world", PROP_FLOAT, PROP_MATRIX);
 	RNA_def_property_float_sdna(prop, NULL, "obmat");
 	RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Matrix World", "Worldspace transformation matrix");
 	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_matrix_world_update");
 
-	prop= RNA_def_property(srna, "matrix_local", PROP_FLOAT, PROP_MATRIX);
+	prop = RNA_def_property(srna, "matrix_local", PROP_FLOAT, PROP_MATRIX);
 	RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Local Matrix", "Parent relative transformation matrix");
 	RNA_def_property_float_funcs(prop, "rna_Object_matrix_local_get", "rna_Object_matrix_local_set", NULL);
 	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, NULL);
 
-	prop= RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX);
+	prop = RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX);
 	RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Input Matrix",
@@ -2136,108 +2168,109 @@ static void rna_def_object(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
 
 	/*parent_inverse*/
-	prop= RNA_def_property(srna, "matrix_parent_inverse", PROP_FLOAT, PROP_MATRIX);
+	prop = RNA_def_property(srna, "matrix_parent_inverse", PROP_FLOAT, PROP_MATRIX);
 	RNA_def_property_float_sdna(prop, NULL, "parentinv");
 	RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
 	RNA_def_property_ui_text(prop, "Matrix", "Inverse of object's parent matrix at time of parenting");
 	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
 
 	/* modifiers */
-	prop= RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Modifier");
 	RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting the geometric data of the object");
 	rna_def_object_modifiers(brna, prop);
 
 	/* constraints */
-	prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Constraint");
 	RNA_def_property_ui_text(prop, "Constraints", "Constraints affecting the transformation of the object");
-//	RNA_def_property_collection_funcs(prop, 0, 0, 0, 0, 0, 0, 0, "constraints__add", "constraints__remove");
+/*	RNA_def_property_collection_funcs(prop, 0, 0, 0, 0, 0, 0, 0, "constraints__add", "constraints__remove"); */
 	rna_def_object_constraints(brna, prop);
 
 	/* game engine */
-	prop= RNA_def_property(srna, "game", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "game", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "GameObjectSettings");
 	RNA_def_property_pointer_funcs(prop, "rna_Object_game_settings_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Game Settings", "Game engine related settings for the object");
 
 	/* vertex groups */
-	prop= RNA_def_property(srna, "vertex_groups", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "vertex_groups", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "defbase", NULL);
 	RNA_def_property_struct_type(prop, "VertexGroup");
 	RNA_def_property_ui_text(prop, "Vertex Groups", "Vertex groups of the object");
 	rna_def_object_vertex_groups(brna, prop);
 
 	/* empty */
-	prop= RNA_def_property(srna, "empty_draw_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "empty_draw_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "empty_drawtype");
 	RNA_def_property_enum_items(prop, empty_drawtype_items);
 	RNA_def_property_ui_text(prop, "Empty Display Type", "Viewport display style for empties");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
-	prop= RNA_def_property(srna, "empty_draw_size", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "empty_draw_size", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "empty_drawsize");
 	RNA_def_property_range(prop, 0.0001f, 1000.0f);
 	RNA_def_property_ui_range(prop, 0.01, 100, 1, 2);
 	RNA_def_property_ui_text(prop, "Empty Display Size", "Size of display for empties in the viewport");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
-	prop= RNA_def_property(srna, "empty_image_offset", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "empty_image_offset", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "ima_ofs");
 	RNA_def_property_ui_text(prop, "Origin Offset", "Origin offset distance");
 	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 0.1f, 2);
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
 	/* render */
-	prop= RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "index");
 	RNA_def_property_ui_text(prop, "Pass Index", "Index number for the IndexOB render pass");
 	RNA_def_property_update(prop, NC_OBJECT, NULL);
 	
-	prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "col");
 	RNA_def_property_ui_text(prop, "Color", "Object color and alpha, used when faces have the ObColor mode enabled");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
 	/* physics */
-	prop= RNA_def_property(srna, "field", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "field", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "pd");
 	RNA_def_property_struct_type(prop, "FieldSettings");
 	RNA_def_property_pointer_funcs(prop, "rna_Object_field_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Field Settings", "Settings for using the object as a field in physics simulation");
 
-	prop= RNA_def_property(srna, "collision", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "collision", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "pd");
 	RNA_def_property_struct_type(prop, "CollisionSettings");
 	RNA_def_property_pointer_funcs(prop, "rna_Object_collision_get", NULL, NULL, NULL);
-	RNA_def_property_ui_text(prop, "Collision Settings", "Settings for using the object as a collider in physics simulation");
+	RNA_def_property_ui_text(prop, "Collision Settings",
+	                         "Settings for using the object as a collider in physics simulation");
 
-	prop= RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "soft");
 	RNA_def_property_struct_type(prop, "SoftBodySettings");
 	RNA_def_property_ui_text(prop, "Soft Body Settings", "Settings for soft body simulation");
 
-	prop= RNA_def_property(srna, "particle_systems", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "particle_systems", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "particlesystem", NULL);
 	RNA_def_property_struct_type(prop, "ParticleSystem");
 	RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object");
 	rna_def_object_particle_systems(brna, prop);
 
 	/* restrict */
-	prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_VIEW);
 	RNA_def_property_ui_text(prop, "Restrict View", "Restrict visibility in the viewport");
 	RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1);
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
-	prop= RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_SELECT);
 	RNA_def_property_ui_text(prop, "Restrict Select", "Restrict selection in the viewport");
 	RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 1);
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
-	prop= RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_RENDER);
 	RNA_def_property_ui_text(prop, "Restrict Render", "Restrict renderability");
 	RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
@@ -2250,139 +2283,143 @@ static void rna_def_object(BlenderRNA *brna)
 	rna_def_motionpath_common(srna);
 	
 	/* slow parenting */
-	// XXX: evil old crap
-	prop= RNA_def_property(srna, "use_slow_parent", PROP_BOOLEAN, PROP_NONE);
+	/* XXX: evil old crap */
+	prop = RNA_def_property(srna, "use_slow_parent", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "partype", PARSLOW);
-	RNA_def_property_ui_text(prop, "Slow Parent", "Create a delay in the parent relationship (beware: this isn't renderfarm safe and may be invalid after jumping around the timeline)");
+	RNA_def_property_ui_text(prop, "Slow Parent",
+	                         "Create a delay in the parent relationship (beware: this isn't renderfarm "
+	                         "safe and may be invalid after jumping around the timeline)");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
 	
-	prop= RNA_def_property(srna, "slow_parent_offset", PROP_FLOAT, PROP_NONE|PROP_UNIT_TIME);
+	prop = RNA_def_property(srna, "slow_parent_offset", PROP_FLOAT, PROP_NONE|PROP_UNIT_TIME);
 	RNA_def_property_float_sdna(prop, NULL, "sf");
 	RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
 	RNA_def_property_ui_text(prop, "Slow Parent Offset", "Delay in the parent relationship");
 	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Object_internal_update");
 	
 	/* duplicates */
-	prop= RNA_def_property(srna, "dupli_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "dupli_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "transflag");
 	RNA_def_property_enum_items(prop, dupli_items);
 	RNA_def_property_ui_text(prop, "Dupli Type", "If not None, object duplication method to use");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
 
-	prop= RNA_def_property(srna, "use_dupli_frames_speed", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_dupli_frames_speed", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "transflag", OB_DUPLINOSPEED);
-	RNA_def_property_ui_text(prop, "Dupli Frames Speed", "Set dupliframes to use the current frame instead of parent curve's evaluation time");
+	RNA_def_property_ui_text(prop, "Dupli Frames Speed",
+	                         "Set dupliframes to use the current frame instead of parent curve's evaluation time");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
 
-	prop= RNA_def_property(srna, "use_dupli_vertices_rotation", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_dupli_vertices_rotation", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIROT);
 	RNA_def_property_ui_text(prop, "Dupli Verts Rotation", "Rotate dupli according to vertex normal");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
-	prop= RNA_def_property(srna, "use_dupli_faces_scale", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_dupli_faces_scale", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIFACES_SCALE);
 	RNA_def_property_ui_text(prop, "Dupli Faces Inherit Scale", "Scale dupli based on face size");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
 
-	prop= RNA_def_property(srna, "dupli_faces_scale", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "dupli_faces_scale", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "dupfacesca");
 	RNA_def_property_range(prop, 0.001f, 10000.0f);
 	RNA_def_property_ui_text(prop, "Dupli Faces Scale", "Scale the DupliFace objects");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
-	prop= RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "dup_group");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_dup_group_set", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Dupli Group", "Instance an existing group");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update");
 
-	prop= RNA_def_property(srna, "dupli_frames_start", PROP_INT, PROP_NONE|PROP_UNIT_TIME);
+	prop = RNA_def_property(srna, "dupli_frames_start", PROP_INT, PROP_NONE|PROP_UNIT_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "dupsta");
 	RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
 	RNA_def_property_ui_text(prop, "Dupli Frames Start", "Start frame for DupliFrames");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
 
-	prop= RNA_def_property(srna, "dupli_frames_end", PROP_INT, PROP_NONE|PROP_UNIT_TIME);
+	prop = RNA_def_property(srna, "dupli_frames_end", PROP_INT, PROP_NONE|PROP_UNIT_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "dupend");
 	RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
 	RNA_def_property_ui_text(prop, "Dupli Frames End", "End frame for DupliFrames");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
 
-	prop= RNA_def_property(srna, "dupli_frames_on", PROP_INT, PROP_NONE|PROP_UNIT_TIME);
+	prop = RNA_def_property(srna, "dupli_frames_on", PROP_INT, PROP_NONE|PROP_UNIT_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "dupon");
 	RNA_def_property_range(prop, MINFRAME, MAXFRAME);
 	RNA_def_property_ui_range(prop, 1, 1500, 1, 0);
 	RNA_def_property_ui_text(prop, "Dupli Frames On", "Number of frames to use between DupOff frames");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
 
-	prop= RNA_def_property(srna, "dupli_frames_off", PROP_INT, PROP_NONE|PROP_UNIT_TIME);
+	prop = RNA_def_property(srna, "dupli_frames_off", PROP_INT, PROP_NONE|PROP_UNIT_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "dupoff");
 	RNA_def_property_range(prop, 0, MAXFRAME);
 	RNA_def_property_ui_range(prop, 0, 1500, 1, 0);
 	RNA_def_property_ui_text(prop, "Dupli Frames Off", "Recurring frames to exclude from the Dupliframes");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_internal_update");
 
-	prop= RNA_def_property(srna, "dupli_list", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "dupli_list", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "duplilist", NULL);
 	RNA_def_property_struct_type(prop, "DupliObject");
 	RNA_def_property_ui_text(prop, "Dupli list", "Object duplis");
 
-	prop= RNA_def_property(srna, "is_duplicator", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_duplicator", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLI);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	
 	/* drawing */
-	prop= RNA_def_property(srna, "draw_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "draw_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "dt");
 	RNA_def_property_enum_items(prop, drawtype_items);
 	RNA_def_property_ui_text(prop, "Maximum Draw Type",  "Maximum draw type to display object with in viewport");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
-	prop= RNA_def_property(srna, "show_bounds", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_bounds", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_BOUNDBOX);
 	RNA_def_property_ui_text(prop, "Draw Bounds", "Display the object's bounds");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
-	prop= RNA_def_property(srna, "draw_bounds_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "draw_bounds_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "boundtype");
 	RNA_def_property_enum_items(prop, boundtype_items);
 	RNA_def_property_ui_text(prop, "Draw Bounds Type", "Object boundary display type");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 	
-	prop= RNA_def_property(srna, "show_name", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_name", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWNAME);
 	RNA_def_property_ui_text(prop, "Draw Name", "Display the object's name");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 	
-	prop= RNA_def_property(srna, "show_axis", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_axis", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_AXIS);
 	RNA_def_property_ui_text(prop, "Draw Axes", "Display the object's origin and axes");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 	
-	prop= RNA_def_property(srna, "show_texture_space", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_texture_space", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_TEXSPACE);
 	RNA_def_property_ui_text(prop, "Draw Texture Space", "Display the object's texture space");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 	
-	prop= RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWWIRE);
 	RNA_def_property_ui_text(prop, "Draw Wire", "Add the object's wireframe over solid drawing");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 	
-	prop= RNA_def_property(srna, "show_transparent", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_transparent", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWTRANSP);
 	RNA_def_property_ui_text(prop, "Draw Transparent",
 	                         "Display material transparency in the object (unsupported for duplicator drawing)");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 	
-	prop= RNA_def_property(srna, "show_x_ray", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_x_ray", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWXRAY);
-	RNA_def_property_ui_text(prop, "X-Ray", "Make the object draw in front of others (unsupported for duplicator drawing)");
+	RNA_def_property_ui_text(prop, "X-Ray",
+	                         "Make the object draw in front of others (unsupported for duplicator drawing)");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 	
 	/* Grease Pencil */
-	prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "gpd");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "GreasePencil");
@@ -2390,39 +2427,40 @@ static void rna_def_object(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 	
 	/* pose */
-	prop= RNA_def_property(srna, "pose_library", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "pose_library", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "poselib");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "Action");
 	RNA_def_property_ui_text(prop, "Pose Library", "Action used as a pose library for armatures");
 
-	prop= RNA_def_property(srna, "pose", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "pose", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "pose");
 	RNA_def_property_struct_type(prop, "Pose");
 	RNA_def_property_ui_text(prop, "Pose", "Current pose for armatures");
 
 	/* shape keys */
-	prop= RNA_def_property(srna, "show_only_shape_key", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_only_shape_key", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "shapeflag", OB_SHAPE_LOCK);
 	RNA_def_property_ui_text(prop, "Shape Key Lock", "Always show the current Shape for this Object");
 	RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
 	RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
 
-	prop= RNA_def_property(srna, "use_shape_key_edit_mode", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_shape_key_edit_mode", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "shapeflag", OB_SHAPE_EDIT_MODE);
 	RNA_def_property_ui_text(prop, "Shape Key Edit Mode", "Apply shape keys in edit mode (for Meshes only)");
 	RNA_def_property_ui_icon(prop, ICON_EDITMODE_HLT, 0);
 	RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
 
-	prop= RNA_def_property(srna, "active_shape_key", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active_shape_key", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "ShapeKey");
 	RNA_def_property_pointer_funcs(prop, "rna_Object_active_shape_key_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Active Shape Key", "Current shape key");
 
-	prop= RNA_def_property(srna, "active_shape_key_index", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "active_shape_key_index", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "shapenr");
-	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); // XXX this is really unpredictable...
-	RNA_def_property_int_funcs(prop, "rna_Object_active_shape_key_index_get", "rna_Object_active_shape_key_index_set", "rna_Object_active_shape_key_index_range");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* XXX this is really unpredictable... */
+	RNA_def_property_int_funcs(prop, "rna_Object_active_shape_key_index_get", "rna_Object_active_shape_key_index_set",
+	                           "rna_Object_active_shape_key_index_range");
 	RNA_def_property_ui_text(prop, "Active Shape Key Index", "Current shape key index");
 	RNA_def_property_update(prop, 0, "rna_Object_active_shape_update");
 
@@ -2434,29 +2472,29 @@ static void rna_def_dupli_object(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "DupliObject", NULL);
+	srna = RNA_def_struct(brna, "DupliObject", NULL);
 	RNA_def_struct_sdna(srna, "DupliObject");
 	RNA_def_struct_ui_text(srna, "Object Duplicate", "An object duplicate");
 	/* RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA); */
 
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "ob");
 	/* RNA_def_property_pointer_funcs(prop, "rna_DupliObject_object_get", NULL, NULL, NULL); */
 	RNA_def_property_ui_text(prop, "Object", "Object being duplicated");
 
-	prop= RNA_def_property(srna, "matrix_original", PROP_FLOAT, PROP_MATRIX);
+	prop = RNA_def_property(srna, "matrix_original", PROP_FLOAT, PROP_MATRIX);
 	RNA_def_property_float_sdna(prop, NULL, "omat");
 	RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE|PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Object Matrix", "The original matrix of this object before it was duplicated");
 
-	prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
+	prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
 	RNA_def_property_float_sdna(prop, NULL, "mat");
 	RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE|PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Object Duplicate Matrix", "Object duplicate transformation matrix");
 
-	prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "no_draw", 0);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE|PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Hide", "Don't show dupli object in viewport or render");
@@ -2469,24 +2507,24 @@ static void rna_def_object_base(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "ObjectBase", NULL);
+	srna = RNA_def_struct(brna, "ObjectBase", NULL);
 	RNA_def_struct_sdna(srna, "Base");
 	RNA_def_struct_ui_text(srna, "Object Base", "An object instance in a scene");
 	RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA);
 
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "object");
 	RNA_def_property_ui_text(prop, "Object", "Object this base links to");
 
 	/* same as object layer */
-	prop= RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
+	prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
 	RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
 	RNA_def_property_array(prop, 20);
 	RNA_def_property_ui_text(prop, "Layers", "Layers the object base is on");
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_Base_layer_set");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Base_layer_update");
 	
-	prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BA_SELECT);
 	RNA_def_property_ui_text(prop, "Select", "Object base selection state");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Base_select_update");
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index 9a90499..fb383b1 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.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
@@ -18,7 +18,7 @@
  * The Original Code is Copyright (C) 2009 Blender Foundation.
  * All rights reserved.
  *
- * 
+ *
  * Contributor(s): Blender Foundation
  *
  * ***** END GPL LICENSE BLOCK *****
@@ -39,11 +39,6 @@
 #include "DNA_object_types.h"
 #include "DNA_modifier_types.h"
 
-// #include "BLO_sys_types.h" /* needed for intptr_t used in ED_mesh.h */
-
-// #include "ED_mesh.h"
-
-
 #ifdef RNA_RUNTIME
 #include "BLI_math.h"
 
@@ -92,20 +87,20 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
 	case OB_SURF:
 
 		/* copies object and modifiers (but not the data) */
-		tmpobj= copy_object(ob);
+		tmpobj = copy_object(ob);
 		tmpcu = (Curve *)tmpobj->data;
 		tmpcu->id.us--;
 
 		/* if getting the original caged mesh, delete object modifiers */
-		if( cage )
+		if ( cage )
 			object_free_modifiers(tmpobj);
 
 		/* copies the data */
 		copycu = tmpobj->data = copy_curve( (Curve *) ob->data );
 
 		/* temporarily set edit so we get updates from edit mode, but
-		   also because for text datablocks copying it while in edit
-		   mode gives invalid data structures */
+		 * also because for text datablocks copying it while in edit
+		 * mode gives invalid data structures */
 		copycu->editfont = tmpcu->editfont;
 		copycu->editnurb = tmpcu->editnurb;
 
@@ -116,7 +111,7 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
 		copycu->editnurb = NULL;
 
 		nurbs_to_mesh( tmpobj );
-		
+
 		/* nurbs_to_mesh changes the type to a mesh, check it worked */
 		if (tmpobj->type != OB_MESH) {
 			free_libblock_us( &(G.main->object), tmpobj );
@@ -133,12 +128,12 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
 		/* todo, re-generatre for render-res */
 		/* metaball_polygonize(scene, ob) */
 
-		if(ob != basis_ob)
+		if (ob != basis_ob)
 			return NULL; /* only do basis metaball */
 
 		tmpmesh = add_mesh("Mesh");
 			
-		if(render) {
+		if (render) {
 			ListBase disp = {NULL, NULL};
 			makeDispListMBall_forRender(sce, ob, &disp);
 			mball_to_mesh(&disp, tmpmesh);
@@ -155,22 +150,23 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
 			/* copies the data */
 			tmpmesh = copy_mesh( ob->data );
 		/* if not getting the original caged mesh, get final derived mesh */
-		} else {
+		}
+		else {
 			/* Make a dummy mesh, saves copying */
 			DerivedMesh *dm;
 			/* CustomDataMask mask = CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL; */
 			CustomDataMask mask = CD_MASK_MESH; /* this seems more suitable, exporter,
-												   for example, needs CD_MASK_MDEFORMVERT */
+												 * for example, needs CD_MASK_MDEFORMVERT */
 			
 			/* Write the display mesh into the dummy mesh */
 			if (render)
-				dm = mesh_create_derived_render( sce, ob, mask );
+				dm = mesh_create_derived_render(sce, ob, mask);
 			else
-				dm = mesh_create_derived_view( sce, ob, mask );
+				dm = mesh_create_derived_view(sce, ob, mask);
 			
-			tmpmesh = add_mesh( "Mesh" );
-			DM_to_mesh( dm, tmpmesh );
-			dm->release( dm );
+			tmpmesh = add_mesh("Mesh");
+			DM_to_mesh(dm, tmpmesh, ob);
+			dm->release(dm);
 		}
 		
 		break;
@@ -184,11 +180,11 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
 	case OB_SURF:
 	case OB_FONT:
 	case OB_CURVE:
-		tmpmesh->totcol = tmpcu->totcol;		
+		tmpmesh->totcol = tmpcu->totcol;
 		
 		/* free old material list (if it exists) and adjust user counts */
-		if( tmpcu->mat ) {
-			for( i = tmpcu->totcol; i-- > 0; ) {
+		if ( tmpcu->mat ) {
+			for ( i = tmpcu->totcol; i-- > 0; ) {
 				/* are we an object material or data based? */
 
 				tmpmesh->mat[i] = ob->matbits[i] ? ob->mat[i] : tmpcu->mat[i];
@@ -207,8 +203,8 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
 		tmpmesh->totcol = tmpmb->totcol;
 		
 		/* free old material list (if it exists) and adjust user counts */
-		if( tmpmb->mat ) {
-			for( i = tmpmb->totcol; i-- > 0; ) {
+		if ( tmpmb->mat ) {
+			for ( i = tmpmb->totcol; i-- > 0; ) {
 				tmpmesh->mat[i] = tmpmb->mat[i]; /* CRASH HERE ??? */
 				if (tmpmesh->mat[i]) {
 					tmpmb->mat[i]->id.us++;
@@ -220,13 +216,13 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
 
 	case OB_MESH:
 		if (!cage) {
-			Mesh *origmesh= ob->data;
-			tmpmesh->flag= origmesh->flag;
+			Mesh *origmesh = ob->data;
+			tmpmesh->flag = origmesh->flag;
 			tmpmesh->mat = MEM_dupallocN(origmesh->mat);
 			tmpmesh->totcol = origmesh->totcol;
-			tmpmesh->smoothresh= origmesh->smoothresh;
-			if( origmesh->mat ) {
-				for( i = origmesh->totcol; i-- > 0; ) {
+			tmpmesh->smoothresh = origmesh->smoothresh;
+			if ( origmesh->mat ) {
+				for ( i = origmesh->totcol; i-- > 0; ) {
 					/* are we an object material or data based? */
 					tmpmesh->mat[i] = ob->matbits[i] ? ob->mat[i] : origmesh->mat[i];
 
@@ -239,11 +235,14 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_
 		break;
 	} /* end copy materials */
 
+	/* cycles and exporters rely on this still */
+	BKE_mesh_tessface_ensure(tmpmesh);
+
 	/* we don't assign it to anything */
 	tmpmesh->id.us--;
 	
 	/* make sure materials get updated in objects */
-	test_object_materials( ( ID * ) tmpmesh );
+	test_object_materials(&tmpmesh->id);
 
 	return tmpmesh;
 }
@@ -261,35 +260,35 @@ static void dupli_render_particle_set(Scene *scene, Object *ob, int level, int e
 
 	unit_m4(mat);
 
-	if(level >= MAX_DUPLI_RECUR)
+	if (level >= MAX_DUPLI_RECUR)
 		return;
 	
-	if(ob->transflag & OB_DUPLIPARTS) {
-		for(psys=ob->particlesystem.first; psys; psys=psys->next) {
-			if(ELEM(psys->part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
-				if(enable)
+	if (ob->transflag & OB_DUPLIPARTS) {
+		for (psys = ob->particlesystem.first; psys; psys = psys->next) {
+			if (ELEM(psys->part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
+				if (enable)
 					psys_render_set(ob, psys, mat, mat, 1, 1, 0.f);
 				else
 					psys_render_restore(ob, psys);
 			}
 		}
 
-		if(level == 0 && enable) {
+		if (level == 0 && 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 */
+			 * the derivedmesh must be created before init_render_mesh,
+			 * since object_duplilist does dupliparticles before that */
 			dm = mesh_create_derived_render(scene, ob, CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL);
 			dm->release(dm);
 
-			for(psys=ob->particlesystem.first; psys; psys=psys->next)
+			for (psys = ob->particlesystem.first; psys; psys = psys->next)
 				psys_get_modifier(ob, psys)->flag &= ~eParticleSystemFlag_psys_updated;
 		}
 	}
 
-	if(ob->dup_group==NULL) return;
-	group= ob->dup_group;
+	if (ob->dup_group == NULL) return;
+	group = ob->dup_group;
 
-	for(go= group->gobject.first; go; go= go->next)
+	for (go = group->gobject.first; go; go = go->next)
 		dupli_render_particle_set(scene, go->ob, level+1, enable);
 }
 /* When no longer needed, duplilist should be freed with Object.free_duplilist */
@@ -305,12 +304,12 @@ void rna_Object_create_duplilist(Object *ob, ReportList *reports, Scene *sce)
 		BKE_reportf(reports, RPT_WARNING, "Object.dupli_list has not been freed");
 
 		free_object_duplilist(ob->duplilist);
-		ob->duplilist= NULL;
+		ob->duplilist = NULL;
 	}
-	if(G.rendering)
+	if (G.rendering)
 		dupli_render_particle_set(sce, ob, 0, 1);
-	ob->duplilist= object_duplilist(sce, ob);
-	if(G.rendering)
+	ob->duplilist = object_duplilist(sce, ob);
+	if (G.rendering)
 		dupli_render_particle_set(sce, ob, 0, 0);
 	/* ob->duplilist should now be freed with Object.free_duplilist */
 }
@@ -319,16 +318,17 @@ void rna_Object_free_duplilist(Object *ob)
 {
 	if (ob->duplilist) {
 		free_object_duplilist(ob->duplilist);
-		ob->duplilist= NULL;
+		ob->duplilist = NULL;
 	}
 }
 
-static PointerRNA rna_Object_shape_key_add(Object *ob, bContext *C, ReportList *reports, const char *name, int from_mix)
+static PointerRNA rna_Object_shape_key_add(Object *ob, bContext *C, ReportList *reports,
+                                           const char *name, int from_mix)
 {
-	Scene *scene= CTX_data_scene(C);
-	KeyBlock *kb= NULL;
+	Scene *scene = CTX_data_scene(C);
+	KeyBlock *kb = NULL;
 
-	if((kb=object_insert_shape_key(scene, ob, name, from_mix))) {
+	if ((kb = object_insert_shape_key(scene, ob, name, from_mix))) {
 		PointerRNA keyptr;
 
 		RNA_pointer_create((ID *)ob->data, &RNA_ShapeKey, kb, &keyptr);
@@ -347,8 +347,9 @@ int rna_Object_is_visible(Object *ob, Scene *sce)
 	return !(ob->restrictflag & OB_RESTRICT_VIEW) && (ob->lay & sce->lay);
 }
 
-/*
-static void rna_Mesh_assign_verts_to_group(Object *ob, bDeformGroup *group, int *indices, int totindex, float weight, int assignmode)
+#if 0
+static void rna_Mesh_assign_verts_to_group(Object *ob, bDeformGroup *group, int *indices, int totindex,
+                                           float weight, int assignmode)
 {
 	if (ob->type != OB_MESH) {
 		BKE_report(reports, RPT_ERROR, "Object should be of MESH type");
@@ -367,13 +368,13 @@ static void rna_Mesh_assign_verts_to_group(Object *ob, bDeformGroup *group, int
 		return;
 	}
 
-	// makes a set of dVerts corresponding to the mVerts
-	if (!me->dvert) 
+	/* makes a set of dVerts corresponding to the mVerts */
+	if (!me->dvert)
 		create_dverts(&me->id);
 
-	// loop list adding verts to group 
-	for (i= 0; i < totindex; i++) {
-		if(i < 0 || i >= me->totvert) {
+	/* loop list adding verts to group  */
+	for (i = 0; i < totindex; i++) {
+		if (i < 0 || i >= me->totvert) {
 			BKE_report(reports, RPT_ERROR, "Bad vertex index in list");
 			return;
 		}
@@ -381,13 +382,15 @@ static void rna_Mesh_assign_verts_to_group(Object *ob, bDeformGroup *group, int
 		add_vert_defnr(ob, group_index, i, weight, assignmode);
 	}
 }
-*/
+#endif
 
-void rna_Object_ray_cast(Object *ob, ReportList *reports, float ray_start[3], float ray_end[3], float r_location[3], float r_normal[3], int *index)
+/* BMESH_TODO, return polygon index, not tessface */
+void rna_Object_ray_cast(Object *ob, ReportList *reports, float ray_start[3], float ray_end[3],
+                         float r_location[3], float r_normal[3], int *index)
 {
-	BVHTreeFromMesh treeData= {NULL};
+	BVHTreeFromMesh treeData = {NULL};
 	
-	if(ob->derivedFinal==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);
 		return;
 	}
@@ -395,7 +398,7 @@ void rna_Object_ray_cast(Object *ob, ReportList *reports, float ray_start[3], fl
 	/* no need to managing allocation or freeing of the BVH data. this is generated and freed as needed */
 	bvhtree_from_mesh_faces(&treeData, ob->derivedFinal, 0.0f, 4, 6);
 
-	if(treeData.tree==NULL) {
+	if (treeData.tree == NULL) {
 		BKE_reportf(reports, RPT_ERROR, "object \"%s\" could not create internal data for ray casting", ob->id.name+2);
 		return;
 	}
@@ -404,14 +407,15 @@ void rna_Object_ray_cast(Object *ob, ReportList *reports, float ray_start[3], fl
 		float ray_nor[3], dist;
 		sub_v3_v3v3(ray_nor, ray_end, ray_start);
 
-		dist= hit.dist = normalize_v3(ray_nor);
+		dist = hit.dist = normalize_v3(ray_nor);
 		hit.index = -1;
 		
-		if(BLI_bvhtree_ray_cast(treeData.tree, ray_start, ray_nor, 0.0f, &hit, treeData.raycast_callback, &treeData) != -1) {
-			if(hit.dist<=dist) {
+		if (BLI_bvhtree_ray_cast(treeData.tree, ray_start, ray_nor, 0.0f, &hit,
+		                         treeData.raycast_callback, &treeData) != -1) {
+			if (hit.dist <= dist) {
 				copy_v3_v3(r_location, hit.co);
 				copy_v3_v3(r_normal, hit.no);
-				*index= hit.index;
+				*index = hit.index;
 				return;
 			}
 		}
@@ -419,23 +423,26 @@ void rna_Object_ray_cast(Object *ob, ReportList *reports, float ray_start[3], fl
 
 	zero_v3(r_location);
 	zero_v3(r_normal);
-	*index= -1;
+	*index = -1;
 }
 
-void rna_Object_closest_point_on_mesh(Object *ob, ReportList *reports, float point_co[3], float max_dist, float n_location[3], float n_normal[3], int *index)
+void rna_Object_closest_point_on_mesh(Object *ob, ReportList *reports, float point_co[3], float max_dist,
+                                      float n_location[3], float n_normal[3], int *index)
 {
-	BVHTreeFromMesh treeData= {NULL};
+	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", ob->id.name+2);
+	if (ob->derivedFinal == NULL) {
+		BKE_reportf(reports, RPT_ERROR, "object \"%s\" has no mesh data to be used for finding nearest point",
+		            ob->id.name+2);
 		return;
 	}
 
 	/* no need to managing allocation or freeing of the BVH data. this is generated and freed as needed */
 	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", ob->id.name+2);
+	if (treeData.tree == NULL) {
+		BKE_reportf(reports, RPT_ERROR, "object \"%s\" could not create internal data for finding nearest point",
+		            ob->id.name+2);
 		return;
 	}
 	else {
@@ -444,24 +451,24 @@ void rna_Object_closest_point_on_mesh(Object *ob, ReportList *reports, float poi
 		nearest.index = -1;
 		nearest.dist = max_dist * max_dist;
 
-		if(BLI_bvhtree_find_nearest(treeData.tree, point_co, &nearest, treeData.nearest_callback, &treeData) != -1) {
+		if (BLI_bvhtree_find_nearest(treeData.tree, point_co, &nearest, treeData.nearest_callback, &treeData) != -1) {
 			copy_v3_v3(n_location, nearest.co);
 			copy_v3_v3(n_normal, nearest.no);
-			*index= nearest.index;
+			*index = nearest.index;
 			return;
 		}
 	}
 
 	zero_v3(n_location);
 	zero_v3(n_normal);
-	*index= -1;
+	*index = -1;
 }
 
 /* ObjectBase */
 
 void rna_ObjectBase_layers_from_view(Base *base, View3D *v3d)
 {
-	base->lay= base->object->lay= v3d->lay;
+	base->lay = base->object->lay = v3d->lay;
 }
 
 int rna_Object_is_modified(Object *ob, Scene *scene, int settings)
@@ -478,7 +485,7 @@ void rna_Object_dm_info(struct Object *ob, int type, char *result)
 
 	result[0] = '\0';
 
-	switch(type) {
+	switch (type) {
 		case 0:
 			if (ob->type == OB_MESH) {
 				dm = CDDM_from_mesh(ob->data, ob);
@@ -524,124 +531,129 @@ void RNA_api_object(StructRNA *srna)
 	static EnumPropertyItem mesh_dm_info_items[] = {
 		{0, "SOURCE", 0, "Source", "Source mesh"},
 		{1, "DEFORM", 0, "Deform", "Objects deform mesh"},
-	    {2, "FINAL", 0, "Final", "Objects final mesh"},
+		{2, "FINAL", 0, "Final", "Objects final mesh"},
 		{0, NULL, 0, NULL, NULL}
 	};
 #endif
 
 	/* mesh */
-	func= RNA_def_function(srna, "to_mesh", "rna_Object_to_mesh");
+	func = RNA_def_function(srna, "to_mesh", "rna_Object_to_mesh");
 	RNA_def_function_ui_description(func, "Create a Mesh datablock with modifiers applied");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
-	parm= RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate modifiers");
+	parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate modifiers");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
-	parm= RNA_def_boolean(func, "apply_modifiers", 0, "", "Apply modifiers");
+	parm = RNA_def_boolean(func, "apply_modifiers", 0, "", "Apply modifiers");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
+	parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh created from object, remove it if it is only used for export");
+	parm = RNA_def_pointer(func, "mesh", "Mesh", "",
+	                       "Mesh created from object, remove it if it is only used for export");
 	RNA_def_function_return(func, parm);
 
 	/* duplis */
-	func= RNA_def_function(srna, "dupli_list_create", "rna_Object_create_duplilist");
+	func = RNA_def_function(srna, "dupli_list_create", "rna_Object_create_duplilist");
 	RNA_def_function_ui_description(func, "Create a list of dupli objects for this object, needs to "
 	                                      "be freed manually with free_dupli_list to restore the "
 	                                      "objects real matrix and layers");
-	parm= RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate duplis");
+	parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate duplis");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 
-	func= RNA_def_function(srna, "dupli_list_clear", "rna_Object_free_duplilist");
+	func = RNA_def_function(srna, "dupli_list_clear", "rna_Object_free_duplilist");
 	RNA_def_function_ui_description(func, "Free the list of dupli objects");
 
 	/* Armature */
-	func= RNA_def_function(srna, "find_armature", "modifiers_isDeformedByArmature");
+	func = RNA_def_function(srna, "find_armature", "modifiers_isDeformedByArmature");
 	RNA_def_function_ui_description(func, "Find armature influencing this object as a parent or via a modifier");
-	parm= RNA_def_pointer(func, "ob_arm", "Object", "", "Armature object influencing this object or NULL");
+	parm = RNA_def_pointer(func, "ob_arm", "Object", "", "Armature object influencing this object or NULL");
 	RNA_def_function_return(func, parm);
 
 	/* Shape key */
-	func= RNA_def_function(srna, "shape_key_add", "rna_Object_shape_key_add");
+	func = RNA_def_function(srna, "shape_key_add", "rna_Object_shape_key_add");
 	RNA_def_function_ui_description(func, "Add shape key to an object");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
 	RNA_def_string(func, "name", "Key", 0, "", "Unique name for the new keylock"); /* optional */
 	RNA_def_boolean(func, "from_mix", 1, "", "Create new shape from existing mix of shapes");
-	parm= RNA_def_pointer(func, "key", "ShapeKey", "", "New shape keyblock");
+	parm = RNA_def_pointer(func, "key", "ShapeKey", "", "New shape keyblock");
 	RNA_def_property_flag(parm, PROP_RNAPTR);
 	RNA_def_function_return(func, parm);
 
 	/* Ray Cast */
-	func= RNA_def_function(srna, "ray_cast", "rna_Object_ray_cast");
+	func = RNA_def_function(srna, "ray_cast", "rna_Object_ray_cast");
 	RNA_def_function_ui_description(func, "Cast a ray onto in object space");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	
 	/* ray start and end */
-	parm= RNA_def_float_vector(func, "start", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
+	parm = RNA_def_float_vector(func, "start", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_float_vector(func, "end", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
+	parm = RNA_def_float_vector(func, "end", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
 	/* return location and normal */
-	parm= RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "The hit location of this ray cast", -1e4, 1e4);
+	parm = RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location",
+	                            "The hit location of this ray cast", -1e4, 1e4);
 	RNA_def_property_flag(parm, PROP_THICK_WRAP);
 	RNA_def_function_output(func, parm);
-	parm= RNA_def_float_vector(func, "normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal", "The face normal at the ray cast hit location", -1e4, 1e4);
+	parm = RNA_def_float_vector(func, "normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal",
+	                            "The face normal at the ray cast hit location", -1e4, 1e4);
 	RNA_def_property_flag(parm, PROP_THICK_WRAP);
 	RNA_def_function_output(func, parm);
 	
-	parm= RNA_def_int(func, "index", 0, 0, 0, "", "The face index, -1 when no intersection is found", 0, 0);
+	parm = RNA_def_int(func, "index", 0, 0, 0, "", "The face index, -1 when no intersection is found", 0, 0);
 	RNA_def_function_output(func, parm);
 
 	/* Nearest Point */
-	func= RNA_def_function(srna, "closest_point_on_mesh", "rna_Object_closest_point_on_mesh");
+	func = RNA_def_function(srna, "closest_point_on_mesh", "rna_Object_closest_point_on_mesh");
 	RNA_def_function_ui_description(func, "Find the nearest point on the object");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 
 	/* location of point for test and max distance */
-	parm= RNA_def_float_vector(func, "point", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
+	parm = RNA_def_float_vector(func, "point", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* default is sqrt(FLT_MAX) */
 	RNA_def_float(func, "max_dist", 1.844674352395373e+19, 0.0, FLT_MAX, "", "", 0.0, FLT_MAX);
 
 	/* return location and normal */
-	parm= RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "The location on the object closest to the point", -1e4, 1e4);
+	parm = RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location",
+	                            "The location on the object closest to the point", -1e4, 1e4);
 	RNA_def_property_flag(parm, PROP_THICK_WRAP);
 	RNA_def_function_output(func, parm);
-	parm= RNA_def_float_vector(func, "normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal", "The face normal at the closest point", -1e4, 1e4);
+	parm = RNA_def_float_vector(func, "normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal",
+	                            "The face normal at the closest point", -1e4, 1e4);
 	RNA_def_property_flag(parm, PROP_THICK_WRAP);
 	RNA_def_function_output(func, parm);
 
-	parm= RNA_def_int(func, "index", 0, 0, 0, "", "The face index, -1 when no closest point is found", 0, 0);
+	parm = RNA_def_int(func, "index", 0, 0, 0, "", "The face index, -1 when no closest point is found", 0, 0);
 	RNA_def_function_output(func, parm);
 
 	/* View */
-	func= RNA_def_function(srna, "is_visible", "rna_Object_is_visible");
+	func = RNA_def_function(srna, "is_visible", "rna_Object_is_visible");
 	RNA_def_function_ui_description(func, "Determine if object is visible in a given scene");
-	parm= RNA_def_pointer(func, "scene", "Scene", "", "");
+	parm = RNA_def_pointer(func, "scene", "Scene", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
-	parm= RNA_def_boolean(func, "result", 0, "", "Object visibility");
+	parm = RNA_def_boolean(func, "result", 0, "", "Object visibility");
 	RNA_def_function_return(func, parm);
 
 	/* utility function for checking if the object is modified */
-	func= RNA_def_function(srna, "is_modified", "rna_Object_is_modified");
+	func = RNA_def_function(srna, "is_modified", "rna_Object_is_modified");
 	RNA_def_function_ui_description(func, "Determine if this object is modified from the base mesh data");
-	parm= RNA_def_pointer(func, "scene", "Scene", "", "");
+	parm = RNA_def_pointer(func, "scene", "Scene", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
-	parm= RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
+	parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_boolean(func, "result", 0, "", "Object visibility");
+	parm = RNA_def_boolean(func, "result", 0, "", "Object visibility");
 	RNA_def_function_return(func, parm);
 
 
 #ifndef NDEBUG
 	/* mesh */
-	func= RNA_def_function(srna, "dm_info", "rna_Object_dm_info");
+	func = RNA_def_function(srna, "dm_info", "rna_Object_dm_info");
 	RNA_def_function_ui_description(func, "Returns a string for derived mesh data");
 
-	parm= RNA_def_enum(func, "type", mesh_dm_info_items, 0, "", "Modifier settings to apply");
+	parm = RNA_def_enum(func, "type", mesh_dm_info_items, 0, "", "Modifier settings to apply");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* weak!, no way to return dynamic string type */
-	parm= RNA_def_string(func, "result", "", 16384, "result", "");
+	parm = RNA_def_string(func, "result", "", 16384, "result", "");
 	RNA_def_property_flag(parm, PROP_THICK_WRAP); /* needed for string return value */
 	RNA_def_function_output(func, parm);
 #endif /* NDEBUG */
@@ -653,9 +665,10 @@ void RNA_api_object_base(StructRNA *srna)
 	FunctionRNA *func;
 	PropertyRNA *parm;
 
-	func= RNA_def_function(srna, "layers_from_view", "rna_ObjectBase_layers_from_view");
-	RNA_def_function_ui_description(func, "Sets the object layers from a 3D View (use when adding an object in local view)");
-	parm= RNA_def_pointer(func, "view", "SpaceView3D", "", "");
+	func = RNA_def_function(srna, "layers_from_view", "rna_ObjectBase_layers_from_view");
+	RNA_def_function_ui_description(func,
+	                                "Sets the object layers from a 3D View (use when adding an object in local view)");
+	parm = RNA_def_pointer(func, "view", "SpaceView3D", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 }
 
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index 2997acd..c52b625 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -105,7 +105,7 @@ static void rna_Cache_change(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerR
 	PTCacheID *pid = NULL;
 	ListBase pidlist;
 
-	if(!ob)
+	if (!ob)
 		return;
 
 	cache->flag |= PTCACHE_OUTDATED;
@@ -114,14 +114,14 @@ static void rna_Cache_change(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerR
 
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 
-	for(pid=pidlist.first; pid; pid=pid->next) {
-		if(pid->cache==cache)
+	for (pid = pidlist.first; pid; pid = pid->next) {
+		if (pid->cache == cache)
 			break;
 	}
 
-	if(pid) {
+	if (pid) {
 		/* Just make sure this wasn't changed. */
-		if(pid->type == PTCACHE_TYPE_SMOKE_DOMAIN)
+		if (pid->type == PTCACHE_TYPE_SMOKE_DOMAIN)
 			cache->step = 1;
 		BKE_ptcache_update_info(pid);
 	}
@@ -136,18 +136,18 @@ static void rna_Cache_toggle_disk_cache(Main *UNUSED(bmain), Scene *UNUSED(scene
 	PTCacheID *pid = NULL;
 	ListBase pidlist;
 
-	if(!ob)
+	if (!ob)
 		return;
 
 	BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
 
-	for(pid=pidlist.first; pid; pid=pid->next) {
-		if(pid->cache==cache)
+	for (pid = pidlist.first; pid; pid = pid->next) {
+		if (pid->cache == cache)
 			break;
 	}
 
 	/* smoke can only use disk cache */
-	if(pid && pid->type != PTCACHE_TYPE_SMOKE_DOMAIN)
+	if (pid && pid->type != PTCACHE_TYPE_SMOKE_DOMAIN)
 		BKE_ptcache_toggle_disk_cache(pid);
 	else
 		cache->flag ^= PTCACHE_DISK_CACHE;
@@ -159,24 +159,24 @@ static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), P
 {
 	Object *ob = (Object*)ptr->id.data;
 	PointCache *cache = (PointCache*)ptr->data;
-	PTCacheID *pid = NULL, *pid2= NULL;
+	PTCacheID *pid = NULL, *pid2 = NULL;
 	ListBase pidlist;
 	int new_name = 1;
 
-	if(!ob)
+	if (!ob)
 		return;
 
 	/* TODO: check for proper characters */
 
 	BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
 
-	if(cache->flag & PTCACHE_EXTERNAL) {
-		for(pid=pidlist.first; pid; pid=pid->next) {
-			if(pid->cache==cache)
+	if (cache->flag & PTCACHE_EXTERNAL) {
+		for (pid = pidlist.first; pid; pid = pid->next) {
+			if (pid->cache == cache)
 				break;
 		}
 
-		if(!pid)
+		if (!pid)
 			return;
 
 		BKE_ptcache_load_external(pid);
@@ -184,18 +184,18 @@ static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), P
 		DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 	}
 	else {
-		for(pid=pidlist.first; pid; pid=pid->next) {
-			if(pid->cache==cache)
+		for (pid = pidlist.first; pid; pid = pid->next) {
+			if (pid->cache == cache)
 				pid2 = pid;
-			else if(cache->name[0] != '\0' && strcmp(cache->name,pid->cache->name)==0) {
+			else if (cache->name[0] != '\0' && strcmp(cache->name,pid->cache->name) == 0) {
 				/*TODO: report "name exists" to user */
 				BLI_strncpy(cache->name, cache->prev_name, sizeof(cache->name));
 				new_name = 0;
 			}
 		}
 
-		if(new_name) {
-			if(pid2 && cache->flag & PTCACHE_DISK_CACHE) {
+		if (new_name) {
+			if (pid2 && cache->flag & PTCACHE_DISK_CACHE) {
 				char old_name[80];
 				char new_name[80];
 
@@ -214,33 +214,33 @@ static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), P
 
 static void rna_Cache_list_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	PointCache *cache= ptr->data;
+	PointCache *cache = ptr->data;
 	ListBase lb;
 
-	while(cache->prev)
-		cache= cache->prev;
+	while (cache->prev)
+		cache = cache->prev;
 
-	lb.first= cache;
-	lb.last= NULL; /* not used by listbase_begin */
+	lb.first = cache;
+	lb.last = NULL; /* not used by listbase_begin */
 
 	rna_iterator_listbase_begin(iter, &lb, NULL);
 }
-static void rna_Cache_active_point_cache_index_range(PointerRNA *ptr, int *min, int *max)
+static void rna_Cache_active_point_cache_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
 {
 	Object *ob = ptr->id.data;
-	PointCache *cache= ptr->data;
+	PointCache *cache = ptr->data;
 	PTCacheID *pid;
 	ListBase pidlist;
 
 	BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
 	
-	*min= 0;
-	*max= 0;
+	*min = 0;
+	*max = 0;
 
-	for(pid=pidlist.first; pid; pid=pid->next) {
-		if(pid->cache == cache) {
-			*max= BLI_countlist(pid->ptcaches)-1;
-			*max= MAX2(0, *max);
+	for (pid = pidlist.first; pid; pid = pid->next) {
+		if (pid->cache == cache) {
+			*max = BLI_countlist(pid->ptcaches)-1;
+			*max = MAX2(0, *max);
 			break;
 		}
 	}
@@ -251,15 +251,15 @@ static void rna_Cache_active_point_cache_index_range(PointerRNA *ptr, int *min,
 static int rna_Cache_active_point_cache_index_get(PointerRNA *ptr)
 {
 	Object *ob = ptr->id.data;
-	PointCache *cache= ptr->data;
+	PointCache *cache = ptr->data;
 	PTCacheID *pid;
 	ListBase pidlist;
 	int num = 0;
 
 	BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
 	
-	for(pid=pidlist.first; pid; pid=pid->next) {
-		if(pid->cache == cache) {
+	for (pid = pidlist.first; pid; pid = pid->next) {
+		if (pid->cache == cache) {
 			num = BLI_findindex(pid->ptcaches, cache);
 			break;
 		}
@@ -273,14 +273,14 @@ static int rna_Cache_active_point_cache_index_get(PointerRNA *ptr)
 static void rna_Cache_active_point_cache_index_set(struct PointerRNA *ptr, int value)
 {
 	Object *ob = ptr->id.data;
-	PointCache *cache= ptr->data;
+	PointCache *cache = ptr->data;
 	PTCacheID *pid;
 	ListBase pidlist;
 
 	BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
 	
-	for(pid=pidlist.first; pid; pid=pid->next) {
-		if(pid->cache == cache) {
+	for (pid = pidlist.first; pid; pid = pid->next) {
+		if (pid->cache == cache) {
 			*(pid->cache_ptr) = BLI_findlink(pid->ptcaches, value);
 			break;
 		}
@@ -289,21 +289,21 @@ static void rna_Cache_active_point_cache_index_set(struct PointerRNA *ptr, int v
 	BLI_freelistN(&pidlist);
 }
 
-static void rna_PointCache_frame_step_range(PointerRNA *ptr, int *min, int *max)
+static void rna_PointCache_frame_step_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
 {
 	Object *ob = ptr->id.data;
-	PointCache *cache= ptr->data;
+	PointCache *cache = ptr->data;
 	PTCacheID *pid;
 	ListBase pidlist;
 
-	*min= 1;
-	*max= 20;
+	*min = 1;
+	*max = 20;
 
 	BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
 	
-	for(pid=pidlist.first; pid; pid=pid->next) {
-		if(pid->cache == cache) {
-			*max= pid->max_step;
+	for (pid = pidlist.first; pid; pid = pid->next) {
+		if (pid->cache == cache) {
+			*max = pid->max_step;
 			break;
 		}
 	}
@@ -315,10 +315,10 @@ static char *rna_CollisionSettings_path(PointerRNA *UNUSED(ptr))
 {
 	/* both methods work ok, but return the shorter path */
 #if 0
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 	ModifierData *md = (ModifierData *)modifiers_findByType(ob, eModifierType_Collision);
 
-	if(md) {
+	if (md) {
 		return BLI_sprintfN("modifiers[\"%s\"].settings", md->name);
 	}
 	else {
@@ -332,59 +332,59 @@ static char *rna_CollisionSettings_path(PointerRNA *UNUSED(ptr))
 
 static int rna_SoftBodySettings_use_edges_get(PointerRNA *ptr)
 {
-	Object *data= (Object*)(ptr->id.data);
+	Object *data = (Object*)(ptr->id.data);
 	return (((data->softflag) & OB_SB_EDGES) != 0);
 }
 
 static void rna_SoftBodySettings_use_edges_set(PointerRNA *ptr, int value)
 {
-	Object *data= (Object*)(ptr->id.data);
-	if(value) data->softflag |= OB_SB_EDGES;
+	Object *data = (Object*)(ptr->id.data);
+	if (value) data->softflag |= OB_SB_EDGES;
 	else data->softflag &= ~OB_SB_EDGES;
 }
 
 static int rna_SoftBodySettings_use_goal_get(PointerRNA *ptr)
 {
-	Object *data= (Object*)(ptr->id.data);
+	Object *data = (Object*)(ptr->id.data);
 	return (((data->softflag) & OB_SB_GOAL) != 0);
 }
 
 static void rna_SoftBodySettings_use_goal_set(PointerRNA *ptr, int value)
 {
-	Object *data= (Object*)(ptr->id.data);
-	if(value) data->softflag |= OB_SB_GOAL;
+	Object *data = (Object*)(ptr->id.data);
+	if (value) data->softflag |= OB_SB_GOAL;
 	else data->softflag &= ~OB_SB_GOAL;
 }
 
 static int rna_SoftBodySettings_stiff_quads_get(PointerRNA *ptr)
 {
-	Object *data= (Object*)(ptr->id.data);
+	Object *data = (Object*)(ptr->id.data);
 	return (((data->softflag) & OB_SB_QUADS) != 0);
 }
 
 static void rna_SoftBodySettings_stiff_quads_set(PointerRNA *ptr, int value)
 {
-	Object *data= (Object*)(ptr->id.data);
-	if(value) data->softflag |= OB_SB_QUADS;
+	Object *data = (Object*)(ptr->id.data);
+	if (value) data->softflag |= OB_SB_QUADS;
 	else data->softflag &= ~OB_SB_QUADS;
 }
 
 static int rna_SoftBodySettings_self_collision_get(PointerRNA *ptr)
 {
-	Object *data= (Object*)(ptr->id.data);
+	Object *data = (Object*)(ptr->id.data);
 	return (((data->softflag) & OB_SB_SELF) != 0);
 }
 
 static void rna_SoftBodySettings_self_collision_set(PointerRNA *ptr, int value)
 {
-	Object *data= (Object*)(ptr->id.data);
-	if(value) data->softflag |= OB_SB_SELF;
+	Object *data = (Object*)(ptr->id.data);
+	if (value) data->softflag |= OB_SB_SELF;
 	else data->softflag &= ~OB_SB_SELF;
 }
 
 static int rna_SoftBodySettings_new_aero_get(PointerRNA *ptr)
 {
-	Object *data= (Object*)(ptr->id.data);
+	Object *data = (Object*)(ptr->id.data);
 	if (data->softflag & OB_SB_AERO_ANGLE)
 		return 1;
 	else
@@ -393,7 +393,7 @@ static int rna_SoftBodySettings_new_aero_get(PointerRNA *ptr)
 
 static void rna_SoftBodySettings_new_aero_set(PointerRNA *ptr, int value)
 {
-	Object *data= (Object*)(ptr->id.data);
+	Object *data = (Object*)(ptr->id.data);
 	if (value == 1)
 		data->softflag |= OB_SB_AERO_ANGLE;
 	else	/* value == 0 */
@@ -402,64 +402,64 @@ static void rna_SoftBodySettings_new_aero_set(PointerRNA *ptr, int value)
 
 static int rna_SoftBodySettings_face_collision_get(PointerRNA *ptr)
 {
-	Object *data= (Object*)(ptr->id.data);
+	Object *data = (Object*)(ptr->id.data);
 	return (((data->softflag) & OB_SB_FACECOLL) != 0);
 }
 
 static void rna_SoftBodySettings_face_collision_set(PointerRNA *ptr, int value)
 {
-	Object *data= (Object*)(ptr->id.data);
-	if(value) data->softflag |= OB_SB_FACECOLL;
+	Object *data = (Object*)(ptr->id.data);
+	if (value) data->softflag |= OB_SB_FACECOLL;
 	else data->softflag &= ~OB_SB_FACECOLL;
 }
 
 static int rna_SoftBodySettings_edge_collision_get(PointerRNA *ptr)
 {
-	Object *data= (Object*)(ptr->id.data);
+	Object *data = (Object*)(ptr->id.data);
 	return (((data->softflag) & OB_SB_EDGECOLL) != 0);
 }
 
 static void rna_SoftBodySettings_edge_collision_set(PointerRNA *ptr, int value)
 {
-	Object *data= (Object*)(ptr->id.data);
-	if(value) data->softflag |= OB_SB_EDGECOLL;
+	Object *data = (Object*)(ptr->id.data);
+	if (value) data->softflag |= OB_SB_EDGECOLL;
 	else data->softflag &= ~OB_SB_EDGECOLL;
 }
 
 static void rna_SoftBodySettings_goal_vgroup_get(PointerRNA *ptr, char *value)
 {
-	SoftBody *sb= (SoftBody*)ptr->data;
+	SoftBody *sb = (SoftBody*)ptr->data;
 	rna_object_vgroup_name_index_get(ptr, value, sb->vertgroup);
 }
 
 static int rna_SoftBodySettings_goal_vgroup_length(PointerRNA *ptr)
 {
-	SoftBody *sb= (SoftBody*)ptr->data;
+	SoftBody *sb = (SoftBody*)ptr->data;
 	return rna_object_vgroup_name_index_length(ptr, sb->vertgroup);
 }
 
 static void rna_SoftBodySettings_goal_vgroup_set(PointerRNA *ptr, const char *value)
 {
-	SoftBody *sb= (SoftBody*)ptr->data;
+	SoftBody *sb = (SoftBody*)ptr->data;
 	rna_object_vgroup_name_index_set(ptr, value, &sb->vertgroup);
 }
 
 static void rna_SoftBodySettings_mass_vgroup_set(PointerRNA *ptr, const char *value)
 {
-	SoftBody *sb= (SoftBody*)ptr->data;
+	SoftBody *sb = (SoftBody*)ptr->data;
 	rna_object_vgroup_name_set(ptr, value, sb->namedVG_Mass, sizeof(sb->namedVG_Mass));
 }
 
 static void rna_SoftBodySettings_spring_vgroup_set(PointerRNA *ptr, const char *value)
 {
-	SoftBody *sb= (SoftBody*)ptr->data;
+	SoftBody *sb = (SoftBody*)ptr->data;
 	rna_object_vgroup_name_set(ptr, value, sb->namedVG_Spring_K, sizeof(sb->namedVG_Spring_K));
 }
 
 
 static char *rna_SoftBodySettings_path(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 	ModifierData *md = (ModifierData *)modifiers_findByType(ob, eModifierType_Softbody);
 	
 	return BLI_sprintfN("modifiers[\"%s\"].settings", md->name);
@@ -467,24 +467,24 @@ static char *rna_SoftBodySettings_path(PointerRNA *ptr)
 
 static int particle_id_check(PointerRNA *ptr)
 {
-	ID *id= ptr->id.data;
+	ID *id = ptr->id.data;
 
 	return (GS(id->name) == ID_PA);
 }
 
 static void rna_FieldSettings_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	if(particle_id_check(ptr)) {
+	if (particle_id_check(ptr)) {
 		ParticleSettings *part = (ParticleSettings*)ptr->id.data;
 
-		if(part->pd->forcefield != PFIELD_TEXTURE && part->pd->tex) {
+		if (part->pd->forcefield != PFIELD_TEXTURE && part->pd->tex) {
 			part->pd->tex->id.us--;
-			part->pd->tex= NULL;
+			part->pd->tex = NULL;
 		}
 
-		if(part->pd2->forcefield != PFIELD_TEXTURE && part->pd2->tex) {
+		if (part->pd2->forcefield != PFIELD_TEXTURE && part->pd2->tex) {
 			part->pd2->tex->id.us--;
-			part->pd2->tex= NULL;
+			part->pd2->tex = NULL;
 		}
 
 		DAG_id_tag_update(&part->id, OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME|PSYS_RECALC_RESET);
@@ -494,9 +494,9 @@ static void rna_FieldSettings_update(Main *UNUSED(bmain), Scene *UNUSED(scene),
 	else {
 		Object *ob = (Object*)ptr->id.data;
 
-		if(ob->pd->forcefield != PFIELD_TEXTURE && ob->pd->tex) {
+		if (ob->pd->forcefield != PFIELD_TEXTURE && ob->pd->tex) {
 			ob->pd->tex->id.us--;
-			ob->pd->tex= NULL;
+			ob->pd->tex = NULL;
 		}
 
 		DAG_id_tag_update(&ob->id, OB_RECALC_OB);
@@ -506,19 +506,19 @@ static void rna_FieldSettings_update(Main *UNUSED(bmain), Scene *UNUSED(scene),
 
 static void rna_FieldSettings_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	if(!particle_id_check(ptr)) {
-		Object *ob= (Object*)ptr->id.data;
-		PartDeflect *pd= ob->pd;
-		ModifierData *md= modifiers_findByType(ob, eModifierType_Surface);
+	if (!particle_id_check(ptr)) {
+		Object *ob = (Object*)ptr->id.data;
+		PartDeflect *pd = ob->pd;
+		ModifierData *md = modifiers_findByType(ob, eModifierType_Surface);
 
 		/* add/remove modifier as needed */
-		if(!md) {
-			if(pd && (pd->shape == PFIELD_SHAPE_SURFACE) && ELEM(pd->forcefield,PFIELD_GUIDE,PFIELD_TEXTURE)==0)
-				if(ELEM4(ob->type, OB_MESH, OB_SURF, OB_FONT, OB_CURVE))
+		if (!md) {
+			if (pd && (pd->shape == PFIELD_SHAPE_SURFACE) && ELEM(pd->forcefield,PFIELD_GUIDE,PFIELD_TEXTURE) == 0)
+				if (ELEM4(ob->type, OB_MESH, OB_SURF, OB_FONT, OB_CURVE))
 					ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Surface);
 		}
 		else {
-			if(!pd || pd->shape != PFIELD_SHAPE_SURFACE)
+			if (!pd || pd->shape != PFIELD_SHAPE_SURFACE)
 				ED_object_modifier_remove(NULL, bmain, scene, ob, md);
 		}
 
@@ -528,24 +528,26 @@ static void rna_FieldSettings_shape_update(Main *bmain, Scene *scene, PointerRNA
 
 static void rna_FieldSettings_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	if(particle_id_check(ptr)) {
+	if (particle_id_check(ptr)) {
 		DAG_id_tag_update((ID*)ptr->id.data, OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME|PSYS_RECALC_RESET);
 	}
 	else {
-		Object *ob= (Object*)ptr->id.data;
+		Object *ob = (Object*)ptr->id.data;
 
 		/* do this before scene sort, that one checks for CU_PATH */
-		/* XXX if(ob->type==OB_CURVE && ob->pd->forcefield==PFIELD_GUIDE) {
-			Curve *cu= ob->data;
+#if 0 /* XXX */
+		if (ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE) {
+			Curve *cu = ob->data;
 			cu->flag |= (CU_PATH|CU_3D);
-			do_curvebuts(B_CU3D);  // all curves too
-		}*/
+			do_curvebuts(B_CU3D);  /* all curves too */
+		}
+#endif
 
 		rna_FieldSettings_shape_update(bmain, scene, ptr);
 
 		DAG_scene_sort(bmain, scene);
 
-		if(ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE)
+		if (ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE)
 			DAG_id_tag_update(&ob->id, OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME);
 		else
 			DAG_id_tag_update(&ob->id, OB_RECALC_OB);
@@ -560,7 +562,7 @@ static char *rna_FieldSettings_path(PointerRNA *ptr)
 	
 	/* Check through all possible places the settings can be to find the right one */
 	
-	if(particle_id_check(ptr)) {
+	if (particle_id_check(ptr)) {
 		/* particle system force field */
 		ParticleSettings *part = (ParticleSettings*)ptr->id.data;
 		
@@ -568,9 +570,10 @@ static char *rna_FieldSettings_path(PointerRNA *ptr)
 			return BLI_sprintfN("force_field_1");
 		else if (part->pd2 == pd)
 			return BLI_sprintfN("force_field_2");
-	} else {
+	}
+	else {
 		/* object force field */
-		Object *ob= (Object*)ptr->id.data;
+		Object *ob = (Object*)ptr->id.data;
 		
 		if (ob->pd == pd)
 			return BLI_sprintfN("field");
@@ -599,14 +602,15 @@ static char *rna_EffectorWeight_path(PointerRNA *ptr)
 	EffectorWeights *ew = (EffectorWeights *)ptr->data;
 	/* Check through all possible places the settings can be to find the right one */
 	
-	if(particle_id_check(ptr)) {
+	if (particle_id_check(ptr)) {
 		/* particle effector weights */
 		ParticleSettings *part = (ParticleSettings*)ptr->id.data;
 		
 		if (part->effector_weights == ew)
 			return BLI_sprintfN("effector_weights");
-	} else {
-		Object *ob= (Object*)ptr->id.data;
+	}
+	else {
+		Object *ob = (Object*)ptr->id.data;
 		ModifierData *md;
 		
 		/* check softbody modifier */
@@ -643,10 +647,10 @@ static char *rna_EffectorWeight_path(PointerRNA *ptr)
 			if (pmd->canvas) {
 				DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
 
-				for(; surface; surface=surface->next) {
+				for (; surface; surface = surface->next) {
 					if (surface->effector_weights == ew)
-						return BLI_sprintfN("modifiers[\"%s\"].canvas_settings.canvas_surfaces[\"%s\"].effector_weights",
-							md->name, surface->name);
+						return BLI_sprintfN("modifiers[\"%s\"].canvas_settings.canvas_surfaces[\"%s\"]"
+						                    ".effector_weights", md->name, surface->name);
 				}
 			}
 		}
@@ -656,13 +660,13 @@ static char *rna_EffectorWeight_path(PointerRNA *ptr)
 
 static void rna_CollisionSettings_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
-	ModifierData *md= modifiers_findByType(ob, eModifierType_Collision);
+	Object *ob = (Object*)ptr->id.data;
+	ModifierData *md = modifiers_findByType(ob, eModifierType_Collision);
 
 	/* add/remove modifier as needed */
-	if(ob->pd->deflect && !md)
+	if (ob->pd->deflect && !md)
 		ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Collision);
-	else if(!ob->pd->deflect && md)
+	else if (!ob->pd->deflect && md)
 		ED_object_modifier_remove(NULL, bmain, scene, ob, md);
 
 	WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob);
@@ -670,7 +674,7 @@ static void rna_CollisionSettings_dependency_update(Main *bmain, Scene *scene, P
 
 static void rna_CollisionSettings_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 
 	DAG_id_tag_update(&ob->id, OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME);
 	WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob);
@@ -678,7 +682,7 @@ static void rna_CollisionSettings_update(Main *UNUSED(bmain), Scene *UNUSED(scen
 
 static void rna_softbody_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
+	Object *ob = (Object*)ptr->id.data;
 
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 	WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob);
@@ -688,27 +692,27 @@ static void rna_softbody_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Point
 static EnumPropertyItem *rna_Effector_shape_itemf(bContext *UNUSED(C), PointerRNA *ptr,
                                                   PropertyRNA *UNUSED(prop), int *UNUSED(free))
 {
-	Object *ob= NULL;
+	Object *ob = NULL;
 
-	if(particle_id_check(ptr))
+	if (particle_id_check(ptr))
 		return empty_shape_items;
 	
-	ob= (Object*)ptr->id.data;
+	ob = (Object*)ptr->id.data;
 	
-	if(ob->type == OB_CURVE) {
-		if(ob->pd->forcefield == PFIELD_VORTEX)
+	if (ob->type == OB_CURVE) {
+		if (ob->pd->forcefield == PFIELD_VORTEX)
 			return curve_vortex_shape_items;
 
 		return curve_shape_items;
 	}
-	else if(ELEM3(ob->type, OB_MESH, OB_SURF, OB_FONT)) {
-		if(ob->pd->forcefield == PFIELD_VORTEX)
+	else if (ELEM3(ob->type, OB_MESH, OB_SURF, OB_FONT)) {
+		if (ob->pd->forcefield == PFIELD_VORTEX)
 			return vortex_shape_items;
 
 		return effector_shape_items;
 	}
 	else {
-		if(ob->pd->forcefield == PFIELD_VORTEX)
+		if (ob->pd->forcefield == PFIELD_VORTEX)
 			return empty_vortex_shape_items;
 
 		return empty_shape_items;
@@ -723,16 +727,17 @@ static void rna_def_ptcache_point_caches(BlenderRNA *brna, PropertyRNA *cprop)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	// FunctionRNA *func;
-	// PropertyRNA *parm;
+	/* FunctionRNA *func; */
+	/* PropertyRNA *parm; */
 
 	RNA_def_property_srna(cprop, "PointCaches");
-	srna= RNA_def_struct(brna, "PointCaches", NULL);
+	srna = RNA_def_struct(brna, "PointCaches", NULL);
 	RNA_def_struct_sdna(srna, "PointCache");
 	RNA_def_struct_ui_text(srna, "Point Caches", "Collection of point caches");
 
-	prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
-	RNA_def_property_int_funcs(prop, "rna_Cache_active_point_cache_index_get", "rna_Cache_active_point_cache_index_set",
+	prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_int_funcs(prop, "rna_Cache_active_point_cache_index_get",
+	                           "rna_Cache_active_point_cache_index_set",
 	                           "rna_Cache_active_point_cache_index_range");
 	RNA_def_property_ui_text(prop, "Active Point Cache Index", "");
 	RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change");
@@ -749,94 +754,95 @@ static void rna_def_pointcache(BlenderRNA *brna)
 		{PTCACHE_COMPRESS_LZMA, "HEAVY", 0, "Heavy", "Effective but slow compression"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "PointCache", NULL);
+	srna = RNA_def_struct(brna, "PointCache", NULL);
 	RNA_def_struct_ui_text(srna, "Point Cache", "Point cache for physics simulations");
 	RNA_def_struct_ui_icon(srna, ICON_PHYSICS);
 	
-	prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "startframe");
 	RNA_def_property_range(prop, 1, MAXFRAME);
 	RNA_def_property_ui_text(prop, "Start", "Frame on which the simulation starts");
 	
-	prop= RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "endframe");
 	RNA_def_property_range(prop, 1, MAXFRAME);
 	RNA_def_property_ui_text(prop, "End", "Frame on which the simulation stops");
 
-	prop= RNA_def_property(srna, "frame_step", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_step", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "step");
 	RNA_def_property_range(prop, 1, 20);
 	RNA_def_property_int_funcs(prop, NULL, NULL, "rna_PointCache_frame_step_range");
 	RNA_def_property_ui_text(prop, "Cache Step", "Number of frames between cached frames");
 	RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change");
 
-	prop= RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "index");
 	RNA_def_property_range(prop, -1, 100);
 	RNA_def_property_ui_text(prop, "Cache Index", "Index number of cache files");
 	RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
 
-	prop= RNA_def_property(srna, "compression", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "compression", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, point_cache_compress_items);
 	RNA_def_property_ui_text(prop, "Cache Compression", "Compression method to be used");
 
 	/* flags */
-	prop= RNA_def_property(srna, "is_baked", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_baked", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_BAKED);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "is_baking", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_baking", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_BAKING);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_disk_cache", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_disk_cache", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_DISK_CACHE);
 	RNA_def_property_ui_text(prop, "Disk Cache", "Save cache files to disk (.blend file must be saved first)");
 	RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_toggle_disk_cache");
 
-	prop= RNA_def_property(srna, "is_outdated", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_outdated", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_OUTDATED);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Cache is outdated", "");
 
-	prop= RNA_def_property(srna, "frames_skipped", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "frames_skipped", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_FRAMES_SKIPPED);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "name");
 	RNA_def_property_ui_text(prop, "Name", "Cache name");
 	RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
 	RNA_def_struct_name_property(srna, prop);
 
-	prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_DIRPATH);
+	prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_DIRPATH);
 	RNA_def_property_string_sdna(prop, NULL, "path");
 	RNA_def_property_ui_text(prop, "File Path", "Cache file path");
 	RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
 
-	prop= RNA_def_property(srna, "use_quick_cache", PROP_BOOLEAN, PROP_NONE);
+	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");
 
-	prop= RNA_def_property(srna, "info", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "info", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "info");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Cache Info", "Info on current cache status");
 
-	prop= RNA_def_property(srna, "use_external", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_external", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_EXTERNAL);
 	RNA_def_property_ui_text(prop, "External", "Read cache from an external location");
 	RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
 
-	prop= RNA_def_property(srna, "use_library_path", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_library_path", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PTCACHE_IGNORE_LIBPATH);
 	RNA_def_property_ui_text(prop, "Library Path", "Use this files path when library linked into another file");
 	RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
 
-	prop= RNA_def_property(srna, "point_caches", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "point_caches", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_funcs(prop, "rna_Cache_list_begin", "rna_iterator_listbase_next",
-	                                  "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL);
+	                                  "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+	                                  NULL, NULL, NULL, NULL);
 	RNA_def_property_struct_type(prop, "PointCache");
 	RNA_def_property_ui_text(prop, "Point Cache List", "Point cache list");
 	rna_def_ptcache_point_caches(brna, prop);
@@ -847,54 +853,54 @@ static void rna_def_collision(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "CollisionSettings", NULL);
+	srna = RNA_def_struct(brna, "CollisionSettings", NULL);
 	RNA_def_struct_sdna(srna, "PartDeflect");
 	RNA_def_struct_path_func(srna, "rna_CollisionSettings_path");
 	RNA_def_struct_ui_text(srna, "Collision Settings", "Collision settings for object in physics simulation");
 	
-	prop= RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "deflect", 1);
 	RNA_def_property_ui_text(prop, "Enabled", "Enable this objects as a collider for physics systems");
 	RNA_def_property_update(prop, 0, "rna_CollisionSettings_dependency_update");
 	
 	/* Particle Interaction */
 	
-	prop= RNA_def_property(srna, "damping_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "damping_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "pdef_damp");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Damping Factor", "Amount of damping during particle collision");
 	RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
 	
-	prop= RNA_def_property(srna, "damping_random", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "damping_random", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "pdef_rdamp");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Random Damping", "Random variation of damping");
 	RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
 	
-	prop= RNA_def_property(srna, "friction_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "friction_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "pdef_frict");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Friction Factor", "Amount of friction during particle collision");
 	RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
 	
-	prop= RNA_def_property(srna, "friction_random", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "friction_random", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "pdef_rfrict");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Random Friction", "Random variation of friction");
 	RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
 		
-	prop= RNA_def_property(srna, "permeability", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "permeability", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "pdef_perm");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Permeability", "Chance that the particle will pass through the mesh");
 	RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
 	
-	prop= RNA_def_property(srna, "use_particle_kill", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_particle_kill", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PDEFLE_KILL_PART);
 	RNA_def_property_ui_text(prop, "Kill Particles", "Kill collided particles");
 	RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
 
-	prop= RNA_def_property(srna, "stickness", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "stickness", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "pdef_stickness");
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Stickness", "Amount of stickness to surface collision");
@@ -902,25 +908,25 @@ static void rna_def_collision(BlenderRNA *brna)
 	
 	/* Soft Body and Cloth Interaction */
 	
-	prop= RNA_def_property(srna, "thickness_inner", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "thickness_inner", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "pdef_sbift");
 	RNA_def_property_range(prop, 0.001f, 1.0f);
 	RNA_def_property_ui_text(prop, "Inner Thickness", "Inner face thickness");
 	RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
 	
-	prop= RNA_def_property(srna, "thickness_outer", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "thickness_outer", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "pdef_sboft");
 	RNA_def_property_range(prop, 0.001f, 1.0f);
 	RNA_def_property_ui_text(prop, "Outer Thickness", "Outer face thickness");
 	RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
 	
-	prop= RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "pdef_sbdamp");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Damping", "Amount of damping during collision");
 	RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
 
-	prop= RNA_def_property(srna, "absorption", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "absorption", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 2);
 	RNA_def_property_ui_text(prop, "Absorption",
@@ -933,25 +939,25 @@ static void rna_def_effector_weight(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "EffectorWeights", NULL);
+	srna = RNA_def_struct(brna, "EffectorWeights", NULL);
 	RNA_def_struct_sdna(srna, "EffectorWeights");
 	RNA_def_struct_path_func(srna, "rna_EffectorWeight_path");
 	RNA_def_struct_ui_text(srna, "Effector Weights", "Effector weights for physics simulation");
 	RNA_def_struct_ui_icon(srna, ICON_PHYSICS);
 
 	/* Flags */
-	prop= RNA_def_property(srna, "apply_to_hair_growing", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "apply_to_hair_growing", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", EFF_WEIGHT_DO_HAIR);
 	RNA_def_property_ui_text(prop, "Use For Growing Hair", "Use force fields when growing hair");
 	RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
 	
 	/* General */
-	prop= RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Effector Group", "Limit effectors to this Group");
 	RNA_def_property_update(prop, 0, "rna_EffectorWeight_dependency_update");
 
-	prop= RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "global_gravity");
 	RNA_def_property_range(prop, -200.0f, 200.0f);
 	RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
@@ -959,91 +965,91 @@ static void rna_def_effector_weight(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
 
 	/* Effector weights */
-	prop= RNA_def_property(srna, "all", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "all", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "weight[0]");
 	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, "All", "All effector's weight");
 	RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
 
-	prop= RNA_def_property(srna, "force", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "force", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "weight[1]");
 	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, "Force", "Force effector weight");
 	RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
 
-	prop= RNA_def_property(srna, "vortex", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "vortex", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "weight[2]");
 	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, "Vortex", "Vortex effector weight");
 	RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
 
-	prop= RNA_def_property(srna, "magnetic", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "magnetic", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "weight[3]");
 	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, "Magnetic", "Magnetic effector weight");
 	RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
 
-	prop= RNA_def_property(srna, "wind", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "wind", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "weight[4]");
 	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, "Wind", "Wind effector weight");
 	RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
 
-	prop= RNA_def_property(srna, "curve_guide", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "curve_guide", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "weight[5]");
 	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, "Curve Guide", "Curve guide effector weight");
 	RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
 
-	prop= RNA_def_property(srna, "texture", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "texture", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "weight[6]");
 	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, "Texture", "Texture effector weight");
 	RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
 
-	prop= RNA_def_property(srna, "harmonic", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "harmonic", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "weight[7]");
 	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, "Harmonic", "Harmonic effector weight");
 	RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
 
-	prop= RNA_def_property(srna, "charge", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "charge", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "weight[8]");
 	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, "Charge", "Charge effector weight");
 	RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
 
-	prop= RNA_def_property(srna, "lennardjones", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "lennardjones", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "weight[9]");
 	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, "Lennard-Jones", "Lennard-Jones effector weight");
 	RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
 
-	prop= RNA_def_property(srna, "boid", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "boid", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "weight[10]");
 	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, "Boid", "Boid effector weight");
 	RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
 
-	prop= RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "weight[11]");
 	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, "Turbulence", "Turbulence effector weight");
 	RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
 
-	prop= RNA_def_property(srna, "drag", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "drag", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "weight[12]");
 	RNA_def_property_range(prop, -200.0f, 200.0f);
 	RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
@@ -1060,12 +1066,14 @@ static void rna_def_field(BlenderRNA *brna)
 		{0, "NONE", 0, "None", ""},
 		{PFIELD_FORCE, "FORCE", ICON_FORCE_FORCE, "Force", "Radial field toward the center of object"},
 		{PFIELD_WIND, "WIND", ICON_FORCE_WIND, "Wind", "Constant force along the force object's local Z axis"},
-		{PFIELD_VORTEX, "VORTEX", ICON_FORCE_VORTEX, "Vortex", "Spiraling force that twists the force object's local Z axis"},
+		{PFIELD_VORTEX, "VORTEX", ICON_FORCE_VORTEX, "Vortex",
+		                "Spiraling force that twists the force object's local Z axis"},
 		{PFIELD_MAGNET, "MAGNET", ICON_FORCE_MAGNETIC, "Magnetic", "Forcefield depends on the speed of the particles"},
 		{PFIELD_HARMONIC, "HARMONIC", ICON_FORCE_HARMONIC, "Harmonic",
 		                  "The source of this force field is the zero point of a harmonic oscillator"},
 		{PFIELD_CHARGE, "CHARGE", ICON_FORCE_CHARGE, "Charge",
-		                "Spherical forcefield based on the charge of particles, only influences other charge force fields"},
+		                "Spherical forcefield based on the charge of particles, "
+		                "only influences other charge force fields"},
 		{PFIELD_LENNARDJ, "LENNARDJ", ICON_FORCE_LENNARDJONES, "Lennard-Jones",
 		                  "Forcefield based on the Lennard-Jones potential"},
 		{PFIELD_TEXTURE, "TEXTURE", ICON_FORCE_TEXTURE, "Texture", "Forcefield based on a texture"},
@@ -1109,7 +1117,7 @@ static void rna_def_field(BlenderRNA *brna)
 		{2, "Z", 0, "Z", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "FieldSettings", NULL);
+	srna = RNA_def_struct(brna, "FieldSettings", NULL);
 	RNA_def_struct_sdna(srna, "PartDeflect");
 	RNA_def_struct_path_func(srna, "rna_FieldSettings_path");
 	RNA_def_struct_ui_text(srna, "Field Settings", "Field settings for an object in physics simulation");
@@ -1117,25 +1125,25 @@ static void rna_def_field(BlenderRNA *brna)
 	
 	/* Enums */
 	
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "forcefield");
 	RNA_def_property_enum_items(prop, field_type_items);
 	RNA_def_property_ui_text(prop, "Type", "Type of field");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_dependency_update");
 
-	prop= RNA_def_property(srna, "shape", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "shape", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, effector_shape_items);
 	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Effector_shape_itemf");
 	RNA_def_property_ui_text(prop, "Shape", "Which direction is used to calculate the effector force");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_shape_update");
 	
-	prop= RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "falloff");
 	RNA_def_property_enum_items(prop, falloff_items);
 	RNA_def_property_ui_text(prop, "Fall-Off", "");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 	
-	prop= RNA_def_property(srna, "texture_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "texture_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "tex_mode");
 	RNA_def_property_enum_items(prop, texture_items);
 	RNA_def_property_ui_text(prop, "Texture Mode",
@@ -1143,7 +1151,7 @@ static void rna_def_field(BlenderRNA *brna)
 	                         "else Gradient will be used instead)");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
-	prop= RNA_def_property(srna, "z_direction", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "z_direction", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "zdir");
 	RNA_def_property_enum_items(prop, zdirection_items);
 	RNA_def_property_ui_text(prop, "Z Direction", "Effect in full or only positive/negative Z direction");
@@ -1151,177 +1159,178 @@ static void rna_def_field(BlenderRNA *brna)
 	
 	/* Float */
 	
-	prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "f_strength");
 	RNA_def_property_range(prop, -1000.0f, 1000.0f);
 	RNA_def_property_ui_text(prop, "Strength", "Strength of force field");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
 	/* different ui range to above */
-	prop= RNA_def_property(srna, "linear_drag", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "linear_drag", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "f_strength");
 	RNA_def_property_range(prop, -2.0f, 2.0f);
 	RNA_def_property_ui_text(prop, "Linear Drag", "Drag component proportional to velocity");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
-	prop= RNA_def_property(srna, "harmonic_damping", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "harmonic_damping", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "f_damp");
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Harmonic Damping", "Damping of the harmonic force");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
 	/* different ui range to above */
-	prop= RNA_def_property(srna, "quadratic_drag", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "quadratic_drag", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "f_damp");
 	RNA_def_property_range(prop, -2.0f, 2.0f);
 	RNA_def_property_ui_text(prop, "Quadratic Drag", "Drag component proportional to the square of velocity");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
-	prop= RNA_def_property(srna, "flow", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "flow", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "f_flow");
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Flow", "Convert effector force into air flow velocity");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
 	/* different ui range to above */
-	prop= RNA_def_property(srna, "inflow", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "inflow", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "f_flow");
 	RNA_def_property_range(prop, -10.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Inflow", "Inwards component of the vortex force");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
-	prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "f_size");
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Size", "Size of the turbulence");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
-	prop= RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "f_size");
 	RNA_def_property_range(prop, 0.0f, 1000.0f);
 	RNA_def_property_ui_text(prop, "Rest Length", "Rest length of the harmonic force");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 	
-	prop= RNA_def_property(srna, "falloff_power", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "falloff_power", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "f_power");
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Falloff Power", "Falloff power (real gravitational falloff = 2)");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 	
-	prop= RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "mindist");
 	RNA_def_property_range(prop, 0.0f, 1000.0f);
 	RNA_def_property_ui_text(prop, "Minimum Distance", "Minimum distance for the field's fall-off");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 	
-	prop= RNA_def_property(srna, "distance_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "distance_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "maxdist");
 	RNA_def_property_range(prop, 0.0f, 1000.0f);
 	RNA_def_property_ui_text(prop, "Maximum Distance", "Maximum distance for the field to work");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 	
-	prop= RNA_def_property(srna, "radial_min", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "radial_min", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "minrad");
 	RNA_def_property_range(prop, 0.0f, 1000.0f);
 	RNA_def_property_ui_text(prop, "Minimum Radial Distance", "Minimum radial distance for the field's fall-off");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 	
-	prop= RNA_def_property(srna, "radial_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "radial_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "maxrad");
 	RNA_def_property_range(prop, 0.0f, 1000.0f);
 	RNA_def_property_ui_text(prop, "Maximum Radial Distance", "Maximum radial distance for the field to work");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 	
-	prop= RNA_def_property(srna, "radial_falloff", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "radial_falloff", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "f_power_r");
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Radial Falloff Power", "Radial falloff power (real gravitational falloff = 2)");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
-	prop= RNA_def_property(srna, "texture_nabla", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "texture_nabla", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "tex_nabla");
 	RNA_def_property_range(prop, 0.0001f, 1.0f);
-	RNA_def_property_ui_text(prop, "Nabla", "Defines size of derivative offset used for calculating gradient and curl");
+	RNA_def_property_ui_text(prop, "Nabla",
+	                         "Defines size of derivative offset used for calculating gradient and curl");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 	
-	prop= RNA_def_property(srna, "noise", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "noise", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "f_noise");
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Noise", "Amount of noise for the force strength");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
-	prop= RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_range(prop, 1, 128);
 	RNA_def_property_ui_text(prop, "Seed", "Seed of the noise");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
 	/* Boolean */
 	
-	prop= RNA_def_property(srna, "use_min_distance", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_min_distance", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMIN);
 	RNA_def_property_ui_text(prop, "Use Min", "Use a minimum distance for the field's fall-off");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 	
-	prop= RNA_def_property(srna, "use_max_distance", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_max_distance", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMAX);
 	RNA_def_property_ui_text(prop, "Use Max", "Use a maximum distance for the field to work");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 	
-	prop= RNA_def_property(srna, "use_radial_min", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_radial_min", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMINR);
 	RNA_def_property_ui_text(prop, "Use Min", "Use a minimum radial distance for the field's fall-off");
-	// "Use a minimum angle for the field's fall-off"
+	/* "Use a minimum angle for the field's fall-off" */
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 	
-	prop= RNA_def_property(srna, "use_radial_max", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_radial_max", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMAXR);
 	RNA_def_property_ui_text(prop, "Use Max", "Use a maximum radial distance for the field to work");
-	// "Use a maximum angle for the field to work"
+	/* "Use a maximum angle for the field to work" */
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
-	prop= RNA_def_property(srna, "use_object_coords", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_object_coords", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_TEX_OBJECT);
 	RNA_def_property_ui_text(prop, "Use Coordinates", "Use object/global coordinates for texture");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
-	prop= RNA_def_property(srna, "use_global_coords", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_global_coords", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GLOBAL_CO);
 	RNA_def_property_ui_text(prop, "Use Global Coordinates", "Use effector/global coordinates for turbulence");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 	
-	prop= RNA_def_property(srna, "use_2d_force", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_2d_force", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_TEX_2D);
 	RNA_def_property_ui_text(prop, "2D", "Apply force only in 2d");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 	
-	prop= RNA_def_property(srna, "use_root_coords", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_root_coords", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_TEX_ROOTCO);
 	RNA_def_property_ui_text(prop, "Root Texture Coordinates", "Texture coordinates from root particle locations");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
-	prop= RNA_def_property(srna, "apply_to_location", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "apply_to_location", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_DO_LOCATION);
 	RNA_def_property_ui_text(prop, "Location", "Effect particles' location");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
-	prop= RNA_def_property(srna, "apply_to_rotation", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "apply_to_rotation", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_DO_ROTATION);
 	RNA_def_property_ui_text(prop, "Rotation", "Effect particles' dynamic rotation");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
-	prop= RNA_def_property(srna, "use_absorption", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_absorption", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_VISIBILITY);
 	RNA_def_property_ui_text(prop, "Absorption", "Force gets absorbed by collision objects");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
-	prop= RNA_def_property(srna, "use_multiple_springs", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_multiple_springs", PROP_BOOLEAN, PROP_NONE);
 	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");
 	
 	/* Pointer */
 	
-	prop= RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "tex");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Texture", "Texture to use as force");
@@ -1329,37 +1338,37 @@ static void rna_def_field(BlenderRNA *brna)
 	
 	/********** Curve Guide Field Settings **********/
 	
-	prop= RNA_def_property(srna, "guide_minimum", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "guide_minimum", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "f_strength");
 	RNA_def_property_range(prop, 0.0f, 1000.0f);
 	RNA_def_property_ui_text(prop, "Minimum Distance", "The distance from which particles are affected fully");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
-	prop= RNA_def_property(srna, "guide_free", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "guide_free", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "free_end");
 	RNA_def_property_range(prop, 0.0f, 0.99f);
 	RNA_def_property_ui_text(prop, "Free", "Guide-free time from particle life's end");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
-	prop= RNA_def_property(srna, "use_guide_path_add", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_guide_path_add", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GUIDE_PATH_ADD);
 	RNA_def_property_ui_text(prop, "Additive", "Based on distance/falloff it adds a portion of the entire path");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
-	prop= RNA_def_property(srna, "use_guide_path_weight", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_guide_path_weight", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GUIDE_PATH_WEIGHT);
 	RNA_def_property_ui_text(prop, "Weights", "Use curve weights to influence the particle influence along the curve");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 	
 	/* Clump Settings */
 	
-	prop= RNA_def_property(srna, "guide_clump_amount", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "guide_clump_amount", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "clump_fac");
 	RNA_def_property_range(prop, -1.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Amount", "Amount of clumping");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 	
-	prop= RNA_def_property(srna, "guide_clump_shape", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "guide_clump_shape", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "clump_pow");
 	RNA_def_property_range(prop, -0.999f, 0.999f);
 	RNA_def_property_ui_text(prop, "Shape", "Shape of clumping");
@@ -1367,38 +1376,38 @@ static void rna_def_field(BlenderRNA *brna)
 	
 	/* Kink Settings */
 	
-	prop= RNA_def_property(srna, "guide_kink_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "guide_kink_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "kink");
 	RNA_def_property_enum_items(prop, guide_kink_items);
 	RNA_def_property_ui_text(prop, "Kink", "Type of periodic offset on the curve");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 	
-	prop= RNA_def_property(srna, "guide_kink_axis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "guide_kink_axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "kink_axis");
 	RNA_def_property_enum_items(prop, guide_kink_axis_items);
 	RNA_def_property_ui_text(prop, "Axis", "Which axis to use for offset");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
-	prop= RNA_def_property(srna, "guide_kink_frequency", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "guide_kink_frequency", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "kink_freq");
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Frequency", "The frequency of the offset (1/total length)");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 	
-	prop= RNA_def_property(srna, "guide_kink_shape", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "guide_kink_shape", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "kink_shape");
 	RNA_def_property_range(prop, -0.999f, 0.999f);
 	RNA_def_property_ui_text(prop, "Shape", "Adjust the offset to the beginning/end");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 	
-	prop= RNA_def_property(srna, "guide_kink_amplitude", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "guide_kink_amplitude", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "kink_amp");
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Amplitude", "The amplitude of the offset");
 	RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
 
 	/* Variables used for Curve Guide, already wrapped, used for other fields too */
-	// falloff_power, use_max_distance, maximum_distance
+	/* falloff_power, use_max_distance, maximum_distance */
 }
 
 static void rna_def_game_softbody(BlenderRNA *brna)
@@ -1406,33 +1415,35 @@ static void rna_def_game_softbody(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "GameSoftBodySettings", NULL);
+	srna = RNA_def_struct(brna, "GameSoftBodySettings", NULL);
 	RNA_def_struct_sdna(srna, "BulletSoftBody");
-	RNA_def_struct_ui_text(srna, "Game Soft Body Settings", "Soft body simulation settings for an object in the game engine");
+	RNA_def_struct_ui_text(srna, "Game Soft Body Settings",
+	                       "Soft body simulation settings for an object in the game engine");
 	
 	/* Floats */
 	
-	prop= RNA_def_property(srna, "linear_stiffness", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "linear_stiffness", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "linStiff");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Linear Stiffness", "Linear stiffness of the soft body links");
 	
-	prop= RNA_def_property(srna, "dynamic_friction", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "dynamic_friction", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "kDF");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Friction", "Dynamic Friction");
 	
-	prop= RNA_def_property(srna, "shape_threshold", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "shape_threshold", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "kMT");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Threshold", "Shape matching threshold");
 	
-	prop= RNA_def_property(srna, "collision_margin", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "collision_margin", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "margin");
 	RNA_def_property_range(prop, 0.01f, 1.0f);
-	RNA_def_property_ui_text(prop, "Margin", "Collision margin for soft body. Small value makes the algorithm unstable");
+	RNA_def_property_ui_text(prop, "Margin",
+	                         "Collision margin for soft body. Small value makes the algorithm unstable");
 	
-	prop= RNA_def_property(srna, "weld_threshold", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "weld_threshold", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "welding");
 	RNA_def_property_range(prop, 0.0f, 0.01f);
 	RNA_def_property_ui_text(prop, "Welding",
@@ -1442,31 +1453,31 @@ static void rna_def_game_softbody(BlenderRNA *brna)
 
 	/* Integers */
 	
-	prop= RNA_def_property(srna, "location_iterations", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "location_iterations", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "piterations");
 	RNA_def_property_range(prop, 0, 10);
 	RNA_def_property_ui_text(prop, "Position Iterations", "Position solver iterations");
 	
-	prop= RNA_def_property(srna, "cluster_iterations", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "cluster_iterations", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "numclusteriterations");
 	RNA_def_property_range(prop, 1, 128);
 	RNA_def_property_ui_text(prop, "Cluster Iterations", "Number of cluster iterations");
 	
 	/* Booleans */
 	
-	prop= RNA_def_property(srna, "use_shape_match", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_shape_match", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_BSB_SHAPE_MATCHING);
 	RNA_def_property_ui_text(prop, "Shape Match", "Enable soft body shape matching goal");
 	
-	prop= RNA_def_property(srna, "use_bending_constraints", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_bending_constraints", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_BSB_BENDING_CONSTRAINTS);
 	RNA_def_property_ui_text(prop, "Bending Const", "Enable bending constraints");
 	
-	prop= RNA_def_property(srna, "use_cluster_rigid_to_softbody", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_cluster_rigid_to_softbody", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "collisionflags", OB_BSB_COL_CL_RS);
 	RNA_def_property_ui_text(prop, "Rigid to Soft Body", "Enable cluster collision between soft and rigid body");
 	
-	prop= RNA_def_property(srna, "use_cluster_soft_to_softbody", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_cluster_soft_to_softbody", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "collisionflags", OB_BSB_COL_CL_SS);
 	RNA_def_property_ui_text(prop, "Soft to Soft Body", "Enable cluster collision between soft and soft body");
 }
@@ -1475,7 +1486,7 @@ static void rna_def_softbody(BlenderRNA *brna)
 {
 	StructRNA *srna;
 	PropertyRNA *prop;
-	const int matrix_dimsize[]= {3, 3};
+	const int matrix_dimsize[] = {3, 3};
 
 	
 	static EnumPropertyItem collision_type_items[] = {
@@ -1491,39 +1502,39 @@ static void rna_def_softbody(BlenderRNA *brna)
 		{1, "LIFT_FORCE", 0, "Lift Force", "Edges receive a lift force when passing through surrounding media"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "SoftBodySettings", NULL);
+	srna = RNA_def_struct(brna, "SoftBodySettings", NULL);
 	RNA_def_struct_sdna(srna, "SoftBody");
 	RNA_def_struct_path_func(srna, "rna_SoftBodySettings_path");
 	RNA_def_struct_ui_text(srna, "Soft Body Settings", "Soft body simulation settings for an object");
 	
 	/* General Settings */
 	
-	prop= RNA_def_property(srna, "friction", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "friction", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "mediafrict");
 	RNA_def_property_range(prop, 0.0f, 50.0f);
 	RNA_def_property_ui_text(prop, "Friction", "General media friction for point movements");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "nodemass");
 	RNA_def_property_range(prop, 0.0f, 50000.0f);
 	RNA_def_property_ui_text(prop, "Mass", "General Mass value");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "vertex_group_mass", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "vertex_group_mass", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "namedVG_Mass");
 	RNA_def_property_ui_text(prop, "Mass Vertex Group", "Control point mass values");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SoftBodySettings_mass_vgroup_set");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
 	/* no longer used */
-	prop= RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
+	prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
 	RNA_def_property_float_sdna(prop, NULL, "grav");
 	RNA_def_property_range(prop, -10.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Gravitation", "Apply gravitation to point movement");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "speed", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "speed", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "physics_speed");
 	RNA_def_property_range(prop, 0.01f, 100.0f);
 	RNA_def_property_ui_text(prop, "Speed", "Tweak timing for physics to control frequency and speed");
@@ -1531,39 +1542,41 @@ static void rna_def_softbody(BlenderRNA *brna)
 	
 	/* Goal */
 	
-	prop= RNA_def_property(srna, "vertex_group_goal", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "vertex_group_goal", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "vertgroup");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* not impossible .. but not supported yet */
-	RNA_def_property_string_funcs(prop, "rna_SoftBodySettings_goal_vgroup_get", "rna_SoftBodySettings_goal_vgroup_length",
+	RNA_def_property_string_funcs(prop, "rna_SoftBodySettings_goal_vgroup_get",
+	                              "rna_SoftBodySettings_goal_vgroup_length",
 	                              "rna_SoftBodySettings_goal_vgroup_set");
 	RNA_def_property_ui_text(prop, "Goal Vertex Group", "Control point weight values");
 	
-	prop= RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "mingoal");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Goal Minimum", "Goal minimum, vertex weights are scaled to match this range");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 
-	prop= RNA_def_property(srna, "goal_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "goal_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "maxgoal");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Goal Maximum", "Goal maximum, vertex weights are scaled to match this range");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 
-	prop= RNA_def_property(srna, "goal_default", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "goal_default", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "defgoal");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
-	RNA_def_property_ui_text(prop, "Goal Default", "Default Goal (vertex target position) value, when no Vertex Group used");
+	RNA_def_property_ui_text(prop, "Goal Default",
+	                         "Default Goal (vertex target position) value, when no Vertex Group used");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "goal_spring", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "goal_spring", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "goalspring");
 	RNA_def_property_range(prop, 0.0f, 0.999f);
 	RNA_def_property_ui_text(prop, "Goal Stiffness", "Goal (vertex target position) spring stiffness");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "goal_friction", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "goal_friction", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "goalfrict");
 	RNA_def_property_range(prop, 0.0f, 50.0f);
 	RNA_def_property_ui_text(prop, "Goal Damping", "Goal (vertex target position) friction");
@@ -1571,54 +1584,54 @@ static void rna_def_softbody(BlenderRNA *brna)
 	
 	/* Edge Spring Settings */
 	
-	prop= RNA_def_property(srna, "pull", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "pull", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "inspring");
 	RNA_def_property_range(prop, 0.0f, 0.999f);
 	RNA_def_property_ui_text(prop, "Pull", "Edge spring stiffness when longer than rest length");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "push", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "push", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "inpush");
 	RNA_def_property_range(prop, 0.0f, 0.999f);
 	RNA_def_property_ui_text(prop, "Push", "Edge spring stiffness when shorter than rest length");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "infrict");
 	RNA_def_property_range(prop, 0.0f, 50.0f);
 	RNA_def_property_ui_text(prop, "Damp", "Edge spring friction");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "spring_length", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "spring_length", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "springpreload");
 	RNA_def_property_range(prop, 0.0f, 200.0f);
 	RNA_def_property_ui_text(prop, "SL", "Alter spring length to shrink/blow up (unit %) 0 to disable");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "aero", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "aero", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "aeroedge");
 	RNA_def_property_range(prop, 0.0f, 30000.0f);
 	RNA_def_property_ui_text(prop, "Aero", "Make edges 'sail'");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "plastic", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "plastic", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "plastic");
 	RNA_def_property_range(prop, 0.0f, 100.0f);
 	RNA_def_property_ui_text(prop, "Plastic", "Permanent deform");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "bend", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "bend", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "secondspring");
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Bending", "Bending Stiffness");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "shear", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "shear", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "shearstiff");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Shear", "Shear Stiffness");
 	
-	prop= RNA_def_property(srna, "vertex_group_spring", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "vertex_group_spring", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "namedVG_Spring_K");
 	RNA_def_property_ui_text(prop, "Spring Vertex Group", "Control point spring strength values");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SoftBodySettings_spring_vgroup_set");
@@ -1626,27 +1639,27 @@ static void rna_def_softbody(BlenderRNA *brna)
 	
 	/* Collision */
 	
-	prop= RNA_def_property(srna, "collision_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "collision_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "sbc_mode");
 	RNA_def_property_enum_items(prop, collision_type_items);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Collision Type", "Choose Collision Type");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "ball_size", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "ball_size", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "colball");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* code is not ready for that yet */
 	RNA_def_property_range(prop, -10.0f, 10.0f);
-	RNA_def_property_ui_text(prop, "Ball Size", "Absolute ball size or factor if not manual adjusted");
+	RNA_def_property_ui_text(prop, "Ball Size", "Absolute ball size or factor if not manually adjusted");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "ball_stiff", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "ball_stiff", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "ballstiff");
 	RNA_def_property_range(prop, 0.001f, 100.0f);
 	RNA_def_property_ui_text(prop, "Ball Size", "Ball inflating pressure");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "ball_damp", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "ball_damp", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "balldamp");
 	RNA_def_property_range(prop, 0.001f, 1.0f);
 	RNA_def_property_ui_text(prop, "Ball Size", "Blending to inelastic collision");
@@ -1654,48 +1667,50 @@ static void rna_def_softbody(BlenderRNA *brna)
 	
 	/* Solver */
 	
-	prop= RNA_def_property(srna, "error_threshold", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "error_threshold", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "rklimit");
 	RNA_def_property_range(prop, 0.001f, 10.0f);
 	RNA_def_property_ui_text(prop, "Error Limit",
-	                         "The Runge-Kutta ODE solver error limit, low value gives more precision, high values speed");
+	                         "The Runge-Kutta ODE solver error limit, low value gives more precision, "
+	                         "high values speed");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "step_min", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "step_min", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "minloops");
 	RNA_def_property_range(prop, 0, 30000);
 	RNA_def_property_ui_text(prop, "Min Step", "Minimal # solver steps/frame");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "step_max", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "step_max", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "maxloops");
 	RNA_def_property_range(prop, 0, 30000);
 	RNA_def_property_ui_text(prop, "Max Step", "Maximal # solver steps/frame");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "choke", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "choke", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "choke");
 	RNA_def_property_range(prop, 0, 100);
 	RNA_def_property_ui_text(prop, "Choke", "'Viscosity' inside collision target");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "fuzzy", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "fuzzy", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "fuzzyness");
 	RNA_def_property_range(prop, 1, 100);
 	RNA_def_property_ui_text(prop, "Fuzzy",
-	                         "Fuzziness while on collision, high values make collision handling faster but less stable");
+	                         "Fuzziness while on collision, high values make collision handling faster "
+	                         "but less stable");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "use_auto_step", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_auto_step", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "solverflags", SBSO_OLDERR);
 	RNA_def_property_ui_text(prop, "V", "Use velocities for automagic step sizes");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "use_diagnose", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_diagnose", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "solverflags", SBSO_MONITOR);
 	RNA_def_property_ui_text(prop, "Print Performance to Console", "Turn on SB diagnose console prints");
 	
-	prop= RNA_def_property(srna, "use_estimate_matrix", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_estimate_matrix", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "solverflags", SBSO_ESTIMATEIPO);
 	RNA_def_property_ui_text(prop, "Estimate matrix", "Estimate matrix... split to COM, ROT, SCALE");
 
@@ -1705,17 +1720,18 @@ static void rna_def_softbody(BlenderRNA *brna)
 	/* but i did not want to start a new property struct */
 	/* so rather rename this from SoftBodySettings to SoftBody */
 	/* translation */
-	prop= RNA_def_property(srna, "location_mass_center", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "location_mass_center", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "lcom");
 	RNA_def_property_ui_text(prop, "Center of mass", "Location of Center of mass");
+	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
 
 	/* matrix */
-	prop= RNA_def_property(srna, "rotation_estimate", PROP_FLOAT, PROP_MATRIX);
+	prop = RNA_def_property(srna, "rotation_estimate", PROP_FLOAT, PROP_MATRIX);
 	RNA_def_property_float_sdna(prop, NULL, "lrot");
 	RNA_def_property_multi_array(prop, 2, matrix_dimsize);
 	RNA_def_property_ui_text(prop, "Rot Matrix", "Estimated rotation matrix");
 
-	prop= RNA_def_property(srna, "scale_estimate", PROP_FLOAT, PROP_MATRIX);
+	prop = RNA_def_property(srna, "scale_estimate", PROP_FLOAT, PROP_MATRIX);
 	RNA_def_property_float_sdna(prop, NULL, "lscale");
 	RNA_def_property_multi_array(prop, 2, matrix_dimsize);
 	RNA_def_property_ui_text(prop, "Scale Matrix", "Estimated scale matrix");
@@ -1724,47 +1740,51 @@ static void rna_def_softbody(BlenderRNA *brna)
 
 	/* Flags */
 	
-	prop= RNA_def_property(srna, "use_goal", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_goal", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_use_goal_get", "rna_SoftBodySettings_use_goal_set");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Use Goal", "Define forces for vertices to stick to animated position");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "use_edges", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_edges", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_use_edges_get", "rna_SoftBodySettings_use_edges_set");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Use Edges", "Use Edges as springs");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "use_stiff_quads", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_stiff_quads_get", "rna_SoftBodySettings_stiff_quads_set");
+	prop = RNA_def_property(srna, "use_stiff_quads", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_stiff_quads_get",
+	                               "rna_SoftBodySettings_stiff_quads_set");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Stiff Quads", "Add diagonal springs on 4-gons");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "use_edge_collision", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_edge_collision_get", "rna_SoftBodySettings_edge_collision_set");
+	prop = RNA_def_property(srna, "use_edge_collision", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_edge_collision_get",
+	                               "rna_SoftBodySettings_edge_collision_set");
 	RNA_def_property_ui_text(prop, "Edge Collision", "Edges collide too");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "use_face_collision", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_face_collision_get", "rna_SoftBodySettings_face_collision_set");
+	prop = RNA_def_property(srna, "use_face_collision", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_face_collision_get",
+	                               "rna_SoftBodySettings_face_collision_set");
 	RNA_def_property_ui_text(prop, "Face Collision", "Faces collide too, can be very slow");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "aerodynamics_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "aerodynamics_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, aerodynamics_type);
 	RNA_def_property_enum_funcs(prop, "rna_SoftBodySettings_new_aero_get", "rna_SoftBodySettings_new_aero_set", NULL);
 	RNA_def_property_ui_text(prop, "Aerodynamics Type", "Method of calculating aerodynamic interaction");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 	
-	prop= RNA_def_property(srna, "use_self_collision", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_self_collision_get", "rna_SoftBodySettings_self_collision_set");
+	prop = RNA_def_property(srna, "use_self_collision", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_self_collision_get",
+	                               "rna_SoftBodySettings_self_collision_set");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Self Collision", "Enable naive vertex ball self collision");
 	RNA_def_property_update(prop, 0, "rna_softbody_update");
 
-	prop= RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "effector_weights");
 	RNA_def_property_struct_type(prop, "EffectorWeights");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
diff --git a/source/blender/makesrna/intern/rna_packedfile.c b/source/blender/makesrna/intern/rna_packedfile.c
index 3d19cc3..1fed98b 100644
--- a/source/blender/makesrna/intern/rna_packedfile.c
+++ b/source/blender/makesrna/intern/rna_packedfile.c
@@ -48,10 +48,10 @@ void RNA_def_packedfile(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "PackedFile", NULL);
+	srna = RNA_def_struct(brna, "PackedFile", NULL);
 	RNA_def_struct_ui_text(srna, "Packed File", "External file packed into the .blend file");
 
-	prop= RNA_def_property(srna, "size", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Size", "Size of packed file in bytes");
 
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 2c71fff..dd591ea 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -30,8 +30,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-
-#include "limits.h"
+#include <limits.h>
 
 #include "RNA_define.h"
 #include "RNA_enum_types.h"
@@ -132,18 +131,19 @@ EnumPropertyItem part_hair_ren_as_items[] = {
 #include "BKE_texture.h"
 
 /* use for object space hair get/set */
-static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr, ParticleSystemModifierData **psmd_pt, ParticleData **pa_pt)
+static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr, ParticleSystemModifierData **psmd_pt,
+                                                     ParticleData **pa_pt)
 {
-	HairKey *hkey= (HairKey *)ptr->data;
+	HairKey *hkey = (HairKey *)ptr->data;
 	Object *ob = (Object *)ptr->id.data;
 	ModifierData *md;
-	ParticleSystemModifierData *psmd=NULL;
+	ParticleSystemModifierData *psmd = NULL;
 	ParticleSystem *psys;
 	ParticleData *pa;
 	int i;
 
-	*psmd_pt= NULL;
-	*pa_pt= NULL;
+	*psmd_pt = NULL;
+	*pa_pt = NULL;
 
 	/* given the pointer HairKey *hkey, we iterate over all particles in all
 	 * particle systems in the object "ob" in order to find
@@ -159,12 +159,12 @@ static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr, ParticleSy
 	 * hairkey belongs.
 	 */
 
-	for (md= ob->modifiers.first; md; md=md->next) {
+	for (md = ob->modifiers.first; md; md = md->next) {
 		if (md->type == eModifierType_ParticleSystem) {
-			psmd= (ParticleSystemModifierData *) md;
+			psmd = (ParticleSystemModifierData *) md;
 			if (psmd && psmd->dm && psmd->psys) {
 				psys = psmd->psys;
-				for(i= 0, pa= psys->particles; i < psys->totpart; i++, pa++) {
+				for (i = 0, pa = psys->particles; i < psys->totpart; i++, pa++) {
 					/* hairkeys are stored sequentially in memory, so we can
 					 * find if it's the same particle by comparing pointers,
 					 * without having to iterate over them all */
@@ -181,17 +181,17 @@ static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr, ParticleSy
 
 static void rna_ParticleHairKey_location_object_get(PointerRNA *ptr, float *values)
 {
-	HairKey *hkey= (HairKey *)ptr->data;
+	HairKey *hkey = (HairKey *)ptr->data;
 	Object *ob = (Object *)ptr->id.data;
 	ParticleSystemModifierData *psmd;
 	ParticleData *pa;
 
 	rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa);
 
-	if(pa) {
+	if (pa) {
 		DerivedMesh *hairdm = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_dm : NULL;
 
-		if(hairdm) {
+		if (hairdm) {
 			MVert *mvert = CDDM_get_vert(hairdm, pa->hair_index + (hkey - pa->hair));
 			copy_v3_v3(values, mvert->co);
 		}
@@ -209,17 +209,17 @@ static void rna_ParticleHairKey_location_object_get(PointerRNA *ptr, float *valu
 
 static void rna_ParticleHairKey_location_object_set(PointerRNA *ptr, const float *values)
 {
-	HairKey *hkey= (HairKey *)ptr->data;
+	HairKey *hkey = (HairKey *)ptr->data;
 	Object *ob = (Object *)ptr->id.data;
 	ParticleSystemModifierData *psmd;
 	ParticleData *pa;
 
 	rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa);
 
-	if(pa) {
+	if (pa) {
 		DerivedMesh *hairdm = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_dm : NULL;
 
-		if(hairdm) {
+		if (hairdm) {
 			MVert *mvert = CDDM_get_vert(hairdm, pa->hair_index + (hkey - pa->hair));
 			copy_v3_v3(mvert->co, values);
 		}
@@ -241,7 +241,7 @@ static void rna_ParticleHairKey_location_object_set(PointerRNA *ptr, const float
 /* property update functions */
 static void particle_recalc(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr, short flag)
 {
-	if(ptr->type==&RNA_ParticleSystem) {
+	if (ptr->type == &RNA_ParticleSystem) {
 		ParticleSystem *psys = (ParticleSystem*)ptr->data;
 		
 		psys->recalc = flag;
@@ -289,9 +289,9 @@ static ParticleSystem *rna_particle_system_for_target(Object *ob, ParticleTarget
 	ParticleSystem *psys;
 	ParticleTarget *pt;
 
-	for(psys=ob->particlesystem.first; psys; psys=psys->next)
-		for(pt=psys->targets.first; pt; pt=pt->next)
-			if(pt == target)
+	for (psys = ob->particlesystem.first; psys; psys = psys->next)
+		for (pt = psys->targets.first; pt; pt = pt->next)
+			if (pt == target)
 				return psys;
 	
 	return NULL;
@@ -299,24 +299,24 @@ static ParticleSystem *rna_particle_system_for_target(Object *ob, ParticleTarget
 
 static void rna_Particle_target_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	if(ptr->type==&RNA_ParticleTarget) {
+	if (ptr->type == &RNA_ParticleTarget) {
 		Object *ob = (Object*)ptr->id.data;
 		ParticleTarget *pt = (ParticleTarget*)ptr->data;
-		ParticleSystem *kpsys=NULL, *psys=rna_particle_system_for_target(ob, pt);
+		ParticleSystem *kpsys = NULL, *psys = rna_particle_system_for_target(ob, pt);
 
-		if(pt->ob==ob || pt->ob==NULL) {
+		if (pt->ob == ob || pt->ob == NULL) {
 			kpsys = BLI_findlink(&ob->particlesystem, pt->psys-1);
 
-			if(kpsys)
+			if (kpsys)
 				pt->flag |= PTARGET_VALID;
 			else
 				pt->flag &= ~PTARGET_VALID;
 		}
 		else {
-			if(pt->ob)
+			if (pt->ob)
 				kpsys = BLI_findlink(&pt->ob->particlesystem, pt->psys-1);
 
-			if(kpsys)
+			if (kpsys)
 				pt->flag |= PTARGET_VALID;
 			else
 				pt->flag &= ~PTARGET_VALID;
@@ -333,7 +333,7 @@ static void rna_Particle_target_reset(Main *bmain, Scene *scene, PointerRNA *ptr
 
 static void rna_Particle_target_redo(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	if(ptr->type==&RNA_ParticleTarget) {
+	if (ptr->type == &RNA_ParticleTarget) {
 		Object *ob = (Object*)ptr->id.data;
 		ParticleTarget *pt = (ParticleTarget*)ptr->data;
 		ParticleSystem *psys = rna_particle_system_for_target(ob, pt);
@@ -350,7 +350,7 @@ static void rna_Particle_hair_dynamics(Main *bmain, Scene *scene, PointerRNA *pt
 	Object *ob = (Object*)ptr->id.data;
 	ParticleSystem *psys = (ParticleSystem*)ptr->data;
 	
-	if(psys && !psys->clmd) {
+	if (psys && !psys->clmd) {
 		psys->clmd = (ClothModifierData*)modifier_new(eModifierType_Cloth);
 		psys->clmd->sim_parms->goalspring = 0.0f;
 		psys->clmd->sim_parms->flags |= CLOTH_SIMSETTINGS_FLAG_GOAL|CLOTH_SIMSETTINGS_FLAG_NO_SPRING_COMPRESS;
@@ -364,7 +364,7 @@ static void rna_Particle_hair_dynamics(Main *bmain, Scene *scene, PointerRNA *pt
 }
 static PointerRNA rna_particle_settings_get(PointerRNA *ptr)
 {
-	ParticleSystem *psys= (ParticleSystem*)ptr->data;
+	ParticleSystem *psys = (ParticleSystem*)ptr->data;
 	ParticleSettings *part = psys->part;
 
 	return rna_pointer_inherit_refine(ptr, &RNA_ParticleSettings, part);
@@ -372,21 +372,21 @@ static PointerRNA rna_particle_settings_get(PointerRNA *ptr)
 
 static void rna_particle_settings_set(PointerRNA *ptr, PointerRNA value)
 {
-	ParticleSystem *psys= (ParticleSystem*)ptr->data;
+	ParticleSystem *psys = (ParticleSystem*)ptr->data;
 	int old_type = 0;
 
 
-	if(psys->part) {
+	if (psys->part) {
 		old_type = psys->part->type;
 		psys->part->id.us--;
 	}
 
 	psys->part = (ParticleSettings *)value.data;
 
-	if(psys->part) {
+	if (psys->part) {
 		psys->part->id.us++;
 		psys_check_boid_data(psys);
-		if(old_type != psys->part->type)
+		if (old_type != psys->part->type)
 			psys->recalc |= PSYS_RECALC_TYPE;
 	}
 }
@@ -394,7 +394,7 @@ static void rna_Particle_abspathtime_update(Main *bmain, Scene *scene, PointerRN
 {
 	ParticleSettings *settings = (ParticleSettings*)ptr->data;
 	float delta = settings->end + settings->lifetime - settings->sta;
-	if(settings->draw & PART_ABS_PATH_TIME) {
+	if (settings->draw & PART_ABS_PATH_TIME) {
 		settings->path_start = settings->sta + settings->path_start * delta;
 		settings->path_end = settings->sta + settings->path_end * delta;
 	}
@@ -409,12 +409,12 @@ static void rna_PartSettings_start_set(struct PointerRNA *ptr, float value)
 	ParticleSettings *settings = (ParticleSettings*)ptr->data;
 
 	/* check for clipping */
-	if(value > settings->end)
+	if (value > settings->end)
 		value = settings->end;
 
-	//if(settings->type==PART_REACTOR && value < 1.0)
-	//	value = 1.0;
-	//else 
+	/*if (settings->type==PART_REACTOR && value < 1.0) */
+	/*	value = 1.0; */
+	/*else  */
 	if (value < MINAFRAMEF)
 		value = MINAFRAMEF;
 
@@ -426,7 +426,7 @@ static void rna_PartSettings_end_set(struct PointerRNA *ptr, float value)
 	ParticleSettings *settings = (ParticleSettings*)ptr->data;
 
 	/* check for clipping */
-	if(value < settings->sta)
+	if (value < settings->sta)
 		value = settings->sta;
 
 	settings->end = value;
@@ -469,17 +469,17 @@ static float rna_PartSetting_linelentail_get(struct PointerRNA *ptr)
 	ParticleSettings *settings = (ParticleSettings*)ptr->data;
 	return settings->draw_line[0];
 }
-static void rna_PartSetting_pathstartend_range(PointerRNA *ptr, float *min, float *max)
+static void rna_PartSetting_pathstartend_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
 {
 	ParticleSettings *settings = (ParticleSettings*)ptr->data;
 
-	if(settings->type==PART_HAIR) {
+	if (settings->type == PART_HAIR) {
 		*min = 0.0f;
 		*max = (settings->draw & PART_ABS_PATH_TIME) ? 100.0f : 1.0f;
 	}
 	else {
 		*min = (settings->draw & PART_ABS_PATH_TIME) ? settings->sta : 0.0f;
-		*max= (settings->draw & PART_ABS_PATH_TIME) ? MAXFRAMEF : 1.0f;
+		*max = (settings->draw & PART_ABS_PATH_TIME) ? MAXFRAMEF : 1.0f;
 	}
 }
 static void rna_PartSetting_linelenhead_set(struct PointerRNA *ptr, float value)
@@ -497,49 +497,51 @@ static float rna_PartSetting_linelenhead_get(struct PointerRNA *ptr)
 
 static int rna_PartSettings_is_fluid_get(PointerRNA *ptr)
 {
-	ParticleSettings *part= (ParticleSettings*)ptr->data;
+	ParticleSettings *part = (ParticleSettings*)ptr->data;
 
 	return part->type == PART_FLUID;
 }
 
 void rna_ParticleSystem_name_set(PointerRNA *ptr, const char *value)
 {
-	Object *ob= ptr->id.data;
-	ParticleSystem *part= (ParticleSystem*)ptr->data;
+	Object *ob = ptr->id.data;
+	ParticleSystem *part = (ParticleSystem*)ptr->data;
 
 	/* copy the new name into the name slot */
 	BLI_strncpy_utf8(part->name, value, sizeof(part->name));
 
-	BLI_uniquename(&ob->particlesystem, part, "ParticleSystem", '.', offsetof(ParticleSystem, name), sizeof(part->name));
+	BLI_uniquename(&ob->particlesystem, part, "ParticleSystem", '.', offsetof(ParticleSystem, name),
+	               sizeof(part->name));
 }
 
 static PointerRNA rna_ParticleSystem_active_particle_target_get(PointerRNA *ptr)
 {
-	ParticleSystem *psys= (ParticleSystem*)ptr->data;
+	ParticleSystem *psys = (ParticleSystem*)ptr->data;
 	ParticleTarget *pt = psys->targets.first;
 
-	for(; pt; pt=pt->next) {
-		if(pt->flag & PTARGET_CURRENT)
+	for (; pt; pt = pt->next) {
+		if (pt->flag & PTARGET_CURRENT)
 			return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, pt);
 	}
 	return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, NULL);
 }
-static void rna_ParticleSystem_active_particle_target_index_range(PointerRNA *ptr, int *min, int *max)
+static void rna_ParticleSystem_active_particle_target_index_range(PointerRNA *ptr, int *min, int *max,
+                                                                  int *softmin, int *softmax)
 {
-	ParticleSystem *psys= (ParticleSystem*)ptr->data;
-	*min= 0;
-	*max= BLI_countlist(&psys->targets)-1;
-	*max= MAX2(0, *max);
+	ParticleSystem *psys = (ParticleSystem*)ptr->data;
+	*min = 0;
+	*max = BLI_countlist(&psys->targets)-1;
+	*max = MAX2(0, *max);
 }
 
 static int rna_ParticleSystem_active_particle_target_index_get(PointerRNA *ptr)
 {
-	ParticleSystem *psys= (ParticleSystem*)ptr->data;
+	ParticleSystem *psys = (ParticleSystem*)ptr->data;
 	ParticleTarget *pt = psys->targets.first;
-	int i=0;
+	int i = 0;
 
-	for(; pt; pt=pt->next, i++)
-		if(pt->flag & PTARGET_CURRENT)
+	for (; pt; pt = pt->next, i++)
+		if (pt->flag & PTARGET_CURRENT)
 			return i;
 
 	return 0;
@@ -547,12 +549,12 @@ static int rna_ParticleSystem_active_particle_target_index_get(PointerRNA *ptr)
 
 static void rna_ParticleSystem_active_particle_target_index_set(struct PointerRNA *ptr, int value)
 {
-	ParticleSystem *psys= (ParticleSystem*)ptr->data;
+	ParticleSystem *psys = (ParticleSystem*)ptr->data;
 	ParticleTarget *pt = psys->targets.first;
-	int i=0;
+	int i = 0;
 
-	for(; pt; pt=pt->next, i++) {
-		if(i==value)
+	for (; pt; pt = pt->next, i++) {
+		if (i == value)
 			pt->flag |= PTARGET_CURRENT;
 		else
 			pt->flag &= ~PTARGET_CURRENT;
@@ -560,20 +562,20 @@ static void rna_ParticleSystem_active_particle_target_index_set(struct PointerRN
 }
 static int rna_ParticleTarget_name_length(PointerRNA *ptr)
 {
-	ParticleTarget *pt= ptr->data;
+	ParticleTarget *pt = ptr->data;
 
-	if(pt->flag & PTARGET_VALID) {
+	if (pt->flag & PTARGET_VALID) {
 		ParticleSystem *psys = NULL;
 
-		if(pt->ob)
+		if (pt->ob)
 			psys = BLI_findlink(&pt->ob->particlesystem, pt->psys-1);
 		else {
 			Object *ob = (Object*) ptr->id.data;
 			psys = BLI_findlink(&ob->particlesystem, pt->psys-1);
 		}
 		
-		if(psys) {
-			if(pt->ob)
+		if (psys) {
+			if (pt->ob)
 				return strlen(pt->ob->id.name+2) + 2 + strlen(psys->name);
 			else
 				return strlen(psys->name);
@@ -587,20 +589,20 @@ static int rna_ParticleTarget_name_length(PointerRNA *ptr)
 
 static void rna_ParticleTarget_name_get(PointerRNA *ptr, char *str)
 {
-	ParticleTarget *pt= ptr->data;
+	ParticleTarget *pt = ptr->data;
 
-	if(pt->flag & PTARGET_VALID) {
+	if (pt->flag & PTARGET_VALID) {
 		ParticleSystem *psys = NULL;
 
-		if(pt->ob)
+		if (pt->ob)
 			psys = BLI_findlink(&pt->ob->particlesystem, pt->psys-1);
 		else {
 			Object *ob = (Object*) ptr->id.data;
 			psys = BLI_findlink(&ob->particlesystem, pt->psys-1);
 		}
 		
-		if(psys) {
-			if(pt->ob)
+		if (psys) {
+			if (pt->ob)
 				sprintf(str, "%s: %s", pt->ob->id.name+2, psys->name);
 			else
 				strcpy(str, psys->name);
@@ -614,7 +616,7 @@ static void rna_ParticleTarget_name_get(PointerRNA *ptr, char *str)
 
 static int particle_id_check(PointerRNA *ptr)
 {
-	ID *id= ptr->id.data;
+	ID *id = ptr->id.data;
 
 	return (GS(id->name) == ID_PA);
 }
@@ -623,7 +625,7 @@ static char *rna_SPHFluidSettings_path(PointerRNA *ptr)
 {
 	SPHFluidSettings *fluid = (SPHFluidSettings *)ptr->data;
 	
-	if(particle_id_check(ptr)) {
+	if (particle_id_check(ptr)) {
 		ParticleSettings *part = (ParticleSettings*)ptr->id.data;
 		
 		if (part->fluid == fluid)
@@ -634,52 +636,52 @@ static char *rna_SPHFluidSettings_path(PointerRNA *ptr)
 
 static int rna_ParticleSystem_multiple_caches_get(PointerRNA *ptr)
 {
-	ParticleSystem *psys= (ParticleSystem*)ptr->data;
+	ParticleSystem *psys = (ParticleSystem*)ptr->data;
 
 	return (psys->ptcaches.first != psys->ptcaches.last);
 }
 static int rna_ParticleSystem_editable_get(PointerRNA *ptr)
 {
-	ParticleSystem *psys= (ParticleSystem*)ptr->data;
+	ParticleSystem *psys = (ParticleSystem*)ptr->data;
 
 	return psys_check_edited(psys);
 }
 static int rna_ParticleSystem_edited_get(PointerRNA *ptr)
 {
-	ParticleSystem *psys= (ParticleSystem*)ptr->data;
+	ParticleSystem *psys = (ParticleSystem*)ptr->data;
 
-	if(psys->part && psys->part->type==PART_HAIR)
+	if (psys->part && psys->part->type == PART_HAIR)
 		return (psys->flag & PSYS_EDITED || (psys->edit && psys->edit->edited));
 	else
 		return (psys->pointcache->edit && psys->pointcache->edit->edited);
 }
 static PointerRNA rna_ParticleDupliWeight_active_get(PointerRNA *ptr)
 {
-	ParticleSettings *part= (ParticleSettings*)ptr->id.data;
+	ParticleSettings *part = (ParticleSettings*)ptr->id.data;
 	ParticleDupliWeight *dw = part->dupliweights.first;
 
-	for(; dw; dw=dw->next) {
-		if(dw->flag & PART_DUPLIW_CURRENT)
+	for (; dw; dw = dw->next) {
+		if (dw->flag & PART_DUPLIW_CURRENT)
 			return rna_pointer_inherit_refine(ptr, &RNA_ParticleDupliWeight, dw);
 	}
 	return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, NULL);
 }
-static void rna_ParticleDupliWeight_active_index_range(PointerRNA *ptr, int *min, int *max)
+static void rna_ParticleDupliWeight_active_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
 {
-	ParticleSettings *part= (ParticleSettings*)ptr->id.data;
-	*min= 0;
-	*max= BLI_countlist(&part->dupliweights)-1;
-	*max= MAX2(0, *max);
+	ParticleSettings *part = (ParticleSettings*)ptr->id.data;
+	*min = 0;
+	*max = BLI_countlist(&part->dupliweights)-1;
+	*max = MAX2(0, *max);
 }
 
 static int rna_ParticleDupliWeight_active_index_get(PointerRNA *ptr)
 {
-	ParticleSettings *part= (ParticleSettings*)ptr->id.data;
+	ParticleSettings *part = (ParticleSettings*)ptr->id.data;
 	ParticleDupliWeight *dw = part->dupliweights.first;
-	int i=0;
+	int i = 0;
 
-	for(; dw; dw=dw->next, i++)
-		if(dw->flag & PART_DUPLIW_CURRENT)
+	for (; dw; dw = dw->next, i++)
+		if (dw->flag & PART_DUPLIW_CURRENT)
 			return i;
 
 	return 0;
@@ -687,12 +689,12 @@ static int rna_ParticleDupliWeight_active_index_get(PointerRNA *ptr)
 
 static void rna_ParticleDupliWeight_active_index_set(struct PointerRNA *ptr, int value)
 {
-	ParticleSettings *part= (ParticleSettings*)ptr->id.data;
+	ParticleSettings *part = (ParticleSettings*)ptr->id.data;
 	ParticleDupliWeight *dw = part->dupliweights.first;
-	int i=0;
+	int i = 0;
 
-	for(; dw; dw=dw->next, i++) {
-		if(i==value)
+	for (; dw; dw = dw->next, i++) {
+		if (i == value)
 			dw->flag |= PART_DUPLIW_CURRENT;
 		else
 			dw->flag &= ~PART_DUPLIW_CURRENT;
@@ -710,47 +712,51 @@ static int rna_ParticleDupliWeight_name_length(PointerRNA *ptr)
 
 static void rna_ParticleDupliWeight_name_get(PointerRNA *ptr, char *str)
 {
-	ParticleDupliWeight *dw= ptr->data;
+	ParticleDupliWeight *dw = ptr->data;
 
-	if(dw->ob)
+	if (dw->ob)
 		sprintf(str, "%s: %i", dw->ob->id.name+2, dw->count);
 	else
 		strcpy(str, "No object");
 }
 
-static EnumPropertyItem *rna_Particle_from_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *UNUSED(free))
+static EnumPropertyItem *rna_Particle_from_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr),
+                                                 PropertyRNA *UNUSED(prop), int *UNUSED(free))
 {
-	//if(part->type==PART_REACTOR)
-	//	return part_reactor_from_items;
-	//else
+	/*if (part->type==PART_REACTOR) */
+	/*	return part_reactor_from_items; */
+	/*else */
 		return part_from_items;
 }
 
-static EnumPropertyItem *rna_Particle_dist_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
+static EnumPropertyItem *rna_Particle_dist_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+                                                 PropertyRNA *UNUSED(prop), int *UNUSED(free))
 {
 	ParticleSettings *part = ptr->id.data;
 
-	if(part->type==PART_HAIR)
+	if (part->type == PART_HAIR)
 		return part_hair_dist_items;
 	else
 		return part_dist_items;
 }
 
-static EnumPropertyItem *rna_Particle_draw_as_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
+static EnumPropertyItem *rna_Particle_draw_as_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+                                                    PropertyRNA *UNUSED(prop), int *UNUSED(free))
 {
 	ParticleSettings *part = ptr->id.data;
 
-	if(part->type==PART_HAIR)
+	if (part->type == PART_HAIR)
 		return part_hair_draw_as_items;
 	else
 		return part_draw_as_items;
 }
 
-static EnumPropertyItem *rna_Particle_ren_as_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
+static EnumPropertyItem *rna_Particle_ren_as_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+                                                   PropertyRNA *UNUSED(prop), int *UNUSED(free))
 {
 	ParticleSettings *part = ptr->id.data;
 
-	if(part->type==PART_HAIR)
+	if (part->type == PART_HAIR)
 		return part_hair_ren_as_items;
 	else
 		return part_ren_as_items;
@@ -758,51 +764,51 @@ static EnumPropertyItem *rna_Particle_ren_as_itemf(bContext *UNUSED(C), PointerR
 
 static PointerRNA rna_Particle_field1_get(PointerRNA *ptr)
 {
-	ParticleSettings *part= (ParticleSettings*)ptr->id.data;
+	ParticleSettings *part = (ParticleSettings*)ptr->id.data;
 
 	/* weak */
-	if(!part->pd)
-		part->pd= object_add_collision_fields(0);
+	if (!part->pd)
+		part->pd = object_add_collision_fields(0);
 	
 	return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd);
 }
 
 static PointerRNA rna_Particle_field2_get(PointerRNA *ptr)
 {
-	ParticleSettings *part= (ParticleSettings*)ptr->id.data;
+	ParticleSettings *part = (ParticleSettings*)ptr->id.data;
 
 	/* weak */
-	if(!part->pd2)
-		part->pd2= object_add_collision_fields(0);
+	if (!part->pd2)
+		part->pd2 = object_add_collision_fields(0);
 	
 	return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd2);
 }
 
 static void psys_vg_name_get__internal(PointerRNA *ptr, char *value, int index)
 {
-	Object *ob= ptr->id.data;
-	ParticleSystem *psys= (ParticleSystem*)ptr->data;
+	Object *ob = ptr->id.data;
+	ParticleSystem *psys = (ParticleSystem*)ptr->data;
 
-	if(psys->vgroup[index] > 0) {
-		bDeformGroup *defGroup= BLI_findlink(&ob->defbase, psys->vgroup[index]-1);
+	if (psys->vgroup[index] > 0) {
+		bDeformGroup *defGroup = BLI_findlink(&ob->defbase, psys->vgroup[index]-1);
 
-		if(defGroup) {
+		if (defGroup) {
 			strcpy(value, defGroup->name);
 			return;
 		}
 	}
 
-	value[0]= '\0';
+	value[0] = '\0';
 }
 static int psys_vg_name_len__internal(PointerRNA *ptr, int index)
 {
-	Object *ob= ptr->id.data;
-	ParticleSystem *psys= (ParticleSystem*)ptr->data;
+	Object *ob = ptr->id.data;
+	ParticleSystem *psys = (ParticleSystem*)ptr->data;
 
-	if(psys->vgroup[index] > 0) {
-		bDeformGroup *defGroup= BLI_findlink(&ob->defbase, psys->vgroup[index]-1);
+	if (psys->vgroup[index] > 0) {
+		bDeformGroup *defGroup = BLI_findlink(&ob->defbase, psys->vgroup[index]-1);
 
-		if(defGroup) {
+		if (defGroup) {
 			return strlen(defGroup->name);
 		}
 	}
@@ -810,46 +816,46 @@ static int psys_vg_name_len__internal(PointerRNA *ptr, int index)
 }
 static void psys_vg_name_set__internal(PointerRNA *ptr, const char *value, int index)
 {
-	Object *ob= ptr->id.data;
-	ParticleSystem *psys= (ParticleSystem*)ptr->data;
+	Object *ob = ptr->id.data;
+	ParticleSystem *psys = (ParticleSystem*)ptr->data;
 
-	if(value[0]=='\0') {
-		psys->vgroup[index]= 0;
+	if (value[0] =='\0') {
+		psys->vgroup[index] = 0;
 	}
 	else {
 		int vgroup_num = defgroup_name_index(ob, value);
 
-		if(vgroup_num == -1)
+		if (vgroup_num == -1)
 			return;
 
-		psys->vgroup[index]= vgroup_num + 1;
+		psys->vgroup[index] = vgroup_num + 1;
 	}
 }
 
 static char *rna_ParticleSystem_path(PointerRNA *ptr)
 {
-	ParticleSystem *psys= (ParticleSystem*)ptr->data;
+	ParticleSystem *psys = (ParticleSystem*)ptr->data;
 	return BLI_sprintfN("particle_systems[\"%s\"]", psys->name);
 }
 
 static void rna_ParticleSettings_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	ParticleSettings *part= (ParticleSettings*)ptr->data;
+	ParticleSettings *part = (ParticleSettings*)ptr->data;
 	rna_iterator_array_begin(iter, (void*)part->mtex, sizeof(MTex*), MAX_MTEX, 0, NULL);
 }
 
 static PointerRNA rna_ParticleSettings_active_texture_get(PointerRNA *ptr)
 {
-	ParticleSettings *part= (ParticleSettings*)ptr->data;
+	ParticleSettings *part = (ParticleSettings*)ptr->data;
 	Tex *tex;
 
-	tex= give_current_particle_texture(part);
+	tex = give_current_particle_texture(part);
 	return rna_pointer_inherit_refine(ptr, &RNA_Texture, tex);
 }
 
 static void rna_ParticleSettings_active_texture_set(PointerRNA *ptr, PointerRNA value)
 {
-	ParticleSettings *part= (ParticleSettings*)ptr->data;
+	ParticleSettings *part = (ParticleSettings*)ptr->data;
 
 	set_current_particle_texture(part, value.data);
 }
@@ -906,21 +912,24 @@ static void rna_def_particle_hair_key(BlenderRNA *brna)
 	RNA_def_struct_sdna(srna, "HairKey");
 	RNA_def_struct_ui_text(srna, "Particle Hair Key", "Particle key for hair particle system");
 
-	prop= RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
 	RNA_def_property_ui_text(prop, "Time", "Relative time of key over hair length");
 
-	prop= RNA_def_property(srna, "weight", PROP_FLOAT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_UNSIGNED);
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_text(prop, "Weight", "Weight for cloth simulation");
 
-	prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Location (Object Space)", "Location of the hair key in object space");
-	RNA_def_property_float_funcs(prop, "rna_ParticleHairKey_location_object_get", "rna_ParticleHairKey_location_object_set", NULL);
+	RNA_def_property_float_funcs(prop, "rna_ParticleHairKey_location_object_get",
+	                             "rna_ParticleHairKey_location_object_set", NULL);
 	
-	prop= RNA_def_property(srna, "co_hair_space", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "co_hair_space", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "co");
-	RNA_def_property_ui_text(prop, "Location", "Location of the hair key in its internal coordinate system, relative to the emitting face");
+	RNA_def_property_ui_text(prop, "Location",
+	                         "Location of the hair key in its internal coordinate system, "
+	                         "relative to the emitting face");
 }
 
 static void rna_def_particle_key(BlenderRNA *brna)
@@ -931,40 +940,41 @@ static void rna_def_particle_key(BlenderRNA *brna)
 	srna = RNA_def_struct(brna, "ParticleKey", NULL);
 	RNA_def_struct_ui_text(srna, "Particle Key", "Key location for a particle over time");
 
-	prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "co");
 	RNA_def_property_ui_text(prop, "Location", "Key location");
 
-	prop= RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
+	prop = RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
 	RNA_def_property_float_sdna(prop, NULL, "vel");
 	RNA_def_property_ui_text(prop, "Velocity", "Key velocity");
 
-	prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
+	prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
 	RNA_def_property_float_sdna(prop, NULL, "rot");
 	RNA_def_property_ui_text(prop, "Rotation", "Key rotation quaternion");
 
-	prop= RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
+	prop = RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
 	RNA_def_property_float_sdna(prop, NULL, "ave");
 	RNA_def_property_ui_text(prop, "Angular Velocity", "Key angular velocity");
 
-	prop= RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
 	RNA_def_property_ui_text(prop, "Time", "Time of key over the simulation");
 }
 
 static void rna_def_child_particle(BlenderRNA *brna)
 {
 	StructRNA *srna;
-	//PropertyRNA *prop;
+	/*PropertyRNA *prop; */
 
 	srna = RNA_def_struct(brna, "ChildParticle", NULL);
-	RNA_def_struct_ui_text(srna, "Child Particle", "Child particle interpolated from simulated or edited particles");
+	RNA_def_struct_ui_text(srna, "Child Particle",
+	                       "Child particle interpolated from simulated or edited particles");
 
-//	int num, parent;	/* num is face index on the final derived mesh */
+/*	int num, parent;	 *//* num is face index on the final derived mesh */
 
-//	int pa[4];			/* nearest particles to the child, used for the interpolation */
-//	float w[4];			/* interpolation weights for the above particles */
-//	float fuv[4], foffset; /* face vertex weights and offset */
-//	float rand[3];
+/*	int pa[4];			 *//* nearest particles to the child, used for the interpolation */
+/*	float w[4];			 *//* interpolation weights for the above particles */
+/*	float fuv[4], foffset;  *//* face vertex weights and offset */
+/*	float rand[3]; */
 }
 
 static void rna_def_particle(BlenderRNA *brna)
@@ -973,7 +983,7 @@ static void rna_def_particle(BlenderRNA *brna)
 	PropertyRNA *prop;
 
 	static EnumPropertyItem alive_items[] = {
-		//{PARS_KILLED, "KILLED", 0, "Killed", ""},
+		/*{PARS_KILLED, "KILLED", 0, "Killed", ""}, */
 		{PARS_DEAD, "DEAD", 0, "Dead", ""},
 		{PARS_UNBORN, "UNBORN", 0, "Unborn", ""},
 		{PARS_ALIVE, "ALIVE", 0, "Alive", ""},
@@ -986,95 +996,95 @@ static void rna_def_particle(BlenderRNA *brna)
 	RNA_def_struct_ui_text(srna, "Particle", "Particle in a particle system");
 
 	/* Particle State & Previous State */
-	prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "state.co");
 	RNA_def_property_ui_text(prop, "Particle Location", "");
 
-	prop= RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
+	prop = RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
 	RNA_def_property_float_sdna(prop, NULL, "state.vel");
 	RNA_def_property_ui_text(prop, "Particle Velocity", "");
 
-	prop= RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
+	prop = RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
 	RNA_def_property_float_sdna(prop, NULL, "state.ave");
 	RNA_def_property_ui_text(prop, "Angular Velocity", "");
 
-	prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
+	prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
 	RNA_def_property_float_sdna(prop, NULL, "state.rot");
 	RNA_def_property_ui_text(prop, "Rotation", "");
 
-	prop= RNA_def_property(srna, "prev_location", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "prev_location", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "prev_state.co");
 	RNA_def_property_ui_text(prop, "Previous Particle Location", "");
 
-	prop= RNA_def_property(srna, "prev_velocity", PROP_FLOAT, PROP_VELOCITY);
+	prop = RNA_def_property(srna, "prev_velocity", PROP_FLOAT, PROP_VELOCITY);
 	RNA_def_property_float_sdna(prop, NULL, "prev_state.vel");
 	RNA_def_property_ui_text(prop, "Previous Particle Velocity", "");
 
-	prop= RNA_def_property(srna, "prev_angular_velocity", PROP_FLOAT, PROP_VELOCITY);
+	prop = RNA_def_property(srna, "prev_angular_velocity", PROP_FLOAT, PROP_VELOCITY);
 	RNA_def_property_float_sdna(prop, NULL, "prev_state.ave");
 	RNA_def_property_ui_text(prop, "Previous Angular Velocity", "");
 
-	prop= RNA_def_property(srna, "prev_rotation", PROP_FLOAT, PROP_QUATERNION);
+	prop = RNA_def_property(srna, "prev_rotation", PROP_FLOAT, PROP_QUATERNION);
 	RNA_def_property_float_sdna(prop, NULL, "prev_state.rot");
 	RNA_def_property_ui_text(prop, "Previous Rotation", "");
 
 	/* Hair & Keyed Keys */
 
-	prop= RNA_def_property(srna, "hair_keys", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "hair_keys", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "hair", "totkey");
 	RNA_def_property_struct_type(prop, "ParticleHairKey");
 	RNA_def_property_ui_text(prop, "Hair", "");
 
-	prop= RNA_def_property(srna, "particle_keys", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "particle_keys", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "keys", "totkey");
 	RNA_def_property_struct_type(prop, "ParticleKey");
 	RNA_def_property_ui_text(prop, "Keyed States", "");
-//
-//	float fuv[4], foffset;	/* coordinates on face/edge number "num" and depth along*/
-//							/* face normal for volume emission						*/
+/* */
+/*	float fuv[4], foffset;	 *//* coordinates on face/edge number "num" and depth along*/
+/*							 *//* face normal for volume emission						*/
 
-	prop= RNA_def_property(srna, "birth_time", PROP_FLOAT, PROP_TIME);
+	prop = RNA_def_property(srna, "birth_time", PROP_FLOAT, PROP_TIME);
 	RNA_def_property_float_sdna(prop, NULL, "time");
-//	RNA_def_property_range(prop, lowerLimitf, upperLimitf);
+/*	RNA_def_property_range(prop, lowerLimitf, upperLimitf); */
 	RNA_def_property_ui_text(prop, "Birth Time", "");
 
-	prop= RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
-//	RNA_def_property_range(prop, lowerLimitf, upperLimitf);
+	prop = RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
+/*	RNA_def_property_range(prop, lowerLimitf, upperLimitf); */
 	RNA_def_property_ui_text(prop, "Lifetime", "");
 
-	prop= RNA_def_property(srna, "die_time", PROP_FLOAT, PROP_TIME);
+	prop = RNA_def_property(srna, "die_time", PROP_FLOAT, PROP_TIME);
 	RNA_def_property_float_sdna(prop, NULL, "dietime");
-//	RNA_def_property_range(prop, lowerLimitf, upperLimitf);
+/*	RNA_def_property_range(prop, lowerLimitf, upperLimitf); */
 	RNA_def_property_ui_text(prop, "Die Time", "");
 
-	prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
-//	RNA_def_property_range(prop, lowerLimitf, upperLimitf);
+	prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
+/*	RNA_def_property_range(prop, lowerLimitf, upperLimitf); */
 	RNA_def_property_ui_text(prop, "Size", "");
 
-//
-//	int num;				/* index to vert/edge/face */
-//	int num_dmcache;		/* index to derived mesh data (face) to avoid slow lookups */
-//	int pad;
-//
-//	int totkey;
+/* */
+/*	int num;				 *//* index to vert/edge/face */
+/*	int num_dmcache;		 *//* index to derived mesh data (face) to avoid slow lookups */
+/*	int pad; */
+/* */
+/*	int totkey; */
 
 	/* flag */
-	prop= RNA_def_property(srna, "is_exist", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_exist", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PARS_UNEXIST);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Exists", "");
 
-	prop= RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PARS_NO_DISP);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Visible", "");
 
-	prop= RNA_def_property(srna, "alive_state", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "alive_state", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "alive");
 	RNA_def_property_enum_items(prop, alive_items);
 	RNA_def_property_ui_text(prop, "Alive State", "");
 
-//	short rt2;
+/*	short rt2; */
 }
 
 static void rna_def_particle_dupliweight(BlenderRNA *brna)
@@ -1086,15 +1096,17 @@ static void rna_def_particle_dupliweight(BlenderRNA *brna)
 	RNA_def_struct_ui_text(srna, "Particle Dupliobject Weight", "Weight of a particle dupliobject in a group");
 	RNA_def_struct_sdna(srna, "ParticleDupliWeight");
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
-	RNA_def_property_string_funcs(prop, "rna_ParticleDupliWeight_name_get", "rna_ParticleDupliWeight_name_length", NULL);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_funcs(prop, "rna_ParticleDupliWeight_name_get",
+	                              "rna_ParticleDupliWeight_name_length", NULL);
 	RNA_def_property_ui_text(prop, "Name", "Particle dupliobject name");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_struct_name_property(srna, prop);
 
-	prop= RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_range(prop, 0, SHRT_MAX);
-	RNA_def_property_ui_text(prop, "Count", "The number of times this object is repeated with respect to other objects");
+	RNA_def_property_ui_text(prop, "Count",
+	                         "The number of times this object is repeated with respect to other objects");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 }
 
@@ -1108,83 +1120,88 @@ static void rna_def_fluid_settings(BlenderRNA *brna)
 	RNA_def_struct_ui_text(srna, "SPH Fluid Settings", "Settings for particle fluids physics");
 	
 	/* Fluid settings */
-	prop= RNA_def_property(srna, "spring_force", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "spring_force", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "spring_k");
 	RNA_def_property_range(prop, 0.0f, 100.0f);
 	RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
 	RNA_def_property_ui_text(prop, "Spring Force", "Spring force");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "fluid_radius", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "fluid_radius", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "radius");
 	RNA_def_property_range(prop, 0.0f, 20.0f);
 	RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
 	RNA_def_property_ui_text(prop, "Interaction Radius", "Fluid interaction radius");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 2.0f);
 	RNA_def_property_ui_text(prop, "Rest Length", "Spring rest length (factor of particle radius)");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "use_viscoelastic_springs", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_viscoelastic_springs", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_VISCOELASTIC_SPRINGS);
 	RNA_def_property_ui_text(prop, "Viscoelastic Springs", "Use viscoelastic springs instead of Hooke's springs");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "use_initial_rest_length", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_initial_rest_length", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_CURRENT_REST_LENGTH);
-	RNA_def_property_ui_text(prop, "Initial Rest Length", "Use the initial length as spring rest length instead of 2 * particle size");
+	RNA_def_property_ui_text(prop, "Initial Rest Length",
+	                         "Use the initial length as spring rest length instead of 2 * particle size");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "plasticity", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "plasticity", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "plasticity_constant");
 	RNA_def_property_range(prop, 0.0f, 100.0f);
-	RNA_def_property_ui_text(prop, "Plasticity", "How much the spring rest length can change after the elastic limit is crossed");
+	RNA_def_property_ui_text(prop, "Plasticity",
+	                         "How much the spring rest length can change after the elastic limit is crossed");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "yield_ratio", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "yield_ratio", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "yield_ratio");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
-	RNA_def_property_ui_text(prop, "Elastic Limit", "How much the spring has to be stretched/compressed in order to change it's rest length");
+	RNA_def_property_ui_text(prop, "Elastic Limit",
+	                         "How much the spring has to be stretched/compressed in order to change it's rest length");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "spring_frames", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "spring_frames", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 100.0f);
-	RNA_def_property_ui_text(prop, "Spring Frames", "Create springs for this number of frames since particles birth (0 is always)");
+	RNA_def_property_ui_text(prop, "Spring Frames",
+	                         "Create springs for this number of frames since particles birth (0 is always)");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
 	/* Viscosity */
-	prop= RNA_def_property(srna, "linear_viscosity", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "linear_viscosity", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "viscosity_omega");
 	RNA_def_property_range(prop, 0.0f, 100.0f);
 	RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
 	RNA_def_property_ui_text(prop, "Viscosity", "Linear viscosity");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "stiff_viscosity", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "stiff_viscosity", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "viscosity_beta");
 	RNA_def_property_range(prop, 0.0f, 100.0f);
 	RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
-	RNA_def_property_ui_text(prop, "Stiff viscosity", "Creates viscosity for expanding fluid)");
+	RNA_def_property_ui_text(prop, "Stiff viscosity", "Creates viscosity for expanding fluid");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
 	/* Double density relaxation */
-	prop= RNA_def_property(srna, "stiffness", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "stiffness", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "stiffness_k");
 	RNA_def_property_range(prop, 0.0f, 100.0f);
 	RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
 	RNA_def_property_ui_text(prop, "Stiffness", "How incompressible the fluid is");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "repulsion", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "repulsion", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "stiffness_knear");
 	RNA_def_property_range(prop, 0.0f, 100.0f);
 	RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
-	RNA_def_property_ui_text(prop, "Repulsion Factor", "How strongly the fluid tries to keep from clustering (factor of stiffness)");
+	RNA_def_property_ui_text(prop, "Repulsion Factor",
+	                         "How strongly the fluid tries to keep from clustering (factor of stiffness)");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "rest_density", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "rest_density", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "rest_density");
 	RNA_def_property_range(prop, 0.0f, 100.0f);
 	RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
@@ -1192,36 +1209,39 @@ static void rna_def_fluid_settings(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
 	/* Buoyancy */
-	prop= RNA_def_property(srna, "buoyancy", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "buoyancy", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "buoyancy");
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3);
-	RNA_def_property_ui_text(prop, "Buoyancy", "Artificial buoyancy force in negative gravity direction based on pressure differences inside the fluid");
+	RNA_def_property_ui_text(prop, "Buoyancy",
+	                         "Artificial buoyancy force in negative gravity direction based on pressure "
+	                         "differences inside the fluid");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
 	/* Factor flags */
 
-	prop= RNA_def_property(srna, "factor_repulsion", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "factor_repulsion", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_REPULSION);
 	RNA_def_property_ui_text(prop, "Factor Repulsion", "Repulsion is a factor of stiffness");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "factor_density", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "factor_density", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_DENSITY);
-	RNA_def_property_ui_text(prop, "Factor Density", "Density is calculated as a factor of default density (depends on particle size)");
+	RNA_def_property_ui_text(prop, "Factor Density",
+	                         "Density is calculated as a factor of default density (depends on particle size)");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "factor_radius", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "factor_radius", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_RADIUS);
 	RNA_def_property_ui_text(prop, "Factor Radius", "Interaction radius is a factor of 4 * particle size");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "factor_stiff_viscosity", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "factor_stiff_viscosity", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_VISCOSITY);
 	RNA_def_property_ui_text(prop, "Factor Stiff Viscosity", "Stiff viscosity is a factor of normal viscosity");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "factor_rest_length", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "factor_rest_length", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_REST_LENGTH);
 	RNA_def_property_ui_text(prop, "Factor Rest Length", "Spring rest length is a factor of 2 * particle size");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
@@ -1237,7 +1257,8 @@ static void rna_def_particle_settings_mtex(BlenderRNA *brna)
 		{TEXCO_OBJECT, "OBJECT", 0, "Object", "Use linked object's coordinates for texture coordinates"},
 		{TEXCO_UV, "UV", 0, "UV", "Use UV coordinates for texture coordinates"},
 		{TEXCO_ORCO, "ORCO", 0, "Generated", "Use the original undeformed coordinates of the object"},
-		{TEXCO_STRAND, "STRAND", 0, "Strand / Particle", "Use normalized strand texture coordinate (1D) or particle age (X) and trail position (Y)"},
+		{TEXCO_STRAND, "STRAND", 0, "Strand / Particle",
+		               "Use normalized strand texture coordinate (1D) or particle age (X) and trail position (Y)"},
 		{0, NULL, 0, NULL, NULL}};
 
 	static EnumPropertyItem prop_mapping_items[] = {
@@ -1268,183 +1289,185 @@ static void rna_def_particle_settings_mtex(BlenderRNA *brna)
 		{3, "Z", 0, "Z", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "ParticleSettingsTextureSlot", "TextureSlot");
+	srna = RNA_def_struct(brna, "ParticleSettingsTextureSlot", "TextureSlot");
 	RNA_def_struct_sdna(srna, "MTex");
-	RNA_def_struct_ui_text(srna, "Particle Settings Texture Slot", "Texture slot for textures in a Particle Settings datablock");
+	RNA_def_struct_ui_text(srna, "Particle Settings Texture Slot",
+	                       "Texture slot for textures in a Particle Settings datablock");
 
-	prop= RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "texco");
 	RNA_def_property_enum_items(prop, texco_items);
-	RNA_def_property_ui_text(prop, "Texture Coordinates", "Texture coordinates used to map the texture onto the background");
+	RNA_def_property_ui_text(prop, "Texture Coordinates",
+	                         "Texture coordinates used to map the texture onto the background");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "object");
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Object", "Object to use for mapping with Object texture coordinates");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "uvname");
 	RNA_def_property_ui_text(prop, "UV Map", "UV map to use for mapping with UV texture coordinates");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "projx");
 	RNA_def_property_enum_items(prop, prop_x_mapping_items);
 	RNA_def_property_ui_text(prop, "X Mapping", "");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 	
-	prop= RNA_def_property(srna, "mapping_y", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mapping_y", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "projy");
 	RNA_def_property_enum_items(prop, prop_y_mapping_items);
 	RNA_def_property_ui_text(prop, "Y Mapping", "");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 	
-	prop= RNA_def_property(srna, "mapping_z", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mapping_z", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "projz");
 	RNA_def_property_enum_items(prop, prop_z_mapping_items);
 	RNA_def_property_ui_text(prop, "Z Mapping", "");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 	
-	prop= RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, prop_mapping_items);
 	RNA_def_property_ui_text(prop, "Mapping", "");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
 	/* map to */
-	prop= RNA_def_property(srna, "use_map_time", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_time", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_TIME);
 	RNA_def_property_ui_text(prop, "Emission Time", "Affect the emission time of the particles");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "use_map_life", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_life", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_LIFE);
 	RNA_def_property_ui_text(prop, "Life Time", "Affect the life time of the particles");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "use_map_density", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_density", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_DENS);
 	RNA_def_property_ui_text(prop, "Density", "Affect the density of the particles");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "use_map_size", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_size", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_SIZE);
 	RNA_def_property_ui_text(prop, "Size", "Affect the particle size");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "use_map_velocity", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_velocity", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_IVEL);
 	RNA_def_property_ui_text(prop, "Initial Velocity", "Affect the particle initial velocity");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "use_map_field", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_field", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_FIELD);
 	RNA_def_property_ui_text(prop, "Force Field", "Affect the particle force fields");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "use_map_gravity", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_gravity", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_GRAVITY);
 	RNA_def_property_ui_text(prop, "Gravity", "Affect the particle gravity");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "use_map_damp", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_damp", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_DAMP);
 	RNA_def_property_ui_text(prop, "Damp", "Affect the particle velocity damping");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "use_map_clump", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_clump", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_CLUMP);
 	RNA_def_property_ui_text(prop, "Clump", "Affect the child clumping");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "use_map_kink", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_kink", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_KINK);
 	RNA_def_property_ui_text(prop, "Kink", "Affect the child kink");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "use_map_rough", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_rough", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_ROUGH);
 	RNA_def_property_ui_text(prop, "Rough", "Affect the child rough");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "use_map_length", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_length", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_LENGTH);
 	RNA_def_property_ui_text(prop, "Length", "Affect the child hair length");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
 
 	/* influence factors */
-	prop= RNA_def_property(srna, "time_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "time_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "timefac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Emission Time Factor", "Amount texture affects particle emission time");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "life_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "life_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "lifefac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Life Time Factor", "Amount texture affects particle life time");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "density_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "density_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "padensfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Density Factor", "Amount texture affects particle density");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "size_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "size_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "sizefac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Size Factor", "Amount texture affects physical particle size");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "ivelfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Velocity Factor", "Amount texture affects particle initial velocity");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
 
-	prop= RNA_def_property(srna, "field_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "field_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "fieldfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Field Factor", "Amount texture affects particle force fields");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "gravity_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "gravity_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "gravityfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Gravity Factor", "Amount texture affects particle gravity");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "damp_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "damp_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "dampfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Damp Factor", "Amount texture affects particle damping");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
 
-	prop= RNA_def_property(srna, "length_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "length_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "lengthfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Length Factor", "Amount texture affects child hair length");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "clumpfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Clump Factor", "Amount texture affects child clump");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "kink_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "kink_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "kinkfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Kink Factor", "Amount texture affects child kink");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "rough_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "rough_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "roughfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Rough Factor", "Amount texture affects child roughness");
@@ -1458,7 +1481,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
 
 	static EnumPropertyItem type_items[] = {
 		{PART_EMITTER, "EMITTER", 0, "Emitter", ""},
-		//{PART_REACTOR, "REACTOR", 0, "Reactor", ""},
+		/*{PART_REACTOR, "REACTOR", 0, "Reactor", ""}, */
 		{PART_HAIR, "HAIR", 0, "Hair", ""},
 		{0, NULL, 0, NULL, NULL}
 	};
@@ -1487,7 +1510,12 @@ static void rna_def_particle_settings(BlenderRNA *brna)
 
 	static EnumPropertyItem ave_mode_items[] = {
 		{0, "NONE", 0, "None", ""},
-		{PART_AVE_SPIN, "SPIN", 0, "Spin", ""},
+		{PART_AVE_VELOCITY, "VELOCITY", 0, "Velocity", ""},
+		{PART_AVE_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""},
+		{PART_AVE_VERTICAL, "VERTICAL", 0, "Vertical", ""},
+		{PART_AVE_GLOBAL_X, "GLOBAL_X", 0, "Global X", ""},
+		{PART_AVE_GLOBAL_Y, "GLOBAL_Y", 0, "Global Y", ""},
+		{PART_AVE_GLOBAL_Z, "GLOBAL_Z", 0, "Global Z", ""},
 		{PART_AVE_RAND, "RAND", 0, "Random", ""} ,
 		{0, NULL, 0, NULL, NULL}
 	};
@@ -1506,7 +1534,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}
 	};
 
-	//TODO: names, tooltips
+	/*TODO: names, tooltips */
 #if 0
 	static EnumPropertyItem rot_from_items[] = {
 		{PART_ROT_KEYS, "KEYS", 0, "keys", ""},
@@ -1571,137 +1599,145 @@ static void rna_def_particle_settings(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}
 	};
 
-	srna= RNA_def_struct(brna, "ParticleSettings", "ID");
+	srna = RNA_def_struct(brna, "ParticleSettings", "ID");
 	RNA_def_struct_ui_text(srna, "Particle Settings", "Particle settings, reusable by multiple particle systems");
 	RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
 
 	rna_def_mtex_common(brna, srna, "rna_ParticleSettings_mtex_begin", "rna_ParticleSettings_active_texture_get",
-		"rna_ParticleSettings_active_texture_set", NULL, "ParticleSettingsTextureSlot", "ParticleSettingsTextureSlots", "rna_Particle_reset");
+	                    "rna_ParticleSettings_active_texture_set", NULL, "ParticleSettingsTextureSlot",
+	                    "ParticleSettingsTextureSlots", "rna_Particle_reset");
 
 	/* fluid particle type can't be checked from the type value in rna as it's not shown in the menu */
-	prop= RNA_def_property(srna, "is_fluid", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_fluid", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_PartSettings_is_fluid_get", NULL);
 	RNA_def_property_ui_text(prop, "Fluid", "Particles were created by a fluid simulation");
 
 	/* flag */
-	prop= RNA_def_property(srna, "use_react_start_end", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_react_start_end", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_STA_END);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Start/End", "Give birth to unreacted particles eventually");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "use_react_multiple", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_react_multiple", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_MULTIPLE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Multi React", "React multiple times");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "regrow_hair", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "regrow_hair", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_REGROW);
 	RNA_def_property_ui_text(prop, "Regrow", "Regrow hair for each frame");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_UNBORN);
 	RNA_def_property_ui_text(prop, "Unborn", "Show particles before they are emitted");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "use_dead", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_dead", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_DIED);
 	RNA_def_property_ui_text(prop, "Died", "Show particles after they have died");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "use_emit_random", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_emit_random", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_TRAND);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Random", "Emit in random order of elements");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "use_even_distribution", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_even_distribution", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_EDISTR);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-	RNA_def_property_ui_text(prop, "Even Distribution", "Use even distribution from faces based on face areas or edge lengths");
+	RNA_def_property_ui_text(prop, "Even Distribution",
+	                         "Use even distribution from faces based on face areas or edge lengths");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
  
-	prop= RNA_def_property(srna, "use_die_on_collision", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_die_on_collision", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_DIE_ON_COL);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Die on hit", "Particles die when they collide with a deflector object");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "use_size_deflect", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_size_deflect", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SIZE_DEFL);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Size Deflect", "Use particle's size in deflection");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "use_dynamic_rotation", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_rotations", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ROTATIONS);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+	RNA_def_property_ui_text(prop, "Rotations", "Calculate particle rotations");
+	RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+	prop = RNA_def_property(srna, "use_dynamic_rotation", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ROT_DYN);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-	RNA_def_property_ui_text(prop, "Dynamic", "Set rotation to dynamic/constant");
+	RNA_def_property_ui_text(prop, "Dynamic", "Particle rotations are effected by collisions and effectors");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "use_multiply_size_mass", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_multiply_size_mass", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SIZEMASS);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Mass from Size", "Multiply mass by particle size");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "use_advanced_hair", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_advanced_hair", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PART_HIDE_ADVANCED_HAIR);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Advanced", "Use full physics calculations for growing hair");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "lock_boids_to_surface", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_boids_to_surface", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_BOIDS_2D);
 	RNA_def_property_ui_text(prop, "Boids 2D", "Constrain boids to a surface");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "use_hair_bspline", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_hair_bspline", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_BSPLINE);
 	RNA_def_property_ui_text(prop, "B-Spline", "Interpolate hair using B-Splines");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "invert_grid", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_grid", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GRID_INVERT);
 	RNA_def_property_ui_text(prop, "Invert Grid", "Invert what is considered object and what is not");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "hexagonal_grid", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "hexagonal_grid", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GRID_HEXAGONAL);
 	RNA_def_property_ui_text(prop, "Hexagonal Grid", "Create the grid in a hexagonal pattern");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "apply_effector_to_children", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "apply_effector_to_children", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_EFFECT);
 	RNA_def_property_ui_text(prop, "Effect Children", "Apply effectors to children");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "create_long_hair_children", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "create_long_hair_children", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_LONG_HAIR);
 	RNA_def_property_ui_text(prop, "Long Hair", "Calculate children that suit long hair well");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "apply_guide_to_children", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "apply_guide_to_children", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_GUIDE);
 	RNA_def_property_ui_text(prop, "apply_guide_to_children", "");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "use_self_effect", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_self_effect", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SELF_EFFECT);
 	RNA_def_property_ui_text(prop, "Self Effect", "Particle effectors effect themselves");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
 
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, type_items);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Type", "Particle Type");
 	RNA_def_property_update(prop, 0, "rna_Particle_change_type");
 
-	prop= RNA_def_property(srna, "emit_from", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "emit_from", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "from");
 	RNA_def_property_enum_items(prop, part_reactor_from_items);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
@@ -1709,7 +1745,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Emit From", "Where to emit particles from");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "distr");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_items(prop, part_dist_items);
@@ -1719,28 +1755,29 @@ static void rna_def_particle_settings(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
 	/* physics modes */
-	prop= RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "phystype");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_items(prop, phys_type_items);
 	RNA_def_property_ui_text(prop, "Physics Type", "Particle physics type");
 	RNA_def_property_update(prop, 0, "rna_Particle_change_physics");
 
-	prop= RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "rotmode");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_items(prop, rot_mode_items);
-	RNA_def_property_ui_text(prop, "Rotation", "Particle rotation axis");
+	RNA_def_property_ui_text(prop, "Orientation axis",
+	                         "Particle orientation axis (does not affect Explode modifier's results)");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "angular_velocity_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "angular_velocity_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "avemode");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_items(prop, ave_mode_items);
-	RNA_def_property_ui_text(prop, "Angular Velocity Mode", "Particle angular velocity mode");
+	RNA_def_property_ui_text(prop, "Angular Velocity Axis", "What axis is used to change particle rotation with time");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "react_event", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "react_event", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "reactevent");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_items(prop, react_event_items);
@@ -1748,232 +1785,234 @@ static void rna_def_particle_settings(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
 	/*draw flag*/
-	prop= RNA_def_property(srna, "show_velocity", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_velocity", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_VEL);
 	RNA_def_property_ui_text(prop, "Velocity", "Show particle velocity");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "show_size", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_size", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_SIZE);
 	RNA_def_property_ui_text(prop, "Size", "Show particle size");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "use_render_emitter", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_render_emitter", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_EMITTER);
 	RNA_def_property_ui_text(prop, "Emitter", "Render emitter Object also");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "show_health", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_health", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_HEALTH);
 	RNA_def_property_ui_text(prop, "Health", "Draw boid health");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "use_absolute_path_time", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_absolute_path_time", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_ABS_PATH_TIME);
 	RNA_def_property_ui_text(prop, "Absolute Path Time", "Path timing is in absolute frames");
 	RNA_def_property_update(prop, 0, "rna_Particle_abspathtime_update");
 
-	prop= RNA_def_property(srna, "use_parent_particles", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_parent_particles", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_PARENT);
 	RNA_def_property_ui_text(prop, "Parents", "Render parent particles");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "show_number", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_number", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_NUM);
 	RNA_def_property_ui_text(prop, "Number", "Show particle number");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "use_group_pick_random", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_group_pick_random", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_RAND_GR);
 	RNA_def_property_ui_text(prop, "Pick Random", "Pick objects from group randomly");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "use_group_count", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_group_count", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_COUNT_GR);
 	RNA_def_property_ui_text(prop, "Use Count", "Use object multiple times in the same group");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "use_global_dupli", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_global_dupli", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_GLOBAL_OB);
 	RNA_def_property_ui_text(prop, "Global", "Use object's global coordinates for duplication");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "use_rotation_dupli", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_rotation_dupli", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_ROTATE_OB);
-	RNA_def_property_ui_text(prop, "Rotation", "Use object's rotation for duplication (global x-axis is aligned particle rotation axis)");
+	RNA_def_property_ui_text(prop, "Rotation",
+	                         "Use object's rotation for duplication (global x-axis is aligned "
+	                         "particle rotation axis)");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "use_render_adaptive", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_render_adaptive", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_REN_ADAPT);
 	RNA_def_property_ui_text(prop, "Adaptive render", "Draw steps of the particle path");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "use_velocity_length", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_velocity_length", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_VEL_LENGTH);
 	RNA_def_property_ui_text(prop, "Speed", "Multiply line length by particle speed");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "use_whole_group", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_whole_group", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_WHOLE_GR);
 	RNA_def_property_ui_text(prop, "Whole Group", "Use whole group at once");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "use_strand_primitive", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_strand_primitive", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_REN_STRAND);
 	RNA_def_property_ui_text(prop, "Strand render", "Use the strand primitive for rendering");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "draw_method", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "draw_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "draw_as");
 	RNA_def_property_enum_items(prop, part_draw_as_items);
 	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_draw_as_itemf");
 	RNA_def_property_ui_text(prop, "Particle Drawing", "How particles are drawn in viewport");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "render_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "render_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "ren_as");
 	RNA_def_property_enum_items(prop, part_ren_as_items);
 	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_ren_as_itemf");
 	RNA_def_property_ui_text(prop, "Particle Rendering", "How particles are rendered");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "draw_color", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "draw_color", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "draw_col");
 	RNA_def_property_enum_items(prop, draw_col_items);
 	RNA_def_property_ui_text(prop, "Draw Color", "Draw additional particle data as a color");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "draw_size", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "draw_size", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, 0, 1000);
 	RNA_def_property_ui_range(prop, 0, 100, 1, 0);
 	RNA_def_property_ui_text(prop, "Draw Size", "Size of particles on viewport in pixels (0=default)");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "child_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "child_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "childtype");
 	RNA_def_property_enum_items(prop, child_type_items);
 	RNA_def_property_ui_text(prop, "Children From", "Create child particles");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "draw_step", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "draw_step", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, 0, 10);
 	RNA_def_property_ui_range(prop, 0, 7, 1, 0);
 	RNA_def_property_ui_text(prop, "Steps", "How many steps paths are drawn with (power of 2)");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "render_step", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "render_step", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "ren_step");
 	RNA_def_property_range(prop, 0, 20);
 	RNA_def_property_ui_range(prop, 0, 9, 1, 0);
 	RNA_def_property_ui_text(prop, "Render", "How many steps paths are rendered with (power of 2)");
 
-	prop= RNA_def_property(srna, "hair_step", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "hair_step", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, 2, 50);
 	RNA_def_property_ui_text(prop, "Segments", "Number of hair segments");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
 
-	//TODO: not found in UI, readonly?
-	prop= RNA_def_property(srna, "keys_step", PROP_INT, PROP_NONE);
-	RNA_def_property_range(prop, 0, SHRT_MAX);//TODO:min,max
+	/*TODO: not found in UI, readonly? */
+	prop = RNA_def_property(srna, "keys_step", PROP_INT, PROP_NONE);
+	RNA_def_property_range(prop, 0, SHRT_MAX);/*TODO:min,max */
 	RNA_def_property_ui_text(prop, "Keys Step", "");
 
 	/* adaptive path rendering */
-	prop= RNA_def_property(srna, "adaptive_angle", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "adaptive_angle", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "adapt_angle");
 	RNA_def_property_range(prop, 0, 45);
 	RNA_def_property_ui_text(prop, "Degrees", "How many degrees path has to curve to make another render segment");
 
-	prop= RNA_def_property(srna, "adaptive_pixel", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "adaptive_pixel", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "adapt_pix");
 	RNA_def_property_range(prop, 0, 50);
 	RNA_def_property_ui_text(prop, "Pixel", "How many pixels path has to cover to make another render segment");
 
-	prop= RNA_def_property(srna, "draw_percentage", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "draw_percentage", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "disp");
 	RNA_def_property_range(prop, 0, 100);
 	RNA_def_property_ui_text(prop, "Display", "Percentage of particles to display in 3D view");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "material", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "material", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "omat");
 	RNA_def_property_range(prop, 1, 32767);
 	RNA_def_property_ui_text(prop, "Material", "Material used for the particles");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
 
-	// not used anywhere, why is this in DNA???
+	/* not used anywhere, why is this in DNA??? */
 #if 0
-	prop= RNA_def_property(srna, "rotate_from", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "rotate_from", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "rotfrom");
 	RNA_def_property_enum_items(prop, rot_from_items);
 	RNA_def_property_ui_text(prop, "Rotate From", "");
 #endif
 
-	prop= RNA_def_property(srna, "integrator", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "integrator", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, integrator_type_items);
 	RNA_def_property_ui_text(prop, "Integration",
 	                         "Algorithm used to calculate physics, from the fastest to the "
 	                         "most stable/accurate: Midpoint, Euler, Verlet, RK4 (Old)");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "kink", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "kink", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, kink_type_items);
 	RNA_def_property_ui_text(prop, "Kink", "Type of periodic offset on the path");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "kink_axis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "kink_axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, kink_axis_items);
 	RNA_def_property_ui_text(prop, "Axis", "Which axis to use for offset");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
 	/* billboards */
-	prop= RNA_def_property(srna, "lock_billboard", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_billboard", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_BB_LOCK);
 	RNA_def_property_ui_text(prop, "Lock Billboard", "Lock the billboards align axis");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "billboard_align", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "billboard_align", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "bb_align");
 	RNA_def_property_enum_items(prop, bb_align_items);
 	RNA_def_property_ui_text(prop, "Align to", "In respect to what the billboards are aligned");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "billboard_uv_split", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "billboard_uv_split", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "bb_uv_split");
 	RNA_def_property_range(prop, 1, 100);
 	RNA_def_property_ui_range(prop, 1, 10, 1, 0);
 	RNA_def_property_ui_text(prop, "UV Split", "Number of rows/columns to split UV coordinates for billboards");
 
-	prop= RNA_def_property(srna, "billboard_animation", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "billboard_animation", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "bb_anim");
 	RNA_def_property_enum_items(prop, bb_anim_items);
 	RNA_def_property_ui_text(prop, "Animate", "How to animate billboard textures");
 
-	prop= RNA_def_property(srna, "billboard_offset_split", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "billboard_offset_split", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "bb_split_offset");
 	RNA_def_property_enum_items(prop, bb_split_offset_items);
 	RNA_def_property_ui_text(prop, "Offset", "How to offset billboard textures");
 
-	prop= RNA_def_property(srna, "billboard_tilt", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "billboard_tilt", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "bb_tilt");
 	RNA_def_property_range(prop, -1.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Tilt", "Tilt of the billboards");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "color_maximum", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "color_maximum", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "color_vec_max");
 	RNA_def_property_range(prop, 0.01f, 100.0f);
 	RNA_def_property_ui_text(prop, "Color Maximum", "Maximum length of the particle color vector");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "billboard_tilt_random", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "billboard_tilt_random", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "bb_rand_tilt");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Random Tilt", "Random tilt of the billboards");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "billboard_offset", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "billboard_offset", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "bb_offset");
 	RNA_def_property_array(prop, 2);
 	RNA_def_property_range(prop, -100.0f, 100.0f);
@@ -1981,61 +2020,62 @@ static void rna_def_particle_settings(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Billboard Offset", "");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "billboard_size", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "billboard_size", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "bb_size");
 	RNA_def_property_array(prop, 2);
 	RNA_def_property_range(prop, 0.001f, 10.0f);
 	RNA_def_property_ui_text(prop, "Billboard Scale", "Scale billboards relative to particle size");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "billboard_velocity_head", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "billboard_velocity_head", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "bb_vel_head");
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Billboard Velocity Head", "Scale billboards by velocity");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "billboard_velocity_tail", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "billboard_velocity_tail", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "bb_vel_tail");
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Billboard Velocity Tail", "Scale billboards by velocity");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
 	/* simplification */
-	prop= RNA_def_property(srna, "use_simplify", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_simplify", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "simplify_flag", PART_SIMPLIFY_ENABLE);
-	RNA_def_property_ui_text(prop, "Child Simplification", "Remove child strands as the object becomes smaller on the screen");
+	RNA_def_property_ui_text(prop, "Child Simplification",
+	                         "Remove child strands as the object becomes smaller on the screen");
 
-	prop= RNA_def_property(srna, "use_simplify_viewport", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_simplify_viewport", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "simplify_flag", PART_SIMPLIFY_VIEWPORT);
 	RNA_def_property_ui_text(prop, "Viewport", "");
 
-	prop= RNA_def_property(srna, "simplify_refsize", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "simplify_refsize", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "simplify_refsize");
 	RNA_def_property_range(prop, 1, 32768);
 	RNA_def_property_ui_text(prop, "Reference Size", "Reference size in pixels, after which simplification begins");
 
-	prop= RNA_def_property(srna, "simplify_rate", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "simplify_rate", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Rate", "Speed of simplification");
 
-	prop= RNA_def_property(srna, "simplify_transition", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "simplify_transition", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Transition", "Transition period for fading out strands");
 
-	prop= RNA_def_property(srna, "simplify_viewport", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "simplify_viewport", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 0.999f);
 	RNA_def_property_ui_text(prop, "Rate", "Speed of Simplification");
 
 	/* general values */
-	prop= RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
-	RNA_def_property_float_sdna(prop, NULL, "sta");//optional if prop names are the same
+	prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "sta");/*optional if prop names are the same */
 	RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_start_set", NULL);
 	RNA_def_property_ui_text(prop, "Start", "Frame number to start emitting particles");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "end");
 	RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
 
@@ -2044,61 +2084,65 @@ static void rna_def_particle_settings(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "End", "Frame number to stop emitting particles");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
+	prop = RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
 	RNA_def_property_range(prop, 1.0f, MAXFRAMEF);
 	RNA_def_property_ui_text(prop, "Lifetime", "Life span of the particles");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "lifetime_random", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "lifetime_random", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "randlife");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Random", "Give the particle life a random variation");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "time_tweak", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "time_tweak", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "timetweak");
 	RNA_def_property_range(prop, 0.0f, 100.0f);
 	RNA_def_property_ui_range(prop, 0, 10, 1, 3);
 	RNA_def_property_ui_text(prop, "Tweak", "A multiplier for physics timestep (1.0 means one frame = 1/25 seconds)");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "timestep", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "timestep", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_funcs(prop, "rna_PartSettings_timestep_get", "rna_PartSetings_timestep_set", NULL);
 	RNA_def_property_range(prop, 0.0001, 100.0);
 	RNA_def_property_ui_range(prop, 0.01, 10, 1, 3);
 	RNA_def_property_ui_text(prop, "Timestep", "The simulation timestep per frame (seconds per frame)");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "adaptive_subframes", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "adaptive_subframes", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "time_flag", PART_TIME_AUTOSF);
 	RNA_def_property_ui_text(prop, "Automatic Subframes", "Automatically set the number of subframes");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE);
-	RNA_def_property_range(prop, 0, 1000);	
-	RNA_def_property_ui_text(prop, "Subframes", "Subframes to simulate for improved stability and finer granularity simulations (dt = timestep / (subframes + 1))");
+	prop = RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE);
+	RNA_def_property_range(prop, 0, 1000);
+	RNA_def_property_ui_text(prop, "Subframes",
+	                         "Subframes to simulate for improved stability and finer granularity simulations "
+	                         "(dt = timestep / (subframes + 1))");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "courant_target", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "courant_target", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.01, 10);
 	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 Courant number); 0.1-0.3 is the recommended range");
+	RNA_def_property_ui_text(prop, "Adaptive Subframe Threshold",
+	                         "The relative distance a particle can move before requiring more subframes "
+	                         "(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);
+	prop = RNA_def_property(srna, "jitter_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_float_sdna(prop, NULL, "jitfac");
 	RNA_def_property_range(prop, 0.0f, 2.0f);
 	RNA_def_property_ui_text(prop, "Amount", "Amount of jitter applied to the sampling");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "effect_hair", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "effect_hair", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "eff_hair");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Stiffness", "Hair stiffness for effectors");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "totpart");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	/* This limit is for those freaks who have the machine power to handle it. */
@@ -2109,14 +2153,14 @@ static void rna_def_particle_settings(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Number", "Total number of particles");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "userjit", PROP_INT, PROP_UNSIGNED);//TODO: can we get a better name for userjit?
+	prop = RNA_def_property(srna, "userjit", PROP_INT, PROP_UNSIGNED);/*TODO: can we get a better name for userjit? */
 	RNA_def_property_int_sdna(prop, NULL, "userjit");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0, 1000);
 	RNA_def_property_ui_text(prop, "P/F", "Emission locations / face (0 = automatic)");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "grid_resolution", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "grid_resolution", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "grid_res");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 1, 250); /* ~15M particles in a cube (ouch!), but could be very usable in a plane */
@@ -2124,13 +2168,13 @@ static void rna_def_particle_settings(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Resolution", "The resolution of the particle grid");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "grid_random", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "grid_random", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "grid_rand");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Grid Randomness", "Add random offset to the grid locations");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "effector_amount", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "effector_amount", PROP_INT, PROP_UNSIGNED);
 	/* in theory PROP_ANIMATABLE perhaps should be cleared, but animating this can give some interesting results! */
 	RNA_def_property_range(prop, 0, 10000); /* 10000 effectors will bel SLOW, but who knows */
 	RNA_def_property_ui_range(prop, 0, 100, 1, 0);
@@ -2138,87 +2182,90 @@ static void rna_def_particle_settings(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
 	/* initial velocity factors */
-	prop= RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_NONE);
-	RNA_def_property_float_sdna(prop, NULL, "normfac");//optional if prop names are the same
+	prop = RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "normfac");/*optional if prop names are the same */
 	RNA_def_property_range(prop, -1000.0f, 1000.0f);
 	RNA_def_property_ui_range(prop, 0, 100, 1, 3);
 	RNA_def_property_ui_text(prop, "Normal", "Let the surface normal give the particle a starting speed");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "object_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "object_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "obfac");
 	RNA_def_property_range(prop, -200.0f, 200.0f);
 	RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Object", "Let the object give the particle a starting speed");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "factor_random", PROP_FLOAT, PROP_NONE);
-	RNA_def_property_float_sdna(prop, NULL, "randfac");//optional if prop names are the same
+	prop = RNA_def_property(srna, "factor_random", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "randfac");/*optional if prop names are the same */
 	RNA_def_property_range(prop, 0.0f, 200.0f);
 	RNA_def_property_ui_range(prop, 0, 100, 1, 3);
 	RNA_def_property_ui_text(prop, "Random", "Give the starting speed a random variation");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "particle_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "particle_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "partfac");
 	RNA_def_property_range(prop, -200.0f, 200.0f);
 	RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Particle", "Let the target particle give the particle a starting speed");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "tangent_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "tangent_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "tanfac");
 	RNA_def_property_range(prop, -1000.0f, 1000.0f);
 	RNA_def_property_ui_range(prop, -100, 100, 1, 2);
 	RNA_def_property_ui_text(prop, "Tangent", "Let the surface tangent give the particle a starting speed");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "tangent_phase", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "tangent_phase", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "tanphase");
 	RNA_def_property_range(prop, -1.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Rot", "Rotate the surface tangent");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "reactor_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "reactor_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "reactfac");
 	RNA_def_property_range(prop, -10.0f, 10.0f);
-	RNA_def_property_ui_text(prop, "Reactor", "Let the vector away from the target particle's location give the particle a starting speed");
+	RNA_def_property_ui_text(prop, "Reactor",
+	                         "Let the vector away from the target particle's location give the particle "
+	                         "a starting speed");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "object_align_factor", PROP_FLOAT, PROP_VELOCITY);
+	prop = RNA_def_property(srna, "object_align_factor", PROP_FLOAT, PROP_VELOCITY);
 	RNA_def_property_float_sdna(prop, NULL, "ob_vel");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_range(prop, -200.0f, 200.0f);
 	RNA_def_property_ui_range(prop, -100, 100, 1, 3);
-	RNA_def_property_ui_text(prop, "Object Aligned", "Let the emitter object orientation give the particle a starting speed");
+	RNA_def_property_ui_text(prop, "Object Aligned",
+	                         "Let the emitter object orientation give the particle a starting speed");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "angular_velocity_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "angular_velocity_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "avefac");
 	RNA_def_property_range(prop, -200.0f, 200.0f);
 	RNA_def_property_ui_range(prop, -100, 100, 10, 3);
-	RNA_def_property_ui_text(prop, "Angular Velocity", "Angular velocity amount");
+	RNA_def_property_ui_text(prop, "Angular Velocity", "Angular velocity amount (in radians per second)");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "phase_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "phase_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "phasefac");
 	RNA_def_property_range(prop, -1.0f, 1.0f);
-	RNA_def_property_ui_text(prop, "Phase", "Initial rotation phase");
+	RNA_def_property_ui_text(prop, "Phase", "Rotation around the chosen orientation axis");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "rotation_factor_random", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "rotation_factor_random", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "randrotfac");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
-	RNA_def_property_ui_text(prop, "Random Rotation", "Randomize rotation");
+	RNA_def_property_ui_text(prop, "Random Orientation", "Randomize particle orientation");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "phase_factor_random", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "phase_factor_random", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "randphasefac");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
-	RNA_def_property_ui_text(prop, "Random Phase", "Randomize rotation phase");
+	RNA_def_property_ui_text(prop, "Random Phase", "Randomize rotation around the chosen orientation axis");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "hair_length", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "hair_length", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_funcs(prop, "rna_PartSetting_hairlength_get", "rna_PartSetting_hairlength_set", NULL);
 	RNA_def_property_range(prop, 0.0f, 1000.0f);
 	RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
@@ -2226,20 +2273,20 @@ static void rna_def_particle_settings(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
 	/* physical properties */
-	prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.001f, 100000.0f);
 	RNA_def_property_ui_range(prop, 0.01, 100, 1, 3);
 	RNA_def_property_ui_text(prop, "Mass", "Mass of the particles");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "particle_size", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "particle_size", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "size");
 	RNA_def_property_range(prop, 0.001f, 100000.0f);
 	RNA_def_property_ui_range(prop, 0.01, 100, 1, 3);
 	RNA_def_property_ui_text(prop, "Size", "The size of the particles");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "size_random", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "size_random", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "randsize");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Random Size", "Give the particle size a random variation");
@@ -2247,85 +2294,85 @@ static void rna_def_particle_settings(BlenderRNA *brna)
 
 
 	/* global physical properties */
-	prop= RNA_def_property(srna, "drag_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "drag_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "dragfac");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Drag", "Amount of air-drag");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "brownian_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "brownian_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "brownfac");
 	RNA_def_property_range(prop, 0.0f, 200.0f);
 	RNA_def_property_ui_range(prop, 0, 20, 1, 3);
 	RNA_def_property_ui_text(prop, "Brownian", "Amount of Brownian motion");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "dampfac");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Damp", "Amount of damping");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
 	/* random length */
-	prop= RNA_def_property(srna, "length_random", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "length_random", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "randlength");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Random Length", "Give path length a random variation");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
 	/* children */
-	prop= RNA_def_property(srna, "child_nbr", PROP_INT, PROP_NONE);
-	RNA_def_property_int_sdna(prop, NULL, "child_nbr");//optional if prop names are the same
+	prop = RNA_def_property(srna, "child_nbr", PROP_INT, PROP_NONE);
+	RNA_def_property_int_sdna(prop, NULL, "child_nbr");/*optional if prop names are the same */
 	RNA_def_property_range(prop, 0, 100000);
 	RNA_def_property_ui_range(prop, 0, 1000, 1, 0);
 	RNA_def_property_ui_text(prop, "Children Per Parent", "Number of children/parent");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "rendered_child_count", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "rendered_child_count", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "ren_child_nbr");
 	RNA_def_property_range(prop, 0, 100000);
 	RNA_def_property_ui_range(prop, 0, 10000, 1, 0);
 	RNA_def_property_ui_text(prop, "Rendered Children", "Number of children/parent for rendering");
 
-	prop= RNA_def_property(srna, "virtual_parents", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "virtual_parents", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "parents");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Virtual Parents", "Relative amount of virtual parents");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "child_size", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "child_size", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "childsize");
 	RNA_def_property_range(prop, 0.001f, 100000.0f);
 	RNA_def_property_ui_range(prop, 0.01f, 100.0f, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Child Size", "A multiplier for the child particle size");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "child_size_random", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "child_size_random", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "childrandsize");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Random Child Size", "Random variation to the size of the child particles");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "child_radius", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "child_radius", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "childrad");
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Child Radius", "Radius of children around parent");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "child_roundness", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "child_roundness", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "childflat");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Child Roundness", "Roundness of children around parent");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
 	/* clumping */
-	prop= RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "clumpfac");
 	RNA_def_property_range(prop, -1.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Clump", "Amount of clumping");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "clump_shape", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "clump_shape", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "clumppow");
 	RNA_def_property_range(prop, -0.999f, 0.999f);
 	RNA_def_property_ui_text(prop, "Shape", "Shape of clumping");
@@ -2333,150 +2380,152 @@ static void rna_def_particle_settings(BlenderRNA *brna)
 
 
 	/* kink */
-	prop= RNA_def_property(srna, "kink_amplitude", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "kink_amplitude", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "kink_amp");
 	RNA_def_property_range(prop, -100000.0f, 100000.0f);
 	RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Amplitude", "The amplitude of the offset");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "kink_amplitude_clump", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "kink_amplitude_clump", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "kink_amp_clump");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Amplitude Clump", "How much clump affects kink amplitude");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "kink_frequency", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "kink_frequency", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "kink_freq");
 	RNA_def_property_range(prop, -100000.0f, 100000.0f);
 	RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Frequency", "The frequency of the offset (1/total length)");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "kink_shape", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "kink_shape", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, -0.999f, 0.999f);
 	RNA_def_property_ui_text(prop, "Shape", "Adjust the offset to the beginning/end");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "kink_flat", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "kink_flat", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Flatness", "How flat the hairs are");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
 	/* rough */
-	prop= RNA_def_property(srna, "roughness_1", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "roughness_1", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "rough1");
 	RNA_def_property_range(prop, 0.0f, 100000.0f);
 	RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Rough1", "Amount of location dependent rough");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "roughness_1_size", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "roughness_1_size", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "rough1_size");
 	RNA_def_property_range(prop, 0.01f, 100000.0f);
 	RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Size1", "Size of location dependent rough");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "roughness_2", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "roughness_2", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "rough2");
 	RNA_def_property_range(prop, 0.0f, 100000.0f);
 	RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Rough2", "Amount of random rough");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "roughness_2_size", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "roughness_2_size", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "rough2_size");
 	RNA_def_property_range(prop, 0.01f, 100000.0f);
 	RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Size2", "Size of random rough");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "roughness_2_threshold", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "roughness_2_threshold", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "rough2_thres");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Threshold", "Amount of particles left untouched by random rough");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "roughness_endpoint", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "roughness_endpoint", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "rough_end");
 	RNA_def_property_range(prop, 0.0f, 100000.0f);
 	RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Rough Endpoint", "Amount of end point rough");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "roughness_end_shape", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "roughness_end_shape", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "rough_end_shape");
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Shape", "Shape of end point rough");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "child_length", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "child_length", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "clength");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Length", "Length of child paths");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "child_length_threshold", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "child_length_threshold", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "clength_thres");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Threshold", "Amount of particles left untouched by child path length");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
 	/* parting */
-	prop= RNA_def_property(srna, "child_parting_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "child_parting_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "parting_fac");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Parting Factor", "Create parting in the children based on parent strands");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "child_parting_min", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "child_parting_min", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "parting_min");
 	RNA_def_property_range(prop, 0.0f, 180.0f);
-	RNA_def_property_ui_text(prop, "Parting Minimum", "Minimum root to tip angle (tip distance/root distance for long hair)");
+	RNA_def_property_ui_text(prop, "Parting Minimum",
+	                         "Minimum root to tip angle (tip distance/root distance for long hair)");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "child_parting_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "child_parting_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "parting_max");
 	RNA_def_property_range(prop, 0.0f, 180.0f);
-	RNA_def_property_ui_text(prop, "Parting Maximum", "Maximum root to tip angle (tip distance/root distance for long hair)");
+	RNA_def_property_ui_text(prop, "Parting Maximum",
+	                         "Maximum root to tip angle (tip distance/root distance for long hair)");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
 	/* branching */
-	prop= RNA_def_property(srna, "branch_threshold", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "branch_threshold", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "branch_thres");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Threshold", "Threshold of branching");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
 	/* drawing stuff */
-	prop= RNA_def_property(srna, "line_length_tail", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "line_length_tail", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_funcs(prop, "rna_PartSetting_linelentail_get", "rna_PartSetting_linelentail_set", NULL);
 	RNA_def_property_range(prop, 0.0f, 100000.0f);
 	RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Back", "Length of the line's tail");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "line_length_head", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "line_length_head", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_funcs(prop, "rna_PartSetting_linelenhead_get", "rna_PartSetting_linelenhead_set", NULL);
 	RNA_def_property_range(prop, 0.0f, 100000.0f);
 	RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Head", "Length of the line's head");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "path_start", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "path_start", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "path_start");
 	RNA_def_property_float_funcs(prop, NULL, NULL, "rna_PartSetting_pathstartend_range");
 	RNA_def_property_ui_text(prop, "Path Start", "Starting time of drawn path");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "path_end", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "path_end", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "path_end");
 	RNA_def_property_float_funcs(prop, NULL, NULL, "rna_PartSetting_pathstartend_range");
 	RNA_def_property_ui_text(prop, "Path End", "End time of drawn path");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "trail_count", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "trail_count", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "trail_count");
 	RNA_def_property_range(prop, 1, 100000);
 	RNA_def_property_ui_range(prop, 1, 100, 1, 0);
@@ -2484,7 +2533,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
 	/* keyed particles */
-	prop= RNA_def_property(srna, "keyed_loops", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "keyed_loops", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "keyed_loops");
 	RNA_def_property_range(prop, 1.0f, 10000.0f);
 	RNA_def_property_ui_range(prop, 1.0f, 100.0f, 0.1, 3);
@@ -2492,35 +2541,37 @@ static void rna_def_particle_settings(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 	
 	/* draw objects & groups */
-	prop= RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "dup_group");
 	RNA_def_property_struct_type(prop, "Group");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Dupli Group", "Show Objects in this Group in place of particles");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "dupli_weights", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "dupli_weights", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "dupliweights", NULL);
 	RNA_def_property_struct_type(prop, "ParticleDupliWeight");
 	RNA_def_property_ui_text(prop, "Dupli Group Weights", "Weights for all of the objects in the dupli group");
 
-	prop= RNA_def_property(srna, "active_dupliweight", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active_dupliweight", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "ParticleDupliWeight");
 	RNA_def_property_pointer_funcs(prop, "rna_ParticleDupliWeight_active_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Active Dupli Object", "");
 
-	prop= RNA_def_property(srna, "active_dupliweight_index", PROP_INT, PROP_UNSIGNED);
-	RNA_def_property_int_funcs(prop, "rna_ParticleDupliWeight_active_index_get", "rna_ParticleDupliWeight_active_index_set", "rna_ParticleDupliWeight_active_index_range");
+	prop = RNA_def_property(srna, "active_dupliweight_index", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_int_funcs(prop, "rna_ParticleDupliWeight_active_index_get",
+	                           "rna_ParticleDupliWeight_active_index_set",
+	                           "rna_ParticleDupliWeight_active_index_range");
 	RNA_def_property_ui_text(prop, "Active Dupli Object Index", "");
 
-	prop= RNA_def_property(srna, "dupli_object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "dupli_object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "dup_ob");
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Dupli Object", "Show this Object in place of particles");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_dependency");
 
-	prop= RNA_def_property(srna, "billboard_object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "billboard_object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "bb_ob");
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
@@ -2528,19 +2579,19 @@ static void rna_def_particle_settings(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
 	/* boids */
-	prop= RNA_def_property(srna, "boids", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "boids", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "BoidSettings");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Boid Settings", "");
 	
 	/* Fluid particles */
-	prop= RNA_def_property(srna, "fluid", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "fluid", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "SPHFluidSettings");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "SPH Fluid Settings", ""); 
+	RNA_def_property_ui_text(prop, "SPH Fluid Settings", "");
 
 	/* Effector weights */
-	prop= RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "EffectorWeights");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Effector Weights", "");
@@ -2548,13 +2599,13 @@ static void rna_def_particle_settings(BlenderRNA *brna)
 	/* animation here? */
 	rna_def_animdata_common(srna);
 
-	prop= RNA_def_property(srna, "force_field_1", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "force_field_1", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "pd");
 	RNA_def_property_struct_type(prop, "FieldSettings");
 	RNA_def_property_pointer_funcs(prop, "rna_Particle_field1_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Force Field 1", "");
 
-	prop= RNA_def_property(srna, "force_field_2", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "force_field_2", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "pd2");
 	RNA_def_property_struct_type(prop, "FieldSettings");
 	RNA_def_property_pointer_funcs(prop, "rna_Particle_field2_get", NULL, NULL, NULL);
@@ -2577,42 +2628,43 @@ static void rna_def_particle_target(BlenderRNA *brna)
 	srna = RNA_def_struct(brna, "ParticleTarget", NULL);
 	RNA_def_struct_ui_text(srna, "Particle Target", "Target particle system");
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_funcs(prop, "rna_ParticleTarget_name_get", "rna_ParticleTarget_name_length", NULL);
 	RNA_def_property_ui_text(prop, "Name", "Particle target name");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_struct_name_property(srna, prop);
 
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "ob");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "Target Object", "The object that has the target particle system (empty if same object)");
+	RNA_def_property_ui_text(prop, "Target Object",
+	                         "The object that has the target particle system (empty if same object)");
 	RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
 
-	prop= RNA_def_property(srna, "system", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "system", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "psys");
 	RNA_def_property_range(prop, 1, INT_MAX);
 	RNA_def_property_ui_text(prop, "Target Particle System", "The index of particle system on the target object");
 	RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
 
-	prop= RNA_def_property(srna, "time", PROP_FLOAT, PROP_TIME);
+	prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_TIME);
 	RNA_def_property_float_sdna(prop, NULL, "time");
-	RNA_def_property_range(prop, 0.0, 30000.0f); //TODO: replace 30000 with MAXFRAMEF when available in 2.5
+	RNA_def_property_range(prop, 0.0, 30000.0f); /*TODO: replace 30000 with MAXFRAMEF when available in 2.5 */
 	RNA_def_property_ui_text(prop, "Time", "");
 	RNA_def_property_update(prop, 0, "rna_Particle_target_redo");
 
-	prop= RNA_def_property(srna, "duration", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "duration", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "duration");
-	RNA_def_property_range(prop, 0.0, 30000.0f); //TODO: replace 30000 with MAXFRAMEF when available in 2.5
+	RNA_def_property_range(prop, 0.0, 30000.0f); /*TODO: replace 30000 with MAXFRAMEF when available in 2.5 */
 	RNA_def_property_ui_text(prop, "Duration", "");
 	RNA_def_property_update(prop, 0, "rna_Particle_target_redo");
 
-	prop= RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PTARGET_VALID);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Valid", "Keyed particles target is valid");
 
-	prop= RNA_def_property(srna, "alliance", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "alliance", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "mode");
 	RNA_def_property_enum_items(prop, mode_items);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
@@ -2625,11 +2677,11 @@ static void rna_def_particle_system(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "ParticleSystem", NULL);
+	srna = RNA_def_struct(brna, "ParticleSystem", NULL);
 	RNA_def_struct_ui_text(srna, "Particle System", "Particle system in an object");
 	RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Name", "Particle system name");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER|NA_RENAME, NULL);
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ParticleSystem_name_set");
@@ -2637,44 +2689,46 @@ static void rna_def_particle_system(BlenderRNA *brna)
 
 	/* access to particle settings is redirected through functions */
 	/* to allow proper id-buttons functionality */
-	prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
-	//RNA_def_property_pointer_sdna(prop, NULL, "part");
+	prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
+	/*RNA_def_property_pointer_sdna(prop, NULL, "part"); */
 	RNA_def_property_struct_type(prop, "ParticleSettings");
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_NULL);
 	RNA_def_property_pointer_funcs(prop, "rna_particle_settings_get", "rna_particle_settings_set", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Settings", "Particle system settings");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "particles", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "particles", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "particles", "totpart");
 	RNA_def_property_struct_type(prop, "Particle");
 	RNA_def_property_ui_text(prop, "Particles", "Particles generated by the particle system");
 
-	prop= RNA_def_property(srna, "child_particles", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "child_particles", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "child", "totchild");
 	RNA_def_property_struct_type(prop, "ChildParticle");
 	RNA_def_property_ui_text(prop, "Child Particles", "Child particles generated by the particle system");
 
-	prop= RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_ui_text(prop, "Seed", "Offset in the random number table, to get a different randomized result");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "child_seed", PROP_INT, PROP_UNSIGNED);
-	RNA_def_property_ui_text(prop, "Child Seed", "Offset in the random number table for child particles, to get a different randomized result");
+	prop = RNA_def_property(srna, "child_seed", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_ui_text(prop, "Child Seed",
+	                         "Offset in the random number table for child particles, to get a different "
+	                         "randomized result");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
 	/* hair */
-	prop= RNA_def_property(srna, "is_global_hair", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_global_hair", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_GLOBAL_HAIR);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Global Hair", "Hair keys are in global coordinate space");
 
-	prop= RNA_def_property(srna, "use_hair_dynamics", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_hair_dynamics", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_HAIR_DYNAMICS);
 	RNA_def_property_ui_text(prop, "Hair Dynamics", "Enable hair dynamics using cloth simulation");
 	RNA_def_property_update(prop, 0, "rna_Particle_hair_dynamics");
 
-	prop= RNA_def_property(srna, "cloth", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "cloth", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "clmd");
 	RNA_def_property_struct_type(prop, "ClothModifier");
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
@@ -2682,51 +2736,56 @@ static void rna_def_particle_system(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Cloth", "Cloth dynamics for hair");
 
 	/* reactor */
-	prop= RNA_def_property(srna, "reactor_target_object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "reactor_target_object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "target_ob");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "Reactor Target Object", "For reactor systems, the object that has the target particle system (empty if same object)");
+	RNA_def_property_ui_text(prop, "Reactor Target Object",
+	                         "For reactor systems, the object that has the target particle system "
+	                         "(empty if same object)");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "reactor_target_particle_system", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "reactor_target_particle_system", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "target_psys");
 	RNA_def_property_range(prop, 1, SHRT_MAX);
-	RNA_def_property_ui_text(prop, "Reactor Target Particle System", "For reactor systems, index of particle system on the target object");
+	RNA_def_property_ui_text(prop, "Reactor Target Particle System",
+	                         "For reactor systems, index of particle system on the target object");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
 	/* keyed */
-	prop= RNA_def_property(srna, "use_keyed_timing", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_keyed_timing", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_KEYED_TIMING);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Keyed timing", "Use key times");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "ParticleTarget");
 	RNA_def_property_ui_text(prop, "Targets", "Target particle systems");
 
-	prop= RNA_def_property(srna, "active_particle_target", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active_particle_target", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "ParticleTarget");
 	RNA_def_property_pointer_funcs(prop, "rna_ParticleSystem_active_particle_target_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Active Particle Target", "");
 
-	prop= RNA_def_property(srna, "active_particle_target_index", PROP_INT, PROP_UNSIGNED);
-	RNA_def_property_int_funcs(prop, "rna_ParticleSystem_active_particle_target_index_get", "rna_ParticleSystem_active_particle_target_index_set", "rna_ParticleSystem_active_particle_target_index_range");
+	prop = RNA_def_property(srna, "active_particle_target_index", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_int_funcs(prop, "rna_ParticleSystem_active_particle_target_index_get",
+	                           "rna_ParticleSystem_active_particle_target_index_set",
+	                           "rna_ParticleSystem_active_particle_target_index_range");
 	RNA_def_property_ui_text(prop, "Active Particle Target Index", "");
 
 
 	/* billboard */
-	prop= RNA_def_property(srna, "billboard_normal_uv", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "billboard_normal_uv", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "bb_uvname[0]");
 	RNA_def_property_string_maxlength(prop, 32);
 	RNA_def_property_ui_text(prop, "Billboard Normal UV", "UV map to control billboard normals");
 
-	prop= RNA_def_property(srna, "billboard_time_index_uv", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "billboard_time_index_uv", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "bb_uvname[1]");
 	RNA_def_property_string_maxlength(prop, 32);
 	RNA_def_property_ui_text(prop, "Billboard Time Index UV", "UV map to control billboard time index (X-Y)");
 
-	prop= RNA_def_property(srna, "billboard_split_uv", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "billboard_split_uv", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "bb_uvname[2]");
 	RNA_def_property_string_maxlength(prop, 32);
 	RNA_def_property_ui_text(prop, "Billboard Split UV", "UV map to control billboard splitting");
@@ -2734,159 +2793,175 @@ static void rna_def_particle_system(BlenderRNA *brna)
 	/* vertex groups */
 
 	/* note, internally store as ints, access as strings */
-#if 0 // int access. works ok but isnt useful for the UI
-	prop= RNA_def_property(srna, "vertex_group_density", PROP_INT, PROP_NONE);
+#if 0 /* int access. works ok but isn't useful for the UI */
+	prop = RNA_def_property(srna, "vertex_group_density", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "vgroup[0]");
 	RNA_def_property_ui_text(prop, "Vertex Group Density", "Vertex group to control density");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 #endif
 
-	prop= RNA_def_property(srna, "vertex_group_density", PROP_STRING, PROP_NONE);
-	RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_0", "rna_ParticleVGroup_name_len_0", "rna_ParticleVGroup_name_set_0");
+	prop = RNA_def_property(srna, "vertex_group_density", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_0", "rna_ParticleVGroup_name_len_0",
+	                              "rna_ParticleVGroup_name_set_0");
 	RNA_def_property_ui_text(prop, "Vertex Group Density", "Vertex group to control density");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "invert_vertex_group_density", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_vertex_group_density", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_DENSITY));
 	RNA_def_property_ui_text(prop, "Vertex Group Density Negate", "Negate the effect of the density vertex group");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "vertex_group_velocity", PROP_STRING, PROP_NONE);
-	RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_1", "rna_ParticleVGroup_name_len_1", "rna_ParticleVGroup_name_set_1");
+	prop = RNA_def_property(srna, "vertex_group_velocity", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_1", "rna_ParticleVGroup_name_len_1",
+	                              "rna_ParticleVGroup_name_set_1");
 	RNA_def_property_ui_text(prop, "Vertex Group Velocity", "Vertex group to control velocity");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "invert_vertex_group_velocity", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_vertex_group_velocity", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_VEL));
 	RNA_def_property_ui_text(prop, "Vertex Group Velocity Negate", "Negate the effect of the velocity vertex group");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "vertex_group_length", PROP_STRING, PROP_NONE);
-	RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_2", "rna_ParticleVGroup_name_len_2", "rna_ParticleVGroup_name_set_2");
+	prop = RNA_def_property(srna, "vertex_group_length", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_2", "rna_ParticleVGroup_name_len_2",
+	                              "rna_ParticleVGroup_name_set_2");
 	RNA_def_property_ui_text(prop, "Vertex Group Length", "Vertex group to control length");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "invert_vertex_group_length", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_vertex_group_length", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_LENGTH));
 	RNA_def_property_ui_text(prop, "Vertex Group Length Negate", "Negate the effect of the length vertex group");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
-	prop= RNA_def_property(srna, "vertex_group_clump", PROP_STRING, PROP_NONE);
-	RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_3", "rna_ParticleVGroup_name_len_3", "rna_ParticleVGroup_name_set_3");
+	prop = RNA_def_property(srna, "vertex_group_clump", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_3", "rna_ParticleVGroup_name_len_3",
+	                              "rna_ParticleVGroup_name_set_3");
 	RNA_def_property_ui_text(prop, "Vertex Group Clump", "Vertex group to control clump");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "invert_vertex_group_clump", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_vertex_group_clump", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_CLUMP));
 	RNA_def_property_ui_text(prop, "Vertex Group Clump Negate", "Negate the effect of the clump vertex group");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "vertex_group_kink", PROP_STRING, PROP_NONE);
-	RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_4", "rna_ParticleVGroup_name_len_4", "rna_ParticleVGroup_name_set_4");
+	prop = RNA_def_property(srna, "vertex_group_kink", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_4", "rna_ParticleVGroup_name_len_4",
+	                              "rna_ParticleVGroup_name_set_4");
 	RNA_def_property_ui_text(prop, "Vertex Group Kink", "Vertex group to control kink");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "invert_vertex_group_kink", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_vertex_group_kink", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_KINK));
 	RNA_def_property_ui_text(prop, "Vertex Group Kink Negate", "Negate the effect of the kink vertex group");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "vertex_group_roughness_1", PROP_STRING, PROP_NONE);
-	RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_5", "rna_ParticleVGroup_name_len_5", "rna_ParticleVGroup_name_set_5");
+	prop = RNA_def_property(srna, "vertex_group_roughness_1", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_5", "rna_ParticleVGroup_name_len_5",
+	                              "rna_ParticleVGroup_name_set_5");
 	RNA_def_property_ui_text(prop, "Vertex Group Roughness 1", "Vertex group to control roughness 1");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "invert_vertex_group_roughness_1", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_vertex_group_roughness_1", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGH1));
-	RNA_def_property_ui_text(prop, "Vertex Group Roughness 1 Negate", "Negate the effect of the roughness 1 vertex group");
+	RNA_def_property_ui_text(prop, "Vertex Group Roughness 1 Negate",
+	                         "Negate the effect of the roughness 1 vertex group");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "vertex_group_roughness_2", PROP_STRING, PROP_NONE);
-	RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_6", "rna_ParticleVGroup_name_len_6", "rna_ParticleVGroup_name_set_6");
+	prop = RNA_def_property(srna, "vertex_group_roughness_2", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_6", "rna_ParticleVGroup_name_len_6",
+	                              "rna_ParticleVGroup_name_set_6");
 	RNA_def_property_ui_text(prop, "Vertex Group Roughness 2", "Vertex group to control roughness 2");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "invert_vertex_group_roughness_2", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_vertex_group_roughness_2", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGH2));
-	RNA_def_property_ui_text(prop, "Vertex Group Roughness 2 Negate", "Negate the effect of the roughness 2 vertex group");
+	RNA_def_property_ui_text(prop, "Vertex Group Roughness 2 Negate",
+	                         "Negate the effect of the roughness 2 vertex group");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "vertex_group_roughness_end", PROP_STRING, PROP_NONE);
-	RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_7", "rna_ParticleVGroup_name_len_7", "rna_ParticleVGroup_name_set_7");
+	prop = RNA_def_property(srna, "vertex_group_roughness_end", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_7", "rna_ParticleVGroup_name_len_7",
+	                              "rna_ParticleVGroup_name_set_7");
 	RNA_def_property_ui_text(prop, "Vertex Group Roughness End", "Vertex group to control roughness end");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "invert_vertex_group_roughness_end", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_vertex_group_roughness_end", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGHE));
-	RNA_def_property_ui_text(prop, "Vertex Group Roughness End Negate", "Negate the effect of the roughness end vertex group");
+	RNA_def_property_ui_text(prop, "Vertex Group Roughness End Negate",
+	                         "Negate the effect of the roughness end vertex group");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
 
-	prop= RNA_def_property(srna, "vertex_group_size", PROP_STRING, PROP_NONE);
-	RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_8", "rna_ParticleVGroup_name_len_8", "rna_ParticleVGroup_name_set_8");
+	prop = RNA_def_property(srna, "vertex_group_size", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_8", "rna_ParticleVGroup_name_len_8",
+	                              "rna_ParticleVGroup_name_set_8");
 	RNA_def_property_ui_text(prop, "Vertex Group Size", "Vertex group to control size");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "invert_vertex_group_size", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_vertex_group_size", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_SIZE));
 	RNA_def_property_ui_text(prop, "Vertex Group Size Negate", "Negate the effect of the size vertex group");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "vertex_group_tangent", PROP_STRING, PROP_NONE);
-	RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_9", "rna_ParticleVGroup_name_len_9", "rna_ParticleVGroup_name_set_9");
+	prop = RNA_def_property(srna, "vertex_group_tangent", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_9", "rna_ParticleVGroup_name_len_9",
+	                              "rna_ParticleVGroup_name_set_9");
 	RNA_def_property_ui_text(prop, "Vertex Group Tangent", "Vertex group to control tangent");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "invert_vertex_group_tangent", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_vertex_group_tangent", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_TAN));
 	RNA_def_property_ui_text(prop, "Vertex Group Tangent Negate", "Negate the effect of the tangent vertex group");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "vertex_group_rotation", PROP_STRING, PROP_NONE);
-	RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_10", "rna_ParticleVGroup_name_len_10", "rna_ParticleVGroup_name_set_10");
+	prop = RNA_def_property(srna, "vertex_group_rotation", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_10", "rna_ParticleVGroup_name_len_10",
+	                              "rna_ParticleVGroup_name_set_10");
 	RNA_def_property_ui_text(prop, "Vertex Group Rotation", "Vertex group to control rotation");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "invert_vertex_group_rotation", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_vertex_group_rotation", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROT));
 	RNA_def_property_ui_text(prop, "Vertex Group Rotation Negate", "Negate the effect of the rotation vertex group");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "vertex_group_field", PROP_STRING, PROP_NONE);
-	RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_11", "rna_ParticleVGroup_name_len_11", "rna_ParticleVGroup_name_set_11");
+	prop = RNA_def_property(srna, "vertex_group_field", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_11", "rna_ParticleVGroup_name_len_11",
+	                              "rna_ParticleVGroup_name_set_11");
 	RNA_def_property_ui_text(prop, "Vertex Group Field", "Vertex group to control field");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
-	prop= RNA_def_property(srna, "invert_vertex_group_field", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_vertex_group_field", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_EFFECTOR));
 	RNA_def_property_ui_text(prop, "Vertex Group Field Negate", "Negate the effect of the field vertex group");
 	RNA_def_property_update(prop, 0, "rna_Particle_reset");
 
 	/* pointcache */
-	prop= RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "pointcache");
 	RNA_def_property_struct_type(prop, "PointCache");
 	RNA_def_property_ui_text(prop, "Point Cache", "");
 
-	prop= RNA_def_property(srna, "has_multiple_caches", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "has_multiple_caches", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_multiple_caches_get", NULL);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Multiple Caches", "Particle system has multiple point caches");
 
 	/* offset ob */
-	prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "parent");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "Parent", "Use this object's coordinate system instead of global coordinate system");
+	RNA_def_property_ui_text(prop, "Parent",
+	                         "Use this object's coordinate system instead of global coordinate system");
 	RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
 	/* hair or cache editing */
-	prop= RNA_def_property(srna, "is_editable", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_editable", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_editable_get", NULL);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Editable", "Particle system can be edited in particle mode");
 
-	prop= RNA_def_property(srna, "is_edited", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_edited", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_edited_get", NULL);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Edited", "Particle system has been edited in particle mode");
@@ -2894,7 +2969,7 @@ static void rna_def_particle_system(BlenderRNA *brna)
 	/* Read-only: this is calculated internally. Changing it would only affect
 	 * the next time-step. The user should change ParticlSettings.subframes or
 	 * ParticleSettings.courant_target instead. */
-	prop= RNA_def_property(srna, "dt_frac", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "dt_frac", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 1.0f/101.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Timestep", "The current simulation time step size, as a fraction of a frame");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -2914,7 +2989,7 @@ void RNA_def_particle(BlenderRNA *brna)
 	rna_def_particle_dupliweight(brna);
 	rna_def_particle_system(brna);
 	rna_def_particle_settings_mtex(brna);
-	rna_def_particle_settings(brna);	
+	rna_def_particle_settings(brna);
 }
 
 #endif
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index 9ed3f8f..b659240 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -45,7 +45,8 @@
 
 
 
-// XXX: this RNA enum define is currently duplicated for objects, since there is some text here which is not applicable
+/* XXX: this RNA enum define is currently duplicated for objects,
+ * since there is some text here which is not applicable */
 EnumPropertyItem posebone_rotmode_items[] = {
 	{ROT_MODE_QUAT, "QUATERNION", 0, "Quaternion (WXYZ)", "No Gimbal Lock (default)"},
 	{ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order (prone to Gimbal Lock)"},
@@ -86,15 +87,15 @@ EnumPropertyItem posebone_rotmode_items[] = {
 
 static void rna_Pose_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	// XXX when to use this? ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
+	/* XXX when to use this? ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK); */
 
 	DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
 }
 
 static void rna_Pose_IK_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	// XXX when to use this? ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
-	Object *ob= ptr->id.data;
+	/* XXX when to use this? ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK); */
+	Object *ob = ptr->id.data;
 
 	DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 	BIK_clear_data(ob->pose);
@@ -107,11 +108,11 @@ static char *rna_PoseBone_path(PointerRNA *ptr)
 
 static void rna_BoneGroup_color_set_set(PointerRNA *ptr, int value)
 {
-	bActionGroup *grp= ptr->data;
+	bActionGroup *grp = ptr->data;
 	
 	/* if valid value, set the new enum value, then copy the relevant colors? */
 	if ((value >= -1) && (value < 21))
-		grp->customCol= value;
+		grp->customCol = value;
 	else
 		return;
 	
@@ -119,22 +120,19 @@ static void rna_BoneGroup_color_set_set(PointerRNA *ptr, int value)
 	if (grp->customCol) {
 		if (grp->customCol > 0) {
 			/* copy theme colors on-to group's custom color in case user tries to edit color */
-			bTheme *btheme= U.themes.first;
-			ThemeWireColor *col_set= &btheme->tarm[(grp->customCol - 1)];
+			bTheme *btheme = U.themes.first;
+			ThemeWireColor *col_set = &btheme->tarm[(grp->customCol - 1)];
 			
 			memcpy(&grp->cs, col_set, sizeof(ThemeWireColor));
 		}
 		else {
-			/* init custom colors with a generic multi-color rgb set, if not initialised already (for custom color set) */
+			/* init custom colors with a generic multi-color rgb set, if not initialized already
+			 * (for custom color set) */
 			if (grp->cs.solid[0] == 0) {
 				/* define for setting colors in theme below */
-				#define SETCOL(col, r, g, b, a)  col[0]=r; col[1]=g; col[2]= b; col[3]= a;
-				
-				SETCOL(grp->cs.solid, 0xff, 0x00, 0x00, 255);
-				SETCOL(grp->cs.select, 0x81, 0xe6, 0x14, 255);
-				SETCOL(grp->cs.active, 0x18, 0xb6, 0xe0, 255);
-				
-				#undef SETCOL
+				rgba_char_args_set(grp->cs.solid, 0xff, 0x00, 0x00, 255);
+				rgba_char_args_set(grp->cs.select, 0x81, 0xe6, 0x14, 255);
+				rgba_char_args_set(grp->cs.active, 0x18, 0xb6, 0xe0, 255);
 			}
 		}
 	}
@@ -142,8 +140,8 @@ static void rna_BoneGroup_color_set_set(PointerRNA *ptr, int value)
 
 void rna_BoneGroup_name_set(PointerRNA *ptr, const char *value)
 {
-	Object *ob= ptr->id.data;
-	bActionGroup *agrp= ptr->data;
+	Object *ob = ptr->id.data;
+	bActionGroup *agrp = ptr->data;
 
 	/* copy the new name into the name slot */
 	BLI_strncpy_utf8(agrp->name, value, sizeof(agrp->name));
@@ -153,11 +151,11 @@ void rna_BoneGroup_name_set(PointerRNA *ptr, const char *value)
 
 static IDProperty *rna_PoseBone_idprops(PointerRNA *ptr, int create)
 {
-	bPoseChannel *pchan= ptr->data;
+	bPoseChannel *pchan = ptr->data;
 
-	if(create && !pchan->prop) {
+	if (create && !pchan->prop) {
 		IDPropertyTemplate val = {0};
-		pchan->prop= IDP_New(IDP_GROUP, &val, "RNA_PoseBone group");
+		pchan->prop = IDP_New(IDP_GROUP, &val, "RNA_PoseBone group");
 	}
 
 	return pchan->prop;
@@ -165,10 +163,10 @@ static IDProperty *rna_PoseBone_idprops(PointerRNA *ptr, int create)
 
 static void rna_Pose_ik_solver_set(struct PointerRNA *ptr, int value)
 {
-	bPose *pose= (bPose*)ptr->data;
+	bPose *pose = (bPose*)ptr->data;
 
 	if (pose->iksolver != value) {
-		// the solver has changed, must clean any temporary structures
+		/* the solver has changed, must clean any temporary structures */
 		BIK_clear_data(pose);
 		if (pose->ikparam) {
 			MEM_freeN(pose->ikparam);
@@ -181,10 +179,10 @@ static void rna_Pose_ik_solver_set(struct PointerRNA *ptr, int value)
 
 static void rna_Pose_ik_solver_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Object *ob= ptr->id.data;
+	Object *ob = ptr->id.data;
 	bPose *pose = ptr->data;
 
-	pose->flag |= POSE_RECALC;	// checks & sorts pose channels
+	pose->flag |= POSE_RECALC;	/* checks & sorts pose channels */
 	DAG_scene_sort(bmain, scene);
 	
 	update_pose_constraint_flags(pose);
@@ -197,40 +195,41 @@ static void rna_Pose_ik_solver_update(Main *bmain, Scene *scene, PointerRNA *ptr
 /* rotation - axis-angle */
 static void rna_PoseChannel_rotation_axis_angle_get(PointerRNA *ptr, float *value)
 {
-	bPoseChannel *pchan= ptr->data;
+	bPoseChannel *pchan = ptr->data;
 	
 	/* for now, assume that rotation mode is axis-angle */
-	value[0]= pchan->rotAngle;
+	value[0] = pchan->rotAngle;
 	copy_v3_v3(&value[1], pchan->rotAxis);
 }
 
 /* rotation - axis-angle */
 static void rna_PoseChannel_rotation_axis_angle_set(PointerRNA *ptr, const float *value)
 {
-	bPoseChannel *pchan= ptr->data;
+	bPoseChannel *pchan = ptr->data;
 	
 	/* for now, assume that rotation mode is axis-angle */
-	pchan->rotAngle= value[0];
+	pchan->rotAngle = value[0];
 	copy_v3_v3(pchan->rotAxis, (float *)&value[1]);
 	
-	// TODO: validate axis?
+	/* TODO: validate axis? */
 }
 
 static void rna_PoseChannel_rotation_mode_set(PointerRNA *ptr, int value)
 {
-	bPoseChannel *pchan= ptr->data;
+	bPoseChannel *pchan = ptr->data;
 	
 	/* use API Method for conversions... */
-	BKE_rotMode_change_values(pchan->quat, pchan->eul, pchan->rotAxis, &pchan->rotAngle, pchan->rotmode, (short)value);
+	BKE_rotMode_change_values(pchan->quat, pchan->eul, pchan->rotAxis, &pchan->rotAngle,
+	                          pchan->rotmode, (short)value);
 	
 	/* finally, set the new rotation type */
-	pchan->rotmode= value;
+	pchan->rotmode = value;
 }
 
 static void rna_PoseChannel_name_set(PointerRNA *ptr, const char *value)
 {
-	Object *ob= (Object*)ptr->id.data;
-	bPoseChannel *pchan= (bPoseChannel*)ptr->data;
+	Object *ob = (Object*)ptr->id.data;
+	bPoseChannel *pchan = (bPoseChannel*)ptr->data;
 	char oldname[sizeof(pchan->name)], newname[sizeof(pchan->name)];
 
 	/* need to be on the stack */
@@ -242,8 +241,8 @@ static void rna_PoseChannel_name_set(PointerRNA *ptr, const char *value)
 
 static int rna_PoseChannel_has_ik_get(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
-	bPoseChannel *pchan= (bPoseChannel*)ptr->data;
+	Object *ob = (Object*)ptr->id.data;
+	bPoseChannel *pchan = (bPoseChannel*)ptr->data;
 
 	return ED_pose_channel_in_IK_chain(ob, pchan);
 }
@@ -262,13 +261,13 @@ StructRNA *rna_IKParam_refine(PointerRNA *ptr)
 
 PointerRNA rna_Pose_ikparam_get(struct PointerRNA *ptr)
 {
-	bPose *pose= (bPose*)ptr->data;
+	bPose *pose = (bPose*)ptr->data;
 	return rna_pointer_inherit_refine(ptr, &RNA_IKParam, pose->ikparam);
 }
 
 static StructRNA *rna_Pose_ikparam_typef(PointerRNA *ptr)
 {
-	bPose *pose= (bPose*)ptr->data;
+	bPose *pose = (bPose*)ptr->data;
 
 	switch (pose->iksolver) {
 	case IKSOLVER_ITASC:
@@ -305,10 +304,10 @@ static void rna_Itasc_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerR
 
 static void rna_Itasc_update_rebuild(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Object *ob= ptr->id.data;
+	Object *ob = ptr->id.data;
 	bPose *pose = ob->pose;
 
-	pose->flag |= POSE_RECALC;	// checks & sorts pose channels
+	pose->flag |= POSE_RECALC;	/* checks & sorts pose channels */
 	rna_Itasc_update(bmain, scene, ptr);
 }
 
@@ -329,174 +328,174 @@ static void rna_PoseChannel_bone_custom_set(PointerRNA *ptr, PointerRNA value)
 
 static PointerRNA rna_PoseChannel_bone_group_get(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
-	bPose *pose= (ob) ? ob->pose : NULL;
-	bPoseChannel *pchan= (bPoseChannel*)ptr->data;
+	Object *ob = (Object*)ptr->id.data;
+	bPose *pose = (ob) ? ob->pose : NULL;
+	bPoseChannel *pchan = (bPoseChannel*)ptr->data;
 	bActionGroup *grp;
 	
 	if (pose)
-		grp= BLI_findlink(&pose->agroups, pchan->agrp_index-1);
+		grp = BLI_findlink(&pose->agroups, pchan->agrp_index-1);
 	else
-		grp= NULL;
+		grp = NULL;
 	
 	return rna_pointer_inherit_refine(ptr, &RNA_BoneGroup, grp);
 }
 
 static void rna_PoseChannel_bone_group_set(PointerRNA *ptr, PointerRNA value)
 {
-	Object *ob= (Object*)ptr->id.data;
-	bPose *pose= (ob) ? ob->pose : NULL;
-	bPoseChannel *pchan= (bPoseChannel*)ptr->data;
+	Object *ob = (Object*)ptr->id.data;
+	bPose *pose = (ob) ? ob->pose : NULL;
+	bPoseChannel *pchan = (bPoseChannel*)ptr->data;
 	
 	if (pose)
-		pchan->agrp_index= BLI_findindex(&pose->agroups, value.data) + 1;
+		pchan->agrp_index = BLI_findindex(&pose->agroups, value.data) + 1;
 	else
-		pchan->agrp_index= 0;
+		pchan->agrp_index = 0;
 }
 
 static int rna_PoseChannel_bone_group_index_get(PointerRNA *ptr)
 {
-	bPoseChannel *pchan= (bPoseChannel*)ptr->data;
+	bPoseChannel *pchan = (bPoseChannel*)ptr->data;
 	return MAX2(pchan->agrp_index-1, 0);
 }
 
 static void rna_PoseChannel_bone_group_index_set(PointerRNA *ptr, int value)
 {
-	bPoseChannel *pchan= (bPoseChannel*)ptr->data;
-	pchan->agrp_index= value+1;
+	bPoseChannel *pchan = (bPoseChannel*)ptr->data;
+	pchan->agrp_index = value+1;
 }
 
-static void rna_PoseChannel_bone_group_index_range(PointerRNA *ptr, int *min, int *max)
+static void rna_PoseChannel_bone_group_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
 {
-	Object *ob= (Object*)ptr->id.data;
-	bPose *pose= (ob) ? ob->pose : NULL;
+	Object *ob = (Object*)ptr->id.data;
+	bPose *pose = (ob) ? ob->pose : NULL;
 	
-	*min= 0;
+	*min = 0;
 	
 	if (pose) {
-		*max= BLI_countlist(&pose->agroups)-1;
-		*max= MAX2(0, *max);
+		*max = BLI_countlist(&pose->agroups)-1;
+		*max = MAX2(0, *max);
 	}
 	else
-		*max= 0;
+		*max = 0;
 }
 
 static PointerRNA rna_Pose_active_bone_group_get(PointerRNA *ptr)
 {
-	bPose *pose= (bPose*)ptr->data;
+	bPose *pose = (bPose*)ptr->data;
 	return rna_pointer_inherit_refine(ptr, &RNA_BoneGroup, BLI_findlink(&pose->agroups, pose->active_group-1));
 }
 
 static void rna_Pose_active_bone_group_set(PointerRNA *ptr, PointerRNA value)
 {
-	bPose *pose= (bPose*)ptr->data;
-	pose->active_group= BLI_findindex(&pose->agroups, value.data) + 1;
+	bPose *pose = (bPose*)ptr->data;
+	pose->active_group = BLI_findindex(&pose->agroups, value.data) + 1;
 }
 
 static int rna_Pose_active_bone_group_index_get(PointerRNA *ptr)
 {
-	bPose *pose= (bPose*)ptr->data;
+	bPose *pose = (bPose*)ptr->data;
 	return MAX2(pose->active_group-1, 0);
 }
 
 static void rna_Pose_active_bone_group_index_set(PointerRNA *ptr, int value)
 {
-	bPose *pose= (bPose*)ptr->data;
-	pose->active_group= value+1;
+	bPose *pose = (bPose*)ptr->data;
+	pose->active_group = value+1;
 }
 
-static void rna_Pose_active_bone_group_index_range(PointerRNA *ptr, int *min, int *max)
+static void rna_Pose_active_bone_group_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
 {
-	bPose *pose= (bPose*)ptr->data;
+	bPose *pose = (bPose*)ptr->data;
 
-	*min= 0;
-	*max= BLI_countlist(&pose->agroups)-1;
-	*max= MAX2(0, *max);
+	*min = 0;
+	*max = BLI_countlist(&pose->agroups)-1;
+	*max = MAX2(0, *max);
 }
 
 #if 0
 static void rna_pose_bgroup_name_index_get(PointerRNA *ptr, char *value, int index)
 {
-	bPose *pose= (bPose*)ptr->data;
+	bPose *pose = (bPose*)ptr->data;
 	bActionGroup *grp;
 
-	grp= BLI_findlink(&pose->agroups, index-1);
+	grp = BLI_findlink(&pose->agroups, index-1);
 
-	if(grp) BLI_strncpy(value, grp->name, sizeof(grp->name));
-	else value[0]= '\0';
+	if (grp) BLI_strncpy(value, grp->name, sizeof(grp->name));
+	else value[0] = '\0';
 }
 
 static int rna_pose_bgroup_name_index_length(PointerRNA *ptr, int index)
 {
-	bPose *pose= (bPose*)ptr->data;
+	bPose *pose = (bPose*)ptr->data;
 	bActionGroup *grp;
 
-	grp= BLI_findlink(&pose->agroups, index-1);
+	grp = BLI_findlink(&pose->agroups, index-1);
 	return (grp)? strlen(grp->name): 0;
 }
 
 static void rna_pose_bgroup_name_index_set(PointerRNA *ptr, const char *value, short *index)
 {
-	bPose *pose= (bPose*)ptr->data;
+	bPose *pose = (bPose*)ptr->data;
 	bActionGroup *grp;
 	int a;
 	
-	for (a=1, grp=pose->agroups.first; grp; grp=grp->next, a++) {
+	for (a = 1, grp = pose->agroups.first; grp; grp = grp->next, a++) {
 		if (strcmp(grp->name, value) == 0) {
-			*index= a;
+			*index = a;
 			return;
 		}
 	}
 	
-	*index= 0;
+	*index = 0;
 }
 
 static void rna_pose_pgroup_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
 {
-	bPose *pose= (bPose*)ptr->data;
+	bPose *pose = (bPose*)ptr->data;
 	bActionGroup *grp;
 	
-	for (grp= pose->agroups.first; grp; grp= grp->next) {
+	for (grp = pose->agroups.first; grp; grp = grp->next) {
 		if (strcmp(grp->name, value) == 0) {
 			BLI_strncpy(result, value, maxlen);
 			return;
 		}
 	}
 	
-	result[0]= '\0';
+	result[0] = '\0';
 }
 #endif
 
 static PointerRNA rna_PoseChannel_active_constraint_get(PointerRNA *ptr)
 {
-	bPoseChannel *pchan= (bPoseChannel*)ptr->data;
-	bConstraint *con= constraints_get_active(&pchan->constraints);
+	bPoseChannel *pchan = (bPoseChannel*)ptr->data;
+	bConstraint *con = constraints_get_active(&pchan->constraints);
 	return rna_pointer_inherit_refine(ptr, &RNA_Constraint, con);
 }
 
 static void rna_PoseChannel_active_constraint_set(PointerRNA *ptr, PointerRNA value)
 {
-	bPoseChannel *pchan= (bPoseChannel*)ptr->data;
+	bPoseChannel *pchan = (bPoseChannel*)ptr->data;
 	constraints_set_active(&pchan->constraints, (bConstraint *)value.data);
 }
 
 static bConstraint *rna_PoseChannel_constraints_new(bPoseChannel *pchan, int type)
 {
-	//WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT|NA_ADDED, object);
-	// TODO, pass object also
-	// TODO, new pose bones don't have updated draw flags
+	/*WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT|NA_ADDED, object); */
+	/* TODO, pass object also */
+	/* TODO, new pose bones don't have updated draw flags */
 	return add_pose_constraint(NULL, pchan, NULL, type);
 }
 
 static void rna_PoseChannel_constraints_remove(ID *id, bPoseChannel *pchan, ReportList *reports, bConstraint *con)
 {
-	if(BLI_findindex(&pchan->constraints, con) == -1) {
+	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);
+		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);
@@ -511,16 +510,16 @@ static void rna_PoseChannel_constraints_remove(ID *id, bPoseChannel *pchan, Repo
 
 static int rna_PoseChannel_proxy_editable(PointerRNA *ptr)
 {
-	Object *ob= (Object*)ptr->id.data;
-	bArmature *arm= ob->data;
-	bPoseChannel *pchan= (bPoseChannel*)ptr->data;
+	Object *ob = (Object*)ptr->id.data;
+	bArmature *arm = ob->data;
+	bPoseChannel *pchan = (bPoseChannel*)ptr->data;
 	
 	return (ob->proxy && pchan->bone && (pchan->bone->layer & arm->layer_protected))? 0: PROP_EDITABLE;
 }
 
 static int rna_PoseChannel_location_editable(PointerRNA *ptr, int index)
 {
-	bPoseChannel *pchan= (bPoseChannel*)ptr->data;
+	bPoseChannel *pchan = (bPoseChannel*)ptr->data;
 
 	/* only if the axis in question is locked, not editable... */
 	if ((index == 0) && (pchan->protectflag & OB_LOCK_LOCX))
@@ -535,7 +534,7 @@ static int rna_PoseChannel_location_editable(PointerRNA *ptr, int index)
 
 static int rna_PoseChannel_scale_editable(PointerRNA *ptr, int index)
 {
-	bPoseChannel *pchan= (bPoseChannel*)ptr->data;
+	bPoseChannel *pchan = (bPoseChannel*)ptr->data;
 	
 	/* only if the axis in question is locked, not editable... */
 	if ((index == 0) && (pchan->protectflag & OB_LOCK_SCALEX))
@@ -550,7 +549,7 @@ static int rna_PoseChannel_scale_editable(PointerRNA *ptr, int index)
 
 static int rna_PoseChannel_rotation_euler_editable(PointerRNA *ptr, int index)
 {
-	bPoseChannel *pchan= (bPoseChannel*)ptr->data;
+	bPoseChannel *pchan = (bPoseChannel*)ptr->data;
 	
 	/* only if the axis in question is locked, not editable... */
 	if ((index == 0) && (pchan->protectflag & OB_LOCK_ROTX))
@@ -565,7 +564,7 @@ static int rna_PoseChannel_rotation_euler_editable(PointerRNA *ptr, int index)
 
 static int rna_PoseChannel_rotation_4d_editable(PointerRNA *ptr, int index)
 {
-	bPoseChannel *pchan= (bPoseChannel*)ptr->data;
+	bPoseChannel *pchan = (bPoseChannel*)ptr->data;
 	
 	/* only consider locks if locking components individually... */
 	if (pchan->protectflag & OB_LOCK_ROT4D) {
@@ -586,9 +585,9 @@ static int rna_PoseChannel_rotation_4d_editable(PointerRNA *ptr, int index)
 /* not essential, but much faster then the default lookup function */
 int rna_PoseBones_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
 {
-	bPose *pose= (bPose*)ptr->data;
-	bPoseChannel *pchan= get_pose_channel(pose, key);
-	if(pchan) {
+	bPose *pose = (bPose*)ptr->data;
+	bPoseChannel *pchan = get_pose_channel(pose, key);
+	if (pchan) {
 		RNA_pointer_create(ptr->id.data, &RNA_PoseBone, pchan, r_ptr);
 		return TRUE;
 	}
@@ -599,20 +598,20 @@ int rna_PoseBones_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_
 
 static void rna_PoseChannel_matrix_basis_get(PointerRNA *ptr, float *values)
 {
-	bPoseChannel *pchan= (bPoseChannel*)ptr->data;
+	bPoseChannel *pchan = (bPoseChannel*)ptr->data;
 	pchan_to_mat4(pchan, (float (*)[4])values);
 }
 
 static void rna_PoseChannel_matrix_basis_set(PointerRNA *ptr, const float *values)
 {
-	bPoseChannel *pchan= (bPoseChannel*)ptr->data;
+	bPoseChannel *pchan = (bPoseChannel*)ptr->data;
 	pchan_apply_mat4(pchan, (float (*)[4])values, FALSE); /* no compat for predictable result */
 }
 
 static void rna_PoseChannel_matrix_set(PointerRNA *ptr, const float *values)
 {
-	bPoseChannel *pchan= (bPoseChannel*)ptr->data;
-	Object *ob= (Object*)ptr->id.data;
+	bPoseChannel *pchan = (bPoseChannel*)ptr->data;
+	Object *ob = (Object*)ptr->id.data;
 	float tmat[4][4];
 
 	armature_mat_pose_to_bone_ex(ob, pchan, (float (*)[4])values, tmat);
@@ -653,32 +652,33 @@ static void rna_def_bone_group(BlenderRNA *brna)
 	PropertyRNA *prop;
 	
 	/* struct */
-	srna= RNA_def_struct(brna, "BoneGroup", NULL);
+	srna = RNA_def_struct(brna, "BoneGroup", NULL);
 	RNA_def_struct_sdna(srna, "bActionGroup");
 	RNA_def_struct_ui_text(srna, "Bone Group", "Groups of Pose Channels (Bones)");
 	RNA_def_struct_ui_icon(srna, ICON_GROUP_BONE);
 	
 	/* name */
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Name", "");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_BoneGroup_name_set");
 	RNA_def_struct_name_property(srna, prop);
 	
-	// TODO: add some runtime-collections stuff to access grouped bones 
+	/* TODO: add some runtime-collections stuff to access grouped bones  */
 	
 	/* color set + colors */
-	prop= RNA_def_property(srna, "color_set", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "color_set", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "customCol");
 	RNA_def_property_enum_items(prop, prop_colorSets_items);
 	RNA_def_property_enum_funcs(prop, NULL, "rna_BoneGroup_color_set_set", NULL);
 	RNA_def_property_ui_text(prop, "Color Set", "Custom color set to use");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 	
-		// TODO: editing the colors for this should result in changes to the color type...
-	prop= RNA_def_property(srna, "colors", PROP_POINTER, PROP_NONE);
+		/* TODO: editing the colors for this should result in changes to the color type... */
+	prop = RNA_def_property(srna, "colors", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "ThemeBoneColorSet");
-	RNA_def_property_pointer_sdna(prop, NULL, "cs"); /* NOTE: the DNA data is not really a pointer, but this code works :) */
+		/* NOTE: the DNA data is not really a pointer, but this code works :) */
+	RNA_def_property_pointer_sdna(prop, NULL, "cs");
 	RNA_def_property_ui_text(prop, "Colors", "Copy of the colors associated with the group's color set");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 }
@@ -703,12 +703,12 @@ static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cpro
 	PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, "PoseBoneConstraints");
-	srna= RNA_def_struct(brna, "PoseBoneConstraints", NULL);
+	srna = RNA_def_struct(brna, "PoseBoneConstraints", NULL);
 	RNA_def_struct_sdna(srna, "bPoseChannel");
 	RNA_def_struct_ui_text(srna, "PoseBone Constraints", "Collection of pose bone constraints");
 
 	/* Collection active property */
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Constraint");
 	RNA_def_property_pointer_funcs(prop, "rna_PoseChannel_active_constraint_get",
 	                               "rna_PoseChannel_active_constraint_set", NULL, NULL);
@@ -717,49 +717,49 @@ static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cpro
 
 
 	/* Constraint collection */
-	func= RNA_def_function(srna, "new", "rna_PoseChannel_constraints_new");
+	func = RNA_def_function(srna, "new", "rna_PoseChannel_constraints_new");
 	RNA_def_function_ui_description(func, "Add a constraint to this object");
 	/* return type */
-	parm= RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint");
+	parm = RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint");
 	RNA_def_function_return(func, parm);
 	/* constraint to add */
-	parm= RNA_def_enum(func, "type", constraint_type_items, 1, "", "Constraint type to add");
+	parm = RNA_def_enum(func, "type", constraint_type_items, 1, "", "Constraint type to add");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	func= RNA_def_function(srna, "remove", "rna_PoseChannel_constraints_remove");
+	func = RNA_def_function(srna, "remove", "rna_PoseChannel_constraints_remove");
 	RNA_def_function_ui_description(func, "Remove a constraint from this object");
 	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");
+	parm = RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 }
 
 static void rna_def_pose_channel(BlenderRNA *brna)
-{	
+{
 	static float default_quat[4] = {1,0,0,0};	/* default quaternion values */
 	static float default_axisAngle[4] = {0,0,1,0};	/* default axis-angle rotation values */
 	static float default_scale[3] = {1,1,1}; /* default scale values */
 	
-	const int matrix_dimsize[]= {4, 4};
+	const int matrix_dimsize[] = {4, 4};
 	
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "PoseBone", NULL);
+	srna = RNA_def_struct(brna, "PoseBone", NULL);
 	RNA_def_struct_sdna(srna, "bPoseChannel");
 	RNA_def_struct_ui_text(srna, "Pose Bone", "Channel defining pose data for a bone in a Pose");
 	RNA_def_struct_path_func(srna, "rna_PoseBone_path");
 	RNA_def_struct_idprops_func(srna, "rna_PoseBone_idprops");
 	
 	/* Bone Constraints */
-	prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Constraint");
 	RNA_def_property_ui_text(prop, "Constraints", "Constraints that act on this PoseChannel");
 
 	rna_def_pose_channel_constraints(brna, prop);
 
 	/* Name + Selection Status */
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_PoseChannel_name_set");
 	RNA_def_property_ui_text(prop, "Name", "");
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
@@ -769,83 +769,90 @@ static void rna_def_pose_channel(BlenderRNA *brna)
 	rna_def_motionpath_common(srna);
 	
 	/* Relationships to other bones */
-	prop= RNA_def_property(srna, "bone", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "bone", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "Bone");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Bone", "Bone associated with this PoseBone");
 
-	prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "PoseBone");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Parent", "Parent of this pose bone");
 
-	prop= RNA_def_property(srna, "child", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "child", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "PoseBone");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Child", "Child of this pose bone");
 	
 	/* Transformation settings */
-	prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "loc");
 	RNA_def_property_editable_array_func(prop, "rna_PoseChannel_location_editable");
 	RNA_def_property_ui_text(prop, "Location", "");
-	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); // XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too
+	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+		/* XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too */
+	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 
-	prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "size");
 	RNA_def_property_editable_array_func(prop, "rna_PoseChannel_scale_editable");
 	RNA_def_property_float_array_default(prop, default_scale);
 	RNA_def_property_ui_text(prop, "Scale", "");
-	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); // XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too
+		/* XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too */
+	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 
-	prop= RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
+	prop = RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
 	RNA_def_property_float_sdna(prop, NULL, "quat");
 	RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable");
 	RNA_def_property_float_array_default(prop, default_quat);
 	RNA_def_property_ui_text(prop, "Quaternion Rotation", "Rotation in Quaternions");
-	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); // XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too
+		/* XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too */
+	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 	
 		/* XXX: for axis-angle, it would have been nice to have 2 separate fields for UI purposes, but
 		 * having a single one is better for Keyframing and other property-management situations...
 		 */
-	prop= RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
+	prop = RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_float_funcs(prop, "rna_PoseChannel_rotation_axis_angle_get",
 	                             "rna_PoseChannel_rotation_axis_angle_set", NULL);
 	RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable");
 	RNA_def_property_float_array_default(prop, default_axisAngle);
 	RNA_def_property_ui_text(prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
-	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); // XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too
+		/* XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too */
+	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 	
-	prop= RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
+	prop = RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
 	RNA_def_property_float_sdna(prop, NULL, "eul");
 	RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_euler_editable");
-	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); // XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too
+		/* XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too */
+	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_ui_text(prop, "Euler Rotation", "Rotation in Eulers");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 	
-	prop= RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "rotmode");
-	RNA_def_property_enum_items(prop, posebone_rotmode_items); // XXX move to using a single define of this someday
+	RNA_def_property_enum_items(prop, posebone_rotmode_items); /* XXX move to using a single define of this someday */
 	RNA_def_property_enum_funcs(prop, NULL, "rna_PoseChannel_rotation_mode_set", NULL);
-	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable"); // XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too
+		/* XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too */
+	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_ui_text(prop, "Rotation Mode", "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 	
 	/* transform matrices - should be read-only since these are set directly by AnimSys evaluation */
-	prop= RNA_def_property(srna, "matrix_channel", PROP_FLOAT, PROP_MATRIX);
+	prop = RNA_def_property(srna, "matrix_channel", PROP_FLOAT, PROP_MATRIX);
 	RNA_def_property_float_sdna(prop, NULL, "chan_mat");
 	RNA_def_property_multi_array(prop, 2, matrix_dimsize);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Channel Matrix", "4x4 matrix, before constraints");
 
 	/* writable because it touches loc/scale/rot directly */
-	prop= RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX);
+	prop = RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX);
 	RNA_def_property_multi_array(prop, 2, matrix_dimsize);
 	RNA_def_property_ui_text(prop, "Basis Matrix",
 	                         "Alternative access to location/scale/rotation relative to the parent and own rest bone");
@@ -854,157 +861,160 @@ static void rna_def_pose_channel(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 
 	/* final matrix */
-	prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
+	prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
 	RNA_def_property_float_sdna(prop, NULL, "pose_mat");
 	RNA_def_property_multi_array(prop, 2, matrix_dimsize);
 	RNA_def_property_float_funcs(prop, NULL, "rna_PoseChannel_matrix_set", NULL);
-	RNA_def_property_ui_text(prop, "Pose Matrix", "Final 4x4 matrix after constraints and drivers are applied (object space)");
+	RNA_def_property_ui_text(prop, "Pose Matrix",
+	                         "Final 4x4 matrix after constraints and drivers are applied (object space)");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 
 	/* Head/Tail Coordinates (in Pose Space) - Automatically calculated... */
-	prop= RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "pose_head");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Pose Head Position", "Location of head of the channel's bone");
+	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
 
-	prop= RNA_def_property(srna, "tail", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "tail", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "pose_tail");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Pose Tail Position", "Location of tail of the channel's bone");
+	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
 	
 	/* IK Settings */
-	prop= RNA_def_property(srna, "is_in_ik_chain", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_in_ik_chain", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop,  "rna_PoseChannel_has_ik_get", NULL);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Has IK", "Is part of an IK chain");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
 
-	prop= RNA_def_property(srna, "lock_ik_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_ik_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_NO_XDOF);
 	RNA_def_property_ui_text(prop, "IK X Lock", "Disallow movement around the X axis");
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
 
-	prop= RNA_def_property(srna, "lock_ik_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_ik_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_NO_YDOF);
 	RNA_def_property_ui_text(prop, "IK Y Lock", "Disallow movement around the Y axis");
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
 
-	prop= RNA_def_property(srna, "lock_ik_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_ik_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_NO_ZDOF);
 	RNA_def_property_ui_text(prop, "IK Z Lock", "Disallow movement around the Z axis");
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
 
-	prop= RNA_def_property(srna, "use_ik_limit_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_ik_limit_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_XLIMIT);
 	RNA_def_property_ui_text(prop, "IK X Limit", "Limit movement around the X axis");
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
 
-	prop= RNA_def_property(srna, "use_ik_limit_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_ik_limit_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_YLIMIT);
 	RNA_def_property_ui_text(prop, "IK Y Limit", "Limit movement around the Y axis");
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
 
-	prop= RNA_def_property(srna, "use_ik_limit_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_ik_limit_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_ZLIMIT);
 	RNA_def_property_ui_text(prop, "IK Z Limit", "Limit movement around the Z axis");
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
 	
-	prop= RNA_def_property(srna, "use_ik_rotation_control", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_ik_rotation_control", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_ROTCTL);
 	RNA_def_property_ui_text(prop, "IK rot control", "Apply channel rotation as IK constraint");
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
 	
-	prop= RNA_def_property(srna, "use_ik_linear_control", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_ik_linear_control", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_LINCTL);
 	RNA_def_property_ui_text(prop, "IK rot control", "Apply channel size as IK constraint if stretching is enabled");
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
 	
-	prop= RNA_def_property(srna, "ik_min_x", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "ik_min_x", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "limitmin[0]");
 	RNA_def_property_range(prop, -M_PI, 0.0f);
 	RNA_def_property_ui_text(prop, "IK X Minimum", "Minimum angles for IK Limit");
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
 
-	prop= RNA_def_property(srna, "ik_max_x", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "ik_max_x", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "limitmax[0]");
 	RNA_def_property_range(prop, 0.0f, M_PI);
 	RNA_def_property_ui_text(prop, "IK X Maximum", "Maximum angles for IK Limit");
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
 
-	prop= RNA_def_property(srna, "ik_min_y", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "ik_min_y", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "limitmin[1]");
 	RNA_def_property_range(prop, -M_PI, 0.0f);
 	RNA_def_property_ui_text(prop, "IK Y Minimum", "Minimum angles for IK Limit");
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
 
-	prop= RNA_def_property(srna, "ik_max_y", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "ik_max_y", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "limitmax[1]");
 	RNA_def_property_range(prop, 0.0f, M_PI);
 	RNA_def_property_ui_text(prop, "IK Y Maximum", "Maximum angles for IK Limit");
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
 
-	prop= RNA_def_property(srna, "ik_min_z", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "ik_min_z", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "limitmin[2]");
 	RNA_def_property_range(prop, -M_PI, 0.0f);
 	RNA_def_property_ui_text(prop, "IK Z Minimum", "Minimum angles for IK Limit");
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
 
-	prop= RNA_def_property(srna, "ik_max_z", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "ik_max_z", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "limitmax[2]");
 	RNA_def_property_range(prop, 0.0f, M_PI);
 	RNA_def_property_ui_text(prop, "IK Z Maximum", "Maximum angles for IK Limit");
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
 
-	prop= RNA_def_property(srna, "ik_stiffness_x", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "ik_stiffness_x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "stiffness[0]");
 	RNA_def_property_range(prop, 0.0f, 0.99f);
 	RNA_def_property_ui_text(prop, "IK X Stiffness", "IK stiffness around the X axis");
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
 
-	prop= RNA_def_property(srna, "ik_stiffness_y", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "ik_stiffness_y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "stiffness[1]");
 	RNA_def_property_range(prop, 0.0f, 0.99f);
 	RNA_def_property_ui_text(prop, "IK Y Stiffness", "IK stiffness around the Y axis");
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
 
-	prop= RNA_def_property(srna, "ik_stiffness_z", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "ik_stiffness_z", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "stiffness[2]");
 	RNA_def_property_range(prop, 0.0f, 0.99f);
 	RNA_def_property_ui_text(prop, "IK Z Stiffness", "IK stiffness around the Z axis");
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
 
-	prop= RNA_def_property(srna, "ik_stretch", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "ik_stretch", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "ikstretch");
 	RNA_def_property_range(prop, 0.0f,1.0f);
 	RNA_def_property_ui_text(prop, "IK Stretch", "Allow scaling of the bone for IK");
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_IK_update");
 	
-	prop= RNA_def_property(srna, "ik_rotation_weight", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "ik_rotation_weight", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "ikrotweight");
 	RNA_def_property_range(prop, 0.0f,1.0f);
 	RNA_def_property_ui_text(prop, "IK Rot Weight", "Weight of rotation constraint for IK");
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 	
-	prop= RNA_def_property(srna, "ik_linear_weight", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "ik_linear_weight", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "iklinweight");
 	RNA_def_property_range(prop, 0.0f,1.0f);
 	RNA_def_property_ui_text(prop, "IK Lin Weight", "Weight of scale constraint for IK");
@@ -1012,7 +1022,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 	
 	/* custom bone shapes */
-	prop= RNA_def_property(srna, "custom_shape", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "custom_shape", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "custom");
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
@@ -1021,16 +1031,17 @@ static void rna_def_pose_channel(BlenderRNA *brna)
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 	
-	prop= RNA_def_property(srna, "custom_shape_transform", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "custom_shape_transform", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "custom_tx");
 	RNA_def_property_struct_type(prop, "PoseBone");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "Custom Shape Transform", "Bone that defines the display transform of this custom shape");
+	RNA_def_property_ui_text(prop, "Custom Shape Transform",
+	                         "Bone that defines the display transform of this custom shape");
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 	
 	/* bone groups */
-	prop= RNA_def_property(srna, "bone_group_index", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "bone_group_index", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "agrp_index");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
@@ -1040,16 +1051,17 @@ static void rna_def_pose_channel(BlenderRNA *brna)
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 	
-	prop= RNA_def_property(srna, "bone_group", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "bone_group", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "BoneGroup");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
-	RNA_def_property_pointer_funcs(prop, "rna_PoseChannel_bone_group_get", "rna_PoseChannel_bone_group_set", NULL, NULL);
+	RNA_def_property_pointer_funcs(prop, "rna_PoseChannel_bone_group_get",
+	                               "rna_PoseChannel_bone_group_set", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Bone Group", "Bone Group this pose channel belongs to");
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 	
 	/* transform locks */
-	prop= RNA_def_property(srna, "lock_location", PROP_BOOLEAN, PROP_XYZ);
+	prop = RNA_def_property(srna, "lock_location", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_LOCX);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Lock Location", "Lock editing of location in the interface");
@@ -1057,7 +1069,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 
-	prop= RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_XYZ);
+	prop = RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTX);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Lock Rotation", "Lock editing of rotation in the interface");
@@ -1065,8 +1077,9 @@ static void rna_def_pose_channel(BlenderRNA *brna)
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 	
-		// XXX this is sub-optimal - it really should be included above, but due to technical reasons we can't do this!
-	prop= RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE);
+		/* XXX this is sub-optimal - it really should be included above, but due to technical reasons
+		 *     we can't do this! */
+	prop = RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTW);
 	RNA_def_property_ui_text(prop, "Lock Rotation (4D Angle)",
 	                         "Lock editing of 'angle' component of four-component rotations in the interface");
@@ -1074,15 +1087,15 @@ static void rna_def_pose_channel(BlenderRNA *brna)
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 
-		// XXX this needs a better name
-	prop= RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE);
+		/* XXX this needs a better name */
+	prop = RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROT4D);
 	RNA_def_property_ui_text(prop, "Lock Rotations (4D)",
 	                         "Lock editing of four component rotations by components (instead of as Eulers)");
 	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 
-	prop= RNA_def_property(srna, "lock_scale", PROP_BOOLEAN, PROP_XYZ);
+	prop = RNA_def_property(srna, "lock_scale", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_SCALEX);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Lock Scale", "Lock editing of scale in the interface");
@@ -1095,16 +1108,18 @@ static void rna_def_pose_channel(BlenderRNA *brna)
 
 static void rna_def_pose_itasc(BlenderRNA *brna)
 {
-	static const EnumPropertyItem prop_itasc_mode_items[]= {
+	static const EnumPropertyItem prop_itasc_mode_items[] = {
 		{0, "ANIMATION", 0, "Animation",
 		    "Stateless solver computing pose starting from current action and non-IK constraints"},
 		{ITASC_SIMULATION, "SIMULATION", 0, "Simulation",
-		                   "Statefull solver running in real-time context and ignoring actions and non-IK constraints"},
+		                   "Statefull solver running in real-time context and ignoring actions "
+		                   "and non-IK constraints"},
 		{0, NULL, 0, NULL, NULL}};
-	static const EnumPropertyItem prop_itasc_reiteration_items[]= {
+	static const EnumPropertyItem prop_itasc_reiteration_items[] = {
 		{0, "NEVER", 0, "Never", "The solver does not reiterate, not even on first frame (starts from rest pose)"},
 		{ITASC_INITIAL_REITERATION, "INITIAL", 0, "Initial",
-		                            "The solver reiterates (converges) on the first frame but not on subsequent frame"},
+		                            "The solver reiterates (converges) on the first frame but not on "
+		                            "subsequent frame"},
 		{ITASC_INITIAL_REITERATION|ITASC_REITERATION, "ALWAYS", 0, "Always",
 		                                              "The solver reiterates (converges) on all frames"},
 		{0, NULL, 0, NULL, NULL}};
@@ -1112,35 +1127,36 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "Itasc", "IKParam");
+	srna = RNA_def_struct(brna, "Itasc", "IKParam");
 	RNA_def_struct_sdna(srna, "bItasc");
 	RNA_def_struct_ui_text(srna, "bItasc", "Parameters for the iTaSC IK solver");
 
-	prop= RNA_def_property(srna, "precision", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "precision", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "precision");
 	RNA_def_property_range(prop, 0.0f,0.1f);
 	RNA_def_property_ui_text(prop, "Precision", "Precision of convergence in case of reiteration");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
 
-	prop= RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
+	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_ui_text(prop, "Iterations", "Maximum number of iterations for convergence in case of reiteration");
+	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");
 
-	prop= RNA_def_property(srna, "step_count", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "step_count", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "numstep");
 	RNA_def_property_range(prop, 1.f, 50.f);
 	RNA_def_property_ui_text(prop, "Num steps", "Divide the frame interval into this many steps");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
 
-	prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, prop_itasc_mode_items);
 	RNA_def_property_ui_text(prop, "Mode", NULL);
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update_rebuild");
 
-	prop= RNA_def_property(srna, "reiteration_method", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "reiteration_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, prop_itasc_reiteration_items);
 	RNA_def_property_ui_text(prop, "Reiteration",
@@ -1148,44 +1164,46 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
 	                         "precision is met) on none, first or all frames");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
 
-	prop= RNA_def_property(srna, "use_auto_step", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_auto_step", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", ITASC_AUTO_STEP);
 	RNA_def_property_ui_text(prop, "Auto step",
-	                         "Automatically determine the optimal number of steps for best performance/accuracy trade off");
+	                         "Automatically determine the optimal number of steps for best "
+	                         "performance/accuracy trade off");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
 
-	prop= RNA_def_property(srna, "step_min", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "step_min", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "minstep");
 	RNA_def_property_range(prop, 0.0f,0.1f);
 	RNA_def_property_ui_text(prop, "Min step", "Lower bound for timestep in second in case of automatic substeps");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
 
-	prop= RNA_def_property(srna, "step_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "step_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "maxstep");
 	RNA_def_property_range(prop, 0.0f,1.0f);
 	RNA_def_property_ui_text(prop, "Max step", "Higher bound for timestep in second in case of automatic substeps");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
 
-	prop= RNA_def_property(srna, "feedback", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "feedback", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "feedback");
 	RNA_def_property_range(prop, 0.0f,100.0f);
 	RNA_def_property_ui_text(prop, "Feedback",
-	                         "Feedback coefficient for error correction, average response time is 1/feedback (default=20)");
+	                         "Feedback coefficient for error correction, average response time is 1/feedback "
+	                         "(default=20)");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
 
-	prop= RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "maxvel");
 	RNA_def_property_range(prop, 0.0f,100.0f);
 	RNA_def_property_ui_text(prop, "Max Velocity", "Maximum joint velocity in rad/s (default=50)");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
 
-	prop= RNA_def_property(srna, "solver", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "solver", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "solver");
 	RNA_def_property_enum_items(prop, prop_solver_items);
 	RNA_def_property_ui_text(prop, "Solver", "Solving method selection: automatic damping or manual damping");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update_rebuild");
 
-	prop= RNA_def_property(srna, "damping_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "damping_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "dampmax");
 	RNA_def_property_range(prop, 0.0f,1.0f);
 	RNA_def_property_ui_text(prop, "Damp",
@@ -1193,7 +1211,7 @@ static void rna_def_pose_itasc(BlenderRNA *brna)
 	                         "(higher values=more stability, less reactivity - default=0.5)");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Itasc_update");
 
-	prop= RNA_def_property(srna, "damping_epsilon", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "damping_epsilon", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "dampeps");
 	RNA_def_property_range(prop, 0.0f,1.0f);
 	RNA_def_property_ui_text(prop, "Epsilon",
@@ -1207,16 +1225,17 @@ static void rna_def_pose_ikparam(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "IKParam", NULL);
+	srna = RNA_def_struct(brna, "IKParam", NULL);
 	RNA_def_struct_sdna(srna, "bIKParam");
 	RNA_def_struct_ui_text(srna, "IKParam", "Base type for IK solver parameters");
 	RNA_def_struct_refine_func(srna, "rna_IKParam_refine");
 
-	prop= RNA_def_property(srna, "ik_solver", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "ik_solver", PROP_ENUM, PROP_NONE);
 	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, 0 for Legacy, 1 for iTaSC");
 }
 
 /* pose.bone_groups */
@@ -1225,22 +1244,23 @@ static void rna_def_bone_groups(BlenderRNA *brna, PropertyRNA *cprop)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-//	FunctionRNA *func;
-//	PropertyRNA *parm;
+/*	FunctionRNA *func; */
+/*	PropertyRNA *parm; */
 
 	RNA_def_property_srna(cprop, "BoneGroups");
-	srna= RNA_def_struct(brna, "BoneGroups", NULL);
+	srna = RNA_def_struct(brna, "BoneGroups", NULL);
 	RNA_def_struct_sdna(srna, "bPose");
 	RNA_def_struct_ui_text(srna, "Bone Groups", "Collection of bone groups");
 
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "BoneGroup");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
-	RNA_def_property_pointer_funcs(prop, "rna_Pose_active_bone_group_get", "rna_Pose_active_bone_group_set", NULL, NULL);
+	RNA_def_property_pointer_funcs(prop, "rna_Pose_active_bone_group_get",
+	                               "rna_Pose_active_bone_group_set", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Active Bone Group", "Active bone group for this pose");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 	
-	prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "active_group");
 	RNA_def_property_int_funcs(prop, "rna_Pose_active_bone_group_index_get", "rna_Pose_active_bone_group_index_set",
 	                           "rna_Pose_active_bone_group_index_range");
@@ -1254,25 +1274,27 @@ static void rna_def_pose(BlenderRNA *brna)
 	PropertyRNA *prop;
 	
 	/* struct definition */
-	srna= RNA_def_struct(brna, "Pose", NULL);
+	srna = RNA_def_struct(brna, "Pose", NULL);
 	RNA_def_struct_sdna(srna, "bPose");
 	RNA_def_struct_ui_text(srna, "Pose", "A collection of pose channels, including settings for animating bones");
 
 	/* pose channels */
-	prop= RNA_def_property(srna, "bones", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "bones", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "chanbase", NULL);
 	RNA_def_property_struct_type(prop, "PoseBone");
 	RNA_def_property_ui_text(prop, "Pose Bones", "Individual pose bones for the armature");
-	RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, "rna_PoseBones_lookup_string", NULL); /* can be removed, only for fast lookup */
+		/* can be removed, only for fast lookup */
+	RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, "rna_PoseBones_lookup_string", NULL);
+
 	/* bone groups */
-	prop= RNA_def_property(srna, "bone_groups", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "bone_groups", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "agroups", NULL);
 	RNA_def_property_struct_type(prop, "BoneGroup");
 	RNA_def_property_ui_text(prop, "Bone Groups", "Groups of the bones");
 	rna_def_bone_groups(brna, prop);
 	
 	/* ik solvers */
-	prop= RNA_def_property(srna, "ik_solver", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "ik_solver", PROP_ENUM, PROP_NONE);
 	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);
@@ -1280,7 +1302,7 @@ static void rna_def_pose(BlenderRNA *brna)
 	                         "Selection of IK solver for IK chain, current choice is 0 for Legacy, 1 for iTaSC");
 	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);
+	prop = RNA_def_property(srna, "ik_param", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "IKParam");
 	RNA_def_property_pointer_funcs(prop, "rna_Pose_ikparam_get", NULL, "rna_Pose_ikparam_typef", NULL);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
diff --git a/source/blender/makesrna/intern/rna_pose_api.c b/source/blender/makesrna/intern/rna_pose_api.c
index b8eda78..14f7b7c 100644
--- a/source/blender/makesrna/intern/rna_pose_api.c
+++ b/source/blender/makesrna/intern/rna_pose_api.c
@@ -1,11 +1,11 @@
 /*
- * 
+ *
  * ***** 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. 
+ * of the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -19,7 +19,7 @@
  * The Original Code is Copyright (C) 2009 Blender Foundation.
  * All rights reserved.
  *
- * 
+ *
  * Contributor(s): Blender Foundation
  *
  * ***** END GPL LICENSE BLOCK *****
@@ -53,7 +53,8 @@ static float rna_PoseBone_do_envelope(bPoseChannel *chan, float *vec)
 
 	float scale = (bone->flag & BONE_MULT_VG_ENV) == BONE_MULT_VG_ENV ? bone->weight : 1.0f;
 
-	return distfactor_to_bone(vec, chan->pose_head, chan->pose_tail, bone->rad_head * scale, bone->rad_tail * scale, bone->dist * scale);
+	return distfactor_to_bone(vec, chan->pose_head, chan->pose_tail, bone->rad_head * scale,
+	                          bone->rad_tail * scale, bone->dist * scale);
 }
 #else
 
@@ -68,13 +69,13 @@ void RNA_api_pose_channel(StructRNA *srna)
 	PropertyRNA *parm;
 	FunctionRNA *func;
 
-	func= RNA_def_function(srna, "evaluate_envelope", "rna_PoseBone_do_envelope");
+	func = RNA_def_function(srna, "evaluate_envelope", "rna_PoseBone_do_envelope");
 	RNA_def_function_ui_description(func, "Calculate bone envelope at given point");
-	parm= RNA_def_float_vector_xyz(func, "point", 3, NULL, -FLT_MAX, FLT_MAX, "Point",
+	parm = RNA_def_float_vector_xyz(func, "point", 3, NULL, -FLT_MAX, FLT_MAX, "Point",
 	                               "Position in 3d space to evaluate", -FLT_MAX, FLT_MAX);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	/* return value */
-	parm= RNA_def_float(func, "factor", 0, -FLT_MAX, FLT_MAX, "Factor", "Envelope factor", -FLT_MAX, FLT_MAX);
+	parm = RNA_def_float(func, "factor", 0, -FLT_MAX, FLT_MAX, "Factor", "Envelope factor", -FLT_MAX, FLT_MAX);
 	RNA_def_function_return(func, parm);
 }
 
diff --git a/source/blender/makesrna/intern/rna_property.c b/source/blender/makesrna/intern/rna_property.c
index dfdc175..3eac129 100644
--- a/source/blender/makesrna/intern/rna_property.c
+++ b/source/blender/makesrna/intern/rna_property.c
@@ -35,7 +35,7 @@
 
 #include "WM_types.h"
 
-EnumPropertyItem gameproperty_type_items[] ={
+EnumPropertyItem gameproperty_type_items[] = {
 	{GPROP_BOOL, "BOOL", 0, "Boolean", "Boolean Property"},
 	{GPROP_INT, "INT", 0, "Integer", "Integer Property"},
 	{GPROP_FLOAT, "FLOAT", 0, "Float", "Floating-Point Property"},
@@ -50,9 +50,9 @@ EnumPropertyItem gameproperty_type_items[] ={
 
 static StructRNA* rna_GameProperty_refine(struct PointerRNA *ptr)
 {
-	bProperty *property= (bProperty*)ptr->data;
+	bProperty *property = (bProperty*)ptr->data;
 
-	switch(property->type){
+	switch (property->type) {
 		case GPROP_BOOL:
 			return &RNA_GameBooleanProperty;
 		case GPROP_INT:
@@ -71,30 +71,30 @@ static StructRNA* rna_GameProperty_refine(struct PointerRNA *ptr)
 /* for both float and timer */
 static float rna_GameFloatProperty_value_get(PointerRNA *ptr)
 {
-	bProperty *prop= (bProperty*)(ptr->data);
+	bProperty *prop = (bProperty*)(ptr->data);
 	return *(float*)(&prop->data);
 }
 
 static void rna_GameFloatProperty_value_set(PointerRNA *ptr, float value)
 {
-	bProperty *prop= (bProperty*)(ptr->data);
+	bProperty *prop = (bProperty*)(ptr->data);
 	CLAMP(value, -10000.0f, 10000.0f);
-	*(float*)(&prop->data)= value;
+	*(float*)(&prop->data) = value;
 }
 
 static void rna_GameProperty_type_set(PointerRNA *ptr, int value)
 {
-	bProperty *prop= (bProperty*)(ptr->data);
+	bProperty *prop = (bProperty*)(ptr->data);
 
-	if(prop->type != value) {
-		prop->type= value;
+	if (prop->type != value) {
+		prop->type = value;
 		init_property(prop);
 	}
 }
 
 static void rna_GameProperty_name_set(PointerRNA *ptr, const char *value)
 {
-	bProperty *prop= (bProperty*)(ptr->data);
+	bProperty *prop = (bProperty*)(ptr->data);
 	BLI_strncpy_utf8(prop->name, value, sizeof(prop->name));
 	unique_property(NULL, prop, 1);
 }
@@ -108,80 +108,80 @@ void RNA_def_gameproperty(BlenderRNA *brna)
 	PropertyRNA *prop;
 
 	/* Base Struct for GameProperty */
-	srna= RNA_def_struct(brna, "GameProperty", NULL);
+	srna = RNA_def_struct(brna, "GameProperty", NULL);
 	RNA_def_struct_ui_text(srna , "Game Property", "Game engine user defined object property");
 	RNA_def_struct_sdna(srna, "bProperty");
 	RNA_def_struct_refine_func(srna, "rna_GameProperty_refine");
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Name", "Available as GameObject attributes in the game engine's python API");
 	RNA_def_struct_name_property(srna, prop);
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GameProperty_name_set");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, gameproperty_type_items);
 	RNA_def_property_ui_text(prop, "Type", "");
 	RNA_def_property_enum_funcs(prop, NULL, "rna_GameProperty_type_set", NULL);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "show_debug", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_debug", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PROP_DEBUG);
 	RNA_def_property_ui_text(prop, "Debug", "Print debug information for this property");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* GameBooleanProperty */
-	srna= RNA_def_struct(brna, "GameBooleanProperty", "GameProperty");
+	srna = RNA_def_struct(brna, "GameBooleanProperty", "GameProperty");
 	RNA_def_struct_ui_text(srna , "Game Boolean Property", "Game engine user defined Boolean property");
 	RNA_def_struct_sdna(srna, "bProperty");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "value", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "value", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "data", 1);
 	RNA_def_property_ui_text(prop, "Value", "Property value");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* GameIntProperty */
-	srna= RNA_def_struct(brna, "GameIntProperty", "GameProperty");
+	srna = RNA_def_struct(brna, "GameIntProperty", "GameProperty");
 	RNA_def_struct_ui_text(srna , "Game Integer Property", "Game engine user defined integer number property");
 	RNA_def_struct_sdna(srna, "bProperty");
 
-	prop= RNA_def_property(srna, "value", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "value", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "data");
 	RNA_def_property_ui_text(prop, "Value", "Property value");
 	RNA_def_property_range(prop, -10000, 10000);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* GameFloatProperty */
-	srna= RNA_def_struct(brna, "GameFloatProperty", "GameProperty");
+	srna = RNA_def_struct(brna, "GameFloatProperty", "GameProperty");
 	RNA_def_struct_ui_text(srna, "Game Float Property", "Game engine user defined floating point number property");
 	RNA_def_struct_sdna(srna, "bProperty");
 
-	prop= RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
-	// RNA_def_property_float_sdna(prop, NULL, "data");
+	prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
+	/* RNA_def_property_float_sdna(prop, NULL, "data"); */
 	RNA_def_property_ui_text(prop, "Value", "Property value");
 	RNA_def_property_range(prop, -10000, 10000);
 	RNA_def_property_float_funcs(prop, "rna_GameFloatProperty_value_get", "rna_GameFloatProperty_value_set", NULL);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* GameTimerProperty */
-	srna= RNA_def_struct(brna, "GameTimerProperty", "GameProperty");
+	srna = RNA_def_struct(brna, "GameTimerProperty", "GameProperty");
 	RNA_def_struct_ui_text(srna, "Game Timer Property", "Game engine user defined timer property");
 	RNA_def_struct_sdna(srna, "bProperty");
 
-	prop= RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
-	// RNA_def_property_float_sdna(prop, NULL, "data");
+	prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
+	/* RNA_def_property_float_sdna(prop, NULL, "data"); */
 	RNA_def_property_ui_text(prop, "Value", "Property value");
 	RNA_def_property_range(prop, -10000, 10000);
 	RNA_def_property_float_funcs(prop, "rna_GameFloatProperty_value_get", "rna_GameFloatProperty_value_set", NULL);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* GameStringProperty */
-	srna= RNA_def_struct(brna, "GameStringProperty", "GameProperty");
+	srna = RNA_def_struct(brna, "GameStringProperty", "GameProperty");
 	RNA_def_struct_ui_text(srna, "Game String Property", "Game engine user defined text string property");
 	RNA_def_struct_sdna(srna, "bProperty");
 
-	prop= RNA_def_property(srna, "value", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "value", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "poin");
 	RNA_def_property_string_maxlength(prop, MAX_PROPSTRING);
 	RNA_def_property_ui_text(prop, "Value", "Property value");
diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c
index b88e452..69d9ce0 100644
--- a/source/blender/makesrna/intern/rna_render.c
+++ b/source/blender/makesrna/intern/rna_render.c
@@ -68,7 +68,7 @@ static void engine_update(RenderEngine *engine, Main *bmain, Scene *scene)
 	FunctionRNA *func;
 
 	RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
-	func= &rna_RenderEngine_update_func;
+	func = &rna_RenderEngine_update_func;
 
 	RNA_parameter_list_create(&list, &ptr, func);
 	RNA_parameter_set_lookup(&list, "data", &bmain);
@@ -86,7 +86,7 @@ static void engine_render(RenderEngine *engine, struct Scene *scene)
 	FunctionRNA *func;
 
 	RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
-	func= &rna_RenderEngine_render_func;
+	func = &rna_RenderEngine_render_func;
 
 	RNA_parameter_list_create(&list, &ptr, func);
 	RNA_parameter_set_lookup(&list, "scene", &scene);
@@ -103,7 +103,7 @@ static void engine_view_update(RenderEngine *engine, const struct bContext *cont
 	FunctionRNA *func;
 
 	RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
-	func= &rna_RenderEngine_view_update_func;
+	func = &rna_RenderEngine_view_update_func;
 
 	RNA_parameter_list_create(&list, &ptr, func);
 	RNA_parameter_set_lookup(&list, "context", &context);
@@ -120,7 +120,7 @@ static void engine_view_draw(RenderEngine *engine, const struct bContext *contex
 	FunctionRNA *func;
 
 	RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
-	func= &rna_RenderEngine_view_draw_func;
+	func = &rna_RenderEngine_view_draw_func;
 
 	RNA_parameter_list_create(&list, &ptr, func);
 	RNA_parameter_set_lookup(&list, "context", &context);
@@ -133,9 +133,9 @@ static void engine_view_draw(RenderEngine *engine, const struct bContext *contex
 
 static void rna_RenderEngine_unregister(Main *UNUSED(bmain), StructRNA *type)
 {
-	RenderEngineType *et= RNA_struct_blender_type_get(type);
+	RenderEngineType *et = RNA_struct_blender_type_get(type);
 
-	if(!et)
+	if (!et)
 		return;
 	
 	RNA_struct_free_extension(type, &et->ext);
@@ -143,50 +143,51 @@ static void rna_RenderEngine_unregister(Main *UNUSED(bmain), StructRNA *type)
 	RNA_struct_free(&BLENDER_RNA, type);
 }
 
-static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, void *data, const char *identifier,
+                                            StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
 {
 	RenderEngineType *et, dummyet = {NULL};
-	RenderEngine dummyengine= {NULL};
+	RenderEngine dummyengine = {NULL};
 	PointerRNA dummyptr;
 	int have_function[4];
 
 	/* setup dummy engine & engine type to store static properties in */
-	dummyengine.type= &dummyet;
+	dummyengine.type = &dummyet;
 	RNA_pointer_create(NULL, &RNA_RenderEngine, &dummyengine, &dummyptr);
 
 	/* validate the python class */
-	if(validate(&dummyptr, data, have_function) != 0)
+	if (validate(&dummyptr, data, have_function) != 0)
 		return NULL;
 
-	if(strlen(identifier) >= sizeof(dummyet.idname)) {
+	if (strlen(identifier) >= sizeof(dummyet.idname)) {
 		BKE_reportf(reports, RPT_ERROR, "registering render engine class: '%s' is too long, maximum length is %d",
-		                                identifier, (int)sizeof(dummyet.idname));
+		            identifier, (int)sizeof(dummyet.idname));
 		return NULL;
 	}
 
 	/* check if we have registered this engine type before, and remove it */
-	for(et=R_engines.first; et; et=et->next) {
-		if(strcmp(et->idname, dummyet.idname) == 0) {
-			if(et->ext.srna)
+	for (et = R_engines.first; et; et = et->next) {
+		if (strcmp(et->idname, dummyet.idname) == 0) {
+			if (et->ext.srna)
 				rna_RenderEngine_unregister(bmain, et->ext.srna);
 			break;
 		}
 	}
 	
 	/* create a new engine type */
-	et= MEM_callocN(sizeof(RenderEngineType), "python render engine");
+	et = MEM_callocN(sizeof(RenderEngineType), "python render engine");
 	memcpy(et, &dummyet, sizeof(dummyet));
 
-	et->ext.srna= RNA_def_struct(&BLENDER_RNA, et->idname, "RenderEngine"); 
-	et->ext.data= data;
-	et->ext.call= call;
-	et->ext.free= free;
+	et->ext.srna = RNA_def_struct(&BLENDER_RNA, et->idname, "RenderEngine");
+	et->ext.data = data;
+	et->ext.call = call;
+	et->ext.free = free;
 	RNA_struct_blender_type_set(et->ext.srna, et);
 
-	et->update= (have_function[0])? engine_update: NULL;
-	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 = (have_function[0])? engine_update: NULL;
+	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;
 
 	BLI_addtail(&R_engines, et);
 
@@ -201,67 +202,67 @@ static void **rna_RenderEngine_instance(PointerRNA *ptr)
 
 static StructRNA* rna_RenderEngine_refine(PointerRNA *ptr)
 {
-	RenderEngine *engine= (RenderEngine*)ptr->data;
+	RenderEngine *engine = (RenderEngine*)ptr->data;
 	return (engine->type && engine->type->ext.srna)? engine->type->ext.srna: &RNA_RenderEngine;
 }
 
 static void rna_RenderResult_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	RenderResult *rr= (RenderResult*)ptr->data;
+	RenderResult *rr = (RenderResult*)ptr->data;
 	rna_iterator_listbase_begin(iter, &rr->layers, NULL);
 }
 
 static void rna_RenderLayer_passes_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	RenderLayer *rl= (RenderLayer*)ptr->data;
+	RenderLayer *rl = (RenderLayer*)ptr->data;
 	rna_iterator_listbase_begin(iter, &rl->passes, NULL);
 }
 
 static int rna_RenderLayer_rect_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
 {
-	RenderLayer *rl= (RenderLayer*)ptr->data;
+	RenderLayer *rl = (RenderLayer*)ptr->data;
 
-	length[0]= rl->rectx*rl->recty;
-	length[1]= 4;
+	length[0] = rl->rectx*rl->recty;
+	length[1] = 4;
 
 	return length[0]*length[1];
 }
 
 static void rna_RenderLayer_rect_get(PointerRNA *ptr, float *values)
 {
-	RenderLayer *rl= (RenderLayer*)ptr->data;
+	RenderLayer *rl = (RenderLayer*)ptr->data;
 	memcpy(values, rl->rectf, sizeof(float)*rl->rectx*rl->recty*4);
 }
 
 void rna_RenderLayer_rect_set(PointerRNA *ptr, const float *values)
 {
-	RenderLayer *rl= (RenderLayer*)ptr->data;
+	RenderLayer *rl = (RenderLayer*)ptr->data;
 	memcpy(rl->rectf, values, sizeof(float)*rl->rectx*rl->recty*4);
 }
 
 static int rna_RenderPass_rect_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
 {
-	RenderPass *rpass= (RenderPass*)ptr->data;
+	RenderPass *rpass = (RenderPass*)ptr->data;
 
-	length[0]= rpass->rectx*rpass->recty;
-	length[1]= rpass->channels;
+	length[0] = rpass->rectx*rpass->recty;
+	length[1] = rpass->channels;
 
 	return length[0]*length[1];
 }
 
 static void rna_RenderPass_rect_get(PointerRNA *ptr, float *values)
 {
-	RenderPass *rpass= (RenderPass*)ptr->data;
+	RenderPass *rpass = (RenderPass*)ptr->data;
 	memcpy(values, rpass->rect, sizeof(float)*rpass->rectx*rpass->recty*rpass->channels);
 }
 
 void rna_RenderPass_rect_set(PointerRNA *ptr, const float *values)
 {
-	RenderPass *rpass= (RenderPass*)ptr->data;
+	RenderPass *rpass = (RenderPass*)ptr->data;
 	memcpy(rpass->rect, values, sizeof(float)*rpass->rectx*rpass->recty*rpass->channels);
 }
 
-#else // RNA_RUNTIME
+#else /* RNA_RUNTIME */
 
 static void rna_def_render_engine(BlenderRNA *brna)
 {
@@ -269,31 +270,32 @@ static void rna_def_render_engine(BlenderRNA *brna)
 	PropertyRNA *prop;
 	FunctionRNA *func;
 	
-	srna= RNA_def_struct(brna, "RenderEngine", NULL);
+	srna = RNA_def_struct(brna, "RenderEngine", NULL);
 	RNA_def_struct_sdna(srna, "RenderEngine");
 	RNA_def_struct_ui_text(srna, "Render Engine", "Render engine");
 	RNA_def_struct_refine_func(srna, "rna_RenderEngine_refine");
-	RNA_def_struct_register_funcs(srna, "rna_RenderEngine_register", "rna_RenderEngine_unregister", "rna_RenderEngine_instance");
+	RNA_def_struct_register_funcs(srna, "rna_RenderEngine_register", "rna_RenderEngine_unregister",
+	                              "rna_RenderEngine_instance");
 
 	/* final render callbacks */
-	func= RNA_def_function(srna, "update", NULL);
+	func = RNA_def_function(srna, "update", NULL);
 	RNA_def_function_ui_description(func, "Export scene data for render");
 	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
 	RNA_def_pointer(func, "data", "BlendData", "", "");
 	RNA_def_pointer(func, "scene", "Scene", "", "");
 
-	func= RNA_def_function(srna, "render", NULL);
+	func = RNA_def_function(srna, "render", NULL);
 	RNA_def_function_ui_description(func, "Render scene into an image");
 	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
 	RNA_def_pointer(func, "scene", "Scene", "", "");
 
 	/* viewport render callbacks */
-	func= RNA_def_function(srna, "view_update", NULL);
+	func = RNA_def_function(srna, "view_update", NULL);
 	RNA_def_function_ui_description(func, "Update on data changes for viewport render");
 	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
 	RNA_def_pointer(func, "context", "Context", "", "");
 
-	func= RNA_def_function(srna, "view_draw", NULL);
+	func = RNA_def_function(srna, "view_draw", NULL);
 	RNA_def_function_ui_description(func, "Draw viewport render");
 	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
 	RNA_def_pointer(func, "context", "Context", "", "");
@@ -306,73 +308,77 @@ static void rna_def_render_engine(BlenderRNA *brna)
 	RNA_def_function(srna, "tag_update", "engine_tag_update");
 	RNA_def_function_ui_description(func, "Request update call for viewport rendering");
 
-	func= RNA_def_function(srna, "begin_result", "RE_engine_begin_result");
-	prop= RNA_def_int(func, "x", 0, 0, INT_MAX, "X", "", 0, INT_MAX);
+	func = RNA_def_function(srna, "begin_result", "RE_engine_begin_result");
+	prop = RNA_def_int(func, "x", 0, 0, INT_MAX, "X", "", 0, INT_MAX);
 	RNA_def_property_flag(prop, PROP_REQUIRED);
-	prop= RNA_def_int(func, "y", 0, 0, INT_MAX, "Y", "", 0, INT_MAX);
+	prop = RNA_def_int(func, "y", 0, 0, INT_MAX, "Y", "", 0, INT_MAX);
 	RNA_def_property_flag(prop, PROP_REQUIRED);
-	prop= RNA_def_int(func, "w", 0, 0, INT_MAX, "Width", "", 0, INT_MAX);
+	prop = RNA_def_int(func, "w", 0, 0, INT_MAX, "Width", "", 0, INT_MAX);
 	RNA_def_property_flag(prop, PROP_REQUIRED);
-	prop= RNA_def_int(func, "h", 0, 0, INT_MAX, "Height", "", 0, INT_MAX);
+	prop = RNA_def_int(func, "h", 0, 0, INT_MAX, "Height", "", 0, INT_MAX);
 	RNA_def_property_flag(prop, PROP_REQUIRED);
-	prop= RNA_def_pointer(func, "result", "RenderResult", "Result", "");
+	prop = RNA_def_pointer(func, "result", "RenderResult", "Result", "");
 	RNA_def_function_return(func, prop);
 
-	func= RNA_def_function(srna, "update_result", "RE_engine_update_result");
-	prop= RNA_def_pointer(func, "result", "RenderResult", "Result", "");
+	func = RNA_def_function(srna, "update_result", "RE_engine_update_result");
+	prop = RNA_def_pointer(func, "result", "RenderResult", "Result", "");
 	RNA_def_property_flag(prop, PROP_REQUIRED);
 
-	func= RNA_def_function(srna, "end_result", "RE_engine_end_result");
-	prop= RNA_def_pointer(func, "result", "RenderResult", "Result", "");
+	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);
 
-	func= RNA_def_function(srna, "test_break", "RE_engine_test_break");
-	prop= RNA_def_boolean(func, "do_break", 0, "Break", "");
+	func = RNA_def_function(srna, "test_break", "RE_engine_test_break");
+	prop = RNA_def_boolean(func, "do_break", 0, "Break", "");
 	RNA_def_function_return(func, prop);
 
-	func= RNA_def_function(srna, "update_stats", "RE_engine_update_stats");
-	prop= RNA_def_string(func, "stats", "", 0, "Stats", "");
+	func = RNA_def_function(srna, "update_stats", "RE_engine_update_stats");
+	prop = RNA_def_string(func, "stats", "", 0, "Stats", "");
 	RNA_def_property_flag(prop, PROP_REQUIRED);
-	prop= RNA_def_string(func, "info", "", 0, "Info", "");
+	prop = RNA_def_string(func, "info", "", 0, "Info", "");
 	RNA_def_property_flag(prop, PROP_REQUIRED);
 
-	func= RNA_def_function(srna, "update_progress", "RE_engine_update_progress");
-	prop= RNA_def_float(func, "progress", 0, 0.0f, 1.0f, "", "Percentage of render that's done", 0.0f, 1.0f);
+	func = RNA_def_function(srna, "update_progress", "RE_engine_update_progress");
+	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, "report", "RE_engine_report");
-	prop= RNA_def_enum_flag(func, "type", wm_report_items, 0, "Type", "");
+	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);
-	prop= RNA_def_string(func, "message", "", 0, "Report Message", "");
+	prop = RNA_def_string(func, "message", "", 0, "Report Message", "");
 	RNA_def_property_flag(prop, PROP_REQUIRED);
 
 	RNA_define_verify_sdna(0);
 
-	prop= RNA_def_property(srna, "is_animation", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_animation", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", RE_ENGINE_ANIMATION);
 
-	prop= RNA_def_property(srna, "is_preview", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_preview", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", RE_ENGINE_PREVIEW);
 
+	prop = RNA_def_property(srna, "camera_override", PROP_POINTER, PROP_NONE);
+	RNA_def_property_pointer_sdna(prop, NULL, "camera_override");
+	RNA_def_property_struct_type(prop, "Object");
+
 	/* registration */
 
-	prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "type->idname");
 	RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP);
 
-	prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE);
+	prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE);
 	RNA_def_property_string_sdna(prop, NULL, "type->name");
 	RNA_def_property_flag(prop, PROP_REGISTER);
 
-	prop= RNA_def_property(srna, "bl_use_preview", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "bl_use_preview", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_PREVIEW);
 	RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
 
-	prop= RNA_def_property(srna, "bl_use_postprocess", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "bl_use_postprocess", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "type->flag", RE_USE_POSTPROCESS);
 	RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
 
-	prop= RNA_def_property(srna, "bl_use_shading_nodes", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "bl_use_shading_nodes", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_SHADING_NODES);
 	RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
 
@@ -385,29 +391,32 @@ static void rna_def_render_result(BlenderRNA *brna)
 	FunctionRNA *func;
 	PropertyRNA *parm;
 	
-	srna= RNA_def_struct(brna, "RenderResult", NULL);
+	srna = RNA_def_struct(brna, "RenderResult", NULL);
 	RNA_def_struct_ui_text(srna, "Render Result", "Result of rendering, including all layers and passes");
 
-	func= RNA_def_function(srna, "load_from_file", "RE_result_load_from_file");
+	func = RNA_def_function(srna, "load_from_file", "RE_result_load_from_file");
 	RNA_def_function_ui_description(func, "Copies the pixels of this render result from an image file");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
-	parm= RNA_def_string_file_name(func, "filename", "", FILE_MAX, "File Name",
-	                               "Filename to load into this render tile, must be no smaller than the render result");
+	parm = RNA_def_string_file_name(func, "filename", "", FILE_MAX, "File Name",
+	                               "Filename to load into this render tile, must be no smaller than "
+	                               "the render result");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
 	RNA_define_verify_sdna(0);
 
-	parm= RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE);
+	parm = RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(parm, NULL, "rectx");
 	RNA_def_property_clear_flag(parm, PROP_EDITABLE);
 
-	parm= RNA_def_property(srna, "resolution_y", PROP_INT, PROP_NONE);
+	parm = RNA_def_property(srna, "resolution_y", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(parm, NULL, "recty");
 	RNA_def_property_clear_flag(parm, PROP_EDITABLE);
 
-	parm= RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
+	parm = RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(parm, "RenderLayer");
-	RNA_def_property_collection_funcs(parm, "rna_RenderResult_layers_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL);
+	RNA_def_property_collection_funcs(parm, "rna_RenderResult_layers_begin", "rna_iterator_listbase_next",
+	                                  "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+	                                  NULL, NULL, NULL, NULL);
 
 	RNA_define_verify_sdna(1);
 }
@@ -418,13 +427,13 @@ static void rna_def_render_layer(BlenderRNA *brna)
 	PropertyRNA *prop;
 	FunctionRNA *func;
 	
-	srna= RNA_def_struct(brna, "RenderLayer", NULL);
+	srna = RNA_def_struct(brna, "RenderLayer", NULL);
 	RNA_def_struct_ui_text(srna, "Render Layer", "");
 
-	func= RNA_def_function(srna, "load_from_file", "RE_layer_load_from_file");
+	func = RNA_def_function(srna, "load_from_file", "RE_layer_load_from_file");
 	RNA_def_function_ui_description(func, "Copies the pixels of this renderlayer from an image file");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
-	prop= RNA_def_string(func, "filename", "", 0, "Filename",
+	prop = RNA_def_string(func, "filename", "", 0, "Filename",
 	                     "Filename to load into this render tile, must be no smaller than the renderlayer");
 	RNA_def_property_flag(prop, PROP_REQUIRED);
 	RNA_def_int(func, "x", 0, 0, INT_MAX, "Offset X",
@@ -436,11 +445,13 @@ static void rna_def_render_layer(BlenderRNA *brna)
 
 	rna_def_render_layer_common(srna, 0);
 
-	prop= RNA_def_property(srna, "passes", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "passes", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "RenderPass");
-	RNA_def_property_collection_funcs(prop, "rna_RenderLayer_passes_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL);
+	RNA_def_property_collection_funcs(prop, "rna_RenderLayer_passes_begin", "rna_iterator_listbase_next",
+	                                  "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+	                                  NULL, NULL, NULL, NULL);
 
-	prop= RNA_def_property(srna, "rect", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "rect", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_DYNAMIC);
 	RNA_def_property_multi_array(prop, 2, NULL);
 	RNA_def_property_dynamic_array_funcs(prop, "rna_RenderLayer_rect_get_length");
@@ -454,7 +465,7 @@ static void rna_def_render_pass(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static EnumPropertyItem pass_type_items[]= {
+	static EnumPropertyItem pass_type_items[] = {
 		{SCE_PASS_COMBINED, "COMBINED", 0, "Combined", ""},
 		{SCE_PASS_Z, "Z", 0, "Z", ""},
 		{SCE_PASS_RGBA, "COLOR", 0, "Color", ""},
@@ -483,30 +494,30 @@ static void rna_def_render_pass(BlenderRNA *brna)
 		{SCE_PASS_TRANSM_COLOR, "TRANSMISSION_COLOR", 0, "Transmission Color", ""},
 		{0, NULL, 0, NULL, NULL}};
 	
-	srna= RNA_def_struct(brna, "RenderPass", NULL);
+	srna = RNA_def_struct(brna, "RenderPass", NULL);
 	RNA_def_struct_ui_text(srna, "Render Pass", "");
 
 	RNA_define_verify_sdna(0);
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "name");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_struct_name_property(srna, prop);
 
-	prop= RNA_def_property(srna, "channel_id", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "channel_id", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "chan_id");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "channels", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "channels", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "channels");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "passtype");
 	RNA_def_property_enum_items(prop, pass_type_items);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "rect", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "rect", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_DYNAMIC);
 	RNA_def_property_multi_array(prop, 2, NULL);
 	RNA_def_property_dynamic_array_funcs(prop, "rna_RenderPass_rect_get_length");
@@ -523,5 +534,4 @@ void RNA_def_render(BlenderRNA *brna)
 	rna_def_render_pass(brna);
 }
 
-#endif // RNA_RUNTIME
-
+#endif /* RNA_RUNTIME */
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 676d5f2..e9f35de 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -129,6 +129,16 @@ static int rna_Struct_name_length(PointerRNA *ptr)
 	return strlen(((StructRNA*)ptr->data)->name);
 }
 
+static void rna_Struct_translation_context_get(PointerRNA *ptr, char *value)
+{
+	strcpy(value, ((StructRNA*)ptr->data)->translation_context ? ((StructRNA*)ptr->data)->translation_context : "");
+}
+
+static int rna_Struct_translation_context_length(PointerRNA *ptr)
+{
+	return ((StructRNA*)ptr->data)->translation_context ? strlen(((StructRNA*)ptr->data)->translation_context) : 0;
+}
+
 static PointerRNA rna_Struct_base_get(PointerRNA *ptr)
 {
 	return rna_pointer_inherit_refine(ptr, &RNA_Struct, ((StructRNA*)ptr->data)->base);
@@ -150,24 +160,24 @@ static PointerRNA rna_Struct_name_property_get(PointerRNA *ptr)
 
 static int rna_idproperty_known(CollectionPropertyIterator *iter, void *data)
 {
-	IDProperty *idprop= (IDProperty*)data;
+	IDProperty *idprop = (IDProperty*)data;
 	PropertyRNA *prop;
-	StructRNA *ptype= iter->builtin_parent.type;
+	StructRNA *ptype = iter->builtin_parent.type;
 
 	/* function to skip any id properties that are already known by RNA,
 	 * for the second loop where we go over unknown id properties */
 	do {
-		for(prop= ptype->cont.properties.first; prop; prop=prop->next)
-			if((prop->flag & PROP_BUILTIN) == 0 && strcmp(prop->identifier, idprop->name) == 0)
+		for (prop = ptype->cont.properties.first; prop; prop = prop->next)
+			if ((prop->flag & PROP_BUILTIN) == 0 && strcmp(prop->identifier, idprop->name) == 0)
 				return 1;
-	} while((ptype=ptype->base));
+	} while ((ptype = ptype->base));
 
 	return 0;
 }
 
 static int rna_property_builtin(CollectionPropertyIterator *UNUSED(iter), void *data)
 {
-	PropertyRNA *prop= (PropertyRNA*)data;
+	PropertyRNA *prop = (PropertyRNA*)data;
 
 	/* function to skip builtin rna properties */
 
@@ -176,7 +186,7 @@ static int rna_property_builtin(CollectionPropertyIterator *UNUSED(iter), void *
 
 static int rna_function_builtin(CollectionPropertyIterator *UNUSED(iter), void *data)
 {
-	FunctionRNA *func= (FunctionRNA*)data;
+	FunctionRNA *func = (FunctionRNA*)data;
 
 	/* function to skip builtin rna functions */
 
@@ -186,14 +196,14 @@ static int rna_function_builtin(CollectionPropertyIterator *UNUSED(iter), void *
 static void rna_inheritance_next_level_restart(CollectionPropertyIterator *iter, IteratorSkipFunc skip, int funcs)
 {
 	/* RNA struct inheritance */
-	while(!iter->valid && iter->level > 0) {
+	while (!iter->valid && iter->level > 0) {
 		StructRNA *srna;
 		int i;
 
-		srna= (StructRNA*)iter->parent.data;
+		srna = (StructRNA*)iter->parent.data;
 		iter->level--;
-		for(i=iter->level; i>0; i--)
-			srna= srna->base;
+		for (i = iter->level; i>0; i--)
+			srna = srna->base;
 
 		rna_iterator_listbase_end(iter);
 
@@ -204,7 +214,8 @@ static void rna_inheritance_next_level_restart(CollectionPropertyIterator *iter,
 	}
 }
 
-static void rna_inheritance_properties_listbase_begin(CollectionPropertyIterator *iter, ListBase *lb, IteratorSkipFunc skip)
+static void rna_inheritance_properties_listbase_begin(CollectionPropertyIterator *iter, ListBase *lb,
+                                                      IteratorSkipFunc skip)
 {
 	rna_iterator_listbase_begin(iter, lb, skip);
 	rna_inheritance_next_level_restart(iter, skip, 0);
@@ -216,7 +227,8 @@ static void rna_inheritance_properties_listbase_next(CollectionPropertyIterator
 	rna_inheritance_next_level_restart(iter, skip, 0);
 }
 
-static void rna_inheritance_functions_listbase_begin(CollectionPropertyIterator *iter, ListBase *lb, IteratorSkipFunc skip)
+static void rna_inheritance_functions_listbase_begin(CollectionPropertyIterator *iter, ListBase *lb,
+                                                     IteratorSkipFunc skip)
 {
 	rna_iterator_listbase_begin(iter, lb, skip);
 	rna_inheritance_next_level_restart(iter, skip, 1);
@@ -230,10 +242,10 @@ static void rna_inheritance_functions_listbase_next(CollectionPropertyIterator *
 
 static void rna_Struct_properties_next(CollectionPropertyIterator *iter)
 {
-	ListBaseIterator *internal= iter->internal;
+	ListBaseIterator *internal = iter->internal;
 	IDProperty *group;
 
-	if(internal->flag) {
+	if (internal->flag) {
 		/* id properties */
 		rna_iterator_listbase_next(iter);
 	}
@@ -242,14 +254,14 @@ static void rna_Struct_properties_next(CollectionPropertyIterator *iter)
 		rna_inheritance_properties_listbase_next(iter, rna_property_builtin);
 
 		/* try id properties */
-		if(!iter->valid) {
-			group= RNA_struct_idprops(&iter->builtin_parent, 0);
+		if (!iter->valid) {
+			group = RNA_struct_idprops(&iter->builtin_parent, 0);
 
-			if(group) {
+			if (group) {
 				rna_iterator_listbase_end(iter);
 				rna_iterator_listbase_begin(iter, &group->data.group, rna_idproperty_known);
-				internal= iter->internal;
-				internal->flag= 1;
+				internal = iter->internal;
+				internal->flag = 1;
 			}
 		}
 	}
@@ -260,11 +272,11 @@ static void rna_Struct_properties_begin(CollectionPropertyIterator *iter, Pointe
 	StructRNA *srna;
 
 	/* here ptr->data should always be the same as iter->parent.type */
-	srna= (StructRNA *)ptr->data;
+	srna = (StructRNA *)ptr->data;
 
-	while(srna->base) {
+	while (srna->base) {
 		iter->level++;
-		srna= srna->base;
+		srna = srna->base;
 	}
 
 	rna_inheritance_properties_listbase_begin(iter, &srna->cont.properties, rna_property_builtin);
@@ -272,7 +284,7 @@ static void rna_Struct_properties_begin(CollectionPropertyIterator *iter, Pointe
 
 static PointerRNA rna_Struct_properties_get(CollectionPropertyIterator *iter)
 {
-	ListBaseIterator *internal= iter->internal;
+	ListBaseIterator *internal = iter->internal;
 
 	/* we return either PropertyRNA* or IDProperty*, the rna_access.c
 	 * functions can handle both as PropertyRNA* with some tricks */
@@ -289,11 +301,11 @@ static void rna_Struct_functions_begin(CollectionPropertyIterator *iter, Pointer
 	StructRNA *srna;
 
 	/* here ptr->data should always be the same as iter->parent.type */
-	srna= (StructRNA *)ptr->data;
+	srna = (StructRNA *)ptr->data;
 
-	while(srna->base) {
+	while (srna->base) {
 		iter->level++;
-		srna= srna->base;
+		srna = srna->base;
 	}
 
 	rna_inheritance_functions_listbase_begin(iter, &srna->functions, rna_function_builtin);
@@ -301,7 +313,7 @@ static void rna_Struct_functions_begin(CollectionPropertyIterator *iter, Pointer
 
 static PointerRNA rna_Struct_functions_get(CollectionPropertyIterator *iter)
 {
-	ListBaseIterator *internal= iter->internal;
+	ListBaseIterator *internal = iter->internal;
 
 	/* we return either PropertyRNA* or IDProperty*, the rna_access.c
 	 * functions can handle both as PropertyRNA* with some tricks */
@@ -317,15 +329,15 @@ void rna_builtin_properties_begin(CollectionPropertyIterator *iter, PointerRNA *
 	PointerRNA newptr;
 
 	/* we create a new pointer with the type as the data */
-	newptr.type= &RNA_Struct;
-	newptr.data= ptr->type;
+	newptr.type = &RNA_Struct;
+	newptr.data = ptr->type;
 
-	if(ptr->type->flag & STRUCT_ID)
-		newptr.id.data= ptr->data;
+	if (ptr->type->flag & STRUCT_ID)
+		newptr.id.data = ptr->data;
 	else
-		newptr.id.data= NULL;
+		newptr.id.data = NULL;
 
-	iter->parent= newptr;
+	iter->parent = newptr;
 	iter->builtin_parent = *ptr;
 
 	rna_Struct_properties_begin(iter, &newptr);
@@ -345,51 +357,51 @@ int rna_builtin_properties_lookup_string(PointerRNA *ptr, const char *key, Point
 {
 	StructRNA *srna;
 	PropertyRNA *prop;
-	PointerRNA propptr= {{NULL}};
+	PointerRNA propptr = {{NULL}};
 
-	srna= ptr->type;
+	srna = ptr->type;
 
 	do {
-		if(srna->cont.prophash) {
-			prop= BLI_ghash_lookup(srna->cont.prophash, (void*)key);
+		if (srna->cont.prophash) {
+			prop = BLI_ghash_lookup(srna->cont.prophash, (void*)key);
 
-			if(prop) {
-				propptr.type= &RNA_Property;
-				propptr.data= prop;
+			if (prop) {
+				propptr.type = &RNA_Property;
+				propptr.data = prop;
 
-				*r_ptr= propptr;
+				*r_ptr = propptr;
 				return TRUE;
 			}
 		}
 		else {
-			for(prop=srna->cont.properties.first; prop; prop=prop->next) {
-				if(!(prop->flag & PROP_BUILTIN) && strcmp(prop->identifier, key)==0) {
-					propptr.type= &RNA_Property;
-					propptr.data= prop;
+			for (prop = srna->cont.properties.first; prop; prop = prop->next) {
+				if (!(prop->flag & PROP_BUILTIN) && strcmp(prop->identifier, key) == 0) {
+					propptr.type = &RNA_Property;
+					propptr.data = prop;
 
-					*r_ptr= propptr;
+					*r_ptr = propptr;
 					return TRUE;
 				}
 			}
 		}
-	} while((srna=srna->base));
+	} while ((srna = srna->base));
 
 	/* this was used pre 2.5beta0, now ID property access uses python's
 	 * getitem style access
 	 * - ob["foo"] rather than ob.foo */
 #if 0
-	if(ptr->data) {
+	if (ptr->data) {
 		IDProperty *group, *idp;
 
-		group= RNA_struct_idprops(ptr, 0);
+		group = RNA_struct_idprops(ptr, 0);
 
-		if(group) {
-			for(idp=group->data.group.first; idp; idp=idp->next) {
-				if(strcmp(idp->name, key) == 0) {
-					propptr.type= &RNA_Property;
-					propptr.data= idp;
+		if (group) {
+			for (idp = group->data.group.first; idp; idp = idp->next) {
+				if (strcmp(idp->name, key) == 0) {
+					propptr.type = &RNA_Property;
+					propptr.data = idp;
 
-					*r_ptr= propptr;
+					*r_ptr = propptr;
 					return TRUE;
 				}
 			}
@@ -408,11 +420,11 @@ PointerRNA rna_builtin_type_get(PointerRNA *ptr)
 
 static StructRNA *rna_Property_refine(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 
 	rna_idproperty_check(&prop, ptr); /* XXX ptr? */
 
-	switch(prop->type) {
+	switch (prop->type) {
 		case PROP_BOOLEAN: return &RNA_BoolProperty;
 		case PROP_INT: return &RNA_IntProperty;
 		case PROP_FLOAT: return &RNA_FloatProperty;
@@ -426,354 +438,355 @@ static StructRNA *rna_Property_refine(PointerRNA *ptr)
 
 static void rna_Property_identifier_get(PointerRNA *ptr, char *value)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	strcpy(value, ((PropertyRNA*)prop)->identifier);
 }
 
 static int rna_Property_identifier_length(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return strlen(prop->identifier);
 }
 
 static void rna_Property_name_get(PointerRNA *ptr, char *value)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	strcpy(value, prop->name);
 }
 
 static int rna_Property_name_length(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return strlen(prop->name);
 }
 
 static void rna_Property_description_get(PointerRNA *ptr, char *value)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	strcpy(value, prop->description ? prop->description:"");
 }
 static int rna_Property_description_length(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return prop->description ? strlen(prop->description) : 0;
 }
 
 static void rna_Property_translation_context_get(PointerRNA *ptr, char *value)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	strcpy(value, prop->translation_context ? prop->translation_context:"");
 }
 
 static int rna_Property_translation_context_length(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return prop->translation_context ? strlen(prop->translation_context) : 0;
 }
 
 static int rna_Property_type_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return prop->type;
 }
 
 static int rna_Property_subtype_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return prop->subtype;
 }
 
 static PointerRNA rna_Property_srna_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return rna_pointer_inherit_refine(ptr, &RNA_Struct, prop->srna);
 }
 
 static int rna_Property_unit_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return RNA_SUBTYPE_UNIT(prop->subtype);
 }
 
 static int rna_Property_readonly_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 
-	/* dont use this becaure it will call functions that check the internal
+	/* don't use this becaure it will call functions that check the internal
 	 * data for introspection we only need to know if it can be edited so the
 	 * flag is better for this */
-//	return RNA_property_editable(ptr, prop);
+/*	return RNA_property_editable(ptr, prop); */
 	return prop->flag & PROP_EDITABLE ? 0:1;
 }
 
 static int rna_Property_animatable_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 
 	return (prop->flag & PROP_ANIMATABLE) != 0;
 }
 
 static int rna_Property_use_output_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	return prop->flag & PROP_OUTPUT ? 1:0;
 }
 
 static int rna_Property_is_required_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	return prop->flag & PROP_REQUIRED ? 1:0;
 }
 
 static int rna_Property_is_never_none_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	return prop->flag & PROP_NEVER_NULL ? 1:0;
 }
 
 static int rna_Property_is_hidden_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	return prop->flag & PROP_HIDDEN ? 1:0;
 }
 
 static int rna_Property_is_skip_save_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	return prop->flag & PROP_SKIP_SAVE ? 1:0;
 }
 
 
 static int rna_Property_is_enum_flag_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	return prop->flag & PROP_ENUM_FLAG ? 1:0;
 }
 
 static int rna_Property_array_length_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return prop->totarraylength;
 }
 
 static int rna_Property_registered_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	return prop->flag & PROP_REGISTER;
 }
 
 static int rna_Property_registered_optional_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	return prop->flag & PROP_REGISTER_OPTIONAL;
 }
 
 static int rna_Property_runtime_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	return prop->flag & PROP_RUNTIME;
 }
 
 
 static int rna_BoolProperty_default_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return ((BoolPropertyRNA*)prop)->defaultvalue;
 }
 
 static int rna_IntProperty_default_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return ((IntPropertyRNA*)prop)->defaultvalue;
 }
 /* int/float/bool */
 static int rna_NumberProperty_default_array_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 
-	length[0]= prop->totarraylength;
+	length[0] = prop->totarraylength;
 
 	return length[0];
 }
 static void rna_IntProperty_default_array_get(PointerRNA *ptr, int *values)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
-	IntPropertyRNA *nprop= (IntPropertyRNA*)prop;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
+	IntPropertyRNA *nprop = (IntPropertyRNA*)prop;
 	rna_idproperty_check(&prop, ptr);
 
-	if(nprop->defaultarray) {
+	if (nprop->defaultarray) {
 		memcpy(values, nprop->defaultarray, prop->totarraylength * sizeof(int));
 	}
 	else {
 		int i;
-		for(i=0; i < prop->totarraylength; i++)
-			values[i]= nprop->defaultvalue;
+		for (i = 0; i < prop->totarraylength; i++)
+			values[i] = nprop->defaultvalue;
 	}
 }
 static void rna_BoolProperty_default_array_get(PointerRNA *ptr, int *values)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
-	BoolPropertyRNA *nprop= (BoolPropertyRNA*)prop;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
+	BoolPropertyRNA *nprop = (BoolPropertyRNA*)prop;
 	rna_idproperty_check(&prop, ptr);
 
-	if(nprop->defaultarray) {
+	if (nprop->defaultarray) {
 		memcpy(values, nprop->defaultarray, prop->totarraylength * sizeof(int));
 	}
 	else {
 		int i;
-		for(i=0; i < prop->totarraylength; i++)
-			values[i]= nprop->defaultvalue;
+		for (i = 0; i < prop->totarraylength; i++)
+			values[i] = nprop->defaultvalue;
 	}
 }
 static void rna_FloatProperty_default_array_get(PointerRNA *ptr, float *values)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
-	FloatPropertyRNA *nprop= (FloatPropertyRNA*)prop;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
+	FloatPropertyRNA *nprop = (FloatPropertyRNA*)prop;
 	rna_idproperty_check(&prop, ptr);
 
-	if(nprop->defaultarray) {
+	if (nprop->defaultarray) {
 		memcpy(values, nprop->defaultarray, prop->totarraylength * sizeof(float));
 	}
 	else {
 		int i;
-		for(i=0; i < prop->totarraylength; i++)
-			values[i]= nprop->defaultvalue;
+		for (i = 0; i < prop->totarraylength; i++)
+			values[i] = nprop->defaultvalue;
 	}
 }
 
 static int rna_IntProperty_hard_min_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return ((IntPropertyRNA*)prop)->hardmin;
 }
 
 static int rna_IntProperty_hard_max_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return ((IntPropertyRNA*)prop)->hardmax;
 }
 
 static int rna_IntProperty_soft_min_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return ((IntPropertyRNA*)prop)->softmin;
 }
 
 static int rna_IntProperty_soft_max_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return ((IntPropertyRNA*)prop)->softmax;
 }
 
 static int rna_IntProperty_step_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return ((IntPropertyRNA*)prop)->step;
 }
 
 static float rna_FloatProperty_default_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return ((FloatPropertyRNA*)prop)->defaultvalue;
 }
 static float rna_FloatProperty_hard_min_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return ((FloatPropertyRNA*)prop)->hardmin;
 }
 
 static float rna_FloatProperty_hard_max_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return ((FloatPropertyRNA*)prop)->hardmax;
 }
 
 static float rna_FloatProperty_soft_min_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return ((FloatPropertyRNA*)prop)->softmin;
 }
 
 static float rna_FloatProperty_soft_max_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return ((FloatPropertyRNA*)prop)->softmax;
 }
 
 static float rna_FloatProperty_step_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return ((FloatPropertyRNA*)prop)->step;
 }
 
 static int rna_FloatProperty_precision_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return ((FloatPropertyRNA*)prop)->precision;
 }
 
 static void rna_StringProperty_default_get(PointerRNA *ptr, char *value)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	strcpy(value, ((StringPropertyRNA*)prop)->defaultvalue);
 }
 static int rna_StringProperty_default_length(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return strlen(((StringPropertyRNA*)prop)->defaultvalue);
 }
 
 static int rna_StringProperty_max_length_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return ((StringPropertyRNA*)prop)->maxlength;
 }
 
-static EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop_parent, int *free)
+static EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA *ptr,
+                                                        PropertyRNA *prop_parent, int *free)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	EnumPropertyRNA *eprop;
 
 	rna_idproperty_check(&prop, ptr);
-	eprop= (EnumPropertyRNA*)prop;
+	eprop = (EnumPropertyRNA*)prop;
 
 	/* incompatible default attributes */
 	if ((prop_parent->flag & PROP_ENUM_FLAG) != (prop->flag & PROP_ENUM_FLAG)) {
 		return NULL;
 	}
 
-	if(		(eprop->itemf == NULL) ||
+	if (		(eprop->itemf == NULL) ||
 			(eprop->itemf == rna_EnumProperty_default_itemf) ||
 			(ptr->type == &RNA_EnumProperty) ||
 			(C == NULL))
@@ -787,27 +800,27 @@ static EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C, PointerRNA
 /* XXX - not sure this is needed? */
 static int rna_EnumProperty_default_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return ((EnumPropertyRNA*)prop)->defaultvalue;
 }
 
 static int rna_enum_check_separator(CollectionPropertyIterator *UNUSED(iter), void *data)
 {
-	EnumPropertyItem *item= (EnumPropertyItem*)data;
+	EnumPropertyItem *item = (EnumPropertyItem*)data;
 
 	return (item->identifier[0] == 0);
 }
 
 static void rna_EnumProperty_items_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
-	// EnumPropertyRNA *eprop; // UNUSED
-	EnumPropertyItem *item= NULL;
-	int totitem, free= 0;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
+	/* EnumPropertyRNA *eprop;  *//* UNUSED */
+	EnumPropertyItem *item = NULL;
+	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);
@@ -835,19 +848,19 @@ static int rna_EnumPropertyItem_name_length(PointerRNA *ptr)
 
 static void rna_EnumPropertyItem_description_get(PointerRNA *ptr, char *value)
 {
-	EnumPropertyItem *eprop= (EnumPropertyItem*)ptr->data;
+	EnumPropertyItem *eprop = (EnumPropertyItem*)ptr->data;
 
-	if(eprop->description)
+	if (eprop->description)
 		strcpy(value, eprop->description);
 	else
-		value[0]= '\0';
+		value[0] = '\0';
 }
 
 static int rna_EnumPropertyItem_description_length(PointerRNA *ptr)
 {
-	EnumPropertyItem *eprop= (EnumPropertyItem*)ptr->data;
+	EnumPropertyItem *eprop = (EnumPropertyItem*)ptr->data;
 
-	if(eprop->description)
+	if (eprop->description)
 		return strlen(eprop->description);
 	else
 		return 0;
@@ -860,14 +873,14 @@ static int rna_EnumPropertyItem_value_get(PointerRNA *ptr)
 
 static PointerRNA rna_PointerProperty_fixed_type_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return rna_pointer_inherit_refine(ptr, &RNA_Struct, ((PointerPropertyRNA*)prop)->type);
 }
 
 static PointerRNA rna_CollectionProperty_fixed_type_get(PointerRNA *ptr)
 {
-	PropertyRNA *prop= (PropertyRNA*)ptr->data;
+	PropertyRNA *prop = (PropertyRNA*)ptr->data;
 	rna_idproperty_check(&prop, ptr);
 	return rna_pointer_inherit_refine(ptr, &RNA_Struct, ((CollectionPropertyRNA*)prop)->item_type);
 }
@@ -901,19 +914,19 @@ static void rna_Function_parameters_begin(CollectionPropertyIterator *iter, Poin
 
 static int rna_Function_registered_get(PointerRNA *ptr)
 {
-	FunctionRNA *func= (FunctionRNA*)ptr->data;
+	FunctionRNA *func = (FunctionRNA*)ptr->data;
 	return func->flag & FUNC_REGISTER;
 }
 
 static int rna_Function_registered_optional_get(PointerRNA *ptr)
 {
-	FunctionRNA *func= (FunctionRNA*)ptr->data;
+	FunctionRNA *func = (FunctionRNA*)ptr->data;
 	return func->flag & FUNC_REGISTER_OPTIONAL;
 }
 
 static int rna_Function_no_self_get(PointerRNA *ptr)
 {
-	FunctionRNA *func= (FunctionRNA*)ptr->data;
+	FunctionRNA *func = (FunctionRNA*)ptr->data;
 	return !(func->flag & FUNC_NO_SELF);
 }
 
@@ -931,9 +944,9 @@ static int rna_BlenderRNA_structs_length(PointerRNA *ptr)
 }
 static int rna_BlenderRNA_structs_lookup_int(PointerRNA *ptr, int index, PointerRNA *r_ptr)
 {
-	StructRNA *srna= BLI_findlink(&((BlenderRNA*)ptr->data)->structs, index);
+	StructRNA *srna = BLI_findlink(&((BlenderRNA*)ptr->data)->structs, index);
 
-	if(srna) {
+	if (srna) {
 		RNA_pointer_create(NULL, &RNA_Struct, srna, r_ptr);
 		return TRUE;
 	}
@@ -943,9 +956,9 @@ static int rna_BlenderRNA_structs_lookup_int(PointerRNA *ptr, int index, Pointer
 }
 static int rna_BlenderRNA_structs_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
 {
-	StructRNA *srna= ((BlenderRNA*)ptr->data)->structs.first;
-	for(; srna; srna=srna->cont.next) {
-		if(key[0] == srna->identifier[0] && strcmp(key, srna->identifier)==0) {
+	StructRNA *srna = ((BlenderRNA*)ptr->data)->structs.first;
+	for (; srna; srna = srna->cont.next) {
+		if (key[0] == srna->identifier[0] && strcmp(key, srna->identifier) == 0) {
 			RNA_pointer_create(NULL, &RNA_Struct, srna, r_ptr);
 			return TRUE;
 		}
@@ -962,54 +975,65 @@ static void rna_def_struct(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "Struct", NULL);
+	srna = RNA_def_struct(brna, "Struct", NULL);
 	RNA_def_struct_ui_text(srna, "Struct Definition", "RNA structure definition");
 	RNA_def_struct_ui_icon(srna, ICON_RNA);
 
-	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_funcs(prop, "rna_Struct_name_get", "rna_Struct_name_length", NULL);
 	RNA_def_property_ui_text(prop, "Name", "Human readable name");
 
-	prop= RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_string_funcs(prop, "rna_Struct_identifier_get", "rna_Struct_identifier_length", NULL);
 	RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting");
 	RNA_def_struct_name_property(srna, prop);
 	
-	prop= RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_string_funcs(prop, "rna_Struct_description_get", "rna_Struct_description_length", NULL);
 	RNA_def_property_ui_text(prop, "Description", "Description of the Struct's purpose");
 	
-	prop= RNA_def_property(srna, "base", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "translation_context", PROP_STRING, PROP_NONE);
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+	RNA_def_property_string_funcs(prop, "rna_Struct_translation_context_get",
+	                              "rna_Struct_translation_context_length", NULL);
+	RNA_def_property_ui_text(prop, "Translation Context", "Translation context of the struct's name");
+	
+	prop = RNA_def_property(srna, "base", PROP_POINTER, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "Struct");
 	RNA_def_property_pointer_funcs(prop, "rna_Struct_base_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Base", "Struct definition this is derived from");
 
-	prop= RNA_def_property(srna, "nested", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "nested", PROP_POINTER, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "Struct");
 	RNA_def_property_pointer_funcs(prop, "rna_Struct_nested_get", NULL, NULL, NULL);
-	RNA_def_property_ui_text(prop, "Nested", "Struct in which this struct is always nested, and to which it logically belongs");
+	RNA_def_property_ui_text(prop, "Nested",
+	                         "Struct in which this struct is always nested, and to which it logically belongs");
 
-	prop= RNA_def_property(srna, "name_property", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "name_property", PROP_POINTER, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "StringProperty");
 	RNA_def_property_pointer_funcs(prop, "rna_Struct_name_property_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Name Property", "Property that gives the name of the struct");
 
-	prop= RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "Property");
-	RNA_def_property_collection_funcs(prop, "rna_Struct_properties_begin", "rna_Struct_properties_next", "rna_iterator_listbase_end", "rna_Struct_properties_get", NULL, NULL, NULL, NULL);
+	RNA_def_property_collection_funcs(prop, "rna_Struct_properties_begin", "rna_Struct_properties_next",
+	                                  "rna_iterator_listbase_end", "rna_Struct_properties_get",
+	                                  NULL, NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Properties", "Properties in the struct");
 
-	prop= RNA_def_property(srna, "functions", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "functions", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "Function");
-	RNA_def_property_collection_funcs(prop, "rna_Struct_functions_begin", "rna_Struct_functions_next", "rna_iterator_listbase_end", "rna_Struct_functions_get", NULL, NULL, NULL, NULL);
+	RNA_def_property_collection_funcs(prop, "rna_Struct_functions_begin", "rna_Struct_functions_next",
+	                                  "rna_iterator_listbase_end", "rna_Struct_functions_get",
+	                                  NULL, NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Functions", "");
 }
 
@@ -1040,107 +1064,109 @@ static void rna_def_property(BlenderRNA *brna)
 		{PROP_LAYER_MEMBER, "LAYER_MEMBERSHIP", 0, "Layer Membership", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "Property", NULL);
+	srna = RNA_def_struct(brna, "Property", NULL);
 	RNA_def_struct_ui_text(srna, "Property Definition", "RNA property definition");
 	RNA_def_struct_refine_func(srna, "rna_Property_refine");
 	RNA_def_struct_ui_icon(srna, ICON_RNA);
 
-	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_funcs(prop, "rna_Property_name_get", "rna_Property_name_length", NULL);
 	RNA_def_property_ui_text(prop, "Name", "Human readable name");
 
-	prop= RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_string_funcs(prop, "rna_Property_identifier_get", "rna_Property_identifier_length", NULL);
 	RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting");
 	RNA_def_struct_name_property(srna, prop);
 		
-	prop= RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_string_funcs(prop, "rna_Property_description_get", "rna_Property_description_length", NULL);
 	RNA_def_property_ui_text(prop, "Description", "Description of the property for tooltips");
 
-	prop= RNA_def_property(srna, "translation_context", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "translation_context", PROP_STRING, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_string_funcs(prop, "rna_Property_translation_context_get", "rna_Property_translation_context_length", NULL);
-	RNA_def_property_ui_text(prop, "Translation Context", "Translation context of the property");
+	RNA_def_property_string_funcs(prop, "rna_Property_translation_context_get",
+	                              "rna_Property_translation_context_length", NULL);
+	RNA_def_property_ui_text(prop, "Translation Context", "Translation context of the property's name");
 
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_enum_items(prop, property_type_items);
 	RNA_def_property_enum_funcs(prop, "rna_Property_type_get", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Type", "Data type of the property");
 
-	prop= RNA_def_property(srna, "subtype", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "subtype", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_enum_items(prop, subtype_items);
 	RNA_def_property_enum_funcs(prop, "rna_Property_subtype_get", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Subtype", "Semantic interpretation of the property");
 
-	prop= RNA_def_property(srna, "srna", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "srna", PROP_POINTER, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "Struct");
 	RNA_def_property_pointer_funcs(prop, "rna_Property_srna_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Base", "Struct definition used for properties assigned to this item");
 
-	prop= RNA_def_property(srna, "unit", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "unit", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_enum_items(prop, property_unit_items);
 	RNA_def_property_enum_funcs(prop, "rna_Property_unit_get", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Unit", "Type of units for this property");
 
-	prop= RNA_def_property(srna, "is_readonly", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_readonly", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Property_readonly_get", NULL);
 	RNA_def_property_ui_text(prop, "Read Only", "Property is editable through RNA");
 
-	prop= RNA_def_property(srna, "is_animatable", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_animatable", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Property_animatable_get", NULL);
 	RNA_def_property_ui_text(prop, "Animatable", "Property is animatable through RNA");
 
-	prop= RNA_def_property(srna, "is_required", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_required", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Property_is_required_get", NULL);
 	RNA_def_property_ui_text(prop, "Required", "False when this property is an optional argument in an RNA function");
 
-	prop= RNA_def_property(srna, "is_never_none", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_never_none", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Property_is_never_none_get", NULL);
 	RNA_def_property_ui_text(prop, "Never None", "True when this value can't be set to None");
 
-	prop= RNA_def_property(srna, "is_hidden", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_hidden", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Property_is_hidden_get", NULL);
 	RNA_def_property_ui_text(prop, "Hidden", "True when the property is hidden");
 
-	prop= RNA_def_property(srna, "is_skip_save", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_skip_save", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Property_is_skip_save_get", NULL);
 	RNA_def_property_ui_text(prop, "Skip Save", "True when the property is not saved in presets");
 
-	prop= RNA_def_property(srna, "is_output", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_output", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Property_use_output_get", NULL);
 	RNA_def_property_ui_text(prop, "Return", "True when this property is an output value from an RNA function");
 
-	prop= RNA_def_property(srna, "is_registered", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_registered", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Property_registered_get", NULL);
 	RNA_def_property_ui_text(prop, "Registered", "Property is registered as part of type registration");
 
-	prop= RNA_def_property(srna, "is_registered_optional", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_registered_optional", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Property_registered_optional_get", NULL);
-	RNA_def_property_ui_text(prop, "Registered Optionally", "Property is optionally registered as part of type registration");
+	RNA_def_property_ui_text(prop, "Registered Optionally",
+	                         "Property is optionally registered as part of type registration");
 	
-	prop= RNA_def_property(srna, "is_runtime", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_runtime", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Property_runtime_get", NULL);
 	RNA_def_property_ui_text(prop, "Runtime", "Property has been dynamically created at runtime");
 
-	prop= RNA_def_property(srna, "is_enum_flag", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_enum_flag", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Property_is_enum_flag_get", NULL);
 	RNA_def_property_ui_text(prop, "Enum Flag", "True when multiple enums ");
@@ -1151,52 +1177,56 @@ static void rna_def_function(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "Function", NULL);
+	srna = RNA_def_struct(brna, "Function", NULL);
 	RNA_def_struct_ui_text(srna, "Function Definition", "RNA function definition");
 	RNA_def_struct_ui_icon(srna, ICON_RNA);
 
-	prop= RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_string_funcs(prop, "rna_Function_identifier_get", "rna_Function_identifier_length", NULL);
 	RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting");
 	RNA_def_struct_name_property(srna, prop);
 
-	prop= RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_string_funcs(prop, "rna_Function_description_get", "rna_Function_description_length", NULL);
 	RNA_def_property_ui_text(prop, "Description", "Description of the Function's purpose");
 
-	prop= RNA_def_property(srna, "parameters", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "parameters", PROP_COLLECTION, PROP_NONE);
 	/*RNA_def_property_clear_flag(prop, PROP_EDITABLE);*/
 	RNA_def_property_struct_type(prop, "Property");
-	RNA_def_property_collection_funcs(prop, "rna_Function_parameters_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL);
+	RNA_def_property_collection_funcs(prop, "rna_Function_parameters_begin", "rna_iterator_listbase_next",
+	                                  "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+	                                  NULL, NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Parameters", "Parameters for the function");
 
-	prop= RNA_def_property(srna, "is_registered", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_registered", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Function_registered_get", NULL);
 	RNA_def_property_ui_text(prop, "Registered", "Function is registered as callback as part of type registration");
 
-	prop= RNA_def_property(srna, "is_registered_optional", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_registered_optional", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Function_registered_optional_get", NULL);
-	RNA_def_property_ui_text(prop, "Registered Optionally", "Function is optionally registered as callback part of type registration");
+	RNA_def_property_ui_text(prop, "Registered Optionally",
+	                         "Function is optionally registered as callback part of type registration");
 
-	prop= RNA_def_property(srna, "use_self", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_self", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Function_no_self_get", NULL);
-	RNA_def_property_ui_text(prop, "No Self", "Function does not pass its self as an argument (becomes a class method in python)");
+	RNA_def_property_ui_text(prop, "No Self",
+	                         "Function does not pass its self as an argument (becomes a class method in python)");
 }
 
 static void rna_def_number_property(StructRNA *srna, PropertyType type)
 {
 	PropertyRNA *prop;
 
-	prop= RNA_def_property(srna, "default", type, PROP_NONE);
+	prop = RNA_def_property(srna, "default", type, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Default", "Default value for this number");
 
-	switch(type) {
+	switch (type) {
 		case PROP_BOOLEAN:
 			RNA_def_property_boolean_funcs(prop, "rna_BoolProperty_default_get", NULL);
 			break;
@@ -1211,13 +1241,13 @@ static void rna_def_number_property(StructRNA *srna, PropertyType type)
 	}
 
 
-	prop= RNA_def_property(srna, "default_array", type, PROP_NONE);
+	prop = RNA_def_property(srna, "default_array", type, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_array(prop, RNA_MAX_ARRAY_DIMENSION); /* no fixed default length, important its not 0 though */
 	RNA_def_property_flag(prop, PROP_DYNAMIC);
 	RNA_def_property_dynamic_array_funcs(prop, "rna_NumberProperty_default_array_get_length"); /* same for all types */
 
-	switch(type) {
+	switch (type) {
 		case PROP_BOOLEAN:
 			RNA_def_property_boolean_funcs(prop, "rna_BoolProperty_default_array_get", NULL);
 			break;
@@ -1233,46 +1263,46 @@ static void rna_def_number_property(StructRNA *srna, PropertyType type)
 	RNA_def_property_ui_text(prop, "Default Array", "Default value for this array");
 
 
-	prop= RNA_def_property(srna, "array_length", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "array_length", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_int_funcs(prop, "rna_Property_array_length_get", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Array Length", "Maximum length of the array, 0 means unlimited");
 
-	if(type == PROP_BOOLEAN)
+	if (type == PROP_BOOLEAN)
 		return;
 
-	prop= RNA_def_property(srna, "hard_min", type, PROP_NONE);
+	prop = RNA_def_property(srna, "hard_min", type, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	if(type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_hard_min_get", NULL, NULL);
+	if (type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_hard_min_get", NULL, NULL);
 	else RNA_def_property_float_funcs(prop, "rna_FloatProperty_hard_min_get", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Hard Minimum", "Minimum value used by buttons");
 
-	prop= RNA_def_property(srna, "hard_max", type, PROP_NONE);
+	prop = RNA_def_property(srna, "hard_max", type, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	if(type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_hard_max_get", NULL, NULL);
+	if (type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_hard_max_get", NULL, NULL);
 	else RNA_def_property_float_funcs(prop, "rna_FloatProperty_hard_max_get", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Hard Maximum", "Maximum value used by buttons");
 
-	prop= RNA_def_property(srna, "soft_min", type, PROP_NONE);
+	prop = RNA_def_property(srna, "soft_min", type, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	if(type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_soft_min_get", NULL, NULL);
+	if (type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_soft_min_get", NULL, NULL);
 	else RNA_def_property_float_funcs(prop, "rna_FloatProperty_soft_min_get", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Soft Minimum", "Minimum value used by buttons");
 
-	prop= RNA_def_property(srna, "soft_max", type, PROP_NONE);
+	prop = RNA_def_property(srna, "soft_max", type, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	if(type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_soft_max_get", NULL, NULL);
+	if (type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_soft_max_get", NULL, NULL);
 	else RNA_def_property_float_funcs(prop, "rna_FloatProperty_soft_max_get", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Soft Maximum", "Maximum value used by buttons");
 
-	prop= RNA_def_property(srna, "step", type, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "step", type, PROP_UNSIGNED);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	if(type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_step_get", NULL, NULL);
+	if (type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_step_get", NULL, NULL);
 	else RNA_def_property_float_funcs(prop, "rna_FloatProperty_step_get", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Step", "Step size used by number buttons, for floats 1/100th of the step size");
 
-	if(type == PROP_FLOAT) {
-		prop= RNA_def_property(srna, "precision", PROP_INT, PROP_UNSIGNED);
+	if (type == PROP_FLOAT) {
+		prop = RNA_def_property(srna, "precision", PROP_INT, PROP_UNSIGNED);
 		RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 		RNA_def_property_int_funcs(prop, "rna_FloatProperty_precision_get", NULL, NULL);
 		RNA_def_property_ui_text(prop, "Precision", "Number of digits after the dot used by buttons");
@@ -1283,12 +1313,12 @@ static void rna_def_string_property(StructRNA *srna)
 {
 	PropertyRNA *prop;
 
-	prop= RNA_def_property(srna, "default", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "default", PROP_STRING, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_string_funcs(prop, "rna_StringProperty_default_get", "rna_StringProperty_default_length", NULL);
 	RNA_def_property_ui_text(prop, "Default", "string default value");
 
-	prop= RNA_def_property(srna, "length_max", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "length_max", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_int_funcs(prop, "rna_StringProperty_max_length_get", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Maximum Length", "Maximum length of the string, 0 means unlimited");
@@ -1303,47 +1333,50 @@ static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna)
 		{PROP_NONE, "DUMMY", 0, "Dummy", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	prop= RNA_def_property(srna, "default", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "default", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_enum_items(prop, default_dummy_items);
 	RNA_def_property_enum_funcs(prop, "rna_EnumProperty_default_get", NULL, "rna_EnumProperty_default_itemf");
 	RNA_def_property_ui_text(prop, "Default", "Default value for this enum");
 
 	/* same 'default' but uses 'PROP_ENUM_FLAG' */
-	prop= RNA_def_property(srna, "default_flag", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "default_flag", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_flag(prop, PROP_ENUM_FLAG);
 	RNA_def_property_enum_items(prop, default_dummy_items);
 	RNA_def_property_enum_funcs(prop, "rna_EnumProperty_default_get", NULL, "rna_EnumProperty_default_itemf");
 	RNA_def_property_ui_text(prop, "Default", "Default value for this enum");
 
-	prop= RNA_def_property(srna, "enum_items", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "enum_items", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "EnumPropertyItem");
-	RNA_def_property_collection_funcs(prop, "rna_EnumProperty_items_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
+	RNA_def_property_collection_funcs(prop, "rna_EnumProperty_items_begin", "rna_iterator_array_next",
+	                                  "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Items", "Possible values for the property");
 
-	srna= RNA_def_struct(brna, "EnumPropertyItem", NULL);
+	srna = RNA_def_struct(brna, "EnumPropertyItem", NULL);
 	RNA_def_struct_ui_text(srna, "Enum Item Definition", "Definition of a choice in an RNA enum property");
 	RNA_def_struct_ui_icon(srna, ICON_RNA);
 
-	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_funcs(prop, "rna_EnumPropertyItem_name_get", "rna_EnumPropertyItem_name_length", NULL);
 	RNA_def_property_ui_text(prop, "Name", "Human readable name");
 
-	prop= RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_string_funcs(prop, "rna_EnumPropertyItem_description_get", "rna_EnumPropertyItem_description_length", NULL);
+	RNA_def_property_string_funcs(prop, "rna_EnumPropertyItem_description_get",
+	                              "rna_EnumPropertyItem_description_length", NULL);
 	RNA_def_property_ui_text(prop, "Description", "Description of the item's purpose");
 
-	prop= RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_string_funcs(prop, "rna_EnumPropertyItem_identifier_get", "rna_EnumPropertyItem_identifier_length", NULL);
+	RNA_def_property_string_funcs(prop, "rna_EnumPropertyItem_identifier_get",
+	                              "rna_EnumPropertyItem_identifier_length", NULL);
 	RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting");
 	RNA_def_struct_name_property(srna, prop);
 
-	prop= RNA_def_property(srna, "value", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "value", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_int_funcs(prop, "rna_EnumPropertyItem_value_get", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Value", "Value of the item");
@@ -1353,10 +1386,10 @@ static void rna_def_pointer_property(StructRNA *srna, PropertyType type)
 {
 	PropertyRNA *prop;
 
-	prop= RNA_def_property(srna, "fixed_type", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "fixed_type", PROP_POINTER, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "Struct");
-	if(type == PROP_POINTER)
+	if (type == PROP_POINTER)
 		RNA_def_property_pointer_funcs(prop, "rna_PointerProperty_fixed_type_get", NULL, NULL, NULL);
 	else
 		RNA_def_property_pointer_funcs(prop, "rna_CollectionProperty_fixed_type_get", NULL, NULL, NULL);
@@ -1375,61 +1408,64 @@ void RNA_def_rna(BlenderRNA *brna)
 	rna_def_property(brna);
 
 	/* BoolProperty */
-	srna= RNA_def_struct(brna, "BoolProperty", "Property");
+	srna = RNA_def_struct(brna, "BoolProperty", "Property");
 	RNA_def_struct_ui_text(srna, "Boolean Definition", "RNA boolean property definition");
 	rna_def_number_property(srna, PROP_BOOLEAN);
 
 	/* IntProperty */
-	srna= RNA_def_struct(brna, "IntProperty", "Property");
+	srna = RNA_def_struct(brna, "IntProperty", "Property");
 	RNA_def_struct_ui_text(srna, "Int Definition", "RNA integer number property definition");
 	rna_def_number_property(srna, PROP_INT);
 
 	/* FloatProperty */
-	srna= RNA_def_struct(brna, "FloatProperty", "Property");
+	srna = RNA_def_struct(brna, "FloatProperty", "Property");
 	RNA_def_struct_ui_text(srna, "Float Definition", "RNA floating pointer number property definition");
 	rna_def_number_property(srna, PROP_FLOAT);
 
 	/* StringProperty */
-	srna= RNA_def_struct(brna, "StringProperty", "Property");
+	srna = RNA_def_struct(brna, "StringProperty", "Property");
 	RNA_def_struct_ui_text(srna, "String Definition", "RNA text string property definition");
 	rna_def_string_property(srna);
 
 	/* EnumProperty */
-	srna= RNA_def_struct(brna, "EnumProperty", "Property");
-	RNA_def_struct_ui_text(srna, "Enum Definition", "RNA enumeration property definition, to choose from a number of predefined options");
+	srna = RNA_def_struct(brna, "EnumProperty", "Property");
+	RNA_def_struct_ui_text(srna, "Enum Definition",
+	                       "RNA enumeration property definition, to choose from a number of predefined options");
 	rna_def_enum_property(brna, srna);
 
 	/* PointerProperty */
-	srna= RNA_def_struct(brna, "PointerProperty", "Property");
+	srna = RNA_def_struct(brna, "PointerProperty", "Property");
 	RNA_def_struct_ui_text(srna, "Pointer Definition", "RNA pointer property to point to another RNA struct");
 	rna_def_pointer_property(srna, PROP_POINTER);
 
 	/* CollectionProperty */
-	srna= RNA_def_struct(brna, "CollectionProperty", "Property");
-	RNA_def_struct_ui_text(srna, "Collection Definition", "RNA collection property to define lists, arrays and mappings");
+	srna = RNA_def_struct(brna, "CollectionProperty", "Property");
+	RNA_def_struct_ui_text(srna, "Collection Definition",
+	                       "RNA collection property to define lists, arrays and mappings");
 	rna_def_pointer_property(srna, PROP_COLLECTION);
 	
 	/* Function */
 	rna_def_function(brna);
 
 	/* Blender RNA */
-	srna= RNA_def_struct(brna, "BlenderRNA", NULL);
+	srna = RNA_def_struct(brna, "BlenderRNA", NULL);
 	RNA_def_struct_ui_text(srna, "Blender RNA", "Blender RNA structure definitions");
 	RNA_def_struct_ui_icon(srna, ICON_RNA);
 
-	prop= RNA_def_property(srna, "structs", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "structs", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "Struct");
-	RNA_def_property_collection_funcs(prop, "rna_BlenderRNA_structs_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+	RNA_def_property_collection_funcs(prop, "rna_BlenderRNA_structs_begin", "rna_iterator_listbase_next",
+	                                  "rna_iterator_listbase_end", "rna_iterator_listbase_get",
 		/* included for speed, can be removed */
 #if 0
-			0,0,0,0);
+	                                  NULL, NULL, NULL, NULL);
 #else
-			"rna_BlenderRNA_structs_length", "rna_BlenderRNA_structs_lookup_int", "rna_BlenderRNA_structs_lookup_string", NULL);
+	                                  "rna_BlenderRNA_structs_length", "rna_BlenderRNA_structs_lookup_int",
+	                                  "rna_BlenderRNA_structs_lookup_string", NULL);
 #endif
 
 	RNA_def_property_ui_text(prop, "Structs", "");
 }
 
 #endif
-
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 0ece690..d2eef1c 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -37,8 +37,13 @@
 #include "DNA_particle_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_userdef_types.h"
+
 #include "BLI_math.h"
 
+#include "BLF_translation.h"
+
+#include "BKE_tessmesh.h"
+
 /* Include for Bake Options */
 #include "RE_engine.h"
 #include "RE_pipeline.h"
@@ -52,7 +57,7 @@
 
 #ifdef WITH_FFMPEG
 #include "BKE_writeffmpeg.h"
-#include <libavcodec/avcodec.h> 
+#include <libavcodec/avcodec.h>
 #include <libavformat/avformat.h>
 #endif
 
@@ -82,7 +87,7 @@ EnumPropertyItem snap_target_items[] = {
 	{SCE_SNAP_TARGET_ACTIVE, "ACTIVE", 0, "Active", "Snap active onto target"},
 	{0, NULL, 0, NULL, NULL}};
 	
-EnumPropertyItem proportional_falloff_items[] ={
+EnumPropertyItem proportional_falloff_items[] = {
 	{PROP_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", "Smooth falloff"},
 	{PROP_SPHERE, "SPHERE", ICON_SPHERECURVE, "Sphere", "Spherical falloff"},
 	{PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"},
@@ -96,7 +101,8 @@ EnumPropertyItem proportional_falloff_items[] ={
 EnumPropertyItem proportional_editing_items[] = {
 	{PROP_EDIT_OFF, "DISABLED", ICON_PROP_OFF, "Disable", "Proportional Editing disabled"},
 	{PROP_EDIT_ON, "ENABLED", ICON_PROP_ON, "Enable", "Proportional Editing enabled"},
-	{PROP_EDIT_CONNECTED, "CONNECTED", ICON_PROP_CON, "Connected", "Proportional Editing using connected geometry only"},
+	{PROP_EDIT_CONNECTED, "CONNECTED", ICON_PROP_CON, "Connected",
+	                      "Proportional Editing using connected geometry only"},
 	{0, NULL, 0, NULL, NULL}};
 
 /* keep for operators, not used here */
@@ -120,11 +126,13 @@ EnumPropertyItem snap_element_items[] = {
  */
 
 #define R_IMF_ENUM_BMP      {R_IMF_IMTYPE_BMP, "BMP", ICON_FILE_IMAGE, "BMP", "Output image in bitmap format"},
-#define R_IMF_ENUM_IRIS     {R_IMF_IMTYPE_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", "Output image in (old!) SGI IRIS format"},
+#define R_IMF_ENUM_IRIS     {R_IMF_IMTYPE_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", \
+                                                "Output image in (old!) SGI IRIS format"},
 #define R_IMF_ENUM_PNG      {R_IMF_IMTYPE_PNG, "PNG", ICON_FILE_IMAGE, "PNG", "Output image in PNG format"},
 #define R_IMF_ENUM_JPEG     {R_IMF_IMTYPE_JPEG90, "JPEG", ICON_FILE_IMAGE, "JPEG", "Output image in JPEG format"},
 #define R_IMF_ENUM_TAGA     {R_IMF_IMTYPE_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", "Output image in Targa format"},
-#define R_IMF_ENUM_TAGA_RAW {R_IMF_IMTYPE_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", "Output image in uncompressed Targa format"},
+#define R_IMF_ENUM_TAGA_RAW {R_IMF_IMTYPE_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", \
+                                                  "Output image in uncompressed Targa format"},
 
 
 #ifdef WITH_DDS
@@ -134,13 +142,15 @@ EnumPropertyItem snap_element_items[] = {
 #endif
 
 #ifdef WITH_OPENJPEG
-#  define R_IMF_ENUM_JPEG2K {R_IMF_IMTYPE_JP2, "JPEG2000", ICON_FILE_IMAGE, "JPEG 2000", "Output image in JPEG 2000 format"},
+#  define R_IMF_ENUM_JPEG2K {R_IMF_IMTYPE_JP2, "JPEG2000", ICON_FILE_IMAGE, "JPEG 2000", \
+                                               "Output image in JPEG 2000 format"},
 #else
 #  define R_IMF_ENUM_JPEG2K
 #endif
 
 #ifdef WITH_CINEON
-#  define R_IMF_ENUM_CINEON {R_IMF_IMTYPE_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", "Output image in Cineon format"},
+#  define R_IMF_ENUM_CINEON {R_IMF_IMTYPE_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", \
+                                                  "Output image in Cineon format"},
 #  define R_IMF_ENUM_DPX    {R_IMF_IMTYPE_DPX, "DPX",ICON_FILE_IMAGE, "DPX", "Output image in DPX format"},
 #else
 #  define R_IMF_ENUM_CINEON
@@ -148,15 +158,19 @@ EnumPropertyItem snap_element_items[] = {
 #endif
 
 #ifdef WITH_OPENEXR
-#  define R_IMF_ENUM_EXR_MULTI  {R_IMF_IMTYPE_MULTILAYER, "OPEN_EXR_MULTILAYER", ICON_FILE_IMAGE, "OpenEXR MultiLayer", "Output image in multilayer OpenEXR format"},
-#  define R_IMF_ENUM_EXR        {R_IMF_IMTYPE_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", "Output image in OpenEXR format"},
+#  define R_IMF_ENUM_EXR_MULTI  {R_IMF_IMTYPE_MULTILAYER, "OPEN_EXR_MULTILAYER", ICON_FILE_IMAGE, \
+                                                          "OpenEXR MultiLayer", \
+                                                          "Output image in multilayer OpenEXR format"},
+#  define R_IMF_ENUM_EXR        {R_IMF_IMTYPE_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", \
+                                                       "Output image in OpenEXR format"},
 #else
 #  define R_IMF_ENUM_EXR_MULTI
 #  define R_IMF_ENUM_EXR
 #endif
 
 #ifdef WITH_HDR
-#  define R_IMF_ENUM_HDR  {R_IMF_IMTYPE_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", "Output image in Radiance HDR format"},
+#  define R_IMF_ENUM_HDR  {R_IMF_IMTYPE_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", \
+                                                "Output image in Radiance HDR format"},
 #else
 #  define R_IMF_ENUM_HDR
 #endif
@@ -190,16 +204,17 @@ EnumPropertyItem image_only_type_items[] = {
 
 	IMAGE_TYPE_ITEMS_IMAGE_ONLY
 
-    {0, NULL, 0, NULL, NULL}};
+	{0, NULL, 0, NULL, NULL}};
 
 EnumPropertyItem image_type_items[] = {
-	{0, "", 0, "Image", NULL},
+	{0, "", 0, N_("Image"), NULL},
 
 	IMAGE_TYPE_ITEMS_IMAGE_ONLY
 
-	{0, "", 0, "Movie", NULL},
+	{0, "", 0, N_("Movie"), NULL},
 #ifdef _WIN32
-	{R_IMF_IMTYPE_AVICODEC, "AVICODEC", ICON_FILE_MOVIE, "AVI Codec", "Output video in AVI format"}, // XXX Missing codec menu
+		/* XXX Missing codec menu */
+	{R_IMF_IMTYPE_AVICODEC, "AVICODEC", ICON_FILE_MOVIE, "AVI Codec", "Output video in AVI format"},
 #endif
 	{R_IMF_IMTYPE_AVIJPEG, "AVI_JPEG", ICON_FILE_MOVIE, "AVI JPEG", "Output video in AVI JPEG format"},
 	{R_IMF_IMTYPE_AVIRAW, "AVI_RAW", ICON_FILE_MOVIE, "AVI Raw", "Output video in AVI Raw format"},
@@ -223,7 +238,7 @@ EnumPropertyItem image_type_items[] = {
 #endif
 	{0, NULL, 0, NULL, NULL}};
 
-EnumPropertyItem image_color_mode_items[] ={
+EnumPropertyItem image_color_mode_items[] = {
 	{R_IMF_PLANES_BW, "BW", 0, "BW", "Images get saved in 8 bits grayscale (only PNG, JPEG, TGA, TIF)"},
 	{R_IMF_PLANES_RGB, "RGB", 0, "RGB", "Images are saved with RGB (color) data"},
 	{R_IMF_PLANES_RGBA, "RGBA", 0, "RGBA", "Images are saved with RGB and Alpha data (if supported)"},
@@ -254,7 +269,6 @@ EnumPropertyItem image_color_depth_items[] = {
 #include "MEM_guardedalloc.h"
 
 #include "BLI_threads.h"
-#include "BLI_editVert.h"
 
 #include "BKE_brush.h"
 #include "BKE_context.h"
@@ -290,12 +304,12 @@ static void rna_SpaceImageEditor_uv_sculpt_update(Main *bmain, Scene *scene, Poi
 
 static int rna_Scene_object_bases_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
 {
-	Scene *scene= (Scene*)ptr->data;
+	Scene *scene = (Scene*)ptr->data;
 	Base *base;
 
-	for(base= scene->base.first; base; base= base->next) {
-		if(strncmp(base->object->id.name+2, key, sizeof(base->object->id.name)-2)==0) {
-			*r_ptr= rna_pointer_inherit_refine(ptr, &RNA_ObjectBase, base);
+	for (base = scene->base.first; base; base = base->next) {
+		if (strncmp(base->object->id.name+2, key, sizeof(base->object->id.name)-2) == 0) {
+			*r_ptr = rna_pointer_inherit_refine(ptr, &RNA_ObjectBase, base);
 			return TRUE;
 		}
 	}
@@ -305,7 +319,7 @@ static int rna_Scene_object_bases_lookup_string(PointerRNA *ptr, const char *key
 
 static PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter)
 {
-	ListBaseIterator *internal= iter->internal;
+	ListBaseIterator *internal = iter->internal;
 
 	/* we are actually iterating a Base list, so override get */
 	return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((Base*)internal->link)->object);
@@ -313,7 +327,7 @@ static PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter)
 
 static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *reports, Object *ob)
 {
-	Scene *scene_act= CTX_data_scene(C);
+	Scene *scene_act = CTX_data_scene(C);
 	Base *base;
 
 	if (object_in_scene(ob, scene)) {
@@ -321,15 +335,15 @@ static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *report
 		return NULL;
 	}
 
-	base= scene_add_base(scene, ob);
+	base = scene_add_base(scene, ob);
 	id_us_plus(&ob->id);
 
 	/* this is similar to what object_add_type and add_object do */
-	base->lay= scene->lay;
+	base->lay = scene->lay;
 
-	/* when linking to an inactive scene dont touch the layer */
-	if(scene == scene_act)
-		ob->lay= base->lay;
+	/* when linking to an inactive scene don't touch the layer */
+	if (scene == scene_act)
+		ob->lay = base->lay;
 
 	ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME;
 
@@ -343,17 +357,17 @@ static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *report
 
 static void rna_Scene_object_unlink(Scene *scene, ReportList *reports, Object *ob)
 {
-	Base *base= object_in_scene(ob, scene);
+	Base *base = object_in_scene(ob, scene);
 	if (!base) {
 		BKE_reportf(reports, RPT_ERROR, "Object '%s' is not in this scene '%s'", ob->id.name+2, scene->id.name+2);
 		return;
 	}
-	if (base==scene->basact && ob->mode != OB_MODE_OBJECT) {
+	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);
 		return;
 	}
-	if(scene->basact==base) {
-		scene->basact= NULL;
+	if (scene->basact == base) {
+		scene->basact = NULL;
 	}
 
 	BLI_remlink(&scene->base, base);
@@ -361,7 +375,7 @@ static void rna_Scene_object_unlink(Scene *scene, ReportList *reports, Object *o
 
 	ob->id.us--;
 
-	/* needed otherwise the depgraph will contain free'd objects which can crash, see [#20958] */
+	/* needed otherwise the depgraph will contain freed objects which can crash, see [#20958] */
 	DAG_scene_sort(G.main, scene);
 	DAG_ids_flush_update(G.main, 0);
 
@@ -371,7 +385,7 @@ static void rna_Scene_object_unlink(Scene *scene, ReportList *reports, Object *o
 static void rna_Scene_skgen_etch_template_set(PointerRNA *ptr, PointerRNA value)
 {
 	ToolSettings *ts = (ToolSettings*)ptr->data;
-	if(value.data && ((Object*)value.data)->type == OB_ARMATURE)
+	if (value.data && ((Object*)value.data)->type == OB_ARMATURE)
 		ts->skgen_template = value.data;
 	else
 		ts->skgen_template = NULL;
@@ -379,43 +393,50 @@ static void rna_Scene_skgen_etch_template_set(PointerRNA *ptr, PointerRNA value)
 
 static PointerRNA rna_Scene_active_object_get(PointerRNA *ptr)
 {
-	Scene *scene= (Scene*)ptr->data;
+	Scene *scene = (Scene*)ptr->data;
 	return rna_pointer_inherit_refine(ptr, &RNA_Object, scene->basact ? scene->basact->object : NULL);
 }
 
 static void rna_Scene_active_object_set(PointerRNA *ptr, PointerRNA value)
 {
-	Scene *scene= (Scene*)ptr->data;
-	if(value.data)
-		scene->basact= object_in_scene((Object*)value.data, scene);
+	Scene *scene = (Scene*)ptr->data;
+	if (value.data)
+		scene->basact = object_in_scene((Object*)value.data, scene);
 	else
-		scene->basact= NULL;
+		scene->basact = NULL;
 }
 
 static void rna_Scene_set_set(PointerRNA *ptr, PointerRNA value)
 {
-	Scene *scene= (Scene*)ptr->data;
-	Scene *set= (Scene*)value.data;
+	Scene *scene = (Scene*)ptr->data;
+	Scene *set = (Scene*)value.data;
 	Scene *nested_set;
 
-	for(nested_set= set; nested_set; nested_set= nested_set->set) {
-		if(nested_set==scene)
+	for (nested_set = set; nested_set; nested_set = nested_set->set) {
+		if (nested_set == scene)
 			return;
 	}
 
-	scene->set= set;
+	scene->set = set;
 }
 
 static void rna_Scene_layer_set(PointerRNA *ptr, const int *values)
 {
-	Scene *scene= (Scene*)ptr->data;
+	Scene *scene = (Scene*)ptr->data;
+
+	scene->lay = ED_view3d_scene_layer_set(scene->lay, values, &scene->layact);
+}
+
+static int rna_Scene_active_layer_get(PointerRNA *ptr)
+{
+	Scene *scene = (Scene*)ptr->data;
 
-	scene->lay= ED_view3d_scene_layer_set(scene->lay, values, &scene->layact);
+	return (int)(log(scene->layact)/M_LN2);
 }
 
 static void rna_Scene_view3d_update(Main *bmain, Scene *UNUSED(scene_unused), PointerRNA *ptr)
 {
-	Scene *scene= (Scene*)ptr->data;
+	Scene *scene = (Scene*)ptr->data;
 
 	BKE_screen_view3d_main_sync(&bmain->screen, scene);
 }
@@ -439,52 +460,60 @@ static void rna_Scene_listener_update(Main *UNUSED(bmain), Scene *scene, Pointer
 
 static void rna_Scene_volume_set(PointerRNA *ptr, float value)
 {
-	Scene *scene= (Scene*)(ptr->data);
+	Scene *scene = (Scene*)(ptr->data);
 
 	scene->audio.volume = value;
-	if(scene->sound_scene)
+	if (scene->sound_scene)
 		sound_set_scene_volume(scene, value);
 }
 
 static void rna_Scene_framelen_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
-{	
-	scene->r.framelen= (float)scene->r.framapto/(float)scene->r.images;
+{
+	scene->r.framelen = (float)scene->r.framapto/(float)scene->r.images;
 }
 
 
 static void rna_Scene_current_frame_set(PointerRNA *ptr, int value)
 {
-	Scene *data= (Scene*)ptr->data;
+	Scene *data = (Scene*)ptr->data;
 	
 	/* if negative frames aren't allowed, then we can't use them */
 	FRAMENUMBER_MIN_CLAMP(value);
-	data->r.cfra= value;
+	data->r.cfra = value;
 }
 
 static void rna_Scene_start_frame_set(PointerRNA *ptr, int value)
 {
-	Scene *data= (Scene*)ptr->data;
+	Scene *data = (Scene*)ptr->data;
 	/* MINFRAME not MINAFRAME, since some output formats can't taken negative frames */
-	CLAMP(value, MINFRAME, data->r.efra); 
-	data->r.sfra= value;
+	CLAMP(value, MINFRAME, MAXFRAME);
+	data->r.sfra = value;
+
+	if (data->r.sfra >= data->r.efra) {
+		data->r.efra = MIN2(data->r.sfra, MAXFRAME);
+	}
 }
 
 static void rna_Scene_end_frame_set(PointerRNA *ptr, int value)
 {
-	Scene *data= (Scene*)ptr->data;
-	CLAMP(value, data->r.sfra, MAXFRAME);
-	data->r.efra= value;
+	Scene *data = (Scene*)ptr->data;
+	CLAMP(value, MINFRAME, MAXFRAME);
+	data->r.efra = value;
+
+	if (data->r.sfra >= data->r.efra) {
+		data->r.sfra = MAX2(data->r.efra, MINFRAME);
+	}
 }
 
 static void rna_Scene_use_preview_range_set(PointerRNA *ptr, int value)
 {
-	Scene *data= (Scene*)ptr->data;
+	Scene *data = (Scene*)ptr->data;
 	
 	if (value) {
 		/* copy range from scene if not set before */
 		if ((data->r.psfra == data->r.pefra) && (data->r.psfra == 0)) {
-			data->r.psfra= data->r.sfra;
-			data->r.pefra= data->r.efra;
+			data->r.psfra = data->r.sfra;
+			data->r.pefra = data->r.efra;
 		}
 		
 		data->r.flag |= SCER_PRV_RANGE;
@@ -496,84 +525,84 @@ static void rna_Scene_use_preview_range_set(PointerRNA *ptr, int value)
 
 static void rna_Scene_preview_range_start_frame_set(PointerRNA *ptr, int value)
 {
-	Scene *data= (Scene*)ptr->data;
+	Scene *data = (Scene*)ptr->data;
 	
 	/* check if enabled already */
 	if ((data->r.flag & SCER_PRV_RANGE) == 0) {
 		/* set end of preview range to end frame, then clamp as per normal */
-		// TODO: or just refuse to set instead?
-		data->r.pefra= data->r.efra;
+		/* TODO: or just refuse to set instead? */
+		data->r.pefra = data->r.efra;
 	}
 	
 	/* now set normally */
 	CLAMP(value, MINAFRAME, data->r.pefra);
-	data->r.psfra= value;
+	data->r.psfra = value;
 }
 
 static void rna_Scene_preview_range_end_frame_set(PointerRNA *ptr, int value)
 {
-	Scene *data= (Scene*)ptr->data;
+	Scene *data = (Scene*)ptr->data;
 	
 	/* check if enabled already */
 	if ((data->r.flag & SCER_PRV_RANGE) == 0) {
 		/* set start of preview range to start frame, then clamp as per normal */
-		// TODO: or just refuse to set instead?
-		data->r.psfra= data->r.sfra; 
+		/* TODO: or just refuse to set instead? */
+		data->r.psfra = data->r.sfra;
 	}
 	
 	/* now set normally */
 	CLAMP(value, data->r.psfra, MAXFRAME);
-	data->r.pefra= value;
+	data->r.pefra = value;
 }
 
 static void rna_Scene_frame_update(Main *bmain, Scene *UNUSED(current_scene), PointerRNA *ptr)
 {
-	Scene *scene= (Scene*)ptr->id.data;
+	Scene *scene = (Scene*)ptr->id.data;
 	sound_seek_scene(bmain, scene);
 }
 
 static PointerRNA rna_Scene_active_keying_set_get(PointerRNA *ptr)
 {
-	Scene *scene= (Scene *)ptr->data;
+	Scene *scene = (Scene *)ptr->data;
 	return rna_pointer_inherit_refine(ptr, &RNA_KeyingSet, ANIM_scene_get_active_keyingset(scene));
 }
 
 static void rna_Scene_active_keying_set_set(PointerRNA *ptr, PointerRNA value)
 {
-	Scene *scene= (Scene *)ptr->data;
-	KeyingSet *ks= (KeyingSet*)value.data;
+	Scene *scene = (Scene *)ptr->data;
+	KeyingSet *ks = (KeyingSet*)value.data;
 	
-	scene->active_keyingset= ANIM_scene_get_keyingset_index(scene, ks);
+	scene->active_keyingset = ANIM_scene_get_keyingset_index(scene, ks);
 }
 
 /* get KeyingSet index stuff for list of Keying Sets editing UI
  *	- active_keyingset-1 since 0 is reserved for 'none'
- *	- don't clamp, otherwise can never set builtins types as active... 
+ *	- don't clamp, otherwise can never set builtins types as active...
  */
 static int rna_Scene_active_keying_set_index_get(PointerRNA *ptr)
 {
-	Scene *scene= (Scene *)ptr->data; 	
+	Scene *scene = (Scene *)ptr->data;
 	return scene->active_keyingset-1;
 }
 
 /* get KeyingSet index stuff for list of Keying Sets editing UI
  *	- value+1 since 0 is reserved for 'none'
  */
-static void rna_Scene_active_keying_set_index_set(PointerRNA *ptr, int value) 
+static void rna_Scene_active_keying_set_index_set(PointerRNA *ptr, int value)
 {
-	Scene *scene= (Scene *)ptr->data; 
-	scene->active_keyingset= value+1; 	 
+	Scene *scene = (Scene *)ptr->data;
+	scene->active_keyingset = value+1;
 }
 
-// XXX: evil... builtin_keyingsets is defined in keyingsets.c!
-// TODO: make API function to retrieve this...
+/* XXX: evil... builtin_keyingsets is defined in keyingsets.c! */
+/* TODO: make API function to retrieve this... */
 extern ListBase builtin_keyingsets;
 
 static void rna_Scene_all_keyingsets_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Scene *scene= (Scene*)ptr->data;
+	Scene *scene = (Scene*)ptr->data;
 	
-	/* start going over the scene KeyingSets first, while we still have pointer to it 
+	/* start going over the scene KeyingSets first, while we still have pointer to it
 	 * but only if we have any Keying Sets to use...
 	 */
 	if (scene->keyingsets.first)
@@ -584,16 +613,16 @@ static void rna_Scene_all_keyingsets_begin(CollectionPropertyIterator *iter, Poi
 
 static void rna_Scene_all_keyingsets_next(CollectionPropertyIterator *iter)
 {
-	ListBaseIterator *internal= iter->internal;
-	KeyingSet *ks= (KeyingSet*)internal->link;
+	ListBaseIterator *internal = iter->internal;
+	KeyingSet *ks = (KeyingSet*)internal->link;
 	
 	/* if we've run out of links in Scene list, jump over to the builtins list unless we're there already */
 	if ((ks->next == NULL) && (ks != builtin_keyingsets.last))
-		internal->link= (Link*)builtin_keyingsets.first;
+		internal->link = (Link*)builtin_keyingsets.first;
 	else
-		internal->link= (Link*)ks->next;
+		internal->link = (Link*)ks->next;
 		
-	iter->valid= (internal->link != NULL);
+	iter->valid = (internal->link != NULL);
 }
 
 
@@ -604,9 +633,9 @@ static char *rna_RenderSettings_path(PointerRNA *UNUSED(ptr))
 
 static int rna_RenderSettings_threads_get(PointerRNA *ptr)
 {
-	RenderData *rd= (RenderData*)ptr->data;
+	RenderData *rd = (RenderData*)ptr->data;
 
-	if(rd->mode & R_FIXED_THREADS)
+	if (rd->mode & R_FIXED_THREADS)
 		return rd->threads;
 	else
 		return BLI_system_thread_count();
@@ -614,14 +643,14 @@ static int rna_RenderSettings_threads_get(PointerRNA *ptr)
 
 static int rna_RenderSettings_is_movie_fomat_get(PointerRNA *ptr)
 {
-	RenderData *rd= (RenderData*)ptr->data;
+	RenderData *rd = (RenderData*)ptr->data;
 	return BKE_imtype_is_movie(rd->im_format.imtype);
 }
 
 static int rna_RenderSettings_save_buffers_get(PointerRNA *ptr)
 {
-	RenderData *rd= (RenderData*)ptr->data;
-	if(rd->mode & R_BORDER)
+	RenderData *rd = (RenderData*)ptr->data;
+	if (rd->mode & R_BORDER)
 		return 0;
 	else
 		return (rd->scemode & (R_EXR_TILE_FILE|R_FULL_SAMPLE)) != 0;
@@ -629,34 +658,34 @@ static int rna_RenderSettings_save_buffers_get(PointerRNA *ptr)
 
 static int rna_RenderSettings_full_sample_get(PointerRNA *ptr)
 {
-	RenderData *rd= (RenderData*)ptr->data;
+	RenderData *rd = (RenderData*)ptr->data;
 
 	return (rd->scemode & R_FULL_SAMPLE) && !(rd->mode & R_BORDER);
 }
 
 static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value)
 {
-	ImageFormatData *imf= (ImageFormatData *)ptr->data;
-	ID *id= ptr->id.data;
-	const char is_render= (id && GS(id->name) == ID_SCE);
+	ImageFormatData *imf = (ImageFormatData *)ptr->data;
+	ID *id = ptr->id.data;
+	const char is_render = (id && GS(id->name) == ID_SCE);
 	/* see note below on why this is */
-	const char chan_flag= BKE_imtype_valid_channels(imf->imtype) | (is_render ? IMA_CHAN_FLAG_BW : 0);
+	const char chan_flag = BKE_imtype_valid_channels(imf->imtype) | (is_render ? IMA_CHAN_FLAG_BW : 0);
 
-	imf->imtype= value;
+	imf->imtype = value;
 
 	/* ensure depth and color settings match */
 	if ( ((imf->planes == R_IMF_PLANES_BW) &&   !(chan_flag & IMA_CHAN_FLAG_BW)) ||
 	     ((imf->planes == R_IMF_PLANES_RGBA) && !(chan_flag & IMA_CHAN_FLAG_ALPHA)))
 	{
-		imf->planes= R_IMF_PLANES_RGB;
+		imf->planes = R_IMF_PLANES_RGB;
 	}
 
 	/* ensure usable depth */
 	{
-		const int depth_ok= BKE_imtype_valid_depths(imf->imtype);
+		const int depth_ok = BKE_imtype_valid_depths(imf->imtype);
 		if ((imf->depth & depth_ok) == 0) {
 			/* set first available depth */
-			char depth_ls[]= {R_IMF_CHAN_DEPTH_32,
+			char depth_ls[] = {R_IMF_CHAN_DEPTH_32,
 			                  R_IMF_CHAN_DEPTH_24,
 			                  R_IMF_CHAN_DEPTH_16,
 			                  R_IMF_CHAN_DEPTH_12,
@@ -665,9 +694,9 @@ static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value)
 			                  0};
 			int i;
 
-			for (i= 0; depth_ls[i]; i++) {
+			for (i = 0; depth_ls[i]; i++) {
 				if (depth_ok & depth_ls[i]) {
-					imf->depth= depth_ls[i];
+					imf->depth = depth_ls[i];
 					break;
 				}
 			}
@@ -675,8 +704,8 @@ static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value)
 	}
 
 	if (id && GS(id->name) == ID_SCE) {
-		Scene *scene= ptr->id.data;
-		RenderData *rd= &scene->r;
+		Scene *scene = ptr->id.data;
+		RenderData *rd = &scene->r;
 #ifdef WITH_FFMPEG
 		ffmpeg_verify_image_type(rd, imf);
 #endif
@@ -690,7 +719,7 @@ static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value)
 static EnumPropertyItem *rna_ImageFormatSettings_file_format_itemf(bContext *C, PointerRNA *ptr,
                                                                    PropertyRNA *UNUSED(prop), int *free)
 {
-	ID *id= ptr->id.data;
+	ID *id = ptr->id.data;
 	if (id && GS(id->name) == ID_SCE) {
 		return image_type_items;
 	}
@@ -702,26 +731,26 @@ static EnumPropertyItem *rna_ImageFormatSettings_file_format_itemf(bContext *C,
 static EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(bContext *C, PointerRNA *ptr,
                                                                   PropertyRNA *UNUSED(prop), int *free)
 {
-	ImageFormatData *imf= (ImageFormatData *)ptr->data;
-	ID *id= ptr->id.data;
-	const char is_render= (id && GS(id->name) == ID_SCE);
+	ImageFormatData *imf = (ImageFormatData *)ptr->data;
+	ID *id = ptr->id.data;
+	const char is_render = (id && GS(id->name) == ID_SCE);
 
 	/* note, we need to act differently for render
 	 * where 'BW' will force greyscale even if the output format writes
 	 * as RGBA, this is age old blender convention and not sure how useful
 	 * it really is but keep it for now - campbell */
-	char chan_flag= BKE_imtype_valid_channels(imf->imtype) | (is_render ? IMA_CHAN_FLAG_BW : 0);
+	char chan_flag = BKE_imtype_valid_channels(imf->imtype) | (is_render ? IMA_CHAN_FLAG_BW : 0);
 
 #ifdef WITH_FFMPEG
 	/* a WAY more crappy case than B&W flag: depending on codec, file format MIGHT support
 	 * alpha channel. for example MPEG format with h264 codec can't do alpha channel, but
 	 * the same MPEG format with QTRLE codec can easily handle alpga channel.
 	 * not sure how to deal with such cases in a nicer way (sergey) */
-	if(is_render) {
+	if (is_render) {
 		Scene *scene = ptr->id.data;
 		RenderData *rd = &scene->r;
 
-		if (rd->ffcodecdata.codec == CODEC_ID_QTRLE)
+		if (ffmpeg_alpha_channel_supported(rd))
 			chan_flag |= IMA_CHAN_FLAG_ALPHA;
 	}
 #endif
@@ -730,15 +759,15 @@ static EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(bContext *C, P
 		return image_color_mode_items;
 	}
 	else {
-		int totitem= 0;
-		EnumPropertyItem *item= NULL;
+		int totitem = 0;
+		EnumPropertyItem *item = NULL;
 
 		if (chan_flag & IMA_CHAN_FLAG_BW)    RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_BW);
 		if (chan_flag & IMA_CHAN_FLAG_RGB)   RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_RGB);
 		if (chan_flag & IMA_CHAN_FLAG_ALPHA) RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_RGBA);
 
 		RNA_enum_item_end(&item, &totitem);
-		*free= 1;
+		*free = 1;
 
 		return item;
 	}
@@ -747,22 +776,22 @@ static EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(bContext *C, P
 static EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf(bContext *C, PointerRNA *ptr,
                                                                   PropertyRNA *UNUSED(prop), int *free)
 {
-	ImageFormatData *imf= (ImageFormatData *)ptr->data;
+	ImageFormatData *imf = (ImageFormatData *)ptr->data;
 
 	if (imf == NULL) {
 		return image_color_depth_items;
 	}
 	else {
-		const int depth_ok= BKE_imtype_valid_depths(imf->imtype);
-		const int is_float= ELEM3(imf->imtype, R_IMF_IMTYPE_RADHDR, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER);
+		const int depth_ok = BKE_imtype_valid_depths(imf->imtype);
+		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_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];
 
-		int totitem= 0;
-		EnumPropertyItem *item= NULL;
+		int totitem = 0;
+		EnumPropertyItem *item = NULL;
 		EnumPropertyItem tmp = {0, "", 0, "", ""};
 
 		if (depth_ok & R_IMF_CHAN_DEPTH_8) {
@@ -775,8 +804,8 @@ static EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf(bContext *C,
 
 		if (depth_ok & R_IMF_CHAN_DEPTH_16) {
 			if (is_float) {
-				tmp= *item_16bit;
-				tmp.name= "Float (Half)";
+				tmp = *item_16bit;
+				tmp.name = "Float (Half)";
 				RNA_enum_item_add(&item, &totitem, &tmp);
 			}
 			else {
@@ -786,8 +815,8 @@ static EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf(bContext *C,
 
 		if (depth_ok & R_IMF_CHAN_DEPTH_32) {
 			if (is_float) {
-				tmp= *item_32bit;
-				tmp.name= "Float (Full)";
+				tmp = *item_32bit;
+				tmp.name = "Float (Full)";
 				RNA_enum_item_add(&item, &totitem, &tmp);
 			}
 			else {
@@ -796,7 +825,7 @@ static EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf(bContext *C,
 		}
 
 		RNA_enum_item_end(&item, &totitem);
-		*free= 1;
+		*free = 1;
 
 		return item;
 	}
@@ -804,17 +833,17 @@ static EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf(bContext *C,
 
 static int rna_SceneRender_file_ext_length(PointerRNA *ptr)
 {
-	RenderData *rd= (RenderData*)ptr->data;
+	RenderData *rd = (RenderData*)ptr->data;
 	char ext[8];
-	ext[0]= '\0';
+	ext[0] = '\0';
 	BKE_add_image_extension(ext, rd->im_format.imtype);
 	return strlen(ext);
 }
 
 static void rna_SceneRender_file_ext_get(PointerRNA *ptr, char *str)
 {
-	RenderData *rd= (RenderData*)ptr->data;
-	str[0]= '\0';
+	RenderData *rd = (RenderData*)ptr->data;
+	str[0] = '\0';
 	BKE_add_image_extension(str, rd->im_format.imtype);
 }
 
@@ -836,28 +865,28 @@ static void rna_RenderSettings_qtcodecsettings_codecType_set(PointerRNA *ptr, in
 static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bContext *C, PointerRNA *ptr,
                                                                             PropertyRNA *UNUSED(prop), int *free)
 {
-	EnumPropertyItem *item= NULL;
+	EnumPropertyItem *item = NULL;
 	EnumPropertyItem tmp = {0, "", 0, "", ""};
 	QuicktimeCodecTypeDesc *codecTypeDesc;
-	int i=1, totitem= 0;
+	int i = 1, totitem = 0;
 	char id[5];
 	
-	for(i=0;i<quicktime_get_num_videocodecs();i++) {
+	for (i = 0;i<quicktime_get_num_videocodecs();i++) {
 		codecTypeDesc = quicktime_get_videocodecType_desc(i);
 		if (!codecTypeDesc) break;
 		
-		tmp.value= codecTypeDesc->rnatmpvalue;
+		tmp.value = codecTypeDesc->rnatmpvalue;
 		*((int*)id) = codecTypeDesc->codecType;
 		id[4] = 0;
-		tmp.identifier= id; 
-		tmp.name= codecTypeDesc->codecName;
+		tmp.identifier = id;
+		tmp.name = codecTypeDesc->codecName;
 		RNA_enum_item_add(&item, &totitem, &tmp);
 	}
 	
 	RNA_enum_item_end(&item, &totitem);
-	*free= 1;
+	*free = 1;
 	
-	return item;	
+	return item;
 }
 
 #ifdef USE_QTKIT
@@ -878,26 +907,26 @@ static void rna_RenderSettings_qtcodecsettings_audiocodecType_set(PointerRNA *pt
 static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_audiocodecType_itemf(bContext *C, PointerRNA *ptr,
                                                                                  PropertyRNA *UNUSED(prop), int *free)
 {
-	EnumPropertyItem *item= NULL;
+	EnumPropertyItem *item = NULL;
 	EnumPropertyItem tmp = {0, "", 0, "", ""};
 	QuicktimeCodecTypeDesc *codecTypeDesc;
-	int i=1, totitem= 0;
+	int i = 1, totitem = 0;
 	
-	for(i=0;i<quicktime_get_num_audiocodecs();i++) {
+	for (i = 0;i<quicktime_get_num_audiocodecs();i++) {
 		codecTypeDesc = quicktime_get_audiocodecType_desc(i);
 		if (!codecTypeDesc) break;
 		
-		tmp.value= codecTypeDesc->rnatmpvalue;
-		tmp.identifier= codecTypeDesc->codecName; 
-		tmp.name= codecTypeDesc->codecName;
+		tmp.value = codecTypeDesc->rnatmpvalue;
+		tmp.identifier = codecTypeDesc->codecName;
+		tmp.name = codecTypeDesc->codecName;
 		RNA_enum_item_add(&item, &totitem, &tmp);
 	}
 	
 	RNA_enum_item_end(&item, &totitem);
-	*free= 1;
+	*free = 1;
 	
-	return item;	
-}	
+	return item;
+}
 #endif
 #endif
 
@@ -926,28 +955,28 @@ static void rna_FFmpegSettings_codec_settings_update(Main *UNUSED(bmain), Scene
 
 static int rna_RenderSettings_active_layer_index_get(PointerRNA *ptr)
 {
-	RenderData *rd= (RenderData*)ptr->data;
+	RenderData *rd = (RenderData*)ptr->data;
 	return rd->actlay;
 }
 
 static void rna_RenderSettings_active_layer_index_set(PointerRNA *ptr, int value)
 {
-	RenderData *rd= (RenderData*)ptr->data;
-	rd->actlay= value;
+	RenderData *rd = (RenderData*)ptr->data;
+	rd->actlay = value;
 }
 
-static void rna_RenderSettings_active_layer_index_range(PointerRNA *ptr, int *min, int *max)
+static void rna_RenderSettings_active_layer_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
 {
-	RenderData *rd= (RenderData*)ptr->data;
+	RenderData *rd = (RenderData*)ptr->data;
 
-	*min= 0;
-	*max= BLI_countlist(&rd->layers)-1;
-	*max= MAX2(0, *max);
+	*min = 0;
+	*max = BLI_countlist(&rd->layers)-1;
+	*max = MAX2(0, *max);
 }
 
 static PointerRNA rna_RenderSettings_active_layer_get(PointerRNA *ptr)
 {
-	RenderData *rd= (RenderData*)ptr->data;
+	RenderData *rd = (RenderData*)ptr->data;
 	SceneRenderLayer *srl = BLI_findlink(&rd->layers, rd->actlay);
 	
 	return rna_pointer_inherit_refine(ptr, &RNA_SceneRenderLayer, srl);
@@ -955,28 +984,30 @@ static PointerRNA rna_RenderSettings_active_layer_get(PointerRNA *ptr)
 
 static void rna_RenderSettings_active_layer_set(PointerRNA *ptr, PointerRNA value)
 {
-	RenderData *rd= (RenderData*)ptr->data;
-	SceneRenderLayer *srl= (SceneRenderLayer*)value.data;
-	const int index= BLI_findindex(&rd->layers, srl);
-	if (index != -1) rd->actlay= index;
+	RenderData *rd = (RenderData*)ptr->data;
+	SceneRenderLayer *srl = (SceneRenderLayer*)value.data;
+	const int index = BLI_findindex(&rd->layers, srl);
+	if (index != -1) rd->actlay = index;
 }
 
 static SceneRenderLayer *rna_RenderLayer_new(ID *id, RenderData *UNUSED(rd), const char *name)
 {
-	Scene *scene= (Scene *)id;
-	SceneRenderLayer *srl= scene_add_render_layer(scene, name);
+	Scene *scene = (Scene *)id;
+	SceneRenderLayer *srl = scene_add_render_layer(scene, name);
 
 	WM_main_add_notifier(NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
 	return srl;
 }
 
-static void rna_RenderLayer_remove(ID *id, RenderData *UNUSED(rd), Main *bmain, ReportList *reports, SceneRenderLayer *srl)
+static void rna_RenderLayer_remove(ID *id, RenderData *UNUSED(rd), Main *bmain, ReportList *reports,
+                                   SceneRenderLayer *srl)
 {
-	Scene *scene= (Scene *)id;
+	Scene *scene = (Scene *)id;
 
 	if (!scene_remove_render_layer(bmain, scene, srl)) {
-		BKE_reportf(reports, RPT_ERROR, "RenderLayer '%s' could not be removed from scene '%s'", srl->name, scene->id.name+2);
+		BKE_reportf(reports, RPT_ERROR, "RenderLayer '%s' could not be removed from scene '%s'",
+		            srl->name, scene->id.name+2);
 	}
 	else {
 		WM_main_add_notifier(NC_SCENE|ND_RENDER_OPTIONS, NULL);
@@ -985,10 +1016,10 @@ static void rna_RenderLayer_remove(ID *id, RenderData *UNUSED(rd), Main *bmain,
 
 static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value)
 {
-	RenderData *rd= (RenderData*)ptr->data;
-	RenderEngineType *type= BLI_findlink(&R_engines, value);
+	RenderData *rd = (RenderData*)ptr->data;
+	RenderEngineType *type = BLI_findlink(&R_engines, value);
 
-	if(type)
+	if (type)
 		BLI_strncpy_utf8(rd->engine, type->idname, sizeof(rd->engine));
 }
 
@@ -996,31 +1027,31 @@ static EnumPropertyItem *rna_RenderSettings_engine_itemf(bContext *UNUSED(C), Po
                                                          PropertyRNA *UNUSED(prop), int *free)
 {
 	RenderEngineType *type;
-	EnumPropertyItem *item= NULL;
+	EnumPropertyItem *item = NULL;
 	EnumPropertyItem tmp = {0, "", 0, "", ""};
-	int a=0, totitem= 0;
+	int a = 0, totitem = 0;
 
-	for(type=R_engines.first; type; type=type->next, a++) {
-		tmp.value= a;
-		tmp.identifier= type->idname;
-		tmp.name= type->name;
+	for (type = R_engines.first; type; type = type->next, a++) {
+		tmp.value = a;
+		tmp.identifier = type->idname;
+		tmp.name = type->name;
 		RNA_enum_item_add(&item, &totitem, &tmp);
 	}
 	
 	RNA_enum_item_end(&item, &totitem);
-	*free= 1;
+	*free = 1;
 
 	return item;
 }
 
 static int rna_RenderSettings_engine_get(PointerRNA *ptr)
 {
-	RenderData *rd= (RenderData*)ptr->data;
+	RenderData *rd = (RenderData*)ptr->data;
 	RenderEngineType *type;
-	int a= 0;
+	int a = 0;
 
-	for(type=R_engines.first; type; type=type->next, a++)
-		if(strcmp(type->idname, rd->engine) == 0)
+	for (type = R_engines.first; type; type = type->next, a++)
+		if (strcmp(type->idname, rd->engine) == 0)
 			return a;
 	
 	return 0;
@@ -1033,7 +1064,7 @@ static void rna_RenderSettings_engine_update(Main *bmain, Scene *UNUSED(unused),
 
 static void rna_Scene_glsl_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	Scene *scene= (Scene*)ptr->id.data;
+	Scene *scene = (Scene*)ptr->id.data;
 
 	DAG_id_tag_update(&scene->id, 0);
 }
@@ -1041,15 +1072,15 @@ static void rna_Scene_glsl_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Poi
 static void rna_RenderSettings_color_management_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
 {
 	/* reset image nodes */
-	Scene *scene= (Scene*)ptr->id.data;
-	bNodeTree *ntree=scene->nodetree;
+	Scene *scene = (Scene*)ptr->id.data;
+	bNodeTree *ntree = scene->nodetree;
 	bNode *node;
 	
-	if(ntree && scene->use_nodes) {
+	if (ntree && scene->use_nodes) {
 		/* XXX images are freed here, stop render and preview threads, until Image is threadsafe */
 		WM_jobs_stop_all(bmain->wm.first);
 		
-		for (node=ntree->nodes.first; node; node=node->next) {
+		for (node = ntree->nodes.first; node; node = node->next) {
 			if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_IMAGE)) {
 				ED_node_changed_update(&scene->id, node);
 				WM_main_add_notifier(NC_NODE|NA_EDITED, node);
@@ -1065,18 +1096,18 @@ static void rna_RenderSettings_color_management_update(Main *bmain, Scene *UNUSE
 
 static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value)
 {
-	Scene *scene= (Scene*)ptr->id.data;
-	SceneRenderLayer *rl= (SceneRenderLayer*)ptr->data;
+	Scene *scene = (Scene*)ptr->id.data;
+	SceneRenderLayer *rl = (SceneRenderLayer*)ptr->data;
 	BLI_strncpy_utf8(rl->name, value, sizeof(rl->name));
 	BLI_uniquename(&scene->r.layers, rl, "RenderLayer", '.', offsetof(SceneRenderLayer, name), sizeof(rl->name));
 
-	if(scene->nodetree) {
+	if (scene->nodetree) {
 		bNode *node;
-		int index= BLI_findindex(&scene->r.layers, rl);
+		int index = BLI_findindex(&scene->r.layers, rl);
 
-		for(node= scene->nodetree->nodes.first; node; node= node->next) {
-			if(node->type==CMP_NODE_R_LAYERS && node->id==NULL) {
-				if(node->custom1==index)
+		for (node = scene->nodetree->nodes.first; node; node = node->next) {
+			if (node->type == CMP_NODE_R_LAYERS && node->id == NULL) {
+				if (node->custom1 == index)
 					BLI_strncpy(node->name, rl->name, NODE_MAXSTR);
 			}
 		}
@@ -1090,17 +1121,17 @@ static int rna_RenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr))
 
 static int rna_RenderSettings_use_shading_nodes_get(PointerRNA *ptr)
 {
-	Scene *scene= (Scene*)ptr->id.data;
+	Scene *scene = (Scene*)ptr->id.data;
 	return scene_use_new_shading_nodes(scene);
 }
 
 static int rna_RenderSettings_use_game_engine_get(PointerRNA *ptr)
 {
-	RenderData *rd= (RenderData*)ptr->data;
+	RenderData *rd = (RenderData*)ptr->data;
 	RenderEngineType *type;
 
-	for(type=R_engines.first; type; type=type->next)
-		if(strcmp(type->idname, rd->engine) == 0)
+	for (type = R_engines.first; type; type = type->next)
+		if (strcmp(type->idname, rd->engine) == 0)
 			return (type->flag & RE_GAME);
 	
 	return 0;
@@ -1108,50 +1139,52 @@ static int rna_RenderSettings_use_game_engine_get(PointerRNA *ptr)
 
 static void rna_SceneRenderLayer_layer_set(PointerRNA *ptr, const int *values)
 {
-	SceneRenderLayer *rl= (SceneRenderLayer*)ptr->data;
-	rl->lay= ED_view3d_scene_layer_set(rl->lay, values, NULL);
+	SceneRenderLayer *rl = (SceneRenderLayer*)ptr->data;
+	rl->lay = ED_view3d_scene_layer_set(rl->lay, values, NULL);
 }
 
-static void rna_SceneRenderLayer_pass_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_SceneRenderLayer_pass_update(Main *bmain, Scene *activescene, PointerRNA *ptr)
 {
-	Scene *scene= (Scene*)ptr->id.data;
+	Scene *scene = (Scene*)ptr->id.data;
 
-	if(scene->nodetree)
+	if (scene->nodetree)
 		ntreeCompositForceHidden(scene->nodetree, scene);
+	
+	rna_Scene_glsl_update(bmain, activescene, ptr);
 }
 
 static void rna_Scene_use_nodes_set(PointerRNA *ptr, int value)
 {
-	Scene *scene= (Scene*)ptr->data;
+	Scene *scene = (Scene*)ptr->data;
 
-	scene->use_nodes= value;
-	if(scene->use_nodes && scene->nodetree==NULL)
+	scene->use_nodes = value;
+	if (scene->use_nodes && scene->nodetree == NULL)
 		ED_node_composit_default(scene);
 }
 
 static void rna_Physics_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	Scene *scene= (Scene*)ptr->id.data;
+	Scene *scene = (Scene*)ptr->id.data;
 	Base *base;
 
-	for(base = scene->base.first; base; base=base->next)
+	for (base = scene->base.first; base; base = base->next)
 		BKE_ptcache_object_reset(scene, base->object, PTCACHE_RESET_DEPSGRAPH);
 }
 
 static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const int *value)
 {
-	Scene *scene= (Scene*)ptr->id.data;
+	Scene *scene = (Scene*)ptr->id.data;
 	ToolSettings *ts = (ToolSettings*)ptr->data;
-	int flag = (value[0] ? SCE_SELECT_VERTEX:0) | (value[1] ? SCE_SELECT_EDGE:0) | (value[2] ? SCE_SELECT_FACE:0);
+	int flag = (value[0] ? SCE_SELECT_VERTEX:0) | (value[1] ? SCE_SELECT_EDGE:0) | (value[2] ? SCE_SELECT_FACE : 0);
 
-	if(flag) {
+	if (flag) {
 		ts->selectmode = flag;
 
-		if(scene->basact) {
-			Mesh *me= get_mesh(scene->basact->object);
-			if(me && me->edit_mesh && me->edit_mesh->selectmode != flag) {
-				me->edit_mesh->selectmode= flag;
-				EM_selectmode_set(me->edit_mesh);
+		if (scene->basact) {
+			Mesh *me = get_mesh(scene->basact->object);
+			if (me && me->edit_btmesh && me->edit_btmesh->selectmode != flag) {
+				me->edit_btmesh->selectmode = flag;
+				EDBM_selectmode_set(me->edit_btmesh);
 			}
 		}
 	}
@@ -1159,12 +1192,12 @@ static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const int *value
 
 static void rna_Scene_editmesh_select_mode_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
 {
-	Mesh *me= NULL;
+	Mesh *me = NULL;
 
-	if(scene->basact) {
-		me= get_mesh(scene->basact->object);
-		if(me && me->edit_mesh==NULL)
-			me= NULL;
+	if (scene->basact) {
+		me = get_mesh(scene->basact->object);
+		if (me && me->edit_btmesh == NULL)
+			me = NULL;
 	}
 
 	WM_main_add_notifier(NC_GEOM|ND_SELECT, me);
@@ -1176,17 +1209,17 @@ 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))
+	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(psys=ob->particlesystem.first; psys; psys=psys->next)
+	for (psys = ob->particlesystem.first; psys; psys = psys->next)
 		psys->recalc |= PSYS_RECALC_CHILD;
 	
-	if(ob->dup_group) {
+	if (ob->dup_group) {
 		GroupObject *gob;
 
-		for(gob=ob->dup_group->gobject.first; gob; gob=gob->next)
+		for (gob = ob->dup_group->gobject.first; gob; gob = gob->next)
 			object_simplify_update(gob->ob);
 	}
 }
@@ -1196,7 +1229,7 @@ static void rna_Scene_use_simplify_update(Main *bmain, Scene *scene, PointerRNA
 	Scene *sce_iter;
 	Base *base;
 
-	for(SETLOOPER(scene, sce_iter, base))
+	for (SETLOOPER(scene, sce_iter, base))
 		object_simplify_update(base->object);
 	
 	DAG_ids_flush_update(bmain, 0);
@@ -1205,21 +1238,21 @@ static void rna_Scene_use_simplify_update(Main *bmain, Scene *scene, PointerRNA
 
 static void rna_Scene_simplify_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	if(scene->r.mode & R_SIMPLIFY)
+	if (scene->r.mode & R_SIMPLIFY)
 		rna_Scene_use_simplify_update(bmain, scene, ptr);
 }
 
 static int rna_Scene_use_audio_get(PointerRNA *ptr)
 {
-	Scene *scene= (Scene*)ptr->data;
+	Scene *scene = (Scene*)ptr->data;
 	return scene->audio.flag & AUDIO_MUTE;
 }
 
 static void rna_Scene_use_audio_set(PointerRNA *ptr, int value)
 {
-	Scene *scene= (Scene*)ptr->data;
+	Scene *scene = (Scene*)ptr->data;
 
-	if(value)
+	if (value)
 		scene->audio.flag |= AUDIO_MUTE;
 	else
 		scene->audio.flag &= ~AUDIO_MUTE;
@@ -1229,25 +1262,24 @@ static void rna_Scene_use_audio_set(PointerRNA *ptr, int value)
 
 static int rna_Scene_sync_mode_get(PointerRNA *ptr)
 {
-	Scene *scene= (Scene*)ptr->data;
-	if(scene->audio.flag & AUDIO_SYNC)
+	Scene *scene = (Scene*)ptr->data;
+	if (scene->audio.flag & AUDIO_SYNC)
 		return AUDIO_SYNC;
 	return scene->flag & SCE_FRAME_DROP;
 }
 
 static void rna_Scene_sync_mode_set(PointerRNA *ptr, int value)
 {
-	Scene *scene= (Scene*)ptr->data;
+	Scene *scene = (Scene*)ptr->data;
 
-	if(value == AUDIO_SYNC)
+	if (value == AUDIO_SYNC) {
 		scene->audio.flag |= AUDIO_SYNC;
-	else if(value == SCE_FRAME_DROP)
-	{
+	}
+	else if (value == SCE_FRAME_DROP) {
 		scene->audio.flag &= ~AUDIO_SYNC;
 		scene->flag |= SCE_FRAME_DROP;
 	}
-	else
-	{
+	else {
 		scene->audio.flag &= ~AUDIO_SYNC;
 		scene->flag &= ~SCE_FRAME_DROP;
 	}
@@ -1263,7 +1295,7 @@ static int rna_GameSettings_auto_start_get(PointerRNA *UNUSED(ptr))
 
 static void rna_GameSettings_auto_start_set(PointerRNA *UNUSED(ptr), int value)
 {
-	if(value)
+	if (value)
 		G.fileflags |= G_FILE_AUTOPLAY;
 	else
 		G.fileflags &= ~G_FILE_AUTOPLAY;
@@ -1273,15 +1305,15 @@ static void rna_GameSettings_exit_key_set(PointerRNA *ptr, int value)
 {
 	GameData *gm = (GameData*)ptr->data;
 
-	if(ISKEYBOARD(value))
-		gm->exitkey=value;
+	if (ISKEYBOARD(value))
+		gm->exitkey = value;
 }
 
 static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[])
 {
 	TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
-	marker->flag= SELECT;
-	marker->frame= 1;
+	marker->flag = SELECT;
+	marker->frame = 1;
 	BLI_strncpy_utf8(marker->name, name, sizeof(marker->name));
 	BLI_addtail(&scene->markers, marker);
 
@@ -1313,15 +1345,15 @@ static void rna_TimeLine_clear(Scene *scene)
 	WM_main_add_notifier(NC_ANIMATION|ND_MARKERS, NULL);
 }
 
-static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, const char name[])
+static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, const char idname[], const char name[])
 {
-	KeyingSet *ks= NULL;
+	KeyingSet *ks = NULL;
 
 	/* call the API func, and set the active keyingset index */
-	ks= BKE_keyingset_add(&sce->keyingsets, name, KEYINGSET_ABSOLUTE, 0);
+	ks = BKE_keyingset_add(&sce->keyingsets, idname, name, KEYINGSET_ABSOLUTE, 0);
 	
 	if (ks) {
-		sce->active_keyingset= BLI_countlist(&sce->keyingsets);
+		sce->active_keyingset = BLI_countlist(&sce->keyingsets);
 		return ks;
 	}
 	else {
@@ -1337,7 +1369,7 @@ static void rna_UnifiedPaintSettings_size_set(PointerRNA *ptr, int value)
 	/* scale unprojected radius so it stays consistent with brush size */
 	brush_scale_unprojected_radius(&ups->unprojected_radius,
 								   value, ups->size);
-	ups->size= value;
+	ups->size = value;
 }
 
 static void rna_UnifiedPaintSettings_unprojected_radius_set(PointerRNA *ptr, float value)
@@ -1346,7 +1378,7 @@ static void rna_UnifiedPaintSettings_unprojected_radius_set(PointerRNA *ptr, flo
 
 	/* scale brush size so it stays consistent with unprojected_radius */
 	brush_scale_size(&ups->size, value, ups->unprojected_radius);
-	ups->unprojected_radius= value;
+	ups->unprojected_radius = value;
 }
 
 /* note: without this, when Multi-Paint is activated/deactivated, the colors
@@ -1356,8 +1388,8 @@ static void rna_UnifiedPaintSettings_unprojected_radius_set(PointerRNA *ptr, flo
  * given its own notifier. */
 static void rna_Scene_update_active_object_data(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
 {
-	Object *ob= OBACT;
-	if(ob) {
+	Object *ob = OBACT;
+	if (ob) {
 		DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 		WM_main_add_notifier(NC_OBJECT|ND_DRAW, &ob->id);
 	}
@@ -1365,10 +1397,10 @@ static void rna_Scene_update_active_object_data(Main *UNUSED(bmain), Scene *scen
 
 static void rna_SceneCamera_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	Scene *scene= (Scene*)ptr->id.data;
-	Object *camera= scene->camera;
+	Scene *scene = (Scene*)ptr->id.data;
+	Object *camera = scene->camera;
 
-	if(camera)
+	if (camera)
 		DAG_id_tag_update(&camera->id, 0);
 }
 
@@ -1379,16 +1411,16 @@ static void rna_def_transform_orientation(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	const int matrix_dimsize[]= {3, 3};
+	const int matrix_dimsize[] = {3, 3};
 	
-	srna= RNA_def_struct(brna, "TransformOrientation", NULL);
+	srna = RNA_def_struct(brna, "TransformOrientation", NULL);
 	
-	prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
+	prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
 	RNA_def_property_float_sdna(prop, NULL, "mat");
 	RNA_def_property_multi_array(prop, 2, matrix_dimsize);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 	
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_struct_name_property(srna, prop);
 	RNA_def_property_ui_text(prop, "Name", "Name of the custom transform orientation");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
@@ -1406,8 +1438,8 @@ static void rna_def_tool_settings(BlenderRNA  *brna)
 		{UV_SELECT_ISLAND, "ISLAND", ICON_UV_ISLANDSEL, "Island", "Island selection mode"},
 		{0, NULL, 0, NULL, NULL}};
 	
-	/* the construction of this enum is quite special - everything is stored as bitflags, 
-	 * with 1st position only for for on/off (and exposed as boolean), while others are mutually 
+	/* the construction of this enum is quite special - everything is stored as bitflags,
+	 * with 1st position only for for on/off (and exposed as boolean), while others are mutually
 	 * exclusive options but which will only have any effect when autokey is enabled
 	 */
 	static EnumPropertyItem auto_key_items[] = {
@@ -1437,10 +1469,10 @@ static void rna_def_tool_settings(BlenderRNA  *brna)
 		{EDGE_MODE_TAG_BEVEL, "BEVEL", 0, "Tag Bevel", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "ToolSettings", NULL);
+	srna = RNA_def_struct(brna, "ToolSettings", NULL);
 	RNA_def_struct_ui_text(srna, "Tool Settings", "");
 	
-	prop= RNA_def_property(srna, "sculpt", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "sculpt", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Sculpt");
 	RNA_def_property_ui_text(prop, "Sculpt", "");
 	
@@ -1458,124 +1490,130 @@ static void rna_def_tool_settings(BlenderRNA  *brna)
 	                         "weight painting");
 	RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
 
-	prop= RNA_def_property(srna, "vertex_paint", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "vertex_paint", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "vpaint");
 	RNA_def_property_ui_text(prop, "Vertex Paint", "");
 
-	prop= RNA_def_property(srna, "weight_paint", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "weight_paint", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "wpaint");
 	RNA_def_property_ui_text(prop, "Weight Paint", "");
 
-	prop= RNA_def_property(srna, "image_paint", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "image_paint", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "imapaint");
 	RNA_def_property_ui_text(prop, "Image Paint", "");
 
-	prop= RNA_def_property(srna, "uv_sculpt", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "uv_sculpt", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "uvsculpt");
 	RNA_def_property_ui_text(prop, "UV Sculpt", "");
 
-	prop= RNA_def_property(srna, "particle_edit", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "particle_edit", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "particle");
 	RNA_def_property_ui_text(prop, "Particle Edit", "");
 
-	prop= RNA_def_property(srna, "use_uv_sculpt", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_uv_sculpt", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "use_uv_sculpt", 1);
 	RNA_def_property_ui_text(prop, "UV Sculpt", "Enable brush for UV sculpting");
 	RNA_def_property_ui_icon(prop, ICON_TPAINT_HLT, 0);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_SpaceImageEditor_uv_sculpt_update");
 
-	prop= RNA_def_property(srna, "uv_sculpt_lock_borders", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "uv_sculpt_lock_borders", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_LOCK_BORDERS);
 	RNA_def_property_ui_text(prop, "Lock Borders", "Disable editing of boundary edges");
 
-	prop= RNA_def_property(srna, "uv_sculpt_all_islands", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "uv_sculpt_all_islands", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_ALL_ISLANDS);
 	RNA_def_property_ui_text(prop, "Sculpt All Islands", "Brush operates on all islands");
 
-	prop= RNA_def_property(srna, "uv_sculpt_tool", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "uv_sculpt_tool", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "uv_sculpt_tool");
 	RNA_def_property_enum_items(prop, uv_sculpt_tool_items);
 	RNA_def_property_ui_text(prop, "UV Sculpt Tools", "Select Tools for the UV sculpt brushes");
 
-	prop= RNA_def_property(srna, "uv_relax_method", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "uv_relax_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "uv_relax_method");
 	RNA_def_property_enum_items(prop, uv_sculpt_relaxation_items);
 	RNA_def_property_ui_text(prop, "Relaxation Method", "Algorithm used for UV relaxation");
 
 	/* Transform */
-	prop= RNA_def_property(srna, "proportional_edit", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "proportional_edit", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "proportional");
 	RNA_def_property_enum_items(prop, proportional_editing_items);
 	RNA_def_property_ui_text(prop, "Proportional Editing",
 	                         "Proportional Editing mode, allows transforms with distance fall-off");
 	RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */
 
-	prop= RNA_def_property(srna, "use_proportional_edit_objects", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_proportional_edit_objects", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "proportional_objects", 0);
 	RNA_def_property_ui_text(prop, "Proportional Editing Objects", "Proportional editing object mode");
 	RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
 	RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */
 
-	prop= RNA_def_property(srna, "proportional_edit_falloff", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "proportional_edit_falloff", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "prop_mode");
 	RNA_def_property_enum_items(prop, proportional_falloff_items);
 	RNA_def_property_ui_text(prop, "Proportional Editing Falloff", "Falloff type for proportional editing mode");
 	RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */
 
-	prop= RNA_def_property(srna, "proportional_size", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "proportional_size", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "proportional_size");
 	RNA_def_property_ui_text(prop, "Proportional Size", "Display size for proportional editing circle");
 	RNA_def_property_range(prop, 0.00001, 5000.0);
 	
-	prop= RNA_def_property(srna, "normal_size", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "normal_size", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "normalsize");
 	RNA_def_property_ui_text(prop, "Normal Size", "Display size for normals in the 3D view");
 	RNA_def_property_range(prop, 0.00001, 1000.0);
 	RNA_def_property_ui_range(prop, 0.01, 10.0, 10.0, 2);
 	RNA_def_property_update(prop, NC_GEOM|ND_DATA, NULL);
 
-	prop= RNA_def_property(srna, "use_mesh_automerge", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "double_threshold", PROP_FLOAT, PROP_DISTANCE);
+	RNA_def_property_float_sdna(prop, NULL, "doublimit");
+	RNA_def_property_ui_text(prop, "Double Threshold", "Limit for removing duplicates and 'Auto Merge'");
+	RNA_def_property_range(prop, 0.0, 1.0);
+	RNA_def_property_ui_range(prop, 0.0, 0.1, 0.01, 6);
+
+	prop = RNA_def_property(srna, "use_mesh_automerge", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "automerge", 0);
 	RNA_def_property_ui_text(prop, "AutoMerge Editing", "Automatically merge vertices moved to the same location");
 
-	prop= RNA_def_property(srna, "use_snap", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_snap", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP);
 	RNA_def_property_ui_text(prop, "Snap", "Snap during transform");
 	RNA_def_property_ui_icon(prop, ICON_SNAP_OFF, 1);
 	RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */
 
-	prop= RNA_def_property(srna, "use_snap_align_rotation", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_snap_align_rotation", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_ROTATE);
 	RNA_def_property_ui_text(prop, "Snap Align Rotation", "Align rotation with the snapping target");
 	RNA_def_property_ui_icon(prop, ICON_SNAP_NORMAL, 0);
 	RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */
 
-	prop= RNA_def_property(srna, "snap_element", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "snap_element", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "snap_mode");
 	RNA_def_property_enum_items(prop, snap_element_items);
 	RNA_def_property_ui_text(prop, "Snap 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);
+	prop = RNA_def_property(srna, "snap_target", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "snap_target");
 	RNA_def_property_enum_items(prop, snap_target_items);
 	RNA_def_property_ui_text(prop, "Snap Target", "Which part to snap onto the target");
 	RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */
 
-	prop= RNA_def_property(srna, "use_snap_peel_object", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_snap_peel_object", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PEEL_OBJECT);
 	RNA_def_property_ui_text(prop, "Snap Peel Object", "Consider objects as whole when finding volume center");
 	RNA_def_property_ui_icon(prop, ICON_SNAP_PEEL_OBJECT, 0);
 	RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */
 	
-	prop= RNA_def_property(srna, "use_snap_project", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_snap_project", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PROJECT);
 	RNA_def_property_ui_text(prop, "Project Individual Elements",
 	                         "Project individual elements on the surface of other objects");
 	RNA_def_property_ui_icon(prop, ICON_RETOPO, 0);
 	RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */
 
-	prop= RNA_def_property(srna, "use_snap_self", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_snap_self", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "snap_flag", SCE_SNAP_NO_SELF);
 	RNA_def_property_ui_text(prop, "Project to Self", "Snap onto itself (editmode)");
 	RNA_def_property_ui_icon(prop, ICON_ORTHO, 0);
@@ -1584,138 +1622,139 @@ static void rna_def_tool_settings(BlenderRNA  *brna)
 	/* Grease Pencil */
 	prop = RNA_def_property(srna, "use_grease_pencil_sessions", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_PAINTSESSIONS_ON);
-	RNA_def_property_ui_text(prop, "Use Sketching Sessions", "Allow drawing multiple strokes at a time with Grease Pencil");
-	RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); // xxx: need toolbar to be redrawn...
+	RNA_def_property_ui_text(prop, "Use Sketching Sessions",
+	                         "Allow drawing multiple strokes at a time with Grease Pencil");
+	RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* xxx: need toolbar to be redrawn... */
 	
 	/* Auto Keying */
-	prop= RNA_def_property(srna, "use_keyframe_insert_auto", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_keyframe_insert_auto", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "autokey_mode", AUTOKEY_ON);
 	RNA_def_property_ui_text(prop, "Auto Keying", "Automatic keyframe insertion for Objects and Bones");
 	RNA_def_property_ui_icon(prop, ICON_REC, 0);
 	
-	prop= RNA_def_property(srna, "auto_keying_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "auto_keying_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "autokey_mode");
 	RNA_def_property_enum_items(prop, auto_key_items);
 	RNA_def_property_ui_text(prop, "Auto-Keying Mode", "Mode of automatic keyframe insertion for Objects and Bones");
 	
-	prop= RNA_def_property(srna, "use_record_with_nla", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_record_with_nla", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", ANIMRECORD_FLAG_WITHNLA);
 	RNA_def_property_ui_text(prop, "Layered",
 	                         "Add a new NLA Track + Strip for every loop/pass made over the animation "
 	                         "to allow non-destructive tweaking");
 	
-	prop= RNA_def_property(srna, "use_keyframe_insert_keyingset", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_keyframe_insert_keyingset", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_ONLYKEYINGSET);
 	RNA_def_property_ui_text(prop, "Auto Keyframe Insert Keying Set",
 	                         "Automatic keyframe insertion using active Keying Set only");
 	RNA_def_property_ui_icon(prop, ICON_KEYINGSET, 0);
 	
 	/* UV */
-	prop= RNA_def_property(srna, "uv_select_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "uv_select_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "uv_selectmode");
 	RNA_def_property_enum_items(prop, uv_select_mode_items);
 	RNA_def_property_ui_text(prop, "UV Selection Mode", "UV selection and display mode");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
 
-	prop= RNA_def_property(srna, "use_uv_select_sync", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_uv_select_sync", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SYNC_SELECTION);
 	RNA_def_property_ui_text(prop, "UV Sync Selection", "Keep UV and edit mode mesh selection in sync");
 	RNA_def_property_ui_icon(prop, ICON_EDIT, 0);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
 
-	prop= RNA_def_property(srna, "show_uv_local_view", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_uv_local_view", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SHOW_SAME_IMAGE);
 	RNA_def_property_ui_text(prop, "UV Local View", "Draw only faces with the currently displayed image assigned");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
 
 	/* Mesh */
-	prop= RNA_def_property(srna, "mesh_select_mode", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "mesh_select_mode", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "selectmode", 1);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_editmesh_select_mode_set");
 	RNA_def_property_ui_text(prop, "Mesh Selection Mode", "Which mesh elements selection works on");
 	RNA_def_property_update(prop, 0, "rna_Scene_editmesh_select_mode_update");
 
-	prop= RNA_def_property(srna, "vertex_group_weight", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "vertex_group_weight", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "vgroup_weight");
 	RNA_def_property_ui_text(prop, "Vertex Group Weight", "Weight to assign in vertex groups");
 
 	/* use with MESH_OT_select_shortest_path */
-	prop= RNA_def_property(srna, "edge_path_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "edge_path_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "edge_mode");
 	RNA_def_property_enum_items(prop, edge_tag_items);
 	RNA_def_property_ui_text(prop, "Edge Tag Mode", "The edge flag to tag when selecting the shortest path");
 
-	prop= RNA_def_property(srna, "edge_path_live_unwrap", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "edge_path_live_unwrap", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "edge_mode_live_unwrap", 1);
 	RNA_def_property_ui_text(prop, "Live Unwrap", "Changing edges seam re-calculates UV unwrap");
 
 	/* etch-a-ton */
-	prop= RNA_def_property(srna, "use_bone_sketching", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_bone_sketching", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "bone_sketching", BONE_SKETCHING);
 	RNA_def_property_ui_text(prop, "Use Bone Sketching", "DOC BROKEN");
-//	RNA_def_property_ui_icon(prop, ICON_EDIT, 0);
+/*	RNA_def_property_ui_icon(prop, ICON_EDIT, 0); */
 
-	prop= RNA_def_property(srna, "use_etch_quick", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_etch_quick", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "bone_sketching", BONE_SKETCHING_QUICK);
 	RNA_def_property_ui_text(prop, "Quick Sketching", "DOC BROKEN");
 
-	prop= RNA_def_property(srna, "use_etch_overdraw", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_etch_overdraw", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "bone_sketching", BONE_SKETCHING_ADJUST);
 	RNA_def_property_ui_text(prop, "Overdraw Sketching", "DOC BROKEN");
 	
-	prop= RNA_def_property(srna, "use_etch_autoname", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_etch_autoname", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "skgen_retarget_options", SK_RETARGET_AUTONAME);
 	RNA_def_property_ui_text(prop, "Autoname", "DOC BROKEN");
 
-	prop= RNA_def_property(srna, "etch_number", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "etch_number", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "skgen_num_string");
 	RNA_def_property_ui_text(prop, "Number", "DOC BROKEN");
 
-	prop= RNA_def_property(srna, "etch_side", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "etch_side", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "skgen_num_string");
 	RNA_def_property_ui_text(prop, "Side", "DOC BROKEN");
 
-	prop= RNA_def_property(srna, "etch_template", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "etch_template", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "skgen_template");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_Scene_skgen_etch_template_set", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Template", "Template armature that will be retargeted to the stroke");
 
-	prop= RNA_def_property(srna, "etch_subdivision_number", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "etch_subdivision_number", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "skgen_subdivision_number");
 	RNA_def_property_range(prop, 1, 255);
 	RNA_def_property_ui_text(prop, "Subdivisions", "Number of bones in the subdivided stroke");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "etch_adaptive_limit", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "etch_adaptive_limit", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "skgen_correlation_limit");
 	RNA_def_property_range(prop, 0.00001, 1.0);
 	RNA_def_property_ui_range(prop, 0.01, 1.0, 0.01, 2);
 	RNA_def_property_ui_text(prop, "Limit", "Number of bones in the subdivided stroke");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "etch_length_limit", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "etch_length_limit", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "skgen_length_limit");
 	RNA_def_property_range(prop, 0.00001, 100000.0);
 	RNA_def_property_ui_range(prop, 0.001, 100.0, 0.1, 3);
 	RNA_def_property_ui_text(prop, "Length", "Number of bones in the subdivided stroke");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "etch_roll_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "etch_roll_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "skgen_retarget_roll");
 	RNA_def_property_enum_items(prop, retarget_roll_items);
 	RNA_def_property_ui_text(prop, "Retarget roll mode", "Method used to adjust the roll of bones when retargeting");
 	
-	prop= RNA_def_property(srna, "etch_convert_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "etch_convert_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "bone_sketching_convert");
 	RNA_def_property_enum_items(prop, sketch_convert_items);
 	RNA_def_property_ui_text(prop, "Stroke conversion method", "Method used to convert stroke to bones");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
 	/* Unified Paint Settings */
-	prop= RNA_def_property(srna, "unified_paint_settings", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "unified_paint_settings", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "UnifiedPaintSettings");
 	RNA_def_property_ui_text(prop, "Unified Paint Settings", NULL);
@@ -1726,54 +1765,56 @@ static void rna_def_unified_paint_settings(BlenderRNA  *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "UnifiedPaintSettings", NULL);
+	srna = RNA_def_struct(brna, "UnifiedPaintSettings", NULL);
 	RNA_def_struct_ui_text(srna, "Unified Paint Settings", "Overrides for some of the active brush's settings");
 
 	/* high-level flags to enable or disable unified paint settings */
-	prop= RNA_def_property(srna, "use_unified_size", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_unified_size", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_SIZE);
 	RNA_def_property_ui_text(prop, "Use Unified Radius",
 	                         "Instead of per-brush radius, the radius is shared across brushes");
 
-	prop= RNA_def_property(srna, "use_unified_strength", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_unified_strength", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_ALPHA);
 	RNA_def_property_ui_text(prop, "Use Unified Strength",
 	                         "Instead of per-brush strength, the strength is shared across brushes");
 
 	/* unified paint settings that override the equivalent settings
-	   from the active brush */
-	prop= RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE);
+	 * from the active brush */
+	prop = RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE);
 	RNA_def_property_int_funcs(prop, NULL, "rna_UnifiedPaintSettings_size_set", NULL);
 	RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS*10);
 	RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, 0);
 	RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels");
 
-	prop= RNA_def_property(srna, "unprojected_radius", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "unprojected_radius", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_funcs(prop, NULL, "rna_UnifiedPaintSettings_unprojected_radius_set", NULL);
 	RNA_def_property_range(prop, 0.001, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.001, 1, 0, 0);
 	RNA_def_property_ui_text(prop, "Unprojected Radius", "Radius of brush in Blender units");
 
-	prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "alpha");
 	RNA_def_property_float_default(prop, 0.5f);
 	RNA_def_property_range(prop, 0.0f, 10.0f);
-	RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 0.001);
+	RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
 	RNA_def_property_ui_text(prop, "Strength", "How powerful the effect of the brush is when applied");
 
-	prop= RNA_def_property(srna, "use_pressure_size", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pressure_size", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_SIZE_PRESSURE);
 	RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
 	RNA_def_property_ui_text(prop, "Size Pressure", "Enable tablet pressure sensitivity for size");
 
-	prop= RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_ALPHA_PRESSURE);
 	RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
 	RNA_def_property_ui_text(prop, "Strength Pressure", "Enable tablet pressure sensitivity for strength");
 
-	prop= RNA_def_property(srna, "use_locked_size", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_locked_size", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_LOCK_SIZE);
-	RNA_def_property_ui_text(prop, "Use Blender Units", "When locked brush stays same size relative to object; when unlocked brush size is given in pixels");
+	RNA_def_property_ui_text(prop, "Use Blender Units",
+	                         "When locked brush stays same size relative to object; "
+	                         "when unlocked brush size is given in pixels");
 }
 
 static void rna_def_unit_settings(BlenderRNA  *brna)
@@ -1792,29 +1833,29 @@ static void rna_def_unit_settings(BlenderRNA  *brna)
 		{USER_UNIT_ROT_RADIANS, "RADIANS", 0, "Radians", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "UnitSettings", NULL);
+	srna = RNA_def_struct(brna, "UnitSettings", NULL);
 	RNA_def_struct_ui_text(srna, "Unit Settings", "");
 
 	/* Units */
-	prop= RNA_def_property(srna, "system", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "system", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, unit_systems);
 	RNA_def_property_ui_text(prop, "Unit System", "The unit system to use for button display");
 	RNA_def_property_update(prop, NC_WINDOW, NULL);
 	
-	prop= RNA_def_property(srna, "system_rotation", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "system_rotation", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, rotation_units);
 	RNA_def_property_ui_text(prop, "Rotation Units", "Unit to use for displaying/editing rotation values");
 	RNA_def_property_update(prop, NC_WINDOW, NULL);
 
-	prop= RNA_def_property(srna, "scale_length", PROP_FLOAT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "scale_length", PROP_FLOAT, PROP_UNSIGNED);
 	RNA_def_property_ui_text(prop, "Unit Scale", "Scale to use when converting between blender units and dimensions");
 	RNA_def_property_range(prop, 0.00001, 100000.0);
 	RNA_def_property_ui_range(prop, 0.001, 100.0, 0.1, 3);
 	RNA_def_property_update(prop, NC_WINDOW, NULL);
 
-	prop= RNA_def_property(srna, "use_separate", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_separate", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_UNIT_OPT_SPLIT);
-	RNA_def_property_ui_text(prop, "Separate Units", "Display units in pairs");
+	RNA_def_property_ui_text(prop, "Separate Units", "Display units in pairs (e.g. 1m 0cm)");
 	RNA_def_property_update(prop, NC_WINDOW, NULL);
 }
 
@@ -1822,325 +1863,327 @@ void rna_def_render_layer_common(StructRNA *srna, int scene)
 {
 	PropertyRNA *prop;
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
-	if(scene) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneRenderLayer_name_set");
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	if (scene) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneRenderLayer_name_set");
 	else RNA_def_property_string_sdna(prop, NULL, "name");
 	RNA_def_property_ui_text(prop, "Name", "Render layer name");
 	RNA_def_struct_name_property(srna, prop);
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "material_override", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "material_override", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "mat_override");
 	RNA_def_property_struct_type(prop, "Material");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "Material Override", "Material to override all other materials in this render layer");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	RNA_def_property_ui_text(prop, "Material Override",
+	                         "Material to override all other materials in this render layer");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "light_override", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "light_override", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "light_override");
 	RNA_def_property_struct_type(prop, "Group");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Light Override", "Group to override all other lights in this render layer");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
 	/* layers */
-	prop= RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
+	prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
 	RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
 	RNA_def_property_array(prop, 20);
 	RNA_def_property_ui_text(prop, "Visible Layers", "Scene layers included in this render layer");
-	if(scene) RNA_def_property_boolean_funcs(prop, NULL, "rna_SceneRenderLayer_layer_set");
+	if (scene) RNA_def_property_boolean_funcs(prop, NULL, "rna_SceneRenderLayer_layer_set");
 	else RNA_def_property_boolean_funcs(prop, NULL, "rna_RenderLayer_layer_set");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "layers_zmask", PROP_BOOLEAN, PROP_LAYER);
+	prop = RNA_def_property(srna, "layers_zmask", PROP_BOOLEAN, PROP_LAYER);
 	RNA_def_property_boolean_sdna(prop, NULL, "lay_zmask", 1);
 	RNA_def_property_array(prop, 20);
 	RNA_def_property_ui_text(prop, "Zmask Layers", "Zmask scene layers for solid faces");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
 	/* layer options */
-	prop= RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "layflag", SCE_LAY_DISABLE);
 	RNA_def_property_ui_text(prop, "Enabled", "Disable or enable the render layer");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_zmask", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_zmask", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZMASK);
 	RNA_def_property_ui_text(prop, "Zmask", "Only render what's in front of the solid z values");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "invert_zmask", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_zmask", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_NEG_ZMASK);
-	RNA_def_property_ui_text(prop, "Zmask Negate", "For Zmask, only render what is behind solid z values instead of in front");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+	RNA_def_property_ui_text(prop, "Zmask Negate",
+	                         "For Zmask, only render what is behind solid z values instead of in front");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_all_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_all_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ALL_Z);
 	RNA_def_property_ui_text(prop, "All Z", "Fill in Z values for solid faces in invisible layers, for masking");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_solid", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_solid", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_SOLID);
 	RNA_def_property_ui_text(prop, "Solid", "Render Solid faces in this Layer");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_halo", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_halo", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_HALO);
 	RNA_def_property_ui_text(prop, "Halo", "Render Halos in this Layer (on top of Solid)");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_ztransp", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_ztransp", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZTRA);
 	RNA_def_property_ui_text(prop, "ZTransp", "Render Z-Transparent faces in this Layer (on top of Solid and Halos)");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_sky", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_sky", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_SKY);
 	RNA_def_property_ui_text(prop, "Sky", "Render Sky in this Layer");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_edge_enhance", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_edge_enhance", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_EDGE);
 	RNA_def_property_ui_text(prop, "Edge", "Render Edge-enhance in this Layer (only works for Solid faces)");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_strand", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_strand", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_STRAND);
 	RNA_def_property_ui_text(prop, "Strand", "Render Strands in this Layer");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
 	/* passes */
-	prop= RNA_def_property(srna, "use_pass_combined", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_combined", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_COMBINED);
 	RNA_def_property_ui_text(prop, "Combined", "Deliver full combined RGBA buffer");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_pass_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_Z);
 	RNA_def_property_ui_text(prop, "Z", "Deliver Z values pass");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	
-	prop= RNA_def_property(srna, "use_pass_vector", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_vector", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_VECTOR);
 	RNA_def_property_ui_text(prop, "Vector", "Deliver speed vector pass");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_pass_normal", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_normal", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_NORMAL);
 	RNA_def_property_ui_text(prop, "Normal", "Deliver normal pass");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_pass_uv", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_uv", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_UV);
 	RNA_def_property_ui_text(prop, "UV", "Deliver texture UV pass");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_pass_mist", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_mist", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_MIST);
 	RNA_def_property_ui_text(prop, "Mist", "Deliver mist factor pass (0.0-1.0)");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_pass_object_index", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_object_index", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXOB);
 	RNA_def_property_ui_text(prop, "Object Index", "Deliver object index pass");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_pass_material_index", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_material_index", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXMA);
 	RNA_def_property_ui_text(prop, "Material Index", "Deliver material index pass");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_pass_color", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_color", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_RGBA);
 	RNA_def_property_ui_text(prop, "Color", "Deliver shade-less color pass");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_pass_diffuse", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_diffuse", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE);
 	RNA_def_property_ui_text(prop, "Diffuse", "Deliver diffuse pass");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_pass_specular", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_specular", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SPEC);
 	RNA_def_property_ui_text(prop, "Specular", "Deliver specular pass");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_pass_shadow", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_shadow", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SHADOW);
 	RNA_def_property_ui_text(prop, "Shadow", "Deliver shadow pass");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_pass_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_AO);
 	RNA_def_property_ui_text(prop, "AO", "Deliver AO pass");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	
-	prop= RNA_def_property(srna, "use_pass_reflection", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_reflection", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_REFLECT);
 	RNA_def_property_ui_text(prop, "Reflection", "Deliver raytraced reflection pass");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_pass_refraction", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_refraction", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_REFRACT);
 	RNA_def_property_ui_text(prop, "Refraction", "Deliver raytraced refraction pass");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_pass_emit", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_emit", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_EMIT);
 	RNA_def_property_ui_text(prop, "Emit", "Deliver emission pass");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_pass_environment", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_environment", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_ENVIRONMENT);
 	RNA_def_property_ui_text(prop, "Environment", "Deliver environment lighting pass");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_pass_indirect", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_indirect", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDIRECT);
 	RNA_def_property_ui_text(prop, "Indirect", "Deliver indirect lighting pass");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "exclude_specular", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "exclude_specular", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_SPEC);
 	RNA_def_property_ui_text(prop, "Specular Exclude", "Exclude specular pass from combined");
 	RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "exclude_shadow", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "exclude_shadow", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_SHADOW);
 	RNA_def_property_ui_text(prop, "Shadow Exclude", "Exclude shadow pass from combined");
 	RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "exclude_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "exclude_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_AO);
 	RNA_def_property_ui_text(prop, "AO Exclude", "Exclude AO pass from combined");
 	RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	
-	prop= RNA_def_property(srna, "exclude_reflection", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "exclude_reflection", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_REFLECT);
 	RNA_def_property_ui_text(prop, "Reflection Exclude", "Exclude raytraced reflection pass from combined");
 	RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "exclude_refraction", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "exclude_refraction", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_REFRACT);
 	RNA_def_property_ui_text(prop, "Refraction Exclude", "Exclude raytraced refraction pass from combined");
 	RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "exclude_emit", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "exclude_emit", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_EMIT);
 	RNA_def_property_ui_text(prop, "Emit Exclude", "Exclude emission pass from combined");
 	RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "exclude_environment", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "exclude_environment", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_ENVIRONMENT);
 	RNA_def_property_ui_text(prop, "Environment Exclude", "Exclude environment pass from combined");
 	RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "exclude_indirect", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "exclude_indirect", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_INDIRECT);
 	RNA_def_property_ui_text(prop, "Indirect Exclude", "Exclude indirect pass from combined");
 	RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_pass_diffuse_direct", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_diffuse_direct", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_DIRECT);
 	RNA_def_property_ui_text(prop, "Diffuse Direct", "Deliver diffuse direct pass");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_pass_diffuse_indirect", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_diffuse_indirect", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_INDIRECT);
 	RNA_def_property_ui_text(prop, "Diffuse Indirect", "Deliver diffuse indirect pass");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_pass_diffuse_color", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_diffuse_color", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_COLOR);
 	RNA_def_property_ui_text(prop, "Diffuse Color", "Deliver diffuse color pass");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_pass_glossy_direct", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_glossy_direct", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_DIRECT);
 	RNA_def_property_ui_text(prop, "Glossy Direct", "Deliver glossy direct pass");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_pass_glossy_indirect", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_glossy_indirect", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_INDIRECT);
 	RNA_def_property_ui_text(prop, "Glossy Indirect", "Deliver glossy indirect pass");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_pass_glossy_color", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_glossy_color", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_COLOR);
 	RNA_def_property_ui_text(prop, "Glossy Color", "Deliver glossy color pass");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_pass_transmission_direct", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_transmission_direct", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_DIRECT);
 	RNA_def_property_ui_text(prop, "Transmission Direct", "Deliver transmission direct pass");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_pass_transmission_indirect", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_transmission_indirect", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_INDIRECT);
 	RNA_def_property_ui_text(prop, "Transmission Indirect", "Deliver transmission indirect pass");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "use_pass_transmission_color", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pass_transmission_color", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_COLOR);
 	RNA_def_property_ui_text(prop, "Transmission Color", "Deliver transmission color pass");
-	if(scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+	if (scene) RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
 	else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 }
 
@@ -2149,85 +2192,85 @@ static void rna_def_scene_game_recast_data(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "SceneGameRecastData", NULL);
+	srna = RNA_def_struct(brna, "SceneGameRecastData", NULL);
 	RNA_def_struct_sdna(srna, "RecastData");
 	RNA_def_struct_nested(brna, srna, "Scene");
 	RNA_def_struct_ui_text(srna, "Recast Data", "Recast data for a Game datablock");
 
-	prop= RNA_def_property(srna, "cell_size", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "cell_size", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "cellsize");
 	RNA_def_property_ui_range(prop, 0.1, 1, 1, 2);
 	RNA_def_property_ui_text(prop, "Cell Size", "Rasterized cell size");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "cell_height", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "cell_height", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "cellheight");
 	RNA_def_property_ui_range(prop, 0.1, 1, 1, 2);
 	RNA_def_property_ui_text(prop, "Cell Height", "Rasterized cell height");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "agent_height", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "agent_height", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "agentheight");
 	RNA_def_property_ui_range(prop, 0.1, 5, 1, 2);
 	RNA_def_property_ui_text(prop, "Agent Height", "Minimum height where the agent can still walk");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "agent_radius", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "agent_radius", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "agentradius");
 	RNA_def_property_ui_range(prop, 0.1, 5, 1, 2);
 	RNA_def_property_ui_text(prop, "Agent Radius", "Radius of the agent");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "climb_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "climb_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "agentmaxclimb");
 	RNA_def_property_ui_range(prop, 0.1, 5, 1, 2);
 	RNA_def_property_ui_text(prop, "Max Climb", "Maximum height between grid cells the agent can climb");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "slope_max", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "slope_max", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_sdna(prop, NULL, "agentmaxslope");
 	RNA_def_property_range(prop, 0, M_PI/2);
 	RNA_def_property_ui_text(prop, "Max Slope", "Maximum walkable slope angle in degrees");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
 
-	prop= RNA_def_property(srna, "region_min_size", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "region_min_size", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "regionminsize");
 	RNA_def_property_ui_range(prop, 0, 150, 1, 2);
 	RNA_def_property_ui_text(prop, "Min Region Size", "Minimum regions size (smaller regions will be deleted)");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "region_merge_size", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "region_merge_size", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "regionmergesize");
 	RNA_def_property_ui_range(prop, 0, 150, 1, 2);
 	RNA_def_property_ui_text(prop, "Merged Region Size", "Minimum regions size (smaller regions will be merged)");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "edge_max_len", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "edge_max_len", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "edgemaxlen");
 	RNA_def_property_ui_range(prop, 0, 50, 1, 2);
 	RNA_def_property_ui_text(prop, "Max Edge Length", "Maximum contour edge length");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "edge_max_error", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "edge_max_error", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "edgemaxerror");
 	RNA_def_property_ui_range(prop, 0.1, 3.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Max Edge Error", "Maximum distance error from contour to cells");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "verts_per_poly", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "verts_per_poly", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "vertsperpoly");
 	RNA_def_property_ui_range(prop, 3, 12, 1, 0);
 	RNA_def_property_ui_text(prop, "Verts Per Poly", "Max number of vertices per polygon");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "sample_dist", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "sample_dist", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "detailsampledist");
 	RNA_def_property_ui_range(prop, 0.0, 16.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Sample Distance", "Detail mesh sample spacing");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "sample_max_error", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "sample_max_error", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "detailsamplemaxerror");
 	RNA_def_property_ui_range(prop, 0.0, 16.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Max Sample Error", "Detail mesh simplification max sample error");
@@ -2239,7 +2282,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static EnumPropertyItem aasamples_items[]  ={
+	static EnumPropertyItem aasamples_items[]  = {
 		{0, "SAMPLES_0", 0, "Off", ""},
 		{2, "SAMPLES_2", 0, "2x", ""},
 		{4, "SAMPLES_4", 0, "4x", ""},
@@ -2247,15 +2290,16 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
 		{16, "SAMPLES_16", 0, "16x", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	static EnumPropertyItem framing_types_items[] ={
+	static EnumPropertyItem framing_types_items[] = {
 		{SCE_GAMEFRAMING_BARS, "LETTERBOX", 0, "Letterbox",
 		                       "Show the entire viewport in the display window, using bar horizontally or vertically"},
 		{SCE_GAMEFRAMING_EXTEND, "EXTEND", 0, "Extend",
-		                         "Show the entire viewport in the display window, viewing more horizontally or vertically"},
+		                         "Show the entire viewport in the display window, viewing more horizontally "
+		                         "or vertically"},
 		{SCE_GAMEFRAMING_SCALE, "SCALE", 0, "Scale", "Stretch or squeeze the viewport to fill the display window"},
 		{0, NULL, 0, NULL, NULL}};
 
-	static EnumPropertyItem dome_modes_items[] ={
+	static EnumPropertyItem dome_modes_items[] = {
 		{DOME_FISHEYE, "FISHEYE", 0, "Fisheye", ""},
 		{DOME_TRUNCATED_FRONT, "TRUNCATED_FRONT", 0, "Front-Truncated", ""},
 		{DOME_TRUNCATED_REAR, "TRUNCATED_REAR", 0, "Rear-Truncated", ""},
@@ -2263,7 +2307,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
 		{DOME_PANORAM_SPH, "PANORAM_SPH", 0, "Spherical Panoramic", ""},
 		{0, NULL, 0, NULL, NULL}};
 		
-	 static EnumPropertyItem stereo_modes_items[] ={
+	 static EnumPropertyItem stereo_modes_items[] = {
 		{STEREO_QUADBUFFERED, "QUADBUFFERED", 0, "Quad-Buffer", ""},
 		{STEREO_ABOVEBELOW, "ABOVEBELOW", 0, "Above-Below", ""},
 		{STEREO_INTERLACED, "INTERLACED", 0, "Interlaced", ""},
@@ -2272,7 +2316,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
 		{STEREO_VINTERLACE, "VINTERLACE", 0, "Vinterlace", ""},
 		{0, NULL, 0, NULL, NULL}};
 		
-	 static EnumPropertyItem stereo_items[] ={
+	 static EnumPropertyItem stereo_items[] = {
 		{STEREO_NOSTEREO, "NONE", 0, "None", "Disable Stereo and Dome environments"},
 		{STEREO_ENABLED, "STEREO", 0, "Stereo", "Enable Stereo environment"},
 		{STEREO_DOME, "DOME", 0, "Dome", "Enable Dome environment"},
@@ -2280,14 +2324,14 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
 
 	static EnumPropertyItem physics_engine_items[] = {
 		{WOPHY_NONE, "NONE", 0, "None", "Don't use a physics engine"},
-		//{WOPHY_ENJI, "ENJI", 0, "Enji", ""},
-		//{WOPHY_SUMO, "SUMO", 0, "Sumo (Deprecated)", ""},
-		//{WOPHY_DYNAMO, "DYNAMO", 0, "Dynamo", ""},
-		//{WOPHY_ODE, "ODE", 0, "ODE", ""},
+		/*{WOPHY_ENJI, "ENJI", 0, "Enji", ""}, */
+		/*{WOPHY_SUMO, "SUMO", 0, "Sumo (Deprecated)", ""}, */
+		/*{WOPHY_DYNAMO, "DYNAMO", 0, "Dynamo", ""}, */
+		/*{WOPHY_ODE, "ODE", 0, "ODE", ""}, */
 		{WOPHY_BULLET, "BULLET", 0, "Bullet", "Use the Bullet physics engine"},
 		{0, NULL, 0, NULL, NULL}};
 
-	static EnumPropertyItem material_items[] ={
+	static EnumPropertyItem material_items[] = {
 		{GAME_MAT_TEXFACE, "SINGLETEXTURE", 0, "Singletexture", "Singletexture face materials"},
 		{GAME_MAT_MULTITEX, "MULTITEXTURE", 0, "Multitexture", "Multitexture materials"},
 		{GAME_MAT_GLSL, "GLSL", 0, "GLSL", "OpenGL shading language shaders"},
@@ -2299,66 +2343,66 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
 		{OBSTSIMULATION_TOI_cells, "RVO_CELLS", 0, "RVO (cells)", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "SceneGameData", NULL);
+	srna = RNA_def_struct(brna, "SceneGameData", NULL);
 	RNA_def_struct_sdna(srna, "GameData");
 	RNA_def_struct_nested(brna, srna, "Scene");
 	RNA_def_struct_ui_text(srna, "Game Data", "Game data for a Scene datablock");
 	
-	prop= RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "xplay");
 	RNA_def_property_range(prop, 4, 10000);
 	RNA_def_property_ui_text(prop, "Resolution X", "Number of horizontal pixels in the screen");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 	
-	prop= RNA_def_property(srna, "resolution_y", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "resolution_y", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "yplay");
 	RNA_def_property_range(prop, 4, 10000);
 	RNA_def_property_ui_text(prop, "Resolution Y", "Number of vertical pixels in the screen");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 	
-	prop= RNA_def_property(srna, "samples", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "samples", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "aasamples");
 	RNA_def_property_enum_items(prop, aasamples_items);
 	RNA_def_property_ui_text(prop, "AA Samples", "The number of AA Samples to use for MSAA");
 	
-	prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "depth");
 	RNA_def_property_range(prop, 8, 32);
 	RNA_def_property_ui_text(prop, "Bits", "Display bit depth of full screen display");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "exit_key", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "exit_key", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "exitkey");
 	RNA_def_property_enum_items(prop, event_type_items);
 	RNA_def_property_enum_funcs(prop, NULL, "rna_GameSettings_exit_key_set", NULL);
 	RNA_def_property_ui_text(prop, "Exit Key",  "The key that exits the Game Engine");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 	
-	// Do we need it here ? (since we already have it in World
-	prop= RNA_def_property(srna, "frequency", PROP_INT, PROP_NONE);
+	/* Do we need it here ? (since we already have it in World */
+	prop = RNA_def_property(srna, "frequency", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "freqplay");
 	RNA_def_property_range(prop, 4, 2000);
 	RNA_def_property_ui_text(prop, "Freq", "Display clock frequency of fullscreen display");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 	
-	prop= RNA_def_property(srna, "show_fullscreen", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_fullscreen", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "playerflag", GAME_PLAYER_FULLSCREEN);
 	RNA_def_property_ui_text(prop, "Fullscreen", "Start player in a new fullscreen display");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "use_desktop", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_desktop", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "playerflag", GAME_PLAYER_DESKTOP_RESOLUTION);
 	RNA_def_property_ui_text(prop, "Desktop", "Uses the current desktop resultion in fullscreen mode");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
 	/* Framing */
-	prop= RNA_def_property(srna, "frame_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "framing.type");
 	RNA_def_property_enum_items(prop, framing_types_items);
 	RNA_def_property_ui_text(prop, "Framing Types", "Select the type of Framing you want");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "frame_color", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "frame_color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "framing.col");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_array(prop, 3);
@@ -2366,19 +2410,19 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 	
 	/* Stereo */
-	prop= RNA_def_property(srna, "stereo", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "stereo", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "stereoflag");
 	RNA_def_property_enum_items(prop, stereo_items);
 	RNA_def_property_ui_text(prop, "Stereo Options", "");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "stereo_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "stereo_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "stereomode");
 	RNA_def_property_enum_items(prop, stereo_modes_items);
 	RNA_def_property_ui_text(prop, "Stereo Mode", "Stereographic techniques");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "stereo_eye_separation", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "stereo_eye_separation", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "eyeseparation");
 	RNA_def_property_range(prop, 0.01, 5.0);
 	RNA_def_property_ui_text(prop, "Eye Separation",
@@ -2386,37 +2430,37 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 	
 	/* Dome */
-	prop= RNA_def_property(srna, "dome_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "dome_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "dome.mode");
 	RNA_def_property_enum_items(prop, dome_modes_items);
 	RNA_def_property_ui_text(prop, "Dome Mode", "Dome physical configurations");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 	
-	prop= RNA_def_property(srna, "dome_tesselation", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "dome_tessellation", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "dome.res");
 	RNA_def_property_ui_range(prop, 1, 8, 1, 1);
 	RNA_def_property_ui_text(prop, "Tessellation", "Tessellation level - check the generated mesh in wireframe mode");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 	
-	prop= RNA_def_property(srna, "dome_buffer_resolution", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "dome_buffer_resolution", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "dome.resbuf");
-	RNA_def_property_ui_range(prop, 0.1, 1.0, 0.1, 0.1);
+	RNA_def_property_ui_range(prop, 0.1, 1.0, 0.1, 2);
 	RNA_def_property_ui_text(prop, "Buffer Resolution", "Buffer Resolution - decrease it to increase speed");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 	
-	prop= RNA_def_property(srna, "dome_angle", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "dome_angle", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "dome.angle");
 	RNA_def_property_ui_range(prop, 90, 250, 1, 1);
 	RNA_def_property_ui_text(prop, "Angle", "Field of View of the Dome - it only works in mode Fisheye and Truncated");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 	
-	prop= RNA_def_property(srna, "dome_tilt", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "dome_tilt", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "dome.tilt");
 	RNA_def_property_ui_range(prop, -180, 180, 1, 1);
 	RNA_def_property_ui_text(prop, "Tilt", "Camera rotation in horizontal axis");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 	
-	prop= RNA_def_property(srna, "dome_text", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "dome_text", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "dome.warptext");
 	RNA_def_property_struct_type(prop, "Text");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
@@ -2424,27 +2468,28 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 	
 	/* physics */
-	prop= RNA_def_property(srna, "physics_engine", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "physics_engine", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "physicsEngine");
 	RNA_def_property_enum_items(prop, physics_engine_items);
 	RNA_def_property_ui_text(prop, "Physics Engine", "Physics engine used for physics simulation in the game engine");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "physics_gravity", PROP_FLOAT, PROP_ACCELERATION);
+	prop = RNA_def_property(srna, "physics_gravity", PROP_FLOAT, PROP_ACCELERATION);
 	RNA_def_property_float_sdna(prop, NULL, "gravity");
 	RNA_def_property_ui_range(prop, 0.0, 25.0, 1, 2);
 	RNA_def_property_range(prop, 0.0, 10000.0);
-	RNA_def_property_ui_text(prop, "Physics Gravity", "Gravitational constant used for physics simulation in the game engine");
+	RNA_def_property_ui_text(prop, "Physics Gravity",
+	                         "Gravitational constant used for physics simulation in the game engine");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "occlusion_culling_resolution", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "occlusion_culling_resolution", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "occlusionRes");
 	RNA_def_property_range(prop, 128.0, 1024.0);
 	RNA_def_property_ui_text(prop, "Occlusion Resolution",
 	                         "Size of the occlusion buffer in pixel, use higher value for better precision (slower)");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "fps", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "fps", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "ticrate");
 	RNA_def_property_ui_range(prop, 1, 60, 1, 1);
 	RNA_def_property_range(prop, 1, 250);
@@ -2453,7 +2498,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
 	                         "(physics fixed timestep = 1/fps, independently of actual frame rate)");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "logic_step_max", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "logic_step_max", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "maxlogicstep");
 	RNA_def_property_ui_range(prop, 1, 5, 1, 1);
 	RNA_def_property_range(prop, 1, 5);
@@ -2462,7 +2507,7 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
 	                         "higher value allows better synchronization with physics");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "physics_step_max", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "physics_step_max", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "maxphystep");
 	RNA_def_property_ui_range(prop, 1, 5, 1, 1);
 	RNA_def_property_range(prop, 1, 5);
@@ -2471,138 +2516,146 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
 	                         "higher value allows physics to keep up with realtime");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "physics_step_sub", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "physics_step_sub", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "physubstep");
+	RNA_def_property_range(prop, 1, 50);
 	RNA_def_property_ui_range(prop, 1, 5, 1, 1);
-	RNA_def_property_range(prop, 1, 5);
 	RNA_def_property_ui_text(prop, "Physics Sub Steps",
 	                         "Number of simulation substep per physic timestep, "
 	                         "higher value give better physics precision");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
 	/* mode */
-	prop= RNA_def_property(srna, "use_occlusion_culling", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "mode", (1 << 5)); //XXX mode hardcoded // WO_DBVT_CULLING
-	RNA_def_property_ui_text(prop, "DBVT culling", "Use optimized Bullet DBVT tree for view frustum and occlusion culling");
-	
-	// not used // deprecated !!!!!!!!!!!!!
-	prop= RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "mode", (1 << 3)); //XXX mode hardcoded
+	prop = RNA_def_property(srna, "use_occlusion_culling", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "mode", (1 << 5)); /*XXX mode hardcoded  *//* WO_DBVT_CULLING */
+	RNA_def_property_ui_text(prop, "DBVT culling",
+	                         "Use optimized Bullet DBVT tree for view frustum and occlusion culling");
+	
+	/* not used  *//* deprecated !!!!!!!!!!!!! */
+	prop = RNA_def_property(srna, "use_activity_culling", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "mode", (1 << 3)); /*XXX mode hardcoded */
 	RNA_def_property_ui_text(prop, "Activity Culling", "Activity culling is enabled");
 
-	// not used // deprecated !!!!!!!!!!!!!
-	prop= RNA_def_property(srna, "activity_culling_box_radius", PROP_FLOAT, PROP_NONE);
+	/* not used  *//* deprecated !!!!!!!!!!!!! */
+	prop = RNA_def_property(srna, "activity_culling_box_radius", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "activityBoxRadius");
 	RNA_def_property_range(prop, 0.0, 1000.0);
-	RNA_def_property_ui_text(prop, "box radius",
+	RNA_def_property_ui_text(prop, "Box Radius",
 	                         "Radius of the activity bubble, in Manhattan length "
 	                         "(objects outside the box are activity-culled)");
 
 	/* booleans */
-	prop= RNA_def_property(srna, "show_debug_properties", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_debug_properties", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_DEBUG_PROPS);
-	RNA_def_property_ui_text(prop, "Show Debug Properties", "Show properties marked for debugging while the game runs");
+	RNA_def_property_ui_text(prop, "Show Debug Properties",
+	                         "Show properties marked for debugging while the game runs");
 
-	prop= RNA_def_property(srna, "show_framerate_profile", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_framerate_profile", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_FRAMERATE);
 	RNA_def_property_ui_text(prop, "Show Framerate and Profile",
 	                         "Show framerate and profiling information while the game runs");
 
-	prop= RNA_def_property(srna, "show_physics_visualization", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_physics_visualization", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_PHYSICS);
-	RNA_def_property_ui_text(prop, "Show Physics Visualization", "Show a visualization of physics bounds and interactions");
+	RNA_def_property_ui_text(prop, "Show Physics Visualization",
+	                         "Show a visualization of physics bounds and interactions");
 
-	prop= RNA_def_property(srna, "show_mouse", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_mouse", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_MOUSE);
 	RNA_def_property_ui_text(prop, "Show Mouse", "Start player with a visible mouse cursor");
 
-	prop= RNA_def_property(srna, "use_frame_rate", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_frame_rate", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_ENABLE_ALL_FRAMES);
-	RNA_def_property_ui_text(prop, "Use Frame Rate", "Respect the frame rate rather than rendering as many frames as possible");
+	RNA_def_property_ui_text(prop, "Use Frame Rate",
+	                         "Respect the frame rate rather than rendering as many frames as possible");
 
-	prop= RNA_def_property(srna, "use_display_lists", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_display_lists", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_DISPLAY_LISTS);
-	RNA_def_property_ui_text(prop, "Display Lists", "Use display lists to speed up rendering by keeping geometry on the GPU");
+	RNA_def_property_ui_text(prop, "Display Lists",
+	                         "Use display lists to speed up rendering by keeping geometry on the GPU");
 
-	prop= RNA_def_property(srna, "use_deprecation_warnings", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_deprecation_warnings", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_IGNORE_DEPRECATION_WARNINGS);
-	RNA_def_property_ui_text(prop, "Deprecation Warnings", "Print warnings when using deprecated features in the python API");
+	RNA_def_property_ui_text(prop, "Deprecation Warnings",
+	                         "Print warnings when using deprecated features in the python API");
 
-	prop= RNA_def_property(srna, "use_animation_record", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_animation_record", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_ENABLE_ANIMATION_RECORD);
 	RNA_def_property_ui_text(prop, "Record Animation", "Record animation to F-Curves");
 
-	prop= RNA_def_property(srna, "use_auto_start", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_auto_start", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_GameSettings_auto_start_get", "rna_GameSettings_auto_start_set");
 	RNA_def_property_ui_text(prop, "Auto Start", "Automatically start game at load time");
 
-	prop= RNA_def_property(srna, "restrict_animation_updates", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "restrict_animation_updates", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_RESTRICT_ANIM_UPDATES);
 	RNA_def_property_ui_text(prop, "Restrict Animation Updates",
 	                         "Restrict the number of animation updates to the animation FPS (this is "
 	                         "better for performance, but can cause issues with smooth playback)");
 	
 	/* materials */
-	prop= RNA_def_property(srna, "material_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "material_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "matmode");
 	RNA_def_property_enum_items(prop, material_items);
 	RNA_def_property_ui_text(prop, "Material Mode", "Material mode to use for rendering");
 	RNA_def_property_update(prop, NC_SCENE|NA_EDITED, NULL);
 
-	prop= RNA_def_property(srna, "use_glsl_lights", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_glsl_lights", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_LIGHTS);
 	RNA_def_property_ui_text(prop, "GLSL Lights", "Use lights for GLSL rendering");
 	RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_glsl_update");
 
-	prop= RNA_def_property(srna, "use_glsl_shaders", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_glsl_shaders", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_SHADERS);
 	RNA_def_property_ui_text(prop, "GLSL Shaders", "Use shaders for GLSL rendering");
 	RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_glsl_update");
 
-	prop= RNA_def_property(srna, "use_glsl_shadows", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_glsl_shadows", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_SHADOWS);
 	RNA_def_property_ui_text(prop, "GLSL Shadows", "Use shadows for GLSL rendering");
 	RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_glsl_update");
 
-	prop= RNA_def_property(srna, "use_glsl_ramps", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_glsl_ramps", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_RAMPS);
 	RNA_def_property_ui_text(prop, "GLSL Ramps", "Use ramps for GLSL rendering");
 	RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_glsl_update");
 
-	prop= RNA_def_property(srna, "use_glsl_nodes", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_glsl_nodes", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_NODES);
 	RNA_def_property_ui_text(prop, "GLSL Nodes", "Use nodes for GLSL rendering");
 	RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_glsl_update");
 
-	prop= RNA_def_property(srna, "use_glsl_color_management", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_glsl_color_management", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_COLOR_MANAGEMENT);
 	RNA_def_property_ui_text(prop, "GLSL Color Management", "Use color management for GLSL rendering");
 	RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_glsl_update");
 
-	prop= RNA_def_property(srna, "use_glsl_extra_textures", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_glsl_extra_textures", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_EXTRA_TEX);
-	RNA_def_property_ui_text(prop, "GLSL Extra Textures", "Use extra textures like normal or specular maps for GLSL rendering");
+	RNA_def_property_ui_text(prop, "GLSL Extra Textures",
+	                         "Use extra textures like normal or specular maps for GLSL rendering");
 	RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_glsl_update");
 
 	/* obstacle simulation */
-	prop= RNA_def_property(srna, "obstacle_simulation", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "obstacle_simulation", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "obstacleSimulation");
 	RNA_def_property_enum_items(prop, obstacle_simulation_items);
 	RNA_def_property_ui_text(prop, "Obstacle simulation", "Simulation used for obstacle avoidance in the game engine");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "level_height", PROP_FLOAT, PROP_ACCELERATION);
+	prop = RNA_def_property(srna, "level_height", PROP_FLOAT, PROP_ACCELERATION);
 	RNA_def_property_float_sdna(prop, NULL, "levelHeight");
 	RNA_def_property_range(prop, 0.0f, 200.0f);
-	RNA_def_property_ui_text(prop, "Level height", "Max difference in heights of obstacles to enable their interaction");
+	RNA_def_property_ui_text(prop, "Level height",
+	                         "Max difference in heights of obstacles to enable their interaction");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "show_obstacle_simulation", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_obstacle_simulation", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_OBSTACLE_SIMULATION);
 	RNA_def_property_ui_text(prop, "Visualization", "Enable debug visualization for obstacle simulation");
 
 	/* Recast Settings */
-	prop= RNA_def_property(srna, "recast_data", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "recast_data", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "recastData");
 	RNA_def_property_struct_type(prop, "SceneGameRecastData");
@@ -2616,7 +2669,7 @@ static void rna_def_scene_render_layer(BlenderRNA *brna)
 {
 	StructRNA *srna;
 
-	srna= RNA_def_struct(brna, "SceneRenderLayer", NULL);
+	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);
 
@@ -2633,37 +2686,38 @@ static void rna_def_render_layers(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, "RenderLayers");
-	srna= RNA_def_struct(brna, "RenderLayers", NULL);
+	srna = RNA_def_struct(brna, "RenderLayers", NULL);
 	RNA_def_struct_sdna(srna, "RenderData");
 	RNA_def_struct_ui_text(srna, "Render Layers", "Collection of render layers");
 
-	prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "actlay");
-	RNA_def_property_int_funcs(prop, "rna_RenderSettings_active_layer_index_get", "rna_RenderSettings_active_layer_index_set",
+	RNA_def_property_int_funcs(prop, "rna_RenderSettings_active_layer_index_get",
+	                           "rna_RenderSettings_active_layer_index_set",
 	                           "rna_RenderSettings_active_layer_index_range");
 	RNA_def_property_ui_text(prop, "Active Layer Index", "Active index in render layer array");
-	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, "active", PROP_POINTER, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
 	RNA_def_property_struct_type(prop, "SceneRenderLayer");
 	RNA_def_property_pointer_funcs(prop, "rna_RenderSettings_active_layer_get",
 	                               "rna_RenderSettings_active_layer_set", NULL, NULL);
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_NULL);
 	RNA_def_property_ui_text(prop, "Active Render Layer", "Active Render Layer");
-	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");
 
-	func= RNA_def_function(srna, "new", "rna_RenderLayer_new");
+	func = RNA_def_function(srna, "new", "rna_RenderLayer_new");
 	RNA_def_function_ui_description(func, "Add a render layer to scene");
 	RNA_def_function_flag(func, FUNC_USE_SELF_ID);
-	parm= RNA_def_string(func, "name", "RenderLayer", 0, "", "New name for the marker (not unique)");
+	parm = RNA_def_string(func, "name", "RenderLayer", 0, "", "New name for the marker (not unique)");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_pointer(func, "result", "SceneRenderLayer", "", "Newly created render layer");
+	parm = RNA_def_pointer(func, "result", "SceneRenderLayer", "", "Newly created render layer");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_RenderLayer_remove");
+	func = RNA_def_function(srna, "remove", "rna_RenderLayer_remove");
 	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");
+	parm = RNA_def_pointer(func, "layer", "SceneRenderLayer", "", "Timeline marker to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 }
 
@@ -2687,20 +2741,21 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "ImageFormatSettings", NULL);
+	srna = RNA_def_struct(brna, "ImageFormatSettings", NULL);
 	RNA_def_struct_sdna(srna, "ImageFormatData");
 	RNA_def_struct_nested(brna, srna, "Scene");
-	// RNA_def_struct_path_func(srna, "rna_RenderSettings_path"); // no need for the path, its not animated!
+	/* RNA_def_struct_path_func(srna, "rna_RenderSettings_path");  *//* no need for the path, its not animated! */
 	RNA_def_struct_ui_text(srna, "Image Format", "Settings for image formats");
 
-	prop= RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "imtype");
 	RNA_def_property_enum_items(prop, image_type_items);
-	RNA_def_property_enum_funcs(prop, NULL, "rna_ImageFormatSettings_file_format_set", "rna_ImageFormatSettings_file_format_itemf");
+	RNA_def_property_enum_funcs(prop, NULL, "rna_ImageFormatSettings_file_format_set",
+	                            "rna_ImageFormatSettings_file_format_itemf");
 	RNA_def_property_ui_text(prop, "File Format", "File format to save the rendered images as");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "planes");
 	RNA_def_property_enum_items(prop, image_color_mode_items);
 	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageFormatSettings_color_mode_itemf");
@@ -2709,7 +2764,7 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna)
 	                         "and RGBA for saving red, green, blue and alpha channels");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "color_depth", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "color_depth", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "depth");
 	RNA_def_property_enum_items(prop, image_color_depth_items);
 	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageFormatSettings_color_depth_itemf");
@@ -2717,36 +2772,36 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
 	/* was 'file_quality' */
-	prop= RNA_def_property(srna, "quality", PROP_INT, PROP_PERCENTAGE);
+	prop = RNA_def_property(srna, "quality", PROP_INT, PROP_PERCENTAGE);
 	RNA_def_property_int_sdna(prop, NULL, "quality");
 	RNA_def_property_range(prop, 0, 100); /* 0 is needed for compression. */
 	RNA_def_property_ui_text(prop, "Quality", "Quality for image formats that support lossy compression");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
 	/* was shared with file_quality */
-	prop= RNA_def_property(srna, "compression", PROP_INT, PROP_PERCENTAGE);
+	prop = RNA_def_property(srna, "compression", PROP_INT, PROP_PERCENTAGE);
 	RNA_def_property_int_sdna(prop, NULL, "compress");
 	RNA_def_property_range(prop, 0, 100); /* 0 is needed for compression. */
 	RNA_def_property_ui_text(prop, "Compression", "Compression level for formats that support lossless compression");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
 	/* flag */
-	prop= RNA_def_property(srna, "use_zbuffer", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_zbuffer", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", R_IMF_FLAG_ZBUF);
 	RNA_def_property_ui_text(prop, "Z Buffer", "Save the z-depth per pixel (32 bit unsigned int z-buffer)");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "use_preview", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_preview", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", R_IMF_FLAG_PREVIEW_JPG);
 	RNA_def_property_ui_text(prop, "Preview", "When rendering animations, save JPG preview images in same directory");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	/* format spesific */
+	/* format specific */
 
 #ifdef WITH_OPENEXR
 	/* OpenEXR */
 
-	prop= RNA_def_property(srna, "exr_codec", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "exr_codec", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "exr_codec");
 	RNA_def_property_enum_items(prop, exr_codec_items);
 	RNA_def_property_ui_text(prop, "Codec", "Codec settings for OpenEXR");
@@ -2757,17 +2812,17 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna)
 
 #ifdef WITH_OPENJPEG
 	/* Jpeg 2000 */
-	prop= RNA_def_property(srna, "use_jpeg2k_ycc", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_jpeg2k_ycc", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "jp2_flag", R_IMF_JP2_FLAG_YCC);
 	RNA_def_property_ui_text(prop, "YCC", "Save luminance-chrominance-chrominance channels instead of RGB colors");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "use_jpeg2k_cinema_preset", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_jpeg2k_cinema_preset", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "jp2_flag", R_IMF_JP2_FLAG_CINE_PRESET);
 	RNA_def_property_ui_text(prop, "Cinema", "Use Openjpeg Cinema Preset");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "use_jpeg2k_cinema_48", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_jpeg2k_cinema_48", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "jp2_flag", R_IMF_JP2_FLAG_CINE_48);
 	RNA_def_property_ui_text(prop, "Cinema (48)", "Use Openjpeg Cinema Preset (48fps)");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
@@ -2775,24 +2830,24 @@ 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);
+	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_ui_text(prop, "Log", "Convert to logarithmic color space");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "cineon_black", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "cineon_black", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "cineon_black");
 	RNA_def_property_range(prop, 0, 1024);
 	RNA_def_property_ui_text(prop, "B", "Log conversion reference blackpoint");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "cineon_white", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "cineon_white", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "cineon_white");
 	RNA_def_property_range(prop, 0, 1024);
 	RNA_def_property_ui_text(prop, "W", "Log conversion reference whitepoint");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "cineon_gamma", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "cineon_gamma", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "cineon_gamma");
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "G", "Log conversion gamma");
@@ -2896,7 +2951,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Max Rate", "Rate control: max rate (kb/s)");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "muxrate", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "muxrate", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "mux_rate");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0, 100000000);
@@ -2924,7 +2979,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Mux Packet Size", "Mux packet size (byte)");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "use_autosplit", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_autosplit", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", FFMPEG_AUTOSPLIT_OUTPUT);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Autosplit Output", "Autosplit output at 2GB boundary");
@@ -2952,7 +3007,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Bitrate", "Audio bitrate (kb/s)");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "audio_volume", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "audio_volume", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "audio_volume");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
@@ -2960,15 +3015,15 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 #endif
 
-	// the following two "ffmpeg" settings are general audio settings
-	prop= RNA_def_property(srna, "audio_mixrate", PROP_INT, PROP_NONE);
+	/* the following two "ffmpeg" settings are general audio settings */
+	prop = RNA_def_property(srna, "audio_mixrate", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "audio_mixrate");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 8000, 192000);
 	RNA_def_property_ui_text(prop, "Samplerate", "Audio samplerate(samples/s)");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "audio_channels", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "audio_channels", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "audio_channels");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_items(prop, audio_channel_items);
@@ -3061,12 +3116,12 @@ static void rna_def_scene_quicktime_settings(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "HQ", "Use High Quality resampling algorithm");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "audio_codec_isvbr", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "audio_codec_isvbr", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "audioCodecFlags", QTAUDIO_FLAG_CODEC_ISCBR);
 	RNA_def_property_ui_text(prop, "VBR", "Use Variable Bit Rate compression (improves quality at same bitrate)");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "audio_bitrate", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "audio_bitrate", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "audioBitRate");
 	RNA_def_property_enum_items(prop, quicktime_audio_bitrate_items);
 	RNA_def_property_ui_text(prop, "Bitrate", "Compressed audio bitrate");
@@ -3080,7 +3135,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	static EnumPropertyItem pixel_filter_items[] ={
+	static EnumPropertyItem pixel_filter_items[] = {
 		{R_FILTER_BOX, "BOX", 0, "Box", "Use a box filter for anti-aliasing"},
 		{R_FILTER_TENT, "TENT", 0, "Tent", "Use a tent filter for anti-aliasing"},
 		{R_FILTER_QUAD, "QUADRATIC", 0, "Quadratic", "Use a quadratic filter for anti-aliasing"},
@@ -3090,21 +3145,21 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 		{R_FILTER_MITCH, "MITCHELL", 0, "Mitchell-Netravali", "Use a Mitchell-Netravali filter for anti-aliasing"},
 		{0, NULL, 0, NULL, NULL}};
 		
-	static EnumPropertyItem alpha_mode_items[] ={
+	static EnumPropertyItem alpha_mode_items[] = {
 		{R_ADDSKY, "SKY", 0, "Sky", "Transparent pixels are filled with sky color"},
 		{R_ALPHAPREMUL, "PREMUL", 0, "Premultiplied", "Transparent RGB pixels are multiplied by the alpha channel"},
 		{R_ALPHAKEY, "STRAIGHT", 0, "Straight Alpha", "Transparent RGB and alpha pixels are unmodified"},
 		{0, NULL, 0, NULL, NULL}};
 
-	static EnumPropertyItem display_mode_items[] ={
+	static EnumPropertyItem display_mode_items[] = {
 		{R_OUTPUT_SCREEN, "SCREEN", 0, "Full Screen", "Images are rendered in full Screen"},
 		{R_OUTPUT_AREA, "AREA", 0, "Image Editor", "Images are rendered in Image Editor"},
 		{R_OUTPUT_WINDOW, "WINDOW", 0, "New Window", "Images are rendered in new Window"},
-		{R_OUTPUT_NONE, "NONE", 0, "Keep UI", "Images are rendered without forcing UI changes, optionally showing result"},
+		{R_OUTPUT_NONE, "NONE", 0, "Keep UI", "Images are rendered without forcing UI changes"},
 		{0, NULL, 0, NULL, NULL}};
 	
 	/* Bake */
-	static EnumPropertyItem bake_mode_items[] ={
+	static EnumPropertyItem bake_mode_items[] = {
 		{RE_BAKE_ALL, "FULL", 0, "Full Render", "Bake everything"},
 		{RE_BAKE_AO, "AO", 0, "Ambient Occlusion", "Bake ambient occlusion"},
 		{RE_BAKE_SHADOW, "SHADOW", 0, "Shadow", "Bake shadows"},
@@ -3119,14 +3174,14 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 		{RE_BAKE_SPEC_COLOR, "SPEC_COLOR", 0, "Specular Colors", "Bake Specular colors"},
 		{0, NULL, 0, NULL, NULL}};
 
-	static EnumPropertyItem bake_normal_space_items[] ={
+	static EnumPropertyItem bake_normal_space_items[] = {
 		{R_BAKE_SPACE_CAMERA, "CAMERA", 0, "Camera", "Bake the normals in camera space"},
 		{R_BAKE_SPACE_WORLD, "WORLD", 0, "World", "Bake the normals in world space"},
 		{R_BAKE_SPACE_OBJECT, "OBJECT", 0, "Object", "Bake the normals in object space"},
 		{R_BAKE_SPACE_TANGENT, "TANGENT", 0, "Tangent", "Bake the normals in tangent space"},
 		{0, NULL, 0, NULL, NULL}};
 
-	static EnumPropertyItem bake_qyad_split_items[] ={
+	static EnumPropertyItem bake_qyad_split_items[] = {
 		{0, "AUTO", 0, "Automatic", "Split quads to give the least distortion while baking"},
 		{1, "FIXED", 0, "Fixed", "Split quads predictably (0,1,2) (0,2,3)"},
 		{2, "FIXED_ALT", 0, "Fixed Alternate", "Split quads predictably (1,2,3) (1,3,0)"},
@@ -3175,34 +3230,34 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 	rna_def_scene_quicktime_settings(brna);
 #endif
 
-	srna= RNA_def_struct(brna, "RenderSettings", NULL);
+	srna = RNA_def_struct(brna, "RenderSettings", NULL);
 	RNA_def_struct_sdna(srna, "RenderData");
 	RNA_def_struct_nested(brna, srna, "Scene");
 	RNA_def_struct_path_func(srna, "rna_RenderSettings_path");
 	RNA_def_struct_ui_text(srna, "Render Data", "Rendering settings for a Scene datablock");
 
 	/* Render Data */
-	prop= RNA_def_property(srna, "image_settings", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "image_settings", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "im_format");
 	RNA_def_property_struct_type(prop, "ImageFormatSettings");
 	RNA_def_property_ui_text(prop, "Image Format", "");
 
-	prop= RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "xsch");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 4, 10000);
 	RNA_def_property_ui_text(prop, "Resolution X", "Number of horizontal pixels in the rendered image");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneCamera_update");
 	
-	prop= RNA_def_property(srna, "resolution_y", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "resolution_y", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "ysch");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 4, 10000);
 	RNA_def_property_ui_text(prop, "Resolution Y", "Number of vertical pixels in the rendered image");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneCamera_update");
 	
-	prop= RNA_def_property(srna, "resolution_percentage", PROP_INT, PROP_PERCENTAGE);
+	prop = RNA_def_property(srna, "resolution_percentage", PROP_INT, PROP_PERCENTAGE);
 	RNA_def_property_int_sdna(prop, NULL, "size");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 1, SHRT_MAX);
@@ -3210,54 +3265,56 @@ 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);
+	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");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "parts_y", PROP_INT, PROP_NONE);
+	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");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "pixel_aspect_x", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "pixel_aspect_x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "xasp");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 1.0f, 200.0f);
-	RNA_def_property_ui_text(prop, "Pixel Aspect X", "Horizontal aspect ratio - for anamorphic or non-square pixel output");
+	RNA_def_property_ui_text(prop, "Pixel Aspect X",
+	                         "Horizontal aspect ratio - for anamorphic or non-square pixel output");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneCamera_update");
 	
-	prop= RNA_def_property(srna, "pixel_aspect_y", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "pixel_aspect_y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "yasp");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 1.0f, 200.0f);
-	RNA_def_property_ui_text(prop, "Pixel Aspect Y", "Vertical aspect ratio - for anamorphic or non-square pixel output");
+	RNA_def_property_ui_text(prop, "Pixel Aspect Y",
+	                         "Vertical aspect ratio - for anamorphic or non-square pixel output");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_SceneCamera_update");
 
 #ifdef WITH_QUICKTIME
-	prop= RNA_def_property(srna, "quicktime", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "quicktime", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "QuickTimeSettings");
 	RNA_def_property_pointer_sdna(prop, NULL, "qtcodecsettings");
 	RNA_def_property_flag(prop, PROP_NEVER_UNLINK);
 	RNA_def_property_ui_text(prop, "QuickTime Settings", "QuickTime related settings for the scene");
 #endif
 
-	prop= RNA_def_property(srna, "ffmpeg", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "ffmpeg", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "FFmpegSettings");
 	RNA_def_property_pointer_sdna(prop, NULL, "ffcodecdata");
 	RNA_def_property_flag(prop, PROP_NEVER_UNLINK);
 	RNA_def_property_ui_text(prop, "FFmpeg Settings", "FFmpeg related settings for the scene");
 
-	prop= RNA_def_property(srna, "fps", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "fps", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "frs_sec");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 1, 120);
 	RNA_def_property_ui_text(prop, "FPS", "Framerate, expressed in frames per second");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_Scene_fps_update");
 	
-	prop= RNA_def_property(srna, "fps_base", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "fps_base", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "frs_sec_base");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0.1f, 120.0f);
@@ -3265,14 +3322,14 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_Scene_fps_update");
 	
 	/* frame mapping */
-	prop= RNA_def_property(srna, "frame_map_old", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_map_old", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "framapto");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 1, 900);
 	RNA_def_property_ui_text(prop, "Frame Map Old", "Old mapping value in frames");
 	RNA_def_property_update(prop, NC_SCENE|ND_FRAME, "rna_Scene_framelen_update");
 	
-	prop= RNA_def_property(srna, "frame_map_new", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_map_new", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "images");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 1, 900);
@@ -3280,74 +3337,75 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_SCENE|ND_FRAME, "rna_Scene_framelen_update");
 
 	
-	prop= RNA_def_property(srna, "dither_intensity", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "dither_intensity", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "dither_intensity");
 	RNA_def_property_range(prop, 0.0f, 2.0f);
 	RNA_def_property_ui_text(prop, "Dither Intensity",
 	                         "Amount of dithering noise added to the rendered image to break up banding");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "pixel_filter_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "pixel_filter_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "filtertype");
 	RNA_def_property_enum_items(prop, pixel_filter_items);
 	RNA_def_property_ui_text(prop, "Pixel Filter", "Reconstruction filter used for combining anti-aliasing samples");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "filter_size", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "filter_size", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "gauss");
 	RNA_def_property_range(prop, 0.5f, 1.5f);
 	RNA_def_property_ui_text(prop, "Filter Size", "Pixel width over which the reconstruction filter combines samples");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "alpha_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "alpha_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "alphamode");
 	RNA_def_property_enum_items(prop, alpha_mode_items);
 	RNA_def_property_ui_text(prop, "Alpha Mode", "Representation of alpha information in the RGBA pixels");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "octree_resolution", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "octree_resolution", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "ocres");
 	RNA_def_property_enum_items(prop, octree_resolution_items);
 	RNA_def_property_ui_text(prop, "Octree Resolution",
 	                         "Resolution of raytrace accelerator, use higher resolutions for larger scenes");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "raytrace_method", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "raytrace_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "raytrace_structure");
 	RNA_def_property_enum_items(prop, raytrace_structure_items);
 	RNA_def_property_ui_text(prop, "Raytrace Acceleration Structure", "Type of raytrace accelerator structure");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "use_instances", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_instances", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "raytrace_options", R_RAYTRACE_USE_INSTANCES);
 	RNA_def_property_ui_text(prop, "Use Instances",
 	                         "Instance support leads to effective memory reduction when using duplicates");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "use_local_coords", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_local_coords", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "raytrace_options", R_RAYTRACE_USE_LOCAL_COORDS);
 	RNA_def_property_ui_text(prop, "Use Local Coords",
-	                         "Vertex coordinates are stored localy on each primitive "
+	                         "Vertex coordinates are stored locally on each primitive "
 	                         "(increases memory usage, but may have impact on speed)");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", R_OSA);
-	RNA_def_property_ui_text(prop, "Anti-Aliasing", "Render and combine multiple samples per pixel to prevent jagged edges");
+	RNA_def_property_ui_text(prop, "Anti-Aliasing",
+	                         "Render and combine multiple samples per pixel to prevent jagged edges");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "antialiasing_samples", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "antialiasing_samples", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "osa");
 	RNA_def_property_enum_items(prop, fixed_oversample_items);
 	RNA_def_property_ui_text(prop, "Anti-Aliasing Samples", "Amount of anti-aliasing samples per pixel");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "use_fields", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_fields", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", R_FIELDS);
 	RNA_def_property_ui_text(prop, "Fields", "Render image to two fields per frame, for interlaced TV output");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "field_order", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "field_order", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode");
 	RNA_def_property_enum_items(prop, field_order_items);
 	RNA_def_property_ui_text(prop, "Field Order",
@@ -3355,97 +3413,100 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 	                         "to create smooth motion for TV output)");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "use_fields_still", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_fields_still", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", R_FIELDSTILL);
 	RNA_def_property_ui_text(prop, "Fields Still", "Disable the time difference between fields");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
 	/* rendering features */
-	prop= RNA_def_property(srna, "use_shadows", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_shadows", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", R_SHADOW);
 	RNA_def_property_ui_text(prop, "Shadows", "Calculate shadows while rendering");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "use_envmaps", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_envmaps", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", R_ENVMAP);
 	RNA_def_property_ui_text(prop, "Environment Maps", "Calculate environment maps while rendering");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "use_radiosity", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_radiosity", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", R_RADIO);
 	RNA_def_property_ui_text(prop, "Radiosity", "Calculate radiosity in a pre-process before rendering");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "use_sss", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_sss", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", R_SSS);
 	RNA_def_property_ui_text(prop, "Subsurface Scattering", "Calculate sub-surface scattering in materials rendering");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "use_raytrace", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_raytrace", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", R_RAYTRACE);
-	RNA_def_property_ui_text(prop, "Raytracing", "Pre-calculate the raytrace accelerator and render raytracing effects");
+	RNA_def_property_ui_text(prop, "Raytracing",
+	                         "Pre-calculate the raytrace accelerator and render raytracing effects");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "use_textures", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_textures", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "scemode", R_NO_TEX);
 	RNA_def_property_ui_text(prop, "Textures", "Use textures to affect material properties");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "use_edge_enhance", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_edge_enhance", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", R_EDGE);
 	RNA_def_property_ui_text(prop, "Edge", "Create a toon outline around the edges of geometry");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "edge_threshold", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "edge_threshold", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "edgeint");
 	RNA_def_property_range(prop, 0, 255);
 	RNA_def_property_ui_text(prop, "Edge Threshold", "Threshold for drawing outlines on geometry edges");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "edge_color", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "edge_color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "edgeR");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Edge Color", "Edge color");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
 	/* threads */
-	prop= RNA_def_property(srna, "threads", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "threads", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "threads");
 	RNA_def_property_range(prop, 1, BLENDER_MAX_THREADS);
 	RNA_def_property_int_funcs(prop, "rna_RenderSettings_threads_get", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Threads",
-	                         "Number of CPU threads to use simultaneously while rendering (for multi-core/CPU systems)");
+	                         "Number of CPU threads to use simultaneously while rendering "
+	                         "(for multi-core/CPU systems)");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "threads_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "threads_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode");
 	RNA_def_property_enum_items(prop, threads_mode_items);
 	RNA_def_property_ui_text(prop, "Threads Mode", "Determine the amount of render threads used");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
 	/* motion blur */
-	prop= RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE);
 	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);
 	
-	prop= RNA_def_property(srna, "motion_blur_samples", PROP_INT, PROP_NONE);
+	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);
 	
-	prop= RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "blurfac");
 	RNA_def_property_range(prop, 0.01f, 10.0f);
 	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);
 	
 	/* border */
-	prop= RNA_def_property(srna, "use_border", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_border", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", R_BORDER);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Border",
@@ -3453,78 +3514,81 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 	                         "(note that this disables save_buffers and full_sample)");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "border_min_x", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "border_min_x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "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_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "border_min_y", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "border_min_y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "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_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "border_max_x", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "border_max_x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "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_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "border_max_y", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "border_max_y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "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_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "use_crop_to_border", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_crop_to_border", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", R_CROP);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Crop to Border", "Crop the rendered frame to the defined border size");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "use_placeholder", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_placeholder", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", R_TOUCH);
 	RNA_def_property_ui_text(prop, "Placeholders",
 	                         "Create empty placeholder files while rendering frames (similar to Unix 'touch')");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "use_overwrite", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_overwrite", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "mode", R_NO_OVERWRITE);
 	RNA_def_property_ui_text(prop, "Overwrite", "Overwrite existing files while rendering");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "use_compositing", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_compositing", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_DOCOMP);
 	RNA_def_property_ui_text(prop, "Compositing",
-	                         "Process the render result through the compositing pipeline, if compositing nodes are enabled");
+	                         "Process the render result through the compositing pipeline, "
+	                         "if compositing nodes are enabled");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "use_sequencer", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_sequencer", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_DOSEQ);
 	RNA_def_property_ui_text(prop, "Sequencer",
 	                         "Process the render (and composited) result through the video sequence "
 	                         "editor pipeline, if sequencer strips exist");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "use_color_management", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_color_management", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "color_mgt_flag", R_COLOR_MANAGEMENT);
 	RNA_def_property_ui_text(prop, "Color Management", "Use linear workflow - gamma corrected imaging pipeline");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, "rna_RenderSettings_color_management_update");
 	
-	prop= RNA_def_property(srna, "use_color_unpremultiply", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_color_unpremultiply", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "color_mgt_flag", R_COLOR_MANAGEMENT_PREDIVIDE);
-	RNA_def_property_ui_text(prop, "Color Unpremultipy", "For premultiplied alpha render output, do color space conversion on colors without alpha, to avoid fringing on light backgrounds");
+	RNA_def_property_ui_text(prop, "Color Unpremultiply",
+	                         "For premultiplied alpha render output, do color space conversion on "
+	                         "colors without alpha, to avoid fringing on light backgrounds");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "use_file_extension", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_file_extension", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_EXTENSION);
 	RNA_def_property_ui_text(prop, "File Extensions",
 	                         "Add the file format extensions to the rendered file name (eg: filename + .jpg)");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
 #if 0 /* moved */
-	prop= RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "imtype");
 	RNA_def_property_enum_items(prop, image_type_items);
 	RNA_def_property_enum_funcs(prop, NULL, "rna_RenderSettings_file_format_set", NULL);
@@ -3532,28 +3596,29 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 #endif
 
-	prop= RNA_def_property(srna, "file_extension", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "file_extension", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_funcs(prop, "rna_SceneRender_file_ext_get", "rna_SceneRender_file_ext_length", NULL);
 	RNA_def_property_ui_text(prop, "Extension", "The file extension used for saving renders");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "is_movie_format", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_movie_format", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_is_movie_fomat_get", NULL);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Movie Format", "When true the format is a movie");
 
-	prop= RNA_def_property(srna, "use_free_image_textures", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_free_image_textures", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_FREE_IMAGE);
 	RNA_def_property_ui_text(prop, "Free Image Textures",
-	                         "Free all image texture from memory after render, to save memory before compositing");
+	                         "Free all image textures from memory after render, to save memory before compositing");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "use_free_unused_nodes", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_free_unused_nodes", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_COMP_FREE);
-	RNA_def_property_ui_text(prop, "Free Unused Nodes", "Free Nodes that are not used while compositing, to save memory");
+	RNA_def_property_ui_text(prop, "Free Unused Nodes",
+	                         "Free Nodes that are not used while compositing, to save memory");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "use_save_buffers", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_save_buffers", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_EXR_TILE_FILE);
 	RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_save_buffers_get", NULL);
 	RNA_def_property_ui_text(prop, "Save Buffers",
@@ -3561,7 +3626,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 	                         "(saves memory, required for Full Sample)");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "use_full_sample", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_full_sample", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_FULL_SAMPLE);
 	RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_full_sample_get", NULL);
 	RNA_def_property_ui_text(prop, "Full Sample",
@@ -3569,13 +3634,13 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 	                         "(this solves anti-aliasing issues with compositing)");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "displaymode");
 	RNA_def_property_enum_items(prop, display_mode_items);
 	RNA_def_property_ui_text(prop, "Display", "Select where rendered images will be displayed");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+	prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
 	RNA_def_property_string_sdna(prop, NULL, "pic");
 	RNA_def_property_ui_text(prop, "Output Path",
 	                         "Directory/name to save animations, # characters defines the position "
@@ -3584,149 +3649,153 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 
 	/* Bake */
 	
-	prop= RNA_def_property(srna, "bake_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "bake_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "bake_mode");
 	RNA_def_property_enum_items(prop, bake_mode_items);
 	RNA_def_property_ui_text(prop, "Bake Mode", "Choose shading information to bake into the image");
 	
-	prop= RNA_def_property(srna, "bake_normal_space", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "bake_normal_space", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "bake_normal_space");
 	RNA_def_property_enum_items(prop, bake_normal_space_items);
 	RNA_def_property_ui_text(prop, "Normal Space", "Choose normal space for baking");
 	
-	prop= RNA_def_property(srna, "bake_quad_split", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "bake_quad_split", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, bake_qyad_split_items);
 	RNA_def_property_ui_text(prop, "Quad Split", "Choose the method used to split a quad into 2 triangles for baking");
 	
-	prop= RNA_def_property(srna, "bake_aa_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "bake_aa_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "bake_osa");
 	RNA_def_property_enum_items(prop, fixed_oversample_items);
 	RNA_def_property_ui_text(prop, "Anti-Aliasing Level", "");
 	
-	prop= RNA_def_property(srna, "use_bake_selected_to_active", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_bake_selected_to_active", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_TO_ACTIVE);
 	RNA_def_property_ui_text(prop, "Selected to Active",
 	                         "Bake shading on the surface of selected objects to the active object");
 	
-	prop= RNA_def_property(srna, "use_bake_normalize", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_bake_normalize", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_NORMALIZE);
 	RNA_def_property_ui_text(prop, "Normalized",
 	                         "With displacement normalize to the distance, with ambient occlusion "
 	                         "normalize without using material settings");
 	
-	prop= RNA_def_property(srna, "use_bake_clear", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_bake_clear", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_CLEAR);
 	RNA_def_property_ui_text(prop, "Clear", "Clear Images before baking");
 	
-	prop= RNA_def_property(srna, "use_bake_antialiasing", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_bake_antialiasing", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_OSA);
 	RNA_def_property_ui_text(prop, "Anti-Aliasing", "Enables Anti-aliasing");
 	
-	prop= RNA_def_property(srna, "bake_margin", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "bake_margin", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "bake_filter");
 	RNA_def_property_range(prop, 0, 64);
-	RNA_def_property_ui_text(prop, "Margin", "Amount of pixels to extend the baked result with, as post process filter");
+	RNA_def_property_ui_text(prop, "Margin",
+	                         "Amount of pixels to extend the baked result with, as post process filter");
 
-	prop= RNA_def_property(srna, "bake_distance", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "bake_distance", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "bake_maxdist");
 	RNA_def_property_range(prop, 0.0, 1000.0);
-	RNA_def_property_ui_text(prop, "Distance", "Maximum distance from active object to other object (in blender units)");
+	RNA_def_property_ui_text(prop, "Distance",
+	                         "Maximum distance from active object to other object (in blender units)");
 	
-	prop= RNA_def_property(srna, "bake_bias", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "bake_bias", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "bake_biasdist");
 	RNA_def_property_range(prop, 0.0, 1000.0);
 	RNA_def_property_ui_text(prop, "Bias", "Bias towards faces further away from the object (in blender units)");
 	
-	prop= RNA_def_property(srna, "use_bake_multires", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_bake_multires", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_MULTIRES);
 	RNA_def_property_ui_text(prop, "Bake from Multires", "Bake directly from multires object");
 
-	prop= RNA_def_property(srna, "use_bake_lores_mesh", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_bake_lores_mesh", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_LORES_MESH);
-	RNA_def_property_ui_text(prop, "Low Resolution Mesh", "Calculate heights against unsubdivided low resolution mesh");
+	RNA_def_property_ui_text(prop, "Low Resolution Mesh",
+	                         "Calculate heights against unsubdivided low resolution mesh");
 
 	/* stamp */
 	
-	prop= RNA_def_property(srna, "use_stamp_time", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_stamp_time", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_TIME);
-	RNA_def_property_ui_text(prop, "Stamp Time", "Include the rendered frame timecode as HH:MM:SS.FF in image metadata");
+	RNA_def_property_ui_text(prop, "Stamp Time",
+	                         "Include the rendered frame timecode as HH:MM:SS.FF in image metadata");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "use_stamp_date", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_stamp_date", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_DATE);
 	RNA_def_property_ui_text(prop, "Stamp Date", "Include the current date in image metadata");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "use_stamp_frame", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_stamp_frame", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_FRAME);
 	RNA_def_property_ui_text(prop, "Stamp Frame", "Include the frame number in image metadata");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "use_stamp_camera", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_stamp_camera", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_CAMERA);
 	RNA_def_property_ui_text(prop, "Stamp Camera", "Include the name of the active camera in image metadata");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "use_stamp_lens", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_stamp_lens", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_CAMERALENS);
 	RNA_def_property_ui_text(prop, "Stamp Lens", "Include the active camera's lens in image metadata");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "use_stamp_scene", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_stamp_scene", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_SCENE);
 	RNA_def_property_ui_text(prop, "Stamp Scene", "Include the name of the active scene in image metadata");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "use_stamp_note", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_stamp_note", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_NOTE);
 	RNA_def_property_ui_text(prop, "Stamp Note", "Include a custom note in image metadata");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "use_stamp_marker", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_stamp_marker", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_MARKER);
 	RNA_def_property_ui_text(prop, "Stamp Marker", "Include the name of the last marker in image metadata");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "use_stamp_filename", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_stamp_filename", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_FILENAME);
 	RNA_def_property_ui_text(prop, "Stamp Filename", "Include the .blend filename in image metadata");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "use_stamp_sequencer_strip", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_stamp_sequencer_strip", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_SEQSTRIP);
 	RNA_def_property_ui_text(prop, "Stamp Sequence Strip",
 	                         "Include the name of the foreground sequence strip in image metadata");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "use_stamp_render_time", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_stamp_render_time", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_RENDERTIME);
 	RNA_def_property_ui_text(prop, "Stamp Render Time", "Include the render time in image metadata");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "stamp_note_text", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "stamp_note_text", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "stamp_udata");
 	RNA_def_property_ui_text(prop, "Stamp Note Text", "Custom text to appear in the stamp note");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "use_stamp", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_stamp", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_DRAW);
 	RNA_def_property_ui_text(prop, "Render Stamp", "Render the stamp info text in the rendered image");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "stamp_font_size", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "stamp_font_size", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "stamp_font_id");
 	RNA_def_property_range(prop, 8, 64);
 	RNA_def_property_ui_text(prop, "Font Size", "Size of the font used when rendering stamp text");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
-	prop= RNA_def_property(srna, "stamp_foreground", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "stamp_foreground", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "fg_stamp");
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_range(prop,0.0,1.0);
 	RNA_def_property_ui_text(prop, "Text Color", "Color to use for stamp text");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
-	prop= RNA_def_property(srna, "stamp_background", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "stamp_background", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "bg_stamp");
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_range(prop,0.0,1.0);
@@ -3735,91 +3804,91 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 
 	/* sequencer draw options */
 
-	prop= RNA_def_property(srna, "use_sequencer_gl_preview", PROP_BOOLEAN, PROP_NONE);
+	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", "");
 
-	prop= RNA_def_property(srna, "use_sequencer_gl_render", PROP_BOOLEAN, PROP_NONE);
+	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", "");
 
 
-	prop= RNA_def_property(srna, "sequencer_gl_preview", PROP_ENUM, PROP_NONE);
+	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");
 
-	prop= RNA_def_property(srna, "sequencer_gl_render", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "sequencer_gl_render", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "seq_rend_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");
 
 	/* layers */
-	prop= RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "layers", NULL);
 	RNA_def_property_struct_type(prop, "SceneRenderLayer");
 	RNA_def_property_ui_text(prop, "Render Layers", "");
 	rna_def_render_layers(brna, prop);
 
 
-	prop= RNA_def_property(srna, "use_single_layer", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_single_layer", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_SINGLE_LAYER);
 	RNA_def_property_ui_text(prop, "Single Layer", "Only render the active layer");
 	RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 
 	/* engine */
-	prop= RNA_def_property(srna, "engine", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "engine", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, engine_items);
 	RNA_def_property_enum_funcs(prop, "rna_RenderSettings_engine_get", "rna_RenderSettings_engine_set",
 	                            "rna_RenderSettings_engine_itemf");
 	RNA_def_property_ui_text(prop, "Engine", "Engine to use for rendering");
 	RNA_def_property_update(prop, NC_WINDOW, "rna_RenderSettings_engine_update");
 
-	prop= RNA_def_property(srna, "has_multiple_engines", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "has_multiple_engines", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_multiple_engines_get", NULL);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Multiple Engines", "More than one rendering engine is available");
 
-	prop= RNA_def_property(srna, "use_shading_nodes", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_shading_nodes", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_use_shading_nodes_get", NULL);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Use Shading Nodes", "Active render engine uses new shading nodes system");
 
-	prop= RNA_def_property(srna, "use_game_engine", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_game_engine", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_use_game_engine_get", NULL);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Use Game Engine", "Current rendering engine is a game engine");
 
 	/* simplify */
-	prop= RNA_def_property(srna, "use_simplify", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_simplify", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", R_SIMPLIFY);
 	RNA_def_property_ui_text(prop, "Use Simplify", "Enable simplification of scene for quicker preview renders");
 	RNA_def_property_update(prop, 0, "rna_Scene_use_simplify_update");
 
-	prop= RNA_def_property(srna, "simplify_subdivision", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "simplify_subdivision", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "simplify_subsurf");
 	RNA_def_property_ui_range(prop, 0, 6, 1, 0);
 	RNA_def_property_ui_text(prop, "Simplify Subdivision", "Global maximum subdivision level");
 	RNA_def_property_update(prop, 0, "rna_Scene_simplify_update");
 
-	prop= RNA_def_property(srna, "simplify_child_particles", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "simplify_child_particles", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "simplify_particles");
 	RNA_def_property_ui_text(prop, "Simplify Child Particles", "Global child particles percentage");
 	RNA_def_property_update(prop, 0, "rna_Scene_simplify_update");
 
-	prop= RNA_def_property(srna, "simplify_shadow_samples", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "simplify_shadow_samples", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "simplify_shadowsamples");
 	RNA_def_property_ui_range(prop, 1, 16, 1, 0);
 	RNA_def_property_ui_text(prop, "Simplify Shadow Samples", "Global maximum shadow samples");
 	RNA_def_property_update(prop, 0, "rna_Scene_simplify_update");
 
-	prop= RNA_def_property(srna, "simplify_ao_sss", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "simplify_ao_sss", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "simplify_aosss");
 	RNA_def_property_ui_text(prop, "Simplify AO and SSS", "Global approximate AO and SSS quality factor");
 	RNA_def_property_update(prop, 0, "rna_Scene_simplify_update");
 
-	prop= RNA_def_property(srna, "use_simplify_triangulate", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_simplify_triangulate", PROP_BOOLEAN, PROP_NONE);
 	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");
 
@@ -3837,25 +3906,25 @@ static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *parm;
 	
 	RNA_def_property_srna(cprop, "SceneObjects");
-	srna= RNA_def_struct(brna, "SceneObjects", NULL);
+	srna = RNA_def_struct(brna, "SceneObjects", NULL);
 	RNA_def_struct_sdna(srna, "Scene");
 	RNA_def_struct_ui_text(srna, "Scene Objects", "Collection of scene objects");
 
-	func= RNA_def_function(srna, "link", "rna_Scene_object_link");
+	func = RNA_def_function(srna, "link", "rna_Scene_object_link");
 	RNA_def_function_ui_description(func, "Link object to scene, run scene.update() after");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
-	parm= RNA_def_pointer(func, "object", "Object", "", "Object to add to scene");
+	parm = RNA_def_pointer(func, "object", "Object", "", "Object to add to scene");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
-	parm= RNA_def_pointer(func, "base", "ObjectBase", "", "The newly created base");
+	parm = RNA_def_pointer(func, "base", "ObjectBase", "", "The newly created base");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "unlink", "rna_Scene_object_unlink");
+	func = RNA_def_function(srna, "unlink", "rna_Scene_object_unlink");
 	RNA_def_function_ui_description(func, "Unlink object from scene");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
-	parm= RNA_def_pointer(func, "object", "Object", "", "Object to remove from scene");
+	parm = RNA_def_pointer(func, "object", "Object", "", "Object to remove from scene");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_pointer_funcs(prop, "rna_Scene_active_object_get", "rna_Scene_active_object_set", NULL, NULL);
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK);
@@ -3872,15 +3941,15 @@ static void rna_def_scene_bases(BlenderRNA *brna, PropertyRNA *cprop)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-//	FunctionRNA *func;
-//	PropertyRNA *parm;
+/*	FunctionRNA *func; */
+/*	PropertyRNA *parm; */
 
 	RNA_def_property_srna(cprop, "SceneBases");
-	srna= RNA_def_struct(brna, "SceneBases", NULL);
+	srna = RNA_def_struct(brna, "SceneBases", NULL);
 	RNA_def_struct_sdna(srna, "Scene");
 	RNA_def_struct_ui_text(srna, "Scene Bases", "Collection of scene bases");
 
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "ObjectBase");
 	RNA_def_property_pointer_sdna(prop, NULL, "basact");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
@@ -3897,26 +3966,26 @@ static void rna_def_timeline_markers(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, "TimelineMarkers");
-	srna= RNA_def_struct(brna, "TimelineMarkers", NULL);
+	srna = RNA_def_struct(brna, "TimelineMarkers", NULL);
 	RNA_def_struct_sdna(srna, "Scene");
 	RNA_def_struct_ui_text(srna, "Timeline Markers", "Collection of timeline markers");
 
-	func= RNA_def_function(srna, "new", "rna_TimeLine_add");
+	func = RNA_def_function(srna, "new", "rna_TimeLine_add");
 	RNA_def_function_ui_description(func, "Add a keyframe to the curve");
-	parm= RNA_def_string(func, "name", "Marker", 0, "", "New name for the marker (not unique)");
+	parm = RNA_def_string(func, "name", "Marker", 0, "", "New name for the marker (not unique)");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	parm= RNA_def_pointer(func, "marker", "TimelineMarker", "", "Newly created timeline marker");
+	parm = RNA_def_pointer(func, "marker", "TimelineMarker", "", "Newly created timeline marker");
 	RNA_def_function_return(func, parm);
 
 
-	func= RNA_def_function(srna, "remove", "rna_TimeLine_remove");
+	func = RNA_def_function(srna, "remove", "rna_TimeLine_remove");
 	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");
+	parm = RNA_def_pointer(func, "marker", "TimelineMarker", "", "Timeline marker to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "clear", "rna_TimeLine_clear");
+	func = RNA_def_function(srna, "clear", "rna_TimeLine_clear");
 	RNA_def_function_ui_description(func, "Remove all timeline markers");
 }
 
@@ -3930,31 +3999,34 @@ static void rna_def_scene_keying_sets(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, "KeyingSets");
-	srna= RNA_def_struct(brna, "KeyingSets", NULL);
+	srna = RNA_def_struct(brna, "KeyingSets", NULL);
 	RNA_def_struct_sdna(srna, "Scene");
 	RNA_def_struct_ui_text(srna, "Keying Sets", "Scene keying sets");
 
 	/* Add Keying Set */
-	func= RNA_def_function(srna, "new", "rna_Scene_keying_set_new");
+	func = RNA_def_function(srna, "new", "rna_Scene_keying_set_new");
 	RNA_def_function_ui_description(func, "Add a new Keying Set to Scene");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
 	/* name */
-	RNA_def_string(func, "name", "KeyingSet", 64, "Name", "Name of Keying Set");
+	RNA_def_string(func, "idname", "KeyingSet", 64, "IDName", "Internal identifier of Keying Set");
+	RNA_def_string(func, "name", "KeyingSet", 64, "Name", "User visible name of Keying Set");
 
 	/* returns the new KeyingSet */
-	parm= RNA_def_pointer(func, "keyingset", "KeyingSet", "", "Newly created Keying Set");
+	parm = RNA_def_pointer(func, "keyingset", "KeyingSet", "", "Newly created Keying Set");
 	RNA_def_function_return(func, parm);
 
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "KeyingSet");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
-	RNA_def_property_pointer_funcs(prop, "rna_Scene_active_keying_set_get", "rna_Scene_active_keying_set_set", NULL, NULL);
+	RNA_def_property_pointer_funcs(prop, "rna_Scene_active_keying_set_get",
+	                               "rna_Scene_active_keying_set_set", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
 	RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
 	
-	prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "active_keyingset");
-	RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get", "rna_Scene_active_keying_set_index_set", NULL);
+	RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get",
+	                           "rna_Scene_active_keying_set_index_set", NULL);
 	RNA_def_property_ui_text(prop, "Active Keying Set Index",
 	                         "Current Keying Set index (negative for 'builtin' and positive for 'absolute')");
 	RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
@@ -3966,22 +4038,24 @@ static void rna_def_scene_keying_sets_all(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 	
 	RNA_def_property_srna(cprop, "KeyingSetsAll");
-	srna= RNA_def_struct(brna, "KeyingSetsAll", NULL);
+	srna = RNA_def_struct(brna, "KeyingSetsAll", NULL);
 	RNA_def_struct_sdna(srna, "Scene");
 	RNA_def_struct_ui_text(srna, "Keying Sets All", "All available keying sets");
 	
 	/* NOTE: no add/remove available here, without screwing up this amalgamated list... */
 	
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "KeyingSet");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
-	RNA_def_property_pointer_funcs(prop, "rna_Scene_active_keying_set_get", "rna_Scene_active_keying_set_set", NULL, NULL);
+	RNA_def_property_pointer_funcs(prop, "rna_Scene_active_keying_set_get",
+	                               "rna_Scene_active_keying_set_set", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
 	RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
 	
-	prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "active_keyingset");
-	RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get", "rna_Scene_active_keying_set_index_set", NULL);
+	RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get",
+	                           "rna_Scene_active_keying_set_index_set", NULL);
 	RNA_def_property_ui_text(prop, "Active Keying Set Index",
 	                         "Current Keying Set index (negative for 'builtin' and positive for 'absolute')");
 	RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
@@ -3994,15 +4068,15 @@ static void rna_def_selected_uv_element(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "SelectedUvElement", "PropertyGroup");
+	srna = RNA_def_struct(brna, "SelectedUvElement", "PropertyGroup");
 	RNA_def_struct_ui_text(srna, "Selected UV Element", "");
 
 	/* store the index to the UV element selected */
-	prop= RNA_def_property(srna, "element_index", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "element_index", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_flag(prop, PROP_IDPROPERTY);
 	RNA_def_property_ui_text(prop, "Element Index", "");
 
-	prop= RNA_def_property(srna, "face_index", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "face_index", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_flag(prop, PROP_IDPROPERTY);
 	RNA_def_property_ui_text(prop, "Face Index", "");
 }
@@ -4032,20 +4106,20 @@ void RNA_def_scene(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}};
 
 	/* Struct definition */
-	srna= RNA_def_struct(brna, "Scene", "ID");
+	srna = RNA_def_struct(brna, "Scene", "ID");
 	RNA_def_struct_ui_text(srna, "Scene",
 	                       "Scene data block, consisting in objects and defining time and render related settings");
 	RNA_def_struct_ui_icon(srna, ICON_SCENE_DATA);
 	RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
 	
 	/* Global Settings */
-	prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Camera_object_poll");
 	RNA_def_property_ui_text(prop, "Camera", "Active camera, used for rendering the scene");
 	RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_view3d_update");
 
-	prop= RNA_def_property(srna, "background_set", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "background_set", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "set");
 	RNA_def_property_struct_type(prop, "Scene");
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
@@ -4053,26 +4127,27 @@ void RNA_def_scene(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Background Scene", "Background set scene");
 	RNA_def_property_update(prop, NC_SCENE|NA_EDITED, NULL);
 
-	prop= RNA_def_property(srna, "world", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "world", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "World", "World used for rendering the scene");
 	RNA_def_property_update(prop, NC_SCENE|ND_WORLD, "rna_Scene_glsl_update");
 
-	prop= RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ_LENGTH);
+	prop = RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ_LENGTH);
 	RNA_def_property_float_sdna(prop, NULL, "cursor");
 	RNA_def_property_ui_text(prop, "Cursor Location", "3D cursor location");
 	RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4);
 	RNA_def_property_update(prop, NC_WINDOW, NULL);
 	
 	/* Bases/Objects */
-	prop= RNA_def_property(srna, "object_bases", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "object_bases", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "base", NULL);
 	RNA_def_property_struct_type(prop, "ObjectBase");
 	RNA_def_property_ui_text(prop, "Bases", "");
-	RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, "rna_Scene_object_bases_lookup_string", NULL);
+	RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL,
+	                                  "rna_Scene_object_bases_lookup_string", NULL);
 	rna_def_scene_bases(brna, prop);
 
-	prop= RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "base", NULL);
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_ui_text(prop, "Objects", "");
@@ -4080,29 +4155,37 @@ void RNA_def_scene(BlenderRNA *brna)
 	rna_def_scene_objects(brna, prop);
 
 	/* Layers */
-	prop= RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
-	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); // this seems to be too much trouble with depsgraph updates/etc. currently (20110420)
+	prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
+		/* this seems to be too much trouble with depsgraph updates/etc. currently (20110420) */
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
 	RNA_def_property_array(prop, 20);
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_layer_set");
-	RNA_def_property_ui_text(prop, "Layers", "Layers visible when rendering the scene");
+	RNA_def_property_ui_text(prop, "Layers", "Visible layers - Shift-Click to select multiple layers");
 	RNA_def_property_update(prop, NC_SCENE|ND_LAYER, "rna_Scene_layer_update");
-	
+
+	/* active layer */
+	prop = RNA_def_property(srna, "active_layer", PROP_INT, PROP_NONE);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE|PROP_EDITABLE);
+	RNA_def_property_int_funcs(prop, "rna_Scene_active_layer_get", NULL, NULL);
+	RNA_def_property_ui_text(prop, "Active Layer", "Active scene layer index");
+
 	/* Frame Range Stuff */
-	prop= RNA_def_property(srna, "frame_current", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_current", PROP_INT, PROP_TIME);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_int_sdna(prop, NULL, "r.cfra");
 	RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
 	RNA_def_property_int_funcs(prop, NULL, "rna_Scene_current_frame_set", NULL);
-	RNA_def_property_ui_text(prop, "Current Frame", "Current Frame, to update animation data from python frame_set() instead");
+	RNA_def_property_ui_text(prop, "Current Frame",
+	                         "Current Frame, to update animation data from python frame_set() instead");
 	RNA_def_property_update(prop, NC_SCENE|ND_FRAME, "rna_Scene_frame_update");
 	
-	prop= RNA_def_property(srna, "frame_subframe", PROP_FLOAT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_subframe", PROP_FLOAT, PROP_TIME);
 	RNA_def_property_float_sdna(prop, NULL, "r.subframe");
 	RNA_def_property_ui_text(prop, "Current Sub-Frame", "");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE|PROP_EDITABLE);
 	
-	prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_int_sdna(prop, NULL, "r.sfra");
 	RNA_def_property_int_funcs(prop, NULL, "rna_Scene_start_frame_set", NULL);
@@ -4110,7 +4193,7 @@ void RNA_def_scene(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Start Frame", "First frame of the playback/rendering range");
 	RNA_def_property_update(prop, NC_SCENE|ND_FRAME_RANGE, NULL);
 	
-	prop= RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_int_sdna(prop, NULL, "r.efra");
 	RNA_def_property_int_funcs(prop, NULL, "rna_Scene_end_frame_set", NULL);
@@ -4118,32 +4201,34 @@ void RNA_def_scene(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "End Frame", "Final frame of the playback/rendering range");
 	RNA_def_property_update(prop, NC_SCENE|ND_FRAME_RANGE, NULL);
 	
-	prop= RNA_def_property(srna, "frame_step", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_step", PROP_INT, PROP_TIME);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_int_sdna(prop, NULL, "r.frame_step");
 	RNA_def_property_range(prop, 0, MAXFRAME);
 	RNA_def_property_ui_range(prop, 1, 100, 1, 0);
-	RNA_def_property_ui_text(prop, "Frame Step", "Number of frames to skip forward while rendering/playing back each frame");
+	RNA_def_property_ui_text(prop, "Frame Step",
+	                         "Number of frames to skip forward while rendering/playing back each frame");
 	RNA_def_property_update(prop, NC_SCENE|ND_FRAME, NULL);
 	
 	/* Preview Range (frame-range for UI playback) */
-	prop=RNA_def_property(srna, "use_preview_range", PROP_BOOLEAN, PROP_NONE); 
+	prop = RNA_def_property(srna, "use_preview_range", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_boolean_sdna(prop, NULL, "r.flag", SCER_PRV_RANGE);
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_use_preview_range_set");
 	RNA_def_property_ui_text(prop, "Use Preview Range",
-	                         "Use an alternative start/end frame for UI playback, rather than the scene start/end frame");
+	                         "Use an alternative start/end frame for UI playback, "
+	                         "rather than the scene start/end frame");
 	RNA_def_property_update(prop, NC_SCENE|ND_FRAME, NULL);
 	RNA_def_property_ui_icon(prop, ICON_PREVIEW_RANGE, 0);
 	
-	prop= RNA_def_property(srna, "frame_preview_start", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_preview_start", PROP_INT, PROP_TIME);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_int_sdna(prop, NULL, "r.psfra");
 	RNA_def_property_int_funcs(prop, NULL, "rna_Scene_preview_range_start_frame_set", NULL);
 	RNA_def_property_ui_text(prop, "Preview Range Start Frame", "Alternative start frame for UI playback");
 	RNA_def_property_update(prop, NC_SCENE|ND_FRAME, NULL);
 	
-	prop= RNA_def_property(srna, "frame_preview_end", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_preview_end", PROP_INT, PROP_TIME);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_int_sdna(prop, NULL, "r.pefra");
 	RNA_def_property_int_funcs(prop, NULL, "rna_Scene_preview_range_end_frame_set", NULL);
@@ -4151,7 +4236,7 @@ void RNA_def_scene(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_SCENE|ND_FRAME, NULL);
 	
 	/* Stamp */
-	prop= RNA_def_property(srna, "use_stamp_note", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "use_stamp_note", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "r.stamp_udata");
 	RNA_def_property_ui_text(prop, "Stamp Note", "User defined note for the render stamping");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
@@ -4160,7 +4245,7 @@ void RNA_def_scene(BlenderRNA *brna)
 	rna_def_animdata_common(srna);
 	
 	/* Readonly Properties */
-	prop= RNA_def_property(srna, "is_nla_tweakmode", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_nla_tweakmode", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_NLA_EDIT_ON);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* DO NOT MAKE THIS EDITABLE, OR NLA EDITOR BREAKS */
 	RNA_def_property_ui_text(prop, "NLA TweakMode",
@@ -4168,12 +4253,12 @@ void RNA_def_scene(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
 	
 	/* Frame dropping flag for playback and sync enum */
-	prop= RNA_def_property(srna, "use_frame_drop", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_frame_drop", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_FRAME_DROP);
 	RNA_def_property_ui_text(prop, "Frame Dropping", "Play back dropping frames if frame display is too slow");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "sync_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "sync_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_funcs(prop, "rna_Scene_sync_mode_get", "rna_Scene_sync_mode_set", NULL);
 	RNA_def_property_enum_items(prop, sync_mode_items);
 	RNA_def_property_ui_text(prop, "Sync Mode", "How to sync playback");
@@ -4181,32 +4266,34 @@ void RNA_def_scene(BlenderRNA *brna)
 
 
 	/* Nodes (Compositing) */
-	prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
 	RNA_def_property_ui_text(prop, "Node Tree", "Compositing node tree");
 
-	prop= RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1);
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_use_nodes_set");
 	RNA_def_property_ui_text(prop, "Use Nodes", "Enable the compositing node tree");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
 	/* Sequencer */
-	prop= RNA_def_property(srna, "sequence_editor", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "sequence_editor", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "ed");
 	RNA_def_property_struct_type(prop, "SequenceEditor");
 	RNA_def_property_ui_text(prop, "Sequence Editor", "");
 	
 	/* Keying Sets */
-	prop= RNA_def_property(srna, "keying_sets", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "keying_sets", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "keyingsets", NULL);
 	RNA_def_property_struct_type(prop, "KeyingSet");
 	RNA_def_property_ui_text(prop, "Absolute Keying Sets", "Absolute Keying Sets for this Scene");
 	RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
 	rna_def_scene_keying_sets(brna, prop);
 	
-	prop= RNA_def_property(srna, "keying_sets_all", PROP_COLLECTION, PROP_NONE);
-	RNA_def_property_collection_funcs(prop, "rna_Scene_all_keyingsets_begin", "rna_Scene_all_keyingsets_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL);
+	prop = RNA_def_property(srna, "keying_sets_all", PROP_COLLECTION, PROP_NONE);
+	RNA_def_property_collection_funcs(prop, "rna_Scene_all_keyingsets_begin", "rna_Scene_all_keyingsets_next",
+	                                  "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+	                                  NULL, NULL, NULL, NULL);
 	RNA_def_property_struct_type(prop, "KeyingSet");
 	RNA_def_property_ui_text(prop, "All Keying Sets",
 	                         "All Keying Sets available for use (Builtins and Absolute Keying Sets for this Scene)");
@@ -4214,85 +4301,85 @@ void RNA_def_scene(BlenderRNA *brna)
 	rna_def_scene_keying_sets_all(brna, prop);
 	
 	/* Tool Settings */
-	prop= RNA_def_property(srna, "tool_settings", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "tool_settings", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "toolsettings");
 	RNA_def_property_struct_type(prop, "ToolSettings");
 	RNA_def_property_ui_text(prop, "Tool Settings", "");
 
 	/* Unit Settings */
-	prop= RNA_def_property(srna, "unit_settings", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "unit_settings", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "unit");
 	RNA_def_property_struct_type(prop, "UnitSettings");
 	RNA_def_property_ui_text(prop, "Unit Settings", "Unit editing settings");
 
 	/* Physics Settings */
-	prop= RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
+	prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
 	RNA_def_property_float_sdna(prop, NULL, "physics_settings.gravity");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_range(prop, -200.0f, 200.0f);
 	RNA_def_property_ui_text(prop, "Gravity", "Constant acceleration in a given direction");
 	RNA_def_property_update(prop, 0, "rna_Physics_update");
 
-	prop= RNA_def_property(srna, "use_gravity", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_gravity", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "physics_settings.flag", PHYS_GLOBAL_GRAVITY);
 	RNA_def_property_ui_text(prop, "Global Gravity", "Use global gravity for all dynamics");
 	RNA_def_property_update(prop, 0, "rna_Physics_update");
 	
 	/* Render Data */
-	prop= RNA_def_property(srna, "render", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "render", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "r");
 	RNA_def_property_struct_type(prop, "RenderSettings");
 	RNA_def_property_ui_text(prop, "Render Data", "");
 	
 	/* Markers */
-	prop= RNA_def_property(srna, "timeline_markers", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "timeline_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, "Timeline Markers", "Markers used in all timelines for the current scene");
 	rna_def_timeline_markers(brna, prop);
 
 	/* Audio Settings */
-	prop= RNA_def_property(srna, "use_audio", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_audio", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_Scene_use_audio_get", "rna_Scene_use_audio_set");
 	RNA_def_property_ui_text(prop, "Audio Muted", "Play back of audio from Sequence Editor will be muted");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "use_audio_sync", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_audio_sync", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "audio.flag", AUDIO_SYNC);
 	RNA_def_property_ui_text(prop, "Audio Sync",
 	                         "Play back and sync with audio clock, dropping frames if frame display is too slow");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "use_audio_scrub", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_audio_scrub", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "audio.flag", AUDIO_SCRUB);
 	RNA_def_property_ui_text(prop, "Audio Scrubbing", "Play audio from Sequence Editor while scrubbing");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
-	prop= RNA_def_property(srna, "audio_doppler_speed", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "audio_doppler_speed", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "audio.speed_of_sound");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0.01f, FLT_MAX);
 	RNA_def_property_ui_text(prop, "Speed of Sound", "Speed of sound for Doppler effect calculation");
 	RNA_def_property_update(prop, NC_SCENE, "rna_Scene_listener_update");
 
-	prop= RNA_def_property(srna, "audio_doppler_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "audio_doppler_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "audio.doppler_factor");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0.0, FLT_MAX);
 	RNA_def_property_ui_text(prop, "Doppler Factor", "Pitch factor for Doppler effect calculation");
 	RNA_def_property_update(prop, NC_SCENE, "rna_Scene_listener_update");
 
-	prop= RNA_def_property(srna, "audio_distance_model", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "audio_distance_model", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "audio.distance_model");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_items(prop, audio_distance_model_items);
 	RNA_def_property_ui_text(prop, "Distance Model", "Distance model for distance attenuation calculation");
 	RNA_def_property_update(prop, NC_SCENE, "rna_Scene_listener_update");
 
-	prop= RNA_def_property(srna, "audio_volume", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "audio_volume", PROP_FLOAT, PROP_NONE);
 	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");
@@ -4300,19 +4387,19 @@ void RNA_def_scene(BlenderRNA *brna)
 	RNA_def_property_float_funcs(prop, NULL, "rna_Scene_volume_set", NULL);
 
 	/* Game Settings */
-	prop= RNA_def_property(srna, "game_settings", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "game_settings", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "gm");
 	RNA_def_property_struct_type(prop, "SceneGameData");
 	RNA_def_property_ui_text(prop, "Game Data", "");
 
 	/* Statistics */
-	func= RNA_def_function(srna, "statistics", "ED_info_stats_string");
-	prop= RNA_def_string(func, "statistics", "", 0, "Statistics", "");
+	func = RNA_def_function(srna, "statistics", "ED_info_stats_string");
+	prop = RNA_def_string(func, "statistics", "", 0, "Statistics", "");
 	RNA_def_function_return(func, prop);
 	
 	/* Grease Pencil */
-	prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "gpd");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "GreasePencil");
@@ -4320,13 +4407,13 @@ void RNA_def_scene(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 	
 	/* Transform Orientations */
-	prop= RNA_def_property(srna, "orientations", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "orientations", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "transform_spaces", NULL);
 	RNA_def_property_struct_type(prop, "TransformOrientation");
 	RNA_def_property_ui_text(prop, "Transform Orientations", "");
 
 	/* active MovieClip */
-	prop= RNA_def_property(srna, "active_clip", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active_clip", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "clip");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "MovieClip");
@@ -4349,4 +4436,3 @@ void RNA_def_scene(BlenderRNA *brna)
 }
 
 #endif
-
diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c
index 6d58863..08ed762 100644
--- a/source/blender/makesrna/intern/rna_scene_api.c
+++ b/source/blender/makesrna/intern/rna_scene_api.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
@@ -18,7 +18,7 @@
  * The Original Code is Copyright (C) 2009 Blender Foundation.
  * All rights reserved.
  *
- * 
+ *
  * Contributor(s): Joshua Leung, Arystanbek Dyussenov
  *
  * ***** END GPL LICENSE BLOCK *****
@@ -52,14 +52,14 @@
 
 static void rna_Scene_frame_set(Scene *scene, int frame, float subframe)
 {
-	scene->r.cfra= frame;
-	scene->r.subframe= subframe;
+	scene->r.cfra = frame;
+	scene->r.subframe = subframe;
 	
 	CLAMP(scene->r.cfra, MINAFRAME, MAXFRAME);
 	scene_update_for_newframe(G.main, scene, (1<<20) - 1);
 	scene_camera_switch_update(scene);
 
-	/* cant use NC_SCENE|ND_FRAME because this casues wm_event_do_notifiers to call 
+	/* cant use NC_SCENE|ND_FRAME because this casues wm_event_do_notifiers to call
 	 * scene_update_for_newframe which will loose any un-keyed changes [#24690] */
 	/* WM_main_add_notifier(NC_SCENE|ND_FRAME, scene); */
 	
@@ -74,10 +74,11 @@ static void rna_Scene_update_tagged(Scene *scene)
 
 static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name)
 {
-	if(BKE_imtype_is_movie(rd->im_format.imtype))
+	if (BKE_imtype_is_movie(rd->im_format.imtype))
 		BKE_makeanimstring(name, rd);
 	else
-		BKE_makepicstring(name, rd->pic, G.main->name, (frame==INT_MIN) ? rd->cfra : frame, rd->im_format.imtype, rd->scemode & R_EXTENSION, TRUE);
+		BKE_makepicstring(name, rd->pic, G.main->name, (frame == INT_MIN) ? rd->cfra : frame, rd->im_format.imtype,
+		                  rd->scemode & R_EXTENSION, TRUE);
 }
 
 #ifdef WITH_COLLADA
@@ -98,23 +99,24 @@ void RNA_api_scene(StructRNA *srna)
 	FunctionRNA *func;
 	PropertyRNA *parm;
 
-	func= RNA_def_function(srna, "frame_set", "rna_Scene_frame_set");
+	func = RNA_def_function(srna, "frame_set", "rna_Scene_frame_set");
 	RNA_def_function_ui_description(func, "Set scene frame updating all objects immediately");
-	parm= RNA_def_int(func, "frame", 0, MINAFRAME, MAXFRAME, "", "Frame number to set", MINAFRAME, MAXFRAME);
+	parm = RNA_def_int(func, "frame", 0, MINAFRAME, MAXFRAME, "", "Frame number to set", MINAFRAME, MAXFRAME);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_float(func, "subframe", 0.0, 0.0, 1.0, "", "Sub-frame time, between 0.0 and 1.0", 0.0, 1.0);
 
-	func= RNA_def_function(srna, "update", "rna_Scene_update_tagged");
-	RNA_def_function_ui_description(func, "Update data tagged to be updated from previous access to data or operators");
+	func = RNA_def_function(srna, "update", "rna_Scene_update_tagged");
+	RNA_def_function_ui_description(func,
+	                                "Update data tagged to be updated from previous access to data or operators");
 
 #ifdef WITH_COLLADA
 	/* don't remove this, as COLLADA exporting cannot be done through operators in render() callback. */
-	func= RNA_def_function(srna, "collada_export", "rna_Scene_collada_export");
-	parm= RNA_def_string(func, "filepath", "", FILE_MAX, "File Path", "File path to write Collada file");
+	func = RNA_def_function(srna, "collada_export", "rna_Scene_collada_export");
+	parm = RNA_def_string(func, "filepath", "", FILE_MAX, "File Path", "File path to write Collada file");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_property_subtype(parm, PROP_FILEPATH); /* allow non utf8 */
-	parm= RNA_def_boolean(func, "selected", 0, "Export only selected", "Export only selected elements");
-	parm= RNA_def_boolean(func, "second_life", 0, "Export for Second Life", "Compatibility mode for Second Life");
+	parm = RNA_def_boolean(func, "selected", 0, "Export only selected", "Export only selected elements");
+	parm = RNA_def_boolean(func, "second_life", 0, "Export for Second Life", "Compatibility mode for Second Life");
 	RNA_def_function_ui_description(func, "Export to collada file");
 #endif
 }
@@ -125,15 +127,14 @@ void RNA_api_scene_render(StructRNA *srna)
 	FunctionRNA *func;
 	PropertyRNA *parm;
 
-	func= RNA_def_function(srna, "frame_path", "rna_SceneRender_get_frame_path");
+	func = RNA_def_function(srna, "frame_path", "rna_SceneRender_get_frame_path");
 	RNA_def_function_ui_description(func, "Return the absolute path to the filename to be written for a given frame");
 	RNA_def_int(func, "frame", INT_MIN, INT_MIN, INT_MAX, "",
 	            "Frame number to use, if unset the current frame will be used", MINAFRAME, MAXFRAME);
-	parm= RNA_def_string_file_path(func, "filepath", "", FILE_MAX, "File Path",
+	parm = RNA_def_string_file_path(func, "filepath", "", FILE_MAX, "File Path",
 	                               "The resulting filepath from the scenes render settings");
 	RNA_def_property_flag(parm, PROP_THICK_WRAP); /* needed for string return value */
 	RNA_def_function_output(func, parm);
 }
 
 #endif
-
diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c
index fa1f6c7..67a4baf 100644
--- a/source/blender/makesrna/intern/rna_screen.c
+++ b/source/blender/makesrna/intern/rna_screen.c
@@ -58,33 +58,33 @@ EnumPropertyItem region_type_items[] = {
 
 static void rna_Screen_scene_set(PointerRNA *ptr, PointerRNA value)
 {
-	bScreen *sc= (bScreen*)ptr->data;
+	bScreen *sc = (bScreen*)ptr->data;
 
-	if(value.data == NULL)
+	if (value.data == NULL)
 		return;
 
-	sc->newscene= value.data;
+	sc->newscene = value.data;
 }
 
 static void rna_Screen_scene_update(bContext *C, PointerRNA *ptr)
 {
-	bScreen *sc= (bScreen*)ptr->data;
+	bScreen *sc = (bScreen*)ptr->data;
 
 	/* exception: must use context so notifier gets to the right window  */
-	if(sc->newscene) {
-		ED_screen_set_scene(C, sc->newscene);
+	if (sc->newscene) {
+		ED_screen_set_scene(C, sc, sc->newscene);
 		WM_event_add_notifier(C, NC_SCENE|ND_SCENEBROWSE, sc->newscene);
 
-		if(G.f & G_DEBUG)
+		if (G.debug & G_DEBUG)
 			printf("scene set %p\n", sc->newscene);
 
-		sc->newscene= NULL;
+		sc->newscene = NULL;
 	}
 }
 
-static void rna_Screen_redraw_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Screen_redraw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	bScreen *screen= (bScreen*)ptr->data;
+	bScreen *screen = (bScreen *)ptr->data;
 
 	/* the settings for this are currently only available from a menu in the TimeLine, hence refresh=SPACE_TIME */
 	ED_screen_animation_timer_update(screen, screen->redraws_flag, SPACE_TIME);
@@ -93,25 +93,25 @@ static void rna_Screen_redraw_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 
 static int rna_Screen_is_animation_playing_get(PointerRNA *ptr)
 {
-	bScreen *sc= (bScreen*)ptr->data;
+	bScreen *sc = (bScreen*)ptr->data;
 	return (sc->animtimer != NULL);
 }
 
 static int rna_Screen_fullscreen_get(PointerRNA *ptr)
 {
-	bScreen *sc= (bScreen*)ptr->data;
+	bScreen *sc = (bScreen*)ptr->data;
 	return (sc->full != 0);
 }
 
 static void rna_Area_type_set(PointerRNA *ptr, int value)
 {
-	ScrArea *sa= (ScrArea*)ptr->data;
-	sa->butspacetype= value;
+	ScrArea *sa = (ScrArea*)ptr->data;
+	sa->butspacetype = value;
 }
 
 static void rna_Area_type_update(bContext *C, PointerRNA *ptr)
 {
-	ScrArea *sa= (ScrArea*)ptr->data;
+	ScrArea *sa = (ScrArea*)ptr->data;
 
 	ED_area_newspace(C, sa, sa->butspacetype); /* XXX - this uses the window */
 	ED_area_tag_redraw(sa);
@@ -126,11 +126,11 @@ static void rna_def_area_spaces(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "AreaSpaces");
-	srna= RNA_def_struct(brna, "AreaSpaces", NULL);
+	srna = RNA_def_struct(brna, "AreaSpaces", NULL);
 	RNA_def_struct_sdna(srna, "ScrArea");
 	RNA_def_struct_ui_text(srna, "Area Spaces", "Collection of spaces");
 
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "spacedata.first");
 	RNA_def_property_struct_type(prop, "Space");
 	RNA_def_property_ui_text(prop, "Active Space", "Space currently being displayed in this area");
@@ -142,11 +142,11 @@ static void rna_def_area(BlenderRNA *brna)
 	PropertyRNA *prop;
 	FunctionRNA *func;
 
-	srna= RNA_def_struct(brna, "Area", NULL);
+	srna = RNA_def_struct(brna, "Area", NULL);
 	RNA_def_struct_ui_text(srna, "Area", "Area in a subdivided screen, containing an editor");
 	RNA_def_struct_sdna(srna, "ScrArea");
 
-	prop= RNA_def_property(srna, "spaces", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "spaces", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "spacedata", NULL);
 	RNA_def_property_struct_type(prop, "Space");
 	RNA_def_property_ui_text(prop, "Spaces",
@@ -155,16 +155,16 @@ static void rna_def_area(BlenderRNA *brna)
 	                         "in a certain area to get the old view orientation)");
 	rna_def_area_spaces(brna, prop);
 
-	prop= RNA_def_property(srna, "regions", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "regions", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "regionbase", NULL);
 	RNA_def_property_struct_type(prop, "Region");
 	RNA_def_property_ui_text(prop, "Regions", "Regions this area is subdivided in");
 
-	prop= RNA_def_property(srna, "show_menus", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_menus", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", HEADER_NO_PULLDOWN);
 	RNA_def_property_ui_text(prop, "Show Menus", "Show menus in the header");
 
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "spacetype");
 	RNA_def_property_enum_items(prop, space_type_items);
 	RNA_def_property_enum_funcs(prop, NULL, "rna_Area_type_set", NULL);
@@ -172,19 +172,19 @@ static void rna_def_area(BlenderRNA *brna)
 	RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
 	RNA_def_property_update(prop, 0, "rna_Area_type_update");
 
-	prop= RNA_def_property(srna, "width", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "width", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "winx");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Width", "Area width");
 
-	prop= RNA_def_property(srna, "height", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "height", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "winy");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Height", "Area height");
 
 	RNA_def_function(srna, "tag_redraw", "ED_area_tag_redraw");
 
-	func= RNA_def_function(srna, "header_text_set", "ED_area_headerprint");
+	func = RNA_def_function(srna, "header_text_set", "ED_area_headerprint");
 	RNA_def_function_ui_description(func, "Set the header text");
 	RNA_def_string(func, "text", NULL, 0, "Text", "New string for the header, no argument clears the text");
 }
@@ -194,27 +194,27 @@ static void rna_def_region(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "Region", NULL);
+	srna = RNA_def_struct(brna, "Region", NULL);
 	RNA_def_struct_ui_text(srna, "Region", "Region in a subdivided screen area");
 	RNA_def_struct_sdna(srna, "ARegion");
 
-	prop= RNA_def_property(srna, "id", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "id", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "swinid");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Region ID", "Unique ID for this region");
 
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "regiontype");
 	RNA_def_property_enum_items(prop, region_type_items);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Region Type", "Type of this region");
 
-	prop= RNA_def_property(srna, "width", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "width", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "winx");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Width", "Region width");
 
-	prop= RNA_def_property(srna, "height", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "height", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "winy");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Height", "Region height");
@@ -227,13 +227,13 @@ static void rna_def_screen(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "Screen", "ID");
+	srna = RNA_def_struct(brna, "Screen", "ID");
 	RNA_def_struct_sdna(srna, "Screen"); /* it is actually bScreen but for 2.5 the dna is patched! */
 	RNA_def_struct_ui_text(srna, "Screen", "Screen datablock, defining the layout of areas in a window");
 	RNA_def_struct_ui_icon(srna, ICON_SPLITSCREEN);
 
 	/* pointers */
-	prop= RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_NULL);
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_Screen_scene_set", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Scene", "Active scene to be edited in the screen");
@@ -241,59 +241,59 @@ static void rna_def_screen(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_Screen_scene_update");
 
 	/* collections */
-	prop= RNA_def_property(srna, "areas", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "areas", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "areabase", NULL);
 	RNA_def_property_struct_type(prop, "Area");
 	RNA_def_property_ui_text(prop, "Areas", "Areas the screen is subdivided into");
 
 	/* readonly status indicators */
-	prop= RNA_def_property(srna, "is_animation_playing", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_animation_playing", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Screen_is_animation_playing_get", NULL);
 	RNA_def_property_ui_text(prop, "Animation Playing", "Animation playback is active");
 
-	prop= RNA_def_property(srna, "show_fullscreen", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_fullscreen", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Screen_fullscreen_get", NULL);
 	RNA_def_property_ui_text(prop, "Fullscreen", "An area is maximised, filling this screen");
 
 	/* Define Anim Playback Areas */
-	prop= RNA_def_property(srna, "use_play_top_left_3d_editor", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_play_top_left_3d_editor", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_REGION);
 	RNA_def_property_ui_text(prop, "Top-Left 3D Editor", "");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update");
 
-	prop= RNA_def_property(srna, "use_play_3d_editors", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_play_3d_editors", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_3D_WIN);
 	RNA_def_property_ui_text(prop, "All 3D View Editors", "");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update");
 
-	prop= RNA_def_property(srna, "use_play_animation_editors", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_play_animation_editors", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_ANIM_WIN);
 	RNA_def_property_ui_text(prop, "Animation Editors", "");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update");
 
-	prop= RNA_def_property(srna, "use_play_properties_editors", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_play_properties_editors", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_BUTS_WIN);
 	RNA_def_property_ui_text(prop, "Property Editors", "");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update");
 
-	prop= RNA_def_property(srna, "use_play_image_editors", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_play_image_editors", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_IMAGE_WIN);
 	RNA_def_property_ui_text(prop, "Image Editors", "");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update");
 
-	prop= RNA_def_property(srna, "use_play_sequence_editors", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_play_sequence_editors", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_SEQ);
 	RNA_def_property_ui_text(prop, "Sequencer Editors", "");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update");
 
-	prop= RNA_def_property(srna, "use_play_node_editors", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_play_node_editors", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_NODES);
 	RNA_def_property_ui_text(prop, "Node Editors", "");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update");
 
-	prop= RNA_def_property(srna, "use_play_clip_editors", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_play_clip_editors", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_CLIPS);
 	RNA_def_property_ui_text(prop, "Clip Editors", "");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, "rna_Screen_redraw_update");
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index 6730499..c8aa5eb 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -79,11 +79,11 @@ static EnumPropertyItem particle_edit_cache_brush_items[] = {
 
 static PointerRNA rna_ParticleEdit_brush_get(PointerRNA *ptr)
 {
-	ParticleEditSettings *pset= (ParticleEditSettings*)ptr->data;
-	ParticleBrushData *brush= NULL;
+	ParticleEditSettings *pset = (ParticleEditSettings*)ptr->data;
+	ParticleBrushData *brush = NULL;
 
-	if(pset->brushtype != PE_BRUSH_NONE)
-		brush= &pset->brush[pset->brushtype];
+	if (pset->brushtype != PE_BRUSH_NONE)
+		brush = &pset->brush[pset->brushtype];
 
 	return rna_pointer_inherit_refine(ptr, &RNA_ParticleBrush, brush);
 }
@@ -95,10 +95,10 @@ static PointerRNA rna_ParticleBrush_curve_get(PointerRNA *ptr)
 
 static void rna_ParticleEdit_redo(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
 {
-	Object *ob= (scene->basact)? scene->basact->object: NULL;
+	Object *ob = (scene->basact)? scene->basact->object: NULL;
 	PTCacheEdit *edit = PE_get_current(scene, ob);
 
-	if(!edit)
+	if (!edit)
 		return;
 
 	psys_free_path_cache(edit->psys, edit);
@@ -106,18 +106,18 @@ static void rna_ParticleEdit_redo(Main *UNUSED(bmain), Scene *scene, PointerRNA
 
 static void rna_ParticleEdit_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
 {
-	Object *ob= (scene->basact)? scene->basact->object: NULL;
+	Object *ob = (scene->basact)? scene->basact->object: NULL;
 
-	if(ob) DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+	if (ob) DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 }
 static void rna_ParticleEdit_tool_set(PointerRNA *ptr, int value)
 {
-	ParticleEditSettings *pset= (ParticleEditSettings*)ptr->data;
+	ParticleEditSettings *pset = (ParticleEditSettings*)ptr->data;
 	
 	/* redraw hair completely if weight brush is/was used */
-	if((pset->brushtype == PE_BRUSH_WEIGHT || value == PE_BRUSH_WEIGHT) && pset->scene) {
+	if ((pset->brushtype == PE_BRUSH_WEIGHT || value == PE_BRUSH_WEIGHT) && pset->scene) {
 		Object *ob = (pset->scene->basact)? pset->scene->basact->object: NULL;
-		if(ob) {
+		if (ob) {
 			DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 			WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL);
 		}
@@ -128,20 +128,20 @@ static void rna_ParticleEdit_tool_set(PointerRNA *ptr, int value)
 static EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C, PointerRNA *UNUSED(ptr),
                                                      PropertyRNA *UNUSED(prop), int *UNUSED(free))
 {
-	Scene *scene= CTX_data_scene(C);
-	Object *ob= (scene->basact)? scene->basact->object: NULL;
+	Scene *scene = CTX_data_scene(C);
+	Object *ob = (scene->basact)? scene->basact->object: NULL;
 #if 0
 	PTCacheEdit *edit = PE_get_current(scene, ob);
-	ParticleSystem *psys= edit ? edit->psys : NULL;
+	ParticleSystem *psys = edit ? edit->psys : NULL;
 #else
 	/* use this rather than PE_get_current() - because the editing cache is
-	 * dependant on the cache being updated which can happen after this UI
+	 * dependent on the cache being updated which can happen after this UI
 	 * draws causing a glitch [#28883] */
-	ParticleSystem *psys= psys_get_current(ob);
+	ParticleSystem *psys = psys_get_current(ob);
 #endif
 
-	if(psys) {
-		if(psys->flag & PSYS_GLOBAL_HAIR) {
+	if (psys) {
+		if (psys->flag & PSYS_GLOBAL_HAIR) {
 			return particle_edit_disconnected_hair_brush_items;
 		}
 		else {
@@ -154,15 +154,15 @@ static EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C, PointerRNA *UN
 
 static int rna_ParticleEdit_editable_get(PointerRNA *ptr)
 {
-	ParticleEditSettings *pset= (ParticleEditSettings*)ptr->data;
+	ParticleEditSettings *pset = (ParticleEditSettings*)ptr->data;
 
 	return (pset->object && pset->scene && PE_get_current(pset->scene, pset->object));
 }
 static int rna_ParticleEdit_hair_get(PointerRNA *ptr)
 {
-	ParticleEditSettings *pset= (ParticleEditSettings*)ptr->data;
+	ParticleEditSettings *pset = (ParticleEditSettings*)ptr->data;
 
-	if(pset->scene) {
+	if (pset->scene) {
 		PTCacheEdit *edit = PE_get_current(pset->scene, pset->object);
 
 		return (edit && edit->psys);
@@ -173,21 +173,21 @@ static int rna_ParticleEdit_hair_get(PointerRNA *ptr)
 
 static int rna_Brush_mode_poll(PointerRNA *ptr, PointerRNA value)
 {
-	Scene *scene= (Scene *)ptr->id.data;
+	Scene *scene = (Scene *)ptr->id.data;
 	ToolSettings *ts = scene->toolsettings;
-	Brush *brush= value.id.data;
+	Brush *brush = value.id.data;
 	int mode = 0;
 
 	/* check the origin of the Paint struct to see which paint
-	   mode to select from */
+	 * mode to select from */
 
-	if(ptr->data == &ts->imapaint)
+	if (ptr->data == &ts->imapaint)
 		mode = OB_MODE_TEXTURE_PAINT;
-	else if(ptr->data == ts->sculpt)
+	else if (ptr->data == ts->sculpt)
 		mode = OB_MODE_SCULPT;
-	else if(ptr->data == ts->vpaint)
+	else if (ptr->data == ts->vpaint)
 		mode = OB_MODE_VERTEX_PAINT;
-	else if(ptr->data == ts->wpaint)
+	else if (ptr->data == ts->wpaint)
 		mode = OB_MODE_WEIGHT_PAINT;
 
 	return brush->ob_mode & mode;
@@ -195,9 +195,9 @@ static int rna_Brush_mode_poll(PointerRNA *ptr, PointerRNA value)
 
 static void rna_Sculpt_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
 {
-	Object *ob= (scene->basact)? scene->basact->object: NULL;
+	Object *ob = (scene->basact)? scene->basact->object: NULL;
 
-	if(ob) {
+	if (ob) {
 		DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 		WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob);
 	}
@@ -210,25 +210,25 @@ static void rna_def_paint(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "Paint", NULL);
+	srna = RNA_def_struct(brna, "Paint", NULL);
 	RNA_def_struct_ui_text(srna, "Paint", "");
 
 	/* Global Settings */
-	prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Brush_mode_poll");
 	RNA_def_property_ui_text(prop, "Brush", "Active Brush");
 	RNA_def_property_update(prop, NC_BRUSH|NA_EDITED, NULL);
 
-	prop= RNA_def_property(srna, "show_brush", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_brush", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_SHOW_BRUSH);
 	RNA_def_property_ui_text(prop, "Show Brush", "");
 
-	prop= RNA_def_property(srna, "show_brush_on_surface", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_brush_on_surface", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_SHOW_BRUSH_ON_SURFACE);
 	RNA_def_property_ui_text(prop, "Show Brush On Surface", "");
 
-	prop= RNA_def_property(srna, "show_low_resolution", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_low_resolution", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_FAST_NAVIGATE);
 	RNA_def_property_ui_text(prop, "Fast Navigate", "For multires, show low resolution while navigating the view");
 }
@@ -238,50 +238,52 @@ static void rna_def_sculpt(BlenderRNA  *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "Sculpt", "Paint");
+	srna = RNA_def_struct(brna, "Sculpt", "Paint");
 	RNA_def_struct_ui_text(srna, "Sculpt", "");
 
-	prop= RNA_def_property(srna, "radial_symmetry", PROP_INT, PROP_XYZ);
+	prop = RNA_def_property(srna, "radial_symmetry", PROP_INT, PROP_XYZ);
 	RNA_def_property_int_sdna(prop, NULL, "radial_symm");
 	RNA_def_property_int_default(prop, 1);
 	RNA_def_property_range(prop, 1, 64);
 	RNA_def_property_ui_range(prop, 0, 32, 1, 1);
-	RNA_def_property_ui_text(prop, "Radial Symmetry Count X Axis", "Number of times to copy strokes across the surface");
+	RNA_def_property_ui_text(prop, "Radial Symmetry Count X Axis",
+	                         "Number of times to copy strokes across the surface");
 
-	prop= RNA_def_property(srna, "use_symmetry_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_symmetry_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_X);
 	RNA_def_property_ui_text(prop, "Symmetry X", "Mirror brush across the X axis");
 
-	prop= RNA_def_property(srna, "use_symmetry_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_symmetry_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_Y);
 	RNA_def_property_ui_text(prop, "Symmetry Y", "Mirror brush across the Y axis");
 
-	prop= RNA_def_property(srna, "use_symmetry_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_symmetry_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_Z);
 	RNA_def_property_ui_text(prop, "Symmetry Z", "Mirror brush across the Z axis");
 
-	prop= RNA_def_property(srna, "lock_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_X);
 	RNA_def_property_ui_text(prop, "Lock X", "Disallow changes to the X axis of vertices");
 
-	prop= RNA_def_property(srna, "lock_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_Y);
 	RNA_def_property_ui_text(prop, "Lock Y", "Disallow changes to the Y axis of vertices");
 
-	prop= RNA_def_property(srna, "lock_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_Z);
 	RNA_def_property_ui_text(prop, "Lock Z", "Disallow changes to the Z axis of vertices");
 
-	prop= RNA_def_property(srna, "use_symmetry_feather", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_symmetry_feather", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMMETRY_FEATHER);
 	RNA_def_property_ui_text(prop, "Symmetry Feathering",
 	                         "Reduce the strength of the brush where it overlaps symmetrical daubs");
 
-	prop= RNA_def_property(srna, "use_threaded", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_threaded", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_USE_OPENMP);
-	RNA_def_property_ui_text(prop, "Use OpenMP", "Take advantage of multiple CPU cores to improve sculpting performance");
+	RNA_def_property_ui_text(prop, "Use OpenMP",
+	                         "Take advantage of multiple CPU cores to improve sculpting performance");
 
-	prop= RNA_def_property(srna, "use_deform_only", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_deform_only", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_ONLY_DEFORM);
 	RNA_def_property_ui_text(prop, "Use Deform Only",
 	                         "Use only deformation modifiers (temporary disable all "
@@ -294,7 +296,7 @@ static void rna_def_uv_sculpt(BlenderRNA  *brna)
 {
 	StructRNA *srna;
 
-	srna= RNA_def_struct(brna, "UvSculpt", "Paint");
+	srna = RNA_def_struct(brna, "UvSculpt", "Paint");
 	RNA_def_struct_ui_text(srna, "UV Sculpting", "");
 }
 
@@ -305,25 +307,25 @@ static void rna_def_vertex_paint(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "VertexPaint", "Paint");
+	srna = RNA_def_struct(brna, "VertexPaint", "Paint");
 	RNA_def_struct_sdna(srna, "VPaint");
 	RNA_def_struct_ui_text(srna, "Vertex Paint", "Properties of vertex and weight paint mode");
 
 	/* vertex paint only */
-	prop= RNA_def_property(srna, "use_all_faces", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_all_faces", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_AREA);
 	RNA_def_property_ui_text(prop, "All Faces", "Paint on all faces inside brush");
 
-	prop= RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_NORMALS);
 	RNA_def_property_ui_text(prop, "Normals", "Apply the vertex normal before painting");
 	
-	prop= RNA_def_property(srna, "use_spray", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_spray", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_SPRAY);
 	RNA_def_property_ui_text(prop, "Spray", "Keep applying paint effect while holding mouse");
 
 	/* weight paint only */
-	prop= RNA_def_property(srna, "use_group_restrict", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_group_restrict", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_ONLYVGROUP);
 	RNA_def_property_ui_text(prop, "Restrict", "Restrict painting to verts already apart of the vertex group");
 }
@@ -333,51 +335,52 @@ static void rna_def_image_paint(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "ImagePaint", "Paint");
+	srna = RNA_def_struct(brna, "ImagePaint", "Paint");
 	RNA_def_struct_sdna(srna, "ImagePaintSettings");
 	RNA_def_struct_ui_text(srna, "Image Paint", "Properties of image and texture painting mode");
 	
 	/* booleans */
-	prop= RNA_def_property(srna, "use_projection", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_projection", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_DISABLE);
-	RNA_def_property_ui_text(prop, "Project Paint", "Use projection painting for improved consistency in the brush strokes");
+	RNA_def_property_ui_text(prop, "Project Paint",
+	                         "Use projection painting for improved consistency in the brush strokes");
 	
-	prop= RNA_def_property(srna, "use_occlude", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_occlude", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_XRAY);
 	RNA_def_property_ui_text(prop, "Occlude", "Only paint onto the faces directly under the brush (slower)");
 	
-	prop= RNA_def_property(srna, "use_backface_culling", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_backface_culling", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_BACKFACE);
 	RNA_def_property_ui_text(prop, "Cull", "Ignore faces pointing away from the view (faster)");
 	
-	prop= RNA_def_property(srna, "use_normal_falloff", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_normal_falloff", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_FLAT);
 	RNA_def_property_ui_text(prop, "Normal", "Paint most on faces pointing towards the view");
 	
-	prop= RNA_def_property(srna, "use_stencil_layer", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_stencil_layer", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_STENCIL);
 	RNA_def_property_ui_text(prop, "Stencil Layer", "Set the mask layer from the UV map buttons");
 	
-	prop= RNA_def_property(srna, "invert_stencil", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_stencil", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_STENCIL_INV);
 	RNA_def_property_ui_text(prop, "Invert", "Invert the stencil layer");
 	
-	prop= RNA_def_property(srna, "use_clone_layer", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_clone_layer", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_CLONE);
 	RNA_def_property_ui_text(prop, "Clone Map",
 	                         "Use another UV map as clone source, otherwise use the 3D cursor as the source");
 	
 	/* integers */
 	
-	prop= RNA_def_property(srna, "seam_bleed", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "seam_bleed", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_ui_range(prop, 0, 8, 0, 0);
 	RNA_def_property_ui_text(prop, "Bleed", "Extend paint beyond the faces UVs to reduce seams (in pixels, slower)");
 
-	prop= RNA_def_property(srna, "normal_angle", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "normal_angle", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_range(prop, 0, 90);
 	RNA_def_property_ui_text(prop, "Angle", "Paint most on faces pointing towards the view according to this angle");
 
-	prop= RNA_def_int_array(srna, "screen_grab_size", 2, NULL, 0, 0, "screen_grab_size",
+	prop = RNA_def_int_array(srna, "screen_grab_size", 2, NULL, 0, 0, "screen_grab_size",
 	                        "Size to capture the image for re-projecting", 0, 0);
 	RNA_def_property_range(prop, 512, 16384);
 }
@@ -403,7 +406,7 @@ static void rna_def_particle_edit(BlenderRNA *brna)
 		{1, "SHRINK", 0, "Shrink", "Make hairs shorter"},
 		{0, NULL, 0, NULL, NULL}};
 
-	static EnumPropertyItem edit_type_items[]= {
+	static EnumPropertyItem edit_type_items[] = {
 		{PE_TYPE_PARTICLES, "PARTICLES", 0, "Particles", ""},
 		{PE_TYPE_SOFTBODY, "SOFT_BODY", 0, "Soft body", ""},
 		{PE_TYPE_CLOTH, "CLOTH", 0, "Cloth", ""},
@@ -413,142 +416,142 @@ static void rna_def_particle_edit(BlenderRNA *brna)
 
 	/* edit */
 
-	srna= RNA_def_struct(brna, "ParticleEdit", NULL);
+	srna = RNA_def_struct(brna, "ParticleEdit", NULL);
 	RNA_def_struct_sdna(srna, "ParticleEditSettings");
 	RNA_def_struct_ui_text(srna, "Particle Edit", "Properties of particle editing mode");
 
-	prop= RNA_def_property(srna, "tool", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "tool", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "brushtype");
 	RNA_def_property_enum_items(prop, particle_edit_hair_brush_items);
 	RNA_def_property_enum_funcs(prop, NULL, "rna_ParticleEdit_tool_set", "rna_ParticleEdit_tool_itemf");
 	RNA_def_property_ui_text(prop, "Tool", "");
 
-	prop= RNA_def_property(srna, "select_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "select_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "selectmode");
 	RNA_def_property_enum_items(prop, select_mode_items);
 	RNA_def_property_ui_text(prop, "Selection Mode", "Particle select and display mode");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_ParticleEdit_update");
 
-	prop= RNA_def_property(srna, "use_preserve_length", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_preserve_length", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_KEEP_LENGTHS);
 	RNA_def_property_ui_text(prop, "Keep Lengths", "Keep path lengths constant");
 
-	prop= RNA_def_property(srna, "use_preserve_root", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_preserve_root", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_LOCK_FIRST);
 	RNA_def_property_ui_text(prop, "Keep Root", "Keep root keys unmodified");
 
-	prop= RNA_def_property(srna, "use_emitter_deflect", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_emitter_deflect", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_DEFLECT_EMITTER);
 	RNA_def_property_ui_text(prop, "Deflect Emitter", "Keep paths from intersecting the emitter");
 
-	prop= RNA_def_property(srna, "emitter_distance", PROP_FLOAT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "emitter_distance", PROP_FLOAT, PROP_UNSIGNED);
 	RNA_def_property_float_sdna(prop, NULL, "emitterdist");
 	RNA_def_property_ui_range(prop, 0.0f, 10.0f, 10, 3);
 	RNA_def_property_ui_text(prop, "Emitter Distance", "Distance to keep particles away from the emitter");
 
-	prop= RNA_def_property(srna, "use_fade_time", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_fade_time", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_FADE_TIME);
 	RNA_def_property_ui_text(prop, "Fade Time", "Fade paths and keys further away from current frame");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_ParticleEdit_update");
 
-	prop= RNA_def_property(srna, "use_auto_velocity", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_auto_velocity", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_AUTO_VELOCITY);
 	RNA_def_property_ui_text(prop, "Auto Velocity", "Calculate point velocities automatically");
 
-	prop= RNA_def_property(srna, "show_particles", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_particles", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_DRAW_PART);
 	RNA_def_property_ui_text(prop, "Draw Particles", "Draw actual particles");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_ParticleEdit_redo");
 
-	prop= RNA_def_property(srna, "use_default_interpolate", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_default_interpolate", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_INTERPOLATE_ADDED);
 	RNA_def_property_ui_text(prop, "Interpolate", "Interpolate new particles from the existing ones");
 
-	prop= RNA_def_property(srna, "default_key_count", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "default_key_count", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "totaddkey");
 	RNA_def_property_range(prop, 2, SHRT_MAX);
 	RNA_def_property_ui_range(prop, 2, 20, 10, 3);
 	RNA_def_property_ui_text(prop, "Keys", "How many keys to make new particles with");
 
-	prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "ParticleBrush");
 	RNA_def_property_pointer_funcs(prop, "rna_ParticleEdit_brush_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Brush", "");
 
-	prop= RNA_def_property(srna, "draw_step", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "draw_step", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, 1, 10);
 	RNA_def_property_ui_text(prop, "Steps", "How many steps to draw the path with");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_ParticleEdit_redo");
 
-	prop= RNA_def_property(srna, "fade_frames", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "fade_frames", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, 1, 100);
 	RNA_def_property_ui_text(prop, "Frames", "How many frames to fade");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_ParticleEdit_update");
 
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "edittype");
 	RNA_def_property_enum_items(prop, edit_type_items);
 	RNA_def_property_ui_text(prop, "Type", "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_ParticleEdit_redo");
 
-	prop= RNA_def_property(srna, "is_editable", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_editable", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_ParticleEdit_editable_get", NULL);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Editable", "A valid edit mode exists");
 
-	prop= RNA_def_property(srna, "is_hair", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_hair", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_ParticleEdit_hair_get", NULL);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Hair", "Editing hair");
 
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Object", "The edited object");
 
 
 	/* brush */
 
-	srna= RNA_def_struct(brna, "ParticleBrush", NULL);
+	srna = RNA_def_struct(brna, "ParticleBrush", NULL);
 	RNA_def_struct_sdna(srna, "ParticleBrushData");
 	RNA_def_struct_ui_text(srna, "Particle Brush", "Particle editing brush");
 
-	prop= RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE);
 	RNA_def_property_range(prop, 1, SHRT_MAX);
 	RNA_def_property_ui_range(prop, 1, 100, 10, 3);
 	RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels");
 
-	prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_range(prop, 0.001, 1.0);
 	RNA_def_property_ui_text(prop, "Strength", "Brush strength");
 
-	prop= RNA_def_property(srna, "count", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "count", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, 1, 1000);
 	RNA_def_property_ui_range(prop, 1, 100, 10, 3);
 	RNA_def_property_ui_text(prop, "Count", "Particle count");
 
-	prop= RNA_def_property(srna, "steps", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "steps", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "step");
 	RNA_def_property_range(prop, 1, SHRT_MAX);
 	RNA_def_property_ui_range(prop, 1, 50, 10, 3);
 	RNA_def_property_ui_text(prop, "Steps", "Brush steps");
 
-	prop= RNA_def_property(srna, "puff_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "puff_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "invert");
 	RNA_def_property_enum_items(prop, puff_mode);
 	RNA_def_property_ui_text(prop, "Puff Mode", "");
 
-	prop= RNA_def_property(srna, "use_puff_volume", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_puff_volume", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_BRUSH_DATA_PUFF_VOLUME);
 	RNA_def_property_ui_text(prop, "Puff Volume",
 	                         "Apply puff to unselected end-points (helps maintain hair volume when puffing root)");
 
-	prop= RNA_def_property(srna, "length_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "length_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "invert");
 	RNA_def_property_enum_items(prop, length_mode);
 	RNA_def_property_ui_text(prop, "Length Mode", "");
 
 	/* dummy */
-	prop= RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "CurveMapping");
 	RNA_def_property_pointer_funcs(prop, "rna_ParticleBrush_curve_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Curve", "");
@@ -565,4 +568,3 @@ void RNA_def_sculpt_paint(BlenderRNA *brna)
 }
 
 #endif
-
diff --git a/source/blender/makesrna/intern/rna_sensor.c b/source/blender/makesrna/intern/rna_sensor.c
index 4413eee..ff336ba 100644
--- a/source/blender/makesrna/intern/rna_sensor.c
+++ b/source/blender/makesrna/intern/rna_sensor.c
@@ -40,7 +40,7 @@
 #include "WM_types.h"
 
 /* Always keep in alphabetical order */
-EnumPropertyItem sensor_type_items[] ={
+EnumPropertyItem sensor_type_items[] = {
 	{SENS_ACTUATOR, "ACTUATOR", 0, "Actuator", ""},
 	{SENS_ALWAYS, "ALWAYS", 0, "Always", ""},
 	{SENS_ARMATURE, "ARMATURE", 0, "Armature", ""},
@@ -65,9 +65,9 @@ EnumPropertyItem sensor_type_items[] ={
 
 static StructRNA* rna_Sensor_refine(struct PointerRNA *ptr)
 {
-	bSensor *sensor= (bSensor*)ptr->data;
+	bSensor *sensor = (bSensor*)ptr->data;
 
-	switch(sensor->type) {
+	switch (sensor->type) {
 		case SENS_ALWAYS:
 			return &RNA_AlwaysSensor;
 		case SENS_TOUCH:
@@ -105,21 +105,20 @@ static StructRNA* rna_Sensor_refine(struct PointerRNA *ptr)
 
 void rna_Sensor_name_set(PointerRNA *ptr, const char *value)
 {
-	bSensor *sens= (bSensor *)ptr->data;
+	bSensor *sens = (bSensor *)ptr->data;
 
 	BLI_strncpy_utf8(sens->name, value, sizeof(sens->name));
 
 	if (ptr->id.data) {
-		Object *ob= (Object *)ptr->id.data;
+		Object *ob = (Object *)ptr->id.data;
 		BLI_uniquename(&ob->sensors, sens, "Sensor", '.', offsetof(bSensor, name), sizeof(sens->name));
 	}
 }
 
 static void rna_Sensor_type_set(struct PointerRNA *ptr, int value)
 {
-	bSensor *sens= (bSensor *)ptr->data;
-	if (value != sens->type)
-	{
+	bSensor *sens = (bSensor *)ptr->data;
+	if (value != sens->type) {
 		sens->type = value;
 		init_sensor(sens);
 	}
@@ -141,13 +140,14 @@ static int rna_Sensor_controllers_length(PointerRNA *ptr)
 
 EnumPropertyItem *rna_Sensor_type_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
 {
-	EnumPropertyItem *item= NULL;
-	Object *ob=NULL;
-	int totitem= 0;
+	EnumPropertyItem *item = NULL;
+	Object *ob = NULL;
+	int totitem = 0;
 
 	if (ptr->type == &RNA_Sensor || RNA_struct_is_a(ptr->type, &RNA_Sensor)) {
 		ob = (Object *)ptr->id.data;
-	} else {
+	}
+	else {
 		/* can't use ob from ptr->id.data because that enum is also used by operators */
 		ob = CTX_data_active_object(C);
 	}
@@ -156,11 +156,11 @@ EnumPropertyItem *rna_Sensor_type_itemf(bContext *C, PointerRNA *ptr, PropertyRN
 	RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_ALWAYS);
 
 	if (ob != NULL) {
-		if (ob->type==OB_ARMATURE) {
+		if (ob->type == OB_ARMATURE) {
 			RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_ARMATURE);
 		}
 	}
-	RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_COLLISION);	
+	RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_COLLISION);
 	RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_DELAY);
 	RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_JOYSTICK);
 	RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_KEYBOARD);
@@ -174,14 +174,14 @@ EnumPropertyItem *rna_Sensor_type_itemf(bContext *C, PointerRNA *ptr, PropertyRN
 	RNA_enum_items_add_value(&item, &totitem, sensor_type_items, SENS_TOUCH);
 	
 	RNA_enum_item_end(&item, &totitem);
-	*free= 1;
+	*free = 1;
 	
 	return item;
 }
 
 static void rna_Sensor_keyboard_key_set(struct PointerRNA *ptr, int value)
 {
-	bSensor *sens= (bSensor *)ptr->data;
+	bSensor *sens = (bSensor *)ptr->data;
 	bKeyboardSensor *ks = (bKeyboardSensor *)sens->data;
 	
 	if (ISKEYBOARD(value))
@@ -192,7 +192,7 @@ static void rna_Sensor_keyboard_key_set(struct PointerRNA *ptr, int value)
 
 static void rna_Sensor_keyboard_modifier_set(struct PointerRNA *ptr, int value)
 {
-	bSensor *sens= (bSensor *)ptr->data;
+	bSensor *sens = (bSensor *)ptr->data;
 	bKeyboardSensor *ks = (bKeyboardSensor *)sens->data;
 	
 	if (ISKEYBOARD(value))
@@ -203,7 +203,7 @@ static void rna_Sensor_keyboard_modifier_set(struct PointerRNA *ptr, int value)
 		
 static void rna_Sensor_keyboard_modifier2_set(struct PointerRNA *ptr, int value)
 {
-	bSensor *sens= (bSensor *)ptr->data;
+	bSensor *sens = (bSensor *)ptr->data;
 	bKeyboardSensor *ks = (bKeyboardSensor *)sens->data;
 	
 	if (ISKEYBOARD(value))
@@ -214,43 +214,43 @@ static void rna_Sensor_keyboard_modifier2_set(struct PointerRNA *ptr, int value)
 
 static void rna_Sensor_tap_set(struct PointerRNA *ptr, int value)
 {
-	bSensor *sens= (bSensor*)ptr->data;
+	bSensor *sens = (bSensor*)ptr->data;
 
 	sens->tap = value;
-	if(sens->tap == 1)
+	if (sens->tap == 1)
 		sens->level = 0;
 }
 
 static void rna_Sensor_level_set(struct PointerRNA *ptr, int value)
 {
-	bSensor *sens= (bSensor*)ptr->data;
+	bSensor *sens = (bSensor*)ptr->data;
 
 	sens->level = value;
-	if(sens->level == 1)
+	if (sens->level == 1)
 		sens->tap = 0;
 }
 
 static void rna_Sensor_Armature_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	bSensor *sens= (bSensor *)ptr->data;
+	bSensor *sens = (bSensor *)ptr->data;
 	bArmatureSensor *as = sens->data;
 	Object *ob = (Object *)ptr->id.data;
 
-	char *posechannel= as->posechannel;
-	char *constraint= as->constraint;
+	char *posechannel = as->posechannel;
+	char *constraint = as->constraint;
 
 	/* check that bone exist in the active object */
 	if (ob->type == OB_ARMATURE && ob->pose) {
 		bPoseChannel *pchan;
 		bPose *pose = ob->pose;
-		for (pchan=pose->chanbase.first; pchan; pchan=pchan->next) {
+		for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
 			if (!strcmp(pchan->name, posechannel)) {
 				/* found it, now look for constraint channel */
 				bConstraint *con;
-				for (con=pchan->constraints.first; con; con=con->next) {
+				for (con = pchan->constraints.first; con; con = con->next) {
 					if (!strcmp(con->name, constraint)) {
 						/* found it, all ok */
-						return;						
+						return;
 					}
 				}
 				/* didn't find constraint, make empty */
@@ -279,73 +279,78 @@ static void rna_def_sensor(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "Sensor", NULL);
+	srna = RNA_def_struct(brna, "Sensor", NULL);
 	RNA_def_struct_ui_text(srna, "Sensor", "Game engine logic brick to detect events");
 	RNA_def_struct_sdna(srna, "bSensor");
 	RNA_def_struct_refine_func(srna, "rna_Sensor_refine");
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Name", "Sensor name");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Sensor_name_set");
 	RNA_def_struct_name_property(srna, prop);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_items(prop, sensor_type_items);
 	RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_type_set", "rna_Sensor_type_itemf");
 	RNA_def_property_ui_text(prop, "Type", "");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "pin", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "pin", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_PIN);
 	RNA_def_property_ui_text(prop, "Pinned", "Display when not linked to a visible states controller");
 	RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	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, "flag", SENS_SHOW);
 	RNA_def_property_ui_text(prop, "Expanded", "Set sensor expanded in the user interface");
 	RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Invert Output", "Invert the level(output) of this sensor");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_level", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_level", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "level", 1);
-	RNA_def_property_ui_text(prop, "Level", "Level detector, trigger controllers of new states(only applicable upon logic state transition)");
+	RNA_def_property_ui_text(prop, "Level",
+	                         "Level detector, trigger controllers of new states "
+	                         "(only applicable upon logic state transition)");
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_Sensor_level_set");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_pulse_true_level", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pulse_true_level", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "pulse", SENS_PULSE_REPEAT);
 	RNA_def_property_ui_text(prop, "Pulse True Level", "Activate TRUE level triggering (pulse mode)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_pulse_false_level", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pulse_false_level", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "pulse", SENS_NEG_PULSE_MODE);
 	RNA_def_property_ui_text(prop, "Pulse False Level", "Activate FALSE level triggering (pulse mode)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 	
-	prop= RNA_def_property(srna, "frequency", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "frequency", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "freq");
 	RNA_def_property_ui_text(prop, "Frequency", "Delay between repeated pulses(in logic tics, 0=no delay)");
 	RNA_def_property_range(prop, 0, 10000);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_tap", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_tap", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "tap", 1);
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_Sensor_tap_set");
-	RNA_def_property_ui_text(prop, "Tap", "Trigger controllers only for an instant, even while the sensor remains true");
+	RNA_def_property_ui_text(prop, "Tap",
+	                         "Trigger controllers only for an instant, even while the sensor remains true");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "controllers", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "controllers", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "links", NULL);
 	RNA_def_property_struct_type(prop, "Controller");
 	RNA_def_property_ui_text(prop, "Controllers", "The list containing the controllers connected to the sensor");
-	RNA_def_property_collection_funcs(prop, "rna_Sensor_controllers_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_dereference_get", "rna_Sensor_controllers_length", NULL, NULL, NULL);
+	RNA_def_property_collection_funcs(prop, "rna_Sensor_controllers_begin", "rna_iterator_array_next",
+	                                  "rna_iterator_array_end", "rna_iterator_array_dereference_get",
+	                                  "rna_Sensor_controllers_length", NULL, NULL, NULL);
 
 
 	RNA_api_sensor(srna);
@@ -354,7 +359,7 @@ static void rna_def_sensor(BlenderRNA *brna)
 static void rna_def_always_sensor(BlenderRNA *brna)
 {
 	StructRNA *srna;
-	srna= RNA_def_struct(brna, "AlwaysSensor", "Sensor");
+	srna = RNA_def_struct(brna, "AlwaysSensor", "Sensor");
 	RNA_def_struct_ui_text(srna, "Always Sensor", "Sensor to generate continuous pulses");
 }
 
@@ -363,22 +368,22 @@ static void rna_def_near_sensor(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "NearSensor", "Sensor");
+	srna = RNA_def_struct(brna, "NearSensor", "Sensor");
 	RNA_def_struct_ui_text(srna , "Near Sensor", "Sensor to detect nearby objects");
 	RNA_def_struct_sdna_from(srna, "bNearSensor", "data");
 
-	prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "name");
 	RNA_def_property_ui_text(prop, "Property", "Only look for objects with this property (blank = all objects)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "dist");
 	RNA_def_property_ui_text(prop, "Distance", "Trigger distance");
 	RNA_def_property_range(prop, 0.0f, 10000.0f);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "reset_distance", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "reset_distance", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "resetdist");
 	RNA_def_property_ui_text(prop, "Reset Distance", "The distance where the sensor forgets the actor");
 	RNA_def_property_range(prop, 0.0f, 10000.0f);
@@ -390,7 +395,7 @@ static void rna_def_mouse_sensor(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static EnumPropertyItem mouse_event_items[] ={
+	static EnumPropertyItem mouse_event_items[] = {
 		{BL_SENS_MOUSE_LEFT_BUTTON, "LEFTCLICK", 0, "Left Button", ""},
 		{BL_SENS_MOUSE_MIDDLE_BUTTON, "MIDDLECLICK", 0, "Middle Button", ""},
 		{BL_SENS_MOUSE_RIGHT_BUTTON, "RIGHTCLICK", 0, "Right Button", ""},
@@ -401,11 +406,11 @@ static void rna_def_mouse_sensor(BlenderRNA *brna)
 		{BL_SENS_MOUSE_MOUSEOVER_ANY, "MOUSEOVERANY", 0, "Mouse Over Any", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "MouseSensor", "Sensor");
+	srna = RNA_def_struct(brna, "MouseSensor", "Sensor");
 	RNA_def_struct_ui_text(srna, "Mouse Sensor", "Sensor to detect mouse events");
 	RNA_def_struct_sdna_from(srna, "bMouseSensor", "data");
 
-	prop= RNA_def_property(srna, "mouse_event", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mouse_event", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, mouse_event_items);
 	RNA_def_property_ui_text(prop, "Mouse Event", "Type of event this mouse sensor should trigger on");
@@ -417,11 +422,11 @@ static void rna_def_touch_sensor(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "TouchSensor", "Sensor");
+	srna = RNA_def_struct(brna, "TouchSensor", "Sensor");
 	RNA_def_struct_ui_text(srna, "Touch Sensor", "Sensor to detect objects colliding with the current object");
 	RNA_def_struct_sdna_from(srna, "bTouchSensor", "data");
 
-	prop= RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Material");
 	RNA_def_property_pointer_sdna(prop, NULL, "ma");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
@@ -436,42 +441,42 @@ static void rna_def_keyboard_sensor(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "KeyboardSensor", "Sensor");
+	srna = RNA_def_struct(brna, "KeyboardSensor", "Sensor");
 	RNA_def_struct_ui_text(srna, "Keyboard Sensor", "Sensor to detect keyboard events");
 	RNA_def_struct_sdna_from(srna, "bKeyboardSensor", "data");
 
-	prop= RNA_def_property(srna, "key", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "key", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "key");
 	RNA_def_property_enum_items(prop, event_type_items);
 	RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_keyboard_key_set", NULL);
 	RNA_def_property_ui_text(prop, "Key",  "");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 	
-	prop= RNA_def_property(srna, "modifier_key_1", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "modifier_key_1", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "qual");
 	RNA_def_property_enum_items(prop, event_type_items);
 	RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_keyboard_modifier_set", NULL);
 	RNA_def_property_ui_text(prop, "Modifier Key", "Modifier key code");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 	
-	prop= RNA_def_property(srna, "modifier_key_2", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "modifier_key_2", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "qual2");
 	RNA_def_property_enum_items(prop, event_type_items);
 	RNA_def_property_enum_funcs(prop, NULL, "rna_Sensor_keyboard_modifier2_set", NULL);
 	RNA_def_property_ui_text(prop, "Second Modifier Key", "Modifier key code");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "target", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "target", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "targetName");
 	RNA_def_property_ui_text(prop, "Target", "Property that receives the keystrokes in case a string is logged");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "log", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "log", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "toggleName");
 	RNA_def_property_ui_text(prop, "Log Toggle", "Property that indicates whether to log keystrokes as a string");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_all_keys", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_all_keys", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "type", 1);
 	RNA_def_property_ui_text(prop, "All Keys", "Trigger this sensor on any keystroke");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -481,7 +486,7 @@ static void rna_def_property_sensor(BlenderRNA *brna)
 {
 	StructRNA *srna;
 	PropertyRNA *prop;
-	static EnumPropertyItem prop_type_items[] ={
+	static EnumPropertyItem prop_type_items[] = {
 		{SENS_PROP_EQUAL, "PROPEQUAL", 0, "Equal", ""},
 		{SENS_PROP_NEQUAL, "PROPNEQUAL", 0, "Not Equal", ""},
 		{SENS_PROP_INTERVAL, "PROPINTERVAL", 0, "Interval", ""},
@@ -489,32 +494,32 @@ static void rna_def_property_sensor(BlenderRNA *brna)
 		/* {SENS_PROP_EXPRESSION, "PROPEXPRESSION", 0, "Expression", ""},  NOT_USED_IN_UI */
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "PropertySensor", "Sensor");
+	srna = RNA_def_struct(brna, "PropertySensor", "Sensor");
 	RNA_def_struct_ui_text(srna, "Property Sensor", "Sensor to detect values and changes in values of properties");
 	RNA_def_struct_sdna_from(srna, "bPropertySensor", "data");
 
-	prop= RNA_def_property(srna, "evaluation_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "evaluation_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_ui_text(prop, "Evaluation Type", "Type of property evaluation");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "name");
 	RNA_def_property_ui_text(prop, "Property", "");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "value", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "value", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "value");
 	RNA_def_property_ui_text(prop, "Value", "Check for this value in types in Equal or Not Equal types");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "value_min", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "value_min", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "value");
 	RNA_def_property_ui_text(prop, "Minimum Value", "Minimum value in Interval type");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "value_max", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "value_max", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "maxvalue");
 	RNA_def_property_ui_text(prop, "Maximum Value", "Maximum value in Interval type");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -524,7 +529,7 @@ static void rna_def_armature_sensor(BlenderRNA *brna)
 {
 	StructRNA *srna;
 	PropertyRNA *prop;
-	static EnumPropertyItem prop_type_items[] ={
+	static EnumPropertyItem prop_type_items[] = {
 		{SENS_ARM_STATE_CHANGED, "STATECHG", 0, "State Changed", ""},
 		{SENS_ARM_LIN_ERROR_BELOW, "LINERRORBELOW", 0, "Lin error below", ""},
 		{SENS_ARM_LIN_ERROR_ABOVE, "LINERRORABOVE", 0, "Lin error above", ""},
@@ -532,27 +537,27 @@ static void rna_def_armature_sensor(BlenderRNA *brna)
 		{SENS_ARM_ROT_ERROR_ABOVE, "ROTERRORABOVE", 0, "Rot error above", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "ArmatureSensor", "Sensor");
+	srna = RNA_def_struct(brna, "ArmatureSensor", "Sensor");
 	RNA_def_struct_ui_text(srna, "Armature Sensor", "Sensor to detect values and changes in values of IK solver");
 	RNA_def_struct_sdna_from(srna, "bArmatureSensor", "data");
 
-	prop= RNA_def_property(srna, "test_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "test_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, prop_type_items);
 	RNA_def_property_ui_text(prop, "Test", "Type of value and test");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "bone", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "bone", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "posechannel");
 	RNA_def_property_ui_text(prop, "Bone Name", "Identify the bone to check value from");
 	RNA_def_property_update(prop, NC_LOGIC, "rna_Sensor_Armature_update");
 
-	prop= RNA_def_property(srna, "constraint", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "constraint", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "constraint");
 	RNA_def_property_ui_text(prop, "Constraint Name", "Identify the bone constraint to check value from");
 	RNA_def_property_update(prop, NC_LOGIC, "rna_Sensor_Armature_update");
 
-	prop= RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "value");
 	RNA_def_property_ui_text(prop, "Compare Value", "Value to be used in comparison");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -563,12 +568,12 @@ static void rna_def_actuator_sensor(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "ActuatorSensor", "Sensor");
+	srna = RNA_def_struct(brna, "ActuatorSensor", "Sensor");
 	RNA_def_struct_ui_text(srna, "Actuator Sensor", "Sensor to detect state modifications of actuators");
 	RNA_def_struct_sdna_from(srna, "bActuatorSensor", "data");
 
-	// XXX if eventually have Logics using RNA 100%, we could use the actuator datablock isntead of its name
-	prop= RNA_def_property(srna, "actuator", PROP_STRING, PROP_NONE);
+	/* XXX if eventually have Logics using RNA 100%, we could use the actuator datablock isntead of its name */
+	prop = RNA_def_property(srna, "actuator", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "name");
 	RNA_def_property_ui_text(prop, "Actuator", "Actuator name, actuator active state modifications will be detected");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -579,23 +584,28 @@ static void rna_def_delay_sensor(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "DelaySensor", "Sensor");
+	srna = RNA_def_struct(brna, "DelaySensor", "Sensor");
 	RNA_def_struct_ui_text(srna, "Delay Sensor", "Sensor to send delayed events");
 	RNA_def_struct_sdna_from(srna, "bDelaySensor", "data");
 
-	prop= RNA_def_property(srna, "delay", PROP_INT, PROP_NONE);
-	RNA_def_property_ui_text(prop, "Delay", "Delay in number of logic tics before the positive trigger (default 60 per second)");
+	prop = RNA_def_property(srna, "delay", PROP_INT, PROP_NONE);
+	RNA_def_property_ui_text(prop, "Delay",
+	                         "Delay in number of logic tics before the positive trigger (default 60 per second)");
 	RNA_def_property_range(prop, 0, 5000);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "duration", PROP_INT, PROP_NONE);
-	RNA_def_property_ui_text(prop, "Duration", "If >0, delay in number of logic tics before the negative trigger following the positive trigger");
+	prop = RNA_def_property(srna, "duration", PROP_INT, PROP_NONE);
+	RNA_def_property_ui_text(prop, "Duration",
+	                         "If >0, delay in number of logic tics before the negative trigger following "
+	                         "the positive trigger");
 	RNA_def_property_range(prop, 0, 5000);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_repeat", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_repeat", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_DELAY_REPEAT);
-	RNA_def_property_ui_text(prop, "Repeat", "Toggle repeat option (if selected, the sensor restarts after Delay+Duration logic tics)");
+	RNA_def_property_ui_text(prop, "Repeat",
+	                         "Toggle repeat option (if selected, the sensor restarts after Delay+Duration "
+	                         "logic tics)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 }
 
@@ -604,46 +614,49 @@ static void rna_def_collision_sensor(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "CollisionSensor", "Sensor");
-	RNA_def_struct_ui_text(srna, "Collision Sensor", "Sensor to detect objects colliding with the current object, with more settings than the Touch sensor");
+	srna = RNA_def_struct(brna, "CollisionSensor", "Sensor");
+	RNA_def_struct_ui_text(srna, "Collision Sensor",
+	                       "Sensor to detect objects colliding with the current object, with more settings than "
+	                       "the Touch sensor");
 	RNA_def_struct_sdna_from(srna, "bCollisionSensor", "data");
 
-	prop= RNA_def_property(srna, "use_pulse", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pulse", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", SENS_COLLISION_PULSE);
 	RNA_def_property_ui_text(prop, "Pulse", "Change to the set of colliding objects generates pulse");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_material", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_material", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", SENS_COLLISION_MATERIAL);
 	RNA_def_property_ui_text(prop, "M/P", "Toggle collision on material or property");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "name");
 	RNA_def_property_ui_text(prop, "Property", "Only look for objects with this property (blank = all objects)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	//XXX to make a setFunction to create a lookup with all materials in Blend File (not only this object mat.)
-	prop= RNA_def_property(srna, "material", PROP_STRING, PROP_NONE);
+	/*XXX to make a setFunction to create a lookup with all materials in Blend File (not only this object mat.) */
+	prop = RNA_def_property(srna, "material", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "materialName");
 	RNA_def_property_ui_text(prop, "Material", "Only look for objects with this material (blank = all objects)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-/*//XXX either use a datablock look up to store the string name (material)
-  // or to do a doversion and use a material pointer.
-	prop= RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
+#if 0
+	/* XXX either use a datablock look up to store the string name (material)
+	 * or to do a doversion and use a material pointer. */
+	prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Material");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_pointer_sdna(prop, NULL, "ma");
 	RNA_def_property_ui_text(prop, "Material", "Only look for objects with this material (blank = all objects)");
-*/
+#endif
 }
 
 static void rna_def_radar_sensor(BlenderRNA *brna)
 {
 	StructRNA *srna;
 	PropertyRNA *prop;
-	static EnumPropertyItem axis_items[] ={
+	static EnumPropertyItem axis_items[] = {
 		{SENS_RADAR_X_AXIS, "XAXIS", 0, "+X axis", ""},
 		{SENS_RADAR_Y_AXIS, "YAXIS", 0, "+Y axis", ""},
 		{SENS_RADAR_Z_AXIS, "ZAXIS", 0, "+Z axis", ""},
@@ -652,27 +665,28 @@ static void rna_def_radar_sensor(BlenderRNA *brna)
 		{SENS_RADAR_NEG_Z_AXIS, "NEGZAXIS", 0, "-Z axis", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "RadarSensor", "Sensor");
-	RNA_def_struct_ui_text(srna, "Radar Sensor", "Sensor to detect objects in a cone shaped radar emanating from the current object");
+	srna = RNA_def_struct(brna, "RadarSensor", "Sensor");
+	RNA_def_struct_ui_text(srna, "Radar Sensor",
+	                       "Sensor to detect objects in a cone shaped radar emanating from the current object");
 	RNA_def_struct_sdna_from(srna, "bRadarSensor", "data");
 
-	prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "name");
 	RNA_def_property_ui_text(prop, "Property", "Only look for objects with this property (blank = all objects)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, axis_items);
 	RNA_def_property_ui_text(prop, "Axis", "Along which axis the radar cone is cast");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	//XXX TODO - use radians internally then change to PROP_ANGLE
-	prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE);
+	/*XXX TODO - use radians internally then change to PROP_ANGLE */
+	prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0, 179.9);
 	RNA_def_property_ui_text(prop, "Angle", "Opening angle of the radar cone (in degrees)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "range");
 	RNA_def_property_range(prop, 0.0, 10000.0);
 	RNA_def_property_ui_text(prop, "Distance", "Depth of the radar cone");
@@ -684,11 +698,11 @@ static void rna_def_random_sensor(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "RandomSensor", "Sensor");
+	srna = RNA_def_struct(brna, "RandomSensor", "Sensor");
 	RNA_def_struct_ui_text(srna, "Random Sensor", "Sensor to send random events");
 	RNA_def_struct_sdna_from(srna, "bRandomSensor", "data");
 
-	prop= RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, 0, 1000);
 	RNA_def_property_ui_text(prop, "Seed", "Initial seed of the generator (choose 0 for not random)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -698,7 +712,7 @@ static void rna_def_ray_sensor(BlenderRNA *brna)
 {
 	StructRNA *srna;
 	PropertyRNA *prop;
-	static EnumPropertyItem axis_items[] ={
+	static EnumPropertyItem axis_items[] = {
 		{SENS_RAY_X_AXIS, "XAXIS", 0, "+X axis", ""},
 		{SENS_RAY_Y_AXIS, "YAXIS", 0, "+Y axis", ""},
 		{SENS_RAY_Z_AXIS, "ZAXIS", 0, "+Z axis", ""},
@@ -707,51 +721,54 @@ static void rna_def_ray_sensor(BlenderRNA *brna)
 		{SENS_RAY_NEG_Z_AXIS, "NEGZAXIS", 0, "-Z axis", ""},
 		{0, NULL, 0, NULL, NULL}};
 	
-	static const EnumPropertyItem prop_ray_type_items[]= {
+	static const EnumPropertyItem prop_ray_type_items[] = {
 		{SENS_COLLISION_PROPERTY, "PROPERTY", ICON_LOGIC, "Property", "Use a material for ray intersections"},
 		{SENS_COLLISION_MATERIAL, "MATERIAL", ICON_MATERIAL_DATA, "Material", "Use a property for ray intersections"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "RaySensor", "Sensor");
-	RNA_def_struct_ui_text(srna, "Ray Sensor", "Sensor to detect intersections with a ray emanating from the current object");
+	srna = RNA_def_struct(brna, "RaySensor", "Sensor");
+	RNA_def_struct_ui_text(srna, "Ray Sensor",
+	                       "Sensor to detect intersections with a ray emanating from the current object");
 	RNA_def_struct_sdna_from(srna, "bRaySensor", "data");
 	
-	prop= RNA_def_property(srna, "ray_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "ray_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode");
 	RNA_def_property_enum_items(prop, prop_ray_type_items);
 	RNA_def_property_ui_text(prop, "Ray Type", "Toggle collision on material or property");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "property", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "propname");
 	RNA_def_property_ui_text(prop, "Property", "Only look for objects with this property (blank = all objects)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "material", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "material", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "matname");
 	RNA_def_property_ui_text(prop, "Material", "Only look for objects with this material (blank = all objects)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	/* //XXX either use a datablock look up to store the string name (material)
-	   // or to do a doversion and use a material pointer.
-	prop= RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
+#if 0
+	/* XXX either use a datablock look up to store the string name (material)
+	 * or to do a doversion and use a material pointer. */
+	prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Material");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_pointer_sdna(prop, NULL, "ma");
 	RNA_def_property_ui_text(prop, "Material", "Only look for objects with this material (blank = all objects)");
-*/
+#endif
 
-	prop= RNA_def_property(srna, "use_x_ray", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_x_ray", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", SENS_RAY_XRAY);
-	RNA_def_property_ui_text(prop, "X-Ray Mode", "Toggle X-Ray option (see through objects that don't have the property)");
+	RNA_def_property_ui_text(prop, "X-Ray Mode",
+	                         "Toggle X-Ray option (see through objects that don't have the property)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "range", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "range", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.01, 10000.0);
 	RNA_def_property_ui_text(prop, "Range", "Sense objects no farther than this distance");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "axisflag");
 	RNA_def_property_enum_items(prop, axis_items);
 	RNA_def_property_ui_text(prop, "Axis", "Along which axis the ray is cast");
@@ -763,12 +780,14 @@ static void rna_def_message_sensor(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "MessageSensor", "Sensor");
+	srna = RNA_def_struct(brna, "MessageSensor", "Sensor");
 	RNA_def_struct_ui_text(srna, "Message Sensor", "Sensor to detect incoming messages");
 	RNA_def_struct_sdna_from(srna, "bMessageSensor", "data");
 
-	prop= RNA_def_property(srna, "subject", PROP_STRING, PROP_NONE);
-	RNA_def_property_ui_text(prop, "Subject", "Optional subject filter: only accept messages with this subject, or empty to accept all");
+	prop = RNA_def_property(srna, "subject", PROP_STRING, PROP_NONE);
+	RNA_def_property_ui_text(prop, "Subject",
+	                         "Optional subject filter: only accept messages with this subject, "
+	                         "or empty to accept all");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 }
 
@@ -777,21 +796,21 @@ static void rna_def_joystick_sensor(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static EnumPropertyItem event_type_items[] ={
+	static EnumPropertyItem event_type_items[] = {
 		{SENS_JOY_BUTTON, "BUTTON", 0, "Button", ""},
 		{SENS_JOY_AXIS, "AXIS", 0, "Axis", ""},
 		{SENS_JOY_HAT, "HAT", 0, "Hat", ""},
 		{SENS_JOY_AXIS_SINGLE, "AXIS_SINGLE", 0, "Single Axis", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	static EnumPropertyItem axis_direction_items[] ={
+	static EnumPropertyItem axis_direction_items[] = {
 		{SENS_JOY_X_AXIS, "RIGHTAXIS", 0, "Right Axis", ""},
 		{SENS_JOY_Y_AXIS, "UPAXIS", 0, "Up Axis", ""},
 		{SENS_JOY_NEG_X_AXIS, "LEFTAXIS", 0, "Left Axis", ""},
 		{SENS_JOY_NEG_Y_AXIS, "DOWNAXIS", 0, "Down Axis", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	static EnumPropertyItem hat_direction_items[] ={
+	static EnumPropertyItem hat_direction_items[] = {
 		{SENS_JOY_HAT_UP, "UP", 0, "Up", ""},
 		{SENS_JOY_HAT_DOWN, "DOWN", 0, "Down", ""},
 		{SENS_JOY_HAT_LEFT, "LEFT", 0, "Left", ""},
@@ -803,68 +822,69 @@ static void rna_def_joystick_sensor(BlenderRNA *brna)
 		{SENS_JOY_HAT_DOWN_RIGHT, "DOWNRIGHT", 0, "Down/Right", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "JoystickSensor", "Sensor");
+	srna = RNA_def_struct(brna, "JoystickSensor", "Sensor");
 	RNA_def_struct_ui_text(srna, "Joystick Sensor", "Sensor to detect joystick events");
 	RNA_def_struct_sdna_from(srna, "bJoystickSensor", "data");
 	
-	prop= RNA_def_property(srna, "joystick_index", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "joystick_index", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "joyindex");
 	RNA_def_property_ui_text(prop, "Index", "Which joystick to use");
 	RNA_def_property_range(prop, 0, SENS_JOY_MAXINDEX-1);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "event_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "event_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, event_type_items);
 	RNA_def_property_ui_text(prop, "Event Type", "The type of event this joystick sensor is triggered on");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "use_all_events", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_all_events", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SENS_JOY_ANY_EVENT);
-	RNA_def_property_ui_text(prop, "All Events", "Triggered by all events on this joystick's current type (axis/button/hat)");
+	RNA_def_property_ui_text(prop, "All Events",
+	                         "Triggered by all events on this joystick's current type (axis/button/hat)");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* Button */
-	prop= RNA_def_property(srna, "button_number", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "button_number", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "button");
 	RNA_def_property_ui_text(prop, "Button Number", "Which button to use");
 	RNA_def_property_range(prop, 0, 18);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* Axis */
-	prop= RNA_def_property(srna, "axis_number", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "axis_number", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "axis");
 	RNA_def_property_ui_text(prop, "Axis Number", "Which axis pair to use, 1 is usually the main direction input");
 	RNA_def_property_range(prop, 1, 8);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "axis_threshold", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "axis_threshold", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "precision");
 	RNA_def_property_ui_text(prop, "Axis Threshold", "Precision of the axis");
 	RNA_def_property_range(prop, 0, 32768);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "axis_direction", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "axis_direction", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "axisf");
 	RNA_def_property_enum_items(prop, axis_direction_items);
 	RNA_def_property_ui_text(prop, "Axis Direction", "The direction of the axis");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* Single Axis */
-	prop= RNA_def_property(srna, "single_axis_number", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "single_axis_number", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "axis_single");
 	RNA_def_property_ui_text(prop, "Axis Number", "Single axis (vertical/horizontal/other) to detect");
 	RNA_def_property_range(prop, 1, 16);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* Hat */
-	prop= RNA_def_property(srna, "hat_number", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "hat_number", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "hat");
 	RNA_def_property_ui_text(prop, "Hat Number", "Which hat to use");
 	RNA_def_property_range(prop, 1, 2);
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "hat_direction", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "hat_direction", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "hatf");
 	RNA_def_property_enum_items(prop, hat_direction_items);
 	RNA_def_property_ui_text(prop, "Hat Direction", "Hat direction");
@@ -893,4 +913,3 @@ void RNA_def_sensor(BlenderRNA *brna)
 }
 
 #endif
-
diff --git a/source/blender/makesrna/intern/rna_sensor_api.c b/source/blender/makesrna/intern/rna_sensor_api.c
index bb1afd8..fd0c6f6 100644
--- a/source/blender/makesrna/intern/rna_sensor_api.c
+++ b/source/blender/makesrna/intern/rna_sensor_api.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
@@ -18,7 +18,7 @@
  * The Original Code is Copyright (C) 2010 Blender Foundation.
  * All rights reserved.
  *
- * 
+ *
  * Contributor(s):
  *
  * ***** END GPL LICENSE BLOCK *****
@@ -58,15 +58,15 @@ void RNA_api_sensor(StructRNA *srna)
 	FunctionRNA *func;
 	PropertyRNA *parm;
 
-	func= RNA_def_function(srna, "link", "rna_Sensor_link");
+	func = RNA_def_function(srna, "link", "rna_Sensor_link");
 	RNA_def_function_ui_description(func, "Link the sensor to a controller");
-	parm= RNA_def_pointer(func, "controller", "Controller", "", "Controller to link to"); 
+	parm = RNA_def_pointer(func, "controller", "Controller", "", "Controller to link to");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_property_update(parm, NC_LOGIC, NULL);
 
-	func= RNA_def_function(srna, "unlink", "rna_Sensor_unlink");
+	func = RNA_def_function(srna, "unlink", "rna_Sensor_unlink");
 	RNA_def_function_ui_description(func, "Unlink the sensor from a controller");
-	parm= RNA_def_pointer(func, "controller", "Controller", "", "Controller to unlink from"); 
+	parm = RNA_def_pointer(func, "controller", "Controller", "", "Controller to unlink from");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_property_update(parm, NC_LOGIC, NULL);
 }
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index 4da4e65..c94d420 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -37,6 +37,7 @@
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_sequence_types.h"
+#include "DNA_movieclip_types.h"
 
 #include "BKE_animsys.h"
 #include "BKE_global.h"
@@ -53,9 +54,9 @@
 /* build a temp referene to the parent */
 static void meta_tmp_ref(Sequence *seq_par, Sequence *seq)
 {
-	for (; seq; seq= seq->next) {
-		seq->tmp= seq_par;
-		if(seq->type == SEQ_META) {
+	for (; seq; seq = seq->next) {
+		seq->tmp = seq_par;
+		if (seq->type == SEQ_META) {
 			meta_tmp_ref(seq, seq->seqbase.first);
 		}
 	}
@@ -63,8 +64,8 @@ static void meta_tmp_ref(Sequence *seq_par, Sequence *seq)
 
 static void rna_SequenceEditor_sequences_all_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Scene *scene= (Scene*)ptr->id.data;
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Scene *scene = (Scene*)ptr->id.data;
+	Editing *ed = seq_give_editing(scene, FALSE);
 
 	meta_tmp_ref(NULL, ed->seqbase.first);
 
@@ -73,32 +74,32 @@ static void rna_SequenceEditor_sequences_all_begin(CollectionPropertyIterator *i
 
 static void rna_SequenceEditor_sequences_all_next(CollectionPropertyIterator *iter)
 {
-	ListBaseIterator *internal= iter->internal;
-	Sequence *seq= (Sequence*)internal->link;
+	ListBaseIterator *internal = iter->internal;
+	Sequence *seq = (Sequence*)internal->link;
 
-	if(seq->seqbase.first)
-		internal->link= (Link*)seq->seqbase.first;
-	else if(seq->next)
-		internal->link= (Link*)seq->next;
+	if (seq->seqbase.first)
+		internal->link = (Link*)seq->seqbase.first;
+	else if (seq->next)
+		internal->link = (Link*)seq->next;
 	else {
-		internal->link= NULL;
+		internal->link = NULL;
 
 		do {
-			seq= seq->tmp; // XXX - seq's dont reference their parents!
-			if(seq && seq->next) {
-				internal->link= (Link*)seq->next;
+			seq = seq->tmp; /* XXX - seq's don't reference their parents! */
+			if (seq && seq->next) {
+				internal->link = (Link*)seq->next;
 				break;
 			}
-		} while(seq);
+		} while (seq);
 	}
 
-	iter->valid= (internal->link != NULL);
+	iter->valid = (internal->link != NULL);
 }
 
 /* internal use */
 static int rna_SequenceEditor_elements_length(PointerRNA *ptr)
 {
-	Sequence *seq= (Sequence*)ptr->data;
+	Sequence *seq = (Sequence*)ptr->data;
 
 	/* Hack? copied from sequencer.c::reload_sequence_new_file() */
 	size_t olen = MEM_allocN_len(seq->strip->stripdata)/sizeof(struct StripElem);
@@ -109,26 +110,27 @@ static int rna_SequenceEditor_elements_length(PointerRNA *ptr)
 
 static void rna_SequenceEditor_elements_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	Sequence *seq= (Sequence*)ptr->data;
-	rna_iterator_array_begin(iter, (void*)seq->strip->stripdata, sizeof(StripElem), rna_SequenceEditor_elements_length(ptr), 0, NULL);
+	Sequence *seq = (Sequence*)ptr->data;
+	rna_iterator_array_begin(iter, (void*)seq->strip->stripdata, sizeof(StripElem),
+	                         rna_SequenceEditor_elements_length(ptr), 0, NULL);
 }
 
 static void rna_Sequence_frame_change_update(Scene *scene, Sequence *seq)
 {
-	Editing *ed= seq_give_editing(scene, FALSE);
-	ListBase *seqbase= seq_seqbase(&ed->seqbase, seq);
+	Editing *ed = seq_give_editing(scene, FALSE);
+	ListBase *seqbase = seq_seqbase(&ed->seqbase, seq);
 	calc_sequence_disp(scene, seq);
 
-	if(seq_test_overlap(seqbase, seq)) {
-		shuffle_seq(seqbase, seq, scene); // XXX - BROKEN!, uses context seqbasep
+	if (seq_test_overlap(seqbase, seq)) {
+		shuffle_seq(seqbase, seq, scene); /* XXX - BROKEN!, uses context seqbasep */
 	}
 	sort_seq(scene);
 }
 
 static void rna_Sequence_start_frame_set(PointerRNA *ptr, int value)
 {
-	Sequence *seq= (Sequence*)ptr->data;
-	Scene *scene= (Scene*)ptr->id.data;
+	Sequence *seq = (Sequence*)ptr->data;
+	Scene *scene = (Scene*)ptr->id.data;
 	
 	seq_translate(scene, seq, value - seq->start);
 	rna_Sequence_frame_change_update(scene, seq);
@@ -136,8 +138,8 @@ static void rna_Sequence_start_frame_set(PointerRNA *ptr, int value)
 
 static void rna_Sequence_start_frame_final_set(PointerRNA *ptr, int value)
 {
-	Sequence *seq= (Sequence*)ptr->data;
-	Scene *scene= (Scene*)ptr->id.data;
+	Sequence *seq = (Sequence*)ptr->data;
+	Scene *scene = (Scene*)ptr->id.data;
 
 	seq_tx_set_final_left(seq, value);
 	seq_single_fix(seq);
@@ -146,8 +148,8 @@ static void rna_Sequence_start_frame_final_set(PointerRNA *ptr, int value)
 
 static void rna_Sequence_end_frame_final_set(PointerRNA *ptr, int value)
 {
-	Sequence *seq= (Sequence*)ptr->data;
-	Scene *scene= (Scene*)ptr->id.data;
+	Sequence *seq = (Sequence*)ptr->data;
+	Scene *scene = (Scene*)ptr->id.data;
 
 	seq_tx_set_final_right(seq, value);
 	seq_single_fix(seq);
@@ -156,8 +158,8 @@ static void rna_Sequence_end_frame_final_set(PointerRNA *ptr, int value)
 
 static void rna_Sequence_anim_startofs_final_set(PointerRNA *ptr, int value)
 {
-	Sequence *seq= (Sequence*)ptr->data;
-	Scene *scene= (Scene*)ptr->id.data;
+	Sequence *seq = (Sequence*)ptr->data;
+	Scene *scene = (Scene*)ptr->id.data;
 
 	seq->anim_startofs = MIN2(value, seq->len + seq->anim_startofs);
 
@@ -167,8 +169,8 @@ static void rna_Sequence_anim_startofs_final_set(PointerRNA *ptr, int value)
 
 static void rna_Sequence_anim_endofs_final_set(PointerRNA *ptr, int value)
 {
-	Sequence *seq= (Sequence*)ptr->data;
-	Scene *scene= (Scene*)ptr->id.data;
+	Sequence *seq = (Sequence*)ptr->data;
+	Scene *scene = (Scene*)ptr->id.data;
 
 	seq->anim_endofs = MIN2(value, seq->len + seq->anim_endofs);
 
@@ -178,8 +180,8 @@ static void rna_Sequence_anim_endofs_final_set(PointerRNA *ptr, int value)
 
 static void rna_Sequence_frame_length_set(PointerRNA *ptr, int value)
 {
-	Sequence *seq= (Sequence*)ptr->data;
-	Scene *scene= (Scene*)ptr->id.data;
+	Sequence *seq = (Sequence*)ptr->data;
+	Scene *scene = (Scene*)ptr->id.data;
 	
 	seq_tx_set_final_right(seq, seq->start+value);
 	rna_Sequence_frame_change_update(scene, seq);
@@ -187,7 +189,7 @@ static void rna_Sequence_frame_length_set(PointerRNA *ptr, int value)
 
 static int rna_Sequence_frame_length_get(PointerRNA *ptr)
 {
-	Sequence *seq= (Sequence*)ptr->data;
+	Sequence *seq = (Sequence*)ptr->data;
 	return seq_tx_get_final_right(seq, 0)-seq_tx_get_final_left(seq, 0);
 }
 
@@ -200,15 +202,15 @@ static int rna_Sequence_frame_editable(PointerRNA *ptr)
 
 static void rna_Sequence_channel_set(PointerRNA *ptr, int value)
 {
-	Sequence *seq= (Sequence*)ptr->data;
-	Scene *scene= (Scene*)ptr->id.data;
-	Editing *ed= seq_give_editing(scene, FALSE);
-	ListBase *seqbase= seq_seqbase(&ed->seqbase, seq);
+	Sequence *seq = (Sequence*)ptr->data;
+	Scene *scene = (Scene*)ptr->id.data;
+	Editing *ed = seq_give_editing(scene, FALSE);
+	ListBase *seqbase = seq_seqbase(&ed->seqbase, seq);
 
-	seq->machine= value;
+	seq->machine = value;
 	
-	if( seq_test_overlap(seqbase, seq) ) {
-		shuffle_seq(seqbase, seq, scene);  // XXX - BROKEN!, uses context seqbasep
+	if ( seq_test_overlap(seqbase, seq) ) {
+		shuffle_seq(seqbase, seq, scene);  /* XXX - BROKEN!, uses context seqbasep */
 	}
 	sort_seq(scene);
 }
@@ -216,73 +218,77 @@ static void rna_Sequence_channel_set(PointerRNA *ptr, int value)
 /* properties that need to allocate structs */
 static void rna_Sequence_use_color_balance_set(PointerRNA *ptr, int value)
 {
-	Sequence *seq= (Sequence*)ptr->data;
+	Sequence *seq = (Sequence*)ptr->data;
 	int c;
 	
-	if(value) {
+	if (value) {
 		seq->flag |= SEQ_USE_COLOR_BALANCE;
-		if(seq->strip->color_balance == NULL) {
+		if (seq->strip->color_balance == NULL) {
 			seq->strip->color_balance = MEM_callocN(sizeof(struct StripColorBalance), "StripColorBalance");
-			for (c=0; c<3; c++) {
+			for (c = 0; c<3; c++) {
 				seq->strip->color_balance->lift[c] = 1.0f;
 				seq->strip->color_balance->gamma[c] = 1.0f;
 				seq->strip->color_balance->gain[c] = 1.0f;
 			}
 		}
-	} else {
+	}
+	else {
 		seq->flag ^= SEQ_USE_COLOR_BALANCE;
 	}
 }
 
 static void rna_Sequence_use_proxy_set(PointerRNA *ptr, int value)
 {
-	Sequence *seq= (Sequence*)ptr->data;
-	if(value) {
+	Sequence *seq = (Sequence*)ptr->data;
+	if (value) {
 		seq->flag |= SEQ_USE_PROXY;
-		if(seq->strip->proxy == NULL) {
+		if (seq->strip->proxy == NULL) {
 			seq->strip->proxy = MEM_callocN(sizeof(struct StripProxy), "StripProxy");
 			seq->strip->proxy->quality = 90;
 			seq->strip->proxy->build_tc_flags = SEQ_PROXY_TC_ALL;
-			seq->strip->proxy->build_size_flags 
+			seq->strip->proxy->build_size_flags
 				= SEQ_PROXY_IMAGE_SIZE_25;
 		}
-	} else {
+	}
+	else {
 		seq->flag ^= SEQ_USE_PROXY;
 	}
 }
 
 static void rna_Sequence_use_translation_set(PointerRNA *ptr, int value)
 {
-	Sequence *seq= (Sequence*)ptr->data;
-	if(value) {
+	Sequence *seq = (Sequence*)ptr->data;
+	if (value) {
 		seq->flag |= SEQ_USE_TRANSFORM;
-		if(seq->strip->transform == NULL) {
+		if (seq->strip->transform == NULL) {
 			seq->strip->transform = MEM_callocN(sizeof(struct StripTransform), "StripTransform");
 		}
-	} else {
+	}
+	else {
 		seq->flag ^= SEQ_USE_TRANSFORM;
 	}
 }
 
 static void rna_Sequence_use_crop_set(PointerRNA *ptr, int value)
 {
-	Sequence *seq= (Sequence*)ptr->data;
-	if(value) {
+	Sequence *seq = (Sequence*)ptr->data;
+	if (value) {
 		seq->flag |= SEQ_USE_CROP;
-		if(seq->strip->crop == NULL) {
+		if (seq->strip->crop == NULL) {
 			seq->strip->crop = MEM_callocN(sizeof(struct StripCrop), "StripCrop");
 		}
-	} else {
+	}
+	else {
 		seq->flag ^= SEQ_USE_CROP;
 	}
 }
 
 static int transform_seq_cmp_cb(Sequence *seq, void *arg_pt)
 {
-	struct { Sequence *seq; void *transform; } *data= arg_pt;
+	struct { Sequence *seq; void *transform; } *data = arg_pt;
 
-	if(seq->strip && seq->strip->transform == data->transform) {
-		data->seq= seq;
+	if (seq->strip && seq->strip->transform == data->transform) {
+		data->seq = seq;
 		return -1; /* done so bail out */
 	}
 	return 1;
@@ -290,17 +296,17 @@ static int transform_seq_cmp_cb(Sequence *seq, void *arg_pt)
 
 static char *rna_SequenceTransform_path(PointerRNA *ptr)
 {
-	Scene *scene= ptr->id.data;
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Scene *scene = ptr->id.data;
+	Editing *ed = seq_give_editing(scene, FALSE);
 	Sequence *seq;
 
 	struct { Sequence *seq; void *transform; } data;
-	data.seq= NULL;
-	data.transform= ptr->data;
+	data.seq = NULL;
+	data.transform = ptr->data;
 
 	/* irritating we need to search for our sequence! */
 	seqbase_recursive_apply(&ed->seqbase, transform_seq_cmp_cb, &data);
-	seq= data.seq;
+	seq = data.seq;
 
 	if (seq && seq->name+2)
 		return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].transform", seq->name+2);
@@ -310,10 +316,10 @@ static char *rna_SequenceTransform_path(PointerRNA *ptr)
 
 static int crop_seq_cmp_cb(Sequence *seq, void *arg_pt)
 {
-	struct { Sequence *seq; void *crop; } *data= arg_pt;
+	struct { Sequence *seq; void *crop; } *data = arg_pt;
 
-	if(seq->strip && seq->strip->crop == data->crop) {
-		data->seq= seq;
+	if (seq->strip && seq->strip->crop == data->crop) {
+		data->seq = seq;
 		return -1; /* done so bail out */
 	}
 	return 1;
@@ -321,17 +327,17 @@ static int crop_seq_cmp_cb(Sequence *seq, void *arg_pt)
 
 static char *rna_SequenceCrop_path(PointerRNA *ptr)
 {
-	Scene *scene= ptr->id.data;
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Scene *scene = ptr->id.data;
+	Editing *ed = seq_give_editing(scene, FALSE);
 	Sequence *seq;
 
 	struct { Sequence *seq; void *crop; } data;
-	data.seq= NULL;
-	data.crop= ptr->data;
+	data.seq = NULL;
+	data.crop = ptr->data;
 
 	/* irritating we need to search for our sequence! */
 	seqbase_recursive_apply(&ed->seqbase, crop_seq_cmp_cb, &data);
-	seq= data.seq;
+	seq = data.seq;
 
 	if (seq && seq->name+2)
 		return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].crop", seq->name+2);
@@ -343,20 +349,20 @@ static char *rna_SequenceCrop_path(PointerRNA *ptr)
 /* name functions that ignore the first two characters */
 static void rna_Sequence_name_get(PointerRNA *ptr, char *value)
 {
-	Sequence *seq= (Sequence*)ptr->data;
+	Sequence *seq = (Sequence*)ptr->data;
 	BLI_strncpy(value, seq->name+2, sizeof(seq->name)-2);
 }
 
 static int rna_Sequence_name_length(PointerRNA *ptr)
 {
-	Sequence *seq= (Sequence*)ptr->data;
+	Sequence *seq = (Sequence*)ptr->data;
 	return strlen(seq->name+2);
 }
 
 static void rna_Sequence_name_set(PointerRNA *ptr, const char *value)
 {
-	Scene *scene= (Scene*)ptr->id.data;
-	Sequence *seq= (Sequence*)ptr->data;
+	Scene *scene = (Scene*)ptr->id.data;
+	Sequence *seq = (Sequence*)ptr->data;
 	char oldname[sizeof(seq->name)];
 	AnimData *adt;
 	
@@ -371,18 +377,18 @@ static void rna_Sequence_name_set(PointerRNA *ptr, const char *value)
 	
 	/* fix all the animation data which may link to this */
 
-	/* dont rename everywhere because these are per scene */
-	/* BKE_all_animdata_fix_paths_rename("sequence_editor.sequences_all", oldname, seq->name+2); */
-	adt= BKE_animdata_from_id(&scene->id);
-	if(adt)
-		BKE_animdata_fix_paths_rename(&scene->id, adt, "sequence_editor.sequences_all", oldname, seq->name+2, 0, 0, 1);
+	/* don't rename everywhere because these are per scene */
+	/* BKE_all_animdata_fix_paths_rename(NULL, "sequence_editor.sequences_all", oldname, seq->name+2); */
+	adt = BKE_animdata_from_id(&scene->id);
+	if (adt)
+		BKE_animdata_fix_paths_rename(&scene->id, adt, NULL, "sequence_editor.sequences_all", oldname, seq->name+2, 0, 0, 1);
 }
 
 static StructRNA* rna_Sequence_refine(struct PointerRNA *ptr)
 {
-	Sequence *seq= (Sequence*)ptr->data;
+	Sequence *seq = (Sequence*)ptr->data;
 
-	switch(seq->type) {
+	switch (seq->type) {
 		case SEQ_IMAGE:
 			return &RNA_ImageSequence;
 		case SEQ_META:
@@ -391,6 +397,8 @@ static StructRNA* rna_Sequence_refine(struct PointerRNA *ptr)
 			return &RNA_SceneSequence;
 		case SEQ_MOVIE:
 			return &RNA_MovieSequence;
+		case SEQ_MOVIECLIP:
+			return &RNA_MovieClipSequence;
 		case SEQ_SOUND:
 			return &RNA_SoundSequence;
 		case SEQ_CROSS:
@@ -425,9 +433,9 @@ static StructRNA* rna_Sequence_refine(struct PointerRNA *ptr)
 
 static char *rna_Sequence_path(PointerRNA *ptr)
 {
-	Sequence *seq= (Sequence*)ptr->data;
+	Sequence *seq = (Sequence*)ptr->data;
 	
-	/* sequencer data comes from scene... 
+	/* sequencer data comes from scene...
 	 * TODO: would be nice to make SequenceEditor data a datablock of its own (for shorter paths)
 	 */
 	if (seq->name+2)
@@ -438,8 +446,8 @@ static char *rna_Sequence_path(PointerRNA *ptr)
 
 static PointerRNA rna_SequenceEditor_meta_stack_get(CollectionPropertyIterator *iter)
 {
-	ListBaseIterator *internal= iter->internal;
-	MetaStack *ms= (MetaStack*)internal->link;
+	ListBaseIterator *internal = iter->internal;
+	MetaStack *ms = (MetaStack*)internal->link;
 
 	return rna_pointer_inherit_refine(&iter->parent, &RNA_Sequence, ms->parseq);
 }
@@ -447,9 +455,9 @@ static PointerRNA rna_SequenceEditor_meta_stack_get(CollectionPropertyIterator *
 /* TODO, expose seq path setting as a higher level sequencer BKE function */
 static void rna_Sequence_filepath_set(PointerRNA *ptr, const char *value)
 {
-	Sequence *seq= (Sequence*)(ptr->data);
+	Sequence *seq = (Sequence*)(ptr->data);
 
-	if(seq->type == SEQ_SOUND && seq->sound) {
+	if (seq->type == SEQ_SOUND && seq->sound) {
 		/* for sound strips we need to update the sound as well.
 		 * arguably, this could load in a new sound rather than modify an existing one.
 		 * but while using the sequencer its most likely your not using the sound in the game engine too.
@@ -461,19 +469,20 @@ static void rna_Sequence_filepath_set(PointerRNA *ptr, const char *value)
 		sound_update_scene_sound(seq->scene_sound, seq->sound);
 	}
 
-	BLI_split_dirfile(value, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir), sizeof(seq->strip->stripdata->name));
+	BLI_split_dirfile(value, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir),
+	                  sizeof(seq->strip->stripdata->name));
 }
 
 static void rna_Sequence_filepath_get(PointerRNA *ptr, char *value)
 {
-	Sequence *seq= (Sequence*)(ptr->data);
+	Sequence *seq = (Sequence*)(ptr->data);
 
 	BLI_join_dirfile(value, FILE_MAX, seq->strip->dir, seq->strip->stripdata->name);
 }
 
 static int rna_Sequence_filepath_length(PointerRNA *ptr)
 {
-	Sequence *seq= (Sequence*)(ptr->data);
+	Sequence *seq = (Sequence*)(ptr->data);
 	char path[FILE_MAX];
 
 	BLI_join_dirfile(path, sizeof(path), seq->strip->dir, seq->strip->stripdata->name);
@@ -482,20 +491,20 @@ static int rna_Sequence_filepath_length(PointerRNA *ptr)
 
 static void rna_Sequence_proxy_filepath_set(PointerRNA *ptr, const char *value)
 {
-	StripProxy *proxy= (StripProxy*)(ptr->data);
+	StripProxy *proxy = (StripProxy*)(ptr->data);
 	BLI_split_dirfile(value, proxy->dir, proxy->file, sizeof(proxy->dir), sizeof(proxy->file));
 }
 
 static void rna_Sequence_proxy_filepath_get(PointerRNA *ptr, char *value)
 {
-	StripProxy *proxy= (StripProxy*)(ptr->data);
+	StripProxy *proxy = (StripProxy*)(ptr->data);
 
 	BLI_join_dirfile(value, FILE_MAX, proxy->dir, proxy->file);
 }
 
 static int rna_Sequence_proxy_filepath_length(PointerRNA *ptr)
 {
-	StripProxy *proxy= (StripProxy*)(ptr->data);
+	StripProxy *proxy = (StripProxy*)(ptr->data);
 	char path[FILE_MAX];
 
 	BLI_join_dirfile(path, sizeof(path), proxy->dir, proxy->file);
@@ -504,42 +513,43 @@ static int rna_Sequence_proxy_filepath_length(PointerRNA *ptr)
 
 static void rna_Sequence_volume_set(PointerRNA *ptr, float value)
 {
-	Sequence *seq= (Sequence*)(ptr->data);
+	Sequence *seq = (Sequence*)(ptr->data);
 
 	seq->volume = value;
-	if(seq->scene_sound)
+	if (seq->scene_sound)
 		sound_set_scene_sound_volume(seq->scene_sound, value, (seq->flag & SEQ_AUDIO_VOLUME_ANIMATED) != 0);
 }
 
 static void rna_Sequence_pitch_set(PointerRNA *ptr, float value)
 {
-	Sequence *seq= (Sequence*)(ptr->data);
+	Sequence *seq = (Sequence*)(ptr->data);
 
 	seq->pitch = value;
-	if(seq->scene_sound)
+	if (seq->scene_sound)
 		sound_set_scene_sound_pitch(seq->scene_sound, value, (seq->flag & SEQ_AUDIO_PITCH_ANIMATED) != 0);
 }
 
 static void rna_Sequence_pan_set(PointerRNA *ptr, float value)
 {
-	Sequence *seq= (Sequence*)(ptr->data);
+	Sequence *seq = (Sequence*)(ptr->data);
 
 	seq->pan = value;
-	if(seq->scene_sound)
+	if (seq->scene_sound)
 		sound_set_scene_sound_pan(seq->scene_sound, value, (seq->flag & SEQ_AUDIO_PAN_ANIMATED) != 0);
 }
 
 
 static int rna_Sequence_input_count_get(PointerRNA *ptr)
 {
-	Sequence *seq= (Sequence*)(ptr->data);
+	Sequence *seq = (Sequence*)(ptr->data);
 
 	return get_sequence_effect_num_inputs(seq->type);
 }
 /*static void rna_SoundSequence_filename_set(PointerRNA *ptr, const char *value)
 {
 	Sequence *seq= (Sequence*)(ptr->data);
-	BLI_split_dirfile(value, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir), sizeof(seq->strip->stripdata->name));
+	BLI_split_dirfile(value, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir),
+	                  sizeof(seq->strip->stripdata->name));
 }
 
 static void rna_SequenceElement_filename_set(PointerRNA *ptr, const char *value)
@@ -550,25 +560,25 @@ static void rna_SequenceElement_filename_set(PointerRNA *ptr, const char *value)
 
 static void rna_Sequence_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
 {
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Editing *ed = seq_give_editing(scene, FALSE);
 
-	if(ed)
+	if (ed)
 		free_imbuf_seq(scene, &ed->seqbase, FALSE, TRUE);
 }
 
 static void rna_Sequence_update_reopen_files(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
 {
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Editing *ed = seq_give_editing(scene, FALSE);
 
 	free_imbuf_seq(scene, &ed->seqbase, FALSE, FALSE);
 
-	if(RNA_struct_is_a(ptr->type, &RNA_SoundSequence))
+	if (RNA_struct_is_a(ptr->type, &RNA_SoundSequence))
 		seq_update_sound_bounds(scene, ptr->data);
 }
 
 static void rna_Sequence_mute_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Editing *ed = seq_give_editing(scene, FALSE);
 
 	seq_update_muting(ed);
 	rna_Sequence_update(bmain, scene, ptr);
@@ -576,7 +586,7 @@ static void rna_Sequence_mute_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 
 static void rna_Sequence_filepath_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Sequence *seq= (Sequence*)(ptr->data);
+	Sequence *seq = (Sequence*)(ptr->data);
 	reload_sequence_new_file(scene, seq, TRUE);
 	calc_sequence(scene, seq);
 	rna_Sequence_update(bmain, scene, ptr);
@@ -584,10 +594,10 @@ static void rna_Sequence_filepath_update(Main *bmain, Scene *scene, PointerRNA *
 
 static int seqproxy_seq_cmp_cb(Sequence *seq, void *arg_pt)
 {
-	struct { Sequence *seq; void *seq_proxy; } *data= arg_pt;
+	struct { Sequence *seq; void *seq_proxy; } *data = arg_pt;
 
-	if(seq->strip && seq->strip->proxy == data->seq_proxy) {
-		data->seq= seq;
+	if (seq->strip && seq->strip->proxy == data->seq_proxy) {
+		data->seq = seq;
 		return -1; /* done so bail out */
 	}
 	return 1;
@@ -595,16 +605,16 @@ static int seqproxy_seq_cmp_cb(Sequence *seq, void *arg_pt)
 
 static void rna_Sequence_tcindex_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Editing *ed = seq_give_editing(scene, FALSE);
 	Sequence *seq;
 
 	struct { Sequence *seq; void *seq_proxy; } data;
 
-	data.seq= NULL;
+	data.seq = NULL;
 	data.seq_proxy = ptr->data;
 
 	seqbase_recursive_apply(&ed->seqbase, seqproxy_seq_cmp_cb, &data);
-	seq= data.seq;
+	seq = data.seq;
 
 	reload_sequence_new_file(scene, seq, FALSE);
 	rna_Sequence_frame_change_update(scene, seq);
@@ -613,12 +623,12 @@ static void rna_Sequence_tcindex_update(Main *bmain, Scene *scene, PointerRNA *p
 /* do_versions? */
 static float rna_Sequence_opacity_get(PointerRNA *ptr)
 {
-	Sequence *seq= (Sequence*)(ptr->data);
+	Sequence *seq = (Sequence*)(ptr->data);
 	return seq->blend_opacity / 100.0f;
 }
 static void rna_Sequence_opacity_set(PointerRNA *ptr, float value)
 {
-	Sequence *seq= (Sequence*)(ptr->data);
+	Sequence *seq = (Sequence*)(ptr->data);
 	CLAMP(value, 0.0f, 1.0f);
 	seq->blend_opacity = value * 100.0f;
 }
@@ -626,27 +636,27 @@ static void rna_Sequence_opacity_set(PointerRNA *ptr, float value)
 
 static int colbalance_seq_cmp_cb(Sequence *seq, void *arg_pt)
 {
-	struct { Sequence *seq; void *color_balance; } *data= arg_pt;
+	struct { Sequence *seq; void *color_balance; } *data = arg_pt;
 
-	if(seq->strip && seq->strip->color_balance == data->color_balance) {
-		data->seq= seq;
+	if (seq->strip && seq->strip->color_balance == data->color_balance) {
+		data->seq = seq;
 		return -1; /* done so bail out */
 	}
 	return 1;
 }
 static char *rna_SequenceColorBalance_path(PointerRNA *ptr)
 {
-	Scene *scene= ptr->id.data;
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Scene *scene = ptr->id.data;
+	Editing *ed = seq_give_editing(scene, FALSE);
 	Sequence *seq;
 
 	struct { Sequence *seq; void *color_balance; } data;
-	data.seq= NULL;
-	data.color_balance= ptr->data;
+	data.seq = NULL;
+	data.color_balance = ptr->data;
 
 	/* irritating we need to search for our sequence! */
 	seqbase_recursive_apply(&ed->seqbase, colbalance_seq_cmp_cb, &data);
-	seq= data.seq;
+	seq = data.seq;
 
 	if (seq && seq->name+2)
 		return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].color_balance", seq->name+2);
@@ -656,32 +666,32 @@ static char *rna_SequenceColorBalance_path(PointerRNA *ptr)
 
 static void rna_SequenceEditor_overlay_lock_set(PointerRNA *ptr, int value)
 {
-	Scene *scene= ptr->id.data;
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Scene *scene = ptr->id.data;
+	Editing *ed = seq_give_editing(scene, FALSE);
 
-	if(ed==NULL)
+	if (ed == NULL)
 		return;
 
 	/* convert from abs to relative and back */
-	if((ed->over_flag & SEQ_EDIT_OVERLAY_ABS)==0 && value) {
-		ed->over_cfra= scene->r.cfra + ed->over_ofs;
+	if ((ed->over_flag & SEQ_EDIT_OVERLAY_ABS) == 0 && value) {
+		ed->over_cfra = scene->r.cfra + ed->over_ofs;
 		ed->over_flag |= SEQ_EDIT_OVERLAY_ABS;
 	}
-	else if((ed->over_flag & SEQ_EDIT_OVERLAY_ABS) && !value) {
-		ed->over_ofs= ed->over_cfra - scene->r.cfra;
+	else if ((ed->over_flag & SEQ_EDIT_OVERLAY_ABS) && !value) {
+		ed->over_ofs = ed->over_cfra - scene->r.cfra;
 		ed->over_flag &= ~SEQ_EDIT_OVERLAY_ABS;
 	}
 }
 
 static int rna_SequenceEditor_overlay_frame_get(PointerRNA *ptr)
 {
-	Scene *scene= (Scene *)ptr->id.data;
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Scene *scene = (Scene *)ptr->id.data;
+	Editing *ed = seq_give_editing(scene, FALSE);
 
-	if(ed==NULL)
+	if (ed == NULL)
 		return scene->r.cfra;
 
-	if(ed->over_flag & SEQ_EDIT_OVERLAY_ABS)
+	if (ed->over_flag & SEQ_EDIT_OVERLAY_ABS)
 		return ed->over_cfra - scene->r.cfra;
 	else
 		return ed->over_ofs;
@@ -690,31 +700,31 @@ static int rna_SequenceEditor_overlay_frame_get(PointerRNA *ptr)
 
 static void rna_SequenceEditor_overlay_frame_set(PointerRNA *ptr, int value)
 {
-	Scene *scene= (Scene *)ptr->id.data;
-	Editing *ed= seq_give_editing(scene, FALSE);
+	Scene *scene = (Scene *)ptr->id.data;
+	Editing *ed = seq_give_editing(scene, FALSE);
 
-	if(ed==NULL)
+	if (ed == NULL)
 		return;
 
 
-	if(ed->over_flag & SEQ_EDIT_OVERLAY_ABS)
-		ed->over_cfra= (scene->r.cfra + value);
+	if (ed->over_flag & SEQ_EDIT_OVERLAY_ABS)
+		ed->over_cfra = (scene->r.cfra + value);
 	else
-		ed->over_ofs= value;
+		ed->over_ofs = value;
 }
 
 
 static void rna_WipeSequence_angle_set(PointerRNA *ptr, float value)
 {
-	Sequence *seq= (Sequence *)(ptr->data);
-	value= RAD2DEGF(value);
+	Sequence *seq = (Sequence *)(ptr->data);
+	value = RAD2DEGF(value);
 	CLAMP(value, -90.0f, 90.0f);
-	((WipeVars *)seq->effectdata)->angle= value;
+	((WipeVars *)seq->effectdata)->angle = value;
 }
 
 static float rna_WipeSequence_angle_get(PointerRNA *ptr)
 {
-	Sequence *seq= (Sequence *)(ptr->data);
+	Sequence *seq = (Sequence *)(ptr->data);
 
 	return DEG2RADF(((WipeVars *)seq->effectdata)->angle);
 }
@@ -731,17 +741,17 @@ static void rna_def_strip_element(BlenderRNA *brna)
 	RNA_def_struct_ui_text(srna, "Sequence Element", "Sequence strip data for a single frame");
 	RNA_def_struct_sdna(srna, "StripElem");
 	
-	prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILENAME);
+	prop = RNA_def_property(srna, "filename", PROP_STRING, PROP_FILENAME);
 	RNA_def_property_string_sdna(prop, NULL, "name");
 	RNA_def_property_ui_text(prop, "Filename", "");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "orig_width", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "orig_width", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "orig_width");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Orig Width", "Original image width");
 
-	prop= RNA_def_property(srna, "orig_height", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "orig_height", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "orig_height");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Orig Height", "Original image height");
@@ -756,25 +766,25 @@ static void rna_def_strip_crop(BlenderRNA *brna)
 	RNA_def_struct_ui_text(srna, "Sequence Crop", "Cropping parameters for a sequence strip");
 	RNA_def_struct_sdna(srna, "StripCrop");
 
-	prop= RNA_def_property(srna, "max_y", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "max_y", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "top");
 	RNA_def_property_ui_text(prop, "Top", "");
 	RNA_def_property_ui_range(prop, 0, 4096, 1, 0);
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "min_y", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "min_y", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "bottom");
 	RNA_def_property_ui_text(prop, "Bottom", "");
 	RNA_def_property_ui_range(prop, 0, 4096, 1, 0);
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "min_x", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "min_x", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "left");
 	RNA_def_property_ui_text(prop, "Left", "");
 	RNA_def_property_ui_range(prop, 0, 4096, 1, 0);
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "max_x", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "max_x", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "right");
 	RNA_def_property_ui_text(prop, "Right", "");
 	RNA_def_property_ui_range(prop, 0, 4096, 1, 0);
@@ -792,13 +802,13 @@ static void rna_def_strip_transform(BlenderRNA *brna)
 	RNA_def_struct_ui_text(srna, "Sequence Transform", "Transform parameters for a sequence strip");
 	RNA_def_struct_sdna(srna, "StripTransform");
 
-	prop= RNA_def_property(srna, "offset_x", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "offset_x", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "xofs");
 	RNA_def_property_ui_text(prop, "Offset X", "");
 	RNA_def_property_ui_range(prop, -4096, 4096, 1, 0);
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "offset_y", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "offset_y", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "yofs");
 	RNA_def_property_ui_text(prop, "Offset Y", "");
 	RNA_def_property_ui_range(prop, -4096, 4096, 1, 0);
@@ -813,7 +823,7 @@ static void rna_def_strip_proxy(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static const EnumPropertyItem seq_tc_items[]= {
+	static const EnumPropertyItem seq_tc_items[] = {
 		{SEQ_PROXY_TC_NONE, "NONE", 0, "No TC in use", ""},
 		{SEQ_PROXY_TC_RECORD_RUN, "RECORD_RUN", 0, "Record Run",
 		                          "Use images in the order as they are recorded"},
@@ -822,8 +832,8 @@ static void rna_def_strip_proxy(BlenderRNA *brna)
 		{SEQ_PROXY_TC_INTERP_REC_DATE_FREE_RUN, "FREE_RUN_REC_DATE", 0, "Free Run (rec date)",
 		                                        "Interpolate a global timestamp using the "
 		                                        "record date and time written by recording device"},
-		{SEQ_PROXY_TC_RECORD_RUN_NO_GAPS, "FREE_RUN_NO_GAPS", 0, "Free Run No Gaps",
-		                                        "Record run, but ignore timecode, "
+		{SEQ_PROXY_TC_RECORD_RUN_NO_GAPS, "RECORD_RUN_NO_GAPS", 0, "Record Run No Gaps",
+		                                        "Like record run, but ignore timecode, "
 		                                        "changes in framerate or dropouts"},
 		{0, NULL, 0, NULL, NULL}};
 	
@@ -831,51 +841,52 @@ static void rna_def_strip_proxy(BlenderRNA *brna)
 	RNA_def_struct_ui_text(srna, "Sequence Proxy", "Proxy parameters for a sequence strip");
 	RNA_def_struct_sdna(srna, "StripProxy");
 	
-	prop= RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
+	prop = RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
 	RNA_def_property_string_sdna(prop, NULL, "dir");
 	RNA_def_property_ui_text(prop, "Directory", "Location to store the proxy files");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+	prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
 	RNA_def_property_ui_text(prop, "Path", "Location of custom proxy file");
-	RNA_def_property_string_funcs(prop, "rna_Sequence_proxy_filepath_get", "rna_Sequence_proxy_filepath_length", "rna_Sequence_proxy_filepath_set");
+	RNA_def_property_string_funcs(prop, "rna_Sequence_proxy_filepath_get", "rna_Sequence_proxy_filepath_length",
+	                              "rna_Sequence_proxy_filepath_set");
 
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "build_25", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "build_25", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_size_flags", SEQ_PROXY_IMAGE_SIZE_25);
 	RNA_def_property_ui_text(prop, "25%", "Build 25% proxy resolution");
 
-	prop= RNA_def_property(srna, "build_50", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "build_50", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_size_flags", SEQ_PROXY_IMAGE_SIZE_50);
 	RNA_def_property_ui_text(prop, "50%", "Build 50% proxy resolution");
 
-	prop= RNA_def_property(srna, "build_75", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "build_75", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_size_flags", SEQ_PROXY_IMAGE_SIZE_75);
 	RNA_def_property_ui_text(prop, "75%", "Build 75% proxy resolution");
 
-	prop= RNA_def_property(srna, "build_100", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "build_100", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_size_flags", SEQ_PROXY_IMAGE_SIZE_100);
 	RNA_def_property_ui_text(prop, "100%", "Build 100% proxy resolution");
 
-	prop= RNA_def_property(srna, "build_record_run", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "build_record_run", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flags", SEQ_PROXY_TC_RECORD_RUN);
 	RNA_def_property_ui_text(prop, "Rec Run", "Build record run time code index");
 
-	prop= RNA_def_property(srna, "build_free_run", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "build_free_run", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flags", SEQ_PROXY_TC_FREE_RUN);
 	RNA_def_property_ui_text(prop, "Free Run", "Build free run time code index");
 
-	prop= RNA_def_property(srna, "build_free_run_rec_date", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "build_free_run_rec_date", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flags", SEQ_PROXY_TC_INTERP_REC_DATE_FREE_RUN);
 	RNA_def_property_ui_text(prop, "Free Run (Rec Date)", "Build free run time code index using Record Date/Time");
 
-	prop= RNA_def_property(srna, "quality", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "quality", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "quality");
 	RNA_def_property_ui_text(prop, "Quality", "JPEG Quality of proxies to build");
 	RNA_def_property_ui_range(prop, 1, 100, 1, 0);
 
-	prop= RNA_def_property(srna, "timecode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "timecode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "tc");
 	RNA_def_property_enum_items(prop, seq_tc_items);
 	RNA_def_property_ui_text(prop, "Timecode", "");
@@ -892,32 +903,32 @@ static void rna_def_strip_color_balance(BlenderRNA *brna)
 	RNA_def_struct_ui_text(srna, "Sequence Color Balance", "Color balance parameters for a sequence strip");
 	RNA_def_struct_sdna(srna, "StripColorBalance");
 
-	prop= RNA_def_property(srna, "lift", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_ui_text(prop, "Lift", "Color balance lift (shadows)");
 	RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_ui_text(prop, "Gamma", "Color balance gamma (midtones)");
 	RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "gain", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_ui_text(prop, "Gain", "Color balance gain (highlights)");
 	RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "invert_gain", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_gain", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_GAIN);
 	RNA_def_property_ui_text(prop, "Inverse Gain", "");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "invert_gamma", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_gamma", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_GAMMA);
 	RNA_def_property_ui_text(prop, "Inverse Gamma", "");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "invert_lift", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_lift", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_LIFT);
 	RNA_def_property_ui_text(prop, "Inverse Lift", "");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
@@ -941,40 +952,41 @@ static void rna_def_sequence(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static const EnumPropertyItem seq_type_items[]= {
-		{SEQ_IMAGE, "IMAGE", 0, "Image", ""}, 
-		{SEQ_META, "META", 0, "Meta", ""}, 
-		{SEQ_SCENE, "SCENE", 0, "Scene", ""}, 
-		{SEQ_MOVIE, "MOVIE", 0, "Movie", ""}, 
+	static const EnumPropertyItem seq_type_items[] = {
+		{SEQ_IMAGE, "IMAGE", 0, "Image", ""},
+		{SEQ_META, "META", 0, "Meta", ""},
+		{SEQ_SCENE, "SCENE", 0, "Scene", ""},
+		{SEQ_MOVIE, "MOVIE", 0, "Movie", ""},
+		{SEQ_MOVIECLIP, "MOVIECLIP", 0, "Clip", ""},
 		{SEQ_SOUND, "SOUND", 0, "Sound", ""},
-		{SEQ_CROSS, "CROSS", 0, "Cross", ""}, 
-		{SEQ_ADD, "ADD", 0, "Add", ""}, 
-		{SEQ_SUB, "SUBTRACT", 0, "Subtract", ""}, 
-		{SEQ_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""}, 
-		{SEQ_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""}, 
-		{SEQ_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""}, 
-		{SEQ_MUL, "MULTIPLY", 0, "Multiply", ""}, 
-		{SEQ_OVERDROP, "OVER_DROP", 0, "Over Drop", ""}, 
-		{SEQ_PLUGIN, "PLUGIN", 0, "plugin", ""}, 
-		{SEQ_WIPE, "WIPE", 0, "Wipe", ""}, 
-		{SEQ_GLOW, "GLOW", 0, "Glow", ""}, 
-		{SEQ_TRANSFORM, "TRANSFORM", 0, "Transform", ""}, 
-		{SEQ_COLOR, "COLOR", 0, "Color", ""}, 
-		{SEQ_SPEED, "SPEED", 0, "Speed", ""}, 
+		{SEQ_CROSS, "CROSS", 0, "Cross", ""},
+		{SEQ_ADD, "ADD", 0, "Add", ""},
+		{SEQ_SUB, "SUBTRACT", 0, "Subtract", ""},
+		{SEQ_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""},
+		{SEQ_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""},
+		{SEQ_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""},
+		{SEQ_MUL, "MULTIPLY", 0, "Multiply", ""},
+		{SEQ_OVERDROP, "OVER_DROP", 0, "Over Drop", ""},
+		{SEQ_PLUGIN, "PLUGIN", 0, "Plugin", ""},
+		{SEQ_WIPE, "WIPE", 0, "Wipe", ""},
+		{SEQ_GLOW, "GLOW", 0, "Glow", ""},
+		{SEQ_TRANSFORM, "TRANSFORM", 0, "Transform", ""},
+		{SEQ_COLOR, "COLOR", 0, "Color", ""},
+		{SEQ_SPEED, "SPEED", 0, "Speed", ""},
 		{SEQ_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""},
 		{SEQ_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	static const EnumPropertyItem blend_mode_items[]= {
-		{SEQ_BLEND_REPLACE, "REPLACE", 0, "Replace", ""}, 
-		{SEQ_CROSS, "CROSS", 0, "Cross", ""}, 
-		{SEQ_ADD, "ADD", 0, "Add", ""}, 
-		{SEQ_SUB, "SUBTRACT", 0, "Subtract", ""}, 
-		{SEQ_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""}, 
-		{SEQ_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""}, 
-		{SEQ_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""}, 
-		{SEQ_MUL, "MULTIPLY", 0, "Multiply", ""}, 
-		{SEQ_OVERDROP, "OVER_DROP", 0, "Over Drop", ""}, 
+	static const EnumPropertyItem blend_mode_items[] = {
+		{SEQ_BLEND_REPLACE, "REPLACE", 0, "Replace", ""},
+		{SEQ_CROSS, "CROSS", 0, "Cross", ""},
+		{SEQ_ADD, "ADD", 0, "Add", ""},
+		{SEQ_SUB, "SUBTRACT", 0, "Subtract", ""},
+		{SEQ_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""},
+		{SEQ_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""},
+		{SEQ_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""},
+		{SEQ_MUL, "MULTIPLY", 0, "Multiply", ""},
+		{SEQ_OVERDROP, "OVER_DROP", 0, "Over Drop", ""},
 		{0, NULL, 0, NULL, NULL}};
 	
 	srna = RNA_def_struct(brna, "Sequence", NULL);
@@ -982,57 +994,57 @@ static void rna_def_sequence(BlenderRNA *brna)
 	RNA_def_struct_refine_func(srna, "rna_Sequence_refine");
 	RNA_def_struct_path_func(srna, "rna_Sequence_path");
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_funcs(prop, "rna_Sequence_name_get", "rna_Sequence_name_length", "rna_Sequence_name_set");
 	RNA_def_property_string_maxlength(prop, sizeof(((Sequence*)NULL)->name)-2);
 	RNA_def_property_ui_text(prop, "Name", "");
 	RNA_def_struct_name_property(srna, prop);
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL);
 
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_enum_items(prop, seq_type_items);
 	RNA_def_property_ui_text(prop, "Type", "");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	//prop= RNA_def_property(srna, "ipo", PROP_POINTER, PROP_NONE);
-	//RNA_def_property_ui_text(prop, "IPO Curves", "IPO curves used by this sequence");
+	/*prop= RNA_def_property(srna, "ipo", PROP_POINTER, PROP_NONE); */
+	/*RNA_def_property_ui_text(prop, "IPO Curves", "IPO curves used by this sequence"); */
 
 	/* flags */
 
-	prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
 	RNA_def_property_ui_text(prop, "Select", "");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER|NA_SELECTED, NULL);
 
-	prop= RNA_def_property(srna, "select_left_handle", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select_left_handle", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_LEFTSEL);
 	RNA_def_property_ui_text(prop, "Left Handle Selected", "");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER|NA_SELECTED, NULL);
 
-	prop= RNA_def_property(srna, "select_right_handle", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select_right_handle", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_RIGHTSEL);
 	RNA_def_property_ui_text(prop, "Right Handle Selected", "");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER|NA_SELECTED, NULL);
 
-	prop= RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MUTE);
 	RNA_def_property_ui_text(prop, "Mute", "");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_mute_update");
 
-	prop= RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_LOCK);
 	RNA_def_property_ui_text(prop, "Lock", "Lock strip so that it can't be transformed");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL);
 
-	prop= RNA_def_property(srna, "waveform", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "waveform", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_AUDIO_DRAW_WAVEFORM);
 	RNA_def_property_ui_text(prop, "Draw Waveform", "Whether to draw the sound's waveform");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL);
 
 	/* strip positioning */
 
-	prop= RNA_def_property(srna, "frame_final_duration", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_final_duration", PROP_INT, PROP_TIME);
 	RNA_def_property_range(prop, 1, MAXFRAME);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Length", "The length of the contents of this strip after the handles are applied");
@@ -1040,115 +1052,126 @@ static void rna_def_sequence(BlenderRNA *brna)
 	RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "frame_duration", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "len");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE|PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 1, MAXFRAME);
-	RNA_def_property_ui_text(prop, "Length", "The length of the contents of this strip before the handles are applied");
+	RNA_def_property_ui_text(prop, "Length",
+	                         "The length of the contents of this strip before the handles are applied");
 	
-	prop= RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "start");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Start Frame", "");
-	RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_start_frame_set",NULL); // overlap tests and calc_seq_disp
+	RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_start_frame_set",NULL); /* overlap tests and calc_seq_disp */
 	RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "frame_final_start", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_final_start", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "startdisp");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-	RNA_def_property_ui_text(prop, "Start Frame", "Start frame displayed in the sequence editor after offsets are applied, setting this is equivalent to moving the handle, not the actual start frame");
-	RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_start_frame_final_set", NULL); // overlap tests and calc_seq_disp
+	RNA_def_property_ui_text(prop, "Start Frame",
+	                         "Start frame displayed in the sequence editor after offsets are applied, setting this is "
+	                         "equivalent to moving the handle, not the actual start frame");
+		/* overlap tests and calc_seq_disp */
+	RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_start_frame_final_set", NULL);
 	RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "frame_final_end", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_final_end", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "enddisp");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-	RNA_def_property_ui_text(prop, "End Frame", "End frame displayed in the sequence editor after offsets are applied");
-	RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_end_frame_final_set", NULL); // overlap tests and calc_seq_disp
+	RNA_def_property_ui_text(prop, "End Frame",
+	                         "End frame displayed in the sequence editor after offsets are applied");
+		/* overlap tests and calc_seq_disp */
+	RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_end_frame_final_set", NULL);
 	RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "frame_offset_start", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_offset_start", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "startofs");
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE); // overlap tests
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */
 	RNA_def_property_ui_text(prop, "Start Offset", "");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "frame_offset_end", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_offset_end", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "endofs");
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE); // overlap tests
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */
 	RNA_def_property_ui_text(prop, "End Offset", "");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "frame_still_start", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_still_start", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "startstill");
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE); // overlap tests
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */
 	RNA_def_property_range(prop, 0, MAXFRAME);
 	RNA_def_property_ui_text(prop, "Start Still", "");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "frame_still_end", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame_still_end", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "endstill");
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE); // overlap tests
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */
 	RNA_def_property_range(prop, 0, MAXFRAME);
 	RNA_def_property_ui_text(prop, "End Still", "");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "channel", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "channel", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "machine");
 	RNA_def_property_range(prop, 0, MAXSEQ-1);
 	RNA_def_property_ui_text(prop, "Channel", "Y position of the sequence strip");
-	RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_channel_set",NULL); // overlap test
+	RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_channel_set",NULL); /* overlap test */
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
 	/* blending */
 
-	prop= RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "blend_mode");
 	RNA_def_property_enum_items(prop, blend_mode_items);
 	RNA_def_property_ui_text(prop, "Blend Mode", "");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "blend_alpha", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "blend_alpha", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Blend Opacity", "");
-	RNA_def_property_float_funcs(prop, "rna_Sequence_opacity_get", "rna_Sequence_opacity_set", NULL); // stupid 0-100 -> 0-1
+		/* stupid 0-100 -> 0-1 */
+	RNA_def_property_float_funcs(prop, "rna_Sequence_opacity_get", "rna_Sequence_opacity_set", NULL);
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "effect_fader", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "effect_fader", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_float_sdna(prop, NULL, "effect_fader");
 	RNA_def_property_ui_text(prop, "Effect fader position", "");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "use_default_fade", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_default_fade", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_EFFECT_DEFAULT_FADE);
-	RNA_def_property_ui_text(prop, "Use Default Fade", "Fade effect using the built-in default (usually make transition as long as effect strip)");
+	RNA_def_property_ui_text(prop, "Use Default Fade",
+	                         "Fade effect using the built-in default (usually make transition as long as "
+	                         "effect strip)");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
 
-	prop= RNA_def_property(srna, "speed_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "speed_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "speed_fader");
-	RNA_def_property_ui_text(prop, "Speed factor", "Multiply the current speed of the sequence with this number or remap current frame to this frame");
+	RNA_def_property_ui_text(prop, "Speed factor",
+	                         "Multiply the current speed of the sequence with this number or remap current frame "
+	                         "to this frame");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
 	/* effect strip inputs */
 
-	prop= RNA_def_property(srna, "input_count", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "input_count", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_int_funcs(prop, "rna_Sequence_input_count_get", NULL, NULL);
 
-	prop= RNA_def_property(srna, "input_1",  PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "input_1",  PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "seq1");
 	RNA_def_property_ui_text(prop, "Input 1", "First input for the effect strip");
 
-	prop= RNA_def_property(srna, "input_2",  PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "input_2",  PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "seq2");
 	RNA_def_property_ui_text(prop, "Input 2", "Second input for the effect strip");
 
-	prop= RNA_def_property(srna, "input_3",  PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "input_3",  PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "seq1");
 	RNA_def_property_ui_text(prop, "Input 3", "Third input for the effect strip");
 
@@ -1165,42 +1188,45 @@ static void rna_def_editor(BlenderRNA *brna)
 	RNA_def_struct_ui_icon(srna, ICON_SEQUENCE);
 	RNA_def_struct_sdna(srna, "Editing");
 
-	prop= RNA_def_property(srna, "sequences", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "sequences", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "seqbase", NULL);
 	RNA_def_property_struct_type(prop, "Sequence");
 	RNA_def_property_ui_text(prop, "Sequences", "");
 
-	prop= RNA_def_property(srna, "sequences_all", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "sequences_all", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "seqbase", NULL);
 	RNA_def_property_struct_type(prop, "Sequence");
 	RNA_def_property_ui_text(prop, "Sequences", "");
-	RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_sequences_all_begin", "rna_SequenceEditor_sequences_all_next", NULL, NULL, NULL, NULL, NULL, NULL);
+	RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_sequences_all_begin",
+	                                  "rna_SequenceEditor_sequences_all_next", NULL, NULL, NULL, NULL, NULL, NULL);
 
-	prop= RNA_def_property(srna, "meta_stack", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "meta_stack", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "metastack", NULL);
 	RNA_def_property_struct_type(prop, "Sequence");
 	RNA_def_property_ui_text(prop, "Meta Stack", "Meta strip stack, last is currently edited meta strip");
-	RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_SequenceEditor_meta_stack_get", NULL, NULL, NULL, NULL);
+	RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_SequenceEditor_meta_stack_get",
+	                                  NULL, NULL, NULL, NULL);
 	
-	prop= RNA_def_property(srna, "active_strip", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active_strip", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "act_seq");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "show_overlay", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_overlay", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "over_flag", SEQ_EDIT_OVERLAY_SHOW);
 	RNA_def_property_ui_text(prop, "Draw Axes", "Partial overlay on top of the sequencer");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
 
-	prop= RNA_def_property(srna, "overlay_lock", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "overlay_lock", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "over_flag", SEQ_EDIT_OVERLAY_ABS);
 	RNA_def_property_ui_text(prop, "Overlay Lock", "");
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_SequenceEditor_overlay_lock_set");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
 
 	/* access to fixed and relative frame */
-	prop= RNA_def_property(srna, "overlay_frame", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "overlay_frame", PROP_INT, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Overlay Offset", "");
-	RNA_def_property_int_funcs(prop, "rna_SequenceEditor_overlay_frame_get", "rna_SequenceEditor_overlay_frame_set", NULL);
+	RNA_def_property_int_funcs(prop, "rna_SequenceEditor_overlay_frame_get",
+	                           "rna_SequenceEditor_overlay_frame_set", NULL);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
 	RNA_def_property_ui_text(prop, "Active Strip", "Sequencer's active strip");
 }
@@ -1209,81 +1235,81 @@ static void rna_def_filter_video(StructRNA *srna)
 {
 	PropertyRNA *prop;
 
-	prop= RNA_def_property(srna, "use_deinterlace", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_deinterlace", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_FILTERY);
 	RNA_def_property_ui_text(prop, "De-Interlace", "For video movies to remove fields");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update_reopen_files");
 
-	prop= RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MAKE_PREMUL);
 	RNA_def_property_ui_text(prop, "Premultiply", "Convert RGB from key alpha to premultiplied alpha");
-	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, NULL);
+	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "use_flip_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_flip_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_FLIPX);
 	RNA_def_property_ui_text(prop, "Flip X", "Flip on the X axis");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "use_flip_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_flip_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_FLIPY);
 	RNA_def_property_ui_text(prop, "Flip Y", "Flip on the Y axis");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "use_float", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_float", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MAKE_FLOAT);
 	RNA_def_property_ui_text(prop, "Convert Float", "Convert input to float data");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "use_reverse_frames", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_reverse_frames", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_REVERSE_FRAMES);
 	RNA_def_property_ui_text(prop, "Flip Time", "Reverse frame order");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "color_multiply", PROP_FLOAT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "color_multiply", PROP_FLOAT, PROP_UNSIGNED);
 	RNA_def_property_float_sdna(prop, NULL, "mul");
 	RNA_def_property_range(prop, 0.0f, 20.0f);
 	RNA_def_property_ui_text(prop, "Multiply Colors", "");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "color_saturation", PROP_FLOAT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "color_saturation", PROP_FLOAT, PROP_UNSIGNED);
 	RNA_def_property_float_sdna(prop, NULL, "sat");
 	RNA_def_property_range(prop, 0.0f, 20.0f);
 	RNA_def_property_ui_range(prop, 0.0f, 2.0f, 3, 3);
 	RNA_def_property_ui_text(prop, "Saturation", "");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "strobe", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "strobe", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 1.0f, 30.0f);
 	RNA_def_property_ui_text(prop, "Strobe", "Only display every nth frame");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "use_color_balance", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_color_balance", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_COLOR_BALANCE);
 	RNA_def_property_ui_text(prop, "Use Color Balance", "(3-Way color correction) on input");
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_color_balance_set");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "color_balance", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "color_balance", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "strip->color_balance");
 	RNA_def_property_ui_text(prop, "Color Balance", "");
 
-	prop= RNA_def_property(srna, "use_translation", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_translation", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_TRANSFORM);
 	RNA_def_property_ui_text(prop, "Use Translation", "Translate image before processing");
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_translation_set");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "transform", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "transform", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "strip->transform");
 	RNA_def_property_ui_text(prop, "Transform", "");
 
-	prop= RNA_def_property(srna, "use_crop", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_crop", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_CROP);
 	RNA_def_property_ui_text(prop, "Use Crop", "Crop image before processing");
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_crop_set");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "crop", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "crop", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "strip->crop");
 	RNA_def_property_ui_text(prop, "Crop", "");
 }
@@ -1292,21 +1318,21 @@ static void rna_def_proxy(StructRNA *srna)
 {
 	PropertyRNA *prop;
 
-	prop= RNA_def_property(srna, "use_proxy", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_proxy", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_PROXY);
 	RNA_def_property_ui_text(prop, "Use Proxy / Timecode", "Use a preview proxy and/or timecode index for this strip");
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_proxy_set");
 
-	prop= RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "strip->proxy");
 	RNA_def_property_ui_text(prop, "Proxy", "");
 
-	prop= RNA_def_property(srna, "use_proxy_custom_directory", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_proxy_custom_directory", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_PROXY_CUSTOM_DIR);
 	RNA_def_property_ui_text(prop, "Proxy Custom Directory", "Use a custom directory to store data");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "use_proxy_custom_file", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_proxy_custom_file", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_PROXY_CUSTOM_FILE);
 	RNA_def_property_ui_text(prop, "Proxy Custom File", "Use a custom file to read proxy data from");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
@@ -1316,18 +1342,18 @@ static void rna_def_input(StructRNA *srna)
 {
 	PropertyRNA *prop;
 
-	prop= RNA_def_property(srna, "animation_offset_start", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "animation_offset_start", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "anim_startofs");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-	RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_anim_startofs_final_set", NULL); // overlap tests
+	RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_anim_startofs_final_set", NULL); /* overlap tests */
 
 	RNA_def_property_ui_text(prop, "Animation Start Offset", "Animation start offset (trim start)");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "animation_offset_end", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "animation_offset_end", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "anim_endofs");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-	RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_anim_endofs_final_set", NULL); // overlap tests
+	RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_anim_endofs_final_set", NULL); /* overlap tests */
 	RNA_def_property_ui_text(prop, "Animation End Offset", "Animation end offset (trim end)");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 }
@@ -1341,16 +1367,18 @@ static void rna_def_image(BlenderRNA *brna)
 	RNA_def_struct_ui_text(srna, "Image Sequence", "Sequence strip to load one or more images");
 	RNA_def_struct_sdna(srna, "Sequence");
 
-	prop= RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
+	prop = RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
 	RNA_def_property_string_sdna(prop, NULL, "strip->dir");
 	RNA_def_property_ui_text(prop, "Directory", "");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "strip->stripdata", NULL);
 	RNA_def_property_struct_type(prop, "SequenceElement");
 	RNA_def_property_ui_text(prop, "Elements", "");
-	RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_elements_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_SequenceEditor_elements_length", NULL, NULL, NULL);
+	RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_elements_begin", "rna_iterator_array_next",
+	                                  "rna_iterator_array_end", "rna_iterator_array_get",
+	                                  "rna_SequenceEditor_elements_length", NULL, NULL, NULL);
 
 	rna_def_filter_video(srna);
 	rna_def_proxy(srna);
@@ -1385,12 +1413,12 @@ static void rna_def_scene(BlenderRNA *brna)
 	RNA_def_struct_ui_text(srna, "Scene Sequence", "Sequence strip to used the rendered image of a scene");
 	RNA_def_struct_sdna(srna, "Sequence");
 
-	prop= RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Scene", "Scene that this sequence uses");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "scene_camera", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "scene_camera", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Camera_object_poll");
 	RNA_def_property_ui_text(prop, "Camera Override", "Override the scenes active camera");
@@ -1410,25 +1438,28 @@ static void rna_def_movie(BlenderRNA *brna)
 	RNA_def_struct_ui_text(srna, "Movie Sequence", "Sequence strip to load a video");
 	RNA_def_struct_sdna(srna, "Sequence");
 
-	prop= RNA_def_property(srna, "mpeg_preseek", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "mpeg_preseek", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "anim_preseek");
 	RNA_def_property_range(prop, 0, 50);
 	RNA_def_property_ui_text(prop, "MPEG Preseek", "For MPEG movies, preseek this many frames");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "stream_index", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "stream_index", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "streamindex");
 	RNA_def_property_range(prop, 0, 20);
-	RNA_def_property_ui_text(prop, "Streamindex", "For files with several movie streams, use the stream with the given index");
+	RNA_def_property_ui_text(prop, "Streamindex",
+	                         "For files with several movie streams, use the stream with the given index");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update_reopen_files");
 
-	prop= RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "strip->stripdata", NULL);
 	RNA_def_property_struct_type(prop, "SequenceElement");
 	RNA_def_property_ui_text(prop, "Elements", "");
-	RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_elements_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_SequenceEditor_elements_length", NULL, NULL, NULL);
+	RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_elements_begin", "rna_iterator_array_next",
+	                                  "rna_iterator_array_end", "rna_iterator_array_get",
+	                                  "rna_SequenceEditor_elements_length", NULL, NULL, NULL);
 
-	prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+	prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
 	RNA_def_property_ui_text(prop, "File", "");
 	RNA_def_property_string_funcs(prop, "rna_Sequence_filepath_get", "rna_Sequence_filepath_length",
 										"rna_Sequence_filepath_set");
@@ -1439,44 +1470,69 @@ static void rna_def_movie(BlenderRNA *brna)
 	rna_def_input(srna);
 }
 
+static void rna_def_movieclip(BlenderRNA *brna)
+{
+	StructRNA *srna;
+	PropertyRNA *prop;
+	
+	srna = RNA_def_struct(brna, "MovieClipSequence", "Sequence");
+	RNA_def_struct_ui_text(srna, "MovieClip Sequence", "Sequence strip to load a video from the clip editor");
+	RNA_def_struct_sdna(srna, "Sequence");
+
+	prop = RNA_def_property(srna, "undistort", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "clip_flag", SEQ_MOVIECLIP_RENDER_UNDISTORTED);
+	RNA_def_property_ui_text(prop, "Undistort Clip", "Use the undistorted version of the clip");
+	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
+
+	prop = RNA_def_property(srna, "stabilize2d", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "clip_flag", SEQ_MOVIECLIP_RENDER_STABILIZED);
+	RNA_def_property_ui_text(prop, "Stabilize 2D Clip", "Use the 2D stabilized version of the clip");
+	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
+
+	rna_def_filter_video(srna);
+	rna_def_input(srna);
+}
+
+
 static void rna_def_sound(BlenderRNA *brna)
 {
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
 	srna = RNA_def_struct(brna, "SoundSequence", "Sequence");
-	RNA_def_struct_ui_text(srna, "Sound Sequence", "Sequence strip defining a sound to be played over a period of time");
+	RNA_def_struct_ui_text(srna, "Sound Sequence",
+	                       "Sequence strip defining a sound to be played over a period of time");
 	RNA_def_struct_sdna(srna, "Sequence");
 
-	prop= RNA_def_property(srna, "sound", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "sound", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Sound");
 	RNA_def_property_ui_text(prop, "Sound", "Sound datablock used by this sequence");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
 	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_float_funcs(prop, NULL, "rna_Sequence_volume_set", NULL);
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE);
 	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_float_funcs(prop, NULL, "rna_Sequence_pitch_set", NULL);
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "pan", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "pan", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "pan");
 	RNA_def_property_range(prop, -2.0f, 2.0f);
 	RNA_def_property_ui_text(prop, "Pan", "Playback panning of the sound (only for Mono sources)");
 	RNA_def_property_float_funcs(prop, NULL, "rna_Sequence_pan_set", NULL);
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+	prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
 	RNA_def_property_ui_text(prop, "File", "");
-	RNA_def_property_string_funcs(prop, "rna_Sequence_filepath_get", "rna_Sequence_filepath_length", 
+	RNA_def_property_string_funcs(prop, "rna_Sequence_filepath_get", "rna_Sequence_filepath_length",
 										"rna_Sequence_filepath_set");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_filepath_update");
 	
@@ -1488,7 +1544,8 @@ static void rna_def_effect(BlenderRNA *brna)
 	StructRNA *srna;
 
 	srna = RNA_def_struct(brna, "EffectSequence", "Sequence");
-	RNA_def_struct_ui_text(srna, "Effect Sequence", "Sequence strip applying an effect on the images created by other strips");
+	RNA_def_struct_ui_text(srna, "Effect Sequence",
+	                       "Sequence strip applying an effect on the images created by other strips");
 	RNA_def_struct_sdna(srna, "Sequence");
 
 	rna_def_filter_video(srna);
@@ -1501,10 +1558,11 @@ static void rna_def_multicam(BlenderRNA *brna)
 	PropertyRNA *prop;
 	
 	srna = RNA_def_struct(brna, "MulticamSequence", "Sequence");
-	RNA_def_struct_ui_text(srna, "Multicam Select Sequence", "Sequence strip to perform multicam editing: select channel from below");
+	RNA_def_struct_ui_text(srna, "Multicam Select Sequence",
+	                       "Sequence strip to perform multicam editing: select channel from below");
 	RNA_def_struct_sdna(srna, "Sequence");
 
-	prop= RNA_def_property(srna, "multicam_source", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "multicam_source", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "multicam_source");
 	RNA_def_property_range(prop, 0, MAXSEQ-1);
 	RNA_def_property_ui_text(prop, "Multicam Source Channel", "");
@@ -1518,10 +1576,11 @@ static void rna_def_multicam(BlenderRNA *brna)
 static void rna_def_adjustment(BlenderRNA *brna)
 {
 	StructRNA *srna;
-//	PropertyRNA *prop;
+/*	PropertyRNA *prop; */
 	
 	srna = RNA_def_struct(brna, "AdjustmentSequence", "Sequence");
-	RNA_def_struct_ui_text(srna, "Adjustment Layer Sequence", "Sequence strip to perform filter adjustments to layers below");
+	RNA_def_struct_ui_text(srna, "Adjustment Layer Sequence",
+	                       "Sequence strip to perform filter adjustments to layers below");
 	RNA_def_struct_sdna(srna, "Sequence");
 
 	rna_def_filter_video(srna);
@@ -1535,10 +1594,11 @@ static void rna_def_plugin(BlenderRNA *brna)
 	PropertyRNA *prop;
 	
 	srna = RNA_def_struct(brna, "PluginSequence", "EffectSequence");
-	RNA_def_struct_ui_text(srna, "Plugin Sequence", "Sequence strip applying an effect, loaded from an external plugin");
+	RNA_def_struct_ui_text(srna, "Plugin Sequence",
+	                       "Sequence strip applying an effect, loaded from an external plugin");
 	RNA_def_struct_sdna_from(srna, "PluginSeq", "plugin");
 
-	prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILENAME);
+	prop = RNA_def_property(srna, "filename", PROP_STRING, PROP_FILENAME);
 	RNA_def_property_string_sdna(prop, NULL, "name");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Filename", "");
@@ -1552,17 +1612,17 @@ static void rna_def_wipe(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	static const EnumPropertyItem wipe_type_items[]= {
-		{0, "SINGLE", 0, "Single", ""}, 
-		{1, "DOUBLE", 0, "Double", ""}, 
+	static const EnumPropertyItem wipe_type_items[] = {
+		{0, "SINGLE", 0, "Single", ""},
+		{1, "DOUBLE", 0, "Double", ""},
 		/* not used yet {2, "BOX", 0, "Box", ""}, */
 		/* not used yet {3, "CROSS", 0, "Cross", ""}, */
-		{4, "IRIS", 0, "Iris", ""}, 
-		{5, "CLOCK", 0, "Clock", ""}, 	
+		{4, "IRIS", 0, "Iris", ""},
+		{5, "CLOCK", 0, "Clock", ""},
 		{0, NULL, 0, NULL, NULL}
 	};
 
-	static const EnumPropertyItem wipe_direction_items[]= {
+	static const EnumPropertyItem wipe_direction_items[] = {
 		{0, "OUT", 0, "Out", ""},
 		{1, "IN", 0, "In", ""},
 		{0, NULL, 0, NULL, NULL}
@@ -1572,31 +1632,32 @@ static void rna_def_wipe(BlenderRNA *brna)
 	RNA_def_struct_ui_text(srna, "Wipe Sequence", "Sequence strip creating a wipe transition");
 	RNA_def_struct_sdna_from(srna, "WipeVars", "effectdata");
 
-	prop= RNA_def_property(srna, "blur_width", PROP_FLOAT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "blur_width", PROP_FLOAT, PROP_UNSIGNED);
 	RNA_def_property_float_sdna(prop, NULL, "edgeWidth");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
-	RNA_def_property_ui_text(prop, "Blur Width", "Width of the blur edge, in percentage relative to the image size");
+	RNA_def_property_ui_text(prop, "Blur Width",
+	                         "Width of the blur edge, in percentage relative to the image size");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
 #if 1 /* expose as radians */
-	prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
+	prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_float_funcs(prop, "rna_WipeSequence_angle_get", "rna_WipeSequence_angle_set", NULL);
 	RNA_def_property_range(prop, DEG2RAD(-90.0), DEG2RAD(90.0));
 #else
-	prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "angle");
 	RNA_def_property_range(prop, -90.0f, 90.0f);
 #endif
 	RNA_def_property_ui_text(prop, "Angle", "Edge angle");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "forward");
 	RNA_def_property_enum_items(prop, wipe_direction_items);
 	RNA_def_property_ui_text(prop, "Direction", "Wipe direction");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "transition_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "transition_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "wipetype");
 	RNA_def_property_enum_items(prop, wipe_type_items);
 	RNA_def_property_ui_text(prop, "Transition Type", "");
@@ -1612,37 +1673,37 @@ static void rna_def_glow(BlenderRNA *brna)
 	RNA_def_struct_ui_text(srna, "Glow Sequence", "Sequence strip creating a glow effect");
 	RNA_def_struct_sdna_from(srna, "GlowVars", "effectdata");
 	
-	prop= RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "fMini");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Threshold", "Minimum intensity to trigger a glow");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "clamp", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "clamp", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "fClamp");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Clamp", "Brightness limit of intensity");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "boost_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "boost_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "fBoost");
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Boost Factor", "Brightness multiplier");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "blur_radius", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "blur_radius", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "dDist");
 	RNA_def_property_range(prop, 0.5f, 20.0f);
 	RNA_def_property_ui_text(prop, "Blur Distance", "Radius of glow effect");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "quality", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "quality", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "dQuality");
 	RNA_def_property_range(prop, 1, 5);
 	RNA_def_property_ui_text(prop, "Quality", "Accuracy of the blur effect");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "use_only_boost", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_only_boost", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "bNoComp", 0);
 	RNA_def_property_ui_text(prop, "Only Boost", "Show the glow buffer only");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
@@ -1653,66 +1714,67 @@ static void rna_def_transform(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	static const EnumPropertyItem interpolation_items[]= {
+	static const EnumPropertyItem interpolation_items[] = {
 		{0, "NONE", 0, "None", "No interpolation"},
 		{1, "BILINEAR", 0, "Bilinear", "Bilinear interpolation"},
 		{2, "BICUBIC", 0, "Bicubic", "Bicubic interpolation"},
 		{0, NULL, 0, NULL, NULL}
 	};
 
-	static const EnumPropertyItem translation_unit_items[]= {
+	static const EnumPropertyItem translation_unit_items[] = {
 		{0, "PIXELS", 0, "Pixels", ""},
 		{1, "PERCENT", 0, "Percent", ""},
 		{0, NULL, 0, NULL, NULL}
 	};
 
 	srna = RNA_def_struct(brna, "TransformSequence", "EffectSequence");
-	RNA_def_struct_ui_text(srna, "Transform Sequence", "Sequence strip applying affine transformations to other strips");
+	RNA_def_struct_ui_text(srna, "Transform Sequence",
+	                       "Sequence strip applying affine transformations to other strips");
 	RNA_def_struct_sdna_from(srna, "TransformVars", "effectdata");
 	
-	prop= RNA_def_property(srna, "scale_start_x", PROP_FLOAT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "scale_start_x", PROP_FLOAT, PROP_UNSIGNED);
 	RNA_def_property_float_sdna(prop, NULL, "ScalexIni");
 	RNA_def_property_ui_text(prop, "Scale X", "");
 	RNA_def_property_ui_range(prop, 0, 10, 3, 10);
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "scale_start_y", PROP_FLOAT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "scale_start_y", PROP_FLOAT, PROP_UNSIGNED);
 	RNA_def_property_float_sdna(prop, NULL, "ScaleyIni");
 	RNA_def_property_ui_text(prop, "Scale Y", "");
 	RNA_def_property_ui_range(prop, 0, 10, 3, 10);
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "use_uniform_scale", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_uniform_scale", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uniform_scale", 0);
 	RNA_def_property_ui_text(prop, "Uniform Scale", "Scale uniformly, preserving aspect ratio");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "translate_start_x", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "translate_start_x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "xIni");
 	RNA_def_property_ui_text(prop, "Translate X", "");
 	RNA_def_property_ui_range(prop, -500.0f, 500.0f, 3, 10);
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "translate_start_y", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "translate_start_y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "yIni");
 	RNA_def_property_ui_text(prop, "Translate Y", "");
 	RNA_def_property_ui_range(prop, -500.0f, 500.0f, 3, 10);
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "rotation_start", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "rotation_start", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "rotIni");
 	RNA_def_property_range(prop, -360.0f, 360.0f);
 	RNA_def_property_ui_text(prop, "Rotation", "");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "translation_unit", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "translation_unit", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "percent");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* not meant to be animated */
 	RNA_def_property_enum_items(prop, translation_unit_items);
 	RNA_def_property_ui_text(prop, "Translation Unit", "");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, interpolation_items);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* not meant to be animated */
 	RNA_def_property_ui_text(prop, "Interpolation", "");
@@ -1728,7 +1790,7 @@ static void rna_def_solid_color(BlenderRNA *brna)
 	RNA_def_struct_ui_text(srna, "Color Sequence", "Sequence strip creating an image filled with a single color");
 	RNA_def_struct_sdna_from(srna, "SolidColorVars", "effectdata");
 	
-	prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "col");
 	RNA_def_property_ui_text(prop, "Color", "");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
@@ -1743,24 +1805,24 @@ static void rna_def_speed_control(BlenderRNA *brna)
 	RNA_def_struct_ui_text(srna, "SpeedControl Sequence", "Sequence strip to control the speed of other strips");
 	RNA_def_struct_sdna_from(srna, "SpeedControlVars", "effectdata");
 	
-	prop= RNA_def_property(srna, "multiply_speed", PROP_FLOAT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "multiply_speed", PROP_FLOAT, PROP_UNSIGNED);
 	RNA_def_property_float_sdna(prop, NULL, "globalSpeed");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* seq->facf0 is used to animate this */
 	RNA_def_property_ui_text(prop, "Multiply Speed", "Multiply the resulting speed after the speed factor");
 	RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 0);
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 	
-	prop= RNA_def_property(srna, "use_as_speed", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_as_speed", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", SEQ_SPEED_INTEGRATE);
 	RNA_def_property_ui_text(prop, "Use as speed", "Interpret the value as speed instead of a frame number");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "use_frame_blend", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_frame_blend", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", SEQ_SPEED_BLEND);
 	RNA_def_property_ui_text(prop, "Frame Blending", "Blend two frames into the target for a smoother result");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
 
-	prop= RNA_def_property(srna, "scale_to_length", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "scale_to_length", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", SEQ_SPEED_COMPRESS_IPO_Y);
 	RNA_def_property_ui_text(prop, "Scale to length", "Scale values from 0.0 to 1.0 to target sequence length");
 	RNA_def_property_update(prop, NC_SCENE|ND_SEQUENCER, "rna_Sequence_update");
@@ -1781,6 +1843,7 @@ void RNA_def_sequencer(BlenderRNA *brna)
 	rna_def_meta(brna);
 	rna_def_scene(brna);
 	rna_def_movie(brna);
+	rna_def_movieclip(brna);
 	rna_def_sound(brna);
 	rna_def_effect(brna);
 	rna_def_multicam(brna);
@@ -1794,4 +1857,3 @@ void RNA_def_sequencer(BlenderRNA *brna)
 }
 
 #endif
-
diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c
index 98eb302..20ceaec 100644
--- a/source/blender/makesrna/intern/rna_sequencer_api.c
+++ b/source/blender/makesrna/intern/rna_sequencer_api.c
@@ -31,9 +31,6 @@
 #include <string.h>
 
 #include "RNA_define.h"
-
-#include "BLO_sys_types.h" /* needed for intptr_t used in ED_mesh.h */
-
 #include "RNA_access.h"
 #include "RNA_define.h"
 
@@ -51,7 +48,7 @@ static void rna_Sequence_swap_internal(Sequence *seq_self, ReportList *reports,
 {
 	const char *error_msg;
 	
-	if(seq_swap(seq_self, seq_other, &error_msg) == 0)
+	if (seq_swap(seq_self, seq_other, &error_msg) == 0)
 		BKE_report(reports, RPT_ERROR, error_msg);
 }
 
@@ -62,16 +59,17 @@ void RNA_api_sequence_strip(StructRNA *srna)
 	FunctionRNA *func;
 	PropertyRNA *parm;
 
-	func= RNA_def_function(srna, "getStripElem", "give_stripelem");
+	func = RNA_def_function(srna, "getStripElem", "give_stripelem");
 	RNA_def_function_ui_description(func, "Return the strip element from a given frame or None");
-	parm= RNA_def_int(func, "frame", 0, -MAXFRAME, MAXFRAME, "Frame",
+	parm = RNA_def_int(func, "frame", 0, -MAXFRAME, MAXFRAME, "Frame",
 	                  "The frame to get the strip element from", -MAXFRAME, MAXFRAME);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	RNA_def_function_return(func, RNA_def_pointer(func, "elem", "SequenceElement", "", "strip element of the current frame"));
+	RNA_def_function_return(func, RNA_def_pointer(func, "elem", "SequenceElement", "",
+	                        "strip element of the current frame"));
 
-	func= RNA_def_function(srna, "swap", "rna_Sequence_swap_internal");
+	func = RNA_def_function(srna, "swap", "rna_Sequence_swap_internal");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
-	parm= RNA_def_pointer(func, "other", "Sequence", "Other", "");
+	parm = RNA_def_pointer(func, "other", "Sequence", "Other", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 }
 
diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c
index 30db0a3..69d76c0 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -68,7 +68,7 @@ static void rna_Smoke_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
 
 	smokeModifier_reset(settings->smd);
 
-	if(settings->smd && settings->smd->domain)
+	if (settings->smd && settings->smd->domain)
 		settings->point_cache[0]->flag |= PTCACHE_OUTDATED;
 
 	rna_Smoke_update(bmain, scene, ptr);
@@ -80,7 +80,7 @@ static void rna_Smoke_reset_dependancy(Main *bmain, Scene *scene, PointerRNA *pt
 
 	smokeModifier_reset(settings->smd);
 
-	if(settings->smd && settings->smd->domain)
+	if (settings->smd && settings->smd->domain)
 		settings->smd->domain->point_cache[0]->flag |= PTCACHE_OUTDATED;
 
 	rna_Smoke_dependency_update(bmain, scene, ptr);
@@ -89,7 +89,7 @@ static void rna_Smoke_reset_dependancy(Main *bmain, Scene *scene, PointerRNA *pt
 static char *rna_SmokeDomainSettings_path(PointerRNA *ptr)
 {
 	SmokeDomainSettings *settings = (SmokeDomainSettings*)ptr->data;
-	ModifierData *md= (ModifierData *)settings->smd;
+	ModifierData *md = (ModifierData *)settings->smd;
 
 	return BLI_sprintfN("modifiers[\"%s\"].domain_settings", md->name);
 }
@@ -97,7 +97,7 @@ static char *rna_SmokeDomainSettings_path(PointerRNA *ptr)
 static char *rna_SmokeFlowSettings_path(PointerRNA *ptr)
 {
 	SmokeFlowSettings *settings = (SmokeFlowSettings*)ptr->data;
-	ModifierData *md= (ModifierData *)settings->smd;
+	ModifierData *md = (ModifierData *)settings->smd;
 
 	return BLI_sprintfN("modifiers[\"%s\"].flow_settings", md->name);
 }
@@ -105,7 +105,7 @@ static char *rna_SmokeFlowSettings_path(PointerRNA *ptr)
 static char *rna_SmokeCollSettings_path(PointerRNA *ptr)
 {
 	SmokeCollSettings *settings = (SmokeCollSettings*)ptr->data;
-	ModifierData *md= (ModifierData *)settings->smd;
+	ModifierData *md = (ModifierData *)settings->smd;
 
 	return BLI_sprintfN("modifiers[\"%s\"].coll_settings", md->name);
 }
@@ -120,7 +120,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
 	static EnumPropertyItem prop_noise_type_items[] = {
 				{MOD_SMOKE_NOISEWAVE, "NOISEWAVE", 0, "Wavelet", ""},
 #ifdef WITH_FFTW3
-				{MOD_SMOKE_NOISEFFT, "NOISEFFT", 0, "FFT", ""}, 
+				{MOD_SMOKE_NOISEFFT, "NOISEFFT", 0, "FFT", ""},
 #endif
 			/* 	{MOD_SMOKE_NOISECURL, "NOISECURL", 0, "Curl", ""}, */
 				{0, NULL, 0, NULL, NULL}};
@@ -132,7 +132,8 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
 
 	static EnumPropertyItem smoke_domain_colli_items[] = {
 		{SM_BORDER_OPEN, "BORDEROPEN", 0, "Open", "Smoke doesn't collide with any border"},
-		{SM_BORDER_VERTICAL, "BORDERVERTICAL", 0, "Vertically Open", "Smoke doesn't collide with top and bottom sides"},
+		{SM_BORDER_VERTICAL, "BORDERVERTICAL", 0, "Vertically Open",
+		                     "Smoke doesn't collide with top and bottom sides"},
 		{SM_BORDER_CLOSED, "BORDERCLOSED", 0, "Collide All", "Smoke collides with every side"},
 		{0, NULL, 0, NULL, NULL}};
 
@@ -141,129 +142,136 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
 	RNA_def_struct_sdna(srna, "SmokeDomainSettings");
 	RNA_def_struct_path_func(srna, "rna_SmokeDomainSettings_path");
 
-	prop= RNA_def_property(srna, "resolution_max", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "resolution_max", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "maxres");
 	RNA_def_property_range(prop, 24, 512);
 	RNA_def_property_ui_range(prop, 24, 512, 2, 0);
 	RNA_def_property_ui_text(prop, "Max Res", "Maximal resolution used in the fluid domain");
+	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, "amplify", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "amplify", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "amplify");
 	RNA_def_property_range(prop, 1, 10);
 	RNA_def_property_ui_range(prop, 1, 10, 1, 0);
 	RNA_def_property_ui_text(prop, "Amplification", "Enhance the resolution of smoke by this factor using noise");
+	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, "use_high_resolution", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_high_resolution", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_HIGHRES);
 	RNA_def_property_ui_text(prop, "High res", "Enable high resolution (using amplification)");
+	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, "show_high_resolution", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_high_resolution", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "viewsettings", MOD_SMOKE_VIEW_SHOWBIG);
 	RNA_def_property_ui_text(prop, "Show High Resolution", "Show high resolution (using amplification)");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
-	prop= RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "noise");
 	RNA_def_property_enum_items(prop, prop_noise_type_items);
 	RNA_def_property_ui_text(prop, "Noise Method", "Noise method which is used for creating the high resolution");
+	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, "alpha", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "alpha");
 	RNA_def_property_range(prop, -5.0, 5.0);
 	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_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");
 
-	prop= RNA_def_property(srna, "beta", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "beta", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "beta");
 	RNA_def_property_range(prop, -5.0, 5.0);
 	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_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");
 
-	prop= RNA_def_property(srna, "collision_group", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "collision_group", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "coll_group");
 	RNA_def_property_struct_type(prop, "Group");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Collision Group", "Limit collisions to this group");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset_dependancy");
 
-	prop= RNA_def_property(srna, "fluid_group", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "fluid_group", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "fluid_group");
 	RNA_def_property_struct_type(prop, "Group");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Fluid Group", "Limit fluid objects to this group");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset_dependancy");
 
-	prop= RNA_def_property(srna, "effector_group", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "effector_group", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "eff_group");
 	RNA_def_property_struct_type(prop, "Group");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Effector Group", "Limit effectors to this group");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset_dependancy");
 
-	prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "strength");
 	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");
 
-	prop= RNA_def_property(srna, "dissolve_speed", PROP_INT, PROP_NONE);
+	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");
 
-	prop= RNA_def_property(srna, "use_dissolve_smoke", PROP_BOOLEAN, PROP_NONE);
+	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");
 
-	prop= RNA_def_property(srna, "use_dissolve_smoke_log", PROP_BOOLEAN, PROP_NONE);
+	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");
 
-	prop= RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "point_cache[0]");
 	RNA_def_property_ui_text(prop, "Point Cache", "");
 
-	prop= RNA_def_property(srna, "point_cache_compress_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "point_cache_compress_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "cache_comp");
 	RNA_def_property_enum_items(prop, smoke_cache_comp_items);
 	RNA_def_property_ui_text(prop, "Cache Compression", "Compression method to be used");
 
-	prop= RNA_def_property(srna, "collision_extents", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "collision_extents", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "border_collisions");
 	RNA_def_property_enum_items(prop, smoke_domain_colli_items);
-	RNA_def_property_ui_text(prop, "Border Collisions", "Select which domain border will be treated as collision object");
+	RNA_def_property_ui_text(prop, "Border Collisions",
+	                         "Select which domain border will be treated as collision object");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 
-	prop= RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "EffectorWeights");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Effector Weights", "");
 
-	prop= RNA_def_property(srna, "smooth_emitter", PROP_BOOLEAN, PROP_NONE);
+	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", "Smoothen emitted smoke to avoid blockiness");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 
-	prop= RNA_def_property(srna, "time_scale", PROP_FLOAT, PROP_NONE);
+	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");
 
-	prop= RNA_def_property(srna, "vorticity", PROP_FLOAT, PROP_NONE);
+	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);
@@ -282,43 +290,43 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna)
 	RNA_def_struct_sdna(srna, "SmokeFlowSettings");
 	RNA_def_struct_path_func(srna, "rna_SmokeFlowSettings_path");
 
-	prop= RNA_def_property(srna, "density", PROP_FLOAT, PROP_NONE);
+	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_ui_text(prop, "Density", "");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 
-	prop= RNA_def_property(srna, "temperature", PROP_FLOAT, PROP_NONE);
+	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);
 	RNA_def_property_ui_range(prop, -10, 10, 1, 1);
 	RNA_def_property_ui_text(prop, "Temp. Diff.", "Temperature difference to ambient temperature");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 	
-	prop= RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "psys");
 	RNA_def_property_struct_type(prop, "ParticleSystem");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	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);
+	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");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 
-	prop= RNA_def_property(srna, "use_absolute", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_absolute", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_ABSOLUTE);
 	RNA_def_property_ui_text(prop, "Absolute Density", "Only allow given density value in emitter area");
 	RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 
-	prop= RNA_def_property(srna, "initial_velocity", PROP_BOOLEAN, PROP_NONE);
+	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_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
 
-	prop= RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE);
+	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);
@@ -344,4 +352,3 @@ void RNA_def_smoke(BlenderRNA *brna)
 }
 
 #endif
-
diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c
index f5984d2..18499fa 100644
--- a/source/blender/makesrna/intern/rna_sound.c
+++ b/source/blender/makesrna/intern/rna_sound.c
@@ -53,7 +53,7 @@ static int rna_Sound_caching_get(PointerRNA *ptr)
 static void rna_Sound_caching_set(PointerRNA *ptr, const int value)
 {
 	bSound *sound = (bSound*)(ptr->data);
-	if(value)
+	if (value)
 		sound_cache(sound);
 	else
 		sound_delete_cache(sound);
@@ -71,30 +71,31 @@ static void rna_def_sound(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "Sound", "ID");
+	srna = RNA_def_struct(brna, "Sound", "ID");
 	RNA_def_struct_sdna(srna, "bSound");
 	RNA_def_struct_ui_text(srna, "Sound", "Sound datablock referencing an external or packed sound file");
 	RNA_def_struct_ui_icon(srna, ICON_SOUND);
 
-	//rna_def_ipo_common(srna);
+	/*rna_def_ipo_common(srna); */
 
-	prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+	prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
 	RNA_def_property_string_sdna(prop, NULL, "name");
 	RNA_def_property_ui_text(prop, "File Path", "Sound sample file used by this Sound datablock");
 	RNA_def_property_update(prop, 0, "rna_Sound_update");
 
-	prop= RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
 	RNA_def_property_ui_text(prop, "Packed File", "");
 
-	prop= RNA_def_property(srna, "use_memory_cache", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_memory_cache", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_Sound_caching_get", "rna_Sound_caching_set");
 	RNA_def_property_ui_text(prop, "Caching", "The sound file is decoded and loaded into RAM");
 	RNA_def_property_update(prop, 0, "rna_Sound_caching_update");
 
-	prop= RNA_def_property(srna, "use_mono", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_mono", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", SOUND_FLAGS_MONO);
-	RNA_def_property_ui_text(prop, "Mono", "If the file contains multiple audio channels they are rendered to a single one");
+	RNA_def_property_ui_text(prop, "Mono",
+	                         "If the file contains multiple audio channels they are rendered to a single one");
 	RNA_def_property_update(prop, 0, "rna_Sound_update");
 }
 
@@ -104,5 +105,3 @@ void RNA_def_sound(BlenderRNA *brna)
 }
 
 #endif
-
-
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index f405b98..8d4b5a3 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -34,6 +34,8 @@
 
 #include "rna_internal.h"
 
+#include "BLF_translation.h"
+
 #include "BKE_key.h"
 #include "BKE_movieclip.h"
 
@@ -76,7 +78,8 @@ EnumPropertyItem space_type_items[] = {
 
 static EnumPropertyItem draw_channels_items[] = {
 	{0, "COLOR", ICON_IMAGE_RGB, "Color", "Draw image with RGB colors"},
-	{SI_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha", "Draw image with RGB colors and alpha transparency"},
+	{SI_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha",
+	               "Draw image with RGB colors and alpha transparency"},
 	{SI_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Draw alpha transparency channel"},
 	{SI_SHOW_ZBUF, "Z_BUFFER", ICON_IMAGE_ZDEPTH, "Z-Buffer",
 	               "Draw Z-buffer associated with image (mapped from camera clip start to end)"},
@@ -87,7 +90,8 @@ static EnumPropertyItem transform_orientation_items[] = {
 	{V3D_MANIP_LOCAL, "LOCAL", 0, "Local", "Align the transformation axes to the selected objects' local space"},
 	{V3D_MANIP_GIMBAL, "GIMBAL", 0, "Gimbal", "Align each axis to the Euler rotation axis as used for input"},
 	{V3D_MANIP_NORMAL, "NORMAL", 0, "Normal",
-	                   "Align the transformation axes to average normal of selected elements (bone Y axis for pose mode)"},
+	                   "Align the transformation axes to average normal of selected elements "
+	                   "(bone Y axis for pose mode)"},
 	{V3D_MANIP_VIEW, "VIEW", 0, "View", "Align the transformation axes to the window"},
 	{V3D_MANIP_CUSTOM, "CUSTOM", 0, "Custom", "Use a custom transform orientation"},
 	{0, NULL, 0, NULL, NULL}};
@@ -136,9 +140,9 @@ EnumPropertyItem viewport_shade_items[] = {
 
 static StructRNA* rna_Space_refine(struct PointerRNA *ptr)
 {
-	SpaceLink *space= (SpaceLink*)ptr->data;
+	SpaceLink *space = (SpaceLink*)ptr->data;
 
-	switch(space->spacetype) {
+	switch (space->spacetype) {
 		case SPACE_VIEW3D:
 			return &RNA_SpaceView3D;
 		case SPACE_IPO:
@@ -181,41 +185,47 @@ static StructRNA* rna_Space_refine(struct PointerRNA *ptr)
 static ScrArea *rna_area_from_space(PointerRNA *ptr)
 {
 	bScreen *sc = (bScreen*)ptr->id.data;
-	SpaceLink *link= (SpaceLink*)ptr->data;
+	SpaceLink *link = (SpaceLink*)ptr->data;
 	ScrArea *sa;
 
-	for(sa=sc->areabase.first; sa; sa=sa->next)
-		if(BLI_findindex(&sa->spacedata, link) != -1)
+	for (sa = sc->areabase.first; sa; sa = sa->next)
+		if (BLI_findindex(&sa->spacedata, link) != -1)
 			return sa;
 
 	return NULL;
 }
 
-static void rna_area_region_from_regiondata(PointerRNA *ptr, ScrArea **sa_r, ARegion **ar_r)
+static void area_region_from_regiondata(bScreen *sc, void *regiondata, ScrArea **r_sa, ARegion **r_ar)
 {
-	bScreen *sc = (bScreen*)ptr->id.data;
 	ScrArea *sa;
 	ARegion *ar;
-	void *regiondata= ptr->data;
 
-	*sa_r= NULL;
-	*ar_r= NULL;
+	*r_sa = NULL;
+	*r_ar = NULL;
 
-	for(sa=sc->areabase.first; sa; sa=sa->next) {
-		for(ar=sa->regionbase.first; ar; ar=ar->next) {
-			if(ar->regiondata == regiondata) {
-				*sa_r= sa;
-				*ar_r= ar;
+	for (sa = sc->areabase.first; sa; sa = sa->next) {
+		for (ar = sa->regionbase.first; ar; ar = ar->next) {
+			if (ar->regiondata == regiondata) {
+				*r_sa = sa;
+				*r_ar = ar;
 				return;
 			}
 		}
 	}
 }
 
+static void rna_area_region_from_regiondata(PointerRNA *ptr, ScrArea **r_sa, ARegion **r_ar)
+{
+	bScreen *sc = (bScreen*)ptr->id.data;
+	void *regiondata = ptr->data;
+
+	area_region_from_regiondata(sc, regiondata, r_sa, r_ar);
+}
+
 static PointerRNA rna_CurrentOrientation_get(PointerRNA *ptr)
 {
 	Scene *scene = ((bScreen*)ptr->id.data)->scene;
-	View3D *v3d= (View3D*)ptr->data;
+	View3D *v3d = (View3D*)ptr->data;
 	
 	if (v3d->twmode < V3D_MANIP_CUSTOM)
 		return rna_pointer_inherit_refine(ptr, &RNA_TransformOrientation, NULL);
@@ -228,10 +238,10 @@ EnumPropertyItem *rna_TransformOrientation_itemf(bContext *C, PointerRNA *ptr, P
 {
 	Scene *scene = NULL;
 	ListBase *transform_spaces;
-	TransformOrientation *ts= NULL;
+	TransformOrientation *ts = NULL;
 	EnumPropertyItem tmp = {0, "", 0, "", ""};
-	EnumPropertyItem *item= NULL;
-	int i = V3D_MANIP_CUSTOM, totitem= 0;
+	EnumPropertyItem *item = NULL;
+	int i = V3D_MANIP_CUSTOM, totitem = 0;
 
 	RNA_enum_items_add_value(&item, &totitem, transform_orientation_items, V3D_MANIP_GLOBAL);
 	RNA_enum_items_add_value(&item, &totitem, transform_orientation_items, V3D_MANIP_NORMAL);
@@ -244,25 +254,24 @@ EnumPropertyItem *rna_TransformOrientation_itemf(bContext *C, PointerRNA *ptr, P
 	else
 		scene = CTX_data_scene(C); /* can't use scene from ptr->id.data because that enum is also used by operators */
 
-	if(scene) {
+	if (scene) {
 		transform_spaces = &scene->transform_spaces;
 		ts = transform_spaces->first;
 	}
 
-	if(ts)
-	{
+	if (ts) {
 		RNA_enum_item_add_separator(&item, &totitem);
 
-		for(; ts; ts = ts->next) {
+		for (; ts; ts = ts->next) {
 			tmp.identifier = ts->name;
-			tmp.name= ts->name;
+			tmp.name = ts->name;
 			tmp.value = i++;
 			RNA_enum_item_add(&item, &totitem, &tmp);
 		}
 	}
 
 	RNA_enum_item_end(&item, &totitem);
-	*free= 1;
+	*free = 1;
 
 	return item;
 }
@@ -270,32 +279,32 @@ EnumPropertyItem *rna_TransformOrientation_itemf(bContext *C, PointerRNA *ptr, P
 /* Space 3D View */
 static void rna_SpaceView3D_lock_camera_and_layers_set(PointerRNA *ptr, int value)
 {
-	View3D *v3d= (View3D*)(ptr->data);
-	bScreen *sc= (bScreen*)ptr->id.data;
+	View3D *v3d = (View3D*)(ptr->data);
+	bScreen *sc = (bScreen*)ptr->id.data;
 
 	v3d->scenelock = value;
 
-	if(value) {
+	if (value) {
 		int bit;
-		v3d->lay= sc->scene->lay;
+		v3d->lay = sc->scene->lay;
 		/* seek for layact */
-		bit= 0;
-		while(bit<32) {
-			if(v3d->lay & (1<<bit)) {
-				v3d->layact= 1<<bit;
+		bit = 0;
+		while (bit<32) {
+			if (v3d->lay & (1<<bit)) {
+				v3d->layact = 1<<bit;
 				break;
 			}
 			bit++;
 		}
-		v3d->camera= sc->scene->camera;
+		v3d->camera = sc->scene->camera;
 	}
 }
 
 static void rna_View3D_CursorLocation_get(PointerRNA *ptr, float *values)
 {
-	View3D *v3d= (View3D*)(ptr->data);
-	bScreen *sc= (bScreen*)ptr->id.data;
-	Scene *scene= (Scene *)sc->scene;
+	View3D *v3d = (View3D*)(ptr->data);
+	bScreen *sc = (bScreen*)ptr->id.data;
+	Scene *scene = (Scene *)sc->scene;
 	float *loc = give_cursor(scene, v3d);
 	
 	copy_v3_v3(values, loc);
@@ -303,9 +312,9 @@ static void rna_View3D_CursorLocation_get(PointerRNA *ptr, float *values)
 
 static void rna_View3D_CursorLocation_set(PointerRNA *ptr, const float *values)
 {
-	View3D *v3d= (View3D*)(ptr->data);
-	bScreen *sc= (bScreen*)ptr->id.data;
-	Scene *scene= (Scene *)sc->scene;
+	View3D *v3d = (View3D*)(ptr->data);
+	bScreen *sc = (bScreen*)ptr->id.data;
+	Scene *scene = (Scene *)sc->scene;
 	float *cursor = give_cursor(scene, v3d);
 	
 	copy_v3_v3(cursor, values);
@@ -313,9 +322,9 @@ static void rna_View3D_CursorLocation_set(PointerRNA *ptr, const float *values)
 
 static void rna_SpaceView3D_layer_set(PointerRNA *ptr, const int *values)
 {
-	View3D *v3d= (View3D*)(ptr->data);
+	View3D *v3d = (View3D*)(ptr->data);
 	
-	v3d->lay= ED_view3d_scene_layer_set(v3d->lay, values, &v3d->layact);
+	v3d->lay = ED_view3d_scene_layer_set(v3d->lay, values, &v3d->layact);
 }
 
 static void rna_SpaceView3D_layer_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
@@ -323,20 +332,20 @@ static void rna_SpaceView3D_layer_update(Main *bmain, Scene *UNUSED(scene), Poin
 	DAG_on_visible_update(bmain, FALSE);
 }
 
-static void rna_SpaceView3D_viewport_shade_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_SpaceView3D_viewport_shade_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	View3D *v3d= (View3D*)(ptr->data);
-	ScrArea *sa= rna_area_from_space(ptr);
+	View3D *v3d = (View3D*)(ptr->data);
+	ScrArea *sa = rna_area_from_space(ptr);
 
-	if(v3d->drawtype != OB_RENDER) {
+	if (v3d->drawtype != OB_RENDER) {
 		ARegion *ar;
 
-		for(ar=sa->regionbase.first; ar; ar=ar->next) {
+		for (ar = sa->regionbase.first; ar; ar = ar->next) {
 			RegionView3D *rv3d = ar->regiondata;
 
-			if(rv3d && rv3d->render_engine) {
+			if (rv3d && rv3d->render_engine) {
 				RE_engine_free(rv3d->render_engine);
-				rv3d->render_engine= NULL;
+				rv3d->render_engine = NULL;
 			}
 		}
 	}
@@ -345,20 +354,20 @@ static void rna_SpaceView3D_viewport_shade_update(Main *bmain, Scene *scene, Poi
 static void rna_SpaceView3D_pivot_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
 {
 	if (U.uiflag & USER_LOCKAROUND) {
-		View3D *v3d_act= (View3D*)(ptr->data);
+		View3D *v3d_act = (View3D*)(ptr->data);
 
 		/* TODO, space looper */
 		bScreen *screen;
-		for(screen= bmain->screen.first; screen; screen= screen->id.next) {
+		for (screen = bmain->screen.first; screen; screen = screen->id.next) {
 			ScrArea *sa;
-			for(sa= screen->areabase.first; sa; sa= sa->next) {
+			for (sa = screen->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;
+				for (sl = sa->spacedata.first; sl ;sl = sl->next) {
+					if (sl->spacetype == SPACE_VIEW3D) {
+						View3D *v3d = (View3D *)sl;
 						if (v3d != v3d_act) {
-							v3d->around= v3d_act->around;
-							v3d->flag= (v3d->flag & ~V3D_ALIGN) | (v3d_act->flag & V3D_ALIGN);
+							v3d->around = v3d_act->around;
+							v3d->flag = (v3d->flag & ~V3D_ALIGN) | (v3d_act->flag & V3D_ALIGN);
 							ED_area_tag_redraw_regiontype(sa, RGN_TYPE_HEADER);
 						}
 					}
@@ -370,13 +379,13 @@ static void rna_SpaceView3D_pivot_update(Main *bmain, Scene *UNUSED(scene), Poin
 
 static PointerRNA rna_SpaceView3D_region_3d_get(PointerRNA *ptr)
 {
-	View3D *v3d= (View3D*)(ptr->data);
-	ScrArea *sa= rna_area_from_space(ptr);
-	void *regiondata= NULL;
-	if(sa) {
-		ListBase *regionbase= (sa->spacedata.first == v3d)? &sa->regionbase: &v3d->regionbase;
-		ARegion *ar= regionbase->last; /* always last in list, weak .. */
-		regiondata= ar->regiondata;
+	View3D *v3d = (View3D*)(ptr->data);
+	ScrArea *sa = rna_area_from_space(ptr);
+	void *regiondata = NULL;
+	if (sa) {
+		ListBase *regionbase = (sa->spacedata.first == v3d)? &sa->regionbase: &v3d->regionbase;
+		ARegion *ar = regionbase->last; /* always last in list, weak .. */
+		regiondata = ar->regiondata;
 	}
 
 	return rna_pointer_inherit_refine(ptr, &RNA_RegionView3D, regiondata);
@@ -384,16 +393,16 @@ static PointerRNA rna_SpaceView3D_region_3d_get(PointerRNA *ptr)
 
 static PointerRNA rna_SpaceView3D_region_quadview_get(PointerRNA *ptr)
 {
-	View3D *v3d= (View3D*)(ptr->data);
-	ScrArea *sa= rna_area_from_space(ptr);
-	void *regiondata= NULL;
-	if(sa) {
-		ListBase *regionbase= (sa->spacedata.first == v3d)? &sa->regionbase: &v3d->regionbase;
-		ARegion *ar= regionbase->last; /* always before last in list, weak .. */
+	View3D *v3d = (View3D*)(ptr->data);
+	ScrArea *sa = rna_area_from_space(ptr);
+	void *regiondata = NULL;
+	if (sa) {
+		ListBase *regionbase = (sa->spacedata.first == v3d)? &sa->regionbase: &v3d->regionbase;
+		ARegion *ar = regionbase->last; /* always before last in list, weak .. */
 
-		ar= (ar->alignment == RGN_ALIGN_QSPLIT)? ar->prev: NULL;
-		if(ar) {
-			regiondata= ar->regiondata;
+		ar = (ar->alignment == RGN_ALIGN_QSPLIT)? ar->prev: NULL;
+		if (ar) {
+			regiondata = ar->regiondata;
 		}
 	}
 
@@ -406,7 +415,7 @@ static void rna_RegionView3D_quadview_update(Main *UNUSED(main), Scene *UNUSED(s
 	ARegion *ar;
 
 	rna_area_region_from_regiondata(ptr, &sa, &ar);
-	if(sa && ar && ar->alignment==RGN_ALIGN_QSPLIT)
+	if (sa && ar && ar->alignment == RGN_ALIGN_QSPLIT)
 		ED_view3d_quadview_update(sa, ar, FALSE);
 }
 
@@ -417,62 +426,82 @@ static void rna_RegionView3D_quadview_clip_update(Main *UNUSED(main), Scene *UNU
 	ARegion *ar;
 
 	rna_area_region_from_regiondata(ptr, &sa, &ar);
-	if(sa && ar && ar->alignment==RGN_ALIGN_QSPLIT)
+	if (sa && ar && ar->alignment == RGN_ALIGN_QSPLIT)
 		ED_view3d_quadview_update(sa, ar, TRUE);
 }
 
 static void rna_RegionView3D_view_location_get(PointerRNA *ptr, float *values)
 {
-	RegionView3D *rv3d= (RegionView3D *)(ptr->data);
+	RegionView3D *rv3d = (RegionView3D *)(ptr->data);
 	negate_v3_v3(values, rv3d->ofs);
 }
 
 static void rna_RegionView3D_view_location_set(PointerRNA *ptr, const float *values)
 {
-	RegionView3D *rv3d= (RegionView3D *)(ptr->data);
+	RegionView3D *rv3d = (RegionView3D *)(ptr->data);
 	negate_v3_v3(rv3d->ofs, values);
 }
 
 static void rna_RegionView3D_view_rotation_get(PointerRNA *ptr, float *values)
 {
-	RegionView3D *rv3d= (RegionView3D *)(ptr->data);
+	RegionView3D *rv3d = (RegionView3D *)(ptr->data);
 	invert_qt_qt(values, rv3d->viewquat);
 }
 
 static void rna_RegionView3D_view_rotation_set(PointerRNA *ptr, const float *values)
 {
-	RegionView3D *rv3d= (RegionView3D *)(ptr->data);
+	RegionView3D *rv3d = (RegionView3D *)(ptr->data);
 	invert_qt_qt(rv3d->viewquat, values);
 }
 
 static void rna_RegionView3D_view_matrix_set(PointerRNA *ptr, const float *values)
 {
-	RegionView3D *rv3d= (RegionView3D *)(ptr->data);
+	RegionView3D *rv3d = (RegionView3D *)(ptr->data);
 	negate_v3_v3(rv3d->ofs, values);
 	ED_view3d_from_m4((float (*)[4])values, rv3d->ofs, rv3d->viewquat, &rv3d->dist);
 }
 
-static EnumPropertyItem *rna_SpaceView3D_viewport_shade_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
+/* api call */
+void rna_RegionView3D_update(ID *id, RegionView3D *rv3d)
+{
+	bScreen *sc = (bScreen *)id;
+
+	ScrArea *sa;
+	ARegion *ar;
+
+	area_region_from_regiondata(sc, rv3d, &sa, &ar);
+
+	if (sa && ar && sa->spacetype == SPACE_VIEW3D) {
+		View3D *v3d;
+
+		v3d = (View3D *)sa->spacedata.first;
+
+		ED_view3d_update_viewmat(sc->scene, v3d, ar, NULL, NULL);
+	}
+}
+
+static EnumPropertyItem *rna_SpaceView3D_viewport_shade_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+                                                              PropertyRNA *UNUSED(prop), int *free)
 {
 	Scene *scene = ((bScreen*)ptr->id.data)->scene;
 	RenderEngineType *type = RE_engines_find(scene->r.engine);
 	
-	EnumPropertyItem *item= NULL;
-	int totitem= 0;
+	EnumPropertyItem *item = NULL;
+	int totitem = 0;
 
 	RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_BOUNDBOX);
 	RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_WIRE);
 	RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_SOLID);
 	RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_TEXTURE);
 
-	if(scene_use_new_shading_nodes(scene))
+	if (scene_use_new_shading_nodes(scene))
 		RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_MATERIAL);
 	
-	if(type->view_draw)
+	if (type->view_draw)
 		RNA_enum_items_add_value(&item, &totitem, viewport_shade_items, OB_RENDER);
 
 	RNA_enum_item_end(&item, &totitem);
-	*free= 1;
+	*free = 1;
 
 	return item;
 }
@@ -493,27 +522,27 @@ static void rna_SpaceImageEditor_paint_update(Main *bmain, Scene *scene, Pointer
 
 static int rna_SpaceImageEditor_show_render_get(PointerRNA *ptr)
 {
-	SpaceImage *sima= (SpaceImage*)(ptr->data);
+	SpaceImage *sima = (SpaceImage*)(ptr->data);
 	return ED_space_image_show_render(sima);
 }
 
 static int rna_SpaceImageEditor_show_paint_get(PointerRNA *ptr)
 {
-	SpaceImage *sima= (SpaceImage*)(ptr->data);
+	SpaceImage *sima = (SpaceImage*)(ptr->data);
 	return ED_space_image_show_paint(sima);
 }
 
 static int rna_SpaceImageEditor_show_uvedit_get(PointerRNA *ptr)
 {
-	SpaceImage *sima= (SpaceImage*)(ptr->data);
-	bScreen *sc= (bScreen*)ptr->id.data;
+	SpaceImage *sima = (SpaceImage*)(ptr->data);
+	bScreen *sc = (bScreen*)ptr->id.data;
 	return ED_space_image_show_uvedit(sima, sc->scene->obedit);
 }
 
 static void rna_SpaceImageEditor_image_set(PointerRNA *ptr, PointerRNA value)
 {
-	SpaceImage *sima= (SpaceImage*)(ptr->data);
-	bScreen *sc= (bScreen*)ptr->id.data;
+	SpaceImage *sima = (SpaceImage*)(ptr->data);
+	bScreen *sc = (bScreen*)ptr->id.data;
 
 	ED_space_image_set(sima, sc->scene, sc->scene->obedit, (Image*)value.data);
 }
@@ -521,61 +550,62 @@ static void rna_SpaceImageEditor_image_set(PointerRNA *ptr, PointerRNA value)
 static EnumPropertyItem *rna_SpaceImageEditor_draw_channels_itemf(bContext *UNUSED(C), PointerRNA *ptr,
                                                                   PropertyRNA *UNUSED(prop), int *free)
 {
-	SpaceImage *sima= (SpaceImage*)ptr->data;
-	EnumPropertyItem *item= NULL;
+	SpaceImage *sima = (SpaceImage*)ptr->data;
+	EnumPropertyItem *item = NULL;
 	ImBuf *ibuf;
 	void *lock;
-	int zbuf, alpha, totitem= 0;
+	int zbuf, alpha, totitem = 0;
 
-	ibuf= ED_space_image_acquire_buffer(sima, &lock);
+	ibuf = ED_space_image_acquire_buffer(sima, &lock);
 	
-	alpha= ibuf && (ibuf->channels == 4);
-	zbuf= ibuf && (ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels==1));
+	alpha = ibuf && (ibuf->channels == 4);
+	zbuf = ibuf && (ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels == 1));
 
 	ED_space_image_release_buffer(sima, lock);
 
-	if(alpha && zbuf)
+	if (alpha && zbuf)
 		return draw_channels_items;
 
 	RNA_enum_items_add_value(&item, &totitem, draw_channels_items, 0);
 
-	if(alpha) {
+	if (alpha) {
 		RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_USE_ALPHA);
 		RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_SHOW_ALPHA);
 	}
-	else if(zbuf) {
+	else if (zbuf) {
 		RNA_enum_items_add_value(&item, &totitem, draw_channels_items, SI_SHOW_ZBUF);
 	}
 
 	RNA_enum_item_end(&item, &totitem);
-	*free= 1;
+	*free = 1;
 
 	return item;
 }
 
 static void rna_SpaceImageEditor_zoom_get(PointerRNA *ptr, float *values)
 {
-	SpaceImage *sima= (SpaceImage*)ptr->data;
+	SpaceImage *sima = (SpaceImage*)ptr->data;
 	ScrArea *sa;
 	ARegion *ar;
 
 	values[0] = values[1] = 1;
 
 	/* find aregion */
-	sa= rna_area_from_space(ptr); /* can be NULL */
-	ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
-	if(ar) {
+	sa = rna_area_from_space(ptr); /* can be NULL */
+	ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+	if (ar) {
 		ED_space_image_zoom(sima, ar, &values[0], &values[1]);
 	}
 }
 
 static void rna_SpaceImageEditor_cursor_location_get(PointerRNA *ptr, float *values)
 {
-	SpaceImage *sima= (SpaceImage*)ptr->data;
+	SpaceImage *sima = (SpaceImage*)ptr->data;
 	
 	if (sima->flag & SI_COORDFLOATS) {
 		copy_v2_v2(values, sima->cursor);
-	} else {
+	}
+	else {
 		int w, h;
 		ED_space_image_size(sima, &w, &h);
 		
@@ -586,11 +616,12 @@ static void rna_SpaceImageEditor_cursor_location_get(PointerRNA *ptr, float *val
 
 static void rna_SpaceImageEditor_cursor_location_set(PointerRNA *ptr, const float *values)
 {
-	SpaceImage *sima= (SpaceImage*)ptr->data;
+	SpaceImage *sima = (SpaceImage*)ptr->data;
 	
 	if (sima->flag & SI_COORDFLOATS) {
 		copy_v2_v2(sima->cursor, values);
-	} else {
+	}
+	else {
 		int w, h;
 		ED_space_image_size(sima, &w, &h);
 		
@@ -601,12 +632,12 @@ static void rna_SpaceImageEditor_cursor_location_set(PointerRNA *ptr, const floa
 
 static void rna_SpaceImageEditor_curves_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	SpaceImage *sima= (SpaceImage*)ptr->data;
+	SpaceImage *sima = (SpaceImage*)ptr->data;
 	ImBuf *ibuf;
 	void *lock;
 
-	ibuf= ED_space_image_acquire_buffer(sima, &lock);
-	if(ibuf->rect_float)
+	ibuf = ED_space_image_acquire_buffer(sima, &lock);
+	if (ibuf->rect_float)
 		curvemapping_do_ibuf(sima->cumap, ibuf);
 	ED_space_image_release_buffer(sima, lock);
 
@@ -615,12 +646,12 @@ static void rna_SpaceImageEditor_curves_update(Main *UNUSED(bmain), Scene *UNUSE
 
 static void rna_SpaceImageEditor_scopes_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
 {
-	SpaceImage *sima= (SpaceImage*)ptr->data;
+	SpaceImage *sima = (SpaceImage*)ptr->data;
 	ImBuf *ibuf;
 	void *lock;
 	
-	ibuf= ED_space_image_acquire_buffer(sima, &lock);
-	if(ibuf) {
+	ibuf = ED_space_image_acquire_buffer(sima, &lock);
+	if (ibuf) {
 		scopes_update(&sima->scopes, ibuf, scene->r.color_mgt_flag & R_COLOR_MANAGEMENT);
 		WM_main_add_notifier(NC_IMAGE, sima->image);
 	}
@@ -631,26 +662,26 @@ static void rna_SpaceImageEditor_scopes_update(Main *UNUSED(bmain), Scene *scene
 
 static void rna_SpaceTextEditor_word_wrap_set(PointerRNA *ptr, int value)
 {
-	SpaceText *st= (SpaceText*)(ptr->data);
+	SpaceText *st = (SpaceText*)(ptr->data);
 
-	st->wordwrap= value;
-	st->left= 0;
+	st->wordwrap = value;
+	st->left = 0;
 }
 
 static void rna_SpaceTextEditor_text_set(PointerRNA *ptr, PointerRNA value)
 {
-	SpaceText *st= (SpaceText*)(ptr->data);
+	SpaceText *st = (SpaceText*)(ptr->data);
 
-	st->text= value.data;
+	st->text = value.data;
 
 	WM_main_add_notifier(NC_TEXT|NA_SELECTED, st->text);
 }
 
 static void rna_SpaceTextEditor_updateEdited(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	SpaceText *st= (SpaceText*)ptr->data;
+	SpaceText *st = (SpaceText*)ptr->data;
 
-	if(st->text)
+	if (st->text)
 		WM_main_add_notifier(NC_TEXT|NA_EDITED, st->text);
 }
 
@@ -660,15 +691,15 @@ static void rna_SpaceTextEditor_updateEdited(Main *UNUSED(bmain), Scene *UNUSED(
 /* note: this function exists only to avoid id refcounting */
 static void rna_SpaceProperties_pin_id_set(PointerRNA *ptr, PointerRNA value)
 {
-	SpaceButs *sbuts= (SpaceButs*)(ptr->data);
-	sbuts->pinid= value.data;
+	SpaceButs *sbuts = (SpaceButs*)(ptr->data);
+	sbuts->pinid = value.data;
 }
 
 static StructRNA *rna_SpaceProperties_pin_id_typef(PointerRNA *ptr)
 {
-	SpaceButs *sbuts= (SpaceButs*)(ptr->data);
+	SpaceButs *sbuts = (SpaceButs*)(ptr->data);
 
-	if(sbuts->pinid)
+	if (sbuts->pinid)
 		return ID_code_to_RNA_type(GS(sbuts->pinid->name));
 
 	return &RNA_ID;
@@ -676,7 +707,7 @@ static StructRNA *rna_SpaceProperties_pin_id_typef(PointerRNA *ptr)
 
 static void rna_SpaceProperties_pin_id_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	SpaceButs *sbuts= (SpaceButs*)(ptr->data);
+	SpaceButs *sbuts = (SpaceButs*)(ptr->data);
 	ID *id = sbuts->pinid;
 	
 	if (id == NULL) {
@@ -703,68 +734,68 @@ static void rna_SpaceProperties_pin_id_update(Main *UNUSED(bmain), Scene *UNUSED
 
 static void rna_SpaceProperties_context_set(PointerRNA *ptr, int value)
 {
-	SpaceButs *sbuts= (SpaceButs*)(ptr->data);
+	SpaceButs *sbuts = (SpaceButs*)(ptr->data);
 	
-	sbuts->mainb= value;
+	sbuts->mainb = value;
 	sbuts->mainbuser = value;
 }
 
 static void rna_SpaceProperties_align_set(PointerRNA *ptr, int value)
 {
-	SpaceButs *sbuts= (SpaceButs*)(ptr->data);
+	SpaceButs *sbuts = (SpaceButs*)(ptr->data);
 
-	sbuts->align= value;
-	sbuts->re_align= 1;
+	sbuts->align = value;
+	sbuts->re_align = 1;
 }
 
 /* Space Console */
 static void rna_ConsoleLine_body_get(PointerRNA *ptr, char *value)
 {
-	ConsoleLine *ci= (ConsoleLine*)ptr->data;
+	ConsoleLine *ci = (ConsoleLine*)ptr->data;
 	strcpy(value, ci->line);
 }
 
 static int rna_ConsoleLine_body_length(PointerRNA *ptr)
 {
-	ConsoleLine *ci= (ConsoleLine*)ptr->data;
+	ConsoleLine *ci = (ConsoleLine*)ptr->data;
 	return ci->len;
 }
 
 static void rna_ConsoleLine_body_set(PointerRNA *ptr, const char *value)
 {
-	ConsoleLine *ci= (ConsoleLine*)ptr->data;
-	int len= strlen(value);
+	ConsoleLine *ci = (ConsoleLine*)ptr->data;
+	int len = strlen(value);
 	
-	if((len >= ci->len_alloc) || (len * 2 < ci->len_alloc) ) { /* allocate a new string */
+	if ((len >= ci->len_alloc) || (len * 2 < ci->len_alloc) ) { /* allocate a new string */
 		MEM_freeN(ci->line);
-		ci->line= MEM_mallocN((len + 1) * sizeof(char), "rna_consoleline");
-		ci->len_alloc= len + 1;
+		ci->line = MEM_mallocN((len + 1) * sizeof(char), "rna_consoleline");
+		ci->len_alloc = len + 1;
 	}
 	memcpy(ci->line, value, len + 1);
-	ci->len= len;
+	ci->len = len;
 
-	if(ci->cursor > len) /* clamp the cursor */
-		ci->cursor= len;
+	if (ci->cursor > len) /* clamp the cursor */
+		ci->cursor = len;
 }
 
-static void rna_ConsoleLine_cursor_index_range(PointerRNA *ptr, int *min, int *max)
+static void rna_ConsoleLine_cursor_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
 {
-	ConsoleLine *ci= (ConsoleLine*)ptr->data;
+	ConsoleLine *ci = (ConsoleLine*)ptr->data;
 
-	*min= 0;
-	*max= ci->len; /* intentionally _not_ -1 */
+	*min = 0;
+	*max = ci->len; /* intentionally _not_ -1 */
 }
 
 /* Space Dopesheet */
 
 static void rna_SpaceDopeSheetEditor_action_set(PointerRNA *ptr, PointerRNA value)
 {
-	SpaceAction *saction= (SpaceAction*)(ptr->data);
+	SpaceAction *saction = (SpaceAction*)(ptr->data);
 	bAction *act = (bAction*)value.data;
 	
 	if ((act == NULL) || (act->idroot == 0)) {
 		/* just set if we're clearing the action or if the action is "amorphous" still */
-		saction->action= act;
+		saction->action = act;
 	}
 	else {
 		/* action to set must strictly meet the mode criteria... */
@@ -792,21 +823,21 @@ static void rna_SpaceDopeSheetEditor_action_set(PointerRNA *ptr, PointerRNA valu
 
 static void rna_SpaceDopeSheetEditor_action_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
 {
-	SpaceAction *saction= (SpaceAction*)(ptr->data);
-	Object *obact= (scene->basact)? scene->basact->object: NULL;
+	SpaceAction *saction = (SpaceAction*)(ptr->data);
+	Object *obact = (scene->basact)? scene->basact->object: NULL;
 
 	/* we must set this action to be the one used by active object (if not pinned) */
 	if (obact/* && saction->pin == 0*/) {
 		AnimData *adt = NULL;
 		
 		if (saction->mode == SACTCONT_ACTION) {
-			// TODO: context selector could help decide this with more control?
-			adt= BKE_id_add_animdata(&obact->id); /* this only adds if non-existant */
+			/* TODO: context selector could help decide this with more control? */
+			adt = BKE_id_add_animdata(&obact->id); /* this only adds if non-existant */
 		}
 		else if (saction->mode == SACTCONT_SHAPEKEY) {
 			Key *key = ob_get_key(obact);
 			if (key)
-				adt= BKE_id_add_animdata(&key->id); /* this only adds if non-existant */
+				adt = BKE_id_add_animdata(&key->id); /* this only adds if non-existant */
 		}
 		
 		/* set action */
@@ -815,7 +846,7 @@ static void rna_SpaceDopeSheetEditor_action_update(Main *UNUSED(bmain), Scene *s
 			id_us_min(&adt->action->id);
 			
 			/* show new id-count of action we're replacing */
-			adt->action= saction->action;
+			adt->action = saction->action;
 			id_us_plus(&adt->action->id);
 		}
 		
@@ -826,8 +857,8 @@ static void rna_SpaceDopeSheetEditor_action_update(Main *UNUSED(bmain), Scene *s
 
 static void rna_SpaceDopeSheetEditor_mode_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
 {
-	SpaceAction *saction= (SpaceAction*)(ptr->data);
-	Object *obact= (scene->basact)? scene->basact->object: NULL;
+	SpaceAction *saction = (SpaceAction*)(ptr->data);
+	Object *obact = (scene->basact)? scene->basact->object: NULL;
 	
 	/* special exceptions for ShapeKey Editor mode */
 	if (saction->mode == SACTCONT_SHAPEKEY) {
@@ -848,7 +879,7 @@ static void rna_SpaceDopeSheetEditor_mode_update(Main *UNUSED(bmain), Scene *sce
 	/* make sure action stored is valid */
 	else if (saction->mode == SACTCONT_ACTION) {
 		/* 1)	update the action stored for the editor */
-		// TODO: context selector could help decide this with more control?
+		/* TODO: context selector could help decide this with more control? */
 		if (obact)
 			saction->action = (obact->adt)? obact->adt->action : NULL;
 		else
@@ -860,9 +891,9 @@ static void rna_SpaceDopeSheetEditor_mode_update(Main *UNUSED(bmain), Scene *sce
 
 static void rna_SpaceGraphEditor_display_mode_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	ScrArea *sa= rna_area_from_space(ptr);
+	ScrArea *sa = rna_area_from_space(ptr);
 	
-	/* after changing view mode, must force recalculation of F-Curve colors 
+	/* after changing view mode, must force recalculation of F-Curve colors
 	 * which can only be achieved using refresh as opposed to redraw
 	 */
 	ED_area_tag_refresh(sa);
@@ -870,31 +901,31 @@ static void rna_SpaceGraphEditor_display_mode_update(Main *UNUSED(bmain), Scene
 
 static int rna_SpaceGraphEditor_has_ghost_curves_get(PointerRNA *ptr)
 {
-	SpaceIpo *sipo= (SpaceIpo*)(ptr->data);
+	SpaceIpo *sipo = (SpaceIpo*)(ptr->data);
 	return (sipo->ghostCurves.first != NULL);
 }
 
 static void rna_Sequencer_view_type_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	ScrArea *sa= rna_area_from_space(ptr);
+	ScrArea *sa = rna_area_from_space(ptr);
 	ED_area_tag_refresh(sa);
 }
 
 static float rna_BackgroundImage_opacity_get(PointerRNA *ptr)
 {
-	BGpic *bgpic= (BGpic *)ptr->data;
+	BGpic *bgpic = (BGpic *)ptr->data;
 	return 1.0f-bgpic->blend;
 }
 
 static void rna_BackgroundImage_opacity_set(PointerRNA *ptr, float value)
 {
-	BGpic *bgpic= (BGpic *)ptr->data;
+	BGpic *bgpic = (BGpic *)ptr->data;
 	bgpic->blend = 1.0f - value;
 }
 
 static BGpic *rna_BackgroundImage_new(View3D *v3d)
 {
-	BGpic *bgpic= ED_view3D_background_image_new(v3d);
+	BGpic *bgpic = ED_view3D_background_image_new(v3d);
 
 	WM_main_add_notifier(NC_SPACE|ND_SPACE_VIEW3D, v3d);
 
@@ -922,16 +953,16 @@ static void rna_BackgroundImage_clear(View3D *v3d)
 
 static int rna_SpaceNodeEditor_node_tree_poll(PointerRNA *ptr, PointerRNA value)
 {
-	SpaceNode *snode= (SpaceNode*)ptr->data;
-	bNodeTree *ntree= (bNodeTree*)value.data;
+	SpaceNode *snode = (SpaceNode*)ptr->data;
+	bNodeTree *ntree = (bNodeTree*)value.data;
 	
 	/* exclude group trees, only trees of the active type */
-	return (ntree->nodetype==0 && ntree->type == snode->treetype);
+	return (ntree->nodetype == 0 && ntree->type == snode->treetype);
 }
 
 static void rna_SpaceNodeEditor_node_tree_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
 {
-	SpaceNode *snode= (SpaceNode*)ptr->data;
+	SpaceNode *snode = (SpaceNode*)ptr->data;
 	
 	ED_node_tree_update(snode, scene);
 }
@@ -941,19 +972,19 @@ static EnumPropertyItem *rna_SpaceProperties_texture_context_itemf(bContext *C,
 {
 	Scene *scene = CTX_data_scene(C);
 	Object *ob = CTX_data_active_object(C);
-	EnumPropertyItem *item= NULL;
-	EnumPropertyItem tmp= {0, "", 0, "", ""};
-	int totitem= 0;
+	EnumPropertyItem *item = NULL;
+	EnumPropertyItem tmp = {0, "", 0, "", ""};
+	int totitem = 0;
 
-	if(ob) {
-		if(ob->type == OB_LAMP) {
+	if (ob) {
+		if (ob->type == OB_LAMP) {
 			tmp.value = SB_TEXC_MAT_OR_LAMP;
 			tmp.description = "Show Lamp Textures";
 			tmp.identifier = "LAMP";
 			tmp.icon = ICON_LAMP_POINT;
 			RNA_enum_item_add(&item, &totitem, &tmp);
 		}
-		else if(ob->totcol) {
+		else if (ob->totcol) {
 			tmp.value = SB_TEXC_MAT_OR_LAMP;
 			tmp.description = "Show Material Textures";
 			tmp.identifier = "MATERIAL";
@@ -961,7 +992,7 @@ static EnumPropertyItem *rna_SpaceProperties_texture_context_itemf(bContext *C,
 			RNA_enum_item_add(&item, &totitem, &tmp);
 		}
 
-		if(ob->particlesystem.first) {
+		if (ob->particlesystem.first) {
 			tmp.value = SB_TEXC_PARTICLES;
 			tmp.description = "Show Particle Textures";
 			tmp.identifier = "PARTICLE";
@@ -970,7 +1001,7 @@ static EnumPropertyItem *rna_SpaceProperties_texture_context_itemf(bContext *C,
 		}
 	}
 
-	if(scene && scene->world) {
+	if (scene && scene->world) {
 		tmp.value = SB_TEXC_WORLD;
 		tmp.description = "Show World Textures";
 		tmp.identifier = "WORLD";
@@ -992,29 +1023,29 @@ static EnumPropertyItem *rna_SpaceProperties_texture_context_itemf(bContext *C,
 
 static void rna_SpaceClipEditor_clip_set(PointerRNA *ptr, PointerRNA value)
 {
-	SpaceClip *sc= (SpaceClip*)(ptr->data);
+	SpaceClip *sc = (SpaceClip*)(ptr->data);
 
 	ED_space_clip_set(NULL, sc, (MovieClip*)value.data);
 }
 
 static void rna_SpaceClipEditor_clip_mode_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	SpaceClip *sc= (SpaceClip*)(ptr->data);
+	SpaceClip *sc = (SpaceClip*)(ptr->data);
 
-	sc->scopes.ok= 0;
+	sc->scopes.ok = 0;
 }
 
 static void rna_SpaceClipEditor_lock_selection_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	SpaceClip *sc= (SpaceClip*)(ptr->data);
+	SpaceClip *sc = (SpaceClip*)(ptr->data);
 
-	sc->xlockof= 0.f;
-	sc->ylockof= 0.f;
+	sc->xlockof = 0.f;
+	sc->ylockof = 0.f;
 }
 
 static void rna_SpaceClipEditor_view_type_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	ScrArea *sa= rna_area_from_space(ptr);
+	ScrArea *sa = rna_area_from_space(ptr);
 	ED_area_tag_refresh(sa);
 }
 
@@ -1025,12 +1056,12 @@ static void rna_def_space(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "Space", NULL);
+	srna = RNA_def_struct(brna, "Space", NULL);
 	RNA_def_struct_sdna(srna, "SpaceLink");
 	RNA_def_struct_ui_text(srna, "Space", "Space data for a screen area");
 	RNA_def_struct_refine_func(srna, "rna_Space_refine");
 	
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "spacetype");
 	RNA_def_property_enum_items(prop, space_type_items);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -1068,13 +1099,13 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
 		{V3D_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "SpaceUVEditor", NULL);
+	srna = RNA_def_struct(brna, "SpaceUVEditor", NULL);
 	RNA_def_struct_sdna(srna, "SpaceImage");
 	RNA_def_struct_nested(brna, srna, "SpaceImageEditor");
 	RNA_def_struct_ui_text(srna, "Space UV Editor", "UV editor data for the image editor space");
 
 	/* selection */
-	prop= RNA_def_property(srna, "sticky_select_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "sticky_select_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "sticky");
 	RNA_def_property_enum_items(prop, sticky_mode_items);
 	RNA_def_property_ui_text(prop, "Sticky Selection Mode",
@@ -1082,51 +1113,52 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
 
 	/* drawing */
-	prop= RNA_def_property(srna, "edge_draw_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "edge_draw_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "dt_uv");
 	RNA_def_property_enum_items(prop, dt_uv_items);
 	RNA_def_property_ui_text(prop, "Edge Draw Type", "Draw type for drawing UV edges");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
 
-	prop= RNA_def_property(srna, "show_smooth_edges", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_smooth_edges", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_SMOOTH_UV);
 	RNA_def_property_ui_text(prop, "Draw Smooth Edges", "Draw UV edges anti-aliased");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
 
-	prop= RNA_def_property(srna, "show_stretch", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_stretch", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_STRETCH);
 	RNA_def_property_ui_text(prop, "Draw Stretch",
 	                         "Draw faces colored according to the difference in shape between UVs and "
 	                         "their 3D coordinates (blue for low distortion, red for high distortion)");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
 
-	prop= RNA_def_property(srna, "draw_stretch_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "draw_stretch_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "dt_uvstretch");
 	RNA_def_property_enum_items(prop, dt_uvstretch_items);
 	RNA_def_property_ui_text(prop, "Draw Stretch Type", "Type of stretch to draw");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
 
-	prop= RNA_def_property(srna, "show_modified_edges", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_modified_edges", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAWSHADOW);
 	RNA_def_property_ui_text(prop, "Draw Modified Edges", "Draw edges after modifiers are applied");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
 
-	prop= RNA_def_property(srna, "show_other_objects", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_other_objects", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_OTHER);
 	RNA_def_property_ui_text(prop, "Draw Other Objects", "Draw other selected objects that share the same image");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
 
-	prop= RNA_def_property(srna, "show_normalized_coords", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_normalized_coords", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_COORDFLOATS);
-	RNA_def_property_ui_text(prop, "Normalized Coordinates", "Display UV coordinates from 0.0 to 1.0 rather than in pixels");
+	RNA_def_property_ui_text(prop, "Normalized Coordinates",
+	                         "Display UV coordinates from 0.0 to 1.0 rather than in pixels");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
 
-	prop= RNA_def_property(srna, "show_faces", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_faces", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SI_NO_DRAWFACES);
 	RNA_def_property_ui_text(prop, "Draw Faces", "Draw faces over the image");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
 
-	prop= RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_array(prop, 2);
 	RNA_def_property_float_funcs(prop, "rna_SpaceImageEditor_cursor_location_get",
 	                             "rna_SpaceImageEditor_cursor_location_set", NULL);
@@ -1135,23 +1167,24 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
 
 	/* todo: move edge and face drawing options here from G.f */
 
-	prop= RNA_def_property(srna, "use_snap_to_pixels", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_snap_to_pixels", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_PIXELSNAP);
 	RNA_def_property_ui_text(prop, "Snap to Pixels", "Snap UVs to pixel locations while editing");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
 
-	prop= RNA_def_property(srna, "lock_bounds", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_bounds", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_CLIP_UV);
-	RNA_def_property_ui_text(prop, "Constrain to Image Bounds", "Constraint to stay within the image bounds while editing");
+	RNA_def_property_ui_text(prop, "Constrain to Image Bounds",
+	                         "Constraint to stay within the image bounds while editing");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
 
-	prop= RNA_def_property(srna, "use_live_unwrap", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_live_unwrap", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_LIVE_UNWRAP);
 	RNA_def_property_ui_text(prop, "Live Unwrap",
 	                         "Continuously unwrap the selected UV island while transforming pinned vertices");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
 
-	prop= RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "around");
 	RNA_def_property_enum_items(prop, pivot_items);
 	RNA_def_property_ui_text(prop, "Pivot", "Rotation/Scaling Pivot");
@@ -1169,7 +1202,8 @@ static void rna_def_space_outliner(BlenderRNA *brna)
 		{SO_VISIBLE, "VISIBLE_LAYERS", 0, "Visible Layers", "Display datablocks in visible layers"},
 		{SO_SELECTED, "SELECTED", 0, "Selected", "Display datablocks of selected objects"},
 		{SO_ACTIVE, "ACTIVE", 0, "Active", "Display datablocks of active object"},
-		{SO_SAME_TYPE, "SAME_TYPES", 0, "Same Types", "Display datablocks of all objects of same type as selected object"},
+		{SO_SAME_TYPE, "SAME_TYPES", 0, "Same Types",
+		               "Display datablocks of all objects of same type as selected object"},
 		{SO_GROUPS, "GROUPS", 0, "Groups", "Display groups and their datablocks"},
 		{SO_LIBRARIES, "LIBRARIES", 0, "Libraries", "Display libraries"},
 		{SO_SEQUENCE, "SEQUENCE", 0, "Sequence", "Display sequence datablocks"},
@@ -1178,32 +1212,32 @@ static void rna_def_space_outliner(BlenderRNA *brna)
 		{SO_KEYMAP, "KEYMAPS", 0, "Key Maps", "Display keymap datablocks"},
 		{0, NULL, 0, NULL, NULL}};
 	
-	srna= RNA_def_struct(brna, "SpaceOutliner", "Space");
+	srna = RNA_def_struct(brna, "SpaceOutliner", "Space");
 	RNA_def_struct_sdna(srna, "SpaceOops");
 	RNA_def_struct_ui_text(srna, "Space Outliner", "Outliner space data");
 	
-	prop= RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "outlinevis");
 	RNA_def_property_enum_items(prop, display_mode_items);
 	RNA_def_property_ui_text(prop, "Display Mode", "Type of information to display");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_OUTLINER, NULL);
 	
-	prop= RNA_def_property(srna, "filter_text", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "filter_text", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "search_string");
 	RNA_def_property_ui_text(prop, "Display Filter", "Live search filtering string");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_OUTLINER, NULL);
 	
-	prop= RNA_def_property(srna, "use_filter_case_sensitive", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_filter_case_sensitive", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "search_flags", SO_FIND_CASE_SENSITIVE);
 	RNA_def_property_ui_text(prop, "Case Sensitive Matches Only", "Only use case sensitive matches of search string");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_OUTLINER, NULL);
 	
-	prop= RNA_def_property(srna, "use_filter_complete", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_filter_complete", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "search_flags", SO_FIND_COMPLETE);
 	RNA_def_property_ui_text(prop, "Complete Matches Only", "Only use complete matches of search string");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_OUTLINER, NULL);
 	
-	prop= RNA_def_property(srna, "show_restrict_columns", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_restrict_columns", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SO_HIDE_RESTRICTCOLS);
 	RNA_def_property_ui_text(prop, "Show Restriction Columns", "Show column");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_OUTLINER, NULL);
@@ -1214,21 +1248,21 @@ static void rna_def_background_image(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	/* note: combinations work but dont flip so arnt that useful */
+	/* note: combinations work but don't flip so arnt that useful */
 	static EnumPropertyItem bgpic_axis_items[] = {
-		{0, "", 0, "X Axis", ""},
+		{0, "", 0, N_("X Axis"), ""},
 		{(1<<RV3D_VIEW_LEFT), "LEFT", 0, "Left", "Show background image while looking to the left"},
 		{(1<<RV3D_VIEW_RIGHT), "RIGHT", 0, "Right", "Show background image while looking to the right"},
 		/*{(1<<RV3D_VIEW_LEFT)|(1<<RV3D_VIEW_RIGHT), "LEFT_RIGHT", 0, "Left/Right", ""},*/
-		{0, "", 0, "Y Axis", ""},
+		{0, "", 0, N_("Y Axis"), ""},
 		{(1<<RV3D_VIEW_BACK), "BACK", 0, "Back", "Show background image in back view"},
 		{(1<<RV3D_VIEW_FRONT), "FRONT", 0, "Front", "Show background image in front view"},
 		/*{(1<<RV3D_VIEW_BACK)|(1<<RV3D_VIEW_FRONT), "BACK_FRONT", 0, "Back/Front", ""},*/
-		{0, "", 0, "Z Axis", ""},
+		{0, "", 0, N_("Z Axis"), ""},
 		{(1<<RV3D_VIEW_BOTTOM), "BOTTOM", 0, "Bottom", "Show background image in bottom view"},
 		{(1<<RV3D_VIEW_TOP), "TOP", 0, "Top", "Show background image in top view"},
 		/*{(1<<RV3D_VIEW_BOTTOM)|(1<<RV3D_VIEW_TOP), "BOTTOM_TOP", 0, "Top/Bottom", ""},*/
-		{0, "", 0, "Other", ""},
+		{0, "", 0, N_("Other"), ""},
 		{0, "ALL", 0, "All Views", "Show background image in all views"},
 		{(1<<RV3D_VIEW_CAMERA), "CAMERA", 0, "Camera", "Show background image in camera view"},
 		{0, NULL, 0, NULL, NULL}};
@@ -1239,84 +1273,90 @@ static void rna_def_background_image(BlenderRNA *brna)
 	    {0, NULL, 0, NULL, NULL}
 	};
 
-	srna= RNA_def_struct(brna, "BackgroundImage", NULL);
+	srna = RNA_def_struct(brna, "BackgroundImage", NULL);
 	RNA_def_struct_sdna(srna, "BGpic");
 	RNA_def_struct_ui_text(srna, "Background Image", "Image and settings for display in the 3d View background");
 
-	prop= RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "source");
 	RNA_def_property_enum_items(prop, bgpic_source_items);
 	RNA_def_property_ui_text(prop, "Background Source", "Data source used for background");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "ima");
 	RNA_def_property_ui_text(prop, "Image", "Image displayed and edited in this space");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "clip");
 	RNA_def_property_ui_text(prop, "MovieClip", "Movie clip displayed and edited in this space");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "iuser");
-	RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed");
+	RNA_def_property_ui_text(prop, "Image User",
+	                         "Parameters defining which layer, pass and frame of the image is displayed");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "clip_user", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "clip_user", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "MovieClipUser");
 	RNA_def_property_pointer_sdna(prop, NULL, "cuser");
 	RNA_def_property_ui_text(prop, "Clip User", "Parameters defining which frame of the movie clip is displayed");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 	
-	prop= RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "xof");
 	RNA_def_property_ui_text(prop, "X Offset", "Offset image horizontally from the world origin");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 	
-	prop= RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "yof");
 	RNA_def_property_ui_text(prop, "Y Offset", "Offset image vertically from the world origin");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 	
-	prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "size");
 	RNA_def_property_ui_text(prop, "Size", "Scaling factor for the background image");
 	RNA_def_property_range(prop, 0.0, FLT_MAX);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 	
-	prop= RNA_def_property(srna, "opacity", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "opacity", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "blend");
 	RNA_def_property_float_funcs(prop, "rna_BackgroundImage_opacity_get", "rna_BackgroundImage_opacity_set", NULL);
 	RNA_def_property_ui_text(prop, "Opacity", "Image opacity to blend the image against the background color");
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "view_axis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "view_axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "view");
 	RNA_def_property_enum_items(prop, bgpic_axis_items);
 	RNA_def_property_ui_text(prop, "Image Axis", "The axis to display the image on");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	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, "flag", V3D_BGPIC_EXPANDED);
 	RNA_def_property_ui_text(prop, "Show Expanded", "Show the expanded in the user interface");
 	RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
 
-	prop= RNA_def_property(srna, "use_camera_clip", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_camera_clip", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_BGPIC_CAMERACLIP);
 	RNA_def_property_ui_text(prop, "Camera Clip", "Use movie clip from active scene camera");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "show_background_image", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_background_image", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", V3D_BGPIC_DISABLED);
 	RNA_def_property_ui_text(prop, "Show Background Image", "Show this image as background");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+
+	prop = RNA_def_property(srna, "show_on_foreground", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_BGPIC_FOREGROUND);
+	RNA_def_property_ui_text(prop, "Show On Foreground", "Show this image in front of objects in viewport");
+	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 }
 
 static void rna_def_backgroundImages(BlenderRNA *brna, PropertyRNA *cprop)
@@ -1326,22 +1366,22 @@ static void rna_def_backgroundImages(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, "BackgroundImages");
-	srna= RNA_def_struct(brna, "BackgroundImages", NULL);
+	srna = RNA_def_struct(brna, "BackgroundImages", NULL);
 	RNA_def_struct_sdna(srna, "View3D");
 	RNA_def_struct_ui_text(srna, "Background Images", "Collection of background images");
 
-	func= RNA_def_function(srna, "new", "rna_BackgroundImage_new");
+	func = RNA_def_function(srna, "new", "rna_BackgroundImage_new");
 	RNA_def_function_ui_description(func, "Add new background image");
-	parm= RNA_def_pointer(func, "image", "BackgroundImage", "", "Image displayed as viewport background");
+	parm = RNA_def_pointer(func, "image", "BackgroundImage", "", "Image displayed as viewport background");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_BackgroundImage_remove");
+	func = RNA_def_function(srna, "remove", "rna_BackgroundImage_remove");
 	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");
+	parm = RNA_def_pointer(func, "image", "BackgroundImage", "", "Image displayed as viewport background");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "clear", "rna_BackgroundImage_clear");
+	func = RNA_def_function(srna, "clear", "rna_BackgroundImage_clear");
 	RNA_def_function_ui_description(func, "Remove all background images");
 }
 
@@ -1349,14 +1389,16 @@ static void rna_def_space_view3d(BlenderRNA *brna)
 {
 	StructRNA *srna;
 	PropertyRNA *prop;
-	const int matrix_dimsize[]= {4, 4};
+	const int matrix_dimsize[] = {4, 4};
 		
 	static EnumPropertyItem pivot_items[] = {
 		{V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center",
 		             "Pivot around bounding box center of selected object(s)"},
 		{V3D_CURSOR, "CURSOR", ICON_CURSOR, "3D Cursor", "Pivot around the 3D cursor"},
-		{V3D_LOCAL, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION, "Individual Origins", "Pivot around each object's own origin"},
-		{V3D_CENTROID, "MEDIAN_POINT", ICON_ROTATECENTER, "Median Point", "Pivot around the median point of selected objects"},
+		{V3D_LOCAL, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION,
+		            "Individual Origins", "Pivot around each object's own origin"},
+		{V3D_CENTROID, "MEDIAN_POINT", ICON_ROTATECENTER, "Median Point",
+		               "Pivot around the median point of selected objects"},
 		{V3D_ACTIVE, "ACTIVE_ELEMENT", ICON_ROTACTIVE, "Active Element", "Pivot around active object"},
 		{0, NULL, 0, NULL, NULL}};
 
@@ -1376,205 +1418,215 @@ static void rna_def_space_view3d(BlenderRNA *brna)
 		{OB_EMPTY_CONE, "CONE", 0, "Cone", ""},
 		{0, NULL, 0, NULL, NULL}};
 	
-	srna= RNA_def_struct(brna, "SpaceView3D", "Space");
+	srna = RNA_def_struct(brna, "SpaceView3D", "Space");
 	RNA_def_struct_sdna(srna, "View3D");
 	RNA_def_struct_ui_text(srna, "3D View Space", "3D View space data");
 	
-	prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_pointer_sdna(prop, NULL, "camera");
-	RNA_def_property_ui_text(prop, "Camera", "Active camera used in this view (when unlocked from the scene's active camera)");
+	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);
 	
-	prop= RNA_def_property(srna, "lock_object", PROP_POINTER, PROP_NONE);
+	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");
 	RNA_def_property_ui_text(prop, "Lock to Object", "3D View center is locked to this object's position");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 	
-	prop= RNA_def_property(srna, "lock_bone", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_bone", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "ob_centre_bone");
 	RNA_def_property_ui_text(prop, "Lock to Bone", "3D View center is locked to this bone's position");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "lock_cursor", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_cursor", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ob_centre_cursor", 1);
 	RNA_def_property_ui_text(prop, "Lock to Cursor", "3D View center is locked to the cursor's position");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "viewport_shade", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "viewport_shade", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "drawtype");
 	RNA_def_property_enum_items(prop, viewport_shade_items);
 	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceView3D_viewport_shade_itemf");
 	RNA_def_property_ui_text(prop, "Viewport Shading", "Method to display/shade objects in the 3D View");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_SpaceView3D_viewport_shade_update");
 
-	prop= RNA_def_property(srna, "local_view", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "local_view", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "localvd");
-	RNA_def_property_ui_text(prop, "Local View", "Display an isolated sub-set of objects, apart from the scene visibility");
+	RNA_def_property_ui_text(prop, "Local View",
+	                         "Display an isolated sub-set of objects, apart from the scene visibility");
 	
-	prop= RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ_LENGTH);
+	prop = RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ_LENGTH);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_float_funcs(prop, "rna_View3D_CursorLocation_get", "rna_View3D_CursorLocation_set", NULL);
-	RNA_def_property_ui_text(prop, "3D Cursor Location", "3D cursor location for this view (dependent on local view setting)");
+	RNA_def_property_ui_text(prop, "3D Cursor Location",
+	                         "3D cursor location for this view (dependent on local view setting)");
 	RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 	
-	prop= RNA_def_property(srna, "lens", PROP_FLOAT, PROP_NONE);
+	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_range(prop, 1.0f, 250.0f);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 	
-	prop= RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "near");
 	RNA_def_property_range(prop, 0.001f, FLT_MAX);
+	RNA_def_property_float_default(prop, 0.1f);
 	RNA_def_property_ui_text(prop, "Clip Start", "3D View near clipping distance");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "far");
 	RNA_def_property_range(prop, 1.0f, FLT_MAX);
+	RNA_def_property_float_default(prop, 1000.0f);
 	RNA_def_property_ui_text(prop, "Clip End", "3D View far clipping distance");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "grid_scale", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "grid_scale", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "grid");
 	RNA_def_property_ui_text(prop, "Grid Scale", "Distance between 3D View grid lines");
 	RNA_def_property_range(prop, 0.0f, FLT_MAX);
+	RNA_def_property_float_default(prop, 1.0f);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "grid_lines", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "grid_lines", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "gridlines");
 	RNA_def_property_ui_text(prop, "Grid Lines", "Number of grid lines to display in perspective view");
 	RNA_def_property_range(prop, 0, 1024);
+	RNA_def_property_int_default(prop, 16);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 	
-	prop= RNA_def_property(srna, "grid_subdivisions", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "grid_subdivisions", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "gridsubdiv");
 	RNA_def_property_ui_text(prop, "Grid Subdivisions", "Number of subdivisions between grid lines");
 	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, "show_floor", PROP_BOOLEAN, PROP_NONE);
+	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");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 	
-	prop= RNA_def_property(srna, "show_axis_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_axis_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_X);
 	RNA_def_property_ui_text(prop, "Display X Axis", "Show the X axis line in perspective view");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 	
-	prop= RNA_def_property(srna, "show_axis_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_axis_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_Y);
 	RNA_def_property_ui_text(prop, "Display Y Axis", "Show the Y axis line in perspective view");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 	
-	prop= RNA_def_property(srna, "show_axis_z", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_axis_z", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_Z);
 	RNA_def_property_ui_text(prop, "Display Z Axis", "Show the Z axis line in perspective view");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 	
-	prop= RNA_def_property(srna, "show_outline_selected", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_outline_selected", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SELECT_OUTLINE);
 	RNA_def_property_ui_text(prop, "Outline Selected",
 	                         "Show an outline highlight around selected objects in non-wireframe views");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 	
-	prop= RNA_def_property(srna, "show_all_objects_origin", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_all_objects_origin", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_DRAW_CENTERS);
 	RNA_def_property_ui_text(prop, "All Object Origins",
 	                         "Show the object origin center dot for all (selected and unselected) objects");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "show_relationship_lines", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_relationship_lines", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", V3D_HIDE_HELPLINES);
-	RNA_def_property_ui_text(prop, "Relationship Lines", "Show dashed lines indicating parent or constraint relationships");
+	RNA_def_property_ui_text(prop, "Relationship Lines",
+	                         "Show dashed lines indicating parent or constraint relationships");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 	
-	prop= RNA_def_property(srna, "show_textured_solid", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_textured_solid", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SOLID_TEX);
 	RNA_def_property_ui_text(prop, "Textured Solid", "Display face-assigned textures in solid view");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "lock_camera", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_camera", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_LOCK_CAMERA);
 	RNA_def_property_ui_text(prop, "Lock Camera to View", "Enable view navigation within the camera view");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "show_only_render", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_only_render", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_RENDER_OVERRIDE);
 	RNA_def_property_ui_text(prop, "Only Render", "Display only objects which will be rendered");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 	
-	prop= RNA_def_property(srna, "use_occlude_geometry", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_occlude_geometry", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_ZBUF_SELECT);
 	RNA_def_property_ui_text(prop, "Occlude Geometry", "Limit selection to visible (clipped with depth buffer)");
 	RNA_def_property_ui_icon(prop, ICON_ORTHO, 0);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "background_images", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "background_images", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "bgpicbase", NULL);
 	RNA_def_property_struct_type(prop, "BackgroundImage");
 	RNA_def_property_ui_text(prop, "Background Images", "List of background images");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 	rna_def_backgroundImages(brna, prop);
 
-	prop= RNA_def_property(srna, "show_background_images", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_background_images", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_DISPBGPICS);
-	RNA_def_property_ui_text(prop, "Display Background Images", "Display reference images behind objects in the 3D View");
+	RNA_def_property_ui_text(prop, "Display Background Images",
+	                         "Display reference images behind objects in the 3D View");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "around");
 	RNA_def_property_enum_items(prop, pivot_items);
 	RNA_def_property_ui_text(prop, "Pivot Point", "Pivot center for rotation/scaling");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_SpaceView3D_pivot_update");
 	
-	prop= RNA_def_property(srna, "use_pivot_point_align", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pivot_point_align", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_ALIGN);
 	RNA_def_property_ui_text(prop, "Align", "Manipulate center points (object and pose mode only)");
 	RNA_def_property_ui_icon(prop, ICON_ALIGN, 0);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_SpaceView3D_pivot_update");
 
-	prop= RNA_def_property(srna, "show_manipulator", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_manipulator", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "twflag", V3D_USE_MANIPULATOR);
 	RNA_def_property_ui_text(prop, "Manipulator", "Use a 3D manipulator widget for controlling transforms");
 	RNA_def_property_ui_icon(prop, ICON_MANIPUL, 0);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 	
-	prop= RNA_def_property(srna, "use_manipulator_translate", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_manipulator_translate", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "twtype", V3D_MANIP_TRANSLATE);
 	RNA_def_property_ui_text(prop, "Manipulator Translate", "Use the manipulator for movement transformations");
 	RNA_def_property_ui_icon(prop, ICON_MAN_TRANS, 0);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 	
-	prop= RNA_def_property(srna, "use_manipulator_rotate", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_manipulator_rotate", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "twtype", V3D_MANIP_ROTATE);
 	RNA_def_property_ui_text(prop, "Manipulator Rotate", "Use the manipulator for rotation transformations");
 	RNA_def_property_ui_icon(prop, ICON_MAN_ROT, 0);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 	
-	prop= RNA_def_property(srna, "use_manipulator_scale", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_manipulator_scale", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "twtype", V3D_MANIP_SCALE);
 	RNA_def_property_ui_text(prop, "Manipulator Scale", "Use the manipulator for scale transformations");
 	RNA_def_property_ui_icon(prop, ICON_MAN_SCALE, 0);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 	
-	prop= RNA_def_property(srna, "transform_orientation", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "transform_orientation", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "twmode");
 	RNA_def_property_enum_items(prop, transform_orientation_items);
 	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_TransformOrientation_itemf");
 	RNA_def_property_ui_text(prop, "Transform Orientation", "Transformation orientation");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "current_orientation", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "current_orientation", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "TransformOrientation");
 	RNA_def_property_pointer_funcs(prop, "rna_CurrentOrientation_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Current Transform Orientation", "Current transformation orientation");
 
-	prop= RNA_def_property(srna, "lock_camera_and_layers", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_camera_and_layers", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scenelock", 1);
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceView3D_lock_camera_and_layers_set");
 	RNA_def_property_ui_text(prop, "Lock Camera and Layers",
@@ -1582,138 +1634,150 @@ static void rna_def_space_view3d(BlenderRNA *brna)
 	RNA_def_property_ui_icon(prop, ICON_LOCKVIEW_OFF, 1);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
+	prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
 	RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
 	RNA_def_property_array(prop, 20);
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceView3D_layer_set");
 	RNA_def_property_ui_text(prop, "Visible Layers", "Layers visible in this 3D View");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_SpaceView3D_layer_update");
 	
-	prop= RNA_def_property(srna, "layers_used", PROP_BOOLEAN, PROP_LAYER_MEMBER);
+	prop = RNA_def_property(srna, "layers_used", PROP_BOOLEAN, PROP_LAYER_MEMBER);
 	RNA_def_property_boolean_sdna(prop, NULL, "lay_used", 1);
 	RNA_def_property_array(prop, 20);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Used Layers", "Layers that contain something");
 
-	prop= RNA_def_property(srna, "region_3d", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "region_3d", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "RegionView3D");
 	RNA_def_property_pointer_funcs(prop, "rna_SpaceView3D_region_3d_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "3D Region", "3D region in this space, in case of quad view the camera region");
 
-	prop= RNA_def_property(srna, "region_quadview", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "region_quadview", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "RegionView3D");
 	RNA_def_property_pointer_funcs(prop, "rna_SpaceView3D_region_quadview_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Quad View Region", "3D region that defines the quad view settings");
 
-	prop= RNA_def_property(srna, "show_reconstruction", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_reconstruction", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_RECONSTRUCTION);
 	RNA_def_property_ui_text(prop, "Show Reconstruction", "Display reconstruction data from active movie clip");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "tracks_draw_size", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "tracks_draw_size", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0, FLT_MAX);
 	RNA_def_property_float_sdna(prop, NULL, "bundle_size");
 	RNA_def_property_ui_text(prop, "Tracks Size", "Display size of tracks from reconstructed data");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "tracks_draw_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "tracks_draw_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "bundle_drawtype");
 	RNA_def_property_enum_items(prop, bundle_drawtype_items);
 	RNA_def_property_ui_text(prop, "Tracks Display Type", "Viewport display style for tracks");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "show_camera_path", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_camera_path", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_CAMERAPATH);
 	RNA_def_property_ui_text(prop, "Show Camera Path", "Show reconstructed camera path");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "show_bundle_names", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_bundle_names", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_BUNDLENAME);
 	RNA_def_property_ui_text(prop, "Show 3D Marker Names", "Show names for reconstructed tracks objects");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
 	/* region */
 
-	srna= RNA_def_struct(brna, "RegionView3D", NULL);
+	srna = RNA_def_struct(brna, "RegionView3D", NULL);
 	RNA_def_struct_sdna(srna, "RegionView3D");
 	RNA_def_struct_ui_text(srna, "3D View Region", "3D View region data");
 
-	prop= RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "viewlock", RV3D_LOCKED);
 	RNA_def_property_ui_text(prop, "Lock", "Lock view rotation in side views");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_RegionView3D_quadview_update");
 	
-	prop= RNA_def_property(srna, "show_sync_view", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_sync_view", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "viewlock", RV3D_BOXVIEW);
 	RNA_def_property_ui_text(prop, "Box", "Sync view position between side views");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_RegionView3D_quadview_update");
 	
-	prop= RNA_def_property(srna, "use_box_clip", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_box_clip", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "viewlock", RV3D_BOXCLIP);
 	RNA_def_property_ui_text(prop, "Clip", "Clip objects based on what's visible in other side views");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, "rna_RegionView3D_quadview_clip_update");
 	
-	prop= RNA_def_property(srna, "perspective_matrix", PROP_FLOAT, PROP_MATRIX);
+	prop = RNA_def_property(srna, "perspective_matrix", PROP_FLOAT, PROP_MATRIX);
 	RNA_def_property_float_sdna(prop, NULL, "persmat");
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE); // XXX: for now, it's too risky for users to do this
+	RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* XXX: for now, it's too risky for users to do this */
 	RNA_def_property_multi_array(prop, 2, matrix_dimsize);
 	RNA_def_property_ui_text(prop, "Perspective Matrix", "Current perspective matrix of the 3D region");
 	
-	prop= RNA_def_property(srna, "view_matrix", PROP_FLOAT, PROP_MATRIX);
+	prop = RNA_def_property(srna, "view_matrix", PROP_FLOAT, PROP_MATRIX);
 	RNA_def_property_float_sdna(prop, NULL, "viewmat");
 	RNA_def_property_multi_array(prop, 2, matrix_dimsize);
 	RNA_def_property_float_funcs(prop, NULL, "rna_RegionView3D_view_matrix_set", NULL);
 	RNA_def_property_ui_text(prop, "View Matrix", "Current view matrix of the 3D region");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "view_perspective", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "view_perspective", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "persp");
 	RNA_def_property_enum_items(prop, rv3d_persp_items);
 	RNA_def_property_ui_text(prop, "Perspective", "View Perspective");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "is_perspective", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_perspective", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "is_persp", 1);
 	RNA_def_property_ui_text(prop, "Is Perspective", "");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	
-	prop= RNA_def_property(srna, "view_location", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "view_location", PROP_FLOAT, PROP_TRANSLATION);
 #if 0
-	RNA_def_property_float_sdna(prop, NULL, "ofs"); // cant use because its negated
+	RNA_def_property_float_sdna(prop, NULL, "ofs"); /* cant use because its negated */
 #else
 	RNA_def_property_array(prop, 3);
-	RNA_def_property_float_funcs(prop, "rna_RegionView3D_view_location_get", "rna_RegionView3D_view_location_set", NULL);
+	RNA_def_property_float_funcs(prop, "rna_RegionView3D_view_location_get",
+	                             "rna_RegionView3D_view_location_set", NULL);
 #endif
 	RNA_def_property_ui_text(prop, "View Location", "View pivot location");
-	RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4);
+	RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, RNA_TRANSLATION_PREC_DEFAULT);
 	RNA_def_property_update(prop, NC_WINDOW, NULL);
 	
-	prop= RNA_def_property(srna, "view_rotation", PROP_FLOAT, PROP_QUATERNION); // cant use because its inverted
+	prop = RNA_def_property(srna, "view_rotation", PROP_FLOAT, PROP_QUATERNION); /* cant use because its inverted */
 #if 0
 	RNA_def_property_float_sdna(prop, NULL, "viewquat");
 #else
 	RNA_def_property_array(prop, 4);
-	RNA_def_property_float_funcs(prop, "rna_RegionView3D_view_rotation_get", "rna_RegionView3D_view_rotation_set", NULL);
+	RNA_def_property_float_funcs(prop, "rna_RegionView3D_view_rotation_get",
+	                             "rna_RegionView3D_view_rotation_set", NULL);
 #endif
 	RNA_def_property_ui_text(prop, "View Rotation", "Rotation in quaternions (keep normalized)");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 	
 	/* not sure we need rna access to these but adding anyway */
-	prop= RNA_def_property(srna, "view_distance", PROP_FLOAT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "view_distance", PROP_FLOAT, PROP_UNSIGNED);
 	RNA_def_property_float_sdna(prop, NULL, "dist");
 	RNA_def_property_ui_text(prop, "Distance", "Distance to the view location");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "view_camera_zoom", PROP_INT, PROP_UNSIGNED);
-	RNA_def_property_int_sdna(prop, NULL, "camzoom");
+	prop = RNA_def_property(srna, "view_camera_zoom", PROP_FLOAT, PROP_UNSIGNED);
+	RNA_def_property_float_sdna(prop, NULL, "camzoom");
 	RNA_def_property_ui_text(prop, "Camera Zoom", "Zoom factor in camera view");
+	RNA_def_property_range(prop, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
 
-	prop= RNA_def_property(srna, "view_camera_offset", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "view_camera_offset", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "camdx");
 	RNA_def_property_array(prop, 2);
 	RNA_def_property_ui_text(prop, "Camera Offset", "View shift in camera view");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL);
+
+	/* until we have real api call */
+	{
+		FunctionRNA *func;
+
+		func = RNA_def_function(srna, "update", "rna_RegionView3D_update");
+		RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+		RNA_def_function_ui_description(func, "Recalculate the view matrices");
+	}
 }
 
 static void rna_def_space_buttons(BlenderRNA *brna)
@@ -1744,42 +1808,43 @@ static void rna_def_space_buttons(BlenderRNA *brna)
 
 	static EnumPropertyItem buttons_texture_context_items[] = {
 		{SB_TEXC_MAT_OR_LAMP, "MATERIAL", ICON_MATERIAL, "Material", "Material"},
-		{0, NULL, 0, NULL, NULL}}; //actually populated dynamically trough a function
+		{0, NULL, 0, NULL, NULL}}; /*actually populated dynamically trough a function */
 		
-	srna= RNA_def_struct(brna, "SpaceProperties", "Space");
+	srna = RNA_def_struct(brna, "SpaceProperties", "Space");
 	RNA_def_struct_sdna(srna, "SpaceButs");
 	RNA_def_struct_ui_text(srna, "Properties Space", "Properties space data");
 	
-	prop= RNA_def_property(srna, "context", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "context", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "mainb");
 	RNA_def_property_enum_items(prop, buttons_context_items);
 	RNA_def_property_enum_funcs(prop, NULL, "rna_SpaceProperties_context_set", NULL);
 	RNA_def_property_ui_text(prop, "Context", "Type of active data to display and edit");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_PROPERTIES, NULL);
 	
-	prop= RNA_def_property(srna, "align", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "align", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "align");
 	RNA_def_property_enum_items(prop, align_items);
 	RNA_def_property_enum_funcs(prop, NULL, "rna_SpaceProperties_align_set", NULL);
 	RNA_def_property_ui_text(prop, "Align", "Arrangement of the panels");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_PROPERTIES, NULL);
 
-	prop= RNA_def_property(srna, "texture_context", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "texture_context", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, buttons_texture_context_items);
 	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceProperties_texture_context_itemf");
 	RNA_def_property_ui_text(prop, "Texture Context", "Type of texture data to display and edit");
 	RNA_def_property_update(prop, NC_TEXTURE, NULL);
 
 	/* pinned data */
-	prop= RNA_def_property(srna, "pin_id", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "pin_id", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "pinid");
 	RNA_def_property_struct_type(prop, "ID");
 	/* note: custom set function is ONLY to avoid rna setting a user for this. */
-	RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceProperties_pin_id_set", "rna_SpaceProperties_pin_id_typef", NULL);
+	RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceProperties_pin_id_set",
+	                               "rna_SpaceProperties_pin_id_typef", NULL);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_PROPERTIES, "rna_SpaceProperties_pin_id_update");
 
-	prop= RNA_def_property(srna, "use_pin_id", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_pin_id", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SB_PIN_CONTEXT);
 	RNA_def_property_ui_text(prop, "Pin ID", "Use the pinned context");
 }
@@ -1789,58 +1854,59 @@ static void rna_def_space_image(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "SpaceImageEditor", "Space");
+	srna = RNA_def_struct(brna, "SpaceImageEditor", "Space");
 	RNA_def_struct_sdna(srna, "SpaceImage");
 	RNA_def_struct_ui_text(srna, "Space Image Editor", "Image and UV editor space data");
 
 	/* image */
-	prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceImageEditor_image_set", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Image", "Image displayed and edited in this space");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
-	RNA_def_property_update(prop, NC_GEOM|ND_DATA, NULL); // is handled in image editor too
+	RNA_def_property_update(prop, NC_GEOM|ND_DATA, NULL); /* is handled in image editor too */
 
-	prop= RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "iuser");
-	RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed");
+	RNA_def_property_ui_text(prop, "Image User",
+	                         "Parameters defining which layer, pass and frame of the image is displayed");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
 
-	prop= RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "cumap");
 	RNA_def_property_ui_text(prop, "Curve", "Color curve mapping to use for displaying the image");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_SpaceImageEditor_curves_update");
 
-	prop= RNA_def_property(srna, "scopes", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "scopes", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "scopes");
 	RNA_def_property_struct_type(prop, "Scopes");
 	RNA_def_property_ui_text(prop, "Scopes", "Scopes to visualize image statistics");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_SpaceImageEditor_scopes_update");
 
-	prop= RNA_def_property(srna, "use_image_pin", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_image_pin", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "pin", 0);
 	RNA_def_property_ui_text(prop, "Image Pin", "Display current image regardless of object selection");
 	RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
 
-	prop= RNA_def_property(srna, "sample_histogram", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "sample_histogram", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "sample_line_hist");
 	RNA_def_property_struct_type(prop, "Histogram");
 	RNA_def_property_ui_text(prop, "Line sample", "Sampled colors along line");
 
-	prop= RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_array(prop, 2);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_float_funcs(prop, "rna_SpaceImageEditor_zoom_get", NULL, NULL);
 	RNA_def_property_ui_text(prop, "Zoom", "Zoom factor");
 	
 	/* image draw */
-	prop= RNA_def_property(srna, "show_repeat", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_repeat", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_TILE);
 	RNA_def_property_ui_text(prop, "Draw Repeated", "Draw the image repeated outside of the main view");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
 
-	prop= RNA_def_property(srna, "draw_channels", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "draw_channels", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, draw_channels_items);
 	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceImageEditor_draw_channels_itemf");
@@ -1848,50 +1914,51 @@ static void rna_def_space_image(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
 
 	/* uv */
-	prop= RNA_def_property(srna, "uv_editor", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "uv_editor", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "SpaceUVEditor");
 	RNA_def_property_pointer_funcs(prop, "rna_SpaceImageEditor_uvedit_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "UV Editor", "UV editor settings");
 	
 	/* paint */
-	prop= RNA_def_property(srna, "use_image_paint", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_image_paint", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAWTOOL);
 	RNA_def_property_ui_text(prop, "Image Painting", "Enable image painting mode");
 	RNA_def_property_ui_icon(prop, ICON_TPAINT_HLT, 0);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_SpaceImageEditor_paint_update");
 
 	/* grease pencil */
-	prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "gpd");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "GreasePencil");
 	RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this space");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, NULL);
 
-	prop= RNA_def_property(srna, "use_grease_pencil", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_grease_pencil", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DISPGP);
-	RNA_def_property_ui_text(prop, "Use Grease Pencil", "Display and edit the grease pencil freehand annotations overlay");
+	RNA_def_property_ui_text(prop, "Use Grease Pencil",
+	                         "Display and edit the grease pencil freehand annotations overlay");
 
 	/* update */
-	prop= RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "lock", 0);
 	RNA_def_property_ui_text(prop, "Update Automatically",
 	                         "Update other affected window spaces automatically to reflect changes "
 	                         "during interactive operations such as transform");
 
 	/* state */
-	prop= RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_render_get", NULL);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Show Render", "Show render related properties");
 
-	prop= RNA_def_property(srna, "show_paint", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_paint", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_paint_get", NULL);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Show Paint", "Show paint related properties");
 
-	prop= RNA_def_property(srna, "show_uvedit", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_uvedit", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_uvedit_get", NULL);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Show UV Editor", "Show UV editing related properties");
@@ -1927,84 +1994,87 @@ static void rna_def_space_sequencer(BlenderRNA *brna)
 		{SEQ_PROXY_RENDER_SIZE_FULL, "FULL", 0, "No proxy, full render", ""},
 		{0, NULL, 0, NULL, NULL}};
 	
-	srna= RNA_def_struct(brna, "SpaceSequenceEditor", "Space");
+	srna = RNA_def_struct(brna, "SpaceSequenceEditor", "Space");
 	RNA_def_struct_sdna(srna, "SpaceSeq");
 	RNA_def_struct_ui_text(srna, "Space Sequence Editor", "Sequence editor space data");
 	
 	/* view type, fairly important */
-	prop= RNA_def_property(srna, "view_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "view_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "view");
 	RNA_def_property_enum_items(prop, view_type_items);
 	RNA_def_property_ui_text(prop, "View Type", "Type of the Sequencer view (sequencer, preview or both)");
 	RNA_def_property_update(prop, 0, "rna_Sequencer_view_type_update");
 
 	/* display type, fairly important */
-	prop= RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "mainb");
 	RNA_def_property_enum_items(prop, display_mode_items);
 	RNA_def_property_ui_text(prop, "Display Mode", "View mode to use for displaying sequencer output");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
 		
 	/* flag's */
-	prop= RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SEQ_NO_DRAW_CFRANUM);
-	RNA_def_property_ui_text(prop, "Show Frame Number Indicator", "Show frame number beside the current frame indicator line");
+	RNA_def_property_ui_text(prop, "Show Frame Number Indicator",
+	                         "Show frame number beside the current frame indicator line");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
 	
-	prop= RNA_def_property(srna, "show_frames", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_frames", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAWFRAMES);
 	RNA_def_property_ui_text(prop, "Draw Frames", "Draw frames rather than seconds");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
 	
-	prop= RNA_def_property(srna, "use_marker_sync", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_marker_sync", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MARKER_TRANS);
 	RNA_def_property_ui_text(prop, "Sync Markers", "Transform markers as well as strips");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
 	
-	prop= RNA_def_property(srna, "show_separate_color", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAW_COLOR_SEPERATED);
+	prop = RNA_def_property(srna, "show_separate_color", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAW_COLOR_SEPARATED);
 	RNA_def_property_ui_text(prop, "Separate Colors", "Separate color channels in preview");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
 
-	prop= RNA_def_property(srna, "show_safe_margin", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_safe_margin", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAW_SAFE_MARGINS);
-	RNA_def_property_ui_text(prop, "Safe Margin", "Draw title safe margins in preview");	
+	RNA_def_property_ui_text(prop, "Safe Margin", "Draw title safe margins in preview");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
 	
-	prop= RNA_def_property(srna, "use_grease_pencil", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_grease_pencil", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAW_GPENCIL);
-	RNA_def_property_ui_text(prop, "Use Grease Pencil", "Display and edit the grease pencil freehand annotations overlay");
+	RNA_def_property_ui_text(prop, "Use Grease Pencil",
+	                         "Display and edit the grease pencil freehand annotations overlay");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
 	
-	prop= RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SEQ_DRAWFRAMES);
 	RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
 
 	/* grease pencil */
-	prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "gpd");
 	RNA_def_property_struct_type(prop, "UnknownType");
 	RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this space");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
 	
-	prop= RNA_def_property(srna, "display_channel", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "display_channel", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "chanshown");
 	RNA_def_property_ui_text(prop, "Display Channel",
 	                         "The channel number shown in the image preview. 0 is the result of all strips combined");
 	RNA_def_property_range(prop, -5, MAXSEQ);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
 	
-	prop= RNA_def_property(srna, "draw_overexposed", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "draw_overexposed", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "zebra");
 	RNA_def_property_ui_text(prop, "Show Overexposed", "Show overexposed areas with zebra stripes");
 	RNA_def_property_range(prop, 0, 110);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
 	
-	prop= RNA_def_property(srna, "proxy_render_size", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "proxy_render_size", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "render_size");
 	RNA_def_property_enum_items(prop, proxy_render_size_items);
-	RNA_def_property_ui_text(prop, "Proxy render size", "Draw preview using full resolution or different proxy resolutions");
+	RNA_def_property_ui_text(prop, "Proxy render size",
+	                         "Draw preview using full resolution or different proxy resolutions");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_SEQUENCER, NULL);
 }
 
@@ -2013,98 +2083,98 @@ static void rna_def_space_text(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "SpaceTextEditor", "Space");
+	srna = RNA_def_struct(brna, "SpaceTextEditor", "Space");
 	RNA_def_struct_sdna(srna, "SpaceText");
 	RNA_def_struct_ui_text(srna, "Space Text Editor", "Text editor space data");
 
 	/* text */
-	prop= RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Text", "Text displayed and edited in this space");
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceTextEditor_text_set", NULL, NULL);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
 
 	/* display */
-	prop= RNA_def_property(srna, "show_word_wrap", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_word_wrap", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "wordwrap", 0);
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceTextEditor_word_wrap_set");
 	RNA_def_property_ui_text(prop, "Word Wrap", "Wrap words if there is not enough horizontal space");
 	RNA_def_property_ui_icon(prop, ICON_WORDWRAP_OFF, 1);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
 
-	prop= RNA_def_property(srna, "show_line_numbers", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_line_numbers", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "showlinenrs", 0);
 	RNA_def_property_ui_text(prop, "Line Numbers", "Show line numbers next to the text");
 	RNA_def_property_ui_icon(prop, ICON_LINENUMBERS_OFF, 1);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
 
-	prop= RNA_def_property(srna, "show_syntax_highlight", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_syntax_highlight", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "showsyntax", 0);
 	RNA_def_property_ui_text(prop, "Syntax Highlight", "Syntax highlight for scripting");
 	RNA_def_property_ui_icon(prop, ICON_SYNTAX_OFF, 1);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
 	
-	prop= RNA_def_property(srna, "show_line_highlight", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_line_highlight", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "line_hlight", 0);
 	RNA_def_property_ui_text(prop, "Highlight Line", "Highlight the current line");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
 
-	prop= RNA_def_property(srna, "tab_width", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "tab_width", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "tabnumber");
 	RNA_def_property_range(prop, 2, 8);
 	RNA_def_property_ui_text(prop, "Tab Width", "Number of spaces to display tabs with");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, "rna_SpaceTextEditor_updateEdited");
 
-	prop= RNA_def_property(srna, "font_size", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "font_size", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "lheight");
 	RNA_def_property_range(prop, 8, 32);
 	RNA_def_property_ui_text(prop, "Font Size", "Font size to use for displaying the text");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
 
-	prop= RNA_def_property(srna, "show_margin", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_margin", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_SHOW_MARGIN);
 	RNA_def_property_ui_text(prop, "Show Margin", "Show right margin");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
 
-	prop= RNA_def_property(srna, "margin_column", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "margin_column", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "margin_column");
 	RNA_def_property_range(prop, 0, 1024);
 	RNA_def_property_ui_text(prop, "Margin Column", "Column number to show right margin at");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
 
 	/* functionality options */
-	prop= RNA_def_property(srna, "use_overwrite", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_overwrite", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "overwrite", 1);
 	RNA_def_property_ui_text(prop, "Overwrite", "Overwrite characters when typing rather than inserting them");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
 	
-	prop= RNA_def_property(srna, "use_live_edit", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_live_edit", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "live_edit", 1);
 	RNA_def_property_ui_text(prop, "Live Edit", "Run python while editing");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
 	
 	/* find */
-	prop= RNA_def_property(srna, "use_find_all", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_find_all", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_FIND_ALL);
 	RNA_def_property_ui_text(prop, "Find All", "Search in all text datablocks, instead of only the active one");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
 
-	prop= RNA_def_property(srna, "use_find_wrap", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_find_wrap", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_FIND_WRAP);
 	RNA_def_property_ui_text(prop, "Find Wrap", "Search again from the start of the file when reaching the end");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
 
-	prop= RNA_def_property(srna, "use_match_case", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_match_case", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_MATCH_CASE);
 	RNA_def_property_ui_text(prop, "Match case", "Search string is sensitive to uppercase and lowercase letters");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
 
-	prop= RNA_def_property(srna, "find_text", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "find_text", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "findstr");
 	RNA_def_property_ui_text(prop, "Find Text", "Text to search for with the find tool");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
 
-	prop= RNA_def_property(srna, "replace_text", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "replace_text", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "replacestr");
 	RNA_def_property_ui_text(prop, "Replace Text", "Text to replace selected text with using the replace tool");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TEXT, NULL);
@@ -2115,7 +2185,7 @@ static void rna_def_space_dopesheet(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	// XXX: action-editor is currently for object-level only actions, so show that using object-icon hint
+	/* XXX: action-editor is currently for object-level only actions, so show that using object-icon hint */
 	static EnumPropertyItem mode_items[] = {
 		{SACTCONT_DOPESHEET, "DOPESHEET", ICON_OOPS, "DopeSheet", "DopeSheet Editor"},
 		{SACTCONT_ACTION, "ACTION", ICON_OBJECT_DATA, "Action Editor", "Action Editor"},
@@ -2124,41 +2194,43 @@ static void rna_def_space_dopesheet(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}};
 		
 	
-	srna= RNA_def_struct(brna, "SpaceDopeSheetEditor", "Space");
+	srna = RNA_def_struct(brna, "SpaceDopeSheetEditor", "Space");
 	RNA_def_struct_sdna(srna, "SpaceAction");
 	RNA_def_struct_ui_text(srna, "Space DopeSheet Editor", "DopeSheet space data");
 
 	/* data */
-	prop= RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
-	RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceDopeSheetEditor_action_set", NULL, "rna_Action_actedit_assign_poll");
+	RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceDopeSheetEditor_action_set", NULL,
+	                               "rna_Action_actedit_assign_poll");
 	RNA_def_property_ui_text(prop, "Action", "Action displayed and edited in this space");
 	RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, "rna_SpaceDopeSheetEditor_action_update");
 	
 	/* mode */
-	prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "mode");
 	RNA_def_property_enum_items(prop, mode_items);
 	RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, "rna_SpaceDopeSheetEditor_mode_update");
 	
 	/* display */
-	prop= RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_DRAWTIME);
 	RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL);
 	
-	prop= RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NODRAWCFRANUM);
-	RNA_def_property_ui_text(prop, "Show Frame Number Indicator", "Show frame number beside the current frame indicator line");
+	RNA_def_property_ui_text(prop, "Show Frame Number Indicator",
+	                         "Show frame number beside the current frame indicator line");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL);
 	
-	prop= RNA_def_property(srna, "show_sliders", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_sliders", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_SLIDERS);
 	RNA_def_property_ui_text(prop, "Show Sliders", "Show sliders beside F-Curve channels");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL);
 	
-	prop= RNA_def_property(srna, "show_pose_markers", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_pose_markers", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_POSEMARKERS_SHOW);
 	RNA_def_property_ui_text(prop, "Show Pose Markers",
 	                         "Show markers belonging to the active action instead of Scene markers "
@@ -2166,29 +2238,29 @@ static void rna_def_space_dopesheet(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL);
 	
 	/* editing */
-	prop= RNA_def_property(srna, "use_auto_merge_keyframes", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_auto_merge_keyframes", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NOTRANSKEYCULL);
 	RNA_def_property_ui_text(prop, "AutoMerge Keyframes", "Automatically merge nearby keyframes");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL);
 	
-	prop= RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NOREALTIMEUPDATES);
 	RNA_def_property_ui_text(prop, "Realtime Updates",
 	                         "When transforming keyframes, changes to the animation data are flushed to other views");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_DOPESHEET, NULL);
 
-	prop= RNA_def_property(srna, "use_marker_sync", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_marker_sync", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_MARKERS_MOVE);
 	RNA_def_property_ui_text(prop, "Sync Markers", "Sync Markers with keyframe edits");
 
 	/* dopesheet */
-	prop= RNA_def_property(srna, "dopesheet", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "dopesheet", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "DopeSheet");
 	RNA_def_property_pointer_sdna(prop, NULL, "ads");
 	RNA_def_property_ui_text(prop, "DopeSheet", "Settings for filtering animation data");
 
 	/* autosnap */
-	prop= RNA_def_property(srna, "auto_snap", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "auto_snap", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "autosnap");
 	RNA_def_property_enum_items(prop, autosnap_items);
 	RNA_def_property_ui_text(prop, "Auto Snap", "Automatic time snapping settings for transformations");
@@ -2201,7 +2273,8 @@ static void rna_def_space_graph(BlenderRNA *brna)
 	PropertyRNA *prop;
 	
 	static EnumPropertyItem mode_items[] = {
-		{SIPO_MODE_ANIMATION, "FCURVES", ICON_IPO, "F-Curve Editor", "Edit animation/keyframes displayed as 2D curves"},
+		{SIPO_MODE_ANIMATION, "FCURVES", ICON_IPO, "F-Curve Editor",
+		                      "Edit animation/keyframes displayed as 2D curves"},
 		{SIPO_MODE_DRIVERS, "DRIVERS", ICON_DRIVER, "Drivers", "Edit drivers"},
 		{0, NULL, 0, NULL, NULL}};
 		
@@ -2210,105 +2283,109 @@ static void rna_def_space_graph(BlenderRNA *brna)
 		{V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", ""},
 		{V3D_CURSOR, "CURSOR", ICON_CURSOR, "2D Cursor", ""},
 		{V3D_LOCAL, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION, "Individual Centers", ""},
-		//{V3D_CENTROID, "MEDIAN_POINT", 0, "Median Point", ""},
-		//{V3D_ACTIVE, "ACTIVE_ELEMENT", 0, "Active Element", ""},
+		/*{V3D_CENTROID, "MEDIAN_POINT", 0, "Median Point", ""}, */
+		/*{V3D_ACTIVE, "ACTIVE_ELEMENT", 0, "Active Element", ""}, */
 		{0, NULL, 0, NULL, NULL}};
 
 	
-	srna= RNA_def_struct(brna, "SpaceGraphEditor", "Space");
+	srna = RNA_def_struct(brna, "SpaceGraphEditor", "Space");
 	RNA_def_struct_sdna(srna, "SpaceIpo");
 	RNA_def_struct_ui_text(srna, "Space Graph Editor", "Graph Editor space data");
 	
 	/* mode */
-	prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "mode");
 	RNA_def_property_enum_items(prop, mode_items);
 	RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, "rna_SpaceGraphEditor_display_mode_update");
 	
 	/* display */
-	prop= RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_DRAWTIME);
 	RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
 	
-	prop= RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NODRAWCFRANUM);
-	RNA_def_property_ui_text(prop, "Show Frame Number Indicator", "Show frame number beside the current frame indicator line");
+	RNA_def_property_ui_text(prop, "Show Frame Number Indicator",
+	                         "Show frame number beside the current frame indicator line");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
 	
-	prop= RNA_def_property(srna, "show_sliders", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_sliders", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SLIDERS);
 	RNA_def_property_ui_text(prop, "Show Sliders", "Show sliders beside F-Curve channels");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
 	
-	prop= RNA_def_property(srna, "show_handles", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_handles", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NOHANDLES);
 	RNA_def_property_ui_text(prop, "Show Handles", "Show handles of Bezier control points");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
 	
-	prop= RNA_def_property(srna, "use_only_selected_curves_handles", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_only_selected_curves_handles", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SELCUVERTSONLY);
 	RNA_def_property_ui_text(prop, "Only Selected Curve Keyframes",
 	                         "Only keyframes of selected F-Curves are visible and editable");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
 	
-	prop= RNA_def_property(srna, "use_only_selected_keyframe_handles", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_only_selected_keyframe_handles", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SELVHANDLESONLY);
-	RNA_def_property_ui_text(prop, "Only Selected Keyframes Handles", "Only show and edit handles of selected keyframes");
+	RNA_def_property_ui_text(prop, "Only Selected Keyframes Handles",
+	                         "Only show and edit handles of selected keyframes");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
 	
-	prop= RNA_def_property(srna, "use_beauty_drawing", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_beauty_drawing", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_BEAUTYDRAW_OFF);
 	RNA_def_property_ui_text(prop, "Use High Quality Drawing",
-	                         "Draw F-Curves using Anti-Aliasing and other fancy effects (disable for better performance)");
+	                         "Draw F-Curves using Anti-Aliasing and other fancy effects "
+	                         "(disable for better performance)");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
 	
 	/* editing */
-	prop= RNA_def_property(srna, "use_auto_merge_keyframes", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_auto_merge_keyframes", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NOTRANSKEYCULL);
 	RNA_def_property_ui_text(prop, "AutoMerge Keyframes", "Automatically merge nearby keyframes");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
 	
-	prop= RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NOREALTIMEUPDATES);
 	RNA_def_property_ui_text(prop, "Realtime Updates",
 	                         "When transforming keyframes, changes to the animation data are flushed to other views");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
 	
 	/* cursor */
-	prop= RNA_def_property(srna, "show_cursor", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_cursor", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NODRAWCURSOR);
 	RNA_def_property_ui_text(prop, "Show Cursor", "Show 2D cursor");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
 	
-	prop= RNA_def_property(srna, "cursor_position_y", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "cursor_position_y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "cursorVal");
 	RNA_def_property_ui_text(prop, "Cursor Y-Value", "Graph Editor 2D-Value cursor - Y-Value component");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
 	
-	prop= RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "around");
 	RNA_def_property_enum_items(prop, gpivot_items);
 	RNA_def_property_ui_text(prop, "Pivot Point", "Pivot center for rotation/scaling");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
 
 	/* dopesheet */
-	prop= RNA_def_property(srna, "dopesheet", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "dopesheet", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "DopeSheet");
 	RNA_def_property_pointer_sdna(prop, NULL, "ads");
 	RNA_def_property_ui_text(prop, "DopeSheet", "Settings for filtering animation data");
 
 	/* autosnap */
-	prop= RNA_def_property(srna, "auto_snap", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "auto_snap", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "autosnap");
 	RNA_def_property_enum_items(prop, autosnap_items);
 	RNA_def_property_ui_text(prop, "Auto Snap", "Automatic time snapping settings for transformations");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
 	
 	/* readonly state info */
-	prop= RNA_def_property(srna, "has_ghost_curves", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "flag", 0); /* XXX: hack to make this compile, since this property doesn't actually exist*/
+	prop = RNA_def_property(srna, "has_ghost_curves", PROP_BOOLEAN, PROP_NONE);
+		/* XXX: hack to make this compile, since this property doesn't actually exist*/
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", 0);
 	RNA_def_property_boolean_funcs(prop, "rna_SpaceGraphEditor_has_ghost_curves_get", NULL);
 	RNA_def_property_ui_text(prop, "Has Ghost Curves", "Graph Editor instance has some ghost curves stored");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
@@ -2319,41 +2396,42 @@ static void rna_def_space_nla(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "SpaceNLA", "Space");
+	srna = RNA_def_struct(brna, "SpaceNLA", "Space");
 	RNA_def_struct_sdna(srna, "SpaceNla");
 	RNA_def_struct_ui_text(srna, "Space Nla Editor", "NLA editor space data");
 	
 	/* display */
-	prop= RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SNLA_DRAWTIME);
 	RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NLA, NULL);
 	
-	prop= RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NODRAWCFRANUM);
-	RNA_def_property_ui_text(prop, "Show Frame Number Indicator", "Show frame number beside the current frame indicator line");
+	RNA_def_property_ui_text(prop, "Show Frame Number Indicator",
+	                         "Show frame number beside the current frame indicator line");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NLA, NULL);
 	
-	prop= RNA_def_property(srna, "show_strip_curves", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_strip_curves", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NOSTRIPCURVES);
 	RNA_def_property_ui_text(prop, "Show Control F-Curves", "Show influence F-Curves on strips");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NLA, NULL);
 	
 	/* editing */
-	prop= RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NOREALTIMEUPDATES);
 	RNA_def_property_ui_text(prop, "Realtime Updates",
 	                         "When transforming strips, changes to the animation data are flushed to other views");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NLA, NULL);
 
 	/* dopesheet */
-	prop= RNA_def_property(srna, "dopesheet", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "dopesheet", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "DopeSheet");
 	RNA_def_property_pointer_sdna(prop, NULL, "ads");
 	RNA_def_property_ui_text(prop, "DopeSheet", "Settings for filtering animation data");
 
 	/* autosnap */
-	prop= RNA_def_property(srna, "auto_snap", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "auto_snap", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "autosnap");
 	RNA_def_property_enum_items(prop, autosnap_items);
 	RNA_def_property_ui_text(prop, "Auto Snap", "Automatic time snapping settings for transformations");
@@ -2365,55 +2443,57 @@ static void rna_def_space_time(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "SpaceTimeline", "Space");
+	srna = RNA_def_struct(brna, "SpaceTimeline", "Space");
 	RNA_def_struct_sdna(srna, "SpaceTime");
 	RNA_def_struct_ui_text(srna, "Space Timeline Editor", "Timeline editor space data");
 	
-	/* view settings */	
-	prop= RNA_def_property(srna, "show_only_selected", PROP_BOOLEAN, PROP_NONE);
+	/* view settings */
+	prop = RNA_def_property(srna, "show_only_selected", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_ONLYACTSEL);
-	RNA_def_property_ui_text(prop, "Only Selected Channels", "Show keyframes for active Object and/or its selected bones only");
+	RNA_def_property_ui_text(prop, "Only Selected Channels",
+	                         "Show keyframes for active Object and/or its selected bones only");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
 	
-	prop= RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TIME_CFRA_NUM);
-	RNA_def_property_ui_text(prop, "Show Frame Number Indicator", "Show frame number beside the current frame indicator line");
+	RNA_def_property_ui_text(prop, "Show Frame Number Indicator",
+	                         "Show frame number beside the current frame indicator line");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
 	
-	prop= RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TIME_DRAWFRAMES);
 	RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
 	
 	/* displaying cache status */
-	prop= RNA_def_property(srna, "show_cache", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_cache", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_DISPLAY);
-	RNA_def_property_ui_text(prop, "Show Cache", "Show the status of cached frames in the timeline");	
+	RNA_def_property_ui_text(prop, "Show Cache", "Show the status of cached frames in the timeline");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
 	
-	prop= RNA_def_property(srna, "cache_softbody", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "cache_softbody", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_SOFTBODY);
-	RNA_def_property_ui_text(prop, "Softbody", "Show the active object's softbody point cache");	
+	RNA_def_property_ui_text(prop, "Softbody", "Show the active object's softbody point cache");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
 	
-	prop= RNA_def_property(srna, "cache_particles", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "cache_particles", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_PARTICLES);
-	RNA_def_property_ui_text(prop, "Particles", "Show the active object's particle point cache");	
+	RNA_def_property_ui_text(prop, "Particles", "Show the active object's particle point cache");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
 	
-	prop= RNA_def_property(srna, "cache_cloth", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "cache_cloth", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_CLOTH);
-	RNA_def_property_ui_text(prop, "Cloth", "Show the active object's cloth point cache");	
+	RNA_def_property_ui_text(prop, "Cloth", "Show the active object's cloth point cache");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
 	
-	prop= RNA_def_property(srna, "cache_smoke", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "cache_smoke", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_SMOKE);
-	RNA_def_property_ui_text(prop, "Smoke", "Show the active object's smoke cache");	
+	RNA_def_property_ui_text(prop, "Smoke", "Show the active object's smoke cache");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
 		
-	prop= RNA_def_property(srna, "cache_dynamicpaint", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "cache_dynamicpaint", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_DYNAMICPAINT);
-	RNA_def_property_ui_text(prop, "Dynamic Paint", "Show the active object's Dynamic Paint cache");	
+	RNA_def_property_ui_text(prop, "Dynamic Paint", "Show the active object's Dynamic Paint cache");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_TIME, NULL);
 }
 
@@ -2424,14 +2504,15 @@ static void rna_def_console_line(BlenderRNA *brna)
 	
 	srna = RNA_def_struct(brna, "ConsoleLine", NULL);
 	RNA_def_struct_ui_text(srna, "Console Input", "Input line for the interactive console");
-	// XXX using non-inited "prop", uh? RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL);
+	/* XXX using non-inited "prop", uh? RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL); */
 	
-	prop= RNA_def_property(srna, "body", PROP_STRING, PROP_NONE);
-	RNA_def_property_string_funcs(prop, "rna_ConsoleLine_body_get", "rna_ConsoleLine_body_length", "rna_ConsoleLine_body_set");
+	prop = RNA_def_property(srna, "body", PROP_STRING, PROP_NONE);
+	RNA_def_property_string_funcs(prop, "rna_ConsoleLine_body_get", "rna_ConsoleLine_body_length",
+	                              "rna_ConsoleLine_body_set");
 	RNA_def_property_ui_text(prop, "Line", "Text in the line");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL);
 	
-	prop= RNA_def_property(srna, "current_character", PROP_INT, PROP_NONE); /* copied from text editor */
+	prop = RNA_def_property(srna, "current_character", PROP_INT, PROP_NONE); /* copied from text editor */
 	RNA_def_property_int_sdna(prop, NULL, "cursor");
 	RNA_def_property_int_funcs(prop, NULL, NULL, "rna_ConsoleLine_cursor_index_range");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL);
@@ -2442,38 +2523,38 @@ static void rna_def_space_console(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "SpaceConsole", "Space");
+	srna = RNA_def_struct(brna, "SpaceConsole", "Space");
 	RNA_def_struct_sdna(srna, "SpaceConsole");
 	RNA_def_struct_ui_text(srna, "Space Console", "Interactive python console");
 	
 	/* display */
-	prop= RNA_def_property(srna, "font_size", PROP_INT, PROP_NONE); /* copied from text editor */
+	prop = RNA_def_property(srna, "font_size", PROP_INT, PROP_NONE); /* copied from text editor */
 	RNA_def_property_int_sdna(prop, NULL, "lheight");
 	RNA_def_property_range(prop, 8, 32);
 	RNA_def_property_ui_text(prop, "Font Size", "Font size to use for displaying the text");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL);
 
 
-	prop= RNA_def_property(srna, "select_start", PROP_INT, PROP_UNSIGNED); /* copied from text editor */
+	prop = RNA_def_property(srna, "select_start", PROP_INT, PROP_UNSIGNED); /* copied from text editor */
 	RNA_def_property_int_sdna(prop, NULL, "sel_start");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL);
 	
-	prop= RNA_def_property(srna, "select_end", PROP_INT, PROP_UNSIGNED); /* copied from text editor */
+	prop = RNA_def_property(srna, "select_end", PROP_INT, PROP_UNSIGNED); /* copied from text editor */
 	RNA_def_property_int_sdna(prop, NULL, "sel_end");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE, NULL);
 
-	prop= RNA_def_property(srna, "prompt", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "prompt", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Prompt", "Command line prompt");
 	
-	prop= RNA_def_property(srna, "language", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "language", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Language", "Command line prompt language");
 
-	prop= RNA_def_property(srna, "history", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "history", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "history", NULL);
 	RNA_def_property_struct_type(prop, "ConsoleLine");
 	RNA_def_property_ui_text(prop, "History", "Command history");
 	
-	prop= RNA_def_property(srna, "scrollback", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "scrollback", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "scrollback", NULL);
 	RNA_def_property_struct_type(prop, "ConsoleLine");
 	RNA_def_property_ui_text(prop, "Output", "Command output");
@@ -2491,101 +2572,103 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}};
 
 	static EnumPropertyItem file_sort_items[] = {
-		{FILE_SORT_ALPHA, "FILE_SORT_ALPHA", ICON_SORTALPHA, "Sort alphabetically", "Sort the file list alphabetically"},
-		{FILE_SORT_EXTENSION, "FILE_SORT_EXTENSION", ICON_SORTBYEXT, "Sort by extension", "Sort the file list by extension"},
+		{FILE_SORT_ALPHA, "FILE_SORT_ALPHA", ICON_SORTALPHA, "Sort alphabetically",
+		                  "Sort the file list alphabetically"},
+		{FILE_SORT_EXTENSION, "FILE_SORT_EXTENSION", ICON_SORTBYEXT, "Sort by extension",
+		                      "Sort the file list by extension"},
 		{FILE_SORT_TIME, "FILE_SORT_TIME", ICON_SORTTIME, "Sort by time", "Sort files by modification time"},
 		{FILE_SORT_SIZE, "FILE_SORT_SIZE", ICON_SORTSIZE, "Sort by size", "Sort files by size"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "FileSelectParams", NULL);
+	srna = RNA_def_struct(brna, "FileSelectParams", NULL);
 	RNA_def_struct_ui_text(srna, "File Select Parameters", "File Select Parameters");
 
-	prop= RNA_def_property(srna, "title", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "title", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "title");
 	RNA_def_property_ui_text(prop, "Title", "Title for the file browser");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-	prop= RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
+	prop = RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
 	RNA_def_property_string_sdna(prop, NULL, "dir");
 	RNA_def_property_ui_text(prop, "Directory", "Directory displayed in the file browser");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
 
-	prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILENAME);
+	prop = RNA_def_property(srna, "filename", PROP_STRING, PROP_FILENAME);
 	RNA_def_property_string_sdna(prop, NULL, "file");
 	RNA_def_property_ui_text(prop, "File Name", "Active file in the file browser");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
 
-	prop= RNA_def_property(srna, "display_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "display_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "display");
 	RNA_def_property_enum_items(prop, file_display_items);
 	RNA_def_property_ui_text(prop, "Display Mode", "Display mode for the file list");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
 
-	prop= RNA_def_property(srna, "use_filter", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_filter", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", FILE_FILTER);
 	RNA_def_property_ui_text(prop, "Filter Files", "Enable filtering of files");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
 
-	prop= RNA_def_property(srna, "show_hidden", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_hidden", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FILE_HIDE_DOT);
 	RNA_def_property_ui_text(prop, "Show Hidden", "Show hidden dot files");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS , NULL);
 
-	prop= RNA_def_property(srna, "sort_method", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "sort_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "sort");
 	RNA_def_property_enum_items(prop, file_sort_items);
 	RNA_def_property_ui_text(prop, "Sort", "");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
 
-	prop= RNA_def_property(srna, "use_filter_image", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_filter_image", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "filter", IMAGEFILE);
 	RNA_def_property_ui_text(prop, "Filter Images", "Show image files");
 	RNA_def_property_ui_icon(prop, ICON_FILE_IMAGE, 0);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
 
-	prop= RNA_def_property(srna, "use_filter_blender", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_filter_blender", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "filter", BLENDERFILE);
 	RNA_def_property_ui_text(prop, "Filter Blender", "Show .blend files");
 	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_movie", PROP_BOOLEAN, PROP_NONE);
+	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");
 	RNA_def_property_ui_icon(prop, ICON_FILE_MOVIE, 0);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
 
-	prop= RNA_def_property(srna, "use_filter_script", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_filter_script", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "filter", PYSCRIPTFILE);
 	RNA_def_property_ui_text(prop, "Filter Script", "Show script files");
 	RNA_def_property_ui_icon(prop, ICON_FILE_SCRIPT, 0);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
 
-	prop= RNA_def_property(srna, "use_filter_font", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_filter_font", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "filter", FTFONTFILE);
 	RNA_def_property_ui_text(prop, "Filter Fonts", "Show font files");
 	RNA_def_property_ui_icon(prop, ICON_FILE_FONT, 0);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
 
-	prop= RNA_def_property(srna, "use_filter_sound", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_filter_sound", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "filter", SOUNDFILE);
 	RNA_def_property_ui_text(prop, "Filter Sound", "Show sound files");
 	RNA_def_property_ui_icon(prop, ICON_FILE_SOUND, 0);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
 
-	prop= RNA_def_property(srna, "use_filter_text", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_filter_text", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "filter", TEXTFILE);
 	RNA_def_property_ui_text(prop, "Filter Text", "Show text files");
-	RNA_def_property_ui_icon(prop, ICON_FILE_BLANK, 0);
+	RNA_def_property_ui_icon(prop, ICON_FILE_TEXT, 0);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
 
-	prop= RNA_def_property(srna, "use_filter_folder", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_filter_folder", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "filter", FOLDERFILE);
 	RNA_def_property_ui_text(prop, "Filter Folder", "Show folders");
 	RNA_def_property_ui_icon(prop, ICON_FILE_FOLDER, 0);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
 	
-	prop= RNA_def_property(srna, "filter_glob", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "filter_glob", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "filter_glob");
 	RNA_def_property_ui_text(prop, "Extension Filter", "");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_LIST, NULL);
@@ -2597,21 +2680,21 @@ static void rna_def_space_filebrowser(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "SpaceFileBrowser", "Space");
+	srna = RNA_def_struct(brna, "SpaceFileBrowser", "Space");
 	RNA_def_struct_sdna(srna, "SpaceFile");
 	RNA_def_struct_ui_text(srna, "Space File Browser", "File browser space data");
 
-	prop= RNA_def_property(srna, "params", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "params", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "params");
 	RNA_def_property_ui_text(prop, "Filebrowser Parameter", "Parameters and Settings for the Filebrowser");
 	
-	prop= RNA_def_property(srna, "active_operator", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active_operator", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "op");
 	RNA_def_property_ui_text(prop, "Active Operator", "");
 
 	/* keep this for compatibility with existing presets,
-	   not exposed in c++ api because of keyword conflict */
-	prop= RNA_def_property(srna, "operator", PROP_POINTER, PROP_NONE);
+	 * not exposed in c++ api because of keyword conflict */
+	prop = RNA_def_property(srna, "operator", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "op");
 	RNA_def_property_ui_text(prop, "Active Operator", "");
 }
@@ -2621,35 +2704,35 @@ static void rna_def_space_info(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "SpaceInfo", "Space");
+	srna = RNA_def_struct(brna, "SpaceInfo", "Space");
 	RNA_def_struct_sdna(srna, "SpaceInfo");
 	RNA_def_struct_ui_text(srna, "Space Info", "Info space data");
 	
 	/* reporting display */
-	prop= RNA_def_property(srna, "show_report_debug", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_report_debug", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_DEBUG);
 	RNA_def_property_ui_text(prop, "Show Debug", "Display debug reporting info");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_INFO_REPORT, NULL);
 	
-	prop= RNA_def_property(srna, "show_report_info", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_report_info", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_INFO);
 	RNA_def_property_ui_text(prop, "Show Info", "Display general information");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_INFO_REPORT, NULL);
 	
-	prop= RNA_def_property(srna, "show_report_operator", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_report_operator", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_OP);
 	RNA_def_property_ui_text(prop, "Show Operator", "Display the operator log");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_INFO_REPORT, NULL);
 	
-	prop= RNA_def_property(srna, "show_report_warning", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_report_warning", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_WARN);
 	RNA_def_property_ui_text(prop, "Show Warn", "Display warnings");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_INFO_REPORT, NULL);
 	
-	prop= RNA_def_property(srna, "show_report_error", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_report_error", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_ERR);
 	RNA_def_property_ui_text(prop, "Show Error", "Display error text");
-	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_INFO_REPORT, NULL);	
+	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_INFO_REPORT, NULL);
 }
 
 static void rna_def_space_userpref(BlenderRNA *brna)
@@ -2657,11 +2740,11 @@ static void rna_def_space_userpref(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "SpaceUserPreferences", "Space");
+	srna = RNA_def_struct(brna, "SpaceUserPreferences", "Space");
 	RNA_def_struct_sdna(srna, "SpaceUserPref");
 	RNA_def_struct_ui_text(srna, "Space User Preferences", "User preferences space data");
 	
-	prop= RNA_def_property(srna, "filter_text", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "filter_text", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "filter");
 	RNA_def_property_ui_text(prop, "Filter", "Search term for filtering in the UI");
 
@@ -2690,55 +2773,55 @@ static void rna_def_space_node(BlenderRNA *brna)
 		{SNODE_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Draw alpha transparency channel"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "SpaceNodeEditor", "Space");
+	srna = RNA_def_struct(brna, "SpaceNodeEditor", "Space");
 	RNA_def_struct_sdna(srna, "SpaceNode");
 	RNA_def_struct_ui_text(srna, "Space Node Editor", "Node editor space data");
 
-	prop= RNA_def_property(srna, "tree_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "tree_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "treetype");
 	RNA_def_property_enum_items(prop, nodetree_type_items);
 	RNA_def_property_ui_text(prop, "Tree Type", "Node tree type to display and edit");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE, NULL);
 
-	prop= RNA_def_property(srna, "texture_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "texture_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "texfrom");
 	RNA_def_property_enum_items(prop, texture_type_items);
 	RNA_def_property_ui_text(prop, "Texture Type", "Type of data to take texture from");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE, NULL);
 
-	prop= RNA_def_property(srna, "shader_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "shader_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "shaderfrom");
 	RNA_def_property_enum_items(prop, shader_type_items);
 	RNA_def_property_ui_text(prop, "Shader Type", "Type of data to take shader from");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE, NULL);
 
-	prop= RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "ID", "Datablock whose nodes are being edited");
 
-	prop= RNA_def_property(srna, "id_from", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "id_from", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "from");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "ID From", "Datablock from which the edited datablock is linked");
 
-	prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
 	RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_SpaceNodeEditor_node_tree_poll");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Node Tree", "Node tree being displayed and edited");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE, "rna_SpaceNodeEditor_node_tree_update");
 
-	prop= RNA_def_property(srna, "show_backdrop", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_backdrop", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SNODE_BACKDRAW);
 	RNA_def_property_ui_text(prop, "Backdrop", "Use active Viewer Node output as backdrop for compositing nodes");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE_VIEW, NULL);
 
-	prop= RNA_def_property(srna, "use_auto_render", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_auto_render", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SNODE_AUTO_RENDER);
 	RNA_def_property_ui_text(prop, "Auto Render", "Re-render and composite changed layers on 3D edits");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE_VIEW, NULL);
 	
-	prop= RNA_def_property(srna, "backdrop_zoom", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "backdrop_zoom", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "zoom");
 	RNA_def_property_float_default(prop, 1.0f);
 	RNA_def_property_range(prop, 0.01f, FLT_MAX);
@@ -2746,17 +2829,17 @@ static void rna_def_space_node(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Backdrop Zoom", "Backdrop zoom factor");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE_VIEW, NULL);
 	
-	prop= RNA_def_property(srna, "backdrop_x", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "backdrop_x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "xof");
 	RNA_def_property_ui_text(prop, "Backdrop X", "Backdrop X offset");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE_VIEW, NULL);
 
-	prop= RNA_def_property(srna, "backdrop_y", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "backdrop_y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "yof");
 	RNA_def_property_ui_text(prop, "Backdrop Y", "Backdrop Y offset");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_NODE_VIEW, NULL);
 
-	prop= RNA_def_property(srna, "backdrop_channels", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "backdrop_channels", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, backdrop_channels_items);
 	RNA_def_property_ui_text(prop, "Draw Channels", "Channels of the image to draw");
@@ -2768,64 +2851,64 @@ static void rna_def_space_logic(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "SpaceLogicEditor", "Space");
+	srna = RNA_def_struct(brna, "SpaceLogicEditor", "Space");
 	RNA_def_struct_sdna(srna, "SpaceLogic");
 	RNA_def_struct_ui_text(srna, "Space Logic Editor", "Logic editor space data");
 
 	/* sensors */
-	prop= RNA_def_property(srna, "show_sensors_selected_objects", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_sensors_selected_objects", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_SENS_SEL);
 	RNA_def_property_ui_text(prop, "Show Selected Object", "Show sensors of all selected objects");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 	
-	prop= RNA_def_property(srna, "show_sensors_active_object", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_sensors_active_object", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_SENS_ACT);
 	RNA_def_property_ui_text(prop, "Show Active Object", "Show sensors of active object");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 	
-	prop= RNA_def_property(srna, "show_sensors_linked_controller", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_sensors_linked_controller", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_SENS_LINK);
 	RNA_def_property_ui_text(prop, "Show Linked to Controller", "Show linked objects to the controller");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "show_sensors_active_states", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_sensors_active_states", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_SENS_STATE);
 	RNA_def_property_ui_text(prop, "Show Active States", "Show only sensors connected to active states");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* controllers */
-	prop= RNA_def_property(srna, "show_controllers_selected_objects", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_controllers_selected_objects", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_CONT_SEL);
 	RNA_def_property_ui_text(prop, "Show Selected Object", "Show controllers of all selected objects");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 	
-	prop= RNA_def_property(srna, "show_controllers_active_object", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_controllers_active_object", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_CONT_ACT);
 	RNA_def_property_ui_text(prop, "Show Active Object", "Show controllers of active object");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "show_controllers_linked_controller", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_controllers_linked_controller", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_CONT_LINK);
 	RNA_def_property_ui_text(prop, "Show Linked to Controller", "Show linked objects to sensor/actuator");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
 	/* actuators */
-	prop= RNA_def_property(srna, "show_actuators_selected_objects", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_actuators_selected_objects", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_ACT_SEL);
 	RNA_def_property_ui_text(prop, "Show Selected Object", "Show actuators of all selected objects");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 	
-	prop= RNA_def_property(srna, "show_actuators_active_object", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_actuators_active_object", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_ACT_ACT);
 	RNA_def_property_ui_text(prop, "Show Active Object", "Show actuators of active object");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 	
-	prop= RNA_def_property(srna, "show_actuators_linked_controller", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_actuators_linked_controller", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_ACT_LINK);
 	RNA_def_property_ui_text(prop, "Show Linked to Actuator", "Show linked objects to the actuator");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
 
-	prop= RNA_def_property(srna, "show_actuators_active_states", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_actuators_active_states", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "scaflag", BUTS_ACT_STATE);
 	RNA_def_property_ui_text(prop, "Show Active States", "Show only actuators connected to active states");
 	RNA_def_property_update(prop, NC_LOGIC, NULL);
@@ -2839,7 +2922,8 @@ static void rna_def_space_clip(BlenderRNA *brna)
 
 	static EnumPropertyItem mode_items[] = {
 		{SC_MODE_TRACKING, "TRACKING", ICON_ANIM_DATA, "Tracking", "Show tracking and solving tools"},
-		{SC_MODE_RECONSTRUCTION, "RECONSTRUCTION", ICON_SNAP_FACE, "Reconstruction", "Show tracking/reconstruction tools"},
+		{SC_MODE_RECONSTRUCTION, "RECONSTRUCTION", ICON_SNAP_FACE, "Reconstruction",
+		                         "Show tracking/reconstruction tools"},
 		{SC_MODE_DISTORTION, "DISTORTION", ICON_GRID, "Distortion", "Show distortion tools"},
 		{0, NULL, 0, NULL, NULL}};
 
@@ -2848,170 +2932,175 @@ static void rna_def_space_clip(BlenderRNA *brna)
 		{SC_VIEW_GRAPH, "GRAPH", ICON_IPO, "Graph", "Show graph view for active element"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "SpaceClipEditor", "Space");
+	srna = RNA_def_struct(brna, "SpaceClipEditor", "Space");
 	RNA_def_struct_sdna(srna, "SpaceClip");
 	RNA_def_struct_ui_text(srna, "Space Clip Editor", "Clip editor space data");
 
 	/* movieclip */
-	prop= RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Movie Clip", "Movie clip displayed and edited in this space");
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceClipEditor_clip_set", NULL, NULL);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
 
 	/* clip user */
-	prop= RNA_def_property(srna, "clip_user", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "clip_user", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "MovieClipUser");
 	RNA_def_property_pointer_sdna(prop, NULL, "user");
-	RNA_def_property_ui_text(prop, "Movie Clip User", "Parameters defining which frame of the movie clip is displayed");
+	RNA_def_property_ui_text(prop, "Movie Clip User",
+	                         "Parameters defining which frame of the movie clip is displayed");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
 
 	/* mode */
-	prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "mode");
 	RNA_def_property_enum_items(prop, mode_items);
 	RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, "rna_SpaceClipEditor_clip_mode_update");
 
 	/* view */
-	prop= RNA_def_property(srna, "view", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "view", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "view");
 	RNA_def_property_enum_items(prop, view_items);
 	RNA_def_property_ui_text(prop, "View", "Type of the clip editor view");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, "rna_SpaceClipEditor_view_type_update");
 
 	/* show pattern */
-	prop= RNA_def_property(srna, "show_marker_pattern", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_marker_pattern", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Show Marker Pattern", "Show pattern boundbox for markers");
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_MARKER_PATTERN);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
 
 	/* show search */
-	prop= RNA_def_property(srna, "show_marker_search", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_marker_search", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Show Marker Search", "Show search boundbox for markers");
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_MARKER_SEARCH);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
 
 	/* lock to selection */
-	prop= RNA_def_property(srna, "lock_selection", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock_selection", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Lock to Selection", "Lock viewport to selected markers during playback");
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_LOCK_SELECTION);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, "rna_SpaceClipEditor_lock_selection_update");
 
 	/* lock to time cursor */
-	prop= RNA_def_property(srna, "lock_time_cursor", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_ui_text(prop, "Lock to Time Cursor", "Lock curves view to time cursor during playback and tracking");
+	prop = RNA_def_property(srna, "lock_time_cursor", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_ui_text(prop, "Lock to Time Cursor",
+	                         "Lock curves view to time cursor during playback and tracking");
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_LOCK_TIMECURSOR);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
 
-	/* show markers pathes */
-	prop= RNA_def_property(srna, "show_track_path", PROP_BOOLEAN, PROP_NONE);
+	/* show markers paths */
+	prop = RNA_def_property(srna, "show_track_path", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_TRACK_PATH);
 	RNA_def_property_ui_text(prop, "Show Track Path", "Show path of how track moves");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
 
 	/* path length */
-	prop= RNA_def_property(srna, "path_length", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "path_length", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "path_length");
 	RNA_def_property_range(prop, 0, 50);
 	RNA_def_property_ui_text(prop, "Path Length", "Length of displaying path, in frames");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
 
 	/* show tiny markers */
-	prop= RNA_def_property(srna, "show_tiny_markers", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_tiny_markers", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Show Tiny Markers", "Show markers in a more compact manner");
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_TINY_MARKER);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
 
 	/* show bundles */
-	prop= RNA_def_property(srna, "show_bundles", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_bundles", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Show Bundles", "Show projection of 3D markers into footage");
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_BUNDLES);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
 
 	/* mute footage */
-	prop= RNA_def_property(srna, "use_mute_footage", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_mute_footage", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Mute Footage", "Mute footage and show black background instead");
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_MUTE_FOOTAGE);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
 
 	/* hide disabled */
-	prop= RNA_def_property(srna, "show_disabled", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_disabled", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Show Disabled", "Show disabled tracks from the footage");
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SC_HIDE_DISABLED);
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
 
 	/* scopes */
-	prop= RNA_def_property(srna, "scopes", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "scopes", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "scopes");
 	RNA_def_property_struct_type(prop, "MovieClipScopes");
 	RNA_def_property_ui_text(prop, "Scopes", "Scopes to visualize movie clip statistics");
 
 	/* show names */
-	prop= RNA_def_property(srna, "show_names", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_names", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_NAMES);
 	RNA_def_property_ui_text(prop, "Show Names", "Show track names and status");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
 
 	/* show grid */
-	prop= RNA_def_property(srna, "show_grid", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_grid", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GRID);
 	RNA_def_property_ui_text(prop, "Show Grid", "Show grid showing lens distortion");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
 
 	/* show stable */
-	prop= RNA_def_property(srna, "show_stable", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_stable", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_STABLE);
 	RNA_def_property_ui_text(prop, "Show Stable", "Show stable footage in editor (if stabilization is enabled)");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
 
 	/* manual calibration */
-	prop= RNA_def_property(srna, "use_manual_calibration", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_manual_calibration", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_MANUAL_CALIBRATION);
 	RNA_def_property_ui_text(prop, "Manual Calibration", "Use manual calibration helpers");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
 
 	/* show filters */
-	prop= RNA_def_property(srna, "show_filters", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_filters", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_FILTERS);
 	RNA_def_property_ui_text(prop, "Show Filters", "Show filters for graph editor");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
 
 	/* show graph_frames */
-	prop= RNA_def_property(srna, "show_graph_frames", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_graph_frames", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GRAPH_FRAMES);
-	RNA_def_property_ui_text(prop, "Show Frames", "Show curve for per-frame average error (camera motion should be solved first)");
+	RNA_def_property_ui_text(prop, "Show Frames",
+	                         "Show curve for per-frame average error (camera motion should be solved first)");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
 
 	/* show graph_tracks */
-	prop= RNA_def_property(srna, "show_graph_tracks", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_graph_tracks", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GRAPH_TRACKS);
-	RNA_def_property_ui_text(prop, "Show Tracks", "Display the speed curves (in \"x\" direction red, in \"y\" direction green) for the selected tracks");
+	RNA_def_property_ui_text(prop, "Show Tracks",
+	                         "Display the speed curves (in \"x\" direction red, in \"y\" direction green) "
+	                         "for the selected tracks");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
 
 	/* ** channels ** */
 
 	/* show_red_channel */
-	prop= RNA_def_property(srna, "show_red_channel", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_red_channel", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "postproc_flag", MOVIECLIP_DISABLE_RED);
 	RNA_def_property_ui_text(prop, "Show Red Channel", "Show red channel in the frame");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
 
 	/* show_green_channel */
-	prop= RNA_def_property(srna, "show_green_channel", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_green_channel", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "postproc_flag", MOVIECLIP_DISABLE_GREEN);
 	RNA_def_property_ui_text(prop, "Show Green Channel", "Show green channel in the frame");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
 
 	/* show_blue_channel */
-	prop= RNA_def_property(srna, "show_blue_channel", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_blue_channel", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "postproc_flag", MOVIECLIP_DISABLE_BLUE);
 	RNA_def_property_ui_text(prop, "Show Blue Channel", "Show blue channel in the frame");
 	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
 
 	/* preview_grayscale */
-	prop= RNA_def_property(srna, "use_grayscale_preview", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_grayscale_preview", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "postproc_flag", MOVIECLIP_PREVIEW_GRAYSCALE);
 	RNA_def_property_ui_text(prop, "Grayscale", "Display frame in grayscale mode");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
diff --git a/source/blender/makesrna/intern/rna_speaker.c b/source/blender/makesrna/intern/rna_speaker.c
index cb2b1fe..1e3c8df 100644
--- a/source/blender/makesrna/intern/rna_speaker.c
+++ b/source/blender/makesrna/intern/rna_speaker.c
@@ -53,112 +53,113 @@ static void rna_def_speaker(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "Speaker", "ID");
+	srna = RNA_def_struct(brna, "Speaker", "ID");
 	RNA_def_struct_ui_text(srna, "Speaker", "Speaker datablock for 3D audio speaker objects");
 	RNA_def_struct_ui_icon(srna, ICON_SPEAKER);
 
-	prop= RNA_def_property(srna, "muted", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "muted", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SPK_MUTED);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Mute", "Mute the speaker");
-	// RNA_def_property_update(prop, 0, "rna_Speaker_update");
+	/* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
 
-	/* This shouldn't be changed actually, hiding it!
-	prop= RNA_def_property(srna, "relative", PROP_BOOLEAN, PROP_NONE);
+#if 0 /* This shouldn't be changed actually, hiding it! */
+	prop = RNA_def_property(srna, "relative", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SPK_RELATIVE);
 	RNA_def_property_ui_text(prop, "Relative", "Whether the source is relative to the camera or not");
-	// RNA_def_property_update(prop, 0, "rna_Speaker_update");*/
+	/* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
+#endif
 
-	prop= RNA_def_property(srna, "sound", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "sound", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "sound");
 	RNA_def_property_struct_type(prop, "Sound");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Sound", "Sound datablock used by this speaker");
-	// RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_sound_set", NULL);
-	// RNA_def_property_update(prop, 0, "rna_Speaker_update");
+	/* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_sound_set", NULL); */
+	/* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
 
-	prop= RNA_def_property(srna, "volume_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "volume_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "volume_max");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Maximum Volume", "Maximum volume, no matter how near the object is");
-	// RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_volume_max_set", NULL);
-	// RNA_def_property_update(prop, 0, "rna_Speaker_update");
+	/* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_volume_max_set", NULL); */
+	/* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
 
-	prop= RNA_def_property(srna, "volume_min", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "volume_min", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "volume_min");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Minimum Volume", "Minimum volume, no matter how far away the object is");
-	// RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_volume_min_set", NULL);
-	// RNA_def_property_update(prop, 0, "rna_Speaker_update");
+	/* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_volume_min_set", NULL); */
+	/* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
 
-	prop= RNA_def_property(srna, "distance_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "distance_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "distance_max");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0.0f, FLT_MAX);
 	RNA_def_property_ui_text(prop, "Maximum Distance",
 	                         "Maximum distance for volume calculation, no matter how far away the object is");
-	// RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_distance_max_set", NULL);
-	// RNA_def_property_update(prop, 0, "rna_Speaker_update");
+	/* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_distance_max_set", NULL); */
+	/* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
 
-	prop= RNA_def_property(srna, "distance_reference", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "distance_reference", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "distance_reference");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0.0f, FLT_MAX);
 	RNA_def_property_ui_text(prop, "Reference Distance", "Reference distance at which volume is 100 %");
-	// RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_distance_reference_set", NULL);
-	// RNA_def_property_update(prop, 0, "rna_Speaker_update");
+	/* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_distance_reference_set", NULL); */
+	/* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
 
-	prop= RNA_def_property(srna, "attenuation", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "attenuation", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "attenuation");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0.0f, FLT_MAX);
 	RNA_def_property_ui_text(prop, "Attenuation", "How strong the distance affects volume, depending on distance model");
-	// RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_attenuation_set", NULL);
-	// RNA_def_property_update(prop, 0, "rna_Speaker_update");
+	/* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_attenuation_set", NULL); */
+	/* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
 
-	prop= RNA_def_property(srna, "cone_angle_outer", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "cone_angle_outer", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "cone_angle_outer");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0.0f, 360.0f);
 	RNA_def_property_ui_text(prop, "Outer Cone Angle",
 	                         "Angle of the outer cone, in degrees, outside this cone the volume is "
 	                         "the outer cone volume, between inner and outer cone the volume is interpolated");
-	// RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_cone_angle_outer_set", NULL);
-	// RNA_def_property_update(prop, 0, "rna_Speaker_update");
+	/* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_cone_angle_outer_set", NULL); */
+	/* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
 
-	prop= RNA_def_property(srna, "cone_angle_inner", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "cone_angle_inner", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "cone_angle_inner");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0.0f, 360.0f);
 	RNA_def_property_ui_text(prop, "Inner Cone Angle",
 	                         "Angle of the inner cone, in degrees, inside the cone the volume is 100 %");
-	// RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_cone_angle_inner_set", NULL);
-	// RNA_def_property_update(prop, 0, "rna_Speaker_update");
+	/* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_cone_angle_inner_set", NULL); */
+	/* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
 
-	prop= RNA_def_property(srna, "cone_volume_outer", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "cone_volume_outer", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "cone_volume_outer");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Outer Cone Volume", "Volume outside the outer cone");
-	// RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_cone_volume_outer_set", NULL);
-	// RNA_def_property_update(prop, 0, "rna_Speaker_update");
+	/* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_cone_volume_outer_set", NULL); */
+	/* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
 
-	prop= RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
 	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_float_funcs(prop, NULL, "rna_Speaker_volume_set", NULL);
-	// RNA_def_property_update(prop, 0, "rna_Speaker_update");
+	/* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_volume_set", NULL); */
+	/* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
 
-	prop= RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE);
 	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_float_funcs(prop, NULL, "rna_Speaker_pitch_set", NULL);
-	// RNA_def_property_update(prop, 0, "rna_Speaker_update");
+	/* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_pitch_set", NULL); */
+	/* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
 
 	/* common */
 	rna_def_animdata_common(srna);
diff --git a/source/blender/makesrna/intern/rna_test.c b/source/blender/makesrna/intern/rna_test.c
index c0f5e07..8bc545f 100644
--- a/source/blender/makesrna/intern/rna_test.c
+++ b/source/blender/makesrna/intern/rna_test.c
@@ -47,66 +47,69 @@
 
 #ifdef UNIT_TEST
 
-#define DEF_VARS(type, prefix)								\
-	static type prefix ## arr[ARRAY_SIZE];					\
-	static type prefix ## darr[DYNAMIC_ARRAY_SIZE];			\
-	static int prefix ## darr_len= ARRAY_SIZE;				\
-	static type prefix ## marr MARRAY_DIM;					\
-	static type prefix ## dmarr DYNAMIC_MARRAY_DIM;			\
-	static int prefix ## dmarr_len= sizeof(prefix ## dmarr);
-
-#define DEF_GET_SET(type, arr)											\
-	void rna_Test_ ## arr ## _get(PointerRNA *ptr, type *values)		\
-	{																	\
-		memcpy(values, arr, sizeof(arr));								\
-	}																	\
-																		\
-	void rna_Test_ ## arr ## _set(PointerRNA *ptr, const type *values)	\
-	{																	\
-		memcpy(arr, values, sizeof(arr));								\
-	}
-
-#define DEF_GET_SET_LEN(arr, max)										\
-	static int rna_Test_ ## arr ## _get_length(PointerRNA *ptr)			\
-	{																	\
-		return arr ## _len;												\
-	}																	\
-																		\
-	static int rna_Test_ ## arr ## _set_length(PointerRNA *ptr, int length)	\
-	{																	\
-		if (length > max)												\
-			return 0;													\
-																		\
-		arr ## _len= length;											\
-																		\
-		return 1;														\
-	}																	\
-
-DEF_VARS(float, f)
-DEF_VARS(int, i)
-DEF_VARS(int, b)
-
-DEF_GET_SET(float, farr)
-DEF_GET_SET(int, iarr)
-DEF_GET_SET(int, barr)
-
-DEF_GET_SET(float, fmarr)
-DEF_GET_SET(int, imarr)
-DEF_GET_SET(int, bmarr)
-
-DEF_GET_SET(float, fdarr)
-DEF_GET_SET_LEN(fdarr, DYNAMIC_ARRAY_SIZE)
-DEF_GET_SET(int, idarr)
-DEF_GET_SET_LEN(idarr, DYNAMIC_ARRAY_SIZE)
-DEF_GET_SET(int, bdarr)
-DEF_GET_SET_LEN(bdarr, DYNAMIC_ARRAY_SIZE)
-
-DEF_GET_SET(float, fdmarr)
-DEF_GET_SET_LEN(fdmarr, DYNAMIC_MARRAY_SIZE(float))
-DEF_GET_SET(int, idmarr)
-DEF_GET_SET_LEN(idmarr, DYNAMIC_MARRAY_SIZE(int))
-DEF_GET_SET(int, bdmarr)
-DEF_GET_SET_LEN(bdmarr, DYNAMIC_MARRAY_SIZE(int))
+#define DEF_VARS(type, prefix)                                \
+    static type prefix ## arr[ARRAY_SIZE];                    \
+    static type prefix ## darr[DYNAMIC_ARRAY_SIZE];           \
+    static int prefix ## darr_len = ARRAY_SIZE;               \
+    static type prefix ## marr MARRAY_DIM;                    \
+    static type prefix ## dmarr DYNAMIC_MARRAY_DIM;           \
+    static int prefix ## dmarr_len = sizeof(prefix ## dmarr); \
+    (void)0
+
+#define DEF_GET_SET(type, arr)                                          \
+    void rna_Test_ ## arr ## _get(PointerRNA * ptr, type * values)        \
+	{                                                                   \
+		memcpy(values, arr, sizeof(arr));                               \
+	}                                                                   \
+                                                                        \
+    void rna_Test_ ## arr ## _set(PointerRNA * ptr, const type * values)  \
+	{                                                                   \
+		memcpy(arr, values, sizeof(arr));                               \
+	}                                                                   \
+    (void)0
+
+#define DEF_GET_SET_LEN(arr, max)                                       \
+    static int rna_Test_ ## arr ## _get_length(PointerRNA * ptr)         \
+	{                                                                   \
+		return arr ## _len;                                             \
+	}                                                                   \
+                                                                        \
+    static int rna_Test_ ## arr ## _set_length(PointerRNA * ptr, int length) \
+	{                                                                   \
+		if (length > max)                                               \
+			return 0;                                                   \
+                                                                        \
+		arr ## _len = length;                                           \
+                                                                        \
+		return 1;                                                       \
+	}                                                                   \
+    (void)0
+
+DEF_VARS(float, f);
+DEF_VARS(int, i);
+DEF_VARS(int, b);
+
+DEF_GET_SET(float, farr);
+DEF_GET_SET(int, iarr);
+DEF_GET_SET(int, barr);
+
+DEF_GET_SET(float, fmarr);
+DEF_GET_SET(int, imarr);
+DEF_GET_SET(int, bmarr);
+
+DEF_GET_SET(float, fdarr);
+DEF_GET_SET_LEN(fdarr, DYNAMIC_ARRAY_SIZE);
+DEF_GET_SET(int, idarr);
+DEF_GET_SET_LEN(idarr, DYNAMIC_ARRAY_SIZE);
+DEF_GET_SET(int, bdarr);
+DEF_GET_SET_LEN(bdarr, DYNAMIC_ARRAY_SIZE);
+
+DEF_GET_SET(float, fdmarr);
+DEF_GET_SET_LEN(fdmarr, DYNAMIC_MARRAY_SIZE(float));
+DEF_GET_SET(int, idmarr);
+DEF_GET_SET_LEN(idmarr, DYNAMIC_MARRAY_SIZE(int));
+DEF_GET_SET(int, bdmarr);
+DEF_GET_SET_LEN(bdmarr, DYNAMIC_MARRAY_SIZE(int));
 
 #endif
 
@@ -117,66 +120,67 @@ void RNA_def_test(BlenderRNA *brna)
 #ifdef UNIT_TEST
 	StructRNA *srna;
 	PropertyRNA *prop;
-	unsigned short dimsize[]= {MARRAY_DIMSIZE};
+	unsigned short dimsize[] = {MARRAY_DIMSIZE};
 
-	srna= RNA_def_struct(brna, "Test", NULL);
+	srna = RNA_def_struct(brna, "Test", NULL);
 	RNA_def_struct_sdna(srna, "Test");
 
-	prop= RNA_def_float_array(srna, "farr", ARRAY_SIZE, NULL, 0.0f, 0.0f, "farr", "float array", 0.0f, 0.0f);
+	prop = RNA_def_float_array(srna, "farr", ARRAY_SIZE, NULL, 0.0f, 0.0f, "farr", "float array", 0.0f, 0.0f);
 	RNA_def_property_float_funcs(prop, "rna_Test_farr_get", "rna_Test_farr_set", NULL);
 
-	prop= RNA_def_int_array(srna, "iarr", ARRAY_SIZE, NULL, 0, 0, "iarr", "int array", 0, 0);
+	prop = RNA_def_int_array(srna, "iarr", ARRAY_SIZE, NULL, 0, 0, "iarr", "int array", 0, 0);
 	RNA_def_property_int_funcs(prop, "rna_Test_iarr_get", "rna_Test_iarr_set", NULL);
 
-	prop= RNA_def_boolean_array(srna, "barr", ARRAY_SIZE, NULL, "barr", "boolean array");
+	prop = RNA_def_boolean_array(srna, "barr", ARRAY_SIZE, NULL, "barr", "boolean array");
 	RNA_def_property_boolean_funcs(prop, "rna_Test_barr_get", "rna_Test_barr_set");
 
 	/* dynamic arrays */
 
-	prop= RNA_def_float_array(srna, "fdarr", DYNAMIC_ARRAY_SIZE, NULL, 0.0f, 0.0f, "fdarr", "dynamic float array", 0.0f, 0.0f);
+	prop = RNA_def_float_array(srna, "fdarr", DYNAMIC_ARRAY_SIZE, NULL, 0.0f, 0.0f, "fdarr",
+	                           "dynamic float array", 0.0f, 0.0f);
 	RNA_def_property_flag(prop, PROP_DYNAMIC);
 	RNA_def_property_dynamic_array_funcs(prop, "rna_Test_fdarr_get_length", "rna_Test_fdarr_set_length");
 	RNA_def_property_float_funcs(prop, "rna_Test_fdarr_get", "rna_Test_fdarr_set", NULL);
 
-	prop= RNA_def_int_array(srna, "idarr", DYNAMIC_ARRAY_SIZE, NULL, 0, 0, "idarr", "int array", 0, 0);
+	prop = RNA_def_int_array(srna, "idarr", DYNAMIC_ARRAY_SIZE, NULL, 0, 0, "idarr", "int array", 0, 0);
 	RNA_def_property_flag(prop, PROP_DYNAMIC);
 	RNA_def_property_dynamic_array_funcs(prop, "rna_Test_idarr_get_length", "rna_Test_idarr_set_length");
 	RNA_def_property_int_funcs(prop, "rna_Test_idarr_get", "rna_Test_idarr_set", NULL);
 	
-	prop= RNA_def_boolean_array(srna, "bdarr", DYNAMIC_ARRAY_SIZE, NULL, "bdarr", "boolean array");
+	prop = RNA_def_boolean_array(srna, "bdarr", DYNAMIC_ARRAY_SIZE, NULL, "bdarr", "boolean array");
 	RNA_def_property_flag(prop, PROP_DYNAMIC);
 	RNA_def_property_dynamic_array_funcs(prop, "rna_Test_bdarr_get_length", "rna_Test_bdarr_set_length");
 	RNA_def_property_boolean_funcs(prop, "rna_Test_bdarr_get", "rna_Test_bdarr_set");
 
 	/* multidimensional arrays */
 
-	prop= RNA_def_property(srna, "fmarr", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "fmarr", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_multidimensional_array(prop, MARRAY_SIZE(float), MARRAY_TOTDIM, dimsize);
 	RNA_def_property_float_funcs(prop, "rna_Test_fmarr_get", "rna_Test_fmarr_set", NULL);
 
-	prop= RNA_def_property(srna, "imarr", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "imarr", PROP_INT, PROP_NONE);
 	RNA_def_property_multidimensional_array(prop, MARRAY_SIZE(int), MARRAY_TOTDIM, dimsize);
 	RNA_def_property_int_funcs(prop, "rna_Test_imarr_get", "rna_Test_imarr_set", NULL);
 
-	prop= RNA_def_property(srna, "bmarr", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "bmarr", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_multidimensional_array(prop, MARRAY_SIZE(int), MARRAY_TOTDIM, dimsize);
 	RNA_def_property_boolean_funcs(prop, "rna_Test_bmarr_get", "rna_Test_bmarr_set");
 
 	/* dynamic multidimensional arrays */
 
-	prop= RNA_def_property(srna, "fdmarr", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "fdmarr", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_multidimensional_array(prop, DYNAMIC_MARRAY_SIZE(float), MARRAY_TOTDIM, dimsize);
 	RNA_def_property_flag(prop, PROP_DYNAMIC);
 	RNA_def_property_dynamic_array_funcs(prop, "rna_Test_fdmarr_get_length", "rna_Test_fdmarr_set_length");
 	RNA_def_property_float_funcs(prop, "rna_Test_fdmarr_get", "rna_Test_fdmarr_set", NULL);
 
-	prop= RNA_def_property(srna, "idmarr", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "idmarr", PROP_INT, PROP_NONE);
 	RNA_def_property_multidimensional_array(prop, DYNAMIC_MARRAY_SIZE(int), MARRAY_TOTDIM, dimsize);
 	RNA_def_property_flag(prop, PROP_DYNAMIC);
 	RNA_def_property_dynamic_array_funcs(prop, "rna_Test_idmarr_get_length", "rna_Test_idmarr_set_length");
 	RNA_def_property_int_funcs(prop, "rna_Test_idmarr_get", "rna_Test_idmarr_set", NULL);
 
-	prop= RNA_def_property(srna, "bdmarr", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "bdmarr", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_multidimensional_array(prop, DYNAMIC_MARRAY_SIZE(int), MARRAY_TOTDIM, dimsize);
 	RNA_def_property_flag(prop, PROP_DYNAMIC);
 	RNA_def_property_dynamic_array_funcs(prop, "rna_Test_bdmarr_get_length", "rna_Test_bdmarr_set_length");
@@ -185,6 +189,4 @@ void RNA_def_test(BlenderRNA *brna)
 #endif
 }
 
-#endif	/* RNA_RUNTIME */
-
-
+#endif  /* RNA_RUNTIME */
diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c
index 9e3611b..36ee361 100644
--- a/source/blender/makesrna/intern/rna_text.c
+++ b/source/blender/makesrna/intern/rna_text.c
@@ -46,70 +46,70 @@ int text_file_modified(Text *text); /* XXX bad level call */
 
 static void rna_Text_filename_get(PointerRNA *ptr, char *value)
 {
-	Text *text= (Text*)ptr->data;
+	Text *text = (Text*)ptr->data;
 
-	if(text->name)
+	if (text->name)
 		strcpy(value, text->name);
 	else
-		value[0]= '\0';
+		value[0] = '\0';
 }
 
 static int rna_Text_filename_length(PointerRNA *ptr)
 {
-	Text *text= (Text*)ptr->data;
+	Text *text = (Text*)ptr->data;
 	return (text->name)? strlen(text->name): 0;
 }
 
 static void rna_Text_filename_set(PointerRNA *ptr, const char *value)
 {
-	Text *text= (Text*)ptr->data;
+	Text *text = (Text*)ptr->data;
 
-	if(text->name)
+	if (text->name)
 		MEM_freeN(text->name);
 
-	if(value[0])
-		text->name= BLI_strdup(value);
+	if (value[0])
+		text->name = BLI_strdup(value);
 	else
-		text->name= NULL;
+		text->name = NULL;
 }
 
 static int rna_Text_modified_get(PointerRNA *ptr)
 {
-	Text *text= (Text*)ptr->data;
+	Text *text = (Text*)ptr->data;
 	return text_file_modified(text);
 }
 
 static void rna_TextLine_body_get(PointerRNA *ptr, char *value)
 {
-	TextLine *line= (TextLine*)ptr->data;
+	TextLine *line = (TextLine*)ptr->data;
 
-	if(line->line)
+	if (line->line)
 		strcpy(value, line->line);
 	else
-		value[0]= '\0';
+		value[0] = '\0';
 }
 
 static int rna_TextLine_body_length(PointerRNA *ptr)
 {
-	TextLine *line= (TextLine*)ptr->data;
+	TextLine *line = (TextLine*)ptr->data;
 	return line->len;
 }
 
 static void rna_TextLine_body_set(PointerRNA *ptr, const char *value)
 {
-	TextLine *line= (TextLine*)ptr->data;
-	int len= strlen(value);
+	TextLine *line = (TextLine*)ptr->data;
+	int len = strlen(value);
 
-	if(line->line)
+	if (line->line)
 		MEM_freeN(line->line);
 
-	line->line= MEM_mallocN((len + 1) * sizeof(char), "rna_text_body");
-	line->len= len;
+	line->line = MEM_mallocN((len + 1) * sizeof(char), "rna_text_body");
+	line->len = len;
 	memcpy(line->line, value, len + 1);
 
-	if(line->format) {
+	if (line->format) {
 		MEM_freeN(line->format);
-		line->format= NULL;
+		line->format = NULL;
 	}
 }
 
@@ -123,7 +123,7 @@ static void rna_def_text_line(BlenderRNA *brna)
 	srna = RNA_def_struct(brna, "TextLine", NULL);
 	RNA_def_struct_ui_text(srna, "Text Line", "Line of text in a Text datablock");
 	
-	prop= RNA_def_property(srna, "body", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "body", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_funcs(prop, "rna_TextLine_body_get", "rna_TextLine_body_length", "rna_TextLine_body_set");
 	RNA_def_property_ui_text(prop, "Line", "Text in the line");
 	RNA_def_property_update(prop, NC_TEXT|NA_EDITED, NULL);
@@ -137,37 +137,37 @@ static void rna_def_text_marker(BlenderRNA *brna)
 	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);
+	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);
+	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);
+	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);
+	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);
+	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);
+	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);
+	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");
 }
@@ -182,62 +182,66 @@ static void rna_def_text(BlenderRNA *brna)
 	RNA_def_struct_ui_icon(srna, ICON_TEXT);
 	RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
 	
-	prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_funcs(prop, "rna_Text_filename_get", "rna_Text_filename_length", "rna_Text_filename_set");
 	RNA_def_property_ui_text(prop, "File Path", "Filename of the text file");
 
-	prop= RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", TXT_ISDIRTY);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Dirty", "Text file has been edited since last save");
 
-	prop= RNA_def_property(srna, "is_modified", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_modified", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_funcs(prop, "rna_Text_modified_get", NULL);
 	RNA_def_property_ui_text(prop, "Modified", "Text file on disk is different than the one in memory");
 
-	prop= RNA_def_property(srna, "is_in_memory", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_in_memory", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", TXT_ISMEM);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Memory", "Text file is in memory, without a corresponding file on disk");
 	
-	prop= RNA_def_property(srna, "use_module", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_module", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", TXT_ISSCRIPT);
-	RNA_def_property_ui_text(prop, "Register", "Register this text as a module on loading, Text name must end with \".py\"");
+	RNA_def_property_ui_text(prop, "Register",
+	                         "Register this text as a module on loading, Text name must end with \".py\"");
 
-	prop= RNA_def_property(srna, "use_tabs_as_spaces", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_tabs_as_spaces", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flags", TXT_TABSTOSPACES);
 	RNA_def_property_ui_text(prop, "Tabs as Spaces", "Automatically converts all new tabs into spaces");
 
-	prop= RNA_def_property(srna, "lines", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "lines", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "TextLine");
 	RNA_def_property_ui_text(prop, "Lines", "Lines of text");
 	
-	prop= RNA_def_property(srna, "current_line", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "current_line", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "curl");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "TextLine");
 	RNA_def_property_ui_text(prop, "Current Line", "Current line, and start line of selection if one exists");
 
-	prop= RNA_def_property(srna, "current_character", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "current_character", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "curc");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "Current Character", "Index of current character in current line, and also start index of character in selection if one exists");
+	RNA_def_property_ui_text(prop, "Current Character",
+	                         "Index of current character in current line, and also start index of "
+	                         "character in selection if one exists");
 	
-	prop= RNA_def_property(srna, "select_end_line", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "select_end_line", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "sell");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_struct_type(prop, "TextLine");
 	RNA_def_property_ui_text(prop, "Selection End Line", "End line of selection");
 	
-	prop= RNA_def_property(srna, "select_end_character", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "select_end_character", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "selc");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "Selection End Character", "Index of character after end of selection in the selection end line");
+	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);
+	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");
 
diff --git a/source/blender/makesrna/intern/rna_text_api.c b/source/blender/makesrna/intern/rna_text_api.c
index acfcad8..3f51185 100644
--- a/source/blender/makesrna/intern/rna_text_api.c
+++ b/source/blender/makesrna/intern/rna_text_api.c
@@ -54,12 +54,12 @@ void RNA_api_text(StructRNA *srna)
 	FunctionRNA *func;
 	PropertyRNA *prop;
 
-	func= RNA_def_function(srna, "clear", "rna_Text_clear");
+	func = RNA_def_function(srna, "clear", "rna_Text_clear");
 	RNA_def_function_ui_description(func, "clear the text block");
 
-	func= RNA_def_function(srna, "write", "rna_Text_write");
+	func = RNA_def_function(srna, "write", "rna_Text_write");
 	RNA_def_function_ui_description(func, "write text at the cursor location and advance to the end of the text block");
-	prop= RNA_def_string(func, "text", "Text", 0, "", "New text for this datablock");
+	prop = RNA_def_string(func, "text", "Text", 0, "", "New text for this datablock");
 	RNA_def_property_flag(prop, PROP_REQUIRED);
 }
 
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c
index ba8460e..fab8099 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -67,7 +67,7 @@ EnumPropertyItem texture_type_items[] = {
 	{TEX_MUSGRAVE, "MUSGRAVE", ICON_TEXTURE, "Musgrave", "Procedural - highly flexible fractal noise texture"},
 	{TEX_NOISE, "NOISE", ICON_TEXTURE, "Noise",
 	            "Procedural - random noise, gives a different result every time, for every frame, for every pixel"},
-	//{TEX_PLUGIN, "PLUGIN", ICON_PLUGIN, "Plugin", ""}, /* Nothing yet */
+	/*{TEX_PLUGIN, "PLUGIN", ICON_PLUGIN, "Plugin", ""},  *//* Nothing yet */
 	{TEX_POINTDENSITY, "POINT_DENSITY", ICON_TEXTURE, "Point Density", ""},
 	{TEX_STUCCI, "STUCCI", ICON_TEXTURE, "Stucci", "Procedural - create a fractal noise texture"},
 	{TEX_VORONOI, "VORONOI", ICON_TEXTURE, "Voronoi", "Procedural - create cell-like patterns based on Worley noise"},
@@ -91,8 +91,8 @@ EnumPropertyItem blend_type_items[] = {
 	{MTEX_BLEND_SAT, "SATURATION", 0, "Saturation", ""},
 	{MTEX_BLEND_VAL, "VALUE", 0, "Value", ""},
 	{MTEX_BLEND_COLOR, "COLOR", 0, "Color", ""},
-	{MTEX_SOFT_LIGHT, "SOFT_LIGHT", 0, "Soft Light", ""}, 
-	{MTEX_LIN_LIGHT    , "LINEAR_LIGHT", 0, "Linear Light", ""}, 
+	{MTEX_SOFT_LIGHT, "SOFT_LIGHT", 0, "Soft Light", ""},
+	{MTEX_LIN_LIGHT    , "LINEAR_LIGHT", 0, "Linear Light", ""},
 	{0, NULL, 0, NULL, NULL}};
 
 #ifdef RNA_RUNTIME
@@ -113,11 +113,11 @@ EnumPropertyItem blend_type_items[] = {
 
 static StructRNA *rna_Texture_refine(struct PointerRNA *ptr)
 {
-	Tex *tex= (Tex*)ptr->data;
+	Tex *tex = (Tex*)ptr->data;
 
-	switch(tex->type) {
+	switch (tex->type) {
 		case TEX_BLEND:
-			return &RNA_BlendTexture; 
+			return &RNA_BlendTexture;
 		case TEX_CLOUDS:
 			return &RNA_CloudsTexture;
 		case TEX_DISTNOISE:
@@ -155,17 +155,17 @@ static StructRNA *rna_Texture_refine(struct PointerRNA *ptr)
 
 static void rna_Texture_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	ID *id= ptr->id.data;
+	ID *id = ptr->id.data;
 
-	if(GS(id->name) == ID_TE) {
-		Tex *tex= ptr->id.data;
+	if (GS(id->name) == ID_TE) {
+		Tex *tex = ptr->id.data;
 
 		DAG_id_tag_update(&tex->id, 0);
 		WM_main_add_notifier(NC_TEXTURE, tex);
 		WM_main_add_notifier(NC_MATERIAL|ND_SHADING_DRAW, NULL);
 	}
-	else if(GS(id->name) == ID_NT) {
-		bNodeTree *ntree= ptr->id.data;
+	else if (GS(id->name) == ID_NT) {
+		bNodeTree *ntree = ptr->id.data;
 		ED_node_generic_update(bmain, ntree, NULL);
 	}
 }
@@ -184,7 +184,7 @@ static void rna_Color_mapping_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 
 static void rna_Texture_voxeldata_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Tex *tex= ptr->id.data;
+	Tex *tex = ptr->id.data;
 	
 	tex->vd->ok = 0;
 	rna_Texture_update(bmain, scene, ptr);
@@ -192,9 +192,9 @@ static void rna_Texture_voxeldata_update(Main *bmain, Scene *scene, PointerRNA *
 
 static void rna_Texture_voxeldata_image_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Tex *tex= ptr->id.data;
+	Tex *tex = ptr->id.data;
 	
-	if(tex->ima) { /* may be getting cleared too */
+	if (tex->ima) { /* may be getting cleared too */
 		tex->ima->source = IMA_SRC_SEQUENCE;
 	}
 	rna_Texture_voxeldata_update(bmain, scene, ptr);
@@ -204,7 +204,7 @@ static void rna_Texture_voxeldata_image_update(Main *bmain, Scene *scene, Pointe
 /* Used for Texture Properties, used (also) for/in Nodes */
 static void rna_Texture_nodes_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	Tex *tex= ptr->id.data;
+	Tex *tex = ptr->id.data;
 
 	DAG_id_tag_update(&tex->id, 0);
 	WM_main_add_notifier(NC_TEXTURE|ND_NODES, tex);
@@ -212,39 +212,39 @@ static void rna_Texture_nodes_update(Main *UNUSED(bmain), Scene *UNUSED(scene),
 
 static void rna_Texture_type_set(PointerRNA *ptr, int value)
 {
-	Tex *tex= (Tex*)ptr->data;
+	Tex *tex = (Tex*)ptr->data;
 	
 	tex_set_type(tex, value);
 }
 
 void rna_TextureSlot_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	ID *id= ptr->id.data;
+	ID *id = ptr->id.data;
 
 	DAG_id_tag_update(id, 0);
 
-	switch(GS(id->name)) {
-		case ID_MA: 
+	switch (GS(id->name)) {
+		case ID_MA:
 			WM_main_add_notifier(NC_MATERIAL|ND_SHADING, id);
 			WM_main_add_notifier(NC_MATERIAL|ND_SHADING_DRAW, id);
 			break;
-		case ID_WO: 
+		case ID_WO:
 			WM_main_add_notifier(NC_WORLD, id);
 			break;
-		case ID_LA: 
+		case ID_LA:
 			WM_main_add_notifier(NC_LAMP|ND_LIGHTING, id);
 			break;
-		case ID_BR: 
+		case ID_BR:
 			WM_main_add_notifier(NC_BRUSH, id);
 			break;
 		case ID_PA:
 		{
-			MTex *mtex= ptr->data;
+			MTex *mtex = ptr->data;
 			int recalc = OB_RECALC_DATA;
 
-			if(mtex->mapto & PAMAP_INIT)
+			if (mtex->mapto & PAMAP_INIT)
 				recalc |= PSYS_RECALC_RESET;
-			if(mtex->mapto & PAMAP_CHILD)
+			if (mtex->mapto & PAMAP_CHILD)
 				recalc |= PSYS_RECALC_CHILD;
 
 			DAG_id_tag_update(id, recalc);
@@ -256,7 +256,7 @@ void rna_TextureSlot_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRN
 
 char *rna_TextureSlot_path(PointerRNA *ptr)
 {
-	MTex *mtex= ptr->data;
+	MTex *mtex = ptr->data;
 	
 	/* if there is ID-data, resolve the path using the index instead of by name,
 	 * since the name used is the name of the texture assigned, but the texture
@@ -268,11 +268,11 @@ char *rna_TextureSlot_path(PointerRNA *ptr)
 		
 		/* 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");
+		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);
+			int index = RNA_property_collection_lookup_index(&id_ptr, prop, ptr);
 			
 			if (index >= 0)
 				return BLI_sprintfN("texture_slots[%d]", index);
@@ -288,9 +288,9 @@ char *rna_TextureSlot_path(PointerRNA *ptr)
 
 static int rna_TextureSlot_name_length(PointerRNA *ptr)
 {
-	MTex *mtex= ptr->data;
+	MTex *mtex = ptr->data;
 
-	if(mtex->tex)
+	if (mtex->tex)
 		return strlen(mtex->tex->id.name+2);
 	
 	return 0;
@@ -298,49 +298,50 @@ static int rna_TextureSlot_name_length(PointerRNA *ptr)
 
 static void rna_TextureSlot_name_get(PointerRNA *ptr, char *str)
 {
-	MTex *mtex= ptr->data;
+	MTex *mtex = ptr->data;
 
-	if(mtex->tex)
+	if (mtex->tex)
 		strcpy(str, mtex->tex->id.name+2);
 	else
-		str[0]= '\0';
+		str[0] = '\0';
 }
 
 static int rna_TextureSlot_output_node_get(PointerRNA *ptr)
 {
-	MTex *mtex= ptr->data;
-	Tex *tex= mtex->tex;
-	int cur= mtex->which_output;
+	MTex *mtex = ptr->data;
+	Tex *tex = mtex->tex;
+	int cur = mtex->which_output;
 	
-	if(tex) {
-		bNodeTree *ntree= tex->nodetree;
+	if (tex) {
+		bNodeTree *ntree = tex->nodetree;
 		bNode *node;
-		if(ntree) {
-			for(node= ntree->nodes.first; node; node= node->next) {
-				if(node->type == TEX_NODE_OUTPUT) {
-					if(cur == node->custom1)
+		if (ntree) {
+			for (node = ntree->nodes.first; node; node = node->next) {
+				if (node->type == TEX_NODE_OUTPUT) {
+					if (cur == node->custom1)
 						return cur;
 				}
 			}
 		}
 	}
 	
-	mtex->which_output= 0;
+	mtex->which_output = 0;
 	return 0;
 }
 
 
-static EnumPropertyItem *rna_TextureSlot_output_node_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *free)
+static EnumPropertyItem *rna_TextureSlot_output_node_itemf(bContext *C, PointerRNA *ptr,
+                                                           PropertyRNA *UNUSED(prop), int *free)
 {
-	MTex *mtex= ptr->data;
-	Tex *tex= mtex->tex;
-	EnumPropertyItem *item= NULL;
-	int totitem= 0;
-	
-	if(tex) {
-		bNodeTree *ntree= tex->nodetree;
-		if(ntree) {
-			EnumPropertyItem tmp= {0, "", 0, "", ""};
+	MTex *mtex = ptr->data;
+	Tex *tex = mtex->tex;
+	EnumPropertyItem *item = NULL;
+	int totitem = 0;
+	
+	if (tex) {
+		bNodeTree *ntree = tex->nodetree;
+		if (ntree) {
+			EnumPropertyItem tmp = {0, "", 0, "", ""};
 			bNode *node;
 			
 			tmp.value = 0;
@@ -348,10 +349,10 @@ static EnumPropertyItem *rna_TextureSlot_output_node_itemf(bContext *C, PointerR
 			tmp.identifier = "NOT_SPECIFIED";
 			RNA_enum_item_add(&item, &totitem, &tmp);
 			
-			for(node= ntree->nodes.first; node; node= node->next) {
-				if(node->type == TEX_NODE_OUTPUT) {
-					tmp.value= node->custom1;
-					tmp.name= ((TexNodeOutput*)node->storage)->name;
+			for (node = ntree->nodes.first; node; node = node->next) {
+				if (node->type == TEX_NODE_OUTPUT) {
+					tmp.value = node->custom1;
+					tmp.name = ((TexNodeOutput*)node->storage)->name;
 					tmp.identifier = tmp.name;
 					RNA_enum_item_add(&item, &totitem, &tmp);
 				}
@@ -367,37 +368,37 @@ static EnumPropertyItem *rna_TextureSlot_output_node_itemf(bContext *C, PointerR
 
 static void rna_Texture_use_color_ramp_set(PointerRNA *ptr, int value)
 {
-	Tex *tex= (Tex*)ptr->data;
+	Tex *tex = (Tex*)ptr->data;
 
-	if(value) tex->flag |= TEX_COLORBAND;
+	if (value) tex->flag |= TEX_COLORBAND;
 	else tex->flag &= ~TEX_COLORBAND;
 
-	if((tex->flag & TEX_COLORBAND) && tex->coba == NULL)
-		tex->coba= add_colorband(0);
+	if ((tex->flag & TEX_COLORBAND) && tex->coba == NULL)
+		tex->coba = add_colorband(0);
 }
 
 static void rna_Texture_use_nodes_set(PointerRNA *ptr, int v)
 {
-	Tex *tex= (Tex*)ptr->data;
+	Tex *tex = (Tex*)ptr->data;
 	
 	tex->use_nodes = v;
 	tex->type = 0;
 	
-	if(v && tex->nodetree==NULL)
+	if (v && tex->nodetree == NULL)
 		ED_node_texture_default(tex);
 }
 
 static void rna_ImageTexture_mipmap_set(PointerRNA *ptr, int value)
 {
-	Tex *tex= (Tex*)ptr->data;
+	Tex *tex = (Tex*)ptr->data;
 
-	if(value) tex->imaflag |= TEX_MIPMAP;
+	if (value) tex->imaflag |= TEX_MIPMAP;
 	else tex->imaflag &= ~TEX_MIPMAP;
 }
 
 static void rna_Envmap_source_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	Tex *tex= ptr->id.data;
+	Tex *tex = ptr->id.data;
 	
 	if (tex->env)
 		BKE_free_envmapdata(tex->env);
@@ -407,13 +408,13 @@ static void rna_Envmap_source_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 
 static PointerRNA rna_PointDensity_psys_get(PointerRNA *ptr)
 {
-	PointDensity *pd= ptr->data;
-	Object *ob= pd->object;
-	ParticleSystem *psys= NULL;
+	PointDensity *pd = ptr->data;
+	Object *ob = pd->object;
+	ParticleSystem *psys = NULL;
 	PointerRNA value;
 
-	if(ob && pd->psys)
-		psys= BLI_findlink(&ob->particlesystem, pd->psys-1);
+	if (ob && pd->psys)
+		psys = BLI_findlink(&ob->particlesystem, pd->psys-1);
 
 	RNA_pointer_create(&ob->id, &RNA_ParticleSystem, psys, &value);
 	return value;
@@ -421,11 +422,11 @@ static PointerRNA rna_PointDensity_psys_get(PointerRNA *ptr)
 
 static void rna_PointDensity_psys_set(PointerRNA *ptr, PointerRNA value)
 {
-	PointDensity *pd= ptr->data;
-	Object *ob= pd->object;
+	PointDensity *pd = ptr->data;
+	Object *ob = pd->object;
 
-	if(ob && value.id.data == ob)
-		pd->psys= BLI_findindex(&ob->particlesystem, value.data) + 1;
+	if (ob && value.id.data == ob)
+		pd->psys = BLI_findindex(&ob->particlesystem, value.data) + 1;
 }
 
 static char *rna_PointDensity_path(PointerRNA *UNUSED(ptr))
@@ -464,63 +465,65 @@ static void rna_def_texmapping(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "TexMapping", NULL);
+	srna = RNA_def_struct(brna, "TexMapping", NULL);
 	RNA_def_struct_ui_text(srna, "Texture Mapping", "Texture coordinate mapping settings");
 
-	prop= RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "translation", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "loc");
 	RNA_def_property_ui_text(prop, "Location", "");
+	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
 	RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
 	
-	prop= RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER); /* Not PROP_XYZ, this is now in radians, no more degrees */
+		/* Not PROP_XYZ, this is now in radians, no more degrees */
+	prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER);
 	RNA_def_property_float_sdna(prop, NULL, "rot");
 	RNA_def_property_ui_text(prop, "Rotation", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
 	
-	prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "size");
 	RNA_def_property_ui_text(prop, "Scale", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
 	
-	prop= RNA_def_property(srna, "min", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "min");
 	RNA_def_property_ui_text(prop, "Minimum", "Minimum value for clipping");
 	RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
 	
-	prop= RNA_def_property(srna, "max", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "max");
 	RNA_def_property_ui_text(prop, "Maximum", "Maximum value for clipping");
 	RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
 	
-	prop= RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MIN);
 	RNA_def_property_ui_text(prop, "Has Minimum", "Whether to use minimum clipping value");
 	RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
 	
-	prop= RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MAX);
 	RNA_def_property_ui_text(prop, "Has Maximum", "Whether to use maximum clipping value");
 	RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
 
-	prop= RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "projx");
 	RNA_def_property_enum_items(prop, prop_xyz_mapping_items);
 	RNA_def_property_ui_text(prop, "X Mapping", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
 	
-	prop= RNA_def_property(srna, "mapping_y", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mapping_y", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "projy");
 	RNA_def_property_enum_items(prop, prop_xyz_mapping_items);
 	RNA_def_property_ui_text(prop, "Y Mapping", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
 	
-	prop= RNA_def_property(srna, "mapping_z", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mapping_z", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "projz");
 	RNA_def_property_enum_items(prop, prop_xyz_mapping_items);
 	RNA_def_property_ui_text(prop, "Z Mapping", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
 
-	prop= RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, prop_mapping_items);
 	RNA_def_property_ui_text(prop, "Mapping", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
@@ -531,47 +534,47 @@ static void rna_def_colormapping(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "ColorMapping", NULL);
+	srna = RNA_def_struct(brna, "ColorMapping", NULL);
 	RNA_def_struct_ui_text(srna, "Color Mapping", "Color mapping settings");
 
-	prop= RNA_def_property(srna, "use_color_ramp", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_color_ramp", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", COLORMAP_USE_RAMP);
 	RNA_def_property_ui_text(prop, "Use Color Ramp", "Toggle color ramp operations");
 	RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
 
-	prop= RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL);
+	prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "coba");
 	RNA_def_property_struct_type(prop, "ColorRamp");
 	RNA_def_property_ui_text(prop, "Color Ramp", "");
 	RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
 
-	prop= RNA_def_property(srna, "brightness", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "brightness", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "bright");
 	RNA_def_property_range(prop, 0, 2);
 	RNA_def_property_ui_text(prop, "Brightness", "Adjust the brightness of the texture");
 	RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
 
-	prop= RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.01, 5);
 	RNA_def_property_ui_text(prop, "Contrast", "Adjust the contrast of the texture");
 	RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
 
-	prop= RNA_def_property(srna, "saturation", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "saturation", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0, 2);
 	RNA_def_property_ui_text(prop, "Saturation", "Adjust the saturation of colors in the texture");
 	RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
 
-	prop= RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, blend_type_items);
 	RNA_def_property_ui_text(prop, "Blend Type", "Mode used to mix with texture output color");
 	RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
 
-	prop= RNA_def_property(srna, "blend_color", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "blend_color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Color", "Blend color to mix with texture output color");
 	RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
 
-	prop= RNA_def_property(srna, "blend_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "blend_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Blend Factor", "");
 	RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
 }
@@ -585,20 +588,20 @@ static void rna_def_mtex(BlenderRNA *brna)
 		{0, "DUMMY", 0, "Dummy", ""},
 		{0, NULL, 0, NULL, NULL}};
 		
-	srna= RNA_def_struct(brna, "TextureSlot", NULL);
+	srna = RNA_def_struct(brna, "TextureSlot", NULL);
 	RNA_def_struct_sdna(srna, "MTex");
 	RNA_def_struct_ui_text(srna, "Texture Slot", "Texture slot defining the mapping and influence of a texture");
 	RNA_def_struct_path_func(srna, "rna_TextureSlot_path");
 	RNA_def_struct_ui_icon(srna, ICON_TEXTURE_DATA);
 
-	prop= RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "tex");
 	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");
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	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);
 	RNA_def_property_ui_text(prop, "Name", "Texture slot name");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -606,53 +609,54 @@ static void rna_def_mtex(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
 
 	/* mapping */
-	prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "ofs");
-	RNA_def_property_ui_range(prop, -10, 10, 10, 2);
+	RNA_def_property_ui_range(prop, -10, 10, 10, RNA_TRANSLATION_PREC_DEFAULT);
 	RNA_def_property_ui_text(prop, "Offset", "Fine tune of the texture mapping X, Y and Z locations");
 	RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
 
-	prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "size");
 	RNA_def_property_ui_range(prop, -100, 100, 10, 2);
 	RNA_def_property_ui_text(prop, "Size", "Set scaling for the texture's X, Y and Z sizes");
 	RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
 
-	prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "r");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Color",
 	                         "Default color for textures that don't return RGB or when RGB to intensity is enabled");
 	RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
 
-	prop= RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "blendtype");
 	RNA_def_property_enum_items(prop, blend_type_items);
 	RNA_def_property_ui_text(prop, "Blend Type", "Mode used to apply the texture");
 	RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
 
-	prop= RNA_def_property(srna, "use_stencil", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_stencil", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_STENCIL);
 	RNA_def_property_ui_text(prop, "Stencil", "Use this texture as a blending value on the next texture");
 	RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
 
-	prop= RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_NEGATIVE);
 	RNA_def_property_ui_text(prop, "Negate", "Invert the values of the texture to reverse its effect");
 	RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
 
-	prop= RNA_def_property(srna, "use_rgb_to_intensity", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_rgb_to_intensity", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "texflag", MTEX_RGBTOINT);
 	RNA_def_property_ui_text(prop, "RGB to Intensity", "Convert texture RGB values to intensity (gray) values");
 	RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
 
-	prop= RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "def_var");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
-	RNA_def_property_ui_text(prop, "Default Value", "Value to use for Ref, Spec, Amb, Emit, Alpha, RayMir, TransLu and Hard");
+	RNA_def_property_ui_text(prop, "Default Value",
+	                         "Value to use for Ref, Spec, Amb, Emit, Alpha, RayMir, TransLu and Hard");
 	RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
 	
-	prop= RNA_def_property(srna, "output_node", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "output_node", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "which_output");
 	RNA_def_property_enum_items(prop, output_node_items);
 	RNA_def_property_enum_funcs(prop, "rna_TextureSlot_output_node_get", NULL, "rna_TextureSlot_output_node_itemf");
@@ -660,50 +664,52 @@ static void rna_def_mtex(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
 }
 
-static void rna_def_filter_common(StructRNA *srna) 
+static void rna_def_filter_common(StructRNA *srna)
 {
 	PropertyRNA *prop;
 	
-	prop= RNA_def_property(srna, "use_mipmap", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_mipmap", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_MIPMAP);
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_ImageTexture_mipmap_set");
 	RNA_def_property_ui_text(prop, "MIP Map", "Use auto-generated MIP maps for the image");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "use_mipmap_gauss", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_mipmap_gauss", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_GAUSS_MIP);
 	RNA_def_property_ui_text(prop, "MIP Map Gaussian filter", "Use Gauss filter to sample down MIP maps");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "texfilter");
 	RNA_def_property_enum_items(prop, texture_filter_items);
 	RNA_def_property_ui_text(prop, "Filter", "Texture filter to use for sampling image");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "filter_probes", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "filter_probes", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "afmax");
 	RNA_def_property_range(prop, 1, 256);
 	RNA_def_property_ui_text(prop, "Filter Probes",
-	                         "Maximum number of samples (higher gives less blur at distant/oblique angles, but is also slower)");
+	                         "Maximum number of samples (higher gives less blur at distant/oblique angles, "
+	                         "but is also slower)");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "filter_eccentricity", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "filter_eccentricity", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "afmax");
 	RNA_def_property_range(prop, 1, 256);
 	RNA_def_property_ui_text(prop, "Filter Eccentricity",
-	                         "Maximum eccentricity (higher gives less blur at distant/oblique angles, but is also slower)");
+	                         "Maximum eccentricity (higher gives less blur at distant/oblique angles, "
+	                         "but is also slower)");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "use_filter_size_min", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_filter_size_min", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_FILTER_MIN);
 	RNA_def_property_ui_text(prop, "Minimum Filter Size", "Use Filter Size as a minimal filter value in pixels");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "filter_size", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "filter_size", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "filtersize");
 	RNA_def_property_range(prop, 0.1, 50.0);
-	RNA_def_property_ui_range(prop, 0.1, 50.0, 1, 0.2);
+	RNA_def_property_ui_range(prop, 0.1, 50.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Filter Size", "Multiply the filter size used by MIP Map and Interpolation");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 }
@@ -724,67 +730,69 @@ static void rna_def_environment_map(BlenderRNA *brna)
 		{ENV_PLANE, "PLANE", 0, "Plane", "Only one side is rendered, with Z axis pointing in direction of image"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "EnvironmentMap", NULL);
+	srna = RNA_def_struct(brna, "EnvironmentMap", NULL);
 	RNA_def_struct_sdna(srna, "EnvMap");
-	RNA_def_struct_ui_text(srna, "EnvironmentMap", "Environment map created by the renderer and cached for subsequent renders");
+	RNA_def_struct_ui_text(srna, "EnvironmentMap",
+	                       "Environment map created by the renderer and cached for subsequent renders");
 	
-	prop= RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "stype");
 	RNA_def_property_enum_items(prop, prop_source_items);
 	RNA_def_property_ui_text(prop, "Source", "");
 	RNA_def_property_update(prop, 0, "rna_Envmap_source_update");
 
-	prop= RNA_def_property(srna, "viewpoint_object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "viewpoint_object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "object");
 	RNA_def_property_ui_text(prop, "Viewpoint Object", "Object to use as the environment map's viewpoint location");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, prop_mapping_items);
 	RNA_def_property_ui_text(prop, "Mapping", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "clipsta");
 	RNA_def_property_range(prop, 0.001, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.01, 50, 100, 2);
 	RNA_def_property_ui_text(prop, "Clip Start", "Objects nearer than this are not visible to map");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "clipend");
 	RNA_def_property_range(prop, 0.01, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.10, 20000, 100, 2);
 	RNA_def_property_ui_text(prop, "Clip End", "Objects further than this are not visible to map");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "viewscale");
 	RNA_def_property_range(prop, 0.1, 5.0);
 	RNA_def_property_ui_range(prop, 0.5, 1.5, 1, 2);
 	RNA_def_property_ui_text(prop, "Zoom", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "layers_ignore", PROP_BOOLEAN, PROP_LAYER_MEMBER);
+	prop = RNA_def_property(srna, "layers_ignore", PROP_BOOLEAN, PROP_LAYER_MEMBER);
 	RNA_def_property_boolean_sdna(prop, NULL, "notlay", 1);
 	RNA_def_property_array(prop, 20);
-	RNA_def_property_ui_text(prop, "Ignore Layers", "Hide objects on these layers when generating the Environment Map");
+	RNA_def_property_ui_text(prop, "Ignore Layers",
+	                         "Hide objects on these layers when generating the Environment Map");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "resolution", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "resolution", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "cuberes");
 	RNA_def_property_range(prop, 50, 4096);
 	RNA_def_property_ui_text(prop, "Resolution", "Pixel resolution of the rendered environment map");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_range(prop, 0, 5);
 	RNA_def_property_ui_text(prop, "Depth", "Number of times a map will be rendered recursively (mirror effects)");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "is_valid", PROP_BOOLEAN, 0);
+	prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, 0);
 	RNA_def_property_boolean_sdna(prop, NULL, "ok", 2);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Validity", "True if this map is ready for use, False if it needs rendering");
@@ -830,43 +838,43 @@ static void rna_def_texture_clouds(BlenderRNA *brna)
 	{TEX_COLOR, "COLOR", 0, "Color", ""},
 	{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "CloudsTexture", "Texture");
+	srna = RNA_def_struct(brna, "CloudsTexture", "Texture");
 	RNA_def_struct_ui_text(srna, "Clouds Texture", "Procedural noise texture");
 	RNA_def_struct_sdna(srna, "Tex");
 
-	prop= RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "noisesize");
 	RNA_def_property_range(prop, 0.0001, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
 	RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "noisedepth");
 	RNA_def_property_range(prop, 0, 30);
 	RNA_def_property_ui_range(prop, 0, 24, 0, 2);
 	RNA_def_property_ui_text(prop, "Noise Depth", "Depth of the cloud calculation");
 	RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
 
-	prop= RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
 	RNA_def_property_enum_items(prop, prop_noise_basis_items);
 	RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
 	RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
 
-	prop= RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "noisetype");
 	RNA_def_property_enum_items(prop, prop_noise_type);
 	RNA_def_property_ui_text(prop, "Noise Type", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
 
-	prop= RNA_def_property(srna, "cloud_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "cloud_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "stype");
 	RNA_def_property_enum_items(prop, prop_clouds_stype);
 	RNA_def_property_ui_text(prop, "Color", "Determine whether Noise returns grayscale or RGB values");
 	RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
 
-	prop= RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.001, 0.1);
 	RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
 	RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
@@ -891,49 +899,49 @@ static void rna_def_texture_wood(BlenderRNA *brna)
 	{TEX_TRI, "TRI", 0, "Tri", "Use a triangle wave to produce bands"},
 	{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "WoodTexture", "Texture");
+	srna = RNA_def_struct(brna, "WoodTexture", "Texture");
 	RNA_def_struct_ui_text(srna, "Wood Texture", "Procedural noise texture");
 	RNA_def_struct_sdna(srna, "Tex");
 
-	prop= RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "noisesize");
 	RNA_def_property_range(prop, 0.0001, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
 	RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "turbul");
 	RNA_def_property_range(prop, 0.0001, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.0001, 200, 10, 2);
 	RNA_def_property_ui_text(prop, "Turbulence", "Turbulence of the bandnoise and ringnoise types");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
 	RNA_def_property_enum_items(prop, prop_noise_basis_items);
 	RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
 	RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
 
-	prop= RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "noisetype");
 	RNA_def_property_enum_items(prop, prop_noise_type);
 	RNA_def_property_ui_text(prop, "Noise Type", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
 
-	prop= RNA_def_property(srna, "wood_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "wood_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "stype");
 	RNA_def_property_enum_items(prop, prop_wood_stype);
 	RNA_def_property_ui_text(prop, "Pattern", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
 
-	prop= RNA_def_property(srna, "noise_basis_2", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_basis_2", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "noisebasis2");
 	RNA_def_property_enum_items(prop, prop_wood_noisebasis2);
 	RNA_def_property_ui_text(prop, "Noise Basis 2", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
 
-	prop= RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.001, 0.1);
 	RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
 	RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
@@ -958,56 +966,56 @@ static void rna_def_texture_marble(BlenderRNA *brna)
 	{TEX_TRI, "TRI", 0, "Tri", "Use a triangle wave to produce bands"},
 	{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "MarbleTexture", "Texture");
+	srna = RNA_def_struct(brna, "MarbleTexture", "Texture");
 	RNA_def_struct_ui_text(srna, "Marble Texture", "Procedural noise texture");
 	RNA_def_struct_sdna(srna, "Tex");
 
-	prop= RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "noisesize");
 	RNA_def_property_range(prop, 0.0001, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
 	RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "turbul");
 	RNA_def_property_range(prop, 0.0001, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.0001, 200, 10, 2);
 	RNA_def_property_ui_text(prop, "Turbulence", "Turbulence of the bandnoise and ringnoise types");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "noisedepth");
 	RNA_def_property_range(prop, 0, 30);
 	RNA_def_property_ui_range(prop, 0, 24, 0, 2);
 	RNA_def_property_ui_text(prop, "Noise Depth", "Depth of the cloud calculation");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "noisetype");
 	RNA_def_property_enum_items(prop, prop_noise_type);
 	RNA_def_property_ui_text(prop, "Noise Type", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
 
-	prop= RNA_def_property(srna, "marble_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "marble_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "stype");
 	RNA_def_property_enum_items(prop, prop_marble_stype);
 	RNA_def_property_ui_text(prop, "Pattern", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
 	
-	prop= RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
 	RNA_def_property_enum_items(prop, prop_noise_basis_items);
 	RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
 	RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
 
-	prop= RNA_def_property(srna, "noise_basis_2", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_basis_2", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "noisebasis2");
 	RNA_def_property_enum_items(prop, prop_marble_noisebasis2);
 	RNA_def_property_ui_text(prop, "Noise Basis 2", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
 
-	prop= RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.001, 0.1);
 	RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
 	RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
@@ -1020,18 +1028,18 @@ static void rna_def_texture_magic(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "MagicTexture", "Texture");
+	srna = RNA_def_struct(brna, "MagicTexture", "Texture");
 	RNA_def_struct_ui_text(srna, "Magic Texture", "Procedural noise texture");
 	RNA_def_struct_sdna(srna, "Tex");
 
-	prop= RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "turbul");
 	RNA_def_property_range(prop, 0.0001, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.0001, 200, 10, 2);
 	RNA_def_property_ui_text(prop, "Turbulence", "Turbulence of the noise");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "noisedepth");
 	RNA_def_property_range(prop, 0, 30);
 	RNA_def_property_ui_range(prop, 0, 24, 0, 2);
@@ -1050,26 +1058,27 @@ static void rna_def_texture_blend(BlenderRNA *brna)
 		{TEX_EASE, "EASING", 0, "Easing", "Create a progression easing from one step to the next"},
 		{TEX_DIAG, "DIAGONAL", 0, "Diagonal", "Create a diagonal progression"},
 		{TEX_SPHERE, "SPHERICAL", 0, "Spherical", "Create a spherical progression"},
-		{TEX_HALO, "QUADRATIC_SPHERE", 0, "Quadratic sphere", "Create a quadratic progression in the shape of a sphere"},
+		{TEX_HALO, "QUADRATIC_SPHERE", 0, "Quadratic sphere",
+		           "Create a quadratic progression in the shape of a sphere"},
 		{TEX_RAD, "RADIAL", 0, "Radial", "Create a radial progression"},
 		{0, NULL, 0, NULL, NULL}};
 
-	static const EnumPropertyItem prop_flip_axis_items[]= {
+	static const EnumPropertyItem prop_flip_axis_items[] = {
 		{0, "HORIZONTAL", 0, "Horizontal", "No flipping"},
 		{TEX_FLIPBLEND, "VERTICAL", 0, "Vertical", "Flip the texture's X and Y axis"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "BlendTexture", "Texture");
+	srna = RNA_def_struct(brna, "BlendTexture", "Texture");
 	RNA_def_struct_ui_text(srna, "Blend Texture", "Procedural color blending texture");
 	RNA_def_struct_sdna(srna, "Tex");
 
-	prop= RNA_def_property(srna, "progression", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "progression", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "stype");
 	RNA_def_property_enum_items(prop, prop_blend_progression);
 	RNA_def_property_ui_text(prop, "Progression", "Style of the color blending");
 	RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
 
-	prop= RNA_def_property(srna, "use_flip_axis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "use_flip_axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, prop_flip_axis_items);
 	RNA_def_property_ui_text(prop, "Flip Axis", "Flip the texture's X and Y axis");
@@ -1088,37 +1097,37 @@ static void rna_def_texture_stucci(BlenderRNA *brna)
 	{TEX_WALLOUT, "WALL_OUT", 0, "Wall out", "Create Ridges"},
 	{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "StucciTexture", "Texture");
+	srna = RNA_def_struct(brna, "StucciTexture", "Texture");
 	RNA_def_struct_ui_text(srna, "Stucci Texture", "Procedural noise texture");
 	RNA_def_struct_sdna(srna, "Tex");
 
-	prop= RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "turbul");
 	RNA_def_property_range(prop, 0.0001, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.0001, 200, 10, 2);
 	RNA_def_property_ui_text(prop, "Turbulence", "Turbulence of the noise");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
 	RNA_def_property_enum_items(prop, prop_noise_basis_items);
 	RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "noisesize");
 	RNA_def_property_range(prop, 0.0001, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
 	RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "noisetype");
 	RNA_def_property_enum_items(prop, prop_noise_type);
 	RNA_def_property_ui_text(prop, "Noise Type", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "stucci_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "stucci_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "stype");
 	RNA_def_property_enum_items(prop, prop_stucci_stype);
 	RNA_def_property_ui_text(prop, "Pattern", "");
@@ -1129,7 +1138,7 @@ static void rna_def_texture_noise(BlenderRNA *brna)
 {
 	StructRNA *srna;
 
-	srna= RNA_def_struct(brna, "NoiseTexture", "Texture");
+	srna = RNA_def_struct(brna, "NoiseTexture", "Texture");
 	RNA_def_struct_ui_text(srna, "Noise Texture", "Procedural noise texture");
 	RNA_def_struct_sdna(srna, "Tex");
 }
@@ -1148,89 +1157,89 @@ static void rna_def_texture_image(BlenderRNA *brna)
 		{TEX_CHECKER, "CHECKER", 0, "Checker", "Cause the image to repeat in checker board pattern"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "ImageTexture", "Texture");
+	srna = RNA_def_struct(brna, "ImageTexture", "Texture");
 	RNA_def_struct_ui_text(srna, "Image Texture", "");
 	RNA_def_struct_sdna(srna, "Tex");
 
-	prop= RNA_def_property(srna, "use_interpolation", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_interpolation", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_INTERPOL);
 	RNA_def_property_ui_text(prop, "Interpolation", "Interpolate pixels using selected filter");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
 	/* XXX: I think flip_axis should be a generic Texture property, enabled for all the texture types */
-	prop= RNA_def_property(srna, "use_flip_axis", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_flip_axis", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_IMAROT);
 	RNA_def_property_ui_text(prop, "Flip Axis", "Flip the texture's X and Y axis");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_USEALPHA);
 	RNA_def_property_ui_text(prop, "Use Alpha", "Use the alpha channel information in the image");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "use_calculate_alpha", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_calculate_alpha", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_CALCALPHA);
 	RNA_def_property_ui_text(prop, "Calculate Alpha", "Calculate an alpha channel based on RGB values in the image");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "invert_alpha", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_alpha", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_NEGALPHA);
 	RNA_def_property_ui_text(prop, "Invert Alpha", "Invert all the alpha values in the image");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
 	rna_def_filter_common(srna);
 
-	prop= RNA_def_property(srna, "extension", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "extension", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "extend");
 	RNA_def_property_enum_items(prop, prop_image_extension);
 	RNA_def_property_ui_text(prop, "Extension", "How the image is extrapolated past its original bounds");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "repeat_x", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "repeat_x", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "xrepeat");
 	RNA_def_property_range(prop, 1, 512);
 	RNA_def_property_ui_text(prop, "Repeat X", "Repetition multiplier in the X direction");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "repeat_y", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "repeat_y", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "yrepeat");
 	RNA_def_property_range(prop, 1, 512);
 	RNA_def_property_ui_text(prop, "Repeat Y", "Repetition multiplier in the Y direction");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_REPEAT_XMIR);
 	RNA_def_property_ui_text(prop, "Mirror X", "Mirror the image repetition on the X direction");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "use_mirror_y", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_mirror_y", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_REPEAT_YMIR);
 	RNA_def_property_ui_text(prop, "Mirror Y", "Mirror the image repetition on the Y direction");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "use_checker_odd", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_checker_odd", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_CHECKER_ODD);
 	RNA_def_property_ui_text(prop, "Checker Odd", "Odd checker tiles");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "use_checker_even", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_checker_even", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_CHECKER_EVEN);
 	RNA_def_property_ui_text(prop, "Checker Even", "Even checker tiles");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "checker_distance", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "checker_distance", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "checkerdist");
 	RNA_def_property_range(prop, 0.0, 0.99);
-	RNA_def_property_ui_range(prop, 0.0, 0.99, 0.1, 0.01);
+	RNA_def_property_ui_range(prop, 0.0, 0.99, 0.1, 2);
 	RNA_def_property_ui_text(prop, "Checker Distance", "Distance between checker tiles");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
 #if 0
 
 	/* XXX: did this as an array, but needs better descriptions than "1 2 3 4"
-	perhaps a new subtype could be added? 
-	--I actually used single values for this, maybe change later with a RNA_Rect thing? */
-	prop= RNA_def_property(srna, "crop_rectangle", PROP_FLOAT, PROP_NONE);
+	 * perhaps a new subtype could be added?
+	 * --I actually used single values for this, maybe change later with a RNA_Rect thing? */
+	prop = RNA_def_property(srna, "crop_rectangle", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "cropxmin");
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_range(prop, -10, 10);
@@ -1239,54 +1248,55 @@ static void rna_def_texture_image(BlenderRNA *brna)
 
 #endif
 
-	prop= RNA_def_property(srna, "crop_min_x", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "crop_min_x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "cropxmin");
 	RNA_def_property_range(prop, -10.0, 10.0);
-	RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 0.2);
+	RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Crop Minimum X", "Minimum X value to crop the image");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "crop_min_y", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "crop_min_y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "cropymin");
 	RNA_def_property_range(prop, -10.0, 10.0);
-	RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 0.2);
+	RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Crop Minimum Y", "Minimum Y value to crop the image");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "crop_max_x", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "crop_max_x", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "cropxmax");
 	RNA_def_property_range(prop, -10.0, 10.0);
-	RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 0.2);
+	RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Crop Maximum X", "Maximum X value to crop the image");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "crop_max_y", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "crop_max_y", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "cropymax");
 	RNA_def_property_range(prop, -10.0, 10.0);
-	RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 0.2);
+	RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 2);
 	RNA_def_property_ui_text(prop, "Crop Maximum Y", "Maximum Y value to crop the image");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "ima");
 	RNA_def_property_struct_type(prop, "Image");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Image", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NEVER_NULL);
+	prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "iuser");
-	RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed");
+	RNA_def_property_ui_text(prop, "Image User",
+	                         "Parameters defining which layer, pass and frame of the image is displayed");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
 	/* Normal Map */
-	prop= RNA_def_property(srna, "use_normal_map", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_normal_map", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_NORMALMAP);
 	RNA_def_property_ui_text(prop, "Normal Map", "Use image RGB values for normal mapping");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
 	/* Derivative Map */
-	prop= RNA_def_property(srna, "use_derivative_map", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_derivative_map", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_DERIVATIVEMAP);
 	RNA_def_property_ui_text(prop, "Derivative Map", "Use red and green as derivative values");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
@@ -1296,7 +1306,7 @@ static void rna_def_texture_plugin(BlenderRNA *brna)
 {
 	StructRNA *srna;
 
-	srna= RNA_def_struct(brna, "PluginTexture", "Texture");
+	srna = RNA_def_struct(brna, "PluginTexture", "Texture");
 	RNA_def_struct_ui_text(srna, "Plugin", "External plugin texture");
 	RNA_def_struct_sdna(srna, "Tex");
 
@@ -1308,25 +1318,26 @@ static void rna_def_texture_environment_map(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "EnvironmentMapTexture", "Texture");
+	srna = RNA_def_struct(brna, "EnvironmentMapTexture", "Texture");
 	RNA_def_struct_ui_text(srna, "Environment Map", "Environment map texture");
 	RNA_def_struct_sdna(srna, "Tex");
 
-	prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "ima");
 	RNA_def_property_struct_type(prop, "Image");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Image", "Source image file to read the environment map from");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NEVER_NULL);
+	prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "iuser");
-	RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed");
+	RNA_def_property_ui_text(prop, "Image User",
+	                         "Parameters defining which layer, pass and frame of the image is displayed");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
 	rna_def_filter_common(srna);
 	
-	prop= RNA_def_property(srna, "environment_map", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "environment_map", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "env");
 	RNA_def_property_struct_type(prop, "EnvironmentMap");
 	RNA_def_property_ui_text(prop, "Environment Map", "Get the environment map associated with this texture");
@@ -1348,66 +1359,66 @@ static void rna_def_texture_musgrave(BlenderRNA *brna)
 		{TEX_HTERRAIN, "HETERO_TERRAIN", 0, "Hetero Terrain", "Similar to multifractal"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "MusgraveTexture", "Texture");
+	srna = RNA_def_struct(brna, "MusgraveTexture", "Texture");
 	RNA_def_struct_ui_text(srna, "Musgrave", "Procedural musgrave texture");
 	RNA_def_struct_sdna(srna, "Tex");
 
-	prop= RNA_def_property(srna, "musgrave_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "musgrave_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "stype");
 	RNA_def_property_enum_items(prop, prop_musgrave_type);
 	RNA_def_property_ui_text(prop, "Type", "Fractal noise algorithm");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "dimension_max", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "dimension_max", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "mg_H");
 	RNA_def_property_range(prop, 0.0001, 2);
 	RNA_def_property_ui_text(prop, "Highest Dimension", "Highest fractal dimension");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "lacunarity", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "lacunarity", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "mg_lacunarity");
 	RNA_def_property_range(prop, 0, 6);
 	RNA_def_property_ui_text(prop, "Lacunarity", "Gap between successive frequencies");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "octaves", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "octaves", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "mg_octaves");
 	RNA_def_property_range(prop, 0, 8);
 	RNA_def_property_ui_text(prop, "Octaves", "Number of frequencies used");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "mg_offset");
 	RNA_def_property_range(prop, 0, 6);
 	RNA_def_property_ui_text(prop, "Offset", "The fractal offset");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "gain", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "mg_gain");
 	RNA_def_property_range(prop, 0, 6);
 	RNA_def_property_ui_text(prop, "Gain", "The gain multiplier");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "noise_intensity", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_intensity", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "ns_outscale");
 	RNA_def_property_range(prop, 0, 10);
 	RNA_def_property_ui_text(prop, "Noise Intensity", "Intensity of the noise");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "noisesize");
 	RNA_def_property_range(prop, 0.0001, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
 	RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
 	RNA_def_property_enum_items(prop, prop_noise_basis_items);
 	RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.001, 0.1);
 	RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
 	RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
@@ -1444,66 +1455,67 @@ static void rna_def_texture_voronoi(BlenderRNA *brna)
 		           "Multiply position and outline by intensity"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "VoronoiTexture", "Texture");
+	srna = RNA_def_struct(brna, "VoronoiTexture", "Texture");
 	RNA_def_struct_ui_text(srna, "Voronoi", "Procedural voronoi texture");
 	RNA_def_struct_sdna(srna, "Tex");
 
-	prop= RNA_def_property(srna, "weight_1", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "weight_1", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "vn_w1");
 	RNA_def_property_range(prop, -2, 2);
 	RNA_def_property_ui_text(prop, "Weight 1", "Voronoi feature weight 1");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "weight_2", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "weight_2", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "vn_w2");
 	RNA_def_property_range(prop, -2, 2);
 	RNA_def_property_ui_text(prop, "Weight 2", "Voronoi feature weight 2");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "weight_3", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "weight_3", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "vn_w3");
 	RNA_def_property_range(prop, -2, 2);
 	RNA_def_property_ui_text(prop, "Weight 3", "Voronoi feature weight 3");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "weight_4", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "weight_4", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "vn_w4");
 	RNA_def_property_range(prop, -2, 2);
 	RNA_def_property_ui_text(prop, "Weight 4", "Voronoi feature weight 4");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "minkovsky_exponent", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "minkovsky_exponent", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "vn_mexp");
 	RNA_def_property_range(prop, 0.01, 10);
 	RNA_def_property_ui_text(prop, "Minkovsky Exponent", "Minkovsky exponent");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "distance_metric", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "distance_metric", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "vn_distm");
 	RNA_def_property_enum_items(prop, prop_distance_metric_items);
-	RNA_def_property_ui_text(prop, "Distance Metric", "Algorithm used to calculate distance of sample points to feature points");
+	RNA_def_property_ui_text(prop, "Distance Metric",
+	                         "Algorithm used to calculate distance of sample points to feature points");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "vn_coltype");
 	RNA_def_property_enum_items(prop, prop_coloring_items);
 	RNA_def_property_ui_text(prop, "Coloring", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "noise_intensity", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_intensity", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "ns_outscale");
 	RNA_def_property_range(prop, 0.01, 10);
 	RNA_def_property_ui_text(prop, "Noise Intensity", "Scales the intensity of the noise");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "noisesize");
 	RNA_def_property_range(prop, 0.0001, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
 	RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.001, 0.1);
 	RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
 	RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
@@ -1515,36 +1527,36 @@ static void rna_def_texture_distorted_noise(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "DistortedNoiseTexture", "Texture");
+	srna = RNA_def_struct(brna, "DistortedNoiseTexture", "Texture");
 	RNA_def_struct_ui_text(srna, "Distorted Noise", "Procedural distorted noise texture");
 	RNA_def_struct_sdna(srna, "Tex");
 
-	prop= RNA_def_property(srna, "distortion", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "distortion", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "dist_amount");
 	RNA_def_property_range(prop, 0, 10);
 	RNA_def_property_ui_text(prop, "Distortion Amount", "Amount of distortion");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "noisesize");
 	RNA_def_property_range(prop, 0.0001, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
 	RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "noisebasis2");
 	RNA_def_property_enum_items(prop, prop_noise_basis_items);
 	RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
 	RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
 
-	prop= RNA_def_property(srna, "noise_distortion", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_distortion", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
 	RNA_def_property_enum_items(prop, prop_noise_basis_items);
 	RNA_def_property_ui_text(prop, "Noise Distortion", "Noise basis for the distortion");
 	RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
 
-	prop= RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.001, 0.1);
 	RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
 	RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
@@ -1559,7 +1571,7 @@ static void rna_def_texture_pointdensity(BlenderRNA *brna)
 	static EnumPropertyItem point_source_items[] = {
 		{TEX_PD_PSYS, "PARTICLE_SYSTEM", 0, "Particle System", "Generate point density from a particle system"},
 		{TEX_PD_OBJECT, "OBJECT", 0, "Object Vertices", "Generate point density from an object's vertices"},
-		//{TEX_PD_FILE, "FILE", 0 , "File", ""},
+		/*{TEX_PD_FILE, "FILE", 0 , "File", ""}, */
 		{0, NULL, 0, NULL, NULL}};
 	
 	static EnumPropertyItem particle_cache_items[] = {
@@ -1593,144 +1605,146 @@ static void rna_def_texture_pointdensity(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}};
 	
 	static EnumPropertyItem turbulence_influence_items[] = {
-		{TEX_PD_NOISE_STATIC, "STATIC", 0, "Static", "Noise patterns will remain unchanged, faster and suitable for stills"},
-		{TEX_PD_NOISE_VEL, "PARTICLE_VELOCITY", 0, "Particle Velocity", "Turbulent noise driven by particle velocity"},
+		{TEX_PD_NOISE_STATIC, "STATIC", 0, "Static",
+		                      "Noise patterns will remain unchanged, faster and suitable for stills"},
+		{TEX_PD_NOISE_VEL, "PARTICLE_VELOCITY", 0, "Particle Velocity",
+		                   "Turbulent noise driven by particle velocity"},
 		{TEX_PD_NOISE_AGE, "PARTICLE_AGE", 0, "Particle Age",
 		                   "Turbulent noise driven by the particle's age between birth and death"},
 		{TEX_PD_NOISE_TIME, "GLOBAL_TIME", 0, "Global Time", "Turbulent noise driven by the global current frame"},
 		{0, NULL, 0, NULL, NULL}};
 	
-	srna= RNA_def_struct(brna, "PointDensity", NULL);
+	srna = RNA_def_struct(brna, "PointDensity", NULL);
 	RNA_def_struct_sdna(srna, "PointDensity");
 	RNA_def_struct_ui_text(srna, "PointDensity", "Point density settings");
 	RNA_def_struct_path_func(srna, "rna_PointDensity_path");
 	
-	prop= RNA_def_property(srna, "point_source", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "point_source", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "source");
 	RNA_def_property_enum_items(prop, point_source_items);
 	RNA_def_property_ui_text(prop, "Point Source", "Point data to use as renderable point density");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "object");
 	RNA_def_property_ui_text(prop, "Object", "Object to take point data from");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Particle System", "Particle System to render as points");
 	RNA_def_property_struct_type(prop, "ParticleSystem");
 	RNA_def_property_pointer_funcs(prop, "rna_PointDensity_psys_get", "rna_PointDensity_psys_set", NULL, NULL);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "particle_cache_space", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "particle_cache_space", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "psys_cache_space");
 	RNA_def_property_enum_items(prop, particle_cache_items);
 	RNA_def_property_ui_text(prop, "Particle Cache", "Coordinate system to cache particles in");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "vertex_cache_space", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "vertex_cache_space", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "ob_cache_space");
 	RNA_def_property_enum_items(prop, vertice_cache_items);
 	RNA_def_property_ui_text(prop, "Vertices Cache", "Coordinate system to cache vertices in");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "radius");
 	RNA_def_property_range(prop, 0.001, FLT_MAX);
 	RNA_def_property_ui_text(prop, "Radius", "Radius from the shaded sample to look for points within");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "falloff_type");
 	RNA_def_property_enum_items(prop, falloff_items);
 	RNA_def_property_ui_text(prop, "Falloff", "Method of attenuating density by distance from the point");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "falloff_soft", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "falloff_soft", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "falloff_softness");
 	RNA_def_property_range(prop, 0.01, FLT_MAX);
 	RNA_def_property_ui_text(prop, "Softness", "Softness of the 'soft' falloff option");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "color_source", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "color_source", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "color_source");
 	RNA_def_property_enum_items(prop, color_source_items);
 	RNA_def_property_ui_text(prop, "Color Source", "Data to derive color results from");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "speed_scale", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "speed_scale", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "speed_scale");
 	RNA_def_property_range(prop, 0.001, 100.0);
 	RNA_def_property_ui_text(prop, "Scale", "Multiplier to bring particle speed within an acceptable range");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "falloff_speed_scale", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "falloff_speed_scale", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "falloff_speed_scale");
 	RNA_def_property_range(prop, 0.001, 100.0);
 	RNA_def_property_ui_text(prop, "Velocity Scale", "Multiplier to bring particle speed within an acceptable range");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
 	
-	prop= RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL);
+	prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "coba");
 	RNA_def_property_struct_type(prop, "ColorRamp");
 	RNA_def_property_ui_text(prop, "Color Ramp", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NEVER_NULL);
+	prop = RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "falloff_curve");
 	RNA_def_property_struct_type(prop, "CurveMapping");
 	RNA_def_property_ui_text(prop, "Falloff Curve", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "use_falloff_curve", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_falloff_curve", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_PD_FALLOFF_CURVE);
 	RNA_def_property_ui_text(prop, "Falloff Curve", "Use a custom falloff curve");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
 	/* Turbulence */
-	prop= RNA_def_property(srna, "use_turbulence", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_turbulence", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_PD_TURBULENCE);
 	RNA_def_property_ui_text(prop, "Turbulence", "Add directed noise to the density at render-time");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "turbulence_scale", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "turbulence_scale", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "noise_size");
 	RNA_def_property_range(prop, 0.01, FLT_MAX);
 	RNA_def_property_ui_text(prop, "Size", "Scale of the added turbulent noise");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "turbulence_strength", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "turbulence_strength", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "noise_fac");
 	RNA_def_property_range(prop, 0.01, FLT_MAX);
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "turbulence_depth", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "turbulence_depth", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "noise_depth");
 	RNA_def_property_range(prop, 0, 30);
 	RNA_def_property_ui_text(prop, "Depth", "Level of detail in the added turbulent noise");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "turbulence_influence", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "turbulence_influence", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "noise_influence");
 	RNA_def_property_enum_items(prop, turbulence_influence_items);
 	RNA_def_property_ui_text(prop, "Turbulence Influence", "Method for driving added turbulent noise");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "noise_basis");
 	RNA_def_property_enum_items(prop, prop_noise_basis_items);
 	RNA_def_property_ui_text(prop, "Noise Basis", "Noise formula used for turbulence");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
 
-	srna= RNA_def_struct(brna, "PointDensityTexture", "Texture");
+	srna = RNA_def_struct(brna, "PointDensityTexture", "Texture");
 	RNA_def_struct_sdna(srna, "Tex");
 	RNA_def_struct_ui_text(srna, "Point Density", "Settings for the Point Density texture");
 	
-	prop= RNA_def_property(srna, "point_density", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "point_density", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "pd");
 	RNA_def_property_struct_type(prop, "PointDensity");
 	RNA_def_property_ui_text(prop, "Point Density", "The point density settings associated with this texture");
@@ -1743,18 +1757,21 @@ static void rna_def_texture_voxeldata(BlenderRNA *brna)
 	PropertyRNA *prop;
 	
 	static EnumPropertyItem interpolation_type_items[] = {
-		{TEX_VD_NEARESTNEIGHBOR, "NEREASTNEIGHBOR", 0, "Nearest Neighbor", "No interpolation, fast but blocky and low quality"},
+		{TEX_VD_NEARESTNEIGHBOR, "NEREASTNEIGHBOR", 0, "Nearest Neighbor",
+		                         "No interpolation, fast but blocky and low quality"},
 		{TEX_VD_LINEAR, "TRILINEAR", 0, "Linear", "Good smoothness and speed"},
 		{TEX_VD_QUADRATIC, "QUADRATIC", 0, "Quadratic", "Mid-range quality and speed"},
 		{TEX_VD_TRICUBIC_CATROM, "TRICUBIC_CATROM", 0, "Cubic Catmull-Rom", "High quality interpolation, but slower"},
-		{TEX_VD_TRICUBIC_BSPLINE, "TRICUBIC_BSPLINE", 0, "Cubic B-Spline", "Smoothed high quality interpolation, but slower"},
+		{TEX_VD_TRICUBIC_BSPLINE, "TRICUBIC_BSPLINE", 0, "Cubic B-Spline",
+		                          "Smoothed high quality interpolation, but slower"},
 		{0, NULL, 0, NULL, NULL}};
 
 	static EnumPropertyItem file_format_items[] = {
 		{TEX_VD_BLENDERVOXEL, "BLENDER_VOXEL", 0, "Blender Voxel", "Default binary voxel file format"},
 		{TEX_VD_RAW_8BIT, "RAW_8BIT", 0, "8 bit RAW", "8 bit greyscale binary data"},
-		//{TEX_VD_RAW_16BIT, "RAW_16BIT", 0, "16 bit RAW", ""},
-		{TEX_VD_IMAGE_SEQUENCE, "IMAGE_SEQUENCE", 0, "Image Sequence", "Generate voxels from a sequence of image slices"},
+		/*{TEX_VD_RAW_16BIT, "RAW_16BIT", 0, "16 bit RAW", ""}, */
+		{TEX_VD_IMAGE_SEQUENCE, "IMAGE_SEQUENCE", 0, "Image Sequence",
+		                        "Generate voxels from a sequence of image slices"},
 		{TEX_VD_SMOKE, "SMOKE", 0, "Smoke", "Render voxels from a Blender smoke simulation"},
 		{0, NULL, 0, NULL, NULL}};
 	
@@ -1770,90 +1787,91 @@ static void rna_def_texture_voxeldata(BlenderRNA *brna)
 		{TEX_VD_SMOKEVEL, "SMOKEVEL", 0, "Velocity", "Use smoke velocity as texture data"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "VoxelData", NULL);
+	srna = RNA_def_struct(brna, "VoxelData", NULL);
 	RNA_def_struct_sdna(srna, "VoxelData");
 	RNA_def_struct_ui_text(srna, "VoxelData", "Voxel data settings");
 	RNA_def_struct_path_func(srna, "rna_VoxelData_path");
 	
-	prop= RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "interp_type");
 	RNA_def_property_enum_items(prop, interpolation_type_items);
 	RNA_def_property_ui_text(prop, "Interpolation", "Method to interpolate/smooth values between voxel cells");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "smoke_data_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "smoke_data_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "smoked_type");
 	RNA_def_property_enum_items(prop, smoked_type_items);
 	RNA_def_property_ui_text(prop, "Source", "Simulation value to be used as a texture");
 	RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
 	
-	prop= RNA_def_property(srna, "extension", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "extension", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "extend");
 	RNA_def_property_enum_items(prop, voxeldata_extension);
 	RNA_def_property_ui_text(prop, "Extension", "How the texture is extrapolated past its original bounds");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "int_multiplier");
 	RNA_def_property_range(prop, 0.01, FLT_MAX);
 	RNA_def_property_ui_text(prop, "Intensity", "Multiplier for intensity values");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "file_format");
 	RNA_def_property_enum_items(prop, file_format_items);
 	RNA_def_property_ui_text(prop, "File Format", "Format of the source data set to render	");
 	RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
 	
-	prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+	prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
 	RNA_def_property_string_sdna(prop, NULL, "source_path");
 	RNA_def_property_ui_text(prop, "Source Path", "The external source data file to use");
 	RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
 	
-	prop= RNA_def_property(srna, "resolution", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "resolution", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "resol");
 	RNA_def_property_range(prop, 1, 100000);
 	RNA_def_property_ui_text(prop, "Resolution", "Resolution of the voxel grid");
 	RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
 	
-	prop= RNA_def_property(srna, "use_still_frame", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_still_frame", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_VD_STILL);
 	RNA_def_property_ui_text(prop, "Still Frame Only", "Always render a still frame from the voxel data sequence");
 	RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
 	
-	prop= RNA_def_property(srna, "still_frame", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "still_frame", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "still_frame");
 	RNA_def_property_range(prop, -MAXFRAME, MAXFRAME);
 	RNA_def_property_ui_text(prop, "Still Frame Number", "The frame number to always use");
 	RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
 	
-	prop= RNA_def_property(srna, "domain_object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "domain_object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "object");
 	RNA_def_property_ui_text(prop, "Domain Object", "Object used as the smoke simulation domain");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
 
 	
-	srna= RNA_def_struct(brna, "VoxelDataTexture", "Texture");
+	srna = RNA_def_struct(brna, "VoxelDataTexture", "Texture");
 	RNA_def_struct_sdna(srna, "Tex");
 	RNA_def_struct_ui_text(srna, "Voxel Data", "Settings for the Voxel Data texture");
 	
-	prop= RNA_def_property(srna, "voxel_data", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "voxel_data", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "vd");
 	RNA_def_property_struct_type(prop, "VoxelData");
 	RNA_def_property_ui_text(prop, "Voxel Data", "The voxel data associated with this texture");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "ima");
 	RNA_def_property_struct_type(prop, "Image");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Image", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_image_update");
 	
-	prop= RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NEVER_NULL);
+	prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "iuser");
-	RNA_def_property_ui_text(prop, "Image User", "Parameters defining which layer, pass and frame of the image is displayed");
+	RNA_def_property_ui_text(prop, "Image User",
+	                         "Parameters defining which layer, pass and frame of the image is displayed");
 	RNA_def_property_update(prop, 0, "rna_Texture_voxeldata_update");
 }
 
@@ -1864,36 +1882,36 @@ static void rna_def_texture_ocean(BlenderRNA *brna)
 	
 	static EnumPropertyItem ocean_output_items[] = {
 		{TEX_OCN_DISPLACEMENT, "DISPLACEMENT", 0, "Displacement", "Output XYZ displacement in RGB channels"},
-		//{TEX_OCN_NORMALS, "NORMALS", 0, "Normals", "Outputs wave normals"},	// these are in nor channel now
+		/*{TEX_OCN_NORMALS, "NORMALS", 0, "Normals", "Outputs wave normals"},	 *//* these are in nor channel now */
 		{TEX_OCN_FOAM, "FOAM", 0, "Foam", "Output Foam (wave overlap) amount in single channel"},
 		{TEX_OCN_JPLUS, "JPLUS", 0, "Eigenvalues", "Positive Eigenvalues"},
 		{TEX_OCN_EMINUS, "EMINUS", 0, "Eigenvectors (-)", "Negative Eigenvectors"},
 		{TEX_OCN_EPLUS, "EPLUS", 0, "Eigenvectors (+)", "Positive Eigenvectors"},
 		{0, NULL, 0, NULL, NULL}};
 	
-	srna= RNA_def_struct(brna, "OceanTexData", NULL);
+	srna = RNA_def_struct(brna, "OceanTexData", NULL);
 	RNA_def_struct_sdna(srna, "OceanTex");
 	RNA_def_struct_ui_text(srna, "Ocean", "Ocean Texture settings");
 	RNA_def_struct_path_func(srna, "rna_OceanTex_path");
 	
-	prop= RNA_def_property(srna, "output", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "output", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "output");
 	RNA_def_property_enum_items(prop, ocean_output_items);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Output", "The data that is output by the texture");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "ocean_object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "ocean_object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "object");
 	RNA_def_property_ui_text(prop, "Modifier Object", "Object containing the ocean modifier");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	srna= RNA_def_struct(brna, "OceanTexture", "Texture");
+	srna = RNA_def_struct(brna, "OceanTexture", "Texture");
 	RNA_def_struct_sdna(srna, "Tex");
 	RNA_def_struct_ui_text(srna, "Ocean", "Settings for the Ocean texture");
 	
-	prop= RNA_def_property(srna, "ocean", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "ocean", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "ot");
 	RNA_def_property_struct_type(prop, "OceanTexData");
 	RNA_def_property_ui_text(prop, "Ocean", "The ocean data associated with this texture");
@@ -1905,81 +1923,81 @@ static void rna_def_texture(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "Texture", "ID");
+	srna = RNA_def_struct(brna, "Texture", "ID");
 	RNA_def_struct_sdna(srna, "Tex");
 	RNA_def_struct_ui_text(srna, "Texture", "Texture datablock used by materials, lamps, worlds and brushes");
 	RNA_def_struct_ui_icon(srna, ICON_TEXTURE_DATA);
 	RNA_def_struct_refine_func(srna, "rna_Texture_refine");
 
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
-	//RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	/*RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, texture_type_items);
 	RNA_def_property_enum_funcs(prop, NULL, "rna_Texture_type_set", NULL);
 	RNA_def_property_ui_text(prop, "Type", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "use_color_ramp", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_color_ramp", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_COLORBAND);
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_Texture_use_color_ramp_set");
 	RNA_def_property_ui_text(prop, "Use Color Ramp", "Toggle color ramp operations");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL);
+	prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "coba");
 	RNA_def_property_struct_type(prop, "ColorRamp");
 	RNA_def_property_ui_text(prop, "Color Ramp", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "bright");
 	RNA_def_property_range(prop, 0, 2);
 	RNA_def_property_ui_text(prop, "Brightness", "Adjust the brightness of the texture");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.01, 5);
 	RNA_def_property_ui_text(prop, "Contrast", "Adjust the contrast of the texture");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 
-	prop= RNA_def_property(srna, "saturation", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "saturation", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0, 2);
 	RNA_def_property_ui_text(prop, "Saturation", "Adjust the saturation of colors in the texture");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
 	/* RGB Factor */
-	prop= RNA_def_property(srna, "factor_red", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "factor_red", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "rfac");
 	RNA_def_property_range(prop, 0, 2);
 	RNA_def_property_ui_text(prop, "Factor Red", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "factor_green", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "factor_green", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "gfac");
 	RNA_def_property_range(prop, 0, 2);
 	RNA_def_property_ui_text(prop, "Factor Green", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
-	prop= RNA_def_property(srna, "factor_blue", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "factor_blue", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "bfac");
 	RNA_def_property_range(prop, 0, 2);
 	RNA_def_property_ui_text(prop, "Factor Blue", "");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
 	/* Alpha for preview render */
-	prop= RNA_def_property(srna, "use_preview_alpha", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_preview_alpha", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_PRV_ALPHA);
 	RNA_def_property_ui_text(prop, "Show Alpha", "Show Alpha in Preview Render");
 	RNA_def_property_update(prop, 0, "rna_Texture_update");
 	
 	/* nodetree */
-	prop= RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1);
 	RNA_def_property_boolean_funcs(prop, NULL, "rna_Texture_use_nodes_set");
 	RNA_def_property_ui_text(prop, "Use Nodes", "Make this a node-based texture");
 	RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
 	
-	prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
 	RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node-based textures");
 	RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
diff --git a/source/blender/makesrna/intern/rna_texture_api.c b/source/blender/makesrna/intern/rna_texture_api.c
index 88ea78c..034696b 100644
--- a/source/blender/makesrna/intern/rna_texture_api.c
+++ b/source/blender/makesrna/intern/rna_texture_api.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
@@ -43,7 +43,8 @@
 #include "RE_pipeline.h"
 #include "RE_shader_ext.h"
 
-void save_envmap(struct EnvMap *env, bContext *C, ReportList *reports, const char* filepath, struct Scene *scene, float layout[12])
+void save_envmap(struct EnvMap *env, bContext *C, ReportList *reports, const char* filepath,
+                 struct Scene *scene, float layout[12])
 {
 	if (scene == NULL) {
 		scene = CTX_data_scene(C);
@@ -59,7 +60,7 @@ void clear_envmap(struct EnvMap *env, bContext *C)
 
 	BKE_free_envmapdata(env);
 	
-	for (tex=bmain->tex.first; tex; tex=tex->id.next)
+	for (tex = bmain->tex.first; tex; tex = tex->id.next)
 		if (tex->env == env) {
 			WM_event_add_notifier(C, NC_TEXTURE|NA_EDITED, tex);
 			break;
@@ -68,7 +69,7 @@ void clear_envmap(struct EnvMap *env, bContext *C)
 
 void texture_evaluate(struct Tex *tex, float value[3], float color_r[4])
 {
-	TexResult texres= {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
+	TexResult texres = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
 	multitex_ext(tex, value, NULL, NULL, 1, &texres);
 
 	color_r[0] = texres.tr;
@@ -84,14 +85,14 @@ void RNA_api_texture(StructRNA *srna)
 	FunctionRNA *func;
 	PropertyRNA *parm;
 
-	func= RNA_def_function(srna, "evaluate", "texture_evaluate");
+	func = RNA_def_function(srna, "evaluate", "texture_evaluate");
 	RNA_def_function_ui_description(func, "Evaluate the texture at the coordinates given");
 
-	parm= RNA_def_float_vector(func, "value", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
+	parm = RNA_def_float_vector(func, "value", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
 	/* return location and normal */
-	parm= RNA_def_float_vector(func, "result", 4, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
+	parm = RNA_def_float_vector(func, "result", 4, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
 	RNA_def_property_flag(parm, PROP_THICK_WRAP);
 	RNA_def_function_output(func, parm);
 
@@ -104,16 +105,16 @@ void RNA_api_environment_map(StructRNA *srna)
 
 	static const float default_layout[] = { 0,0, 1,0, 2,0, 0,1, 1,1, 2,1 };
 
-	func= RNA_def_function(srna, "clear", "clear_envmap");
+	func = RNA_def_function(srna, "clear", "clear_envmap");
 	RNA_def_function_ui_description(func, "Discard the environment map and free it from memory");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
 
 
-	func= RNA_def_function(srna,"save", "save_envmap");
+	func = RNA_def_function(srna,"save", "save_envmap");
 	RNA_def_function_ui_description(func, "Save the environment map to disc using the scene render settings");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
 
-	parm= RNA_def_string_file_name(func,"filepath","",FILE_MAX,"File path","Location of the output file");
+	parm = RNA_def_string_file_name(func,"filepath","",FILE_MAX,"File path","Location of the output file");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
 	RNA_def_pointer(func, "scene", "Scene", "", "Overrides the scene from which image parameters are taken");
diff --git a/source/blender/makesrna/intern/rna_timeline.c b/source/blender/makesrna/intern/rna_timeline.c
index 1dba222..a33e415 100644
--- a/source/blender/makesrna/intern/rna_timeline.c
+++ b/source/blender/makesrna/intern/rna_timeline.c
@@ -37,6 +37,14 @@
 
 #ifdef RNA_RUNTIME
 
+#include "WM_api.h"
+
+static void rna_TimelineMarker_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+{
+	WM_main_add_notifier(NC_SCENE|ND_MARKERS, NULL);
+	WM_main_add_notifier(NC_ANIMATION|ND_MARKERS, NULL);
+}
+
 #else
 
 static void rna_def_timeline_marker(BlenderRNA *brna)
@@ -44,27 +52,27 @@ static void rna_def_timeline_marker(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "TimelineMarker", NULL);
+	srna = RNA_def_struct(brna, "TimelineMarker", NULL);
 	RNA_def_struct_sdna(srna, "TimeMarker");
 	RNA_def_struct_ui_text(srna, "Marker", "Marker for noting points in the timeline");
 
 	/* String values */
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Name", "");
 	RNA_def_struct_name_property(srna, prop);
-	RNA_def_property_update(prop, NC_ANIMATION, NULL);
+	RNA_def_property_update(prop, 0, "rna_TimelineMarker_update");
 
-	prop= RNA_def_property(srna, "frame", PROP_INT, PROP_TIME);
+	prop = RNA_def_property(srna, "frame", PROP_INT, PROP_TIME);
 	RNA_def_property_ui_text(prop, "Frame", "The frame on which the timeline marker appears");
-	RNA_def_property_update(prop, NC_ANIMATION, NULL);
+	RNA_def_property_update(prop, 0, "rna_TimelineMarker_update");
 
-	prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", 1 /*SELECT*/);
 	RNA_def_property_ui_text(prop, "Select", "Marker selection state");
-	RNA_def_property_update(prop, NC_ANIMATION, NULL);
+	RNA_def_property_update(prop, 0, "rna_TimelineMarker_update");
 
 #ifdef DURIAN_CAMERA_SWITCH
-	prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_ID_SELF_CHECK);
 	RNA_def_property_ui_text(prop, "Camera", "Camera this timeline sets to active");
diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c
index aff8a85..c3a46c3 100644
--- a/source/blender/makesrna/intern/rna_tracking.c
+++ b/source/blender/makesrna/intern/rna_tracking.c
@@ -54,120 +54,132 @@
 
 #include "WM_api.h"
 
-static void rna_tracking_defaultSettings_levelsUpdate(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
+static char *rna_tracking_path(PointerRNA *UNUSED(ptr))
 {
-	MovieClip *clip= (MovieClip*)ptr->id.data;
-	MovieTracking *tracking= &clip->tracking;
-	MovieTrackingSettings *settings= &tracking->settings;
+	return BLI_sprintfN("tracking");
+}
+
+static void rna_tracking_defaultSettings_levelsUpdate(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+	MovieClip *clip = (MovieClip*)ptr->id.data;
+	MovieTracking *tracking = &clip->tracking;
+	MovieTrackingSettings *settings = &tracking->settings;
 
-	if(settings->default_tracker==TRACKER_KLT) {
-		int max_pyramid_level_factor= 1 << (settings->default_pyramid_levels - 1);
-		float search_ratio= 2.3f * max_pyramid_level_factor;
+	if (settings->default_tracker == TRACKER_KLT) {
+		int max_pyramid_level_factor = 1 << (settings->default_pyramid_levels - 1);
+		float search_ratio = 2.3f * max_pyramid_level_factor;
 
-		settings->default_search_size= settings->default_pattern_size*search_ratio;
+		settings->default_search_size = settings->default_pattern_size*search_ratio;
 	}
 }
 
-static void rna_tracking_defaultSettings_patternUpdate(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
+static void rna_tracking_defaultSettings_patternUpdate(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+	MovieClip *clip = (MovieClip*)ptr->id.data;
+	MovieTracking *tracking = &clip->tracking;
+	MovieTrackingSettings *settings = &tracking->settings;
+
+	if (settings->default_search_size<settings->default_pattern_size)
+		settings->default_search_size = settings->default_pattern_size;
+}
+
+static void rna_tracking_defaultSettings_searchUpdate(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	MovieClip *clip= (MovieClip*)ptr->id.data;
-	MovieTracking *tracking= &clip->tracking;
-	MovieTrackingSettings *settings= &tracking->settings;
+	MovieClip *clip = (MovieClip*)ptr->id.data;
+	MovieTracking *tracking = &clip->tracking;
+	MovieTrackingSettings *settings = &tracking->settings;
 
-	if(settings->default_search_size<settings->default_pattern_size)
-		settings->default_search_size= settings->default_pattern_size;
+	if (settings->default_pattern_size>settings->default_search_size)
+		settings->default_pattern_size = settings->default_search_size;
 }
 
-static void rna_tracking_defaultSettings_searchUpdate(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
+static char *rna_trackingTrack_path(PointerRNA *ptr)
 {
-	MovieClip *clip= (MovieClip*)ptr->id.data;
-	MovieTracking *tracking= &clip->tracking;
-	MovieTrackingSettings *settings= &tracking->settings;
+	MovieTrackingTrack *track = (MovieTrackingTrack *) ptr->data;
 
-	if(settings->default_pattern_size>settings->default_search_size)
-		settings->default_pattern_size= settings->default_search_size;
+	return BLI_sprintfN("tracking.tracks[\"%s\"]", track->name);
 }
 
 static void rna_trackingTracks_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	MovieClip *clip= (MovieClip*)ptr->id.data;
+	MovieClip *clip = (MovieClip*)ptr->id.data;
 
 	rna_iterator_listbase_begin(iter, &clip->tracking.tracks, NULL);
 }
 
 static void rna_trackingObjects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	MovieClip *clip= (MovieClip*)ptr->id.data;
+	MovieClip *clip = (MovieClip*)ptr->id.data;
 
 	rna_iterator_listbase_begin(iter, &clip->tracking.objects, NULL);
 }
 
 static int rna_tracking_active_object_index_get(PointerRNA *ptr)
 {
-	MovieClip *clip= (MovieClip*)ptr->id.data;
+	MovieClip *clip = (MovieClip*)ptr->id.data;
 
 	return clip->tracking.objectnr;
 }
 
 static void rna_tracking_active_object_index_set(PointerRNA *ptr, int value)
 {
-	MovieClip *clip= (MovieClip*)ptr->id.data;
+	MovieClip *clip = (MovieClip*)ptr->id.data;
 
-	clip->tracking.objectnr= value;
+	clip->tracking.objectnr = value;
 }
 
-static void rna_tracking_active_object_index_range(PointerRNA *ptr, int *min, int *max)
+static void rna_tracking_active_object_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
 {
-	MovieClip *clip= (MovieClip*)ptr->id.data;
+	MovieClip *clip = (MovieClip*)ptr->id.data;
 
-	*min= 0;
-	*max= clip->tracking.tot_object-1;
-	*max= MAX2(0, *max);
+	*min = 0;
+	*max = clip->tracking.tot_object-1;
+	*max = MAX2(0, *max);
 }
 
 static PointerRNA rna_tracking_active_track_get(PointerRNA *ptr)
 {
-	MovieClip *clip= (MovieClip*)ptr->id.data;
-	MovieTrackingTrack *act_track= BKE_tracking_active_track(&clip->tracking);
+	MovieClip *clip = (MovieClip*)ptr->id.data;
+	MovieTrackingTrack *act_track = BKE_tracking_active_track(&clip->tracking);
 
 	return rna_pointer_inherit_refine(ptr, &RNA_MovieTrackingTrack, act_track);
 }
 
 static void rna_tracking_active_track_set(PointerRNA *ptr, PointerRNA value)
 {
-	MovieClip *clip= (MovieClip*)ptr->id.data;
-	MovieTrackingTrack *track= (MovieTrackingTrack *)value.data;
-	ListBase *tracksbase= BKE_tracking_get_tracks(&clip->tracking);
-	int index= BLI_findindex(tracksbase, track);
+	MovieClip *clip = (MovieClip*)ptr->id.data;
+	MovieTrackingTrack *track = (MovieTrackingTrack *)value.data;
+	ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
+	int index = BLI_findindex(tracksbase, track);
 
-	if(index>=0)
-		clip->tracking.act_track= track;
+	if (index >= 0)
+		clip->tracking.act_track = track;
 	else
-		clip->tracking.act_track= NULL;
+		clip->tracking.act_track = NULL;
 }
 
 void rna_trackingTrack_name_set(PointerRNA *ptr, const char *value)
 {
-	MovieClip *clip= (MovieClip *)ptr->id.data;
-	MovieTracking *tracking= &clip->tracking;
-	MovieTrackingTrack *track= (MovieTrackingTrack *)ptr->data;
-	ListBase *tracksbase= &tracking->tracks;
+	MovieClip *clip = (MovieClip *)ptr->id.data;
+	MovieTracking *tracking = &clip->tracking;
+	MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data;
+	ListBase *tracksbase = &tracking->tracks;
 
 	BLI_strncpy(track->name, value, sizeof(track->name));
 
 	/* TODO: it's a bit difficult to find list track came from knowing just
-	         movie clip ID and MovieTracking structure, so keep this naive
-			 search for a while */
-	if(BLI_findindex(tracksbase, track) < 0) {
-		MovieTrackingObject *object= tracking->objects.first;
-
-		while(object) {
-			if(BLI_findindex(&object->tracks, track)) {
-				tracksbase= &object->tracks;
+	 *       movie clip ID and MovieTracking structure, so keep this naive
+	 *       search for a while */
+	if (BLI_findindex(tracksbase, track) < 0) {
+		MovieTrackingObject *object = tracking->objects.first;
+
+		while (object) {
+			if (BLI_findindex(&object->tracks, track)) {
+				tracksbase = &object->tracks;
 				break;
 			}
 
-			object= object->next;
+			object = object->next;
 		}
 	}
 
@@ -176,87 +188,97 @@ void rna_trackingTrack_name_set(PointerRNA *ptr, const char *value)
 
 static int rna_trackingTrack_select_get(PointerRNA *ptr)
 {
-	MovieTrackingTrack *track= (MovieTrackingTrack *)ptr->data;
+	MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data;
 
 	return TRACK_SELECTED(track);
 }
 
 static void rna_trackingTrack_select_set(PointerRNA *ptr, int value)
 {
-	MovieTrackingTrack *track= (MovieTrackingTrack *)ptr->data;
+	MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data;
 
-	if(value) {
-		track->flag|= SELECT;
-		track->pat_flag|= SELECT;
-		track->search_flag|= SELECT;
+	if (value) {
+		track->flag |= SELECT;
+		track->pat_flag |= SELECT;
+		track->search_flag |= SELECT;
 	}
 	else {
-		track->flag&= ~SELECT;
-		track->pat_flag&= ~SELECT;
-		track->search_flag&= ~SELECT;
+		track->flag &= ~SELECT;
+		track->pat_flag &= ~SELECT;
+		track->search_flag &= ~SELECT;
 	}
 }
 
 static void rna_tracking_trackerPattern_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	MovieTrackingTrack *track= (MovieTrackingTrack *)ptr->data;
+	MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data;
 
 	BKE_tracking_clamp_track(track, CLAMP_PAT_DIM);
 }
 
 static void rna_tracking_trackerSearch_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	MovieTrackingTrack *track= (MovieTrackingTrack *)ptr->data;
+	MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data;
 
 	BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM);
 }
 
 static void rna_tracking_trackerAlgorithm_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	MovieTrackingTrack *track= (MovieTrackingTrack *)ptr->data;
+	MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data;
 
-        if(track->tracker==TRACKER_KLT)
-          BKE_tracking_clamp_track(track, CLAMP_PYRAMID_LEVELS);
-        else
-          BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM);
+	if (track->tracker == TRACKER_KLT)
+		BKE_tracking_clamp_track(track, CLAMP_PYRAMID_LEVELS);
+	else
+		BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM);
 }
 
 static void rna_tracking_trackerPyramid_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	MovieTrackingTrack *track= (MovieTrackingTrack *)ptr->data;
+	MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data;
 
 	BKE_tracking_clamp_track(track, CLAMP_PYRAMID_LEVELS);
 }
 
+static char *rna_trackingCamera_path(PointerRNA *UNUSED(ptr))
+{
+	return BLI_sprintfN("tracking.camera");
+}
+
 static float rna_trackingCamera_focal_mm_get(PointerRNA *ptr)
 {
-	MovieClip *clip= (MovieClip*)ptr->id.data;
-	MovieTrackingCamera *camera= &clip->tracking.camera;
-	float val= camera->focal;
+	MovieClip *clip = (MovieClip*)ptr->id.data;
+	MovieTrackingCamera *camera = &clip->tracking.camera;
+	float val = camera->focal;
 
-	if(clip->lastsize[0])
-		val= val*camera->sensor_width/(float)clip->lastsize[0];
+	if (clip->lastsize[0])
+		val = val*camera->sensor_width/(float)clip->lastsize[0];
 
 	return val;
 }
 
 static void rna_trackingCamera_focal_mm_set(PointerRNA *ptr, float value)
 {
-	MovieClip *clip= (MovieClip*)ptr->id.data;
-	MovieTrackingCamera *camera= &clip->tracking.camera;
+	MovieClip *clip = (MovieClip*)ptr->id.data;
+	MovieTrackingCamera *camera = &clip->tracking.camera;
+
+	if (clip->lastsize[0])
+		value = clip->lastsize[0]*value/camera->sensor_width;
 
-	if(clip->lastsize[0])
-		value= clip->lastsize[0]*value/camera->sensor_width;
+	if (value >= 0.0001)
+		camera->focal = value;
+}
 
-	if(value>=0.0001)
-		camera->focal= value;
+static char *rna_trackingStabilization_path(PointerRNA *UNUSED(ptr))
+{
+	return BLI_sprintfN("tracking.stabilization");
 }
 
 static int rna_track_2d_stabilization(CollectionPropertyIterator *UNUSED(iter), void *data)
 {
-	MovieTrackingTrack *track= (MovieTrackingTrack*)data;
+	MovieTrackingTrack *track = (MovieTrackingTrack*)data;
 
-	if((track->flag&TRACK_USE_2D_STAB)==0)
+	if ((track->flag&TRACK_USE_2D_STAB) == 0)
 		return 1;
 
 	return 0;
@@ -264,37 +286,37 @@ static int rna_track_2d_stabilization(CollectionPropertyIterator *UNUSED(iter),
 
 static void rna_tracking_stabTracks_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	MovieClip *clip= (MovieClip*)ptr->id.data;
+	MovieClip *clip = (MovieClip*)ptr->id.data;
 	rna_iterator_listbase_begin(iter, &clip->tracking.tracks, rna_track_2d_stabilization);
 }
 
 static int rna_tracking_stabTracks_active_index_get(PointerRNA *ptr)
 {
-	MovieClip *clip= (MovieClip*)ptr->id.data;
+	MovieClip *clip = (MovieClip*)ptr->id.data;
 	return clip->tracking.stabilization.act_track;
 }
 
 static void rna_tracking_stabTracks_active_index_set(PointerRNA *ptr, int value)
 {
-	MovieClip *clip= (MovieClip*)ptr->id.data;
-	clip->tracking.stabilization.act_track= value;
+	MovieClip *clip = (MovieClip*)ptr->id.data;
+	clip->tracking.stabilization.act_track = value;
 }
 
-static void rna_tracking_stabTracks_active_index_range(PointerRNA *ptr, int *min, int *max)
+static void rna_tracking_stabTracks_active_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
 {
-	MovieClip *clip= (MovieClip*)ptr->id.data;
+	MovieClip *clip = (MovieClip*)ptr->id.data;
 
-	*min= 0;
-	*max= clip->tracking.stabilization.tot_track-1;
-	*max= MAX2(0, *max);
+	*min = 0;
+	*max = clip->tracking.stabilization.tot_track-1;
+	*max = MAX2(0, *max);
 }
 
 static void rna_tracking_flushUpdate(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
 {
-	MovieClip *clip= (MovieClip*)ptr->id.data;
-	MovieTrackingStabilization *stab= &clip->tracking.stabilization;
+	MovieClip *clip = (MovieClip*)ptr->id.data;
+	MovieTrackingStabilization *stab = &clip->tracking.stabilization;
 
-	stab->ok= 0;
+	stab->ok = 0;
 
 	nodeUpdateID(scene->nodetree, &clip->id);
 
@@ -304,10 +326,10 @@ static void rna_tracking_flushUpdate(Main *UNUSED(bmain), Scene *scene, PointerR
 
 static void rna_trackingObject_tracks_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	MovieTrackingObject *object= (MovieTrackingObject* )ptr->data;
+	MovieTrackingObject *object = (MovieTrackingObject* )ptr->data;
 
-	if(object->flag&TRACKING_OBJECT_CAMERA) {
-		MovieClip *clip= (MovieClip*)ptr->id.data;
+	if (object->flag&TRACKING_OBJECT_CAMERA) {
+		MovieClip *clip = (MovieClip*)ptr->id.data;
 
 		rna_iterator_listbase_begin(iter, &clip->tracking.tracks, NULL);
 	}
@@ -318,35 +340,35 @@ static void rna_trackingObject_tracks_begin(CollectionPropertyIterator *iter, Po
 
 static PointerRNA rna_tracking_active_object_get(PointerRNA *ptr)
 {
-	MovieClip *clip= (MovieClip*)ptr->id.data;
-	MovieTrackingObject *object= BLI_findlink(&clip->tracking.objects, clip->tracking.objectnr);
+	MovieClip *clip = (MovieClip*)ptr->id.data;
+	MovieTrackingObject *object = BLI_findlink(&clip->tracking.objects, clip->tracking.objectnr);
 
 	return rna_pointer_inherit_refine(ptr, &RNA_MovieTrackingObject, object);
 }
 
 static void rna_tracking_active_object_set(PointerRNA *ptr, PointerRNA value)
 {
-	MovieClip *clip= (MovieClip*)ptr->id.data;
-	MovieTrackingObject *object= (MovieTrackingObject *)value.data;
-	int index= BLI_findindex(&clip->tracking.objects, object);
+	MovieClip *clip = (MovieClip*)ptr->id.data;
+	MovieTrackingObject *object = (MovieTrackingObject *)value.data;
+	int index = BLI_findindex(&clip->tracking.objects, object);
 
-	if(index>=0) clip->tracking.objectnr= index;
-	else clip->tracking.objectnr= 0;
+	if (index >= 0) clip->tracking.objectnr = index;
+	else clip->tracking.objectnr = 0;
 }
 
 void rna_trackingObject_name_set(PointerRNA *ptr, const char *value)
 {
-	MovieClip *clip= (MovieClip *)ptr->id.data;
-	MovieTrackingObject *object= (MovieTrackingObject *)ptr->data;
+	MovieClip *clip = (MovieClip *)ptr->id.data;
+	MovieTrackingObject *object = (MovieTrackingObject *)ptr->data;
 
 	BLI_strncpy(object->name, value, sizeof(object->name));
 
 	BKE_tracking_object_unique_name(&clip->tracking, object);
 }
 
-static void rna_trackingObject_flushUpdate(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
+static void rna_trackingObject_flushUpdate(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	MovieClip *clip= (MovieClip*)ptr->id.data;
+	MovieClip *clip = (MovieClip*)ptr->id.data;
 
 	WM_main_add_notifier(NC_OBJECT|ND_TRANSFORM, NULL);
 	DAG_id_tag_update(&clip->id, 0);
@@ -382,19 +404,19 @@ static void rna_trackingMarker_frame_set(PointerRNA *ptr, int value)
 static void add_tracks_to_base(MovieClip *clip, MovieTracking *tracking, ListBase *tracksbase, int frame, int number)
 {
 	int a, width, height;
-	MovieClipUser user= {0};
+	MovieClipUser user = {0};
 
-	user.framenr= 1;
+	user.framenr = 1;
 
 	BKE_movieclip_get_size(clip, &user, &width, &height);
 
-	for(a= 0; a<number; a++)
+	for (a = 0; a<number; a++)
 		BKE_tracking_add_track(tracking, tracksbase, 0, 0, frame, width, height);
 }
 
 static void rna_trackingTracks_add(ID *id, MovieTracking *tracking, int frame, int number)
 {
-	MovieClip *clip= (MovieClip *) id;
+	MovieClip *clip = (MovieClip *) id;
 
 	add_tracks_to_base(clip, tracking, &tracking->tracks, frame, number);
 
@@ -403,11 +425,11 @@ static void rna_trackingTracks_add(ID *id, MovieTracking *tracking, int frame, i
 
 static void rna_trackingObject_tracks_add(ID *id, MovieTrackingObject *object, int frame, int number)
 {
-	MovieClip *clip= (MovieClip *) id;
-	ListBase *tracksbase= &object->tracks;
+	MovieClip *clip = (MovieClip *) id;
+	ListBase *tracksbase = &object->tracks;
 
-	if(object->flag&TRACKING_OBJECT_CAMERA)
-		tracksbase= &clip->tracking.tracks;
+	if (object->flag&TRACKING_OBJECT_CAMERA)
+		tracksbase = &clip->tracking.tracks;
 
 	add_tracks_to_base(clip, &clip->tracking, tracksbase, frame, number);
 
@@ -416,7 +438,7 @@ static void rna_trackingObject_tracks_add(ID *id, MovieTrackingObject *object, i
 
 static MovieTrackingObject *rna_trackingObject_new(MovieTracking *tracking, const char *name)
 {
-	MovieTrackingObject *object= BKE_tracking_new_object(tracking, name);
+	MovieTrackingObject *object = BKE_tracking_new_object(tracking, name);
 
 	WM_main_add_notifier(NC_MOVIECLIP|NA_EDITED, NULL);
 
@@ -452,7 +474,7 @@ static MovieTrackingMarker* rna_trackingMarkers_insert_frame(MovieTrackingTrack
 
 void rna_trackingMarkers_delete_frame(MovieTrackingTrack *track, int framenr)
 {
-	if(track->markersnr==1)
+	if (track->markersnr == 1)
 		return;
 
 	BKE_tracking_delete_marker(track, framenr);
@@ -463,7 +485,8 @@ void rna_trackingMarkers_delete_frame(MovieTrackingTrack *track, int framenr)
 #else
 
 static EnumPropertyItem tracker_items[] = {
-	{TRACKER_KLT, "KLT", 0, "KLT", "Kanade–Lucas–Tomasi tracker which works with most of video clips, a bit slower than SAD"},
+	{TRACKER_KLT, "KLT", 0, "KLT",
+	              "Kanade–Lucas–Tomasi tracker which works with most of video clips, a bit slower than SAD"},
 	{TRACKER_SAD, "SAD", 0, "SAD", "Sum of Absolute Differences tracker which can be used when KLT tracker fails"},
 	{TRACKER_HYBRID, "Hybrid", 0, "Hybrid", "A hybrid tracker that uses SAD for rough tracking, KLT for refinement."},
 	{0, NULL, 0, NULL, NULL}};
@@ -473,7 +496,7 @@ static EnumPropertyItem pattern_match_items[] = {
 	{TRACK_MATCH_PREVFRAME, "PREV_FRAME", 0, "Previous frame", "Track pattern from current frame to next frame"},
 	{0, NULL, 0, NULL, NULL}};
 
-static int rna_matrix_dimsize_4x4[]= {4, 4};
+static int rna_matrix_dimsize_4x4[] = {4, 4};
 
 static void rna_def_trackingSettings(BlenderRNA *brna)
 {
@@ -498,43 +521,49 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
 	static EnumPropertyItem refine_items[] = {
 		{0, "NONE", 0, "Nothing", "Do not refine camera intrinsics"},
 		{REFINE_FOCAL_LENGTH, "FOCAL_LENGTH", 0, "Focal Length", "Refine focal length"},
-		{REFINE_FOCAL_LENGTH|REFINE_RADIAL_DISTORTION_K1, "FOCAL_LENGTH_RADIAL_K1", 0, "Focal length, K1", "Refine focal length and radial distortion K1"},
+		{REFINE_FOCAL_LENGTH|REFINE_RADIAL_DISTORTION_K1, "FOCAL_LENGTH_RADIAL_K1", 0, "Focal length, K1",
+		                                                  "Refine focal length and radial distortion K1"},
 		{REFINE_FOCAL_LENGTH|
 		 REFINE_RADIAL_DISTORTION_K1|
-		 REFINE_RADIAL_DISTORTION_K2, "FOCAL_LENGTH_RADIAL_K1_K2", 0, "Focal length, K1, K2", "Refine focal length and radial distortion K1 and K2"},
+		 REFINE_RADIAL_DISTORTION_K2, "FOCAL_LENGTH_RADIAL_K1_K2", 0, "Focal length, K1, K2",
+		                              "Refine focal length and radial distortion K1 and K2"},
 		{REFINE_FOCAL_LENGTH|
 		 REFINE_PRINCIPAL_POINT|
 		 REFINE_RADIAL_DISTORTION_K1|
-		 REFINE_RADIAL_DISTORTION_K2,
-		 "FOCAL_LENGTH_PRINCIPAL_POINT_RADIAL_K1_K2", 0, "Focal Length, Optical Center, K1, K2", "Refine focal length, optical center and radial distortion K1 and K2"},
+		 REFINE_RADIAL_DISTORTION_K2, "FOCAL_LENGTH_PRINCIPAL_POINT_RADIAL_K1_K2", 0,
+		                              "Focal Length, Optical Center, K1, K2",
+		                              "Refine focal length, optical center and radial distortion K1 and K2"},
 		{REFINE_FOCAL_LENGTH|
-		 REFINE_PRINCIPAL_POINT, "FOCAL_LENGTH_PRINCIPAL_POINT", 0, "Focal Length, Optical Center", "Refine focal length and optical center"},
+		 REFINE_PRINCIPAL_POINT, "FOCAL_LENGTH_PRINCIPAL_POINT", 0, "Focal Length, Optical Center",
+		                         "Refine focal length and optical center"},
 		{0, NULL, 0, NULL, NULL}
 	};
 
-	srna= RNA_def_struct(brna, "MovieTrackingSettings", NULL);
+	srna = RNA_def_struct(brna, "MovieTrackingSettings", NULL);
 	RNA_def_struct_ui_text(srna, "Movie tracking settings", "Match moving settings");
 
 	/* speed */
-	prop= RNA_def_property(srna, "speed", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "speed", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_items(prop, speed_items);
-	RNA_def_property_ui_text(prop, "Speed", "Limit speed of tracking to make visual feedback easier (this does not affect the tracking quality)");
+	RNA_def_property_ui_text(prop, "Speed",
+	                         "Limit speed of tracking to make visual feedback easier "
+	                         "(this does not affect the tracking quality)");
 
 	/* keyframe_a */
-	prop= RNA_def_property(srna, "keyframe_a", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "keyframe_a", PROP_INT, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_int_sdna(prop, NULL, "keyframe1");
 	RNA_def_property_ui_text(prop, "Keyframe A", "First keyframe used for reconstruction initialization");
 
 	/* keyframe_b */
-	prop= RNA_def_property(srna, "keyframe_b", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "keyframe_b", PROP_INT, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_int_sdna(prop, NULL, "keyframe2");
 	RNA_def_property_ui_text(prop, "Keyframe B", "Second keyframe used for reconstruction initialization");
 
 	/* intrinsics refinement during bundle adjustment */
-	prop= RNA_def_property(srna, "refine_intrinsics", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "refine_intrinsics", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "refine_camera_intrinsics");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_items(prop, refine_items);
@@ -543,63 +572,65 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
 	/* tool settings */
 
 	/* distance */
-	prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_float_sdna(prop, NULL, "dist");
 	RNA_def_property_float_default(prop, 1.0f);
 	RNA_def_property_ui_text(prop, "Distance", "Distance between two bundles used for scene scaling");
 
 	/* frames count */
-	prop= RNA_def_property(srna, "clean_frames", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "clean_frames", PROP_INT, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_int_sdna(prop, NULL, "clean_frames");
 	RNA_def_property_range(prop, 0, INT_MAX);
-	RNA_def_property_ui_text(prop, "Tracked Frames", "Effect on tracks which are tracked less than the specified amount of frames");
+	RNA_def_property_ui_text(prop, "Tracked Frames",
+	                         "Effect on tracks which are tracked less than the specified amount of frames");
 
-	/* reprojection error */
-	prop= RNA_def_property(srna, "clean_error", PROP_FLOAT, PROP_NONE);
+	/* re-projection error */
+	prop = RNA_def_property(srna, "clean_error", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_float_sdna(prop, NULL, "clean_error");
 	RNA_def_property_range(prop, 0, FLT_MAX);
-	RNA_def_property_ui_text(prop, "Reprojection Error", "Effect on tracks which have a larger reprojection error");
+	RNA_def_property_ui_text(prop, "Reprojection Error", "Effect on tracks which have a larger re-projection error");
 
 	/* cleanup action */
-	prop= RNA_def_property(srna, "clean_action", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "clean_action", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "clean_action");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_items(prop, cleanup_items);
 	RNA_def_property_ui_text(prop, "Action", "Cleanup action to execute");
 
 	/* ** default tracker settings ** */
-	prop= RNA_def_property(srna, "show_default_expanded", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_default_expanded", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_SETTINGS_SHOW_DEFAULT_EXPANDED);
 	RNA_def_property_ui_text(prop, "Show Expanded", "Show the expanded in the user interface");
 	RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
 
 	/* limit frames */
-	prop= RNA_def_property(srna, "default_frames_limit", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "default_frames_limit", PROP_INT, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_int_sdna(prop, NULL, "default_frames_limit");
 	RNA_def_property_range(prop, 0, SHRT_MAX);
 	RNA_def_property_ui_text(prop, "Frames Limit", "Every tracking cycle, this number of frames are tracked");
 
 	/* pattern match */
-	prop= RNA_def_property(srna, "default_pattern_match", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "default_pattern_match", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_sdna(prop, NULL, "default_pattern_match");
 	RNA_def_property_enum_items(prop, pattern_match_items);
-	RNA_def_property_ui_text(prop, "Pattern Match", "Track pattern from given frame when tracking marker to next frame");
+	RNA_def_property_ui_text(prop, "Pattern Match",
+	                         "Track pattern from given frame when tracking marker to next frame");
 
 	/* margin */
-	prop= RNA_def_property(srna, "default_margin", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "default_margin", PROP_INT, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_int_sdna(prop, NULL, "default_margin");
 	RNA_def_property_range(prop, 0, 300);
 	RNA_def_property_ui_text(prop, "Margin", "Default distance from image boudary at which marker stops tracking");
 
 	/* tracking algorithm */
-	prop= RNA_def_property(srna, "default_tracker", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "default_tracker", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_items(prop, tracker_items);
@@ -607,7 +638,7 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Tracker", "Default tracking algorithm to use");
 
 	/* pyramid level for pyramid klt tracking */
-	prop= RNA_def_property(srna, "default_pyramid_levels", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "default_pyramid_levels", PROP_INT, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_int_sdna(prop, NULL, "default_pyramid_levels");
@@ -616,16 +647,18 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Pyramid levels", "Default number of pyramid levels (increase on blurry footage)");
 
 	/* minmal correlation - only used for SAD tracker */
-	prop= RNA_def_property(srna, "default_correlation_min", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "default_correlation_min", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_float_sdna(prop, NULL, "default_minimum_correlation");
 	RNA_def_property_range(prop, -1.0f, 1.0f);
 	RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
-	RNA_def_property_ui_text(prop, "Correlation", "Default minimal value of correlation between matched pattern and reference which is still treated as successful tracking");
+	RNA_def_property_ui_text(prop, "Correlation",
+	                         "Default minimal value of correlation between matched pattern and reference "
+	                         "which is still treated as successful tracking");
 
 	/* default pattern size */
-	prop= RNA_def_property(srna, "default_pattern_size", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "default_pattern_size", PROP_INT, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_int_sdna(prop, NULL, "default_pattern_size");
 	RNA_def_property_range(prop, 5, 1000);
@@ -633,7 +666,7 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Pattern Size", "Size of pattern area for newly created tracks");
 
 	/* default search size */
-	prop= RNA_def_property(srna, "default_search_size", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "default_search_size", PROP_INT, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_int_sdna(prop, NULL, "default_search_size");
 	RNA_def_property_range(prop, 5, 1000);
@@ -641,19 +674,19 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Search Size", "Size of search area for newly created tracks");
 
 	/* use_red_channel */
-	prop= RNA_def_property(srna, "use_default_red_channel", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_default_red_channel", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "default_flag", TRACK_DISABLE_RED);
 	RNA_def_property_ui_text(prop, "Use Red Channel", "Use red channel from footage for tracking");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
 
 	/* use_green_channel */
-	prop= RNA_def_property(srna, "use_default_green_channel", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_default_green_channel", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "default_flag", TRACK_DISABLE_GREEN);
 	RNA_def_property_ui_text(prop, "Use Green Channel", "Use green channel from footage for tracking");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
 
 	/* use_blue_channel */
-	prop= RNA_def_property(srna, "use_default_blue_channel", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_default_blue_channel", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "default_flag", TRACK_DISABLE_BLUE);
 	RNA_def_property_ui_text(prop, "Use Blue Channel", "Use blue channel from footage for tracking");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
@@ -661,7 +694,7 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
 	/* ** object tracking ** */
 
 	/* object distance */
-	prop= RNA_def_property(srna, "object_distance", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "object_distance", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_float_sdna(prop, NULL, "object_distance");
 	RNA_def_property_ui_text(prop, "Distance", "Distance between two bundles used for object scaling");
@@ -680,69 +713,80 @@ static void rna_def_trackingCamera(BlenderRNA *brna)
 		{CAMERA_UNITS_MM, "MILLIMETERS", 0, "mm", "Use millimeters for units of focal length"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "MovieTrackingCamera", NULL);
+	srna = RNA_def_struct(brna, "MovieTrackingCamera", NULL);
+	RNA_def_struct_path_func(srna, "rna_trackingCamera_path");
 	RNA_def_struct_ui_text(srna, "Movie tracking camera data", "Match-moving camera data for tracking");
 
 	/* Sensor */
-	prop= RNA_def_property(srna, "sensor_width", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "sensor_width", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "sensor_width");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0.0f, 500.0f);
 	RNA_def_property_ui_text(prop, "Sensor", "Width of CCD sensor in millimeters");
 	RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
 
 	/* Focal Length */
-	prop= RNA_def_property(srna, "focal_length", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "focal_length", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "focal");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0.0001f, 5000.0f);
 	RNA_def_property_float_funcs(prop, "rna_trackingCamera_focal_mm_get", "rna_trackingCamera_focal_mm_set", NULL);
 	RNA_def_property_ui_text(prop, "Focal Length", "Camera's focal length");
 	RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
 
 	/* Focal Length in pixels */
-	prop= RNA_def_property(srna, "focal_length_pixels", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "focal_length_pixels", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "focal");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0.0f, 5000.0f);
 	RNA_def_property_ui_text(prop, "Focal Length", "Camera's focal length");
 	RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
 
 	/* Units */
-	prop= RNA_def_property(srna, "units", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "units", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "units");
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_items(prop, camera_units_items);
 	RNA_def_property_ui_text(prop, "Units", "Units used for camera focal length");
 
 	/* Principal Point */
-	prop= RNA_def_property(srna, "principal", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "principal", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_array(prop, 2);
 	RNA_def_property_float_sdna(prop, NULL, "principal");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Principal Point", "Optical center of lens");
 	RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
 
 	/* Radial distortion parameters */
-	prop= RNA_def_property(srna, "k1", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "k1", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "k1");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_range(prop, -10, 10, .1, 3);
 	RNA_def_property_ui_text(prop, "K1", "First coefficient of third order polynomial radial distortion");
 	RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_flushUpdate");
 
-	prop= RNA_def_property(srna, "k2", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "k2", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "k2");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_range(prop, -10, 10, .1, 3);
 	RNA_def_property_ui_text(prop, "K2", "Second coefficient of third order polynomial radial distortion");
 	RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_flushUpdate");
 
-	prop= RNA_def_property(srna, "k3", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "k3", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "k3");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_range(prop, -10, 10, .1, 3);
 	RNA_def_property_ui_text(prop, "K3", "Third coefficient of third order polynomial radial distortion");
 	RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_flushUpdate");
 
 	/* pixel aspect */
-	prop= RNA_def_property(srna, "pixel_aspect", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "pixel_aspect", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "pixel_aspect");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0.1f, 5000.0f);
 	RNA_def_property_ui_range(prop, 0.1f, 5000.0f, 1, 2);
+	RNA_def_property_float_default(prop, 1.0f);
 	RNA_def_property_ui_text(prop, "Pixel Aspect Ratio", "Pixel aspect ratio");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
 }
@@ -752,26 +796,26 @@ static void rna_def_trackingMarker(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "MovieTrackingMarker", NULL);
+	srna = RNA_def_struct(brna, "MovieTrackingMarker", NULL);
 	RNA_def_struct_ui_text(srna, "Movie tracking marker data", "Match-moving marker data for tracking");
 
 	/* position */
-	prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_array(prop, 2);
-	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5);
+	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
 	RNA_def_property_float_sdna(prop, NULL, "pos");
 	RNA_def_property_ui_text(prop, "Position", "Marker position at frame in normalized coordinates");
 	RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
 
 	/* frame */
-	prop= RNA_def_property(srna, "frame", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "framenr");
 	RNA_def_property_ui_text(prop, "Frame", "Frame number marker is keyframed on");
 	RNA_def_property_int_funcs(prop, NULL, "rna_trackingMarker_frame_set", NULL);
 	RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, 0);
 
 	/* enable */
-	prop= RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MARKER_DISABLED);
 	RNA_def_property_ui_text(prop, "Mode", "Is marker muted for current frame");
 	RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
@@ -784,33 +828,34 @@ static void rna_def_trackingMarkers(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, "MovieTrackingMarkers");
-	srna= RNA_def_struct(brna, "MovieTrackingMarkers", NULL);
+	srna = RNA_def_struct(brna, "MovieTrackingMarkers", NULL);
 	RNA_def_struct_sdna(srna, "MovieTrackingTrack");
 	RNA_def_struct_ui_text(srna, "Movie Tracking Markers", "Collection of markers for movie tracking track");
 
-	func= RNA_def_function(srna, "find_frame", "rna_trackingMarkers_find_frame");
+	func = RNA_def_function(srna, "find_frame", "rna_trackingMarkers_find_frame");
 	RNA_def_function_ui_description(func, "Get marker for specified frame");
-	parm= RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame",
-			 "Frame number to find marker for", MINFRAME, MAXFRAME);
+	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_pointer(func, "marker", "MovieTrackingMarker", "", "Marker for specified frame");
+	parm = RNA_def_pointer(func, "marker", "MovieTrackingMarker", "", "Marker for specified frame");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "insert_frame", "rna_trackingMarkers_insert_frame");
+	func = RNA_def_function(srna, "insert_frame", "rna_trackingMarkers_insert_frame");
 	RNA_def_function_ui_description(func, "Add a number of tracks to this movie clip");
-	parm= RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame",
-			"Frame number to insert marker to", MINFRAME, MAXFRAME);
+	parm = RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame",
+	                   "Frame number to insert marker to", MINFRAME, MAXFRAME);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_float_vector(func, "co", 2, 0, -1.0, 1.0, "Coordinate",
-			"Place new marker at the given frame using specified in normalized space coordinates", -1.0, 1.0);
+	                     "Place new marker at the given frame using specified in normalized space coordinates",
+	                     -1.0, 1.0);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_pointer(func, "marker", "MovieTrackingMarker", "", "Newly created marker");
+	parm = RNA_def_pointer(func, "marker", "MovieTrackingMarker", "", "Newly created marker");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "delete_frame", "rna_trackingMarkers_delete_frame");
+	func = RNA_def_function(srna, "delete_frame", "rna_trackingMarkers_delete_frame");
 	RNA_def_function_ui_description(func, "Delete marker at specified frame");
-	parm= RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame",
-			"Frame number to delete marker from", MINFRAME, MAXFRAME);
+	parm = RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame",
+	                   "Frame number to delete marker from", MINFRAME, MAXFRAME);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 }
 
@@ -821,12 +866,13 @@ static void rna_def_trackingTrack(BlenderRNA *brna)
 
 	rna_def_trackingMarker(brna);
 
-	srna= RNA_def_struct(brna, "MovieTrackingTrack", NULL);
+	srna = RNA_def_struct(brna, "MovieTrackingTrack", NULL);
+	RNA_def_struct_path_func(srna, "rna_trackingTrack_path");
 	RNA_def_struct_ui_text(srna, "Movie tracking track data", "Match-moving track data for tracking");
 	RNA_def_struct_ui_icon(srna, ICON_ANIM_DATA);
 
 	/* name */
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Name", "Unique name of track");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_trackingTrack_name_set");
 	RNA_def_property_string_maxlength(prop, MAX_ID_NAME-2);
@@ -834,81 +880,101 @@ static void rna_def_trackingTrack(BlenderRNA *brna)
 	RNA_def_struct_name_property(srna, prop);
 
 	/* Pattern */
-	prop= RNA_def_property(srna, "pattern_min", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "pattern_min", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_array(prop, 2);
-	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5);
+	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
 	RNA_def_property_float_sdna(prop, NULL, "pat_min");
-	RNA_def_property_ui_text(prop, "Pattern Min", "Left-bottom corner of pattern area in normalized coordinates relative to marker position");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+	RNA_def_property_ui_text(prop, "Pattern Min",
+	                         "Left-bottom corner of pattern area in normalized coordinates relative "
+	                         "to marker position");
 	RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerPattern_update");
 
-	prop= RNA_def_property(srna, "pattern_max", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "pattern_max", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_array(prop, 2);
-	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5);
+	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
 	RNA_def_property_float_sdna(prop, NULL, "pat_max");
-	RNA_def_property_ui_text(prop, "Pattern Max", "Right-bottom corner of pattern area in normalized coordinates relative to marker position");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+	RNA_def_property_ui_text(prop, "Pattern Max",
+	                         "Right-bottom corner of pattern area in normalized coordinates relative "
+	                         "to marker position");
 	RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerPattern_update");
 
 	/* Search */
-	prop= RNA_def_property(srna, "search_min", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "search_min", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_array(prop, 2);
-	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5);
+	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
 	RNA_def_property_float_sdna(prop, NULL, "search_min");
-	RNA_def_property_ui_text(prop, "Search Min", "Left-bottom corner of search area in normalized coordinates relative to marker position");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+	RNA_def_property_ui_text(prop, "Search Min",
+	                         "Left-bottom corner of search area in normalized coordinates relative "
+	                         "to marker position");
 	RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerSearch_update");
 
-	prop= RNA_def_property(srna, "search_max", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "search_max", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_array(prop, 2);
-	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 5);
+	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
 	RNA_def_property_float_sdna(prop, NULL, "search_max");
-	RNA_def_property_ui_text(prop, "Search Max", "Right-bottom corner of search area in normalized coordinates relative to marker position");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+	RNA_def_property_ui_text(prop, "Search Max",
+	                         "Right-bottom corner of search area in normalized coordinates relative "
+	                         "to marker position");
 	RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerSearch_update");
 
 	/* limit frames */
-	prop= RNA_def_property(srna, "frames_limit", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "frames_limit", PROP_INT, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_int_sdna(prop, NULL, "frames_limit");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0, SHRT_MAX);
 	RNA_def_property_ui_text(prop, "Frames Limit", "Every tracking cycle, this number of frames are tracked");
 
 	/* pattern match */
-	prop= RNA_def_property(srna, "pattern_match", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "pattern_match", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_sdna(prop, NULL, "pattern_match");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_items(prop, pattern_match_items);
-	RNA_def_property_ui_text(prop, "Pattern Match", "Track pattern from given frame when tracking marker to next frame");
+	RNA_def_property_ui_text(prop, "Pattern Match",
+	                         "Track pattern from given frame when tracking marker to next frame");
 
 	/* margin */
-	prop= RNA_def_property(srna, "margin", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "margin", PROP_INT, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_int_sdna(prop, NULL, "margin");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 0, 300);
 	RNA_def_property_ui_text(prop, "Margin", "Distance from image boudary at which marker stops tracking");
 
 	/* tracking algorithm */
-	prop= RNA_def_property(srna, "tracker", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "tracker", PROP_ENUM, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_items(prop, tracker_items);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Tracker", "Tracking algorithm to use");
 	RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerAlgorithm_update");
 
 	/* pyramid level for pyramid klt tracking */
-	prop= RNA_def_property(srna, "pyramid_levels", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "pyramid_levels", PROP_INT, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_int_sdna(prop, NULL, "pyramid_levels");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_range(prop, 1, 16);
 	RNA_def_property_ui_text(prop, "Pyramid levels", "Number of pyramid levels (increase on blurry footage)");
 	RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_trackerPyramid_update");
 
 	/* minmal correlation - only used for SAD tracker */
-	prop= RNA_def_property(srna, "correlation_min", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "correlation_min", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_float_sdna(prop, NULL, "minimum_correlation");
 	RNA_def_property_range(prop, -1.0f, 1.0f);
 	RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
-	RNA_def_property_ui_text(prop, "Correlation", "Minimal value of correlation between matched pattern and reference which is still treated as successful tracking");
+	RNA_def_property_ui_text(prop, "Correlation",
+	                         "Minimal value of correlation between matched pattern and reference "
+	                         "which is still treated as successful tracking");
 
 	/* markers */
-	prop= RNA_def_property(srna, "markers", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "markers", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "MovieTrackingMarker");
 	RNA_def_property_collection_sdna(prop, NULL, "markers", "markersnr");
 	RNA_def_property_ui_text(prop, "Markers", "Collection of markers in track");
@@ -917,93 +983,102 @@ static void rna_def_trackingTrack(BlenderRNA *brna)
 	/* ** channels ** */
 
 	/* use_red_channel */
-	prop= RNA_def_property(srna, "use_red_channel", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_red_channel", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TRACK_DISABLE_RED);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Use Red Channel", "Use red channel from footage for tracking");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
 
 	/* use_green_channel */
-	prop= RNA_def_property(srna, "use_green_channel", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_green_channel", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TRACK_DISABLE_GREEN);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Use Green Channel", "Use green channel from footage for tracking");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
 
 	/* use_blue_channel */
-	prop= RNA_def_property(srna, "use_blue_channel", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_blue_channel", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TRACK_DISABLE_BLUE);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Use Blue Channel", "Use blue channel from footage for tracking");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
 
 	/* preview_grayscale */
-	prop= RNA_def_property(srna, "use_grayscale_preview", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_grayscale_preview", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_PREVIEW_GRAYSCALE);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Grayscale", "Display what the tracking algorithm sees in the preview");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
 
 	/* has bundle */
-	prop= RNA_def_property(srna, "has_bundle", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "has_bundle", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_HAS_BUNDLE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Has Bundle", "True if track has a valid bundle");
 
 	/* bundle position */
-	prop= RNA_def_property(srna, "bundle", PROP_FLOAT, PROP_TRANSLATION);
+	prop = RNA_def_property(srna, "bundle", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_float_sdna(prop, NULL, "bundle_pos");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Bundle", "Position of bundle reconstructed from this track");
+	RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
 
 	/* hide */
-	prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_HIDDEN);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Hide", "Track is hidden");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
 
 	/* select */
-	prop= RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_trackingTrack_select_get", "rna_trackingTrack_select_set");
 	RNA_def_property_ui_text(prop, "Select", "Track is selected");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
 
 	/* select_anchor */
-	prop= RNA_def_property(srna, "select_anchor", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select_anchor", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
 	RNA_def_property_ui_text(prop, "Select Anchor", "Track's anchor point is selected");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
 
 	/* select_pattern */
-	prop= RNA_def_property(srna, "select_pattern", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select_pattern", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "pat_flag", SELECT);
 	RNA_def_property_ui_text(prop, "Select Pattern", "Track's pattern area is selected");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
 
 	/* select_search */
-	prop= RNA_def_property(srna, "select_search", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "select_search", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "search_flag", SELECT);
 	RNA_def_property_ui_text(prop, "Select Search", "Track's search area is selected");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
 
 	/* locked */
-	prop= RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_LOCKED);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Lock", "Track is locked and all changes to it are disabled");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
 
 	/* custom color */
-	prop= RNA_def_property(srna, "use_custom_color", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_custom_color", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_CUSTOMCOLOR);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Custom Color", "Use custom color instead of theme-defined");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
 
 	/* color */
-	prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
-	RNA_def_property_ui_text(prop, "Color", "Color of the track in the Movie Track Editor and the 3D viewport after a solve");
+	RNA_def_property_ui_text(prop, "Color",
+	                         "Color of the track in the Movie Clip Editor and the 3D viewport after a solve");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
 
 	/* average error */
-	prop= RNA_def_property(srna, "average_error", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "average_error", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "error");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Average Error", "Average error of re-projection");
@@ -1014,74 +1089,97 @@ static void rna_def_trackingStabilization(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "MovieTrackingStabilization", NULL);
+	static EnumPropertyItem filter_items[] = {
+		{TRACKING_FILTER_NEAREAST, "NEAREST",   0, "Nearest",   ""},
+		{TRACKING_FILTER_BILINEAR, "BILINEAR",   0, "Bilinear",   ""},
+		{TRACKING_FILTER_BICUBIC, "BICUBIC", 0, "Bicubic", ""},
+		{0, NULL, 0, NULL, NULL}};
+
+	srna = RNA_def_struct(brna, "MovieTrackingStabilization", NULL);
+	RNA_def_struct_path_func(srna, "rna_trackingStabilization_path");
 	RNA_def_struct_ui_text(srna, "Movie tracking stabilization data", "Match-moving stabilization data for tracking");
 
 	/* 2d stabilization */
-	prop= RNA_def_property(srna, "use_2d_stabilization", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_2d_stabilization", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_2D_STABILIZATION);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Use 2D stabilization", "Use 2D stabilization for footage");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
 
 	/* tracks */
-	prop= RNA_def_property(srna, "tracks", PROP_COLLECTION, PROP_NONE);
-	RNA_def_property_collection_funcs(prop, "rna_tracking_stabTracks_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0);
+	prop = RNA_def_property(srna, "tracks", PROP_COLLECTION, PROP_NONE);
+	RNA_def_property_collection_funcs(prop, "rna_tracking_stabTracks_begin", "rna_iterator_listbase_next",
+	                                  "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+	                                  NULL, NULL, NULL, NULL);
 	RNA_def_property_struct_type(prop, "MovieTrackingTrack");
 	RNA_def_property_ui_text(prop, "Tracks", "Collection of tracks used for stabilization");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
 
 	/* rotation track */
-	prop= RNA_def_property(srna, "rotation_track", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "rotation_track", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "rot_track");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Rotation Track", "Track used to compensate rotation");
 	RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, "rna_tracking_flushUpdate");
 
 	/* active track index */
-	prop= RNA_def_property(srna, "active_track_index", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "active_track_index", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "act_track");
-	RNA_def_property_int_funcs(prop, "rna_tracking_stabTracks_active_index_get", "rna_tracking_stabTracks_active_index_set", "rna_tracking_stabTracks_active_index_range");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+	RNA_def_property_int_funcs(prop, "rna_tracking_stabTracks_active_index_get",
+	                           "rna_tracking_stabTracks_active_index_set",
+	                           "rna_tracking_stabTracks_active_index_range");
 	RNA_def_property_ui_text(prop, "Active Track Index", "Index of active track in stabilization tracks list");
 
 	/* autoscale */
-	prop= RNA_def_property(srna, "use_autoscale", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_autoscale", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_AUTOSCALE);
-	RNA_def_property_ui_text(prop, "Autoscale", "Automatically scale footage to cover unfilled areas when stabilizating");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+	RNA_def_property_ui_text(prop, "Autoscale",
+	                         "Automatically scale footage to cover unfilled areas when stabilizating");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
 
 	/* max scale */
-	prop= RNA_def_property(srna, "scale_max", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "scale_max", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "maxscale");
 	RNA_def_property_range(prop, 0.0f, 10.0f);
 	RNA_def_property_ui_text(prop, "Maximal Scale", "Limit the amount of automatic scaling");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
 
 	/* influence_location */
-	prop= RNA_def_property(srna, "influence_location", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "influence_location", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "locinf");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Location Influence", "Influence of stabilization algorithm on footage location");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
 
 	/* influence_scale */
-	prop= RNA_def_property(srna, "influence_scale", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "influence_scale", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "scaleinf");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Scale Influence", "Influence of stabilization algorithm on footage scale");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
 
 	/* use_stabilize_rotation */
-	prop= RNA_def_property(srna, "use_stabilize_rotation", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_stabilize_rotation", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_STABILIZE_ROTATION);
 	RNA_def_property_ui_text(prop, "Stabilize Rotation", "Stabilize horizon line on the shot");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
 
 	/* influence_rotation */
-	prop= RNA_def_property(srna, "influence_rotation", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "influence_rotation", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "rotinf");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Rotation Influence", "Influence of stabilization algorithm on footage rotation");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
+
+	/* filter */
+	prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_sdna(prop, NULL, "filter");
+	RNA_def_property_enum_items(prop, filter_items);
+	RNA_def_property_ui_text(prop, "Filter", "Method to use to filter stabilization");
+	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_tracking_flushUpdate");
 }
 
 static void rna_def_reconstructedCamera(BlenderRNA *brna)
@@ -1089,24 +1187,25 @@ static void rna_def_reconstructedCamera(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "MovieReconstructedCamera", NULL);
-	RNA_def_struct_ui_text(srna, "Movie tracking reconstructed camera data", "Match-moving reconstructed camera data from tracker");
+	srna = RNA_def_struct(brna, "MovieReconstructedCamera", NULL);
+	RNA_def_struct_ui_text(srna, "Movie tracking reconstructed camera data",
+	                       "Match-moving reconstructed camera data from tracker");
 
 	/* frame */
-	prop= RNA_def_property(srna, "frame", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame", PROP_INT, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_int_sdna(prop, NULL, "framenr");
 	RNA_def_property_ui_text(prop, "Frame", "Frame number marker is keyframed on");
 
 	/* matrix */
-	prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
+	prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
 	RNA_def_property_float_sdna(prop, NULL, "mat");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
 	RNA_def_property_ui_text(prop, "Matrix", "Worldspace transformation matrix");
 
 	/* average_error */
-	prop= RNA_def_property(srna, "average_error", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "average_error", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "error");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Average Error", "Average error of resonctruction");
@@ -1119,23 +1218,24 @@ static void rna_def_trackingReconstruction(BlenderRNA *brna)
 
 	rna_def_reconstructedCamera(brna);
 
-	srna= RNA_def_struct(brna, "MovieTrackingReconstruction", NULL);
-	RNA_def_struct_ui_text(srna, "Movie tracking reconstruction data", "Match-moving reconstruction data from tracker");
+	srna = RNA_def_struct(brna, "MovieTrackingReconstruction", NULL);
+	RNA_def_struct_ui_text(srna, "Movie tracking reconstruction data",
+	                       "Match-moving reconstruction data from tracker");
 
 	/* is_valid */
-	prop= RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_RECONSTRUCTED);
 	RNA_def_property_ui_text(prop, "Reconstructed", "Is tracking data contains valid reconstruction information");
 
 	/* average_error */
-	prop= RNA_def_property(srna, "average_error", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "average_error", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "error");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Average Error", "Average error of resonctruction");
 
 	/* cameras */
-	prop= RNA_def_property(srna, "cameras", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "cameras", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "MovieReconstructedCamera");
 	RNA_def_property_collection_sdna(prop, NULL, "cameras", "camnr");
 	RNA_def_property_ui_text(prop, "Cameras", "Collection of solved cameras");
@@ -1147,18 +1247,18 @@ static void rna_def_trackingTracks(BlenderRNA *brna)
 	FunctionRNA *func;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "MovieTrackingTracks", NULL);
+	srna = RNA_def_struct(brna, "MovieTrackingTracks", NULL);
 	RNA_def_struct_sdna(srna, "MovieTracking");
 	RNA_def_struct_ui_text(srna, "Movie Tracks", "Collection of movie tracking tracks");
 
-	func= RNA_def_function(srna, "add", "rna_trackingTracks_add");
+	func = RNA_def_function(srna, "add", "rna_trackingTracks_add");
 	RNA_def_function_flag(func, FUNC_USE_SELF_ID);
 	RNA_def_function_ui_description(func, "Add a number of tracks to this movie clip");
 	RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame", "Frame number to add tracks on", MINFRAME, MAXFRAME);
 	RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of tracks to add to the movie clip", 0, INT_MAX);
 
 	/* active track */
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "MovieTrackingTrack");
 	RNA_def_property_pointer_funcs(prop, "rna_tracking_active_track_get", "rna_tracking_active_track_set", NULL, NULL);
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK);
@@ -1171,18 +1271,18 @@ static void rna_def_trackingObjectTracks(BlenderRNA *brna)
 	FunctionRNA *func;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "MovieTrackingObjectTracks", NULL);
+	srna = RNA_def_struct(brna, "MovieTrackingObjectTracks", NULL);
 	RNA_def_struct_sdna(srna, "MovieTrackingObject");
 	RNA_def_struct_ui_text(srna, "Movie Tracks", "Collection of movie tracking tracks");
 
-	func= RNA_def_function(srna, "add", "rna_trackingObject_tracks_add");
+	func = RNA_def_function(srna, "add", "rna_trackingObject_tracks_add");
 	RNA_def_function_flag(func, FUNC_USE_SELF_ID);
 	RNA_def_function_ui_description(func, "Add a number of tracks to this movie clip");
 	RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame", "Frame number to add tracks on", MINFRAME, MAXFRAME);
 	RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of tracks to add to the movie clip", 0, INT_MAX);
 
 	/* active track */
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "MovieTrackingTrack");
 	RNA_def_property_pointer_funcs(prop, "rna_tracking_active_track_get", "rna_tracking_active_track_set", NULL, NULL);
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK);
@@ -1194,11 +1294,11 @@ static void rna_def_trackingObject(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "MovieTrackingObject", NULL);
+	srna = RNA_def_struct(brna, "MovieTrackingObject", NULL);
 	RNA_def_struct_ui_text(srna, "Movie tracking object data", "Match-moving object tracking and reconstruction data");
 
 	/* name */
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Name", "Unique name of object");
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_trackingObject_name_set");
 	RNA_def_property_string_maxlength(prop, MAX_ID_NAME-2);
@@ -1206,25 +1306,27 @@ static void rna_def_trackingObject(BlenderRNA *brna)
 	RNA_def_struct_name_property(srna, prop);
 
 	/* is_camera */
-	prop= RNA_def_property(srna, "is_camera", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_camera", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_OBJECT_CAMERA);
 	RNA_def_property_ui_text(prop, "Camera", "Object is used for camera tracking");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
 
 	/* tracks */
-	prop= RNA_def_property(srna, "tracks", PROP_COLLECTION, PROP_NONE);
-	RNA_def_property_collection_funcs(prop, "rna_trackingObject_tracks_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0);
+	prop = RNA_def_property(srna, "tracks", PROP_COLLECTION, PROP_NONE);
+	RNA_def_property_collection_funcs(prop, "rna_trackingObject_tracks_begin", "rna_iterator_listbase_next",
+	                                  "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+	                                  NULL, NULL, NULL, NULL);
 	RNA_def_property_struct_type(prop, "MovieTrackingTrack");
 	RNA_def_property_ui_text(prop, "Tracks", "Collection of tracks in this tracking data object");
 	RNA_def_property_srna(prop, "MovieTrackingObjectTracks");
 
 	/* reconstruction */
-	prop= RNA_def_property(srna, "reconstruction", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "reconstruction", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "MovieTrackingReconstruction");
 
 	/* scale */
-	prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_float_sdna(prop, NULL, "scale");
 	RNA_def_property_range(prop, 0.0001f, 10000.0f);
@@ -1243,24 +1345,26 @@ static void rna_def_trackingObjects(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, "MovieTrackingObjects");
-	srna= RNA_def_struct(brna, "MovieTrackingObjects", NULL);
+	srna = RNA_def_struct(brna, "MovieTrackingObjects", NULL);
 	RNA_def_struct_sdna(srna, "MovieTracking");
 	RNA_def_struct_ui_text(srna, "Movie Objects", "Collection of movie trackingobjects");
 
-	func= RNA_def_function(srna, "new", "rna_trackingObject_new");
+	func = RNA_def_function(srna, "new", "rna_trackingObject_new");
 	RNA_def_function_ui_description(func, "Add tracking object to this movie clip");
-	RNA_def_string(func, "name", "", 0, "", "Name of new object");
-	parm= RNA_def_pointer(func, "object", "MovieTrackingObject", "", "New motion tracking object");
+	parm = RNA_def_string(func, "name", "", 0, "", "Name of new object");
+	RNA_def_property_flag(parm, PROP_REQUIRED);
+	parm = RNA_def_pointer(func, "object", "MovieTrackingObject", "", "New motion tracking object");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_trackingObject_remove");
+	func = RNA_def_function(srna, "remove", "rna_trackingObject_remove");
 	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");
 
 	/* active object */
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "MovieTrackingObject");
-	RNA_def_property_pointer_funcs(prop, "rna_tracking_active_object_get", "rna_tracking_active_object_set", NULL, NULL);
+	RNA_def_property_pointer_funcs(prop, "rna_tracking_active_object_get",
+	                               "rna_tracking_active_object_set", NULL, NULL);
 	RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK);
 	RNA_def_property_ui_text(prop, "Active Object", "Active object in this tracking data object");
 }
@@ -1279,43 +1383,50 @@ static void rna_def_tracking(BlenderRNA *brna)
 	rna_def_trackingReconstruction(brna);
 	rna_def_trackingObject(brna);
 
-	srna= RNA_def_struct(brna, "MovieTracking", NULL);
+	srna = RNA_def_struct(brna, "MovieTracking", NULL);
+	RNA_def_struct_path_func(srna, "rna_tracking_path");
 	RNA_def_struct_ui_text(srna, "Movie tracking data", "Match-moving data for tracking");
 
 	/* settings */
-	prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "MovieTrackingSettings");
 
 	/* camera properties */
-	prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "MovieTrackingCamera");
 
 	/* tracks */
-	prop= RNA_def_property(srna, "tracks", PROP_COLLECTION, PROP_NONE);
-	RNA_def_property_collection_funcs(prop, "rna_trackingTracks_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0);
+	prop = RNA_def_property(srna, "tracks", PROP_COLLECTION, PROP_NONE);
+	RNA_def_property_collection_funcs(prop, "rna_trackingTracks_begin", "rna_iterator_listbase_next",
+	                                  "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+	                                  NULL, NULL, NULL, NULL);
 	RNA_def_property_struct_type(prop, "MovieTrackingTrack");
 	RNA_def_property_ui_text(prop, "Tracks", "Collection of tracks in this tracking data object");
 	RNA_def_property_srna(prop, "MovieTrackingTracks");
 
 	/* stabilization */
-	prop= RNA_def_property(srna, "stabilization", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "stabilization", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "MovieTrackingStabilization");
 
 	/* reconstruction */
-	prop= RNA_def_property(srna, "reconstruction", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "reconstruction", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "MovieTrackingReconstruction");
 
 	/* objects */
-	prop= RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
-	RNA_def_property_collection_funcs(prop, "rna_trackingObjects_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0);
+	prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
+	RNA_def_property_collection_funcs(prop, "rna_trackingObjects_begin", "rna_iterator_listbase_next",
+	                                  "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+	                                  NULL, NULL, NULL, NULL);
 	RNA_def_property_struct_type(prop, "MovieTrackingObject");
 	RNA_def_property_ui_text(prop, "Objects", "Collection of objects in this tracking data object");
 	rna_def_trackingObjects(brna, prop);
 
 	/* active object index */
-	prop= RNA_def_property(srna, "active_object_index", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "active_object_index", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "objectnr");
-	RNA_def_property_int_funcs(prop, "rna_tracking_active_object_index_get", "rna_tracking_active_object_index_set", "rna_tracking_active_object_index_range");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+	RNA_def_property_int_funcs(prop, "rna_tracking_active_object_index_get", "rna_tracking_active_object_index_set",
+	                           "rna_tracking_active_object_index_range");
 	RNA_def_property_ui_text(prop, "Active Object Index", "Index of active object");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
 }
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index 8e3178a..635dfb4 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -75,15 +75,15 @@ static ARegionType *region_type_find(ReportList *reports, int space_type, int re
 	SpaceType *st;
 	ARegionType *art;
 
-	st= BKE_spacetype_from_id(space_type);
+	st = BKE_spacetype_from_id(space_type);
 
-	for(art= (st)? st->regiontypes.first: NULL; art; art= art->next) {
-		if (art->regionid==region_type)
+	for (art = (st)? st->regiontypes.first: NULL; art; art = art->next) {
+		if (art->regionid == region_type)
 			break;
 	}
 	
 	/* region type not found? abort */
-	if (art==NULL) {
+	if (art == NULL) {
 		BKE_report(reports, RPT_ERROR, "Region not found in spacetype");
 		return NULL;
 	}
@@ -104,14 +104,14 @@ static int panel_poll(const bContext *C, PanelType *pt)
 	int visible;
 
 	RNA_pointer_create(NULL, pt->ext.srna, NULL, &ptr); /* dummy */
-	func= &rna_Panel_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
+	func = &rna_Panel_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
 
 	RNA_parameter_list_create(&list, &ptr, func);
 	RNA_parameter_set_lookup(&list, "context", &C);
 	pt->ext.call((bContext *)C, &ptr, func, &list);
 
 	RNA_parameter_get_lookup(&list, "visible", &ret);
-	visible= *(int*)ret;
+	visible = *(int*)ret;
 
 	RNA_parameter_list_free(&list);
 
@@ -127,7 +127,7 @@ static void panel_draw(const bContext *C, Panel *pnl)
 	FunctionRNA *func;
 
 	RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->ext.srna, pnl, &ptr);
-	func= &rna_Panel_draw_func;/* RNA_struct_find_function(&ptr, "draw"); */
+	func = &rna_Panel_draw_func;/* RNA_struct_find_function(&ptr, "draw"); */
 
 	RNA_parameter_list_create(&list, &ptr, func);
 	RNA_parameter_set_lookup(&list, "context", &C);
@@ -145,7 +145,7 @@ static void panel_draw_header(const bContext *C, Panel *pnl)
 	FunctionRNA *func;
 
 	RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->ext.srna, pnl, &ptr);
-	func= &rna_Panel_draw_header_func; /* RNA_struct_find_function(&ptr, "draw_header"); */
+	func = &rna_Panel_draw_header_func; /* RNA_struct_find_function(&ptr, "draw_header"); */
 
 	RNA_parameter_list_create(&list, &ptr, func);
 	RNA_parameter_set_lookup(&list, "context", &C);
@@ -157,11 +157,11 @@ static void panel_draw_header(const bContext *C, Panel *pnl)
 static void rna_Panel_unregister(Main *UNUSED(bmain), StructRNA *type)
 {
 	ARegionType *art;
-	PanelType *pt= RNA_struct_blender_type_get(type);
+	PanelType *pt = RNA_struct_blender_type_get(type);
 
-	if(!pt)
+	if (!pt)
 		return;
-	if(!(art=region_type_find(NULL, pt->space_type, pt->region_type)))
+	if (!(art = region_type_find(NULL, pt->space_type, pt->region_type)))
 		return;
 	
 	RNA_struct_free_extension(type, &pt->ext);
@@ -178,31 +178,31 @@ static StructRNA *rna_Panel_register(Main *bmain, ReportList *reports, void *dat
 {
 	ARegionType *art;
 	PanelType *pt, dummypt = {NULL};
-	Panel dummypanel= {NULL};
+	Panel dummypanel = {NULL};
 	PointerRNA dummyptr;
 	int have_function[3];
 
 	/* setup dummy panel & panel type to store static properties in */
-	dummypanel.type= &dummypt;
+	dummypanel.type = &dummypt;
 	RNA_pointer_create(NULL, &RNA_Panel, &dummypanel, &dummyptr);
 
 	/* validate the python class */
-	if(validate(&dummyptr, data, have_function) != 0)
+	if (validate(&dummyptr, data, have_function) != 0)
 		return NULL;
 		
-	if(strlen(identifier) >= sizeof(dummypt.idname)) {
+	if (strlen(identifier) >= sizeof(dummypt.idname)) {
 		BKE_reportf(reports, RPT_ERROR, "registering panel class: '%s' is too long, maximum length is %d",
 		            identifier, (int)sizeof(dummypt.idname));
 		return NULL;
 	}
 	
-	if(!(art=region_type_find(reports, dummypt.space_type, dummypt.region_type)))
+	if (!(art = region_type_find(reports, dummypt.space_type, dummypt.region_type)))
 		return NULL;
 
 	/* check if we have registered this panel type before, and remove it */
-	for(pt=art->paneltypes.first; pt; pt=pt->next) {
-		if(strcmp(pt->idname, dummypt.idname) == 0) {
-			if(pt->ext.srna)
+	for (pt = art->paneltypes.first; pt; pt = pt->next) {
+		if (strcmp(pt->idname, dummypt.idname) == 0) {
+			if (pt->ext.srna)
 				rna_Panel_unregister(bmain, pt->ext.srna);
 			else
 				BLI_freelinkN(&art->paneltypes, pt);
@@ -211,27 +211,27 @@ static StructRNA *rna_Panel_register(Main *bmain, ReportList *reports, void *dat
 	}
 	
 	/* create a new panel type */
-	pt= MEM_callocN(sizeof(PanelType), "python buttons panel");
+	pt = MEM_callocN(sizeof(PanelType), "python buttons panel");
 	memcpy(pt, &dummypt, sizeof(dummypt));
 
-	pt->ext.srna= RNA_def_struct(&BLENDER_RNA, pt->idname, "Panel"); 
-	pt->ext.data= data;
-	pt->ext.call= call;
-	pt->ext.free= free;
+	pt->ext.srna = RNA_def_struct(&BLENDER_RNA, pt->idname, "Panel");
+	pt->ext.data = data;
+	pt->ext.call = call;
+	pt->ext.free = free;
 	RNA_struct_blender_type_set(pt->ext.srna, pt);
 	RNA_def_struct_flag(pt->ext.srna, STRUCT_NO_IDPROPERTIES);
 
-	pt->poll= (have_function[0])? panel_poll: NULL;
-	pt->draw= (have_function[1])? panel_draw: NULL;
-	pt->draw_header= (have_function[2])? panel_draw_header: NULL;
+	pt->poll = (have_function[0])? panel_poll: NULL;
+	pt->draw = (have_function[1])? panel_draw: NULL;
+	pt->draw_header = (have_function[2])? panel_draw_header: NULL;
 
 	/* XXX use "no header" flag for some ordering of panels until we have real panel ordering */
-	if(pt->flag & PNL_NO_HEADER) {
+	if (pt->flag & PNL_NO_HEADER) {
 		PanelType *pth = art->paneltypes.first;
-		while(pth && pth->flag & PNL_NO_HEADER)
-			pth=pth->next;
+		while (pth && pth->flag & PNL_NO_HEADER)
+			pth = pth->next;
 
-		if(pth)
+		if (pth)
 			BLI_insertlinkbefore(&art->paneltypes, pth, pt);
 		else
 			BLI_addtail(&art->paneltypes, pt);
@@ -247,7 +247,7 @@ static StructRNA *rna_Panel_register(Main *bmain, ReportList *reports, void *dat
 
 static StructRNA* rna_Panel_refine(PointerRNA *ptr)
 {
-	Panel *hdr= (Panel*)ptr->data;
+	Panel *hdr = (Panel*)ptr->data;
 	return (hdr->type && hdr->type->ext.srna)? hdr->type->ext.srna: &RNA_Panel;
 }
 
@@ -262,7 +262,7 @@ static void header_draw(const bContext *C, Header *hdr)
 	FunctionRNA *func;
 
 	RNA_pointer_create(&CTX_wm_screen(C)->id, hdr->type->ext.srna, hdr, &htr);
-	func= &rna_Header_draw_func; /* RNA_struct_find_function(&htr, "draw"); */
+	func = &rna_Header_draw_func; /* RNA_struct_find_function(&htr, "draw"); */
 
 	RNA_parameter_list_create(&list, &htr, func);
 	RNA_parameter_set_lookup(&list, "context", &C);
@@ -274,11 +274,11 @@ static void header_draw(const bContext *C, Header *hdr)
 static void rna_Header_unregister(Main *UNUSED(bmain), StructRNA *type)
 {
 	ARegionType *art;
-	HeaderType *ht= RNA_struct_blender_type_get(type);
+	HeaderType *ht = RNA_struct_blender_type_get(type);
 
-	if(!ht)
+	if (!ht)
 		return;
-	if(!(art=region_type_find(NULL, ht->space_type, RGN_TYPE_HEADER)))
+	if (!(art = region_type_find(NULL, ht->space_type, RGN_TYPE_HEADER)))
 		return;
 	
 	RNA_struct_free_extension(type, &ht->ext);
@@ -295,47 +295,47 @@ static StructRNA *rna_Header_register(Main *bmain, ReportList *reports, void *da
 {
 	ARegionType *art;
 	HeaderType *ht, dummyht = {NULL};
-	Header dummyheader= {NULL};
+	Header dummyheader = {NULL};
 	PointerRNA dummyhtr;
 	int have_function[1];
 
 	/* setup dummy header & header type to store static properties in */
-	dummyheader.type= &dummyht;
+	dummyheader.type = &dummyht;
 	RNA_pointer_create(NULL, &RNA_Header, &dummyheader, &dummyhtr);
 
 	/* validate the python class */
-	if(validate(&dummyhtr, data, have_function) != 0)
+	if (validate(&dummyhtr, data, have_function) != 0)
 		return NULL;
 
-	if(strlen(identifier) >= sizeof(dummyht.idname)) {
+	if (strlen(identifier) >= sizeof(dummyht.idname)) {
 		BKE_reportf(reports, RPT_ERROR, "registering header class: '%s' is too long, maximum length is %d",
 		            identifier, (int)sizeof(dummyht.idname));
 		return NULL;
 	}
 
-	if(!(art=region_type_find(reports, dummyht.space_type, RGN_TYPE_HEADER)))
+	if (!(art = region_type_find(reports, dummyht.space_type, RGN_TYPE_HEADER)))
 		return NULL;
 
 	/* check if we have registered this header type before, and remove it */
-	for(ht=art->headertypes.first; ht; ht=ht->next) {
-		if(strcmp(ht->idname, dummyht.idname) == 0) {
-			if(ht->ext.srna)
+	for (ht = art->headertypes.first; ht; ht = ht->next) {
+		if (strcmp(ht->idname, dummyht.idname) == 0) {
+			if (ht->ext.srna)
 				rna_Header_unregister(bmain, ht->ext.srna);
 			break;
 		}
 	}
 	
 	/* create a new header type */
-	ht= MEM_callocN(sizeof(HeaderType), "python buttons header");
+	ht = MEM_callocN(sizeof(HeaderType), "python buttons header");
 	memcpy(ht, &dummyht, sizeof(dummyht));
 
-	ht->ext.srna= RNA_def_struct(&BLENDER_RNA, ht->idname, "Header"); 
-	ht->ext.data= data;
-	ht->ext.call= call;
-	ht->ext.free= free;
+	ht->ext.srna = RNA_def_struct(&BLENDER_RNA, ht->idname, "Header");
+	ht->ext.data = data;
+	ht->ext.call = call;
+	ht->ext.free = free;
 	RNA_struct_blender_type_set(ht->ext.srna, ht);
 
-	ht->draw= (have_function[0])? header_draw: NULL;
+	ht->draw = (have_function[0])? header_draw: NULL;
 
 	BLI_addtail(&art->headertypes, ht);
 
@@ -347,7 +347,7 @@ static StructRNA *rna_Header_register(Main *bmain, ReportList *reports, void *da
 
 static StructRNA* rna_Header_refine(PointerRNA *htr)
 {
-	Header *hdr= (Header*)htr->data;
+	Header *hdr = (Header*)htr->data;
 	return (hdr->type && hdr->type->ext.srna)? hdr->type->ext.srna: &RNA_Header;
 }
 
@@ -364,14 +364,14 @@ static int menu_poll(const bContext *C, MenuType *pt)
 	int visible;
 
 	RNA_pointer_create(NULL, pt->ext.srna, NULL, &ptr); /* dummy */
-	func= &rna_Menu_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
+	func = &rna_Menu_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
 
 	RNA_parameter_list_create(&list, &ptr, func);
 	RNA_parameter_set_lookup(&list, "context", &C);
 	pt->ext.call((bContext *)C, &ptr, func, &list);
 
 	RNA_parameter_get_lookup(&list, "visible", &ret);
-	visible= *(int*)ret;
+	visible = *(int*)ret;
 
 	RNA_parameter_list_free(&list);
 
@@ -387,7 +387,7 @@ static void menu_draw(const bContext *C, Menu *hdr)
 	FunctionRNA *func;
 
 	RNA_pointer_create(&CTX_wm_screen(C)->id, hdr->type->ext.srna, hdr, &mtr);
-	func= &rna_Menu_draw_func; /* RNA_struct_find_function(&mtr, "draw"); */
+	func = &rna_Menu_draw_func; /* RNA_struct_find_function(&mtr, "draw"); */
 
 	RNA_parameter_list_create(&list, &mtr, func);
 	RNA_parameter_set_lookup(&list, "context", &C);
@@ -398,9 +398,9 @@ static void menu_draw(const bContext *C, Menu *hdr)
 
 static void rna_Menu_unregister(Main *UNUSED(bmain), StructRNA *type)
 {
-	MenuType *mt= RNA_struct_blender_type_get(type);
+	MenuType *mt = RNA_struct_blender_type_get(type);
 
-	if(!mt)
+	if (!mt)
 		return;
 	
 	RNA_struct_free_extension(type, &mt->ext);
@@ -418,59 +418,59 @@ static StructRNA *rna_Menu_register(Main *bmain, ReportList *reports, void *data
                                     StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
 {
 	MenuType *mt, dummymt = {NULL};
-	Menu dummymenu= {NULL};
+	Menu dummymenu = {NULL};
 	PointerRNA dummymtr;
 	int have_function[2];
-	size_t over_alloc= 0; /* warning, if this becomes a bess, we better do another alloc */
-	size_t description_size= 0;
+	size_t over_alloc = 0; /* warning, if this becomes a bess, we better do another alloc */
+	size_t description_size = 0;
 
 	/* setup dummy menu & menu type to store static properties in */
-	dummymenu.type= &dummymt;
-	dummymenu.type->description= _menu_descr;
+	dummymenu.type = &dummymt;
+	dummymenu.type->description = _menu_descr;
 	RNA_pointer_create(NULL, &RNA_Menu, &dummymenu, &dummymtr);
 
-	/* clear incase they are left unset */
-	_menu_descr[0]= '\0';
+	/* clear in case they are left unset */
+	_menu_descr[0] = '\0';
 
 	/* validate the python class */
-	if(validate(&dummymtr, data, have_function) != 0)
+	if (validate(&dummymtr, data, have_function) != 0)
 		return NULL;
 	
-	if(strlen(identifier) >= sizeof(dummymt.idname)) {
+	if (strlen(identifier) >= sizeof(dummymt.idname)) {
 		BKE_reportf(reports, RPT_ERROR, "registering menu class: '%s' is too long, maximum length is %d",
 		            identifier, (int)sizeof(dummymt.idname));
 		return NULL;
 	}
 
 	/* check if we have registered this menu type before, and remove it */
-	mt= WM_menutype_find(dummymt.idname, TRUE);
-	if(mt && mt->ext.srna)
+	mt = WM_menutype_find(dummymt.idname, TRUE);
+	if (mt && mt->ext.srna)
 		rna_Menu_unregister(bmain, mt->ext.srna);
 	
 	/* create a new menu type */
 	if (_menu_descr[0]) {
-		description_size= strlen(_menu_descr) + 1;
+		description_size = strlen(_menu_descr) + 1;
 		over_alloc += description_size;
 	}
 
-	mt= MEM_callocN(sizeof(MenuType) + over_alloc, "python buttons menu");
+	mt = MEM_callocN(sizeof(MenuType) + over_alloc, "python buttons menu");
 	memcpy(mt, &dummymt, sizeof(dummymt));
 
 	if (_menu_descr[0]) {
-		char *buf= (char *)(mt + 1);
+		char *buf = (char *)(mt + 1);
 		memcpy(buf, _menu_descr, description_size);
-		mt->description= buf;
+		mt->description = buf;
 	}
 
-	mt->ext.srna= RNA_def_struct(&BLENDER_RNA, mt->idname, "Menu"); 
-	mt->ext.data= data;
-	mt->ext.call= call;
-	mt->ext.free= free;
+	mt->ext.srna = RNA_def_struct(&BLENDER_RNA, mt->idname, "Menu");
+	mt->ext.data = data;
+	mt->ext.call = call;
+	mt->ext.free = free;
 	RNA_struct_blender_type_set(mt->ext.srna, mt);
 	RNA_def_struct_flag(mt->ext.srna, STRUCT_NO_IDPROPERTIES);
 
-	mt->poll= (have_function[0])? menu_poll: NULL;
-	mt->draw= (have_function[1])? menu_draw: NULL;
+	mt->poll = (have_function[0])? menu_poll: NULL;
+	mt->draw = (have_function[1])? menu_draw: NULL;
 
 	WM_menutype_add(mt);
 
@@ -482,15 +482,15 @@ static StructRNA *rna_Menu_register(Main *bmain, ReportList *reports, void *data
 
 static StructRNA* rna_Menu_refine(PointerRNA *mtr)
 {
-	Menu *hdr= (Menu*)mtr->data;
+	Menu *hdr = (Menu*)mtr->data;
 	return (hdr->type && hdr->type->ext.srna)? hdr->type->ext.srna: &RNA_Menu;
 }
 
 static void rna_Menu_bl_description_set(PointerRNA *ptr, const char *value)
 {
-	Menu *data= (Menu*)(ptr->data);
-	char *str= (char *)data->type->description;
-	if(!str[0])	BLI_strncpy(str, value, RNA_DYN_DESCR_MAX);  /* utf8 already ensured */
+	Menu *data = (Menu*)(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 menu");
 }
 
@@ -586,7 +586,7 @@ static void rna_UILayout_scale_y_set(PointerRNA *ptr, float value)
 	uiLayoutSetScaleY(ptr->data, value);
 }
 
-#else // RNA_RUNTIME
+#else /* RNA_RUNTIME */
 
 static void rna_def_ui_layout(BlenderRNA *brna)
 {
@@ -602,38 +602,38 @@ static void rna_def_ui_layout(BlenderRNA *brna)
 	
 	/* layout */
 
-	srna= RNA_def_struct(brna, "UILayout", NULL);
+	srna = RNA_def_struct(brna, "UILayout", NULL);
 	RNA_def_struct_sdna(srna, "uiLayout");
 	RNA_def_struct_ui_text(srna, "UI Layout", "User interface layout in a panel or header");
 
-	prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_UILayout_active_get", "rna_UILayout_active_set");
 	
-	prop= RNA_def_property(srna, "operator_context", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "operator_context", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, operator_context_items);
 	RNA_def_property_enum_funcs(prop, "rna_UILayout_op_context_get", "rna_UILayout_op_context_set", NULL);
 	
-	prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_UILayout_enabled_get", "rna_UILayout_enabled_set");
 	RNA_def_property_ui_text(prop, "Enabled", "When false, this (sub)layout is greyed out");
 	
-	prop= RNA_def_property(srna, "alert", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "alert", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_UILayout_alert_get", "rna_UILayout_alert_set");
 
-	prop= RNA_def_property(srna, "alignment", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "alignment", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, alignment_items);
 	RNA_def_property_enum_funcs(prop, "rna_UILayout_alignment_get", "rna_UILayout_alignment_set", NULL);
 
 #if 0
-	prop= RNA_def_property(srna, "keep_aspect", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "keep_aspect", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_UILayout_keep_aspect_get", "rna_UILayout_keep_aspect_set");
 #endif
 
-	prop= RNA_def_property(srna, "scale_x", PROP_FLOAT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "scale_x", PROP_FLOAT, PROP_UNSIGNED);
 	RNA_def_property_float_funcs(prop, "rna_UILayout_scale_x_get", "rna_UILayout_scale_x_set", NULL);
 	RNA_def_property_ui_text(prop, "Scale X", "Scale factor along the X for items in this (sub)layout");
 	
-	prop= RNA_def_property(srna, "scale_y", PROP_FLOAT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "scale_y", PROP_FLOAT, PROP_UNSIGNED);
 	RNA_def_property_float_funcs(prop, "rna_UILayout_scale_y_get", "rna_UILayout_scale_y_set", NULL);
 	RNA_def_property_ui_text(prop, "Scale Y", "Scale factor along the Y for items in this (sub)layout");
 	RNA_api_ui_layout(srna);
@@ -654,43 +654,43 @@ static void rna_def_panel(BlenderRNA *brna)
 			                "arrow to collapse the panel and the label (see bl_label)"},
 			{0, NULL, 0, NULL, NULL}};
 	
-	srna= RNA_def_struct(brna, "Panel", NULL);
+	srna = RNA_def_struct(brna, "Panel", NULL);
 	RNA_def_struct_ui_text(srna, "Panel", "Panel containing UI elements");
 	RNA_def_struct_sdna(srna, "Panel");
 	RNA_def_struct_refine_func(srna, "rna_Panel_refine");
 	RNA_def_struct_register_funcs(srna, "rna_Panel_register", "rna_Panel_unregister", NULL);
 
 	/* poll */
-	func= RNA_def_function(srna, "poll", NULL);
+	func = RNA_def_function(srna, "poll", NULL);
 	RNA_def_function_ui_description(func, "If this method returns a non-null output, then the panel can be drawn");
 	RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_REGISTER_OPTIONAL);
 	RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
-	parm= RNA_def_pointer(func, "context", "Context", "", "");
+	parm = RNA_def_pointer(func, "context", "Context", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
 	/* draw */
-	func= RNA_def_function(srna, "draw", NULL);
+	func = RNA_def_function(srna, "draw", NULL);
 	RNA_def_function_ui_description(func, "Draw UI elements into the panel UI layout");
 	RNA_def_function_flag(func, FUNC_REGISTER);
-	parm= RNA_def_pointer(func, "context", "Context", "", "");
+	parm = RNA_def_pointer(func, "context", "Context", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "draw_header", NULL);
+	func = RNA_def_function(srna, "draw_header", NULL);
 	RNA_def_function_ui_description(func, "Draw UI elements into the panel's header UI layout");
 	RNA_def_function_flag(func, FUNC_REGISTER);
-	parm= RNA_def_pointer(func, "context", "Context", "", "");
+	parm = RNA_def_pointer(func, "context", "Context", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	prop= RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "UILayout");
 	RNA_def_property_ui_text(prop, "Layout", "Defines the structure of the panel in the UI");
 	
-	prop= RNA_def_property(srna, "text", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "text", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "drawname");
 	RNA_def_property_ui_text(prop, "Text", "XXX todo");
 	
 	/* registration */
-	prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "type->idname");
 	RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP);
 	RNA_def_property_ui_text(prop, "ID Name",
@@ -698,34 +698,37 @@ static void rna_def_panel(BlenderRNA *brna)
 	                         "name of the class used to define the panel. For example, if the "
 	                         "class name is \"OBJECT_PT_hello\", and bl_idname is not set by the "
 	                         "script, then bl_idname = \"OBJECT_PT_hello\"");
-	
-	prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
+
+	/* panel's label indeed doesn't need PROP_TRANSLATE flag: translation of label happens in runtime
+	 * when drawing panel and having this flag set will make runtime switching of language much more tricky
+	 * because label will be stored translated */
+	prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "type->label");
 	RNA_def_property_flag(prop, PROP_REGISTER);
 	RNA_def_property_ui_text(prop, "Label",
 	                         "The panel label, shows up in the panel header at the right of the "
 	                         "triangle used to collapse the panel");
 	
-	prop= RNA_def_property(srna, "bl_space_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "bl_space_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type->space_type");
 	RNA_def_property_enum_items(prop, space_type_items);
 	RNA_def_property_flag(prop, PROP_REGISTER);
 	RNA_def_property_ui_text(prop, "Space type", "The space where the panel is going to be used in");
 	
-	prop= RNA_def_property(srna, "bl_region_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "bl_region_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type->region_type");
 	RNA_def_property_enum_items(prop, region_type_items);
 	RNA_def_property_flag(prop, PROP_REGISTER);
 	RNA_def_property_ui_text(prop, "Region Type", "The region where the panel is going to be used in");
 
-	prop= RNA_def_property(srna, "bl_context", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "bl_context", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "type->context");
 	RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); /* should this be optional? - Campbell */
 	RNA_def_property_ui_text(prop, "Context",
 	                         "The context in which the panel belongs to. (TODO: explain the "
 	                         "possible combinations bl_context/bl_region_type/bl_space_type)");
 	
-	prop= RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type->flag");
 	RNA_def_property_enum_items(prop, panel_flag_items);
 	RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL|PROP_ENUM_FLAG);
@@ -739,28 +742,28 @@ static void rna_def_header(BlenderRNA *brna)
 	PropertyRNA *parm;
 	FunctionRNA *func;
 	
-	srna= RNA_def_struct(brna, "Header", NULL);
+	srna = RNA_def_struct(brna, "Header", NULL);
 	RNA_def_struct_ui_text(srna, "Header", "Editor header containing UI elements");
 	RNA_def_struct_sdna(srna, "Header");
 	RNA_def_struct_refine_func(srna, "rna_Header_refine");
 	RNA_def_struct_register_funcs(srna, "rna_Header_register", "rna_Header_unregister", NULL);
 
 	/* draw */
-	func= RNA_def_function(srna, "draw", NULL);
+	func = RNA_def_function(srna, "draw", NULL);
 	RNA_def_function_ui_description(func, "Draw UI elements into the header UI layout");
 	RNA_def_function_flag(func, FUNC_REGISTER);
-	parm= RNA_def_pointer(func, "context", "Context", "", "");
+	parm = RNA_def_pointer(func, "context", "Context", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	RNA_define_verify_sdna(0); // not in sdna
+	RNA_define_verify_sdna(0); /* not in sdna */
 
-	prop= RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "layout");
 	RNA_def_property_struct_type(prop, "UILayout");
 	RNA_def_property_ui_text(prop, "Layout", "Structure of the header in the UI");
 
 	/* registration */
-	prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "type->idname");
 	RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP);
 	RNA_def_property_ui_text(prop, "ID Name",
@@ -769,7 +772,7 @@ static void rna_def_header(BlenderRNA *brna)
 	                         "class name is \"OBJECT_HT_hello\", and bl_idname is not set by the "
 	                         "script, then bl_idname = \"OBJECT_HT_hello\"");
 
-	prop= RNA_def_property(srna, "bl_space_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "bl_space_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type->space_type");
 	RNA_def_property_enum_items(prop, space_type_items);
 	RNA_def_property_flag(prop, PROP_REGISTER);
@@ -785,36 +788,36 @@ static void rna_def_menu(BlenderRNA *brna)
 	PropertyRNA *parm;
 	FunctionRNA *func;
 	
-	srna= RNA_def_struct(brna, "Menu", NULL);
+	srna = RNA_def_struct(brna, "Menu", NULL);
 	RNA_def_struct_ui_text(srna, "Menu", "Editor menu containing buttons");
 	RNA_def_struct_sdna(srna, "Menu");
 	RNA_def_struct_refine_func(srna, "rna_Menu_refine");
 	RNA_def_struct_register_funcs(srna, "rna_Menu_register", "rna_Menu_unregister", NULL);
 
 	/* poll */
-	func= RNA_def_function(srna, "poll", NULL);
+	func = RNA_def_function(srna, "poll", NULL);
 	RNA_def_function_ui_description(func, "If this method returns a non-null output, then the menu can be drawn");
 	RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_REGISTER_OPTIONAL);
 	RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
-	parm= RNA_def_pointer(func, "context", "Context", "", "");
+	parm = RNA_def_pointer(func, "context", "Context", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
 	/* draw */
-	func= RNA_def_function(srna, "draw", NULL);
+	func = RNA_def_function(srna, "draw", NULL);
 	RNA_def_function_ui_description(func, "Draw UI elements into the menu UI layout");
 	RNA_def_function_flag(func, FUNC_REGISTER);
-	parm= RNA_def_pointer(func, "context", "Context", "", "");
+	parm = RNA_def_pointer(func, "context", "Context", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	RNA_define_verify_sdna(0); // not in sdna
+	RNA_define_verify_sdna(0); /* not in sdna */
 
-	prop= RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "layout");
 	RNA_def_property_struct_type(prop, "UILayout");
 	RNA_def_property_ui_text(prop, "Layout", "Defines the structure of the menu in the UI");
 
 	/* registration */
-	prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "type->idname");
 	RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP);
 	RNA_def_property_ui_text(prop, "ID Name",
@@ -823,17 +826,21 @@ static void rna_def_menu(BlenderRNA *brna)
 	                         "class name is \"OBJECT_MT_hello\", and bl_idname is not set by the "
 	                         "script, then bl_idname = \"OBJECT_MT_hello\")");
 
-	prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE);
+	/* menu's label indeed doesn't need PROP_TRANSLATE flag: translation of label happens in runtime
+	 * when drawing panel and having this flag set will make runtime switching of language much more tricky
+	 * because label will be stored translated */
+	prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "type->label");
 	RNA_def_property_flag(prop, PROP_REGISTER);
 	RNA_def_property_ui_text(prop, "Label", "The menu label");
 
-	prop= RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATE);
+	prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATE);
 	RNA_def_property_string_sdna(prop, NULL, "type->description");
 	RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Menu_bl_description_set");
-	// RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+	/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
 	RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+	RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
 
 	RNA_define_verify_sdna(1);
 }
@@ -846,5 +853,5 @@ void RNA_def_ui(BlenderRNA *brna)
 	rna_def_menu(brna);
 }
 
-#endif // RNA_RUNTIME
+#endif /* RNA_RUNTIME */
 
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index 96667c9..b4b8ee0 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.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
@@ -18,7 +18,7 @@
  * The Original Code is Copyright (C) 2009 Blender Foundation.
  * All rights reserved.
  *
- * 
+ *
  * Contributor(s): Blender Foundation
  *
  * ***** END GPL LICENSE BLOCK *****
@@ -38,12 +38,14 @@
 
 #ifdef RNA_RUNTIME
 
-static void rna_uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *name, int icon, int expand, int slider, int toggle, int icon_only, int event, int full_event, int emboss, int index)
+static void rna_uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *name, int icon,
+                        int expand, int slider, int toggle, int icon_only, int event, int full_event,
+                        int emboss, int index)
 {
-	PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
-	int flag= 0;
+	PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
+	int flag = 0;
 
-	if(!prop) {
+	if (!prop) {
 		RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
 		return;
 	}
@@ -61,7 +63,7 @@ static void rna_uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname,
 
 static PointerRNA rna_uiItemO(uiLayout *layout, const char *opname, const char *name, int icon, int emboss)
 {
-	int flag= UI_ITEM_O_RETURN_PROPS;
+	int flag = UI_ITEM_O_RETURN_PROPS;
 	flag |= (emboss)? 0: UI_ITEM_R_NO_BG;
 	return uiItemFullO(layout, opname, name, icon, NULL, uiLayoutGetOperatorContext(layout), flag);
 }
@@ -84,7 +86,7 @@ static void api_ui_item_common(FunctionRNA *func)
 
 	RNA_def_string_translate(func, "text", "", 0, "", "Override automatic text of the item");
 
-	prop= RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, icon_items);
 	RNA_def_property_ui_text(prop, "Icon", "Override automatic icon of the item");
 
@@ -93,7 +95,7 @@ static void api_ui_item_common(FunctionRNA *func)
 static void api_ui_item_op(FunctionRNA *func)
 {
 	PropertyRNA *parm;
-	parm= RNA_def_string(func, "operator", "", 0, "", "Identifier of the operator");
+	parm = RNA_def_string(func, "operator", "", 0, "", "Identifier of the operator");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 }
 
@@ -107,9 +109,9 @@ static void api_ui_item_rna_common(FunctionRNA *func)
 {
 	PropertyRNA *parm;
 
-	parm= RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
+	parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
-	parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in data");
+	parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 }
 
@@ -131,40 +133,44 @@ void RNA_api_ui_layout(StructRNA *srna)
 		{0, NULL, 0, NULL, NULL}};
 
 	/* simple layout specifiers */
-	func= RNA_def_function(srna, "row", "uiLayoutRow");
-	parm= RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
+	func = RNA_def_function(srna, "row", "uiLayoutRow");
+	parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
 	RNA_def_function_return(func, parm);
-	RNA_def_function_ui_description(func, "Sub-layout. Items placed in this sublayout are placed next to each other in a row");
+	RNA_def_function_ui_description(func,
+	                                "Sub-layout. Items placed in this sublayout are placed next to each other "
+	                                "in a row");
 	RNA_def_boolean(func, "align", 0, "", "Align buttons to each other");
 	
-	func= RNA_def_function(srna, "column", "uiLayoutColumn");
-	parm= RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
+	func = RNA_def_function(srna, "column", "uiLayoutColumn");
+	parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
 	RNA_def_function_return(func, parm);
-	RNA_def_function_ui_description(func, "Sub-layout. Items placed in this sublayout are placed under each other in a column");
+	RNA_def_function_ui_description(func,
+	                                "Sub-layout. Items placed in this sublayout are placed under each other "
+	                                "in a column");
 	RNA_def_boolean(func, "align", 0, "", "Align buttons to each other");
 
-	func= RNA_def_function(srna, "column_flow", "uiLayoutColumnFlow");
+	func = RNA_def_function(srna, "column_flow", "uiLayoutColumnFlow");
 	RNA_def_int(func, "columns", 0, 0, INT_MAX, "", "Number of columns, 0 is automatic", 0, INT_MAX);
-	parm= RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
+	parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
 	RNA_def_function_return(func, parm);
 	RNA_def_boolean(func, "align", 0, "", "Align buttons to each other");
 
 	/* box layout */
-	func= RNA_def_function(srna, "box", "uiLayoutBox");
-	parm= RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
+	func = RNA_def_function(srna, "box", "uiLayoutBox");
+	parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
 	RNA_def_function_return(func, parm);
 	RNA_def_function_ui_description(func, "Sublayout (items placed in this sublayout are placed "
 	                                      "under each other in a column and are surrounded by a box)");
 	
 	/* split layout */
-	func= RNA_def_function(srna, "split", "uiLayoutSplit");
-	parm= RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
+	func = RNA_def_function(srna, "split", "uiLayoutSplit");
+	parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
 	RNA_def_function_return(func, parm);
 	RNA_def_float(func, "percentage", 0.0f, 0.0f, 1.0f, "Percentage", "Percentage of width to split at", 0.0f, 1.0f);
 	RNA_def_boolean(func, "align", 0, "", "Align buttons to each other");
 
 	/* items */
-	func= RNA_def_function(srna, "prop", "rna_uiItemR");
+	func = RNA_def_function(srna, "prop", "rna_uiItemR");
 	RNA_def_function_ui_description(func, "Item. Exposes an RNA item and places it into the layout");
 	api_ui_item_rna_common(func);
 	api_ui_item_common(func);
@@ -179,31 +185,31 @@ void RNA_api_ui_layout(StructRNA *srna)
 	            "The index of this button, when set a single member of an array can be accessed, "
 	            "when set to -1 all array members are used", -2, INT_MAX); /* RNA_NO_INDEX == -1 */
 
-	func= RNA_def_function(srna, "props_enum", "uiItemsEnumR");
+	func = RNA_def_function(srna, "props_enum", "uiItemsEnumR");
 	api_ui_item_rna_common(func);
 
-	func= RNA_def_function(srna, "prop_menu_enum", "uiItemMenuEnumR");
+	func = RNA_def_function(srna, "prop_menu_enum", "uiItemMenuEnumR");
 	api_ui_item_rna_common(func);
 	api_ui_item_common(func);
 
-	func= RNA_def_function(srna, "prop_enum", "uiItemEnumR_string");
+	func = RNA_def_function(srna, "prop_enum", "uiItemEnumR_string");
 	api_ui_item_rna_common(func);
-	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);
 	api_ui_item_common(func);
 
-	func= RNA_def_function(srna, "prop_search", "uiItemPointerR");
+	func = RNA_def_function(srna, "prop_search", "uiItemPointerR");
 	api_ui_item_rna_common(func);
-	parm= RNA_def_pointer(func, "search_data", "AnyType", "", "Data from which to take collection to search in");
+	parm = RNA_def_pointer(func, "search_data", "AnyType", "", "Data from which to take collection to search in");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
-	parm= RNA_def_string(func, "search_property", "", 0, "", "Identifier of search collection property");
+	parm = RNA_def_string(func, "search_property", "", 0, "", "Identifier of search collection property");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	api_ui_item_common(func);
 
-	func= RNA_def_function(srna, "operator", "rna_uiItemO");
+	func = RNA_def_function(srna, "operator", "rna_uiItemO");
 	api_ui_item_op_common(func);
 	RNA_def_boolean(func, "emboss", 1, "", "Draw the button itself, just the icon/text");
-	parm= RNA_def_pointer(func, "properties", "OperatorProperties", "",
+	parm = RNA_def_pointer(func, "properties", "OperatorProperties", "",
 	                      "Operator properties to fill in, return when 'properties' is set to true");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR);
 	RNA_def_function_return(func, parm);
@@ -216,15 +222,15 @@ void RNA_api_ui_layout(StructRNA *srna)
 	parm= RNA_def_string(func, "value", "", 0, "", "Enum property value");
 	RNA_def_property_flag(parm, PROP_REQUIRED); */
 
-	func= RNA_def_function(srna, "operator_enum", "uiItemsEnumO");
-	parm= RNA_def_string(func, "operator", "", 0, "", "Identifier of the operator");
+	func = RNA_def_function(srna, "operator_enum", "uiItemsEnumO");
+	parm = RNA_def_string(func, "operator", "", 0, "", "Identifier of the operator");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	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);
 
-	func= RNA_def_function(srna, "operator_menu_enum", "uiItemMenuEnumO");
+	func = RNA_def_function(srna, "operator_menu_enum", "uiItemMenuEnumO");
 	api_ui_item_op(func); /* cant use api_ui_item_op_common because property must come right after */
-	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);
 	api_ui_item_common(func);
 
@@ -258,39 +264,39 @@ void RNA_api_ui_layout(StructRNA *srna)
 	parm= RNA_def_string(func, "value", "", 0, "", "Value of the property to call the operator with");
 	RNA_def_property_flag(parm, PROP_REQUIRED); */
 
-	func= RNA_def_function(srna, "label", "uiItemL");
+	func = RNA_def_function(srna, "label", "uiItemL");
 	RNA_def_function_ui_description(func, "Item. Display text in the layout");
 	api_ui_item_common(func);
 
-	func= RNA_def_function(srna, "menu", "uiItemM");
+	func = RNA_def_function(srna, "menu", "uiItemM");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
-	parm= RNA_def_string(func, "menu", "", 0, "", "Identifier of the menu");
+	parm = RNA_def_string(func, "menu", "", 0, "", "Identifier of the menu");
 	api_ui_item_common(func);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	func= RNA_def_function(srna, "separator", "uiItemS");
+	func = RNA_def_function(srna, "separator", "uiItemS");
 	RNA_def_function_ui_description(func, "Item. Inserts empty space into the layout between items");
 
 	/* context */
-	func= RNA_def_function(srna, "context_pointer_set", "uiLayoutSetContextPointer");
-	parm= RNA_def_string(func, "name", "", 0, "Name", "Name of entry in the context");
+	func = RNA_def_function(srna, "context_pointer_set", "uiLayoutSetContextPointer");
+	parm = RNA_def_string(func, "name", "", 0, "Name", "Name of entry in the context");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_pointer(func, "data", "AnyType", "", "Pointer to put in context");
+	parm = RNA_def_pointer(func, "data", "AnyType", "", "Pointer to put in context");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR);
 	
 	/* templates */
-	func= RNA_def_function(srna, "template_header", "uiTemplateHeader");
+	func = RNA_def_function(srna, "template_header", "uiTemplateHeader");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
 	RNA_def_boolean(func, "menus", 1, "", "The header has menus, and should show menu expander");
 
-	func= RNA_def_function(srna, "template_ID", "uiTemplateID");
+	func = RNA_def_function(srna, "template_ID", "uiTemplateID");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
 	api_ui_item_rna_common(func);
 	RNA_def_string(func, "new", "", 0, "", "Operator identifier to create a new ID block");
 	RNA_def_string(func, "open", "", 0, "", "Operator identifier to open a file for creating a new ID block");
 	RNA_def_string(func, "unlink", "", 0, "", "Operator identifier to unlink the ID block");
 	
-	func= RNA_def_function(srna, "template_ID_preview", "uiTemplateIDPreview");
+	func = RNA_def_function(srna, "template_ID_preview", "uiTemplateIDPreview");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
 	api_ui_item_rna_common(func);
 	RNA_def_string(func, "new", "", 0, "", "Operator identifier to create a new ID block");
@@ -299,82 +305,82 @@ void RNA_api_ui_layout(StructRNA *srna)
 	RNA_def_int(func, "rows", 0, 0, INT_MAX, "Number of thumbnail preview rows to display", "", 0, INT_MAX);
 	RNA_def_int(func, "cols", 0, 0, INT_MAX, "Number of thumbnail preview columns to display", "", 0, INT_MAX);
 	
-	func= RNA_def_function(srna, "template_any_ID", "uiTemplateAnyID");
-	parm= RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
+	func = RNA_def_function(srna, "template_any_ID", "uiTemplateAnyID");
+	parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
-	parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in data");
+	parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_string(func, "type_property", "", 0, "",
+	parm = RNA_def_string(func, "type_property", "", 0, "",
 	                     "Identifier of property in data giving the type of the ID-blocks to use");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_string_translate(func, "text", "", 0, "", "Custom label to display in UI");
 	
-	func= RNA_def_function(srna, "template_path_builder", "uiTemplatePathBuilder");
-	parm= RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
+	func = RNA_def_function(srna, "template_path_builder", "uiTemplatePathBuilder");
+	parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
-	parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in data");
+	parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_pointer(func, "root", "ID", "", "ID-block from which path is evaluated from");
+	parm = RNA_def_pointer(func, "root", "ID", "", "ID-block from which path is evaluated from");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR);
 	RNA_def_string_translate(func, "text", "", 0, "", "Custom label to display in UI");
 	
-	func= RNA_def_function(srna, "template_modifier", "uiTemplateModifier");
+	func = RNA_def_function(srna, "template_modifier", "uiTemplateModifier");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
 	RNA_def_function_ui_description(func, "Layout . Generates the UI layout for modifiers");
-	parm= RNA_def_pointer(func, "data", "Modifier", "", "Modifier data");
+	parm = RNA_def_pointer(func, "data", "Modifier", "", "Modifier data");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
-	parm= RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
+	parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "template_constraint", "uiTemplateConstraint");
+	func = RNA_def_function(srna, "template_constraint", "uiTemplateConstraint");
 	RNA_def_function_ui_description(func, "Layout . Generates the UI layout for constraints");
-	parm= RNA_def_pointer(func, "data", "Constraint", "", "Constraint data");
+	parm = RNA_def_pointer(func, "data", "Constraint", "", "Constraint data");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
-	parm= RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
+	parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "template_preview", "uiTemplatePreview");
-	RNA_def_function_ui_description(func, "Item. A preview window for materials, textures, lamps, etc.");
-	parm= RNA_def_pointer(func, "id", "ID", "", "ID datablock");
+	func = RNA_def_function(srna, "template_preview", "uiTemplatePreview");
+	RNA_def_function_ui_description(func, "Item. A preview window for materials, textures, lamps, etc");
+	parm = RNA_def_pointer(func, "id", "ID", "", "ID datablock");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_boolean(func, "show_buttons", 1, "", "Show preview buttons?");
 	RNA_def_pointer(func, "parent", "ID", "", "ID datablock");
 	RNA_def_pointer(func, "slot", "TextureSlot", "", "Texture slot");
 
-	func= RNA_def_function(srna, "template_curve_mapping", "uiTemplateCurveMapping");
+	func = RNA_def_function(srna, "template_curve_mapping", "uiTemplateCurveMapping");
 	RNA_def_function_ui_description(func, "Item. A curve mapping widget used for e.g falloff curves for lamps");
 	api_ui_item_rna_common(func);
 	RNA_def_enum(func, "type", curve_type_items, 0, "Type", "Type of curves to display");
 	RNA_def_boolean(func, "levels", 0, "", "Show black/white levels");
 	RNA_def_boolean(func, "brush", 0, "", "Show brush options");
 
-	func= RNA_def_function(srna, "template_color_ramp", "uiTemplateColorRamp");
+	func = RNA_def_function(srna, "template_color_ramp", "uiTemplateColorRamp");
 	RNA_def_function_ui_description(func, "Item. A color ramp widget");
 	api_ui_item_rna_common(func);
 	RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail");
 	
-	func= RNA_def_function(srna, "template_histogram", "uiTemplateHistogram");
+	func = RNA_def_function(srna, "template_histogram", "uiTemplateHistogram");
 	RNA_def_function_ui_description(func, "Item. A histogramm widget to analyze imaga data");
 	api_ui_item_rna_common(func);
 	
-	func= RNA_def_function(srna, "template_waveform", "uiTemplateWaveform");
+	func = RNA_def_function(srna, "template_waveform", "uiTemplateWaveform");
 	RNA_def_function_ui_description(func, "Item. A waveform widget to analyze imaga data");
 	api_ui_item_rna_common(func);
 	
-	func= RNA_def_function(srna, "template_vectorscope", "uiTemplateVectorscope");
+	func = RNA_def_function(srna, "template_vectorscope", "uiTemplateVectorscope");
 	RNA_def_function_ui_description(func, "Item. A vectorscope widget to analyze imaga data");
 	api_ui_item_rna_common(func);
 	
-	func= RNA_def_function(srna, "template_layers", "uiTemplateLayers");
+	func = RNA_def_function(srna, "template_layers", "uiTemplateLayers");
 	api_ui_item_rna_common(func);
-	parm= RNA_def_pointer(func, "used_layers_data", "AnyType", "", "Data from which to take property");
+	parm = RNA_def_pointer(func, "used_layers_data", "AnyType", "", "Data from which to take property");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR);
-	parm= RNA_def_string(func, "used_layers_property", "", 0, "", "Identifier of property in data");
+	parm = RNA_def_string(func, "used_layers_property", "", 0, "", "Identifier of property in data");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_int(func, "active_layer", 0, 0, INT_MAX, "Active Layer", "", 0, INT_MAX);
+	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_wheel", "uiTemplateColorWheel");
 	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");
@@ -382,55 +388,57 @@ void RNA_api_ui_layout(StructRNA *srna)
 	RNA_def_boolean(func, "lock_luminosity", 0, "", "Keep the color at its original vector length");
 	RNA_def_boolean(func, "cubic", 1, "", "Cubic saturation for picking values close to white");
 
-	func= RNA_def_function(srna, "template_image_layers", "uiTemplateImageLayers");
+	func = RNA_def_function(srna, "template_image_layers", "uiTemplateImageLayers");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
-	parm= RNA_def_pointer(func, "image", "Image", "", "");
+	parm = RNA_def_pointer(func, "image", "Image", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_pointer(func, "image_user", "ImageUser", "", "");
+	parm = RNA_def_pointer(func, "image_user", "ImageUser", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	func= RNA_def_function(srna, "template_image", "uiTemplateImage");
+	func = RNA_def_function(srna, "template_image", "uiTemplateImage");
 	RNA_def_function_ui_description(func, "Item(s). User interface for selecting images and their source paths");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
 	api_ui_item_rna_common(func);
-	parm= RNA_def_pointer(func, "image_user", "ImageUser", "", "");
+	parm = RNA_def_pointer(func, "image_user", "ImageUser", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
 	RNA_def_boolean(func, "compact", 0, "", "Use more compact layout");
 
-	func= RNA_def_function(srna, "template_image_settings", "uiTemplateImageSettings");
+	func = RNA_def_function(srna, "template_image_settings", "uiTemplateImageSettings");
 	RNA_def_function_ui_description(func, "User interface for setting image format options");
-	parm= RNA_def_pointer(func, "image_settings", "ImageFormatSettings", "", "");
+	parm = RNA_def_pointer(func, "image_settings", "ImageFormatSettings", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "template_movieclip", "uiTemplateMovieClip");
+	func = RNA_def_function(srna, "template_movieclip", "uiTemplateMovieClip");
 	RNA_def_function_ui_description(func, "Item(s). User interface for selecting movie clips and their source paths");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
 	api_ui_item_rna_common(func);
 	RNA_def_boolean(func, "compact", 0, "", "Use more compact layout");
 
-	func= RNA_def_function(srna, "template_track", "uiTemplateTrack");
+	func = RNA_def_function(srna, "template_track", "uiTemplateTrack");
 	RNA_def_function_ui_description(func, "Item. A movie-track widget to preview tracking image.");
 	api_ui_item_rna_common(func);
 
-	func= RNA_def_function(srna, "template_marker", "uiTemplateMarker");
+	func = RNA_def_function(srna, "template_marker", "uiTemplateMarker");
 	RNA_def_function_ui_description(func, "Item. A widget to control single marker settings.");
 	api_ui_item_rna_common(func);
-	parm= RNA_def_pointer(func, "clip_user", "MovieClipUser", "", "");
+	parm = RNA_def_pointer(func, "clip_user", "MovieClipUser", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
-	parm= RNA_def_pointer(func, "track", "MovieTrackingTrack", "", "");
+	parm = RNA_def_pointer(func, "track", "MovieTrackingTrack", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
 	RNA_def_boolean(func, "compact", 0, "", "Use more compact layout");
 
-	func= RNA_def_function(srna, "template_list", "uiTemplateList");
+	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_flag(func, FUNC_USE_CONTEXT);
-	parm= RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
+	parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR);
-	parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in data");
+	parm = RNA_def_string(func, "property", "", 0, "", "Identifier of property in data");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_pointer(func, "active_data", "AnyType", "", "Data from which to take property for the active element");
+	parm = RNA_def_pointer(func, "active_data", "AnyType", "",
+	                       "Data from which to take property for the active element");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
-	parm= RNA_def_string(func, "active_property", "", 0, "", "Identifier of property in data, for the active element");
+	parm = RNA_def_string(func, "active_property", "", 0, "",
+	                      "Identifier of property in data, for the active element");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_string(func, "prop_list", "", 0, "",
 	               "Identifier of a string property in each data member, specifying which "
@@ -440,47 +448,47 @@ void RNA_api_ui_layout(StructRNA *srna)
 	RNA_def_int(func, "maxrows", 5, 0, INT_MAX, "", "Maximum number of rows to display", 0, INT_MAX);
 	RNA_def_enum(func, "type", list_type_items, 0, "Type", "Type of list to use");
 
-	func= RNA_def_function(srna, "template_running_jobs", "uiTemplateRunningJobs");
+	func = RNA_def_function(srna, "template_running_jobs", "uiTemplateRunningJobs");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
 
 	RNA_def_function(srna, "template_operator_search", "uiTemplateOperatorSearch");
 
-	func= RNA_def_function(srna, "template_header_3D", "uiTemplateHeader3D");
+	func = RNA_def_function(srna, "template_header_3D", "uiTemplateHeader3D");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
 
-	func= RNA_def_function(srna, "template_edit_mode_selection", "uiTemplateEditModeSelection");
+	func = RNA_def_function(srna, "template_edit_mode_selection", "uiTemplateEditModeSelection");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
 	
-	func= RNA_def_function(srna, "template_reports_banner", "uiTemplateReportsBanner");
+	func = RNA_def_function(srna, "template_reports_banner", "uiTemplateReportsBanner");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
 
-	func= RNA_def_function(srna, "template_node_link", "uiTemplateNodeLink");
-	parm= RNA_def_pointer(func, "ntree", "NodeTree", "", "");
+	func = RNA_def_function(srna, "template_node_link", "uiTemplateNodeLink");
+	parm = RNA_def_pointer(func, "ntree", "NodeTree", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_pointer(func, "node", "Node", "", "");
+	parm = RNA_def_pointer(func, "node", "Node", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_pointer(func, "socket", "NodeSocket", "", "");
+	parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	func= RNA_def_function(srna, "template_node_view", "uiTemplateNodeView");
+	func = RNA_def_function(srna, "template_node_view", "uiTemplateNodeView");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
-	parm= RNA_def_pointer(func, "ntree", "NodeTree", "", "");
+	parm = RNA_def_pointer(func, "ntree", "NodeTree", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_pointer(func, "node", "Node", "", "");
+	parm = RNA_def_pointer(func, "node", "Node", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_pointer(func, "socket", "NodeSocket", "", "");
+	parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	func= RNA_def_function(srna, "template_texture_user", "uiTemplateTextureUser");
+	func = RNA_def_function(srna, "template_texture_user", "uiTemplateTextureUser");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
 
-	func= RNA_def_function(srna, "template_keymap_item_properties", "uiTemplateKeymapItemProperties");
-	parm= RNA_def_pointer(func, "item", "KeyMapItem", "", "");
+	func = RNA_def_function(srna, "template_keymap_item_properties", "uiTemplateKeymapItemProperties");
+	parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
 
-	func= RNA_def_function(srna, "introspect", "uiLayoutIntrospect");
-	parm= RNA_def_string(func, "string", "", 1024*1024, "Descr", "DESCR");
+	func = RNA_def_function(srna, "introspect", "uiLayoutIntrospect");
+	parm = RNA_def_string(func, "string", "", 1024*1024, "Descr", "DESCR");
 	RNA_def_function_return(func, parm);
 }
-#endif
 
+#endif
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index f7c8558..ae236da 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -43,6 +43,7 @@
 #include "WM_types.h"
 
 #include "BLI_utildefines.h"
+
 #include "BLF_translation.h"
 
 #include "BKE_sound.h"
@@ -105,12 +106,12 @@ static void rna_userdef_show_manipulator_update(Main *bmain, Scene *scene, Point
 	SpaceLink *sl;
 
 	/* from scene copy to the other views */
-	for(sc=bmain->screen.first; sc; sc=sc->id.next) {
-		for(sa=sc->areabase.first; sa; sa=sa->next) {
-			for(sl=sa->spacedata.first; sl; sl=sl->next) {
-				if(sl->spacetype==SPACE_VIEW3D) {
-					View3D *v3d= (View3D *)sl;
-					if(userdef->tw_flag & V3D_USE_MANIPULATOR)
+	for (sc = bmain->screen.first; sc; sc = sc->id.next) {
+		for (sa = sc->areabase.first; sa; sa = sa->next) {
+			for (sl = sa->spacedata.first; sl; sl = sl->next) {
+				if (sl->spacetype == SPACE_VIEW3D) {
+					View3D *v3d = (View3D *)sl;
+					if (userdef->tw_flag & V3D_USE_MANIPULATOR)
 						v3d->twflag |= V3D_USE_MANIPULATOR;
 					else
 						v3d->twflag &= ~V3D_USE_MANIPULATOR;
@@ -158,7 +159,7 @@ static void rna_userdef_select_mouse_set(PointerRNA *ptr,int value)
 {
 	UserDef *userdef = (UserDef*)ptr->data;
 
-	if(value) {
+	if (value) {
 		userdef->flag |= USER_LMOUSESELECT;
 		userdef->flag &= ~USER_TWOBUTTONMOUSE;
 	}
@@ -171,7 +172,7 @@ static int rna_userdef_autokeymode_get(PointerRNA *ptr)
 	UserDef *userdef = (UserDef*)ptr->data;
 	short retval = userdef->autokey_mode;
 	
-	if(!(userdef->autokey_mode & AUTOKEY_ON))
+	if (!(userdef->autokey_mode & AUTOKEY_ON))
 		retval |= AUTOKEY_ON;
 
 	return retval;
@@ -181,11 +182,11 @@ static void rna_userdef_autokeymode_set(PointerRNA *ptr,int value)
 {
 	UserDef *userdef = (UserDef*)ptr->data;
 
-	if(value == AUTOKEY_MODE_NORMAL) {
+	if (value == AUTOKEY_MODE_NORMAL) {
 		userdef->autokey_mode |= (AUTOKEY_MODE_NORMAL - AUTOKEY_ON);
 		userdef->autokey_mode &= ~(AUTOKEY_MODE_EDITKEYS - AUTOKEY_ON);
 	}
-	else if(value == AUTOKEY_MODE_EDITKEYS) {
+	else if (value == AUTOKEY_MODE_EDITKEYS) {
 		userdef->autokey_mode |= (AUTOKEY_MODE_EDITKEYS - AUTOKEY_ON);
 		userdef->autokey_mode &= ~(AUTOKEY_MODE_NORMAL - AUTOKEY_ON);
 	}
@@ -197,9 +198,9 @@ static void rna_userdef_timecode_style_set(PointerRNA *ptr, int value)
 	int required_size = userdef->v2d_min_gridsize;
 	
 	/* set the timecode style */
-	userdef->timecode_style= value;
+	userdef->timecode_style = value;
 	
-	/* adjust the v2d gridsize if needed so that timecodes don't overlap 
+	/* adjust the v2d gridsize if needed so that timecodes don't overlap
 	 * NOTE: most of these have been hand-picked to avoid overlaps while still keeping
 	 * things from getting too blown out
 	 */
@@ -207,22 +208,22 @@ static void rna_userdef_timecode_style_set(PointerRNA *ptr, int value)
 		case USER_TIMECODE_MINIMAL:
 		case USER_TIMECODE_SECONDS_ONLY:
 			/* 35 is great most of the time, but not that great for full-blown */
-			required_size= 35;
+			required_size = 35;
 			break;
 		case USER_TIMECODE_SMPTE_MSF:
-			required_size= 50;
+			required_size = 50;
 			break;
 		case USER_TIMECODE_SMPTE_FULL:
 			/* the granddaddy! */
-			required_size= 65;
+			required_size = 65;
 			break;
 		case USER_TIMECODE_MILLISECONDS:
-			required_size= 45;
+			required_size = 45;
 			break;
 	}
 	
 	if (U.v2d_min_gridsize < required_size)
-		U.v2d_min_gridsize= required_size;
+		U.v2d_min_gridsize = required_size;
 }
 
 static PointerRNA rna_UserDef_view_get(PointerRNA *ptr)
@@ -266,8 +267,8 @@ static void rna_UserDef_weight_color_update(Main *bmain, Scene *scene, PointerRN
 
 	vDM_ColorBand_store((U.flag & USER_CUSTOM_RANGE) ? (&U.coba_weight):NULL);
 
-	for(ob= bmain->object.first; ob; ob= ob->id.next) {
-		if(ob->mode & OB_MODE_WEIGHT_PAINT)
+	for (ob = bmain->object.first; ob; ob = ob->id.next) {
+		if (ob->mode & OB_MODE_WEIGHT_PAINT)
 			DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
 	}
 
@@ -278,8 +279,8 @@ static void rna_UserDef_viewport_lights_update(Main *bmain, Scene *scene, Pointe
 {
 	/* if all lights are off gpu_draw resets them all, [#27627]
 	 * so disallow them all to be disabled */
-	if(U.light[0].flag==0 && U.light[1].flag==0 && U.light[2].flag==0) {
-		SolidLight *light= ptr->data;
+	if (U.light[0].flag == 0 && U.light[1].flag == 0 && U.light[2].flag == 0) {
+		SolidLight *light = ptr->data;
 		light->flag |= 1;
 	}
 
@@ -289,16 +290,16 @@ static void rna_UserDef_viewport_lights_update(Main *bmain, Scene *scene, Pointe
 
 static void rna_userdef_autosave_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	wmWindowManager *wm= bmain->wm.first;
+	wmWindowManager *wm = bmain->wm.first;
 
-	if(wm)
+	if (wm)
 		WM_autosave_init(wm);
 	rna_userdef_update(bmain, scene, ptr);
 }
 
 static bAddon *rna_userdef_addon_new(void)
 {
-	bAddon *bext= MEM_callocN(sizeof(bAddon), "bAddon");
+	bAddon *bext = MEM_callocN(sizeof(bAddon), "bAddon");
 	BLI_addtail(&U.addons, bext);
 	return bext;
 }
@@ -331,16 +332,17 @@ static PointerRNA rna_Theme_space_list_generic_get(PointerRNA *ptr)
 
 
 #ifdef WITH_CYCLES
-static EnumPropertyItem *rna_userdef_compute_device_type_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
+static EnumPropertyItem *rna_userdef_compute_device_type_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr),
+                                                               PropertyRNA *UNUSED(prop), int *free)
 {
-	EnumPropertyItem *item= NULL;
-	int totitem= 0;
+	EnumPropertyItem *item = NULL;
+	int totitem = 0;
 
 	/* add supported device types */
 	RNA_enum_items_add_value(&item, &totitem, compute_device_type_items, USER_COMPUTE_DEVICE_NONE);
-	if(CCL_compute_device_list(0))
+	if (CCL_compute_device_list(0))
 		RNA_enum_items_add_value(&item, &totitem, compute_device_type_items, USER_COMPUTE_DEVICE_CUDA);
-	if(CCL_compute_device_list(1))
+	if (CCL_compute_device_list(1))
 		RNA_enum_items_add_value(&item, &totitem, compute_device_type_items, USER_COMPUTE_DEVICE_OPENCL);
 
 	RNA_enum_item_end(&item, &totitem);
@@ -351,19 +353,20 @@ static EnumPropertyItem *rna_userdef_compute_device_type_itemf(bContext *UNUSED(
 
 static int rna_userdef_compute_device_get(PointerRNA *UNUSED(ptr))
 {
-	if(U.compute_device_type == USER_COMPUTE_DEVICE_NONE)
+	if (U.compute_device_type == USER_COMPUTE_DEVICE_NONE)
 		return 0;
 
 	return U.compute_device_id;
 }
 
-static EnumPropertyItem *rna_userdef_compute_device_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
+static EnumPropertyItem *rna_userdef_compute_device_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr),
+                                                          PropertyRNA *UNUSED(prop), int *free)
 {
-	EnumPropertyItem tmp= {0, "", 0, "", ""};
-	EnumPropertyItem *item= NULL;
-	int totitem= 0;
+	EnumPropertyItem tmp = {0, "", 0, "", ""};
+	EnumPropertyItem *item = NULL;
+	int totitem = 0;
 	
-	if(U.compute_device_type == USER_COMPUTE_DEVICE_NONE) {
+	if (U.compute_device_type == USER_COMPUTE_DEVICE_NONE) {
 		/* only add a single CPU device */
 		tmp.value = 0;
 		tmp.name = "CPU";
@@ -377,8 +380,8 @@ static EnumPropertyItem *rna_userdef_compute_device_itemf(bContext *UNUSED(C), P
 		CCLDeviceInfo *devices = CCL_compute_device_list(opencl);
 		int a;
 
-		if(devices) {
-			for(a = 0; devices[a].name; a++) {
+		if (devices) {
+			for (a = 0; devices[a].name; a++) {
 				tmp.value = devices[a].value;
 				tmp.identifier = devices[a].identifier;
 				tmp.name = devices[a].name;
@@ -412,49 +415,49 @@ static void rna_def_userdef_theme_ui_font_style(BlenderRNA *brna)
 		{1, "DEFAULT", 0, "Default", "Use scaled and grid-fitted kerning distances"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "ThemeFontStyle", NULL);
+	srna = RNA_def_struct(brna, "ThemeFontStyle", NULL);
 	RNA_def_struct_sdna(srna, "uiFontStyle");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Font Style", "Theme settings for Font");
 	
-	prop= RNA_def_property(srna, "points", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "points", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, 6, 48);
 	RNA_def_property_ui_text(prop, "Points", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "font_kerning_style", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "font_kerning_style", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "kerning");
 	RNA_def_property_enum_items(prop, font_kerning_style);
 	RNA_def_property_ui_text(prop, "Kerning Style", "Which style to use for font kerning");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "shadow", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "shadow", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, 0, 5);
 	RNA_def_property_ui_text(prop, "Shadow Size", "Shadow size in pixels (0, 3 and 5 supported)");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "shadow_offset_x", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "shadow_offset_x", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "shadx");
 	RNA_def_property_range(prop, -10, 10);
 	RNA_def_property_ui_text(prop, "Shadow X Offset", "Shadow offset in pixels");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "shadow_offset_y", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "shadow_offset_y", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "shady");
 	RNA_def_property_range(prop, -10, 10);
 	RNA_def_property_ui_text(prop, "Shadow Y Offset", "Shadow offset in pixels");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "shadowalpha", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "shadowalpha", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Shadow Alpha", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "shadowcolor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "shadowcolor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Shadow Brightness", "Shadow color in grey value");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
-}	
+}
 
 static void rna_def_userdef_theme_ui_style(BlenderRNA *brna)
 {
@@ -463,7 +466,7 @@ static void rna_def_userdef_theme_ui_style(BlenderRNA *brna)
 	
 	rna_def_userdef_theme_ui_font_style(brna);
 	
-	srna= RNA_def_struct(brna, "ThemeStyle", NULL);
+	srna = RNA_def_struct(brna, "ThemeStyle", NULL);
 	RNA_def_struct_sdna(srna, "uiStyle");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Style", "Theme settings for style sets");
@@ -473,87 +476,88 @@ static void rna_def_userdef_theme_ui_style(BlenderRNA *brna)
 	RNA_def_property_range(prop, 0.5, 2.0);
 	RNA_def_property_ui_text(prop, "Panel Zoom", "Default zoom level for panel areas");
 	*/
-	prop= RNA_def_property(srna, "panel_title", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "panel_title", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "paneltitle");
 	RNA_def_property_struct_type(prop, "ThemeFontStyle");
 	RNA_def_property_ui_text(prop, "Panel Style", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
-/*	(not used yet)
+	/*	(not used yet) */
+#if 0
 	prop= RNA_def_property(srna, "group_label", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "grouplabel");
 	RNA_def_property_struct_type(prop, "ThemeFontStyle");
 	RNA_def_property_ui_text(prop, "Group Label Font", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
-*/	
-	prop= RNA_def_property(srna, "widget_label", PROP_POINTER, PROP_NONE);
+#endif
+	prop = RNA_def_property(srna, "widget_label", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "widgetlabel");
 	RNA_def_property_struct_type(prop, "ThemeFontStyle");
 	RNA_def_property_ui_text(prop, "Widget Label Style", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "widget", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "widget", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "widget");
 	RNA_def_property_struct_type(prop, "ThemeFontStyle");
 	RNA_def_property_ui_text(prop, "Widget Style", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-}	
+}
 
 static void rna_def_userdef_theme_ui_wcol(BlenderRNA *brna)
 {
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "ThemeWidgetColors", NULL);
+	srna = RNA_def_struct(brna, "ThemeWidgetColors", NULL);
 	RNA_def_struct_sdna(srna, "uiWidgetColors");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Theme Widget Color Set", "Theme settings for widget color sets");
 		
-	prop= RNA_def_property(srna, "outline", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "outline", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Outline", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "inner", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "inner", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "Inner", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "inner_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "inner_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "Inner Selected", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "item", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "item", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "Item", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "text", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "text", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Text", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "text_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "text_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Text Selected", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "show_shaded", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_shaded", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "shaded", 1);
 	RNA_def_property_ui_text(prop, "Shaded", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "shadetop", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "shadetop", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, -100, 100);
 	RNA_def_property_ui_text(prop, "Shade Top", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "shadedown", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "shadedown", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, -100, 100);
 	RNA_def_property_ui_text(prop, "Shade Down", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
@@ -564,42 +568,42 @@ static void rna_def_userdef_theme_ui_wcol_state(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "ThemeWidgetStateColors", NULL);
+	srna = RNA_def_struct(brna, "ThemeWidgetStateColors", NULL);
 	RNA_def_struct_sdna(srna, "uiWidgetStateColors");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Theme Widget State Color", "Theme settings for widget state colors");
 		
-	prop= RNA_def_property(srna, "inner_anim", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "inner_anim", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Animated", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "inner_anim_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "inner_anim_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Animated Selected", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "inner_key", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "inner_key", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Keyframe", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "inner_key_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "inner_key_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Keyframe Selected", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "inner_driven", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "inner_driven", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Driven", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "inner_driven_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "inner_driven_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Driven Selected", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "blend", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "blend", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_ui_text(prop, "Blend", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 }
@@ -609,16 +613,16 @@ static void rna_def_userdef_theme_ui_panel(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "ThemePanelColors", NULL);
+	srna = RNA_def_struct(brna, "ThemePanelColors", NULL);
 	RNA_def_struct_sdna(srna, "uiPanelColors");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Theme Panel Color", "Theme settings for panel colors");
 		
-	prop= RNA_def_property(srna, "header", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "header", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_ui_text(prop, "Header", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "show_header", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_header", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Show Header", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 }
@@ -632,107 +636,111 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna)
 	rna_def_userdef_theme_ui_wcol_state(brna);
 	rna_def_userdef_theme_ui_panel(brna);
 	
-	srna= RNA_def_struct(brna, "ThemeUserInterface", NULL);
+	srna = RNA_def_struct(brna, "ThemeUserInterface", NULL);
 	RNA_def_struct_sdna(srna, "ThemeUI");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Theme User Interface", "Theme settings for user interface elements");
 
-	prop= RNA_def_property(srna, "wcol_regular", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "wcol_regular", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_ui_text(prop, "Regular Widget Colors", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "wcol_tool", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "wcol_tool", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_ui_text(prop, "Tool Widget Colors", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "wcol_radio", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "wcol_radio", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_ui_text(prop, "Radio Widget Colors", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "wcol_text", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "wcol_text", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_ui_text(prop, "Text Widget Colors", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "wcol_option", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "wcol_option", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_ui_text(prop, "Option Widget Colors", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "wcol_toggle", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "wcol_toggle", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_ui_text(prop, "Toggle Widget Colors", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "wcol_num", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "wcol_num", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_ui_text(prop, "Number Widget Colors", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "wcol_numslider", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "wcol_numslider", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_ui_text(prop, "Slider Widget Colors", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "wcol_box", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "wcol_box", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_ui_text(prop, "Box Backdrop Colors", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "wcol_menu", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "wcol_menu", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_ui_text(prop, "Menu Widget Colors", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "wcol_pulldown", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "wcol_pulldown", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_ui_text(prop, "Pulldown Widget Colors", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "wcol_menu_back", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "wcol_menu_back", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_ui_text(prop, "Menu Backdrop Colors", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
+	prop = RNA_def_property(srna, "wcol_tooltip", PROP_POINTER, PROP_NONE);
+	RNA_def_property_flag(prop, PROP_NEVER_NULL);
+	RNA_def_property_ui_text(prop, "Tooltip Colors", "");
+	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "wcol_menu_item", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "wcol_menu_item", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_ui_text(prop, "Menu Item Colors", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "wcol_scroll", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "wcol_scroll", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_ui_text(prop, "Scroll Widget Colors", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "wcol_progress", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "wcol_progress", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_ui_text(prop, "Progress Bar Widget Colors", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "wcol_list_item", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "wcol_list_item", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_ui_text(prop, "List Item Colors", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "wcol_state", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "wcol_state", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_ui_text(prop, "State Colors", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "panel", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "panel", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_ui_text(prop, "Panel Colors", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "icon_file", PROP_STRING, PROP_FILEPATH);
+	prop = RNA_def_property(srna, "icon_file", PROP_STRING, PROP_FILEPATH);
 	RNA_def_property_string_sdna(prop, NULL, "iconfile");
 	RNA_def_property_ui_text(prop, "Icon File", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "icon_alpha", PROP_FLOAT, PROP_FACTOR);
+	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");
 }
@@ -742,69 +750,69 @@ static void rna_def_userdef_theme_space_generic(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "ThemeSpaceGeneric", NULL);
+	srna = RNA_def_struct(brna, "ThemeSpaceGeneric", NULL);
 	RNA_def_struct_sdna(srna, "ThemeSpace");
 	RNA_def_struct_ui_text(srna, "Theme Space Settings", "");
 
 	/* window */
-	prop= RNA_def_property(srna, "back", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "back", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Window Background", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "title", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "title", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Title", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "text", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "text", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Text", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Text Highlight", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
 	/* header */
-	prop= RNA_def_property(srna, "header", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "header", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Header", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "header_text", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "header_text", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Header Text", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "header_text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "header_text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Header Text Highlight", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
 	/* buttons */
-//	if(! ELEM(spacetype, SPACE_BUTS, SPACE_OUTLINER)) {
-	prop= RNA_def_property(srna, "button", PROP_FLOAT, PROP_COLOR_GAMMA);
+/*	if (! ELEM(spacetype, SPACE_BUTS, SPACE_OUTLINER)) { */
+	prop = RNA_def_property(srna, "button", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Region Background", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "button_title", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "button_title", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Region Text Titles", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "button_text", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "button_text", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Region Text", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "button_text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "button_text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Region Text Highlight", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
-//	}
+/*	} */
 }
 
 /* list / channels */
@@ -813,26 +821,26 @@ static void rna_def_userdef_theme_space_list_generic(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "ThemeSpaceListGeneric", NULL);
+	srna = RNA_def_struct(brna, "ThemeSpaceListGeneric", NULL);
 	RNA_def_struct_sdna(srna, "ThemeSpace");
 	RNA_def_struct_ui_text(srna, "Theme Space List Settings", "");
 
-	prop= RNA_def_property(srna, "list", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "list", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Source List", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "list_title", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "list_title", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Source List Title", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "list_text", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "list_text", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Source List Text", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "list_text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "list_text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Source List Text Highlight", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
@@ -842,7 +850,7 @@ static void rna_def_userdef_theme_spaces_main(StructRNA *srna)
 {
 	PropertyRNA *prop;
 
-	prop= RNA_def_property(srna, "space", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "space", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "ThemeSpaceGeneric");
 	RNA_def_property_pointer_funcs(prop, "rna_Theme_space_generic_get", NULL, NULL, NULL);
@@ -853,7 +861,7 @@ static void rna_def_userdef_theme_spaces_list_main(StructRNA *srna)
 {
 	PropertyRNA *prop;
 
-	prop= RNA_def_property(srna, "space_list", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "space_list", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "ThemeSpaceListGeneric");
 	RNA_def_property_pointer_funcs(prop, "rna_Theme_space_list_generic_get", NULL, NULL, NULL);
@@ -864,17 +872,17 @@ static void rna_def_userdef_theme_spaces_vertex(StructRNA *srna)
 {
 	PropertyRNA *prop;
 
-	prop= RNA_def_property(srna, "vertex", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "vertex", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Vertex", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "vertex_select", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "vertex_select", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Vertex Select", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "vertex_size", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "vertex_size", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, 1, 10);
 	RNA_def_property_ui_text(prop, "Vertex Size", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
@@ -884,27 +892,27 @@ static void rna_def_userdef_theme_spaces_edge(StructRNA *srna)
 {
 	PropertyRNA *prop;
 
-	prop= RNA_def_property(srna, "edge_select", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "edge_select", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Edge Select", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "edge_seam", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "edge_seam", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Edge Seam", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "edge_sharp", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "edge_sharp", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Edge Sharp", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "edge_crease", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "edge_crease", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Edge Crease", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "edge_facesel", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "edge_facesel", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Edge UV Face Select", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
@@ -914,22 +922,22 @@ static void rna_def_userdef_theme_spaces_face(StructRNA *srna)
 {
 	PropertyRNA *prop;
 
-	prop= RNA_def_property(srna, "face", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "face", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "Face", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "face_select", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "face_select", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "Face Selected", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "face_dot", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "face_dot", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Face Dot Selected", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "facedot_size", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "facedot_size", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, 1, 10);
 	RNA_def_property_ui_text(prop, "Face Dot Size", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
@@ -940,80 +948,80 @@ static void rna_def_userdef_theme_spaces_curves(StructRNA *srna, short incl_nurb
 	PropertyRNA *prop;
 	
 	if (incl_nurbs) {
-		prop= RNA_def_property(srna, "nurb_uline", PROP_FLOAT, PROP_COLOR_GAMMA);
+		prop = RNA_def_property(srna, "nurb_uline", PROP_FLOAT, PROP_COLOR_GAMMA);
 		RNA_def_property_float_sdna(prop, NULL, "nurb_uline");
 		RNA_def_property_array(prop, 3);
 		RNA_def_property_ui_text(prop, "NURBS U-lines", "");
 		RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-		prop= RNA_def_property(srna, "nurb_vline", PROP_FLOAT, PROP_COLOR_GAMMA);
+		prop = RNA_def_property(srna, "nurb_vline", PROP_FLOAT, PROP_COLOR_GAMMA);
 		RNA_def_property_float_sdna(prop, NULL, "nurb_vline");
 		RNA_def_property_array(prop, 3);
 		RNA_def_property_ui_text(prop, "NURBS V-lines", "");
 		RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-		prop= RNA_def_property(srna, "nurb_sel_uline", PROP_FLOAT, PROP_COLOR_GAMMA);
+		prop = RNA_def_property(srna, "nurb_sel_uline", PROP_FLOAT, PROP_COLOR_GAMMA);
 		RNA_def_property_float_sdna(prop, NULL, "nurb_sel_uline");
 		RNA_def_property_array(prop, 3);
 		RNA_def_property_ui_text(prop, "NURBS active U-lines", "");
 		RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-		prop= RNA_def_property(srna, "nurb_sel_vline", PROP_FLOAT, PROP_COLOR_GAMMA);
+		prop = RNA_def_property(srna, "nurb_sel_vline", PROP_FLOAT, PROP_COLOR_GAMMA);
 		RNA_def_property_float_sdna(prop, NULL, "nurb_sel_vline");
 		RNA_def_property_array(prop, 3);
 		RNA_def_property_ui_text(prop, "NURBS active V-lines", "");
 		RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-		prop= RNA_def_property(srna, "act_spline", PROP_FLOAT, PROP_COLOR_GAMMA);
+		prop = RNA_def_property(srna, "act_spline", PROP_FLOAT, PROP_COLOR_GAMMA);
 		RNA_def_property_float_sdna(prop, NULL, "act_spline");
 		RNA_def_property_array(prop, 3);
 		RNA_def_property_ui_text(prop, "Active spline", "");
 		RNA_def_property_update(prop, 0, "rna_userdef_update");
 	}
 
-	prop= RNA_def_property(srna, "handle_free", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "handle_free", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "handle_free");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Free handle color", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "handle_auto", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "handle_auto", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "handle_auto");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Auto handle color", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "handle_vect", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "handle_vect", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "handle_vect");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Vector handle color", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "handle_align", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "handle_align", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "handle_align");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Align handle color", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "handle_sel_free", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "handle_sel_free", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "handle_sel_free");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Free handle selected color", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "handle_sel_auto", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "handle_sel_auto", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "handle_sel_auto");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Auto handle selected color", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "handle_sel_vect", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "handle_sel_vect", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "handle_sel_vect");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Vector handle selected color", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "handle_sel_align", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "handle_sel_align", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "handle_sel_align");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Align handle selected color", "");
@@ -1021,20 +1029,20 @@ static void rna_def_userdef_theme_spaces_curves(StructRNA *srna, short incl_nurb
 	
 	if (incl_nurbs == 0) {
 		/* assume that when nurbs are off, this is for 2D (i.e. anim) editors */
-		prop= RNA_def_property(srna, "handle_auto_clamped", PROP_FLOAT, PROP_COLOR_GAMMA);
+		prop = RNA_def_property(srna, "handle_auto_clamped", PROP_FLOAT, PROP_COLOR_GAMMA);
 		RNA_def_property_float_sdna(prop, NULL, "handle_auto_clamped");
 		RNA_def_property_array(prop, 3);
 		RNA_def_property_ui_text(prop, "Auto-Clamped handle color", "");
 		RNA_def_property_update(prop, 0, "rna_userdef_update");
 		
-		prop= RNA_def_property(srna, "handle_sel_auto_clamped", PROP_FLOAT, PROP_COLOR_GAMMA);
+		prop = RNA_def_property(srna, "handle_sel_auto_clamped", PROP_FLOAT, PROP_COLOR_GAMMA);
 		RNA_def_property_float_sdna(prop, NULL, "handle_sel_auto_clamped");
 		RNA_def_property_array(prop, 3);
 		RNA_def_property_ui_text(prop, "Auto-Clamped handle selected color", "");
 		RNA_def_property_update(prop, 0, "rna_userdef_update");
 	}
 
-	prop= RNA_def_property(srna, "lastsel_point", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "lastsel_point", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "lastsel_point");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Last selected point", "");
@@ -1048,63 +1056,73 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna)
 
 	/* space_view3d */
 
-	srna= RNA_def_struct(brna, "ThemeView3D", NULL);
+	srna = RNA_def_struct(brna, "ThemeView3D", NULL);
 	RNA_def_struct_sdna(srna, "ThemeSpace");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Theme 3D View", "Theme settings for the 3D View");
 
 	rna_def_userdef_theme_spaces_main(srna);
 
-	prop= RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Grid", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "panel", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "panel", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "Panel", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "wire", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "wire", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Wire", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "lamp", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "lamp", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "Lamp", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "speaker", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "speaker", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Speaker", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
+	
+	prop = RNA_def_property(srna, "camera", PROP_FLOAT, PROP_COLOR_GAMMA);
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_ui_text(prop, "Camera", "");
+	RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+	prop = RNA_def_property(srna, "empty", PROP_FLOAT, PROP_COLOR_GAMMA);
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_ui_text(prop, "Empty", "");
+	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "object_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "object_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "select");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Object Selected", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "object_active", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "object_active", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "active");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Active Object", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "object_grouped", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "object_grouped", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "group");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Object Grouped", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "object_grouped_active", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "object_grouped_active", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "group_active");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Object Grouped Active", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "transform", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "transform", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Transform", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
@@ -1114,64 +1132,64 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna)
 	rna_def_userdef_theme_spaces_face(srna);
 	rna_def_userdef_theme_spaces_curves(srna, 1);
 
-	prop= RNA_def_property(srna, "extra_edge_len", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "extra_edge_len", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Edge Length Text", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "extra_face_angle", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "extra_face_angle", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Face Angle Text", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "extra_face_area", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "extra_face_area", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Face Area Text", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "editmesh_active", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "editmesh_active", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "Active Vert/Edge/Face", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "normal", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Face Normal", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "vertex_normal", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "vertex_normal", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Vertex Normal", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "bone_solid", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "bone_solid", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Bone Solid", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "bone_pose", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "bone_pose", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Bone Pose", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "cframe");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Current Frame", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "outline_width", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "outline_width", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, 1, 5);
 	RNA_def_property_ui_text(prop, "Outline Width", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "bundle_solid", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "bundle_solid", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "bundle_solid");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Bundle Solid", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "camera_path", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "camera_path", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "camera_path");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Camera Path", "");
@@ -1186,7 +1204,7 @@ static void rna_def_userdef_theme_space_graph(BlenderRNA *brna)
 
 	/* space_graph */
 
-	srna= RNA_def_struct(brna, "ThemeGraphEditor", NULL);
+	srna = RNA_def_struct(brna, "ThemeGraphEditor", NULL);
 	RNA_def_struct_sdna(srna, "ThemeSpace");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Theme Graph Editor", "Theme settings for the graph editor");
@@ -1194,23 +1212,23 @@ static void rna_def_userdef_theme_space_graph(BlenderRNA *brna)
 	rna_def_userdef_theme_spaces_main(srna);
 	rna_def_userdef_theme_spaces_list_main(srna);
 
-	prop= RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Grid", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "panel", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "panel", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Panel", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "window_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "window_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "shade1");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Window Sliders", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "channels_region", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "channels_region", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "shade2");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Channels Region", "");
@@ -1219,46 +1237,46 @@ static void rna_def_userdef_theme_space_graph(BlenderRNA *brna)
 	rna_def_userdef_theme_spaces_vertex(srna);
 	rna_def_userdef_theme_spaces_curves(srna, 0);
 
-	prop= RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "cframe");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Current Frame", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "handle_vertex", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "handle_vertex", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Handle Vertex", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "handle_vertex_select", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "handle_vertex_select", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Handle Vertex Select", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "handle_vertex_size", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "handle_vertex_size", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, 0, 255);
 	RNA_def_property_ui_text(prop, "Handle Vertex Size", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "channel_group", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "channel_group", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "group");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Channel Group", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "active_channels_group", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "active_channels_group", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "group_active");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Active Channel Group", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "dopesheet_channel", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "dopesheet_channel", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "ds_channel");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "DopeSheet Channel", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "dopesheet_subchannel", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "dopesheet_subchannel", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "ds_subchannel");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "DopeSheet Sub-Channel", "");
@@ -1272,7 +1290,7 @@ static void rna_def_userdef_theme_space_file(BlenderRNA *brna)
 
 	/* space_file  */
 
-	srna= RNA_def_struct(brna, "ThemeFileBrowser", NULL);
+	srna = RNA_def_struct(brna, "ThemeFileBrowser", NULL);
 	RNA_def_struct_sdna(srna, "ThemeSpace");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Theme File Browser", "Theme settings for the File Browser");
@@ -1280,37 +1298,37 @@ static void rna_def_userdef_theme_space_file(BlenderRNA *brna)
 	rna_def_userdef_theme_spaces_main(srna);
 	rna_def_userdef_theme_spaces_list_main(srna);
 
-	prop= RNA_def_property(srna, "selected_file", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "selected_file", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "hilite");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Selected File", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "tiles", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "tiles", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "panel");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Tiles", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "scrollbar", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "scrollbar", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "shade1");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Scrollbar", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "scroll_handle", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "scroll_handle", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "shade2");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Scroll Handle", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "active_file", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "active_file", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "active");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Active File", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "active_file_text", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "active_file_text", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "grid");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Active File Text", "");
@@ -1324,19 +1342,19 @@ static void rna_def_userdef_theme_space_outliner(BlenderRNA *brna)
 
 	/* space_outliner */
 
-	srna= RNA_def_struct(brna, "ThemeOutliner", NULL);
+	srna = RNA_def_struct(brna, "ThemeOutliner", NULL);
 	RNA_def_struct_sdna(srna, "ThemeSpace");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Theme Outliner", "Theme settings for the Outliner");
 
 	rna_def_userdef_theme_spaces_main(srna);
 
-	prop= RNA_def_property(srna, "match", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "match", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Filter Match", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "selected_highlight", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "selected_highlight", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Selected Highlight", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
@@ -1348,7 +1366,7 @@ static void rna_def_userdef_theme_space_userpref(BlenderRNA *brna)
 
 	/* space_userpref */
 
-	srna= RNA_def_struct(brna, "ThemeUserPreferences", NULL);
+	srna = RNA_def_struct(brna, "ThemeUserPreferences", NULL);
 	RNA_def_struct_sdna(srna, "ThemeSpace");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Theme User Preferences", "Theme settings for the User Preferences");
@@ -1363,38 +1381,38 @@ static void rna_def_userdef_theme_space_console(BlenderRNA *brna)
 
 	/* space_console */
 
-	srna= RNA_def_struct(brna, "ThemeConsole", NULL);
+	srna = RNA_def_struct(brna, "ThemeConsole", NULL);
 	RNA_def_struct_sdna(srna, "ThemeSpace");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Theme Console", "Theme settings for the Console");
 	
 	rna_def_userdef_theme_spaces_main(srna);
 	
-	prop= RNA_def_property(srna, "line_output", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "line_output", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "console_output");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Line Output", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "line_input", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "line_input", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "console_input");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Line Input", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "line_info", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "line_info", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "console_info");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Line Info", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "line_error", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "line_error", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "console_error");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Line Error", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "cursor", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "cursor", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "console_cursor");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Cursor", "");
@@ -1407,7 +1425,7 @@ static void rna_def_userdef_theme_space_info(BlenderRNA *brna)
 
 	/* space_info */
 
-	srna= RNA_def_struct(brna, "ThemeInfo", NULL);
+	srna = RNA_def_struct(brna, "ThemeInfo", NULL);
 	RNA_def_struct_sdna(srna, "ThemeSpace");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Theme Info", "Theme settings for Info");
@@ -1423,62 +1441,65 @@ static void rna_def_userdef_theme_space_text(BlenderRNA *brna)
 
 	/* space_text */
 
-	srna= RNA_def_struct(brna, "ThemeTextEditor", NULL);
+	srna = RNA_def_struct(brna, "ThemeTextEditor", NULL);
 	RNA_def_struct_sdna(srna, "ThemeSpace");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Theme Text Editor", "Theme settings for the Text Editor");
 
 	rna_def_userdef_theme_spaces_main(srna);
 
-	prop= RNA_def_property(srna, "line_numbers_background", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "line_numbers_background", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "grid");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Line Numbers Background", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "scroll_bar", PROP_FLOAT, PROP_COLOR_GAMMA);
+	/* no longer used */
+#if 0
+	prop = RNA_def_property(srna, "scroll_bar", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "shade1");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Scroll Bar", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
+#endif
 
-	prop= RNA_def_property(srna, "selected_text", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "selected_text", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "shade2");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Selected Text", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "cursor", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "cursor", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "hilite");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Cursor", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "syntax_builtin", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "syntax_builtin", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "syntaxb");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Syntax Built-in", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "syntax_special", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "syntax_special", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "syntaxv");
 	RNA_def_property_array(prop, 3);
-	RNA_def_property_ui_text(prop, "Syntax Special", "");
+	RNA_def_property_ui_text(prop, "Decorator", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "syntax_comment", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "syntax_comment", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "syntaxc");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Syntax Comment", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "syntax_string", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "syntax_string", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "syntaxl");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Syntax String", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "syntax_numbers", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "syntax_numbers", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "syntaxn");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Syntax Numbers", "");
@@ -1492,7 +1513,7 @@ static void rna_def_userdef_theme_space_node(BlenderRNA *brna)
 
 	/* space_node */
 
-	srna= RNA_def_struct(brna, "ThemeNodeEditor", NULL);
+	srna = RNA_def_struct(brna, "ThemeNodeEditor", NULL);
 	RNA_def_struct_sdna(srna, "ThemeSpace");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Theme Node Editor", "Theme settings for the Node Editor");
@@ -1500,55 +1521,55 @@ static void rna_def_userdef_theme_space_node(BlenderRNA *brna)
 	rna_def_userdef_theme_spaces_main(srna);
 	rna_def_userdef_theme_spaces_list_main(srna);
 
-	prop= RNA_def_property(srna, "wire", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "wire", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "wire");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Wires", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "wire_select", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "wire_select", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "edge_select");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Wire Select", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "selected_text", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "selected_text", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "shade2");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Selected Text", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "node_backdrop", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "node_backdrop", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "syntaxl");
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "Node Backdrop", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "in_out_node", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "in_out_node", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "syntaxn");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "In/Out Node", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "converter_node", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "converter_node", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "syntaxv");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Converter Node", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "operator_node", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "operator_node", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "syntaxb");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Operator Node", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "group_node", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "group_node", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "syntaxc");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Group Node", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "noodle_curving", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "noodle_curving", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "noodle_curving");
 	RNA_def_property_int_default(prop, 5);
 	RNA_def_property_range(prop, 0, 10);
@@ -1563,14 +1584,14 @@ static void rna_def_userdef_theme_space_logic(BlenderRNA *brna)
 	
 	/* space_logic */
 	
-	srna= RNA_def_struct(brna, "ThemeLogicEditor", NULL);
+	srna = RNA_def_struct(brna, "ThemeLogicEditor", NULL);
 	RNA_def_struct_sdna(srna, "ThemeSpace");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Theme Logic Editor", "Theme settings for the Logic Editor");
 	
 	rna_def_userdef_theme_spaces_main(srna);
 	
-	prop= RNA_def_property(srna, "panel", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "panel", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Panel", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
@@ -1584,14 +1605,14 @@ static void rna_def_userdef_theme_space_buts(BlenderRNA *brna)
 
 	/* space_buts */
 
-	srna= RNA_def_struct(brna, "ThemeProperties", NULL);
+	srna = RNA_def_struct(brna, "ThemeProperties", NULL);
 	RNA_def_struct_sdna(srna, "ThemeSpace");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Theme Properties", "Theme settings for the Properties");
 
 	rna_def_userdef_theme_spaces_main(srna);
 
-	prop= RNA_def_property(srna, "panel", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "panel", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Panel", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
@@ -1604,19 +1625,19 @@ static void rna_def_userdef_theme_space_time(BlenderRNA *brna)
 
 	/* space_time */
 
-	srna= RNA_def_struct(brna, "ThemeTimeline", NULL);
+	srna = RNA_def_struct(brna, "ThemeTimeline", NULL);
 	RNA_def_struct_sdna(srna, "ThemeSpace");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Theme Timeline", "Theme settings for the Timeline");
 
 	rna_def_userdef_theme_spaces_main(srna);
 
-	prop= RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Grid", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "cframe");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Current Frame", "");
@@ -1630,7 +1651,7 @@ static void rna_def_userdef_theme_space_image(BlenderRNA *brna)
 
 	/* space_image */
 
-	srna= RNA_def_struct(brna, "ThemeImageEditor", NULL);
+	srna = RNA_def_struct(brna, "ThemeImageEditor", NULL);
 	RNA_def_struct_sdna(srna, "ThemeSpace");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Theme Image Editor", "Theme settings for the Image Editor");
@@ -1639,48 +1660,48 @@ static void rna_def_userdef_theme_space_image(BlenderRNA *brna)
 	rna_def_userdef_theme_spaces_vertex(srna);
 	rna_def_userdef_theme_spaces_face(srna);
 
-	prop= RNA_def_property(srna, "editmesh_active", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "editmesh_active", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "Active Vert/Edge/Face", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "scope_back", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "scope_back", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "preview_back");
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "Scope region background color", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "preview_stitch_face", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "preview_stitch_face", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "preview_stitch_face");
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "Stitch preview face color", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "preview_stitch_edge", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "preview_stitch_edge", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "preview_stitch_edge");
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "Stitch preview edge color", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "preview_stitch_vert", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "preview_stitch_vert", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "preview_stitch_vert");
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "Stitch preview vertex color", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "preview_stitch_stitchable", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "preview_stitch_stitchable", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "preview_stitch_stitchable");
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "Stitch preview stitchable color", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "preview_stitch_unstitchable", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "preview_stitch_unstitchable", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "preview_stitch_unstitchable");
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "Stitch preview unstitchable color", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "preview_stitch_active", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "preview_stitch_active", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "preview_stitch_active");
 	RNA_def_property_array(prop, 4);
 	RNA_def_property_ui_text(prop, "Stitch preview active island", "");
@@ -1694,89 +1715,101 @@ static void rna_def_userdef_theme_space_seq(BlenderRNA *brna)
 
 	/* space_seq */
 
-	srna= RNA_def_struct(brna, "ThemeSequenceEditor", NULL);
+	srna = RNA_def_struct(brna, "ThemeSequenceEditor", NULL);
 	RNA_def_struct_sdna(srna, "ThemeSpace");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Theme Sequence Editor", "Theme settings for the Sequence Editor");
 
 	rna_def_userdef_theme_spaces_main(srna);
 
-	prop= RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Grid", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "window_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "window_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "shade1");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Window Sliders", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "movie_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "movie_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "movie");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Movie Strip", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "image_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "movieclip_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
+	RNA_def_property_float_sdna(prop, NULL, "movieclip");
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_ui_text(prop, "Clip Strip", "");
+	RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+	prop = RNA_def_property(srna, "image_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "image");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Image Strip", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "scene_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "scene_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "scene");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Scene Strip", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "audio_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "audio_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "audio");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Audio Strip", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "effect_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "effect_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "effect");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Effect Strip", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "plugin_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "plugin_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "plugin");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Plugin Strip", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "transition_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "transition_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "transition");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Transition Strip", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "meta_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "meta_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "meta");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Meta Strip", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "cframe");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Current Frame", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "keyframe", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "keyframe", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "vertex_select");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Keyframe", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "draw_action", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "draw_action", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "bone_pose");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Draw Action", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
+	
+	prop = RNA_def_property(srna, "preview_back", PROP_FLOAT, PROP_COLOR_GAMMA);
+	RNA_def_property_float_sdna(prop, NULL, "preview_back");
+	RNA_def_property_array(prop, 3);
+	RNA_def_property_ui_text(prop, "Preview Background", "");
+	RNA_def_property_update(prop, 0, "rna_userdef_update");
 }
 
 static void rna_def_userdef_theme_space_action(BlenderRNA *brna)
@@ -1786,7 +1819,7 @@ static void rna_def_userdef_theme_space_action(BlenderRNA *brna)
 
 	/* space_action */
 
-	srna= RNA_def_struct(brna, "ThemeDopeSheet", NULL);
+	srna = RNA_def_struct(brna, "ThemeDopeSheet", NULL);
 	RNA_def_struct_sdna(srna, "ThemeSpace");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Theme DopeSheet", "Theme settings for the DopeSheet");
@@ -1794,72 +1827,72 @@ static void rna_def_userdef_theme_space_action(BlenderRNA *brna)
 	rna_def_userdef_theme_spaces_main(srna);
 	rna_def_userdef_theme_spaces_list_main(srna);
 
-	prop= RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Grid", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "value_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "value_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "face");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Value Sliders", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "view_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "view_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "shade1");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "View Sliders", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "channels", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "channels", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "shade2");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Channels", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "channels_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "channels_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "hilite");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Channels Selected", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "channel_group", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "channel_group", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "group");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Channel Group", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "active_channels_group", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "active_channels_group", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "group_active");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Active Channel Group", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "long_key", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "long_key", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "strip");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Long Key", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "long_key_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "long_key_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "strip_select");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Long Key Selected", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "cframe");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Current Frame", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "dopesheet_channel", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "dopesheet_channel", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "ds_channel");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "DopeSheet Channel", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "dopesheet_subchannel", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "dopesheet_subchannel", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "ds_subchannel");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "DopeSheet Sub-Channel", "");
@@ -1873,7 +1906,7 @@ static void rna_def_userdef_theme_space_nla(BlenderRNA *brna)
 
 	/* space_nla */
 
-	srna= RNA_def_struct(brna, "ThemeNLAEditor", NULL);
+	srna = RNA_def_struct(brna, "ThemeNLAEditor", NULL);
 	RNA_def_struct_sdna(srna, "ThemeSpace");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Theme NLA Editor", "Theme settings for the NLA Editor");
@@ -1881,42 +1914,42 @@ static void rna_def_userdef_theme_space_nla(BlenderRNA *brna)
 	rna_def_userdef_theme_spaces_main(srna);
 	rna_def_userdef_theme_spaces_list_main(srna);
 
-	prop= RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Grid", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "view_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "view_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "shade1");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "View Sliders", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "bars", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "bars", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "shade2");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Bars", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "bars_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "bars_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "hilite");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Bars Selected", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "strips", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "strips", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "strip");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Strips", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "strips_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "strips_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "strip_select");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Strips Selected", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "cframe");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Current Frame", "");
@@ -1928,31 +1961,32 @@ static void rna_def_userdef_theme_colorset(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "ThemeBoneColorSet", NULL);
+	srna = RNA_def_struct(brna, "ThemeBoneColorSet", NULL);
 	RNA_def_struct_sdna(srna, "ThemeWireColor");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Theme Bone Color Set", "Theme settings for bone color sets");
 
-	prop= RNA_def_property(srna, "normal", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "solid");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Normal", "Color used for the surface of bones");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "select", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "select", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "select");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Select", "Color used for selected bones");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "active", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "active", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Active", "Color used for active bones");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "show_colored_constraints", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_colored_constraints", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", TH_WIRECOLOR_CONSTCOLS);
-	RNA_def_property_ui_text(prop, "Colored Constraints", "Allow the use of colors indicating constraints/keyed status");
+	RNA_def_property_ui_text(prop, "Colored Constraints",
+	                         "Allow the use of colors indicating constraints/keyed status");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 }
 
@@ -1963,83 +1997,83 @@ static void rna_def_userdef_theme_space_clip(BlenderRNA *brna)
 
 	/* space_clip */
 
-	srna= RNA_def_struct(brna, "ThemeClipEditor", NULL);
+	srna = RNA_def_struct(brna, "ThemeClipEditor", NULL);
 	RNA_def_struct_sdna(srna, "ThemeSpace");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Theme Clip Editor", "Theme settings for the Movie Clip Editor");
 
 	rna_def_userdef_theme_spaces_main(srna);
 
-	prop= RNA_def_property(srna, "marker_outline", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "marker_outline", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "marker_outline");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Marker Outline Color", "Color of marker's outile");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "marker", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "marker", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "marker");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Marker Color", "Color of marker");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "active_marker", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "active_marker", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "act_marker");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Active Marker", "Color of active marker");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "selected_marker", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "selected_marker", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "sel_marker");
 	RNA_def_property_array(prop, 3);
-	RNA_def_property_ui_text(prop, "Selected Marker", "Color of sleected marker");
+	RNA_def_property_ui_text(prop, "Selected Marker", "Color of selected marker");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "disabled_marker", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "disabled_marker", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "dis_marker");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Disabled Marker", "Color of disabled marker");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "locked_marker", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "locked_marker", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "lock_marker");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Locked Marker", "Color of locked marker");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "path_before", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "path_before", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "path_before");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Path Before", "Color of path before current frame");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "path_after", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "path_after", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "path_after");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Path After", "Color of path after current frame");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Grid", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "cframe");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Current Frame", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "handle_vertex", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "handle_vertex", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Handle Vertex", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "handle_vertex_select", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "handle_vertex_select", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Handle Vertex Select", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "handle_vertex_size", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "handle_vertex_size", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, 0, 255);
 	RNA_def_property_ui_text(prop, "Handle Vertex Size", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
@@ -2056,7 +2090,7 @@ static void rna_def_userdef_themes(BlenderRNA *brna)
 		{1, "VIEW_3D", ICON_VIEW3D, "3D View", ""},
 		{2, "TIMELINE", ICON_TIME, "Timeline", ""},
 		{3, "GRAPH_EDITOR", ICON_IPO, "Graph Editor", ""},
-		{4, "DOPESHEET_EDITOR", ICON_ACTION, "Dopesheet", ""},
+		{4, "DOPESHEET_EDITOR", ICON_ACTION, "DopeSheet", ""},
 		{5, "NLA_EDITOR", ICON_NLA, "NLA Editor", ""},
 		{6, "IMAGE_EDITOR", ICON_IMAGE_COL, "UV/Image Editor", ""},
 		{7, "SEQUENCE_EDITOR", ICON_SEQUENCE, "Video Sequence Editor", ""},
@@ -2072,131 +2106,132 @@ static void rna_def_userdef_themes(BlenderRNA *brna)
 	    {20, "CLIP_EDITOR", ICON_CLIP, "Movie Clip Editor", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "Theme", NULL);
+	srna = RNA_def_struct(brna, "Theme", NULL);
 	RNA_def_struct_sdna(srna, "bTheme");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Theme", "Theme settings defining draw style and colors in the user interface");
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Name", "Name of the theme");
 	RNA_def_struct_name_property(srna, prop);
-	RNA_def_property_flag(prop, PROP_SKIP_SAVE); /* XXX: for now putting this in presets is silly - its just Default */
+		/* XXX: for now putting this in presets is silly - its just Default */
+	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 
-	prop= RNA_def_property(srna, "theme_area", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "theme_area", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "active_theme_area");
 	RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 	RNA_def_property_enum_items(prop, active_theme_area);
 	RNA_def_property_ui_text(prop, "Active Theme Area", "");
 
-	prop= RNA_def_property(srna, "user_interface", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "user_interface", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "tui");
 	RNA_def_property_struct_type(prop, "ThemeUserInterface");
 	RNA_def_property_ui_text(prop, "User Interface", "");
 
-	prop= RNA_def_property(srna, "view_3d", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "view_3d", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "tv3d");
 	RNA_def_property_struct_type(prop, "ThemeView3D");
 	RNA_def_property_ui_text(prop, "3D View", "");
 
-	prop= RNA_def_property(srna, "graph_editor", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "graph_editor", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "tipo");
 	RNA_def_property_struct_type(prop, "ThemeGraphEditor");
 	RNA_def_property_ui_text(prop, "Graph Editor", "");
 
-	prop= RNA_def_property(srna, "file_browser", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "file_browser", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "tfile");
 	RNA_def_property_struct_type(prop, "ThemeFileBrowser");
 	RNA_def_property_ui_text(prop, "File Browser", "");
 
-	prop= RNA_def_property(srna, "nla_editor", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "nla_editor", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "tnla");
 	RNA_def_property_struct_type(prop, "ThemeNLAEditor");
 	RNA_def_property_ui_text(prop, "NLA Editor", "");
 
-	prop= RNA_def_property(srna, "dopesheet_editor", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "dopesheet_editor", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "tact");
 	RNA_def_property_struct_type(prop, "ThemeDopeSheet");
 	RNA_def_property_ui_text(prop, "DopeSheet", "");
 
-	prop= RNA_def_property(srna, "image_editor", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "image_editor", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "tima");
 	RNA_def_property_struct_type(prop, "ThemeImageEditor");
 	RNA_def_property_ui_text(prop, "Image Editor", "");
 
-	prop= RNA_def_property(srna, "sequence_editor", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "sequence_editor", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "tseq");
 	RNA_def_property_struct_type(prop, "ThemeSequenceEditor");
 	RNA_def_property_ui_text(prop, "Sequence Editor", "");
 
-	prop= RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "tbuts");
 	RNA_def_property_struct_type(prop, "ThemeProperties");
 	RNA_def_property_ui_text(prop, "Properties", "");
 
-	prop= RNA_def_property(srna, "text_editor", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "text_editor", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "text");
 	RNA_def_property_struct_type(prop, "ThemeTextEditor");
 	RNA_def_property_ui_text(prop, "Text Editor", "");
 
-	prop= RNA_def_property(srna, "timeline", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "timeline", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "ttime");
 	RNA_def_property_struct_type(prop, "ThemeTimeline");
 	RNA_def_property_ui_text(prop, "Timeline", "");
 
-	prop= RNA_def_property(srna, "node_editor", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "node_editor", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "tnode");
 	RNA_def_property_struct_type(prop, "ThemeNodeEditor");
 	RNA_def_property_ui_text(prop, "Node Editor", "");
 
-	prop= RNA_def_property(srna, "logic_editor", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "logic_editor", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "tlogic");
 	RNA_def_property_struct_type(prop, "ThemeLogicEditor");
 	RNA_def_property_ui_text(prop, "Logic Editor", "");
 	
-	prop= RNA_def_property(srna, "outliner", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "outliner", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "toops");
 	RNA_def_property_struct_type(prop, "ThemeOutliner");
 	RNA_def_property_ui_text(prop, "Outliner", "");
 
-	prop= RNA_def_property(srna, "info", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "info", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "tinfo");
 	RNA_def_property_struct_type(prop, "ThemeInfo");
 	RNA_def_property_ui_text(prop, "Info", "");
 
-	prop= RNA_def_property(srna, "user_preferences", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "user_preferences", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "tuserpref");
 	RNA_def_property_struct_type(prop, "ThemeUserPreferences");
 	RNA_def_property_ui_text(prop, "User Preferences", "");
 	
-	prop= RNA_def_property(srna, "console", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "console", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "tconsole");
 	RNA_def_property_struct_type(prop, "ThemeConsole");
 	RNA_def_property_ui_text(prop, "Console", "");
 
-	prop= RNA_def_property(srna, "bone_color_sets", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "bone_color_sets", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_collection_sdna(prop, NULL, "tarm", "");
 	RNA_def_property_struct_type(prop, "ThemeBoneColorSet");
 	RNA_def_property_ui_text(prop, "Bone Color Sets", "");
 
-	prop= RNA_def_property(srna, "clip_editor", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "clip_editor", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "tclip");
 	RNA_def_property_struct_type(prop, "ThemeClipEditor");
@@ -2208,12 +2243,12 @@ static void rna_def_userdef_addon(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "Addon", NULL);
+	srna = RNA_def_struct(brna, "Addon", NULL);
 	RNA_def_struct_sdna(srna, "bAddon");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Addon", "Python addons to be loaded automatically");
 
-	prop= RNA_def_property(srna, "module", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "module", PROP_STRING, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Module", "Module name");
 	RNA_def_struct_name_property(srna, prop);
 }
@@ -2255,30 +2290,30 @@ static void rna_def_userdef_solidlight(BlenderRNA *brna)
 	PropertyRNA *prop;
 	static float default_dir[3] = {0.f, 1.f, 0.f};
 
-	srna= RNA_def_struct(brna, "UserSolidLight", NULL);
+	srna = RNA_def_struct(brna, "UserSolidLight", NULL);
 	RNA_def_struct_sdna(srna, "SolidLight");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Solid Light", "Light used for OpenGL lighting in solid draw mode");
 	
-	prop= RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", 1);
 	RNA_def_property_ui_text(prop, "Enabled", "Enable this OpenGL light in solid draw mode");
 	RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update");
 
-	prop= RNA_def_property(srna, "direction", PROP_FLOAT, PROP_DIRECTION);
+	prop = RNA_def_property(srna, "direction", PROP_FLOAT, PROP_DIRECTION);
 	RNA_def_property_float_sdna(prop, NULL, "vec");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_float_array_default(prop, default_dir);
 	RNA_def_property_ui_text(prop, "Direction", "Direction that the OpenGL light is shining");
 	RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update");
 
-	prop= RNA_def_property(srna, "diffuse_color", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "diffuse_color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "col");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Diffuse Color", "Diffuse color of the OpenGL light");
 	RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update");
 
-	prop= RNA_def_property(srna, "specular_color", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "specular_color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "spec");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Specular Color", "Color of the light's specular highlight");
@@ -2298,13 +2333,14 @@ static void rna_def_userdef_view(BlenderRNA *brna)
 		{USER_TIMECODE_MILLISECONDS, "MILLISECONDS", 0, "Compact with Milliseconds",
 		                             "Similar to SMPTE (Compact), except that instead of frames, "
 		                             "milliseconds are shown instead"},
-		{USER_TIMECODE_SECONDS_ONLY, "SECONDS_ONLY", 0, "Only Seconds", "Direct conversion of frame numbers to seconds"},
+		{USER_TIMECODE_SECONDS_ONLY, "SECONDS_ONLY", 0, "Only Seconds",
+		                             "Direct conversion of frame numbers to seconds"},
 		{0, NULL, 0, NULL, NULL}};
 	
 	PropertyRNA *prop;
 	StructRNA *srna;
 	
-	srna= RNA_def_struct(brna, "UserPreferencesView", NULL);
+	srna = RNA_def_struct(brna, "UserPreferencesView", NULL);
 	RNA_def_struct_sdna(srna, "UserDef");
 	RNA_def_struct_nested(brna, srna, "UserPreferences");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
@@ -2313,185 +2349,194 @@ static void rna_def_userdef_view(BlenderRNA *brna)
 	/* View  */
 
 	/* display */
-	prop= RNA_def_property(srna, "show_tooltips", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_tooltips", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_TOOLTIPS);
 	RNA_def_property_ui_text(prop, "Tooltips", "Display tooltips");
 
-	prop= RNA_def_property(srna, "show_tooltips_python", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_tooltips_python", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_TOOLTIPS_PYTHON);
 	RNA_def_property_ui_text(prop, "Show Python Tooltips", "Show Python references in tooltips");
 
-	prop= RNA_def_property(srna, "show_object_info", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_object_info", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_DRAWVIEWINFO);
 	RNA_def_property_ui_text(prop, "Display Object Info", "Display objects name and frame number in 3D view");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "use_global_scene", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_global_scene", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_SCENEGLOBAL);
 	RNA_def_property_ui_text(prop, "Global Scene", "Force the current Scene to be displayed in all Screens");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "show_large_cursors", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_large_cursors", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "curssize", 0);
 	RNA_def_property_ui_text(prop, "Large Cursors", "Use large mouse cursors when available");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "show_view_name", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_view_name", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_VIEWPORTNAME);
 	RNA_def_property_ui_text(prop, "Show View Name", "Show the name of the view's direction in each 3D View");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "show_splash", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_splash", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_SPLASH_DISABLE);
 	RNA_def_property_ui_text(prop, "Show Splash", "Display splash screen on startup");
 
-	prop= RNA_def_property(srna, "show_playback_fps", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_playback_fps", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_FPS);
 	RNA_def_property_ui_text(prop, "Show Playback FPS",
 	                         "Show the frames per second screen refresh rate, while animation is played back");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
 	/* menus */
-	prop= RNA_def_property(srna, "use_mouse_over_open", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_mouse_over_open", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_MENUOPENAUTO);
 	RNA_def_property_ui_text(prop, "Open On Mouse Over",
 	                         "Open menu buttons and pulldowns automatically when the mouse is hovering");
 	
-	prop= RNA_def_property(srna, "open_toplevel_delay", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "open_toplevel_delay", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "menuthreshold1");
 	RNA_def_property_range(prop, 1, 40);
 	RNA_def_property_ui_text(prop, "Top Level Menu Open Delay",
 	                         "Time delay in 1/10 seconds before automatically opening top level menus");
 
-	prop= RNA_def_property(srna, "open_sublevel_delay", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "open_sublevel_delay", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "menuthreshold2");
 	RNA_def_property_range(prop, 1, 40);
 	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);
+	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");
+
 	/* Toolbox click-hold delay */
-	prop= RNA_def_property(srna, "open_left_mouse_delay", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "open_left_mouse_delay", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "tb_leftmouse");
 	RNA_def_property_range(prop, 1, 40);
 	RNA_def_property_ui_text(prop, "Hold LMB Open Toolbox Delay",
 	                         "Time in 1/10 seconds to hold the Left Mouse Button before opening the toolbox");
 
-	prop= RNA_def_property(srna, "open_right_mouse_delay", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "open_right_mouse_delay", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "tb_rightmouse");
 	RNA_def_property_range(prop, 1, 40);
 	RNA_def_property_ui_text(prop, "Hold RMB Open Toolbox Delay",
 	                         "Time in 1/10 seconds to hold the Right Mouse Button before opening the toolbox");
 
-	prop= RNA_def_property(srna, "show_column_layout", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_column_layout", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_PLAINMENUS);
 	RNA_def_property_ui_text(prop, "Toolbox Column Layout", "Use a column layout for toolbox");
 
-	prop= RNA_def_property(srna, "use_directional_menus", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_directional_menus", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_MENUFIXEDORDER);
 	RNA_def_property_ui_text(prop, "Contents Follow Opening Direction",
-	                         "Otherwise menus, etc will always be top to bottom, left to right, no matter opening direction");
+	                         "Otherwise menus, etc will always be top to bottom, left to right, "
+	                         "no matter opening direction");
 
-	prop= RNA_def_property(srna, "use_global_pivot", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_global_pivot", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_LOCKAROUND);
 	RNA_def_property_ui_text(prop, "Global Pivot", "Lock the same rotation/scaling pivot in all 3D Views");
 
-	prop= RNA_def_property(srna, "use_mouse_auto_depth", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_mouse_auto_depth", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ORBIT_ZBUF);
-	RNA_def_property_ui_text(prop, "Auto Depth", "Use the depth under the mouse to improve view pan/rotate/zoom functionality");
+	RNA_def_property_ui_text(prop, "Auto Depth",
+	                         "Use the depth under the mouse to improve view pan/rotate/zoom functionality");
 
-	prop= RNA_def_property(srna, "use_camera_lock_parent", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_camera_lock_parent", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_CAM_LOCK_NO_PARENT);
 	RNA_def_property_ui_text(prop, "Camera Parent Lock",
 	                         "When the camera is locked to the view and in fly mode, "
 	                         "transform the parent rather than the camera");
 
 	/* view zoom */
-	prop= RNA_def_property(srna, "use_zoom_to_mouse", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_zoom_to_mouse", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ZOOM_TO_MOUSEPOS);
 	RNA_def_property_ui_text(prop, "Zoom To Mouse Position",
-	                         "Zoom in towards the mouse pointer's position in the 3D view, rather than the 2D window center");
+	                         "Zoom in towards the mouse pointer's position in the 3D view, "
+	                         "rather than the 2D window center");
 
 	/* view rotation */
-	prop= RNA_def_property(srna, "use_auto_perspective", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_auto_perspective", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_AUTOPERSP);
 	RNA_def_property_ui_text(prop, "Auto Perspective",
 	                         "Automatically switch between orthographic and perspective when changing "
 	                         "from top/front/side views");
 
-	prop= RNA_def_property(srna, "use_rotate_around_active", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_rotate_around_active", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ORBIT_SELECTION);
 	RNA_def_property_ui_text(prop, "Rotate Around Selection", "Use selection as the pivot point");
 	
 	/* mini axis */
-	prop= RNA_def_property(srna, "show_mini_axis", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_mini_axis", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_ROTVIEWICON);
-	RNA_def_property_ui_text(prop, "Show Mini Axes", "Show a small rotating 3D axes in the bottom left corner of the 3D View");
+	RNA_def_property_ui_text(prop, "Show Mini Axes",
+	                         "Show a small rotating 3D axes in the bottom left corner of the 3D View");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "mini_axis_size", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "mini_axis_size", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "rvisize");
 	RNA_def_property_range(prop, 10, 64);
 	RNA_def_property_ui_text(prop, "Mini Axes Size", "The axes icon's size");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "mini_axis_brightness", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "mini_axis_brightness", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "rvibright");
 	RNA_def_property_range(prop, 0, 10);
 	RNA_def_property_ui_text(prop, "Mini Axes Brightness", "Brightness of the icon");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "smooth_view", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "smooth_view", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "smooth_viewtx");
 	RNA_def_property_range(prop, 0, 1000);
 	RNA_def_property_ui_text(prop, "Smooth View", "Time to animate the view in milliseconds, zero to disable");
 
-	prop= RNA_def_property(srna, "rotation_angle", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "rotation_angle", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "pad_rot_angle");
 	RNA_def_property_range(prop, 0, 90);
 	RNA_def_property_ui_text(prop, "Rotation Angle", "Rotation step for numerical pad keys (2 4 6 8)");
 
 	/* 3D transform widget */
-	prop= RNA_def_property(srna, "show_manipulator", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_manipulator", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "tw_flag", V3D_USE_MANIPULATOR);
 	RNA_def_property_ui_text(prop, "Manipulator", "Use 3D transform manipulator");
 	RNA_def_property_update(prop, 0, "rna_userdef_show_manipulator_update");
 
-	prop= RNA_def_property(srna, "manipulator_size", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "manipulator_size", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "tw_size");
 	RNA_def_property_range(prop, 2, 40);
 	RNA_def_property_int_default(prop, 15);
 	RNA_def_property_ui_text(prop, "Manipulator Size", "Diameter of widget, in 10 pixel units");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "manipulator_handle_size", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "manipulator_handle_size", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "tw_handlesize");
 	RNA_def_property_range(prop, 2, 40);
 	RNA_def_property_int_default(prop, 25);
 	RNA_def_property_ui_text(prop, "Manipulator Handle Size", "Size of widget handles as percentage of widget radius");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "manipulator_hotspot", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "manipulator_hotspot", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "tw_hotspot");
 	RNA_def_property_range(prop, 4, 40);
 	RNA_def_property_int_default(prop, 14);
 	RNA_def_property_ui_text(prop, "Manipulator Hotspot", "Pixel distance around the handles to accept mouse clicks");
 
-	prop= RNA_def_property(srna, "object_origin_size", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "object_origin_size", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "obcenter_dia");
 	RNA_def_property_range(prop, 4, 10);
 	RNA_def_property_ui_text(prop, "Object Origin Size", "Diameter in Pixels for Object/Lamp origin display");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
 	/* View2D Grid Displays */
-	prop= RNA_def_property(srna, "view2d_grid_spacing_min", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "view2d_grid_spacing_min", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "v2d_min_gridsize");
-	RNA_def_property_range(prop, 1, 500); // XXX: perhaps the lower range should only go down to 5?
+	RNA_def_property_range(prop, 1, 500); /* XXX: perhaps the lower range should only go down to 5? */
 	RNA_def_property_ui_text(prop, "2D View Minimum Grid Spacing",
 	                         "Minimum number of pixels between each gridline in 2D Viewports");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-		// TODO: add a setter for this, so that we can bump up the minimum size as necessary...
-	prop= RNA_def_property(srna, "timecode_style", PROP_ENUM, PROP_NONE);
+		/* TODO: add a setter for this, so that we can bump up the minimum size as necessary... */
+	prop = RNA_def_property(srna, "timecode_style", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, timecode_styles);
 	RNA_def_property_enum_sdna(prop, NULL, "timecode_style");
 	RNA_def_property_enum_funcs(prop, NULL, "rna_userdef_timecode_style_set", NULL);
@@ -2510,17 +2555,18 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
 		{AUTOKEY_MODE_EDITKEYS, "REPLACE_KEYS", 0, "Replace", ""},
 		{0, NULL, 0, NULL, NULL}};
 		
-	static const EnumPropertyItem material_link_items[]= {
+	static const EnumPropertyItem material_link_items[] = {
 		{0, "OBDATA", 0, "ObData", "Toggle whether the material is linked to object data or the object block"},
-		{USER_MAT_ON_OB, "OBJECT", 0, "Object", "Toggle whether the material is linked to object data or the object block"},
+		{USER_MAT_ON_OB, "OBJECT", 0, "Object",
+		                 "Toggle whether the material is linked to object data or the object block"},
 		{0, NULL, 0, NULL, NULL}};
 		
-	static const EnumPropertyItem object_align_items[]= {
+	static const EnumPropertyItem object_align_items[] = {
 		{0, "WORLD", 0, "World", "Align newly added objects to the world coordinate system"},
 		{USER_ADD_VIEWALIGNED, "VIEW", 0, "View", "Align newly added objects facing the active 3D View direction"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "UserPreferencesEdit", NULL);
+	srna = RNA_def_struct(brna, "UserPreferencesEdit", NULL);
 	RNA_def_struct_sdna(srna, "UserDef");
 	RNA_def_struct_nested(brna, srna, "UserPreferences");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
@@ -2528,171 +2574,186 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
 	
 	/* Edit Methods */
 	
-	prop= RNA_def_property(srna, "material_link", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "material_link", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, material_link_items);
 	RNA_def_property_ui_text(prop, "Material Link To",
 	                         "Toggle whether the material is linked to object data or the object block");
 	
-	prop= RNA_def_property(srna, "object_align", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "object_align", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, object_align_items);
 	RNA_def_property_ui_text(prop, "Align Object To",
-	                         "When adding objects from a 3D View menu, either align them with that view or with the world");
+	                         "When adding objects from a 3D View menu, either align them with that view or "
+	                         "with the world");
 
-	prop= RNA_def_property(srna, "use_enter_edit_mode", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_enter_edit_mode", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_ADD_EDITMODE);
 	RNA_def_property_ui_text(prop, "Enter Edit Mode", "Enter Edit Mode automatically after adding a new object");
 
-	prop= RNA_def_property(srna, "use_drag_immediately", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_drag_immediately", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_RELEASECONFIRM);
-	RNA_def_property_ui_text(prop, "Release confirms", "Moving things with a mouse drag confirms when releasing the button");
+	RNA_def_property_ui_text(prop, "Release confirms",
+	                         "Moving things with a mouse drag confirms when releasing the button");
 	
 	/* Undo */
-	prop= RNA_def_property(srna, "undo_steps", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "undo_steps", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "undosteps");
 	RNA_def_property_range(prop, 0, 64);
 	RNA_def_property_ui_text(prop, "Undo Steps", "Number of undo steps available (smaller values conserve memory)");
 
-	prop= RNA_def_property(srna, "undo_memory_limit", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "undo_memory_limit", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "undomemory");
 	RNA_def_property_range(prop, 0, 32767);
 	RNA_def_property_ui_text(prop, "Undo Memory Size", "Maximum memory usage in megabytes (0 means unlimited)");
 
-	prop= RNA_def_property(srna, "use_global_undo", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_global_undo", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_GLOBALUNDO);
 	RNA_def_property_ui_text(prop, "Global Undo",
-	                         "Global undo works by keeping a full copy of the file itself in memory, so takes extra memory");
+	                         "Global undo works by keeping a full copy of the file itself in memory, "
+	                         "so takes extra memory");
 
-	/* auto keyframing */	
-	prop= RNA_def_property(srna, "use_auto_keying", PROP_BOOLEAN, PROP_NONE);
+	/* auto keyframing */
+	prop = RNA_def_property(srna, "use_auto_keying", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "autokey_mode", AUTOKEY_ON);
 	RNA_def_property_ui_text(prop, "Auto Keying Enable",
-	                         "Automatic keyframe insertion for Objects and Bones (default setting used for new Scenes)");
+	                         "Automatic keyframe insertion for Objects and Bones "
+	                         "(default setting used for new Scenes)");
 	RNA_def_property_ui_icon(prop, ICON_REC, 0);
 
-	prop= RNA_def_property(srna, "auto_keying_mode", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "auto_keying_mode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, auto_key_modes);
 	RNA_def_property_enum_funcs(prop, "rna_userdef_autokeymode_get", "rna_userdef_autokeymode_set", NULL);
 	RNA_def_property_ui_text(prop, "Auto Keying Mode",
 	                         "Mode of automatic keyframe insertion for Objects and Bones "
 	                         "(default setting used for new Scenes)");
 
-	prop= RNA_def_property(srna, "use_keyframe_insert_available", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_keyframe_insert_available", PROP_BOOLEAN, PROP_NONE);
 	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");
+	RNA_def_property_ui_text(prop, "Auto Keyframe Insert Available",
+	                         "Automatic keyframe insertion in available F-Curves");
 	
 	/* keyframing settings */
-	prop= RNA_def_property(srna, "use_keyframe_insert_needed", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_keyframe_insert_needed", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_INSERTNEEDED);
 	RNA_def_property_ui_text(prop, "Keyframe Insert Needed", "Keyframe insertion only when keyframe needed");
 
-	prop= RNA_def_property(srna, "use_visual_keying", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_visual_keying", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_AUTOMATKEY);
 	RNA_def_property_ui_text(prop, "Visual Keying", "Use Visual keying automatically for constrained objects");
 	
-	prop= RNA_def_property(srna, "use_insertkey_xyz_to_rgb", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_insertkey_xyz_to_rgb", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_XYZ2RGB);
 	RNA_def_property_ui_text(prop, "New F-Curve Colors - XYZ to RGB",
 	                         "Color for newly added transformation F-Curves (Location, Rotation, Scale) "
 	                         "and also Color is based on the transform axis");
 	
-	prop= RNA_def_property(srna, "keyframe_new_interpolation_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "keyframe_new_interpolation_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, beztriple_interpolation_mode_items);
 	RNA_def_property_enum_sdna(prop, NULL, "ipo_new");
 	RNA_def_property_ui_text(prop, "New Interpolation Type",
 	                         "Interpolation mode used for first keyframe on newly added F-Curves "
 	                         "(subsequent keyframes take interpolation from preceeding keyframe)");
 	
-	prop= RNA_def_property(srna, "keyframe_new_handle_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "keyframe_new_handle_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, keyframe_handle_type_items);
 	RNA_def_property_enum_sdna(prop, NULL, "keyhandles_new");
 	RNA_def_property_ui_text(prop, "New Handles Type", "Handle type for handles of new keyframes");
 	
 	/* frame numbers */
-	prop= RNA_def_property(srna, "use_negative_frames", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_negative_frames", PROP_BOOLEAN, PROP_NONE);
 	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");
+	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");
+	RNA_def_property_range(prop, 0.001f, 1.0f);
+	RNA_def_property_ui_text(prop, "Unselected F-Curve Visibility",
+	                         "Amount that unselected F-Curves stand out from the background (Graph Editor)");
+	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_GRAPH, NULL);
 	
 	/* grease pencil */
-	prop= RNA_def_property(srna, "grease_pencil_manhattan_distance", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "grease_pencil_manhattan_distance", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "gp_manhattendist");
 	RNA_def_property_range(prop, 0, 100);
-	RNA_def_property_ui_text(prop, "Grease Pencil Manhattan Distance", "Pixels moved by mouse per axis when drawing stroke");
+	RNA_def_property_ui_text(prop, "Grease Pencil Manhattan Distance",
+	                         "Pixels moved by mouse per axis when drawing stroke");
 
-	prop= RNA_def_property(srna, "grease_pencil_euclidean_distance", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "grease_pencil_euclidean_distance", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "gp_euclideandist");
 	RNA_def_property_range(prop, 0, 100);
 	RNA_def_property_ui_text(prop, "Grease Pencil Euclidean Distance",
 	                         "Distance moved by mouse when drawing stroke (in pixels) to include");
 
-	prop= RNA_def_property(srna, "use_grease_pencil_smooth_stroke", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_grease_pencil_smooth_stroke", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gp_settings", GP_PAINT_DOSMOOTH);
 	RNA_def_property_ui_text(prop, "Grease Pencil Smooth Stroke", "Smooth the final stroke");
 
-	prop= RNA_def_property(srna, "use_grease_pencil_simplify_stroke", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_grease_pencil_simplify_stroke", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gp_settings", GP_PAINT_DOSIMPLIFY);
 	RNA_def_property_ui_text(prop, "Grease Pencil Simplify Stroke", "Simplify the final stroke");
 
-	prop= RNA_def_property(srna, "grease_pencil_eraser_radius", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "grease_pencil_eraser_radius", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "gp_eraser");
 	RNA_def_property_range(prop, 0, 100);
 	RNA_def_property_ui_text(prop, "Grease Pencil Eraser Radius", "Radius of eraser 'brush'");
 
 	/* sculpt and paint */
 
-	prop= RNA_def_property(srna, "sculpt_paint_overlay_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+	prop = RNA_def_property(srna, "sculpt_paint_overlay_color", PROP_FLOAT, PROP_COLOR_GAMMA);
 	RNA_def_property_float_sdna(prop, NULL, "sculpt_paint_overlay_col");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Sculpt/Paint Overlay Color", "Color of texture overlay");
 
 	/* duplication linking */
-	prop= RNA_def_property(srna, "use_duplicate_mesh", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_duplicate_mesh", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_MESH);
 	RNA_def_property_ui_text(prop, "Duplicate Mesh", "Causes mesh data to be duplicated with the object");
 
-	prop= RNA_def_property(srna, "use_duplicate_surface", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_duplicate_surface", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_SURF);
 	RNA_def_property_ui_text(prop, "Duplicate Surface", "Causes surface data to be duplicated with the object");
 	
-	prop= RNA_def_property(srna, "use_duplicate_curve", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_duplicate_curve", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_CURVE);
 	RNA_def_property_ui_text(prop, "Duplicate Curve", "Causes curve data to be duplicated with the object");
 
-	prop= RNA_def_property(srna, "use_duplicate_text", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_duplicate_text", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_FONT);
 	RNA_def_property_ui_text(prop, "Duplicate Text", "Causes text data to be duplicated with the object");
 
-	prop= RNA_def_property(srna, "use_duplicate_metaball", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_duplicate_metaball", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_MBALL);
 	RNA_def_property_ui_text(prop, "Duplicate Metaball", "Causes metaball data to be duplicated with the object");
 	
-	prop= RNA_def_property(srna, "use_duplicate_armature", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_duplicate_armature", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_ARM);
 	RNA_def_property_ui_text(prop, "Duplicate Armature", "Causes armature data to be duplicated with the object");
 
-	prop= RNA_def_property(srna, "use_duplicate_lamp", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_duplicate_lamp", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_LAMP);
 	RNA_def_property_ui_text(prop, "Duplicate Lamp", "Causes lamp data to be duplicated with the object");
 
-	prop= RNA_def_property(srna, "use_duplicate_material", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_duplicate_material", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_MAT);
 	RNA_def_property_ui_text(prop, "Duplicate Material", "Causes material data to be duplicated with the object");
 
-	prop= RNA_def_property(srna, "use_duplicate_texture", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_duplicate_texture", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_TEX);
 	RNA_def_property_ui_text(prop, "Duplicate Texture", "Causes texture data to be duplicated with the object");
 		
-		// xxx
-	prop= RNA_def_property(srna, "use_duplicate_fcurve", PROP_BOOLEAN, PROP_NONE);
+		/* xxx */
+	prop = RNA_def_property(srna, "use_duplicate_fcurve", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_IPO);
 	RNA_def_property_ui_text(prop, "Duplicate F-Curve", "Causes F-curve data to be duplicated with the object");
-		// xxx
-	prop= RNA_def_property(srna, "use_duplicate_action", PROP_BOOLEAN, PROP_NONE);
+		/* xxx */
+	prop = RNA_def_property(srna, "use_duplicate_action", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_ACT);
 	RNA_def_property_ui_text(prop, "Duplicate Action", "Causes actions to be duplicated with the object");
 	
-	prop= RNA_def_property(srna, "use_duplicate_particle", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_duplicate_particle", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_PSYS);
 	RNA_def_property_ui_text(prop, "Duplicate Particle", "Causes particle systems to be duplicated with the object");
 }
@@ -2713,7 +2774,7 @@ static void rna_def_userdef_system(BlenderRNA *brna)
 		{128, "CLAMP_128", 0, "128", ""},
 		{0, NULL, 0, NULL, NULL}};
 
-	static EnumPropertyItem anisotropic_items[]  ={
+	static EnumPropertyItem anisotropic_items[]  = {
 		{1, "FILTER_0", 0, "Off", ""},
 		{2, "FILTER_2", 0, "2x", ""},
 		{4, "FILTER_4", 0, "4x", ""},
@@ -2741,19 +2802,19 @@ static void rna_def_userdef_system(BlenderRNA *brna)
 		{2, "OPENAL", 0, "OpenAL", "OpenAL device - supports 3D audio, recommended for game engine usage"},
 #endif
 #ifdef WITH_JACK
-		{3, "JACK", 0, "Jack", "Jack device - open source pro audio, recommended for pro audio users"},
+		{3, "JACK", 0, "Jack", "JACK - Audio Connection Kit, recommended for pro audio users"},
 #endif
 		{0, NULL, 0, NULL, NULL}};
 
 	static EnumPropertyItem audio_rate_items[] = {
-//		{8000, "RATE_8000", 0, "8 kHz", "Set audio sampling rate to 8000 samples per second"},
-//		{11025, "RATE_11025", 0, "11.025 kHz", "Set audio sampling rate to 11025 samples per second"},
-//		{16000, "RATE_16000", 0, "16 kHz", "Set audio sampling rate to 16000 samples per second"},
-//		{22050, "RATE_22050", 0, "22.05 kHz", "Set audio sampling rate to 22050 samples per second"},
-//		{32000, "RATE_32000", 0, "32 kHz", "Set audio sampling rate to 32000 samples per second"},
+/*		{8000, "RATE_8000", 0, "8 kHz", "Set audio sampling rate to 8000 samples per second"}, */
+/*		{11025, "RATE_11025", 0, "11.025 kHz", "Set audio sampling rate to 11025 samples per second"}, */
+/*		{16000, "RATE_16000", 0, "16 kHz", "Set audio sampling rate to 16000 samples per second"}, */
+/*		{22050, "RATE_22050", 0, "22.05 kHz", "Set audio sampling rate to 22050 samples per second"}, */
+/*		{32000, "RATE_32000", 0, "32 kHz", "Set audio sampling rate to 32000 samples per second"}, */
 		{44100, "RATE_44100", 0, "44.1 kHz", "Set audio sampling rate to 44100 samples per second"},
 		{48000, "RATE_48000", 0, "48 kHz", "Set audio sampling rate to 48000 samples per second"},
-//		{88200, "RATE_88200", 0, "88.2 kHz", "Set audio sampling rate to 88200 samples per second"},
+/*		{88200, "RATE_88200", 0, "88.2 kHz", "Set audio sampling rate to 88200 samples per second"}, */
 		{96000, "RATE_96000", 0, "96 kHz", "Set audio sampling rate to 96000 samples per second"},
 		{192000, "RATE_192000", 0, "192 kHz", "Set audio sampling rate to 192000 samples per second"},
 		{0, NULL, 0, NULL, NULL}};
@@ -2779,7 +2840,8 @@ static void rna_def_userdef_system(BlenderRNA *brna)
 		{USER_DRAW_AUTOMATIC, "AUTOMATIC", 0, "Automatic", "Automatically set based on graphics card and driver"},
 		{USER_DRAW_TRIPLE, "TRIPLE_BUFFER", 0, "Triple Buffer",
 		                   "Use a third buffer for minimal redraws at the cost of more memory"},
-		{USER_DRAW_OVERLAP, "OVERLAP", 0, "Overlap", "Redraw all overlapping regions, minimal memory usage but more redraws"},
+		{USER_DRAW_OVERLAP, "OVERLAP", 0, "Overlap",
+		                    "Redraw all overlapping regions, minimal memory usage but more redraws"},
 		{USER_DRAW_OVERLAP_FLIP, "OVERLAP_FLIP", 0, "Overlap Flip",
 		                         "Redraw all overlapping regions, minimal memory usage but more redraws "
 		                         "(for graphics drivers that do flipping)"},
@@ -2798,9 +2860,9 @@ static void rna_def_userdef_system(BlenderRNA *brna)
 	/* 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: 29 (kyrgyz). */
+	 *       here is the highest define currently in use: 30 (turkish). */
 	static EnumPropertyItem language_items[] = {
-		{ 0, "", 0, "Nearly done", ""},
+		{ 0, "", 0, N_("Nearly done"), ""},
 		{ 0, "DEFAULT", 0, "Default (Default)", ""},
 		{ 1, "ENGLISH", 0, "English (English)", "en_US"},
 		{ 8, "FRENCH", 0, "French (Français)", "fr_FR"},
@@ -2809,30 +2871,31 @@ static void rna_def_userdef_system(BlenderRNA *brna)
 		{13, "SIMPLIFIED_CHINESE", 0, "Simplified Chinese (简体中文)", "zh_CN"},
 		{ 9, "SPANISH", 0, "Spanish (Español)", "es"},
 		{14, "TRADITIONAL_CHINESE", 0, "Traditional Chinese (繁體中文)", "zh_TW"},
-		{ 0, "", 0, "In progress", ""},
+		{ 0, "", 0, N_("In progress"), ""},
 		/* using the utf8 flipped form of Arabic (العربية) */
 		{21, "ARABIC", 0, "Arabic (ﺔﻴﺑﺮﻌﻟﺍ)", "ar_EG"},
-		{12, "BRAZILIAN_PORTUGUESE", 0, "Brazilian Portuguese (Português do Brasil)", "pt_BR"},
 		{22, "BULGARIAN", 0, "Bulgarian (Български)", "bg_BG"},
 		{10, "CATALAN", 0, "Catalan (Català)", "ca_AD"},
 		{16, "CROATIAN", 0, "Croatian (Hrvatski)", "hr_HR"},
 		{11, "CZECH", 0, "Czech (Český)", "cs_CZ"},
-		{ 3, "DUTCH", 0, "Dutch (Nederlandse taal)", "nl_NL"},
+/*		{ 3, "DUTCH", 0, "Dutch (Nederlandse taal)", "nl_NL"},*/ /* XXX No po's yet. */
 		{ 6, "FINNISH", 0, "Finnish (Suomi)", "fi_FI"},
 		{ 5, "GERMAN", 0, "German (Deutsch)", "de_DE"},
 		{23, "GREEK", 0, "Greek (Ελληνικά)", "el_GR"},
 		{27, "INDONESIAN", 0, "Indonesian (Bahasa indonesia)", "id_ID"},
 		{ 2, "JAPANESE", 0, "Japanese (日本語)", "ja_JP"},
-		{29, "KYRGYZ", 0, "Kyrgyz (Kyrgyz tili)", "ki"},
-		{24, "KOREAN", 0, "Korean (한국 언어)", "ko_KR"},
+		{29, "KYRGYZ", 0, "Kyrgyz (Кыргыз тили)", "ky_KG"},
+/*		{24, "KOREAN", 0, "Korean (한국 언어)", "ko_KR"},*/ /* XXX No po's yet. */
 		{25, "NEPALI", 0, "Nepali (नेपाली)", "ne_NP"},
 		/* using the utf8 flipped form of Persian (فارسی) */
-		{26, "PERSIAN", 0, "Persian (ﯽﺳﺭﺎﻓ)", "fa_PE"},
+		{26, "PERSIAN", 0, "Persian (ﯽﺳﺭﺎﻓ)", "fa_IR"},
 		{19, "POLISH", 0, "Polish (Polski)", "pl_PL"},
-		{20, "ROMANIAN", 0, "Romanian (Român)", "ro_RO"},
+		{12, "BRAZILIAN_PORTUGUESE", 0, "Portuguese (Português)", "pt"},
+/*		{20, "ROMANIAN", 0, "Romanian (Român)", "ro_RO"},*/ /* XXX No po's yet. */
 		{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"},
 		{18, "UKRAINIAN", 0, "Ukrainian (Український)", "uk_UA"},
 		{ 0, NULL, 0, NULL, NULL}};
 
@@ -2842,7 +2905,7 @@ static void rna_def_userdef_system(BlenderRNA *brna)
 		{ 0, NULL, 0, NULL, NULL}};
 #endif
 
-	srna= RNA_def_struct(brna, "UserPreferencesSystem", NULL);
+	srna = RNA_def_struct(brna, "UserPreferencesSystem", NULL);
 	RNA_def_struct_sdna(srna, "UserDef");
 	RNA_def_struct_nested(brna, srna, "UserPreferences");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
@@ -2850,220 +2913,228 @@ static void rna_def_userdef_system(BlenderRNA *brna)
 
 	/* Language */
 	
-	prop= RNA_def_property(srna, "use_international_fonts", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_international_fonts", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_DOTRANSLATE);
 	RNA_def_property_ui_text(prop, "International Fonts", "Use international fonts");
 	RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_language_update");
 
-	prop= RNA_def_property(srna, "dpi", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "dpi", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "dpi");
 	RNA_def_property_range(prop, 48, 128);
 	RNA_def_property_ui_text(prop, "DPI", "Font size and resolution for display");
 	RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
 	
-	prop= RNA_def_property(srna, "scrollback", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "scrollback", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "scrollback");
 	RNA_def_property_range(prop, 32, 32768);
 	RNA_def_property_ui_text(prop, "Scrollback", "Maximum number of lines to store for the console buffer");
 
-	prop= RNA_def_property(srna, "author", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "author", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "author");
 	RNA_def_property_string_maxlength(prop, 80);
-	RNA_def_property_ui_text(prop, "Author", "Name that will be used in exported files when format supports such feature");
+	RNA_def_property_ui_text(prop, "Author",
+	                         "Name that will be used in exported files when format supports such feature");
 
 	/* Language Selection */
 
-	prop= RNA_def_property(srna, "language", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "language", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, language_items);
 	RNA_def_property_ui_text(prop, "Language", "Language used for translation");
 	RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_language_update");
 
-	prop= RNA_def_property(srna, "use_translate_tooltips", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_translate_tooltips", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_TR_TOOLTIPS);
 	RNA_def_property_ui_text(prop, "Translate Tooltips", "Translate Tooltips");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "use_translate_interface", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_translate_interface", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_TR_IFACE);
 	RNA_def_property_ui_text(prop, "Translate Interface", "Translate Interface");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "use_textured_fonts", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_textured_fonts", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_USETEXTUREFONT);
 	RNA_def_property_ui_text(prop, "Textured Fonts", "Use textures for drawing international fonts");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
 	/* System & OpenGL */
 
-	prop= RNA_def_property(srna, "solid_lights", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "solid_lights", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "light", "");
 	RNA_def_property_struct_type(prop, "UserSolidLight");
 	RNA_def_property_ui_text(prop, "Solid Lights", "Lights user to display objects in solid draw mode");
 
-	prop= RNA_def_property(srna, "use_weight_color_range", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_weight_color_range", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_CUSTOM_RANGE);
 	RNA_def_property_ui_text(prop, "Use Weight Color Range",
 	                         "Enable color range used for weight visualization in weight painting mode");
 	RNA_def_property_update(prop, 0, "rna_UserDef_weight_color_update");
 
-	prop= RNA_def_property(srna, "weight_color_range", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "weight_color_range", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "coba_weight");
 	RNA_def_property_struct_type(prop, "ColorRamp");
-	RNA_def_property_ui_text(prop, "Weight Color Range", "Color range used for weight visualization in weight painting mode");
+	RNA_def_property_ui_text(prop, "Weight Color Range",
+	                         "Color range used for weight visualization in weight painting mode");
 	RNA_def_property_update(prop, 0, "rna_UserDef_weight_color_update");
 
-	prop= RNA_def_property(srna, "color_picker_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "color_picker_type", PROP_ENUM, PROP_NONE);
 	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");
 	
-	prop= RNA_def_property(srna, "use_preview_images", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_preview_images", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ALLWINCODECS);
 	RNA_def_property_ui_text(prop, "Enable All Codecs",
 	                         "Allow user to choose any codec (Windows only, might generate instability)");
 
-	prop= RNA_def_property(srna, "use_scripts_auto_execute", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_scripts_auto_execute", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_SCRIPT_AUTOEXEC_DISABLE);
 	RNA_def_property_ui_text(prop, "Auto Run Python Scripts",
 	                         "Allow any .blend file to run scripts automatically "
 	                         "(unsafe with blend files from an untrusted source)");
 	RNA_def_property_update(prop, 0, "rna_userdef_script_autoexec_update");
 
-	prop= RNA_def_property(srna, "use_tabs_as_spaces", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_tabs_as_spaces", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_TXT_TABSTOSPACES_DISABLE);
 	RNA_def_property_ui_text(prop, "Tabs as Spaces",
 	                         "Automatically convert all new tabs into spaces for new and loaded text files");
 
-	prop= RNA_def_property(srna, "prefetch_frames", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "prefetch_frames", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "prefetchframes");
 	RNA_def_property_range(prop, 0, 500);
 	RNA_def_property_ui_text(prop, "Prefetch Frames", "Number of frames to render ahead during playback");
 
-	prop= RNA_def_property(srna, "memory_cache_limit", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "memory_cache_limit", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "memcachelimit");
-	RNA_def_property_range(prop, 0, (sizeof(void *) ==8)? 1024*16: 1024); /* 32 bit 2 GB, 64 bit 16 GB */
+	RNA_def_property_range(prop, 0, (sizeof(void *) == 8)? 1024*16: 1024); /* 32 bit 2 GB, 64 bit 16 GB */
 	RNA_def_property_ui_text(prop, "Memory Cache Limit", "Memory cache limit in sequencer (megabytes)");
 	RNA_def_property_update(prop, 0, "rna_Userdef_memcache_update");
 
-	prop= RNA_def_property(srna, "frame_server_port", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "frame_server_port", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "frameserverport");
 	RNA_def_property_range(prop, 0, 32727);
 	RNA_def_property_ui_text(prop, "Frame Server Port", "Frameserver Port for Frameserver Rendering");
 
-	prop= RNA_def_property(srna, "gl_clip_alpha", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "gl_clip_alpha", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "glalphaclip");
 	RNA_def_property_range(prop, 0.0f, 1.0f);
 	RNA_def_property_ui_text(prop, "Clip Alpha", "Clip alpha below this threshold in the 3D textured view");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 	
-	prop= RNA_def_property(srna, "use_mipmaps", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_mipmaps", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflags", USER_DISABLE_MIPMAP);
 	RNA_def_property_ui_text(prop, "Mipmaps",
-	                         "Scale textures for the 3D View (looks nicer but uses more memory and slows image reloading)");
+	                         "Scale textures for the 3D View (looks nicer but uses more memory and slows image "
+	                         "reloading)");
 	RNA_def_property_update(prop, 0, "rna_userdef_mipmap_update");
 
-	prop= RNA_def_property(srna, "use_16bit_textures", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_16bit_textures", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "use_16bit_textures", 1);
 	RNA_def_property_ui_text(prop, "16 Bit Float Textures", "Use 16 bit per component texture for float images");
 	RNA_def_property_update(prop, 0, "rna_userdef_gl_use_16bit_textures");
 
-	prop= RNA_def_property(srna, "use_vertex_buffer_objects", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_vertex_buffer_objects", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflags", USER_DISABLE_VBO);
-	RNA_def_property_ui_text(prop, "VBOs", "Use Vertex Buffer Objects (or Vertex Arrays, if unsupported) for viewport rendering");
-	RNA_def_property_update(prop, NC_WINDOW, NULL); /* this isnt essential but nice to check if VBO draws any differently */
+	RNA_def_property_ui_text(prop, "VBOs",
+	                         "Use Vertex Buffer Objects (or Vertex Arrays, if unsupported) for viewport rendering");
+		/* this isn't essential but nice to check if VBO draws any differently */
+	RNA_def_property_update(prop, NC_WINDOW, NULL);
 
-	prop= RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
+	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)");
+	RNA_def_property_ui_text(prop, "Anti-aliasing",
+	                         "Use anti-aliasing for the 3D view (may impact redraw performance)");
 
-	prop= RNA_def_property(srna, "anisotropic_filter", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "anisotropic_filter", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "anisotropic_filter");
 	RNA_def_property_enum_items(prop, anisotropic_items);
 	RNA_def_property_enum_default(prop, 1);
 	RNA_def_property_ui_text(prop, "Anisotropic Filter",
-	                         "Quality of the anisotropic filtering (values greater than 1.0 enable anisotropic filtering)");
+	                         "Quality of the anisotropic filtering (values greater than 1.0 enable anisotropic "
+	                         "filtering)");
 	RNA_def_property_update(prop, 0, "rna_userdef_anisotropic_update");
 	
-	prop= RNA_def_property(srna, "gl_texture_limit", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "gl_texture_limit", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "glreslimit");
 	RNA_def_property_enum_items(prop, gl_texture_clamp_items);
 	RNA_def_property_ui_text(prop, "GL Texture Limit", "Limit the texture size to save graphics memory");
 	RNA_def_property_update(prop, 0, "rna_userdef_gl_texture_limit_update");
 
-	prop= RNA_def_property(srna, "texture_time_out", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "texture_time_out", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "textimeout");
 	RNA_def_property_range(prop, 0, 3600);
 	RNA_def_property_ui_text(prop, "Texture Time Out",
 	                         "Time since last access of a GL texture in seconds after which it is freed "
 	                         "(set to 0 to keep textures allocated)");
 
-	prop= RNA_def_property(srna, "texture_collection_rate", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "texture_collection_rate", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "texcollectrate");
 	RNA_def_property_range(prop, 1, 3600);
 	RNA_def_property_ui_text(prop, "Texture Collection Rate",
 	                         "Number of seconds between each run of the GL texture garbage collector");
 
-	prop= RNA_def_property(srna, "window_draw_method", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "window_draw_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "wmdrawmethod");
 	RNA_def_property_enum_items(prop, draw_method_items);
 	RNA_def_property_ui_text(prop, "Window Draw Method", "Drawing method used by the window manager");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "audio_mixing_buffer", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "audio_mixing_buffer", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "mixbufsize");
 	RNA_def_property_enum_items(prop, audio_mixing_samples_items);
 	RNA_def_property_ui_text(prop, "Audio Mixing Buffer", "Number of samples used by the audio mixing buffer");
 	RNA_def_property_update(prop, 0, "rna_UserDef_audio_update");
 
-	prop= RNA_def_property(srna, "audio_device", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "audio_device", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "audiodevice");
 	RNA_def_property_enum_items(prop, audio_device_items);
 	RNA_def_property_ui_text(prop, "Audio Device", "Audio output device");
 	RNA_def_property_update(prop, 0, "rna_UserDef_audio_update");
 
-	prop= RNA_def_property(srna, "audio_sample_rate", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "audio_sample_rate", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "audiorate");
 	RNA_def_property_enum_items(prop, audio_rate_items);
 	RNA_def_property_ui_text(prop, "Audio Sample Rate", "Audio sample rate");
 	RNA_def_property_update(prop, 0, "rna_UserDef_audio_update");
 
-	prop= RNA_def_property(srna, "audio_sample_format", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "audio_sample_format", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "audioformat");
 	RNA_def_property_enum_items(prop, audio_format_items);
 	RNA_def_property_ui_text(prop, "Audio Sample Format", "Audio sample format");
 	RNA_def_property_update(prop, 0, "rna_UserDef_audio_update");
 
-	prop= RNA_def_property(srna, "audio_channels", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "audio_channels", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "audiochannels");
 	RNA_def_property_enum_items(prop, audio_channel_items);
 	RNA_def_property_ui_text(prop, "Audio Channels", "Audio channel count");
 	RNA_def_property_update(prop, 0, "rna_UserDef_audio_update");
 
-	prop= RNA_def_property(srna, "screencast_fps", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "screencast_fps", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "scrcastfps");
 	RNA_def_property_range(prop, 10, 50);
 	RNA_def_property_ui_text(prop, "FPS", "Frame rate for the screencast to be played back");
 
-	prop= RNA_def_property(srna, "screencast_wait_time", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "screencast_wait_time", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "scrcastwait");
 	RNA_def_property_range(prop, 50, 1000);
-	RNA_def_property_ui_text(prop, "Wait Timer (ms)", "Time in milliseconds between each frame recorded for screencast");
+	RNA_def_property_ui_text(prop, "Wait Timer (ms)",
+	                         "Time in milliseconds between each frame recorded for screencast");
 
-	prop= RNA_def_property(srna, "use_text_antialiasing", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_text_antialiasing", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "text_render", USER_TEXT_DISABLE_AA);
 	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");
 	
 #ifdef WITH_CYCLES
-	prop= RNA_def_property(srna, "compute_device_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "compute_device_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
 	RNA_def_property_enum_sdna(prop, NULL, "compute_device_type");
 	RNA_def_property_enum_items(prop, compute_device_type_items);
 	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_userdef_compute_device_type_itemf");
 	RNA_def_property_ui_text(prop, "Compute Device Type", "Device to use for computation (rendering with Cycles)");
 
-	prop= RNA_def_property(srna, "compute_device", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "compute_device", PROP_ENUM, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
 	RNA_def_property_enum_sdna(prop, NULL, "compute_device_id");
 	RNA_def_property_enum_items(prop, compute_device_items);
@@ -3090,7 +3161,8 @@ static void rna_def_userdef_input(BlenderRNA *brna)
 	static EnumPropertyItem view_zoom_styles[] = {
 		{USER_ZOOM_CONT, "CONTINUE", 0, "Continue", "Old style zoom, continues while moving mouse up or down"},
 		{USER_ZOOM_DOLLY, "DOLLY", 0, "Dolly", "Zoom in and out based on vertical mouse movement"},
-		{USER_ZOOM_SCALE, "SCALE", 0, "Scale", "Zoom in and out like scaling the view, mouse movements relative to center"},
+		{USER_ZOOM_SCALE, "SCALE", 0, "Scale",
+		                  "Zoom in and out like scaling the view, mouse movements relative to center"},
 		{0, NULL, 0, NULL, NULL}};
 	
 	static EnumPropertyItem view_zoom_axes[] = {
@@ -3098,142 +3170,147 @@ static void rna_def_userdef_input(BlenderRNA *brna)
 		{USER_ZOOM_HORIZ, "HORIZONTAL", 0, "Horizontal", "Zoom in and out based on horizontal mouse movement"},
 		{0, NULL, 0, NULL, NULL}};
 		
-	srna= RNA_def_struct(brna, "UserPreferencesInput", NULL);
+	srna = RNA_def_struct(brna, "UserPreferencesInput", NULL);
 	RNA_def_struct_sdna(srna, "UserDef");
 	RNA_def_struct_nested(brna, srna, "UserPreferences");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "Input", "Settings for input devices");
 	
-	prop= RNA_def_property(srna, "select_mouse", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "select_mouse", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, select_mouse_items);
 	RNA_def_property_enum_funcs(prop, NULL, "rna_userdef_select_mouse_set", NULL);
 	RNA_def_property_ui_text(prop, "Select Mouse", "Mouse button used for selection");
 	
-	prop= RNA_def_property(srna, "view_zoom_method", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "view_zoom_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "viewzoom");
 	RNA_def_property_enum_items(prop, view_zoom_styles);
 	RNA_def_property_ui_text(prop, "Zoom Style", "Which style to use for viewport scaling");
 	
-	prop= RNA_def_property(srna, "view_zoom_axis", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "view_zoom_axis", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "uiflag");
 	RNA_def_property_enum_items(prop, view_zoom_axes);
 	RNA_def_property_ui_text(prop, "Zoom Axis", "Axis of mouse movement to zoom in or out on");
 	
-	prop= RNA_def_property(srna, "invert_mouse_zoom", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_mouse_zoom", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ZOOM_INVERT);
 	RNA_def_property_ui_text(prop, "Invert Zoom Direction", "Invert the axis of mouse movement for zooming");
 	
-	prop= RNA_def_property(srna, "view_rotate_method", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "view_rotate_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
 	RNA_def_property_enum_items(prop, view_rotation_items);
 	RNA_def_property_ui_text(prop, "View Rotation", "Rotation style in the viewport");
 	
-	prop= RNA_def_property(srna, "use_mouse_continuous", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_mouse_continuous", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_CONTINUOUS_MOUSE);
 	RNA_def_property_ui_text(prop, "Continuous Grab",
-	                         "Allow moving the mouse outside the view on some manipulations (transform, ui control drag)");
+	                         "Allow moving the mouse outside the view on some manipulations "
+	                         "(transform, ui control drag)");
 	
 	/* tweak tablet & mouse preset */
-	prop= RNA_def_property(srna, "drag_threshold", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "drag_threshold", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "dragthreshold");
 	RNA_def_property_range(prop, 3, 40);
-	RNA_def_property_ui_text(prop, "Drag Threshold", "Amount of pixels you have to drag before dragging UI items happens");
+	RNA_def_property_ui_text(prop, "Drag Threshold",
+	                         "Amount of pixels you have to drag before dragging UI items happens");
 
-	prop= RNA_def_property(srna, "tweak_threshold", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "tweak_threshold", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "tweak_threshold");
 	RNA_def_property_range(prop, 3, 1024);
-	RNA_def_property_ui_text(prop, "Tweak Threshold", "Number of pixels you have to drag before tweak event is triggered");
+	RNA_def_property_ui_text(prop, "Tweak Threshold",
+	                         "Number of pixels you have to drag before tweak event is triggered");
 
 	/* 3D mouse settings */
 	/* global options */
-	prop= RNA_def_property(srna, "ndof_sensitivity", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "ndof_sensitivity", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_range(prop, 0.25f, 4.0f);
 	RNA_def_property_ui_text(prop, "Sensitivity", "Overall sensitivity of the 3D Mouse");
 
-	prop= RNA_def_property(srna, "ndof_zoom_updown", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "ndof_zoom_updown", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ZOOM_UPDOWN);
-	RNA_def_property_ui_text(prop, "Zoom = Up/Down", "Zoom using up/down on the device (otherwise forward/backward)");
+	RNA_def_property_ui_text(prop, "Zoom = Up/Down",
+	                         "Zoom using up/down on the device (otherwise forward/backward)");
 
-	prop= RNA_def_property(srna, "ndof_zoom_invert", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "ndof_zoom_invert", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ZOOM_INVERT);
-	RNA_def_property_ui_text(prop, "Invert Zoom", "Zoom using opposite direction");	
+	RNA_def_property_ui_text(prop, "Invert Zoom", "Zoom using opposite direction");
 
 	/* 3D view */
-	prop= RNA_def_property(srna, "ndof_show_guide", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "ndof_show_guide", PROP_BOOLEAN, PROP_NONE);
 	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: roll */
-	prop= RNA_def_property(srna, "ndof_roll_invert_axis", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "ndof_roll_invert_axis", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ROLL_INVERT_AXIS);
 	RNA_def_property_ui_text(prop, "Invert roll Axis", "Invert roll axis");
 
 	/* 3D view: tilt */
-	prop= RNA_def_property(srna, "ndof_tilt_invert_axis", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "ndof_tilt_invert_axis", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_TILT_INVERT_AXIS);
 	RNA_def_property_ui_text(prop, "Invert tilt Axis", "Invert tilt axis");
 
 	/* 3D view: rotate */
-	prop= RNA_def_property(srna, "ndof_rotate_invert_axis", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "ndof_rotate_invert_axis", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ROTATE_INVERT_AXIS);
 	RNA_def_property_ui_text(prop, "Invert rotation Axis", "Invert rotation axis");
 
 	/* 3D view: pan x */
-	prop= RNA_def_property(srna, "ndof_panx_invert_axis", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "ndof_panx_invert_axis", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_PANX_INVERT_AXIS);
 	RNA_def_property_ui_text(prop, "Invert x Axis", "Invert x axis");
 
 	/* 3D view: pan y */
-	prop= RNA_def_property(srna, "ndof_pany_invert_axis", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "ndof_pany_invert_axis", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_PANY_INVERT_AXIS);
 	RNA_def_property_ui_text(prop, "Invert y Axis", "Invert y axis");
 
 	/* 3D view: pan z */
-	prop= RNA_def_property(srna, "ndof_panz_invert_axis", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "ndof_panz_invert_axis", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_PANZ_INVERT_AXIS);
 	RNA_def_property_ui_text(prop, "Invert z Axis", "Invert z axis");
 
 	/* 3D view: fly */
-	prop= RNA_def_property(srna, "ndof_lock_horizon", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "ndof_lock_horizon", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_LOCK_HORIZON);
 	RNA_def_property_ui_text(prop, "Lock Horizon", "Keep horizon level while flying with 3D Mouse");
 
-	prop= RNA_def_property(srna, "ndof_fly_helicopter", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "ndof_fly_helicopter", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_FLY_HELICOPTER);
 	RNA_def_property_ui_text(prop, "Helicopter Mode", "Device up/down directly controls your Z position");
 
 
-	prop= RNA_def_property(srna, "mouse_double_click_time", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "mouse_double_click_time", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "dbl_click_time");
 	RNA_def_property_range(prop, 1, 1000);
 	RNA_def_property_ui_text(prop, "Double Click Timeout", "Time/delay (in ms) for a double click");
 
-	prop= RNA_def_property(srna, "use_mouse_emulate_3_button", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_mouse_emulate_3_button", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_TWOBUTTONMOUSE);
 	RNA_def_property_ui_text(prop, "Emulate 3 Button Mouse",
 	                         "Emulate Middle Mouse with Alt+Left Mouse (doesn't work with Left Mouse Select option)");
 
-	prop= RNA_def_property(srna, "use_emulate_numpad", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_emulate_numpad", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_NONUMPAD);
 	RNA_def_property_ui_text(prop, "Emulate Numpad", "Main 1 to 0 keys act as the numpad ones (useful for laptops)");
 	
 	/* middle mouse button */
-	prop= RNA_def_property(srna, "use_mouse_mmb_paste", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_mouse_mmb_paste", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_MMB_PASTE);
-	RNA_def_property_ui_text(prop, "Middle Mouse Paste", "In text window, paste with middle mouse button instead of panning");
+	RNA_def_property_ui_text(prop, "Middle Mouse Paste",
+	                         "In text window, paste with middle mouse button instead of panning");
 	
-	prop= RNA_def_property(srna, "invert_zoom_wheel", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "invert_zoom_wheel", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_WHEELZOOMDIR);
 	RNA_def_property_ui_text(prop, "Wheel Invert Zoom", "Swap the Mouse Wheel zoom direction");
 
-	prop= RNA_def_property(srna, "wheel_scroll_lines", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "wheel_scroll_lines", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "wheellinescroll");
 	RNA_def_property_range(prop, 0, 32);
 	RNA_def_property_ui_text(prop, "Wheel Scroll Lines", "Number of lines scrolled at a time with the mouse wheel");
 	
-	prop= RNA_def_property(srna, "active_keyconfig", PROP_STRING, PROP_DIRPATH);
+	prop = RNA_def_property(srna, "active_keyconfig", PROP_STRING, PROP_DIRPATH);
 	RNA_def_property_string_sdna(prop, NULL, "keyconfigstr");
 	RNA_def_property_ui_text(prop, "Key Config", "The name of the active key configuration");
 }
@@ -3244,7 +3321,7 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna)
 	StructRNA *srna;
 	
 	static EnumPropertyItem anim_player_presets[] = {
-		//{0, "INTERNAL", 0, "Internal", "Built-in animation player"},	// doesn't work yet!
+		/*{0, "INTERNAL", 0, "Internal", "Built-in animation player"},	 *//* doesn't work yet! */
 		{1, "BLENDER24", 0, "Blender 2.4", "Blender command line animation playback - path to Blender 2.4"},
 		{2, "DJV", 0, "Djv", "Open source frame player: http://djv.sourceforge.net"},
 		{3, "FRAMECYCLER", 0, "FrameCycler", "Frame player from IRIDAS"},
@@ -3253,85 +3330,88 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna)
 		{50, "CUSTOM", 0, "Custom", "Custom animation player executable path"},
 		{0, NULL, 0, NULL, NULL}};
 	
-	srna= RNA_def_struct(brna, "UserPreferencesFilePaths", NULL);
+	srna = RNA_def_struct(brna, "UserPreferencesFilePaths", NULL);
 	RNA_def_struct_sdna(srna, "UserDef");
 	RNA_def_struct_nested(brna, srna, "UserPreferences");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "File Paths", "Default paths for external files");
 	
-	prop= RNA_def_property(srna, "show_hidden_files_datablocks", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_hidden_files_datablocks", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_HIDE_DOT);
 	RNA_def_property_ui_text(prop, "Hide Dot Files/Datablocks", "Hide files/datablocks that start with a dot (.*)");
 	
-	prop= RNA_def_property(srna, "use_filter_files", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_filter_files", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_FILTERFILEEXTS);
-	RNA_def_property_ui_text(prop, "Filter File Extensions", "Display only files with extensions in the image select window");
+	RNA_def_property_ui_text(prop, "Filter File Extensions",
+	                         "Display only files with extensions in the image select window");
 	
-	prop= RNA_def_property(srna, "hide_recent_locations", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "hide_recent_locations", PROP_BOOLEAN, PROP_NONE);
 	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, "show_thumbnails", PROP_BOOLEAN, PROP_NONE);
+	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");
 
-	prop= RNA_def_property(srna, "use_relative_paths", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_relative_paths", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_RELPATHS);
 	RNA_def_property_ui_text(prop, "Relative Paths", "Default relative path option for the file selector");
 	
-	prop= RNA_def_property(srna, "use_file_compression", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_file_compression", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_FILECOMPRESS);
 	RNA_def_property_ui_text(prop, "Compress File", "Enable file compression when saving .blend files");
 
-	prop= RNA_def_property(srna, "use_load_ui", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_load_ui", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_FILENOUI);
 	RNA_def_property_ui_text(prop, "Load UI", "Load user interface setup when loading .blend files");
 
-	prop= RNA_def_property(srna, "font_directory", PROP_STRING, PROP_DIRPATH);
+	prop = RNA_def_property(srna, "font_directory", PROP_STRING, PROP_DIRPATH);
 	RNA_def_property_string_sdna(prop, NULL, "fontdir");
 	RNA_def_property_ui_text(prop, "Fonts Directory", "The default directory to search for loading fonts");
 
-	prop= RNA_def_property(srna, "texture_directory", PROP_STRING, PROP_DIRPATH);
+	prop = RNA_def_property(srna, "texture_directory", PROP_STRING, PROP_DIRPATH);
 	RNA_def_property_string_sdna(prop, NULL, "textudir");
 	RNA_def_property_ui_text(prop, "Textures Directory", "The default directory to search for textures");
 
-	prop= RNA_def_property(srna, "texture_plugin_directory", PROP_STRING, PROP_DIRPATH);
+	prop = RNA_def_property(srna, "texture_plugin_directory", PROP_STRING, PROP_DIRPATH);
 	RNA_def_property_string_sdna(prop, NULL, "plugtexdir");
 	RNA_def_property_ui_text(prop, "Texture Plugin Directory", "The default directory to search for texture plugins");
 
-	prop= RNA_def_property(srna, "sequence_plugin_directory", PROP_STRING, PROP_DIRPATH);
+	prop = RNA_def_property(srna, "sequence_plugin_directory", PROP_STRING, PROP_DIRPATH);
 	RNA_def_property_string_sdna(prop, NULL, "plugseqdir");
-	RNA_def_property_ui_text(prop, "Sequence Plugin Directory", "The default directory to search for sequence plugins");
+	RNA_def_property_ui_text(prop, "Sequence Plugin Directory",
+	                         "The default directory to search for sequence plugins");
 
-	prop= RNA_def_property(srna, "render_output_directory", PROP_STRING, PROP_DIRPATH);
+	prop = RNA_def_property(srna, "render_output_directory", PROP_STRING, PROP_DIRPATH);
 	RNA_def_property_string_sdna(prop, NULL, "renderdir");
-	RNA_def_property_ui_text(prop, "Render Output Directory", "The default directory for rendering output, for new scenes");
+	RNA_def_property_ui_text(prop, "Render Output Directory",
+	                         "The default directory for rendering output, for new scenes");
 
-	prop= RNA_def_property(srna, "script_directory", PROP_STRING, PROP_DIRPATH);
+	prop = RNA_def_property(srna, "script_directory", PROP_STRING, PROP_DIRPATH);
 	RNA_def_property_string_sdna(prop, NULL, "pythondir");
 	RNA_def_property_ui_text(prop, "Python Scripts Directory",
 	                         "Alternate script path, matching the default layout with subdirs: "
 	                         "startup, addons & modules (requires restart)");
 	/* TODO, editing should reset sys.path! */
 
-	prop= RNA_def_property(srna, "sound_directory", PROP_STRING, PROP_DIRPATH);
+	prop = RNA_def_property(srna, "sound_directory", PROP_STRING, PROP_DIRPATH);
 	RNA_def_property_string_sdna(prop, NULL, "sounddir");
 	RNA_def_property_ui_text(prop, "Sounds Directory", "The default directory to search for sounds");
 
-	prop= RNA_def_property(srna, "temporary_directory", PROP_STRING, PROP_DIRPATH);
+	prop = RNA_def_property(srna, "temporary_directory", PROP_STRING, PROP_DIRPATH);
 	RNA_def_property_string_sdna(prop, NULL, "tempdir");
 	RNA_def_property_ui_text(prop, "Temporary Directory", "The directory for storing temporary save files");
 	RNA_def_property_update(prop, 0, "rna_userdef_temp_update");
 
-	prop= RNA_def_property(srna, "image_editor", PROP_STRING, PROP_FILEPATH);
+	prop = RNA_def_property(srna, "image_editor", PROP_STRING, PROP_FILEPATH);
 	RNA_def_property_string_sdna(prop, NULL, "image_editor");
 	RNA_def_property_ui_text(prop, "Image Editor", "Path to an image editor");
 	
-	prop= RNA_def_property(srna, "animation_player", PROP_STRING, PROP_FILEPATH);
+	prop = RNA_def_property(srna, "animation_player", PROP_STRING, PROP_FILEPATH);
 	RNA_def_property_string_sdna(prop, NULL, "anim_player");
 	RNA_def_property_ui_text(prop, "Animation Player", "Path to a custom animation/frame sequence player");
 
-	prop= RNA_def_property(srna, "animation_player_preset", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "animation_player_preset", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "anim_player_preset");
 	RNA_def_property_enum_items(prop, anim_player_presets);
 	RNA_def_property_ui_text(prop, "Animation Player Preset", "Preset configs for external animation players");
@@ -3339,31 +3419,33 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna)
 	
 	/* Autosave  */
 
-	prop= RNA_def_property(srna, "save_version", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "save_version", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "versions");
 	RNA_def_property_range(prop, 0, 32);
 	RNA_def_property_ui_text(prop, "Save Versions",
 	                         "The number of old versions to maintain in the current directory, when manually saving");
 
-	prop= RNA_def_property(srna, "use_auto_save_temporary_files", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_auto_save_temporary_files", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_AUTOSAVE);
 	RNA_def_property_ui_text(prop, "Auto Save Temporary Files",
 	                         "Automatic saving of temporary files in temp directory, uses process ID");
 	RNA_def_property_update(prop, 0, "rna_userdef_autosave_update");
 
-	prop= RNA_def_property(srna, "auto_save_time", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "auto_save_time", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "savetime");
 	RNA_def_property_range(prop, 1, 60);
-	RNA_def_property_ui_text(prop, "Auto Save Time", "The time (in minutes) to wait between automatic temporary saves");
+	RNA_def_property_ui_text(prop, "Auto Save Time",
+	                         "The time (in minutes) to wait between automatic temporary saves");
 	RNA_def_property_update(prop, 0, "rna_userdef_autosave_update");
 
-	prop= RNA_def_property(srna, "recent_files", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "recent_files", PROP_INT, PROP_NONE);
 	RNA_def_property_range(prop, 0, 30);
 	RNA_def_property_ui_text(prop, "Recent Files", "Maximum number of recently opened files to remember");
 
-	prop= RNA_def_property(srna, "use_save_preview_images", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_save_preview_images", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_SAVE_PREVIEWS);
-	RNA_def_property_ui_text(prop, "Save Preview Images", "Enables automatic saving of preview images in the .blend file");
+	RNA_def_property_ui_text(prop, "Save Preview Images",
+	                         "Enables automatic saving of preview images in the .blend file");
 }
 
 void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA *cprop)
@@ -3373,21 +3455,21 @@ void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *parm;
 
 	RNA_def_property_srna(cprop, "Addons");
-	srna= RNA_def_struct(brna, "Addons", NULL);
+	srna = RNA_def_struct(brna, "Addons", NULL);
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "User Addons", "Collection of addons");
 
-	func= RNA_def_function(srna, "new", "rna_userdef_addon_new");
+	func = RNA_def_function(srna, "new", "rna_userdef_addon_new");
 	RNA_def_function_flag(func, FUNC_NO_SELF);
 	RNA_def_function_ui_description(func, "Add a new addon");
 	/* return type */
-	parm= RNA_def_pointer(func, "addon", "Addon", "", "Addon datablock");
+	parm = RNA_def_pointer(func, "addon", "Addon", "", "Addon datablock");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "remove", "rna_userdef_addon_remove");
+	func = RNA_def_function(srna, "remove", "rna_userdef_addon_remove");
 	RNA_def_function_flag(func, FUNC_NO_SELF);
 	RNA_def_function_ui_description(func, "Remove addon");
-	parm= RNA_def_pointer(func, "addon", "Addon", "", "Addon to remove");
+	parm = RNA_def_pointer(func, "addon", "Addon", "", "Addon to remove");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 }
 
@@ -3409,28 +3491,29 @@ void RNA_def_userdef(BlenderRNA *brna)
 	rna_def_userdef_dothemes(brna);
 	rna_def_userdef_solidlight(brna);
 
-	srna= RNA_def_struct(brna, "UserPreferences", NULL);
+	srna = RNA_def_struct(brna, "UserPreferences", NULL);
 	RNA_def_struct_sdna(srna, "UserDef");
 	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
 	RNA_def_struct_ui_text(srna, "User Preferences", "Global user preferences");
 
-	prop= RNA_def_property(srna, "active_section", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "active_section", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "userpref");
 	RNA_def_property_enum_items(prop, user_pref_sections);
-	RNA_def_property_ui_text(prop, "Active Section", "Active section of the user preferences shown in the user interface");
+	RNA_def_property_ui_text(prop, "Active Section",
+	                         "Active section of the user preferences shown in the user interface");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
 
-	prop= RNA_def_property(srna, "themes", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "themes", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "themes", NULL);
 	RNA_def_property_struct_type(prop, "Theme");
 	RNA_def_property_ui_text(prop, "Themes", "");
 
-	prop= RNA_def_property(srna, "ui_styles", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "ui_styles", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "uistyles", NULL);
 	RNA_def_property_struct_type(prop, "ThemeStyle");
 	RNA_def_property_ui_text(prop, "Styles", "");
 	
-	prop= RNA_def_property(srna, "addons", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "addons", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "addons", NULL);
 	RNA_def_property_struct_type(prop, "Addon");
 	RNA_def_property_ui_text(prop, "Addon", "");
@@ -3438,31 +3521,31 @@ void RNA_def_userdef(BlenderRNA *brna)
 
 
 	/* nested structs */
-	prop= RNA_def_property(srna, "view", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "view", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "UserPreferencesView");
 	RNA_def_property_pointer_funcs(prop, "rna_UserDef_view_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "View & Controls", "Preferences related to viewing data");
 
-	prop= RNA_def_property(srna, "edit", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "edit", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "UserPreferencesEdit");
 	RNA_def_property_pointer_funcs(prop, "rna_UserDef_edit_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Edit Methods", "Settings for interacting with Blender data");
 	
-	prop= RNA_def_property(srna, "inputs", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "inputs", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "UserPreferencesInput");
 	RNA_def_property_pointer_funcs(prop, "rna_UserDef_input_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Inputs", "Settings for input devices");
 	
-	prop= RNA_def_property(srna, "filepaths", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "filepaths", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "UserPreferencesFilePaths");
 	RNA_def_property_pointer_funcs(prop, "rna_UserDef_filepaths_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "File Paths", "Default paths for external files");
 	
-	prop= RNA_def_property(srna, "system", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "system", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "UserPreferencesSystem");
 	RNA_def_property_pointer_funcs(prop, "rna_UserDef_system_get", NULL, NULL, NULL);
diff --git a/source/blender/makesrna/intern/rna_vfont.c b/source/blender/makesrna/intern/rna_vfont.c
index e5ea480..aca2525 100644
--- a/source/blender/makesrna/intern/rna_vfont.c
+++ b/source/blender/makesrna/intern/rna_vfont.c
@@ -42,17 +42,17 @@ void RNA_def_vfont(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "VectorFont", "ID");
+	srna = RNA_def_struct(brna, "VectorFont", "ID");
 	RNA_def_struct_ui_text(srna, "Vector Font", "Vector font for Text objects");
 	RNA_def_struct_sdna(srna, "VFont");
 	RNA_def_struct_ui_icon(srna, ICON_FILE_FONT);
 
-	prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+	prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_string_sdna(prop, NULL, "name");
 	RNA_def_property_ui_text(prop, "File Path", "");
 
-	prop= RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
 	RNA_def_property_ui_text(prop, "Packed File", "");
 }
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 4f8f301..8c4b791 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -48,7 +48,7 @@ EnumPropertyItem event_keymouse_value_items[] = {
 	{KM_DBL_CLICK, "DOUBLE_CLICK", 0, "Double Click", ""},
 	{0, NULL, 0, NULL, NULL}};
 
-EnumPropertyItem event_tweak_value_items[]= {
+EnumPropertyItem event_tweak_value_items[] = {
 	{KM_ANY, "ANY", 0, "Any", ""},
 	{EVT_GESTURE_N, "NORTH", 0, "North", ""},
 	{EVT_GESTURE_NE, "NORTH_EAST", 0, "North-East", ""},
@@ -77,7 +77,7 @@ EnumPropertyItem event_value_items[] = {
 	{EVT_GESTURE_NW, "NORTH_WEST", 0, "North-West", ""},
 	{0, NULL, 0, NULL, NULL}};
 
-EnumPropertyItem event_tweak_type_items[]= {
+EnumPropertyItem event_tweak_type_items[] = {
 	{EVT_TWEAK_L, "EVT_TWEAK_L", 0, "Left", ""},
 	{EVT_TWEAK_M, "EVT_TWEAK_M", 0, "Middle", ""},
 	{EVT_TWEAK_R, "EVT_TWEAK_R", 0, "Right", ""},
@@ -85,7 +85,7 @@ EnumPropertyItem event_tweak_type_items[]= {
 	{EVT_TWEAK_S, "EVT_TWEAK_S", 0, "Select", ""},
 	{0, NULL, 0, NULL, NULL}};
 
-EnumPropertyItem event_mouse_type_items[]= {
+EnumPropertyItem event_mouse_type_items[] = {
 	{LEFTMOUSE, "LEFTMOUSE", 0, "Left", ""},
 	{MIDDLEMOUSE, "MIDDLEMOUSE", 0, "Middle", ""},
 	{RIGHTMOUSE, "RIGHTMOUSE", 0, "Right", ""},
@@ -105,14 +105,14 @@ EnumPropertyItem event_mouse_type_items[]= {
 	{WHEELOUTMOUSE, "WHEELOUTMOUSE", 0, "Wheel Out", ""},
 	{0, NULL, 0, NULL, NULL}};
 
-EnumPropertyItem event_timer_type_items[]= {
+EnumPropertyItem event_timer_type_items[] = {
 	{TIMER, "TIMER", 0, "Timer", ""},
 	{TIMER0, "TIMER0", 0, "Timer 0", ""},
 	{TIMER1, "TIMER1", 0, "Timer 1", ""},
 	{TIMER2, "TIMER2", 0, "Timer 2", ""},
 	{0, NULL, 0, NULL, NULL}};
 
-EnumPropertyItem event_ndof_type_items[]= {
+EnumPropertyItem event_ndof_type_items[] = {
 	/* buttons on all 3dconnexion devices */
 	{NDOF_BUTTON_MENU, "NDOF_BUTTON_MENU", 0, "Menu", ""},
 	{NDOF_BUTTON_FIT, "NDOF_BUTTON_FIT", 0, "Fit", ""},
@@ -124,8 +124,8 @@ EnumPropertyItem event_ndof_type_items[]= {
 	{NDOF_BUTTON_FRONT, "NDOF_BUTTON_FRONT", 0, "Front", ""},
 	{NDOF_BUTTON_BACK, "NDOF_BUTTON_BACK", 0, "Back", ""},
 	/* more views */
-	{NDOF_BUTTON_ISO1, "NDOF_BUTTON_ISO1", 0, "ISO 1", ""},
-	{NDOF_BUTTON_ISO2, "NDOF_BUTTON_ISO2", 0, "ISO 2", ""},
+	{NDOF_BUTTON_ISO1, "NDOF_BUTTON_ISO1", 0, "Isometric 1", ""},
+	{NDOF_BUTTON_ISO2, "NDOF_BUTTON_ISO2", 0, "Isometric 2", ""},
 	/* 90 degree rotations */
 	{NDOF_BUTTON_ROLL_CW, "NDOF_BUTTON_ROLL_CW", 0, "Roll CW", ""},
 	{NDOF_BUTTON_ROLL_CCW, "NDOF_BUTTON_ROLL_CCW", 0, "Roll CCW", ""},
@@ -139,6 +139,11 @@ EnumPropertyItem event_ndof_type_items[]= {
 	{NDOF_BUTTON_DOMINANT, "NDOF_BUTTON_DOMINANT", 0, "Dominant", ""},
 	{NDOF_BUTTON_PLUS, "NDOF_BUTTON_PLUS", 0, "Plus", ""},
 	{NDOF_BUTTON_MINUS, "NDOF_BUTTON_MINUS", 0, "Minus", ""},
+	/* keyboard emulation */
+	{NDOF_BUTTON_ESC, "NDOF_BUTTON_ESC", 0, "Esc"},
+	{NDOF_BUTTON_ALT, "NDOF_BUTTON_ALT", 0, "Alt"},
+	{NDOF_BUTTON_SHIFT, "NDOF_BUTTON_SHIFT", 0, "Shift"},
+	{NDOF_BUTTON_CTRL, "NDOF_BUTTON_CTRL", 0, "Ctrl"},
 	/* general-purpose buttons */
 	{NDOF_BUTTON_1, "NDOF_BUTTON_1", 0, "Button 1", ""},
 	{NDOF_BUTTON_2, "NDOF_BUTTON_2", 0, "Button 2", ""},
@@ -150,6 +155,9 @@ EnumPropertyItem event_ndof_type_items[]= {
 	{NDOF_BUTTON_8, "NDOF_BUTTON_8", 0, "Button 8", ""},
 	{NDOF_BUTTON_9, "NDOF_BUTTON_9", 0, "Button 9", ""},
 	{NDOF_BUTTON_10, "NDOF_BUTTON_10", 0, "Button 10", ""},
+	{NDOF_BUTTON_A, "NDOF_BUTTON_A", 0, "Button A", ""},
+	{NDOF_BUTTON_B, "NDOF_BUTTON_B", 0, "Button B", ""},
+	{NDOF_BUTTON_C, "NDOF_BUTTON_C", 0, "Button C", ""},
 	{0, NULL, 0, NULL, NULL}};
 
 /* not returned: CAPSLOCKKEY, UNKNOWNKEY */
@@ -315,8 +323,8 @@ EnumPropertyItem event_type_items[] = {
 	{NDOF_BUTTON_FRONT, "NDOF_BUTTON_FRONT", 0, "NDOF Front", ""},
 	{NDOF_BUTTON_BACK, "NDOF_BUTTON_BACK", 0, "NDOF Back", ""},
 	/* more views */
-	{NDOF_BUTTON_ISO1, "NDOF_BUTTON_ISO1", 0, "NDOF ISO 1", ""},
-	{NDOF_BUTTON_ISO2, "NDOF_BUTTON_ISO2", 0, "NDOF ISO 2", ""},
+	{NDOF_BUTTON_ISO1, "NDOF_BUTTON_ISO1", 0, "NDOF Isometric 1", ""},
+	{NDOF_BUTTON_ISO2, "NDOF_BUTTON_ISO2", 0, "NDOF Isometric 2", ""},
 	/* 90 degree rotations */
 	{NDOF_BUTTON_ROLL_CW, "NDOF_BUTTON_ROLL_CW", 0, "NDOF Roll CW", ""},
 	{NDOF_BUTTON_ROLL_CCW, "NDOF_BUTTON_ROLL_CCW", 0, "NDOF Roll CCW", ""},
@@ -330,6 +338,11 @@ EnumPropertyItem event_type_items[] = {
 	{NDOF_BUTTON_DOMINANT, "NDOF_BUTTON_DOMINANT", 0, "NDOF Dominant", ""},
 	{NDOF_BUTTON_PLUS, "NDOF_BUTTON_PLUS", 0, "NDOF Plus", ""},
 	{NDOF_BUTTON_MINUS, "NDOF_BUTTON_MINUS", 0, "NDOF Minus", ""},
+	/* keyboard emulation */
+	{NDOF_BUTTON_ESC, "NDOF_BUTTON_ESC", 0, "NDOF Esc"},
+	{NDOF_BUTTON_ALT, "NDOF_BUTTON_ALT", 0, "NDOF Alt"},
+	{NDOF_BUTTON_SHIFT, "NDOF_BUTTON_SHIFT", 0, "NDOF Shift"},
+	{NDOF_BUTTON_CTRL, "NDOF_BUTTON_CTRL", 0, "NDOF Ctrl"},
 	/* general-purpose buttons */
 	{NDOF_BUTTON_1, "NDOF_BUTTON_1", 0, "NDOF Button 1", ""},
 	{NDOF_BUTTON_2, "NDOF_BUTTON_2", 0, "NDOF Button 2", ""},
@@ -341,7 +354,10 @@ EnumPropertyItem event_type_items[] = {
 	{NDOF_BUTTON_8, "NDOF_BUTTON_8", 0, "NDOF Button 8", ""},
 	{NDOF_BUTTON_9, "NDOF_BUTTON_9", 0, "NDOF Button 9", ""},
 	{NDOF_BUTTON_10, "NDOF_BUTTON_10", 0, "NDOF Button 10", ""},
-	{0, NULL, 0, NULL, NULL}};	
+	{NDOF_BUTTON_A, "NDOF_BUTTON_A", 0, "NDOF Button A", ""},
+	{NDOF_BUTTON_B, "NDOF_BUTTON_B", 0, "NDOF Button B", ""},
+	{NDOF_BUTTON_C, "NDOF_BUTTON_C", 0, "NDOF Button C", ""},
+	{0, NULL, 0, NULL, NULL}};
 
 EnumPropertyItem keymap_propvalue_items[] = {
 		{0, "NONE", 0, "", ""},
@@ -361,7 +377,9 @@ EnumPropertyItem operator_flag_items[] = {
 	{OPTYPE_UNDO, "UNDO", 0, "Undo", "Push an undo event (needed for operator redo)"},
 	{OPTYPE_BLOCKING, "BLOCKING", 0, "Blocking", "Block anything else from using the cursor"},
 	{OPTYPE_MACRO, "MACRO", 0, "Macro", "Use to check if an operator is a macro"},
-	{OPTYPE_GRAB_POINTER, "GRAB_POINTER", 0, "Grab Pointer", "Use so the operator grabs the mouse focus, enables wrapping when continuous grab is enabled"},
+	{OPTYPE_GRAB_POINTER, "GRAB_POINTER", 0, "Grab Pointer",
+	                      "Use so the operator grabs the mouse focus, enables wrapping when continuous grab "
+	                      "is enabled"},
 	{OPTYPE_PRESET, "PRESET", 0, "Preset", "Display a preset button with the operators settings"},
 	{OPTYPE_INTERNAL, "INTERNAL", 0, "Internal", "Removes the operator from search results"},
 	{0, NULL, 0, NULL, NULL}};
@@ -370,7 +388,8 @@ EnumPropertyItem operator_return_items[] = {
 	{OPERATOR_RUNNING_MODAL, "RUNNING_MODAL", 0, "Running Modal", "Keep the operator running with blender"},
 	{OPERATOR_CANCELLED, "CANCELLED", 0, "Cancelled", "When no action has been taken, operator exits"},
 	{OPERATOR_FINISHED, "FINISHED", 0, "Finished", "When the operator is complete, operator exits"},
-	{OPERATOR_PASS_THROUGH, "PASS_THROUGH", 0, "Pass Through", "Do nothing and pass the event on"}, // used as a flag
+		/* used as a flag */
+	{OPERATOR_PASS_THROUGH, "PASS_THROUGH", 0, "Pass Through", "Do nothing and pass the event on"},
 	{0, NULL, 0, NULL, NULL}};
 
 /* flag/enum */
@@ -404,13 +423,13 @@ EnumPropertyItem wm_report_items[] = {
 
 static wmOperator *rna_OperatorProperties_find_operator(PointerRNA *ptr)
 {
-	wmWindowManager *wm= ptr->id.data;
-	IDProperty *properties= (IDProperty*)ptr->data;
+	wmWindowManager *wm = ptr->id.data;
+	IDProperty *properties = (IDProperty*)ptr->data;
 	wmOperator *op;
 
-	if(wm)
-		for(op=wm->operators.first; op; op=op->next)
-			if(op->properties == properties)
+	if (wm)
+		for (op = wm->operators.first; op; op = op->next)
+			if (op->properties == properties)
 				return op;
 	
 	return NULL;
@@ -418,9 +437,9 @@ static wmOperator *rna_OperatorProperties_find_operator(PointerRNA *ptr)
 
 static StructRNA *rna_OperatorProperties_refine(PointerRNA *ptr)
 {
-	wmOperator *op= rna_OperatorProperties_find_operator(ptr);
+	wmOperator *op = rna_OperatorProperties_find_operator(ptr);
 
-	if(op)
+	if (op)
 		return op->type->srna;
 	else
 		return ptr->type;
@@ -428,9 +447,9 @@ static StructRNA *rna_OperatorProperties_refine(PointerRNA *ptr)
 
 static IDProperty *rna_OperatorProperties_idprops(PointerRNA *ptr, int create)
 {
-	if(create && !ptr->data) {
+	if (create && !ptr->data) {
 		IDPropertyTemplate val = {0};
-		ptr->data= IDP_New(IDP_GROUP, &val, "RNA_OperatorProperties group");
+		ptr->data = IDP_New(IDP_GROUP, &val, "RNA_OperatorProperties group");
 	}
 
 	return ptr->data;
@@ -438,53 +457,53 @@ static IDProperty *rna_OperatorProperties_idprops(PointerRNA *ptr, int create)
 
 static void rna_Operator_name_get(PointerRNA *ptr, char *value)
 {
-	wmOperator *op= (wmOperator*)ptr->data;
+	wmOperator *op = (wmOperator*)ptr->data;
 	strcpy(value, op->type->name);
 }
 
 static int rna_Operator_name_length(PointerRNA *ptr)
 {
-	wmOperator *op= (wmOperator*)ptr->data;
+	wmOperator *op = (wmOperator*)ptr->data;
 	return strlen(op->type->name);
 }
 
 static int rna_Operator_has_reports_get(PointerRNA *ptr)
 {
-	wmOperator *op= (wmOperator*)ptr->data;
+	wmOperator *op = (wmOperator*)ptr->data;
 	return (op->reports && op->reports->list.first);
 }
 
 static PointerRNA rna_Operator_properties_get(PointerRNA *ptr)
 {
-	wmOperator *op= (wmOperator*)ptr->data;
+	wmOperator *op = (wmOperator*)ptr->data;
 	return rna_pointer_inherit_refine(ptr, op->type->srna, op->properties);
 }
 
 static PointerRNA rna_OperatorMacro_properties_get(PointerRNA *ptr)
 {
-	wmOperatorTypeMacro *otmacro= (wmOperatorTypeMacro*)ptr->data;
+	wmOperatorTypeMacro *otmacro = (wmOperatorTypeMacro*)ptr->data;
 	wmOperatorType *ot = WM_operatortype_find(otmacro->idname, TRUE);
 	return rna_pointer_inherit_refine(ptr, ot->srna, otmacro->properties);
 }
 
 static void rna_Event_ascii_get(PointerRNA *ptr, char *value)
 {
-	wmEvent *event= (wmEvent*)ptr->data;
-	value[0]= event->ascii;
-	value[1]= '\0';
+	wmEvent *event = (wmEvent*)ptr->data;
+	value[0] = event->ascii;
+	value[1] = '\0';
 }
 
 static int rna_Event_ascii_length(PointerRNA *ptr)
 {
-	wmEvent *event= (wmEvent*)ptr->data;
+	wmEvent *event = (wmEvent*)ptr->data;
 	return (event->ascii)? 1 : 0;
 }
 
 static void rna_Event_unicode_get(PointerRNA *ptr, char *value)
 {
-	/* utf8 buf isnt \0 terminated */
-	wmEvent *event= (wmEvent*)ptr->data;
-	size_t len= 0;
+	/* utf8 buf isn't \0 terminated */
+	wmEvent *event = (wmEvent*)ptr->data;
+	size_t len = 0;
 
 	if (event->utf8_buf[0]) {
 		BLI_str_utf8_as_unicode_and_size(event->utf8_buf, &len);
@@ -493,15 +512,16 @@ static void rna_Event_unicode_get(PointerRNA *ptr, char *value)
 		}
 	}
 
-	value[len]= '\0';
+	value[len] = '\0';
 }
 
 static int rna_Event_unicode_length(PointerRNA *ptr)
 {
 
-	wmEvent *event= (wmEvent*)ptr->data;
+	wmEvent *event = (wmEvent*)ptr->data;
 	if (event->utf8_buf[0]) {
-		return BLI_str_utf8_size(event->utf8_buf); /* invalid value is checked on assignment so we dont need to account for this */
+		/* invalid value is checked on assignment so we don't need to account for this */
+		return BLI_str_utf8_size(event->utf8_buf);
 	}
 	else {
 		return 0;
@@ -510,118 +530,124 @@ static int rna_Event_unicode_length(PointerRNA *ptr)
 
 static void rna_Window_screen_set(PointerRNA *ptr, PointerRNA value)
 {
-	wmWindow *win= (wmWindow*)ptr->data;
+	wmWindow *win = (wmWindow*)ptr->data;
 
-	if(value.data == NULL)
+	if (value.data == NULL)
 		return;
 
 	/* exception: can't set screens inside of area/region handers */
-	win->newscreen= value.data;
+	win->newscreen = value.data;
 }
 
 static void rna_Window_screen_update(bContext *C, PointerRNA *ptr)
 {
-	wmWindow *win= (wmWindow*)ptr->data;
+	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 */
-	if(win->newscreen) {
+	 * 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;
+		win->newscreen = NULL;
 	}
 }
 
 static PointerRNA rna_KeyMapItem_properties_get(PointerRNA *ptr)
 {
-	wmKeyMapItem *kmi= ptr->data;
+	wmKeyMapItem *kmi = ptr->data;
 
-	if(kmi->ptr)
+	if (kmi->ptr)
 		return *(kmi->ptr);
 	
-	//return rna_pointer_inherit_refine(ptr, &RNA_OperatorProperties, op->properties);
+	/*return rna_pointer_inherit_refine(ptr, &RNA_OperatorProperties, op->properties); */
 	return PointerRNA_NULL;
 }
 
 static int rna_wmKeyMapItem_map_type_get(PointerRNA *ptr)
 {
-	wmKeyMapItem *kmi= ptr->data;
+	wmKeyMapItem *kmi = ptr->data;
 
-	if(ISTIMER(kmi->type)) return KMI_TYPE_TIMER;
-	if(ISKEYBOARD(kmi->type)) return KMI_TYPE_KEYBOARD;
-	if(ISTWEAK(kmi->type)) return KMI_TYPE_TWEAK;
-	if(ISMOUSE(kmi->type)) return KMI_TYPE_MOUSE;
-	if(ISNDOF(kmi->type)) return KMI_TYPE_NDOF;
-	if(kmi->type == KM_TEXTINPUT) return KMI_TYPE_TEXTINPUT;
+	if (ISTIMER(kmi->type)) return KMI_TYPE_TIMER;
+	if (ISKEYBOARD(kmi->type)) return KMI_TYPE_KEYBOARD;
+	if (ISTWEAK(kmi->type)) return KMI_TYPE_TWEAK;
+	if (ISMOUSE(kmi->type)) return KMI_TYPE_MOUSE;
+	if (ISNDOF(kmi->type)) return KMI_TYPE_NDOF;
+	if (kmi->type == KM_TEXTINPUT) return KMI_TYPE_TEXTINPUT;
 	return KMI_TYPE_KEYBOARD;
 }
 
 static void rna_wmKeyMapItem_map_type_set(PointerRNA *ptr, int value)
 {
-	wmKeyMapItem *kmi= ptr->data;
-	int map_type= rna_wmKeyMapItem_map_type_get(ptr);
+	wmKeyMapItem *kmi = ptr->data;
+	int map_type = rna_wmKeyMapItem_map_type_get(ptr);
 
-	if(value != map_type) {
-		switch(value) {
+	if (value != map_type) {
+		switch (value) {
 		case KMI_TYPE_KEYBOARD:
-			kmi->type= AKEY;
-			kmi->val= KM_PRESS;
+			kmi->type = AKEY;
+			kmi->val = KM_PRESS;
 			break;
 		case KMI_TYPE_TWEAK:
-			kmi->type= EVT_TWEAK_L;
-			kmi->val= KM_ANY;
+			kmi->type = EVT_TWEAK_L;
+			kmi->val = KM_ANY;
 			break;
 		case KMI_TYPE_MOUSE:
-			kmi->type= LEFTMOUSE;
-			kmi->val= KM_PRESS;
+			kmi->type = LEFTMOUSE;
+			kmi->val = KM_PRESS;
 			break;
 		case KMI_TYPE_TEXTINPUT:
-			kmi->type= KM_TEXTINPUT;
-			kmi->val= KM_NOTHING;
+			kmi->type = KM_TEXTINPUT;
+			kmi->val = KM_NOTHING;
 			break;
 		case KMI_TYPE_TIMER:
-			kmi->type= TIMER;
-			kmi->val= KM_NOTHING;
+			kmi->type = TIMER;
+			kmi->val = KM_NOTHING;
 			break;
 		case KMI_TYPE_NDOF:
 			kmi->type = NDOF_BUTTON_MENU;
-			kmi->val = KM_NOTHING;
+			kmi->val = KM_PRESS;
 			break;
 		}
 	}
 }
 
-static EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
+static EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop),
+                                                   int *UNUSED(free))
 {
-	int map_type= rna_wmKeyMapItem_map_type_get(ptr);
+	int map_type = rna_wmKeyMapItem_map_type_get(ptr);
 
-	if(map_type == KMI_TYPE_MOUSE) return event_mouse_type_items;
-	if(map_type == KMI_TYPE_TWEAK) return event_tweak_type_items;
-	if(map_type == KMI_TYPE_TIMER) return event_timer_type_items;
-	if(map_type == KMI_TYPE_NDOF) return event_ndof_type_items;
+	if (map_type == KMI_TYPE_MOUSE) return event_mouse_type_items;
+	if (map_type == KMI_TYPE_TWEAK) return event_tweak_type_items;
+	if (map_type == KMI_TYPE_TIMER) return event_timer_type_items;
+	if (map_type == KMI_TYPE_NDOF) return event_ndof_type_items;
 	else return event_type_items;
 }
 
-static EnumPropertyItem *rna_KeyMapItem_value_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
+static EnumPropertyItem *rna_KeyMapItem_value_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop),
+                                                    int *UNUSED(free))
 {
-	int map_type= rna_wmKeyMapItem_map_type_get(ptr);
+	int map_type = rna_wmKeyMapItem_map_type_get(ptr);
 
-	if(map_type == KMI_TYPE_MOUSE || map_type == KMI_TYPE_KEYBOARD || map_type == KMI_TYPE_NDOF) return event_keymouse_value_items;
-	if(map_type == KMI_TYPE_TWEAK) return event_tweak_value_items;
-	else return event_value_items;
+	if (map_type == KMI_TYPE_MOUSE || map_type == KMI_TYPE_KEYBOARD || map_type == KMI_TYPE_NDOF)
+		return event_keymouse_value_items;
+	if (map_type == KMI_TYPE_TWEAK)
+		return event_tweak_value_items;
+	else
+		return event_value_items;
 }
 
-static EnumPropertyItem *rna_KeyMapItem_propvalue_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *UNUSED(free))
+static EnumPropertyItem *rna_KeyMapItem_propvalue_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop),
+                                                        int *UNUSED(free))
 {
 	wmWindowManager *wm = CTX_wm_manager(C);
 	wmKeyConfig *kc;
 	wmKeyMap *km;
 
-	for(kc=wm->keyconfigs.first; kc; kc=kc->next) {
-		for(km=kc->keymaps.first; km; km=km->next) {
+	for (kc = wm->keyconfigs.first; kc; kc = kc->next) {
+		for (km = kc->keymaps.first; km; km = km->next) {
 			/* only check if it's a modal keymap */
 			if (km->modal_items) {
 				wmKeyMapItem *kmi;
-				for (kmi=km->items.first; kmi; kmi=kmi->next) {
+				for (kmi = km->items.first; kmi; kmi = kmi->next) {
 					if (kmi == ptr->data) {
 						return km->modal_items;
 					}
@@ -652,48 +678,48 @@ static void rna_KeyMapItem_any_setf(PointerRNA *ptr, int value)
 {
 	wmKeyMapItem *kmi = (wmKeyMapItem*)ptr->data;
 
-	if(value) {
-		kmi->shift= kmi->ctrl= kmi->alt= kmi->oskey= KM_ANY;
+	if (value) {
+		kmi->shift = kmi->ctrl = kmi->alt = kmi->oskey = KM_ANY;
 	}
 	else {
-		kmi->shift= kmi->ctrl= kmi->alt= kmi->oskey= 0;
+		kmi->shift = kmi->ctrl = kmi->alt = kmi->oskey = 0;
 	}
 }
 
 
 static PointerRNA rna_WindowManager_active_keyconfig_get(PointerRNA *ptr)
 {
-	wmWindowManager *wm= ptr->data;
+	wmWindowManager *wm = ptr->data;
 	wmKeyConfig *kc;
 
-	for(kc=wm->keyconfigs.first; kc; kc=kc->next)
-		if(strcmp(kc->idname, U.keyconfigstr) == 0)
+	for (kc = wm->keyconfigs.first; kc; kc = kc->next)
+		if (strcmp(kc->idname, U.keyconfigstr) == 0)
 			break;
 	
-	if(!kc)
-		kc= wm->defaultconf;
+	if (!kc)
+		kc = wm->defaultconf;
 	
 	return rna_pointer_inherit_refine(ptr, &RNA_KeyConfig, kc);
 }
 
 static void rna_WindowManager_active_keyconfig_set(PointerRNA *ptr, PointerRNA value)
 {
-	wmWindowManager *wm= ptr->data;
-	wmKeyConfig *kc= value.data;
+	wmWindowManager *wm = ptr->data;
+	wmKeyConfig *kc = value.data;
 
-	if(kc)
+	if (kc)
 		WM_keyconfig_set_active(wm, kc->idname);
 }
 
 static void rna_wmKeyMapItem_idname_get(PointerRNA *ptr, char *value)
 {
-	wmKeyMapItem *kmi= ptr->data;
+	wmKeyMapItem *kmi = ptr->data;
 	WM_operator_py_idname(value, kmi->idname);
 }
 
 static int rna_wmKeyMapItem_idname_length(PointerRNA *ptr)
 {
-	wmKeyMapItem *kmi= ptr->data;
+	wmKeyMapItem *kmi = ptr->data;
 	char pyname[OP_MAX_TYPENAME];
 
 	WM_operator_py_idname(pyname, kmi->idname);
@@ -702,12 +728,12 @@ static int rna_wmKeyMapItem_idname_length(PointerRNA *ptr)
 
 static void rna_wmKeyMapItem_idname_set(PointerRNA *ptr, const char *value)
 {
-	wmKeyMapItem *kmi= ptr->data;
+	wmKeyMapItem *kmi = ptr->data;
 	char idname[OP_MAX_TYPENAME];
 
 	WM_operator_bl_idname(idname, value);
 
-	if(strcmp(idname, kmi->idname) != 0) {
+	if (strcmp(idname, kmi->idname) != 0) {
 		BLI_strncpy(kmi->idname, idname, sizeof(kmi->idname));
 
 		WM_keymap_properties_reset(kmi, NULL);
@@ -716,21 +742,21 @@ static void rna_wmKeyMapItem_idname_set(PointerRNA *ptr, const char *value)
 
 static void rna_wmKeyMapItem_name_get(PointerRNA *ptr, char *value)
 {
-	wmKeyMapItem *kmi= ptr->data;
-	wmOperatorType *ot= WM_operatortype_find(kmi->idname, 1);
+	wmKeyMapItem *kmi = ptr->data;
+	wmOperatorType *ot = WM_operatortype_find(kmi->idname, 1);
 	strcpy(value, ot ? ot->name : kmi->idname);
 }
 
 static int rna_wmKeyMapItem_name_length(PointerRNA *ptr)
 {
-	wmKeyMapItem *kmi= ptr->data;
-	wmOperatorType *ot= WM_operatortype_find(kmi->idname, 1);
+	wmKeyMapItem *kmi = ptr->data;
+	wmOperatorType *ot = WM_operatortype_find(kmi->idname, 1);
 	return strlen(ot ? ot->name : kmi->idname);
 }
 
 static int rna_KeyMapItem_userdefined_get(PointerRNA *ptr)
 {
-	wmKeyMapItem *kmi= ptr->data;
+	wmKeyMapItem *kmi = ptr->data;
 	return kmi->id < 0;
 }
 
@@ -738,13 +764,13 @@ static void rna_wmClipboard_get(PointerRNA *UNUSED(ptr), char *value)
 {
 	char *pbuf;
 
-	pbuf= WM_clipboard_text_get(FALSE);
-	if(pbuf) {
+	pbuf = WM_clipboard_text_get(FALSE);
+	if (pbuf) {
 		strcpy(value, pbuf);
 		MEM_freeN(pbuf);
 	}
 	else {
-		value[0]= '\0';
+		value[0] = '\0';
 	}
 }
 
@@ -754,12 +780,12 @@ static int rna_wmClipboard_length(PointerRNA *UNUSED(ptr))
 	int length;
 
 	pbuf = WM_clipboard_text_get(FALSE);
-	if(pbuf) {
+	if (pbuf) {
 		length = strlen(pbuf);
 		MEM_freeN(pbuf);
 	}
 	else {
-		length= 0;
+		length = 0;
 	}
 	
 
@@ -775,21 +801,21 @@ static void rna_wmClipboard_set(PointerRNA *UNUSED(ptr), const char *value)
 static void rna_Operator_unregister(struct Main *bmain, StructRNA *type)
 {
 	const char *idname;
-	wmOperatorType *ot= RNA_struct_blender_type_get(type);
+	wmOperatorType *ot = RNA_struct_blender_type_get(type);
 	wmWindowManager *wm;
 
-	if(!ot)
+	if (!ot)
 		return;
 
 	/* update while blender is running */
-	wm= bmain->wm.first;
-	if(wm)
+	wm = bmain->wm.first;
+	if (wm)
 		WM_operator_stack_clear(wm);
 	WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL);
 
 	RNA_struct_free_extension(type, &ot->ext);
 
-	idname= ot->idname;
+	idname = ot->idname;
 	WM_operatortype_remove(ot->idname);
 	MEM_freeN((void *)idname);
 
@@ -808,14 +834,14 @@ static int operator_poll(bContext *C, wmOperatorType *ot)
 	int visible;
 
 	RNA_pointer_create(NULL, ot->ext.srna, NULL, &ptr); /* dummy */
-	func= &rna_Operator_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
+	func = &rna_Operator_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
 
 	RNA_parameter_list_create(&list, &ptr, func);
 	RNA_parameter_set_lookup(&list, "context", &C);
 	ot->ext.call(C, &ptr, func, &list);
 
 	RNA_parameter_get_lookup(&list, "visible", &ret);
-	visible= *(int*)ret;
+	visible = *(int*)ret;
 
 	RNA_parameter_list_free(&list);
 
@@ -833,14 +859,14 @@ static int operator_execute(bContext *C, wmOperator *op)
 	int result;
 
 	RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
-	func= &rna_Operator_execute_func; /* RNA_struct_find_function(&opr, "execute"); */
+	func = &rna_Operator_execute_func; /* RNA_struct_find_function(&opr, "execute"); */
 
 	RNA_parameter_list_create(&list, &opr, func);
 	RNA_parameter_set_lookup(&list, "context", &C);
 	op->type->ext.call(C, &opr, func, &list);
 
 	RNA_parameter_get_lookup(&list, "result", &ret);
-	result= *(int*)ret;
+	result = *(int*)ret;
 
 	RNA_parameter_list_free(&list);
 
@@ -859,14 +885,14 @@ static int operator_check(bContext *C, wmOperator *op)
 	int result;
 
 	RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
-	func= &rna_Operator_check_func; /* RNA_struct_find_function(&opr, "check"); */
+	func = &rna_Operator_check_func; /* RNA_struct_find_function(&opr, "check"); */
 
 	RNA_parameter_list_create(&list, &opr, func);
 	RNA_parameter_set_lookup(&list, "context", &C);
 	op->type->ext.call(C, &opr, func, &list);
 
 	RNA_parameter_get_lookup(&list, "result", &ret);
-	result= *(int*)ret;
+	result = *(int*)ret;
 
 	RNA_parameter_list_free(&list);
 
@@ -884,7 +910,7 @@ static int operator_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	int result;
 
 	RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
-	func= &rna_Operator_invoke_func; /* RNA_struct_find_function(&opr, "invoke"); */
+	func = &rna_Operator_invoke_func; /* RNA_struct_find_function(&opr, "invoke"); */
 
 	RNA_parameter_list_create(&list, &opr, func);
 	RNA_parameter_set_lookup(&list, "context", &C);
@@ -892,7 +918,7 @@ static int operator_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	op->type->ext.call(C, &opr, func, &list);
 
 	RNA_parameter_get_lookup(&list, "result", &ret);
-	result= *(int*)ret;
+	result = *(int*)ret;
 
 	RNA_parameter_list_free(&list);
 
@@ -911,7 +937,7 @@ static int operator_modal(bContext *C, wmOperator *op, wmEvent *event)
 	int result;
 
 	RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
-	func= &rna_Operator_modal_func; /* RNA_struct_find_function(&opr, "modal"); */
+	func = &rna_Operator_modal_func; /* RNA_struct_find_function(&opr, "modal"); */
 
 	RNA_parameter_list_create(&list, &opr, func);
 	RNA_parameter_set_lookup(&list, "context", &C);
@@ -919,7 +945,7 @@ static int operator_modal(bContext *C, wmOperator *op, wmEvent *event)
 	op->type->ext.call(C, &opr, func, &list);
 
 	RNA_parameter_get_lookup(&list, "result", &ret);
-	result= *(int*)ret;
+	result = *(int*)ret;
 
 	RNA_parameter_list_free(&list);
 
@@ -935,7 +961,7 @@ static void operator_draw(bContext *C, wmOperator *op)
 	FunctionRNA *func;
 
 	RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
-	func= &rna_Operator_draw_func; /* RNA_struct_find_function(&opr, "draw"); */
+	func = &rna_Operator_draw_func; /* RNA_struct_find_function(&opr, "draw"); */
 
 	RNA_parameter_list_create(&list, &opr, func);
 	RNA_parameter_set_lookup(&list, "context", &C);
@@ -956,14 +982,14 @@ static int operator_cancel(bContext *C, wmOperator *op)
 	int result;
 
 	RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
-	func= &rna_Operator_cancel_func; /* RNA_struct_find_function(&opr, "cancel"); */
+	func = &rna_Operator_cancel_func; /* RNA_struct_find_function(&opr, "cancel"); */
 
 	RNA_parameter_list_create(&list, &opr, func);
 	RNA_parameter_set_lookup(&list, "context", &C);
 	op->type->ext.call(C, &opr, func, &list);
 
 	RNA_parameter_get_lookup(&list, "result", &ret);
-	result= *(int*)ret;
+	result = *(int*)ret;
 
 	RNA_parameter_list_free(&list);
 
@@ -976,25 +1002,26 @@ void macro_wrapper(wmOperatorType *ot, void *userdata);
 static char _operator_idname[OP_MAX_TYPENAME];
 static char _operator_name[OP_MAX_TYPENAME];
 static char _operator_descr[RNA_DYN_DESCR_MAX];
-static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void *data, const char *identifier,
+                                        StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
 {
 	wmOperatorType dummyot = {NULL};
-	wmOperator dummyop= {NULL};
+	wmOperator dummyop = {NULL};
 	PointerRNA dummyotr;
 	int have_function[7];
 
 	/* setup dummy operator & operator type to store static properties in */
-	dummyop.type= &dummyot;
-	dummyot.idname= _operator_idname; /* only assigne the pointer, string is NULL'd */
-	dummyot.name= _operator_name; /* only assigne the pointer, string is NULL'd */
-	dummyot.description= _operator_descr; /* only assigne the pointer, string is NULL'd */
+	dummyop.type = &dummyot;
+	dummyot.idname = _operator_idname; /* only assigne the pointer, string is NULL'd */
+	dummyot.name = _operator_name; /* only assigne the pointer, string is NULL'd */
+	dummyot.description = _operator_descr; /* only assigne the pointer, string is NULL'd */
 	RNA_pointer_create(NULL, &RNA_Operator, &dummyop, &dummyotr);
 
-	/* clear incase they are left unset */
-	_operator_idname[0]= _operator_name[0]= _operator_descr[0]= '\0';
+	/* clear in case they are left unset */
+	_operator_idname[0] = _operator_name[0] = _operator_descr[0] = '\0';
 
 	/* validate the python class */
-	if(validate(&dummyotr, data, have_function) != 0)
+	if (validate(&dummyotr, data, have_function) != 0)
 		return NULL;
 
 	{	/* convert foo.bar to FOO_OT_bar
@@ -1002,34 +1029,37 @@ static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void *
 
 		/* inconveniently long name sanity check */
 		{
-			char *ch= _operator_idname;
+			char *ch = _operator_idname;
 			int i;
-			int dot= 0;
-			for(i=0; *ch; i++) {
-				if((*ch >= 'a' && *ch <= 'z') || (*ch >= '0' && *ch <= '9') || *ch == '_') {
+			int dot = 0;
+			for (i = 0; *ch; i++) {
+				if ((*ch >= 'a' && *ch <= 'z') || (*ch >= '0' && *ch <= '9') || *ch == '_') {
 					/* pass */
 				}
-				else if(*ch == '.') {
+				else if (*ch == '.') {
 					dot++;
 				}
 				else {
-					BKE_reportf(reports, RPT_ERROR, "registering operator class: '%s', invalid bl_idname '%s', at position %d", identifier, _operator_idname, i);
+					BKE_reportf(reports, RPT_ERROR,
+					            "registering operator class: '%s', invalid bl_idname '%s', at position %d",
+					            identifier, _operator_idname, i);
 					return NULL;
 				}
 
 				ch++;
 			}
 
-			if(i > ((int)sizeof(dummyop.idname)) - 3) {
+			if (i > ((int)sizeof(dummyop.idname)) - 3) {
 				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);
+				            (int)sizeof(dummyop.idname) - 3);
 				return NULL;
 			}
 
-			if(dot != 1) {
-				BKE_reportf(reports, RPT_ERROR, "registering operator class: '%s', invalid bl_idname '%s', "
-				            "must contain 1 '.' character", identifier, _operator_idname);
+			if (dot != 1) {
+				BKE_reportf(reports, RPT_ERROR,
+				            "registering operator class: '%s', invalid bl_idname '%s', must contain 1 '.' character",
+				            identifier, _operator_idname);
 				return NULL;
 			}
 		}
@@ -1040,9 +1070,10 @@ static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void *
 			int namelen = strlen(_operator_name) + 1;
 			int desclen = strlen(_operator_descr) + 1;
 			char *ch;
-			ch= MEM_callocN(sizeof(char) * (idlen + namelen + desclen), "_operator_idname"); /* 2 terminators and 3 to convert a.b -> A_OT_b */
+			/* 2 terminators and 3 to convert a.b -> A_OT_b */
+			ch = MEM_callocN(sizeof(char) * (idlen + namelen + desclen), "_operator_idname");
 			WM_operator_bl_idname(ch, _operator_idname); /* convert the idname from python */
-			dummyot.idname= ch;
+			dummyot.idname = ch;
 			ch += idlen;
 			strcpy(ch, _operator_name);
 			dummyot.name = ch;
@@ -1054,8 +1085,8 @@ static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void *
 
 	/* check if we have registered this operator type before, and remove it */
 	{
-		wmOperatorType *ot= WM_operatortype_find(dummyot.idname, TRUE);
-		if(ot && ot->ext.srna)
+		wmOperatorType *ot = WM_operatortype_find(dummyot.idname, TRUE);
+		if (ot && ot->ext.srna)
 			rna_Operator_unregister(bmain, ot->ext.srna);
 	}
 
@@ -1063,19 +1094,19 @@ static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void *
 	 * for now just remove from dir(bpy.types) */
 
 	/* create a new operator type */
-	dummyot.ext.srna= RNA_def_struct(&BLENDER_RNA, dummyot.idname, "Operator");
+	dummyot.ext.srna = RNA_def_struct(&BLENDER_RNA, dummyot.idname, "Operator");
 	RNA_def_struct_flag(dummyot.ext.srna, STRUCT_NO_IDPROPERTIES); /* operator properties are registered separately */
-	dummyot.ext.data= data;
-	dummyot.ext.call= call;
-	dummyot.ext.free= free;
-
-	dummyot.pyop_poll=	(have_function[0])? operator_poll: NULL;
-	dummyot.exec=		(have_function[1])? operator_execute: NULL;
-	dummyot.check=		(have_function[2])? operator_check: NULL;
-	dummyot.invoke=		(have_function[3])? operator_invoke: NULL;
-	dummyot.modal=		(have_function[4])? operator_modal: NULL;
-	dummyot.ui=			(have_function[5])? operator_draw: NULL;
-	dummyot.cancel=		(have_function[6])? operator_cancel: NULL;
+	dummyot.ext.data = data;
+	dummyot.ext.call = call;
+	dummyot.ext.free = free;
+
+	dummyot.pyop_poll =	(have_function[0])? operator_poll: NULL;
+	dummyot.exec =		(have_function[1])? operator_execute: NULL;
+	dummyot.check =		(have_function[2])? operator_check: NULL;
+	dummyot.invoke =		(have_function[3])? operator_invoke: NULL;
+	dummyot.modal =		(have_function[4])? operator_modal: NULL;
+	dummyot.ui =			(have_function[5])? operator_draw: NULL;
+	dummyot.cancel =		(have_function[6])? operator_cancel: NULL;
 	WM_operatortype_append_ptr(operator_wrapper, (void *)&dummyot);
 
 	/* update while blender is running */
@@ -1090,22 +1121,23 @@ void **rna_Operator_instance(PointerRNA *ptr)
 	return &op->py_instance;
 }
 
-static StructRNA *rna_MacroOperator_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_MacroOperator_register(Main *bmain, ReportList *reports, void *data, const char *identifier,
+                                             StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
 {
 	wmOperatorType dummyot = {NULL};
-	wmOperator dummyop= {NULL};
+	wmOperator dummyop = {NULL};
 	PointerRNA dummyotr;
 	int have_function[4];
 
 	/* setup dummy operator & operator type to store static properties in */
-	dummyop.type= &dummyot;
-	dummyot.idname= _operator_idname; /* only assigne the pointer, string is NULL'd */
-	dummyot.name= _operator_name; /* only assigne the pointer, string is NULL'd */
-	dummyot.description= _operator_descr; /* only assigne the pointer, string is NULL'd */
+	dummyop.type = &dummyot;
+	dummyot.idname = _operator_idname; /* only assigne the pointer, string is NULL'd */
+	dummyot.name = _operator_name; /* only assigne the pointer, string is NULL'd */
+	dummyot.description = _operator_descr; /* only assigne the pointer, string is NULL'd */
 	RNA_pointer_create(NULL, &RNA_Macro, &dummyop, &dummyotr);
 
 	/* validate the python class */
-	if(validate(&dummyotr, data, have_function) != 0)
+	if (validate(&dummyotr, data, have_function) != 0)
 		return NULL;
 
 	{	/* convert foo.bar to FOO_OT_bar
@@ -1114,9 +1146,10 @@ static StructRNA *rna_MacroOperator_register(Main *bmain, ReportList *reports, v
 		int namelen = strlen(_operator_name) + 1;
 		int desclen = strlen(_operator_descr) + 1;
 		char *ch;
-		ch= MEM_callocN(sizeof(char) * (idlen + namelen + desclen), "_operator_idname"); /* 2 terminators and 3 to convert a.b -> A_OT_b */
+		/* 2 terminators and 3 to convert a.b -> A_OT_b */
+		ch = MEM_callocN(sizeof(char) * (idlen + namelen + desclen), "_operator_idname");
 		WM_operator_bl_idname(ch, _operator_idname); /* convert the idname from python */
-		dummyot.idname= ch;
+		dummyot.idname = ch;
 		ch += idlen;
 		strcpy(ch, _operator_name);
 		dummyot.name = ch;
@@ -1125,7 +1158,7 @@ static StructRNA *rna_MacroOperator_register(Main *bmain, ReportList *reports, v
 		dummyot.description = ch;
 	}
 
-	if(strlen(identifier) >= sizeof(dummyop.idname)) {
+	if (strlen(identifier) >= sizeof(dummyop.idname)) {
 		BKE_reportf(reports, RPT_ERROR, "registering operator class: '%s' is too long, maximum length is %d",
 		            identifier, (int)sizeof(dummyop.idname));
 		return NULL;
@@ -1133,8 +1166,8 @@ static StructRNA *rna_MacroOperator_register(Main *bmain, ReportList *reports, v
 
 	/* check if we have registered this operator type before, and remove it */
 	{
-		wmOperatorType *ot= WM_operatortype_find(dummyot.idname, TRUE);
-		if(ot && ot->ext.srna)
+		wmOperatorType *ot = WM_operatortype_find(dummyot.idname, TRUE);
+		if (ot && ot->ext.srna)
 			rna_Operator_unregister(bmain, ot->ext.srna);
 	}
 
@@ -1142,13 +1175,13 @@ static StructRNA *rna_MacroOperator_register(Main *bmain, ReportList *reports, v
 	 * for now just remove from dir(bpy.types) */
 
 	/* create a new operator type */
-	dummyot.ext.srna= RNA_def_struct(&BLENDER_RNA, dummyot.idname, "Operator");
-	dummyot.ext.data= data;
-	dummyot.ext.call= call;
-	dummyot.ext.free= free;
+	dummyot.ext.srna = RNA_def_struct(&BLENDER_RNA, dummyot.idname, "Operator");
+	dummyot.ext.data = data;
+	dummyot.ext.call = call;
+	dummyot.ext.free = free;
 
-	dummyot.pyop_poll=	(have_function[0])? operator_poll: NULL;
-	dummyot.ui=			(have_function[3])? operator_draw: NULL;
+	dummyot.pyop_poll =	(have_function[0])? operator_poll: NULL;
+	dummyot.ui =			(have_function[3])? operator_draw: NULL;
 
 	WM_operatortype_append_macro_ptr(macro_wrapper, (void *)&dummyot);
 
@@ -1161,44 +1194,44 @@ static StructRNA *rna_MacroOperator_register(Main *bmain, ReportList *reports, v
 
 static StructRNA* rna_Operator_refine(PointerRNA *opr)
 {
-	wmOperator *op= (wmOperator*)opr->data;
+	wmOperator *op = (wmOperator*)opr->data;
 	return (op->type && op->type->ext.srna)? op->type->ext.srna: &RNA_Operator;
 }
 
 static StructRNA* rna_MacroOperator_refine(PointerRNA *opr)
 {
-	wmOperator *op= (wmOperator*)opr->data;
+	wmOperator *op = (wmOperator*)opr->data;
 	return (op->type && op->type->ext.srna)? op->type->ext.srna: &RNA_Macro;
 }
 
 /* just to work around 'const char *' warning and to ensure this is a python op */
 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 */
+	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");
 }
 
 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 */
+	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");
 }
 
 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 */
+	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");
 }
 
 static void rna_KeyMapItem_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	wmKeyMapItem *kmi= ptr->data;
+	wmKeyMapItem *kmi = ptr->data;
 	WM_keyconfig_update_tag(NULL, kmi);
 }
 
@@ -1209,7 +1242,7 @@ static void rna_def_operator(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "Operator", NULL);
+	srna = RNA_def_struct(brna, "Operator", NULL);
 	RNA_def_struct_ui_text(srna, "Operator", "Storage of an operator being executed, or registered after execution");
 	RNA_def_struct_sdna(srna, "wmOperator");
 	RNA_def_struct_refine_func(srna, "rna_Operator_refine");
@@ -1217,49 +1250,55 @@ static void rna_def_operator(BlenderRNA *brna)
 	RNA_def_struct_register_funcs(srna, "rna_Operator_register", "rna_Operator_unregister", "rna_Operator_instance");
 #endif
 
-	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_funcs(prop, "rna_Operator_name_get", "rna_Operator_name_length", NULL);
 	RNA_def_property_ui_text(prop, "Name", "");
 
-	prop= RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "OperatorProperties");
 	RNA_def_property_ui_text(prop, "Properties", "");
 	RNA_def_property_pointer_funcs(prop, "rna_Operator_properties_get", NULL, NULL, NULL);
 	
-	prop= RNA_def_property(srna, "has_reports", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "has_reports", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* this is 'virtual' property */
 	RNA_def_property_boolean_funcs(prop, "rna_Operator_has_reports_get", NULL);
-	RNA_def_property_ui_text(prop, "Has Reports", "Operator has a set of reports (warnings and errors) from last execution");
+	RNA_def_property_ui_text(prop, "Has Reports",
+	                         "Operator has a set of reports (warnings and errors) from last execution");
 	
-	prop= RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "UILayout");
 
 	/* Registration */
-	prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "type->idname");
-	RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME-3); /* else it uses the pointer size!. -3 because '.' -> '_OT_' */
+		/* else it uses the pointer size!. -3 because '.' -> '_OT_' */
+	RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME-3);
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_idname_set");
-	// RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+	/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
 	RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP);
 	RNA_def_struct_name_property(srna, prop);
 
-	prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
+	/* operator's label indeed doesn't need PROP_TRANSLATE flag: translation of label happens in runtime
+	 * when drawing panel and having this flag set will make runtime switching of language much more tricky
+	 * because label will be stored translated */
+	prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "type->name");
 	RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_label_set");
-	// RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+	/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
 	RNA_def_property_flag(prop, PROP_REGISTER);
 
-	prop= RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATE);
+	prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATE);
 	RNA_def_property_string_sdna(prop, NULL, "type->description");
 	RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_description_set");
-	// RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+	/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
 	RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+	RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
 
-	prop= RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type->flag");
 	RNA_def_property_enum_items(prop, operator_flag_items);
 	RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL|PROP_ENUM_FLAG);
@@ -1267,7 +1306,7 @@ static void rna_def_operator(BlenderRNA *brna)
 
 	RNA_api_operator(srna);
 
-	srna= RNA_def_struct(brna, "OperatorProperties", NULL);
+	srna = RNA_def_struct(brna, "OperatorProperties", NULL);
 	RNA_def_struct_ui_text(srna, "Operator Properties", "Input properties of an Operator");
 	RNA_def_struct_refine_func(srna, "rna_OperatorProperties_refine");
 	RNA_def_struct_idprops_func(srna, "rna_OperatorProperties_idprops");
@@ -1278,49 +1317,55 @@ static void rna_def_macro_operator(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "Macro", NULL);
-	RNA_def_struct_ui_text(srna, "Macro Operator", "Storage of a macro operator being executed, or registered after execution");
+	srna = RNA_def_struct(brna, "Macro", NULL);
+	RNA_def_struct_ui_text(srna, "Macro Operator",
+	                       "Storage of a macro operator being executed, or registered after execution");
 	RNA_def_struct_sdna(srna, "wmOperator");
 	RNA_def_struct_refine_func(srna, "rna_MacroOperator_refine");
 #ifdef WITH_PYTHON
-	RNA_def_struct_register_funcs(srna, "rna_MacroOperator_register", "rna_Operator_unregister", "rna_Operator_instance");
+	RNA_def_struct_register_funcs(srna, "rna_MacroOperator_register", "rna_Operator_unregister",
+	                              "rna_Operator_instance");
 #endif
 
-	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_funcs(prop, "rna_Operator_name_get", "rna_Operator_name_length", NULL);
 	RNA_def_property_ui_text(prop, "Name", "");
 
-	prop= RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "OperatorProperties");
 	RNA_def_property_ui_text(prop, "Properties", "");
 	RNA_def_property_pointer_funcs(prop, "rna_Operator_properties_get", NULL, NULL, NULL);
 
 	/* Registration */
-	prop= RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "type->idname");
 	RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME); /* else it uses the pointer size! */
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_idname_set");
-	// RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+	/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
 	RNA_def_property_flag(prop, PROP_REGISTER|PROP_NEVER_CLAMP);
 	RNA_def_struct_name_property(srna, prop);
 
-	prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_TRANSLATE);
+	/* menu's label indeed doesn't need PROP_TRANSLATE flag: translation of label happens in runtime
+	 * when drawing panel and having this flag set will make runtime switching of language much more tricky
+	 * because label will be stored translated */
+	prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "type->name");
 	RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_label_set");
-	// RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+	/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
 	RNA_def_property_flag(prop, PROP_REGISTER);
 
-	prop= RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATE);
+	prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATE);
 	RNA_def_property_string_sdna(prop, NULL, "type->description");
 	RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_description_set");
-	// RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+	/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
 	RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+	RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
 
-	prop= RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type->flag");
 	RNA_def_property_enum_items(prop, operator_flag_items);
 	RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL|PROP_ENUM_FLAG);
@@ -1334,17 +1379,17 @@ static void rna_def_operator_type_macro(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "OperatorMacro", NULL);
+	srna = RNA_def_struct(brna, "OperatorMacro", NULL);
 	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);
-//	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");
-//	RNA_def_struct_name_property(srna, prop);
+/*	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"); */
+/*	RNA_def_struct_name_property(srna, prop); */
 
-	prop= RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "OperatorProperties");
 	RNA_def_property_ui_text(prop, "Properties", "");
@@ -1356,15 +1401,15 @@ static void rna_def_operator_utils(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "OperatorMousePath", "PropertyGroup");
+	srna = RNA_def_struct(brna, "OperatorMousePath", "PropertyGroup");
 	RNA_def_struct_ui_text(srna, "Operator Mouse Path", "Mouse path values for operators that record such paths");
 
-	prop= RNA_def_property(srna, "loc", PROP_FLOAT, PROP_XYZ);
+	prop = RNA_def_property(srna, "loc", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_flag(prop, PROP_IDPROPERTY);
 	RNA_def_property_array(prop, 2);
 	RNA_def_property_ui_text(prop, "Location", "Mouse location");
 
-	prop= RNA_def_property(srna, "time", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_IDPROPERTY);
 	RNA_def_property_ui_text(prop, "Time", "Time of mouse location");
 }
@@ -1374,13 +1419,13 @@ static void rna_def_operator_filelist_element(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "OperatorFileListElement", "PropertyGroup");
+	srna = RNA_def_struct(brna, "OperatorFileListElement", "PropertyGroup");
 	RNA_def_struct_ui_text(srna, "Operator File List Element", "");
 
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_FILENAME);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_FILENAME);
 	RNA_def_property_flag(prop, PROP_IDPROPERTY);
-	RNA_def_property_ui_text(prop, "Name", "the name of a file or directory within a file list");
+	RNA_def_property_ui_text(prop, "Name", "Name of a file or directory within a file list");
 }
 	
 static void rna_def_event(BlenderRNA *brna)
@@ -1388,32 +1433,32 @@ static void rna_def_event(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 	
-	srna= RNA_def_struct(brna, "Event", NULL);
+	srna = RNA_def_struct(brna, "Event", NULL);
 	RNA_def_struct_ui_text(srna, "Event", "Window Manager Event");
 	RNA_def_struct_sdna(srna, "wmEvent");
 
-	RNA_define_verify_sdna(0); // not in sdna
+	RNA_define_verify_sdna(0); /* not in sdna */
 
 	/* strings */
-	prop= RNA_def_property(srna, "ascii", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "ascii", PROP_STRING, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_string_funcs(prop, "rna_Event_ascii_get", "rna_Event_ascii_length", NULL);
 	RNA_def_property_ui_text(prop, "ASCII", "Single ASCII character for this event");
 
 
-	prop= RNA_def_property(srna, "unicode", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "unicode", PROP_STRING, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_string_funcs(prop, "rna_Event_unicode_get", "rna_Event_unicode_length", NULL);
 	RNA_def_property_ui_text(prop, "Unicode", "Single unicode character for this event");
 
 	/* enums */
-	prop= RNA_def_property(srna, "value", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "value", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "val");
 	RNA_def_property_enum_items(prop, event_value_items);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Value",  "The type of event, only applies to some");
 	
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, event_type_items);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -1421,59 +1466,59 @@ static void rna_def_event(BlenderRNA *brna)
 
 
 	/* mouse */
-	prop= RNA_def_property(srna, "mouse_x", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "mouse_x", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "x");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Mouse X Position", "The window relative vertical location of the mouse");
 	
-	prop= RNA_def_property(srna, "mouse_y", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "mouse_y", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "y");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Mouse Y Position", "The window relative horizontal location of the mouse");
 
-	prop= RNA_def_property(srna, "mouse_region_x", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "mouse_region_x", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "mval[0]");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Mouse X Position", "The region relative vertical location of the mouse");
 
-	prop= RNA_def_property(srna, "mouse_region_y", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "mouse_region_y", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "mval[1]");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Mouse Y Position", "The region relative horizontal location of the mouse");
 	
-	prop= RNA_def_property(srna, "mouse_prev_x", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "mouse_prev_x", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "prevx");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Mouse Previous X Position", "The window relative vertical location of the mouse");
 	
-	prop= RNA_def_property(srna, "mouse_prev_y", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "mouse_prev_y", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "prevy");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "Mouse Previous Y Position", "The window relative horizontal location of the mouse");	
+	RNA_def_property_ui_text(prop, "Mouse Previous Y Position", "The window relative horizontal location of the mouse");
 
 
 	/* modifiers */
-	prop= RNA_def_property(srna, "shift", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "shift", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "shift", 1);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Shift", "True when the Shift key is held");
 	
-	prop= RNA_def_property(srna, "ctrl", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "ctrl", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ctrl", 1);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Ctrl", "True when the Ctrl key is held");
 	
-	prop= RNA_def_property(srna, "alt", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "alt", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "alt", 1);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Alt", "True when the Alt/Option key is held");
 	
-	prop= RNA_def_property(srna, "oskey", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "oskey", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "oskey", 1);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "OS Key", "True when the Cmd key is held");
 
-	RNA_define_verify_sdna(1); // not in sdna
+	RNA_define_verify_sdna(1); /* not in sdna */
 }
 
 static void rna_def_timer(BlenderRNA *brna)
@@ -1481,29 +1526,29 @@ static void rna_def_timer(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "Timer", NULL);
+	srna = RNA_def_struct(brna, "Timer", NULL);
 	RNA_def_struct_ui_text(srna, "Timer", "Window event timer");
 	RNA_def_struct_sdna(srna, "wmTimer");
 
-	RNA_define_verify_sdna(0); // not in sdna
+	RNA_define_verify_sdna(0); /* not in sdna */
 
 	/* could wrap more, for now this is enough */
-	prop= RNA_def_property(srna, "time_step", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "time_step", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "timestep");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Time Step", "");
 
-	prop= RNA_def_property(srna, "time_delta", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "time_delta", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "delta");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Delta", "Time since last step in seconds");
 
-	prop= RNA_def_property(srna, "time_duration", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "time_duration", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "duration");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Delta", "Time since last step in seconds");
 
-	RNA_define_verify_sdna(1); // not in sdna
+	RNA_define_verify_sdna(1); /* not in sdna */
 }
 
 static void rna_def_window(BlenderRNA *brna)
@@ -1511,11 +1556,11 @@ static void rna_def_window(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "Window", NULL);
+	srna = RNA_def_struct(brna, "Window", NULL);
 	RNA_def_struct_ui_text(srna, "Window", "Open window");
 	RNA_def_struct_sdna(srna, "wmWindow");
 
-	prop= RNA_def_property(srna, "screen", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "screen", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "Screen");
 	RNA_def_property_ui_text(prop, "Screen", "Active screen showing in the window");
@@ -1532,30 +1577,35 @@ static void rna_def_wm_keyconfigs(BlenderRNA *brna, PropertyRNA *cprop)
 	PropertyRNA *prop;
 
 	RNA_def_property_srna(cprop, "KeyConfigurations");
-	srna= RNA_def_struct(brna, "KeyConfigurations", NULL);
+	srna = RNA_def_struct(brna, "KeyConfigurations", NULL);
 	RNA_def_struct_sdna(srna, "wmWindowManager");
 	RNA_def_struct_ui_text(srna, "KeyConfigs", "Collection of KeyConfigs");
 
-	prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "KeyConfig");
-	RNA_def_property_pointer_funcs(prop, "rna_WindowManager_active_keyconfig_get", "rna_WindowManager_active_keyconfig_set", NULL, NULL);
+	RNA_def_property_pointer_funcs(prop, "rna_WindowManager_active_keyconfig_get",
+	                               "rna_WindowManager_active_keyconfig_set", NULL, NULL);
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Active KeyConfig", "Active key configuration (preset)");
 	
-	prop= RNA_def_property(srna, "default", PROP_POINTER, PROP_NEVER_NULL);
+	prop = RNA_def_property(srna, "default", PROP_POINTER, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "defaultconf");
 	RNA_def_property_struct_type(prop, "KeyConfig");
 	RNA_def_property_ui_text(prop, "Default Key Configuration", "Default builtin key configuration");
 
-	prop= RNA_def_property(srna, "addon", PROP_POINTER, PROP_NEVER_NULL);
+	prop = RNA_def_property(srna, "addon", PROP_POINTER, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "addonconf");
 	RNA_def_property_struct_type(prop, "KeyConfig");
-	RNA_def_property_ui_text(prop, "Addon Key Configuration", "Key configuration that can be extended by addons, and is added to the active configuration when handling events");
+	RNA_def_property_ui_text(prop, "Addon Key Configuration",
+	                         "Key configuration that can be extended by addons, and is added to the active "
+	                         "configuration when handling events");
 
-	prop= RNA_def_property(srna, "user", PROP_POINTER, PROP_NEVER_NULL);
+	prop = RNA_def_property(srna, "user", PROP_POINTER, PROP_NEVER_NULL);
 	RNA_def_property_pointer_sdna(prop, NULL, "userconf");
 	RNA_def_property_struct_type(prop, "KeyConfig");
-	RNA_def_property_ui_text(prop, "User Key Configuration", "Final key configuration that combines keymaps from the active and addon configurations, and can be edited by the user");
+	RNA_def_property_ui_text(prop, "User Key Configuration",
+	                         "Final key configuration that combines keymaps from the active and addon configurations, "
+	                         "and can be edited by the user");
 	
 	RNA_api_keyconfigs(srna);
 }
@@ -1565,25 +1615,26 @@ static void rna_def_windowmanager(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "WindowManager", "ID");
-	RNA_def_struct_ui_text(srna, "Window Manager", "Window manager datablock defining open windows and other user interface data");
+	srna = RNA_def_struct(brna, "WindowManager", "ID");
+	RNA_def_struct_ui_text(srna, "Window Manager",
+	                       "Window manager datablock defining open windows and other user interface data");
 	RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
 	RNA_def_struct_sdna(srna, "wmWindowManager");
 
-	prop= RNA_def_property(srna, "operators", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "operators", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Operator");
 	RNA_def_property_ui_text(prop, "Operators", "Operator registry");
 
-	prop= RNA_def_property(srna, "windows", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "windows", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Window");
 	RNA_def_property_ui_text(prop, "Windows", "Open windows");
 
-	prop= RNA_def_property(srna, "keyconfigs", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "keyconfigs", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "KeyConfig");
 	RNA_def_property_ui_text(prop, "Key Configurations", "Registered key configurations");
 	rna_def_wm_keyconfigs(brna, prop);
 
-	prop= RNA_def_property(srna, "clipboard", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "clipboard", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_funcs(prop, "rna_wmClipboard_get", "rna_wmClipboard_length", "rna_wmClipboard_set");
 	RNA_def_property_ui_text(prop, "Text Clipboard", "");
 
@@ -1596,7 +1647,7 @@ static void rna_def_keymap_items(BlenderRNA *brna, PropertyRNA *cprop)
 	StructRNA *srna;
 	
 	RNA_def_property_srna(cprop, "KeyMapItems");
-	srna= RNA_def_struct(brna, "KeyMapItems", NULL);
+	srna = RNA_def_struct(brna, "KeyMapItems", NULL);
 	RNA_def_struct_sdna(srna, "wmKeyMap");
 	RNA_def_struct_ui_text(srna, "KeyMap Items", "Collection of keymap items");
 
@@ -1608,7 +1659,7 @@ static void rna_def_wm_keymaps(BlenderRNA *brna, PropertyRNA *cprop)
 	StructRNA *srna;
 
 	RNA_def_property_srna(cprop, "KeyMaps");
-	srna= RNA_def_struct(brna, "KeyMaps", NULL);
+	srna = RNA_def_struct(brna, "KeyMaps", NULL);
 	RNA_def_struct_sdna(srna, "wmKeyConfig");
 	RNA_def_struct_ui_text(srna, "Key Maps", "Collection of keymaps");
 
@@ -1630,21 +1681,21 @@ static void rna_def_keyconfig(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}};
 
 	/* KeyConfig */
-	srna= RNA_def_struct(brna, "KeyConfig", NULL);
+	srna = RNA_def_struct(brna, "KeyConfig", NULL);
 	RNA_def_struct_sdna(srna, "wmKeyConfig");
 	RNA_def_struct_ui_text(srna, "Key Configuration", "Input configuration, including keymaps");
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "idname");
 	RNA_def_property_ui_text(prop, "Name", "Name of the key configuration");
 	RNA_def_struct_name_property(srna, prop);
 
-	prop= RNA_def_property(srna, "keymaps", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "keymaps", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_struct_type(prop, "KeyMap");
 	RNA_def_property_ui_text(prop, "Key Maps", "Key maps configured as part of this configuration");
 	rna_def_wm_keymaps(brna, prop);
 
-	prop= RNA_def_property(srna, "is_user_defined", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_user_defined", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYCONF_USER);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "User Defined", "Indicates that a keyconfig was defined by the user");
@@ -1652,49 +1703,50 @@ static void rna_def_keyconfig(BlenderRNA *brna)
 	RNA_api_keyconfig(srna);
 
 	/* KeyMap */
-	srna= RNA_def_struct(brna, "KeyMap", NULL);
+	srna = RNA_def_struct(brna, "KeyMap", NULL);
 	RNA_def_struct_sdna(srna, "wmKeyMap");
 	RNA_def_struct_ui_text(srna, "Key Map", "Input configuration, including keymaps");
 
-	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "idname");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Name", "Name of the key map");
 	RNA_def_struct_name_property(srna, prop);
 
-	prop= RNA_def_property(srna, "space_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "space_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "spaceid");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_enum_items(prop, space_type_items);
 	RNA_def_property_ui_text(prop, "Space Type", "Optional space type keymap is associated with");
 
-	prop= RNA_def_property(srna, "region_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "region_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "regionid");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_enum_items(prop, region_type_items);
 	RNA_def_property_ui_text(prop, "Region Type", "Optional region type keymap is associated with");
 
-	prop= RNA_def_property(srna, "keymap_items", PROP_COLLECTION, PROP_NONE);
+	prop = RNA_def_property(srna, "keymap_items", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "items", NULL);
 	RNA_def_property_struct_type(prop, "KeyMapItem");
 	RNA_def_property_ui_text(prop, "Items", "Items in the keymap, linking an operator to an input event");
 	rna_def_keymap_items(brna, prop);
 
-	prop= RNA_def_property(srna, "is_user_modified", PROP_BOOLEAN, PROP_NEVER_NULL);
+	prop = RNA_def_property(srna, "is_user_modified", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_USER_MODIFIED);
 	RNA_def_property_ui_text(prop, "User Defined", "Keymap is defined by the user");
 
-	prop= RNA_def_property(srna, "is_modal", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_modal", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_MODAL);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "Modal Keymap", "Indicates that a keymap is used for translate modal events for an operator");
+	RNA_def_property_ui_text(prop, "Modal Keymap",
+	                         "Indicates that a keymap is used for translate modal events for an operator");
 
-	prop= RNA_def_property(srna, "show_expanded_items", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_expanded_items", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_EXPANDED);
 	RNA_def_property_ui_text(prop, "Items Expanded", "Expanded in the user interface");
 	RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
 	
-	prop= RNA_def_property(srna, "show_expanded_children", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "show_expanded_children", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_CHILDREN_EXPANDED);
 	RNA_def_property_ui_text(prop, "Children Expanded", "Children expanded in the user interface");
 	RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
@@ -1703,122 +1755,125 @@ static void rna_def_keyconfig(BlenderRNA *brna)
 	RNA_api_keymap(srna);
 
 	/* KeyMapItem */
-	srna= RNA_def_struct(brna, "KeyMapItem", NULL);
+	srna = RNA_def_struct(brna, "KeyMapItem", NULL);
 	RNA_def_struct_sdna(srna, "wmKeyMapItem");
 	RNA_def_struct_ui_text(srna, "Key Map Item", "Item in a Key Map");
 
-	prop= RNA_def_property(srna, "idname", PROP_STRING, PROP_NONE);
+	prop = RNA_def_property(srna, "idname", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_sdna(prop, NULL, "idname");
 	RNA_def_property_ui_text(prop, "Identifier", "Identifier of operator to call on input event");
-	RNA_def_property_string_funcs(prop, "rna_wmKeyMapItem_idname_get", "rna_wmKeyMapItem_idname_length", "rna_wmKeyMapItem_idname_set");
+	RNA_def_property_string_funcs(prop, "rna_wmKeyMapItem_idname_get", "rna_wmKeyMapItem_idname_length",
+	                              "rna_wmKeyMapItem_idname_set");
 	RNA_def_struct_name_property(srna, prop);
 	RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
 
 	/* this is infact the operator name, but if the operator can't be found we
 	 * fallback on the operator ID */
-	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_ui_text(prop, "Name", "Name of operator to call on input event");
 	RNA_def_property_string_funcs(prop, "rna_wmKeyMapItem_name_get", "rna_wmKeyMapItem_name_length", NULL);
 	
-	prop= RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "OperatorProperties");
 	RNA_def_property_pointer_funcs(prop, "rna_KeyMapItem_properties_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Properties", "Properties to set when the operator is called");
 	RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
 
-	prop= RNA_def_property(srna, "map_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "map_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "maptype");
 	RNA_def_property_enum_items(prop, map_type_items);
 	RNA_def_property_enum_funcs(prop, "rna_wmKeyMapItem_map_type_get", "rna_wmKeyMapItem_map_type_set", NULL);
 	RNA_def_property_ui_text(prop, "Map Type", "Type of event mapping");
 	RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
 
-	prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "type");
 	RNA_def_property_enum_items(prop, event_type_items);
 	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_type_itemf");
 	RNA_def_property_ui_text(prop, "Type", "Type of event");
 	RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
 
-	prop= RNA_def_property(srna, "value", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "value", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "val");
 	RNA_def_property_enum_items(prop, event_value_items);
 	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_value_itemf");
 	RNA_def_property_ui_text(prop, "Value", "");
 	RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
 
-	prop= RNA_def_property(srna, "id", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "id", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "id");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "ID", "ID of the item");
 	RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
 
-	prop= RNA_def_property(srna, "any", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "any", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_any_getf", "rna_KeyMapItem_any_setf");
 	RNA_def_property_ui_text(prop, "Any", "Any modifier keys pressed");
 	RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
 
-	prop= RNA_def_property(srna, "shift", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "shift", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "shift", 0);
-//	RNA_def_property_enum_sdna(prop, NULL, "shift");
-//	RNA_def_property_enum_items(prop, keymap_modifiers_items);
+/*	RNA_def_property_enum_sdna(prop, NULL, "shift"); */
+/*	RNA_def_property_enum_items(prop, keymap_modifiers_items); */
 	RNA_def_property_ui_text(prop, "Shift", "Shift key pressed");
 	RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
 
-	prop= RNA_def_property(srna, "ctrl", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "ctrl", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "ctrl", 0);
-//	RNA_def_property_enum_sdna(prop, NULL, "ctrl");
-//	RNA_def_property_enum_items(prop, keymap_modifiers_items);
+/*	RNA_def_property_enum_sdna(prop, NULL, "ctrl"); */
+/*	RNA_def_property_enum_items(prop, keymap_modifiers_items); */
 	RNA_def_property_ui_text(prop, "Ctrl", "Control key pressed");
 	RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
 
-	prop= RNA_def_property(srna, "alt", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "alt", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "alt", 0);
-//	RNA_def_property_enum_sdna(prop, NULL, "alt");
-//	RNA_def_property_enum_items(prop, keymap_modifiers_items);
+/*	RNA_def_property_enum_sdna(prop, NULL, "alt"); */
+/*	RNA_def_property_enum_items(prop, keymap_modifiers_items); */
 	RNA_def_property_ui_text(prop, "Alt", "Alt key pressed");
 	RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
 
-	prop= RNA_def_property(srna, "oskey", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "oskey", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "oskey", 0);
-//	RNA_def_property_enum_sdna(prop, NULL, "oskey");
-//	RNA_def_property_enum_items(prop, keymap_modifiers_items);
+/*	RNA_def_property_enum_sdna(prop, NULL, "oskey"); */
+/*	RNA_def_property_enum_items(prop, keymap_modifiers_items); */
 	RNA_def_property_ui_text(prop, "OS Key", "Operating system key pressed");
 	RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
 
-	prop= RNA_def_property(srna, "key_modifier", PROP_ENUM, PROP_NONE);
+	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_ui_text(prop, "Key Modifier", "Regular key pressed as a modifier");
 	RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
 
-	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, "flag", KMI_EXPANDED);
 	RNA_def_property_ui_text(prop, "Expanded", "Show key map event and property details in the user interface");
 	RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
+	RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
 
-	prop= RNA_def_property(srna, "propvalue", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "propvalue", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "propvalue");
 	RNA_def_property_enum_items(prop, keymap_propvalue_items);
 	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_propvalue_itemf");
 	RNA_def_property_ui_text(prop, "Property Value", "The value this event translates to in a modal keymap");
 	RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
 
-	prop= RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", KMI_INACTIVE);
 	RNA_def_property_ui_text(prop, "Active", "Activate or deactivate item");
 	RNA_def_property_ui_icon(prop, ICON_CHECKBOX_DEHLT, 1);
 	RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
 
-	prop= RNA_def_property(srna, "is_user_modified", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_user_modified", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", KMI_USER_MODIFIED);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "User Modified", "Is this keymap item modified by the user");
 
-	prop= RNA_def_property(srna, "is_user_defined", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "is_user_defined", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "User Defined", "Is this keymap item user defined (doesn't just replace a builtin item)");
+	RNA_def_property_ui_text(prop, "User Defined",
+	                         "Is this keymap item user defined (doesn't just replace a builtin item)");
 	RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_userdefined_get", NULL);
 
 	RNA_api_keymapitem(srna);
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c
index 35f1211..9b3634b 100644
--- a/source/blender/makesrna/intern/rna_wm_api.c
+++ b/source/blender/makesrna/intern/rna_wm_api.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
@@ -18,7 +18,7 @@
  * The Original Code is Copyright (C) 2009 Blender Foundation.
  * All rights reserved.
  *
- * 
+ *
  * Contributor(s): Blender Foundation
  *
  * ***** END GPL LICENSE BLOCK *****
@@ -59,7 +59,7 @@ static void rna_Operator_report(wmOperator *op, int type, const char *msg)
 	BKE_report(op->reports, type, msg);
 }
 
-/* since event isnt needed... */
+/* since event isn't needed... */
 static void rna_Operator_enum_search_invoke(bContext *C, wmOperator *op)
 {
 	WM_enum_search_invoke(C, op, NULL);
@@ -82,11 +82,12 @@ void rna_event_timer_remove(struct wmWindowManager *wm, wmTimer *timer)
 	WM_event_remove_timer(wm, timer->win, timer);
 }
 
-static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km, ReportList *reports, const char *idname, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier)
+static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km, ReportList *reports, const char *idname, int type, int value,
+                                         int any, int shift, int ctrl, int alt, int oskey, int keymodifier)
 {
-//	wmWindowManager *wm = CTX_wm_manager(C);
+/*	wmWindowManager *wm = CTX_wm_manager(C); */
 	char idname_bl[OP_MAX_TYPENAME];
-	int modifier= 0;
+	int modifier = 0;
 
 	/* only on non-modal maps */
 	if (km->flag & KEYMAP_MODAL) {
@@ -96,19 +97,21 @@ static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km, ReportList *reports, cons
 
 	WM_operator_bl_idname(idname_bl, idname);
 
-	if(shift) modifier |= KM_SHIFT;
-	if(ctrl) modifier |= KM_CTRL;
-	if(alt) modifier |= KM_ALT;
-	if(oskey) modifier |= KM_OSKEY;
+	if (shift) modifier |= KM_SHIFT;
+	if (ctrl) modifier |= KM_CTRL;
+	if (alt) modifier |= KM_ALT;
+	if (oskey) modifier |= KM_OSKEY;
 
-	if(any) modifier = KM_ANY;
+	if (any) modifier = KM_ANY;
 
 	return WM_keymap_add_item(km, idname_bl, type, value, modifier, keymodifier);
 }
 
-static wmKeyMapItem *rna_KeyMap_item_new_modal(wmKeyMap *km, ReportList *reports, const char *propvalue_str, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier)
+static wmKeyMapItem *rna_KeyMap_item_new_modal(wmKeyMap *km, ReportList *reports, const char *propvalue_str,
+                                               int type, int value, int any, int shift, int ctrl, int alt,
+                                               int oskey, int keymodifier)
 {
-	int modifier= 0;
+	int modifier = 0;
 	int propvalue = 0;
 
 	/* only modal maps */
@@ -117,22 +120,19 @@ static wmKeyMapItem *rna_KeyMap_item_new_modal(wmKeyMap *km, ReportList *reports
 		return NULL;
 	}
 
-	if (!km->modal_items) {
-		BKE_report(reports, RPT_ERROR, "No property values defined");
-		return NULL;
-	}
-
+	if (shift) modifier |= KM_SHIFT;
+	if (ctrl) modifier |= KM_CTRL;
+	if (alt) modifier |= KM_ALT;
+	if (oskey) modifier |= KM_OSKEY;
 
-	if(RNA_enum_value_from_id(km->modal_items, propvalue_str, &propvalue)==0) {
-		BKE_report(reports, RPT_WARNING, "Property value not in enumeration");
-	}
+	if (any) modifier = KM_ANY;
 
-	if(shift) modifier |= KM_SHIFT;
-	if(ctrl) modifier |= KM_CTRL;
-	if(alt) modifier |= KM_ALT;
-	if(oskey) modifier |= KM_OSKEY;
+	/* not initialized yet, do delayed lookup */
+	if (!km->modal_items)
+		return WM_modalkeymap_add_item_str(km, type, value, modifier, keymodifier, propvalue_str);
 
-	if(any) modifier = KM_ANY;
+	if (RNA_enum_value_from_id(km->modal_items, propvalue_str, &propvalue) == 0)
+		BKE_report(reports, RPT_WARNING, "Property value not in enumeration");
 
 	return WM_modalkeymap_add_item(km, type, value, modifier, keymodifier, propvalue);
 }
@@ -141,7 +141,8 @@ static wmKeyMap *rna_keymap_new(wmKeyConfig *keyconf, const char *idname, int sp
 {
 	if (modal == 0) {
 		return WM_keymap_find(keyconf, idname, spaceid, regionid);
-	} else {
+	}
+	else {
 		return WM_modalkeymap_add(keyconf, idname, NULL); /* items will be lazy init */
 	}
 }
@@ -172,21 +173,21 @@ static void rna_generic_op_invoke(FunctionRNA *func, int flag)
 	PropertyRNA *parm;
 
 	RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_USE_CONTEXT);
-	parm= RNA_def_pointer(func, "operator", "Operator", "", "Operator to call");
+	parm = RNA_def_pointer(func, "operator", "Operator", "", "Operator to call");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	if(flag & WM_GEN_INVOKE_EVENT) {
-		parm= RNA_def_pointer(func, "event", "Event", "", "Event");
+	if (flag & WM_GEN_INVOKE_EVENT) {
+		parm = RNA_def_pointer(func, "event", "Event", "", "Event");
 		RNA_def_property_flag(parm, PROP_REQUIRED);
 	}
 
-	if(flag & WM_GEN_INVOKE_SIZE) {
+	if (flag & WM_GEN_INVOKE_SIZE) {
 		RNA_def_int(func, "width", 300, 0, INT_MAX, "", "Width of the popup", 0, INT_MAX);
 		RNA_def_int(func, "height", 20, 0, INT_MAX, "", "Height of the popup", 0, INT_MAX);
 	}
 
-	if(flag & WM_GEN_INVOKE_RETURN) {
-		parm= RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", "");
+	if (flag & WM_GEN_INVOKE_RETURN) {
+		parm = RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", "");
 		RNA_def_function_return(func, parm);
 	}
 }
@@ -196,54 +197,54 @@ void RNA_api_wm(StructRNA *srna)
 	FunctionRNA *func;
 	PropertyRNA *parm;
 
-	func= RNA_def_function(srna, "fileselect_add", "WM_event_add_fileselect");
+	func = RNA_def_function(srna, "fileselect_add", "WM_event_add_fileselect");
 	RNA_def_function_ui_description(func, "Opens a file selector with an operator. "
-	                                "The string properties 'filepath', 'filename', 'directory' and a 'files' collection "
-	                                "are assigned when present in the operator");
+	                                "The string properties 'filepath', 'filename', 'directory' and a 'files' "
+	                                "collection are assigned when present in the operator");
 	rna_generic_op_invoke(func, 0);
 
-	func= RNA_def_function(srna, "modal_handler_add", "rna_event_modal_handler_add");
+	func = RNA_def_function(srna, "modal_handler_add", "rna_event_modal_handler_add");
 	RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_USE_CONTEXT);
-	parm= RNA_def_pointer(func, "operator", "Operator", "", "Operator to call");
+	parm = RNA_def_pointer(func, "operator", "Operator", "", "Operator to call");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_function_return(func, RNA_def_boolean(func, "handle", 1, "", ""));
 
 
-	func= RNA_def_function(srna, "event_timer_add", "rna_event_timer_add");
-	parm= RNA_def_property(func, "time_step", PROP_FLOAT, PROP_NONE);
+	func = RNA_def_function(srna, "event_timer_add", "rna_event_timer_add");
+	parm = RNA_def_property(func, "time_step", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_property_range(parm, 0.0, FLT_MAX);
 	RNA_def_property_ui_text(parm, "Time Step", "Interval in seconds between timer events");
 	RNA_def_pointer(func, "window", "Window", "", "Window to attach the timer to or None");
-	parm= RNA_def_pointer(func, "result", "Timer", "", "");
+	parm = RNA_def_pointer(func, "result", "Timer", "", "");
 	RNA_def_function_return(func, parm);
 
 
-	func= RNA_def_function(srna, "event_timer_remove", "rna_event_timer_remove");
-	parm= RNA_def_pointer(func, "timer", "Timer", "", "");
+	func = RNA_def_function(srna, "event_timer_remove", "rna_event_timer_remove");
+	parm = RNA_def_pointer(func, "timer", "Timer", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
 
 	/* invoke functions, for use with python */
-	func= RNA_def_function(srna, "invoke_props_popup", "WM_operator_props_popup");
+	func = RNA_def_function(srna, "invoke_props_popup", "WM_operator_props_popup");
 	RNA_def_function_ui_description(func, "Operator popup invoke");
 	rna_generic_op_invoke(func, WM_GEN_INVOKE_EVENT|WM_GEN_INVOKE_RETURN);
 
 	/* invoked dialog opens popup with OK button, does not auto-exec operator. */
-	func= RNA_def_function(srna, "invoke_props_dialog", "WM_operator_props_dialog_popup");
+	func = RNA_def_function(srna, "invoke_props_dialog", "WM_operator_props_dialog_popup");
 	RNA_def_function_ui_description(func, "Operator dialog (non-autoexec popup) invoke");
 	rna_generic_op_invoke(func, WM_GEN_INVOKE_SIZE|WM_GEN_INVOKE_RETURN);
 
 	/* invoke enum */
-	func= RNA_def_function(srna, "invoke_search_popup", "rna_Operator_enum_search_invoke");
+	func = RNA_def_function(srna, "invoke_search_popup", "rna_Operator_enum_search_invoke");
 	rna_generic_op_invoke(func, 0);
 
 	/* invoke functions, for use with python */
-	func= RNA_def_function(srna, "invoke_popup", "WM_operator_ui_popup");
+	func = RNA_def_function(srna, "invoke_popup", "WM_operator_ui_popup");
 	RNA_def_function_ui_description(func, "Operator popup invoke");
 	rna_generic_op_invoke(func, WM_GEN_INVOKE_SIZE|WM_GEN_INVOKE_RETURN);
 
-	func= RNA_def_function(srna, "invoke_confirm", "WM_operator_confirm");
+	func = RNA_def_function(srna, "invoke_confirm", "WM_operator_confirm");
 	RNA_def_function_ui_description(func, "Operator confirmation");
 	rna_generic_op_invoke(func, WM_GEN_INVOKE_EVENT|WM_GEN_INVOKE_RETURN);
 	
@@ -255,81 +256,85 @@ void RNA_api_operator(StructRNA *srna)
 	PropertyRNA *parm;
 
 	/* utility, not for registering */
-	func= RNA_def_function(srna, "report", "rna_Operator_report");
-	parm= RNA_def_enum_flag(func, "type", wm_report_items, 0, "Type", "");
+	func = RNA_def_function(srna, "report", "rna_Operator_report");
+	parm = RNA_def_enum_flag(func, "type", wm_report_items, 0, "Type", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_string(func, "message", "", 0, "Report Message", "");
+	parm = RNA_def_string(func, "message", "", 0, "Report Message", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
 
 	/* Registration */
 
 	/* poll */
-	func= RNA_def_function(srna, "poll", NULL);
+	func = RNA_def_function(srna, "poll", NULL);
 	RNA_def_function_ui_description(func, "Test if the operator can be called or not");
 	RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_REGISTER_OPTIONAL);
 	RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
-	parm= RNA_def_pointer(func, "context", "Context", "", "");
+	parm = RNA_def_pointer(func, "context", "Context", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
 	/* exec */
-	func= RNA_def_function(srna, "execute", NULL);
+	func = RNA_def_function(srna, "execute", NULL);
 	RNA_def_function_ui_description(func, "Execute the operator");
 	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
-	parm= RNA_def_pointer(func, "context", "Context", "", "");
+	parm = RNA_def_pointer(func, "context", "Context", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	parm= RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", ""); // better name?
+		/* better name? */
+	parm = RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", "");
 	RNA_def_function_return(func, parm);
 
 	/* check */
-	func= RNA_def_function(srna, "check", NULL);
+	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);
-	parm= RNA_def_pointer(func, "context", "Context", "", "");
+	parm = RNA_def_pointer(func, "context", "Context", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	parm= RNA_def_boolean(func, "result", 0, "result", ""); // better name?
+	parm = RNA_def_boolean(func, "result", 0, "result", ""); /* better name? */
 	RNA_def_function_return(func, parm);
 	
 	/* invoke */
-	func= RNA_def_function(srna, "invoke", NULL);
+	func = RNA_def_function(srna, "invoke", NULL);
 	RNA_def_function_ui_description(func, "Invoke the operator");
 	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
-	parm= RNA_def_pointer(func, "context", "Context", "", "");
+	parm = RNA_def_pointer(func, "context", "Context", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
-	parm= RNA_def_pointer(func, "event", "Event", "", "");
+	parm = RNA_def_pointer(func, "event", "Event", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	parm= RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", ""); // better name?
+		/* better name? */
+	parm = RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", "");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "modal", NULL); /* same as invoke */
+	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);
-	parm= RNA_def_pointer(func, "context", "Context", "", "");
+	parm = RNA_def_pointer(func, "context", "Context", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
-	parm= RNA_def_pointer(func, "event", "Event", "", "");
+	parm = RNA_def_pointer(func, "event", "Event", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	parm= RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", ""); // better name?
+		/* better name? */
+	parm = RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", "");
 	RNA_def_function_return(func, parm);
 
 	/* draw */
-	func= RNA_def_function(srna, "draw", NULL);
+	func = RNA_def_function(srna, "draw", NULL);
 	RNA_def_function_ui_description(func, "Draw function for the operator");
 	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
-	parm= RNA_def_pointer(func, "context", "Context", "", "");
+	parm = RNA_def_pointer(func, "context", "Context", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
 	/* cancel */
-	func= RNA_def_function(srna, "cancel", NULL);
-	RNA_def_function_ui_description(func, "Called when the operator is cancelled");
+	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);
-	parm= RNA_def_pointer(func, "context", "Context", "", "");
+	parm = RNA_def_pointer(func, "context", "Context", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
-	parm= RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", ""); // better name?
+		/* better name? */
+	parm = RNA_def_enum_flag(func, "result", operator_return_items, OPERATOR_CANCELLED, "result", "");
 	RNA_def_function_return(func, parm);
 }
 
@@ -339,35 +344,35 @@ void RNA_api_macro(StructRNA *srna)
 	PropertyRNA *parm;
 
 	/* utility, not for registering */
-	func= RNA_def_function(srna, "report", "rna_Operator_report");
-	parm= RNA_def_enum_flag(func, "type", wm_report_items, 0, "Type", "");
+	func = RNA_def_function(srna, "report", "rna_Operator_report");
+	parm = RNA_def_enum_flag(func, "type", wm_report_items, 0, "Type", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_string(func, "message", "", 0, "Report Message", "");
+	parm = RNA_def_string(func, "message", "", 0, "Report Message", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
 
 	/* Registration */
 
 	/* poll */
-	func= RNA_def_function(srna, "poll", NULL);
+	func = RNA_def_function(srna, "poll", NULL);
 	RNA_def_function_ui_description(func, "Test if the operator can be called or not");
 	RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_REGISTER_OPTIONAL);
 	RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
-	parm= RNA_def_pointer(func, "context", "Context", "", "");
+	parm = RNA_def_pointer(func, "context", "Context", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 
 	/* draw */
-	func= RNA_def_function(srna, "draw", NULL);
+	func = RNA_def_function(srna, "draw", NULL);
 	RNA_def_function_ui_description(func, "Draw function for the operator");
 	RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
-	parm= RNA_def_pointer(func, "context", "Context", "", "");
+	parm = RNA_def_pointer(func, "context", "Context", "", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 }
 
 void RNA_api_keyconfig(StructRNA *srna)
 {
-	// FunctionRNA *func;
-	// PropertyRNA *parm;
+	/* FunctionRNA *func; */
+	/* PropertyRNA *parm; */
 }
 
 void RNA_api_keymap(StructRNA *srna)
@@ -375,17 +380,17 @@ void RNA_api_keymap(StructRNA *srna)
 	FunctionRNA *func;
 	PropertyRNA *parm;
 
-	func= RNA_def_function(srna, "active", "rna_keymap_active");
+	func = RNA_def_function(srna, "active", "rna_keymap_active");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
-	parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Active key map");
+	parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Active key map");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "restore_to_default", "WM_keymap_restore_to_default");
+	func = RNA_def_function(srna, "restore_to_default", "WM_keymap_restore_to_default");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
 
-	func= RNA_def_function(srna, "restore_item_to_default", "rna_keymap_restore_item_to_default");
+	func = RNA_def_function(srna, "restore_item_to_default", "rna_keymap_restore_item_to_default");
 	RNA_def_function_flag(func, FUNC_USE_CONTEXT);
-	parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
+	parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
 }
 
@@ -394,10 +399,10 @@ void RNA_api_keymapitem(StructRNA *srna)
 	FunctionRNA *func;
 	PropertyRNA *parm;
 
-	func= RNA_def_function(srna, "compare", "WM_keymap_item_compare");
-	parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
+	func = RNA_def_function(srna, "compare", "WM_keymap_item_compare");
+	parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_boolean(func, "result", 0, "Comparison result", "");
+	parm = RNA_def_boolean(func, "result", 0, "Comparison result", "");
 	RNA_def_function_return(func, parm);
 }
 
@@ -406,13 +411,13 @@ void RNA_api_keymapitems(StructRNA *srna)
 	FunctionRNA *func;
 	PropertyRNA *parm;
 
-	func= RNA_def_function(srna, "new", "rna_KeyMap_item_new");
+	func = RNA_def_function(srna, "new", "rna_KeyMap_item_new");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
-	parm= RNA_def_string(func, "idname", "", 0, "Operator Identifier", "");
+	parm = RNA_def_string(func, "idname", "", 0, "Operator Identifier", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_enum(func, "type", event_type_items, 0, "Type", "");
+	parm = RNA_def_enum(func, "type", event_type_items, 0, "Type", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_enum(func, "value", event_value_items, 0, "Value", "");
+	parm = RNA_def_enum(func, "value", event_value_items, 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_boolean(func, "any", 0, "Any", "");
 	RNA_def_boolean(func, "shift", 0, "Shift", "");
@@ -420,16 +425,16 @@ void RNA_api_keymapitems(StructRNA *srna)
 	RNA_def_boolean(func, "alt", 0, "Alt", "");
 	RNA_def_boolean(func, "oskey", 0, "OS Key", "");
 	RNA_def_enum(func, "key_modifier", event_type_items, 0, "Key Modifier", "");
-	parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item");
+	parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "new_modal", "rna_KeyMap_item_new_modal");
+	func = RNA_def_function(srna, "new_modal", "rna_KeyMap_item_new_modal");
 	RNA_def_function_flag(func, FUNC_USE_REPORTS);
-	parm= RNA_def_string(func, "propvalue", "", 0, "Property Value", "");
+	parm = RNA_def_string(func, "propvalue", "", 0, "Property Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_enum(func, "type", event_type_items, 0, "Type", "");
+	parm = RNA_def_enum(func, "type", event_type_items, 0, "Type", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_enum(func, "value", event_value_items, 0, "Value", "");
+	parm = RNA_def_enum(func, "value", event_value_items, 0, "Value", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_boolean(func, "any", 0, "Any", "");
 	RNA_def_boolean(func, "shift", 0, "Shift", "");
@@ -437,18 +442,18 @@ void RNA_api_keymapitems(StructRNA *srna)
 	RNA_def_boolean(func, "alt", 0, "Alt", "");
 	RNA_def_boolean(func, "oskey", 0, "OS Key", "");
 	RNA_def_enum(func, "key_modifier", event_type_items, 0, "Key Modifier", "");
-	parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item");
+	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");
-	parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
+	func = RNA_def_function(srna, "remove", "WM_keymap_remove_item");
+	parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 
-	func= RNA_def_function(srna, "from_id", "WM_keymap_item_find_id");
-	parm= RNA_def_property(func, "id", PROP_INT, PROP_NONE);
+	func = RNA_def_function(srna, "from_id", "WM_keymap_item_find_id");
+	parm = RNA_def_property(func, "id", PROP_INT, PROP_NONE);
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_property_ui_text(parm, "id", "ID of the item");
-	parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
+	parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
 	RNA_def_function_return(func, parm);
 }
 
@@ -457,27 +462,27 @@ void RNA_api_keymaps(StructRNA *srna)
 	FunctionRNA *func;
 	PropertyRNA *parm;
 
-	func= RNA_def_function(srna, "new", "rna_keymap_new"); // add_keymap
-	parm= RNA_def_string(func, "name", "", 0, "Name", "");
+	func = RNA_def_function(srna, "new", "rna_keymap_new"); /* add_keymap */
+	parm = RNA_def_string(func, "name", "", 0, "Name", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_enum(func, "space_type", space_type_items, SPACE_EMPTY, "Space Type", "");
 	RNA_def_enum(func, "region_type", region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
 	RNA_def_boolean(func, "modal", 0, "Modal", "");
-	parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Added key map");
+	parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Added key map");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "find", "rna_keymap_find"); // find_keymap
-	parm= RNA_def_string(func, "name", "", 0, "Name", "");
+	func = RNA_def_function(srna, "find", "rna_keymap_find"); /* find_keymap */
+	parm = RNA_def_string(func, "name", "", 0, "Name", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 	RNA_def_enum(func, "space_type", space_type_items, SPACE_EMPTY, "Space Type", "");
 	RNA_def_enum(func, "region_type", region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
-	parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map");
+	parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map");
 	RNA_def_function_return(func, parm);
 
-	func= RNA_def_function(srna, "find_modal", "rna_keymap_find_modal"); // find_keymap_modal
-	parm= RNA_def_string(func, "name", "", 0, "Operator Name", "");
+	func = RNA_def_function(srna, "find_modal", "rna_keymap_find_modal"); /* find_keymap_modal */
+	parm = RNA_def_string(func, "name", "", 0, "Operator Name", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map");
+	parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map");
 	RNA_def_function_return(func, parm);
 }
 
@@ -486,14 +491,14 @@ void RNA_api_keyconfigs(StructRNA *srna)
 	FunctionRNA *func;
 	PropertyRNA *parm;
 
-	func= RNA_def_function(srna, "new", "WM_keyconfig_new_user"); // add_keyconfig
-	parm= RNA_def_string(func, "name", "", 0, "Name", "");
+	func = RNA_def_function(srna, "new", "WM_keyconfig_new_user"); /* add_keyconfig */
+	parm = RNA_def_string(func, "name", "", 0, "Name", "");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
-	parm= RNA_def_pointer(func, "keyconfig", "KeyConfig", "Key Configuration", "Added key configuration");
+	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
-	parm= RNA_def_pointer(func, "keyconfig", "KeyConfig", "Key Configuration", "Removed key configuration");
+	func = RNA_def_function(srna, "remove", "WM_keyconfig_remove"); /* remove_keyconfig */
+	parm = RNA_def_pointer(func, "keyconfig", "KeyConfig", "Key Configuration", "Removed key configuration");
 	RNA_def_property_flag(parm, PROP_REQUIRED);
 }
 
diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c
index 087716a..9bc1fa2 100644
--- a/source/blender/makesrna/intern/rna_world.c
+++ b/source/blender/makesrna/intern/rna_world.c
@@ -67,29 +67,29 @@ static PointerRNA rna_World_mist_get(PointerRNA *ptr)
 
 static void rna_World_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-	World *wo= (World*)ptr->data;
+	World *wo = (World*)ptr->data;
 	rna_iterator_array_begin(iter, (void*)wo->mtex, sizeof(MTex*), MAX_MTEX, 0, NULL);
 }
 
 static PointerRNA rna_World_active_texture_get(PointerRNA *ptr)
 {
-	World *wo= (World*)ptr->data;
+	World *wo = (World*)ptr->data;
 	Tex *tex;
 
-	tex= give_current_world_texture(wo);
+	tex = give_current_world_texture(wo);
 	return rna_pointer_inherit_refine(ptr, &RNA_Texture, tex);
 }
 
 static void rna_World_active_texture_set(PointerRNA *ptr, PointerRNA value)
 {
-	World *wo= (World*)ptr->data;
+	World *wo = (World*)ptr->data;
 
 	set_current_world_texture(wo, value.data);
 }
 
 static void rna_World_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	World *wo= ptr->id.data;
+	World *wo = ptr->id.data;
 
 	DAG_id_tag_update(&wo->id, 0);
 	WM_main_add_notifier(NC_WORLD, wo);
@@ -97,7 +97,7 @@ static void rna_World_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerR
 
 static void rna_World_draw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	World *wo= ptr->id.data;
+	World *wo = ptr->id.data;
 
 	DAG_id_tag_update(&wo->id, 0);
 	WM_main_add_notifier(NC_WORLD|ND_WORLD_DRAW, wo);
@@ -106,7 +106,7 @@ static void rna_World_draw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Poi
 /* so camera mist limits redraw */
 static void rna_World_draw_mist_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	World *wo= ptr->id.data;
+	World *wo = ptr->id.data;
 
 	DAG_id_tag_update(&wo->id, 0);
 	WM_main_add_notifier(NC_WORLD|ND_WORLD_DRAW, wo);
@@ -115,7 +115,7 @@ static void rna_World_draw_mist_update(Main *UNUSED(bmain), Scene *UNUSED(scene)
 
 static void rna_World_stars_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
-	World *wo= ptr->id.data;
+	World *wo = ptr->id.data;
 
 	DAG_id_tag_update(&wo->id, 0);
 	WM_main_add_notifier(NC_WORLD|ND_WORLD_STARS, wo);
@@ -123,9 +123,9 @@ static void rna_World_stars_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Po
 
 static void rna_World_use_nodes_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-	World *wrld= (World*)ptr->data;
+	World *wrld = (World*)ptr->data;
 
-	if(wrld->use_nodes && wrld->nodetree==NULL)
+	if (wrld->use_nodes && wrld->nodetree == NULL)
 		ED_node_shader_default(scene, &wrld->id);
 	
 	rna_World_update(bmain, scene, ptr);
@@ -148,63 +148,64 @@ static void rna_def_world_mtex(BlenderRNA *brna)
 		{TEXCO_OBJECT, "OBJECT", 0, "Object", "Use linked object's coordinates for texture coordinates"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "WorldTextureSlot", "TextureSlot");
+	srna = RNA_def_struct(brna, "WorldTextureSlot", "TextureSlot");
 	RNA_def_struct_sdna(srna, "MTex");
 	RNA_def_struct_ui_text(srna, "World Texture Slot", "Texture slot for textures in a World datablock");
 
 	/* map to */
-	prop= RNA_def_property(srna, "use_map_blend", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_blend", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", WOMAP_BLEND);
 	RNA_def_property_ui_text(prop, "Blend", "Affect the color progression of the background");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "use_map_horizon", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_horizon", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", WOMAP_HORIZ);
 	RNA_def_property_ui_text(prop, "Horizon", "Affect the color of the horizon");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "use_map_zenith_up", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_zenith_up", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", WOMAP_ZENUP);
 	RNA_def_property_ui_text(prop, "Zenith Up", "Affect the color of the zenith above");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "use_map_zenith_down", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_map_zenith_down", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mapto", WOMAP_ZENDOWN);
 	RNA_def_property_ui_text(prop, "Zenith Down", "Affect the color of the zenith below");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "texco");
 	RNA_def_property_enum_items(prop, texco_items);
-	RNA_def_property_ui_text(prop, "Texture Coordinates", "Texture coordinates used to map the texture onto the background");
+	RNA_def_property_ui_text(prop, "Texture Coordinates",
+	                         "Texture coordinates used to map the texture onto the background");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "object");
 	RNA_def_property_struct_type(prop, "Object");
 	RNA_def_property_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Object", "Object to use for mapping with Object texture coordinates");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "blend_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "blend_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "blendfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Blend Factor", "Amount texture affects color progression of the background");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "horizon_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "horizon_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "colfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Horizon Factor", "Amount texture affects color of the horizon");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "zenith_up_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "zenith_up_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "zenupfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Zenith Up Factor", "Amount texture affects color of the zenith above");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "zenith_down_factor", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "zenith_down_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "zendownfac");
 	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Zenith Down Factor", "Amount texture affects color of the zenith below");
@@ -238,138 +239,150 @@ static void rna_def_lighting(BlenderRNA *brna)
 		{WO_AOGATHER_APPROX, "APPROXIMATE", 0, "Approximate", "Inaccurate, but faster and without noise"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "WorldLighting", NULL);
+	srna = RNA_def_struct(brna, "WorldLighting", NULL);
 	RNA_def_struct_sdna(srna, "World");
 	RNA_def_struct_nested(brna, srna, "World");
 	RNA_def_struct_ui_text(srna, "Lighting", "Lighting for a World datablock");
 
 	/* ambient occlusion */
-	prop= RNA_def_property(srna, "use_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_AMB_OCC);
-	RNA_def_property_ui_text(prop, "Use Ambient Occlusion", "Use Ambient Occlusion to add shadowing based on distance between objects");
+	RNA_def_property_ui_text(prop, "Use Ambient Occlusion",
+	                         "Use Ambient Occlusion to add shadowing based on distance between objects");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "ao_factor", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "ao_factor", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "aoenergy");
 	RNA_def_property_range(prop, 0, INT_MAX);
 	RNA_def_property_ui_range(prop, 0, 1, 0.1, 2);
 	RNA_def_property_ui_text(prop, "Factor", "Factor for ambient occlusion blending");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "ao_blend_type", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "ao_blend_type", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "aomix");
 	RNA_def_property_enum_items(prop, blend_mode_items);
 	RNA_def_property_ui_text(prop, "Blend Mode", "Defines how AO mixes with material shading");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
 	/* environment lighting */
-	prop= RNA_def_property(srna, "use_environment_light", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_environment_light", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_ENV_LIGHT);
 	RNA_def_property_ui_text(prop, "Use Environment Lighting", "Add light coming from the environment");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "environment_energy", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "environment_energy", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "ao_env_energy");
 	RNA_def_property_ui_range(prop, 0, FLT_MAX, 1, 3);
 	RNA_def_property_ui_text(prop, "Environment Color", "Defines the strength of environment light");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "environment_color", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "environment_color", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "aocolor");
 	RNA_def_property_enum_items(prop, prop_color_items);
 	RNA_def_property_ui_text(prop, "Environment Color", "Defines where the color of the environment light comes from");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
 	/* indirect lighting */
-	prop= RNA_def_property(srna, "use_indirect_light", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_indirect_light", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_INDIRECT_LIGHT);
 	RNA_def_property_ui_text(prop, "Use Indirect Lighting", "Add indirect light bouncing of surrounding objects");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "indirect_factor", PROP_FLOAT, PROP_FACTOR);
+	prop = RNA_def_property(srna, "indirect_factor", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "ao_indirect_energy");
 	RNA_def_property_range(prop, 0, INT_MAX);
 	RNA_def_property_ui_range(prop, 0, 1, 0.1, 2);
 	RNA_def_property_ui_text(prop, "Indirect Factor", "Factor for how much surrounding objects contribute to light");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "indirect_bounces", PROP_INT, PROP_UNSIGNED);
+	prop = RNA_def_property(srna, "indirect_bounces", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "ao_indirect_bounces");
 	RNA_def_property_range(prop, 1, SHRT_MAX);
 	RNA_def_property_ui_text(prop, "Bounces", "Number of indirect diffuse light bounces");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
 	/* gathering parameters */
-	prop= RNA_def_property(srna, "gather_method", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "gather_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "ao_gather_method");
 	RNA_def_property_enum_items(prop, prop_gather_method_items);
 	RNA_def_property_ui_text(prop, "Gather Method", "");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "passes", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "passes", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "ao_approx_passes");
 	RNA_def_property_range(prop, 0, 10);
 	RNA_def_property_ui_text(prop, "Passes", "Number of preprocessing passes to reduce overocclusion");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "aodist");
-	RNA_def_property_ui_text(prop, "Distance", "Length of rays, defines how far away other faces give occlusion effect");
+	RNA_def_property_ui_text(prop, "Distance",
+	                         "Length of rays, defines how far away other faces give occlusion effect");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "falloff_strength", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "falloff_strength", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "aodistfac");
-	RNA_def_property_ui_text(prop, "Strength", "Attenuation falloff strength, the higher, the less influence distant objects have");
+	RNA_def_property_ui_text(prop, "Strength",
+	                         "Attenuation falloff strength, the higher, the less influence distant objects have");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "bias", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "bias", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "aobias");
 	RNA_def_property_range(prop, 0, 0.5);
-	RNA_def_property_ui_text(prop, "Bias", "Bias (in radians) to prevent smoothed faces from showing banding (for Raytrace Constant Jittered)");
+	RNA_def_property_ui_text(prop, "Bias",
+	                         "Bias (in radians) to prevent smoothed faces from showing banding "
+	                         "(for Raytrace Constant Jittered)");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "ao_adapt_thresh");
 	RNA_def_property_range(prop, 0, 1);
-	RNA_def_property_ui_text(prop, "Threshold", "Samples below this threshold will be considered fully shadowed/unshadowed and skipped (for Raytrace Adaptive QMC)");
+	RNA_def_property_ui_text(prop, "Threshold",
+	                         "Samples below this threshold will be considered fully shadowed/unshadowed and skipped "
+	                         "(for Raytrace Adaptive QMC)");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "adapt_to_speed", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "adapt_to_speed", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "ao_adapt_speed_fac");
 	RNA_def_property_range(prop, 0, 1);
-	RNA_def_property_ui_text(prop, "Adapt To Speed", "Use the speed vector pass to reduce AO samples in fast moving pixels. Higher values result in more aggressive sample reduction. Requires Vec pass enabled (for Raytrace Adaptive QMC)");
+	RNA_def_property_ui_text(prop, "Adapt To Speed",
+	                         "Use the speed vector pass to reduce AO samples in fast moving pixels - "
+	                         "higher values result in more aggressive sample reduction "
+	                         "(requires Vec pass enabled, for Raytrace Adaptive QMC)");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "error_threshold", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "error_threshold", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "ao_approx_error");
 	RNA_def_property_range(prop, 0.0001, 10);
 	RNA_def_property_ui_text(prop, "Error Tolerance", "Low values are slower and higher quality");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "correction", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "correction", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "ao_approx_correction");
 	RNA_def_property_range(prop, 0, 1);
 	RNA_def_property_ui_range(prop, 0, 1, 0.1, 2);
 	RNA_def_property_ui_text(prop, "Correction", "Ad-hoc correction for over-occlusion due to the approximation");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "use_falloff", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_falloff", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "aomode", WO_AODIST);
 	RNA_def_property_ui_text(prop, "Falloff", "Distance will be used to attenuate shadows");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "use_cache", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_cache", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "aomode", WO_AOCACHE);
-	RNA_def_property_ui_text(prop, "Pixel Cache", "Cache AO results in pixels and interpolate over neighbouring pixels for speedup");
+	RNA_def_property_ui_text(prop, "Pixel Cache",
+	                         "Cache AO results in pixels and interpolate over neighboring pixels for speedup");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
+	prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "aosamp");
 	RNA_def_property_range(prop, 1, 128);
-	RNA_def_property_ui_text(prop, "Samples", "Amount of ray samples. Higher values give smoother results and longer rendering times");
+	RNA_def_property_ui_text(prop, "Samples",
+	                         "Amount of ray samples. Higher values give smoother results and longer rendering times");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "sample_method", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "sample_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "ao_samp_method");
 	RNA_def_property_enum_items(prop, prop_sample_method_items);
 	RNA_def_property_ui_text(prop, "Sample Method", "Method for generating shadow samples (for Raytrace)");
@@ -387,43 +400,43 @@ static void rna_def_world_mist(BlenderRNA *brna)
 		{2, "INVERSE_QUADRATIC", 0, "Inverse Quadratic", "Use inverse quadratic progression"},
 		{0, NULL, 0, NULL, NULL}};
 
-	srna= RNA_def_struct(brna, "WorldMistSettings", NULL);
+	srna = RNA_def_struct(brna, "WorldMistSettings", NULL);
 	RNA_def_struct_sdna(srna, "World");
 	RNA_def_struct_nested(brna, srna, "World");
 	RNA_def_struct_ui_text(srna, "World Mist", "Mist settings for a World data-block");
 
-	prop= RNA_def_property(srna, "use_mist", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_mist", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_MIST);
 	RNA_def_property_ui_text(prop, "Use Mist", "Occlude objects with the environment color as they are further away");
 	RNA_def_property_update(prop, 0, "rna_World_draw_update");
 
-	prop= RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "misi");
 	RNA_def_property_range(prop, 0, 1);
 	RNA_def_property_ui_text(prop, "Minimum", "Overall minimum intensity of the mist effect");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "start", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "start", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "miststa");
 	RNA_def_property_range(prop, 0, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0, 10000, 10, 2);
 	RNA_def_property_ui_text(prop, "Start", "Starting distance of the mist, measured from the camera");
 	RNA_def_property_update(prop, 0, "rna_World_draw_mist_update");
 
-	prop= RNA_def_property(srna, "depth", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "depth", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "mistdist");
 	RNA_def_property_range(prop, 0, FLT_MAX);
 	RNA_def_property_ui_range(prop, 0, 10000, 10, 2);
 	RNA_def_property_ui_text(prop, "Depth", "Distance over which the mist effect fades in");
 	RNA_def_property_update(prop, 0, "rna_World_draw_mist_update");
 
-	prop= RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "misthi");
 	RNA_def_property_range(prop, 0, 100);
 	RNA_def_property_ui_text(prop, "Height", "Control how much mist density decreases with height");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 	
-	prop= RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
+	prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "mistype");
 	RNA_def_property_enum_items(prop, falloff_items);
 	RNA_def_property_ui_text(prop, "Falloff", "Type of transition used to fade mist");
@@ -435,35 +448,35 @@ static void rna_def_world_stars(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna= RNA_def_struct(brna, "WorldStarsSettings", NULL);
+	srna = RNA_def_struct(brna, "WorldStarsSettings", NULL);
 	RNA_def_struct_sdna(srna, "World");
 	RNA_def_struct_nested(brna, srna, "World");
 	RNA_def_struct_ui_text(srna, "World Stars", "Stars settings for a World data-block");
 
-	prop= RNA_def_property(srna, "use_stars", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_stars", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_STARS);
 	RNA_def_property_ui_text(prop, "Use Stars", "Enable starfield generation");
 	RNA_def_property_update(prop, 0, "rna_World_stars_update");
 
-	prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "starsize");
 	RNA_def_property_range(prop, 0, 10);
 	RNA_def_property_ui_text(prop, "Size", "Average screen dimension of stars");
-	RNA_def_property_update(prop, 0, "rna_World_draw_update"); /* use normal update since this isnt visualized */
+	RNA_def_property_update(prop, 0, "rna_World_draw_update"); /* use normal update since this isn't visualized */
 
-	prop= RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_DISTANCE);
+	prop = RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "starmindist");
 	RNA_def_property_range(prop, 0, 1000);
 	RNA_def_property_ui_text(prop, "Minimum Distance", "Minimum distance to the camera for stars");
 	RNA_def_property_update(prop, 0, "rna_World_stars_update");
 
-	prop= RNA_def_property(srna, "average_separation", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "average_separation", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "stardist");
 	RNA_def_property_range(prop, 2, 1000);
 	RNA_def_property_ui_text(prop, "Average Separation", "Average distance between any two stars");
 	RNA_def_property_update(prop, 0, "rna_World_stars_update");
 
-	prop= RNA_def_property(srna, "color_random", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "color_random", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "starcolnoise");
 	RNA_def_property_range(prop, 0, 1);
 	RNA_def_property_ui_text(prop, "Color Randomization", "Randomize star colors");
@@ -475,19 +488,20 @@ void RNA_def_world(BlenderRNA *brna)
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-/*
+#if 0
 	static EnumPropertyItem physics_engine_items[] = {
 		{WOPHY_NONE, "NONE", 0, "None", ""},
-		//{WOPHY_ENJI, "ENJI", 0, "Enji", ""},
-		//{WOPHY_SUMO, "SUMO", 0, "Sumo (Deprecated)", ""},
-		//{WOPHY_DYNAMO, "DYNAMO", 0, "Dynamo", ""},
-		//{WOPHY_ODE, "ODE", 0, "ODE", ""},
+		/*{WOPHY_ENJI, "ENJI", 0, "Enji", ""}, */
+		/*{WOPHY_SUMO, "SUMO", 0, "Sumo (Deprecated)", ""}, */
+		/*{WOPHY_DYNAMO, "DYNAMO", 0, "Dynamo", ""}, */
+		/*{WOPHY_ODE, "ODE", 0, "ODE", ""}, */
 		{WOPHY_BULLET, "BULLET", 0, "Bullet", ""},
 		{0, NULL, 0, NULL, NULL}};
-*/
+#endif
 
-	srna= RNA_def_struct(brna, "World", "ID");
-	RNA_def_struct_ui_text(srna, "World", "World datablock describing the environment and ambient lighting of a scene");
+	srna = RNA_def_struct(brna, "World", "ID");
+	RNA_def_struct_ui_text(srna, "World",
+	                       "World datablock describing the environment and ambient lighting of a scene");
 	RNA_def_struct_ui_icon(srna, ICON_WORLD_DATA);
 
 	rna_def_animdata_common(srna);
@@ -495,7 +509,7 @@ void RNA_def_world(BlenderRNA *brna)
 		"rna_World_active_texture_set", NULL, "WorldTextureSlot", "WorldTextureSlots", "rna_World_update");
 
 	/* colors */
-	prop= RNA_def_property(srna, "horizon_color", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "horizon_color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "horr");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Horizon Color", "Color at the horizon");
@@ -504,72 +518,72 @@ void RNA_def_world(BlenderRNA *brna)
 	RNA_def_property_update(prop, NC_WORLD|ND_WORLD_DRAW, "rna_World_update");
 
 	
-	prop= RNA_def_property(srna, "zenith_color", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "zenith_color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "zenr");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Zenith Color", "Color at the zenith");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "ambient_color", PROP_FLOAT, PROP_COLOR);
+	prop = RNA_def_property(srna, "ambient_color", PROP_FLOAT, PROP_COLOR);
 	RNA_def_property_float_sdna(prop, NULL, "ambr");
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Ambient Color", "Ambient color of the world");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
 	/* exp, range */
-	prop= RNA_def_property(srna, "exposure", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "exposure", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "exp");
 	RNA_def_property_range(prop, 0.0, 1.0);
 	RNA_def_property_ui_text(prop, "Exposure", "Amount of exponential color correction for light");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "color_range", PROP_FLOAT, PROP_NONE);
+	prop = RNA_def_property(srna, "color_range", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "range");
 	RNA_def_property_range(prop, 0.2, 5.0);
 	RNA_def_property_ui_text(prop, "Range", "The color range that will be mapped to 0-1");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
 	/* sky type */
-	prop= RNA_def_property(srna, "use_sky_blend", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_sky_blend", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "skytype", WO_SKYBLEND);
 	RNA_def_property_ui_text(prop, "Blend Sky", "Render background with natural progression from horizon to zenith");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "use_sky_paper", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_sky_paper", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "skytype", WO_SKYPAPER);
 	RNA_def_property_ui_text(prop, "Paper Sky", "Flatten blend or texture coordinates");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
-	prop= RNA_def_property(srna, "use_sky_real", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_sky_real", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "skytype", WO_SKYREAL);
 	RNA_def_property_ui_text(prop, "Real Sky", "Render background with a real horizon, relative to the camera angle");
 	RNA_def_property_update(prop, 0, "rna_World_update");
 
 	/* nested structs */
-	prop= RNA_def_property(srna, "light_settings", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "light_settings", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "WorldLighting");
 	RNA_def_property_pointer_funcs(prop, "rna_World_lighting_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Lighting", "World lighting settings");
 
-	prop= RNA_def_property(srna, "mist_settings", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "mist_settings", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "WorldMistSettings");
 	RNA_def_property_pointer_funcs(prop, "rna_World_mist_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Mist", "World mist settings");
 
-	prop= RNA_def_property(srna, "star_settings", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "star_settings", PROP_POINTER, PROP_NONE);
 	RNA_def_property_flag(prop, PROP_NEVER_NULL);
 	RNA_def_property_struct_type(prop, "WorldStarsSettings");
 	RNA_def_property_pointer_funcs(prop, "rna_World_stars_get", NULL, NULL, NULL);
 	RNA_def_property_ui_text(prop, "Stars", "World stars settings");
 
 	/* nodes */
-	prop= RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
+	prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
 	RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
 	RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node based worlds");
 
-	prop= RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
+	prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1);
 	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the world");
diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt
index fabaa66..90ae423 100644
--- a/source/blender/modifiers/CMakeLists.txt
+++ b/source/blender/modifiers/CMakeLists.txt
@@ -30,9 +30,11 @@ set(INC
 	../blenkernel
 	../blenkernel/intern
 	../blenlib
+	../blenfont
 	../blenloader
 	../makesdna
 	../makesrna
+	../bmesh
 	../render/extern/include
 	../../../intern/elbeem/extern
 	../../../intern/guardedalloc
@@ -138,6 +140,10 @@ if(WITH_GAMEENGINE)
 	)
 endif()
 
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
 if(WITH_OPENMP)
 	add_definitions(-DPARALLEL=1)
 endif()
diff --git a/source/blender/modifiers/MOD_modifiertypes.h b/source/blender/modifiers/MOD_modifiertypes.h
index fec6545..ea5574a 100644
--- a/source/blender/modifiers/MOD_modifiertypes.h
+++ b/source/blender/modifiers/MOD_modifiertypes.h
@@ -24,8 +24,8 @@
  *  \ingroup modifiers
  */
 
-#ifndef MOD_MODIFIERTYPES_H
-#define MOD_MODIFIERTYPES_H
+#ifndef __MOD_MODIFIERTYPES_H__
+#define __MOD_MODIFIERTYPES_H__
 
 #include "BKE_modifier.h"
 
@@ -78,4 +78,4 @@ extern ModifierTypeInfo modifierType_Remesh;
 /* MOD_util.c */
 void modifier_type_init(ModifierTypeInfo *types[]);
 
-#endif //MOD_MODIFIERTYPES_H
+#endif //__MOD_MODIFIERTYPES_H__
diff --git a/source/blender/modifiers/SConscript b/source/blender/modifiers/SConscript
index 03fcee3..2b506cc 100644
--- a/source/blender/modifiers/SConscript
+++ b/source/blender/modifiers/SConscript
@@ -5,8 +5,8 @@ sources = env.Glob('intern/*.c')
 
 incs = '. ./intern'
 incs += ' #/intern/guardedalloc #/intern/decimation/extern #/intern/bsp/extern #/intern/elbeem/extern #/extern/glew/include'
-incs += ' ../render/extern/include ../blenloader'
-incs += ' ../include ../blenlib ../makesdna ../makesrna ../blenkernel ../blenkernel/intern'
+incs += ' ../render/extern/include ../blenloader ../bmesh'
+incs += ' ../include ../blenlib ../blenfont ../makesdna ../makesrna ../blenkernel ../blenkernel/intern'
 incs += ' ../gpu'
 
 incs += ' ' + env['BF_ZLIB_INC']
@@ -33,6 +33,9 @@ if env['WITH_BF_GAMEENGINE']:
     incs += ' #/extern/recastnavigation'
     defs.append('WITH_GAMEENGINE')
 
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
+
 env.BlenderLib ( libname = 'bf_modifiers', sources = sources,
                  includes = Split(incs), defines=defs,
                  libtype=['core','player'], priority = [80, 40] )
diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c
index 8c8523f..fd97302 100644
--- a/source/blender/modifiers/intern/MOD_armature.c
+++ b/source/blender/modifiers/intern/MOD_armature.c
@@ -129,20 +129,20 @@ static void deformVerts(ModifierData *md, Object *ob,
 		numVerts, amd->deformflag, (float(*)[3])amd->prevCos, amd->defgrp_name);
 
 	/* free cache */
-	if(amd->prevCos) {
+	if (amd->prevCos) {
 		MEM_freeN(amd->prevCos);
 		amd->prevCos= NULL;
 	}
 }
 
 static void deformVertsEM(
-					   ModifierData *md, Object *ob, struct EditMesh *editData,
+					   ModifierData *md, Object *ob, struct BMEditMesh *editData,
 	DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
 {
 	ArmatureModifierData *amd = (ArmatureModifierData*) md;
 	DerivedMesh *dm = derivedData;
 
-	if(!derivedData) dm = CDDM_from_editmesh(editData, ob->data);
+	if (!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
 
 	modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
 
@@ -150,28 +150,28 @@ static void deformVertsEM(
 		numVerts, amd->deformflag, (float(*)[3])amd->prevCos, amd->defgrp_name);
 
 	/* free cache */
-	if(amd->prevCos) {
+	if (amd->prevCos) {
 		MEM_freeN(amd->prevCos);
 		amd->prevCos= NULL;
 	}
 
-	if(!derivedData) dm->release(dm);
+	if (!derivedData) dm->release(dm);
 }
 
 static void deformMatricesEM(
-						  ModifierData *md, Object *ob, struct EditMesh *editData,
+						  ModifierData *md, Object *ob, struct BMEditMesh *editData,
 	   DerivedMesh *derivedData, float (*vertexCos)[3],
 						 float (*defMats)[3][3], int numVerts)
 {
 	ArmatureModifierData *amd = (ArmatureModifierData*) md;
 	DerivedMesh *dm = derivedData;
 
-	if(!derivedData) dm = CDDM_from_editmesh(editData, ob->data);
+	if (!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
 
 	armature_deform_verts(amd->object, ob, dm, vertexCos, defMats, numVerts,
 	                      amd->deformflag, NULL, amd->defgrp_name);
 
-	if(!derivedData) dm->release(dm);
+	if (!derivedData) dm->release(dm);
 }
 
 static void deformMatrices(ModifierData *md, Object *ob, DerivedMesh *derivedData,
@@ -180,12 +180,12 @@ static void deformMatrices(ModifierData *md, Object *ob, DerivedMesh *derivedDat
 	ArmatureModifierData *amd = (ArmatureModifierData*) md;
 	DerivedMesh *dm = derivedData;
 
-	if(!derivedData) dm = CDDM_from_mesh((Mesh*)ob->data, ob);
+	if (!derivedData) dm = CDDM_from_mesh((Mesh*)ob->data, ob);
 
 	armature_deform_verts(amd->object, ob, dm, vertexCos, defMats, numVerts,
 	                      amd->deformflag, NULL, amd->defgrp_name);
 
-	if(!derivedData) dm->release(dm);
+	if (!derivedData) dm->release(dm);
 }
 
 ModifierTypeInfo modifierType_Armature = {
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c
index 4602600..1fe4f92 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -39,33 +39,38 @@
 
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
+#include "BLI_string.h"
 #include "BLI_ghash.h"
 #include "BLI_edgehash.h"
 
 #include "DNA_curve_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_object_types.h"
+#include "DNA_scene_types.h"
 
 #include "BKE_cdderivedmesh.h"
 #include "BKE_displist.h"
 #include "BKE_mesh.h"
 #include "BKE_modifier.h"
 #include "BKE_object.h"
+#include "BKE_tessmesh.h"
 
 #include "depsgraph_private.h"
 
-#include "MOD_util.h"
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
 
 static void initData(ModifierData *md)
 {
 	ArrayModifierData *amd = (ArrayModifierData*) md;
 
 	/* default to 2 duplicates distributed along the x-axis by an
-	offset of 1 object-width
-	*/
+	 * offset of 1 object-width
+	 */
 	amd->start_cap = amd->end_cap = amd->curve_ob = amd->offset_ob = NULL;
 	amd->count = 2;
-	amd->offset[0] = amd->offset[1] = amd->offset[2] = 0;
+	zero_v3(amd->offset);
 	amd->scale[0] = 1;
 	amd->scale[1] = amd->scale[2] = 0;
 	amd->length = 0;
@@ -144,132 +149,197 @@ static float vertarray_size(MVert *mvert, int numVerts, int axis)
 	float min_co, max_co;
 
 	/* if there are no vertices, width is 0 */
-	if(numVerts == 0) return 0;
+	if (numVerts == 0) return 0;
 
 	/* find the minimum and maximum coordinates on the desired axis */
 	min_co = max_co = mvert->co[axis];
 	++mvert;
-	for(i = 1; i < numVerts; ++i, ++mvert) {
-		if(mvert->co[axis] < min_co) min_co = mvert->co[axis];
-		if(mvert->co[axis] > max_co) max_co = mvert->co[axis];
+	for (i = 1; i < numVerts; ++i, ++mvert) {
+		if (mvert->co[axis] < min_co) min_co = mvert->co[axis];
+		if (mvert->co[axis] > max_co) max_co = mvert->co[axis];
 	}
 
 	return max_co - min_co;
 }
 
-/* XXX This function fixes bad merging code, in some cases removing vertices creates indices > maxvert */
-
-static int test_index_face_maxvert(MFace *mface, CustomData *fdata, int mfindex, int nr, int maxvert)
+static int *find_doubles_index_map(BMesh *bm, BMOperator *dupe_op,
+								   const ArrayModifierData *amd,
+								   int *index_map_length)
 {
-	if(mface->v1 >= maxvert) {
-		// printf("bad index in array\n");
-		mface->v1= maxvert - 1;
-	}
-	if(mface->v2 >= maxvert) {
-		// printf("bad index in array\n");
-		mface->v2= maxvert - 1;
+	BMOperator find_op;
+	BMOIter oiter;
+	BMVert *v, *v2;
+	BMElem *ele;
+	int *index_map, i;
+
+	BMO_op_initf(bm, &find_op,
+				 "finddoubles verts=%av dist=%f keepverts=%s",
+				 amd->merge_dist, dupe_op, "geom");
+
+	BMO_op_exec(bm, &find_op);
+			
+	i = 0;
+	BMO_ITER (ele, &oiter, bm, dupe_op, "geom", BM_ALL) {
+		BM_elem_index_set(ele, i); /* set_dirty */
+		i++;
 	}
-	if(mface->v3 >= maxvert) {
-		// printf("bad index in array\n");
-		mface->v3= maxvert - 1;
+
+	BMO_ITER (ele, &oiter, bm, dupe_op, "newout", BM_ALL) {
+		BM_elem_index_set(ele, i); /* set_dirty */
+		i++;
 	}
-	if(mface->v4 >= maxvert) {
-		// printf("bad index in array\n");
-		mface->v4= maxvert - 1;
+	/* above loops over all, so set all to dirty, if this is somehow
+	 * setting valid values, this line can be remvoed - campbell */
+	bm->elem_index_dirty |= BM_VERT | BM_EDGE | BM_FACE;
+
+	(*index_map_length) = i;
+	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) {
+		v2 = BMO_iter_map_value_p(&oiter);
+
+		index_map[BM_elem_index_get(v)] = BM_elem_index_get(v2) + 1;
 	}
-	
-	return test_index_face(mface, fdata, mfindex, nr);
+
+	BMO_op_finish(bm, &find_op);
+
+	return index_map;
 }
 
-typedef struct IndexMapEntry {
-	/* the new vert index that this old vert index maps to */
-	int new;
-	/* -1 if this vert isn't merged, otherwise the old vert index it
-	* should be replaced with
-	*/
-	int merge;
-	/* 1 if this vert's first copy is merged with the last copy of its
-	* merge target, otherwise 0
-	*/
-	short merge_final;
-} IndexMapEntry;
-
-/* indexMap - an array of IndexMap entries
- * oldIndex - the old index to map
- * copyNum - the copy number to map to (original = 0, first copy = 1, etc.)
+/* Used for start/end cap.
+ *
+ * this function expects all existing vertices to be tagged,
+ * so we can know new verts are not tagged.
+ *
+ * All verts will be tagged on exit.
  */
-static int calc_mapping(IndexMapEntry *indexMap, int oldIndex, int copyNum)
+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,
+								  BMOperator *weld_op)
 {
-	if(indexMap[oldIndex].merge < 0) {
-		/* vert wasn't merged, so use copy of this vert */
-		return indexMap[oldIndex].new + copyNum;
-	} else if(indexMap[oldIndex].merge == oldIndex) {
-		/* vert was merged with itself */
-		return indexMap[oldIndex].new;
-	} else {
-		/* vert was merged with another vert */
-		/* follow the chain of merges to the end, or until we've passed
-		* a number of vertices equal to the copy number
-		*/
-		if(copyNum <= 0)
-			return indexMap[oldIndex].new;
-		else
-			return calc_mapping(indexMap, indexMap[oldIndex].merge,
-						copyNum - 1);
+	BMVert *v, *v2;
+	BMIter iter;
+
+	DM_to_bmesh_ex(dm, bm);
+
+	if (amd->flags & MOD_ARR_MERGE) {
+		/* if merging is enabled, find doubles */
+		
+		BMOIter oiter;
+		BMOperator find_op;
+
+		BMO_op_initf(bm, &find_op,
+					 "finddoubles verts=%Hv dist=%f keepverts=%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);
+
+		/* transform and tag verts */
+		BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+			if (!BM_elem_flag_test(v, BM_ELEM_TAG)) {
+				mul_m4_v3(mat, v->co);
+				BM_elem_flag_enable(v, BM_ELEM_TAG);
+			}
+		}
+
+		BMO_op_exec(bm, &find_op);
+
+		/* add new merge targets to weld operator */
+		BMO_ITER (v, &oiter, bm, &find_op, "targetmapout", 0) {
+			v2 = BMO_iter_map_value_p(&oiter);
+			BMO_slot_map_ptr_insert(bm, weld_op, "targetmap", v, v2);
+		}
+
+		BMO_op_finish(bm, &find_op);
+	}
+	else {
+		/* transform and tag verts */
+		BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
+			if (!BM_elem_flag_test(v, BM_ELEM_TAG)) {
+				mul_m4_v3(mat, v->co);
+				BM_elem_flag_enable(v, BM_ELEM_TAG);
+			}
+		}
 	}
 }
 
+static void merge_first_last(BMesh* bm,
+							 const ArrayModifierData *amd,
+							 BMOperator *dupe_first,
+							 BMOperator *dupe_last,
+							 BMOperator *weld_op)
+{
+	BMOperator find_op;
+	BMOIter oiter;
+	BMVert *v, *v2;
+
+	BMO_op_initf(bm, &find_op,
+				 "finddoubles verts=%s dist=%f keepverts=%s",
+				 dupe_first, "geom", amd->merge_dist,
+				 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_op_exec(bm, &find_op);
+
+	/* add new merge targets to weld operator */
+	BMO_ITER (v, &oiter, bm, &find_op, "targetmapout", 0) {
+		v2 = BMO_iter_map_value_p(&oiter);
+		BMO_slot_map_ptr_insert(bm, weld_op, "targetmap", v, v2);
+	}
+
+	BMO_op_finish(bm, &find_op);
+}
+
 static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
-					  struct Scene *scene, Object *ob, DerivedMesh *dm,
-	   int initFlags)
+                                          Scene *scene, Object *ob, DerivedMesh *dm,
+                                          int UNUSED(initFlags))
 {
-	int i, j;
+	DerivedMesh *result;
+	BMEditMesh *em = DM_to_editbmesh(dm, NULL, FALSE);
+	BMOperator first_dupe_op, dupe_op, old_dupe_op, weld_op;
+	BMVert **first_geom = NULL;
+	int i, j, indexLen;
 	/* offset matrix */
 	float offset[4][4];
 	float final_offset[4][4];
 	float tmp_mat[4][4];
 	float length = amd->length;
-	int count = amd->count;
-	int numVerts, numEdges, numFaces;
-	int maxVerts, maxEdges, maxFaces;
-	int finalVerts, finalEdges, finalFaces;
-	DerivedMesh *result, *start_cap = NULL, *end_cap = NULL;
-	MVert *mvert, *src_mvert;
-	MEdge *medge;
-	MFace *mface;
-
-	IndexMapEntry *indexMap;
-
-	EdgeHash *edges;
+	int count = amd->count, maxVerts;
+	int *indexMap = NULL;
+	DerivedMesh *start_cap = NULL, *end_cap = NULL;
+	MVert *src_mvert;
 
 	/* need to avoid infinite recursion here */
-	if(amd->start_cap && amd->start_cap != ob)
-		start_cap = amd->start_cap->derivedFinal;
-	if(amd->end_cap && amd->end_cap != ob)
-		end_cap = amd->end_cap->derivedFinal;
+	if (amd->start_cap && amd->start_cap != ob)
+		start_cap = mesh_get_derived_final(scene, amd->start_cap, CD_MASK_MESH);
+	if (amd->end_cap && amd->end_cap != ob)
+		end_cap = mesh_get_derived_final(scene, amd->end_cap, CD_MASK_MESH);
 
 	unit_m4(offset);
 
-	indexMap = MEM_callocN(sizeof(*indexMap) * dm->getNumVerts(dm),
-				   "indexmap");
-
 	src_mvert = dm->getVertArray(dm);
-
 	maxVerts = dm->getNumVerts(dm);
 
-	if(amd->offset_type & MOD_ARR_OFF_CONST)
-		add_v3_v3(offset[3], amd->offset);
-	if(amd->offset_type & MOD_ARR_OFF_RELATIVE) {
-		for(j = 0; j < 3; j++)
+	if (amd->offset_type & MOD_ARR_OFF_CONST)
+		add_v3_v3v3(offset[3], offset[3], amd->offset);
+	if (amd->offset_type & MOD_ARR_OFF_RELATIVE) {
+		for (j = 0; j < 3; j++)
 			offset[3][j] += amd->scale[j] * vertarray_size(src_mvert,
 					maxVerts, j);
 	}
 
-	if((amd->offset_type & MOD_ARR_OFF_OBJ) && (amd->offset_ob)) {
+	if ((amd->offset_type & MOD_ARR_OFF_OBJ) && (amd->offset_ob)) {
 		float obinv[4][4];
 		float result_mat[4][4];
 
-		if(ob)
+		if (ob)
 			invert_m4_m4(obinv, ob->obmat);
 		else
 			unit_m4(obinv);
@@ -280,495 +350,193 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
 		copy_m4_m4(offset, result_mat);
 	}
 
-	if(amd->fit_type == MOD_ARR_FITCURVE && amd->curve_ob) {
+	if (amd->fit_type == MOD_ARR_FITCURVE && amd->curve_ob) {
 		Curve *cu = amd->curve_ob->data;
-		if(cu) {
+		if (cu) {
 			float tmp_mat[3][3];
 			float scale;
 			
 			object_to_mat3(amd->curve_ob, tmp_mat);
 			scale = mat3_to_scale(tmp_mat);
 				
-			if(!cu->path) {
+			if (!cu->path) {
 				cu->flag |= CU_PATH; // needed for path & bevlist
 				makeDispListCurveTypes(scene, amd->curve_ob, 0);
 			}
-			if(cu->path)
+			if (cu->path)
 				length = scale*cu->path->totdist;
 		}
 	}
 
 	/* calculate the maximum number of copies which will fit within the
-	prescribed length */
-	if(amd->fit_type == MOD_ARR_FITLENGTH
-		  || amd->fit_type == MOD_ARR_FITCURVE) {
+	 * prescribed length */
+	if (amd->fit_type == MOD_ARR_FITLENGTH || amd->fit_type == MOD_ARR_FITCURVE) {
 		float dist = sqrt(dot_v3v3(offset[3], offset[3]));
 
-		if(dist > 1e-6f)
+		if (dist > 1e-6f)
 			/* this gives length = first copy start to last copy end
-			add a tiny offset for floating point rounding errors */
+			 * add a tiny offset for floating point rounding errors */
 			count = (length + 1e-6f) / dist;
 		else
 			/* if the offset has no translation, just make one copy */
 			count = 1;
 	}
 
-	if(count < 1)
+	if (count < 1)
 		count = 1;
 
-	/* allocate memory for count duplicates (including original) plus
-		  * start and end caps
-	*/
-	finalVerts = dm->getNumVerts(dm) * count;
-	finalEdges = dm->getNumEdges(dm) * count;
-	finalFaces = dm->getNumFaces(dm) * count;
-	if(start_cap) {
-		finalVerts += start_cap->getNumVerts(start_cap);
-		finalEdges += start_cap->getNumEdges(start_cap);
-		finalFaces += start_cap->getNumFaces(start_cap);
-	}
-	if(end_cap) {
-		finalVerts += end_cap->getNumVerts(end_cap);
-		finalEdges += end_cap->getNumEdges(end_cap);
-		finalFaces += end_cap->getNumFaces(end_cap);
-	}
-	result = CDDM_from_template(dm, finalVerts, finalEdges, finalFaces);
-
 	/* calculate the offset matrix of the final copy (for merging) */
 	unit_m4(final_offset);
 
-	for(j=0; j < count - 1; j++) {
+	for (j=0; j < count - 1; j++) {
 		mult_m4_m4m4(tmp_mat, offset, final_offset);
 		copy_m4_m4(final_offset, tmp_mat);
 	}
 
-	numVerts = numEdges = numFaces = 0;
-	mvert = CDDM_get_verts(result);
-
-	for (i = 0; i < maxVerts; i++) {
-		indexMap[i].merge = -1; /* default to no merge */
-		indexMap[i].merge_final = 0; /* default to no merge */
-	}
-
-	for (i = 0; i < maxVerts; i++) {
-		MVert *inMV;
-		MVert *mv = &mvert[numVerts];
-		MVert *mv2;
-		float co[3];
-
-		inMV = &src_mvert[i];
-
-		DM_copy_vert_data(dm, result, i, numVerts, 1);
-		*mv = *inMV;
-		numVerts++;
-
-		indexMap[i].new = numVerts - 1;
-
-		copy_v3_v3(co, mv->co);
-		
-		/* Attempts to merge verts from one duplicate with verts from the
-			  * next duplicate which are closer than amd->merge_dist.
-			  * Only the first such vert pair is merged.
-			  * If verts are merged in the first duplicate pair, they are merged
-			  * in all pairs.
-		*/
-		if((count > 1) && (amd->flags & MOD_ARR_MERGE)) {
-			float tmp_co[3];
-			mul_v3_m4v3(tmp_co, offset, mv->co);
-
-			for(j = 0; j < maxVerts; j++) {
-				/* if vertex already merged, don't use it */
-				if( indexMap[j].merge != -1 ) continue;
-
-				inMV = &src_mvert[j];
-				/* if this vert is within merge limit, merge */
-				if(compare_len_v3v3(tmp_co, inMV->co, amd->merge_dist)) {
-					indexMap[i].merge = j;
-
-					/* test for merging with final copy of merge target */
-					if(amd->flags & MOD_ARR_MERGEFINAL) {
-						copy_v3_v3(tmp_co, inMV->co);
-						inMV = &src_mvert[i];
-						mul_m4_v3(final_offset, tmp_co);
-						if(compare_len_v3v3(tmp_co, inMV->co, amd->merge_dist))
-							indexMap[i].merge_final = 1;
-					}
-					break;
-				}
-			}
-		}
-
-		/* if no merging, generate copies of this vert */
-		if(indexMap[i].merge < 0) {
-			for(j=0; j < count - 1; j++) {
-				mv2 = &mvert[numVerts];
+	/* BMESH_TODO: bumping up the stack level avoids computing the normals
+	 * after every top-level operator execution (and this modifier has the
+	 * potential to execute a *lot* of top-level BMOps. There should be a
+	 * 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);
 
-				DM_copy_vert_data(result, result, numVerts - 1, numVerts, 1);
-				*mv2 = *mv;
-				numVerts++;
+	if (amd->flags & MOD_ARR_MERGE)
+		BMO_op_init(em->bm, &weld_op, "weldverts");
 
-				mul_m4_v3(offset, co);
-				copy_v3_v3(mv2->co, co);
-			}
-		} else if(indexMap[i].merge != i && indexMap[i].merge_final) {
-			/* if this vert is not merging with itself, and it is merging
-				  * with the final copy of its merge target, remove the first copy
-			*/
-			numVerts--;
-			DM_free_vert_data(result, numVerts, 1);
-		}
-	}
+	BMO_op_initf(em->bm, &dupe_op, "dupe geom=%avef");
+	first_dupe_op = dupe_op;
 
-	/* make a hashtable so we can avoid duplicate edges from merging */
-	edges = BLI_edgehash_new();
-
-	maxEdges = dm->getNumEdges(dm);
-	medge = CDDM_get_edges(result);
-	for(i = 0; i < maxEdges; i++) {
-		MEdge inMED;
-		MEdge med;
-		MEdge *med2;
-		int vert1, vert2;
-
-		dm->getEdge(dm, i, &inMED);
-
-		med = inMED;
-		med.v1 = indexMap[inMED.v1].new;
-		med.v2 = indexMap[inMED.v2].new;
-
-		/* if vertices are to be merged with the final copies of their
-			  * merge targets, calculate that final copy
-		*/
-		if(indexMap[inMED.v1].merge_final) {
-			med.v1 = calc_mapping(indexMap, indexMap[inMED.v1].merge,
-			count - 1);
-		}
-		if(indexMap[inMED.v2].merge_final) {
-			med.v2 = calc_mapping(indexMap, indexMap[inMED.v2].merge,
-			count - 1);
-		}
+	for (j=0; j < count - 1; j++) {
+		BMVert *v, *v2, *v3;
+		BMOpSlot *geom_slot;
+		BMOpSlot *newout_slot;
+		BMOIter oiter;
 
-		if(med.v1 == med.v2) continue;
+		if (j != 0)
+			BMO_op_initf(em->bm, &dupe_op, "dupe geom=%s", &old_dupe_op, "newout");
+		BMO_op_exec(em->bm, &dupe_op);
 
-		/* XXX Unfortunately the calc_mapping returns sometimes numVerts... leads to bad crashes */
-		if(med.v1 >= numVerts)
-			med.v1= numVerts-1;
-		if(med.v2 >= numVerts)
-			med.v2= numVerts-1;
+		geom_slot = BMO_slot_get(&dupe_op, "geom");
+		newout_slot = BMO_slot_get(&dupe_op, "newout");
 
-		if (initFlags) {
-			med.flag |= ME_EDGEDRAW | ME_EDGERENDER;
+		if ((amd->flags & MOD_ARR_MERGEFINAL) && j == 0) {
+			int first_geom_bytes = sizeof(BMVert*) * geom_slot->len;
+				
+			/* make a copy of the initial geometry ordering so the
+			 * last duplicate can be merged into it */
+			first_geom = MEM_mallocN(first_geom_bytes, "first_geom");
+			memcpy(first_geom, geom_slot->data.buf, first_geom_bytes);
 		}
 
-		if(!BLI_edgehash_haskey(edges, med.v1, med.v2)) {
-			DM_copy_edge_data(dm, result, i, numEdges, 1);
-			medge[numEdges] = med;
-			numEdges++;
-
-			BLI_edgehash_insert(edges, med.v1, med.v2, NULL);
+		/* apply transformation matrix */
+		BMO_ITER (v, &oiter, em->bm, &dupe_op, "newout", BM_VERT) {
+			mul_m4_v3(offset, v->co);
 		}
 
-		for(j = 1; j < count; j++)
-		{
-			vert1 = calc_mapping(indexMap, inMED.v1, j);
-			vert2 = calc_mapping(indexMap, inMED.v2, j);
-
-			/* edge could collapse to single point after mapping */
-			if(vert1 == vert2) continue;
+		if (amd->flags & MOD_ARR_MERGE) {
+			/*calculate merge mapping*/
+			if (j == 0) {
+				indexMap = find_doubles_index_map(em->bm, &dupe_op,
+												  amd, &indexLen);
+			}
 
-			/* XXX Unfortunately the calc_mapping returns sometimes numVerts... leads to bad crashes */
-			if(vert1 >= numVerts)
-				vert1= numVerts-1;
-			if(vert2 >= numVerts)
-				vert2= numVerts-1;
+			#define _E(s, i) ((BMVert **)(s)->data.buf)[i]
 
-			/* avoid duplicate edges */
-			if(!BLI_edgehash_haskey(edges, vert1, vert2)) {
-				med2 = &medge[numEdges];
+			for (i=0; i<indexLen; i++) {
+				if (!indexMap[i]) continue;
 
-				DM_copy_edge_data(dm, result, i, numEdges, 1);
-				*med2 = med;
-				numEdges++;
+				/* merge v (from 'newout') into v2 (from old 'geom') */
+				v = _E(newout_slot, i - geom_slot->len);
+				v2 = _E(geom_slot, indexMap[i]-1);
 
-				med2->v1 = vert1;
-				med2->v2 = vert2;
+				/* 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))) {
+					v2 = v3;
+				}
 
-				BLI_edgehash_insert(edges, med2->v1, med2->v2, NULL);
+				BMO_slot_map_ptr_insert(em->bm, &weld_op, "targetmap", v, v2);
 			}
-		}
-	}
 
-	maxFaces = dm->getNumFaces(dm);
-	mface = CDDM_get_faces(result);
-	for (i=0; i < maxFaces; i++) {
-		MFace inMF;
-		MFace *mf = &mface[numFaces];
-
-		dm->getFace(dm, i, &inMF);
-
-		DM_copy_face_data(dm, result, i, numFaces, 1);
-		*mf = inMF;
-
-		mf->v1 = indexMap[inMF.v1].new;
-		mf->v2 = indexMap[inMF.v2].new;
-		mf->v3 = indexMap[inMF.v3].new;
-		if(inMF.v4)
-			mf->v4 = indexMap[inMF.v4].new;
-
-		/* if vertices are to be merged with the final copies of their
-			  * merge targets, calculate that final copy
-		*/
-		if(indexMap[inMF.v1].merge_final)
-			mf->v1 = calc_mapping(indexMap, indexMap[inMF.v1].merge, count-1);
-		if(indexMap[inMF.v2].merge_final)
-			mf->v2 = calc_mapping(indexMap, indexMap[inMF.v2].merge, count-1);
-		if(indexMap[inMF.v3].merge_final)
-			mf->v3 = calc_mapping(indexMap, indexMap[inMF.v3].merge, count-1);
-		if(inMF.v4 && indexMap[inMF.v4].merge_final)
-			mf->v4 = calc_mapping(indexMap, indexMap[inMF.v4].merge, count-1);
-
-		if(test_index_face_maxvert(mf, &result->faceData, numFaces, inMF.v4?4:3, numVerts) < 3)
-			continue;
-
-		numFaces++;
-
-		/* if the face has fewer than 3 vertices, don't create it */
-		if(mf->v3 == 0 || (mf->v1 && (mf->v1 == mf->v3 || mf->v1 == mf->v4))) {
-			numFaces--;
-			DM_free_face_data(result, numFaces, 1);
+			#undef _E
 		}
 
-		for(j = 1; j < count; j++)
-		{
-			MFace *mf2 = &mface[numFaces];
-
-			DM_copy_face_data(dm, result, i, numFaces, 1);
-			*mf2 = *mf;
-
-			mf2->v1 = calc_mapping(indexMap, inMF.v1, j);
-			mf2->v2 = calc_mapping(indexMap, inMF.v2, j);
-			mf2->v3 = calc_mapping(indexMap, inMF.v3, j);
-			if (inMF.v4)
-				mf2->v4 = calc_mapping(indexMap, inMF.v4, j);
-
-			numFaces++;
-
-			/* if the face has fewer than 3 vertices, don't create it */
-			if(test_index_face_maxvert(mf2, &result->faceData, numFaces-1, inMF.v4?4:3, numVerts) < 3) {
-				numFaces--;
-				DM_free_face_data(result, numFaces, 1);
-			}
-		}
+		/* already copied earlier, but after executation more slot
+		 * memory may be allocated */
+		if (j == 0)
+			first_dupe_op = dupe_op;
+		
+		if (j >= 2)
+			BMO_op_finish(em->bm, &old_dupe_op);
+		old_dupe_op = dupe_op;
 	}
 
-	/* add start and end caps */
-	if(start_cap) {
-		float startoffset[4][4];
-		MVert *cap_mvert;
-		MEdge *cap_medge;
-		MFace *cap_mface;
-		int *origindex;
-		int *vert_map;
-		int capVerts, capEdges, capFaces;
-
-		capVerts = start_cap->getNumVerts(start_cap);
-		capEdges = start_cap->getNumEdges(start_cap);
-		capFaces = start_cap->getNumFaces(start_cap);
-		cap_mvert = start_cap->getVertArray(start_cap);
-		cap_medge = start_cap->getEdgeArray(start_cap);
-		cap_mface = start_cap->getFaceArray(start_cap);
-
-		invert_m4_m4(startoffset, offset);
-
-		vert_map = MEM_callocN(sizeof(*vert_map) * capVerts,
-		"arrayModifier_doArray vert_map");
-
-		origindex = result->getVertDataArray(result, CD_ORIGINDEX);
-		for(i = 0; i < capVerts; i++) {
-			MVert *mv = &cap_mvert[i];
-			short merged = 0;
-
-			if(amd->flags & MOD_ARR_MERGE) {
-				float tmp_co[3];
-				MVert *in_mv;
-				int j;
-
-				copy_v3_v3(tmp_co, mv->co);
-				mul_m4_v3(startoffset, tmp_co);
-
-				for(j = 0; j < maxVerts; j++) {
-					in_mv = &src_mvert[j];
-					/* if this vert is within merge limit, merge */
-					if(compare_len_v3v3(tmp_co, in_mv->co, amd->merge_dist)) {
-						vert_map[i] = calc_mapping(indexMap, j, 0);
-						merged = 1;
-						break;
-					}
-				}
-			}
-
-			if(!merged) {
-				DM_copy_vert_data(start_cap, result, i, numVerts, 1);
-				mvert[numVerts] = *mv;
-				mul_m4_v3(startoffset, mvert[numVerts].co);
-				origindex[numVerts] = ORIGINDEX_NONE;
-
-				vert_map[i] = numVerts;
+	if ((amd->flags & MOD_ARR_MERGE) &&
+	    (amd->flags & MOD_ARR_MERGEFINAL) &&
+	    (count > 1))
+	{
+		/* Merge first and last copies. Note that we can't use the
+		 * indexMap for this because (unless the array is forming a
+		 * loop) the offset between first and last is different from
+		 * dupe X to dupe X+1. */
 
-				numVerts++;
-			}
-		}
-		origindex = result->getEdgeDataArray(result, CD_ORIGINDEX);
-		for(i = 0; i < capEdges; i++) {
-			int v1, v2;
-
-			v1 = vert_map[cap_medge[i].v1];
-			v2 = vert_map[cap_medge[i].v2];
+		merge_first_last(em->bm, amd, &first_dupe_op, &dupe_op, &weld_op);
+	}
 
-			if(!BLI_edgehash_haskey(edges, v1, v2)) {
-				DM_copy_edge_data(start_cap, result, i, numEdges, 1);
-				medge[numEdges] = cap_medge[i];
-				medge[numEdges].v1 = v1;
-				medge[numEdges].v2 = v2;
-				origindex[numEdges] = ORIGINDEX_NONE;
+	/* start capping */
+	if (start_cap || end_cap) {
+		BM_mesh_elem_hflag_enable_all(em->bm, BM_VERT, BM_ELEM_TAG, FALSE);
 
-				numEdges++;
-			}
+		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);
 		}
-		origindex = result->getFaceDataArray(result, CD_ORIGINDEX);
-		for(i = 0; i < capFaces; i++) {
-			DM_copy_face_data(start_cap, result, i, numFaces, 1);
-			mface[numFaces] = cap_mface[i];
-			mface[numFaces].v1 = vert_map[mface[numFaces].v1];
-			mface[numFaces].v2 = vert_map[mface[numFaces].v2];
-			mface[numFaces].v3 = vert_map[mface[numFaces].v3];
-			if(mface[numFaces].v4) {
-				mface[numFaces].v4 = vert_map[mface[numFaces].v4];
-
-				test_index_face_maxvert(&mface[numFaces], &result->faceData,
-				numFaces, 4, numVerts);
-			}
-			else
-			{
-				test_index_face(&mface[numFaces], &result->faceData,
-				numFaces, 3);
-			}
 
-			origindex[numFaces] = ORIGINDEX_NONE;
-
-			numFaces++;
+		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);
 		}
-
-		MEM_freeN(vert_map);
-		start_cap->release(start_cap);
 	}
+	/* done capping */
 
-	if(end_cap) {
-		float endoffset[4][4];
-		MVert *cap_mvert;
-		MEdge *cap_medge;
-		MFace *cap_mface;
-		int *origindex;
-		int *vert_map;
-		int capVerts, capEdges, capFaces;
-
-		capVerts = end_cap->getNumVerts(end_cap);
-		capEdges = end_cap->getNumEdges(end_cap);
-		capFaces = end_cap->getNumFaces(end_cap);
-		cap_mvert = end_cap->getVertArray(end_cap);
-		cap_medge = end_cap->getEdgeArray(end_cap);
-		cap_mface = end_cap->getFaceArray(end_cap);
-
-		mult_m4_m4m4(endoffset, offset, final_offset);
-
-		vert_map = MEM_callocN(sizeof(*vert_map) * capVerts,
-		"arrayModifier_doArray vert_map");
-
-		origindex = result->getVertDataArray(result, CD_ORIGINDEX);
-		for(i = 0; i < capVerts; i++) {
-			MVert *mv = &cap_mvert[i];
-			short merged = 0;
-
-			if(amd->flags & MOD_ARR_MERGE) {
-				float tmp_co[3];
-				MVert *in_mv;
-				int j;
-
-				copy_v3_v3(tmp_co, mv->co);
-				mul_m4_v3(offset, tmp_co);
-
-				for(j = 0; j < maxVerts; j++) {
-					in_mv = &src_mvert[j];
-					/* if this vert is within merge limit, merge */
-					if(compare_len_v3v3(tmp_co, in_mv->co, amd->merge_dist)) {
-						vert_map[i] = calc_mapping(indexMap, j, count - 1);
-						merged = 1;
-						break;
-					}
-				}
-			}
-
-			if(!merged) {
-				DM_copy_vert_data(end_cap, result, i, numVerts, 1);
-				mvert[numVerts] = *mv;
-				mul_m4_v3(endoffset, mvert[numVerts].co);
-				origindex[numVerts] = ORIGINDEX_NONE;
-
-				vert_map[i] = numVerts;
+	/* free remaining dupe operators */
+	BMO_op_finish(em->bm, &first_dupe_op);
+	if (count > 2)
+		BMO_op_finish(em->bm, &dupe_op);
 
-				numVerts++;
-			}
-		}
-		origindex = result->getEdgeDataArray(result, CD_ORIGINDEX);
-		for(i = 0; i < capEdges; i++) {
-			int v1, v2;
+	/* run merge operator */
+	if (amd->flags & MOD_ARR_MERGE) {
+		BMO_op_exec(em->bm, &weld_op);
+		BMO_op_finish(em->bm, &weld_op);
+	}
 
-			v1 = vert_map[cap_medge[i].v1];
-			v2 = vert_map[cap_medge[i].v2];
+	/* Bump the stack level back down to match the adjustment up above */
+	BMO_pop(em->bm);
 
-			if(!BLI_edgehash_haskey(edges, v1, v2)) {
-				DM_copy_edge_data(end_cap, result, i, numEdges, 1);
-				medge[numEdges] = cap_medge[i];
-				medge[numEdges].v1 = v1;
-				medge[numEdges].v2 = v2;
-				origindex[numEdges] = ORIGINDEX_NONE;
+	BLI_assert(em->looptris == NULL);
+	result = CDDM_from_BMEditMesh(em, NULL, FALSE, FALSE);
 
-				numEdges++;
-			}
-		}
-		origindex = result->getFaceDataArray(result, CD_ORIGINDEX);
-		for(i = 0; i < capFaces; i++) {
-			DM_copy_face_data(end_cap, result, i, numFaces, 1);
-			mface[numFaces] = cap_mface[i];
-			mface[numFaces].v1 = vert_map[mface[numFaces].v1];
-			mface[numFaces].v2 = vert_map[mface[numFaces].v2];
-			mface[numFaces].v3 = vert_map[mface[numFaces].v3];
-			if(mface[numFaces].v4) {
-				mface[numFaces].v4 = vert_map[mface[numFaces].v4];
-
-				test_index_face(&mface[numFaces], &result->faceData,
-				numFaces, 4);
-			}
-			else
-			{
-				test_index_face(&mface[numFaces], &result->faceData,
-				numFaces, 3);
-			}
-			origindex[numFaces] = ORIGINDEX_NONE;
-
-			numFaces++;
-		}
+	if ((amd->offset_type & MOD_ARR_OFF_OBJ) && (amd->offset_ob)) {
+		/* Update normals in case offset object has rotation. */
+		
+		/* BMESH_TODO: check if normal recalc needed under any other
+		 * conditions? */
 
-		MEM_freeN(vert_map);
-		end_cap->release(end_cap);
+		CDDM_calc_normals(result);
 	}
 
-	BLI_edgehash_free(edges, NULL);
-	MEM_freeN(indexMap);
-
-	CDDM_lower_num_verts(result, numVerts);
-	CDDM_lower_num_edges(result, numEdges);
-	CDDM_lower_num_faces(result, numFaces);
+	BMEdit_Free(em);
+	MEM_freeN(em);
+	if (indexMap)
+		MEM_freeN(indexMap);
+	if (first_geom)
+		MEM_freeN(first_geom);
 
 	return result;
 }
@@ -783,14 +551,14 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 
 	result = arrayModifier_doArray(amd, md->scene, ob, dm, 0);
 
-	if(result != dm)
-		CDDM_calc_normals(result);
+	//if (result != dm)
+	//	CDDM_calc_normals_mapping(result);
 
 	return result;
 }
 
 static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
-						struct EditMesh *UNUSED(editData),
+						struct BMEditMesh *UNUSED(editData),
 						DerivedMesh *dm)
 {
 	return applyModifier(md, ob, dm, 0, 1);
diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c
index 1601678..613dfee 100644
--- a/source/blender/modifiers/intern/MOD_bevel.c
+++ b/source/blender/modifiers/intern/MOD_bevel.c
@@ -32,17 +32,20 @@
  *  \ingroup modifiers
  */
 
-#include "MEM_guardedalloc.h"
-
 #include "BLI_utildefines.h"
+#include "BLI_math.h"
 #include "BLI_string.h"
 
-#include "BKE_bmesh.h"
 #include "BKE_cdderivedmesh.h"
 #include "BKE_modifier.h"
-#include "BKE_particle.h"
+#include "BKE_tessmesh.h"
+#include "BKE_mesh.h"
 
-#include "MOD_util.h"
+#include "BKE_bmesh.h" /* only for defines */
+
+#include "DNA_object_types.h"
+
+#include "MEM_guardedalloc.h"
 
 
 static void initData(ModifierData *md)
@@ -80,44 +83,123 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
 	CustomDataMask dataMask = 0;
 
 	/* ask for vertexgroups if we need them */
-	if(bmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+	if (bmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
 
 	return dataMask;
 }
 
+#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.
+ * - 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.
+ */
+static DerivedMesh *applyModifier(ModifierData *md, struct Object *UNUSED(ob),
+                                  DerivedMesh *dm,
+                                  int UNUSED(useRenderParams),
+                                  int UNUSED(isFinalCalc))
+{
+	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;
+
+	BM_mesh_normals_update(bm, FALSE);
+	BMO_push(bm, NULL);
+
+	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);
+				}
+			}
+		}
+	}
+	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);
+		}
+	}
+
+	BMO_op_callf(bm, "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);
+
+	BLI_assert(em->looptris == NULL);
+	result = CDDM_from_BMEditMesh(em, NULL, TRUE, FALSE);
+	BMEdit_Free(em);
+	MEM_freeN(em);
+
+	return result;
+}
+
+
+#else /* from trunk, see note above */
+
 static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
 						DerivedMesh *derivedData,
 						int UNUSED(useRenderParams),
 						int UNUSED(isFinalCalc))
 {
 	DerivedMesh *result;
-	BME_Mesh *bm;
+	BMEditMesh *em;
 
 	/*bDeformGroup *def;*/
 	int /*i,*/ options, defgrp_index = -1;
 	BevelModifierData *bmd = (BevelModifierData*) md;
 
-	options = bmd->flags|bmd->val_flags|bmd->lim_flags|bmd->e_flags;
+	options = bmd->flags | bmd->val_flags | bmd->lim_flags | bmd->e_flags;
 
-	/*if ((options & BME_BEVEL_VWEIGHT) && bmd->defgrp_name[0]) {
+#if 0
+	if ((options & BME_BEVEL_VWEIGHT) && bmd->defgrp_name[0]) {
 		defgrp_index = defgroup_name_index(ob, bmd->defgrp_name);
 		if (defgrp_index < 0) {
 			options &= ~BME_BEVEL_VWEIGHT;
 		}
-	}*/
-
-	bm = BME_derivedmesh_to_bmesh(derivedData);
-	BME_bevel(bm,bmd->value,bmd->res,options,defgrp_index,bmd->bevel_angle,NULL);
-	result = BME_bmesh_to_derivedmesh(bm,derivedData);
-	BME_free_mesh(bm);
-
+	}
+#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);
+
+	/* until we allow for dirty normal flag, always calc,
+	 * note: calculating on the CDDM is faster then the BMesh equivalent */
 	CDDM_calc_normals(result);
 
 	return result;
 }
 
+#endif
+
 static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
-						EditMesh *UNUSED(editData),
+						struct BMEditMesh *UNUSED(editData),
 						DerivedMesh *derivedData)
 {
 	return applyModifier(md, ob, derivedData, 0, 1);
diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c
index 2493b5e..e4e89db 100644
--- a/source/blender/modifiers/intern/MOD_boolean.c
+++ b/source/blender/modifiers/intern/MOD_boolean.c
@@ -38,6 +38,7 @@
 
 #include "BLI_utildefines.h"
 
+#include "BLF_translation.h"
 
 #include "BKE_cdderivedmesh.h"
 #include "BKE_modifier.h"
@@ -82,7 +83,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
 {
 	BooleanModifierData *bmd = (BooleanModifierData*) md;
 
-	if(bmd->object) {
+	if (bmd->object) {
 		DagNode *curNode = dag_get_node(forest, bmd->object);
 
 		dag_add_relation(forest, curNode, obNode,
@@ -95,14 +96,14 @@ static DerivedMesh *get_quick_derivedMesh(DerivedMesh *derivedData, DerivedMesh
 {
 	DerivedMesh *result = NULL;
 
-	if(derivedData->getNumFaces(derivedData) == 0 || dm->getNumFaces(dm) == 0) {
+	if (derivedData->getNumPolys(derivedData) == 0 || dm->getNumPolys(dm) == 0) {
 		switch(operation) {
 			case eBooleanModifierOp_Intersect:
-				result = CDDM_new(0, 0, 0);
+				result = CDDM_new(0, 0, 0, 0, 0);
 				break;
 
 			case eBooleanModifierOp_Union:
-				if(derivedData->getNumFaces(derivedData)) result = derivedData;
+				if (derivedData->getNumPolys(derivedData)) result = derivedData;
 				else result = CDDM_copy(dm);
 
 				break;
@@ -124,20 +125,24 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 	BooleanModifierData *bmd = (BooleanModifierData*) md;
 	DerivedMesh *dm;
 
-	if(!bmd->object)
+	if (!bmd->object)
 		return derivedData;
 
 	dm = bmd->object->derivedFinal;
 
-	if(dm) {
+	if (dm) {
 		DerivedMesh *result;
 
 		/* when one of objects is empty (has got no faces) we could speed up
-		   calculation a bit returning one of objects' derived meshes (or empty one)
-		   Returning mesh is depended on modifieier's operation (sergey) */
+		 * calculation a bit returning one of objects' derived meshes (or empty one)
+		 * Returning mesh is depended on modifiers operation (sergey) */
 		result = get_quick_derivedMesh(derivedData, dm, bmd->operation);
 
-		if(result == NULL) {
+		if (result == NULL) {
+
+			DM_ensure_tessface(dm);          /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
+			DM_ensure_tessface(derivedData); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
+
 			// TIMEIT_START(NewBooleanDerivedMesh)
 
 			result = NewBooleanDerivedMesh(dm, bmd->object, derivedData, ob,
@@ -147,11 +152,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		}
 
 		/* if new mesh returned, return it; otherwise there was
-		* an error, so delete the modifier object */
-		if(result)
+		 * an error, so delete the modifier object */
+		if (result)
 			return result;
 		else
-			modifier_setError(md, "Can't execute boolean operation.");
+			modifier_setError(md, "%s", TIP_("Can't execute boolean operation."));
 	}
 	
 	return derivedData;
diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c
index 4b380ef..8341bc6 100644
--- a/source/blender/modifiers/intern/MOD_boolean_util.c
+++ b/source/blender/modifiers/intern/MOD_boolean_util.c
@@ -173,29 +173,31 @@ static int FaceIt_Done(CSG_IteratorPtr it)
 {
 	// assume CSG_IteratorPtr is of the correct type.
 	FaceIt * iterator = (FaceIt *)it;
-	return(iterator->pos >= iterator->dm->getNumFaces(iterator->dm));
+	return(iterator->pos >= iterator->dm->getNumTessFaces(iterator->dm));
 }
 
 static void FaceIt_Fill(CSG_IteratorPtr it, CSG_IFace *face)
 {
 	// assume CSG_IteratorPtr is of the correct type.
 	FaceIt *face_it = (FaceIt *)it;
-	MFace *mfaces = face_it->dm->getFaceArray(face_it->dm);
+	MFace *mfaces = face_it->dm->getTessFaceArray(face_it->dm);
 	MFace *mface = &mfaces[face_it->pos];
 
 	/* reverse face vertices if necessary */
 	face->vertex_index[1] = mface->v2;
-	if( face_it->flip == 0 ) {
+	if ( face_it->flip == 0 ) {
 	face->vertex_index[0] = mface->v1;
 	face->vertex_index[2] = mface->v3;
-	} else {
+	}
+	else {
 		face->vertex_index[2] = mface->v1;
 		face->vertex_index[0] = mface->v3;
 	}
 	if (mface->v4) {
 		face->vertex_index[3] = mface->v4;
 		face->vertex_number = 4;
-	} else {
+	}
+	else {
 		face->vertex_number = 3;
 	}
 
@@ -223,7 +225,7 @@ static void FaceIt_Construct(
 	// allocate some memory for blender iterator
 	it = (FaceIt *)(MEM_mallocN(sizeof(FaceIt),"Boolean_FIt"));
 	if (it == 0) {
-		return ;
+		return;
 	}
 	// assign blender specific variables
 	it->dm = dm;
@@ -234,17 +236,22 @@ static void FaceIt_Construct(
 	if (ob->size[0] < 0.0f) {
 		if (ob->size[1] < 0.0f && ob->size[2] < 0.0f) {
 			it->flip = 1;
-		} else if (ob->size[1] >= 0.0f && ob->size[2] >= 0.0f) {
+		}
+		else if (ob->size[1] >= 0.0f && ob->size[2] >= 0.0f) {
 			it->flip = 1;
-		} else {
+		}
+		else {
 			it->flip = 0;
 		}
-	} else {
+	}
+	else {
 		if (ob->size[1] < 0.0f && ob->size[2] < 0.0f) {
 			it->flip = 0;
-		} else if (ob->size[1] >= 0.0f && ob->size[2] >= 0.0f) {
+		}
+		else if (ob->size[1] >= 0.0f && ob->size[2] >= 0.0f) {
 			it->flip = 0;
-		} else {
+		}
+		else {
 			it->flip = 1;
 		}
 	}
@@ -254,7 +261,7 @@ static void FaceIt_Construct(
 	output->Fill = FaceIt_Fill;
 	output->Done = FaceIt_Done;
 	output->Reset = FaceIt_Reset;
-	output->num_elements = it->dm->getNumFaces(it->dm);
+	output->num_elements = it->dm->getNumTessFaces(it->dm);
 	output->it = it;
 }
 
@@ -304,8 +311,8 @@ static void InterpCSGFace(
 	MFace *mface, *orig_mface;
 	int j;
 
-	mface = CDDM_get_face(dm, index);
-	orig_mface = orig_dm->getFaceArray(orig_dm) + orig_index;
+	mface = CDDM_get_tessface(dm, index);
+	orig_mface = orig_dm->getTessFaceArray(orig_dm) + orig_index;
 
 	// get the vertex coordinates from the original mesh
 	orig_co[0] = (orig_dm->getVertArray(orig_dm) + orig_mface->v1)->co;
@@ -333,7 +340,7 @@ static void InterpCSGFace(
 }
 
 /* Iterate over the CSG Output Descriptors and create a new DerivedMesh
-   from them */
+ * from them */
 static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
 	CSG_FaceIteratorDescriptor *face_it,
 	CSG_VertexIteratorDescriptor *vertex_it,
@@ -353,10 +360,10 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
 	int i, *origindex_layer;
 
 	// create a new DerivedMesh
-	result = CDDM_new(vertex_it->num_elements, 0, face_it->num_elements);
-	CustomData_merge(&dm1->faceData, &result->faceData, CD_MASK_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),
 					  CD_DEFAULT, face_it->num_elements); 
-	CustomData_merge(&dm2->faceData, &result->faceData, CD_MASK_DERIVEDMESH,
+	CustomData_merge(&dm2->faceData, &result->faceData, CD_MASK_DERIVEDMESH & ~(CD_MASK_NORMAL | CD_MASK_POLYINDEX | CD_MASK_ORIGINDEX),
 					  CD_DEFAULT, face_it->num_elements); 
 
 	// step through the vertex iterators:
@@ -379,10 +386,10 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
 	if (mat)
 		*totmat = 0;
 
-	origindex_layer = result->getFaceDataArray(result, CD_ORIGINDEX);
+	origindex_layer = result->getTessFaceDataArray(result, CD_ORIGINDEX);
 
 	// step through the face iterators
-	for(i = 0; !face_it->Done(face_it->it); i++) {
+	for (i = 0; !face_it->Done(face_it->it); i++) {
 		Mesh *orig_me;
 		Object *orig_ob;
 		Material *orig_mat;
@@ -395,23 +402,23 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
 		face_it->Step(face_it->it);
 
 		// find the original mesh and data
-		orig_ob = (csgface.orig_face < dm1->getNumFaces(dm1))? ob1: ob2;
-		orig_dm = (csgface.orig_face < dm1->getNumFaces(dm1))? dm1: dm2;
+		orig_ob = (csgface.orig_face < dm1->getNumTessFaces(dm1))? ob1: ob2;
+		orig_dm = (csgface.orig_face < dm1->getNumTessFaces(dm1))? dm1: dm2;
 		orig_me = (orig_ob == ob1)? me1: me2;
-		orig_index = (orig_ob == ob1)? csgface.orig_face: csgface.orig_face - dm1->getNumFaces(dm1);
+		orig_index = (orig_ob == ob1)? csgface.orig_face: csgface.orig_face - dm1->getNumTessFaces(dm1);
 
 		// copy all face layers, including mface
 		CustomData_copy_data(&orig_dm->faceData, &result->faceData, orig_index, i, 1);
 
 		// set mface
-		mface = CDDM_get_face(result, i);
+		mface = CDDM_get_tessface(result, i);
 		mface->v1 = csgface.vertex_index[0];
 		mface->v2 = csgface.vertex_index[1];
 		mface->v3 = csgface.vertex_index[2];
 		mface->v4 = (csgface.vertex_number == 4)? csgface.vertex_index[3]: 0;
 
 		// set material, based on lookup in hash table
-		orig_mat= give_current_material(orig_ob, mface->mat_nr+1);
+		orig_mat = give_current_material(orig_ob, mface->mat_nr + 1);
 
 		if (mat && orig_mat) {
 			if (!BLI_ghash_haskey(material_hash, orig_mat)) {
@@ -422,8 +429,8 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
 			else
 				mface->mat_nr = GET_INT_FROM_POINTER(BLI_ghash_lookup(material_hash, orig_mat));
 		}
-		else if(orig_mat) {
-			if(orig_ob == ob1) {
+		else if (orig_mat) {
+			if (orig_ob == ob1) {
 				// No need to change materian index for faces from left operand
 			}
 			else {
@@ -433,8 +440,8 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
 					int a;
 
 					mat_nr = 0;
-					for(a = 0; a < ob1->totcol; a++) {
-						if(give_current_material(ob1, a+1) == orig_mat) {
+					for (a = 0; a < ob1->totcol; a++) {
+						if (give_current_material(ob1, a+1) == orig_mat) {
 							mat_nr = a;
 							break;
 						}
@@ -456,14 +463,27 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
 
 		test_index_face(mface, &result->faceData, i, csgface.vertex_number);
 
-		if(origindex_layer && orig_ob == ob2)
+		if (origindex_layer && orig_ob == ob2)
 			origindex_layer[i] = ORIGINDEX_NONE;
 	}
 
 	if (material_hash)
 		BLI_ghash_free(material_hash, NULL, NULL);
 
-	CDDM_calc_edges(result);
+	CDDM_calc_edges_tessface(result);
+
+	CDDM_tessfaces_to_faces(result); /*builds ngon faces from tess (mface) faces*/
+
+	/* this fixes shading issues but SHOULD NOT.
+	 * TODO, find out why face normals are wrong & flicker - campbell */
+#if 0
+	DM_debug_print(result);
+
+	CustomData_free(&result->faceData, result->numTessFaceData);
+	result->numTessFaceData = 0;
+	DM_ensure_tessface(result);
+#endif
+
 	CDDM_calc_normals(result);
 
 	return result;
@@ -499,7 +519,7 @@ static DerivedMesh *NewBooleanDerivedMesh_intern(
 	DerivedMesh *result = NULL;
 
 	if (dm == NULL || dm_select == NULL) return 0;
-	if (!dm->getNumFaces(dm) || !dm_select->getNumFaces(dm_select)) return 0;
+	if (!dm->getNumTessFaces(dm) || !dm_select->getNumTessFaces(dm_select)) return 0;
 
 	// we map the final object back into ob's local coordinate space. For this
 	// we need to compute the inverse transform from global to ob (inv_mat),
@@ -531,7 +551,7 @@ static DerivedMesh *NewBooleanDerivedMesh_intern(
 		}
 		
 		BuildMeshDescriptors(dm_select, ob_select, 0, &fd_1, &vd_1);
-		BuildMeshDescriptors(dm, ob, dm_select->getNumFaces(dm_select) , &fd_2, &vd_2);
+		BuildMeshDescriptors(dm, ob, dm_select->getNumTessFaces(dm_select) , &fd_2, &vd_2);
 
 		bool_op = CSG_NewBooleanFunction();
 
@@ -584,9 +604,11 @@ int NewBooleanMesh(Scene *scene, Base *base, Base *base_select, int int_op_type)
 	mat= (Material**)MEM_mallocN(sizeof(Material*)*maxmat, "NewBooleanMeshMat");
 	
 	/* put some checks in for nice user feedback */
-	if (dm == NULL || dm_select == NULL) return 0;
-	if (!dm->getNumFaces(dm) || !dm_select->getNumFaces(dm_select))
-	{
+	if (dm == NULL || dm_select == NULL) {
+		return 0;
+	}
+
+	if (!dm->getNumTessFaces(dm) || !dm_select->getNumTessFaces(dm_select)) {
 		MEM_freeN(mat);
 		return -1;
 	}
@@ -602,7 +624,7 @@ int NewBooleanMesh(Scene *scene, Base *base, Base *base_select, int int_op_type)
 	ob_new= AddNewBlenderMesh(scene, base_select);
 	me_new= ob_new->data;
 
-	DM_to_mesh(result, me_new);
+	DM_to_mesh(result, me_new, ob_new);
 	result->release(result);
 
 	dm->release(dm);
diff --git a/source/blender/modifiers/intern/MOD_boolean_util.h b/source/blender/modifiers/intern/MOD_boolean_util.h
index dcd5460..6ba4940 100644
--- a/source/blender/modifiers/intern/MOD_boolean_util.h
+++ b/source/blender/modifiers/intern/MOD_boolean_util.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef MOD_BOOLEAN_UTILS_H
-#define MOD_BOOLEAN_UTILS_H
+#ifndef __MOD_BOOLEAN_UTIL_H__
+#define __MOD_BOOLEAN_UTIL_H__
 
 struct Scene;
 struct Object;
@@ -39,15 +39,15 @@ struct Base;
 struct DerivedMesh;
 
 /* Performs a boolean between two mesh objects, it is assumed that both objects
-   are in fact a mesh object. On success returns 1 and creates a new mesh object
-   into blender data structures. On failure returns 0 and reports an error. */
+ * are in fact a mesh object. On success returns 1 and creates a new mesh object
+ * into blender data structures. On failure returns 0 and reports an error. */
 int NewBooleanMesh(struct Scene *scene, struct Base *base, struct Base *base_select, int op);
 
 
 /* Performs a boolean between two mesh objects, it is assumed that both objects
-   are in fact mesh object. On success returns a DerivedMesh. On failure
-   returns NULL and reports an error. */
-   
+ * are in fact mesh object. On success returns a DerivedMesh. On failure
+ * returns NULL and reports an error. */
+
 struct DerivedMesh *NewBooleanDerivedMesh(struct DerivedMesh *dm, struct Object *ob, struct DerivedMesh *dm_select, struct Object *ob_select, int int_op_type);
 
 #endif // MOD_BOOLEAN_UTILS
diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c
index ebb5bd9..ddfb793 100644
--- a/source/blender/modifiers/intern/MOD_build.c
+++ b/source/blender/modifiers/intern/MOD_build.c
@@ -83,10 +83,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
 	DerivedMesh *dm = derivedData;
 	DerivedMesh *result;
 	BuildModifierData *bmd = (BuildModifierData*) md;
-	int i;
-	int numFaces_dst, numEdges_dst;
+	int i, j, k;
+	int numFaces_dst, numEdges_dst, numLoops_dst = 0;
 	int *vertMap, *edgeMap, *faceMap;
 	float frac;
+	MPoly *mpoly_dst;
+	MLoop *ml_dst, *ml_src /*, *mloop_dst */;
 	GHashIterator *hashIter;
 	/* maps vert indices in old mesh to indices in new mesh */
 	GHash *vertHash = BLI_ghash_new(BLI_ghashutil_inthash,
@@ -94,106 +96,114 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
 	/* maps edge indices in new mesh to indices in old mesh */
 	GHash *edgeHash = BLI_ghash_new(BLI_ghashutil_inthash,
 	                                BLI_ghashutil_intcmp, "build ed apply gh");
+	GHash *edgeHash2 = BLI_ghash_new(BLI_ghashutil_inthash,
+	                                 BLI_ghashutil_intcmp, "build ed apply gh");
+
+	const int numVert_src = dm->getNumVerts(dm);
+	const int numEdge_src = dm->getNumEdges(dm);
+	const int numPoly_src = dm->getNumPolys(dm);
+	MPoly *mpoly_src = dm->getPolyArray(dm);
+	MLoop *mloop_src = dm->getLoopArray(dm);
+	MEdge *medge_src = dm->getEdgeArray(dm);
+	MVert *mvert_src = dm->getVertArray(dm);
 
-	const int numVert_src= dm->getNumVerts(dm);
-	const int numEdge_src= dm->getNumEdges(dm);
-	const int numFace_src= dm->getNumFaces(dm);
 
 	vertMap = MEM_callocN(sizeof(*vertMap) * numVert_src, "build modifier vertMap");
 	for (i = 0; i < numVert_src; i++) vertMap[i] = i;
 	edgeMap = MEM_callocN(sizeof(*edgeMap) * numEdge_src, "build modifier edgeMap");
 	for (i = 0; i < numEdge_src; i++) edgeMap[i] = i;
-	faceMap = MEM_callocN(sizeof(*faceMap) * numFace_src, "build modifier faceMap");
-	for (i = 0; i < numFace_src; i++) faceMap[i] = i;
+	faceMap = MEM_callocN(sizeof(*faceMap) * numPoly_src, "build modifier faceMap");
+	for (i = 0; i < numPoly_src; i++) faceMap[i] = i;
 
 	frac = (BKE_curframe(md->scene) - bmd->start) / bmd->length;
 	CLAMP(frac, 0.0f, 1.0f);
 
-	numFaces_dst = dm->getNumFaces(dm) * frac;
-	numEdges_dst = dm->getNumEdges(dm) * frac;
+	numFaces_dst = numPoly_src * frac;
+	numEdges_dst = numEdge_src * frac;
 
 	/* if there's at least one face, build based on faces */
 	if (numFaces_dst) {
+		MPoly *mpoly, *mp;
+		MLoop *ml, *mloop;
+		MEdge *medge;
+		
 		if (bmd->randomize) {
 			BLI_array_randomize(faceMap, sizeof(*faceMap),
-			                    numFace_src, bmd->seed);
+			                    numPoly_src, bmd->seed);
 		}
 
 		/* get the set of all vert indices that will be in the final mesh,
 		 * mapped to the new indices
 		 */
+		mpoly = mpoly_src;
+		mloop = mloop_src;
 		for (i = 0; i < numFaces_dst; i++) {
-			MFace mf;
-			dm->getFace(dm, faceMap[i], &mf);
+			mp = mpoly + faceMap[i];
+			ml = mloop + mp->loopstart;
 
-			if (!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(mf.v1))) {
-				BLI_ghash_insert(vertHash, SET_INT_IN_POINTER(mf.v1),
-				                 SET_INT_IN_POINTER(BLI_ghash_size(vertHash)));
-			}
-			if (!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(mf.v2))) {
-				BLI_ghash_insert(vertHash, SET_INT_IN_POINTER(mf.v2),
-				                 SET_INT_IN_POINTER(BLI_ghash_size(vertHash)));
-			}
-			if (!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(mf.v3))) {
-				BLI_ghash_insert(vertHash, SET_INT_IN_POINTER(mf.v3),
-				                 SET_INT_IN_POINTER(BLI_ghash_size(vertHash)));
-			}
-			if (mf.v4 && !BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(mf.v4))) {
-				BLI_ghash_insert(vertHash, SET_INT_IN_POINTER(mf.v4),
-				                 SET_INT_IN_POINTER(BLI_ghash_size(vertHash)));
+			for (j=0; j<mp->totloop; j++, ml++) {
+				if (!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(ml->v)))
+					BLI_ghash_insert(vertHash, SET_INT_IN_POINTER(ml->v),
+					                 SET_INT_IN_POINTER(BLI_ghash_size(vertHash)));
 			}
+			
+			numLoops_dst += mp->totloop;
 		}
 
 		/* get the set of edges that will be in the new mesh (i.e. all edges
 		 * that have both verts in the new mesh)
 		 */
+		medge = medge_src;
 		for (i = 0; i < numEdge_src; i++) {
-			MEdge me;
-			dm->getEdge(dm, i, &me);
+			MEdge *me = medge + i;
 
-			if ( BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me.v1)) &&
-			     BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me.v2)))
+			if ( BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v1)) &&
+			     BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v2)))
 			{
-				BLI_ghash_insert(edgeHash, SET_INT_IN_POINTER(BLI_ghash_size(edgeHash)),
+				j = BLI_ghash_size(edgeHash);
+				
+				BLI_ghash_insert(edgeHash, SET_INT_IN_POINTER(j),
 				                 SET_INT_IN_POINTER(i));
+				BLI_ghash_insert(edgeHash2, SET_INT_IN_POINTER(i),
+				                 SET_INT_IN_POINTER(j));
 			}
 		}
 	}
 	else if (numEdges_dst) {
-		if (bmd->randomize) {
+		MEdge *medge, *me;
+
+		if (bmd->randomize)
 			BLI_array_randomize(edgeMap, sizeof(*edgeMap),
 			                    numEdge_src, bmd->seed);
-		}
 
 		/* get the set of all vert indices that will be in the final mesh,
 		 * mapped to the new indices
 		 */
+		medge = medge_src;
 		for (i = 0; i < numEdges_dst; i++) {
-			MEdge me;
-			dm->getEdge(dm, edgeMap[i], &me);
+			me = medge + edgeMap[i];
 
-			if (!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me.v1))) {
-				BLI_ghash_insert(vertHash, SET_INT_IN_POINTER(me.v1),
+			if (!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v1))) {
+				BLI_ghash_insert(vertHash, SET_INT_IN_POINTER(me->v1),
 				                 SET_INT_IN_POINTER(BLI_ghash_size(vertHash)));
 			}
-			if (!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me.v2))) {
-				BLI_ghash_insert(vertHash, SET_INT_IN_POINTER(me.v2),
-				                 SET_INT_IN_POINTER(BLI_ghash_size(vertHash)));
+			if (!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(me->v2))) {
+				BLI_ghash_insert(vertHash, SET_INT_IN_POINTER(me->v2), SET_INT_IN_POINTER(BLI_ghash_size(vertHash)));
 			}
 		}
 
-		/* get the set of edges that will be in the new mesh
-		 */
+		/* get the set of edges that will be in the new mesh */
 		for (i = 0; i < numEdges_dst; i++) {
-			MEdge me;
-			dm->getEdge(dm, edgeMap[i], &me);
-
-			BLI_ghash_insert(edgeHash, SET_INT_IN_POINTER(BLI_ghash_size(edgeHash)),
+			j = BLI_ghash_size(edgeHash);
+			
+			BLI_ghash_insert(edgeHash, SET_INT_IN_POINTER(j),
 			                 SET_INT_IN_POINTER(edgeMap[i]));
+			BLI_ghash_insert(edgeHash2,  SET_INT_IN_POINTER(edgeMap[i]),
+			                 SET_INT_IN_POINTER(j));
 		}
 	}
 	else {
-		int numVerts = dm->getNumVerts(dm) * frac;
+		int numVerts = numVert_src * frac;
 
 		if (bmd->randomize) {
 			BLI_array_randomize(vertMap, sizeof(*vertMap),
@@ -201,11 +211,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
 		}
 
 		/* get the set of all vert indices that will be in the final mesh,
-		* mapped to the new indices
-		*/
+		 * mapped to the new indices
+		 */
 		for (i = 0; i < numVerts; i++) {
-			BLI_ghash_insert(vertHash, SET_INT_IN_POINTER(vertMap[i]),
-			                 SET_INT_IN_POINTER(i));
+			BLI_ghash_insert(vertHash, SET_INT_IN_POINTER(vertMap[i]), SET_INT_IN_POINTER(i));
 		}
 	}
 
@@ -213,19 +222,20 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
 	 * the mesh
 	 */
 	result = CDDM_from_template(dm, BLI_ghash_size(vertHash),
-	                            BLI_ghash_size(edgeHash), numFaces_dst);
+	                            BLI_ghash_size(edgeHash), 0, numLoops_dst, numFaces_dst);
 
 	/* copy the vertices across */
 	for ( hashIter = BLI_ghashIterator_new(vertHash);
 	      !BLI_ghashIterator_isDone(hashIter);
-	      BLI_ghashIterator_step(hashIter))
+	      BLI_ghashIterator_step(hashIter)
+	      )
 	{
 		MVert source;
 		MVert *dest;
 		int oldIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(hashIter));
 		int newIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(hashIter));
 
-		dm->getVert(dm, oldIndex, &source);
+		source = mvert_src [oldIndex];
 		dest = CDDM_get_vert(result, newIndex);
 
 		DM_copy_vert_data(dm, result, oldIndex, newIndex, 1);
@@ -239,7 +249,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
 		MEdge *dest;
 		int oldIndex = GET_INT_FROM_POINTER(BLI_ghash_lookup(edgeHash, SET_INT_IN_POINTER(i)));
 		
-		dm->getEdge(dm, oldIndex, &source);
+		source = medge_src[oldIndex];
 		dest = CDDM_get_edge(result, i);
 		
 		source.v1 = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source.v1)));
@@ -249,33 +259,34 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
 		*dest = source;
 	}
 
+	mpoly_dst = CDDM_get_polys(result);
+	/* mloop_dst = */ ml_dst = CDDM_get_loops(result);
+	
 	/* copy the faces across, remapping indices */
+	k = 0;
 	for (i = 0; i < numFaces_dst; i++) {
-		MFace source;
-		MFace *dest;
-		int orig_v4;
+		MPoly *source;
+		MPoly *dest;
 		
-		dm->getFace(dm, faceMap[i], &source);
-		dest = CDDM_get_face(result, i);
+		source = mpoly_src + faceMap[i];
+		dest = mpoly_dst + i;
+		DM_copy_poly_data(dm, result, faceMap[i], i, 1);
 		
-		orig_v4 = source.v4;
+		*dest = *source;
+		dest->loopstart = k;
 		
-		source.v1 = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source.v1)));
-		source.v2 = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source.v2)));
-		source.v3 = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source.v3)));
-		if (source.v4)
-			source.v4 = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source.v4)));
-		
-		DM_copy_face_data(dm, result, faceMap[i], i, 1);
-		*dest = source;
-		
-		test_index_face(dest, &result->faceData, i, (orig_v4 ? 4 : 3));
-	}
+		DM_copy_loop_data(dm, result, source->loopstart, dest->loopstart, dest->totloop);
 
-	CDDM_calc_normals(result);
+		ml_src = mloop_src + source->loopstart;
+		for (j=0; j<source->totloop; j++, k++, ml_src++, ml_dst++) {
+			ml_dst->v = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(ml_src->v)));
+			ml_dst->e = GET_INT_FROM_POINTER(BLI_ghash_lookup(edgeHash2, SET_INT_IN_POINTER(ml_src->e)));
+		}
+	}
 
 	BLI_ghash_free(vertHash, NULL, NULL);
 	BLI_ghash_free(edgeHash, NULL, NULL);
+	BLI_ghash_free(edgeHash2, NULL, NULL);
 	
 	MEM_freeN(vertMap);
 	MEM_freeN(edgeMap);
diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c
index 78bebc0..1594011 100644
--- a/source/blender/modifiers/intern/MOD_cast.c
+++ b/source/blender/modifiers/intern/MOD_cast.c
@@ -86,7 +86,7 @@ static int isDisabled(ModifierData *md, int UNUSED(useRenderParams))
 	
 	flag = cmd->flag & (MOD_CAST_X|MOD_CAST_Y|MOD_CAST_Z);
 
-	if((cmd->fac == 0.0f) || flag == 0) return 1;
+	if ((cmd->fac == 0.0f) || flag == 0) return 1;
 
 	return 0;
 }
@@ -97,7 +97,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
 	CustomDataMask dataMask = 0;
 
 	/* ask for vertexgroups if we need them */
-	if(cmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+	if (cmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
 
 	return dataMask;
 }
@@ -154,10 +154,10 @@ static void sphere_do(
 	ctrl_ob = cmd->object;
 
 	/* spherify's center is {0, 0, 0} (the ob's own center in its local
-	* space), by default, but if the user defined a control object,
-	* we use its location, transformed to ob's local space */
+	 * space), by default, but if the user defined a control object,
+	 * we use its location, transformed to ob's local space */
 	if (ctrl_ob) {
-		if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+		if (flag & MOD_CAST_USE_OB_TRANSFORM) {
 			invert_m4_m4(ctrl_ob->imat, ctrl_ob->obmat);
 			mult_m4_m4m4(mat, ctrl_ob->imat, ob->obmat);
 			invert_m4_m4(imat, mat);
@@ -171,21 +171,21 @@ static void sphere_do(
 
 	/* 1) (flag was checked in the "if (ctrl_ob)" block above) */
 	/* 2) cmd->radius > 0.0f: only the vertices within this radius from
-	* the center of the effect should be deformed */
+	 * the center of the effect should be deformed */
 	if (cmd->radius > FLT_EPSILON) has_radius = 1;
 
 	/* 3) if we were given a vertex group name,
-	* only those vertices should be affected */
+	 * only those vertices should be affected */
 	modifier_get_vgroup(ob, dm, cmd->defgrp_name, &dvert, &defgrp_index);
 
-	if(flag & MOD_CAST_SIZE_FROM_RADIUS) {
+	if (flag & MOD_CAST_SIZE_FROM_RADIUS) {
 		len = cmd->radius;
 	}
 	else {
 		len = cmd->size;
 	}
 
-	if(len <= 0) {
+	if (len <= 0) {
 		for (i = 0; i < numVerts; i++) {
 			len += len_v3v3(center, vertexCos[i]);
 		}
@@ -195,10 +195,10 @@ static void sphere_do(
 	}
 
 	/* ready to apply the effect, one vertex at a time;
-	* tiny optimization: the code is separated (with parts repeated)
+	 * tiny optimization: the code is separated (with parts repeated)
 	 * in two possible cases:
-	* with or w/o a vgroup. With lots of if's in the code below,
-	* further optimizations are possible, if needed */
+	 * with or w/o a vgroup. With lots of if's in the code below,
+	 * further optimization's are possible, if needed */
 	if (dvert) { /* with a vgroup */
 		MDeformVert *dv= dvert;
 		float fac_orig = fac;
@@ -207,10 +207,11 @@ static void sphere_do(
 			float weight;
 
 			copy_v3_v3(tmp_co, vertexCos[i]);
-			if(ctrl_ob) {
-				if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+			if (ctrl_ob) {
+				if (flag & MOD_CAST_USE_OB_TRANSFORM) {
 					mul_m4_v3(mat, tmp_co);
-				} else {
+				}
+				else {
 					sub_v3_v3(tmp_co, center);
 				}
 			}
@@ -239,10 +240,11 @@ static void sphere_do(
 			if (flag & MOD_CAST_Z)
 				tmp_co[2] = fac*vec[2]*len + facm*tmp_co[2];
 
-			if(ctrl_ob) {
-				if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+			if (ctrl_ob) {
+				if (flag & MOD_CAST_USE_OB_TRANSFORM) {
 					mul_m4_v3(imat, tmp_co);
-				} else {
+				}
+				else {
 					add_v3_v3(tmp_co, center);
 				}
 			}
@@ -257,10 +259,11 @@ static void sphere_do(
 		float tmp_co[3];
 
 		copy_v3_v3(tmp_co, vertexCos[i]);
-		if(ctrl_ob) {
-			if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+		if (ctrl_ob) {
+			if (flag & MOD_CAST_USE_OB_TRANSFORM) {
 				mul_m4_v3(mat, tmp_co);
-			} else {
+			}
+			else {
 				sub_v3_v3(tmp_co, center);
 			}
 		}
@@ -283,10 +286,11 @@ static void sphere_do(
 		if (flag & MOD_CAST_Z)
 			tmp_co[2] = fac*vec[2]*len + facm*tmp_co[2];
 
-		if(ctrl_ob) {
-			if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+		if (ctrl_ob) {
+			if (flag & MOD_CAST_USE_OB_TRANSFORM) {
 				mul_m4_v3(imat, tmp_co);
-			} else {
+			}
+			else {
 				add_v3_v3(tmp_co, center);
 			}
 		}
@@ -321,15 +325,15 @@ static void cuboid_do(
 
 	/* 1) (flag was checked in the "if (ctrl_ob)" block above) */
 	/* 2) cmd->radius > 0.0f: only the vertices within this radius from
-	* the center of the effect should be deformed */
+	 * the center of the effect should be deformed */
 	if (cmd->radius > FLT_EPSILON) has_radius = 1;
 
 	/* 3) if we were given a vertex group name,
-	* only those vertices should be affected */
+	 * only those vertices should be affected */
 	modifier_get_vgroup(ob, dm, cmd->defgrp_name, &dvert, &defgrp_index);
 
 	if (ctrl_ob) {
-		if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+		if (flag & MOD_CAST_USE_OB_TRANSFORM) {
 			invert_m4_m4(ctrl_ob->imat, ctrl_ob->obmat);
 			mult_m4_m4m4(mat, ctrl_ob->imat, ob->obmat);
 			invert_m4_m4(imat, mat);
@@ -339,25 +343,27 @@ static void cuboid_do(
 		mul_v3_m4v3(center, ob->imat, ctrl_ob->obmat[3]);
 	}
 
-	if((flag & MOD_CAST_SIZE_FROM_RADIUS) && has_radius) {
-		for(i = 0; i < 3; i++) {
+	if ((flag & MOD_CAST_SIZE_FROM_RADIUS) && has_radius) {
+		for (i = 0; i < 3; i++) {
 			min[i] = -cmd->radius;
 			max[i] = cmd->radius;
 		}
-	} else if(!(flag & MOD_CAST_SIZE_FROM_RADIUS) && cmd->size > 0) {
-		for(i = 0; i < 3; i++) {
+	}
+	else if (!(flag & MOD_CAST_SIZE_FROM_RADIUS) && cmd->size > 0) {
+		for (i = 0; i < 3; i++) {
 			min[i] = -cmd->size;
 			max[i] = cmd->size;
 		}
-	} else {
+	}
+	else {
 		/* get bound box */
 		/* We can't use the object's bound box because other modifiers
-		* may have changed the vertex data. */
+		 * may have changed the vertex data. */
 		INIT_MINMAX(min, max);
 
 		/* Cast's center is the ob's own center in its local space,
-		* by default, but if the user defined a control object, we use
-		* its location, transformed to ob's local space. */
+		 * by default, but if the user defined a control object, we use
+		 * its location, transformed to ob's local space. */
 		if (ctrl_ob) {
 			float vec[3];
 
@@ -393,10 +399,10 @@ static void cuboid_do(
 	bb[4][2] = bb[5][2] = bb[6][2] = bb[7][2] = max[2];
 
 	/* ready to apply the effect, one vertex at a time;
-	* tiny optimization: the code is separated (with parts repeated)
+	 * tiny optimization: the code is separated (with parts repeated)
 	 * in two possible cases:
-	* with or w/o a vgroup. With lots of if's in the code below,
-	* further optimizations are possible, if needed */
+	 * with or w/o a vgroup. With lots of if's in the code below,
+	 * further optimization's are possible, if needed */
 	if (dvert) { /* with a vgroup */
 		float fac_orig = fac;
 		for (i = 0; i < numVerts; i++) {
@@ -406,10 +412,11 @@ static void cuboid_do(
 			float tmp_co[3];
 
 			copy_v3_v3(tmp_co, vertexCos[i]);
-			if(ctrl_ob) {
-				if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+			if (ctrl_ob) {
+				if (flag & MOD_CAST_USE_OB_TRANSFORM) {
 					mul_m4_v3(mat, tmp_co);
-				} else {
+				}
+				else {
 					sub_v3_v3(tmp_co, center);
 				}
 			}
@@ -421,7 +428,7 @@ static void cuboid_do(
 			}
 
 			for (j = 0; j < dvert[i].totweight; ++j) {
-				if(dvert[i].dw[j].def_nr == defgrp_index) {
+				if (dvert[i].dw[j].def_nr == defgrp_index) {
 					dw = &dvert[i].dw[j];
 					break;
 				}
@@ -434,10 +441,10 @@ static void cuboid_do(
 			/* The algo used to project the vertices to their
 			 * bounding box (bb) is pretty simple:
 			 * for each vertex v:
-			* 1) find in which octant v is in;
-			* 2) find which outer "wall" of that octant is closer to v;
-			* 3) calculate factor (var fbb) to project v to that wall;
-			* 4) project. */
+			 * 1) find in which octant v is in;
+			 * 2) find which outer "wall" of that octant is closer to v;
+			 * 3) calculate factor (var fbb) to project v to that wall;
+			 * 4) project. */
 
 			/* find in which octant this vertex is in */
 			octant = 0;
@@ -471,7 +478,7 @@ static void cuboid_do(
 				continue;
 
 			/* finally, this is the factor we wanted, to project the vertex
-			* to its bounding box (bb) */
+			 * to its bounding box (bb) */
 			fbb = apex[coord] / tmp_co[coord];
 
 			/* calculate the new vertex position */
@@ -482,10 +489,11 @@ static void cuboid_do(
 			if (flag & MOD_CAST_Z)
 				tmp_co[2] = facm * tmp_co[2] + fac * tmp_co[2] * fbb;
 
-			if(ctrl_ob) {
-				if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+			if (ctrl_ob) {
+				if (flag & MOD_CAST_USE_OB_TRANSFORM) {
 					mul_m4_v3(imat, tmp_co);
-				} else {
+				}
+				else {
 					add_v3_v3(tmp_co, center);
 				}
 			}
@@ -502,10 +510,11 @@ static void cuboid_do(
 		float tmp_co[3];
 
 		copy_v3_v3(tmp_co, vertexCos[i]);
-		if(ctrl_ob) {
-			if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+		if (ctrl_ob) {
+			if (flag & MOD_CAST_USE_OB_TRANSFORM) {
 				mul_m4_v3(mat, tmp_co);
-			} else {
+			}
+			else {
 				sub_v3_v3(tmp_co, center);
 			}
 		}
@@ -550,10 +559,11 @@ static void cuboid_do(
 		if (flag & MOD_CAST_Z)
 			tmp_co[2] = facm * tmp_co[2] + fac * tmp_co[2] * fbb;
 
-		if(ctrl_ob) {
-			if(flag & MOD_CAST_USE_OB_TRANSFORM) {
+		if (ctrl_ob) {
+			if (flag & MOD_CAST_USE_OB_TRANSFORM) {
 				mul_m4_v3(imat, tmp_co);
-			} else {
+			}
+			else {
 				add_v3_v3(tmp_co, center);
 			}
 		}
@@ -576,16 +586,17 @@ static void deformVerts(ModifierData *md, Object *ob,
 
 	if (cmd->type == MOD_CAST_TYPE_CUBOID) {
 		cuboid_do(cmd, ob, dm, vertexCos, numVerts);
-	} else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */
+	}
+	else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */
 		sphere_do(cmd, ob, dm, vertexCos, numVerts);
 	}
 
-	if(dm != derivedData)
+	if (dm != derivedData)
 		dm->release(dm);
 }
 
 static void deformVertsEM(
-					   ModifierData *md, Object *ob, struct EditMesh *editData,
+					   ModifierData *md, Object *ob, struct BMEditMesh *editData,
 	   DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
 {
 	DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, 0);
@@ -593,11 +604,12 @@ static void deformVertsEM(
 
 	if (cmd->type == MOD_CAST_TYPE_CUBOID) {
 		cuboid_do(cmd, ob, dm, vertexCos, numVerts);
-	} else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */
+	}
+	else { /* MOD_CAST_TYPE_SPHERE or MOD_CAST_TYPE_CYLINDER */
 		sphere_do(cmd, ob, dm, vertexCos, numVerts);
 	}
 
-	if(dm != derivedData)
+	if (dm != derivedData)
 		dm->release(dm);
 }
 
diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c
index fdb584e..d5d8439 100644
--- a/source/blender/modifiers/intern/MOD_cloth.c
+++ b/source/blender/modifiers/intern/MOD_cloth.c
@@ -61,7 +61,7 @@ static void initData(ModifierData *md)
 	clmd->point_cache = BKE_ptcache_add(&clmd->ptcaches);
 	
 	/* check for alloc failing */
-	if(!clmd->sim_parms || !clmd->coll_parms || !clmd->point_cache)
+	if (!clmd->sim_parms || !clmd->coll_parms || !clmd->point_cache)
 		return;
 	
 	cloth_init (clmd);
@@ -75,23 +75,24 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
 	DerivedMesh *result=NULL;
 	
 	/* check for alloc failing */
-	if(!clmd->sim_parms || !clmd->coll_parms)
-	{
+	if (!clmd->sim_parms || !clmd->coll_parms) {
 		initData(md);
 
-		if(!clmd->sim_parms || !clmd->coll_parms)
+		if (!clmd->sim_parms || !clmd->coll_parms)
 			return;
 	}
 
 	dm = get_dm(ob, NULL, derivedData, NULL, 0);
-	if(dm == derivedData)
+	if (dm == derivedData)
 		dm = CDDM_copy(dm);
 
 	CDDM_apply_vert_coords(dm, vertexCos);
 
+	DM_ensure_tessface(dm); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
+
 	clothModifier_do(clmd, md->scene, ob, dm, vertexCos);
 
-	if(result) {
+	if (result) {
 		result->getVertCos(result, vertexCos);
 		result->release(result);
 	}
@@ -99,24 +100,18 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
 	dm->release(dm);
 }
 
-static void updateDepgraph(
-					 ModifierData *md, DagForest *forest, Scene *scene, Object *ob,
-	  DagNode *obNode)
+static void updateDepgraph(ModifierData *md, DagForest *forest, Scene *scene, Object *ob, DagNode *obNode)
 {
 	ClothModifierData *clmd = (ClothModifierData*) md;
 	
 	Base *base;
 	
-	if(clmd)
-	{
-		for(base = scene->base.first; base; base= base->next) 
-		{
+	if (clmd) {
+		for (base = scene->base.first; base; base= base->next) {
 			Object *ob1= base->object;
-			if(ob1 != ob)
-			{
+			if (ob1 != ob) {
 				CollisionModifierData *coll_clmd = (CollisionModifierData *)modifiers_findByType(ob1, eModifierType_Collision);
-				if(coll_clmd)
-				{
+				if (coll_clmd) {
 					DagNode *curNode = dag_get_node(forest, ob1);
 					dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Cloth Collision");
 				}
@@ -130,10 +125,10 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
 	CustomDataMask dataMask = 0;
 	ClothModifierData *clmd = (ClothModifierData*)md;
 
-	if(cloth_uses_vgroup(clmd))
+	if (cloth_uses_vgroup(clmd))
 		dataMask |= CD_MASK_MDEFORMVERT;
 
-	if(clmd->sim_parms->shapekey_rest != 0)
+	if (clmd->sim_parms->shapekey_rest != 0)
 		dataMask |= CD_MASK_CLOTH_ORCO;
 
 	return dataMask;
@@ -144,20 +139,20 @@ static void copyData(ModifierData *md, ModifierData *target)
 	ClothModifierData *clmd = (ClothModifierData*) md;
 	ClothModifierData *tclmd = (ClothModifierData*) target;
 
-	if(tclmd->sim_parms) {
-		if(tclmd->sim_parms->effector_weights)
+	if (tclmd->sim_parms) {
+		if (tclmd->sim_parms->effector_weights)
 			MEM_freeN(tclmd->sim_parms->effector_weights);
 		MEM_freeN(tclmd->sim_parms);
 	}
 
-	if(tclmd->coll_parms)
+	if (tclmd->coll_parms)
 		MEM_freeN(tclmd->coll_parms);
 	
 	BKE_ptcache_free_list(&tclmd->ptcaches);
 	tclmd->point_cache = NULL;
 
 	tclmd->sim_parms = MEM_dupallocN(clmd->sim_parms);
-	if(clmd->sim_parms->effector_weights)
+	if (clmd->sim_parms->effector_weights)
 		tclmd->sim_parms->effector_weights = MEM_dupallocN(clmd->sim_parms->effector_weights);
 	tclmd->coll_parms = MEM_dupallocN(clmd->coll_parms);
 	tclmd->point_cache = BKE_ptcache_copy_list(&tclmd->ptcaches, &clmd->ptcaches);
@@ -173,19 +168,18 @@ static void freeData(ModifierData *md)
 {
 	ClothModifierData *clmd = (ClothModifierData*) md;
 	
-	if (clmd) 
-	{
-		if(G.rt > 0)
+	if (clmd) {
+		if (G.rt > 0)
 			printf("clothModifier_freeData\n");
 		
 		cloth_free_modifier_extern (clmd);
 		
-		if(clmd->sim_parms) {
-			if(clmd->sim_parms->effector_weights)
+		if (clmd->sim_parms) {
+			if (clmd->sim_parms->effector_weights)
 				MEM_freeN(clmd->sim_parms->effector_weights);
 			MEM_freeN(clmd->sim_parms);
 		}
-		if(clmd->coll_parms)
+		if (clmd->coll_parms)
 			MEM_freeN(clmd->coll_parms);	
 		
 		BKE_ptcache_free_list(&clmd->ptcaches);
@@ -198,11 +192,11 @@ static void foreachIDLink(ModifierData *md, Object *ob,
 {
 	ClothModifierData *clmd = (ClothModifierData*) md;
 
-	if(clmd->coll_parms) {
+	if (clmd->coll_parms) {
 		walk(userData, ob, (ID **)&clmd->coll_parms->group);
 	}
 
-	if(clmd->sim_parms && clmd->sim_parms->effector_weights) {
+	if (clmd->sim_parms && clmd->sim_parms->effector_weights) {
 		walk(userData, ob, (ID **)&clmd->sim_parms->effector_weights->group);
 	}
 }
diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c
index 0cd3481..b3faf6c 100644
--- a/source/blender/modifiers/intern/MOD_collision.c
+++ b/source/blender/modifiers/intern/MOD_collision.c
@@ -73,19 +73,19 @@ static void freeData(ModifierData *md)
 	
 	if (collmd) 
 	{
-		if(collmd->bvhtree)
+		if (collmd->bvhtree)
 			BLI_bvhtree_free(collmd->bvhtree);
-		if(collmd->x)
+		if (collmd->x)
 			MEM_freeN(collmd->x);
-		if(collmd->xnew)
+		if (collmd->xnew)
 			MEM_freeN(collmd->xnew);
-		if(collmd->current_x)
+		if (collmd->current_x)
 			MEM_freeN(collmd->current_x);
-		if(collmd->current_xnew)
+		if (collmd->current_xnew)
 			MEM_freeN(collmd->current_xnew);
-		if(collmd->current_v)
+		if (collmd->current_v)
 			MEM_freeN(collmd->current_v);
-		if(collmd->mfaces)
+		if (collmd->mfaces)
 			MEM_freeN(collmd->mfaces);
 		
 		collmd->x = NULL;
@@ -117,16 +117,16 @@ static void deformVerts(ModifierData *md, Object *ob,
 	MVert *tempVert = NULL;
 	
 	/* if possible use/create DerivedMesh */
-	if(derivedData) dm = CDDM_copy(derivedData);
-	else if(ob->type==OB_MESH) dm = CDDM_from_mesh(ob->data, ob);
+	if (derivedData) dm = CDDM_copy(derivedData);
+	else if (ob->type==OB_MESH) dm = CDDM_from_mesh(ob->data, ob);
 	
-	if(!ob->pd)
+	if (!ob->pd)
 	{
 		printf("CollisionModifier deformVerts: Should not happen!\n");
 		return;
 	}
 	
-	if(dm)
+	if (dm)
 	{
 		float current_time = 0;
 		unsigned int numverts = 0;
@@ -136,20 +136,20 @@ static void deformVerts(ModifierData *md, Object *ob,
 		
 		current_time = BKE_curframe(md->scene);
 		
-		if(G.rt > 0)
+		if (G.rt > 0)
 			printf("current_time %f, collmd->time_xnew %f\n", current_time, collmd->time_xnew);
 		
 		numverts = dm->getNumVerts ( dm );
 		
-		if((current_time > collmd->time_xnew)|| (BKE_ptcache_get_continue_physics()))
+		if ((current_time > collmd->time_xnew)|| (BKE_ptcache_get_continue_physics()))
 		{
 			unsigned int i;
 
 			// check if mesh has changed
-			if(collmd->x && (numverts != collmd->numverts))
+			if (collmd->x && (numverts != collmd->numverts))
 				freeData((ModifierData *)collmd);
 			
-			if(collmd->time_xnew == -1000) // first time
+			if (collmd->time_xnew == -1000) // first time
 			{
 				collmd->x = dm->dupVertArray(dm); // frame start position
 				
@@ -166,16 +166,17 @@ static void deformVerts(ModifierData *md, Object *ob,
 
 				collmd->numverts = numverts;
 				
-				collmd->mfaces = dm->dupFaceArray(dm);
-				collmd->numfaces = dm->getNumFaces(dm);
+				DM_ensure_tessface(dm); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
+
+				collmd->mfaces = dm->dupTessFaceArray(dm);
+				collmd->numfaces = dm->getNumTessFaces(dm);
 				
 				// create bounding box hierarchy
 				collmd->bvhtree = bvhtree_build_from_mvert(collmd->mfaces, collmd->numfaces, collmd->x, numverts, ob->pd->pdef_sboft);
 				
 				collmd->time_x = collmd->time_xnew = current_time;
 			}
-			else if(numverts == collmd->numverts)
-			{
+			else if (numverts == collmd->numverts) {
 				// put positions to old positions
 				tempVert = collmd->x;
 				collmd->x = collmd->xnew;
@@ -184,8 +185,7 @@ static void deformVerts(ModifierData *md, Object *ob,
 				
 				memcpy(collmd->xnew, dm->getVertArray(dm), numverts*sizeof(MVert));
 				
-				for ( i = 0; i < numverts; i++ )
-				{
+				for (i = 0; i < numverts; i++) {
 					// we save global positions
 					mul_m4_v3( ob->obmat, collmd->xnew[i].co );
 				}
@@ -194,10 +194,8 @@ static void deformVerts(ModifierData *md, Object *ob,
 				memcpy(collmd->current_x, collmd->x, numverts*sizeof(MVert));
 				
 				/* check if GUI setting has changed for bvh */
-				if(collmd->bvhtree) 
-				{
-					if(ob->pd->pdef_sboft != BLI_bvhtree_getepsilon(collmd->bvhtree))
-					{
+				if (collmd->bvhtree) {
+					if (ob->pd->pdef_sboft != BLI_bvhtree_getepsilon(collmd->bvhtree)) {
 						BLI_bvhtree_free(collmd->bvhtree);
 						collmd->bvhtree = bvhtree_build_from_mvert(collmd->mfaces, collmd->numfaces, collmd->current_x, numverts, ob->pd->pdef_sboft);
 					}
@@ -205,38 +203,32 @@ static void deformVerts(ModifierData *md, Object *ob,
 				}
 				
 				/* happens on file load (ONLY when i decomment changes in readfile.c) */
-				if(!collmd->bvhtree)
-				{
+				if (!collmd->bvhtree) {
 					collmd->bvhtree = bvhtree_build_from_mvert(collmd->mfaces, collmd->numfaces, collmd->current_x, numverts, ob->pd->pdef_sboft);
 				}
-				else
-				{
+				else {
 					// recalc static bounding boxes
 					bvhtree_update_from_mvert ( collmd->bvhtree, collmd->mfaces, collmd->numfaces, collmd->current_x, collmd->current_xnew, collmd->numverts, 1 );
 				}
 				
 				collmd->time_xnew = current_time;
 			}
-			else if(numverts != collmd->numverts)
-			{
+			else if (numverts != collmd->numverts) {
 				freeData((ModifierData *)collmd);
 			}
 			
 		}
-		else if(current_time < collmd->time_xnew)
-		{	
+		else if (current_time < collmd->time_xnew) {
 			freeData((ModifierData *)collmd);
 		}
-		else
-		{
-			if(numverts != collmd->numverts)
-			{
+		else {
+			if (numverts != collmd->numverts) {
 				freeData((ModifierData *)collmd);
 			}
 		}
 	}
 	
-	if(dm)
+	if (dm)
 		dm->release(dm);
 }
 
diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c
index 5ce05e5..f516f97 100644
--- a/source/blender/modifiers/intern/MOD_curve.c
+++ b/source/blender/modifiers/intern/MOD_curve.c
@@ -73,7 +73,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
 	CustomDataMask dataMask = 0;
 
 	/* ask for vertexgroups if we need them */
-	if(cmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+	if (cmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT;
 
 	return dataMask;
 }
@@ -126,16 +126,16 @@ static void deformVerts(ModifierData *md, Object *ob,
 }
 
 static void deformVertsEM(
-					ModifierData *md, Object *ob, struct EditMesh *editData,
+					ModifierData *md, Object *ob, struct BMEditMesh *editData,
 	 DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
 {
 	DerivedMesh *dm = derivedData;
 
-	if(!derivedData) dm = CDDM_from_editmesh(editData, ob->data);
+	if (!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
 
 	deformVerts(md, ob, dm, vertexCos, numVerts, 0, 0);
 
-	if(!derivedData) dm->release(dm);
+	if (!derivedData) dm->release(dm);
 }
 
 
diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c
index d109234..f55faf9 100644
--- a/source/blender/modifiers/intern/MOD_decimate.c
+++ b/source/blender/modifiers/intern/MOD_decimate.c
@@ -38,6 +38,8 @@
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
 
+#include "BLF_translation.h"
+
 #include "MEM_guardedalloc.h"
 
 #include "BKE_mesh.h"
@@ -81,10 +83,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
 	int totvert, totface;
 	int a, numTris;
 
+	DM_ensure_tessface(dm); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
+
 	mvert = dm->getVertArray(dm);
-	mface = dm->getFaceArray(dm);
+	mface = dm->getTessFaceArray(dm);
 	totvert = dm->getNumVerts(dm);
-	totface = dm->getNumFaces(dm);
+	totface = dm->getNumTessFaces(dm);
 
 	numTris = 0;
 	for (a=0; a<totface; a++) {
@@ -93,10 +97,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
 		if (mf->v4) numTris++;
 	}
 
-	if(numTris<3) {
-		modifier_setError(md,
-			"Modifier requires more than 3 input faces (triangles).");
-		goto exit;
+	if (numTris<3) {
+		modifier_setError(md, "%s", TIP_("Modifier requires more than 3 input faces (triangles)."));
+		dm = CDDM_copy(dm);
+		return dm;
 	}
 
 	lod.vertex_buffer= MEM_mallocN(3*sizeof(float)*totvert, "vertices");
@@ -105,7 +109,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
 	lod.vertex_num= totvert;
 	lod.face_num= numTris;
 
-	for(a=0; a<totvert; a++) {
+	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];
@@ -115,14 +119,14 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
 	}
 
 	numTris = 0;
-	for(a=0; a<totface; a++) {
+	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) {
+		if (mf->v4) {
 			tri = &lod.triangle_index_buffer[3*numTris++];
 			tri[0]= mf->v1;
 			tri[1]= mf->v3;
@@ -131,32 +135,32 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
 	}
 
 	dmd->faceCount = 0;
-	if(LOD_LoadMesh(&lod) ) {
-		if( LOD_PreprocessMesh(&lod) ) {
+	if (LOD_LoadMesh(&lod) ) {
+		if ( LOD_PreprocessMesh(&lod) ) {
 			/* we assume the decim_faces tells how much to reduce */
 
-			while(lod.face_num > numTris*dmd->percent) {
-				if( LOD_CollapseEdge(&lod)==0) break;
+			while (lod.face_num > numTris*dmd->percent) {
+				if ( LOD_CollapseEdge(&lod)==0) break;
 			}
 
-			if(lod.vertex_num>2) {
-				result = CDDM_new(lod.vertex_num, 0, lod.face_num);
+			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);
+				result = CDDM_new(lod.vertex_num, 0, 0, 0, 0);
 
 			mvert = CDDM_get_verts(result);
-			for(a=0; a<lod.vertex_num; a++) {
+			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(lod.vertex_num>2) {
-				mface = CDDM_get_faces(result);
-				for(a=0; a<lod.face_num; a++) {
+			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];
@@ -166,23 +170,28 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
 				}
 			}
 
-			CDDM_calc_edges(result);
-			CDDM_calc_normals(result);
+			CDDM_calc_edges_tessface(result);
 		}
 		else
-			modifier_setError(md, "Out of memory.");
+			modifier_setError(md, "%s", TIP_("Out of memory."));
 
 		LOD_FreeDecimationData(&lod);
 	}
 	else
-		modifier_setError(md, "Non-manifold mesh as input.");
+		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);
 
-exit:
+	if (result) {
+		CDDM_tessfaces_to_faces(result); /*builds ngon faces from tess (mface) faces*/
+
 		return result;
+	}
+	else {
+		return dm;
+	}
 }
 #else // WITH_MOD_DECIMATE
 static DerivedMesh *applyModifier(ModifierData *UNUSED(md), Object *UNUSED(ob),
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c
index 1ac11da..293a8a8 100644
--- a/source/blender/modifiers/intern/MOD_displace.c
+++ b/source/blender/modifiers/intern/MOD_displace.c
@@ -87,10 +87,10 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
 	CustomDataMask dataMask = 0;
 
 	/* ask for vertexgroups if we need them */
-	if(dmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+	if (dmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
 
 	/* ask for UV coordinates if we need them */
-	if(dmd->texmapping == MOD_DISP_MAP_UV) dataMask |= CD_MASK_MTFACE;
+	if (dmd->texmapping == MOD_DISP_MAP_UV) dataMask |= CD_MASK_MTFACE;
 
 	return dataMask;
 }
@@ -99,12 +99,10 @@ static int dependsOnTime(ModifierData *md)
 {
 	DisplaceModifierData *dmd = (DisplaceModifierData *)md;
 
-	if(dmd->texture)
-	{
+	if (dmd->texture) {
 		return BKE_texture_dependsOnTime(dmd->texture);
 	}
-	else
-	{
+	else {
 		return 0;
 	}
 }
@@ -153,7 +151,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
 {
 	DisplaceModifierData *dmd = (DisplaceModifierData*) md;
 
-	if(dmd->map_object && dmd->texmapping == MOD_DISP_MAP_OBJECT) {
+	if (dmd->map_object && dmd->texmapping == MOD_DISP_MAP_OBJECT) {
 		DagNode *curNode = dag_get_node(forest, dmd->map_object);
 
 		dag_add_relation(forest, curNode, obNode,
@@ -161,7 +159,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
 	}
 	
 
-	if(dmd->texmapping == MOD_DISP_MAP_GLOBAL)
+	if (dmd->texmapping == MOD_DISP_MAP_GLOBAL)
 		dag_add_relation(forest, obNode, obNode,
 		                 DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Displace Modifier");
 	
@@ -179,8 +177,8 @@ static void displaceModifier_do(
 	float (*tex_co)[3];
 	float weight= 1.0f; /* init value unused but some compilers may complain */
 
-	if(!dmd->texture) return;
-	if(dmd->strength == 0.0f) return;
+	if (!dmd->texture) return;
+	if (dmd->strength == 0.0f) return;
 
 	mvert = CDDM_get_verts(dm);
 	modifier_get_vgroup(ob, dm, dmd->defgrp_name, &dvert, &defgrp_index);
@@ -189,13 +187,15 @@ static void displaceModifier_do(
 				 "displaceModifier_do tex_co");
 	get_texture_coords((MappingInfoModifierData *)dmd, ob, dm, vertexCos, tex_co, numVerts);
 
-	for(i = 0; i < numVerts; ++i) {
+	modifier_init_texture(dmd->modifier.scene, dmd->texture);
+
+	for (i = 0; i < numVerts; ++i) {
 		TexResult texres;
 		float delta = 0, strength = dmd->strength;
 
-		if(dvert) {
+		if (dvert) {
 			weight= defvert_find_weight(dvert + i, defgrp_index);
-			if(weight == 0.0f) continue;
+			if (weight == 0.0f) continue;
 		}
 
 		texres.nor = NULL;
@@ -203,7 +203,7 @@ static void displaceModifier_do(
 
 		delta = texres.tin - dmd->midlevel;
 
-		if(dvert) strength *= weight;
+		if (dvert) strength *= weight;
 
 		delta *= strength;
 		CLAMP(delta, -10000, 10000);
@@ -246,12 +246,12 @@ static void deformVerts(ModifierData *md, Object *ob,
 	displaceModifier_do((DisplaceModifierData *)md, ob, dm,
 	                    vertexCos, numVerts);
 
-	if(dm != derivedData)
+	if (dm != derivedData)
 		dm->release(dm);
 }
 
 static void deformVertsEM(
-					   ModifierData *md, Object *ob, struct EditMesh *editData,
+					   ModifierData *md, Object *ob, struct BMEditMesh *editData,
 	DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
 {
 	DerivedMesh *dm= get_cddm(ob, editData, derivedData, vertexCos);
@@ -259,7 +259,7 @@ static void deformVertsEM(
 	displaceModifier_do((DisplaceModifierData *)md, ob, dm,
 	                    vertexCos, numVerts);
 
-	if(dm != derivedData)
+	if (dm != derivedData)
 		dm->release(dm);
 }
 
diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c b/source/blender/modifiers/intern/MOD_dynamicpaint.c
index c7b4d41..5005e2c 100644
--- a/source/blender/modifiers/intern/MOD_dynamicpaint.c
+++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c
@@ -75,7 +75,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
 
 	if (pmd->canvas) {
 		DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
-		for(; surface; surface=surface->next) {
+		for (; surface; surface=surface->next) {
 			/* tface */
 			if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ || 
 				surface->init_color_type == MOD_DPAINT_INITIAL_TEXTURE) {
@@ -119,15 +119,13 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
 	DynamicPaintModifierData *pmd = (DynamicPaintModifierData*) md;
 
 	/* add relation from canvases to all brush objects */
-	if(pmd && pmd->canvas)
-	{
+	if (pmd && pmd->canvas) {
 		Base *base = scene->base.first;
 
-		for(; base; base = base->next) {
+		for (; base; base = base->next) {
 			DynamicPaintModifierData *pmd2 = (DynamicPaintModifierData *)modifiers_findByType(base->object, eModifierType_DynamicPaint);
 
-			if(pmd2 && pmd2->brush && ob!=base->object)
-			{
+			if (pmd2 && pmd2->brush && ob!=base->object) {
 				DagNode *brushNode = dag_get_node(forest, base->object);
 				dag_add_relation(forest, brushNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Dynamic Paint Brush");
 			}
@@ -145,10 +143,10 @@ static void foreachIDLink(ModifierData *md, Object *ob,
 {
 	DynamicPaintModifierData *pmd = (DynamicPaintModifierData*) md;
 
-	if(pmd->canvas) {
+	if (pmd->canvas) {
 		DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
 
-		for(; surface; surface=surface->next) {
+		for (; surface; surface=surface->next) {
 			walk(userData, ob, (ID **)&surface->brush_group);
 			walk(userData, ob, (ID **)&surface->init_texture);
 		}
diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c
index 32ab2c8..def0208 100644
--- a/source/blender/modifiers/intern/MOD_edgesplit.c
+++ b/source/blender/modifiers/intern/MOD_edgesplit.c
@@ -36,1252 +36,127 @@
 /* EdgeSplit modifier: Splits edges in the mesh according to sharpness flag
  * or edge angle (can be used to achieve autosmoothing) */
 
-#include <assert.h>
-
-#include "DNA_meshdata_types.h"
-
-#include "BLI_listbase.h"
-#include "BLI_memarena.h"
-#include "BLI_edgehash.h"
-#include "BLI_math.h"
 #include "BLI_utildefines.h"
-#include "BLI_linklist.h"
+#include "BLI_math.h"
 
 #include "MEM_guardedalloc.h"
 
 #include "BKE_cdderivedmesh.h"
 #include "BKE_modifier.h"
-#include "BKE_particle.h"
-
-
-#include "MOD_util.h"
-
-#if 0
-#define EDGESPLIT_DEBUG_3
-#define EDGESPLIT_DEBUG_2
-#define EDGESPLIT_DEBUG_1
-#define EDGESPLIT_DEBUG_0
-#endif
-
-static void initData(ModifierData *md)
-{
-	EdgeSplitModifierData *emd = (EdgeSplitModifierData*) md;
-
-	/* default to 30-degree split angle, sharpness from both angle & flag
-	*/
-	emd->split_angle = 30;
-	emd->flags = MOD_EDGESPLIT_FROMANGLE | MOD_EDGESPLIT_FROMFLAG;
-}
-
-static void copyData(ModifierData *md, ModifierData *target)
-{
-	EdgeSplitModifierData *emd = (EdgeSplitModifierData*) md;
-	EdgeSplitModifierData *temd = (EdgeSplitModifierData*) target;
-
-	temd->split_angle = emd->split_angle;
-	temd->flags = emd->flags;
-}
-
-/* Mesh data for edgesplit operation */
-typedef struct SmoothVert {
-	LinkNode *faces;     /* all faces which use this vert */
-	int oldIndex; /* the index of the original DerivedMesh vert */
-	int newIndex; /* the index of the new DerivedMesh vert */
-} SmoothVert;
-
-#define SMOOTHEDGE_NUM_VERTS 2
-
-typedef struct SmoothEdge {
-	SmoothVert *verts[SMOOTHEDGE_NUM_VERTS]; /* the verts used by this edge */
-	LinkNode *faces;     /* all faces which use this edge */
-	int oldIndex; /* the index of the original DerivedMesh edge */
-	int newIndex; /* the index of the new DerivedMesh edge */
-	short flag; /* the flags from the original DerivedMesh edge */
-} SmoothEdge;
-
-#define SMOOTHFACE_MAX_EDGES 4
-
-typedef struct SmoothFace {
-	SmoothEdge *edges[SMOOTHFACE_MAX_EDGES]; /* nonexistent edges == NULL */
-	int flip[SMOOTHFACE_MAX_EDGES]; /* 1 = flip edge dir, 0 = don't flip */
-	float normal[3]; /* the normal of this face */
-	int oldIndex; /* the index of the original DerivedMesh face */
-	int newIndex; /* the index of the new DerivedMesh face */
-} SmoothFace;
-
-typedef struct SmoothMesh {
-	SmoothVert *verts;
-	SmoothEdge *edges;
-	SmoothFace *faces;
-	int num_verts, num_edges, num_faces;
-	int max_verts, max_edges, max_faces;
-	DerivedMesh *dm;
-	float threshold; /* the cosine of the smoothing angle */
-	int flags;
-	MemArena *arena;
-	ListBase propagatestack, reusestack;
-} SmoothMesh;
-
-static SmoothVert *smoothvert_copy(SmoothVert *vert, SmoothMesh *mesh)
-{
-	SmoothVert *copy = &mesh->verts[mesh->num_verts];
-
-	assert(vert != NULL);
-
-	if(mesh->num_verts >= mesh->max_verts) {
-		printf("Attempted to add a SmoothMesh vert beyond end of array\n");
-		return NULL;
-	}
-
-	*copy = *vert;
-	copy->faces = NULL;
-	copy->newIndex = mesh->num_verts;
-	++mesh->num_verts;
-
-#ifdef EDGESPLIT_DEBUG_2
-	printf("copied vert %4d to vert %4d\n", vert->newIndex, copy->newIndex);
-#endif
-	return copy;
-}
-
-static SmoothEdge *smoothedge_copy(SmoothEdge *edge, SmoothMesh *mesh)
-{
-	SmoothEdge *copy = &mesh->edges[mesh->num_edges];
-
-	if(mesh->num_edges >= mesh->max_edges) {
-		printf("Attempted to add a SmoothMesh edge beyond end of array\n");
-		return NULL;
-	}
-
-	*copy = *edge;
-	copy->faces = NULL;
-	copy->newIndex = mesh->num_edges;
-	++mesh->num_edges;
-
-#ifdef EDGESPLIT_DEBUG_2
-	printf("copied edge %4d to edge %4d\n", edge->newIndex, copy->newIndex);
-#endif
-	return copy;
-}
-
-static int smoothedge_has_vert(SmoothEdge *edge, SmoothVert *vert)
-{
-	int i;
-	for(i = 0; i < SMOOTHEDGE_NUM_VERTS; i++)
-		if(edge->verts[i] == vert) return 1;
-
-	return 0;
-}
-
-static SmoothMesh *smoothmesh_new(int num_verts, int num_edges, int num_faces,
-				  int max_verts, int max_edges, int max_faces)
-{
-	SmoothMesh *mesh = MEM_callocN(sizeof(*mesh), "smoothmesh");
-	mesh->verts = MEM_callocN(sizeof(*mesh->verts) * max_verts,
-			"SmoothMesh.verts");
-	mesh->edges = MEM_callocN(sizeof(*mesh->edges) * max_edges,
-			"SmoothMesh.edges");
-	mesh->faces = MEM_callocN(sizeof(*mesh->faces) * max_faces,
-			"SmoothMesh.faces");
-
-	mesh->num_verts = num_verts;
-	mesh->num_edges = num_edges;
-	mesh->num_faces = num_faces;
-
-	mesh->max_verts = max_verts;
-	mesh->max_edges = max_edges;
-	mesh->max_faces = max_faces;
-
-	return mesh;
-}
-
-static void smoothmesh_free(SmoothMesh *mesh)
-{
-	int i;
-
-	for(i = 0; i < mesh->num_verts; ++i)
-		BLI_linklist_free(mesh->verts[i].faces, NULL);
-
-	for(i = 0; i < mesh->num_edges; ++i)
-		BLI_linklist_free(mesh->edges[i].faces, NULL);
-	
-	if(mesh->arena)
-		BLI_memarena_free(mesh->arena);
-
-	MEM_freeN(mesh->verts);
-	MEM_freeN(mesh->edges);
-	MEM_freeN(mesh->faces);
-	MEM_freeN(mesh);
-}
-
-static void smoothmesh_resize_verts(SmoothMesh *mesh, int max_verts)
-{
-	int i;
-	SmoothVert *tmp;
-
-	if(max_verts <= mesh->max_verts) return;
-
-	tmp = MEM_callocN(sizeof(*tmp) * max_verts, "SmoothMesh.verts");
-
-	memcpy(tmp, mesh->verts, sizeof(*tmp) * mesh->num_verts);
-
-	/* remap vert pointers in edges */
-	for(i = 0; i < mesh->num_edges; ++i) {
-		int j;
-		SmoothEdge *edge = &mesh->edges[i];
-
-		for(j = 0; j < SMOOTHEDGE_NUM_VERTS; ++j)
-			/* pointer arithmetic to get vert array index */
-			edge->verts[j] = &tmp[edge->verts[j] - mesh->verts];
-	}
-
-	MEM_freeN(mesh->verts);
-	mesh->verts = tmp;
-	mesh->max_verts = max_verts;
-}
-
-static void smoothmesh_resize_edges(SmoothMesh *mesh, int max_edges)
-{
-	int i;
-	SmoothEdge *tmp;
-
-	if(max_edges <= mesh->max_edges) return;
-
-	tmp = MEM_callocN(sizeof(*tmp) * max_edges, "SmoothMesh.edges");
-
-	memcpy(tmp, mesh->edges, sizeof(*tmp) * mesh->num_edges);
-
-	/* remap edge pointers in faces */
-	for(i = 0; i < mesh->num_faces; ++i) {
-		int j;
-		SmoothFace *face = &mesh->faces[i];
-
-		for(j = 0; j < SMOOTHFACE_MAX_EDGES; ++j)
-			if(face->edges[j])
-				/* pointer arithmetic to get edge array index */
-				face->edges[j] = &tmp[face->edges[j] - mesh->edges];
-	}
-
-	MEM_freeN(mesh->edges);
-	mesh->edges = tmp;
-	mesh->max_edges = max_edges;
-}
-
-#ifdef EDGESPLIT_DEBUG_0
-static void smoothmesh_print(SmoothMesh *mesh)
-{
-	int i, j;
-	DerivedMesh *dm = mesh->dm;
-
-	printf("--- SmoothMesh ---\n");
-	printf("--- Vertices ---\n");
-	for(i = 0; i < mesh->num_verts; i++) {
-		SmoothVert *vert = &mesh->verts[i];
-		LinkNode *node;
-		MVert mv;
-
-		dm->getVert(dm, vert->oldIndex, &mv);
-
-		printf("%3d: ind={%3d, %3d}, pos={% 5.1f, % 5.1f, % 5.1f}",
-			i, vert->oldIndex, vert->newIndex,
-			mv.co[0], mv.co[1], mv.co[2]);
-		printf(", faces={");
-		for(node = vert->faces; node != NULL; node = node->next) {
-			printf(" %d", ((SmoothFace *)node->link)->newIndex);
-		}
-		printf("}\n");
-	}
-
-	printf("\n--- Edges ---\n");
-	for(i = 0; i < mesh->num_edges; i++) {
-		SmoothEdge *edge = &mesh->edges[i];
-		LinkNode *node;
-
-		printf("%4d: indices={%4d, %4d}, verts={%4d, %4d}",
-			i,
-			edge->oldIndex, edge->newIndex,
-			edge->verts[0]->newIndex, edge->verts[1]->newIndex);
-		if(edge->verts[0] == edge->verts[1]) printf(" <- DUPLICATE VERTEX");
-		printf(", faces={");
-		for(node = edge->faces; node != NULL; node = node->next) {
-			printf(" %d", ((SmoothFace *)node->link)->newIndex);
-		}
-		printf("}\n");
-	}
-
-	printf("\n--- Faces ---\n");
-	for(i = 0; i < mesh->num_faces; i++) {
-		SmoothFace *face = &mesh->faces[i];
-
-		printf("%4d: indices={%4d, %4d}, edges={", i,
-			face->oldIndex, face->newIndex);
-		for(j = 0; j < SMOOTHFACE_MAX_EDGES && face->edges[j]; j++) {
-			if(face->flip[j])
-				printf(" -%-2d", face->edges[j]->newIndex);
-			else
-				printf("  %-2d", face->edges[j]->newIndex);
-		}
-		printf("}, verts={");
-		for(j = 0; j < SMOOTHFACE_MAX_EDGES && face->edges[j]; j++) {
-			printf(" %d", face->edges[j]->verts[face->flip[j]]->newIndex);
-		}
-		printf("}\n");
-	}
-}
-#endif
-
-static SmoothMesh *smoothmesh_from_derivedmesh(DerivedMesh *dm)
-{
-	SmoothMesh *mesh;
-	EdgeHash *edges = BLI_edgehash_new();
-	int i;
-	int totvert, totedge, totface;
-
-	totvert = dm->getNumVerts(dm);
-	totedge = dm->getNumEdges(dm);
-	totface = dm->getNumFaces(dm);
-
-	mesh = smoothmesh_new(totvert, totedge, totface,
-			totvert, totedge, totface);
-
-	mesh->dm = dm;
-
-	for(i = 0; i < totvert; i++) {
-		SmoothVert *vert = &mesh->verts[i];
-
-		vert->oldIndex = vert->newIndex = i;
-	}
-
-	for(i = 0; i < totedge; i++) {
-		SmoothEdge *edge = &mesh->edges[i];
-		MEdge med;
-
-		dm->getEdge(dm, i, &med);
-		edge->verts[0] = &mesh->verts[med.v1];
-		edge->verts[1] = &mesh->verts[med.v2];
-		edge->oldIndex = edge->newIndex = i;
-		edge->flag = med.flag;
-
-		BLI_edgehash_insert(edges, med.v1, med.v2, edge);
-	}
-
-	for(i = 0; i < totface; i++) {
-		SmoothFace *face = &mesh->faces[i];
-		MFace mf;
-		MVert v1, v2, v3;
-		int j;
-
-		dm->getFace(dm, i, &mf);
-
-		dm->getVert(dm, mf.v1, &v1);
-		dm->getVert(dm, mf.v2, &v2);
-		dm->getVert(dm, mf.v3, &v3);
-		face->edges[0] = BLI_edgehash_lookup(edges, mf.v1, mf.v2);
-		if(face->edges[0]->verts[1]->oldIndex == mf.v1) face->flip[0] = 1;
-		face->edges[1] = BLI_edgehash_lookup(edges, mf.v2, mf.v3);
-		if(face->edges[1]->verts[1]->oldIndex == mf.v2) face->flip[1] = 1;
-		if(mf.v4) {
-			MVert v4;
-			dm->getVert(dm, mf.v4, &v4);
-			face->edges[2] = BLI_edgehash_lookup(edges, mf.v3, mf.v4);
-			if(face->edges[2]->verts[1]->oldIndex == mf.v3) face->flip[2] = 1;
-			face->edges[3] = BLI_edgehash_lookup(edges, mf.v4, mf.v1);
-			if(face->edges[3]->verts[1]->oldIndex == mf.v4) face->flip[3] = 1;
-			normal_quad_v3( face->normal,v1.co, v2.co, v3.co, v4.co);
-		} else {
-			face->edges[2] = BLI_edgehash_lookup(edges, mf.v3, mf.v1);
-			if(face->edges[2]->verts[1]->oldIndex == mf.v3) face->flip[2] = 1;
-			face->edges[3] = NULL;
-			normal_tri_v3( face->normal,v1.co, v2.co, v3.co);
-		}
-
-		for(j = 0; j < SMOOTHFACE_MAX_EDGES && face->edges[j]; j++) {
-			SmoothEdge *edge = face->edges[j];
-			BLI_linklist_prepend(&edge->faces, face);
-			BLI_linklist_prepend(&edge->verts[face->flip[j]]->faces, face);
-		}
-
-		face->oldIndex = face->newIndex = i;
-	}
-
-	BLI_edgehash_free(edges, NULL);
-
-	return mesh;
-}
-
-static DerivedMesh *CDDM_from_smoothmesh(SmoothMesh *mesh)
-{
-	DerivedMesh *result = CDDM_from_template(mesh->dm,
-			mesh->num_verts,
-			mesh->num_edges,
-			mesh->num_faces);
-	MVert *new_verts = CDDM_get_verts(result);
-	MEdge *new_edges = CDDM_get_edges(result);
-	MFace *new_faces = CDDM_get_faces(result);
-	int i;
-
-	for(i = 0; i < mesh->num_verts; ++i) {
-		SmoothVert *vert = &mesh->verts[i];
-		MVert *newMV = &new_verts[vert->newIndex];
-
-		DM_copy_vert_data(mesh->dm, result,
-				vert->oldIndex, vert->newIndex, 1);
-		mesh->dm->getVert(mesh->dm, vert->oldIndex, newMV);
-	}
-
-	for(i = 0; i < mesh->num_edges; ++i) {
-		SmoothEdge *edge = &mesh->edges[i];
-		MEdge *newME = &new_edges[edge->newIndex];
-
-		DM_copy_edge_data(mesh->dm, result,
-				edge->oldIndex, edge->newIndex, 1);
-		mesh->dm->getEdge(mesh->dm, edge->oldIndex, newME);
-		newME->v1 = edge->verts[0]->newIndex;
-		newME->v2 = edge->verts[1]->newIndex;
-	}
-
-	for(i = 0; i < mesh->num_faces; ++i) {
-		SmoothFace *face = &mesh->faces[i];
-		MFace *newMF = &new_faces[face->newIndex];
-
-		DM_copy_face_data(mesh->dm, result,
-				face->oldIndex, face->newIndex, 1);
-		mesh->dm->getFace(mesh->dm, face->oldIndex, newMF);
-
-		newMF->v1 = face->edges[0]->verts[face->flip[0]]->newIndex;
-		newMF->v2 = face->edges[1]->verts[face->flip[1]]->newIndex;
-		newMF->v3 = face->edges[2]->verts[face->flip[2]]->newIndex;
-
-		if(face->edges[3]) {
-			newMF->v4 = face->edges[3]->verts[face->flip[3]]->newIndex;
-		} else {
-			newMF->v4 = 0;
-		}
-	}
-
-	return result;
-}
-
-/* returns the other vert in the given edge
- */
-static SmoothVert *other_vert(SmoothEdge *edge, SmoothVert *vert)
-{
-	if(edge->verts[0] == vert) return edge->verts[1];
-	else return edge->verts[0];
-}
-
-/* returns the other edge in the given face that uses the given vert
- * returns NULL if no other edge in the given face uses the given vert
- * (this should never happen)
- */
-static SmoothEdge *other_edge(SmoothFace *face, SmoothVert *vert,
-				  SmoothEdge *edge)
-{
-	int i,j;
-	for(i = 0; i < SMOOTHFACE_MAX_EDGES && face->edges[i]; i++) {
-		SmoothEdge *tmp_edge = face->edges[i];
-		if(tmp_edge == edge) continue;
-
-		for(j = 0; j < SMOOTHEDGE_NUM_VERTS; j++)
-			if(tmp_edge->verts[j] == vert) return tmp_edge;
-	}
-
-	/* if we get to here, something's wrong (there should always be 2 edges
-	* which use the same vert in a face)
-	*/
-	return NULL;
-}
-
-/* returns a face attached to the given edge which is not the given face.
- * returns NULL if no other faces use this edge.
- */
-static SmoothFace *other_face(SmoothEdge *edge, SmoothFace *face)
-{
-	LinkNode *node;
-
-	for(node = edge->faces; node != NULL; node = node->next)
-		if(node->link != face) return node->link;
-
-	return NULL;
-}
-
-#if 0
-/* copies source list to target, overwriting target (target is not freed)
- * nodes in the copy will be in the same order as in source
- */
-static void linklist_copy(LinkNode **target, LinkNode *source)
-{
-	LinkNode *node = NULL;
-	*target = NULL;
-
-	for(; source; source = source->next) {
-		if(node) {
-			node->next = MEM_mallocN(sizeof(*node->next), "nlink_copy");
-			node = node->next;
-		} else {
-			node = *target = MEM_mallocN(sizeof(**target), "nlink_copy");
-		}
-		node->link = source->link;
-		node->next = NULL;
-	}
-}
-#endif
-
-/* appends source to target if it's not already in target */
-static void linklist_append_unique(LinkNode **target, void *source)
-{
-	LinkNode *node;
-	LinkNode *prev = NULL;
-
-	/* check if source value is already in the list */
-	for(node = *target; node; prev = node, node = node->next)
-		if(node->link == source) return;
-
-	node = MEM_mallocN(sizeof(*node), "nlink");
-	node->next = NULL;
-	node->link = source;
+#include "BKE_tessmesh.h"
+#include "BKE_mesh.h"
 
-	if(prev) prev->next = node;
-	else *target = node;
-}
-
-/* appends elements of source which aren't already in target to target */
-static void linklist_append_list_unique(LinkNode **target, LinkNode *source)
-{
-	for(; source; source = source->next)
-		linklist_append_unique(target, source->link);
-}
-
-#if 0 /* this is no longer used, it should possibly be removed */
-/* prepends prepend to list - doesn't copy nodes, just joins the lists */
-static void linklist_prepend_linklist(LinkNode **list, LinkNode *prepend)
-{
-	if(prepend) {
-		LinkNode *node = prepend;
-		while(node->next) node = node->next;
+#include "DNA_object_types.h"
 
-		node->next = *list;
-		*list = prepend;
-	}
-}
-#endif
-
-/* returns 1 if the linked list contains the given pointer, 0 otherwise
- */
-static int linklist_contains(LinkNode *list, void *ptr)
-{
-	LinkNode *node;
-
-	for(node = list; node; node = node->next)
-		if(node->link == ptr) return 1;
-
-	return 0;
-}
-
-/* returns 1 if the first linked list is a subset of the second (comparing
- * pointer values), 0 if not
- */
-static int linklist_subset(LinkNode *list1, LinkNode *list2)
-{
-	for(; list1; list1 = list1->next)
-		if(!linklist_contains(list2, list1->link))
-			return 0;
-
-	return 1;
-}
-
-#if 0
-/* empties the linked list
- * frees pointers with freefunc if freefunc is not NULL
- */
-static void linklist_empty(LinkNode **list, LinkNodeFreeFP freefunc)
-{
-	BLI_linklist_free(*list, freefunc);
-	*list = NULL;
-}
-#endif
-
-/* removes the first instance of value from the linked list
- * frees the pointer with freefunc if freefunc is not NULL
- */
-static void linklist_remove_first(LinkNode **list, void *value,
-				  LinkNodeFreeFP freefunc)
-{
-	LinkNode *node = *list;
-	LinkNode *prev = NULL;
-
-	while(node && node->link != value) {
-		prev = node;
-		node = node->next;
-	}
-
-	if(node) {
-		if(prev)
-			prev->next = node->next;
-		else
-			*list = node->next;
-
-		if(freefunc)
-			freefunc(node->link);
-
-		MEM_freeN(node);
-	}
-}
-
-/* removes all elements in source from target */
-static void linklist_remove_list(LinkNode **target, LinkNode *source,
-				 LinkNodeFreeFP freefunc)
-{
-	for(; source; source = source->next)
-		linklist_remove_first(target, source->link, freefunc);
-}
-
-#ifdef EDGESPLIT_DEBUG_0
-static void print_ptr(void *ptr)
-{
-	printf("%p\n", ptr);
-}
-
-static void print_edge(void *ptr)
-{
-	SmoothEdge *edge = ptr;
-	printf(" %4d", edge->newIndex);
-}
-
-static void print_face(void *ptr)
-{
-	SmoothFace *face = ptr;
-	printf(" %4d", face->newIndex);
-}
-#endif
-
-typedef struct ReplaceData {
-	void *find;
-	void *replace;
-} ReplaceData;
-
-static void edge_replace_vert(void *ptr, void *userdata)
-{
-	SmoothEdge *edge = ptr;
-	SmoothVert *find = ((ReplaceData *)userdata)->find;
-	SmoothVert *replace = ((ReplaceData *)userdata)->replace;
-	int i;
-
-#ifdef EDGESPLIT_DEBUG_3
-	printf("replacing vert %4d with %4d in edge %4d",
-		find->newIndex, replace->newIndex, edge->newIndex);
-	printf(": {%4d, %4d}", edge->verts[0]->newIndex, edge->verts[1]->newIndex);
-#endif
-
-	for(i = 0; i < SMOOTHEDGE_NUM_VERTS; i++) {
-		if(edge->verts[i] == find) {
-			linklist_append_list_unique(&replace->faces, edge->faces);
-			linklist_remove_list(&find->faces, edge->faces, NULL);
-
-			edge->verts[i] = replace;
-		}
-	}
-
-#ifdef EDGESPLIT_DEBUG_3
-	printf(" -> {%4d, %4d}\n", edge->verts[0]->newIndex, edge->verts[1]->newIndex);
-#endif
-}
-
-static void face_replace_vert(void *ptr, void *userdata)
-{
-	SmoothFace *face = ptr;
-	int i;
-
-	for(i = 0; i < SMOOTHFACE_MAX_EDGES && face->edges[i]; i++)
-		edge_replace_vert(face->edges[i], userdata);
-}
-
-static void face_replace_edge(void *ptr, void *userdata)
-{
-	SmoothFace *face = ptr;
-	SmoothEdge *find = ((ReplaceData *)userdata)->find;
-	SmoothEdge *replace = ((ReplaceData *)userdata)->replace;
-	int i;
-
-#ifdef EDGESPLIT_DEBUG_3
-	printf("replacing edge %4d with %4d in face %4d",
-		find->newIndex, replace->newIndex, face->newIndex);
-	if(face->edges[3])
-		printf(": {%2d %2d %2d %2d}",
-			face->edges[0]->newIndex, face->edges[1]->newIndex,
-			face->edges[2]->newIndex, face->edges[3]->newIndex);
-	else
-		printf(": {%2d %2d %2d}",
-			face->edges[0]->newIndex, face->edges[1]->newIndex,
-			face->edges[2]->newIndex);
-#endif
-
-	for(i = 0; i < SMOOTHFACE_MAX_EDGES && face->edges[i]; i++) {
-		if(face->edges[i] == find) {
-			linklist_remove_first(&face->edges[i]->faces, face, NULL);
-			BLI_linklist_prepend(&replace->faces, face);
-			face->edges[i] = replace;
-		}
-	}
-
-#ifdef EDGESPLIT_DEBUG_3
-	if(face->edges[3])
-		printf(" -> {%2d %2d %2d %2d}\n",
-			face->edges[0]->newIndex, face->edges[1]->newIndex,
-			face->edges[2]->newIndex, face->edges[3]->newIndex);
-	else
-		printf(" -> {%2d %2d %2d}\n",
-			face->edges[0]->newIndex, face->edges[1]->newIndex,
-			face->edges[2]->newIndex);
-#endif
-}
-
-static int edge_is_loose(SmoothEdge *edge)
-{
-	return !(edge->faces && edge->faces->next);
-}
-
-static int edge_is_sharp(SmoothEdge *edge)
-{
-#ifdef EDGESPLIT_DEBUG_1
-	printf("edge %d: ", edge->newIndex);
-#endif
-	if(edge->flag & ME_SHARP) {
-		/* edge can only be sharp if it has at least 2 faces */
-		if(!edge_is_loose(edge)) {
-#ifdef EDGESPLIT_DEBUG_1
-			printf("sharp\n");
-#endif
-			return 1;
-		} else {
-			/* edge is loose, so it can't be sharp */
-			edge->flag &= ~ME_SHARP;
-		}
-	}
-
-#ifdef EDGESPLIT_DEBUG_1
-	printf("not sharp\n");
-#endif
-	return 0;
-}
-
-/* finds another sharp edge which uses vert, by traversing faces around the
- * vert until it does one of the following:
- * - hits a loose edge (the edge is returned)
- * - hits a sharp edge (the edge is returned)
- * - returns to the start edge (NULL is returned)
+/* EdgeSplit */
+/* EdgeSplit modifier: Splits edges in the mesh according to sharpness flag
+ * or edge angle (can be used to achieve autosmoothing)
+ *
+ * note: this code is very close to MOD_bevel.c
  */
-static SmoothEdge *find_other_sharp_edge(SmoothVert *vert, SmoothEdge *edge, LinkNode **visited_faces)
-{
-	SmoothFace *face = NULL;
-	SmoothEdge *edge2 = NULL;
-	/* holds the edges we've seen so we can avoid looping indefinitely */
-	LinkNode *visited_edges = NULL;
-#ifdef EDGESPLIT_DEBUG_1
-	printf("=== START === find_other_sharp_edge(edge = %4d, vert = %4d)\n",
-		edge->newIndex, vert->newIndex);
-#endif
-
-	/* get a face on which to start */
-	if(edge->faces) face = edge->faces->link;
-	else return NULL;
-
-	/* record this edge as visited */
-	BLI_linklist_prepend(&visited_edges, edge);
-
-	/* get the next edge */
-	edge2 = other_edge(face, vert, edge);
-
-	/* record this face as visited */
-	if(visited_faces)
-		BLI_linklist_prepend(visited_faces, face);
-
-	/* search until we hit a loose edge or a sharp edge or an edge we've
-	* seen before
-	*/
-	while(face && !edge_is_sharp(edge2)
-			 && !linklist_contains(visited_edges, edge2)) {
-#ifdef EDGESPLIT_DEBUG_3
-		printf("current face %4d; current edge %4d\n", face->newIndex,
-			edge2->newIndex);
-#endif
-		/* get the next face */
-		face = other_face(edge2, face);
-
-		/* if face == NULL, edge2 is a loose edge */
-		if(face) {
-			/* record this face as visited */
-			if(visited_faces)
-				BLI_linklist_prepend(visited_faces, face);
 
-			/* record this edge as visited */
-			BLI_linklist_prepend(&visited_edges, edge2);
+#define EDGE_MARK	1
 
-			/* get the next edge */
-			edge2 = other_edge(face, vert, edge2);
-#ifdef EDGESPLIT_DEBUG_3
-			printf("next face %4d; next edge %4d\n",
-				face->newIndex, edge2->newIndex);
-		} else {
-			printf("loose edge: %4d\n", edge2->newIndex);
-#endif
-		}
-	}
-
-	/* either we came back to the start edge or we found a sharp/loose edge */
-	if(linklist_contains(visited_edges, edge2))
-		/* we came back to the start edge */
-		edge2 = NULL;
-
-	BLI_linklist_free(visited_edges, NULL);
-
-#ifdef EDGESPLIT_DEBUG_1
-	printf("=== END === find_other_sharp_edge(edge = %4d, vert = %4d), "
-		"returning edge %d\n",
-		edge->newIndex, vert->newIndex, edge2 ? edge2->newIndex : -1);
-#endif
-	return edge2;
-}
-
-static void split_single_vert(SmoothVert *vert, SmoothFace *face,
-				  SmoothMesh *mesh)
+static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Object *UNUSED(ob))
 {
-	SmoothVert *copy_vert;
-	ReplaceData repdata;
-
-	copy_vert = smoothvert_copy(vert, mesh);
-
-	if(copy_vert == NULL) {
-		/* bug [#26316], this prevents a segfault
-		 * but this still needs fixing */
-		return;
-	}
-
-	repdata.find = vert;
-	repdata.replace = copy_vert;
-	face_replace_vert(face, &repdata);
-}
-
-typedef struct PropagateEdge {
-	struct PropagateEdge *next, *prev;
-	SmoothEdge *edge;
-	SmoothVert *vert;
-} PropagateEdge;
-
-static void push_propagate_stack(SmoothEdge *edge, SmoothVert *vert, SmoothMesh *mesh)
-{
-	PropagateEdge *pedge = mesh->reusestack.first;
-
-	if(pedge) {
-		BLI_remlink(&mesh->reusestack, pedge);
-	}
-	else {
-		if(!mesh->arena) {
-			mesh->arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "edgesplit arena");
-			BLI_memarena_use_calloc(mesh->arena);
-		}
-
-		pedge = BLI_memarena_alloc(mesh->arena, sizeof(PropagateEdge));
-	}
-
-	pedge->edge = edge;
-	pedge->vert = vert;
-	BLI_addhead(&mesh->propagatestack, pedge);
-}
-
-static void pop_propagate_stack(SmoothEdge **edge, SmoothVert **vert, SmoothMesh *mesh)
-{
-	PropagateEdge *pedge = mesh->propagatestack.first;
-
-	if(pedge) {
-		*edge = pedge->edge;
-		*vert = pedge->vert;
-		BLI_remlink(&mesh->propagatestack, pedge);
-		BLI_addhead(&mesh->reusestack, pedge);
-	}
-	else {
-		*edge = NULL;
-		*vert = NULL;
-	}
-}
-
-static void split_edge(SmoothEdge *edge, SmoothVert *vert, SmoothMesh *mesh);
-
-static void propagate_split(SmoothEdge *edge, SmoothVert *vert,
-				SmoothMesh *mesh)
-{
-	SmoothEdge *edge2;
-	LinkNode *visited_faces = NULL;
-#ifdef EDGESPLIT_DEBUG_1
-	printf("=== START === propagate_split(edge = %4d, vert = %4d)\n",
-		edge->newIndex, vert->newIndex);
-#endif
-
-	edge2 = find_other_sharp_edge(vert, edge, &visited_faces);
-
-	if(!edge2) {
-		/* didn't find a sharp or loose edge, so we've hit a dead end */
-	} else if(!edge_is_loose(edge2)) {
-		/* edge2 is not loose, so it must be sharp */
-		if(edge_is_loose(edge)) {
-			/* edge is loose, so we can split edge2 at this vert */
-			split_edge(edge2, vert, mesh);
-		} else if(edge_is_sharp(edge)) {
-			/* both edges are sharp, so we can split the pair at vert */
-			split_edge(edge, vert, mesh);
-		} else {
-			/* edge is not sharp, so try to split edge2 at its other vert */
-			split_edge(edge2, other_vert(edge2, vert), mesh);
-		}
-	} else { /* edge2 is loose */
-		if(edge_is_loose(edge)) {
-			SmoothVert *vert2;
-			ReplaceData repdata;
+	DerivedMesh *result;
+	BMesh *bm;
+	BMEditMesh *em;
+	BMIter iter;
+	BMEdge *e;
+	float threshold = cos((emd->split_angle + 0.00001) * M_PI / 180.0);
 
-			/* can't split edge, what should we do with vert? */
-			if(linklist_subset(vert->faces, visited_faces)) {
-				/* vert has only one fan of faces attached; don't split it */
-			} else {
-				/* vert has more than one fan of faces attached; split it */
-				vert2 = smoothvert_copy(vert, mesh);
+	em = DM_to_editbmesh(dm, NULL, FALSE);
+	bm = em->bm;
 
-				/* fails in rare cases, see [#26993] */
-				if(vert2) {
-					/* replace vert with its copy in visited_faces */
-					repdata.find = vert;
-					repdata.replace = vert2;
-					BLI_linklist_apply(visited_faces, face_replace_vert, &repdata);
+	BM_mesh_normals_update(bm, FALSE);
+	BMO_push(bm, NULL);
+	
+	if (emd->flags & MOD_EDGESPLIT_FROMANGLE) {
+		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);
 				}
 			}
-		} else {
-			/* edge is not loose, so it must be sharp; split it */
-			split_edge(edge, vert, mesh);
-		}
-	}
-
-	BLI_linklist_free(visited_faces, NULL);
-#ifdef EDGESPLIT_DEBUG_1
-	printf("=== END === propagate_split(edge = %4d, vert = %4d)\n",
-		edge->newIndex, vert->newIndex);
-#endif
-}
-
-static void split_edge(SmoothEdge *edge, SmoothVert *vert, SmoothMesh *mesh)
-{
-	SmoothEdge *edge2;
-	SmoothVert *vert2;
-	ReplaceData repdata;
-	/* the list of faces traversed while looking for a sharp edge */
-	LinkNode *visited_faces = NULL;
-#ifdef EDGESPLIT_DEBUG_1
-	printf("=== START === split_edge(edge = %4d, vert = %4d)\n",
-		edge->newIndex, vert->newIndex);
-#endif
-
-	edge2 = find_other_sharp_edge(vert, edge, &visited_faces);
-
-	if(!edge2) {
-		/* didn't find a sharp or loose edge, so try the other vert */
-		vert2 = other_vert(edge, vert);
-		push_propagate_stack(edge, vert2, mesh);
-	} else if(!edge_is_loose(edge2)) {
-		/* edge2 is not loose, so it must be sharp */
-		SmoothEdge *copy_edge = smoothedge_copy(edge, mesh);
-		SmoothEdge *copy_edge2 = smoothedge_copy(edge2, mesh);
-		SmoothVert *vert2;
-
-		/* replace edge with its copy in visited_faces */
-		repdata.find = edge;
-		repdata.replace = copy_edge;
-		BLI_linklist_apply(visited_faces, face_replace_edge, &repdata);
-
-		/* replace edge2 with its copy in visited_faces */
-		repdata.find = edge2;
-		repdata.replace = copy_edge2;
-		BLI_linklist_apply(visited_faces, face_replace_edge, &repdata);
-
-		vert2 = smoothvert_copy(vert, mesh);
-
-		/* replace vert with its copy in visited_faces (must be done after
-		* edge replacement so edges have correct vertices)
-		*/
-		repdata.find = vert;
-		repdata.replace = vert2;
-		BLI_linklist_apply(visited_faces, face_replace_vert, &repdata);
-
-		/* all copying and replacing is done; the mesh should be consistent.
-		* now propagate the split to the vertices at either end
-		*/
-		push_propagate_stack(copy_edge, other_vert(copy_edge, vert2), mesh);
-		push_propagate_stack(copy_edge2, other_vert(copy_edge2, vert2), mesh);
-
-		if(smoothedge_has_vert(edge, vert))
-			push_propagate_stack(edge, vert, mesh);
-	} else {
-		/* edge2 is loose */
-		SmoothEdge *copy_edge = smoothedge_copy(edge, mesh);
-		SmoothVert *vert2;
-
-		/* replace edge with its copy in visited_faces */
-		repdata.find = edge;
-		repdata.replace = copy_edge;
-		BLI_linklist_apply(visited_faces, face_replace_edge, &repdata);
-
-		vert2 = smoothvert_copy(vert, mesh);
-
-		/* bug [#29205] which is caused by exactly the same reason as [#26316]
-		   this check will only prevent crash without fixing actual issue and
-		   some vertices can stay unsplitted when they should (sergey) */
-		if(vert2) {
-			/* replace vert with its copy in visited_faces (must be done after
-			 * edge replacement so edges have correct vertices)
-			 */
-			repdata.find = vert;
-			repdata.replace = vert2;
-			BLI_linklist_apply(visited_faces, face_replace_vert, &repdata);
 		}
-
-		/* copying and replacing is done; the mesh should be consistent.
-		* now propagate the split to the vertex at the other end
-		*/
-		push_propagate_stack(copy_edge, other_vert(copy_edge, vert2), mesh);
-
-		if(smoothedge_has_vert(edge, vert))
-			push_propagate_stack(edge, vert, mesh);
 	}
-
-	BLI_linklist_free(visited_faces, NULL);
-#ifdef EDGESPLIT_DEBUG_1
-	printf("=== END === split_edge(edge = %4d, vert = %4d)\n",
-		edge->newIndex, vert->newIndex);
-#endif
-}
-
-static void tag_and_count_extra_edges(SmoothMesh *mesh, float split_angle,
-					  int flags, int *extra_edges)
-{
-	/* if normal1 dot normal2 < threshold, angle is greater, so split */
-	/* FIXME not sure if this always works */
-	/* 0.00001 added for floating-point rounding */
-	float threshold = cos((split_angle + 0.00001f) * (float)M_PI / 180.0f);
-	int i;
-
-	*extra_edges = 0;
-
-	/* loop through edges, counting potential new ones */
-	for(i = 0; i < mesh->num_edges; i++) {
-		SmoothEdge *edge = &mesh->edges[i];
-		int sharp = 0;
-
-		/* treat all non-manifold edges (3 or more faces) as sharp */
-		if(edge->faces && edge->faces->next && edge->faces->next->next) {
-			LinkNode *node;
-
-			/* this edge is sharp */
-			sharp = 1;
-
-			/* add an extra edge for every face beyond the first */
-			*extra_edges += 2;
-			for(node = edge->faces->next->next->next; node; node = node->next)
-				(*extra_edges)++;
-		} else if((flags & (MOD_EDGESPLIT_FROMANGLE | MOD_EDGESPLIT_FROMFLAG))
-					 && !edge_is_loose(edge)) {
-			/* (the edge can only be sharp if we're checking angle or flag,
-			* and it has at least 2 faces) */
-
-			/* if we're checking the sharp flag and it's set, good */
-			if((flags & MOD_EDGESPLIT_FROMFLAG) && (edge->flag & ME_SHARP)) {
-				/* this edge is sharp */
-				sharp = 1;
-
-				(*extra_edges)++;
-			} else if(flags & MOD_EDGESPLIT_FROMANGLE) {
-				/* we know the edge has 2 faces, so check the angle */
-				SmoothFace *face1 = edge->faces->link;
-				SmoothFace *face2 = edge->faces->next->link;
-				float edge_angle_cos = dot_v3v3(face1->normal,
-				face2->normal);
-
-				if(edge_angle_cos < threshold) {
-					/* this edge is sharp */
-					sharp = 1;
-
-					(*extra_edges)++;
+	
+	if (emd->flags & MOD_EDGESPLIT_FROMFLAG) {
+		BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
+			/* check for 2 or more edge users */
+			if ((e->l) &&
+			    (e->l->next != e->l))
+			{
+				if (!BM_elem_flag_test(e, BM_ELEM_SMOOTH)) {
+					BMO_elem_flag_enable(bm, e, EDGE_MARK);
 				}
 			}
 		}
-
-		/* set/clear sharp flag appropriately */
-		if(sharp) edge->flag |= ME_SHARP;
-		else edge->flag &= ~ME_SHARP;
 	}
-}
-
-static void split_sharp_edges(SmoothMesh *mesh, float split_angle, int flags)
-{
-	SmoothVert *vert;
-	int i;
-	/* if normal1 dot normal2 < threshold, angle is greater, so split */
-	/* FIXME not sure if this always works */
-	/* 0.00001 added for floating-point rounding */
-	mesh->threshold = cosf((split_angle + 0.00001f) * (float)M_PI / 180.0f);
-	mesh->flags = flags;
-
-	/* loop through edges, splitting sharp ones */
-	/* can't use an iterator here, because we'll be adding edges */
-	for(i = 0; i < mesh->num_edges; i++) {
-		SmoothEdge *edge = &mesh->edges[i];
+	
+	BMO_op_callf(bm, "edgesplit edges=%fe", EDGE_MARK);
+	
+	BMO_pop(bm);
 
-		if(edge_is_sharp(edge)) {
-			split_edge(edge, edge->verts[0], mesh);
+	/* BM_mesh_validate(bm); */ /* for troubleshooting */
 
-			do {
-				pop_propagate_stack(&edge, &vert, mesh);
-				if(edge && smoothedge_has_vert(edge, vert))
-					propagate_split(edge, vert, mesh);
-			} while(edge);
-		}
-	}
+	BLI_assert(em->looptris == NULL);
+	result = CDDM_from_BMEditMesh(em, NULL, TRUE, FALSE);
+	BMEdit_Free(em);
+	MEM_freeN(em);
+	
+	return result;
 }
 
-static int count_bridge_verts(SmoothMesh *mesh)
+static void initData(ModifierData *md)
 {
-	int i, j, count = 0;
-
-	for(i = 0; i < mesh->num_faces; i++) {
-		SmoothFace *face = &mesh->faces[i];
-
-		for(j = 0; j < SMOOTHFACE_MAX_EDGES && face->edges[j]; j++) {
-			SmoothEdge *edge = face->edges[j];
-			SmoothEdge *next_edge;
-			SmoothVert *vert = edge->verts[1 - face->flip[j]];
-			int next = (j + 1) % SMOOTHFACE_MAX_EDGES;
-
-			/* wrap next around if at last edge */
-			if(!face->edges[next]) next = 0;
-
-			next_edge = face->edges[next];
-
-			/* if there are other faces sharing this vertex but not
-			* these edges, the vertex will be split, so count it
-			*/
-			/* vert has to have at least one face (this one), so faces != 0 */
-			if(!edge->faces->next && !next_edge->faces->next
-						 && vert->faces->next) {
-				count++;
-						 }
-		}
-	}
+	EdgeSplitModifierData *emd = (EdgeSplitModifierData*) md;
 
-	/* each bridge vert will be counted once per face that uses it,
-	* so count is too high, but it's ok for now
-	*/
-	return count;
+	/* default to 30-degree split angle, sharpness from both angle & flag */
+	emd->split_angle = 30;
+	emd->flags = MOD_EDGESPLIT_FROMANGLE | MOD_EDGESPLIT_FROMFLAG;
 }
 
-static void split_bridge_verts(SmoothMesh *mesh)
+static void copyData(ModifierData *md, ModifierData *target)
 {
-	int i,j;
-
-	for(i = 0; i < mesh->num_faces; i++) {
-		SmoothFace *face = &mesh->faces[i];
-
-		for(j = 0; j < SMOOTHFACE_MAX_EDGES && face->edges[j]; j++) {
-			SmoothEdge *edge = face->edges[j];
-			SmoothEdge *next_edge;
-			SmoothVert *vert = edge->verts[1 - face->flip[j]];
-			int next = (j + 1) % SMOOTHFACE_MAX_EDGES;
-
-			/* wrap next around if at last edge */
-			if(!face->edges[next]) next = 0;
-
-			next_edge = face->edges[next];
+	EdgeSplitModifierData *emd = (EdgeSplitModifierData*) md;
+	EdgeSplitModifierData *temd = (EdgeSplitModifierData*) target;
 
-			/* if there are other faces sharing this vertex but not
-			* these edges, split the vertex
-			*/
-			/* vert has to have at least one face (this one), so faces != 0 */
-			if(!edge->faces->next && !next_edge->faces->next
-						 && vert->faces->next)
-				/* FIXME this needs to find all faces that share edges with
-				* this one and split off together
-				*/
-				split_single_vert(vert, face, mesh);
-		}
-	}
+	temd->split_angle = emd->split_angle;
+	temd->flags = emd->flags;
 }
 
-static DerivedMesh *edgesplitModifier_do(EdgeSplitModifierData *emd, DerivedMesh *dm)
+static DerivedMesh *edgesplitModifier_do(EdgeSplitModifierData *emd,
+					 Object *ob, DerivedMesh *dm)
 {
-	SmoothMesh *mesh;
-	DerivedMesh *result;
-	int max_verts, max_edges;
-
-	if(!(emd->flags & (MOD_EDGESPLIT_FROMANGLE | MOD_EDGESPLIT_FROMFLAG)))
+	if (!(emd->flags & (MOD_EDGESPLIT_FROMANGLE | MOD_EDGESPLIT_FROMFLAG)))
 		return dm;
 
-	/* 1. make smoothmesh with initial number of elements */
-	mesh = smoothmesh_from_derivedmesh(dm);
-
-	/* 2. count max number of elements to add */
-	tag_and_count_extra_edges(mesh, emd->split_angle, emd->flags, &max_edges);
-	max_verts = max_edges * 2 + mesh->max_verts;
-	max_verts += count_bridge_verts(mesh);
-	max_edges += mesh->max_edges;
-
-	/* 3. reallocate smoothmesh arrays & copy elements across */
-	/* 4. remap copied elements' pointers to point into the new arrays */
-	smoothmesh_resize_verts(mesh, max_verts);
-	smoothmesh_resize_edges(mesh, max_edges);
-
-#ifdef EDGESPLIT_DEBUG_1
-	printf("********** Pre-split **********\n");
-	smoothmesh_print(mesh);
-#endif
-
-	split_sharp_edges(mesh, emd->split_angle, emd->flags);
-#ifdef EDGESPLIT_DEBUG_1
-	printf("********** Post-edge-split **********\n");
-	smoothmesh_print(mesh);
-#endif
-
-	split_bridge_verts(mesh);
-
-#ifdef EDGESPLIT_DEBUG_1
-	printf("********** Post-vert-split **********\n");
-	smoothmesh_print(mesh);
-#endif
-
-#ifdef EDGESPLIT_DEBUG_0
-	printf("Edgesplit: Estimated %d verts & %d edges, "
-		"found %d verts & %d edges\n", max_verts, max_edges,
-		mesh->num_verts, mesh->num_edges);
-#endif
-
-	result = CDDM_from_smoothmesh(mesh);
-	smoothmesh_free(mesh);
-
-	return result;
+	return doEdgeSplit(dm, emd, ob);
 }
 
-static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
-						DerivedMesh *derivedData,
-						int UNUSED(useRenderParams),
-						int UNUSED(isFinalCalc))
+static DerivedMesh *applyModifier(
+		ModifierData *md, Object *ob, DerivedMesh *derivedData,
+		int UNUSED(useRenderParams), int UNUSED(isFinalCalc))
 {
 	DerivedMesh *result;
 	EdgeSplitModifierData *emd = (EdgeSplitModifierData*) md;
 
-	result = edgesplitModifier_do(emd, derivedData);
+	result = edgesplitModifier_do(emd, ob, derivedData);
 
-	if(result != derivedData)
+	if (result != derivedData)
 		CDDM_calc_normals(result);
 
 	return result;
 }
 
 static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
-						struct EditMesh *UNUSED(editData),
+						struct BMEditMesh *UNUSED(editData),
 						DerivedMesh *derivedData)
 {
 	return applyModifier(md, ob, derivedData, 0, 1);
diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c
index d00d76f..a1dc699 100644
--- a/source/blender/modifiers/intern/MOD_explode.c
+++ b/source/blender/modifiers/intern/MOD_explode.c
@@ -67,7 +67,7 @@ static void freeData(ModifierData *md)
 {
 	ExplodeModifierData *emd= (ExplodeModifierData*) md;
 	
-	if(emd->facepa) MEM_freeN(emd->facepa);
+	if (emd->facepa) MEM_freeN(emd->facepa);
 }
 static void copyData(ModifierData *md, ModifierData *target)
 {
@@ -88,7 +88,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
 	ExplodeModifierData *emd= (ExplodeModifierData*) md;
 	CustomDataMask dataMask = 0;
 
-	if(emd->vgroup)
+	if (emd->vgroup)
 		dataMask |= CD_MASK_MDEFORMVERT;
 
 	return dataMask;
@@ -108,14 +108,14 @@ static void createFacepa(ExplodeModifierData *emd,
 	int i,p,v1,v2,v3,v4=0;
 
 	mvert = dm->getVertArray(dm);
-	mface = dm->getFaceArray(dm);
-	totface= dm->getNumFaces(dm);
+	mface = dm->getTessFaceArray(dm);
+	totface= dm->getNumTessFaces(dm);
 	totvert= dm->getNumVerts(dm);
 	totpart= psmd->psys->totpart;
 
 	BLI_srandom(psys->seed);
 
-	if(emd->facepa)
+	if (emd->facepa)
 		MEM_freeN(emd->facepa);
 
 	facepa = emd->facepa = MEM_callocN(sizeof(int)*totface, "explode_facepa");
@@ -123,21 +123,21 @@ static void createFacepa(ExplodeModifierData *emd,
 	vertpa = MEM_callocN(sizeof(int)*totvert, "explode_vertpa");
 
 	/* initialize all faces & verts to no particle */
-	for(i=0; i<totface; i++)
+	for (i=0; i<totface; i++)
 		facepa[i]=totpart;
 
 	for (i=0; i<totvert; i++)
 		vertpa[i]=totpart;
 
 	/* set protected verts */
-	if(emd->vgroup){
+	if (emd->vgroup) {
 		MDeformVert *dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
-		if(dvert){
+		if (dvert) {
 			const int defgrp_index= emd->vgroup-1;
-			for(i=0; i<totvert; i++, dvert++){
+			for (i=0; i<totvert; i++, dvert++) {
 				float val = BLI_frand();
 				val = (1.0f-emd->protect)*val + emd->protect*0.5f;
-				if(val < defvert_find_weight(dvert, defgrp_index))
+				if (val < defvert_find_weight(dvert, defgrp_index))
 					vertpa[i] = -1;
 			}
 		}
@@ -145,17 +145,17 @@ static void createFacepa(ExplodeModifierData *emd,
 
 	/* make tree of emitter locations */
 	tree=BLI_kdtree_new(totpart);
-	for(p=0,pa=psys->particles; p<totpart; p++,pa++){
+	for (p=0,pa=psys->particles; p<totpart; p++,pa++) {
 		psys_particle_on_emitter(psmd,psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,co,NULL,NULL,NULL,NULL,NULL);
 		BLI_kdtree_insert(tree, p, co, NULL);
 	}
 	BLI_kdtree_balance(tree);
 
 	/* set face-particle-indexes to nearest particle to face center */
-	for(i=0,fa=mface; i<totface; i++,fa++){
+	for (i=0,fa=mface; i<totface; i++,fa++) {
 		add_v3_v3v3(center,mvert[fa->v1].co,mvert[fa->v2].co);
 		add_v3_v3(center, mvert[fa->v3].co);
-		if(fa->v4){
+		if (fa->v4) {
 			add_v3_v3(center, mvert[fa->v4].co);
 			mul_v3_fl(center,0.25);
 		}
@@ -167,23 +167,23 @@ static void createFacepa(ExplodeModifierData *emd,
 		v1=vertpa[fa->v1];
 		v2=vertpa[fa->v2];
 		v3=vertpa[fa->v3];
-		if(fa->v4)
+		if (fa->v4)
 			v4=vertpa[fa->v4];
 
-		if(v1>=0 && v2>=0 && v3>=0 && (fa->v4==0 || v4>=0))
+		if (v1>=0 && v2>=0 && v3>=0 && (fa->v4==0 || v4>=0))
 			facepa[i]=p;
 
-		if(v1>=0) vertpa[fa->v1]=p;
-		if(v2>=0) vertpa[fa->v2]=p;
-		if(v3>=0) vertpa[fa->v3]=p;
-		if(fa->v4 && v4>=0) vertpa[fa->v4]=p;
+		if (v1>=0) vertpa[fa->v1]=p;
+		if (v2>=0) vertpa[fa->v2]=p;
+		if (v3>=0) vertpa[fa->v3]=p;
+		if (fa->v4 && v4>=0) vertpa[fa->v4]=p;
 	}
 
-	if(vertpa) MEM_freeN(vertpa);
+	if (vertpa) MEM_freeN(vertpa);
 	BLI_kdtree_free(tree);
 }
 
-static int edgecut_get(EdgeHash *edgehash, int v1, int v2)
+static int edgecut_get(EdgeHash *edgehash, unsigned int v1, unsigned int v2)
 {
 	return GET_INT_FROM_POINTER(BLI_edgehash_lookup(edgehash, v1, v2));
 }
@@ -198,20 +198,21 @@ static const short add_faces[24] = {
 
 static MFace *get_dface(DerivedMesh *dm, DerivedMesh *split, int cur, int i, MFace *mf)
 {
-	MFace *df = CDDM_get_face(split, cur);
-	DM_copy_face_data(dm, split, i, cur, 1);
+	MFace *df = CDDM_get_tessface(split, cur);
+	DM_copy_tessface_data(dm, split, i, cur, 1);
 	*df = *mf;
 	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;
+		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);
+#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)
 
 static void remap_faces_3_6_9_12(DerivedMesh *dm, DerivedMesh *split, MFace *mf, int *facepa, int *vertpa, int i, EdgeHash *eh, int cur, int v1, int v2, int v3, int v4)
 {
@@ -221,15 +222,15 @@ static void remap_faces_3_6_9_12(DerivedMesh *dm, DerivedMesh *split, MFace *mf,
 
 	facepa[cur] = vertpa[v1];
 	df1->v1 = v1;
-	df1->v2 = GET_ES(v1, v2)
-	df1->v3 = GET_ES(v2, v3)
+	df1->v2 = GET_ES(v1, v2);
+	df1->v3 = GET_ES(v2, v3);
 	df1->v4 = v3;
 	df1->flag |= ME_FACE_SEL;
 
 	facepa[cur+1] = vertpa[v2];
-	df2->v1 = GET_ES(v1, v2)
+	df2->v1 = GET_ES(v1, v2);
 	df2->v2 = v2;
-	df2->v3 = GET_ES(v2, v3)
+	df2->v3 = GET_ES(v2, v3);
 	df2->v4 = 0;
 	df2->flag &= ~ME_FACE_SEL;
 
@@ -246,7 +247,7 @@ static void remap_uvs_3_6_9_12(DerivedMesh *dm, DerivedMesh *split, int numlayer
 	MTFace *mf, *df1, *df2, *df3;
 	int l;
 
-	for(l=0; l<numlayer; l++) {
+	for (l=0; l<numlayer; l++) {
 		mf = CustomData_get_layer_n(&split->faceData, CD_MTFACE, l);
 		df1 = mf+cur;
 		df2 = df1 + 1;
@@ -255,13 +256,13 @@ static void remap_uvs_3_6_9_12(DerivedMesh *dm, DerivedMesh *split, int numlayer
 		mf += i;
 
 		copy_v2_v2(df1->uv[0], mf->uv[c0]);
-		INT_UV(df1->uv[1], c0, c1)
-		INT_UV(df1->uv[2], c1, c2)
+		INT_UV(df1->uv[1], c0, c1);
+		INT_UV(df1->uv[2], c1, c2);
 		copy_v2_v2(df1->uv[3], mf->uv[c2]);
 
-		INT_UV(df2->uv[0], c0, c1)
+		INT_UV(df2->uv[0], c0, c1);
 		copy_v2_v2(df2->uv[1], mf->uv[c1]);
-		INT_UV(df2->uv[2], c1, c2)
+		INT_UV(df2->uv[2], c1, c2);
 
 		copy_v2_v2(df3->uv[0], mf->uv[c0]);
 		copy_v2_v2(df3->uv[1], mf->uv[c2]);
@@ -277,13 +278,13 @@ static void remap_faces_5_10(DerivedMesh *dm, DerivedMesh *split, MFace *mf, int
 	facepa[cur] = vertpa[v1];
 	df1->v1 = v1;
 	df1->v2 = v2;
-	df1->v3 = GET_ES(v2, v3)
-	df1->v4 = GET_ES(v1, v4)
+	df1->v3 = GET_ES(v2, v3);
+	df1->v4 = GET_ES(v1, v4);
 	df1->flag |= ME_FACE_SEL;
 
 	facepa[cur+1] = vertpa[v3];
-	df2->v1 = GET_ES(v1, v4)
-	df2->v2 = GET_ES(v2, v3)
+	df2->v1 = GET_ES(v1, v4);
+	df2->v2 = GET_ES(v2, v3);
 	df2->v3 = v3;
 	df2->v4 = v4;
 	df2->flag |= ME_FACE_SEL;
@@ -294,7 +295,7 @@ static void remap_uvs_5_10(DerivedMesh *dm, DerivedMesh *split, int numlayer, in
 	MTFace *mf, *df1, *df2;
 	int l;
 
-	for(l=0; l<numlayer; l++) {
+	for (l=0; l<numlayer; l++) {
 		mf = CustomData_get_layer_n(&split->faceData, CD_MTFACE, l);
 		df1 = mf+cur;
 		df2 = df1 + 1;
@@ -303,11 +304,11 @@ static void remap_uvs_5_10(DerivedMesh *dm, DerivedMesh *split, int numlayer, in
 
 		copy_v2_v2(df1->uv[0], mf->uv[c0]);
 		copy_v2_v2(df1->uv[1], mf->uv[c1]);
-		INT_UV(df1->uv[2], c1, c2)
-		INT_UV(df1->uv[3], c0, c3)
+		INT_UV(df1->uv[2], c1, c2);
+		INT_UV(df1->uv[3], c0, c3);
 
-		INT_UV(df2->uv[0], c0, c3)
-		INT_UV(df2->uv[1], c1, c2)
+		INT_UV(df2->uv[0], c0, c3);
+		INT_UV(df2->uv[1], c1, c2);
 		copy_v2_v2(df2->uv[2], mf->uv[c2]);
 		copy_v2_v2(df2->uv[3], mf->uv[c3]);
 
@@ -323,29 +324,29 @@ static void remap_faces_15(DerivedMesh *dm, DerivedMesh *split, MFace *mf, int *
 
 	facepa[cur] = vertpa[v1];
 	df1->v1 = v1;
-	df1->v2 = GET_ES(v1, v2)
-	df1->v3 = GET_ES(v1, v3)
-	df1->v4 = GET_ES(v1, v4)
+	df1->v2 = GET_ES(v1, v2);
+	df1->v3 = GET_ES(v1, v3);
+	df1->v4 = GET_ES(v1, v4);
 	df1->flag |= ME_FACE_SEL;
 
 	facepa[cur+1] = vertpa[v2];
-	df2->v1 = GET_ES(v1, v2)
+	df2->v1 = GET_ES(v1, v2);
 	df2->v2 = v2;
-	df2->v3 = GET_ES(v2, v3)
-	df2->v4 = GET_ES(v1, v3)
+	df2->v3 = GET_ES(v2, v3);
+	df2->v4 = GET_ES(v1, v3);
 	df2->flag |= ME_FACE_SEL;
 
 	facepa[cur+2] = vertpa[v3];
-	df3->v1 = GET_ES(v1, v3)
-	df3->v2 = GET_ES(v2, v3)
+	df3->v1 = GET_ES(v1, v3);
+	df3->v2 = GET_ES(v2, v3);
 	df3->v3 = v3;
-	df3->v4 = GET_ES(v3, v4)
+	df3->v4 = GET_ES(v3, v4);
 	df3->flag |= ME_FACE_SEL;
 
 	facepa[cur+3] = vertpa[v4];
-	df4->v1 = GET_ES(v1, v4)
-	df4->v2 = GET_ES(v1, v3)
-	df4->v3 = GET_ES(v3, v4)
+	df4->v1 = GET_ES(v1, v4);
+	df4->v2 = GET_ES(v1, v3);
+	df4->v3 = GET_ES(v3, v4);
 	df4->v4 = v4;
 	df4->flag |= ME_FACE_SEL;
 }
@@ -355,7 +356,7 @@ static void remap_uvs_15(DerivedMesh *dm, DerivedMesh *split, int numlayer, int
 	MTFace *mf, *df1, *df2, *df3, *df4;
 	int l;
 
-	for(l=0; l<numlayer; l++) {
+	for (l=0; l<numlayer; l++) {
 		mf = CustomData_get_layer_n(&split->faceData, CD_MTFACE, l);
 		df1 = mf+cur;
 		df2 = df1 + 1;
@@ -365,23 +366,23 @@ static void remap_uvs_15(DerivedMesh *dm, DerivedMesh *split, int numlayer, int
 		mf += i;
 
 		copy_v2_v2(df1->uv[0], mf->uv[c0]);
-		INT_UV(df1->uv[1], c0, c1)
-		INT_UV(df1->uv[2], c0, c2)
-		INT_UV(df1->uv[3], c0, c3)
+		INT_UV(df1->uv[1], c0, c1);
+		INT_UV(df1->uv[2], c0, c2);
+		INT_UV(df1->uv[3], c0, c3);
 
-		INT_UV(df2->uv[0], c0, c1)
+		INT_UV(df2->uv[0], c0, c1);
 		copy_v2_v2(df2->uv[1], mf->uv[c1]);
-		INT_UV(df2->uv[2], c1, c2)
-		INT_UV(df2->uv[3], c0, c2)
+		INT_UV(df2->uv[2], c1, c2);
+		INT_UV(df2->uv[3], c0, c2);
 
-		INT_UV(df3->uv[0], c0, c2)
-		INT_UV(df3->uv[1], c1, c2)
+		INT_UV(df3->uv[0], c0, c2);
+		INT_UV(df3->uv[1], c1, c2);
 		copy_v2_v2(df3->uv[2], mf->uv[c2]);
-		INT_UV(df3->uv[3], c2, c3)
+		INT_UV(df3->uv[3], c2, c3);
 
-		INT_UV(df4->uv[0], c0, c3)
-		INT_UV(df4->uv[1], c0, c2)
-		INT_UV(df4->uv[2], c2, c3)
+		INT_UV(df4->uv[0], c0, c3);
+		INT_UV(df4->uv[1], c0, c2);
+		INT_UV(df4->uv[2], c2, c3);
 		copy_v2_v2(df4->uv[3], mf->uv[c3]);
 	}
 }
@@ -394,21 +395,21 @@ static void remap_faces_7_11_13_14(DerivedMesh *dm, DerivedMesh *split, MFace *m
 
 	facepa[cur] = vertpa[v1];
 	df1->v1 = v1;
-	df1->v2 = GET_ES(v1, v2)
-	df1->v3 = GET_ES(v2, v3)
-	df1->v4 = GET_ES(v1, v4)
+	df1->v2 = GET_ES(v1, v2);
+	df1->v3 = GET_ES(v2, v3);
+	df1->v4 = GET_ES(v1, v4);
 	df1->flag |= ME_FACE_SEL;
 
 	facepa[cur+1] = vertpa[v2];
-	df2->v1 = GET_ES(v1, v2)
+	df2->v1 = GET_ES(v1, v2);
 	df2->v2 = v2;
-	df2->v3 = GET_ES(v2, v3)
+	df2->v3 = GET_ES(v2, v3);
 	df2->v4 = 0;
 	df2->flag &= ~ME_FACE_SEL;
 
 	facepa[cur+2] = vertpa[v4];
-	df3->v1 = GET_ES(v1, v4)
-	df3->v2 = GET_ES(v2, v3)
+	df3->v1 = GET_ES(v1, v4);
+	df3->v2 = GET_ES(v2, v3);
 	df3->v3 = v3;
 	df3->v4 = v4;
 	df3->flag |= ME_FACE_SEL;
@@ -419,7 +420,7 @@ static void remap_uvs_7_11_13_14(DerivedMesh *dm, DerivedMesh *split, int numlay
 	MTFace *mf, *df1, *df2, *df3;
 	int l;
 
-	for(l=0; l<numlayer; l++) {
+	for (l=0; l<numlayer; l++) {
 		mf = CustomData_get_layer_n(&split->faceData, CD_MTFACE, l);
 		df1 = mf+cur;
 		df2 = df1 + 1;
@@ -428,16 +429,16 @@ static void remap_uvs_7_11_13_14(DerivedMesh *dm, DerivedMesh *split, int numlay
 		mf += i;
 
 		copy_v2_v2(df1->uv[0], mf->uv[c0]);
-		INT_UV(df1->uv[1], c0, c1)
-		INT_UV(df1->uv[2], c1, c2)
-		INT_UV(df1->uv[3], c0, c3)
+		INT_UV(df1->uv[1], c0, c1);
+		INT_UV(df1->uv[2], c1, c2);
+		INT_UV(df1->uv[3], c0, c3);
 
-		INT_UV(df2->uv[0], c0, c1)
+		INT_UV(df2->uv[0], c0, c1);
 		copy_v2_v2(df2->uv[1], mf->uv[c1]);
-		INT_UV(df2->uv[2], c1, c2)
+		INT_UV(df2->uv[2], c1, c2);
 
-		INT_UV(df3->uv[0], c0, c3)
-		INT_UV(df3->uv[1], c1, c2)
+		INT_UV(df3->uv[0], c0, c3);
+		INT_UV(df3->uv[1], c1, c2);
 		copy_v2_v2(df3->uv[2], mf->uv[c2]);
 		copy_v2_v2(df3->uv[3], mf->uv[c3]);
 	}
@@ -450,16 +451,16 @@ static void remap_faces_19_21_22(DerivedMesh *dm, DerivedMesh *split, MFace *mf,
 
 	facepa[cur] = vertpa[v1];
 	df1->v1 = v1;
-	df1->v2 = GET_ES(v1, v2)
-	df1->v3 = GET_ES(v1, v3)
+	df1->v2 = GET_ES(v1, v2);
+	df1->v3 = GET_ES(v1, v3);
 	df1->v4 = 0;
 	df1->flag &= ~ME_FACE_SEL;
 
 	facepa[cur+1] = vertpa[v2];
-	df2->v1 = GET_ES(v1, v2)
+	df2->v1 = GET_ES(v1, v2);
 	df2->v2 = v2;
 	df2->v3 = v3;
-	df2->v4 = GET_ES(v1, v3)
+	df2->v4 = GET_ES(v1, v3);
 	df2->flag |= ME_FACE_SEL;
 }
 
@@ -468,7 +469,7 @@ static void remap_uvs_19_21_22(DerivedMesh *dm, DerivedMesh *split, int numlayer
 	MTFace *mf, *df1, *df2;
 	int l;
 
-	for(l=0; l<numlayer; l++) {
+	for (l=0; l<numlayer; l++) {
 		mf = CustomData_get_layer_n(&split->faceData, CD_MTFACE, l);
 		df1 = mf+cur;
 		df2 = df1 + 1;
@@ -476,13 +477,13 @@ static void remap_uvs_19_21_22(DerivedMesh *dm, DerivedMesh *split, int numlayer
 		mf += i;
 
 		copy_v2_v2(df1->uv[0], mf->uv[c0]);
-		INT_UV(df1->uv[1], c0, c1)
-		INT_UV(df1->uv[2], c0, c2)
+		INT_UV(df1->uv[1], c0, c1);
+		INT_UV(df1->uv[2], c0, c2);
 
-		INT_UV(df2->uv[0], c0, c1)
+		INT_UV(df2->uv[0], c0, c1);
 		copy_v2_v2(df2->uv[1], mf->uv[c1]);
 		copy_v2_v2(df2->uv[2], mf->uv[c2]);
-		INT_UV(df2->uv[3], c0, c2)
+		INT_UV(df2->uv[3], c0, c2);
 	}
 }
 
@@ -494,21 +495,21 @@ static void remap_faces_23(DerivedMesh *dm, DerivedMesh *split, MFace *mf, int *
 
 	facepa[cur] = vertpa[v1];
 	df1->v1 = v1;
-	df1->v2 = GET_ES(v1, v2)
-	df1->v3 = GET_ES(v2, v3)
-	df1->v4 = GET_ES(v1, v3)
+	df1->v2 = GET_ES(v1, v2);
+	df1->v3 = GET_ES(v2, v3);
+	df1->v4 = GET_ES(v1, v3);
 	df1->flag |= ME_FACE_SEL;
 
 	facepa[cur+1] = vertpa[v2];
-	df2->v1 = GET_ES(v1, v2)
+	df2->v1 = GET_ES(v1, v2);
 	df2->v2 = v2;
-	df2->v3 = GET_ES(v2, v3)
+	df2->v3 = GET_ES(v2, v3);
 	df2->v4 = 0;
 	df2->flag &= ~ME_FACE_SEL;
 
 	facepa[cur+2] = vertpa[v3];
-	df3->v1 = GET_ES(v1, v3)
-	df3->v2 = GET_ES(v2, v3)
+	df3->v1 = GET_ES(v1, v3);
+	df3->v2 = GET_ES(v2, v3);
 	df3->v3 = v3;
 	df3->v4 = 0;
 	df3->flag &= ~ME_FACE_SEL;
@@ -519,7 +520,7 @@ static void remap_uvs_23(DerivedMesh *dm, DerivedMesh *split, int numlayer, int
 	MTFace *mf, *df1, *df2;
 	int l;
 
-	for(l=0; l<numlayer; l++) {
+	for (l=0; l<numlayer; l++) {
 		mf = CustomData_get_layer_n(&split->faceData, CD_MTFACE, l);
 		df1 = mf+cur;
 		df2 = df1 + 1;
@@ -527,16 +528,16 @@ static void remap_uvs_23(DerivedMesh *dm, DerivedMesh *split, int numlayer, int
 		mf += i;
 
 		copy_v2_v2(df1->uv[0], mf->uv[c0]);
-		INT_UV(df1->uv[1], c0, c1)
-		INT_UV(df1->uv[2], c1, c2)
-		INT_UV(df1->uv[3], c0, c2)
+		INT_UV(df1->uv[1], c0, c1);
+		INT_UV(df1->uv[2], c1, c2);
+		INT_UV(df1->uv[3], c0, c2);
 
-		INT_UV(df2->uv[0], c0, c1)
+		INT_UV(df2->uv[0], c0, c1);
 		copy_v2_v2(df2->uv[1], mf->uv[c1]);
-		INT_UV(df2->uv[2], c1, c2)
+		INT_UV(df2->uv[2], c1, c2);
 
-		INT_UV(df2->uv[0], c0, c2)
-		INT_UV(df2->uv[1], c1, c2)
+		INT_UV(df2->uv[0], c0, c2);
+		INT_UV(df2->uv[1], c1, c2);
 		copy_v2_v2(df2->uv[2], mf->uv[c2]);
 	}
 }
@@ -545,12 +546,12 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
 {
 	DerivedMesh *splitdm;
 	MFace *mf=NULL,*df1=NULL;
-	MFace *mface=dm->getFaceArray(dm);
+	MFace *mface=dm->getTessFaceArray(dm);
 	MVert *dupve, *mv;
 	EdgeHash *edgehash;
 	EdgeHashIterator *ehi;
 	int totvert=dm->getNumVerts(dm);
-	int totface=dm->getNumFaces(dm);
+	int totface=dm->getNumTessFaces(dm);
 
 	int *facesplit = MEM_callocN(sizeof(int)*totface,"explode_facesplit");
 	int *vertpa = MEM_callocN(sizeof(int)*totvert,"explode_vertpa2");
@@ -569,7 +570,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
 		vertpa[mf->v1]=facepa[i];
 		vertpa[mf->v2]=facepa[i];
 		vertpa[mf->v3]=facepa[i];
-		if(mf->v4)
+		if (mf->v4)
 			vertpa[mf->v4]=facepa[i];
 	}
 
@@ -579,37 +580,37 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
 		v2=vertpa[mf->v2];
 		v3=vertpa[mf->v3];
 
-		if(v1!=v2){
+		if (v1!=v2) {
 			BLI_edgehash_insert(edgehash, mf->v1, mf->v2, NULL);
 			(*fs) |= 1;
 		}
 
-		if(v2!=v3){
+		if (v2!=v3) {
 			BLI_edgehash_insert(edgehash, mf->v2, mf->v3, NULL);
 			(*fs) |= 2;
 		}
 
-		if(mf->v4){
+		if (mf->v4) {
 			v4=vertpa[mf->v4];
 
-			if(v3!=v4){
+			if (v3!=v4) {
 				BLI_edgehash_insert(edgehash, mf->v3, mf->v4, NULL);
 				(*fs) |= 4;
 			}
 
-			if(v1!=v4){
+			if (v1!=v4) {
 				BLI_edgehash_insert(edgehash, mf->v1, mf->v4, NULL);
 				(*fs) |= 8;
 			}
 
 			/* mark center vertex as a fake edge split */
-			if(*fs == 15)
+			if (*fs == 15)
 				BLI_edgehash_insert(edgehash, mf->v1, mf->v3, NULL);
 		}
 		else {
 			(*fs) |= 16; /* mark face as tri */
 
-			if(v1!=v3){
+			if (v1!=v3) {
 				BLI_edgehash_insert(edgehash, mf->v1, mf->v3, NULL);
 				(*fs) |= 4;
 			}
@@ -619,21 +620,21 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
 	/* count splits & create indexes for new verts */
 	ehi= BLI_edgehashIterator_new(edgehash);
 	totesplit=totvert;
-	for(; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
+	for (; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
 		BLI_edgehashIterator_setValue(ehi, SET_INT_IN_POINTER(totesplit));
 		totesplit++;
 	}
 	BLI_edgehashIterator_free(ehi);
 
 	/* count new faces due to splitting */
-	for(i=0,fs=facesplit; i<totface; i++,fs++)
+	for (i=0,fs=facesplit; i<totface; i++,fs++)
 		totfsplit += add_faces[*fs];
 	
-	splitdm= CDDM_from_template(dm, totesplit, 0, totface+totfsplit);
+	splitdm= CDDM_from_template(dm, totesplit, 0, totface+totfsplit, 0, 0);
 	numlayer = CustomData_number_of_layers(&splitdm->faceData, CD_MTFACE);
 
 	/* copy new faces & verts (is it really this painful with custom data??) */
-	for(i=0; i<totvert; i++){
+	for (i=0; i<totvert; i++) {
 		MVert source;
 		MVert *dest;
 		dm->getVert(dm, i, &source);
@@ -644,13 +645,18 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
 	}
 
 	/* override original facepa (original pointer is saved in caller function) */
-	facepa= MEM_callocN(sizeof(int)*(totface+totfsplit),"explode_facepa");
+
+	/* BMESH_TODO, (totfsplit * 2) over allocation is used since the quads are
+	 * later interpreted as tri's, for this to work right I think we probably
+	 * have to stop using tessface - campbell */
+
+	facepa= MEM_callocN(sizeof(int)*(totface+(totfsplit * 2)),"explode_facepa");
 	//memcpy(facepa,emd->facepa,totface*sizeof(int));
 	emd->facepa=facepa;
 
 	/* create new verts */
 	ehi= BLI_edgehashIterator_new(edgehash);
-	for(; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
+	for (; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
 		BLI_edgehashIterator_getKey(ehi, &ed_v1, &ed_v2);
 		esplit= GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi));
 		mv=CDDM_get_vert(splitdm, ed_v2);
@@ -670,38 +676,38 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
 	/* create new faces */
 	curdupface=0;//=totface;
 	//curdupin=totesplit;
-	for(i=0,fs=facesplit; i<totface; i++,fs++){
-		mf = dm->getFaceData(dm, i, CD_MFACE);
+	for (i=0,fs=facesplit; i<totface; i++,fs++) {
+		mf = dm->getTessFaceData(dm, i, CD_MFACE);
 
 		switch(*fs) {
 		case 3:
 		case 10:
 		case 11:
 		case 15:
-			SET_VERTS(1, 2, 3, 4)
+			SET_VERTS(1, 2, 3, 4);
 			break;
 		case 5:
 		case 6:
 		case 7:
-			SET_VERTS(2, 3, 4, 1)
+			SET_VERTS(2, 3, 4, 1);
 			break;
 		case 9:
 		case 13:
-			SET_VERTS(4, 1, 2, 3)
+			SET_VERTS(4, 1, 2, 3);
 			break;
 		case 12:
 		case 14:
-			SET_VERTS(3, 4, 1, 2)
+			SET_VERTS(3, 4, 1, 2);
 			break;
 		case 21:
 		case 23:
-			SET_VERTS(1, 2, 3, 4)
+			SET_VERTS(1, 2, 3, 4);
 			break;
 		case 19:
-			SET_VERTS(2, 3, 1, 4)
+			SET_VERTS(2, 3, 1, 4);
 			break;
 		case 22:
-			SET_VERTS(3, 1, 2, 4)
+			SET_VERTS(3, 1, 2, 4);
 			break;
 		}
 
@@ -711,18 +717,18 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
 		case 9:
 		case 12:
 			remap_faces_3_6_9_12(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2], v[3]);
-			if(numlayer)
+			if (numlayer)
 				remap_uvs_3_6_9_12(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2], uv[3]);
 			break;
 		case 5:
 		case 10:
 			remap_faces_5_10(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2], v[3]);
-			if(numlayer)
+			if (numlayer)
 				remap_uvs_5_10(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2], uv[3]);
 			break;
 		case 15:
 			remap_faces_15(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2], v[3]);
-			if(numlayer)
+			if (numlayer)
 				remap_uvs_15(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2], uv[3]);
 			break;
 		case 7:
@@ -730,19 +736,19 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
 		case 13:
 		case 14:
 			remap_faces_7_11_13_14(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2], v[3]);
-			if(numlayer)
+			if (numlayer)
 				remap_uvs_7_11_13_14(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2], uv[3]);
 			break;
 		case 19:
 		case 21:
 		case 22:
 			remap_faces_19_21_22(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2]);
-			if(numlayer)
+			if (numlayer)
 				remap_uvs_19_21_22(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2]);
 			break;
 		case 23:
 			remap_faces_23(dm, splitdm, mf, facepa, vertpa, i, edgehash, curdupface, v[0], v[1], v[2]);
-			if(numlayer)
+			if (numlayer)
 				remap_uvs_23(dm, splitdm, numlayer, i, curdupface, uv[0], uv[1], uv[2]);
 			break;
 		case 0:
@@ -750,7 +756,7 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
 			df1 = get_dface(dm, splitdm, curdupface, i, mf);
 			facepa[curdupface] = vertpa[mf->v1];
 
-			if(df1->v4)
+			if (df1->v4)
 				df1->flag |= ME_FACE_SEL;
 			else
 				df1->flag &= ~ME_FACE_SEL;
@@ -760,8 +766,8 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
 		curdupface += add_faces[*fs]+1;
 	}
 
-	for(i=0; i<curdupface; i++) {
-		mf = CDDM_get_face(splitdm, i);
+	for (i=0; i<curdupface; i++) {
+		mf = CDDM_get_tessface(splitdm, i);
 		test_index_face(mf, &splitdm->faceData, i, (mf->flag & ME_FACE_SEL ? 4 : 3));
 	}
 
@@ -769,8 +775,10 @@ static DerivedMesh * cutEdges(ExplodeModifierData *emd, DerivedMesh *dm)
 	MEM_freeN(facesplit);
 	MEM_freeN(vertpa);
 
-	return splitdm;
+	CDDM_calc_edges_tessface(splitdm);
+	CDDM_tessfaces_to_faces(splitdm); /*builds ngon faces from tess (mface) faces*/
 
+	return splitdm;
 }
 static DerivedMesh * explodeMesh(ExplodeModifierData *emd, 
 		ParticleSystemModifierData *psmd, Scene *scene, Object *ob, 
@@ -794,9 +802,9 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
 	unsigned int ed_v1, ed_v2, mindex=0;
 	MTFace *mtface = NULL, *mtf;
 
-	totface= dm->getNumFaces(dm);
+	totface= dm->getNumTessFaces(dm);
 	totvert= dm->getNumVerts(dm);
-	mface= dm->getFaceArray(dm);
+	mface= dm->getTessFaceArray(dm);
 	totpart= psmd->psys->totpart;
 
 	sim.scene= scene;
@@ -812,13 +820,13 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
 	vertpahash= BLI_edgehash_new();
 
 	for (i=0; i<totface; i++) {
-		if(facepa[i]!=totpart)
-		{
-			pa=pars+facepa[i];
+		if (facepa[i] != totpart) {
+			pa = pars + facepa[i];
 
-			if((pa->alive==PARS_UNBORN && (emd->flag&eExplodeFlag_Unborn)==0)
-				|| (pa->alive==PARS_ALIVE && (emd->flag&eExplodeFlag_Alive)==0)
-				|| (pa->alive==PARS_DEAD && (emd->flag&eExplodeFlag_Dead)==0)) {
+			if ((pa->alive == PARS_UNBORN && (emd->flag & eExplodeFlag_Unborn) == 0) ||
+			    (pa->alive == PARS_ALIVE && (emd->flag & eExplodeFlag_Alive) == 0) ||
+			    (pa->alive == PARS_DEAD && (emd->flag & eExplodeFlag_Dead) == 0))
+			{
 				delface++;
 				continue;
 			}
@@ -826,7 +834,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
 
 		/* do mindex + totvert to ensure the vertex index to be the first
 		 * with BLI_edgehashIterator_getKey */
-		if(facepa[i]==totpart || cfra < (pars+facepa[i])->time)
+		if (facepa[i]==totpart || cfra < (pars+facepa[i])->time)
 			mindex = totvert+totpart;
 		else 
 			mindex = totvert+facepa[i];
@@ -837,20 +845,20 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
 		BLI_edgehash_insert(vertpahash, mf->v1, mindex, NULL);
 		BLI_edgehash_insert(vertpahash, mf->v2, mindex, NULL);
 		BLI_edgehash_insert(vertpahash, mf->v3, mindex, NULL);
-		if(mf->v4)
+		if (mf->v4)
 			BLI_edgehash_insert(vertpahash, mf->v4, mindex, NULL);
 	}
 
 	/* make new vertice indexes & count total vertices after duplication */
 	ehi= BLI_edgehashIterator_new(vertpahash);
-	for(; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
+	for (; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
 		BLI_edgehashIterator_setValue(ehi, SET_INT_IN_POINTER(totdup));
 		totdup++;
 	}
 	BLI_edgehashIterator_free(ehi);
 
 	/* the final duplicated vertices */
-	explode= CDDM_from_template(dm, totdup, 0,totface-delface);
+	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);*/
 
@@ -861,7 +869,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
 
 	/* duplicate & displace vertices */
 	ehi= BLI_edgehashIterator_new(vertpahash);
-	for(; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
+	for (; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
 		MVert source;
 		MVert *dest;
 
@@ -876,7 +884,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
 		DM_copy_vert_data(dm, explode, ed_v1, v, 1);
 		*dest = source;
 
-		if(ed_v2 != totpart) {
+		if (ed_v2 != totpart) {
 			/* get particle */
 			pa= pars + ed_v2;
 
@@ -894,7 +902,7 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
 			sub_qt_qtqt(rot, state.rot, birth.rot);
 			mul_qt_v3(rot, vertco);
 
-			if(emd->flag & eExplodeFlag_PaSize)
+			if (emd->flag & eExplodeFlag_PaSize)
 				mul_v3_fl(vertco,pa->size);
 
 			add_v3_v3(vertco, state.co);
@@ -909,21 +917,20 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
 		MFace source;
 		int orig_v4;
 
-		if(facepa[i]!=totpart)
-		{
+		if (facepa[i]!=totpart) {
 			pa=pars+facepa[i];
 
-			if(pa->alive==PARS_UNBORN && (emd->flag&eExplodeFlag_Unborn)==0) continue;
-			if(pa->alive==PARS_ALIVE && (emd->flag&eExplodeFlag_Alive)==0) continue;
-			if(pa->alive==PARS_DEAD && (emd->flag&eExplodeFlag_Dead)==0) continue;
+			if (pa->alive==PARS_UNBORN && (emd->flag&eExplodeFlag_Unborn)==0) continue;
+			if (pa->alive==PARS_ALIVE && (emd->flag&eExplodeFlag_Alive)==0) continue;
+			if (pa->alive==PARS_DEAD && (emd->flag&eExplodeFlag_Dead)==0) continue;
 		}
 
-		dm->getFace(dm,i,&source);
-		mf=CDDM_get_face(explode,u);
+		dm->getTessFace(dm,i,&source);
+		mf=CDDM_get_tessface(explode,u);
 		
 		orig_v4 = source.v4;
 
-		if(facepa[i]!=totpart && cfra < pa->time)
+		if (facepa[i]!=totpart && cfra < pa->time)
 			mindex = totvert+totpart;
 		else 
 			mindex = totvert+facepa[i];
@@ -931,15 +938,15 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
 		source.v1 = edgecut_get(vertpahash, source.v1, mindex);
 		source.v2 = edgecut_get(vertpahash, source.v2, mindex);
 		source.v3 = edgecut_get(vertpahash, source.v3, mindex);
-		if(source.v4)
+		if (source.v4)
 			source.v4 = edgecut_get(vertpahash, source.v4, mindex);
 
-		DM_copy_face_data(dm,explode,i,u,1);
+		DM_copy_tessface_data(dm,explode,i,u,1);
 
 		*mf = source;
 
 		/* override uv channel for particle age */
-		if(mtface) {
+		if (mtface) {
 			float age = (cfra - pa->time)/pa->lifetime;
 			/* Clamp to this range to avoid flipping to the other side of the coordinates. */
 			CLAMP(age, 0.001f, 0.999f);
@@ -958,10 +965,11 @@ static DerivedMesh * explodeMesh(ExplodeModifierData *emd,
 	BLI_edgehash_free(vertpahash, NULL);
 
 	/* finalization */
-	CDDM_calc_edges(explode);
+	CDDM_calc_edges_tessface(explode);
+	CDDM_tessfaces_to_faces(explode);
 	CDDM_calc_normals(explode);
 
-	if(psmd->psys->lattice){
+	if (psmd->psys->lattice) {
 		end_latt_deform(psmd->psys->lattice);
 		psmd->psys->lattice= NULL;
 	}
@@ -974,8 +982,8 @@ static ParticleSystemModifierData * findPrecedingParticlesystem(Object *ob, Modi
 	ModifierData *md;
 	ParticleSystemModifierData *psmd= NULL;
 
-	for (md=ob->modifiers.first; emd!=md; md=md->next){
-		if(md->type==eModifierType_ParticleSystem)
+	for (md=ob->modifiers.first; emd!=md; md=md->next) {
+		if (md->type==eModifierType_ParticleSystem)
 			psmd= (ParticleSystemModifierData*) md;
 	}
 	return psmd;
@@ -989,29 +997,31 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
 	ExplodeModifierData *emd= (ExplodeModifierData*) md;
 	ParticleSystemModifierData *psmd=findPrecedingParticlesystem(ob,md);
 
-	if(psmd){
+	DM_ensure_tessface(dm); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
+
+	if (psmd) {
 		ParticleSystem * psys=psmd->psys;
 
-		if(psys==NULL || psys->totpart==0) return derivedData;
-		if(psys->part==NULL || psys->particles==NULL) return derivedData;
-		if(psmd->dm==NULL) return derivedData;
+		if (psys==NULL || psys->totpart==0) return derivedData;
+		if (psys->part==NULL || psys->particles==NULL) return derivedData;
+		if (psmd->dm==NULL) return derivedData;
 
 		/* 1. find faces to be exploded if needed */
-		if(emd->facepa == NULL
-				 || psmd->flag&eParticleSystemFlag_Pars
-				 || emd->flag&eExplodeFlag_CalcFaces
-				 || MEM_allocN_len(emd->facepa)/sizeof(int) != dm->getNumFaces(dm))
+		if (emd->facepa == NULL ||
+		    psmd->flag&eParticleSystemFlag_Pars ||
+		    emd->flag&eExplodeFlag_CalcFaces ||
+		    MEM_allocN_len(emd->facepa) / sizeof(int) != dm->getNumTessFaces(dm))
 		{
-			if(psmd->flag & eParticleSystemFlag_Pars)
+			if (psmd->flag & eParticleSystemFlag_Pars)
 				psmd->flag &= ~eParticleSystemFlag_Pars;
 			
-			if(emd->flag & eExplodeFlag_CalcFaces)
+			if (emd->flag & eExplodeFlag_CalcFaces)
 				emd->flag &= ~eExplodeFlag_CalcFaces;
 
 			createFacepa(emd,psmd,derivedData);
 		}
 		/* 2. create new mesh */
-		if(emd->flag & eExplodeFlag_EdgeCut){
+		if (emd->flag & eExplodeFlag_EdgeCut) {
 			int *facepa = emd->facepa;
 			DerivedMesh *splitdm=cutEdges(emd,dm);
 			DerivedMesh *explode=explodeMesh(emd, psmd, md->scene, ob, splitdm);
diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c
index 8bf5619..5518257 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim.c
@@ -68,7 +68,7 @@ static void copyData(ModifierData *md, ModifierData *target)
 	FluidsimModifierData *fluidmd= (FluidsimModifierData*) md;
 	FluidsimModifierData *tfluidmd= (FluidsimModifierData*) target;
 	
-	if(tfluidmd->fss)
+	if (tfluidmd->fss)
 		MEM_freeN(tfluidmd->fss);
 	
 	tfluidmd->fss = MEM_dupallocN(fluidmd->fss);
@@ -85,12 +85,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 	DerivedMesh *result = NULL;
 	
 	/* check for alloc failing */
-	if(!fluidmd->fss)
-	{
+	if (!fluidmd->fss) {
 		initData(md);
 		
-		if(!fluidmd->fss)
+		if (!fluidmd->fss) {
 			return dm;
+		}
 	}
 
 	result= fluidsimModifier_do(fluidmd, md->scene, ob, dm, useRenderParams, isFinalCalc);
@@ -105,20 +105,15 @@ static void updateDepgraph(
 	FluidsimModifierData *fluidmd= (FluidsimModifierData*) md;
 	Base *base;
 
-	if(fluidmd && fluidmd->fss)
-	{
-		if(fluidmd->fss->type == OB_FLUIDSIM_DOMAIN)
-		{
-			for(base = scene->base.first; base; base= base->next) 
-			{
+	if (fluidmd && fluidmd->fss) {
+		if (fluidmd->fss->type == OB_FLUIDSIM_DOMAIN) {
+			for (base = scene->base.first; base; base= base->next) {
 				Object *ob1= base->object;
-				if(ob1 != ob)
-				{
+				if (ob1 != ob) {
 					FluidsimModifierData *fluidmdtmp = (FluidsimModifierData *)modifiers_findByType(ob1, eModifierType_Fluidsim);
 					
-					// only put dependancies from NON-DOMAIN fluids in here
-					if(fluidmdtmp && fluidmdtmp->fss && (fluidmdtmp->fss->type!=OB_FLUIDSIM_DOMAIN))
-					{
+					/* only put dependencies from NON-DOMAIN fluids in here */
+					if (fluidmdtmp && fluidmdtmp->fss && (fluidmdtmp->fss->type!=OB_FLUIDSIM_DOMAIN)) {
 						DagNode *curNode = dag_get_node(forest, ob1);
 						dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Fluidsim Object");
 					}
diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c
index 0cdb2c8..fe0cb2e 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim_util.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c
@@ -66,13 +66,13 @@
 void fluidsim_init(FluidsimModifierData *fluidmd)
 {
 #ifdef WITH_MOD_FLUID
-	if(fluidmd)
+	if (fluidmd)
 	{
 		FluidsimSettings *fss = MEM_callocN(sizeof(FluidsimSettings), "fluidsimsettings");
 
 		fluidmd->fss = fss;
 		
-		if(!fss)
+		if (!fss)
 			return;
 		
 		fss->fmd = fluidmd;
@@ -85,7 +85,6 @@ void fluidsim_init(FluidsimModifierData *fluidmd)
 		fss->guiDisplayMode = 2; // preview
 		fss->renderDisplayMode = 3; // render
 
-		fss->viscosityMode = 2; // default to water
 		fss->viscosityValue = 1.0;
 		fss->viscosityExponent = 6;
 		
@@ -131,11 +130,11 @@ void fluidsim_init(FluidsimModifierData *fluidmd)
 		fss->cpsQuality = 10.0; // 1.0 / 10.0 => means 0.1 width
 		
 		/*
-		BAD TODO: this is done in buttons_object.c in the moment 
-		Mesh *mesh = ob->data;
-		// calculate bounding box
-		fluid_get_bb(mesh->mvert, mesh->totvert, ob->obmat, fss->bbStart, fss->bbSize);	
-		*/
+		 * BAD TODO: this is done in buttons_object.c in the moment
+		 * Mesh *mesh = ob->data;
+		 * // calculate bounding box
+		 * fluid_get_bb(mesh->mvert, mesh->totvert, ob->obmat, fss->bbStart, fss->bbSize);
+		 */
 		
 		fss->meshVelocities = NULL;
 		
@@ -152,9 +151,8 @@ void fluidsim_init(FluidsimModifierData *fluidmd)
 
 void fluidsim_free(FluidsimModifierData *fluidmd)
 {
-	if(fluidmd) {
-		if(fluidmd->fss->meshVelocities)
-		{
+	if (fluidmd && fluidmd->fss) {
+		if (fluidmd->fss->meshVelocities) {
 			MEM_freeN(fluidmd->fss->meshVelocities);
 			fluidmd->fss->meshVelocities = NULL;
 		}
@@ -166,25 +164,26 @@ void fluidsim_free(FluidsimModifierData *fluidmd)
 
 #ifdef WITH_MOD_FLUID
 /* read .bobj.gz file into a fluidsimDerivedMesh struct */
-static DerivedMesh *fluidsim_read_obj(const char *filename, const MFace *mf_example)
+static DerivedMesh *fluidsim_read_obj(const char *filename, const MPoly *mp_example)
 {
 	int wri = 0,i;
 	int gotBytes;
 	gzFile gzf;
 	int numverts = 0, numfaces = 0;
 	DerivedMesh *dm = NULL;
-	MFace *mf;
+	MPoly *mp;
+	MLoop *ml;
 	MVert *mv;
 	short *normals, *no_s;
 	float no[3];
 
-	const short mf_mat_nr = mf_example->mat_nr;
-	const char  mf_flag =   mf_example->flag;
+	const short mp_mat_nr = mp_example->mat_nr;
+	const char  mp_flag =   mp_example->flag;
 
 	// ------------------------------------------------
 	// get numverts + numfaces first
 	// ------------------------------------------------
-	gzf = gzopen(filename, "rb");
+	gzf = BLI_gzopen(filename, "rb");
 	if (!gzf)
 	{
 		return NULL;
@@ -199,34 +198,34 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MFace *mf_exam
 
 
 	// read number of normals
-	if(gotBytes)
+	if (gotBytes)
 		gotBytes = gzread(gzf, &wri, sizeof(wri));
 
 	// skip normals
 	gotBytes = gzseek(gzf, numverts * 3 * sizeof(float), SEEK_CUR) != -1;
 
 	/* get no. of triangles */
-	if(gotBytes)
+	if (gotBytes)
 		gotBytes = gzread(gzf, &wri, sizeof(wri));
 	numfaces = wri;
 
-	gzclose( gzf );
+	gzclose(gzf);
 	// ------------------------------------------------
 
-	if(!numfaces || !numverts || !gotBytes)
+	if (!numfaces || !numverts || !gotBytes)
 		return NULL;
 
-	gzf = gzopen(filename, "rb");
+	gzf = BLI_gzopen(filename, "rb");
 	if (!gzf)
 	{
 		return NULL;
 	}
 
-	dm = CDDM_new(numverts, 0, numfaces);
+	dm = CDDM_new(numverts, 0, 0, numfaces * 3, numfaces);
 
-	if(!dm)
+	if (!dm)
 	{
-		gzclose( gzf );
+		gzclose(gzf);
 		return NULL;
 	}
 
@@ -236,30 +235,30 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MFace *mf_exam
 	// read vertex position from file
 	mv = CDDM_get_verts(dm);
 
-	for(i=0; i<numverts; i++, mv++)
+	for (i=0; i<numverts; i++, mv++)
 		gotBytes = gzread(gzf, mv->co, sizeof(float) * 3);
 
 	// should be the same as numverts
 	gotBytes = gzread(gzf, &wri, sizeof(wri));
-	if(wri != numverts)
+	if (wri != numverts)
 	{
-		if(dm)
+		if (dm)
 			dm->release(dm);
-		gzclose( gzf );
+		gzclose(gzf);
 		return NULL;
 	}
 
 	normals = MEM_callocN(sizeof(short) * numverts * 3, "fluid_tmp_normals" );
-	if(!normals)
+	if (!normals)
 	{
-		if(dm)
+		if (dm)
 			dm->release(dm);
-		gzclose( gzf );
+		gzclose(gzf);
 		return NULL;
 	}
 
 	// read normals from file (but don't save them yet)
-	for(i=numverts, no_s= normals; i>0; i--, no_s += 3)
+	for (i=numverts, no_s= normals; i>0; i--, no_s += 3)
 	{
 		gotBytes = gzread(gzf, no, sizeof(float) * 3);
 		normal_float_to_short_v3(no_s, no);
@@ -268,46 +267,38 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MFace *mf_exam
 	/* read no. of triangles */
 	gotBytes = gzread(gzf, &wri, sizeof(wri));
 
-	if(wri!=numfaces) {
+	if (wri!=numfaces) {
 		printf("Fluidsim: error in reading data from file.\n");
-		if(dm)
+		if (dm)
 			dm->release(dm);
-		gzclose( gzf );
+		gzclose(gzf);
 		MEM_freeN(normals);
 		return NULL;
 	}
 
 	// read triangles from file
-	mf = CDDM_get_faces(dm);
-	for(i=numfaces; i>0; i--, mf++)
+	mp = CDDM_get_polys(dm);
+	ml = CDDM_get_loops(dm);
+	for (i=0; i < numfaces; i++, mp++, ml += 3)
 	{
 		int face[3];
 
 		gotBytes = gzread(gzf, face, sizeof(int) * 3);
 
 		/* initialize from existing face */
-		mf->mat_nr = mf_mat_nr;
-		mf->flag =   mf_flag;
+		mp->mat_nr = mp_mat_nr;
+		mp->flag =   mp_flag;
 
-		// check if 3rd vertex has index 0 (not allowed in blender)
-		if(face[2])
-		{
-			mf->v1 = face[0];
-			mf->v2 = face[1];
-			mf->v3 = face[2];
-		}
-		else
-		{
-			mf->v1 = face[1];
-			mf->v2 = face[2];
-			mf->v3 = face[0];
-		}
-		mf->v4 = 0;
+		mp->loopstart = i * 3;
+		mp->totloop = 3;
+
+		ml[0].v = face[0];
+		ml[1].v = face[1];
+		ml[2].v = face[2];
 
-		test_index_face(mf, NULL, 0, 3);
 	}
 
-	gzclose( gzf );
+	gzclose(gzf);
 
 	CDDM_calc_edges(dm);
 
@@ -315,7 +306,6 @@ static DerivedMesh *fluidsim_read_obj(const char *filename, const MFace *mf_exam
 	MEM_freeN(normals);
 
 	// CDDM_calc_normals(result);
-
 	return dm;
 }
 
@@ -328,7 +318,7 @@ void fluid_get_bb(MVert *mvert, int totvert, float obmat[][4],
 	int i;
 	float vec[3];
 
-	if(totvert == 0) {
+	if (totvert == 0) {
 		zero_v3(start);
 		zero_v3(size);
 		return;
@@ -339,25 +329,25 @@ void fluid_get_bb(MVert *mvert, int totvert, float obmat[][4],
 	bbsx = vec[0]; bbsy = vec[1]; bbsz = vec[2];
 	bbex = vec[0]; bbey = vec[1]; bbez = vec[2];
 
-	for(i = 1; i < totvert; i++) {
+	for (i = 1; i < totvert; i++) {
 		copy_v3_v3(vec, mvert[i].co);
 		mul_m4_v3(obmat, vec);
 
-		if(vec[0] < bbsx){ bbsx= vec[0]; }
-		if(vec[1] < bbsy){ bbsy= vec[1]; }
-		if(vec[2] < bbsz){ bbsz= vec[2]; }
-		if(vec[0] > bbex){ bbex= vec[0]; }
-		if(vec[1] > bbey){ bbey= vec[1]; }
-		if(vec[2] > bbez){ bbez= vec[2]; }
+		if (vec[0] < bbsx) { bbsx= vec[0]; }
+		if (vec[1] < bbsy) { bbsy= vec[1]; }
+		if (vec[2] < bbsz) { bbsz= vec[2]; }
+		if (vec[0] > bbex) { bbex= vec[0]; }
+		if (vec[1] > bbey) { bbey= vec[1]; }
+		if (vec[2] > bbez) { bbez= vec[2]; }
 	}
 
 	// return values...
-	if(start) {
+	if (start) {
 		start[0] = bbsx;
 		start[1] = bbsy;
 		start[2] = bbsz;
 	}
-	if(size) {
+	if (size) {
 		size[0] = bbex-bbsx;
 		size[1] = bbey-bbsy;
 		size[2] = bbez-bbsz;
@@ -374,7 +364,7 @@ void fluid_estimate_memory(Object *ob, FluidsimSettings *fss, char *value)
 
 	value[0]= '\0';
 
-	if(ob->type == OB_MESH) {
+	if (ob->type == OB_MESH) {
 		/* use mesh bounding box and object scaling */
 		mesh= ob->data;
 
@@ -397,15 +387,15 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh *
 
 	// mesh and vverts have to be valid from loading...
 
-	if(fss->meshVelocities)
+	if (fss->meshVelocities)
 		MEM_freeN(fss->meshVelocities);
 
-	if(len<7)
+	if (len<7)
 	{
 		return;
 	}
 
-	if(fss->domainNovecgen>0) return;
+	if (fss->domainNovecgen>0) return;
 
 	fss->meshVelocities = MEM_callocN(sizeof(FluidVertexVelocity)*dm->getNumVerts(dm), "Fluidsim_velocities");
 	fss->totvert = totvert;
@@ -418,7 +408,7 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh *
 	filename[len-5] = 'e';
 	filename[len-4] = 'l';
 
-	gzf = gzopen(filename, "rb");
+	gzf = BLI_gzopen(filename, "rb");
 	if (!gzf)
 	{
 		MEM_freeN(fss->meshVelocities);
@@ -427,16 +417,16 @@ static void fluidsim_read_vel_cache(FluidsimModifierData *fluidmd, DerivedMesh *
 	}
 
 	gzread(gzf, &wri, sizeof( wri ));
-	if(wri != totvert)
+	if (wri != totvert)
 	{
 		MEM_freeN(fss->meshVelocities);
 		fss->meshVelocities = NULL;
 		return;
 	}
 
-	for(i=0; i<totvert;i++)
+	for (i=0; i<totvert;i++)
 	{
-		for(j=0; j<3; j++)
+		for (j=0; j<3; j++)
 		{
 			gzread(gzf, &wrf, sizeof( wrf ));
 			velarray[i].vel[j] = wrf;
@@ -453,13 +443,13 @@ static DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, Fluidsim
 	char targetFile[FILE_MAX];
 	FluidsimSettings *fss = fluidmd->fss;
 	DerivedMesh *dm = NULL;
-	MFace *mface;
-	MFace mf_example = {0};
+	MPoly *mpoly;
+	MPoly mp_example = {0};
 
-
-	if(!useRenderParams) {
+	if (!useRenderParams) {
 		displaymode = fss->guiDisplayMode;
-	} else {
+	}
+	else {
 		displaymode = fss->renderDisplayMode;
 	}
 
@@ -485,23 +475,23 @@ static DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, Fluidsim
 
 	// assign material + flags to new dm
 	// if there's no faces in original dm, keep materials and flags unchanged
-	mface = orgdm->getFaceArray(orgdm);
-	if (mface) {
-		mf_example = *mface;
+	mpoly = orgdm->getPolyArray(orgdm);
+	if (mpoly) {
+		mp_example = *mpoly;
 	}
 	/* else leave NULL'd */
 
-	dm = fluidsim_read_obj(targetFile, &mf_example);
+	dm = fluidsim_read_obj(targetFile, &mp_example);
 
-	if(!dm)
+	if (!dm)
 	{
 		// switch, abort background rendering when fluidsim mesh is missing
 		const char *strEnvName2 = "BLENDER_ELBEEMBOBJABORT"; // from blendercall.cpp
 
-		if(G.background==1) {
-			if(getenv(strEnvName2)) {
+		if (G.background==1) {
+			if (getenv(strEnvName2)) {
 				int elevel = atoi(getenv(strEnvName2));
-				if(elevel>0) {
+				if (elevel>0) {
 					printf("Env. var %s set, fluid sim mesh '%s' not found, aborting render...\n",strEnvName2, targetFile);
 					exit(1);
 				}
@@ -515,13 +505,11 @@ static DerivedMesh *fluidsim_read_cache(Object *ob, DerivedMesh *orgdm, Fluidsim
 	// load vertex velocities, if they exist...
 	// TODO? use generate flag as loading flag as well?
 	// warning, needs original .bobj.gz mesh loading filename
-	if(displaymode==3)
-	{
+	if (displaymode==3) {
 		fluidsim_read_vel_cache(fluidmd, dm, targetFile);
 	}
-	else
-	{
-		if(fss->meshVelocities)
+	else {
+		if (fss->meshVelocities)
 			MEM_freeN(fss->meshVelocities);
 
 		fss->meshVelocities = NULL;
@@ -544,11 +532,11 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene,
 	framenr= (int)scene->r.cfra;
 	
 	// only handle fluidsim domains
-	if(fluidmd && fluidmd->fss && (fluidmd->fss->type != OB_FLUIDSIM_DOMAIN))
+	if (fluidmd && fluidmd->fss && (fluidmd->fss->type != OB_FLUIDSIM_DOMAIN))
 		return dm;
 	
 	// sanity check
-	if(!fluidmd || (fluidmd && !fluidmd->fss))
+	if (!fluidmd || (fluidmd && !fluidmd->fss))
 		return dm;
 	
 	fss = fluidmd->fss;
@@ -557,15 +545,14 @@ DerivedMesh *fluidsimModifier_do(FluidsimModifierData *fluidmd, Scene *scene,
 	// clmd->sim_parms->timescale= timescale;
 
 	// support reversing of baked fluid frames here
-	if((fss->flag & OB_FLUIDSIM_REVERSE) && (fss->lastgoodframe >= 0))
-	{
+	if ((fss->flag & OB_FLUIDSIM_REVERSE) && (fss->lastgoodframe >= 0)) {
 		framenr = fss->lastgoodframe - framenr + 1;
 		CLAMP(framenr, 1, fss->lastgoodframe);
 	}
 	
 	/* try to read from cache */
 	/* if the frame is there, fine, otherwise don't do anything */
-	if((result = fluidsim_read_cache(ob, dm, fluidmd, framenr, useRenderParams)))
+	if ((result = fluidsim_read_cache(ob, dm, fluidmd, framenr, useRenderParams)))
 		return result;
 	
 	return dm;
diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.h b/source/blender/modifiers/intern/MOD_fluidsim_util.h
index 2c22f37..334826e 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim_util.h
+++ b/source/blender/modifiers/intern/MOD_fluidsim_util.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef MOD_FLUIDSIM_UTIL_H
-#define MOD_FLUIDSIM_UTIL_H
+#ifndef __MOD_FLUIDSIM_UTIL_H__
+#define __MOD_FLUIDSIM_UTIL_H__
 
 struct Object;
 struct Scene;
diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c
index 9d5bc46..d8fbb6f 100644
--- a/source/blender/modifiers/intern/MOD_hook.c
+++ b/source/blender/modifiers/intern/MOD_hook.c
@@ -81,8 +81,8 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
 	CustomDataMask dataMask = 0;
 
 	/* ask for vertexgroups if we need them */
-	if(hmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT;
-	if(hmd->indexar) dataMask |= CD_MASK_ORIGINDEX;
+	if (hmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+	if (hmd->indexar) dataMask |= CD_MASK_ORIGINDEX;
 
 	return dataMask;
 }
@@ -130,12 +130,12 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
 
 static float hook_falloff(float *co_1, float *co_2, const float falloff_squared, float fac)
 {
-	if(falloff_squared) {
+	if (falloff_squared) {
 		float len_squared = len_squared_v3v3(co_1, co_2);
-		if(len_squared > falloff_squared) {
+		if (len_squared > falloff_squared) {
 			return 0.0f;
 		}
-		else if(len_squared > 0.0f) {
+		else if (len_squared > 0.0f) {
 			return fac * (1.0f - (len_squared / falloff_squared));
 		}
 	}
@@ -178,28 +178,28 @@ static void deformVerts_do(HookModifierData *hmd, Object *ob, DerivedMesh *dm,
 	 * not correct them on exit editmode. - zr
 	 */
 	
-	if(hmd->force == 0.0f) {
+	if (hmd->force == 0.0f) {
 		/* do nothing, avoid annoying checks in the loop */
 	}
-	else if(hmd->indexar) { /* vertex indices? */
+	else if (hmd->indexar) { /* vertex indices? */
 		const float fac_orig= hmd->force;
 		float fac;
 		const int *origindex_ar;
 		
 		/* if DerivedMesh is present and has original index data, use it */
-		if(dm && (origindex_ar= dm->getVertDataArray(dm, CD_ORIGINDEX))) {
-			for(i= 0, index_pt= hmd->indexar; i < hmd->totindex; i++, index_pt++) {
-				if(*index_pt < numVerts) {
+		if (dm && (origindex_ar= dm->getVertDataArray(dm, CD_ORIGINDEX))) {
+			for (i= 0, index_pt= hmd->indexar; i < hmd->totindex; i++, index_pt++) {
+				if (*index_pt < numVerts) {
 					int j;
 					
-					for(j = 0; j < numVerts; j++) {
-						if(origindex_ar[j] == *index_pt) {
+					for (j = 0; j < numVerts; j++) {
+						if (origindex_ar[j] == *index_pt) {
 							float *co = vertexCos[j];
-							if((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
-								if(dvert)
+							if ((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
+								if (dvert)
 									fac *= defvert_find_weight(dvert+j, defgrp_index);
 								
-								if(fac) {
+								if (fac) {
 									mul_v3_m4v3(vec, mat, co);
 									interp_v3_v3v3(co, co, vec, fac);
 								}
@@ -210,14 +210,14 @@ static void deformVerts_do(HookModifierData *hmd, Object *ob, DerivedMesh *dm,
 			}
 		}
 		else { /* missing dm or ORIGINDEX */
-			for(i= 0, index_pt= hmd->indexar; i < hmd->totindex; i++, index_pt++) {
-				if(*index_pt < numVerts) {
+			for (i= 0, index_pt= hmd->indexar; i < hmd->totindex; i++, index_pt++) {
+				if (*index_pt < numVerts) {
 					float *co = vertexCos[*index_pt];
-					if((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
-						if(dvert)
+					if ((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
+						if (dvert)
 							fac *= defvert_find_weight(dvert+(*index_pt), defgrp_index);
 						
-						if(fac) {
+						if (fac) {
 							mul_v3_m4v3(vec, mat, co);
 							interp_v3_v3v3(co, co, vec, fac);
 						}
@@ -226,16 +226,16 @@ static void deformVerts_do(HookModifierData *hmd, Object *ob, DerivedMesh *dm,
 			}
 		}
 	}
-	else if(dvert) {	/* vertex group hook */
+	else if (dvert) {	/* vertex group hook */
 		const float fac_orig= hmd->force;
 		
-		for(i = 0; i < max_dvert; i++, dvert++) {
+		for (i = 0; i < max_dvert; i++, dvert++) {
 			float fac;
 			float *co = vertexCos[i];
 			
-			if((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
+			if ((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
 				fac *= defvert_find_weight(dvert, defgrp_index);
-				if(fac) {
+				if (fac) {
 					mul_v3_m4v3(vec, mat, co);
 					interp_v3_v3v3(co, co, vec, fac);
 				}
@@ -251,27 +251,27 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
 	HookModifierData *hmd = (HookModifierData*) md;
 	DerivedMesh *dm = derivedData;
 	/* We need a valid dm for meshes when a vgroup is set... */
-	if(!dm && ob->type == OB_MESH && hmd->name[0] != '\0')
+	if (!dm && ob->type == OB_MESH && hmd->name[0] != '\0')
 		dm = get_dm(ob, NULL, dm, NULL, 0);
 
 	deformVerts_do(hmd, ob, dm, vertexCos, numVerts);
 
-	if(derivedData != dm)
+	if (derivedData != dm)
 		dm->release(dm);
 }
 
-static void deformVertsEM(ModifierData *md, Object *ob, struct EditMesh *editData,
+static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *editData,
                           DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
 {
 	HookModifierData *hmd = (HookModifierData*) md;
 	DerivedMesh *dm = derivedData;
 	/* We need a valid dm for meshes when a vgroup is set... */
-	if(!dm && ob->type == OB_MESH && hmd->name[0] != '\0')
+	if (!dm && ob->type == OB_MESH && hmd->name[0] != '\0')
 		dm = get_dm(ob, editData, dm, NULL, 0);
 
 	deformVerts_do(hmd, ob, dm, vertexCos, numVerts);
 
-	if(derivedData != dm)
+	if (derivedData != dm)
 		dm->release(dm);
 }
 
diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c
index ac0a3a0..ca700d4 100644
--- a/source/blender/modifiers/intern/MOD_lattice.c
+++ b/source/blender/modifiers/intern/MOD_lattice.c
@@ -40,7 +40,6 @@
 #include "BLI_utildefines.h"
 #include "BLI_string.h"
 
-
 #include "BKE_cdderivedmesh.h"
 #include "BKE_lattice.h"
 #include "BKE_modifier.h"
@@ -49,6 +48,11 @@
 
 #include "MOD_util.h"
 
+static void initData(ModifierData *md)
+{
+	LatticeModifierData *lmd = (LatticeModifierData*) md;
+	lmd->strength = 1.0f;
+}
 
 static void copyData(ModifierData *md, ModifierData *target)
 {
@@ -65,7 +69,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
 	CustomDataMask dataMask = 0;
 
 	/* ask for vertexgroups if we need them */
-	if(lmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+	if (lmd->name[0]) dataMask |= CD_MASK_MDEFORMVERT;
 
 	return dataMask;
 }
@@ -94,7 +98,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
 {
 	LatticeModifierData *lmd = (LatticeModifierData*) md;
 
-	if(lmd->object) {
+	if (lmd->object) {
 		DagNode *latNode = dag_get_node(forest, lmd->object);
 
 		dag_add_relation(forest, latNode, obNode,
@@ -115,20 +119,20 @@ static void deformVerts(ModifierData *md, Object *ob,
 	modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
 	
 	lattice_deform_verts(lmd->object, ob, derivedData,
-	                     vertexCos, numVerts, lmd->name);
+	                     vertexCos, numVerts, lmd->name, lmd->strength);
 }
 
 static void deformVertsEM(
-					  ModifierData *md, Object *ob, struct EditMesh *editData,
+					  ModifierData *md, Object *ob, struct BMEditMesh *editData,
 	   DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
 {
 	DerivedMesh *dm = derivedData;
 
-	if(!derivedData) dm = CDDM_from_editmesh(editData, ob->data);
+	if (!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
 
 	deformVerts(md, ob, dm, vertexCos, numVerts, 0, 0);
 
-	if(!derivedData) dm->release(dm);
+	if (!derivedData) dm->release(dm);
 }
 
 
@@ -146,7 +150,7 @@ ModifierTypeInfo modifierType_Lattice = {
 	/* deformMatricesEM */  NULL,
 	/* applyModifier */     NULL,
 	/* applyModifierEM */   NULL,
-	/* initData */          NULL,
+	/* initData */          initData,
 	/* requiredDataMask */  requiredDataMask,
 	/* freeData */          NULL,
 	/* isDisabled */        isDisabled,
diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c
index 1fbe0ee..da4a489 100644
--- a/source/blender/modifiers/intern/MOD_mask.c
+++ b/source/blender/modifiers/intern/MOD_mask.c
@@ -85,12 +85,10 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
 {
 	MaskModifierData *mmd = (MaskModifierData *)md;
 
-	if (mmd->ob_arm) 
-	{
+	if (mmd->ob_arm) {
 		DagNode *armNode = dag_get_node(forest, mmd->ob_arm);
 		
-		dag_add_relation(forest, armNode, obNode,
-				DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Mask Modifier");
+		dag_add_relation(forest, armNode, obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Mask Modifier");
 	}
 }
 
@@ -101,13 +99,24 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 {
 	MaskModifierData *mmd= (MaskModifierData *)md;
 	DerivedMesh *dm= derivedData, *result= NULL;
-	GHash *vertHash=NULL, *edgeHash, *faceHash;
+	GHash *vertHash=NULL, *edgeHash, *polyHash;
 	GHashIterator *hashIter;
 	MDeformVert *dvert= NULL, *dv;
-	int numFaces=0, numEdges=0, numVerts=0;
-	int maxVerts, maxEdges, maxFaces;
+	int numPolys=0, numLoops=0, numEdges=0, numVerts=0;
+	int maxVerts, maxEdges, maxPolys;
 	int i;
-	
+
+	MPoly *mpoly;
+	MLoop *mloop;
+
+	MPoly *mpoly_new;
+	MLoop *mloop_new;
+	MEdge *medge_new;
+	MVert *mvert_new;
+
+
+	int *loop_mapping;
+
 	/* Overview of Method:
 	 *	1. Get the vertices that are in the vertexgroup of interest 
 	 *	2. Filter out unwanted geometry (i.e. not in vertexgroup), by populating mappings with new vs old indices
@@ -117,7 +126,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 	/* get original number of verts, edges, and faces */
 	maxVerts= dm->getNumVerts(dm);
 	maxEdges= dm->getNumEdges(dm);
-	maxFaces= dm->getNumFaces(dm);
+	maxPolys= dm->getNumPolys(dm);
 	
 	/* check if we can just return the original mesh 
 	 *	- must have verts and therefore verts assigned to vgroups to do anything useful
@@ -129,8 +138,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 	}
 	
 	/* if mode is to use selected armature bones, aggregate the bone groups */
-	if (mmd->mode == MOD_MASK_MODE_ARM) /* --- using selected bones --- */
-	{
+	if (mmd->mode == MOD_MASK_MODE_ARM) { /* --- using selected bones --- */
 		GHash *vgroupHash;
 		Object *oba= mmd->ob_arm;
 		bPoseChannel *pchan;
@@ -138,17 +146,16 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		char *bone_select_array;
 		int bone_select_tot= 0;
 		const int defbase_tot= BLI_countlist(&ob->defbase);
-		
+
 		/* check that there is armature object with bones to use, otherwise return original mesh */
 		if (ELEM3(NULL, mmd->ob_arm, mmd->ob_arm->pose, ob->defbase.first))
 			return derivedData;
 
 		bone_select_array= MEM_mallocN(defbase_tot * sizeof(char), "mask array");
 
-		for (i = 0, def = ob->defbase.first; def; def = def->next, i++)
-		{
-			if (((pchan= get_pose_channel(oba->pose, def->name)) && pchan->bone && (pchan->bone->flag & BONE_SELECTED)))
-			{
+		for (i = 0, def = ob->defbase.first; def; def = def->next, i++) {
+			pchan = get_pose_channel(oba->pose, def->name);
+			if (pchan && pchan->bone && (pchan->bone->flag & BONE_SELECTED)) {
 				bone_select_array[i]= TRUE;
 				bone_select_tot++;
 			}
@@ -168,8 +175,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 			BLI_ghash_insert(vgroupHash, def->name, SET_INT_IN_POINTER(i));
 		
 		/* if no bones selected, free hashes and return original mesh */
-		if (bone_select_tot == 0)
-		{
+		if (bone_select_tot == 0) {
 			BLI_ghash_free(vgroupHash, NULL, NULL);
 			MEM_freeN(bone_select_array);
 			
@@ -178,8 +184,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		
 		/* repeat the previous check, but for dverts */
 		dvert= dm->getVertDataArray(dm, CD_MDEFORMVERT);
-		if (dvert == NULL)
-		{
+		if (dvert == NULL) {
 			BLI_ghash_free(vgroupHash, NULL, NULL);
 			MEM_freeN(bone_select_array);
 			
@@ -198,7 +203,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 			for (j= dv->totweight; j > 0; j--, dw++) {
 				if (dw->def_nr < defbase_tot) {
 					if (bone_select_array[dw->def_nr]) {
-						if(dw->weight != 0.0f) {
+						if (dw->weight != 0.0f) {
 							break;
 						}
 					}
@@ -259,11 +264,16 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 			numVerts++;
 		}
 	}
-	
+
 	/* hashes for quickly providing a mapping from old to new - use key=oldindex, value=newindex */
 	edgeHash= BLI_ghash_new(BLI_ghashutil_inthash, BLI_ghashutil_intcmp, "mask ed2 gh");
-	faceHash= BLI_ghash_new(BLI_ghashutil_inthash, BLI_ghashutil_intcmp, "mask fa2 gh");
+	polyHash= BLI_ghash_new(BLI_ghashutil_inthash, BLI_ghashutil_intcmp, "mask fa2 gh");
 	
+	mpoly = dm->getPolyArray(dm);
+	mloop = dm->getLoopArray(dm);
+
+	loop_mapping = MEM_callocN(sizeof(int) * maxPolys, "mask loopmap"); /* overalloc, assume all polys are seen */
+
 	/* loop over edges and faces, and do the same thing to 
 	 * ensure that they only reference existing verts 
 	 */
@@ -280,19 +290,26 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 			numEdges++;
 		}
 	}
-	for (i = 0; i < maxFaces; i++) 
+	for (i = 0; i < maxPolys; i++)
 	{
-		MFace mf;
-		dm->getFace(dm, i, &mf);
+		MPoly *mp = &mpoly[i];
+		MLoop *ml = mloop + mp->loopstart;
+		int ok = TRUE;
+		int j;
+
+		for (j = 0; j < mp->totloop; j++, ml++) {
+			if (!BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(ml->v))) {
+				ok = FALSE;
+				break;
+			}
+		}
 		
 		/* all verts must be available */
-		if ( BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(mf.v1)) &&
-			 BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(mf.v2)) &&
-			 BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(mf.v3)) &&
-			(mf.v4==0 || BLI_ghash_haskey(vertHash, SET_INT_IN_POINTER(mf.v4))) )
-		{
-			BLI_ghash_insert(faceHash, SET_INT_IN_POINTER(i), SET_INT_IN_POINTER(numFaces));
-			numFaces++;
+		if (ok) {
+			BLI_ghash_insert(polyHash, SET_INT_IN_POINTER(i), SET_INT_IN_POINTER(numPolys));
+			loop_mapping[numPolys] = numLoops;
+			numPolys++;
+			numLoops += mp->totloop;
 		}
 	}
 	
@@ -300,8 +317,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 	/* now we know the number of verts, edges and faces, 
 	 * we can create the new (reduced) mesh
 	 */
-	result = CDDM_from_template(dm, numVerts, numEdges, numFaces);
+	result = CDDM_from_template(dm, numVerts, numEdges, 0, numLoops, numPolys);
 	
+	mpoly_new = CDDM_get_polys(result);
+	mloop_new = CDDM_get_loops(result);
+	medge_new = CDDM_get_edges(result);
+	mvert_new = CDDM_get_verts(result);
 	
 	/* using ghash-iterators, map data into new mesh */
 		/* vertices */
@@ -315,7 +336,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		int newIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(hashIter));
 		
 		dm->getVert(dm, oldIndex, &source);
-		dest = CDDM_get_vert(result, newIndex);
+		dest = &mvert_new[newIndex];
 		
 		DM_copy_vert_data(dm, result, oldIndex, newIndex, 1);
 		*dest = source;
@@ -333,7 +354,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		int newIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(hashIter));
 		
 		dm->getEdge(dm, oldIndex, &source);
-		dest = CDDM_get_edge(result, newIndex);
+		dest = &medge_new[newIndex];
 		
 		source.v1 = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source.v1)));
 		source.v2 = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source.v2)));
@@ -344,42 +365,43 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 	BLI_ghashIterator_free(hashIter);
 	
 		/* faces */
-	for ( hashIter = BLI_ghashIterator_new(faceHash);
+	for ( hashIter = BLI_ghashIterator_new(polyHash);
 		  !BLI_ghashIterator_isDone(hashIter);
 		  BLI_ghashIterator_step(hashIter) ) 
 	{
-		MFace source;
-		MFace *dest;
 		int oldIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(hashIter));
 		int newIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(hashIter));
-		int orig_v4;
-		
-		dm->getFace(dm, oldIndex, &source);
-		dest = CDDM_get_face(result, newIndex);
-		
-		orig_v4 = source.v4;
-		
-		source.v1 = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source.v1)));
-		source.v2 = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source.v2)));
-		source.v3 = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source.v3)));
-		if (source.v4)
-		   source.v4 = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source.v4)));
-		
-		DM_copy_face_data(dm, result, oldIndex, newIndex, 1);
-		*dest = source;
+		MPoly *source = &mpoly[oldIndex];
+		MPoly *dest = &mpoly_new[newIndex];
+		int oldLoopIndex = source->loopstart;
+		int newLoopIndex = loop_mapping[newIndex];
+		MLoop *source_loop = &mloop[oldLoopIndex];
+		MLoop *dest_loop = &mloop_new[newLoopIndex];
 		
-		test_index_face(dest, &result->faceData, newIndex, (orig_v4 ? 4 : 3));
+		DM_copy_poly_data(dm, result, oldIndex, newIndex, 1);
+		DM_copy_loop_data(dm, result, oldLoopIndex, newLoopIndex, source->totloop);
+
+		*dest = *source;
+		dest->loopstart = newLoopIndex;
+		for (i = 0; i < source->totloop; i++) {
+			dest_loop[i].v = GET_INT_FROM_POINTER(BLI_ghash_lookup(vertHash, SET_INT_IN_POINTER(source_loop[i].v)));
+			dest_loop[i].e = GET_INT_FROM_POINTER(BLI_ghash_lookup(edgeHash, SET_INT_IN_POINTER(source_loop[i].e)));
+		}
 	}
+
 	BLI_ghashIterator_free(hashIter);
-	
+
+	MEM_freeN(loop_mapping);
+
+	/* why is this needed? - campbell */
 	/* recalculate normals */
 	CDDM_calc_normals(result);
 	
 	/* free hashes */
 	BLI_ghash_free(vertHash, NULL, NULL);
 	BLI_ghash_free(edgeHash, NULL, NULL);
-	BLI_ghash_free(faceHash, NULL, NULL);
-	
+	BLI_ghash_free(polyHash, NULL, NULL);
+
 	/* return the new mesh */
 	return result;
 }
diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c
index d80c671..08626e5 100644
--- a/source/blender/modifiers/intern/MOD_meshdeform.c
+++ b/source/blender/modifiers/intern/MOD_meshdeform.c
@@ -32,19 +32,21 @@
  *  \ingroup modifiers
  */
 
-
+#include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
 #include "DNA_object_types.h"
 
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
 
+#include "BLF_translation.h"
 
 #include "BKE_cdderivedmesh.h"
 #include "BKE_global.h"
 #include "BKE_mesh.h"
 #include "BKE_modifier.h"
 #include "BKE_deform.h"
+#include "BKE_tessmesh.h"
 
 #include "depsgraph_private.h"
 
@@ -64,14 +66,14 @@ static void freeData(ModifierData *md)
 {
 	MeshDeformModifierData *mmd = (MeshDeformModifierData*) md;
 
-	if(mmd->bindinfluences) MEM_freeN(mmd->bindinfluences);
-	if(mmd->bindoffsets) MEM_freeN(mmd->bindoffsets);
-	if(mmd->bindcagecos) MEM_freeN(mmd->bindcagecos);
-	if(mmd->dyngrid) MEM_freeN(mmd->dyngrid);
-	if(mmd->dyninfluences) MEM_freeN(mmd->dyninfluences);
-	if(mmd->dynverts) MEM_freeN(mmd->dynverts);
-	if(mmd->bindweights) MEM_freeN(mmd->bindweights); /* deprecated */
-	if(mmd->bindcos) MEM_freeN(mmd->bindcos); /* deprecated */
+	if (mmd->bindinfluences) MEM_freeN(mmd->bindinfluences);
+	if (mmd->bindoffsets) MEM_freeN(mmd->bindoffsets);
+	if (mmd->bindcagecos) MEM_freeN(mmd->bindcagecos);
+	if (mmd->dyngrid) MEM_freeN(mmd->dyngrid);
+	if (mmd->dyninfluences) MEM_freeN(mmd->dyninfluences);
+	if (mmd->dynverts) MEM_freeN(mmd->dynverts);
+	if (mmd->bindweights) MEM_freeN(mmd->bindweights); /* deprecated */
+	if (mmd->bindcos) MEM_freeN(mmd->bindcos); /* deprecated */
 }
 
 static void copyData(ModifierData *md, ModifierData *target)
@@ -89,7 +91,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
 	CustomDataMask dataMask = 0;
 
 	/* ask for vertexgroups if we need them */
-	if(mmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+	if (mmd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
 
 	return dataMask;
 }
@@ -139,20 +141,20 @@ static float meshdeform_dynamic_bind(MeshDeformModifierData *mmd, float (*dco)[3
 	totweight= 0.0f;
 	size= mmd->dyngridsize;
 
-	for(i=0; i<3; i++) {
+	for (i=0; i<3; i++) {
 		gridvec[i]= (vec[i] - mmd->dyncellmin[i] - mmd->dyncellwidth*0.5f)/mmd->dyncellwidth;
 		ivec[i]= (int)gridvec[i];
 		dvec[i]= gridvec[i] - ivec[i];
 	}
 
-	for(i=0; i<8; i++) {
-		if(i & 1) { x= ivec[0]+1; wx= dvec[0]; }
+	for (i=0; i<8; i++) {
+		if (i & 1) { x= ivec[0]+1; wx= dvec[0]; }
 		else { x= ivec[0]; wx= 1.0f-dvec[0]; } 
 
-		if(i & 2) { y= ivec[1]+1; wy= dvec[1]; }
+		if (i & 2) { y= ivec[1]+1; wy= dvec[1]; }
 		else { y= ivec[1]; wy= 1.0f-dvec[1]; } 
 
-		if(i & 4) { z= ivec[2]+1; wz= dvec[2]; }
+		if (i & 4) { z= ivec[2]+1; wz= dvec[2]; }
 		else { z= ivec[2]; wz= 1.0f-dvec[2]; } 
 
 		CLAMP(x, 0, size-1);
@@ -164,7 +166,7 @@ static float meshdeform_dynamic_bind(MeshDeformModifierData *mmd, float (*dco)[3
 
 		cell= &mmd->dyngrid[a];
 		inf= mmd->dyninfluences + cell->offset;
-		for(j=0; j<cell->totinfluence; j++, inf++) {
+		for (j=0; j<cell->totinfluence; j++, inf++) {
 			cageco= dco[inf->vertex];
 			cageweight= weight*inf->weight;
 			co[0] += cageweight*cageco[0];
@@ -185,7 +187,7 @@ static void meshdeformModifier_do(
 {
 	MeshDeformModifierData *mmd = (MeshDeformModifierData*) md;
 	struct Mesh *me= (mmd->object)? mmd->object->data: NULL;
-	struct EditMesh *em = (me)? BKE_mesh_get_editmesh(me): NULL;
+	BMEditMesh *em = me ? me->edit_btmesh : NULL;
 	DerivedMesh *tmpdm, *cagedm;
 	MDeformVert *dvert = NULL;
 	MDefInfluence *influences;
@@ -195,29 +197,28 @@ static void meshdeformModifier_do(
 	int a, b, totvert, totcagevert, defgrp_index;
 	float (*cagecos)[3];
 
-	if(!mmd->object || (!mmd->bindcagecos && !mmd->bindfunc))
+	if (!mmd->object || (!mmd->bindcagecos && !mmd->bindfunc))
 		return;
 	
 	/* get cage derivedmesh */
-	if(em) {
-		tmpdm= editmesh_get_derived_cage_and_final(md->scene, ob, em, &cagedm, 0);
-		if(tmpdm)
+	if (em) {
+		tmpdm= editbmesh_get_derived_cage_and_final(md->scene, ob, em, &cagedm, 0);
+		if (tmpdm)
 			tmpdm->release(tmpdm);
-		BKE_mesh_end_editmesh(me, em);
 	}
 	else
 		cagedm= mmd->object->derivedFinal;
 
 	/* if we don't have one computed, use derivedmesh from data
 	 * without any modifiers */
-	if(!cagedm) {
+	if (!cagedm) {
 		cagedm= get_dm(mmd->object, NULL, NULL, NULL, 0);
-		if(cagedm)
+		if (cagedm)
 			cagedm->needsFree= 1;
 	}
 	
-	if(!cagedm) {
-		modifier_setError(md, "Can't get mesh from cage object.");
+	if (!cagedm) {
+		modifier_setError(md, "%s", TIP_("Can't get mesh from cage object."));
 		return;
 	}
 
@@ -229,11 +230,11 @@ static void meshdeformModifier_do(
 	copy_m3_m4(icagemat, iobmat);
 
 	/* bind weights if needed */
-	if(!mmd->bindcagecos) {
+	if (!mmd->bindcagecos) {
 		static int recursive = 0;
 
 		/* progress bar redraw can make this recursive .. */
-		if(!recursive) {
+		if (!recursive) {
 			recursive = 1;
 			mmd->bindfunc(md->scene, mmd, (float*)vertexCos, numVerts, cagemat);
 			recursive = 0;
@@ -244,17 +245,18 @@ static void meshdeformModifier_do(
 	totvert= numVerts;
 	totcagevert= cagedm->getNumVerts(cagedm);
 
-	if(mmd->totvert != totvert) {
-		modifier_setError(md, "Verts changed from %d to %d.", mmd->totvert, totvert);
+	if (mmd->totvert != totvert) {
+		modifier_setError(md, TIP_("Verts changed from %d to %d."), mmd->totvert, totvert);
 		cagedm->release(cagedm);
 		return;
 	}
 	else if (mmd->totcagevert != totcagevert) {
-		modifier_setError(md, "Cage verts changed from %d to %d.", mmd->totcagevert, totcagevert);
+		modifier_setError(md, TIP_("Cage verts changed from %d to %d."), mmd->totcagevert, totcagevert);
 		cagedm->release(cagedm);
 		return;
-	} else if (mmd->bindcagecos == NULL) {
-		modifier_setError(md, "Bind data missing.");
+	}
+	else if (mmd->bindcagecos == NULL) {
+		modifier_setError(md, "%s", TIP_("Bind data missing."));
 		cagedm->release(cagedm);
 		return;
 	}
@@ -268,11 +270,11 @@ static void meshdeformModifier_do(
 	bindcagecos= (float(*)[3])mmd->bindcagecos;
 
 	dco= MEM_callocN(sizeof(*dco)*totcagevert, "MDefDco");
-	for(a=0; a<totcagevert; a++) {
+	for (a=0; a<totcagevert; a++) {
 		/* get cage vertex in world space with binding transform */
 		copy_v3_v3(co, cagecos[a]);
 
-		if(G.rt != 527) {
+		if (G.rt != 527) {
 			mul_m4_v3(mmd->bindmat, co);
 			/* compute difference with world space bind coord */
 			sub_v3_v3v3(dco[a], co, bindcagecos[a]);
@@ -286,12 +288,12 @@ static void meshdeformModifier_do(
 	/* do deformation */
 	fac= 1.0f;
 
-	for(b=0; b<totvert; b++) {
-		if(mmd->flag & MOD_MDEF_DYNAMIC_BIND)
-			if(!mmd->dynverts[b])
+	for (b=0; b<totvert; b++) {
+		if (mmd->flag & MOD_MDEF_DYNAMIC_BIND)
+			if (!mmd->dynverts[b])
 				continue;
 
-		if(dvert) {
+		if (dvert) {
 			fac= defvert_find_weight(&dvert[b], defgrp_index);
 
 			if (mmd->flag & MOD_MDEF_INVERT_VGROUP) {
@@ -303,7 +305,7 @@ static void meshdeformModifier_do(
 			}
 		}
 
-		if(mmd->flag & MOD_MDEF_DYNAMIC_BIND) {
+		if (mmd->flag & MOD_MDEF_DYNAMIC_BIND) {
 			/* transform coordinate into cage's local space */
 			mul_v3_m4v3(co, cagemat, vertexCos[b]);
 			totweight= meshdeform_dynamic_bind(mmd, dco, co);
@@ -312,17 +314,17 @@ static void meshdeformModifier_do(
 			totweight= 0.0f;
 			zero_v3(co);
 
-			for(a=offsets[b]; a<offsets[b+1]; a++) {
+			for (a=offsets[b]; a<offsets[b+1]; a++) {
 				weight= influences[a].weight;
 				madd_v3_v3fl(co, dco[influences[a].vertex], weight);
 				totweight += weight;
 			}
 		}
 
-		if(totweight > 0.0f) {
+		if (totweight > 0.0f) {
 			mul_v3_fl(co, fac/totweight);
 			mul_m3_v3(icagemat, co);
-			if(G.rt != 527)
+			if (G.rt != 527)
 				add_v3_v3(vertexCos[b], co);
 			else
 				copy_v3_v3(vertexCos[b], co);
@@ -348,12 +350,12 @@ static void deformVerts(ModifierData *md, Object *ob,
 	
 	meshdeformModifier_do(md, ob, dm, vertexCos, numVerts);
 
-	if(dm && dm != derivedData)
+	if (dm && dm != derivedData)
 		dm->release(dm);
 }
 
 static void deformVertsEM(ModifierData *md, Object *ob,
-						struct EditMesh *UNUSED(editData),
+						struct BMEditMesh *UNUSED(editData),
 						DerivedMesh *derivedData,
 						float (*vertexCos)[3],
 						int numVerts)
@@ -362,7 +364,7 @@ static void deformVertsEM(ModifierData *md, Object *ob,
 
 	meshdeformModifier_do(md, ob, dm, vertexCos, numVerts);
 
-	if(dm && dm != derivedData)
+	if (dm && dm != derivedData)
 		dm->release(dm);
 }
 
@@ -375,18 +377,18 @@ void modifier_mdef_compact_influences(ModifierData *md)
 	int totinfluence, totvert, totcagevert, a, b;
 
 	weights= mmd->bindweights;
-	if(!weights)
+	if (!weights)
 		return;
 	
 	totvert= mmd->totvert;
 	totcagevert= mmd->totcagevert;
 
 	/* count number of influences above threshold */
-	for(b=0; b<totvert; b++) {
-		for(a=0; a<totcagevert; a++) {
+	for (b=0; b<totvert; b++) {
+		for (a=0; a<totcagevert; a++) {
 			weight= weights[a + b*totcagevert];
 
-			if(weight > MESHDEFORM_MIN_INFLUENCE)
+			if (weight > MESHDEFORM_MIN_INFLUENCE)
 				mmd->totinfluence++;
 		}
 	}
@@ -398,23 +400,23 @@ void modifier_mdef_compact_influences(ModifierData *md)
 	/* write influences */
 	totinfluence= 0;
 
-	for(b=0; b<totvert; b++) {
+	for (b=0; b<totvert; b++) {
 		mmd->bindoffsets[b]= totinfluence;
 		totweight= 0.0f;
 
 		/* sum total weight */
-		for(a=0; a<totcagevert; a++) {
+		for (a=0; a<totcagevert; a++) {
 			weight= weights[a + b*totcagevert];
 
-			if(weight > MESHDEFORM_MIN_INFLUENCE)
+			if (weight > MESHDEFORM_MIN_INFLUENCE)
 				totweight += weight;
 		}
 
 		/* assign weights normalized */
-		for(a=0; a<totcagevert; a++) {
+		for (a=0; a<totcagevert; a++) {
 			weight= weights[a + b*totcagevert];
 
-			if(weight > MESHDEFORM_MIN_INFLUENCE) {
+			if (weight > MESHDEFORM_MIN_INFLUENCE) {
 				mmd->bindinfluences[totinfluence].weight= weight/totweight;
 				mmd->bindinfluences[totinfluence].vertex= a;
 				totinfluence++;
diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c
index c130af1..1284d5a 100644
--- a/source/blender/modifiers/intern/MOD_mirror.c
+++ b/source/blender/modifiers/intern/MOD_mirror.c
@@ -37,19 +37,18 @@
 #include "DNA_object_types.h"
 
 #include "BLI_math.h"
-#include "BLI_utildefines.h"
+#include "BLI_array.h"
 
 #include "BKE_cdderivedmesh.h"
 #include "BKE_mesh.h"
 #include "BKE_modifier.h"
 #include "BKE_deform.h"
-
+#include "BKE_utildefines.h"
+#include "BKE_tessmesh.h"
 
 #include "MEM_guardedalloc.h"
 #include "depsgraph_private.h"
 
-#include "MOD_util.h"
-
 static void initData(ModifierData *md)
 {
 	MirrorModifierData *mmd = (MirrorModifierData*) md;
@@ -69,10 +68,9 @@ static void copyData(ModifierData *md, ModifierData *target)
 	tmmd->mirror_ob = mmd->mirror_ob;
 }
 
-static void foreachObjectLink(
-						 ModifierData *md, Object *ob,
-	  void (*walk)(void *userData, Object *ob, Object **obpoin),
-		 void *userData)
+static void foreachObjectLink(ModifierData *md, Object *ob,
+                              void (*walk)(void *userData, Object *ob, Object **obpoin),
+                              void *userData)
 {
 	MirrorModifierData *mmd = (MirrorModifierData*) md;
 
@@ -80,13 +78,13 @@ static void foreachObjectLink(
 }
 
 static void updateDepgraph(ModifierData *md, DagForest *forest,
-						struct Scene *UNUSED(scene),
-						Object *UNUSED(ob),
-						DagNode *obNode)
+                           struct Scene *UNUSED(scene),
+                           Object *UNUSED(ob),
+                           DagNode *obNode)
 {
 	MirrorModifierData *mmd = (MirrorModifierData*) md;
 
-	if(mmd->mirror_ob) {
+	if (mmd->mirror_ob) {
 		DagNode *latNode = dag_get_node(forest, mmd->mirror_ob);
 
 		dag_add_relation(forest, latNode, obNode,
@@ -99,234 +97,247 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
                                    DerivedMesh *dm,
                                    int axis)
 {
-	int i;
-	float tolerance = mmd->tolerance;
+	const float tolerance_sq = mmd->tolerance * mmd->tolerance;
+	const int do_vtargetmap = !(mmd->flag & MOD_MIR_NO_MERGE);
+	int is_vtargetmap = FALSE; /* true when it should be used */
+
 	DerivedMesh *result;
-	int numVerts, numEdges, numFaces;
-	int maxVerts = dm->getNumVerts(dm);
-	int maxEdges = dm->getNumEdges(dm);
-	int maxFaces = dm->getNumFaces(dm);
-	int *flip_map= NULL, flip_map_len= 0;
-	int do_vgroup_mirr= (mmd->flag & MOD_MIR_VGROUP);
-	unsigned int (*indexMap)[2];
-	float mtx[4][4], imtx[4][4];
+	const int maxVerts = dm->getNumVerts(dm);
+	const int maxEdges = dm->getNumEdges(dm);
+	const int maxLoops = dm->getNumLoops(dm);
+	const int maxPolys = dm->getNumPolys(dm);
+	MVert *mv, *mv_prev;
+	MEdge *me;
+	MLoop *ml;
+	MPoly *mp;
+	float mtx[4][4];
+	int i, j;
+	int a, totshape;
+	int *vtargetmap, *vtmap_a = NULL, *vtmap_b = NULL;
+
+	/* mtx is the mirror transformation */
+	unit_m4(mtx);
+	mtx[axis][axis] = -1.0f;
 
-	numVerts = numEdges = numFaces = 0;
+	if (mmd->mirror_ob) {
+		float tmp[4][4];
+		float itmp[4][4];
+
+		/* tmp is a transform from coords relative to the object's own origin,
+		 * to coords relative to the mirror object origin */
+		invert_m4_m4(tmp, mmd->mirror_ob->obmat);
+		mult_m4_m4m4(tmp, tmp, ob->obmat);
+
+		/* itmp is the reverse transform back to origin-relative coordinates */
+		invert_m4_m4(itmp, tmp);
+
+		/* combine matrices to get a single matrix that translates coordinates into
+		 * mirror-object-relative space, does the mirror, and translates back to
+		 * origin-relative space */
+		mult_m4_m4m4(mtx, mtx, tmp);
+		mult_m4_m4m4(mtx, itmp, mtx);
+	}
 
-	indexMap = MEM_mallocN(sizeof(*indexMap) * maxVerts, "indexmap");
+	result = CDDM_from_template(dm, maxVerts*2, maxEdges*2, 0, maxLoops*2, maxPolys*2);
 
-	result = CDDM_from_template(dm, maxVerts * 2, maxEdges * 2, maxFaces * 2);
+	/*copy customdata to original geometry*/
+	DM_copy_vert_data(dm, result, 0, 0, maxVerts);
+	DM_copy_edge_data(dm, result, 0, 0, maxEdges);
+	DM_copy_loop_data(dm, result, 0, 0, maxLoops);
+	DM_copy_poly_data(dm, result, 0, 0, maxPolys);
 
 
-	if (do_vgroup_mirr) {
-		flip_map= defgroup_flip_map(ob, &flip_map_len, FALSE);
-		if(flip_map == NULL)
-			do_vgroup_mirr= 0;
+	/* subsurf for eg wont have mesh data in the */
+	/* now add mvert/medge/mface layers */
+
+	if (!CustomData_has_layer(&dm->vertData, CD_MVERT)) {
+		dm->copyVertArray(dm, CDDM_get_verts(result));
+	}
+	if (!CustomData_has_layer(&dm->edgeData, CD_MEDGE)) {
+		dm->copyEdgeArray(dm, CDDM_get_edges(result));
+	}
+	if (!CustomData_has_layer(&dm->polyData, CD_MPOLY)) {
+		dm->copyLoopArray(dm, CDDM_get_loops(result));
+		dm->copyPolyArray(dm, CDDM_get_polys(result));
 	}
 
-	if (mmd->mirror_ob) {
-		float obinv[4][4];
-		
-		invert_m4_m4(obinv, mmd->mirror_ob->obmat);
-		mult_m4_m4m4(mtx, obinv, ob->obmat);
-		invert_m4_m4(imtx, mtx);
+	/* copy customdata to new geometry,
+	 * copy from its self because this data may have been created in the checks above */
+	DM_copy_vert_data(result, result, 0, maxVerts, maxVerts);
+	DM_copy_edge_data(result, result, 0, maxEdges, maxEdges);
+	/* loops are copied later */
+	DM_copy_poly_data(result, result, 0, maxPolys, maxPolys);
+
+	if (do_vtargetmap) {
+		/* second half is filled with -1 */
+		vtargetmap = MEM_mallocN(sizeof(int) * maxVerts * 2, "MOD_mirror tarmap");
+
+		vtmap_a = vtargetmap;
+		vtmap_b = vtargetmap + maxVerts;
 	}
 
-	for(i = 0; i < maxVerts; i++) {
-		MVert inMV;
-		MVert *mv = CDDM_get_vert(result, numVerts);
-		int isShared;
-		float co[3];
-		
-		dm->getVert(dm, i, &inMV);
-		
-		copy_v3_v3(co, inMV.co);
-		
-		if (mmd->mirror_ob) {
-			mul_m4_v3(mtx, co);
-		}
-		
-		if(mmd->flag & MOD_MIR_NO_MERGE)
-			isShared = 0;
-		else
-			isShared = ABS(co[axis])<=tolerance;
-		
-		/* Because the topology result (# of vertices) must be the same if
-		 * the mesh data is overridden by vertex cos, have to calc sharedness
-		 * based on original coordinates. This is why we test before copy.
-		 */
-		DM_copy_vert_data(dm, result, i, numVerts, 1);
-		*mv = inMV;
-
-		indexMap[i][0] = numVerts;
-		indexMap[i][1] = !isShared;
-
-		numVerts++;
-
-		if(isShared ) {
-			co[axis] = 0.0f;
-			if (mmd->mirror_ob) {
-				mul_m4_v3(imtx, co);
+	/* mirror vertex coordinates */
+	mv_prev = CDDM_get_verts(result);
+	mv = mv_prev + maxVerts;
+	for (i = 0; i < maxVerts; i++, mv++, mv_prev++) {
+		mul_m4_v3(mtx, mv->co);
+
+		if (do_vtargetmap) {
+			/* compare location of the original and mirrored vertex, to see if they
+			 * should be mapped for merging */
+			if (UNLIKELY(len_squared_v3v3(mv_prev->co, mv->co) < tolerance_sq)) {
+				*vtmap_a = maxVerts + i;
+				is_vtargetmap = TRUE;
 			}
-			copy_v3_v3(mv->co, co);
-			
-			mv->flag |= ME_VERT_MERGED;
-		}
-		else {
-			MVert *mv2 = CDDM_get_vert(result, numVerts);
-			
-			DM_copy_vert_data(dm, result, i, numVerts, 1);
-			*mv2 = *mv;
-			
-			co[axis] = -co[axis];
-			if (mmd->mirror_ob) {
-				mul_m4_v3(imtx, co);
-			}
-			copy_v3_v3(mv2->co, co);
-			
-			if (do_vgroup_mirr) {
-				MDeformVert *dvert= DM_get_vert_data(result, numVerts, CD_MDEFORMVERT);
-				if(dvert) {
-					defvert_flip(dvert, flip_map, flip_map_len);
-				}
+			else {
+				*vtmap_a = -1;
 			}
 
-			numVerts++;
+			*vtmap_b = -1; /* fill here to avoid 2x loops */
+
+			vtmap_a++;
+			vtmap_b++;
 		}
 	}
-
-	for(i = 0; i < maxEdges; i++) {
-		MEdge inMED;
-		MEdge *med = CDDM_get_edge(result, numEdges);
-		
-		dm->getEdge(dm, i, &inMED);
-		
-		DM_copy_edge_data(dm, result, i, numEdges, 1);
-		*med = inMED;
-		numEdges++;
-		
-		med->v1 = indexMap[inMED.v1][0];
-		med->v2 = indexMap[inMED.v2][0];
-		
-		if(indexMap[inMED.v1][1] || indexMap[inMED.v2][1]) {
-			MEdge *med2 = CDDM_get_edge(result, numEdges);
-			
-			DM_copy_edge_data(dm, result, i, numEdges, 1);
-			*med2 = *med;
-			numEdges++;
-			
-			med2->v1 += indexMap[inMED.v1][1];
-			med2->v2 += indexMap[inMED.v2][1];
+	
+	/* handle shape keys */
+	totshape = CustomData_number_of_layers(&result->vertData, CD_SHAPEKEY);
+	for (a = 0; a < totshape; a++) {
+		float (*cos)[3] = CustomData_get_layer_n(&result->vertData, CD_SHAPEKEY, a);
+		for (i = maxVerts; i < result->numVertData; i++) {
+			mul_m4_v3(mtx, cos[i]);
 		}
 	}
+	
+	/* adjust mirrored edge vertex indices */
+	me = CDDM_get_edges(result) + maxEdges;
+	for (i = 0; i < maxEdges; i++, me++) {
+		me->v1 += maxVerts;
+		me->v2 += maxVerts;
+	}
+	
+	/* adjust mirrored poly loopstart indices, and reverse loop order (normals) */
+	mp = CDDM_get_polys(result) + maxPolys;
+	ml = CDDM_get_loops(result);
+	for (i = 0; i < maxPolys; i++, mp++) {
+		MLoop *ml2;
+		int e;
+
+		/* reverse the loop */
+		for (j = 0; j < mp->totloop; j++) {
+			DM_copy_loop_data(result, result, mp->loopstart + j, mp->loopstart + maxLoops + mp->totloop - j - 1, 1);
+		}
 
-	for(i = 0; i < maxFaces; i++) {
-		MFace inMF;
-		MFace *mf = CDDM_get_face(result, numFaces);
-		
-		dm->getFace(dm, i, &inMF);
-		
-		DM_copy_face_data(dm, result, i, numFaces, 1);
-		*mf = inMF;
-		numFaces++;
-		
-		mf->v1 = indexMap[inMF.v1][0];
-		mf->v2 = indexMap[inMF.v2][0];
-		mf->v3 = indexMap[inMF.v3][0];
-		mf->v4 = indexMap[inMF.v4][0];
+		ml2 = ml + mp->loopstart + maxLoops;
+		e = ml2[0].e;
+		for (j = 0; j < mp->totloop-1; j++) {
+			ml2[j].e = ml2[j+1].e;
+		}
+		ml2[mp->totloop-1].e = e;
 		
-		if ( indexMap[inMF.v1][1] ||
-		     indexMap[inMF.v2][1] ||
-		     indexMap[inMF.v3][1] ||
-		     (mf->v4 && indexMap[inMF.v4][1]))
-		{
-			MFace *mf2 = CDDM_get_face(result, numFaces);
-			static int corner_indices[4] = {2, 1, 0, 3};
-			
-			DM_copy_face_data(dm, result, i, numFaces, 1);
-			*mf2 = *mf;
-			
-			mf2->v1 += indexMap[inMF.v1][1];
-			mf2->v2 += indexMap[inMF.v2][1];
-			mf2->v3 += indexMap[inMF.v3][1];
-			if(inMF.v4) mf2->v4 += indexMap[inMF.v4][1];
-			
-			/* mirror UVs if enabled */
-			if(mmd->flag & (MOD_MIR_MIRROR_U | MOD_MIR_MIRROR_V)) {
-				MTFace *tf = result->getFaceData(result, numFaces, CD_MTFACE);
-				if(tf) {
-					int j;
-					for(j = 0; j < 4; ++j) {
-						if(mmd->flag & MOD_MIR_MIRROR_U)
-							tf->uv[j][0] = 1.0f - tf->uv[j][0];
-						if(mmd->flag & MOD_MIR_MIRROR_V)
-							tf->uv[j][1] = 1.0f - tf->uv[j][1];
-					}
-				}
+		mp->loopstart += maxLoops;
+	}
+
+	/* adjust mirrored loop vertex and edge indices */
+	ml = CDDM_get_loops(result) + maxLoops;
+	for (i = 0; i < maxLoops; i++, ml++) {
+		ml->v += maxVerts;
+		ml->e += maxEdges;
+	}
+
+	/* handle uvs,
+	 * let tessface recalc handle updating the MTFace data */
+	if (mmd->flag & (MOD_MIR_MIRROR_U | MOD_MIR_MIRROR_V)) {
+		const int do_mirr_u= (mmd->flag & MOD_MIR_MIRROR_U) != 0;
+		const int do_mirr_v= (mmd->flag & MOD_MIR_MIRROR_V) != 0;
+
+		const int totuv = CustomData_number_of_layers(&result->loopData, CD_MLOOPUV);
+
+		for (a = 0; a < totuv; a++) {
+			MLoopUV *dmloopuv = CustomData_get_layer_n(&result->loopData, CD_MLOOPUV, a);
+			int j = maxLoops;
+			dmloopuv += j; /* second set of loops only */
+			for ( ; i-- > 0; dmloopuv++) {
+				if (do_mirr_u) dmloopuv->uv[0] = 1.0f - dmloopuv->uv[0];
+				if (do_mirr_v) dmloopuv->uv[1] = 1.0f - dmloopuv->uv[1];
 			}
-			
-			/* Flip face normal */
-			SWAP(unsigned int, mf2->v1, mf2->v3);
-			DM_swap_face_data(result, numFaces, corner_indices);
-			
-			test_index_face(mf2, &result->faceData, numFaces, inMF.v4?4:3);
-			numFaces++;
 		}
 	}
 
-	if (flip_map) MEM_freeN(flip_map);
+	/* handle vgroup stuff */
+	if ((mmd->flag & MOD_MIR_VGROUP) && CustomData_has_layer(&result->vertData, CD_MDEFORMVERT)) {
+		MDeformVert *dvert = (MDeformVert *) CustomData_get_layer(&result->vertData, CD_MDEFORMVERT) + maxVerts;
+		int *flip_map= NULL, flip_map_len= 0;
+
+		flip_map= defgroup_flip_map(ob, &flip_map_len, FALSE);
+		
+		if (flip_map) {
+			for (i = 0; i < maxVerts; dvert++, i++) {
+				/* merged vertices get both groups, others get flipped */
+				if (do_vtargetmap && (vtargetmap[i] != -1))
+					defvert_flip_merged(dvert, flip_map, flip_map_len);
+				else
+					defvert_flip(dvert, flip_map, flip_map_len);
+			}
 
-	MEM_freeN(indexMap);
+			MEM_freeN(flip_map);
+		}
+	}
 
-	CDDM_lower_num_verts(result, numVerts);
-	CDDM_lower_num_edges(result, numEdges);
-	CDDM_lower_num_faces(result, numFaces);
+	if (do_vtargetmap) {
+		/* slow - so only call if one or more merge verts are found,
+		 * users may leave this on and not realize there is nothing to merge - campbell */
+		if (is_vtargetmap) {
+			result = CDDM_merge_verts(result, vtargetmap);
+		}
+		MEM_freeN(vtargetmap);
+	}
 
 	return result;
 }
 
 static DerivedMesh *mirrorModifier__doMirror(MirrorModifierData *mmd,
-						Object *ob, DerivedMesh *dm)
+                                             Object *ob, DerivedMesh *dm)
 {
 	DerivedMesh *result = dm;
 
 	/* check which axes have been toggled and mirror accordingly */
-	if(mmd->flag & MOD_MIR_AXIS_X) {
+	if (mmd->flag & MOD_MIR_AXIS_X) {
 		result = doMirrorOnAxis(mmd, ob, result, 0);
 	}
-	if(mmd->flag & MOD_MIR_AXIS_Y) {
+	if (mmd->flag & MOD_MIR_AXIS_Y) {
 		DerivedMesh *tmp = result;
 		result = doMirrorOnAxis(mmd, ob, result, 1);
-		if(tmp != dm) tmp->release(tmp); /* free intermediate results */
+		if (tmp != dm) tmp->release(tmp); /* free intermediate results */
 	}
-	if(mmd->flag & MOD_MIR_AXIS_Z) {
+	if (mmd->flag & MOD_MIR_AXIS_Z) {
 		DerivedMesh *tmp = result;
 		result = doMirrorOnAxis(mmd, ob, result, 2);
-		if(tmp != dm) tmp->release(tmp); /* free intermediate results */
+		if (tmp != dm) tmp->release(tmp); /* free intermediate results */
 	}
 
 	return result;
 }
 
 static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
-						DerivedMesh *derivedData,
-						int UNUSED(useRenderParams),
-						int UNUSED(isFinalCalc))
+                                  DerivedMesh *derivedData,
+                                  int UNUSED(useRenderParams),
+                                  int UNUSED(isFinalCalc))
 {
 	DerivedMesh *result;
 	MirrorModifierData *mmd = (MirrorModifierData*) md;
 
 	result = mirrorModifier__doMirror(mmd, ob, derivedData);
 
-	if(result != derivedData)
+	if (result != derivedData)
 		CDDM_calc_normals(result);
 	
 	return result;
 }
 
 static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
-						struct EditMesh *UNUSED(editData),
-						DerivedMesh *derivedData)
+                                    struct BMEditMesh *UNUSED(editData),
+                                    DerivedMesh *derivedData)
 {
 	return applyModifier(md, ob, derivedData, 0, 1);
 }
diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c
index 55f2913..57268d0 100644
--- a/source/blender/modifiers/intern/MOD_multires.c
+++ b/source/blender/modifiers/intern/MOD_multires.c
@@ -36,12 +36,14 @@
 #include <stddef.h>
 
 #include "DNA_mesh_types.h"
+#include "DNA_object_types.h"
 
 #include "BKE_cdderivedmesh.h"
+#include "BKE_mesh.h"
 #include "BKE_multires.h"
 #include "BKE_modifier.h"
 #include "BKE_paint.h"
-#include "BKE_particle.h"
+#include "BKE_subsurf.h"
 
 #include "MOD_util.h"
 
@@ -71,34 +73,48 @@ static void copyData(ModifierData *md, ModifierData *target)
 static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm,
 						   int useRenderParams, int isFinalCalc)
 {
-	SculptSession *ss= ob->sculpt;
-	int sculpting= (ob->mode & OB_MODE_SCULPT) && ss;
 	MultiresModifierData *mmd = (MultiresModifierData*)md;
 	DerivedMesh *result;
 	Mesh *me= (Mesh*)ob->data;
 
-	if(mmd->totlvl) {
-		if(!CustomData_get_layer(&me->fdata, CD_MDISPS)) {
+	if (mmd->totlvl) {
+		if (!CustomData_get_layer(&me->ldata, CD_MDISPS)) {
 			/* multires always needs a displacement layer */
-			CustomData_add_layer(&me->fdata, CD_MDISPS, CD_CALLOC, NULL, me->totface);
+			CustomData_add_layer(&me->ldata, CD_MDISPS, CD_CALLOC, NULL, me->totloop);
 		}
 	}
 
-	result = multires_dm_create_from_derived(mmd, 0, dm, ob, useRenderParams, isFinalCalc);
+	result = multires_dm_create_from_derived(mmd, 0, dm, ob, useRenderParams);
 
-	if(result == dm)
+	if (result == dm)
 		return dm;
 
-	if(useRenderParams || !isFinalCalc) {
-		DerivedMesh *cddm= CDDM_copy(result);
+	if (useRenderParams || !isFinalCalc) {
+		DerivedMesh *cddm;
+		
+		cddm= CDDM_copy(result);
+
+		/* copy hidden flag to vertices */
+		if (!useRenderParams) {
+			struct MDisps *mdisps;
+			mdisps = CustomData_get_layer(&me->ldata, CD_MDISPS);
+			if (mdisps) {
+				subsurf_copy_grid_hidden(result, me->mpoly,
+										 cddm->getVertArray(cddm),
+										 mdisps);
+
+				mesh_flush_hidden_from_verts(cddm->getVertArray(cddm),
+											 cddm->getLoopArray(cddm),
+											 cddm->getEdgeArray(cddm),
+											 cddm->getNumEdges(cddm),
+											 cddm->getPolyArray(cddm),
+											 cddm->getNumPolys(cddm));
+			}
+		}
+
 		result->release(result);
 		result= cddm;
 	}
-	else if(sculpting) {
-		/* would be created on the fly too, just nicer this
-		   way on first stroke after e.g. switching levels */
-		ss->pbvh= result->getPBVH(ob, result);
-	}
 
 	return result;
 }
diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c
index f79ee0c..fd86919 100644
--- a/source/blender/modifiers/intern/MOD_ocean.c
+++ b/source/blender/modifiers/intern/MOD_ocean.c
@@ -240,7 +240,7 @@ static void dm_get_bounds(DerivedMesh *dm, float *sx, float *sy, float *ox, floa
 	copy_v3_v3(min, mvert->co);
 	copy_v3_v3(max, mvert->co);
 
-	for(v=1; v<totvert; v++, mvert++) {
+	for (v=1; v<totvert; v++, mvert++) {
 		min[0]=MIN2(min[0],mvert->co[0]);
 		min[1]=MIN2(min[1],mvert->co[1]);
 		min[2]=MIN2(min[2],mvert->co[2]);
@@ -269,7 +269,8 @@ static DerivedMesh *generate_ocean_geometry(OceanModifierData *omd)
 	DerivedMesh *result;
 
 	MVert *mverts;
-	MFace *mfaces;
+	MPoly *mpolys;
+	MLoop *mloops;
 	int *origindex;
 
 	int cdlayer;
@@ -280,7 +281,7 @@ static DerivedMesh *generate_ocean_geometry(OceanModifierData *omd)
 	const int res_y = ry * omd->repeat_y;
 
 	const int num_verts = (res_x + 1) * (res_y + 1);
-	const int num_edges = (res_x * res_y * 2) + res_x + res_y;
+	/* const int num_edges = (res_x * res_y * 2) + res_x + res_y; */ /* UNUSED BMESH */
 	const int num_faces = res_x * res_y;
 
 	float sx = omd->size * omd->spatial_size;
@@ -295,11 +296,17 @@ static DerivedMesh *generate_ocean_geometry(OceanModifierData *omd)
 	sx /= rx;
 	sy /= ry;
 
-	result = CDDM_new(num_verts, num_edges, num_faces);
+	result = CDDM_new(num_verts, 0, 0, num_faces * 4, num_faces);
 
 	mverts = CDDM_get_verts(result);
-	mfaces = CDDM_get_faces(result);
+	mpolys = CDDM_get_polys(result);
+	mloops = CDDM_get_loops(result);
+
+#if 0 // trunk
 	origindex= result->getFaceDataArray(result, CD_ORIGINDEX);
+#else // bmesh
+	origindex= CustomData_get_layer(&result->polyData, CD_ORIGINDEX);
+#endif
 
 	/* create vertices */
 	#pragma omp parallel for private(x, y) if (rx > OMP_MIN_RES)
@@ -319,13 +326,22 @@ static DerivedMesh *generate_ocean_geometry(OceanModifierData *omd)
 		for (x=0; x < res_x; x++) {
 			const int fi = y*res_x + x;
 			const int vi = y*(res_x+1) + x;
-			MFace *mf= &mfaces[fi];
-			mf->v1 = vi;
-			mf->v2 = vi + 1;
-			mf->v3 = vi + 1 + res_x+1;
-			mf->v4 = vi + res_x+1;
+			MPoly *mp= &mpolys[fi];
+			MLoop *ml= &mloops[fi * 4];
+
+			ml->v = vi;
+			ml++;
+			ml->v = vi + 1;
+			ml++;
+			ml->v = vi + 1 + res_x + 1;
+			ml++;
+			ml->v = vi + res_x + 1;
+			ml++;
+
+			mp->loopstart= fi * 4;
+			mp->totloop= 4;
 
-			mf->flag |= ME_SMOOTH;
+			mp->flag |= ME_SMOOTH;
 
 			/* generated geometry does not map to original faces */
 			origindex[fi] = ORIGINDEX_NONE;
@@ -335,28 +351,36 @@ static DerivedMesh *generate_ocean_geometry(OceanModifierData *omd)
 	CDDM_calc_edges(result);
 
 	/* add uvs */
-	cdlayer= CustomData_number_of_layers(&result->faceData, CD_MTFACE);
-	if(cdlayer < MAX_MTFACE) {
-		MTFace *tfaces= CustomData_add_layer(&result->faceData, CD_MTFACE, CD_CALLOC, NULL, num_faces);
+	cdlayer= CustomData_number_of_layers(&result->loopData, CD_MLOOPUV);
+	if (cdlayer < MAX_MTFACE) {
+		MLoopUV *mloopuvs = CustomData_add_layer(&result->loopData, CD_MLOOPUV, CD_CALLOC, NULL, num_faces * 4);
+		CustomData_add_layer(&result->polyData, CD_MTEXPOLY, CD_CALLOC, NULL, num_faces);
 
-		if (tfaces) { /* unlikely to fail */
+		if (mloopuvs) { /* unlikely to fail */
 			ix = 1.0 / rx;
 			iy = 1.0 / ry;
 			#pragma omp parallel for private(x, y) if (rx > OMP_MIN_RES)
 			for (y=0; y < res_y; y++) {
 				for (x=0; x < res_x; x++) {
 					const int i = y*res_x + x;
-					tfaces[i].uv[0][0] = x * ix;
-					tfaces[i].uv[0][1] = y * iy;
+					MLoopUV *luv= &mloopuvs[i * 4];
 
-					tfaces[i].uv[1][0] = (x+1) * ix;
-					tfaces[i].uv[1][1] = y * iy;
+					luv->uv[0] = x * ix;
+					luv->uv[1] = y * iy;
+					luv++;
 
-					tfaces[i].uv[2][0] = (x+1) * ix;
-					tfaces[i].uv[2][1] = (y+1) * iy;
+					luv->uv[0] = (x+1) * ix;
+					luv->uv[1] = y * iy;
+					luv++;
+
+					luv->uv[0] = (x+1) * ix;
+					luv->uv[1] = (y+1) * iy;
+					luv++;
+
+					luv->uv[0] = x * ix;
+					luv->uv[1] = (y+1) * iy;
+					luv++;
 
-					tfaces[i].uv[3][0] = x * ix;
-					tfaces[i].uv[3][1] = (y+1) * iy;
 				}
 			}
 		}
@@ -375,6 +399,7 @@ static DerivedMesh *doOcean(ModifierData *md, Object *ob,
 	OceanResult ocr;
 
 	MVert *mverts, *mv;
+	MLoop *mloops;
 
 	int i, j;
 
@@ -421,29 +446,34 @@ static DerivedMesh *doOcean(ModifierData *md, Object *ob,
 	cfra -= omd->bakestart;	// shift to 0 based
 
 	num_verts = dm->getNumVerts(dm);
-	num_faces = dm->getNumFaces(dm);
+	num_faces = dm->getNumPolys(dm);
 
 	mverts = dm->getVertArray(dm);
+	mloops = dm->getLoopArray(dm);
 
 	/* add vcols before displacement - allows lookup based on position */
 
 	if (omd->flag & MOD_OCEAN_GENERATE_FOAM) {
-		int cdlayer= CustomData_number_of_layers(&dm->faceData, CD_MCOL);
+		int cdlayer= CustomData_number_of_layers(&dm->loopData, CD_MLOOPCOL);
 
-		if(cdlayer < MAX_MCOL) {
-			MCol *mcols= CustomData_add_layer_named(&dm->faceData, CD_MCOL, CD_CALLOC, NULL, num_faces, omd->foamlayername);
+		if (cdlayer < MAX_MCOL) {
+			MLoopCol *mloopcols= CustomData_add_layer_named(&dm->loopData, CD_MLOOPCOL, CD_CALLOC, NULL, num_faces * 4, omd->foamlayername);
 
-			if (mcols) { /* unlikely to fail */
-				MCol *mc;
-				MFace *mfaces= dm->getFaceArray(dm);
-				MFace *mf;
+			if (mloopcols) { /* unlikely to fail */
+				MLoopCol *mlcol;
+				MPoly *mpolys= dm->getPolyArray(dm);
+				MPoly *mp;
 
 				float foam;
 
-				for (i = 0, mf= mfaces; i < num_faces; i++, mf++) {
-					j= mf->v4 ? 3 : 2;
+				for (i = 0, mp= mpolys; i < num_faces; i++, mp++) {
+					j= mp->totloop - 1;
+
+					/* highly unlikely */
+					if (j <= 0) continue;
+
 					do {
-						const float *co= mverts[*(&mf->v1 + j)].co;
+						const float *co= mverts[mloops[mp->loopstart + j].v].co;
 						const float u = OCEAN_CO(size_co_inv, co[0]);
 						const float v = OCEAN_CO(size_co_inv, co[1]);
 
@@ -457,8 +487,8 @@ static DerivedMesh *doOcean(ModifierData *md, Object *ob,
 							foam = BKE_ocean_jminus_to_foam(ocr.Jminus, omd->foam_coverage);
 						}
 
-						mc= &mcols[i*4 + j];
-						mc->r = mc->g = mc->b = (char)(foam * 255);
+						mlcol= &mloopcols[mp->loopstart + j];
+						mlcol->r = mlcol->g = mlcol->b = (char)(foam * 255);
 						/* mc->a = 255; */ /* no need to set */
 					} while (j--);
 				}
@@ -511,14 +541,14 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 
 	result = doOcean(md, ob, derivedData, 0);
 
-	if(result != derivedData)
+	if (result != derivedData)
 		CDDM_calc_normals(result);
 
 	return result;
 }
 
 static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
-									struct EditMesh *UNUSED(editData),
+									struct BMEditMesh *UNUSED(editData),
 									DerivedMesh *derivedData)
 {
 	return applyModifier(md, ob, derivedData, 0, 1);
diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c
index 509c916..6281042 100644
--- a/source/blender/modifiers/intern/MOD_particleinstance.c
+++ b/source/blender/modifiers/intern/MOD_particleinstance.c
@@ -122,29 +122,31 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
 	float max_co=0.0, min_co=0.0, temp_co[3], cross[3];
 	float *size=NULL;
 
+	DM_ensure_tessface(dm); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
+
 	trackneg=((ob->trackflag>2)?1:0);
 
-	if(pimd->ob==ob){
+	if (pimd->ob==ob) {
 		pimd->ob= NULL;
 		return derivedData;
 	}
 
-	if(pimd->ob){
+	if (pimd->ob) {
 		psys = BLI_findlink(&pimd->ob->particlesystem,pimd->psys-1);
-		if(psys==NULL || psys->totpart==0)
+		if (psys==NULL || psys->totpart==0)
 			return derivedData;
 	}
 	else return derivedData;
 
-	if(pimd->flag & eParticleInstanceFlag_Parents)
+	if (pimd->flag & eParticleInstanceFlag_Parents)
 		totpart+=psys->totpart;
-	if(pimd->flag & eParticleInstanceFlag_Children){
-		if(totpart==0)
+	if (pimd->flag & eParticleInstanceFlag_Children) {
+		if (totpart==0)
 			first_particle=psys->totpart;
 		totpart+=psys->totchild;
 	}
 
-	if(totpart==0)
+	if (totpart==0)
 		return derivedData;
 
 	sim.scene = md->scene;
@@ -152,20 +154,20 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
 	sim.psys = psys;
 	sim.psmd = psys_get_modifier(pimd->ob, psys);
 
-	if(pimd->flag & eParticleInstanceFlag_UseSize) {
+	if (pimd->flag & eParticleInstanceFlag_UseSize) {
 		int p;
 		float *si;
 		si = size = MEM_callocN(totpart * sizeof(float), "particle size array");
 
-		if(pimd->flag & eParticleInstanceFlag_Parents) {
-			for(p=0, pa= psys->particles; p<psys->totpart; p++, pa++, si++)
+		if (pimd->flag & eParticleInstanceFlag_Parents) {
+			for (p=0, pa= psys->particles; p<psys->totpart; p++, pa++, si++)
 				*si = pa->size;
 		}
 
-		if(pimd->flag & eParticleInstanceFlag_Children) {
+		if (pimd->flag & eParticleInstanceFlag_Children) {
 			ChildParticle *cpa = psys->child;
 
-			for(p=0; p<psys->totchild; p++, cpa++, si++) {
+			for (p=0; p<psys->totchild; p++, cpa++, si++) {
 				*si = psys_get_child_size(psys, cpa, 0.0f, NULL);
 			}
 		}
@@ -174,14 +176,14 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
 	pars=psys->particles;
 
 	totvert=dm->getNumVerts(dm);
-	totface=dm->getNumFaces(dm);
+	totface=dm->getNumTessFaces(dm);
 
 	maxvert=totvert*totpart;
 	maxface=totface*totpart;
 
 	psys->lattice=psys_get_lattice(&sim);
 
-	if(psys->flag & (PSYS_HAIR_DONE|PSYS_KEYED) || psys->pointcache->flag & PTCACHE_BAKED){
+	if (psys->flag & (PSYS_HAIR_DONE|PSYS_KEYED) || psys->pointcache->flag & PTCACHE_BAKED) {
 
 		float min_r[3], max_r[3];
 		INIT_MINMAX(min_r, max_r);
@@ -190,12 +192,12 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
 		max_co=max_r[track];
 	}
 
-	result = CDDM_from_template(dm, maxvert,dm->getNumEdges(dm)*totpart,maxface);
+	result = CDDM_from_template(dm, maxvert,dm->getNumEdges(dm)*totpart,maxface, 0, 0);
 
 	mvert=result->getVertArray(result);
 	orig_mvert=dm->getVertArray(dm);
 
-	for(i=0; i<maxvert; i++){
+	for (i=0; i<maxvert; i++) {
 		MVert *inMV;
 		MVert *mv = mvert + i;
 		ParticleKey state;
@@ -210,20 +212,20 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
 		mv->co[(axis+1)%3]=temp_co[(track+1)%3];
 		mv->co[(axis+2)%3]=temp_co[(track+2)%3];
 
-		if((psys->flag & (PSYS_HAIR_DONE|PSYS_KEYED) || psys->pointcache->flag & PTCACHE_BAKED) && pimd->flag & eParticleInstanceFlag_Path){
+		if ((psys->flag & (PSYS_HAIR_DONE|PSYS_KEYED) || psys->pointcache->flag & PTCACHE_BAKED) && pimd->flag & eParticleInstanceFlag_Path) {
 			float ran = 0.0f;
-			if(pimd->random_position != 0.0f) {
+			if (pimd->random_position != 0.0f) {
 				BLI_srandom(psys->seed + (i/totvert)%totpart);
 				ran = pimd->random_position * BLI_frand();
 			}
 
-			if(pimd->flag & eParticleInstanceFlag_KeepShape) {
+			if (pimd->flag & eParticleInstanceFlag_KeepShape) {
 				state.time = pimd->position * (1.0f - ran);
 			}
 			else {
 				state.time=(mv->co[axis]-min_co)/(max_co-min_co) * pimd->position * (1.0f - ran);
 
-				if(trackneg)
+				if (trackneg)
 					state.time=1.0f-state.time;
 
 				mv->co[axis] = 0.0;
@@ -234,7 +236,7 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
 			normalize_v3(state.vel);
 
 			/* TODO: incremental rotations somehow */
-			if(state.vel[axis] < -0.9999f || state.vel[axis] > 0.9999f) {
+			if (state.vel[axis] < -0.9999f || state.vel[axis] > 0.9999f) {
 				state.rot[0] = 1;
 				state.rot[1] = state.rot[2] = state.rot[3] = 0.0f;
 			}
@@ -249,73 +251,81 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
 			}
 
 		}
-		else{
+		else {
 			state.time=-1.0;
 			psys_get_particle_state(&sim, first_particle + i/totvert, &state,1);
 		}
 
 		mul_qt_v3(state.rot,mv->co);
-		if(pimd->flag & eParticleInstanceFlag_UseSize)
+		if (pimd->flag & eParticleInstanceFlag_UseSize)
 			mul_v3_fl(mv->co, size[i/totvert]);
 		add_v3_v3(mv->co, state.co);
 	}
 
-	mface=result->getFaceArray(result);
-	orig_mface=dm->getFaceArray(dm);
+	mface=result->getTessFaceArray(result);
+	orig_mface=dm->getTessFaceArray(dm);
 
-	for(i=0; i<maxface; i++){
+	for (i=0; i<maxface; i++) {
 		MFace *inMF;
 		MFace *mf = mface + i;
 
-		if(pimd->flag & eParticleInstanceFlag_Parents){
-			if(i/totface>=psys->totpart){
-				if(psys->part->childtype==PART_CHILD_PARTICLES)
+		if (pimd->flag & eParticleInstanceFlag_Parents) {
+			if (i/totface>=psys->totpart) {
+				if (psys->part->childtype==PART_CHILD_PARTICLES) {
 					pa=psys->particles+(psys->child+i/totface-psys->totpart)->parent;
-				else
+				}
+				else {
 					pa= NULL;
+				}
 			}
-			else
+			else {
 				pa=pars+i/totface;
+			}
 		}
-		else{
-			if(psys->part->childtype==PART_CHILD_PARTICLES)
+		else {
+			if (psys->part->childtype==PART_CHILD_PARTICLES) {
 				pa=psys->particles+(psys->child+i/totface)->parent;
-			else
+			}
+			else {
 				pa= NULL;
+			}
 		}
 
-		if(pa){
-			if(pa->alive==PARS_UNBORN && (pimd->flag&eParticleInstanceFlag_Unborn)==0) continue;
-			if(pa->alive==PARS_ALIVE && (pimd->flag&eParticleInstanceFlag_Alive)==0) continue;
-			if(pa->alive==PARS_DEAD && (pimd->flag&eParticleInstanceFlag_Dead)==0) continue;
+		if (pa) {
+			if (pa->alive==PARS_UNBORN && (pimd->flag&eParticleInstanceFlag_Unborn)==0) continue;
+			if (pa->alive==PARS_ALIVE && (pimd->flag&eParticleInstanceFlag_Alive)==0) continue;
+			if (pa->alive==PARS_DEAD && (pimd->flag&eParticleInstanceFlag_Dead)==0) continue;
 		}
 
 		inMF = orig_mface + i%totface;
-		DM_copy_face_data(dm, result, i%totface, i, 1);
+		DM_copy_poly_data(dm, result, i%totface, i, 1);
 		*mf = *inMF;
 
 		mf->v1+=(i/totface)*totvert;
 		mf->v2+=(i/totface)*totvert;
 		mf->v3+=(i/totface)*totvert;
-		if(mf->v4)
+		if (mf->v4) {
 			mf->v4+=(i/totface)*totvert;
+		}
 	}
 
-	CDDM_calc_edges(result);
-	CDDM_calc_normals(result);
+	CDDM_calc_edges_tessface(result);
 
-	if(psys->lattice){
+	if (psys->lattice) {
 		end_latt_deform(psys->lattice);
 		psys->lattice= NULL;
 	}
 
-	if(size)
+	if (size)
 		MEM_freeN(size);
 
+	CDDM_tessfaces_to_faces(result); /*builds ngon faces from tess (mface) faces*/
+	CDDM_calc_normals(result);
+
 	return result;
 }
 static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
-						struct EditMesh *UNUSED(editData),
+						struct BMEditMesh *UNUSED(editData),
 						DerivedMesh *derivedData)
 {
 	return applyModifier(md, ob, derivedData, 0, 1);
diff --git a/source/blender/modifiers/intern/MOD_particlesystem.c b/source/blender/modifiers/intern/MOD_particlesystem.c
index 5ce2437..d93779f 100644
--- a/source/blender/modifiers/intern/MOD_particlesystem.c
+++ b/source/blender/modifiers/intern/MOD_particlesystem.c
@@ -59,7 +59,7 @@ static void freeData(ModifierData *md)
 {
 	ParticleSystemModifierData *psmd= (ParticleSystemModifierData*) md;
 
-	if(psmd->dm){
+	if (psmd->dm) {
 		psmd->dm->needsFree = 1;
 		psmd->dm->release(psmd->dm);
 		psmd->dm = NULL;
@@ -67,7 +67,7 @@ static void freeData(ModifierData *md)
 
 	/* ED_object_modifier_remove may have freed this first before calling
 	 * modifier_free (which calls this function) */
-	if(psmd->psys)
+	if (psmd->psys)
 		psmd->psys->flag |= PSYS_DELETE;
 }
 static void copyData(ModifierData *md, ModifierData *target)
@@ -90,29 +90,29 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
 	MTex *mtex;
 	int i;
 
-	if(!psmd->psys->part)
+	if (!psmd->psys->part)
 		return 0;
 
-	for(i=0; i<MAX_MTEX; i++) {
+	for (i=0; i<MAX_MTEX; i++) {
 		mtex = psmd->psys->part->mtex[i];
-		if(mtex && mtex->mapto && (mtex->texco & TEXCO_UV))
+		if (mtex && mtex->mapto && (mtex->texco & TEXCO_UV))
 			dataMask |= CD_MASK_MTFACE;
 	}
 
-	if(psmd->psys->part->tanfac != 0.0f)
+	if (psmd->psys->part->tanfac != 0.0f)
 		dataMask |= CD_MASK_MTFACE;
 
 	/* ask for vertexgroups if we need them */
-	for(i=0; i<PSYS_TOT_VG; i++){
-		if(psmd->psys->vgroup[i]){
+	for (i=0; i<PSYS_TOT_VG; i++) {
+		if (psmd->psys->vgroup[i]) {
 			dataMask |= CD_MASK_MDEFORMVERT;
 			break;
 		}
 	}
 	
 	/* particles only need this if they are after a non deform modifier, and
-	* the modifier stack will only create them in that case. */
-	dataMask |= CD_MASK_ORIGSPACE|CD_MASK_ORIGINDEX;
+	 * the modifier stack will only create them in that case. */
+	dataMask |= CD_MASK_ORIGSPACE_MLOOP|CD_MASK_ORIGINDEX;
 
 	dataMask |= CD_MASK_ORCO;
 	
@@ -132,29 +132,29 @@ static void deformVerts(ModifierData *md, Object *ob,
 	ParticleSystem * psys= NULL;
 	int needsFree=0;
 
-	if(ob->particlesystem.first)
+	if (ob->particlesystem.first)
 		psys=psmd->psys;
 	else
 		return;
 	
-	if(!psys_check_enabled(ob, psys))
+	if (!psys_check_enabled(ob, psys))
 		return;
 
-	if(dm==NULL) {
+	if (dm==NULL) {
 		dm= get_dm(ob, NULL, NULL, vertexCos, 1);
 
-		if(!dm)
+		if (!dm)
 			return;
 
 		needsFree= 1;
 	}
 
 	/* clear old dm */
-	if(psmd->dm){
+	if (psmd->dm) {
 		psmd->dm->needsFree = 1;
 		psmd->dm->release(psmd->dm);
 	}
-	else if(psmd->flag & eParticleSystemFlag_file_loaded) {
+	else if (psmd->flag & eParticleSystemFlag_file_loaded) {
 		/* in file read dm just wasn't saved in file so no need to reset everything */
 		psmd->flag &= ~eParticleSystemFlag_file_loaded;
 	}
@@ -168,7 +168,7 @@ static void deformVerts(ModifierData *md, Object *ob,
 	CDDM_apply_vert_coords(psmd->dm, vertexCos);
 	CDDM_calc_normals(psmd->dm);
 
-	if(needsFree){
+	if (needsFree) {
 		dm->needsFree = 1;
 		dm->release(dm);
 	}
@@ -177,18 +177,18 @@ static void deformVerts(ModifierData *md, Object *ob,
 	psmd->dm->needsFree = 0;
 
 	/* report change in mesh structure */
-	if(psmd->dm->getNumVerts(psmd->dm)!=psmd->totdmvert ||
+	if (psmd->dm->getNumVerts(psmd->dm)!=psmd->totdmvert ||
 		  psmd->dm->getNumEdges(psmd->dm)!=psmd->totdmedge ||
-		  psmd->dm->getNumFaces(psmd->dm)!=psmd->totdmface){
+		  psmd->dm->getNumTessFaces(psmd->dm)!=psmd->totdmface) {
 
 		psys->recalc |= PSYS_RECALC_RESET;
 
 		psmd->totdmvert= psmd->dm->getNumVerts(psmd->dm);
 		psmd->totdmedge= psmd->dm->getNumEdges(psmd->dm);
-		psmd->totdmface= psmd->dm->getNumFaces(psmd->dm);
+		psmd->totdmface= psmd->dm->getNumTessFaces(psmd->dm);
 	}
 
-	if(psys) {
+	if (psys) {
 		psmd->flag &= ~eParticleSystemFlag_psys_updated;
 		particle_system_update(md->scene, ob, psys);
 		psmd->flag |= eParticleSystemFlag_psys_updated;
@@ -204,11 +204,11 @@ static void deformVertsEM(
 {
 	DerivedMesh *dm = derivedData;
 
-	if(!derivedData) dm = CDDM_from_editmesh(editData, ob->data);
+	if (!derivedData) dm = CDDM_from_editmesh(editData, ob->data);
 
 	deformVerts(md, ob, dm, vertexCos, numVerts);
 
-	if(!derivedData) dm->release(dm);
+	if (!derivedData) dm->release(dm);
 }
 #endif
 
diff --git a/source/blender/modifiers/intern/MOD_remesh.c b/source/blender/modifiers/intern/MOD_remesh.c
index bc67237..d408e5a 100644
--- a/source/blender/modifiers/intern/MOD_remesh.c
+++ b/source/blender/modifiers/intern/MOD_remesh.c
@@ -26,6 +26,7 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "BLI_math_base.h"
 #include "BLI_math_vector.h"
 #include "BLI_utildefines.h"
 
@@ -82,15 +83,15 @@ static void init_dualcon_mesh(DualConInput *mesh, DerivedMesh *dm)
 	mesh->co_stride = sizeof(MVert);
 	mesh->totco = dm->getNumVerts(dm);
 
-	mesh->faces = (void*)dm->getFaceArray(dm);
+	mesh->faces = (void*)dm->getTessFaceArray(dm);
 	mesh->face_stride = sizeof(MFace);
-	mesh->totface = dm->getNumFaces(dm);
+	mesh->totface = dm->getNumTessFaces(dm);
 
 	dm->getMinMax(dm, mesh->min, mesh->max);
 }
 
 /* simple structure to hold the output: a CDDM and two counters to
-   keep track of the current elements */
+ * keep track of the current elements */
 typedef struct {
 	DerivedMesh *dm;
 	int curvert, curface;
@@ -101,11 +102,11 @@ static void *dualcon_alloc_output(int totvert, int totquad)
 {
 	DualConOutput *output;
 
-	if(!(output = MEM_callocN(sizeof(DualConOutput),
+	if (!(output = MEM_callocN(sizeof(DualConOutput),
 							  "DualConOutput")))
 		return NULL;
 	
-	output->dm = CDDM_new(totvert, 0, totquad);
+	output->dm = CDDM_new(totvert, 0, 0, 4*totquad, totquad);
 	return output;
 }
 
@@ -124,18 +125,21 @@ static void dualcon_add_quad(void *output_v, const int vert_indices[4])
 {
 	DualConOutput *output = output_v;
 	DerivedMesh *dm = output->dm;
-	MFace *mface;
+	MLoop *mloop;
+	MPoly *cur_poly;
+	int i;
 	
-	assert(output->curface < dm->getNumFaces(dm));
+	assert(output->curface < dm->getNumPolys(dm));
 
-	mface = &CDDM_get_faces(dm)[output->curface];
-	mface->v1 = vert_indices[0];
-	mface->v2 = vert_indices[1];
-	mface->v3 = vert_indices[2];
-	mface->v4 = vert_indices[3];
+	mloop = CDDM_get_loops(dm);
+	cur_poly = CDDM_get_poly(dm, output->curface);
 	
-	if(test_index_face(mface, NULL, 0, 4))
-		output->curface++;
+	cur_poly->loopstart = output->curface * 4;
+	cur_poly->totloop = 4;
+	for (i = 0; i < 4; i++)
+		mloop[output->curface * 4 + i].v = vert_indices[i];
+	
+	output->curface++;
 }
 
 static DerivedMesh *applyModifier(ModifierData *md,
@@ -151,11 +155,13 @@ static DerivedMesh *applyModifier(ModifierData *md,
 	DualConFlags flags = 0;
 	DualConMode mode = 0;
 
+	DM_ensure_tessface(dm); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
+
 	rmd = (RemeshModifierData*)md;
 
 	init_dualcon_mesh(&input, dm);
 
-	if(rmd->flag & MOD_REMESH_FLOOD_FILL)
+	if (rmd->flag & MOD_REMESH_FLOOD_FILL)
 		flags |= DUALCON_FLOOD_FILL;
 
 	switch(rmd->mode) {
@@ -181,12 +187,10 @@ static DerivedMesh *applyModifier(ModifierData *md,
 					 rmd->scale,
 					 rmd->depth);
 	result = output->dm;
-	CDDM_lower_num_faces(result, output->curface);
 	MEM_freeN(output);
 
 	CDDM_calc_edges(result);
 	CDDM_calc_normals(result);
-
 	return result;
 }
 
diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c
index 93abbb1..ae21d3d 100644
--- a/source/blender/modifiers/intern/MOD_screw.c
+++ b/source/blender/modifiers/intern/MOD_screw.c
@@ -142,13 +142,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 	ScrewModifierData *ltmd= (ScrewModifierData*) md;
 	
 	int *origindex;
-	int mface_index=0;
+	int mpoly_index=0;
 	int step;
 	int i, j;
 	unsigned int i1, i2;
 	int step_tot= useRenderParams ? ltmd->render_steps : ltmd->steps;
 	const int do_flip = ltmd->flag & MOD_SCREW_NORMAL_FLIP ? 1 : 0;
-	int maxVerts=0, maxEdges=0, maxFaces=0;
+	int maxVerts=0, maxEdges=0, maxPolys=0;
 	const unsigned int totvert= dm->getNumVerts(dm);
 	const unsigned int totedge= dm->getNumEdges(dm);
 
@@ -165,16 +165,19 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 	int vc_tot_linked= 0;
 	short other_axis_1, other_axis_2;
 	float *tmpf1, *tmpf2;
+
+	int edge_offset;
 	
-	MFace *mface_new, *mf_new;
+	MPoly *mpoly_new, *mp_new;
+	MLoop *mloop_new, *ml_new;
 	MEdge *medge_orig, *med_orig, *med_new, *med_new_firstloop, *medge_new;
 	MVert *mvert_new, *mvert_orig, *mv_orig, *mv_new, *mv_new_base;
 
 	ScrewVertConnect *vc, *vc_tmp, *vert_connect= NULL;
 
-	/* dont do anything? */
+	/* don't do anything? */
 	if (!totvert)
-		return CDDM_from_template(dm, 0, 0, 0);
+		return CDDM_from_template(dm, 0, 0, 0, 0, 0);
 
 	switch(ltmd->axis) {
 	case 0:
@@ -204,11 +207,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		normalize_v3(axis_vec);
 
 		/* screw */
-		if(ltmd->flag & MOD_SCREW_OBJECT_OFFSET) {
+		if (ltmd->flag & MOD_SCREW_OBJECT_OFFSET) {
 			/* find the offset along this axis relative to this objects matrix */
 			float totlen = len_v3(mtx_tx[3]);
 
-			if(totlen != 0.0f) {
+			if (totlen != 0.0f) {
 				float zero[3]={0.0f, 0.0f, 0.0f};
 				float cp[3];				
 				screw_ofs= closest_to_line_v3(cp, mtx_tx[3], zero, axis_vec);
@@ -221,7 +224,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		/* angle */
 
 #if 0	// cant incluide this, not predictable enough, though quite fun,.
-		if(ltmd->flag & MOD_SCREW_OBJECT_ANGLE) {
+		if (ltmd->flag & MOD_SCREW_OBJECT_ANGLE) {
 			float mtx3_tx[3][3];
 			copy_m3_m4(mtx3_tx, mtx_tx);
 
@@ -245,7 +248,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 				cross_v3_v3v3(axis_tmp, cross1, c2);
 				normalize_v3(axis_tmp);
 
-				if(len_v3v3(axis_tmp, axis_vec) > 1.0f)
+				if (len_v3v3(axis_tmp, axis_vec) > 1.0f)
 					angle= -angle;
 
 			}
@@ -273,36 +276,45 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 	if (fabsf(screw_ofs) <= (FLT_EPSILON*100.0f) && fabsf(fabsf(angle) - ((float)M_PI * 2.0f)) <= (FLT_EPSILON*100.0f)) {
 		close= 1;
 		step_tot--;
-		if(step_tot < 3) step_tot= 3;
+		if (step_tot < 3) step_tot= 3;
 	
 		maxVerts =	totvert  * step_tot; /* -1 because we're joining back up */
 		maxEdges =	(totvert * step_tot) + /* these are the edges between new verts */
 					(totedge * step_tot); /* -1 because vert edges join */
-		maxFaces =	totedge * step_tot;
+		maxPolys =	totedge * step_tot;
 
 		screw_ofs= 0.0f;
 	}
 	else {
 		close= 0;
-		if(step_tot < 3) step_tot= 3;
+		if (step_tot < 3) step_tot= 3;
 
 		maxVerts =	totvert  * step_tot; /* -1 because we're joining back up */
 		maxEdges =	(totvert * (step_tot-1)) + /* these are the edges between new verts */
 					(totedge * step_tot); /* -1 because vert edges join */
-		maxFaces =	totedge * (step_tot-1);
+		maxPolys =	totedge * (step_tot-1);
 	}
 	
-	result= CDDM_from_template(dm, maxVerts, maxEdges, maxFaces);
+	result= CDDM_from_template(dm, maxVerts, maxEdges, 0, maxPolys * 4, maxPolys);
 	
 	/* copy verts from mesh */
 	mvert_orig =	dm->getVertArray(dm);
 	medge_orig =	dm->getEdgeArray(dm);
 	
 	mvert_new =		result->getVertArray(result);
-	mface_new =		result->getFaceArray(result);
+	mpoly_new =		result->getPolyArray(result);
+	mloop_new =		result->getLoopArray(result);
 	medge_new =		result->getEdgeArray(result);
-	
-	origindex= result->getFaceDataArray(result, CD_ORIGINDEX);
+
+	if (!CustomData_has_layer(&result->polyData, CD_ORIGINDEX)) {
+		CustomData_add_layer(&result->polyData, CD_ORIGINDEX, CD_CALLOC, NULL, maxPolys);
+	}
+
+#if 0 // trunk
+	origindex = result->getPolyDataArray(result, CD_ORIGINDEX);
+#else // bmesh
+	origindex = CustomData_get_layer(&result->polyData, CD_ORIGINDEX);
+#endif
 
 	DM_copy_vert_data(dm, result, 0, 0, totvert); /* copy first otherwise this overwrites our own vertex normals */
 	
@@ -321,7 +333,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		med_new->flag= med_orig->flag &  ~ME_LOOSEEDGE;
 	}
 	
-	if(ltmd->flag & MOD_SCREW_NORMAL_CALC) {
+	if (ltmd->flag & MOD_SCREW_NORMAL_CALC) {
 		/*
 		 * Normal Calculation (for face flipping)
 		 * Sort edge verts for correct face flipping
@@ -333,7 +345,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		/* Notice!
 		 *
 		 * Since we are only ordering the edges here it can avoid mallocing the
-		 * extra space by abusing the vert array berfore its filled with new verts.
+		 * extra space by abusing the vert array before its filled with new verts.
 		 * The new array for vert_connect must be at least sizeof(ScrewVertConnect) * totvert
 		 * and the size of our resulting meshes array is sizeof(MVert) * totvert * 3
 		 * so its safe to use the second 2 thrids of MVert the array for vert_connect,
@@ -376,7 +388,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 					vc->v[0]= vc->v[1]= -1;
 
 					mul_m4_v3(mtx_tx, vc->co);
-					/* length in 2d, dont sqrt because this is only for comparison */
+					/* length in 2d, don't sqrt because this is only for comparison */
 					vc->dist =	vc->co[other_axis_1]*vc->co[other_axis_1] +
 								vc->co[other_axis_2]*vc->co[other_axis_2];
 
@@ -393,7 +405,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 					vc->e[0]= vc->e[1]= NULL;
 					vc->v[0]= vc->v[1]= -1;
 
-					/* length in 2d, dont sqrt because this is only for comparison */
+					/* length in 2d, don't sqrt because this is only for comparison */
 					vc->dist =	vc->co[other_axis_1]*vc->co[other_axis_1] +
 								vc->co[other_axis_2]*vc->co[other_axis_2];
 
@@ -414,7 +426,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 					vc->e[1]= med_new;
 				}
 				else {
-					vc->v[0]= vc->v[1]= -2; /* erro value  - dont use, 3 edges on vert */
+					vc->v[0]= vc->v[1]= -2; /* erro value  - don't use, 3 edges on vert */
 				}
 
 				vc= &vert_connect[med_new->v2];
@@ -429,7 +441,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 					vc->e[1]= med_new;
 				}
 				else {
-					vc->v[0]= vc->v[1]= -2; /* erro value  - dont use, 3 edges on vert */
+					vc->v[0]= vc->v[1]= -2; /* erro value  - don't use, 3 edges on vert */
 				}
 			}
 
@@ -447,7 +459,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 
 					/*printf("Loop on connected vert: %i\n", i);*/
 
-					for(j=0; j<2; j++) {
+					for (j=0; j<2; j++) {
 						/*printf("\tSide: %i\n", j);*/
 						screwvert_iter_init(&lt_iter, vert_connect, i, j);
 						if (j == 1) {
@@ -531,25 +543,28 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 								ed_loop_flip= 0;
 							}
 
-						}/* else {
+						}
+#if 0
+						else {
 							printf("No Connected ___\n");
-						}*/
+						}
+#endif
 
 						/*printf("flip direction %i\n", ed_loop_flip);*/
 
 
 						/* switch the flip option if set
 						 * note: flip is now done at face level so copying vgroup slizes is easier */
-						/*						
+#if 0
 						if (do_flip)
 							ed_loop_flip= !ed_loop_flip;
-						*/
+#endif
 
 						if (angle < 0.0f)
 							ed_loop_flip= !ed_loop_flip;
 
 						/* if its closed, we only need 1 loop */
-						for(j=ed_loop_closed; j<2; j++) {
+						for (j=ed_loop_closed; j<2; j++) {
 							/*printf("Ordering Side J %i\n", j);*/
 
 							screwvert_iter_init(&lt_iter, vert_connect, v_best, j);
@@ -572,7 +587,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 										if (ed_loop_flip == 0) {
 											/*printf("\t\t\tFlipping 0\n");*/
 											SWAP(unsigned int, lt_iter.e->v1, lt_iter.e->v2);
-										}/* else {
+										}
+										/* else {
 											printf("\t\t\tFlipping Not 0\n");
 										}*/
 									}
@@ -580,13 +596,16 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 										if (ed_loop_flip == 1) {
 											/*printf("\t\t\tFlipping 1\n");*/
 											SWAP(unsigned int, lt_iter.e->v1, lt_iter.e->v2);
-										}/* else {
+										}
+										/* else {
 											printf("\t\t\tFlipping Not 1\n");
 										}*/
-									}/* else {
+									}
+									/* else {
 										printf("\t\tIncorrect edge topology");
 									}*/
-								}/* else {
+								}
+								/* else {
 									printf("\t\tNo Edge at this point\n");
 								}*/
 								screwvert_iter_step(&lt_iter);
@@ -599,7 +618,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 				 * we know the surrounding edges are ordered correctly now
 				 * so its safe to create vertex normals.
 				 *
-				 * calculate vertex normals that can be propodated on lathing
+				 * calculate vertex normals that can be propagated on lathing
 				 * use edge connectivity work this out */
 				if (vc->v[0] >= 0) {
 					if (vc->v[1] >= 0) {
@@ -624,7 +643,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 					}
 					else {
 						/* only 1 edge connected - same as above except
-						 * dont need to average edge direction */
+						 * don't need to average edge direction */
 						if (vc->e && vc->e[0]->v2 == i) {
 							sub_v3_v3v3(tmp_vec1, mvert_new[i].co, mvert_new[vc->v[0]].co);
 						}
@@ -685,7 +704,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 			copy_m3_m4(mat3, mat);
 		}
 
-		if(screw_ofs)
+		if (screw_ofs)
 			madd_v3_v3fl(mat[3], axis_vec, screw_ofs * ((float)step / (float)(step_tot-1)));
 
 		/* copy a slice */
@@ -696,7 +715,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		
 		for (j=0; j<totvert; j++, mv_new_base++, mv_new++) {
 			/* set normal */
-			if(vert_connect) {
+			if (vert_connect) {
 				mul_v3_m3v3(nor_tx, mat3, vert_connect[j].no);
 
 				/* set the normal now its transformed */
@@ -729,7 +748,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 	}
 
 	/* we can avoid if using vert alloc trick */
-	if(vert_connect) {
+	if (vert_connect) {
 		MEM_freeN(vert_connect);
 		vert_connect= NULL;
 	}
@@ -746,9 +765,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		}
 	}
 	
-	mf_new= mface_new;
+	mp_new= mpoly_new;
+	ml_new= mloop_new;
 	med_new_firstloop= medge_new;
 	
+	/* more of an offset in this case */
+	edge_offset = totedge + (totvert * (step_tot - (close ? 0 : 1)));
+
 	for (i=0; i < totedge; i++, med_new_firstloop++) {
 		/* for each edge, make a cylinder of quads */
 		i1= med_new_firstloop->v1;
@@ -757,27 +780,37 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		for (step=0; step < step_tot-1; step++) {
 			
 			/* new face */
-			if(do_flip) {
-				mf_new->v4= i1;
-				mf_new->v3= i2;
-				mf_new->v2= i2 + totvert;
-				mf_new->v1= i1 + totvert;
+			if (do_flip) {
+				ml_new[3].v = i1;
+				ml_new[2].v = i2;
+				ml_new[1].v = i2 + totvert;
+				ml_new[0].v = i1 + totvert;
+
+				ml_new[2].e = step == 0 ? i : (edge_offset + step + (i * (step_tot - 1))) - 1;
+				ml_new[1].e = totedge + i2;
+				ml_new[0].e = edge_offset + step + (i * (step_tot - 1));
+				ml_new[3].e = totedge + i1;
 			}
 			else {
-				mf_new->v1= i1;
-				mf_new->v2= i2;
-				mf_new->v3= i2 + totvert;
-				mf_new->v4= i1 + totvert;
+				ml_new[0].v = i1;
+				ml_new[1].v = i2;
+				ml_new[2].v = i2 + totvert;
+				ml_new[3].v = i1 + totvert;
+
+				ml_new[0].e = step == 0 ? i : (edge_offset + step + (i * (step_tot - 1))) - 1;
+				ml_new[1].e = totedge + i2;
+				ml_new[2].e = edge_offset + step + (i * (step_tot - 1));
+				ml_new[3].e = totedge + i1;
 			}
-			
-			if( !mf_new->v3 || !mf_new->v4 ) {
-				SWAP(unsigned int, mf_new->v1, mf_new->v3);
-				SWAP(unsigned int, mf_new->v2, mf_new->v4);
-			}
-			mf_new->flag= ME_SMOOTH;
-			origindex[mface_index]= ORIGINDEX_NONE;
-			mf_new++;
-			mface_index++;
+
+
+			mp_new->loopstart = mpoly_index * 4;
+			mp_new->totloop = 4;
+			mp_new->flag= ME_SMOOTH;
+			origindex[mpoly_index]= ORIGINDEX_NONE;
+			mp_new++;
+			ml_new += 4;
+			mpoly_index++;
 			
 			/* new vertical edge */
 			if (step) { /* The first set is already dome */
@@ -793,27 +826,36 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		
 		/* close the loop*/
 		if (close) { 
-			if(do_flip) {
-				mf_new->v4= i1;
-				mf_new->v3= i2;
-				mf_new->v2= med_new_firstloop->v2;
-				mf_new->v1= med_new_firstloop->v1;
+			if (do_flip) {
+				ml_new[3].v = i1;
+				ml_new[2].v = i2;
+				ml_new[1].v = med_new_firstloop->v2;
+				ml_new[0].v = med_new_firstloop->v1;
+
+				ml_new[2].e = (edge_offset + step + (i * (step_tot - 1))) - 1;
+				ml_new[1].e = totedge + i2;
+				ml_new[0].e = i;
+				ml_new[3].e = totedge + i1;
 			}
 			else {
-				mf_new->v1= i1;
-				mf_new->v2= i2;
-				mf_new->v3= med_new_firstloop->v2;
-				mf_new->v4= med_new_firstloop->v1;
+				ml_new[0].v = i1;
+				ml_new[1].v = i2;
+				ml_new[2].v = med_new_firstloop->v2;
+				ml_new[3].v = med_new_firstloop->v1;
+
+				ml_new[0].e = (edge_offset + step + (i * (step_tot - 1))) - 1;
+				ml_new[1].e = totedge + i2;
+				ml_new[2].e = i;
+				ml_new[3].e = totedge + i1;
 			}
 
-			if( !mf_new->v3 || !mf_new->v4 ) {
-				SWAP(unsigned int, mf_new->v1, mf_new->v3);
-				SWAP(unsigned int, mf_new->v2, mf_new->v4);
-			}
-			mf_new->flag= ME_SMOOTH;
-			origindex[mface_index]= ORIGINDEX_NONE;
-			mf_new++;
-			mface_index++;
+			mp_new->loopstart = mpoly_index * 4;
+			mp_new->totloop = 4;
+			mp_new->flag= ME_SMOOTH;
+			origindex[mpoly_index]= ORIGINDEX_NONE;
+			mp_new++;
+			ml_new += 4;
+			mpoly_index++;
 		}
 		
 		/* new vertical edge */
@@ -823,8 +865,37 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		med_new->crease= med_new_firstloop->crease;
 		med_new++;
 	}
-	
-	if((ltmd->flag & MOD_SCREW_NORMAL_CALC) == 0) {
+
+	/* validate loop edges */
+#if 0
+	{
+		i = 0;
+		printf("\n");
+		for ( ; i < maxPolys * 4; i += 4) {
+			int ii;
+			ml_new = mloop_new + i;
+			ii = findEd(medge_new, maxEdges, ml_new[0].v, ml_new[1].v);
+			printf("%d %d -- ", ii, ml_new[0].e);
+			ml_new[0].e = ii;
+
+			ii = findEd(medge_new, maxEdges, ml_new[1].v, ml_new[2].v);
+			printf("%d %d -- ", ii, ml_new[1].e);
+			ml_new[1].e = ii;
+
+			ii = findEd(medge_new, maxEdges, ml_new[2].v, ml_new[3].v);
+			printf("%d %d -- ", ii, ml_new[2].e);
+			ml_new[2].e = ii;
+
+			ii = findEd(medge_new, maxEdges, ml_new[3].v, ml_new[0].v);
+			printf("%d %d\n", ii, ml_new[3].e);
+			ml_new[3].e = ii;
+
+		}
+	}
+#endif
+
+	if ((ltmd->flag & MOD_SCREW_NORMAL_CALC) == 0) {
+		/* BMESH_TODO, we only need to get vertex normals here, this is way overkill */
 		CDDM_calc_normals(result);
 	}
 
@@ -839,7 +910,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
 {
 	ScrewModifierData *ltmd= (ScrewModifierData*) md;
 
-	if(ltmd->ob_axis) {
+	if (ltmd->ob_axis) {
 		DagNode *curNode= dag_get_node(forest, ltmd->ob_axis);
 
 		dag_add_relation(forest, curNode, obNode,
@@ -862,7 +933,7 @@ static void foreachObjectLink(
 static DerivedMesh *applyModifierEM(
 						ModifierData *md,
 						Object *ob,
-						struct EditMesh *UNUSED(editData),
+						struct BMEditMesh *UNUSED(editData),
 						DerivedMesh *derivedData)
 {
 	return applyModifier(md, ob, derivedData, 0, 1);
diff --git a/source/blender/modifiers/intern/MOD_shapekey.c b/source/blender/modifiers/intern/MOD_shapekey.c
index 9080ca3..a91019b 100644
--- a/source/blender/modifiers/intern/MOD_shapekey.c
+++ b/source/blender/modifiers/intern/MOD_shapekey.c
@@ -58,9 +58,9 @@ static void deformVerts(ModifierData *md, Object *ob,
 	KeyBlock *kb= ob_get_keyblock(ob);
 	float (*deformedVerts)[3];
 
-	if(kb && kb->totelem == numVerts) {
+	if (kb && kb->totelem == numVerts) {
 		deformedVerts= (float(*)[3])do_ob_key(md->scene, ob);
-		if(deformedVerts) {
+		if (deformedVerts) {
 			memcpy(vertexCos, deformedVerts, sizeof(float)*3*numVerts);
 			MEM_freeN(deformedVerts);
 		}
@@ -76,13 +76,13 @@ static void deformMatrices(ModifierData *md, Object *ob, DerivedMesh *derivedDat
 
 	(void)vertexCos; /* unused */
 
-	if(kb && kb->totelem==numVerts && kb!=key->refkey) {
+	if (kb && kb->totelem==numVerts && kb!=key->refkey) {
 		int a;
 
-		if(ob->shapeflag & OB_SHAPE_LOCK) scale_m3_fl(scale, 1);
+		if (ob->shapeflag & OB_SHAPE_LOCK) scale_m3_fl(scale, 1);
 		else scale_m3_fl(scale, kb->curval);
 
-		for(a=0; a<numVerts; a++)
+		for (a=0; a<numVerts; a++)
 			copy_m3_m3(defMats[a], scale);
 	}
 
@@ -90,19 +90,19 @@ static void deformMatrices(ModifierData *md, Object *ob, DerivedMesh *derivedDat
 }
 
 static void deformVertsEM(ModifierData *md, Object *ob,
-						struct EditMesh *UNUSED(editData),
+						struct BMEditMesh *UNUSED(editData),
 						DerivedMesh *derivedData,
 						float (*vertexCos)[3],
 						int numVerts)
 {
 	Key *key= ob_get_key(ob);
 
-	if(key && key->type == KEY_RELATIVE)
+	if (key && key->type == KEY_RELATIVE)
 		deformVerts(md, ob, derivedData, vertexCos, numVerts, 0, 0);
 }
 
 static void deformMatricesEM(ModifierData *UNUSED(md), Object *ob,
-						struct EditMesh *UNUSED(editData),
+						struct BMEditMesh *UNUSED(editData),
 						DerivedMesh *UNUSED(derivedData),
 						float (*vertexCos)[3],
 						float (*defMats)[3][3],
@@ -114,11 +114,11 @@ static void deformMatricesEM(ModifierData *UNUSED(md), Object *ob,
 
 	(void)vertexCos; /* unused */
 
-	if(kb && kb->totelem==numVerts && kb!=key->refkey) {
+	if (kb && kb->totelem==numVerts && kb!=key->refkey) {
 		int a;
 		scale_m3_fl(scale, kb->curval);
 
-		for(a=0; a<numVerts; a++)
+		for (a=0; a<numVerts; a++)
 			copy_m3_m3(defMats[a], scale);
 	}
 }
diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c
index e8f0997..ae8ca26 100644
--- a/source/blender/modifiers/intern/MOD_shrinkwrap.c
+++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c
@@ -83,13 +83,15 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
 	CustomDataMask dataMask = 0;
 
 	/* ask for vertexgroups if we need them */
-	if(smd->vgroup_name[0])
+	if (smd->vgroup_name[0])
 		dataMask |= CD_MASK_MDEFORMVERT;
 
-	if(smd->shrinkType == MOD_SHRINKWRAP_PROJECT
-	&& smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL)
+	if ((smd->shrinkType == MOD_SHRINKWRAP_PROJECT) &&
+	    (smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL))
+	{
 		dataMask |= CD_MASK_MVERT;
-		
+	}
+
 	return dataMask;
 }
 
@@ -119,27 +121,27 @@ static void deformVerts(ModifierData *md, Object *ob,
 	CustomDataMask dataMask = requiredDataMask(ob, md);
 
 	/* ensure we get a CDDM with applied vertex coords */
-	if(dataMask)
+	if (dataMask)
 		dm= get_cddm(ob, NULL, dm, vertexCos);
 
 	shrinkwrapModifier_deform((ShrinkwrapModifierData*)md, ob, dm, vertexCos, numVerts);
 
-	if(dm != derivedData)
+	if (dm != derivedData)
 		dm->release(dm);
 }
 
-static void deformVertsEM(ModifierData *md, Object *ob, struct EditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
+static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *editData, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
 {
 	DerivedMesh *dm = derivedData;
 	CustomDataMask dataMask = requiredDataMask(ob, md);
 
 	/* ensure we get a CDDM with applied vertex coords */
-	if(dataMask)
+	if (dataMask)
 		dm= get_cddm(ob, editData, dm, vertexCos);
 
 	shrinkwrapModifier_deform((ShrinkwrapModifierData*)md, ob, dm, vertexCos, numVerts);
 
-	if(dm != derivedData)
+	if (dm != derivedData)
 		dm->release(dm);
 }
 
diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c
index 2c056ad..6c1325b 100644
--- a/source/blender/modifiers/intern/MOD_simpledeform.c
+++ b/source/blender/modifiers/intern/MOD_simpledeform.c
@@ -58,8 +58,8 @@
 static void axis_limit(int axis, const float limits[2], float co[3], float dcut[3])
 {
 	float val = co[axis];
-	if(limits[0] > val) val = limits[0];
-	if(limits[1] < val) val = limits[1];
+	if (limits[0] > val) val = limits[0];
+	if (limits[1] < val) val = limits[1];
 
 	dcut[axis] = co[axis] - val;
 	co[axis] = val;
@@ -74,8 +74,7 @@ static void simpleDeform_taper(const float factor, const float dcut[3], float *c
 	co[1] = y + y*scale;
 	co[2] = z;
 
-	if(dcut)
-	{
+	if (dcut) {
 		co[0] += dcut[0];
 		co[1] += dcut[1];
 		co[2] += dcut[2];
@@ -93,9 +92,7 @@ static void simpleDeform_stretch(const float factor, const float dcut[3], float
 	co[1] = y*scale;
 	co[2] = z*(1.0f+factor);
 
-
-	if(dcut)
-	{
+	if (dcut) {
 		co[0] += dcut[0];
 		co[1] += dcut[1];
 		co[2] += dcut[2];
@@ -115,8 +112,7 @@ static void simpleDeform_twist(const float factor, const float *dcut, float *co)
 	co[1] = x*sint + y*cost;
 	co[2] = z;
 
-	if(dcut)
-	{
+	if (dcut) {
 		co[0] += dcut[0];
 		co[1] += dcut[1];
 		co[2] += dcut[2];
@@ -132,16 +128,13 @@ static void simpleDeform_bend(const float factor, const float dcut[3], float *co
 	sint = sin(theta);
 	cost = cos(theta);
 
-	if(fabsf(factor) > 1e-7f)
-	{
+	if (fabsf(factor) > 1e-7f) {
 		co[0] = -(y-1.0f/factor)*sint;
 		co[1] =  (y-1.0f/factor)*cost + 1.0f/factor;
 		co[2] = z;
 	}
 
-
-	if(dcut)
-	{
+	if (dcut) {
 		co[0] += cost*dcut[0];
 		co[1] += sint*dcut[0];
 		co[2] += dcut[2];
@@ -164,24 +157,21 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object
 	MDeformVert *dvert;
 
 	//Safe-check
-	if(smd->origin == ob) smd->origin = NULL;					//No self references
+	if (smd->origin == ob) smd->origin = NULL;					//No self references
 
-	if(smd->limit[0] < 0.0f) smd->limit[0] = 0.0f;
-	if(smd->limit[0] > 1.0f) smd->limit[0] = 1.0f;
+	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] = MIN2(smd->limit[0], smd->limit[1]);			//Upper limit >= than lower limit
 
 	//Calculate matrixs do convert between coordinate spaces
-	if(smd->origin)
-	{
+	if (smd->origin) {
 		transf = &tmp_transf;
 
-		if(smd->originOpts & MOD_SIMPLEDEFORM_ORIGIN_LOCAL)
-		{
+		if (smd->originOpts & MOD_SIMPLEDEFORM_ORIGIN_LOCAL) {
 			space_transform_from_matrixs(transf, ob->obmat, smd->origin->obmat);
 		}
-		else
-		{
+		else {
 			copy_m4_m4(transf->local2target, smd->origin->obmat);
 			invert_m4_m4(transf->target2local, transf->local2target);
 		}
@@ -195,12 +185,12 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object
 		float lower =  FLT_MAX;
 		float upper = -FLT_MAX;
 
-		for(i=0; i<numVerts; i++)
+		for (i=0; i<numVerts; i++)
 		{
 			float tmp[3];
 			copy_v3_v3(tmp, vertexCos[i]);
 
-			if(transf) space_transform_apply(transf, tmp);
+			if (transf) space_transform_apply(transf, tmp);
 
 			lower = MIN2(lower, tmp[limit_axis]);
 			upper = MAX2(upper, tmp[limit_axis]);
@@ -226,30 +216,30 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object
 			return;	//No simpledeform mode?
 	}
 
-	for(i=0; i<numVerts; i++)
+	for (i=0; i<numVerts; i++)
 	{
 		float weight = defvert_array_find_weight_safe(dvert, i, vgroup);
 
-		if(weight != 0.0f)
-		{
+		if (weight != 0.0f) {
 			float co[3], dcut[3] = {0.0f, 0.0f, 0.0f};
 
-			if(transf) space_transform_apply(transf, vertexCos[i]);
+			if (transf) {
+				space_transform_apply(transf, vertexCos[i]);
+			}
 
 			copy_v3_v3(co, vertexCos[i]);
 
-			//Apply axis limits
-			if(smd->mode != MOD_SIMPLEDEFORM_MODE_BEND) //Bend mode shoulnt have any lock axis
-			{
-				if(smd->axis & MOD_SIMPLEDEFORM_LOCK_AXIS_X) axis_limit(0, lock_axis, co, dcut);
-				if(smd->axis & MOD_SIMPLEDEFORM_LOCK_AXIS_Y) axis_limit(1, lock_axis, co, dcut);
+			/* Apply axis limits */
+			if (smd->mode != MOD_SIMPLEDEFORM_MODE_BEND) { /* Bend mode shoulnt have any lock axis */
+				if (smd->axis & MOD_SIMPLEDEFORM_LOCK_AXIS_X) axis_limit(0, lock_axis, co, dcut);
+				if (smd->axis & MOD_SIMPLEDEFORM_LOCK_AXIS_Y) axis_limit(1, lock_axis, co, dcut);
 			}
 			axis_limit(limit_axis, smd_limit, co, dcut);
 
 			simpleDeform_callback(smd_factor, dcut, co);		//Apply deform
 			interp_v3_v3v3(vertexCos[i], vertexCos[i], co, weight);	//Use vertex weight has coef of linear interpolation
 
-			if(transf) space_transform_invert(transf, vertexCos[i]);
+			if (transf) space_transform_invert(transf, vertexCos[i]);
 		}
 	}
 }
@@ -291,7 +281,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
 	CustomDataMask dataMask = 0;
 
 	/* ask for vertexgroups if we need them */
-	if(smd->vgroup_name[0])
+	if (smd->vgroup_name[0])
 		dataMask |= CD_MASK_MDEFORMVERT;
 
 	return dataMask;
@@ -325,18 +315,18 @@ static void deformVerts(ModifierData *md, Object *ob,
 	CustomDataMask dataMask = requiredDataMask(ob, md);
 
 	/* we implement requiredDataMask but thats not really useful since
-	   mesh_calc_modifiers pass a NULL derivedData */
-	if(dataMask)
+	 * mesh_calc_modifiers pass a NULL derivedData */
+	if (dataMask)
 		dm= get_dm(ob, NULL, dm, NULL, 0);
 
 	SimpleDeformModifier_do((SimpleDeformModifierData*)md, ob, dm, vertexCos, numVerts);
 
-	if(dm != derivedData)
+	if (dm != derivedData)
 		dm->release(dm);
 }
 
 static void deformVertsEM(ModifierData *md, Object *ob,
-						struct EditMesh *editData,
+						struct BMEditMesh *editData,
 						DerivedMesh *derivedData,
 						float (*vertexCos)[3],
 						int numVerts)
@@ -345,13 +335,13 @@ static void deformVertsEM(ModifierData *md, Object *ob,
 	CustomDataMask dataMask = requiredDataMask(ob, md);
 
 	/* we implement requiredDataMask but thats not really useful since
-	   mesh_calc_modifiers pass a NULL derivedData */
-	if(dataMask)
+	 * mesh_calc_modifiers pass a NULL derivedData */
+	if (dataMask)
 		dm= get_dm(ob, editData, dm, NULL, 0);
 
 	SimpleDeformModifier_do((SimpleDeformModifierData*)md, ob, dm, vertexCos, numVerts);
 
-	if(dm != derivedData)
+	if (dm != derivedData)
 		dm->release(dm);
 }
 
diff --git a/source/blender/modifiers/intern/MOD_smoke.c b/source/blender/modifiers/intern/MOD_smoke.c
index 9b03816..706c981 100644
--- a/source/blender/modifiers/intern/MOD_smoke.c
+++ b/source/blender/modifiers/intern/MOD_smoke.c
@@ -93,7 +93,7 @@ static void deformVerts(ModifierData *md, Object *ob,
 
 	smokeModifier_do(smd, md->scene, ob, dm);
 
-	if(dm != derivedData)
+	if (dm != derivedData)
 		dm->release(dm);
 }
 
@@ -109,37 +109,45 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
 {
 	SmokeModifierData *smd = (SmokeModifierData *) md;
 
-	if(smd && (smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain)
-	{
-		if(smd->domain->fluid_group)
-		{
+	if (smd && (smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) {
+		if (smd->domain->fluid_group || smd->domain->coll_group) {
 			GroupObject *go = NULL;
 			
-			for(go = smd->domain->fluid_group->gobject.first; go; go = go->next) 
-			{
-				if(go->ob)
-				{
-					SmokeModifierData *smd2 = (SmokeModifierData *)modifiers_findByType(go->ob, eModifierType_Smoke);
-					
-					// check for initialized smoke object
-					if(smd2 && (((smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow) || ((smd->type & MOD_SMOKE_TYPE_COLL) && smd2->coll)))
-					{
-						DagNode *curNode = dag_get_node(forest, go->ob);
-						dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Smoke Flow");
+			if (smd->domain->fluid_group)
+				for (go = smd->domain->fluid_group->gobject.first; go; go = go->next) {
+					if (go->ob) {
+						SmokeModifierData *smd2 = (SmokeModifierData *)modifiers_findByType(go->ob, eModifierType_Smoke);
+						
+						// check for initialized smoke object
+						if (smd2 && (smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow) {
+							DagNode *curNode = dag_get_node(forest, go->ob);
+							dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Smoke Flow");
+						}
+					}
+				}
+
+			if (smd->domain->coll_group)
+				for (go = smd->domain->coll_group->gobject.first; go; go = go->next) {
+					if (go->ob) {
+						SmokeModifierData *smd2 = (SmokeModifierData *)modifiers_findByType(go->ob, eModifierType_Smoke);
+						
+						// check for initialized smoke object
+						if (smd2 && (smd2->type & MOD_SMOKE_TYPE_COLL) && smd2->coll) {
+							DagNode *curNode = dag_get_node(forest, go->ob);
+							dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Smoke Coll");
+						}
 					}
 				}
-			}
 		}
 		else {
 			Base *base = scene->base.first;
 
-			for(; base; base = base->next) {
+			for ( ; base; base = base->next) {
 				SmokeModifierData *smd2 = (SmokeModifierData *)modifiers_findByType(base->object, eModifierType_Smoke);
 
-				if(smd2 && (((smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow) || ((smd->type & MOD_SMOKE_TYPE_COLL) && smd2->coll)))
-				{
+				if (smd2 && (((smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow) || ((smd2->type & MOD_SMOKE_TYPE_COLL) && smd2->coll))) {
 					DagNode *curNode = dag_get_node(forest, base->object);
-					dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Smoke Flow");
+					dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Smoke Flow/Coll");
 				}
 			}
 		}
@@ -151,12 +159,12 @@ static void foreachIDLink(ModifierData *md, Object *ob,
 {
 	SmokeModifierData *smd = (SmokeModifierData*) md;
 
-	if(smd->type==MOD_SMOKE_TYPE_DOMAIN && smd->domain) {
+	if (smd->type==MOD_SMOKE_TYPE_DOMAIN && smd->domain) {
 		walk(userData, ob, (ID **)&smd->domain->coll_group);
 		walk(userData, ob, (ID **)&smd->domain->fluid_group);
 		walk(userData, ob, (ID **)&smd->domain->eff_group);
 
-		if(smd->domain->effector_weights) {
+		if (smd->domain->effector_weights) {
 			walk(userData, ob, (ID **)&smd->domain->effector_weights->group);
 		}
 	}
diff --git a/source/blender/modifiers/intern/MOD_smooth.c b/source/blender/modifiers/intern/MOD_smooth.c
index e43304b..b909e1f 100644
--- a/source/blender/modifiers/intern/MOD_smooth.c
+++ b/source/blender/modifiers/intern/MOD_smooth.c
@@ -78,7 +78,7 @@ static int isDisabled(ModifierData *md, int UNUSED(useRenderParams))
 	flag = smd->flag & (MOD_SMOOTH_X|MOD_SMOOTH_Y|MOD_SMOOTH_Z);
 
 	/* disable if modifier is off for X, Y and Z or if factor is 0 */
-	if((smd->fac == 0.0f) || flag == 0) return 1;
+	if ((smd->fac == 0.0f) || flag == 0) return 1;
 
 	return 0;
 }
@@ -89,7 +89,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
 	CustomDataMask dataMask = 0;
 
 	/* ask for vertexgroups if we need them */
-	if(smd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+	if (smd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
 
 	return dataMask;
 }
@@ -124,7 +124,7 @@ static void smoothModifier_do(
 	modifier_get_vgroup(ob, dm, smd->defgrp_name, &dvert, &defgrp_index);
 
 	/* NOTICE: this can be optimized a little bit by moving the
-	* if (dvert) out of the loop, if needed */
+	 * if (dvert) out of the loop, if needed */
 	for (j = 0; j < smd->repeat; j++) {
 		for (i = 0; i < numDMEdges; i++) {
 			float fvec[3];
@@ -221,12 +221,12 @@ static void deformVerts(
 	smoothModifier_do((SmoothModifierData *)md, ob, dm,
 	                  vertexCos, numVerts);
 
-	if(dm != derivedData)
+	if (dm != derivedData)
 		dm->release(dm);
 }
 
 static void deformVertsEM(
-					 ModifierData *md, Object *ob, struct EditMesh *editData,
+					 ModifierData *md, Object *ob, struct BMEditMesh *editData,
 	  DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
 {
 	DerivedMesh *dm= get_dm(ob, editData, derivedData, NULL, 0);
@@ -234,7 +234,7 @@ static void deformVertsEM(
 	smoothModifier_do((SmoothModifierData *)md, ob, dm,
 	                  vertexCos, numVerts);
 
-	if(dm != derivedData)
+	if (dm != derivedData)
 		dm->release(dm);
 }
 
diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c
index d16fa0c..d3e5465 100644
--- a/source/blender/modifiers/intern/MOD_solidify.c
+++ b/source/blender/modifiers/intern/MOD_solidify.c
@@ -35,13 +35,14 @@
 
 #include "DNA_meshdata_types.h"
 
+#include "MEM_guardedalloc.h"
+
+#include "BLI_utildefines.h"
 #include "BLI_math.h"
 #include "BLI_edgehash.h"
-#include "BLI_utildefines.h"
+#include "BLI_array.h"
 #include "BLI_string.h"
 
-#include "MEM_guardedalloc.h"
-
 #include "BKE_cdderivedmesh.h"
 #include "BKE_mesh.h"
 #include "BKE_particle.h"
@@ -59,7 +60,8 @@ typedef struct EdgeFaceRef {
 static void dm_calc_normal(DerivedMesh *dm, float (*temp_nors)[3])
 {
 	int i, numVerts, numEdges, numFaces;
-	MFace *mface, *mf;
+	MPoly *mpoly, *mp;
+	MLoop *mloop, *ml;
 	MVert *mvert, *mv;
 
 	float (*face_nors)[3];
@@ -68,26 +70,27 @@ static void dm_calc_normal(DerivedMesh *dm, float (*temp_nors)[3])
 
 	numVerts = dm->getNumVerts(dm);
 	numEdges = dm->getNumEdges(dm);
-	numFaces = dm->getNumFaces(dm);
-	mface = dm->getFaceArray(dm);
+	numFaces = dm->getNumPolys(dm);
+	mpoly = dm->getPolyArray(dm);
 	mvert = dm->getVertArray(dm);
-
+	mloop = dm->getLoopArray(dm);
+	
 	/* we don't want to overwrite any referenced layers */
 
-	/*
-	Doesn't work here!
+	/* Doesn't work here! */
+#if 0
 	mv = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT, numVerts);
 	cddm->mvert = mv;
-	*/
+#endif
 
-	face_nors = CustomData_get_layer(&dm->faceData, CD_NORMAL);
-	if(!face_nors) {
+	face_nors = CustomData_get_layer(&dm->polyData, CD_NORMAL);
+	if (!face_nors) {
 		calc_face_nors = 1;
-		face_nors = CustomData_add_layer(&dm->faceData, CD_NORMAL, CD_CALLOC, NULL, numFaces);
+		face_nors = CustomData_add_layer(&dm->polyData, CD_NORMAL, CD_CALLOC, NULL, numFaces);
 	}
 
 	mv = mvert;
-	mf = mface;
+	mp = mpoly;
 
 	{
 		EdgeHash *edge_hash = BLI_edgehash_new();
@@ -116,28 +119,20 @@ static void dm_calc_normal(DerivedMesh *dm, float (*temp_nors)[3])
 			}
 		/* --- end define --- */
 
-		for(i = 0; i < numFaces; i++, mf++) {
+		for (i = 0; i < numFaces; i++, mp++) {
+			int j;
+			
 			f_no = face_nors[i];
+			if (calc_face_nors)
+				mesh_calc_poly_normal(mp, mloop+mp->loopstart, mvert, f_no);
 
-			if(mf->v4) {
-				if(calc_face_nors)
-					normal_quad_v3(f_no, mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co, mv[mf->v4].co);
-
-				NOCALC_EDGEWEIGHT_ADD_EDGEREF_FACE(mf->v1, mf->v2);
-				NOCALC_EDGEWEIGHT_ADD_EDGEREF_FACE(mf->v2, mf->v3);
-				NOCALC_EDGEWEIGHT_ADD_EDGEREF_FACE(mf->v3, mf->v4);
-				NOCALC_EDGEWEIGHT_ADD_EDGEREF_FACE(mf->v4, mf->v1);
-			} else {
-				if(calc_face_nors)
-					normal_tri_v3(f_no, mv[mf->v1].co, mv[mf->v2].co, mv[mf->v3].co);
-
-				NOCALC_EDGEWEIGHT_ADD_EDGEREF_FACE(mf->v1, mf->v2);
-				NOCALC_EDGEWEIGHT_ADD_EDGEREF_FACE(mf->v2, mf->v3);
-				NOCALC_EDGEWEIGHT_ADD_EDGEREF_FACE(mf->v3, mf->v1);
+			ml = mloop + mp->loopstart;
+			for (j=0; j<mp->totloop; j++, ml++) {
+				NOCALC_EDGEWEIGHT_ADD_EDGEREF_FACE(ml->v, ME_POLY_LOOP_NEXT(mloop, mp, j)->v);
 			}
 		}
 
-		for(edge_iter = BLI_edgehashIterator_new(edge_hash); !BLI_edgehashIterator_isDone(edge_iter); BLI_edgehashIterator_step(edge_iter)) {
+		for (edge_iter = BLI_edgehashIterator_new(edge_hash); !BLI_edgehashIterator_isDone(edge_iter); BLI_edgehashIterator_step(edge_iter)) {
 			/* Get the edge vert indices, and edge value (the face indices that use it)*/
 			BLI_edgehashIterator_getKey(edge_iter, &ed_v1, &ed_v2);
 			edge_ref = BLI_edgehashIterator_getValue(edge_iter);
@@ -148,7 +143,8 @@ static void dm_calc_normal(DerivedMesh *dm, float (*temp_nors)[3])
 				add_v3_v3v3(edge_normal, face_nors[edge_ref->f1], face_nors[edge_ref->f2]);
 				normalize_v3(edge_normal);
 				mul_v3_fl(edge_normal, angle_normalized_v3v3(face_nors[edge_ref->f1], face_nors[edge_ref->f2]));
-			} else {
+			}
+			else {
 				/* only one face attached to that edge */
 				/* an edge without another attached- the weight on this is
 				 * undefined, M_PI/2 is 90d in radians and that seems good enough */
@@ -163,8 +159,8 @@ static void dm_calc_normal(DerivedMesh *dm, float (*temp_nors)[3])
 	}
 
 	/* normalize vertex normals and assign */
-	for(i = 0; i < numVerts; i++, mv++) {
-		if(normalize_v3(temp_nors[i]) == 0.0f) {
+	for (i = 0; i < numVerts; i++, mv++) {
+		if (normalize_v3(temp_nors[i]) == 0.0f) {
 			normal_short_to_float_v3(temp_nors[i], mv->no);
 		}
 	}
@@ -197,7 +193,7 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
 	CustomDataMask dataMask = 0;
 
 	/* ask for vertexgroups if we need them */
-	if(smd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
+	if (smd->defgrp_name[0]) dataMask |= CD_MASK_MDEFORMVERT;
 
 	return dataMask;
 }
@@ -212,14 +208,16 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 	DerivedMesh *result;
 	const SolidifyModifierData *smd = (SolidifyModifierData*) md;
 
-	MFace *mf, *mface, *orig_mface;
-	MEdge *ed, *medge, *orig_medge;
 	MVert *mv, *mvert, *orig_mvert;
-
+	MEdge *ed, *medge, *orig_medge;
+	MLoop *ml, *mloop, *orig_mloop;
+	MPoly *mp, *mpoly, *orig_mpoly;
 	const int numVerts = dm->getNumVerts(dm);
 	const int numEdges = dm->getNumEdges(dm);
-	const int numFaces = dm->getNumFaces(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;
 	const short mat_ofs= mat_nr_max ? smd->mat_ofs : 0;
@@ -227,16 +225,19 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 
 	/* use for edges */
 	int *new_vert_arr= NULL;
-	int newFaces = 0;
-
+	BLI_array_declare(new_vert_arr);
 	int *new_edge_arr= NULL;
-	int newEdges = 0;
+	BLI_array_declare(new_edge_arr);
+	int *old_vert_arr = MEM_callocN(sizeof(int)*numVerts, "old_vert_arr in solidify");
 
 	int *edge_users= NULL;
 	char *edge_order= NULL;
-
+	int *edge_origIndex;
+	
 	float (*vert_nors)[3]= NULL;
 
+	float (*face_nors_result)[3] = NULL;
+
 	const float ofs_orig=				- (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset);
 	const float ofs_new= smd->offset	- (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset);
 	const float offset_fac_vg= smd->offset_fac_vg;
@@ -249,21 +250,25 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 
 	modifier_get_vgroup(ob, dm, smd->defgrp_name, &dvert, &defgrp_index);
 
-	orig_mface = dm->getFaceArray(dm);
-	orig_medge = dm->getEdgeArray(dm);
+	numLoops = dm->numLoopData;
+	newLoops = 0;
+	
 	orig_mvert = dm->getVertArray(dm);
+	orig_medge = dm->getEdgeArray(dm);
+	orig_mloop = dm->getLoopArray(dm);
+	orig_mpoly = dm->getPolyArray(dm);
 
-	if(smd->flag & MOD_SOLIDIFY_RIM) {
+	if (smd->flag & MOD_SOLIDIFY_RIM) {
 		EdgeHash *edgehash = BLI_edgehash_new();
 		EdgeHashIterator *ehi;
 		unsigned int v1, v2;
 		int eidx;
 
-		for(i=0, mv=orig_mvert; i<numVerts; i++, mv++) {
+		for (i=0, mv=orig_mvert; i<numVerts; i++, mv++) {
 			mv->flag &= ~ME_VERT_TMP_TAG;
 		}
 
-		for(i=0, ed=orig_medge; i<numEdges; i++, ed++) {
+		for (i=0, ed=orig_medge; i<numEdges; i++, ed++) {
 			BLI_edgehash_insert(edgehash, ed->v1, ed->v2, SET_INT_IN_POINTER(i));
 		}
 
@@ -275,7 +280,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 			const unsigned int ml_v1 = _v1; \
 			const unsigned int ml_v2 = _v2; \
 			eidx= GET_INT_FROM_POINTER(BLI_edgehash_lookup(edgehash, ml_v1, ml_v2)); \
-			if(edge_users[eidx] == INVALID_UNUSED) { \
+			if (edge_users[eidx] == INVALID_UNUSED) { \
 				ed= orig_medge + eidx; \
 				edge_users[eidx] = (ml_v1 < ml_v2) == (ed->v1 < ed->v2) ? i : (i + numFaces); \
 				edge_order[eidx] = edge_ord; \
@@ -288,48 +293,38 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 
 		edge_users= MEM_mallocN(sizeof(int) * numEdges, "solid_mod edges");
 		edge_order= MEM_mallocN(sizeof(char) * numEdges, "solid_mod eorder");
-		memset(edge_users, INVALID_UNUSED, sizeof(int) * numEdges);
-
-		for(i=0, mf=orig_mface; i<numFaces; i++, mf++) {
-			if(mf->v4) {
-				ADD_EDGE_USER(mf->v1, mf->v2, 0);
-				ADD_EDGE_USER(mf->v2, mf->v3, 1);
-				ADD_EDGE_USER(mf->v3, mf->v4, 2);
-				ADD_EDGE_USER(mf->v4, mf->v1, 3);
-			}
-			else {
-				ADD_EDGE_USER(mf->v1, mf->v2, 0);
-				ADD_EDGE_USER(mf->v2, mf->v3, 1);
-				ADD_EDGE_USER(mf->v3, mf->v1, 2);
-			}
+		fill_vn_i(edge_users, numEdges, INVALID_UNUSED);
+		
+		for (i=0, mp=orig_mpoly; i<numFaces; i++, mp++) {
+			MLoop *ml;
+			
+			for (ml=orig_mloop + mp->loopstart, j=0; j<mp->totloop; ml++, j++) {
+				ADD_EDGE_USER(ml->v, ME_POLY_LOOP_NEXT(orig_mloop, mp, j)->v, j);
+			}	
 		}
 
 #undef ADD_EDGE_USER
 #undef INVALID_UNUSED
 #undef INVALID_PAIR
 
-
-		new_edge_arr= MEM_callocN(sizeof(int) * numEdges, "solid_mod arr");
-
 		ehi= BLI_edgehashIterator_new(edgehash);
-		for(; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
+		for (; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
 			eidx= GET_INT_FROM_POINTER(BLI_edgehashIterator_getValue(ehi));
-			if(edge_users[eidx] >= 0) {
+			if (edge_users[eidx] >= 0) {
 				BLI_edgehashIterator_getKey(ehi, &v1, &v2);
 				orig_mvert[v1].flag |= ME_VERT_TMP_TAG;
 				orig_mvert[v2].flag |= ME_VERT_TMP_TAG;
-				new_edge_arr[newFaces]= eidx;
+				BLI_array_append(new_edge_arr, eidx);
 				newFaces++;
+				newLoops += 4;
 			}
 		}
 		BLI_edgehashIterator_free(ehi);
 
-
-
-		new_vert_arr= MEM_callocN(sizeof(int) * numVerts, "solid_mod new_varr");
-		for(i=0, mv=orig_mvert; i<numVerts; i++, mv++) {
-			if(mv->flag & ME_VERT_TMP_TAG) {
-				new_vert_arr[newEdges] = i;
+		for (i=0, mv=orig_mvert; i<numVerts; i++, mv++) {
+			if (mv->flag & ME_VERT_TMP_TAG) {
+				old_vert_arr[i] = BLI_array_count(new_vert_arr);
+				BLI_array_append(new_vert_arr, i);
 				newEdges++;
 
 				mv->flag &= ~ME_VERT_TMP_TAG;
@@ -339,19 +334,17 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		BLI_edgehash_free(edgehash, NULL);
 	}
 
-	if(smd->flag & MOD_SOLIDIFY_NORMAL_CALC) {
+	if (smd->flag & MOD_SOLIDIFY_NORMAL_CALC) {
 		vert_nors= MEM_callocN(sizeof(float) * numVerts * 3, "mod_solid_vno_hq");
 		dm_calc_normal(dm, vert_nors);
 	}
 
-	result = CDDM_from_template(dm, numVerts * 2, (numEdges * 2) + newEdges, (numFaces * 2) + newFaces);	
+	result = CDDM_from_template(dm, numVerts * 2, (numEdges * 2) + newEdges, 0, (numLoops*2) + newLoops, (numFaces * 2) + newFaces);
 
-	mface = result->getFaceArray(result);
-	medge = result->getEdgeArray(result);
-	mvert = result->getVertArray(result);
-
-	DM_copy_face_data(dm, result, 0, 0, numFaces);
-	DM_copy_face_data(dm, result, 0, numFaces, numFaces);
+	mpoly = CDDM_get_polys(result);
+	mloop = CDDM_get_loops(result);
+	medge = CDDM_get_edges(result);
+	mvert = CDDM_get_verts(result);
 
 	DM_copy_edge_data(dm, result, 0, 0, numEdges);
 	DM_copy_edge_data(dm, result, 0, numEdges, numEdges);
@@ -359,51 +352,69 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 	DM_copy_vert_data(dm, result, 0, 0, numVerts);
 	DM_copy_vert_data(dm, result, 0, numVerts, numVerts);
 
-	{
-		static int corner_indices[4] = {2, 1, 0, 3};
-		unsigned int is_quad;
-
-		for(i=0, mf=mface+numFaces; i<numFaces; i++, mf++) {
-			mf->v1 += numVerts;
-			mf->v2 += numVerts;
-			mf->v3 += numVerts;
-			if(mf->v4)
-				mf->v4 += numVerts;
-
-			/* Flip face normal */
-			{
-				is_quad = mf->v4;
-				SWAP(unsigned int, mf->v1, mf->v3);
-				DM_swap_face_data(result, i+numFaces, corner_indices);
-				test_index_face(mf, &result->faceData, numFaces, is_quad ? 4:3);
-			}
+	DM_copy_loop_data(dm, result, 0, 0, numLoops);
+	DM_copy_loop_data(dm, result, 0, numLoops, numLoops);
 
-			if(mat_ofs) {
-				mf->mat_nr += mat_ofs;
-				CLAMP(mf->mat_nr, 0, mat_nr_max);
-			}
+	DM_copy_poly_data(dm, result, 0, 0, numFaces);
+	DM_copy_poly_data(dm, result, 0, numFaces, numFaces);
+
+	/* if the original has it, get the result so we can update it */
+	face_nors_result = CustomData_get_layer(&result->polyData, CD_NORMAL);
+
+	/*flip normals*/
+	mp = mpoly + numFaces;
+	for (i=0; i<dm->numPolyData; i++, mp++) {
+		MLoop *ml2;
+		int e;
+
+		ml2 = mloop + mp->loopstart + dm->numLoopData;
+		for (j=0; j<mp->totloop; j++) {
+			CustomData_copy_data(&dm->loopData, &result->loopData, mp->loopstart+j, 
+			                     mp->loopstart+(mp->totloop-j-1)+dm->numLoopData, 1);
+		}
+
+		if (mat_ofs) {
+			mp->mat_nr += mat_ofs;
+			CLAMP(mp->mat_nr, 0, mat_nr_max);
+		}
+
+		e = ml2[0].e;
+		for (j=0; j<mp->totloop-1; j++) {
+			ml2[j].e = ml2[j+1].e;
+		}
+		ml2[mp->totloop-1].e = e;
+		
+		mp->loopstart += dm->numLoopData;
+		
+		for (j=0; j<mp->totloop; j++) {
+			ml2[j].e += numEdges;
+			ml2[j].v += numVerts;
+		}
+
+		if (face_nors_result) {
+			negate_v3_v3(face_nors_result[numFaces + i], face_nors_result[i]);
 		}
 	}
 
-	for(i=0, ed=medge+numEdges; i<numEdges; i++, ed++) {
+	for (i=0, ed=medge+numEdges; i<numEdges; i++, ed++) {
 		ed->v1 += numVerts;
 		ed->v2 += numVerts;
 	}
 
-	/* note, copied vertex layers dont have flipped normals yet. do this after applying offset */
-	if((smd->flag & MOD_SOLIDIFY_EVEN) == 0) {
+	/* note, copied vertex layers don't have flipped normals yet. do this after applying offset */
+	if ((smd->flag & MOD_SOLIDIFY_EVEN) == 0) {
 		/* no even thickness, very simple */
 		float scalar_short;
 		float scalar_short_vgroup;
 
 
-		if(ofs_new != 0.0f) {
+		if (ofs_new != 0.0f) {
 			scalar_short= scalar_short_vgroup= ofs_new / 32767.0f;
 			mv= mvert + ((ofs_new >= ofs_orig) ? 0 : numVerts);
 			dv= dvert;
-			for(i=0; i<numVerts; i++, mv++) {
-				if(dv) {
-					if(defgrp_invert)	scalar_short_vgroup = 1.0f - defvert_find_weight(dv, defgrp_index);
+			for (i=0; i<numVerts; i++, mv++) {
+				if (dv) {
+					if (defgrp_invert)	scalar_short_vgroup = 1.0f - defvert_find_weight(dv, defgrp_index);
 					else				scalar_short_vgroup = defvert_find_weight(dv, defgrp_index);
 					scalar_short_vgroup= (offset_fac_vg + (scalar_short_vgroup * offset_fac_vg_inv)) * scalar_short;
 					dv++;
@@ -412,13 +423,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 			}
 		}
 
-		if(ofs_orig != 0.0f) {
+		if (ofs_orig != 0.0f) {
 			scalar_short= scalar_short_vgroup= ofs_orig / 32767.0f;
 			mv= mvert + ((ofs_new >= ofs_orig) ? numVerts : 0); /* same as above but swapped, intentional use of 'ofs_new' */
 			dv= dvert;
-			for(i=0; i<numVerts; i++, mv++) {
-				if(dv) {
-					if(defgrp_invert)	scalar_short_vgroup = 1.0f - defvert_find_weight(dv, defgrp_index);
+			for (i=0; i<numVerts; i++, mv++) {
+				if (dv) {
+					if (defgrp_invert)	scalar_short_vgroup = 1.0f - defvert_find_weight(dv, defgrp_index);
 					else				scalar_short_vgroup = defvert_find_weight(dv, defgrp_index);
 					scalar_short_vgroup= (offset_fac_vg + (scalar_short_vgroup * offset_fac_vg_inv)) * scalar_short;
 					dv++;
@@ -436,62 +447,64 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		/* same as EM_solidify() in editmesh_lib.c */
 		float *vert_angles= MEM_callocN(sizeof(float) * numVerts * 2, "mod_solid_pair"); /* 2 in 1 */
 		float *vert_accum= vert_angles + numVerts;
-		float face_angles[4];
+		float *face_angles = NULL;
+		BLI_array_staticdeclare(face_angles, 16); /* BM_NGON_STACK_SIZE */
 		int j, vidx;
 
-		face_nors = CustomData_get_layer(&dm->faceData, CD_NORMAL);
-		if(!face_nors) {
-			face_nors = CustomData_add_layer(&dm->faceData, CD_NORMAL, CD_CALLOC, NULL, dm->numFaceData);
+		face_nors = CustomData_get_layer(&dm->polyData, CD_NORMAL);
+		if (!face_nors) {
+			face_nors = CustomData_add_layer(&dm->polyData, CD_NORMAL, CD_CALLOC, NULL, dm->numPolyData);
 			face_nors_calc= 1;
 		}
 
-		if(vert_nors==NULL) {
+		if (vert_nors==NULL) {
 			vert_nors= MEM_mallocN(sizeof(float) * numVerts * 3, "mod_solid_vno");
-			for(i=0, mv=mvert; i<numVerts; i++, mv++) {
+			for (i=0, mv=mvert; i<numVerts; i++, mv++) {
 				normal_short_to_float_v3(vert_nors[i], mv->no);
 			}
 		}
 
-		for(i=0, mf=mface; i<numFaces; i++, mf++) {
-
+		for (i=0, mp=mpoly; i<numFaces; i++, mp++) {
+			if (face_nors_calc)
+				mesh_calc_poly_normal(mp, &mloop[mp->loopstart], mvert, face_nors[i]);
+			
 			/* just added, calc the normal */
-			if(face_nors_calc) {
-				if(mf->v4)
-					normal_quad_v3(face_nors[i], mvert[mf->v1].co, mvert[mf->v2].co, mvert[mf->v3].co, mvert[mf->v4].co);
-				else
-					normal_tri_v3(face_nors[i] , mvert[mf->v1].co, mvert[mf->v2].co, mvert[mf->v3].co);
-			}
-
-			if(mf->v4) {
-				angle_quad_v3(face_angles, mvert[mf->v1].co, mvert[mf->v2].co, mvert[mf->v3].co, mvert[mf->v4].co);
-				j= 3;
+			BLI_array_empty(face_angles);
+			for (j=0, ml=mloop+mp->loopstart; j<mp->totloop; j++, ml++) {
+				MLoop *ml_prev = ME_POLY_LOOP_PREV(mloop, mp, j);
+				MLoop *ml_next = ME_POLY_LOOP_NEXT(mloop, mp, j);
+
+				float e1[3], e2[3], angle;
+				
+				sub_v3_v3v3(e1, mvert[ml_next->v].co, mvert[ml->v].co);
+				sub_v3_v3v3(e2, mvert[ml_prev->v].co, mvert[ml->v].co);
+				angle = M_PI - angle_normalized_v3v3(e1, e2);
+				BLI_array_append(face_angles, angle);
 			}
-			else {
-				angle_tri_v3(face_angles, mvert[mf->v1].co, mvert[mf->v2].co, mvert[mf->v3].co);
-				j= 2;
-			}
-
-			do {
-				vidx = *(&mf->v1 + j);
+			
+			for (j=0, ml=mloop+mp->loopstart; j<mp->totloop; j++, ml++) {
+				vidx = ml->v;
 				vert_accum[vidx] += face_angles[j];
 				vert_angles[vidx]+= shell_angle_to_dist(angle_normalized_v3v3(vert_nors[vidx], face_nors[i])) * face_angles[j];
-			} while(j--);
+			}
 		}
+	
+		BLI_array_free(face_angles);
 
 		/* vertex group support */
-		if(dvert) {
+		if (dvert) {
 			float scalar;
 
 			dv= dvert;
-			if(defgrp_invert) {
-				for(i=0; i<numVerts; i++, dv++) {
+			if (defgrp_invert) {
+				for (i=0; i<numVerts; i++, dv++) {
 					scalar= 1.0f - defvert_find_weight(dv, defgrp_index);
 					scalar= offset_fac_vg + (scalar * offset_fac_vg_inv);
 					vert_angles[i] *= scalar;
 				}
 			}
 			else {
-				for(i=0; i<numVerts; i++, dv++) {
+				for (i=0; i<numVerts; i++, dv++) {
 					scalar= defvert_find_weight(dv, defgrp_index);
 					scalar= offset_fac_vg + (scalar * offset_fac_vg_inv);
 					vert_angles[i] *= scalar;
@@ -499,21 +512,21 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 			}
 		}
 
-		if(ofs_new) {
+		if (ofs_new) {
 			mv= mvert + ((ofs_new >= ofs_orig) ? 0 : numVerts);
 
-			for(i=0; i<numVerts; i++, mv++) {
-				if(vert_accum[i]) { /* zero if unselected */
+			for (i=0; i<numVerts; i++, mv++) {
+				if (vert_accum[i]) { /* zero if unselected */
 					madd_v3_v3fl(mv->co, vert_nors[i], ofs_new * (vert_angles[i] / vert_accum[i]));
 				}
 			}
 		}
 
-		if(ofs_orig) {
+		if (ofs_orig) {
 			mv= mvert + ((ofs_new >= ofs_orig) ? numVerts : 0); /* same as above but swapped, intentional use of 'ofs_new' */
 
-			for(i=0; i<numVerts; i++, mv++) {
-				if(vert_accum[i]) { /* zero if unselected */
+			for (i=0; i<numVerts; i++, mv++) {
+				if (vert_accum[i]) { /* zero if unselected */
 					madd_v3_v3fl(mv->co, vert_nors[i], ofs_orig * (vert_angles[i] / vert_accum[i]));
 				}
 			}
@@ -522,18 +535,18 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		MEM_freeN(vert_angles);
 	}
 
-	if(vert_nors)
+	if (vert_nors)
 		MEM_freeN(vert_nors);
 
 	/* flip vertex normals for copied verts */
 	mv= mvert + numVerts;
-	for(i=0; i<numVerts; i++, mv++) {
+	for (i=0; i<numVerts; i++, mv++) {
 		mv->no[0]= -mv->no[0];
 		mv->no[1]= -mv->no[1];
 		mv->no[2]= -mv->no[2];
 	}
 
-	if(smd->flag & MOD_SOLIDIFY_RIM) {
+	if (smd->flag & MOD_SOLIDIFY_RIM) {
 		int *origindex;
 		
 		/* bugger, need to re-calculate the normals for the new edge faces.
@@ -554,43 +567,33 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		const unsigned char crease_outer= smd->crease_outer * 255.0f;
 		const unsigned char crease_inner= smd->crease_inner * 255.0f;
 
-		const int edge_indices[2][4][4] = {
-		        /* quad */
-		       {{1, 0, 0, 1},
-		        {2, 1, 1, 2},
-		        {3, 2, 2, 3},
-		        {0, 3, 3, 0}},
-		        /* tri */
-		       {{1, 0, 0, 1},
-		        {2, 1, 1, 2},
-		        {0, 2, 2, 0},
-		        {0, 0, 0, 0}} /* unused for tris */
-		        };
-
 		/* add faces & edges */
 		origindex= result->getEdgeDataArray(result, CD_ORIGINDEX);
 		ed= medge + (numEdges * 2);
-		for(i=0; i<newEdges; i++, ed++) {
+		for (i=0; i<newEdges; i++, ed++) {
 			ed->v1= new_vert_arr[i];
 			ed->v2= new_vert_arr[i] + numVerts;
 			ed->flag |= ME_EDGEDRAW;
 
 			origindex[numEdges * 2 + i]= ORIGINDEX_NONE;
 
-			if(crease_rim)
+			if (crease_rim)
 				ed->crease= crease_rim;
 		}
 
 		/* faces */
-		mf= mface + (numFaces * 2);
-
-		for(i=0; i<newFaces; i++, mf++) {
+		edge_origIndex = origindex;
+		origindex = DM_get_poly_data_layer(result, CD_ORIGINDEX);
+		
+		mp = mpoly + (numFaces * 2);
+		ml = mloop + (numLoops * 2);
+		j = 0;
+		for (i=0; i<newFaces; i++, mp++) {
 			int eidx= new_edge_arr[i];
 			int fidx= edge_users[eidx];
-			int flip;
-			int is_tri;
+			int flip, k1, k2;
 
-			if(fidx >= numFaces) {
+			if (fidx >= numFaces) {
 				fidx -= numFaces;
 				flip= 1;
 			}
@@ -601,40 +604,68 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 			ed= medge + eidx;
 
 			/* copy most of the face settings */
-			DM_copy_face_data(dm, result, fidx, (numFaces * 2) + i, 1);
-
-			is_tri = (orig_mface[fidx].v4 == 0);
-
-			if(flip) {
-				DM_swap_face_data(result, (numFaces * 2) + i, edge_indices[is_tri][edge_order[eidx]]);
-
-				mf->v1= ed->v1;
-				mf->v2= ed->v2;
-				mf->v3= ed->v2 + numVerts;
-				mf->v4= ed->v1 + numVerts;
+			DM_copy_poly_data(dm, result, fidx, (numFaces * 2) + i, 1);
+			mp->loopstart = j+numLoops*2;
+			mp->flag = mpoly[fidx].flag;
+
+			/* notice we use 'mp->totloop' which is later overwritten,
+			 * we could lookup the original face but theres no point since this is a copy
+			 * and will have the same value, just take care when changing order of assignment */
+			k1 = mpoly[fidx].loopstart + ((edge_order[eidx] + 1) % mp->totloop);
+			k2 = mpoly[fidx].loopstart +  (edge_order[eidx]);
+
+			mp->totloop = 4;
+
+			CustomData_copy_data(&dm->loopData, &result->loopData, k1, numLoops*2+j+0, 1);
+			CustomData_copy_data(&dm->loopData, &result->loopData, k2, numLoops*2+j+1, 1);
+			CustomData_copy_data(&dm->loopData, &result->loopData, k2, numLoops*2+j+2, 1);
+			CustomData_copy_data(&dm->loopData, &result->loopData, k1, numLoops*2+j+3, 1);
+
+			if (flip) {
+				ml[j].v = ed->v1;
+				ml[j++].e = eidx;
+				
+				ml[j].v = ed->v2;
+				ml[j++].e = numEdges*2 + old_vert_arr[ed->v2];
+				
+				ml[j].v = ed->v2+numVerts;
+				ml[j++].e = eidx+numEdges;
+				
+				ml[j].v = ed->v1+numVerts;
+				ml[j++].e = numEdges*2 + old_vert_arr[ed->v1];
 			}
 			else {
-				DM_swap_face_data(result, (numFaces * 2) + i, edge_indices[is_tri][edge_order[eidx]]);
+				ml[j].v = ed->v2;
+				ml[j++].e = eidx;
+
+				ml[j].v = ed->v1;
+				ml[j++].e = numEdges*2 + old_vert_arr[ed->v1];
+
+				ml[j].v = ed->v1+numVerts;
+				ml[j++].e = eidx+numEdges;
 
-				mf->v1= ed->v2;
-				mf->v2= ed->v1;
-				mf->v3= ed->v1 + numVerts;
-				mf->v4= ed->v2 + numVerts;
+				ml[j].v = ed->v2+numVerts;
+				ml[j++].e = numEdges*2 + old_vert_arr[ed->v2];
 			}
 			
+			if (edge_origIndex) {
+				edge_origIndex[ml[j-3].e] = ORIGINDEX_NONE;
+				edge_origIndex[ml[j-1].e] = ORIGINDEX_NONE;
+			}
+
 			/* use the next material index if option enabled */
-			if(mat_ofs_rim) {
-				mf->mat_nr += mat_ofs_rim;
-				CLAMP(mf->mat_nr, 0, mat_nr_max);
+			if (mat_ofs_rim) {
+				mp->mat_nr += mat_ofs_rim;
+				CLAMP(mp->mat_nr, 0, mat_nr_max);
 			}
-			if(crease_outer) {
+			if (crease_outer) {
 				/* crease += crease_outer; without wrapping */
 				unsigned char *cr= (unsigned char *)&(ed->crease);
 				int tcr= *cr + crease_outer;
 				*cr= tcr > 255 ? 255 : tcr;
 			}
 
-			if(crease_inner) {
+			if (crease_inner) {
 				/* crease += crease_inner; without wrapping */
 				unsigned char *cr= (unsigned char *)&(medge[numEdges + eidx].crease);
 				int tcr= *cr + crease_inner;
@@ -642,16 +673,20 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 			}
 			
 #ifdef SOLIDIFY_SIDE_NORMALS
-			normal_quad_v3(nor, mvert[mf->v1].co, mvert[mf->v2].co, mvert[mf->v3].co, mvert[mf->v4].co);
+			normal_quad_v3(nor, mvert[ml[j-4].v].co, mvert[ml[j-3].v].co, mvert[ml[j-2].v].co, mvert[ml[j-1].v].co);
 
 			add_v3_v3(edge_vert_nos[ed->v1], nor);
 			add_v3_v3(edge_vert_nos[ed->v2], nor);
+
+			if (face_nors_result) {
+				copy_v3_v3(face_nors_result[(numFaces * 2) + i], nor);
+			}
 #endif
 		}
 		
 #ifdef SOLIDIFY_SIDE_NORMALS
 		ed= medge + (numEdges * 2);
-		for(i=0; i<newEdges; i++, ed++) {
+		for (i=0; i<newEdges; i++, ed++) {
 			float nor_cpy[3];
 			short *nor_short;
 			int j;
@@ -659,7 +694,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 			/* 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 */
+			for (j=0; j<2; j++) { /* loop over both verts of the edge */
 				nor_short= mvert[*(&ed->v1 + j)].no;
 				normal_short_to_float_v3(nor, nor_short);
 				add_v3_v3(nor, nor_cpy);
@@ -671,14 +706,17 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 		MEM_freeN(edge_vert_nos);
 #endif
 
-		MEM_freeN(new_vert_arr);
-		MEM_freeN(new_edge_arr);
+		BLI_array_free(new_vert_arr);
+		BLI_array_free(new_edge_arr);
 		MEM_freeN(edge_users);
 		MEM_freeN(edge_order);
 	}
 
+	if (old_vert_arr)
+		MEM_freeN(old_vert_arr);
+	
 	/* must recalculate normals with vgroups since they can displace unevenly [#26888] */
-	if(dvert) {
+	if (dvert) {
 		CDDM_calc_normals(result);
 	}
 
@@ -689,7 +727,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 
 static DerivedMesh *applyModifierEM(ModifierData *md,
 							 Object *ob,
-							 struct EditMesh *UNUSED(editData),
+							 struct BMEditMesh *UNUSED(editData),
 							 DerivedMesh *derivedData)
 {
 	return applyModifier(md, ob, derivedData, 0, 1);
diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c
index d42c95a..be1ceee 100644
--- a/source/blender/modifiers/intern/MOD_subsurf.c
+++ b/source/blender/modifiers/intern/MOD_subsurf.c
@@ -73,10 +73,10 @@ static void freeData(ModifierData *md)
 {
 	SubsurfModifierData *smd = (SubsurfModifierData*) md;
 
-	if(smd->mCache) {
+	if (smd->mCache) {
 		ccgSubSurf_free(smd->mCache);
 	}
-	if(smd->emCache) {
+	if (smd->emCache) {
 		ccgSubSurf_free(smd->emCache);
 	}
 }
@@ -100,7 +100,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 	result = subsurf_make_derived_from_derived(derivedData, smd,
 			useRenderParams, NULL, isFinalCalc, 0, (ob->flag & OB_MODE_EDIT));
 	
-	if(useRenderParams || !isFinalCalc) {
+	if (useRenderParams || !isFinalCalc) {
 		DerivedMesh *cddm= CDDM_copy(result);
 		result->release(result);
 		result= cddm;
@@ -110,7 +110,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 }
 
 static DerivedMesh *applyModifierEM(ModifierData *md, Object *UNUSED(ob),
-						struct EditMesh *UNUSED(editData),
+						struct BMEditMesh *UNUSED(editData),
 						DerivedMesh *derivedData)
 {
 	SubsurfModifierData *smd = (SubsurfModifierData*) md;
diff --git a/source/blender/modifiers/intern/MOD_surface.c b/source/blender/modifiers/intern/MOD_surface.c
index 258627e..86e11ac 100644
--- a/source/blender/modifiers/intern/MOD_surface.c
+++ b/source/blender/modifiers/intern/MOD_surface.c
@@ -59,21 +59,20 @@ static void initData(ModifierData *md)
 static void freeData(ModifierData *md)
 {
 	SurfaceModifierData *surmd = (SurfaceModifierData*) md;
-	
-	if (surmd)
-	{
-		if(surmd->bvhtree) {
+
+	if (surmd) {
+		if (surmd->bvhtree) {
 			free_bvhtree_from_mesh(surmd->bvhtree);
 			MEM_freeN(surmd->bvhtree);
 		}
 
-		if(surmd->dm)
+		if (surmd->dm)
 			surmd->dm->release(surmd->dm);
 
-		if(surmd->x)
+		if (surmd->x)
 			MEM_freeN(surmd->x);
 		
-		if(surmd->v)
+		if (surmd->v)
 			MEM_freeN(surmd->v);
 
 		surmd->bvhtree = NULL;
@@ -95,21 +94,19 @@ static void deformVerts(ModifierData *md, Object *ob,
 {
 	SurfaceModifierData *surmd = (SurfaceModifierData*) md;
 	
-	if(surmd->dm)
+	if (surmd->dm)
 		surmd->dm->release(surmd->dm);
 
 	/* if possible use/create DerivedMesh */
-	if(derivedData) surmd->dm = CDDM_copy(derivedData);
+	if (derivedData) surmd->dm = CDDM_copy(derivedData);
 	else surmd->dm = get_dm(ob, NULL, NULL, NULL, 0);
 	
-	if(!ob->pd)
-	{
+	if (!ob->pd) {
 		printf("SurfaceModifier deformVerts: Should not happen!\n");
 		return;
 	}
-	
-	if(surmd->dm)
-	{
+
+	if (surmd->dm) {
 		unsigned int numverts = 0, i = 0;
 		int init = 0;
 		float *vec;
@@ -120,12 +117,12 @@ static void deformVerts(ModifierData *md, Object *ob,
 		
 		numverts = surmd->dm->getNumVerts ( surmd->dm );
 
-		if(numverts != surmd->numverts || surmd->x == NULL || surmd->v == NULL || md->scene->r.cfra != surmd->cfra+1) {
-			if(surmd->x) {
+		if (numverts != surmd->numverts || surmd->x == NULL || surmd->v == NULL || md->scene->r.cfra != surmd->cfra+1) {
+			if (surmd->x) {
 				MEM_freeN(surmd->x);
 				surmd->x = NULL;
 			}
-			if(surmd->v) {
+			if (surmd->v) {
 				MEM_freeN(surmd->v);
 				surmd->v = NULL;
 			}
@@ -139,11 +136,11 @@ static void deformVerts(ModifierData *md, Object *ob,
 		}
 
 		/* convert to global coordinates and calculate velocity */
-		for(i = 0, x = surmd->x, v = surmd->v; i<numverts; i++, x++, v++) {
+		for (i = 0, x = surmd->x, v = surmd->v; i<numverts; i++, x++, v++) {
 			vec = CDDM_get_vert(surmd->dm, i)->co;
 			mul_m4_v3(ob->obmat, vec);
 
-			if(init)
+			if (init)
 				v->co[0] = v->co[1] = v->co[2] = 0.0f;
 			else
 				sub_v3_v3v3(v->co, vec, x->co);
@@ -153,12 +150,12 @@ static void deformVerts(ModifierData *md, Object *ob,
 
 		surmd->cfra = md->scene->r.cfra;
 
-		if(surmd->bvhtree)
+		if (surmd->bvhtree)
 			free_bvhtree_from_mesh(surmd->bvhtree);
 		else
 			surmd->bvhtree = MEM_callocN(sizeof(BVHTreeFromMesh), "BVHTreeFromMesh");
 
-		if(surmd->dm->getNumFaces(surmd->dm))
+		if (surmd->dm->getNumTessFaces(surmd->dm))
 			bvhtree_from_mesh_faces(surmd->bvhtree, surmd->dm, 0.0, 2, 6);
 		else
 			bvhtree_from_mesh_edges(surmd->bvhtree, surmd->dm, 0.0, 2, 6);
diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c
index aa8f578..e134ff9 100644
--- a/source/blender/modifiers/intern/MOD_util.c
+++ b/source/blender/modifiers/intern/MOD_util.c
@@ -32,11 +32,13 @@
 
 #include <string.h>
 
+#include "DNA_curve_types.h"
+#include "DNA_image_types.h"
 #include "DNA_lattice_types.h"
+#include "DNA_meshdata_types.h"
 #include "DNA_modifier_types.h"
 #include "DNA_object_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_meshdata_types.h"
+#include "DNA_scene_types.h"
 
 #include "BLI_utildefines.h"
 #include "BLI_math_vector.h"
@@ -44,6 +46,7 @@
 
 #include "BKE_cdderivedmesh.h"
 #include "BKE_deform.h"
+#include "BKE_image.h"
 #include "BKE_lattice.h"
 #include "BKE_mesh.h"
 #include "BKE_displist.h"
@@ -57,6 +60,15 @@
 
 #include "RE_shader_ext.h"
 
+void modifier_init_texture(Scene *scene, Tex *tex)
+{
+	if (!tex)
+		return;
+
+	if (tex->ima && ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE))
+		BKE_image_user_calc_frame(&tex->iuser, scene->r.cfra, 0);
+}
+
 void get_texture_value(Tex *texture, float *tex_co, TexResult *texres)
 {
 	int result_type;
@@ -65,10 +77,10 @@ void get_texture_value(Tex *texture, float *tex_co, TexResult *texres)
 	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, so calculate one (formula from do_material_tex).
-	* if the texture didn't give an RGB value, copy the intensity across
-	*/
-	if(result_type & TEX_RGB)
+	 * intensity, so calculate one (formula from do_material_tex).
+	 * if the texture didn't give an RGB value, copy the intensity across
+	 */
+	if (result_type & TEX_RGB)
 		texres->tin = (0.35f * texres->tr + 0.45f * texres->tg
 				+ 0.2f * texres->tb);
 	else
@@ -84,38 +96,40 @@ void get_texture_coords(MappingInfoModifierData *dmd, Object *ob,
 	int texmapping = dmd->texmapping;
 	float mapob_imat[4][4];
 
-	if(texmapping == MOD_DISP_MAP_OBJECT) {
-		if(dmd->map_object)
+	if (texmapping == MOD_DISP_MAP_OBJECT) {
+		if (dmd->map_object)
 			invert_m4_m4(mapob_imat, dmd->map_object->obmat);
 		else /* if there is no map object, default to local */
 			texmapping = MOD_DISP_MAP_LOCAL;
 	}
 
 	/* UVs need special handling, since they come from faces */
-	if(texmapping == MOD_DISP_MAP_UV) {
-		if(CustomData_has_layer(&dm->faceData, CD_MTFACE)) {
-			MFace *mface = dm->getFaceArray(dm);
-			MFace *mf;
+	if (texmapping == MOD_DISP_MAP_UV) {
+		if (CustomData_has_layer(&dm->loopData, CD_MLOOPUV)) {
+			MPoly *mpoly = dm->getPolyArray(dm);
+			MPoly *mp;
+			MLoop *mloop = dm->getLoopArray(dm);
 			char *done = MEM_callocN(sizeof(*done) * numVerts,
 			                         "get_texture_coords done");
-			int numFaces = dm->getNumFaces(dm);
+			int numPolys = dm->getNumPolys(dm);
 			char uvname[MAX_CUSTOMDATA_LAYER_NAME];
-			MTFace *tf;
+			MLoopUV *mloop_uv;
 
-			CustomData_validate_layer_name(&dm->faceData, CD_MTFACE, dmd->uvlayer_name, uvname);
-			tf = CustomData_get_layer_named(&dm->faceData, CD_MTFACE, uvname);
+			CustomData_validate_layer_name(&dm->loopData, CD_MLOOPUV, dmd->uvlayer_name, uvname);
+			mloop_uv = CustomData_get_layer_named(&dm->loopData, CD_MLOOPUV, uvname);
 
 			/* verts are given the UV from the first face that uses them */
-			for(i = 0, mf = mface; i < numFaces; ++i, ++mf, ++tf) {
-				unsigned int fidx= mf->v4 ? 3:2;
+			for (i = 0, mp = mpoly; i < numPolys; ++i, ++mp) {
+				unsigned int fidx= mp->totloop - 1;
 
 				do {
-					unsigned int vidx = *(&mf->v1 + fidx);
+					unsigned int lidx= mp->loopstart + fidx;
+					unsigned int vidx= mloop[lidx].v;
 
 					if (done[vidx] == 0) {
 						/* remap UVs from [0, 1] to [-1, 1] */
-						texco[vidx][0] = (tf->uv[fidx][0] * 2.0f) - 1.0f;
-						texco[vidx][1] = (tf->uv[fidx][1] * 2.0f) - 1.0f;
+						texco[vidx][0] = (mloop_uv[lidx].uv[0] * 2.0f) - 1.0f;
+						texco[vidx][1] = (mloop_uv[lidx].uv[1] * 2.0f) - 1.0f;
 						done[vidx] = 1;
 					}
 
@@ -124,11 +138,12 @@ void get_texture_coords(MappingInfoModifierData *dmd, Object *ob,
 
 			MEM_freeN(done);
 			return;
-		} else /* if there are no UVs, default to local */
+		}
+		else /* if there are no UVs, default to local */
 			texmapping = MOD_DISP_MAP_LOCAL;
 	}
 
-	for(i = 0; i < numVerts; ++i, ++co, ++texco) {
+	for (i = 0; i < numVerts; ++i, ++co, ++texco) {
 		switch(texmapping) {
 		case MOD_DISP_MAP_LOCAL:
 			copy_v3_v3(*texco, *co);
@@ -146,9 +161,9 @@ void get_texture_coords(MappingInfoModifierData *dmd, Object *ob,
 
 void modifier_vgroup_cache(ModifierData *md, float (*vertexCos)[3])
 {
-	while((md=md->next) && md->type==eModifierType_Armature) {
+	while ((md=md->next) && md->type==eModifierType_Armature) {
 		ArmatureModifierData *amd = (ArmatureModifierData*) md;
-		if(amd->multi && amd->prevCos==NULL)
+		if (amd->multi && amd->prevCos==NULL)
 			amd->prevCos= MEM_dupallocN(vertexCos);
 		else
 			break;
@@ -157,12 +172,12 @@ void modifier_vgroup_cache(ModifierData *md, float (*vertexCos)[3])
 }
 
 /* returns a cdderivedmesh if dm == NULL or is another type of derivedmesh */
-DerivedMesh *get_cddm(Object *ob, struct EditMesh *em, DerivedMesh *dm, float (*vertexCos)[3])
+DerivedMesh *get_cddm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float (*vertexCos)[3])
 {
-	if(dm && dm->type == DM_TYPE_CDDM)
+	if (dm && dm->type == DM_TYPE_CDDM)
 		return dm;
 
-	if(!dm) {
+	if (!dm) {
 		dm= get_dm(ob, em, dm, vertexCos, 0);
 	}
 	else {
@@ -170,31 +185,31 @@ DerivedMesh *get_cddm(Object *ob, struct EditMesh *em, DerivedMesh *dm, float (*
 		CDDM_apply_vert_coords(dm, vertexCos);
 	}
 
-	if(dm)
+	if (dm)
 		CDDM_calc_normals(dm);
 	
 	return dm;
 }
 
 /* returns a derived mesh if dm == NULL, for deforming modifiers that need it */
-DerivedMesh *get_dm(Object *ob, struct EditMesh *em, DerivedMesh *dm, float (*vertexCos)[3], int orco)
+DerivedMesh *get_dm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float (*vertexCos)[3], int orco)
 {
-	if(dm)
+	if (dm)
 		return dm;
 
-	if(ob->type==OB_MESH) {
-		if(em) dm= CDDM_from_editmesh(em, ob->data);
+	if (ob->type==OB_MESH) {
+		if (em) dm= CDDM_from_BMEditMesh(em, ob->data, FALSE, FALSE);
 		else dm = CDDM_from_mesh((struct Mesh *)(ob->data), ob);
 
-		if(vertexCos) {
+		if (vertexCos) {
 			CDDM_apply_vert_coords(dm, vertexCos);
 			//CDDM_calc_normals(dm);
 		}
 		
-		if(orco)
+		if (orco)
 			DM_add_vert_layer(dm, CD_ORCO, CD_ASSIGN, get_mesh_orco_verts(ob));
 	}
-	else if(ELEM3(ob->type,OB_FONT,OB_CURVE,OB_SURF)) {
+	else if (ELEM3(ob->type,OB_FONT,OB_CURVE,OB_SURF)) {
 		dm= CDDM_from_curve(ob);
 	}
 
@@ -206,10 +221,10 @@ 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(ob->type == OB_LATTICE)
+	if (*defgrp_index >= 0) {
+		if (ob->type == OB_LATTICE)
 			*dvert = lattice_get_deform_verts(ob);
-		else if(dm)
+		else if (dm)
 			*dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
 	}
 }
diff --git a/source/blender/modifiers/intern/MOD_util.h b/source/blender/modifiers/intern/MOD_util.h
index 86909ef..eadf7af 100644
--- a/source/blender/modifiers/intern/MOD_util.h
+++ b/source/blender/modifiers/intern/MOD_util.h
@@ -25,15 +25,14 @@
  */
 
 
-#ifndef MOD_UTIL_H
-#define MOD_UTIL_H
+#ifndef __MOD_UTIL_H__
+#define __MOD_UTIL_H__
 
 /* so modifier types match their defines */
 #include "MOD_modifiertypes.h"
 
 struct CustomData;
 struct DerivedMesh;
-struct EditMesh;
 struct MDeformVert;
 struct ModifierData;
 struct Object;
@@ -41,11 +40,12 @@ struct Scene;
 struct Tex;
 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 modifier_vgroup_cache(struct ModifierData *md, float (*vertexCos)[3]);
-struct DerivedMesh *get_cddm(struct Object *ob, struct EditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3]);
-struct DerivedMesh *get_dm(struct Object *ob, struct EditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3], int orco);
+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 */
+#endif /* __MOD_UTIL_H__ */
diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c
index 77ce879..1b96c58 100644
--- a/source/blender/modifiers/intern/MOD_uvproject.c
+++ b/source/blender/modifiers/intern/MOD_uvproject.c
@@ -47,6 +47,7 @@
 
 
 #include "BKE_camera.h"
+#include "BKE_mesh.h"
 #include "BKE_DerivedMesh.h"
 
 #include "MOD_modifiertypes.h"
@@ -60,7 +61,7 @@ static void initData(ModifierData *md)
 	UVProjectModifierData *umd = (UVProjectModifierData*) md;
 	int i;
 
-	for(i = 0; i < MOD_UVPROJECT_MAXPROJECTORS; ++i)
+	for (i = 0; i < MOD_UVPROJECT_MAXPROJECTORS; ++i)
 		umd->projectors[i] = NULL;
 	umd->image = NULL;
 	umd->flags = 0;
@@ -75,7 +76,7 @@ static void copyData(ModifierData *md, ModifierData *target)
 	UVProjectModifierData *tumd = (UVProjectModifierData*) target;
 	int i;
 
-	for(i = 0; i < MOD_UVPROJECT_MAXPROJECTORS; ++i)
+	for (i = 0; i < MOD_UVPROJECT_MAXPROJECTORS; ++i)
 		tumd->projectors[i] = umd->projectors[i];
 	tumd->image = umd->image;
 	tumd->flags = umd->flags;
@@ -103,7 +104,7 @@ static void foreachObjectLink(ModifierData *md, Object *ob,
 	UVProjectModifierData *umd = (UVProjectModifierData*) md;
 	int i;
 
-	for(i = 0; i < MOD_UVPROJECT_MAXPROJECTORS; ++i)
+	for (i = 0; i < MOD_UVPROJECT_MAXPROJECTORS; ++i)
 		walk(userData, ob, &umd->projectors[i]);
 }
 
@@ -126,8 +127,8 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
 	UVProjectModifierData *umd = (UVProjectModifierData*) md;
 	int i;
 
-	for(i = 0; i < umd->num_projectors; ++i) {
-		if(umd->projectors[i]) {
+	for (i = 0; i < umd->num_projectors; ++i) {
+		if (umd->projectors[i]) {
 			DagNode *curNode = dag_get_node(forest, umd->projectors[i]);
 
 			dag_add_relation(forest, curNode, obNode,
@@ -147,10 +148,12 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
 					 Object *ob, DerivedMesh *dm)
 {
 	float (*coords)[3], (*co)[3];
-	MTFace *tface;
-	int i, numVerts, numFaces;
+	MLoopUV *mloop_uv;
+	MTexPoly *mtexpoly, *mt = NULL;
+	int i, numVerts, numPolys, numLoops;
 	Image *image = umd->image;
-	MFace *mface, *mf;
+	MPoly *mpoly, *mp;
+	MLoop *mloop;
 	int override_image = ((umd->flags & MOD_UVPROJECT_OVERRIDEIMAGE) != 0);
 	Projector projectors[MOD_UVPROJECT_MAXPROJECTORS];
 	int num_projectors = 0;
@@ -164,21 +167,21 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
 
 	aspect = aspx / aspy;
 
-	for(i = 0; i < umd->num_projectors; ++i)
-		if(umd->projectors[i])
+	for (i = 0; i < umd->num_projectors; ++i)
+		if (umd->projectors[i])
 			projectors[num_projectors++].ob = umd->projectors[i];
 
-	if(num_projectors == 0) return dm;
+	if (num_projectors == 0) return dm;
 
 	/* make sure there are UV Maps available */
 
-	if(!CustomData_has_layer(&dm->faceData, CD_MTFACE)) return dm;
+	if (!CustomData_has_layer(&dm->loopData, CD_MLOOPUV)) return dm;
 
 	/* make sure we're using an existing layer */
-	CustomData_validate_layer_name(&dm->faceData, CD_MTFACE, umd->uvlayer_name, uvname);
+	CustomData_validate_layer_name(&dm->loopData, CD_MLOOPUV, umd->uvlayer_name, uvname);
 
 	/* calculate a projection matrix and normal for each projector */
-	for(i = 0; i < num_projectors; ++i) {
+	for (i = 0; i < num_projectors; ++i) {
 		float tmpmat[4][4];
 		float offsetmat[4][4];
 		Camera *cam = NULL;
@@ -187,10 +190,10 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
 
 		projectors[i].uci= NULL;
 
-		if(projectors[i].ob->type == OB_CAMERA) {
+		if (projectors[i].ob->type == OB_CAMERA) {
 			
 			cam = (Camera *)projectors[i].ob->data;
-			if(cam->flag & CAM_PANORAMA) {
+			if (cam->flag & CAM_PANORAMA) {
 				projectors[i].uci= project_camera_info(projectors[i].ob, NULL, aspx, aspy);
 				project_camera_info_scale(projectors[i].uci, scax, scay);
 				free_uci= 1;
@@ -201,7 +204,7 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
 				float scale= (cam->type == CAM_PERSP) ? cam->clipsta * sensor / cam->lens : cam->ortho_scale;
 				float xmax, xmin, ymax, ymin;
 
-				if(sensor_fit==CAMERA_SENSOR_FIT_HOR) {
+				if (sensor_fit==CAMERA_SENSOR_FIT_HOR) {
 					xmax = 0.5f * scale;
 					ymax = xmax / aspect;
 				}
@@ -219,17 +222,19 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
 				ymin *= scay;
 				ymax *= scay;
 
-				if(cam->type == CAM_PERSP) {
+				if (cam->type == CAM_PERSP) {
 					float perspmat[4][4];
 					perspective_m4( perspmat,xmin, xmax, ymin, ymax, cam->clipsta, cam->clipend);
 					mult_m4_m4m4(tmpmat, perspmat, projectors[i].projmat);
-				} else { /* if(cam->type == CAM_ORTHO) */
+				}
+				else { /* if (cam->type == CAM_ORTHO) */
 					float orthomat[4][4];
 					orthographic_m4( orthomat,xmin, xmax, ymin, ymax, cam->clipsta, cam->clipend);
 					mult_m4_m4m4(tmpmat, orthomat, projectors[i].projmat);
 				}
 			}
-		} else {
+		}
+		else {
 			copy_m4_m4(tmpmat, projectors[i].projmat);
 		}
 
@@ -241,10 +246,12 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
 			if (aspx == aspy) { 
 				offsetmat[3][0] -= cam->shiftx;
 				offsetmat[3][1] -= cam->shifty;
-			} else if (aspx < aspy)  {
+			}
+			else if (aspx < aspy) {
 				offsetmat[3][0] -=(cam->shiftx * aspy/aspx);
 				offsetmat[3][1] -= cam->shifty;
-			} else {
+			}
+			else {
 				offsetmat[3][0] -= cam->shiftx;
 				offsetmat[3][1] -=(cam->shifty * aspx/aspy);
 			}
@@ -259,11 +266,16 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
 		mul_mat3_m4_v3(projectors[i].ob->obmat, projectors[i].normal);
 	}
 
-	numFaces = dm->getNumFaces(dm);
+	numPolys = dm->getNumPolys(dm);
+	numLoops = dm->getNumLoops(dm);
 
 	/* make sure we are not modifying the original UV map */
-	tface = CustomData_duplicate_referenced_layer_named(&dm->faceData,
-			CD_MTFACE, uvname, numFaces);
+	mloop_uv = CustomData_duplicate_referenced_layer_named(&dm->loopData,
+			CD_MLOOPUV, uvname, numLoops);
+
+	/* can be NULL */
+	mt = mtexpoly = CustomData_duplicate_referenced_layer_named(&dm->polyData,
+			CD_MTEXPOLY, uvname, numPolys);
 
 	numVerts = dm->getNumVerts(dm);
 
@@ -272,103 +284,107 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
 	dm->getVertCos(dm, coords);
 
 	/* convert coords to world space */
-	for(i = 0, co = coords; i < numVerts; ++i, ++co)
+	for (i = 0, co = coords; i < numVerts; ++i, ++co)
 		mul_m4_v3(ob->obmat, *co);
 	
 	/* if only one projector, project coords to UVs */
-	if(num_projectors == 1 && projectors[0].uci==NULL)
-		for(i = 0, co = coords; i < numVerts; ++i, ++co)
+	if (num_projectors == 1 && projectors[0].uci==NULL)
+		for (i = 0, co = coords; i < numVerts; ++i, ++co)
 			mul_project_m4_v3(projectors[0].projmat, *co);
 
-	mface = dm->getFaceArray(dm);
+	mpoly = dm->getPolyArray(dm);
+	mloop = dm->getLoopArray(dm);
 
 	/* apply coords as UVs, and apply image if tfaces are new */
-	for(i = 0, mf = mface; i < numFaces; ++i, ++mf, ++tface) {
-		if(override_image || !image || tface->tpage == image) {
-			if(num_projectors == 1) {
-				if(projectors[0].uci) {
-					unsigned int fidx= mf->v4 ? 3:2;
+	for (i = 0, mp = mpoly; i < numPolys; ++i, ++mp, ++mt) {
+		if (override_image || !image || (mtexpoly == NULL || mt->tpage == image)) {
+			if (num_projectors == 1) {
+				if (projectors[0].uci) {
+					unsigned int fidx= mp->totloop - 1;
 					do {
-						unsigned int vidx= *(&mf->v1 + fidx);
-						project_from_camera(tface->uv[fidx], coords[vidx], projectors[0].uci);
+						unsigned int lidx= mp->loopstart + fidx;
+						unsigned int vidx= mloop[lidx].v;
+						project_from_camera(mloop_uv[lidx].uv, coords[vidx], projectors[0].uci);
 					} while (fidx--);
 				}
 				else {
 					/* apply transformed coords as UVs */
-					unsigned int fidx= mf->v4 ? 3:2;
+					unsigned int fidx= mp->totloop - 1;
 					do {
-						unsigned int vidx= *(&mf->v1 + fidx);
-						copy_v2_v2(tface->uv[fidx], coords[vidx]);
+						unsigned int lidx= mp->loopstart + fidx;
+						unsigned int vidx= mloop[lidx].v;
+						copy_v2_v2(mloop_uv[lidx].uv, coords[vidx]);
 					} while (fidx--);
 				}
-			} else {
-				/* multiple projectors, select the closest to face normal
-				* direction
-				*/
+			}
+			else {
+				/* multiple projectors, select the closest to face normal direction */
 				float face_no[3];
 				int j;
 				Projector *best_projector;
 				float best_dot;
 
 				/* get the untransformed face normal */
-				if(mf->v4) {
-					normal_quad_v3(face_no, coords[mf->v1], coords[mf->v2], coords[mf->v3], coords[mf->v4]);
-				} else { 
-					normal_tri_v3(face_no, coords[mf->v1], coords[mf->v2], coords[mf->v3]);
-				}
+				mesh_calc_poly_normal_coords(mp, mloop + mp->loopstart, (const float (*)[3])coords, face_no);
 
 				/* find the projector which the face points at most directly
-				* (projector normal with largest dot product is best)
-				*/
+				 * (projector normal with largest dot product is best)
+				 */
 				best_dot = dot_v3v3(projectors[0].normal, face_no);
 				best_projector = &projectors[0];
 
-				for(j = 1; j < num_projectors; ++j) {
+				for (j = 1; j < num_projectors; ++j) {
 					float tmp_dot = dot_v3v3(projectors[j].normal,
 							face_no);
-					if(tmp_dot > best_dot) {
+					if (tmp_dot > best_dot) {
 						best_dot = tmp_dot;
 						best_projector = &projectors[j];
 					}
 				}
 
-				if(best_projector->uci) {
-					unsigned int fidx= mf->v4 ? 3:2;
+				if (best_projector->uci) {
+					unsigned int fidx= mp->totloop - 1;
 					do {
-						unsigned int vidx= *(&mf->v1 + fidx);
-						project_from_camera(tface->uv[fidx], coords[vidx], best_projector->uci);
+						unsigned int lidx= mp->loopstart + fidx;
+						unsigned int vidx= mloop[lidx].v;
+						project_from_camera(mloop_uv[lidx].uv, coords[vidx], best_projector->uci);
 					} while (fidx--);
 				}
 				else {
-					unsigned int fidx= mf->v4 ? 3:2;
+					unsigned int fidx= mp->totloop - 1;
 					do {
-						unsigned int vidx= *(&mf->v1 + fidx);
+						unsigned int lidx= mp->loopstart + fidx;
+						unsigned int vidx= mloop[lidx].v;
 						float tco[3];
 
 						copy_v3_v3(tco, coords[vidx]);
 						mul_project_m4_v3(best_projector->projmat, tco);
-						copy_v2_v2(tface->uv[fidx], tco);
+						copy_v2_v2(mloop_uv[lidx].uv, tco);
 
 					} while (fidx--);
 				}
 			}
 		}
 
-		if(override_image) {
-			tface->tpage = image;
+		if (override_image && mtexpoly) {
+			mt->tpage = image;
 		}
 	}
 
 	MEM_freeN(coords);
 	
-	if(free_uci) {
+	if (free_uci) {
 		int j;
-		for(j = 0; j < num_projectors; ++j) {
-			if(projectors[j].uci) {
+		for (j = 0; j < num_projectors; ++j) {
+			if (projectors[j].uci) {
 				MEM_freeN(projectors[j].uci);
 			}
 		}
 	}
+
+	/* Mark tessellated CD layers as dirty. */
+	dm->dirty |= DM_DIRTY_TESS_CDLAYERS;
+
 	return dm;
 }
 
@@ -386,7 +402,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 }
 
 static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
-						struct EditMesh *UNUSED(editData),
+						struct BMEditMesh *UNUSED(editData),
 						DerivedMesh *derivedData)
 {
 	return applyModifier(md, ob, derivedData, 0, 1);
diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c
index 41702a7..dd89ad5 100644
--- a/source/blender/modifiers/intern/MOD_warp.c
+++ b/source/blender/modifiers/intern/MOD_warp.c
@@ -88,11 +88,11 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
 	CustomDataMask dataMask = 0;
 
 	/* ask for vertexgroups if we need them */
-	if(wmd->defgrp_name[0]) dataMask |= (CD_MASK_MDEFORMVERT);
+	if (wmd->defgrp_name[0]) dataMask |= (CD_MASK_MDEFORMVERT);
 	dataMask |= (CD_MASK_MDEFORMVERT);
 
 	/* ask for UV coordinates if we need them */
-	if(wmd->texmapping == MOD_DISP_MAP_UV) dataMask |= (1 << CD_MTFACE);
+	if (wmd->texmapping == MOD_DISP_MAP_UV) dataMask |= (1 << CD_MTFACE);
 
 	return dataMask;
 }
@@ -101,7 +101,7 @@ static int dependsOnTime(ModifierData *md)
 {
 	WarpModifierData *wmd = (WarpModifierData *)md;
 
-	if(wmd->texture) {
+	if (wmd->texture) {
 		return BKE_texture_dependsOnTime(wmd->texture);
 	}
 	else {
@@ -153,7 +153,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UN
 {
 	WarpModifierData *wmd = (WarpModifierData*) md;
 
-	if(wmd->object_from && wmd->object_to) {
+	if (wmd->object_from && wmd->object_to) {
 		DagNode *fromNode = dag_get_node(forest, wmd->object_from);
 		DagNode *toNode = dag_get_node(forest, wmd->object_to);
 
@@ -161,7 +161,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UN
 		dag_add_relation(forest, toNode, obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Warp Modifier2");
 	}
 
-	if((wmd->texmapping == MOD_DISP_MAP_OBJECT) && wmd->map_object) {
+	if ((wmd->texmapping == MOD_DISP_MAP_OBJECT) && wmd->map_object) {
 		DagNode *curNode = dag_get_node(forest, wmd->map_object);
 		dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Warp Modifier3");
 	}
@@ -187,12 +187,12 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob,
 
 	float (*tex_co)[3]= NULL;
 
-	if(!(wmd->object_from && wmd->object_to))
+	if (!(wmd->object_from && wmd->object_to))
 		return;
 
 	modifier_get_vgroup(ob, dm, wmd->defgrp_name, &dvert, &defgrp_index);
 
-	if(wmd->curfalloff==NULL) /* should never happen, but bad lib linking could cause it */
+	if (wmd->curfalloff==NULL) /* should never happen, but bad lib linking could cause it */
 		wmd->curfalloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
 
 	invert_m4_m4(obinv, ob->obmat);
@@ -207,7 +207,7 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob,
 
 	unit_m4(mat_unit);
 
-	if(strength < 0.0f) {
+	if (strength < 0.0f) {
 		float loc[3];
 		strength = -strength;
 
@@ -219,24 +219,26 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob,
 	}
 	weight= strength;
 
-	if(wmd->texture) {
+	if (wmd->texture) {
 		tex_co = MEM_mallocN(sizeof(*tex_co) * numVerts, "warpModifier_do tex_co");
 		get_texture_coords((MappingInfoModifierData *)wmd, ob, dm, vertexCos, tex_co, numVerts);
+
+		modifier_init_texture(wmd->modifier.scene, wmd->texture);
 	}
 
-	for(i = 0; i < numVerts; i++) {
+	for (i = 0; i < numVerts; i++) {
 		float *co = vertexCos[i];
 
-		if(wmd->falloff_type==eWarp_Falloff_None ||
+		if (wmd->falloff_type==eWarp_Falloff_None ||
 		        ((fac=len_v3v3(co, mat_from[3])) < wmd->falloff_radius && (fac=(wmd->falloff_radius-fac)/wmd->falloff_radius)) ) {
 
 			/* skip if no vert group found */
-			if(dvert && defgrp_index >= 0) {
+			if (dvert && defgrp_index >= 0) {
 				dv = &dvert[i];
 
-				if(dv) {
+				if (dv) {
 					weight = defvert_find_weight(dv, defgrp_index) * strength;
-					if(weight <= 0.0f) /* Should never occure... */
+					if (weight <= 0.0f) /* Should never occure... */
 						continue;
 				}
 			}
@@ -272,7 +274,7 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob,
 
 			fac *= weight;
 
-			if(tex_co) {
+			if (tex_co) {
 				TexResult texres;
 				texres.nor = NULL;
 				get_texture_value(wmd->texture, tex_co[i], &texres);
@@ -282,11 +284,11 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob,
 			/* into the 'from' objects space */
 			mul_m4_v3(mat_from_inv, co);
 
-			if(fac >= 1.0f) {
+			if (fac >= 1.0f) {
 				mul_m4_v3(mat_final, co);
 			}
-			else if(fac > 0.0f) {
-				if(wmd->flag & MOD_WARP_VOLUME_PRESERVE) {
+			else if (fac > 0.0f) {
+				if (wmd->flag & MOD_WARP_VOLUME_PRESERVE) {
 					/* interpolate the matrix for nicer locations */
 					blend_m4_m4m4(tmat, mat_unit, mat_final, fac);
 					mul_m4_v3(tmat, co);
@@ -303,7 +305,7 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob,
 		}
 	}
 
-	if(tex_co)
+	if (tex_co)
 		MEM_freeN(tex_co);
 
 }
@@ -319,32 +321,32 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
 	DerivedMesh *dm= NULL;
 	int use_dm= warp_needs_dm((WarpModifierData *)md);
 
-	if(use_dm) {
+	if (use_dm) {
 		dm= get_cddm(ob, NULL, derivedData, vertexCos);
 	}
 
 	warpModifier_do((WarpModifierData *)md, ob, dm, vertexCos, numVerts);
 
-	if(use_dm) {
-		if(dm != derivedData) dm->release(dm);
+	if (use_dm) {
+		if (dm != derivedData) dm->release(dm);
 	}
 }
 
-static void deformVertsEM(ModifierData *md, Object *ob, struct EditMesh *editData,
+static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *editData,
                           DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
 {
 	DerivedMesh *dm = derivedData;
 	int use_dm= warp_needs_dm((WarpModifierData *)md);
 
-	if(use_dm) {
-		if(!derivedData)
-			dm = CDDM_from_editmesh(editData, ob->data);
+	if (use_dm) {
+		if (!derivedData)
+			dm = CDDM_from_BMEditMesh(editData, ob->data, FALSE, FALSE);
 	}
 
 	deformVerts(md, ob, dm, vertexCos, numVerts, 0, 0);
 
-	if(use_dm) {
-		if(!derivedData) dm->release(dm);
+	if (use_dm) {
+		if (!derivedData) dm->release(dm);
 	}
 }
 
diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c
index f4377e8..78e76e2 100644
--- a/source/blender/modifiers/intern/MOD_wave.c
+++ b/source/blender/modifiers/intern/MOD_wave.c
@@ -138,14 +138,14 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
 {
 	WaveModifierData *wmd = (WaveModifierData*) md;
 
-	if(wmd->objectcenter) {
+	if (wmd->objectcenter) {
 		DagNode *curNode = dag_get_node(forest, wmd->objectcenter);
 
 		dag_add_relation(forest, curNode, obNode, DAG_RL_OB_DATA,
 			"Wave Modifier");
 	}
 
-	if(wmd->map_object) {
+	if (wmd->map_object) {
 		DagNode *curNode = dag_get_node(forest, wmd->map_object);
 
 		dag_add_relation(forest, curNode, obNode, DAG_RL_OB_DATA,
@@ -160,11 +160,11 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
 
 
 	/* ask for UV coordinates if we need them */
-	if(wmd->texture && wmd->texmapping == MOD_DISP_MAP_UV)
+	if (wmd->texture && wmd->texmapping == MOD_DISP_MAP_UV)
 		dataMask |= CD_MASK_MTFACE;
 
 	/* ask for vertexgroups if we need them */
-	if(wmd->defgrp_name[0])
+	if (wmd->defgrp_name[0])
 		dataMask |= CD_MASK_MDEFORMVERT;
 
 	return dataMask;
@@ -187,10 +187,10 @@ 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){
+	if (wmd->objectcenter) {
 		float mat[4][4];
 		/* get the control object's location in local coordinates */
 		invert_m4_m4(ob->imat, ob->obmat);
@@ -203,32 +203,34 @@ static void waveModifier_do(WaveModifierData *md,
 	/* get the index of the deform group */
 	modifier_get_vgroup(ob, dm, wmd->defgrp_name, &dvert, &defgrp_index);
 
-	if(wmd->damp == 0) wmd->damp = 10.0f;
+	if (wmd->damp == 0) wmd->damp = 10.0f;
 
-	if(wmd->lifetime != 0.0f) {
+	if (wmd->lifetime != 0.0f) {
 		float x = ctime - wmd->timeoffs;
 
-		if(x > wmd->lifetime) {
+		if (x > wmd->lifetime) {
 			lifefac = x - wmd->lifetime;
 
-			if(lifefac > wmd->damp) lifefac = 0.0;
+			if (lifefac > wmd->damp) lifefac = 0.0;
 			else lifefac =
 				(float)(wmd->height * (1.0f - sqrtf(lifefac / wmd->damp)));
 		}
 	}
 
-	if(wmd->texture) {
+	if (wmd->texture) {
 		tex_co = MEM_mallocN(sizeof(*tex_co) * numVerts,
 					 "waveModifier_do tex_co");
 		get_texture_coords((MappingInfoModifierData *)wmd, ob, dm, vertexCos, tex_co, numVerts);
+
+		modifier_init_texture(wmd->modifier.scene, wmd->texture);
 	}
 
-	if(lifefac != 0.0f) {
+	if (lifefac != 0.0f) {
 		/* avoid divide by zero checks within the loop */
 		float falloff_inv= falloff ? 1.0f / falloff : 1.0f;
 		int i;
 
-		for(i = 0; i < numVerts; i++) {
+		for (i = 0; i < numVerts; i++) {
 			float *co = vertexCos[i];
 			float x = co[0] - wmd->startx;
 			float y = co[1] - wmd->starty;
@@ -236,11 +238,11 @@ static void waveModifier_do(WaveModifierData *md,
 			float def_weight= 1.0f;
 
 			/* get weights */
-			if(dvert) {
+			if (dvert) {
 				def_weight= defvert_find_weight(&dvert[i], defgrp_index);
 
 				/* if this vert isn't in the vgroup, don't deform it */
-				if(def_weight == 0.0f) {
+				if (def_weight == 0.0f) {
 					continue;
 				}
 			}
@@ -260,12 +262,12 @@ static void waveModifier_do(WaveModifierData *md,
 			/* this way it makes nice circles */
 			amplit -= (ctime - wmd->timeoffs) * wmd->speed;
 
-			if(wmd->flag & MOD_WAVE_CYCL) {
+			if (wmd->flag & MOD_WAVE_CYCL) {
 				amplit = (float)fmodf(amplit - wmd->width, 2.0f * wmd->width)
 						+ wmd->width;
 			}
 
-			if(falloff != 0.0f) {
+			if (falloff != 0.0f) {
 				float dist = 0.0f;
 
 				switch(wmd_axis) {
@@ -285,12 +287,12 @@ static void waveModifier_do(WaveModifierData *md,
 			}
 
 			/* GAUSSIAN */
-			if((falloff_fac != 0.0f) && (amplit > -wmd->width) && (amplit < wmd->width)) {
+			if ((falloff_fac != 0.0f) && (amplit > -wmd->width) && (amplit < wmd->width)) {
 				amplit = amplit * wmd->narrow;
 				amplit = (float)(1.0f / expf(amplit * amplit) - minfac);
 
 				/*apply texture*/
-				if(wmd->texture) {
+				if (wmd->texture) {
 					TexResult texres;
 					texres.nor = NULL;
 					get_texture_value(wmd->texture, tex_co[i], &texres);
@@ -300,15 +302,15 @@ static void waveModifier_do(WaveModifierData *md,
 				/*apply weight & falloff */
 				amplit *= def_weight * falloff_fac;
 
-				if(mvert) {
+				if (mvert) {
 					/* move along normals */
-					if(wmd->flag & MOD_WAVE_NORM_X) {
+					if (wmd->flag & MOD_WAVE_NORM_X) {
 						co[0] += (lifefac * amplit) * mvert[i].no[0] / 32767.0f;
 					}
-					if(wmd->flag & MOD_WAVE_NORM_Y) {
+					if (wmd->flag & MOD_WAVE_NORM_Y) {
 						co[1] += (lifefac * amplit) * mvert[i].no[1] / 32767.0f;
 					}
-					if(wmd->flag & MOD_WAVE_NORM_Z) {
+					if (wmd->flag & MOD_WAVE_NORM_Z) {
 						co[2] += (lifefac * amplit) * mvert[i].no[2] / 32767.0f;
 					}
 				}
@@ -320,7 +322,7 @@ static void waveModifier_do(WaveModifierData *md,
 		}
 	}
 
-	if(wmd->texture) MEM_freeN(tex_co);
+	if (wmd->texture) MEM_freeN(tex_co);
 }
 
 static void deformVerts(ModifierData *md, Object *ob,
@@ -333,32 +335,32 @@ static void deformVerts(ModifierData *md, Object *ob,
 	DerivedMesh *dm= derivedData;
 	WaveModifierData *wmd = (WaveModifierData *)md;
 
-	if(wmd->flag & MOD_WAVE_NORM)
+	if (wmd->flag & MOD_WAVE_NORM)
 		dm= get_cddm(ob, NULL, dm, vertexCos);
-	else if(wmd->texture || wmd->defgrp_name[0])
+	else if (wmd->texture || wmd->defgrp_name[0])
 		dm= get_dm(ob, NULL, dm, NULL, 0);
 
 	waveModifier_do(wmd, md->scene, ob, dm, vertexCos, numVerts);
 
-	if(dm != derivedData)
+	if (dm != derivedData)
 		dm->release(dm);
 }
 
 static void deformVertsEM(
-					   ModifierData *md, Object *ob, struct EditMesh *editData,
+					   ModifierData *md, Object *ob, struct BMEditMesh *editData,
 	   DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
 {
 	DerivedMesh *dm= derivedData;
 	WaveModifierData *wmd = (WaveModifierData *)md;
 
-	if(wmd->flag & MOD_WAVE_NORM)
+	if (wmd->flag & MOD_WAVE_NORM)
 		dm= get_cddm(ob, editData, dm, vertexCos);
-	else if(wmd->texture || wmd->defgrp_name[0])
+	else if (wmd->texture || wmd->defgrp_name[0])
 		dm= get_dm(ob, editData, dm, NULL, 0);
 
 	waveModifier_do(wmd, md->scene, ob, dm, vertexCos, numVerts);
 
-	if(dm != derivedData)
+	if (dm != derivedData)
 		dm->release(dm);
 }
 
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c
index 9794635..5ce435a 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.c
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.c
@@ -38,6 +38,7 @@
 #include "DNA_meshdata_types.h"
 #include "DNA_modifier_types.h"
 #include "DNA_object_types.h"
+#include "DNA_scene_types.h"
 
 #include "BKE_cdderivedmesh.h"
 #include "BKE_colortools.h"       /* CurveMapping. */
@@ -52,7 +53,7 @@
 #include "MOD_weightvg_util.h"
 #include "RE_shader_ext.h"        /* Texture masking. */
 
-/* Maps new_w weights in place, using either one of the predifined functions, or a custom curve.
+/* Maps new_w weights in place, using either one of the predefined functions, or a custom curve.
  * Return values are in new_w.
  * If indices is not NULL, it must be a table of same length as org_w and new_w, mapping to the real
  * vertex index (in case the weight tables do not cover the whole vertices...).
@@ -64,14 +65,14 @@ void weightvg_do_map(int num, float *new_w, short falloff_type, CurveMapping *cm
 
 	/* Return immediately, if we have nothing to do! */
 	/* Also security checks... */
-	if(((falloff_type == MOD_WVG_MAPPING_CURVE) && (cmap == NULL))
-	        || !ELEM7(falloff_type, MOD_WVG_MAPPING_CURVE, MOD_WVG_MAPPING_SHARP, MOD_WVG_MAPPING_SMOOTH,
-	                  MOD_WVG_MAPPING_ROOT, MOD_WVG_MAPPING_SPHERE, MOD_WVG_MAPPING_RANDOM,
-	                  MOD_WVG_MAPPING_STEP))
+	if (((falloff_type == MOD_WVG_MAPPING_CURVE) && (cmap == NULL)) ||
+	    !ELEM7(falloff_type, MOD_WVG_MAPPING_CURVE, MOD_WVG_MAPPING_SHARP, MOD_WVG_MAPPING_SMOOTH,
+	           MOD_WVG_MAPPING_ROOT, MOD_WVG_MAPPING_SPHERE, MOD_WVG_MAPPING_RANDOM,
+	           MOD_WVG_MAPPING_STEP))
 		return;
 
 	/* Map each weight (vertex) to its new value, accordingly to the chosen mode. */
-	for(i = 0; i < num; ++i) {
+	for (i = 0; i < num; ++i) {
 		float fac = new_w[i];
 
 		/* Code borrowed from the warp modifier. */
@@ -109,11 +110,11 @@ void weightvg_do_map(int num, float *new_w, short falloff_type, CurveMapping *cm
  * Return values are in org_w.
  * If indices is not NULL, it must be a table of same length as org_w and new_w, mapping to the real
  * vertex index (in case the weight tables do not cover the whole vertices...).
- * XXX The standard “factor” value is assumed in [0.0, 1.0] range. Else, weird results might appear.
+ * XXX The standard "factor" value is assumed in [0.0, 1.0] range. Else, weird results might appear.
  */
 void weightvg_do_mask(int num, const int *indices, float *org_w, const float *new_w,
                       Object *ob, DerivedMesh *dm, float fact, const char defgrp_name[MAX_VGROUP_NAME],
-                      Tex *texture, int tex_use_channel, int tex_mapping,
+                      Scene *scene, Tex *texture, int tex_use_channel, int tex_mapping,
                       Object *tex_map_object, const char *tex_uvlayer_name)
 {
 	int ref_didx;
@@ -145,8 +146,10 @@ void weightvg_do_mask(int num, const int *indices, float *org_w, const float *ne
 		get_texture_coords(&t_map, ob, dm, v_co, tex_co, num);
 		MEM_freeN(v_co);
 
+		modifier_init_texture(scene, texture);
+
 		/* For each weight (vertex), make the mix between org and new weights. */
-		for(i = 0; i < num; ++i) {
+		for (i = 0; i < num; ++i) {
 			int idx = indices ? indices[i] : i;
 			TexResult texres;
 			float h, s, v; /* For HSV color space. */
@@ -225,7 +228,7 @@ void weightvg_do_mask(int num, const int *indices, float *org_w, const float *ne
 
 
 
-/* Applies weights to given vgroup (defgroup), and optionnaly add/remove vertices from the group.
+/* Applies weights to given vgroup (defgroup), and optionally add/remove vertices from the group.
  * If dws is not NULL, it must be an array of MDeformWeight pointers of same length as weights (and
  * defgrp_idx can then have any value).
  * If indices is not NULL, it must be an array of same length as weights, mapping to the real
@@ -237,7 +240,7 @@ void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, MDeformWeight **dws,
 {
 	int i;
 
-	for(i = 0; i < num; i++) {
+	for (i = 0; i < num; i++) {
 		float w = weights[i];
 		MDeformVert *dv = &dvert[indices ? indices[i] : i];
 		MDeformWeight *dw = dws ? dws[i] : defvert_find_index(dv, defgrp_idx);
@@ -246,8 +249,8 @@ void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, MDeformWeight **dws,
 		CLAMP(w, 0.0f, 1.0f);
 
 		/* If the vertex is in this vgroup, remove it if needed, or just update it. */
-		if(dw != NULL) {
-			if(do_rem && w < rem_thresh) {
+		if (dw != NULL) {
+			if (do_rem && w < rem_thresh) {
 				defvert_remove_group(dv, dw);
 			}
 			else {
@@ -255,7 +258,7 @@ void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, MDeformWeight **dws,
 			}
 		}
 		/* Else, add it if needed! */
-		else if(do_add && w > add_thresh) {
+		else if (do_add && w > add_thresh) {
 			defvert_add_index_notest(dv, defgrp_idx, w);
 		}
 	}
diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.h b/source/blender/modifiers/intern/MOD_weightvg_util.h
index 5ae1e99..209b784 100644
--- a/source/blender/modifiers/intern/MOD_weightvg_util.h
+++ b/source/blender/modifiers/intern/MOD_weightvg_util.h
@@ -29,8 +29,8 @@
  */
 
 
-#ifndef MOD_WEIGHTVG_UTIL_H
-#define MOD_WEIGHTVG_UTIL_H
+#ifndef __MOD_WEIGHTVG_UTIL_H__
+#define __MOD_WEIGHTVG_UTIL_H__
 
 /* so modifier types match their defines */
 #include "MOD_modifiertypes.h"
@@ -39,6 +39,7 @@ struct CurveMapping;
 struct DerivedMesh;
 struct Object;
 struct Tex;
+struct Scene;
 
 /*
  * XXX I'd like to make modified weights visible in WeightPaint mode,
@@ -58,7 +59,7 @@ struct Tex;
  */
 #define MOD_WVG_ZEROFLOOR		1.0e-32f
 
-/* Maps new_w weights in place, using either one of the predifined functions, or a custom curve.
+/* Maps new_w weights in place, using either one of the predefined functions, or a custom curve.
  * Return values are in new_w.
  * If indices is not NULL, it must be a table of same length as org_w and new_w, mapping to the real
  * vertex index (in case the weight tables do not cover the whole vertices...).
@@ -70,14 +71,14 @@ void weightvg_do_map(int num, float *new_w, short mode, struct CurveMapping *cma
  * Return values are in org_w.
  * If indices is not NULL, it must be a table of same length as org_w and new_w, mapping to the real
  * vertex index (in case the weight tables do not cover the whole vertices...).
- * XXX The standard “factor” value is assumed in [0.0, 1.0] range. Else, weird results might appear.
+ * XXX The standard "factor" value is assumed in [0.0, 1.0] range. Else, weird results might appear.
  */
 void weightvg_do_mask(int num, const int *indices, float *org_w, const float *new_w, Object *ob,
-                      DerivedMesh *dm, float fact, const char defgrp_name[MAX_VGROUP_NAME], Tex *texture,
-                      int tex_use_channel, int tex_mapping, Object *tex_map_object,
-                      const char *tex_uvlayer_name);
+                      DerivedMesh *dm, float fact, const char defgrp_name[MAX_VGROUP_NAME],
+                      struct Scene *scene, Tex *texture, int tex_use_channel, int tex_mapping,
+                      Object *tex_map_object, const char *tex_uvlayer_name);
 
-/* Applies weights to given vgroup (defgroup), and optionnaly add/remove vertices from the group.
+/* Applies weights to given vgroup (defgroup), and optionally add/remove vertices from the group.
  * If indices is not NULL, it must be a table of same length as weights, mapping to the real
  * vertex index (in case the weight table does not cover the whole vertices...).
  */
@@ -85,4 +86,4 @@ void weightvg_update_vg(MDeformVert *dvert, int defgrp_idx, MDeformWeight **dws,
                         const int *indices, const float *weights, int do_add,
                         float add_thresh, int do_rem, float rem_thresh);
 
-#endif /* MOD_WEIGHTVG_UTIL_H */
+#endif /* __MOD_WEIGHTVG_UTIL_H__ */
diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c
index e4d1d7d..b896187 100644
--- a/source/blender/modifiers/intern/MOD_weightvgedit.c
+++ b/source/blender/modifiers/intern/MOD_weightvgedit.c
@@ -111,10 +111,10 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
 	dataMask |= CD_MASK_MDEFORMVERT;
 
 	/* Ask for UV coordinates if we need them. */
-	if(wmd->mask_tex_mapping == MOD_DISP_MAP_UV)
+	if (wmd->mask_tex_mapping == MOD_DISP_MAP_UV)
 		dataMask |= CD_MASK_MTFACE;
 
-	/* No need to ask for CD_WEIGHT_MCOL... */
+	/* No need to ask for CD_PREVIEW_MLOOPCOL... */
 
 	return dataMask;
 }
@@ -123,7 +123,7 @@ static int dependsOnTime(ModifierData *md)
 {
 	WeightVGEditModifierData *wmd = (WeightVGEditModifierData*) md;
 
-	if(wmd->mask_texture)
+	if (wmd->mask_texture)
 		return BKE_texture_dependsOnTime(wmd->mask_texture);
 	return 0;
 }
@@ -156,14 +156,14 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UN
 	WeightVGEditModifierData *wmd = (WeightVGEditModifierData*) md;
 	DagNode *curNode;
 
-	if(wmd->mask_tex_map_obj && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
+	if (wmd->mask_tex_map_obj && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
 		curNode = dag_get_node(forest, wmd->mask_tex_map_obj);
 
 		dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA,
 		                 "WeightVGEdit Modifier");
 	}
 
-	if(wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL)
+	if (wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL)
 		dag_add_relation(forest, obNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA,
 		                 "WeightVGEdit Modifier");
 }
@@ -211,15 +211,15 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 
 	dvert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MDEFORMVERT, numVerts);
 	/* If no vertices were ever added to an object's vgroup, dvert might be NULL. */
-	if(!dvert)
+	if (!dvert)
 		/* If this modifier is not allowed to add vertices, just return. */
-		if(!do_add)
+		if (!do_add)
 			return dm;
 		/* Else, add a valid data layer! */
 		dvert = CustomData_add_layer_named(&dm->vertData, CD_MDEFORMVERT, CD_CALLOC,
 		                                   NULL, numVerts, wmd->defgrp_name);
 		/* Ultimate security check. */
-		if(!dvert)
+		if (!dvert)
 			return dm;
 
 	/* Get org weights, assuming 0.0 for vertices not in given vgroup. */
@@ -228,7 +228,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 	dw = MEM_mallocN(sizeof(MDeformWeight*) * numVerts, "WeightVGEdit Modifier, dw");
 	for (i = 0; i < numVerts; i++) {
 		dw[i] = defvert_find_index(&dvert[i], defgrp_idx);
-		if(dw[i]) {
+		if (dw[i]) {
 			org_w[i] = new_w[i] = dw[i]->weight;
 		}
 		else {
@@ -243,8 +243,9 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 
 	/* Do masking. */
 	weightvg_do_mask(numVerts, NULL, org_w, new_w, ob, dm, wmd->mask_constant,
-	                 wmd->mask_defgrp_name, wmd->mask_texture, wmd->mask_tex_use_channel,
-	                 wmd->mask_tex_mapping, wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
+	                 wmd->mask_defgrp_name, wmd->modifier.scene, wmd->mask_texture,
+	                 wmd->mask_tex_use_channel, wmd->mask_tex_mapping,
+	                 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,
@@ -252,7 +253,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 
 	/* If weight preview enabled... */
 #if 0 /* XXX Currently done in mod stack :/ */
-	if(do_prev)
+	if (do_prev)
 		DM_update_weight_mcol(ob, dm, 0, org_w, 0, NULL);
 #endif
 
@@ -266,7 +267,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 }
 
 static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
-                                    struct EditMesh *UNUSED(editData),
+                                    struct BMEditMesh *UNUSED(editData),
                                     DerivedMesh *derivedData)
 {
 	return applyModifier(md, ob, derivedData, 0, 1);
diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c
index 38de944..b7bbc71 100644
--- a/source/blender/modifiers/intern/MOD_weightvgmix.c
+++ b/source/blender/modifiers/intern/MOD_weightvgmix.c
@@ -153,10 +153,10 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
 	dataMask |= CD_MASK_MDEFORMVERT;
 
 	/* Ask for UV coordinates if we need them. */
-	if(wmd->mask_tex_mapping == MOD_DISP_MAP_UV)
+	if (wmd->mask_tex_mapping == MOD_DISP_MAP_UV)
 		dataMask |= CD_MASK_MTFACE;
 
-	/* No need to ask for CD_WEIGHT_MCOL... */
+	/* No need to ask for CD_PREVIEW_MLOOPCOL... */
 
 	return dataMask;
 }
@@ -165,7 +165,7 @@ static int dependsOnTime(ModifierData *md)
 {
 	WeightVGMixModifierData *wmd = (WeightVGMixModifierData*) md;
 
-	if(wmd->mask_texture)
+	if (wmd->mask_texture)
 		return BKE_texture_dependsOnTime(wmd->mask_texture);
 	return 0;
 }
@@ -198,14 +198,14 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UN
 	WeightVGMixModifierData *wmd = (WeightVGMixModifierData*) md;
 	DagNode *curNode;
 
-	if(wmd->mask_tex_map_obj && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
+	if (wmd->mask_tex_map_obj && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
 		curNode = dag_get_node(forest, wmd->mask_tex_map_obj);
 
 		dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA,
 		                 "WeightVGMix Modifier");
 	}
 
-	if(wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL)
+	if (wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL)
 		dag_add_relation(forest, obNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA,
 		                 "WeightVGMix Modifier");
 }
@@ -258,15 +258,15 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 
 	dvert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MDEFORMVERT, numVerts);
 	/* If no vertices were ever added to an object's vgroup, dvert might be NULL. */
-	if(!dvert)
+	if (!dvert)
 		/* If not affecting all vertices, just return. */
-		if(wmd->mix_set != MOD_WVG_SET_ALL)
+		if (wmd->mix_set != MOD_WVG_SET_ALL)
 			return dm;
 		/* Else, add a valid data layer! */
 		dvert = CustomData_add_layer_named(&dm->vertData, CD_MDEFORMVERT, CD_CALLOC,
 		                                   NULL, numVerts, wmd->defgrp_name_a);
 		/* Ultimate security check. */
-		if(!dvert)
+		if (!dvert)
 			return dm;
 
 	/* Find out which vertices to work on. */
@@ -278,7 +278,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 		/* All vertices in first vgroup. */
 		for (i = 0; i < numVerts; i++) {
 			MDeformWeight *dw = defvert_find_index(&dvert[i], defgrp_idx);
-			if(dw) {
+			if (dw) {
 				tdw1[numIdx] = dw;
 				tdw2[numIdx] = defvert_find_index(&dvert[i], defgrp_idx2);
 				tidx[numIdx++] = i;
@@ -289,7 +289,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 		/* All vertices in second vgroup. */
 		for (i = 0; i < numVerts; i++) {
 			MDeformWeight *dw = defvert_find_index(&dvert[i], defgrp_idx2);
-			if(dw) {
+			if (dw) {
 				tdw1[numIdx] = defvert_find_index(&dvert[i], defgrp_idx);
 				tdw2[numIdx] = dw;
 				tidx[numIdx++] = i;
@@ -301,7 +301,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 		for (i = 0; i < numVerts; i++) {
 			MDeformWeight *adw = defvert_find_index(&dvert[i], defgrp_idx);
 			MDeformWeight *bdw = defvert_find_index(&dvert[i], defgrp_idx2);
-			if(adw || bdw) {
+			if (adw || bdw) {
 				tdw1[numIdx] = adw;
 				tdw2[numIdx] = bdw;
 				tidx[numIdx++] = i;
@@ -313,7 +313,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 		for (i = 0; i < numVerts; i++) {
 			MDeformWeight *adw = defvert_find_index(&dvert[i], defgrp_idx);
 			MDeformWeight *bdw = defvert_find_index(&dvert[i], defgrp_idx2);
-			if(adw && bdw) {
+			if (adw && bdw) {
 				tdw1[numIdx] = adw;
 				tdw2[numIdx] = bdw;
 				tidx[numIdx++] = i;
@@ -330,7 +330,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 		numIdx = -1;
 		break;
 	}
-	if(numIdx == 0) {
+	if (numIdx == 0) {
 		/* Use no vertices! Hence, return org data. */
 		MEM_freeN(tdw1);
 		MEM_freeN(tdw2);
@@ -370,8 +370,9 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 
 	/* Do masking. */
 	weightvg_do_mask(numIdx, indices, org_w, new_w, ob, dm, wmd->mask_constant,
-	                 wmd->mask_defgrp_name, wmd->mask_texture, wmd->mask_tex_use_channel,
-	                 wmd->mask_tex_mapping, wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
+	                 wmd->mask_defgrp_name, wmd->modifier.scene, wmd->mask_texture,
+	                 wmd->mask_tex_use_channel, wmd->mask_tex_mapping,
+	                 wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
 
 	/* Update (add to) vgroup.
 	 * XXX Depending on the MOD_WVG_SET_xxx option chosen, we might have to add vertices to vgroup.
@@ -380,7 +381,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 
 	/* If weight preview enabled... */
 #if 0 /* XXX Currently done in mod stack :/ */
-	if(do_prev)
+	if (do_prev)
 		DM_update_weight_mcol(ob, dm, 0, org_w, numIdx, indices);
 #endif
 
@@ -398,7 +399,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 }
 
 static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
-                                    struct EditMesh *UNUSED(editData),
+                                    struct BMEditMesh *UNUSED(editData),
                                     DerivedMesh *derivedData)
 {
 	return applyModifier(md, ob, derivedData, 0, 1);
diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c
index c1aa68d..bcfdced 100644
--- a/source/blender/modifiers/intern/MOD_weightvgproximity.c
+++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c
@@ -30,7 +30,6 @@
 
 #define DO_PROFILE 0
 
-#include "BLI_editVert.h"
 #include "BLI_math.h"
 #include "BLI_string.h"
 #include "BLI_utildefines.h"
@@ -81,7 +80,7 @@ static void get_vert2geom_distance(int numVerts, float (*v_cos)[3],
 	if (dist_v) {
 		/* Create a bvh-tree of the given target's verts. */
 		bvhtree_from_mesh_verts(&treeData_v, target, 0.0, 2, 6);
-		if(treeData_v.tree == NULL) {
+		if (treeData_v.tree == NULL) {
 			OUT_OF_MEMORY();
 			return;
 		}
@@ -89,7 +88,7 @@ static void get_vert2geom_distance(int numVerts, float (*v_cos)[3],
 	if (dist_e) {
 		/* Create a bvh-tree of the given target's edges. */
 		bvhtree_from_mesh_edges(&treeData_e, target, 0.0, 2, 6);
-		if(treeData_e.tree == NULL) {
+		if (treeData_e.tree == NULL) {
 			OUT_OF_MEMORY();
 			return;
 		}
@@ -97,7 +96,7 @@ static void get_vert2geom_distance(int numVerts, float (*v_cos)[3],
 	if (dist_f) {
 		/* Create a bvh-tree of the given target's faces. */
 		bvhtree_from_mesh_faces(&treeData_f, target, 0.0, 2, 6);
-		if(treeData_f.tree == NULL) {
+		if (treeData_f.tree == NULL) {
 			OUT_OF_MEMORY();
 			return;
 		}
@@ -166,7 +165,7 @@ static void get_vert2ob_distance(int numVerts, float (*v_cos)[3], float *dist,
 	float v_wco[3];
 	unsigned int i= numVerts;
 
-	while(i-- > 0) {
+	while (i-- > 0) {
 		/* Get world-coordinates of the vertex (constraints and anim included). */
 		mul_v3_m4v3(v_wco, ob->obmat, v_cos[i]);
 		/* Return distance between both coordinates. */
@@ -184,33 +183,33 @@ static float get_ob2ob_distance(const Object* ob, const Object* obr)
 }
 
 /**
- * Maps distances to weights, with an optionnal “smoothing” mapping.
+ * Maps distances to weights, with an optionnal "smoothing" mapping.
  */
 void do_map(float *weights, const int nidx, const float min_d, const float max_d, short mode)
 {
 	const float range_inv= 1.0f / (max_d - min_d); /* invert since multiplication is faster */
 	unsigned int i= nidx;
-	if(max_d == min_d) {
+	if (max_d == min_d) {
 		while (i-- > 0) {
 			weights[i] = (weights[i] >= max_d) ? 1.0f : 0.0f; /* "Step" behavior... */
 		}
 	}
-	else if(max_d > min_d) {
+	else if (max_d > min_d) {
 		while (i-- > 0) {
 			if     (weights[i] >= max_d) weights[i]= 1.0f; /* most likely case first */
-			else if(weights[i] <= min_d) weights[i]= 0.0f;
+			else if (weights[i] <= min_d) weights[i]= 0.0f;
 			else                         weights[i]= (weights[i] - min_d) * range_inv;
 		}
 	}
 	else {
 		while (i-- > 0) {
 			if     (weights[i] <= max_d) weights[i]= 1.0f; /* most likely case first */
-			else if(weights[i] >= min_d) weights[i]= 0.0f;
+			else if (weights[i] >= min_d) weights[i]= 0.0f;
 			else                         weights[i]= (weights[i] - min_d) * range_inv;
 		}
 	}
 
-	if(!ELEM(mode, MOD_WVG_MAPPING_NONE, MOD_WVG_MAPPING_CURVE)) {
+	if (!ELEM(mode, MOD_WVG_MAPPING_NONE, MOD_WVG_MAPPING_CURVE)) {
 		weightvg_do_map(nidx, weights, mode, NULL);
 	}
 }
@@ -265,10 +264,10 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
 	dataMask |= CD_MASK_MDEFORMVERT;
 
 	/* Ask for UV coordinates if we need them. */
-	if(wmd->mask_tex_mapping == MOD_DISP_MAP_UV)
+	if (wmd->mask_tex_mapping == MOD_DISP_MAP_UV)
 		dataMask |= CD_MASK_MTFACE;
 
-	/* No need to ask for CD_WEIGHT_MCOL... */
+	/* No need to ask for CD_PREVIEW_MLOOPCOL... */
 
 	return dataMask;
 }
@@ -277,7 +276,7 @@ static int dependsOnTime(ModifierData *md)
 {
 	WeightVGProximityModifierData *wmd = (WeightVGProximityModifierData*) md;
 
-	if(wmd->mask_texture)
+	if (wmd->mask_texture)
 		return BKE_texture_dependsOnTime(wmd->mask_texture);
 	return 0;
 }
@@ -317,14 +316,14 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UN
 		                 "WeightVGProximity Modifier");
 	}
 
-	if(wmd->mask_tex_map_obj && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
+	if (wmd->mask_tex_map_obj && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
 		curNode = dag_get_node(forest, wmd->mask_tex_map_obj);
 
 		dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA,
 		                 "WeightVGProximity Modifier");
 	}
 
-	if(wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL)
+	if (wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL)
 		dag_add_relation(forest, obNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA,
 		                 "WeightVGProximity Modifier");
 }
@@ -386,7 +385,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 	dvert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MDEFORMVERT, numVerts);
 	/* If no vertices were ever added to an object's vgroup, dvert might be NULL.
 	 * As this modifier never add vertices to vgroup, just return. */
-	if(!dvert)
+	if (!dvert)
 		return dm;
 
 	/* Find out which vertices to work on (all vertices in vgroup), and get their relevant weight.
@@ -396,20 +395,20 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 	tdw = MEM_mallocN(sizeof(MDeformWeight*) * numVerts, "WeightVGProximity Modifier, tdw");
 	for (i = 0; i < numVerts; i++) {
 		MDeformWeight *_dw = defvert_find_index(&dvert[i], defgrp_idx);
-		if(_dw) {
+		if (_dw) {
 			tidx[numIdx] = i;
 			tw[numIdx] = _dw->weight;
 			tdw[numIdx++] = _dw;
 		}
 	}
 	/* If no vertices found, return org data! */
-	if(numIdx == 0) {
+	if (numIdx == 0) {
 		MEM_freeN(tidx);
 		MEM_freeN(tw);
 		MEM_freeN(tdw);
 		return dm;
 	}
-	if(numIdx != numVerts) {
+	if (numIdx != numVerts) {
 		indices = MEM_mallocN(sizeof(int) * numIdx, "WeightVGProximity Modifier, indices");
 		memcpy(indices, tidx, sizeof(int) * numIdx);
 		org_w = MEM_mallocN(sizeof(float) * numIdx, "WeightVGProximity Modifier, org_w");
@@ -428,7 +427,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 
 	/* Get our vertex coordinates. */
 	v_cos = MEM_mallocN(sizeof(float[3]) * numIdx, "WeightVGProximity Modifier, v_cos");
-	if(numIdx != numVerts) {
+	if (numIdx != numVerts) {
 		/* XXX In some situations, this code can be up to about 50 times more performant
 		 *     than simply using getVertCo for each affected vertex...
 		 */
@@ -444,7 +443,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 	/* Compute wanted distances. */
 	if (wmd->proximity_mode == MOD_WVG_PROXIMITY_OBJECT) {
 		const float dist = get_ob2ob_distance(ob, obr);
-		for(i = 0; i < numIdx; i++)
+		for (i = 0; i < numIdx; i++)
 			new_w[i] = dist;
 	}
 	else if (wmd->proximity_mode == MOD_WVG_PROXIMITY_GEOMETRY) {
@@ -460,8 +459,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 					target_dm = CDDM_from_curve(obr);
 				else if (obr->type == OB_MESH) {
 					Mesh *me = (Mesh*)obr->data;
-					if (me->edit_mesh)
-						target_dm = CDDM_from_editmesh((EditMesh*)me->edit_mesh, me);
+					if (me->edit_btmesh)
+						target_dm = CDDM_from_BMEditMesh(me->edit_btmesh, me, FALSE, FALSE);
 					else
 						target_dm = CDDM_from_mesh(me, obr);
 				}
@@ -478,17 +477,17 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 				space_transform_setup(&loc2trgt, ob, obr);
 				get_vert2geom_distance(numIdx, v_cos, dists_v, dists_e, dists_f,
 				                       target_dm, &loc2trgt);
-				for(i = 0; i < numIdx; i++) {
+				for (i = 0; i < numIdx; i++) {
 					new_w[i] = dists_v ? dists_v[i] : FLT_MAX;
-					if(dists_e)
+					if (dists_e)
 						new_w[i] = minf(dists_e[i], new_w[i]);
-					if(dists_f)
+					if (dists_f)
 						new_w[i] = minf(dists_f[i], new_w[i]);
 				}
-				if(free_target_dm) target_dm->release(target_dm);
-				if(dists_v) MEM_freeN(dists_v);
-				if(dists_e) MEM_freeN(dists_e);
-				if(dists_f) MEM_freeN(dists_f);
+				if (free_target_dm) target_dm->release(target_dm);
+				if (dists_v) MEM_freeN(dists_v);
+				if (dists_e) MEM_freeN(dists_e);
+				if (dists_f) MEM_freeN(dists_f);
 			}
 			/* Else, fall back to default obj2vert behavior. */
 			else {
@@ -505,15 +504,16 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 
 	/* Do masking. */
 	weightvg_do_mask(numIdx, indices, org_w, new_w, ob, dm, wmd->mask_constant,
-	                 wmd->mask_defgrp_name, wmd->mask_texture, wmd->mask_tex_use_channel,
-	                 wmd->mask_tex_mapping, wmd->mask_tex_map_obj, wmd->mask_tex_uvlayer_name);
+	                 wmd->mask_defgrp_name, wmd->modifier.scene, wmd->mask_texture,
+	                 wmd->mask_tex_use_channel, wmd->mask_tex_mapping,
+	                 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);
 
 	/* If weight preview enabled... */
 #if 0 /* XXX Currently done in mod stack :/ */
-	if(do_prev)
+	if (do_prev)
 		DM_update_weight_mcol(ob, dm, 0, org_w, numIdx, indices);
 #endif
 
@@ -521,7 +521,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 	MEM_freeN(org_w);
 	MEM_freeN(new_w);
 	MEM_freeN(dw);
-	if(indices)
+	if (indices)
 		MEM_freeN(indices);
 	MEM_freeN(v_cos);
 
@@ -534,7 +534,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
 }
 
 static DerivedMesh *applyModifierEM(ModifierData *md, Object *ob,
-                                    struct EditMesh *UNUSED(editData),
+                                    struct BMEditMesh *UNUSED(editData),
                                     DerivedMesh *derivedData)
 {
 	return applyModifier(md, ob, derivedData, 0, 1);
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index b458ae3..9bcbc91 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -222,4 +222,12 @@ if(WITH_PYTHON)
 	add_definitions(-DWITH_PYTHON)
 endif()
 
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
+if(WITH_IMAGE_OPENEXR)
+	add_definitions(-DWITH_OPENEXR)
+endif()
+
 blender_add_lib(bf_nodes "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/nodes/NOD_composite.h b/source/blender/nodes/NOD_composite.h
index 77745a1..284b89b 100644
--- a/source/blender/nodes/NOD_composite.h
+++ b/source/blender/nodes/NOD_composite.h
@@ -29,8 +29,8 @@
  *  \ingroup nodes
  */
 
-#ifndef NOD_composite_H
-#define NOD_composite_H
+#ifndef __NOD_COMPOSITE_H__
+#define __NOD_COMPOSITE_H__
 
 #include "BKE_node.h"
 
diff --git a/source/blender/nodes/NOD_shader.h b/source/blender/nodes/NOD_shader.h
index 63fc0f4..d2b3a61 100644
--- a/source/blender/nodes/NOD_shader.h
+++ b/source/blender/nodes/NOD_shader.h
@@ -29,8 +29,8 @@
  *  \ingroup nodes
  */
 
-#ifndef NOD_SHADER_H
-#define NOD_SHADER_H
+#ifndef __NOD_SHADER_H__
+#define __NOD_SHADER_H__
 
 #include "BKE_node.h"
 
diff --git a/source/blender/nodes/NOD_socket.h b/source/blender/nodes/NOD_socket.h
index fb3946b..f41be2b 100644
--- a/source/blender/nodes/NOD_socket.h
+++ b/source/blender/nodes/NOD_socket.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NOD_SOCKET_H_
-#define NOD_SOCKET_H_
+#ifndef __NOD_SOCKET_H__
+#define __NOD_SOCKET_H__
 
 #include "DNA_listBase.h"
 
diff --git a/source/blender/nodes/NOD_texture.h b/source/blender/nodes/NOD_texture.h
index cb727ef..7722580 100644
--- a/source/blender/nodes/NOD_texture.h
+++ b/source/blender/nodes/NOD_texture.h
@@ -29,8 +29,8 @@
  *  \ingroup nodes
  */
 
-#ifndef NOD_TEXTURE_H
-#define NOD_TEXTURE_H
+#ifndef __NOD_TEXTURE_H__
+#define __NOD_TEXTURE_H__
 
 #include "BKE_node.h"
 
diff --git a/source/blender/nodes/SConscript b/source/blender/nodes/SConscript
index d7dbed5..c8b13e2 100644
--- a/source/blender/nodes/SConscript
+++ b/source/blender/nodes/SConscript
@@ -26,11 +26,14 @@ if env['WITH_BF_PYTHON']:
     if env['BF_DEBUG']:
         defs.append('_DEBUG')
 
+if env['WITH_BF_INTERNATIONAL']:
+    defs.append('WITH_INTERNATIONAL')
+
 if env['OURPLATFORM'] == 'linux':
     cflags='-pthread'
     incs += ' ../../../extern/binreloc/include'
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
 
 env.BlenderLib ( libname = 'bf_nodes', sources = sources, includes = Split(incs), defines = defs, libtype=['core','player'], priority = [190,105] )
diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c
index 52dc364..049b5dd 100644
--- a/source/blender/nodes/composite/node_composite_tree.c
+++ b/source/blender/nodes/composite/node_composite_tree.c
@@ -63,8 +63,8 @@
 static void foreach_nodetree(Main *main, void *calldata, bNodeTreeCallback func)
 {
 	Scene *sce;
-	for(sce= main->scene.first; sce; sce= sce->id.next) {
-		if(sce->nodetree) {
+	for (sce= main->scene.first; sce; sce= sce->id.next) {
+		if (sce->nodetree) {
 			func(calldata, &sce->id, sce->nodetree);
 		}
 	}
@@ -88,8 +88,8 @@ static void free_node_cache(bNodeTree *UNUSED(ntree), bNode *node)
 {
 	bNodeSocket *sock;
 	
-	for(sock= node->outputs.first; sock; sock= sock->next) {
-		if(sock->cache) {
+	for (sock= node->outputs.first; sock; sock= sock->next) {
+		if (sock->cache) {
 			free_compbuf(sock->cache);
 			sock->cache= NULL;
 		}
@@ -99,7 +99,7 @@ static void free_node_cache(bNodeTree *UNUSED(ntree), bNode *node)
 static void free_cache(bNodeTree *ntree)
 {
 	bNode *node;
-	for(node= ntree->nodes.first; node; node= node->next)
+	for (node= ntree->nodes.first; node; node= node->next)
 		free_node_cache(ntree, node);
 }
 
@@ -107,8 +107,8 @@ static void update_node(bNodeTree *ntree, bNode *node)
 {
 	bNodeSocket *sock;
 
-	for(sock= node->outputs.first; sock; sock= sock->next) {
-		if(sock->cache) {
+	for (sock= node->outputs.first; sock; sock= sock->next) {
+		if (sock->cache) {
 			//free_compbuf(sock->cache);
 			//sock->cache= NULL;
 		}
@@ -121,28 +121,28 @@ static void update_node(bNodeTree *ntree, bNode *node)
 }
 
 /* local tree then owns all compbufs */
-static void localize(bNodeTree *UNUSED(localtree), bNodeTree *ntree)
+static void localize(bNodeTree *localtree, bNodeTree *ntree)
 {
-	bNode *node;
+	bNode *node, *node_next;
 	bNodeSocket *sock;
 	
-	for(node= ntree->nodes.first; node; node= node->next) {
+	for (node= ntree->nodes.first; node; node= node->next) {
 		/* ensure new user input gets handled ok */
 		node->need_exec= 0;
 		
 		/* move over the compbufs */
 		/* right after ntreeCopyTree() oldsock pointers are valid */
 		
-		if(ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
-			if(node->id) {
-				if(node->flag & NODE_DO_OUTPUT)
+		if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
+			if (node->id) {
+				if (node->flag & NODE_DO_OUTPUT)
 					node->new_node->id= (ID *)copy_image((Image *)node->id);
 				else
 					node->new_node->id= NULL;
 			}
 		}
 		
-		for(sock= node->outputs.first; sock; sock= sock->next) {
+		for (sock= node->outputs.first; sock; sock= sock->next) {
 			sock->new_sock->cache= sock->cache;
 			compbuf_set_node(sock->new_sock->cache, node->new_node);
 			
@@ -150,6 +150,26 @@ static void localize(bNodeTree *UNUSED(localtree), bNodeTree *ntree)
 			sock->new_sock->new_sock= sock;
 		}
 	}
+	
+	/* replace muted nodes by internal links */
+	for (node= localtree->nodes.first; node; node= node_next) {
+		node_next = node->next;
+		
+		if (node->flag & NODE_MUTED) {
+			/* make sure the update tag isn't lost when removing the muted node.
+			 * propagate this to all downstream nodes.
+			 */
+			if (node->need_exec) {
+				bNodeLink *link;
+				for (link=localtree->links.first; link; link=link->next)
+					if (link->fromnode==node && link->tonode)
+						link->tonode->need_exec = 1;
+			}
+			
+			nodeInternalRelink(localtree, node);
+			nodeFreeNode(localtree, node);
+		}
+	}
 }
 
 static void local_sync(bNodeTree *localtree, bNodeTree *ntree)
@@ -157,11 +177,11 @@ static void local_sync(bNodeTree *localtree, bNodeTree *ntree)
 	bNode *lnode;
 	
 	/* move over the compbufs and previews */
-	for(lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
-		if( (lnode->exec & NODE_READY) && !(lnode->exec & NODE_SKIPPED) ) {
-			if(ntreeNodeExists(ntree, lnode->new_node)) {
+	for (lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
+		if ( (lnode->exec & NODE_READY) && !(lnode->exec & NODE_SKIPPED) ) {
+			if (ntreeNodeExists(ntree, lnode->new_node)) {
 				
-				if(lnode->preview && lnode->preview->rect) {
+				if (lnode->preview && lnode->preview->rect) {
 					nodeFreePreview(lnode->new_node);
 					lnode->new_node->preview= lnode->preview;
 					lnode->preview= NULL;
@@ -177,28 +197,28 @@ static void local_merge(bNodeTree *localtree, bNodeTree *ntree)
 	bNodeSocket *lsock;
 	
 	/* move over the compbufs and previews */
-	for(lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
-		if(ntreeNodeExists(ntree, lnode->new_node)) {
-			if(ELEM(lnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
-				if(lnode->id && (lnode->flag & NODE_DO_OUTPUT)) {
+	for (lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
+		if (ntreeNodeExists(ntree, lnode->new_node)) {
+			if (ELEM(lnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
+				if (lnode->id && (lnode->flag & NODE_DO_OUTPUT)) {
 					/* image_merge does sanity check for pointers */
 					BKE_image_merge((Image *)lnode->new_node->id, (Image *)lnode->id);
 				}
 			}
-			else if(lnode->type==CMP_NODE_MOVIEDISTORTION) {
+			else if (lnode->type==CMP_NODE_MOVIEDISTORTION) {
 				/* special case for distortion node: distortion context is allocating in exec function
 				   and to achive much better performance on further calls this context should be
 				   copied back to original node */
-				if(lnode->storage) {
-					if(lnode->new_node->storage)
+				if (lnode->storage) {
+					if (lnode->new_node->storage)
 						BKE_tracking_distortion_destroy(lnode->new_node->storage);
 
 					lnode->new_node->storage= BKE_tracking_distortion_copy(lnode->storage);
 				}
 			}
 			
-			for(lsock= lnode->outputs.first; lsock; lsock= lsock->next) {
-				if(ntreeOutputExists(lnode->new_node, lsock->new_sock)) {
+			for (lsock= lnode->outputs.first; lsock; lsock= lsock->next) {
+				if (ntreeOutputExists(lnode->new_node, lsock->new_sock)) {
 					lsock->new_sock->cache= lsock->cache;
 					compbuf_set_node(lsock->new_sock->cache, lnode->new_node);
 					lsock->cache= NULL;
@@ -230,9 +250,7 @@ bNodeTreeType ntreeType_Composite = {
 	/* update */			update,
 	/* update_node */		update_node,
 	/* validate_link */		NULL,
-	/* mutefunc */			node_compo_pass_on,
-	/* mutelinksfunc */		node_mute_get_links,
-	/* gpumutefunc */		NULL
+	/* internal_connect */	node_internal_connect_default
 };
 
 
@@ -258,21 +276,21 @@ struct bNodeTreeExec *ntreeCompositBeginExecTree(bNodeTree *ntree, int use_tree_
 	
 	exec = ntree_exec_begin(ntree);
 	
-	for(node= exec->nodetree->nodes.first; node; node= node->next) {
+	for (node= exec->nodetree->nodes.first; node; node= node->next) {
 		/* initialize needed for groups */
 		node->exec= 0;	
 		
-		for(sock= node->outputs.first; sock; sock= sock->next) {
+		for (sock= node->outputs.first; sock; sock= sock->next) {
 			bNodeStack *ns= node_get_socket_stack(exec->stack, sock);
-			if(ns && sock->cache) {
+			if (ns && sock->cache) {
 				ns->data= sock->cache;
 				sock->cache= NULL;
 			}
 		}
 		/* cannot initialize them while using in threads */
-		if(ELEM4(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT)) {
+		if (ELEM4(node->type, CMP_NODE_TIME, CMP_NODE_CURVE_VEC, CMP_NODE_CURVE_RGB, CMP_NODE_HUECORRECT)) {
 			curvemapping_initialize(node->storage);
-			if(node->type==CMP_NODE_CURVE_RGB)
+			if (node->type==CMP_NODE_CURVE_RGB)
 				curvemapping_premultiply(node->storage, 0);
 		}
 	}
@@ -292,22 +310,22 @@ struct bNodeTreeExec *ntreeCompositBeginExecTree(bNodeTree *ntree, int use_tree_
  */
 void ntreeCompositEndExecTree(bNodeTreeExec *exec, int use_tree_data)
 {
-	if(exec) {
+	if (exec) {
 		bNodeTree *ntree= exec->nodetree;
 		bNode *node;
 		bNodeStack *ns;
 		
-		for(node= exec->nodetree->nodes.first; node; node= node->next) {
+		for (node= exec->nodetree->nodes.first; node; node= node->next) {
 			bNodeSocket *sock;
 			
-			for(sock= node->outputs.first; sock; sock= sock->next) {
+			for (sock= node->outputs.first; sock; sock= sock->next) {
 				ns = node_get_socket_stack(exec->stack, sock);
-				if(ns && ns->data) {
+				if (ns && ns->data) {
 					sock->cache= ns->data;
 					ns->data= NULL;
 				}
 			}
-			if(node->type==CMP_NODE_CURVE_RGB)
+			if (node->type==CMP_NODE_CURVE_RGB)
 				curvemapping_premultiply(node->storage, 1);
 			
 			node->need_exec= 0;
@@ -329,14 +347,14 @@ static int node_only_value(bNode *node)
 {
 	bNodeSocket *sock;
 	
-	if(ELEM3(node->type, CMP_NODE_TIME, CMP_NODE_VALUE, CMP_NODE_RGB))
+	if (ELEM3(node->type, CMP_NODE_TIME, CMP_NODE_VALUE, CMP_NODE_RGB))
 		return 1;
 	
 	/* doing this for all node types goes wrong. memory free errors */
-	if(node->inputs.first && node->type==CMP_NODE_MAP_VALUE) {
+	if (node->inputs.first && node->type==CMP_NODE_MAP_VALUE) {
 		int retval= 1;
-		for(sock= node->inputs.first; sock; sock= sock->next) {
-			if(sock->link)
+		for (sock= node->inputs.first; sock; sock= sock->next) {
+			if (sock->link)
 				retval &= node_only_value(sock->link->fromnode);
 		}
 		return retval;
@@ -360,9 +378,7 @@ static void *exec_composite_node(void *nodeexec_v)
 	
 	node_get_stack(node, thd->stack, nsin, nsout);
 	
-	if((node->flag & NODE_MUTED) && node->typeinfo->mutefunc)
-		node->typeinfo->mutefunc(thd->rd, 0, node, nodeexec->data, nsin, nsout);
-	else if(node->typeinfo->execfunc)
+	if (node->typeinfo->execfunc)
 		node->typeinfo->execfunc(thd->rd, node, nsin, nsout);
 	else if (node->typeinfo->newexecfunc)
 		node->typeinfo->newexecfunc(thd->rd, 0, node, nodeexec->data, nsin, nsout);
@@ -383,13 +399,13 @@ static int setExecutableNodes(bNodeTreeExec *exec, ThreadData *thd)
 	int n, totnode= 0, group_edit= 0;
 	
 	/* if we are in group edit, viewer nodes get skipped when group has viewer */
-	for(node= ntree->nodes.first; node; node= node->next)
-		if(node->type==NODE_GROUP && (node->flag & NODE_GROUP_EDIT))
-			if(ntreeHasType((bNodeTree *)node->id, CMP_NODE_VIEWER))
+	for (node= ntree->nodes.first; node; node= node->next)
+		if (node->type==NODE_GROUP && (node->flag & NODE_GROUP_EDIT))
+			if (ntreeHasType((bNodeTree *)node->id, CMP_NODE_VIEWER))
 				group_edit= 1;
 	
 	/* NB: using the exec data list here to have valid dependency sort */
-	for(n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+	for (n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
 		int a;
 		node = nodeexec->node;
 		
@@ -397,9 +413,9 @@ static int setExecutableNodes(bNodeTreeExec *exec, ThreadData *thd)
 		
 		/* test the outputs */
 		/* skip value-only nodes (should be in type!) */
-		if(!node_only_value(node)) {
-			for(a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
-				if(nsout[a]->data==NULL && nsout[a]->hasoutput) {
+		if (!node_only_value(node)) {
+			for (a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
+				if (nsout[a]->data==NULL && nsout[a]->hasoutput) {
 					node->need_exec= 1;
 					break;
 				}
@@ -407,18 +423,18 @@ static int setExecutableNodes(bNodeTreeExec *exec, ThreadData *thd)
 		}
 		
 		/* test the inputs */
-		for(a=0, sock= node->inputs.first; sock; sock= sock->next, a++) {
+		for (a=0, sock= node->inputs.first; sock; sock= sock->next, a++) {
 			/* skip viewer nodes in bg render or group edit */
-			if( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER) && (G.background || group_edit))
+			if ( ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER) && (G.background || group_edit))
 				node->need_exec= 0;
 			/* is sock in use? */
-			else if(sock->link) {
+			else if (sock->link) {
 				bNodeLink *link= sock->link;
 				
 				/* this is the test for a cyclic case */
-				if(link->fromnode==NULL || link->tonode==NULL);
-				else if(link->fromnode->level >= link->tonode->level && link->tonode->level!=0xFFF) {
-					if(link->fromnode->need_exec) {
+				if (link->fromnode==NULL || link->tonode==NULL);
+				else if (link->fromnode->level >= link->tonode->level && link->tonode->level!=0xFFF) {
+					if (link->fromnode->need_exec) {
 						node->need_exec= 1;
 						break;
 					}
@@ -430,11 +446,11 @@ static int setExecutableNodes(bNodeTreeExec *exec, ThreadData *thd)
 			}
 		}
 		
-		if(node->need_exec) {
+		if (node->need_exec) {
 			
 			/* free output buffers */
-			for(a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
-				if(nsout[a]->data) {
+			for (a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
+				if (nsout[a]->data) {
 					free_compbuf(nsout[a]->data);
 					nsout[a]->data= NULL;
 				}
@@ -454,11 +470,11 @@ static int setExecutableNodes(bNodeTreeExec *exec, ThreadData *thd)
 	
 	/* last step: set the stack values for only-value nodes */
 	/* just does all now, compared to a full buffer exec this is nothing */
-	if(totnode) {
-		for(n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+	if (totnode) {
+		for (n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
 			node = nodeexec->node;
-			if(node->need_exec==0 && node_only_value(node)) {
-				if(node->typeinfo->execfunc) {
+			if (node->need_exec==0 && node_only_value(node)) {
+				if (node->typeinfo->execfunc) {
 					node_get_stack(node, exec->stack, nsin, nsout);
 					node->typeinfo->execfunc(thd->rd, node, nsin, nsout);
 				}
@@ -483,31 +499,31 @@ static void freeExecutableNode(bNodeTreeExec *exec)
 	int n;
 	
 	/* set exec flag for finished nodes that might need freed */
-	for(node= ntree->nodes.first; node; node= node->next) {
-		if(node->type!=CMP_NODE_R_LAYERS)
-			if(node->exec & NODE_FINISHED)
+	for (node= ntree->nodes.first; node; node= node->next) {
+		if (node->type!=CMP_NODE_R_LAYERS)
+			if (node->exec & NODE_FINISHED)
 				node->exec |= NODE_FREEBUFS;
 	}
 	/* clear this flag for input links that are not done yet.
 	 * Using the exec data for valid dependency sort.
 	 */
-	for(n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+	for (n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
 		node = nodeexec->node;
-		if((node->exec & NODE_FINISHED)==0) {
-			for(sock= node->inputs.first; sock; sock= sock->next)
-				if(sock->link)
+		if ((node->exec & NODE_FINISHED)==0) {
+			for (sock= node->inputs.first; sock; sock= sock->next)
+				if (sock->link)
 					sock->link->fromnode->exec &= ~NODE_FREEBUFS;
 		}
 	}
 	/* now we can free buffers */
-	for(node= ntree->nodes.first; node; node= node->next) {
-		if(node->exec & NODE_FREEBUFS) {
-			for(sock= node->outputs.first; sock; sock= sock->next) {
+	for (node= ntree->nodes.first; node; node= node->next) {
+		if (node->exec & NODE_FREEBUFS) {
+			for (sock= node->outputs.first; sock; sock= sock->next) {
 				bNodeStack *ns= node_get_socket_stack(exec->stack, sock);
-				if(ns && ns->data) {
+				if (ns && ns->data) {
 					free_compbuf(ns->data);
 					ns->data= NULL;
-					// printf("freed buf node %s \n", node->name);
+					// printf("freed buf node %s\n", node->name);
 				}
 			}
 		}
@@ -520,15 +536,15 @@ static bNodeExec *getExecutableNode(bNodeTreeExec *exec)
 	bNodeSocket *sock;
 	int n;
 	
-	for(n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
-		if(nodeexec->node->exec==0) {
+	for (n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+		if (nodeexec->node->exec==0) {
 			/* input sockets should be ready */
-			for(sock= nodeexec->node->inputs.first; sock; sock= sock->next) {
-				if(sock->link && sock->link->fromnode)
-					if((sock->link->fromnode->exec & NODE_READY)==0)
+			for (sock= nodeexec->node->inputs.first; sock; sock= sock->next) {
+				if (sock->link && sock->link->fromnode)
+					if ((sock->link->fromnode->exec & NODE_READY)==0)
 						break;
 			}
-			if(sock==NULL)
+			if (sock==NULL)
 				return nodeexec;
 		}
 	}
@@ -540,12 +556,12 @@ static  void ntree_composite_texnode(bNodeTree *ntree, int init)
 {
 	bNode *node;
 	
-	for(node= ntree->nodes.first; node; node= node->next) {
-		if(node->type==CMP_NODE_TEXTURE && node->id) {
+	for (node= ntree->nodes.first; node; node= node->next) {
+		if (node->type==CMP_NODE_TEXTURE && node->id) {
 			Tex *tex= (Tex *)node->id;
-			if(tex->nodetree && tex->use_nodes) {
+			if (tex->nodetree && tex->use_nodes) {
 				/* has internal flag to detect it only does it once */
-				if(init) {
+				if (init) {
 					if (!tex->nodetree->execdata)
 						tex->nodetree->execdata = ntreeTexBeginExecTree(tex->nodetree, 1); 
 				}
@@ -566,11 +582,13 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
 	ListBase threads;
 	ThreadData thdata;
 	int totnode, curnode, rendering= 1, n;
-	bNodeTreeExec *exec= ntree->execdata;
-	
-	if(ntree==NULL) return;
-	
-	if(do_preview)
+	bNodeTreeExec *exec;
+
+	if (ntree==NULL) return;
+
+	exec = ntree->execdata;
+
+	if (do_preview)
 		ntreeInitPreview(ntree, 0, 0);
 	
 	if (!ntree->execdata) {
@@ -580,7 +598,7 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
 	ntree_composite_texnode(ntree, 1);
 	
 	/* prevent unlucky accidents */
-	if(G.background)
+	if (G.background)
 		rd->scemode &= ~R_COMP_CROP;
 	
 	/* setup callerdata for thread callback */
@@ -595,15 +613,15 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
 
 	BLI_init_threads(&threads, exec_composite_node, rd->threads);
 	
-	while(rendering) {
+	while (rendering) {
 		
-		if(BLI_available_threads(&threads)) {
+		if (BLI_available_threads(&threads)) {
 			nodeexec= getExecutableNode(exec);
-			if(nodeexec) {
+			if (nodeexec) {
 				node = nodeexec->node;
-				if(ntree->progress && totnode)
+				if (ntree->progress && totnode)
 					ntree->progress(ntree->prh, (1.0f - curnode/(float)totnode));
-				if(ntree->stats_draw) {
+				if (ntree->stats_draw) {
 					char str[128];
 					BLI_snprintf(str, sizeof(str), "Compositing %d %s", curnode, node->name);
 					ntree->stats_draw(ntree->sdh, str);
@@ -622,21 +640,21 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
 		
 		rendering= 0;
 		/* test for ESC */
-		if(ntree->test_break && ntree->test_break(ntree->tbh)) {
-			for(node= ntree->nodes.first; node; node= node->next)
+		if (ntree->test_break && ntree->test_break(ntree->tbh)) {
+			for (node= ntree->nodes.first; node; node= node->next)
 				node->exec |= NODE_READY;
 		}
 		
 		/* check for ready ones, and if we need to continue */
-		for(n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+		for (n=0, nodeexec=exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
 			node = nodeexec->node;
-			if(node->exec & NODE_READY) {
-				if((node->exec & NODE_FINISHED)==0) {
+			if (node->exec & NODE_READY) {
+				if ((node->exec & NODE_FINISHED)==0) {
 					BLI_remove_thread(&threads, nodeexec); /* this waits for running thread to finish btw */
 					node->exec |= NODE_FINISHED;
 					
 					/* freeing unused buffers */
-					if(rd->scemode & R_COMP_FREE)
+					if (rd->scemode & R_COMP_FREE)
 						freeExecutableNode(exec);
 				}
 			}
@@ -657,10 +675,10 @@ static void force_hidden_passes(bNode *node, int passflag)
 {
 	bNodeSocket *sock;
 	
-	for(sock= node->outputs.first; sock; sock= sock->next)
+	for (sock= node->outputs.first; sock; sock= sock->next)
 		sock->flag &= ~SOCK_UNAVAIL;
 	
-	if(!(passflag & SCE_PASS_COMBINED)) {
+	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);
@@ -668,60 +686,60 @@ static void force_hidden_passes(bNode *node, int passflag)
 	}
 	
 	sock= BLI_findlink(&node->outputs, RRES_OUT_Z);
-	if(!(passflag & SCE_PASS_Z)) sock->flag |= SOCK_UNAVAIL;
+	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;
+	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;
+	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;
+	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;
+	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;
+	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;
+	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;
+	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;
+	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;
+	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;
+	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;
+	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;
+	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;
+	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;
+	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;
+	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;
+	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;
+	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;
+	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;
+	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;
+	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;
+	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;
+	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;
+	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;
+	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;
+	if (!(passflag & SCE_PASS_TRANSM_COLOR)) sock->flag |= SOCK_UNAVAIL;
 	sock= BLI_findlink(&node->outputs, RRES_OUT_TRANSM_COLOR);
 }
 
@@ -730,35 +748,23 @@ void ntreeCompositForceHidden(bNodeTree *ntree, Scene *curscene)
 {
 	bNode *node;
 	
-	if(ntree==NULL) return;
+	if (ntree==NULL) return;
 	
-	for(node= ntree->nodes.first; node; node= node->next) {
-		if( node->type==CMP_NODE_R_LAYERS) {
+	for (node= ntree->nodes.first; node; node= node->next) {
+		if ( node->type==CMP_NODE_R_LAYERS) {
 			Scene *sce= node->id?(Scene *)node->id:curscene;
 			SceneRenderLayer *srl= BLI_findlink(&sce->r.layers, node->custom1);
-			if(srl)
+			if (srl)
 				force_hidden_passes(node, srl->passflag);
 		}
-		else if( node->type==CMP_NODE_IMAGE) {
-			Image *ima= (Image *)node->id;
-			if(ima) {
-				if(ima->rr) {
-					ImageUser *iuser= node->storage;
-					RenderLayer *rl= BLI_findlink(&ima->rr->layers, iuser->layer);
-					if(rl)
-						force_hidden_passes(node, rl->passflag);
-					else
-						force_hidden_passes(node, RRES_OUT_IMAGE|RRES_OUT_ALPHA);
-				}
-				else if(ima->type!=IMA_TYPE_MULTILAYER) {	/* if ->rr not yet read we keep inputs */
-					force_hidden_passes(node, RRES_OUT_IMAGE|RRES_OUT_ALPHA|RRES_OUT_Z);
-				}
-				else
-					force_hidden_passes(node, RRES_OUT_IMAGE|RRES_OUT_ALPHA);
-			}
-			else
-				force_hidden_passes(node, RRES_OUT_IMAGE|RRES_OUT_ALPHA);
+		/* XXX this stuff is called all the time, don't want that.
+		 * Updates should only happen when actually necessary.
+		 */
+		#if 0
+		else if ( node->type==CMP_NODE_IMAGE) {
+			nodeUpdate(ntree, node);
 		}
+		#endif
 	}
 
 }
@@ -769,14 +775,14 @@ void ntreeCompositTagRender(Scene *curscene)
 {
 	Scene *sce;
 	
-	for(sce= G.main->scene.first; sce; sce= sce->id.next) {
-		if(sce->nodetree) {
+	for (sce= G.main->scene.first; sce; sce= sce->id.next) {
+		if (sce->nodetree) {
 			bNode *node;
 			
-			for(node= sce->nodetree->nodes.first; node; node= node->next) {
-				if(node->id==(ID *)curscene || node->type==CMP_NODE_COMPOSITE)
+			for (node= sce->nodetree->nodes.first; node; node= node->next) {
+				if (node->id==(ID *)curscene || node->type==CMP_NODE_COMPOSITE)
 					nodeUpdate(sce->nodetree, node);
-				else if(node->type==CMP_NODE_TEXTURE) /* uses scene sizex/sizey */
+				else if (node->type==CMP_NODE_TEXTURE) /* uses scene sizex/sizey */
 					nodeUpdate(sce->nodetree, node);
 			}
 		}
@@ -838,31 +844,31 @@ int ntreeCompositTagAnimated(bNodeTree *ntree)
 	bNode *node;
 	int tagged= 0;
 	
-	if(ntree==NULL) return 0;
+	if (ntree==NULL) return 0;
 	
-	for(node= ntree->nodes.first; node; node= node->next) {
+	for (node= ntree->nodes.first; node; node= node->next) {
 		
 		tagged = node_animation_properties(ntree, node);
 		
 		/* otherwise always tag these node types */
-		if(node->type==CMP_NODE_IMAGE) {
+		if (node->type==CMP_NODE_IMAGE) {
 			Image *ima= (Image *)node->id;
-			if(ima && ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
+			if (ima && ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
 				nodeUpdate(ntree, node);
 				tagged= 1;
 			}
 		}
-		else if(node->type==CMP_NODE_TIME) {
+		else if (node->type==CMP_NODE_TIME) {
 			nodeUpdate(ntree, node);
 			tagged= 1;
 		}
 		/* here was tag render layer, but this is called after a render, so re-composites fail */
-		else if(node->type==NODE_GROUP) {
-			if( ntreeCompositTagAnimated((bNodeTree *)node->id) ) {
+		else if (node->type==NODE_GROUP) {
+			if ( ntreeCompositTagAnimated((bNodeTree *)node->id) ) {
 				nodeUpdate(ntree, node);
 			}
 		}
-		else if(ELEM(node->type, CMP_NODE_MOVIECLIP, CMP_NODE_TRANSFORM)) {
+		else if (ELEM(node->type, CMP_NODE_MOVIECLIP, CMP_NODE_TRANSFORM)) {
 			nodeUpdate(ntree, node);
 			tagged= 1;
 		}
@@ -877,10 +883,10 @@ void ntreeCompositTagGenerators(bNodeTree *ntree)
 {
 	bNode *node;
 	
-	if(ntree==NULL) return;
+	if (ntree==NULL) return;
 	
-	for(node= ntree->nodes.first; node; node= node->next) {
-		if( ELEM(node->type, CMP_NODE_R_LAYERS, CMP_NODE_IMAGE))
+	for (node= ntree->nodes.first; node; node= node->next) {
+		if ( ELEM(node->type, CMP_NODE_R_LAYERS, CMP_NODE_IMAGE))
 			nodeUpdate(ntree, node);
 	}
 }
@@ -890,11 +896,11 @@ void ntreeCompositClearTags(bNodeTree *ntree)
 {
 	bNode *node;
 	
-	if(ntree==NULL) return;
+	if (ntree==NULL) return;
 	
-	for(node= ntree->nodes.first; node; node= node->next) {
+	for (node= ntree->nodes.first; node; node= node->next) {
 		node->need_exec= 0;
-		if(node->type==NODE_GROUP)
+		if (node->type==NODE_GROUP)
 			ntreeCompositClearTags((bNodeTree *)node->id);
 	}
 }
diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c
index 45f4907..ab3a363 100644
--- a/source/blender/nodes/composite/node_composite_util.c
+++ b/source/blender/nodes/composite/node_composite_util.c
@@ -42,21 +42,21 @@ CompBuf *alloc_compbuf(int sizex, int sizey, int type, int alloc)
 	cbuf->yrad= sizey/2;
 	
 	cbuf->type= type;
-	if(alloc) {
-		if(cbuf->type==CB_RGBA)
+	if (alloc) {
+		if (cbuf->type==CB_RGBA)
 			cbuf->rect= MEM_mapallocN(4*sizeof(float)*sizex*sizey, "compbuf RGBA rect");
-		else if(cbuf->type==CB_VEC3)
+		else if (cbuf->type==CB_VEC3)
 			cbuf->rect= MEM_mapallocN(3*sizeof(float)*sizex*sizey, "compbuf Vector3 rect");
-		else if(cbuf->type==CB_VEC2)
+		else if (cbuf->type==CB_VEC2)
 			cbuf->rect= MEM_mapallocN(2*sizeof(float)*sizex*sizey, "compbuf Vector2 rect");
 		else
 			cbuf->rect= MEM_mapallocN(sizeof(float)*sizex*sizey, "compbuf Fac rect");
 		cbuf->malloc= 1;
 	}
-	cbuf->disprect.xmin= 0;
-	cbuf->disprect.ymin= 0;
-	cbuf->disprect.xmax= sizex;
-	cbuf->disprect.ymax= sizey;
+	cbuf->disprect.xmin = 0;
+	cbuf->disprect.ymin = 0;
+	cbuf->disprect.xmax = sizex;
+	cbuf->disprect.ymax = sizey;
 	
 	return cbuf;
 }
@@ -64,7 +64,7 @@ CompBuf *alloc_compbuf(int sizex, int sizey, int type, int alloc)
 CompBuf *dupalloc_compbuf(CompBuf *cbuf)
 {
 	CompBuf *dupbuf= alloc_compbuf(cbuf->x, cbuf->y, cbuf->type, 1);
-	if(dupbuf) {
+	if (dupbuf) {
 		memcpy(dupbuf->rect, cbuf->rect, cbuf->type*sizeof(float)*cbuf->x*cbuf->y);
 	
 		dupbuf->xof= cbuf->xof;
@@ -79,15 +79,15 @@ CompBuf *pass_on_compbuf(CompBuf *cbuf)
 	CompBuf *dupbuf= (cbuf)? alloc_compbuf(cbuf->x, cbuf->y, cbuf->type, 0): NULL;
 	CompBuf *lastbuf;
 	
-	if(dupbuf) {
+	if (dupbuf) {
 		dupbuf->rect= cbuf->rect;
 		dupbuf->xof= cbuf->xof;
 		dupbuf->yof= cbuf->yof;
 		dupbuf->malloc= 0;
 		
 		/* get last buffer in list, and append dupbuf */
-		for(lastbuf= cbuf; lastbuf; lastbuf= lastbuf->next)
-			if(lastbuf->next==NULL)
+		for (lastbuf= cbuf; lastbuf; lastbuf= lastbuf->next)
+			if (lastbuf->next==NULL)
 				break;
 		lastbuf->next= dupbuf;
 		dupbuf->prev= lastbuf;
@@ -99,13 +99,13 @@ CompBuf *pass_on_compbuf(CompBuf *cbuf)
 void free_compbuf(CompBuf *cbuf)
 {
 	/* check referencing, then remove from list and set malloc tag */
-	if(cbuf->prev || cbuf->next) {
-		if(cbuf->prev)
+	if (cbuf->prev || cbuf->next) {
+		if (cbuf->prev)
 			cbuf->prev->next= cbuf->next;
-		if(cbuf->next)
+		if (cbuf->next)
 			cbuf->next->prev= cbuf->prev;
-		if(cbuf->malloc) {
-			if(cbuf->prev)
+		if (cbuf->malloc) {
+			if (cbuf->prev)
 				cbuf->prev->malloc= 1;
 			else
 				cbuf->next->malloc= 1;
@@ -113,7 +113,7 @@ void free_compbuf(CompBuf *cbuf)
 		}
 	}
 	
-	if(cbuf->malloc && cbuf->rect)
+	if (cbuf->malloc && cbuf->rect)
 		MEM_freeN(cbuf->rect);
 
 	MEM_freeN(cbuf);
@@ -130,32 +130,6 @@ void compbuf_set_node(CompBuf *cbuf, bNode *node)
 	if (cbuf) cbuf->node = node;
 }
 
-/* used for disabling node  (similar code in node_draw.c for disable line and node_edit for untangling nodes) */
-void node_compo_pass_on(void *UNUSED(data), int UNUSED(thread), struct bNode *node, void *UNUSED(nodedata),
-                        struct bNodeStack **in, struct bNodeStack **out)
-{
-	ListBase links;
-	LinkInOutsMuteNode *lnk;
-	int i;
-
-	if(node->typeinfo->mutelinksfunc == NULL)
-		return;
-
-	/* Get default muting links (as bNodeStack pointers). */
-	links = node->typeinfo->mutelinksfunc(NULL, node, in, out, NULL, NULL);
-
-	for(lnk = links.first; lnk; lnk = lnk->next) {
-		for(i = 0; i < lnk->num_outs; i++) {
-			if(((bNodeStack*)(lnk->in))->data)
-				(((bNodeStack*)(lnk->outs))+i)->data = pass_on_compbuf((CompBuf*)((bNodeStack*)(lnk->in))->data);
-		}
-		/* If num_outs > 1, lnk->outs was an allocated table of pointers... */
-		if(i > 1)
-			MEM_freeN(lnk->outs);
-	}
-	BLI_freelistN(&links);
-}
-
 
 CompBuf *get_cropped_compbuf(rcti *drect, float *rectf, int rectx, int recty, int type)
 {
@@ -164,16 +138,16 @@ CompBuf *get_cropped_compbuf(rcti *drect, float *rectf, int rectx, int recty, in
 	float *outfp;
 	int dx, y;
 	
-	if(disprect.xmax>rectx) disprect.xmax= rectx;
-	if(disprect.ymax>recty) disprect.ymax= recty;
-	if(disprect.xmin>= disprect.xmax) return NULL;
-	if(disprect.ymin>= disprect.ymax) return NULL;
+	if (disprect.xmax>rectx) disprect.xmax = rectx;
+	if (disprect.ymax>recty) disprect.ymax = recty;
+	if (disprect.xmin>= disprect.xmax) return NULL;
+	if (disprect.ymin>= disprect.ymax) return NULL;
 	
 	cbuf= alloc_compbuf(disprect.xmax-disprect.xmin, disprect.ymax-disprect.ymin, type, 1);
 	outfp= cbuf->rect;
 	rectf += type*(disprect.ymin*rectx + disprect.xmin);
 	dx= type*cbuf->x;
-	for(y=cbuf->y; y>0; y--, outfp+=dx, rectf+=type*rectx)
+	for (y=cbuf->y; y>0; y--, outfp+=dx, rectf+=type*rectx)
 		memcpy(outfp, rectf, sizeof(float)*dx);
 	
 	return cbuf;
@@ -186,7 +160,7 @@ CompBuf *scalefast_compbuf(CompBuf *inbuf, int newx, int newy)
 	int x, y, c, pixsize= inbuf->type;
 	int ofsx, ofsy, stepx, stepy;
 	
-	if(inbuf->x==newx && inbuf->y==newy)
+	if (inbuf->x==newx && inbuf->y==newy)
 		return dupalloc_compbuf(inbuf);
 	
 	outbuf= alloc_compbuf(newx, newy, inbuf->type, 1);
@@ -196,7 +170,7 @@ CompBuf *scalefast_compbuf(CompBuf *inbuf, int newx, int newy)
 	stepy = (65536.0 * (inbuf->y - 1.0) / (newy - 1.0)) + 0.5;
 	ofsy = 32768;
 	
-	for (y = newy; y > 0 ; y--){
+	for (y = newy; y > 0 ; y--) {
 		rectf = inbuf->rect;
 		rectf += pixsize * (ofsy >> 16) * inbuf->x;
 
@@ -206,7 +180,7 @@ CompBuf *scalefast_compbuf(CompBuf *inbuf, int newx, int newy)
 		for (x = newx ; x>0 ; x--) {
 			
 			rf= rectf + pixsize*(ofsx >> 16);
-			for(c=0; c<pixsize; c++)
+			for (c=0; c<pixsize; c++)
 				newrectf[c] = rf[c];
 			
 			newrectf+= pixsize;
@@ -220,65 +194,65 @@ CompBuf *scalefast_compbuf(CompBuf *inbuf, int newx, int newy)
 
 void typecheck_compbuf_color(float *out, float *in, int outtype, int intype)
 {
-	if(intype == outtype) {
+	if (intype == outtype) {
 		memcpy(out, in, sizeof(float)*outtype);
 	}
-	else if(outtype==CB_VAL) {
-		if(intype==CB_VEC2) {
+	else if (outtype==CB_VAL) {
+		if (intype==CB_VEC2) {
 			*out= 0.5f*(in[0]+in[1]);
 		}
-		else if(intype==CB_VEC3) {
+		else if (intype==CB_VEC3) {
 			*out= 0.333333f*(in[0]+in[1]+in[2]);
 		}
-		else if(intype==CB_RGBA) {
+		else if (intype==CB_RGBA) {
 			*out= in[0]*0.35f + in[1]*0.45f + in[2]*0.2f;
 		}
 	}
-	else if(outtype==CB_VEC2) {
-		if(intype==CB_VAL) {
+	else if (outtype==CB_VEC2) {
+		if (intype==CB_VAL) {
 			out[0]= in[0];
 			out[1]= in[0];
 		}
-		else if(intype==CB_VEC3) {
+		else if (intype==CB_VEC3) {
 			out[0]= in[0];
 			out[1]= in[1];
 		}
-		else if(intype==CB_RGBA) {
+		else if (intype==CB_RGBA) {
 			out[0]= in[0];
 			out[1]= in[1];
 		}
 	}
-	else if(outtype==CB_VEC3) {
-		if(intype==CB_VAL) {
+	else if (outtype==CB_VEC3) {
+		if (intype==CB_VAL) {
 			out[0]= in[0];
 			out[1]= in[0];
 			out[2]= in[0];
 		}
-		else if(intype==CB_VEC2) {
+		else if (intype==CB_VEC2) {
 			out[0]= in[0];
 			out[1]= in[1];
 			out[2]= 0.0f;
 		}
-		else if(intype==CB_RGBA) {
+		else if (intype==CB_RGBA) {
 			out[0]= in[0];
 			out[1]= in[1];
 			out[2]= in[2];
 		}
 	}
-	else if(outtype==CB_RGBA) {
-		if(intype==CB_VAL) {
+	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;
 		}
-		else if(intype==CB_VEC2) {
+		else if (intype==CB_VEC2) {
 			out[0]= in[0];
 			out[1]= in[1];
 			out[2]= 0.0f;
 			out[3]= 1.0f;
 		}
-		else if(intype==CB_VEC3) {
+		else if (intype==CB_VEC3) {
 			out[0]= in[0];
 			out[1]= in[1];
 			out[2]= in[2];
@@ -289,7 +263,7 @@ void typecheck_compbuf_color(float *out, float *in, int outtype, int intype)
 
 CompBuf *typecheck_compbuf(CompBuf *inbuf, int type)
 {
-	if(inbuf && inbuf->type!=type) {
+	if (inbuf && inbuf->type!=type) {
 		CompBuf *outbuf;
 		float *inrf, *outrf;
 		int x;
@@ -300,7 +274,7 @@ CompBuf *typecheck_compbuf(CompBuf *inbuf, int type)
 		outbuf->xof= inbuf->xof;
 		outbuf->yof= inbuf->yof;
 
-		if(inbuf->rect_procedural) {
+		if (inbuf->rect_procedural) {
 			outbuf->rect_procedural= inbuf->rect_procedural;
 			copy_v3_v3(outbuf->procedural_size, inbuf->procedural_size);
 			copy_v3_v3(outbuf->procedural_offset, inbuf->procedural_offset);
@@ -313,82 +287,82 @@ CompBuf *typecheck_compbuf(CompBuf *inbuf, int type)
 		outrf= outbuf->rect;
 		x= inbuf->x*inbuf->y;
 		
-		if(type==CB_VAL) {
-			if(inbuf->type==CB_VEC2) {
-				for(; x>0; x--, outrf+= 1, inrf+= 2)
+		if (type==CB_VAL) {
+			if (inbuf->type==CB_VEC2) {
+				for (; x>0; x--, outrf+= 1, inrf+= 2)
 					*outrf= 0.5f*(inrf[0]+inrf[1]);
 			}
-			else if(inbuf->type==CB_VEC3) {
-				for(; x>0; x--, outrf+= 1, inrf+= 3)
+			else if (inbuf->type==CB_VEC3) {
+				for (; x>0; x--, outrf+= 1, inrf+= 3)
 					*outrf= 0.333333f*(inrf[0]+inrf[1]+inrf[2]);
 			}
-			else if(inbuf->type==CB_RGBA) {
-				for(; x>0; x--, outrf+= 1, inrf+= 4)
+			else if (inbuf->type==CB_RGBA) {
+				for (; x>0; x--, outrf+= 1, inrf+= 4)
 					*outrf= inrf[0]*0.35f + inrf[1]*0.45f + inrf[2]*0.2f;
 			}
 		}
-		else if(type==CB_VEC2) {
-			if(inbuf->type==CB_VAL) {
-				for(; x>0; x--, outrf+= 2, inrf+= 1) {
+		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];
 				}
 			}
-			else if(inbuf->type==CB_VEC3) {
-				for(; x>0; x--, outrf+= 2, inrf+= 3) {
+			else if (inbuf->type==CB_VEC3) {
+				for (; x>0; x--, outrf+= 2, inrf+= 3) {
 					outrf[0]= inrf[0];
 					outrf[1]= inrf[1];
 				}
 			}
-			else if(inbuf->type==CB_RGBA) {
-				for(; x>0; x--, outrf+= 2, inrf+= 4) {
+			else if (inbuf->type==CB_RGBA) {
+				for (; x>0; x--, outrf+= 2, inrf+= 4) {
 					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) {
+		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];
 				}
 			}
-			else if(inbuf->type==CB_VEC2) {
-				for(; x>0; x--, outrf+= 3, inrf+= 2) {
+			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;
 				}
 			}
-			else if(inbuf->type==CB_RGBA) {
-				for(; x>0; x--, outrf+= 3, inrf+= 4) {
+			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];
 				}
 			}
 		}
-		else if(type==CB_RGBA) {
-			if(inbuf->type==CB_VAL) {
-				for(; x>0; x--, outrf+= 4, inrf+= 1) {
+		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;
 				}
 			}
-			else if(inbuf->type==CB_VEC2) {
-				for(; x>0; x--, outrf+= 4, inrf+= 2) {
+			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;
 				}
 			}
-			else if(inbuf->type==CB_VEC3) {
-				for(; x>0; x--, outrf+= 4, inrf+= 3) {
+			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];
@@ -404,8 +378,8 @@ CompBuf *typecheck_compbuf(CompBuf *inbuf, int type)
 
 float *compbuf_get_pixel(CompBuf *cbuf, float *defcol, float *use, int x, int y, int xrad, int yrad)
 {
-	if(cbuf) {
-		if(cbuf->rect_procedural) {
+	if (cbuf) {
+		if (cbuf->rect_procedural) {
 			cbuf->rect_procedural(cbuf, use, (float)x/(float)xrad, (float)y/(float)yrad);
 			return use;
 		}
@@ -416,8 +390,8 @@ float *compbuf_get_pixel(CompBuf *cbuf, float *defcol, float *use, int x, int y,
 			x-= cbuf->xof;
 			y-= cbuf->yof;
 			
-			if(y<-cbuf->yrad || y>= -cbuf->yrad+cbuf->y) return col;
-			if(x<-cbuf->xrad || x>= -cbuf->xrad+cbuf->x) return col;
+			if (y<-cbuf->yrad || y>= -cbuf->yrad+cbuf->y) return col;
+			if (x<-cbuf->xrad || x>= -cbuf->xrad+cbuf->x) return col;
 			
 			return cbuf->rect + cbuf->type*( (cbuf->yrad+y)*cbuf->x + (cbuf->xrad+x) );
 		}
@@ -433,7 +407,7 @@ static CompBuf *composit_check_compbuf(CompBuf *cbuf, int type, CompBuf *outbuf)
 	CompBuf *dbuf= typecheck_compbuf(cbuf, type);
 
 	/* if same as output and translated, duplicate so pixels don't interfere */
-	if(dbuf == outbuf && !dbuf->rect_procedural && (dbuf->xof || dbuf->yof))
+	if (dbuf == outbuf && !dbuf->rect_procedural && (dbuf->xof || dbuf->yof))
 		dbuf= dupalloc_compbuf(dbuf);
 	
 	return dbuf;
@@ -454,14 +428,14 @@ void composit1_pixel_processor(bNode *node, CompBuf *out, CompBuf *src_buf, floa
 	xrad= out->xrad;
 	yrad= out->yrad;
 	
-	for(y= -yrad; y<-yrad+out->y; y++) {
-		for(x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) {
+	for (y= -yrad; y<-yrad+out->y; y++) {
+		for (x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) {
 			srcfp= compbuf_get_pixel(src_use, src_col, color, x, y, xrad, yrad);
 			func(node, outfp, srcfp);
 		}
 	}
 	
-	if(src_use!=src_buf)
+	if (src_use!=src_buf)
 		free_compbuf(src_use);
 }
 
@@ -481,17 +455,17 @@ void composit2_pixel_processor(bNode *node, CompBuf *out, CompBuf *src_buf, floa
 	xrad= out->xrad;
 	yrad= out->yrad;
 	
-	for(y= -yrad; y<-yrad+out->y; y++) {
-		for(x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) {
+	for (y= -yrad; y<-yrad+out->y; y++) {
+		for (x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) {
 			srcfp= compbuf_get_pixel(src_use, src_col, color, x, y, xrad, yrad);
 			facfp= compbuf_get_pixel(fac_use, fac, color, x, y, xrad, yrad);
 			
 			func(node, outfp, srcfp, facfp);
 		}
 	}
-	if(src_use!=src_buf)
+	if (src_use!=src_buf)
 		free_compbuf(src_use);
-	if(fac_use!=fac_buf)
+	if (fac_use!=fac_buf)
 		free_compbuf(fac_use);
 }
 
@@ -512,8 +486,8 @@ void composit3_pixel_processor(bNode *node, CompBuf *out, CompBuf *src1_buf, flo
 	xrad= out->xrad;
 	yrad= out->yrad;
 	
-	for(y= -yrad; y<-yrad+out->y; y++) {
-		for(x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) {
+	for (y= -yrad; y<-yrad+out->y; y++) {
+		for (x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) {
 			src1fp= compbuf_get_pixel(src1_use, src1_col, color, x, y, xrad, yrad);
 			src2fp= compbuf_get_pixel(src2_use, src2_col, color, x, y, xrad, yrad);
 			facfp= compbuf_get_pixel(fac_use, fac, color, x, y, xrad, yrad);
@@ -522,11 +496,11 @@ void composit3_pixel_processor(bNode *node, CompBuf *out, CompBuf *src1_buf, flo
 		}
 	}
 	
-	if(src1_use!=src1_buf)
+	if (src1_use!=src1_buf)
 		free_compbuf(src1_use);
-	if(src2_use!=src2_buf)
+	if (src2_use!=src2_buf)
 		free_compbuf(src2_use);
-	if(fac_use!=fac_buf)
+	if (fac_use!=fac_buf)
 		free_compbuf(fac_use);
 }
 
@@ -549,8 +523,8 @@ void composit4_pixel_processor(bNode *node, CompBuf *out, CompBuf *src1_buf, flo
 	xrad= out->xrad;
 	yrad= out->yrad;
 	
-	for(y= -yrad; y<-yrad+out->y; y++) {
-		for(x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) {
+	for (y= -yrad; y<-yrad+out->y; y++) {
+		for (x= -xrad; x<-xrad+out->x; x++, outfp+=out->type) {
 			src1fp= compbuf_get_pixel(src1_use, src1_col, color, x, y, xrad, yrad);
 			src2fp= compbuf_get_pixel(src2_use, src2_col, color, x, y, xrad, yrad);
 			fac1fp= compbuf_get_pixel(fac1_use, fac1, color, x, y, xrad, yrad);
@@ -560,13 +534,13 @@ void composit4_pixel_processor(bNode *node, CompBuf *out, CompBuf *src1_buf, flo
 		}
 	}
 	
-	if(src1_use!=src1_buf)
+	if (src1_use!=src1_buf)
 		free_compbuf(src1_use);
-	if(src2_use!=src2_buf)
+	if (src2_use!=src2_buf)
 		free_compbuf(src2_use);
-	if(fac1_use!=fac1_buf)
+	if (fac1_use!=fac1_buf)
 		free_compbuf(fac1_use);
-	if(fac2_use!=fac2_buf)
+	if (fac2_use!=fac2_buf)
 		free_compbuf(fac2_use);
 }
 
@@ -588,7 +562,7 @@ CompBuf *valbuf_from_rgbabuf(CompBuf *cbuf, int channel)
 
 	rectf= cbuf->rect + channel;
 	
-	for(tot= cbuf->x*cbuf->y; tot>0; tot--, valf++, rectf+=4)
+	for (tot= cbuf->x*cbuf->y; tot>0; tot--, valf++, rectf+=4)
 		*valf= *rectf;
 	
 	return valbuf;
@@ -606,8 +580,8 @@ static CompBuf *generate_procedural_preview(CompBuf *cbuf, int newx, int newy)
 	xrad= outbuf->xrad;
 	yrad= outbuf->yrad;
 	
-	for(y= -yrad; y<-yrad+outbuf->y; y++)
-		for(x= -xrad; x<-xrad+outbuf->x; x++, outfp+=outbuf->type)
+	for (y= -yrad; y<-yrad+outbuf->y; y++)
+		for (x= -xrad; x<-xrad+outbuf->x; x++, outfp+=outbuf->type)
 			cbuf->rect_procedural(cbuf, outfp, (float)x/(float)xrad, (float)y/(float)yrad);
 
 	return outbuf;
@@ -623,14 +597,14 @@ void generate_preview(void *data, bNode *node, CompBuf *stackbuf)
 	int dither= 0;
 	unsigned char *rect;
 	
-	if(preview && stackbuf) {
+	if (preview && stackbuf) {
 		CompBuf *cbuf, *stackbuf_use;
 		
-		if(stackbuf->rect==NULL && stackbuf->rect_procedural==NULL) return;
+		if (stackbuf->rect==NULL && stackbuf->rect_procedural==NULL) return;
 		
 		stackbuf_use= typecheck_compbuf(stackbuf, CB_RGBA);
 
-		if(stackbuf->x > stackbuf->y) {
+		if (stackbuf->x > stackbuf->y) {
 			xsize= 140;
 			ysize= (140*stackbuf->y)/stackbuf->x;
 		}
@@ -639,7 +613,7 @@ void generate_preview(void *data, bNode *node, CompBuf *stackbuf)
 			xsize= (140*stackbuf->x)/stackbuf->y;
 		}
 		
-		if(stackbuf_use->rect_procedural)
+		if (stackbuf_use->rect_procedural)
 			cbuf= generate_procedural_preview(stackbuf_use, xsize, ysize);
 		else
 			cbuf= scalefast_compbuf(stackbuf_use, xsize, ysize);
@@ -652,12 +626,12 @@ void generate_preview(void *data, bNode *node, CompBuf *stackbuf)
 			xsize, ysize, xsize, xsize);
 		
 		free_compbuf(cbuf);
-		if(stackbuf_use!=stackbuf)
+		if (stackbuf_use!=stackbuf)
 			free_compbuf(stackbuf_use);
 
 		BLI_lock_thread(LOCK_PREVIEW);
 
-		if(preview->rect)
+		if (preview->rect)
 			MEM_freeN(preview->rect);
 		preview->xsize= xsize;
 		preview->ysize= ysize;
@@ -731,21 +705,21 @@ void gamma_correct_compbuf(CompBuf *img, int inversed)
 	float *drect;
 	int x;
 
-	if(img->type!=CB_RGBA) return;
+	if (img->type!=CB_RGBA) return;
 
 	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 (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;
 		}
 	}
 	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;
+		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;
 		}
 	}
 }
@@ -755,12 +729,12 @@ void premul_compbuf(CompBuf *img, int inversed)
 	float *drect;
 	int x;
 
-	if(img->type!=CB_RGBA) return;
+	if (img->type!=CB_RGBA) return;
 
 	drect= img->rect;
-	if(inversed) {
-		for(x=img->x*img->y; x>0; x--, drect+=4) {
-			if(fabsf(drect[3]) < 1e-5f) {
+	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;
@@ -773,7 +747,7 @@ void premul_compbuf(CompBuf *img, int inversed)
 		}
 	}
 	else {
-		for(x=img->x*img->y; x>0; x--, drect+=4) {
+		for (x=img->x*img->y; x>0; x--, drect+=4) {
 			drect[0] *= drect[3];
 			drect[1] *= drect[3];
 			drect[2] *= drect[3];
@@ -907,12 +881,12 @@ static void FHT2D(fREAL *data, unsigned int Mx, unsigned int My,
 	else {  // rectangular
 		unsigned int k, Nym = Ny-1, stm = 1 << (Mx + My);
 		for (i=0; stm>0; i++) {
-			#define pred(k) (((k & Nym) << Mx) + (k >> My))
-			for (j=pred(i); j>i; j=pred(j));
+			#define PRED(k) (((k & Nym) << Mx) + (k >> My))
+			for (j=PRED(i); j>i; j=PRED(j));
 			if (j < i) continue;
-			for (k=i, j=pred(i); j!=i; k=j, j=pred(j), stm--)
+			for (k=i, j=PRED(i); j!=i; k=j, j=PRED(j), stm--)
 				{ t=data[j], data[j]=data[k], data[k]=t; }
-			#undef pred
+			#undef PRED
 			stm--;
 		}
 	}
@@ -1130,11 +1104,11 @@ void convolve(CompBuf* dst, CompBuf* in1, CompBuf* in2)
 // sets fcol to pixelcolor at (x, y)
 void qd_getPixel(CompBuf* src, int x, int y, float* col)
 {
-	if(src->rect_procedural) {
+	if (src->rect_procedural) {
 		float bc[4];
 		src->rect_procedural(src, bc, (float)x/(float)src->xrad, (float)y/(float)src->yrad);
 
-		switch(src->type){
+		switch(src->type) {
 			/* these fallthrough to get all the channels */
 			case CB_RGBA: col[3]=bc[3]; 
 			case CB_VEC3: col[2]=bc[2];
@@ -1144,7 +1118,7 @@ void qd_getPixel(CompBuf* src, int x, int y, float* col)
 	}
 	else if ((x >= 0) && (x < src->x) && (y >= 0) && (y < src->y)) {
 		float* bc = &src->rect[(x + y*src->x)*src->type];
-		switch(src->type){
+		switch(src->type) {
 			/* these fallthrough to get all the channels */
 			case CB_RGBA: col[3]=bc[3]; 
 			case CB_VEC3: col[2]=bc[2];
@@ -1153,7 +1127,7 @@ void qd_getPixel(CompBuf* src, int x, int y, float* col)
 		}
 	}
 	else {
-		switch(src->type){
+		switch(src->type) {
 			/* these fallthrough to get all the channels */
 			case CB_RGBA: col[3]=0.0; 
 			case CB_VEC3: col[2]=0.0; 
@@ -1168,7 +1142,7 @@ void qd_setPixel(CompBuf* src, int x, int y, float* col)
 {
 	if ((x >= 0) && (x < src->x) && (y >= 0) && (y < src->y)) {
 		float* bc = &src->rect[(x + y*src->x)*src->type];
-		switch(src->type){
+		switch(src->type) {
 			/* these fallthrough to get all the channels */
 			case CB_RGBA: bc[3]=col[3]; 
 			case CB_VEC3: bc[2]=col[2];
diff --git a/source/blender/nodes/composite/node_composite_util.h b/source/blender/nodes/composite/node_composite_util.h
index 0248793..3efdf76 100644
--- a/source/blender/nodes/composite/node_composite_util.h
+++ b/source/blender/nodes/composite/node_composite_util.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NODE_COMPOSITE_UTIL_H_
-#define NODE_COMPOSITE_UTIL_H_
+#ifndef __NODE_COMPOSITE_UTIL_H__
+#define __NODE_COMPOSITE_UTIL_H__
 
 #include <stdlib.h>
 #include <string.h>
@@ -124,7 +124,6 @@ CompBuf *pass_on_compbuf(CompBuf *cbuf);
 void free_compbuf(CompBuf *cbuf);
 void print_compbuf(char *str, CompBuf *cbuf);
 void compbuf_set_node(struct CompBuf *cbuf, struct bNode *node);
-void node_compo_pass_on(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out);
 
 CompBuf *get_cropped_compbuf(rcti *drect, float *rectf, int rectx, int recty, int type);
 CompBuf *scalefast_compbuf(CompBuf *inbuf, int newx, int newy);
diff --git a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
index 3a783f0..5a716e1 100644
--- a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
+++ b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
@@ -48,10 +48,10 @@ static void do_alphaover_premul(bNode *UNUSED(node), float *out, float *src, flo
 {
 	
 	/* Zero alpha values should still permit an add of RGB data */	
-	if(over[3]<0.0f) {
+	if (over[3]<0.0f) {
 		copy_v4_v4(out, src);
 	}
-	else if(fac[0]==1.0f && over[3]>=1.0f) {
+	else if (fac[0]==1.0f && over[3]>=1.0f) {
 		copy_v4_v4(out, over);
 	}
 	else {
@@ -68,10 +68,10 @@ static void do_alphaover_premul(bNode *UNUSED(node), float *out, float *src, flo
 static void do_alphaover_key(bNode *UNUSED(node), float *out, float *src, float *over, float *fac)
 {
 	
-	if(over[3]<=0.0f) {
+	if (over[3]<=0.0f) {
 		copy_v4_v4(out, src);
 	}
-	else if(fac[0]==1.0f && over[3]>=1.0f) {
+	else if (fac[0]==1.0f && over[3]>=1.0f) {
 		copy_v4_v4(out, over);
 	}
 	else {
@@ -89,10 +89,10 @@ static void do_alphaover_key(bNode *UNUSED(node), float *out, float *src, float
 static void do_alphaover_mixed(bNode *node, float *out, float *src, float *over, float *fac)
 {
 	
-	if(over[3]<=0.0f) {
+	if (over[3]<=0.0f) {
 		copy_v4_v4(out, src);
 	}
-	else if(fac[0]==1.0f && over[3]>=1.0f) {
+	else if (fac[0]==1.0f && over[3]>=1.0f) {
 		copy_v4_v4(out, over);
 	}
 	else {
@@ -115,11 +115,11 @@ static void node_composit_exec_alphaover(void *UNUSED(data), bNode *node, bNodeS
 {
 	/* stack order in: col col */
 	/* stack order out: col */
-	if(out[0]->hasoutput==0) 
+	if (out[0]->hasoutput==0) 
 		return;
 	
 	/* input no image? then only color operation */
-	if(in[1]->data==NULL && in[2]->data==NULL) {
+	if (in[1]->data==NULL && in[2]->data==NULL) {
 		do_alphaover_premul(node, out[0]->vec, in[1]->vec, in[2]->vec, in[0]->vec);
 	}
 	else {
@@ -128,9 +128,9 @@ static void node_composit_exec_alphaover(void *UNUSED(data), bNode *node, bNodeS
 		CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* allocs */
 		NodeTwoFloats *ntf= node->storage;
 		
-		if(ntf->x != 0.0f)
+		if (ntf->x != 0.0f)
 			composit3_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[2]->data, in[2]->vec, in[0]->data, in[0]->vec, do_alphaover_mixed, CB_RGBA, CB_RGBA, CB_VAL);
-		else if(node->custom1)
+		else if (node->custom1)
 			composit3_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[2]->data, in[2]->vec, in[0]->data, in[0]->vec, do_alphaover_key, CB_RGBA, CB_RGBA, CB_VAL);
 		else
 			composit3_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[2]->data, in[2]->vec, in[0]->data, in[0]->vec, do_alphaover_premul, CB_RGBA, CB_RGBA, CB_VAL);
diff --git a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c
index c6462e2..f42fd83 100644
--- a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.c
@@ -48,7 +48,8 @@ static bNodeSocketTemplate cmp_node_bilateralblur_out[]= {
 	mean1[0] = src[0];                                                        \
 	mean1[1] = src[1];                                                        \
 	mean1[2] = src[2];                                                        \
-	mean1[3] = src[3];
+	mean1[3] = src[3];                                                        \
+	(void)0
 
 /* finds color distances */
 #define COLOR_DISTANCE_C3(c1, c2)                                             \
@@ -66,25 +67,28 @@ static bNodeSocketTemplate cmp_node_bilateralblur_out[]= {
 		(double)COLOR_DISTANCE_C3(ref, ref_color ) * i2sigma_color;           \
 	w = 1.0/(w*w + 1);                                                        \
 	mean0 += w;                                                               \
-	mean1[0] += (double)temp_color[0]*w;                                      \
-	mean1[1] += (double)temp_color[1]*w;                                      \
-	mean1[2] += (double)temp_color[2]*w;                                      \
-	mean1[3] += (double)temp_color[3]*w;
+	mean1[0] += (double)temp_color[0] * w;                                    \
+	mean1[1] += (double)temp_color[1] * w;                                    \
+	mean1[2] += (double)temp_color[2] * w;                                    \
+	mean1[3] += (double)temp_color[3] * w;                                    \
+	(void)0
 
 /* write blurred values to image */
 #define UPDATE_OUTPUT_C3                                                      \
 	mean0 = 1.0/mean0;                                                        \
-	dest[x*pix + 0] = mean1[0]*mean0;                                         \
-	dest[x*pix + 1] = mean1[1]*mean0;                                         \
-	dest[x*pix + 2] = mean1[2]*mean0;                                         \
-	dest[x*pix + 3] = mean1[3]*mean0;
+	dest[x * pix + 0] = mean1[0] * mean0;                                     \
+	dest[x * pix + 1] = mean1[1] * mean0;                                     \
+	dest[x * pix + 2] = mean1[2] * mean0;                                     \
+	dest[x * pix + 3] = mean1[3] * mean0;                                     \
+	(void)0
 
-/* initializes deltas for fast access to neighbour pixels */
+/* initializes deltas for fast access to neighbor pixels */
 #define INIT_3X3_DELTAS( deltas, step, nch )                                  \
 	((deltas)[0] =  (nch),  (deltas)[1] = -(step) + (nch),                    \
 	 (deltas)[2] = -(step), (deltas)[3] = -(step) - (nch),                    \
 	 (deltas)[4] = -(nch),  (deltas)[5] =  (step) - (nch),                    \
-	 (deltas)[6] =  (step), (deltas)[7] =  (step) + (nch));
+	 (deltas)[6] =  (step), (deltas)[7] =  (step) + (nch));                   \
+	(void)0
 
 
 /* code of this node was heavily inspired by the smooth function of opencv library.
@@ -102,10 +106,10 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN
 	int deltas[8];
 	short found_determinator= 0;
 
-	if(img == NULL || out[0]->hasoutput == 0)
+	if (img == NULL || out[0]->hasoutput == 0)
 		return;
 
-	if(img->type != CB_RGBA) {
+	if (img->type != CB_RGBA) {
 		img= typecheck_compbuf(in[0]->data, CB_RGBA);
 	}
 
@@ -114,9 +118,9 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN
 	pix= img->type;
 	step= pix * imgx;
 
-	if(refimg) {
-		if(refimg->x == imgx && refimg->y == imgy) {
-			if(ELEM3(refimg->type, CB_VAL, CB_VEC2, CB_VEC3)) {
+	if (refimg) {
+		if (refimg->x == imgx && refimg->y == imgy) {
+			if (ELEM3(refimg->type, CB_VAL, CB_VEC2, CB_VEC3)) {
 				refimg= typecheck_compbuf(in[1]->data, CB_RGBA);
 				found_determinator= 1;
 			}
@@ -147,23 +151,23 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN
 	weight_tab[1] = weight_tab[3] = weight_tab[5] = weight_tab[7] = i2sigma_space * 2;
 
 	/* iterations */
-	for(i= 0; i < nbbd->iter; i++) {
+	for (i= 0; i < nbbd->iter; i++) {
 		src= source->rect;
 		ref= refimg->rect;
 		dest= new->rect;
 		/*goes through image, there are more loops for 1st/last line and all other lines*/
 		/*kernel element accumulates surrounding colors, which are then written with the update_output function*/
-		for(x= 0; x < imgx; x++, src+= pix, ref+= pix) {
+		for (x= 0; x < imgx; x++, src+= pix, ref+= pix) {
 			INIT_C3;
 
 			KERNEL_ELEMENT_C3(6);
 
-			if(x > 0) {
+			if (x > 0) {
 				KERNEL_ELEMENT_C3(5);
 				KERNEL_ELEMENT_C3(4);
 			}
 
-			if(x < imgx - 1) {
+			if (x < imgx - 1) {
 				KERNEL_ELEMENT_C3(7);
 				KERNEL_ELEMENT_C3(0);
 			}
@@ -173,7 +177,7 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN
 
 		dest+= step;
 
-		for(y= 1; y < imgy - 1; y++, dest+= step, src+= pix, ref+= pix) {
+		for (y= 1; y < imgy - 1; y++, dest+= step, src+= pix, ref+= pix) {
 			x= 0;
 
 			INIT_C3;
@@ -189,7 +193,7 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN
 			src+= pix;
 			ref+= pix;
 
-			for(x= 1; x < imgx - 1; x++, src+= pix, ref+= pix) {
+			for (x= 1; x < imgx - 1; x++, src+= pix, ref+= pix) {
 				INIT_C3;
 
 				KERNEL_ELEMENT_C3(0);
@@ -215,16 +219,16 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN
 			UPDATE_OUTPUT_C3;
 		}
 
-		for(x= 0; x < imgx; x++, src+= pix, ref+= pix) {
+		for (x= 0; x < imgx; x++, src+= pix, ref+= pix) {
 			INIT_C3;
 
 			KERNEL_ELEMENT_C3(2);
 
-			if(x > 0) {
+			if (x > 0) {
 				KERNEL_ELEMENT_C3(3);
 				KERNEL_ELEMENT_C3(4);
 			}
-			if(x < imgx - 1) {
+			if (x < imgx - 1) {
 				KERNEL_ELEMENT_C3(1);
 				KERNEL_ELEMENT_C3(0);
 			}
@@ -232,16 +236,16 @@ static void node_composit_exec_bilateralblur(void *UNUSED(data), bNode *node, bN
 			UPDATE_OUTPUT_C3;
 		}
 
-		if(node->exec & NODE_BREAK) break;
+		if (node->exec & NODE_BREAK) break;
 
 		SWAP(CompBuf, *source, *new);
 	}
 
-	if(img != in[0]->data)
+	if (img != in[0]->data)
 		free_compbuf(img);
 
-	if(found_determinator == 1) {
-		if(refimg != in[1]->data)
+	if (found_determinator == 1) {
+		if (refimg != in[1]->data)
 			free_compbuf(refimg);
 	}
 
diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c
index fad8072..354bb45 100644
--- a/source/blender/nodes/composite/nodes/node_composite_blur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_blur.c
@@ -61,7 +61,7 @@ static float *make_gausstab(int filtertype, int rad)
 	}
 	
 	sum= 1.0f/sum;
-	for(i=0; i<n; i++)
+	for (i=0; i<n; i++)
 		gausstab[i]*= sum;
 	
 	return gausstab;
@@ -101,14 +101,14 @@ static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float sca
 	work= alloc_compbuf(imgx, imgy, img->type, 1); /* allocs */
 
 	/* horizontal */
-	if(nbd->sizex == 0) {
+	if (nbd->sizex == 0) {
 		memcpy(work->rect, img->rect, sizeof(float) * img->type * imgx * imgy);
 	}
 	else {
 		rad = scale*(float)nbd->sizex;
-		if(rad>imgx/2)
+		if (rad>imgx/2)
 			rad= imgx/2;
-		else if(rad<1) 
+		else if (rad<1)
 			rad= 1;
 		
 		gausstab= make_gausstab(nbd->filtertype, rad);
@@ -130,7 +130,7 @@ static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float sca
 					val= gausstabcent[i];
 					sum+= val;
 					rval += val * (*src++);
-					if(pix==4) {
+					if (pix==4) {
 						gval += val * (*src++);
 						bval += val * (*src++);
 						aval += val * (*src++);
@@ -138,13 +138,13 @@ static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float sca
 				}
 				sum= 1.0f/sum;
 				*dest++ = rval*sum;
-				if(pix==4) {
+				if (pix==4) {
 					*dest++ = gval*sum;
 					*dest++ = bval*sum;
 					*dest++ = aval*sum;
 				}
 			}
-			if(node->exec & NODE_BREAK)
+			if (node->exec & NODE_BREAK)
 				break;
 		}
 		
@@ -152,14 +152,14 @@ static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float sca
 		MEM_freeN(gausstab);
 	}
 	
-	if(nbd->sizey == 0) {
+	if (nbd->sizey == 0) {
 		memcpy(new->rect, work->rect, sizeof(float) * img->type * imgx * imgy);
 	}
 	else {
 		rad = scale*(float)nbd->sizey;
-		if(rad>imgy/2)
+		if (rad>imgy/2)
 			rad= imgy/2;
-		else if(rad<1) 
+		else if (rad<1)
 			rad= 1;
 	
 		gausstab= make_gausstab(nbd->filtertype, rad);
@@ -182,7 +182,7 @@ static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float sca
 					val= gausstabcent[i];
 					sum+= val;
 					rval += val * src[0];
-					if(pix==4) {
+					if (pix==4) {
 						gval += val * src[1];
 						bval += val * src[2];
 						aval += val * src[3];
@@ -191,14 +191,14 @@ static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float sca
 				}
 				sum= 1.0f/sum;
 				dest[0] = rval*sum;
-				if(pix==4) {
+				if (pix==4) {
 					dest[1] = gval*sum;
 					dest[2] = bval*sum;
 					dest[3] = aval*sum;
 				}
 				dest+= bigstep;
 			}
-			if(node->exec & NODE_BREAK)
+			if (node->exec & NODE_BREAK)
 				break;
 		}
 		MEM_freeN(gausstab);
@@ -225,21 +225,21 @@ static void bloom_with_reference(CompBuf *new, CompBuf *img, CompBuf *UNUSED(ref
 	
 	/* horizontal */
 	radx = (float)nbd->sizex;
-	if(radx>imgx/2)
+	if (radx>imgx/2)
 		radx= imgx/2;
-	else if(radx<1) 
+	else if (radx<1)
 		radx= 1;
 	
 	/* vertical */
 	rady = (float)nbd->sizey;
-	if(rady>imgy/2)
+	if (rady>imgy/2)
 		rady= imgy/2;
-	else if(rady<1) 
+	else if (rady<1)
 		rady= 1;
 	
 	x= MAX2(radx, rady);
 	maintabs= MEM_mallocN(x*sizeof(void *), "gauss array");
-	for(i= 0; i<x; i++)
+	for (i= 0; i<x; i++)
 		maintabs[i]= make_bloomtab(i+1);
 		
 	/* vars to store before we go */
@@ -258,12 +258,12 @@ static void bloom_with_reference(CompBuf *new, CompBuf *img, CompBuf *UNUSED(ref
 			int refradx= (int)(radxf*0.3f*src[3]*(src[0]+src[1]+src[2]));
 			int refrady= (int)(radyf*0.3f*src[3]*(src[0]+src[1]+src[2]));
 			
-			if(refradx>radx) refradx= radx;
-			else if(refradx<1) refradx= 1;
-			if(refrady>rady) refrady= rady;
-			else if(refrady<1) refrady= 1;
+			if (refradx>radx) refradx= radx;
+			else if (refradx<1) refradx= 1;
+			if (refrady>rady) refrady= rady;
+			else if (refrady<1) refrady= 1;
 			
-			if(refradx==1 && refrady==1) {
+			if (refradx==1 && refrady==1) {
 				wb= wbuf->rect + ( y*imgx + x);
 				dest= new->rect + 4*( y*imgx + x);
 				wb[0]+= 1.0f;
@@ -306,7 +306,7 @@ static void bloom_with_reference(CompBuf *new, CompBuf *img, CompBuf *UNUSED(ref
 	x= imgx*imgy;
 	dest= new->rect;
 	wb= wbuf->rect;
-	while(x--) {
+	while (x--) {
 		val= 1.0f/wb[0];
 		dest[0]*= val;
 		dest[1]*= val;
@@ -319,7 +319,7 @@ static void bloom_with_reference(CompBuf *new, CompBuf *img, CompBuf *UNUSED(ref
 	free_compbuf(wbuf);
 	
 	x= MAX2(radx, rady);
-	for(i= 0; i<x; i++)
+	for (i= 0; i<x; i++)
 		MEM_freeN(maintabs[i]);
 	MEM_freeN(maintabs);
 	
@@ -331,9 +331,9 @@ static float hexagon_filter(float fi, float fj)
 	fi= fabs(fi);
 	fj= fabs(fj);
 	
-	if(fj>0.33f) {
+	if (fj>0.33f) {
 		fj= (fj-0.33f)/0.66f;
-		if(fi+fj>1.0f)
+		if (fi+fj>1.0f)
 			return 0.0f;
 		else
 			return 1.0f;
@@ -357,16 +357,16 @@ static void bokeh_single_image(bNode *node, CompBuf *new, CompBuf *img, float fa
 	
 	/* horizontal */
 	radxf = fac*(float)nbd->sizex;
-	if(radxf>imgx/2.0f)
+	if (radxf>imgx/2.0f)
 		radxf= imgx/2.0f;
-	else if(radxf<1.0f) 
+	else if (radxf<1.0f)
 		radxf= 1.0f;
 	
 	/* vertical */
 	radyf = fac*(float)nbd->sizey;
-	if(radyf>imgy/2.0f)
+	if (radyf>imgy/2.0f)
 		radyf= imgy/2.0f;
-	else if(radyf<1.0f) 
+	else if (radyf<1.0f)
 		radyf= 1.0f;
 	
 	radx= ceil(radxf);
@@ -378,8 +378,8 @@ static void bokeh_single_image(bNode *node, CompBuf *new, CompBuf *img, float fa
 	gausstab= MEM_mallocN(sizeof(float)*n, "filter tab");
 	dgauss= gausstab;
 	val= 0.0f;
-	for(j=-rady; j<=rady; j++) {
-		for(i=-radx; i<=radx; i++, dgauss++) {
+	for (j=-rady; j<=rady; j++) {
+		for (i=-radx; i<=radx; i++, dgauss++) {
 			float fj= (float)j/radyf;
 			float fi= (float)i/radxf;
 			float dist= sqrt(fj*fj + fi*fi);
@@ -391,17 +391,17 @@ static void bokeh_single_image(bNode *node, CompBuf *new, CompBuf *img, float fa
 		}
 	}
 
-	if(val!=0.0f) {
+	if (val!=0.0f) {
 		val= 1.0f/val;
-		for(j= n -1; j>=0; j--)
+		for (j= n -1; j>=0; j--)
 			gausstab[j]*= val;
 	}
 	else gausstab[4]= 1.0f;
 	
 	for (y = -rady+1; y < imgy+rady-1; y++) {
 		
-		if(y<=0) srcd= img->rect;
-		else if(y<imgy) srcd+= pix*imgx;
+		if (y<=0) srcd= img->rect;
+		else if (y<imgy) srcd+= pix*imgx;
 		else srcd= img->rect + pix*(imgy-1)*imgx;
 			
 		for (x = -radx+1; x < imgx+radx-1 ; x++) {
@@ -413,8 +413,8 @@ static void bokeh_single_image(bNode *node, CompBuf *new, CompBuf *img, float fa
 			float *destd= new->rect + pix*( (y + minyr)*imgx + x + minxr);
 			float *dgausd= gausstab + (minyr+rady)*(2*radx+1) + minxr+radx;
 			
-			if(x<=0) src= srcd;
-			else if(x<imgx) src+= pix;
+			if (x<=0) src= srcd;
+			else if (x<imgx) src+= pix;
 			else src= srcd + pix*(imgx-1);
 			
 			for (i= minyr; i <=maxyr; i++, destd+= pix*imgx, dgausd+= 2*radx + 1) {
@@ -422,9 +422,9 @@ static void bokeh_single_image(bNode *node, CompBuf *new, CompBuf *img, float fa
 				dgauss= dgausd;
 				for (j= minxr; j <=maxxr; j++, dest+=pix, dgauss++) {
 					val= *dgauss;
-					if(val!=0.0f) {
+					if (val!=0.0f) {
 						dest[0] += val * src[0];
-						if(pix>1) {
+						if (pix>1) {
 							dest[1] += val * src[1];
 							dest[2] += val * src[2];
 							dest[3] += val * src[3];
@@ -433,7 +433,7 @@ static void bokeh_single_image(bNode *node, CompBuf *new, CompBuf *img, float fa
 				}
 			}
 		}
-		if(node->exec & NODE_BREAK)
+		if (node->exec & NODE_BREAK)
 			break;
 	}
 	
@@ -459,7 +459,7 @@ static void blur_with_reference(bNode *node, CompBuf *new, CompBuf *img, CompBuf
 	float proccol[4];	/* local color if compbuf is procedural */
 	int refradx, refrady;
 
-	if(ref->x!=img->x || ref->y!=img->y)
+	if (ref->x!=img->x || ref->y!=img->y)
 		return;
 	
 	ref_use= typecheck_compbuf(ref, CB_VAL);
@@ -470,9 +470,9 @@ static void blur_with_reference(bNode *node, CompBuf *new, CompBuf *img, CompBuf
 	blurbuf->yof= ref_use->yof;
 	blurd= blurbuf->rect;
 	refd= ref_use->rect;
-	for(x= imgx*imgy; x>0; x--, refd++, blurd++) {
-		if(refd[0]<0.0f) blurd[0]= 0.0f;
-		else if(refd[0]>1.0f) blurd[0]= 1.0f;
+	for (x= imgx*imgy; x>0; x--, refd++, blurd++) {
+		if (refd[0]<0.0f) blurd[0]= 0.0f;
+		else if (refd[0]>1.0f) blurd[0]= 1.0f;
 		else blurd[0]= refd[0];
 	}
 	
@@ -480,21 +480,21 @@ static void blur_with_reference(bNode *node, CompBuf *new, CompBuf *img, CompBuf
 	
 	/* horizontal */
 	radx = (float)nbd->sizex;
-	if(radx>imgx/2)
+	if (radx>imgx/2)
 		radx= imgx/2;
-	else if(radx<1) 
+	else if (radx<1)
 		radx= 1;
 	
 	/* vertical */
 	rady = (float)nbd->sizey;
-	if(rady>imgy/2)
+	if (rady>imgy/2)
 		rady= imgy/2;
-	else if(rady<1) 
+	else if (rady<1)
 		rady= 1;
 	
 	x= MAX2(radx, rady);
 	maintabs= MEM_mallocN(x*sizeof(void *), "gauss array");
-	for(i= 0; i<x; i++)
+	for (i= 0; i<x; i++)
 		maintabs[i]= make_gausstab(nbd->filtertype, i+1);
 	
 	dest= new->rect;
@@ -507,14 +507,14 @@ static void blur_with_reference(bNode *node, CompBuf *new, CompBuf *img, CompBuf
 			refradx= (int)(refd[0]*radxf);
 			refrady= (int)(refd[0]*radyf);
 			
-			if(refradx>radx) refradx= radx;
-			else if(refradx<1) refradx= 1;
-			if(refrady>rady) refrady= rady;
-			else if(refrady<1) refrady= 1;
+			if (refradx>radx) refradx= radx;
+			else if (refradx<1) refradx= 1;
+			if (refrady>rady) refrady= rady;
+			else if (refrady<1) refrady= 1;
 
-			if(refradx==1 && refrady==1) {
+			if (refradx==1 && refrady==1) {
 				src= img->rect + pix*( y*imgx + x);
-				if(pix==1)
+				if (pix==1)
 					dest[0]= src[0];
 				else
 					copy_v4_v4(dest, src);
@@ -541,7 +541,7 @@ static void blur_with_reference(bNode *node, CompBuf *new, CompBuf *img, CompBuf
 						val= gausstabcenty[i]*gausstabcentx[j];
 						sum+= val;
 						rval += val * src[0];
-						if(pix>1) {
+						if (pix>1) {
 							gval += val * src[1];
 							bval += val * src[2];
 							aval += val * src[3];
@@ -550,25 +550,25 @@ static void blur_with_reference(bNode *node, CompBuf *new, CompBuf *img, CompBuf
 				}
 				sum= 1.0f/sum;
 				dest[0] = rval*sum;
-				if(pix>1) {
+				if (pix>1) {
 					dest[1] = gval*sum;
 					dest[2] = bval*sum;
 					dest[3] = aval*sum;
 				}
 			}
 		}
-		if(node->exec & NODE_BREAK)
+		if (node->exec & NODE_BREAK)
 			break;
 	}
 	
 	free_compbuf(blurbuf);
 	
 	x= MAX2(radx, rady);
-	for(i= 0; i<x; i++)
+	for (i= 0; i<x; i++)
 		MEM_freeN(maintabs[i]);
 	MEM_freeN(maintabs);
 	
-	if(ref_use!=ref)
+	if (ref_use!=ref)
 		free_compbuf(ref_use);
 }
 
@@ -577,15 +577,15 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
 	CompBuf *new, *img= in[0]->data;
 	NodeBlurData *nbd= node->storage;
 	
-	if(img==NULL) return;
+	if (img==NULL) return;
 	
 	/* store image in size that is needed for absolute/relative conversions on ui level */
 	nbd->image_in_width= img->x;
 	nbd->image_in_height= img->y;
 	
-	if(out[0]->hasoutput==0) return;
+	if (out[0]->hasoutput==0) return;
 	
-	if(nbd->relative) {
+	if (nbd->relative) {
 		if (nbd->aspect==CMP_NODE_BLUR_ASPECT_NONE) {
 			nbd->sizex= (int)(nbd->percentx*0.01f*nbd->image_in_width);
 			nbd->sizey= (int)(nbd->percenty*0.01f*nbd->image_in_height);
@@ -635,14 +635,15 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
 		}
 		out[0]->data = new;
 		
-	} else { 
+	}
+	else {
 		/* All non fast gauss blur methods */
-		if(img->type==CB_VEC2 || img->type==CB_VEC3) {
+		if (img->type==CB_VEC2 || img->type==CB_VEC3) {
 			img= typecheck_compbuf(in[0]->data, CB_RGBA);
 		}
 		
 		/* if fac input, we do it different */
-		if(in[1]->data) {
+		if (in[1]->data) {
 			CompBuf *gammabuf;
 			
 			/* make output size of input image */
@@ -652,7 +653,7 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
 			new->xof = img->xof;
 			new->yof = img->yof;
 			
-			if(nbd->gamma) {
+			if (nbd->gamma) {
 				gammabuf= dupalloc_compbuf(img);
 				gamma_correct_compbuf(gammabuf, 0);
 			}
@@ -660,11 +661,11 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
 			
 			blur_with_reference(node, new, gammabuf, in[1]->data);
 			
-			if(nbd->gamma) {
+			if (nbd->gamma) {
 				gamma_correct_compbuf(new, 1);
 				free_compbuf(gammabuf);
 			}
-			if(node->exec & NODE_BREAK) {
+			if (node->exec & NODE_BREAK) {
 				free_compbuf(new);
 				new= NULL;
 			}
@@ -672,7 +673,7 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
 		}
 		else {
 			
-			if(in[1]->vec[0]<=0.001f) {	/* time node inputs can be a tiny value */
+			if (in[1]->vec[0]<=0.001f) {	/* time node inputs can be a tiny value */
 				new= pass_on_compbuf(img);
 			}
 			else {
@@ -685,31 +686,31 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
 				new->xof = img->xof;
 				new->yof = img->yof;
 					
-				if(nbd->gamma) {
+				if (nbd->gamma) {
 					gammabuf= dupalloc_compbuf(img);
 					gamma_correct_compbuf(gammabuf, 0);
 				}
 				else gammabuf= img;
 				
-				if(nbd->bokeh)
+				if (nbd->bokeh)
 					bokeh_single_image(node, new, gammabuf, in[1]->vec[0]);
-				else if(1)
+				else if (1)
 					blur_single_image(node, new, gammabuf, in[1]->vec[0]);
 				else	/* bloom experimental... */
 					bloom_with_reference(new, gammabuf, NULL, in[1]->vec[0], nbd);
 				
-				if(nbd->gamma) {
+				if (nbd->gamma) {
 					gamma_correct_compbuf(new, 1);
 					free_compbuf(gammabuf);
 				}
-				if(node->exec & NODE_BREAK) {
+				if (node->exec & NODE_BREAK) {
 					free_compbuf(new);
 					new= NULL;
 				}
 			}
 			out[0]->data= new;
 		}
-		if(img!=in[0]->data)
+		if (img!=in[0]->data)
 			free_compbuf(img);
 	}
 
diff --git a/source/blender/nodes/composite/nodes/node_composite_brightness.c b/source/blender/nodes/composite/nodes/node_composite_brightness.c
index d935d9a..caae5f3 100644
--- a/source/blender/nodes/composite/nodes/node_composite_brightness.c
+++ b/source/blender/nodes/composite/nodes/node_composite_brightness.c
@@ -61,18 +61,16 @@ static void do_brightnesscontrast(bNode *UNUSED(node), float *out, float *in, fl
 	* (http://visca.com/ffactory/archives/5-99/msg00021.html)
 	* Extracted of OpenCV demhist.c
 	*/
-	if( contrast > 0 )
-{
+	if (contrast > 0) {
 		a = 1.0f / a;
 		b = a * (brightness - delta);
 	}
-	else
-	{
+	else {
 		delta *= -1;
 		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;
@@ -81,15 +79,15 @@ static void do_brightnesscontrast(bNode *UNUSED(node), float *out, float *in, fl
 
 static void node_composit_exec_brightcontrast(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
 {
-	if(out[0]->hasoutput==0)
+	if (out[0]->hasoutput==0)
 		return;
 	
-	if(in[0]->data) {
+	if (in[0]->data) {
 		CompBuf *stackbuf, *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
 		stackbuf= dupalloc_compbuf(cbuf);
 		composit3_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, in[2]->data, in[2]->vec, do_brightnesscontrast, CB_RGBA, CB_VAL, CB_VAL);
 		out[0]->data = stackbuf;
-		if(cbuf != in[0]->data)
+		if (cbuf != in[0]->data)
 			free_compbuf(cbuf);
 	}
 }
diff --git a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
index 785786d..132b165 100644
--- a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c
@@ -105,10 +105,10 @@ static void do_channel_matte(bNode *node, float *out, float *in)
 	alpha=1-alpha;
 	
 	/* test range*/
-	if(alpha>c->t1) {
+	if (alpha>c->t1) {
 		alpha=in[3]; /*whatever it was prior */
 	}
-	else if(alpha<c->t2){
+	else if (alpha<c->t2) {
 		alpha=0.0;
 	}
 	else {/*blend */
@@ -130,9 +130,9 @@ static void node_composit_exec_channel_matte(void *data, bNode *node, bNodeStack
 	CompBuf *cbuf;
 	CompBuf *outbuf;
 	
-	if(in[0]->hasinput==0) return;
-	if(in[0]->data==NULL) return;
-	if(out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
+	if (in[0]->hasinput==0) return;
+	if (in[0]->data==NULL) return;
+	if (out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
 	
 	cbuf=typecheck_compbuf(in[0]->data, CB_RGBA);
 	
@@ -177,10 +177,10 @@ static void node_composit_exec_channel_matte(void *data, bNode *node, bNodeStack
 
 	generate_preview(data, node, outbuf);
 	out[0]->data=outbuf;
-	if(out[1]->hasoutput)
+	if (out[1]->hasoutput)
 		out[1]->data=valbuf_from_rgbabuf(outbuf, CHAN_A);
 	
-	if(cbuf!=in[0]->data)
+	if (cbuf!=in[0]->data)
 		free_compbuf(cbuf);
 
 }
diff --git a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
index b6f490a..2df8e1b 100644
--- a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
@@ -111,14 +111,14 @@ static void do_chroma_key(bNode *node, float *out, float *in)
 	out[1]=in[1];
 	out[2]=in[2];
 
-	if(kfg>0.0f) {  /* found a pixel that is within key color */
+	if (kfg>0.0f) {  /* found a pixel that is within key color */
 		alpha=(1.0f-kfg)*(c->fstrength);
 
 		beta=atan2(z,x);
 		angle2=c->t2; /* t2 is radians. */
 
 		/* if beta is within the cutoff angle */
-		if(fabsf(beta) < (angle2/2.0f)) {
+		if (fabsf(beta) < (angle2/2.0f)) {
 			alpha=0.0;
 		}
 
@@ -144,9 +144,9 @@ static void node_composit_exec_chroma_matte(void *data, bNode *node, bNodeStack
 	CompBuf *chromabuf;
 	NodeChroma *c;
 	
-	if(in[0]->hasinput==0) return;
-	if(in[0]->data==NULL) return;
-	if(out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
+	if (in[0]->hasinput==0) return;
+	if (in[0]->data==NULL) return;
+	if (out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
 	
 	cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
 	
@@ -166,12 +166,12 @@ static void node_composit_exec_chroma_matte(void *data, bNode *node, bNodeStack
 	composit1_pixel_processor(node, chromabuf, chromabuf, in[0]->vec, do_ycca_to_rgba_normalized, CB_RGBA);
 	
 	out[0]->data= chromabuf;
-	if(out[1]->hasoutput)
+	if (out[1]->hasoutput)
 		out[1]->data= valbuf_from_rgbabuf(chromabuf, CHAN_A);
 	
 	generate_preview(data, node, chromabuf);
 
-	if(cbuf!=in[0]->data)
+	if (cbuf!=in[0]->data)
 		free_compbuf(cbuf);
 }
 
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
index 2d56c9e..12b6e80 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
@@ -54,7 +54,7 @@ static void do_color_key(bNode *node, float *out, float *in)
 
 	copy_v3_v3(out, in);
 
-	if(
+	if (
 	/* do hue last because it needs to wrap, and does some more checks  */
 
 	/* sat */	(fabsf(in[1]-c->key[1]) < c->t2) &&
@@ -79,9 +79,9 @@ static void node_composit_exec_color_matte(void *data, bNode *node, bNodeStack *
 	CompBuf *colorbuf;
 	NodeChroma *c;
 	
-	if(in[0]->hasinput==0) return;
-	if(in[0]->data==NULL) return;
-	if(out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
+	if (in[0]->hasinput==0) return;
+	if (in[0]->data==NULL) return;
+	if (out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
 	
 	cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
 	
@@ -103,12 +103,12 @@ static void node_composit_exec_color_matte(void *data, bNode *node, bNodeStack *
 	composit1_pixel_processor(node, colorbuf, colorbuf, in[0]->vec, do_hsva_to_rgba, CB_RGBA);
 	
 	out[0]->data= colorbuf;
-	if(out[1]->hasoutput)
+	if (out[1]->hasoutput)
 		out[1]->data= valbuf_from_rgbabuf(colorbuf, CHAN_A);
 	
 	generate_preview(data, node, colorbuf);
 
-	if(cbuf!=in[0]->data)
+	if (cbuf!=in[0]->data)
 		free_compbuf(cbuf);
 }
 
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
index af6a295..46d7c62 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorSpill.c
@@ -33,7 +33,7 @@
 
 #include "node_composite_util.h"
 
-#define avg(a,b) ((a+b)/2)
+#define AVG(a, b) ((a + b) / 2)
 
 /* ******************* Color Spill Supression ********************************* */
 static bNodeSocketTemplate cmp_node_color_spill_in[]={
@@ -96,7 +96,7 @@ static void do_average_spillmap_red(bNode *node, float* out, float *in)
 {
 	NodeColorspill *ncs;
 	ncs=node->storage;
-	out[0]=in[0]-(ncs->limscale * avg(in[1], in[2]) );
+	out[0]=in[0]-(ncs->limscale * AVG(in[1], in[2]) );
 }
 
 static void do_average_spillmap_red_fac(bNode *node, float* out, float *in, float *fac)
@@ -104,14 +104,14 @@ static void do_average_spillmap_red_fac(bNode *node, float* out, float *in, floa
 	NodeColorspill *ncs;
 	ncs=node->storage;
 
-	out[0] = *fac * (in[0]-(ncs->limscale * avg(in[1], in[2]) ));
+	out[0] = *fac * (in[0]-(ncs->limscale * AVG(in[1], in[2]) ));
 }
 
 static void do_average_spillmap_green(bNode *node, float* out, float *in)
 {
 	NodeColorspill *ncs;
 	ncs=node->storage;
-	out[0]=in[1]-(ncs->limscale * avg(in[0], in[2]) );
+	out[0]=in[1]-(ncs->limscale * AVG(in[0], in[2]) );
 }
 
 static void do_average_spillmap_green_fac(bNode *node, float* out, float *in, float *fac)
@@ -119,14 +119,14 @@ static void do_average_spillmap_green_fac(bNode *node, float* out, float *in, fl
 	NodeColorspill *ncs;
 	ncs=node->storage;
 
-	out[0] = *fac * (in[0]-(ncs->limscale * avg(in[0], in[2]) ));
+	out[0] = *fac * (in[0]-(ncs->limscale * AVG(in[0], in[2]) ));
 }
 
 static void do_average_spillmap_blue(bNode *node, float* out, float *in)
 {
 	NodeColorspill *ncs;
 	ncs=node->storage;
-	out[0]=in[2]-(ncs->limscale * avg(in[0], in[1]) );
+	out[0]=in[2]-(ncs->limscale * AVG(in[0], in[1]) );
 }
 
 static void do_average_spillmap_blue_fac(bNode *node, float* out, float *in, float *fac)
@@ -134,14 +134,14 @@ static void do_average_spillmap_blue_fac(bNode *node, float* out, float *in, flo
 	NodeColorspill *ncs;
 	ncs=node->storage;
 
-	out[0] = *fac * (in[0]-(ncs->limscale * avg(in[0], in[1]) ));
+	out[0] = *fac * (in[0]-(ncs->limscale * AVG(in[0], in[1]) ));
 }
 
 static void do_apply_spillmap_red(bNode *node, float* out, float *in, float *map)
 {	
 	NodeColorspill *ncs;
 	ncs=node->storage;
-	if(map[0]>0) {
+	if (map[0]>0) {
 		out[0]=in[0]-(ncs->uspillr*map[0]);
 		out[1]=in[1]+(ncs->uspillg*map[0]);
 		out[2]=in[2]+(ncs->uspillb*map[0]);
@@ -157,7 +157,7 @@ static void do_apply_spillmap_green(bNode *node, float* out, float *in, float *m
 {
 	NodeColorspill *ncs;
 	ncs=node->storage;
-	if(map[0]>0) {
+	if (map[0]>0) {
 		out[0]=in[0]+(ncs->uspillr*map[0]);
 		out[1]=in[1]-(ncs->uspillg*map[0]);
 		out[2]=in[2]+(ncs->uspillb*map[0]);
@@ -173,7 +173,7 @@ static void do_apply_spillmap_blue(bNode *node, float* out, float *in, float *ma
 {
 	NodeColorspill *ncs;
 	ncs=node->storage;
-	if(map[0]>0) {
+	if (map[0]>0) {
 		out[0]=in[0]+(ncs->uspillr*map[0]);
 		out[1]=in[1]+(ncs->uspillg*map[0]);
 		out[2]=in[2]-(ncs->uspillb*map[0]);
@@ -197,9 +197,9 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
 	ncs=node->storage;
 
 	/* early out for missing connections */
-	if(out[0]->hasoutput==0 ) return;
-	if(in[0]->hasinput==0) return;
-	if(in[0]->data==NULL) return;
+	if (out[0]->hasoutput==0 ) return;
+	if (in[0]->hasinput==0) return;
+	if (in[0]->data==NULL) return;
 	
 	cbuf=typecheck_compbuf(in[0]->data, CB_RGBA);
 	/* mask= */ /* UNUSED */ typecheck_compbuf(in[1]->data, CB_VAL);
@@ -216,7 +216,8 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
 				{
 					if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
 						composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_simple_spillmap_red, CB_RGBA);
-					} else {
+					}
+					else {
 						composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_simple_spillmap_red_fac, CB_RGBA,  CB_VAL);
 					}
 					break;
@@ -225,13 +226,14 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
 				{
 					if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
 						composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_average_spillmap_red, CB_RGBA);
-					} else {
+					}
+					else {
 						composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_average_spillmap_red_fac, CB_RGBA,  CB_VAL);
 					}
 					break;
 				}
 			}
-			if(ncs->unspill==0) {
+			if (ncs->unspill==0) {
 				ncs->uspillr=1.0f;
 				ncs->uspillg=0.0f;
 				ncs->uspillb=0.0f;
@@ -247,7 +249,8 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
 				{
 					if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
 						composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_simple_spillmap_green, CB_RGBA);
-					} else {
+					}
+					else {
 						composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_simple_spillmap_green_fac, CB_RGBA,  CB_VAL);
 					}
 					break;
@@ -256,13 +259,14 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
 				{
 					if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
 						composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_average_spillmap_green, CB_RGBA);
-					} else {
+					}
+					else {
 						composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_average_spillmap_green_fac, CB_RGBA,  CB_VAL);
 					}
 					break;
 				}
 			}
-			if(ncs->unspill==0) {
+			if (ncs->unspill==0) {
 				ncs->uspillr=0.0f;
 				ncs->uspillg=1.0f;
 				ncs->uspillb=0.0f;
@@ -278,7 +282,8 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
 				{
 					if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
 						composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_simple_spillmap_blue, CB_RGBA);
-					} else {
+					}
+					else {
 						composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_simple_spillmap_blue_fac, CB_RGBA,  CB_VAL);
 					}
 					break;
@@ -287,13 +292,14 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
 				{
 					if ((in[1]->data==NULL) && (in[1]->vec[0] >= 1.f)) {
 						composit1_pixel_processor(node, spillmap, cbuf, in[0]->vec, do_average_spillmap_blue, CB_RGBA);
-					} else {
+					}
+					else {
 						composit2_pixel_processor(node, spillmap, cbuf, in[0]->vec, in[1]->data, in[1]->vec, do_average_spillmap_blue_fac, CB_RGBA,  CB_VAL);
 					}
 					break;
 				}
 			}
-			if(ncs->unspill==0) {
+			if (ncs->unspill==0) {
 				ncs->uspillr=0.0f;
 				ncs->uspillg=0.0f;
 				ncs->uspillb=1.0f;
@@ -307,7 +313,7 @@ static void node_composit_exec_color_spill(void *UNUSED(data), bNode *node, bNod
 
 	out[0]->data=rgbbuf;
 
-	if(cbuf!=in[0]->data)
+	if (cbuf!=in[0]->data)
 		free_compbuf(cbuf);
 
 	free_compbuf(spillmap);
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c
index 26d7aa0..f77e4cd 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c
@@ -69,7 +69,7 @@ DO_INLINE float colorbalance_cdl(float in, float offset, float power, float slop
 /* note: lift_lgg is just 2-lift, gamma_inv is 1.0/gamma */
 DO_INLINE float colorbalance_lgg(float in, float lift_lgg, float gamma_inv, float gain)
 {
-	/* 1:1 match with the sequencer with linear/srgb conversions, the conversion isnt pretty
+	/* 1:1 match with the sequencer with linear/srgb conversions, the conversion isn'tisn't pretty
 	 * but best keep it this way, sice testing for durian shows a similar calculation
 	 * without lin/srgb conversions gives bad results (over-saturated shadows) with colors
 	 * slightly below 1.0. some correction can be done but it ends up looking bad for shadows or lighter tones - campbell */
@@ -130,9 +130,9 @@ static void node_composit_exec_colorbalance(void *UNUSED(data), bNode *node, bNo
 	
 	/* stack order input:  fac, image */
 	/* stack order output: image */
-	if(out[0]->hasoutput==0) return;
+	if (out[0]->hasoutput==0) return;
 	
-	if(in[0]->vec[0] == 0.f && in[0]->data == NULL) {
+	if (in[0]->vec[0] == 0.f && in[0]->data == NULL) {
 		out[0]->data = pass_on_compbuf(cbuf);
 		return;
 	}
@@ -158,7 +158,8 @@ static void node_composit_exec_colorbalance(void *UNUSED(data), bNode *node, bNo
 			else {
 				composit2_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[0]->data, in[0]->vec, do_colorbalance_lgg_fac, CB_RGBA, CB_VAL);
 			}
-		} else {
+		}
+		else {
 			/* offset/power/slope : ASC-CDL */
 			if ((in[0]->data==NULL) && (in[0]->vec[0] >= 1.f)) {
 				composit1_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, do_colorbalance_cdl, CB_RGBA);
diff --git a/source/blender/nodes/composite/nodes/node_composite_composite.c b/source/blender/nodes/composite/nodes/node_composite_composite.c
index a5f90d3..9b1e5e4 100644
--- a/source/blender/nodes/composite/nodes/node_composite_composite.c
+++ b/source/blender/nodes/composite/nodes/node_composite_composite.c
@@ -48,27 +48,27 @@ static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **i
 	/* image assigned to output */
 	/* stack order input sockets: col, alpha, z */
 	
-	if(node->flag & NODE_DO_OUTPUT) {	/* only one works on out */
+	if (node->flag & NODE_DO_OUTPUT) {	/* only one works on out */
 		Scene *scene= (Scene *)node->id;
 		RenderData *rd= data;
 		
-		if(scene && (rd->scemode & R_DOCOMP)) {
+		if (scene && (rd->scemode & R_DOCOMP)) {
 			Render *re= RE_GetRender(scene->id.name);
 			RenderResult *rr= RE_AcquireResultWrite(re); 
-			if(rr) {
+			if (rr) {
 				CompBuf *outbuf, *zbuf=NULL;
 				
-				if(rr->rectf) 
+				if (rr->rectf) 
 					MEM_freeN(rr->rectf);
 				outbuf= alloc_compbuf(rr->rectx, rr->recty, CB_RGBA, 1);
 				
-				if(in[1]->data==NULL)
+				if (in[1]->data==NULL)
 					composit1_pixel_processor(node, outbuf, in[0]->data, in[0]->vec, do_copy_rgba, CB_RGBA);
 				else
 					composit2_pixel_processor(node, outbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, do_copy_a_rgba, CB_RGBA, CB_VAL);
 				
-				if(in[2]->data) {
-					if(rr->rectz) 
+				if (in[2]->data) {
+					if (rr->rectz) 
 						MEM_freeN(rr->rectz);
 					zbuf= alloc_compbuf(rr->rectx, rr->recty, CB_VAL, 1);
 					composit1_pixel_processor(node, zbuf, in[2]->data, in[2]->vec, do_copy_value, CB_VAL);
@@ -93,7 +93,7 @@ static void node_composit_exec_composite(void *data, bNode *node, bNodeStack **i
 				RE_ReleaseResult(re);
 		}
 	}
-	if(in[0]->data)
+	if (in[0]->data)
 		generate_preview(data, node, in[0]->data);
 }
 
@@ -106,7 +106,7 @@ void register_node_type_cmp_composite(bNodeTreeType *ttype)
 	node_type_size(&ntype, 80, 60, 200);
 	node_type_exec(&ntype, node_composit_exec_composite);
 	/* Do not allow muting for this node. */
-	node_type_mute(&ntype, NULL, NULL);
+	node_type_internal_connect(&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 3697f3e..242bc83 100644
--- a/source/blender/nodes/composite/nodes/node_composite_crop.c
+++ b/source/blender/nodes/composite/nodes/node_composite_crop.c
@@ -45,7 +45,7 @@ static bNodeSocketTemplate cmp_node_crop_out[]= {
 
 static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
 {
-	if(in[0]->data) {
+	if (in[0]->data) {
 		NodeTwoXYs *ntxy= node->storage;
 		CompBuf *cbuf= in[0]->data;
 		CompBuf *stackbuf;
@@ -53,7 +53,7 @@ static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack
 		float *srcfp, *outfp;
 		rcti outputrect;
 
-		if(node->custom2) {
+		if (node->custom2) {
 			ntxy->x1= cbuf->x* ntxy->fac_x1;
 			ntxy->x2= cbuf->x* ntxy->fac_x2;
 			ntxy->y1= cbuf->y* ntxy->fac_y1;
@@ -61,16 +61,16 @@ static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack
 		}
 
 		/* check input image size */
-		if(cbuf->x <= ntxy->x1 + 1)
+		if (cbuf->x <= ntxy->x1 + 1)
 			ntxy->x1= cbuf->x - 1;
 
-		if(cbuf->y <= ntxy->y1 + 1)
+		if (cbuf->y <= ntxy->y1 + 1)
 			ntxy->y1= cbuf->y - 1;
 
-		if(cbuf->x <= ntxy->x2 + 1)
+		if (cbuf->x <= ntxy->x2 + 1)
 			ntxy->x2= cbuf->x - 1;
 
-		if(cbuf->y <= ntxy->y2 + 1)
+		if (cbuf->y <= ntxy->y2 + 1)
 			ntxy->y2= cbuf->y - 1;
 
 		/* figure out the minimums and maximums */
@@ -79,7 +79,7 @@ static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack
 		outputrect.ymax=MAX2(ntxy->y1, ntxy->y2) + 1;
 		outputrect.ymin=MIN2(ntxy->y1, ntxy->y2);
 
-		if(node->custom1) {
+		if (node->custom1) {
 			/* this option crops the image size too  */	
 			stackbuf= get_cropped_compbuf(&outputrect, cbuf->rect, cbuf->x, cbuf->y, cbuf->type);
 		}
@@ -89,10 +89,10 @@ static void node_composit_exec_crop(void *UNUSED(data), bNode *node, bNodeStack
 			stackbuf = alloc_compbuf(cbuf->x, cbuf->y, cbuf->type, 1);
 
 			/* select the cropped part of the image and set it to the output */
-			for(y=outputrect.ymin; y<outputrect.ymax; y++){
+			for (y=outputrect.ymin; y<outputrect.ymax; y++) {
 				srcfp= cbuf->rect     + (y * cbuf->x     + outputrect.xmin) * cbuf->type;
 				outfp= stackbuf->rect + (y * stackbuf->x + outputrect.xmin) * stackbuf->type;
-				for(x=outputrect.xmin; x<outputrect.xmax; x++, outfp+= stackbuf->type, srcfp+= cbuf->type)
+				for (x=outputrect.xmin; x<outputrect.xmax; x++, outfp+= stackbuf->type, srcfp+= cbuf->type)
 							memcpy(outfp, srcfp, sizeof(float)*stackbuf->type);
 			}
 		}
diff --git a/source/blender/nodes/composite/nodes/node_composite_curves.c b/source/blender/nodes/composite/nodes/node_composite_curves.c
index 8142458..d17a7bf 100644
--- a/source/blender/nodes/composite/nodes/node_composite_curves.c
+++ b/source/blender/nodes/composite/nodes/node_composite_curves.c
@@ -47,7 +47,7 @@ static void node_composit_exec_curves_time(void *data, bNode *node, bNodeStack *
 	/* stack order output: fac */
 	float fac= 0.0f;
 	
-	if(node->custom1 < node->custom2)
+	if (node->custom1 < node->custom2)
 		fac= (rd->cfra - node->custom1)/(float)(node->custom2-node->custom1);
 	
 	fac= curvemapping_evaluateF(node->storage, 0, fac);
@@ -140,9 +140,9 @@ static void do_curves(bNode *node, float *out, float *in)
 static void do_curves_fac(bNode *node, float *out, float *in, float *fac)
 {
 	
-	if(*fac >= 1.0f)
+	if (*fac >= 1.0f)
 		curvemapping_evaluate_premulRGBF(node->storage, out, in);
-	else if(*fac <= 0.0f) {
+	else if (*fac <= 0.0f) {
 		copy_v3_v3(out, in);
 	}
 	else {
@@ -160,11 +160,11 @@ static void node_composit_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeS
 	/* stack order input:  fac, image, black level, white level */
 	/* stack order output: image */
 	
-	if(out[0]->hasoutput==0)
+	if (out[0]->hasoutput==0)
 		return;
 
 	/* input no image? then only color operation */
-	if(in[1]->data==NULL) {
+	if (in[1]->data==NULL) {
 		curvemapping_evaluateRGBF(node->storage, out[0]->vec, in[1]->vec);
 	}
 	else {
@@ -174,7 +174,7 @@ static void node_composit_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeS
 		
 		curvemapping_set_black_white(node->storage, in[2]->vec, in[3]->vec);
 		
-		if(in[0]->data==NULL && in[0]->vec[0] == 1.0f)
+		if (in[0]->data==NULL && in[0]->vec[0] == 1.0f)
 			composit1_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, do_curves, CB_RGBA);
 		else
 			composit2_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[0]->data, in[0]->vec, do_curves_fac, CB_RGBA, CB_VAL);
diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.c b/source/blender/nodes/composite/nodes/node_composite_defocus.c
index 1e7c8e8..fc6e684 100644
--- a/source/blender/nodes/composite/nodes/node_composite_defocus.c
+++ b/source/blender/nodes/composite/nodes/node_composite_defocus.c
@@ -376,7 +376,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf,
 				wts->rect[px] = 0.f;
 			}
 			// esc set by main calling process
-			if(node->exec & NODE_BREAK)
+			if (node->exec & NODE_BREAK)
 				break;
 		}
 	}
@@ -385,9 +385,9 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf,
 	// main loop
 #ifndef __APPLE__ /* can crash on Mac, see bug #22856, disabled for now */
 #ifdef __INTEL_COMPILER /* icc doesn't like the compound statement -- internal error: 0_1506 */
-	#pragma omp parallel for private(y) if(!nqd->preview) schedule(guided)
+	#pragma omp parallel for private(y) if (!nqd->preview) schedule(guided)
 #else
-	#pragma omp parallel for private(y) if(!nqd->preview && img->y*img->x > 16384) schedule(guided)
+	#pragma omp parallel for private(y) if (!nqd->preview && img->y*img->x > 16384) schedule(guided)
 #endif
 #endif
 	for (y=0; y<img->y; y++) {
@@ -400,7 +400,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf,
 		#pragma omp critical
 		{
 			if (((ydone & 7)==0) || (ydone==(img->y-1))) {
-				if(G.background==0) {
+				if (G.background==0) {
 					printf("\rdefocus: Processing Line %d of %d ... ", ydone+1, img->y);
 					fflush(stdout);
 				}
@@ -411,7 +411,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf,
 
 		// esc set by main calling process. don't break because openmp doesn't
 		// allow it, just continue and do nothing 
-		if(node->exec & NODE_BREAK)
+		if (node->exec & NODE_BREAK)
 			continue;
 
 		zp = y * img->x;
@@ -462,7 +462,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf,
 				// (eg. aa disk blur without test: 112 sec, vs with test: 176 sec...)
 				// iff center blur radius > threshold
 				// and if overlap pixel in focus, do nothing, else add color/weigbt
-				// (threshold constant is dependant on amount of blur)
+				// (threshold constant is dependent on amount of blur)
 				#define TESTBG1(c, w) {\
 					if (ct_crad > nqd->bthresh) {\
 						if (crad->rect[p] > nqd->bthresh) {\
@@ -850,7 +850,7 @@ static void node_composit_exec_defocus(void *UNUSED(data), bNode *node, bNodeSta
 		premul_compbuf(new, 0);
 		free_compbuf(old);
 	}
-	if(node->exec & NODE_BREAK) {
+	if (node->exec & NODE_BREAK) {
 		free_compbuf(new);
 		new= NULL;
 	}	
diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
index eae59de..027786d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
@@ -63,15 +63,15 @@ static void do_diff_matte(bNode *node, float *outColor, float *inColor1, float *
 	copy_v3_v3(outColor, inColor1);
 
 	/*make 100% transparent*/
-	if(difference < tolerence) {
+	if (difference < tolerence) {
 		outColor[3]=0.0;
 	}
 	/*in the falloff region, make partially transparent */
-	else if(difference < falloff+tolerence) {
+	else if (difference < falloff+tolerence) {
 		difference=difference-tolerence;
 		alpha=difference/falloff;
 		/*only change if more transparent than before */
-		if(alpha < inColor1[3]) {
+		if (alpha < inColor1[3]) {
 			outColor[3]=alpha;
 		}
 		else { /* leave as before */
@@ -92,16 +92,16 @@ static void node_composit_exec_diff_matte(void *data, bNode *node, bNodeStack **
 	/* NodeChroma *c; */ /* UNUSED */
 
 	/*is anything connected?*/
-	if(out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
+	if (out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
 
 	/*must have an image imput*/
-	if(in[0]->data==NULL) return;
+	if (in[0]->data==NULL) return;
 
 
 	imbuf1=typecheck_compbuf(in[0]->data, CB_RGBA);
 
 	/* if there's an image, use that, if not use the color */
-	if(in[1]->data) {
+	if (in[1]->data) {
 		imbuf2=typecheck_compbuf(in[1]->data, CB_RGBA);
 	}
 
@@ -112,14 +112,14 @@ static void node_composit_exec_diff_matte(void *data, bNode *node, bNodeStack **
 	composit2_pixel_processor(node, outbuf, imbuf1, in[0]->vec, imbuf2, in[1]->vec, do_diff_matte, CB_RGBA, CB_RGBA);
 
 	out[0]->data=outbuf;
-	if(out[1]->hasoutput)
+	if (out[1]->hasoutput)
 		out[1]->data=valbuf_from_rgbabuf(outbuf, CHAN_A);
 	generate_preview(data, node, outbuf);
 
-	if(imbuf1!=in[0]->data)
+	if (imbuf1!=in[0]->data)
 		free_compbuf(imbuf1);
 
-	if(imbuf2!=in[1]->data)
+	if (imbuf2!=in[1]->data)
 		free_compbuf(imbuf2);
 }
 
diff --git a/source/blender/nodes/composite/nodes/node_composite_dilate.c b/source/blender/nodes/composite/nodes/node_composite_dilate.c
index f8abf96..ee857dd 100644
--- a/source/blender/nodes/composite/nodes/node_composite_dilate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_dilate.c
@@ -117,11 +117,11 @@ static void node_composit_exec_dilateerode(void *UNUSED(data), bNode *node, bNod
 {
 	/* stack order in: mask */
 	/* stack order out: mask */
-	if(out[0]->hasoutput==0) 
+	if (out[0]->hasoutput==0) 
 		return;
 	
 	/* input no image? then only color operation */
-	if(in[0]->data==NULL) {
+	if (in[0]->data==NULL) {
 		out[0]->vec[0] = out[0]->vec[1] = out[0]->vec[2] = 0.0f;
 		out[0]->vec[3] = 0.0f;
 	}
@@ -134,12 +134,13 @@ static void node_composit_exec_dilateerode(void *UNUSED(data), bNode *node, bNod
 		if (node->custom2 > 0) { // positive, dilate
 			for (i = 0; i < node->custom2; i++)
 				morpho_dilate(stackbuf);
-		} else if (node->custom2 < 0) { // negative, erode
+		}
+		else if (node->custom2 < 0) { // negative, erode
 			for (i = 0; i > node->custom2; i--)
 				morpho_erode(stackbuf);
 		}
 		
-		if(cbuf!=in[0]->data)
+		if (cbuf!=in[0]->data)
 			free_compbuf(cbuf);
 		
 		out[0]->data= stackbuf;
diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c
index d0f7fec..f65b331 100644
--- a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c
@@ -68,37 +68,37 @@ static CompBuf *dblur(bNode *node, CompBuf *img, int iterations, int wrap,
 		rot= itsc * spin;
 
 		/* blur the image */
-		for(i= 0; i < iterations; ++i) {
+		for (i= 0; i < iterations; ++i) {
 			const float cs= cosf(rot), ss= sinf(rot);
 			const float isc= 1.f / (1.f + sc);
 			unsigned int x, y;
 			float col[4]= {0,0,0,0};
 
-			for(y= 0; y < img->y; ++y) {
+			for (y= 0; y < img->y; ++y) {
 				const float v= isc * (y - center_y_pix) + ty;
 
-				for(x= 0; x < img->x; ++x) {
+				for (x= 0; x < img->x; ++x) {
 					const float  u= isc * (x - center_x_pix) + tx;
 					unsigned int p= (x + y * img->x) * img->type;
 
 					getpix(tmp, cs * u + ss * v + center_x_pix, cs * v - ss * u + center_y_pix, col);
 
 					/* mix img and transformed tmp */
-					for(j= 0; j < 4; ++j) {
+					for (j= 0; j < 4; ++j) {
 						img->rect[p + j]= 0.5f * (img->rect[p + j] + col[j]);
 					}
 				}
 			}
 
 			/* copy img to tmp */
-			if(i != (iterations - 1)) 
+			if (i != (iterations - 1)) 
 				memcpy(tmp->rect, img->rect, sizeof(float) * img->x * img->y * img->type);
 
 			/* double transformations */
 			tx *= 2.f, ty  *= 2.f;
 			sc *= 2.f, rot *= 2.f;
 
-			if(node->exec & NODE_BREAK) break;
+			if (node->exec & NODE_BREAK) break;
 		}
 
 		free_compbuf(tmp);
@@ -112,7 +112,7 @@ static void node_composit_exec_dblur(void *UNUSED(data), bNode *node, bNodeStack
 	NodeDBlurData *ndbd= node->storage;
 	CompBuf *new, *img= in[0]->data;
 	
-	if((img == NULL) || (out[0]->hasoutput == 0)) return;
+	if ((img == NULL) || (out[0]->hasoutput == 0)) return;
 
 	if (img->type != CB_RGBA)
 		new = typecheck_compbuf(img, CB_RGBA);
diff --git a/source/blender/nodes/composite/nodes/node_composite_displace.c b/source/blender/nodes/composite/nodes/node_composite_displace.c
index ad7c1fa..6e4bbc6 100644
--- a/source/blender/nodes/composite/nodes/node_composite_displace.c
+++ b/source/blender/nodes/composite/nodes/node_composite_displace.c
@@ -66,8 +66,8 @@ static void do_displace(bNode *node, CompBuf *stackbuf, CompBuf *cbuf, CompBuf *
 	ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
 	ibuf->rect_float= cbuf->rect;
 	
-	for(y=0; y < stackbuf->y; y++) {
-		for(x=0; x < stackbuf->x; x++) {
+	for (y=0; y < stackbuf->y; y++) {
+		for (x=0; x < stackbuf->x; x++) {
 			/* calc pixel coordinates */
 			qd_getPixel(vecbuf, x-vecbuf->xof, y-vecbuf->yof, vec);
 			
@@ -117,10 +117,10 @@ static void do_displace(bNode *node, CompBuf *stackbuf, CompBuf *cbuf, CompBuf *
 			ibuf_sample(ibuf, u, v, dxt, dyt, col);
 			qd_setPixel(stackbuf, x, y, col);
 			
-			if(node->exec & NODE_BREAK) break;
+			if (node->exec & NODE_BREAK) break;
 		}
 		
-		if(node->exec & NODE_BREAK) break;
+		if (node->exec & NODE_BREAK) break;
 	}
 	IMB_freeImBuf(ibuf);
 	
@@ -133,8 +133,8 @@ static void do_displace(bNode *node, CompBuf *stackbuf, CompBuf *cbuf, CompBuf *
 	float vec[3];
 	float col[3];
 	
-	for(y=0; y < stackbuf->y; y++) {
-		for(x=0; x < stackbuf->x; x++) {
+	for (y=0; y < stackbuf->y; y++) {
+		for (x=0; x < stackbuf->x; x++) {
 			qd_getPixel(vecbuf, x, y, vec);
 			
 			dx = vec[0] * (xscale[0]);
@@ -153,10 +153,10 @@ static void do_displace(bNode *node, CompBuf *stackbuf, CompBuf *cbuf, CompBuf *
 
 static void node_composit_exec_displace(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
 {
-	if(out[0]->hasoutput==0)
+	if (out[0]->hasoutput==0)
 		return;
 	
-	if(in[0]->data && in[1]->data) {
+	if (in[0]->data && in[1]->data) {
 		CompBuf *cbuf= in[0]->data;
 		CompBuf *vecbuf= in[1]->data;
 		CompBuf *xbuf= in[2]->data;
@@ -175,9 +175,9 @@ static void node_composit_exec_displace(void *UNUSED(data), bNode *node, bNodeSt
 		out[0]->data= stackbuf;
 		
 		
-		if(cbuf!=in[0]->data)
+		if (cbuf!=in[0]->data)
 			free_compbuf(cbuf);
-		if(vecbuf!=in[1]->data)
+		if (vecbuf!=in[1]->data)
 			free_compbuf(vecbuf);
 	}
 }
diff --git a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
index 292bb66..7aaaa7e 100644
--- a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
@@ -62,15 +62,15 @@ static void do_distance_matte(bNode *node, float *out, float *in)
 	copy_v3_v3(out, in);
 
 	/*make 100% transparent */
-	if(distance < tolerence) {
+	if (distance < tolerence) {
 		out[3]=0.0;
 	}
 	/*in the falloff region, make partially transparent */
-	else if(distance < falloff+tolerence){
+	else if (distance < falloff+tolerence) {
 		distance=distance-tolerence;
 		alpha=distance/falloff;
 		/*only change if more transparent than before */
-		if(alpha < in[3]) {
+		if (alpha < in[3]) {
 			out[3]=alpha;
 		}
 		else { /* leave as before */
@@ -93,9 +93,9 @@ static void node_composit_exec_distance_matte(void *data, bNode *node, bNodeStac
 	NodeChroma *c;
 	
 	/*is anything connected?*/
-	if(out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
+	if (out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
 	/*must have an image imput*/
-	if(in[0]->data==NULL) return;
+	if (in[0]->data==NULL) return;
 	
 	inbuf=typecheck_compbuf(in[0]->data, CB_RGBA);
 	
@@ -112,11 +112,11 @@ static void node_composit_exec_distance_matte(void *data, bNode *node, bNodeStac
 	
 	
 	out[0]->data=workbuf;
-	if(out[1]->hasoutput)
+	if (out[1]->hasoutput)
 		out[1]->data=valbuf_from_rgbabuf(workbuf, CHAN_A);
 	generate_preview(data, node, workbuf);
 
-	if(inbuf!=in[0]->data)
+	if (inbuf!=in[0]->data)
 		free_compbuf(inbuf);
 }
 
diff --git a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
index 61d30a5..966d8f8 100644
--- a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.c
@@ -33,1152 +33,1252 @@
 
 
 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
+	{ 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[]= {
-    { SOCK_FLOAT, 0, "Mask"},          // output socket definition
-    { -1, 0, "" }                      // output socket array terminator
+	{ SOCK_FLOAT, 0, "Mask"},		// output socket definition
+	{ -1, 0, "" }					// output socket array terminator
 };
 
-static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize){
-    int x;
-    unsigned int isz=0; // inner edge size
-    unsigned int osz=0; // outer edge size
-    unsigned int gsz=0; // gradient fill area size
-    /* Test the four corners */
-    /* upper left corner */
-    x=t-rw+1;
-    // test if inner mask is filled
-    if(limask[x]){
-        // test if pixel underneath, or to the right, are empty in the inner mask,
-        // but filled in the outer mask
-        if((!limask[x-rw] && lomask[x-rw]) || (!limask[x+1] && lomask[x+1])){
-            isz++;                               // increment inner edge size
-            lres[x]=4;                           // flag pixel as inner edge
-        } else {
-            res[x]=1.0f;                         // pixel is just part of inner mask, and it's not an edge
-        }
-    } else if(lomask[x]){                        // inner mask was empty, test if outer mask is filled
-        osz++;                                   // increment outer edge size
-        lres[x]=3;                               // flag pixel as outer edge
-    }
-    /* upper right corner */
-    x=t;
-    // test if inner mask is filled
-    if(limask[x]){
-        // test if pixel underneath, or to the left, are empty in the inner mask,
-        // but filled in the outer mask
-        if((!limask[x-rw] && lomask[x-rw]) || (!limask[x-1] && lomask[x-1])){
-            isz++;                               // increment inner edge size
-            lres[x]=4;                           // flag pixel as inner edge
-        } else {
-            res[x]=1.0f;                         // pixel is just part of inner mask, and it's not an edge
-        }
-    } else if(lomask[x]){                        // inner mask was empty, test if outer mask is filled
-        osz++;                                   // increment outer edge size
-        lres[x]=3;                               // flag pixel as outer edge
-    }
-    /* lower left corner */
-    x=0;
-    // test if inner mask is filled
-    if(limask[x]){
-        // test if pixel above, or to the right, are empty in the inner mask,
-        // but filled in the outer mask
-        if((!limask[x+rw] && lomask[x+rw]) || (!limask[x+1] && lomask[x+1])){
-            isz++;                               // increment inner edge size
-            lres[x]=4;                           // flag pixel as inner edge
-        } else {
-            res[x]=1.0f;                         // pixel is just part of inner mask, and it's not an edge
-        }
-    } else if(lomask[x]){                        // inner mask was empty, test if outer mask is filled
-        osz++;                                   // increment outer edge size
-        lres[x]=3;                               // flag pixel as outer edge
-    }
-    /* lower right corner */
-    x=rw-1;
-    // test if inner mask is filled
-    if(limask[x]){
-        // test if pixel above, or to the left, are empty in the inner mask,
-        // but filled in the outer mask
-        if((!limask[x+rw] && lomask[x+rw]) || (!limask[x-1] && lomask[x-1])){
-            isz++;                               // increment inner edge size
-            lres[x]=4;                           // flag pixel as inner edge
-        } else {
-            res[x]=1.0f;                         // pixel is just part of inner mask, and it's not an edge
-        }
-    } else if(lomask[x]){                        // inner mask was empty, test if outer mask is filled
-        osz++;                                   // increment outer edge size
-        lres[x]=3;                               // flag pixel as outer edge
-    }
-
-    /* Test the TOP row of pixels in buffer, except corners */
-    for(x= t-1; x>=(t-rw)+2; x--) {
-        // test if inner mask is filled
-        if(limask[x]) {
-            // test if pixel to the right, or to the left, are empty in the inner mask,
-            // but filled in the outer mask
-            if((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) {
-                isz++;                           // increment inner edge size
-                lres[x]=4;                       // flag pixel as inner edge
-            } else {
-                res[x]=1.0f;                     // pixel is just part of inner mask, and it's not an edge
-            }
-        } else if(lomask[x]) {                   // inner mask was empty, test if outer mask is filled
-            osz++;                               // increment outer edge size
-            lres[x]=3;                           // flag pixel as outer edge
-        }
-    }
-
-    /* Test the BOTTOM row of pixels in buffer, except corners */
-    for(x= rw-2; x; x--) {
-        // test if inner mask is filled
-        if(limask[x]) {
-            // test if pixel to the right, or to the left, are empty in the inner mask,
-            // but filled in the outer mask
-            if((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) {
-                isz++;                           // increment inner edge size
-                lres[x]=4;                       // flag pixel as inner edge
-            } else {
-                res[x]=1.0f;                     // pixel is just part of inner mask, and it's not an edge
-            }
-        } else if(lomask[x]) {                   // inner mask was empty, test if outer mask is filled
-            osz++;                               // increment outer edge size
-            lres[x]=3;                           // flag pixel as outer edge
-        }
-    }
-    /* Test the LEFT edge of pixels in buffer, except corners */
-    for(x= t-(rw<<1)+1; x>=rw; x-=rw) {
-        // test if inner mask is filled
-        if(limask[x]) {
-            // test if pixel underneath, or above, are empty in the inner mask,
-            // but filled in the outer mask
-            if((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) {
-                isz++;                           // increment inner edge size
-                lres[x]=4;                       // flag pixel as inner edge
-            } else {
-                res[x]=1.0f;                     // pixel is just part of inner mask, and it's not an edge
-            }
-        } else if(lomask[x]) {                   // inner mask was empty, test if outer mask is filled
-            osz++;                               // increment outer edge size
-            lres[x]=3;                           // flag pixel as outer edge
-        }
-    }
-
-    /* Test the RIGHT edge of pixels in buffer, except corners */
-    for(x= t-rw; x>rw; x-=rw) {
-        // test if inner mask is filled
-        if(limask[x]) {
-            // test if pixel underneath, or above, are empty in the inner mask,
-            // but filled in the outer mask
-            if((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) {
-                isz++;                           // increment inner edge size
-                lres[x]=4;                       // flag pixel as inner edge
-            } else {
-                res[x]=1.0f;                     // pixel is just part of inner mask, and it's not an edge
-            }
-        } else if(lomask[x]) {                   // inner mask was empty, test if outer mask is filled
-            osz++;                               // increment outer edge size
-            lres[x]=3;                           // flag pixel as outer edge
-        }
-    }
-
-    rsize[0]=isz;  // fill in our return sizes for edges + fill
-    rsize[1]=osz;
-    rsize[2]=gsz;
+static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize)
+{
+	int x;
+	unsigned int isz=0; // inner edge size
+	unsigned int osz=0; // outer edge size
+	unsigned int gsz=0; // gradient fill area size
+	/* Test the four corners */
+	/* upper left corner */
+	x=t-rw+1;
+	// test if inner mask is filled
+	if (limask[x]) {
+		// test if pixel underneath, or to the right, are empty in the inner mask,
+		// but filled in the outer mask
+		if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+1] && lomask[x+1])) {
+			isz++;								// increment inner edge size
+			lres[x]=4;							// flag pixel as inner edge
+		}
+		else {
+			res[x]=1.0f;						// pixel is just part of inner mask, and it's not an edge
+		}
+	}
+	else if (lomask[x]) {						// inner mask was empty, test if outer mask is filled
+		osz++;									// increment outer edge size
+		lres[x]=3;								// flag pixel as outer edge
+	}
+	/* upper right corner */
+	x=t;
+	// test if inner mask is filled
+	if (limask[x]) {
+		// test if pixel underneath, or to the left, are empty in the inner mask,
+		// but filled in the outer mask
+		if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x-1] && lomask[x-1])) {
+			isz++;								// increment inner edge size
+			lres[x]=4;							// flag pixel as inner edge
+		}
+		else {
+			res[x]=1.0f;						// pixel is just part of inner mask, and it's not an edge
+		}
+	}
+	else if (lomask[x]) {						// inner mask was empty, test if outer mask is filled
+		osz++;									// increment outer edge size
+		lres[x]=3;								// flag pixel as outer edge
+	}
+	/* lower left corner */
+	x=0;
+	// test if inner mask is filled
+	if (limask[x]) {
+		// test if pixel above, or to the right, are empty in the inner mask,
+		// but filled in the outer mask
+		if ((!limask[x+rw] && lomask[x+rw]) || (!limask[x+1] && lomask[x+1])) {
+			isz++;								// increment inner edge size
+			lres[x]=4;							// flag pixel as inner edge
+		}
+		else {
+			res[x]=1.0f;						// pixel is just part of inner mask, and it's not an edge
+		}
+	}
+	else if (lomask[x]) {						// inner mask was empty, test if outer mask is filled
+		osz++;									// increment outer edge size
+		lres[x]=3;								// flag pixel as outer edge
+	}
+	/* lower right corner */
+	x=rw-1;
+	// test if inner mask is filled
+	if (limask[x]) {
+		// test if pixel above, or to the left, are empty in the inner mask,
+		// but filled in the outer mask
+		if ((!limask[x+rw] && lomask[x+rw]) || (!limask[x-1] && lomask[x-1])) {
+			isz++;								// increment inner edge size
+			lres[x]=4;							// flag pixel as inner edge
+		}
+		else {
+			res[x]=1.0f;						// pixel is just part of inner mask, and it's not an edge
+		}
+	}
+	else if (lomask[x]) {						// inner mask was empty, test if outer mask is filled
+		osz++;									// increment outer edge size
+		lres[x]=3;								// flag pixel as outer edge
+	}
+
+	/* Test the TOP row of pixels in buffer, except corners */
+	for (x= t-1; x>=(t-rw)+2; x--) {
+		// test if inner mask is filled
+		if (limask[x]) {
+			// test if pixel to the right, or to the left, are empty in the inner mask,
+			// but filled in the outer mask
+			if ((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) {
+				isz++;							// increment inner edge size
+				lres[x]=4;						// flag pixel as inner edge
+			}
+			else {
+				res[x]=1.0f;					// pixel is just part of inner mask, and it's not an edge
+			}
+		}
+		else if (lomask[x]) {					// inner mask was empty, test if outer mask is filled
+			osz++;								// increment outer edge size
+			lres[x]=3;							// flag pixel as outer edge
+		}
+	}
+
+	/* Test the BOTTOM row of pixels in buffer, except corners */
+	for (x= rw-2; x; x--) {
+		// test if inner mask is filled
+		if (limask[x]) {
+			// test if pixel to the right, or to the left, are empty in the inner mask,
+			// but filled in the outer mask
+			if ((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) {
+				isz++;							// increment inner edge size
+				lres[x]=4;						// flag pixel as inner edge
+			}
+			else {
+				res[x]=1.0f;					// pixel is just part of inner mask, and it's not an edge
+			}
+		}
+		else if (lomask[x]) {					// inner mask was empty, test if outer mask is filled
+			osz++;								// increment outer edge size
+			lres[x]=3;							// flag pixel as outer edge
+		}
+	}
+	/* Test the LEFT edge of pixels in buffer, except corners */
+	for (x= t-(rw<<1)+1; x>=rw; x-=rw) {
+		// test if inner mask is filled
+		if (limask[x]) {
+			// test if pixel underneath, or above, are empty in the inner mask,
+			// but filled in the outer mask
+			if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) {
+				isz++;							// increment inner edge size
+				lres[x]=4;						// flag pixel as inner edge
+			}
+			else {
+				res[x]=1.0f;					// pixel is just part of inner mask, and it's not an edge
+			}
+		}
+		else if (lomask[x]) {					// inner mask was empty, test if outer mask is filled
+			osz++;								// increment outer edge size
+			lres[x]=3;							// flag pixel as outer edge
+		}
+	}
+
+	/* Test the RIGHT edge of pixels in buffer, except corners */
+	for (x= t-rw; x>rw; x-=rw) {
+		// test if inner mask is filled
+		if (limask[x]) {
+			// test if pixel underneath, or above, are empty in the inner mask,
+			// but filled in the outer mask
+			if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) {
+				isz++;							// increment inner edge size
+				lres[x]=4;						// flag pixel as inner edge
+			}
+			else {
+				res[x]=1.0f;					// pixel is just part of inner mask, and it's not an edge
+			}
+		}
+		else if (lomask[x]) {					// inner mask was empty, test if outer mask is filled
+			osz++;								// increment outer edge size
+			lres[x]=3;							// flag pixel as outer edge
+		}
+	}
+
+	rsize[0]=isz; // fill in our return sizes for edges + fill
+	rsize[1]=osz;
+	rsize[2]=gsz;
 }
 
-static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize){
-    int x;
-    unsigned int isz=0; // inner edge size
-    unsigned int osz=0; // outer edge size
-    unsigned int gsz=0; // gradient fill area size
-    /* Test the four corners */
-    /* upper left corner */
-    x=t-rw+1;
-    // test if inner mask is filled
-    if(limask[x]){
-        // test if pixel underneath, or to the right, are empty in the inner mask,
-        // but filled in the outer mask
-        if((!limask[x-rw] && lomask[x-rw]) || (!limask[x+1] && lomask[x+1])){
-            isz++;                               // increment inner edge size
-            lres[x]=4;                           // flag pixel as inner edge
-        } else {
-            res[x]=1.0f;                         // pixel is just part of inner mask, and it's not an edge
-        }
-    } else if(lomask[x]){                        // inner mask was empty, test if outer mask is filled
-        if(!lomask[x-rw] || !lomask[x+1]) {      // test if outer mask is empty underneath or to the right
-            osz++;                               // increment outer edge size
-            lres[x]=3;                           // flag pixel as outer edge
-        } else {
-            gsz++;                               // increment the gradient pixel count
-            lres[x]=2;                           // flag pixel as gradient
-        }
-    }
-    /* upper right corner */
-    x=t;
-    // test if inner mask is filled
-    if(limask[x]){
-        // test if pixel underneath, or to the left, are empty in the inner mask,
-        // but filled in the outer mask
-        if((!limask[x-rw] && lomask[x-rw]) || (!limask[x-1] && lomask[x-1])){
-            isz++;                               // increment inner edge size
-            lres[x]=4;                           // flag pixel as inner edge
-        } else {
-            res[x]=1.0f;                         // pixel is just part of inner mask, and it's not an edge
-        }
-    } else if(lomask[x]){                        // inner mask was empty, test if outer mask is filled
-        if(!lomask[x-rw] || !lomask[x-1]) {      // test if outer mask is empty underneath or to the left
-            osz++;                               // increment outer edge size
-            lres[x]=3;                           // flag pixel as outer edge
-        } else {
-            gsz++;                               // increment the gradient pixel count
-            lres[x]=2;                           // flag pixel as gradient
-        }
-    }
-    /* lower left corner */
-    x=0;
-    // test if inner mask is filled
-    if(limask[x]){
-        // test if pixel above, or to the right, are empty in the inner mask,
-        // but filled in the outer mask
-        if((!limask[x+rw] && lomask[x+rw]) || (!limask[x+1] && lomask[x+1])){
-            isz++;                               // increment inner edge size
-            lres[x]=4;                           // flag pixel as inner edge
-        } else {
-            res[x]=1.0f;                         // pixel is just part of inner mask, and it's not an edge
-        }
-    } else if(lomask[x]){                        // inner mask was empty, test if outer mask is filled
-        if(!lomask[x+rw] || !lomask[x+1]) {      // test if outer mask is empty above or to the right
-            osz++;                               // increment outer edge size
-            lres[x]=3;                           // flag pixel as outer edge
-        } else {
-            gsz++;                               // increment the gradient pixel count
-            lres[x]=2;                           // flag pixel as gradient
-        }
-    }
-    /* lower right corner */
-    x=rw-1;
-    // test if inner mask is filled
-    if(limask[x]){
-        // test if pixel above, or to the left, are empty in the inner mask,
-        // but filled in the outer mask
-        if((!limask[x+rw] && lomask[x+rw]) || (!limask[x-1] && lomask[x-1])){
-            isz++;                               // increment inner edge size
-            lres[x]=4;                           // flag pixel as inner edge
-        } else {
-            res[x]=1.0f;                         // pixel is just part of inner mask, and it's not an edge
-        }
-    } else if(lomask[x]){                        // inner mask was empty, test if outer mask is filled
-        if(!lomask[x+rw] || !lomask[x-1]) {      // test if outer mask is empty above or to the left
-            osz++;                               // increment outer edge size
-            lres[x]=3;                           // flag pixel as outer edge
-        } else {
-            gsz++;                               // increment the gradient pixel count
-            lres[x]=2;                           // flag pixel as gradient
-        }
-    }
-    /* Test the TOP row of pixels in buffer, except corners */
-    for(x= t-1; x>=(t-rw)+2; x--) {
-        // test if inner mask is filled
-        if(limask[x]) {
-            // test if pixel to the left, or to the right, are empty in the inner mask,
-            // but filled in the outer mask
-            if((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) {
-                isz++;                           // increment inner edge size
-                lres[x]=4;                       // flag pixel as inner edge
-            } else {
-                res[x]=1.0f;                     // pixel is just part of inner mask, and it's not an edge
-            }
-        } else if(lomask[x]) {                   // inner mask was empty, test if outer mask is filled
-            if(!lomask[x-1] || !lomask[x+1]) {   // test if outer mask is empty to the left or to the right
-                osz++;                           // increment outer edge size
-                lres[x]=3;                       // flag pixel as outer edge
-            } else {
-                gsz++;                           // increment the gradient pixel count
-                lres[x]=2;                       // flag pixel as gradient
-            }
-        }
-    }
-
-    /* Test the BOTTOM row of pixels in buffer, except corners */
-    for(x= rw-2; x; x--) {
-        // test if inner mask is filled
-        if(limask[x]) {
-            // test if pixel to the left, or to the right, are empty in the inner mask,
-            // but filled in the outer mask
-            if((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) {
-                isz++;                           // increment inner edge size
-                lres[x]=4;                       // flag pixel as inner edge
-            } else {
-                res[x]=1.0f;                     // pixel is just part of inner mask, and it's not an edge
-            }
-        } else if(lomask[x]) {                   // inner mask was empty, test if outer mask is filled
-            if(!lomask[x-1] || !lomask[x+1]) {   // test if outer mask is empty to the left or to the right
-                osz++;                           // increment outer edge size
-                lres[x]=3;                       // flag pixel as outer edge
-            } else {
-                gsz++;                           // increment the gradient pixel count
-                lres[x]=2;                       // flag pixel as gradient
-            }
-        }
-    }
-    /* Test the LEFT edge of pixels in buffer, except corners */
-    for(x= t-(rw<<1)+1; x>=rw; x-=rw) {
-        // test if inner mask is filled
-        if(limask[x]) {
-            // test if pixel underneath, or above, are empty in the inner mask,
-            // but filled in the outer mask
-            if((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) {
-                isz++;                           // increment inner edge size
-                lres[x]=4;                       // flag pixel as inner edge
-            } else {
-                res[x]=1.0f;                     // pixel is just part of inner mask, and it's not an edge
-            }
-        } else if(lomask[x]) {                   // inner mask was empty, test if outer mask is filled
-            if(!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above
-                osz++;                           // increment outer edge size
-                lres[x]=3;                       // flag pixel as outer edge
-            } else {
-                gsz++;                           // increment the gradient pixel count
-                lres[x]=2;                       // flag pixel as gradient
-            }
-        }
-    }
-
-    /* Test the RIGHT edge of pixels in buffer, except corners */
-    for(x= t-rw; x>rw; x-=rw) {
-        // test if inner mask is filled
-        if(limask[x]) {
-            // test if pixel underneath, or above, are empty in the inner mask,
-            // but filled in the outer mask
-            if((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) {
-                isz++;                           // increment inner edge size
-                lres[x]=4;                       // flag pixel as inner edge
-            } else {
-                res[x]=1.0f;                     // pixel is just part of inner mask, and it's not an edge
-            }
-        } else if(lomask[x]) {                   // inner mask was empty, test if outer mask is filled
-            if(!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above
-                osz++;                           // increment outer edge size
-                lres[x]=3;                       // flag pixel as outer edge
-            } else {
-                gsz++;                           // increment the gradient pixel count
-                lres[x]=2;                       // flag pixel as gradient
-            }
-        }
-    }
-
-    rsize[0]=isz;  // fill in our return sizes for edges + fill
-    rsize[1]=osz;
-    rsize[2]=gsz;
+static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize)
+{
+	int x;
+	unsigned int isz=0; // inner edge size
+	unsigned int osz=0; // outer edge size
+	unsigned int gsz=0; // gradient fill area size
+	/* Test the four corners */
+	/* upper left corner */
+	x=t-rw+1;
+	// test if inner mask is filled
+	if (limask[x]) {
+		// test if pixel underneath, or to the right, are empty in the inner mask,
+		// but filled in the outer mask
+		if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+1] && lomask[x+1])) {
+			isz++;								// increment inner edge size
+			lres[x]=4;							// flag pixel as inner edge
+		}
+		else {
+			res[x]=1.0f;						// pixel is just part of inner mask, and it's not an edge
+		}
+	}
+	else if (lomask[x]) {						// inner mask was empty, test if outer mask is filled
+		if (!lomask[x-rw] || !lomask[x+1]) {		// test if outer mask is empty underneath or to the right
+			osz++;								// increment outer edge size
+			lres[x]=3;							// flag pixel as outer edge
+		}
+		else {
+			gsz++;								// increment the gradient pixel count
+			lres[x]=2;							// flag pixel as gradient
+		}
+	}
+	/* upper right corner */
+	x=t;
+	// test if inner mask is filled
+	if (limask[x]) {
+		// test if pixel underneath, or to the left, are empty in the inner mask,
+		// but filled in the outer mask
+		if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x-1] && lomask[x-1])) {
+			isz++;								// increment inner edge size
+			lres[x]=4;							// flag pixel as inner edge
+		}
+		else {
+			res[x]=1.0f;						// pixel is just part of inner mask, and it's not an edge
+		}
+	}
+	else if (lomask[x]) {						// inner mask was empty, test if outer mask is filled
+		if (!lomask[x-rw] || !lomask[x-1]) {	// test if outer mask is empty underneath or to the left
+			osz++;								// increment outer edge size
+			lres[x]=3;							// flag pixel as outer edge
+		}
+		else {
+			gsz++;								// increment the gradient pixel count
+			lres[x]=2;							// flag pixel as gradient
+		}
+	}
+	/* lower left corner */
+	x=0;
+	// test if inner mask is filled
+	if (limask[x]) {
+		// test if pixel above, or to the right, are empty in the inner mask,
+		// but filled in the outer mask
+		if ((!limask[x+rw] && lomask[x+rw]) || (!limask[x+1] && lomask[x+1])) {
+			isz++;								// increment inner edge size
+			lres[x]=4;							// flag pixel as inner edge
+		}
+		else {
+			res[x]=1.0f;						// pixel is just part of inner mask, and it's not an edge
+		}
+	}
+	else if (lomask[x]) {						// inner mask was empty, test if outer mask is filled
+		if (!lomask[x+rw] || !lomask[x+1]) {	// test if outer mask is empty above or to the right
+			osz++;								// increment outer edge size
+			lres[x]=3;							// flag pixel as outer edge
+		}
+		else {
+			gsz++;								// increment the gradient pixel count
+			lres[x]=2;							// flag pixel as gradient
+		}
+	}
+	/* lower right corner */
+	x=rw-1;
+	// test if inner mask is filled
+	if (limask[x]) {
+		// test if pixel above, or to the left, are empty in the inner mask,
+		// but filled in the outer mask
+		if ((!limask[x+rw] && lomask[x+rw]) || (!limask[x-1] && lomask[x-1])) {
+			isz++;								// increment inner edge size
+			lres[x]=4;							// flag pixel as inner edge
+		}
+		else {
+			res[x]=1.0f;						// pixel is just part of inner mask, and it's not an edge
+		}
+	}
+	else if (lomask[x]) {						// inner mask was empty, test if outer mask is filled
+		if (!lomask[x+rw] || !lomask[x-1]) {	// test if outer mask is empty above or to the left
+			osz++;								// increment outer edge size
+			lres[x]=3;							// flag pixel as outer edge
+		}
+		else {
+			gsz++;								// increment the gradient pixel count
+			lres[x]=2;							// flag pixel as gradient
+		}
+	}
+	/* Test the TOP row of pixels in buffer, except corners */
+	for (x= t-1; x>=(t-rw)+2; x--) {
+		// test if inner mask is filled
+		if (limask[x]) {
+			// test if pixel to the left, or to the right, are empty in the inner mask,
+			// but filled in the outer mask
+			if ((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) {
+				isz++;							// increment inner edge size
+				lres[x]=4;						// flag pixel as inner edge
+			}
+			else {
+				res[x]=1.0f;					// pixel is just part of inner mask, and it's not an edge
+			}
+		}
+		else if (lomask[x]) {					// inner mask was empty, test if outer mask is filled
+			if (!lomask[x-1] || !lomask[x+1]) {	// test if outer mask is empty to the left or to the right
+				osz++;							// increment outer edge size
+				lres[x]=3;						// flag pixel as outer edge
+			}
+			else {
+				gsz++;							// increment the gradient pixel count
+				lres[x]=2;						// flag pixel as gradient
+			}
+		}
+	}
+
+	/* Test the BOTTOM row of pixels in buffer, except corners */
+	for (x= rw-2; x; x--) {
+		// test if inner mask is filled
+		if (limask[x]) {
+			// test if pixel to the left, or to the right, are empty in the inner mask,
+			// but filled in the outer mask
+			if ((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) {
+				isz++;							// increment inner edge size
+				lres[x]=4;						// flag pixel as inner edge
+			}
+			else {
+				res[x]=1.0f;					// pixel is just part of inner mask, and it's not an edge
+			}
+		}
+		else if (lomask[x]) {					// inner mask was empty, test if outer mask is filled
+			if (!lomask[x-1] || !lomask[x+1]) {	// test if outer mask is empty to the left or to the right
+				osz++;							// increment outer edge size
+				lres[x]=3;						// flag pixel as outer edge
+			}
+			else {
+				gsz++;							// increment the gradient pixel count
+				lres[x]=2;						// flag pixel as gradient
+			}
+		}
+	}
+	/* Test the LEFT edge of pixels in buffer, except corners */
+	for (x= t-(rw<<1)+1; x>=rw; x-=rw) {
+		// test if inner mask is filled
+		if (limask[x]) {
+			// test if pixel underneath, or above, are empty in the inner mask,
+			// but filled in the outer mask
+			if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) {
+				isz++;							// increment inner edge size
+				lres[x]=4;						// flag pixel as inner edge
+			}
+			else {
+				res[x]=1.0f;					// pixel is just part of inner mask, and it's not an edge
+			}
+		}
+		else if (lomask[x]) {						// inner mask was empty, test if outer mask is filled
+			if (!lomask[x-rw] || !lomask[x+rw]) {	// test if outer mask is empty underneath or above
+				osz++;								// increment outer edge size
+				lres[x]=3;							// flag pixel as outer edge
+			}
+			else {
+				gsz++;							// increment the gradient pixel count
+				lres[x]=2;						// flag pixel as gradient
+			}
+		}
+	}
+
+	/* Test the RIGHT edge of pixels in buffer, except corners */
+	for (x= t-rw; x>rw; x-=rw) {
+		// test if inner mask is filled
+		if (limask[x]) {
+			// test if pixel underneath, or above, are empty in the inner mask,
+			// but filled in the outer mask
+			if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) {
+				isz++;							// increment inner edge size
+				lres[x]=4;						// flag pixel as inner edge
+			}
+			else {
+				res[x]=1.0f;					// pixel is just part of inner mask, and it's not an edge
+			}
+		}
+		else if (lomask[x]) {						// inner mask was empty, test if outer mask is filled
+			if (!lomask[x-rw] || !lomask[x+rw]) {	// test if outer mask is empty underneath or above
+				osz++;								// increment outer edge size
+				lres[x]=3;							// flag pixel as outer edge
+			}
+			else {
+				gsz++;							// increment the gradient pixel count
+				lres[x]=2;						// flag pixel as gradient
+			}
+		}
+	}
+
+	rsize[0]=isz;  // fill in our return sizes for edges + fill
+	rsize[1]=osz;
+	rsize[2]=gsz;
 }
 
-static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize){
-    int x;
-    unsigned int isz=0; // inner edge size
-    unsigned int osz=0; // outer edge size
-    unsigned int gsz=0; // gradient fill area size
-    /* Test the four corners */
-    /* upper left corner */
-    x=t-rw+1;
-    // test if inner mask is filled
-    if(limask[x]){
-        // test if the inner mask is empty underneath or to the right
-        if(!limask[x-rw] || !limask[x+1]){
-            isz++;                               // increment inner edge size
-            lres[x]=4;                           // flag pixel as inner edge
-        } else {
-            res[x]=1.0f;                         // pixel is just part of inner mask, and it's not an edge
-        }
-    } else if(lomask[x]){                        // inner mask was empty, test if outer mask is filled
-        osz++;                                   // increment outer edge size
-        lres[x]=3;                               // flag pixel as outer edge
-    }
-    /* upper right corner */
-    x=t;
-    // test if inner mask is filled
-    if(limask[x]){
-        // test if the inner mask is empty underneath or to the left
-        if(!limask[x-rw] || !limask[x-1]){
-            isz++;                               // increment inner edge size
-            lres[x]=4;                           // flag pixel as inner edge
-        } else {
-            res[x]=1.0f;                         // pixel is just part of inner mask, and it's not an edge
-        }
-    } else if(lomask[x]){                        // inner mask was empty, test if outer mask is filled
-        osz++;                                   // increment outer edge size
-        lres[x]=3;                               // flag pixel as outer edge
-    }
-    /* lower left corner */
-    x=0;
-    // test if inner mask is filled
-    if(limask[x]){
-        // test if inner mask is empty above or to the right
-        if(!limask[x+rw] || !limask[x+1]){
-            isz++;                               // increment inner edge size
-            lres[x]=4;                           // flag pixel as inner edge
-        } else {
-            res[x]=1.0f;                         // pixel is just part of inner mask, and it's not an edge
-        }
-    } else if(lomask[x]){                        // inner mask was empty, test if outer mask is filled
-        osz++;                                   // increment outer edge size
-        lres[x]=3;                               // flag pixel as outer edge
-    }
-    /* lower right corner */
-    x=rw-1;
-    // test if inner mask is filled
-    if(limask[x]){
-        // test if inner mask is empty above or to the left
-        if(!limask[x+rw] || !limask[x-1]){
-            isz++;                               // increment inner edge size
-            lres[x]=4;                           // flag pixel as inner edge
-        } else {
-            res[x]=1.0f;                         // pixel is just part of inner mask, and it's not an edge
-        }
-    } else if(lomask[x]){                        // inner mask was empty, test if outer mask is filled
-        osz++;                                   // increment outer edge size
-        lres[x]=3;                               // flag pixel as outer edge
-    }
-
-    /* Test the TOP row of pixels in buffer, except corners */
-    for(x= t-1; x>=(t-rw)+2; x--) {
-        // test if inner mask is filled
-        if(limask[x]) {
-            // test if inner mask is empty to the left or to the right
-            if(!limask[x-1] || !limask[x+1]) {
-                isz++;                           // increment inner edge size
-                lres[x]=4;                       // flag pixel as inner edge
-            } else {
-                res[x]=1.0f;                     // pixel is just part of inner mask, and it's not an edge
-            }
-        } else if(lomask[x]) {                   // inner mask was empty, test if outer mask is filled
-            osz++;                               // increment outer edge size
-            lres[x]=3;                           // flag pixel as outer edge
-        }
-    }
-
-    /* Test the BOTTOM row of pixels in buffer, except corners */
-    for(x= rw-2; x; x--) {
-        // test if inner mask is filled
-        if(limask[x]) {
-            // test if inner mask is empty to the left or to the right
-            if(!limask[x-1] || !limask[x+1]) {
-                isz++;                           // increment inner edge size
-                lres[x]=4;                       // flag pixel as inner edge
-            } else {
-                res[x]=1.0f;                     // pixel is just part of inner mask, and it's not an edge
-            }
-        } else if(lomask[x]) {                   // inner mask was empty, test if outer mask is filled
-            osz++;                               // increment outer edge size
-            lres[x]=3;                           // flag pixel as outer edge
-        }
-    }
-    /* Test the LEFT edge of pixels in buffer, except corners */
-    for(x= t-(rw<<1)+1; x>=rw; x-=rw) {
-        // test if inner mask is filled
-        if(limask[x]) {
-            // test if inner mask is empty underneath or above
-            if(!limask[x-rw] || !limask[x+rw]) {
-                isz++;                           // increment inner edge size
-                lres[x]=4;                       // flag pixel as inner edge
-            } else {
-                res[x]=1.0f;                     // pixel is just part of inner mask, and it's not an edge
-            }
-        } else if(lomask[x]) {                   // inner mask was empty, test if outer mask is filled
-            osz++;                               // increment outer edge size
-            lres[x]=3;                           // flag pixel as outer edge
-        }
-    }
-
-    /* Test the RIGHT edge of pixels in buffer, except corners */
-    for(x= t-rw; x>rw; x-=rw) {
-        // test if inner mask is filled
-        if(limask[x]) {
-            // test if inner mask is empty underneath or above
-            if(!limask[x-rw] || !limask[x+rw]) {
-                isz++;                           // increment inner edge size
-                lres[x]=4;                       // flag pixel as inner edge
-            } else {
-                res[x]=1.0f;                     // pixel is just part of inner mask, and it's not an edge
-            }
-        } else if(lomask[x]) {                   // inner mask was empty, test if outer mask is filled
-            osz++;                               // increment outer edge size
-            lres[x]=3;                           // flag pixel as outer edge
-        }
-    }
-
-    rsize[0]=isz;  // fill in our return sizes for edges + fill
-    rsize[1]=osz;
-    rsize[2]=gsz;
+static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize)
+{
+	int x;
+	unsigned int isz=0; // inner edge size
+	unsigned int osz=0; // outer edge size
+	unsigned int gsz=0; // gradient fill area size
+	/* Test the four corners */
+	/* upper left corner */
+	x=t-rw+1;
+	// test if inner mask is filled
+	if (limask[x]) {
+		// test if the inner mask is empty underneath or to the right
+		if (!limask[x-rw] || !limask[x+1]) {
+			isz++;								// increment inner edge size
+			lres[x]=4;							// flag pixel as inner edge
+		}
+		else {
+			res[x]=1.0f;						// pixel is just part of inner mask, and it's not an edge
+		}
+	}
+	else if (lomask[x]) {						// inner mask was empty, test if outer mask is filled
+		osz++;									// increment outer edge size
+		lres[x]=3;								// flag pixel as outer edge
+	}
+	/* upper right corner */
+	x=t;
+	// test if inner mask is filled
+	if (limask[x]) {
+		// test if the inner mask is empty underneath or to the left
+		if (!limask[x-rw] || !limask[x-1]) {
+			isz++;								// increment inner edge size
+			lres[x]=4;							// flag pixel as inner edge
+		}
+		else {
+			res[x]=1.0f;						// pixel is just part of inner mask, and it's not an edge
+		}
+	}
+	else if (lomask[x]) {						// inner mask was empty, test if outer mask is filled
+		osz++;									// increment outer edge size
+		lres[x]=3;								// flag pixel as outer edge
+	}
+	/* lower left corner */
+	x=0;
+	// test if inner mask is filled
+	if (limask[x]) {
+		// test if inner mask is empty above or to the right
+		if (!limask[x+rw] || !limask[x+1]) {
+			isz++;								// increment inner edge size
+			lres[x]=4;							// flag pixel as inner edge
+		}
+		else {
+			res[x]=1.0f;						// pixel is just part of inner mask, and it's not an edge
+		}
+	}
+	else if (lomask[x]) {						// inner mask was empty, test if outer mask is filled
+		osz++;									// increment outer edge size
+		lres[x]=3;								// flag pixel as outer edge
+	}
+	/* lower right corner */
+	x=rw-1;
+	// test if inner mask is filled
+	if (limask[x]) {
+		// test if inner mask is empty above or to the left
+		if (!limask[x+rw] || !limask[x-1]) {
+			isz++;								// increment inner edge size
+			lres[x]=4;							// flag pixel as inner edge
+		}
+		else {
+			res[x]=1.0f;						// pixel is just part of inner mask, and it's not an edge
+		}
+	}
+	else if (lomask[x]) {						// inner mask was empty, test if outer mask is filled
+		osz++;									// increment outer edge size
+		lres[x]=3;								// flag pixel as outer edge
+	}
+
+	/* Test the TOP row of pixels in buffer, except corners */
+	for (x= t-1; x>=(t-rw)+2; x--) {
+		// test if inner mask is filled
+		if (limask[x]) {
+			// test if inner mask is empty to the left or to the right
+			if (!limask[x-1] || !limask[x+1]) {
+				isz++;							// increment inner edge size
+				lres[x]=4;						// flag pixel as inner edge
+			}
+			else {
+				res[x]=1.0f;					// pixel is just part of inner mask, and it's not an edge
+			}
+		}
+		else if (lomask[x]) {					// inner mask was empty, test if outer mask is filled
+			osz++;								// increment outer edge size
+			lres[x]=3;							// flag pixel as outer edge
+		}
+	}
+
+	/* Test the BOTTOM row of pixels in buffer, except corners */
+	for (x= rw-2; x; x--) {
+		// test if inner mask is filled
+		if (limask[x]) {
+			// test if inner mask is empty to the left or to the right
+			if (!limask[x-1] || !limask[x+1]) {
+				isz++;							// increment inner edge size
+				lres[x]=4;						// flag pixel as inner edge
+			}
+			else {
+				res[x]=1.0f;					// pixel is just part of inner mask, and it's not an edge
+			}
+		}
+		else if (lomask[x]) {					// inner mask was empty, test if outer mask is filled
+			osz++;								// increment outer edge size
+			lres[x]=3;							// flag pixel as outer edge
+		}
+	}
+	/* Test the LEFT edge of pixels in buffer, except corners */
+	for (x= t-(rw<<1)+1; x>=rw; x-=rw) {
+		// test if inner mask is filled
+		if (limask[x]) {
+			// test if inner mask is empty underneath or above
+			if (!limask[x-rw] || !limask[x+rw]) {
+				isz++;							// increment inner edge size
+				lres[x]=4;						// flag pixel as inner edge
+			}
+			else {
+				res[x]=1.0f;					// pixel is just part of inner mask, and it's not an edge
+			}
+		}
+		else if (lomask[x]) {					// inner mask was empty, test if outer mask is filled
+			osz++;								// increment outer edge size
+			lres[x]=3;							// flag pixel as outer edge
+		}
+	}
+
+	/* Test the RIGHT edge of pixels in buffer, except corners */
+	for (x= t-rw; x>rw; x-=rw) {
+		// test if inner mask is filled
+		if (limask[x]) {
+			// test if inner mask is empty underneath or above
+			if (!limask[x-rw] || !limask[x+rw]) {
+				isz++;							// increment inner edge size
+				lres[x]=4;						// flag pixel as inner edge
+			}
+			else {
+				res[x]=1.0f;					// pixel is just part of inner mask, and it's not an edge
+			}
+		}
+		else if (lomask[x]) {					// inner mask was empty, test if outer mask is filled
+			osz++;								// increment outer edge size
+			lres[x]=3;							// flag pixel as outer edge
+		}
+	}
+
+	rsize[0]=isz;  // fill in our return sizes for edges + fill
+	rsize[1]=osz;
+	rsize[2]=gsz;
 }
 
-static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize){
-    int x;
-    unsigned int isz=0; // inner edge size
-    unsigned int osz=0; // outer edge size
-    unsigned int gsz=0; // gradient fill area size
-    /* Test the four corners */
-    /* upper left corner */
-    x=t-rw+1;
-    // test if inner mask is filled
-    if(limask[x]){
-        // test if the inner mask is empty underneath or to the right
-        if(!limask[x-rw] || !limask[x+1]){
-            isz++;                               // increment inner edge size
-            lres[x]=4;                           // flag pixel as inner edge
-        } else {
-            res[x]=1.0f;                         // pixel is just part of inner mask, and it's not an edge
-        }
-    } else if(lomask[x]){                        // inner mask was empty, test if outer mask is filled
-        if(!lomask[x-rw] || !lomask[x+1]) {      // test if outer mask is empty underneath or to the right
-            osz++;                               // increment outer edge size
-            lres[x]=3;                           // flag pixel as outer edge
-        } else {
-            gsz++;                               // increment the gradient pixel count
-            lres[x]=2;                           // flag pixel as gradient
-        }
-    }
-    /* upper right corner */
-    x=t;
-    // test if inner mask is filled
-    if(limask[x]){
-        // test if the inner mask is empty underneath or to the left
-        if(!limask[x-rw] || !limask[x-1]){
-            isz++;                               // increment inner edge size
-            lres[x]=4;                           // flag pixel as inner edge
-        } else {
-            res[x]=1.0f;                         // pixel is just part of inner mask, and it's not an edge
-        }
-    } else if(lomask[x]){                        // inner mask was empty, test if outer mask is filled
-        if(!lomask[x-rw] || !lomask[x-1]) {      // test if outer mask is empty above or to the left
-            osz++;                               // increment outer edge size
-            lres[x]=3;                           // flag pixel as outer edge
-        } else {
-            gsz++;                               // increment the gradient pixel count
-            lres[x]=2;                           // flag pixel as gradient
-        }
-    }
-    /* lower left corner */
-    x=0;
-    // test if inner mask is filled
-    if(limask[x]){
-        // test if inner mask is empty above or to the right
-        if(!limask[x+rw] || !limask[x+1]){
-            isz++;                               // increment inner edge size
-            lres[x]=4;                           // flag pixel as inner edge
-        } else {
-            res[x]=1.0f;                         // pixel is just part of inner mask, and it's not an edge
-        }
-    } else if(lomask[x]){                        // inner mask was empty, test if outer mask is filled
-        if(!lomask[x+rw] || !lomask[x+1]) {      // test if outer mask is empty underneath or to the right
-            osz++;                               // increment outer edge size
-            lres[x]=3;                           // flag pixel as outer edge
-        } else {
-            gsz++;                               // increment the gradient pixel count
-            lres[x]=2;                           // flag pixel as gradient
-        }
-    }
-    /* lower right corner */
-    x=rw-1;
-    // test if inner mask is filled
-    if(limask[x]){
-        // test if inner mask is empty above or to the left
-        if(!limask[x+rw] || !limask[x-1]){
-            isz++;                               // increment inner edge size
-            lres[x]=4;                           // flag pixel as inner edge
-        } else {
-            res[x]=1.0f;                         // pixel is just part of inner mask, and it's not an edge
-        }
-    } else if(lomask[x]){                        // inner mask was empty, test if outer mask is filled
-        if(!lomask[x+rw] || !lomask[x-1]) {      // test if outer mask is empty underneath or to the left
-            osz++;                               // increment outer edge size
-            lres[x]=3;                           // flag pixel as outer edge
-        } else {
-            gsz++;                               // increment the gradient pixel count
-            lres[x]=2;                           // flag pixel as gradient
-        }
-    }
-    /* Test the TOP row of pixels in buffer, except corners */
-    for(x= t-1; x>=(t-rw)+2; x--) {
-        // test if inner mask is filled
-        if(limask[x]) {
-            // test if inner mask is empty to the left or to the right
-            if(!limask[x-1] || !limask[x+1]) {
-                isz++;                           // increment inner edge size
-                lres[x]=4;                       // flag pixel as inner edge
-            } else {
-                res[x]=1.0f;                     // pixel is just part of inner mask, and it's not an edge
-            }
-        } else if(lomask[x]) {                   // inner mask was empty, test if outer mask is filled
-            if(!lomask[x-1] || !lomask[x+1]) {   // test if outer mask is empty to the left or to the right
-                osz++;                           // increment outer edge size
-                lres[x]=3;                       // flag pixel as outer edge
-            } else {
-                gsz++;                           // increment the gradient pixel count
-                lres[x]=2;                       // flag pixel as gradient
-            }
-        }
-    }
-
-    /* Test the BOTTOM row of pixels in buffer, except corners */
-    for(x= rw-2; x; x--) {
-        // test if inner mask is filled
-        if(limask[x]) {
-            // test if inner mask is empty to the left or to the right
-            if(!limask[x-1] || !limask[x+1]) {
-                isz++;                           // increment inner edge size
-                lres[x]=4;                       // flag pixel as inner edge
-            } else {
-                res[x]=1.0f;                     // pixel is just part of inner mask, and it's not an edge
-            }
-        } else if(lomask[x]) {                   // inner mask was empty, test if outer mask is filled
-            if(!lomask[x-1] || !lomask[x+1]) {   // test if outer mask is empty to the left or to the right
-                osz++;                           // increment outer edge size
-                lres[x]=3;                       // flag pixel as outer edge
-            } else {
-                gsz++;                           // increment the gradient pixel count
-                lres[x]=2;                       // flag pixel as gradient
-            }
-        }
-    }
-    /* Test the LEFT edge of pixels in buffer, except corners */
-    for(x= t-(rw<<1)+1; x>=rw; x-=rw) {
-        // test if inner mask is filled
-        if(limask[x]) {
-            // test if inner mask is empty underneath or above
-            if(!limask[x-rw] || !limask[x+rw]) {
-                isz++;                           // increment inner edge size
-                lres[x]=4;                       // flag pixel as inner edge
-            } else {
-                res[x]=1.0f;                     // pixel is just part of inner mask, and it's not an edge
-            }
-        } else if(lomask[x]) {                   // inner mask was empty, test if outer mask is filled
-            if(!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above
-                osz++;                           // increment outer edge size
-                lres[x]=3;                       // flag pixel as outer edge
-            } else {
-                gsz++;                           // increment the gradient pixel count
-                lres[x]=2;                       // flag pixel as gradient
-            }
-        }
-    }
-
-    /* Test the RIGHT edge of pixels in buffer, except corners */
-    for(x= t-rw; x>rw; x-=rw) {
-        // test if inner mask is filled
-        if(limask[x]) {
-            // test if inner mask is empty underneath or above
-            if(!limask[x-rw] || !limask[x+rw]) {
-                isz++;                           // increment inner edge size
-                lres[x]=4;                       // flag pixel as inner edge
-            } else {
-                res[x]=1.0f;                     // pixel is just part of inner mask, and it's not an edge
-            }
-        } else if(lomask[x]) {                   // inner mask was empty, test if outer mask is filled
-            if(!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above
-                osz++;                           // increment outer edge size
-                lres[x]=3;                       // flag pixel as outer edge
-            } else {
-                gsz++;                           // increment the gradient pixel count
-                lres[x]=2;                       // flag pixel as gradient
-            }
-        }
-    }
-
-    rsize[0]=isz;  // fill in our return sizes for edges + fill
-    rsize[1]=osz;
-    rsize[2]=gsz;
+static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize)
+{
+	int x;
+	unsigned int isz=0; // inner edge size
+	unsigned int osz=0; // outer edge size
+	unsigned int gsz=0; // gradient fill area size
+	/* Test the four corners */
+	/* upper left corner */
+	x=t-rw+1;
+	// test if inner mask is filled
+	if (limask[x]) {
+		// test if the inner mask is empty underneath or to the right
+		if (!limask[x-rw] || !limask[x+1]) {
+			isz++;								// increment inner edge size
+			lres[x]=4;							// flag pixel as inner edge
+		}
+		else {
+			res[x]=1.0f;						// pixel is just part of inner mask, and it's not an edge
+		}
+	}
+	else if (lomask[x]) {						// inner mask was empty, test if outer mask is filled
+		if (!lomask[x-rw] || !lomask[x+1]) {	// test if outer mask is empty underneath or to the right
+			osz++;								// increment outer edge size
+			lres[x]=3;							// flag pixel as outer edge
+		}
+		else {
+			gsz++;								// increment the gradient pixel count
+			lres[x]=2;							// flag pixel as gradient
+		}
+	}
+	/* upper right corner */
+	x=t;
+	// test if inner mask is filled
+	if (limask[x]) {
+		// test if the inner mask is empty underneath or to the left
+		if (!limask[x-rw] || !limask[x-1]) {
+			isz++;								// increment inner edge size
+			lres[x]=4;							// flag pixel as inner edge
+		}
+		else {
+			res[x]=1.0f;						// pixel is just part of inner mask, and it's not an edge
+		}
+	}
+	else if (lomask[x]) {						// inner mask was empty, test if outer mask is filled
+		if (!lomask[x-rw] || !lomask[x-1]) {		// test if outer mask is empty above or to the left
+			osz++;								// increment outer edge size
+			lres[x]=3;							// flag pixel as outer edge
+		}
+		else {
+			gsz++;								// increment the gradient pixel count
+			lres[x]=2;							// flag pixel as gradient
+		}
+	}
+	/* lower left corner */
+	x=0;
+	// test if inner mask is filled
+	if (limask[x]) {
+		// test if inner mask is empty above or to the right
+		if (!limask[x+rw] || !limask[x+1]) {
+			isz++;								// increment inner edge size
+			lres[x]=4;							// flag pixel as inner edge
+		}
+		else {
+			res[x]=1.0f;						// pixel is just part of inner mask, and it's not an edge
+		}
+	}
+	else if (lomask[x]) {						// inner mask was empty, test if outer mask is filled
+		if (!lomask[x+rw] || !lomask[x+1]) {	// test if outer mask is empty underneath or to the right
+			osz++;								// increment outer edge size
+			lres[x]=3;							// flag pixel as outer edge
+		}
+		else {
+			gsz++;								// increment the gradient pixel count
+			lres[x]=2;							// flag pixel as gradient
+		}
+	}
+	/* lower right corner */
+	x=rw-1;
+	// test if inner mask is filled
+	if (limask[x]) {
+		// test if inner mask is empty above or to the left
+		if (!limask[x+rw] || !limask[x-1]) {
+			isz++;								// increment inner edge size
+			lres[x]=4;							// flag pixel as inner edge
+		}
+		else {
+			res[x]=1.0f;						// pixel is just part of inner mask, and it's not an edge
+		}
+	}
+	else if (lomask[x]) {						// inner mask was empty, test if outer mask is filled
+		if (!lomask[x+rw] || !lomask[x-1]) {	// test if outer mask is empty underneath or to the left
+			osz++;								// increment outer edge size
+			lres[x]=3;							// flag pixel as outer edge
+		}
+		else {
+			gsz++;								// increment the gradient pixel count
+			lres[x]=2;							// flag pixel as gradient
+		}
+	}
+	/* Test the TOP row of pixels in buffer, except corners */
+	for (x= t-1; x>=(t-rw)+2; x--) {
+		// test if inner mask is filled
+		if (limask[x]) {
+			// test if inner mask is empty to the left or to the right
+			if (!limask[x-1] || !limask[x+1]) {
+				isz++;							// increment inner edge size
+				lres[x]=4;						// flag pixel as inner edge
+			}
+			else {
+				res[x]=1.0f;					// pixel is just part of inner mask, and it's not an edge
+			}
+		}
+		else if (lomask[x]) {					// inner mask was empty, test if outer mask is filled
+			if (!lomask[x-1] || !lomask[x+1]) {	// test if outer mask is empty to the left or to the right
+				osz++;							// increment outer edge size
+				lres[x]=3;						// flag pixel as outer edge
+			}
+			else {
+				gsz++;							// increment the gradient pixel count
+				lres[x]=2;						// flag pixel as gradient
+			}
+		}
+	}
+
+	/* Test the BOTTOM row of pixels in buffer, except corners */
+	for (x= rw-2; x; x--) {
+		// test if inner mask is filled
+		if (limask[x]) {
+			// test if inner mask is empty to the left or to the right
+			if (!limask[x-1] || !limask[x+1]) {
+				isz++;							// increment inner edge size
+				lres[x]=4;						// flag pixel as inner edge
+			}
+			else {
+				res[x]=1.0f;					// pixel is just part of inner mask, and it's not an edge
+			}
+		}
+		else if (lomask[x]) {					// inner mask was empty, test if outer mask is filled
+			if (!lomask[x-1] || !lomask[x+1]) {	// test if outer mask is empty to the left or to the right
+				osz++;							// increment outer edge size
+				lres[x]=3;						// flag pixel as outer edge
+			}
+			else {
+				gsz++;							// increment the gradient pixel count
+				lres[x]=2;						// flag pixel as gradient
+			}
+		}
+	}
+	/* Test the LEFT edge of pixels in buffer, except corners */
+	for (x= t-(rw<<1)+1; x>=rw; x-=rw) {
+		// test if inner mask is filled
+		if (limask[x]) {
+			// test if inner mask is empty underneath or above
+			if (!limask[x-rw] || !limask[x+rw]) {
+				isz++;								// increment inner edge size
+				lres[x]=4;							// flag pixel as inner edge
+			}
+			else {
+				res[x]=1.0f;						// pixel is just part of inner mask, and it's not an edge
+			}
+		}
+		else if (lomask[x]) {						// inner mask was empty, test if outer mask is filled
+			if (!lomask[x-rw] || !lomask[x+rw]) {	// test if outer mask is empty underneath or above
+				osz++;								// increment outer edge size
+				lres[x]=3;							// flag pixel as outer edge
+			}
+			else {
+				gsz++;								// increment the gradient pixel count
+				lres[x]=2;							// flag pixel as gradient
+			}
+		}
+	}
+
+	/* Test the RIGHT edge of pixels in buffer, except corners */
+	for (x= t-rw; x>rw; x-=rw) {
+		// test if inner mask is filled
+		if (limask[x]) {
+			// test if inner mask is empty underneath or above
+			if (!limask[x-rw] || !limask[x+rw]) {
+				isz++;							// increment inner edge size
+				lres[x]=4;						// flag pixel as inner edge
+			}
+			else {
+				res[x]=1.0f;					// pixel is just part of inner mask, and it's not an edge
+			}
+		}
+		else if (lomask[x]) {						// inner mask was empty, test if outer mask is filled
+			if (!lomask[x-rw] || !lomask[x+rw]) {	// test if outer mask is empty underneath or above
+				osz++;								// increment outer edge size
+				lres[x]=3;							// flag pixel as outer edge
+			}
+			else {
+				gsz++;							// increment the gradient pixel count
+				lres[x]=2;						// flag pixel as gradient
+			}
+		}
+	}
+
+	rsize[0]=isz;  // fill in our return sizes for edges + fill
+	rsize[1]=osz;
+	rsize[2]=gsz;
 }
 
-static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz){
-    int x;                             // x = pixel loop counter
-    int a;                             // a = pixel loop counter
-    int dx;                            // dx = delta x
-    int pix_prevRow;                   // pix_prevRow = pixel one row behind the one we are testing in a loop
-    int pix_nextRow;                   // pix_nextRow = pixel one row in front of the one we are testing in a loop
-    int pix_prevCol;                   // pix_prevCol = pixel one column behind the one we are testing in a loop
-    int pix_nextCol;                   // pix_nextCol = pixel one column in front of the one we are testing in a loop
-    /* Test all rows between the FIRST and LAST rows, excluding left and right edges */
-    for(x= (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) {
-        a=x-2;
-        pix_prevRow=a+rw;
-        pix_nextRow=a-rw;
-        pix_prevCol=a+1;
-        pix_nextCol=a-1;
-        while(a>dx-2) {
-            if(!limask[a]) {             // if the inner mask is empty
-                if(lomask[a]) {          // if the outer mask is full
-                    /*
-                      Next we test all 4 directions around the current pixel: next/prev/up/down
-                      The test ensures that the outer mask is empty and that the inner mask
-                      is also empty. If both conditions are true for any one of the 4 adjacent pixels
-                      then the current pixel is counted as being a true outer edge pixel.
-                     */
-                    if((!lomask[pix_nextCol] && !limask[pix_nextCol]) ||
-                       (!lomask[pix_prevCol] && !limask[pix_prevCol]) ||
-                       (!lomask[pix_nextRow] && !limask[pix_nextRow]) ||
-                       (!lomask[pix_prevRow] && !limask[pix_prevRow]))
+static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz)
+{
+	int x;								// x = pixel loop counter
+	int a;								// a = pixel loop counter
+	int dx;								// dx = delta x
+	int pix_prevRow;					// pix_prevRow = pixel one row behind the one we are testing in a loop
+	int pix_nextRow;					// pix_nextRow = pixel one row in front of the one we are testing in a loop
+	int pix_prevCol;					// pix_prevCol = pixel one column behind the one we are testing in a loop
+	int pix_nextCol;					// pix_nextCol = pixel one column in front of the one we are testing in a loop
+	/* Test all rows between the FIRST and LAST rows, excluding left and right edges */
+	for (x= (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) {
+		a=x-2;
+		pix_prevRow=a+rw;
+		pix_nextRow=a-rw;
+		pix_prevCol=a+1;
+		pix_nextCol=a-1;
+		while (a>dx-2) {
+			if (!limask[a]) {			// if the inner mask is empty
+				if (lomask[a]) {		// if the outer mask is full
+					/*
+					 * Next we test all 4 directions around the current pixel: next/prev/up/down
+					 * The test ensures that the outer mask is empty and that the inner mask
+					 * is also empty. If both conditions are true for any one of the 4 adjacent pixels
+					 * then the current pixel is counted as being a true outer edge pixel.
+					 */
+					if ((!lomask[pix_nextCol] && !limask[pix_nextCol]) ||
+					    (!lomask[pix_prevCol] && !limask[pix_prevCol]) ||
+					    (!lomask[pix_nextRow] && !limask[pix_nextRow]) ||
+					    (!lomask[pix_prevRow] && !limask[pix_prevRow]))
 					{
-                        in_osz++;           // increment the outer boundary pixel count
-                        lres[a]=3;       // flag pixel as part of outer edge
-                    } else {             // it's not a boundary pixel, but it is a gradient pixel
-                        in_gsz++;           // increment the gradient pixel count
-                        lres[a]=2;       // flag pixel as gradient
-                    }
-                }
-
-            } else {
-                if(!limask[pix_nextCol] || !limask[pix_prevCol] || !limask[pix_nextRow] || !limask[pix_prevRow]) {
-                    in_isz++;               // increment the inner boundary pixel count
-                    lres[a]=4;           // flag pixel as part of inner edge
-                } else {
-                    res[a]=1.0f;         // pixel is part of inner mask, but not at an edge
-                }
-            }
-            a--;
-            pix_prevRow--;
-            pix_nextRow--;
-            pix_prevCol--;
-            pix_nextCol--;
-        }
-    }
-
-    rsize[0]=in_isz;  // fill in our return sizes for edges + fill
-    rsize[1]=in_osz;
-    rsize[2]=in_gsz;
+						in_osz++;		// increment the outer boundary pixel count
+						lres[a]=3;		// flag pixel as part of outer edge
+					}
+					else {				// it's not a boundary pixel, but it is a gradient pixel
+						in_gsz++;		// increment the gradient pixel count
+						lres[a]=2;		// flag pixel as gradient
+					}
+				}
+
+			}
+			else {
+				if (!limask[pix_nextCol] || !limask[pix_prevCol] || !limask[pix_nextRow] || !limask[pix_prevRow]) {
+					in_isz++;			// increment the inner boundary pixel count
+					lres[a]=4;			// flag pixel as part of inner edge
+				}
+				else {
+					res[a]=1.0f;		// pixel is part of inner mask, but not at an edge
+				}
+			}
+			a--;
+			pix_prevRow--;
+			pix_nextRow--;
+			pix_prevCol--;
+			pix_nextCol--;
+		}
+	}
+
+	rsize[0]=in_isz;  // fill in our return sizes for edges + fill
+	rsize[1]=in_osz;
+	rsize[2]=in_gsz;
 }
 
-static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz){
-    int x;                             // x = pixel loop counter
-    int a;                             // a = pixel loop counter
-    int dx;                            // dx = delta x
-    int pix_prevRow;                   // pix_prevRow = pixel one row behind the one we are testing in a loop
-    int pix_nextRow;                   // pix_nextRow = pixel one row in front of the one we are testing in a loop
-    int pix_prevCol;                   // pix_prevCol = pixel one column behind the one we are testing in a loop
-    int pix_nextCol;                   // pix_nextCol = pixel one column in front of the one we are testing in a loop
-    /* Test all rows between the FIRST and LAST rows, excluding left and right edges */
-    for(x= (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) {
-        a=x-2;
-        pix_prevRow=a+rw;
-        pix_nextRow=a-rw;
-        pix_prevCol=a+1;
-        pix_nextCol=a-1;
-        while(a>dx-2) {
-            if(!limask[a]) {             // if the inner mask is empty
-                if(lomask[a]) {          // if the outer mask is full
-                    /*
-                      Next we test all 4 directions around the current pixel: next/prev/up/down
-                      The test ensures that the outer mask is empty and that the inner mask
-                      is also empty. If both conditions are true for any one of the 4 adjacent pixels
-                      then the current pixel is counted as being a true outer edge pixel.
-                     */
-                    if((!lomask[pix_nextCol] && !limask[pix_nextCol]) ||
-                       (!lomask[pix_prevCol] && !limask[pix_prevCol]) ||
-                       (!lomask[pix_nextRow] && !limask[pix_nextRow]) ||
-                       (!lomask[pix_prevRow] && !limask[pix_prevRow]))
+static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz)
+{
+	int x;							// x = pixel loop counter
+	int a;							// a = pixel loop counter
+	int dx;							// dx = delta x
+	int pix_prevRow;				// pix_prevRow = pixel one row behind the one we are testing in a loop
+	int pix_nextRow;				// pix_nextRow = pixel one row in front of the one we are testing in a loop
+	int pix_prevCol;				// pix_prevCol = pixel one column behind the one we are testing in a loop
+	int pix_nextCol;				// pix_nextCol = pixel one column in front of the one we are testing in a loop
+	/* Test all rows between the FIRST and LAST rows, excluding left and right edges */
+	for (x= (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) {
+		a=x-2;
+		pix_prevRow=a+rw;
+		pix_nextRow=a-rw;
+		pix_prevCol=a+1;
+		pix_nextCol=a-1;
+		while (a>dx-2) {
+			if (!limask[a]) {			// if the inner mask is empty
+				if (lomask[a]) {		// if the outer mask is full
+					/*
+					 * Next we test all 4 directions around the current pixel: next/prev/up/down
+					 * The test ensures that the outer mask is empty and that the inner mask
+					 * is also empty. If both conditions are true for any one of the 4 adjacent pixels
+					 * then the current pixel is counted as being a true outer edge pixel.
+					 */
+					if ((!lomask[pix_nextCol] && !limask[pix_nextCol]) ||
+					    (!lomask[pix_prevCol] && !limask[pix_prevCol]) ||
+					    (!lomask[pix_nextRow] && !limask[pix_nextRow]) ||
+					    (!lomask[pix_prevRow] && !limask[pix_prevRow]))
 					{
-                        in_osz++;           // increment the outer boundary pixel count
-                        lres[a]=3;       // flag pixel as part of outer edge
-                    } else {             // it's not a boundary pixel, but it is a gradient pixel
-                        in_gsz++;           // increment the gradient pixel count
-                        lres[a]=2;       // flag pixel as gradient
-                    }
-                }
-
-            } else {
-                if((!limask[pix_nextCol] && lomask[pix_nextCol]) ||
-                   (!limask[pix_prevCol] && lomask[pix_prevCol]) ||
-                   (!limask[pix_nextRow] && lomask[pix_nextRow]) ||
-                   (!limask[pix_prevRow] && lomask[pix_prevRow]))
+						in_osz++;		// increment the outer boundary pixel count
+						lres[a]=3;		// flag pixel as part of outer edge
+					}
+					else {				// it's not a boundary pixel, but it is a gradient pixel
+						in_gsz++;		// increment the gradient pixel count
+						lres[a]=2;		// flag pixel as gradient
+					}
+				}
+
+			}
+			else {
+				if ((!limask[pix_nextCol] && lomask[pix_nextCol]) ||
+				    (!limask[pix_prevCol] && lomask[pix_prevCol]) ||
+				    (!limask[pix_nextRow] && lomask[pix_nextRow]) ||
+				    (!limask[pix_prevRow] && lomask[pix_prevRow]))
 				{
-                    in_isz++;               // increment the inner boundary pixel count
-                    lres[a]=4;           // flag pixel as part of inner edge
-                } else {
-                    res[a]=1.0f;         // pixel is part of inner mask, but not at an edge
-                }
-            }
-            a--;
-            pix_prevRow--;              // advance all four "surrounding" pixel pointers
-            pix_nextRow--;
-            pix_prevCol--;
-            pix_nextCol--;
-        }
-    }
-
-    rsize[0]=in_isz;  // fill in our return sizes for edges + fill
-    rsize[1]=in_osz;
-    rsize[2]=in_gsz;
+					in_isz++;			// increment the inner boundary pixel count
+					lres[a]=4;			// flag pixel as part of inner edge
+				}
+				else {
+					res[a]=1.0f;		// pixel is part of inner mask, but not at an edge
+				}
+			}
+			a--;
+			pix_prevRow--;				// advance all four "surrounding" pixel pointers
+			pix_nextRow--;
+			pix_prevCol--;
+			pix_nextCol--;
+		}
+	}
+
+	rsize[0]=in_isz;  // fill in our return sizes for edges + fill
+	rsize[1]=in_osz;
+	rsize[2]=in_gsz;
 }
 
-static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigned int *lres, float *res, unsigned short *gbuf, unsigned int *innerEdgeOffset, unsigned int *outerEdgeOffset, unsigned int isz, unsigned int gsz){
-    int x;                             // x = pixel loop counter
-    int a;                             // a = temporary pixel index buffer loop counter
-    unsigned int ud;                   // ud = unscaled edge distance
-    unsigned int dmin;                 // dmin = minimun edge distance
-
-    unsigned int rsl;                  // long used for finding fast 1.0/sqrt
-    unsigned int gradientFillOffset;
-    unsigned int innerAccum=0;         // for looping inner edge pixel indexes, represents current position from offset
-    unsigned int outerAccum=0;         // for looping outer edge pixel indexes, represents current position from offset
-    unsigned int gradientAccum=0;      // for looping gradient pixel indexes, represents current position from offset
-    /*
-    Here we compute the size of buffer needed to hold (row,col) coordinates
-    for each pixel previously determined to be either gradient, inner edge,
-    or outer edge.
-
-    Allocation is done by requesting 4 bytes "sizeof(int)" per pixel, even
-    though gbuf[] is declared as unsigned short* (2 bytes) because we don't
-    store the pixel indexes, we only store x,y location of pixel in buffer.
-
-    This does make the assumption that x and y can fit in 16 unsigned bits
-    so if Blender starts doing renders greater than 65536 in either direction
-    this will need to allocate gbuf[] as unsigned int* and allocate 8 bytes
-    per flagged pixel.
-
-    In general, the buffer on-screen:
-
-    Example:  9 by 9 pixel block
-
-    . = pixel non-white in both outer and inner mask
-    o = pixel white in outer, but not inner mask, adjacent to "." pixel
-    g = pixel white in outer, but not inner mask, not adjacent to "." pixel
-    i = pixel white in inner mask, adjacent to "g" or "." pixel
-    F = pixel white in inner mask, only adjacent to other pixels white in the inner mask
-
-
-                     .........   <----- pixel #80
-                     ..oooo...
-                     .oggggo..
-                     .oggiggo.
-                     .ogiFigo.
-                     .oggiggo.
-                     .oggggo..
-                     ..oooo...
-    pixel #00 -----> .........
-
-    gsz = 18   (18 "g" pixels above)
-    isz = 4    (4 "i" pixels above)
-    osz = 18   (18 "o" pixels above)
-
-
-    The memory in gbuf[] after filling will look like this:
-
-     gradientFillOffset (0 pixels)                   innerEdgeOffset (18 pixels)    outerEdgeOffset (22 pixels)
-    /                                               /                              /
-    /                                               /                              /
-    |X   Y   X   Y   X   Y   X   Y   >     <X   Y   X   Y   >     <X   Y   X   Y   X   Y   >     <X   Y   X   Y   | <- (x,y)
-    +-------------------------------->     <---------------->     <------------------------>     <----------------+
-    |0   2   4   6   8   10  12  14  > ... <68  70  72  74  > ... <80  82  84  86  88  90  > ... <152 154 156 158 | <- bytes
-    +-------------------------------->     <---------------->     <------------------------>     <----------------+
-    |g0  g0  g1  g1  g2  g2  g3  g3  >     <g17 g17 i0  i0  >     <i2  i2  i3  i3  o0  o0  >     <o16 o16 o17 o17 | <- pixel
-                                                 /                              /                              /
-                                                /                              /                              /
-                                               /                              /                              /
-      +---------- gradientAccum (18) ---------+      +--- innerAccum (22) ---+      +--- outerAccum (40) ---+
-
-
-    Ultimately we do need the pixel's memory buffer index to set the output
-    pixel color, but it's faster to reconstruct the memory buffer location
-    each iteration of the final gradient calculation than it is to deconstruct
-    a memory location into x,y pairs each round.
-*/
-
-
-    gradientFillOffset=0;                              // since there are likely "more" of these, put it first. :)
-    *innerEdgeOffset=gradientFillOffset+gsz;           // set start of inner edge indexes
-    *outerEdgeOffset=(*innerEdgeOffset)+isz;           // set start of outer edge indexes
-    /* set the accumulators to correct positions */    // set up some accumulator variables for loops
-    gradientAccum = gradientFillOffset;                // each accumulator variable starts at its respective
-    innerAccum = *innerEdgeOffset;                     // section's offset so when we start filling, each
-    outerAccum = *outerEdgeOffset;                     // section fills up it's allocated space in gbuf
-    //uses dmin=row, rsl=col
-    for(x=0,dmin=0; x<t; x+=rw,dmin++) {
-        for(rsl=0; rsl<rw; rsl++) {
-            a=x+rsl;
-            if(lres[a]==2) {           // it is a gradient pixel flagged by 2
-                ud=gradientAccum<<1;   // double the index to reach correct unsigned short location
-                gbuf[ud]=dmin;         // insert pixel's row into gradient pixel location buffer
-                gbuf[ud+1]=rsl;        // insert pixel's column into gradient pixel location buffer
-                gradientAccum++;       // increment gradient index buffer pointer
-            } else if(lres[a]==3) {    // it is an outer edge pixel flagged by 3
-                ud=outerAccum<<1;      // double the index to reach correct unsigned short location
-                gbuf[ud]=dmin;         // insert pixel's row into outer edge pixel location buffer
-                gbuf[ud+1]=rsl;        // insert pixel's column into outer edge pixel location buffer
-                outerAccum++;          // increment outer edge index buffer pointer
-                res[a]=0.0f;           // set output pixel intensity now since it won't change later
-            } else if(lres[a]==4) {    // it is an inner edge pixel flagged by 4
-                ud=innerAccum<<1;      // double int index to reach correct unsigned short location
-                gbuf[ud]=dmin;         // insert pixel's row into inner edge pixel location buffer
-                gbuf[ud+1]=rsl;        // insert pixel's column into inner edge pixel location buffer
-                innerAccum++;          // increment inner edge index buffer pointer
-                res[a]=1.0f;           // set output pixel intensity now since it won't change later
-            }
-        }
-    }
+static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigned int *lres, float *res, unsigned short *gbuf, unsigned int *innerEdgeOffset, unsigned int *outerEdgeOffset, unsigned int isz, unsigned int gsz)
+{
+	int x;							// x = pixel loop counter
+	int a;							// a = temporary pixel index buffer loop counter
+	unsigned int ud;				// ud = unscaled edge distance
+	unsigned int dmin;				// dmin = minimun edge distance
+
+	unsigned int rsl;				// long used for finding fast 1.0/sqrt
+	unsigned int gradientFillOffset;
+	unsigned int innerAccum=0;		// for looping inner edge pixel indexes, represents current position from offset
+	unsigned int outerAccum=0;		// for looping outer edge pixel indexes, represents current position from offset
+	unsigned int gradientAccum=0;	// for looping gradient pixel indexes, represents current position from offset
+	/*
+	 * Here we compute the size of buffer needed to hold (row,col) coordinates
+	 * for each pixel previously determined to be either gradient, inner edge,
+	 * or outer edge.
+	 *
+	 * Allocation is done by requesting 4 bytes "sizeof(int)" per pixel, even
+	 * though gbuf[] is declared as unsigned short* (2 bytes) because we don't
+	 * store the pixel indexes, we only store x,y location of pixel in buffer.
+	 *
+	 * This does make the assumption that x and y can fit in 16 unsigned bits
+	 * so if Blender starts doing renders greater than 65536 in either direction
+	 * this will need to allocate gbuf[] as unsigned int* and allocate 8 bytes
+	 * per flagged pixel.
+	 *
+	 * In general, the buffer on-screen:
+	 *
+	 * Example:  9 by 9 pixel block
+	 *
+	 * . = pixel non-white in both outer and inner mask
+	 * o = pixel white in outer, but not inner mask, adjacent to "." pixel
+	 * g = pixel white in outer, but not inner mask, not adjacent to "." pixel
+	 * i = pixel white in inner mask, adjacent to "g" or "." pixel
+	 * F = pixel white in inner mask, only adjacent to other pixels white in the inner mask
+	 *
+	 *
+	 *                  .........   <----- pixel #80
+	 *                  ..oooo...
+	 *                  .oggggo..
+	 *                  .oggiggo.
+	 *                  .ogiFigo.
+	 *                  .oggiggo.
+	 *                  .oggggo..
+	 *                  ..oooo...
+	 * pixel #00 -----> .........
+	 *
+	 * gsz = 18   (18 "g" pixels above)
+	 * isz = 4    (4 "i" pixels above)
+	 * osz = 18   (18 "o" pixels above)
+	 *
+	 *
+	 * The memory in gbuf[] after filling will look like this:
+	 *
+	 *  gradientFillOffset (0 pixels)                   innerEdgeOffset (18 pixels)    outerEdgeOffset (22 pixels)
+	 * /                                               /                              /
+	 * /                                               /                              /
+	 * |X   Y   X   Y   X   Y   X   Y   >     <X   Y   X   Y   >     <X   Y   X   Y   X   Y   >     <X   Y   X   Y   | <- (x,y)
+	 * +-------------------------------->     <---------------->     <------------------------>     <----------------+
+	 * |0   2   4   6   8   10  12  14  > ... <68  70  72  74  > ... <80  82  84  86  88  90  > ... <152 154 156 158 | <- bytes
+	 * +-------------------------------->     <---------------->     <------------------------>     <----------------+
+	 * |g0  g0  g1  g1  g2  g2  g3  g3  >     <g17 g17 i0  i0  >     <i2  i2  i3  i3  o0  o0  >     <o16 o16 o17 o17 | <- pixel
+	 *                                              /                              /                              /
+	 *                                             /                              /                              /
+	 *                                            /                              /                              /
+	 *   +---------- gradientAccum (18) ---------+      +--- innerAccum (22) ---+      +--- outerAccum (40) ---+
+	 *
+	 *
+	 * Ultimately we do need the pixel's memory buffer index to set the output
+	 * pixel color, but it's faster to reconstruct the memory buffer location
+	 * each iteration of the final gradient calculation than it is to deconstruct
+	 * a memory location into x,y pairs each round.
+	 */
+
+
+	gradientFillOffset=0;								// since there are likely "more" of these, put it first. :)
+	*innerEdgeOffset=gradientFillOffset+gsz;			// set start of inner edge indexes
+	*outerEdgeOffset=(*innerEdgeOffset)+isz;			// set start of outer edge indexes
+	/* set the accumulators to correct positions */		// set up some accumulator variables for loops
+	gradientAccum = gradientFillOffset;					// each accumulator variable starts at its respective
+	innerAccum = *innerEdgeOffset;						// section's offset so when we start filling, each
+	outerAccum = *outerEdgeOffset;						// section fills up it's allocated space in gbuf
+	//uses dmin=row, rsl=col
+	for (x=0,dmin=0; x<t; x+=rw,dmin++) {
+		for (rsl=0; rsl<rw; rsl++) {
+			a=x+rsl;
+			if (lres[a]==2) {			// it is a gradient pixel flagged by 2
+				ud=gradientAccum<<1;	// double the index to reach correct unsigned short location
+				gbuf[ud]=dmin;			// insert pixel's row into gradient pixel location buffer
+				gbuf[ud+1]=rsl;			// insert pixel's column into gradient pixel location buffer
+				gradientAccum++;		// increment gradient index buffer pointer
+			}
+			else if (lres[a]==3) {		// it is an outer edge pixel flagged by 3
+				ud=outerAccum<<1;		// double the index to reach correct unsigned short location
+				gbuf[ud]=dmin;			// insert pixel's row into outer edge pixel location buffer
+				gbuf[ud+1]=rsl;			// insert pixel's column into outer edge pixel location buffer
+				outerAccum++;			// increment outer edge index buffer pointer
+				res[a]=0.0f;			// set output pixel intensity now since it won't change later
+			}
+			else if (lres[a]==4) {		// it is an inner edge pixel flagged by 4
+				ud=innerAccum<<1;		// double int index to reach correct unsigned short location
+				gbuf[ud]=dmin;			// insert pixel's row into inner edge pixel location buffer
+				gbuf[ud+1]=rsl;			// insert pixel's column into inner edge pixel location buffer
+				innerAccum++;			// increment inner edge index buffer pointer
+				res[a]=1.0f;			// set output pixel intensity now since it won't change later
+			}
+		}
+	}
 
 }
 
-static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *gbuf, unsigned int isz, unsigned int osz, unsigned int gsz, unsigned int innerEdgeOffset, unsigned int outerEdgeOffset){
-    int x;                             // x = pixel loop counter
-    int a;                             // a = temporary pixel index buffer loop counter
-    int fsz;                           // size of the frame
-    unsigned int rsl;                  // long used for finding fast 1.0/sqrt
-    float rsf;                         // float used for finding fast 1.0/sqrt
-    const float rsopf = 1.5f;          // constant float used for finding fast 1.0/sqrt
-
-    unsigned int gradientFillOffset;
-    unsigned int t;
-    unsigned int ud;                   // ud = unscaled edge distance
-    unsigned int dmin;                 // dmin = minimun edge distance
-    float odist;                       // odist = current outer edge distance
-    float idist;                       // idist = current inner edge distance
-    int dx;                            // dx = X-delta (used for distance proportion calculation)
-    int dy;                            // dy = Y-delta (used for distance proportion calculation)
-
-    /*
-     The general algorithm used to color each gradient pixel is:
-
-     1.) Loop through all gradient pixels.
-        A.) For each gradient pixel:
-            a.) Loop though all outside edge pixels, looking for closest one
-                to the gradient pixel we are in.
-            b.) Loop through all inside edge pixels, looking for closest one
-                to the gradient pixel we are in.
-            c.) Find proportion of distance from gradient pixel to inside edge
-                pixel compared to sum of distance to inside edge and distance to
-                outside edge.
-
-                In an image where:
-                . = blank (black) pixels, not covered by inner mask or outer mask
-                + = desired gradient pixels, covered only by outer mask
-                * = white full mask pixels, covered by at least inner mask
-
-                ...............................
-                ...............+++++++++++.....
-                ...+O++++++..++++++++++++++....
-                ..+++\++++++++++++++++++++.....
-                .+++++G+++++++++*******+++.....
-                .+++++|+++++++*********+++.....
-                .++***I****************+++.....
-                .++*******************+++......
-                .+++*****************+++.......
-                ..+++***************+++........
-                ....+++**********+++...........
-                ......++++++++++++.............
-                ...............................
-
-                    O = outside edge pixel
-                     \
-                      G = gradient pixel
-                      |
-                      I = inside edge pixel
-
-                                 __
-                      *note that IO does not need to be a straight line, in fact
-                       many cases can arise where straight lines do not work
-                       correctly.
-
-                                            __       __     __
-            d.) Pixel color is assigned as |GO| / ( |GI| + |GO| )
-
-     The implementation does not compute distance, but the reciprocal of the
-     distance. This is done to avoid having to compute a square root, as a
-     reciprocal square root can be computed faster. Therefore, the code computes
-     pixel color as |GI| / (|GI| + |GO|). Since these are reciprocals, GI serves the
-     purpose of GO for the proportion calculation.
-
-     For the purposes of the minimun distance comparisons, we only check
-     the sums-of-squares against eachother, since they are in the same
-     mathematical sort-order as if we did go ahead and take square roots
-
-     Loop through all gradient pixels.
-     */
-
-    for(x= gsz-1; x>=0; x--) {
-        gradientFillOffset=x<<1;
-        t=gbuf[gradientFillOffset];         // calculate column of pixel indexed by gbuf[x]
-        fsz=gbuf[gradientFillOffset+1];     // calculate row of pixel indexed by gbuf[x]
-        dmin=0xffffffff;                    // reset min distance to edge pixel
-        for(a=outerEdgeOffset+osz-1; a>=outerEdgeOffset; a--) {   // loop through all outer edge buffer pixels
-            ud=a<<1;
-            dy=t-gbuf[ud];                  // set dx to gradient pixel column - outer edge pixel row
-            dx=fsz-gbuf[ud+1];              // set dy to gradient pixel row - outer edge pixel column
-            ud=dx*dx+dy*dy;                 // compute sum of squares
-            if(ud<dmin) {                   // if our new sum of squares is less than the current minimum
-                dmin=ud;                    // set a new minimum equal to the new lower value
-            }
-        }
-        odist=(float)(dmin);                     // cast outer min to a float
-        rsf=odist*0.5f;                          //
-        rsl=*(unsigned int*)&odist;              // use some peculiar properties of the way bits are stored
-        rsl=0x5f3759df-(rsl>>1);                 // in floats vs. unsigned ints to compute an approximate
-        odist=*(float*)&rsl;                     // reciprocal square root
-        odist=odist*(rsopf-(rsf*odist*odist));   // -- ** this line can be iterated for more accuracy ** --
-        dmin=0xffffffff;                         // reset min distance to edge pixel
-        for(a= innerEdgeOffset+isz-1; a>=innerEdgeOffset; a--) {   // loop through all inside edge pixels
-            ud=a<<1;
-            dy=t-gbuf[ud];         // compute delta in Y from gradient pixel to inside edge pixel
-            dx=fsz-gbuf[ud+1];     // compute delta in X from gradient pixel to inside edge pixel
-            ud=dx*dx+dy*dy;        // compute sum of squares
-            if(ud<dmin) {          // if our new sum of squares is less than the current minimum we've found
-                dmin=ud;           // set a new minimum equal to the new lower value
-            }
-        }
-        idist=(float)(dmin);                     // cast inner min to a float
-        rsf=idist*0.5f;                          //
-        rsl=*(unsigned int*)&idist;              //
-        rsl=0x5f3759df-(rsl>>1);                 // see notes above
-        idist=*(float*)&rsl;                     //
-        idist=idist*(rsopf-(rsf*idist*idist));   //
-        /*
-         Note once again that since we are using reciprocals of distance values our
-         proportion is already the correct intensity, and does not need to be
-         subracted from 1.0 like it would have if we used real distances.
-         */
-
-        /*
-         Here we reconstruct the pixel's memory location in the CompBuf by
-         Pixel Index = Pixel Column + ( Pixel Row * Row Width )
-         */
-        res[gbuf[gradientFillOffset+1]+(gbuf[gradientFillOffset]*rw)]=(idist/(idist+odist));	//set intensity
-    }
+static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *gbuf, unsigned int isz, unsigned int osz, unsigned int gsz, unsigned int innerEdgeOffset, unsigned int outerEdgeOffset)
+{
+	int x;							// x = pixel loop counter
+	int a;							// a = temporary pixel index buffer loop counter
+	int fsz;						// size of the frame
+	unsigned int rsl;				// long used for finding fast 1.0/sqrt
+	float rsf;						// float used for finding fast 1.0/sqrt
+	const float rsopf = 1.5f;		// constant float used for finding fast 1.0/sqrt
+
+	unsigned int gradientFillOffset;
+	unsigned int t;
+	unsigned int ud;				// ud = unscaled edge distance
+	unsigned int dmin;				// dmin = minimun edge distance
+	float odist;					// odist = current outer edge distance
+	float idist;					// idist = current inner edge distance
+	int dx;							// dx = X-delta (used for distance proportion calculation)
+	int dy;							// dy = Y-delta (used for distance proportion calculation)
+	/*
+	 * The general algorithm used to color each gradient pixel is:
+	 *
+	 * 1.) Loop through all gradient pixels.
+	 *    A.) For each gradient pixel:
+	 *        a.) Loop though all outside edge pixels, looking for closest one
+	 *            to the gradient pixel we are in.
+	 *        b.) Loop through all inside edge pixels, looking for closest one
+	 *            to the gradient pixel we are in.
+	 *        c.) Find proportion of distance from gradient pixel to inside edge
+	 *            pixel compared to sum of distance to inside edge and distance to
+	 *            outside edge.
+	 *
+	 *            In an image where:
+	 *            . = blank (black) pixels, not covered by inner mask or outer mask
+	 *            + = desired gradient pixels, covered only by outer mask
+	 *            * = white full mask pixels, covered by at least inner mask
+	 *
+	 *            ...............................
+	 *            ...............+++++++++++.....
+	 *            ...+O++++++..++++++++++++++....
+	 *            ..+++\++++++++++++++++++++.....
+	 *            .+++++G+++++++++*******+++.....
+	 *            .+++++|+++++++*********+++.....
+	 *            .++***I****************+++.....
+	 *            .++*******************+++......
+	 *            .+++*****************+++.......
+	 *            ..+++***************+++........
+	 *            ....+++**********+++...........
+	 *            ......++++++++++++.............
+	 *            ...............................
+	 *
+	 *                O = outside edge pixel
+	 *                 \
+	 *                  G = gradient pixel
+	 *                  |
+	 *                  I = inside edge pixel
+	 *
+	 *                             __
+	 *                  *note that IO does not need to be a straight line, in fact
+	 *                   many cases can arise where straight lines do not work
+	 *                   correctly.
+	 *
+	 *                                        __       __     __
+	 *        d.) Pixel color is assigned as |GO| / ( |GI| + |GO| )
+	 *
+	 * The implementation does not compute distance, but the reciprocal of the
+	 * distance. This is done to avoid having to compute a square root, as a
+	 * reciprocal square root can be computed faster. Therefore, the code computes
+	 * pixel color as |GI| / (|GI| + |GO|). Since these are reciprocals, GI serves the
+	 * purpose of GO for the proportion calculation.
+	 *
+	 * For the purposes of the minimun distance comparisons, we only check
+	 * the sums-of-squares against each other, since they are in the same
+	 * mathematical sort-order as if we did go ahead and take square roots
+	 *
+	 * Loop through all gradient pixels.
+	 */
+
+	for (x= gsz-1; x>=0; x--) {
+		gradientFillOffset=x<<1;
+		t=gbuf[gradientFillOffset];		// calculate column of pixel indexed by gbuf[x]
+		fsz=gbuf[gradientFillOffset+1];	// calculate row of pixel indexed by gbuf[x]
+		dmin=0xffffffff;					// reset min distance to edge pixel
+		for (a=outerEdgeOffset+osz-1; a>=outerEdgeOffset; a--) {	// loop through all outer edge buffer pixels
+			ud=a<<1;
+			dy=t-gbuf[ud];					// set dx to gradient pixel column - outer edge pixel row
+			dx=fsz-gbuf[ud+1];				// set dy to gradient pixel row - outer edge pixel column
+			ud=dx*dx+dy*dy;					// compute sum of squares
+			if (ud<dmin) {					// if our new sum of squares is less than the current minimum
+				dmin=ud;					// set a new minimum equal to the new lower value
+			}
+		}
+		odist=(float)(dmin);					// cast outer min to a float
+		rsf=odist*0.5f;							//
+		rsl=*(unsigned int*)&odist;				// use some peculiar properties of the way bits are stored
+		rsl=0x5f3759df-(rsl>>1);				// in floats vs. unsigned ints to compute an approximate
+		odist=*(float*)&rsl;					// reciprocal square root
+		odist=odist*(rsopf-(rsf*odist*odist));	// -- ** this line can be iterated for more accuracy ** --
+		dmin=0xffffffff;						// reset min distance to edge pixel
+		for (a= innerEdgeOffset+isz-1; a>=innerEdgeOffset; a--) {	// loop through all inside edge pixels
+			ud=a<<1;
+			dy=t-gbuf[ud];			// compute delta in Y from gradient pixel to inside edge pixel
+			dx=fsz-gbuf[ud+1];		// compute delta in X from gradient pixel to inside edge pixel
+			ud=dx*dx+dy*dy;			// compute sum of squares
+			if (ud<dmin) {			// if our new sum of squares is less than the current minimum we've found
+				dmin=ud;			// set a new minimum equal to the new lower value
+			}
+		}
+		idist=(float)(dmin);					// cast inner min to a float
+		rsf=idist*0.5f;							//
+		rsl=*(unsigned int*)&idist;				//
+		rsl=0x5f3759df-(rsl>>1);				// see notes above
+		idist=*(float*)&rsl;					//
+		idist=idist*(rsopf-(rsf*idist*idist));	//
+		/*
+		 * Note once again that since we are using reciprocals of distance values our
+		 * proportion is already the correct intensity, and does not need to be
+		 * subracted from 1.0 like it would have if we used real distances.
+		 */
+
+		/*
+		 * Here we reconstruct the pixel's memory location in the CompBuf by
+		 * Pixel Index = Pixel Column + ( Pixel Row * Row Width )
+		 */
+		res[gbuf[gradientFillOffset+1]+(gbuf[gradientFillOffset]*rw)]=(idist/(idist+odist));	//set intensity
+	}
 
 }
 
 
-static void node_composit_exec_doubleedgemask(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) {
-
-    float *imask;                      // imask = pointer to inner mask pixel buffer
-    float *omask;                      // omask = pointer to outer mask pixel buffer
-    float *res;                        // res = pointer to output mask
-
-    unsigned int *lres;                // lres = unsigned int pointer to output pixel buffer (for bit operations)
-    unsigned int *limask;              // limask = unsigned int pointer to inner mask (for bit operations)
-    unsigned int *lomask;              // lomask = unsigned int pointer to outer mask (for bit operations)
-
-    int rw;                            // rw = pixel row width
-    int t;                             // t = total number of pixels in buffer - 1 (used for loop starts)
-    int fsz;                           // size of the frame
-
-    unsigned int isz=0;                // size (in pixels) of inside edge pixel index buffer
-    unsigned int osz=0;                // size (in pixels) of outside edge pixel index buffer
-    unsigned int gsz=0;                // size (in pixels) of gradient pixel index buffer
-    unsigned int rsize[3];             // size storage to pass to helper functions
-    unsigned int innerEdgeOffset=0;    // offset into final buffer where inner edge pixel indexes start
-    unsigned int outerEdgeOffset=0;    // offset into final buffer where outer edge pixel indexes start
-
-    unsigned short *gbuf;              // gradient/inner/outer pixel location index buffer
-
-    CompBuf *cbuf;                     // pointer, will be set to inner mask data
-    CompBuf *dbuf;                     // pointer, will be set to outer mask data
-    CompBuf *stackbuf;                 // pointer, will get allocated as output buffer
-
-    if(out[0]->hasoutput==0) {         // if the node's output socket is not connected to anything...
-        return;                        //     do not execute any further, just exit the node immediately
-    }
-
-    if(in[0]->data && in[1]->data) {                    // if both input sockets have some data coming in...
-        cbuf= in[0]->data;                              //     get a pointer to the inner mask data
-        dbuf= in[1]->data;                              //     get a pointer to the outer mask data
-        if(cbuf->type!=CB_VAL || dbuf->type!=CB_VAL) {  // if either input socket has an incorrect data type coming in
-            return;                                     //     exit the node immediately
-        }
-
-        t=(cbuf->x*cbuf->y)-1;                                // determine size of the frame
-
-        stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1); // allocate the output buffer
-
-        imask= cbuf->rect;             // set the inner mask
-        omask= dbuf->rect;             // set the outer mask
-        res= stackbuf->rect;           // set output pointer
-        lres= (unsigned int*)res;      // unsigned int pointer to output buffer (for bit level ops)
-        limask=(unsigned int*)imask;   // unsigned int pointer to input mask (for bit level ops)
-        lomask=(unsigned int*)omask;   // unsigned int pointer to output mask (for bit level ops)
-        rw= cbuf->x;                   // width of a row of pixels
-
-
-        /*
-         The whole buffer is broken up into 4 parts. The four CORNERS, the FIRST and LAST rows, the
-         LEFT and RIGHT edges (excluding the corner pixels), and all OTHER rows.
-         This allows for quick computation of outer edge pixels where
-         a screen edge pixel is marked to be gradient.
-
-         The pixel type (gradient vs inner-edge vs outer-edge) tests change
-         depending on the user selected "Inner Edge Mode" and the user selected
-         "Buffer Edge Mode" on the node's GUI. There are 4 sets of basically the
-         same algorithm:
-
-         1.) Inner Edge -> Adjacent Only
-             Buffer Edge -> Keep Inside
-
-         2.) Inner Edge -> Adjacent Only
-             Buffer Edge -> Bleed Out
-
-         3.) Inner Edge -> All
-             Buffer Edge -> Keep Inside
-
-         4.) Inner Edge -> All
-             Buffer Edge -> Bleed Out
-
-         Each version has slightly different criteria for detecting an edge pixel.
-         */
-        if(node->custom2) {            // if "adjacent only" inner edge mode is turned on
-            if(node->custom1) {        // if "keep inside" buffer edge mode is turned on
-                do_adjacentKeepBorders(t,rw,limask,lomask,lres,res,rsize);
-            }else{                     // "bleed out" buffer edge mode is turned on
-                do_adjacentBleedBorders(t,rw,limask,lomask,lres,res,rsize);
-            }
-            isz=rsize[0];              // set up inner edge, outer edge, and gradient buffer sizes after border pass
-            osz=rsize[1];
-            gsz=rsize[2];
-            // detect edges in all non-border pixels in the buffer
-            do_adjacentEdgeDetection(t,rw,limask,lomask,lres,res,rsize,isz,osz,gsz);
-        }else{                         // "all" inner edge mode is turned on
-            if(node->custom1) {        // if "keep inside" buffer edge mode is turned on
-                do_allKeepBorders(t,rw,limask,lomask,lres,res,rsize);
-            }else{                     // "bleed out" buffer edge mode is turned on
-                do_allBleedBorders(t,rw,limask,lomask,lres,res,rsize);
-            }
-            isz=rsize[0];              // set up inner edge, outer edge, and gradient buffer sizes after border pass
-            osz=rsize[1];
-            gsz=rsize[2];
-            // detect edges in all non-border pixels in the buffer
-            do_allEdgeDetection(t,rw,limask,lomask,lres,res,rsize,isz,osz,gsz);
-        }
-
-        isz=rsize[0];                  // set edge and gradient buffer sizes once again...
-        osz=rsize[1];                  // the sizes in rsize[] may have been modified
-        gsz=rsize[2];                  // by the do_*EdgeDetection() function.
-
-        // quick check for existance of edges in the buffer...
-        // if we don't have any one of the three sizes, the other two make no difference visually,
-        // so we can just pass the inner input buffer back as output.
-        if(!gsz || !isz || !osz) {
-            out[0]->data= stackbuf;    // point the node output buffer to our filled buffer
-            return;
-        }
-
-
-        fsz=gsz+isz+osz;                                   // calculate size of pixel index buffer needed
-        gbuf= MEM_mallocN(fsz*sizeof(int), "grd buf");     // allocate edge/gradient pixel index buffer
-
-        do_createEdgeLocationBuffer(t,rw,lres,res,gbuf,&innerEdgeOffset,&outerEdgeOffset,isz,gsz);
-        do_fillGradientBuffer(rw,res,gbuf,isz,osz,gsz,innerEdgeOffset,outerEdgeOffset);
-
-        MEM_freeN(gbuf);          // free the gradient index buffer
-        out[0]->data= stackbuf;   // point the node output buffer to our filled buffer
-    }
+static void node_composit_exec_doubleedgemask(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
+{
+
+	float *imask;					// imask = pointer to inner mask pixel buffer
+	float *omask;					// omask = pointer to outer mask pixel buffer
+	float *res;						// res = pointer to output mask
+
+	unsigned int *lres;				// lres = unsigned int pointer to output pixel buffer (for bit operations)
+	unsigned int *limask;			// limask = unsigned int pointer to inner mask (for bit operations)
+	unsigned int *lomask;			// lomask = unsigned int pointer to outer mask (for bit operations)
+
+	int rw;							// rw = pixel row width
+	int t;							// t = total number of pixels in buffer - 1 (used for loop starts)
+	int fsz;						// size of the frame
+
+	unsigned int isz=0;				// size (in pixels) of inside edge pixel index buffer
+	unsigned int osz=0;				// size (in pixels) of outside edge pixel index buffer
+	unsigned int gsz=0;				// size (in pixels) of gradient pixel index buffer
+	unsigned int rsize[3];			// size storage to pass to helper functions
+	unsigned int innerEdgeOffset=0;	// offset into final buffer where inner edge pixel indexes start
+	unsigned int outerEdgeOffset=0;	// offset into final buffer where outer edge pixel indexes start
+
+	unsigned short *gbuf;			// gradient/inner/outer pixel location index buffer
+
+	CompBuf *cbuf;					// pointer, will be set to inner mask data
+	CompBuf *dbuf;					// pointer, will be set to outer mask data
+	CompBuf *stackbuf;				// pointer, will get allocated as output buffer
+
+	if (out[0]->hasoutput==0) {		// if the node's output socket is not connected to anything...
+		return;						//     do not execute any further, just exit the node immediately
+	}
+
+	if (in[0]->data && in[1]->data) {					// if both input sockets have some data coming in...
+		cbuf= in[0]->data;								//     get a pointer to the inner mask data
+		dbuf= in[1]->data;								//     get a pointer to the outer mask data
+		if (cbuf->type!=CB_VAL || dbuf->type!=CB_VAL) {	// if either input socket has an incorrect data type coming in
+			return;										//     exit the node immediately
+		}
+
+		t=(cbuf->x*cbuf->y)-1;									// determine size of the frame
+
+		stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1);	// allocate the output buffer
+
+		imask= cbuf->rect;				// set the inner mask
+		omask= dbuf->rect;				// set the outer mask
+		res= stackbuf->rect;			// set output pointer
+		lres= (unsigned int*)res;		// unsigned int pointer to output buffer (for bit level ops)
+		limask=(unsigned int*)imask;	// unsigned int pointer to input mask (for bit level ops)
+		lomask=(unsigned int*)omask;	// unsigned int pointer to output mask (for bit level ops)
+		rw= cbuf->x;					// width of a row of pixels
+
+
+		/*
+		 * The whole buffer is broken up into 4 parts. The four CORNERS, the FIRST and LAST rows, the
+		 * LEFT and RIGHT edges (excluding the corner pixels), and all OTHER rows.
+		 * This allows for quick computation of outer edge pixels where
+		 * a screen edge pixel is marked to be gradient.
+		 *
+		 * The pixel type (gradient vs inner-edge vs outer-edge) tests change
+		 * depending on the user selected "Inner Edge Mode" and the user selected
+		 * "Buffer Edge Mode" on the node's GUI. There are 4 sets of basically the
+		 * same algorithm:
+		 *
+		 * 1.) Inner Edge -> Adjacent Only
+		 *     Buffer Edge -> Keep Inside
+		 *
+		 * 2.) Inner Edge -> Adjacent Only
+		 *     Buffer Edge -> Bleed Out
+		 *
+		 * 3.) Inner Edge -> All
+		 *     Buffer Edge -> Keep Inside
+		 *
+		 * 4.) Inner Edge -> All
+		 *     Buffer Edge -> Bleed Out
+		 *
+		 * Each version has slightly different criteria for detecting an edge pixel.
+		 */
+		if (node->custom2) {		// if "adjacent only" inner edge mode is turned on
+			if (node->custom1) {	// if "keep inside" buffer edge mode is turned on
+				do_adjacentKeepBorders(t,rw,limask,lomask,lres,res,rsize);
+			}
+			else {					// "bleed out" buffer edge mode is turned on
+				do_adjacentBleedBorders(t,rw,limask,lomask,lres,res,rsize);
+			}
+			isz=rsize[0];			// set up inner edge, outer edge, and gradient buffer sizes after border pass
+			osz=rsize[1];
+			gsz=rsize[2];
+			// detect edges in all non-border pixels in the buffer
+			do_adjacentEdgeDetection(t,rw,limask,lomask,lres,res,rsize,isz,osz,gsz);
+		}
+		else {						// "all" inner edge mode is turned on
+			if (node->custom1) {	// if "keep inside" buffer edge mode is turned on
+				do_allKeepBorders(t,rw,limask,lomask,lres,res,rsize);
+			}
+			else {					// "bleed out" buffer edge mode is turned on
+				do_allBleedBorders(t,rw,limask,lomask,lres,res,rsize);
+			}
+			isz=rsize[0];			// set up inner edge, outer edge, and gradient buffer sizes after border pass
+			osz=rsize[1];
+			gsz=rsize[2];
+			// detect edges in all non-border pixels in the buffer
+			do_allEdgeDetection(t,rw,limask,lomask,lres,res,rsize,isz,osz,gsz);
+		}
+
+		isz=rsize[0];				// set edge and gradient buffer sizes once again...
+		osz=rsize[1];				// the sizes in rsize[] may have been modified
+		gsz=rsize[2];				// by the do_*EdgeDetection() function.
+
+		// quick check for existance of edges in the buffer...
+		// if we don't have any one of the three sizes, the other two make no difference visually,
+		// so we can just pass the inner input buffer back as output.
+		if (!gsz || !isz || !osz) {
+			out[0]->data= stackbuf;	// point the node output buffer to our filled buffer
+			return;
+		}
+
+
+		fsz=gsz+isz+osz;									// calculate size of pixel index buffer needed
+		gbuf= MEM_mallocN(fsz*sizeof(int), "grd buf");		// allocate edge/gradient pixel index buffer
+
+		do_createEdgeLocationBuffer(t,rw,lres,res,gbuf,&innerEdgeOffset,&outerEdgeOffset,isz,gsz);
+		do_fillGradientBuffer(rw,res,gbuf,isz,osz,gsz,innerEdgeOffset,outerEdgeOffset);
+
+		MEM_freeN(gbuf);		// free the gradient index buffer
+		out[0]->data= stackbuf;	// point the node output buffer to our filled buffer
+	}
 }
 
-void register_node_type_cmp_doubleedgemask(bNodeTreeType *ttype) {
-    static bNodeType ntype;      // allocate a node type data structure
+void register_node_type_cmp_doubleedgemask(bNodeTreeType *ttype)
+{
+	static bNodeType ntype;	// allocate a node type data structure
 
-    node_type_base(ttype, &ntype, CMP_NODE_DOUBLEEDGEMASK, "Double Edge Mask", NODE_CLASS_MATTE, NODE_OPTIONS);
-    node_type_socket_templates(&ntype, cmp_node_doubleedgemask_in, cmp_node_doubleedgemask_out);
-    node_type_size(&ntype, 210, 210, 210);
-    node_type_exec(&ntype, node_composit_exec_doubleedgemask);
+	node_type_base(ttype, &ntype, CMP_NODE_DOUBLEEDGEMASK, "Double Edge Mask", NODE_CLASS_MATTE, NODE_OPTIONS);
+	node_type_socket_templates(&ntype, cmp_node_doubleedgemask_in, cmp_node_doubleedgemask_out);
+	node_type_size(&ntype, 210, 210, 210);
+	node_type_exec(&ntype, node_composit_exec_doubleedgemask);
 
-    nodeRegisterType(ttype, &ntype);
+	nodeRegisterType(ttype, &ntype);
 }
diff --git a/source/blender/nodes/composite/nodes/node_composite_filter.c b/source/blender/nodes/composite/nodes/node_composite_filter.c
index 94a109d..6d47046 100644
--- a/source/blender/nodes/composite/nodes/node_composite_filter.c
+++ b/source/blender/nodes/composite/nodes/node_composite_filter.c
@@ -51,24 +51,24 @@ static void do_filter_edge(CompBuf *out, CompBuf *in, float *filter, float fac)
 	
 	rowlen= in->x;
 	
-	for(y=0; y<in->y; y++) {
+	for (y=0; y<in->y; y++) {
 		/* setup rows */
-		if(y==0) row1= in->rect;
+		if (y==0) row1= in->rect;
 		else row1= in->rect + pix*(y-1)*rowlen;
 		
 		row2= in->rect + y*pix*rowlen;
 		
-		if(y==in->y-1) row3= row2;
+		if (y==in->y-1) row3= row2;
 		else row3= row2 + pix*rowlen;
 		
 		fp= out->rect + pix*y*rowlen;
 		
-		if(pix==CB_RGBA) {
+		if (pix==CB_RGBA) {
 			copy_v4_v4(fp, row2);
 			fp+= pix;
 			
-			for(x=2; x<rowlen; x++) {
-				for(c=0; c<3; c++) {
+			for (x=2; x<rowlen; x++) {
+				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);
@@ -80,9 +80,9 @@ static void do_filter_edge(CompBuf *out, CompBuf *in, float *filter, float fac)
 			}
 			copy_v4_v4(fp, row2+4);
 		}
-		else if(pix==CB_VAL) {
+		else if (pix==CB_VAL) {
 			fp+= pix;
-			for(x=2; x<rowlen; x++) {
+			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);
@@ -101,35 +101,35 @@ static void do_filter3(CompBuf *out, CompBuf *in, float *filter, float fac)
 	
 	rowlen= in->x;
 	
-	for(y=0; y<in->y; y++) {
+	for (y=0; y<in->y; y++) {
 		/* setup rows */
-		if(y==0) row1= in->rect;
+		if (y==0) row1= in->rect;
 		else row1= in->rect + pixlen*(y-1)*rowlen;
 		
 		row2= in->rect + y*pixlen*rowlen;
 		
-		if(y==in->y-1) row3= row2;
+		if (y==in->y-1) row3= row2;
 		else row3= row2 + pixlen*rowlen;
 		
 		fp= out->rect + pixlen*(y)*rowlen;
 		
-		if(pixlen==1) {
+		if (pixlen==1) {
 			fp[0]= row2[0];
 			fp+= 1;
 			
-			for(x=2; x<rowlen; x++) {
+			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++; row1++; row2++; row3++;
 			}
 			fp[0]= row2[1];
 		}
-		else if(pixlen==2) {
+		else if (pixlen==2) {
 			fp[0]= row2[0];
 			fp[1]= row2[1];
 			fp+= 2;
 			
-			for(x=2; x<rowlen; x++) {
-				for(c=0; c<2; c++) {
+			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++; row1++; row2++; row3++;
 				}
@@ -137,12 +137,12 @@ static void do_filter3(CompBuf *out, CompBuf *in, float *filter, float fac)
 			fp[0]= row2[2];
 			fp[1]= row2[3];
 		}
-		else if(pixlen==3) {
+		else if (pixlen==3) {
 			copy_v3_v3(fp, row2);
 			fp+= 3;
 			
-			for(x=2; x<rowlen; x++) {
-				for(c=0; c<3; c++) {
+			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++; row1++; row2++; row3++;
 				}
@@ -153,8 +153,8 @@ static void do_filter3(CompBuf *out, CompBuf *in, float *filter, float fac)
 			copy_v4_v4(fp, row2);
 			fp+= 4;
 			
-			for(x=2; x<rowlen; x++) {
-				for(c=0; c<4; c++) {
+			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++; row1++; row2++; row3++;
 				}
@@ -175,12 +175,12 @@ static void node_composit_exec_filter(void *data, bNode *node, bNodeStack **in,
 	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;
+	if (out[0]->hasoutput==0) return;
 	
 	/* stack order in: Image */
 	/* stack order out: Image */
 	
-	if(in[1]->data) {
+	if (in[1]->data) {
 		/* make output size of first available input image */
 		CompBuf *cbuf= in[1]->data;
 		CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, cbuf->type, 1); /* allocs */
diff --git a/source/blender/nodes/composite/nodes/node_composite_flip.c b/source/blender/nodes/composite/nodes/node_composite_flip.c
index 974a140..3c29729 100644
--- a/source/blender/nodes/composite/nodes/node_composite_flip.c
+++ b/source/blender/nodes/composite/nodes/node_composite_flip.c
@@ -45,7 +45,7 @@ static bNodeSocketTemplate cmp_node_flip_out[]= {
 
 static void node_composit_exec_flip(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
 {
-	if(in[0]->data) {
+	if (in[0]->data) {
 		CompBuf *cbuf= in[0]->data;
 		CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, cbuf->type, 1);	/* note, this returns zero'd image */
 		int i, src_pix, src_width, src_height, srcydelt, outydelt, x, y;
@@ -59,20 +59,20 @@ static void node_composit_exec_flip(void *UNUSED(data), bNode *node, bNodeStack
 		srcydelt= src_width*src_pix;
 		outydelt= srcydelt;
 		
-		if(node->custom1) {		/*set up output pointer for y flip*/
+		if (node->custom1) {		/*set up output pointer for y flip*/
 			outfp+= (src_height-1)*outydelt;
 			outydelt= -outydelt;
 		}
 
-		for(y=0; y<src_height; y++) {
-			if(node->custom1 == 1) {	/* no x flip so just copy line*/
+		for (y=0; y<src_height; y++) {
+			if (node->custom1 == 1) {	/* no x flip so just copy line*/
 				memcpy(outfp, srcfp, sizeof(float) * src_pix * src_width);
 				srcfp+=srcydelt;
 			}
 			else {
 				outfp += (src_width-1)*src_pix;
-				for(x=0; x<src_width; x++) {
-					for(i=0; i<src_pix; i++) {
+				for (x=0; x<src_width; x++) {
+					for (i=0; i<src_pix; i++) {
 						outfp[i]= srcfp[i];
 					}
 					outfp -= 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 90135b5..ae793b4 100644
--- a/source/blender/nodes/composite/nodes/node_composite_gamma.c
+++ b/source/blender/nodes/composite/nodes/node_composite_gamma.c
@@ -48,7 +48,7 @@ static bNodeSocketTemplate cmp_node_gamma_out[]= {
 static void do_gamma(bNode *UNUSED(node), float *out, float *in, float *fac)
 {
 	int i=0;
-	for(i=0; i<3; i++) {
+	for (i=0; i<3; i++) {
 		/* check for negative to avoid nan's */
 		out[i] = (in[i] > 0.0f)? powf(in[i],fac[0]): in[i];
 	}
@@ -58,10 +58,10 @@ static void node_composit_exec_gamma(void *UNUSED(data), bNode *node, bNodeStack
 {
 	/* stack order in: Fac, Image */
 	/* stack order out: Image */
-	if(out[0]->hasoutput==0) return;
+	if (out[0]->hasoutput==0) return;
 	
 	/* input no image? then only color operation */
-	if(in[0]->data==NULL) {
+	if (in[0]->data==NULL) {
 		do_gamma(node, out[0]->vec, in[0]->vec, in[1]->vec);
 	}
 	else {
diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.c b/source/blender/nodes/composite/nodes/node_composite_glare.c
index d4e15f7..42760dd 100644
--- a/source/blender/nodes/composite/nodes/node_composite_glare.c
+++ b/source/blender/nodes/composite/nodes/node_composite_glare.c
@@ -436,7 +436,8 @@ static void node_composit_exec_glare(void *UNUSED(data), bNode *node, bNodeStack
 	if (img->type != CB_RGBA) {
 		new = typecheck_compbuf(img, CB_RGBA);
 		src = typecheck_compbuf(img, CB_RGBA);
-	} else {
+	}
+	else {
 		new = dupalloc_compbuf(img);
 		src = dupalloc_compbuf(img);
 	}
diff --git a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
index c459871..7349d1d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
+++ b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
@@ -48,12 +48,12 @@ static void do_hue_sat_fac(bNode *node, float *out, float *in, float *fac)
 {
 	NodeHueSat *nhs= node->storage;
 	
-	if(*fac!=0.0f && (nhs->hue!=0.5f || nhs->sat!=1.0f || nhs->val!=1.0f)) {
+	if (*fac!=0.0f && (nhs->hue!=0.5f || nhs->sat!=1.0f || nhs->val!=1.0f)) {
 		float col[3], hsv[3], mfac= 1.0f - *fac;
 		
 		rgb_to_hsv(in[0], in[1], in[2], hsv, hsv+1, hsv+2);
 		hsv[0]+= (nhs->hue - 0.5f);
-		if(hsv[0]>1.0f) hsv[0]-=1.0f; else if(hsv[0]<0.0f) hsv[0]+= 1.0f;
+		if (hsv[0]>1.0f) hsv[0]-=1.0f; else if (hsv[0]<0.0f) hsv[0]+= 1.0f;
 		hsv[1]*= nhs->sat;
 		hsv[2]*= nhs->val;
 		hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2);
@@ -72,10 +72,10 @@ static void node_composit_exec_hue_sat(void *UNUSED(data), bNode *node, bNodeSta
 {
 	/* stack order in: Fac, Image */
 	/* stack order out: Image */
-	if(out[0]->hasoutput==0) return;
+	if (out[0]->hasoutput==0) return;
 	
 	/* input no image? then only color operation */
-	if(in[1]->data==NULL) {
+	if (in[1]->data==NULL) {
 		do_hue_sat_fac(node, out[0]->vec, in[1]->vec, in[0]->vec);
 	}
 	else {
@@ -88,7 +88,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 */		
-		if(stackbuf!=cbuf)
+		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 6b0849b..23d04a2 100644
--- a/source/blender/nodes/composite/nodes/node_composite_huecorrect.c
+++ b/source/blender/nodes/composite/nodes/node_composite_huecorrect.c
@@ -109,16 +109,16 @@ static void node_composit_exec_huecorrect(void *UNUSED(data), bNode *node, bNode
 	/* stack order input:  fac, image, black level, white level */
 	/* stack order output: image */
 	
-	if(out[0]->hasoutput==0)
+	if (out[0]->hasoutput==0)
 		return;
 
-	if(in[0]->vec[0] == 0.f && in[0]->data == NULL) {
+	if (in[0]->vec[0] == 0.f && in[0]->data == NULL) {
 		out[0]->data = pass_on_compbuf(cbuf);
 		return;
 	}
 	
 	/* input no image? then only color operation */
-	if(in[1]->data==NULL) {
+	if (in[1]->data==NULL) {
 		do_huecorrect_fac(node, out[0]->vec, in[1]->vec, in[0]->vec);
 	}
 	
diff --git a/source/blender/nodes/composite/nodes/node_composite_idMask.c b/source/blender/nodes/composite/nodes/node_composite_idMask.c
index 0600e44..c1dba47 100644
--- a/source/blender/nodes/composite/nodes/node_composite_idMask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_idMask.c
@@ -52,15 +52,15 @@ static void do_idmask(CompBuf *stackbuf, CompBuf *cbuf, float idnr)
 	char *abuf= MEM_mapallocN(cbuf->x*cbuf->y, "anti ali buf");
 	
 	rect= cbuf->rect;
-	for(x= cbuf->x*cbuf->y - 1; x>=0; x--)
-		if(rect[x]==idnr)
+	for (x= cbuf->x*cbuf->y - 1; x>=0; x--)
+		if (rect[x]==idnr)
 			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)
+	for (x= cbuf->x*cbuf->y - 1; x>=0; x--)
+		if (abuf[x]>1)
 			rect[x]= (1.0f/255.0f)*(float)abuf[x];
 	
 	MEM_freeN(abuf);
@@ -74,8 +74,8 @@ static void do_idmask_fsa(CompBuf *stackbuf, CompBuf *cbuf, float idnr)
 	
 	rect= cbuf->rect;
 	rs= stackbuf->rect;
-	for(x= cbuf->x*cbuf->y - 1; x>=0; x--)
-		if(rect[x]==idnr)
+	for (x= cbuf->x*cbuf->y - 1; x>=0; x--)
+		if (rect[x]==idnr)
 			rs[x]= 1.0f;
 	
 }
@@ -85,19 +85,19 @@ static void node_composit_exec_idmask(void *data, bNode *node, bNodeStack **in,
 {
 	RenderData *rd= data;
 	
-	if(out[0]->hasoutput==0)
+	if (out[0]->hasoutput==0)
 		return;
 	
-	if(in[0]->data) {
+	if (in[0]->data) {
 		CompBuf *cbuf= in[0]->data;
 		CompBuf *stackbuf;
 		
-		if(cbuf->type!=CB_VAL)
+		if (cbuf->type!=CB_VAL)
 			return;
 		
 		stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1); /* allocs */;
 		
-		if((rd->scemode & R_FULL_SAMPLE) || node->custom2 == 0)
+		if ((rd->scemode & R_FULL_SAMPLE) || node->custom2 == 0)
 			do_idmask_fsa(stackbuf, cbuf, (float)node->custom1);
 		else
 			do_idmask(stackbuf, cbuf, (float)node->custom1);
diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c
index 997bd72..6a156c3 100644
--- a/source/blender/nodes/composite/nodes/node_composite_image.c
+++ b/source/blender/nodes/composite/nodes/node_composite_image.c
@@ -32,7 +32,6 @@
 
 #include "node_composite_util.h"
 
-
 /* **************** IMAGE (and RenderResult, multilayer image) ******************** */
 
 static bNodeSocketTemplate cmp_node_rlayers_out[]= {
@@ -67,6 +66,212 @@ static bNodeSocketTemplate cmp_node_rlayers_out[]= {
 	{	-1, 0, ""	}
 };
 
+static bNodeSocket *cmp_node_image_add_render_pass_output(bNodeTree *ntree, bNode *node, int UNUSED(pass), int rres_index)
+{
+	bNodeSocket *sock;
+	
+	sock = node_add_output_from_template(ntree, node, &cmp_node_rlayers_out[rres_index]);
+	/* for render pass outputs store the pass type index as a lookup key */
+	sock->storage = SET_INT_IN_POINTER(rres_index);
+	
+	return sock;
+}
+
+static void cmp_node_image_add_render_pass_outputs(bNodeTree *ntree, bNode *node, int passflag)
+{
+	if (passflag & SCE_PASS_COMBINED) {
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_COMBINED, RRES_OUT_IMAGE);
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_COMBINED, RRES_OUT_ALPHA);
+	}
+	
+	if (passflag & SCE_PASS_Z)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_Z, RRES_OUT_Z);
+	if (passflag & SCE_PASS_NORMAL)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_NORMAL, RRES_OUT_NORMAL);
+	if (passflag & SCE_PASS_VECTOR)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_VECTOR, RRES_OUT_VEC);
+	if (passflag & SCE_PASS_UV)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_UV, RRES_OUT_UV);
+	if (passflag & SCE_PASS_RGBA)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_RGBA, RRES_OUT_RGBA);
+	if (passflag & SCE_PASS_DIFFUSE)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_DIFFUSE, RRES_OUT_DIFF);
+	if (passflag & SCE_PASS_SPEC)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_SPEC, RRES_OUT_SPEC);
+	if (passflag & SCE_PASS_SHADOW)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_SHADOW, RRES_OUT_SHADOW);
+	if (passflag & SCE_PASS_AO)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_AO, RRES_OUT_AO);
+	if (passflag & SCE_PASS_REFLECT)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_REFLECT, RRES_OUT_REFLECT);
+	if (passflag & SCE_PASS_REFRACT)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_REFRACT, RRES_OUT_REFRACT);
+	if (passflag & SCE_PASS_INDIRECT)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_INDIRECT, RRES_OUT_INDIRECT);
+	if (passflag & SCE_PASS_INDEXOB)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_INDEXOB, RRES_OUT_INDEXOB);
+	if (passflag & SCE_PASS_INDEXMA)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_INDEXMA, RRES_OUT_INDEXMA);
+	if (passflag & SCE_PASS_MIST)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_MIST, RRES_OUT_MIST);
+	if (passflag & SCE_PASS_EMIT)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_EMIT, RRES_OUT_EMIT);
+	if (passflag & SCE_PASS_ENVIRONMENT)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_ENVIRONMENT, RRES_OUT_ENV);
+	
+	if (passflag & SCE_PASS_DIFFUSE_DIRECT)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_DIFFUSE_DIRECT, RRES_OUT_DIFF_DIRECT);
+	if (passflag & SCE_PASS_DIFFUSE_INDIRECT)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_DIFFUSE_INDIRECT, RRES_OUT_DIFF_INDIRECT);
+	if (passflag & SCE_PASS_DIFFUSE_COLOR)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_DIFFUSE_COLOR, RRES_OUT_DIFF_COLOR);
+	
+	if (passflag & SCE_PASS_GLOSSY_DIRECT)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_GLOSSY_DIRECT, RRES_OUT_GLOSSY_DIRECT);
+	if (passflag & SCE_PASS_GLOSSY_INDIRECT)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_GLOSSY_INDIRECT, RRES_OUT_GLOSSY_INDIRECT);
+	if (passflag & SCE_PASS_GLOSSY_COLOR)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_GLOSSY_COLOR, RRES_OUT_GLOSSY_COLOR);
+	
+	if (passflag & SCE_PASS_TRANSM_DIRECT)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_TRANSM_DIRECT, RRES_OUT_TRANSM_DIRECT);
+	if (passflag & SCE_PASS_TRANSM_INDIRECT)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_TRANSM_INDIRECT, RRES_OUT_TRANSM_INDIRECT);
+	if (passflag & SCE_PASS_TRANSM_COLOR)
+		cmp_node_image_add_render_pass_output(ntree, node, SCE_PASS_TRANSM_COLOR, RRES_OUT_TRANSM_COLOR);
+}
+
+static void cmp_node_image_add_multilayer_outputs(bNodeTree *ntree, bNode *node, RenderLayer *rl)
+{
+	bNodeSocket *sock;
+	RenderPass *rpass;
+	int index;
+	for (rpass=rl->passes.first, index=0; rpass; rpass=rpass->next, ++index) {
+		int type;
+		if (rpass->channels == 1)
+			type = SOCK_FLOAT;
+		else
+			type = SOCK_RGBA;
+		
+		sock = nodeAddSocket(ntree, node, SOCK_OUT, rpass->name, type);
+		/* for multilayer image use pass index directly as key */
+		sock->storage = SET_INT_IN_POINTER(index);
+	}
+}
+
+static void cmp_node_image_create_outputs(bNodeTree *ntree, bNode *node)
+{
+	Image *ima= (Image *)node->id;
+	if (ima) {
+		ImageUser *iuser= node->storage;
+		
+		/* make sure ima->type is correct */
+		BKE_image_get_ibuf(ima, iuser);
+		
+		if (ima->rr) {
+			RenderLayer *rl= BLI_findlink(&ima->rr->layers, iuser->layer);
+			
+			if (rl) {
+				if (ima->type!=IMA_TYPE_MULTILAYER)
+					cmp_node_image_add_render_pass_outputs(ntree, node, rl->passflag);
+				else
+					cmp_node_image_add_multilayer_outputs(ntree, node, rl);
+			}
+			else
+				cmp_node_image_add_render_pass_outputs(ntree, node, RRES_OUT_IMAGE|RRES_OUT_ALPHA);
+		}
+		else
+			cmp_node_image_add_render_pass_outputs(ntree, node, RRES_OUT_IMAGE|RRES_OUT_ALPHA|RRES_OUT_Z);
+	}
+	else
+		cmp_node_image_add_render_pass_outputs(ntree, node, RRES_OUT_IMAGE|RRES_OUT_ALPHA);
+}
+
+static bNodeSocket *cmp_node_image_output_find_match(bNode *UNUSED(node), bNodeSocket *newsock, ListBase *oldsocklist)
+{
+	bNodeSocket *sock;
+	
+	for (sock=oldsocklist->first; sock; sock=sock->next)
+		if (strcmp(sock->name, newsock->name)==0)
+			return sock;
+	return NULL;
+}
+
+static bNodeSocket *cmp_node_image_output_relink(bNode *node, bNodeSocket *oldsock, int oldindex)
+{
+	bNodeSocket *sock;
+	
+	/* first try to find matching socket name */
+	for (sock=node->outputs.first; sock; sock=sock->next)
+		if (strcmp(sock->name, oldsock->name)==0)
+			return sock;
+	
+	/* no matching name, simply link to same index */
+	return BLI_findlink(&node->outputs, oldindex);
+}
+
+static void cmp_node_image_sync_output(bNode *UNUSED(node), bNodeSocket *UNUSED(newsock), bNodeSocket *UNUSED(oldsock))
+{
+	/* pass */
+}
+
+/* XXX make this into a generic socket verification function for dynamic socket replacement (multilayer, groups, static templates) */
+static void cmp_node_image_verify_outputs(bNodeTree *ntree, bNode *node)
+{
+	bNodeSocket *newsock, *oldsock, *oldsock_next;
+	ListBase oldsocklist;
+	int oldindex;
+	bNodeLink *link;
+	
+	/* store current nodes in oldsocklist, then clear socket list */
+	oldsocklist = node->outputs;
+	node->outputs.first = node->outputs.last = NULL;
+	
+	/* XXX make callback */
+	cmp_node_image_create_outputs(ntree, node);
+	/* flag all new sockets as dynamic, to prevent removal by socket verification function */
+	for (newsock=node->outputs.first; newsock; newsock=newsock->next)
+		newsock->flag |= SOCK_DYNAMIC;
+	
+	for (newsock=node->outputs.first; newsock; newsock=newsock->next) {
+		/* XXX make callback */
+		oldsock = cmp_node_image_output_find_match(node, newsock, &oldsocklist);
+		if (oldsock) {
+			/* XXX make callback */
+			cmp_node_image_sync_output(node, newsock, oldsock);
+		}
+	}
+	
+	/* move links to new socket */
+	for (oldsock=oldsocklist.first, oldindex=0; oldsock; oldsock=oldsock->next, ++oldindex) {
+		newsock = cmp_node_image_output_relink(node, oldsock, oldindex);
+		
+		if (newsock) {
+			for (link=ntree->links.first; link; link=link->next) {
+				if (link->fromsock == oldsock)
+					link->fromsock = newsock;
+			}
+		}
+	}
+	
+	/* delete old sockets
+	 * XXX oldsock is not actually in the node->outputs list any more,
+	 * but the nodeRemoveSocket function works anyway. In future this
+	 * should become part of the core code, so can take care of this behavior.
+	 */
+	for (oldsock=oldsocklist.first; oldsock; oldsock=oldsock_next) {
+		oldsock_next = oldsock->next;
+		nodeRemoveSocket(ntree, node, oldsock);
+	}
+}
+
+static void cmp_node_image_update(bNodeTree *ntree, bNode *node)
+{
+	/* avoid unnecessary updates, only changes to the image/image user data are of interest */
+	if (node->update & NODE_UPDATE_ID)
+		cmp_node_image_verify_outputs(ntree, node);
+}
+
 /* float buffer from the image with matching color management */
 float *node_composit_get_float_buffer(RenderData *rd, ImBuf *ibuf, int *alloc)
 {
@@ -75,8 +280,8 @@ float *node_composit_get_float_buffer(RenderData *rd, ImBuf *ibuf, int *alloc)
 
 	*alloc= FALSE;
 
-	if(rd->color_mgt_flag & R_COLOR_MANAGEMENT) {
-		if(ibuf->profile != IB_PROFILE_NONE) {
+	if (rd->color_mgt_flag & R_COLOR_MANAGEMENT) {
+		if (ibuf->profile != IB_PROFILE_NONE) {
 			rect= ibuf->rect_float;
 		}
 		else {
@@ -90,7 +295,7 @@ float *node_composit_get_float_buffer(RenderData *rd, ImBuf *ibuf, int *alloc)
 		}
 	}
 	else {
-		if(ibuf->profile == IB_PROFILE_NONE) {
+		if (ibuf->profile == IB_PROFILE_NONE) {
 			rect= ibuf->rect_float;
 		}
 		else {
@@ -119,7 +324,7 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i
 	int alloc= FALSE;
 
 	ibuf= BKE_image_get_ibuf(ima, iuser);
-	if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) {
+	if (ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) {
 		return NULL;
 	}
 
@@ -129,7 +334,7 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i
 
 	/* now we need a float buffer from the image with matching color management */
 	/* XXX weak code, multilayer is excluded from this */
-	if(ibuf->channels == 4 && ima->rr==NULL) {
+	if (ibuf->channels == 4 && ima->rr==NULL) {
 		rect= node_composit_get_float_buffer(rd, ibuf, &alloc);
 	}
 	else {
@@ -141,9 +346,9 @@ static CompBuf *node_composit_get_image(RenderData *rd, Image *ima, ImageUser *i
 
 	type= ibuf->channels;
 	
-	if(rd->scemode & R_COMP_CROP) {
+	if (rd->scemode & R_COMP_CROP) {
 		stackbuf= get_cropped_compbuf(&rd->disprect, rect, ibuf->x, ibuf->y, type);
-		if(alloc)
+		if (alloc)
 			MEM_freeN(rect);
 	}
 	else {
@@ -176,8 +381,8 @@ static CompBuf *node_composit_get_zimage(bNode *node, RenderData *rd)
 	ImBuf *ibuf= BKE_image_get_ibuf((Image *)node->id, node->storage);
 	CompBuf *zbuf= NULL;
 	
-	if(ibuf && ibuf->zbuf_float) {
-		if(rd->scemode & R_COMP_CROP) {
+	if (ibuf && ibuf->zbuf_float) {
+		if (rd->scemode & R_COMP_CROP) {
 			zbuf= get_cropped_compbuf(&rd->disprect, ibuf->zbuf_float, ibuf->x, ibuf->y, CB_VAL);
 		}
 		else {
@@ -189,117 +394,75 @@ static CompBuf *node_composit_get_zimage(bNode *node, RenderData *rd)
 }
 
 /* check if layer is available, returns pass buffer */
-static CompBuf *compbuf_multilayer_get(RenderData *rd, RenderLayer *rl, Image *ima, ImageUser *iuser, int passtype)
+static CompBuf *compbuf_multilayer_get(RenderData *rd, RenderLayer *rl, Image *ima, ImageUser *iuser, int passindex)
 {
-	RenderPass *rpass;
-	short index;
-	
-	for(index=0, rpass= rl->passes.first; rpass; rpass= rpass->next, index++)
-		if(rpass->passtype==passtype)
-			break;
-	
-	if(rpass) {
+	RenderPass *rpass = BLI_findlink(&rl->passes, passindex);
+	if (rpass) {
 		CompBuf *cbuf;
 		
-		iuser->pass= index;
+		iuser->pass = passindex;
 		BKE_image_multilayer_index(ima->rr, iuser);
-		cbuf= node_composit_get_image(rd, ima, iuser);
+		cbuf = node_composit_get_image(rd, ima, iuser);
 		
 		return cbuf;
 	}
 	return NULL;
 }
 
-static void outputs_multilayer_get(RenderData *rd, RenderLayer *rl, bNodeStack **out, Image *ima, ImageUser *iuser)
-{
-	if(out[RRES_OUT_Z]->hasoutput)
-		out[RRES_OUT_Z]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_Z);
-	if(out[RRES_OUT_VEC]->hasoutput)
-		out[RRES_OUT_VEC]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_VECTOR);
-	if(out[RRES_OUT_NORMAL]->hasoutput)
-		out[RRES_OUT_NORMAL]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_NORMAL);
-	if(out[RRES_OUT_UV]->hasoutput)
-		out[RRES_OUT_UV]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_UV);
-	
-	if(out[RRES_OUT_RGBA]->hasoutput)
-		out[RRES_OUT_RGBA]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_RGBA);
-	if(out[RRES_OUT_DIFF]->hasoutput)
-		out[RRES_OUT_DIFF]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_DIFFUSE);
-	if(out[RRES_OUT_SPEC]->hasoutput)
-		out[RRES_OUT_SPEC]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_SPEC);
-	if(out[RRES_OUT_SHADOW]->hasoutput)
-		out[RRES_OUT_SHADOW]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_SHADOW);
-	if(out[RRES_OUT_AO]->hasoutput)
-		out[RRES_OUT_AO]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_AO);
-	if(out[RRES_OUT_REFLECT]->hasoutput)
-		out[RRES_OUT_REFLECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_REFLECT);
-	if(out[RRES_OUT_REFRACT]->hasoutput)
-		out[RRES_OUT_REFRACT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_REFRACT);
-	if(out[RRES_OUT_INDIRECT]->hasoutput)
-		out[RRES_OUT_INDIRECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_INDIRECT);
-	if(out[RRES_OUT_INDEXOB]->hasoutput)
-		out[RRES_OUT_INDEXOB]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_INDEXOB);
-	if(out[RRES_OUT_INDEXMA]->hasoutput)
-		out[RRES_OUT_INDEXMA]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_INDEXMA);
-	if(out[RRES_OUT_MIST]->hasoutput)
-		out[RRES_OUT_MIST]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_MIST);
-	if(out[RRES_OUT_EMIT]->hasoutput)
-		out[RRES_OUT_EMIT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_EMIT);
-	if(out[RRES_OUT_ENV]->hasoutput)
-		out[RRES_OUT_ENV]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_ENVIRONMENT);
-	if(out[RRES_OUT_DIFF_DIRECT]->hasoutput)
-		out[RRES_OUT_DIFF_DIRECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_DIFFUSE_DIRECT);
-	if(out[RRES_OUT_DIFF_INDIRECT]->hasoutput)
-		out[RRES_OUT_DIFF_INDIRECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_DIFFUSE_INDIRECT);
-	if(out[RRES_OUT_DIFF_COLOR]->hasoutput)
-		out[RRES_OUT_DIFF_COLOR]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_DIFFUSE_COLOR);
-	if(out[RRES_OUT_GLOSSY_DIRECT]->hasoutput)
-		out[RRES_OUT_GLOSSY_DIRECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_GLOSSY_DIRECT);
-	if(out[RRES_OUT_GLOSSY_INDIRECT]->hasoutput)
-		out[RRES_OUT_GLOSSY_INDIRECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_GLOSSY_INDIRECT);
-	if(out[RRES_OUT_GLOSSY_COLOR]->hasoutput)
-		out[RRES_OUT_GLOSSY_COLOR]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_GLOSSY_COLOR);
-	if(out[RRES_OUT_TRANSM_DIRECT]->hasoutput)
-		out[RRES_OUT_TRANSM_DIRECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_TRANSM_DIRECT);
-	if(out[RRES_OUT_TRANSM_INDIRECT]->hasoutput)
-		out[RRES_OUT_TRANSM_INDIRECT]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_TRANSM_INDIRECT);
-	if(out[RRES_OUT_TRANSM_COLOR]->hasoutput)
-		out[RRES_OUT_TRANSM_COLOR]->data= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_TRANSM_COLOR);
-}
-
-
 static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
 {
 	
 	/* image assigned to output */
 	/* stack order input sockets: col, alpha */
-	if(node->id) {
+	if (node->id) {
 		RenderData *rd= data;
 		Image *ima= (Image *)node->id;
 		ImageUser *iuser= (ImageUser *)node->storage;
-		CompBuf *stackbuf= NULL;
 		
 		/* first set the right frame number in iuser */
 		BKE_image_user_calc_frame(iuser, rd->cfra, 0);
 		
 		/* force a load, we assume iuser index will be set OK anyway */
-		if(ima->type==IMA_TYPE_MULTILAYER)
+		if (ima->type==IMA_TYPE_MULTILAYER)
 			BKE_image_get_ibuf(ima, iuser);
 		
-		if(ima->type==IMA_TYPE_MULTILAYER && ima->rr) {
+		if (ima->type==IMA_TYPE_MULTILAYER && ima->rr) {
 			RenderLayer *rl= BLI_findlink(&ima->rr->layers, iuser->layer);
 			
-			if(rl) {
-				out[0]->data= stackbuf= compbuf_multilayer_get(rd, rl, ima, iuser, SCE_PASS_COMBINED);
+			if (rl) {
+				bNodeSocket *sock;
+				int out_index;
+				CompBuf *combinedbuf= NULL, *firstbuf= NULL;
 				
-				/* go over all layers */
-				outputs_multilayer_get(rd, rl, out, ima, iuser);
+				for (sock=node->outputs.first, out_index=0; sock; sock=sock->next, ++out_index) {
+					int passindex = GET_INT_FROM_POINTER(sock->storage);
+					if (out[out_index]->hasoutput) {
+						CompBuf *stackbuf = out[out_index]->data = compbuf_multilayer_get(rd, rl, ima, iuser, passindex);
+						if (stackbuf) {
+							/* preview policy: take first 'Combined' pass if available,
+							 * otherwise just use the first layer.
+							 */
+							if (!firstbuf)
+								firstbuf = stackbuf;
+							if (!combinedbuf &&
+							    (strcmp(sock->name, "Combined")==0 || strcmp(sock->name, "Image")==0))
+								combinedbuf = stackbuf;
+						}
+					}
+				}
+				
+				/* preview */
+				if (combinedbuf)
+					generate_preview(data, node, combinedbuf);
+				else if (firstbuf)
+					generate_preview(data, node, firstbuf);
 			}
 		}
 		else {
-			stackbuf= node_composit_get_image(rd, ima, iuser);
-
+			CompBuf *stackbuf = node_composit_get_image(rd, ima, iuser);
 			if (stackbuf) {
+				int num_outputs = BLI_countlist(&node->outputs);
+				
 				/*respect image premul option*/
 				if (stackbuf->type==CB_RGBA && ima->flag & IMA_DO_PREMUL) {
 					int i;
@@ -322,25 +485,26 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **UNUSE
 					}
 				}
 			
-				/* put image on stack */	
-				out[0]->data= stackbuf;
-			
-				if(out[2]->hasoutput)
+				/* put image on stack */
+				if (num_outputs > 0)
+					out[0]->data= stackbuf;
+				
+				/* alpha output */
+				if (num_outputs > 1 && out[1]->hasoutput)
+					out[1]->data= valbuf_from_rgbabuf(stackbuf, CHAN_A);
+				
+				/* Z output */
+				if (num_outputs > 2 && out[2]->hasoutput)
 					out[2]->data= node_composit_get_zimage(node, rd);
+				
+				/* preview */
+				generate_preview(data, node, stackbuf);
 			}
 		}
-		
-		/* alpha and preview for both types */
-		if(stackbuf) {
-			if(out[1]->hasoutput)
-				out[1]->data= valbuf_from_rgbabuf(stackbuf, CHAN_A);
-
-			generate_preview(data, node, stackbuf);
-		}
 	}	
 }
 
-static void node_composit_init_image(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+static void node_composit_init_image(bNodeTree *ntree, bNode* node, bNodeTemplate *UNUSED(ntemp))
 {
 	ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "node image user");
 	node->storage= iuser;
@@ -348,6 +512,9 @@ static void node_composit_init_image(bNodeTree *UNUSED(ntree), bNode* node, bNod
 	iuser->sfra= 1;
 	iuser->fie_ima= 2;
 	iuser->ok= 1;
+	
+	/* setup initial outputs */
+	cmp_node_image_verify_outputs(ntree, node);
 }
 
 void register_node_type_cmp_image(bNodeTreeType *ttype)
@@ -355,10 +522,10 @@ void register_node_type_cmp_image(bNodeTreeType *ttype)
 	static bNodeType ntype;
 
 	node_type_base(ttype, &ntype, CMP_NODE_IMAGE, "Image", NODE_CLASS_INPUT, NODE_PREVIEW|NODE_OPTIONS);
-	node_type_socket_templates(&ntype, NULL, cmp_node_rlayers_out);
 	node_type_size(&ntype, 120, 80, 300);
 	node_type_init(&ntype, node_composit_init_image);
 	node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage);
+	node_type_update(&ntype, cmp_node_image_update, NULL);
 	node_type_exec(&ntype, node_composit_exec_image);
 
 	nodeRegisterType(ttype, &ntype);
@@ -370,18 +537,18 @@ void register_node_type_cmp_image(bNodeTreeType *ttype)
 static CompBuf *compbuf_from_pass(RenderData *rd, RenderLayer *rl, int rectx, int recty, int passcode)
 {
 	float *fp= RE_RenderLayerGetPass(rl, passcode);
-	if(fp) {
+	if (fp) {
 		CompBuf *buf;
 		int buftype= CB_VEC3;
 
-		if(ELEM4(passcode, SCE_PASS_Z, SCE_PASS_INDEXOB, SCE_PASS_MIST, SCE_PASS_INDEXMA))
+		if (ELEM4(passcode, SCE_PASS_Z, SCE_PASS_INDEXOB, SCE_PASS_MIST, SCE_PASS_INDEXMA))
 			buftype= CB_VAL;
-		else if(passcode==SCE_PASS_VECTOR)
+		else if (passcode==SCE_PASS_VECTOR)
 			buftype= CB_VEC4;
-		else if(ELEM(passcode, SCE_PASS_COMBINED, SCE_PASS_RGBA))
+		else if (ELEM(passcode, SCE_PASS_COMBINED, SCE_PASS_RGBA))
 			buftype= CB_RGBA;
 
-		if(rd->scemode & R_COMP_CROP)
+		if (rd->scemode & R_COMP_CROP)
 			buf= get_cropped_compbuf(&rd->disprect, fp, rectx, recty, buftype);
 		else {
 			buf= alloc_compbuf(rectx, recty, buftype, 0);
@@ -394,61 +561,63 @@ static CompBuf *compbuf_from_pass(RenderData *rd, RenderLayer *rl, int rectx, in
 
 static void node_composit_rlayers_out(RenderData *rd, RenderLayer *rl, bNodeStack **out, int rectx, int recty)
 {
-	if(out[RRES_OUT_Z]->hasoutput)
+	if (out[RRES_OUT_Z]->hasoutput)
 		out[RRES_OUT_Z]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_Z);
-	if(out[RRES_OUT_VEC]->hasoutput)
+	if (out[RRES_OUT_VEC]->hasoutput)
 		out[RRES_OUT_VEC]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_VECTOR);
-	if(out[RRES_OUT_NORMAL]->hasoutput)
+	if (out[RRES_OUT_NORMAL]->hasoutput)
 		out[RRES_OUT_NORMAL]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_NORMAL);
-	if(out[RRES_OUT_UV]->hasoutput)
+	if (out[RRES_OUT_UV]->hasoutput)
 		out[RRES_OUT_UV]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_UV);
 
-	if(out[RRES_OUT_RGBA]->hasoutput)
+	if (out[RRES_OUT_RGBA]->hasoutput)
 		out[RRES_OUT_RGBA]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_RGBA);
-	if(out[RRES_OUT_DIFF]->hasoutput)
+	if (out[RRES_OUT_DIFF]->hasoutput)
 		out[RRES_OUT_DIFF]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_DIFFUSE);
-	if(out[RRES_OUT_SPEC]->hasoutput)
+	if (out[RRES_OUT_SPEC]->hasoutput)
 		out[RRES_OUT_SPEC]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_SPEC);
-	if(out[RRES_OUT_SHADOW]->hasoutput)
+	if (out[RRES_OUT_SHADOW]->hasoutput)
 		out[RRES_OUT_SHADOW]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_SHADOW);
-	if(out[RRES_OUT_AO]->hasoutput)
+	if (out[RRES_OUT_AO]->hasoutput)
 		out[RRES_OUT_AO]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_AO);
-	if(out[RRES_OUT_REFLECT]->hasoutput)
+	if (out[RRES_OUT_REFLECT]->hasoutput)
 		out[RRES_OUT_REFLECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_REFLECT);
-	if(out[RRES_OUT_REFRACT]->hasoutput)
+	if (out[RRES_OUT_REFRACT]->hasoutput)
 		out[RRES_OUT_REFRACT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_REFRACT);
-	if(out[RRES_OUT_INDIRECT]->hasoutput)
+	if (out[RRES_OUT_INDIRECT]->hasoutput)
 		out[RRES_OUT_INDIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDIRECT);
-	if(out[RRES_OUT_INDEXOB]->hasoutput)
+	if (out[RRES_OUT_INDEXOB]->hasoutput)
 		out[RRES_OUT_INDEXOB]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDEXOB);
-	if(out[RRES_OUT_INDEXMA]->hasoutput)
+	if (out[RRES_OUT_INDEXMA]->hasoutput)
 		out[RRES_OUT_INDEXMA]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_INDEXMA);
-	if(out[RRES_OUT_MIST]->hasoutput)
+	if (out[RRES_OUT_MIST]->hasoutput)
 		out[RRES_OUT_MIST]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_MIST);
-	if(out[RRES_OUT_EMIT]->hasoutput)
+	if (out[RRES_OUT_EMIT]->hasoutput)
 		out[RRES_OUT_EMIT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_EMIT);
-	if(out[RRES_OUT_ENV]->hasoutput)
+	if (out[RRES_OUT_ENV]->hasoutput)
 		out[RRES_OUT_ENV]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_ENVIRONMENT);
-	if(out[RRES_OUT_DIFF_DIRECT]->hasoutput)
+	if (out[RRES_OUT_DIFF_DIRECT]->hasoutput)
 		out[RRES_OUT_DIFF_DIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_DIFFUSE_DIRECT);
-	if(out[RRES_OUT_DIFF_INDIRECT]->hasoutput)
+	if (out[RRES_OUT_DIFF_INDIRECT]->hasoutput)
 		out[RRES_OUT_DIFF_INDIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_DIFFUSE_INDIRECT);
-	if(out[RRES_OUT_DIFF_COLOR]->hasoutput)
+	if (out[RRES_OUT_DIFF_COLOR]->hasoutput)
 		out[RRES_OUT_DIFF_COLOR]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_DIFFUSE_COLOR);
-	if(out[RRES_OUT_GLOSSY_DIRECT]->hasoutput)
+	if (out[RRES_OUT_GLOSSY_DIRECT]->hasoutput)
 		out[RRES_OUT_GLOSSY_DIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_GLOSSY_DIRECT);
-	if(out[RRES_OUT_GLOSSY_INDIRECT]->hasoutput)
+	if (out[RRES_OUT_GLOSSY_INDIRECT]->hasoutput)
 		out[RRES_OUT_GLOSSY_INDIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_GLOSSY_INDIRECT);
-	if(out[RRES_OUT_GLOSSY_COLOR]->hasoutput)
+	if (out[RRES_OUT_GLOSSY_COLOR]->hasoutput)
 		out[RRES_OUT_GLOSSY_COLOR]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_GLOSSY_COLOR);
-	if(out[RRES_OUT_TRANSM_DIRECT]->hasoutput)
+	if (out[RRES_OUT_TRANSM_DIRECT]->hasoutput)
 		out[RRES_OUT_TRANSM_DIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_TRANSM_DIRECT);
-	if(out[RRES_OUT_TRANSM_INDIRECT]->hasoutput)
+	if (out[RRES_OUT_TRANSM_INDIRECT]->hasoutput)
 		out[RRES_OUT_TRANSM_INDIRECT]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_TRANSM_INDIRECT);
-	if(out[RRES_OUT_TRANSM_COLOR]->hasoutput)
+	if (out[RRES_OUT_TRANSM_COLOR]->hasoutput)
 		out[RRES_OUT_TRANSM_COLOR]->data= compbuf_from_pass(rd, rl, rectx, recty, SCE_PASS_TRANSM_COLOR);
 }
 
+
+
 static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
 {
 	Scene *sce= (Scene *)node->id;
@@ -456,24 +625,24 @@ static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **UNU
 	RenderData *rd= data;
 	RenderResult *rr= NULL;
 
-	if(re)
+	if (re)
 		rr= RE_AcquireResultRead(re);
 
-	if(rr) {
+	if (rr) {
 		SceneRenderLayer *srl= BLI_findlink(&sce->r.layers, node->custom1);
-		if(srl) {
+		if (srl) {
 			RenderLayer *rl= RE_GetRenderLayer(rr, srl->name);
-			if(rl && rl->rectf) {
+			if (rl && rl->rectf) {
 				CompBuf *stackbuf;
 
 				/* we put render rect on stack, cbuf knows rect is from other ibuf when freed! */
-				if(rd->scemode & R_COMP_CROP)
+				if (rd->scemode & R_COMP_CROP)
 					stackbuf= get_cropped_compbuf(&rd->disprect, rl->rectf, rr->rectx, rr->recty, CB_RGBA);
 				else {
 					stackbuf= alloc_compbuf(rr->rectx, rr->recty, CB_RGBA, 0);
 					stackbuf->rect= rl->rectf;
 				}
-				if(stackbuf==NULL) {
+				if (stackbuf==NULL) {
 					printf("Error; Preview Panel in UV Window returns zero sized image\n");
 				}
 				else {
@@ -483,7 +652,7 @@ static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **UNU
 					/* put on stack */
 					out[RRES_OUT_IMAGE]->data= stackbuf;
 
-					if(out[RRES_OUT_ALPHA]->hasoutput)
+					if (out[RRES_OUT_ALPHA]->hasoutput)
 						out[RRES_OUT_ALPHA]->data= valbuf_from_rgbabuf(stackbuf, CHAN_A);
 
 					node_composit_rlayers_out(rd, rl, out, rr->rectx, rr->recty);
@@ -494,7 +663,7 @@ static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **UNU
 		}
 	}
 
-	if(re)
+	if (re)
 		RE_ReleaseResult(re);
 }
 
diff --git a/source/blender/nodes/composite/nodes/node_composite_invert.c b/source/blender/nodes/composite/nodes/node_composite_invert.c
index 4fda90e..8f3a6fc 100644
--- a/source/blender/nodes/composite/nodes/node_composite_invert.c
+++ b/source/blender/nodes/composite/nodes/node_composite_invert.c
@@ -45,14 +45,16 @@ static bNodeSocketTemplate cmp_node_invert_out[]= {
 
 static void do_invert(bNode *node, float *out, float *in)
 {
-	if(node->custom1 & CMP_CHAN_RGB) {
+	if (node->custom1 & CMP_CHAN_RGB) {
 		out[0] = 1.0f - in[0];
 		out[1] = 1.0f - in[1];
 		out[2] = 1.0f - in[2];
-	} else
+	}
+	else {
 		copy_v3_v3(out, in);
+	}
 		
-	if(node->custom1 & CMP_CHAN_A)
+	if (node->custom1 & CMP_CHAN_A)
 		out[3] = 1.0f - in[3];
 	else
 		out[3] = in[3];
@@ -67,12 +69,12 @@ static void do_invert_fac(bNode *node, float *out, float *in, float *fac)
 	/* blend inverted result against original input with fac */
 	facm = 1.0f - fac[0];
 
-	if(node->custom1 & CMP_CHAN_RGB) {
+	if (node->custom1 & CMP_CHAN_RGB) {
 		col[0] = fac[0]*col[0] + (facm*in[0]);
 		col[1] = fac[0]*col[1] + (facm*in[1]);
 		col[2] = fac[0]*col[2] + (facm*in[2]);
 	}
-	if(node->custom1 & CMP_CHAN_A)
+	if (node->custom1 & CMP_CHAN_A)
 		col[3] = fac[0]*col[3] + (facm*in[3]);
 	
 	copy_v4_v4(out, col);
@@ -84,10 +86,10 @@ static void node_composit_exec_invert(void *UNUSED(data), bNode *node, bNodeStac
 	/* stack order out: Image */
 	float *fac= in[0]->vec;
 	
-	if(out[0]->hasoutput==0) return;
+	if (out[0]->hasoutput==0) return;
 	
 	/* input no image? then only color operation */
-	if(in[1]->data==NULL && in[0]->data==NULL) {
+	if (in[1]->data==NULL && in[0]->data==NULL) {
 		do_invert_fac(node, out[0]->vec, in[1]->vec, fac);
 	}
 	else {
@@ -105,7 +107,8 @@ static void node_composit_exec_invert(void *UNUSED(data), bNode *node, bNodeStac
 			out[0]->data= stackbuf;
 			return;
 			
-		} else {
+		}
+		else {
 			out[0]->data = pass_on_compbuf(cbuf);
 			return;
 		}
diff --git a/source/blender/nodes/composite/nodes/node_composite_levels.c b/source/blender/nodes/composite/nodes/node_composite_levels.c
index 9417e50..ec6d200 100644
--- a/source/blender/nodes/composite/nodes/node_composite_levels.c
+++ b/source/blender/nodes/composite/nodes/node_composite_levels.c
@@ -57,13 +57,13 @@ static void fill_bins(bNode* node, CompBuf* in, int* bins)
 	int x,y;
 
 	/*fill bins */
-	for(y=0; y<in->y; y++) {
-		for(x=0; x<in->x; x++) {
+	for (y=0; y<in->y; y++) {
+		for (x=0; x<in->x; x++) {
 
 			/* get the pixel */
 			qd_getPixel(in, x, y, value);
 
-			if(value[3] > 0.0f) { /* don't count transparent pixels */
+			if (value[3] > 0.0f) { /* don't count transparent pixels */
 				switch(node->custom1) {
 					case 1: { /* all colors */
 						rgb_tobw(value[0],value[1],value[2], &value[0]);
@@ -97,8 +97,8 @@ static void fill_bins(bNode* node, CompBuf* in, int* bins)
 				} /*end switch */
 
 				/*clip*/
-				if(ivalue<0) ivalue=0;
-				if(ivalue>255) ivalue=255;
+				if (ivalue<0) ivalue=0;
+				if (ivalue>255) ivalue=255;
 
 				/*put in the correct bin*/
 				bins[ivalue]+=1;
@@ -114,13 +114,13 @@ static float brightness_mean(bNode* node, CompBuf* in)
 	int x,y;
 	float value[4];
 
-	for(x=0; x< in->x; x++) {
-		for(y=0; y < in->y; y++) {
+	for (x=0; x< in->x; x++) {
+		for (y=0; y < in->y; y++) {
 			
 			/* get the pixel */
 			qd_getPixel(in, x, y, value);
 
-			if(value[3] > 0.0f) { /* don't count transparent pixels */
+			if (value[3] > 0.0f) { /* don't count transparent pixels */
 				numPixels++;
 				switch(node->custom1)
 				{
@@ -166,13 +166,13 @@ static float brightness_standard_deviation(bNode* node, CompBuf* in, float mean)
 	int x,y;
 	float value[4];
 
-	for(x=0; x< in->x; x++) {
-		for(y=0; y < in->y; y++) {
+	for (x=0; x< in->x; x++) {
+		for (y=0; y < in->y; y++) {
 			
 			/* get the pixel */
 			qd_getPixel(in, x, y, value);
 
-			if(value[3] > 0.0f) { /* don't count transparent pixels */
+			if (value[3] > 0.0f) { /* don't count transparent pixels */
 				numPixels++;
 				switch(node->custom1)
 				{
@@ -224,18 +224,18 @@ static void draw_histogram(bNode *node, CompBuf *out, int* bins)
 
 	/* find max value */
 	max=0;
-	for(x=0; x<256; x++) {
-		if(bins[x]>max) max=bins[x];
+	for (x=0; x<256; x++) {
+		if (bins[x]>max) max=bins[x];
 	}
 
 	/*draw histogram in buffer */
-	for(x=0; x<out->x; x++) {
-		for(y=0;y<out->y; y++) {
+	for (x=0; x<out->x; x++) {
+		for (y=0;y<out->y; y++) {
 
 			/* get normalized value (0..255) */
 			value=((float)bins[x]/(float)max)*255.0f;
 
-			if(y < (int)value) { /*if the y value is below the height of the bar for this line then draw with the color */
+			if (y < (int)value) { /*if the y value is below the height of the bar for this line then draw with the color */
 				switch (node->custom1) {
 					case 1: { /* draw in black */
 						color[0]=0.0; color[1]=0.0; color[2]=0.0; color[3]=1.0;
@@ -259,7 +259,7 @@ static void draw_histogram(bNode *node, CompBuf *out, int* bins)
 					}
 				}
 			}
-			else{
+			else {
 				color[0]=0.8; color[1]=0.8; color[2]=0.8; color[3]=1.0;
 			}
 
@@ -277,14 +277,14 @@ static void node_composit_exec_view_levels(void *data, bNode *node, bNodeStack *
 	int bins[256];
 	int x;
 
-	if(in[0]->hasinput==0)  return;
-	if(in[0]->data==NULL) return;
+	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);	
 		
 	/*initalize bins*/
-	for(x=0; x<256; x++) {
+	for (x=0; x<256; x++) {
 		bins[x]=0;
 	}
 	
@@ -303,14 +303,14 @@ static void node_composit_exec_view_levels(void *data, bNode *node, bNodeStack *
 	printf("Std Dev: %f\n", std_dev);
 	*/
 
-	if(out[0]->hasoutput)
+	if (out[0]->hasoutput)
 			out[0]->vec[0]= mean;
-	if(out[1]->hasoutput)
+	if (out[1]->hasoutput)
 			out[1]->vec[0]= std_dev;
 
 	generate_preview(data, node, histogram);
 
-	if(cbuf!=in[0]->data)
+	if (cbuf!=in[0]->data)
 		free_compbuf(cbuf);
 	free_compbuf(histogram);
 }
diff --git a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c
index ad5e9d4..85c291f 100644
--- a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.c
@@ -51,10 +51,10 @@ static void do_luma_matte(bNode *node, float *out, float *in)
 	float alpha;
 
 	/* test range*/
-	if(in[0]>c->t1) {
+	if (in[0]>c->t1) {
 		alpha=1.0;
 	}
-	else if(in[0]<c->t2){
+	else if (in[0]<c->t2) {
 		alpha=0.0;
 	}
 	else {/*blend */
@@ -76,9 +76,9 @@ static void node_composit_exec_luma_matte(void *data, bNode *node, bNodeStack **
 	CompBuf *cbuf;
 	CompBuf *outbuf;
 	
-	if(in[0]->hasinput==0)  return;
-	if(in[0]->data==NULL) return;
-	if(out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
+	if (in[0]->hasinput==0)  return;
+	if (in[0]->data==NULL) return;
+	if (out[0]->hasoutput==0 && out[1]->hasoutput==0) return;
 	
 	cbuf=typecheck_compbuf(in[0]->data, CB_RGBA);
 	
@@ -92,7 +92,7 @@ static void node_composit_exec_luma_matte(void *data, bNode *node, bNodeStack **
 	out[0]->data=outbuf;
 	if (out[1]->hasoutput)
 		out[1]->data=valbuf_from_rgbabuf(outbuf, CHAN_A);
-	if(cbuf!=in[0]->data)
+	if (cbuf!=in[0]->data)
 		free_compbuf(cbuf);
 }
 
diff --git a/source/blender/nodes/composite/nodes/node_composite_mapUV.c b/source/blender/nodes/composite/nodes/node_composite_mapUV.c
index 1ca729c..7d62e6b 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mapUV.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mapUV.c
@@ -64,10 +64,10 @@ static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float thr
 	sx= stackbuf->x;
 	sy= stackbuf->y;
 	
-	for(y=0; y<sy; y++) {
-		for(x=0; x<sx; x++, out+=4, uv+=3, uvnext+=3, uvprev+=3) {
-			if(x>0 && x<sx-1 && y>0 && y<sy-1) {
-				if(uv[2]!=0.0f) {
+	for (y=0; y<sy; y++) {
+		for (x=0; x<sx; x++, out+=4, uv+=3, uvnext+=3, uvprev+=3) {
+			if (x>0 && x<sx-1 && y>0 && y<sy-1) {
+				if (uv[2]!=0.0f) {
 					float uv_l, uv_r;
 					
 					/* adaptive sampling, red (U) channel */
@@ -113,16 +113,16 @@ static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float thr
 					
 					/* UV to alpha threshold */
 					alpha= 1.0f - threshold*(dx+dy);
-					if(alpha<0.0f) alpha= 0.0f;
+					if (alpha<0.0f) alpha= 0.0f;
 					else alpha*= uv[2];
 					
 					/* should use mipmap */
-					if(dx > 0.20f) dx= 0.20f;
-					if(dy > 0.20f) dy= 0.20f;
+					if (dx > 0.20f) dx= 0.20f;
+					if (dy > 0.20f) dy= 0.20f;
 					
 					ibuf_sample(ibuf, uv[0], uv[1], dx, dy, out);
 					/* premul */
-					if(alpha<1.0f) {
+					if (alpha<1.0f) {
 						out[0]*= alpha;
 						out[1]*= alpha;
 						out[2]*= alpha;
@@ -139,10 +139,10 @@ static void do_mapuv(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *uvbuf, float thr
 
 static void node_composit_exec_mapuv(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
 {
-	if(out[0]->hasoutput==0)
+	if (out[0]->hasoutput==0)
 		return;
 	
-	if(in[0]->data && in[1]->data) {
+	if (in[0]->data && in[1]->data) {
 		CompBuf *cbuf= in[0]->data;
 		CompBuf *uvbuf= in[1]->data;
 		CompBuf *stackbuf;
@@ -155,9 +155,9 @@ static void node_composit_exec_mapuv(void *UNUSED(data), bNode *node, bNodeStack
 		
 		out[0]->data= stackbuf;
 		
-		if(cbuf!=in[0]->data)
+		if (cbuf!=in[0]->data)
 			free_compbuf(cbuf);
-		if(uvbuf!=in[1]->data)
+		if (uvbuf!=in[1]->data)
 			free_compbuf(uvbuf);
 	}
 }
diff --git a/source/blender/nodes/composite/nodes/node_composite_mapValue.c b/source/blender/nodes/composite/nodes/node_composite_mapValue.c
index 380aa0b..2fd1152 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mapValue.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mapValue.c
@@ -47,11 +47,11 @@ 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];
-	if(texmap->flag & TEXMAP_CLIP_MIN)
-		if(out[0]<texmap->min[0])
+	if (texmap->flag & TEXMAP_CLIP_MIN)
+		if (out[0]<texmap->min[0])
 			out[0]= texmap->min[0];
-	if(texmap->flag & TEXMAP_CLIP_MAX)
-		if(out[0]>texmap->max[0])
+	if (texmap->flag & TEXMAP_CLIP_MAX)
+		if (out[0]>texmap->max[0])
 			out[0]= texmap->max[0];
 }
 
@@ -59,10 +59,10 @@ static void node_composit_exec_map_value(void *UNUSED(data), bNode *node, bNodeS
 {
 	/* stack order in: valbuf */
 	/* stack order out: valbuf */
-	if(out[0]->hasoutput==0) return;
+	if (out[0]->hasoutput==0) return;
 	
 	/* input no image? then only value operation */
-	if(in[0]->data==NULL) {
+	if (in[0]->data==NULL) {
 		do_map_value(node, out[0]->vec, in[0]->vec);
 	}
 	else {
diff --git a/source/blender/nodes/composite/nodes/node_composite_math.c b/source/blender/nodes/composite/nodes/node_composite_math.c
index 6c2cbb9..8362df1 100644
--- a/source/blender/nodes/composite/nodes/node_composite_math.c
+++ b/source/blender/nodes/composite/nodes/node_composite_math.c
@@ -59,7 +59,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
 		break; 
 	case 3: /* Divide */
 		{
-			if(in2[0]==0)	/* We don't want to divide by zero. */
+			if (in2[0]==0)	/* We don't want to divide by zero. */
 				out[0]= 0.0;
 			else
 				out[0]= in[0] / in2[0];
@@ -77,7 +77,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
 	case 7: /* Arc-Sine */
 		{
 			/* Can't do the impossible... */
-			if(in[0] <= 1 && in[0] >= -1 )
+			if (in[0] <= 1 && in[0] >= -1 )
 				out[0]= asin(in[0]);
 			else
 				out[0]= 0.0;
@@ -86,7 +86,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
 	case 8: /* Arc-Cosine */
 		{
 			/* Can't do the impossible... */
-			if( in[0] <= 1 && in[0] >= -1 )
+			if ( in[0] <= 1 && in[0] >= -1 )
 				out[0]= acos(in[0]);
 			else
 				out[0]= 0.0;
@@ -98,14 +98,16 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
 	case 10: /* Power */
 		{
 			/* Only raise negative numbers by full integers */
-			if( in[0] >= 0 ) {
+			if ( in[0] >= 0 ) {
 				out[0]= pow(in[0], in2[0]);
-			} else {
+			}
+			else {
 				float y_mod_1 = fmod(in2[0], 1);
 				/* 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));
-				} else {
+				}
+				else {
 					out[0] = 0.0f;
 				}
 			}
@@ -114,7 +116,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
 	case 11: /* Logarithm */
 		{
 			/* Don't want any imaginary numbers... */
-			if( in[0] > 0  && in2[0] > 0 )
+			if ( in[0] > 0  && in2[0] > 0 )
 				out[0]= log(in[0]) / log(in2[0]);
 			else
 				out[0]= 0.0;
@@ -122,7 +124,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
 		break;
 	case 12: /* Minimum */
 		{
-			if( in[0] < in2[0] )
+			if ( in[0] < in2[0] )
 				out[0]= in[0];
 			else
 				out[0]= in2[0];
@@ -130,7 +132,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
 		break;
 	case 13: /* Maximum */
 		{
-			if( in[0] > in2[0] )
+			if ( in[0] > in2[0] )
 				out[0]= in[0];
 			else
 				out[0]= in2[0];
@@ -139,7 +141,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
 	case 14: /* Round */
 		{
 			/* round by the second value */
-			if( in2[0] != 0.0f )
+			if ( in2[0] != 0.0f )
 				out[0]= floorf(in[0] / in2[0] + 0.5f) * in2[0];
 			else
 				out[0]= floorf(in[0] + 0.5f);
@@ -147,7 +149,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
 		break;
 	case 15: /* Less Than */
 		{
-			if( in[0] < in2[0] )
+			if ( in[0] < in2[0] )
 				out[0]= 1.0f;
 			else
 				out[0]= 0.0f;
@@ -155,7 +157,7 @@ static void do_math(bNode *node, float *out, float *in, float *in2)
 		break;
 	case 16: /* Greater Than */
 		{
-			if( in[0] > in2[0] )
+			if ( in[0] > in2[0] )
 				out[0]= 1.0f;
 			else
 				out[0]= 0.0f;
@@ -171,21 +173,21 @@ static void node_composit_exec_math(void *UNUSED(data), bNode *node, bNodeStack
 	CompBuf *stackbuf; 
 
 	/* check for inputs and outputs for early out*/
-	if(out[0]->hasoutput==0) return;
+	if (out[0]->hasoutput==0) return;
 
 	/* no image-color operation */
-	if(in[0]->data==NULL && in[1]->data==NULL) {
+	if (in[0]->data==NULL && in[1]->data==NULL) {
 		do_math(node, out[0]->vec, in[0]->vec, in[1]->vec);
 		return;
 	}
 
 	/*create output based on first input */
-	if(cbuf) {
+	if (cbuf) {
 		stackbuf=alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1);
 	}
 	/* and if it doesn't exist use the second input since we 
 	 know that one of them must exist at this point*/
-	else  {
+	else {
 		stackbuf=alloc_compbuf(cbuf2->x, cbuf2->y, CB_VAL, 1);
 	}
 
diff --git a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
index 0296fa4..6539e81 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
@@ -48,7 +48,7 @@ static void do_mix_rgb(bNode *node, float *out, float *in1, float *in2, float *f
 	float col[3];
 	
 	copy_v3_v3(col, in1);
-	if(node->custom2)
+	if (node->custom2)
 		ramp_blend(node->custom1, col, in2[3]*fac[0], in2);
 	else
 		ramp_blend(node->custom1, col, fac[0], in2);
@@ -62,10 +62,10 @@ static void node_composit_exec_mix_rgb(void *data, bNode *node, bNodeStack **in,
 	/* stack order out: Image */
 	float *fac= in[0]->vec;
 	
-	if(out[0]->hasoutput==0) return;
+	if (out[0]->hasoutput==0) return;
 	
 	/* input no image? then only color operation */
-	if(in[1]->data==NULL && in[2]->data==NULL) {
+	if (in[1]->data==NULL && in[2]->data==NULL) {
 		do_mix_rgb(node, out[0]->vec, in[1]->vec, in[2]->vec, fac);
 	}
 	else {
diff --git a/source/blender/nodes/composite/nodes/node_composite_movieclip.c b/source/blender/nodes/composite/nodes/node_composite_movieclip.c
index 1f449f8..dd2c169 100644
--- a/source/blender/nodes/composite/nodes/node_composite_movieclip.c
+++ b/source/blender/nodes/composite/nodes/node_composite_movieclip.c
@@ -44,27 +44,30 @@ static bNodeSocketTemplate cmp_node_movieclip_out[]= {
 
 static CompBuf *node_composit_get_movieclip(RenderData *rd, MovieClip *clip, MovieClipUser *user)
 {
-	ImBuf *ibuf;
+	ImBuf *orig_ibuf, *ibuf;
 	CompBuf *stackbuf;
 	int type;
 
 	float *rect;
 	int alloc= FALSE;
 
-	ibuf= BKE_movieclip_get_ibuf(clip, user);
+	orig_ibuf= BKE_movieclip_get_ibuf(clip, user);
 
-	if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) {
-		IMB_freeImBuf(ibuf);
+	if (orig_ibuf==NULL || (orig_ibuf->rect==NULL && orig_ibuf->rect_float==NULL)) {
+		IMB_freeImBuf(orig_ibuf);
 		return NULL;
 	}
 
+	ibuf= IMB_dupImBuf(orig_ibuf);
+	IMB_freeImBuf(orig_ibuf);
+
 	if (ibuf->rect_float == NULL || ibuf->userflags&IB_RECT_INVALID) {
 		IMB_float_from_rect(ibuf);
 		ibuf->userflags&= ~IB_RECT_INVALID;
 	}
 
 	/* now we need a float buffer from the image with matching color management */
-	if(ibuf->channels == 4) {
+	if (ibuf->channels == 4) {
 		rect= node_composit_get_float_buffer(rd, ibuf, &alloc);
 	}
 	else {
@@ -73,16 +76,16 @@ static CompBuf *node_composit_get_movieclip(RenderData *rd, MovieClip *clip, Mov
 	}
 	/* done coercing into the correct color management */
 
-	if(!alloc) {
+	if (!alloc) {
 		rect= MEM_dupallocN(rect);
 		alloc= 1;
 	}
 
 	type= ibuf->channels;
 
-	if(rd->scemode & R_COMP_CROP) {
+	if (rd->scemode & R_COMP_CROP) {
 		stackbuf= get_cropped_compbuf(&rd->disprect, rect, ibuf->x, ibuf->y, type);
-		if(alloc)
+		if (alloc)
 			MEM_freeN(rect);
 	}
 	else {
@@ -99,7 +102,7 @@ static CompBuf *node_composit_get_movieclip(RenderData *rd, MovieClip *clip, Mov
 
 static void node_composit_exec_movieclip(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
 {
-	if(node->id) {
+	if (node->id) {
 		RenderData *rd= data;
 		MovieClip *clip= (MovieClip *)node->id;
 		MovieClipUser *user= (MovieClipUser *)node->storage;
@@ -115,7 +118,7 @@ static void node_composit_exec_movieclip(void *data, bNode *node, bNodeStack **U
 			/* put image on stack */
 			out[0]->data= stackbuf;
 
-			if(stab->flag&TRACKING_2D_STABILIZATION) {
+			if (stab->flag&TRACKING_2D_STABILIZATION) {
 				float loc[2], scale, angle;
 
 				BKE_tracking_stabilization_data(&clip->tracking, rd->cfra, stackbuf->x, stackbuf->y,
diff --git a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
index bc3f648..d9f0da9 100644
--- a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
+++ b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
@@ -30,6 +30,8 @@
  *  \ingroup cmpnodes
  */
 
+#include "BLF_translation.h"
+
 
 #include "node_composite_util.h"
 
@@ -47,8 +49,8 @@ static bNodeSocketTemplate cmp_node_moviedistortion_out[]= {
 
 static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
 {
-	if(in[0]->data) {
-		if(node->id) {
+	if (in[0]->data) {
+		if (node->id) {
 			MovieClip *clip= (MovieClip *)node->id;
 			CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
 			CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 0);
@@ -56,7 +58,7 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
 
 			ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
 
-			if(ibuf) {
+			if (ibuf) {
 				RenderData *rd= data;
 				ImBuf *obuf;
 				MovieTracking *tracking= &clip->tracking;
@@ -70,10 +72,10 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
 
 				BKE_movieclip_get_size(clip, &user, &width, &height);
 
-				if(!node->storage)
+				if (!node->storage)
 					node->storage= BKE_tracking_distortion_create();
 
-				if(node->custom1==0)
+				if (node->custom1==0)
 					obuf= BKE_tracking_distortion_exec(node->storage, tracking, ibuf, width, height, overscan, 1);
 				else
 					obuf= BKE_tracking_distortion_exec(node->storage, tracking, ibuf, width, height, overscan, 0);
@@ -91,9 +93,10 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
 			/* pass on output and free */
 			out[0]->data= stackbuf;
 
-			if(cbuf!=in[0]->data)
+			if (cbuf!=in[0]->data)
 				free_compbuf(cbuf);
-		} else {
+		}
+		else {
 			CompBuf *cbuf= in[0]->data;
 			CompBuf *stackbuf= pass_on_compbuf(cbuf);
 
@@ -104,15 +107,15 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
 
 static const char *label(bNode *node)
 {
-	if(node->custom1==0)
-		return "Undistortion";
+	if (node->custom1==0)
+		return IFACE_("Undistortion");
 	else
-		return "Distortion";
+		return IFACE_("Distortion");
 }
 
 static void storage_free(bNode *node)
 {
-	if(node->storage)
+	if (node->storage)
 		BKE_tracking_distortion_destroy(node->storage);
 
 	node->storage= NULL;
@@ -120,7 +123,7 @@ static void storage_free(bNode *node)
 
 static void storage_copy(bNode *orig_node, bNode *new_node)
 {
-	if(orig_node->storage)
+	if (orig_node->storage)
 		new_node->storage= BKE_tracking_distortion_copy(orig_node->storage);
 }
 
diff --git a/source/blender/nodes/composite/nodes/node_composite_normal.c b/source/blender/nodes/composite/nodes/node_composite_normal.c
index fbbd589..e9b5f10 100644
--- a/source/blender/nodes/composite/nodes/node_composite_normal.c
+++ b/source/blender/nodes/composite/nodes/node_composite_normal.c
@@ -51,7 +51,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]= -INPR(nor, in);
+	out[0]= -dot_v3v3(nor, in);
 }
 
 /* generates normal, does dot product */
@@ -63,12 +63,12 @@ static void node_composit_exec_normal(void *UNUSED(data), bNode *node, bNodeStac
 	/* stack order output: normal, value */
 	
 	/* input no image? then only vector op */
-	if(in[0]->data==NULL) {
+	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);
 	}
-	else if(out[1]->hasoutput) {
+	else if (out[1]->hasoutput) {
 		/* make output size of input image */
 		CompBuf *cbuf= in[0]->data;
 		CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1); /* allocs */
diff --git a/source/blender/nodes/composite/nodes/node_composite_normalize.c b/source/blender/nodes/composite/nodes/node_composite_normalize.c
index 455966e..69386c3 100644
--- a/source/blender/nodes/composite/nodes/node_composite_normalize.c
+++ b/source/blender/nodes/composite/nodes/node_composite_normalize.c
@@ -65,10 +65,10 @@ static void node_composit_exec_normalize(void *UNUSED(data), bNode *node, bNodeS
 {
 	/* stack order in: valbuf */
 	/* stack order out: valbuf */
-	if(out[0]->hasoutput==0) return;
+	if (out[0]->hasoutput==0) return;
 
 	/* Input has no image buffer? Then pass the value */
-	if(in[0]->data==NULL) {
+	if (in[0]->data==NULL) {
 		copy_v4_v4(out[0]->vec, in[0]->vec);
 	}
 	else {
@@ -93,7 +93,8 @@ static void node_composit_exec_normalize(void *UNUSED(data), bNode *node, bNodeS
 		if ((max-min) != 0.0f) {
 			mult = 1.0f/(max-min);
 			composit3_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, NULL, &min, NULL, &mult, do_normalize, CB_VAL, CB_VAL, CB_VAL);
-		} else {
+		}
+		else {
 			memcpy(stackbuf->rect, cbuf->rect, sizeof(float) * cbuf->x * cbuf->y);
 		}
 
diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.c b/source/blender/nodes/composite/nodes/node_composite_outputFile.c
index 50a196d..2eb68c7 100644
--- a/source/blender/nodes/composite/nodes/node_composite_outputFile.c
+++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.c
@@ -30,95 +30,309 @@
  */
 
 
+#include <string.h>
+#include "BLI_path_util.h"
+
+#include "BKE_utildefines.h"
+
 #include "node_composite_util.h"
 
+#include "IMB_imbuf.h"
+#include "IMB_imbuf_types.h"
+
+#include "intern/openexr/openexr_multi.h"
+
+
 /* **************** OUTPUT FILE ******************** */
-static bNodeSocketTemplate cmp_node_output_file_in[]= {
-	{	SOCK_RGBA, 1, "Image",		0.0f, 0.0f, 0.0f, 1.0f},
-	{	SOCK_FLOAT, 1, "Z",		0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_NONE},
-	{	-1, 0, ""	}
-};
 
-static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out))
+bNodeSocket *ntreeCompositOutputFileAddSocket(bNodeTree *ntree, bNode *node, const char *name, ImageFormatData *im_format)
+{
+	NodeImageMultiFile *nimf = node->storage;
+	bNodeSocket *sock = nodeAddSocket(ntree, node, SOCK_IN, name, SOCK_RGBA);
+	
+	/* create format data for the input socket */
+	NodeImageMultiFileSocket *sockdata = MEM_callocN(sizeof(NodeImageMultiFileSocket), "socket image format");
+	sock->storage = sockdata;
+	sock->struct_type = SOCK_STRUCT_OUTPUT_FILE;
+	
+	if (im_format) {
+		sockdata->format= *im_format;
+		if (BKE_imtype_is_movie(sockdata->format.imtype)) {
+			sockdata->format.imtype= R_IMF_IMTYPE_OPENEXR;
+		}
+	}
+	/* use node data format by default */
+	sockdata->use_node_format = 1;
+	
+	nimf->active_input = BLI_findindex(&node->inputs, sock);
+	
+	return sock;
+}
+
+int ntreeCompositOutputFileRemoveActiveSocket(bNodeTree *ntree, bNode *node)
+{
+	NodeImageMultiFile *nimf = node->storage;
+	bNodeSocket *sock = BLI_findlink(&node->inputs, nimf->active_input);
+	int totinputs = BLI_countlist(&node->inputs);
+	
+	if (!sock)
+		return 0;
+	
+	if (nimf->active_input == totinputs-1)
+		--nimf->active_input;
+	
+	/* free format data */
+	MEM_freeN(sock->storage);
+	
+	nodeRemoveSocket(ntree, node, sock);
+	return 1;
+}
+
+static void init_output_file(bNodeTree *ntree, bNode* node, bNodeTemplate *ntemp)
+{
+	NodeImageMultiFile *nimf= MEM_callocN(sizeof(NodeImageMultiFile), "node image multi file");
+	ImageFormatData *format = NULL;
+	node->storage= nimf;
+
+	if (ntemp->scene) {
+		RenderData *rd = &ntemp->scene->r;
+		BLI_strncpy(nimf->base_path, rd->pic, sizeof(nimf->base_path));
+		nimf->format = rd->im_format;
+		
+		format = &rd->im_format;
+	}
+	
+	/* add one socket by default */
+	ntreeCompositOutputFileAddSocket(ntree, node, "Image", format);
+}
+
+static void free_output_file(bNode *node)
+{
+	bNodeSocket *sock;
+	
+	/* free storage data in sockets */
+	for (sock=node->inputs.first; sock; sock=sock->next) {
+		MEM_freeN(sock->storage);
+	}
+	
+	MEM_freeN(node->storage);
+}
+
+static void copy_output_file(struct bNode *node, struct bNode *target)
+{
+	bNodeSocket *sock, *newsock;
+	
+	target->storage = MEM_dupallocN(node->storage);
+	
+	/* duplicate storage data in sockets */
+	for (sock=node->inputs.first, newsock=target->inputs.first; sock && newsock; sock=sock->next, newsock=newsock->next) {
+		newsock->storage = MEM_dupallocN(sock->storage);
+	}
+}
+
+static void update_output_file(bNodeTree *UNUSED(ntree), bNode *node)
 {
-	/* image assigned to output */
-	/* stack order input sockets: col, alpha */
-	
-	if(in[0]->data) {
-		RenderData *rd= data;
-		NodeImageFile *nif= node->storage;
-		if(nif->sfra!=nif->efra && (rd->cfra<nif->sfra || rd->cfra>nif->efra)) {
-			return;	/* BAIL OUT RETURN */
+	bNodeSocket *sock;
+	
+	/* automatically update the socket type based on linked input */
+	for (sock=node->inputs.first; sock; sock=sock->next) {
+		if (sock->link) {
+			int linktype = sock->link->fromsock->type;
+			if (linktype != sock->type)
+				nodeSocketSetType(sock, linktype);
 		}
-		else if (!G.rendering) {
-			/* only output files when rendering a sequence -
-			 * otherwise, it overwrites the output files just 
-			 * scrubbing through the timeline when the compositor updates */
-			return;
-		} else {
-			Main *bmain= G.main; /* TODO, have this passed along */
-			CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
-			ImBuf *ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
-			char string[256];
+	}
+}
+
+/* write input data into individual files */
+static void exec_output_file_singlelayer(RenderData *rd, bNode *node, bNodeStack **in)
+{
+	Main *bmain= G.main; /* TODO, have this passed along */
+	NodeImageMultiFile *nimf= node->storage;
+	bNodeSocket *sock;
+	int i;
+	int has_preview = 0;
+	
+	for (sock=node->inputs.first, i=0; sock; sock=sock->next, ++i) {
+		if (in[i]->data) {
+			NodeImageMultiFileSocket *sockdata = sock->storage;
+			ImageFormatData *format = (sockdata->use_node_format ? &nimf->format : &sockdata->format);
+			char path[FILE_MAX];
+			char filename[FILE_MAX];
+			CompBuf *cbuf;
+			ImBuf *ibuf;
 			
-			ibuf->rect_float= cbuf->rect;
-			ibuf->dither= rd->dither_intensity;
+			switch (format->planes) {
+			case R_IMF_PLANES_BW:
+				cbuf = typecheck_compbuf(in[i]->data, CB_VAL);
+				break;
+			case R_IMF_PLANES_RGB:
+				cbuf = typecheck_compbuf(in[i]->data, CB_VEC3);
+				break;
+			case R_IMF_PLANES_RGBA:
+				cbuf = typecheck_compbuf(in[i]->data, CB_RGBA);
+				break;
+			}
+			
+			ibuf = IMB_allocImBuf(cbuf->x, cbuf->y, format->planes, 0);
+			/* XXX have to set this explicitly it seems */
+			switch (format->planes) {
+			case R_IMF_PLANES_BW:	ibuf->channels = 1;	break;
+			case R_IMF_PLANES_RGB:	ibuf->channels = 3;	break;
+			case R_IMF_PLANES_RGBA:	ibuf->channels = 4;	break;
+			}
+			ibuf->rect_float = cbuf->rect;
+			ibuf->dither = rd->dither_intensity;
 			
 			if (rd->color_mgt_flag & R_COLOR_MANAGEMENT)
 				ibuf->profile = IB_PROFILE_LINEAR_RGB;
 			
-			if(in[1]->data) {
-				CompBuf *zbuf= in[1]->data;
-				if(zbuf->type==CB_VAL && zbuf->x==cbuf->x && zbuf->y==cbuf->y) {
-					nif->im_format.flag |= R_IMF_FLAG_ZBUF;
-					ibuf->zbuf_float= zbuf->rect;
-				}
-			}
-			
-			BKE_makepicstring(string, nif->name, bmain->name, rd->cfra, nif->im_format.imtype, (rd->scemode & R_EXTENSION), TRUE);
+			/* get full path */
+			BLI_join_dirfile(path, FILE_MAX, nimf->base_path, sock->name);
+			BKE_makepicstring(filename, path, bmain->name, rd->cfra, format->imtype, (rd->scemode & R_EXTENSION), TRUE);
 			
-			if(0 == BKE_write_ibuf(ibuf, string, &nif->im_format))
-				printf("Cannot save Node File Output to %s\n", string);
+			if (0 == BKE_write_ibuf(ibuf, filename, format))
+				printf("Cannot save Node File Output to %s\n", filename);
 			else
-				printf("Saved: %s\n", string);
+				printf("Saved: %s\n", filename);
 			
-			IMB_freeImBuf(ibuf);	
+			IMB_freeImBuf(ibuf);
 			
-			generate_preview(data, node, cbuf);
+			/* simply pick the first valid input for preview */
+			if (!has_preview) {
+				generate_preview(rd, node, cbuf);
+				has_preview = 1;
+			}
 			
-			if(in[0]->data != cbuf) 
+			if (in[i]->data != cbuf) 
 				free_compbuf(cbuf);
 		}
 	}
 }
 
-static void node_composit_init_output_file(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+/* write input data into layers */
+static void exec_output_file_multilayer(RenderData *rd, bNode *node, bNodeStack **in)
 {
-	Scene *scene= (Scene *)node->id;
-	NodeImageFile *nif= MEM_callocN(sizeof(NodeImageFile), "node image file");
-	node->storage= nif;
-
-	if(scene) {
-		BLI_strncpy(nif->name, scene->r.pic, sizeof(nif->name));
-		nif->im_format= scene->r.im_format;
-		if (BKE_imtype_is_movie(nif->im_format.imtype)) {
-			nif->im_format.imtype= R_IMF_IMTYPE_OPENEXR;
+	Main *bmain= G.main; /* TODO, have this passed along */
+	NodeImageMultiFile *nimf= node->storage;
+	void *exrhandle= IMB_exr_get_handle();
+	char filename[FILE_MAX];
+	bNodeSocket *sock;
+	int i;
+	/* Must have consistent pixel size for exr file, simply take the first valid input size. */
+	int rectx = -1;
+	int recty = -1;
+	int has_preview = 0;
+	
+	BKE_makepicstring(filename, nimf->base_path, bmain->name, rd->cfra, R_IMF_IMTYPE_MULTILAYER, (rd->scemode & R_EXTENSION), TRUE);
+	BLI_make_existing_file(filename);
+	
+	for (sock=node->inputs.first, i=0; sock; sock=sock->next, ++i) {
+		if (in[i]->data) {
+			CompBuf *cbuf = in[i]->data;
+			char layname[EXR_LAY_MAXNAME];
+			char channelname[EXR_PASS_MAXNAME];
+			char *channelname_ext;
+			
+			if (cbuf->rect_procedural) {
+				printf("Error writing multilayer EXR: Procedural buffer not supported\n");
+				continue;
+			}
+			if (rectx < 0) {
+				rectx = cbuf->x;
+				recty = cbuf->y;
+			}
+			else if (cbuf->x != rectx || cbuf->y != recty) {
+				printf("Error: Multilayer EXR output node %s expects same resolution for all input buffers. Layer %s skipped.\n", node->name, sock->name);
+				continue;
+			}
+			
+			BLI_strncpy(layname, sock->name, sizeof(layname));
+			BLI_strncpy(channelname, sock->name, sizeof(channelname)-2);
+			channelname_ext = channelname + strlen(channelname);
+			
+			/* create channels */
+			switch (cbuf->type) {
+			case CB_VAL:
+				strcpy(channelname_ext, ".V");
+				IMB_exr_add_channel(exrhandle, layname, channelname, 1, rectx, cbuf->rect);
+				break;
+			case CB_VEC2:
+				strcpy(channelname_ext, ".X");
+				IMB_exr_add_channel(exrhandle, layname, channelname, 2, 2*rectx, cbuf->rect);
+				strcpy(channelname_ext, ".Y");
+				IMB_exr_add_channel(exrhandle, layname, channelname, 2, 2*rectx, cbuf->rect+1);
+				break;
+			case CB_VEC3:
+				strcpy(channelname_ext, ".X");
+				IMB_exr_add_channel(exrhandle, layname, channelname, 3, 3*rectx, cbuf->rect);
+				strcpy(channelname_ext, ".Y");
+				IMB_exr_add_channel(exrhandle, layname, channelname, 3, 3*rectx, cbuf->rect+1);
+				strcpy(channelname_ext, ".Z");
+				IMB_exr_add_channel(exrhandle, layname, channelname, 3, 3*rectx, cbuf->rect+2);
+				break;
+			case CB_RGBA:
+				strcpy(channelname_ext, ".R");
+				IMB_exr_add_channel(exrhandle, layname, channelname, 4, 4*rectx, cbuf->rect);
+				strcpy(channelname_ext, ".G");
+				IMB_exr_add_channel(exrhandle, layname, channelname, 4, 4*rectx, cbuf->rect+1);
+				strcpy(channelname_ext, ".B");
+				IMB_exr_add_channel(exrhandle, layname, channelname, 4, 4*rectx, cbuf->rect+2);
+				strcpy(channelname_ext, ".A");
+				IMB_exr_add_channel(exrhandle, layname, channelname, 4, 4*rectx, cbuf->rect+3);
+				break;
+			}
+			
+			/* simply pick the first valid input for preview */
+			if (!has_preview) {
+				generate_preview(rd, node, cbuf);
+				has_preview = 1;
+			}
 		}
-		nif->sfra= scene->r.sfra;
-		nif->efra= scene->r.efra;
 	}
+	
+	/* when the filename has no permissions, this can fail */
+	if (IMB_exr_begin_write(exrhandle, filename, rectx, recty, nimf->format.exr_codec)) {
+		IMB_exr_write_channels(exrhandle);
+	}
+	else {
+		/* TODO, get the error from openexr's exception */
+		/* XXX nice way to do report? */
+		printf("Error Writing Render Result, see console\n");
+	}
+	
+	IMB_exr_close(exrhandle);
+}
+
+static void exec_output_file(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out))
+{
+	RenderData *rd= data;
+	NodeImageMultiFile *nimf= node->storage;
+	
+	if (!G.rendering) {
+		/* only output files when rendering a sequence -
+		 * otherwise, it overwrites the output files just 
+		 * scrubbing through the timeline when the compositor updates */
+		return;
+	}
+	
+	if (nimf->format.imtype==R_IMF_IMTYPE_MULTILAYER)
+		exec_output_file_multilayer(rd, node, in);
+	else
+		exec_output_file_singlelayer(rd, node, in);
 }
 
 void register_node_type_cmp_output_file(bNodeTreeType *ttype)
 {
 	static bNodeType ntype;
 
-	node_type_base(ttype, &ntype, CMP_NODE_OUTPUT_FILE, "File Output", NODE_CLASS_OUTPUT, NODE_PREVIEW|NODE_OPTIONS);
-	node_type_socket_templates(&ntype, cmp_node_output_file_in, NULL);
+	node_type_base(ttype, &ntype, CMP_NODE_OUTPUT_FILE, "File Output", NODE_CLASS_OUTPUT, NODE_OPTIONS|NODE_PREVIEW);
+	node_type_socket_templates(&ntype, NULL, NULL);
 	node_type_size(&ntype, 140, 80, 300);
-	node_type_init(&ntype, node_composit_init_output_file);
-	node_type_storage(&ntype, "NodeImageFile", node_free_standard_storage, node_copy_standard_storage);
-	node_type_exec(&ntype, node_composit_exec_output_file);
+	node_type_init(&ntype, init_output_file);
+	node_type_storage(&ntype, "NodeImageMultiFile", free_output_file, copy_output_file);
+	node_type_update(&ntype, update_output_file, NULL);
+	node_type_exec(&ntype, exec_output_file);
 
 	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 bf934fc..3d8b010 100644
--- a/source/blender/nodes/composite/nodes/node_composite_premulkey.c
+++ b/source/blender/nodes/composite/nodes/node_composite_premulkey.c
@@ -46,17 +46,17 @@ static bNodeSocketTemplate cmp_node_premulkey_out[]= {
 
 static void node_composit_exec_premulkey(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
 {
-	if(out[0]->hasoutput==0)
+	if (out[0]->hasoutput==0)
 		return;
 	
-	if(in[0]->data) {
+	if (in[0]->data) {
 		CompBuf *stackbuf, *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
 
 		stackbuf= dupalloc_compbuf(cbuf);
 		premul_compbuf(stackbuf, node->custom1 == 1);
 
 		out[0]->data = stackbuf;
-		if(cbuf != in[0]->data)
+		if (cbuf != in[0]->data)
 			free_compbuf(cbuf);
 	}
 }
diff --git a/source/blender/nodes/composite/nodes/node_composite_rotate.c b/source/blender/nodes/composite/nodes/node_composite_rotate.c
index 826653c..6952817 100644
--- a/source/blender/nodes/composite/nodes/node_composite_rotate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_rotate.c
@@ -48,10 +48,10 @@ static bNodeSocketTemplate cmp_node_rotate_out[]= {
 static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
 {
 
-	if(out[0]->hasoutput==0)
+	if (out[0]->hasoutput==0)
 		return;
 
-	if(in[0]->data) {
+	if (in[0]->data) {
 		CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
 		CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1);	/* note, this returns zero'd image */
 		float rad, u, v, s, c, centx, centy, miny, maxy, minx, maxx;
@@ -75,14 +75,14 @@ static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStac
 		ibuf=IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
 		obuf=IMB_allocImBuf(stackbuf->x, stackbuf->y, 32, 0);
 
-		if(ibuf && obuf){
+		if (ibuf && obuf) {
 			ibuf->rect_float=cbuf->rect;
 			obuf->rect_float=stackbuf->rect;
 
-			for(y=miny; y<maxy; y++) {
+			for (y=miny; y<maxy; y++) {
 				yo= y+(int)centy;
 
-				for(x=minx; x<maxx;x++) {
+				for (x=minx; x<maxx;x++) {
 					u=c*x + y*s + centx;
 					v=-s*x + c*y + centy;
 					xo= x+(int)centx;
@@ -90,7 +90,7 @@ static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStac
 					switch(node->custom1) {
 					case 0:
 						neareast_interpolation(ibuf, obuf, u, v, xo, yo);
-						break ;
+						break;
 					case 1:
 						bilinear_interpolation(ibuf, obuf, u, v, xo, yo);
 						break;
@@ -115,7 +115,7 @@ static void node_composit_exec_rotate(void *UNUSED(data), bNode *node, bNodeStac
 
 		/* pass on output and free */
 		out[0]->data= stackbuf;
-		if(cbuf!=in[0]->data) {
+		if (cbuf!=in[0]->data) {
 			free_compbuf(cbuf);
 		}
 	}
diff --git a/source/blender/nodes/composite/nodes/node_composite_scale.c b/source/blender/nodes/composite/nodes/node_composite_scale.c
index 188449d..38cce50 100644
--- a/source/blender/nodes/composite/nodes/node_composite_scale.c
+++ b/source/blender/nodes/composite/nodes/node_composite_scale.c
@@ -49,27 +49,28 @@ static bNodeSocketTemplate cmp_node_scale_out[]= {
 /* node->custom1 stores if input values are absolute or relative scale */
 static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
 {
-	if(out[0]->hasoutput==0)
+	if (out[0]->hasoutput==0)
 		return;
 	
-	if(in[0]->data) {
+	if (in[0]->data) {
 		RenderData *rd= data;
 		CompBuf *stackbuf, *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
 		ImBuf *ibuf;
 		int newx, newy;
 		
-		if(node->custom1==CMP_SCALE_RELATIVE) {
+		if (node->custom1==CMP_SCALE_RELATIVE) {
 			newx= MAX2((int)(in[1]->vec[0]*cbuf->x), 1);
 			newy= MAX2((int)(in[2]->vec[0]*cbuf->y), 1);
 		}
-		else if(node->custom1==CMP_SCALE_SCENEPERCENT) {
+		else if (node->custom1==CMP_SCALE_SCENEPERCENT) {
 			newx = cbuf->x * (rd->size / 100.0f);
 			newy = cbuf->y * (rd->size / 100.0f);
 		}
 		else if (node->custom1==CMP_SCALE_RENDERPERCENT) {
 			newx= (rd->xsch * rd->size)/100;
 			newy= (rd->ysch * rd->size)/100;
-		} else {	/* CMP_SCALE_ABSOLUTE */
+		}
+		else {	/* CMP_SCALE_ABSOLUTE */
 			newx= MAX2((int)in[1]->vec[0], 1);
 			newy= MAX2((int)in[2]->vec[0], 1);
 		}
@@ -77,11 +78,11 @@ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, b
 		newy= MIN2(newy, CMP_SCALE_MAX);
 
 		ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
-		if(ibuf) {
+		if (ibuf) {
 			ibuf->rect_float= cbuf->rect;
 			IMB_scaleImBuf(ibuf, newx, newy);
 			
-			if(ibuf->rect_float == cbuf->rect) {
+			if (ibuf->rect_float == cbuf->rect) {
 				/* no scaling happened. */
 				stackbuf= pass_on_compbuf(in[0]->data);
 			}
@@ -105,7 +106,7 @@ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, b
 		}
 		
 		out[0]->data= stackbuf;
-		if(cbuf!=in[0]->data)
+		if (cbuf!=in[0]->data)
 			free_compbuf(cbuf);
 	}
 	else if (node->custom1==CMP_SCALE_ABSOLUTE) {
@@ -120,7 +121,7 @@ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, b
 		fp = stackbuf->rect;
 
 		a = stackbuf->x * stackbuf->y;
-		while(a--) {
+		while (a--) {
 			copy_v4_v4(fp, in[0]->vec);
 			fp += 4;
 		}
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
index d742a91..6dac2d1 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
@@ -64,7 +64,7 @@ static void node_composit_exec_sephsva(void *UNUSED(data), bNode *node, bNodeSta
 	/* stack order in: col */
 
 	/* input no image? then only color operation */
-	if(in[0]->data==NULL) {
+	if (in[0]->data==NULL) {
 		float h, s, v;
 	
 	rgb_to_hsv(in[0]->vec[0], in[0]->vec[1], in[0]->vec[2], &h, &s, &v);
@@ -83,17 +83,17 @@ static void node_composit_exec_sephsva(void *UNUSED(data), bNode *node, bNodeSta
 		composit1_pixel_processor(node, cbuf2, cbuf2, in[0]->vec, do_sephsva, CB_RGBA);
 
 		/* separate each of those channels */
-		if(out[0]->hasoutput)
+		if (out[0]->hasoutput)
 			out[0]->data= valbuf_from_rgbabuf(cbuf2, CHAN_R);
-		if(out[1]->hasoutput)
+		if (out[1]->hasoutput)
 			out[1]->data= valbuf_from_rgbabuf(cbuf2, CHAN_G);
-		if(out[2]->hasoutput)
+		if (out[2]->hasoutput)
 			out[2]->data= valbuf_from_rgbabuf(cbuf2, CHAN_B);
-		if(out[3]->hasoutput)
+		if (out[3]->hasoutput)
 			out[3]->data= valbuf_from_rgbabuf(cbuf2, CHAN_A);
 
 		/*not used anymore */
-		if(cbuf2!=cbuf)
+		if (cbuf2!=cbuf)
 			free_compbuf(cbuf2);
 		free_compbuf(cbuf);	
 	}
@@ -141,11 +141,10 @@ static void node_composit_exec_combhsva(void *UNUSED(data), bNode *node, bNodeSt
 	/* stack order out: 1 rgba channels */
 	/* stack order in: 4 value channels */
 
-	/* input no image? then only color operation */
-	if((in[0]->data==NULL) && (in[1]->data==NULL) && (in[2]->data==NULL) && (in[3]->data==NULL)) {
-		out[0]->vec[0] = in[0]->vec[0];
-		out[0]->vec[1] = in[1]->vec[0];
-		out[0]->vec[2] = in[2]->vec[0];
+	/* input no image? then only color operation in HSV */
+	if ((in[0]->data==NULL) && (in[1]->data==NULL) && (in[2]->data==NULL) && (in[3]->data==NULL)) {
+		hsv_to_rgb(in[0]->vec[0], in[1]->vec[0], in[2]->vec[0],
+		&out[0]->vec[0], &out[0]->vec[1], &out[0]->vec[2]);
 		out[0]->vec[3] = in[3]->vec[0];
 	}
 	else {
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c
index 1f0b504..be4a8ac 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c
@@ -51,7 +51,7 @@ static void node_composit_exec_seprgba(void *UNUSED(data), bNode *UNUSED(node),
 	/* stack order in: col */
 	
 	/* input no image? then only color operation */
-	if(in[0]->data==NULL) {
+	if (in[0]->data==NULL) {
 		out[0]->vec[0] = in[0]->vec[0];
 		out[1]->vec[0] = in[0]->vec[1];
 		out[2]->vec[0] = in[0]->vec[2];
@@ -62,16 +62,16 @@ static void node_composit_exec_seprgba(void *UNUSED(data), bNode *UNUSED(node),
 		CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
 
 		/* don't do any pixel processing, just copy the stack directly (faster, I presume) */
-		if(out[0]->hasoutput)
+		if (out[0]->hasoutput)
 			out[0]->data= valbuf_from_rgbabuf(cbuf, CHAN_R);
-		if(out[1]->hasoutput)
+		if (out[1]->hasoutput)
 			out[1]->data= valbuf_from_rgbabuf(cbuf, CHAN_G);
-		if(out[2]->hasoutput)
+		if (out[2]->hasoutput)
 			out[2]->data= valbuf_from_rgbabuf(cbuf, CHAN_B);
-		if(out[3]->hasoutput)
+		if (out[3]->hasoutput)
 			out[3]->data= valbuf_from_rgbabuf(cbuf, CHAN_A);
 		
-		if(cbuf!=in[0]->data) 
+		if (cbuf!=in[0]->data) 
 			free_compbuf(cbuf);
 
 	}
@@ -118,7 +118,7 @@ static void node_composit_exec_combrgba(void *UNUSED(data), bNode *node, bNodeSt
 	/* stack order in: 4 value channels */
 	
 	/* input no image? then only color operation */
-	if((in[0]->data==NULL) && (in[1]->data==NULL) && (in[2]->data==NULL) && (in[3]->data==NULL)) {
+	if ((in[0]->data==NULL) && (in[1]->data==NULL) && (in[2]->data==NULL) && (in[3]->data==NULL)) {
 		out[0]->vec[0] = in[0]->vec[0];
 		out[0]->vec[1] = in[1]->vec[0];
 		out[0]->vec[2] = in[2]->vec[0];
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
index a5f827b..b12f08b 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
@@ -88,7 +88,7 @@ static void do_sepycca_jfif(bNode *UNUSED(node), float *out, float *in)
 static void node_composit_exec_sepycca(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
 {
 	/* input no image? then only color operation */
-	if(in[0]->data==NULL) {
+	if (in[0]->data==NULL) {
 		float y, cb, cr;
 	
 		switch(node->custom1)
@@ -132,17 +132,17 @@ static void node_composit_exec_sepycca(void *UNUSED(data), bNode *node, bNodeSta
 		}
 	
 		/* separate each of those channels */
-		if(out[0]->hasoutput)
+		if (out[0]->hasoutput)
 			out[0]->data= valbuf_from_rgbabuf(cbuf2, CHAN_R);
-		if(out[1]->hasoutput)
+		if (out[1]->hasoutput)
 			out[1]->data= valbuf_from_rgbabuf(cbuf2, CHAN_G);
-		if(out[2]->hasoutput)
+		if (out[2]->hasoutput)
 			out[2]->data= valbuf_from_rgbabuf(cbuf2, CHAN_B);
-		if(out[3]->hasoutput)
+		if (out[3]->hasoutput)
 			out[3]->data= valbuf_from_rgbabuf(cbuf2, CHAN_A);
 
 		/*not used anymore */
-		if(cbuf2!=cbuf)
+		if (cbuf2!=cbuf)
 			free_compbuf(cbuf2);
 		free_compbuf(cbuf);
 	}
@@ -235,7 +235,7 @@ static void node_composit_exec_combycca(void *UNUSED(data), bNode *node, bNodeSt
 	/* stack order in: 4 value channels */
 	
 	/* input no image? then only color operation */
-	if((in[0]->data==NULL) && (in[1]->data==NULL) && (in[2]->data==NULL) && (in[3]->data==NULL)) {
+	if ((in[0]->data==NULL) && (in[1]->data==NULL) && (in[2]->data==NULL) && (in[3]->data==NULL)) {
 		float y = in[0]->vec[0] * 255;
 		float cb = in[1]->vec[0] * 255;
 		float cr = in[2]->vec[0] * 255;
diff --git a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
index 2a2f64a..8dd5516 100644
--- a/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
+++ b/source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
@@ -64,7 +64,7 @@ static void node_composit_exec_sepyuva(void *UNUSED(data), bNode *node, bNodeSta
 	/* stack order in: col */
 	
 	/* input no image? then only color operation */
-	if(in[0]->data==NULL) {
+	if (in[0]->data==NULL) {
 		float y, u, v;
 	
 		rgb_to_yuv(in[0]->vec[0], in[0]->vec[1], in[0]->vec[2], &y, &u, &v);
@@ -83,17 +83,17 @@ static void node_composit_exec_sepyuva(void *UNUSED(data), bNode *node, bNodeSta
 		composit1_pixel_processor(node, cbuf2, cbuf2, in[0]->vec, do_sepyuva, CB_RGBA);
 	
 		/* separate each of those channels */
-		if(out[0]->hasoutput)
+		if (out[0]->hasoutput)
 			out[0]->data= valbuf_from_rgbabuf(cbuf2, CHAN_R);
-		if(out[1]->hasoutput)
+		if (out[1]->hasoutput)
 			out[1]->data= valbuf_from_rgbabuf(cbuf2, CHAN_G);
-		if(out[2]->hasoutput)
+		if (out[2]->hasoutput)
 			out[2]->data= valbuf_from_rgbabuf(cbuf2, CHAN_B);
-		if(out[3]->hasoutput)
+		if (out[3]->hasoutput)
 			out[3]->data= valbuf_from_rgbabuf(cbuf2, CHAN_A);
 
 		/*not used anymore */
-		if(cbuf2!=cbuf)
+		if (cbuf2!=cbuf)
 			free_compbuf(cbuf2);
 		free_compbuf(cbuf);
 	}
@@ -143,7 +143,7 @@ static void node_composit_exec_combyuva(void *UNUSED(data), bNode *node, bNodeSt
 	/* stack order in: 4 value channels */
 	
 	/* input no image? then only color operation */
-	if((in[0]->data==NULL) && (in[1]->data==NULL) && (in[2]->data==NULL) && (in[3]->data==NULL)) {
+	if ((in[0]->data==NULL) && (in[1]->data==NULL) && (in[2]->data==NULL) && (in[3]->data==NULL)) {
 		out[0]->vec[0] = in[0]->vec[0];
 		out[0]->vec[1] = in[1]->vec[0];
 		out[0]->vec[2] = in[2]->vec[0];
diff --git a/source/blender/nodes/composite/nodes/node_composite_setalpha.c b/source/blender/nodes/composite/nodes/node_composite_setalpha.c
index 6c24185..646bcc4 100644
--- a/source/blender/nodes/composite/nodes/node_composite_setalpha.c
+++ b/source/blender/nodes/composite/nodes/node_composite_setalpha.c
@@ -49,7 +49,7 @@ static void node_composit_exec_setalpha(void *UNUSED(data), bNode *node, bNodeSt
 	/* stack order in: col, alpha */
 	
 	/* input no image? then only color operation */
-	if(in[0]->data==NULL && in[1]->data==NULL) {
+	if (in[0]->data==NULL && in[1]->data==NULL) {
 		out[0]->vec[0] = in[0]->vec[0];
 		out[0]->vec[1] = in[0]->vec[1];
 		out[0]->vec[2] = in[0]->vec[2];
@@ -60,7 +60,7 @@ static void node_composit_exec_setalpha(void *UNUSED(data), bNode *node, bNodeSt
 		CompBuf *cbuf= in[0]->data?in[0]->data:in[1]->data;
 		CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* allocs */
 		
-		if(in[1]->data==NULL && in[1]->vec[0]==1.0f) {
+		if (in[1]->data==NULL && in[1]->vec[0]==1.0f) {
 			/* pass on image */
 			composit1_pixel_processor(node, stackbuf, in[0]->data, in[0]->vec, do_copy_rgb, CB_RGBA);
 		}
diff --git a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c
index bc8bc7c..c226305 100644
--- a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c
+++ b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c
@@ -41,7 +41,7 @@ static bNodeSocketTemplate cmp_node_splitviewer_in[]= {
 
 static void do_copy_split_rgba(bNode *UNUSED(node), float *out, float *in1, float *in2, float *fac)
 {
-	if(*fac==0.0f) {
+	if (*fac==0.0f) {
 		copy_v4_v4(out, in1);
 	}
 	else {
@@ -54,10 +54,10 @@ static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack *
 	/* image assigned to output */
 	/* stack order input sockets: image image */
 	
-	if(in[0]->data==NULL || in[1]->data==NULL)
+	if (in[0]->data==NULL || in[1]->data==NULL)
 		return;
 	
-	if(node->id && (node->flag & NODE_DO_OUTPUT)) {	/* only one works on out */
+	if (node->id && (node->flag & NODE_DO_OUTPUT)) {	/* only one works on out */
 		Image *ima= (Image *)node->id;
 		RenderData *rd= data;
 		ImBuf *ibuf;
@@ -73,7 +73,7 @@ static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack *
 		
 		/* always returns for viewer image, but we check nevertheless */
 		ibuf= BKE_image_acquire_ibuf(ima, node->storage, &lock);
-		if(ibuf==NULL) {
+		if (ibuf==NULL) {
 			printf("node_composit_exec_viewer error\n");
 			BKE_image_release_ibuf(ima, lock);
 			return;
@@ -100,7 +100,7 @@ static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack *
 		
 		
 		/* Check which offset mode is selected and limit offset if needed */
-		if(node->custom2 == 0) {
+		if (node->custom2 == 0) {
 			offset = buf1->x / 100.0f * node->custom1;
 			CLAMP(offset, 0, buf1->x);
 		}
@@ -109,17 +109,17 @@ static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack *
 			CLAMP(offset, 0, buf1->y);
 		}
 		
-		if(node->custom2 == 0) {
-			for(y=0; y<buf1->y; y++) {
+		if (node->custom2 == 0) {
+			for (y=0; y<buf1->y; y++) {
 				float *fac= mask->rect + y*buf1->x;
-				for(x=offset; x>0; x--, fac++)
+				for (x=offset; x>0; x--, fac++)
 					*fac= 1.0f;
 			}
 		}
 		else {
-			for(y=0; y<offset; y++) {
+			for (y=0; y<offset; y++) {
 				float *fac= mask->rect + y*buf1->x;
-				for(x=buf1->x; x>0; x--, fac++)
+				for (x=buf1->x; x>0; x--, fac++)
 					*fac= 1.0f;
 			}
 		}
@@ -132,9 +132,9 @@ static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack *
 		free_compbuf(cbuf);
 		free_compbuf(mask);
 		
-		if(in[0]->data != buf1) 
+		if (in[0]->data != buf1) 
 			free_compbuf(buf1);
-		if(in[1]->data != buf2) 
+		if (in[1]->data != buf2) 
 			free_compbuf(buf2);
 	}
 }
@@ -159,8 +159,8 @@ void register_node_type_cmp_splitviewer(bNodeTreeType *ttype)
 	node_type_init(&ntype, node_composit_init_splitviewer);
 	node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage);
 	node_type_exec(&ntype, node_composit_exec_splitviewer);
-	/* Do not allow muting this node. */
-	node_type_mute(&ntype, NULL, NULL);
+	/* Do not allow muting for this node. */
+	node_type_internal_connect(&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 f41751b..0eac85c 100644
--- a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
+++ b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
@@ -47,7 +47,7 @@ static bNodeSocketTemplate cmp_node_stabilize2d_out[]= {
 
 static void node_composit_exec_stabilize2d(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
 {
-	if(in[0]->data && node->id) {
+	if (in[0]->data && node->id) {
 		RenderData *rd= data;
 		MovieClip *clip= (MovieClip *)node->id;
 		CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
@@ -61,7 +61,7 @@ static void node_composit_exec_stabilize2d(void *data, bNode *node, bNodeStack *
 		/* pass on output and free */
 		out[0]->data= stackbuf;
 
-		if(cbuf!=in[0]->data)
+		if (cbuf!=in[0]->data)
 			free_compbuf(cbuf);
 	}
 }
diff --git a/source/blender/nodes/composite/nodes/node_composite_texture.c b/source/blender/nodes/composite/nodes/node_composite_texture.c
index 7f8f14b..562e2b2 100644
--- a/source/blender/nodes/composite/nodes/node_composite_texture.c
+++ b/source/blender/nodes/composite/nodes/node_composite_texture.c
@@ -60,19 +60,19 @@ static void texture_procedural(CompBuf *cbuf, float *out, float xco, float yco)
 	
 	retval= multitex_ext((Tex *)node->id, vec, NULL, NULL, 0, &texres);
 	
-	if(type==CB_VAL) {
-		if(texres.talpha)
+	if (type==CB_VAL) {
+		if (texres.talpha)
 			col[0]= texres.ta;
 		else
 			col[0]= texres.tin;
 	}
-	else if(type==CB_RGBA) {
-		if(texres.talpha)
+	else if (type==CB_RGBA) {
+		if (texres.talpha)
 			col[3]= texres.ta;
 		else
 			col[3]= texres.tin;
 		
-		if((retval & TEX_RGB)) {
+		if ((retval & TEX_RGB)) {
 			col[0]= texres.tr;
 			col[1]= texres.tg;
 			col[2]= texres.tb;
@@ -92,7 +92,7 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in,
 {
 	/* outputs: value, color, normal */
 	
-	if(node->id) {
+	if (node->id) {
 		RenderData *rd= data;
 		short sizex, sizey;
 		
@@ -113,7 +113,7 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in,
 		sizex = (rd->size*rd->xsch)/100;
 		sizey = (rd->size*rd->ysch)/100;
 		
-		if(out[0]->hasoutput) {
+		if (out[0]->hasoutput) {
 			CompBuf *stackbuf= alloc_compbuf(sizex, sizey, CB_VAL, 1); /* alloc */
 			
 			stackbuf->rect_procedural= texture_procedural;
@@ -126,7 +126,7 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in,
 			
 			out[0]->data= stackbuf; 
 		}
-		if(out[1]->hasoutput) {
+		if (out[1]->hasoutput) {
 			CompBuf *stackbuf= alloc_compbuf(sizex, sizey, CB_RGBA, 1); /* alloc */
 			
 			stackbuf->rect_procedural= texture_procedural;
diff --git a/source/blender/nodes/composite/nodes/node_composite_tonemap.c b/source/blender/nodes/composite/nodes/node_composite_tonemap.c
index 9b34e11..0696c2b 100644
--- a/source/blender/nodes/composite/nodes/node_composite_tonemap.c
+++ b/source/blender/nodes/composite/nodes/node_composite_tonemap.c
@@ -118,9 +118,9 @@ static void tonemap(NodeTonemap* ntm, CompBuf* dst, CompBuf* src)
 			dp[x][1] /= ((dg == 0.f) ? 1.f : dg);
 			dp[x][2] /= ((db == 0.f) ? 1.f : db);
 			if (igm != 0.f) {
-				dp[x][0] = pow((double)MAX2(dp[x][0], 0.), igm);
-				dp[x][1] = pow((double)MAX2(dp[x][1], 0.), igm);
-				dp[x][2] = pow((double)MAX2(dp[x][2], 0.), igm);
+				dp[x][0] = pow((double)MAX2(dp[x][0], 0.0), igm);
+				dp[x][1] = pow((double)MAX2(dp[x][1], 0.0), igm);
+				dp[x][2] = pow((double)MAX2(dp[x][2], 0.0), igm);
 			}
 		}
 	}
@@ -142,7 +142,7 @@ static void node_composit_exec_tonemap(void *UNUSED(data), bNode *node, bNodeSta
 
 	out[0]->data = new;
 	
-	if(img!=in[0]->data)
+	if (img!=in[0]->data)
 		free_compbuf(img);
 }
 
diff --git a/source/blender/nodes/composite/nodes/node_composite_transform.c b/source/blender/nodes/composite/nodes/node_composite_transform.c
index 7e096bf..a610d8a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_transform.c
+++ b/source/blender/nodes/composite/nodes/node_composite_transform.c
@@ -77,14 +77,14 @@ CompBuf* node_composit_transform(CompBuf *cbuf, float x, float y, float angle, f
 	ibuf= IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0);
 	obuf= IMB_allocImBuf(stackbuf->x, stackbuf->y, 32, 0);
 
-	if(ibuf && obuf) {
+	if (ibuf && obuf) {
 		int i, j;
 
 		ibuf->rect_float= cbuf->rect;
 		obuf->rect_float= stackbuf->rect;
 
-		for(j=0; j<cbuf->y; j++) {
-			for(i=0; i<cbuf->x;i++) {
+		for (j=0; j<cbuf->y; j++) {
+			for (i=0; i<cbuf->x;i++) {
 				float vec[3]= {i, j, 0};
 
 				mul_v3_m4v3(vec, mat, vec);
@@ -92,7 +92,7 @@ CompBuf* node_composit_transform(CompBuf *cbuf, float x, float y, float angle, f
 				switch(filter_type) {
 					case 0:
 						neareast_interpolation(ibuf, obuf, vec[0], vec[1], i, j);
-						break ;
+						break;
 					case 1:
 						bilinear_interpolation(ibuf, obuf, vec[0], vec[1], i, j);
 						break;
@@ -113,7 +113,7 @@ CompBuf* node_composit_transform(CompBuf *cbuf, float x, float y, float angle, f
 
 static void node_composit_exec_transform(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
 {
-	if(in[0]->data) {
+	if (in[0]->data) {
 		CompBuf *cbuf= typecheck_compbuf(in[0]->data, CB_RGBA);
 		CompBuf *stackbuf;
 
@@ -122,7 +122,7 @@ static void node_composit_exec_transform(void *UNUSED(data), bNode *node, bNodeS
 		/* pass on output and free */
 		out[0]->data= stackbuf;
 
-		if(cbuf!=in[0]->data)
+		if (cbuf!=in[0]->data)
 			free_compbuf(cbuf);
 	}
 }
diff --git a/source/blender/nodes/composite/nodes/node_composite_translate.c b/source/blender/nodes/composite/nodes/node_composite_translate.c
index 073b035..970e2c7 100644
--- a/source/blender/nodes/composite/nodes/node_composite_translate.c
+++ b/source/blender/nodes/composite/nodes/node_composite_translate.c
@@ -48,7 +48,7 @@ static bNodeSocketTemplate cmp_node_translate_out[]= {
 
 static void node_composit_exec_translate(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **in, bNodeStack **out)
 {
-	if(in[0]->data) {
+	if (in[0]->data) {
 		CompBuf *cbuf= in[0]->data;
 		CompBuf *stackbuf= pass_on_compbuf(cbuf);
 	
diff --git a/source/blender/nodes/composite/nodes/node_composite_valToRgb.c b/source/blender/nodes/composite/nodes/node_composite_valToRgb.c
index 30f6246..86986f6 100644
--- a/source/blender/nodes/composite/nodes/node_composite_valToRgb.c
+++ b/source/blender/nodes/composite/nodes/node_composite_valToRgb.c
@@ -54,12 +54,12 @@ static void node_composit_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeSt
 	/* stack order in: fac */
 	/* stack order out: col, alpha */
 	
-	if(out[0]->hasoutput==0 && out[1]->hasoutput==0) 
+	if (out[0]->hasoutput==0 && out[1]->hasoutput==0) 
 		return;
 	
-	if(node->storage) {
+	if (node->storage) {
 		/* input no image? then only color operation */
-		if(in[0]->data==NULL) {
+		if (in[0]->data==NULL) {
 			do_colorband(node->storage, in[0]->vec[0], out[0]->vec);
 		}
 		else {
@@ -71,7 +71,7 @@ static void node_composit_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeSt
 			
 			out[0]->data= stackbuf;
 			
-			if(out[1]->hasoutput)
+			if (out[1]->hasoutput)
 				out[1]->data= valbuf_from_rgbabuf(stackbuf, CHAN_A);
 
 		}
@@ -119,11 +119,11 @@ static void node_composit_exec_rgbtobw(void *UNUSED(data), bNode *node, bNodeSta
 	/* stack order out: bw */
 	/* stack order in: col */
 	
-	if(out[0]->hasoutput==0)
+	if (out[0]->hasoutput==0)
 		return;
 	
 	/* input no image? then only color operation */
-	if(in[0]->data==NULL) {
+	if (in[0]->data==NULL) {
 		do_rgbtobw(node, out[0]->vec, in[0]->vec);
 	}
 	else {
diff --git a/source/blender/nodes/composite/nodes/node_composite_vecBlur.c b/source/blender/nodes/composite/nodes/node_composite_vecBlur.c
index 69f896e..1d4662a 100644
--- a/source/blender/nodes/composite/nodes/node_composite_vecBlur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_vecBlur.c
@@ -52,21 +52,21 @@ static void node_composit_exec_vecblur(void *UNUSED(data), bNode *node, bNodeSta
 	NodeBlurData *nbd= node->storage;
 	CompBuf *new, *img= in[0]->data, *vecbuf= in[2]->data, *zbuf= in[1]->data;
 	
-	if(img==NULL || vecbuf==NULL || zbuf==NULL || out[0]->hasoutput==0)
+	if (img==NULL || vecbuf==NULL || zbuf==NULL || out[0]->hasoutput==0)
 		return;
-	if(vecbuf->x!=img->x || vecbuf->y!=img->y) {
+	if (vecbuf->x!=img->x || vecbuf->y!=img->y) {
 		printf("ERROR: cannot do different sized vecbuf yet\n");
 		return;
 	}
-	if(vecbuf->type!=CB_VEC4) {
+	if (vecbuf->type!=CB_VEC4) {
 		printf("ERROR: input should be vecbuf\n");
 		return;
 	}
-	if(zbuf->type!=CB_VAL) {
+	if (zbuf->type!=CB_VAL) {
 		printf("ERROR: input should be zbuf\n");
 		return;
 	}
-	if(zbuf->x!=img->x || zbuf->y!=img->y) {
+	if (zbuf->x!=img->x || zbuf->y!=img->y) {
 		printf("ERROR: cannot do different sized zbuf yet\n");
 		return;
 	}
@@ -81,7 +81,7 @@ static void node_composit_exec_vecblur(void *UNUSED(data), bNode *node, bNodeSta
 	
 	out[0]->data= new;
 	
-	if(img!=in[0]->data)
+	if (img!=in[0]->data)
 		free_compbuf(img);
 }
 
diff --git a/source/blender/nodes/composite/nodes/node_composite_viewer.c b/source/blender/nodes/composite/nodes/node_composite_viewer.c
index 6a0c074..f9b1e55 100644
--- a/source/blender/nodes/composite/nodes/node_composite_viewer.c
+++ b/source/blender/nodes/composite/nodes/node_composite_viewer.c
@@ -47,7 +47,7 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in,
 	/* image assigned to output */
 	/* stack order input sockets: col, alpha, z */
 	
-	if(node->id && (node->flag & NODE_DO_OUTPUT)) {	/* only one works on out */
+	if (node->id && (node->flag & NODE_DO_OUTPUT)) {	/* only one works on out */
 		RenderData *rd= data;
 		Image *ima= (Image *)node->id;
 		ImBuf *ibuf;
@@ -59,7 +59,7 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in,
 
 		/* always returns for viewer image, but we check nevertheless */
 		ibuf= BKE_image_acquire_ibuf(ima, node->storage, &lock);
-		if(ibuf==NULL) {
+		if (ibuf==NULL) {
 			printf("node_composit_exec_viewer error\n");
 			BKE_image_release_ibuf(ima, lock);
 			return;
@@ -72,7 +72,7 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in,
 		
 		/* get size */
 		tbuf= in[0]->data?in[0]->data:(in[1]->data?in[1]->data:in[2]->data);
-		if(tbuf==NULL) {
+		if (tbuf==NULL) {
 			rectx= 320; recty= 256;
 		}
 		else {
@@ -92,14 +92,14 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in,
 		cbuf->rect= ibuf->rect_float;
 		
 		/* when no alpha, we can simply copy */
-		if(in[1]->data==NULL) {
+		if (in[1]->data==NULL) {
 			composit1_pixel_processor(node, cbuf, in[0]->data, in[0]->vec, do_copy_rgba, CB_RGBA);
 		}
 		else
 			composit2_pixel_processor(node, cbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, do_copy_a_rgba, CB_RGBA, CB_VAL);
 		
 		/* zbuf option */
-		if(in[2]->data) {
+		if (in[2]->data) {
 			CompBuf *zbuf= alloc_compbuf(rectx, recty, CB_VAL, 1);
 			ibuf->zbuf_float= zbuf->rect;
 			ibuf->mall |= IB_zbuffloat;
@@ -117,7 +117,7 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in,
 		free_compbuf(cbuf);
 
 	}
-	else if(in[0]->data) {
+	else if (in[0]->data) {
 		generate_preview(data, node, in[0]->data);
 	}
 }
@@ -141,8 +141,7 @@ void register_node_type_cmp_viewer(bNodeTreeType *ttype)
 	node_type_init(&ntype, node_composit_init_viewer);
 	node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage);
 	node_type_exec(&ntype, node_composit_exec_viewer);
-	/* Do not allow muting this node. */
-	node_type_mute(&ntype, NULL, NULL);
+	node_type_internal_connect(&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 57b0b7b..6434275 100644
--- a/source/blender/nodes/composite/nodes/node_composite_zcombine.c
+++ b/source/blender/nodes/composite/nodes/node_composite_zcombine.c
@@ -53,7 +53,7 @@ static void do_zcombine(bNode *node, float *out, float *src1, float *z1, float *
 	float alpha;
 	float malpha;
 	
-	if(*z1 <= *z2) {
+	if (*z1 <= *z2) {
 		if (node->custom1) {
 			// use alpha in combine operation
 			alpha= src1[3];
@@ -83,16 +83,16 @@ static void do_zcombine(bNode *node, float *out, float *src1, float *z1, float *
 			copy_v4_v4(out, src1);
 		}
 		
-		if(node->custom2)
+		if (node->custom2)
 			*z1= *z2;
 	}
 }
 
 static void do_zcombine_mask(bNode *node, float *out, float *z1, float *z2)
 {
-	if(*z1 > *z2) {
+	if (*z1 > *z2) {
 		*out= 1.0f;
-		if(node->custom2)
+		if (node->custom2)
 			*z1= *z2;
 	}
 }
@@ -145,24 +145,24 @@ static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in
 
 	/* stack order in: col z col z */
 	/* stack order out: col z */
-	if(out[0]->hasoutput==0 && out[1]->hasoutput==0) 
+	if (out[0]->hasoutput==0 && out[1]->hasoutput==0) 
 		return;
 	
 	/* no input image; do nothing now */
-	if(in[0]->data==NULL) {
+	if (in[0]->data==NULL) {
 		return;
 	}
 	
-	if(out[1]->hasoutput) {
+	if (out[1]->hasoutput) {
 		/* copy or make a buffer for for the first z value, here we write result in */
-		if(in[1]->data)
+		if (in[1]->data)
 			zbuf= dupalloc_compbuf(in[1]->data);
 		else {
 			float *zval;
 			int tot= cbuf->x*cbuf->y;
 			
 			zbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_VAL, 1);
-			for(zval= zbuf->rect; tot; tot--, zval++)
+			for (zval= zbuf->rect; tot; tot--, zval++)
 				*zval= in[1]->vec[0];
 		}
 		/* lazy coder hack */
@@ -174,7 +174,7 @@ static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in
 		zbuf= in[1]->data;
 	}
 	
-	if(rd->scemode & R_FULL_SAMPLE) {
+	if (rd->scemode & R_FULL_SAMPLE) {
 		/* make output size of first input image */
 		CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); // allocs
 		
@@ -199,16 +199,16 @@ static void node_composit_exec_zcombine(void *data, bNode *node, bNodeStack **in
 		/* convert to char */
 		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;
+		for (x= cbuf->x*cbuf->y-1; x>=0; x--)
+			if (fp[x]==0.0f) aabuf[x]= 0;
 			else aabuf[x]= 255;
 		
 		antialias_tagbuf(cbuf->x, cbuf->y, aabuf);
 		
 		/* convert to float */
 		fp= mbuf->rect;
-		for(x= cbuf->x*cbuf->y-1; x>=0; x--)
-			if(aabuf[x]>1)
+		for (x= cbuf->x*cbuf->y-1; x>=0; x--)
+			if (aabuf[x]>1)
 				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, 
diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c
index e5571b1..362ed59 100644
--- a/source/blender/nodes/intern/node_common.c
+++ b/source/blender/nodes/intern/node_common.c
@@ -40,6 +40,8 @@
 #include "BLI_string.h"
 #include "BLI_utildefines.h"
 
+#include "BLF_translation.h"
+
 #include "BKE_action.h"
 #include "BKE_animsys.h"
 #include "BKE_global.h"
@@ -103,7 +105,7 @@ bNodeSocket *node_group_add_extern_socket(bNodeTree *UNUSED(ntree), ListBase *lb
 	sock->default_value = node_socket_make_default_value(sock->type);
 	node_socket_copy_default_value(sock->type, sock->default_value, gsock->default_value);
 	
-	if(lb)
+	if (lb)
 		BLI_addtail(lb, sock);
 	
 	return sock;
@@ -123,42 +125,42 @@ bNode *node_group_make_from_selected(bNodeTree *ntree)
 	INIT_MINMAX2(min, max);
 	
 	/* is there something to group? also do some clearing */
-	for(node= ntree->nodes.first; node; node= node->next) {
-		if(node->flag & NODE_SELECT) {
+	for (node= ntree->nodes.first; node; node= node->next) {
+		if (node->flag & NODE_SELECT) {
 			/* no groups in groups */
-			if(node->type==NODE_GROUP)
+			if (node->type==NODE_GROUP)
 				return NULL;
 			DO_MINMAX2( (&node->locx), min, max);
 			totnode++;
 		}
 		node->done= 0;
 	}
-	if(totnode==0) return NULL;
+	if (totnode==0) return NULL;
 	
 	/* check if all connections are OK, no unselected node has both
-		inputs and outputs to a selection */
-	for(link= ntree->links.first; link; link= link->next) {
-		if(link->fromnode && link->tonode && link->fromnode->flag & NODE_SELECT)
+	 * inputs and outputs to a selection */
+	for (link= ntree->links.first; link; link= link->next) {
+		if (link->fromnode && link->tonode && link->fromnode->flag & NODE_SELECT)
 			link->tonode->done |= 1;
-		if(link->fromnode && link->tonode && link->tonode->flag & NODE_SELECT)
+		if (link->fromnode && link->tonode && link->tonode->flag & NODE_SELECT)
 			link->fromnode->done |= 2;
 	}	
 	
-	for(node= ntree->nodes.first; node; node= node->next) {
-		if((node->flag & NODE_SELECT)==0)
-			if(node->done==3)
+	for (node= ntree->nodes.first; node; node= node->next) {
+		if ((node->flag & NODE_SELECT)==0)
+			if (node->done==3)
 				break;
 	}
-	if(node) 
+	if (node) 
 		return NULL;
 	
 	/* OK! new nodetree */
 	ngroup= ntreeAddTree("NodeGroup", ntree->type, NODE_GROUP);
 	
 	/* move nodes over */
-	for(node= ntree->nodes.first; node; node= nextn) {
+	for (node= ntree->nodes.first; node; node= nextn) {
 		nextn= node->next;
-		if(node->flag & NODE_SELECT) {
+		if (node->flag & NODE_SELECT) {
 			/* keep track of this node's RNA "base" path (the part of the pat identifying the node) 
 			 * if the old nodetree has animation data which potentially covers this node
 			 */
@@ -208,20 +210,20 @@ bNode *node_group_make_from_selected(bNodeTree *ntree)
 	gnode->locy= 0.5f*(min[1]+max[1]);
 	
 	/* relink external sockets */
-	for(link= ntree->links.first; link; link= linkn) {
+	for (link= ntree->links.first; link; link= linkn) {
 		linkn= link->next;
 		
-		if(link->fromnode && link->tonode && (link->fromnode->flag & link->tonode->flag & NODE_SELECT)) {
+		if (link->fromnode && link->tonode && (link->fromnode->flag & link->tonode->flag & NODE_SELECT)) {
 			BLI_remlink(&ntree->links, link);
 			BLI_addtail(&ngroup->links, link);
 		}
-		else if(link->tonode && (link->tonode->flag & NODE_SELECT)) {
+		else if (link->tonode && (link->tonode->flag & NODE_SELECT)) {
 			gsock = node_group_expose_socket(ngroup, link->tosock, SOCK_IN);
 			link->tosock->link = nodeAddLink(ngroup, NULL, gsock, link->tonode, link->tosock);
 			link->tosock = node_group_add_extern_socket(ntree, &gnode->inputs, SOCK_IN, gsock);
 			link->tonode = gnode;
 		}
-		else if(link->fromnode && (link->fromnode->flag & NODE_SELECT)) {
+		else if (link->fromnode && (link->fromnode->flag & NODE_SELECT)) {
 			/* search for existing group node socket */
 			for (gsock=ngroup->outputs.first; gsock; gsock=gsock->next)
 				if (gsock->link && gsock->link->fromsock==link->fromsock)
@@ -256,10 +258,10 @@ int node_group_ungroup(bNodeTree *ntree, bNode *gnode)
 	ListBase anim_basepaths = {NULL, NULL};
 	
 	ngroup= (bNodeTree *)gnode->id;
-	if(ngroup==NULL) return 0;
+	if (ngroup==NULL) return 0;
 	
 	/* clear new pointers, set in copytree */
-	for(node= ntree->nodes.first; node; node= node->next)
+	for (node= ntree->nodes.first; node; node= node->next)
 		node->new_node= NULL;
 	
 	/* wgroup is a temporary copy of the NodeTree we're merging in
@@ -269,7 +271,7 @@ int node_group_ungroup(bNodeTree *ntree, bNode *gnode)
 	wgroup= ntreeCopyTree(ngroup);
 	
 	/* add the nodes into the ntree */
-	for(node= wgroup->nodes.first; node; node= nextn) {
+	for (node= wgroup->nodes.first; node; node= nextn) {
 		nextn= node->next;
 		
 		/* keep track of this node's RNA "base" path (the part of the pat identifying the node) 
@@ -297,7 +299,7 @@ int node_group_ungroup(bNodeTree *ntree, bNode *gnode)
 	}
 	
 	/* restore external links to and from the gnode */
-	for(link= ntree->links.first; link; link= link->next) {
+	for (link= ntree->links.first; link; link= link->next) {
 		if (link->fromnode==gnode) {
 			if (link->fromsock->groupsock) {
 				bNodeSocket *gsock= link->fromsock->groupsock;
@@ -324,13 +326,13 @@ int node_group_ungroup(bNodeTree *ntree, bNode *gnode)
 		}
 	}
 	/* remove internal output links, these are not used anymore */
-	for(link=wgroup->links.first; link; link= linkn) {
+	for (link=wgroup->links.first; link; link= linkn) {
 		linkn = link->next;
 		if (!link->tonode)
 			nodeRemLink(wgroup, link);
 	}
 	/* restore links from internal nodes */
-	for(link= wgroup->links.first; link; link= link->next) {
+	for (link= wgroup->links.first; link; link= link->next) {
 		/* indicates link to group input */
 		if (!link->fromnode) {
 			/* NB: can't use find_group_node_input here,
@@ -353,7 +355,7 @@ int node_group_ungroup(bNodeTree *ntree, bNode *gnode)
 	}
 	
 	/* add internal links to the ntree */
-	for(link= wgroup->links.first; link; link= linkn) {
+	for (link= wgroup->links.first; link; link= linkn) {
 		linkn= link->next;
 		BLI_remlink(&wgroup->links, link);
 		BLI_addtail(&ntree->links, link);
@@ -487,7 +489,7 @@ void node_group_remove_socket(bNodeTree *ngroup, bNodeSocket *gsock, int in_out)
 /* groups display their internal tree name as label */
 const char *node_group_label(bNode *node)
 {
-	return (node->id)? node->id->name+2: "Missing Datablock";
+	return (node->id)? node->id->name+2: IFACE_("Missing Datablock");
 }
 
 int node_group_valid(bNodeTree *ntree, bNodeTemplate *ntemp)
@@ -541,11 +543,11 @@ static bNodeSocket *group_verify_socket(bNodeTree *ntree, ListBase *lb, int in_o
 	if (gsock->flag & SOCK_INTERNAL)
 		return NULL;
 	
-	for(sock= lb->first; sock; sock= sock->next) {
-		if(sock->own_index==gsock->own_index)
+	for (sock= lb->first; sock; sock= sock->next) {
+		if (sock->own_index==gsock->own_index)
 				break;
 	}
-	if(sock) {
+	if (sock) {
 		sock->groupsock = gsock;
 		
 		BLI_strncpy(sock->name, gsock->name, sizeof(sock->name));
@@ -613,7 +615,7 @@ struct bNodeTree *node_group_edit_set(bNode *node, int edit)
 	if (edit) {
 		bNodeTree *ngroup= (bNodeTree*)node->id;
 		if (ngroup) {
-			if(ngroup->id.lib)
+			if (ngroup->id.lib)
 				ntreeMakeLocal(ngroup);
 			
 			node->flag |= NODE_GROUP_EDIT;
diff --git a/source/blender/nodes/intern/node_common.h b/source/blender/nodes/intern/node_common.h
index ee52312..616221d 100644
--- a/source/blender/nodes/intern/node_common.h
+++ b/source/blender/nodes/intern/node_common.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NODE_COMMON_H_
-#define NODE_COMMON_H_
+#ifndef __NODE_COMMON_H__
+#define __NODE_COMMON_H__
 
 #include "DNA_listBase.h"
 
diff --git a/source/blender/nodes/intern/node_exec.c b/source/blender/nodes/intern/node_exec.c
index 1def0c3..3b757e7 100644
--- a/source/blender/nodes/intern/node_exec.c
+++ b/source/blender/nodes/intern/node_exec.c
@@ -55,13 +55,13 @@ void node_get_stack(bNode *node, bNodeStack *stack, bNodeStack **in, bNodeStack
 	
 	/* build pointer stack */
 	if (in) {
-		for(sock= node->inputs.first; sock; sock= sock->next) {
+		for (sock= node->inputs.first; sock; sock= sock->next) {
 			*(in++) = node_get_socket_stack(stack, sock);
 		}
 	}
 	
 	if (out) {
-		for(sock= node->outputs.first; sock; sock= sock->next) {
+		for (sock= node->outputs.first; sock; sock= sock->next) {
 			*(out++) = node_get_socket_stack(stack, sock);
 		}
 	}
@@ -135,7 +135,7 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree)
 	bNode **nodelist;
 	int totnodes, n;
 	
-	if((ntree->init & NTREE_TYPE_INIT)==0)
+	if ((ntree->init & NTREE_TYPE_INIT)==0)
 		ntreeInitTypes(ntree);
 	
 	/* get a dependency-sorted list of nodes */
@@ -147,10 +147,10 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree)
 	exec->nodetree = ntree;
 	
 	/* group inputs essentially work as outputs */
-	for(gsock=ntree->inputs.first; gsock; gsock = gsock->next)
+	for (gsock=ntree->inputs.first; gsock; gsock = gsock->next)
 		node_init_output_index(gsock, &index);
 	/* set stack indexes */
-	for(n=0; n < totnodes; ++n) {
+	for (n=0; n < totnodes; ++n) {
 		node = nodelist[n];
 		
 		node->stack_index = index;
@@ -162,7 +162,7 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree)
 			node_init_output_index(sock, &index);
 	}
 	/* group outputs essentially work as inputs */
-	for(gsock=ntree->outputs.first; gsock; gsock = gsock->next)
+	for (gsock=ntree->outputs.first; gsock; gsock = gsock->next)
 		node_init_input_index(gsock, &index);
 	
 	/* allocated exec data pointers for nodes */
@@ -181,13 +181,13 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree)
 		/* ns = */ setup_stack(exec->stack, sock);
 	}
 	/* prepare all internal nodes for execution */
-	for(n=0, nodeexec= exec->nodeexec; n < totnodes; ++n, ++nodeexec) {
+	for (n=0, nodeexec= exec->nodeexec; n < totnodes; ++n, ++nodeexec) {
 		node = nodeexec->node = nodelist[n];
 		
 		/* tag inputs */
 		for (sock=node->inputs.first; sock; sock=sock->next) {
 			/* disable the node if an input link is invalid */
-			if(sock->link && !(sock->link->flag & NODE_LINK_VALID))
+			if (sock->link && !(sock->link->flag & NODE_LINK_VALID))
 				node->need_exec= 0;
 			
 			ns = setup_stack(exec->stack, sock);
@@ -199,7 +199,7 @@ bNodeTreeExec *ntree_exec_begin(bNodeTree *ntree)
 			/* ns = */ setup_stack(exec->stack, sock);
 		}
 		
-		if(node->typeinfo->initexecfunc)
+		if (node->typeinfo->initexecfunc)
 			nodeexec->data = node->typeinfo->initexecfunc(node);
 	}
 	/* prepare group tree outputs */
@@ -222,7 +222,7 @@ void ntree_exec_end(bNodeTreeExec *exec)
 	if (exec->stack)
 		MEM_freeN(exec->stack);
 	
-	for(n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+	for (n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
 		if (nodeexec->node->typeinfo->freeexecfunc)
 			nodeexec->node->typeinfo->freeexecfunc(nodeexec->node, nodeexec->data);
 	}
@@ -240,8 +240,8 @@ bNodeThreadStack *ntreeGetThreadStack(bNodeTreeExec *exec, int thread)
 	ListBase *lb= &exec->threadstack[thread];
 	bNodeThreadStack *nts;
 	
-	for(nts=lb->first; nts; nts=nts->next) {
-		if(!nts->used) {
+	for (nts=lb->first; nts; nts=nts->next) {
+		if (!nts->used) {
 			nts->used= 1;
 			break;
 		}
@@ -272,17 +272,15 @@ void ntreeExecNodes(bNodeTreeExec *exec, void *callerdata, int thread)
 	
 	/* nodes are presorted, so exec is in order of list */
 	
-	for(n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+	for (n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
 		node = nodeexec->node;
-		if(node->need_exec) {
+		if (node->need_exec) {
 			node_get_stack(node, exec->stack, nsin, nsout);
 			/* Handle muted nodes...
 			 * If the mute func is not set, assume the node should never be muted,
 			 * and hence execute it!
 			 */
-			if((node->flag & NODE_MUTED) && node->typeinfo->mutefunc)
-				node->typeinfo->mutefunc(callerdata, thread, node, nodeexec->data, nsin, nsout);
-			else if(node->typeinfo->execfunc)
+			if (node->typeinfo->execfunc)
 				node->typeinfo->execfunc(callerdata, node, nsin, nsout);
 			else if (node->typeinfo->newexecfunc)
 				node->typeinfo->newexecfunc(callerdata, thread, node, nodeexec->data, nsin, nsout);
@@ -300,17 +298,15 @@ void ntreeExecThreadNodes(bNodeTreeExec *exec, bNodeThreadStack *nts, void *call
 	
 	/* nodes are presorted, so exec is in order of list */
 	
-	for(n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+	for (n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
 		node = nodeexec->node;
-		if(node->need_exec) {
+		if (node->need_exec) {
 			node_get_stack(node, nts->stack, nsin, nsout);
 			/* Handle muted nodes...
 			 * If the mute func is not set, assume the node should never be muted,
 			 * and hence execute it!
 			 */
-			if((node->flag & NODE_MUTED) && node->typeinfo->mutefunc)
-				node->typeinfo->mutefunc(callerdata, thread, node, nodeexec->data, nsin, nsout);
-			else if(node->typeinfo->execfunc)
+			if (node->typeinfo->execfunc)
 				node->typeinfo->execfunc(callerdata, node, nsin, nsout);
 			else if (node->typeinfo->newexecfunc)
 				node->typeinfo->newexecfunc(callerdata, thread, node, nodeexec->data, nsin, nsout);
diff --git a/source/blender/nodes/intern/node_exec.h b/source/blender/nodes/intern/node_exec.h
index fe1bb0b..1003206 100644
--- a/source/blender/nodes/intern/node_exec.h
+++ b/source/blender/nodes/intern/node_exec.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NODE_EXEC_H_
-#define NODE_EXEC_H_
+#ifndef __NODE_EXEC_H__
+#define __NODE_EXEC_H__
 
 #include "DNA_listBase.h"
 
diff --git a/source/blender/nodes/intern/node_socket.c b/source/blender/nodes/intern/node_socket.c
index f03aff8..94b9d36 100644
--- a/source/blender/nodes/intern/node_socket.c
+++ b/source/blender/nodes/intern/node_socket.c
@@ -160,7 +160,7 @@ static bNodeSocketType node_socket_type_mesh = {
 
 void node_socket_type_init(bNodeSocketType *types[])
 {
-	#define INIT_TYPE(name)		types[node_socket_type_##name.type] = &node_socket_type_##name;
+	#define INIT_TYPE(name)		types[node_socket_type_##name.type] = &node_socket_type_##name
 	
 	INIT_TYPE(float);
 	INIT_TYPE(vector);
@@ -485,13 +485,13 @@ static bNodeSocket *verify_socket_template(bNodeTree *ntree, bNode *node, int in
 {
 	bNodeSocket *sock;
 	
-	for(sock= socklist->first; sock; sock= sock->next) {
-		if(!(sock->flag & SOCK_DYNAMIC) && strncmp(sock->name, stemp->name, NODE_MAXSTR)==0)
+	for (sock= socklist->first; sock; sock= sock->next) {
+		if (!(sock->flag & SOCK_DYNAMIC) && strncmp(sock->name, stemp->name, NODE_MAXSTR)==0)
 			break;
 	}
-	if(sock) {
+	if (sock) {
 		sock->type= stemp->type;		/* in future, read this from tydefs! */
-		if(stemp->limit==0) sock->limit= 0xFFF;
+		if (stemp->limit==0) sock->limit= 0xFFF;
 		else sock->limit= stemp->limit;
 		sock->flag |= stemp->flag;
 		
@@ -550,7 +550,7 @@ static void verify_socket_template_list(bNodeTree *ntree, bNode *node, int in_ou
 	bNodeSocketTemplate *stemp;
 	
 	/* no inputs anymore? */
-	if(stemp_first==NULL) {
+	if (stemp_first==NULL) {
 		for (sock = (bNodeSocket*)socklist->first; sock; sock=nextsock) {
 			nextsock = sock->next;
 			if (!(sock->flag & SOCK_DYNAMIC))
@@ -560,7 +560,7 @@ static void verify_socket_template_list(bNodeTree *ntree, bNode *node, int in_ou
 	else {
 		/* step by step compare */
 		stemp= stemp_first;
-		while(stemp->type != -1) {
+		while (stemp->type != -1) {
 			stemp->sock= verify_socket_template(ntree, node, in_out, socklist, stemp);
 			stemp++;
 		}
@@ -578,14 +578,14 @@ static void verify_socket_template_list(bNodeTree *ntree, bNode *node, int in_ou
 			 * so we can add static sockets infront of it.
 			 */
 			sock = socklist->first;
-			while(stemp->type != -1) {
+			while (stemp->type != -1) {
 				/* put static sockets infront of dynamic */
 				BLI_insertlinkbefore(socklist, sock, stemp->sock);
 				stemp++;
 			}
 		}
 		else {
-			while(stemp->type != -1) {
+			while (stemp->type != -1) {
 				BLI_addtail(socklist, stemp->sock);
 				stemp++;
 			}
@@ -600,7 +600,7 @@ 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 dabad10..1c38bdf 100644
--- a/source/blender/nodes/intern/node_util.c
+++ b/source/blender/nodes/intern/node_util.c
@@ -36,6 +36,8 @@
 #include "BLI_listbase.h"
 #include "BLI_utildefines.h"
 
+#include "BLF_translation.h"
+
 #include "BKE_colortools.h"
 #include "BKE_node.h"
 
@@ -74,87 +76,95 @@ const char *node_blend_label(bNode *node)
 {
 	const char *name;
 	RNA_enum_name(ramp_blend_items, node->custom1, &name);
-	return name;
+	return IFACE_(name);
 }
 
 const char *node_math_label(bNode *node)
 {
 	const char *name;
 	RNA_enum_name(node_math_items, node->custom1, &name);
-	return name;
+	return IFACE_(name);
 }
 
 const char *node_vect_math_label(bNode *node)
 {
 	const char *name;
 	RNA_enum_name(node_vec_math_items, node->custom1, &name);
-	return name;
+	return IFACE_(name);
 }
 
 const char *node_filter_label(bNode *node)
 {
 	const char *name;
 	RNA_enum_name(node_filter_items, node->custom1, &name);
-	return name;
+	return IFACE_(name);
 }
 
-/* Returns a list of mapping of some input bNodeStack, GPUNodeStack or bNodeSocket
- * to one or more outputs of the same type.
- * *ntree or (**nsin, **nsout) or (*gnsin, *gnsout) must not be NULL. */
-ListBase node_mute_get_links(bNodeTree *ntree, bNode *node, bNodeStack **nsin, bNodeStack **nsout,
-                             GPUNodeStack *gnsin, GPUNodeStack *gnsout)
+ListBase node_internal_connect_default(bNodeTree *ntree, bNode *node)
 {
-	static int types[] = { SOCK_FLOAT, SOCK_VECTOR, SOCK_RGBA };
-	bNodeLink link = {NULL};
 	ListBase ret;
-	LinkInOutsMuteNode *lnk;
-	int in, out, i;
+	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 || (nsin && nsout) || (gnsin && gnsout)))
+	if (!ntree)
 		return ret;
 
-	/* Connect the first input of each type with first output of the same type. */
-
-	link.fromnode = link.tonode = node;
-	for (i=0; i < 3; ++i) {
-		/* find input socket */
-		for (in=0, link.fromsock=node->inputs.first; link.fromsock; in++, link.fromsock=link.fromsock->next) {
-			if (link.fromsock->type==types[i] && (ntree ? nodeCountSocketLinks(ntree, link.fromsock) : nsin ? nsin[in]->hasinput : gnsin[in].hasinput))
+	for (datatype=0; datatype < NUM_SOCKET_TYPES; ++datatype) {
+		bNodeSocket *fromsock=NULL, *tosock=NULL;
+		bNodeLink *link;
+		
+		/* Connect the first input of each type with outputs of the same type. */
+		
+		for (link=ntree->links.first; link; link=link->next) {
+			if (link->tonode == node && link->tosock->type == datatype) {
+				fromsock = link->tosock;
+				++num_links_in;
+				if (!fromsock_first)
+					fromsock_first = fromsock;
 				break;
-		}
-		if (link.fromsock) {
-			for (out=0, link.tosock=node->outputs.first; link.tosock; out++, link.tosock=link.tosock->next) {
-				if (link.tosock->type==types[i] && (ntree ? nodeCountSocketLinks(ntree, link.tosock) : nsout ? nsout[out]->hasoutput : gnsout[out].hasoutput))
-					break;
 			}
-			if (link.tosock) {
-				if(nsin && nsout) {
-					lnk = MEM_mallocN(sizeof(LinkInOutsMuteNode), "Muting node: new in to outs link.");
-					lnk->in = nsin[in];
-					lnk->outs = nsout[out];
-					lnk->num_outs = 1;
-					BLI_addtail(&ret, lnk);
-				}
-				else if(gnsin && gnsout) {
-					lnk = MEM_mallocN(sizeof(LinkInOutsMuteNode), "Muting node: new in to outs link.");
-					lnk->in = &gnsin[in];
-					lnk->outs = &gnsout[out];
-					lnk->num_outs = 1;
-					BLI_addtail(&ret, lnk);
-				}
-				else {
-					lnk = MEM_mallocN(sizeof(LinkInOutsMuteNode), "Muting node: new in to outs link.");
-					lnk->in = link.fromsock;
-					lnk->outs = link.tosock;
-					lnk->num_outs = 1;
-					BLI_addtail(&ret, lnk);
+		}
+		
+		for (link=ntree->links.first; link; link=link->next) {
+			if (link->fromnode == node && link->fromsock->type == datatype) {
+				tosock = link->fromsock;
+				++num_links_out;
+				if (!tosock_first)
+					tosock_first = tosock;
+				
+				if (fromsock) {
+					bNodeLink *ilink = MEM_callocN(sizeof(bNodeLink), "internal node link");
+					ilink->fromnode = node;
+					ilink->fromsock = fromsock;
+					ilink->tonode = node;
+					ilink->tosock = tosock;
+					/* internal link is always valid */
+					ilink->flag |= NODE_LINK_VALID;
+					BLI_addtail(&ret, ilink);
+					
+					++num_reconnect;
 				}
 			}
 		}
 	}
-
+	
+	/* if there is one input and one output link, but no reconnections by type,
+	 * simply connect those two sockets.
+	 */
+	if (num_reconnect==0 && num_links_in==1 && num_links_out==1) {
+		bNodeLink *ilink = MEM_callocN(sizeof(bNodeLink), "internal node link");
+		ilink->fromnode = node;
+		ilink->fromsock = fromsock_first;
+		ilink->tonode = node;
+		ilink->tosock = tosock_first;
+		/* internal link is always valid */
+		ilink->flag |= NODE_LINK_VALID;
+		BLI_addtail(&ret, ilink);
+	}
+	
 	return ret;
 }
diff --git a/source/blender/nodes/intern/node_util.h b/source/blender/nodes/intern/node_util.h
index 7ca0903..6f167e3 100644
--- a/source/blender/nodes/intern/node_util.h
+++ b/source/blender/nodes/intern/node_util.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NODE_UTIL_H_
-#define NODE_UTIL_H_
+#ifndef __NODE_UTIL_H__
+#define __NODE_UTIL_H__
 
 #include "DNA_listBase.h"
 
@@ -61,18 +61,11 @@ 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);
 
-typedef struct LinkInOutsMuteNode
-{
-	struct LinkInOutsMuteNode *next, *prev;
-	void *in, *outs;
-	unsigned int num_outs; /* If > 1, outs is an array of pointers that need to be freed too! */
-} LinkInOutsMuteNode;
-ListBase node_mute_get_links(struct bNodeTree *ntree, struct bNode *node, struct bNodeStack **nsin,
-                             struct bNodeStack **nsout, struct GPUNodeStack *gnsin, struct GPUNodeStack *gnsout);
+ListBase node_internal_connect_default(struct bNodeTree *ntree, struct bNode *node);
 
 #endif
 
-// this is needed for inlining behaviour
+// this is needed for inlining behavior
 #if defined _WIN32
 #   define DO_INLINE __inline
 #elif defined (__sun) || defined (__sun__)
diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c
index b3144ff..c028ca8 100644
--- a/source/blender/nodes/shader/node_shader_tree.c
+++ b/source/blender/nodes/shader/node_shader_tree.c
@@ -65,16 +65,16 @@ static void foreach_nodetree(Main *main, void *calldata, bNodeTreeCallback func)
 	Lamp *la;
 	World *wo;
 
-	for(ma= main->mat.first; ma; ma= ma->id.next)
-		if(ma->nodetree)
+	for (ma= main->mat.first; ma; ma= ma->id.next)
+		if (ma->nodetree)
 			func(calldata, &ma->id, ma->nodetree);
 
-	for(la= main->lamp.first; la; la= la->id.next)
-		if(la->nodetree)
+	for (la= main->lamp.first; la; la= la->id.next)
+		if (la->nodetree)
 			func(calldata, &la->id, la->nodetree);
 
-	for(wo= main->world.first; wo; wo= wo->id.next)
-		if(wo->nodetree)
+	for (wo= main->world.first; wo; wo= wo->id.next)
+		if (wo->nodetree)
 			func(calldata, &wo->id, wo->nodetree);
 }
 
@@ -83,7 +83,7 @@ static void foreach_nodeclass(Scene *scene, void *calldata, bNodeClassCallback f
 	func(calldata, NODE_CLASS_INPUT, IFACE_("Input"));
 	func(calldata, NODE_CLASS_OUTPUT, IFACE_("Output"));
 
-	if(scene_use_new_shading_nodes(scene)) {
+	if (scene_use_new_shading_nodes(scene)) {
 		func(calldata, NODE_CLASS_SHADER, IFACE_("Shader"));
 		func(calldata, NODE_CLASS_TEXTURE, IFACE_("Texture"));
 	}
@@ -95,17 +95,32 @@ static void foreach_nodeclass(Scene *scene, void *calldata, bNodeClassCallback f
 	func(calldata, NODE_CLASS_LAYOUT, IFACE_("Layout"));
 }
 
+static void localize(bNodeTree *localtree, bNodeTree *UNUSED(ntree))
+{
+	bNode *node, *node_next;
+	
+	/* replace muted nodes by internal links */
+	for (node= localtree->nodes.first; node; node= node_next) {
+		node_next = node->next;
+		
+		if (node->flag & NODE_MUTED) {
+			nodeInternalRelink(localtree, node);
+			nodeFreeNode(localtree, node);
+		}
+	}
+}
+
 static void local_sync(bNodeTree *localtree, bNodeTree *ntree)
 {
 	bNode *lnode;
 	
 	/* copy over contents of previews */
-	for(lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
-		if(ntreeNodeExists(ntree, lnode->new_node)) {
+	for (lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
+		if (ntreeNodeExists(ntree, lnode->new_node)) {
 			bNode *node= lnode->new_node;
 			
-			if(node->preview && node->preview->rect) {
-				if(lnode->preview && lnode->preview->rect) {
+			if (node->preview && node->preview->rect) {
+				if (lnode->preview && lnode->preview->rect) {
 					int xsize= node->preview->xsize;
 					int ysize= node->preview->ysize;
 					memcpy(node->preview->rect, lnode->preview->rect, 4*xsize + xsize*ysize*sizeof(char)*4);
@@ -130,15 +145,13 @@ bNodeTreeType ntreeType_Shader = {
 	/* free_node_cache */	NULL,
 	/* foreach_nodetree */	foreach_nodetree,
 	/* foreach_nodeclass */	foreach_nodeclass,
-	/* localize */			NULL,
+	/* localize */			localize,
 	/* local_sync */		local_sync,
 	/* local_merge */		NULL,
 	/* update */			update,
 	/* update_node */		NULL,
 	/* validate_link */		NULL,
-	/* mute node */			node_shader_pass_on,
-	/* mute links node */	node_mute_get_links,
-	/* gpu mute node */		gpu_shader_pass_on
+	/* internal_connect */	node_internal_connect_default
 };
 
 /* GPU material from shader nodes */
@@ -189,7 +202,7 @@ bNodeTreeExec *ntreeShaderBeginExecTree(bNodeTree *ntree, int use_tree_data)
 	/* allocate the thread stack listbase array */
 	exec->threadstack= MEM_callocN(BLENDER_MAX_THREADS*sizeof(ListBase), "thread stack array");
 	
-	for(node= exec->nodetree->nodes.first; node; node= node->next)
+	for (node= exec->nodetree->nodes.first; node; node= node->next)
 		node->need_exec= 1;
 	
 	if (use_tree_data) {
@@ -207,14 +220,14 @@ bNodeTreeExec *ntreeShaderBeginExecTree(bNodeTree *ntree, int use_tree_data)
  */
 void ntreeShaderEndExecTree(bNodeTreeExec *exec, int use_tree_data)
 {
-	if(exec) {
+	if (exec) {
 		bNodeTree *ntree= exec->nodetree;
 		bNodeThreadStack *nts;
 		int a;
 		
-		if(exec->threadstack) {
-			for(a=0; a<BLENDER_MAX_THREADS; a++) {
-				for(nts=exec->threadstack[a].first; nts; nts=nts->next)
+		if (exec->threadstack) {
+			for (a=0; a<BLENDER_MAX_THREADS; a++) {
+				for (nts=exec->threadstack[a].first; nts; nts=nts->next)
 					if (nts->stack) MEM_freeN(nts->stack);
 				BLI_freelistN(&exec->threadstack[a]);
 			}
@@ -235,10 +248,10 @@ void ntreeShaderEndExecTree(bNodeTreeExec *exec, int use_tree_data)
 void ntreeShaderExecTree(bNodeTree *ntree, ShadeInput *shi, ShadeResult *shr)
 {
 	ShaderCallData scd;
-	/*
-	@note: preserve material from ShadeInput for material id, nodetree execs change it
-	fix for bug "[#28012] Mat ID messy with shader nodes"
-	*/
+	/**
+	 * \note: preserve material from ShadeInput for material id, nodetree execs change it
+	 * fix for bug "[#28012] Mat ID messy with shader nodes"
+	 */
 	Material *mat = shi->mat;
 	bNodeThreadStack *nts = NULL;
 	bNodeTreeExec *exec = ntree->execdata;
@@ -253,7 +266,7 @@ void ntreeShaderExecTree(bNodeTree *ntree, ShadeInput *shi, ShadeResult *shr)
 	/* ensure execdata is only initialized once */
 	if (!exec) {
 		BLI_lock_thread(LOCK_NODES);
-		if(!ntree->execdata)
+		if (!ntree->execdata)
 			ntree->execdata = ntreeShaderBeginExecTree(ntree, 1);
 		BLI_unlock_thread(LOCK_NODES);
 
@@ -264,10 +277,10 @@ void ntreeShaderExecTree(bNodeTree *ntree, ShadeInput *shi, ShadeResult *shr)
 	ntreeExecThreadNodes(exec, nts, &scd, shi->thread);
 	ntreeReleaseThreadStack(nts);
 	
-	// @note: set material back to preserved material
+	// \note: set material back to preserved material
 	shi->mat = mat;
 	/* better not allow negative for now */
-	if(shr->combined[0]<0.0f) shr->combined[0]= 0.0f;
-	if(shr->combined[1]<0.0f) shr->combined[1]= 0.0f;
-	if(shr->combined[2]<0.0f) shr->combined[2]= 0.0f;
+	if (shr->combined[0]<0.0f) shr->combined[0]= 0.0f;
+	if (shr->combined[1]<0.0f) shr->combined[1]= 0.0f;
+	if (shr->combined[2]<0.0f) shr->combined[2]= 0.0f;
 }
diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c
index 1bfb986..90c62bc 100644
--- a/source/blender/nodes/shader/node_shader_util.c
+++ b/source/blender/nodes/shader/node_shader_util.c
@@ -42,14 +42,14 @@ void nodestack_get_vec(float *in, short type_in, bNodeStack *ns)
 {
 	float *from= ns->vec;
 		
-	if(type_in==SOCK_FLOAT) {
-		if(ns->sockettype==SOCK_FLOAT)
+	if (type_in==SOCK_FLOAT) {
+		if (ns->sockettype==SOCK_FLOAT)
 			*in= *from;
 		else 
 			*in= 0.333333f*(from[0]+from[1]+from[2]);
 	}
-	else if(type_in==SOCK_VECTOR) {
-		if(ns->sockettype==SOCK_FLOAT) {
+	else if (type_in==SOCK_VECTOR) {
+		if (ns->sockettype==SOCK_FLOAT) {
 			in[0]= from[0];
 			in[1]= from[0];
 			in[2]= from[0];
@@ -59,10 +59,10 @@ void nodestack_get_vec(float *in, short type_in, bNodeStack *ns)
 		}
 	}
 	else { /* type_in==SOCK_RGBA */
-		if(ns->sockettype==SOCK_RGBA) {
+		if (ns->sockettype==SOCK_RGBA) {
 			copy_v4_v4(in, from);
 		}
-		else if(ns->sockettype==SOCK_FLOAT) {
+		else if (ns->sockettype==SOCK_FLOAT) {
 			in[0]= from[0];
 			in[1]= from[0];
 			in[2]= from[0];
@@ -76,56 +76,6 @@ void nodestack_get_vec(float *in, short type_in, bNodeStack *ns)
 }
 
 
-/* ******************* execute and parse ************ */
-
-/* Used for muted nodes, just copy the vec data from input to output… */
-void node_shader_pass_on(void *UNUSED(data), int UNUSED(thread), struct bNode *node, void *UNUSED(nodedata),
-                         struct bNodeStack **in, struct bNodeStack **out)
-{
-	ListBase links;
-	LinkInOutsMuteNode *lnk;
-	int i;
-
-	if(node->typeinfo->mutelinksfunc == NULL)
-		return;
-
-	/* Get default muting links (as bNodeStack pointers). */
-	links = node->typeinfo->mutelinksfunc(NULL, node, in, out, NULL, NULL);
-
-	for(lnk = links.first; lnk; lnk = lnk->next) {
-		for(i = 0; i < lnk->num_outs; i++) {
-			copy_v4_v4((((bNodeStack*)(lnk->outs))+i)->vec, ((bNodeStack*)(lnk->in))->vec);
-		}
-		/* If num_outs > 1, lnk->outs was an allocated table of pointers... */
-		if(i > 1)
-			MEM_freeN(lnk->outs);
-	}
-	BLI_freelistN(&links);
-}
-
-int gpu_shader_pass_on(struct GPUMaterial *mat, struct bNode *node, void *UNUSED(nodedata),
-                       struct GPUNodeStack *in, struct GPUNodeStack *out)
-{
-	ListBase links;
-	LinkInOutsMuteNode *lnk;
-
-	if(node->typeinfo->mutelinksfunc == NULL)
-		return 0;
-
-	/* Get default muting links (as GPUNodeStack pointers). */
-	links = node->typeinfo->mutelinksfunc(NULL, node, NULL, NULL, in, out);
-
-	for(lnk = links.first; lnk; lnk = lnk->next) {
-		GPU_stack_link_mute(mat, "copy_raw", lnk);
-		/* If num_outs > 1, lnk->outs was an allocated table of pointers... */
-		if(lnk->num_outs > 1)
-			MEM_freeN(lnk->outs);
-	}
-
-	BLI_freelistN(&links);
-	return 1;
-}
-
 /* go over all used Geometry and Texture nodes, and return a texco flag */
 /* no group inside needed, this function is called for groups too */
 void ntreeShaderGetTexcoMode(bNodeTree *ntree, int r_mode, short *texco, int *mode)
@@ -134,22 +84,23 @@ void ntreeShaderGetTexcoMode(bNodeTree *ntree, int r_mode, short *texco, int *mo
 	bNodeSocket *sock;
 	int a;
 	
-	for(node= ntree->nodes.first; node; node= node->next) {
-		if(node->type==SH_NODE_TEXTURE) {
-			if((r_mode & R_OSA) && node->id) {
+	for (node= ntree->nodes.first; node; node= node->next) {
+		if (node->type==SH_NODE_TEXTURE) {
+			if ((r_mode & R_OSA) && node->id) {
 				Tex *tex= (Tex *)node->id;
-				if ELEM3(tex->type, TEX_IMAGE, TEX_PLUGIN, TEX_ENVMAP) 
+				if (ELEM3(tex->type, TEX_IMAGE, TEX_PLUGIN, TEX_ENVMAP)) {
 					*texco |= TEXCO_OSA|NEED_UV;
+				}
 			}
 			/* usability exception... without input we still give the node orcos */
 			sock= node->inputs.first;
-			if(sock==NULL || sock->link==NULL)
+			if (sock==NULL || sock->link==NULL)
 				*texco |= TEXCO_ORCO|NEED_UV;
 		}
-		else if(node->type==SH_NODE_GEOMETRY) {
+		else if (node->type==SH_NODE_GEOMETRY) {
 			/* note; sockets always exist for the given type! */
-			for(a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
-				if(sock->flag & SOCK_IN_USE) {
+			for (a=0, sock= node->outputs.first; sock; sock= sock->next, a++) {
+				if (sock->flag & SOCK_IN_USE) {
 					switch(a) {
 						case GEOM_OUT_GLOB: 
 							*texco |= TEXCO_GLOB|NEED_UV; break;
@@ -175,17 +126,17 @@ void ntreeShaderGetTexcoMode(bNodeTree *ntree, int r_mode, short *texco, int *mo
 /* nodes that use ID data get synced with local data */
 void nodeShaderSynchronizeID(bNode *node, int copyto)
 {
-	if(node->id==NULL) return;
+	if (node->id==NULL) return;
 	
-	if(ELEM(node->type, SH_NODE_MATERIAL, SH_NODE_MATERIAL_EXT)) {
+	if (ELEM(node->type, SH_NODE_MATERIAL, SH_NODE_MATERIAL_EXT)) {
 		bNodeSocket *sock;
 		Material *ma= (Material *)node->id;
 		int a;
 		
-		/* hrmf, case in loop isnt super fast, but we dont edit 100s of material at same time either! */
-		for(a=0, sock= node->inputs.first; sock; sock= sock->next, a++) {
-			if(!nodeSocketIsHidden(sock)) {
-				if(copyto) {
+		/* hrmf, case in loop isn't super fast, but we don't edit 100s of material at same time either! */
+		for (a=0, sock= node->inputs.first; sock; sock= sock->next, a++) {
+			if (!nodeSocketIsHidden(sock)) {
+				if (copyto) {
 					switch(a) {
 						case MAT_IN_COLOR:
 							copy_v3_v3(&ma->r, ((bNodeSocketValueRGBA*)sock->default_value)->value); break;
@@ -260,7 +211,7 @@ void node_gpu_stack_from_data(struct GPUNodeStack *gs, int type, bNodeStack *ns)
 	
 	gs->name = "";
 	gs->hasinput= ns->hasinput && ns->data;
-	/* XXX Commented out the ns->data check here, as it seems it’s not alwas set,
+	/* XXX Commented out the ns->data check here, as it seems it's not alwas set,
 	 *     even though there *is* a valid connection/output... But that might need
 	 *     further investigation.
 	 */
@@ -299,19 +250,19 @@ bNode *nodeGetActiveTexture(bNodeTree *ntree)
 	/* this is the node we texture paint and draw in textured draw */
 	bNode *node;
 
-	if(!ntree)
+	if (!ntree)
 		return NULL;
 
 	/* check for group edit */
-	for(node= ntree->nodes.first; node; node= node->next)
-		if(node->flag & NODE_GROUP_EDIT)
+	for (node= ntree->nodes.first; node; node= node->next)
+		if (node->flag & NODE_GROUP_EDIT)
 			break;
 
-	if(node)
+	if (node)
 		ntree= (bNodeTree*)node->id;
 
-	for(node= ntree->nodes.first; node; node= node->next)
-		if(node->flag & NODE_ACTIVE_TEXTURE)
+	for (node= ntree->nodes.first; node; node= node->next)
+		if (node->flag & NODE_ACTIVE_TEXTURE)
 			return node;
 	
 	return NULL;
@@ -330,38 +281,31 @@ void ntreeExecGPUNodes(bNodeTreeExec *exec, GPUMaterial *mat, int do_outputs)
 
 	stack= exec->stack;
 
-	for(n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
+	for (n=0, nodeexec= exec->nodeexec; n < exec->totnodes; ++n, ++nodeexec) {
 		node = nodeexec->node;
 		
 		doit = 0;
 		/* for groups, only execute outputs for edited group */
-		if(node->typeinfo->nclass==NODE_CLASS_OUTPUT) {
-			if(do_outputs && (node->flag & NODE_DO_OUTPUT))
+		if (node->typeinfo->nclass==NODE_CLASS_OUTPUT) {
+			if (do_outputs && (node->flag & NODE_DO_OUTPUT))
 				doit = 1;
 		}
 		else
 			doit = 1;
 
 		if (doit) {
-			if((node->flag & NODE_MUTED) && node->typeinfo->gpumutefunc) {
-				node_get_stack(node, stack, nsin, nsout);
-				gpu_stack_from_data_list(gpuin, &node->inputs, nsin);
-				gpu_stack_from_data_list(gpuout, &node->outputs, nsout);
-				if(node->typeinfo->gpumutefunc(mat, node, nodeexec->data, gpuin, gpuout))
-					data_from_gpu_stack_list(&node->outputs, nsout, gpuout);
-			}
-			else if(node->typeinfo->gpufunc) {
+			if (node->typeinfo->gpufunc) {
 				node_get_stack(node, stack, nsin, nsout);
 				gpu_stack_from_data_list(gpuin, &node->inputs, nsin);
 				gpu_stack_from_data_list(gpuout, &node->outputs, nsout);
-				if(node->typeinfo->gpufunc(mat, node, gpuin, gpuout))
+				if (node->typeinfo->gpufunc(mat, node, gpuin, gpuout))
 					data_from_gpu_stack_list(&node->outputs, nsout, gpuout);
 			}
-			else if(node->typeinfo->gpuextfunc) {
+			else if (node->typeinfo->gpuextfunc) {
 				node_get_stack(node, stack, nsin, nsout);
 				gpu_stack_from_data_list(gpuin, &node->inputs, nsin);
 				gpu_stack_from_data_list(gpuout, &node->outputs, nsout);
-				if(node->typeinfo->gpuextfunc(mat, node, nodeexec->data, gpuin, gpuout))
+				if (node->typeinfo->gpuextfunc(mat, node, nodeexec->data, gpuin, gpuout))
 					data_from_gpu_stack_list(&node->outputs, nsout, gpuout);
 			}
 		}
@@ -375,7 +319,7 @@ void node_shader_gpu_tex_mapping(GPUMaterial *mat, bNode *node, GPUNodeStack *in
 	float domin= (texmap->flag & TEXMAP_CLIP_MIN) != 0;
 	float domax= (texmap->flag & TEXMAP_CLIP_MAX) != 0;
 
-	if(domin || domax || !(texmap->flag & TEXMAP_UNIT_MATRIX)) {
+	if (domin || domax || !(texmap->flag & TEXMAP_UNIT_MATRIX)) {
 		GPUNodeLink *tmat = GPU_uniform((float*)texmap->mat);
 		GPUNodeLink *tmin = GPU_uniform(texmap->min);
 		GPUNodeLink *tmax = GPU_uniform(texmap->max);
diff --git a/source/blender/nodes/shader/node_shader_util.h b/source/blender/nodes/shader/node_shader_util.h
index d345f3f..37c272a 100644
--- a/source/blender/nodes/shader/node_shader_util.h
+++ b/source/blender/nodes/shader/node_shader_util.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NODE_SHADER_UTIL_H_
-#define NODE_SHADER_UTIL_H_
+#ifndef __NODE_SHADER_UTIL_H__
+#define __NODE_SHADER_UTIL_H__
 
 #include <math.h>
 #include <float.h>
@@ -128,7 +128,4 @@ void node_shader_gpu_tex_mapping(struct GPUMaterial *mat, struct bNode *node, st
 
 void ntreeExecGPUNodes(struct bNodeTreeExec *exec, struct GPUMaterial *mat, int do_outputs);
 
-void node_shader_pass_on(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out);
-int gpu_shader_pass_on(struct GPUMaterial *mat, struct bNode *node, void *nodedata, struct GPUNodeStack *in, struct GPUNodeStack *out);
-
 #endif
diff --git a/source/blender/nodes/shader/nodes/node_shader_camera.c b/source/blender/nodes/shader/nodes/node_shader_camera.c
index 3ec75df..69a6a5c 100644
--- a/source/blender/nodes/shader/nodes/node_shader_camera.c
+++ b/source/blender/nodes/shader/nodes/node_shader_camera.c
@@ -43,7 +43,7 @@ static bNodeSocketTemplate sh_node_camera_out[]= {
 
 static void node_shader_exec_camera(void *data, bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **out)
 {
-	if(data) {
+	if (data) {
 		ShadeInput *shi= ((ShaderCallData *)data)->shi;  /* Data we need for shading. */
 		
 		copy_v3_v3(out[0]->vec, shi->co);		/* get view vector */
diff --git a/source/blender/nodes/shader/nodes/node_shader_curves.c b/source/blender/nodes/shader/nodes/node_shader_curves.c
index d30434f..50bf4c5 100644
--- a/source/blender/nodes/shader/nodes/node_shader_curves.c
+++ b/source/blender/nodes/shader/nodes/node_shader_curves.c
@@ -106,7 +106,7 @@ static void node_shader_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeSta
 	/* stack order output: vec */
 	nodestack_get_vec(vec, SOCK_VECTOR, in[1]);
 	curvemapping_evaluateRGBF(node->storage, out[0]->vec, vec);
-	if(in[0]->vec[0] != 1.0f) {
+	if (in[0]->vec[0] != 1.0f) {
 		interp_v3_v3v3(out[0]->vec, vec, out[0]->vec, *in[0]->vec);
 	}
 }
diff --git a/source/blender/nodes/shader/nodes/node_shader_dynamic.c b/source/blender/nodes/shader/nodes/node_shader_dynamic.c
index e55b1b1..5a6a92b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_dynamic.c
+++ b/source/blender/nodes/shader/nodes/node_shader_dynamic.c
@@ -83,7 +83,7 @@ static bNodeType *node_dynamic_find_typeinfo(ListBase *list, ID *id)
 {
 	bNodeType *ntype = list->first;
 
-	while(ntype) {
+	while (ntype) {
 		if (ntype->type == NODE_DYNAMIC && ntype->id == id)
 			break;
 		ntype = ntype->next;
@@ -459,7 +459,8 @@ static int node_dynamic_parse(struct bNode *node)
 	if (!pyresult) {
 		if (BTST(node->custom1, NODE_DYNAMIC_LOADED)) {
 			node_dynamic_disable(node);
-		} else {
+		}
+		else {
 		node_dynamic_disable_all_by_id(node->id);
 		}
 		node_dynamic_pyerror_print(node);
@@ -574,7 +575,8 @@ static void node_dynamic_setup(bNode *node)
 			}
 			else { nodeMakeDynamicType(node); }
 
-		} else {
+		}
+		else {
 			node_dynamic_rem_all_links(node->typeinfo);
 			node_dynamic_free_typeinfo_sockets(node->typeinfo);
 			node_dynamic_update_socket_links(node, NULL);
@@ -654,7 +656,7 @@ static void node_dynamic_setup(bNode *node)
  *  0: for loaded empty nodes
  *  NODE_DYNAMIC_MENU: for the default Dynamic node type
  *  > NODE_DYNAMIC_MENU: for the new types defined by scripts
-*/
+ */
 static void node_dynamic_init_cb(bNode *node)
 {
 	int type = node->custom2;
@@ -718,8 +720,10 @@ static void node_dynamic_exec_cb(void *data, bNode *node, bNodeStack **in, bNode
 	if (!node->id)
 		return;
 
-	/*if (G.scene->r.threads > 1)
-		return;*/
+#if 0
+	if (G.scene->r.threads > 1)
+		return;
+#endif
 
 	if (BTST2(node->custom1, NODE_DYNAMIC_NEW, NODE_DYNAMIC_REPARSE)) {
 		node_dynamic_setup(node);
diff --git a/source/blender/nodes/shader/nodes/node_shader_geom.c b/source/blender/nodes/shader/nodes/node_shader_geom.c
index cf6f400..5e30239 100644
--- a/source/blender/nodes/shader/nodes/node_shader_geom.c
+++ b/source/blender/nodes/shader/nodes/node_shader_geom.c
@@ -53,17 +53,17 @@ static bNodeSocketTemplate sh_node_geom_out[]= {
 /* node execute callback */
 static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out)
 {
-	if(data) {
+	if (data) {
 		ShadeInput *shi= ((ShaderCallData *)data)->shi;
 		NodeGeometry *ngeo= (NodeGeometry*)node->storage;
 		ShadeInputUV *suv= &shi->uv[shi->actuv];
 		static float defaultvcol[4] = {1.0f, 1.0f, 1.0f, 1.0f};
 		int i;
 
-		if(ngeo->uvname[0]) {
+		if (ngeo->uvname[0]) {
 			/* find uv map by name */
-			for(i = 0; i < shi->totuv; i++) {
-				if(strcmp(shi->uv[i].name, ngeo->uvname)==0) {
+			for (i = 0; i < shi->totuv; i++) {
+				if (strcmp(shi->uv[i].name, ngeo->uvname)==0) {
 					suv= &shi->uv[i];
 					break;
 				}
@@ -82,9 +82,9 @@ static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(i
 			/* find vertex color layer by name */
 			ShadeInputCol *scol= &shi->col[0];
 
-			if(ngeo->colname[0]) {
-				for(i = 0; i < shi->totcol; i++) {
-					if(strcmp(shi->col[i].name, ngeo->colname)==0) {
+			if (ngeo->colname[0]) {
+				for (i = 0; i < shi->totcol; i++) {
+					if (strcmp(shi->col[i].name, ngeo->colname)==0) {
 						scol= &shi->col[i];
 						break;
 					}
@@ -95,12 +95,12 @@ static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(i
 			out[GEOM_OUT_VCOL]->vec[3]= scol->col[3];
 			out[GEOM_OUT_VCOL_ALPHA]->vec[0]= scol->col[3];
 		}
-		else  {
+		else {
 			memcpy(out[GEOM_OUT_VCOL]->vec, defaultvcol, sizeof(defaultvcol));
 			out[GEOM_OUT_VCOL_ALPHA]->vec[0]= 1.0f;
 		}
 		
-		if(shi->osatex) {
+		if (shi->osatex) {
 			out[GEOM_OUT_GLOB]->data= shi->dxgl;
 			out[GEOM_OUT_GLOB]->datatype= NS_OSA_VECTORS;
 			out[GEOM_OUT_LOCAL]->data= shi->dxco;
diff --git a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
index 0f85196..12b97e6 100644
--- a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
+++ b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
@@ -50,12 +50,12 @@ static bNodeSocketTemplate sh_node_hue_sat_out[]= {
 /* note: it would be possible to use CMP version for both nodes */
 static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float *hue, float *sat, float *val, float *in, float *fac)
 {
-	if(*fac!=0.0f && (*hue!=0.5f || *sat!=1.0f || *val!=1.0f)) {
+	if (*fac!=0.0f && (*hue!=0.5f || *sat!=1.0f || *val!=1.0f)) {
 		float col[3], hsv[3], mfac= 1.0f - *fac;
 		
 		rgb_to_hsv(in[0], in[1], in[2], hsv, hsv+1, hsv+2);
 		hsv[0]+= (*hue - 0.5f);
-		if(hsv[0]>1.0f) hsv[0]-=1.0f; else if(hsv[0]<0.0f) hsv[0]+= 1.0f;
+		if (hsv[0]>1.0f) hsv[0]-=1.0f; else if (hsv[0]<0.0f) hsv[0]+= 1.0f;
 		hsv[1]*= *sat;
 		hsv[2]*= *val;
 		hsv_to_rgb(hsv[0], hsv[1], hsv[2], col, col+1, col+2);
diff --git a/source/blender/nodes/shader/nodes/node_shader_mapping.c b/source/blender/nodes/shader/nodes/node_shader_mapping.c
index c2a58d4..b7b080f 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mapping.c
+++ b/source/blender/nodes/shader/nodes/node_shader_mapping.c
@@ -54,15 +54,15 @@ static void node_shader_exec_mapping(void *UNUSED(data), bNode *node, bNodeStack
 	nodestack_get_vec(vec, SOCK_VECTOR, in[0]);
 	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 (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(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 (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];
 	}
 }
 
diff --git a/source/blender/nodes/shader/nodes/node_shader_material.c b/source/blender/nodes/shader/nodes/node_shader_material.c
index decd3bb..279bbfa 100644
--- a/source/blender/nodes/shader/nodes/node_shader_material.c
+++ b/source/blender/nodes/shader/nodes/node_shader_material.c
@@ -78,7 +78,7 @@ static bNodeSocketTemplate sh_node_material_ext_out[]= {
 
 static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
 {
-	if(data && node->id) {
+	if (data && node->id) {
 		ShadeResult shrnode;
 		ShadeInput *shi;
 		ShaderCallData *shcd= data;
@@ -103,17 +103,17 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
 		shi->har= shi->mat->har;
 		
 		/* write values */
-		if(hasinput[MAT_IN_COLOR])
+		if (hasinput[MAT_IN_COLOR])
 			nodestack_get_vec(&shi->r, SOCK_VECTOR, in[MAT_IN_COLOR]);
 		
-		if(hasinput[MAT_IN_SPEC])
+		if (hasinput[MAT_IN_SPEC])
 			nodestack_get_vec(&shi->specr, SOCK_VECTOR, in[MAT_IN_SPEC]);
 		
-		if(hasinput[MAT_IN_REFL])
+		if (hasinput[MAT_IN_REFL])
 			nodestack_get_vec(&shi->refl, SOCK_FLOAT, in[MAT_IN_REFL]);
 		
 		/* retrieve normal */
-		if(hasinput[MAT_IN_NORMAL]) {
+		if (hasinput[MAT_IN_NORMAL]) {
 			nodestack_get_vec(shi->vn, SOCK_VECTOR, in[MAT_IN_NORMAL]);
 			normalize_v3(shi->vn);
 		}
@@ -121,24 +121,24 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
 			copy_v3_v3(shi->vn, shi->vno);
 		
 		/* custom option to flip normal */
-		if(node->custom1 & SH_NODE_MAT_NEG) {
+		if (node->custom1 & SH_NODE_MAT_NEG) {
 			negate_v3(shi->vn);
 		}
 		
 		if (node->type == SH_NODE_MATERIAL_EXT) {
-			if(hasinput[MAT_IN_MIR])
+			if (hasinput[MAT_IN_MIR])
 				nodestack_get_vec(&shi->mirr, SOCK_VECTOR, in[MAT_IN_MIR]);
-			if(hasinput[MAT_IN_AMB])
+			if (hasinput[MAT_IN_AMB])
 				nodestack_get_vec(&shi->amb, SOCK_FLOAT, in[MAT_IN_AMB]);
-			if(hasinput[MAT_IN_EMIT])
+			if (hasinput[MAT_IN_EMIT])
 				nodestack_get_vec(&shi->emit, SOCK_FLOAT, in[MAT_IN_EMIT]);
-			if(hasinput[MAT_IN_SPECTRA])
+			if (hasinput[MAT_IN_SPECTRA])
 				nodestack_get_vec(&shi->spectra, SOCK_FLOAT, in[MAT_IN_SPECTRA]);
-			if(hasinput[MAT_IN_RAY_MIRROR])
+			if (hasinput[MAT_IN_RAY_MIRROR])
 				nodestack_get_vec(&shi->ray_mirror, SOCK_FLOAT, in[MAT_IN_RAY_MIRROR]);
-			if(hasinput[MAT_IN_ALPHA])
+			if (hasinput[MAT_IN_ALPHA])
 				nodestack_get_vec(&shi->alpha, SOCK_FLOAT, in[MAT_IN_ALPHA]);
-			if(hasinput[MAT_IN_TRANSLUCENCY])
+			if (hasinput[MAT_IN_TRANSLUCENCY])
 				nodestack_get_vec(&shi->translucency, SOCK_FLOAT, in[MAT_IN_TRANSLUCENCY]);			
 		}
 		
@@ -147,13 +147,13 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
 		shi->nodes= 0;
 		
 		/* write to outputs */
-		if(node->custom1 & SH_NODE_MAT_DIFF) {
+		if (node->custom1 & SH_NODE_MAT_DIFF) {
 			copy_v3_v3(col, shrnode.combined);
-			if(!(node->custom1 & SH_NODE_MAT_SPEC)) {
+			if (!(node->custom1 & SH_NODE_MAT_SPEC)) {
 				sub_v3_v3(col, shrnode.spec);
 			}
 		}
-		else if(node->custom1 & SH_NODE_MAT_SPEC) {
+		else if (node->custom1 & SH_NODE_MAT_SPEC) {
 			copy_v3_v3(col, shrnode.spec);
 		}
 		else
@@ -161,13 +161,13 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
 		
 		col[3]= shrnode.alpha;
 		
-		if(shi->do_preview)
+		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;
 		
-		if(node->custom1 & SH_NODE_MAT_NEG) {
+		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];
@@ -185,7 +185,7 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
 		}
 		
 		/* copy passes, now just active node */
-		if(node->flag & NODE_ACTIVE_ID) {
+		if (node->flag & NODE_ACTIVE_ID) {
 			float combined[4], alpha;
 
 			copy_v4_v4(combined, shcd->shr->combined);
@@ -218,7 +218,7 @@ static GPUNodeLink *gpu_get_input_link(GPUNodeStack *in)
 
 static int gpu_shader_material(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
 {
-	if(node->id) {
+	if (node->id) {
 		GPUShadeInput shi;
 		GPUShadeResult shr;
 		bNodeSocket *sock;
@@ -235,47 +235,47 @@ static int gpu_shader_material(GPUMaterial *mat, bNode *node, GPUNodeStack *in,
 		GPU_shadeinput_set(mat, (Material*)node->id, &shi);
 
 		/* write values */
-		if(hasinput[MAT_IN_COLOR])
+		if (hasinput[MAT_IN_COLOR])
 			shi.rgb = gpu_get_input_link(&in[MAT_IN_COLOR]);
 		
-		if(hasinput[MAT_IN_SPEC])
+		if (hasinput[MAT_IN_SPEC])
 			shi.specrgb = gpu_get_input_link(&in[MAT_IN_SPEC]);
 		
-		if(hasinput[MAT_IN_REFL])
+		if (hasinput[MAT_IN_REFL])
 			shi.refl = gpu_get_input_link(&in[MAT_IN_REFL]);
 		
 		/* retrieve normal */
-		if(hasinput[MAT_IN_NORMAL]) {
+		if (hasinput[MAT_IN_NORMAL]) {
 			GPUNodeLink *tmp;
 			shi.vn = gpu_get_input_link(&in[MAT_IN_NORMAL]);
 			GPU_link(mat, "vec_math_normalize", shi.vn, &shi.vn, &tmp);
 		}
 		
 		/* custom option to flip normal */
-		if(node->custom1 & SH_NODE_MAT_NEG)
+		if (node->custom1 & SH_NODE_MAT_NEG)
 			GPU_link(mat, "vec_math_negate", shi.vn, &shi.vn);
 
 		if (node->type == SH_NODE_MATERIAL_EXT) {
-			if(hasinput[MAT_IN_AMB])
+			if (hasinput[MAT_IN_AMB])
 				shi.amb= gpu_get_input_link(&in[MAT_IN_AMB]);
-			if(hasinput[MAT_IN_EMIT])
+			if (hasinput[MAT_IN_EMIT])
 				shi.emit= gpu_get_input_link(&in[MAT_IN_EMIT]);
-			if(hasinput[MAT_IN_ALPHA])
+			if (hasinput[MAT_IN_ALPHA])
 				shi.alpha= gpu_get_input_link(&in[MAT_IN_ALPHA]);
 		}
 
 		GPU_shaderesult_set(&shi, &shr); /* clears shr */
 		
 		/* write to outputs */
-		if(node->custom1 & SH_NODE_MAT_DIFF) {
+		if (node->custom1 & SH_NODE_MAT_DIFF) {
 			out[MAT_OUT_COLOR].link= shr.combined;
 
-			if(!(node->custom1 & SH_NODE_MAT_SPEC)) {
+			if (!(node->custom1 & SH_NODE_MAT_SPEC)) {
 				GPUNodeLink *link;
 				GPU_link(mat, "vec_math_sub", shr.combined, shr.spec, &out[MAT_OUT_COLOR].link, &link);
 			}
 		}
-		else if(node->custom1 & SH_NODE_MAT_SPEC) {
+		else if (node->custom1 & SH_NODE_MAT_SPEC) {
 			out[MAT_OUT_COLOR].link= shr.spec;
 		}
 		else
@@ -285,7 +285,7 @@ static int gpu_shader_material(GPUMaterial *mat, bNode *node, GPUNodeStack *in,
 
 		out[MAT_OUT_ALPHA].link = shr.alpha; //
 		
-		if(node->custom1 & SH_NODE_MAT_NEG)
+		if (node->custom1 & SH_NODE_MAT_NEG)
 			GPU_link(mat, "vec_math_negate", shi.vn, &shi.vn);
 		out[MAT_OUT_NORMAL].link = shi.vn;
 
diff --git a/source/blender/nodes/shader/nodes/node_shader_math.c b/source/blender/nodes/shader/nodes/node_shader_math.c
index c9234c6..44df496 100644
--- a/source/blender/nodes/shader/nodes/node_shader_math.c
+++ b/source/blender/nodes/shader/nodes/node_shader_math.c
@@ -35,8 +35,8 @@
 
 /* **************** SCALAR MATH ******************** */ 
 static bNodeSocketTemplate sh_node_math_in[]= { 
-	{ SOCK_FLOAT, 1, "Value", 0.5f, 0.5f, 0.5f, 1.0f, -100.0f, 100.0f, PROP_NONE}, 
-	{ SOCK_FLOAT, 1, "Value", 0.5f, 0.5f, 0.5f, 1.0f, -100.0f, 100.0f, PROP_NONE}, 
+	{ SOCK_FLOAT, 1, "Value", 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, 
+	{ SOCK_FLOAT, 1, "Value", 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, 
 	{ -1, 0, "" } 
 };
 
@@ -48,7 +48,7 @@ static bNodeSocketTemplate sh_node_math_out[]= {
 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]; 
@@ -61,7 +61,7 @@ bNodeStack **out)
 		break; 
 	case 3: /* Divide */
 		{
-			if(in[1]->vec[0]==0)	/* We don't want to divide by zero. */
+			if (in[1]->vec[0]==0)	/* We don't want to divide by zero. */
 				out[0]->vec[0]= 0.0;
 			else
 				out[0]->vec[0]= in[0]->vec[0] / in[1]->vec[0];
@@ -69,7 +69,7 @@ bNodeStack **out)
 		break;
 	case 4: /* Sine */
 		{
-			if(in[0]->hasinput || !in[1]->hasinput)  /* This one only takes one input, so we've got to choose. */
+			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]);
 			else
 				out[0]->vec[0]= sin(in[1]->vec[0]);
@@ -77,7 +77,7 @@ bNodeStack **out)
 		break;
 	case 5: /* Cosine */
 		{
-			if(in[0]->hasinput || !in[1]->hasinput)  /* This one only takes one input, so we've got to choose. */	
+			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]);
@@ -85,7 +85,7 @@ bNodeStack **out)
 		break;
 	case 6: /* Tangent */
 		{
-			if(in[0]->hasinput || !in[1]->hasinput)  /* This one only takes one input, so we've got to choose. */	
+			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]);
@@ -93,16 +93,16 @@ bNodeStack **out)
 		break;
 	case 7: /* Arc-Sine */
 		{
-			if(in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */
+			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 )
+				if ( in[0]->vec[0] <= 1 && in[0]->vec[0] >= -1 )
 					out[0]->vec[0]= asin(in[0]->vec[0]);
 				else
 					out[0]->vec[0]= 0.0;
 			}
 			else {
 				/* Can't do the impossible... */
-				if( in[1]->vec[0] <= 1 && in[1]->vec[0] >= -1 )
+				if ( in[1]->vec[0] <= 1 && in[1]->vec[0] >= -1 )
 					out[0]->vec[0]= asin(in[1]->vec[0]);
 				else
 					out[0]->vec[0]= 0.0;
@@ -111,16 +111,16 @@ bNodeStack **out)
 		break;
 	case 8: /* Arc-Cosine */
 		{
-			if(in[0]->hasinput || !in[1]->hasinput) { /* This one only takes one input, so we've got to choose. */
+			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 )
+				if ( in[0]->vec[0] <= 1 && in[0]->vec[0] >= -1 )
 					out[0]->vec[0]= acos(in[0]->vec[0]);
 				else
 					out[0]->vec[0]= 0.0;
 			}
 			else {
 				/* Can't do the impossible... */
-				if( in[1]->vec[0] <= 1 && in[1]->vec[0] >= -1 )
+				if ( in[1]->vec[0] <= 1 && in[1]->vec[0] >= -1 )
 					out[0]->vec[0]= acos(in[1]->vec[0]);
 				else
 					out[0]->vec[0]= 0.0;
@@ -129,7 +129,7 @@ bNodeStack **out)
 		break;
 	case 9: /* Arc-Tangent */
 		{
-			if(in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
+			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]);
 			else
 				out[0]->vec[0]= atan(in[1]->vec[0]);
@@ -138,7 +138,7 @@ bNodeStack **out)
 	case 10: /* Power */
 		{
 			/* Don't want any imaginary numbers... */
-			if( in[0]->vec[0] >= 0 )
+			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;
@@ -147,7 +147,7 @@ bNodeStack **out)
 	case 11: /* Logarithm */
 		{
 			/* Don't want any imaginary numbers... */
-			if( in[0]->vec[0] > 0  && in[1]->vec[0] > 0 )
+			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]);
 			else
 				out[0]->vec[0]= 0.0;
@@ -155,7 +155,7 @@ bNodeStack **out)
 		break;
 	case 12: /* Minimum */
 		{
-			if( in[0]->vec[0] < in[1]->vec[0] )
+			if ( in[0]->vec[0] < in[1]->vec[0] )
 				out[0]->vec[0]= in[0]->vec[0];
 			else
 				out[0]->vec[0]= in[1]->vec[0];
@@ -163,7 +163,7 @@ bNodeStack **out)
 		break;
 	case 13: /* Maximum */
 		{
-			if( in[0]->vec[0] > in[1]->vec[0] )
+			if ( in[0]->vec[0] > in[1]->vec[0] )
 				out[0]->vec[0]= in[0]->vec[0];
 			else
 				out[0]->vec[0]= in[1]->vec[0];
@@ -171,7 +171,7 @@ bNodeStack **out)
 		break;
 	case 14: /* Round */
 		{
-			if(in[0]->hasinput || !in[1]->hasinput) /* This one only takes one input, so we've got to choose. */
+			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);
 			else
 				out[0]->vec[0]= (in[1]->vec[0]<0)?(int)(in[1]->vec[0] - 0.5f):(int)(in[1]->vec[0] + 0.5f);
@@ -179,7 +179,7 @@ bNodeStack **out)
 		break;
 	case 15: /* Less Than */
 		{
-			if( in[0]->vec[0] < in[1]->vec[0] )
+			if ( in[0]->vec[0] < in[1]->vec[0] )
 				out[0]->vec[0]= 1.0f;
 			else
 				out[0]->vec[0]= 0.0f;
@@ -187,7 +187,7 @@ bNodeStack **out)
 		break;
 	case 16: /* Greater Than */
 		{
-			if( in[0]->vec[0] > in[1]->vec[0] )
+			if ( in[0]->vec[0] > in[1]->vec[0] )
 				out[0]->vec[0]= 1.0f;
 			else
 				out[0]->vec[0]= 0.0f;
@@ -224,7 +224,7 @@ 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)
+			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]));
diff --git a/source/blender/nodes/shader/nodes/node_shader_normal.c b/source/blender/nodes/shader/nodes/node_shader_normal.c
index 8515c99..3421355 100644
--- a/source/blender/nodes/shader/nodes/node_shader_normal.c
+++ b/source/blender/nodes/shader/nodes/node_shader_normal.c
@@ -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]= -INPR(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_output.c b/source/blender/nodes/shader/nodes/node_shader_output.c
index 5bc6185..14a115a 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output.c
+++ b/source/blender/nodes/shader/nodes/node_shader_output.c
@@ -41,7 +41,7 @@ static bNodeSocketTemplate sh_node_output_in[]= {
 
 static void node_shader_exec_output(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(out))
 {
-	if(data) {
+	if (data) {
 		ShadeInput *shi= ((ShaderCallData *)data)->shi;
 		float col[4];
 		
@@ -49,12 +49,12 @@ static void node_shader_exec_output(void *data, bNode *node, bNodeStack **in, bN
 		nodestack_get_vec(col, SOCK_VECTOR, in[0]);
 		nodestack_get_vec(col+3, SOCK_FLOAT, in[1]);
 		
-		if(shi->do_preview) {
+		if (shi->do_preview) {
 			nodeAddToPreview(node, col, shi->xs, shi->ys, shi->do_manage);
 			node->lasty= shi->ys;
 		}
 		
-		if(node->flag & NODE_DO_OUTPUT) {
+		if (node->flag & NODE_DO_OUTPUT) {
 			ShadeResult *shr= ((ShaderCallData *)data)->shr;
 			
 			copy_v4_v4(shr->combined, col);
@@ -69,8 +69,10 @@ static int gpu_shader_output(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack
 {
 	GPUNodeLink *outlink;
 
-	/*if(in[1].hasinput)
-		GPU_material_enable_alpha(mat);*/
+#if 0
+	if (in[1].hasinput)
+		GPU_material_enable_alpha(mat);
+#endif
 
 	GPU_stack_link(mat, "output_node", in, out, &outlink);
 	GPU_material_output_link(mat, outlink);
@@ -90,8 +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_mute(&ntype, NULL, NULL);
-	node_type_gpu_mute(&ntype, NULL);
+	node_type_internal_connect(&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 cf2542c..f6d5e78 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output_lamp.c
+++ b/source/blender/nodes/shader/nodes/node_shader_output_lamp.c
@@ -49,8 +49,7 @@ void register_node_type_sh_output_lamp(bNodeTreeType *ttype)
 	node_type_gpu(&ntype, NULL);
 
 	/* Do not allow muting output node. */
-	node_type_mute(&ntype, NULL, NULL);
-	node_type_gpu_mute(&ntype, NULL);
+	node_type_internal_connect(&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 298df3b..13d8ff1 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output_material.c
+++ b/source/blender/nodes/shader/nodes/node_shader_output_material.c
@@ -62,8 +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_mute(&ntype, NULL, NULL);
-	node_type_gpu_mute(&ntype, NULL);
+	node_type_internal_connect(&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 711f591..5063d0b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output_world.c
+++ b/source/blender/nodes/shader/nodes/node_shader_output_world.c
@@ -50,8 +50,7 @@ void register_node_type_sh_output_world(bNodeTreeType *ttype)
 	node_type_gpu(&ntype, NULL);
 
 	/* Do not allow muting output node. */
-	node_type_mute(&ntype, NULL, NULL);
-	node_type_gpu_mute(&ntype, NULL);
+	node_type_internal_connect(&ntype, NULL);
 
 	nodeRegisterType(ttype, &ntype);
 }
diff --git a/source/blender/nodes/shader/nodes/node_shader_squeeze.c b/source/blender/nodes/shader/nodes/node_shader_squeeze.c
index ded9306..6483851 100644
--- a/source/blender/nodes/shader/nodes/node_shader_squeeze.c
+++ b/source/blender/nodes/shader/nodes/node_shader_squeeze.c
@@ -54,7 +54,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(2.71828183,-((vec[0]-vec[2])*vec[1]))) ;
+	out[0]->vec[0] = 1.0f / (1.0f + pow(2.71828183, -((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_tex_checker.c b/source/blender/nodes/shader/nodes/node_shader_tex_checker.c
index 551b70d..2fff2ba 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_checker.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_checker.c
@@ -54,7 +54,7 @@ static void node_shader_init_tex_checker(bNodeTree *UNUSED(ntree), bNode* node,
 
 static int node_shader_gpu_tex_checker(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
 {
-	if(!in[0].link)
+	if (!in[0].link)
 		in[0].link = GPU_attribute(CD_ORCO, "");
 
 	node_shader_gpu_tex_mapping(mat, node, in, out);
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 dbdd6a8..852c056 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
@@ -44,7 +44,8 @@ static void node_shader_init_tex_environment(bNodeTree *UNUSED(ntree), bNode* no
 	NodeTexEnvironment *tex = MEM_callocN(sizeof(NodeTexEnvironment), "NodeTexEnvironment");
 	default_tex_mapping(&tex->base.tex_mapping);
 	default_color_mapping(&tex->base.color_mapping);
-	tex->color_space = SHD_COLORSPACE_SRGB;
+	tex->color_space = SHD_COLORSPACE_COLOR;
+	tex->projection = SHD_PROJ_EQUIRECTANGULAR;
 
 	node->storage = tex;
 }
@@ -54,13 +55,13 @@ static int node_shader_gpu_tex_environment(GPUMaterial *mat, bNode *node, GPUNod
 	Image *ima= (Image*)node->id;
 	ImageUser *iuser= NULL;
 
-	if(!ima) {
+	if (!ima) {
 		float black[4] = {0.0f, 0.0f, 0.0f, 1.0f};
 		GPUNodeLink *vec = GPU_uniform(black);
 		return GPU_stack_link(mat, "set_rgba", out, out, vec);
 	}
 
-	if(!in[0].link)
+	if (!in[0].link)
 		in[0].link = GPU_builtin(GPU_VIEW_POSITION);
 
 	node_shader_gpu_tex_mapping(mat, node, in, out);
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 a2403b6..769cf84 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.c
@@ -52,7 +52,7 @@ static void node_shader_init_tex_gradient(bNodeTree *UNUSED(ntree), bNode* node,
 
 static int node_shader_gpu_tex_gradient(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
 {
-	if(!in[0].link)
+	if (!in[0].link)
 		in[0].link = GPU_attribute(CD_ORCO, "");
 
 	node_shader_gpu_tex_mapping(mat, node, in, out);
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 aa679b4..28dcada 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_image.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.c
@@ -36,6 +36,7 @@ static bNodeSocketTemplate sh_node_tex_image_in[]= {
 
 static bNodeSocketTemplate sh_node_tex_image_out[]= {
 	{	SOCK_RGBA, 0, "Color",		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+	{	SOCK_FLOAT, 0, "Alpha",		0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
 	{	-1, 0, ""	}
 };
 
@@ -44,7 +45,7 @@ static void node_shader_init_tex_image(bNodeTree *UNUSED(ntree), bNode* node, bN
 	NodeTexImage *tex = MEM_callocN(sizeof(NodeTexImage), "NodeTexImage");
 	default_tex_mapping(&tex->base.tex_mapping);
 	default_color_mapping(&tex->base.color_mapping);
-	tex->color_space = SHD_COLORSPACE_SRGB;
+	tex->color_space = SHD_COLORSPACE_COLOR;
 
 	node->storage = tex;
 }
@@ -54,13 +55,13 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, bNode *node, GPUNodeStack
 	Image *ima= (Image*)node->id;
 	ImageUser *iuser= NULL;
 
-	if(!ima) {
+	if (!ima) {
 		float black[4] = {0.0f, 0.0f, 0.0f, 1.0f};
 		GPUNodeLink *vec = GPU_uniform(black);
 		return GPU_stack_link(mat, "set_rgba", out, out, vec);
 	}
 	
-	if(!in[0].link)
+	if (!in[0].link)
 		in[0].link = GPU_attribute(CD_MTFACE, "");
 
 	node_shader_gpu_tex_mapping(mat, node, in, out);
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 3a27022..e2c0cfc 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_magic.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_magic.c
@@ -57,7 +57,7 @@ static int node_shader_gpu_tex_magic(GPUMaterial *mat, bNode *node, GPUNodeStack
 	NodeTexMagic *tex = (NodeTexMagic*)node->storage;
 	float depth = tex->depth;
 
-	if(!in[0].link)
+	if (!in[0].link)
 		in[0].link = GPU_attribute(CD_ORCO, "");
 
 	node_shader_gpu_tex_mapping(mat, node, in, out);
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 015b786..9fe3e65 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c
@@ -58,7 +58,7 @@ static void node_shader_init_tex_musgrave(bNodeTree *UNUSED(ntree), bNode* node,
 
 static int node_shader_gpu_tex_musgrave(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
 {
-	if(!in[0].link)
+	if (!in[0].link)
 		in[0].link = GPU_attribute(CD_ORCO, "");
 
 	node_shader_gpu_tex_mapping(mat, node, in, out);
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 bb365cf..2667d2a 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_noise.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_noise.c
@@ -54,7 +54,7 @@ static void node_shader_init_tex_noise(bNodeTree *UNUSED(ntree), bNode* node, bN
 
 static int node_shader_gpu_tex_noise(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
 {
-	if(!in[0].link)
+	if (!in[0].link)
 		in[0].link = GPU_attribute(CD_ORCO, "");
 
 	node_shader_gpu_tex_mapping(mat, node, in, out);
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 a4131f3..b4855fa 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_sky.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_sky.c
@@ -54,7 +54,7 @@ static void node_shader_init_tex_sky(bNodeTree *UNUSED(ntree), bNode* node, bNod
 
 static int node_shader_gpu_tex_sky(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
 {
-	if(!in[0].link)
+	if (!in[0].link)
 		in[0].link = GPU_attribute(CD_ORCO, "");
 
 	node_shader_gpu_tex_mapping(mat, node, in, out);
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 9adaab2..eebd488 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c
@@ -53,7 +53,7 @@ static void node_shader_init_tex_voronoi(bNodeTree *UNUSED(ntree), bNode* node,
 
 static int node_shader_gpu_tex_voronoi(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
 {
-	if(!in[0].link)
+	if (!in[0].link)
 		in[0].link = GPU_attribute(CD_ORCO, "");
 
 	node_shader_gpu_tex_mapping(mat, node, in, out);
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 d359a40..3e079ff 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_wave.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_wave.c
@@ -56,7 +56,7 @@ static void node_shader_init_tex_wave(bNodeTree *UNUSED(ntree), bNode* node, bNo
 
 static int node_shader_gpu_tex_wave(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
 {
-	if(!in[0].link)
+	if (!in[0].link)
 		in[0].link = GPU_attribute(CD_ORCO, "");
 
 	node_shader_gpu_tex_mapping(mat, node, in, out);
diff --git a/source/blender/nodes/shader/nodes/node_shader_texture.c b/source/blender/nodes/shader/nodes/node_shader_texture.c
index 0281849..8b6386f 100644
--- a/source/blender/nodes/shader/nodes/node_shader_texture.c
+++ b/source/blender/nodes/shader/nodes/node_shader_texture.c
@@ -48,7 +48,7 @@ static bNodeSocketTemplate sh_node_texture_out[]= {
 
 static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
 {
-	if(data && node->id) {
+	if (data && node->id) {
 		ShadeInput *shi= ((ShaderCallData *)data)->shi;
 		TexResult texres;
 		bNodeSocket *sock_vector= node->inputs.first;
@@ -65,14 +65,14 @@ static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, b
 		texres.tr= texres.tg= texres.tb= 0.0f;
 		
 		/* don't use in[0]->hasinput, see material node for explanation */
-		if(sock_vector->link) {
+		if (sock_vector->link) {
 			nodestack_get_vec(vec, SOCK_VECTOR, in[0]);
 			
-			if(in[0]->datatype==NS_OSA_VECTORS) {
+			if (in[0]->datatype==NS_OSA_VECTORS) {
 				float *fp= in[0]->data;
 				retval= multitex_nodes((Tex *)node->id, vec, fp, fp+3, shi->osatex, &texres, thread, which_output, NULL, NULL);
 			}
-			else if(in[0]->datatype==NS_OSA_VALUES) {
+			else if (in[0]->datatype==NS_OSA_VALUES) {
 				float *fp= in[0]->data;
 				float dxt[3], dyt[3];
 				
@@ -89,18 +89,18 @@ static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, b
 		}
 		
 		/* stupid exception */
-		if( ((Tex *)node->id)->type==TEX_STUCCI) {
+		if ( ((Tex *)node->id)->type==TEX_STUCCI) {
 			texres.tin= 0.5f + 0.7f*texres.nor[0];
 			CLAMP(texres.tin, 0.0f, 1.0f);
 		}
 		
 		/* intensity and color need some handling */
-		if(texres.talpha)
+		if (texres.talpha)
 			out[0]->vec[0]= texres.ta;
 		else
 			out[0]->vec[0]= texres.tin;
 		
-		if((retval & TEX_RGB)==0) {
+		if ((retval & TEX_RGB)==0) {
 			out[1]->vec[0]= out[0]->vec[0];
 			out[1]->vec[1]= out[0]->vec[0];
 			out[1]->vec[2]= out[0]->vec[0];
@@ -115,7 +115,7 @@ static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, b
 		
 		copy_v3_v3(out[2]->vec, nor);
 		
-		if(shi->do_preview)
+		if (shi->do_preview)
 			nodeAddToPreview(node, out[1]->vec, shi->xs, shi->ys, shi->do_manage);
 		
 	}
@@ -125,7 +125,7 @@ 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) {
+	if (tex && tex->type == TEX_IMAGE && tex->ima) {
 		GPUNodeLink *texlink = GPU_image(tex->ima, NULL);
 		return GPU_stack_link(mat, "texture_image", in, out, texlink);
 	}
diff --git a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c
index f0a9492..7e51313 100644
--- a/source/blender/nodes/shader/nodes/node_shader_valToRgb.c
+++ b/source/blender/nodes/shader/nodes/node_shader_valToRgb.c
@@ -48,7 +48,7 @@ static void node_shader_exec_valtorgb(void *UNUSED(data), bNode *node, bNodeStac
 	/* stack order in: fac */
 	/* stack order out: col, alpha */
 	
-	if(node->storage) {
+	if (node->storage) {
 		float fac;
 		nodestack_get_vec(&fac, SOCK_FLOAT, in[0]);
 
@@ -76,7 +76,7 @@ void register_node_type_sh_valtorgb(bNodeTreeType *ttype)
 	static bNodeType ntype;
 
 	node_type_base(ttype, &ntype, SH_NODE_VALTORGB, "ColorRamp", NODE_CLASS_CONVERTOR, NODE_OPTIONS);
-	node_type_compatibility(&ntype, NODE_OLD_SHADING);
+	node_type_compatibility(&ntype, NODE_OLD_SHADING|NODE_NEW_SHADING);
 	node_type_socket_templates(&ntype, sh_node_valtorgb_in, sh_node_valtorgb_out);
 	node_type_size(&ntype, 240, 200, 300);
 	node_type_init(&ntype, node_shader_init_valtorgb);
diff --git a/source/blender/nodes/shader/nodes/node_shader_vectMath.c b/source/blender/nodes/shader/nodes/node_shader_vectMath.c
index 75dbff1..a0fe67d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_vectMath.c
+++ b/source/blender/nodes/shader/nodes/node_shader_vectMath.c
@@ -36,8 +36,8 @@
 
 /* **************** VECTOR MATH ******************** */ 
 static bNodeSocketTemplate sh_node_vect_math_in[]= { 
-	{ SOCK_VECTOR, 1, "Vector", 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f, PROP_NONE}, 
-	{ SOCK_VECTOR, 1, "Vector", 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f, PROP_NONE}, 
+        { SOCK_VECTOR, 1, "Vector", 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE},
+        { SOCK_VECTOR, 1, "Vector", 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE},
 	{ -1, 0, "" } 
 };
 
@@ -54,39 +54,39 @@ static void node_shader_exec_vect_math(void *UNUSED(data), bNode *node, bNodeSta
 	nodestack_get_vec(vec1, SOCK_VECTOR, in[0]);
 	nodestack_get_vec(vec2, SOCK_VECTOR, in[1]);
 	
-	if(node->custom1 == 0) {	/* Add */
+	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[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 */
+	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[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 */
+	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[1]->vec[0] = normalize_v3( out[0]->vec );
 	}
-	else if(node->custom1 == 3) {	/* Dot product */
+	else if (node->custom1 == 3) {	/* Dot product */
 		out[1]->vec[0]= (vec1[0] * vec2[0]) + (vec1[1] * vec2[1]) + (vec1[2] * vec2[2]);
 	}
-	else if(node->custom1 == 4) {	/* Cross product */
+	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[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. */
+	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];
@@ -118,7 +118,7 @@ static int gpu_shader_vect_math(GPUMaterial *mat, bNode *node, GPUNodeStack *in,
 				GPU_socket(&in[0]), GPU_socket(&in[1]));
 			break;
 		case 5:
-			if(in[0].hasinput || !in[1].hasinput)
+			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]));
diff --git a/source/blender/nodes/texture/node_texture_tree.c b/source/blender/nodes/texture/node_texture_tree.c
index 1e171bd..add9fdb 100644
--- a/source/blender/nodes/texture/node_texture_tree.c
+++ b/source/blender/nodes/texture/node_texture_tree.c
@@ -57,8 +57,8 @@
 static void foreach_nodetree(Main *main, void *calldata, bNodeTreeCallback func)
 {
 	Tex *tx;
-	for(tx= main->tex.first; tx; tx= tx->id.next) {
-		if(tx->nodetree) {
+	for (tx= main->tex.first; tx; tx= tx->id.next) {
+		if (tx->nodetree) {
 			func(calldata, &tx->id, tx->nodetree);
 		}
 	}
@@ -77,17 +77,32 @@ static void foreach_nodeclass(Scene *UNUSED(scene), void *calldata, bNodeClassCa
 	func(calldata, NODE_CLASS_LAYOUT, IFACE_("Layout"));
 }
 
+static void localize(bNodeTree *localtree, bNodeTree *UNUSED(ntree))
+{
+	bNode *node, *node_next;
+	
+	/* replace muted nodes by internal links */
+	for (node= localtree->nodes.first; node; node= node_next) {
+		node_next = node->next;
+		
+		if (node->flag & NODE_MUTED) {
+			nodeInternalRelink(localtree, node);
+			nodeFreeNode(localtree, node);
+		}
+	}
+}
+
 static void local_sync(bNodeTree *localtree, bNodeTree *ntree)
 {
 	bNode *lnode;
 	
 	/* copy over contents of previews */
-	for(lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
-		if(ntreeNodeExists(ntree, lnode->new_node)) {
+	for (lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
+		if (ntreeNodeExists(ntree, lnode->new_node)) {
 			bNode *node= lnode->new_node;
 			
-			if(node->preview && node->preview->rect) {
-				if(lnode->preview && lnode->preview->rect) {
+			if (node->preview && node->preview->rect) {
+				if (lnode->preview && lnode->preview->rect) {
 					int xsize= node->preview->xsize;
 					int ysize= node->preview->ysize;
 					memcpy(node->preview->rect, lnode->preview->rect, 4*xsize + xsize*ysize*sizeof(char)*4);
@@ -107,30 +122,28 @@ bNodeTreeType ntreeType_Texture = {
 	/* free_node_cache */		NULL,
 	/* foreach_nodetree */	foreach_nodetree,
 	/* foreach_nodeclass */	foreach_nodeclass,
-	/* localize */			NULL,
+	/* localize */			localize,
 	/* local_sync */		local_sync,
 	/* local_merge */		NULL,
 	/* update */			NULL,
 	/* update_node */		NULL,
 	/* validate_link */		NULL,
-	/* mute node */			node_tex_pass_on,
-	/* mute links node */	node_mute_get_links,
-	/* gpu mute node */		NULL
+	/* internal_connect */	node_internal_connect_default
 };
 
 int ntreeTexTagAnimated(bNodeTree *ntree)
 {
 	bNode *node;
 	
-	if(ntree==NULL) return 0;
+	if (ntree==NULL) return 0;
 	
-	for(node= ntree->nodes.first; node; node= node->next) {
-		if(node->type==TEX_NODE_CURVE_TIME) {
+	for (node= ntree->nodes.first; node; node= node->next) {
+		if (node->type==TEX_NODE_CURVE_TIME) {
 			nodeUpdate(ntree, node);
 			return 1;
 		}
-		else if(node->type==NODE_GROUP) {
-			if( ntreeTexTagAnimated((bNodeTree *)node->id) ) {
+		else if (node->type==NODE_GROUP) {
+			if ( ntreeTexTagAnimated((bNodeTree *)node->id) ) {
 				return 1;
 			}
 		}
@@ -161,7 +174,7 @@ bNodeTreeExec *ntreeTexBeginExecTree(bNodeTree *ntree, int use_tree_data)
 	/* allocate the thread stack listbase array */
 	exec->threadstack= MEM_callocN(BLENDER_MAX_THREADS*sizeof(ListBase), "thread stack array");
 	
-	for(node= exec->nodetree->nodes.first; node; node= node->next)
+	for (node= exec->nodetree->nodes.first; node; node= node->next)
 		node->need_exec= 1;
 	
 	if (use_tree_data) {
@@ -181,10 +194,10 @@ static void tex_free_delegates(bNodeTreeExec *exec)
 	bNodeStack *ns;
 	int th, a;
 	
-	for(th=0; th<BLENDER_MAX_THREADS; th++)
-		for(nts=exec->threadstack[th].first; nts; nts=nts->next)
-			for(ns= nts->stack, a=0; a<exec->stacksize; a++, ns++)
-				if(ns->data && !ns->is_copy)
+	for (th=0; th<BLENDER_MAX_THREADS; th++)
+		for (nts=exec->threadstack[th].first; nts; nts=nts->next)
+			for (ns= nts->stack, a=0; a<exec->stacksize; a++, ns++)
+				if (ns->data && !ns->is_copy)
 					MEM_freeN(ns->data);
 }
 
@@ -193,16 +206,16 @@ static void tex_free_delegates(bNodeTreeExec *exec)
  */
 void ntreeTexEndExecTree(bNodeTreeExec *exec, int use_tree_data)
 {
-	if(exec) {
+	if (exec) {
 		bNodeTree *ntree= exec->nodetree;
 		bNodeThreadStack *nts;
 		int a;
 		
-		if(exec->threadstack) {
+		if (exec->threadstack) {
 			tex_free_delegates(exec);
 			
-			for(a=0; a<BLENDER_MAX_THREADS; a++) {
-				for(nts=exec->threadstack[a].first; nts; nts=nts->next)
+			for (a=0; a<BLENDER_MAX_THREADS; a++) {
+				for (nts=exec->threadstack[a].first; nts; nts=nts->next)
 					if (nts->stack) MEM_freeN(nts->stack);
 				BLI_freelistN(&exec->threadstack[a]);
 			}
@@ -233,7 +246,7 @@ int ntreeTexExecTree(
 	int preview,
 	ShadeInput *shi,
 	MTex *mtex
-){
+) {
 	TexCallData data;
 	float *nor= texres->nor;
 	int retval = TEX_INT;
@@ -255,7 +268,7 @@ int ntreeTexExecTree(
 	/* ensure execdata is only initialized once */
 	if (!exec) {
 		BLI_lock_thread(LOCK_NODES);
-		if(!nodes->execdata)
+		if (!nodes->execdata)
 			ntreeTexBeginExecTree(nodes, 1);
 		BLI_unlock_thread(LOCK_NODES);
 
@@ -266,7 +279,7 @@ int ntreeTexExecTree(
 	ntreeExecThreadNodes(exec, nts, &data, thread);
 	ntreeReleaseThreadStack(nts);
 
-	if(texres->nor) retval |= TEX_NOR;
+	if (texres->nor) retval |= TEX_NOR;
 	retval |= TEX_RGB;
 	/* confusing stuff; the texture output node sets this to NULL to indicate no normal socket was set
 	   however, the texture code checks this for other reasons (namely, a normal is required for material) */
diff --git a/source/blender/nodes/texture/node_texture_util.c b/source/blender/nodes/texture/node_texture_util.c
index 06ee4b0..255ed9e 100644
--- a/source/blender/nodes/texture/node_texture_util.c
+++ b/source/blender/nodes/texture/node_texture_util.c
@@ -53,10 +53,10 @@
 
 static void tex_call_delegate(TexDelegate *dg, float *out, TexParams *params, short thread)
 {
-	if(dg->node->need_exec) {
+	if (dg->node->need_exec) {
 		dg->fn(out, params, dg->node, dg->in, thread);
 
-		if(dg->cdata->do_preview)
+		if (dg->cdata->do_preview)
 			tex_do_preview(dg->node, params->previewco, out);
 	}
 }
@@ -64,10 +64,10 @@ static void tex_call_delegate(TexDelegate *dg, float *out, TexParams *params, sh
 static void tex_input(float *out, int sz, bNodeStack *in, TexParams *params, short thread)
 {
 	TexDelegate *dg = in->data;
-	if(dg) {
+	if (dg) {
 		tex_call_delegate(dg, in->vec, params, thread);
 	
-		if(in->hasoutput && in->sockettype == SOCK_FLOAT)
+		if (in->hasoutput && in->sockettype == SOCK_FLOAT)
 			in->vec[1] = in->vec[2] = in->vec[0];
 	}
 	memcpy(out, in->vec, sz * sizeof(float));
@@ -82,13 +82,12 @@ void tex_input_rgba(float *out, bNodeStack *in, TexParams *params, short thread)
 {
 	tex_input(out, 4, in, params, thread);
 	
-	if(in->hasoutput && in->sockettype == SOCK_FLOAT)
-	{
+	if (in->hasoutput && in->sockettype == SOCK_FLOAT) {
 		out[1] = out[2] = out[0];
 		out[3] = 1;
 	}
 	
-	if(in->hasoutput && in->sockettype == SOCK_VECTOR) {
+	if (in->hasoutput && in->sockettype == SOCK_VECTOR) {
 		out[0] = out[0] * .5f + .5f;
 		out[1] = out[1] * .5f + .5f;
 		out[2] = out[2] * .5f + .5f;
@@ -119,7 +118,7 @@ void tex_do_preview(bNode *node, float *co, float *col)
 {
 	bNodePreview *preview= node->preview;
 
-	if(preview) {
+	if (preview) {
 		int xs= ((co[0] + 1.0f)*0.5f)*preview->xsize;
 		int ys= ((co[1] + 1.0f)*0.5f)*preview->ysize;
 
@@ -130,7 +129,7 @@ void tex_do_preview(bNode *node, float *co, float *col)
 void tex_output(bNode *node, bNodeStack **in, bNodeStack *out, TexFn texfn, TexCallData *cdata)
 {
 	TexDelegate *dg;
-	if(!out->data)
+	if (!out->data)
 		/* Freed in tex_end_exec (node.c) */
 		dg = out->data = MEM_mallocN(sizeof(TexDelegate), "tex delegate");
 	else
@@ -143,116 +142,24 @@ void tex_output(bNode *node, bNodeStack **in, bNodeStack *out, TexFn texfn, TexC
 	dg->type = out->sockettype;
 }
 
-/* Used for muted nodes, just pass the TexDelegate data from input to output…
- * XXX That *%!?¿§ callback TextureDelegate system is a nightmare here!
- *     So I have to use an ugly hack (checking inputs twice!)… Yuk!
- *     I’d be very happy if someone can imagine a better solution
- *     (without changing the whole stuff).
- * WARNING: These are only suitable for default muting behavior. If you want a custom
- *          one for your texnode, you must not use them!
- */
-static void passonvalfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
-{
-	bNodeSocket *sock;
-	int i;
-
-	/* test the inputs */
-	for(i=0, sock = node->inputs.first; sock; sock = sock->next, i++) {
-		if(sock->link && sock->type==SOCK_FLOAT && in) {
-			out[0] = tex_input_value(in[i], p, thread);
-			break;
-		}
-	}
-}
-
-static void passonvecfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
-{
-	bNodeSocket *sock;
-	int i;
-
-	/* test the inputs */
-	for(i=0, sock = node->inputs.first; sock; sock = sock->next, i++) {
-		if(sock->link && sock->type==SOCK_VECTOR && in) {
-			tex_input_vec(out, in[i], p, thread);
-			break;
-		}
-	}
-}
-
-static void passoncolfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
-{
-	bNodeSocket *sock;
-	int i;
-
-	/* test the inputs */
-	for(i=0, sock = node->inputs.first; sock; sock = sock->next, i++) {
-		if(sock->link && sock->type==SOCK_RGBA && in) {
-			tex_input_rgba(out, in[i], p, thread);
-			break;
-		}
-	}
-}
-
-void node_tex_pass_on(void *data, int UNUSED(thread), struct bNode *node, void *UNUSED(nodedata),
-                      struct bNodeStack **in, struct bNodeStack **out)
-{
-	ListBase links;
-	LinkInOutsMuteNode *lnk;
-	int i;
-
-	if(node->typeinfo->mutelinksfunc == NULL)
-		return;
-
-	/* Get default muting links (as bNodeStack pointers). */
-	links = node->typeinfo->mutelinksfunc(NULL, node, in, out, NULL, NULL);
-
-	for(lnk = links.first; lnk; lnk = lnk->next) {
-		/* XXX This breaks the generality of the system.
-		 *     Again, unfortunately, I see no other way to do due to tex nodes behavior...
-		 */
-		void (*passonfn)(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread);
-		switch(((bNodeStack*)(lnk->in))->sockettype) {
-		case SOCK_FLOAT:
-			passonfn = passonvalfn;
-			break;
-		case SOCK_VECTOR:
-			passonfn = passonvecfn;
-			break;
-		case SOCK_RGBA:
-			passonfn = passoncolfn;
-			break;
-		default:
-			passonfn = NULL;
-		}
-		for(i = 0; i < lnk->num_outs; i++) {
-			if(((bNodeStack*)(lnk->in))->data && passonfn)
-				tex_output(node, in, ((bNodeStack*)(lnk->outs))+i, passonfn, data);
-		}
-		/* If num_outs > 1, lnk->outs was an allocated table of pointers... */
-		if(i > 1)
-			MEM_freeN(lnk->outs);
-	}
-	BLI_freelistN(&links);
-}
-
 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)
-		{
+		if (node->type == TEX_NODE_TEXTURE && node->id) {
 			/* custom2 stops the node from rendering */
-			if(node->custom1) {
+			if (node->custom1) {
 				node->custom2 = 1;
 				node->custom1 = 0;
-			} else {
+			}
+			else {
 				Tex *tex = (Tex *)node->id;
 				
 				node->custom2 = 0;
 			
 				node->custom1 = 1;
-				if(tex->use_nodes && tex->nodetree) {
+				if (tex->use_nodes && tex->nodetree) {
 					ntreeTexCheckCyclics(tex->nodetree);
 				}
 				node->custom1 = 0;
diff --git a/source/blender/nodes/texture/node_texture_util.h b/source/blender/nodes/texture/node_texture_util.h
index 5095a97..c9a5a02 100644
--- a/source/blender/nodes/texture/node_texture_util.h
+++ b/source/blender/nodes/texture/node_texture_util.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef NODE_TEXTURE_UTIL_H_
-#define NODE_TEXTURE_UTIL_H_
+#ifndef __NODE_TEXTURE_UTIL_H__
+#define __NODE_TEXTURE_UTIL_H__
 
 #include <math.h>
 #include <string.h>
@@ -119,6 +119,4 @@ void tex_do_preview(bNode *node, float *coord, float *col);
 
 void params_from_cdata(TexParams *out, TexCallData *in);
 
-void node_tex_pass_on(void *data, int thread, struct bNode *node, void *nodedata, struct bNodeStack **in, struct bNodeStack **out);
-
 #endif
diff --git a/source/blender/nodes/texture/nodes/node_texture_bricks.c b/source/blender/nodes/texture/nodes/node_texture_bricks.c
index 9e76309..ac87997 100644
--- a/source/blender/nodes/texture/nodes/node_texture_bricks.c
+++ b/source/blender/nodes/texture/nodes/node_texture_bricks.c
@@ -91,7 +91,7 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
 	
 	rownum = (int)floor(y / row_height);
 	
-	if( node->custom1 && node->custom2 ) {
+	if ( node->custom1 && node->custom2 ) {
 		brick_width *= ((int)(rownum) % node->custom2 ) ? 1.0f : node->custom4;      /* squash */
 		offset = ((int)(rownum) % node->custom1 ) ? 0 : (brick_width*node->custom3); /* offset */
 	}
@@ -104,11 +104,12 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
 	tint = noise((rownum << 16) + (bricknum & 0xFFFF)) + bias;
 	CLAMP(tint,0.0f,1.0f);
 	
-	if( ins_x < mortar_thickness || ins_y < mortar_thickness ||
+	if ( ins_x < mortar_thickness || ins_y < mortar_thickness ||
 		ins_x > (brick_width - mortar_thickness) ||
 		ins_y > (row_height - mortar_thickness) ) {
 		copy_v4_v4( out, mortar );
-	} else {
+	}
+	else {
 		copy_v4_v4( out, bricks1 );
 		ramp_blend( MA_RAMP_BLEND, out, tint, bricks2 );
 	}
diff --git a/source/blender/nodes/texture/nodes/node_texture_checker.c b/source/blender/nodes/texture/nodes/node_texture_checker.c
index 6b58482..c96a73d 100644
--- a/source/blender/nodes/texture/nodes/node_texture_checker.c
+++ b/source/blender/nodes/texture/nodes/node_texture_checker.c
@@ -57,9 +57,10 @@ static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **
 	int yi = (int)fabs(floor(0.00001f + y / sz));
 	int zi = (int)fabs(floor(0.00001f + z / sz));
 	
-	if( (xi % 2 == yi % 2) == (zi % 2) ) {
+	if ( (xi % 2 == yi % 2) == (zi % 2) ) {
 		tex_input_rgba(out, in[0], p, thread);
-	} else {
+	}
+	else {
 		tex_input_rgba(out, in[1], p, thread);
 	} 
 }
diff --git a/source/blender/nodes/texture/nodes/node_texture_compose.c b/source/blender/nodes/texture/nodes/node_texture_compose.c
index 5256db9..a3ac196 100644
--- a/source/blender/nodes/texture/nodes/node_texture_compose.c
+++ b/source/blender/nodes/texture/nodes/node_texture_compose.c
@@ -48,7 +48,7 @@ static bNodeSocketTemplate outputs[]= {
 static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **in, short thread)
 {
 	int i;
-	for(i = 0; i < 4; i++)
+	for (i = 0; i < 4; i++)
 		out[i] = tex_input_value(in[i], p, thread);
 }
 
diff --git a/source/blender/nodes/texture/nodes/node_texture_curves.c b/source/blender/nodes/texture/nodes/node_texture_curves.c
index 08e7efc..0f7213a 100644
--- a/source/blender/nodes/texture/nodes/node_texture_curves.c
+++ b/source/blender/nodes/texture/nodes/node_texture_curves.c
@@ -46,7 +46,7 @@ static void time_colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNU
 	/* stack order output: fac */
 	float fac= 0.0f;
 	
-	if(node->custom1 < node->custom2)
+	if (node->custom1 < node->custom2)
 		fac = (p->cfra - node->custom1)/(float)(node->custom2-node->custom1);
 	
 	fac = curvemapping_evaluateF(node->storage, 0, fac);
diff --git a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
index e566fb0..d5a957a 100644
--- a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
+++ b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
@@ -49,16 +49,16 @@ static bNodeSocketTemplate outputs[]= {
 
 static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float hue, float sat, float val, float *in, float fac)
 {
-	if(fac != 0 && (hue != 0.5f || sat != 1 || val != 1)) {
+	if (fac != 0 && (hue != 0.5f || sat != 1 || val != 1)) {
 		float col[3], hsv[3], mfac= 1.0f - fac;
 		
 		rgb_to_hsv(in[0], in[1], in[2], hsv, hsv+1, hsv+2);
 		hsv[0]+= (hue - 0.5f);
-		if(hsv[0]>1.0f) hsv[0]-=1.0f; else if(hsv[0]<0.0f) hsv[0]+= 1.0f;
+		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];
diff --git a/source/blender/nodes/texture/nodes/node_texture_image.c b/source/blender/nodes/texture/nodes/node_texture_image.c
index 0acfe62..d0bc300 100644
--- a/source/blender/nodes/texture/nodes/node_texture_image.c
+++ b/source/blender/nodes/texture/nodes/node_texture_image.c
@@ -45,9 +45,9 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNUSED(i
 	Image *ima= (Image *)node->id;
 	ImageUser *iuser= (ImageUser *)node->storage;
 	
-	if( ima ) {
+	if ( ima ) {
 		ImBuf *ibuf = BKE_image_get_ibuf(ima, iuser);
-		if( ibuf ) {
+		if ( ibuf ) {
 			float xsize, ysize;
 			float xoff, yoff;
 			int px, py;
@@ -61,19 +61,19 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNUSED(i
 			px = (int)( (x-xoff) * xsize );
 			py = (int)( (y-yoff) * ysize );
 		
-			if( (!xsize) || (!ysize) ) return;
+			if ( (!xsize) || (!ysize) ) return;
 			
-			if( !ibuf->rect_float ) {
+			if ( !ibuf->rect_float ) {
 				BLI_lock_thread(LOCK_IMAGE);
-				if( !ibuf->rect_float )
+				if ( !ibuf->rect_float )
 					IMB_float_from_rect(ibuf);
 				BLI_unlock_thread(LOCK_IMAGE);
 			}
 			
-			while( px < 0 ) px += ibuf->x;
-			while( py < 0 ) py += ibuf->y;
-			while( px >= ibuf->x ) px -= ibuf->x;
-			while( py >= ibuf->y ) py -= ibuf->y;
+			while ( px < 0 ) px += ibuf->x;
+			while ( py < 0 ) py += ibuf->y;
+			while ( px >= ibuf->x ) px -= ibuf->x;
+			while ( py >= ibuf->y ) py -= ibuf->y;
 			
 			result = ibuf->rect_float + py*ibuf->x*4 + px*4;
 			copy_v4_v4( out, result );
diff --git a/source/blender/nodes/texture/nodes/node_texture_math.c b/source/blender/nodes/texture/nodes/node_texture_math.c
index 4659aa2..29d154d 100644
--- a/source/blender/nodes/texture/nodes/node_texture_math.c
+++ b/source/blender/nodes/texture/nodes/node_texture_math.c
@@ -51,7 +51,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
 	float in0 = tex_input_value(in[0], p, thread);
 	float in1 = tex_input_value(in[1], p, thread);
 	
-	switch(node->custom1){ 
+	switch(node->custom1) {
 	
 	case 0: /* Add */
 		*out= in0 + in1; 
@@ -64,7 +64,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
 		break; 
 	case 3: /* Divide */
 		{
-			if(in1==0)	/* We don't want to divide by zero. */
+			if (in1==0)	/* We don't want to divide by zero. */
 				*out= 0.0;
 			else
 				*out= in0 / in1;
@@ -88,7 +88,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
 	case 7: /* Arc-Sine */
 		{
 			/* Can't do the impossible... */
-			if( in0 <= 1 && in0 >= -1 )
+			if ( in0 <= 1 && in0 >= -1 )
 				*out= asin(in0);
 			else
 				*out= 0.0;
@@ -97,7 +97,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
 	case 8: /* Arc-Cosine */
 		{
 			/* Can't do the impossible... */
-			if( in0 <= 1 && in0 >= -1 )
+			if ( in0 <= 1 && in0 >= -1 )
 				*out= acos(in0);
 			else
 				*out= 0.0;
@@ -111,13 +111,15 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
 	case 10: /* Power */
 		{
 			/* Only raise negative numbers by full integers */
-			if( in0 >= 0 ) {
+			if ( in0 >= 0 ) {
 				out[0]= pow(in0, in1);
-			} else {
+			}
+			else {
 				float y_mod_1 = fmod(in1, 1);
 				if (y_mod_1 > 0.999f || y_mod_1 < 0.001f) {
 					*out = pow(in0, floor(in1 + 0.5f));
-				} else {
+				}
+				else {
 					*out = 0.0;
 				}
 			}
@@ -126,7 +128,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
 	case 11: /* Logarithm */
 		{
 			/* Don't want any imaginary numbers... */
-			if( in0 > 0  && in1 > 0 )
+			if ( in0 > 0  && in1 > 0 )
 				*out= log(in0) / log(in1);
 			else
 				*out= 0.0;
@@ -134,7 +136,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
 		break;
 	case 12: /* Minimum */
 		{
-			if( in0 < in1 )
+			if ( in0 < in1 )
 				*out= in0;
 			else
 				*out= in1;
@@ -142,7 +144,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
 		break;
 	case 13: /* Maximum */
 		{
-			if( in0 > in1 )
+			if ( in0 > in1 )
 				*out= in0;
 			else
 				*out= in1;
@@ -156,7 +158,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
 		
 	case 15: /* Less Than */
 		{
-			if( in0 < in1 )
+			if ( in0 < in1 )
 				*out= 1.0f;
 			else
 				*out= 0.0f;
@@ -165,7 +167,7 @@ static void valuefn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
 		
 	case 16: /* Greater Than */
 		{
-			if( in0 > in1 )
+			if ( in0 > in1 )
 				*out= 1.0f;
 			else
 				*out= 0.0f;
diff --git a/source/blender/nodes/texture/nodes/node_texture_output.c b/source/blender/nodes/texture/nodes/node_texture_output.c
index 829cd06..2b899fd 100644
--- a/source/blender/nodes/texture/nodes/node_texture_output.c
+++ b/source/blender/nodes/texture/nodes/node_texture_output.c
@@ -46,11 +46,11 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(o
 	TexCallData *cdata = (TexCallData *)data;
 	TexResult *target = cdata->target;
 	
-	if(cdata->do_preview) {
+	if (cdata->do_preview) {
 		TexParams params;
 		params_from_cdata(&params, cdata);
 
-		if(in[1] && in[1]->hasinput && !in[0]->hasinput)
+		if (in[1] && in[1]->hasinput && !in[0]->hasinput)
 			tex_input_rgba(&target->tr, in[1], &params, cdata->thread);
 		else
 			tex_input_rgba(&target->tr, in[0], &params, cdata->thread);
@@ -58,7 +58,7 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(o
 	}
 	else {
 		/* 0 means don't care, so just use first */
-		if(cdata->which_output == node->custom1 || (cdata->which_output == 0 && node->custom1 == 1)) {
+		if (cdata->which_output == node->custom1 || (cdata->which_output == 0 && node->custom1 == 1)) {
 			TexParams params;
 			params_from_cdata(&params, cdata);
 			
@@ -67,8 +67,8 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(o
 			target->tin = (target->tr + target->tg + target->tb) / 3.0f;
 			target->talpha = 1;
 		
-			if(target->nor) {
-				if(in[1] && in[1]->hasinput)
+			if (target->nor) {
+				if (in[1] && in[1]->hasinput)
 					tex_input_vec(target->nor, in[1], &params, cdata->thread);
 				else
 					target->nor = NULL;
@@ -87,23 +87,24 @@ static void unique_name(bNode *node)
 	char *name = tno->name;
 	
 	i = node;
-	while(i->prev) i = i->prev;
-	for(; i; i=i->next) {
-		if(
+	while (i->prev) i = i->prev;
+	for (; i; i=i->next) {
+		if (
 			i == node ||
 			i->type != TEX_NODE_OUTPUT ||
 			strcmp(name, ((TexNodeOutput*)(i->storage))->name)
 		)
 			continue;
 		
-		if(!new_name) {
+		if (!new_name) {
 			int len = strlen(name);
-			if(len >= 4 && sscanf(name + len - 4, ".%03d", &suffix) == 1) {
+			if (len >= 4 && sscanf(name + len - 4, ".%03d", &suffix) == 1) {
 				new_len = len;
-			} else {
+			}
+			else {
 				suffix = 0;
 				new_len = len + 4;
-				if(new_len > (sizeof(tno->name) - 1))
+				if (new_len > (sizeof(tno->name) - 1))
 					new_len = (sizeof(tno->name) - 1);
 			}
 			
@@ -114,7 +115,7 @@ static void unique_name(bNode *node)
 		sprintf(new_name + new_len - 4, ".%03d", ++suffix);
 	}
 	
-	if(new_name) {
+	if (new_name) {
 		strcpy(tno->name, new_name);
 		MEM_freeN(new_name);
 	}
@@ -126,13 +127,13 @@ static void assign_index(struct bNode *node)
 	int index = 1;
 	
 	tnode = node;
-	while(tnode->prev)
+	while (tnode->prev)
 		tnode = tnode->prev;
 	
 	check_index:
-	for(; tnode; tnode= tnode->next)
-		if(tnode->type == TEX_NODE_OUTPUT && tnode != node)
-			if(tnode->custom1 == index) {
+	for (; tnode; tnode= tnode->next)
+		if (tnode->type == TEX_NODE_OUTPUT && tnode != node)
+			if (tnode->custom1 == index) {
 				index ++;
 				goto check_index;
 			}
@@ -169,7 +170,7 @@ void register_node_type_tex_output(bNodeTreeType *ttype)
 	node_type_exec(&ntype, exec);
 	
 	/* Do not allow muting output. */
-	node_type_mute(&ntype, NULL, NULL);
+	node_type_internal_connect(&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 efc8228..348827b 100644
--- a/source/blender/nodes/texture/nodes/node_texture_proc.c
+++ b/source/blender/nodes/texture/nodes/node_texture_proc.c
@@ -62,7 +62,7 @@ static void do_proc(float *result, TexParams *p, float *col1, float *col2, char
 	TexResult texres;
 	int textype;
 	
-	if(is_normal) {
+	if (is_normal) {
 		texres.nor = result;
 	}
 	else
@@ -71,10 +71,10 @@ static void do_proc(float *result, TexParams *p, float *col1, float *col2, char
 	textype = multitex_nodes(tex, p->co, p->dxt, p->dyt, p->osatex,
 		&texres, thread, 0, p->shi, p->mtex);
 	
-	if(is_normal)
+	if (is_normal)
 		return;
 	
-	if(textype & TEX_RGB) {
+	if (textype & TEX_RGB) {
 		copy_v4_v4(result, &texres.tr);
 	}
 	else {
@@ -108,7 +108,7 @@ static int count_outputs(bNode *node)
 {
 	bNodeSocket *sock;
 	int num = 0;
-	for(sock= node->outputs.first; sock; sock= sock->next) {
+	for (sock= node->outputs.first; sock; sock= sock->next) {
 		num++;
 	}
 	return num;
@@ -132,8 +132,8 @@ static int count_outputs(bNode *node)
 		static void name##_exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)                  \
 		{                                                                                                    \
 				int outs = count_outputs(node);                                                              \
-				if(outs >= 1) tex_output(node, in, out[0], &name##_colorfn, data);                                 \
-				if(outs >= 2) tex_output(node, in, out[1], &name##_normalfn, data);                                \
+				if (outs >= 1) tex_output(node, in, out[0], &name##_colorfn, data);                                 \
+				if (outs >= 2) tex_output(node, in, out[1], &name##_normalfn, data);                                \
 		}
 
 
@@ -289,7 +289,7 @@ static void init(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(nt
 	default_tex(tex);
 	tex->type = node->type - TEX_NODE_PROC;
 	
-	if(tex->type == TEX_WOOD)
+	if (tex->type == TEX_WOOD)
 		tex->stype = TEX_BANDNOISE;
 	
 }
diff --git a/source/blender/nodes/texture/nodes/node_texture_texture.c b/source/blender/nodes/texture/nodes/node_texture_texture.c
index d408b87..bf93231 100644
--- a/source/blender/nodes/texture/nodes/node_texture_texture.c
+++ b/source/blender/nodes/texture/nodes/node_texture_texture.c
@@ -63,11 +63,11 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
 		zero_v3(dyt);
 	}
 	
-	if(node->custom2 || node->need_exec==0) {
+	if (node->custom2 || node->need_exec==0) {
 		/* this node refers to its own texture tree! */
 		copy_v4_v4(out, (fabs(co[0] - co[1]) < .01) ? white : red );
 	}
-	else if(nodetex) {
+	else if (nodetex) {
 		TexResult texres;
 		int textype;
 		float nor[] = {0,0,0};
@@ -80,7 +80,7 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
 		textype = multitex_nodes(nodetex, co, dxt, dyt, p->osatex,
 			&texres, thread, 0, p->shi, p->mtex);
 		
-		if(textype & TEX_RGB) {
+		if (textype & TEX_RGB) {
 			copy_v4_v4(out, &texres.tr);
 		}
 		else {
diff --git a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c
index c0efa43..1d282b4 100644
--- a/source/blender/nodes/texture/nodes/node_texture_valToRgb.c
+++ b/source/blender/nodes/texture/nodes/node_texture_valToRgb.c
@@ -45,7 +45,7 @@ static bNodeSocketTemplate valtorgb_out[]= {
 
 static void valtorgb_colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, short thread)
 {
-	if(node->storage) {
+	if (node->storage) {
 		float fac = tex_input_value(in[0], p, thread);
 
 		do_colorband(node->storage, fac, out);
diff --git a/source/blender/nodes/texture/nodes/node_texture_viewer.c b/source/blender/nodes/texture/nodes/node_texture_viewer.c
index a588f13..0d7a04b 100644
--- a/source/blender/nodes/texture/nodes/node_texture_viewer.c
+++ b/source/blender/nodes/texture/nodes/node_texture_viewer.c
@@ -46,7 +46,7 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **UNUSED(o
 {
 	TexCallData *cdata = (TexCallData *)data;
 
-	if(cdata->do_preview) {
+	if (cdata->do_preview) {
 		TexParams params;
 		float col[4];
 		params_from_cdata(&params, cdata);
@@ -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_mute(&ntype, NULL, NULL);
+	node_type_internal_connect(&ntype, NULL);
 	
 	nodeRegisterType(ttype, &ntype);
 }
diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h
index 51f9063..33ea139 100644
--- a/source/blender/python/BPY_extern.h
+++ b/source/blender/python/BPY_extern.h
@@ -34,8 +34,8 @@
 
 
 
-#ifndef BPY_EXTERN_H
-#define BPY_EXTERN_H
+#ifndef __BPY_EXTERN_H__
+#define __BPY_EXTERN_H__
 
 struct Text; /* defined in DNA_text_types.h */
 struct ID; /* DNA_ID.h */
@@ -89,4 +89,4 @@ void	BPY_id_release(struct ID *id);
 }				/* extern "C" */
 #endif
 
-#endif  /* BPY_EXTERN_H */
+#endif  /* __BPY_EXTERN_H__ */
diff --git a/source/blender/python/CMakeLists.txt b/source/blender/python/CMakeLists.txt
index 8071edb..e855f3a 100644
--- a/source/blender/python/CMakeLists.txt
+++ b/source/blender/python/CMakeLists.txt
@@ -19,3 +19,4 @@
 add_subdirectory(intern)
 add_subdirectory(generic)
 add_subdirectory(mathutils)
+add_subdirectory(bmesh)
diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript
index 2a47c2d..a79138f 100644
--- a/source/blender/python/SConscript
+++ b/source/blender/python/SConscript
@@ -5,11 +5,17 @@
 Import ('env')
 
 incs = '. ../editors/include ../makesdna ../makesrna ../blenfont ../blenlib ../blenkernel ../nodes'
-incs += ' ../imbuf ../blenloader ../gpu ../render/extern/include ../windowmanager'
+incs += ' ../imbuf ../blenloader ../bmesh ../gpu ../render/extern/include ../windowmanager'
 incs += ' #intern/guardedalloc #intern/memutil #extern/glew/include #intern/cycles/blender'
 incs += ' #intern/audaspace/intern ' + env['BF_PYTHON_INC']
 
-is_debug = (env['OURPLATFORM'] in ('win32-mingw', 'win32-vc','win64-vc') and env['BF_DEBUG'])
+is_debug = (env['OURPLATFORM'] in ('win32-mingw', 'win32-vc','win64-vc', 'win64-mingw') and env['BF_DEBUG'])
+
+# bmesh
+defs = []
+
+sources = env.Glob('bmesh/*.c')
+env.BlenderLib( libname = 'bf_python_bmesh', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core','player'], priority = [362,165])
 
 # generic
 defs = []
@@ -49,6 +55,9 @@ if env['WITH_BF_CYCLES']:
 if env['WITH_BF_FFMPEG']:
     defs.append('WITH_FFMPEG')
     incs += ' ' + env['BF_FFMPEG_INC']
+    
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-mingw', 'linuxcross', 'win64-vc'):
+    incs += ' ' + env['BF_PTHREADS_INC']
 
 sources = env.Glob('intern/*.c')
 env.BlenderLib( libname = 'bf_python', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core'], priority = [361])
diff --git a/source/blender/python/bmesh/CMakeLists.txt b/source/blender/python/bmesh/CMakeLists.txt
new file mode 100644
index 0000000..40bde71
--- /dev/null
+++ b/source/blender/python/bmesh/CMakeLists.txt
@@ -0,0 +1,50 @@
+# ***** 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 *****
+
+set(INC 
+	.
+	../../bmesh
+	../../blenkernel
+	../../blenlib
+	../../makesdna
+	../../../../intern/guardedalloc
+)
+
+set(INC_SYS
+	${PYTHON_INCLUDE_DIRS}
+)
+
+set(SRC
+	bmesh_py_api.c
+	bmesh_py_types.c
+	bmesh_py_types_customdata.c
+	bmesh_py_types_meshdata.c
+	bmesh_py_types_select.c
+	bmesh_py_utils.c
+
+	bmesh_py_api.h
+	bmesh_py_types.h
+	bmesh_py_types_customdata.h
+	bmesh_py_types_meshdata.h
+	bmesh_py_types_select.h
+	bmesh_py_utils.h
+)
+
+blender_add_lib(bf_python_bmesh "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/python/bmesh/bmesh_py_api.c b/source/blender/python/bmesh/bmesh_py_api.c
new file mode 100644
index 0000000..4d8d4e3
--- /dev/null
+++ b/source/blender/python/bmesh/bmesh_py_api.c
@@ -0,0 +1,151 @@
+/*
+ * ***** 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_api.c
+ *  \ingroup pybmesh
+ *
+ * This file defines the 'bmesh' module.
+ */
+
+#include <Python.h>
+
+#include "BLI_utildefines.h"
+
+#include "bmesh.h"
+
+#include "bmesh_py_types.h"
+#include "bmesh_py_types_select.h"
+#include "bmesh_py_types_customdata.h"
+#include "bmesh_py_types_meshdata.h"
+
+#include "bmesh_py_utils.h"
+
+#include "BKE_tessmesh.h"
+
+#include "DNA_mesh_types.h"
+
+#include "../generic/py_capi_utils.h"
+
+#include "bmesh_py_api.h" /* own include */
+
+
+PyDoc_STRVAR(bpy_bm_new_doc,
+".. method:: new()\n"
+"\n"
+"   :return: Return a new, empty BMesh.\n"
+"   :rtype: :class:`bmesh.types.BMesh`\n"
+);
+
+static PyObject *bpy_bm_new(PyObject *UNUSED(self))
+{
+	BMesh *bm;
+
+	bm = BM_mesh_create(&bm_mesh_allocsize_default);
+
+	return BPy_BMesh_CreatePyObject(bm, BPY_BMFLAG_NOP);
+}
+
+PyDoc_STRVAR(bpy_bm_from_edit_mesh_doc,
+".. method:: from_edit_mesh(mesh)\n"
+"\n"
+"   Return a BMesh from this mesh, currently the mesh must already be in editmode.\n"
+"\n"
+"   :return: the BMesh assosiated with this mesh.\n"
+"   :rtype: :class:`bmesh.types.BMesh`\n"
+);
+static PyObject *bpy_bm_from_edit_mesh(PyObject *UNUSED(self), PyObject *value)
+{
+	BMesh *bm;
+	Mesh *me = PyC_RNA_AsPointer(value, "Mesh");
+
+	if (me == NULL) {
+		return NULL;
+	}
+
+	if (me->edit_btmesh == NULL) {
+		PyErr_SetString(PyExc_ValueError,
+		                "The mesh must be in editmode");
+		return NULL;
+	}
+
+	bm = me->edit_btmesh->bm;
+
+	return BPy_BMesh_CreatePyObject(bm, BPY_BMFLAG_IS_WRAPPED);
+}
+
+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},
+    {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 = {
+	PyModuleDef_HEAD_INIT,
+	"bmesh",  /* m_name */
+	BPy_BM_doc,  /* m_doc */
+	0,  /* m_size */
+	BPy_BM_methods,  /* m_methods */
+	NULL,  /* m_reload */
+	NULL,  /* m_traverse */
+	NULL,  /* m_clear */
+	NULL,  /* m_free */
+};
+
+PyObject *BPyInit_bmesh(void)
+{
+	PyObject *mod;
+	PyObject *submodule;
+	PyObject *sys_modules = PyThreadState_GET()->interp->modules;
+
+	BPy_BM_init_types();
+	BPy_BM_init_types_select();
+	BPy_BM_init_types_customdata();
+	BPy_BM_init_types_meshdata();
+
+	mod = PyModule_Create(&BPy_BM_module_def);
+
+	/* bmesh.types */
+	PyModule_AddObject(mod, "types", (submodule = BPyInit_bmesh_types()));
+	PyDict_SetItemString(sys_modules, PyModule_GetName(submodule), submodule);
+	Py_INCREF(submodule);
+
+	PyModule_AddObject(mod, "utils", (submodule = BPyInit_bmesh_utils()));
+	PyDict_SetItemString(sys_modules, PyModule_GetName(submodule), submodule);
+	Py_INCREF(submodule);
+
+	return mod;
+}
diff --git a/source/blender/python/bmesh/bmesh_py_api.h b/source/blender/python/bmesh/bmesh_py_api.h
new file mode 100644
index 0000000..74510ed
--- /dev/null
+++ b/source/blender/python/bmesh/bmesh_py_api.h
@@ -0,0 +1,35 @@
+/*
+ * ***** 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_api.h
+ *  \ingroup pybmesh
+ */
+
+#ifndef __BMESH_PY_API_H__
+#define __BMESH_PY_API_H__
+
+PyObject *BPyInit_bmesh(void);
+
+#endif /* __BMESH_PY_API_H__ */
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c
new file mode 100644
index 0000000..b75243c
--- /dev/null
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -0,0 +1,3279 @@
+/*
+ * ***** 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_types.c
+ *  \ingroup pybmesh
+ */
+
+#include <Python.h>
+
+#include "BLI_math.h"
+
+#include "DNA_mesh_types.h"
+#include "DNA_object_types.h"
+#include "DNA_material_types.h"
+
+#include "BKE_depsgraph.h"
+#include "BKE_customdata.h"
+#include "BKE_DerivedMesh.h"
+
+#include "bmesh.h"
+
+#include "../mathutils/mathutils.h"
+
+#include "../generic/py_capi_utils.h"
+
+#include "bmesh_py_types.h" /* own include */
+#include "bmesh_py_types_select.h"
+#include "bmesh_py_types_customdata.h"
+#include "bmesh_py_types_meshdata.h"
+
+/* Common Flags
+ * ************ */
+
+/* scene does not use BM_* flags. */
+PyC_FlagSet bpy_bm_scene_vert_edge_face_flags[] = {
+    {1, "VERT"},
+    {2, "EDGE"},
+    {4, "FACE"},
+    {0, NULL}
+};
+
+PyC_FlagSet bpy_bm_htype_vert_edge_face_flags[] = {
+    {BM_VERT, "VERT"},
+    {BM_EDGE, "EDGE"},
+    {BM_FACE, "FACE"},
+    {0, NULL}
+};
+
+PyC_FlagSet bpy_bm_htype_all_flags[] = {
+    {BM_VERT, "VERT"},
+    {BM_LOOP, "EDGE"},
+    {BM_FACE, "FACE"},
+    {BM_LOOP, "LOOP"},
+    {0, NULL}
+};
+
+PyC_FlagSet bpy_bm_hflag_all_flags[] = {
+    {BM_ELEM_SELECT,  "SELECT"},
+    {BM_ELEM_HIDDEN,  "HIDE"},
+    {BM_ELEM_SEAM,    "SEAM"},
+    {BM_ELEM_SMOOTH,  "SMOOTH"},
+    {BM_ELEM_TAG,     "TAG"},
+    {0, NULL}
+};
+
+/* py-type definitions
+ * ******************* */
+
+/* getseters
+ * ========= */
+
+
+/* bmesh elems
+ * ----------- */
+
+PyDoc_STRVAR(bpy_bm_elem_select_doc,  "Selected state of this element.\n\n:type: boolean");
+PyDoc_STRVAR(bpy_bm_elem_hide_doc,    "Hidden state of this element.\n\n:type: boolean");
+PyDoc_STRVAR(bpy_bm_elem_tag_doc,     "Generic attribute scripts can use for own logic\n\n:type: boolean");
+PyDoc_STRVAR(bpy_bm_elem_smooth_doc,  "Smooth state of this element.\n\n:type: boolean");
+PyDoc_STRVAR(bpy_bm_elem_seam_doc,    "Seam for UV unwrapping.\n\n:type: boolean");
+
+
+static PyObject *bpy_bm_elem_hflag_get(BPy_BMElem *self, void *flag)
+{
+	const char hflag = (char)GET_INT_FROM_POINTER(flag);
+
+	BPY_BM_CHECK_OBJ(self);
+
+	return PyBool_FromLong(BM_elem_flag_test(self->ele, hflag));
+}
+
+static int bpy_bm_elem_hflag_set(BPy_BMElem *self, PyObject *value, void *flag)
+{
+	const char hflag = (char)GET_INT_FROM_POINTER(flag);
+	int param;
+
+	BPY_BM_CHECK_INT(self);
+
+	param = PyLong_AsLong(value);
+
+	if (param == TRUE) {
+		BM_elem_flag_enable(self->ele, hflag);
+		return 0;
+	}
+	else if (param == FALSE) {
+		BM_elem_flag_disable(self->ele, hflag);
+		return 0;
+	}
+	else {
+		PyErr_Format(PyExc_TypeError,
+		             "expected True/False or 0/1, not %.200s",
+		             Py_TYPE(value)->tp_name);
+		return -1;
+	}
+}
+
+
+PyDoc_STRVAR(bpy_bm_elem_index_doc,
+"Index of this element.\n"
+"\n"
+":type: int\n"
+"\n"
+".. note::\n"
+"\n"
+"   This value is not necessarily valid, while editing the mesh it can become *dirty*.\n"
+"\n"
+"   It's also possible to assign any number to this attribute for a scripts internal logic.\n"
+"\n"
+"   To ensure the value is up to date - see :class:`BMElemSeq.index_update`.\n"
+);
+static PyObject *bpy_bm_elem_index_get(BPy_BMElem *self, void *UNUSED(flag))
+{
+	BPY_BM_CHECK_OBJ(self);
+
+	return PyLong_FromLong(BM_elem_index_get(self->ele));
+}
+
+static int bpy_bm_elem_index_set(BPy_BMElem *self, PyObject *value, void *UNUSED(flag))
+{
+	int param;
+
+	BPY_BM_CHECK_INT(self);
+
+	param = PyLong_AsLong(value);
+
+	if (param == -1 && PyErr_Occurred()) {
+		PyErr_SetString(PyExc_TypeError,
+		                "expected an int type");
+		return -1;
+	}
+	else {
+		BM_elem_index_set(self->ele, param); /* set_dirty! */
+
+		/* when setting the index assume its set invalid */
+		if (self->ele->head.htype & (BM_VERT | BM_EDGE | BM_FACE)) {
+			self->bm->elem_index_dirty |= self->ele->head.htype;
+		}
+
+		return 0;
+	}
+}
+
+/* type specific get/sets
+ * ---------------------- */
+
+
+/* Mesh
+ * ^^^^ */
+
+/* doc-strings for all uses of this funcion */
+
+PyDoc_STRVAR(bpy_bmvertseq_doc,
+"This meshes vert sequence (read-only).\n\n:type: :class:`BMVertSeq`"
+);
+static PyObject *bpy_bmvertseq_get(BPy_BMesh *self, void *UNUSED(closure))
+{
+	BPY_BM_CHECK_OBJ(self);
+	return BPy_BMVertSeq_CreatePyObject(self->bm);
+}
+
+PyDoc_STRVAR(bpy_bmedgeseq_doc,
+"This meshes edge sequence (read-only).\n\n:type: :class:`BMEdgeSeq`"
+);
+static PyObject *bpy_bmedgeseq_get(BPy_BMesh *self, void *UNUSED(closure))
+{
+	BPY_BM_CHECK_OBJ(self);
+	return BPy_BMEdgeSeq_CreatePyObject(self->bm);
+}
+
+PyDoc_STRVAR(bpy_bmfaceseq_doc,
+"This meshes face sequence (read-only).\n\n:type: :class:`BMFaceSeq`"
+);
+static PyObject *bpy_bmfaceseq_get(BPy_BMesh *self, void *UNUSED(closure))
+{
+	BPY_BM_CHECK_OBJ(self);
+	return BPy_BMFaceSeq_CreatePyObject(self->bm);
+}
+
+PyDoc_STRVAR(bpy_bmloopseq_doc,
+"This meshes face sequence (read-only).\n\n:type: :class:`BMLoopSeq`"
+);
+static PyObject *bpy_bmloopseq_get(BPy_BMesh *self, void *UNUSED(closure))
+{
+	BPY_BM_CHECK_OBJ(self);
+	return BPy_BMLoopSeq_CreatePyObject(self->bm);
+}
+
+/* vert */
+PyDoc_STRVAR(bpy_bmvert_link_edges_doc,
+"Edges connected to this vertex (read-only).\n\n:type: :class:`BMElemSeq` of :class:`BMVert`"
+);
+PyDoc_STRVAR(bpy_bmvert_link_faces_doc,
+"Faces connected to this vertex (read-only).\n\n:type: :class:`BMElemSeq` of :class:`BMFace`"
+);
+PyDoc_STRVAR(bpy_bmvert_link_loops_doc,
+"Loops that use this vertex (read-only).\n\n:type: :class:`BMElemSeq` of :class:`BMLoop`"
+);
+/* edge */
+PyDoc_STRVAR(bpy_bmedge_verts_doc,
+"Verts this edge uses (always 2), (read-only).\n\n:type: :class:`BMElemSeq` of :class:`BMVert`"
+);
+PyDoc_STRVAR(bpy_bmedge_link_faces_doc,
+"Faces connected to this edge, (read-only).\n\n:type: :class:`BMElemSeq` of :class:`BMFace`"
+);
+PyDoc_STRVAR(bpy_bmedge_link_loops_doc,
+"Loops connected to this edge, (read-only).\n\n:type: :class:`BMElemSeq` of :class:`BMLoop`"
+);
+/* face */
+PyDoc_STRVAR(bpy_bmface_verts_doc,
+"Verts of this face, (read-only).\n\n:type: :class:`BMElemSeq` of :class:`BMVert`"
+);
+PyDoc_STRVAR(bpy_bmface_edges_doc,
+"Edges of this face, (read-only).\n\n:type: :class:`BMElemSeq` of :class:`BMEdge`"
+);
+PyDoc_STRVAR(bpy_bmface_loops_doc,
+"Loops of this face, (read-only).\n\n:type: :class:`BMElemSeq` of :class:`BMLoop`"
+);
+/* loop */
+PyDoc_STRVAR(bpy_bmloops_link_loops_doc,
+"Loops connected to this loop, (read-only).\n\n:type: :class:`BMElemSeq` of :class:`BMLoop`"
+);
+
+static PyObject *bpy_bmelemseq_elem_get(BPy_BMElem *self, void *itype)
+{
+	BPY_BM_CHECK_OBJ(self);
+	return BPy_BMElemSeq_CreatePyObject(self->bm, self, GET_INT_FROM_POINTER(itype));
+}
+
+
+PyDoc_STRVAR(bpy_bm_is_valid_doc,
+"True when this element is valid (hasn't been removed).\n\n:type: boolean"
+);
+static PyObject *bpy_bm_is_valid_get(BPy_BMGeneric *self)
+{
+	return PyBool_FromLong(BPY_BM_IS_VALID(self));
+}
+
+PyDoc_STRVAR(bpy_bmesh_is_wrapped_doc,
+"True when this mesh is owned by blender (typically the editmode BMesh).\n\n:type: boolean"
+);
+static PyObject *bpy_bmesh_is_wrapped_get(BPy_BMesh *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+
+	return PyBool_FromLong(self->flag & BPY_BMFLAG_IS_WRAPPED);
+}
+
+PyDoc_STRVAR(bpy_bmesh_select_mode_doc,
+"The selection mode, values can be {'VERT', 'EDGE', 'FACE'}, can't be assigned an empty set.\n\n:type: set"
+);
+static PyObject *bpy_bmesh_select_mode_get(BPy_BMesh *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+
+	return PyC_FlagSet_FromBitfield(bpy_bm_scene_vert_edge_face_flags, self->bm->selectmode);
+}
+
+static int bpy_bmesh_select_mode_set(BPy_BMesh *self, PyObject *value)
+{
+	int flag = 0;
+	BPY_BM_CHECK_INT(self);
+
+	if (PyC_FlagSet_ToBitfield(bpy_bm_scene_vert_edge_face_flags, value, &flag, "bm.select_mode") == -1) {
+		return -1;
+	}
+	else if (flag == 0) {
+		PyErr_SetString(PyExc_TypeError,
+		                "bm.select_mode: cant assignt an empty value");
+		return -1;
+	}
+	else {
+		self->bm->selectmode = flag;
+		return 0;
+	}
+}
+
+PyDoc_STRVAR(bpy_bmesh_select_history_doc,
+"Sequence of selected items (the last is displayed as active).\n\n:type: :class:`BMEditSelSeq`"
+);
+static PyObject *bpy_bmesh_select_history_get(BPy_BMesh *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+
+	return BPy_BMEditSel_CreatePyObject(self->bm);
+}
+
+static int bpy_bmesh_select_history_set(BPy_BMesh *self, PyObject *value)
+{
+	BPY_BM_CHECK_INT(self);
+
+	return BPy_BMEditSel_Assign(self, value);
+}
+
+/* Vert
+ * ^^^^ */
+
+PyDoc_STRVAR(bpy_bmvert_co_doc,
+"The coordinates for this vertex as a 3D, wrapped vector.\n\n:type: :class:`mathutils.Vector`"
+);
+static PyObject *bpy_bmvert_co_get(BPy_BMVert *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+	return Vector_CreatePyObject(self->v->co, 3, Py_WRAP, NULL);
+}
+
+static int bpy_bmvert_co_set(BPy_BMVert *self, PyObject *value)
+{
+	BPY_BM_CHECK_INT(self);
+
+	if (mathutils_array_parse(self->v->co, 3, 3, value, "BMVert.co") != -1) {
+		return 0;
+	}
+	else {
+		return -1;
+	}
+}
+
+
+PyDoc_STRVAR(bpy_bmvert_normal_doc,
+"The normal for this vertex as a 3D, wrapped vector.\n\n:type: :class:`mathutils.Vector`"
+);
+static PyObject *bpy_bmvert_normal_get(BPy_BMVert *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+	return Vector_CreatePyObject(self->v->no, 3, Py_WRAP, NULL);
+}
+
+static int bpy_bmvert_normal_set(BPy_BMVert *self, PyObject *value)
+{
+	BPY_BM_CHECK_INT(self);
+
+	if (mathutils_array_parse(self->v->no, 3, 3, value, "BMVert.normal") != -1) {
+		return 0;
+	}
+	else {
+		return -1;
+	}
+}
+
+
+PyDoc_STRVAR(bpy_bmvert_is_manifold_doc,
+"True when this vertex is manifold (read-only).\n\n:type: boolean"
+);
+static PyObject *bpy_bmvert_is_manifold_get(BPy_BMVert *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+	return PyBool_FromLong(BM_vert_is_manifold(self->v));
+}
+
+
+PyDoc_STRVAR(bpy_bmvert_is_wire_doc,
+"True when this vertex is not connected to any faces (read-only).\n\n:type: boolean"
+);
+static PyObject *bpy_bmvert_is_wire_get(BPy_BMVert *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+	return PyBool_FromLong(BM_vert_is_wire(self->v));
+}
+
+
+/* Edge
+ * ^^^^ */
+
+PyDoc_STRVAR(bpy_bmedge_is_manifold_doc,
+"True when this edge is manifold (read-only).\n\n:type: boolean"
+);
+static PyObject *bpy_bmedge_is_manifold_get(BPy_BMEdge *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+	return PyBool_FromLong(BM_edge_is_manifold(self->e));
+}
+
+
+PyDoc_STRVAR(bpy_bmedge_is_wire_doc,
+"True when this edge is not connected to any faces (read-only).\n\n:type: boolean"
+);
+static PyObject *bpy_bmedge_is_wire_get(BPy_BMEdge *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+	return PyBool_FromLong(BM_edge_is_wire(self->e));
+}
+
+
+PyDoc_STRVAR(bpy_bmedge_is_boundary_doc,
+"True when this edge is at the boundary of a face (read-only).\n\n:type: boolean"
+);
+static PyObject *bpy_bmedge_is_boundary_get(BPy_BMEdge *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+	return PyBool_FromLong(BM_edge_is_boundary(self->e));
+}
+
+
+/* Face
+ * ^^^^ */
+
+PyDoc_STRVAR(bpy_bmface_normal_doc,
+"The normal for this face as a 3D, wrapped vector.\n\n:type: :class:`mathutils.Vector`"
+);
+static PyObject *bpy_bmface_normal_get(BPy_BMFace *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+	return Vector_CreatePyObject(self->f->no, 3, Py_WRAP, NULL);
+}
+
+static int bpy_bmface_normal_set(BPy_BMFace *self, PyObject *value)
+{
+	BPY_BM_CHECK_INT(self);
+
+	if (mathutils_array_parse(self->f->no, 3, 3, value, "BMFace.normal") != -1) {
+		return 0;
+	}
+	else {
+		return -1;
+	}
+}
+
+PyDoc_STRVAR(bpy_bmface_material_index_doc,
+"The faces material index.\n\n:type: int"
+);
+static PyObject *bpy_bmface_material_index_get(BPy_BMFace *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+	return PyLong_FromLong(self->f->mat_nr);
+}
+
+static int bpy_bmface_material_index_set(BPy_BMFace *self, PyObject *value)
+{
+	int param;
+
+	BPY_BM_CHECK_INT(self);
+
+	param = PyLong_AsLong(value);
+
+	if (param == -1 && PyErr_Occurred()) {
+		PyErr_SetString(PyExc_TypeError,
+		                "expected an int type");
+		return -1;
+	}
+	else if ((param < 0) || (param > MAXMAT)) {
+		/* normally we clamp but in this case raise an error */
+		PyErr_SetString(PyExc_ValueError,
+		                "material index outside of usable range (0 - 32766)");
+		return -1;
+	}
+	else {
+		self->f->mat_nr = (short)param;
+		return 0;
+	}
+}
+
+/* Loop
+ * ^^^^ */
+
+PyDoc_STRVAR(bpy_bmloop_vert_doc,
+"The loops vertex (read-only).\n\n:type: :class:`BMVert`"
+);
+static PyObject *bpy_bmloop_vert_get(BPy_BMLoop *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+	return BPy_BMVert_CreatePyObject(self->bm, self->l->v);
+}
+
+
+PyDoc_STRVAR(bpy_bmloop_edge_doc,
+"The loops edge (between this loop and the next), (read-only).\n\n:type: :class:`BMEdge`"
+);
+static PyObject *bpy_bmloop_edge_get(BPy_BMLoop *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+	return BPy_BMEdge_CreatePyObject(self->bm, self->l->e);
+}
+
+
+PyDoc_STRVAR(bpy_bmloop_face_doc,
+"The face this loop makes (read-only).\n\n:type: :class:`BMFace`"
+);
+static PyObject *bpy_bmloop_face_get(BPy_BMLoop *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+	return BPy_BMFace_CreatePyObject(self->bm, self->l->f);
+}
+
+PyDoc_STRVAR(bpy_bmloop_link_loop_next_doc,
+"The next face corner (read-only).\n\n:type: :class:`BMLoop`"
+);
+static PyObject *bpy_bmloop_link_loop_next_get(BPy_BMLoop *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+	return BPy_BMLoop_CreatePyObject(self->bm, self->l->next);
+}
+
+PyDoc_STRVAR(bpy_bmloop_link_loop_prev_doc,
+"The previous face corner (read-only).\n\n:type: :class:`BMLoop`"
+);
+static PyObject *bpy_bmloop_link_loop_prev_get(BPy_BMLoop *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+	return BPy_BMLoop_CreatePyObject(self->bm, self->l->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`"
+);
+static PyObject *bpy_bmelemseq_layers_get(BPy_BMElemSeq *self, void *htype)
+{
+	BPY_BM_CHECK_OBJ(self);
+
+	return BPy_BMLayerAccess_CreatePyObject(self->bm, GET_INT_FROM_POINTER(htype));
+}
+
+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},
+    {(char *)"faces", (getter)bpy_bmfaceseq_get, (setter)NULL, (char *)bpy_bmfaceseq_doc, NULL},
+    {(char *)"loops", (getter)bpy_bmloopseq_get, (setter)NULL, (char *)bpy_bmloopseq_doc, NULL},
+    {(char *)"select_mode", (getter)bpy_bmesh_select_mode_get, (setter)bpy_bmesh_select_mode_set, (char *)bpy_bmesh_select_mode_doc, NULL},
+
+    {(char *)"select_history", (getter)bpy_bmesh_select_history_get, (setter)bpy_bmesh_select_history_set, (char *)bpy_bmesh_select_history_doc, NULL},
+
+    /* readonly checks */
+    {(char *)"is_wrapped", (getter)bpy_bmesh_is_wrapped_get, (setter)NULL, (char *)bpy_bmesh_is_wrapped_doc, NULL}, /* as with mathutils */
+    {(char *)"is_valid",   (getter)bpy_bm_is_valid_get,   (setter)NULL, (char *)bpy_bm_is_valid_doc, NULL},
+
+    {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
+static PyGetSetDef bpy_bmvert_getseters[] = {
+    /* generic */
+    {(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_SELECT},
+    {(char *)"tag",    (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_tag_doc,    (void *)BM_ELEM_TAG},
+    {(char *)"index",  (getter)bpy_bm_elem_index_get, (setter)bpy_bm_elem_index_set, (char *)bpy_bm_elem_index_doc,  NULL},
+
+    {(char *)"co",     (getter)bpy_bmvert_co_get,     (setter)bpy_bmvert_co_set,     (char *)bpy_bmvert_co_doc, NULL},
+    {(char *)"normal", (getter)bpy_bmvert_normal_get, (setter)bpy_bmvert_normal_set, (char *)bpy_bmvert_normal_doc, NULL},
+
+    /* connectivity data */
+    {(char *)"link_edges", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmvert_link_edges_doc, (void *)BM_EDGES_OF_VERT},
+    {(char *)"link_faces", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmvert_link_faces_doc, (void *)BM_FACES_OF_VERT},
+    {(char *)"link_loops", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmvert_link_loops_doc, (void *)BM_LOOPS_OF_VERT},
+
+    /* readonly checks */
+    {(char *)"is_manifold",  (getter)bpy_bmvert_is_manifold_get,  (setter)NULL, (char *)bpy_bmvert_is_manifold_doc, NULL},
+    {(char *)"is_wire",      (getter)bpy_bmvert_is_wire_get,      (setter)NULL, (char *)bpy_bmvert_is_wire_doc, NULL},
+    {(char *)"is_valid",     (getter)bpy_bm_is_valid_get,         (setter)NULL, (char *)bpy_bm_is_valid_doc, NULL},
+
+    {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
+static PyGetSetDef bpy_bmedge_getseters[] = {
+    /* generic */
+    {(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_SELECT},
+    {(char *)"tag",    (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_tag_doc,    (void *)BM_ELEM_TAG},
+    {(char *)"index",  (getter)bpy_bm_elem_index_get, (setter)bpy_bm_elem_index_set, (char *)bpy_bm_elem_index_doc,  NULL},
+
+    {(char *)"smooth", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_smooth_doc, (void *)BM_ELEM_SMOOTH},
+    {(char *)"seam",   (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_seam_doc, (void *)BM_ELEM_SEAM},
+
+    /* connectivity data */
+    {(char *)"verts", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmedge_verts_doc, (void *)BM_VERTS_OF_EDGE},
+
+    {(char *)"link_faces", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmedge_link_faces_doc, (void *)BM_FACES_OF_EDGE},
+    {(char *)"link_loops", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmedge_link_loops_doc, (void *)BM_LOOPS_OF_EDGE},
+
+    /* readonly checks */
+    {(char *)"is_manifold",  (getter)bpy_bmedge_is_manifold_get,  (setter)NULL, (char *)bpy_bmedge_is_manifold_doc, NULL},
+    {(char *)"is_wire",      (getter)bpy_bmedge_is_wire_get,      (setter)NULL, (char *)bpy_bmedge_is_wire_doc, NULL},
+    {(char *)"is_boundary",   (getter)bpy_bmedge_is_boundary_get,   (setter)NULL, (char *)bpy_bmedge_is_boundary_doc, NULL},
+    {(char *)"is_valid",     (getter)bpy_bm_is_valid_get,         (setter)NULL, (char *)bpy_bm_is_valid_doc, NULL},
+
+    {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
+static PyGetSetDef bpy_bmface_getseters[] = {
+    /* generic */
+    {(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_SELECT},
+    {(char *)"tag",    (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_tag_doc,    (void *)BM_ELEM_TAG},
+    {(char *)"index",  (getter)bpy_bm_elem_index_get, (setter)bpy_bm_elem_index_set, (char *)bpy_bm_elem_index_doc,  NULL},
+
+    {(char *)"smooth", (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_smooth_doc, (void *)BM_ELEM_SMOOTH},
+
+    {(char *)"normal", (getter)bpy_bmface_normal_get, (setter)bpy_bmface_normal_set, (char *)bpy_bmface_normal_doc, NULL},
+
+    {(char *)"material_index",  (getter)bpy_bmface_material_index_get, (setter)bpy_bmface_material_index_set, (char *)bpy_bmface_material_index_doc,  NULL},
+
+    /* connectivity data */
+    {(char *)"verts", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmface_verts_doc, (void *)BM_VERTS_OF_FACE},
+    {(char *)"edges", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmface_edges_doc, (void *)BM_EDGES_OF_FACE},
+    {(char *)"loops", (getter)bpy_bmelemseq_elem_get, (setter)NULL, (char *)bpy_bmface_loops_doc, (void *)BM_LOOPS_OF_FACE},
+
+    /* readonly checks */
+    {(char *)"is_valid",   (getter)bpy_bm_is_valid_get, (setter)NULL, (char *)bpy_bm_is_valid_doc, NULL},
+
+    {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
+static PyGetSetDef bpy_bmloop_getseters[] = {
+    /* generic */
+    // 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_SELECT},
+    {(char *)"tag",    (getter)bpy_bm_elem_hflag_get, (setter)bpy_bm_elem_hflag_set, (char *)bpy_bm_elem_tag_doc,    (void *)BM_ELEM_TAG},
+    {(char *)"index",  (getter)bpy_bm_elem_index_get, (setter)bpy_bm_elem_index_set, (char *)bpy_bm_elem_index_doc,  NULL},
+
+    {(char *)"vert", (getter)bpy_bmloop_vert_get, (setter)NULL, (char *)bpy_bmloop_vert_doc, NULL},
+    {(char *)"edge", (getter)bpy_bmloop_edge_get, (setter)NULL, (char *)bpy_bmloop_edge_doc, NULL},
+    {(char *)"face", (getter)bpy_bmloop_face_get, (setter)NULL, (char *)bpy_bmloop_face_doc, NULL},
+
+    /* connectivity data */
+    {(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},
+
+    /* readonly checks */
+    {(char *)"is_valid",   (getter)bpy_bm_is_valid_get, (setter)NULL, (char *)bpy_bm_is_valid_doc, NULL},
+
+    {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
+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 */
+};
+static PyGetSetDef bpy_bmedgeseq_getseters[] = {
+    {(char *)"layers",    (getter)bpy_bmelemseq_layers_get, (setter)NULL, (char *)bpy_bmelemseq_layers_doc, (void *)BM_EDGE},
+    {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+static PyGetSetDef bpy_bmfaceseq_getseters[] = {
+    {(char *)"layers",    (getter)bpy_bmelemseq_layers_get, (setter)NULL, (char *)bpy_bmelemseq_layers_doc, (void *)BM_FACE},
+    {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+static PyGetSetDef bpy_bmloopseq_getseters[] = {
+    {(char *)"layers",    (getter)bpy_bmelemseq_layers_get, (setter)NULL, (char *)bpy_bmelemseq_layers_doc, (void *)BM_LOOP},
+    {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
+
+/* Methods
+ * ======= */
+
+
+/* Mesh
+ * ---- */
+
+PyDoc_STRVAR(bpy_bmesh_copy_doc,
+".. method:: copy()\n"
+"\n"
+"   :return: A copy of this BMesh.\n"
+"   :rtype: :class:`BMesh`\n"
+);
+static PyObject *bpy_bmesh_copy(BPy_BMesh *self)
+{
+	BMesh *bm;
+	BMesh *bm_copy;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	bm = self->bm;
+
+	bm_copy = BM_mesh_copy(bm);
+
+	if (bm_copy) {
+		return BPy_BMesh_CreatePyObject(bm_copy, BPY_BMFLAG_NOP);
+	}
+	else {
+		PyErr_SetString(PyExc_SystemError, "Unable to copy BMesh, internal error");
+		return NULL;
+	}
+}
+
+PyDoc_STRVAR(bpy_bmesh_clear_doc,
+".. method:: clear()\n"
+"\n"
+"   Clear all mesh data.\n"
+);
+static PyObject *bpy_bmesh_clear(BPy_BMesh *self)
+{
+	BMesh *bm;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	bm = self->bm;
+
+	BM_mesh_clear(bm);
+
+	Py_RETURN_NONE;
+}
+
+PyDoc_STRVAR(bpy_bmesh_free_doc,
+".. method:: free()\n"
+"\n"
+"   Explicitly free the BMesh data from memory, causing exceptions on further access.\n"
+"\n"
+"   .. note::\n"
+"\n"
+"      The BMesh is freed automatically, typically when the script finishes executing.\n"
+"      However in some cases its hard to predict when this will be and its useful to\n"
+"      explicitly free the data.\n"
+);
+static PyObject *bpy_bmesh_free(BPy_BMesh *self)
+{
+	if (self->bm) {
+		BMesh *bm = self->bm;
+
+		if ((self->flag & BPY_BMFLAG_IS_WRAPPED) == 0) {
+			BM_mesh_free(bm);
+		}
+
+		bpy_bm_generic_invalidate((BPy_BMGeneric *)self);
+	}
+
+	Py_RETURN_NONE;
+}
+
+PyDoc_STRVAR(bpy_bmesh_to_mesh_doc,
+".. method:: to_mesh(mesh)\n"
+"\n"
+"   Writes this BMesh data into an existing Mesh datablock.\n"
+"\n"
+"   :arg mesh: The mesh data to write into.\n"
+"   :type mesh: :class:`Mesh`\n"
+);
+static PyObject *bpy_bmesh_to_mesh(BPy_BMesh *self, PyObject *args)
+{
+	PyObject *py_mesh;
+	Mesh *me;
+	BMesh *bm;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	if (!PyArg_ParseTuple(args, "O:to_mesh", &py_mesh) ||
+	    !(me = PyC_RNA_AsPointer(py_mesh, "Mesh")))
+	{
+		return NULL;
+	}
+
+	/* we could allow this but its almost certainly _not_ what script authors want */
+	if (me->edit_btmesh) {
+		PyErr_Format(PyExc_ValueError,
+		             "to_mesh(): Mesh '%s' is in editmode", me->id.name + 2);
+		return NULL;
+	}
+
+	bm = self->bm;
+
+	BM_mesh_bm_to_me(bm, me, FALSE);
+
+	/* we could have the user do this but if they forget blender can easy crash
+	 * since the references arrays for the objects derived meshes are now invalid */
+	DAG_id_tag_update(&me->id, OB_RECALC_DATA);
+
+	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"
+"\n"
+"   Initialize this bmesh from existing object datablock.\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"
+);
+static PyObject *bpy_bmesh_from_object(BPy_BMesh *self, PyObject *args)
+{
+	PyObject *py_object;
+	Object *ob;
+	BMesh *bm;
+	int apply_modifiers = TRUE;
+	DerivedMesh *dm;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	if (!PyArg_ParseTuple(args, "O|i:from_object", &py_object, &apply_modifiers) ||
+	    !(ob = PyC_RNA_AsPointer(py_object, "Object")))
+	{
+		return NULL;
+	}
+
+	dm = apply_modifiers ? ob->derivedFinal : ob->derivedDeform;
+
+	if (dm == NULL) {
+		PyErr_Format(PyExc_ValueError,
+		             "from_object(...): Object '%s' has no usable mesh data", ob->id.name + 2);
+		return NULL;
+	}
+
+	bm = self->bm;
+
+	DM_to_bmesh_ex(dm, bm);
+
+	Py_RETURN_NONE;
+}
+
+
+PyDoc_STRVAR(bpy_bmesh_from_mesh_doc,
+".. method:: from_mesh(mesh, use_shape_key=False, shape_key_index=0)\n"
+"\n"
+"   Initialize this bmesh from existing mesh datablock.\n"
+"\n"
+"   :arg mesh: The mesh data to load.\n"
+"   :type mesh: :class:`Mesh`\n"
+"   :arg use_shape_key: Use the locations from a shape key.\n"
+"   :type use_shape_key: boolean\n"
+"   :arg shape_key_index: The shape key index to use.\n"
+"   :type shape_key_index: int\n"
+);
+static PyObject *bpy_bmesh_from_mesh(BPy_BMesh *self, PyObject *args, PyObject *kw)
+{
+	static const char *kwlist[] = {"mesh", "use_shape_key", "shape_key_index", NULL};
+	BMesh *bm;
+	PyObject *py_mesh;
+	Mesh *me;
+	int use_shape_key = FALSE;
+	int shape_key_index = 0;
+
+	if (!PyArg_ParseTupleAndKeywords(args, kw, "O|ii:from_mesh", (char **)kwlist,
+	                                 &py_mesh, &use_shape_key, &shape_key_index) ||
+	    !(me = PyC_RNA_AsPointer(py_mesh, "Mesh")))
+	{
+		return NULL;
+	}
+
+	bm = self->bm;
+
+	BM_mesh_bm_from_me(bm, me, use_shape_key, shape_key_index + 1);
+
+	Py_RETURN_NONE;
+}
+
+
+PyDoc_STRVAR(bpy_bmesh_select_flush_mode_doc,
+".. method:: select_flush_mode()\n"
+"\n"
+"   flush selection based on the current mode current :class:`BMesh.select_mode`.\n"
+);
+static PyObject *bpy_bmesh_select_flush_mode(BPy_BMesh *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+
+	BM_mesh_select_mode_flush(self->bm);
+
+	Py_RETURN_NONE;
+}
+
+
+PyDoc_STRVAR(bpy_bmesh_select_flush_doc,
+".. method:: select_flush(select)\n"
+"\n"
+"   Flush selection, independent of the current selection mode.\n"
+"\n"
+"   :arg select: flush selection or de-selected elements.\n"
+"   :type select: boolean\n"
+);
+static PyObject *bpy_bmesh_select_flush(BPy_BMesh *self, PyObject *value)
+{
+	int param;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	param = PyLong_AsLong(value);
+	if (param != FALSE && param != TRUE) {
+		PyErr_SetString(PyExc_TypeError,
+		                "expected a boolean type 0/1");
+		return NULL;
+	}
+
+	if (param)  BM_mesh_select_flush(self->bm);
+	else        BM_mesh_deselect_flush(self->bm);
+
+	Py_RETURN_NONE;
+}
+
+
+PyDoc_STRVAR(bpy_bmesh_normal_update_doc,
+".. method:: normal_update(skip_hidden=False)\n"
+"\n"
+"   Update mesh normals.\n"
+"\n"
+"   :arg skip_hidden: When True hidden elements are ignored.\n"
+"   :type skip_hidden: boolean\n"
+);
+static PyObject *bpy_bmesh_normal_update(BPy_BMesh *self, PyObject *args)
+{
+
+	int skip_hidden = FALSE;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	if (!PyArg_ParseTuple(args, "|i:normal_update", &skip_hidden)) {
+		return NULL;
+	}
+
+	BM_mesh_normals_update(self->bm, skip_hidden);
+
+	Py_RETURN_NONE;
+}
+
+
+PyDoc_STRVAR(bpy_bmesh_transform_doc,
+".. method:: transform(matrix, filter=None)\n"
+"\n"
+"   Transform the mesh (optionally filtering flagged data only).\n"
+"\n"
+"   :arg matrix: transform matrix.\n"
+"   :type matrix: 4x4 :class:`mathutils.Matrix`\n"
+"   :arg filter: set of values in ('SELECT', 'HIDE', 'SEAM', 'SMOOTH', 'TAG').\n"
+"   :type filter: set\n"
+);
+static PyObject *bpy_bmesh_transform(BPy_BMElem *self, PyObject *args, PyObject *kw)
+{
+	static const char *kwlist[] = {"matrix", "filter", NULL};
+
+	MatrixObject *mat;
+	PyObject *filter = NULL;
+	int filter_flags = 0;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	if (!PyArg_ParseTupleAndKeywords(args, kw,
+	                                 "O!|O!:transform",
+	                                 (char **)kwlist,
+	                                 &matrix_Type, &mat,
+	                                 &PySet_Type,  &filter))
+	{
+		return NULL;
+	}
+	else {
+		BMVert *eve;
+		BMIter iter;
+		void *mat_ptr;
+
+		if (BaseMath_ReadCallback(mat) == -1) {
+			return NULL;
+		}
+		else if (mat->num_col != 4 || mat->num_row != 4) {
+			PyErr_SetString(PyExc_ValueError,
+			                "expected a 4x4 matrix");
+			return NULL;
+		}
+
+		if (filter != NULL && PyC_FlagSet_ToBitfield(bpy_bm_hflag_all_flags, filter,
+		                                             &filter_flags, "bm.transform") == -1)
+		{
+			return NULL;
+		}
+
+		mat_ptr = mat->matrix;
+
+		if (!filter_flags) {
+			BM_ITER_MESH (eve, &iter, self->bm, BM_VERTS_OF_MESH) {
+				mul_m4_v3((float (*)[4])mat_ptr, eve->co);
+			}
+		}
+		else {
+			char filter_flags_ch = (char)filter_flags;
+			BM_ITER_MESH (eve, &iter, self->bm, BM_VERTS_OF_MESH) {
+				if (eve->head.hflag & filter_flags_ch) {
+					mul_m4_v3((float (*)[4])mat_ptr, eve->co);
+				}
+			}
+		}
+	}
+
+	Py_RETURN_NONE;
+}
+
+
+/* Elem
+ * ---- */
+
+PyDoc_STRVAR(bpy_bm_elem_select_set_doc,
+".. method:: select_set(select)\n"
+"\n"
+"   Set the selection.\n"
+"   This is different from the *select* attribute because it updates the selection state of assosiated geometry.\n"
+"\n"
+"   :arg select: Select or de-select.\n"
+"   :type select: boolean\n"
+"\n"
+"   .. note::\n"
+"\n"
+"      Currently this only flushes down, so selecting a face will select all its vertices but de-selecting a vertex "
+"      won't de-select all the faces that use it, before finishing with a mesh typically flushing is still needed.\n"
+);
+static PyObject *bpy_bm_elem_select_set(BPy_BMElem *self, PyObject *value)
+{
+	int param;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	param = PyLong_AsLong(value);
+	if (param != FALSE && param != TRUE) {
+		PyErr_SetString(PyExc_TypeError,
+		                "expected a boolean type 0/1");
+		return NULL;
+	}
+
+	BM_elem_select_set(self->bm, self->ele, param);
+
+	Py_RETURN_NONE;
+}
+
+
+PyDoc_STRVAR(bpy_bm_elem_hide_set_doc,
+".. method:: hide_set(hide)\n"
+"\n"
+"   Set the hide state.\n"
+"   This is different from the *hide* attribute because it updates the selection and hide state of assosiated geometry.\n"
+"\n"
+"   :arg hide: Hidden or visible.\n"
+"   :type hide: boolean\n"
+);
+static PyObject *bpy_bm_elem_hide_set(BPy_BMElem *self, PyObject *value)
+{
+	int param;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	param = PyLong_AsLong(value);
+	if (param != FALSE && param != TRUE) {
+		PyErr_SetString(PyExc_TypeError,
+		                "expected a boolean type 0/1");
+		return NULL;
+	}
+
+	BM_elem_hide_set(self->bm, self->ele, param);
+
+	Py_RETURN_NONE;
+}
+
+
+PyDoc_STRVAR(bpy_bm_elem_copy_from_doc,
+".. method:: copy_from(other)\n"
+"\n"
+"   Copy values from another element of matching type.\n"
+);
+static PyObject *bpy_bm_elem_copy_from(BPy_BMElem *self, BPy_BMElem *value)
+{
+	BPY_BM_CHECK_OBJ(self);
+
+	if (Py_TYPE(self) != Py_TYPE(value)) {
+		PyErr_Format(PyExc_TypeError,
+		             "expected element of type '%.200s' not '%.200s'",
+		             Py_TYPE(self)->tp_name, Py_TYPE(value)->tp_name);
+		return NULL;
+	}
+
+	if (value->ele != self->ele) {
+		BM_elem_attrs_copy(value->bm, self->bm, value->ele, self->ele);
+	}
+
+	Py_RETURN_NONE;
+}
+
+
+/* Vert
+ * ---- */
+
+
+PyDoc_STRVAR(bpy_bmvert_copy_from_vert_interp_doc,
+".. method:: copy_from_vert_interp(vert_pair, fac)\n"
+"\n"
+"   Interpolate the customdata from a vert between 2 other verts.\n"
+"\n"
+"   :arg vert_pair: The vert to interpolate data from.\n"
+"   :type vert_pair: :class:`BMVert`\n"
+);
+static PyObject *bpy_bmvert_copy_from_vert_interp(BPy_BMVert *self, PyObject *args)
+{
+	PyObject *vert_seq;
+	float fac;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	if (!PyArg_ParseTuple(args, "Of:BMVert.copy_from_vert_interp",
+	                      &vert_seq, &fac))
+	{
+		return NULL;
+	}
+	else {
+		BMesh *bm = self->bm;
+		BMVert **vert_array = NULL;
+		Py_ssize_t vert_seq_len; /* always 2 */
+
+		vert_array = BPy_BMElem_PySeq_As_Array(&bm, vert_seq, 2, 2,
+		                                       &vert_seq_len, BM_VERT,
+		                                       TRUE, TRUE, "BMVert.copy_from_vert_interp(...)");
+
+		if (vert_array == NULL) {
+			return NULL;
+		}
+
+		BM_data_interp_from_verts(bm, vert_array[0], vert_array[1], self->v, CLAMPIS(fac, 0.0f, 1.0f));
+
+		PyMem_FREE(vert_array);
+		Py_RETURN_NONE;
+	}
+}
+
+
+PyDoc_STRVAR(bpy_bmvert_copy_from_face_interp_doc,
+".. method:: copy_from_face_interp(face)\n"
+"\n"
+"   Interpolate the customdata from a face onto this loop (the loops vert should overlap the face).\n"
+"\n"
+"   :arg face: The face to interpolate data from.\n"
+"   :type face: :class:`BMFace`\n"
+);
+static PyObject *bpy_bmvert_copy_from_face_interp(BPy_BMVert *self, PyObject *args)
+{
+	BPy_BMFace *py_face = NULL;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	if (!PyArg_ParseTuple(args, "O!:BMVert.copy_from_face_interp",
+	                      &BPy_BMFace_Type, &py_face))
+	{
+		return NULL;
+	}
+	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;
+		}
+
+		BM_vert_interp_from_face(bm, self->v, py_face->f);
+
+		Py_RETURN_NONE;
+	}
+}
+
+
+PyDoc_STRVAR(bpy_bmvert_calc_edge_angle_doc,
+".. method:: calc_edge_angle()\n"
+"\n"
+"   Return the angle between this verts 2 connected edges.\n"
+"\n"
+"   :return: Angle between edges in radians.\n"
+"   :rtype: float\n"
+);
+static PyObject *bpy_bmvert_calc_edge_angle(BPy_BMVert *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+	return PyFloat_FromDouble(BM_vert_calc_edge_angle(self->v));
+}
+
+PyDoc_STRVAR(bpy_bmvert_calc_shell_factor_doc,
+".. method:: calc_shell_factor()\n"
+"\n"
+"   Return a multiplier calculated based on the sharpness of the vertex.\n"
+"   Where a flat surface gives 1.0, and higher values sharper edges.\n"
+"   This is used to maintain shell thickness when offsetting verts along their normals.\n"
+"\n"
+"   :return: offset multiplier\n"
+"   :rtype: float\n"
+);
+static PyObject *bpy_bmvert_calc_shell_factor(BPy_BMVert *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+	return PyFloat_FromDouble(BM_vert_calc_shell_factor(self->v));
+}
+
+PyDoc_STRVAR(bpy_bmvert_normal_update_doc,
+".. method:: normal_update()\n"
+"\n"
+"   Update vertex normal.\n"
+);
+static PyObject *bpy_bmvert_normal_update(BPy_BMVert *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+
+	BM_vert_normal_update(self->v);
+
+	Py_RETURN_NONE;
+}
+
+
+/* Edge
+ * ---- */
+
+PyDoc_STRVAR(bpy_bmedge_calc_length_doc,
+".. method:: calc_length()\n"
+"\n"
+"   :return: The length between both verts.\n"
+"   :rtype: float\n"
+);
+static PyObject *bpy_bmedge_calc_length(BPy_BMEdge *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+	return PyFloat_FromDouble(len_v3v3(self->e->v1->co, self->e->v2->co));
+}
+
+PyDoc_STRVAR(bpy_bmedge_calc_face_angle_doc,
+".. method:: calc_face_angle()\n"
+"\n"
+"   :return: The angle between 2 connected faces in radians.\n"
+"   :rtype: float\n"
+);
+static PyObject *bpy_bmedge_calc_face_angle(BPy_BMEdge *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+	return PyFloat_FromDouble(BM_edge_calc_face_angle(self->e));
+}
+
+PyDoc_STRVAR(bpy_bmedge_calc_tangent_doc,
+".. method:: calc_tangent(loop)\n"
+"\n"
+"   Return the tangent at this edge relative to a face (pointing inward into the face).\n"
+"   This uses the face normal for calculation.\n"
+"\n"
+"   :arg loop: The loop used for tangent calculation.\n"
+"   :type loop: :class:`BMLoop`\n"
+"   :return: a normalized vector.\n"
+"   :rtype: :class:`mathutils.Vector`\n"
+);
+static PyObject *bpy_bmedge_calc_tangent(BPy_BMEdge *self, PyObject *args)
+{
+	BPy_BMLoop *py_loop;
+	BPY_BM_CHECK_OBJ(self);
+
+	if (!PyArg_ParseTuple(args, "O!:BMEdge.calc_face_tangent",
+	                      &BPy_BMLoop_Type, &py_loop))
+	{
+		return NULL;
+	}
+	else {
+		float vec[3];
+		BPY_BM_CHECK_OBJ(py_loop);
+		/* no need to check if they are from the same mesh or even connected */
+		BM_edge_calc_face_tangent(self->e, py_loop->l, vec);
+		return Vector_CreatePyObject(vec, 3, Py_NEW, NULL);
+	}
+}
+
+
+PyDoc_STRVAR(bpy_bmedge_other_vert_doc,
+".. method:: other_vert(vert)\n"
+"\n"
+"   Return the other vertex on this edge or None if the vertex is not used by this edge.\n"
+"\n"
+"   :arg vert: a vert in this edge.\n"
+"   :type vert: :class:`BMVert`\n"
+"   :return: The edges other vert.\n"
+"   :rtype: :class:`BMVert` or None\n"
+);
+static PyObject *bpy_bmedge_other_vert(BPy_BMEdge *self, BPy_BMVert *value)
+{
+	BMVert *other;
+	BPY_BM_CHECK_OBJ(self);
+
+	if (!BPy_BMVert_Check(value)) {
+		PyErr_Format(PyExc_TypeError,
+		             "BMEdge.other_vert(vert): BMVert expected, not '%.200s'",
+		             Py_TYPE(value)->tp_name);
+		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;
+	}
+
+	other = BM_edge_other_vert(self->e, value->v);
+
+	if (other) {
+		return BPy_BMVert_CreatePyObject(self->bm, other);
+	}
+	else {
+		/* could raise an exception here */
+		Py_RETURN_NONE;
+	}
+}
+
+
+PyDoc_STRVAR(bpy_bmedge_normal_update_doc,
+".. method:: normal_update()\n"
+"\n"
+"   Update edges vertex normals.\n"
+);
+static PyObject *bpy_bmedge_normal_update(BPy_BMEdge *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+
+	BM_edge_normals_update(self->e);
+
+	Py_RETURN_NONE;
+}
+
+
+/* Face
+ * ---- */
+
+PyDoc_STRVAR(bpy_bmface_copy_from_face_interp_doc,
+".. method:: copy_from_face_interp(face)\n"
+"\n"
+"   Interpolate the customdata from another face onto this one (faces should overlap).\n"
+"\n"
+"   :arg face: The face to interpolate data from.\n"
+"   :type face: :class:`BMFace`\n"
+);
+static PyObject *bpy_bmface_copy_from_face_interp(BPy_BMFace *self, PyObject *args)
+{
+	BPy_BMFace *py_face = NULL;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	if (!PyArg_ParseTuple(args, "O!:BMFace.copy_from_face_interp",
+	                      &BPy_BMFace_Type, &py_face))
+	{
+		return NULL;
+	}
+	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;
+		}
+
+		BM_face_interp_from_face(bm, self->f, py_face->f);
+
+		Py_RETURN_NONE;
+	}
+}
+
+
+PyDoc_STRVAR(bpy_bmface_copy_doc,
+".. method:: copy(verts=True, edges=True)\n"
+"\n"
+"   Make a copy of this face.\n"
+"\n"
+"   :arg verts: When set, the faces verts will be duplicated too.\n"
+"   :type verts: boolean\n"
+"   :arg edges: When set, the faces edges will be duplicated too.\n"
+"   :type edges: boolean\n"
+"   :return: The newly created face.\n"
+"   :rtype: :class:`BMFace`\n"
+);
+static PyObject *bpy_bmface_copy(BPy_BMFace *self, PyObject *args, PyObject *kw)
+{
+	static const char *kwlist[] = {"verts", "edges", NULL};
+
+	BMesh *bm = self->bm;
+	int do_verts = TRUE;
+	int do_edges = TRUE;
+
+	BMFace *f_cpy;
+	BPY_BM_CHECK_OBJ(self);
+
+	if (!PyArg_ParseTupleAndKeywords(args, kw,
+	                                 "|ii:BMFace.copy",
+	                                 (char **)kwlist,
+	                                 &do_verts, &do_edges))
+	{
+		return NULL;
+	}
+
+	f_cpy = BM_face_copy(bm, self->f, do_verts, do_edges);
+
+	if (f_cpy) {
+		return BPy_BMFace_CreatePyObject(bm, f_cpy);
+	}
+	else {
+		PyErr_SetString(PyExc_ValueError,
+		                "BMFace.copy(): couldn't create the new face, internal error");
+		return NULL;
+	}
+}
+
+
+PyDoc_STRVAR(bpy_bmface_calc_area_doc,
+".. method:: calc_area()\n"
+"\n"
+"   Return the area of the face.\n"
+"\n"
+"   :return: Return the area of the face.\n"
+"   :rtype: float\n"
+);
+static PyObject *bpy_bmface_calc_area(BPy_BMFace *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+	return PyFloat_FromDouble(BM_face_calc_area(self->f));
+}
+
+
+PyDoc_STRVAR(bpy_bmface_calc_perimeter_doc,
+".. method:: calc_perimeter()\n"
+"\n"
+"   Return the perimeter of the face.\n"
+"\n"
+"   :return: Return the perimeter of the face.\n"
+"   :rtype: float\n"
+);
+static PyObject *bpy_bmface_calc_perimeter(BPy_BMFace *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+	return PyFloat_FromDouble(BM_face_calc_perimeter(self->f));
+}
+
+
+PyDoc_STRVAR(bpy_bmface_calc_center_mean_doc,
+".. method:: calc_center_median()\n"
+"\n"
+"   Return median center of the face.\n"
+"\n"
+"   :return: a 3D vector.\n"
+"   :rtype: :class:`mathutils.Vector`\n"
+);
+static PyObject *bpy_bmface_calc_center_mean(BPy_BMFace *self)
+{
+	float cent[3];
+
+	BPY_BM_CHECK_OBJ(self);
+	BM_face_calc_center_mean(self->f, cent);
+	return Vector_CreatePyObject(cent, 3, Py_NEW, NULL);
+}
+
+
+PyDoc_STRVAR(bpy_bmface_calc_center_bounds_doc,
+".. method:: calc_center_bounds()\n"
+"\n"
+"   Return bounds center of the face.\n"
+"\n"
+"   :return: a 3D vector.\n"
+"   :rtype: :class:`mathutils.Vector`\n"
+);
+static PyObject *bpy_bmface_calc_center_bounds(BPy_BMFace *self)
+{
+	float cent[3];
+
+	BPY_BM_CHECK_OBJ(self);
+	BM_face_calc_center_bounds(self->f, cent);
+	return Vector_CreatePyObject(cent, 3, Py_NEW, NULL);
+}
+
+
+PyDoc_STRVAR(bpy_bmface_normal_update_doc,
+".. method:: normal_update()\n"
+"\n"
+"   Update faces normal.\n"
+);
+static PyObject *bpy_bmface_normal_update(BPy_BMFace *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+
+	BM_face_normal_update(self->f);
+
+	Py_RETURN_NONE;
+}
+
+
+/* Loop
+ * ---- */
+
+PyDoc_STRVAR(bpy_bmloop_copy_from_face_interp_doc,
+".. method:: copy_from_face_interp(face, vert=True, multires=True)\n"
+"\n"
+"   Interpolate the customdata from a face onto this loop (the loops vert should overlap the face).\n"
+"\n"
+"   :arg face: The face to interpolate data from.\n"
+"   :type face: :class:`BMFace`\n"
+"   :arg vert: When enabled, interpolate the loops vertex data (optional).\n"
+"   :type vert: boolean\n"
+"   :arg multires: When enabled, interpolate the loops multires data (optional).\n"
+"   :type multires: boolean\n"
+);
+static PyObject *bpy_bmloop_copy_from_face_interp(BPy_BMLoop *self, PyObject *args)
+{
+	BPy_BMFace *py_face = NULL;
+	int do_vertex   = TRUE;
+	int do_multires = TRUE;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	if (!PyArg_ParseTuple(args, "O!|ii:BMLoop.copy_from_face_interp",
+	                      &BPy_BMFace_Type, &py_face,
+	                      &do_vertex, &do_multires))
+	{
+		return NULL;
+	}
+	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;
+		}
+
+		BM_loop_interp_from_face(bm, self->l, py_face->f, do_vertex, do_multires);
+
+		Py_RETURN_NONE;
+	}
+}
+
+
+PyDoc_STRVAR(bpy_bmloop_calc_angle_doc,
+".. method:: calc_angle()\n"
+"\n"
+"   Return the angle at this loops corner of the face.\n"
+"   This is calculated so sharper corners give lower angles.\n"
+"\n"
+"   :return: The angle in radians.\n"
+"   :rtype: float\n"
+);
+static PyObject *bpy_bmloop_calc_angle(BPy_BMLoop *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+	return PyFloat_FromDouble(BM_loop_calc_face_angle(self->l));
+}
+
+PyDoc_STRVAR(bpy_bmloop_calc_normal_doc,
+".. method:: calc_normal()\n"
+"\n"
+"   Return normal at this loops corner of the face.\n"
+"   Falls back to the face normal for straignt lines.\n"
+"\n"
+"   :return: a normalized vector.\n"
+"   :rtype: :class:`mathutils.Vector`\n"
+);
+static PyObject *bpy_bmloop_calc_normal(BPy_BMLoop *self)
+{
+	float vec[3];
+	BPY_BM_CHECK_OBJ(self);
+	BM_loop_calc_face_normal(self->l, vec);
+	return Vector_CreatePyObject(vec, 3, Py_NEW, NULL);
+}
+
+PyDoc_STRVAR(bpy_bmloop_calc_tangent_doc,
+".. method:: calc_tangent()\n"
+"\n"
+"   Return the tangent at this loops corner of the face (pointing inward into the face).\n"
+"   Falls back to the face normal for straignt lines.\n"
+"\n"
+"   :return: a normalized vector.\n"
+"   :rtype: :class:`mathutils.Vector`\n"
+);
+static PyObject *bpy_bmloop_calc_tangent(BPy_BMLoop *self)
+{
+	float vec[3];
+	BPY_BM_CHECK_OBJ(self);
+	BM_loop_calc_face_tangent(self->l, vec);
+	return Vector_CreatePyObject(vec, 3, Py_NEW, NULL);
+}
+
+/* Vert Seq
+ * -------- */
+PyDoc_STRVAR(bpy_bmvertseq_new_doc,
+".. method:: new(co=(0.0, 0.0, 0.0), example=None)\n"
+"\n"
+"   Create a new vertex.\n"
+"\n"
+"   :arg co: The initial location of the vertex (optional argument).\n"
+"   :type co: float triplet\n"
+"   :arg example: Existing vert to initialize settings.\n"
+"   :type example: :class:`BMVert`\n"
+"   :return: The newly created edge.\n"
+"   :rtype: :class:`BMVert`\n"
+);
+static PyObject *bpy_bmvertseq_new(BPy_BMElemSeq *self, PyObject *args)
+{
+	PyObject *py_co = NULL;
+	BPy_BMVert *py_vert_example = NULL; /* optional */
+
+	BPY_BM_CHECK_OBJ(self);
+
+	if (!PyArg_ParseTuple(args, "|OO!:verts.new",
+	                      &py_co,
+	                      &BPy_BMVert_Type, &py_vert_example))
+	{
+		return NULL;
+	}
+	else {
+		BMesh *bm = self->bm;
+		BMVert *v;
+		float co[3] = {0.0f, 0.0f, 0.0f};
+
+		if (py_vert_example) {
+			BPY_BM_CHECK_OBJ(py_vert_example);
+		}
+
+		if (py_co && mathutils_array_parse(co, 3, 3, py_co, "verts.new(co)") == -1) {
+			return NULL;
+		}
+
+		v = BM_vert_create(bm, co, NULL);
+
+		if (v == NULL) {
+			PyErr_SetString(PyExc_ValueError,
+			                "faces.new(verts): couldn't create the new face, internal error");
+			return NULL;
+		}
+
+		if (py_vert_example) {
+			BM_elem_attrs_copy(py_vert_example->bm, bm, py_vert_example->v, v);
+		}
+
+		return BPy_BMVert_CreatePyObject(bm, v);
+	}
+}
+
+
+/* Edge Seq
+ * -------- */
+PyDoc_STRVAR(bpy_bmedgeseq_new_doc,
+".. method:: new(verts, example=None)\n"
+"\n"
+"   Create a new edge from a given pair of verts.\n"
+"\n"
+"   :arg verts: Vertex pair.\n"
+"   :type verts: pair of :class:`BMVert`\n"
+"   :arg example: Existing edge to initialize settings (optional argument).\n"
+"   :type example: :class:`BMEdge`\n"
+"   :return: The newly created edge.\n"
+"   :rtype: :class:`BMEdge`\n"
+);
+static PyObject *bpy_bmedgeseq_new(BPy_BMElemSeq *self, PyObject *args)
+{
+	PyObject *vert_seq;
+	BPy_BMEdge *py_edge_example = NULL; /* optional */
+
+	BPY_BM_CHECK_OBJ(self);
+
+	if (!PyArg_ParseTuple(args, "O|O!:edges.new",
+	                      &vert_seq,
+	                      &BPy_BMEdge_Type, &py_edge_example))
+	{
+		return NULL;
+	}
+	else {
+		BMesh *bm = self->bm;
+		BMEdge *e;
+		BMVert **vert_array = NULL;
+		Py_ssize_t vert_seq_len; /* always 2 */
+		PyObject *ret = NULL;
+
+		if (py_edge_example) {
+			BPY_BM_CHECK_OBJ(py_edge_example);
+		}
+
+		vert_array = BPy_BMElem_PySeq_As_Array(&bm, vert_seq, 2, 2,
+		                                       &vert_seq_len, BM_VERT,
+		                                       TRUE, TRUE, "edges.new(...)");
+
+		if (vert_array == NULL) {
+			return NULL;
+		}
+		
+		if (BM_edge_exists(vert_array[0], vert_array[1])) {
+			PyErr_SetString(PyExc_ValueError,
+			                "edges.new(): this edge exists");
+			goto cleanup;
+		}
+
+		e = BM_edge_create(bm, vert_array[0], vert_array[1], NULL, FALSE);
+
+		if (e == NULL) {
+			PyErr_SetString(PyExc_ValueError,
+			                "faces.new(verts): couldn't create the new face, internal error");
+			goto cleanup;
+		}
+
+		if (py_edge_example) {
+			BM_elem_attrs_copy(py_edge_example->bm, bm, py_edge_example->e, e);
+		}
+
+		ret = BPy_BMEdge_CreatePyObject(bm, e);
+
+cleanup:
+		if (vert_array) PyMem_FREE(vert_array);
+		return ret;
+	}
+}
+
+
+/* Face Seq
+ * -------- */
+PyDoc_STRVAR(bpy_bmfaceseq_new_doc,
+".. method:: new(verts, example=None)\n"
+"\n"
+"   Create a new face from a given set of verts.\n"
+"\n"
+"   :arg verts: Sequence of 3 or more verts.\n"
+"   :type verts: :class:`BMVert`\n"
+"   :arg example: Existing face to initialize settings (optional argument).\n"
+"   :type example: :class:`BMFace`\n"
+"   :return: The newly created face.\n"
+"   :rtype: :class:`BMFace`\n"
+);
+static PyObject *bpy_bmfaceseq_new(BPy_BMElemSeq *self, PyObject *args)
+{
+	PyObject *vert_seq;
+	BPy_BMFace *py_face_example = NULL; /* optional */
+
+	BPY_BM_CHECK_OBJ(self);
+
+	if (!PyArg_ParseTuple(args, "O|O!:faces.new",
+	                      &vert_seq,
+	                      &BPy_BMFace_Type, &py_face_example))
+	{
+		return NULL;
+	}
+	else {
+		BMesh *bm = self->bm;
+		Py_ssize_t vert_seq_len;
+		Py_ssize_t i, i_next;
+
+		BMVert **vert_array = NULL;
+		BMEdge **edge_array = NULL;
+
+		PyObject *ret = NULL;
+
+		BMFace *f_new;
+
+		if (py_face_example) {
+			BPY_BM_CHECK_OBJ(py_face_example);
+		}
+
+		vert_array = BPy_BMElem_PySeq_As_Array(&bm, vert_seq, 3, PY_SSIZE_T_MAX,
+		                                       &vert_seq_len, BM_VERT,
+		                                       TRUE, TRUE, "faces.new(...)");
+
+		if (vert_array == NULL) {
+			return NULL;
+		}
+
+		/* check if the face exists */
+		if (BM_face_exists(bm, vert_array, vert_seq_len, NULL)) {
+			PyErr_SetString(PyExc_ValueError,
+			                "faces.new(verts): face already exists");
+			goto cleanup;
+		}
+
+		/* Go ahead and make the face!
+		 * --------------------------- */
+
+		edge_array = (BMEdge **)PyMem_MALLOC(vert_seq_len * sizeof(BMEdge **));
+
+		/* 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);
+		}
+
+		f_new = BM_face_create(bm, vert_array, edge_array, vert_seq_len, FALSE);
+
+		if (f_new == NULL) {
+			PyErr_SetString(PyExc_ValueError,
+			                "faces.new(verts): couldn't create the new face, internal error");
+			goto cleanup;
+		}
+
+		if (py_face_example) {
+			BM_elem_attrs_copy(py_face_example->bm, bm, py_face_example->f, f_new);
+		}
+
+		ret = BPy_BMFace_CreatePyObject(bm, f_new);
+
+		/* pass through */
+cleanup:
+		if (vert_array) PyMem_FREE(vert_array);
+		if (edge_array) PyMem_FREE(edge_array);
+		return ret;
+	}
+}
+
+/* Elem Seq
+ * -------- */
+
+PyDoc_STRVAR(bpy_bmvertseq_remove_doc,
+".. method:: remove(vert)\n"
+"\n"
+"   Remove a vert.\n"
+);
+static PyObject *bpy_bmvertseq_remove(BPy_BMElemSeq *self, BPy_BMVert *value)
+{
+	BPY_BM_CHECK_OBJ(self);
+
+	if (!BPy_BMVert_Check(value)) {
+		return NULL;
+	}
+	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;
+		}
+
+		BM_vert_kill(bm, value->v);
+		bpy_bm_generic_invalidate((BPy_BMGeneric *)value);
+
+		Py_RETURN_NONE;
+	}
+}
+
+PyDoc_STRVAR(bpy_bmedgeseq_remove_doc,
+".. method:: remove(edge)\n"
+"\n"
+"   Remove a edge.\n"
+);
+static PyObject *bpy_bmedgeseq_remove(BPy_BMElemSeq *self, BPy_BMEdge *value)
+{
+	BPY_BM_CHECK_OBJ(self);
+
+	if (!BPy_BMEdge_Check(value)) {
+		return NULL;
+	}
+	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;
+		}
+
+		BM_edge_kill(bm, value->e);
+		bpy_bm_generic_invalidate((BPy_BMGeneric *)value);
+
+		Py_RETURN_NONE;
+	}
+}
+
+PyDoc_STRVAR(bpy_bmfaceseq_remove_doc,
+".. method:: remove(face)\n"
+"\n"
+"   Remove a face.\n"
+);
+static PyObject *bpy_bmfaceseq_remove(BPy_BMElemSeq *self, BPy_BMFace *value)
+{
+	BPY_BM_CHECK_OBJ(self);
+
+	if (!BPy_BMFace_Check(value)) {
+		return NULL;
+	}
+	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;
+		}
+
+		BM_face_kill(bm, value->f);
+		bpy_bm_generic_invalidate((BPy_BMGeneric *)value);
+
+		Py_RETURN_NONE;
+	}
+}
+
+PyDoc_STRVAR(bpy_bmedgeseq_get__method_doc,
+".. method:: get(verts, fallback=None)\n"
+"\n"
+"   Return a edge which uses the **verts** passed.\n"
+"\n"
+"   :arg verts: Sequence of verts.\n"
+"   :type verts: :class:`BMVert`\n"
+"   :arg fallback: Return this value if nothing is found.\n"
+"   :return: The edge found or None\n"
+"   :rtype: :class:`BMEdge`\n"
+);
+static PyObject *bpy_bmedgeseq_get__method(BPy_BMElemSeq *self, PyObject *args)
+{
+	PyObject *vert_seq;
+	PyObject *fallback = Py_None; /* optional */
+
+	BPY_BM_CHECK_OBJ(self);
+
+	if (!PyArg_ParseTuple(args, "O|O:edges.get",
+	                      &vert_seq,
+	                      &fallback))
+	{
+		return NULL;
+	}
+	else {
+		BMesh *bm = self->bm;
+		BMEdge *e;
+		BMVert **vert_array = NULL;
+		Py_ssize_t vert_seq_len; /* always 2 */
+		PyObject *ret = NULL;
+
+		vert_array = BPy_BMElem_PySeq_As_Array(&bm, vert_seq, 2, 2,
+		                                       &vert_seq_len, BM_VERT,
+		                                       TRUE, TRUE, "edges.get(...)");
+
+		if (vert_array == NULL) {
+			return NULL;
+		}
+
+		if ((e = BM_edge_exists(vert_array[0], vert_array[1]))) {
+			ret = BPy_BMEdge_CreatePyObject(bm, e);
+		}
+		else {
+			ret = fallback;
+			Py_INCREF(ret);
+		}
+
+		PyMem_FREE(vert_array);
+		return ret;
+	}
+}
+
+PyDoc_STRVAR(bpy_bmfaceseq_get__method_doc,
+".. method:: get(verts, fallback=None)\n"
+"\n"
+"   Return a face which uses the **verts** passed.\n"
+"\n"
+"   :arg verts: Sequence of verts.\n"
+"   :type verts: :class:`BMVert`\n"
+"   :arg fallback: Return this value if nothing is found.\n"
+"   :return: The face found or None\n"
+"   :rtype: :class:`BMFace`\n"
+);
+static PyObject *bpy_bmfaceseq_get__method(BPy_BMElemSeq *self, PyObject *args)
+{
+	PyObject *vert_seq;
+	PyObject *fallback = Py_None; /* optional */
+
+	BPY_BM_CHECK_OBJ(self);
+
+	if (!PyArg_ParseTuple(args, "O|O:faces.get",
+	                      &vert_seq,
+	                      &fallback))
+	{
+		return NULL;
+	}
+	else {
+		BMesh *bm = self->bm;
+		BMFace *f = NULL;
+		BMVert **vert_array = NULL;
+		Py_ssize_t vert_seq_len;
+		PyObject *ret = NULL;
+
+		vert_array = BPy_BMElem_PySeq_As_Array(&bm, vert_seq, 1, PY_SSIZE_T_MAX,
+		                                       &vert_seq_len, BM_VERT,
+		                                       TRUE, TRUE, "faces.get(...)");
+
+		if (vert_array == NULL) {
+			return NULL;
+		}
+
+		if (BM_face_exists(bm, vert_array, vert_seq_len, &f)) {
+			ret = BPy_BMFace_CreatePyObject(bm, f);
+		}
+		else {
+			ret = fallback;
+			Py_INCREF(ret);
+		}
+
+		PyMem_FREE(vert_array);
+		return ret;
+	}
+}
+
+PyDoc_STRVAR(bpy_bmelemseq_index_update_doc,
+".. method:: index_update()\n"
+"\n"
+"   Initialize the index values of this sequence.\n"
+"\n"
+"   This is the equivalent of looping over all elements and assigning the index values.\n"
+"\n"
+"   .. code-block:: python\n"
+"\n"
+"      for index, ele in enumerate(sequence):\n"
+"          ele.index = index\n"
+"\n"
+"   .. note::\n"
+"\n"
+"      Running this on sequences besides :class:`BMesh.verts`, :class:`BMesh.edges`, :class:`BMesh.faces`\n"
+"      works but wont result in each element having a valid index, insted its order in the sequence will be set.\n"
+);
+static PyObject *bpy_bmelemseq_index_update(BPy_BMElemSeq *self)
+{
+	BMesh *bm = self->bm;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	switch ((BMIterType)self->itype) {
+		case BM_VERTS_OF_MESH:
+			BM_mesh_elem_index_ensure(self->bm, BM_VERT);
+			break;
+		case BM_EDGES_OF_MESH:
+			BM_mesh_elem_index_ensure(self->bm, BM_EDGE);
+			break;
+		case BM_FACES_OF_MESH:
+			BM_mesh_elem_index_ensure(self->bm, BM_FACE);
+			break;
+		default:
+		{
+			BMIter iter;
+			BMElem *ele;
+			int index = 0;
+			const char htype = bm_iter_itype_htype_map[self->itype];
+
+			BM_ITER_BPY_BM_SEQ(ele, &iter, self) {
+				BM_elem_index_set(ele, index); /* set_dirty! */
+				index++;
+			}
+
+			if (htype & (BM_VERT | BM_EDGE | BM_FACE)) {
+				/* since this isn't the normal vert/edge/face loops,
+				 * we're setting dirty values here. so tag as dirty. */
+				bm->elem_index_dirty |= htype;
+			}
+
+			break;
+		}
+	}
+
+	Py_RETURN_NONE;
+}
+
+
+static struct PyMethodDef bpy_bmesh_methods[] = {
+    /* utility */
+    {"copy",  (PyCFunction)bpy_bmesh_copy,  METH_NOARGS, bpy_bmesh_copy_doc},
+    {"clear", (PyCFunction)bpy_bmesh_clear, METH_NOARGS, bpy_bmesh_clear_doc},
+    {"free",  (PyCFunction)bpy_bmesh_free,  METH_NOARGS, bpy_bmesh_free_doc},
+
+    /* conversion */
+    {"from_object", (PyCFunction)bpy_bmesh_from_object, METH_VARARGS | METH_KEYWORDS, bpy_bmesh_from_object_doc},
+    {"from_mesh",   (PyCFunction)bpy_bmesh_from_mesh,   METH_VARARGS | METH_KEYWORDS, bpy_bmesh_from_mesh_doc},
+    {"to_mesh",     (PyCFunction)bpy_bmesh_to_mesh,     METH_VARARGS,                 bpy_bmesh_to_mesh_doc},
+
+    /* meshdata */
+    {"select_flush_mode", (PyCFunction)bpy_bmesh_select_flush_mode, METH_NOARGS, bpy_bmesh_select_flush_mode_doc},
+    {"select_flush", (PyCFunction)bpy_bmesh_select_flush, METH_O, bpy_bmesh_select_flush_doc},
+    {"normal_update", (PyCFunction)bpy_bmesh_normal_update, METH_VARARGS, bpy_bmesh_normal_update_doc},
+    {"transform", (PyCFunction)bpy_bmesh_transform, METH_VARARGS|METH_KEYWORDS, bpy_bmesh_transform_doc},
+    {NULL, NULL, 0, NULL}
+};
+
+static struct PyMethodDef bpy_bmvert_methods[] = {
+    {"select_set", (PyCFunction)bpy_bm_elem_select_set, METH_O, bpy_bm_elem_select_set_doc},
+    {"hide_set", (PyCFunction)bpy_bm_elem_hide_set, METH_O, bpy_bm_elem_hide_set_doc},
+    {"copy_from", (PyCFunction)bpy_bm_elem_copy_from, METH_O, bpy_bm_elem_copy_from_doc},
+    {"copy_from_face_interp", (PyCFunction)bpy_bmvert_copy_from_face_interp, METH_VARARGS, bpy_bmvert_copy_from_face_interp_doc},
+    {"copy_from_vert_interp", (PyCFunction)bpy_bmvert_copy_from_vert_interp, METH_VARARGS, bpy_bmvert_copy_from_vert_interp_doc},
+
+    {"calc_vert_angle",   (PyCFunction)bpy_bmvert_calc_edge_angle,   METH_NOARGS, bpy_bmvert_calc_edge_angle_doc},
+    {"calc_shell_factor", (PyCFunction)bpy_bmvert_calc_shell_factor, METH_NOARGS, bpy_bmvert_calc_shell_factor_doc},
+
+    {"normal_update",  (PyCFunction)bpy_bmvert_normal_update,  METH_NOARGS,  bpy_bmvert_normal_update_doc},
+
+    {NULL, NULL, 0, NULL}
+};
+
+static struct PyMethodDef bpy_bmedge_methods[] = {
+    {"select_set", (PyCFunction)bpy_bm_elem_select_set, METH_O, bpy_bm_elem_select_set_doc},
+    {"hide_set", (PyCFunction)bpy_bm_elem_hide_set, METH_O, bpy_bm_elem_hide_set_doc},
+    {"copy_from", (PyCFunction)bpy_bm_elem_copy_from, METH_O, bpy_bm_elem_copy_from_doc},
+
+    {"other_vert", (PyCFunction)bpy_bmedge_other_vert, METH_O, bpy_bmedge_other_vert_doc},
+
+    {"calc_length",     (PyCFunction)bpy_bmedge_calc_length,     METH_NOARGS,  bpy_bmedge_calc_length_doc},
+    {"calc_face_angle", (PyCFunction)bpy_bmedge_calc_face_angle, METH_NOARGS,  bpy_bmedge_calc_face_angle_doc},
+    {"calc_tangent",    (PyCFunction)bpy_bmedge_calc_tangent,    METH_VARARGS, bpy_bmedge_calc_tangent_doc},
+
+    {"normal_update",  (PyCFunction)bpy_bmedge_normal_update,  METH_NOARGS,  bpy_bmedge_normal_update_doc},
+
+    {NULL, NULL, 0, NULL}
+};
+
+static struct PyMethodDef bpy_bmface_methods[] = {
+    {"select_set", (PyCFunction)bpy_bm_elem_select_set, METH_O, bpy_bm_elem_select_set_doc},
+    {"hide_set", (PyCFunction)bpy_bm_elem_hide_set, METH_O, bpy_bm_elem_hide_set_doc},
+
+    {"copy_from", (PyCFunction)bpy_bm_elem_copy_from, METH_O, bpy_bm_elem_copy_from_doc},
+    {"copy_from_face_interp", (PyCFunction)bpy_bmface_copy_from_face_interp, METH_O, bpy_bmface_copy_from_face_interp_doc},
+
+    {"copy", (PyCFunction)bpy_bmface_copy, METH_VARARGS|METH_KEYWORDS, bpy_bmface_copy_doc},
+
+    {"calc_area",          (PyCFunction)bpy_bmface_calc_area,          METH_NOARGS, bpy_bmface_calc_area_doc},
+    {"calc_perimeter",     (PyCFunction)bpy_bmface_calc_perimeter,     METH_NOARGS, bpy_bmface_calc_perimeter_doc},
+    {"calc_center_median", (PyCFunction)bpy_bmface_calc_center_mean,   METH_NOARGS, bpy_bmface_calc_center_mean_doc},
+    {"calc_center_bounds", (PyCFunction)bpy_bmface_calc_center_bounds, METH_NOARGS, bpy_bmface_calc_center_bounds_doc},
+
+    {"normal_update",  (PyCFunction)bpy_bmface_normal_update,  METH_NOARGS,  bpy_bmface_normal_update_doc},
+
+    {NULL, NULL, 0, NULL}
+};
+
+static struct PyMethodDef bpy_bmloop_methods[] = {
+    {"copy_from", (PyCFunction)bpy_bm_elem_copy_from, METH_O, bpy_bm_elem_copy_from_doc},
+    {"copy_from_face_interp", (PyCFunction)bpy_bmloop_copy_from_face_interp, METH_O, bpy_bmloop_copy_from_face_interp_doc},
+
+    {"calc_angle",   (PyCFunction)bpy_bmloop_calc_angle,   METH_NOARGS, bpy_bmloop_calc_angle_doc},
+    {"calc_normal",  (PyCFunction)bpy_bmloop_calc_normal,  METH_NOARGS, bpy_bmloop_calc_normal_doc},
+    {"calc_tangent", (PyCFunction)bpy_bmloop_calc_tangent, METH_NOARGS, bpy_bmloop_calc_tangent_doc},
+    {NULL, NULL, 0, NULL}
+};
+
+static struct PyMethodDef bpy_bmelemseq_methods[] = {
+    /* odd function, initializes index values */
+    {"index_update", (PyCFunction)bpy_bmelemseq_index_update, METH_NOARGS, bpy_bmelemseq_index_update_doc},
+    {NULL, NULL, 0, NULL}
+};
+
+static struct PyMethodDef bpy_bmvertseq_methods[] = {
+    {"new",     (PyCFunction)bpy_bmvertseq_new,         METH_VARARGS, bpy_bmvertseq_new_doc},
+    {"remove",  (PyCFunction)bpy_bmvertseq_remove,      METH_O,       bpy_bmvertseq_remove_doc},
+
+    /* odd function, initializes index values */
+    {"index_update", (PyCFunction)bpy_bmelemseq_index_update, METH_NOARGS, bpy_bmelemseq_index_update_doc},
+    {NULL, NULL, 0, NULL}
+};
+
+static struct PyMethodDef bpy_bmedgeseq_methods[] = {
+    {"new",     (PyCFunction)bpy_bmedgeseq_new,         METH_VARARGS, bpy_bmedgeseq_new_doc},
+    {"remove",  (PyCFunction)bpy_bmedgeseq_remove,      METH_O,       bpy_bmedgeseq_remove_doc},
+    /* 'bpy_bmelemseq_get' for different purpose */
+    {"get",     (PyCFunction)bpy_bmedgeseq_get__method, METH_VARARGS, bpy_bmedgeseq_get__method_doc},
+
+    /* odd function, initializes index values */
+    {"index_update", (PyCFunction)bpy_bmelemseq_index_update, METH_NOARGS, bpy_bmelemseq_index_update_doc},
+    {NULL, NULL, 0, NULL}
+};
+
+static struct PyMethodDef bpy_bmfaceseq_methods[] = {
+    {"new",     (PyCFunction)bpy_bmfaceseq_new,         METH_VARARGS, bpy_bmfaceseq_new_doc},
+    {"remove",  (PyCFunction)bpy_bmfaceseq_remove,      METH_O,       bpy_bmfaceseq_remove_doc},
+    /* 'bpy_bmelemseq_get' for different purpose */
+    {"get",     (PyCFunction)bpy_bmfaceseq_get__method, METH_VARARGS, bpy_bmfaceseq_get__method_doc},
+
+    /* odd function, initializes index values */
+    {"index_update", (PyCFunction)bpy_bmelemseq_index_update, METH_NOARGS, bpy_bmelemseq_index_update_doc},
+    {NULL, NULL, 0, NULL}
+};
+
+static struct PyMethodDef bpy_bmloopseq_methods[] = {
+    /* odd function, initializes index values */
+    /* no: index_update() function since we cant iterate over loops */
+    {NULL, NULL, 0, NULL}
+};
+
+/* Sequences
+ * ========= */
+
+/* BMElemSeq / Iter
+ * ---------------- */
+
+static PyTypeObject *bpy_bm_itype_as_pytype(const char itype)
+{
+	/* should cover all types */
+	switch ((BMIterType)itype) {
+		case BM_VERTS_OF_MESH:
+		case BM_VERTS_OF_FACE:
+		case BM_VERTS_OF_EDGE:
+			return &BPy_BMVert_Type;
+
+		case BM_EDGES_OF_MESH:
+		case BM_EDGES_OF_FACE:
+		case BM_EDGES_OF_VERT:
+			return &BPy_BMEdge_Type;
+
+		case BM_FACES_OF_MESH:
+		case BM_FACES_OF_EDGE:
+		case BM_FACES_OF_VERT:
+			return &BPy_BMFace_Type;
+
+		case BM_ALL_LOOPS_OF_FACE:
+		case BM_LOOPS_OF_FACE:
+		case BM_LOOPS_OF_EDGE:
+		case BM_LOOPS_OF_VERT:
+		case BM_LOOPS_OF_LOOP:
+			return &BPy_BMLoop_Type;
+	}
+
+	return NULL;
+}
+
+static Py_ssize_t bpy_bmelemseq_length(BPy_BMElemSeq *self)
+{
+	BPY_BM_CHECK_INT(self);
+
+	/* first check if the size is known */
+	switch ((BMIterType)self->itype) {
+		/* main-types */
+		case BM_VERTS_OF_MESH:
+			return self->bm->totvert;
+		case BM_EDGES_OF_MESH:
+			return self->bm->totedge;
+		case BM_FACES_OF_MESH:
+			return self->bm->totface;
+
+			/* sub-types */
+		case BM_VERTS_OF_FACE:
+		case BM_EDGES_OF_FACE:
+		case BM_LOOPS_OF_FACE:
+			BPY_BM_CHECK_INT(self->py_ele);
+			return ((BMFace *)self->py_ele->ele)->len;
+
+		case BM_VERTS_OF_EDGE:
+			return 2;
+
+		default:
+			/* quiet compiler */
+			break;
+	}
+
+
+	/* loop over all items, avoid this if we can */
+	{
+		BMIter iter;
+		BMHeader *ele;
+		Py_ssize_t tot = 0;
+
+		BM_ITER_BPY_BM_SEQ(ele, &iter, self) {
+			tot++;
+		}
+		return tot;
+	}
+}
+
+static PyObject *bpy_bmelemseq_subscript_int(BPy_BMElemSeq *self, int keynum)
+{
+	BPY_BM_CHECK_OBJ(self);
+
+	if (keynum < 0) keynum += bpy_bmelemseq_length(self); /* only get length on negative value, may loop entire seq */
+	if (keynum >= 0) {
+		BMHeader *ele = BM_iter_at_index(self->bm, self->itype, self->py_ele ? self->py_ele->ele : NULL, keynum);
+		if (ele) {
+			return BPy_BMElem_CreatePyObject(self->bm, ele);
+		}
+	}
+
+	PyErr_Format(PyExc_IndexError,
+	             "BMElemSeq[index]: index %d out of range", keynum);
+	return NULL;
+}
+
+static PyObject *bpy_bmelemseq_subscript_slice(BPy_BMElemSeq *self, Py_ssize_t start, Py_ssize_t stop)
+{
+	BMIter iter;
+	int count = 0;
+	int ok;
+
+	PyObject *list;
+	PyObject *item;
+	BMHeader *ele;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	list = PyList_New(0);
+
+	ok = BM_iter_init(&iter, self->bm, self->itype, self->py_ele ? self->py_ele->ele : NULL);
+
+	BLI_assert(ok == TRUE);
+
+	if (UNLIKELY(ok == FALSE)) {
+		return list;
+	}
+
+	/* first loop up-until the start */
+	for (ok = TRUE; ok; ok = (BM_iter_step(&iter) != NULL)) {
+		if (count == start) {
+			break;
+		}
+		count++;
+	}
+
+	/* add items until stop */
+	while ((ele = BM_iter_step(&iter))) {
+		item = BPy_BMElem_CreatePyObject(self->bm, ele);
+		PyList_Append(list, item);
+		Py_DECREF(item);
+
+		count++;
+		if (count == stop) {
+			break;
+		}
+	}
+
+	return list;
+}
+
+static PyObject *bpy_bmelemseq_subscript(BPy_BMElemSeq *self, PyObject *key)
+{
+	/* don't need error check here */
+	if (PyIndex_Check(key)) {
+		Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
+		if (i == -1 && PyErr_Occurred())
+			return NULL;
+		return bpy_bmelemseq_subscript_int(self, i);
+	}
+	else if (PySlice_Check(key)) {
+		PySliceObject *key_slice = (PySliceObject *)key;
+		Py_ssize_t step = 1;
+
+		if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) {
+			return NULL;
+		}
+		else if (step != 1) {
+			PyErr_SetString(PyExc_TypeError,
+			                "BMElemSeq[slice]: slice steps not supported");
+			return NULL;
+		}
+		else if (key_slice->start == Py_None && key_slice->stop == Py_None) {
+			return bpy_bmelemseq_subscript_slice(self, 0, PY_SSIZE_T_MAX);
+		}
+		else {
+			Py_ssize_t start = 0, stop = PY_SSIZE_T_MAX;
+
+			/* avoid PySlice_GetIndicesEx because it needs to know the length ahead of time. */
+			if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) return NULL;
+			if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop))    return NULL;
+
+			if (start < 0 || stop < 0) {
+				/* only get the length for negative values */
+				Py_ssize_t len = bpy_bmelemseq_length(self);
+				if (start < 0) start += len;
+				if (stop < 0) start += len;
+			}
+
+			if (stop - start <= 0) {
+				return PyList_New(0);
+			}
+			else {
+				return bpy_bmelemseq_subscript_slice(self, start, stop);
+			}
+		}
+	}
+	else {
+		PyErr_SetString(PyExc_AttributeError,
+		                "BMElemSeq[key]: invalid key, key must be an int");
+		return NULL;
+	}
+}
+
+static int bpy_bmelemseq_contains(BPy_BMElemSeq *self, PyObject *value)
+{
+	BPY_BM_CHECK_INT(self);
+
+	if (Py_TYPE(value) == bpy_bm_itype_as_pytype(self->itype)) {
+		BPy_BMElem *value_bm_ele = (BPy_BMElem *)value;
+		if (value_bm_ele->bm == self->bm) {
+			BMElem *ele, *ele_test = value_bm_ele->ele;
+			BMIter iter;
+			BM_ITER_BPY_BM_SEQ(ele, &iter, self) {
+				if (ele == ele_test) {
+					return 1;
+				}
+			}
+		}
+	}
+
+	return 0;
+}
+
+/* BMElem (customdata)
+ * ------------------- */
+
+static PyObject *bpy_bmelem_subscript(BPy_BMElem *self, BPy_BMLayerItem *key)
+{
+	BPY_BM_CHECK_OBJ(self);
+
+	return BPy_BMLayerItem_GetItem(self, key);
+}
+
+static int bpy_bmelem_ass_subscript(BPy_BMElem *self, BPy_BMLayerItem *key, PyObject *value)
+{
+	BPY_BM_CHECK_INT(self);
+
+	return BPy_BMLayerItem_SetItem(self, key, value);
+}
+
+static PySequenceMethods bpy_bmelemseq_as_sequence = {
+    (lenfunc)bpy_bmelemseq_length,                  /* sq_length */
+    NULL,                                        /* sq_concat */
+    NULL,                                        /* sq_repeat */
+    (ssizeargfunc)bpy_bmelemseq_subscript_int,      /* sq_item */ /* Only set this so PySequence_Check() returns True */
+    NULL,                                        /* sq_slice */
+    (ssizeobjargproc)NULL,                       /* sq_ass_item */
+    NULL,                                        /* *was* sq_ass_slice */
+    (objobjproc)bpy_bmelemseq_contains,             /* sq_contains */
+    (binaryfunc) NULL,                           /* sq_inplace_concat */
+    (ssizeargfunc) NULL,                         /* sq_inplace_repeat */
+};
+
+static PyMappingMethods bpy_bmelemseq_as_mapping = {
+    (lenfunc)bpy_bmelemseq_length,                  /* mp_length */
+    (binaryfunc)bpy_bmelemseq_subscript,            /* mp_subscript */
+    (objobjargproc)NULL,                         /* mp_ass_subscript */
+};
+
+/* for customdata access */
+static PyMappingMethods bpy_bm_elem_as_mapping = {
+    (lenfunc)NULL,                           /* mp_length */ /* keep this empty, messes up 'if elem: ...' test */
+    (binaryfunc)bpy_bmelem_subscript,        /* mp_subscript */
+    (objobjargproc)bpy_bmelem_ass_subscript, /* mp_ass_subscript */
+};
+
+/* Iterator
+ * -------- */
+
+static PyObject *bpy_bmelemseq_iter(BPy_BMElemSeq *self)
+{
+	BPy_BMIter *py_iter;
+
+	BPY_BM_CHECK_OBJ(self);
+	py_iter = (BPy_BMIter *)BPy_BMIter_CreatePyObject(self->bm);
+	BM_iter_init(&(py_iter->iter), self->bm, self->itype, self->py_ele ? self->py_ele->ele : NULL);
+	return (PyObject *)py_iter;
+}
+
+static PyObject *bpy_bmiter_next(BPy_BMIter *self)
+{
+	BMHeader *ele = BM_iter_step(&self->iter);
+	if (ele == NULL) {
+		PyErr_SetString(PyExc_StopIteration,
+		                "bpy_bmiter_next stop");
+		return NULL;
+	}
+	else {
+		return (PyObject *)BPy_BMElem_CreatePyObject(self->bm, ele);
+	}
+}
+
+
+/* Dealloc Functions
+ * ================= */
+
+static void bpy_bmesh_dealloc(BPy_BMesh *self)
+{
+	BMesh *bm = self->bm;
+
+	/* have have been freed by bmesh */
+	if (bm) {
+		BM_data_layer_free(bm, &bm->vdata, CD_BM_ELEM_PYPTR);
+		BM_data_layer_free(bm, &bm->edata, CD_BM_ELEM_PYPTR);
+		BM_data_layer_free(bm, &bm->pdata, CD_BM_ELEM_PYPTR);
+		BM_data_layer_free(bm, &bm->ldata, CD_BM_ELEM_PYPTR);
+
+		bm->py_handle = NULL;
+
+		if ((self->flag & BPY_BMFLAG_IS_WRAPPED) == 0) {
+			BM_mesh_free(bm);
+		}
+	}
+
+	PyObject_DEL(self);
+}
+
+static void bpy_bmvert_dealloc(BPy_BMElem *self)
+{
+	BMesh *bm = self->bm;
+	if (bm) {
+		void **ptr = CustomData_bmesh_get(&bm->vdata, self->ele->head.data, CD_BM_ELEM_PYPTR);
+		*ptr = NULL;
+	}
+	PyObject_DEL(self);
+}
+
+static void bpy_bmedge_dealloc(BPy_BMElem *self)
+{
+	BMesh *bm = self->bm;
+	if (bm) {
+		void **ptr = CustomData_bmesh_get(&bm->edata, self->ele->head.data, CD_BM_ELEM_PYPTR);
+		*ptr = NULL;
+	}
+	PyObject_DEL(self);
+}
+
+static void bpy_bmface_dealloc(BPy_BMElem *self)
+{
+	BMesh *bm = self->bm;
+	if (bm) {
+		void **ptr = CustomData_bmesh_get(&bm->pdata, self->ele->head.data, CD_BM_ELEM_PYPTR);
+		*ptr = NULL;
+	}
+	PyObject_DEL(self);
+}
+
+static void bpy_bmloop_dealloc(BPy_BMElem *self)
+{
+	BMesh *bm = self->bm;
+	if (bm) {
+		void **ptr = CustomData_bmesh_get(&bm->ldata, self->ele->head.data, CD_BM_ELEM_PYPTR);
+		*ptr = NULL;
+	}
+	PyObject_DEL(self);
+}
+
+static void bpy_bmelemseq_dealloc(BPy_BMElemSeq *self)
+{
+	Py_XDECREF(self->py_ele);
+
+	PyObject_DEL(self);
+}
+
+/* not sure where this should go */
+static Py_hash_t bpy_bm_elem_hash(PyObject *self)
+{
+	return _Py_HashPointer(((BPy_BMElem *)self)->ele);
+}
+
+static Py_hash_t bpy_bm_hash(PyObject *self)
+{
+	return _Py_HashPointer(((BPy_BMesh *)self)->bm);
+}
+
+/* Type Docstrings
+ * =============== */
+
+PyDoc_STRVAR(bpy_bmesh_doc,
+"The BMesh data structure\n"
+);
+PyDoc_STRVAR(bpy_bmvert_doc,
+"The BMesh vertex type\n"
+);
+PyDoc_STRVAR(bpy_bmedge_doc,
+"The BMesh edge connecting 2 verts\n"
+);
+PyDoc_STRVAR(bpy_bmface_doc,
+"The BMesh face with 3 or more sides\n"
+);
+PyDoc_STRVAR(bpy_bmloop_doc,
+"This is normally accessed from :class:`BMFace.loops` where each face corner represents a corner of a face.\n"
+);
+PyDoc_STRVAR(bpy_bmelemseq_doc,
+"General sequence type used for accessing any sequence of \n"
+":class:`BMVert`, :class:`BMEdge`, :class:`BMFace`, :class:`BMLoop`.\n"
+"\n"
+"When accessed via :class:`BMesh.verts`, :class:`BMesh.edges`, :class:`BMesh.faces` \n"
+"there are also functions to create/remomove items.\n"
+);
+PyDoc_STRVAR(bpy_bmiter_doc,
+"Internal BMesh type for looping over verts/faces/edges,\n"
+"used for iterating over :class:`BMElemSeq` types.\n"
+);
+
+static PyObject *bpy_bmesh_repr(BPy_BMesh *self)
+{
+	BMesh *bm = self->bm;
+
+	if (bm) {
+		return PyUnicode_FromFormat("<BMesh(%p), totvert=%d, totedge=%d, totface=%d, totloop=%d>",
+		                            bm, bm->totvert, bm->totedge, bm->totface, bm->totloop);
+	}
+	else {
+		return PyUnicode_FromFormat("<BMesh dead at %p>", self);
+	}
+}
+
+static PyObject *bpy_bmvert_repr(BPy_BMVert *self)
+{
+	BMesh *bm = self->bm;
+
+	if (bm) {
+		BMVert *v = self->v;
+		return PyUnicode_FromFormat("<BMVert(%p), index=%d>",
+		                            v, BM_elem_index_get(v));
+	}
+	else {
+		return PyUnicode_FromFormat("<BMVert dead at %p>", self);
+	}
+}
+
+static PyObject *bpy_bmedge_repr(BPy_BMEdge *self)
+{
+	BMesh *bm = self->bm;
+
+	if (bm) {
+		BMEdge *e = self->e;
+		return PyUnicode_FromFormat("<BMEdge(%p), index=%d, verts=(%p/%d, %p/%d)>",
+		                            e, BM_elem_index_get(e),
+		                            e->v1, BM_elem_index_get(e->v1),
+		                            e->v2, BM_elem_index_get(e->v2));
+	}
+	else {
+		return PyUnicode_FromFormat("<BMEdge dead at %p>", self);
+	}
+}
+
+static PyObject *bpy_bmface_repr(BPy_BMFace *self)
+{
+	BMesh *bm = self->bm;
+
+	if (bm) {
+		BMFace *f = self->f;
+		return PyUnicode_FromFormat("<BMFace(%p), index=%d, totverts=%d>",
+		                            f, BM_elem_index_get(f),
+		                            f->len);
+	}
+	else {
+		return PyUnicode_FromFormat("<BMFace dead at %p>", self);
+	}
+}
+
+static PyObject *bpy_bmloop_repr(BPy_BMLoop *self)
+{
+	BMesh *bm = self->bm;
+
+	if (bm) {
+		BMLoop *l = self->l;
+		return PyUnicode_FromFormat("<BMLoop(%p), index=%d, vert=%p/%d, edge=%p/%d, face=%p/%d>",
+		                            l, BM_elem_index_get(l),
+		                            l->v, BM_elem_index_get(l->v),
+		                            l->e, BM_elem_index_get(l->e),
+		                            l->f, BM_elem_index_get(l->f));
+	}
+	else {
+		return PyUnicode_FromFormat("<BMLoop dead at %p>", self);
+	}
+}
+
+/* Types
+ * ===== */
+
+PyTypeObject BPy_BMesh_Type     = {{{0}}};
+PyTypeObject BPy_BMVert_Type    = {{{0}}};
+PyTypeObject BPy_BMEdge_Type    = {{{0}}};
+PyTypeObject BPy_BMFace_Type    = {{{0}}};
+PyTypeObject BPy_BMLoop_Type    = {{{0}}};
+PyTypeObject BPy_BMElemSeq_Type = {{{0}}};
+PyTypeObject BPy_BMVertSeq_Type = {{{0}}};
+PyTypeObject BPy_BMEdgeSeq_Type = {{{0}}};
+PyTypeObject BPy_BMFaceSeq_Type = {{{0}}};
+PyTypeObject BPy_BMLoopSeq_Type = {{{0}}};
+PyTypeObject BPy_BMIter_Type    = {{{0}}};
+
+
+
+void BPy_BM_init_types(void)
+{
+	BPy_BMesh_Type.tp_basicsize     = sizeof(BPy_BMesh);
+	BPy_BMVert_Type.tp_basicsize    = sizeof(BPy_BMVert);
+	BPy_BMEdge_Type.tp_basicsize    = sizeof(BPy_BMEdge);
+	BPy_BMFace_Type.tp_basicsize    = sizeof(BPy_BMFace);
+	BPy_BMLoop_Type.tp_basicsize    = sizeof(BPy_BMLoop);
+	BPy_BMElemSeq_Type.tp_basicsize = sizeof(BPy_BMElemSeq);
+	BPy_BMVertSeq_Type.tp_basicsize = sizeof(BPy_BMElemSeq);
+	BPy_BMEdgeSeq_Type.tp_basicsize = sizeof(BPy_BMElemSeq);
+	BPy_BMFaceSeq_Type.tp_basicsize = sizeof(BPy_BMElemSeq);
+	BPy_BMLoopSeq_Type.tp_basicsize = sizeof(BPy_BMElemSeq);
+	BPy_BMIter_Type.tp_basicsize    = sizeof(BPy_BMIter);
+
+
+	BPy_BMesh_Type.tp_name     = "BMesh";
+	BPy_BMVert_Type.tp_name    = "BMVert";
+	BPy_BMEdge_Type.tp_name    = "BMEdge";
+	BPy_BMFace_Type.tp_name    = "BMFace";
+	BPy_BMLoop_Type.tp_name    = "BMLoop";
+	BPy_BMElemSeq_Type.tp_name = "BMElemSeq";
+	BPy_BMVertSeq_Type.tp_name = "BMVertSeq";
+	BPy_BMEdgeSeq_Type.tp_name = "BMEdgeSeq";
+	BPy_BMFaceSeq_Type.tp_name = "BMFaceSeq";
+	BPy_BMLoopSeq_Type.tp_name = "BMLoopSeq";
+	BPy_BMIter_Type.tp_name    = "BMIter";
+
+
+	BPy_BMesh_Type.tp_doc     = bpy_bmesh_doc;
+	BPy_BMVert_Type.tp_doc    = bpy_bmvert_doc;
+	BPy_BMEdge_Type.tp_doc    = bpy_bmedge_doc;
+	BPy_BMFace_Type.tp_doc    = bpy_bmface_doc;
+	BPy_BMLoop_Type.tp_doc    = bpy_bmloop_doc;
+	BPy_BMElemSeq_Type.tp_doc = bpy_bmelemseq_doc;
+	BPy_BMVertSeq_Type.tp_doc = NULL;
+	BPy_BMEdgeSeq_Type.tp_doc = NULL;
+	BPy_BMFaceSeq_Type.tp_doc = NULL;
+	BPy_BMLoopSeq_Type.tp_doc = NULL;
+	BPy_BMIter_Type.tp_doc    = bpy_bmiter_doc;
+
+
+	BPy_BMesh_Type.tp_repr     = (reprfunc)bpy_bmesh_repr;
+	BPy_BMVert_Type.tp_repr    = (reprfunc)bpy_bmvert_repr;
+	BPy_BMEdge_Type.tp_repr    = (reprfunc)bpy_bmedge_repr;
+	BPy_BMFace_Type.tp_repr    = (reprfunc)bpy_bmface_repr;
+	BPy_BMLoop_Type.tp_repr    = (reprfunc)bpy_bmloop_repr;
+	BPy_BMElemSeq_Type.tp_repr = NULL;
+	BPy_BMVertSeq_Type.tp_repr = NULL;
+	BPy_BMEdgeSeq_Type.tp_repr = NULL;
+	BPy_BMFaceSeq_Type.tp_repr = NULL;
+	BPy_BMLoopSeq_Type.tp_repr = NULL;
+	BPy_BMIter_Type.tp_repr    = NULL;
+
+
+	BPy_BMesh_Type.tp_getset     = bpy_bmesh_getseters;
+	BPy_BMVert_Type.tp_getset    = bpy_bmvert_getseters;
+	BPy_BMEdge_Type.tp_getset    = bpy_bmedge_getseters;
+	BPy_BMFace_Type.tp_getset    = bpy_bmface_getseters;
+	BPy_BMLoop_Type.tp_getset    = bpy_bmloop_getseters;
+	BPy_BMElemSeq_Type.tp_getset = NULL;
+	BPy_BMVertSeq_Type.tp_getset = bpy_bmvertseq_getseters;
+	BPy_BMEdgeSeq_Type.tp_getset = bpy_bmedgeseq_getseters;
+	BPy_BMFaceSeq_Type.tp_getset = bpy_bmfaceseq_getseters;
+	BPy_BMLoopSeq_Type.tp_getset = bpy_bmloopseq_getseters;
+	BPy_BMIter_Type.tp_getset    = NULL;
+
+
+	BPy_BMesh_Type.tp_methods     = bpy_bmesh_methods;
+	BPy_BMVert_Type.tp_methods    = bpy_bmvert_methods;
+	BPy_BMEdge_Type.tp_methods    = bpy_bmedge_methods;
+	BPy_BMFace_Type.tp_methods    = bpy_bmface_methods;
+	BPy_BMLoop_Type.tp_methods    = bpy_bmloop_methods;
+	BPy_BMElemSeq_Type.tp_methods = bpy_bmelemseq_methods;
+	BPy_BMVertSeq_Type.tp_methods = bpy_bmvertseq_methods;
+	BPy_BMEdgeSeq_Type.tp_methods = bpy_bmedgeseq_methods;
+	BPy_BMFaceSeq_Type.tp_methods = bpy_bmfaceseq_methods;
+	BPy_BMLoopSeq_Type.tp_methods = bpy_bmloopseq_methods;
+	BPy_BMIter_Type.tp_methods    = NULL;
+
+
+	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;
+	BPy_BMFace_Type.tp_hash    = bpy_bm_elem_hash;
+	BPy_BMLoop_Type.tp_hash    = bpy_bm_elem_hash;
+	BPy_BMElemSeq_Type.tp_hash = NULL;
+	BPy_BMVertSeq_Type.tp_hash = NULL;
+	BPy_BMEdgeSeq_Type.tp_hash = NULL;
+	BPy_BMFaceSeq_Type.tp_hash = NULL;
+	BPy_BMLoopSeq_Type.tp_hash = NULL;
+	BPy_BMIter_Type.tp_hash    = NULL;
+
+	BPy_BMElemSeq_Type.tp_as_sequence = &bpy_bmelemseq_as_sequence;
+	BPy_BMVertSeq_Type.tp_as_sequence = &bpy_bmelemseq_as_sequence;
+	BPy_BMEdgeSeq_Type.tp_as_sequence = &bpy_bmelemseq_as_sequence;
+	BPy_BMFaceSeq_Type.tp_as_sequence = &bpy_bmelemseq_as_sequence;
+	BPy_BMLoopSeq_Type.tp_as_sequence = NULL; /* this is not a seq really, only for layer access */
+
+	BPy_BMElemSeq_Type.tp_as_mapping = &bpy_bmelemseq_as_mapping;
+	BPy_BMVertSeq_Type.tp_as_mapping = &bpy_bmelemseq_as_mapping;
+	BPy_BMEdgeSeq_Type.tp_as_mapping = &bpy_bmelemseq_as_mapping;
+	BPy_BMFaceSeq_Type.tp_as_mapping = &bpy_bmelemseq_as_mapping;
+	BPy_BMLoopSeq_Type.tp_as_mapping = NULL; /* this is not a seq really, only for layer access */
+
+	/* layer access */
+	BPy_BMVert_Type.tp_as_mapping    = &bpy_bm_elem_as_mapping;
+	BPy_BMEdge_Type.tp_as_mapping    = &bpy_bm_elem_as_mapping;
+	BPy_BMFace_Type.tp_as_mapping    = &bpy_bm_elem_as_mapping;
+	BPy_BMLoop_Type.tp_as_mapping    = &bpy_bm_elem_as_mapping;
+
+	BPy_BMElemSeq_Type.tp_iter = (getiterfunc)bpy_bmelemseq_iter;
+	BPy_BMVertSeq_Type.tp_iter = (getiterfunc)bpy_bmelemseq_iter;
+	BPy_BMEdgeSeq_Type.tp_iter = (getiterfunc)bpy_bmelemseq_iter;
+	BPy_BMFaceSeq_Type.tp_iter = (getiterfunc)bpy_bmelemseq_iter;
+	BPy_BMLoopSeq_Type.tp_iter = NULL; /* no mapping */
+
+	/* only 1 iteratir so far */
+	BPy_BMIter_Type.tp_iternext = (iternextfunc)bpy_bmiter_next;
+	BPy_BMIter_Type.tp_iter     = PyObject_SelfIter;
+
+	BPy_BMesh_Type.tp_dealloc     = (destructor)bpy_bmesh_dealloc;
+	BPy_BMVert_Type.tp_dealloc    = (destructor)bpy_bmvert_dealloc;
+	BPy_BMEdge_Type.tp_dealloc    = (destructor)bpy_bmedge_dealloc;
+	BPy_BMFace_Type.tp_dealloc    = (destructor)bpy_bmface_dealloc;
+	BPy_BMLoop_Type.tp_dealloc    = (destructor)bpy_bmloop_dealloc;
+	BPy_BMElemSeq_Type.tp_dealloc = (destructor)bpy_bmelemseq_dealloc;
+	BPy_BMVertSeq_Type.tp_dealloc = (destructor)bpy_bmelemseq_dealloc;
+	BPy_BMEdgeSeq_Type.tp_dealloc = (destructor)bpy_bmelemseq_dealloc;
+	BPy_BMFaceSeq_Type.tp_dealloc = (destructor)bpy_bmelemseq_dealloc;
+	BPy_BMLoopSeq_Type.tp_dealloc = (destructor)bpy_bmelemseq_dealloc;
+	BPy_BMIter_Type.tp_dealloc    = NULL;
+
+	BPy_BMesh_Type.tp_flags     = Py_TPFLAGS_DEFAULT;
+	BPy_BMVert_Type.tp_flags    = Py_TPFLAGS_DEFAULT;
+	BPy_BMEdge_Type.tp_flags    = Py_TPFLAGS_DEFAULT;
+	BPy_BMFace_Type.tp_flags    = Py_TPFLAGS_DEFAULT;
+	BPy_BMLoop_Type.tp_flags    = Py_TPFLAGS_DEFAULT;
+	BPy_BMElemSeq_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+	BPy_BMVertSeq_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+	BPy_BMEdgeSeq_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+	BPy_BMFaceSeq_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+	BPy_BMLoopSeq_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+	BPy_BMIter_Type.tp_flags    = Py_TPFLAGS_DEFAULT;
+
+
+	PyType_Ready(&BPy_BMesh_Type);
+	PyType_Ready(&BPy_BMVert_Type);
+	PyType_Ready(&BPy_BMEdge_Type);
+	PyType_Ready(&BPy_BMFace_Type);
+	PyType_Ready(&BPy_BMLoop_Type);
+	PyType_Ready(&BPy_BMElemSeq_Type);
+	PyType_Ready(&BPy_BMVertSeq_Type);
+	PyType_Ready(&BPy_BMEdgeSeq_Type);
+	PyType_Ready(&BPy_BMFaceSeq_Type);
+	PyType_Ready(&BPy_BMLoopSeq_Type);
+	PyType_Ready(&BPy_BMIter_Type);
+}
+
+/* bmesh.types submodule
+ * ********************* */
+
+static struct PyModuleDef BPy_BM_types_module_def = {
+    PyModuleDef_HEAD_INIT,
+    "bmesh.types",  /* m_name */
+    NULL,  /* m_doc */
+    0,  /* m_size */
+    NULL,  /* m_methods */
+    NULL,  /* m_reload */
+    NULL,  /* m_traverse */
+    NULL,  /* m_clear */
+    NULL,  /* m_free */
+};
+
+PyObject *BPyInit_bmesh_types(void)
+{
+	PyObject *submodule;
+
+	submodule = PyModule_Create(&BPy_BM_types_module_def);
+
+#define MODULE_TYPE_ADD(s, t) \
+	PyModule_AddObject(s, t.tp_name, (PyObject *)&t); Py_INCREF((PyObject *)&t)
+
+	/* bmesh_py_types.c */
+	MODULE_TYPE_ADD(submodule, BPy_BMesh_Type);
+	MODULE_TYPE_ADD(submodule, BPy_BMVert_Type);
+	MODULE_TYPE_ADD(submodule, BPy_BMEdge_Type);
+	MODULE_TYPE_ADD(submodule, BPy_BMFace_Type);
+	MODULE_TYPE_ADD(submodule, BPy_BMLoop_Type);
+	MODULE_TYPE_ADD(submodule, BPy_BMElemSeq_Type);
+	MODULE_TYPE_ADD(submodule, BPy_BMVertSeq_Type);
+	MODULE_TYPE_ADD(submodule, BPy_BMEdgeSeq_Type);
+	MODULE_TYPE_ADD(submodule, BPy_BMFaceSeq_Type);
+	MODULE_TYPE_ADD(submodule, BPy_BMLoopSeq_Type);
+	MODULE_TYPE_ADD(submodule, BPy_BMIter_Type);
+	/* bmesh_py_types_select.c */
+	MODULE_TYPE_ADD(submodule, BPy_BMEditSelSeq_Type);
+	MODULE_TYPE_ADD(submodule, BPy_BMEditSelIter_Type);
+	/* bmesh_py_types_customdata.c */
+	MODULE_TYPE_ADD(submodule, BPy_BMLayerAccessVert_Type);
+	MODULE_TYPE_ADD(submodule, BPy_BMLayerAccessEdge_Type);
+	MODULE_TYPE_ADD(submodule, BPy_BMLayerAccessFace_Type);
+	MODULE_TYPE_ADD(submodule, BPy_BMLayerAccessLoop_Type);
+	MODULE_TYPE_ADD(submodule, BPy_BMLayerCollection_Type);
+	MODULE_TYPE_ADD(submodule, BPy_BMLayerItem_Type);
+	/* bmesh_py_types_meshdata.c */
+	MODULE_TYPE_ADD(submodule, BPy_BMLoopUV_Type);
+	MODULE_TYPE_ADD(submodule, BPy_BMDeformVert_Type);
+
+#undef MODULE_TYPE_ADD
+
+	return submodule;
+}
+
+/* Utility Functions
+ * ***************** */
+
+PyObject *BPy_BMesh_CreatePyObject(BMesh *bm, int flag)
+{
+	BPy_BMesh *self;
+
+	if (bm->py_handle) {
+		self = bm->py_handle;
+		Py_INCREF(self);
+	}
+	else {
+		self = PyObject_New(BPy_BMesh, &BPy_BMesh_Type);
+		self->bm = bm;
+		self->flag = flag;
+
+		bm->py_handle = self; /* point back */
+
+		BM_data_layer_add(bm, &bm->vdata, CD_BM_ELEM_PYPTR);
+		BM_data_layer_add(bm, &bm->edata, CD_BM_ELEM_PYPTR);
+		BM_data_layer_add(bm, &bm->pdata, CD_BM_ELEM_PYPTR);
+		BM_data_layer_add(bm, &bm->ldata, CD_BM_ELEM_PYPTR);
+	}
+
+	return (PyObject *)self;
+}
+
+
+
+PyObject *BPy_BMVert_CreatePyObject(BMesh *bm, BMVert *v)
+{
+	BPy_BMVert *self;
+
+	void **ptr = CustomData_bmesh_get(&bm->vdata, v->head.data, CD_BM_ELEM_PYPTR);
+
+	/* bmesh may free layers, ensure we have one to store ourself */
+	if (UNLIKELY(ptr == NULL)) {
+		BM_data_layer_add(bm, &bm->vdata, CD_BM_ELEM_PYPTR);
+		ptr = CustomData_bmesh_get(&bm->vdata, v->head.data, CD_BM_ELEM_PYPTR);
+	}
+
+	if (*ptr != NULL) {
+		self = *ptr;
+		Py_INCREF(self);
+	}
+	else {
+		self = PyObject_New(BPy_BMVert, &BPy_BMVert_Type);
+		BLI_assert(v != NULL);
+		self->bm = bm;
+		self->v  = v;
+		*ptr = self;
+	}
+	return (PyObject *)self;
+}
+
+PyObject *BPy_BMEdge_CreatePyObject(BMesh *bm, BMEdge *e)
+{
+	BPy_BMEdge *self;
+
+	void **ptr = CustomData_bmesh_get(&bm->edata, e->head.data, CD_BM_ELEM_PYPTR);
+
+	/* bmesh may free layers, ensure we have one to store ourself */
+	if (UNLIKELY(ptr == NULL)) {
+		BM_data_layer_add(bm, &bm->edata, CD_BM_ELEM_PYPTR);
+		ptr = CustomData_bmesh_get(&bm->edata, e->head.data, CD_BM_ELEM_PYPTR);
+	}
+
+	if (*ptr != NULL) {
+		self = *ptr;
+		Py_INCREF(self);
+	}
+	else {
+		self = PyObject_New(BPy_BMEdge, &BPy_BMEdge_Type);
+		BLI_assert(e != NULL);
+		self->bm = bm;
+		self->e  = e;
+		*ptr = self;
+	}
+	return (PyObject *)self;
+}
+
+PyObject *BPy_BMFace_CreatePyObject(BMesh *bm, BMFace *f)
+{
+	BPy_BMFace *self;
+
+	void **ptr = CustomData_bmesh_get(&bm->pdata, f->head.data, CD_BM_ELEM_PYPTR);
+
+	/* bmesh may free layers, ensure we have one to store ourself */
+	if (UNLIKELY(ptr == NULL)) {
+		BM_data_layer_add(bm, &bm->pdata, CD_BM_ELEM_PYPTR);
+		ptr = CustomData_bmesh_get(&bm->pdata, f->head.data, CD_BM_ELEM_PYPTR);
+	}
+
+	if (*ptr != NULL) {
+		self = *ptr;
+		Py_INCREF(self);
+	}
+	else {
+		self = PyObject_New(BPy_BMFace, &BPy_BMFace_Type);
+		BLI_assert(f != NULL);
+		self->bm = bm;
+		self->f  = f;
+		*ptr = self;
+	}
+	return (PyObject *)self;
+}
+
+PyObject *BPy_BMLoop_CreatePyObject(BMesh *bm, BMLoop *l)
+{
+	BPy_BMLoop *self;
+
+	void **ptr = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_BM_ELEM_PYPTR);
+
+	/* bmesh may free layers, ensure we have one to store ourself */
+	if (UNLIKELY(ptr == NULL)) {
+		BM_data_layer_add(bm, &bm->ldata, CD_BM_ELEM_PYPTR);
+		ptr = CustomData_bmesh_get(&bm->ldata, l->head.data, CD_BM_ELEM_PYPTR);
+	}
+
+	if (*ptr != NULL) {
+		self = *ptr;
+		Py_INCREF(self);
+	}
+	else {
+		self = PyObject_New(BPy_BMLoop, &BPy_BMLoop_Type);
+		BLI_assert(l != NULL);
+		self->bm = bm;
+		self->l  = l;
+		*ptr = self;
+	}
+	return (PyObject *)self;
+}
+
+PyObject *BPy_BMElemSeq_CreatePyObject(BMesh *bm, BPy_BMElem *py_ele, const char itype)
+{
+	BPy_BMElemSeq *self = PyObject_New(BPy_BMElemSeq, &BPy_BMElemSeq_Type);
+	self->bm = bm;
+	self->py_ele = py_ele; /* can be NULL */
+	self->itype = itype;
+	Py_XINCREF(py_ele);
+	return (PyObject *)self;
+}
+
+PyObject *BPy_BMVertSeq_CreatePyObject(BMesh *bm)
+{
+	BPy_BMElemSeq *self = PyObject_New(BPy_BMElemSeq, &BPy_BMVertSeq_Type);
+	self->bm = bm;
+	self->py_ele = NULL; /* unused */
+	self->itype = BM_VERTS_OF_MESH;
+	return (PyObject *)self;
+}
+
+PyObject *BPy_BMEdgeSeq_CreatePyObject(BMesh *bm)
+{
+	BPy_BMElemSeq *self = PyObject_New(BPy_BMElemSeq, &BPy_BMEdgeSeq_Type);
+	self->bm = bm;
+	self->py_ele = NULL; /* unused */
+	self->itype = BM_EDGES_OF_MESH;
+	return (PyObject *)self;
+}
+
+PyObject *BPy_BMFaceSeq_CreatePyObject(BMesh *bm)
+{
+	BPy_BMElemSeq *self = PyObject_New(BPy_BMElemSeq, &BPy_BMFaceSeq_Type);
+	self->bm = bm;
+	self->py_ele = NULL; /* unused */
+	self->itype = BM_FACES_OF_MESH;
+	return (PyObject *)self;
+}
+
+PyObject *BPy_BMLoopSeq_CreatePyObject(BMesh *bm)
+{
+	BPy_BMElemSeq *self = PyObject_New(BPy_BMElemSeq, &BPy_BMLoopSeq_Type);
+	self->bm = bm;
+	self->py_ele = NULL; /* unused */
+	self->itype = 0; /* should never be passed to the iterator function */
+	return (PyObject *)self;
+}
+
+PyObject *BPy_BMIter_CreatePyObject(BMesh *bm)
+{
+	BPy_BMIter *self = PyObject_New(BPy_BMIter, &BPy_BMIter_Type);
+	self->bm = bm;
+	/* caller must initialize 'iter' member */
+	return (PyObject *)self;
+}
+
+/* this is just a helper func */
+PyObject *BPy_BMElem_CreatePyObject(BMesh *bm, BMHeader *ele)
+{
+	switch (ele->htype) {
+		case BM_VERT:
+			return BPy_BMVert_CreatePyObject(bm, (BMVert *)ele);
+		case BM_EDGE:
+			return BPy_BMEdge_CreatePyObject(bm, (BMEdge *)ele);
+		case BM_FACE:
+			return BPy_BMFace_CreatePyObject(bm, (BMFace *)ele);
+		case BM_LOOP:
+			return BPy_BMLoop_CreatePyObject(bm, (BMLoop *)ele);
+		default:
+			PyErr_SetString(PyExc_SystemError, "internal error");
+			return NULL;
+	}
+}
+
+int bpy_bm_generic_valid_check(BPy_BMGeneric *self)
+{
+	if (LIKELY(self->bm)) {
+		return 0;
+	}
+	else {
+		PyErr_Format(PyExc_ReferenceError,
+		             "BMesh data of type %.200s has been removed",
+		             Py_TYPE(self)->tp_name);
+		return -1;
+	}
+}
+
+void bpy_bm_generic_invalidate(BPy_BMGeneric *self)
+{
+	self->bm = NULL;
+}
+
+/* generic python seq as BMVert/Edge/Face array,
+ * return value must be freed with PyMem_FREE(...);
+ *
+ * The 'bm_r' value is assigned when empty, and used when set.
+ */
+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,
+                                const char *error_prefix)
+{
+	BMesh *bm = (r_bm && *r_bm) ? *r_bm : NULL;
+	PyObject *seq_fast;
+	*r_size = 0;
+
+	if (!(seq_fast = PySequence_Fast(seq, error_prefix))) {
+		return NULL;
+	}
+	else {
+		Py_ssize_t seq_len;
+		Py_ssize_t i;
+
+		BPy_BMElem *item;
+		BMElem **alloc;
+
+		seq_len = PySequence_Fast_GET_SIZE(seq_fast);
+
+		if (seq_len < min || seq_len > max) {
+			PyErr_Format(PyExc_TypeError,
+			             "%s: sequence incorrect size, expected [%d - %d], given %d",
+			             error_prefix, min, max, seq_len);
+			return NULL;
+		}
+
+
+		/* from now on, use goto */
+		alloc = PyMem_MALLOC(seq_len * sizeof(BPy_BMElem **));
+
+		for (i = 0; i < seq_len; i++) {
+			item = (BPy_BMElem *)PySequence_Fast_GET_ITEM(seq_fast, i);
+
+			if (!BPy_BMElem_CheckHType(Py_TYPE(item), htype)) {
+				PyErr_Format(PyExc_TypeError,
+				             "%s: expected %.200s, not '%.200s'",
+				             error_prefix, BPy_BMElem_StringFromHType(htype), Py_TYPE(item)->tp_name);
+				goto err_cleanup;
+			}
+			else if (!BPY_BM_IS_VALID(item)) {
+				PyErr_Format(PyExc_TypeError,
+				             "%s: %d %s has been removed",
+				             error_prefix, i, Py_TYPE(item)->tp_name);
+				goto err_cleanup;
+			}
+			/* trick so we can ensure all items have the same mesh,
+			 * and allows us to pass the 'bm' as NULL. */
+			else if (do_bm_check && (bm  && bm != item->bm)) {
+				PyErr_Format(PyExc_ValueError,
+				             "%s: %d %s is from another mesh",
+				             error_prefix, i, BPy_BMElem_StringFromHType(htype));
+				goto err_cleanup;
+			}
+
+			if (bm == NULL) {
+				bm = item->bm;
+			}
+
+			alloc[i] = item->ele;
+
+			if (do_unique_check) {
+				BM_elem_flag_enable(item->ele, BM_ELEM_INTERNAL_TAG);
+			}
+		}
+
+		if (do_unique_check) {
+			/* check for double verts! */
+			int ok = TRUE;
+			for (i = 0; i < seq_len; i++) {
+				if (UNLIKELY(BM_elem_flag_test(alloc[i], BM_ELEM_INTERNAL_TAG) == FALSE)) {
+					ok = FALSE;
+				}
+
+				/* ensure we don't leave this enabled */
+				BM_elem_flag_disable(alloc[i], BM_ELEM_INTERNAL_TAG);
+			}
+
+			if (ok == FALSE) {
+				PyErr_Format(PyExc_ValueError,
+				             "%s: found the same %.200s used multiple times",
+				             error_prefix, BPy_BMElem_StringFromHType(htype));
+				goto err_cleanup;
+			}
+		}
+
+		Py_DECREF(seq_fast);
+		*r_size = seq_len;
+		if (r_bm) *r_bm = bm;
+		return alloc;
+
+err_cleanup:
+		Py_DECREF(seq_fast);
+		PyMem_FREE(alloc);
+		return NULL;
+	}
+}
+
+
+PyObject *BPy_BMElem_Array_As_Tuple(BMesh *bm, BMHeader **elem, Py_ssize_t elem_len)
+{
+	Py_ssize_t i;
+	PyObject *ret = PyTuple_New(elem_len);
+	for (i = 0; i < elem_len; i++) {
+		PyTuple_SET_ITEM(ret, i, BPy_BMElem_CreatePyObject(bm, elem[i]));
+	}
+
+	return ret;
+}
+
+int BPy_BMElem_CheckHType(PyTypeObject *type, const char htype)
+{
+	return (((htype & BM_VERT) && (type == &BPy_BMVert_Type)) ||
+	        ((htype & BM_EDGE) && (type == &BPy_BMEdge_Type)) ||
+	        ((htype & BM_FACE) && (type == &BPy_BMFace_Type)) ||
+	        ((htype & BM_LOOP) && (type == &BPy_BMLoop_Type)));
+}
+
+/**
+ * Use for error strings only, not thread safe,
+ *
+ * \return a sting like '(BMVert/BMEdge/BMFace/BMLoop)'
+ */
+char *BPy_BMElem_StringFromHType_ex(const char htype, char ret[32])
+{
+	/* zero to ensure string is always NULL terminated */
+	char *ret_ptr = ret;
+	if (htype & BM_VERT) ret_ptr += sprintf(ret_ptr, "/%s", BPy_BMVert_Type.tp_name);
+	if (htype & BM_EDGE) ret_ptr += sprintf(ret_ptr, "/%s", BPy_BMEdge_Type.tp_name);
+	if (htype & BM_FACE) ret_ptr += sprintf(ret_ptr, "/%s", BPy_BMFace_Type.tp_name);
+	if (htype & BM_LOOP) ret_ptr += sprintf(ret_ptr, "/%s", BPy_BMLoop_Type.tp_name);
+	ret[0]   = '(';
+	*ret_ptr = ')';
+	return ret;
+}
+char *BPy_BMElem_StringFromHType(const char htype)
+{
+	/* zero to ensure string is always NULL terminated */
+	static char ret[32];
+	return BPy_BMElem_StringFromHType_ex(htype, ret);
+}
diff --git a/source/blender/python/bmesh/bmesh_py_types.h b/source/blender/python/bmesh/bmesh_py_types.h
new file mode 100644
index 0000000..a69091c
--- /dev/null
+++ b/source/blender/python/bmesh/bmesh_py_types.h
@@ -0,0 +1,189 @@
+/*
+ * ***** 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_types.h
+ *  \ingroup pybmesh
+ */
+
+#ifndef __BMESH_TYPES_H__
+#define __BMESH_TYPES_H__
+
+extern PyTypeObject BPy_BMesh_Type;
+extern PyTypeObject BPy_BMVert_Type;
+extern PyTypeObject BPy_BMEdge_Type;
+extern PyTypeObject BPy_BMFace_Type;
+extern PyTypeObject BPy_BMLoop_Type;
+
+extern PyTypeObject BPy_BMElemSeq_Type;
+extern PyTypeObject BPy_BMVertSeq_Type;
+extern PyTypeObject BPy_BMEdgeSeq_Type;
+extern PyTypeObject BPy_BMFaceSeq_Type;
+extern PyTypeObject BPy_BMLoopSeq_Type;
+
+extern PyTypeObject BPy_BMIter_Type;
+
+#define BPy_BMesh_Check(v)      (Py_TYPE(v) == &BPy_BMesh_Type)
+#define BPy_BMVert_Check(v)     (Py_TYPE(v) == &BPy_BMVert_Type)
+#define BPy_BMEdge_Check(v)     (Py_TYPE(v) == &BPy_BMEdge_Type)
+#define BPy_BMFace_Check(v)     (Py_TYPE(v) == &BPy_BMFace_Type)
+#define BPy_BMLoop_Check(v)     (Py_TYPE(v) == &BPy_BMLoop_Type)
+#define BPy_BMElemSeq_Check(v)  (Py_TYPE(v) == &BPy_BMElemSeq_Type)
+#define BPy_BMVertSeq_Check(v)  (Py_TYPE(v) == &BPy_BMVertSeq_Type)
+#define BPy_BMEdgeSeq_Check(v)  (Py_TYPE(v) == &BPy_BMEdgeSeq_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)
+
+/* cast from _any_ bmesh type - they all have BMesh first */
+typedef struct BPy_BMGeneric {
+	PyObject_VAR_HEAD
+	struct BMesh *bm; /* keep first */
+} BPy_BMGeneric;
+
+/* BPy_BMVert/BPy_BMEdge/BPy_BMFace/BPy_BMLoop can cast to this */
+typedef struct BPy_BMElem {
+	PyObject_VAR_HEAD
+	struct BMesh *bm; /* keep first */
+	struct BMElem *ele;
+} BPy_BMElem;
+
+typedef struct BPy_BMesh {
+	PyObject_VAR_HEAD
+	struct BMesh *bm; /* keep first */
+	int flag;
+} BPy_BMesh;
+
+/* element types */
+typedef struct BPy_BMVert {
+	PyObject_VAR_HEAD
+	struct BMesh *bm; /* keep first */
+	struct BMVert *v;
+} BPy_BMVert;
+
+typedef struct BPy_BMEdge {
+	PyObject_VAR_HEAD
+	struct BMesh *bm; /* keep first */
+	struct BMEdge *e;
+} BPy_BMEdge;
+
+typedef struct BPy_BMFace {
+	PyObject_VAR_HEAD
+	struct BMesh *bm; /* keep first */
+	struct BMFace *f;
+} BPy_BMFace;
+
+typedef struct BPy_BMLoop {
+	PyObject_VAR_HEAD
+	struct BMesh *bm; /* keep first */
+	struct BMLoop *l;
+} BPy_BMLoop;
+
+
+/* iterators */
+
+/* used for ...
+ * - BPy_BMElemSeq_Type
+ * - BPy_BMVertSeq_Type
+ * - BPy_BMEdgeSeq_Type
+ * - BPy_BMFaceSeq_Type
+ * - BPy_BMLoopSeq_Type
+ */
+typedef struct BPy_BMElemSeq {
+	PyObject_VAR_HEAD
+	struct BMesh *bm; /* keep first */
+
+	/* if this is a sequence on an existing element,
+	 * loops of faces for eg.
+	 * If this veriable is set, it will be used */
+
+	/* we hold a reference to this.
+	 * check in case the owner becomes invalid on access */
+	/* TODO - make this a GC'd object!, will function OK without this though */
+	BPy_BMElem *py_ele;
+
+	/* iterator type */
+	short itype;
+} BPy_BMElemSeq;
+
+typedef struct BPy_BMIter {
+	PyObject_VAR_HEAD
+	struct BMesh *bm; /* keep first */
+	BMIter iter;
+} BPy_BMIter;
+
+void BPy_BM_init_types(void);
+
+PyObject *BPyInit_bmesh_types(void);
+
+enum {
+    BPY_BMFLAG_NOP = 0,       /* do nothing */
+    BPY_BMFLAG_IS_WRAPPED = 1 /* the mesh is owned by editmode */
+};
+
+PyObject *BPy_BMesh_CreatePyObject(BMesh *bm, int flag);
+PyObject *BPy_BMVert_CreatePyObject(BMesh *bm, BMVert *v);
+PyObject *BPy_BMEdge_CreatePyObject(BMesh *bm, BMEdge *e);
+PyObject *BPy_BMFace_CreatePyObject(BMesh *bm, BMFace *f);
+PyObject *BPy_BMLoop_CreatePyObject(BMesh *bm, BMLoop *l);
+PyObject *BPy_BMElemSeq_CreatePyObject(BMesh *bm, BPy_BMElem *py_ele, const char itype);
+PyObject *BPy_BMVertSeq_CreatePyObject(BMesh *bm);
+PyObject *BPy_BMEdgeSeq_CreatePyObject(BMesh *bm);
+PyObject *BPy_BMFaceSeq_CreatePyObject(BMesh *bm);
+PyObject *BPy_BMLoopSeq_CreatePyObject(BMesh *bm);
+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,
+                                const char *error_prefix);
+
+PyObject *BPy_BMElem_Array_As_Tuple(BMesh *bm, BMHeader **elem, Py_ssize_t elem_len);
+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
+
+#define BPY_BM_IS_VALID(obj) (LIKELY((obj)->bm != NULL))
+
+#define BM_ITER_BPY_BM_SEQ(ele, iter, bpy_bmelemseq)                          \
+	for (ele = BM_iter_new(iter,                                              \
+	                       (bpy_bmelemseq)->bm,                               \
+	                       (bpy_bmelemseq)->itype,                            \
+	                       (bpy_bmelemseq)->py_ele ?                          \
+	                           ((BPy_BMElem *)(bpy_bmelemseq)->py_ele)->ele : \
+	                           NULL                                           \
+	                       );                                                 \
+	     ele;                                                                 \
+	     ele = BM_iter_step(iter))
+
+#endif /* __BMESH_TYPES_H__ */
diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c
new file mode 100644
index 0000000..6a02d8e
--- /dev/null
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c
@@ -0,0 +1,1038 @@
+/*
+ * ***** 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_types_customdata.c
+ *  \ingroup pybmesh
+ *
+ * This file defines the types for 'BMesh.verts/edges/faces/loops.layers'
+ * customdata layer access.
+ */
+
+#include <Python.h>
+
+#include "BLI_string.h"
+#include "BLI_math_vector.h"
+
+#include "bmesh.h"
+
+#include "bmesh_py_types.h"
+#include "bmesh_py_types_customdata.h"
+#include "bmesh_py_types_meshdata.h"
+
+#include "../mathutils/mathutils.h"
+
+#include "BKE_customdata.h"
+
+#include "DNA_meshdata_types.h"
+
+static CustomData *bpy_bm_customdata_get(BMesh *bm, char htype)
+{
+	switch (htype) {
+		case BM_VERT:  return &bm->vdata;
+		case BM_EDGE:  return &bm->edata;
+		case BM_FACE:  return &bm->pdata;
+		case BM_LOOP:  return &bm->ldata;
+	}
+
+	BLI_assert(0);
+	return NULL;
+}
+
+static CustomDataLayer *bpy_bmlayeritem_get(BPy_BMLayerItem *self)
+{
+	CustomData *data = bpy_bm_customdata_get(self->bm, self->htype);
+	const int index_absolute = CustomData_get_layer_index_n(data, self->type, self->index);
+	if (index_absolute != -1) {
+		return &data->layers[index_absolute];
+	}
+	else {
+		PyErr_SetString(PyExc_RuntimeError,
+		                "layer has become invalid");
+		return NULL;
+	}
+}
+
+/* py-type definitions
+ * ******************* */
+
+/* getseters
+ * ========= */
+
+/* used for many different types  */
+
+PyDoc_STRVAR(bpy_bmlayeraccess_collection__float_doc,
+"Generic float custom-data layer.\n\ntype: :class:`BMLayerCollection`"
+);
+PyDoc_STRVAR(bpy_bmlayeraccess_collection__int_doc,
+"Generic int custom-data layer.\n\ntype: :class:`BMLayerCollection`"
+);
+PyDoc_STRVAR(bpy_bmlayeraccess_collection__string_doc,
+"Generic string custom-data layer (exposed as bytes, 255 max length).\n\ntype: :class:`BMLayerCollection`"
+);
+PyDoc_STRVAR(bpy_bmlayeraccess_collection__deform_doc,
+"Vertex deform weight :class:`BMDeformVert` (TODO).\n\ntype: :class:`BMLayerCollection`" // TYPE DOESN'T EXIST YET
+);
+PyDoc_STRVAR(bpy_bmlayeraccess_collection__shape_doc,
+"Vertex shapekey absolute location (as a 3D Vector).\n\n:type: :class:`BMLayerCollection`"
+);
+PyDoc_STRVAR(bpy_bmlayeraccess_collection__bevel_weight_doc,
+"Bevel weight float in [0 - 1].\n\n:type: :class:`BMLayerCollection`"
+);
+PyDoc_STRVAR(bpy_bmlayeraccess_collection__crease_doc,
+"Edge crease for subsurf - float in [0 - 1].\n\n:type: :class:`BMLayerCollection`"
+);
+PyDoc_STRVAR(bpy_bmlayeraccess_collection__tex_doc,
+"Accessor for :class:`BMTexPoly` layer (TODO).\n\ntype: :class:`BMLayerCollection`" // TYPE DOESN'T EXIST YET
+);
+PyDoc_STRVAR(bpy_bmlayeraccess_collection__uv_doc,
+"Accessor for :class:`BMLoopUV` UV (as a 2D Vector).\n\ntype: :class:`BMLayerCollection`"
+);
+PyDoc_STRVAR(bpy_bmlayeraccess_collection__color_doc,
+"Accessor for vertex color layer.\n\ntype: :class:`BMLayerCollection`"
+);
+
+static PyObject *bpy_bmlayeraccess_collection_get(BPy_BMLayerAccess *self, void *flag)
+{
+	const int type = (int)GET_INT_FROM_POINTER(flag);
+
+	BPY_BM_CHECK_OBJ(self);
+
+	return BPy_BMLayerCollection_CreatePyObject(self->bm, self->htype, type);
+}
+
+
+PyDoc_STRVAR(bpy_bmlayercollection_active_doc,
+"This meshes vert sequence (read-only).\n\n:type: :class:`BMVertSeq`"
+);
+static PyObject *bpy_bmlayercollection_active_get(BPy_BMLayerItem *self, void *UNUSED(flag))
+{
+	CustomData *data;
+	int index;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	data = bpy_bm_customdata_get(self->bm, self->htype);
+	index = CustomData_get_active_layer_index(data, self->type); /* absolute */
+
+	if (index != -1) {
+		index -= CustomData_get_layer_index(data, self->type); /* make relative */
+		return BPy_BMLayerItem_CreatePyObject(self->bm, self->htype, self->type, index);
+	}
+	else {
+		Py_RETURN_NONE;
+	}
+}
+
+PyDoc_STRVAR(bpy_bmlayercollection_name_doc,
+"The layers unique name (read-only).\n\n:type: string"
+);
+static PyObject *bpy_bmlayeritem_name_get(BPy_BMLayerItem *self, void *UNUSED(flag))
+{
+	CustomDataLayer *layer;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	layer = bpy_bmlayeritem_get(self);
+	if (layer) {
+		return PyUnicode_FromString(layer->name);
+	}
+	else {
+		return NULL;
+	}
+}
+
+static PyGetSetDef bpy_bmlayeraccess_vert_getseters[] = {
+    {(char *)"deform", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__deform_doc, (void *)CD_MDEFORMVERT},
+
+    {(char *)"float",  (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__float_doc, (void *)CD_PROP_FLT},
+    {(char *)"int",    (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__int_doc, (void *)CD_PROP_INT},
+    {(char *)"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__string_doc, (void *)CD_PROP_STR},
+
+    {(char *)"shape",        (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__shape_doc, (void *)CD_SHAPEKEY},
+    {(char *)"bevel_weight", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__bevel_weight_doc, (void *)CD_BWEIGHT},
+
+    {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
+static PyGetSetDef bpy_bmlayeraccess_edge_getseters[] = {
+    {(char *)"float",  (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__float_doc, (void *)CD_PROP_FLT},
+    {(char *)"int",    (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__int_doc, (void *)CD_PROP_INT},
+    {(char *)"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__string_doc, (void *)CD_PROP_STR},
+
+    {(char *)"bevel_weight", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__bevel_weight_doc, (void *)CD_BWEIGHT},
+    {(char *)"crease",       (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__crease_doc, (void *)CD_CREASE},
+
+    {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
+static PyGetSetDef bpy_bmlayeraccess_face_getseters[] = {
+    {(char *)"float",  (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__float_doc, (void *)CD_PROP_FLT},
+    {(char *)"int",    (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__int_doc, (void *)CD_PROP_INT},
+    {(char *)"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__string_doc, (void *)CD_PROP_STR},
+
+    {(char *)"tex",   (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__tex_doc, (void *)CD_MTEXPOLY},
+
+    {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
+static PyGetSetDef bpy_bmlayeraccess_loop_getseters[] = {
+    {(char *)"float",  (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__float_doc, (void *)CD_PROP_FLT},
+    {(char *)"int",    (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__int_doc, (void *)CD_PROP_INT},
+    {(char *)"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__string_doc, (void *)CD_PROP_STR},
+
+    {(char *)"uv",    (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__uv_doc, (void *)CD_MLOOPUV},
+    {(char *)"color", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__color_doc, (void *)CD_MLOOPCOL},
+
+    {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
+
+static PyGetSetDef bpy_bmlayercollection_getseters[] = {
+    /* BMESH_TODO, make writeable */
+    {(char *)"active", (getter)bpy_bmlayercollection_active_get, (setter)NULL, (char *)bpy_bmlayercollection_active_doc, NULL},
+
+    {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
+static PyGetSetDef bpy_bmlayeritem_getseters[] = {
+    /* BMESH_TODO, make writeable */
+    {(char *)"name", (getter)bpy_bmlayeritem_name_get, (setter)NULL, (char *)bpy_bmlayercollection_name_doc, NULL},
+
+    {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
+
+/* Methods
+ * ======= */
+
+/* BMLayerCollection
+ * ----------------- */
+
+
+PyDoc_STRVAR(bpy_bmlayercollection_new_doc,
+".. method:: new(name)\n"
+"\n"
+"   Create a new layer\n"
+"\n"
+"   :arg name: Optional name argument (will be made unique).\n"
+"   :type name: string\n"
+"   :return: The newly created layer.\n"
+"   :rtype: :class:`BMLayerItem`\n"
+);
+static PyObject *bpy_bmlayercollection_new(BPy_BMLayerCollection *self, PyObject *args)
+{
+	const char *name = NULL;
+	int index;
+	CustomData *data;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	if (!PyArg_ParseTuple(args, "|s:new", &name)) {
+		return NULL;
+	}
+
+	data = bpy_bm_customdata_get(self->bm, self->htype);
+
+	if (name) {
+		BM_data_layer_add_named(self->bm, data, self->type, name);
+	}
+	else {
+		BM_data_layer_add(self->bm, data, self->type);
+	}
+
+	index = CustomData_number_of_layers(data, self->type) - 1;
+	BLI_assert(index >= 0);
+
+	return BPy_BMLayerItem_CreatePyObject(self->bm, self->htype, self->type, index);
+}
+
+PyDoc_STRVAR(bpy_bmlayercollection_remove_doc,
+".. method:: remove(layer)\n"
+"\n"
+"   Remove a layer\n"
+"\n"
+"   :arg layer: The layer to remove.\n"
+"   :type layer: :class:`BMLayerItem`\n"
+);
+static PyObject *bpy_bmlayercollection_remove(BPy_BMLayerCollection *self, BPy_BMLayerItem *value)
+{
+	CustomData *data;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	if (!BPy_BMLayerItem_Check(value)) {
+		PyErr_Format(PyExc_TypeError,
+		             "layers.remove(x): expected BMLayerItem, not '%.200s'",
+		             Py_TYPE(value)->tp_name);
+		return NULL;
+	}
+
+	BPY_BM_CHECK_OBJ(value);
+
+	if ((self->bm != value->bm) ||
+	    (self->type != value->type) ||
+	    (self->htype != value->htype))
+	{
+		PyErr_SetString(PyExc_ValueError,
+		                "layers.remove(x): x not in layers");
+	}
+
+	data = bpy_bm_customdata_get(self->bm, self->htype);
+	BM_data_layer_free_n(self->bm, data, self->type, value->index);
+
+	Py_RETURN_NONE;
+}
+
+
+PyDoc_STRVAR(bpy_bmlayercollection_keys_doc,
+".. method:: keys()\n"
+"\n"
+"   Return the identifiers of collection members\n"
+"   (matching pythons dict.keys() functionality).\n"
+"\n"
+"   :return: the identifiers for each member of this collection.\n"
+"   :rtype: list of strings\n"
+);
+static PyObject *bpy_bmlayercollection_keys(BPy_BMLayerCollection *self)
+{
+	PyObject *ret;
+	PyObject *item;
+	int index;
+	CustomData *data;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	data = bpy_bm_customdata_get(self->bm, self->htype);
+	index = CustomData_get_layer_index(data, self->type); /* absolute, but no need to make relative */
+
+	ret = PyList_New(0);
+
+	if (index != -1) {
+		int tot = CustomData_number_of_layers(data, self->type);
+		for ( ; tot-- > 0; index++) {
+			item = PyUnicode_FromString(data->layers[index].name);
+			PyList_Append(ret, item);
+			Py_DECREF(item);
+		}
+	}
+
+	return ret;
+}
+
+PyDoc_STRVAR(bpy_bmlayercollection_values_doc,
+".. method:: items()\n"
+"\n"
+"   Return the identifiers of collection members\n"
+"   (matching pythons dict.items() functionality).\n"
+"\n"
+"   :return: (key, value) pairs for each member of this collection.\n"
+"   :rtype: list of tuples\n"
+);
+static PyObject *bpy_bmlayercollection_values(BPy_BMLayerCollection *self)
+{
+	PyObject *ret;
+	PyObject *item;
+	int index;
+	CustomData *data;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	data = bpy_bm_customdata_get(self->bm, self->htype);
+	index = CustomData_get_layer_index(data, self->type);
+
+	ret = PyList_New(0);
+
+	if (index != -1) {
+		int tot = CustomData_number_of_layers(data, self->type);
+		for ( ; tot-- > 0; index++) {
+			item = PyTuple_New(2);
+			PyTuple_SET_ITEM(item, 0, PyUnicode_FromString(data->layers[index].name));
+			PyTuple_SET_ITEM(item, 1, BPy_BMLayerItem_CreatePyObject(self->bm, self->htype, self->type, index));
+			PyList_Append(ret, item);
+			Py_DECREF(item);
+		}
+	}
+
+	return ret;
+}
+
+PyDoc_STRVAR(bpy_bmlayercollection_items_doc,
+".. method:: values()\n"
+"\n"
+"   Return the values of collection\n"
+"   (matching pythons dict.values() functionality).\n"
+"\n"
+"   :return: the members of this collection.\n"
+"   :rtype: list\n"
+);
+static PyObject *bpy_bmlayercollection_items(BPy_BMLayerCollection *self)
+{
+	PyObject *ret;
+	PyObject *item;
+	int index;
+	CustomData *data;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	data = bpy_bm_customdata_get(self->bm, self->htype);
+	index = CustomData_get_layer_index(data, self->type);
+
+	ret = PyList_New(0);
+
+	if (index != -1) {
+		int tot = CustomData_number_of_layers(data, self->type);
+		for ( ; tot-- > 0; index++) {
+			item = BPy_BMLayerItem_CreatePyObject(self->bm, self->htype, self->type, index);
+			PyList_Append(ret, item);
+			Py_DECREF(item);
+		}
+	}
+
+	return ret;
+}
+
+PyDoc_STRVAR(bpy_bmlayercollection_get_doc,
+".. method:: get(key, default=None)\n"
+"\n"
+"   Returns the value of the layer matching the key or default\n"
+"   when not found (matches pythons dictionary function of the same name).\n"
+"\n"
+"   :arg key: The key associated with the layer.\n"
+"   :type key: string\n"
+"   :arg default: Optional argument for the value to return if\n"
+"      *key* is not found.\n"
+"   :type default: Undefined\n"
+);
+static PyObject *bpy_bmlayercollection_get(BPy_BMLayerCollection *self, PyObject *args)
+{
+	const char *key;
+	PyObject *def = Py_None;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	if (!PyArg_ParseTuple(args, "s|O:get", &key, &def)) {
+		return NULL;
+	}
+	else {
+		CustomData *data;
+		int index;
+
+		data = bpy_bm_customdata_get(self->bm, self->htype);
+		index = CustomData_get_named_layer_index(data, self->type, key); /* absolute index */
+
+		if (index != -1) {
+			index -= CustomData_get_layer_index(data, self->type); /* make relative */
+			return BPy_BMLayerItem_CreatePyObject(self->bm, self->htype, self->type, index);
+		}
+	}
+
+	return Py_INCREF(def), def;
+}
+
+static struct PyMethodDef bpy_bmelemseq_methods[] = {
+    {"new",     (PyCFunction)bpy_bmlayercollection_new,      METH_VARARGS, bpy_bmlayercollection_new_doc},
+    {"remove",  (PyCFunction)bpy_bmlayercollection_remove,   METH_O,       bpy_bmlayercollection_remove_doc},
+
+    {"keys",    (PyCFunction)bpy_bmlayercollection_keys,     METH_NOARGS,  bpy_bmlayercollection_keys_doc},
+    {"values",  (PyCFunction)bpy_bmlayercollection_values,   METH_NOARGS,  bpy_bmlayercollection_values_doc},
+    {"items",   (PyCFunction)bpy_bmlayercollection_items,    METH_NOARGS,  bpy_bmlayercollection_items_doc},
+    {"get",     (PyCFunction)bpy_bmlayercollection_get,      METH_VARARGS, bpy_bmlayercollection_get_doc},
+    {NULL, NULL, 0, NULL}
+};
+
+
+
+/* Sequences
+ * ========= */
+
+static Py_ssize_t bpy_bmlayercollection_length(BPy_BMLayerCollection *self)
+{
+	CustomData *data;
+
+	BPY_BM_CHECK_INT(self);
+
+	data = bpy_bm_customdata_get(self->bm, self->htype);
+
+	return CustomData_number_of_layers(data, self->type);
+}
+
+static PyObject *bpy_bmlayercollection_subscript_str(BPy_BMLayerCollection *self, const char *keyname)
+{
+	CustomData *data;
+	int index;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	data = bpy_bm_customdata_get(self->bm, self->htype);
+	index = CustomData_get_named_layer_index(data, self->type, keyname); /* absolute */
+
+	if (index != -1) {
+		index -= CustomData_get_layer_index(data, self->type); /* make relative */
+		return BPy_BMLayerItem_CreatePyObject(self->bm, self->htype, self->type, index);
+	}
+	else {
+		PyErr_Format(PyExc_KeyError,
+		             "BMLayerCollection[key]: key \"%.200s\" not found", keyname);
+		return NULL;
+	}
+}
+
+static PyObject *bpy_bmlayercollection_subscript_int(BPy_BMLayerCollection *self, int keynum)
+{
+	Py_ssize_t len;
+	BPY_BM_CHECK_OBJ(self);
+
+	len = bpy_bmlayercollection_length(self);
+
+	if (keynum < 0) keynum += len;
+	if (keynum >= 0) {
+		if (keynum < len) {
+			return BPy_BMLayerItem_CreatePyObject(self->bm, self->htype, self->type, keynum);
+		}
+	}
+
+	PyErr_Format(PyExc_IndexError,
+	             "BMLayerCollection[index]: index %d out of range", keynum);
+	return NULL;
+}
+
+static PyObject *bpy_bmlayercollection_subscript_slice(BPy_BMLayerCollection *self, Py_ssize_t start, Py_ssize_t stop)
+{
+	Py_ssize_t len = bpy_bmlayercollection_length(self);
+	int count = 0;
+
+	PyObject *tuple;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	if (start >= len) start = len - 1;
+	if (stop  >= len) stop  = len - 1;
+
+	tuple = PyTuple_New(stop - start);
+
+	for (count = start; count < stop; count++) {
+		PyTuple_SET_ITEM(tuple, count - start, BPy_BMLayerItem_CreatePyObject(self->bm, self->htype, self->type, count));
+	}
+
+	return tuple;
+}
+
+static PyObject *bpy_bmlayercollection_subscript(BPy_BMLayerCollection *self, PyObject *key)
+{
+	/* don't need error check here */
+	if (PyUnicode_Check(key)) {
+		return bpy_bmlayercollection_subscript_str(self, _PyUnicode_AsString(key));
+	}
+	else if (PyIndex_Check(key)) {
+		Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
+		if (i == -1 && PyErr_Occurred())
+			return NULL;
+		return bpy_bmlayercollection_subscript_int(self, i);
+	}
+	else if (PySlice_Check(key)) {
+		PySliceObject *key_slice = (PySliceObject *)key;
+		Py_ssize_t step = 1;
+
+		if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) {
+			return NULL;
+		}
+		else if (step != 1) {
+			PyErr_SetString(PyExc_TypeError,
+			                "BMLayerCollection[slice]: slice steps not supported");
+			return NULL;
+		}
+		else if (key_slice->start == Py_None && key_slice->stop == Py_None) {
+			return bpy_bmlayercollection_subscript_slice(self, 0, PY_SSIZE_T_MAX);
+		}
+		else {
+			Py_ssize_t start = 0, stop = PY_SSIZE_T_MAX;
+
+			/* avoid PySlice_GetIndicesEx because it needs to know the length ahead of time. */
+			if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) return NULL;
+			if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop))    return NULL;
+
+			if (start < 0 || stop < 0) {
+				/* only get the length for negative values */
+				Py_ssize_t len = bpy_bmlayercollection_length(self);
+				if (start < 0) start += len;
+				if (stop < 0) start += len;
+			}
+
+			if (stop - start <= 0) {
+				return PyTuple_New(0);
+			}
+			else {
+				return bpy_bmlayercollection_subscript_slice(self, start, stop);
+			}
+		}
+	}
+	else {
+		PyErr_SetString(PyExc_AttributeError,
+		                "BMLayerCollection[key]: invalid key, key must be an int");
+		return NULL;
+	}
+}
+
+static int bpy_bmlayercollection_contains(BPy_BMLayerCollection *self, PyObject *value)
+{
+	const char *keyname = _PyUnicode_AsString(value);
+	CustomData *data;
+	int index;
+
+	BPY_BM_CHECK_INT(self);
+
+	if (keyname == NULL) {
+		PyErr_SetString(PyExc_TypeError,
+		                "BMLayerCollection.__contains__: expected a string");
+		return -1;
+	}
+
+	data = bpy_bm_customdata_get(self->bm, self->htype);
+	index = CustomData_get_named_layer_index(data, self->type, keyname);
+
+	return (index != -1) ? 1 : 0;
+}
+
+static PySequenceMethods bpy_bmlayercollection_as_sequence = {
+    (lenfunc)bpy_bmlayercollection_length,       /* sq_length */
+    NULL,                                        /* sq_concat */
+    NULL,                                        /* sq_repeat */
+    (ssizeargfunc)bpy_bmlayercollection_subscript_int, /* sq_item */ /* Only set this so PySequence_Check() returns True */
+    NULL,                                        /* sq_slice */
+    (ssizeobjargproc)NULL,                       /* sq_ass_item */
+    NULL,                                        /* *was* sq_ass_slice */
+    (objobjproc)bpy_bmlayercollection_contains,  /* sq_contains */
+    (binaryfunc) NULL,                           /* sq_inplace_concat */
+    (ssizeargfunc) NULL,                         /* sq_inplace_repeat */
+};
+
+static PyMappingMethods bpy_bmlayercollection_as_mapping = {
+    (lenfunc)bpy_bmlayercollection_length,       /* mp_length */
+    (binaryfunc)bpy_bmlayercollection_subscript, /* mp_subscript */
+    (objobjargproc)NULL,                         /* mp_ass_subscript */
+};
+
+/* Iterator
+ * -------- */
+
+static PyObject *bpy_bmlayercollection_iter(BPy_BMLayerCollection *self)
+{
+	/* fake it with a list iterator */
+	PyObject *ret;
+	PyObject *iter = NULL;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	ret = bpy_bmlayercollection_subscript_slice(self, 0, PY_SSIZE_T_MIN);
+
+	if (ret) {
+		iter = PyObject_GetIter(ret);
+		Py_DECREF(ret);
+	}
+
+	return iter;
+}
+
+PyDoc_STRVAR(bpy_bmlayeraccess_type_doc,
+"Exposes custom-data layer attributes."
+);
+
+PyDoc_STRVAR(bpy_bmlayercollection_type_doc,
+"Gives access to a collection of custom-data layers of the same type and behaves like python dictionaries, "
+"except for the ability to do list like index access."
+);
+
+PyDoc_STRVAR(bpy_bmlayeritem_type_doc,
+"Exposes a single custom data layer, "
+"their main purpose is for use as item accessors to custom-data when used with vert/edge/face/loop data."
+);
+
+
+PyTypeObject BPy_BMLayerAccessVert_Type     = {{{0}}}; /* bm.verts.layers */
+PyTypeObject BPy_BMLayerAccessEdge_Type     = {{{0}}}; /* bm.edges.layers */
+PyTypeObject BPy_BMLayerAccessFace_Type     = {{{0}}}; /* bm.faces.layers */
+PyTypeObject BPy_BMLayerAccessLoop_Type     = {{{0}}}; /* bm.loops.layers */
+PyTypeObject BPy_BMLayerCollection_Type     = {{{0}}}; /* bm.loops.layers.uv */
+PyTypeObject BPy_BMLayerItem_Type           = {{{0}}}; /* bm.loops.layers.uv["UVMap"] */
+
+
+PyObject *BPy_BMLayerAccess_CreatePyObject(BMesh *bm, const char htype)
+{
+	BPy_BMLayerAccess *self;
+	PyTypeObject *type;
+
+	switch (htype) {
+		case BM_VERT:  type = &BPy_BMLayerAccessVert_Type;  break;
+		case BM_EDGE:  type = &BPy_BMLayerAccessEdge_Type;  break;
+		case BM_FACE:  type = &BPy_BMLayerAccessFace_Type;  break;
+		case BM_LOOP:  type = &BPy_BMLayerAccessLoop_Type;  break;
+		default:
+		{
+			BLI_assert(0);
+			type = NULL;
+			break;
+		}
+	}
+
+	self = PyObject_New(BPy_BMLayerAccess, type);
+	self->bm = bm;
+	self->htype = htype;
+	return (PyObject *)self;
+}
+
+PyObject *BPy_BMLayerCollection_CreatePyObject(BMesh *bm, const char htype, int type)
+{
+	BPy_BMLayerCollection *self = PyObject_New(BPy_BMLayerCollection, &BPy_BMLayerCollection_Type);
+	self->bm = bm;
+	self->htype = htype;
+	self->type = type;
+	return (PyObject *)self;
+}
+
+PyObject *BPy_BMLayerItem_CreatePyObject(BMesh *bm, const char htype, int type, int index)
+{
+	BPy_BMLayerItem *self = PyObject_New(BPy_BMLayerItem, &BPy_BMLayerItem_Type);
+	self->bm = bm;
+	self->htype = htype;
+	self->type = type;
+	self->index = index;
+	return (PyObject *)self;
+}
+
+
+void BPy_BM_init_types_customdata(void)
+{
+	BPy_BMLayerAccessVert_Type.tp_basicsize = sizeof(BPy_BMLayerAccess);
+	BPy_BMLayerAccessEdge_Type.tp_basicsize = sizeof(BPy_BMLayerAccess);
+	BPy_BMLayerAccessFace_Type.tp_basicsize = sizeof(BPy_BMLayerAccess);
+	BPy_BMLayerAccessLoop_Type.tp_basicsize = sizeof(BPy_BMLayerAccess);
+	BPy_BMLayerCollection_Type.tp_basicsize = sizeof(BPy_BMLayerCollection);
+	BPy_BMLayerItem_Type.tp_basicsize       = sizeof(BPy_BMLayerItem);
+
+	BPy_BMLayerAccessVert_Type.tp_name = "BMLayerAccessVert";
+	BPy_BMLayerAccessEdge_Type.tp_name = "BMLayerAccessEdge";
+	BPy_BMLayerAccessFace_Type.tp_name = "BMLayerAccessFace";
+	BPy_BMLayerAccessLoop_Type.tp_name = "BMLayerAccessLoop";
+	BPy_BMLayerCollection_Type.tp_name = "BMLayerCollection";
+	BPy_BMLayerItem_Type.tp_name       = "BMLayerItem";
+
+	/* todo */
+	BPy_BMLayerAccessVert_Type.tp_doc = bpy_bmlayeraccess_type_doc;
+	BPy_BMLayerAccessEdge_Type.tp_doc = bpy_bmlayeraccess_type_doc;
+	BPy_BMLayerAccessFace_Type.tp_doc = bpy_bmlayeraccess_type_doc;
+	BPy_BMLayerAccessLoop_Type.tp_doc = bpy_bmlayeraccess_type_doc;
+	BPy_BMLayerCollection_Type.tp_doc = bpy_bmlayercollection_type_doc;
+	BPy_BMLayerItem_Type.tp_doc       = bpy_bmlayeritem_type_doc;
+
+	BPy_BMLayerAccessVert_Type.tp_repr = (reprfunc)NULL;
+	BPy_BMLayerAccessEdge_Type.tp_repr = (reprfunc)NULL;
+	BPy_BMLayerAccessFace_Type.tp_repr = (reprfunc)NULL;
+	BPy_BMLayerAccessLoop_Type.tp_repr = (reprfunc)NULL;
+	BPy_BMLayerCollection_Type.tp_repr = (reprfunc)NULL;
+	BPy_BMLayerItem_Type.tp_repr = (reprfunc)NULL;
+
+	BPy_BMLayerAccessVert_Type.tp_getset = bpy_bmlayeraccess_vert_getseters;
+	BPy_BMLayerAccessEdge_Type.tp_getset = bpy_bmlayeraccess_edge_getseters;
+	BPy_BMLayerAccessFace_Type.tp_getset = bpy_bmlayeraccess_face_getseters;
+	BPy_BMLayerAccessLoop_Type.tp_getset = bpy_bmlayeraccess_loop_getseters;
+	BPy_BMLayerCollection_Type.tp_getset = bpy_bmlayercollection_getseters;
+	BPy_BMLayerItem_Type.tp_getset       = bpy_bmlayeritem_getseters;
+
+
+//	BPy_BMLayerAccess_Type.tp_methods     = bpy_bmeditselseq_methods;
+	BPy_BMLayerCollection_Type.tp_methods = bpy_bmelemseq_methods;
+
+	BPy_BMLayerCollection_Type.tp_as_sequence = &bpy_bmlayercollection_as_sequence;
+
+	BPy_BMLayerCollection_Type.tp_as_mapping = &bpy_bmlayercollection_as_mapping;
+
+	BPy_BMLayerCollection_Type.tp_iter = (getiterfunc)bpy_bmlayercollection_iter;
+
+	BPy_BMLayerAccessVert_Type.tp_dealloc = NULL;
+	BPy_BMLayerAccessEdge_Type.tp_dealloc = NULL;
+	BPy_BMLayerAccessFace_Type.tp_dealloc = NULL;
+	BPy_BMLayerAccessLoop_Type.tp_dealloc = NULL;
+	BPy_BMLayerCollection_Type.tp_dealloc = NULL;
+	BPy_BMLayerItem_Type.tp_dealloc       = NULL;
+
+
+
+	BPy_BMLayerAccessVert_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+	BPy_BMLayerAccessEdge_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+	BPy_BMLayerAccessFace_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+	BPy_BMLayerAccessLoop_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+	BPy_BMLayerCollection_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+	BPy_BMLayerItem_Type.tp_flags       = Py_TPFLAGS_DEFAULT;
+
+	PyType_Ready(&BPy_BMLayerAccessVert_Type);
+	PyType_Ready(&BPy_BMLayerAccessEdge_Type);
+	PyType_Ready(&BPy_BMLayerAccessFace_Type);
+	PyType_Ready(&BPy_BMLayerAccessLoop_Type);
+	PyType_Ready(&BPy_BMLayerCollection_Type);
+	PyType_Ready(&BPy_BMLayerItem_Type);
+}
+
+
+/* Per Element Get/Set
+ * ******************* */
+
+/**
+ * helper function for get/set, NULL return means the error is set
+ */
+static void *bpy_bmlayeritem_ptr_get(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer)
+{
+	void *value;
+	BMElem *ele = py_ele->ele;
+	CustomData *data;
+
+	/* error checking */
+	if (UNLIKELY(!BPy_BMLayerItem_Check(py_layer))) {
+		PyErr_SetString(PyExc_AttributeError,
+		                "BMElem[key]: invalid key, must be a BMLayerItem");
+		return NULL;
+	}
+	else if (UNLIKELY(py_ele->bm != py_layer->bm)) {
+		PyErr_SetString(PyExc_ValueError,
+		                "BMElem[layer]: layer is from another mesh");
+		return NULL;
+	}
+	else if (UNLIKELY(ele->head.htype != py_layer->htype)) {
+		char namestr_1[32], namestr_2[32];
+		PyErr_Format(PyExc_ValueError,
+		             "Layer/Element type mismatch, expected %.200s got layer type %.200s",
+		             BPy_BMElem_StringFromHType_ex(ele->head.htype, namestr_1),
+		             BPy_BMElem_StringFromHType_ex(py_layer->htype, namestr_2));
+		return NULL;
+	}
+
+	data = bpy_bm_customdata_get(py_layer->bm, py_layer->htype);
+
+	value = CustomData_bmesh_get_n(data, ele->head.data, py_layer->type, py_layer->index);
+
+	if (UNLIKELY(value == NULL)) {
+		/* this should be fairly unlikely but possible if layers move about after we get them */
+		PyErr_SetString(PyExc_KeyError,
+		                "BMElem[key]: layer not found");
+		return NULL;
+	}
+	else {
+		return value;
+	}
+}
+
+
+/**
+ *\brief BMElem.__getitem__()
+ *
+ * assume all error checks are done, eg:
+ *
+ *     uv = vert[uv_layer]
+ */
+PyObject *BPy_BMLayerItem_GetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer)
+{
+	void *value = bpy_bmlayeritem_ptr_get(py_ele, py_layer);
+	PyObject *ret;
+
+	if (UNLIKELY(value == NULL)) {
+		return NULL;
+	}
+
+	switch (py_layer->type) {
+		case CD_MDEFORMVERT:
+		{
+			ret = BPy_BMDeformVert_CreatePyObject(value);
+			break;
+		}
+		case CD_PROP_FLT:
+		{
+			ret = PyFloat_FromDouble(*(float *)value);
+			break;
+		}
+		case CD_PROP_INT:
+		{
+			ret = PyLong_FromSsize_t((Py_ssize_t)(*(int *)value));
+			break;
+		}
+		case CD_PROP_STR:
+		{
+			MStringProperty *mstring = value;
+			ret = PyBytes_FromStringAndSize(mstring->s, BLI_strnlen(mstring->s, sizeof(mstring->s)));
+			break;
+		}
+		case CD_MTEXPOLY:
+		{
+			ret = Py_NotImplemented; /* TODO */
+			Py_INCREF(ret);
+			break;
+		}
+		case CD_MLOOPUV:
+		{
+			ret = BPy_BMLoopUV_CreatePyObject(value);
+			break;
+		}
+		case CD_MLOOPCOL:
+		{
+			ret = BPy_BMLoopColor_CreatePyObject(value);
+			break;
+		}
+		case CD_SHAPEKEY:
+		{
+			ret = Vector_CreatePyObject((float *)value, 3, Py_WRAP, NULL);
+			break;
+		}
+		case CD_BWEIGHT:
+		{
+			ret = PyFloat_FromDouble(*(float *)value);
+			break;
+		}
+		case CD_CREASE:
+		{
+			ret = PyFloat_FromDouble(*(float *)value);
+			break;
+		}
+		default:
+		{
+			ret = Py_NotImplemented; /* TODO */
+			Py_INCREF(ret);
+			break;
+		}
+	}
+
+	return ret;
+}
+
+int BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer, PyObject *py_value)
+{
+	int ret = 0;
+	void *value = bpy_bmlayeritem_ptr_get(py_ele, py_layer);
+
+	if (UNLIKELY(value == NULL)) {
+		return -1;
+	}
+
+	switch (py_layer->type) {
+		case CD_MDEFORMVERT:
+		{
+			ret = BPy_BMDeformVert_AssignPyObject(value, py_value);
+			break;
+		}
+		case CD_PROP_FLT:
+		{
+			float tmp_val = PyFloat_AsDouble(py_value);
+			if (UNLIKELY(tmp_val == -1 && PyErr_Occurred())) {
+				PyErr_Format(PyExc_TypeError, "expected a float, not a %.200s", Py_TYPE(py_value)->tp_name);
+				ret = -1;
+			}
+			else {
+				*(float *)value = tmp_val;
+			}
+			break;
+		}
+		case CD_PROP_INT:
+		{
+			int tmp_val = PyLong_AsSsize_t(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;
+			}
+			else {
+				*(int *)value = tmp_val;
+			}
+			break;
+		}
+		case CD_PROP_STR:
+		{
+			MStringProperty *mstring = value;
+			const char *tmp_val = PyBytes_AsString(py_value);
+			if (UNLIKELY(tmp_val == NULL)) {
+				PyErr_Format(PyExc_TypeError, "expected bytes, not a %.200s", Py_TYPE(py_value)->tp_name);
+				ret = -1;
+			}
+			else {
+				BLI_strncpy(mstring->s, tmp_val, sizeof(mstring->s));
+			}
+			break;
+		}
+		case CD_MTEXPOLY:
+		{
+			PyErr_SetString(PyExc_AttributeError, "readonly"); /* could make this writeable later */
+			ret = -1;
+			break;
+		}
+		case CD_MLOOPUV:
+		{
+			ret = BPy_BMLoopUV_AssignPyObject(value, py_value);
+			break;
+		}
+		case CD_MLOOPCOL:
+		{
+			ret = BPy_BMLoopColor_AssignPyObject(value, py_value);
+			break;
+		}
+		case CD_SHAPEKEY:
+		{
+			float tmp_val[3];
+			if (UNLIKELY(mathutils_array_parse(tmp_val, 3, 3, py_value, "BMVert[shape] = value") == -1)) {
+				ret = -1;
+			}
+			else {
+				copy_v3_v3((float *)value, tmp_val);
+			}
+			break;
+		}
+		case CD_BWEIGHT:
+		{
+			float tmp_val = PyFloat_AsDouble(py_value);
+			if (UNLIKELY(tmp_val == -1 && PyErr_Occurred())) {
+				PyErr_Format(PyExc_TypeError, "expected a float, not a %.200s", Py_TYPE(py_value)->tp_name);
+				ret = -1;
+			}
+			else {
+				*(float *)value = CLAMPIS(tmp_val, 0.0f, 1.0f);
+			}
+			break;
+		}
+		case CD_CREASE:
+		{
+			float tmp_val = PyFloat_AsDouble(py_value);
+			if (UNLIKELY(tmp_val == -1 && PyErr_Occurred())) {
+				PyErr_Format(PyExc_TypeError, "expected a float, not a %.200s", Py_TYPE(py_value)->tp_name);
+				ret = -1;
+			}
+			else {
+				*(float *)value = CLAMPIS(tmp_val, 0.0f, 1.0f);
+			}
+			break;
+		}
+		default:
+		{
+			PyErr_SetString(PyExc_AttributeError, "readonly / unsupported type");
+			ret = -1;
+			break;
+		}
+	}
+
+	return ret;
+}
diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.h b/source/blender/python/bmesh/bmesh_py_types_customdata.h
new file mode 100644
index 0000000..b16b280
--- /dev/null
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.h
@@ -0,0 +1,81 @@
+/*
+ * ***** 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_types_customdata.h
+ *  \ingroup pybmesh
+ */
+
+#ifndef __BMESH_PY_TYPES_CUSTOMDATA_H__
+#define __BMESH_PY_TYPES_CUSTOMDATA_H__
+
+/* all use BPy_BMLayerAccess struct */
+extern PyTypeObject BPy_BMLayerAccessVert_Type;
+extern PyTypeObject BPy_BMLayerAccessEdge_Type;
+extern PyTypeObject BPy_BMLayerAccessFace_Type;
+extern PyTypeObject BPy_BMLayerAccessLoop_Type;
+
+extern PyTypeObject BPy_BMLayerCollection_Type;
+extern PyTypeObject BPy_BMLayerItem_Type;
+
+#define BPy_BMLayerAccess_Check(v)      (Py_TYPE(v) == &BPy_BMLayerAccess_Type)
+#define BPy_BMLayerCollection_Check(v)  (Py_TYPE(v) == &BPy_BMLayerCollection_Type)
+#define BPy_BMLayerItem_Check(v)        (Py_TYPE(v) == &BPy_BMLayerItem_Type)
+
+/* all layers for vert/edge/face/loop */
+typedef struct BPy_BMLayerAccess {
+	PyObject_VAR_HEAD
+	struct BMesh *bm; /* keep first */
+	char htype;
+} BPy_BMLayerAccess;
+
+/* access different layer types deform/uv/vertexcolor */
+typedef struct BPy_BMLayerCollection {
+	PyObject_VAR_HEAD
+	struct BMesh *bm; /* keep first */
+	char htype;
+	int  type; /* customdata type - CD_XXX */
+} BPy_BMLayerCollection;
+
+/* access a specific layer directly */
+typedef struct BPy_BMLayerItem {
+	PyObject_VAR_HEAD
+	struct BMesh *bm; /* keep first */
+	char htype;
+	int  type;  /* customdata type - CD_XXX */
+	int  index; /* index of this layer type */
+} BPy_BMLayerItem;
+
+PyObject *BPy_BMLayerAccess_CreatePyObject(BMesh *bm, const char htype);
+PyObject *BPy_BMLayerCollection_CreatePyObject(BMesh *bm, const char htype, int type);
+PyObject *BPy_BMLayerItem_CreatePyObject(BMesh *bm, const char htype, int type, int index);
+
+void BPy_BM_init_types_customdata(void);
+
+/* __getitem__ / __setitem__ */
+PyObject *BPy_BMLayerItem_GetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer);
+int       BPy_BMLayerItem_SetItem(BPy_BMElem *py_ele, BPy_BMLayerItem *py_layer, PyObject *value);
+
+
+#endif /* __BMESH_PY_TYPES_CUSTOMDATA_H__ */
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
new file mode 100644
index 0000000..9972ff2
--- /dev/null
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -0,0 +1,603 @@
+/*
+ * ***** 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_types_meshdata.c
+ *  \ingroup pybmesh
+ *
+ * This file defines customdata types which can't be accessed as primitive
+ * python types such as MDeformVert, MLoopUV, MTexPoly
+ */
+
+#include <Python.h>
+
+#include "../mathutils/mathutils.h"
+
+#include "DNA_meshdata_types.h"
+
+#include "BLI_utildefines.h"
+#include "BLI_math_vector.h"
+
+#include "BKE_deform.h"
+
+#include "bmesh_py_types_meshdata.h"
+
+/* Mesh Loop UV
+ * ************ */
+
+#define BPy_BMLoopUV_Check(v)  (Py_TYPE(v) == &BPy_BMLoopUV_Type)
+
+typedef struct BPy_BMLoopUV {
+	PyObject_VAR_HEAD
+	MLoopUV *data;
+} BPy_BMLoopUV;
+
+PyDoc_STRVAR(bpy_bmloopuv_uv_doc,
+"Loops UV (as a 2D Vector).\n\n:type: :class:`mathutils.Vector`"
+);
+static PyObject *bpy_bmloopuv_uv_get(BPy_BMLoopUV *self, void *UNUSED(closure))
+{
+	return Vector_CreatePyObject(self->data->uv, 2, Py_WRAP, NULL);
+}
+
+static int bpy_bmloopuv_uv_set(BPy_BMLoopUV *self, PyObject *value, void *UNUSED(closure))
+{
+	float tvec[2];
+	if (mathutils_array_parse(tvec, 2, 2, value, "BMLoopUV.uv") != -1) {
+		copy_v2_v2(self->data->uv, tvec);
+		return 0;
+	}
+	else {
+		return -1;
+	}
+}
+
+PyDoc_STRVAR(bpy_bmloopuv_flag__pin_uv_doc,
+"UV pin state.\n\n:type: boolean"
+);
+PyDoc_STRVAR(bpy_bmloopuv_flag__select_doc,
+"UV select state.\n\n:type: boolean"
+);
+PyDoc_STRVAR(bpy_bmloopuv_flag__select_edge_doc,
+"UV edge select state.\n\n:type: boolean"
+);
+
+
+static PyObject *bpy_bmloopuv_flag_get(BPy_BMLoopUV *self, void *flag_p)
+{
+	const int flag = GET_INT_FROM_POINTER(flag_p);
+	return PyBool_FromLong(self->data->flag & flag);
+}
+
+static int bpy_bmloopuv_flag_set(BPy_BMLoopUV *self, PyObject *value, void *flag_p)
+{
+	const int flag = GET_INT_FROM_POINTER(flag_p);
+
+	switch (PyLong_AsLong(value)) {
+		case TRUE:
+			self->data->flag |= flag;
+			return 0;
+		case FALSE:
+			self->data->flag &= ~flag;
+			return 0;
+		default:
+			PyErr_SetString(PyExc_TypeError,
+			                "expected a boolean type 0/1");
+			return -1;
+	}
+}
+
+static PyGetSetDef bpy_bmloopuv_getseters[] = {
+    /* attributes match rna_def_mloopuv  */
+    {(char *)"uv",          (getter)bpy_bmloopuv_uv_get,   (setter)bpy_bmloopuv_uv_set,   (char *)bpy_bmloopuv_uv_doc, NULL},
+    {(char *)"pin_uv",      (getter)bpy_bmloopuv_flag_get, (setter)bpy_bmloopuv_flag_set, (char *)bpy_bmloopuv_flag__pin_uv_doc, (void *)MLOOPUV_PINNED},
+    {(char *)"select",      (getter)bpy_bmloopuv_flag_get, (setter)bpy_bmloopuv_flag_set, (char *)bpy_bmloopuv_flag__select_doc, (void *)MLOOPUV_VERTSEL},
+    {(char *)"select_edge", (getter)bpy_bmloopuv_flag_get, (setter)bpy_bmloopuv_flag_set, (char *)bpy_bmloopuv_flag__select_edge_doc, (void *)MLOOPUV_EDGESEL},
+
+    {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
+PyTypeObject BPy_BMLoopUV_Type = {{{0}}}; /* bm.loops.layers.uv.active */
+
+static void bm_init_types_bmloopuv(void)
+{
+	BPy_BMLoopUV_Type.tp_basicsize = sizeof(BPy_BMLoopUV);
+
+	BPy_BMLoopUV_Type.tp_name = "BMLoopUV";
+
+	BPy_BMLoopUV_Type.tp_doc = NULL; // todo
+
+	BPy_BMLoopUV_Type.tp_getset = bpy_bmloopuv_getseters;
+
+	BPy_BMLoopUV_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+
+	PyType_Ready(&BPy_BMLoopUV_Type);
+}
+
+int BPy_BMLoopUV_AssignPyObject(struct MLoopUV *mloopuv, PyObject *value)
+{
+	if (UNLIKELY(!BPy_BMLoopUV_Check(value))) {
+		PyErr_Format(PyExc_TypeError, "expected BMLoopUV, not a %.200s", Py_TYPE(value)->tp_name);
+		return -1;
+	}
+	else {
+		*((MLoopUV *)mloopuv) = *(((BPy_BMLoopUV *)value)->data);
+		return 0;
+	}
+}
+
+PyObject *BPy_BMLoopUV_CreatePyObject(struct MLoopUV *mloopuv)
+{
+	BPy_BMLoopUV *self = PyObject_New(BPy_BMLoopUV, &BPy_BMLoopUV_Type);
+	self->data = mloopuv;
+	return (PyObject *)self;
+}
+
+/* --- End Mesh Loop UV --- */
+
+/* Mesh Loop Color
+ * *************** */
+
+/* This simply provices a color wrapper for
+ * color which uses mathutils callbacks for mathutils.Color
+ */
+
+#define MLOOPCOL_FROM_CAPSULE(color_capsule)  \
+	((MLoopCol *)PyCapsule_GetPointer(color_capsule, NULL))
+
+static void mloopcol_to_float(const MLoopCol *mloopcol, float col_r[3])
+{
+	rgb_uchar_to_float(col_r, (unsigned char *)&mloopcol->r);
+}
+
+static void mloopcol_from_float(MLoopCol *mloopcol, const float col[3])
+{
+	rgb_float_to_uchar((unsigned char *)&mloopcol->r, col);
+}
+
+static unsigned char mathutils_bmloopcol_cb_index = -1;
+
+static int mathutils_bmloopcol_check(BaseMathObject *UNUSED(bmo))
+{
+	/* always ok */
+	return 0;
+}
+
+static int mathutils_bmloopcol_get(BaseMathObject *bmo, int UNUSED(subtype))
+{
+	MLoopCol *mloopcol = MLOOPCOL_FROM_CAPSULE(bmo->cb_user);
+	mloopcol_to_float(mloopcol, bmo->data);
+	return 0;
+}
+
+static int mathutils_bmloopcol_set(BaseMathObject *bmo, int UNUSED(subtype))
+{
+	MLoopCol *mloopcol = MLOOPCOL_FROM_CAPSULE(bmo->cb_user);
+	mloopcol_from_float(mloopcol, bmo->data);
+	return 0;
+}
+
+static int mathutils_bmloopcol_get_index(BaseMathObject *bmo, int subtype, int UNUSED(index))
+{
+	/* lazy, avoid repeteing the case statement */
+	if (mathutils_bmloopcol_get(bmo, subtype) == -1)
+		return -1;
+	return 0;
+}
+
+static int mathutils_bmloopcol_set_index(BaseMathObject *bmo, int subtype, int index)
+{
+	const float f = bmo->data[index];
+
+	/* lazy, avoid repeteing the case statement */
+	if (mathutils_bmloopcol_get(bmo, subtype) == -1)
+		return -1;
+
+	bmo->data[index] = f;
+	return mathutils_bmloopcol_set(bmo, subtype);
+}
+
+Mathutils_Callback mathutils_bmloopcol_cb = {
+	mathutils_bmloopcol_check,
+	mathutils_bmloopcol_get,
+	mathutils_bmloopcol_set,
+	mathutils_bmloopcol_get_index,
+	mathutils_bmloopcol_set_index
+};
+
+static void bm_init_types_bmloopcol(void)
+{
+	/* pass */
+	mathutils_bmloopcol_cb_index = Mathutils_RegisterCallback(&mathutils_bmloopcol_cb);
+}
+
+int BPy_BMLoopColor_AssignPyObject(struct MLoopCol *mloopcol, PyObject *value)
+{
+	float tvec[3];
+	if (mathutils_array_parse(tvec, 3, 3, value, "BMLoopCol") != -1) {
+		mloopcol_from_float(mloopcol, tvec);
+		return 0;
+	}
+	else {
+		return -1;
+	}
+}
+
+PyObject *BPy_BMLoopColor_CreatePyObject(struct MLoopCol *data)
+{
+	PyObject *color_capsule;
+	color_capsule = PyCapsule_New(data, NULL, NULL);
+	return Color_CreatePyObject_cb(color_capsule, mathutils_bmloopcol_cb_index, 0);
+}
+
+#undef MLOOPCOL_FROM_CAPSULE
+
+/* --- End Mesh Loop Color --- */
+
+
+/* Mesh Deform Vert
+ * **************** */
+
+/**
+ * This is python type wraps a deform vert as a python dictionary,
+ * hiding the #MDeformWeight on access, since the mapping is very close, eg:
+ *
+ * C:
+ *     weight = defvert_find_weight(dv, group_nr);
+ *     defvert_remove_group(dv, dw)
+ *
+ * Py:
+ *     weight = dv[group_nr]
+ *     del dv[group_nr]
+ *
+ * \note: there is nothing BMesh spesific here,
+ * its only that BMesh is the only part of blender that uses a hand written api like this.
+ * This type could eventually be used to access lattice weights.
+ *
+ * \note: Many of blender-api's dict-like-wrappers act like ordered dicts,
+ * This is intentional _not_ ordered, the weights can be in any order and it wont matter,
+ * the order should not be used in the api in any meaningful way (as with a python dict)
+ * only expose as mapping, not a sequence.
+ */
+
+#define BPy_BMDeformVert_Check(v)  (Py_TYPE(v) == &BPy_BMDeformVert_Type)
+
+typedef struct BPy_BMDeformVert {
+	PyObject_VAR_HEAD
+	MDeformVert *data;
+} BPy_BMDeformVert;
+
+
+/* Mapping Protocols
+ * ================= */
+
+static int bpy_bmdeformvert_len(BPy_BMDeformVert *self)
+{
+	return self->data->totweight;
+}
+
+static PyObject *bpy_bmdeformvert_subscript(BPy_BMDeformVert *self, PyObject *key)
+{
+	if (PyIndex_Check(key)) {
+		int i;
+		i = PyNumber_AsSsize_t(key, PyExc_IndexError);
+		if (i == -1 && PyErr_Occurred()) {
+			return NULL;
+		}
+		else {
+			MDeformWeight *dw = defvert_find_index(self->data, i);
+
+			if (dw == NULL) {
+				PyErr_SetString(PyExc_KeyError, "BMDeformVert[key] = x: "
+				                "key not found");
+				return NULL;
+			}
+			else {
+				return PyFloat_FromDouble(dw->weight);
+			}
+		}
+	}
+	else {
+		PyErr_Format(PyExc_TypeError,
+		             "BMDeformVert keys must be integers, not %.200s",
+		             Py_TYPE(key)->tp_name);
+		return NULL;
+	}
+}
+
+static int bpy_bmdeformvert_ass_subscript(BPy_BMDeformVert *self, PyObject *key, PyObject *value)
+{
+	if (PyIndex_Check(key)) {
+		int i;
+
+		i = PyNumber_AsSsize_t(key, PyExc_IndexError);
+		if (i == -1 && PyErr_Occurred()) {
+			return -1;
+		}
+
+		if (value) {
+			/* dvert[group_index] = 0.5 */
+			if (i < 0) {
+				PyErr_SetString(PyExc_KeyError, "BMDeformVert[key] = x: "
+								"weight keys can't be negative");
+				return -1;
+			}
+			else {
+				MDeformWeight *dw = defvert_verify_index(self->data, i);
+				const float f = PyFloat_AsDouble(value);
+				if (f == -1 && PyErr_Occurred()) { // parsed key not a number
+					PyErr_SetString(PyExc_TypeError,
+									"BMDeformVert[key] = x: "
+									"argument not a number");
+					return -1;
+				}
+
+				dw->weight = CLAMPIS(f, 0.0f, 1.0f);
+			}
+		}
+		else {
+			/* del dvert[group_index] */
+			MDeformWeight *dw = defvert_find_index(self->data, i);
+
+			if (dw == NULL) {
+				PyErr_SetString(PyExc_KeyError, "del BMDeformVert[key]: "
+				                "key not found");
+			}
+			defvert_remove_group(self->data, dw);
+		}
+
+		return 0;
+
+	}
+	else {
+		PyErr_Format(PyExc_TypeError,
+		             "BMDeformVert keys must be integers, not %.200s",
+		             Py_TYPE(key)->tp_name);
+		return -1;
+	}
+}
+
+static int bpy_bmdeformvert_contains(BPy_BMDeformVert *self, PyObject *value)
+{
+	const int key = PyLong_AsSsize_t(value);
+
+	if (key == -1 && PyErr_Occurred()) {
+		PyErr_SetString(PyExc_TypeError,
+		                "BMDeformVert.__contains__: expected an int");
+		return -1;
+	}
+
+	return (defvert_find_index(self->data, key) != NULL) ? 1 : 0;
+}
+
+/* only defined for __contains__ */
+static PySequenceMethods bpy_bmdeformvert_as_sequence = {
+    (lenfunc)bpy_bmdeformvert_len,               /* sq_length */
+    NULL,                                        /* sq_concat */
+    NULL,                                        /* sq_repeat */
+
+    /* note: if this is set PySequence_Check() returns True,
+     * but in this case we dont want to be treated as a seq */
+    NULL,                                        /* sq_item */
+
+    NULL,                                        /* sq_slice */
+    NULL,                                        /* sq_ass_item */
+    NULL,                                        /* *was* sq_ass_slice */
+    (objobjproc)bpy_bmdeformvert_contains,  /* sq_contains */
+    (binaryfunc) NULL,                           /* sq_inplace_concat */
+    (ssizeargfunc) NULL,                         /* sq_inplace_repeat */
+};
+
+static PyMappingMethods bpy_bmdeformvert_as_mapping = {
+	(lenfunc)bpy_bmdeformvert_len,
+	(binaryfunc)bpy_bmdeformvert_subscript,
+	(objobjargproc)bpy_bmdeformvert_ass_subscript
+};
+
+/* Methods
+ * ======= */
+
+PyDoc_STRVAR(bpy_bmdeformvert_keys_doc,
+".. method:: keys()\n"
+"\n"
+"   Return the group indices used by this vertex\n"
+"   (matching pythons dict.keys() functionality).\n"
+"\n"
+"   :return: the deform group this vertex uses\n"
+"   :rtype: list of ints\n"
+);
+static PyObject *bpy_bmdeformvert_keys(BPy_BMDeformVert *self)
+{
+	PyObject *ret;
+	int i;
+	MDeformWeight *dw = self->data->dw;
+
+	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));
+	}
+
+	return ret;
+}
+
+PyDoc_STRVAR(bpy_bmdeformvert_values_doc,
+".. method:: items()\n"
+"\n"
+"   Return (group, weight) pairs for this vertex\n"
+"   (matching pythons dict.items() functionality).\n"
+"\n"
+"   :return: (key, value) pairs for each deform weight of this vertex.\n"
+"   :rtype: list of tuples\n"
+);
+static PyObject *bpy_bmdeformvert_values(BPy_BMDeformVert *self)
+{
+	PyObject *ret;
+	int i;
+	MDeformWeight *dw = self->data->dw;
+
+	ret = PyList_New(self->data->totweight);
+	for (i = 0; i < self->data->totweight; i++, dw++) {
+		PyList_SET_ITEM(ret, i, PyFloat_FromDouble(dw->weight));
+	}
+
+	return ret;
+}
+
+PyDoc_STRVAR(bpy_bmdeformvert_items_doc,
+".. method:: values()\n"
+"\n"
+"   Return the weights of the deform vertex\n"
+"   (matching pythons dict.values() functionality).\n"
+"\n"
+"   :return: The weights that influence this vertex\n"
+"   :rtype: list of floats\n"
+);
+static PyObject *bpy_bmdeformvert_items(BPy_BMDeformVert *self)
+{
+	PyObject *ret;
+	PyObject *item;
+	int i;
+	MDeformWeight *dw = self->data->dw;
+
+	ret = PyList_New(self->data->totweight);
+	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, 1, PyFloat_FromDouble(dw->weight));
+
+		PyList_SET_ITEM(ret, i, item);
+	}
+
+	return ret;
+}
+
+PyDoc_STRVAR(bpy_bmdeformvert_get_doc,
+".. method:: get(key, default=None)\n"
+"\n"
+"   Returns the deform weight matching the key or default\n"
+"   when not found (matches pythons dictionary function of the same name).\n"
+"\n"
+"   :arg key: The key associated with deform weight.\n"
+"   :type key: int\n"
+"   :arg default: Optional argument for the value to return if\n"
+"      *key* is not found.\n"
+"   :type default: Undefined\n"
+);
+static PyObject *bpy_bmdeformvert_get(BPy_BMDeformVert *self, PyObject *args)
+{
+	int key;
+	PyObject *def = Py_None;
+
+	if (!PyArg_ParseTuple(args, "i|O:get", &key, &def)) {
+		return NULL;
+	}
+	else {
+		MDeformWeight *dw = defvert_find_index(self->data, key);
+
+		if (dw) {
+			return PyFloat_FromDouble(dw->weight);
+		}
+		else {
+			return Py_INCREF(def), def;
+		}
+	}
+}
+
+
+PyDoc_STRVAR(bpy_bmdeformvert_clear_doc,
+".. method:: clear()\n"
+"\n"
+"   Clears all weights.\n"
+);
+static PyObject *bpy_bmdeformvert_clear(BPy_BMDeformVert *self)
+{
+	defvert_clear(self->data);
+
+	Py_RETURN_NONE;
+}
+
+static struct PyMethodDef bpy_bmdeformvert_methods[] = {
+    {"keys",    (PyCFunction)bpy_bmdeformvert_keys,    METH_NOARGS,  bpy_bmdeformvert_keys_doc},
+    {"values",  (PyCFunction)bpy_bmdeformvert_values,  METH_NOARGS,  bpy_bmdeformvert_values_doc},
+    {"items",   (PyCFunction)bpy_bmdeformvert_items,   METH_NOARGS,  bpy_bmdeformvert_items_doc},
+    {"get",     (PyCFunction)bpy_bmdeformvert_get,     METH_VARARGS, bpy_bmdeformvert_get_doc},
+    /* BMESH_TODO pop, popitem, update */
+    {"clear",   (PyCFunction)bpy_bmdeformvert_clear,   METH_NOARGS,  bpy_bmdeformvert_clear_doc},
+    {NULL, NULL, 0, NULL}
+};
+
+PyTypeObject BPy_BMDeformVert_Type = {{{0}}}; /* bm.loops.layers.uv.active */
+
+static void bm_init_types_bmdvert(void)
+{
+	BPy_BMDeformVert_Type.tp_basicsize = sizeof(BPy_BMDeformVert);
+
+	BPy_BMDeformVert_Type.tp_name = "BMDeformVert";
+
+	BPy_BMDeformVert_Type.tp_doc = NULL; // todo
+
+	BPy_BMDeformVert_Type.tp_as_sequence = &bpy_bmdeformvert_as_sequence;
+	BPy_BMDeformVert_Type.tp_as_mapping = &bpy_bmdeformvert_as_mapping;
+
+	BPy_BMDeformVert_Type.tp_methods = bpy_bmdeformvert_methods;
+
+	BPy_BMDeformVert_Type.tp_flags = Py_TPFLAGS_DEFAULT;
+
+	PyType_Ready(&BPy_BMDeformVert_Type);
+}
+
+int BPy_BMDeformVert_AssignPyObject(struct MDeformVert *dvert, PyObject *value)
+{
+	if (UNLIKELY(!BPy_BMDeformVert_Check(value))) {
+		PyErr_Format(PyExc_TypeError, "expected BMDeformVert, not a %.200s", Py_TYPE(value)->tp_name);
+		return -1;
+	}
+	else {
+		MDeformVert *dvert_src = ((BPy_BMDeformVert *)value)->data;
+		if (LIKELY(dvert != dvert_src)) {
+			defvert_copy(dvert, dvert_src);
+		}
+		return 0;
+	}
+}
+
+PyObject *BPy_BMDeformVert_CreatePyObject(struct MDeformVert *dvert)
+{
+	BPy_BMDeformVert *self = PyObject_New(BPy_BMDeformVert, &BPy_BMDeformVert_Type);
+	self->data = dvert;
+	return (PyObject *)self;
+}
+
+/* --- End Mesh Deform Vert --- */
+
+
+/* call to init all types */
+void BPy_BM_init_types_meshdata(void)
+{
+	bm_init_types_bmloopuv();
+	bm_init_types_bmloopcol();
+	bm_init_types_bmdvert();
+}
+
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.h b/source/blender/python/bmesh/bmesh_py_types_meshdata.h
new file mode 100644
index 0000000..4636f80
--- /dev/null
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.h
@@ -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.
+ *
+ * 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_types_meshdata.h
+ *  \ingroup pybmesh
+ */
+
+#ifndef __BMESH_PY_TYPES_MESHDATA_H__
+#define __BMESH_PY_TYPES_MESHDATA_H__
+
+extern PyTypeObject BPy_BMLoopUV_Type;
+extern PyTypeObject BPy_BMDeformVert_Type;
+
+#define BPy_BMLoopUV_Check(v)  (Py_TYPE(v) == &BPy_BMLoopUV_Type)
+
+typedef struct BPy_BMGenericMeshData {
+	PyObject_VAR_HEAD
+	void *data;
+} BPy_BMGenericMeshData;
+
+struct MLoopUV;
+struct MLoopCol;
+struct MDeformVert;
+
+int       BPy_BMLoopUV_AssignPyObject(struct MLoopUV *data, PyObject *value);
+PyObject *BPy_BMLoopUV_CreatePyObject(struct MLoopUV *data);
+
+int       BPy_BMLoopColor_AssignPyObject(struct MLoopCol *data, PyObject *value);
+PyObject *BPy_BMLoopColor_CreatePyObject(struct MLoopCol *data);
+
+int       BPy_BMDeformVert_AssignPyObject(struct MDeformVert *dvert, PyObject *value);
+PyObject *BPy_BMDeformVert_CreatePyObject(struct MDeformVert *dvert);
+
+
+void BPy_BM_init_types_meshdata(void);
+
+#endif /* __BMESH_PY_TYPES_MESHDATA_H__ */
diff --git a/source/blender/python/bmesh/bmesh_py_types_select.c b/source/blender/python/bmesh/bmesh_py_types_select.c
new file mode 100644
index 0000000..c76c7d9
--- /dev/null
+++ b/source/blender/python/bmesh/bmesh_py_types_select.c
@@ -0,0 +1,454 @@
+/*
+ * ***** 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_types_select.c
+ *  \ingroup pybmesh
+ *
+ * This file defines the types for 'BMesh.select_history'
+ * sequence and iterator.
+ *
+ * select_history is very loosely based on pytons set() type,
+ * since items can only exist once. however they do have an order.
+ */
+
+#include <Python.h>
+
+#include "BLI_utildefines.h"
+#include "BLI_listbase.h"
+
+#include "bmesh.h"
+
+#include "bmesh_py_types.h"
+#include "bmesh_py_types_select.h"
+
+#include "BKE_tessmesh.h"
+
+#include "DNA_mesh_types.h"
+
+#include "../generic/py_capi_utils.h"
+
+#include "bmesh_py_api.h" /* own include */
+
+PyDoc_STRVAR(bpy_bmeditselseq_active_doc,
+"The last selected element or None (read-only).\n\n:type: :class:`BMVert`, :class:`BMEdge` or :class:`BMFace`"
+);
+static PyObject *bpy_bmeditselseq_active_get(BPy_BMEditSelSeq *self, void *UNUSED(closure))
+{
+	BMEditSelection *ese;
+	BPY_BM_CHECK_OBJ(self);
+
+	if ((ese = self->bm->selected.last)) {
+		return BPy_BMElem_CreatePyObject(self->bm, &ese->ele->head);
+	}
+	else {
+		Py_RETURN_NONE;
+	}
+}
+
+static PyGetSetDef bpy_bmeditselseq_getseters[] = {
+    {(char *)"active", (getter)bpy_bmeditselseq_active_get, (setter)NULL, (char *)bpy_bmeditselseq_active_doc, NULL},
+    {NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
+
+PyDoc_STRVAR(bpy_bmeditselseq_validate_doc,
+".. method:: validate()\n"
+"\n"
+"   Ensures all elements in the selection history are selected.\n"
+);
+static PyObject *bpy_bmeditselseq_validate(BPy_BMEditSelSeq *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+	BM_select_history_validate(self->bm);
+	Py_RETURN_NONE;
+}
+
+PyDoc_STRVAR(bpy_bmeditselseq_clear_doc,
+".. method:: clear()\n"
+"\n"
+"   Empties the selection history.\n"
+);
+static PyObject *bpy_bmeditselseq_clear(BPy_BMEditSelSeq *self)
+{
+	BPY_BM_CHECK_OBJ(self);
+	BM_select_history_clear(self->bm);
+	Py_RETURN_NONE;
+}
+
+PyDoc_STRVAR(bpy_bmeditselseq_add_doc,
+".. method:: add(element)\n"
+"\n"
+"   Add an element to the selection history (no action taken if its already added).\n"
+);
+static PyObject *bpy_bmeditselseq_add(BPy_BMEditSelSeq *self, BPy_BMElem *value)
+{
+	BPY_BM_CHECK_OBJ(self);
+
+	if ((BPy_BMVert_Check(value) ||
+	     BPy_BMEdge_Check(value) ||
+	     BPy_BMFace_Check(value)) == FALSE)
+	{
+		PyErr_Format(PyExc_TypeError,
+		             "Expected a BMVert/BMedge/BMFace not a %.200s", Py_TYPE(value)->tp_name);
+		return NULL;
+	}
+
+	BPY_BM_CHECK_OBJ(value);
+
+	if (self->bm != value->bm) {
+		PyErr_SetString(PyExc_ValueError,
+		                "Element is not from this mesh");
+		return NULL;
+	}
+
+	BM_select_history_store(self->bm, value->ele);
+
+	Py_RETURN_NONE;
+}
+
+PyDoc_STRVAR(bpy_bmeditselseq_remove_doc,
+".. method:: remove(element)\n"
+"\n"
+"   Remove an element from the selection history.\n"
+);
+static PyObject *bpy_bmeditselseq_remove(BPy_BMEditSelSeq *self, BPy_BMElem *value)
+{
+	BPY_BM_CHECK_OBJ(self);
+
+	if ((BPy_BMVert_Check(value) ||
+	     BPy_BMEdge_Check(value) ||
+	     BPy_BMFace_Check(value)) == FALSE)
+	{
+		PyErr_Format(PyExc_TypeError,
+		             "Expected a BMVert/BMedge/BMFace not a %.200s", Py_TYPE(value)->tp_name);
+		return NULL;
+	}
+
+	BPY_BM_CHECK_OBJ(value);
+
+	if ((self->bm != value->bm) ||
+	    (BM_select_history_remove(self->bm, value->ele) == FALSE))
+	{
+		PyErr_SetString(PyExc_ValueError,
+		                "Element not found in selection history");
+		return NULL;
+	}
+
+	Py_RETURN_NONE;
+}
+
+static struct PyMethodDef bpy_bmeditselseq_methods[] = {
+    {"validate", (PyCFunction)bpy_bmeditselseq_validate, METH_NOARGS, bpy_bmeditselseq_validate_doc},
+    {"clear",    (PyCFunction)bpy_bmeditselseq_clear,    METH_NOARGS, bpy_bmeditselseq_clear_doc},
+
+    {"add",      (PyCFunction)bpy_bmeditselseq_add,      METH_O,      bpy_bmeditselseq_add_doc},
+    {"remove",   (PyCFunction)bpy_bmeditselseq_remove,   METH_O,      bpy_bmeditselseq_remove_doc},
+    {NULL, NULL, 0, NULL}
+};
+
+
+/* Sequences
+ * ========= */
+
+static Py_ssize_t bpy_bmeditselseq_length(BPy_BMEditSelSeq *self)
+{
+	BPY_BM_CHECK_INT(self);
+
+	return BLI_countlist(&self->bm->selected);
+}
+
+static PyObject *bpy_bmeditselseq_subscript_int(BPy_BMEditSelSeq *self, int keynum)
+{
+	BMEditSelection *ese;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	if (keynum < 0) {
+		ese = BLI_rfindlink(&self->bm->selected, -1 - keynum);
+	}
+	else {
+		ese = BLI_findlink(&self->bm->selected, keynum);
+	}
+
+	if (ese) {
+		return BPy_BMElem_CreatePyObject(self->bm, &ese->ele->head);
+	}
+	else {
+		PyErr_Format(PyExc_IndexError,
+		             "BMElemSeq[index]: index %d out of range", keynum);
+		return NULL;
+	}
+}
+
+static PyObject *bpy_bmeditselseq_subscript_slice(BPy_BMEditSelSeq *self, Py_ssize_t start, Py_ssize_t stop)
+{
+	int count = 0;
+	int ok;
+
+	PyObject *list;
+	PyObject *item;
+	BMEditSelection *ese;
+
+	BPY_BM_CHECK_OBJ(self);
+
+	list = PyList_New(0);
+
+	ese = self->bm->selected.first;
+
+	ok = (ese != NULL);
+
+	if (UNLIKELY(ok == FALSE)) {
+		return list;
+	}
+
+	/* first loop up-until the start */
+	for (ok = TRUE; ok; ok = ((ese = ese->next) != NULL)) {
+		if (count == start) {
+			break;
+		}
+		count++;
+	}
+
+	/* add items until stop */
+	while ((ese = ese->next)) {
+		item = BPy_BMElem_CreatePyObject(self->bm, &ese->ele->head);
+		PyList_Append(list, item);
+		Py_DECREF(item);
+
+		count++;
+		if (count == stop) {
+			break;
+		}
+	}
+
+	return list;
+}
+
+static PyObject *bpy_bmeditselseq_subscript(BPy_BMEditSelSeq *self, PyObject *key)
+{
+	/* don't need error check here */
+	if (PyIndex_Check(key)) {
+		Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
+		if (i == -1 && PyErr_Occurred())
+			return NULL;
+		return bpy_bmeditselseq_subscript_int(self, i);
+	}
+	else if (PySlice_Check(key)) {
+		PySliceObject *key_slice = (PySliceObject *)key;
+		Py_ssize_t step = 1;
+
+		if (key_slice->step != Py_None && !_PyEval_SliceIndex(key, &step)) {
+			return NULL;
+		}
+		else if (step != 1) {
+			PyErr_SetString(PyExc_TypeError,
+			                "BMElemSeq[slice]: slice steps not supported");
+			return NULL;
+		}
+		else if (key_slice->start == Py_None && key_slice->stop == Py_None) {
+			return bpy_bmeditselseq_subscript_slice(self, 0, PY_SSIZE_T_MAX);
+		}
+		else {
+			Py_ssize_t start = 0, stop = PY_SSIZE_T_MAX;
+
+			/* avoid PySlice_GetIndicesEx because it needs to know the length ahead of time. */
+			if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) return NULL;
+			if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop))    return NULL;
+
+			if (start < 0 || stop < 0) {
+				/* only get the length for negative values */
+				Py_ssize_t len = bpy_bmeditselseq_length(self);
+				if (start < 0) start += len;
+				if (stop < 0) start += len;
+			}
+
+			if (stop - start <= 0) {
+				return PyList_New(0);
+			}
+			else {
+				return bpy_bmeditselseq_subscript_slice(self, start, stop);
+			}
+		}
+	}
+	else {
+		PyErr_SetString(PyExc_AttributeError,
+		                "BMElemSeq[key]: invalid key, key must be an int");
+		return NULL;
+	}
+}
+
+static int bpy_bmeditselseq_contains(BPy_BMEditSelSeq *self, PyObject *value)
+{
+	BPy_BMElem *value_bm_ele;
+
+	BPY_BM_CHECK_INT(self);
+
+	value_bm_ele = (BPy_BMElem *)value;
+	if (value_bm_ele->bm == self->bm) {
+		return BM_select_history_check(self->bm, value_bm_ele->ele);
+	}
+
+	return 0;
+}
+
+static PySequenceMethods bpy_bmeditselseq_as_sequence = {
+    (lenfunc)bpy_bmeditselseq_length,            /* sq_length */
+    NULL,                                        /* sq_concat */
+    NULL,                                        /* sq_repeat */
+    (ssizeargfunc)bpy_bmeditselseq_subscript_int,/* sq_item */ /* Only set this so PySequence_Check() returns True */
+    NULL,                                        /* sq_slice */
+    (ssizeobjargproc)NULL,                       /* sq_ass_item */
+    NULL,                                        /* *was* sq_ass_slice */
+    (objobjproc)bpy_bmeditselseq_contains,       /* sq_contains */
+    (binaryfunc) NULL,                           /* sq_inplace_concat */
+    (ssizeargfunc) NULL,                         /* sq_inplace_repeat */
+};
+
+static PyMappingMethods bpy_bmeditselseq_as_mapping = {
+    (lenfunc)bpy_bmeditselseq_length,            /* mp_length */
+    (binaryfunc)bpy_bmeditselseq_subscript,      /* mp_subscript */
+    (objobjargproc)NULL,                         /* mp_ass_subscript */
+};
+
+
+/* Iterator
+ * -------- */
+
+static PyObject *bpy_bmeditselseq_iter(BPy_BMEditSelSeq *self)
+{
+	BPy_BMEditSelIter *py_iter;
+
+	BPY_BM_CHECK_OBJ(self);
+	py_iter = (BPy_BMEditSelIter *)BPy_BMEditSelIter_CreatePyObject(self->bm);
+	py_iter->ese = self->bm->selected.first;
+	return (PyObject *)py_iter;
+}
+
+static PyObject *bpy_bmeditseliter_next(BPy_BMEditSelIter *self)
+{
+	BMEditSelection *ese = self->ese;
+	if (ese == NULL) {
+		PyErr_SetString(PyExc_StopIteration,
+		                "bpy_bmiter_next stop");
+		return NULL;
+	}
+	else {
+		self->ese = ese->next;
+		return (PyObject *)BPy_BMElem_CreatePyObject(self->bm, &ese->ele->head);
+	}
+}
+
+PyTypeObject BPy_BMEditSelSeq_Type  = {{{0}}};
+PyTypeObject BPy_BMEditSelIter_Type = {{{0}}};
+
+
+PyObject *BPy_BMEditSel_CreatePyObject(BMesh *bm)
+{
+	BPy_BMEditSelSeq *self = PyObject_New(BPy_BMEditSelSeq, &BPy_BMEditSelSeq_Type);
+	self->bm = bm;
+	/* caller must initialize 'iter' member */
+	return (PyObject *)self;
+}
+
+PyObject *BPy_BMEditSelIter_CreatePyObject(BMesh *bm)
+{
+	BPy_BMEditSelIter *self = PyObject_New(BPy_BMEditSelIter, &BPy_BMEditSelIter_Type);
+	self->bm = bm;
+	/* caller must initialize 'iter' member */
+	return (PyObject *)self;
+}
+
+void BPy_BM_init_types_select(void)
+{
+	BPy_BMEditSelSeq_Type.tp_basicsize     = sizeof(BPy_BMEditSelSeq);
+	BPy_BMEditSelIter_Type.tp_basicsize    = sizeof(BPy_BMEditSelIter);
+
+	BPy_BMEditSelSeq_Type.tp_name  = "BMEditSelSeq";
+	BPy_BMEditSelIter_Type.tp_name = "BMEditSelIter";
+
+	BPy_BMEditSelSeq_Type.tp_doc   = NULL; // todo
+	BPy_BMEditSelIter_Type.tp_doc  = NULL;
+
+	BPy_BMEditSelSeq_Type.tp_repr  = (reprfunc)NULL;
+	BPy_BMEditSelIter_Type.tp_repr = (reprfunc)NULL;
+
+	BPy_BMEditSelSeq_Type.tp_getset     = bpy_bmeditselseq_getseters;
+	BPy_BMEditSelIter_Type.tp_getset = NULL;
+
+	BPy_BMEditSelSeq_Type.tp_methods     = bpy_bmeditselseq_methods;
+	BPy_BMEditSelIter_Type.tp_methods = NULL;
+
+	BPy_BMEditSelSeq_Type.tp_as_sequence = &bpy_bmeditselseq_as_sequence;
+
+	BPy_BMEditSelSeq_Type.tp_as_mapping = &bpy_bmeditselseq_as_mapping;
+
+	BPy_BMEditSelSeq_Type.tp_iter = (getiterfunc)bpy_bmeditselseq_iter;
+
+	/* only 1 iteratir so far */
+	BPy_BMEditSelIter_Type.tp_iternext = (iternextfunc)bpy_bmeditseliter_next;
+
+	BPy_BMEditSelSeq_Type.tp_dealloc     = NULL; //(destructor)bpy_bmeditselseq_dealloc;
+	BPy_BMEditSelIter_Type.tp_dealloc = NULL; //(destructor)bpy_bmvert_dealloc;
+
+	BPy_BMEditSelSeq_Type.tp_flags     = Py_TPFLAGS_DEFAULT;
+	BPy_BMEditSelIter_Type.tp_flags    = Py_TPFLAGS_DEFAULT;
+
+	PyType_Ready(&BPy_BMEditSelSeq_Type);
+	PyType_Ready(&BPy_BMEditSelIter_Type);
+}
+
+
+/* utility function */
+
+/**
+ * \note doesn't actually check selection.
+ */
+int BPy_BMEditSel_Assign(BPy_BMesh *self, PyObject *value)
+{
+	BMesh *bm;
+	Py_ssize_t value_len;
+	Py_ssize_t i;
+	BMElem **value_array = NULL;
+
+	BPY_BM_CHECK_INT(self);
+
+	bm = self->bm;
+
+	value_array = BPy_BMElem_PySeq_As_Array(&bm, value, 0, PY_SSIZE_T_MAX,
+	                                        &value_len, BM_VERT | BM_EDGE | BM_FACE,
+	                                        TRUE, TRUE, "BMesh.select_history = value");
+
+	if (value_array == NULL) {
+		return -1;
+	}
+
+	BM_select_history_clear(bm);
+
+	for (i = 0; i < value_len; i++) {
+		BM_select_history_store_notest(bm, value_array[i]);
+	}
+
+	PyMem_FREE(value_array);
+	return 0;
+}
diff --git a/source/blender/python/bmesh/bmesh_py_types_select.h b/source/blender/python/bmesh/bmesh_py_types_select.h
new file mode 100644
index 0000000..4741e22
--- /dev/null
+++ b/source/blender/python/bmesh/bmesh_py_types_select.h
@@ -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) 2012 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/python/bmesh/bmesh_py_types_select.h
+ *  \ingroup pybmesh
+ */
+
+#ifndef __BMESH_PY_TYPES_SELECT_H__
+#define __BMESH_PY_TYPES_SELECT_H__
+
+struct BPy_BMesh;
+
+extern PyTypeObject BPy_BMEditSelSeq_Type;
+extern PyTypeObject BPy_BMEditSelIter_Type;
+
+#define BPy_BMSelectHistory_Check(v)      (Py_TYPE(v) == &BPy_BMEditSelSeq_Type)
+#define BPy_BMSelectHistoryIter_Check(v)  (Py_TYPE(v) == &BPy_BMEditSelIter_Type)
+
+typedef struct BPy_BMEditSelSeq {
+	PyObject_VAR_HEAD
+	struct BMesh *bm; /* keep first */
+} BPy_BMEditSelSeq;
+
+typedef struct BPy_BMEditSelIter {
+	PyObject_VAR_HEAD
+	struct BMesh *bm; /* keep first */
+	struct BMEditSelection *ese;
+} BPy_BMEditSelIter;
+
+void BPy_BM_init_types_select(void);
+
+PyObject *BPy_BMEditSel_CreatePyObject(BMesh *bm);
+PyObject *BPy_BMEditSelIter_CreatePyObject(BMesh *bm);
+int       BPy_BMEditSel_Assign(struct BPy_BMesh *self, PyObject *value);
+
+#endif /* __BMESH_PY_SELECT_H__ */
diff --git a/source/blender/python/bmesh/bmesh_py_utils.c b/source/blender/python/bmesh/bmesh_py_utils.c
new file mode 100644
index 0000000..9fecc0c
--- /dev/null
+++ b/source/blender/python/bmesh/bmesh_py_utils.c
@@ -0,0 +1,693 @@
+/*
+ * ***** 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_api.c
+ *  \ingroup pybmesh
+ *
+ * This file defines the 'bmesh.utils' module.
+ * Utility functions for operating on 'bmesh.types'
+ */
+
+#include <Python.h>
+
+#include "BLI_utildefines.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "../mathutils/mathutils.h"
+
+#include "bmesh.h"
+
+#include "bmesh_py_types.h"
+
+#include "bmesh_py_utils.h" /* own include */
+
+
+PyDoc_STRVAR(bpy_bm_utils_vert_collapse_edge_doc,
+".. method:: vert_collapse_edge(vert, edge)\n"
+"\n"
+"   Collapse a vertex into an edge.\n"
+"\n"
+"   :arg vert: The vert that will be collapsed.\n"
+"   :type vert: :class:`bmesh.types.BMVert`\n"
+"   :arg edge: The edge to collapse into.\n"
+"   :type edge: :class:`bmesh.types.BMEdge`\n"
+"   :return: The resulting edge from the collapse operation.\n"
+"   :rtype: :class:`bmesh.types.BMEdge`\n"
+);
+static PyObject *bpy_bm_utils_vert_collapse_edge(PyObject *UNUSED(self), PyObject *args)
+{
+	BPy_BMEdge *py_edge;
+	BPy_BMVert *py_vert;
+
+	BMesh *bm;
+	BMEdge *e_new = NULL;
+
+	if (!PyArg_ParseTuple(args, "O!O!:vert_collapse_edge",
+	                      &BPy_BMVert_Type, &py_vert,
+	                      &BPy_BMEdge_Type, &py_edge))
+	{
+		return NULL;
+	}
+
+	BPY_BM_CHECK_OBJ(py_edge);
+	BPY_BM_CHECK_OBJ(py_vert);
+
+	/* this doubles for checking that the verts are in the same mesh */
+	if (!(py_edge->e->v1 == py_vert->v ||
+	      py_edge->e->v2 == py_vert->v))
+	{
+		PyErr_SetString(PyExc_ValueError,
+		                "vert_collapse_edge(vert, edge): the vertex is not found in the edge");
+		return NULL;
+	}
+
+	if (BM_vert_edge_count(py_vert->v) > 2) {
+		PyErr_SetString(PyExc_ValueError,
+		                "vert_collapse_edge(vert, edge): vert has more then 2 connected edges");
+		return NULL;
+	}
+
+	bm = py_edge->bm;
+
+	e_new = BM_vert_collapse_edge(bm, py_edge->e, py_vert->v, TRUE);
+
+	if (e_new) {
+		return BPy_BMEdge_CreatePyObject(bm, e_new);
+	}
+	else {
+		PyErr_SetString(PyExc_ValueError,
+		                "vert_collapse_edge(vert, edge): no new edge created, internal error");
+		return NULL;
+	}
+}
+
+
+PyDoc_STRVAR(bpy_bm_utils_vert_collapse_faces_doc,
+".. method:: vert_collapse_faces(vert, edge, fac, join_faces)\n"
+"\n"
+"   Split an edge, return the newly created data.\n"
+"\n"
+"   :arg vert: The vert that will be collapsed.\n"
+"   :type vert: :class:`bmesh.types.BMVert`\n"
+"   :arg edge: The edge to collapse into.\n"
+"   :type edge: :class:`bmesh.types.BMEdge`\n"
+"   :arg fac: The factor to use when merging customdata [0 - 1].\n"
+"   :type fac: float\n"
+"   :return: The resulting edge from the collapse operation.\n"
+"   :rtype: :class:`bmesh.types.BMEdge`\n"
+);
+static PyObject *bpy_bm_utils_vert_collapse_faces(PyObject *UNUSED(self), PyObject *args)
+{
+	BPy_BMEdge *py_edge;
+	BPy_BMVert *py_vert;
+
+	float fac;
+	int do_join_faces;
+
+	BMesh *bm;
+	BMEdge *e_new = NULL;
+
+	if (!PyArg_ParseTuple(args, "O!O!fi:vert_collapse_faces",
+	                      &BPy_BMVert_Type, &py_vert,
+	                      &BPy_BMEdge_Type, &py_edge,
+	                      &fac, &do_join_faces))
+	{
+		return NULL;
+	}
+
+	BPY_BM_CHECK_OBJ(py_edge);
+	BPY_BM_CHECK_OBJ(py_vert);
+
+	/* this doubles for checking that the verts are in the same mesh */
+	if (!(py_edge->e->v1 == py_vert->v ||
+	      py_edge->e->v2 == py_vert->v))
+	{
+		PyErr_SetString(PyExc_ValueError,
+		                "vert_collapse_faces(vert, edge): the vertex is not found in the edge");
+		return NULL;
+	}
+
+	if (BM_vert_edge_count(py_vert->v) > 2) {
+		PyErr_SetString(PyExc_ValueError,
+		                "vert_collapse_faces(vert, edge): vert has more then 2 connected edges");
+		return NULL;
+	}
+
+	bm = py_edge->bm;
+
+	e_new = BM_vert_collapse_faces(bm, py_edge->e, py_vert->v, CLAMPIS(fac, 0.0f, 1.0f), do_join_faces, TRUE);
+
+	if (e_new) {
+		return BPy_BMEdge_CreatePyObject(bm, e_new);
+	}
+	else {
+		PyErr_SetString(PyExc_ValueError,
+		                "vert_collapse_edge(vert, edge): no new edge created, internal error");
+		return NULL;
+	}
+}
+
+
+PyDoc_STRVAR(bpy_bm_utils_vert_dissolve_doc,
+".. method:: vert_dissolve(vert)\n"
+"\n"
+"   Dissolve this vertex (will be removed).\n"
+"\n"
+"   :arg vert: The vert to be dissolved.\n"
+"   :type vert: :class:`bmesh.types.BMVert`\n"
+"   :return: True when the vertex dissolve is successful.\n"
+"   :rtype: boolean\n"
+);
+static PyObject *bpy_bm_utils_vert_dissolve(PyObject *UNUSED(self), PyObject *args)
+{
+	BPy_BMVert *py_vert;
+
+	BMesh *bm;
+
+	if (!PyArg_ParseTuple(args, "O!:vert_dissolve",
+	                      &BPy_BMVert_Type, &py_vert))
+	{
+		return NULL;
+	}
+
+	BPY_BM_CHECK_OBJ(py_vert);
+
+	bm = py_vert->bm;
+
+	return PyBool_FromLong((BM_vert_dissolve(bm, py_vert->v)));
+}
+
+PyDoc_STRVAR(bpy_bm_utils_vert_separate_doc,
+".. method:: vert_separate(vert, edges)\n"
+"\n"
+"   Separate this vertex at every edge.\n"
+"\n"
+"   :arg vert: The vert to be separated.\n"
+"   :type vert: :class:`bmesh.types.BMVert`\n"
+"   :arg edges: The edges to separated.\n"
+"   :type edges: :class:`bmesh.types.BMEdge`\n"
+"   :return: The newly separated verts (including the vertex passed).\n"
+"   :rtype: tuple of :class:`bmesh.types.BMVert`\n"
+);
+static PyObject *bpy_bm_utils_vert_separate(PyObject *UNUSED(self), PyObject *args)
+{
+	BPy_BMVert *py_vert;
+	PyObject *edge_seq;
+
+	BMesh *bm;
+	BMVert **elem;
+	int elem_len;
+
+	/* edges to split */
+	BMEdge **edge_array;
+	Py_ssize_t edge_array_len;
+
+	PyObject *ret;
+
+
+	if (!PyArg_ParseTuple(args, "O!O:vert_separate",
+	                      &BPy_BMVert_Type, &py_vert,
+	                      &edge_seq))
+	{
+		return NULL;
+	}
+
+	BPY_BM_CHECK_OBJ(py_vert);
+
+	bm = py_vert->bm;
+
+	edge_array = BPy_BMElem_PySeq_As_Array(&bm, edge_seq, 0, PY_SSIZE_T_MAX,
+	                                       &edge_array_len, BM_EDGE,
+	                                       TRUE, TRUE, "vert_separate(...)");
+
+	if (edge_array == NULL) {
+		return NULL;
+	}
+
+	if (BM_vert_separate(bm, py_vert->v, &elem, &elem_len, edge_array, edge_array_len)) {
+		/* return collected verts */
+		ret = BPy_BMElem_Array_As_Tuple(bm, (BMHeader **)elem, elem_len);
+		MEM_freeN(elem);
+	}
+	else {
+		ret = PyTuple_New(0);
+	}
+
+	PyMem_FREE(edge_array);
+
+	return ret;
+}
+
+
+PyDoc_STRVAR(bpy_bm_utils_edge_split_doc,
+".. method:: edge_split(edge, vert, fac)\n"
+"\n"
+"   Split an edge, return the newly created data.\n"
+"\n"
+"   :arg edge: The edge to split.\n"
+"   :type edge: :class:`bmesh.types.BMEdge`\n"
+"   :arg vert: One of the verts on the edge, defines the split direction.\n"
+"   :type vert: :class:`bmesh.types.BMVert`\n"
+"   :arg fac: The point on the edge where the new vert will be created [0 - 1].\n"
+"   :type fac: float\n"
+"   :return: The newly created (edge, vert) pair.\n"
+"   :rtype: tuple\n"
+);
+static PyObject *bpy_bm_utils_edge_split(PyObject *UNUSED(self), PyObject *args)
+{
+	BPy_BMEdge *py_edge;
+	BPy_BMVert *py_vert;
+	float fac;
+
+	BMesh *bm;
+	BMVert *v_new = NULL;
+	BMEdge *e_new = NULL;
+
+	if (!PyArg_ParseTuple(args, "O!O!f:edge_split",
+	                      &BPy_BMEdge_Type, &py_edge,
+	                      &BPy_BMVert_Type, &py_vert,
+	                      &fac))
+	{
+		return NULL;
+	}
+
+	BPY_BM_CHECK_OBJ(py_edge);
+	BPY_BM_CHECK_OBJ(py_vert);
+
+	/* this doubles for checking that the verts are in the same mesh */
+	if (!(py_edge->e->v1 == py_vert->v ||
+	      py_edge->e->v2 == py_vert->v))
+	{
+		PyErr_SetString(PyExc_ValueError,
+		                "edge_split(edge, vert): the vertex is not found in the edge");
+		return NULL;
+	}
+
+	bm = py_edge->bm;
+
+	v_new = BM_edge_split(bm, py_edge->e, py_vert->v, &e_new, CLAMPIS(fac, 0.0f, 1.0f));
+
+	if (v_new && e_new) {
+		PyObject *ret = PyTuple_New(2);
+		PyTuple_SET_ITEM(ret, 0, BPy_BMEdge_CreatePyObject(bm, e_new));
+		PyTuple_SET_ITEM(ret, 1, BPy_BMVert_CreatePyObject(bm, v_new));
+		return ret;
+	}
+	else {
+		PyErr_SetString(PyExc_ValueError,
+		                "edge_split(edge, vert): couldn't split the edge, internal error");
+		return NULL;
+	}
+}
+
+
+PyDoc_STRVAR(bpy_bm_utils_edge_rotate_doc,
+".. method:: edge_rotate(edge, ccw=False)\n"
+"\n"
+"   Rotate the edge and return the newly created edge.\n"
+"   If rotating the edge fails, None will be returned.\n"
+"\n"
+"   :arg edge: The edge to rotate.\n"
+"   :type edge: :class:`bmesh.types.BMEdge`\n"
+"   :arg ccw: When True the edge will be rotated counter clockwise.\n"
+"   :type ccw: boolean\n"
+"   :return: The newly rotated edge.\n"
+"   :rtype: :class:`bmesh.types.BMEdge`\n"
+);
+static PyObject *bpy_bm_utils_edge_rotate(PyObject *UNUSED(self), PyObject *args)
+{
+	BPy_BMEdge *py_edge;
+	int do_ccw = FALSE;
+
+	BMesh *bm;
+	BMEdge *e_new = NULL;
+
+	if (!PyArg_ParseTuple(args, "O!|i:edge_rotate",
+	                      &BPy_BMEdge_Type, &py_edge,
+	                      &do_ccw))
+	{
+		return NULL;
+	}
+
+	BPY_BM_CHECK_OBJ(py_edge);
+
+	bm = py_edge->bm;
+
+	e_new = BM_edge_rotate(bm, py_edge->e, do_ccw, 0); /* BMESH_TODO - expose to API */
+
+	if (e_new) {
+		return BPy_BMEdge_CreatePyObject(bm, e_new);
+	}
+	else {
+		Py_RETURN_NONE;
+	}
+}
+
+
+PyDoc_STRVAR(bpy_bm_utils_face_split_doc,
+".. method:: face_split(face, vert_a, vert_b, coords=(), use_exist=True, example=None)\n"
+"\n"
+"   Split an edge, return the newly created data.\n"
+"\n"
+"   :arg face: The face to cut.\n"
+"   :type face: :class:`bmesh.types.BMFace`\n"
+"   :arg vert_a: First vertex to cut in the face (face must contain the vert).\n"
+"   :type vert_a: :class:`bmesh.types.BMVert`\n"
+"   :arg vert_b: Second vertex to cut in the face (face must contain the vert).\n"
+"   :type vert_b: :class:`bmesh.types.BMVert`\n"
+"   :arg coords: Optional argument to define points inbetween *vert_a* and *vert_b*.\n"
+"   :type coords: sequence of float triplets\n"
+"   :arg use_exist: .Use an existing edge if it exists (Only used when *coords* argument is empty or omitted)\n"
+"   :type use_exist: boolean\n"
+"   :arg example: Newly created edge will copy settings from this one.\n"
+"   :type example: :class:`bmesh.types.BMEdge`\n"
+"   :return: The newly created face or None on failure.\n"
+"   :rtype: (:class:`bmesh.types.BMFace`, :class:`bmesh.types.BMLoop`) pair\n"
+);
+static PyObject *bpy_bm_utils_face_split(PyObject *UNUSED(self), PyObject *args, PyObject *kw)
+{
+	static const char *kwlist[] = {"face", "vert_a", "vert_b",
+	                               "coords", "use_exist", "example", NULL};
+
+	BPy_BMFace *py_face;
+	BPy_BMVert *py_vert_a;
+	BPy_BMVert *py_vert_b;
+
+	/* optional */
+	PyObject *py_coords = NULL;
+	int edge_exists = TRUE;
+	BPy_BMEdge *py_edge_example = NULL;
+
+	float *coords;
+	int ncoords = 0;
+
+	BMesh *bm;
+	BMFace *f_new = NULL;
+	BMLoop *l_new = NULL;
+
+	if (!PyArg_ParseTupleAndKeywords(args, kw, "O!O!O!|OiO!:face_split", (char **)kwlist,
+	                                 &BPy_BMFace_Type, &py_face,
+	                                 &BPy_BMVert_Type, &py_vert_a,
+	                                 &BPy_BMVert_Type, &py_vert_b,
+	                                 &py_coords,
+	                                 &edge_exists,
+	                                 &BPy_BMEdge_Type, &py_edge_example))
+	{
+		return NULL;
+	}
+
+	BPY_BM_CHECK_OBJ(py_face);
+	BPY_BM_CHECK_OBJ(py_vert_a);
+	BPY_BM_CHECK_OBJ(py_vert_b);
+
+	if (py_edge_example) {
+		BPY_BM_CHECK_OBJ(py_edge_example);
+	}
+
+	/* this doubles for checking that the verts are in the same mesh */
+	if (BM_vert_in_face(py_face->f, py_vert_a->v) == FALSE ||
+	    BM_vert_in_face(py_face->f, py_vert_b->v) == FALSE)
+	{
+		PyErr_SetString(PyExc_ValueError,
+		                "face_split(...): one of the verts passed is not found in the face");
+		return NULL;
+	}
+
+	if (py_vert_a->v == py_vert_b->v) {
+		PyErr_SetString(PyExc_ValueError,
+		                "face_split(...): vert arguments must differ");
+		return NULL;
+	}
+
+	if (py_coords) {
+		ncoords = mathutils_array_parse_alloc_v(&coords, 3, py_coords, "face_split(...): ");
+		if (ncoords == -1) {
+			return NULL;
+		}
+	}
+
+	/* --- main function body --- */
+	bm = py_face->bm;
+
+	if (ncoords) {
+		f_new = BM_face_split_n(bm, py_face->f,
+		                        py_vert_a->v, py_vert_b->v,
+		                        (float (*)[3])coords, ncoords,
+		                        &l_new, py_edge_example ? py_edge_example->e : NULL);
+	}
+	else {
+		f_new = BM_face_split(bm, py_face->f,
+		                      py_vert_a->v, py_vert_b->v,
+		                      &l_new, py_edge_example ? py_edge_example->e : NULL, edge_exists);
+	}
+
+	if (f_new && l_new) {
+		PyObject *ret = PyTuple_New(2);
+		PyTuple_SET_ITEM(ret, 0, BPy_BMFace_CreatePyObject(bm, f_new));
+		PyTuple_SET_ITEM(ret, 1, BPy_BMLoop_CreatePyObject(bm, l_new));
+		return ret;
+	}
+	else {
+		PyErr_SetString(PyExc_ValueError,
+		                "face_split(...): couldn't split the face, internal error");
+		return NULL;
+	}
+}
+
+
+PyDoc_STRVAR(bpy_bm_utils_face_join_doc,
+".. method:: face_join(faces, remove=True)\n"
+"\n"
+"   Joins a sequence of faces.\n"
+"\n"
+"   :arg faces: Sequence of faces.\n"
+"   :type faces: :class:`bmesh.types.BMFace`\n"
+"   :arg remove: Remove the edges and vertices between the faces.\n"
+"   :type remove: boolean\n"
+"   :return: The newly created face or None on failure.\n"
+"   :rtype: :class:`bmesh.types.BMFace`\n"
+);
+static PyObject *bpy_bm_utils_face_join(PyObject *UNUSED(self), PyObject *args)
+{
+	BMesh *bm = NULL;
+	PyObject *py_face_array;
+	BMFace **face_array;
+	Py_ssize_t face_seq_len = 0;
+	BMFace *f_new;
+	int do_remove = TRUE;
+
+	if (!PyArg_ParseTuple(args, "O|i:face_join", &py_face_array, &do_remove)) {
+		return NULL;
+	}
+
+	face_array = BPy_BMElem_PySeq_As_Array(&bm, py_face_array, 2, PY_SSIZE_T_MAX,
+	                                       &face_seq_len, BM_FACE,
+	                                       TRUE, TRUE, "face_join(...)");
+
+	if (face_array == NULL) {
+		return NULL; /* error will be set */
+	}
+
+	/* Go ahead and join the face!
+	 * --------------------------- */
+	f_new = BM_faces_join(bm, face_array, (int)face_seq_len, do_remove);
+
+	PyMem_FREE(face_array);
+
+	if (f_new) {
+		return BPy_BMFace_CreatePyObject(bm, f_new);
+	}
+	else {
+		Py_RETURN_NONE;
+	}
+}
+
+
+PyDoc_STRVAR(bpy_bm_utils_face_vert_separate_doc,
+".. method:: face_vert_separate(face, vert)\n"
+"\n"
+"   Rip a vertex in a face away and add a new vertex.\n"
+"\n"
+"   :arg face: The face to separate.\n"
+"   :type face: :class:`bmesh.types.BMFace`\n"
+"   :arg vert: A vertex in the face to separate.\n"
+"   :type vert: :class:`bmesh.types.BMVert`\n"
+"   :return vert: The newly created vertex or None of failure.\n"
+"   :rtype vert: :class:`bmesh.types.BMVert`\n"
+"\n"
+"   .. note::\n"
+"\n"
+"      This is the same as loop_separate, and has only been added for convenience.\n"
+);
+static PyObject *bpy_bm_utils_face_vert_separate(PyObject *UNUSED(self), PyObject *args)
+{
+	BPy_BMFace *py_face;
+	BPy_BMVert *py_vert;
+
+	BMesh *bm;
+	BMLoop *l;
+	BMVert *v_new;
+
+	if (!PyArg_ParseTuple(args, "O!O!:face_vert_separate",
+	                      &BPy_BMFace_Type, &py_face,
+	                      &BPy_BMVert_Type, &py_vert))
+	{
+		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;
+	}
+
+	l = BM_face_vert_share_loop(py_face->f, py_vert->v);
+
+	if (l == NULL) {
+		PyErr_SetString(PyExc_ValueError,
+		                "vertex not found in face");
+		return NULL;
+	}
+
+	v_new = BM_face_loop_separate(bm, l);
+
+	if (v_new != l->v) {
+		return BPy_BMVert_CreatePyObject(bm, v_new);
+	}
+	else {
+		Py_RETURN_NONE;
+	}
+}
+
+
+PyDoc_STRVAR(bpy_bm_utils_face_flip_doc,
+".. method:: face_flip(faces)\n"
+"\n"
+"   Flip the faces direction.\n"
+"\n"
+"   :arg face: Face to flip.\n"
+"   :type face: :class:`bmesh.types.BMFace`\n"
+);
+static PyObject *bpy_bm_utils_face_flip(PyObject *UNUSED(self), BPy_BMFace *value)
+{
+	if (!BPy_BMFace_Check(value)) {
+		PyErr_Format(PyExc_TypeError,
+		             "face_flip(face): BMFace expected, not '%.200s'",
+		             Py_TYPE(value)->tp_name);
+		return NULL;
+	}
+
+	BPY_BM_CHECK_OBJ(value);
+
+	BM_face_normal_flip(value->bm, value->f);
+
+	Py_RETURN_NONE;
+}
+
+
+
+PyDoc_STRVAR(bpy_bm_utils_loop_separate_doc,
+".. method:: loop_separate(loop)\n"
+"\n"
+"   Rip a vertex in a face away and add a new vertex.\n"
+"\n"
+"   :arg loop: The to separate.\n"
+"   :type loop: :class:`bmesh.types.BMFace`\n"
+"   :return vert: The newly created vertex or None of failure.\n"
+"   :rtype vert: :class:`bmesh.types.BMVert`\n"
+);
+static PyObject *bpy_bm_utils_loop_separate(PyObject *UNUSED(self), BPy_BMLoop *value)
+{
+	BMesh *bm;
+	BMVert *v_new;
+
+	if (!BPy_BMLoop_Check(value)) {
+		PyErr_Format(PyExc_TypeError,
+		             "loop_separate(loop): BMLoop expected, not '%.200s'",
+		             Py_TYPE(value)->tp_name);
+		return NULL;
+	}
+
+	BPY_BM_CHECK_OBJ(value);
+
+	bm = value->bm;
+
+	v_new = BM_face_loop_separate(bm, value->l);
+
+	if (v_new != value->l->v) {
+		return BPy_BMVert_CreatePyObject(bm, v_new);
+	}
+	else {
+		Py_RETURN_NONE;
+	}
+}
+
+
+static struct PyMethodDef BPy_BM_utils_methods[] = {
+    {"vert_collapse_edge",  (PyCFunction)bpy_bm_utils_vert_collapse_edge,  METH_VARARGS, bpy_bm_utils_vert_collapse_edge_doc},
+    {"vert_collapse_faces", (PyCFunction)bpy_bm_utils_vert_collapse_faces, METH_VARARGS, bpy_bm_utils_vert_collapse_faces_doc},
+    {"vert_dissolve",       (PyCFunction)bpy_bm_utils_vert_dissolve,       METH_VARARGS, bpy_bm_utils_vert_dissolve_doc}, /* could use METH_O */
+    {"vert_separate",       (PyCFunction)bpy_bm_utils_vert_separate,       METH_VARARGS, bpy_bm_utils_vert_separate_doc},
+    {"edge_split",          (PyCFunction)bpy_bm_utils_edge_split,          METH_VARARGS, bpy_bm_utils_edge_split_doc},
+    {"edge_rotate",         (PyCFunction)bpy_bm_utils_edge_rotate,         METH_VARARGS, bpy_bm_utils_edge_rotate_doc},
+    {"face_split",          (PyCFunction)bpy_bm_utils_face_split,          METH_VARARGS | METH_KEYWORDS, bpy_bm_utils_face_split_doc},
+    {"face_join",           (PyCFunction)bpy_bm_utils_face_join,           METH_VARARGS, bpy_bm_utils_face_join_doc},
+    {"face_vert_separate",  (PyCFunction)bpy_bm_utils_face_vert_separate,  METH_VARARGS, bpy_bm_utils_face_vert_separate_doc},
+    {"face_flip",           (PyCFunction)bpy_bm_utils_face_flip,           METH_O,       bpy_bm_utils_face_flip_doc},
+    {"loop_separate",       (PyCFunction)bpy_bm_utils_loop_separate,       METH_O,       bpy_bm_utils_loop_separate_doc},
+    {NULL, NULL, 0, NULL}
+};
+
+
+PyDoc_STRVAR(BPy_BM_doc,
+"This module provides access to blenders bmesh data structures."
+);
+static struct PyModuleDef BPy_BM_types_module_def = {
+    PyModuleDef_HEAD_INIT,
+    "bmesh.utils",  /* m_name */
+    BPy_BM_doc,  /* m_doc */
+    0,  /* m_size */
+    BPy_BM_utils_methods,  /* m_methods */
+    NULL,  /* m_reload */
+    NULL,  /* m_traverse */
+    NULL,  /* m_clear */
+    NULL,  /* m_free */
+};
+
+
+PyObject *BPyInit_bmesh_utils(void)
+{
+	PyObject *submodule;
+
+	submodule = PyModule_Create(&BPy_BM_types_module_def);
+
+	return submodule;
+}
diff --git a/source/blender/python/bmesh/bmesh_py_utils.h b/source/blender/python/bmesh/bmesh_py_utils.h
new file mode 100644
index 0000000..db93f5b
--- /dev/null
+++ b/source/blender/python/bmesh/bmesh_py_utils.h
@@ -0,0 +1,35 @@
+/*
+ * ***** 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_utils.h
+ *  \ingroup pybmesh
+ */
+
+#ifndef __BMESH_PY_UTILS_H__
+#define __BMESH_PY_UTILS_H__
+
+PyObject *BPyInit_bmesh_utils(void);
+
+#endif /* __BMESH_PY_UTILS_H__ */
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c
index e324449..3d695e4 100644
--- a/source/blender/python/generic/bgl.c
+++ b/source/blender/python/generic/bgl.c
@@ -56,16 +56,16 @@ static PyObject *Buffer_subscript(Buffer *self, PyObject *item);
 static int Buffer_ass_subscript(Buffer *self, PyObject *item, PyObject *value);
 
 static PySequenceMethods Buffer_SeqMethods = {
-	(lenfunc) Buffer_len,						/*sq_length */
-	(binaryfunc) NULL,							/*sq_concat */
-	(ssizeargfunc) NULL,						/*sq_repeat */
-	(ssizeargfunc) Buffer_item,					/*sq_item */
-	(ssizessizeargfunc) NULL,					/*sq_slice, deprecated, handled in Buffer_item */
-	(ssizeobjargproc) Buffer_ass_item,			/*sq_ass_item */
-	(ssizessizeobjargproc) NULL,				/*sq_ass_slice, deprecated handled in Buffer_ass_item */
-	(objobjproc) NULL,							/* sq_contains */
-	(binaryfunc) NULL,							/* sq_inplace_concat */
-	(ssizeargfunc) NULL,						/* sq_inplace_repeat */
+	(lenfunc) Buffer_len,                       /*sq_length */
+	(binaryfunc) NULL,                          /*sq_concat */
+	(ssizeargfunc) NULL,                        /*sq_repeat */
+	(ssizeargfunc) Buffer_item,                 /*sq_item */
+	(ssizessizeargfunc) NULL,                   /*sq_slice, deprecated, handled in Buffer_item */
+	(ssizeobjargproc) Buffer_ass_item,          /*sq_ass_item */
+	(ssizessizeobjargproc) NULL,                /*sq_ass_slice, deprecated handled in Buffer_ass_item */
+	(objobjproc) NULL,                          /* sq_contains */
+	(binaryfunc) NULL,                          /* sq_inplace_concat */
+	(ssizeargfunc) NULL,                        /* sq_inplace_repeat */
 };
 
 
@@ -80,10 +80,10 @@ static PyObject *Buffer_repr(Buffer *self);
 
 static PyObject *Buffer_to_list(Buffer *self)
 {
-	int i, len= self->dimensions[0];
-	PyObject *list= PyList_New(len);
+	int i, len = self->dimensions[0];
+	PyObject *list = PyList_New(len);
 
-	for (i=0; i<len; i++) {
+	for (i = 0; i < len; i++) {
 		PyList_SET_ITEM(list, i, Buffer_item(self, i));
 	}
 
@@ -95,17 +95,17 @@ static PyObject *Buffer_to_list_recursive(Buffer *self)
 	PyObject *list;
 
 	if (self->ndimensions > 1) {
-		int i, len= self->dimensions[0];
-		list= PyList_New(len);
+		int i, len = self->dimensions[0];
+		list = PyList_New(len);
 
-		for (i=0; i<len; i++) {
-			Buffer *sub= (Buffer *)Buffer_item(self, i);
+		for (i = 0; i < len; i++) {
+			Buffer *sub = (Buffer *)Buffer_item(self, i);
 			PyList_SET_ITEM(list, i, Buffer_to_list_recursive(sub));
 			Py_DECREF(sub);
 		}
 	}
 	else {
-		list= Buffer_to_list(self);
+		list = Buffer_to_list(self);
 	}
 
 	return list;
@@ -113,10 +113,10 @@ static PyObject *Buffer_to_list_recursive(Buffer *self)
 
 static PyObject *Buffer_dimensions(Buffer *self, void *UNUSED(arg))
 {
-	PyObject *list= PyList_New(self->ndimensions);
+	PyObject *list = PyList_New(self->ndimensions);
 	int i;
 
-	for (i= 0; i<self->ndimensions; i++) {
+	for (i = 0; i < self->ndimensions; i++) {
 		PyList_SET_ITEM(list, i, PyLong_FromLong(self->dimensions[i]));
 	}
 
@@ -125,13 +125,13 @@ static PyObject *Buffer_dimensions(Buffer *self, void *UNUSED(arg))
 
 static PyMethodDef Buffer_methods[] = {
 	{"to_list", (PyCFunction)Buffer_to_list_recursive, METH_NOARGS,
-     "return the buffer as a list"},
+	 "return the buffer as a list"},
 	{NULL, NULL, 0, NULL}
 };
 
 static PyGetSetDef Buffer_getseters[] = {
 	{(char *)"dimensions", (getter)Buffer_dimensions, NULL, NULL, NULL},
-	 {NULL, NULL, NULL, NULL, NULL}
+	{NULL, NULL, NULL, NULL, NULL}
 };
 
 
@@ -144,11 +144,11 @@ PyTypeObject BGL_bufferType = {
 	(printfunc)NULL,            /*tp_print */
 	NULL,                       /*tp_getattr */
 	NULL,                       /*tp_setattr */
-	NULL,		/*tp_compare */
-	(reprfunc) Buffer_repr,	/*tp_repr */
-	NULL,			/*tp_as_number */
-	&Buffer_SeqMethods,	/*tp_as_sequence */
-	&Buffer_AsMapping,		/* PyMappingMethods *tp_as_mapping; */
+	NULL,                       /*tp_compare */
+	(reprfunc) Buffer_repr,     /*tp_repr */
+	NULL,                       /*tp_as_number */
+	&Buffer_SeqMethods,         /*tp_as_sequence */
+	&Buffer_AsMapping,          /* PyMappingMethods *tp_as_mapping; */
 
 	/* More standard operations (here for binary compatibility) */
 
@@ -187,22 +187,22 @@ PyTypeObject BGL_bufferType = {
 	Buffer_methods,             /* struct PyMethodDef *tp_methods; */
 	NULL,                       /* struct PyMemberDef *tp_members; */
 	Buffer_getseters,           /* struct PyGetSetDef *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*/
-	Buffer_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*/
+	NULL,                       /*tp_base*/
+	NULL,                       /*tp_dict*/
+	NULL,                       /*tp_descr_get*/
+	NULL,                       /*tp_descr_set*/
+	0,                          /*tp_dictoffset*/
+	NULL,                       /*tp_init*/
+	NULL,                       /*tp_alloc*/
+	Buffer_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*/
 };
 
 #define BGL_Wrap(nargs, funcname, ret, arg_list)                              \
@@ -239,16 +239,16 @@ static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args)   \
 int BGL_typeSize(int type)
 {
 	switch (type) {
-	case GL_BYTE:
-		return sizeof(char);
-	case GL_SHORT:
-		return sizeof(short);
-	case GL_INT:
-		return sizeof(int);
-	case GL_FLOAT:
-		return sizeof(float);
-	case GL_DOUBLE:
-		return sizeof(double);
+		case GL_BYTE:
+			return sizeof(char);
+		case GL_SHORT:
+			return sizeof(short);
+		case GL_INT:
+			return sizeof(int);
+		case GL_FLOAT:
+			return sizeof(float);
+		case GL_DOUBLE:
+			return sizeof(double);
 	}
 	return -1;
 }
@@ -256,42 +256,43 @@ int BGL_typeSize(int type)
 Buffer *BGL_MakeBuffer(int type, int ndimensions, int *dimensions, void *initbuffer)
 {
 	Buffer *buffer;
-	void *buf= NULL;
+	void *buf = NULL;
 	int i, size, length;
- 
-	length= 1;
-	for (i=0; i<ndimensions; i++) 
-		length*= dimensions[i];
- 
-	size= BGL_typeSize(type);
- 
-	buf= MEM_mallocN(length*size, "Buffer buffer");
-
-	buffer= (Buffer *) PyObject_NEW(Buffer, &BGL_bufferType);
-	buffer->parent= NULL;
-	buffer->ndimensions= ndimensions;
-	buffer->dimensions= MEM_mallocN(ndimensions*sizeof(int), "Buffer dimensions");
-	memcpy(buffer->dimensions, dimensions, ndimensions*sizeof(int));
-	buffer->type= type;
-	buffer->buf.asvoid= buf;
+
+	length = 1;
+	for (i = 0; i < ndimensions; i++) {
+		length *= dimensions[i];
+	}
+
+	size = BGL_typeSize(type);
+
+	buf = MEM_mallocN(length * size, "Buffer buffer");
+
+	buffer = (Buffer *)PyObject_NEW(Buffer, &BGL_bufferType);
+	buffer->parent = NULL;
+	buffer->ndimensions = ndimensions;
+	buffer->dimensions = MEM_mallocN(ndimensions * sizeof(int), "Buffer dimensions");
+	memcpy(buffer->dimensions, dimensions, ndimensions * sizeof(int));
+	buffer->type = type;
+	buffer->buf.asvoid = buf;
 
 	if (initbuffer) {
-		memcpy(buffer->buf.asvoid, initbuffer, length*size);
+		memcpy(buffer->buf.asvoid, initbuffer, length * size);
 	}
 	else {
-		memset(buffer->buf.asvoid, 0, length*size);
+		memset(buffer->buf.asvoid, 0, length * size);
 	}
 	return buffer;
 }
 
 
-#define MAX_DIMENSIONS	256
+#define MAX_DIMENSIONS  256
 static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
 {
-	PyObject *length_ob= NULL, *init= NULL;
+	PyObject *length_ob = NULL, *init = NULL;
 	Buffer *buffer;
 	int dimensions[MAX_DIMENSIONS];
-	
+
 	int type;
 	Py_ssize_t i, ndimensions = 0;
 
@@ -312,15 +313,15 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject
 	}
 
 	if (PyLong_Check(length_ob)) {
-		ndimensions= 1;
-		if (((dimensions[0]= PyLong_AsLong(length_ob)) < 1)) {
+		ndimensions = 1;
+		if (((dimensions[0] = PyLong_AsLong(length_ob)) < 1)) {
 			PyErr_SetString(PyExc_AttributeError,
 			                "dimensions must be between 1 and "STRINGIFY(MAX_DIMENSIONS));
 			return NULL;
 		}
 	}
 	else if (PySequence_Check(length_ob)) {
-		ndimensions= PySequence_Size(length_ob);
+		ndimensions = PySequence_Size(length_ob);
 		if (ndimensions > MAX_DIMENSIONS) {
 			PyErr_SetString(PyExc_AttributeError,
 			                "too many dimensions, max is "STRINGIFY(MAX_DIMENSIONS));
@@ -331,11 +332,13 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject
 			                "sequence must have at least one dimension");
 			return NULL;
 		}
-		for (i=0; i<ndimensions; i++) {
-			PyObject *ob= PySequence_GetItem(length_ob, i);
+		for (i = 0; i < ndimensions; i++) {
+			PyObject *ob = PySequence_GetItem(length_ob, i);
 
-			if (!PyLong_Check(ob)) dimensions[i]= 1;
-			else dimensions[i]= PyLong_AsLong(ob);
+			if (!PyLong_Check(ob))
+				dimensions[i] = 1;
+			else
+				dimensions[i] = PyLong_AsLong(ob);
 			Py_DECREF(ob);
 
 			if (dimensions[i] < 1) {
@@ -351,16 +354,16 @@ static PyObject *Buffer_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject
 		             "or an int, not a %.200s", Py_TYPE(length_ob)->tp_name);
 		return NULL;
 	}
-	
-	buffer= BGL_MakeBuffer(type, ndimensions, dimensions, NULL);
+
+	buffer = BGL_MakeBuffer(type, ndimensions, dimensions, NULL);
 	if (init && ndimensions) {
 		if (Buffer_ass_slice(buffer, 0, dimensions[0], init)) {
 			Py_DECREF(buffer);
 			return NULL;
 		}
 	}
-	
-	return (PyObject *) buffer;
+
+	return (PyObject *)buffer;
 }
 
 /*@ Buffer sequence methods */
@@ -377,12 +380,12 @@ static PyObject *Buffer_item(Buffer *self, int i)
 		return NULL;
 	}
 
-	if (self->ndimensions==1) {
+	if (self->ndimensions == 1) {
 		switch (self->type) {
-			case GL_BYTE: return Py_BuildValue("b", self->buf.asbyte[i]);
-			case GL_SHORT: return Py_BuildValue("h", self->buf.asshort[i]);
-			case GL_INT: return Py_BuildValue("i", self->buf.asint[i]);
-			case GL_FLOAT: return PyFloat_FromDouble(self->buf.asfloat[i]);
+			case GL_BYTE:   return Py_BuildValue("b", self->buf.asbyte[i]);
+			case GL_SHORT:  return Py_BuildValue("h", self->buf.asshort[i]);
+			case GL_INT:    return Py_BuildValue("i", self->buf.asint[i]);
+			case GL_FLOAT:  return PyFloat_FromDouble(self->buf.asfloat[i]);
 			case GL_DOUBLE: return Py_BuildValue("d", self->buf.asdouble[i]);
 		}
 	}
@@ -390,26 +393,24 @@ static PyObject *Buffer_item(Buffer *self, int i)
 		Buffer *newbuf;
 		int j, length, size;
 
-		length= 1;
-		for (j=1; j < self->ndimensions; j++) {
+		length = 1;
+		for (j = 1; j < self->ndimensions; j++) {
 			length *= self->dimensions[j];
 		}
-		size= BGL_typeSize(self->type);
+		size = BGL_typeSize(self->type);
 
-		newbuf= (Buffer *) PyObject_NEW(Buffer, &BGL_bufferType);
+		newbuf = (Buffer *)PyObject_NEW(Buffer, &BGL_bufferType);
 
 		Py_INCREF(self);
-		newbuf->parent= (PyObject *)self;
+		newbuf->parent = (PyObject *)self;
 
-		newbuf->ndimensions= self->ndimensions - 1;
-		newbuf->type= self->type;
-		newbuf->buf.asvoid= self->buf.asbyte + i*length*size;
-		newbuf->dimensions= MEM_mallocN(newbuf->ndimensions*sizeof(int),
-			"Buffer dimensions");
-		memcpy(newbuf->dimensions, self->dimensions+1,
-			newbuf->ndimensions*sizeof(int));
+		newbuf->ndimensions = self->ndimensions - 1;
+		newbuf->type = self->type;
+		newbuf->buf.asvoid = self->buf.asbyte + i * length * size;
+		newbuf->dimensions = MEM_mallocN(newbuf->ndimensions * sizeof(int), "Buffer dimensions");
+		memcpy(newbuf->dimensions, self->dimensions + 1, newbuf->ndimensions * sizeof(int));
 
-		return (PyObject *) newbuf;
+		return (PyObject *)newbuf;
 	}
 
 	return NULL;
@@ -420,14 +421,14 @@ static PyObject *Buffer_slice(Buffer *self, int begin, int end)
 	PyObject *list;
 	int count;
 	
-	if (begin < 0) begin= 0;
-	if (end > self->dimensions[0]) end= self->dimensions[0];
-	if (begin > end) begin= end;
+	if (begin < 0) begin = 0;
+	if (end > self->dimensions[0]) end = self->dimensions[0];
+	if (begin > end) begin = end;
 	  
-	list= PyList_New(end-begin);
+	list = PyList_New(end - begin);
 
-	for (count= begin; count<end; count++) {
-		PyList_SET_ITEM(list, count-begin, Buffer_item(self, count));
+	for (count = begin; count < end; count++) {
+		PyList_SET_ITEM(list, count - begin, Buffer_item(self, count));
 	}
 	return list;
 }
@@ -440,11 +441,11 @@ static int Buffer_ass_item(Buffer *self, int i, PyObject *v)
 		return -1;
 	}
 
-	if (self->ndimensions!=1) {
-		Buffer *row= (Buffer *)Buffer_item(self, i);
+	if (self->ndimensions != 1) {
+		Buffer *row = (Buffer *)Buffer_item(self, i);
 
 		if (row) {
-			int ret= Buffer_ass_slice(row, 0, self->dimensions[1], v);
+			int ret = Buffer_ass_slice(row, 0, self->dimensions[1], v);
 			Py_DECREF(row);
 			return ret;
 		}
@@ -454,29 +455,23 @@ static int Buffer_ass_item(Buffer *self, int i, PyObject *v)
 	}
 
 	switch (self->type) {
-	case GL_BYTE:
-		return PyArg_Parse(v, "b:Expected ints", &self->buf.asbyte[i]) ? 0:-1;
-	case GL_SHORT:
-		return PyArg_Parse(v, "h:Expected ints", &self->buf.asshort[i]) ? 0:-1;
-	case GL_INT:
-		return PyArg_Parse(v, "i:Expected ints", &self->buf.asint[i]) ? 0:-1;
-	case GL_FLOAT:
-		return PyArg_Parse(v, "f:Expected floats", &self->buf.asfloat[i]) ? 0:-1;
-	case GL_DOUBLE:
-		return PyArg_Parse(v, "d:Expected floats", &self->buf.asdouble[i]) ? 0:-1;
-	default:
-		return 0; /* should never happen */
+		case GL_BYTE:   return PyArg_Parse(v, "b:Expected ints",   &self->buf.asbyte[i])   ? 0 : -1;
+		case GL_SHORT:  return PyArg_Parse(v, "h:Expected ints",   &self->buf.asshort[i])  ? 0 : -1;
+		case GL_INT:    return PyArg_Parse(v, "i:Expected ints",   &self->buf.asint[i])    ? 0 : -1;
+		case GL_FLOAT:  return PyArg_Parse(v, "f:Expected floats", &self->buf.asfloat[i])  ? 0 : -1;
+		case GL_DOUBLE: return PyArg_Parse(v, "d:Expected floats", &self->buf.asdouble[i]) ? 0 : -1;
+		default:        return 0; /* should never happen */
 	}
 }
 
 static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq)
 {
 	PyObject *item;
-	int count, err=0;
+	int count, err = 0;
 	
-	if (begin < 0) begin= 0;
-	if (end > self->dimensions[0]) end= self->dimensions[0];
-	if (begin > end) begin= end;
+	if (begin < 0) begin = 0;
+	if (end > self->dimensions[0]) end = self->dimensions[0];
+	if (begin > end) begin = end;
 	
 	if (!PySequence_Check(seq)) {
 		PyErr_Format(PyExc_TypeError,
@@ -487,23 +482,25 @@ static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq)
 	}
 
 	/* re-use count var */
-	if ((count= PySequence_Size(seq)) != (end - begin)) {
+	if ((count = PySequence_Size(seq)) != (end - begin)) {
 		PyErr_Format(PyExc_TypeError,
 		             "buffer[:] = value, size mismatch in assignment. "
 		             "Expected: %d (given: %d)", count, end - begin);
 		return -1;
 	}
 	
-	for (count= begin; count < end; count++) {
-		item= PySequence_GetItem(seq, count - begin);
+	for (count = begin; count < end; count++) {
+		item = PySequence_GetItem(seq, count - begin);
 		if (item) {
-			err= Buffer_ass_item(self, count, item);
+			err = Buffer_ass_item(self, count, item);
 			Py_DECREF(item);
 		}
 		else {
-			err= -1;
+			err = -1;
+		}
+		if (err) {
+			break;
 		}
-		if (err) break;
 	}
 	return err;
 }
@@ -580,8 +577,12 @@ static int Buffer_ass_subscript(Buffer *self, PyObject *item, PyObject *value)
 
 static void Buffer_dealloc(Buffer *self)
 {
-	if (self->parent) Py_DECREF(self->parent);
-	else MEM_freeN (self->buf.asvoid);
+	if (self->parent) {
+		Py_DECREF(self->parent);
+	}
+	else {
+		MEM_freeN(self->buf.asvoid);
+	}
 
 	MEM_freeN(self->dimensions);
 
@@ -591,19 +592,20 @@ static void Buffer_dealloc(Buffer *self)
 
 static PyObject *Buffer_repr(Buffer *self)
 {
-	PyObject *list= Buffer_to_list_recursive(self);
+	PyObject *list = Buffer_to_list_recursive(self);
 	PyObject *repr;
-	const char *typestr= "UNKNOWN";
+	const char *typestr;
 
 	switch (self->type) {
-	case GL_BYTE:   typestr= "GL_BYTE"; break;
-	case GL_SHORT:  typestr= "GL_SHORT"; break;
-	case GL_INT:    typestr= "GL_BYTE"; break;
-	case GL_FLOAT:  typestr= "GL_FLOAT"; break;
-	case GL_DOUBLE: typestr= "GL_DOUBLE"; break;
+		case GL_BYTE:   typestr = "GL_BYTE"; break;
+		case GL_SHORT:  typestr = "GL_SHORT"; break;
+		case GL_INT:    typestr = "GL_BYTE"; break;
+		case GL_FLOAT:  typestr = "GL_FLOAT"; break;
+		case GL_DOUBLE: typestr = "GL_DOUBLE"; break;
+		default:        typestr = "UNKNOWN"; break;
 	}
 
-	repr= PyUnicode_FromFormat("Buffer(%s, %R)", typestr, list);
+	repr = PyUnicode_FromFormat("Buffer(%s, %R)", typestr, list);
 	Py_DECREF(list);
 
 	return repr;
@@ -616,7 +618,7 @@ BGL_Wrap(3, AreTexturesResident,  GLboolean,  (GLsizei, GLuintP, GLbooleanP))
 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))
+                                       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))
@@ -698,7 +700,7 @@ BGL_Wrap(2, Fogi,             void,     (GLenum, GLint))
 BGL_Wrap(2, Fogiv,            void,     (GLenum, GLintP))
 BGL_Wrap(1, FrontFace,        void,     (GLenum))
 BGL_Wrap(6, Frustum,          void,     (GLdouble, GLdouble,
-						GLdouble, GLdouble, GLdouble, GLdouble))
+                                         GLdouble, GLdouble, GLdouble, GLdouble))
 BGL_Wrap(1, GenLists,         GLuint,   (GLsizei))
 BGL_Wrap(2, GenTextures,      void,   (GLsizei, GLuintP))
 BGL_Wrap(2, GetBooleanv,      void,     (GLenum, GLbooleanP))
@@ -717,7 +719,7 @@ BGL_Wrap(3, GetMaterialiv,    void,     (GLenum, GLenum, GLintP))
 BGL_Wrap(2, GetPixelMapfv,    void,     (GLenum, GLfloatP))
 BGL_Wrap(2, GetPixelMapuiv,   void,     (GLenum, GLuintP))
 BGL_Wrap(2, GetPixelMapusv,   void,     (GLenum, GLushortP))
-BGL_Wrap(1, GetPolygonStipple,void,     (GLubyteP))
+BGL_Wrap(1, GetPolygonStipple, void,     (GLubyteP))
 BGL_Wrap(1, GetString,        GLstring,   (GLenum))
 BGL_Wrap(3, GetTexEnvfv,      void,     (GLenum, GLenum, GLfloatP))
 BGL_Wrap(3, GetTexEnviv,      void,     (GLenum, GLenum, GLintP))
@@ -760,19 +762,19 @@ BGL_Wrap(1, LoadMatrixf,    void,     (GLfloatP))
 BGL_Wrap(1, LoadName,       void,     (GLuint))
 BGL_Wrap(1, LogicOp,        void,     (GLenum))
 BGL_Wrap(6, Map1d,          void,     (GLenum, GLdouble, GLdouble,
-						GLint, GLint, GLdoubleP))
+                                       GLint, GLint, GLdoubleP))
 BGL_Wrap(6, Map1f,          void,     (GLenum, GLfloat, GLfloat,
-						GLint, GLint, GLfloatP))
+                                       GLint, GLint, GLfloatP))
 BGL_Wrap(10, Map2d,         void,     (GLenum, GLdouble, GLdouble,
-						GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdoubleP))
+                                       GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdoubleP))
 BGL_Wrap(10, Map2f,         void,     (GLenum, GLfloat, GLfloat,
-						GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloatP))
+                                       GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloatP))
 BGL_Wrap(3, MapGrid1d,        void,     (GLint, GLdouble, GLdouble))
 BGL_Wrap(3, MapGrid1f,        void,     (GLint, GLfloat, GLfloat))
 BGL_Wrap(6, MapGrid2d,        void,     (GLint, GLdouble, GLdouble,
-						GLint, GLdouble, GLdouble))
+                                         GLint, GLdouble, GLdouble))
 BGL_Wrap(6, MapGrid2f,        void,     (GLint, GLfloat, GLfloat,
-						GLint, GLfloat, GLfloat))
+                                         GLint, GLfloat, GLfloat))
 BGL_Wrap(3, Materialf,        void,     (GLenum, GLenum, GLfloat))
 BGL_Wrap(3, Materialfv,       void,     (GLenum, GLenum, GLfloatP))
 BGL_Wrap(3, Materiali,        void,     (GLenum, GLenum, GLint))
@@ -792,7 +794,7 @@ BGL_Wrap(1, Normal3iv,        void,     (GLintP))
 BGL_Wrap(3, Normal3s,         void,     (GLshort, GLshort, GLshort))
 BGL_Wrap(1, Normal3sv,        void,     (GLshortP))
 BGL_Wrap(6, Ortho,            void,     (GLdouble, GLdouble,
-						GLdouble, GLdouble, GLdouble, GLdouble))
+                                         GLdouble, GLdouble, GLdouble, GLdouble))
 BGL_Wrap(1, PassThrough,      void,     (GLfloat))
 BGL_Wrap(3, PixelMapfv,       void,     (GLenum, GLint, GLfloatP))
 BGL_Wrap(3, PixelMapuiv,      void,     (GLenum, GLint, GLuintP))
@@ -841,7 +843,7 @@ BGL_Wrap(4, RasterPos4s,      void,     (GLshort, GLshort, GLshort, GLshort))
 BGL_Wrap(1, RasterPos4sv,     void,     (GLshortP))
 BGL_Wrap(1, ReadBuffer,       void,     (GLenum))
 BGL_Wrap(7, ReadPixels,       void,     (GLint, GLint, GLsizei,
-						GLsizei, GLenum, GLenum, GLvoidP))
+                                         GLsizei, GLenum, GLenum, GLvoidP))
 BGL_Wrap(4, Rectd,          void,     (GLdouble, GLdouble, GLdouble, GLdouble))
 BGL_Wrap(2, Rectdv,         void,     (GLdoubleP, GLdoubleP))
 BGL_Wrap(4, Rectf,          void,     (GLfloat, GLfloat, GLfloat, GLfloat))
@@ -904,9 +906,9 @@ BGL_Wrap(3, TexGenfv,       void,     (GLenum, GLenum, GLfloatP))
 BGL_Wrap(3, TexGeni,        void,     (GLenum, GLenum, GLint))
 BGL_Wrap(3, TexGeniv,       void,     (GLenum, GLenum, GLintP))
 BGL_Wrap(8, TexImage1D,     void,     (GLenum, GLint, GLint,
-						GLsizei, GLint, GLenum, GLenum, GLvoidP))
+                                       GLsizei, GLint, GLenum, GLenum, GLvoidP))
 BGL_Wrap(9, TexImage2D,     void,     (GLenum, GLint, GLint,
-						GLsizei, GLsizei, GLint, GLenum, GLenum, GLvoidP))
+                                       GLsizei, GLsizei, GLint, GLenum, GLenum, GLvoidP))
 BGL_Wrap(3, TexParameterf,      void,     (GLenum, GLenum, GLfloat))
 BGL_Wrap(3, TexParameterfv,     void,     (GLenum, GLenum, GLfloatP))
 BGL_Wrap(3, TexParameteri,      void,     (GLenum, GLenum, GLint))
@@ -938,12 +940,12 @@ BGL_Wrap(1, Vertex4iv,          void,     (GLintP))
 BGL_Wrap(4, Vertex4s,           void,     (GLshort, GLshort, GLshort, GLshort))
 BGL_Wrap(1, Vertex4sv,          void,     (GLshortP))
 BGL_Wrap(4, Viewport,           void,     (GLint, GLint, GLsizei, GLsizei))
-BGLU_Wrap(4, Perspective,       void,     	(GLdouble, GLdouble, GLdouble, GLdouble))
-BGLU_Wrap(9, LookAt,       		void,     	(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble))
-BGLU_Wrap(4, Ortho2D,       	void,     	(GLdouble, GLdouble, GLdouble, GLdouble))
-BGLU_Wrap(5, PickMatrix,       	void,     	(GLdouble, GLdouble, GLdouble, GLdouble, GLintP))
-BGLU_Wrap(9, Project,			GLint,		(GLdouble, GLdouble, GLdouble, GLdoubleP, GLdoubleP, GLintP, GLdoubleP, GLdoubleP, GLdoubleP))
-BGLU_Wrap(9, UnProject,			GLint,		(GLdouble, GLdouble, GLdouble, GLdoubleP, GLdoubleP, GLintP, GLdoubleP, GLdoubleP, GLdoubleP))
+BGLU_Wrap(4, Perspective,       void,       (GLdouble, GLdouble, GLdouble, GLdouble))
+BGLU_Wrap(9, LookAt,            void,       (GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble))
+BGLU_Wrap(4, Ortho2D,           void,       (GLdouble, GLdouble, GLdouble, GLdouble))
+BGLU_Wrap(5, PickMatrix,        void,       (GLdouble, GLdouble, GLdouble, GLdouble, GLintP))
+BGLU_Wrap(9, Project,           GLint,      (GLdouble, GLdouble, GLdouble, GLdoubleP, GLdoubleP, GLintP, GLdoubleP, GLdoubleP, GLdoubleP))
+BGLU_Wrap(9, UnProject,         GLint,      (GLdouble, GLdouble, GLdouble, GLdoubleP, GLdoubleP, GLintP, GLdoubleP, GLdoubleP, GLdoubleP))
 
 #undef MethodDef
 #define MethodDef(func) {"gl"#func, Method_##func, METH_VARARGS, "no string"}
@@ -1296,21 +1298,20 @@ static struct PyModuleDef BGL_module_def = {
 PyObject *BPyInit_bgl(void)
 {
 	PyObject *submodule, *dict, *item;
-	submodule= PyModule_Create(&BGL_module_def);
-	dict= PyModule_GetDict(submodule);
-	
-	if (PyType_Ready(&BGL_bufferType) < 0)
-		return NULL; /* should never happen */
+	submodule = PyModule_Create(&BGL_module_def);
+	dict = PyModule_GetDict(submodule);
 
+	if (PyType_Ready(&BGL_bufferType) < 0)
+		return NULL;  /* should never happen */
 
 	PyModule_AddObject(submodule, "Buffer", (PyObject *)&BGL_bufferType);
 	Py_INCREF((PyObject *)&BGL_bufferType);
 
-#define EXPP_ADDCONST(x) PyDict_SetItemString(dict, #x, item=PyLong_FromLong((int)x)); Py_DECREF(item)
+#define EXPP_ADDCONST(x) PyDict_SetItemString(dict, #x, item = PyLong_FromLong((int)x)); Py_DECREF(item)
 
 /* So, for example:
  * EXPP_ADDCONST(GL_CURRENT_BIT) becomes
- * PyDict_SetItemString(dict, "GL_CURRENT_BIT", item=PyLong_FromLong(GL_CURRENT_BIT)); Py_DECREF(item) */
+ * PyDict_SetItemString(dict, "GL_CURRENT_BIT", item = PyLong_FromLong(GL_CURRENT_BIT)); Py_DECREF(item) */
 
 	EXPP_ADDCONST(GL_CURRENT_BIT);
 	EXPP_ADDCONST(GL_POINT_BIT);
@@ -1795,4 +1796,3 @@ PyObject *BPyInit_bgl(void)
 
 	return submodule;
 }
-
diff --git a/source/blender/python/generic/bgl.h b/source/blender/python/generic/bgl.h
index 2e02900..1a7036d 100644
--- a/source/blender/python/generic/bgl.h
+++ b/source/blender/python/generic/bgl.h
@@ -36,18 +36,18 @@
  * writers to make OpenGL calls in their Python scripts for Blender.  The
  * more important original comments are marked with an @ symbol. */
 
-#ifndef BGL_H
-#define BGL_H
+#ifndef __BGL_H__
+#define __BGL_H__
 
 PyObject *BPyInit_bgl(void);
 
 /*@ Create a buffer object */
 /*@ dimensions is an array of ndimensions integers representing the size of each dimension */
 /*@ initbuffer if not NULL holds a contiguous buffer with the correct format from which the buffer will be initialized */
-struct _Buffer *BGL_MakeBuffer( int type, int ndimensions, int *dimensions, void *initbuffer );
+struct _Buffer *BGL_MakeBuffer(int type, int ndimensions, int *dimensions, void *initbuffer);
 /*@ Return the size of buffer element, type must be one of GL_BYTE, GL_SHORT, GL_INT, GL_FLOAT or GL_DOUBLE */
 /*@ returns -1 otherwise */
-int BGL_typeSize( int type );
+int BGL_typeSize(int type);
 
 /*@ Buffer Object */
 /*@ For Python access to OpenGL functions requiring a pointer. */
@@ -75,7 +75,7 @@ extern PyTypeObject BGL_bufferType;
 
 /*@ By golly George! It looks like fancy pants macro time!!! */
 
-/*
+#if 0 /* unused so far */
 #define int_str       "i"
 #define int_var(number)   bgl_int##number
 #define int_ref(number)   &bgl_int##number
@@ -85,7 +85,7 @@ extern PyTypeObject BGL_bufferType;
 #define float_var(number) bgl_float##number
 #define float_ref(number) &bgl_float##number
 #define float_def(number) float float_var(number)
-*/
+#endif
 
 /* TYPE_str is the string to pass to Py_ArgParse (for the format) */
 /* TYPE_var is the name to pass to the GL function */
@@ -312,23 +312,23 @@ extern PyTypeObject BGL_bufferType;
 #define ret_ret_void    return Py_INCREF(Py_None), Py_None
 
 #define ret_def_GLint   int ret_int
-#define ret_set_GLint   ret_int=
+#define ret_set_GLint   ret_int =
 #define ret_ret_GLint   return PyLong_FromLong(ret_int)
 
 #define ret_def_GLuint    unsigned int ret_uint
-#define ret_set_GLuint    ret_uint=
+#define ret_set_GLuint    ret_uint =
 #define ret_ret_GLuint    return PyLong_FromLong((long) ret_uint)
 
 #define ret_def_GLenum    unsigned int ret_uint
-#define ret_set_GLenum    ret_uint=
+#define ret_set_GLenum    ret_uint =
 #define ret_ret_GLenum    return PyLong_FromLong((long) ret_uint)
 
 #define ret_def_GLboolean unsigned char ret_bool
-#define ret_set_GLboolean ret_bool=
+#define ret_set_GLboolean ret_bool =
 #define ret_ret_GLboolean return PyLong_FromLong((long) ret_bool)
 
-#define ret_def_GLstring  const unsigned char *ret_str;
-#define ret_set_GLstring  ret_str=
+#define ret_def_GLstring  const unsigned char *ret_str
+#define ret_set_GLstring  ret_str =
 
 #define ret_ret_GLstring                                                      \
 	if (ret_str) {                                                            \
@@ -339,4 +339,4 @@ extern PyTypeObject BGL_bufferType;
 		return NULL;                                                          \
 	}                                                                         \
 
-#endif /* BGL_H */
+#endif /* __BGL_H__ */
diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c
index a4373e4..5b5438d 100644
--- a/source/blender/python/generic/blf_py_api.c
+++ b/source/blender/python/generic/blf_py_api.c
@@ -182,7 +182,7 @@ static PyObject *py_blf_dimensions(PyObject *UNUSED(self), PyObject *args)
 
 	BLF_width_and_height(fontid, text, &r_width, &r_height);
 
-	ret= PyTuple_New(2);
+	ret = PyTuple_New(2);
 	PyTuple_SET_ITEM(ret, 0, PyFloat_FromDouble(r_width));
 	PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(r_height));
 	return ret;
@@ -356,7 +356,7 @@ PyDoc_STRVAR(py_blf_load_doc,
 );
 static PyObject *py_blf_load(PyObject *UNUSED(self), PyObject *args)
 {
-	char* filename;
+	char *filename;
 
 	if (!PyArg_ParseTuple(args, "s:blf.load", &filename))
 		return NULL;
@@ -374,7 +374,7 @@ PyDoc_STRVAR(py_blf_unload_doc,
 );
 static PyObject *py_blf_unload(PyObject *UNUSED(self), PyObject *args)
 {
-	char* filename;
+	char *filename;
 
 	if (!PyArg_ParseTuple(args, "s:blf.unload", &filename))
 		return NULL;
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index ecf6527..ad97d74 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -47,7 +47,7 @@
 #include "BLI_string.h"
 #include "BLI_utildefines.h"
 
- /* UNUSED */	
+/* UNUSED */
 #include "BKE_text.h" /* txt_to_buf */	
 #include "BKE_main.h"
 
@@ -101,7 +101,7 @@ void bpy_text_filename_get(char *fn, size_t fn_len, Text *text)
 PyObject *bpy_text_import(Text *text)
 {
 	char *buf = NULL;
-	char modulename[MAX_ID_NAME+2];
+	char modulename[MAX_ID_NAME + 2];
 	int len;
 
 	if (!text->compiled) {
@@ -244,12 +244,12 @@ static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject
 	if (newmodule)
 		return newmodule;
 	
-	PyErr_Fetch(&exception, &err, &tb);	/* get the python error incase we cant import as blender text either */
+	PyErr_Fetch(&exception, &err, &tb); /* get the python error in case we cant import as blender text either */
 	
 	/* importing from existing modules failed, see if we have this module as blender text */
 	newmodule = bpy_text_import_name(name, &found);
 	
-	if (newmodule) {/* found module as blender text, ignore above exception */
+	if (newmodule) { /* found module as blender text, ignore above exception */
 		PyErr_Clear();
 		Py_XDECREF(exception);
 		Py_XDECREF(err);
@@ -287,10 +287,10 @@ static PyObject *blender_reload(PyObject *UNUSED(self), PyObject *module)
 		return newmodule;
 
 	/* no file, try importing from memory */
-	PyErr_Fetch(&exception, &err, &tb);	/*restore for probable later use */
+	PyErr_Fetch(&exception, &err, &tb); /*restore for probable later use */
 
 	newmodule = bpy_text_reimport(module, &found);
-	if (newmodule) {/* found module as blender text, ignore above exception */
+	if (newmodule) { /* found module as blender text, ignore above exception */
 		PyErr_Clear();
 		Py_XDECREF(exception);
 		Py_XDECREF(err);
diff --git a/source/blender/python/generic/bpy_internal_import.h b/source/blender/python/generic/bpy_internal_import.h
index 2ce6447..8b41a57 100644
--- a/source/blender/python/generic/bpy_internal_import.h
+++ b/source/blender/python/generic/bpy_internal_import.h
@@ -32,8 +32,8 @@
 
 /* Note, the BGE needs to use this too, keep it minimal */
 
-#ifndef BPY_INTERNAL_IMPORT_H
-#define BPY_INTERNAL_IMPORT_H
+#ifndef __BPY_INTERNAL_IMPORT_H__
+#define __BPY_INTERNAL_IMPORT_H__
 
 /* python redefines :/ */
 #ifdef _POSIX_C_SOURCE
@@ -62,4 +62,4 @@ extern PyMethodDef bpy_reload_meth;
 struct Main *bpy_import_main_get(void);
 void bpy_import_main_set(struct Main *maggie);
 
-#endif				/* BPY_INTERNAL_IMPORT_H */
+#endif				/* __BPY_INTERNAL_IMPORT_H__ */
diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c
index 516c0af..9fd120b 100644
--- a/source/blender/python/generic/idprop_py_api.c
+++ b/source/blender/python/generic/idprop_py_api.c
@@ -74,21 +74,21 @@ static PyObject *idprop_py_from_idp_int(IDProperty *prop)
 
 static PyObject *idprop_py_from_idp_float(IDProperty *prop)
 {
-	return PyFloat_FromDouble((double)(*(float*)(&prop->data.val)));
+	return PyFloat_FromDouble((double)(*(float *)(&prop->data.val)));
 }
 
 static PyObject *idprop_py_from_idp_double(IDProperty *prop)
 {
-	return PyFloat_FromDouble((*(double*)(&prop->data.val)));
+	return PyFloat_FromDouble((*(double *)(&prop->data.val)));
 }
 
 static PyObject *idprop_py_from_idp_group(ID *id, IDProperty *prop, IDProperty *parent)
 {
-	BPy_IDProperty *group= PyObject_New(BPy_IDProperty, &BPy_IDGroup_Type);
+	BPy_IDProperty *group = PyObject_New(BPy_IDProperty, &BPy_IDGroup_Type);
 	group->id = id;
 	group->prop = prop;
 	group->parent = parent; /* can be NULL */
-	return (PyObject*) group;
+	return (PyObject *)group;
 }
 
 static PyObject *idprop_py_from_idp_array(ID *id, IDProperty *prop)
@@ -96,13 +96,13 @@ static PyObject *idprop_py_from_idp_array(ID *id, IDProperty *prop)
 	BPy_IDProperty *array = PyObject_New(BPy_IDProperty, &BPy_IDArray_Type);
 	array->id = id;
 	array->prop = prop;
-	return (PyObject*) array;
+	return (PyObject *)array;
 }
 
 static PyObject *idprop_py_from_idp_idparray(ID *id, IDProperty *prop)
 {
 	PyObject *seq = PyList_New(prop->len), *wrap;
-	IDProperty *array= IDP_IDPArray(prop);
+	IDProperty *array = IDP_IDPArray(prop);
 	int i;
 
 	if (!seq) {
@@ -112,8 +112,8 @@ static PyObject *idprop_py_from_idp_idparray(ID *id, IDProperty *prop)
 		return NULL;
 	}
 
-	for (i=0; i<prop->len; i++) {
-		wrap= BPy_IDGroup_WrapData(id, array++, prop);
+	for (i = 0; i < prop->len; i++) {
+		wrap = BPy_IDGroup_WrapData(id, array++, prop);
 
 		if (!wrap) /* BPy_IDGroup_MapDataToPy sets the error */
 			return NULL;
@@ -127,35 +127,28 @@ static PyObject *idprop_py_from_idp_idparray(ID *id, IDProperty *prop)
 /* -------------------------------------------------------------------------- */
 
 /* use for both array and group */
-static long BPy_IDGroup_hash(BPy_IDProperty *self)
+static Py_hash_t BPy_IDGroup_hash(BPy_IDProperty *self)
 {
 	return _Py_HashPointer(self->prop);
 }
 
 static PyObject *BPy_IDGroup_repr(BPy_IDProperty *self)
 {
-	return PyUnicode_FromFormat( "<bpy id property from \"%s\">", self->id->name);
+	return PyUnicode_FromFormat("<bpy id prop: owner=\"%s\", name=\"%s\", address=%p>",
+	                            self->id ? self->id->name : "<NONE>", self->prop->name, self->prop);
 }
 
 PyObject *BPy_IDGroup_WrapData(ID *id, IDProperty *prop, IDProperty *parent)
 {
 	switch (prop->type) {
-	case IDP_STRING:
-		return idprop_py_from_idp_string(prop);
-	case IDP_INT:
-		return idprop_py_from_idp_int(prop);
-	case IDP_FLOAT:
-		return idprop_py_from_idp_float(prop);
-	case IDP_DOUBLE:
-		return idprop_py_from_idp_double(prop);
-	case IDP_GROUP:
-		return idprop_py_from_idp_group(id, prop, parent);
-	case IDP_ARRAY:
-		return idprop_py_from_idp_array(id, prop);
-	case IDP_IDPARRAY: /* this could be better a internal type */
-		return idprop_py_from_idp_idparray(id, prop);
-	default:
-		Py_RETURN_NONE;
+		case IDP_STRING:   return idprop_py_from_idp_string(prop);
+		case IDP_INT:      return idprop_py_from_idp_int(prop);
+		case IDP_FLOAT:    return idprop_py_from_idp_float(prop);
+		case IDP_DOUBLE:   return idprop_py_from_idp_double(prop);
+		case IDP_GROUP:    return idprop_py_from_idp_group(id, prop, parent);
+		case IDP_ARRAY:    return idprop_py_from_idp_array(id, prop);
+		case IDP_IDPARRAY: return idprop_py_from_idp_idparray(id, prop); /* this could be better a internal type */
+		default: Py_RETURN_NONE;
 	}
 }
 
@@ -174,10 +167,10 @@ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject
 #ifdef USE_STRING_COERCE
 			{
 				int alloc_len;
-				PyObject *value_coerce= NULL;
+				PyObject *value_coerce = NULL;
 
-				st= (char *)PyC_UnicodeAsByte(value, &value_coerce);
-				alloc_len= strlen(st) + 1;
+				st = (char *)PyC_UnicodeAsByte(value, &value_coerce);
+				alloc_len = strlen(st) + 1;
 
 				st = _PyUnicode_AsString(value);
 				IDP_ResizeArray(prop, alloc_len);
@@ -186,7 +179,7 @@ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject
 			}
 #else
 			st = _PyUnicode_AsString(value);
-			IDP_ResizeArray(prop, strlen(st)+1);
+			IDP_ResizeArray(prop, strlen(st) + 1);
 			strcpy(IDP_Array(prop), st);
 #endif
 
@@ -195,8 +188,8 @@ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject
 
 		case IDP_INT:
 		{
-			int ivalue= PyLong_AsSsize_t(value);
-			if (ivalue==-1 && PyErr_Occurred()) {
+			int ivalue = PyLong_AsSsize_t(value);
+			if (ivalue == -1 && PyErr_Occurred()) {
 				PyErr_SetString(PyExc_TypeError, "expected an int type");
 				return -1;
 			}
@@ -205,22 +198,22 @@ static int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject
 		}
 		case IDP_FLOAT:
 		{
-			float fvalue= (float)PyFloat_AsDouble(value);
-			if (fvalue==-1 && PyErr_Occurred()) {
+			float fvalue = (float)PyFloat_AsDouble(value);
+			if (fvalue == -1 && PyErr_Occurred()) {
 				PyErr_SetString(PyExc_TypeError, "expected a float");
 				return -1;
 			}
-			*(float*)&self->prop->data.val = fvalue;
+			*(float *)&self->prop->data.val = fvalue;
 			break;
 		}
 		case IDP_DOUBLE:
 		{
-			double dvalue= PyFloat_AsDouble(value);
-			if (dvalue==-1 && PyErr_Occurred()) {
+			double dvalue = PyFloat_AsDouble(value);
+			if (dvalue == -1 && PyErr_Occurred()) {
 				PyErr_SetString(PyExc_TypeError, "expected a float");
 				return -1;
 			}
-			*(double*)&self->prop->data.val = dvalue;
+			*(double *)&self->prop->data.val = dvalue;
 			break;
 		}
 		default:
@@ -266,7 +259,7 @@ static PyObject *BPy_IDGroup_GetType(BPy_IDProperty *self)
 
 static PyGetSetDef BPy_IDGroup_getseters[] = {
 	{(char *)"name", (getter)BPy_IDGroup_GetName, (setter)BPy_IDGroup_SetName, (char *)"The name of this Group.", NULL},
-	 {NULL, NULL, NULL, NULL, NULL}
+	{NULL, NULL, NULL, NULL, NULL}
 };
 
 static Py_ssize_t BPy_IDGroup_Map_Len(BPy_IDProperty *self)
@@ -289,16 +282,16 @@ static PyObject *BPy_IDGroup_Map_GetItem(BPy_IDProperty *self, PyObject *item)
 		return NULL;
 	}
 
-	name= _PyUnicode_AsString(item);
+	name = _PyUnicode_AsString(item);
 
 	if (name == NULL) {
 		PyErr_SetString(PyExc_TypeError, "only strings are allowed as keys of ID properties");
 		return NULL;
 	}
 
-	idprop= IDP_GetPropertyFromGroup(self->prop, name);
+	idprop = IDP_GetPropertyFromGroup(self->prop, name);
 
-	if (idprop==NULL) {
+	if (idprop == NULL) {
 		PyErr_SetString(PyExc_KeyError, "key not in subgroup dict");
 		return NULL;
 	}
@@ -306,21 +299,21 @@ static PyObject *BPy_IDGroup_Map_GetItem(BPy_IDProperty *self, PyObject *item)
 	return BPy_IDGroup_WrapData(self->id, idprop, self->prop);
 }
 
-/*returns NULL on success, error string on failure*/
+/* returns NULL on success, error string on failure */
 static int idp_sequence_type(PyObject *seq)
 {
 	PyObject *item;
-	int type= IDP_INT;
+	int type = IDP_INT;
 
 	Py_ssize_t i, len = PySequence_Size(seq);
-	for (i=0; i < len; i++) {
+	for (i = 0; i < len; i++) {
 		item = PySequence_GetItem(seq, i);
 		if (PyFloat_Check(item)) {
 			if (type == IDP_IDPARRAY) { /* mixed dict/int */
 				Py_DECREF(item);
 				return -1;
 			}
-			type= IDP_DOUBLE;
+			type = IDP_DOUBLE;
 		}
 		else if (PyLong_Check(item)) {
 			if (type == IDP_IDPARRAY) { /* mixed dict/int */
@@ -333,7 +326,7 @@ static int idp_sequence_type(PyObject *seq)
 				Py_DECREF(item);
 				return -1;
 			}
-			type= IDP_IDPARRAY;
+			type = IDP_IDPARRAY;
 		}
 		else {
 			Py_XDECREF(item);
@@ -353,7 +346,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
 	IDProperty *prop = NULL;
 	IDPropertyTemplate val = {0};
 
-	const char *name= "";
+	const char *name = "";
 
 	if (name_obj) {
 		Py_ssize_t name_size;
@@ -373,7 +366,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
 	}
 	else if (PyUnicode_Check(ob)) {
 #ifdef USE_STRING_COERCE
-		PyObject *value_coerce= NULL;
+		PyObject *value_coerce = NULL;
 		val.string.str = (char *)PyC_UnicodeAsByte(ob, &value_coerce);
 		val.string.subtype = IDP_STRING_SUB_UTF8;
 		prop = IDP_New(IDP_STRING, &val, name);
@@ -384,56 +377,56 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
 #endif
 	}
 	else if (PyBytes_Check(ob)) {
-		val.string.str= PyBytes_AS_STRING(ob);
-		val.string.len= PyBytes_GET_SIZE(ob);
-		val.string.subtype= IDP_STRING_SUB_BYTE;
+		val.string.str = PyBytes_AS_STRING(ob);
+		val.string.len = PyBytes_GET_SIZE(ob);
+		val.string.subtype = IDP_STRING_SUB_BYTE;
 
 		prop = IDP_New(IDP_STRING, &val, name);
 		//prop = IDP_NewString(PyBytes_AS_STRING(ob), name, PyBytes_GET_SIZE(ob));
-		//prop->subtype= IDP_STRING_SUB_BYTE;
+		//prop->subtype = IDP_STRING_SUB_BYTE;
 	}
 	else if (PySequence_Check(ob)) {
 		PyObject *item;
 		int i;
 
-		if ((val.array.type= idp_sequence_type(ob)) == -1)
+		if ((val.array.type = idp_sequence_type(ob)) == -1)
 			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 */
+		/* 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);
 
 		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);
-				((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);
-			}
-			break;
-		case IDP_IDPARRAY:
-			prop= IDP_NewIDPArray(name);
-			for (i=0; i<val.array.len; i++) {
-				const char *error;
-				item = PySequence_GetItem(ob, i);
-				error= BPy_IDProperty_Map_ValidateAndCreate(NULL, prop, item);
-				Py_DECREF(item);
-
-				if (error)
-					return error;
-			}
-			break;
+			case IDP_DOUBLE:
+				prop = IDP_New(IDP_ARRAY, &val, name);
+				for (i = 0; i < val.array.len; i++) {
+					item = PySequence_GetItem(ob, 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);
+				}
+				break;
+			case IDP_IDPARRAY:
+				prop = IDP_NewIDPArray(name);
+				for (i = 0; i < val.array.len; i++) {
+					const char *error;
+					item = PySequence_GetItem(ob, i);
+					error = BPy_IDProperty_Map_ValidateAndCreate(NULL, prop, item);
+					Py_DECREF(item);
+
+					if (error)
+						return error;
+				}
+				break;
 		}
 	}
 	else if (PyMapping_Check(ob)) {
@@ -443,11 +436,11 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
 		keys = PyMapping_Keys(ob);
 		vals = PyMapping_Values(ob);
 
-		/*we allocate the group first; if we hit any invalid data,
-		  we can delete it easily enough.*/
+		/* we allocate the group first; if we hit any invalid data,
+		 * we can delete it easily enough.*/
 		prop = IDP_New(IDP_GROUP, &val, name);
 		len = PyMapping_Length(ob);
-		for (i=0; i<len; i++) {
+		for (i = 0; i < len; i++) {
 			key = PySequence_GetItem(keys, i);
 			pval = PySequence_GetItem(vals, i);
 			if (!PyUnicode_Check(key)) {
@@ -476,7 +469,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty
 	}
 	else return "invalid property value";
 
-	if (group->type==IDP_IDPARRAY) {
+	if (group->type == IDP_IDPARRAY) {
 		IDP_AppendArray(group, prop);
 		// IDP_FreeProperty(item); // IDP_AppendArray does a shallow copy (memcpy), only free memory
 		MEM_freeN(prop);
@@ -518,7 +511,7 @@ int BPy_Wrap_SetMapItem(IDProperty *prop, PyObject *key, PyObject *val)
 
 		err = BPy_IDProperty_Map_ValidateAndCreate(key, prop, val);
 		if (err) {
-			PyErr_SetString(PyExc_KeyError, err );
+			PyErr_SetString(PyExc_KeyError, err);
 			return -1;
 		}
 
@@ -538,107 +531,107 @@ static PyObject *BPy_IDGroup_iter(BPy_IDProperty *self)
 	iter->mode = IDPROP_ITER_KEYS;
 	iter->cur = self->prop->data.group.first;
 	Py_XINCREF(iter);
-	return (PyObject*) iter;
+	return (PyObject *)iter;
 }
 
 /* for simple, non nested types this is the same as BPy_IDGroup_WrapData */
 static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop)
 {
 	switch (prop->type) {
-	case IDP_STRING:
-		return idprop_py_from_idp_string(prop);
-	case IDP_INT:
-		return idprop_py_from_idp_int(prop);
-	case IDP_FLOAT:
-		return idprop_py_from_idp_float(prop);
-	case IDP_DOUBLE:
-		return idprop_py_from_idp_double(prop);
-	case IDP_ARRAY:
-	{
-		PyObject *seq = PyList_New(prop->len);
-		int i;
-
-		if (!seq) {
-			PyErr_Format(PyExc_RuntimeError,
-			             "%s: IDP_ARRAY: PyList_New(%d) failed",
-			             __func__, prop->len);
-			return NULL;
-		}
-
-		switch (prop->subtype) {
+		case IDP_STRING:
+			return idprop_py_from_idp_string(prop);
+		case IDP_INT:
+			return idprop_py_from_idp_int(prop);
 		case IDP_FLOAT:
-		{
-			float *array= (float*)IDP_Array(prop);
-			for (i=0; i<prop->len; i++) {
-				PyList_SET_ITEM(seq, i, PyFloat_FromDouble(array[i]));
-			}
-			break;
-		}
+			return idprop_py_from_idp_float(prop);
 		case IDP_DOUBLE:
+			return idprop_py_from_idp_double(prop);
+		case IDP_ARRAY:
 		{
-			double *array= (double*)IDP_Array(prop);
-			for (i=0; i<prop->len; i++) {
-				PyList_SET_ITEM(seq, i, PyFloat_FromDouble(array[i]));
-			}
-			break;
-		}
-		case IDP_INT:
-		{
-			int *array= (int*)IDP_Array(prop);
-			for (i=0; i<prop->len; i++) {
-				PyList_SET_ITEM(seq, i, PyLong_FromLong(array[i]));
+			PyObject *seq = PyList_New(prop->len);
+			int i;
+
+			if (!seq) {
+				PyErr_Format(PyExc_RuntimeError,
+				             "%s: IDP_ARRAY: PyList_New(%d) failed",
+				             __func__, prop->len);
+				return NULL;
 			}
-			break;
-		}
-		default:
-			PyErr_Format(PyExc_RuntimeError,
-			             "%s: invalid/corrupt array type '%d'!",
-			             __func__, prop->subtype);
-			Py_DECREF(seq);
-			return NULL;
-		}
 
-		return seq;
-	}
-	case IDP_IDPARRAY:
-	{
-		PyObject *seq = PyList_New(prop->len), *wrap;
-		IDProperty *array= IDP_IDPArray(prop);
-		int i;
+			switch (prop->subtype) {
+				case IDP_FLOAT:
+				{
+					float *array = (float *)IDP_Array(prop);
+					for (i = 0; i < prop->len; i++) {
+						PyList_SET_ITEM(seq, i, PyFloat_FromDouble(array[i]));
+					}
+					break;
+				}
+				case IDP_DOUBLE:
+				{
+					double *array = (double *)IDP_Array(prop);
+					for (i = 0; i < prop->len; i++) {
+						PyList_SET_ITEM(seq, i, PyFloat_FromDouble(array[i]));
+					}
+					break;
+				}
+				case IDP_INT:
+				{
+					int *array = (int *)IDP_Array(prop);
+					for (i = 0; i < prop->len; i++) {
+						PyList_SET_ITEM(seq, i, PyLong_FromLong(array[i]));
+					}
+					break;
+				}
+				default:
+					PyErr_Format(PyExc_RuntimeError,
+					             "%s: invalid/corrupt array type '%d'!",
+					             __func__, prop->subtype);
+					Py_DECREF(seq);
+					return NULL;
+			}
 
-		if (!seq) {
-			PyErr_Format(PyExc_RuntimeError,
-			             "%s: IDP_IDPARRAY: PyList_New(%d) failed",
-			             __func__, prop->len);
-			return NULL;
+			return seq;
 		}
+		case IDP_IDPARRAY:
+		{
+			PyObject *seq = PyList_New(prop->len), *wrap;
+			IDProperty *array = IDP_IDPArray(prop);
+			int i;
+
+			if (!seq) {
+				PyErr_Format(PyExc_RuntimeError,
+				             "%s: IDP_IDPARRAY: PyList_New(%d) failed",
+				             __func__, prop->len);
+				return NULL;
+			}
 
-		for (i=0; i<prop->len; i++) {
-			wrap= BPy_IDGroup_MapDataToPy(array++);
+			for (i = 0; i < prop->len; i++) {
+				wrap = BPy_IDGroup_MapDataToPy(array++);
 
-			if (!wrap) /* BPy_IDGroup_MapDataToPy sets the error */
-				return NULL;
+				if (!wrap) /* BPy_IDGroup_MapDataToPy sets the error */
+					return NULL;
 
-			PyList_SET_ITEM(seq, i, wrap);
+				PyList_SET_ITEM(seq, i, wrap);
+			}
+			return seq;
 		}
-		return seq;
-	}
-	case IDP_GROUP:
-	{
-		PyObject *dict = PyDict_New(), *wrap;
-		IDProperty *loop;
+		case IDP_GROUP:
+		{
+			PyObject *dict = PyDict_New(), *wrap;
+			IDProperty *loop;
 
-		for (loop=prop->data.group.first; loop; loop=loop->next) {
-			wrap = BPy_IDGroup_MapDataToPy(loop);
+			for (loop = prop->data.group.first; loop; loop = loop->next) {
+				wrap = BPy_IDGroup_MapDataToPy(loop);
 
-			if (!wrap) /* BPy_IDGroup_MapDataToPy sets the error */
-				return NULL;
+				if (!wrap) /* BPy_IDGroup_MapDataToPy sets the error */
+					return NULL;
 
-			PyDict_SetItemString(dict, loop->name, wrap);
-			Py_DECREF(wrap);
+				PyDict_SetItemString(dict, loop->name, wrap);
+				Py_DECREF(wrap);
+			}
+			return dict;
 		}
-		return dict;
-	}
 	}
 
 	PyErr_Format(PyExc_RuntimeError,
@@ -660,15 +653,15 @@ static PyObject *BPy_IDGroup_Pop(BPy_IDProperty *self, PyObject *value)
 		return NULL;
 	}
 
-	idprop= IDP_GetPropertyFromGroup(self->prop, name);
+	idprop = IDP_GetPropertyFromGroup(self->prop, name);
 
 	if (idprop) {
 		pyform = BPy_IDGroup_MapDataToPy(idprop);
 
 		if (!pyform) {
-			/*ok something bad happened with the pyobject,
-			  so don't remove the prop from the group.  if pyform is
-			  NULL, then it already should have raised an exception.*/
+			/* ok something bad happened with the pyobject,
+			 * so don't remove the prop from the group.  if pyform is
+			 * NULL, then it already should have raised an exception.*/
 			return NULL;
 		}
 
@@ -687,7 +680,7 @@ static PyObject *BPy_IDGroup_IterItems(BPy_IDProperty *self)
 	iter->mode = IDPROP_ITER_ITEMS;
 	iter->cur = self->prop->data.group.first;
 	Py_XINCREF(iter);
-	return (PyObject*) iter;
+	return (PyObject *)iter;
 }
 
 /* utility function */
@@ -698,7 +691,7 @@ static void BPy_IDGroup_CorrectListLen(IDProperty *prop, PyObject *seq, int len,
 	printf("%s: ID Property Error found and corrected!\n", func);
 
 	/*fill rest of list with valid references to None*/
-	for (j=len; j<prop->len; j++) {
+	for (j = len; j < prop->len; j++) {
 		Py_INCREF(Py_None);
 		PyList_SET_ITEM(seq, j, Py_None);
 	}
@@ -713,11 +706,13 @@ PyObject *BPy_Wrap_GetKeys(IDProperty *prop)
 	IDProperty *loop;
 	int i;
 
-	for (i=0, loop=prop->data.group.first; loop && (i < prop->len); loop=loop->next, i++)
+	for (i = 0, loop = prop->data.group.first; loop && (i < prop->len); loop = loop->next, i++)
 		PyList_SET_ITEM(list, i, PyUnicode_FromString(loop->name));
 
 	/* if the id prop is corrupt, count the remaining */
-	for (; loop; loop=loop->next, i++) {}
+	for ( ; loop; loop = loop->next, i++) {
+		/* pass */
+	}
 
 	if (i != prop->len) { /* if the loop didnt finish, we know the length is wrong */
 		BPy_IDGroup_CorrectListLen(prop, list, i, __func__);
@@ -735,7 +730,7 @@ PyObject *BPy_Wrap_GetValues(ID *id, IDProperty *prop)
 	IDProperty *loop;
 	int i;
 
-	for (i=0, loop=prop->data.group.first; loop; loop=loop->next, i++) {
+	for (i = 0, loop = prop->data.group.first; loop; loop = loop->next, i++) {
 		PyList_SET_ITEM(list, i, BPy_IDGroup_WrapData(id, loop, prop));
 	}
 
@@ -755,8 +750,8 @@ PyObject *BPy_Wrap_GetItems(ID *id, IDProperty *prop)
 	IDProperty *loop;
 	int i;
 
-	for (i=0, loop=prop->data.group.first; loop; loop=loop->next, i++) {
-		PyObject *item= PyTuple_New(2);
+	for (i = 0, loop = prop->data.group.first; loop; loop = loop->next, i++) {
+		PyObject *item = PyTuple_New(2);
 		PyTuple_SET_ITEM(item, 0, PyUnicode_FromString(loop->name));
 		PyTuple_SET_ITEM(item, 1, BPy_IDGroup_WrapData(id, loop, prop));
 		PyList_SET_ITEM(seq, i, item);
@@ -799,13 +794,13 @@ static int BPy_IDGroup_Contains(BPy_IDProperty *self, PyObject *value)
 		return -1;
 	}
 
-	return IDP_GetPropertyFromGroup(self->prop, name) ? 1:0;
+	return IDP_GetPropertyFromGroup(self->prop, name) ? 1 : 0;
 }
 
 static PyObject *BPy_IDGroup_Update(BPy_IDProperty *self, PyObject *value)
 {
 	PyObject *pkey, *pval;
-	Py_ssize_t i=0;
+	Py_ssize_t i = 0;
 
 	if (!PyDict_Check(value)) {
 		PyErr_Format(PyExc_TypeError,
@@ -829,18 +824,18 @@ static PyObject *BPy_IDGroup_to_dict(BPy_IDProperty *self)
 
 
 /* Matches python dict.get(key, [default]) */
-static PyObject* BPy_IDGroup_Get(BPy_IDProperty *self, PyObject *args)
+static PyObject *BPy_IDGroup_Get(BPy_IDProperty *self, PyObject *args)
 {
 	IDProperty *idprop;
 	char *key;
-	PyObject* def = Py_None;
+	PyObject *def = Py_None;
 
 	if (!PyArg_ParseTuple(args, "s|O:get", &key, &def))
 		return NULL;
 
-	idprop= IDP_GetPropertyFromGroup(self->prop, key);
+	idprop = IDP_GetPropertyFromGroup(self->prop, key);
 	if (idprop) {
-		PyObject* pyobj = BPy_IDGroup_WrapData(self->id, idprop, self->prop);
+		PyObject *pyobj = BPy_IDGroup_WrapData(self->id, idprop, self->prop);
 		if (pyobj)
 			return pyobj;
 	}
@@ -851,64 +846,64 @@ static PyObject* BPy_IDGroup_Get(BPy_IDProperty *self, PyObject *args)
 
 static struct PyMethodDef BPy_IDGroup_methods[] = {
 	{"pop", (PyCFunction)BPy_IDGroup_Pop, METH_O,
-		"pop an item from the group; raises KeyError if the item doesn't exist"},
+	 "pop an item from the group; raises KeyError if the item doesn't exist"},
 	{"iteritems", (PyCFunction)BPy_IDGroup_IterItems, METH_NOARGS,
-		"iterate through the items in the dict; behaves like dictionary method iteritems"},
+	 "iterate through the items in the dict; behaves like dictionary method iteritems"},
 	{"keys", (PyCFunction)BPy_IDGroup_GetKeys, METH_NOARGS,
-		"get the keys associated with this group as a list of strings"},
+	 "get the keys associated with this group as a list of strings"},
 	{"values", (PyCFunction)BPy_IDGroup_GetValues, METH_NOARGS,
-		"get the values associated with this group"},
+	 "get the values associated with this group"},
 	{"items", (PyCFunction)BPy_IDGroup_GetItems, METH_NOARGS,
-		"get the items associated with this group"},
+	 "get the items associated with this group"},
 	{"update", (PyCFunction)BPy_IDGroup_Update, METH_O,
-		"updates the values in the group with the values of another or a dict"},
+	 "updates the values in the group with the values of another or a dict"},
 	{"get", (PyCFunction)BPy_IDGroup_Get, METH_VARARGS,
-		"idprop.get(k[,d]) -> idprop[k] if k in idprop, else d.  d defaults to None"},
+	 "idprop.get(k[,d]) -> idprop[k] if k in idprop, else d.  d defaults to None"},
 	{"to_dict", (PyCFunction)BPy_IDGroup_to_dict, METH_NOARGS,
-		"return a purely python version of the group"},
+	 "return a purely python version of the group"},
 	{NULL, NULL, 0, NULL}
 };
 
 static PySequenceMethods BPy_IDGroup_Seq = {
-	(lenfunc) BPy_IDGroup_Map_Len,		/* lenfunc sq_length */
-	NULL,								/* binaryfunc sq_concat */
-	NULL,								/* ssizeargfunc sq_repeat */
-	NULL,								/* ssizeargfunc sq_item */ /* TODO - setting this will allow PySequence_Check to return True */
-	NULL,								/* intintargfunc ***was_sq_slice*** */
-	NULL,								/* intobjargproc sq_ass_item */
-	NULL,								/* ssizeobjargproc ***was_sq_ass_slice*** */
-	(objobjproc) BPy_IDGroup_Contains,	/* objobjproc sq_contains */
-	NULL,								/* binaryfunc sq_inplace_concat */
-	NULL,								/* ssizeargfunc sq_inplace_repeat */
+	(lenfunc) BPy_IDGroup_Map_Len,      /* lenfunc sq_length */
+	NULL,                               /* binaryfunc sq_concat */
+	NULL,                               /* ssizeargfunc sq_repeat */
+	NULL,                               /* ssizeargfunc sq_item */ /* TODO - setting this will allow PySequence_Check to return True */
+	NULL,                               /* intintargfunc ***was_sq_slice*** */
+	NULL,                               /* intobjargproc sq_ass_item */
+	NULL,                               /* ssizeobjargproc ***was_sq_ass_slice*** */
+	(objobjproc) BPy_IDGroup_Contains,  /* objobjproc sq_contains */
+	NULL,                               /* binaryfunc sq_inplace_concat */
+	NULL,                               /* ssizeargfunc sq_inplace_repeat */
 };
 
 static PyMappingMethods BPy_IDGroup_Mapping = {
-	(lenfunc)BPy_IDGroup_Map_Len, 		/*inquiry mp_length */
-	(binaryfunc)BPy_IDGroup_Map_GetItem,/*binaryfunc mp_subscript */
-	(objobjargproc)BPy_IDGroup_Map_SetItem,	/*objobjargproc mp_ass_subscript */
+	(lenfunc)BPy_IDGroup_Map_Len,           /*inquiry mp_length */
+	(binaryfunc)BPy_IDGroup_Map_GetItem,    /*binaryfunc mp_subscript */
+	(objobjargproc)BPy_IDGroup_Map_SetItem, /*objobjargproc mp_ass_subscript */
 };
 
 PyTypeObject BPy_IDGroup_Type = {
 	PyVarObject_HEAD_INIT(NULL, 0)
 	/*  For printing, in format "<module>.<name>" */
-	"Blender IDProperty",		/* char *tp_name; */
-	sizeof(BPy_IDProperty),		/* int tp_basicsize; */
+	"IDPropertyGroup",       /* char *tp_name; */
+	sizeof(BPy_IDProperty),     /* int tp_basicsize; */
 	0,                          /* tp_itemsize;  For allocation */
 
 	/* Methods to implement standard operations */
 
-	NULL,						/* destructor tp_dealloc; */
+	NULL,                       /* destructor tp_dealloc; */
 	NULL,                       /* printfunc tp_print; */
-	NULL,     /* getattrfunc tp_getattr; */
-	NULL,     /* setattrfunc tp_setattr; */
+	NULL,                       /* getattrfunc tp_getattr; */
+	NULL,                       /* setattrfunc tp_setattr; */
 	NULL,                       /* cmpfunc tp_compare; */
 	(reprfunc)BPy_IDGroup_repr,     /* reprfunc tp_repr; */
 
 	/* Method suites for standard classes */
 
 	NULL,                       /* PyNumberMethods *tp_as_number; */
-	&BPy_IDGroup_Seq,			/* PySequenceMethods *tp_as_sequence; */
-	&BPy_IDGroup_Mapping,		/* PyMappingMethods *tp_as_mapping; */
+	&BPy_IDGroup_Seq,           /* PySequenceMethods *tp_as_sequence; */
+	&BPy_IDGroup_Mapping,       /* PyMappingMethods *tp_as_mapping; */
 
 	/* More standard operations (here for binary compatibility) */
 
@@ -921,29 +916,29 @@ PyTypeObject BPy_IDGroup_Type = {
 	/* Functions to access object as input/output buffer */
 	NULL,                       /* PyBufferProcs *tp_as_buffer; */
 
-  /*** Flags to define presence of optional/expanded features ***/
+	/*** Flags to define presence of optional/expanded features ***/
 	Py_TPFLAGS_DEFAULT,         /* long tp_flags; */
 
 	NULL,                       /*  char *tp_doc;  Documentation string */
-  /*** Assigned meaning in release 2.0 ***/
+	/*** Assigned meaning in release 2.0 ***/
 	/* call function for all accessible objects */
 	NULL,                       /* traverseproc tp_traverse; */
 
 	/* delete references to contained objects */
 	NULL,                       /* inquiry tp_clear; */
 
-  /***  Assigned meaning in release 2.1 ***/
-  /*** rich comparisons ***/
+	/***  Assigned meaning in release 2.1 ***/
+	/*** rich comparisons ***/
 	NULL,                       /* richcmpfunc tp_richcompare; */
 
-  /***  weak reference enabler ***/
+	/***  weak reference enabler ***/
 	0,                          /* long tp_weaklistoffset; */
 
-  /*** Added in release 2.2 ***/
+	/*** Added in release 2.2 ***/
 	/*   Iterators */
 	(getiterfunc)BPy_IDGroup_iter, /* getiterfunc tp_iter; */
 	NULL,                       /* iternextfunc tp_iternext; */
-  /*** Attribute descriptor and subclassing stuff ***/
+	/*** Attribute descriptor and subclassing stuff ***/
 	BPy_IDGroup_methods,        /* struct PyMethodDef *tp_methods; */
 	NULL,                       /* struct PyMemberDef *tp_members; */
 	BPy_IDGroup_getseters,       /* struct PyGetSetDef *tp_getset; */
@@ -955,17 +950,17 @@ static PyTypeObject *idp_array_py_type(BPy_IDArray *self, short *is_double)
 {
 	switch (self->prop->subtype) {
 		case IDP_FLOAT:
-			*is_double= 0;
+			*is_double = 0;
 			return &PyFloat_Type;
 		case IDP_DOUBLE:
-			*is_double= 1;
+			*is_double = 1;
 			return &PyFloat_Type;
 		case IDP_INT:
-			*is_double= 0;
+			*is_double = 0;
 			return &PyLong_Type;
 	}
 
-	*is_double= 0;
+	*is_double = 0;
 	return NULL;
 }
 
@@ -977,12 +972,9 @@ static PyObject *BPy_IDArray_repr(BPy_IDArray *self)
 static PyObject *BPy_IDArray_GetType(BPy_IDArray *self)
 {
 	switch (self->prop->subtype) {
-	case IDP_FLOAT:
-		return PyUnicode_FromString("f");
-	case IDP_DOUBLE:
-		return PyUnicode_FromString("d");
-	case IDP_INT:
-		return PyUnicode_FromString("i");
+		case IDP_FLOAT:  return PyUnicode_FromString("f");
+		case IDP_DOUBLE: return PyUnicode_FromString("d");
+		case IDP_INT:    return PyUnicode_FromString("i");
 	}
 
 	PyErr_Format(PyExc_RuntimeError,
@@ -993,7 +985,7 @@ static PyObject *BPy_IDArray_GetType(BPy_IDArray *self)
 }
 
 static PyGetSetDef BPy_IDArray_getseters[] = {
-    /* matches pythons array.typecode */
+	/* matches pythons array.typecode */
 	{(char *)"typecode", (getter)BPy_IDArray_GetType, (setter)NULL, (char *)"The type of the data in the array, is an int.", NULL},
 	{NULL, NULL, NULL, NULL, NULL},
 };
@@ -1005,7 +997,7 @@ static PyObject *BPy_IDArray_to_list(BPy_IDArray *self)
 
 static PyMethodDef BPy_IDArray_methods[] = {
 	{"to_list", (PyCFunction)BPy_IDArray_to_list, METH_NOARGS,
-		"return the array as a list"},
+	 "return the array as a list"},
 	{NULL, NULL, 0, NULL}
 };
 
@@ -1023,11 +1015,11 @@ static PyObject *BPy_IDArray_GetItem(BPy_IDArray *self, int index)
 
 	switch (self->prop->subtype) {
 		case IDP_FLOAT:
-			return PyFloat_FromDouble(((float*)IDP_Array(self->prop))[index]);
+			return PyFloat_FromDouble(((float *)IDP_Array(self->prop))[index]);
 		case IDP_DOUBLE:
-			return PyFloat_FromDouble(((double*)IDP_Array(self->prop))[index]);
+			return PyFloat_FromDouble(((double *)IDP_Array(self->prop))[index]);
 		case IDP_INT:
-			return PyLong_FromLong((long)((int*)IDP_Array(self->prop))[index]);
+			return PyLong_FromLong((long)((int *)IDP_Array(self->prop))[index]);
 	}
 
 	PyErr_Format(PyExc_RuntimeError,
@@ -1050,46 +1042,46 @@ static int BPy_IDArray_SetItem(BPy_IDArray *self, int index, PyObject *value)
 
 	switch (self->prop->subtype) {
 		case IDP_FLOAT:
-			f= (float)PyFloat_AsDouble(value);
-			if (f==-1 && PyErr_Occurred()) {
+			f = (float)PyFloat_AsDouble(value);
+			if (f == -1 && PyErr_Occurred()) {
 				PyErr_SetString(PyExc_TypeError, "expected a float");
 				return -1;
 			}
-			((float*)IDP_Array(self->prop))[index] = f;
+			((float *)IDP_Array(self->prop))[index] = f;
 			break;
 		case IDP_DOUBLE:
-			d= PyFloat_AsDouble(value);
-			if (d==-1 && PyErr_Occurred()) {
+			d = PyFloat_AsDouble(value);
+			if (d == -1 && PyErr_Occurred()) {
 				PyErr_SetString(PyExc_TypeError, "expected a float");
 				return -1;
 			}
-			((double*)IDP_Array(self->prop))[index] = d;
+			((double *)IDP_Array(self->prop))[index] = d;
 			break;
 		case IDP_INT:
-			i= PyLong_AsSsize_t(value);
-			if (i==-1 && PyErr_Occurred()) {
+			i = PyLong_AsSsize_t(value);
+			if (i == -1 && PyErr_Occurred()) {
 				PyErr_SetString(PyExc_TypeError, "expected an int type");
 				return -1;
 			}
 
-			((int*)IDP_Array(self->prop))[index] = i;
+			((int *)IDP_Array(self->prop))[index] = i;
 			break;
 	}
 	return 0;
 }
 
 static PySequenceMethods BPy_IDArray_Seq = {
-	(lenfunc) BPy_IDArray_Len,			/* inquiry sq_length */
-	NULL,								/* binaryfunc sq_concat */
-	NULL,								/* intargfunc sq_repeat */
-	(ssizeargfunc)BPy_IDArray_GetItem,	/* intargfunc sq_item */
-	NULL,								/* intintargfunc sq_slice */
-	(ssizeobjargproc)BPy_IDArray_SetItem,/* intobjargproc sq_ass_item */
-	NULL,								/* intintobjargproc sq_ass_slice */
-	NULL,								/* objobjproc sq_contains */
-				/* Added in release 2.0 */
-	NULL,								/* binaryfunc sq_inplace_concat */
-	NULL,								/* intargfunc sq_inplace_repeat */
+	(lenfunc) BPy_IDArray_Len,          /* inquiry sq_length */
+	NULL,                               /* binaryfunc sq_concat */
+	NULL,                               /* intargfunc sq_repeat */
+	(ssizeargfunc)BPy_IDArray_GetItem,  /* intargfunc sq_item */
+	NULL,                               /* intintargfunc sq_slice */
+	(ssizeobjargproc)BPy_IDArray_SetItem, /* intobjargproc sq_ass_item */
+	NULL,                               /* intintobjargproc sq_ass_slice */
+	NULL,                               /* objobjproc sq_contains */
+	/* Added in release 2.0 */
+	NULL,                               /* binaryfunc sq_inplace_concat */
+	NULL,                               /* intargfunc sq_inplace_repeat */
 };
 
 
@@ -1097,21 +1089,21 @@ static PySequenceMethods BPy_IDArray_Seq = {
 /* sequence slice (get): idparr[a:b] */
 static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end)
 {
-	IDProperty *prop= self->prop;
+	IDProperty *prop = self->prop;
 	PyObject *tuple;
 	int count;
 
 	CLAMP(begin, 0, prop->len);
-	if (end<0) end= prop->len+end+1;
+	if (end < 0) end = prop->len + end + 1;
 	CLAMP(end, 0, prop->len);
-	begin= MIN2(begin, end);
+	begin = MIN2(begin, end);
 
-	tuple= PyTuple_New(end - begin);
+	tuple = PyTuple_New(end - begin);
 
 	switch (prop->subtype) {
 		case IDP_FLOAT:
 		{
-			float *array= (float*)IDP_Array(prop);
+			float *array = (float *)IDP_Array(prop);
 			for (count = begin; count < end; count++) {
 				PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(array[count]));
 			}
@@ -1119,7 +1111,7 @@ static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end)
 		}
 		case IDP_DOUBLE:
 		{
-			double *array= (double*)IDP_Array(prop);
+			double *array = (double *)IDP_Array(prop);
 			for (count = begin; count < end; count++) {
 				PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(array[count]));
 			}
@@ -1127,7 +1119,7 @@ static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end)
 		}
 		case IDP_INT:
 		{
-			int *array= (int*)IDP_Array(prop);
+			int *array = (int *)IDP_Array(prop);
 			for (count = begin; count < end; count++) {
 				PyTuple_SET_ITEM(tuple, count - begin, PyLong_FromLong(array[count]));
 			}
@@ -1140,10 +1132,10 @@ static PyObject *BPy_IDArray_slice(BPy_IDArray *self, int begin, int end)
 /* sequence slice (set): idparr[a:b] = value */
 static int BPy_IDArray_ass_slice(BPy_IDArray *self, int begin, int end, PyObject *seq)
 {
-	IDProperty *prop= self->prop;
-	short is_double= 0;
-	const PyTypeObject *py_type= idp_array_py_type(self, &is_double);
-	const size_t elem_size= is_double ? sizeof(double) : sizeof(float);
+	IDProperty *prop = self->prop;
+	short is_double = 0;
+	const PyTypeObject *py_type = idp_array_py_type(self, &is_double);
+	const size_t elem_size = is_double ? sizeof(double) : sizeof(float);
 	size_t alloc_len;
 	size_t size;
 	void *vec;
@@ -1153,9 +1145,9 @@ static int BPy_IDArray_ass_slice(BPy_IDArray *self, int begin, int end, PyObject
 	begin = MIN2(begin, end);
 
 	size = (end - begin);
-	alloc_len= size * elem_size;
+	alloc_len = size * elem_size;
 
-	vec= MEM_mallocN(alloc_len, "array assignment"); /* NOTE: we count on int/float being the same size here */
+	vec = MEM_mallocN(alloc_len, "array assignment"); /* NOTE: we count on int/float being the same size here */
 	if (PyC_AsArray(vec, seq, size, py_type, is_double, "slice assignment: ") == -1) {
 		MEM_freeN(vec);
 		return -1;
@@ -1167,7 +1159,7 @@ static int BPy_IDArray_ass_slice(BPy_IDArray *self, int begin, int end, PyObject
 	return 0;
 }
 
-static PyObject *BPy_IDArray_subscript(BPy_IDArray* self, PyObject* item)
+static PyObject *BPy_IDArray_subscript(BPy_IDArray *self, PyObject *item)
 {
 	if (PyIndex_Check(item)) {
 		Py_ssize_t i;
@@ -1203,7 +1195,7 @@ static PyObject *BPy_IDArray_subscript(BPy_IDArray* self, PyObject* item)
 	}
 }
 
-static int BPy_IDArray_ass_subscript(BPy_IDArray* self, PyObject* item, PyObject* value)
+static int BPy_IDArray_ass_subscript(BPy_IDArray *self, PyObject *item, PyObject *value)
 {
 	if (PyIndex_Check(item)) {
 		Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
@@ -1244,13 +1236,13 @@ static PyMappingMethods BPy_IDArray_AsMapping = {
 PyTypeObject BPy_IDArray_Type = {
 	PyVarObject_HEAD_INIT(NULL, 0)
 	/*  For printing, in format "<module>.<name>" */
-	"Blender IDArray",           /* char *tp_name; */
+	"IDPropertyArray",           /* char *tp_name; */
 	sizeof(BPy_IDArray),       /* int tp_basicsize; */
 	0,                          /* tp_itemsize;  For allocation */
 
 	/* Methods to implement standard operations */
 
-	NULL,						/* destructor tp_dealloc; */
+	NULL,                       /* destructor tp_dealloc; */
 	NULL,                       /* printfunc tp_print; */
 	NULL,     /* getattrfunc tp_getattr; */
 	NULL,     /* setattrfunc tp_setattr; */
@@ -1260,12 +1252,12 @@ PyTypeObject BPy_IDArray_Type = {
 	/* Method suites for standard classes */
 
 	NULL,                       /* PyNumberMethods *tp_as_number; */
-	&BPy_IDArray_Seq,   		/* PySequenceMethods *tp_as_sequence; */
+	&BPy_IDArray_Seq,           /* PySequenceMethods *tp_as_sequence; */
 	&BPy_IDArray_AsMapping,     /* PyMappingMethods *tp_as_mapping; */
 
 	/* More standard operations (here for binary compatibility) */
 
-	NULL,						/* hashfunc tp_hash; */
+	NULL,                       /* hashfunc tp_hash; */
 	NULL,                       /* ternaryfunc tp_call; */
 	NULL,                       /* reprfunc tp_str; */
 	NULL,                       /* getattrofunc tp_getattro; */
@@ -1274,31 +1266,31 @@ PyTypeObject BPy_IDArray_Type = {
 	/* Functions to access object as input/output buffer */
 	NULL,                       /* PyBufferProcs *tp_as_buffer; */
 
-  /*** Flags to define presence of optional/expanded features ***/
+	/*** Flags to define presence of optional/expanded features ***/
 	Py_TPFLAGS_DEFAULT,         /* long tp_flags; */
 
 	NULL,                       /*  char *tp_doc;  Documentation string */
-  /*** Assigned meaning in release 2.0 ***/
+	/*** Assigned meaning in release 2.0 ***/
 	/* call function for all accessible objects */
 	NULL,                       /* traverseproc tp_traverse; */
 
 	/* delete references to contained objects */
 	NULL,                       /* inquiry tp_clear; */
 
-  /***  Assigned meaning in release 2.1 ***/
-  /*** rich comparisons ***/
+	/***  Assigned meaning in release 2.1 ***/
+	/*** rich comparisons ***/
 	NULL,                       /* richcmpfunc tp_richcompare; */
 
-  /***  weak reference enabler ***/
+	/***  weak reference enabler ***/
 	0,                          /* long tp_weaklistoffset; */
 
-  /*** Added in release 2.2 ***/
+	/*** Added in release 2.2 ***/
 	/*   Iterators */
 	NULL,                       /* getiterfunc tp_iter; */
 	NULL,                       /* iternextfunc tp_iternext; */
 
-  /*** Attribute descriptor and subclassing stuff ***/
-	BPy_IDArray_methods,		/* struct PyMethodDef *tp_methods; */
+	/*** Attribute descriptor and subclassing stuff ***/
+	BPy_IDArray_methods,        /* struct PyMethodDef *tp_methods; */
 	NULL,                       /* struct PyMemberDef *tp_members; */
 	BPy_IDArray_getseters,       /* struct PyGetSetDef *tp_getset; */
 	NULL,                       /* struct _typeobject *tp_base; */
@@ -1324,12 +1316,6 @@ PyTypeObject BPy_IDArray_Type = {
 
 /*********** ID Property Group iterator ********/
 
-static PyObject *IDGroup_Iter_iterself(PyObject *self)
-{
-	Py_XINCREF(self);
-	return self;
-}
-
 static PyObject *IDGroup_Iter_repr(BPy_IDGroup_Iter *self)
 {
 	return PyUnicode_FromFormat("(ID Property Group Iter \"%s\")", self->group->prop->name);
@@ -1337,12 +1323,14 @@ static PyObject *IDGroup_Iter_repr(BPy_IDGroup_Iter *self)
 
 static PyObject *BPy_Group_Iter_Next(BPy_IDGroup_Iter *self)
 {
-	IDProperty *cur=NULL;
-	PyObject *ret;
 
 	if (self->cur) {
+		PyObject *ret;
+		IDProperty *cur;
+
 		cur = self->cur;
 		self->cur = self->cur->next;
+
 		if (self->mode == IDPROP_ITER_ITEMS) {
 			ret = PyTuple_New(2);
 			PyTuple_SET_ITEM(ret, 0, PyUnicode_FromString(cur->name));
@@ -1362,23 +1350,23 @@ static PyObject *BPy_Group_Iter_Next(BPy_IDGroup_Iter *self)
 PyTypeObject BPy_IDGroup_Iter_Type = {
 	PyVarObject_HEAD_INIT(NULL, 0)
 	/*  For printing, in format "<module>.<name>" */
-	"Blender IDGroup_Iter",           /* char *tp_name; */
-	sizeof( BPy_IDGroup_Iter ),       /* int tp_basicsize; */
+	"IDPropertyGroupIter",           /* char *tp_name; */
+	sizeof(BPy_IDGroup_Iter),       /* int tp_basicsize; */
 	0,                          /* tp_itemsize;  For allocation */
 
 	/* Methods to implement standard operations */
 
-	NULL,						/* destructor tp_dealloc; */
+	NULL,                       /* destructor tp_dealloc; */
 	NULL,                       /* printfunc tp_print; */
 	NULL,     /* getattrfunc tp_getattr; */
 	NULL,     /* setattrfunc tp_setattr; */
 	NULL,                       /* cmpfunc tp_compare; */
-	( reprfunc ) IDGroup_Iter_repr,     /* reprfunc tp_repr; */
+	(reprfunc) IDGroup_Iter_repr,     /* reprfunc tp_repr; */
 
 	/* Method suites for standard classes */
 
 	NULL,                       /* PyNumberMethods *tp_as_number; */
-	NULL,						/* PySequenceMethods *tp_as_sequence; */
+	NULL,                       /* PySequenceMethods *tp_as_sequence; */
 	NULL,                       /* PyMappingMethods *tp_as_mapping; */
 
 	/* More standard operations (here for binary compatibility) */
@@ -1392,27 +1380,27 @@ PyTypeObject BPy_IDGroup_Iter_Type = {
 	/* Functions to access object as input/output buffer */
 	NULL,                       /* PyBufferProcs *tp_as_buffer; */
 
-  /*** Flags to define presence of optional/expanded features ***/
+	/*** Flags to define presence of optional/expanded features ***/
 	Py_TPFLAGS_DEFAULT,         /* long tp_flags; */
 
 	NULL,                       /*  char *tp_doc;  Documentation string */
-  /*** Assigned meaning in release 2.0 ***/
+	/*** Assigned meaning in release 2.0 ***/
 	/* call function for all accessible objects */
 	NULL,                       /* traverseproc tp_traverse; */
 
 	/* delete references to contained objects */
 	NULL,                       /* inquiry tp_clear; */
 
-  /***  Assigned meaning in release 2.1 ***/
-  /*** rich comparisons ***/
+	/***  Assigned meaning in release 2.1 ***/
+	/*** rich comparisons ***/
 	NULL,                       /* richcmpfunc tp_richcompare; */
 
-  /***  weak reference enabler ***/
+	/***  weak reference enabler ***/
 	0,                          /* long tp_weaklistoffset; */
 
-  /*** Added in release 2.2 ***/
+	/*** Added in release 2.2 ***/
 	/*   Iterators */
-	IDGroup_Iter_iterself,              /* getiterfunc tp_iter; */
+	PyObject_SelfIter,                  /* getiterfunc tp_iter; */
 	(iternextfunc) BPy_Group_Iter_Next, /* iternextfunc tp_iternext; */
 };
 
@@ -1422,3 +1410,76 @@ void IDProp_Init_Types(void)
 	PyType_Ready(&BPy_IDGroup_Iter_Type);
 	PyType_Ready(&BPy_IDArray_Type);
 }
+
+/*----------------------------MODULE INIT-------------------------*/
+
+/* --- */
+
+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 */
+};
+
+static PyObject *BPyInit_idprop_types(void)
+{
+	PyObject *submodule;
+
+	submodule = PyModule_Create(&IDProp_types_module_def);
+
+#define MODULE_TYPE_ADD(s, t) \
+	PyModule_AddObject(s, t.tp_name, (PyObject *)&t); Py_INCREF((PyObject *)&t)
+
+	/* bmesh_py_types.c */
+	MODULE_TYPE_ADD(submodule, BPy_IDGroup_Type);
+	MODULE_TYPE_ADD(submodule, BPy_IDGroup_Iter_Type);
+	MODULE_TYPE_ADD(submodule, BPy_IDArray_Type);
+
+#undef MODULE_TYPE_ADD
+
+	return submodule;
+}
+
+/* --- */
+
+static PyMethodDef IDProp_methods[] = {
+	{NULL, NULL, 0, NULL}
+};
+
+
+PyDoc_STRVAR(IDProp_module_doc,
+"This module provides access id property types (currently mainly for docs)."
+);
+static struct PyModuleDef IDProp_module_def = {
+	PyModuleDef_HEAD_INIT,
+	"idprop",  /* m_name */
+	IDProp_module_doc,  /* m_doc */
+	0,  /* m_size */
+	IDProp_methods,  /* m_methods */
+	NULL,  /* m_reload */
+	NULL,  /* m_traverse */
+	NULL,  /* m_clear */
+	NULL,  /* m_free */
+};
+
+PyObject *BPyInit_idprop(void)
+{
+	PyObject *mod;
+	PyObject *submodule;
+	PyObject *sys_modules = PyThreadState_GET()->interp->modules;
+
+	mod = PyModule_Create(&IDProp_module_def);
+
+	/* bmesh.types */
+	PyModule_AddObject(mod, "types", (submodule = BPyInit_idprop_types()));
+	PyDict_SetItemString(sys_modules, PyModule_GetName(submodule), submodule);
+	Py_INCREF(submodule);
+
+	return mod;
+}
diff --git a/source/blender/python/generic/idprop_py_api.h b/source/blender/python/generic/idprop_py_api.h
index 599ba8e..99e291f 100644
--- a/source/blender/python/generic/idprop_py_api.h
+++ b/source/blender/python/generic/idprop_py_api.h
@@ -25,8 +25,8 @@
  */
 
 
-#ifndef PY_IDPROP_API_H
-#define PY_IDPROP_API_H
+#ifndef __IDPROP_PY_API_H__
+#define __IDPROP_PY_API_H__
 
 struct ID;
 struct IDProperty;
@@ -34,7 +34,7 @@ struct BPy_IDGroup_Iter;
 
 typedef struct BPy_IDProperty {
 	PyObject_VAR_HEAD
-	struct ID *id;
+	struct ID *id;           /* can be NULL */
 	struct IDProperty *prop; /* must be second member */
 	struct IDProperty *parent;
 	PyObject *data_wrap;
@@ -42,7 +42,7 @@ typedef struct BPy_IDProperty {
 
 typedef struct BPy_IDArray {
 	PyObject_VAR_HEAD
-	struct ID *id;
+	struct ID *id;            /* can be NULL */
 	struct IDProperty *prop;  /* must be second member */
 } BPy_IDArray;
 
@@ -64,7 +64,9 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(PyObject *key, struct IDPropert
 
 void IDProp_Init_Types(void);
 
+PyObject *BPyInit_idprop(void);
+
 #define IDPROP_ITER_KEYS	0
 #define IDPROP_ITER_ITEMS	1
 
-#endif /* PY_IDPROP_API_H */
+#endif /* __IDPROP_PY_API_H__ */
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index ebc9a61..0e51227 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -50,11 +50,11 @@ int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length,
 	Py_ssize_t value_len;
 	Py_ssize_t i;
 
-	if (!(value_fast=PySequence_Fast(value, error_prefix))) {
+	if (!(value_fast = PySequence_Fast(value, error_prefix))) {
 		return -1;
 	}
 
-	value_len= PySequence_Fast_GET_SIZE(value_fast);
+	value_len = PySequence_Fast_GET_SIZE(value_fast);
 
 	if (value_len != length) {
 		Py_DECREF(value);
@@ -67,29 +67,29 @@ int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length,
 	/* for each type */
 	if (type == &PyFloat_Type) {
 		if (is_double) {
-			double *array_double= array;
-			for (i=0; i<length; i++) {
-				array_double[i]= PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value_fast, i));
+			double *array_double = array;
+			for (i = 0; i < length; i++) {
+				array_double[i] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value_fast, i));
 			}
 		}
 		else {
-			float *array_float= array;
-			for (i=0; i<length; i++) {
-				array_float[i]= PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value_fast, i));
+			float *array_float = array;
+			for (i = 0; i < length; i++) {
+				array_float[i] = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value_fast, i));
 			}
 		}
 	}
 	else if (type == &PyLong_Type) {
 		/* 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));
+		int *array_int = array;
+		for (i = 0; i < length; i++) {
+			array_int[i] = PyLong_AsSsize_t(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);
+		int *array_bool = array;
+		for (i = 0; i < length; i++) {
+			array_bool[i] = (PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value_fast, i)) != 0);
 		}
 	}
 	else {
@@ -117,7 +117,7 @@ int PyC_AsArray(void *array, PyObject *value, const Py_ssize_t length,
 void PyC_ObSpit(const char *name, PyObject *var)
 {
 	fprintf(stderr, "<%s> : ", name);
-	if (var==NULL) {
+	if (var == NULL) {
 		fprintf(stderr, "<NIL>");
 	}
 	else {
@@ -156,10 +156,10 @@ void PyC_FileAndNum(const char **filename, int *lineno)
 {
 	PyFrameObject *frame;
 	
-	if (filename)	*filename= NULL;
-	if (lineno)		*lineno = -1;
+	if (filename) *filename = NULL;
+	if (lineno)   *lineno = -1;
 
-	if (!(frame= PyThreadState_GET()->frame)) {
+	if (!(frame = PyThreadState_GET()->frame)) {
 		return;
 	}
 
@@ -172,16 +172,16 @@ void PyC_FileAndNum(const char **filename, int *lineno)
 	if (filename && *filename == NULL) {
 		/* try an alternative method to get the filename - module based
 		 * references below are all borrowed (double checked) */
-		PyObject *mod_name= PyDict_GetItemString(PyEval_GetGlobals(), "__name__");
+		PyObject *mod_name = PyDict_GetItemString(PyEval_GetGlobals(), "__name__");
 		if (mod_name) {
-			PyObject *mod= PyDict_GetItem(PyImport_GetModuleDict(), mod_name);
+			PyObject *mod = PyDict_GetItem(PyImport_GetModuleDict(), mod_name);
 			if (mod) {
-				*filename= PyModule_GetFilename(mod);
+				*filename = PyModule_GetFilename(mod);
 			}
 
 			/* unlikely, fallback */
 			if (*filename == NULL) {
-				*filename= _PyUnicode_AsString(mod_name);
+				*filename = _PyUnicode_AsString(mod_name);
 			}
 		}
 	}
@@ -204,13 +204,13 @@ void PyC_FileAndNum_Safe(const char **filename, int *lineno)
 PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...)
 {
 	Py_ssize_t i;
-	PyObject *item= o;
+	PyObject *item = o;
 	char *attr;
 	
 	va_list vargs;
 
 	va_start(vargs, n);
-	for (i=0; i<n; i++) {
+	for (i = 0; i < n; i++) {
 		attr = va_arg(vargs, char *);
 		item = PyObject_GetAttrString(item, attr);
 		
@@ -228,7 +228,7 @@ PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...)
 
 /* similar to PyErr_Format(),
  *
- * implimentation - we cant actually preprend the existing exception,
+ * implementation - we cant actually preprend the existing exception,
  * because it could have _any_ argiments given to it, so instead we get its
  * __str__ output and raise our own exception including it.
  */
@@ -238,7 +238,7 @@ PyObject *PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *for
 	va_list args;
 
 	va_start(args, format);
-	error_value_prefix= PyUnicode_FromFormatV(format, args); /* can fail and be NULL */
+	error_value_prefix = PyUnicode_FromFormatV(format, args); /* can fail and be NULL */
 	va_end(args);
 
 	if (PyErr_Occurred()) {
@@ -271,22 +271,22 @@ PyObject *PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *for
 
 PyObject *PyC_ExceptionBuffer(void)
 {
-	PyObject *traceback_mod= NULL;
-	PyObject *format_tb_func= NULL;
-	PyObject *ret= NULL;
+	PyObject *traceback_mod = NULL;
+	PyObject *format_tb_func = NULL;
+	PyObject *ret = NULL;
 
-	if (! (traceback_mod= PyImport_ImportModule("traceback")) ) {
+	if (!(traceback_mod = PyImport_ImportModule("traceback"))) {
 		goto error_cleanup;
 	}
-	else if (! (format_tb_func= PyObject_GetAttrString(traceback_mod, "format_exc"))) {
+	else if (!(format_tb_func = PyObject_GetAttrString(traceback_mod, "format_exc"))) {
 		goto error_cleanup;
 	}
 
-	ret= PyObject_CallObject(format_tb_func, NULL);
+	ret = PyObject_CallObject(format_tb_func, NULL);
 
 	if (ret == Py_None) {
 		Py_DECREF(ret);
-		ret= NULL;
+		ret = NULL;
 	}
 
 error_cleanup:
@@ -303,8 +303,8 @@ PyObject *PyC_ExceptionBuffer(void)
 	PyObject *stderr_backup = PySys_GetObject("stderr"); /* borrowed */
 	PyObject *string_io = NULL;
 	PyObject *string_io_buf = NULL;
-	PyObject *string_io_mod= NULL;
-	PyObject *string_io_getvalue= NULL;
+	PyObject *string_io_mod = NULL;
+	PyObject *string_io_getvalue = NULL;
 
 	PyObject *error_type, *error_value, *error_traceback;
 
@@ -319,20 +319,20 @@ PyObject *PyC_ExceptionBuffer(void)
 	 * string_io = io.StringIO()
 	 */
 
-	if (! (string_io_mod= PyImport_ImportModule("io")) ) {
+	if (!(string_io_mod = PyImport_ImportModule("io"))) {
 		goto error_cleanup;
 	}
-	else if (! (string_io = PyObject_CallMethod(string_io_mod, (char *)"StringIO", NULL))) {
+	else if (!(string_io = PyObject_CallMethod(string_io_mod, (char *)"StringIO", NULL))) {
 		goto error_cleanup;
 	}
-	else if (! (string_io_getvalue= PyObject_GetAttrString(string_io, "getvalue"))) {
+	else if (!(string_io_getvalue = PyObject_GetAttrString(string_io, "getvalue"))) {
 		goto error_cleanup;
 	}
 
-	Py_INCREF(stdout_backup); // since these were borrowed we dont want them freed when replaced.
+	Py_INCREF(stdout_backup); // since these were borrowed we don't want them freed when replaced.
 	Py_INCREF(stderr_backup);
 
-	PySys_SetObject("stdout", string_io); // both of these are free'd when restoring
+	PySys_SetObject("stdout", string_io); // both of these are freed when restoring
 	PySys_SetObject("stderr", string_io);
 
 	PyErr_Restore(error_type, error_value, error_traceback);
@@ -374,7 +374,7 @@ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce)
 {
 	const char *result;
 
-	result= _PyUnicode_AsString(py_str);
+	result = _PyUnicode_AsString(py_str);
 
 	if (result) {
 		/* 99% of the time this is enough but we better support non unicode
@@ -387,7 +387,7 @@ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce)
 		if (PyBytes_Check(py_str)) {
 			return PyBytes_AS_STRING(py_str);
 		}
-		else if ((*coerce= PyUnicode_EncodeFSDefault(py_str))) {
+		else if ((*coerce = PyUnicode_EncodeFSDefault(py_str))) {
 			return PyBytes_AS_STRING(*coerce);
 		}
 		else {
@@ -399,7 +399,7 @@ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce)
 
 PyObject *PyC_UnicodeFromByteAndSize(const char *str, Py_ssize_t size)
 {
-    PyObject *result= PyUnicode_FromStringAndSize(str, size);
+	PyObject *result = PyUnicode_FromStringAndSize(str, size);
 	if (result) {
 		/* 99% of the time this is enough but we better support non unicode
 		 * chars since blender doesnt limit this */
@@ -408,7 +408,7 @@ PyObject *PyC_UnicodeFromByteAndSize(const char *str, Py_ssize_t size)
 	else {
 		PyErr_Clear();
 		/* this means paths will always be accessible once converted, on all OS's */
-		result= PyUnicode_DecodeFSDefaultAndSize(str, size);
+		result = PyUnicode_DecodeFSDefaultAndSize(str, size);
 		return result;
 	}
 }
@@ -419,26 +419,28 @@ PyObject *PyC_UnicodeFromByte(const char *str)
 }
 
 /*****************************************************************************
-* Description: This function creates a new Python dictionary object.
-* note: dict is owned by sys.modules["__main__"] module, reference is borrowed
-* note: important we use the dict from __main__, this is what python expects
-  for 'pickle' to work as well as strings like this...
- >> foo = 10
- >> print(__import__("__main__").foo)
-*
-* note: this overwrites __main__ which gives problems with nested calles.
-* be sure to run PyC_MainModule_Backup & PyC_MainModule_Restore if there is
-* any chance that python is in the call stack.
-*****************************************************************************/
+ * Description: This function creates a new Python dictionary object.
+ * note: dict is owned by sys.modules["__main__"] module, reference is borrowed
+ * note: important we use the dict from __main__, this is what python expects
+ *  for 'pickle' to work as well as strings like this...
+ * >> foo = 10
+ * >> print(__import__("__main__").foo)
+ *
+ * note: this overwrites __main__ which gives problems with nested calles.
+ * be sure to run PyC_MainModule_Backup & PyC_MainModule_Restore if there is
+ * any chance that python is in the call stack.
+ ****************************************************************************/
 PyObject *PyC_DefaultNameSpace(const char *filename)
 {
-	PyInterpreterState *interp= PyThreadState_GET()->interp;
-	PyObject *mod_main= PyModule_New("__main__");	
+	PyInterpreterState *interp = PyThreadState_GET()->interp;
+	PyObject *mod_main = PyModule_New("__main__");
 	PyDict_SetItemString(interp->modules, "__main__", mod_main);
 	Py_DECREF(mod_main); /* sys.modules owns now */
 	PyModule_AddStringConstant(mod_main, "__name__", "__main__");
-	if (filename)
-		PyModule_AddStringConstant(mod_main, "__file__", filename); /* __file__ only for nice UI'ness */
+	if (filename) {
+		/* __file__ mainly for nice UI'ness */
+		PyModule_AddObject(mod_main, "__file__", PyUnicode_DecodeFSDefault(filename));
+	}
 	PyModule_AddObject(mod_main, "__builtins__", interp->builtins);
 	Py_INCREF(interp->builtins); /* AddObject steals a reference */
 	return PyModule_GetDict(mod_main);
@@ -447,14 +449,14 @@ PyObject *PyC_DefaultNameSpace(const char *filename)
 /* restore MUST be called after this */
 void PyC_MainModule_Backup(PyObject **main_mod)
 {
-	PyInterpreterState *interp= PyThreadState_GET()->interp;
-	*main_mod= PyDict_GetItemString(interp->modules, "__main__");
-	Py_XINCREF(*main_mod); /* dont free */
+	PyInterpreterState *interp = PyThreadState_GET()->interp;
+	*main_mod = PyDict_GetItemString(interp->modules, "__main__");
+	Py_XINCREF(*main_mod); /* don't free */
 }
 
 void PyC_MainModule_Restore(PyObject *main_mod)
 {
-	PyInterpreterState *interp= PyThreadState_GET()->interp;
+	PyInterpreterState *interp = PyThreadState_GET()->interp;
 	PyDict_SetItemString(interp->modules, "__main__", main_mod);
 	Py_XDECREF(main_mod);
 }
@@ -462,7 +464,7 @@ void PyC_MainModule_Restore(PyObject *main_mod)
 /* must be called before Py_Initialize, expects output of BLI_get_folder(BLENDER_PYTHON, NULL) */
 void PyC_SetHomePath(const char *py_path_bundle)
 {
-	if (py_path_bundle==NULL) {
+	if (py_path_bundle == NULL) {
 		/* Common enough to have bundled *nix python but complain on OSX/Win */
 #if defined(__APPLE__) || defined(_WIN32)
 		fprintf(stderr, "Warning! bundled python not found and is expected on this platform. "
@@ -475,7 +477,7 @@ void PyC_SetHomePath(const char *py_path_bundle)
 
 #ifdef __APPLE__
 	/* OSX allow file/directory names to contain : character (represented as / in the Finder)
-	 but current Python lib (release 3.1.1) doesn't handle these correctly */
+	 * 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");
@@ -483,7 +485,7 @@ void PyC_SetHomePath(const char *py_path_bundle)
 
 #ifdef _WIN32
 	/* cmake/MSVC debug build crashes without this, why only
-	   in this case is unknown.. */
+	 * in this case is unknown.. */
 	{
 		BLI_setenv("PYTHONPATH", py_path_bundle);
 	}
@@ -506,37 +508,37 @@ void PyC_SetHomePath(const char *py_path_bundle)
 /* Would be nice if python had this built in */
 void PyC_RunQuicky(const char *filepath, int n, ...)
 {
-	FILE *fp= fopen(filepath, "r");
+	FILE *fp = fopen(filepath, "r");
 
 	if (fp) {
-		PyGILState_STATE gilstate= PyGILState_Ensure();
+		PyGILState_STATE gilstate = PyGILState_Ensure();
 
 		va_list vargs;	
 
-		int *sizes= PyMem_MALLOC(sizeof(int) * (n / 2));
+		int *sizes = PyMem_MALLOC(sizeof(int) * (n / 2));
 		int i;
 
 		PyObject *py_dict = PyC_DefaultNameSpace(filepath);
-		PyObject *values= PyList_New(n / 2); /* namespace owns this, dont free */
+		PyObject *values = PyList_New(n / 2); /* namespace owns this, don't free */
 
 		PyObject *py_result, *ret;
 
-		PyObject *struct_mod= PyImport_ImportModule("struct");
-		PyObject *calcsize= PyObject_GetAttrString(struct_mod, "calcsize"); /* struct.calcsize */
-		PyObject *pack= PyObject_GetAttrString(struct_mod, "pack"); /* struct.pack */
-		PyObject *unpack= PyObject_GetAttrString(struct_mod, "unpack"); /* struct.unpack */
+		PyObject *struct_mod = PyImport_ImportModule("struct");
+		PyObject *calcsize = PyObject_GetAttrString(struct_mod, "calcsize"); /* struct.calcsize */
+		PyObject *pack = PyObject_GetAttrString(struct_mod, "pack"); /* struct.pack */
+		PyObject *unpack = PyObject_GetAttrString(struct_mod, "unpack"); /* struct.unpack */
 
 		Py_DECREF(struct_mod);
 
 		va_start(vargs, n);
-		for (i=0; i * 2<n; i++) {
+		for (i = 0; i * 2 < n; i++) {
 			char *format = va_arg(vargs, char *);
 			void *ptr = va_arg(vargs, void *);
 
-			ret= PyObject_CallFunction(calcsize, (char *)"s", format);
+			ret = PyObject_CallFunction(calcsize, (char *)"s", format);
 
 			if (ret) {
-				sizes[i]= PyLong_AsSsize_t(ret);
+				sizes[i] = PyLong_AsSsize_t(ret);
 				Py_DECREF(ret);
 				ret = PyObject_CallFunction(unpack, (char *)"sy#", format, (char *)ptr, sizes[i]);
 			}
@@ -549,12 +551,12 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
 				PyList_SET_ITEM(values, i, Py_None); /* hold user */
 				Py_INCREF(Py_None);
 
-				sizes[i]= 0;
+				sizes[i] = 0;
 			}
 			else {
 				if (PyTuple_GET_SIZE(ret) == 1) {
 					/* convenience, convert single tuples into single values */
-					PyObject *tmp= PyTuple_GET_ITEM(ret, 0);
+					PyObject *tmp = PyTuple_GET_ITEM(ret, 0);
 					Py_INCREF(tmp);
 					Py_DECREF(ret);
 					ret = tmp;
@@ -576,29 +578,29 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
 
 			/* we could skip this but then only slice assignment would work
 			 * better not be so strict */
-			values= PyDict_GetItemString(py_dict, "values");
+			values = PyDict_GetItemString(py_dict, "values");
 
 			if (values && PyList_Check(values)) {
 
-				/* dont use the result */
+				/* don't use the result */
 				Py_DECREF(py_result);
-				py_result= NULL;
+				py_result = NULL;
 
 				/* now get the values back */
 				va_start(vargs, n);
-				for (i=0; i*2 <n; i++) {
+				for (i = 0; i * 2 < n; i++) {
 					char *format = va_arg(vargs, char *);
 					void *ptr = va_arg(vargs, void *);
 					
 					PyObject *item;
 					PyObject *item_new;
 					/* prepend the string formatting and remake the tuple */
-					item= PyList_GET_ITEM(values, i);
+					item = PyList_GET_ITEM(values, i);
 					if (PyTuple_CheckExact(item)) {
-						int ofs= PyTuple_GET_SIZE(item);
-						item_new= PyTuple_New(ofs + 1);
+						int ofs = PyTuple_GET_SIZE(item);
+						item_new = PyTuple_New(ofs + 1);
 						while (ofs--) {
-							PyObject *member= PyTuple_GET_ITEM(item, ofs);
+							PyObject *member = PyTuple_GET_ITEM(item, ofs);
 							PyTuple_SET_ITEM(item_new, ofs + 1, member);
 							Py_INCREF(member);
 						}
@@ -606,7 +608,7 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
 						PyTuple_SET_ITEM(item_new, 0, PyUnicode_FromString(format));
 					}
 					else {
-						item_new= Py_BuildValue("sO", format, item);
+						item_new = Py_BuildValue("sO", format, item);
 					}
 
 					ret = PyObject_Call(pack, item_new, NULL);
@@ -646,3 +648,135 @@ void PyC_RunQuicky(const char *filepath, int n, ...)
 		PyGILState_Release(gilstate);
 	}
 }
+
+/* generic function to avoid depending on RNA */
+void *PyC_RNA_AsPointer(PyObject *value, const char *type_name)
+{
+	PyObject *as_pointer;
+	PyObject *pointer;
+
+	if (!strcmp(Py_TYPE(value)->tp_name, type_name) &&
+	    (as_pointer = PyObject_GetAttrString(value, "as_pointer")) != NULL &&
+	    PyCallable_Check(as_pointer))
+	{
+		void *result = NULL;
+
+		/* must be a 'type_name' object */
+		pointer = PyObject_CallObject(as_pointer, NULL);
+		Py_DECREF(as_pointer);
+
+		if (!pointer) {
+			PyErr_SetString(PyExc_SystemError, "value.as_pointer() failed");
+			return NULL;
+		}
+		result = PyLong_AsVoidPtr(pointer);
+		Py_DECREF(pointer);
+		if (!result) {
+			PyErr_SetString(PyExc_SystemError, "value.as_pointer() failed");
+		}
+
+		return result;
+	}
+	else {
+		PyErr_Format(PyExc_TypeError,
+		             "expected '%.200s' type found '%.200s' instead",
+		             type_name, Py_TYPE(value)->tp_name);
+		return NULL;
+	}
+}
+
+
+/* PyC_FlagSet_* functions - so flags/sets can be interchanged in a generic way */
+#include "BLI_dynstr.h"
+#include "MEM_guardedalloc.h"
+
+char *PyC_FlagSet_AsString(PyC_FlagSet *item)
+{
+	DynStr *dynstr = BLI_dynstr_new();
+	PyC_FlagSet *e;
+	char *cstring;
+
+	for (e = item; item->identifier; item++) {
+		BLI_dynstr_appendf(dynstr, (e == item) ? "'%s'" : ", '%s'", item->identifier);
+	}
+
+	cstring = BLI_dynstr_get_cstring(dynstr);
+	BLI_dynstr_free(dynstr);
+	return cstring;
+}
+
+int PyC_FlagSet_ValueFromID_int(PyC_FlagSet *item, const char *identifier, int *value)
+{
+	for ( ; item->identifier; item++) {
+		if (strcmp(item->identifier, identifier) == 0) {
+			*value = item->value;
+			return 1;
+		}
+	}
+
+	return 0;
+}
+
+int PyC_FlagSet_ValueFromID(PyC_FlagSet *item, const char *identifier, int *value, const char *error_prefix)
+{
+	if (PyC_FlagSet_ValueFromID_int(item, identifier, value) == 0) {
+		const char *enum_str = PyC_FlagSet_AsString(item);
+		PyErr_Format(PyExc_ValueError,
+		             "%s: '%.200s' not found in (%s)",
+		             error_prefix, identifier, enum_str);
+		MEM_freeN((void *)enum_str);
+		return -1;
+	}
+
+	return 0;
+}
+
+/* 'value' _must_ be a set type, error check before calling */
+int PyC_FlagSet_ToBitfield(PyC_FlagSet *items, PyObject *value, int *r_value, const char *error_prefix)
+{
+	/* set of enum items, concatenate all values with OR */
+	int ret, flag = 0;
+
+	/* set looping */
+	Py_ssize_t pos = 0;
+	Py_ssize_t hash = 0;
+	PyObject *key;
+
+	*r_value = 0;
+
+	while (_PySet_NextEntry(value, &pos, &key, &hash)) {
+		const char *param = _PyUnicode_AsString(key);
+
+		if (param == NULL) {
+			PyErr_Format(PyExc_TypeError,
+			             "%.200s expected a string, not %.200s",
+			             error_prefix, Py_TYPE(key)->tp_name);
+			return -1;
+		}
+
+		if (PyC_FlagSet_ValueFromID(items, param, &ret, error_prefix) < 0) {
+			return -1;
+		}
+
+		flag |= ret;
+	}
+
+	*r_value = flag;
+	return 0;
+}
+
+PyObject *PyC_FlagSet_FromBitfield(PyC_FlagSet *items, int flag)
+{
+	PyObject *ret = PySet_New(NULL);
+	PyObject *pystr;
+
+	for ( ; items->identifier; items++) {
+		if (items->value & flag) {
+			pystr = PyUnicode_FromString(items->identifier);
+			PySet_Add(ret, pystr);
+			Py_DECREF(pystr);
+		}
+	}
+
+	return ret;
+}
diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h
index 2cab464..9ef1712 100644
--- a/source/blender/python/generic/py_capi_utils.h
+++ b/source/blender/python/generic/py_capi_utils.h
@@ -25,8 +25,8 @@
  */
 
  
-#ifndef PY_CAPI_UTILS_H
-#define PY_CAPI_UTILS_H
+#ifndef __PY_CAPI_UTILS_H__
+#define __PY_CAPI_UTILS_H__
 
 void			PyC_ObSpit(const char *name, PyObject *var);
 void			PyC_LineSpit(void);
@@ -54,4 +54,18 @@ void PyC_SetHomePath(const char *py_path_bundle);
 
 #define PYC_INTERPRETER_ACTIVE (((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current)) != NULL)
 
-#endif // PY_CAPI_UTILS_H
+void *PyC_RNA_AsPointer(PyObject *value, const char *type_name);
+
+/* flag / set --- interchange */
+typedef struct PyC_FlagSet {
+	int value;
+	const char *identifier;
+} PyC_FlagSet;
+
+char     *PyC_FlagSet_AsString(PyC_FlagSet *item);
+int       PyC_FlagSet_ValueFromID_int(PyC_FlagSet *item, const char *identifier, int *value);
+int       PyC_FlagSet_ValueFromID(PyC_FlagSet *item, const char *identifier, int *value, const char *error_prefix);
+int       PyC_FlagSet_ToBitfield(PyC_FlagSet *items, PyObject *value, int *r_value, const char *error_prefix);
+PyObject *PyC_FlagSet_FromBitfield(PyC_FlagSet *items, int flag);
+
+#endif // __PY_CAPI_UTILS_H__
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c
index e0e3dd5..834ca12 100644
--- a/source/blender/python/intern/bpy.c
+++ b/source/blender/python/intern/bpy.c
@@ -52,7 +52,7 @@
 
 #include "MEM_guardedalloc.h"
 
- /* external util modules */
+/* external util modules */
 #include "../generic/idprop_py_api.h"
 #include "../generic/bgl.h"
 #include "../generic/blf_py_api.h"
@@ -71,12 +71,17 @@ PyDoc_STRVAR(bpy_script_paths_doc,
 static PyObject *bpy_script_paths(PyObject *UNUSED(self))
 {
 	PyObject *ret = PyTuple_New(2);
+	PyObject *item;
 	char *path;
 
 	path = BLI_get_folder(BLENDER_SYSTEM_SCRIPTS, NULL);
-	PyTuple_SET_ITEM(ret, 0, PyUnicode_FromString(path?path:""));
+	item = PyUnicode_DecodeFSDefault(path ? path : "");
+	BLI_assert(item != NULL);
+	PyTuple_SET_ITEM(ret, 0, item);
 	path = BLI_get_folder(BLENDER_USER_SCRIPTS, NULL);
-	PyTuple_SET_ITEM(ret, 1, PyUnicode_FromString(path?path:""));
+	item = PyUnicode_DecodeFSDefault(path ? path : "");
+	BLI_assert(item != NULL);
+	PyTuple_SET_ITEM(ret, 1, item);
 
 	return ret;
 }
@@ -190,7 +195,7 @@ static PyObject *bpy_resource_path(PyObject *UNUSED(self), PyObject *args, PyObj
 		return NULL;
 
 	/* stupid string compare */
-	if     (!strcmp(type, "USER"))     folder_id = BLENDER_RESOURCE_PATH_USER;
+	if      (!strcmp(type, "USER"))    folder_id = BLENDER_RESOURCE_PATH_USER;
 	else if (!strcmp(type, "LOCAL"))   folder_id = BLENDER_RESOURCE_PATH_LOCAL;
 	else if (!strcmp(type, "SYSTEM"))  folder_id = BLENDER_RESOURCE_PATH_SYSTEM;
 	else {
@@ -200,17 +205,17 @@ static PyObject *bpy_resource_path(PyObject *UNUSED(self), PyObject *args, PyObj
 
 	path = BLI_get_folder_version(folder_id, (major * 100) + minor, FALSE);
 
-	return PyUnicode_DecodeFSDefault(path);
+	return PyUnicode_DecodeFSDefault(path ? path : "");
 }
 
 static PyMethodDef meth_bpy_script_paths =
 	{"script_paths", (PyCFunction)bpy_script_paths, METH_NOARGS, bpy_script_paths_doc};
 static PyMethodDef meth_bpy_blend_paths =
-	{"blend_paths", (PyCFunction)bpy_blend_paths, METH_VARARGS|METH_KEYWORDS, bpy_blend_paths_doc};
+	{"blend_paths", (PyCFunction)bpy_blend_paths, METH_VARARGS | METH_KEYWORDS, bpy_blend_paths_doc};
 static PyMethodDef meth_bpy_user_resource =
-	{"user_resource", (PyCFunction)bpy_user_resource, METH_VARARGS|METH_KEYWORDS, NULL};
+	{"user_resource", (PyCFunction)bpy_user_resource, METH_VARARGS | METH_KEYWORDS, NULL};
 static PyMethodDef meth_bpy_resource_path =
-	{"resource_path", (PyCFunction)bpy_resource_path, METH_VARARGS|METH_KEYWORDS, bpy_resource_path_doc};
+	{"resource_path", (PyCFunction)bpy_resource_path, METH_VARARGS | METH_KEYWORDS, bpy_resource_path_doc};
 
 
 static PyObject *bpy_import_test(const char *modname)
@@ -227,9 +232,9 @@ static PyObject *bpy_import_test(const char *modname)
 	return mod;
 }
 
-/*****************************************************************************
-* Description: Creates the bpy module and adds it to sys.modules for importing
-*****************************************************************************/
+/******************************************************************************
+ * Description: Creates the bpy module and adds it to sys.modules for importing
+ ******************************************************************************/
 void BPy_init_modules(void)
 {
 	extern BPy_StructRNA *bpy_context_module;
@@ -274,7 +279,7 @@ void BPy_init_modules(void)
 	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());	
-	 /* ops is now a python module that does the conversion from SOME_OT_foo -> some.foo */
+	/* 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 ea95c4e..4497970 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -94,9 +94,6 @@ static PyStructSequence_Desc app_info_desc = {
 	(sizeof(app_info_fields) / sizeof(PyStructSequence_Field)) - 1
 };
 
-#define DO_EXPAND(VAL)  VAL ## 1
-#define EXPAND(VAL)     DO_EXPAND(VAL)
-
 static PyObject *make_app_info(void)
 {
 	PyObject *app_info;
@@ -111,6 +108,8 @@ static PyObject *make_app_info(void)
 	PyStructSequence_SET_ITEM(app_info, pos++, PyLong_FromLong(flag))
 #define SetStrItem(str) \
 	PyStructSequence_SET_ITEM(app_info, pos++, PyUnicode_FromString(str))
+#define SetBytesItem(str) \
+	PyStructSequence_SET_ITEM(app_info, pos++, PyBytes_FromString(str))
 #define SetObjItem(obj) \
 	PyStructSequence_SET_ITEM(app_info, pos++, obj)
 
@@ -119,36 +118,33 @@ static PyObject *make_app_info(void)
 	SetObjItem(PyUnicode_FromFormat("%d.%02d (sub %d)",
 	                                BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION));
 
-#if defined(BLENDER_VERSION_CHAR) && EXPAND(BLENDER_VERSION_CHAR) != 1
 	SetStrItem(STRINGIFY(BLENDER_VERSION_CHAR));
-#else
-	SetStrItem("");
-#endif
 	SetStrItem(STRINGIFY(BLENDER_VERSION_CYCLE));
 	SetStrItem(BLI_program_path());
 	SetObjItem(PyBool_FromLong(G.background));
 
-	/* build info */
+	/* build info, use bytes since we can't assume _any_ encoding:
+	 * see patch [#30154] for issue */
 #ifdef BUILD_DATE
-	SetStrItem(build_date);
-	SetStrItem(build_time);
-	SetStrItem(build_rev);
-	SetStrItem(build_platform);
-	SetStrItem(build_type);
-	SetStrItem(build_cflags);
-	SetStrItem(build_cxxflags);
-	SetStrItem(build_linkflags);
-	SetStrItem(build_system);
+	SetBytesItem(build_date);
+	SetBytesItem(build_time);
+	SetBytesItem(build_rev);
+	SetBytesItem(build_platform);
+	SetBytesItem(build_type);
+	SetBytesItem(build_cflags);
+	SetBytesItem(build_cxxflags);
+	SetBytesItem(build_linkflags);
+	SetBytesItem(build_system);
 #else
-	SetStrItem("Unknown");
-	SetStrItem("Unknown");
-	SetStrItem("Unknown");
-	SetStrItem("Unknown");
-	SetStrItem("Unknown");
-	SetStrItem("Unknown");
-	SetStrItem("Unknown");
-	SetStrItem("Unknown");
-	SetStrItem("Unknown");
+	SetBytesItem("Unknown");
+	SetBytesItem("Unknown");
+	SetBytesItem("Unknown");
+	SetBytesItem("Unknown");
+	SetBytesItem("Unknown");
+	SetBytesItem("Unknown");
+	SetBytesItem("Unknown");
+	SetBytesItem("Unknown");
+	SetBytesItem("Unknown");
 #endif
 
 	SetObjItem(BPY_app_ffmpeg_struct());
@@ -156,6 +152,7 @@ static PyObject *make_app_info(void)
 
 #undef SetIntItem
 #undef SetStrItem
+#undef SetBytesItem
 #undef SetObjItem
 
 	if (PyErr_Occurred()) {
@@ -169,24 +166,26 @@ static PyObject *make_app_info(void)
  * they are not static */
 
 PyDoc_STRVAR(bpy_app_debug_doc,
-"Boolean, set when blender is running in debug mode (started with --debug)"
+"Boolean, for debug info (started with --debug / --debug_* matching this attribute name)"
 );
-static PyObject *bpy_app_debug_get(PyObject *UNUSED(self), void *UNUSED(closure))
+static PyObject *bpy_app_debug_get(PyObject *UNUSED(self), void *closure)
 {
-	return PyBool_FromLong(G.f & G_DEBUG);
+	const int flag = GET_INT_FROM_POINTER(closure);
+	return PyBool_FromLong(G.debug & flag);
 }
 
-static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *UNUSED(closure))
+static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *closure)
 {
-	int param = PyObject_IsTrue(value);
+	const int flag = GET_INT_FROM_POINTER(closure);
+	const int param = PyObject_IsTrue(value);
 
 	if (param < 0) {
 		PyErr_SetString(PyExc_TypeError, "bpy.app.debug can only be True/False");
 		return -1;
 	}
 	
-	if (param)  G.f |=  G_DEBUG;
-	else        G.f &= ~G_DEBUG;
+	if (param)  G.debug |=  flag;
+	else        G.debug &= ~flag;
 	
 	return 0;
 }
@@ -226,10 +225,11 @@ PyDoc_STRVAR(bpy_app_driver_dict_doc,
 );
 static PyObject *bpy_app_driver_dict_get(PyObject *UNUSED(self), void *UNUSED(closure))
 {
-	if (bpy_pydriver_Dict == NULL)
+	if (bpy_pydriver_Dict == NULL) {
 		if (bpy_pydriver_create_dict() != 0) {
 			PyErr_SetString(PyExc_RuntimeError, "bpy.app.driver_namespace failed to create dictionary");
 			return NULL;
+		}
 	}
 
 	Py_INCREF(bpy_pydriver_Dict);
@@ -238,7 +238,12 @@ static PyObject *bpy_app_driver_dict_get(PyObject *UNUSED(self), void *UNUSED(cl
 
 
 static PyGetSetDef bpy_app_getsets[] = {
-	{(char *)"debug", bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, NULL},
+	{(char *)"debug",        bpy_app_debug_get, bpy_app_debug_set, (char *)bpy_app_debug_doc, (void *)G_DEBUG},
+	{(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_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},
 	{(char *)"tempdir", bpy_app_tempdir_get, NULL, (char *)bpy_app_tempdir_doc, NULL},
 	{(char *)"driver_namespace", bpy_app_driver_dict_get, NULL, (char *)bpy_app_driver_dict_doc, NULL},
diff --git a/source/blender/python/intern/bpy_app.h b/source/blender/python/intern/bpy_app.h
index 0aa3b1f..5bf36f0 100644
--- a/source/blender/python/intern/bpy_app.h
+++ b/source/blender/python/intern/bpy_app.h
@@ -24,9 +24,9 @@
  *  \ingroup pythonintern
  */
 
-#ifndef BPY_APP_H
-#define BPY_APP_H
+#ifndef __BPY_APP_H__
+#define __BPY_APP_H__
 
 PyObject *BPY_app_struct(void);
 
-#endif // BPY_APP_H
+#endif // __BPY_APP_H__
diff --git a/source/blender/python/intern/bpy_app_ffmpeg.c b/source/blender/python/intern/bpy_app_ffmpeg.c
index 778334c..44bba4c 100644
--- a/source/blender/python/intern/bpy_app_ffmpeg.c
+++ b/source/blender/python/intern/bpy_app_ffmpeg.c
@@ -88,16 +88,18 @@ static PyObject *make_ffmpeg_info(void)
 	PyStructSequence_SET_ITEM(ffmpeg_info, pos++, obj)
 
 #ifdef WITH_FFMPEG
-	#define FFMPEG_LIB_VERSION(lib) \
+#  define FFMPEG_LIB_VERSION(lib)  { \
 		curversion = lib ## _version(); \
 		SetObjItem(Py_BuildValue("(iii)", \
-				curversion >> 16, (curversion >> 8) % 256, curversion % 256)); \
+		                         curversion >> 16, (curversion >> 8) % 256, curversion % 256)); \
 		SetObjItem(PyUnicode_FromFormat("%2d, %2d, %2d", \
-				curversion >> 16, (curversion >> 8) % 256, curversion % 256));
+		                                curversion >> 16, (curversion >> 8) % 256, curversion % 256)); \
+} (void)0
 #else
-	#define FFMPEG_LIB_VERSION(lib) \
+#  define FFMPEG_LIB_VERSION(lib)  { \
 		SetStrItem("Unknown"); \
-		SetStrItem("Unknown");
+		SetStrItem("Unknown"); \
+} (void)0
 #endif
 
 #ifdef WITH_FFMPEG
diff --git a/source/blender/python/intern/bpy_app_ffmpeg.h b/source/blender/python/intern/bpy_app_ffmpeg.h
index 4ed89cd..cadbb02 100644
--- a/source/blender/python/intern/bpy_app_ffmpeg.h
+++ b/source/blender/python/intern/bpy_app_ffmpeg.h
@@ -24,9 +24,9 @@
  *  \ingroup pythonintern
  */
 
-#ifndef BPY_APP_FFMPEG_H
-#define BPY_APP_FFMPEG_H
+#ifndef __BPY_APP_FFMPEG_H__
+#define __BPY_APP_FFMPEG_H__
 
 PyObject *BPY_app_ffmpeg_struct(void);
 
-#endif // BPY_APP_FFMPEG_H
+#endif // __BPY_APP_FFMPEG_H__
diff --git a/source/blender/python/intern/bpy_app_handlers.c b/source/blender/python/intern/bpy_app_handlers.c
index 721bce5..5128cf0 100644
--- a/source/blender/python/intern/bpy_app_handlers.c
+++ b/source/blender/python/intern/bpy_app_handlers.c
@@ -47,6 +47,8 @@ static PyStructSequence_Field app_cb_info_fields[] = {
 	{(char *)"render_pre",        (char *)"Callback list - on render (before)"},
 	{(char *)"render_post",       (char *)"Callback list - on render (after)"},
 	{(char *)"render_stats",      (char *)"Callback list - on printing render statistics"},
+	{(char *)"render_complete",   (char *)"Callback list - on completion of render job"},
+	{(char *)"render_cancel",     (char *)"Callback list - on cancelling a render job"},
 	{(char *)"load_pre",          (char *)"Callback list - on loading a new blend file (before)"},
 	{(char *)"load_post",         (char *)"Callback list - on loading a new blend file (after)"},
 	{(char *)"save_pre",          (char *)"Callback list - on saving a blend file (before)"},
@@ -68,11 +70,11 @@ static PyStructSequence_Desc app_cb_info_desc = {
 	(sizeof(app_cb_info_fields) / sizeof(PyStructSequence_Field)) - 1
 };
 
-/*
-#if (BLI_CB_EVT_TOT != ((sizeof(app_cb_info_fields)/sizeof(PyStructSequence_Field))))
-#  error "Callbacks are out of sync"
+#if 0
+#  if (BLI_CB_EVT_TOT != ((sizeof(app_cb_info_fields) / sizeof(PyStructSequence_Field))))
+#    error "Callbacks are out of sync"
+#  endif
 #endif
-*/
 
 /* --------------------------------------------------------------------------*/
 /* permanent tagging code */
@@ -116,51 +118,51 @@ static PyObject *bpy_app_handlers_persistent_new(PyTypeObject *UNUSED(type), PyO
 static PyTypeObject BPyPersistent_Type = {
 
 #if defined(_MSC_VER) || defined(FREE_WINDOWS)
-    PyVarObject_HEAD_INIT(NULL, 0)
+	PyVarObject_HEAD_INIT(NULL, 0)
 #else
-    PyVarObject_HEAD_INIT(&PyType_Type, 0)
+	PyVarObject_HEAD_INIT(&PyType_Type, 0)
 #endif
 
-    "persistent",                               /* tp_name */
-    0,                                          /* tp_basicsize */
-    0,                                          /* tp_itemsize */
-    /* methods */
-    0,                                          /* tp_dealloc */
-    0,                                          /* tp_print */
-    0,                                          /* tp_getattr */
-    0,                                          /* tp_setattr */
-    0,                                          /* tp_reserved */
-    0,                                          /* tp_repr */
-    0,                                          /* tp_as_number */
-    0,                                          /* tp_as_sequence */
-    0,                                          /* tp_as_mapping */
-    0,                                          /* tp_hash */
-    0,                                          /* tp_call */
-    0,                                          /* tp_str */
-    0,                                          /* tp_getattro */
-    0,                                          /* tp_setattro */
-    0,                                          /* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
-        Py_TPFLAGS_BASETYPE,                    /* tp_flags */
-    0,                                          /* tp_doc */
-    0,                                          /* tp_traverse */
-    0,                                          /* tp_clear */
-    0,                                          /* tp_richcompare */
-    0,                                          /* tp_weaklistoffset */
-    0,                                          /* tp_iter */
-    0,                                          /* tp_iternext */
-    0,                                          /* tp_methods */
-    0,                                          /* tp_members */
-    0,                                          /* tp_getset */
-    0,                                          /* tp_base */
-    0,                                          /* tp_dict */
-    0,                                          /* tp_descr_get */
-    0,                                          /* tp_descr_set */
-    0,                                          /* tp_dictoffset */
-    0,                                          /* tp_init */
-    0,                                          /* tp_alloc */
-    bpy_app_handlers_persistent_new,            /* tp_new */
-    0,                                          /* tp_free */
+	"persistent",                               /* tp_name */
+	0,                                          /* tp_basicsize */
+	0,                                          /* tp_itemsize */
+	/* methods */
+	0,                                          /* tp_dealloc */
+	0,                                          /* tp_print */
+	0,                                          /* tp_getattr */
+	0,                                          /* tp_setattr */
+	0,                                          /* tp_reserved */
+	0,                                          /* tp_repr */
+	0,                                          /* tp_as_number */
+	0,                                          /* tp_as_sequence */
+	0,                                          /* tp_as_mapping */
+	0,                                          /* tp_hash */
+	0,                                          /* tp_call */
+	0,                                          /* tp_str */
+	0,                                          /* tp_getattro */
+	0,                                          /* tp_setattro */
+	0,                                          /* tp_as_buffer */
+	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
+	Py_TPFLAGS_BASETYPE,                        /* tp_flags */
+	0,                                          /* tp_doc */
+	0,                                          /* tp_traverse */
+	0,                                          /* tp_clear */
+	0,                                          /* tp_richcompare */
+	0,                                          /* tp_weaklistoffset */
+	0,                                          /* tp_iter */
+	0,                                          /* tp_iternext */
+	0,                                          /* tp_methods */
+	0,                                          /* tp_members */
+	0,                                          /* tp_getset */
+	0,                                          /* tp_base */
+	0,                                          /* tp_dict */
+	0,                                          /* tp_descr_get */
+	0,                                          /* tp_descr_set */
+	0,                                          /* tp_dictoffset */
+	0,                                          /* tp_init */
+	0,                                          /* tp_alloc */
+	bpy_app_handlers_persistent_new,            /* tp_new */
+	0,                                          /* tp_free */
 };
 
 static PyObject *py_cb_array[BLI_CB_EVT_TOT] = {NULL};
@@ -235,7 +237,7 @@ void BPY_app_handlers_reset(const short do_all)
 	int pos = 0;
 
 	if (do_all) {
-	for (pos = 0; pos < BLI_CB_EVT_TOT; pos++) {
+		for (pos = 0; pos < BLI_CB_EVT_TOT; pos++) {
 			/* clear list */
 			PyList_SetSlice(py_cb_array[pos], 0, PY_SSIZE_T_MAX, NULL);
 		}
@@ -254,10 +256,10 @@ void BPY_app_handlers_reset(const short do_all)
 
 			for (i = PyList_GET_SIZE(ls) - 1; i >= 0; i--) {
 
-				if ( (PyFunction_Check((item = PyList_GET_ITEM(ls, i)))) &&
-				     (dict_ptr = _PyObject_GetDictPtr(item)) &&
-				     (*dict_ptr) &&
-				     (PyDict_GetItem(*dict_ptr, perm_id_str) != NULL))
+				if ((PyFunction_Check((item = PyList_GET_ITEM(ls, i)))) &&
+				    (dict_ptr = _PyObject_GetDictPtr(item)) &&
+				    (*dict_ptr) &&
+				    (PyDict_GetItem(*dict_ptr, perm_id_str) != NULL))
 				{
 					/* keep */
 				}
@@ -277,13 +279,12 @@ void BPY_app_handlers_reset(const short do_all)
 void bpy_app_generic_callback(struct Main *UNUSED(main), struct ID *id, void *arg)
 {
 	PyObject *cb_list = py_cb_array[GET_INT_FROM_POINTER(arg)];
-	Py_ssize_t cb_list_len;
-	if ((cb_list_len = PyList_GET_SIZE(cb_list)) > 0) {
+	if (PyList_GET_SIZE(cb_list) > 0) {
 		PyGILState_STATE gilstate = PyGILState_Ensure();
 
-		PyObject* args = PyTuple_New(1); // save python creating each call
-		PyObject* func;
-		PyObject* ret;
+		PyObject *args = PyTuple_New(1); // save python creating each call
+		PyObject *func;
+		PyObject *ret;
 		Py_ssize_t pos;
 
 		/* setup arguments */
@@ -297,8 +298,9 @@ void bpy_app_generic_callback(struct Main *UNUSED(main), struct ID *id, void *ar
 			Py_INCREF(Py_None);
 		}
 
-		// Iterate the list and run the callbacks
-		for (pos = 0; pos < cb_list_len; pos++) {
+		/* Iterate the list and run the callbacks
+		 * note: don't store the list size since the scripts may remove themselves */
+		for (pos = 0; pos < PyList_GET_SIZE(cb_list); pos++) {
 			func = PyList_GET_ITEM(cb_list, pos);
 			ret = PyObject_Call(func, args, NULL);
 			if (ret == NULL) {
diff --git a/source/blender/python/intern/bpy_app_handlers.h b/source/blender/python/intern/bpy_app_handlers.h
index 873282b..1f1eaf0 100644
--- a/source/blender/python/intern/bpy_app_handlers.h
+++ b/source/blender/python/intern/bpy_app_handlers.h
@@ -24,10 +24,9 @@
  *  \ingroup pythonintern
  */
 
-#ifndef BPY_APP_HANDLERS_H
-#define BPY_APP_HANDLERS_H
+#ifndef __BPY_APP_HANDLERS_H__
+#define __BPY_APP_HANDLERS_H__
 
 PyObject *BPY_app_handlers_struct(void);
-void BPY_app_handlers_clear(void);
 
-#endif // BPY_APP_HANDLERS_H
+#endif // __BPY_APP_HANDLERS_H__
diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c
index 95b00b1..e2acef7 100644
--- a/source/blender/python/intern/bpy_driver.c
+++ b/source/blender/python/intern/bpy_driver.c
@@ -70,7 +70,7 @@ int bpy_pydriver_create_dict(void)
 
 	mod = PyImport_ImportModule("math");
 	if (mod) {
-		PyDict_Merge(d, PyModule_GetDict(mod), 0); /* 0 - dont overwrite existing values */
+		PyDict_Merge(d, PyModule_GetDict(mod), 0); /* 0 - don't overwrite existing values */
 		Py_DECREF(mod);
 	}
 
@@ -159,14 +159,14 @@ static void pydriver_error(ChannelDriver *driver)
 /* This evals py driver expressions, 'expr' is a Python expression that
  * should evaluate to a float number, which is returned.
  *
- * (old)note: PyGILState_Ensure() isnt always called because python can call
+ * (old)note: PyGILState_Ensure() isn't always called because python can call
  * the bake operator which intern starts a thread which calls scene update
  * which does a driver update. to avoid a deadlock check PYC_INTERPRETER_ACTIVE
  * if PyGILState_Ensure() is needed - see [#27683]
  *
  * (new)note: checking if python is running is not threadsafe [#28114]
  * now release the GIL on python operator execution instead, using
- * PyEval_SaveThread() / PyEval_RestoreThread() so we dont lock up blender.
+ * PyEval_SaveThread() / PyEval_RestoreThread() so we don't lock up blender.
  */
 float BPY_driver_exec(ChannelDriver *driver, const float evaltime)
 {
diff --git a/source/blender/python/intern/bpy_driver.h b/source/blender/python/intern/bpy_driver.h
index 802a364..6d1696d 100644
--- a/source/blender/python/intern/bpy_driver.h
+++ b/source/blender/python/intern/bpy_driver.h
@@ -24,8 +24,8 @@
  *  \ingroup pythonintern
  */
 
-#ifndef BPY_DRIVER_H
-#define BPY_DRIVER_H
+#ifndef __BPY_DRIVER_H__
+#define __BPY_DRIVER_H__
 
 struct ChannelDriver;
 
@@ -36,4 +36,4 @@ extern PyObject *bpy_pydriver_Dict;
 float BPY_driver_exec(struct ChannelDriver *driver, const float evaltime);
 void BPY_driver_reset(void);
 
-#endif // BPY_DRIVER_H
+#endif // __BPY_DRIVER_H__
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 72c072c..d638a3e 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -52,10 +52,12 @@
 #include "DNA_text_types.h"
 
 #include "BLI_path_util.h"
+#include "BLI_fileops.h"
 #include "BLI_math_base.h"
 #include "BLI_string.h"
 #include "BLI_string_utf8.h"
 #include "BLI_utildefines.h"
+#include "BLI_threads.h"
 
 #include "BKE_context.h"
 #include "BKE_text.h"
@@ -72,11 +74,14 @@
 /* inittab initialization functions */
 #include "../generic/bgl.h"
 #include "../generic/blf_py_api.h"
+#include "../generic/idprop_py_api.h"
+#include "../bmesh/bmesh_py_api.h"
 #include "../mathutils/mathutils.h"
 
+
 /* for internal use, when starting and ending python scripts */
 
-/* incase a python script triggers another python call, stop bpy_context_clear from invalidating */
+/* in case a python script triggers another python call, stop bpy_context_clear from invalidating */
 static int py_call_level = 0;
 BPy_StructRNA *bpy_context_module = NULL; /* for fast access */
 
@@ -84,18 +89,24 @@ BPy_StructRNA *bpy_context_module = NULL; /* for fast access */
 
 #ifdef TIME_PY_RUN
 #include "PIL_time.h"
-static int		bpy_timer_count = 0;
-static double	bpy_timer; /* time since python starts */
-static double	bpy_timer_run; /* time for each python script run */
-static double	bpy_timer_run_tot; /* accumulate python runs */
+static int     bpy_timer_count = 0;
+static double  bpy_timer;   /* time since python starts */
+static double  bpy_timer_run;   /* time for each python script run */
+static double  bpy_timer_run_tot;   /* accumulate python runs */
 #endif
 
 /* use for updating while a python script runs - in case of file load */
 void bpy_context_update(bContext *C)
 {
+	/* don't do this from a non-main (e.g. render) thread, it can cause a race
+	 * condition on C->data.recursion. ideal solution would be to disable
+	 * context entirely from non-main threads, but that's more complicated */
+	if (!BLI_thread_is_main())
+		return;
+
 	BPy_SetContext(C);
 	bpy_import_main_set(CTX_data_main(C));
-	BPY_modules_update(C); /* can give really bad results if this isnt here */
+	BPY_modules_update(C); /* can give really bad results if this isn't here */
 }
 
 void bpy_context_set(bContext *C, PyGILState_STATE *gilstate)
@@ -182,7 +193,7 @@ extern PyObject *AUD_initPython(void);
 /* defined in cycles module */
 static PyObject *CCL_initPython(void)
 {
-	return (PyObject*)CCL_python_module_init();
+	return (PyObject *)CCL_python_module_init();
 }
 #endif
 
@@ -192,6 +203,9 @@ static struct _inittab bpy_internal_modules[] = {
 //	{(char *)"mathutils.noise", PyInit_mathutils_noise},
 	{(char *)"bgl", BPyInit_bgl},
 	{(char *)"blf", BPyInit_blf},
+	{(char *)"bmesh", BPyInit_bmesh},
+	// {(char *)"bmesh.types", BPyInit_bmesh_types},
+	// {(char *)"bmesh.utils", BPyInit_bmesh_utils},
 #ifdef WITH_AUDASPACE
 	{(char *)"aud", AUD_initPython},
 #endif
@@ -199,6 +213,7 @@ static struct _inittab bpy_internal_modules[] = {
 	{(char *)"_cycles", CCL_initPython},
 #endif
 	{(char *)"gpu", GPU_initPython},
+	{(char *)"idprop", BPyInit_idprop},
 	{NULL, NULL}
 };
 
@@ -234,7 +249,7 @@ void BPY_python_start(int argc, const char **argv)
 	Py_Initialize();
 
 	// PySys_SetArgv(argc, argv); // broken in py3, not a huge deal
-	/* sigh, why do python guys not have a char** version anymore? :( */
+	/* sigh, why do python guys not have a (char **) version anymore? */
 	{
 		int i;
 		PyObject *py_argv = PyList_New(argc);
@@ -303,10 +318,10 @@ void BPY_python_end(void)
 	printf("tot exec: %d,  ", bpy_timer_count);
 	printf("tot run: %.4fsec,  ", bpy_timer_run_tot);
 	if (bpy_timer_count > 0)
-		printf("average run: %.6fsec,  ", (bpy_timer_run_tot/bpy_timer_count));
+		printf("average run: %.6fsec,  ", (bpy_timer_run_tot / bpy_timer_count));
 
 	if (bpy_timer > 0.0)
-		printf("tot usage %.4f%%", (bpy_timer_run_tot/bpy_timer) * 100.0);
+		printf("tot usage %.4f%%", (bpy_timer_run_tot / bpy_timer) * 100.0);
 
 	printf("\n");
 
@@ -362,7 +377,7 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text,
 		char fn_dummy[FILE_MAXDIR];
 		bpy_text_filename_get(fn_dummy, sizeof(fn_dummy), text);
 
-		if (text->compiled == NULL) {	/* if it wasn't already compiled, do it now */
+		if (text->compiled == NULL) {   /* if it wasn't already compiled, do it now */
 			char *buf = txt_to_buf(text);
 
 			text->compiled = Py_CompileString(buf, fn_dummy, Py_file_input);
@@ -384,7 +399,7 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text,
 
 	}
 	else {
-		FILE *fp = fopen(fn, "r");
+		FILE *fp = BLI_fopen(fn, "r");
 
 		if (fp) {
 			py_dict = PyC_DefaultNameSpace(fn);
@@ -493,7 +508,7 @@ int BPY_button_exec(bContext *C, const char *expr, double *value, const short ve
 
 	mod = PyImport_ImportModule("math");
 	if (mod) {
-		PyDict_Merge(py_dict, PyModule_GetDict(mod), 0); /* 0 - dont overwrite existing values */
+		PyDict_Merge(py_dict, PyModule_GetDict(mod), 0); /* 0 - don't overwrite existing values */
 		Py_DECREF(mod);
 	}
 	else { /* highly unlikely but possibly */
@@ -667,11 +682,11 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
 				PyObject *list_item = PySequence_Fast_GET_ITEM(seq_fast, i);
 
 				if (BPy_StructRNA_Check(list_item)) {
-					/*
+#if 0
 					CollectionPointerLink *link = MEM_callocN(sizeof(CollectionPointerLink), "bpy_context_get");
 					link->ptr = ((BPy_StructRNA *)item)->ptr;
 					BLI_addtail(&result->list, link);
-					*/
+#endif
 					ptr = &(((BPy_StructRNA *)list_item)->ptr);
 					CTX_data_list_add(result, ptr->id.data, ptr->type, ptr->data);
 				}
@@ -687,11 +702,11 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
 	}
 
 	if (done == 0) {
-		if (item)	printf("PyContext '%s' not a valid type\n", member);
-		else		printf("PyContext '%s' not found\n", member);
+		if (item) printf("PyContext '%s' not a valid type\n", member);
+		else      printf("PyContext '%s' not found\n", member);
 	}
 	else {
-		if (G.f & G_DEBUG) {
+		if (G.debug & G_DEBUG_PYTHON) {
 			printf("PyContext '%s' found\n", member);
 		}
 	}
@@ -699,10 +714,9 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult *
 	return done;
 }
 
-
 #ifdef WITH_PYTHON_MODULE
 #include "BLI_fileops.h"
-/* TODO, reloading the module isnt functional at the moment. */
+/* TODO, reloading the module isn't functional at the moment. */
 
 static void bpy_module_free(void *mod);
 extern int main_python_enter(int argc, const char **argv);
@@ -779,7 +793,7 @@ PyInit_bpy(void)
 	 *    we may end up having to rename this module so there is no naming conflict here eg:
 	 *    'from blender import bpy'
 	 *
-	 * 3) we dont know the filename at this point, workaround by assigning a dummy value
+	 * 3) we don't know the filename at this point, workaround by assigning a dummy value
 	 *    which calls back when its freed so the real loading can take place.
 	 */
 
diff --git a/source/blender/python/intern/bpy_interface_atexit.c b/source/blender/python/intern/bpy_interface_atexit.c
index 53775e7..db97d36 100644
--- a/source/blender/python/intern/bpy_interface_atexit.c
+++ b/source/blender/python/intern/bpy_interface_atexit.c
@@ -62,7 +62,7 @@ static void atexit_func_call(const char *func_name, PyObject *atexit_func_arg)
 	PyObject *ret;
 
 	PyTuple_SET_ITEM(args, 0, atexit_func_arg);
-	Py_INCREF(atexit_func_arg); /* only incref so we dont dec'ref along with 'args' */
+	Py_INCREF(atexit_func_arg); /* only incref so we don't dec'ref along with 'args' */
 
 	ret = PyObject_CallObject(atexit_func, args);
 
@@ -92,5 +92,5 @@ void BPY_atexit_unregister(void)
 	BLI_assert(func_bpy_atregister != NULL);
 
 	atexit_func_call("unregister", func_bpy_atregister);
-	func_bpy_atregister = NULL; /* don't really need to set but just incase */
+	func_bpy_atregister = NULL; /* don't really need to set but just in case */
 }
diff --git a/source/blender/python/intern/bpy_library.c b/source/blender/python/intern/bpy_library.c
index ed3b758..a5350b9 100644
--- a/source/blender/python/intern/bpy_library.c
+++ b/source/blender/python/intern/bpy_library.c
@@ -62,7 +62,7 @@
 #endif
 
 typedef struct {
-	PyObject_HEAD /* required python macro   */
+	PyObject_HEAD /* required python macro */
 	/* collection iterator specific parts */
 	char relpath[FILE_MAX];
 	char abspath[FILE_MAX]; /* absolute path */
@@ -92,75 +92,75 @@ static void bpy_lib_dealloc(BPy_Library *self)
 
 static PyTypeObject bpy_lib_Type = {
 	PyVarObject_HEAD_INIT(NULL, 0)
-	"bpy_lib",		/* tp_name */
-	sizeof(BPy_Library),			/* tp_basicsize */
-	0,							/* tp_itemsize */
+	"bpy_lib",      /* tp_name */
+	sizeof(BPy_Library),            /* tp_basicsize */
+	0,                          /* tp_itemsize */
 	/* methods */
-	(destructor)bpy_lib_dealloc,/* tp_dealloc */
+	(destructor)bpy_lib_dealloc, /* tp_dealloc */
 	NULL,                       /* printfunc tp_print; */
-	NULL,						/* getattrfunc tp_getattr; */
+	NULL,                       /* getattrfunc tp_getattr; */
 	NULL,                       /* setattrfunc tp_setattr; */
-	NULL,						/* tp_compare */ /* DEPRECATED in python 3.0! */
-	NULL,						/* tp_repr */
+	NULL,                       /* tp_compare */ /* DEPRECATED in python 3.0! */
+	NULL,                       /* tp_repr */
 
 	/* Method suites for standard classes */
 
-	NULL,						/* PyNumberMethods *tp_as_number; */
-	NULL,						/* PySequenceMethods *tp_as_sequence; */
-	NULL,						/* PyMappingMethods *tp_as_mapping; */
+	NULL,                       /* PyNumberMethods *tp_as_number; */
+	NULL,                       /* PySequenceMethods *tp_as_sequence; */
+	NULL,                       /* PyMappingMethods *tp_as_mapping; */
 
 	/* More standard operations (here for binary compatibility) */
 
-	NULL,						/* hashfunc tp_hash; */
+	NULL,                       /* hashfunc tp_hash; */
 	NULL,                       /* ternaryfunc tp_call; */
 	NULL,                       /* reprfunc tp_str; */
 
 	/* will only use these if this is a subtype of a py class */
-	NULL /*PyObject_GenericGetAttr is assigned later */,	/* getattrofunc tp_getattro; */
-	NULL,						/* setattrofunc tp_setattro; */
+	NULL /*PyObject_GenericGetAttr is assigned later */,    /* getattrofunc tp_getattro; */
+	NULL,                       /* setattrofunc tp_setattro; */
 
 	/* Functions to access object as input/output buffer */
 	NULL,                       /* PyBufferProcs *tp_as_buffer; */
 
-  /*** Flags to define presence of optional/expanded features ***/
+	/*** Flags to define presence of optional/expanded features ***/
 	Py_TPFLAGS_DEFAULT,         /* long tp_flags; */
 
-	NULL,						/*  char *tp_doc;  Documentation string */
-  /*** Assigned meaning in release 2.0 ***/
+	NULL,                       /*  char *tp_doc;  Documentation string */
+	/*** Assigned meaning in release 2.0 ***/
 	/* call function for all accessible objects */
 	NULL,                       /* traverseproc tp_traverse; */
 
 	/* delete references to contained objects */
 	NULL,                       /* inquiry tp_clear; */
 
-  /***  Assigned meaning in release 2.1 ***/
-  /*** rich comparisons ***/
+	/***  Assigned meaning in release 2.1 ***/
+	/*** rich comparisons ***/
 	NULL, /* subclassed */		/* richcmpfunc tp_richcompare; */
 
-  /***  weak reference enabler ***/
+	/***  weak reference enabler ***/
 	0,
-  /*** Added in release 2.2 ***/
+	/*** Added in release 2.2 ***/
 	/*   Iterators */
-	NULL,						/* getiterfunc tp_iter; */
+	NULL,                       /* getiterfunc tp_iter; */
 	NULL,                       /* iternextfunc tp_iternext; */
 
-  /*** Attribute descriptor and subclassing stuff ***/
-	bpy_lib_methods,			/* struct PyMethodDef *tp_methods; */
+	/*** Attribute descriptor and subclassing stuff ***/
+	bpy_lib_methods,            /* struct PyMethodDef *tp_methods; */
 	NULL,                       /* struct PyMemberDef *tp_members; */
-	NULL,				      	/* struct PyGetSetDef *tp_getset; */
+	NULL,                       /* struct PyGetSetDef *tp_getset; */
 	NULL,                       /* struct _typeobject *tp_base; */
 	NULL,                       /* PyObject *tp_dict; */
 	NULL,                       /* descrgetfunc tp_descr_get; */
 	NULL,                       /* descrsetfunc tp_descr_set; */
-	offsetof(BPy_Library, dict),/* long tp_dictoffset; */
+	offsetof(BPy_Library, dict), /* long tp_dictoffset; */
 	NULL,                       /* initproc tp_init; */
 	NULL,                       /* allocfunc tp_alloc; */
-	NULL,						/* newfunc tp_new; */
+	NULL,                       /* newfunc tp_new; */
 	/*  Low-level free-memory routine */
 	NULL,                       /* freefunc tp_free;  */
 	/* For PyObject_IS_GC */
 	NULL,                       /* inquiry tp_is_gc;  */
-	NULL,						/* PyObject *tp_bases; */
+	NULL,                       /* PyObject *tp_bases; */
 	/* method resolution order */
 	NULL,                       /* PyObject *tp_mro;  */
 	NULL,                       /* PyObject *tp_cache; */
@@ -170,23 +170,23 @@ static PyTypeObject bpy_lib_Type = {
 };
 
 PyDoc_STRVAR(bpy_lib_load_doc,
-".. method:: load(filepath, link=False, relative=False)\n"
-"\n"
-"   Returns a context manager which exposes 2 library objects on entering.\n"
-"   Each object has attributes matching bpy.data which are lists of strings to be linked.\n"
-"\n"
-"   :arg filepath: The path to a blend file.\n"
-"   :type filepath: string\n"
-"   :arg link: When False reference to the original file is lost.\n"
-"   :type link: bool\n"
-"   :arg relative: When True the path is stored relative to the open blend file.\n"
-"   :type relative: bool\n"
-);
+             ".. method:: load(filepath, link=False, relative=False)\n"
+             "\n"
+             "   Returns a context manager which exposes 2 library objects on entering.\n"
+             "   Each object has attributes matching bpy.data which are lists of strings to be linked.\n"
+             "\n"
+             "   :arg filepath: The path to a blend file.\n"
+             "   :type filepath: string\n"
+             "   :arg link: When False reference to the original file is lost.\n"
+             "   :type link: bool\n"
+             "   :arg relative: When True the path is stored relative to the open blend file.\n"
+             "   :type relative: bool\n"
+             );
 static PyObject *bpy_lib_load(PyObject *UNUSED(self), PyObject *args, PyObject *kwds)
 {
 	static const char *kwlist[] = {"filepath", "link", "relative", NULL};
 	BPy_Library *ret;
-	const char* filename = NULL;
+	const char *filename = NULL;
 	int is_rel = 0, is_link = 0;
 
 	if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|ii:load", (char **)kwlist, &filename, &is_link, &is_rel))
@@ -199,8 +199,8 @@ static PyObject *bpy_lib_load(PyObject *UNUSED(self), PyObject *args, PyObject *
 	BLI_path_abs(ret->abspath, G.main->name);
 
 	ret->blo_handle = NULL;
-	ret->flag=	(is_link ? FILE_LINK : 0) |
-				(is_rel ? FILE_RELPATH : 0);
+	ret->flag = ((is_link ? FILE_LINK : 0) |
+	             (is_rel ? FILE_RELPATH : 0));
 
 	ret->dict = PyDict_New();
 
@@ -222,7 +222,7 @@ static PyObject *_bpy_names(BPy_Library *self, int blocktype)
 			PyList_SET_ITEM(list, counter, PyUnicode_FromString((char *)l->link));
 			counter++;
 		}
-		BLI_linklist_free(names, free);	/* free linklist *and* each node's data */
+		BLI_linklist_free(names, free); /* free linklist *and* each node's data */
 	}
 	else {
 		list = PyList_New(0);
@@ -401,7 +401,8 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args))
 		BLO_blendhandle_close(self->blo_handle);
 		self->blo_handle = NULL;
 
-		{	/* copied from wm_operator.c */
+		/* copied from wm_operator.c */
+		{
 			/* mark all library linked objects to be updated */
 			recalc_all_library_objects(G.main);
 
@@ -426,12 +427,12 @@ static PyObject *bpy_lib_dir(BPy_Library *self)
 int bpy_lib_init(PyObject *mod_par)
 {
 	static PyMethodDef load_meth = {"load", (PyCFunction)bpy_lib_load,
-	                               METH_STATIC|METH_VARARGS|METH_KEYWORDS,
-	                               bpy_lib_load_doc};
+	                                METH_STATIC | METH_VARARGS | METH_KEYWORDS,
+	                                bpy_lib_load_doc};
 
 	PyModule_AddObject(mod_par, "_library_load", PyCFunction_New(&load_meth, NULL));
 
-	/* some compilers dont like accessing this directly, delay assignment */
+	/* some compilers don't like accessing this directly, delay assignment */
 	bpy_lib_Type.tp_getattro = PyObject_GenericGetAttr;
 
 	if (PyType_Ready(&bpy_lib_Type) < 0)
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index 6a6e659..8f5a9fe 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -65,11 +65,11 @@
 static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args)
 {
 	wmOperatorType *ot;
-	char		*opname;
-	PyObject	*context_dict = NULL; /* optional args */
-	PyObject	*context_dict_back;
-	char		*context_str = NULL;
-	PyObject	*ret;
+	char     *opname;
+	PyObject *context_dict = NULL; /* optional args */
+	PyObject *context_dict_back;
+	char     *context_str = NULL;
+	PyObject *ret;
 
 	int context = WM_OP_EXEC_DEFAULT;
 
@@ -139,11 +139,11 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
 	PointerRNA ptr;
 	int operator_ret = OPERATOR_CANCELLED;
 
-	char		*opname;
-	char		*context_str = NULL;
-	PyObject	*kw = NULL; /* optional args */
-	PyObject	*context_dict = NULL; /* optional args */
-	PyObject	*context_dict_back;
+	char     *opname;
+	char     *context_str = NULL;
+	PyObject *kw = NULL; /* optional args */
+	PyObject *context_dict = NULL; /* optional args */
+	PyObject *context_dict_back;
 
 	/* note that context is an int, python does the conversion in this case */
 	int context = WM_OP_EXEC_DEFAULT;
@@ -225,7 +225,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
 			ReportList *reports;
 
 			reports = MEM_mallocN(sizeof(ReportList), "wmOperatorReportList");
-			BKE_reports_init(reports, RPT_STORE | RPT_OP_HOLD); /* own so these dont move into global reports */
+			BKE_reports_init(reports, RPT_STORE | RPT_OP_HOLD); /* own so these don't move into global reports */
 
 #ifdef BPY_RELEASE_GIL
 			/* release GIL, since a thread could be started from an operator
@@ -257,8 +257,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args)
 			}
 	
 			BKE_reports_clear(reports);
-			if ((reports->flag & RPT_FREE) == 0)
-			{
+			if ((reports->flag & RPT_FREE) == 0) {
 				MEM_freeN(reports);
 			}
 		}
@@ -307,8 +306,8 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
 	wmOperatorType *ot;
 	PointerRNA ptr;
 
-	char		*opname;
-	PyObject	*kw = NULL; /* optional args */
+	char     *opname;
+	PyObject *kw = NULL; /* optional args */
 	int all_args = 1;
 	int error_val = 0;
 
@@ -434,7 +433,7 @@ static PyObject *pyop_getinstance(PyObject *UNUSED(self), PyObject *value)
 	op = PyMem_MALLOC(sizeof(wmOperator));
 	memset(op, 0, sizeof(wmOperator));
 #endif
-	BLI_strncpy(op->idname, op->idname, sizeof(op->idname)); /* incase its needed */
+	BLI_strncpy(op->idname, op->idname, sizeof(op->idname)); /* in case its needed */
 	op->type = ot;
 
 	RNA_pointer_create(NULL, &RNA_Operator, op, &ptr);
@@ -463,7 +462,7 @@ static struct PyModuleDef bpy_ops_module = {
 	PyModuleDef_HEAD_INIT,
 	"_bpy.ops",
 	NULL,
-	-1,/* multiple "initialization" just copies the module dict. */
+	-1, /* multiple "initialization" just copies the module dict. */
 	bpy_ops_methods,
 	NULL, NULL, NULL, NULL
 };
diff --git a/source/blender/python/intern/bpy_operator.h b/source/blender/python/intern/bpy_operator.h
index cf67f2a..68ea942 100644
--- a/source/blender/python/intern/bpy_operator.h
+++ b/source/blender/python/intern/bpy_operator.h
@@ -24,8 +24,8 @@
  *  \ingroup pythonintern
  */
 
-#ifndef BPY_OPERATOR_H
-#define BPY_OPERATOR_H
+#ifndef __BPY_OPERATOR_H__
+#define __BPY_OPERATOR_H__
 
 extern PyTypeObject pyop_base_Type;
 
diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c
index 39780e7..1caec29 100644
--- a/source/blender/python/intern/bpy_operator_wrap.c
+++ b/source/blender/python/intern/bpy_operator_wrap.c
@@ -69,7 +69,8 @@ void operator_wrapper(wmOperatorType *ot, void *userdata)
 
 	operator_properties_init(ot);
 
-	{	/* XXX - not nice, set the first enum as searchable, should have a way for python to set */
+	/* XXX - not nice, set the first enum as searchable, should have a way for python to set */
+	{
 		PointerRNA ptr;
 		PropertyRNA *prop;
 
diff --git a/source/blender/python/intern/bpy_operator_wrap.h b/source/blender/python/intern/bpy_operator_wrap.h
index 125d7db..05a566a 100644
--- a/source/blender/python/intern/bpy_operator_wrap.h
+++ b/source/blender/python/intern/bpy_operator_wrap.h
@@ -24,8 +24,8 @@
  *  \ingroup pythonintern
  */
 
-#ifndef BPY_OPERATOR_WRAP_H
-#define BPY_OPERATOR_WRAP_H
+#ifndef __BPY_OPERATOR_WRAP_H__
+#define __BPY_OPERATOR_WRAP_H__
 
 struct wmOperatorType;
 
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index 414ebe4..4d0c05f 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -59,13 +59,13 @@ extern BPy_StructRNA *bpy_context_module;
 static EnumPropertyItem property_flag_items[] = {
 	{PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""},
 	{PROP_SKIP_SAVE, "SKIP_SAVE", 0, "Skip Save", ""},
-	{PROP_ANIMATABLE, "ANIMATABLE", 0, "Animateable", ""},
+	{PROP_ANIMATABLE, "ANIMATABLE", 0, "Animatable", ""},
 	{0, NULL, 0, NULL, NULL}};
 
 static EnumPropertyItem property_flag_enum_items[] = {
 	{PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""},
 	{PROP_SKIP_SAVE, "SKIP_SAVE", 0, "Skip Save", ""},
-	{PROP_ANIMATABLE, "ANIMATABLE", 0, "Animateable", ""},
+	{PROP_ANIMATABLE, "ANIMATABLE", 0, "Animatable", ""},
 	{PROP_ENUM_FLAG, "ENUM_FLAG", 0, "Enum Flag", ""},
 	{0, NULL, 0, NULL, NULL}};
 
@@ -155,10 +155,10 @@ static void printf_func_error(PyObject *py_func)
 
 	/* use py style error */
 	fprintf(stderr, "File \"%s\", line %d, in %s\n",
-			_PyUnicode_AsString(f_code->co_filename),
-			f_code->co_firstlineno,
-			_PyUnicode_AsString(((PyFunctionObject *)py_func)->func_name)
-			);
+	        _PyUnicode_AsString(f_code->co_filename),
+	        f_code->co_firstlineno,
+	        _PyUnicode_AsString(((PyFunctionObject *)py_func)->func_name)
+	        );
 }
 
 /* operators and classes use this so it can store the args given but defer
@@ -372,7 +372,7 @@ static int bpy_struct_id_used(StructRNA *srna, char *identifier)
 
 /* Function that sets RNA, NOTE - self is NULL when called from python,
  * but being abused from C so we can pass the srna along.
- * This isnt incorrect since its a python object - but be careful */
+ * This isn't incorrect since its a python object - but be careful */
 PyDoc_STRVAR(BPy_BoolProperty_doc,
 ".. function:: BoolProperty(name=\"\", "
                            "description=\"\", "
@@ -399,7 +399,7 @@ static PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
 
 	if (srna) {
 		static const char *kwlist[] = {"attr", "name", "description", "default",
-		                              "options", "subtype", "update", NULL};
+		                               "options", "subtype", "update", NULL};
 		const char *id = NULL, *name = NULL, *description = "";
 		int id_len;
 		int def = 0;
@@ -475,7 +475,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject
 
 	if (srna) {
 		static const char *kwlist[] = {"attr", "name", "description", "default",
-		                              "options", "subtype", "size", "update", NULL};
+		                               "options", "subtype", "size", "update", NULL};
 		const char *id = NULL, *name = NULL, *description = "";
 		int id_len;
 		int def[PYRNA_STACK_ARRAY] = {0};
@@ -561,7 +561,7 @@ static PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
 
 	if (srna) {
 		static const char *kwlist[] = {"attr", "name", "description", "default",
-		                              "min", "max", "soft_min", "soft_max",
+		                               "min", "max", "soft_min", "soft_max",
 		                               "step", "options", "subtype", "update", NULL};
 		const char *id = NULL, *name = NULL, *description = "";
 		int id_len;
@@ -642,8 +642,8 @@ static PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject
 
 	if (srna) {
 		static const char *kwlist[] = {"attr", "name", "description", "default",
-		                              "min", "max", "soft_min", "soft_max",
-		                              "step", "options", "subtype", "size", "update", NULL};
+		                               "min", "max", "soft_min", "soft_max",
+		                               "step", "options", "subtype", "size", "update", NULL};
 		const char *id = NULL, *name = NULL, *description = "";
 		int id_len;
 		int min = INT_MIN, max = INT_MAX, soft_min = INT_MIN, soft_max = INT_MAX, step = 1;
@@ -736,8 +736,8 @@ static PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
 
 	if (srna) {
 		static const char *kwlist[] = {"attr", "name", "description", "default",
-		                              "min", "max", "soft_min", "soft_max",
-		                              "step", "precision", "options", "subtype", "unit", "update", NULL};
+		                               "min", "max", "soft_min", "soft_max",
+		                               "step", "precision", "options", "subtype", "unit", "update", NULL};
 		const char *id = NULL, *name = NULL, *description = "";
 		int id_len;
 		float min = -FLT_MAX, max = FLT_MAX, soft_min = -FLT_MAX, soft_max = FLT_MAX, step = 3, def = 0.0f;
@@ -829,8 +829,8 @@ static PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObjec
 
 	if (srna) {
 		static const char *kwlist[] = {"attr", "name", "description", "default",
-		                              "min", "max", "soft_min", "soft_max",
-		                              "step", "precision", "options", "subtype", "unit", "size", "update", NULL};
+		                               "min", "max", "soft_min", "soft_max",
+		                               "step", "precision", "options", "subtype", "unit", "size", "update", NULL};
 		const char *id = NULL, *name = NULL, *description = "";
 		int id_len;
 		float min = -FLT_MAX, max = FLT_MAX, soft_min = -FLT_MAX, soft_max = FLT_MAX, step = 3;
@@ -924,7 +924,7 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw
 
 	if (srna) {
 		static const char *kwlist[] = {"attr", "name", "description", "default",
-		                              "maxlen", "options", "subtype", "update", NULL};
+		                               "maxlen", "options", "subtype", "update", NULL};
 		const char *id = NULL, *name = NULL, *description = "", *def = "";
 		int id_len;
 		int maxlen = 0;
@@ -952,7 +952,7 @@ static PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw
 		}
 
 		prop = RNA_def_property(srna, id, PROP_STRING, subtype);
-		if (maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen + 1); /* +1 since it includes null terminator */
+		if (maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen + 1);  /* +1 since it includes null terminator */
 		if (def) RNA_def_property_string_default(prop, def);
 		RNA_def_property_ui_text(prop, name ? name : id, description);
 
@@ -1033,14 +1033,14 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
 
 		item = PySequence_Fast_GET_ITEM(seq_fast, i);
 
-		if ( (PyTuple_CheckExact(item)) &&
-		     (item_size = PyTuple_GET_SIZE(item)) &&
-		     (item_size == 3 || item_size == 4) &&
-		     (tmp.identifier =  _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 0), &id_str_size)) &&
-		     (tmp.name =        _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 1), &name_str_size)) &&
-		     (tmp.description = _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 2), &desc_str_size)) &&
-		     /* TODO, number isnt ensured to be unique from the script author */
-		     (item_size < 4 || py_long_as_int(PyTuple_GET_ITEM(item, 3), &tmp.value) != -1))
+		if ((PyTuple_CheckExact(item)) &&
+		    (item_size = PyTuple_GET_SIZE(item)) &&
+		    (item_size == 3 || item_size == 4) &&
+		    (tmp.identifier =  _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 0), &id_str_size)) &&
+		    (tmp.name =        _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 1), &name_str_size)) &&
+		    (tmp.description = _PyUnicode_AsStringAndSize(PyTuple_GET_ITEM(item, 2), &desc_str_size)) &&
+		    /* TODO, number isn't ensured to be unique from the script author */
+		    (item_size < 4 || py_long_as_int(PyTuple_GET_ITEM(item, 3), &tmp.value) != -1))
 		{
 			if (is_enum_flag) {
 				if (item_size < 4) {
@@ -1110,7 +1110,7 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
 	 * annoying because it works most of the time without this. */
 	{
 		EnumPropertyItem *items_dup = MEM_mallocN((sizeof(EnumPropertyItem) * (seq_len + 1)) + (sizeof(char) * totbuf),
-		                                         "enum_items_from_py2");
+		                                          "enum_items_from_py2");
 		EnumPropertyItem *items_ptr = items_dup;
 		char *buf = ((char *)items_dup) + (sizeof(EnumPropertyItem) * (seq_len + 1));
 		memcpy(items_dup, items, sizeof(EnumPropertyItem) * (seq_len + 1));
@@ -1162,7 +1162,7 @@ static EnumPropertyItem *bpy_props_enum_itemf(struct bContext *C, PointerRNA *pt
 		int defvalue_dummy = 0;
 
 		if (!(items_fast = PySequence_Fast(items, "EnumProperty(...): "
-		                                  "return value from the callback was not a sequence")))
+		                                   "return value from the callback was not a sequence")))
 		{
 			err = -1;
 		}
@@ -1230,7 +1230,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
 	
 	if (srna) {
 		static const char *kwlist[] = {"attr", "items", "name", "description", "default",
-		                              "options", "update", NULL};
+		                               "options", "update", NULL};
 		const char *id = NULL, *name = NULL, *description = "";
 		PyObject *def = NULL;
 		int id_len;
@@ -1260,7 +1260,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
 		}
 
 		/* items can be a list or a callable */
-		if (PyFunction_Check(items)) { /* dont use PyCallable_Check because we need the function code for errors */
+		if (PyFunction_Check(items)) { /* don't use PyCallable_Check because we need the function code for errors */
 			PyCodeObject *f_code = (PyCodeObject *)PyFunction_GET_CODE(items);
 			if (f_code->co_argcount != 2) {
 				PyErr_Format(PyExc_ValueError,
@@ -1281,7 +1281,7 @@ static PyObject *BPy_EnumProperty(PyObject *self, PyObject *args, PyObject *kw)
 		}
 		else {
 			if (!(items_fast = PySequence_Fast(items, "EnumProperty(...): "
-			                                  "expected a sequence of tuples for the enum items or a function")))
+			                                   "expected a sequence of tuples for the enum items or a function")))
 			{
 				return NULL;
 			}
@@ -1531,18 +1531,18 @@ static PyObject *BPy_RemoveProperty(PyObject *self, PyObject *args, PyObject *kw
 }
 
 static struct PyMethodDef props_methods[] = {
-	{"BoolProperty", (PyCFunction)BPy_BoolProperty, METH_VARARGS|METH_KEYWORDS, BPy_BoolProperty_doc},
-	{"BoolVectorProperty", (PyCFunction)BPy_BoolVectorProperty, METH_VARARGS|METH_KEYWORDS, BPy_BoolVectorProperty_doc},
-	{"IntProperty", (PyCFunction)BPy_IntProperty, METH_VARARGS|METH_KEYWORDS, BPy_IntProperty_doc},
-	{"IntVectorProperty", (PyCFunction)BPy_IntVectorProperty, METH_VARARGS|METH_KEYWORDS, BPy_IntVectorProperty_doc},
-	{"FloatProperty", (PyCFunction)BPy_FloatProperty, METH_VARARGS|METH_KEYWORDS, BPy_FloatProperty_doc},
-	{"FloatVectorProperty", (PyCFunction)BPy_FloatVectorProperty, METH_VARARGS|METH_KEYWORDS, BPy_FloatVectorProperty_doc},
-	{"StringProperty", (PyCFunction)BPy_StringProperty, METH_VARARGS|METH_KEYWORDS, BPy_StringProperty_doc},
-	{"EnumProperty", (PyCFunction)BPy_EnumProperty, METH_VARARGS|METH_KEYWORDS, BPy_EnumProperty_doc},
-	{"PointerProperty", (PyCFunction)BPy_PointerProperty, METH_VARARGS|METH_KEYWORDS, BPy_PointerProperty_doc},
-	{"CollectionProperty", (PyCFunction)BPy_CollectionProperty, METH_VARARGS|METH_KEYWORDS, BPy_CollectionProperty_doc},
-
-	{"RemoveProperty", (PyCFunction)BPy_RemoveProperty, METH_VARARGS|METH_KEYWORDS, BPy_RemoveProperty_doc},
+	{"BoolProperty", (PyCFunction)BPy_BoolProperty, METH_VARARGS | METH_KEYWORDS, BPy_BoolProperty_doc},
+	{"BoolVectorProperty", (PyCFunction)BPy_BoolVectorProperty, METH_VARARGS | METH_KEYWORDS, BPy_BoolVectorProperty_doc},
+	{"IntProperty", (PyCFunction)BPy_IntProperty, METH_VARARGS | METH_KEYWORDS, BPy_IntProperty_doc},
+	{"IntVectorProperty", (PyCFunction)BPy_IntVectorProperty, METH_VARARGS | METH_KEYWORDS, BPy_IntVectorProperty_doc},
+	{"FloatProperty", (PyCFunction)BPy_FloatProperty, METH_VARARGS | METH_KEYWORDS, BPy_FloatProperty_doc},
+	{"FloatVectorProperty", (PyCFunction)BPy_FloatVectorProperty, METH_VARARGS | METH_KEYWORDS, BPy_FloatVectorProperty_doc},
+	{"StringProperty", (PyCFunction)BPy_StringProperty, METH_VARARGS | METH_KEYWORDS, BPy_StringProperty_doc},
+	{"EnumProperty", (PyCFunction)BPy_EnumProperty, METH_VARARGS | METH_KEYWORDS, BPy_EnumProperty_doc},
+	{"PointerProperty", (PyCFunction)BPy_PointerProperty, METH_VARARGS | METH_KEYWORDS, BPy_PointerProperty_doc},
+	{"CollectionProperty", (PyCFunction)BPy_CollectionProperty, METH_VARARGS | METH_KEYWORDS, BPy_CollectionProperty_doc},
+
+	{"RemoveProperty", (PyCFunction)BPy_RemoveProperty, METH_VARARGS | METH_KEYWORDS, BPy_RemoveProperty_doc},
 	{NULL, NULL, 0, NULL}
 };
 
@@ -1551,7 +1551,7 @@ static struct PyModuleDef props_module = {
 	"bpy.props",
 	"This module defines properties to extend blenders internal data, the result of these functions"
 	" is used to assign properties to classes registered with blender and can't be used directly.",
-	-1,/* multiple "initialization" just copies the module dict. */
+	-1, /* multiple "initialization" just copies the module dict. */
 	props_methods,
 	NULL, NULL, NULL, NULL
 };
diff --git a/source/blender/python/intern/bpy_props.h b/source/blender/python/intern/bpy_props.h
index f7ec6d5..c9934ca 100644
--- a/source/blender/python/intern/bpy_props.h
+++ b/source/blender/python/intern/bpy_props.h
@@ -25,8 +25,8 @@
  */
 
 
-#ifndef BPY_PROPS_H
-#define BPY_PROPS_H
+#ifndef __BPY_PROPS_H__
+#define __BPY_PROPS_H__
 
 PyObject *BPY_rna_props(void);
 
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index fa2a20a..7259ea8 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -85,7 +85,7 @@
 #define USE_MATHUTILS
 #define USE_STRING_COERCE
 
-static PyObject* pyrna_struct_Subtype(PointerRNA *ptr);
+static PyObject *pyrna_struct_Subtype(PointerRNA *ptr);
 static PyObject *pyrna_prop_collection_values(BPy_PropertyRNA *self);
 
 #define BPY_DOC_ID_PROP_TYPE_NOTE                                             \
@@ -121,7 +121,7 @@ int pyrna_prop_validity_check(BPy_PropertyRNA *self)
 static 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 incase */
+	self->ptr.id.data = NULL; /* should not be needed but prevent bad pointer access, just in case */
 }
 #endif
 
@@ -372,7 +372,7 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po
 static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_eul_order, short order_fallback);
 
 /* bpyrna vector/euler/quat callbacks */
-static int mathutils_rna_array_cb_index = -1; /* index for our callbacks */
+static unsigned char mathutils_rna_array_cb_index = -1; /* index for our callbacks */
 
 /* subtype not used much yet */
 #define MATHUTILS_CB_SUBTYPE_EUL 0
@@ -508,16 +508,16 @@ static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int UNUSED(subtyp
 }
 
 static Mathutils_Callback mathutils_rna_array_cb = {
-	(BaseMathCheckFunc)		mathutils_rna_generic_check,
-	(BaseMathGetFunc)		mathutils_rna_vector_get,
-	(BaseMathSetFunc)		mathutils_rna_vector_set,
-	(BaseMathGetIndexFunc)	mathutils_rna_vector_get_index,
-	(BaseMathSetIndexFunc)	mathutils_rna_vector_set_index
+	(BaseMathCheckFunc)     mathutils_rna_generic_check,
+	(BaseMathGetFunc)       mathutils_rna_vector_get,
+	(BaseMathSetFunc)       mathutils_rna_vector_set,
+	(BaseMathGetIndexFunc)  mathutils_rna_vector_get_index,
+	(BaseMathSetIndexFunc)  mathutils_rna_vector_set_index
 };
 
 
 /* bpyrna matrix callbacks */
-static int mathutils_rna_matrix_cb_index = -1; /* index for our callbacks */
+static unsigned char mathutils_rna_matrix_cb_index = -1; /* index for our callbacks */
 
 static int mathutils_rna_matrix_get(BaseMathObject *bmo, int UNUSED(subtype))
 {
@@ -622,91 +622,91 @@ PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop)
 
 	if (totdim == 1 || (totdim == 2 && subtype == PROP_MATRIX)) {
 		if (!is_thick)
-			ret = pyrna_prop_CreatePyObject(ptr, prop); /* owned by the mathutils PyObject */
+			ret = pyrna_prop_CreatePyObject(ptr, prop);  /* owned by the mathutils PyObject */
 
 		switch (subtype) {
-		case PROP_ALL_VECTOR_SUBTYPES:
-			if (len >= 2 && len <= 4) {
-				if (is_thick) {
-					ret = Vector_CreatePyObject(NULL, len, Py_NEW, NULL);
-					RNA_property_float_get_array(ptr, prop, ((VectorObject *)ret)->vec);
-				}
-				else {
-					PyObject *vec_cb = Vector_CreatePyObject_cb(ret, len, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_VEC);
-					Py_DECREF(ret); /* the vector owns now */
-					ret = vec_cb; /* return the vector instead */
-				}
-			}
-			break;
-		case PROP_MATRIX:
-			if (len == 16) {
-				if (is_thick) {
-					ret = Matrix_CreatePyObject(NULL, 4, 4, Py_NEW, NULL);
-					RNA_property_float_get_array(ptr, prop, ((MatrixObject *)ret)->matrix);
-				}
-				else {
-					PyObject *mat_cb = Matrix_CreatePyObject_cb(ret, 4,4, mathutils_rna_matrix_cb_index, FALSE);
-					Py_DECREF(ret); /* the matrix owns now */
-					ret = mat_cb; /* return the matrix instead */
-				}
-			}
-			else if (len == 9) {
-				if (is_thick) {
-					ret = Matrix_CreatePyObject(NULL, 3, 3, Py_NEW, NULL);
-					RNA_property_float_get_array(ptr, prop, ((MatrixObject *)ret)->matrix);
-				}
-				else {
-					PyObject *mat_cb = Matrix_CreatePyObject_cb(ret, 3,3, mathutils_rna_matrix_cb_index, FALSE);
-					Py_DECREF(ret); /* the matrix owns now */
-					ret = mat_cb; /* return the matrix instead */
-				}
-			}
-			break;
-		case PROP_EULER:
-		case PROP_QUATERNION:
-			if (len == 3) { /* euler */
-				if (is_thick) {
-					/* attempt to get order, only needed for thick types since wrapped with update via callbacks */
-					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
-					RNA_property_float_get_array(ptr, prop, ((EulerObject *)ret)->eul);
+			case PROP_ALL_VECTOR_SUBTYPES:
+				if (len >= 2 && len <= 4) {
+					if (is_thick) {
+						ret = Vector_CreatePyObject(NULL, len, Py_NEW, NULL);
+						RNA_property_float_get_array(ptr, prop, ((VectorObject *)ret)->vec);
+					}
+					else {
+						PyObject *vec_cb = Vector_CreatePyObject_cb(ret, len, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_VEC);
+						Py_DECREF(ret); /* the vector owns now */
+						ret = vec_cb; /* return the vector instead */
+					}
 				}
-				else {
-					/* order will be updated from callback on use */
-					PyObject *eul_cb = Euler_CreatePyObject_cb(ret, EULER_ORDER_XYZ, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_EUL); // TODO, get order from RNA
-					Py_DECREF(ret); /* the euler owns now */
-					ret = eul_cb; /* return the euler instead */
+				break;
+			case PROP_MATRIX:
+				if (len == 16) {
+					if (is_thick) {
+						ret = Matrix_CreatePyObject(NULL, 4, 4, Py_NEW, NULL);
+						RNA_property_float_get_array(ptr, prop, ((MatrixObject *)ret)->matrix);
+					}
+					else {
+						PyObject *mat_cb = Matrix_CreatePyObject_cb(ret, 4, 4, mathutils_rna_matrix_cb_index, FALSE);
+						Py_DECREF(ret); /* the matrix owns now */
+						ret = mat_cb; /* return the matrix instead */
+					}
 				}
-			}
-			else if (len == 4) {
-				if (is_thick) {
-					ret = Quaternion_CreatePyObject(NULL, Py_NEW, NULL);
-					RNA_property_float_get_array(ptr, prop, ((QuaternionObject *)ret)->quat);
+				else if (len == 9) {
+					if (is_thick) {
+						ret = Matrix_CreatePyObject(NULL, 3, 3, Py_NEW, NULL);
+						RNA_property_float_get_array(ptr, prop, ((MatrixObject *)ret)->matrix);
+					}
+					else {
+						PyObject *mat_cb = Matrix_CreatePyObject_cb(ret, 3, 3, mathutils_rna_matrix_cb_index, FALSE);
+						Py_DECREF(ret); /* the matrix owns now */
+						ret = mat_cb; /* return the matrix instead */
+					}
 				}
-				else {
-					PyObject *quat_cb = Quaternion_CreatePyObject_cb(ret, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_QUAT);
-					Py_DECREF(ret); /* the quat owns now */
-					ret = quat_cb; /* return the quat instead */
+				break;
+			case PROP_EULER:
+			case PROP_QUATERNION:
+				if (len == 3) { /* euler */
+					if (is_thick) {
+						/* attempt to get order, only needed for thick types since wrapped with update via callbacks */
+						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
+						RNA_property_float_get_array(ptr, prop, ((EulerObject *)ret)->eul);
+					}
+					else {
+						/* order will be updated from callback on use */
+						PyObject *eul_cb = Euler_CreatePyObject_cb(ret, EULER_ORDER_XYZ, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_EUL); // TODO, get order from RNA
+						Py_DECREF(ret); /* the euler owns now */
+						ret = eul_cb; /* return the euler instead */
+					}
 				}
-			}
-			break;
-		case PROP_COLOR:
-		case PROP_COLOR_GAMMA:
-			if (len == 3) { /* color */
-				if (is_thick) {
-					ret = Color_CreatePyObject(NULL, Py_NEW, NULL); // TODO, get order from RNA
-					RNA_property_float_get_array(ptr, prop, ((ColorObject *)ret)->col);
+				else if (len == 4) {
+					if (is_thick) {
+						ret = Quaternion_CreatePyObject(NULL, Py_NEW, NULL);
+						RNA_property_float_get_array(ptr, prop, ((QuaternionObject *)ret)->quat);
+					}
+					else {
+						PyObject *quat_cb = Quaternion_CreatePyObject_cb(ret, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_QUAT);
+						Py_DECREF(ret); /* the quat owns now */
+						ret = quat_cb; /* return the quat instead */
+					}
 				}
-				else {
-					PyObject *col_cb = Color_CreatePyObject_cb(ret, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_COLOR);
-					Py_DECREF(ret); /* the color owns now */
-					ret = col_cb; /* return the color instead */
+				break;
+			case PROP_COLOR:
+			case PROP_COLOR_GAMMA:
+				if (len == 3) { /* color */
+					if (is_thick) {
+						ret = Color_CreatePyObject(NULL, Py_NEW, NULL); // TODO, get order from RNA
+						RNA_property_float_get_array(ptr, prop, ((ColorObject *)ret)->col);
+					}
+					else {
+						PyObject *col_cb = Color_CreatePyObject_cb(ret, mathutils_rna_array_cb_index, MATHUTILS_CB_SUBTYPE_COLOR);
+						Py_DECREF(ret); /* the color owns now */
+						ret = col_cb; /* return the color instead */
+					}
 				}
-			}
-		default:
-			break;
+			default:
+				break;
 		}
 	}
 
@@ -733,7 +733,7 @@ int pyrna_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int
 {
 	if (RNA_enum_value_from_id(item, identifier, value) == 0) {
 		const char *enum_str = BPy_enum_as_string(item);
-		PyErr_Format(PyExc_TypeError,
+		PyErr_Format(PyExc_ValueError,
 		             "%s: '%.200s' not found in (%s)",
 		             error_prefix, identifier, enum_str);
 		MEM_freeN((void *)enum_str);
@@ -756,15 +756,15 @@ int pyrna_enum_value_from_id(EnumPropertyItem *item, const char *identifier, int
 
 static int pyrna_struct_compare(BPy_StructRNA *a, BPy_StructRNA *b)
 {
-	return ( (a->ptr.data == b->ptr.data) &&
-	         (a->ptr.type == b->ptr.type)) ? 0 : -1;
+	return (((a->ptr.data == b->ptr.data) &&
+	         (a->ptr.type == b->ptr.type)) ? 0 : -1);
 }
 
 static int pyrna_prop_compare(BPy_PropertyRNA *a, BPy_PropertyRNA *b)
 {
-	return ( (a->prop == b->prop) &&
+	return (((a->prop == b->prop) &&
 	         (a->ptr.data == b->ptr.data) &&
-	         (a->ptr.type == b->ptr.type) ) ? 0 : -1;
+	         (a->ptr.type == b->ptr.type)) ? 0 : -1);
 }
 
 static PyObject *pyrna_struct_richcmp(PyObject *a, PyObject *b, int op)
@@ -776,21 +776,21 @@ static PyObject *pyrna_struct_richcmp(PyObject *a, PyObject *b, int op)
 		ok = pyrna_struct_compare((BPy_StructRNA *)a, (BPy_StructRNA *)b);
 
 	switch (op) {
-	case Py_NE:
-		ok = !ok; /* pass through */
-	case Py_EQ:
-		res = ok ? Py_False : Py_True;
-		break;
+		case Py_NE:
+			ok = !ok; /* pass through */
+		case Py_EQ:
+			res = ok ? Py_False : Py_True;
+			break;
 
-	case Py_LT:
-	case Py_LE:
-	case Py_GT:
-	case Py_GE:
-		res = Py_NotImplemented;
-		break;
-	default:
-		PyErr_BadArgument();
-		return NULL;
+		case Py_LT:
+		case Py_LE:
+		case Py_GT:
+		case Py_GE:
+			res = Py_NotImplemented;
+			break;
+		default:
+			PyErr_BadArgument();
+			return NULL;
 	}
 
 	return Py_INCREF(res), res;
@@ -805,21 +805,21 @@ static PyObject *pyrna_prop_richcmp(PyObject *a, PyObject *b, int op)
 		ok = pyrna_prop_compare((BPy_PropertyRNA *)a, (BPy_PropertyRNA *)b);
 
 	switch (op) {
-	case Py_NE:
-		ok = !ok; /* pass through */
-	case Py_EQ:
-		res = ok ? Py_False : Py_True;
-		break;
+		case Py_NE:
+			ok = !ok; /* pass through */
+		case Py_EQ:
+			res = ok ? Py_False : Py_True;
+			break;
 
-	case Py_LT:
-	case Py_LE:
-	case Py_GT:
-	case Py_GE:
-		res = Py_NotImplemented;
-		break;
-	default:
-		PyErr_BadArgument();
-		return NULL;
+		case Py_LT:
+		case Py_LE:
+		case Py_GT:
+		case Py_GE:
+			res = Py_NotImplemented;
+			break;
+		default:
+			PyErr_BadArgument();
+			return NULL;
 	}
 
 	return Py_INCREF(res), res;
@@ -840,8 +840,8 @@ static PyObject *pyrna_struct_str(BPy_StructRNA *self)
 	name = RNA_struct_name_get_alloc(&self->ptr, NULL, 0, NULL);
 	if (name) {
 		ret = PyUnicode_FromFormat("<bpy_struct, %.200s(\"%.200s\")>",
-		                          RNA_struct_identifier(self->ptr.type),
-		                          name);
+		                           RNA_struct_identifier(self->ptr.type),
+		                           name);
 		MEM_freeN((void *)name);
 		return ret;
 	}
@@ -858,30 +858,37 @@ static PyObject *pyrna_struct_repr(BPy_StructRNA *self)
 	PyObject *ret;
 
 	if (id == NULL || !PYRNA_STRUCT_IS_VALID(self))
-		return pyrna_struct_str(self); /* fallback */
+		return pyrna_struct_str(self);  /* fallback */
 
 	tmp_str = PyUnicode_FromString(id->name + 2);
 
 	if (RNA_struct_is_ID(self->ptr.type)) {
 		ret = PyUnicode_FromFormat("bpy.data.%s[%R]",
-		                            BKE_idcode_to_name_plural(GS(id->name)),
-		                            tmp_str);
+		                           BKE_idcode_to_name_plural(GS(id->name)),
+		                           tmp_str);
 	}
 	else {
 		const char *path;
 		path = RNA_path_from_ID_to_struct(&self->ptr);
 		if (path) {
-			ret = PyUnicode_FromFormat("bpy.data.%s[%R].%s",
-			                          BKE_idcode_to_name_plural(GS(id->name)),
-			                          tmp_str,
-			                          path);
+			if (GS(id->name) == ID_NT) { /* nodetree paths are not accurate */
+				ret = PyUnicode_FromFormat("bpy.data...%s",
+										   path);
+			}
+			else {
+				ret = PyUnicode_FromFormat("bpy.data.%s[%R].%s",
+				                           BKE_idcode_to_name_plural(GS(id->name)),
+				                           tmp_str,
+				                           path);
+			}
+
 			MEM_freeN((void *)path);
 		}
 		else { /* cant find, print something sane */
 			ret = PyUnicode_FromFormat("bpy.data.%s[%R]...%s",
-			                          BKE_idcode_to_name_plural(GS(id->name)),
-			                          tmp_str,
-			                          RNA_struct_identifier(self->ptr.type));
+			                           BKE_idcode_to_name_plural(GS(id->name)),
+			                           tmp_str,
+			                           RNA_struct_identifier(self->ptr.type));
 		}
 	}
 
@@ -912,7 +919,7 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self)
 		int len = -1;
 		char *c = type_fmt;
 
-		while ((*c++= tolower(*type_id++))) {} ;
+		while ((*c++ = tolower(*type_id++))) {}
 
 		if (type == PROP_COLLECTION) {
 			len = pyrna_prop_collection_length(self);
@@ -932,10 +939,10 @@ static PyObject *pyrna_prop_str(BPy_PropertyRNA *self)
 
 		if (name) {
 			ret = PyUnicode_FromFormat("<bpy_%.200s, %.200s.%.200s(\"%.200s\")>",
-			                          type_fmt,
-			                          RNA_struct_identifier(self->ptr.type),
-			                          RNA_property_identifier(self->prop),
-			                          name);
+			                           type_fmt,
+			                           RNA_struct_identifier(self->ptr.type),
+			                           RNA_property_identifier(self->prop),
+			                           name);
 			MEM_freeN((void *)name);
 			return ret;
 		}
@@ -965,23 +972,30 @@ static PyObject *pyrna_prop_repr(BPy_PropertyRNA *self)
 	PYRNA_PROP_CHECK_OBJ(self);
 
 	if (id == NULL)
-		return pyrna_prop_str(self); /* fallback */
+		return pyrna_prop_str(self);  /* fallback */
 
 	tmp_str = PyUnicode_FromString(id->name + 2);
 
 	path = RNA_path_from_ID_to_property(&self->ptr, self->prop);
 	if (path) {
-		ret = PyUnicode_FromFormat("bpy.data.%s[%R].%s",
-		                          BKE_idcode_to_name_plural(GS(id->name)),
-		                          tmp_str,
-		                          path);
+		if (GS(id->name) == ID_NT) { /* nodetree paths are not accurate */
+			ret = PyUnicode_FromFormat("bpy.data...%s",
+									   path);
+		}
+		else {
+			ret = PyUnicode_FromFormat("bpy.data.%s[%R].%s",
+			                           BKE_idcode_to_name_plural(GS(id->name)),
+			                           tmp_str,
+		    	                       path);
+		}
+
 		MEM_freeN((void *)path);
 	}
 	else { /* cant find, print something sane */
 		ret = PyUnicode_FromFormat("bpy.data.%s[%R]...%s",
-		                          BKE_idcode_to_name_plural(GS(id->name)),
-		                          tmp_str,
-		                          RNA_property_identifier(self->prop));
+		                           BKE_idcode_to_name_plural(GS(id->name)),
+		                           tmp_str,
+		                           RNA_property_identifier(self->prop));
 	}
 
 	Py_DECREF(tmp_str);
@@ -999,7 +1013,7 @@ static PyObject *pyrna_func_repr(BPy_FunctionRNA *self)
 }
 
 
-static long pyrna_struct_hash(BPy_StructRNA *self)
+static Py_hash_t pyrna_struct_hash(BPy_StructRNA *self)
 {
 	return _Py_HashPointer(self->ptr.data);
 }
@@ -1138,10 +1152,6 @@ static int pyrna_string_to_enum(PyObject *item, PointerRNA *ptr, PropertyRNA *pr
 		return -1;
 	}
 	else {
-		/* hack so that dynamic enums used for operator properties will be able to be built (i.e. context will be supplied to itemf)
-		 * and thus running defining operator buttons for such operators in UI will work */
-		RNA_def_property_clear_flag(prop, PROP_ENUM_NO_CONTEXT);
-
 		if (!RNA_property_enum_value(BPy_GetContext(), ptr, prop, param, val)) {
 			const char *enum_str = pyrna_enum_as_string(ptr, prop);
 			PyErr_Format(PyExc_TypeError,
@@ -1284,19 +1294,19 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
 			else {
 				const char *ptr_name = RNA_struct_name_get_alloc(ptr, NULL, 0, NULL);
 
-				/* prefer not fail silently incase of api errors, maybe disable it later */
+				/* prefer not fail silently in case of api errors, maybe disable it later */
 				printf("RNA Warning: Current value \"%d\" "
-					   "matches no enum in '%s', '%s', '%s'\n",
-					   val, RNA_struct_identifier(ptr->type),
-					   ptr_name, RNA_property_identifier(prop));
+				       "matches no enum in '%s', '%s', '%s'\n",
+				       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\" "
-							 "matches no enum in '%s', '%s', '%s'",
-							 val, RNA_struct_identifier(ptr->type),
-							 ptr_name, RNA_property_identifier(prop));
+				             "RNA Warning: Current value \"%d\" "
+				             "matches no enum in '%s', '%s', '%s'",
+				             val, RNA_struct_identifier(ptr->type),
+				             ptr_name, RNA_property_identifier(prop));
 
 				PyErr_Warn(PyExc_RuntimeWarning, error_str);
 #endif
@@ -1309,11 +1319,11 @@ static PyObject *pyrna_enum_to_py(PointerRNA *ptr, PropertyRNA *prop, int val)
 
 			if (free)
 				MEM_freeN(enum_item);
-			/*
+#if 0
 			PyErr_Format(PyExc_AttributeError,
 			             "RNA Error: Current value \"%d\" matches no enum", val);
 			ret = NULL;
-			*/
+#endif
 		}
 	}
 
@@ -1331,73 +1341,73 @@ PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
 
 	/* see if we can coorce into a python type - PropertyType */
 	switch (type) {
-	case PROP_BOOLEAN:
-		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));
-		break;
-	case PROP_FLOAT:
-		ret = PyFloat_FromDouble(RNA_property_float_get(ptr, prop));
-		break;
-	case PROP_STRING:
-	{
-		const int subtype = RNA_property_subtype(prop);
-		const char *buf;
-		int buf_len;
-		char buf_fixed[32];
+		case PROP_BOOLEAN:
+			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));
+			break;
+		case PROP_FLOAT:
+			ret = PyFloat_FromDouble(RNA_property_float_get(ptr, prop));
+			break;
+		case PROP_STRING:
+		{
+			const int subtype = RNA_property_subtype(prop);
+			const char *buf;
+			int buf_len;
+			char buf_fixed[32];
 
-		buf = RNA_property_string_get_alloc(ptr, prop, buf_fixed, sizeof(buf_fixed), &buf_len);
+			buf = RNA_property_string_get_alloc(ptr, prop, buf_fixed, sizeof(buf_fixed), &buf_len);
 #ifdef USE_STRING_COERCE
-		/* only file paths get special treatment, they may contain non utf-8 chars */
-		if (subtype == PROP_BYTESTRING) {
-			ret = PyBytes_FromStringAndSize(buf, buf_len);
-		}
-		else if (ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
-			ret = PyC_UnicodeFromByteAndSize(buf, buf_len);
-		}
-		else {
-			ret = PyUnicode_FromStringAndSize(buf, buf_len);
-		}
+			/* only file paths get special treatment, they may contain non utf-8 chars */
+			if (subtype == PROP_BYTESTRING) {
+				ret = PyBytes_FromStringAndSize(buf, buf_len);
+			}
+			else if (ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
+				ret = PyC_UnicodeFromByteAndSize(buf, buf_len);
+			}
+			else {
+				ret = PyUnicode_FromStringAndSize(buf, buf_len);
+			}
 #else // USE_STRING_COERCE
-		if (subtype == PROP_BYTESTRING) {
-			ret = PyBytes_FromStringAndSize(buf, buf_len);
-		}
-		else {
-			ret = PyUnicode_FromStringAndSize(buf, buf_len);
-		}
+			if (subtype == PROP_BYTESTRING) {
+				ret = PyBytes_FromStringAndSize(buf, buf_len);
+			}
+			else {
+				ret = PyUnicode_FromStringAndSize(buf, buf_len);
+			}
 #endif // USE_STRING_COERCE
-		if (buf_fixed != buf) {
-			MEM_freeN((void *)buf);
+			if (buf_fixed != buf) {
+				MEM_freeN((void *)buf);
+			}
+			break;
 		}
-		break;
-	}
-	case PROP_ENUM:
-	{
-		ret = pyrna_enum_to_py(ptr, prop, RNA_property_enum_get(ptr, prop));
-		break;
-	}
-	case PROP_POINTER:
-	{
-		PointerRNA newptr;
-		newptr = RNA_property_pointer_get(ptr, prop);
-		if (newptr.data) {
-			ret = pyrna_struct_CreatePyObject(&newptr);
+		case PROP_ENUM:
+		{
+			ret = pyrna_enum_to_py(ptr, prop, RNA_property_enum_get(ptr, prop));
+			break;
 		}
-		else {
-			ret = Py_None;
-			Py_INCREF(ret);
+		case PROP_POINTER:
+		{
+			PointerRNA newptr;
+			newptr = RNA_property_pointer_get(ptr, prop);
+			if (newptr.data) {
+				ret = pyrna_struct_CreatePyObject(&newptr);
+			}
+			else {
+				ret = Py_None;
+				Py_INCREF(ret);
+			}
+			break;
 		}
-		break;
-	}
-	case PROP_COLLECTION:
-		ret = pyrna_prop_CreatePyObject(ptr, prop);
-		break;
-	default:
-		PyErr_Format(PyExc_TypeError,
-		             "bpy_struct internal error: unknown type '%d' (pyrna_prop_to_py)", type);
-		ret = NULL;
-		break;
+		case PROP_COLLECTION:
+			ret = pyrna_prop_CreatePyObject(ptr, prop);
+			break;
+		default:
+			PyErr_Format(PyExc_TypeError,
+			             "bpy_struct internal error: unknown type '%d' (pyrna_prop_to_py)", type);
+			ret = NULL;
+			break;
 	}
 
 	return ret;
@@ -1412,7 +1422,7 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const cha
 	const char *arg_name = NULL;
 	PyObject *item;
 
-	totkw = kw ? PyDict_Size(kw):0;
+	totkw = kw ? PyDict_Size(kw) : 0;
 
 	RNA_STRUCT_BEGIN(ptr, prop) {
 		arg_name = RNA_property_identifier(prop);
@@ -1470,7 +1480,7 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const cha
 
 static PyObject *pyrna_func_to_py(PointerRNA *ptr, FunctionRNA *func)
 {
-	BPy_FunctionRNA* pyfunc = (BPy_FunctionRNA *) PyObject_NEW(BPy_FunctionRNA, &pyrna_func_Type);
+	BPy_FunctionRNA *pyfunc = (BPy_FunctionRNA *) PyObject_NEW(BPy_FunctionRNA, &pyrna_func_Type);
 	pyfunc->ptr = *ptr;
 	pyfunc->func = func;
 	return (PyObject *)pyfunc;
@@ -1494,298 +1504,310 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
 
 		/* see if we can coorce into a python type - PropertyType */
 		switch (type) {
-		case PROP_BOOLEAN:
-		{
-			int param;
-			/* prefer not to have an exception here
-			 * however so many poll functions return None or a valid Object.
-			 * its a hassle to convert these into a bool before returning, */
-			if (RNA_property_flag(prop) & PROP_OUTPUT)
-				param = PyObject_IsTrue(value);
-			else
-				param = PyLong_AsLong(value);
+			case PROP_BOOLEAN:
+			{
+				int param;
+				/* prefer not to have an exception here
+				 * however so many poll functions return None or a valid Object.
+				 * its a hassle to convert these into a bool before returning, */
+				if (RNA_property_flag(prop) & PROP_OUTPUT)
+					param = PyObject_IsTrue(value);
+				else
+					param = PyLong_AsLong(value);
 
-			if (param < 0) {
-				PyErr_Format(PyExc_TypeError,
-				             "%.200s %.200s.%.200s expected True/False or 0/1, not %.200s",
-				             error_prefix, RNA_struct_identifier(ptr->type),
-				             RNA_property_identifier(prop), Py_TYPE(value)->tp_name);
-				return -1;
-			}
-			else {
-				if (data)  *((int *)data)= param;
-				else       RNA_property_boolean_set(ptr, prop, param);
-			}
-			break;
-		}
-		case PROP_INT:
-		{
-			int overflow;
-			long param = PyLong_AsLongAndOverflow(value, &overflow);
-			if (overflow || (param > INT_MAX) || (param < INT_MIN)) {
-				PyErr_Format(PyExc_ValueError,
-				             "%.200s %.200s.%.200s value not in 'int' range "
-				             "(" STRINGIFY(INT_MIN) ", " STRINGIFY(INT_MAX) ")",
-				             error_prefix, RNA_struct_identifier(ptr->type),
-				             RNA_property_identifier(prop));
-				return -1;
-			}
-			else if (param == -1 && PyErr_Occurred()) {
-				PyErr_Format(PyExc_TypeError,
-				             "%.200s %.200s.%.200s expected an int type, not %.200s",
-				             error_prefix, RNA_struct_identifier(ptr->type),
-				             RNA_property_identifier(prop), Py_TYPE(value)->tp_name);
-				return -1;
-			}
-			else {
-				int param_i = (int)param;
-				RNA_property_int_clamp(ptr, prop, &param_i);
-				if (data)  *((int *)data)= param_i;
-				else       RNA_property_int_set(ptr, prop, param_i);
+				if (param < 0) {
+					PyErr_Format(PyExc_TypeError,
+					             "%.200s %.200s.%.200s expected True/False or 0/1, not %.200s",
+					             error_prefix, RNA_struct_identifier(ptr->type),
+					             RNA_property_identifier(prop), Py_TYPE(value)->tp_name);
+					return -1;
+				}
+				else {
+					if (data) *((int *)data) = param;
+					else RNA_property_boolean_set(ptr, prop, param);
+				}
+				break;
 			}
-			break;
-		}
-		case PROP_FLOAT:
-		{
-			float param = PyFloat_AsDouble(value);
-			if (PyErr_Occurred()) {
-				PyErr_Format(PyExc_TypeError,
-				             "%.200s %.200s.%.200s expected a float type, not %.200s",
-				             error_prefix, RNA_struct_identifier(ptr->type),
-				             RNA_property_identifier(prop), Py_TYPE(value)->tp_name);
-				return -1;
+			case PROP_INT:
+			{
+				int overflow;
+				long param = PyLong_AsLongAndOverflow(value, &overflow);
+				if (overflow || (param > INT_MAX) || (param < INT_MIN)) {
+					PyErr_Format(PyExc_ValueError,
+					             "%.200s %.200s.%.200s value not in 'int' range "
+					             "(" STRINGIFY(INT_MIN) ", " STRINGIFY(INT_MAX) ")",
+					             error_prefix, RNA_struct_identifier(ptr->type),
+					             RNA_property_identifier(prop));
+					return -1;
+				}
+				else if (param == -1 && PyErr_Occurred()) {
+					PyErr_Format(PyExc_TypeError,
+					             "%.200s %.200s.%.200s expected an int type, not %.200s",
+					             error_prefix, RNA_struct_identifier(ptr->type),
+					             RNA_property_identifier(prop), Py_TYPE(value)->tp_name);
+					return -1;
+				}
+				else {
+					int param_i = (int)param;
+					RNA_property_int_clamp(ptr, prop, &param_i);
+					if (data) *((int *)data) = param_i;
+					else RNA_property_int_set(ptr, prop, param_i);
+				}
+				break;
 			}
-			else {
-				RNA_property_float_clamp(ptr, prop, (float *)&param);
-				if (data)   *((float *)data)= param;
-				else        RNA_property_float_set(ptr, prop, param);
+			case PROP_FLOAT:
+			{
+				float param = PyFloat_AsDouble(value);
+				if (PyErr_Occurred()) {
+					PyErr_Format(PyExc_TypeError,
+					             "%.200s %.200s.%.200s expected a float type, not %.200s",
+					             error_prefix, RNA_struct_identifier(ptr->type),
+					             RNA_property_identifier(prop), Py_TYPE(value)->tp_name);
+					return -1;
+				}
+				else {
+					RNA_property_float_clamp(ptr, prop, (float *)&param);
+					if (data) *((float *)data) = param;
+					else RNA_property_float_set(ptr, prop, param);
+				}
+				break;
 			}
-			break;
-		}
-		case PROP_STRING:
-		{
-			const int subtype = RNA_property_subtype(prop);
-			const char *param;
+			case PROP_STRING:
+			{
+				const int subtype = RNA_property_subtype(prop);
+				const char *param;
 
-			if (subtype == PROP_BYTESTRING) {
+				if (subtype == PROP_BYTESTRING) {
 
-				/* Byte String */
+					/* Byte String */
 
-				param = PyBytes_AsString(value);
+					param = PyBytes_AsString(value);
 
-				if (param == NULL) {
-					if (PyBytes_Check(value)) {
-						/* there was an error assigning a string type,
-						 * rather than setting a new error, prefix the existing one
-						 */
-						PyC_Err_Format_Prefix(PyExc_TypeError,
-						                      "%.200s %.200s.%.200s error assigning bytes",
-						                      error_prefix, RNA_struct_identifier(ptr->type),
-						                      RNA_property_identifier(prop));
+					if (param == NULL) {
+						if (PyBytes_Check(value)) {
+							/* there was an error assigning a string type,
+							 * rather than setting a new error, prefix the existing one
+							 */
+							PyC_Err_Format_Prefix(PyExc_TypeError,
+							                      "%.200s %.200s.%.200s error assigning bytes",
+							                      error_prefix, RNA_struct_identifier(ptr->type),
+							                      RNA_property_identifier(prop));
+						}
+						else {
+							PyErr_Format(PyExc_TypeError,
+							             "%.200s %.200s.%.200s expected a bytes type, not %.200s",
+							             error_prefix, RNA_struct_identifier(ptr->type),
+							             RNA_property_identifier(prop), Py_TYPE(value)->tp_name);
+						}
+
+						return -1;
 					}
 					else {
-						PyErr_Format(PyExc_TypeError,
-						             "%.200s %.200s.%.200s expected a bytes type, not %.200s",
-						             error_prefix, RNA_struct_identifier(ptr->type),
-						             RNA_property_identifier(prop), Py_TYPE(value)->tp_name);
+						/* same as unicode */
+						if (data) *((char **)data) = (char *)param;  /*XXX, this is suspect but needed for function calls, need to see if theres a better way */
+						else RNA_property_string_set(ptr, prop, param);
 					}
-
-					return -1;
 				}
 				else {
-					/* same as unicode */
-					if (data)   *((char **)data)= (char *)param; /*XXX, this is suspect but needed for function calls, need to see if theres a better way */
-					else        RNA_property_string_set(ptr, prop, param);
-				}
-			}
-			else {
 
-				/* Unicode String */
+					/* Unicode String */
 
 #ifdef USE_STRING_COERCE
-				PyObject *value_coerce = NULL;
-				if (ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
-					/* TODO, get size */
-					param = PyC_UnicodeAsByte(value, &value_coerce);
-				}
-				else {
-					param = _PyUnicode_AsString(value);
-#ifdef WITH_INTERNATIONAL
-					if (subtype == PROP_TRANSLATE) {
-						param = IFACE_(param);
+					PyObject *value_coerce = NULL;
+					if (ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
+						/* TODO, get size */
+						param = PyC_UnicodeAsByte(value, &value_coerce);
 					}
+					else {
+						param = _PyUnicode_AsString(value);
+#ifdef WITH_INTERNATIONAL
+						if (subtype == PROP_TRANSLATE) {
+							param = IFACE_(param);
+						}
 #endif // WITH_INTERNATIONAL
 
-				}
+					}
 #else // USE_STRING_COERCE
-				param = _PyUnicode_AsString(value);
+					param = _PyUnicode_AsString(value);
 #endif // USE_STRING_COERCE
 
-				if (param == NULL) {
-					if (PyUnicode_Check(value)) {
-						/* there was an error assigning a string type,
-						 * rather than setting a new error, prefix the existing one
-						 */
-						PyC_Err_Format_Prefix(PyExc_TypeError,
-						                      "%.200s %.200s.%.200s error assigning string",
-						                      error_prefix, RNA_struct_identifier(ptr->type),
-						                      RNA_property_identifier(prop));
+					if (param == NULL) {
+						if (PyUnicode_Check(value)) {
+							/* there was an error assigning a string type,
+							 * rather than setting a new error, prefix the existing one
+							 */
+							PyC_Err_Format_Prefix(PyExc_TypeError,
+							                      "%.200s %.200s.%.200s error assigning string",
+							                      error_prefix, RNA_struct_identifier(ptr->type),
+							                      RNA_property_identifier(prop));
+						}
+						else {
+							PyErr_Format(PyExc_TypeError,
+							             "%.200s %.200s.%.200s expected a string type, not %.200s",
+							             error_prefix, RNA_struct_identifier(ptr->type),
+							             RNA_property_identifier(prop), Py_TYPE(value)->tp_name);
+						}
+
+						return -1;
 					}
 					else {
-						PyErr_Format(PyExc_TypeError,
-						             "%.200s %.200s.%.200s expected a string type, not %.200s",
-						             error_prefix, RNA_struct_identifier(ptr->type),
-						             RNA_property_identifier(prop), Py_TYPE(value)->tp_name);
+						/* same as bytes */
+						if (data) *((char **)data) = (char *)param;  /*XXX, this is suspect but needed for function calls, need to see if theres a better way */
+						else RNA_property_string_set(ptr, prop, param);
 					}
-
-					return -1;
-				}
-				else {
-					/* same as bytes */
-					if (data)   *((char **)data)= (char *)param; /*XXX, this is suspect but needed for function calls, need to see if theres a better way */
-					else        RNA_property_string_set(ptr, prop, param);
-				}
 #ifdef USE_STRING_COERCE
-				Py_XDECREF(value_coerce);
+					Py_XDECREF(value_coerce);
 #endif // USE_STRING_COERCE
+				}
+				break;
 			}
-			break;
-		}
-		case PROP_ENUM:
-		{
-			int val = 0;
+			case PROP_ENUM:
+			{
+				int val = 0;
 
-			/* type checkins is done by each function */
-			if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
-				/* set of enum items, concatenate all values with OR */
-				if (pyrna_prop_to_enum_bitfield(ptr, prop, value, &val, error_prefix) < 0) {
-					return -1;
+				/* type checkins is done by each function */
+				if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
+					/* set of enum items, concatenate all values with OR */
+					if (pyrna_prop_to_enum_bitfield(ptr, prop, value, &val, error_prefix) < 0) {
+						return -1;
+					}
 				}
-			}
-			else {
-				/* simple enum string */
-				if (pyrna_string_to_enum(value, ptr, prop, &val, error_prefix) < 0) {
-					return -1;
+				else {
+					/* simple enum string */
+					if (pyrna_string_to_enum(value, ptr, prop, &val, error_prefix) < 0) {
+						return -1;
+					}
 				}
-			}
 
-			if (data)  *((int *)data)= val;
-			else       RNA_property_enum_set(ptr, prop, val);
+				if (data) *((int *)data) = val;
+				else RNA_property_enum_set(ptr, prop, val);
 
-			break;
-		}
-		case PROP_POINTER:
-		{
-			PyObject *value_new = NULL;
-
-			StructRNA *ptr_type = RNA_property_pointer_type(ptr, prop);
-			int flag = RNA_property_flag(prop);
-
-			/* this is really nasty!, so we can fake the operator having direct properties eg:
-			 * layout.prop(self, "filepath")
-			 * ... which infact should be
-			 * layout.prop(self.properties, "filepath")
-			 *
-			 * we need to do this trick.
-			 * if the prop is not an operator type and the pyobject is an operator,
-			 * use its properties in place of its self.
-			 *
-			 * this is so bad that its almost a good reason to do away with fake 'self.properties -> self' class mixing
-			 * if this causes problems in the future it should be removed.
-			 */
-			if ((ptr_type == &RNA_AnyType) &&
-				(BPy_StructRNA_Check(value)) &&
-				(RNA_struct_is_a(((BPy_StructRNA *)value)->ptr.type, &RNA_Operator))
-			) {
-				value = PyObject_GetAttrString(value, "properties");
-				value_new = value;
+				break;
 			}
+			case PROP_POINTER:
+			{
+				PyObject *value_new = NULL;
+
+				StructRNA *ptr_type = RNA_property_pointer_type(ptr, prop);
+				int flag = RNA_property_flag(prop);
+
+				/* this is really nasty!, so we can fake the operator having direct properties eg:
+				 * layout.prop(self, "filepath")
+				 * ... which infact should be
+				 * layout.prop(self.properties, "filepath")
+				 *
+				 * we need to do this trick.
+				 * if the prop is not an operator type and the pyobject is an operator,
+				 * use its properties in place of its self.
+				 *
+				 * this is so bad that its almost a good reason to do away with fake 'self.properties -> self' class mixing
+				 * if this causes problems in the future it should be removed.
+				 */
+				if ((ptr_type == &RNA_AnyType) &&
+				    (BPy_StructRNA_Check(value)) &&
+				    (RNA_struct_is_a(((BPy_StructRNA *)value)->ptr.type, &RNA_Operator)))
+				{
+					value = PyObject_GetAttrString(value, "properties");
+					value_new = value;
+				}
 
 
-			/* if property is an OperatorProperties pointer and value is a map,
-			 * forward back to pyrna_pydict_to_props */
-			if (RNA_struct_is_a(ptr_type, &RNA_OperatorProperties) && PyDict_Check(value)) {
-				PointerRNA opptr = RNA_property_pointer_get(ptr, prop);
-				return pyrna_pydict_to_props(&opptr, value, 0, error_prefix);
-			}
+				/* if property is an OperatorProperties pointer and value is a map,
+				 * forward back to pyrna_pydict_to_props */
+				if (RNA_struct_is_a(ptr_type, &RNA_OperatorProperties) && PyDict_Check(value)) {
+					PointerRNA opptr = RNA_property_pointer_get(ptr, prop);
+					return pyrna_pydict_to_props(&opptr, value, 0, error_prefix);
+				}
 
-			/* another exception, allow to pass a collection as an RNA property */
-			if (Py_TYPE(value) == &pyrna_prop_collection_Type) { /* ok to ignore idprop collections */
-				PointerRNA c_ptr;
-				BPy_PropertyRNA *value_prop = (BPy_PropertyRNA *)value;
-				if (RNA_property_collection_type_get(&value_prop->ptr, value_prop->prop, &c_ptr)) {
-					value = pyrna_struct_CreatePyObject(&c_ptr);
-					value_new = value;
+				/* another exception, allow to pass a collection as an RNA property */
+				if (Py_TYPE(value) == &pyrna_prop_collection_Type) { /* ok to ignore idprop collections */
+					PointerRNA c_ptr;
+					BPy_PropertyRNA *value_prop = (BPy_PropertyRNA *)value;
+					if (RNA_property_collection_type_get(&value_prop->ptr, value_prop->prop, &c_ptr)) {
+						value = pyrna_struct_CreatePyObject(&c_ptr);
+						value_new = value;
+					}
+					else {
+						PyErr_Format(PyExc_TypeError,
+						             "%.200s %.200s.%.200s collection has no type, "
+						             "cant be used as a %.200s type",
+						             error_prefix, RNA_struct_identifier(ptr->type),
+						             RNA_property_identifier(prop), RNA_struct_identifier(ptr_type));
+						return -1;
+					}
 				}
-				else {
+
+				if (!BPy_StructRNA_Check(value) && value != Py_None) {
+					PyErr_Format(PyExc_TypeError,
+					             "%.200s %.200s.%.200s expected a %.200s type, not %.200s",
+					             error_prefix, RNA_struct_identifier(ptr->type),
+					             RNA_property_identifier(prop), RNA_struct_identifier(ptr_type),
+					             Py_TYPE(value)->tp_name);
+					Py_XDECREF(value_new); return -1;
+				}
+				else if ((flag & PROP_NEVER_NULL) && value == Py_None) {
 					PyErr_Format(PyExc_TypeError,
-					             "%.200s %.200s.%.200s collection has no type, "
-					             "cant be used as a %.200s type",
+					             "%.200s %.200s.%.200s does not support a 'None' assignment %.200s type",
 					             error_prefix, RNA_struct_identifier(ptr->type),
 					             RNA_property_identifier(prop), RNA_struct_identifier(ptr_type));
-					return -1;
+					Py_XDECREF(value_new); return -1;
 				}
-			}
-
-			if (!BPy_StructRNA_Check(value) && value != Py_None) {
-				PyErr_Format(PyExc_TypeError,
-				             "%.200s %.200s.%.200s expected a %.200s type, not %.200s",
-				             error_prefix, RNA_struct_identifier(ptr->type),
-				             RNA_property_identifier(prop), RNA_struct_identifier(ptr_type),
-				             Py_TYPE(value)->tp_name);
-				Py_XDECREF(value_new); return -1;
-			}
-			else if ((flag & PROP_NEVER_NULL) && value == Py_None) {
-				PyErr_Format(PyExc_TypeError,
-				             "%.200s %.200s.%.200s does not support a 'None' assignment %.200s type",
-				             error_prefix, RNA_struct_identifier(ptr->type),
-				             RNA_property_identifier(prop), RNA_struct_identifier(ptr_type));
-				Py_XDECREF(value_new); return -1;
-			}
-			else if ((value != Py_None) &&
-			         ((flag & PROP_ID_SELF_CHECK) && ptr->id.data == ((BPy_StructRNA *)value)->ptr.id.data))
-			{
-				PyErr_Format(PyExc_TypeError,
-				             "%.200s %.200s.%.200s ID type does not support assignment to its self",
-				             error_prefix, RNA_struct_identifier(ptr->type),
-				             RNA_property_identifier(prop));
-				Py_XDECREF(value_new); return -1;
-			}
-			else {
-				BPy_StructRNA *param = (BPy_StructRNA *)value;
-				int raise_error = FALSE;
-				if (data) {
-
-					if (flag & PROP_RNAPTR) {
-						if (value == Py_None)
-							memset(data, 0, sizeof(PointerRNA));
-						else
-							*((PointerRNA *)data)= param->ptr;
-					}
-					else if (value == Py_None) {
-						*((void **)data)= NULL;
-					}
-					else if (RNA_struct_is_a(param->ptr.type, ptr_type)) {
-						*((void **)data)= param->ptr.data;
-					}
-					else {
-						raise_error = TRUE;
-					}
+				else if ((value != Py_None) &&
+				         ((flag & PROP_ID_SELF_CHECK) && ptr->id.data == ((BPy_StructRNA *)value)->ptr.id.data))
+				{
+					PyErr_Format(PyExc_TypeError,
+					             "%.200s %.200s.%.200s ID type does not support assignment to its self",
+					             error_prefix, RNA_struct_identifier(ptr->type),
+					             RNA_property_identifier(prop));
+					Py_XDECREF(value_new); return -1;
 				}
 				else {
-					/* data == NULL, assign to RNA */
-					if (value == Py_None) {
-						PointerRNA valueptr = {{NULL}};
-						RNA_property_pointer_set(ptr, prop, valueptr);
-					}
-					else if (RNA_struct_is_a(param->ptr.type, ptr_type)) {
-						RNA_property_pointer_set(ptr, prop, param->ptr);
+					BPy_StructRNA *param = (BPy_StructRNA *)value;
+					int raise_error = FALSE;
+					if (data) {
+
+						if (flag & PROP_RNAPTR) {
+							if (value == Py_None)
+								memset(data, 0, sizeof(PointerRNA));
+							else
+								*((PointerRNA *)data) = param->ptr;
+						}
+						else if (value == Py_None) {
+							*((void **)data) = NULL;
+						}
+						else if (RNA_struct_is_a(param->ptr.type, ptr_type)) {
+							*((void **)data) = param->ptr.data;
+						}
+						else {
+							raise_error = TRUE;
+						}
 					}
 					else {
+						/* data == NULL, assign to RNA */
+						if (value == Py_None) {
+							PointerRNA valueptr = {{NULL}};
+							RNA_property_pointer_set(ptr, prop, valueptr);
+						}
+						else if (RNA_struct_is_a(param->ptr.type, ptr_type)) {
+							RNA_property_pointer_set(ptr, prop, param->ptr);
+						}
+						else {
+							PointerRNA tmp;
+							RNA_pointer_create(NULL, ptr_type, NULL, &tmp);
+							PyErr_Format(PyExc_TypeError,
+							             "%.200s %.200s.%.200s expected a %.200s type. not %.200s",
+							             error_prefix, RNA_struct_identifier(ptr->type),
+							             RNA_property_identifier(prop), RNA_struct_identifier(tmp.type),
+							             RNA_struct_identifier(param->ptr.type));
+							Py_XDECREF(value_new); return -1;
+						}
+					}
+
+					if (raise_error) {
 						PointerRNA tmp;
 						RNA_pointer_create(NULL, ptr_type, NULL, &tmp);
 						PyErr_Format(PyExc_TypeError,
-						             "%.200s %.200s.%.200s expected a %.200s type. not %.200s",
+						             "%.200s %.200s.%.200s expected a %.200s type, not %.200s",
 						             error_prefix, RNA_struct_identifier(ptr->type),
 						             RNA_property_identifier(prop), RNA_struct_identifier(tmp.type),
 						             RNA_struct_identifier(param->ptr.type));
@@ -1793,98 +1815,86 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
 					}
 				}
 
-				if (raise_error) {
-					PointerRNA tmp;
-					RNA_pointer_create(NULL, ptr_type, NULL, &tmp);
-					PyErr_Format(PyExc_TypeError,
-					             "%.200s %.200s.%.200s expected a %.200s type, not %.200s",
-					             error_prefix, RNA_struct_identifier(ptr->type),
-					             RNA_property_identifier(prop), RNA_struct_identifier(tmp.type),
-					             RNA_struct_identifier(param->ptr.type));
-					Py_XDECREF(value_new); return -1;
-				}
-			}
-
-			Py_XDECREF(value_new);
-
-			break;
-		}
-		case PROP_COLLECTION:
-		{
-			Py_ssize_t seq_len, i;
-			PyObject *item;
-			PointerRNA itemptr;
-			ListBase *lb;
-			CollectionPointerLink *link;
-
-			lb = (data) ? (ListBase *)data : NULL;
+				Py_XDECREF(value_new);
 
-			/* convert a sequence of dict's into a collection */
-			if (!PySequence_Check(value)) {
-				PyErr_Format(PyExc_TypeError,
-				             "%.200s %.200s.%.200s expected a sequence for an RNA collection, not %.200s",
-				             error_prefix, RNA_struct_identifier(ptr->type),
-				             RNA_property_identifier(prop), Py_TYPE(value)->tp_name);
-				return -1;
+				break;
 			}
+			case PROP_COLLECTION:
+			{
+				Py_ssize_t seq_len, i;
+				PyObject *item;
+				PointerRNA itemptr;
+				ListBase *lb;
+				CollectionPointerLink *link;
+
+				lb = (data) ? (ListBase *)data : NULL;
 
-			seq_len = PySequence_Size(value);
-			for (i = 0; i < seq_len; i++) {
-				item = PySequence_GetItem(value, i);
-
-				if (item == NULL) {
-					PyErr_Format(PyExc_TypeError,
-					             "%.200s %.200s.%.200s failed to get sequence index '%d' for an RNA collection",
-					             error_prefix, RNA_struct_identifier(ptr->type),
-					             RNA_property_identifier(prop), i);
-					Py_XDECREF(item);
-					return -1;
-				}
-
-				if (PyDict_Check(item) == 0) {
+				/* convert a sequence of dict's into a collection */
+				if (!PySequence_Check(value)) {
 					PyErr_Format(PyExc_TypeError,
-					             "%.200s %.200s.%.200s expected a each sequence "
-					             "member to be a dict for an RNA collection, not %.200s",
+					             "%.200s %.200s.%.200s expected a sequence for an RNA collection, not %.200s",
 					             error_prefix, RNA_struct_identifier(ptr->type),
-					             RNA_property_identifier(prop), Py_TYPE(item)->tp_name);
-					Py_XDECREF(item);
+					             RNA_property_identifier(prop), Py_TYPE(value)->tp_name);
 					return -1;
 				}
 
-				if (lb) {
-					link = MEM_callocN(sizeof(CollectionPointerLink), "PyCollectionPointerLink");
-					link->ptr = itemptr;
-					BLI_addtail(lb, link);
-				}
-				else
-					RNA_property_collection_add(ptr, prop, &itemptr);
+				seq_len = PySequence_Size(value);
+				for (i = 0; i < seq_len; i++) {
+					item = PySequence_GetItem(value, i);
 
-				if (pyrna_pydict_to_props(&itemptr, item, 1, "Converting a python list to an RNA collection") == -1) {
-					PyObject *msg = PyC_ExceptionBuffer();
-					const char *msg_char = _PyUnicode_AsString(msg);
+					if (item == NULL) {
+						PyErr_Format(PyExc_TypeError,
+						             "%.200s %.200s.%.200s failed to get sequence index '%d' for an RNA collection",
+						             error_prefix, RNA_struct_identifier(ptr->type),
+						             RNA_property_identifier(prop), i);
+						Py_XDECREF(item);
+						return -1;
+					}
 
-					PyErr_Format(PyExc_TypeError,
-					             "%.200s %.200s.%.200s error converting a member of a collection "
-					             "from a dicts into an RNA collection, failed with: %s",
-					             error_prefix, RNA_struct_identifier(ptr->type),
-					             RNA_property_identifier(prop), msg_char);
+					if (PyDict_Check(item) == 0) {
+						PyErr_Format(PyExc_TypeError,
+						             "%.200s %.200s.%.200s expected a each sequence "
+						             "member to be a dict for an RNA collection, not %.200s",
+						             error_prefix, RNA_struct_identifier(ptr->type),
+						             RNA_property_identifier(prop), Py_TYPE(item)->tp_name);
+						Py_XDECREF(item);
+						return -1;
+					}
+
+					if (lb) {
+						link = MEM_callocN(sizeof(CollectionPointerLink), "PyCollectionPointerLink");
+						link->ptr = itemptr;
+						BLI_addtail(lb, link);
+					}
+					else
+						RNA_property_collection_add(ptr, prop, &itemptr);
+
+					if (pyrna_pydict_to_props(&itemptr, item, 1, "Converting a python list to an RNA collection") == -1) {
+						PyObject *msg = PyC_ExceptionBuffer();
+						const char *msg_char = _PyUnicode_AsString(msg);
+
+						PyErr_Format(PyExc_TypeError,
+						             "%.200s %.200s.%.200s error converting a member of a collection "
+						             "from a dicts into an RNA collection, failed with: %s",
+						             error_prefix, RNA_struct_identifier(ptr->type),
+						             RNA_property_identifier(prop), msg_char);
 
+						Py_DECREF(item);
+						Py_DECREF(msg);
+						return -1;
+					}
 					Py_DECREF(item);
-					Py_DECREF(msg);
-					return -1;
 				}
-				Py_DECREF(item);
-			}
 
-			break;
-		}
-		default:
-			PyErr_Format(PyExc_AttributeError,
-			             "%.200s %.200s.%.200s unknown property type (pyrna_py_to_prop)",
-			             error_prefix, RNA_struct_identifier(ptr->type),
-			             RNA_property_identifier(prop));
-			return -1;
-			break;
+				break;
+			}
+			default:
+				PyErr_Format(PyExc_AttributeError,
+				             "%.200s %.200s.%.200s unknown property type (pyrna_py_to_prop)",
+				             error_prefix, RNA_struct_identifier(ptr->type),
+				             RNA_property_identifier(prop));
+				return -1;
+				break;
 		}
 	}
 
@@ -1920,7 +1930,7 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P
 	else {
 		/* see if we can coerce into a python type - PropertyType */
 		switch (RNA_property_type(prop)) {
-		case PROP_BOOLEAN:
+			case PROP_BOOLEAN:
 			{
 				int param = PyLong_AsLong(value);
 
@@ -1933,7 +1943,7 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P
 				}
 				break;
 			}
-		case PROP_INT:
+			case PROP_INT:
 			{
 				int param = PyLong_AsLong(value);
 				if (param == -1 && PyErr_Occurred()) {
@@ -1946,7 +1956,7 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P
 				}
 				break;
 			}
-		case PROP_FLOAT:
+			case PROP_FLOAT:
 			{
 				float param = PyFloat_AsDouble(value);
 				if (PyErr_Occurred()) {
@@ -1959,10 +1969,10 @@ static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, P
 				}
 				break;
 			}
-		default:
-			PyErr_SetString(PyExc_AttributeError, "not an array type");
-			ret = -1;
-			break;
+			default:
+				PyErr_SetString(PyExc_AttributeError, "not an array type");
+				ret = -1;
+				break;
 		}
 	}
 
@@ -2172,9 +2182,9 @@ int pyrna_prop_collection_subscript_str_lib_pair_ptr(BPy_PropertyRNA *self, PyOb
 			if (lib == NULL) {
 				if (err_not_found) {
 					PyErr_Format(PyExc_KeyError,
-								 "%s: lib name '%.240s' "
-								 "does not reference a valid library",
-								 err_prefix, keylib_str);
+					             "%s: lib name '%.240s' "
+					             "does not reference a valid library",
+					             err_prefix, keylib_str);
 					return -1;
 				}
 				else {
@@ -2300,7 +2310,7 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po
 	}
 	else {
 		switch (RNA_property_type(prop)) {
-		case PROP_FLOAT:
+			case PROP_FLOAT:
 			{
 				float values_stack[PYRNA_STACK_ARRAY];
 				float *values;
@@ -2309,30 +2319,30 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, Po
 				RNA_property_float_get_array(ptr, prop, values);
 
 				for (count = start; count < stop; count++)
-					PyTuple_SET_ITEM(tuple, count-start, PyFloat_FromDouble(values[count]));
+					PyTuple_SET_ITEM(tuple, count - start, PyFloat_FromDouble(values[count]));
 
 				if (values != values_stack) {
 					PyMem_FREE(values);
 				}
 				break;
 			}
-		case PROP_BOOLEAN:
+			case PROP_BOOLEAN:
 			{
 				int values_stack[PYRNA_STACK_ARRAY];
 				int *values;
-				if (length > PYRNA_STACK_ARRAY)	{ values = PyMem_MALLOC(sizeof(int) * length); }
+				if (length > PYRNA_STACK_ARRAY) { values = PyMem_MALLOC(sizeof(int) * length); }
 				else                            { values = values_stack; }
 
 				RNA_property_boolean_get_array(ptr, prop, values);
 				for (count = start; count < stop; count++)
-					PyTuple_SET_ITEM(tuple, count-start, PyBool_FromLong(values[count]));
+					PyTuple_SET_ITEM(tuple, count - start, PyBool_FromLong(values[count]));
 
 				if (values != values_stack) {
 					PyMem_FREE(values);
 				}
 				break;
 			}
-		case PROP_INT:
+			case PROP_INT:
 			{
 				int values_stack[PYRNA_STACK_ARRAY];
 				int *values;
@@ -2341,19 +2351,19 @@ 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_FromSsize_t(values[count]));
 
 				if (values != values_stack) {
 					PyMem_FREE(values);
 				}
 				break;
 			}
-		default:
-			BLI_assert(!"Invalid array type");
+			default:
+				BLI_assert(!"Invalid array type");
 
-			PyErr_SetString(PyExc_TypeError, "not an array type");
-			Py_DECREF(tuple);
-			tuple = NULL;
+				PyErr_SetString(PyExc_TypeError, "not an array type");
+				Py_DECREF(tuple);
+				tuple = NULL;
 		}
 	}
 	return tuple;
@@ -2392,7 +2402,7 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject
 
 			/* avoid PySlice_GetIndicesEx because it needs to know the length ahead of time. */
 			if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) return NULL;
-			if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop))    return NULL;
+			if (key_slice->stop  != Py_None && !_PyEval_SliceIndex(key_slice->stop,  &stop))  return NULL;
 
 			if (start < 0 || stop < 0) {
 				/* only get the length for negative values */
@@ -2433,7 +2443,7 @@ static int pyrna_prop_collection_type_check(BPy_PropertyRNA *self, PyObject *val
 		if (RNA_property_flag(self->prop) & PROP_NEVER_NULL) {
 			PyErr_Format(PyExc_TypeError,
 			             "bpy_prop_collection[key] = value: invalid, "
-			             "this collection doesnt support None assignment");
+			             "this collection doesn't support None assignment");
 			return -1;
 		}
 		else {
@@ -2470,7 +2480,7 @@ static int pyrna_prop_collection_type_check(BPy_PropertyRNA *self, PyObject *val
 }
 
 /* note: currently this is a copy of 'pyrna_prop_collection_subscript' with
- * large blocks commented, we may support slice/key indicies later */
+ * large blocks commented, we may support slice/key indices later */
 static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self, PyObject *key, PyObject *value)
 {
 	PYRNA_PROP_CHECK_INT(self);
@@ -2517,8 +2527,8 @@ static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self, PyObject *
 			Py_ssize_t start = 0, stop = PY_SSIZE_T_MAX;
 
 			/* avoid PySlice_GetIndicesEx because it needs to know the length ahead of time. */
-			if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start))	return NULL;
-			if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop))		return NULL;
+			if (key_slice->start != Py_None && !_PyEval_SliceIndex(key_slice->start, &start)) return NULL;
+			if (key_slice->stop != Py_None && !_PyEval_SliceIndex(key_slice->stop, &stop))    return NULL;
 
 			if (start < 0 || stop < 0) {
 				/* only get the length for negative values */
@@ -2549,10 +2559,12 @@ static PyObject *pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject
 {
 	PYRNA_PROP_CHECK_OBJ((BPy_PropertyRNA *)self);
 
-	/*if (PyUnicode_Check(key)) {
+#if 0
+	if (PyUnicode_Check(key)) {
 		return pyrna_prop_array_subscript_str(self, _PyUnicode_AsString(key));
 	}
-	else */
+	else
+#endif
 	if (PyIndex_Check(key)) {
 		Py_ssize_t i = PyNumber_AsSsize_t(key, PyExc_IndexError);
 		if (i == -1 && PyErr_Occurred())
@@ -2616,10 +2628,10 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop,
 		return -1;
 	}
 
-	if (PySequence_Fast_GET_SIZE(value) != stop-start) {
+	if (PySequence_Fast_GET_SIZE(value) != stop - start) {
 		Py_DECREF(value);
 		PyErr_SetString(PyExc_TypeError,
-		                "bpy_prop_array[slice] = value: resizing bpy_struct arrays isn't supported");
+		                "bpy_prop_array[slice] = value: re-sizing bpy_struct arrays isn't supported");
 		return -1;
 	}
 
@@ -2638,7 +2650,7 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop,
 				RNA_property_float_get_array(ptr, prop, values);
 
 			for (count = start; count < stop; count++) {
-				fval = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, count-start));
+				fval = PyFloat_AsDouble(PySequence_Fast_GET_ITEM(value, count - start));
 				CLAMP(fval, min, max);
 				values[count] = fval;
 			}
@@ -2658,7 +2670,7 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop,
 				RNA_property_boolean_get_array(ptr, prop, values);
 
 			for (count = start; count < stop; count++)
-				values[count] = PyLong_AsLong(PySequence_Fast_GET_ITEM(value, count-start));
+				values[count] = PyLong_AsLong(PySequence_Fast_GET_ITEM(value, count - start));
 
 			if (PyErr_Occurred()) ret = -1;
 			else                  RNA_property_boolean_set_array(ptr, prop, values);
@@ -2672,14 +2684,14 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop,
 			int min, max;
 			RNA_property_int_range(ptr, prop, &min, &max);
 
-			if (length > PYRNA_STACK_ARRAY)	{ values = values_alloc = PyMem_MALLOC(sizeof(int) * length); }
+			if (length > PYRNA_STACK_ARRAY) { values = values_alloc = PyMem_MALLOC(sizeof(int) * length); }
 			else                            { values = values_stack; }
 
 			if (start != 0 || stop != length) /* partial assignment? - need to get the array */
 				RNA_property_int_get_array(ptr, prop, values);
 
 			for (count = start; count < stop; count++) {
-				ival = PyLong_AsLong(PySequence_Fast_GET_ITEM(value, count-start));
+				ival = PyLong_AsLong(PySequence_Fast_GET_ITEM(value, count - start));
 				CLAMP(ival, min, max);
 				values[count] = ival;
 			}
@@ -2778,15 +2790,15 @@ static int pyrna_prop_array_ass_subscript(BPy_PropertyArrayRNA *self, PyObject *
 
 /* for slice only */
 static PyMappingMethods pyrna_prop_array_as_mapping = {
-	(lenfunc) pyrna_prop_array_length,	/* mp_length */
-	(binaryfunc) pyrna_prop_array_subscript,	/* mp_subscript */
-	(objobjargproc) pyrna_prop_array_ass_subscript,	/* mp_ass_subscript */
+	(lenfunc) pyrna_prop_array_length,               /* mp_length */
+	(binaryfunc) pyrna_prop_array_subscript,         /* mp_subscript */
+	(objobjargproc) pyrna_prop_array_ass_subscript,  /* mp_ass_subscript */
 };
 
 static PyMappingMethods pyrna_prop_collection_as_mapping = {
-	(lenfunc) pyrna_prop_collection_length,	/* mp_length */
-	(binaryfunc) pyrna_prop_collection_subscript,	/* mp_subscript */
-	(objobjargproc) pyrna_prop_collection_ass_subscript,	/* mp_ass_subscript */
+	(lenfunc) pyrna_prop_collection_length,               /* mp_length */
+	(binaryfunc) pyrna_prop_collection_subscript,         /* mp_subscript */
+	(objobjargproc) pyrna_prop_collection_ass_subscript,  /* mp_ass_subscript */
 };
 
 /* only for fast bool's, large structs, assign nb_bool on init */
@@ -2836,7 +2848,7 @@ static int pyrna_prop_collection_contains(BPy_PropertyRNA *self, PyObject *key)
 
 		if (keyname == NULL) {
 			PyErr_SetString(PyExc_TypeError,
-			                "bpy_prop_collection.__contains__: expected a string or a typle of strings");
+			                "bpy_prop_collection.__contains__: expected a string or a tuple of strings");
 			return -1;
 		}
 
@@ -2869,44 +2881,44 @@ static int pyrna_struct_contains(BPy_StructRNA *self, PyObject *value)
 	if (!group)
 		return 0;
 
-	return IDP_GetPropertyFromGroup(group, name) ? 1:0;
+	return IDP_GetPropertyFromGroup(group, name) ? 1 : 0;
 }
 
 static PySequenceMethods pyrna_prop_array_as_sequence = {
-	(lenfunc)pyrna_prop_array_length,		/* Cant set the len otherwise it can evaluate as false */
-	NULL,		/* sq_concat */
-	NULL,		/* sq_repeat */
+	(lenfunc)pyrna_prop_array_length,       /* Cant set the len otherwise it can evaluate as false */
+	NULL,       /* sq_concat */
+	NULL,       /* sq_repeat */
 	(ssizeargfunc)pyrna_prop_array_subscript_int, /* sq_item */ /* Only set this so PySequence_Check() returns True */
-	NULL,		/* sq_slice */
-	(ssizeobjargproc)prop_subscript_ass_array_int,		/* sq_ass_item */
-	NULL,		/* *was* sq_ass_slice */
-	(objobjproc)pyrna_prop_array_contains,	/* sq_contains */
+	NULL,       /* sq_slice */
+	(ssizeobjargproc)prop_subscript_ass_array_int,      /* sq_ass_item */
+	NULL,       /* *was* sq_ass_slice */
+	(objobjproc)pyrna_prop_array_contains,  /* sq_contains */
 	(binaryfunc) NULL, /* sq_inplace_concat */
 	(ssizeargfunc) NULL, /* sq_inplace_repeat */
 };
 
 static PySequenceMethods pyrna_prop_collection_as_sequence = {
-	(lenfunc)pyrna_prop_collection_length,		/* Cant set the len otherwise it can evaluate as false */
-	NULL,		/* sq_concat */
-	NULL,		/* sq_repeat */
+	(lenfunc)pyrna_prop_collection_length,      /* Cant set the len otherwise it can evaluate as false */
+	NULL,       /* sq_concat */
+	NULL,       /* sq_repeat */
 	(ssizeargfunc)pyrna_prop_collection_subscript_int, /* sq_item */ /* Only set this so PySequence_Check() returns True */
-	NULL,		/* *was* sq_slice */
+	NULL,       /* *was* sq_slice */
 	(ssizeobjargproc)/* pyrna_prop_collection_ass_subscript_int */ NULL /* let mapping take this one */, /* sq_ass_item */
-	NULL,		/* *was* sq_ass_slice */
-	(objobjproc)pyrna_prop_collection_contains,	/* sq_contains */
+	NULL,       /* *was* sq_ass_slice */
+	(objobjproc)pyrna_prop_collection_contains, /* sq_contains */
 	(binaryfunc) NULL, /* sq_inplace_concat */
 	(ssizeargfunc) NULL, /* sq_inplace_repeat */
 };
 
 static PySequenceMethods pyrna_struct_as_sequence = {
-	NULL,		/* Cant set the len otherwise it can evaluate as false */
-	NULL,		/* sq_concat */
-	NULL,		/* sq_repeat */
-	NULL,		/* sq_item */ /* Only set this so PySequence_Check() returns True */
-	NULL,		/* *was* sq_slice */
-	NULL,		/* sq_ass_item */
-	NULL,		/* *was* sq_ass_slice */
-	(objobjproc)pyrna_struct_contains,	/* sq_contains */
+	NULL,       /* Cant set the len otherwise it can evaluate as false */
+	NULL,       /* sq_concat */
+	NULL,       /* sq_repeat */
+	NULL,       /* sq_item */ /* Only set this so PySequence_Check() returns True */
+	NULL,       /* *was* sq_slice */
+	NULL,       /* sq_ass_item */
+	NULL,       /* *was* sq_ass_slice */
+	(objobjproc)pyrna_struct_contains,  /* sq_contains */
 	(binaryfunc) NULL, /* sq_inplace_concat */
 	(ssizeargfunc) NULL, /* sq_inplace_repeat */
 };
@@ -2969,9 +2981,9 @@ static int pyrna_struct_ass_subscript(BPy_StructRNA *self, PyObject *key, PyObje
 }
 
 static PyMappingMethods pyrna_struct_as_mapping = {
-	(lenfunc) NULL,	/* mp_length */
-	(binaryfunc) pyrna_struct_subscript,	/* mp_subscript */
-	(objobjargproc) pyrna_struct_ass_subscript,	/* mp_ass_subscript */
+	(lenfunc) NULL,                             /* mp_length */
+	(binaryfunc) pyrna_struct_subscript,        /* mp_subscript */
+	(objobjargproc) pyrna_struct_ass_subscript, /* mp_ass_subscript */
 };
 
 PyDoc_STRVAR(pyrna_struct_keys_doc,
@@ -3280,25 +3292,44 @@ static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self)
 	return pyrna_struct_CreatePyObject(&r_ptr);
 }
 
+static void pyrna_dir_members_py__add_keys(PyObject *list, PyObject *dict)
+{
+	PyObject *list_tmp;
+
+	list_tmp = PyDict_Keys(dict);
+	PyList_SetSlice(list, INT_MAX, INT_MAX, list_tmp);
+	Py_DECREF(list_tmp);
+}
+
 static void pyrna_dir_members_py(PyObject *list, PyObject *self)
 {
 	PyObject *dict;
 	PyObject **dict_ptr;
-	PyObject *list_tmp;
 
 	dict_ptr = _PyObject_GetDictPtr((PyObject *)self);
 
 	if (dict_ptr && (dict = *dict_ptr)) {
-		list_tmp = PyDict_Keys(dict);
-		PyList_SetSlice(list, INT_MAX, INT_MAX, list_tmp);
-		Py_DECREF(list_tmp);
+		pyrna_dir_members_py__add_keys(list, dict);
 	}
 
 	dict = ((PyTypeObject *)Py_TYPE(self))->tp_dict;
 	if (dict) {
-		list_tmp = PyDict_Keys(dict);
-		PyList_SetSlice(list, INT_MAX, INT_MAX, list_tmp);
-		Py_DECREF(list_tmp);
+		pyrna_dir_members_py__add_keys(list, dict);
+	}
+
+	/* since this is least common case, handle it last */
+	if (BPy_PropertyRNA_Check(self)) {
+		BPy_PropertyRNA *self_prop = (BPy_PropertyRNA *)self;
+		if (RNA_property_type(self_prop->prop) == PROP_COLLECTION) {
+			PointerRNA r_ptr;
+
+			if (RNA_property_collection_type_get(&self_prop->ptr, self_prop->prop, &r_ptr)) {
+				PyObject *cls = pyrna_struct_Subtype(&r_ptr); /* borrows */
+				dict = ((PyTypeObject *)cls)->tp_dict;
+				pyrna_dir_members_py__add_keys(list, dict);
+				Py_DECREF(cls);
+			}
+		}
 	}
 }
 
@@ -3359,7 +3390,7 @@ static PyObject *pyrna_struct_dir(BPy_StructRNA *self)
 
 	PYRNA_STRUCT_CHECK_OBJ(self);
 
-	/* Include this incase this instance is a subtype of a python class
+	/* Include this in case this instance is a subtype of a python class
 	 * In these instances we may want to return a function or variable provided by the subtype
 	 * */
 	ret = PyList_New(0);
@@ -3444,16 +3475,16 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
 
 			if (done == 1) { /* found */
 				switch (newtype) {
-				case CTX_DATA_TYPE_POINTER:
-					if (newptr.data == NULL) {
-						ret = Py_None;
-						Py_INCREF(ret);
-					}
-					else {
-						ret = pyrna_struct_CreatePyObject(&newptr);
-					}
-					break;
-				case CTX_DATA_TYPE_COLLECTION:
+					case CTX_DATA_TYPE_POINTER:
+						if (newptr.data == NULL) {
+							ret = Py_None;
+							Py_INCREF(ret);
+						}
+						else {
+							ret = pyrna_struct_CreatePyObject(&newptr);
+						}
+						break;
+					case CTX_DATA_TYPE_COLLECTION:
 					{
 						CollectionPointerLink *link;
 						PyObject *linkptr;
@@ -3467,14 +3498,14 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
 						}
 					}
 					break;
-				default:
-					/* should never happen */
-					BLI_assert(!"Invalid context type");
-
-					PyErr_Format(PyExc_AttributeError,
-					             "bpy_struct: Context type invalid %d, can't get \"%.200s\" from context",
-					             newtype, name);
-					ret = NULL;
+					default:
+						/* should never happen */
+						BLI_assert(!"Invalid context type");
+
+						PyErr_Format(PyExc_AttributeError,
+						             "bpy_struct: Context type invalid %d, can't get \"%.200s\" from context",
+						             newtype, name);
+						ret = NULL;
 				}
 			}
 			else if (done == -1) { /* found but not set */
@@ -3496,7 +3527,7 @@ static PyObject *pyrna_struct_getattro(BPy_StructRNA *self, PyObject *pyname)
 		             name);
 		ret = NULL;
 #endif
-		/* Include this incase this instance is a subtype of a python class
+		/* Include this in case this instance is a subtype of a python class
 		 * In these instances we may want to return a function or variable provided by the subtype
 		 *
 		 * Also needed to return methods when its not a subtype
@@ -3523,10 +3554,10 @@ static int pyrna_struct_pydict_contains(PyObject *self, PyObject *pyname)
 //--------------- setattr-------------------------------------------
 static int pyrna_is_deferred_prop(const PyObject *value)
 {
-	return  PyTuple_CheckExact(value) &&
-	        PyTuple_GET_SIZE(value) == 2 &&
-	        PyCFunction_Check(PyTuple_GET_ITEM(value, 0)) &&
-	        PyDict_CheckExact(PyTuple_GET_ITEM(value, 1));
+	return PyTuple_CheckExact(value) &&
+	       PyTuple_GET_SIZE(value) == 2 &&
+	       PyCFunction_Check(PyTuple_GET_ITEM(value, 0)) &&
+	       PyDict_CheckExact(PyTuple_GET_ITEM(value, 1));
 }
 
 #if 0
@@ -3576,14 +3607,14 @@ static int pyrna_struct_meta_idprop_setattro(PyObject *cls, PyObject *attr, PyOb
 
 	if (srna == NULL) {
 		/* allow setting on unregistered classes which can be registered later on */
-		/*
+#if 0
 		if (value && is_deferred_prop) {
 			PyErr_Format(PyExc_AttributeError,
 			             "pyrna_struct_meta_idprop_setattro() unable to get srna from class '%.200s'",
 			             ((PyTypeObject *)cls)->tp_name);
 			return -1;
 		}
-		*/
+#endif
 		/* srna_from_self may set an error */
 		PyErr_Clear();
 		return PyType_Type.tp_setattro(cls, attr, value);
@@ -3693,7 +3724,7 @@ static PyObject *pyrna_prop_dir(BPy_PropertyRNA *self)
 	PyObject *ret;
 	PointerRNA r_ptr;
 
-	/* Include this incase this instance is a subtype of a python class
+	/* Include this in case this instance is a subtype of a python class
 	 * In these instances we may want to return a function or variable provided by the subtype
 	 * */
 	ret = PyList_New(0);
@@ -3768,8 +3799,10 @@ static PyObject *pyrna_prop_collection_getattro(BPy_PropertyRNA *self, PyObject
 				PyErr_Fetch(&error_type, &error_value, &error_traceback);
 				PyErr_Clear();
 
-				cls = pyrna_struct_Subtype(&r_ptr); /* borrows */
+				cls = pyrna_struct_Subtype(&r_ptr);
 				ret = PyObject_GenericGetAttr(cls, pyname);
+				Py_DECREF(cls);
+
 				/* restore the original error */
 				if (ret == NULL) {
 					PyErr_Restore(error_type, error_value, error_traceback);
@@ -3848,6 +3881,13 @@ static PyObject *pyrna_prop_collection_idprop_remove(BPy_PropertyRNA *self, PyOb
 	Py_RETURN_NONE;
 }
 
+static PyObject *pyrna_prop_collection_idprop_clear(BPy_PropertyRNA *self)
+{
+	RNA_property_collection_clear(&self->ptr, self->prop);
+
+	Py_RETURN_NONE;
+}
+
 static PyObject *pyrna_prop_collection_idprop_move(BPy_PropertyRNA *self, PyObject *args)
 {
 	int key = 0, pos = 0;
@@ -3917,6 +3957,12 @@ static PyGetSetDef pyrna_struct_getseters[] = {
 	{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
 };
 
+static PyObject *pyrna_func_doc_get(BPy_FunctionRNA *self, void *closure);
+
+static PyGetSetDef pyrna_func_getseters[] = {
+	{(char *)"__doc__", (getter)pyrna_func_doc_get, (setter)NULL, NULL, NULL},
+	{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
+};
 
 PyDoc_STRVAR(pyrna_prop_collection_keys_doc,
 ".. method:: keys()\n"
@@ -3925,7 +3971,7 @@ PyDoc_STRVAR(pyrna_prop_collection_keys_doc,
 "   (matching pythons dict.keys() functionality).\n"
 "\n"
 "   :return: the identifiers for each member of this collection.\n"
-"   :rtype: list of stings\n"
+"   :rtype: list of strings\n"
 );
 static PyObject *pyrna_prop_collection_keys(BPy_PropertyRNA *self)
 {
@@ -4032,7 +4078,7 @@ static PyObject *pyrna_struct_get(BPy_StructRNA *self, PyObject *args)
 	IDProperty *group, *idprop;
 
 	const char *key;
-	PyObject* def = Py_None;
+	PyObject *def = Py_None;
 
 	PYRNA_STRUCT_CHECK_OBJ(self);
 
@@ -4090,7 +4136,7 @@ static PyObject *pyrna_prop_collection_get(BPy_PropertyRNA *self, PyObject *args
 	PointerRNA newptr;
 
 	PyObject *key_ob;
-	PyObject* def = Py_None;
+	PyObject *def = Py_None;
 
 	PYRNA_PROP_CHECK_OBJ(self);
 
@@ -4105,7 +4151,7 @@ static PyObject *pyrna_prop_collection_get(BPy_PropertyRNA *self, PyObject *args
 	}
 	else if (PyTuple_Check(key_ob)) {
 		PyObject *ret = pyrna_prop_collection_subscript_str_lib_pair(self, key_ob,
-		                                                            "bpy_prop_collection.get((id, lib))", FALSE);
+		                                                             "bpy_prop_collection.get((id, lib))", FALSE);
 		if (ret) {
 			return ret;
 		}
@@ -4164,34 +4210,33 @@ static PyObject *pyrna_prop_collection_find(BPy_PropertyRNA *self, PyObject *key
 	return PyLong_FromSsize_t(index);
 }
 
-static void foreach_attr_type(	BPy_PropertyRNA *self, const char *attr,
-									/* values to assign */
-									RawPropertyType *raw_type, int *attr_tot, int *attr_signed)
+static void foreach_attr_type(BPy_PropertyRNA *self, const char *attr,
+                              /* values to assign */
+                              RawPropertyType *raw_type, int *attr_tot, int *attr_signed)
 {
 	PropertyRNA *prop;
 	*raw_type = PROP_RAW_UNSET;
 	*attr_tot = 0;
 	*attr_signed = FALSE;
 
-	/* note: this is fail with zero length lists, so dont let this get caled in that case */
+	/* note: this is fail with zero length lists, so don't let this get caled in that case */
 	RNA_PROP_BEGIN(&self->ptr, itemptr, self->prop) {
 		prop = RNA_struct_find_property(&itemptr, attr);
 		*raw_type = RNA_property_raw_type(prop);
 		*attr_tot = RNA_property_array_length(&itemptr, prop);
-		*attr_signed = (RNA_property_subtype(prop) == PROP_UNSIGNED) ? FALSE:TRUE;
+		*attr_signed = (RNA_property_subtype(prop) == PROP_UNSIGNED) ? FALSE : TRUE;
 		break;
 	}
 	RNA_PROP_END;
 }
 
 /* pyrna_prop_collection_foreach_get/set both use this */
-static int foreach_parse_args(
-        BPy_PropertyRNA *self, PyObject *args,
+static int foreach_parse_args(BPy_PropertyRNA *self, PyObject *args,
 
-		/*values to assign */
-		const char **attr, PyObject **seq, int *tot, int *size,
-        RawPropertyType *raw_type, int *attr_tot, int *attr_signed
-        )
+                              /* values to assign */
+                              const char **attr, PyObject **seq, int *tot, int *size,
+                              RawPropertyType *raw_type, int *attr_tot, int *attr_signed
+                              )
 {
 #if 0
 	int array_tot;
@@ -4212,7 +4257,7 @@ static int foreach_parse_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;
 
@@ -4234,7 +4279,7 @@ static int foreach_parse_args(
 #endif
 	}
 
-	/* check 'attr_tot' otherwise we dont know if any values were set
+	/* check 'attr_tot' otherwise we don't know if any values were set
 	 * this isn't ideal because it means running on an empty list may fail silently when its not compatible. */
 	if (*size == 0 && *attr_tot != 0) {
 		PyErr_SetString(PyExc_AttributeError, "attribute does not support foreach method");
@@ -4245,24 +4290,24 @@ static int foreach_parse_args(
 
 static int foreach_compat_buffer(RawPropertyType raw_type, int attr_signed, const char *format)
 {
-	char f = format ? *format:'B'; /* B is assumed when not set */
+	char f = format ? *format : 'B'; /* B is assumed when not set */
 
 	switch (raw_type) {
-	case PROP_RAW_CHAR:
-		if (attr_signed)  return (f == 'b') ? 1:0;
-		else              return (f == 'B') ? 1:0;
-	case PROP_RAW_SHORT:
-		if (attr_signed)  return (f == 'h') ? 1:0;
-		else              return (f == 'H') ? 1:0;
-	case PROP_RAW_INT:
-		if (attr_signed)  return (f == 'i') ? 1:0;
-		else              return (f == 'I') ? 1:0;
-	case PROP_RAW_FLOAT:
-		return (f == 'f') ? 1:0;
-	case PROP_RAW_DOUBLE:
-		return (f == 'd') ? 1:0;
-	case PROP_RAW_UNSET:
-		return 0;
+		case PROP_RAW_CHAR:
+			if (attr_signed) return (f == 'b') ? 1 : 0;
+			else             return (f == 'B') ? 1 : 0;
+		case PROP_RAW_SHORT:
+			if (attr_signed) return (f == 'h') ? 1 : 0;
+			else             return (f == 'H') ? 1 : 0;
+		case PROP_RAW_INT:
+			if (attr_signed) return (f == 'i') ? 1 : 0;
+			else             return (f == 'I') ? 1 : 0;
+		case PROP_RAW_FLOAT:
+			return (f == 'f') ? 1 : 0;
+		case PROP_RAW_DOUBLE:
+			return (f == 'd') ? 1 : 0;
+		case PROP_RAW_UNSET:
+			return 0;
 	}
 
 	return 0;
@@ -4312,25 +4357,25 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
 			for ( ; i < tot; i++) {
 				item = PySequence_GetItem(seq, i);
 				switch (raw_type) {
-				case PROP_RAW_CHAR:
-					((char *)array)[i] = (char)PyLong_AsLong(item);
-					break;
-				case PROP_RAW_SHORT:
-					((short *)array)[i] = (short)PyLong_AsLong(item);
-					break;
-				case PROP_RAW_INT:
-					((int *)array)[i] = (int)PyLong_AsLong(item);
-					break;
-				case PROP_RAW_FLOAT:
-					((float *)array)[i] = (float)PyFloat_AsDouble(item);
-					break;
-				case PROP_RAW_DOUBLE:
-					((double *)array)[i] = (double)PyFloat_AsDouble(item);
-					break;
-				case PROP_RAW_UNSET:
-					/* should never happen */
-					BLI_assert(!"Invalid array type - set");
-					break;
+					case PROP_RAW_CHAR:
+						((char *)array)[i] = (char)PyLong_AsLong(item);
+						break;
+					case PROP_RAW_SHORT:
+						((short *)array)[i] = (short)PyLong_AsLong(item);
+						break;
+					case PROP_RAW_INT:
+						((int *)array)[i] = (int)PyLong_AsLong(item);
+						break;
+					case PROP_RAW_FLOAT:
+						((float *)array)[i] = (float)PyFloat_AsDouble(item);
+						break;
+					case PROP_RAW_DOUBLE:
+						((double *)array)[i] = (double)PyFloat_AsDouble(item);
+						break;
+					case PROP_RAW_UNSET:
+						/* should never happen */
+						BLI_assert(!"Invalid array type - set");
+						break;
 				}
 
 				Py_DECREF(item);
@@ -4362,32 +4407,32 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set)
 
 			ok = RNA_property_collection_raw_get(NULL, &self->ptr, self->prop, attr, array, raw_type, tot);
 
-			if (!ok) i = tot; /* skip the loop */
+			if (!ok) i = tot;  /* skip the loop */
 
 			for ( ; i < tot; i++) {
 
 				switch (raw_type) {
-				case PROP_RAW_CHAR:
-					item = PyLong_FromSsize_t((Py_ssize_t) ((char *)array)[i]);
-					break;
-				case PROP_RAW_SHORT:
-					item = PyLong_FromSsize_t((Py_ssize_t) ((short *)array)[i]);
-					break;
-				case PROP_RAW_INT:
-					item = PyLong_FromSsize_t((Py_ssize_t) ((int *)array)[i]);
-					break;
-				case PROP_RAW_FLOAT:
-					item = PyFloat_FromDouble((double) ((float *)array)[i]);
-					break;
-				case PROP_RAW_DOUBLE:
-					item = PyFloat_FromDouble((double) ((double *)array)[i]);
-					break;
-				default: /* PROP_RAW_UNSET */
-					/* should never happen */
-					BLI_assert(!"Invalid array type - get");
-					item = Py_None;
-					Py_INCREF(item);
-					break;
+					case PROP_RAW_CHAR:
+						item = PyLong_FromSsize_t((Py_ssize_t) ((char *)array)[i]);
+						break;
+					case PROP_RAW_SHORT:
+						item = PyLong_FromSsize_t((Py_ssize_t) ((short *)array)[i]);
+						break;
+					case PROP_RAW_INT:
+						item = PyLong_FromSsize_t((Py_ssize_t) ((int *)array)[i]);
+						break;
+					case PROP_RAW_FLOAT:
+						item = PyFloat_FromDouble((double) ((float *)array)[i]);
+						break;
+					case PROP_RAW_DOUBLE:
+						item = PyFloat_FromDouble((double) ((double *)array)[i]);
+						break;
+					default: /* PROP_RAW_UNSET */
+						/* should never happen */
+						BLI_assert(!"Invalid array type - get");
+						item = Py_None;
+						Py_INCREF(item);
+						break;
 				}
 
 				PySequence_SetItem(seq, i, item);
@@ -4510,8 +4555,8 @@ static struct PyMethodDef pyrna_struct_methods[] = {
 	{"as_pointer", (PyCFunction)pyrna_struct_as_pointer, METH_NOARGS, pyrna_struct_as_pointer_doc},
 
 	/* bpy_rna_anim.c */
-	{"keyframe_insert", (PyCFunction)pyrna_struct_keyframe_insert, METH_VARARGS|METH_KEYWORDS, pyrna_struct_keyframe_insert_doc},
-	{"keyframe_delete", (PyCFunction)pyrna_struct_keyframe_delete, METH_VARARGS|METH_KEYWORDS, pyrna_struct_keyframe_delete_doc},
+	{"keyframe_insert", (PyCFunction)pyrna_struct_keyframe_insert, METH_VARARGS | METH_KEYWORDS, pyrna_struct_keyframe_insert_doc},
+	{"keyframe_delete", (PyCFunction)pyrna_struct_keyframe_delete, METH_VARARGS | METH_KEYWORDS, pyrna_struct_keyframe_delete_doc},
 	{"driver_add", (PyCFunction)pyrna_struct_driver_add, METH_VARARGS, pyrna_struct_driver_add_doc},
 	{"driver_remove", (PyCFunction)pyrna_struct_driver_remove, METH_VARARGS, pyrna_struct_driver_remove_doc},
 
@@ -4522,7 +4567,7 @@ static struct PyMethodDef pyrna_struct_methods[] = {
 	{"type_recast", (PyCFunction)pyrna_struct_type_recast, METH_NOARGS, pyrna_struct_type_recast_doc},
 	{"__dir__", (PyCFunction)pyrna_struct_dir, METH_NOARGS, NULL},
 
-	/* experemental */
+	/* experimental */
 	{"callback_add", (PyCFunction)pyrna_callback_add, METH_VARARGS, NULL},
 	{"callback_remove", (PyCFunction)pyrna_callback_remove, METH_VARARGS, NULL},
 	{NULL, NULL, 0, NULL}
@@ -4554,6 +4599,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},
 	{"move", (PyCFunction)pyrna_prop_collection_idprop_move, METH_VARARGS, NULL},
 	{NULL, NULL, 0, NULL}
 };
@@ -4571,14 +4617,14 @@ static PyObject *pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *
 		else if (PyType_IsSubtype(Py_TYPE(base), &pyrna_struct_Type)) {
 			/* this almost never runs, only when using user defined subclasses of built-in object.
 			 * this isn't common since its NOT related to registerable subclasses. eg:
-
-				>>> class MyObSubclass(bpy.types.Object):
-				...     def test_func(self):
-				...         print(100)
-				...
-				>>> myob = MyObSubclass(bpy.context.object)
-				>>> myob.test_func()
-				100
+			 *
+			 *  >>> class MyObSubclass(bpy.types.Object):
+			 *  ...     def test_func(self):
+			 *  ...         print(100)
+			 *  ...
+			 *  >>> myob = MyObSubclass(bpy.context.object)
+			 *  >>> myob.test_func()
+			 *  100
 			 *
 			 * Keep this since it could be useful.
 			 */
@@ -4652,154 +4698,154 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat
 		/* kazanbas: TODO make multidim sequences here */
 
 		switch (type) {
-		case PROP_BOOLEAN:
-			ret = PyTuple_New(len);
-			for (a = 0; a < len; a++)
-				PyTuple_SET_ITEM(ret, a, PyBool_FromLong(((int *)data)[a]));
-			break;
-		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]));
-			break;
-		case PROP_FLOAT:
-			switch (RNA_property_subtype(prop)) {
+			case PROP_BOOLEAN:
+				ret = PyTuple_New(len);
+				for (a = 0; a < len; a++)
+					PyTuple_SET_ITEM(ret, a, PyBool_FromLong(((int *)data)[a]));
+				break;
+			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]));
+				break;
+			case PROP_FLOAT:
+				switch (RNA_property_subtype(prop)) {
 #ifdef USE_MATHUTILS
-				case PROP_ALL_VECTOR_SUBTYPES:
-					ret = Vector_CreatePyObject(data, len, Py_NEW, NULL);
-					break;
-				case PROP_MATRIX:
-					if (len == 16) {
-						ret = Matrix_CreatePyObject(data, 4, 4, Py_NEW, NULL);
-						break;
-					}
-					else if (len == 9) {
-						ret = Matrix_CreatePyObject(data, 3, 3, Py_NEW, NULL);
+					case PROP_ALL_VECTOR_SUBTYPES:
+						ret = Vector_CreatePyObject(data, len, Py_NEW, NULL);
 						break;
-					}
-					/* pass through */
+					case PROP_MATRIX:
+						if (len == 16) {
+							ret = Matrix_CreatePyObject(data, 4, 4, Py_NEW, NULL);
+							break;
+						}
+						else if (len == 9) {
+							ret = Matrix_CreatePyObject(data, 3, 3, Py_NEW, NULL);
+							break;
+						}
+						/* pass through */
 #endif
-				default:
-					ret = PyTuple_New(len);
-					for (a = 0; a < len; a++)
-						PyTuple_SET_ITEM(ret, a, PyFloat_FromDouble(((float *)data)[a]));
+					default:
+						ret = PyTuple_New(len);
+						for (a = 0; a < len; a++)
+							PyTuple_SET_ITEM(ret, a, PyFloat_FromDouble(((float *)data)[a]));
 
-			}
-			break;
-		default:
-			PyErr_Format(PyExc_TypeError,
-			             "RNA Error: unknown array type \"%d\" (pyrna_param_to_py)",
-			             type);
-			ret = NULL;
-			break;
+				}
+				break;
+			default:
+				PyErr_Format(PyExc_TypeError,
+				             "RNA Error: unknown array type \"%d\" (pyrna_param_to_py)",
+				             type);
+				ret = NULL;
+				break;
 		}
 	}
 	else {
 		/* see if we can coorce into a python type - PropertyType */
 		switch (type) {
-		case PROP_BOOLEAN:
-			ret = PyBool_FromLong(*(int *)data);
-			break;
-		case PROP_INT:
-			ret = PyLong_FromSsize_t((Py_ssize_t)*(int *)data);
-			break;
-		case PROP_FLOAT:
-			ret = PyFloat_FromDouble(*(float *)data);
-			break;
-		case PROP_STRING:
-		{
-			char *data_ch;
-			PyObject *value_coerce = NULL;
-			const int subtype = RNA_property_subtype(prop);
+			case PROP_BOOLEAN:
+				ret = PyBool_FromLong(*(int *)data);
+				break;
+			case PROP_INT:
+				ret = PyLong_FromSsize_t((Py_ssize_t)*(int *)data);
+				break;
+			case PROP_FLOAT:
+				ret = PyFloat_FromDouble(*(float *)data);
+				break;
+			case PROP_STRING:
+			{
+				char *data_ch;
+				PyObject *value_coerce = NULL;
+				const int subtype = RNA_property_subtype(prop);
 
-			if (flag & PROP_THICK_WRAP)
-				data_ch = (char *)data;
-			else
-				data_ch = *(char **)data;
+				if (flag & PROP_THICK_WRAP)
+					data_ch = (char *)data;
+				else
+					data_ch = *(char **)data;
 
 #ifdef USE_STRING_COERCE
-			if (subtype == PROP_BYTESTRING) {
-				ret = PyBytes_FromString(data_ch);
-			}
-			else if (ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
-				ret = PyC_UnicodeFromByte(data_ch);
-			}
-			else {
-				ret = PyUnicode_FromString(data_ch);
-			}
+				if (subtype == PROP_BYTESTRING) {
+					ret = PyBytes_FromString(data_ch);
+				}
+				else if (ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
+					ret = PyC_UnicodeFromByte(data_ch);
+				}
+				else {
+					ret = PyUnicode_FromString(data_ch);
+				}
 #else
-			if (subtype == PROP_BYTESTRING) {
-				ret = PyBytes_FromString(buf);
-			}
-			else {
-				ret = PyUnicode_FromString(data_ch);
-			}
+				if (subtype == PROP_BYTESTRING) {
+					ret = PyBytes_FromString(buf);
+				}
+				else {
+					ret = PyUnicode_FromString(data_ch);
+				}
 #endif
 
 #ifdef USE_STRING_COERCE
-			Py_XDECREF(value_coerce);
+				Py_XDECREF(value_coerce);
 #endif
 
-			break;
-		}
-		case PROP_ENUM:
-		{
-			ret = pyrna_enum_to_py(ptr, prop, *(int *)data);
-			break;
-		}
-		case PROP_POINTER:
-		{
-			PointerRNA newptr;
-			StructRNA *ptype = RNA_property_pointer_type(ptr, prop);
-
-			if (flag & PROP_RNAPTR) {
-				/* in this case we get the full ptr */
-				newptr = *(PointerRNA *)data;
+				break;
 			}
-			else {
-				if (RNA_struct_is_ID(ptype)) {
-					RNA_id_pointer_create(*(void **)data, &newptr);
+			case PROP_ENUM:
+			{
+				ret = pyrna_enum_to_py(ptr, prop, *(int *)data);
+				break;
+			}
+			case PROP_POINTER:
+			{
+				PointerRNA newptr;
+				StructRNA *ptype = RNA_property_pointer_type(ptr, prop);
+
+				if (flag & PROP_RNAPTR) {
+					/* in this case we get the full ptr */
+					newptr = *(PointerRNA *)data;
+				}
+				else {
+					if (RNA_struct_is_ID(ptype)) {
+						RNA_id_pointer_create(*(void **)data, &newptr);
+					}
+					else {
+						/* note: this is taken from the function's ID pointer
+						 * and will break if a function returns a pointer from
+						 * another ID block, watch this! - it should at least be
+						 * easy to debug since they are all ID's */
+						RNA_pointer_create(ptr->id.data, ptype, *(void **)data, &newptr);
+					}
+				}
+
+				if (newptr.data) {
+					ret = pyrna_struct_CreatePyObject(&newptr);
 				}
 				else {
-					/* note: this is taken from the function's ID pointer
-					 * and will break if a function returns a pointer from
-					 * another ID block, watch this! - it should at least be
-					 * easy to debug since they are all ID's */
-					RNA_pointer_create(ptr->id.data, ptype, *(void **)data, &newptr);
+					ret = Py_None;
+					Py_INCREF(ret);
 				}
+				break;
 			}
+			case PROP_COLLECTION:
+			{
+				ListBase *lb = (ListBase *)data;
+				CollectionPointerLink *link;
+				PyObject *linkptr;
 
-			if (newptr.data) {
-				ret = pyrna_struct_CreatePyObject(&newptr);
-			}
-			else {
-				ret = Py_None;
-				Py_INCREF(ret);
-			}
-			break;
-		}
-		case PROP_COLLECTION:
-		{
-			ListBase *lb = (ListBase *)data;
-			CollectionPointerLink *link;
-			PyObject *linkptr;
+				ret = PyList_New(0);
 
-			ret = PyList_New(0);
+				for (link = lb->first; link; link = link->next) {
+					linkptr = pyrna_struct_CreatePyObject(&link->ptr);
+					PyList_Append(ret, linkptr);
+					Py_DECREF(linkptr);
+				}
 
-			for (link = lb->first; link; link = link->next) {
-				linkptr = pyrna_struct_CreatePyObject(&link->ptr);
-				PyList_Append(ret, linkptr);
-				Py_DECREF(linkptr);
+				break;
 			}
-
-			break;
-		}
-		default:
-			PyErr_Format(PyExc_TypeError,
-			             "RNA Error: unknown type \"%d\" (pyrna_param_to_py)",
-			             type);
-			ret = NULL;
-			break;
+			default:
+				PyErr_Format(PyExc_TypeError,
+				             "RNA Error: unknown type \"%d\" (pyrna_param_to_py)",
+				             type);
+				ret = NULL;
+				break;
 		}
 	}
 
@@ -4866,7 +4912,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
 	}
 
 	/* for testing */
-	/*
+#if 0
 	{
 		const char *fn;
 		int lineno;
@@ -4874,7 +4920,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
 		printf("pyrna_func_call > %.200s.%.200s : %.200s:%d\n",
 		       RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), fn, lineno);
 	}
-	*/
+#endif
 
 	/* include the ID pointer for pyrna_param_to_py() so we can include the
 	 * ID pointer on return values, this only works when returned values have
@@ -4927,7 +4973,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
 			item = small_dict_get_item_string(kw, RNA_property_identifier(parm)); /* borrow ref */
 #endif
 			if (item)
-				kw_tot++; /* make sure invalid keywords are not given */
+				kw_tot++;  /* make sure invalid keywords are not given */
 
 			kw_arg = TRUE;
 		}
@@ -4991,7 +5037,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
 	/* Check if we gave args that don't exist in the function
 	 * printing the error is slow but it should only happen when developing.
 	 * the if below is quick, checking if it passed less keyword args then we gave.
-	 * (Dont overwrite the error if we have one, otherwise can skip important messages and confuse with args)
+	 * (Don't overwrite the error if we have one, otherwise can skip important messages and confuse with args)
 	 */
 	if (err == 0 && kw && (pykw_len > kw_tot)) {
 		PyObject *key, *value;
@@ -5104,14 +5150,14 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
 
 
 #ifdef DEBUG_STRING_FREE
-	/*
+#if 0
 	if (PyList_GET_SIZE(string_free_ls)) {
 		printf("%.200s.%.200s():  has %d strings\n",
 		       RNA_struct_identifier(self_ptr->type),
 		       RNA_function_identifier(self_func),
 		       (int)PyList_GET_SIZE(string_free_ls));
 	}
-	 */
+#endif
 	Py_DECREF(string_free_ls);
 #undef DEBUG_STRING_FREE
 #endif
@@ -5129,6 +5175,22 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
 	Py_RETURN_NONE;
 }
 
+static PyObject *pyrna_func_doc_get(BPy_FunctionRNA *self, void *UNUSED(closure))
+{
+	PyObject *ret;
+	char *args;
+
+	args = RNA_function_as_string_keywords(NULL, self->func, NULL, TRUE, TRUE);
+
+	ret = PyUnicode_FromFormat("%.200s.%.200s(%.200s)\n%s",
+	                           RNA_struct_identifier(self->ptr.type),
+	                           RNA_function_identifier(self->func),
+	                           args, RNA_function_ui_description(self->func));
+
+	MEM_freeN(args);
+
+	return ret;
+}
 
 /* subclasses of pyrna_struct_Type which support idprop definitions use this as a metaclass */
 /* note: tp_base member is set to &PyType_Type on init */
@@ -5163,30 +5225,30 @@ PyTypeObject pyrna_struct_meta_idprop_Type = {
 	/* Functions to access object as input/output buffer */
 	NULL,                       /* PyBufferProcs *tp_as_buffer; */
 
-  /*** Flags to define presence of optional/expanded features ***/
+	/*** Flags to define presence of optional/expanded features ***/
 	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,         /* long tp_flags; */
 
 	NULL,                       /*  char *tp_doc;  Documentation string */
-  /*** Assigned meaning in release 2.0 ***/
+	/*** Assigned meaning in release 2.0 ***/
 	/* call function for all accessible objects */
 	NULL,                       /* traverseproc tp_traverse; */
 
 	/* delete references to contained objects */
 	NULL,                       /* inquiry tp_clear; */
 
-  /***  Assigned meaning in release 2.1 ***/
-  /*** rich comparisons ***/
+	/***  Assigned meaning in release 2.1 ***/
+	/*** rich comparisons ***/
 	NULL,                       /* richcmpfunc tp_richcompare; */
 
-  /***  weak reference enabler ***/
+	/***  weak reference enabler ***/
 	0,                          /* long tp_weaklistoffset; */
 
-  /*** Added in release 2.2 ***/
+	/*** Added in release 2.2 ***/
 	/*   Iterators */
 	NULL,                       /* getiterfunc tp_iter; */
 	NULL,                       /* iternextfunc tp_iternext; */
 
-  /*** Attribute descriptor and subclassing stuff ***/
+	/*** Attribute descriptor and subclassing stuff ***/
 	NULL,                       /* struct PyMethodDef *tp_methods; */
 	NULL,                       /* struct PyMemberDef *tp_members; */
 	NULL,                       /* struct PyGetSetDef *tp_getset; */
@@ -5223,7 +5285,7 @@ PyTypeObject pyrna_struct_Type = {
 	sizeof(BPy_StructRNA),      /* tp_basicsize */
 	0,                          /* tp_itemsize */
 	/* methods */
-	(destructor) pyrna_struct_dealloc,/* tp_dealloc */
+	(destructor) pyrna_struct_dealloc, /* tp_dealloc */
 	NULL,                       /* printfunc tp_print; */
 	NULL,                       /* getattrfunc tp_getattr; */
 	NULL,                       /* setattrfunc tp_setattr; */
@@ -5247,11 +5309,11 @@ PyTypeObject pyrna_struct_Type = {
 	/* Functions to access object as input/output buffer */
 	NULL,                       /* PyBufferProcs *tp_as_buffer; */
 
-  /*** Flags to define presence of optional/expanded features ***/
+	/*** Flags to define presence of optional/expanded features ***/
 	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* long tp_flags; */
 
 	NULL,                       /*  char *tp_doc;  Documentation string */
-  /*** Assigned meaning in release 2.0 ***/
+	/*** Assigned meaning in release 2.0 ***/
 	/* call function for all accessible objects */
 #ifdef USE_PYRNA_STRUCT_REFERENCE
 	(traverseproc) pyrna_struct_traverse, /* traverseproc tp_traverse; */
@@ -5265,22 +5327,22 @@ PyTypeObject pyrna_struct_Type = {
 	NULL,                       /* inquiry tp_clear; */
 #endif /* !USE_PYRNA_STRUCT_REFERENCE */
 
-  /***  Assigned meaning in release 2.1 ***/
-  /*** rich comparisons ***/
+	/***  Assigned meaning in release 2.1 ***/
+	/*** rich comparisons ***/
 	(richcmpfunc)pyrna_struct_richcmp, /* richcmpfunc tp_richcompare; */
 
-  /***  weak reference enabler ***/
+	/***  weak reference enabler ***/
 #ifdef USE_WEAKREFS
 	offsetof(BPy_StructRNA, in_weakreflist), /* long tp_weaklistoffset; */
 #else
 	0,
 #endif
-  /*** Added in release 2.2 ***/
+	/*** Added in release 2.2 ***/
 	/*   Iterators */
 	NULL,                       /* getiterfunc tp_iter; */
 	NULL,                       /* iternextfunc tp_iternext; */
 
-  /*** Attribute descriptor and subclassing stuff ***/
+	/*** Attribute descriptor and subclassing stuff ***/
 	pyrna_struct_methods,       /* struct PyMethodDef *tp_methods; */
 	NULL,                       /* struct PyMemberDef *tp_members; */
 	pyrna_struct_getseters,     /* struct PyGetSetDef *tp_getset; */
@@ -5338,37 +5400,37 @@ PyTypeObject pyrna_prop_Type = {
 	/* Functions to access object as input/output buffer */
 	NULL,                       /* PyBufferProcs *tp_as_buffer; */
 
-  /*** Flags to define presence of optional/expanded features ***/
+	/*** Flags to define presence of optional/expanded features ***/
 	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,         /* long tp_flags; */
 
 	NULL,                       /*  char *tp_doc;  Documentation string */
-  /*** Assigned meaning in release 2.0 ***/
+	/*** Assigned meaning in release 2.0 ***/
 	/* call function for all accessible objects */
 	NULL,                       /* traverseproc tp_traverse; */
 
 	/* delete references to contained objects */
 	NULL,                       /* inquiry tp_clear; */
 
-  /***  Assigned meaning in release 2.1 ***/
-  /*** rich comparisons ***/
-	(richcmpfunc)pyrna_prop_richcmp,	/* richcmpfunc tp_richcompare; */
+	/***  Assigned meaning in release 2.1 ***/
+	/*** rich comparisons ***/
+	(richcmpfunc)pyrna_prop_richcmp,    /* richcmpfunc tp_richcompare; */
 
-  /***  weak reference enabler ***/
+	/***  weak reference enabler ***/
 #ifdef USE_WEAKREFS
-	offsetof(BPy_PropertyRNA, in_weakreflist),	/* long tp_weaklistoffset; */
+	offsetof(BPy_PropertyRNA, in_weakreflist),  /* long tp_weaklistoffset; */
 #else
 	0,
 #endif
 
-  /*** Added in release 2.2 ***/
+	/*** Added in release 2.2 ***/
 	/*   Iterators */
 	NULL,                       /* getiterfunc tp_iter; */
 	NULL,                       /* iternextfunc tp_iternext; */
 
-  /*** Attribute descriptor and subclassing stuff ***/
+	/*** Attribute descriptor and subclassing stuff ***/
 	pyrna_prop_methods,         /* struct PyMethodDef *tp_methods; */
 	NULL,                       /* struct PyMemberDef *tp_members; */
-	pyrna_prop_getseters,      	/* struct PyGetSetDef *tp_getset; */
+	pyrna_prop_getseters,       /* struct PyGetSetDef *tp_getset; */
 	NULL,                       /* struct _typeobject *tp_base; */
 	NULL,                       /* PyObject *tp_dict; */
 	NULL,                       /* descrgetfunc tp_descr_get; */
@@ -5393,7 +5455,7 @@ PyTypeObject pyrna_prop_Type = {
 PyTypeObject pyrna_prop_array_Type = {
 	PyVarObject_HEAD_INIT(NULL, 0)
 	"bpy_prop_array",           /* tp_name */
-	sizeof(BPy_PropertyArrayRNA),			/* tp_basicsize */
+	sizeof(BPy_PropertyArrayRNA),           /* tp_basicsize */
 	0,                          /* tp_itemsize */
 	/* methods */
 	(destructor)pyrna_prop_array_dealloc, /* tp_dealloc */
@@ -5401,7 +5463,7 @@ PyTypeObject pyrna_prop_array_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 */
 
@@ -5422,33 +5484,33 @@ PyTypeObject pyrna_prop_array_Type = {
 	/* Functions to access object as input/output buffer */
 	NULL,                       /* PyBufferProcs *tp_as_buffer; */
 
-  /*** Flags to define presence of optional/expanded features ***/
+	/*** Flags to define presence of optional/expanded features ***/
 	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */
 
 	NULL,                       /*  char *tp_doc;  Documentation string */
-  /*** Assigned meaning in release 2.0 ***/
+	/*** Assigned meaning in release 2.0 ***/
 	/* call function for all accessible objects */
 	NULL,                       /* traverseproc tp_traverse; */
 
 	/* delete references to contained objects */
 	NULL,                       /* inquiry tp_clear; */
 
-  /***  Assigned meaning in release 2.1 ***/
-  /*** rich comparisons ***/
+	/***  Assigned meaning in release 2.1 ***/
+	/*** rich comparisons ***/
 	NULL, /* subclassed */ /* richcmpfunc tp_richcompare; */
 
-  /***  weak reference enabler ***/
+	/***  weak reference enabler ***/
 #ifdef USE_WEAKREFS
-	offsetof(BPy_PropertyArrayRNA, in_weakreflist),	/* long tp_weaklistoffset; */
+	offsetof(BPy_PropertyArrayRNA, in_weakreflist), /* long tp_weaklistoffset; */
 #else
 	0,
 #endif
-  /*** Added in release 2.2 ***/
+	/*** Added in release 2.2 ***/
 	/*   Iterators */
-	(getiterfunc)pyrna_prop_array_iter,	/* getiterfunc tp_iter; */
+	(getiterfunc)pyrna_prop_array_iter, /* getiterfunc tp_iter; */
 	NULL,                       /* iternextfunc tp_iternext; */
 
-  /*** Attribute descriptor and subclassing stuff ***/
+	/*** Attribute descriptor and subclassing stuff ***/
 	pyrna_prop_array_methods,   /* struct PyMethodDef *tp_methods; */
 	NULL,                       /* struct PyMemberDef *tp_members; */
 	NULL /*pyrna_prop_getseters*/, /* struct PyGetSetDef *tp_getset; */
@@ -5505,34 +5567,34 @@ PyTypeObject pyrna_prop_collection_Type = {
 	/* Functions to access object as input/output buffer */
 	NULL,                       /* PyBufferProcs *tp_as_buffer; */
 
-  /*** Flags to define presence of optional/expanded features ***/
+	/*** Flags to define presence of optional/expanded features ***/
 	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,         /* long tp_flags; */
 
 	NULL,                       /*  char *tp_doc;  Documentation string */
-  /*** Assigned meaning in release 2.0 ***/
+	/*** Assigned meaning in release 2.0 ***/
 	/* call function for all accessible objects */
 	NULL,                       /* traverseproc tp_traverse; */
 
 	/* delete references to contained objects */
 	NULL,                       /* inquiry tp_clear; */
 
-  /***  Assigned meaning in release 2.1 ***/
-  /*** rich comparisons ***/
+	/***  Assigned meaning in release 2.1 ***/
+	/*** rich comparisons ***/
 	NULL, /* subclassed */		/* richcmpfunc tp_richcompare; */
 
-  /***  weak reference enabler ***/
+	/***  weak reference enabler ***/
 #ifdef USE_WEAKREFS
 	offsetof(BPy_PropertyRNA, in_weakreflist), /* long tp_weaklistoffset; */
 #else
 	0,
 #endif
 
-  /*** Added in release 2.2 ***/
+	/*** Added in release 2.2 ***/
 	/*   Iterators */
 	(getiterfunc)pyrna_prop_collection_iter, /* getiterfunc tp_iter; */
 	NULL,                       /* iternextfunc tp_iternext; */
 
-  /*** Attribute descriptor and subclassing stuff ***/
+	/*** Attribute descriptor and subclassing stuff ***/
 	pyrna_prop_collection_methods, /* struct PyMethodDef *tp_methods; */
 	NULL,                       /* struct PyMemberDef *tp_members; */
 	NULL /*pyrna_prop_getseters*/, /* struct PyGetSetDef *tp_getset; */
@@ -5590,38 +5652,38 @@ static PyTypeObject pyrna_prop_collection_idprop_Type = {
 	/* Functions to access object as input/output buffer */
 	NULL,                       /* PyBufferProcs *tp_as_buffer; */
 
-  /*** Flags to define presence of optional/expanded features ***/
+	/*** Flags to define presence of optional/expanded features ***/
 	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,         /* long tp_flags; */
 
 	NULL,                       /*  char *tp_doc;  Documentation string */
-  /*** Assigned meaning in release 2.0 ***/
+	/*** Assigned meaning in release 2.0 ***/
 	/* call function for all accessible objects */
 	NULL,                       /* traverseproc tp_traverse; */
 
 	/* delete references to contained objects */
 	NULL,                       /* inquiry tp_clear; */
 
-  /***  Assigned meaning in release 2.1 ***/
-  /*** rich comparisons ***/
+	/***  Assigned meaning in release 2.1 ***/
+	/*** rich comparisons ***/
 	NULL, /* subclassed */		/* richcmpfunc tp_richcompare; */
 
-  /***  weak reference enabler ***/
+	/***  weak reference enabler ***/
 #ifdef USE_WEAKREFS
 	offsetof(BPy_PropertyRNA, in_weakreflist), /* long tp_weaklistoffset; */
 #else
 	0,
 #endif
 
-  /*** Added in release 2.2 ***/
+	/*** Added in release 2.2 ***/
 	/*   Iterators */
 	NULL,                       /* getiterfunc tp_iter; */
 	NULL,                       /* iternextfunc tp_iternext; */
 
-  /*** Attribute descriptor and subclassing stuff ***/
+	/*** Attribute descriptor and subclassing stuff ***/
 	pyrna_prop_collection_idprop_methods, /* struct PyMethodDef *tp_methods; */
 	NULL,                       /* struct PyMemberDef *tp_members; */
 	NULL /*pyrna_prop_getseters*/, /* struct PyGetSetDef *tp_getset; */
-	&pyrna_prop_collection_Type,/* struct _typeobject *tp_base; */
+	&pyrna_prop_collection_Type, /* struct _typeobject *tp_base; */
 	NULL,                       /* PyObject *tp_dict; */
 	NULL,                       /* descrgetfunc tp_descr_get; */
 	NULL,                       /* descrsetfunc tp_descr_set; */
@@ -5675,37 +5737,37 @@ PyTypeObject pyrna_func_Type = {
 	/* Functions to access object as input/output buffer */
 	NULL,                       /* PyBufferProcs *tp_as_buffer; */
 
-  /*** Flags to define presence of optional/expanded features ***/
+	/*** Flags to define presence of optional/expanded features ***/
 	Py_TPFLAGS_DEFAULT,         /* long tp_flags; */
 
 	NULL,                       /*  char *tp_doc;  Documentation string */
-  /*** Assigned meaning in release 2.0 ***/
+	/*** Assigned meaning in release 2.0 ***/
 	/* call function for all accessible objects */
 	NULL,                       /* traverseproc tp_traverse; */
 
 	/* delete references to contained objects */
 	NULL,                       /* inquiry tp_clear; */
 
-  /***  Assigned meaning in release 2.1 ***/
-  /*** rich comparisons ***/
+	/***  Assigned meaning in release 2.1 ***/
+	/*** rich comparisons ***/
 	NULL,                       /* richcmpfunc tp_richcompare; */
 
-  /***  weak reference enabler ***/
+	/***  weak reference enabler ***/
 #ifdef USE_WEAKREFS
-	offsetof(BPy_PropertyRNA, in_weakreflist),	/* long tp_weaklistoffset; */
+	offsetof(BPy_PropertyRNA, in_weakreflist),  /* long tp_weaklistoffset; */
 #else
 	0,
 #endif
 
-  /*** Added in release 2.2 ***/
+	/*** Added in release 2.2 ***/
 	/*   Iterators */
 	NULL,                       /* getiterfunc tp_iter; */
 	NULL,                       /* iternextfunc tp_iternext; */
 
-  /*** Attribute descriptor and subclassing stuff ***/
+	/*** Attribute descriptor and subclassing stuff ***/
 	NULL,                       /* struct PyMethodDef *tp_methods; */
 	NULL,                       /* struct PyMemberDef *tp_members; */
-	NULL,                       /* struct PyGetSetDef *tp_getset; */
+	pyrna_func_getseters,       /* struct PyGetSetDef *tp_getset; */
 	NULL,                       /* struct _typeobject *tp_base; */
 	NULL,                       /* PyObject *tp_dict; */
 	NULL,                       /* descrgetfunc tp_descr_get; */
@@ -5750,7 +5812,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 */
 
@@ -5775,28 +5837,28 @@ PyTypeObject pyrna_prop_collection_iter_Type = {
 	/* Functions to access object as input/output buffer */
 	NULL,                       /* PyBufferProcs *tp_as_buffer; */
 
-  /*** Flags to define presence of optional/expanded features ***/
+	/*** Flags to define presence of optional/expanded features ***/
 	Py_TPFLAGS_DEFAULT,         /* long tp_flags; */
 
 	NULL,                       /*  char *tp_doc;  Documentation string */
-  /*** Assigned meaning in release 2.0 ***/
+	/*** Assigned meaning in release 2.0 ***/
 	/* call function for all accessible objects */
 	NULL,                       /* traverseproc tp_traverse; */
 
 	/* delete references to contained objects */
 	NULL,                       /* inquiry tp_clear; */
 
-  /***  Assigned meaning in release 2.1 ***/
-  /*** rich comparisons ***/
+	/***  Assigned meaning in release 2.1 ***/
+	/*** rich comparisons ***/
 	NULL, /* subclassed */		/* richcmpfunc tp_richcompare; */
 
-  /***  weak reference enabler ***/
+	/***  weak reference enabler ***/
 #ifdef USE_WEAKREFS
 	offsetof(BPy_PropertyCollectionIterRNA, in_weakreflist), /* long tp_weaklistoffset; */
 #else
 	0,
 #endif
-  /*** Added in release 2.2 ***/
+	/*** Added in release 2.2 ***/
 	/*   Iterators */
 #if defined(_MSC_VER) || defined(FREE_WINDOWS)
 	NULL, /* defer assignment */
@@ -5805,7 +5867,7 @@ PyTypeObject pyrna_prop_collection_iter_Type = {
 #endif
 	(iternextfunc) pyrna_prop_collection_iter_next, /* iternextfunc tp_iternext; */
 
-  /*** Attribute descriptor and subclassing stuff ***/
+	/*** Attribute descriptor and subclassing stuff ***/
 	NULL,                       /* struct PyMethodDef *tp_methods; */
 	NULL,                       /* struct PyMemberDef *tp_members; */
 	NULL,                       /* struct PyGetSetDef *tp_getset; */
@@ -5920,10 +5982,10 @@ static void pyrna_subtype_set_rna(PyObject *newclass, StructRNA *srna)
 	/* done with rna instance */
 }
 
-static PyObject* pyrna_srna_Subtype(StructRNA *srna);
+static PyObject *pyrna_srna_Subtype(StructRNA *srna);
 
 /* return a borrowed reference */
-static PyObject* pyrna_srna_PyBase(StructRNA *srna) //, PyObject *bpy_types_dict)
+static PyObject *pyrna_srna_PyBase(StructRNA *srna) //, PyObject *bpy_types_dict)
 {
 	/* Assume RNA_struct_py_type_get(srna) was already checked */
 	StructRNA *base;
@@ -5934,7 +5996,7 @@ static PyObject* pyrna_srna_PyBase(StructRNA *srna) //, PyObject *bpy_types_dict
 	base = RNA_struct_base(srna);
 
 	if (base && base != srna) {
-		/*/printf("debug subtype %s %p\n", RNA_struct_identifier(srna), srna); */
+		/* printf("debug subtype %s %p\n", RNA_struct_identifier(srna), srna); */
 		py_base = pyrna_srna_Subtype(base); //, bpy_types_dict);
 		Py_DECREF(py_base); /* srna owns, this is only to pass as an arg */
 	}
@@ -5950,7 +6012,7 @@ static PyObject* pyrna_srna_PyBase(StructRNA *srna) //, PyObject *bpy_types_dict
  * return a borrowed reference */
 static PyObject *bpy_types_dict = NULL;
 
-static PyObject* pyrna_srna_ExternalType(StructRNA *srna)
+static PyObject *pyrna_srna_ExternalType(StructRNA *srna)
 {
 	const char *idname = RNA_struct_identifier(srna);
 	PyObject *newclass;
@@ -5991,7 +6053,7 @@ static PyObject* pyrna_srna_ExternalType(StructRNA *srna)
 				newclass = NULL;
 			}
 			else {
-				if (G.f & G_DEBUG)
+				if (G.debug & G_DEBUG_PYTHON)
 					fprintf(stderr, "SRNA Subclassed: '%s'\n", idname);
 			}
 		}
@@ -6000,28 +6062,28 @@ static PyObject* pyrna_srna_ExternalType(StructRNA *srna)
 	return newclass;
 }
 
-static PyObject* pyrna_srna_Subtype(StructRNA *srna)
+static PyObject *pyrna_srna_Subtype(StructRNA *srna)
 {
 	PyObject *newclass = NULL;
 
-		/* stupid/simple case */
+	/* stupid/simple case */
 	if (srna == NULL) {
 		newclass = NULL; /* Nothing to do */
-	}	/* the class may have already been declared & allocated */
+	}   /* the class may have already been declared & allocated */
 	else if ((newclass = RNA_struct_py_type_get(srna))) {
 		Py_INCREF(newclass);
-	}	/* check if bpy_types.py module has the class defined in it */
+	}   /* check if bpy_types.py module has the class defined in it */
 	else if ((newclass = pyrna_srna_ExternalType(srna))) {
 		pyrna_subtype_set_rna(newclass, srna);
 		Py_INCREF(newclass);
-	}	/* create a new class instance with the C api
-		 * mainly for the purposing of matching the C/rna type hierarchy */
+	}   /* create a new class instance with the C api
+	     * mainly for the purposing of matching the C/rna type hierarchy */
 	else {
 		/* subclass equivalents
-		- class myClass(myBase):
-			some = 'value' # or ...
-		- myClass = type(name='myClass', bases=(myBase,), dict={'__module__':'bpy.types'})
-		*/
+		 * - class myClass(myBase):
+		 *     some = 'value' # or ...
+		 * - myClass = type(name='myClass', bases=(myBase,), dict={'__module__':'bpy.types'})
+		 */
 
 		/* Assume RNA_struct_py_type_get(srna) was already checked */
 		PyObject *py_base = pyrna_srna_PyBase(srna);
@@ -6033,8 +6095,8 @@ static PyObject* pyrna_srna_Subtype(StructRNA *srna)
 		// if (!descr) descr = "(no docs)";
 		// "__doc__", descr
 
-		if ( RNA_struct_idprops_check(srna) &&
-		     !PyObject_IsSubclass(py_base, (PyObject *)&pyrna_struct_meta_idprop_Type))
+		if (RNA_struct_idprops_check(srna) &&
+		    !PyObject_IsSubclass(py_base, (PyObject *)&pyrna_struct_meta_idprop_Type))
 		{
 			metaclass = (PyObject *)&pyrna_struct_meta_idprop_Type;
 		}
@@ -6043,8 +6105,8 @@ static PyObject* pyrna_srna_Subtype(StructRNA *srna)
 		}
 
 		/* always use O not N when calling, N causes refcount errors */
-		newclass = PyObject_CallFunction(metaclass, (char *)"s(O){sss()}",
-		                                 idname, py_base, "__module__","bpy.types", "__slots__");
+		newclass = PyObject_CallFunction(metaclass, (char *)"s(O) {sss()}",
+		                                 idname, py_base, "__module__", "bpy.types", "__slots__");
 
 		/* newclass will now have 2 ref's, ???, probably 1 is internal since decrefing here segfaults */
 
@@ -6080,7 +6142,7 @@ static StructRNA *srna_from_ptr(PointerRNA *ptr)
 }
 
 /* always returns a new ref, be sure to decref when done */
-static PyObject* pyrna_struct_Subtype(PointerRNA *ptr)
+static PyObject *pyrna_struct_Subtype(PointerRNA *ptr)
 {
 	return pyrna_srna_Subtype(srna_from_ptr(ptr));
 }
@@ -6500,15 +6562,17 @@ static int deferred_register_prop(StructRNA *srna, PyObject *key, PyObject *item
 
 			py_ret = PyObject_Call(py_func, args_fake, py_kw);
 
-			Py_DECREF(args_fake); /* free's py_srna_cobject too */
-
 			if (py_ret) {
 				Py_DECREF(py_ret);
+				Py_DECREF(args_fake); /* free's py_srna_cobject too */
 			}
 			else {
+				/* _must_ print before decreffing args_fake */
 				PyErr_Print();
 				PyErr_Clear();
 
+				Py_DECREF(args_fake); /* free's py_srna_cobject too */
+
 				// PyC_LineSpit();
 				PyErr_Format(PyExc_ValueError,
 				             "bpy_struct \"%.200s\" registration error: "
@@ -6521,8 +6585,10 @@ static int deferred_register_prop(StructRNA *srna, PyObject *key, PyObject *item
 			/* Since this is a class dict, ignore args that can't be passed */
 
 			/* for testing only */
-			/* PyC_ObSpit("Why doesn't this work??", item);
-			PyErr_Print(); */
+#if 0
+			PyC_ObSpit("Why doesn't this work??", item);
+			PyErr_Print();
+#endif
 			PyErr_Clear();
 		}
 	}
@@ -6582,10 +6648,10 @@ static int pyrna_deferred_register_class_recursive(StructRNA *srna, PyTypeObject
 		 *
 		 * So only scan base classes which are not subclasses if blender types.
 		 * This best fits having 'mix-in' classes for operators and render engines.
-		 * */
+		 */
 		if (py_superclass != &PyBaseObject_Type &&
-			!PyObject_IsSubclass((PyObject *)py_superclass, (PyObject *)&pyrna_struct_Type)
-		) {
+		    !PyObject_IsSubclass((PyObject *)py_superclass, (PyObject *)&pyrna_struct_Type))
+		{
 			ret = pyrna_deferred_register_class_recursive(srna, py_superclass);
 
 			if (ret != 0) {
@@ -6600,7 +6666,7 @@ static int pyrna_deferred_register_class_recursive(StructRNA *srna, PyTypeObject
 
 int pyrna_deferred_register_class(StructRNA *srna, PyObject *py_class)
 {
-	/* Panels and Menus dont need this
+	/* Panels and Menus don't need this
 	 * save some time and skip the checks here */
 	if (!RNA_struct_idprops_register_check(srna))
 		return 0;
@@ -6698,7 +6764,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
 
 			func_arg_count = rna_function_arg_count(func);
 
-			if (func_arg_count >= 0) { /* -1 if we dont care*/
+			if (func_arg_count >= 0) { /* -1 if we don't care*/
 				arg_count = ((PyCodeObject *)PyFunction_GET_CODE(item))->co_argcount;
 
 				/* note, the number of args we check for and the number of args we give to
@@ -6735,24 +6801,24 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun
 			/* 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);              \
-				if (item && item != Py_None) {                                \
-					if (pyrna_py_to_prop(dummyptr, prop, NULL,                \
-					                     item, "validating class:") != 0)     \
-					{                                                         \
-						Py_DECREF(item);                                      \
-						return -1;                                            \
-					}                                                         \
-				}                                                             \
-				Py_XDECREF(item);                                             \
+	if (strcmp(identifier, rna_attr) == 0) {                                  \
+		item = PyObject_GetAttrString(py_class, py_attr);                     \
+		if (item && item != Py_None) {                                        \
+			if (pyrna_py_to_prop(dummyptr, prop, NULL,                        \
+			                     item, "validating class:") != 0)             \
+			{                                                                 \
+				Py_DECREF(item);                                              \
+				return -1;                                                    \
 			}                                                                 \
+		}                                                                     \
+		Py_XDECREF(item);                                                     \
+	}                                                                         \
 
 
 			BPY_REPLACEMENT_STRING("bl_idname", "__name__");
 			BPY_REPLACEMENT_STRING("bl_description", "__doc__");
 
-#undef		BPY_REPLACEMENT_STRING
+#undef      BPY_REPLACEMENT_STRING
 
 			if (item == NULL && (((flag & PROP_REGISTER_OPTIONAL) != PROP_REGISTER_OPTIONAL))) {
 				PyErr_Format(PyExc_AttributeError,
@@ -6801,8 +6867,8 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
 	const char *func_id = RNA_function_identifier(func);
 	/* 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);
+	                           /*strstr("render", func_id) ||*/
+	                           !is_operator);
 #endif
 
 	py_class = RNA_struct_py_type_get(ptr->type);
@@ -6857,7 +6923,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
 #if 1
 			/* Skip the code below and call init directly on the allocated 'py_srna'
 			 * otherwise __init__() always needs to take a second self argument, see pyrna_struct_new().
-			 * Although this is annoying to have to impliment a part of pythons typeobject.c:type_call().
+			 * Although this is annoying to have to implement a part of pythons typeobject.c:type_call().
 			 */
 			if (py_class->tp_init) {
 #ifdef USE_PEDANTIC_WRITE
@@ -6884,9 +6950,12 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
 			rna_disallow_writes = TRUE;
 
 			/* 'almost' all the time calling the class isn't needed.
-			 * We could just do...
+			 * We could just do... */
+#if 0
 			py_class_instance = py_srna;
 			Py_INCREF(py_class_instance);
+#endif
+			/*
 			 * This would work fine but means __init__ functions wouldnt run.
 			 * none of blenders default scripts use __init__ but its nice to call it
 			 * for general correctness. just to note why this is here when it could be safely removed.
@@ -6951,7 +7020,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
 			}
 
 #ifdef USE_PEDANTIC_WRITE
-			rna_disallow_writes = is_readonly ? TRUE:FALSE;
+			rna_disallow_writes = is_readonly ? TRUE : FALSE;
 #endif
 			/* *** Main Caller *** */
 
@@ -7007,8 +7076,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
 			if (err == -1) {
 				PyC_Err_Format_Prefix(PyExc_RuntimeError,
 				                      "class %.200s, function %.200s: incompatible return value ",
-				                      RNA_struct_identifier(ptr->type), RNA_function_identifier(func)
-				                      );
+				                      RNA_struct_identifier(ptr->type), RNA_function_identifier(func));
 			}
 		}
 		else if (ret_len > 1) {
@@ -7039,8 +7107,8 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
 					/* only useful for single argument returns, we'll need another list loop for multiple */
 					if (flag & PROP_OUTPUT) {
 						err = pyrna_py_to_prop(&funcptr, parm, iter.data,
-						                      PyTuple_GET_ITEM(ret, i++),
-						                      "calling class function:");
+						                       PyTuple_GET_ITEM(ret, i++),
+						                       "calling class function:");
 						if (err) {
 							break;
 						}
@@ -7056,10 +7124,10 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param
 	if (err != 0) {
 		ReportList *reports;
 		/* alert the user, else they wont know unless they see the console. */
-		if ( (!is_static) &&
-		     (ptr->data) &&
-		     (RNA_struct_is_a(ptr->type, &RNA_Operator)) &&
-		     (is_valid_wm == (CTX_wm_manager(C) != NULL)))
+		if ((!is_static) &&
+		    (ptr->data) &&
+		    (RNA_struct_is_a(ptr->type, &RNA_Operator)) &&
+		    (is_valid_wm == (CTX_wm_manager(C) != NULL)))
 		{
 			wmOperator *op = ptr->data;
 			reports = op->reports;
@@ -7097,7 +7165,7 @@ static void bpy_class_free(void *pyob_ptr)
 		PyErr_Clear();
 
 #if 0 /* needs further investigation, too annoying so quiet for now */
-	if (G.f&G_DEBUG) {
+	if (G.debug & G_DEBUG_PYTHON) {
 		if (self->ob_refcnt > 1) {
 			PyC_ObSpit("zombie class - ref should be 1", self);
 		}
@@ -7154,7 +7222,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);
@@ -7228,14 +7296,14 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class
 		return NULL;
 
 	/* fails in cases, cant use this check but would like to :| */
-	/*
+#if 0
 	if (RNA_struct_py_type_get(srna)) {
 		PyErr_Format(PyExc_ValueError,
 		             "register_class(...): %.200s's parent class %.200s is already registered, this is not allowed",
 		             ((PyTypeObject *)py_class)->tp_name, RNA_struct_identifier(srna));
 		return NULL;
 	}
-	*/
+#endif
 
 	/* check that we have a register callback for this type */
 	reg = RNA_struct_register(srna);
@@ -7269,7 +7337,7 @@ static PyObject *pyrna_register_class(PyObject *UNUSED(self), PyObject *py_class
 
 	pyrna_subtype_set_rna(py_class, srna_new); /* takes a ref to py_class */
 
-	/* old srna still references us, keep the check incase registering somehow can free it */
+	/* old srna still references us, keep the check in case registering somehow can free it */
 	if (RNA_struct_py_type_get(srna)) {
 		RNA_struct_py_type_set(srna, NULL);
 		// Py_DECREF(py_class); // should be able to do this XXX since the old rna adds a new ref.
@@ -7334,7 +7402,7 @@ PyDoc_STRVAR(pyrna_unregister_class_doc,
 "   before unregistering.\n"
 );
 PyMethodDef meth_bpy_unregister_class = {
-    "unregister_class", pyrna_unregister_class, METH_O, pyrna_unregister_class_doc
+	"unregister_class", pyrna_unregister_class, METH_O, pyrna_unregister_class_doc
 };
 static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_class)
 {
@@ -7350,11 +7418,13 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla
 		return NULL;
 	}
 
-	/*if (PyDict_GetItem(((PyTypeObject *)py_class)->tp_dict, bpy_intern_str_bl_rna) == NULL) {
+#if 0
+	if (PyDict_GetItem(((PyTypeObject *)py_class)->tp_dict, bpy_intern_str_bl_rna) == NULL) {
 		PWM_cursor_wait(0);
 		PyErr_SetString(PyExc_ValueError, "unregister_class(): not a registered as a subclass");
 		return NULL;
-	}*/
+	}
+#endif
 
 	if (!pyrna_write_check()) {
 		PyErr_Format(PyExc_RuntimeError,
@@ -7394,7 +7464,7 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla
 	}
 
 	/* should happen all the time but very slow */
-	if (G.f & G_DEBUG) {
+	if (G.debug & G_DEBUG_PYTHON) {
 		/* remove all properties using this class */
 		StructRNA *srna_iter;
 		PointerRNA ptr_rna;
@@ -7431,7 +7501,7 @@ static PyObject *pyrna_unregister_class(PyObject *UNUSED(self), PyObject *py_cla
 
 	PyDict_DelItem(((PyTypeObject *)py_class)->tp_dict, bpy_intern_str_bl_rna);
 	if (PyErr_Occurred())
-		PyErr_Clear(); //return NULL;
+		PyErr_Clear();  //return NULL;
 
 	Py_RETURN_NONE;
 }
diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h
index 70ae816..1133677 100644
--- a/source/blender/python/intern/bpy_rna.h
+++ b/source/blender/python/intern/bpy_rna.h
@@ -24,8 +24,8 @@
  *  \ingroup pythonintern
  */
 
-#ifndef BPY_RNA_H
-#define BPY_RNA_H
+#ifndef __BPY_RNA_H__
+#define __BPY_RNA_H__
 
 /* --- bpy build options --- */
 #ifdef WITH_PYTHON_SAFETY
@@ -83,14 +83,14 @@ extern PyTypeObject pyrna_func_Type;
 #define BPy_PropertyRNA_Check(v)		(PyObject_TypeCheck(v, &pyrna_prop_Type))
 #define BPy_PropertyRNA_CheckExact(v)	(Py_TYPE(v) == &pyrna_prop_Type)
 
-#define PYRNA_STRUCT_CHECK_OBJ(obj) if(pyrna_struct_validity_check(obj) == -1) { return NULL; }
-#define PYRNA_STRUCT_CHECK_INT(obj) if(pyrna_struct_validity_check(obj) == -1) { return -1; }
+#define PYRNA_STRUCT_CHECK_OBJ(obj) if (UNLIKELY(pyrna_struct_validity_check(obj) == -1)) { return NULL; } (void)0
+#define PYRNA_STRUCT_CHECK_INT(obj) if (UNLIKELY(pyrna_struct_validity_check(obj) == -1)) { return -1;   } (void)0
 
-#define PYRNA_PROP_CHECK_OBJ(obj) if(pyrna_prop_validity_check(obj) == -1) { return NULL; }
-#define PYRNA_PROP_CHECK_INT(obj) if(pyrna_prop_validity_check(obj) == -1) { return -1; }
+#define PYRNA_PROP_CHECK_OBJ(obj) if (UNLIKELY(pyrna_prop_validity_check(obj) == -1)) { return NULL; } (void)0
+#define PYRNA_PROP_CHECK_INT(obj) if (UNLIKELY(pyrna_prop_validity_check(obj) == -1)) { return -1;   } (void)0
 
-#define PYRNA_STRUCT_IS_VALID(pysrna) (((BPy_StructRNA *)(pysrna))->ptr.type != NULL)
-#define PYRNA_PROP_IS_VALID(pysrna) (((BPy_PropertyRNA *)(pysrna))->ptr.type != NULL)
+#define PYRNA_STRUCT_IS_VALID(pysrna) (LIKELY(((BPy_StructRNA *)(pysrna))->ptr.type != NULL))
+#define PYRNA_PROP_IS_VALID(pysrna)   (LIKELY(((BPy_PropertyRNA *)(pysrna))->ptr.type != NULL))
 
 /* 'in_weakreflist' MUST be aligned */
 
diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c
index 2371ca7..b7a4589 100644
--- a/source/blender/python/intern/bpy_rna_anim.c
+++ b/source/blender/python/intern/bpy_rna_anim.c
@@ -31,6 +31,7 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "BLI_utildefines.h"
 #include "BLI_string.h"
 
 #include "DNA_scene_types.h"
@@ -148,8 +149,8 @@ static int pyrna_struct_anim_args_parse(
 
 /* internal use for insert and delete */
 static int pyrna_struct_keyframe_parse(
-		PointerRNA *ptr, PyObject *args, PyObject *kw, const char *parse_str, const char *error_prefix,
-		const char **path_full, int *index, float *cfra, const char **group_name) /* return values */
+        PointerRNA *ptr, PyObject *args, PyObject *kw, const char *parse_str, const char *error_prefix,
+        const char **path_full, int *index, float *cfra, const char **group_name)     /* return values */
 {
 	static const char *kwlist[] = {"data_path", "index", "frame", "group", NULL};
 	const char *path;
@@ -194,8 +195,8 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
 	PYRNA_STRUCT_CHECK_OBJ(self);
 
 	if (pyrna_struct_keyframe_parse(&self->ptr, args, kw,
-	                               "s|ifs:bpy_struct.keyframe_insert()", "bpy_struct.keyframe_insert()",
-	                               &path_full, &index, &cfra, &group_name) == -1)
+	                                "s|ifs:bpy_struct.keyframe_insert()", "bpy_struct.keyframe_insert()",
+	                                &path_full, &index, &cfra, &group_name) == -1)
 	{
 		return NULL;
 	}
@@ -242,9 +243,9 @@ PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args, PyOb
 	PYRNA_STRUCT_CHECK_OBJ(self);
 
 	if (pyrna_struct_keyframe_parse(&self->ptr, args, kw,
-	                               "s|ifs:bpy_struct.keyframe_delete()",
-	                               "bpy_struct.keyframe_insert()",
-	                               &path_full, &index, &cfra, &group_name) == -1)
+	                                "s|ifs:bpy_struct.keyframe_delete()",
+	                                "bpy_struct.keyframe_insert()",
+	                                &path_full, &index, &cfra, &group_name) == -1)
 	{
 		return NULL;
 	}
@@ -326,7 +327,7 @@ PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
 				ret = pyrna_struct_CreatePyObject(&tptr);
 			}
 			
-			WM_event_add_notifier(BPy_GetContext(), NC_ANIMATION|ND_FCURVES_ORDER, NULL);
+			WM_event_add_notifier(BPy_GetContext(), NC_ANIMATION | ND_FCURVES_ORDER, NULL);
 		}
 		else {
 			/* XXX, should be handled by reports, */
@@ -379,7 +380,7 @@ PyObject *pyrna_struct_driver_remove(BPy_StructRNA *self, PyObject *args)
 		if (BPy_reports_to_error(&reports, PyExc_RuntimeError, TRUE) == -1)
 			return NULL;
 		
-		WM_event_add_notifier(BPy_GetContext(), NC_ANIMATION|ND_FCURVES_ORDER, NULL);
+		WM_event_add_notifier(BPy_GetContext(), NC_ANIMATION | ND_FCURVES_ORDER, NULL);
 
 		return PyBool_FromLong(result);
 	}
diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c
index a74d041..5c59c1e 100644
--- a/source/blender/python/intern/bpy_rna_array.c
+++ b/source/blender/python/intern/bpy_rna_array.c
@@ -45,27 +45,27 @@
 #define MAX_ARRAY_DIMENSION 10
 
 typedef void (*ItemConvertFunc)(PyObject *, char *);
-typedef int  (*ItemTypeCheckFunc)(PyObject *);
+typedef int (*ItemTypeCheckFunc)(PyObject *);
 typedef void (*RNA_SetArrayFunc)(PointerRNA *, PropertyRNA *, const char *);
 typedef void (*RNA_SetIndexFunc)(PointerRNA *, PropertyRNA *, int index, void *);
 
 /*
-  arr[3][4][5]
-	  0  1  2  <- dimension index
-*/
+ * arr[3][4][5]
+ *     0  1  2  <- dimension index
+ */
 
 /*
-  arr[2] = x
-
-  py_to_array_index(arraydim=0, arrayoffset=0, index=2)
-	validate_array(lvalue_dim=0)
-	... make real index ...
-*/
+ *  arr[2] = x
+ *
+ *  py_to_array_index(arraydim=0, arrayoffset=0, index=2)
+ *      validate_array(lvalue_dim=0)
+ *      ... make real index ...
+ */
 
 /* arr[3] = x, self->arraydim is 0, lvalue_dim is 1 */
 /* Ensures that a python sequence has expected number of items/sub-items and items are of desired type. */
 static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[],
-							   ItemTypeCheckFunc check_item_type, const char *item_type_str, const char *error_prefix)
+                               ItemTypeCheckFunc check_item_type, const char *item_type_str, const char *error_prefix)
 {
 	Py_ssize_t i;
 
@@ -101,8 +101,8 @@ static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[]
 			 * dim = 0 */
 			else if (PySequence_Size(item) != dimsize[dim + 1]) {
 				/* BLI_snprintf(error_str, error_str_size,
-				                "sequences of dimension %d should contain %d items",
-				                (int)dim + 1, (int)dimsize[dim + 1]); */
+				 *              "sequences of dimension %d should contain %d items",
+				 *              (int)dim + 1, (int)dimsize[dim + 1]); */
 				PyErr_Format(PyExc_ValueError, "%s sequences of dimension %d should contain %d items",
 				             error_prefix, (int)dim + 1, (int)dimsize[dim + 1]);
 				ok = 0;
@@ -205,8 +205,8 @@ static int validate_array_length(PyObject *rvalue, PointerRNA *ptr, PropertyRNA
 			/* length is flexible */
 			if (!RNA_property_dynamic_array_set_length(ptr, prop, tot)) {
 				/* BLI_snprintf(error_str, error_str_size,
-				                "%s.%s: array length cannot be changed to %d",
-				                RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), tot); */
+				 *              "%s.%s: array length cannot be changed to %d",
+				 *              RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), tot); */
 				PyErr_Format(PyExc_ValueError, "%s %s.%s: array length cannot be changed to %d",
 				             error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), tot);
 				return -1;
@@ -232,18 +232,18 @@ static int validate_array_length(PyObject *rvalue, PointerRNA *ptr, PropertyRNA
 			len = 1;
 
 			/* arr[3][4][5]
-
-			   arr[2] = x
-			   dimsize = {4, 5}
-			   dimsize[1] = 4
-			   dimsize[2] = 5
-			   lvalue_dim = 0, totdim = 3
-
-			   arr[2][3] = x
-			   lvalue_dim = 1
-
-			   arr[2][3][4] = x
-			   lvalue_dim = 2 */
+			 *
+			 *    arr[2] = x
+			 *    dimsize = {4, 5}
+			 *    dimsize[1] = 4
+			 *    dimsize[2] = 5
+			 *    lvalue_dim = 0, totdim = 3
+			 * 
+			 *    arr[2][3] = x
+			 *    lvalue_dim = 1
+			 * 
+			 *    arr[2][3][4] = x
+			 *    lvalue_dim = 2 */
 			for (i = lvalue_dim; i < totdim; i++)
 				len *= dimsize[i];
 		}
@@ -462,12 +462,12 @@ static int py_to_array_index(PyObject *py, PointerRNA *ptr, PropertyRNA *prop,
 	/* convert index */
 
 	/* arr[3][4][5]
-
-	   arr[2] = x
-	   lvalue_dim = 0, index = 0 + 2 * 4 * 5
-
-	   arr[2][3] = x
-	   lvalue_dim = 1, index = 40 + 3 * 5 */
+	 *
+	 *    arr[2] = x
+	 *    lvalue_dim = 0, index = 0 + 2 * 4 * 5
+	 *
+	 *    arr[2][3] = x
+	 *    lvalue_dim = 1, index = 40 + 3 * 5 */
 
 	lvalue_dim++;
 
@@ -550,21 +550,21 @@ int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, char *param_data,
 {
 	int ret;
 	switch (RNA_property_type(prop)) {
-	case PROP_FLOAT:
-		ret = py_to_array(py, ptr, prop, param_data, py_float_check, "float", sizeof(float),
-		                 py_to_float, (RNA_SetArrayFunc)RNA_property_float_set_array, error_prefix);
-		break;
-	case PROP_INT:
-		ret = py_to_array(py, ptr, prop, param_data, py_int_check, "int", sizeof(int),
-		                 py_to_int, (RNA_SetArrayFunc)RNA_property_int_set_array, error_prefix);
-		break;
-	case PROP_BOOLEAN:
-		ret = py_to_array(py, ptr, prop, param_data, py_bool_check, "boolean", sizeof(int),
-		                 py_to_bool, (RNA_SetArrayFunc)RNA_property_boolean_set_array, error_prefix);
-		break;
-	default:
-		PyErr_SetString(PyExc_TypeError, "not an array type");
-		ret = -1;
+		case PROP_FLOAT:
+			ret = py_to_array(py, ptr, prop, param_data, py_float_check, "float", sizeof(float),
+			                  py_to_float, (RNA_SetArrayFunc)RNA_property_float_set_array, error_prefix);
+			break;
+		case PROP_INT:
+			ret = py_to_array(py, ptr, prop, param_data, py_int_check, "int", sizeof(int),
+			                  py_to_int, (RNA_SetArrayFunc)RNA_property_int_set_array, error_prefix);
+			break;
+		case PROP_BOOLEAN:
+			ret = py_to_array(py, ptr, prop, param_data, py_bool_check, "boolean", sizeof(int),
+			                  py_to_bool, (RNA_SetArrayFunc)RNA_property_boolean_set_array, error_prefix);
+			break;
+		default:
+			PyErr_SetString(PyExc_TypeError, "not an array type");
+			ret = -1;
 	}
 
 	return ret;
@@ -575,21 +575,21 @@ int pyrna_py_to_array_index(PointerRNA *ptr, PropertyRNA *prop, int arraydim, in
 {
 	int ret;
 	switch (RNA_property_type(prop)) {
-	case PROP_FLOAT:
-		ret = py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index,
-		                       py_float_check, "float", py_to_float, float_set_index, error_prefix);
-		break;
-	case PROP_INT:
-		ret = py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index,
-		                       py_int_check, "int", py_to_int, int_set_index, error_prefix);
-		break;
-	case PROP_BOOLEAN:
-		ret = py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index,
-		                       py_bool_check, "boolean", py_to_bool, bool_set_index, error_prefix);
-		break;
-	default:
-		PyErr_SetString(PyExc_TypeError, "not an array type");
-		ret = -1;
+		case PROP_FLOAT:
+			ret = py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index,
+			                        py_float_check, "float", py_to_float, float_set_index, error_prefix);
+			break;
+		case PROP_INT:
+			ret = py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index,
+			                        py_int_check, "int", py_to_int, int_set_index, error_prefix);
+			break;
+		case PROP_BOOLEAN:
+			ret = py_to_array_index(py, ptr, prop, arraydim, arrayoffset, index,
+			                        py_bool_check, "boolean", py_to_bool, bool_set_index, error_prefix);
+			break;
+		default:
+			PyErr_SetString(PyExc_TypeError, "not an array type");
+			ret = -1;
 	}
 
 	return ret;
@@ -600,18 +600,18 @@ PyObject *pyrna_array_index(PointerRNA *ptr, PropertyRNA *prop, int index)
 	PyObject *item;
 
 	switch (RNA_property_type(prop)) {
-	case PROP_FLOAT:
-		item = PyFloat_FromDouble(RNA_property_float_get_index(ptr, prop, index));
-		break;
-	case PROP_BOOLEAN:
-		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));
-		break;
-	default:
-		PyErr_SetString(PyExc_TypeError, "not an array type");
-		item = NULL;
+		case PROP_FLOAT:
+			item = PyFloat_FromDouble(RNA_property_float_get_index(ptr, prop, index));
+			break;
+		case PROP_BOOLEAN:
+			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));
+			break;
+		default:
+			PyErr_SetString(PyExc_TypeError, "not an array type");
+			item = NULL;
 	}
 
 	return item;
@@ -664,7 +664,7 @@ 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.f & G_DEBUG) printf("pyrna_py_from_array_index: invalid index %d for array with length=%d\n", index, len);
+		if (G.debug & G_DEBUG_PYTHON) printf("pyrna_py_from_array_index: invalid index %d for array with length=%d\n", index, len);
 
 		PyErr_SetString(PyExc_IndexError, "out of range");
 		return NULL;
@@ -677,12 +677,12 @@ PyObject *pyrna_py_from_array_index(BPy_PropertyArrayRNA *self, PointerRNA *ptr,
 		ret->arraydim = arraydim + 1;
 
 		/* arr[3][4][5]
-
-		   x = arr[2]
-		   index = 0 + 2 * 4 * 5
-
-		   x = arr[2][3]
-		   index = offset + 3 * 5 */
+		 *
+		 *    x = arr[2]
+		 *    index = 0 + 2 * 4 * 5
+		 * 
+		 *    x = arr[2][3]
+		 *    index = offset + 3 * 5 */
 
 		for (i = arraydim + 1; i < totdim; i++)
 			index *= dimsize[i];
diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c
index 7704ab2..13532b2 100644
--- a/source/blender/python/intern/bpy_rna_callback.c
+++ b/source/blender/python/intern/bpy_rna_callback.c
@@ -137,7 +137,7 @@ PyObject *pyrna_callback_remove(BPy_StructRNA *self, PyObject *args)
 		ED_region_draw_cb_exit(((ARegion *)self->ptr.data)->type, handle);
 	}
 
-	/* dont allow reuse */
+	/* don't allow reuse */
 	PyCapsule_SetName(py_handle, RNA_CAPSULE_ID_INVALID);
 
 	Py_RETURN_NONE;
diff --git a/source/blender/python/intern/bpy_traceback.c b/source/blender/python/intern/bpy_traceback.c
index e3272c9..f7aa6e0 100644
--- a/source/blender/python/intern/bpy_traceback.c
+++ b/source/blender/python/intern/bpy_traceback.c
@@ -29,6 +29,9 @@
 #include <Python.h>
 #include <frameobject.h>
 
+#include "BLI_path_util.h"
+#include "BLI_string.h"
+
 #include "bpy_traceback.h"
 
 static const char *traceback_filepath(PyTracebackObject *tb, PyObject **coerce)
@@ -39,7 +42,7 @@ static const char *traceback_filepath(PyTracebackObject *tb, PyObject **coerce)
 /* copied from pythonrun.c, 3.2.0 */
 static int
 parse_syntax_error(PyObject *err, PyObject **message, const char **filename,
-				   int *lineno, int *offset, const char **text)
+                   int *lineno, int *offset, const char **text)
 {
 	long hold;
 	PyObject *v;
@@ -47,11 +50,11 @@ parse_syntax_error(PyObject *err, PyObject **message, const char **filename,
 	/* old style errors */
 	if (PyTuple_Check(err))
 		return PyArg_ParseTuple(err, "O(ziiz)", message, filename,
-								lineno, offset, text);
+		                        lineno, offset, text);
 
 	/* new style errors.  `err' is an instance */
 
-	if (! (v = PyObject_GetAttrString(err, "msg")))
+	if (!(v = PyObject_GetAttrString(err, "msg")))
 		goto finally;
 	*message = v;
 
@@ -59,7 +62,7 @@ parse_syntax_error(PyObject *err, PyObject **message, const char **filename,
 		goto finally;
 	if (v == Py_None)
 		*filename = NULL;
-	else if (! (*filename = _PyUnicode_AsString(v)))
+	else if (!(*filename = _PyUnicode_AsString(v)))
 		goto finally;
 
 	Py_DECREF(v);
@@ -93,7 +96,7 @@ parse_syntax_error(PyObject *err, PyObject **message, const char **filename,
 	if (v == Py_None)
 		*text = NULL;
 	else if (!PyUnicode_Check(v) ||
-			 !(*text = _PyUnicode_AsString(v)))
+	         !(*text = _PyUnicode_AsString(v)))
 		goto finally;
 	Py_DECREF(v);
 	return 1;
@@ -119,7 +122,7 @@ void python_script_error_jump(const char *filepath, int *lineno, int *offset)
 		/* no traceback available when SyntaxError.
 		 * python has no api's to this. reference parse_syntax_error() from pythonrun.c */
 		PyErr_NormalizeException(&exception, &value, (PyObject **)&tb);
-		PyErr_Restore(exception, value, (PyObject *)tb);	/* takes away reference! */
+		PyErr_Restore(exception, value, (PyObject *)tb);  /* takes away reference! */
 
 		if (value) { /* should always be true */
 			PyObject *message;
@@ -127,9 +130,9 @@ void python_script_error_jump(const char *filepath, int *lineno, int *offset)
 
 			if (parse_syntax_error(value, &message, &filename, lineno, offset, &text)) {
 				/* python adds a '/', prefix, so check for both */
-				if ((strcmp(filename, filepath) == 0) ||
-					((filename[0] == '\\' || filename[0] == '/') && strcmp(filename + 1, filepath) == 0)
-				) {
+				if ((BLI_path_cmp(filename, filepath) == 0) ||
+				    ((filename[0] == '\\' || filename[0] == '/') && BLI_path_cmp(filename + 1, filepath) == 0))
+				{
 					/* good */
 				}
 				else {
@@ -143,7 +146,7 @@ void python_script_error_jump(const char *filepath, int *lineno, int *offset)
 	}
 	else {
 		PyErr_NormalizeException(&exception, &value, (PyObject **)&tb);
-		PyErr_Restore(exception, value, (PyObject *)tb);	/* takes away reference! */
+		PyErr_Restore(exception, value, (PyObject *)tb);  /* takes away reference! */
 		PyErr_Print();
 
 		for (tb = (PyTracebackObject *)PySys_GetObject("last_traceback");
@@ -152,12 +155,13 @@ void python_script_error_jump(const char *filepath, int *lineno, int *offset)
 		{
 			PyObject *coerce;
 			const char *tb_filepath = traceback_filepath(tb, &coerce);
-			const int match = strcmp(tb_filepath, filepath) != 0;
+			const int match = ((BLI_path_cmp(tb_filepath, filepath) == 0) ||
+			                   ((tb_filepath[0] == '\\' || tb_filepath[0] == '/') && BLI_path_cmp(tb_filepath + 1, filepath) == 0));
 			Py_DECREF(coerce);
 
 			if (match) {
 				*lineno = tb->tb_lineno;
-				break;
+				/* used to break here, but better find the inner most line */
 			}
 		}
 	}
diff --git a/source/blender/python/intern/bpy_traceback.h b/source/blender/python/intern/bpy_traceback.h
index ff7312b..575f982 100644
--- a/source/blender/python/intern/bpy_traceback.h
+++ b/source/blender/python/intern/bpy_traceback.h
@@ -23,9 +23,9 @@
  */
 
 
-#ifndef BPY_TRACEBACK_H
-#define BPY_TRACEBACK_H
+#ifndef __BPY_TRACEBACK_H__
+#define __BPY_TRACEBACK_H__
 
 void python_script_error_jump(const char *filepath, int *lineno, int *offset);
 
-#endif // BPY_TRACEBACK_H
+#endif // __BPY_TRACEBACK_H__
diff --git a/source/blender/python/intern/bpy_util.c b/source/blender/python/intern/bpy_util.c
index ec7eff1..01495c7 100644
--- a/source/blender/python/intern/bpy_util.c
+++ b/source/blender/python/intern/bpy_util.c
@@ -37,9 +37,9 @@
 
 #include "../generic/py_capi_utils.h"
 
-static bContext*	__py_context = NULL;
-bContext*	BPy_GetContext(void) { return __py_context; }
-void		BPy_SetContext(bContext *C) { __py_context = C; }
+static bContext*  __py_context = NULL;
+bContext   *BPy_GetContext(void) { return __py_context; }
+void        BPy_SetContext(bContext *C) { __py_context = C; }
 
 char *BPy_enum_as_string(EnumPropertyItem *item)
 {
@@ -49,7 +49,7 @@ char *BPy_enum_as_string(EnumPropertyItem *item)
 
 	for (e = item; item->identifier; item++) {
 		if (item->identifier[0])
-			BLI_dynstr_appendf(dynstr, (e == item)?"'%s'":", '%s'", item->identifier);
+			BLI_dynstr_appendf(dynstr, (e == item) ? "'%s'" : ", '%s'", item->identifier);
 	}
 
 	cstring = BLI_dynstr_get_cstring(dynstr);
diff --git a/source/blender/python/intern/bpy_util.h b/source/blender/python/intern/bpy_util.h
index 4c06bd2..4bebcb2 100644
--- a/source/blender/python/intern/bpy_util.h
+++ b/source/blender/python/intern/bpy_util.h
@@ -25,8 +25,8 @@
  */
 
 
-#ifndef BPY_UTIL_H
-#define BPY_UTIL_H
+#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."
diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c
index 66e8ff5..e5f45ca 100644
--- a/source/blender/python/intern/gpu.c
+++ b/source/blender/python/intern/gpu.c
@@ -56,26 +56,28 @@
 
 #include "bpy_rna.h"
 
+#include "../generic/py_capi_utils.h"
+
 #include "gpu.h"
 
-#define PY_MODULE_ADD_CONSTANT(module, name) PyModule_AddIntConstant(module, #name, name)
+#define PY_MODULE_ADD_CONSTANT(module, name) PyModule_AddIntConstant(module, # name, name)
 
 PyDoc_STRVAR(M_gpu_doc,
-			 "This module provides access to the GLSL shader.");
-
+"This module provides access to the GLSL shader."
+);
 static struct PyModuleDef gpumodule = {
 	PyModuleDef_HEAD_INIT,
 	"gpu",     /* name of module */
 	M_gpu_doc, /* module documentation */
 	-1,        /* size of per-interpreter state of the module,
-				  or -1 if the module keeps state in global variables. */
-   NULL, NULL, NULL, NULL, NULL
+	            *  or -1 if the module keeps state in global variables. */
+	NULL, NULL, NULL, NULL, NULL
 };
 
 PyMODINIT_FUNC
 PyInit_gpu(void)
 {
-	PyObject* m;
+	PyObject *m;
 
 	m = PyModule_Create(&gpumodule);
 	if (m == NULL)
@@ -114,35 +116,35 @@ PyInit_gpu(void)
 	return m;
 }
 
-#define PY_DICT_ADD_STRING(d,s,f) \
-	val = PyUnicode_FromString(s->f);	\
-	PyDict_SetItemString(d, #f, val);	\
+#define PY_DICT_ADD_STRING(d, s, f)      \
+	val = PyUnicode_FromString(s->f);    \
+	PyDict_SetItemString(d, # f, val);   \
 	Py_DECREF(val)
 
-#define PY_DICT_ADD_LONG(d,s,f) \
-	val = PyLong_FromLong(s->f);	\
-	PyDict_SetItemString(d, #f, val);	\
+#define PY_DICT_ADD_LONG(d, s, f)        \
+	val = PyLong_FromLong(s->f);         \
+	PyDict_SetItemString(d, # f, val);   \
 	Py_DECREF(val)
 
-#define PY_DICT_ADD_ID(d,s,f) \
-	RNA_id_pointer_create((struct ID*)s->f, &tptr);	\
-	val = pyrna_struct_CreatePyObject(&tptr);	\
-	PyDict_SetItemString(d, #f, val);	\
+#define PY_DICT_ADD_ID(d, s, f)                      \
+	RNA_id_pointer_create((struct ID *)s->f, &tptr); \
+	val = pyrna_struct_CreatePyObject(&tptr);        \
+	PyDict_SetItemString(d, # f, val);               \
 	Py_DECREF(val)
 
-#define PY_OBJ_ADD_ID(d,s,f) \
-	val = PyUnicode_FromString(&s->f->id.name[2]);	\
-	PyObject_SetAttrString(d, #f, val);	\
+#define PY_OBJ_ADD_ID(d, s, f)                      \
+	val = PyUnicode_FromString(&s->f->id.name[2]);  \
+	PyObject_SetAttrString(d, # f, val);            \
 	Py_DECREF(val)
 
-#define PY_OBJ_ADD_LONG(d,s,f) \
-	val = PyLong_FromLong(s->f);	\
-	PyObject_SetAttrString(d, #f, val);	\
+#define PY_OBJ_ADD_LONG(d, s, f)         \
+	val = PyLong_FromLong(s->f);         \
+	PyObject_SetAttrString(d, # f, val); \
 	Py_DECREF(val)
 
-#define PY_OBJ_ADD_STRING(d,s,f) \
-	val = PyUnicode_FromString(s->f);	\
-	PyObject_SetAttrString(d, #f, val);	\
+#define PY_OBJ_ADD_STRING(d, s, f)       \
+	val = PyUnicode_FromString(s->f);    \
+	PyObject_SetAttrString(d, # f, val); \
 	Py_DECREF(val)
 
 PyDoc_STRVAR(GPU_export_shader_doc,
@@ -153,16 +155,14 @@ PyDoc_STRVAR(GPU_export_shader_doc,
 "   :return: Dictionary defining the shader, uniforms and attributes.\n"
 "   :rtype: Dict"
 );
-static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObject *kwds)
+static PyObject *GPU_export_shader(PyObject *UNUSED(self), PyObject *args, PyObject *kwds)
 {
-	PyObject* pyscene;
-	PyObject* pymat;
-	PyObject* as_pointer;
-	PyObject* pointer;
-	PyObject* result;
-	PyObject* dict;
-	PyObject* val;
-	PyObject* seq;
+	PyObject *pyscene;
+	PyObject *pymat;
+	PyObject *result;
+	PyObject *dict;
+	PyObject *val;
+	PyObject *seq;
 
 	int i;
 	Scene *scene;
@@ -174,50 +174,19 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj
 
 	static const char *kwlist[] = {"scene", "material", NULL};
 
-	if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO:export_shader", (char**)(kwlist), &pyscene, &pymat))
+	if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO:export_shader", (char **)(kwlist), &pyscene, &pymat))
 		return NULL;
 
-	if (!strcmp(Py_TYPE(pyscene)->tp_name, "Scene") && 
-		(as_pointer = PyObject_GetAttrString(pyscene, "as_pointer")) != NULL &&
-		PyCallable_Check(as_pointer)) {
-		// must be a scene object
-		pointer = PyObject_CallObject(as_pointer, NULL);
-		if (!pointer) {
-			PyErr_SetString(PyExc_SystemError, "scene.as_pointer() failed");
-			return NULL;
-		}
-		scene = (Scene*)PyLong_AsVoidPtr(pointer);
-		Py_DECREF(pointer);
-		if (!scene) {
-			PyErr_SetString(PyExc_SystemError, "scene.as_pointer() failed");
-			return NULL;
-		}
-	}
-	else {
-		PyErr_SetString(PyExc_TypeError, "gpu.export_shader() first argument should be of Scene type");
+	scene = (Scene *)PyC_RNA_AsPointer(pyscene, "Scene");
+	if (scene == NULL) {
 		return NULL;
 	}
 
-	if (!strcmp(Py_TYPE(pymat)->tp_name, "Material") && 
-		(as_pointer = PyObject_GetAttrString(pymat, "as_pointer")) != NULL &&
-		PyCallable_Check(as_pointer)) {
-		// must be a material object
-		pointer = PyObject_CallObject(as_pointer, NULL);
-		if (!pointer) {
-			PyErr_SetString(PyExc_SystemError, "scene.as_pointer() failed");
-			return NULL;
-		}
-		material = (Material*)PyLong_AsVoidPtr(pointer);
-		Py_DECREF(pointer);
-		if (!material) {
-			PyErr_SetString(PyExc_SystemError, "scene.as_pointer() failed");
-			return NULL;
-		}
-	}
-	else {
-		PyErr_SetString(PyExc_TypeError, "gpu.export_shader() second argument should be of Material type");
+	material = (Material *)PyC_RNA_AsPointer(pymat, "Material");
+	if (material == NULL) {
 		return NULL;
 	}
+
 	// we can call our internal function at last:
 	shader = GPU_shader_export(scene, material);
 	if (!shader) {
@@ -227,33 +196,34 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj
 	// build a dictionary
 	result = PyDict_New();
 	if (shader->fragment) {
-		PY_DICT_ADD_STRING(result,shader,fragment);
+		PY_DICT_ADD_STRING(result, shader, fragment);
 	}
 	if (shader->vertex) {
-		PY_DICT_ADD_STRING(result,shader,vertex);
+		PY_DICT_ADD_STRING(result, shader, vertex);
 	}
 	seq = PyList_New(BLI_countlist(&shader->uniforms));
-	for (i=0, uniform=shader->uniforms.first; uniform; uniform=uniform->next, i++) {
+	for (i = 0, uniform = shader->uniforms.first; uniform; uniform = uniform->next, i++) {
 		dict = PyDict_New();
-		PY_DICT_ADD_STRING(dict,uniform,varname);
-		PY_DICT_ADD_LONG(dict,uniform,datatype);
-		PY_DICT_ADD_LONG(dict,uniform,type);
+		PY_DICT_ADD_STRING(dict, uniform, varname);
+		PY_DICT_ADD_LONG(dict, uniform, datatype);
+		PY_DICT_ADD_LONG(dict, uniform, type);
 		if (uniform->lamp) {
-			PY_DICT_ADD_ID(dict,uniform,lamp);
+			PY_DICT_ADD_ID(dict, uniform, lamp);
 		}
 		if (uniform->image) {
-			PY_DICT_ADD_ID(dict,uniform,image);
+			PY_DICT_ADD_ID(dict, uniform, image);
 		}
 		if (uniform->type == GPU_DYNAMIC_SAMPLER_2DBUFFER ||
-			uniform->type == GPU_DYNAMIC_SAMPLER_2DIMAGE ||
-			uniform->type == GPU_DYNAMIC_SAMPLER_2DSHADOW) {
-			PY_DICT_ADD_LONG(dict,uniform,texnumber);
+		    uniform->type == GPU_DYNAMIC_SAMPLER_2DIMAGE ||
+		    uniform->type == GPU_DYNAMIC_SAMPLER_2DSHADOW)
+		{
+			PY_DICT_ADD_LONG(dict, uniform, texnumber);
 		}
 		if (uniform->texpixels) {
 			val = PyByteArray_FromStringAndSize((const char *)uniform->texpixels, uniform->texsize * 4);
 			PyDict_SetItemString(dict, "texpixels", val);
 			Py_DECREF(val);
-			PY_DICT_ADD_LONG(dict,uniform,texsize);
+			PY_DICT_ADD_LONG(dict, uniform, texsize);
 		}
 		PyList_SET_ITEM(seq, i, dict);
 	}
@@ -261,15 +231,15 @@ static PyObject* GPU_export_shader(PyObject* UNUSED(self), PyObject *args, PyObj
 	Py_DECREF(seq);
 
 	seq = PyList_New(BLI_countlist(&shader->attributes));
-	for (i=0, attribute=shader->attributes.first; attribute; attribute=attribute->next, i++) {
+	for (i = 0, attribute = shader->attributes.first; attribute; attribute = attribute->next, i++) {
 		dict = PyDict_New();
-		PY_DICT_ADD_STRING(dict,attribute,varname);
-		PY_DICT_ADD_LONG(dict,attribute,datatype);
-		PY_DICT_ADD_LONG(dict,attribute,type);
-		PY_DICT_ADD_LONG(dict,attribute,number);
+		PY_DICT_ADD_STRING(dict, attribute, varname);
+		PY_DICT_ADD_LONG(dict, attribute, datatype);
+		PY_DICT_ADD_LONG(dict, attribute, type);
+		PY_DICT_ADD_LONG(dict, attribute, number);
 		if (attribute->name) {
 			if (attribute->name[0] != 0) {
-				PY_DICT_ADD_STRING(dict,attribute,name);
+				PY_DICT_ADD_STRING(dict, attribute, name);
 			}
 			else {
 				val = PyLong_FromLong(0);
@@ -291,9 +261,9 @@ static PyMethodDef meth_export_shader[] = {
 	{"export_shader", (PyCFunction)GPU_export_shader, METH_VARARGS | METH_KEYWORDS, GPU_export_shader_doc}
 };
 
-PyObject* GPU_initPython(void)
+PyObject *GPU_initPython(void)
 {
-	PyObject* module = PyInit_gpu();
+	PyObject *module = PyInit_gpu();
 	PyModule_AddObject(module, "export_shader", (PyObject *)PyCFunction_New(meth_export_shader, NULL));
 	PyDict_SetItemString(PyImport_GetModuleDict(), "gpu", module);
 
diff --git a/source/blender/python/intern/gpu.h b/source/blender/python/intern/gpu.h
index bffbae1..68e7fa4 100644
--- a/source/blender/python/intern/gpu.h
+++ b/source/blender/python/intern/gpu.h
@@ -32,5 +32,5 @@
 /**
  * Initalizes the gpu Python module.
  */
-PyObject* GPU_initPython(void);
+PyObject *GPU_initPython(void);
 
diff --git a/source/blender/python/mathutils/mathutils.c b/source/blender/python/mathutils/mathutils.c
index c9afb7e..8b79301 100644
--- a/source/blender/python/mathutils/mathutils.c
+++ b/source/blender/python/mathutils/mathutils.c
@@ -52,8 +52,8 @@ static int mathutils_array_parse_fast(float *array,
 	i = size;
 	do {
 		i--;
-		if ( ((array[i] = PyFloat_AsDouble((item = PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0f) &&
-		     PyErr_Occurred())
+		if (((array[i] = PyFloat_AsDouble((item = PySequence_Fast_GET_ITEM(value_fast, i)))) == -1.0f) &&
+		    PyErr_Occurred())
 		{
 			PyErr_Format(PyExc_TypeError,
 			             "%.200s: sequence index %d expected a number, "
@@ -75,17 +75,17 @@ int mathutils_array_parse(float *array, int array_min, int array_max, PyObject *
 
 #if 1 /* approx 6x speedup for mathutils types */
 
-	if ( (size = VectorObject_Check(value)     ? ((VectorObject *)value)->size : 0) ||
-	     (size = EulerObject_Check(value)      ? 3 : 0) ||
-	     (size = QuaternionObject_Check(value) ? 4 : 0) ||
-	     (size = ColorObject_Check(value)      ? 3 : 0))
+	if ((size = VectorObject_Check(value)     ? ((VectorObject *)value)->size : 0) ||
+	    (size = EulerObject_Check(value)      ? 3 : 0) ||
+	    (size = QuaternionObject_Check(value) ? 4 : 0) ||
+	    (size = ColorObject_Check(value)      ? 3 : 0))
 	{
 		if (BaseMath_ReadCallback((BaseMathObject *)value) == -1) {
 			return -1;
 		}
 
 		if (size > array_max || size < array_min) {
-			if (array_max == array_min)	{
+			if (array_max == array_min) {
 				PyErr_Format(PyExc_ValueError,
 				             "%.200s: sequence size is %d, expected %d",
 				             error_prefix, size, array_max);
@@ -115,15 +115,15 @@ int mathutils_array_parse(float *array, int array_min, int array_max, PyObject *
 		size = PySequence_Fast_GET_SIZE(value_fast);
 
 		if (size > array_max || size < array_min) {
-			if (array_max == array_min)	{
+			if (array_max == array_min) {
 				PyErr_Format(PyExc_ValueError,
-							 "%.200s: sequence size is %d, expected %d",
-							 error_prefix, size, array_max);
+				             "%.200s: sequence size is %d, expected %d",
+				             error_prefix, size, array_max);
 			}
 			else {
 				PyErr_Format(PyExc_ValueError,
-							 "%.200s: sequence size is %d, expected [%d - %d]",
-							 error_prefix, size, array_min, array_max);
+				             "%.200s: sequence size is %d, expected [%d - %d]",
+				             error_prefix, size, array_min, array_max);
 			}
 			Py_DECREF(value_fast);
 			return -1;
@@ -139,10 +139,10 @@ int mathutils_array_parse_alloc(float **array, int array_min, PyObject *value, c
 
 #if 1 /* approx 6x speedup for mathutils types */
 
-	if ( (size = VectorObject_Check(value)     ? ((VectorObject *)value)->size : 0) ||
-	     (size = EulerObject_Check(value)      ? 3 : 0) ||
-	     (size = QuaternionObject_Check(value) ? 4 : 0) ||
-	     (size = ColorObject_Check(value)      ? 3 : 0))
+	if ((size = VectorObject_Check(value)     ? ((VectorObject *)value)->size : 0) ||
+	    (size = EulerObject_Check(value)      ? 3 : 0) ||
+	    (size = QuaternionObject_Check(value) ? 4 : 0) ||
+	    (size = ColorObject_Check(value)      ? 3 : 0))
 	{
 		if (BaseMath_ReadCallback((BaseMathObject *)value) == -1) {
 			return -1;
@@ -163,7 +163,7 @@ int mathutils_array_parse_alloc(float **array, int array_min, PyObject *value, c
 #endif
 	{
 		PyObject *value_fast = NULL;
-		//*array = NULL;
+		// *array = NULL;
 
 		/* non list/tuple cases */
 		if (!(value_fast = PySequence_Fast(value, error_prefix))) {
@@ -186,6 +186,41 @@ int mathutils_array_parse_alloc(float **array, int array_min, PyObject *value, c
 	}
 }
 
+/* parse an array of vectors */
+int mathutils_array_parse_alloc_v(float **array, int array_dim, PyObject *value, const char *error_prefix)
+{
+	PyObject *value_fast = NULL;
+	int i, size;
+
+	/* non list/tuple cases */
+	if (!(value_fast = PySequence_Fast(value, error_prefix))) {
+		/* PySequence_Fast sets the error */
+		return -1;
+	}
+
+	size = PySequence_Fast_GET_SIZE(value_fast);
+
+	if (size != 0) {
+		float *fp;
+
+		fp = *array = PyMem_Malloc(size * array_dim * sizeof(float));
+
+		for (i = 0; i < size; i++, fp += array_dim) {
+			PyObject *item = PySequence_Fast_GET_ITEM(value, i);
+
+			if (mathutils_array_parse(fp, array_dim, array_dim, item, error_prefix) == -1) {
+				PyMem_Free(*array);
+				*array = NULL;
+				size = -1;
+				break;
+			}
+		}
+	}
+
+	Py_DECREF(value_fast);
+	return size;
+}
+
 int mathutils_any_to_rotmat(float rmat[3][3], PyObject *value, const char *error_prefix)
 {
 	if (EulerObject_Check(value)) {
@@ -239,25 +274,26 @@ int mathutils_any_to_rotmat(float rmat[3][3], PyObject *value, const char *error
 /* Utility functions */
 
 // LomontRRDCompare4, Ever Faster Float Comparisons by Randy Dillon
-#define SIGNMASK(i) (-(int)(((unsigned int)(i))>>31))
+#define SIGNMASK(i) (-(int)(((unsigned int)(i)) >> 31))
 
 int EXPP_FloatsAreEqual(float af, float bf, int maxDiff)
-{	// solid, fast routine across all platforms
-	// with constant time behavior
+{
+	/* solid, fast routine across all platforms
+	 * with constant time behavior */
 	int ai = *(int *)(&af);
 	int bi = *(int *)(&bf);
-	int test = SIGNMASK(ai^bi);
+	int test = SIGNMASK(ai ^ bi);
 	int diff, v1, v2;
 
 	assert((0 == test) || (0xFFFFFFFF == test));
 	diff = (ai ^ (test & 0x7fffffff)) - bi;
 	v1 = maxDiff + diff;
 	v2 = maxDiff - diff;
-	return (v1|v2) >= 0;
+	return (v1 | v2) >= 0;
 }
 
 /*---------------------- EXPP_VectorsAreEqual -------------------------
-  Builds on EXPP_FloatsAreEqual to test vectors */
+ * Builds on EXPP_FloatsAreEqual to test vectors */
 int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps)
 {
 	int x;
@@ -281,21 +317,31 @@ PyObject *mathutils_dynstr_to_py(struct DynStr *ds)
 	return ret;
 }
 
+/* silly function, we dont use arg. just check its compatible with __deepcopy__ */
+int mathutils_deepcopy_args_check(PyObject *args)
+{
+	PyObject *dummy_pydict;
+	return PyArg_ParseTuple(args, "|O!:__deepcopy__", &PyDict_Type, &dummy_pydict) != 0;
+}
+
 /* Mathutils Callbacks */
 
 /* for mathutils internal use only, eventually should re-alloc but to start with we only have a few users */
-static Mathutils_Callback *mathutils_callbacks[8] = {NULL};
+#define MATHUTILS_TOT_CB 10
+static Mathutils_Callback *mathutils_callbacks[MATHUTILS_TOT_CB] = {NULL};
 
-int Mathutils_RegisterCallback(Mathutils_Callback *cb)
+unsigned char Mathutils_RegisterCallback(Mathutils_Callback *cb)
 {
-	int i;
+	unsigned char i;
 	
 	/* find the first free slot */
 	for (i = 0; mathutils_callbacks[i]; i++) {
 		if (mathutils_callbacks[i] == cb) /* already registered? */
 			return i;
 	}
-	
+
+	BLI_assert(i + 1 < MATHUTILS_TOT_CB);
+
 	mathutils_callbacks[i] = cb;
 	return i;
 }
@@ -304,8 +350,9 @@ int Mathutils_RegisterCallback(Mathutils_Callback *cb)
 int _BaseMathObject_ReadCallback(BaseMathObject *self)
 {
 	Mathutils_Callback *cb = mathutils_callbacks[self->cb_type];
-	if (cb->get(self, self->cb_subtype) != -1)
+	if (LIKELY(cb->get(self, self->cb_subtype) != -1)) {
 		return 0;
+	}
 
 	if (!PyErr_Occurred()) {
 		PyErr_Format(PyExc_RuntimeError,
@@ -318,8 +365,9 @@ int _BaseMathObject_ReadCallback(BaseMathObject *self)
 int _BaseMathObject_WriteCallback(BaseMathObject *self)
 {
 	Mathutils_Callback *cb = mathutils_callbacks[self->cb_type];
-	if (cb->set(self, self->cb_subtype) != -1)
+	if (LIKELY(cb->set(self, self->cb_subtype) != -1)) {
 		return 0;
+	}
 
 	if (!PyErr_Occurred()) {
 		PyErr_Format(PyExc_RuntimeError,
@@ -332,8 +380,9 @@ int _BaseMathObject_WriteCallback(BaseMathObject *self)
 int _BaseMathObject_ReadIndexCallback(BaseMathObject *self, int index)
 {
 	Mathutils_Callback *cb = mathutils_callbacks[self->cb_type];
-	if (cb->get_index(self, self->cb_subtype, index) != -1)
+	if (LIKELY(cb->get_index(self, self->cb_subtype, index) != -1)) {
 		return 0;
+	}
 
 	if (!PyErr_Occurred()) {
 		PyErr_Format(PyExc_RuntimeError,
@@ -346,8 +395,9 @@ int _BaseMathObject_ReadIndexCallback(BaseMathObject *self, int index)
 int _BaseMathObject_WriteIndexCallback(BaseMathObject *self, int index)
 {
 	Mathutils_Callback *cb = mathutils_callbacks[self->cb_type];
-	if (cb->set_index(self, self->cb_subtype, index) != -1)
+	if (LIKELY(cb->set_index(self, self->cb_subtype, index) != -1)) {
 		return 0;
+	}
 
 	if (!PyErr_Occurred()) {
 		PyErr_Format(PyExc_RuntimeError,
@@ -358,7 +408,7 @@ int _BaseMathObject_WriteIndexCallback(BaseMathObject *self, int index)
 }
 
 /* BaseMathObject generic functions for all mathutils types */
-char BaseMathObject_owner_doc[] = "The item this is wrapping or None  (readonly).";
+char BaseMathObject_owner_doc[] = "The item this is wrapping or None  (read-only).";
 PyObject *BaseMathObject_owner_get(BaseMathObject *self, void *UNUSED(closure))
 {
 	PyObject *ret = self->cb_user ? self->cb_user : Py_None;
@@ -366,10 +416,10 @@ PyObject *BaseMathObject_owner_get(BaseMathObject *self, void *UNUSED(closure))
 	return ret;
 }
 
-char BaseMathObject_is_wrapped_doc[] = "True when this object wraps external data (readonly).\n\n:type: boolean";
+char BaseMathObject_is_wrapped_doc[] = "True when this object wraps external data (read-only).\n\n:type: boolean";
 PyObject *BaseMathObject_is_wrapped_get(BaseMathObject *self, void *UNUSED(closure))
 {
-	return PyBool_FromLong((self->wrapped == Py_WRAP) ? 1:0);
+	return PyBool_FromLong((self->wrapped == Py_WRAP) ? 1 : 0);
 }
 
 int BaseMathObject_traverse(BaseMathObject *self, visitproc visit, void *arg)
@@ -418,8 +468,8 @@ static struct PyModuleDef M_Mathutils_module_def = {
 
 PyMODINIT_FUNC PyInit_mathutils(void)
 {
+	PyObject *mod;
 	PyObject *submodule;
-	PyObject *item;
 	PyObject *sys_modules = PyThreadState_GET()->interp->modules;
 
 	if (PyType_Ready(&vector_Type) < 0)
@@ -435,31 +485,31 @@ PyMODINIT_FUNC PyInit_mathutils(void)
 	if (PyType_Ready(&color_Type) < 0)
 		return NULL;
 
-	submodule = PyModule_Create(&M_Mathutils_module_def);
+	mod = PyModule_Create(&M_Mathutils_module_def);
 	
 	/* each type has its own new() function */
-	PyModule_AddObject(submodule, "Vector",		(PyObject *)&vector_Type);
-	PyModule_AddObject(submodule, "Matrix",		(PyObject *)&matrix_Type);
-	PyModule_AddObject(submodule, "Euler",		(PyObject *)&euler_Type);
-	PyModule_AddObject(submodule, "Quaternion",	(PyObject *)&quaternion_Type);
-	PyModule_AddObject(submodule, "Color",		(PyObject *)&color_Type);
+	PyModule_AddObject(mod, vector_Type.tp_name,     (PyObject *)&vector_Type);
+	PyModule_AddObject(mod, matrix_Type.tp_name,     (PyObject *)&matrix_Type);
+	PyModule_AddObject(mod, euler_Type.tp_name,      (PyObject *)&euler_Type);
+	PyModule_AddObject(mod, quaternion_Type.tp_name, (PyObject *)&quaternion_Type);
+	PyModule_AddObject(mod, color_Type.tp_name,      (PyObject *)&color_Type);
 	
 	/* submodule */
-	PyModule_AddObject(submodule, "geometry",		(item = PyInit_mathutils_geometry()));
+	PyModule_AddObject(mod, "geometry",       (submodule = PyInit_mathutils_geometry()));
 	/* XXX, python doesnt do imports with this usefully yet
 	 * 'from mathutils.geometry import PolyFill'
 	 * ...fails without this. */
-	PyDict_SetItemString(sys_modules, "mathutils.geometry", item);
-	Py_INCREF(item);
+	PyDict_SetItemString(sys_modules, PyModule_GetName(submodule), submodule);
+	Py_INCREF(submodule);
 
 	/* Noise submodule */
-	PyModule_AddObject(submodule, "noise",		(item = PyInit_mathutils_noise()));
-	PyDict_SetItemString(sys_modules, "mathutils.noise", item);
-	Py_INCREF(item);
+	PyModule_AddObject(mod, "noise", (submodule = PyInit_mathutils_noise()));
+	PyDict_SetItemString(sys_modules, PyModule_GetName(submodule), submodule);
+	Py_INCREF(submodule);
 
 	mathutils_matrix_row_cb_index = Mathutils_RegisterCallback(&mathutils_matrix_row_cb);
 	mathutils_matrix_col_cb_index = Mathutils_RegisterCallback(&mathutils_matrix_col_cb);
 	mathutils_matrix_translation_cb_index = Mathutils_RegisterCallback(&mathutils_matrix_translation_cb);
 
-	return submodule;
+	return mod;
 }
diff --git a/source/blender/python/mathutils/mathutils.h b/source/blender/python/mathutils/mathutils.h
index 220ae61..e8d128b 100644
--- a/source/blender/python/mathutils/mathutils.h
+++ b/source/blender/python/mathutils/mathutils.h
@@ -32,8 +32,8 @@
 
 //Include this file for access to vector, quat, matrix, euler, etc...
 
-#ifndef MATHUTILS_H
-#define MATHUTILS_H
+#ifndef __MATHUTILS_H__
+#define __MATHUTILS_H__
 
 /* Can cast different mathutils types to this, use for generic funcs */
 
@@ -67,8 +67,8 @@ typedef struct {
 #include "mathutils_geometry.h"
 #include "mathutils_noise.h"
 
-PyObject *BaseMathObject_owner_get( BaseMathObject * self, void * );
-PyObject *BaseMathObject_is_wrapped_get( BaseMathObject *self, void * );
+PyObject *BaseMathObject_owner_get(BaseMathObject * self, void *);
+PyObject *BaseMathObject_is_wrapped_get(BaseMathObject *self, void *);
 
 int BaseMathObject_traverse(BaseMathObject *self, visitproc visit, void *arg);
 int BaseMathObject_clear(BaseMathObject *self);
@@ -98,7 +98,7 @@ struct Mathutils_Callback {
 	BaseMathSetIndexFunc	set_index;
 };
 
-int Mathutils_RegisterCallback(Mathutils_Callback *cb);
+unsigned char Mathutils_RegisterCallback(Mathutils_Callback *cb);
 
 int _BaseMathObject_ReadCallback(BaseMathObject *self);
 int _BaseMathObject_WriteCallback(BaseMathObject *self);
@@ -118,11 +118,13 @@ int _BaseMathObject_WriteIndexCallback(BaseMathObject *self, int index);
 /* utility func */
 int mathutils_array_parse(float *array, int array_min, int array_max, PyObject *value, const char *error_prefix);
 int mathutils_array_parse_alloc(float **array, int array_min, PyObject *value, const char *error_prefix);
+int mathutils_array_parse_alloc_v(float **array, int array_dim, PyObject *value, const char *error_prefix);
 int mathutils_any_to_rotmat(float rmat[3][3], PyObject *value, const char *error_prefix);
 
 int column_vector_multiplication(float rvec[4], VectorObject *vec, MatrixObject *mat);
 
 /* dynstr as python string utility funcions */
 PyObject *mathutils_dynstr_to_py(struct DynStr *ds);
+int mathutils_deepcopy_args_check(PyObject *args);
 
-#endif /* MATHUTILS_H */
+#endif /* __MATHUTILS_H__ */
diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c
index 7f3f811..fc8b288 100644
--- a/source/blender/python/mathutils/mathutils_Color.c
+++ b/source/blender/python/mathutils/mathutils_Color.c
@@ -50,17 +50,17 @@ static PyObject *Color_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 	}
 
 	switch (PyTuple_GET_SIZE(args)) {
-	case 0:
-		break;
-	case 1:
-		if ((mathutils_array_parse(col, COLOR_SIZE, COLOR_SIZE, PyTuple_GET_ITEM(args, 0), "mathutils.Color()")) == -1)
+		case 0:
+			break;
+		case 1:
+			if ((mathutils_array_parse(col, COLOR_SIZE, COLOR_SIZE, PyTuple_GET_ITEM(args, 0), "mathutils.Color()")) == -1)
+				return NULL;
+			break;
+		default:
+			PyErr_SetString(PyExc_TypeError,
+			                "mathutils.Color(): "
+			                "more then a single arg given");
 			return NULL;
-		break;
-	default:
-		PyErr_SetString(PyExc_TypeError,
-		                "mathutils.Color(): "
-		                "more then a single arg given");
-		return NULL;
 	}
 	return Color_CreatePyObject(col, Py_NEW, type);
 }
@@ -107,6 +107,12 @@ static PyObject *Color_copy(ColorObject *self)
 
 	return Color_CreatePyObject(self->col, Py_NEW, Py_TYPE(self));
 }
+static PyObject *Color_deepcopy(ColorObject *self, PyObject *args)
+{
+	if (!mathutils_deepcopy_args_check(args))
+		return NULL;
+	return Color_copy(self);
+}
 
 //----------------------------print object (internal)--------------
 //print the object to screen
@@ -159,21 +165,21 @@ static PyObject *Color_richcmpr(PyObject *a, PyObject *b, int op)
 	}
 
 	switch (op) {
-	case Py_NE:
-		ok = !ok; /* pass through */
-	case Py_EQ:
-		res = ok ? Py_False : Py_True;
-		break;
-
-	case Py_LT:
-	case Py_LE:
-	case Py_GT:
-	case Py_GE:
-		res = Py_NotImplemented;
-		break;
-	default:
-		PyErr_BadArgument();
-		return NULL;
+		case Py_NE:
+			ok = !ok; /* pass through */
+		case Py_EQ:
+			res = ok ? Py_False : Py_True;
+			break;
+
+		case Py_LT:
+		case Py_LE:
+		case Py_GT:
+		case Py_GE:
+			res = Py_NotImplemented;
+			break;
+		default:
+			PyErr_BadArgument();
+			return NULL;
 	}
 
 	return Py_INCREF(res), res;
@@ -194,7 +200,7 @@ static PyObject *Color_item(ColorObject *self, int i)
 
 	if (i < 0 || i >= COLOR_SIZE) {
 		PyErr_SetString(PyExc_IndexError,
-		                "color[attribute]: "
+		                "color[item]: "
 		                "array index out of range");
 		return NULL;
 	}
@@ -213,15 +219,15 @@ static int Color_ass_item(ColorObject *self, int i, PyObject *value)
 
 	if (f == -1 && PyErr_Occurred()) { // parsed item not a number
 		PyErr_SetString(PyExc_TypeError,
-		                "color[attribute] = x: "
+		                "color[item] = x: "
 		                "argument not a number");
 		return -1;
 	}
 
-	if (i < 0) i= COLOR_SIZE - i;
+	if (i < 0) i = COLOR_SIZE - i;
 
 	if (i < 0 || i >= COLOR_SIZE) {
-		PyErr_SetString(PyExc_IndexError, "color[attribute] = x: "
+		PyErr_SetString(PyExc_IndexError, "color[item] = x: "
 		                "array assignment index out of range");
 		return -1;
 	}
@@ -358,16 +364,16 @@ static int Color_ass_subscript(ColorObject *self, PyObject *item, PyObject *valu
 
 //-----------------PROTCOL DECLARATIONS--------------------------
 static PySequenceMethods Color_SeqMethods = {
-	(lenfunc) Color_len,					/* sq_length */
-	(binaryfunc) NULL,						/* sq_concat */
-	(ssizeargfunc) NULL,					/* sq_repeat */
-	(ssizeargfunc) Color_item,				/* sq_item */
-	NULL,									/* sq_slice, deprecated */
-	(ssizeobjargproc) Color_ass_item,		/* sq_ass_item */
-	NULL,									/* sq_ass_slice, deprecated */
-	(objobjproc) NULL,						/* sq_contains */
-	(binaryfunc) NULL,						/* sq_inplace_concat */
-	(ssizeargfunc) NULL,					/* sq_inplace_repeat */
+	(lenfunc) Color_len,                    /* sq_length */
+	(binaryfunc) NULL,                      /* sq_concat */
+	(ssizeargfunc) NULL,                    /* sq_repeat */
+	(ssizeargfunc) Color_item,              /* sq_item */
+	NULL,                                   /* sq_slice, deprecated */
+	(ssizeobjargproc) Color_ass_item,       /* sq_ass_item */
+	NULL,                                   /* sq_ass_slice, deprecated */
+	(objobjproc) NULL,                      /* sq_contains */
+	(binaryfunc) NULL,                      /* sq_inplace_concat */
+	(ssizeargfunc) NULL,                    /* sq_inplace_repeat */
 };
 
 static PyMappingMethods Color_AsMapping = {
@@ -490,12 +496,12 @@ static PyObject *Color_mul(PyObject *v1, PyObject *v2)
 	ColorObject *color1 = NULL, *color2 = NULL;
 	float scalar;
 
-	if ColorObject_Check(v1) {
+	if (ColorObject_Check(v1)) {
 		color1 = (ColorObject *)v1;
 		if (BaseMath_ReadCallback(color1) == -1)
 			return NULL;
 	}
-	if ColorObject_Check(v2) {
+	if (ColorObject_Check(v2)) {
 		color2 = (ColorObject *)v2;
 		if (BaseMath_ReadCallback(color2) == -1)
 			return NULL;
@@ -504,7 +510,7 @@ static PyObject *Color_mul(PyObject *v1, PyObject *v2)
 
 	/* make sure v1 is always the vector */
 	if (color1 && color2) {
-		/* col * col, dont support yet! */
+		/* col * col, don't support yet! */
 	}
 	else if (color1) {
 		if (((scalar = PyFloat_AsDouble(v2)) == -1.0f && PyErr_Occurred()) == 0) { /* COLOR * FLOAT */
@@ -532,7 +538,7 @@ static PyObject *Color_div(PyObject *v1, PyObject *v2)
 	ColorObject *color1 = NULL;
 	float scalar;
 
-	if ColorObject_Check(v1) {
+	if (ColorObject_Check(v1)) {
 		color1 = (ColorObject *)v1;
 		if (BaseMath_ReadCallback(color1) == -1)
 			return NULL;
@@ -619,7 +625,7 @@ static PyObject *Color_idiv(PyObject *v1, PyObject *v2)
 }
 
 /* -obj
-  returns the negative of this object */
+ * returns the negative of this object */
 static PyObject *Color_neg(ColorObject *self)
 {
 	float tcol[COLOR_SIZE];
@@ -633,40 +639,40 @@ static PyObject *Color_neg(ColorObject *self)
 
 
 static PyNumberMethods Color_NumMethods = {
-	(binaryfunc) Color_add,	/*nb_add*/
-	(binaryfunc) Color_sub,	/*nb_subtract*/
-	(binaryfunc) Color_mul,	/*nb_multiply*/
-	NULL,				/*nb_remainder*/
-	NULL,				/*nb_divmod*/
-	NULL,				/*nb_power*/
+	(binaryfunc) Color_add, /*nb_add*/
+	(binaryfunc) Color_sub, /*nb_subtract*/
+	(binaryfunc) Color_mul, /*nb_multiply*/
+	NULL,               /*nb_remainder*/
+	NULL,               /*nb_divmod*/
+	NULL,               /*nb_power*/
 	(unaryfunc) Color_neg, /*nb_negative*/
-	(unaryfunc) NULL,	/*tp_positive*/
-	(unaryfunc) NULL,	/*tp_absolute*/
-	(inquiry)	NULL,	/*tp_bool*/
-	(unaryfunc)	NULL,	/*nb_invert*/
-	NULL,				/*nb_lshift*/
-	(binaryfunc)NULL,	/*nb_rshift*/
-	NULL,				/*nb_and*/
-	NULL,				/*nb_xor*/
-	NULL,				/*nb_or*/
-	NULL,				/*nb_int*/
-	NULL,				/*nb_reserved*/
-	NULL,				/*nb_float*/
-	Color_iadd,			/* nb_inplace_add */
-	Color_isub,			/* nb_inplace_subtract */
-	Color_imul,			/* nb_inplace_multiply */
-	NULL,				/* nb_inplace_remainder */
-	NULL,				/* nb_inplace_power */
-	NULL,				/* nb_inplace_lshift */
-	NULL,				/* nb_inplace_rshift */
-	NULL,				/* nb_inplace_and */
-	NULL,				/* nb_inplace_xor */
-	NULL,				/* nb_inplace_or */
-	NULL,				/* nb_floor_divide */
-	Color_div,			/* nb_true_divide */
-	NULL,				/* nb_inplace_floor_divide */
-	Color_idiv,			/* nb_inplace_true_divide */
-	NULL,				/* nb_index */
+	(unaryfunc) NULL,   /*tp_positive*/
+	(unaryfunc) NULL,   /*tp_absolute*/
+	(inquiry)   NULL,   /*tp_bool*/
+	(unaryfunc) NULL,   /*nb_invert*/
+	NULL,               /*nb_lshift*/
+	(binaryfunc)NULL,   /*nb_rshift*/
+	NULL,               /*nb_and*/
+	NULL,               /*nb_xor*/
+	NULL,               /*nb_or*/
+	NULL,               /*nb_int*/
+	NULL,               /*nb_reserved*/
+	NULL,               /*nb_float*/
+	Color_iadd,         /* nb_inplace_add */
+	Color_isub,         /* nb_inplace_subtract */
+	Color_imul,         /* nb_inplace_multiply */
+	NULL,               /* nb_inplace_remainder */
+	NULL,               /* nb_inplace_power */
+	NULL,               /* nb_inplace_lshift */
+	NULL,               /* nb_inplace_rshift */
+	NULL,               /* nb_inplace_and */
+	NULL,               /* nb_inplace_xor */
+	NULL,               /* nb_inplace_or */
+	NULL,               /* nb_floor_divide */
+	Color_div,          /* nb_true_divide */
+	NULL,               /* nb_inplace_floor_divide */
+	Color_idiv,         /* nb_inplace_true_divide */
+	NULL,               /* nb_index */
 };
 
 /* color channel, vector.r/g/b */
@@ -679,7 +685,7 @@ static PyObject *Color_channel_get(ColorObject *self, void *type)
 	return Color_item(self, GET_INT_FROM_POINTER(type));
 }
 
-static int Color_channel_set(ColorObject *self, PyObject *value, void * type)
+static int Color_channel_set(ColorObject *self, PyObject *value, void *type)
 {
 	return Color_ass_item(self, GET_INT_FROM_POINTER(type), value);
 }
@@ -702,7 +708,7 @@ static PyObject *Color_channel_hsv_get(ColorObject *self, void *type)
 	return PyFloat_FromDouble(hsv[i]);
 }
 
-static int Color_channel_hsv_set(ColorObject *self, PyObject *value, void * type)
+static int Color_channel_hsv_set(ColorObject *self, PyObject *value, void *type)
 {
 	float hsv[3];
 	int i = GET_INT_FROM_POINTER(type);
@@ -789,8 +795,9 @@ static PyGetSetDef Color_getseters[] = {
 
 //-----------------------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},
+	{"__copy__", (PyCFunction) Color_copy, METH_NOARGS, Color_copy_doc},
+	{"__deepcopy__", (PyCFunction) Color_deepcopy, METH_VARARGS, Color_copy_doc},
 	{NULL, NULL, 0, NULL}
 };
 
@@ -800,64 +807,64 @@ PyDoc_STRVAR(color_doc,
 );
 PyTypeObject color_Type = {
 	PyVarObject_HEAD_INIT(NULL, 0)
-	"mathutils.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
+	"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
+	(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
-/*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())*/
+/* 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)
 {
 	ColorObject *self;
 
-	self = base_type ?	(ColorObject *)base_type->tp_alloc(base_type, 0) :
-						(ColorObject *)PyObject_GC_New(ColorObject, &color_Type);
+	self = base_type ?  (ColorObject *)base_type->tp_alloc(base_type, 0) :
+	                    (ColorObject *)PyObject_GC_New(ColorObject, &color_Type);
 
 	if (self) {
 		/* init callbacks as NULL */
@@ -885,14 +892,15 @@ PyObject *Color_CreatePyObject(float *col, int type, PyTypeObject *base_type)
 	return (PyObject *)self;
 }
 
-PyObject *Color_CreatePyObject_cb(PyObject *cb_user, int cb_type, int cb_subtype)
+PyObject *Color_CreatePyObject_cb(PyObject *cb_user,
+                                  unsigned char cb_type, unsigned char cb_subtype)
 {
 	ColorObject *self = (ColorObject *)Color_CreatePyObject(NULL, Py_NEW, NULL);
 	if (self) {
 		Py_INCREF(cb_user);
-		self->cb_user =			cb_user;
-		self->cb_type =			(unsigned char)cb_type;
-		self->cb_subtype =		(unsigned char)cb_subtype;
+		self->cb_user         = cb_user;
+		self->cb_type         = cb_type;
+		self->cb_subtype      = cb_subtype;
 		PyObject_GC_Track(self);
 	}
 
diff --git a/source/blender/python/mathutils/mathutils_Color.h b/source/blender/python/mathutils/mathutils_Color.h
index 7e8a990..2bf6ba2 100644
--- a/source/blender/python/mathutils/mathutils_Color.h
+++ b/source/blender/python/mathutils/mathutils_Color.h
@@ -32,8 +32,8 @@
  */
 
 
-#ifndef MATHUTILS_COLOR_H
-#define MATHUTILS_COLOR_H
+#ifndef __MATHUTILS_COLOR_H__
+#define __MATHUTILS_COLOR_H__
 
 extern PyTypeObject color_Type;
 #define ColorObject_Check(_v) PyObject_TypeCheck((_v), &color_Type)
@@ -42,13 +42,14 @@ typedef struct {
 	BASE_MATH_MEMBERS(col);
 } ColorObject;
 
-/*struct data contains a pointer to the actual data that the
-object uses. It can use either PyMem allocated data (which will
-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*/
+/* struct data contains a pointer to the actual data that the
+ * object uses. It can use either PyMem allocated data (which will
+ * 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);
-PyObject *Color_CreatePyObject_cb(PyObject *cb_user, int cb_type, int cb_subtype);
+PyObject *Color_CreatePyObject(float *col, int type, PyTypeObject *base_type);
+PyObject *Color_CreatePyObject_cb(PyObject *cb_user,
+                                  unsigned char cb_type, unsigned char cb_subtype);
 
-#endif /* MATHUTILS_COLOR_H */
+#endif /* __MATHUTILS_COLOR_H__ */
diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c
index 66caed5..a663bd7 100644
--- a/source/blender/python/mathutils/mathutils_Euler.c
+++ b/source/blender/python/mathutils/mathutils_Euler.c
@@ -61,16 +61,16 @@ static PyObject *Euler_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 		return NULL;
 
 	switch (PyTuple_GET_SIZE(args)) {
-	case 0:
-		break;
-	case 2:
-		if ((order = euler_order_from_string(order_str, "mathutils.Euler()")) == -1)
-			return NULL;
+		case 0:
+			break;
+		case 2:
+			if ((order = euler_order_from_string(order_str, "mathutils.Euler()")) == -1)
+				return NULL;
 		/* intentionally pass through */
-	case 1:
-		if (mathutils_array_parse(eul, EULER_SIZE, EULER_SIZE, seq, "mathutils.Euler()") == -1)
-			return NULL;
-		break;
+		case 1:
+			if (mathutils_array_parse(eul, EULER_SIZE, EULER_SIZE, seq, "mathutils.Euler()") == -1)
+				return NULL;
+			break;
 	}
 	return Euler_CreatePyObject(eul, order, Py_NEW, type);
 }
@@ -86,12 +86,12 @@ short euler_order_from_string(const char *str, const char *error_prefix)
 {
 	if ((str[0] && str[1] && str[2] && str[3] == '\0')) {
 		switch (*((PY_INT32_T *)str)) {
-			case 'X'|'Y'<<8|'Z'<<16:	return EULER_ORDER_XYZ;
-			case 'X'|'Z'<<8|'Y'<<16:	return EULER_ORDER_XZY;
-			case 'Y'|'X'<<8|'Z'<<16:	return EULER_ORDER_YXZ;
-			case 'Y'|'Z'<<8|'X'<<16:	return EULER_ORDER_YZX;
-			case 'Z'|'X'<<8|'Y'<<16:	return EULER_ORDER_ZXY;
-			case 'Z'|'Y'<<8|'X'<<16:	return EULER_ORDER_ZYX;
+			case 'X' | 'Y' << 8 | 'Z' << 16:    return EULER_ORDER_XYZ;
+			case 'X' | 'Z' << 8 | 'Y' << 16:    return EULER_ORDER_XZY;
+			case 'Y' | 'X' << 8 | 'Z' << 16:    return EULER_ORDER_YXZ;
+			case 'Y' | 'Z' << 8 | 'X' << 16:    return EULER_ORDER_YZX;
+			case 'Z' | 'X' << 8 | 'Y' << 16:    return EULER_ORDER_ZXY;
+			case 'Z' | 'Y' << 8 | 'X' << 16:    return EULER_ORDER_ZYX;
 		}
 	}
 
@@ -164,7 +164,7 @@ static PyObject *Euler_to_matrix(EulerObject *self)
 
 	eulO_to_mat3((float (*)[3])mat, self->eul, self->order);
 
-	return Matrix_CreatePyObject(mat, 3, 3 , Py_NEW, NULL);
+	return Matrix_CreatePyObject(mat, 3, 3, Py_NEW, NULL);
 }
 
 PyDoc_STRVAR(Euler_zero_doc,
@@ -299,6 +299,12 @@ static PyObject *Euler_copy(EulerObject *self)
 
 	return Euler_CreatePyObject(self->eul, self->order, Py_NEW, Py_TYPE(self));
 }
+static PyObject *Euler_deepcopy(EulerObject *self, PyObject *args)
+{
+	if (!mathutils_deepcopy_args_check(args))
+		return NULL;
+	return Euler_copy(self);
+}
 
 //----------------------------print object (internal)--------------
 //print the object to screen
@@ -349,21 +355,21 @@ static PyObject *Euler_richcmpr(PyObject *a, PyObject *b, int op)
 	}
 
 	switch (op) {
-	case Py_NE:
-		ok = !ok; /* pass through */
-	case Py_EQ:
-		res = ok ? Py_False : Py_True;
-		break;
-
-	case Py_LT:
-	case Py_LE:
-	case Py_GT:
-	case Py_GE:
-		res = Py_NotImplemented;
-		break;
-	default:
-		PyErr_BadArgument();
-		return NULL;
+		case Py_NE:
+			ok = !ok; /* pass through */
+		case Py_EQ:
+			res = ok ? Py_False : Py_True;
+			break;
+
+		case Py_LT:
+		case Py_LE:
+		case Py_GT:
+		case Py_GE:
+			res = Py_NotImplemented;
+			break;
+		default:
+			PyErr_BadArgument();
+			return NULL;
 	}
 
 	return Py_INCREF(res), res;
@@ -550,16 +556,16 @@ static int Euler_ass_subscript(EulerObject *self, PyObject *item, PyObject *valu
 
 //-----------------PROTCOL DECLARATIONS--------------------------
 static PySequenceMethods Euler_SeqMethods = {
-	(lenfunc) Euler_len,					/* sq_length */
-	(binaryfunc) NULL,						/* sq_concat */
-	(ssizeargfunc) NULL,					/* sq_repeat */
-	(ssizeargfunc) Euler_item,				/* sq_item */
-	(ssizessizeargfunc) NULL,				/* sq_slice, deprecated  */
-	(ssizeobjargproc) Euler_ass_item,		/* sq_ass_item */
-	(ssizessizeobjargproc) NULL,			/* sq_ass_slice, deprecated */
-	(objobjproc) NULL,						/* sq_contains */
-	(binaryfunc) NULL,						/* sq_inplace_concat */
-	(ssizeargfunc) NULL,					/* sq_inplace_repeat */
+	(lenfunc) Euler_len,                    /* sq_length */
+	(binaryfunc) NULL,                      /* sq_concat */
+	(ssizeargfunc) NULL,                    /* sq_repeat */
+	(ssizeargfunc) Euler_item,              /* sq_item */
+	(ssizessizeargfunc) NULL,               /* sq_slice, deprecated  */
+	(ssizeobjargproc) Euler_ass_item,       /* sq_ass_item */
+	(ssizessizeobjargproc) NULL,            /* sq_ass_slice, deprecated */
+	(objobjproc) NULL,                      /* sq_contains */
+	(binaryfunc) NULL,                      /* sq_inplace_concat */
+	(ssizeargfunc) NULL,                    /* sq_inplace_repeat */
 };
 
 static PyMappingMethods Euler_AsMapping = {
@@ -632,8 +638,9 @@ static struct PyMethodDef Euler_methods[] = {
 	{"rotate_axis", (PyCFunction) Euler_rotate_axis, METH_VARARGS, Euler_rotate_axis_doc},
 	{"rotate", (PyCFunction) Euler_rotate, METH_O, Euler_rotate_doc},
 	{"make_compatible", (PyCFunction) Euler_make_compatible, METH_O, Euler_make_compatible_doc},
-	{"__copy__", (PyCFunction) Euler_copy, METH_NOARGS, Euler_copy_doc},
 	{"copy", (PyCFunction) Euler_copy, METH_NOARGS, Euler_copy_doc},
+	{"__copy__", (PyCFunction) Euler_copy, METH_NOARGS, Euler_copy_doc},
+	{"__deepcopy__", (PyCFunction) Euler_deepcopy, METH_VARARGS, Euler_copy_doc},
 	{NULL, NULL, 0, NULL}
 };
 
@@ -643,64 +650,64 @@ PyDoc_STRVAR(euler_doc,
 );
 PyTypeObject euler_Type = {
 	PyVarObject_HEAD_INIT(NULL, 0)
-	"mathutils.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
+	"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
+	(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
-/*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())*/
+/* 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 *Euler_CreatePyObject(float *eul, short order, int type, PyTypeObject *base_type)
 {
 	EulerObject *self;
 
-	self = base_type ?	(EulerObject *)base_type->tp_alloc(base_type, 0) :
-						(EulerObject *)PyObject_GC_New(EulerObject, &euler_Type);
+	self = base_type ?  (EulerObject *)base_type->tp_alloc(base_type, 0) :
+	                    (EulerObject *)PyObject_GC_New(EulerObject, &euler_Type);
 
 	if (self) {
 		/* init callbacks as NULL */
@@ -732,14 +739,15 @@ PyObject *Euler_CreatePyObject(float *eul, short order, int type, PyTypeObject *
 	return (PyObject *)self;
 }
 
-PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, short order, int cb_type, int cb_subtype)
+PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, short order,
+                                  unsigned char cb_type, unsigned char cb_subtype)
 {
 	EulerObject *self = (EulerObject *)Euler_CreatePyObject(NULL, order, Py_NEW, NULL);
 	if (self) {
 		Py_INCREF(cb_user);
-		self->cb_user =			cb_user;
-		self->cb_type =			(unsigned char)cb_type;
-		self->cb_subtype =		(unsigned char)cb_subtype;
+		self->cb_user         = cb_user;
+		self->cb_type         = cb_type;
+		self->cb_subtype      = cb_subtype;
 		PyObject_GC_Track(self);
 	}
 
diff --git a/source/blender/python/mathutils/mathutils_Euler.h b/source/blender/python/mathutils/mathutils_Euler.h
index c42b0da..56199f4 100644
--- a/source/blender/python/mathutils/mathutils_Euler.h
+++ b/source/blender/python/mathutils/mathutils_Euler.h
@@ -32,8 +32,8 @@
  */
 
 
-#ifndef MATHUTILS_EULER_H
-#define MATHUTILS_EULER_H
+#ifndef __MATHUTILS_EULER_H__
+#define __MATHUTILS_EULER_H__
 
 extern PyTypeObject euler_Type;
 #define EulerObject_Check(_v) PyObject_TypeCheck((_v), &euler_Type)
@@ -44,16 +44,17 @@ typedef struct {
 
 } EulerObject;
 
-/*struct data contains a pointer to the actual data that the
-object uses. It can use either PyMem allocated data (which will
-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 */
+/* struct data contains a pointer to the actual data that the
+ * object uses. It can use either PyMem allocated data (which will
+ * 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 *Euler_CreatePyObject( float *eul, short order, int type, PyTypeObject *base_type);
-PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, short order, int cb_type, int cb_subtype);
+PyObject *Euler_CreatePyObject(float *eul, short order, int type, PyTypeObject *base_type);
+PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, short order,
+                                  unsigned char cb_type, unsigned char cb_subtype);
 
 short euler_order_from_string(const char *str, const char *error_prefix);
 
 
-#endif /* MATHUTILS_EULER_H */
+#endif /* __MATHUTILS_EULER_H__ */
diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c
index cbe5b6d..a48e7ed 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.c
+++ b/source/blender/python/mathutils/mathutils_Matrix.c
@@ -44,6 +44,7 @@ typedef enum eMatrixAccess_t {
 } eMatrixAccess_t;
 
 static PyObject *Matrix_copy(MatrixObject *self);
+static PyObject *Matrix_deepcopy(MatrixObject *self, PyObject *args);
 static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *value);
 static PyObject *matrix__apply_to_copy(PyNoArgsFunction matrix_func, MatrixObject *self);
 static PyObject *MatrixAccess_CreatePyObject(MatrixObject *matrix, const eMatrixAccess_t type);
@@ -78,7 +79,7 @@ static int matrix_col_vector_check(MatrixObject *mat, VectorObject *vec, int col
  * matrix row callbacks
  * this is so you can do matrix[i][j] = val OR matrix.row[i][j] = val */
 
-int mathutils_matrix_row_cb_index = -1;
+unsigned char mathutils_matrix_row_cb_index = -1;
 
 static int mathutils_matrix_row_check(BaseMathObject *bmo)
 {
@@ -162,7 +163,7 @@ Mathutils_Callback mathutils_matrix_row_cb = {
  * matrix row callbacks
  * this is so you can do matrix.col[i][j] = val */
 
-int mathutils_matrix_col_cb_index = -1;
+unsigned char mathutils_matrix_col_cb_index = -1;
 
 static int mathutils_matrix_col_check(BaseMathObject *bmo)
 {
@@ -255,7 +256,7 @@ Mathutils_Callback mathutils_matrix_col_cb = {
  * this is so you can do matrix.translation = val
  * note, this is _exactly like matrix.col except the 4th component is always omitted */
 
-int mathutils_matrix_translation_cb_index = -1;
+unsigned char mathutils_matrix_translation_cb_index = -1;
 
 static int mathutils_matrix_translation_check(BaseMathObject *bmo)
 {
@@ -431,8 +432,8 @@ static PyObject *C_Matrix_Identity(PyObject *cls, PyObject *args)
 
 	if (matSize < 2 || matSize > 4) {
 		PyErr_SetString(PyExc_RuntimeError,
-						"Matrix.Identity(): "
-						"size must be between 2 and 4");
+		                "Matrix.Identity(): "
+		                "size must be between 2 and 4");
 		return NULL;
 	}
 
@@ -461,9 +462,9 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args)
 	int matSize;
 	double angle; /* use double because of precision problems at high values */
 	float mat[16] = {0.0f, 0.0f, 0.0f, 0.0f,
-	                 0.0f, 0.0f, 0.0f, 0.0f,
-	                 0.0f, 0.0f, 0.0f, 0.0f,
-	                 0.0f, 0.0f, 0.0f, 1.0f};
+		             0.0f, 0.0f, 0.0f, 0.0f,
+		             0.0f, 0.0f, 0.0f, 0.0f,
+		             0.0f, 0.0f, 0.0f, 1.0f};
 
 	if (!PyArg_ParseTuple(args, "di|O:Matrix.Rotation", &angle, &matSize, &vec)) {
 		return NULL;
@@ -549,7 +550,7 @@ PyDoc_STRVAR(C_Matrix_Translation_doc,
 );
 static PyObject *C_Matrix_Translation(PyObject *cls, PyObject *value)
 {
-	float mat[4][4]= MAT4_UNITY;
+	float mat[4][4] = MAT4_UNITY;
 
 	if (mathutils_array_parse(mat[3], 3, 4, value, "mathutils.Matrix.Translation(vector), invalid vector arg") == -1)
 		return NULL;
@@ -601,7 +602,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;
@@ -612,8 +613,9 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args)
 			mat[8] = factor;
 		}
 	}
-	else { //scaling in arbitrary direction
-		//normalize arbitrary axis
+	else {
+		/* scaling in arbitrary direction
+		 * normalize arbitrary axis */
 		float norm = 0.0f;
 		int x;
 		for (x = 0; x < vec_size; x++) {
@@ -624,21 +626,21 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args)
 			tvec[x] /= norm;
 		}
 		if (matSize == 2) {
-			mat[0] = 1 + ((factor - 1) *(tvec[0] * tvec[0]));
-			mat[1] =     ((factor - 1) *(tvec[0] * tvec[1]));
-			mat[2] =     ((factor - 1) *(tvec[0] * tvec[1]));
-			mat[3] = 1 + ((factor - 1) *(tvec[1] * tvec[1]));
+			mat[0] = 1 + ((factor - 1) * (tvec[0] * tvec[0]));
+			mat[1] =     ((factor - 1) * (tvec[0] * tvec[1]));
+			mat[2] =     ((factor - 1) * (tvec[0] * tvec[1]));
+			mat[3] = 1 + ((factor - 1) * (tvec[1] * tvec[1]));
 		}
 		else {
-			mat[0] = 1 + ((factor - 1) *(tvec[0] * tvec[0]));
-			mat[1] =     ((factor - 1) *(tvec[0] * tvec[1]));
-			mat[2] =     ((factor - 1) *(tvec[0] * tvec[2]));
-			mat[3] =     ((factor - 1) *(tvec[0] * tvec[1]));
-			mat[4] = 1 + ((factor - 1) *(tvec[1] * tvec[1]));
-			mat[5] =     ((factor - 1) *(tvec[1] * tvec[2]));
-			mat[6] =     ((factor - 1) *(tvec[0] * tvec[2]));
-			mat[7] =     ((factor - 1) *(tvec[1] * tvec[2]));
-			mat[8] = 1 + ((factor - 1) *(tvec[2] * tvec[2]));
+			mat[0] = 1 + ((factor - 1) * (tvec[0] * tvec[0]));
+			mat[1] =     ((factor - 1) * (tvec[0] * tvec[1]));
+			mat[2] =     ((factor - 1) * (tvec[0] * tvec[2]));
+			mat[3] =     ((factor - 1) * (tvec[0] * tvec[1]));
+			mat[4] = 1 + ((factor - 1) * (tvec[1] * tvec[1]));
+			mat[5] =     ((factor - 1) * (tvec[1] * tvec[2]));
+			mat[6] =     ((factor - 1) * (tvec[0] * tvec[2]));
+			mat[7] =     ((factor - 1) * (tvec[1] * tvec[2]));
+			mat[8] = 1 + ((factor - 1) * (tvec[2] * tvec[2]));
 		}
 	}
 	if (matSize == 4) {
@@ -684,7 +686,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) {
@@ -780,7 +782,7 @@ PyDoc_STRVAR(C_Matrix_Shear_doc,
 "   :arg size: The size of the shear matrix to construct [2, 4].\n"
 "   :type size: int\n"
 "   :arg factor: The factor of shear to apply. For a 3 or 4 *size* matrix\n"
-"      pass a pair of floats corrasponding with the *plane* axis.\n"
+"      pass a pair of floats corresponding with the *plane* axis.\n"
 "   :type factor: float or float pair\n"
 "   :return: A new shear matrix.\n"
 "   :rtype: :class:`Matrix`\n"
@@ -971,10 +973,10 @@ static PyObject *Matrix_to_euler(MatrixObject *self, PyObject *args)
 	}
 
 	/*must be 3-4 cols, 3-4 rows, square matrix */
-	if (self->num_row ==3 && self->num_col ==3) {
+	if (self->num_row == 3 && self->num_col == 3) {
 		mat = (float (*)[3])self->matrix;
 	}
-	else if (self->num_row ==4 && self->num_col ==4) {
+	else if (self->num_row == 4 && self->num_col == 4) {
 		copy_m3_m4(tmat, (float (*)[4])self->matrix);
 		mat = tmat;
 	}
@@ -993,12 +995,12 @@ static PyObject *Matrix_to_euler(MatrixObject *self, PyObject *args)
 	}
 
 	if (eul_compat) {
-		if (order == 1)	mat3_to_compatible_eul(eul, eul_compatf, mat);
-		else			mat3_to_compatible_eulO(eul, eul_compatf, order, mat);
+		if (order == 1) mat3_to_compatible_eul(eul, eul_compatf, mat);
+		else mat3_to_compatible_eulO(eul, eul_compatf, order, mat);
 	}
 	else {
-		if (order == 1)	mat3_to_eul(eul, mat);
-		else			mat3_to_eulO(eul, order, mat);
+		if (order == 1) mat3_to_eul(eul, mat);
+		else mat3_to_eulO(eul, order, mat);
 	}
 
 	return Euler_CreatePyObject(eul, order, Py_NEW, NULL);
@@ -1202,10 +1204,10 @@ static PyObject *Matrix_invert(MatrixObject *self)
 			mat[3] =  MATRIX_ITEM(self, 0, 0);
 		}
 		else if (self->num_col == 3) {
-			adjoint_m3_m3((float (*)[3]) mat,(float (*)[3])self->matrix);
+			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);
+			adjoint_m4_m4((float (*)[4])mat, (float (*)[4])self->matrix);
 		}
 		/* divide by determinate */
 		for (x = 0; x < (self->num_col * self->num_row); x++) {
@@ -1218,8 +1220,6 @@ static PyObject *Matrix_invert(MatrixObject *self)
 				z++;
 			}
 		}
-		/*transpose
-		Matrix_transpose(self);*/
 	}
 	else {
 		PyErr_SetString(PyExc_ValueError,
@@ -1520,6 +1520,12 @@ static PyObject *Matrix_copy(MatrixObject *self)
 
 	return Matrix_CreatePyObject((float (*))self->matrix, self->num_col, self->num_row, Py_NEW, Py_TYPE(self));
 }
+static PyObject *Matrix_deepcopy(MatrixObject *self, PyObject *args)
+{
+	if (!mathutils_deepcopy_args_check(args))
+		return NULL;
+	return Matrix_copy(self);
+}
 
 /*----------------------------print object (internal)-------------*/
 /* print the object to screen */
@@ -1538,17 +1544,17 @@ static PyObject *Matrix_repr(MatrixObject *self)
 		}
 	}
 	switch (self->num_row) {
-	case 2:	return PyUnicode_FromFormat("Matrix((%R,\n"
-										"        %R))", rows[0], rows[1]);
+		case 2: return PyUnicode_FromFormat("Matrix((%R,\n"
+		                                    "        %R))", rows[0], rows[1]);
 
-	case 3:	return PyUnicode_FromFormat("Matrix((%R,\n"
-										"        %R,\n"
-										"        %R))", rows[0], rows[1], rows[2]);
+		case 3: return PyUnicode_FromFormat("Matrix((%R,\n"
+		                                    "        %R,\n"
+		                                    "        %R))", rows[0], rows[1], rows[2]);
 
-	case 4:	return PyUnicode_FromFormat("Matrix((%R,\n"
-										"        %R,\n"
-										"        %R,\n"
-										"        %R))", rows[0], rows[1], rows[2], rows[3]);
+		case 4: return PyUnicode_FromFormat("Matrix((%R,\n"
+		                                    "        %R,\n"
+		                                    "        %R,\n"
+		                                    "        %R))", rows[0], rows[1], rows[2], rows[3]);
 	}
 
 	Py_FatalError("Matrix(): invalid row size!");
@@ -1603,43 +1609,43 @@ static PyObject *Matrix_richcmpr(PyObject *a, PyObject *b, int op)
 		if (BaseMath_ReadCallback(matA) == -1 || BaseMath_ReadCallback(matB) == -1)
 			return NULL;
 
-		ok = (  (matA->num_row == matB->num_row) &&
-		        (matA->num_col == matB->num_col) &&
-		         EXPP_VectorsAreEqual(matA->matrix, matB->matrix, (matA->num_col * matA->num_row), 1)
-			) ? 0 : -1;
+		ok = ((matA->num_row == matB->num_row) &&
+		      (matA->num_col == matB->num_col) &&
+		      EXPP_VectorsAreEqual(matA->matrix, matB->matrix, (matA->num_col * matA->num_row), 1)
+		      ) ? 0 : -1;
 	}
 
 	switch (op) {
-	case Py_NE:
-		ok = !ok; /* pass through */
-	case Py_EQ:
-		res = ok ? Py_False : Py_True;
-		break;
-
-	case Py_LT:
-	case Py_LE:
-	case Py_GT:
-	case Py_GE:
-		res = Py_NotImplemented;
-		break;
-	default:
-		PyErr_BadArgument();
-		return NULL;
+		case Py_NE:
+			ok = !ok; /* pass through */
+		case Py_EQ:
+			res = ok ? Py_False : Py_True;
+			break;
+
+		case Py_LT:
+		case Py_LE:
+		case Py_GT:
+		case Py_GE:
+			res = Py_NotImplemented;
+			break;
+		default:
+			PyErr_BadArgument();
+			return NULL;
 	}
 
 	return Py_INCREF(res), res;
 }
 
 /*---------------------SEQUENCE PROTOCOLS------------------------
-  ----------------------------len(object)------------------------
-  sequence length */
+ * ----------------------------len(object)------------------------
+ * sequence length */
 static int Matrix_len(MatrixObject *self)
 {
 	return (self->num_row);
 }
 /*----------------------------object[]---------------------------
-  sequence accessor (get)
-  the wrapped vector gives direct access to the matrix data */
+ * sequence accessor (get)
+ * the wrapped vector gives direct access to the matrix data */
 static PyObject *Matrix_item_row(MatrixObject *self, int row)
 {
 	if (BaseMath_ReadCallback(self) == -1)
@@ -1669,7 +1675,7 @@ static PyObject *Matrix_item_col(MatrixObject *self, int col)
 }
 
 /*----------------------------object[]-------------------------
-  sequence accessor (set) */
+ * sequence accessor (set) */
 
 static int Matrix_ass_item_row(MatrixObject *self, int row, PyObject *value)
 {
@@ -1724,7 +1730,7 @@ static int Matrix_ass_item_col(MatrixObject *self, int col, PyObject *value)
 
 
 /*----------------------------object[z:y]------------------------
-  sequence slice (get)*/
+ * sequence slice (get)*/
 static PyObject *Matrix_slice(MatrixObject *self, int begin, int end)
 {
 
@@ -1741,14 +1747,13 @@ static PyObject *Matrix_slice(MatrixObject *self, int begin, int end)
 	tuple = PyTuple_New(end - begin);
 	for (count = begin; count < end; count++) {
 		PyTuple_SET_ITEM(tuple, count - begin,
-				Vector_CreatePyObject_cb((PyObject *)self, self->num_col, mathutils_matrix_row_cb_index, count));
-
+		                 Vector_CreatePyObject_cb((PyObject *)self, self->num_col, mathutils_matrix_row_cb_index, count));
 	}
 
 	return tuple;
 }
 /*----------------------------object[z:y]------------------------
-  sequence slice (set)*/
+ * sequence slice (set)*/
 static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *value)
 {
 	PyObject *value_fast = NULL;
@@ -1807,7 +1812,7 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va
 	}
 }
 /*------------------------NUMERIC PROTOCOLS----------------------
-  ------------------------obj + obj------------------------------*/
+ *------------------------obj + obj------------------------------*/
 static PyObject *Matrix_add(PyObject *m1, PyObject *m2)
 {
 	float mat[16];
@@ -1839,7 +1844,7 @@ static PyObject *Matrix_add(PyObject *m1, PyObject *m2)
 	return Matrix_CreatePyObject(mat, mat1->num_col, mat1->num_row, Py_NEW, Py_TYPE(mat1));
 }
 /*------------------------obj - obj------------------------------
-  subtraction*/
+ * subtraction */
 static PyObject *Matrix_sub(PyObject *m1, PyObject *m2)
 {
 	float mat[16];
@@ -1852,8 +1857,7 @@ static PyObject *Matrix_sub(PyObject *m1, PyObject *m2)
 		PyErr_Format(PyExc_TypeError,
 		             "Matrix subtraction: (%s - %s) "
 		             "invalid type for this operation",
-		             Py_TYPE(m1)->tp_name, Py_TYPE(m2)->tp_name
-		             );
+		             Py_TYPE(m1)->tp_name, Py_TYPE(m2)->tp_name);
 		return NULL;
 	}
 
@@ -1872,7 +1876,7 @@ static PyObject *Matrix_sub(PyObject *m1, PyObject *m2)
 	return Matrix_CreatePyObject(mat, mat1->num_col, mat1->num_row, Py_NEW, Py_TYPE(mat1));
 }
 /*------------------------obj * obj------------------------------
-  mulplication*/
+ * mulplication */
 static PyObject *matrix_mul_float(MatrixObject *mat, const float scalar)
 {
 	float tmat[16];
@@ -1909,8 +1913,8 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
 
 		if (mat1->num_col != mat2->num_row) {
 			PyErr_SetString(PyExc_ValueError,
-							"matrix1 * matrix2: matrix1 number of columns "
-							"and the matrix2 number of rows must be the same");
+			                "matrix1 * matrix2: matrix1 number of columns "
+			                "and the matrix2 number of rows must be the same");
 			return NULL;
 		}
 
@@ -1970,16 +1974,16 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2)
 
 /*-----------------PROTOCOL DECLARATIONS--------------------------*/
 static PySequenceMethods Matrix_SeqMethods = {
-	(lenfunc) Matrix_len,						/* sq_length */
-	(binaryfunc) NULL,							/* sq_concat */
-	(ssizeargfunc) NULL,						/* sq_repeat */
-	(ssizeargfunc) Matrix_item_row,				/* sq_item */
-	(ssizessizeargfunc) NULL,					/* sq_slice, deprecated */
-	(ssizeobjargproc) Matrix_ass_item_row,		/* sq_ass_item */
-	(ssizessizeobjargproc) NULL,				/* sq_ass_slice, deprecated */
-	(objobjproc) NULL,							/* sq_contains */
-	(binaryfunc) NULL,							/* sq_inplace_concat */
-	(ssizeargfunc) NULL,						/* sq_inplace_repeat */
+	(lenfunc) Matrix_len,                       /* sq_length */
+	(binaryfunc) NULL,                          /* sq_concat */
+	(ssizeargfunc) NULL,                        /* sq_repeat */
+	(ssizeargfunc) Matrix_item_row,             /* sq_item */
+	(ssizessizeargfunc) NULL,                   /* sq_slice, deprecated */
+	(ssizeobjargproc) Matrix_ass_item_row,      /* sq_ass_item */
+	(ssizessizeobjargproc) NULL,                /* sq_ass_slice, deprecated */
+	(objobjproc) NULL,                          /* sq_contains */
+	(binaryfunc) NULL,                          /* sq_inplace_concat */
+	(ssizeargfunc) NULL,                        /* sq_inplace_repeat */
 };
 
 
@@ -2060,40 +2064,40 @@ static PyMappingMethods Matrix_AsMapping = {
 
 
 static PyNumberMethods Matrix_NumMethods = {
-		(binaryfunc)	Matrix_add,	/*nb_add*/
-		(binaryfunc)	Matrix_sub,	/*nb_subtract*/
-		(binaryfunc)	Matrix_mul,	/*nb_multiply*/
-		NULL,							/*nb_remainder*/
-		NULL,							/*nb_divmod*/
-		NULL,							/*nb_power*/
-		(unaryfunc) 	0,	/*nb_negative*/
-		(unaryfunc) 	0,	/*tp_positive*/
-		(unaryfunc) 	0,	/*tp_absolute*/
-		(inquiry)	0,	/*tp_bool*/
-		(unaryfunc)	Matrix_inverted,	/*nb_invert*/
-		NULL,				/*nb_lshift*/
-		(binaryfunc)0,	/*nb_rshift*/
-		NULL,				/*nb_and*/
-		NULL,				/*nb_xor*/
-		NULL,				/*nb_or*/
-		NULL,				/*nb_int*/
-		NULL,				/*nb_reserved*/
-		NULL,				/*nb_float*/
-		NULL,				/* nb_inplace_add */
-		NULL,				/* nb_inplace_subtract */
-		NULL,				/* nb_inplace_multiply */
-		NULL,				/* nb_inplace_remainder */
-		NULL,				/* nb_inplace_power */
-		NULL,				/* nb_inplace_lshift */
-		NULL,				/* nb_inplace_rshift */
-		NULL,				/* nb_inplace_and */
-		NULL,				/* nb_inplace_xor */
-		NULL,				/* nb_inplace_or */
-		NULL,				/* nb_floor_divide */
-		NULL,				/* nb_true_divide */
-		NULL,				/* nb_inplace_floor_divide */
-		NULL,				/* nb_inplace_true_divide */
-		NULL,				/* nb_index */
+	(binaryfunc)    Matrix_add,     /*nb_add*/
+	(binaryfunc)    Matrix_sub,     /*nb_subtract*/
+	(binaryfunc)    Matrix_mul,     /*nb_multiply*/
+	NULL,                               /*nb_remainder*/
+	NULL,                               /*nb_divmod*/
+	NULL,                               /*nb_power*/
+	(unaryfunc)     0,      /*nb_negative*/
+	(unaryfunc)     0,      /*tp_positive*/
+	(unaryfunc)     0,      /*tp_absolute*/
+	(inquiry)   0,      /*tp_bool*/
+	(unaryfunc) Matrix_inverted,        /*nb_invert*/
+	NULL,                   /*nb_lshift*/
+	(binaryfunc)0,      /*nb_rshift*/
+	NULL,                   /*nb_and*/
+	NULL,                   /*nb_xor*/
+	NULL,                   /*nb_or*/
+	NULL,                   /*nb_int*/
+	NULL,                   /*nb_reserved*/
+	NULL,                   /*nb_float*/
+	NULL,                   /* nb_inplace_add */
+	NULL,                   /* nb_inplace_subtract */
+	NULL,                   /* nb_inplace_multiply */
+	NULL,                   /* nb_inplace_remainder */
+	NULL,                   /* nb_inplace_power */
+	NULL,                   /* nb_inplace_lshift */
+	NULL,                   /* nb_inplace_rshift */
+	NULL,                   /* nb_inplace_and */
+	NULL,                   /* nb_inplace_xor */
+	NULL,                   /* nb_inplace_or */
+	NULL,                   /* nb_floor_divide */
+	NULL,                   /* nb_true_divide */
+	NULL,                   /* nb_inplace_floor_divide */
+	NULL,                   /* nb_inplace_true_divide */
+	NULL,                   /* nb_index */
 };
 
 PyDoc_STRVAR(Matrix_translation_doc,
@@ -2146,7 +2150,7 @@ static int Matrix_translation_set(MatrixObject *self, PyObject *value, void *UNU
 }
 
 PyDoc_STRVAR(Matrix_row_doc,
-"Access the matix by rows (default), (readonly).\n\n:type: Matrix Access"
+"Access the matix by rows (default), (read-only).\n\n:type: Matrix Access"
 );
 static PyObject *Matrix_row_get(MatrixObject *self, void *UNUSED(closure))
 {
@@ -2154,7 +2158,7 @@ static PyObject *Matrix_row_get(MatrixObject *self, void *UNUSED(closure))
 }
 
 PyDoc_STRVAR(Matrix_col_doc,
-"Access the matix by colums, 3x3 and 4x4 only, (readonly).\n\n:type: Matrix Access"
+"Access the matix by colums, 3x3 and 4x4 only, (read-only).\n\n:type: Matrix Access"
 );
 static PyObject *Matrix_col_get(MatrixObject *self, void *UNUSED(closure))
 {
@@ -2162,7 +2166,7 @@ static PyObject *Matrix_col_get(MatrixObject *self, void *UNUSED(closure))
 }
 
 PyDoc_STRVAR(Matrix_median_scale_doc,
-"The average scale applied to each axis (readonly).\n\n:type: float"
+"The average scale applied to each axis (read-only).\n\n:type: float"
 );
 static PyObject *Matrix_median_scale_get(MatrixObject *self, void *UNUSED(closure))
 {
@@ -2185,7 +2189,7 @@ static PyObject *Matrix_median_scale_get(MatrixObject *self, void *UNUSED(closur
 }
 
 PyDoc_STRVAR(Matrix_is_negative_doc,
-"True if this matrix results in a negative scale, 3x3 and 4x4 only, (readonly).\n\n:type: bool"
+"True if this matrix results in a negative scale, 3x3 and 4x4 only, (read-only).\n\n:type: bool"
 );
 static PyObject *Matrix_is_negative_get(MatrixObject *self, void *UNUSED(closure))
 {
@@ -2206,7 +2210,7 @@ static PyObject *Matrix_is_negative_get(MatrixObject *self, void *UNUSED(closure
 }
 
 PyDoc_STRVAR(Matrix_is_orthogonal_doc,
-"True if this matrix is orthogonal, 3x3 and 4x4 only, (readonly).\n\n:type: bool"
+"True if this matrix is orthogonal, 3x3 and 4x4 only, (read-only).\n\n:type: bool"
 );
 static PyObject *Matrix_is_orthogonal_get(MatrixObject *self, void *UNUSED(closure))
 {
@@ -2215,12 +2219,33 @@ static PyObject *Matrix_is_orthogonal_get(MatrixObject *self, void *UNUSED(closu
 
 	/*must be 3-4 cols, 3-4 rows, square matrix*/
 	if (self->num_row == 4 && self->num_col == 4)
+		return PyBool_FromLong(is_orthonormal_m4((float (*)[4])self->matrix));
+	else if (self->num_row == 3 && self->num_col == 3)
+		return PyBool_FromLong(is_orthonormal_m3((float (*)[3])self->matrix));
+	else {
+		PyErr_SetString(PyExc_AttributeError,
+		                "Matrix.is_orthogonal: "
+		                "inappropriate matrix size - expects 3x3 or 4x4 matrix");
+		return NULL;
+	}
+}
+
+PyDoc_STRVAR(Matrix_is_orthogonal_axis_vectors_doc,
+"True if this matrix has got orthogonal axis vectors, 3x3 and 4x4 only, (read-only).\n\n:type: bool"
+);
+static PyObject *Matrix_is_orthogonal_axis_vectors_get(MatrixObject *self, void *UNUSED(closure))
+{
+	if (BaseMath_ReadCallback(self) == -1)
+		return NULL;
+
+	/*must be 3-4 cols, 3-4 rows, square matrix*/
+	if (self->num_row == 4 && self->num_col == 4)
 		return PyBool_FromLong(is_orthogonal_m4((float (*)[4])self->matrix));
 	else if (self->num_row == 3 && self->num_col == 3)
 		return PyBool_FromLong(is_orthogonal_m3((float (*)[3])self->matrix));
 	else {
 		PyErr_SetString(PyExc_AttributeError,
-		                "Matrix.is_orthogonal: "
+		                "Matrix.is_orthogonal_axis_vectors: "
 		                "inappropriate matrix size - expects 3x3 or 4x4 matrix");
 		return NULL;
 	}
@@ -2236,8 +2261,9 @@ static PyGetSetDef Matrix_getseters[] = {
 	{(char *)"col", (getter)Matrix_col_get, (setter)NULL, Matrix_col_doc, NULL},
 	{(char *)"is_negative", (getter)Matrix_is_negative_get, (setter)NULL, Matrix_is_negative_doc, NULL},
 	{(char *)"is_orthogonal", (getter)Matrix_is_orthogonal_get, (setter)NULL, Matrix_is_orthogonal_doc, NULL},
+	{(char *)"is_orthogonal_axis_vectors", (getter)Matrix_is_orthogonal_axis_vectors_get, (setter)NULL, Matrix_is_orthogonal_axis_vectors_doc, NULL},
 	{(char *)"is_wrapped", (getter)BaseMathObject_is_wrapped_get, (setter)NULL, BaseMathObject_is_wrapped_doc, NULL},
-	{(char *)"owner",(getter)BaseMathObject_owner_get, (setter)NULL, BaseMathObject_owner_doc, NULL},
+	{(char *)"owner", (getter)BaseMathObject_owner_get, (setter)NULL, BaseMathObject_owner_doc, NULL},
 	{NULL, NULL, NULL, NULL, NULL}  /* Sentinel */
 };
 
@@ -2272,6 +2298,7 @@ static struct PyMethodDef Matrix_methods[] = {
 	{"lerp", (PyCFunction) Matrix_lerp, METH_VARARGS, Matrix_lerp_doc},
 	{"copy", (PyCFunction) Matrix_copy, METH_NOARGS, Matrix_copy_doc},
 	{"__copy__", (PyCFunction) Matrix_copy, METH_NOARGS, Matrix_copy_doc},
+	{"__deepcopy__", (PyCFunction) Matrix_deepcopy, METH_VARARGS, Matrix_copy_doc},
 
 	/* class methods */
 	{"Identity", (PyCFunction) C_Matrix_Identity, METH_VARARGS | METH_CLASS, C_Matrix_Identity_doc},
@@ -2289,51 +2316,51 @@ PyDoc_STRVAR(matrix_doc,
 );
 PyTypeObject matrix_Type = {
 	PyVarObject_HEAD_INIT(NULL, 0)
-	"mathutils.Matrix",					/*tp_name*/
-	sizeof(MatrixObject),				/*tp_basicsize*/
-	0,									/*tp_itemsize*/
-	(destructor)BaseMathObject_dealloc,	/*tp_dealloc*/
-	NULL,								/*tp_print*/
-	NULL,								/*tp_getattr*/
-	NULL,								/*tp_setattr*/
-	NULL,								/*tp_compare*/
-	(reprfunc) Matrix_repr,				/*tp_repr*/
-	&Matrix_NumMethods,					/*tp_as_number*/
-	&Matrix_SeqMethods,					/*tp_as_sequence*/
-	&Matrix_AsMapping,					/*tp_as_mapping*/
-	NULL,								/*tp_hash*/
-	NULL,								/*tp_call*/
-	(reprfunc) Matrix_str,				/*tp_str*/
-	NULL,								/*tp_getattro*/
-	NULL,								/*tp_setattro*/
-	NULL,								/*tp_as_buffer*/
+	"Matrix",                           /*tp_name*/
+	sizeof(MatrixObject),               /*tp_basicsize*/
+	0,                                  /*tp_itemsize*/
+	(destructor)BaseMathObject_dealloc, /*tp_dealloc*/
+	NULL,                               /*tp_print*/
+	NULL,                               /*tp_getattr*/
+	NULL,                               /*tp_setattr*/
+	NULL,                               /*tp_compare*/
+	(reprfunc) Matrix_repr,             /*tp_repr*/
+	&Matrix_NumMethods,                 /*tp_as_number*/
+	&Matrix_SeqMethods,                 /*tp_as_sequence*/
+	&Matrix_AsMapping,                  /*tp_as_mapping*/
+	NULL,                               /*tp_hash*/
+	NULL,                               /*tp_call*/
+	(reprfunc) Matrix_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*/
-	matrix_doc,							/*tp_doc*/
-	(traverseproc)BaseMathObject_traverse,	//tp_traverse
-	(inquiry)BaseMathObject_clear,	//tp_clear
-	(richcmpfunc)Matrix_richcmpr,		/*tp_richcompare*/
-	0,									/*tp_weaklistoffset*/
-	NULL,								/*tp_iter*/
-	NULL,								/*tp_iternext*/
-	Matrix_methods,						/*tp_methods*/
-	NULL,								/*tp_members*/
-	Matrix_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*/
-	Matrix_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*/
+	matrix_doc,                         /*tp_doc*/
+	(traverseproc)BaseMathObject_traverse,  //tp_traverse
+	(inquiry)BaseMathObject_clear,  //tp_clear
+	(richcmpfunc)Matrix_richcmpr,       /*tp_richcompare*/
+	0,                                  /*tp_weaklistoffset*/
+	NULL,                               /*tp_iter*/
+	NULL,                               /*tp_iternext*/
+	Matrix_methods,                     /*tp_methods*/
+	NULL,                               /*tp_members*/
+	Matrix_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*/
+	Matrix_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*/
 };
 
 /* pass Py_WRAP - if vector is a WRAPPER for data allocated by BLENDER
@@ -2378,7 +2405,7 @@ PyObject *Matrix_CreatePyObject(float *mat,
 				return NULL;
 			}
 
-			if (mat) {	/*if a float array passed*/
+			if (mat) {  /*if a float array passed*/
 				memcpy(self->matrix, mat, num_col * num_row * sizeof(float));
 			}
 			else if (num_col == num_row) {
@@ -2402,14 +2429,14 @@ PyObject *Matrix_CreatePyObject(float *mat,
 
 PyObject *Matrix_CreatePyObject_cb(PyObject *cb_user,
                                    const unsigned short num_col, const unsigned short num_row,
-                                   int cb_type, int cb_subtype)
+                                   unsigned char cb_type, unsigned char cb_subtype)
 {
 	MatrixObject *self = (MatrixObject *)Matrix_CreatePyObject(NULL, num_col, num_row, Py_NEW, NULL);
 	if (self) {
 		Py_INCREF(cb_user);
-		self->cb_user =			cb_user;
-		self->cb_type =			(unsigned char)cb_type;
-		self->cb_subtype =		(unsigned char)cb_subtype;
+		self->cb_user         = cb_user;
+		self->cb_type         = cb_type;
+		self->cb_subtype      = cb_subtype;
 		PyObject_GC_Track(self);
 	}
 	return (PyObject *) self;
@@ -2452,8 +2479,8 @@ static void MatrixAccess_dealloc(MatrixAccessObject *self)
 static int MatrixAccess_len(MatrixAccessObject *self)
 {
 	return (self->type == MAT_ACCESS_ROW) ?
-	            self->matrix_user->num_row :
-	            self->matrix_user->num_col;
+	       self->matrix_user->num_row :
+	       self->matrix_user->num_col;
 }
 
 static PyObject *MatrixAccess_slice(MatrixAccessObject *self, int begin, int end)
@@ -2589,30 +2616,30 @@ static PyMappingMethods MatrixAccess_AsMapping = {
 
 PyTypeObject matrix_access_Type = {
 	PyVarObject_HEAD_INIT(NULL, 0)
-	"MatrixAccess",						/*tp_name*/
-	sizeof(MatrixAccessObject),			/*tp_basicsize*/
-	0,									/*tp_itemsize*/
-	(destructor)MatrixAccess_dealloc,	/*tp_dealloc*/
-	NULL,								/*tp_print*/
-	NULL,								/*tp_getattr*/
-	NULL,								/*tp_setattr*/
-	NULL,								/*tp_compare*/
-	NULL,								/*tp_repr*/
-	NULL,								/*tp_as_number*/
-	NULL /*&MatrixAccess_SeqMethods*/ /* TODO */,			/*tp_as_sequence*/
-	&MatrixAccess_AsMapping,			/*tp_as_mapping*/
-	NULL,								/*tp_hash*/
-	NULL,								/*tp_call*/
-	NULL,								/*tp_str*/
-	NULL,								/*tp_getattro*/
-	NULL,								/*tp_setattro*/
-	NULL,								/*tp_as_buffer*/
+	"MatrixAccess",                     /*tp_name*/
+	sizeof(MatrixAccessObject),         /*tp_basicsize*/
+	0,                                  /*tp_itemsize*/
+	(destructor)MatrixAccess_dealloc,   /*tp_dealloc*/
+	NULL,                               /*tp_print*/
+	NULL,                               /*tp_getattr*/
+	NULL,                               /*tp_setattr*/
+	NULL,                               /*tp_compare*/
+	NULL,                               /*tp_repr*/
+	NULL,                               /*tp_as_number*/
+	NULL /*&MatrixAccess_SeqMethods*/ /* TODO */,           /*tp_as_sequence*/
+	&MatrixAccess_AsMapping,            /*tp_as_mapping*/
+	NULL,                               /*tp_hash*/
+	NULL,                               /*tp_call*/
+	NULL,                               /*tp_str*/
+	NULL,                               /*tp_getattro*/
+	NULL,                               /*tp_setattro*/
+	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
+	NULL,                               /*tp_doc*/
+	(traverseproc)MatrixAccess_traverse,    //tp_traverse
+	(inquiry)MatrixAccess_clear,    //tp_clear
 	NULL /* (richcmpfunc)MatrixAccess_richcmpr */ /* TODO*/, /*tp_richcompare*/
-	0,									/*tp_weaklistoffset*/
+	0,                                  /*tp_weaklistoffset*/
 	(getiterfunc)MatrixAccess_iter, /* getiterfunc tp_iter; */
 };
 
diff --git a/source/blender/python/mathutils/mathutils_Matrix.h b/source/blender/python/mathutils/mathutils_Matrix.h
index 2ecbc55..fe9bf2c 100644
--- a/source/blender/python/mathutils/mathutils_Matrix.h
+++ b/source/blender/python/mathutils/mathutils_Matrix.h
@@ -31,8 +31,8 @@
  */
 
 
-#ifndef MATHUTILS_MATRIX_H
-#define MATHUTILS_MATRIX_H
+#ifndef __MATHUTILS_MATRIX_H__
+#define __MATHUTILS_MATRIX_H__
 
 extern PyTypeObject matrix_Type;
 extern PyTypeObject matrix_access_Type;
@@ -71,11 +71,11 @@ PyObject *Matrix_CreatePyObject(float *mat,
                                 int type, PyTypeObject *base_type);
 PyObject *Matrix_CreatePyObject_cb(PyObject *user,
                                    const unsigned short num_col, const unsigned short num_row,
-                                   int cb_type, int cb_subtype);
+                                   unsigned char cb_type, unsigned char cb_subtype);
 
-extern int mathutils_matrix_row_cb_index; /* default */
-extern int mathutils_matrix_col_cb_index;
-extern int mathutils_matrix_translation_cb_index;
+extern unsigned char mathutils_matrix_row_cb_index; /* default */
+extern unsigned char mathutils_matrix_col_cb_index;
+extern unsigned char mathutils_matrix_translation_cb_index;
 
 extern struct Mathutils_Callback mathutils_matrix_row_cb; /* default */
 extern struct Mathutils_Callback mathutils_matrix_col_cb;
@@ -83,4 +83,4 @@ extern struct Mathutils_Callback mathutils_matrix_translation_cb;
 
 void matrix_as_3x3(float mat[3][3], MatrixObject *self);
 
-#endif /* MATHUTILS_MATRIX_H */
+#endif /* __MATHUTILS_MATRIX_H__ */
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c
index 20e9518..d1da466 100644
--- a/source/blender/python/mathutils/mathutils_Quaternion.c
+++ b/source/blender/python/mathutils/mathutils_Quaternion.c
@@ -42,6 +42,7 @@
 static PyObject *quat__apply_to_copy(PyNoArgsFunction quat_func, QuaternionObject *self);
 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------------------------------
 
@@ -113,12 +114,12 @@ static PyObject *Quaternion_to_euler(QuaternionObject *self, PyObject *args)
 
 		quat_to_mat3(mat, tquat);
 
-		if (order == EULER_ORDER_XYZ)	mat3_to_compatible_eul(eul, eul_compat->eul, mat);
-		else							mat3_to_compatible_eulO(eul, eul_compat->eul, order, mat);
+		if (order == EULER_ORDER_XYZ)  mat3_to_compatible_eul(eul, eul_compat->eul, mat);
+		else                           mat3_to_compatible_eulO(eul, eul_compat->eul, order, mat);
 	}
 	else {
-		if (order == EULER_ORDER_XYZ)	quat_to_eul(eul, tquat);
-		else							quat_to_eulO(eul, order, tquat);
+		if (order == EULER_ORDER_XYZ)  quat_to_eul(eul, tquat);
+		else                           quat_to_eulO(eul, order, tquat);
 	}
 
 	return Euler_CreatePyObject(eul, order, Py_NEW, NULL);
@@ -478,6 +479,12 @@ static PyObject *Quaternion_copy(QuaternionObject *self)
 
 	return Quaternion_CreatePyObject(self->quat, Py_NEW, Py_TYPE(self));
 }
+static PyObject *Quaternion_deepcopy(QuaternionObject *self, PyObject *args)
+{
+	if (!mathutils_deepcopy_args_check(args))
+		return NULL;
+	return Quaternion_copy(self);
+}
 
 //----------------------------print object (internal)--------------
 //print the object to screen
@@ -527,21 +534,21 @@ static PyObject *Quaternion_richcmpr(PyObject *a, PyObject *b, int op)
 	}
 
 	switch (op) {
-	case Py_NE:
-		ok = !ok; /* pass through */
-	case Py_EQ:
-		res = ok ? Py_False : Py_True;
-		break;
-
-	case Py_LT:
-	case Py_LE:
-	case Py_GT:
-	case Py_GE:
-		res = Py_NotImplemented;
-		break;
-	default:
-		PyErr_BadArgument();
-		return NULL;
+		case Py_NE:
+			ok = !ok; /* pass through */
+		case Py_EQ:
+			res = ok ? Py_False : Py_True;
+			break;
+
+		case Py_LT:
+		case Py_LE:
+		case Py_GT:
+		case Py_GE:
+			res = Py_NotImplemented;
+			break;
+		default:
+			PyErr_BadArgument();
+			return NULL;
 	}
 
 	return Py_INCREF(res), res;
@@ -558,7 +565,7 @@ static int Quaternion_len(QuaternionObject *UNUSED(self))
 //sequence accessor (get)
 static PyObject *Quaternion_item(QuaternionObject *self, int i)
 {
-	if (i < 0)	i = QUAT_SIZE-i;
+	if (i < 0) i = QUAT_SIZE - i;
 
 	if (i < 0 || i >= QUAT_SIZE) {
 		PyErr_SetString(PyExc_IndexError,
@@ -585,7 +592,7 @@ static int Quaternion_ass_item(QuaternionObject *self, int i, PyObject *ob)
 		return -1;
 	}
 
-	if (i < 0)	i = QUAT_SIZE-i;
+	if (i < 0) i = QUAT_SIZE - i;
 
 	if (i < 0 || i >= QUAT_SIZE) {
 		PyErr_SetString(PyExc_IndexError,
@@ -741,8 +748,8 @@ static PyObject *Quaternion_add(PyObject *q1, PyObject *q2)
 		             Py_TYPE(q1)->tp_name, Py_TYPE(q2)->tp_name);
 		return NULL;
 	}
-	quat1 = (QuaternionObject*)q1;
-	quat2 = (QuaternionObject*)q2;
+	quat1 = (QuaternionObject *)q1;
+	quat2 = (QuaternionObject *)q2;
 
 	if (BaseMath_ReadCallback(quat1) == -1 || BaseMath_ReadCallback(quat2) == -1)
 		return NULL;
@@ -766,8 +773,8 @@ static PyObject *Quaternion_sub(PyObject *q1, PyObject *q2)
 		return NULL;
 	}
 
-	quat1 = (QuaternionObject*)q1;
-	quat2 = (QuaternionObject*)q2;
+	quat1 = (QuaternionObject *)q1;
+	quat2 = (QuaternionObject *)q2;
 
 	if (BaseMath_ReadCallback(quat1) == -1 || BaseMath_ReadCallback(quat2) == -1)
 		return NULL;
@@ -795,22 +802,22 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2)
 	QuaternionObject *quat1 = NULL, *quat2 = NULL;
 
 	if (QuaternionObject_Check(q1)) {
-		quat1 = (QuaternionObject*)q1;
+		quat1 = (QuaternionObject *)q1;
 		if (BaseMath_ReadCallback(quat1) == -1)
 			return NULL;
 	}
 	if (QuaternionObject_Check(q2)) {
-		quat2 = (QuaternionObject*)q2;
+		quat2 = (QuaternionObject *)q2;
 		if (BaseMath_ReadCallback(quat2) == -1)
 			return NULL;
 	}
 
-	if (quat1 && quat2) { /* QUAT*QUAT (cross product) */
+	if (quat1 && quat2) { /* QUAT * QUAT (cross product) */
 		mul_qt_qtqt(quat, quat1->quat, quat2->quat);
 		return Quaternion_CreatePyObject(quat, Py_NEW, Py_TYPE(q1));
 	}
-	/* the only case this can happen (for a supported type is "FLOAT*QUAT") */
-	else if (quat2) { /* FLOAT*QUAT */
+	/* the only case this can happen (for a supported type is "FLOAT * QUAT") */
+	else if (quat2) { /* FLOAT * QUAT */
 		if (((scalar = PyFloat_AsDouble(q1)) == -1.0f && PyErr_Occurred()) == 0) {
 			return quat_mul_float(quat2, scalar);
 		}
@@ -823,8 +830,8 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2)
 
 			if (vec2->size != 3) {
 				PyErr_SetString(PyExc_ValueError,
-								"Vector multiplication: "
-								"only 3D vector rotations (with quats) "
+				                "Vector multiplication: "
+				                "only 3D vector rotations (with quats) "
 				                "currently supported");
 				return NULL;
 			}
@@ -854,7 +861,7 @@ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2)
 }
 
 /* -obj
-  returns the negative of this object*/
+ * returns the negative of this object*/
 static PyObject *Quaternion_neg(QuaternionObject *self)
 {
 	float tquat[QUAT_SIZE];
@@ -869,16 +876,16 @@ static PyObject *Quaternion_neg(QuaternionObject *self)
 
 //-----------------PROTOCOL DECLARATIONS--------------------------
 static PySequenceMethods Quaternion_SeqMethods = {
-	(lenfunc) Quaternion_len,				/* sq_length */
-	(binaryfunc) NULL,						/* sq_concat */
-	(ssizeargfunc) NULL,					/* sq_repeat */
-	(ssizeargfunc) Quaternion_item,			/* sq_item */
-	(ssizessizeargfunc) NULL,				/* sq_slice, deprecated */
-	(ssizeobjargproc) Quaternion_ass_item,	/* sq_ass_item */
-	(ssizessizeobjargproc) NULL,			/* sq_ass_slice, deprecated */
-	(objobjproc) NULL,						/* sq_contains */
-	(binaryfunc) NULL,						/* sq_inplace_concat */
-	(ssizeargfunc) NULL,					/* sq_inplace_repeat */
+	(lenfunc) Quaternion_len,               /* sq_length */
+	(binaryfunc) NULL,                      /* sq_concat */
+	(ssizeargfunc) NULL,                    /* sq_repeat */
+	(ssizeargfunc) Quaternion_item,         /* sq_item */
+	(ssizessizeargfunc) NULL,               /* sq_slice, deprecated */
+	(ssizeobjargproc) Quaternion_ass_item,  /* sq_ass_item */
+	(ssizessizeobjargproc) NULL,            /* sq_ass_slice, deprecated */
+	(objobjproc) NULL,                      /* sq_contains */
+	(binaryfunc) NULL,                      /* sq_inplace_concat */
+	(ssizeargfunc) NULL,                    /* sq_inplace_repeat */
 };
 
 static PyMappingMethods Quaternion_AsMapping = {
@@ -888,40 +895,40 @@ static PyMappingMethods Quaternion_AsMapping = {
 };
 
 static PyNumberMethods Quaternion_NumMethods = {
-	(binaryfunc)	Quaternion_add,	/*nb_add*/
-	(binaryfunc)	Quaternion_sub,	/*nb_subtract*/
-	(binaryfunc)	Quaternion_mul,	/*nb_multiply*/
-	NULL,							/*nb_remainder*/
-	NULL,							/*nb_divmod*/
-	NULL,							/*nb_power*/
-	(unaryfunc) 	Quaternion_neg,	/*nb_negative*/
-	(unaryfunc) 	0,	/*tp_positive*/
-	(unaryfunc) 	0,	/*tp_absolute*/
-	(inquiry)	0,	/*tp_bool*/
-	(unaryfunc)	0,	/*nb_invert*/
-	NULL,				/*nb_lshift*/
-	(binaryfunc)0,	/*nb_rshift*/
-	NULL,				/*nb_and*/
-	NULL,				/*nb_xor*/
-	NULL,				/*nb_or*/
-	NULL,				/*nb_int*/
-	NULL,				/*nb_reserved*/
-	NULL,				/*nb_float*/
-	NULL,				/* nb_inplace_add */
-	NULL,				/* nb_inplace_subtract */
-	NULL,				/* nb_inplace_multiply */
-	NULL,				/* nb_inplace_remainder */
-	NULL,				/* nb_inplace_power */
-	NULL,				/* nb_inplace_lshift */
-	NULL,				/* nb_inplace_rshift */
-	NULL,				/* nb_inplace_and */
-	NULL,				/* nb_inplace_xor */
-	NULL,				/* nb_inplace_or */
-	NULL,				/* nb_floor_divide */
-	NULL,				/* nb_true_divide */
-	NULL,				/* nb_inplace_floor_divide */
-	NULL,				/* nb_inplace_true_divide */
-	NULL,				/* nb_index */
+	(binaryfunc)    Quaternion_add, /*nb_add*/
+	(binaryfunc)    Quaternion_sub, /*nb_subtract*/
+	(binaryfunc)    Quaternion_mul, /*nb_multiply*/
+	NULL,                           /*nb_remainder*/
+	NULL,                           /*nb_divmod*/
+	NULL,                           /*nb_power*/
+	(unaryfunc)     Quaternion_neg, /*nb_negative*/
+	(unaryfunc)     0,  /*tp_positive*/
+	(unaryfunc)     0,  /*tp_absolute*/
+	(inquiry)   0,      /*tp_bool*/
+	(unaryfunc) 0,      /*nb_invert*/
+	NULL,               /*nb_lshift*/
+	(binaryfunc)0,      /*nb_rshift*/
+	NULL,               /*nb_and*/
+	NULL,               /*nb_xor*/
+	NULL,               /*nb_or*/
+	NULL,               /*nb_int*/
+	NULL,               /*nb_reserved*/
+	NULL,               /*nb_float*/
+	NULL,               /* nb_inplace_add */
+	NULL,               /* nb_inplace_subtract */
+	NULL,               /* nb_inplace_multiply */
+	NULL,               /* nb_inplace_remainder */
+	NULL,               /* nb_inplace_power */
+	NULL,               /* nb_inplace_lshift */
+	NULL,               /* nb_inplace_rshift */
+	NULL,               /* nb_inplace_and */
+	NULL,               /* nb_inplace_xor */
+	NULL,               /* nb_inplace_or */
+	NULL,               /* nb_floor_divide */
+	NULL,               /* nb_true_divide */
+	NULL,               /* nb_inplace_floor_divide */
+	NULL,               /* nb_inplace_true_divide */
+	NULL,               /* nb_index */
 };
 
 PyDoc_STRVAR(Quaternion_axis_doc,
@@ -938,7 +945,7 @@ static int Quaternion_axis_set(QuaternionObject *self, PyObject *value, void *ty
 }
 
 PyDoc_STRVAR(Quaternion_magnitude_doc,
-"Size of the quaternion (readonly).\n\n:type: float"
+"Size of the quaternion (read-only).\n\n:type: float"
 );
 static PyObject *Quaternion_magnitude_get(QuaternionObject *self, void *UNUSED(closure))
 {
@@ -1070,19 +1077,19 @@ static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kw
 		return NULL;
 
 	switch (PyTuple_GET_SIZE(args)) {
-	case 0:
-		break;
-	case 1:
-		if (mathutils_array_parse(quat, QUAT_SIZE, QUAT_SIZE, seq, "mathutils.Quaternion()") == -1)
-			return NULL;
-		break;
-	case 2:
-		if (mathutils_array_parse(quat, 3, 3, seq, "mathutils.Quaternion()") == -1)
-			return NULL;
-		angle = angle_wrap_rad(angle); /* clamp because of precision issues */
-		axis_angle_to_quat(quat, quat, angle);
-		break;
-	/* PyArg_ParseTuple assures no more then 2 */
+		case 0:
+			break;
+		case 1:
+			if (mathutils_array_parse(quat, QUAT_SIZE, QUAT_SIZE, seq, "mathutils.Quaternion()") == -1)
+				return NULL;
+			break;
+		case 2:
+			if (mathutils_array_parse(quat, 3, 3, seq, "mathutils.Quaternion()") == -1)
+				return NULL;
+			angle = angle_wrap_rad(angle); /* clamp because of precision issues */
+			axis_angle_to_quat(quat, quat, angle);
+			break;
+			/* PyArg_ParseTuple assures no more then 2 */
 	}
 	return Quaternion_CreatePyObject(quat, Py_NEW, type);
 }
@@ -1101,21 +1108,22 @@ static PyObject *quat__apply_to_copy(PyNoArgsFunction quat_func, QuaternionObjec
 	}
 }
 
-/* axis vector suffers from precission errors, use this function to ensure */
+/* axis vector suffers from precision errors, use this function to ensure */
 static void quat__axis_angle_sanitize(float axis[3], float *angle)
 {
 	if (axis) {
-		if ( !finite(axis[0]) ||
-		     !finite(axis[1]) ||
-		     !finite(axis[2]))
+		if (is_zero_v3(axis) ||
+		    !finite(axis[0]) ||
+		    !finite(axis[1]) ||
+		    !finite(axis[2]))
 		{
 			axis[0] = 1.0f;
 			axis[1] = 0.0f;
 			axis[2] = 0.0f;
 		}
-		else if ( EXPP_FloatsAreEqual(axis[0], 0.0f, 10) &&
-		          EXPP_FloatsAreEqual(axis[1], 0.0f, 10) &&
-		          EXPP_FloatsAreEqual(axis[2], 0.0f, 10))
+		else if (EXPP_FloatsAreEqual(axis[0], 0.0f, 10) &&
+		         EXPP_FloatsAreEqual(axis[1], 0.0f, 10) &&
+		         EXPP_FloatsAreEqual(axis[2], 0.0f, 10))
 		{
 			axis[0] = 1.0f;
 		}
@@ -1156,8 +1164,9 @@ static struct PyMethodDef Quaternion_methods[] = {
 	{"slerp", (PyCFunction) Quaternion_slerp, METH_VARARGS, Quaternion_slerp_doc},
 	{"rotate", (PyCFunction) Quaternion_rotate, METH_O, Quaternion_rotate_doc},
 
-	{"__copy__", (PyCFunction) Quaternion_copy, METH_NOARGS, Quaternion_copy_doc},
 	{"copy", (PyCFunction) Quaternion_copy, METH_NOARGS, Quaternion_copy_doc},
+	{"__copy__", (PyCFunction) Quaternion_copy, METH_NOARGS, Quaternion_copy_doc},
+	{"__deepcopy__", (PyCFunction) Quaternion_deepcopy, METH_VARARGS, Quaternion_copy_doc},
 	{NULL, NULL, 0, NULL}
 };
 
@@ -1171,7 +1180,7 @@ static PyGetSetDef Quaternion_getseters[] = {
 	{(char *)"z", (getter)Quaternion_axis_get, (setter)Quaternion_axis_set, Quaternion_axis_doc, (void *)3},
 	{(char *)"magnitude", (getter)Quaternion_magnitude_get, (setter)NULL, Quaternion_magnitude_doc, NULL},
 	{(char *)"angle", (getter)Quaternion_angle_get, (setter)Quaternion_angle_set, Quaternion_angle_doc, NULL},
-	{(char *)"axis",(getter)Quaternion_axis_vector_get, (setter)Quaternion_axis_vector_set, Quaternion_axis_vector_doc, NULL},
+	{(char *)"axis", (getter)Quaternion_axis_vector_get, (setter)Quaternion_axis_vector_set, Quaternion_axis_vector_doc, NULL},
 	{(char *)"is_wrapped", (getter)BaseMathObject_is_wrapped_get, (setter)NULL, BaseMathObject_is_wrapped_doc, NULL},
 	{(char *)"owner", (getter)BaseMathObject_owner_get, (setter)NULL, BaseMathObject_owner_doc, NULL},
 	{NULL, NULL, NULL, NULL, NULL}  /* Sentinel */
@@ -1183,58 +1192,58 @@ PyDoc_STRVAR(quaternion_doc,
 );
 PyTypeObject quaternion_Type = {
 	PyVarObject_HEAD_INIT(NULL, 0)
-	"mathutils.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
+	"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
+	(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
 /*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())*/
+ * (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 *Quaternion_CreatePyObject(float *quat, int type, PyTypeObject *base_type)
 {
 	QuaternionObject *self;
@@ -1268,14 +1277,15 @@ PyObject *Quaternion_CreatePyObject(float *quat, int type, PyTypeObject *base_ty
 	return (PyObject *) self;
 }
 
-PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user, int cb_type, int cb_subtype)
+PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user,
+                                       unsigned char cb_type, unsigned char cb_subtype)
 {
 	QuaternionObject *self = (QuaternionObject *)Quaternion_CreatePyObject(NULL, Py_NEW, NULL);
 	if (self) {
 		Py_INCREF(cb_user);
-		self->cb_user =			cb_user;
-		self->cb_type =			(unsigned char)cb_type;
-		self->cb_subtype =		(unsigned char)cb_subtype;
+		self->cb_user         = cb_user;
+		self->cb_type         = cb_type;
+		self->cb_subtype      = cb_subtype;
 		PyObject_GC_Track(self);
 	}
 
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.h b/source/blender/python/mathutils/mathutils_Quaternion.h
index edd5ec5..09faff1 100644
--- a/source/blender/python/mathutils/mathutils_Quaternion.h
+++ b/source/blender/python/mathutils/mathutils_Quaternion.h
@@ -32,8 +32,8 @@
  */
 
 
-#ifndef MATHUTILS_QUAT_H
-#define MATHUTILS_QUAT_H
+#ifndef __MATHUTILS_QUATERNION_H__
+#define __MATHUTILS_QUATERNION_H__
 
 extern PyTypeObject quaternion_Type;
 #define QuaternionObject_Check(_v) PyObject_TypeCheck((_v), &quaternion_Type)
@@ -42,13 +42,14 @@ typedef struct {
 	BASE_MATH_MEMBERS(quat);
 } QuaternionObject;
 
-/*struct data contains a pointer to the actual data that the
-object uses. It can use either PyMem allocated data (which will
-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*/
+/* struct data contains a pointer to the actual data that the
+ * object uses. It can use either PyMem allocated data (which will
+ * 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 *Quaternion_CreatePyObject( float *quat, int type, PyTypeObject *base_type);
-PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user, int cb_type, int cb_subtype);
+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);
 
-#endif /* MATHUTILS_QUAT_H */
+#endif /* __MATHUTILS_QUATERNION_H__ */
diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c
index 765df7a..07bda4c 100644
--- a/source/blender/python/mathutils/mathutils_Vector.c
+++ b/source/blender/python/mathutils/mathutils_Vector.c
@@ -40,13 +40,14 @@
 #define MAX_DIMENSIONS 4
 
 /* Swizzle axes get packed into a single value that is used as a closure. Each
-   axis uses SWIZZLE_BITS_PER_AXIS bits. The first bit (SWIZZLE_VALID_AXIS) is
-   used as a sentinel: if it is unset, the axis is not valid. */
+ * axis uses SWIZZLE_BITS_PER_AXIS bits. The first bit (SWIZZLE_VALID_AXIS) is
+ * used as a sentinel: if it is unset, the axis is not valid. */
 #define SWIZZLE_BITS_PER_AXIS 3
 #define SWIZZLE_VALID_AXIS 0x4
 #define SWIZZLE_AXIS       0x3
 
 static PyObject *Vector_copy(VectorObject *self);
+static PyObject *Vector_deepcopy(VectorObject *self, PyObject *args);
 static PyObject *Vector_to_tuple_ext(VectorObject *self, int ndigits);
 static int row_vector_multiplication(float rvec[MAX_DIMENSIONS], VectorObject *vec, MatrixObject *mat);
 
@@ -59,31 +60,31 @@ static PyObject *Vector_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED
 	int size = 3; /* default to a 3D vector */
 
 	switch (PyTuple_GET_SIZE(args)) {
-	case 0:
-		vec = PyMem_Malloc(size * sizeof(float));
+		case 0:
+			vec = PyMem_Malloc(size * sizeof(float));
 
-		if (vec == NULL) {
-			PyErr_SetString(PyExc_MemoryError,
-							"Vector(): "
-							"problem allocating pointer space");
-			return NULL;
-		}
+			if (vec == NULL) {
+				PyErr_SetString(PyExc_MemoryError,
+				                "Vector(): "
+				                "problem allocating pointer space");
+				return NULL;
+			}
 
-		fill_vn_fl(vec, size, 0.0f);
-		break;
-	case 1:
-		if ((size = mathutils_array_parse_alloc(&vec, 2, PyTuple_GET_ITEM(args, 0), "mathutils.Vector()")) == -1) {
-			if (vec) {
-				PyMem_Free(vec);
+			fill_vn_fl(vec, size, 0.0f);
+			break;
+		case 1:
+			if ((size = mathutils_array_parse_alloc(&vec, 2, PyTuple_GET_ITEM(args, 0), "mathutils.Vector()")) == -1) {
+				if (vec) {
+					PyMem_Free(vec);
+				}
+				return NULL;
 			}
+			break;
+		default:
+			PyErr_SetString(PyExc_TypeError,
+			                "mathutils.Vector(): "
+			                "more then a single arg given");
 			return NULL;
-		}
-		break;
-	default:
-		PyErr_SetString(PyExc_TypeError,
-		                "mathutils.Vector(): "
-		                "more then a single arg given");
-		return NULL;
 	}
 	return Vector_CreatePyObject(vec, size, Py_NEW, type);
 }
@@ -133,7 +134,7 @@ static PyObject *C_Vector_Fill(PyObject *cls, PyObject *args)
 
 	if (vec == NULL) {
 		PyErr_SetString(PyExc_MemoryError,
-						"Vector.Fill(): "
+		                "Vector.Fill(): "
 		                "problem allocating pointer space");
 		return NULL;
 	}
@@ -167,36 +168,36 @@ static PyObject *C_Vector_Range(PyObject *cls, PyObject *args)
 	}
 
 	switch (PyTuple_GET_SIZE(args)) {
-	case 1:
-		size = start;
-		start = 0;
-		break;
-	case 2:
-		if (start >= stop) {
-			PyErr_SetString(PyExc_RuntimeError,
-			                "Start value is larger "
-			                "than the stop value");
-			return NULL;
-		}
+		case 1:
+			size = start;
+			start = 0;
+			break;
+		case 2:
+			if (start >= stop) {
+				PyErr_SetString(PyExc_RuntimeError,
+				                "Start value is larger "
+				                "than the stop value");
+				return NULL;
+			}
 
-		size = stop - start;
-		break;
-	default:
-		if (start >= stop) {
-			PyErr_SetString(PyExc_RuntimeError,
-			                "Start value is larger "
-			                "than the stop value");
-			return NULL;
-		}
+			size = stop - start;
+			break;
+		default:
+			if (start >= stop) {
+				PyErr_SetString(PyExc_RuntimeError,
+				                "Start value is larger "
+				                "than the stop value");
+				return NULL;
+			}
 
-		size = (stop - start);
+			size = (stop - start);
 
-		if ((size % step) != 0)
-			size += step;
+			if ((size % step) != 0)
+				size += step;
 
-		size /= step;
+			size /= step;
 
-		break;
+			break;
 	}
 
 	if (size < 2) {
@@ -247,7 +248,7 @@ static PyObject *C_Vector_Linspace(PyObject *cls, PyObject *args)
 		return NULL;
 	}
 
-	step = (end - start)/(float)(size-1);
+	step = (end - start) / (float)(size - 1);
 
 	vec = PyMem_Malloc(size * sizeof(float));
 
@@ -412,7 +413,7 @@ static PyObject *Vector_resize(VectorObject *self, PyObject *value)
 	self->vec = PyMem_Realloc(self->vec, (size * sizeof(float)));
 	if (self->vec == NULL) {
 		PyErr_SetString(PyExc_MemoryError,
-						"Vector.resize(): "
+		                "Vector.resize(): "
 		                "problem allocating pointer space");
 		return NULL;
 	}
@@ -439,8 +440,6 @@ static PyObject *Vector_resized(VectorObject *self, PyObject *value)
 	int size;
 	float *vec;
 
-	/*if (!PyArg_ParseTuple(args, "i:resize", &size))
-		return NULL;*/
 	if ((size = PyLong_AsLong(value)) == -1) {
 		return NULL;
 	}
@@ -736,19 +735,19 @@ static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args)
 		}
 		else if (strlen(strack) == 1) {
 			switch (strack[0]) {
-			case '-':
-			case 'X':
-				track = 0;
-				break;
-			case 'Y':
-				track = 1;
-				break;
-			case 'Z':
-				track = 2;
-				break;
-			default:
-				PyErr_SetString(PyExc_ValueError, axis_err_msg);
-				return NULL;
+				case '-':
+				case 'X':
+					track = 0;
+					break;
+				case 'Y':
+					track = 1;
+					break;
+				case 'Z':
+					track = 2;
+					break;
+				default:
+					PyErr_SetString(PyExc_ValueError, axis_err_msg);
+					return NULL;
 			}
 		}
 		else {
@@ -761,18 +760,18 @@ static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args)
 		const char *axis_err_msg = "only X, Y or Z for up axis";
 		if (strlen(sup) == 1) {
 			switch (*sup) {
-			case 'X':
-				up = 0;
-				break;
-			case 'Y':
-				up = 1;
-				break;
-			case 'Z':
-				up = 2;
-				break;
-			default:
-				PyErr_SetString(PyExc_ValueError, axis_err_msg);
-				return NULL;
+				case 'X':
+					up = 0;
+					break;
+				case 'Y':
+					up = 1;
+					break;
+				case 'Z':
+					up = 2;
+					break;
+				default:
+					PyErr_SetString(PyExc_ValueError, axis_err_msg);
+					return NULL;
 			}
 		}
 		else {
@@ -788,9 +787,9 @@ static PyObject *Vector_to_track_quat(VectorObject *self, PyObject *args)
 	}
 
 	/*
-		flip vector around, since vectoquat expect a vector from target to tracking object
-		and the python function expects the inverse (a vector to the target).
-	*/
+	 * flip vector around, since vectoquat expect a vector from target to tracking object
+	 * and the python function expects the inverse (a vector to the target).
+	 */
 	negate_v3_v3(vec, self->vec);
 
 	vec_to_quat(quat, vec, track, up);
@@ -833,13 +832,11 @@ static PyObject *Vector_reflect(VectorObject *self, PyObject *value)
 
 	mirror[0] = tvec[0];
 	mirror[1] = tvec[1];
-	if (value_size > 2)		mirror[2] = tvec[2];
-	else					mirror[2] = 0.0;
+	mirror[2] = (value_size > 2) ? tvec[2] : 0.0f;
 
 	vec[0] = self->vec[0];
 	vec[1] = self->vec[1];
-	if (self->size > 2)		vec[2] = self->vec[2];
-	else					vec[2] = 0.0;
+	vec[2] = (value_size > 2) ? self->vec[2] : 0.0f;
 
 	normalize_v3(mirror);
 	reflect_v3_v3v3(reflect, vec, mirror);
@@ -922,7 +919,7 @@ PyDoc_STRVAR(Vector_angle_doc,
 "   :return: angle in radians or fallback when given\n"
 "   :rtype: float\n"
 "\n"
-"   .. note:: Zero length vectors raise an :exc:`AttributeError`.\n"
+"   .. note:: Zero length vectors raise an :exc:`ValueError`.\n"
 );
 static PyObject *Vector_angle(VectorObject *self, PyObject *args)
 {
@@ -973,6 +970,62 @@ static PyObject *Vector_angle(VectorObject *self, PyObject *args)
 	return PyFloat_FromDouble(saacos(dot / (sqrt(dot_self) * sqrt(dot_other))));
 }
 
+PyDoc_STRVAR(Vector_angle_signed_doc,
+".. function:: angle_signed(other, fallback)\n"
+"\n"
+"   Return the signed angle between two 2D vectors (clockwise is positive).\n"
+"\n"
+"   :arg other: another vector to compare the angle with\n"
+"   :type other: :class:`Vector`\n"
+"   :arg fallback: return this value when the angle cant be calculated\n"
+"      (zero length vector)\n"
+"   :type fallback: any\n"
+"   :return: angle in radians or fallback when given\n"
+"   :rtype: float\n"
+"\n"
+"   .. note:: Zero length vectors raise an :exc:`ValueError`.\n"
+);
+static PyObject *Vector_angle_signed(VectorObject *self, PyObject *args)
+{
+	float tvec[2];
+
+	PyObject *value;
+	PyObject *fallback = NULL;
+
+	if (!PyArg_ParseTuple(args, "O|O:angle_signed", &value, &fallback))
+		return NULL;
+
+	if (BaseMath_ReadCallback(self) == -1)
+		return NULL;
+
+	if (mathutils_array_parse(tvec, 2, 2, value, "Vector.angle_signed(other), invalid 'other' arg") == -1)
+		return NULL;
+
+	if (self->size != 2) {
+		PyErr_SetString(PyExc_ValueError,
+		                "Vector must be 2D");
+		return NULL;
+	}
+
+	if (is_zero_v2(self->vec) || is_zero_v2(tvec)) {
+		/* avoid exception */
+		if (fallback) {
+			Py_INCREF(fallback);
+			return fallback;
+		}
+		else {
+			PyErr_SetString(PyExc_ValueError,
+			                "Vector.angle_signed(other): "
+			                "zero length vectors have no valid angle");
+			return NULL;
+		}
+	}
+
+
+	return PyFloat_FromDouble(angle_signed_v2v2(self->vec, tvec));
+}
+
+
 PyDoc_STRVAR(Vector_rotation_difference_doc,
 ".. function:: rotation_difference(other)\n"
 "\n"
@@ -1159,6 +1212,12 @@ static PyObject *Vector_copy(VectorObject *self)
 
 	return Vector_CreatePyObject(self->vec, self->size, Py_NEW, Py_TYPE(self));
 }
+static PyObject *Vector_deepcopy(VectorObject *self, PyObject *args)
+{
+	if (!mathutils_deepcopy_args_check(args))
+		return NULL;
+	return Vector_copy(self);
+}
 
 static PyObject *Vector_repr(VectorObject *self)
 {
@@ -1205,10 +1264,10 @@ static int Vector_len(VectorObject *self)
 /* sequence accessor (get): vector[index] */
 static PyObject *vector_item_internal(VectorObject *self, int i, const int is_attr)
 {
-	if (i < 0)	i = self->size-i;
+	if (i < 0) i = self->size - i;
 
 	if (i < 0 || i >= self->size) {
-		if (is_attr)	{
+		if (is_attr) {
 			PyErr_Format(PyExc_AttributeError,
 			             "Vector.%c: unavailable on %dd vector",
 			             *(((char *)"xyzw") + i), self->size);
@@ -1241,7 +1300,7 @@ static int vector_ass_item_internal(VectorObject *self, int i, PyObject *value,
 		return -1;
 	}
 
-	if (i < 0)	i = self->size-i;
+	if (i < 0) i = self->size - i;
 
 	if (i < 0 || i >= self->size) {
 		if (is_attr) {
@@ -1309,7 +1368,7 @@ static int Vector_ass_slice(VectorObject *self, int begin, int end, PyObject *se
 
 	if (vec == NULL) {
 		PyErr_SetString(PyExc_MemoryError,
-						"vec[:] = seq: "
+		                "vec[:] = seq: "
 		                "problem allocating pointer space");
 		return -1;
 	}
@@ -1343,8 +1402,8 @@ static PyObject *Vector_add(PyObject *v1, PyObject *v2)
 		             Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
 		return NULL;
 	}
-	vec1 = (VectorObject*)v1;
-	vec2 = (VectorObject*)v2;
+	vec1 = (VectorObject *)v1;
+	vec2 = (VectorObject *)v2;
 
 	if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1)
 		return NULL;
@@ -1383,8 +1442,8 @@ static PyObject *Vector_iadd(PyObject *v1, PyObject *v2)
 		             Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
 		return NULL;
 	}
-	vec1 = (VectorObject*)v1;
-	vec2 = (VectorObject*)v2;
+	vec1 = (VectorObject *)v1;
+	vec2 = (VectorObject *)v2;
 
 	if (vec1->size != vec2->size) {
 		PyErr_SetString(PyExc_AttributeError,
@@ -1416,8 +1475,8 @@ static PyObject *Vector_sub(PyObject *v1, PyObject *v2)
 		             Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
 		return NULL;
 	}
-	vec1 = (VectorObject*)v1;
-	vec2 = (VectorObject*)v2;
+	vec1 = (VectorObject *)v1;
+	vec2 = (VectorObject *)v2;
 
 	if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1)
 		return NULL;
@@ -1455,8 +1514,8 @@ static PyObject *Vector_isub(PyObject *v1, PyObject *v2)
 		             Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
 		return NULL;
 	}
-	vec1 = (VectorObject*)v1;
-	vec2 = (VectorObject*)v2;
+	vec1 = (VectorObject *)v1;
+	vec2 = (VectorObject *)v2;
 
 	if (vec1->size != vec2->size) {
 		PyErr_SetString(PyExc_AttributeError,
@@ -1476,7 +1535,7 @@ static PyObject *Vector_isub(PyObject *v1, PyObject *v2)
 }
 
 /*------------------------obj * obj------------------------------
-  mulplication*/
+ * mulplication*/
 
 
 /* COLUMN VECTOR Multiplication (Matrix X Vector)
@@ -1499,7 +1558,7 @@ int column_vector_multiplication(float r_vec[MAX_DIMENSIONS], VectorObject *vec,
 		else {
 			PyErr_SetString(PyExc_ValueError,
 			                "matrix * vector: "
-							"len(matrix.col) and len(vector) must be the same, "
+			                "len(matrix.col) and len(vector) must be the same, "
 			                "except for 4x4 matrix * 3D vector.");
 			return -1;
 		}
@@ -1541,12 +1600,12 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2)
 	float scalar;
 	int vec_size;
 
-	if VectorObject_Check(v1) {
+	if (VectorObject_Check(v1)) {
 		vec1 = (VectorObject *)v1;
 		if (BaseMath_ReadCallback(vec1) == -1)
 			return NULL;
 	}
-	if VectorObject_Check(v2) {
+	if (VectorObject_Check(v2)) {
 		vec2 = (VectorObject *)v2;
 		if (BaseMath_ReadCallback(vec2) == -1)
 			return NULL;
@@ -1572,7 +1631,7 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2)
 
 			if (BaseMath_ReadCallback((MatrixObject *)v2) == -1)
 				return NULL;
-			if (row_vector_multiplication(tvec, vec1, (MatrixObject*)v2) == -1) {
+			if (row_vector_multiplication(tvec, vec1, (MatrixObject *)v2) == -1) {
 				return NULL;
 			}
 
@@ -1594,7 +1653,7 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2)
 			                "order (promoted to an Error for Debug builds)");
 			return NULL;
 #else
-			QuaternionObject *quat2 = (QuaternionObject*)v2;
+			QuaternionObject *quat2 = (QuaternionObject *)v2;
 			float tvec[3];
 
 			if (vec1->size != 3) {
@@ -1643,21 +1702,21 @@ static PyObject *Vector_imul(PyObject *v1, PyObject *v2)
 		return NULL;
 
 	/* only support vec*=float and vec*=mat
-	   vec*=vec result is a float so that wont work */
+	 *  vec*=vec result is a float so that wont work */
 	if (MatrixObject_Check(v2)) {
 /* ------ to be removed ------*/
 #if 1
 		PyErr_SetString(PyExc_ValueError,
-						"(Vector *= Matrix) is now removed, reverse the "
-						"order (promoted to an Error for Debug builds) "
-						"and uses the non in-place multiplication.");
+		                "(Vector *= Matrix) is now removed, reverse the "
+		                "order (promoted to an Error for Debug builds) "
+		                "and uses the non in-place multiplication.");
 		return NULL;
 #else
 		float rvec[MAX_DIMENSIONS];
 		if (BaseMath_ReadCallback((MatrixObject *)v2) == -1)
 			return NULL;
 
-		if (column_vector_multiplication(rvec, vec, (MatrixObject*)v2) == -1)
+		if (column_vector_multiplication(rvec, vec, (MatrixObject *)v2) == -1)
 			return NULL;
 
 		memcpy(vec->vec, rvec, sizeof(float) * vec->size);
@@ -1670,12 +1729,12 @@ static PyObject *Vector_imul(PyObject *v1, PyObject *v2)
 /* ------ to be removed ------*/
 #if 1
 		PyErr_SetString(PyExc_ValueError,
-						"(Vector *= Quat) is now removed, reverse the "
-						"order (promoted to an Error for Debug builds) "
-						"and uses the non in-place multiplication.");
+		                "(Vector *= Quat) is now removed, reverse the "
+		                "order (promoted to an Error for Debug builds) "
+		                "and uses the non in-place multiplication.");
 		return NULL;
 #else
-		QuaternionObject *quat2 = (QuaternionObject*)v2;
+		QuaternionObject *quat2 = (QuaternionObject *)v2;
 
 		if (vec->size != 3) {
 			PyErr_SetString(PyExc_ValueError,
@@ -1757,7 +1816,7 @@ static PyObject *Vector_div(PyObject *v1, PyObject *v2)
 static PyObject *Vector_idiv(PyObject *v1, PyObject *v2)
 {
 	float scalar;
-	VectorObject *vec1 = (VectorObject*)v1;
+	VectorObject *vec1 = (VectorObject *)v1;
 
 	if (BaseMath_ReadCallback(vec1) == -1)
 		return NULL;
@@ -1785,7 +1844,7 @@ static PyObject *Vector_idiv(PyObject *v1, PyObject *v2)
 }
 
 /* -obj
-  returns the negative of this object*/
+ * returns the negative of this object*/
 static PyObject *Vector_neg(VectorObject *self)
 {
 	float *tvec;
@@ -1801,16 +1860,16 @@ static PyObject *Vector_neg(VectorObject *self)
 /*------------------------vec_magnitude_nosqrt (internal) - for comparing only */
 static double vec_magnitude_nosqrt(float *data, int size)
 {
-	/*return (double)sqrt(dot);*/
+	/* return (double)sqrt(dot);*/
 	/* warning, line above removed because we are not using the length,
-	   rather the comparing the sizes and for this we do not need the sqrt
-	   for the actual length, the dot must be sqrt'd */
+	 * rather the comparing the sizes and for this we do not need the sqrt
+	 * for the actual length, the dot must be sqrt'd */
 	return dot_vn_vn(data, data, size);
 }
 
 
 /*------------------------tp_richcmpr
-  returns -1 execption, 0 false, 1 true */
+ * returns -1 execption, 0 false, 1 true */
 static PyObject *Vector_richcmpr(PyObject *objectA, PyObject *objectB, int comparison_type)
 {
 	VectorObject *vecA = NULL, *vecB = NULL;
@@ -1826,8 +1885,8 @@ static PyObject *Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa
 			Py_RETURN_FALSE;
 		}
 	}
-	vecA = (VectorObject*)objectA;
-	vecB = (VectorObject*)objectB;
+	vecA = (VectorObject *)objectA;
+	vecB = (VectorObject *)objectB;
 
 	if (BaseMath_ReadCallback(vecA) == -1 || BaseMath_ReadCallback(vecB) == -1)
 		return NULL;
@@ -1896,16 +1955,16 @@ static PyObject *Vector_richcmpr(PyObject *objectA, PyObject *objectB, int compa
 
 /*-----------------PROTCOL DECLARATIONS--------------------------*/
 static PySequenceMethods Vector_SeqMethods = {
-	(lenfunc) Vector_len,				/* sq_length */
-	(binaryfunc) NULL,					/* sq_concat */
-	(ssizeargfunc) NULL,				/* sq_repeat */
-	(ssizeargfunc) Vector_item,			/* sq_item */
-	NULL,								/* py3 deprecated slice func */
-	(ssizeobjargproc) Vector_ass_item,	/* sq_ass_item */
-	NULL,								/* py3 deprecated slice assign func */
-	(objobjproc) NULL,					/* sq_contains */
-	(binaryfunc) NULL,					/* sq_inplace_concat */
-	(ssizeargfunc) NULL,				/* sq_inplace_repeat */
+	(lenfunc) Vector_len,               /* sq_length */
+	(binaryfunc) NULL,                  /* sq_concat */
+	(ssizeargfunc) NULL,                /* sq_repeat */
+	(ssizeargfunc) Vector_item,         /* sq_item */
+	NULL,                               /* py3 deprecated slice func */
+	(ssizeobjargproc) Vector_ass_item,  /* sq_ass_item */
+	NULL,                               /* py3 deprecated slice assign func */
+	(objobjproc) NULL,                  /* sq_contains */
+	(binaryfunc) NULL,                  /* sq_inplace_concat */
+	(ssizeargfunc) NULL,                /* sq_inplace_repeat */
 };
 
 static PyObject *Vector_subscript(VectorObject *self, PyObject *item)
@@ -1985,40 +2044,40 @@ static PyMappingMethods Vector_AsMapping = {
 
 
 static PyNumberMethods Vector_NumMethods = {
-	(binaryfunc)	Vector_add,	/*nb_add*/
-	(binaryfunc)	Vector_sub,	/*nb_subtract*/
-	(binaryfunc)	Vector_mul,	/*nb_multiply*/
-	NULL,							/*nb_remainder*/
-	NULL,							/*nb_divmod*/
-	NULL,							/*nb_power*/
-	(unaryfunc) 	Vector_neg,	/*nb_negative*/
-	(unaryfunc) 	NULL,	/*tp_positive*/
-	(unaryfunc) 	NULL,	/*tp_absolute*/
-	(inquiry)	NULL,	/*tp_bool*/
-	(unaryfunc)	NULL,	/*nb_invert*/
-	NULL,				/*nb_lshift*/
-	(binaryfunc)NULL,	/*nb_rshift*/
-	NULL,				/*nb_and*/
-	NULL,				/*nb_xor*/
-	NULL,				/*nb_or*/
-	NULL,				/*nb_int*/
-	NULL,				/*nb_reserved*/
-	NULL,				/*nb_float*/
-	Vector_iadd,	/* nb_inplace_add */
-	Vector_isub,	/* nb_inplace_subtract */
-	Vector_imul,	/* nb_inplace_multiply */
-	NULL,				/* nb_inplace_remainder */
-	NULL,				/* nb_inplace_power */
-	NULL,				/* nb_inplace_lshift */
-	NULL,				/* nb_inplace_rshift */
-	NULL,				/* nb_inplace_and */
-	NULL,				/* nb_inplace_xor */
-	NULL,				/* nb_inplace_or */
-	NULL,				/* nb_floor_divide */
-	Vector_div,		/* nb_true_divide */
-	NULL,				/* nb_inplace_floor_divide */
-	Vector_idiv,	/* nb_inplace_true_divide */
-	NULL,			/* nb_index */
+	(binaryfunc)    Vector_add, /*nb_add*/
+	(binaryfunc)    Vector_sub, /*nb_subtract*/
+	(binaryfunc)    Vector_mul, /*nb_multiply*/
+	NULL,                       /*nb_remainder*/
+	NULL,                       /*nb_divmod*/
+	NULL,                       /*nb_power*/
+	(unaryfunc)     Vector_neg, /*nb_negative*/
+	(unaryfunc)     NULL,       /*tp_positive*/
+	(unaryfunc)     NULL,       /*tp_absolute*/
+	(inquiry)   NULL,           /*tp_bool*/
+	(unaryfunc) NULL,           /*nb_invert*/
+	NULL,                       /*nb_lshift*/
+	(binaryfunc)NULL,           /*nb_rshift*/
+	NULL,                       /*nb_and*/
+	NULL,                       /*nb_xor*/
+	NULL,                       /*nb_or*/
+	NULL,                       /*nb_int*/
+	NULL,                       /*nb_reserved*/
+	NULL,                       /*nb_float*/
+	Vector_iadd,                /* nb_inplace_add */
+	Vector_isub,                /* nb_inplace_subtract */
+	Vector_imul,                /* nb_inplace_multiply */
+	NULL,                       /* nb_inplace_remainder */
+	NULL,                       /* nb_inplace_power */
+	NULL,                       /* nb_inplace_lshift */
+	NULL,                       /* nb_inplace_rshift */
+	NULL,                       /* nb_inplace_and */
+	NULL,                       /* nb_inplace_xor */
+	NULL,                       /* nb_inplace_or */
+	NULL,                       /* nb_floor_divide */
+	Vector_div,                 /* nb_true_divide */
+	NULL,                       /* nb_inplace_floor_divide */
+	Vector_idiv,                /* nb_inplace_true_divide */
+	NULL,                       /* nb_index */
 };
 
 /*------------------PY_OBECT DEFINITION--------------------------*/
@@ -2147,7 +2206,7 @@ static PyObject *Vector_swizzle_get(VectorObject *self, void *closure)
  * - If the value is scalar, it is copied to all axes listed in the swizzle.
  * - If an axis appears more than once in the swizzle, the final occurrence is
  *   the one that determines its value.
-
+ *
  * Returns 0 on success and -1 on failure. On failure, the vector will be
  * unchanged. */
 static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure)
@@ -2192,9 +2251,9 @@ static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure
 
 		size_from = axis_from;
 	}
-	else if ( (PyErr_Clear()), /* run but ignore the result */
-	          (size_from = mathutils_array_parse(vec_assign, 2, 4, value,
-	                                           "mathutils.Vector.**** = swizzle assignment")) == -1)
+	else if ((PyErr_Clear()), /* run but ignore the result */
+	         (size_from = mathutils_array_parse(vec_assign, 2, 4, value,
+	                                            "mathutils.Vector.**** = swizzle assignment")) == -1)
 	{
 		return -1;
 	}
@@ -2209,7 +2268,7 @@ static int Vector_swizzle_set(VectorObject *self, PyObject *value, void *closure
 	axis_from = 0;
 	swizzleClosure = GET_INT_FROM_POINTER(closure);
 
-	while (swizzleClosure & SWIZZLE_VALID_AXIS)	{
+	while (swizzleClosure & SWIZZLE_VALID_AXIS) {
 		axis_to = swizzleClosure & SWIZZLE_AXIS;
 		tvec[axis_to] = vec_assign[axis_from];
 		swizzleClosure = swizzleClosure >> SWIZZLE_BITS_PER_AXIS;
@@ -2240,342 +2299,342 @@ static PyGetSetDef Vector_getseters[] = {
 	{(char *)"owner", (getter)BaseMathObject_owner_get, (setter)NULL, BaseMathObject_owner_doc, NULL},
 
 	/* autogenerated swizzle attrs, see python script below */
-	{(char *)"xx",   (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 36
-	{(char *)"xxx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 292
-	{(char *)"xxxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2340
-	{(char *)"xxxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2852
-	{(char *)"xxxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3364
-	{(char *)"xxxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3876
-	{(char *)"xxy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 356
-	{(char *)"xxyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2404
-	{(char *)"xxyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2916
-	{(char *)"xxyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3428
-	{(char *)"xxyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3940
-	{(char *)"xxz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 420
-	{(char *)"xxzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2468
-	{(char *)"xxzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2980
-	{(char *)"xxzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3492
-	{(char *)"xxzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4004
-	{(char *)"xxw",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 484
-	{(char *)"xxwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2532
-	{(char *)"xxwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3044
-	{(char *)"xxwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3556
-	{(char *)"xxww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4068
-	{(char *)"xy",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 44
-	{(char *)"xyx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 300
-	{(char *)"xyxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2348
-	{(char *)"xyxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2860
-	{(char *)"xyxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3372
-	{(char *)"xyxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3884
-	{(char *)"xyy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 364
-	{(char *)"xyyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2412
-	{(char *)"xyyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2924
-	{(char *)"xyyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3436
-	{(char *)"xyyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3948
-	{(char *)"xyz",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 428
-	{(char *)"xyzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2476
-	{(char *)"xyzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2988
-	{(char *)"xyzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3500
-	{(char *)"xyzw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4012
-	{(char *)"xyw",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 492
-	{(char *)"xywx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2540
-	{(char *)"xywy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3052
-	{(char *)"xywz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3564
-	{(char *)"xyww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4076
-	{(char *)"xz",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 52
-	{(char *)"xzx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 308
-	{(char *)"xzxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2356
-	{(char *)"xzxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2868
-	{(char *)"xzxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3380
-	{(char *)"xzxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3892
-	{(char *)"xzy",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 372
-	{(char *)"xzyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2420
-	{(char *)"xzyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2932
-	{(char *)"xzyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3444
-	{(char *)"xzyw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3956
-	{(char *)"xzz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 436
-	{(char *)"xzzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2484
-	{(char *)"xzzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2996
-	{(char *)"xzzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3508
-	{(char *)"xzzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4020
-	{(char *)"xzw",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 500
-	{(char *)"xzwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2548
-	{(char *)"xzwy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3060
-	{(char *)"xzwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3572
-	{(char *)"xzww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4084
-	{(char *)"xw",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 60
-	{(char *)"xwx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 316
-	{(char *)"xwxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2364
-	{(char *)"xwxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2876
-	{(char *)"xwxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3388
-	{(char *)"xwxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3900
-	{(char *)"xwy",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 380
-	{(char *)"xwyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2428
-	{(char *)"xwyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2940
-	{(char *)"xwyz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3452
-	{(char *)"xwyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3964
-	{(char *)"xwz",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 444
-	{(char *)"xwzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2492
-	{(char *)"xwzy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3004
-	{(char *)"xwzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3516
-	{(char *)"xwzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4028
-	{(char *)"xww",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 508
-	{(char *)"xwwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2556
-	{(char *)"xwwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3068
-	{(char *)"xwwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3580
-	{(char *)"xwww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4092
-	{(char *)"yx",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 37
-	{(char *)"yxx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 293
-	{(char *)"yxxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2341
-	{(char *)"yxxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2853
-	{(char *)"yxxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3365
-	{(char *)"yxxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3877
-	{(char *)"yxy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 357
-	{(char *)"yxyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2405
-	{(char *)"yxyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2917
-	{(char *)"yxyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3429
-	{(char *)"yxyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3941
-	{(char *)"yxz",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 421
-	{(char *)"yxzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2469
-	{(char *)"yxzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2981
-	{(char *)"yxzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3493
-	{(char *)"yxzw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4005
-	{(char *)"yxw",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 485
-	{(char *)"yxwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2533
-	{(char *)"yxwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3045
-	{(char *)"yxwz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3557
-	{(char *)"yxww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4069
-	{(char *)"yy",   (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 45
-	{(char *)"yyx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 301
-	{(char *)"yyxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2349
-	{(char *)"yyxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2861
-	{(char *)"yyxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3373
-	{(char *)"yyxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3885
-	{(char *)"yyy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 365
-	{(char *)"yyyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2413
-	{(char *)"yyyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2925
-	{(char *)"yyyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3437
-	{(char *)"yyyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3949
-	{(char *)"yyz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 429
-	{(char *)"yyzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2477
-	{(char *)"yyzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2989
-	{(char *)"yyzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3501
-	{(char *)"yyzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4013
-	{(char *)"yyw",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 493
-	{(char *)"yywx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2541
-	{(char *)"yywy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3053
-	{(char *)"yywz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3565
-	{(char *)"yyww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4077
-	{(char *)"yz",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 53
-	{(char *)"yzx",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 309
-	{(char *)"yzxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2357
-	{(char *)"yzxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2869
-	{(char *)"yzxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3381
-	{(char *)"yzxw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3893
-	{(char *)"yzy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 373
-	{(char *)"yzyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2421
-	{(char *)"yzyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2933
-	{(char *)"yzyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3445
-	{(char *)"yzyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3957
-	{(char *)"yzz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 437
-	{(char *)"yzzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2485
-	{(char *)"yzzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2997
-	{(char *)"yzzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3509
-	{(char *)"yzzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4021
-	{(char *)"yzw",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 501
-	{(char *)"yzwx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2549
-	{(char *)"yzwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3061
-	{(char *)"yzwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3573
-	{(char *)"yzww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4085
-	{(char *)"yw",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 61
-	{(char *)"ywx",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 317
-	{(char *)"ywxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2365
-	{(char *)"ywxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2877
-	{(char *)"ywxz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3389
-	{(char *)"ywxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3901
-	{(char *)"ywy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 381
-	{(char *)"ywyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2429
-	{(char *)"ywyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2941
-	{(char *)"ywyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3453
-	{(char *)"ywyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3965
-	{(char *)"ywz",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 445
-	{(char *)"ywzx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2493
-	{(char *)"ywzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3005
-	{(char *)"ywzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3517
-	{(char *)"ywzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4029
-	{(char *)"yww",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 509
-	{(char *)"ywwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2557
-	{(char *)"ywwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3069
-	{(char *)"ywwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3581
-	{(char *)"ywww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4093
-	{(char *)"zx",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 38
-	{(char *)"zxx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 294
-	{(char *)"zxxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2342
-	{(char *)"zxxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2854
-	{(char *)"zxxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3366
-	{(char *)"zxxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3878
-	{(char *)"zxy",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 358
-	{(char *)"zxyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2406
-	{(char *)"zxyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2918
-	{(char *)"zxyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3430
-	{(char *)"zxyw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3942
-	{(char *)"zxz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 422
-	{(char *)"zxzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2470
-	{(char *)"zxzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2982
-	{(char *)"zxzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3494
-	{(char *)"zxzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4006
-	{(char *)"zxw",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 486
-	{(char *)"zxwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2534
-	{(char *)"zxwy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3046
-	{(char *)"zxwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3558
-	{(char *)"zxww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4070
-	{(char *)"zy",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 46
-	{(char *)"zyx",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 302
-	{(char *)"zyxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2350
-	{(char *)"zyxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2862
-	{(char *)"zyxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3374
-	{(char *)"zyxw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3886
-	{(char *)"zyy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 366
-	{(char *)"zyyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2414
-	{(char *)"zyyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2926
-	{(char *)"zyyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3438
-	{(char *)"zyyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3950
-	{(char *)"zyz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 430
-	{(char *)"zyzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2478
-	{(char *)"zyzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2990
-	{(char *)"zyzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3502
-	{(char *)"zyzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4014
-	{(char *)"zyw",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 494
-	{(char *)"zywx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2542
-	{(char *)"zywy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3054
-	{(char *)"zywz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3566
-	{(char *)"zyww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4078
-	{(char *)"zz",   (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 54
-	{(char *)"zzx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 310
-	{(char *)"zzxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2358
-	{(char *)"zzxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2870
-	{(char *)"zzxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3382
-	{(char *)"zzxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3894
-	{(char *)"zzy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 374
-	{(char *)"zzyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2422
-	{(char *)"zzyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2934
-	{(char *)"zzyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3446
-	{(char *)"zzyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3958
-	{(char *)"zzz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 438
-	{(char *)"zzzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2486
-	{(char *)"zzzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2998
-	{(char *)"zzzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3510
-	{(char *)"zzzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4022
-	{(char *)"zzw",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 502
-	{(char *)"zzwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2550
-	{(char *)"zzwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3062
-	{(char *)"zzwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3574
-	{(char *)"zzww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4086
-	{(char *)"zw",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 62
-	{(char *)"zwx",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 318
-	{(char *)"zwxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2366
-	{(char *)"zwxy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2878
-	{(char *)"zwxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3390
-	{(char *)"zwxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3902
-	{(char *)"zwy",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 382
-	{(char *)"zwyx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2430
-	{(char *)"zwyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2942
-	{(char *)"zwyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3454
-	{(char *)"zwyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3966
-	{(char *)"zwz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 446
-	{(char *)"zwzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2494
-	{(char *)"zwzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3006
-	{(char *)"zwzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3518
-	{(char *)"zwzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4030
-	{(char *)"zww",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 510
-	{(char *)"zwwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2558
-	{(char *)"zwwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3070
-	{(char *)"zwwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3582
-	{(char *)"zwww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4094
-	{(char *)"wx",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 39
-	{(char *)"wxx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 295
-	{(char *)"wxxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2343
-	{(char *)"wxxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2855
-	{(char *)"wxxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3367
-	{(char *)"wxxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3879
-	{(char *)"wxy",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 359
-	{(char *)"wxyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2407
-	{(char *)"wxyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2919
-	{(char *)"wxyz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3431
-	{(char *)"wxyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3943
-	{(char *)"wxz",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 423
-	{(char *)"wxzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2471
-	{(char *)"wxzy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2983
-	{(char *)"wxzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3495
-	{(char *)"wxzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4007
-	{(char *)"wxw",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 487
-	{(char *)"wxwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2535
-	{(char *)"wxwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3047
-	{(char *)"wxwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3559
-	{(char *)"wxww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4071
-	{(char *)"wy",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 47
-	{(char *)"wyx",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 303
-	{(char *)"wyxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2351
-	{(char *)"wyxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2863
-	{(char *)"wyxz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3375
-	{(char *)"wyxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3887
-	{(char *)"wyy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 367
-	{(char *)"wyyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2415
-	{(char *)"wyyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2927
-	{(char *)"wyyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3439
-	{(char *)"wyyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3951
-	{(char *)"wyz",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 431
-	{(char *)"wyzx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2479
-	{(char *)"wyzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2991
-	{(char *)"wyzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3503
-	{(char *)"wyzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4015
-	{(char *)"wyw",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 495
-	{(char *)"wywx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2543
-	{(char *)"wywy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3055
-	{(char *)"wywz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3567
-	{(char *)"wyww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4079
-	{(char *)"wz",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 55
-	{(char *)"wzx",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 311
-	{(char *)"wzxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2359
-	{(char *)"wzxy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2871
-	{(char *)"wzxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3383
-	{(char *)"wzxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3895
-	{(char *)"wzy",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 375
-	{(char *)"wzyx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2423
-	{(char *)"wzyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2935
-	{(char *)"wzyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3447
-	{(char *)"wzyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3959
-	{(char *)"wzz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 439
-	{(char *)"wzzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2487
-	{(char *)"wzzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2999
-	{(char *)"wzzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3511
-	{(char *)"wzzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4023
-	{(char *)"wzw",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 503
-	{(char *)"wzwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2551
-	{(char *)"wzwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3063
-	{(char *)"wzwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3575
-	{(char *)"wzww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4087
-	{(char *)"ww",   (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 63
-	{(char *)"wwx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 319
-	{(char *)"wwxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2367
-	{(char *)"wwxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2879
-	{(char *)"wwxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3391
-	{(char *)"wwxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3903
-	{(char *)"wwy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 383
-	{(char *)"wwyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2431
-	{(char *)"wwyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2943
-	{(char *)"wwyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3455
-	{(char *)"wwyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3967
-	{(char *)"wwz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 447
-	{(char *)"wwzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2495
-	{(char *)"wwzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3007
-	{(char *)"wwzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3519
-	{(char *)"wwzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4031
-	{(char *)"www",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2))))}, // 511
-	{(char *)"wwwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((0|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 2559
-	{(char *)"wwwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((1|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3071
-	{(char *)"wwwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((2|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 3583
-	{(char *)"wwww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3|SWIZZLE_VALID_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((3|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  )}, // 4095
+	{(char *)"xx",   (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS)))}, // 36
+	{(char *)"xxx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 292
+	{(char *)"xxxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2340
+	{(char *)"xxxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2852
+	{(char *)"xxxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3364
+	{(char *)"xxxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3876
+	{(char *)"xxy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 356
+	{(char *)"xxyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2404
+	{(char *)"xxyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2916
+	{(char *)"xxyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3428
+	{(char *)"xxyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3940
+	{(char *)"xxz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 420
+	{(char *)"xxzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2468
+	{(char *)"xxzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2980
+	{(char *)"xxzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3492
+	{(char *)"xxzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4004
+	{(char *)"xxw",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 484
+	{(char *)"xxwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2532
+	{(char *)"xxwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3044
+	{(char *)"xxwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3556
+	{(char *)"xxww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4068
+	{(char *)"xy",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS)))}, // 44
+	{(char *)"xyx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 300
+	{(char *)"xyxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2348
+	{(char *)"xyxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2860
+	{(char *)"xyxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3372
+	{(char *)"xyxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3884
+	{(char *)"xyy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 364
+	{(char *)"xyyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2412
+	{(char *)"xyyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2924
+	{(char *)"xyyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3436
+	{(char *)"xyyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3948
+	{(char *)"xyz",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 428
+	{(char *)"xyzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2476
+	{(char *)"xyzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2988
+	{(char *)"xyzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3500
+	{(char *)"xyzw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4012
+	{(char *)"xyw",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 492
+	{(char *)"xywx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2540
+	{(char *)"xywy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3052
+	{(char *)"xywz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3564
+	{(char *)"xyww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4076
+	{(char *)"xz",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS)))}, // 52
+	{(char *)"xzx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 308
+	{(char *)"xzxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2356
+	{(char *)"xzxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2868
+	{(char *)"xzxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3380
+	{(char *)"xzxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3892
+	{(char *)"xzy",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 372
+	{(char *)"xzyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2420
+	{(char *)"xzyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2932
+	{(char *)"xzyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3444
+	{(char *)"xzyw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3956
+	{(char *)"xzz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 436
+	{(char *)"xzzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2484
+	{(char *)"xzzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2996
+	{(char *)"xzzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3508
+	{(char *)"xzzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4020
+	{(char *)"xzw",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 500
+	{(char *)"xzwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2548
+	{(char *)"xzwy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3060
+	{(char *)"xzwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3572
+	{(char *)"xzww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4084
+	{(char *)"xw",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS)))}, // 60
+	{(char *)"xwx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 316
+	{(char *)"xwxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2364
+	{(char *)"xwxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2876
+	{(char *)"xwxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3388
+	{(char *)"xwxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3900
+	{(char *)"xwy",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 380
+	{(char *)"xwyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2428
+	{(char *)"xwyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2940
+	{(char *)"xwyz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3452
+	{(char *)"xwyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3964
+	{(char *)"xwz",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 444
+	{(char *)"xwzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2492
+	{(char *)"xwzy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3004
+	{(char *)"xwzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3516
+	{(char *)"xwzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4028
+	{(char *)"xww",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 508
+	{(char *)"xwwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2556
+	{(char *)"xwwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3068
+	{(char *)"xwwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3580
+	{(char *)"xwww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((0 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4092
+	{(char *)"yx",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS)))}, // 37
+	{(char *)"yxx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 293
+	{(char *)"yxxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2341
+	{(char *)"yxxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2853
+	{(char *)"yxxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3365
+	{(char *)"yxxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3877
+	{(char *)"yxy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 357
+	{(char *)"yxyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2405
+	{(char *)"yxyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2917
+	{(char *)"yxyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3429
+	{(char *)"yxyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3941
+	{(char *)"yxz",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 421
+	{(char *)"yxzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2469
+	{(char *)"yxzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2981
+	{(char *)"yxzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3493
+	{(char *)"yxzw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4005
+	{(char *)"yxw",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 485
+	{(char *)"yxwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2533
+	{(char *)"yxwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3045
+	{(char *)"yxwz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3557
+	{(char *)"yxww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4069
+	{(char *)"yy",   (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS)))}, // 45
+	{(char *)"yyx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 301
+	{(char *)"yyxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2349
+	{(char *)"yyxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2861
+	{(char *)"yyxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3373
+	{(char *)"yyxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3885
+	{(char *)"yyy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 365
+	{(char *)"yyyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2413
+	{(char *)"yyyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2925
+	{(char *)"yyyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3437
+	{(char *)"yyyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3949
+	{(char *)"yyz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 429
+	{(char *)"yyzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2477
+	{(char *)"yyzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2989
+	{(char *)"yyzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3501
+	{(char *)"yyzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4013
+	{(char *)"yyw",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 493
+	{(char *)"yywx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2541
+	{(char *)"yywy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3053
+	{(char *)"yywz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3565
+	{(char *)"yyww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4077
+	{(char *)"yz",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS)))}, // 53
+	{(char *)"yzx",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 309
+	{(char *)"yzxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2357
+	{(char *)"yzxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2869
+	{(char *)"yzxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3381
+	{(char *)"yzxw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3893
+	{(char *)"yzy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 373
+	{(char *)"yzyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2421
+	{(char *)"yzyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2933
+	{(char *)"yzyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3445
+	{(char *)"yzyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3957
+	{(char *)"yzz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 437
+	{(char *)"yzzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2485
+	{(char *)"yzzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2997
+	{(char *)"yzzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3509
+	{(char *)"yzzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4021
+	{(char *)"yzw",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 501
+	{(char *)"yzwx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2549
+	{(char *)"yzwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3061
+	{(char *)"yzwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3573
+	{(char *)"yzww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4085
+	{(char *)"yw",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS)))}, // 61
+	{(char *)"ywx",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 317
+	{(char *)"ywxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2365
+	{(char *)"ywxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2877
+	{(char *)"ywxz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3389
+	{(char *)"ywxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3901
+	{(char *)"ywy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 381
+	{(char *)"ywyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2429
+	{(char *)"ywyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2941
+	{(char *)"ywyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3453
+	{(char *)"ywyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3965
+	{(char *)"ywz",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 445
+	{(char *)"ywzx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2493
+	{(char *)"ywzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3005
+	{(char *)"ywzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3517
+	{(char *)"ywzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4029
+	{(char *)"yww",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 509
+	{(char *)"ywwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2557
+	{(char *)"ywwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3069
+	{(char *)"ywwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3581
+	{(char *)"ywww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((1 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4093
+	{(char *)"zx",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS)))}, // 38
+	{(char *)"zxx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 294
+	{(char *)"zxxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2342
+	{(char *)"zxxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2854
+	{(char *)"zxxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3366
+	{(char *)"zxxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3878
+	{(char *)"zxy",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 358
+	{(char *)"zxyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2406
+	{(char *)"zxyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2918
+	{(char *)"zxyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3430
+	{(char *)"zxyw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3942
+	{(char *)"zxz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 422
+	{(char *)"zxzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2470
+	{(char *)"zxzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2982
+	{(char *)"zxzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3494
+	{(char *)"zxzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4006
+	{(char *)"zxw",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 486
+	{(char *)"zxwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2534
+	{(char *)"zxwy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3046
+	{(char *)"zxwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3558
+	{(char *)"zxww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4070
+	{(char *)"zy",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS)))}, // 46
+	{(char *)"zyx",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 302
+	{(char *)"zyxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2350
+	{(char *)"zyxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2862
+	{(char *)"zyxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3374
+	{(char *)"zyxw", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3886
+	{(char *)"zyy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 366
+	{(char *)"zyyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2414
+	{(char *)"zyyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2926
+	{(char *)"zyyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3438
+	{(char *)"zyyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3950
+	{(char *)"zyz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 430
+	{(char *)"zyzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2478
+	{(char *)"zyzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2990
+	{(char *)"zyzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3502
+	{(char *)"zyzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4014
+	{(char *)"zyw",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 494
+	{(char *)"zywx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2542
+	{(char *)"zywy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3054
+	{(char *)"zywz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3566
+	{(char *)"zyww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4078
+	{(char *)"zz",   (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS)))}, // 54
+	{(char *)"zzx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 310
+	{(char *)"zzxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2358
+	{(char *)"zzxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2870
+	{(char *)"zzxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3382
+	{(char *)"zzxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3894
+	{(char *)"zzy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 374
+	{(char *)"zzyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2422
+	{(char *)"zzyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2934
+	{(char *)"zzyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3446
+	{(char *)"zzyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3958
+	{(char *)"zzz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 438
+	{(char *)"zzzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2486
+	{(char *)"zzzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2998
+	{(char *)"zzzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3510
+	{(char *)"zzzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4022
+	{(char *)"zzw",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 502
+	{(char *)"zzwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2550
+	{(char *)"zzwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3062
+	{(char *)"zzwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3574
+	{(char *)"zzww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4086
+	{(char *)"zw",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS)))}, // 62
+	{(char *)"zwx",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 318
+	{(char *)"zwxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2366
+	{(char *)"zwxy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2878
+	{(char *)"zwxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3390
+	{(char *)"zwxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3902
+	{(char *)"zwy",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 382
+	{(char *)"zwyx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2430
+	{(char *)"zwyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2942
+	{(char *)"zwyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3454
+	{(char *)"zwyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3966
+	{(char *)"zwz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 446
+	{(char *)"zwzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2494
+	{(char *)"zwzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3006
+	{(char *)"zwzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3518
+	{(char *)"zwzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4030
+	{(char *)"zww",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 510
+	{(char *)"zwwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2558
+	{(char *)"zwwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3070
+	{(char *)"zwwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3582
+	{(char *)"zwww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((2 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4094
+	{(char *)"wx",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS)))}, // 39
+	{(char *)"wxx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 295
+	{(char *)"wxxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2343
+	{(char *)"wxxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2855
+	{(char *)"wxxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3367
+	{(char *)"wxxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3879
+	{(char *)"wxy",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 359
+	{(char *)"wxyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2407
+	{(char *)"wxyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2919
+	{(char *)"wxyz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3431
+	{(char *)"wxyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3943
+	{(char *)"wxz",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 423
+	{(char *)"wxzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2471
+	{(char *)"wxzy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2983
+	{(char *)"wxzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3495
+	{(char *)"wxzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4007
+	{(char *)"wxw",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 487
+	{(char *)"wxwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2535
+	{(char *)"wxwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3047
+	{(char *)"wxwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3559
+	{(char *)"wxww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4071
+	{(char *)"wy",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS)))}, // 47
+	{(char *)"wyx",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 303
+	{(char *)"wyxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2351
+	{(char *)"wyxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2863
+	{(char *)"wyxz", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3375
+	{(char *)"wyxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3887
+	{(char *)"wyy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 367
+	{(char *)"wyyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2415
+	{(char *)"wyyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2927
+	{(char *)"wyyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3439
+	{(char *)"wyyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3951
+	{(char *)"wyz",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 431
+	{(char *)"wyzx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2479
+	{(char *)"wyzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2991
+	{(char *)"wyzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3503
+	{(char *)"wyzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4015
+	{(char *)"wyw",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 495
+	{(char *)"wywx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2543
+	{(char *)"wywy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3055
+	{(char *)"wywz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3567
+	{(char *)"wyww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4079
+	{(char *)"wz",   (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS)))}, // 55
+	{(char *)"wzx",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 311
+	{(char *)"wzxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2359
+	{(char *)"wzxy", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2871
+	{(char *)"wzxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3383
+	{(char *)"wzxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3895
+	{(char *)"wzy",  (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 375
+	{(char *)"wzyx", (getter)Vector_swizzle_get, (setter)Vector_swizzle_set, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2423
+	{(char *)"wzyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2935
+	{(char *)"wzyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3447
+	{(char *)"wzyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3959
+	{(char *)"wzz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 439
+	{(char *)"wzzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2487
+	{(char *)"wzzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2999
+	{(char *)"wzzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3511
+	{(char *)"wzzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4023
+	{(char *)"wzw",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 503
+	{(char *)"wzwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2551
+	{(char *)"wzwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3063
+	{(char *)"wzwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3575
+	{(char *)"wzww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4087
+	{(char *)"ww",   (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS)))}, // 63
+	{(char *)"wwx",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 319
+	{(char *)"wwxx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2367
+	{(char *)"wwxy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2879
+	{(char *)"wwxz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3391
+	{(char *)"wwxw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3903
+	{(char *)"wwy",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 383
+	{(char *)"wwyx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2431
+	{(char *)"wwyy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2943
+	{(char *)"wwyz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3455
+	{(char *)"wwyw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3967
+	{(char *)"wwz",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 447
+	{(char *)"wwzx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2495
+	{(char *)"wwzy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3007
+	{(char *)"wwzz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3519
+	{(char *)"wwzw", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4031
+	{(char *)"www",  (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2))))}, // 511
+	{(char *)"wwwx", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((0 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 2559
+	{(char *)"wwwy", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((1 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3071
+	{(char *)"wwwz", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((2 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 3583
+	{(char *)"wwww", (getter)Vector_swizzle_get, (setter)NULL, NULL, SET_INT_IN_POINTER(((3 | SWIZZLE_VALID_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << SWIZZLE_BITS_PER_AXIS) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((3 | SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 3)))  )}, // 4095
 	{NULL, NULL, NULL, NULL, NULL}  /* Sentinel */
 };
 
@@ -2597,11 +2656,11 @@ while len(axises) >= 2:
 			if len(axises)>2:
 				for axis_2 in axises:
 					axis_2_pos = axis_pos[axis_2]
-					axis_dict[axis_0 + axis_1 + axis_2] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)))' % (axis_0_pos, axis_1_pos, axis_2_pos)
+					axis_dict[axis_0 + axis_1 + axis_2] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS * 2)))' % (axis_0_pos, axis_1_pos, axis_2_pos)
 					if len(axises)>3:
 						for axis_3 in axises:
 							axis_3_pos = axis_pos[axis_3]
-							axis_dict[axis_0 + axis_1 + axis_2 + axis_3] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*2)) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS*3)))  ' % (axis_0_pos, axis_1_pos, axis_2_pos, axis_3_pos)
+							axis_dict[axis_0 + axis_1 + axis_2 + axis_3] = '((%s|SWIZZLE_VALID_AXIS) | ((%s|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS) | ((%s|SWIZZLE_VALID_AXIS) << (SWIZZLE_BITS_PER_AXIS * 2)) | ((%s|SWIZZLE_VALID_AXIS)<<(SWIZZLE_BITS_PER_AXIS * 3)))  ' % (axis_0_pos, axis_1_pos, axis_2_pos, axis_3_pos)
 
 	axises = axises[:-1]
 
@@ -2613,7 +2672,7 @@ unique = set()
 for key, val in items:
 	num = eval(val)
 	set_str = 'Vector_setSwizzle' if (len(set(key)) == len(key)) else 'NULL'
-	print '\t{"%s", %s(getter)Vector_getSwizzle, (setter)%s, NULL, SET_INT_IN_POINTER(%s)}, // %s' % (key, (' '*(4-len(key))), set_str, axis_dict[key], num)
+	print '\t{"%s", %s(getter)Vector_getSwizzle, (setter)%s, NULL, SET_INT_IN_POINTER(%s)}, // %s' % (key, (' '*(4 - len(key))), set_str, axis_dict[key], num)
 	unique.add(num)
 
 if len(unique) != len(items):
@@ -2707,6 +2766,7 @@ static struct PyMethodDef Vector_methods[] = {
 	{"cross", (PyCFunction) Vector_cross, METH_O, Vector_cross_doc},
 	{"dot", (PyCFunction) Vector_dot, METH_O, Vector_dot_doc},
 	{"angle", (PyCFunction) Vector_angle, METH_VARARGS, Vector_angle_doc},
+	{"angle_signed", (PyCFunction) Vector_angle_signed, METH_VARARGS, Vector_angle_signed_doc},
 	{"rotation_difference", (PyCFunction) Vector_rotation_difference, METH_O, Vector_rotation_difference_doc},
 	{"project", (PyCFunction) Vector_project, METH_O, Vector_project_doc},
 	{"lerp", (PyCFunction) Vector_lerp, METH_VARARGS, Vector_lerp_doc},
@@ -2714,15 +2774,16 @@ static struct PyMethodDef Vector_methods[] = {
 
 	{"copy", (PyCFunction) Vector_copy, METH_NOARGS, Vector_copy_doc},
 	{"__copy__", (PyCFunction) Vector_copy, METH_NOARGS, NULL},
+	{"__deepcopy__", (PyCFunction) Vector_deepcopy, METH_VARARGS, NULL},
 	{NULL, NULL, 0, NULL}
 };
 
 
 /* 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
-*/
+ * 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
+ */
 
 PyDoc_STRVAR(vector_doc,
 "This object gives access to Vectors in Blender."
@@ -2730,13 +2791,13 @@ PyDoc_STRVAR(vector_doc,
 PyTypeObject vector_Type = {
 	PyVarObject_HEAD_INIT(NULL, 0)
 	/*  For printing, in format "<module>.<name>" */
-	"mathutils.Vector",             /* char *tp_name; */
+	"Vector",             /* char *tp_name; */
 	sizeof(VectorObject),         /* int tp_basicsize; */
 	0,                          /* tp_itemsize;  For allocation */
 
 	/* Methods to implement standard operations */
 
-	(destructor) BaseMathObject_dealloc,/* destructor tp_dealloc; */
+	(destructor) BaseMathObject_dealloc, /* destructor tp_dealloc; */
 	NULL,                       /* printfunc tp_print; */
 	NULL,                       /* getattrfunc tp_getattr; */
 	NULL,                       /* setattrfunc tp_setattr; */
@@ -2760,30 +2821,30 @@ PyTypeObject vector_Type = {
 	/* Functions to access object as input/output buffer */
 	NULL,                       /* PyBufferProcs *tp_as_buffer; */
 
-  /*** Flags to define presence of optional/expanded features ***/
+	/*** Flags to define presence of optional/expanded features ***/
 	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC,
 	vector_doc,                       /*  char *tp_doc;  Documentation string */
-  /*** Assigned meaning in release 2.0 ***/
+	/*** 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 ***/
+	/***  Assigned meaning in release 2.1 ***/
+	/*** rich comparisons ***/
 	(richcmpfunc)Vector_richcmpr,                       /* richcmpfunc tp_richcompare; */
 
-  /***  weak reference enabler ***/
+	/***  weak reference enabler ***/
 	0,                          /* long tp_weaklistoffset; */
 
-  /*** Added in release 2.2 ***/
+	/*** Added in release 2.2 ***/
 	/*   Iterators */
 	NULL,                       /* getiterfunc tp_iter; */
 	NULL,                       /* iternextfunc tp_iternext; */
 
-  /*** Attribute descriptor and subclassing stuff ***/
+	/*** Attribute descriptor and subclassing stuff ***/
 	Vector_methods,           /* struct PyMethodDef *tp_methods; */
 	NULL,                       /* struct PyMemberDef *tp_members; */
 	Vector_getseters,           /* struct PyGetSetDef *tp_getset; */
@@ -2809,11 +2870,11 @@ PyTypeObject vector_Type = {
 };
 
 /*------------------------Vector_CreatePyObject (internal)-------------
-  creates a new vector 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())*/
+ * creates a new vector 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 *Vector_CreatePyObject(float *vec, const int size, const int type, PyTypeObject *base_type)
 {
 	VectorObject *self;
@@ -2858,15 +2919,15 @@ PyObject *Vector_CreatePyObject(float *vec, const int size, const int type, PyTy
 	return (PyObject *) self;
 }
 
-PyObject *Vector_CreatePyObject_cb(PyObject *cb_user, int size, int cb_type, int cb_subtype)
+PyObject *Vector_CreatePyObject_cb(PyObject *cb_user, int size, unsigned char cb_type, unsigned char cb_subtype)
 {
 	float dummy[4] = {0.0, 0.0, 0.0, 0.0}; /* dummy init vector, callbacks will be used on access */
 	VectorObject *self = (VectorObject *)Vector_CreatePyObject(dummy, size, Py_NEW, NULL);
 	if (self) {
 		Py_INCREF(cb_user);
-		self->cb_user =			cb_user;
-		self->cb_type =			(unsigned char)cb_type;
-		self->cb_subtype =		(unsigned char)cb_subtype;
+		self->cb_user         = cb_user;
+		self->cb_type         = cb_type;
+		self->cb_subtype      = cb_subtype;
 		PyObject_GC_Track(self);
 	}
 
diff --git a/source/blender/python/mathutils/mathutils_Vector.h b/source/blender/python/mathutils/mathutils_Vector.h
index 4e10e79..04fd0ad 100644
--- a/source/blender/python/mathutils/mathutils_Vector.h
+++ b/source/blender/python/mathutils/mathutils_Vector.h
@@ -32,8 +32,8 @@
  */
 
 
-#ifndef MATHUTILS_VECTOR_H
-#define MATHUTILS_VECTOR_H
+#ifndef __MATHUTILS_VECTOR_H__
+#define __MATHUTILS_VECTOR_H__
 
 extern PyTypeObject vector_Type;
 #define VectorObject_Check(_v) PyObject_TypeCheck((_v), &vector_Type)
@@ -46,7 +46,8 @@ typedef struct {
 
 /*prototypes*/
 PyObject *Vector_CreatePyObject(float *vec, const int size, const int type, PyTypeObject *base_type);
-PyObject *Vector_CreatePyObject_cb(PyObject *user, int size, int callback_type, int subtype);
+PyObject *Vector_CreatePyObject_cb(PyObject *user, int size,
+                                   unsigned char cb_type, unsigned char subtype);
 PyObject *Vector_CreatePyObject_alloc(float *vec, const int size, PyTypeObject *base_type);
 
-#endif				/* MATHUTILS_VECTOR_H */
+#endif				/* __MATHUTILS_VECTOR_H__ */
diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c
index b4f3f4e..b94c2e2 100644
--- a/source/blender/python/mathutils/mathutils_geometry.c
+++ b/source/blender/python/mathutils/mathutils_geometry.c
@@ -99,11 +99,11 @@ static PyObject *M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject *
 		return NULL;
 	}
 
-	if ( BaseMath_ReadCallback(vec1) == -1 ||
-	     BaseMath_ReadCallback(vec2) == -1 ||
-	     BaseMath_ReadCallback(vec3) == -1 ||
-	     BaseMath_ReadCallback(ray)  == -1 ||
-	     BaseMath_ReadCallback(ray_off) == -1)
+	if (BaseMath_ReadCallback(vec1) == -1 ||
+	    BaseMath_ReadCallback(vec2) == -1 ||
+	    BaseMath_ReadCallback(vec3) == -1 ||
+	    BaseMath_ReadCallback(ray)  == -1 ||
+	    BaseMath_ReadCallback(ray_off) == -1)
 	{
 		return NULL;
 	}
@@ -199,10 +199,10 @@ static PyObject *M_Geometry_intersect_line_line(PyObject *UNUSED(self), PyObject
 		return NULL;
 	}
 
-	if ( BaseMath_ReadCallback(vec1) == -1 ||
-	     BaseMath_ReadCallback(vec2) == -1 ||
-	     BaseMath_ReadCallback(vec3) == -1 ||
-	     BaseMath_ReadCallback(vec4) == -1)
+	if (BaseMath_ReadCallback(vec1) == -1 ||
+	    BaseMath_ReadCallback(vec2) == -1 ||
+	    BaseMath_ReadCallback(vec3) == -1 ||
+	    BaseMath_ReadCallback(vec4) == -1)
 	{
 		return NULL;
 	}
@@ -298,9 +298,9 @@ static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject *args)
 			return NULL;
 		}
 
-		if ( BaseMath_ReadCallback(vec1) == -1 ||
-		     BaseMath_ReadCallback(vec2) == -1 ||
-		     BaseMath_ReadCallback(vec3) == -1)
+		if (BaseMath_ReadCallback(vec1) == -1 ||
+		    BaseMath_ReadCallback(vec2) == -1 ||
+		    BaseMath_ReadCallback(vec3) == -1)
 		{
 			return NULL;
 		}
@@ -327,10 +327,10 @@ static PyObject *M_Geometry_normal(PyObject *UNUSED(self), PyObject *args)
 			return NULL;
 		}
 
-		if ( BaseMath_ReadCallback(vec1) == -1 ||
-		     BaseMath_ReadCallback(vec2) == -1 ||
-		     BaseMath_ReadCallback(vec3) == -1 ||
-		     BaseMath_ReadCallback(vec4) == -1)
+		if (BaseMath_ReadCallback(vec1) == -1 ||
+		    BaseMath_ReadCallback(vec2) == -1 ||
+		    BaseMath_ReadCallback(vec3) == -1 ||
+		    BaseMath_ReadCallback(vec4) == -1)
 		{
 			return NULL;
 		}
@@ -374,9 +374,9 @@ static PyObject *M_Geometry_area_tri(PyObject *UNUSED(self), PyObject *args)
 		return NULL;
 	}
 
-	if ( BaseMath_ReadCallback(vec1) == -1 ||
-	     BaseMath_ReadCallback(vec2) == -1 ||
-	     BaseMath_ReadCallback(vec3) == -1)
+	if (BaseMath_ReadCallback(vec1) == -1 ||
+	    BaseMath_ReadCallback(vec2) == -1 ||
+	    BaseMath_ReadCallback(vec3) == -1)
 	{
 		return NULL;
 	}
@@ -424,10 +424,10 @@ static PyObject *M_Geometry_intersect_line_line_2d(PyObject *UNUSED(self), PyObj
 		return NULL;
 	}
 	
-	if ( BaseMath_ReadCallback(line_a1) == -1 ||
-	     BaseMath_ReadCallback(line_a2) == -1 ||
-	     BaseMath_ReadCallback(line_b1) == -1 ||
-	     BaseMath_ReadCallback(line_b2) == -1)
+	if (BaseMath_ReadCallback(line_a1) == -1 ||
+	    BaseMath_ReadCallback(line_a2) == -1 ||
+	    BaseMath_ReadCallback(line_b1) == -1 ||
+	    BaseMath_ReadCallback(line_b2) == -1)
 	{
 		return NULL;
 	}
@@ -444,7 +444,8 @@ static PyObject *M_Geometry_intersect_line_line_2d(PyObject *UNUSED(self), PyObj
 PyDoc_STRVAR(M_Geometry_intersect_line_plane_doc,
 ".. function:: intersect_line_plane(line_a, line_b, plane_co, plane_no, no_flip=False)\n"
 "\n"
-"   Takes 2 lines (as 4 vectors) and returns a vector for their point of intersection or None.\n"
+"   Calculate the intersection between a line (as 2 vectors) and a plane.\n"
+"   Returns a vector for the intersection or None.\n"
 "\n"
 "   :arg line_a: First point of the first line\n"
 "   :type line_a: :class:`mathutils.Vector`\n"
@@ -474,10 +475,10 @@ static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObjec
 		return NULL;
 	}
 
-	if ( BaseMath_ReadCallback(line_a) == -1 ||
-	     BaseMath_ReadCallback(line_b) == -1 ||
-	     BaseMath_ReadCallback(plane_co) == -1 ||
-	     BaseMath_ReadCallback(plane_no) == -1)
+	if (BaseMath_ReadCallback(line_a) == -1 ||
+	    BaseMath_ReadCallback(line_b) == -1 ||
+	    BaseMath_ReadCallback(plane_co) == -1 ||
+	    BaseMath_ReadCallback(plane_no) == -1)
 	{
 		return NULL;
 	}
@@ -530,10 +531,10 @@ static PyObject *M_Geometry_intersect_plane_plane(PyObject *UNUSED(self), PyObje
 		return NULL;
 	}
 
-	if ( BaseMath_ReadCallback(plane_a_co) == -1 ||
-	     BaseMath_ReadCallback(plane_a_no) == -1 ||
-	     BaseMath_ReadCallback(plane_b_co) == -1 ||
-	     BaseMath_ReadCallback(plane_b_no) == -1)
+	if (BaseMath_ReadCallback(plane_a_co) == -1 ||
+	    BaseMath_ReadCallback(plane_a_no) == -1 ||
+	    BaseMath_ReadCallback(plane_b_co) == -1 ||
+	    BaseMath_ReadCallback(plane_b_no) == -1)
 	{
 		return NULL;
 	}
@@ -592,9 +593,9 @@ static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObje
 		return NULL;
 	}
 
-	if ( BaseMath_ReadCallback(line_a) == -1 ||
-	     BaseMath_ReadCallback(line_b) == -1 ||
-	     BaseMath_ReadCallback(sphere_co) == -1)
+	if (BaseMath_ReadCallback(line_a) == -1 ||
+	    BaseMath_ReadCallback(line_b) == -1 ||
+	    BaseMath_ReadCallback(sphere_co) == -1)
 	{
 		return NULL;
 	}
@@ -613,24 +614,24 @@ static PyObject *M_Geometry_intersect_line_sphere(PyObject *UNUSED(self), PyObje
 		PyObject *ret = PyTuple_New(2);
 
 		switch (isect_line_sphere_v3(line_a->vec, line_b->vec, sphere_co->vec, sphere_radius, isect_a, isect_b)) {
-		case 1:
-			if (!(!clip || (((lambda = line_point_factor_v3(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE;
-			use_b = FALSE;
-			break;
-		case 2:
-			if (!(!clip || (((lambda = line_point_factor_v3(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE;
-			if (!(!clip || (((lambda = line_point_factor_v3(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b = FALSE;
-			break;
-		default:
-			use_a = FALSE;
-			use_b = FALSE;
+			case 1:
+				if (!(!clip || (((lambda = line_point_factor_v3(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE;
+				use_b = FALSE;
+				break;
+			case 2:
+				if (!(!clip || (((lambda = line_point_factor_v3(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE;
+				if (!(!clip || (((lambda = line_point_factor_v3(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b = FALSE;
+				break;
+			default:
+				use_a = FALSE;
+				use_b = FALSE;
 		}
 
 		if (use_a) { PyTuple_SET_ITEM(ret, 0,  Vector_CreatePyObject(isect_a, 3, Py_NEW, NULL)); }
-		else      { PyTuple_SET_ITEM(ret, 0,  Py_None); Py_INCREF(Py_None); }
+		else       { PyTuple_SET_ITEM(ret, 0,  Py_None); Py_INCREF(Py_None); }
 
 		if (use_b) { PyTuple_SET_ITEM(ret, 1,  Vector_CreatePyObject(isect_b, 3, Py_NEW, NULL)); }
-		else      { PyTuple_SET_ITEM(ret, 1,  Py_None); Py_INCREF(Py_None); }
+		else       { PyTuple_SET_ITEM(ret, 1,  Py_None); Py_INCREF(Py_None); }
 
 		return ret;
 	}
@@ -672,9 +673,9 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO
 		return NULL;
 	}
 
-	if ( BaseMath_ReadCallback(line_a) == -1 ||
-	     BaseMath_ReadCallback(line_b) == -1 ||
-	     BaseMath_ReadCallback(sphere_co) == -1)
+	if (BaseMath_ReadCallback(line_a) == -1 ||
+	    BaseMath_ReadCallback(line_b) == -1 ||
+	    BaseMath_ReadCallback(sphere_co) == -1)
 	{
 		return NULL;
 	}
@@ -686,24 +687,24 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO
 		PyObject *ret = PyTuple_New(2);
 
 		switch (isect_line_sphere_v2(line_a->vec, line_b->vec, sphere_co->vec, sphere_radius, isect_a, isect_b)) {
-		case 1:
-			if (!(!clip || (((lambda = line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE;
-			use_b = FALSE;
-			break;
-		case 2:
-			if (!(!clip || (((lambda = line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE;
-			if (!(!clip || (((lambda = line_point_factor_v2(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b = FALSE;
-			break;
-		default:
-			use_a = FALSE;
-			use_b = FALSE;
+			case 1:
+				if (!(!clip || (((lambda = line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE;
+				use_b = FALSE;
+				break;
+			case 2:
+				if (!(!clip || (((lambda = line_point_factor_v2(isect_a, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_a = FALSE;
+				if (!(!clip || (((lambda = line_point_factor_v2(isect_b, line_a->vec, line_b->vec)) >= 0.0f) && (lambda <= 1.0f)))) use_b = FALSE;
+				break;
+			default:
+				use_a = FALSE;
+				use_b = FALSE;
 		}
 
 		if (use_a) { PyTuple_SET_ITEM(ret, 0,  Vector_CreatePyObject(isect_a, 2, Py_NEW, NULL)); }
-		else      { PyTuple_SET_ITEM(ret, 0,  Py_None); Py_INCREF(Py_None); }
+		else       { PyTuple_SET_ITEM(ret, 0,  Py_None); Py_INCREF(Py_None); }
 
 		if (use_b) { PyTuple_SET_ITEM(ret, 1,  Vector_CreatePyObject(isect_b, 2, Py_NEW, NULL)); }
-		else      { PyTuple_SET_ITEM(ret, 1,  Py_None); Py_INCREF(Py_None); }
+		else       { PyTuple_SET_ITEM(ret, 1,  Py_None); Py_INCREF(Py_None); }
 
 		return ret;
 	}
@@ -737,21 +738,21 @@ static PyObject *M_Geometry_intersect_point_line(PyObject *UNUSED(self), PyObjec
 		return NULL;
 	}
 
-	if ( BaseMath_ReadCallback(pt) == -1 ||
-	     BaseMath_ReadCallback(line_1) == -1 ||
-	     BaseMath_ReadCallback(line_2) == -1)
+	if (BaseMath_ReadCallback(pt) == -1 ||
+	    BaseMath_ReadCallback(line_1) == -1 ||
+	    BaseMath_ReadCallback(line_2) == -1)
 	{
 		return NULL;
 	}
 
 	/* accept 2d verts */
-	if (pt->size == 3) {     copy_v3_v3(pt_in, pt->vec);}
+	if (pt->size == 3) {     copy_v3_v3(pt_in, pt->vec); }
 	else { pt_in[2] = 0.0f;  copy_v2_v2(pt_in, pt->vec); }
 	
-	if (line_1->size == 3) { copy_v3_v3(l1, line_1->vec);}
+	if (line_1->size == 3) { copy_v3_v3(l1, line_1->vec); }
 	else { l1[2] = 0.0f;     copy_v2_v2(l1, line_1->vec); }
 	
-	if (line_2->size == 3) { copy_v3_v3(l2, line_2->vec);}
+	if (line_2->size == 3) { copy_v3_v3(l2, line_2->vec); }
 	else { l2[2] = 0.0f;     copy_v2_v2(l2, line_2->vec); }
 	
 	/* do the calculation */
@@ -791,10 +792,10 @@ static PyObject *M_Geometry_intersect_point_tri_2d(PyObject *UNUSED(self), PyObj
 		return NULL;
 	}
 	
-	if ( BaseMath_ReadCallback(pt_vec) == -1 ||
-	     BaseMath_ReadCallback(tri_p1) == -1 ||
-	     BaseMath_ReadCallback(tri_p2) == -1 ||
-	     BaseMath_ReadCallback(tri_p3) == -1)
+	if (BaseMath_ReadCallback(pt_vec) == -1 ||
+	    BaseMath_ReadCallback(tri_p1) == -1 ||
+	    BaseMath_ReadCallback(tri_p2) == -1 ||
+	    BaseMath_ReadCallback(tri_p3) == -1)
 	{
 		return NULL;
 	}
@@ -834,11 +835,11 @@ static PyObject *M_Geometry_intersect_point_quad_2d(PyObject *UNUSED(self), PyOb
 		return NULL;
 	}
 
-	if ( BaseMath_ReadCallback(pt_vec)  == -1 ||
-	     BaseMath_ReadCallback(quad_p1) == -1 ||
-	     BaseMath_ReadCallback(quad_p2) == -1 ||
-	     BaseMath_ReadCallback(quad_p3) == -1 ||
-	     BaseMath_ReadCallback(quad_p4) == -1)
+	if (BaseMath_ReadCallback(pt_vec)  == -1 ||
+	    BaseMath_ReadCallback(quad_p1) == -1 ||
+	    BaseMath_ReadCallback(quad_p2) == -1 ||
+	    BaseMath_ReadCallback(quad_p3) == -1 ||
+	    BaseMath_ReadCallback(quad_p4) == -1)
 	{
 		return NULL;
 	}
@@ -872,9 +873,9 @@ static PyObject *M_Geometry_distance_point_to_plane(PyObject *UNUSED(self), PyOb
 		return NULL;
 	}
 
-	if ( BaseMath_ReadCallback(pt) == -1 ||
-	     BaseMath_ReadCallback(plene_co) == -1 ||
-	     BaseMath_ReadCallback(plane_no) == -1)
+	if (BaseMath_ReadCallback(pt) == -1 ||
+	    BaseMath_ReadCallback(plene_co) == -1 ||
+	    BaseMath_ReadCallback(plane_no) == -1)
 	{
 		return NULL;
 	}
@@ -923,13 +924,13 @@ static PyObject *M_Geometry_barycentric_transform(PyObject *UNUSED(self), PyObje
 		return NULL;
 	}
 
-	if (	vec_pt->size != 3 ||
-		vec_t1_src->size != 3 ||
-		vec_t2_src->size != 3 ||
-		vec_t3_src->size != 3 ||
-		vec_t1_tar->size != 3 ||
-		vec_t2_tar->size != 3 ||
-		vec_t3_tar->size != 3)
+	if (vec_pt->size != 3 ||
+	    vec_t1_src->size != 3 ||
+	    vec_t2_src->size != 3 ||
+	    vec_t3_src->size != 3 ||
+	    vec_t1_tar->size != 3 ||
+	    vec_t2_tar->size != 3 ||
+	    vec_t3_tar->size != 3)
 	{
 		PyErr_SetString(PyExc_ValueError,
 		                "One of more of the vector arguments wasn't a 3D vector");
@@ -937,8 +938,8 @@ static PyObject *M_Geometry_barycentric_transform(PyObject *UNUSED(self), PyObje
 	}
 
 	barycentric_transform(vec, vec_pt->vec,
-			vec_t1_tar->vec, vec_t2_tar->vec, vec_t3_tar->vec,
-			vec_t1_src->vec, vec_t2_src->vec, vec_t3_src->vec);
+	                      vec_t1_tar->vec, vec_t2_tar->vec, vec_t3_tar->vec,
+	                      vec_t1_src->vec, vec_t2_src->vec, vec_t3_src->vec);
 
 	return Vector_CreatePyObject(vec, 3, Py_NEW, NULL);
 }
@@ -993,10 +994,10 @@ static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject
 		return NULL;
 	}
 
-	if ( BaseMath_ReadCallback(vec_k1) == -1 ||
-	     BaseMath_ReadCallback(vec_h1) == -1 ||
-	     BaseMath_ReadCallback(vec_k2) == -1 ||
-	     BaseMath_ReadCallback(vec_h2) == -1)
+	if (BaseMath_ReadCallback(vec_k1) == -1 ||
+	    BaseMath_ReadCallback(vec_h1) == -1 ||
+	    BaseMath_ReadCallback(vec_k2) == -1 ||
+	    BaseMath_ReadCallback(vec_h2) == -1)
 	{
 		return NULL;
 	}
@@ -1010,7 +1011,7 @@ static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject
 
 	coord_array = MEM_callocN(dims * (resolu) * sizeof(float), "interpolate_bezier");
 	for (i = 0; i < dims; i++) {
-		forward_diff_bezier(k1[i], h1[i], h2[i], k2[i], coord_array + i, resolu - 1, sizeof(float)*dims);
+		forward_diff_bezier(k1[i], h1[i], h2[i], k2[i], coord_array + i, resolu - 1, sizeof(float) * dims);
 	}
 
 	list = PyList_New(resolu);
@@ -1023,8 +1024,8 @@ static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject
 }
 
 
-PyDoc_STRVAR(M_Geometry_tesselate_polygon_doc,
-".. function:: tesselate_polygon(veclist_list)\n"
+PyDoc_STRVAR(M_Geometry_tessellate_polygon_doc,
+".. function:: tessellate_polygon(veclist_list)\n"
 "\n"
 "   Takes a list of polylines (each point a vector) and returns the point indices for a polyline filled with triangles.\n"
 "\n"
@@ -1032,7 +1033,7 @@ PyDoc_STRVAR(M_Geometry_tesselate_polygon_doc,
 "   :rtype: list\n"
 );
 /* PolyFill function, uses Blenders scanfill to fill multiple poly lines */
-static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *polyLineSeq)
+static PyObject *M_Geometry_tessellate_polygon(PyObject *UNUSED(self), PyObject *polyLineSeq)
 {
 	PyObject *tri_list; /*return this list of tri's */
 	PyObject *polyLine, *polyVec;
@@ -1063,7 +1064,7 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
 		}
 
 		len_polypoints = PySequence_Size(polyLine);
-		if (len_polypoints > 0) { /* dont bother adding edges as polylines */
+		if (len_polypoints > 0) { /* don't bother adding edges as polylines */
 #if 0
 			if (EXPP_check_sequence_consistency(polyLine, &vector_Type) != 1) {
 				freedisplist(&dispbase);
@@ -1095,7 +1096,7 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
 					if (((VectorObject *)polyVec)->size > 2)
 						fp[2] = ((VectorObject *)polyVec)->vec[2];
 					else
-						fp[2] = 0.0f; /* if its a 2d vector then set the z to be zero */
+						fp[2] = 0.0f;  /* if its a 2d vector then set the z to be zero */
 				}
 				else {
 					ls_error = 1;
@@ -1120,7 +1121,7 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
 		filldisplist(&dispbase, &dispbase, 0);
 
 		/* The faces are stored in a new DisplayList
-		thats added to the head of the listbase */
+		 * thats added to the head of the listbase */
 		dl = dispbase.first;
 
 		tri_list = PyList_New(dl->parts);
@@ -1141,7 +1142,7 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
 		freedisplist(&dispbase);
 	}
 	else {
-		/* no points, do this so scripts dont barf */
+		/* no points, do this so scripts don't barf */
 		freedisplist(&dispbase); /* possible some dl was allocated */
 		tri_list = PyList_New(0);
 	}
@@ -1280,7 +1281,7 @@ static PyMethodDef M_Geometry_methods[] = {
 	{"barycentric_transform", (PyCFunction) M_Geometry_barycentric_transform, METH_VARARGS, M_Geometry_barycentric_transform_doc},
 #ifndef MATH_STANDALONE
 	{"interpolate_bezier", (PyCFunction) M_Geometry_interpolate_bezier, METH_VARARGS, M_Geometry_interpolate_bezier_doc},
-	{"tesselate_polygon", (PyCFunction) M_Geometry_tesselate_polygon, METH_O, M_Geometry_tesselate_polygon_doc},
+	{"tessellate_polygon", (PyCFunction) M_Geometry_tessellate_polygon, METH_O, M_Geometry_tessellate_polygon_doc},
 	{"box_pack_2d", (PyCFunction) M_Geometry_box_pack_2d, METH_O, M_Geometry_box_pack_2d_doc},
 #endif
 	{NULL, NULL, 0, NULL}
diff --git a/source/blender/python/mathutils/mathutils_geometry.h b/source/blender/python/mathutils/mathutils_geometry.h
index 1b339bd..ac89698 100644
--- a/source/blender/python/mathutils/mathutils_geometry.h
+++ b/source/blender/python/mathutils/mathutils_geometry.h
@@ -32,11 +32,11 @@
 
 /*Include this file for access to vector, quat, matrix, euler, etc...*/
 
-#ifndef MATHUTILS_GEOMETRY_H
-#define MATHUTILS_GEOMETRY_H
+#ifndef __MATHUTILS_GEOMETRY_H__
+#define __MATHUTILS_GEOMETRY_H__
 
 #include "mathutils.h"
 
 PyMODINIT_FUNC PyInit_mathutils_geometry(void);
 
-#endif /* MATHUTILS_GEOMETRY_H */
+#endif /* __MATHUTILS_GEOMETRY_H__ */
diff --git a/source/blender/python/mathutils/mathutils_noise.c b/source/blender/python/mathutils/mathutils_noise.c
index fc9ea87..9460c4d 100644
--- a/source/blender/python/mathutils/mathutils_noise.c
+++ b/source/blender/python/mathutils/mathutils_noise.c
@@ -64,61 +64,61 @@
 /*-----------------------------------------*/
 /* 'mersenne twister' random number generator */
 
-/* 
-   A C-program for MT19937, with initialization improved 2002/2/10.
-   Coded by Takuji Nishimura and Makoto Matsumoto.
-   This is a faster version by taking Shawn Cokus's optimization,
-   Matthe Bellew's simplification, Isaku Wada's real version.
-
-   Before using, initialize the state by using init_genrand(seed) 
-   or init_by_array(init_key, key_length).
-
-   Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
-   All rights reserved.                          
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions
-   are met:
-
-     1. Redistributions of source code must retain the above copyright
-        notice, this list of conditions and the following disclaimer.
-
-     2. 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.
-
-     3. The names of its contributors may not 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.
-
-
-   Any feedback is very welcome.
-   http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
-   email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
-*/
+/*
+ * A C-program for MT19937, with initialization improved 2002/2/10.
+ * Coded by Takuji Nishimura and Makoto Matsumoto.
+ * This is a faster version by taking Shawn Cokus's optimization,
+ * Matthe Bellew's simplification, Isaku Wada's real version.
+ *
+ * Before using, initialize the state by using init_genrand(seed) 
+ * or init_by_array(init_key, key_length).
+ *
+ * Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
+ * All rights reserved.                          
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   1. Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *
+ *   2. 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.
+ *
+ *   3. The names of its contributors may not 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.
+ *
+ *
+ * Any feedback is very welcome.
+ * http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
+ * email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
+ */
 
 /* Period parameters */
 #define N 624
 #define M 397
-#define MATRIX_A 0x9908b0dfUL	/* constant vector a */
-#define UMASK 0x80000000UL	/* most significant w-r bits */
-#define LMASK 0x7fffffffUL	/* least significant r bits */
-#define MIXBITS(u,v) (((u) & UMASK) | ((v) & LMASK))
-#define TWIST(u,v) ((MIXBITS(u,v) >> 1) ^ ((v)&1UL ? MATRIX_A : 0UL))
+#define MATRIX_A 0x9908b0dfUL   /* constant vector a */
+#define UMASK 0x80000000UL  /* most significant w-r bits */
+#define LMASK 0x7fffffffUL  /* least significant r bits */
+#define MIXBITS(u, v) (((u) & UMASK) | ((v) & LMASK))
+#define TWIST(u, v) ((MIXBITS(u, v) >> 1) ^ ((v) & 1UL ? MATRIX_A : 0UL))
 
-static unsigned long state[N];	/* the array for the state vector  */
+static unsigned long state[N];  /* the array for the state vector  */
 static int left = 1;
 static int initf = 0;
 static unsigned long *next;
@@ -130,13 +130,13 @@ static void init_genrand(unsigned long s)
 	state[0] = s & 0xffffffffUL;
 	for (j = 1; j < N; j++) {
 		state[j] =
-			(1812433253UL *
-			  (state[j - 1] ^ (state[j - 1] >> 30)) + j);
+		    (1812433253UL *
+		     (state[j - 1] ^ (state[j - 1] >> 30)) + j);
 		/* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
 		/* In the previous versions, MSBs of the seed affect   */
 		/* only MSBs of the array state[].                        */
 		/* 2002/01/09 modified by Makoto Matsumoto             */
-		state[j] &= 0xffffffffUL;	/* for >32 bit machines */
+		state[j] &= 0xffffffffUL;   /* for >32 bit machines */
 	}
 	left = 1;
 	initf = 1;
@@ -199,7 +199,7 @@ static float frand(void)
 /* Fills an array of length size with random numbers in the range (-1, 1)*/
 static void rand_vn(float *array_tar, const int size)
 {
-	float *array_pt = array_tar + (size-1);
+	float *array_pt = array_tar + (size - 1);
 	int i = size;
 	while (i--) { *(array_pt--) = 2.0f * frand() - 1.0f; }
 }
@@ -215,7 +215,7 @@ static void noise_vector(float x, float y, float z, int nb, float v[3])
 
 /* Returns a turbulence value for a given position (x, y, z) */
 static float turb(float x, float y, float z, int oct, int hard, int nb,
-		   float ampscale, float freqscale)
+                  float ampscale, float freqscale)
 {
 	float amp, out, t;
 	int i;
@@ -237,7 +237,7 @@ static float turb(float x, float y, float z, int oct, int hard, int nb,
 }
 
 /* Fills an array of length 3 with the turbulence vector for a given
-position (x, y, z) */
+ * position (x, y, z) */
 static void vTurb(float x, float y, float z, int oct, int hard, int nb,
                   float ampscale, float freqscale, float v[3])
 {
@@ -321,7 +321,7 @@ static PyObject *M_Noise_random_unit_vector(PyObject *UNUSED(self), PyObject *ar
 	return Vector_CreatePyObject(vec, size, Py_NEW, NULL);
 }
 /* This is dumb, most people will want a unit vector anyway, since this doesn't have uniform distribution over a sphere*/
-/*
+#if 0
 PyDoc_STRVAR(M_Noise_random_vector_doc,
 ".. function:: random_vector(size=3)\n"
 "\n"
@@ -334,8 +334,8 @@ PyDoc_STRVAR(M_Noise_random_vector_doc,
 );
 static PyObject *M_Noise_random_vector(PyObject *UNUSED(self), PyObject *args)
 {
-	float vec[4]= {0.0f, 0.0f, 0.0f, 0.0f};
-	int size= 3;
+	float vec[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+	int size = 3;
 
 	if (!PyArg_ParseTuple(args, "|i:random_vector", &size))
 		return NULL;
@@ -349,7 +349,7 @@ static PyObject *M_Noise_random_vector(PyObject *UNUSED(self), PyObject *args)
 
 	return Vector_CreatePyObject(vec, size, Py_NEW, NULL);
 }
-*/
+#endif
 
 PyDoc_STRVAR(M_Noise_seed_set_doc,
 ".. function:: seed_set(seed)\n"
@@ -484,7 +484,7 @@ static PyObject *M_Noise_turbulence_vector(PyObject *UNUSED(self), PyObject *arg
 	PyObject *value;
 	float vec[3], r_vec[3];
 	int oct, hd, nb = 1;
-	float as =0.5f, fs = 2.0f;
+	float as = 0.5f, fs = 2.0f;
 	if (!PyArg_ParseTuple(args, "Oii|iff:turbulence_vector", &value, &oct, &hd, &nb, &as, &fs))
 		return NULL;
 
@@ -729,7 +729,7 @@ static PyObject *M_Noise_voronoi(PyObject *UNUSED(self), PyObject *args)
 	float vec[3];
 	float da[4], pa[12];
 	int dtype = 0;
-	float me = 2.5f;		/* default minkovsky exponent */
+	float me = 2.5f;  /* default minkovsky exponent */
 
 	int i;
 
@@ -796,7 +796,7 @@ static PyObject *M_Noise_cell_vector(PyObject *UNUSED(self), PyObject *args)
 		return NULL;
 
 	cellNoiseV(vec[0], vec[1], vec[2], r_vec);
-	return Vector_CreatePyObject(NULL, 3, Py_NEW, NULL);;
+	return Vector_CreatePyObject(NULL, 3, Py_NEW, NULL);
 }
 
 static PyMethodDef M_Noise_methods[] = {
diff --git a/source/blender/python/mathutils/mathutils_noise.h b/source/blender/python/mathutils/mathutils_noise.h
index 6a65275..f4bec88 100644
--- a/source/blender/python/mathutils/mathutils_noise.h
+++ b/source/blender/python/mathutils/mathutils_noise.h
@@ -24,8 +24,8 @@
  *  \ingroup mathutils
  */
 
-#ifndef MATHUTILS_NOISE_H
-#define MATHUTILS_NOISE_H
+#ifndef __MATHUTILS_NOISE_H__
+#define __MATHUTILS_NOISE_H__
 
 #include "mathutils.h"
 
@@ -33,4 +33,4 @@ PyMODINIT_FUNC PyInit_mathutils_noise(void);
 PyMODINIT_FUNC PyInit_mathutils_noise_types(void);
 PyMODINIT_FUNC PyInit_mathutils_noise_metrics(void);
 
-#endif // MATHUTILS_NOISE_H
+#endif // __MATHUTILS_NOISE_H__
diff --git a/source/blender/python/simple_enum_gen.py b/source/blender/python/simple_enum_gen.py
index ec2eead..7e54f3d 100644
--- a/source/blender/python/simple_enum_gen.py
+++ b/source/blender/python/simple_enum_gen.py
@@ -40,7 +40,7 @@ defs = """
 """
 
 print '\tmod = PyModule_New("dummy");'
-print '\tPyModule_AddObject( submodule, "key", mod );'
+print '\tPyModule_AddObject(submodule, "key", mod);'
 
 for d in defs.split('\n'):
 
@@ -58,7 +58,7 @@ for d in defs.split('\n'):
     val = w[0]
     py_val = w[0]
 
-    print '\tPyModule_AddObject( mod, "%s", PyLong_FromSize_t(%s) );' % (val, py_val)
+    print '\tPyModule_AddObject(mod, "%s", PyLong_FromSize_t(%s));' % (val, py_val)
 
 
 
diff --git a/source/blender/quicktime/apple/qtkit_export.m b/source/blender/quicktime/apple/qtkit_export.m
index f709572..b4a89ea 100644
--- a/source/blender/quicktime/apple/qtkit_export.m
+++ b/source/blender/quicktime/apple/qtkit_export.m
@@ -132,7 +132,8 @@ int quicktime_get_num_videocodecs()
 	return qtVideoCodecCount;
 }
 
-QuicktimeCodecTypeDesc* quicktime_get_videocodecType_desc(int indexValue) {
+QuicktimeCodecTypeDesc* quicktime_get_videocodecType_desc(int indexValue)
+{
 	if ((indexValue>=0) && (indexValue < qtVideoCodecCount))
 		return &qtVideoCodecList[indexValue];
 	else
@@ -176,7 +177,8 @@ int quicktime_get_num_audiocodecs()
 	return qtAudioCodecCount;
 }
 
-QuicktimeCodecTypeDesc* quicktime_get_audiocodecType_desc(int indexValue) {
+QuicktimeCodecTypeDesc* quicktime_get_audiocodecType_desc(int indexValue)
+{
 	if ((indexValue>=0) && (indexValue < qtAudioCodecCount))
 		return &qtAudioCodecList[indexValue];
 	else
@@ -241,7 +243,7 @@ void filepath_qt(char *string, RenderData *rd)
 	BLI_make_existing_file(string);
 	
 	if (!BLI_testextensie(string, ".mov")) {
-		/* if we dont have any #'s to insert numbers into, use 4 numbers by default */
+		/* if we don't have any #'s to insert numbers into, use 4 numbers by default */
 		if (strchr(string, '#')==NULL)
 			strcat(string, "####"); /* 4 numbers */
 
@@ -483,7 +485,8 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R
 						qtexport->audioFile = NULL;
 						[qtexport->audioFileName release];
 						qtexport->audioFileName = nil;
-					} else {
+					}
+					else {
 						UInt32 prop,propSize;
 						/* Set up codec properties */
 						if (rd->qtcodecsettings.audiocodecType == kAudioFormatMPEG4AAC) { /*Lossy compressed format*/
@@ -533,7 +536,8 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R
 					qtexport->movie = [[QTMovie alloc] initToWritableFile:qtexport->videoTempFileName error:&error];
 
 			}
-		} else
+		}
+		else
 			qtexport->movie = [[QTMovie alloc] initToWritableFile:qtexport->filename error:&error];
 			
 		if(qtexport->movie == nil) {
@@ -546,7 +550,8 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R
 			if (qtexport->videoTempFileName) [qtexport->videoTempFileName release];
 			qtexport->videoTempFileName = nil;
 			[QTMovie exitQTKitOnThread];
-		} else {
+		}
+		else {
 			[qtexport->movie retain];
 			[qtexport->movie setAttribute:[NSNumber numberWithBool:YES] forKey:QTMovieEditableAttribute];
 			[qtexport->movie setAttribute:@"Made with Blender" forKey:QTMovieCopyrightAttribute];
@@ -659,7 +664,8 @@ int append_qt(struct RenderData *rd, int start_frame, int frame, int *pixels, in
 				if (qtexport->audioOutputFormat.mFramesPerPacket) { 
 					// this is the common case: format has constant frames per packet
 					qtexport->audioTotalSavedFrames += (audioPacketsConverted * qtexport->audioOutputFormat.mFramesPerPacket);
-				} else {
+				}
+				else {
 					unsigned int i;
 					// if there are variable frames per packet, then we have to do this for each packeet
 					for (i = 0; i < audioPacketsConverted; ++i)
diff --git a/source/blender/quicktime/apple/qtkit_import.m b/source/blender/quicktime/apple/qtkit_import.m
index 633d92e..197cbdc 100644
--- a/source/blender/quicktime/apple/qtkit_import.m
+++ b/source/blender/quicktime/apple/qtkit_import.m
@@ -81,7 +81,7 @@ int anim_is_quicktime (const char *name)
 {
 	NSAutoreleasePool *pool;
 	
-	// dont let quicktime movie import handle these
+	// don't let quicktime movie import handle these
 	if( BLI_testextensie(name, ".swf") ||
 		BLI_testextensie(name, ".txt") ||
 		BLI_testextensie(name, ".mpg") ||
@@ -396,7 +396,7 @@ int imb_is_a_quicktime (char *name)
 
 	pool = [[NSAutoreleasePool alloc] init];
 	
-	// dont let quicktime image import handle these
+	// don't let quicktime image import handle these
 	if( BLI_testextensie(name, ".swf") ||
 		BLI_testextensie(name, ".txt") ||
 		BLI_testextensie(name, ".mpg") ||
diff --git a/source/blender/quicktime/apple/quicktime_export.c b/source/blender/quicktime/apple/quicktime_export.c
index 71cf875..599268b 100644
--- a/source/blender/quicktime/apple/quicktime_export.c
+++ b/source/blender/quicktime/apple/quicktime_export.c
@@ -153,7 +153,8 @@ int quicktime_get_num_videocodecs()
 	return qtVideoCodecCount;
 }
 
-QuicktimeCodecTypeDesc* quicktime_get_videocodecType_desc(int indexValue) {
+QuicktimeCodecTypeDesc* quicktime_get_videocodecType_desc(int indexValue)
+{
 	if ((indexValue>=0) && (indexValue < qtVideoCodecCount))
 		return &qtVideoCodecList[indexValue];
 	else
@@ -186,7 +187,7 @@ int quicktime_videocodecType_from_rnatmpvalue(int rnatmpvalue)
 
 static void CheckError(OSErr err, char *msg, ReportList *reports)
 {
-	if(err != noErr) {
+	if (err != noErr) {
 		BKE_reportf(reports, RPT_ERROR, "%s: %d", msg, err);
 	}
 }
@@ -206,7 +207,8 @@ static OSErr QT_SaveCodecSettingsToScene(RenderData *rd, ReportList *reports)
 	// check if current scene already has qtcodec settings, and clear them
 	if (qcd) {
 		free_qtcodecdata(qcd);
-	} else {
+	}
+	else {
 		qcd = rd->qtcodecdata = MEM_callocN(sizeof(QuicktimeCodecData), "QuicktimeCodecData");
 	}
 
@@ -236,7 +238,8 @@ static OSErr QT_SaveCodecSettingsToScene(RenderData *rd, ReportList *reports)
 		qcd->cdSize = mySize;
 
 		GetCodecInfo (&ci, qtdata->gSpatialSettings.codecType, 0);
-	} else {
+	}
+	else {
 		BKE_reportf(reports, RPT_ERROR, "Quicktime: QT_SaveCodecSettingsToScene failed\n"); 
 	}
 
@@ -264,7 +267,7 @@ static OSErr QT_GetCodecSettingsFromScene(RenderData *rd, ReportList *reports)
 	}
 		
 	// restore codecsettings to the quicktime component
-	if(qcd->cdParms && qcd->cdSize) {
+	if (qcd->cdParms && qcd->cdSize) {
 		myErr = SCSetSettingsFromAtomContainer((GraphicsExportComponent)qtdata->theComponent, (QTAtomContainer)myHandle);
 		if (myErr != noErr) {
 			BKE_reportf(reports, RPT_ERROR, "Quicktime: SCSetSettingsFromAtomContainer failed\n"); 
@@ -292,7 +295,8 @@ static OSErr QT_GetCodecSettingsFromScene(RenderData *rd, ReportList *reports)
 		rd->qtcodecsettings.minTemporalQuality = (qtdata->aDataRateSetting.minTemporalQuality * 100) / codecLosslessQuality;
 		//Frame duration is already known (qtdata->aDataRateSetting.frameDuration)
 		
-	} else {
+	}
+	else {
 		BKE_reportf(reports, RPT_ERROR, "Quicktime: QT_GetCodecSettingsFromScene failed\n"); 
 	}
 bail:
@@ -410,8 +414,8 @@ static void QT_StartAddVideoSamplesToMedia (const Rect *trackFrame, int rectx, i
 	// the new callback based api for proper encoding, but that's not
 	// really compatible with rendering out frames sequentially
 	gTemporalSettings = qtdata->gTemporalSettings;
-	if(qtdata->gSpatialSettings.codecType == kH264CodecType) {
-		if(gTemporalSettings.temporalQuality != codecMinQuality) {
+	if (qtdata->gSpatialSettings.codecType == kH264CodecType) {
+		if (gTemporalSettings.temporalQuality != codecMinQuality) {
 			BKE_reportf(reports, RPT_WARNING, "Only minimum quality compression supported for QuickTime H.264.\n");
 			gTemporalSettings.temporalQuality = codecMinQuality;
 		}
@@ -454,7 +458,7 @@ static void QT_DoAddVideoSamplesToMedia (int frame, int *pixels, int rectx, int
 
 	//parse RGBA bitmap into Quicktime's ARGB GWorld
 	boxsize = rectx * recty;
-	for( index = 0; index < boxsize; index++) {
+	for ( index = 0; index < boxsize; index++) {
 		to[0] = from[3];
 		to[1] = from[0];
 		to[2] = from[1];
@@ -532,18 +536,19 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R
 #endif
 	int success= 1;
 
-	if(qtexport == NULL) qtexport = MEM_callocN(sizeof(QuicktimeExport), "QuicktimeExport");
+	if (qtexport == NULL) qtexport = MEM_callocN(sizeof(QuicktimeExport), "QuicktimeExport");
 
-	if(qtdata) {
-		if(qtdata->theComponent) CloseComponent(qtdata->theComponent);
+	if (qtdata) {
+		if (qtdata->theComponent) CloseComponent(qtdata->theComponent);
 		free_qtcomponentdata();
 	}
 
 	qtdata = MEM_callocN(sizeof(QuicktimeComponentData), "QuicktimeCodecDataExt");
 
-	if(rd->qtcodecdata == NULL || rd->qtcodecdata->cdParms == NULL) {
+	if (rd->qtcodecdata == NULL || rd->qtcodecdata->cdParms == NULL) {
 		get_qtcodec_settings(rd, reports);
-	} else {
+	}
+	else {
 		qtdata->theComponent = OpenDefaultComponent(StandardCompressionType, StandardCompressionSubType);
 
 		QT_GetCodecSettingsFromScene(rd, reports);
@@ -588,13 +593,14 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R
 						&qtexport->theMovie );
 	CheckError(err, "CreateMovieFile error", reports);
 
-	if(err != noErr) {
+	if (err != noErr) {
 		BKE_reportf(reports, RPT_ERROR, "Unable to create Quicktime movie: %s", name);
 		success= 0;
 #ifdef __APPLE__
 		ExitMoviesOnThread();
 #endif
-	} else {
+	}
+	else {
 		//printf("Created QuickTime movie: %s\n", name);
 
 		QT_CreateMyVideoTrack(rectx, recty, reports);
@@ -616,7 +622,7 @@ void end_qt(void)
 	OSErr err = noErr;
 	short resId = movieInDataForkResID;
 
-	if(qtexport->theMovie) {
+	if (qtexport->theMovie) {
 		QT_EndCreateMyVideoTrack(NULL);
 
 		err = AddMovieResource (qtexport->theMovie, qtexport->resRefNum, &resId, qtexport->qtfilename);
@@ -628,7 +634,7 @@ void end_qt(void)
 		err = UpdateMovieResource(qtexport->theMovie, qtexport->resRefNum, resId, qtexport->qtfilename);
 		CheckError(err, "UpdateMovieResource error", NULL);
 
-		if(qtexport->resRefNum) CloseMovieFile(qtexport->resRefNum);
+		if (qtexport->resRefNum) CloseMovieFile(qtexport->resRefNum);
 
 		DisposeMovie(qtexport->theMovie);
 
@@ -639,7 +645,7 @@ void end_qt(void)
 		ExitMoviesOnThread();
 #endif
 	
-	if(qtexport) {
+	if (qtexport) {
 		MEM_freeN(qtexport);
 		qtexport = NULL;
 	}
@@ -648,8 +654,8 @@ void end_qt(void)
 
 void free_qtcomponentdata(void)
 {
-	if(qtdata) {
-		if(qtdata->theComponent) CloseComponent(qtdata->theComponent);
+	if (qtdata) {
+		if (qtdata->theComponent) CloseComponent(qtdata->theComponent);
 		MEM_freeN(qtdata);
 		qtdata = NULL;
 	}
@@ -664,7 +670,7 @@ static void check_renderbutton_framerate(RenderData *rd, ReportList *reports)
 	err = SCGetInfo(qtdata->theComponent, scTemporalSettingsType,	&qtdata->gTemporalSettings);
 	CheckError(err, "SCGetInfo fr error", reports);
 
-	if( (rd->frs_sec == 24 || rd->frs_sec == 30 || rd->frs_sec == 60) &&
+	if ( (rd->frs_sec == 24 || rd->frs_sec == 30 || rd->frs_sec == 60) &&
 	    (qtdata->gTemporalSettings.frameRate == 1571553 ||
 	     qtdata->gTemporalSettings.frameRate == 1964113 ||
 	     qtdata->gTemporalSettings.frameRate == 3928227))
@@ -674,22 +680,25 @@ static void check_renderbutton_framerate(RenderData *rd, ReportList *reports)
 	else {
 		if (rd->frs_sec_base > 0)
 			qtdata->gTemporalSettings.frameRate = 
-			((float)(rd->frs_sec << 16) / rd->frs_sec_base) ;
+			((float)(rd->frs_sec << 16) / rd->frs_sec_base);
 	}
 	
 	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;
-	} else {
+	}
+	else {
 		qtdata->kVideoTimeScale = (qtdata->gTemporalSettings.frameRate >> 16) * 100;
 		qtdata->duration = 100;
 	}
@@ -716,8 +725,8 @@ int get_qtcodec_settings(RenderData *rd, ReportList *reports)
 {
 	OSErr err = noErr;
 		// erase any existing codecsetting
-	if(qtdata) {
-		if(qtdata->theComponent) CloseComponent(qtdata->theComponent);
+	if (qtdata) {
+		if (qtdata->theComponent) CloseComponent(qtdata->theComponent);
 		free_qtcomponentdata();
 	}
 
@@ -726,9 +735,10 @@ int get_qtcodec_settings(RenderData *rd, ReportList *reports)
 	qtdata->theComponent = OpenDefaultComponent(StandardCompressionType, StandardCompressionSubType);
 
 	// get previous selected codecsetting, from qtatom or detailed settings
-	if(rd->qtcodecdata && rd->qtcodecdata->cdParms) {
+	if (rd->qtcodecdata && rd->qtcodecdata->cdParms) {
 		QT_GetCodecSettingsFromScene(rd, reports);
-	} else {
+	}
+	else {
 		SCGetInfo(qtdata->theComponent, scDataRateSettingsType,	&qtdata->aDataRateSetting);
 		SCGetInfo(qtdata->theComponent, scSpatialSettingsType,	&qtdata->gSpatialSettings);
 		SCGetInfo(qtdata->theComponent, scTemporalSettingsType,	&qtdata->gTemporalSettings);
@@ -767,8 +777,8 @@ static int request_qtcodec_settings(bContext *C, wmOperator *op)
 	RenderData *rd = &scene->r;
 
 	// erase any existing codecsetting
-	if(qtdata) {
-		if(qtdata->theComponent) CloseComponent(qtdata->theComponent);
+	if (qtdata) {
+		if (qtdata->theComponent) CloseComponent(qtdata->theComponent);
 		free_qtcomponentdata();
 	}
 	
@@ -777,9 +787,10 @@ static int request_qtcodec_settings(bContext *C, wmOperator *op)
 	qtdata->theComponent = OpenDefaultComponent(StandardCompressionType, StandardCompressionSubType);
 	
 	// get previous selected codecsetting, from qtatom or detailed settings
-	if(rd->qtcodecdata && rd->qtcodecdata->cdParms) {
+	if (rd->qtcodecdata && rd->qtcodecdata->cdParms) {
 		QT_GetCodecSettingsFromScene(rd, op->reports);
-	} else {
+	}
+	else {
 		SCGetInfo(qtdata->theComponent, scDataRateSettingsType,	&qtdata->aDataRateSetting);
 		SCGetInfo(qtdata->theComponent, scSpatialSettingsType,	&qtdata->gSpatialSettings);
 		SCGetInfo(qtdata->theComponent, scTemporalSettingsType,	&qtdata->gTemporalSettings);
@@ -835,25 +846,28 @@ static int request_qtcodec_settings(bContext *C, wmOperator *op)
 	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;
 
 		rd->frs_sec = 60;
 		rd->frs_sec_base = 1.001;
-	} else {
+	}
+	else {
 		double fps = qtdata->gTemporalSettings.frameRate;
 
 		qtdata->kVideoTimeScale = 60000;
@@ -862,7 +876,8 @@ static int request_qtcodec_settings(bContext *C, wmOperator *op)
 		if ((qtdata->gTemporalSettings.frameRate & 0xffff) == 0) {
 			rd->frs_sec = fps / 65536;
 			rd->frs_sec_base = 1.0;
-		} else {
+		}
+		else {
 			/* we do our very best... */
 			rd->frs_sec = fps  / 65536;
 			rd->frs_sec_base = 1.0;
@@ -892,20 +907,20 @@ int fromcocoa_request_qtcodec_settings(bContext *C, wmOperator *op)
 void SCENE_OT_render_data_set_quicktime_codec(wmOperatorType *ot)
 {
 	/* identifiers */
-	ot->name= "Change codec";
-	ot->description= "Change Quicktime codec Settings";
-	ot->idname= "SCENE_OT_render_data_set_quicktime_codec";
+	ot->name = "Change codec";
+	ot->description = "Change Quicktime codec Settings";
+	ot->idname = "SCENE_OT_render_data_set_quicktime_codec";
 	
 	/* api callbacks */
 #if defined(__APPLE__) && defined(GHOST_COCOA)
 	ot->exec = cocoa_request_qtcodec_settings;
 #else
-	ot->exec= request_qtcodec_settings;
+	ot->exec = request_qtcodec_settings;
 #endif
-	ot->poll= ED_operator_setqtcodec;
+	ot->poll = ED_operator_setqtcodec;
 	
 	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+	ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 }
 
 #endif /* USE_QTKIT */
diff --git a/source/blender/quicktime/apple/quicktime_import.c b/source/blender/quicktime/apple/quicktime_import.c
index a7d0968..a1f3593 100644
--- a/source/blender/quicktime/apple/quicktime_import.c
+++ b/source/blender/quicktime/apple/quicktime_import.c
@@ -125,7 +125,7 @@ void quicktime_exit(void)
 {
 #if defined(_WIN32) || defined(__APPLE__)
 #ifdef WITH_QUICKTIME
-	if(G.have_quicktime) {
+	if (G.have_quicktime) {
 		free_qtcomponentdata();
 		ExitMovies();
 #ifdef _WIN32
@@ -147,22 +147,24 @@ char *get_valid_qtname(char *name)
 
 	dwRet = GetCurrentDirectory(MAX_PATH, Buffer);
 
-	if(name[1] != ':') {
+	if (name[1] != ':') {
 		char drive[2];
 
-		if(name[0] == '/' || name[0] == '\\') {
+		if (name[0] == '/' || name[0] == '\\') {
 			drive[0] = Buffer[0];
 			drive[1] = '\0';
 
 			BLI_dynstr_append(ds, drive);
 			BLI_dynstr_append(ds, ":");
 			BLI_dynstr_append(ds, name);
-		} else {
+		}
+		else {
 			BLI_dynstr_append(ds, Buffer);
 			BLI_dynstr_append(ds, "/");
 			BLI_dynstr_append(ds, name);
 		}
-	} else {
+	}
+	else {
 		BLI_dynstr_append(ds, name);
 	}
 
@@ -191,8 +193,8 @@ int anim_is_quicktime (const char *name)
 #endif
 	OSErr						err = noErr;
 			
-	// dont let quicktime movie import handle these
-	if( BLI_testextensie(name, ".swf") ||
+	// 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") ||	// wouldnt be appropriate ;)
@@ -204,7 +206,7 @@ int anim_is_quicktime (const char *name)
 		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);
 
 #ifdef __APPLE__
 	sprintf(theFullPath, "%s", name);
@@ -257,16 +259,16 @@ void free_anim_quicktime (struct anim *anim)
 
 	UnlockPixels(anim->qtime->offscreenPixMap);
 
-	if(anim->qtime->have_gw)
+	if (anim->qtime->have_gw)
 		DisposeGWorld( anim->qtime->offscreenGWorld );
-	if(anim->qtime->ibuf)
+	if (anim->qtime->ibuf)
 		IMB_freeImBuf(anim->qtime->ibuf);
 
 	DisposeMovie( anim->qtime->movie );
 	CloseMovieFile( anim->qtime->movieRefNum );
 
-	if(anim->qtime->frameIndex) MEM_freeN (anim->qtime->frameIndex);
-	if(anim->qtime) MEM_freeN (anim->qtime);
+	if (anim->qtime->frameIndex) MEM_freeN (anim->qtime->frameIndex);
+	if (anim->qtime) MEM_freeN (anim->qtime);
 
 	anim->qtime = NULL;
 
@@ -305,7 +307,7 @@ static OSErr QT_get_frameIndexes(struct anim *anim)
 	GetMovieNextInterestingTime(anim->qtime->movie, nextTimeMediaSample, 1, &media, (TimeValue)1, 0, &tmpstartPoint, NULL);
 
 	anim->qtime->frameIndex[0] = startPoint;
-	for(i = 1; i < anim->qtime->framecount; i++) {
+	for (i = 1; i < anim->qtime->framecount; i++) {
 		nextTime = 0;
 		GetMovieNextInterestingTime(anim->qtime->movie, nextTimeMediaSample, 1, &media, startPoint, 0, &nextTime, NULL);
 		startPoint = nextTime;
@@ -367,7 +369,7 @@ ImBuf * qtime_fetchibuf (struct anim *anim, int position)
 	from= (unsigned char *)readPos;
 	to= (unsigned char *)changePos;
 	
-	for( index = 0; index < boxsize; index++, from+=4, to+=4 ) {
+	for ( index = 0; index < boxsize; index++, from+=4, to+=4 ) {
 		to[3] = from[0];
 		to[0] = from[1];
 		to[1] = from[2];
@@ -376,14 +378,14 @@ ImBuf * qtime_fetchibuf (struct anim *anim, int position)
 #endif
 
 #ifdef _WIN32
-	for( index = 0; index < boxsize; index++, changePos++, readPos++ )
+	for ( index = 0; index < boxsize; index++, changePos++, readPos++ )
 		*( changePos ) =  *(readPos );
 
-	if(anim->qtime->depth < 32) {
+	if (anim->qtime->depth < 32) {
 		//add alpha to ibuf
 		boxsize = anim->x * anim->y * 4;
 		crect = (unsigned char *) rect;
-		for( index = 0; index < boxsize; index+=4, crect+=4 ) {
+		for ( index = 0; index < boxsize; index+=4, crect+=4 ) {
 			crect[3] = 0xFF;
 		}
 	}
@@ -425,7 +427,7 @@ static short GetFirstVideoTrackPixelDepth(struct anim *anim)
 	SampleDescriptionHandle imageDescH =	(SampleDescriptionHandle)NewHandle(sizeof(Handle));
 //	long	trackIndex = 0; /*unused*/
 	
-	if(!GetFirstVideoMedia(anim))
+	if (!GetFirstVideoMedia(anim))
 		return -1;
 
 	if (!anim->qtime->trackIndex || !anim->qtime->theMedia) return -1;  // we need both
@@ -453,11 +455,11 @@ int startquicktime (struct anim *anim)
 	anim->qtime->have_gw = FALSE;
 
 	if (anim->qtime == NULL) {
-		if(QTIME_DEBUG) printf("Can't alloc qtime: %s\n", anim->name);
+		if (QTIME_DEBUG) printf("Can't alloc qtime: %s\n", anim->name);
 		return -1;
 	}
 
-	if(QTIME_DEBUG) printf("qt: attempting to load as movie %s\n", anim->name);
+	if (QTIME_DEBUG) printf("qt: attempting to load as movie %s\n", anim->name);
 	
 #ifdef __APPLE__
 	sprintf(theFullPath, "%s", anim->name);
@@ -476,18 +478,18 @@ int startquicktime (struct anim *anim)
 	err = OpenMovieFile(&theFSSpec, &anim->qtime->movieRefNum, fsRdPerm);
 
 	if (err == noErr) {
-		if(QTIME_DEBUG) printf("qt: movie opened\n");
+		if (QTIME_DEBUG) printf("qt: movie opened\n");
 		err = NewMovieFromFile(&anim->qtime->movie,
 						   anim->qtime->movieRefNum,
 						   &anim->qtime->movieResId, NULL, newMovieActive, NULL);
 	}
 
 	if (err) {
-		if(QTIME_DEBUG) printf("qt: bad movie %s\n", anim->name);
+		if (QTIME_DEBUG) printf("qt: bad movie %s\n", anim->name);
 		if (anim->qtime->movie) {
 			DisposeMovie(anim->qtime->movie);
 			MEM_freeN(anim->qtime);
-			if(QTIME_DEBUG) printf("qt: can't load %s\n", anim->name);
+			if (QTIME_DEBUG) printf("qt: can't load %s\n", anim->name);
 			return -1;
 		}
 	}
@@ -495,10 +497,10 @@ int startquicktime (struct anim *anim)
 	GetMovieBox(anim->qtime->movie, &anim->qtime->movieBounds);
 	anim->x = anim->qtime->movWidth = RECT_WIDTH(anim->qtime->movieBounds);
 	anim->y = anim->qtime->movHeight = RECT_HEIGHT(anim->qtime->movieBounds);
-	if(QTIME_DEBUG) printf("qt: got bounds %s\n", anim->name);
+	if (QTIME_DEBUG) printf("qt: got bounds %s\n", anim->name);
 
-	if(anim->x == 0 && anim->y == 0) {
-		if(QTIME_DEBUG) printf("qt: error, no dimensions\n");
+	if (anim->x == 0 && anim->y == 0) {
+		if (QTIME_DEBUG) printf("qt: error, no dimensions\n");
 		free_anim_quicktime(anim);
 		return -1;
 	}
@@ -521,7 +523,7 @@ int startquicktime (struct anim *anim)
 		anim->x * 4);
 #endif /* _WIN32 */
 
-	if(err == noErr) {
+	if (err == noErr) {
 		anim->qtime->have_gw = TRUE;
 
 		SetMovieGWorld(anim->qtime->movie,
@@ -550,7 +552,7 @@ int startquicktime (struct anim *anim)
 
 	anim->curposition = 0;
 
-	if(QTIME_DEBUG) printf("qt: load %s %dx%dx%d frames %d\n", anim->name, anim->qtime->movWidth,
+	if (QTIME_DEBUG) printf("qt: load %s %dx%dx%d frames %d\n", anim->name, anim->qtime->movWidth,
 		anim->qtime->movHeight, anim->qtime->depth, anim->qtime->framecount);
 
 	return 0;
@@ -575,12 +577,12 @@ int imb_is_a_quicktime (char *name)
 #endif
 	OSErr						err = noErr;
 
-	if(!G.have_quicktime) return 0;
+	if (!G.have_quicktime) return 0;
 
-	if(QTIME_DEBUG) printf("qt: checking as image %s\n", name);
+	if (QTIME_DEBUG) printf("qt: checking as image %s\n", name);
 
-	// dont let quicktime image import handle these
-	if( BLI_testextensie(name, ".swf") ||
+	// don't let quicktime image import handle these
+	if ( BLI_testextensie(name, ".swf") ||
 		BLI_testextensie(name, ".txt") ||
 		BLI_testextensie(name, ".mpg") ||
 		BLI_testextensie(name, ".wav") ||
@@ -600,7 +602,7 @@ int imb_is_a_quicktime (char *name)
 	GetGraphicsImporterForFile(&theFSSpec, &theImporter);
 
 	if (theImporter != NULL) {
-		if(QTIME_DEBUG) printf("qt: %s valid\n", name);
+		if (QTIME_DEBUG) printf("qt: %s valid\n", name);
 		CloseComponent(theImporter);
 		return 1;
 	}
@@ -643,7 +645,7 @@ ImBuf  *imb_quicktime_decode(unsigned char *mem, int size, int flags)
 	if (mem == NULL || !G.have_quicktime)
 		goto bail;
 	
-	if(QTIME_DEBUG) printf("qt: attempt to load mem as image\n");
+	if (QTIME_DEBUG) printf("qt: attempt to load mem as image\n");
 
 	dataref= (PointerDataRef)NewHandle(sizeof(PointerDataRefRecord));
 	(**dataref).data = mem;
@@ -657,25 +659,25 @@ ImBuf  *imb_quicktime_decode(unsigned char *mem, int size, int flags)
 							kDataHCanRead,
 							&dataHandler);
 	if (err != noErr) {
-		if(QTIME_DEBUG) printf("no datahandler\n");
+		if (QTIME_DEBUG) printf("no datahandler\n");
 		goto bail;
 	}
 
 	err = GetGraphicsImporterForDataRef((Handle)dataref, PointerDataHandlerSubType, &gImporter);
 	if (err != noErr) {
-		if(QTIME_DEBUG) printf("no graphimport\n");
+		if (QTIME_DEBUG) printf("no graphimport\n");
 		goto bail;
 	}
 
 	err = GraphicsImportGetNaturalBounds(gImporter, &myRect);
 	if (err != noErr) {
-		if(QTIME_DEBUG) printf("no bounds\n");
+		if (QTIME_DEBUG) printf("no bounds\n");
 		goto bail;
 	}
 
 	err = GraphicsImportGetImageDescription (gImporter, &desc );
 	if (err != noErr) {
-		if(QTIME_DEBUG) printf("no imagedescription\n");
+		if (QTIME_DEBUG) printf("no imagedescription\n");
 		goto bail;
 	}
 
@@ -710,9 +712,10 @@ ImBuf  *imb_quicktime_decode(unsigned char *mem, int size, int flags)
 #endif
 	
 	if (err != noErr) {
-		if(QTIME_DEBUG) printf("no newgworld\n");
+		if (QTIME_DEBUG) printf("no newgworld\n");
 		goto bail;
-	} else {
+	}
+	else {
 		have_gw = TRUE;
 	}
 
@@ -740,7 +743,7 @@ ImBuf  *imb_quicktime_decode(unsigned char *mem, int size, int flags)
 	from= (unsigned char *)readPos;
 	to= (unsigned char *)changePos;
 	
-	for( index = 0; index < boxsize; index++, from+=4, to+=4 ) {
+	for ( index = 0; index < boxsize; index++, from+=4, to+=4 ) {
 		to[3] = from[0];
 		to[0] = from[1];
 		to[1] = from[2];
@@ -752,7 +755,7 @@ bail:
 
 	DisposeHandle((Handle)dataref);
 	UnlockPixels(myPixMap);
-	if(have_gw) DisposeGWorld(offGWorld);
+	if (have_gw) DisposeGWorld(offGWorld);
 
 #ifdef __APPLE__
 	if (wbuf) {
@@ -764,14 +767,14 @@ bail:
 	if (gImporter != NULL)	CloseComponent(gImporter);
 
 	if (err != noErr) {
-		if(QTIME_DEBUG) printf("quicktime import unsuccesfull\n");
+		if (QTIME_DEBUG) printf("quicktime import unsuccesfull\n");
 		if (ibuf) {
 			IMB_freeImBuf (ibuf);
 			ibuf = NULL;
 		}
 	}
 
-	if(ibuf) {
+	if (ibuf) {
 
 #ifdef _WIN32
 // add non transparent alpha layer, so images without alpha show up in the sequence editor
@@ -781,8 +784,8 @@ bail:
 		int box = x * y;
 		unsigned char *arect = (unsigned char *) ibuf->rect;
 
-		if( depth < 32 && (**desc).cType != kGIFCodecType) {
-			for(i = 0; i < box; i++, arect+=4)
+		if ( depth < 32 && (**desc).cType != kGIFCodecType) {
+			for (i = 0; i < box; i++, arect+=4)
 				arect[3] = 0xFF;
 		}
 #endif
diff --git a/source/blender/quicktime/quicktime_export.h b/source/blender/quicktime/quicktime_export.h
index deaacb0..ed89635 100644
--- a/source/blender/quicktime/quicktime_export.h
+++ b/source/blender/quicktime/quicktime_export.h
@@ -47,7 +47,7 @@ typedef struct QuicktimeCodecTypeDesc {
 	int codecType;
 	int rnatmpvalue;
 	char * codecName;
-} QuicktimeCodecTypeDesc ;
+} QuicktimeCodecTypeDesc;
 
 // quicktime movie output functions
 struct ImageFormatData;
diff --git a/source/blender/quicktime/quicktime_import.h b/source/blender/quicktime/quicktime_import.h
index d095b83..e6f3c82 100644
--- a/source/blender/quicktime/quicktime_import.h
+++ b/source/blender/quicktime/quicktime_import.h
@@ -34,8 +34,8 @@
 
 
 
-#ifndef __QUICKTIME_IMP_H__
-#define __QUICKTIME_IMP_H__
+#ifndef __QUICKTIME_IMPORT_H__
+#define __QUICKTIME_IMPORT_H__
 
 #define __AIFF__
 
@@ -76,4 +76,4 @@ ImBuf  *qtime_fetchibuf (struct anim *anim, int position);
 int		imb_is_a_quicktime (char *name);
 ImBuf  *imb_quicktime_decode(unsigned char *mem, int size, int flags);
 
-#endif  // __QUICKTIME_IMP_H__
+#endif  // __QUICKTIME_IMPORT_H__
diff --git a/source/blender/render/CMakeLists.txt b/source/blender/render/CMakeLists.txt
index 51c5d49..a2d6e27 100644
--- a/source/blender/render/CMakeLists.txt
+++ b/source/blender/render/CMakeLists.txt
@@ -27,6 +27,7 @@
 set(INC 
 	extern/include
 	intern/include
+	../blenfont
 	../blenkernel
 	../blenlib
 	../blenloader
diff --git a/source/blender/render/SConscript b/source/blender/render/SConscript
index 9c72418..8a044b1 100644
--- a/source/blender/render/SConscript
+++ b/source/blender/render/SConscript
@@ -5,8 +5,8 @@ sources = env.Glob('intern/source/*.c')
 raysources = env.Glob('intern/raytrace/*.cpp')
 
 incs = 'intern/include #/intern/guardedalloc ../blenlib ../makesdna ../makesrna'
-incs += ' extern/include ../blenkernel ../radiosity/extern/include ../imbuf'
-incs += ' ../include ../blenloader ../../../intern/smoke/extern ../../../intern/mikktspace'
+incs += ' extern/include ../blenkernel ../imbuf ../blenfont'
+incs += ' ../include ../blenloader ../../../intern/smoke/extern ../../../intern/mikktspace ../bmesh'
 
 cflags_raytrace = env['CCFLAGS']
 cxxflags_raytrace = env['CXXFLAGS']
@@ -14,7 +14,8 @@ cxxflags_raytrace = env['CXXFLAGS']
 defs = []
 defs_raytrace = []
 
-defs.append('WITH_SMOKE')  # TODO, make optional
+if env['WITH_BF_SMOKE']:
+    defs.append('WITH_SMOKE')
 
 if env['WITH_BF_PYTHON']:
     incs += ' ../python'
@@ -28,7 +29,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
         cflags_raytrace = env['CCFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS']
         cxxflags_raytrace = env['CCFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS']
 
-if env['OURPLATFORM'] == 'win32-mingw':
+if env['OURPLATFORM'] in ('win32-mingw', 'win64-mingw'):
     if env['WITH_BF_RAYOPTIMIZATION']:
         cflags_raytrace = env['CCFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS']
         cxxflags_raytrace = env['CXXFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS']
@@ -59,7 +60,7 @@ if env['WITH_BF_OPENEXR']:
 if env['WITH_BF_GAMEENGINE']:
     defs.append('WITH_GAMEENGINE')
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
 
 #
diff --git a/source/blender/render/extern/include/RE_engine.h b/source/blender/render/extern/include/RE_engine.h
index 02a94e5..5afdb2a 100644
--- a/source/blender/render/extern/include/RE_engine.h
+++ b/source/blender/render/extern/include/RE_engine.h
@@ -29,8 +29,8 @@
  *  \ingroup render
  */
 
-#ifndef RE_ENGINE_H
-#define RE_ENGINE_H
+#ifndef __RE_ENGINE_H__
+#define __RE_ENGINE_H__
 
 #include "DNA_listBase.h"
 #include "RNA_types.h"
@@ -84,6 +84,7 @@ typedef struct RenderEngine {
 	void *py_instance;
 
 	int flag;
+	struct Object *camera_override;
 
 	struct Render *re;
 	ListBase fullresult;
@@ -116,5 +117,5 @@ void RE_engines_exit(void);
 
 RenderEngineType *RE_engines_find(const char *idname);
 
-#endif /* RE_ENGINE_H */
+#endif /* __RE_ENGINE_H__ */
 
diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h
index cc4136f..3159954 100644
--- a/source/blender/render/extern/include/RE_pipeline.h
+++ b/source/blender/render/extern/include/RE_pipeline.h
@@ -29,8 +29,8 @@
  *  \ingroup render
  */
 
-#ifndef RE_PIPELINE_H
-#define RE_PIPELINE_H
+#ifndef __RE_PIPELINE_H__
+#define __RE_PIPELINE_H__
 
 #include "DNA_listBase.h"
 #include "DNA_vec_types.h"
@@ -58,12 +58,12 @@ struct EnvMap;
 typedef struct Render Render;
 
 /* Render Result usage:
-
-- render engine allocates/frees and delivers raw floating point rects
-- right now it's full rects, but might become tiles or file 
-- the display client has to allocate display rects, sort out what to display, 
-  and how it's converted
-*/
+ *
+ * - render engine allocates/frees and delivers raw floating point rects
+ * - right now it's full rects, but might become tiles or file
+ * - the display client has to allocate display rects, sort out what to display,
+ *   and how it's converted
+ */
 
 typedef struct RenderPass {
 	struct RenderPass *next, *prev;
@@ -165,6 +165,8 @@ void RE_InitRenderCB(struct Render *re);
 void RE_FreeRender (struct Render *re);
 /* only called on exit */
 void RE_FreeAllRender (void);
+/* only call on file load */
+void RE_FreeAllRenderResults(void);
 
 /* get results and statistics */
 void RE_FreeRenderResult(struct RenderResult *rr);
@@ -272,5 +274,5 @@ struct Scene *RE_GetScene(struct Render *re);
 
 int RE_is_rendering_allowed(struct Scene *scene, struct Object *camera_override, struct ReportList *reports);
 
-#endif /* RE_PIPELINE_H */
+#endif /* __RE_PIPELINE_H__ */
 
diff --git a/source/blender/render/extern/include/RE_render_ext.h b/source/blender/render/extern/include/RE_render_ext.h
index f93e3c9..9d7393f 100644
--- a/source/blender/render/extern/include/RE_render_ext.h
+++ b/source/blender/render/extern/include/RE_render_ext.h
@@ -29,8 +29,8 @@
  */
 
 
-#ifndef RE_RENDER_EXT_H
-#define RE_RENDER_EXT_H
+#ifndef __RE_RENDER_EXT_H__
+#define __RE_RENDER_EXT_H__
 
 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
 /* this include is for non-render pipeline exports (still old cruft here) */
@@ -50,9 +50,6 @@ struct MTex;
 struct ImBuf;
 struct DerivedMesh;
 
-// RADIO REMOVED, Maybe this will be useful later
-//void    RE_zbufferall_radio(struct RadView *vw, struct RNode **rg_elem, int rg_totelem, struct Render *re);
-
 /* particle.c, effect.c, editmesh_modes.c and brush.c, returns 1 if rgb, 0 otherwise */
 int	externtex(struct MTex *mtex, const float vec[3], float *tin, float *tr, float *tg, float *tb, float *ta, const int thread);
 
@@ -70,5 +67,5 @@ void RE_free_sample_material(struct Material *mat);
 void RE_sample_material_color(struct Material *mat, float color[3], float *alpha, const float volume_co[3], const float surface_co[3],
 						   int face_index, short hit_quad, struct DerivedMesh *orcoDm, struct Object *ob);
 
-#endif /* RE_RENDER_EXT_H */
+#endif /* __RE_RENDER_EXT_H__ */
 
diff --git a/source/blender/render/extern/include/RE_shader_ext.h b/source/blender/render/extern/include/RE_shader_ext.h
index 2f585f9..cf9e6f7 100644
--- a/source/blender/render/extern/include/RE_shader_ext.h
+++ b/source/blender/render/extern/include/RE_shader_ext.h
@@ -29,8 +29,8 @@
  */
 
 
-#ifndef RE_SHADER_EXT_H
-#define RE_SHADER_EXT_H
+#ifndef __RE_SHADER_EXT_H__
+#define __RE_SHADER_EXT_H__
 
 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
 /* this include is for shading and texture exports            */
@@ -214,4 +214,4 @@ void RE_bake_ibuf_filter(struct ImBuf *ibuf, char *mask, const int filter);
 #define BAKE_RESULT_NO_OBJECTS		1
 #define BAKE_RESULT_FEEDBACK_LOOP	2
 
-#endif /* RE_SHADER_EXT_H */
+#endif /* __RE_SHADER_EXT_H__ */
diff --git a/source/blender/render/intern/include/envmap.h b/source/blender/render/intern/include/envmap.h
index 0133c08..2413888 100644
--- a/source/blender/render/intern/include/envmap.h
+++ b/source/blender/render/intern/include/envmap.h
@@ -33,8 +33,8 @@
  */
 
 
-#ifndef ENVMAP_EXT_H
-#define ENVMAP_EXT_H 
+#ifndef __ENVMAP_H__
+#define __ENVMAP_H__ 
 
 /**
  * Make environment maps for all objects in the scene that have an
@@ -48,5 +48,5 @@ struct TexResult;
 void make_envmaps(struct Render *re);
 int envmaptex(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres);
 
-#endif /* ENVMAP_EXT_H */
+#endif /* __ENVMAP_H__ */
 
diff --git a/source/blender/render/intern/include/gammaCorrectionTables.h b/source/blender/render/intern/include/gammaCorrectionTables.h
index 29ceef8..0df4248 100644
--- a/source/blender/render/intern/include/gammaCorrectionTables.h
+++ b/source/blender/render/intern/include/gammaCorrectionTables.h
@@ -33,11 +33,11 @@
  */
 
 
-#ifndef GAMMACORRECTIONTABLES_H
-#define GAMMACORRECTIONTABLES_H
+#ifndef __GAMMACORRECTIONTABLES_H__
+#define __GAMMACORRECTIONTABLES_H__
 
 /**
- * Initialise the gamma lookup tables
+ * Initialize the gamma lookup tables
  */
 void makeGammaTables(float gamma);
 
diff --git a/source/blender/render/intern/include/initrender.h b/source/blender/render/intern/include/initrender.h
index 17fa312..d206b15 100644
--- a/source/blender/render/intern/include/initrender.h
+++ b/source/blender/render/intern/include/initrender.h
@@ -33,8 +33,8 @@
  */
 
 
-#ifndef INITRENDER_H
-#define INITRENDER_H 
+#ifndef __INITRENDER_H__
+#define __INITRENDER_H__ 
 
 struct Object;
 
@@ -43,11 +43,9 @@ struct Object;
 void free_sample_tables(Render *re);
 void make_sample_tables(Render *re);
 
-void render_scene_set_window(Render *re, struct Object *camera, int blursample);
-
 void initparts(Render *re);
 void freeparts(Render *re);
 
 
-#endif /* INITRENDER_H */
+#endif /* __INITRENDER_H__ */
 
diff --git a/source/blender/render/intern/include/occlusion.h b/source/blender/render/intern/include/occlusion.h
index 15581c8..78a1f8a 100644
--- a/source/blender/render/intern/include/occlusion.h
+++ b/source/blender/render/intern/include/occlusion.h
@@ -31,8 +31,8 @@
  */
 
 
-#ifndef OCCLUSION_H
-#define OCCLUSION_H
+#ifndef __OCCLUSION_H__
+#define __OCCLUSION_H__
 
 struct Render;
 struct ShadeInput;
diff --git a/source/blender/render/intern/include/pixelblending.h b/source/blender/render/intern/include/pixelblending.h
index 87a5ed0..97d4110 100644
--- a/source/blender/render/intern/include/pixelblending.h
+++ b/source/blender/render/intern/include/pixelblending.h
@@ -28,12 +28,12 @@
  */
 
 
-#ifndef PIXELBLENDING_EXT_H
-#define PIXELBLENDING_EXT_H 
+#ifndef __PIXELBLENDING_H__
+#define __PIXELBLENDING_H__ 
 
 
 /**
-* add 1 pixel to into filtered three lines 
+ * add 1 pixel to into filtered three lines
  * (float vecs to float vec)
  */
 void add_filt_fmask(unsigned int mask, float *col, float *rowbuf, int row_w);
@@ -62,12 +62,4 @@ void addalphaAddfacFloat(float *dest, float *source, char addfac);
  */
 void addalphaAddFloat(float *dest, float *source);
 
-/**
- * Blend bron under doel, while doing gamma correction
- */
-void addalphaUnderGammaFloat(float *doel, float *bron);
-
-
-
-#endif /* PIXELBLENDING_EXT_H */
-
+#endif /* __PIXELBLENDING_H__ */
diff --git a/source/blender/render/intern/include/pixelshading.h b/source/blender/render/intern/include/pixelshading.h
index 6f4b373..00d7319 100644
--- a/source/blender/render/intern/include/pixelshading.h
+++ b/source/blender/render/intern/include/pixelshading.h
@@ -25,17 +25,12 @@
 
 /** \file blender/render/intern/include/pixelshading.h
  *  \ingroup render
+ *
+ * These functions determine what actual color a pixel will have.
  */
 
-
-/* pixelshading.h
-*
-* These functions determine what actual color a pixel will have.
-*/
-
-
-#ifndef PIXELSHADING_H
-#define PIXELSHADING_H
+#ifndef __PIXELSHADING_H__
+#define __PIXELSHADING_H__
 
 /**
  * Render the pixel at (x,y) for object ap. Apply the jitter mask. 
@@ -46,7 +41,7 @@
  * t[3] - type ZB_POLY or ZB_HALO
  * t[4] - max. distance
  * mask is pixel coverage in bits
- * @return pointer to the object
+ * \return pointer to the object
  */
 int shadeHaloFloat(HaloRen *har, 
 					float *col, int zz, 
diff --git a/source/blender/render/intern/include/pointdensity.h b/source/blender/render/intern/include/pointdensity.h
index 7ceb24e..cc8fabd 100644
--- a/source/blender/render/intern/include/pointdensity.h
+++ b/source/blender/render/intern/include/pointdensity.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef POINTDENSITY_H
-#define POINTDENSITY_H 
+#ifndef __POINTDENSITY_H__
+#define __POINTDENSITY_H__ 
 
 /**
  * Make point density kd-trees for all point density textures in the scene
@@ -45,5 +45,5 @@ void make_pointdensities(struct Render *re);
 void free_pointdensities(struct Render *re);
 int pointdensitytex(struct Tex *tex, float *texvec, struct TexResult *texres);
 
-#endif /* POINTDENSITY_H */
+#endif /* __POINTDENSITY_H__ */
 
diff --git a/source/blender/render/intern/include/raycounter.h b/source/blender/render/intern/include/raycounter.h
index 20348f8..075a633 100644
--- a/source/blender/render/intern/include/raycounter.h
+++ b/source/blender/render/intern/include/raycounter.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef RE_RAYCOUNTER_H
-#define RE_RAYCOUNTER_H
+#ifndef __RAYCOUNTER_H__
+#define __RAYCOUNTER_H__
 
 //#define RE_RAYCOUNTER			/* enable counters per ray, useful for measuring raytrace structures performance */
 
diff --git a/source/blender/render/intern/include/rayintersection.h b/source/blender/render/intern/include/rayintersection.h
index 2c68421..4dceae5 100644
--- a/source/blender/render/intern/include/rayintersection.h
+++ b/source/blender/render/intern/include/rayintersection.h
@@ -31,8 +31,8 @@
  */
 
 
-#ifndef __RENDER_RAYINTERSECTION_H__
-#define __RENDER_RAYINTERSECTION_H__
+#ifndef __RAYINTERSECTION_H__
+#define __RAYINTERSECTION_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -59,7 +59,7 @@ typedef struct RayHint {
 
 typedef struct Isect {
 	/* ray start, direction (normalized vector), and max distance. on hit,
-	   the distance is modified to be the distance to the hit point. */
+	 * the distance is modified to be the distance to the hit point. */
 	float start[3];
 	float dir[3];
 	float dist;
@@ -123,5 +123,5 @@ typedef struct Isect {
 }
 #endif
 
-#endif /* __RENDER_RAYINTERSECTION_H__ */
+#endif /* __RAYINTERSECTION_H__ */
 
diff --git a/source/blender/render/intern/include/rayobject.h b/source/blender/render/intern/include/rayobject.h
index 3ca3bd6..ce20ce4 100644
--- a/source/blender/render/intern/include/rayobject.h
+++ b/source/blender/render/intern/include/rayobject.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef RE_RAYOBJECT_H
-#define RE_RAYOBJECT_H
+#ifndef __RAYOBJECT_H__
+#define __RAYOBJECT_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -43,11 +43,10 @@ struct RayHint;
 struct VlakRen;
 
 /* RayObject
-
-   Can be a face/triangle, bvh tree, object instance, etc. This is the
-   public API used by the renderer, see rayobject_internal.h for the
-   internal implementation details. */
-
+ * Can be a face/triangle, bvh tree, object instance, etc. This is the
+ * public API used by the renderer, see rayobject_internal.h for the
+ * internal implementation details.
+ * */
 typedef struct RayObject RayObject;
 
 /* Intersection, see rayintersection.h */
@@ -74,8 +73,8 @@ void RE_rayobject_free(RayObject *r);
 void RE_rayobject_set_control(RayObject *r, void *data, int (*test_break)(void *data));
 
 /* RayObject representing faces, all data is locally available instead
-   of referring to some external data structure, for possibly faster
-   intersection tests. */
+ * of referring to some external data structure, for possibly faster
+ * intersection tests. */
 
 typedef struct RayFace {
 	float v1[4], v2[4], v3[4], v4[3];
@@ -89,8 +88,8 @@ typedef struct RayFace {
 RayObject* RE_rayface_from_vlak(RayFace *face, struct ObjectInstanceRen *obi, struct VlakRen *vlr);
 
 /* RayObject representing faces directly from a given VlakRen structure. Thus
-   allowing to save memory, but making code triangle intersection dependant on
-   render structures. */
+ * allowing to save memory, but making code triangle intersection dependent on
+ * render structures. */
 
 typedef struct VlakPrimitive {
 	struct ObjectInstanceRen *ob;
@@ -104,10 +103,10 @@ RayObject* RE_vlakprimitive_from_vlak(VlakPrimitive *face, struct ObjectInstance
 /* extend min/max coords so that the rayobject is inside them */
 void RE_rayobject_merge_bb(RayObject *ob, float *min, float *max);
 
-/* initializes an hint for optiming raycast where it is know that a ray will pass by the given BB often the origin point */
+/* 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);
 
-/* initializes an hint for optiming raycast where it is know that a ray will be contained inside the given cone*/
+/* 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 *); */
 
 /* Internals */
diff --git a/source/blender/render/intern/include/render_result.h b/source/blender/render/intern/include/render_result.h
index 93cbc6f..3d73ee1 100644
--- a/source/blender/render/intern/include/render_result.h
+++ b/source/blender/render/intern/include/render_result.h
@@ -29,8 +29,8 @@
  *  \ingroup render
  */
 
-#ifndef RENDER_RESULT_H
-#define RENDER_RESULT_H
+#ifndef __RENDER_RESULT_H__
+#define __RENDER_RESULT_H__
 
 #define PASS_VECTOR_MAX	10000.0f
 
@@ -90,5 +90,5 @@ void render_result_rect_fill_zero(struct RenderResult *rr);
 void render_result_rect_get_pixels(struct RenderResult *rr, struct RenderData *rd,
 	unsigned int *rect, int rectx, int recty);
 
-#endif /* RENDER_RESULT_H */
+#endif /* __RENDER_RESULT_H__ */
 
diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h
index f414be6..7425556 100644
--- a/source/blender/render/intern/include/render_types.h
+++ b/source/blender/render/intern/include/render_types.h
@@ -28,8 +28,8 @@
  */
 
 
-#ifndef RENDER_TYPES_H
-#define RENDER_TYPES_H
+#ifndef __RENDER_TYPES_H__
+#define __RENDER_TYPES_H__
 
 /* ------------------------------------------------------------------------- */
 /* exposed internal in render module only! */
@@ -131,8 +131,8 @@ struct Render
 	/* a list of RenderResults, for fullsample */
 	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 */
+	 * 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 */
 	ThreadRWMutex resultmutex;
 	
 	/* window size, display rect, viewplane */
@@ -149,7 +149,7 @@ struct Render
 	/* 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 */
+	 * partx*xparts can be larger than rectx, in that case last part is smaller */
 	int partx, party;
 	
 	/* values for viewing */
@@ -190,7 +190,7 @@ struct Render
 	struct RayObject *raytree;
 	struct RayFace *rayfaces;
 	struct VlakPrimitive *rayprimitives;
-	float maxdist; /* needed for keeping an incorrect behaviour of SUN and HEMI lights (avoid breaking old scenes) */
+	float maxdist; /* needed for keeping an incorrect behavior of SUN and HEMI lights (avoid breaking old scenes) */
 
 	/* occlusion tree */
 	void *occlusiontree;
@@ -229,8 +229,8 @@ struct Render
 	ListBase volume_precache_parts;
 
 	/* arena for allocating data for use during render, for
-		* example dynamic TFaces to go in the VlakRen structure.
-		*/
+	 * example dynamic TFaces to go in the VlakRen structure.
+	 */
 	struct MemArena *memArena;
 	
 	/* callbacks */
@@ -628,5 +628,5 @@ typedef struct LampRen {
 #define R_ENV_TRANSFORMED	2
 #define R_TRANSFORMED		(1|2)
 
-#endif /* RENDER_TYPES_H */
+#endif /* __RENDER_TYPES_H__ */
 
diff --git a/source/blender/render/intern/include/rendercore.h b/source/blender/render/intern/include/rendercore.h
index 08f73cc..3585f24 100644
--- a/source/blender/render/intern/include/rendercore.h
+++ b/source/blender/render/intern/include/rendercore.h
@@ -33,8 +33,8 @@
  */
 
 
-#ifndef RENDERCORE_H
-#define RENDERCORE_H 
+#ifndef __RENDERCORE_H__
+#define __RENDERCORE_H__ 
 
 #include "render_types.h"
 
@@ -84,9 +84,6 @@ void calc_renderco_ortho(float co[3], float x, float y, int z);
 
 int count_mask(unsigned short mask);
 
-void zbufshade(void);
-void zbufshadeDA(void);	/* Delta Accum Pixel Struct */
-
 void zbufshade_tile(struct RenderPart *pa);
 void zbufshadeDA_tile(struct RenderPart *pa);
 
diff --git a/source/blender/render/intern/include/renderdatabase.h b/source/blender/render/intern/include/renderdatabase.h
index ebbbfb0..298fc3b 100644
--- a/source/blender/render/intern/include/renderdatabase.h
+++ b/source/blender/render/intern/include/renderdatabase.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef RENDERDATABASE_H
-#define RENDERDATABASE_H
+#ifndef __RENDERDATABASE_H__
+#define __RENDERDATABASE_H__
 
 struct Object;
 struct VlakRen;
@@ -88,7 +88,6 @@ void free_renderdata_tables(struct Render *re);
 void free_renderdata_vertnodes(struct VertTableNode *vertnodes);
 void free_renderdata_vlaknodes(struct VlakTableNode *vlaknodes);
 
-void set_normalflags(struct Render *re, struct ObjectRen *obr);
 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]);
 
@@ -105,7 +104,6 @@ struct StrandBuffer *RE_addStrandBuffer(struct ObjectRen *obr, int totvert);
 struct ObjectRen *RE_addRenderObject(struct Render *re, struct Object *ob, struct Object *par, int index, int psysindex, int lay);
 struct ObjectInstanceRen *RE_addRenderInstance(struct Render *re, struct ObjectRen *obr, struct Object *ob, struct Object *par, int index, int psysindex, float mat[][4], int lay);
 void RE_makeRenderInstances(struct Render *re);
-void RE_instanceTransformNormal(struct ObjectInstanceRen *obi, float *nor, float *tnor);
 
 float *RE_vertren_get_sticky(struct ObjectRen *obr, struct VertRen *ver, int verify);
 float *RE_vertren_get_stress(struct ObjectRen *obr, struct VertRen *ver, int verify);
@@ -144,5 +142,5 @@ void init_render_world(Render *re);
 void RE_Database_FromScene_Vectors(Render *re, struct Main *bmain, struct Scene *sce, unsigned int lay);
 
 
-#endif /* RENDERDATABASE_H */
+#endif /* __RENDERDATABASE_H__ */
 
diff --git a/source/blender/render/intern/include/renderpipeline.h b/source/blender/render/intern/include/renderpipeline.h
index 9a87cf8..e713d48 100644
--- a/source/blender/render/intern/include/renderpipeline.h
+++ b/source/blender/render/intern/include/renderpipeline.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef PIPELINE_H
-#define PIPELINE_H
+#ifndef __RENDERPIPELINE_H__
+#define __RENDERPIPELINE_H__
 
 struct Render;
 struct RenderLayer;
@@ -40,5 +40,5 @@ struct RenderResult;
 struct RenderLayer *render_get_active_layer(struct Render *re, struct RenderResult *rr);
 float panorama_pixel_rot(struct Render *re);
 
-#endif /* PIPELINE_H */
+#endif /* __RENDERPIPELINE_H__ */
 
diff --git a/source/blender/render/intern/include/shadbuf.h b/source/blender/render/intern/include/shadbuf.h
index a37af5a..4b3595a 100644
--- a/source/blender/render/intern/include/shadbuf.h
+++ b/source/blender/render/intern/include/shadbuf.h
@@ -33,8 +33,8 @@
  */
 
 
-#ifndef SHADBUF_EXT_H
-#define SHADBUF_EXT_H
+#ifndef __SHADBUF_H__
+#define __SHADBUF_H__
 
 #include "render_types.h"
 
@@ -42,7 +42,7 @@ struct ObjectRen;
 
 /**
  * Calculates shadowbuffers for a vector of shadow-giving lamps
- * @param lar The vector of lamps
+ * \param lar The vector of lamps
  */
 void makeshadowbuf(struct Render *re, LampRen *lar);
 void freeshadowbuf(struct LampRen *lar);
@@ -52,10 +52,10 @@ void threaded_makeshadowbufs(struct Render *re);
 /**
  * Determines the shadow factor for a face and lamp. There is some
  * communication with global variables here.
- * @returns The shadow factors: 1.0 for no shadow, 0.0 for complete
- *          shadow.
- * @param shb The shadowbuffer to find the shadow factor in.
- * @param inp The inproduct between viewvector and ?
+ * \return The shadow factors: 1.0 for no shadow, 0.0 for complete
+ *         shadow.
+ * \param shb The shadowbuffer to find the shadow factor in.
+ * \param inp The inproduct between viewvector and ?
  *
  */
 float testshadowbuf(struct Render *re, struct ShadBuf *shb, const float rco[3], const float dxco[3], const float dyco[3], float inp, float mat_bias);
@@ -114,5 +114,5 @@ typedef struct ISBData {
 	int minx, miny, rectx, recty;	/* copy from part disprect */
 } ISBData;
 
-#endif /* SHADBUF_EXT_H */
+#endif /* __SHADBUF_H__ */
 
diff --git a/source/blender/render/intern/include/shading.h b/source/blender/render/intern/include/shading.h
index ded7139..558342a 100644
--- a/source/blender/render/intern/include/shading.h
+++ b/source/blender/render/intern/include/shading.h
@@ -56,7 +56,6 @@ typedef struct ShadeSample {
 
 	/* also the node shader callback */
 void shade_material_loop(struct ShadeInput *shi, struct ShadeResult *shr);
-void shade_volume_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);
diff --git a/source/blender/render/intern/include/sss.h b/source/blender/render/intern/include/sss.h
index 4e110da..6a179d2 100644
--- a/source/blender/render/intern/include/sss.h
+++ b/source/blender/render/intern/include/sss.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef SSS_H
-#define SSS_H
+#ifndef __SSS_H__
+#define __SSS_H__
 
 /* Generic multiple scattering API */
 
@@ -64,5 +64,5 @@ void free_sss(struct Render *re);
 int sample_sss(struct Render *re, struct Material *mat, float *co, float *col);
 int sss_pass_done(struct Render *re, struct Material *mat);
 
-#endif /*SSS_H*/
+#endif /*__SSS_H__*/
 
diff --git a/source/blender/render/intern/include/strand.h b/source/blender/render/intern/include/strand.h
index 1cf34c7..5094b64 100644
--- a/source/blender/render/intern/include/strand.h
+++ b/source/blender/render/intern/include/strand.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef STRAND_H
-#define STRAND_H 
+#ifndef __STRAND_H__
+#define __STRAND_H__ 
 
 struct StrandVert;
 struct StrandRen;
@@ -103,14 +103,5 @@ void strand_shade_cache_free(struct StrandShadeCache *cache);
 void strand_shade_segment(struct Render *re, struct StrandShadeCache *cache, struct StrandSegment *sseg, struct ShadeSample *ssamp, float t, float s, int addpassflag);
 void strand_shade_unref(struct StrandShadeCache *cache, struct StrandVert *svert);
 
-struct RenderBuckets *init_buckets(struct Render *re);
-void add_buckets_primitive(struct RenderBuckets *buckets, float *min, float *max, void *prim);
-void free_buckets(struct RenderBuckets *buckets);
-void project_hoco_to_bucket(struct RenderBuckets *buckets, float *hoco, float *bucketco);
-
-struct RenderPrimitiveIterator *init_primitive_iterator(struct Render *re, struct RenderBuckets *buckets, struct RenderPart *pa);
-void *next_primitive_iterator(struct RenderPrimitiveIterator *iter);
-void free_primitive_iterator(struct RenderPrimitiveIterator *iter);
-
 #endif
 
diff --git a/source/blender/render/intern/include/sunsky.h b/source/blender/render/intern/include/sunsky.h
index 8c0cbfd..6a41517 100644
--- a/source/blender/render/intern/include/sunsky.h
+++ b/source/blender/render/intern/include/sunsky.h
@@ -24,13 +24,8 @@
  *  \ingroup render
  */
 
-/**
- * This feature comes from Preetham paper on "A Practical Analytic Model for Daylight" 
- * and example code from Brian Smits, another author of that paper in 
- * http://www.cs.utah.edu/vissim/papers/sunsky/code/
- * */
-#ifndef SUNSKY_H_
-#define SUNSKY_H_
+#ifndef __SUNSKY_H__
+#define __SUNSKY_H__
 
 #define SPECTRUM_MAX_COMPONENTS     100
 #define SPECTRUM_START              350.0
@@ -41,14 +36,14 @@ typedef struct SunSky
 	short effect_type, skyblendtype, sky_colorspace;
 	float turbidity;
 	float theta, phi;
-    
+
 	float toSun[3];
 
 	/*float sunSpectralRaddata[SPECTRUM_MAX_COMPONENTS];*/
 	float sunSolidAngle;
 
 	float zenith_Y, zenith_x, zenith_y;
-    
+
 	float perez_Y[5], perez_x[5], perez_y[5];
 
 	/* suggested by glome in 
@@ -75,75 +70,16 @@ typedef struct SunSky
 	float atm_BetaMie[3];
 	float atm_BetaDashMie[3];
 	float atm_BetaRM[3];
-}SunSky;
+} SunSky;
 
-/**
- * InitSunSky:
- * this function compute some sun,sky parameters according to input parameters and also initiate some other sun, sky parameters
- * parameters:
- * sunSky, is a structure that contains informtion about sun, sky and atmosphere, in this function, most of its values initiated
- * turb, is atmosphere turbidity
- * toSun, contains sun direction
- * horizon_brighness, controls the brightness of the horizon colors
- * spread, controls colors spreed at horizon
- * sun_brightness, controls sun's brightness
- * sun_size, controls sun's size
- * back_scatter, controls back scatter light
- * */
 void InitSunSky(struct SunSky *sunsky, float turb, float *toSun, float horizon_brightness, 
-				float spread,float sun_brightness, float sun_size, float back_scatter,
-				float skyblendfac, short skyblendtype, float sky_exposure, float sky_colorspace);
-
-/**
- * GetSkyXYZRadiance:
- * this function compute sky radiance according to a view parameters `theta' and `phi'and sunSky values
- * parameters:
- * sunSky, sontains sun and sky parameters
- * theta, is sun's theta
- * phi, is sun's phi
- * color_out, is computed color that shows sky radiance in XYZ color format
- * */
-void GetSkyXYZRadiance(struct SunSky* sunsky, float theta, float phi, float color_out[3]);
+                float spread,float sun_brightness, float sun_size, float back_scatter,
+                float skyblendfac, short skyblendtype, float sky_exposure, float sky_colorspace);
 
-/**
- * GetSkyXYZRadiancef:
- * this function compute sky radiance according to a view direction `varg' and sunSky values
- * parameters:
- * sunSky, sontains sun and sky parameters
- * varg, shows direction
- * color_out, is computed color that shows sky radiance in XYZ color format
- * */
-void GetSkyXYZRadiancef(struct SunSky* sunsky, const float varg[3], float color_out[3]);
-
-/**
- * InitAtmosphere:
- * this function intiate sunSky structure with user input parameters.
- * parameters:
- * sunSky, contains information about sun, and in this function some atmosphere parameters will initiated
- * sun_intens, shows sun intensity value
- * mief, Mie scattering factor this factor currently call with 1.0 
- * rayf, Rayleigh scattering factor, this factor currently call with 1.0
- * inscattf, inscatter light factor that range from 0.0 to 1.0, 0.0 means no inscatter light and 1.0 means full inscatter light
- * extincf, extinction light factor that range from 0.0 to 1.0, 0.0 means no extinction and 1.0 means full extinction
- * disf, is distance factor, multiplyed to pixle's z value to compute each pixle's distance to camera, 
- * */
+void GetSkyXYZRadiance(struct SunSky *sunsky, float theta, float phi, float color_out[3]);
+void GetSkyXYZRadiancef(struct SunSky *sunsky, const float varg[3], float color_out[3]);
 void InitAtmosphere(struct SunSky *sunSky, float sun_intens, float mief, float rayf, float inscattf, float extincf, float disf);
-
-/**
- * AtmospherePixleShader:
- * this function apply atmosphere effect on a pixle color `rgb' at distance `s'
- * parameters:
- * sunSky, contains information about sun parameters and user values
- * view, is camera view vector
- * s, is distance 
- * rgb, contains rendered color value for a pixle
- * */
-void AtmospherePixleShader( struct SunSky* sunSky, float view[3], float s, float rgb[3]);
-
-/**
- * ClipColor:
- * clip a color to range [0,1];
- * */
+void AtmospherePixleShader(struct SunSky *sunSky, float view[3], float s, float rgb[3]);
 void ClipColor(float c[3]);
 
-#endif /*SUNSKY_H_*/
+#endif /*__SUNSKY_H__*/
diff --git a/source/blender/render/intern/include/texture.h b/source/blender/render/intern/include/texture.h
index a8d1307..e5013ac 100644
--- a/source/blender/render/intern/include/texture.h
+++ b/source/blender/render/intern/include/texture.h
@@ -33,8 +33,8 @@
  */
 
 
-#ifndef TEXTURE_EXT_H
-#define TEXTURE_EXT_H
+#ifndef __TEXTURE_H__
+#define __TEXTURE_H__
 
 #define BRICONT                                                               \
 	texres->tin= (texres->tin-0.5f) * tex->contrast+tex->bright-0.5f;         \
@@ -85,5 +85,5 @@ int imagewraposa(struct Tex *tex, struct Image *ima, struct ImBuf *ibuf, const f
 int imagewrap(struct Tex *tex, struct Image *ima, struct ImBuf *ibuf, const float texvec[3], struct TexResult *texres);
 void image_sample(struct Image *ima, float fx, float fy, float dx, float dy, float *result);
 
-#endif /* TEXTURE_EXT_H */
+#endif /* __TEXTURE_H__ */
 
diff --git a/source/blender/render/intern/include/texture_ocean.h b/source/blender/render/intern/include/texture_ocean.h
index b0a0647..7d4110a 100644
--- a/source/blender/render/intern/include/texture_ocean.h
+++ b/source/blender/render/intern/include/texture_ocean.h
@@ -23,6 +23,4 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-void prepare_ocean_tex_modifier(struct OceanTex *ot);
-
 int ocean_texture(struct Tex *tex, float *texvec, struct TexResult *texres);
diff --git a/source/blender/render/intern/include/voxeldata.h b/source/blender/render/intern/include/voxeldata.h
index aa4a9fd..6362033 100644
--- a/source/blender/render/intern/include/voxeldata.h
+++ b/source/blender/render/intern/include/voxeldata.h
@@ -29,9 +29,8 @@
  *  \ingroup render
  */
 
-
-#ifndef VOXELDATA_H
-#define VOXELDATA_H 
+#ifndef __VOXELDATA_H__
+#define __VOXELDATA_H__ 
 
 struct Render;
 struct TexResult;
@@ -44,7 +43,6 @@ typedef struct VoxelDataHeader
 
 void cache_voxeldata(Tex *tex, int scene_frame);
 void make_voxeldata(struct Render *re);
-void free_voxeldata(struct Render *re);
-int voxeldatatex(struct Tex *tex, const float texvec[3], struct TexResult *texres);
+int  voxeldatatex(struct Tex *tex, const float texvec[3], struct TexResult *texres);
 
-#endif /* VOXELDATA_H */
+#endif /* __VOXELDATA_H__ */
diff --git a/source/blender/render/intern/include/zbuf.h b/source/blender/render/intern/include/zbuf.h
index c467c31..518b2f8 100644
--- a/source/blender/render/intern/include/zbuf.h
+++ b/source/blender/render/intern/include/zbuf.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef ZBUF_H
-#define ZBUF_H
+#ifndef __ZBUF_H__
+#define __ZBUF_H__
 
 struct RenderPart;
 struct RenderLayer;
diff --git a/source/blender/render/intern/raytrace/bvh.h b/source/blender/render/intern/raytrace/bvh.h
index cdc905f..ac86a65 100644
--- a/source/blender/render/intern/raytrace/bvh.h
+++ b/source/blender/render/intern/raytrace/bvh.h
@@ -46,8 +46,8 @@
 #include <xmmintrin.h>
 #endif
 
-#ifndef RE_RAYTRACE_BVH_H
-#define RE_RAYTRACE_BVH_H
+#ifndef __BVH_H__
+#define __BVH_H__
 
 #ifdef __SSE__
 inline int test_bb_group4(__m128 *bb_group, const Isect *isec)
@@ -97,8 +97,6 @@ static int rayobject_bb_intersect_test(const Isect *isec, const float *_bb)
 }
 
 /* bvh tree generics */
-template<class Tree> static int bvh_intersect(Tree *obj, Isect *isec);
-
 template<class Tree> static void bvh_add(Tree *obj, RayObject *ob)
 {
 	rtbuild_add( obj->builder, ob );
@@ -269,7 +267,7 @@ static int bvh_node_stack_raycast_simd(Node *root, Isect *isec)
 			const __m128 Y2Z2Y3Z3 = _mm_shuffle_ps( _mm_load_ps(bb2+4), _mm_load_ps(bb3+4), _MM_SHUFFLE(1,0,1,0) );
 			t_bb[4] = _mm_shuffle_ps( Y0Z0Y1Z1, Y2Z2Y3Z3, _MM_SHUFFLE(2,0,2,0) );
 			t_bb[5] = _mm_shuffle_ps( Y0Z0Y1Z1, Y2Z2Y3Z3, _MM_SHUFFLE(3,1,3,1) );
-/*			
+#if 0
 			for(int i=0; i<4; i++)
 			{
 				Node *t = stack[stack_pos+i];
@@ -284,7 +282,7 @@ static int bvh_node_stack_raycast_simd(Node *root, Isect *isec)
 				bb[4*5] = t->bb[5];
 				t_node[i] = t->child;
 			}
-*/
+#endif
 			RE_RC_COUNT(isec->raycounter->simd_bb.test);
 			int res = test_bb_group4( t_bb, isec );
 
@@ -335,7 +333,7 @@ static int bvh_node_stack_raycast_simd(Node *root, Isect *isec)
 /*
  * recursively transverse a BVH looking for a rayhit using system stack
  */
-/*
+#if 0
 template<class Node>
 static int bvh_node_raycast(Node *node, Isect *isec)
 {
@@ -380,7 +378,7 @@ static int bvh_node_raycast(Node *node, Isect *isec)
 	}
 	return hit;
 }
-*/
+#endif
 
 template<class Node,class HintObject>
 void bvh_dfs_make_hint(Node *node, LCTSHint *hint, int reserve_space, HintObject *hintObject)
diff --git a/source/blender/render/intern/raytrace/rayobject.cpp b/source/blender/render/intern/raytrace/rayobject.cpp
index ef31e73..b2f85e8 100644
--- a/source/blender/render/intern/raytrace/rayobject.cpp
+++ b/source/blender/render/intern/raytrace/rayobject.cpp
@@ -45,10 +45,10 @@
 #include "render_types.h"
 
 /* RayFace
-
-   note we force always inline here, because compiler refuses to otherwise
-   because function is too long. Since this is code that is called billions
-   of times we really do want to inline. */
+ *
+ * note we force always inline here, because compiler refuses to otherwise
+ * because function is too long. Since this is code that is called billions
+ * of times we really do want to inline. */
 
 MALWAYS_INLINE RayObject* rayface_from_coords(RayFace *rayface, void *ob, void *face,
                                               float *v1, float *v2, float *v3, float *v4)
@@ -60,7 +60,7 @@ MALWAYS_INLINE RayObject* rayface_from_coords(RayFace *rayface, void *ob, void *
 	copy_v3_v3(rayface->v2, v2);
 	copy_v3_v3(rayface->v3, v3);
 
-	if(v4)
+	if (v4)
 	{
 		copy_v3_v3(rayface->v4, v4);
 		rayface->quad = 1;
@@ -75,15 +75,15 @@ MALWAYS_INLINE RayObject* rayface_from_coords(RayFace *rayface, void *ob, void *
 
 MALWAYS_INLINE void rayface_from_vlak(RayFace *rayface, ObjectInstanceRen *obi, VlakRen *vlr)
 {
-	rayface_from_coords(rayface, obi, vlr, vlr->v1->co, vlr->v2->co, vlr->v3->co, vlr->v4 ? vlr->v4->co : 0);
+	rayface_from_coords(rayface, obi, vlr, vlr->v1->co, vlr->v2->co, vlr->v3->co, vlr->v4 ? vlr->v4->co : NULL);
 
-	if(obi->transform_primitives)
+	if (obi->transform_primitives)
 	{
 		mul_m4_v3(obi->mat, rayface->v1);
 		mul_m4_v3(obi->mat, rayface->v2);
 		mul_m4_v3(obi->mat, rayface->v3);
 
-		if(RE_rayface_isQuad(rayface))
+		if (RE_rayface_isQuad(rayface))
 			mul_m4_v3(obi->mat, rayface->v4);
 	}
 }
@@ -109,11 +109,11 @@ MALWAYS_INLINE int vlr_check_intersect(Isect *is, ObjectInstanceRen *obi, VlakRe
 {
 	/* for baking selected to active non-traceable materials might still
 	 * be in the raytree */
-	if(!(vlr->flag & R_TRACEBLE))
+	if (!(vlr->flag & R_TRACEBLE))
 		return 0;
 
 	/* I know... cpu cycle waste, might do smarter once */
-	if(is->mode==RE_RAY_MIRROR)
+	if (is->mode==RE_RAY_MIRROR)
 		return !(vlr->mat->mode & MA_ONLYCAST);
 	else
 		return (is->lay & obi->lay);
@@ -159,21 +159,21 @@ MALWAYS_INLINE int isec_tri_quad(float start[3], float dir[3], RayFace *face, fl
 	sub_v3_v3v3(m, start, co3);
 	det1= dot_v3v3(m, x);
 	
-	if(divdet != 0.0f) {
+	if (divdet != 0.0f) {
 		divdet= 1.0f/divdet;
 		v= det1*divdet;
 
-		if(v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) {
+		if (v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) {
 			float cros[3];
 
 			cross_v3_v3v3(cros, m, t0);
 			u= divdet*dot_v3v3(cros, r);
 
-			if(u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON)) {
+			if (u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON)) {
 				l= divdet*dot_v3v3(cros, t1);
 
 				/* check if intersection is within ray length */
-				if(l > -RE_RAYTRACE_EPSILON && l < *lambda) {
+				if (l > -RE_RAYTRACE_EPSILON && l < *lambda) {
 					uv[0]= u;
 					uv[1]= v;
 					*lambda= l;
@@ -184,25 +184,25 @@ MALWAYS_INLINE int isec_tri_quad(float start[3], float dir[3], RayFace *face, fl
 	}
 
 	/* intersect second triangle in quad */
-	if(quad) {
+	if (quad) {
 		copy_v3_v3(co4, face->v4);
 		sub_v3_v3v3(t0, co3, co4);
 		divdet= dot_v3v3(t0, x);
 
-		if(divdet != 0.0f) {
+		if (divdet != 0.0f) {
 			divdet= 1.0f/divdet;
 			v = det1*divdet;
 			
-			if(v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) {
+			if (v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) {
 				float cros[3];
 
 				cross_v3_v3v3(cros, m, t0);
 				u= divdet*dot_v3v3(cros, r);
 	
-				if(u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON)) {
+				if (u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON)) {
 					l= divdet*dot_v3v3(cros, t1);
 					
-					if(l >- RE_RAYTRACE_EPSILON && l < *lambda) {
+					if (l >- RE_RAYTRACE_EPSILON && l < *lambda) {
 						uv[0]= u;
 						uv[1]= -(1.0f + v + u);
 						*lambda= l;
@@ -242,38 +242,38 @@ MALWAYS_INLINE int isec_tri_quad_neighbour(float start[3], float dir[3], RayFace
 	sub_v3_v3v3(m, start, co3);
 	det1= dot_v3v3(m, x);
 	
-	if(divdet != 0.0f) {
+	if (divdet != 0.0f) {
 		divdet= 1.0f/divdet;
 		v= det1*divdet;
 
-		if(v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) {
+		if (v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) {
 			float cros[3];
 
 			cross_v3_v3v3(cros, m, t0);
 			u= divdet*dot_v3v3(cros, r);
 
-			if(u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON))
+			if (u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON))
 				return 1;
 		}
 	}
 
 	/* intersect second triangle in quad */
-	if(quad) {
+	if (quad) {
 		copy_v3_v3(co4, face->v4);
 		sub_v3_v3v3(t0, co3, co4);
 		divdet= dot_v3v3(t0, x);
 
-		if(divdet != 0.0f) {
+		if (divdet != 0.0f) {
 			divdet= 1.0f/divdet;
 			v = det1*divdet;
 			
-			if(v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) {
+			if (v < RE_RAYTRACE_EPSILON && v > -(1.0f+RE_RAYTRACE_EPSILON)) {
 				float cros[3];
 
 				cross_v3_v3v3(cros, m, t0);
 				u= divdet*dot_v3v3(cros, r);
 	
-				if(u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON))
+				if (u < RE_RAYTRACE_EPSILON && (v + u) > -(1.0f+RE_RAYTRACE_EPSILON))
 					return 2;
 			}
 		}
@@ -282,8 +282,8 @@ MALWAYS_INLINE int isec_tri_quad_neighbour(float start[3], float dir[3], RayFace
 	return 0;
 }
 
-/* RayFace intersection with checks and neighbour verifaction included,
-   Isect is modified if the face is hit. */
+/* RayFace intersection with checks and neighbor verifaction included,
+ * Isect is modified if the face is hit. */
 
 MALWAYS_INLINE int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *is)
 {
@@ -291,24 +291,24 @@ MALWAYS_INLINE int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *i
 	int ok= 0;
 	
 	/* avoid self-intersection */
-	if(is->orig.ob == face->ob && is->orig.face == face->face)
+	if (is->orig.ob == face->ob && is->orig.face == face->face)
 		return 0;
 		
 	/* check if we should intersect this face */
-	if(is->check == RE_CHECK_VLR_RENDER)
+	if (is->check == RE_CHECK_VLR_RENDER)
 	{
-		if(vlr_check_intersect(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0)
+		if (vlr_check_intersect(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0)
 			return 0;
 	}
-	else if(is->check == RE_CHECK_VLR_NON_SOLID_MATERIAL)
+	else if (is->check == RE_CHECK_VLR_NON_SOLID_MATERIAL)
 	{
-		if(vlr_check_intersect(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0)
+		if (vlr_check_intersect(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0)
 			return 0;
-		if(vlr_check_intersect_solid(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0)
+		if (vlr_check_intersect_solid(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0)
 			return 0;
 	}
-	else if(is->check == RE_CHECK_VLR_BAKE) {
-		if(vlr_check_bake(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0)
+	else if (is->check == RE_CHECK_VLR_BAKE) {
+		if (vlr_check_bake(is, (ObjectInstanceRen*)face->ob, (VlakRen*)face->face) == 0)
 			return 0;
 	}
 
@@ -318,21 +318,21 @@ MALWAYS_INLINE int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *i
 	dist= is->dist;
 	ok= isec_tri_quad(is->start, is->dir, face, uv, &dist);
 
-	if(ok) {
+	if (ok) {
 	
 		/* when a shadow ray leaves a face, it can be little outside the edges
-		   of it, causing intersection to be detected in its neighbour face */
-		if(is->skip & RE_SKIP_VLR_NEIGHBOUR)
+		 * of it, causing intersection to be detected in its neighbor face */
+		if (is->skip & RE_SKIP_VLR_NEIGHBOUR)
 		{
-			if(dist < 0.1f && is->orig.ob == face->ob)
+			if (dist < 0.1f && is->orig.ob == face->ob)
 			{
 				VlakRen * a = (VlakRen*)is->orig.face;
 				VlakRen * b = (VlakRen*)face->face;
 
 				/* so there's a shared edge or vertex, let's intersect ray with
-				   face itself, if that's true we can safely return 1, otherwise
-				   we assume the intersection is invalid, 0 */
-				if(a->v1==b->v1 || a->v2==b->v1 || a->v3==b->v1 || a->v4==b->v1
+				 * face itself, if that's true we can safely return 1, otherwise
+				 * we assume the intersection is invalid, 0 */
+				if (a->v1==b->v1 || a->v2==b->v1 || a->v3==b->v1 || a->v4==b->v1
 				|| a->v1==b->v2 || a->v2==b->v2 || a->v3==b->v2 || a->v4==b->v2
 				|| a->v1==b->v3 || a->v2==b->v3 || a->v3==b->v3 || a->v4==b->v3
 				|| (b->v4 && (a->v1==b->v4 || a->v2==b->v4 || a->v3==b->v4 || a->v4==b->v4))) {
@@ -341,7 +341,7 @@ MALWAYS_INLINE int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *i
 					ObjectInstanceRen *ob= (ObjectInstanceRen*)is->orig.ob;
 					rayface_from_vlak(&origface, ob, (VlakRen*)is->orig.face);
 
-					if(!isec_tri_quad_neighbour(is->start, is->dir, &origface))
+					if (!isec_tri_quad_neighbour(is->start, is->dir, &origface))
 					{
 						return 0;
 					}
@@ -375,7 +375,7 @@ int RE_rayobject_raycast(RayObject *r, Isect *isec)
 	RE_RC_COUNT(isec->raycounter->raycast.test);
 
 	/* setup vars used on raycast */
-	for(i=0; i<3; i++)
+	for (i=0; i<3; i++)
 	{
 		isec->idot_axis[i]		= 1.0f / isec->dir[i];
 		
@@ -388,11 +388,11 @@ int RE_rayobject_raycast(RayObject *r, Isect *isec)
 
 #ifdef RT_USE_LAST_HIT	
 	/* last hit heuristic */
-	if(isec->mode==RE_RAY_SHADOW && isec->last_hit)
+	if (isec->mode==RE_RAY_SHADOW && isec->last_hit)
 	{
 		RE_RC_COUNT(isec->raycounter->rayshadow_last_hit.test);
 		
-		if(RE_rayobject_intersect(isec->last_hit, isec))
+		if (RE_rayobject_intersect(isec->last_hit, isec))
 		{
 			RE_RC_COUNT(isec->raycounter->raycast.hit);
 			RE_RC_COUNT(isec->raycounter->rayshadow_last_hit.hit);
@@ -405,7 +405,7 @@ int RE_rayobject_raycast(RayObject *r, Isect *isec)
 	isec->hit_hint = 0;
 #endif
 
-	if(RE_rayobject_intersect(r, isec))
+	if (RE_rayobject_intersect(r, isec))
 	{
 		RE_RC_COUNT(isec->raycounter->raycast.hit);
 
@@ -420,11 +420,11 @@ int RE_rayobject_raycast(RayObject *r, Isect *isec)
 
 int RE_rayobject_intersect(RayObject *r, Isect *i)
 {
-	if(RE_rayobject_isRayFace(r))
+	if (RE_rayobject_isRayFace(r))
 	{
 		return intersect_rayface(r, (RayFace*) RE_rayobject_align(r), i);
 	}
-	else if(RE_rayobject_isVlakPrimitive(r))
+	else if (RE_rayobject_isVlakPrimitive(r))
 	{
 		//TODO optimize (useless copy to RayFace to avoid duplicate code)
 		VlakPrimitive *face = (VlakPrimitive*) RE_rayobject_align(r);
@@ -433,7 +433,7 @@ int RE_rayobject_intersect(RayObject *r, Isect *i)
 
 		return intersect_rayface(r, &nface, i);
 	}
-	else if(RE_rayobject_isRayAPI(r))
+	else if (RE_rayobject_isRayAPI(r))
 	{
 		r = RE_rayobject_align(r);
 		return r->api->raycast(r, i);
@@ -466,11 +466,11 @@ void RE_rayobject_free(RayObject *r)
 
 float RE_rayobject_cost(RayObject *r)
 {
-	if(RE_rayobject_isRayFace(r) || RE_rayobject_isVlakPrimitive(r))
+	if (RE_rayobject_isRayFace(r) || RE_rayobject_isVlakPrimitive(r))
 	{
 		return 1.0f;
 	}
-	else if(RE_rayobject_isRayAPI(r))
+	else if (RE_rayobject_isRayAPI(r))
 	{
 		r = RE_rayobject_align(r);
 		return r->api->cost(r);
@@ -485,16 +485,16 @@ float RE_rayobject_cost(RayObject *r)
 
 void RE_rayobject_merge_bb(RayObject *r, float *min, float *max)
 {
-	if(RE_rayobject_isRayFace(r))
+	if (RE_rayobject_isRayFace(r))
 	{
 		RayFace *face = (RayFace*) RE_rayobject_align(r);
 		
 		DO_MINMAX(face->v1, min, max);
 		DO_MINMAX(face->v2, min, max);
 		DO_MINMAX(face->v3, min, max);
-		if(RE_rayface_isQuad(face)) DO_MINMAX(face->v4, min, max);
+		if (RE_rayface_isQuad(face)) DO_MINMAX(face->v4, min, max);
 	}
-	else if(RE_rayobject_isVlakPrimitive(r))
+	else if (RE_rayobject_isVlakPrimitive(r))
 	{
 		VlakPrimitive *face = (VlakPrimitive*) RE_rayobject_align(r);
 		RayFace nface;
@@ -503,9 +503,9 @@ void RE_rayobject_merge_bb(RayObject *r, float *min, float *max)
 		DO_MINMAX(nface.v1, min, max);
 		DO_MINMAX(nface.v2, min, max);
 		DO_MINMAX(nface.v3, min, max);
-		if(RE_rayface_isQuad(&nface)) DO_MINMAX(nface.v4, min, max);
+		if (RE_rayface_isQuad(&nface)) DO_MINMAX(nface.v4, min, max);
 	}
-	else if(RE_rayobject_isRayAPI(r))
+	else if (RE_rayobject_isRayAPI(r))
 	{
 		r = RE_rayobject_align(r);
 		r->api->bb(r, min, max);
@@ -518,11 +518,11 @@ void RE_rayobject_merge_bb(RayObject *r, float *min, float *max)
 
 void RE_rayobject_hint_bb(RayObject *r, RayHint *hint, float *min, float *max)
 {
-	if(RE_rayobject_isRayFace(r) || RE_rayobject_isVlakPrimitive(r))
+	if (RE_rayobject_isRayFace(r) || RE_rayobject_isVlakPrimitive(r))
 	{
 		return;
 	}
-	else if(RE_rayobject_isRayAPI(r))
+	else if (RE_rayobject_isRayAPI(r))
 	{
 		r = RE_rayobject_align(r);
 		return r->api->hint_bb(r, hint, min, max);
@@ -535,7 +535,7 @@ void RE_rayobject_hint_bb(RayObject *r, RayHint *hint, float *min, float *max)
 
 int RE_rayobjectcontrol_test_break(RayObjectControl *control)
 {
-	if(control->test_break)
+	if (control->test_break)
 		return control->test_break(control->data);
 
 	return 0;
@@ -543,7 +543,7 @@ int RE_rayobjectcontrol_test_break(RayObjectControl *control)
 
 void RE_rayobject_set_control(RayObject *r, void *data, RE_rayobjectcontrol_test_break_callback test_break)
 {
-	if(RE_rayobject_isRayAPI(r))
+	if (RE_rayobject_isRayAPI(r))
 	{
 		r = RE_rayobject_align(r);
 		r->control.data = data;
diff --git a/source/blender/render/intern/raytrace/rayobject_blibvh.cpp b/source/blender/render/intern/raytrace/rayobject_blibvh.cpp
index f5a6030..165b62c 100644
--- a/source/blender/render/intern/raytrace/rayobject_blibvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_blibvh.cpp
@@ -102,11 +102,11 @@ static void bvh_callback(void *userdata, int index, const BVHTreeRay *UNUSED(ray
 	Isect *isec = data->isec;
 	RayObject *face = data->leafs[index];
 	
-	if(RE_rayobject_intersect(face,isec))
+	if (RE_rayobject_intersect(face,isec))
 	{
 		hit->index = index;
 
-		if(isec->mode == RE_RAY_SHADOW)
+		if (isec->mode == RE_RAY_SHADOW)
 			hit->dist = 0;
 		else
 			hit->dist = isec->dist;
@@ -154,10 +154,10 @@ static void RE_rayobject_blibvh_free(RayObject *o)
 {
 	BVHObject *obj = (BVHObject*)o;
 
-	if(obj->bvh)
+	if (obj->bvh)
 		BLI_bvhtree_free(obj->bvh);
 
-	if(obj->leafs)
+	if (obj->leafs)
 		MEM_freeN(obj->leafs);
 
 	MEM_freeN(obj);
diff --git a/source/blender/render/intern/raytrace/rayobject_empty.cpp b/source/blender/render/intern/raytrace/rayobject_empty.cpp
index 55696b5..eacec0b 100644
--- a/source/blender/render/intern/raytrace/rayobject_empty.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_empty.cpp
@@ -72,7 +72,7 @@ static RayObjectAPI empty_api =
 	RE_rayobject_empty_hint_bb
 };
 
-static RayObject empty_raytree = { &empty_api, {0, 0} };
+static RayObject empty_raytree = { &empty_api, {NULL, NULL} };
 
 RayObject *RE_rayobject_empty_create()
 {
diff --git a/source/blender/render/intern/raytrace/rayobject_hint.h b/source/blender/render/intern/raytrace/rayobject_hint.h
index e13a8e6..3689aa8 100644
--- a/source/blender/render/intern/raytrace/rayobject_hint.h
+++ b/source/blender/render/intern/raytrace/rayobject_hint.h
@@ -30,8 +30,8 @@
  */
 
 
-#ifndef RE_RAYTRACE_RAYOBJECT_HINT_H
-#define RE_RAYTRACE_RAYOBJECT_HINT_H
+#ifndef __RAYOBJECT_HINT_H__
+#define __RAYOBJECT_HINT_H__
 
 #define HINT_RECURSE	 1
 #define HINT_ACCEPT		 0
@@ -49,7 +49,7 @@ inline int hint_test_bb(HintBB *obj, float *Nmin, float *Nmax)
 	else
 		return HINT_ACCEPT;
 }
-/*
+#if 0
 struct HintFrustum
 {
 	float co[3];
@@ -69,7 +69,6 @@ inline int hint_test_bb(HintFrustum &obj, float *Nmin, float *Nmax)
 	
 	return HINT_ACCEPT;
 }
-*/
-
 #endif
 
+#endif /* __RAYOBJECT_HINT_H__ */
diff --git a/source/blender/render/intern/raytrace/rayobject_instance.cpp b/source/blender/render/intern/raytrace/rayobject_instance.cpp
index c7af501..2e803ce 100644
--- a/source/blender/render/intern/raytrace/rayobject_instance.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_instance.cpp
@@ -99,7 +99,7 @@ static int  RE_rayobject_instance_intersect(RayObject *o, Isect *isec)
 	int changed = 0, i, res;
 	
 	// TODO - this is disabling self intersection on instances
-	if(isec->orig.ob == obj->ob && obj->ob)
+	if (isec->orig.ob == obj->ob && obj->ob)
 	{
 		changed = 1;
 		isec->orig.ob = obj->target_ob;
@@ -117,7 +117,7 @@ static int  RE_rayobject_instance_intersect(RayObject *o, Isect *isec)
 	isec->dist *= normalize_v3(isec->dir);
 	
 	// update idot_axis and bv_index
-	for(i=0; i<3; i++)
+	for (i=0; i<3; i++)
 	{
 		isec->idot_axis[i]		= 1.0f / isec->dir[i];
 		
@@ -132,7 +132,7 @@ static int  RE_rayobject_instance_intersect(RayObject *o, Isect *isec)
 	res = RE_rayobject_intersect(obj->target, isec);
 
 	// map dist into original coordinate space
-	if(res == 0)
+	if (res == 0)
 	{
 		isec->dist = dist;
 	}
@@ -161,11 +161,11 @@ static int  RE_rayobject_instance_intersect(RayObject *o, Isect *isec)
 	copy_v3_v3(isec->dir, dir);
 	copy_v3_v3(isec->idot_axis, idot_axis);
 	
-	if(changed)
+	if (changed)
 		isec->orig.ob = obj->ob;
 
 	// restore bv_index
-	for(i=0; i<3; i++)
+	for (i=0; i<3; i++)
 	{
 		isec->bv_index[2*i]		= isec->idot_axis[i] < 0.0 ? 1 : 0;
 		isec->bv_index[2*i+1]	= 1 - isec->bv_index[2*i];
@@ -202,9 +202,9 @@ static void RE_rayobject_instance_bb(RayObject *o, float *min, float *max)
 	RE_rayobject_merge_bb(obj->target, m, M);
 
 	//There must be a faster way than rotating all the 8 vertexs of the BB
-	for(i=0; i<8; i++)
+	for (i=0; i<8; i++)
 	{
-		for(j=0; j<3; j++) t[j] = i&(1<<j) ? M[j] : m[j];
+		for (j=0; j<3; j++) t[j] = i&(1<<j) ? M[j] : m[j];
 		mul_m4_v3(obj->target2global, t);
 		DO_MINMAX(t, min, max);
 	}
diff --git a/source/blender/render/intern/raytrace/rayobject_internal.h b/source/blender/render/intern/raytrace/rayobject_internal.h
index 458c892..8c8e432 100644
--- a/source/blender/render/intern/raytrace/rayobject_internal.h
+++ b/source/blender/render/intern/raytrace/rayobject_internal.h
@@ -2,8 +2,8 @@
  *  \ingroup render
  */
 
-#ifndef RE_RAYOBJECT_INTERNAL_H
-#define RE_RAYOBJECT_INTERNAL_H
+#ifndef __RAYOBJECT_INTERNAL_H__
+#define __RAYOBJECT_INTERNAL_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -33,40 +33,40 @@ typedef struct RayObjectControl {
 int RE_rayobjectcontrol_test_break(RayObjectControl *c);
 
 /* RayObject
-	
-	A ray object is everything where we can cast rays like:
-		* a face/triangle
-		* an octree
-		* a bvh tree
-		* an octree of bvh's
-		* a bvh of bvh's
-	
-		
-	All types of RayObjects can be created by implementing the
-	callbacks of the RayObject.
-
-	Due to high computing time evolved with casting on faces
-	there is a special type of RayObject (named RayFace)
-	which won't use callbacks like other generic nodes.
-	
-	In order to allow a mixture of RayFace+RayObjects,
-	all RayObjects must be 4byte aligned, allowing us to use the
-	2 least significant bits (with the mask 0x03) to define the
-	type of RayObject.
-	
-	This leads to 4 possible types of RayObject:
-
-	 addr&3  - type of object
-		0		Self (reserved for each structure)
-		1     	RayFace (tri/quad primitive)
-		2		RayObject (generic with API callbacks)
-		3		VlakPrimitive
-				(vlak primitive - to be used when we have a vlak describing the data
-				 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
-	 RayObject primitive, which can be used to save memory)
+ *
+ *  A ray object is everything where we can cast rays like:
+ *      * a face/triangle
+ *      * an octree
+ *      * a bvh tree
+ *      * an octree of bvh's
+ *      * a bvh of bvh's
+ *
+ *
+ *  All types of RayObjects can be created by implementing the
+ *  callbacks of the RayObject.
+ *
+ *  Due to high computing time evolved with casting on faces
+ *  there is a special type of RayObject (named RayFace)
+ *  which won't use callbacks like other generic nodes.
+ *
+ *  In order to allow a mixture of RayFace+RayObjects,
+ *  all RayObjects must be 4byte aligned, allowing us to use the
+ *  2 least significant bits (with the mask 0x03) to define the
+ *  type of RayObject.
+ *
+ *  This leads to 4 possible types of RayObject:
+ *
+ *   addr&3  - type of object
+ *      0       Self (reserved for each structure)
+ *      1       RayFace (tri/quad primitive)
+ *      2       RayObject (generic with API callbacks)
+ *      3       VlakPrimitive
+ *              (vlak primitive - to be used when we have a vlak describing the data
+ *               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
+ *   RayObject primitive, which can be used to save memory)
  */
 
 /* used to test the type of ray object */
diff --git a/source/blender/render/intern/raytrace/rayobject_octree.cpp b/source/blender/render/intern/raytrace/rayobject_octree.cpp
index 20121b0..ea1d5c2 100644
--- a/source/blender/render/intern/raytrace/rayobject_octree.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_octree.cpp
@@ -29,7 +29,7 @@
 
 
 /* IMPORTANT NOTE: this code must be independent of any other render code
-   to use it outside the renderer! */
+ * to use it outside the renderer! */
 
 #include <math.h>
 #include <string.h>
@@ -133,7 +133,7 @@ static void calc_ocval_face(float *v1, float *v2, float *v3, float *v4, short x,
 	copy_v3_v3(max, v1);
 	DO_MINMAX(v2, min, max);
 	DO_MINMAX(v3, min, max);
-	if(v4) {
+	if (v4) {
 		DO_MINMAX(v4, min, max);
 	}
 	
@@ -155,28 +155,31 @@ static void calc_ocval_ray(OcVal *ov, float xo, float yo, float zo, float *vec1,
 {
 	int ocmin, ocmax;
 	
-	if(vec1[0]<vec2[0]) {
+	if (vec1[0]<vec2[0]) {
 		ocmin= OCVALRES*(vec1[0] - xo);
 		ocmax= OCVALRES*(vec2[0] - xo);
-	} else {
+	}
+	else {
 		ocmin= OCVALRES*(vec2[0] - xo);
 		ocmax= OCVALRES*(vec1[0] - xo);
 	}
 	ov->ocx= BROW16(ocmin, ocmax);
 
-	if(vec1[1]<vec2[1]) {
+	if (vec1[1]<vec2[1]) {
 		ocmin= OCVALRES*(vec1[1] - yo);
 		ocmax= OCVALRES*(vec2[1] - yo);
-	} else {
+	}
+	else {
 		ocmin= OCVALRES*(vec2[1] - yo);
 		ocmax= OCVALRES*(vec1[1] - yo);
 	}
 	ov->ocy= BROW16(ocmin, ocmax);
 
-	if(vec1[2]<vec2[2]) {
+	if (vec1[2]<vec2[2]) {
 		ocmin= OCVALRES*(vec1[2] - zo);
 		ocmax= OCVALRES*(vec2[2] - zo);
-	} else {
+	}
+	else {
 		ocmin= OCVALRES*(vec2[2] - zo);
 		ocmax= OCVALRES*(vec1[2] - zo);
 	}
@@ -189,15 +192,15 @@ static Branch *addbranch(Octree *oc, Branch *br, short ocb)
 {
 	int index;
 	
-	if(br->b[ocb]) return br->b[ocb];
+	if (br->b[ocb]) return br->b[ocb];
 	
 	oc->branchcount++;
 	index= oc->branchcount>>12;
 	
-	if(oc->adrbranch[index]==NULL)
+	if (oc->adrbranch[index]==NULL)
 		oc->adrbranch[index]= (Branch*)MEM_callocN(4096*sizeof(Branch), "new oc branch");
 
-	if(oc->branchcount>= BRANCH_ARRAY*4096) {
+	if (oc->branchcount>= BRANCH_ARRAY*4096) {
 		printf("error; octree branches full\n");
 		oc->branchcount=0;
 	}
@@ -212,10 +215,10 @@ static Node *addnode(Octree *oc)
 	oc->nodecount++;
 	index= oc->nodecount>>12;
 	
-	if(oc->adrnode[index]==NULL)
+	if (oc->adrnode[index]==NULL)
 		oc->adrnode[index]= (Node*)MEM_callocN(4096*sizeof(Node),"addnode");
 
-	if(oc->nodecount> NODE_ARRAY*NODE_ARRAY) {
+	if (oc->nodecount> NODE_ARRAY*NODE_ARRAY) {
 		printf("error; octree nodes full\n");
 		oc->nodecount=0;
 	}
@@ -229,7 +232,7 @@ static int face_in_node(RayFace *face, short x, short y, short z, float rtf[][3]
 	float fx, fy, fz;
 	
 	// init static vars 
-	if(face) {
+	if (face) {
 		normal_tri_v3( nor,rtf[0], rtf[1], rtf[2]);
 		d= -nor[0]*rtf[0][0] - nor[1]*rtf[0][1] - nor[2]*rtf[0][2];
 		return 0;
@@ -239,25 +242,25 @@ static int face_in_node(RayFace *face, short x, short y, short z, float rtf[][3]
 	fy= y;
 	fz= z;
 	
-	if((fx)*nor[0] + (fy)*nor[1] + (fz)*nor[2] + d > 0.0f) {
-		if((fx+1)*nor[0] + (fy  )*nor[1] + (fz  )*nor[2] + d < 0.0f) return 1;
-		if((fx  )*nor[0] + (fy+1)*nor[1] + (fz  )*nor[2] + d < 0.0f) return 1;
-		if((fx+1)*nor[0] + (fy+1)*nor[1] + (fz  )*nor[2] + d < 0.0f) return 1;
+	if ((fx)*nor[0] + (fy)*nor[1] + (fz)*nor[2] + d > 0.0f) {
+		if ((fx+1)*nor[0] + (fy  )*nor[1] + (fz  )*nor[2] + d < 0.0f) return 1;
+		if ((fx  )*nor[0] + (fy+1)*nor[1] + (fz  )*nor[2] + d < 0.0f) return 1;
+		if ((fx+1)*nor[0] + (fy+1)*nor[1] + (fz  )*nor[2] + d < 0.0f) return 1;
 	
-		if((fx  )*nor[0] + (fy  )*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1;
-		if((fx+1)*nor[0] + (fy  )*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1;
-		if((fx  )*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1;
-		if((fx+1)*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1;
+		if ((fx  )*nor[0] + (fy  )*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1;
+		if ((fx+1)*nor[0] + (fy  )*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1;
+		if ((fx  )*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1;
+		if ((fx+1)*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d < 0.0f) return 1;
 	}
 	else {
-		if((fx+1)*nor[0] + (fy  )*nor[1] + (fz  )*nor[2] + d > 0.0f) return 1;
-		if((fx  )*nor[0] + (fy+1)*nor[1] + (fz  )*nor[2] + d > 0.0f) return 1;
-		if((fx+1)*nor[0] + (fy+1)*nor[1] + (fz  )*nor[2] + d > 0.0f) return 1;
+		if ((fx+1)*nor[0] + (fy  )*nor[1] + (fz  )*nor[2] + d > 0.0f) return 1;
+		if ((fx  )*nor[0] + (fy+1)*nor[1] + (fz  )*nor[2] + d > 0.0f) return 1;
+		if ((fx+1)*nor[0] + (fy+1)*nor[1] + (fz  )*nor[2] + d > 0.0f) return 1;
 	
-		if((fx  )*nor[0] + (fy  )*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1;
-		if((fx+1)*nor[0] + (fy  )*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1;
-		if((fx  )*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1;
-		if((fx+1)*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1;
+		if ((fx  )*nor[0] + (fy  )*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1;
+		if ((fx+1)*nor[0] + (fy  )*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1;
+		if ((fx  )*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1;
+		if ((fx+1)*nor[0] + (fy+1)*nor[1] + (fz+1)*nor[2] + d > 0.0f) return 1;
 	}
 	
 	return 0;
@@ -274,15 +277,15 @@ static void ocwrite(Octree *oc, RayFace *face, int quad, short x, short y, short
 
 	br= oc->adrbranch[0];
 
-	if(oc->ocres==512) {
+	if (oc->ocres==512) {
 		oc0= ((x & 1024)+(y & 512)+(z & 256))>>8;
 		br= addbranch(oc, br, oc0);
 	}
-	if(oc->ocres>=256) {
+	if (oc->ocres>=256) {
 		oc0= ((x & 512)+(y & 256)+(z & 128))>>7;
 		br= addbranch(oc, br, oc0);
 	}
-	if(oc->ocres>=128) {
+	if (oc->ocres>=128) {
 		oc0= ((x & 256)+(y & 128)+(z & 64))>>6;
 		br= addbranch(oc, br, oc0);
 	}
@@ -300,12 +303,12 @@ static void ocwrite(Octree *oc, RayFace *face, int quad, short x, short y, short
 	br= addbranch(oc, br,oc3);
 	br= addbranch(oc, br,oc4);
 	no= (Node *)br->b[oc5];
-	if(no==NULL) br->b[oc5]= (Branch *)(no= addnode(oc));
+	if (no==NULL) br->b[oc5]= (Branch *)(no= addnode(oc));
 
 	while(no->next) no= no->next;
 
 	a= 0;
-	if(no->v[7]) {		/* node full */
+	if (no->v[7]) {		/* node full */
 		no->next= addnode(oc);
 		no= no->next;
 	}
@@ -315,7 +318,7 @@ static void ocwrite(Octree *oc, RayFace *face, int quad, short x, short y, short
 	
 	no->v[a]= (RayFace*) RE_rayobject_align(face);
 	
-	if(quad)
+	if (quad)
 		calc_ocval_face(rtf[0], rtf[1], rtf[2], rtf[3], x>>2, y>>1, z, &no->ov[a]);
 	else
 		calc_ocval_face(rtf[0], rtf[1], rtf[2], NULL, x>>2, y>>1, z, &no->ov[a]);
@@ -333,7 +336,7 @@ static void d2dda(Octree *oc, short b1, short b2, short c1, short c2, char *ocfa
 	ocx2= rts[b2][c1];
 	ocy2= rts[b2][c2];
 
-	if(ocx1==ocx2 && ocy1==ocy2) {
+	if (ocx1==ocx2 && ocy1==ocy2) {
 		ocface[oc->ocres*ocx1+ocy1]= 1;
 		return;
 	}
@@ -343,32 +346,36 @@ static void d2dda(Octree *oc, short b1, short b2, short c1, short c2, char *ocfa
 	ox2= rtf[b2][c1];
 	oy2= rtf[b2][c2];
 
-	if(ox1!=ox2) {
-		if(ox2-ox1>0.0f) {
+	if (ox1!=ox2) {
+		if (ox2-ox1>0.0f) {
 			labdax= (ox1-ocx1-1.0f)/(ox1-ox2);
 			ldx= -1.0f/(ox1-ox2);
 			dx= 1;
-		} else {
+		}
+		else {
 			labdax= (ox1-ocx1)/(ox1-ox2);
 			ldx= 1.0f/(ox1-ox2);
 			dx= -1;
 		}
-	} else {
+	}
+	else {
 		labdax=1.0f;
 		ldx=0;
 	}
 
-	if(oy1!=oy2) {
-		if(oy2-oy1>0.0f) {
+	if (oy1!=oy2) {
+		if (oy2-oy1>0.0f) {
 			labday= (oy1-ocy1-1.0f)/(oy1-oy2);
 			ldy= -1.0f/(oy1-oy2);
 			dy= 1;
-		} else {
+		}
+		else {
 			labday= (oy1-ocy1)/(oy1-oy2);
 			ldy= 1.0f/(oy1-oy2);
 			dy= -1;
 		}
-	} else {
+	}
+	else {
 		labday=1.0f;
 		ldy=0;
 	}
@@ -378,27 +385,29 @@ 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);
+		if (x<0 || y<0 || x>=oc->ocres || y>=oc->ocres);
 		else ocface[oc->ocres*x+y]= 1;
 		
 		labdao=labda;
-		if(labdax==labday) {
+		if (labdax==labday) {
 			labdax+=ldx;
 			x+=dx;
 			labday+=ldy;
 			y+=dy;
-		} else {
-			if(labdax<labday) {
+		}
+		else {
+			if (labdax<labday) {
 				labdax+=ldx;
 				x+=dx;
-			} else {
+			}
+			else {
 				labday+=ldy;
 				y+=dy;
 			}
 		}
 		labda=MIN2(labdax,labday);
-		if(labda==labdao) break;
-		if(labda>=1.0f) break;
+		if (labda==labdao) break;
+		if (labda>=1.0f) break;
 	}
 	ocface[oc->ocres*ocx2+ocy2]=1;
 }
@@ -407,15 +416,15 @@ static void filltriangle(Octree *oc, short c1, short c2, char *ocface, short *oc
 {
 	int a, x, y, y1, y2;
 
-	for(x=ocmin[c1];x<=ocmax[c1];x++) {
+	for (x=ocmin[c1];x<=ocmax[c1];x++) {
 		a= oc->ocres*x;
-		for(y=ocmin[c2];y<=ocmax[c2];y++) {
-			if(ocface[a+y]) {
+		for (y=ocmin[c2];y<=ocmax[c2];y++) {
+			if (ocface[a+y]) {
 				y++;
 				while(ocface[a+y] && y!=ocmax[c2]) y++;
-				for(y1=ocmax[c2];y1>y;y1--) {
-					if(ocface[a+y1]) {
-						for(y2=y;y2<=y1;y2++) ocface[a+y2]=1;
+				for (y1=ocmax[c2];y1>y;y1--) {
+					if (ocface[a+y1]) {
+						for (y2=y;y2<=y1;y2++) ocface[a+y2]=1;
 						y1=0;
 					}
 				}
@@ -431,14 +440,14 @@ static void RE_rayobject_octree_free(RayObject *tree)
 
 #if 0
 	printf("branches %d nodes %d\n", oc->branchcount, oc->nodecount);
-	printf("raycount %d \n", raycount);	
-	printf("ray coherent %d \n", coherent_ray);
+	printf("raycount %d\n", raycount);
+	printf("ray coherent %d\n", coherent_ray);
 	printf("accepted %d rejected %d\n", accepted, rejected);
 #endif
-	if(oc->ocface)
+	if (oc->ocface)
 		MEM_freeN(oc->ocface);
 
-	if(oc->adrbranch) {
+	if (oc->adrbranch) {
 		int a= 0;
 		while(oc->adrbranch[a]) {
 			MEM_freeN(oc->adrbranch[a]);
@@ -450,7 +459,7 @@ static void RE_rayobject_octree_free(RayObject *tree)
 	}
 	oc->branchcount= 0;
 	
-	if(oc->adrnode) {
+	if (oc->adrnode) {
 		int a= 0;
 		while(oc->adrnode[a]) {
 			MEM_freeN(oc->adrnode[a]);
@@ -511,27 +520,27 @@ static void octree_fill_rayface(Octree *oc, RayFace *face)
 	copy_v3_v3(co1, face->v1);
 	copy_v3_v3(co2, face->v2);
 	copy_v3_v3(co3, face->v3);
-	if(face->v4)
+	if (face->v4)
 		copy_v3_v3(co4, face->v4);
 
-	for(c=0;c<3;c++) {
-		rtf[0][c]= (co1[c]-oc->min[c])*ocfac[c] ;
-		rts[0][c]= (short)rtf[0][c];
-		rtf[1][c]= (co2[c]-oc->min[c])*ocfac[c] ;
-		rts[1][c]= (short)rtf[1][c];
-		rtf[2][c]= (co3[c]-oc->min[c])*ocfac[c] ;
-		rts[2][c]= (short)rtf[2][c];
-		if(RE_rayface_isQuad(face)) {
-			rtf[3][c]= (co4[c]-oc->min[c])*ocfac[c] ;
-			rts[3][c]= (short)rtf[3][c];
+	for (c=0;c<3;c++) {
+		rtf[0][c] = (co1[c] - oc->min[c]) * ocfac[c];
+		rts[0][c] = (short)rtf[0][c];
+		rtf[1][c] = (co2[c] - oc->min[c]) * ocfac[c];
+		rts[1][c] = (short)rtf[1][c];
+		rtf[2][c] = (co3[c] - oc->min[c]) * ocfac[c];
+		rts[2][c] = (short)rtf[2][c];
+		if (RE_rayface_isQuad(face)) {
+			rtf[3][c] = (co4[c] - oc->min[c]) * ocfac[c];
+			rts[3][c] = (short)rtf[3][c];
 		}
 	}
 	
-	for(c=0;c<3;c++) {
+	for (c=0;c<3;c++) {
 		oc1= rts[0][c];
 		oc2= rts[1][c];
 		oc3= rts[2][c];
-		if(!RE_rayface_isQuad(face)) {
+		if (!RE_rayface_isQuad(face)) {
 			ocmin[c]= MIN3(oc1,oc2,oc3);
 			ocmax[c]= MAX3(oc1,oc2,oc3);
 		}
@@ -540,11 +549,11 @@ static void octree_fill_rayface(Octree *oc, RayFace *face)
 			ocmin[c]= MIN4(oc1,oc2,oc3,oc4);
 			ocmax[c]= MAX4(oc1,oc2,oc3,oc4);
 		}
-		if(ocmax[c]>oc->ocres-1) ocmax[c]=oc->ocres-1;
-		if(ocmin[c]<0) ocmin[c]=0;
+		if (ocmax[c]>oc->ocres-1) ocmax[c]=oc->ocres-1;
+		if (ocmin[c]<0) ocmin[c]=0;
 	}
 	
-	if(ocmin[0]==ocmax[0] && ocmin[1]==ocmax[1] && ocmin[2]==ocmax[2]) {
+	if (ocmin[0]==ocmax[0] && ocmin[1]==ocmax[1] && ocmin[2]==ocmax[2]) {
 		ocwrite(oc, face, RE_rayface_isQuad(face), ocmin[0], ocmin[1], ocmin[2], rtf);
 	}
 	else {
@@ -555,7 +564,7 @@ static void octree_fill_rayface(Octree *oc, RayFace *face)
 		d2dda(oc, 1,2,0,1,ocface+ocres2,rts,rtf);
 		d2dda(oc, 1,2,0,2,ocface,rts,rtf);
 		d2dda(oc, 1,2,1,2,ocface+2*ocres2,rts,rtf);
-		if(!RE_rayface_isQuad(face)) {
+		if (!RE_rayface_isQuad(face)) {
 			d2dda(oc, 2,0,0,1,ocface+ocres2,rts,rtf);
 			d2dda(oc, 2,0,0,2,ocface,rts,rtf);
 			d2dda(oc, 2,0,1,2,ocface+2*ocres2,rts,rtf);
@@ -576,14 +585,14 @@ static void octree_fill_rayface(Octree *oc, RayFace *face)
 		/* init static vars here */
 		face_in_node(face, 0,0,0, rtf);
 		
-		for(x=ocmin[0];x<=ocmax[0];x++) {
+		for (x=ocmin[0];x<=ocmax[0];x++) {
 			a= oc->ocres*x;
-			for(y=ocmin[1];y<=ocmax[1];y++) {
-				if(ocface[a+y+ocres2]) {
+			for (y=ocmin[1];y<=ocmax[1];y++) {
+				if (ocface[a+y+ocres2]) {
 					b= oc->ocres*y+2*ocres2;
-					for(z=ocmin[2];z<=ocmax[2];z++) {
-						if(ocface[b+z] && ocface[a+z]) {
-							if(face_in_node(NULL, x, y, z, rtf))
+					for (z=ocmin[2];z<=ocmax[2];z++) {
+						if (ocface[b+z] && ocface[a+z]) {
+							if (face_in_node(NULL, x, y, z, rtf))
 								ocwrite(oc, face, RE_rayface_isQuad(face), x,y,z, rtf);
 						}
 					}
@@ -592,14 +601,14 @@ static void octree_fill_rayface(Octree *oc, RayFace *face)
 		}
 		
 		/* same loops to clear octree, doubt it can be done smarter */
-		for(x=ocmin[0];x<=ocmax[0];x++) {
+		for (x=ocmin[0];x<=ocmax[0];x++) {
 			a= oc->ocres*x;
-			for(y=ocmin[1];y<=ocmax[1];y++) {
+			for (y=ocmin[1];y<=ocmax[1];y++) {
 				/* x-y */
 				ocface[a+y+ocres2]= 0;
 
 				b= oc->ocres*y + 2*ocres2;
-				for(z=ocmin[2];z<=ocmax[2];z++) {
+				for (z=ocmin[2];z<=ocmax[2];z++) {
 					/* y-z */
 					ocface[b+z]= 0;
 					/* x-z */
@@ -620,7 +629,7 @@ static void RE_rayobject_octree_done(RayObject *tree)
 	INIT_MINMAX(oc->min, oc->max);
 	
 	/* Calculate Bounding Box */
-	for(c=0; c<oc->ro_nodes_used; c++)
+	for (c=0; c<oc->ro_nodes_used; c++)
 		RE_rayobject_merge_bb( RE_rayobject_unalignRayFace(oc->ro_nodes[c]), oc->min, oc->max);
 		
 	/* Alloc memory */
@@ -633,7 +642,7 @@ static void RE_rayobject_octree_done(RayObject *tree)
 	oc->ocface= (char*)MEM_callocN( 3*ocres2 + 8, "ocface");
 	memset(oc->ocface, 0, 3*ocres2);
 
-	for(c=0;c<3;c++) {	/* octree enlarge, still needed? */
+	for (c=0;c<3;c++) {	/* octree enlarge, still needed? */
 		oc->min[c]-= 0.01f;
 		oc->max[c]+= 0.01f;
 	}
@@ -649,7 +658,7 @@ static void RE_rayobject_octree_done(RayObject *tree)
 	
 	oc->ocsize= sqrt(t00*t00+t01*t01+t02*t02);	/* global, max size octree */
 
-	for(c=0; c<oc->ro_nodes_used; c++)
+	for (c=0; c<oc->ro_nodes_used; c++)
 	{
 		octree_fill_rayface(oc, oc->ro_nodes[c]);
 	}
@@ -677,19 +686,19 @@ static int testnode(Octree *UNUSED(oc), Isect *is, Node *no, OcVal ocval)
 	short nr=0;
 
 	/* return on any first hit */
-	if(is->mode==RE_RAY_SHADOW) {
+	if (is->mode==RE_RAY_SHADOW) {
 	
-		for(; no; no = no->next)
-		for(nr=0; nr<8; nr++)
+		for (; no; no = no->next)
+		for (nr=0; nr<8; nr++)
 		{
 			RayFace *face = no->v[nr];
 			OcVal 		*ov = no->ov+nr;
 			
-			if(!face) break;
+			if (!face) break;
 			
-			if( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) )
+			if ( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) )
 			{
-				if( RE_rayobject_intersect( RE_rayobject_unalignRayFace(face),is) )
+				if ( RE_rayobject_intersect( RE_rayobject_unalignRayFace(face),is) )
 					return 1;
 			}
 		}
@@ -698,17 +707,17 @@ static int testnode(Octree *UNUSED(oc), Isect *is, Node *no, OcVal ocval)
 	{			/* else mirror or glass or shadowtra, return closest face  */
 		int found= 0;
 		
-		for(; no; no = no->next)
-		for(nr=0; nr<8; nr++)
+		for (; no; no = no->next)
+		for (nr=0; nr<8; nr++)
 		{
 			RayFace *face = no->v[nr];
 			OcVal 		*ov = no->ov+nr;
 			
-			if(!face) break;
+			if (!face) break;
 			
-			if( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) )
+			if ( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && (ov->ocz & ocval.ocz) )
 			{ 
-				if( RE_rayobject_intersect( RE_rayobject_unalignRayFace(face),is) )
+				if ( RE_rayobject_intersect( RE_rayobject_unalignRayFace(face),is) )
 					found= 1;
 			}
 		}
@@ -730,43 +739,43 @@ static Node *ocread(Octree *oc, int x, int y, int z)
 	
 	br= oc->adrbranch[0];
 	
-	if(oc->ocres==512) {
+	if (oc->ocres==512) {
 		oc1= ((x & 1024)+(y & 512)+(z & 256))>>8;
 		br= br->b[oc1];
-		if(br==NULL) {
+		if (br==NULL) {
 			return NULL;
 		}
 	}
-	if(oc->ocres>=256) {
+	if (oc->ocres>=256) {
 		oc1= ((x & 512)+(y & 256)+(z & 128))>>7;
 		br= br->b[oc1];
-		if(br==NULL) {
+		if (br==NULL) {
 			return NULL;
 		}
 	}
-	if(oc->ocres>=128) {
+	if (oc->ocres>=128) {
 		oc1= ((x & 256)+(y & 128)+(z & 64))>>6;
 		br= br->b[oc1];
-		if(br==NULL) {
+		if (br==NULL) {
 			return NULL;
 		}
 	}
 	
 	oc1= ((x & 128)+(y & 64)+(z & 32))>>5;
 	br= br->b[oc1];
-	if(br) {
+	if (br) {
 		oc1= ((x & 64)+(y & 32)+(z & 16))>>4;
 		br= br->b[oc1];
-		if(br) {
+		if (br) {
 			oc1= ((x & 32)+(y & 16)+(z & 8))>>3;
 			br= br->b[oc1];
-			if(br) {
+			if (br) {
 				oc1= ((x & 16)+(y & 8)+(z & 4))>>2;
 				br= br->b[oc1];
-				if(br) {
+				if (br) {
 					oc1= ((x & 8)+(y & 4)+(z & 2))>>1;
 					br= br->b[oc1];
-					if(br) {
+					if (br) {
 						oc1= ((x & 4)+(y & 2)+(z & 1));
 						return (Node *)br->b[oc1];
 					}
@@ -782,32 +791,32 @@ static int cliptest(float p, float q, float *u1, float *u2)
 {
 	float r;
 
-	if(p<0.0f) {
-		if(q<p) return 0;
-		else if(q<0.0f) {
+	if (p<0.0f) {
+		if (q<p) return 0;
+		else if (q<0.0f) {
 			r= q/p;
-			if(r>*u2) return 0;
-			else if(r>*u1) *u1=r;
+			if (r>*u2) return 0;
+			else if (r>*u1) *u1=r;
 		}
 	}
 	else {
-		if(p>0.0f) {
-			if(q<0.0f) return 0;
-			else if(q<p) {
+		if (p>0.0f) {
+			if (q<0.0f) return 0;
+			else if (q<p) {
 				r= q/p;
-				if(r<*u1) return 0;
-				else if(r<*u2) *u2=r;
+				if (r<*u1) return 0;
+				else if (r<*u2) *u2=r;
 			}
 		}
-		else if(q<0.0f) return 0;
+		else if (q<0.0f) return 0;
 	}
 	return 1;
 }
 
 /* extensive coherence checks/storage cancels out the benefit of it, and gives errors... we
-   need better methods, sample code commented out below (ton) */
+ * need better methods, sample code commented out below (ton) */
  
-/*
+#if 0
 
 in top: static int coh_nodes[16*16*16][6];
 in makeoctree: memset(coh_nodes, 0, sizeof(coh_nodes));
@@ -827,12 +836,12 @@ static int do_coherence_test(int ocx1, int ocx2, int ocy1, int ocy2, int ocz1, i
 	short *sp;
 	
 	sp= coh_nodes[ (ocx2 & 15) + 16*(ocy2 & 15) + 256*(ocz2 & 15) ];
-	if(sp[0]==ocx1 && sp[1]==ocy1 && sp[2]==ocz1 &&
+	if (sp[0]==ocx1 && sp[1]==ocy1 && sp[2]==ocz1 &&
 	   sp[3]==ocx2 && sp[4]==ocy2 && sp[5]==ocz2) return 1;
 	return 0;
 }
 
-*/
+#endif
 
 /* return 1: found valid intersection */
 /* starts with is->orig.face */
@@ -850,7 +859,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
 	int ocx1,ocx2,ocy1, ocy2,ocz1,ocz2;
 	
 	/* clip with octree */
-	if(oc->branchcount==0) return 0;
+	if (oc->branchcount==0) return 0;
 	
 	/* do this before intersect calls */
 #if 0
@@ -868,22 +877,22 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
 	u2= 1.0f;
 	
 	/* clip with octree cube */
-	if(cliptest(-ldx, start[0]-oc->min[0], &u1,&u2)) {
-		if(cliptest(ldx, oc->max[0]-start[0], &u1,&u2)) {
+	if (cliptest(-ldx, start[0]-oc->min[0], &u1,&u2)) {
+		if (cliptest(ldx, oc->max[0]-start[0], &u1,&u2)) {
 			ldy= is->dir[1]*is->dist;
-			if(cliptest(-ldy, start[1]-oc->min[1], &u1,&u2)) {
-				if(cliptest(ldy, oc->max[1]-start[1], &u1,&u2)) {
+			if (cliptest(-ldy, start[1]-oc->min[1], &u1,&u2)) {
+				if (cliptest(ldy, oc->max[1]-start[1], &u1,&u2)) {
 					ldz = is->dir[2]*is->dist;
-					if(cliptest(-ldz, start[2]-oc->min[2], &u1,&u2)) {
-						if(cliptest(ldz, oc->max[2]-start[2], &u1,&u2)) {
+					if (cliptest(-ldz, start[2]-oc->min[2], &u1,&u2)) {
+						if (cliptest(ldz, oc->max[2]-start[2], &u1,&u2)) {
 							c1=1;
-							if(u2<1.0f) {
+							if (u2<1.0f) {
 								end[0] = start[0]+u2*ldx;
 								end[1] = start[1]+u2*ldy;
 								end[2] = start[2]+u2*ldz;
 							}
 
-							if(u1>0.0f) {
+							if (u1>0.0f) {
 								start[0] += u1*ldx;
 								start[1] += u1*ldy;
 								start[2] += u1*ldz;
@@ -895,7 +904,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
 		}
 	}
 
-	if(c1==0) return 0;
+	if (c1==0) return 0;
 
 	/* reset static variables in ocread */
 	//ocread(oc, oc->ocres, 0, 0);
@@ -915,14 +924,14 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
 	ocy2= (int)oy2;
 	ocz2= (int)oz2;
 	
-	if(ocx1==ocx2 && ocy1==ocy2 && ocz1==ocz2) {
+	if (ocx1==ocx2 && ocy1==ocy2 && ocz1==ocz2) {
 		no= ocread(oc, ocx1, ocy1, ocz1);
-		if(no) {
+		if (no) {
 			/* exact intersection with node */
 			vec1[0]= ox1; vec1[1]= oy1; vec1[2]= oz1;
 			vec2[0]= ox2; vec2[1]= oy2; vec2[2]= oz2;
 			calc_ocval_ray(&ocval, (float)ocx1, (float)ocy1, (float)ocz1, vec1, vec2);
-			if( testnode(oc, is, no, ocval) ) return 1;
+			if ( testnode(oc, is, no, ocval) ) return 1;
 		}
 	}
 	else {
@@ -936,43 +945,49 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
 		doy= oy1-oy2;
 		doz= oz1-oz2;
 
-		if(dox<-FLT_EPSILON) {
+		if (dox<-FLT_EPSILON) {
 			ldx= -1.0f/dox;
 			labdax= (ocx1-ox1+1.0f)*ldx;
 			dx= 1;
-		} else if(dox>FLT_EPSILON) {
+		}
+		else if (dox>FLT_EPSILON) {
 			ldx= 1.0f/dox;
 			labdax= (ox1-ocx1)*ldx;
 			dx= -1;
-		} else {
+		}
+		else {
 			labdax=1.0f;
 			ldx=0;
 			dx= 0;
 		}
 
-		if(doy<-FLT_EPSILON) {
+		if (doy<-FLT_EPSILON) {
 			ldy= -1.0f/doy;
 			labday= (ocy1-oy1+1.0f)*ldy;
 			dy= 1;
-		} else if(doy>FLT_EPSILON) {
+		}
+		else if (doy>FLT_EPSILON) {
 			ldy= 1.0f/doy;
 			labday= (oy1-ocy1)*ldy;
 			dy= -1;
-		} else {
+		}
+		else {
 			labday=1.0f;
 			ldy=0;
 			dy= 0;
 		}
 
-		if(doz<-FLT_EPSILON) {
+		if (doz<-FLT_EPSILON) {
 			ldz= -1.0f/doz;
 			labdaz= (ocz1-oz1+1.0f)*ldz;
 			dz= 1;
-		} else if(doz>FLT_EPSILON) {
+		}
+		else if (doz>FLT_EPSILON) {
 			ldz= 1.0f/doz;
 			labdaz= (oz1-ocz1)*ldz;
 			dz= -1;
-		} else {
+		}
+		else {
 			labdaz=1.0f;
 			ldz=0;
 			dz= 0;
@@ -986,12 +1001,12 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
 		vec2[2]= oz1;
 		
 		/* this loop has been constructed to make sure the first and last node of ray
-		   are always included, even when ddalabda==1.0f or larger */
+		 * are always included, even when ddalabda==1.0f or larger */
 
 		while(TRUE) {
 
 			no= ocread(oc, xo, yo, zo);
-			if(no) {
+			if (no) {
 				
 				/* calculate ray intersection with octree node */
 				copy_v3_v3(vec1, vec2);
@@ -1002,10 +1017,10 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
 				calc_ocval_ray(&ocval, (float)xo, (float)yo, (float)zo, vec1, vec2);
 
 				//is->dist = (u1+ddalabda*(u2-u1))*olabda;
-				if( testnode(oc, is, no, ocval) )
+				if ( testnode(oc, is, no, ocval) )
 					found = 1;
 
-				if(is->dist < (u1+ddalabda*(u2-u1))*olabda)
+				if (is->dist < (u1+ddalabda*(u2-u1))*olabda)
 					return found;
 			}
 
@@ -1013,19 +1028,19 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
 			labdao= ddalabda;
 			
 			/* traversing ocree nodes need careful detection of smallest values, with proper
-			   exceptions for equal labdas */
+			 * exceptions for equal labdas */
 			eqval= (labdax==labday);
-			if(labday==labdaz) eqval += 2;
-			if(labdax==labdaz) eqval += 4;
+			if (labday==labdaz) eqval += 2;
+			if (labdax==labdaz) eqval += 4;
 			
-			if(eqval) {	// only 4 cases exist!
-				if(eqval==7) {	// x=y=z
+			if (eqval) {	// only 4 cases exist!
+				if (eqval==7) {	// x=y=z
 					xo+=dx; labdax+=ldx;
 					yo+=dy; labday+=ldy;
 					zo+=dz; labdaz+=ldz;
 				}
-				else if(eqval==1) { // x=y 
-					if(labday < labdaz) {
+				else if (eqval==1) { // x=y 
+					if (labday < labdaz) {
 						xo+=dx; labdax+=ldx;
 						yo+=dy; labday+=ldy;
 					}
@@ -1033,8 +1048,8 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
 						zo+=dz; labdaz+=ldz;
 					}
 				}
-				else if(eqval==2) { // y=z
-					if(labdax < labday) {
+				else if (eqval==2) { // y=z
+					if (labdax < labday) {
 						xo+=dx; labdax+=ldx;
 					}
 					else {
@@ -1043,7 +1058,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
 					}
 				}
 				else { // x=z
-					if(labday < labdax) {
+					if (labday < labdax) {
 						yo+=dy; labday+=ldy;
 					}
 					else {
@@ -1054,13 +1069,13 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
 			}
 			else {	// all three different, just three cases exist
 				eqval= (labdax<labday);
-				if(labday<labdaz) eqval += 2;
-				if(labdax<labdaz) eqval += 4;
+				if (labday<labdaz) eqval += 2;
+				if (labdax<labdaz) eqval += 4;
 				
-				if(eqval==7 || eqval==5) { // x smallest
+				if (eqval==7 || eqval==5) { // x smallest
 					xo+=dx; labdax+=ldx;
 				}
-				else if(eqval==2 || eqval==6) { // y smallest
+				else if (eqval==2 || eqval==6) { // y smallest
 					yo+=dy; labday+=ldy;
 				}
 				else { // z smallest
@@ -1070,9 +1085,9 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is)
 			}
 
 			ddalabda=MIN3(labdax,labday,labdaz);
-			if(ddalabda==labdao) break;
+			if (ddalabda==labdao) break;
 			/* to make sure the last node is always checked */
-			if(labdao>=1.0f) break;
+			if (labdao>=1.0f) break;
 		}
 	}
 	
diff --git a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
index f7d38bf..2edf159 100644
--- a/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_qbvh.cpp
@@ -71,14 +71,14 @@ void bvh_done<QBVHTree>(QBVHTree *obj)
 	//TODO do this in 1 pass (half memory usage during building)
 	VBVHNode *root = BuildBinaryVBVH<VBVHNode>(arena1, &obj->rayobj.control).transform(obj->builder);	
 
-	if(RE_rayobjectcontrol_test_break(&obj->rayobj.control))
+	if (RE_rayobjectcontrol_test_break(&obj->rayobj.control))
 	{
 		BLI_memarena_free(arena1);
 		BLI_memarena_free(arena2);
 		return;
 	}
 	
-	if(root) {
+	if (root) {
 		pushup_simd<VBVHNode,4>(root);
 		obj->root = Reorganize_SVBVH<VBVHNode>(arena2).transform(root);
 	}
@@ -99,8 +99,8 @@ template<int StackSize>
 int intersect(QBVHTree *obj, Isect* isec)
 {
 	//TODO renable hint support
-	if(RE_rayobject_isAligned(obj->root)) {
-		if(isec->mode == RE_RAY_SHADOW)
+	if (RE_rayobject_isAligned(obj->root)) {
+		if (isec->mode == RE_RAY_SHADOW)
 			return svbvh_node_stack_raycast<StackSize,true>(obj->root, isec);
 		else
 			return svbvh_node_stack_raycast<StackSize,false>(obj->root, isec);
@@ -141,9 +141,9 @@ RayObjectAPI* bvh_get_api(int maxstacksize)
 {
 	static RayObjectAPI bvh_api256 = make_api<Tree,1024>();
 	
-	if(maxstacksize <= 1024) return &bvh_api256;
+	if (maxstacksize <= 1024) return &bvh_api256;
 	assert(maxstacksize <= 256);
-	return 0;
+	return NULL;
 }
 
 RayObject *RE_rayobject_qbvh_create(int size)
diff --git a/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp b/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
index dc75ed5..54901db 100644
--- a/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
@@ -54,10 +54,10 @@ static void rtbuild_init(RTBuilder *b)
 	b->primitives.end     = 0;
 	b->primitives.maxsize = 0;
 	
-	for(int i=0; i<RTBUILD_MAX_CHILDS; i++)
+	for (int i=0; i<RTBUILD_MAX_CHILDS; i++)
 		b->child_offset[i] = 0;
 
-	for(int i=0; i<3; i++)
+	for (int i=0; i<3; i++)
 		b->sorted_begin[i] = b->sorted_end[i] = 0;
 		
 	INIT_MINMAX(b->bb, b->bb+3);
@@ -74,7 +74,7 @@ RTBuilder* rtbuild_create(int size)
 	builder->primitives.begin = builder->primitives.end = memblock;
 	builder->primitives.maxsize = size;
 	
-	for(int i=0; i<3; i++)
+	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];
@@ -86,10 +86,10 @@ RTBuilder* rtbuild_create(int size)
 
 void rtbuild_free(RTBuilder *b)
 {
-	if(b->primitives.begin) MEM_freeN(b->primitives.begin);
+	if (b->primitives.begin) MEM_freeN(b->primitives.begin);
 
-	for(int i=0; i<3; i++)
-		if(b->sorted_begin[i])
+	for (int i=0; i<3; i++)
+		if (b->sorted_begin[i])
 			MEM_freeN(b->sorted_begin[i]);
 
 	MEM_freeN(b);
@@ -105,18 +105,18 @@ void rtbuild_add(RTBuilder *b, RayObject *o)
 	RE_rayobject_merge_bb(o, bb, bb+3);
 
 	/* skip objects with invalid bounding boxes, nan causes DO_MINMAX
-	   to do nothing, so we get these invalid values. this shouldn't
-	   happen usually, but bugs earlier in the pipeline can cause it. */
-	if(bb[0] > bb[3] || bb[1] > bb[4] || bb[2] > bb[5])
+	 * to do nothing, so we get these invalid values. this shouldn't
+	 * happen usually, but bugs earlier in the pipeline can cause it. */
+	if (bb[0] > bb[3] || bb[1] > bb[4] || bb[2] > bb[5])
 		return;
 	/* skip objects with inf bounding boxes */
-	if(!finite(bb[0]) || !finite(bb[1]) || !finite(bb[2]))
+	if (!finite(bb[0]) || !finite(bb[1]) || !finite(bb[2]))
 		return;
-	if(!finite(bb[3]) || !finite(bb[4]) || !finite(bb[5]))
+	if (!finite(bb[3]) || !finite(bb[4]) || !finite(bb[5]))
 		return;
 	/* skip objects with zero bounding box, they are of no use, and
-	   will give problems in rtbuild_heuristic_object_split later */
-	if(bb[0] == bb[3] && bb[1] == bb[4] && bb[2] == bb[5])
+	 * will give problems in rtbuild_heuristic_object_split later */
+	if (bb[0] == bb[3] && bb[1] == bb[4] && bb[2] == bb[5])
 		return;
 	
 	copy_v3_v3(b->primitives.end->bb, bb);
@@ -124,7 +124,7 @@ void rtbuild_add(RTBuilder *b, RayObject *o)
 	b->primitives.end->obj = o;
 	b->primitives.end->cost = RE_rayobject_cost(o);
 	
-	for(int i=0; i<3; i++)
+	for (int i=0; i<3; i++)
 	{
 		*(b->sorted_end[i]) = b->primitives.end;
 		b->sorted_end[i]++;
@@ -141,7 +141,7 @@ int rtbuild_size(RTBuilder *b)
 template<class Obj,int Axis>
 static bool obj_bb_compare(const Obj &a, const Obj &b)
 {
-	if(a->bb[Axis] != b->bb[Axis])
+	if (a->bb[Axis] != b->bb[Axis])
 		return a->bb[Axis] < b->bb[Axis];
 	return a->obj < b->obj;
 }
@@ -149,18 +149,18 @@ static bool obj_bb_compare(const Obj &a, const Obj &b)
 template<class Item>
 static void object_sort(Item *begin, Item *end, int axis)
 {
-	if(axis == 0) return std::sort(begin, end, obj_bb_compare<Item,0> );
-	if(axis == 1) return std::sort(begin, end, obj_bb_compare<Item,1> );
-	if(axis == 2) return std::sort(begin, end, obj_bb_compare<Item,2> );
+	if (axis == 0) return std::sort(begin, end, obj_bb_compare<Item,0> );
+	if (axis == 1) return std::sort(begin, end, obj_bb_compare<Item,1> );
+	if (axis == 2) return std::sort(begin, end, obj_bb_compare<Item,2> );
 	assert(false);
 }
 
 void rtbuild_done(RTBuilder *b, RayObjectControl* ctrl)
 {
-	for(int i=0; i<3; i++)
-	if(b->sorted_begin[i])
+	for (int i=0; i<3; i++)
+	if (b->sorted_begin[i])
 	{
-		if(RE_rayobjectcontrol_test_break(ctrl)) break;
+		if (RE_rayobjectcontrol_test_break(ctrl)) break;
 		object_sort( b->sorted_begin[i], b->sorted_end[i], i );
 	}
 }
@@ -174,8 +174,8 @@ RTBuilder* rtbuild_get_child(RTBuilder *b, int child, RTBuilder *tmp)
 {
 	rtbuild_init( tmp );
 
-	for(int i=0; i<3; i++)
-		if(b->sorted_begin[i])
+	for (int i=0; i<3; i++)
+		if (b->sorted_begin[i])
 		{
 			tmp->sorted_begin[i] = b->sorted_begin[i] +  b->child_offset[child  ];
 			tmp->sorted_end  [i] = b->sorted_begin[i] +  b->child_offset[child+1];
@@ -191,9 +191,9 @@ RTBuilder* rtbuild_get_child(RTBuilder *b, int child, RTBuilder *tmp)
 
 void rtbuild_calc_bb(RTBuilder *b)
 {
-	if(b->bb[0] == 1.0e30f)
+	if (b->bb[0] == 1.0e30f)
 	{
-		for(RTBuilder::Object **index = b->sorted_begin[0]; index != b->sorted_end[0]; index++)
+		for (RTBuilder::Object **index = b->sorted_begin[0]; index != b->sorted_end[0]; index++)
 			RE_rayobject_merge_bb( (*index)->obj , b->bb, b->bb+3);
 	}
 }
@@ -205,7 +205,7 @@ void rtbuild_merge_bb(RTBuilder *b, float *min, float *max)
 	DO_MAX(b->bb+3, max);
 }
 
-/*
+#if 0
 int rtbuild_get_largest_axis(RTBuilder *b)
 {
 	rtbuild_calc_bb(b);
@@ -225,20 +225,20 @@ int rtbuild_mean_split(RTBuilder *b, int nchilds, int axis)
 	assert(nchilds <= RTBUILD_MAX_CHILDS);
 	
 	//TODO optimize calc of leafs_per_child
-	for(s=nchilds; s<tot_leafs; s*=nchilds);
+	for (s=nchilds; s<tot_leafs; s*=nchilds);
 	Mleafs_per_child = s/nchilds;
 	mleafs_per_child = Mleafs_per_child/nchilds;
 	
 	//split min leafs per child	
 	b->child_offset[0] = 0;
-	for(i=1; i<=nchilds; i++)
+	for (i=1; i<=nchilds; i++)
 		b->child_offset[i] = mleafs_per_child;
 	
 	//split remaining leafs
 	missing_leafs = tot_leafs - mleafs_per_child*nchilds;
-	for(i=1; i<=nchilds; i++)
+	for (i=1; i<=nchilds; i++)
 	{
-		if(missing_leafs > Mleafs_per_child - mleafs_per_child)
+		if (missing_leafs > Mleafs_per_child - mleafs_per_child)
 		{
 			b->child_offset[i] += Mleafs_per_child - mleafs_per_child;
 			missing_leafs -= Mleafs_per_child - mleafs_per_child;
@@ -252,11 +252,11 @@ int rtbuild_mean_split(RTBuilder *b, int nchilds, int axis)
 	}
 	
 	//adjust for accumulative offsets
-	for(i=1; i<=nchilds; i++)
+	for (i=1; i<=nchilds; i++)
 		b->child_offset[i] += b->child_offset[i-1];
 
 	//Count created childs
-	for(i=nchilds; b->child_offset[i] == b->child_offset[i-1]; i--);
+	for (i=nchilds; b->child_offset[i] == b->child_offset[i-1]; i--);
 	split_leafs(b, b->child_offset, i, axis);
 	
 	assert( b->child_offset[0] == 0 && b->child_offset[i] == tot_leafs );
@@ -269,19 +269,19 @@ int rtbuild_mean_split_largest_axis(RTBuilder *b, int nchilds)
 	int axis = rtbuild_get_largest_axis(b);
 	return rtbuild_mean_split(b, nchilds, axis);
 }
-*/
+#endif
 
 /*
  * "separators" is an array of dim NCHILDS-1
  * and indicates where to cut the childs
  */
-/*
+#if 0
 int rtbuild_median_split(RTBuilder *b, float *separators, int nchilds, int axis)
 {
 	int size = rtbuild_size(b);
 		
 	assert(nchilds <= RTBUILD_MAX_CHILDS);
-	if(size <= nchilds)
+	if (size <= nchilds)
 	{
 		return rtbuild_mean_split(b, nchilds, axis);
 	}
@@ -293,12 +293,12 @@ int rtbuild_median_split(RTBuilder *b, float *separators, int nchilds, int axis)
 		
 		//Calculate child offsets
 		b->child_offset[0] = 0;
-		for(i=0; i<nchilds-1; i++)
+		for (i=0; i<nchilds-1; i++)
 			b->child_offset[i+1] = split_leafs_by_plane(b, b->child_offset[i], size, separators[i]);
 		b->child_offset[nchilds] = size;
 		
-		for(i=0; i<nchilds; i++)
-			if(b->child_offset[i+1] - b->child_offset[i] == size)
+		for (i=0; i<nchilds; i++)
+			if (b->child_offset[i+1] - b->child_offset[i] == size)
 				return rtbuild_mean_split(b, nchilds, axis);
 		
 		return nchilds;
@@ -313,12 +313,12 @@ int rtbuild_median_split_largest_axis(RTBuilder *b, int nchilds)
 	rtbuild_calc_bb(b);
 
 	la = bb_largest_axis(b->bb,b->bb+3);
-	for(i=1; i<nchilds; i++)
+	for (i=1; i<nchilds; i++)
 		separators[i-1] = (b->bb[la+3]-b->bb[la])*i / nchilds;
 		
 	return rtbuild_median_split(b, separators, nchilds, la);
 }
-*/
+#endif
 
 //Heuristics Object Splitter
 
@@ -337,23 +337,23 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds)
 	assert(size > 1);
 	int baxis = -1, boffset = 0;
 
-	if(size > nchilds)
+	if (size > nchilds)
 	{
 		float bcost = FLT_MAX;
 		baxis = -1, boffset = size/2;
 
 		SweepCost *sweep = (SweepCost*)MEM_mallocN( sizeof(SweepCost)*size, "RTBuilder.HeuristicSweep" );
 		
-		for(int axis=0; axis<3; axis++)
+		for (int axis=0; axis<3; axis++)
 		{
 			SweepCost sweep_left;
 
 			RTBuilder::Object **obj = b->sorted_begin[axis];
 			
 //			float right_cost = 0;
-			for(int i=size-1; i>=0; i--)
+			for (int i=size-1; i>=0; i--)
 			{
-				if(i == size-1)
+				if (i == size-1)
 				{
 					copy_v3_v3(sweep[i].bb, obj[i]->bb);
 					copy_v3_v3(sweep[i].bb+3, obj[i]->bb+3);
@@ -380,9 +380,9 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds)
 			sweep_left.bb[5] = obj[0]->bb[5];
 			sweep_left.cost  = obj[0]->cost;
 			
-//			right_cost -= obj[0]->cost;	if(right_cost < 0) right_cost = 0;
+//			right_cost -= obj[0]->cost;	if (right_cost < 0) right_cost = 0;
 
-			for(int i=1; i<size; i++)
+			for (int i=1; i<size; i++)
 			{
 				//Worst case heuristic (cost of each child is linear)
 				float hcost, left_side, right_side;
@@ -398,10 +398,10 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds)
 				assert(left_side >= 0);
 				assert(right_side >= 0);
 				
-				if(left_side > bcost) break;	//No way we can find a better heuristic in this axis
+				if (left_side > bcost) break;	//No way we can find a better heuristic in this axis
 
 				assert(hcost >= 0);
-				if( hcost < bcost
+				if ( hcost < bcost
 				|| (hcost == bcost && axis < baxis)) //this makes sure the tree built is the same whatever is the order of the sorting axis
 				{
 					bcost = hcost;
@@ -412,7 +412,7 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds)
 				DO_MAX( obj[i]->bb+3, sweep_left.bb+3 );
 
 				sweep_left.cost += obj[i]->cost;
-//				right_cost -= obj[i]->cost; if(right_cost < 0) right_cost = 0;
+//				right_cost -= obj[i]->cost; if (right_cost < 0) right_cost = 0;
 			}
 			
 			//assert(baxis >= 0 && baxis < 3);
@@ -423,12 +423,12 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds)
 		
 		MEM_freeN(sweep);
 	}
-	else if(size == 2)
+	else if (size == 2)
 	{
 		baxis = 0;
 		boffset = 1;
 	}
-	else if(size == 1)
+	else if (size == 1)
 	{
 		b->child_offset[0] = 0;
 		b->child_offset[1] = 1;
@@ -441,9 +441,9 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds)
 	
 
 	/* Adjust sorted arrays for childs */
-	for(int i=0; i<boffset; i++) b->sorted_begin[baxis][i]->selected = true;
-	for(int i=boffset; i<size; i++) b->sorted_begin[baxis][i]->selected = false;
-	for(int i=0; i<3; i++)
+	for (int i=0; i<boffset; i++) b->sorted_begin[baxis][i]->selected = true;
+	for (int i=boffset; i<size; i++) b->sorted_begin[baxis][i]->selected = false;
+	for (int i=0; i<3; i++)
 		std::stable_partition( b->sorted_begin[i], b->sorted_end[i], selected_node );
 
 	return nchilds;		
@@ -454,22 +454,22 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds)
  * PARTITION code / used on mean-split
  * basicly 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)
 {
 	int i;
 	b->split_axis = split_axis;
 
-	for(i=0; i < partitions-1; i++)
+	for (i=0; i < partitions-1; i++)
 	{
 		assert(nth[i] < nth[i+1] && nth[i+1] < nth[partitions]);
 
-		if(split_axis == 0)	std::nth_element(b, nth[i],  nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object,0>);
-		if(split_axis == 1)	std::nth_element(b, nth[i],  nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object,1>);
-		if(split_axis == 2)	std::nth_element(b, nth[i],  nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object,2>);
+		if (split_axis == 0)	std::nth_element(b, nth[i],  nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object,0>);
+		if (split_axis == 1)	std::nth_element(b, nth[i],  nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object,1>);
+		if (split_axis == 2)	std::nth_element(b, nth[i],  nth[i+1], nth[partitions], obj_bb_compare<RTBuilder::Object,2>);
 	}
 }
-*/
+#endif
 
 /*
  * Bounding Box utils
@@ -500,16 +500,16 @@ int bb_largest_axis(float *min, float *max)
 	sub[0] = max[0]-min[0];
 	sub[1] = max[1]-min[1];
 	sub[2] = max[2]-min[2];
-	if(sub[0] > sub[1])
+	if (sub[0] > sub[1])
 	{
-		if(sub[0] > sub[2])
+		if (sub[0] > sub[2])
 			return 0;
 		else
 			return 2;
 	}
 	else
 	{
-		if(sub[1] > sub[2])
+		if (sub[1] > sub[2])
 			return 1;
 		else
 			return 2;
@@ -519,11 +519,11 @@ int bb_largest_axis(float *min, float *max)
 int bb_fits_inside(float *outer_min, float *outer_max, float *inner_min, float *inner_max)
 {
 	int i;
-	for(i=0; i<3; i++)
-		if(outer_min[i] > inner_min[i]) return 0;
+	for (i=0; i<3; i++)
+		if (outer_min[i] > inner_min[i]) return 0;
 
-	for(i=0; i<3; i++)
-		if(outer_max[i] < inner_max[i]) return 0;
+	for (i=0; i<3; i++)
+		if (outer_max[i] < inner_max[i]) return 0;
 
 	return 1;	
 }
diff --git a/source/blender/render/intern/raytrace/rayobject_rtbuild.h b/source/blender/render/intern/raytrace/rayobject_rtbuild.h
index c408898..f6e9aab 100644
--- a/source/blender/render/intern/raytrace/rayobject_rtbuild.h
+++ b/source/blender/render/intern/raytrace/rayobject_rtbuild.h
@@ -29,8 +29,8 @@
  *  \ingroup render
  */
 
-#ifndef RE_RAYOBJECT_RTBUILD_H
-#define RE_RAYOBJECT_RTBUILD_H
+#ifndef __RAYOBJECT_RTBUILD_H__
+#define __RAYOBJECT_RTBUILD_H__
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/source/blender/render/intern/raytrace/rayobject_svbvh.cpp b/source/blender/render/intern/raytrace/rayobject_svbvh.cpp
index 7ce444a..4c2099e 100644
--- a/source/blender/render/intern/raytrace/rayobject_svbvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_svbvh.cpp
@@ -79,11 +79,11 @@ void bvh_done<SVBVHTree>(SVBVHTree *obj)
 					   BLI_memarena_use_align(arena2, 16);
 
 	//Build and optimize the tree
-	if(0)
+	if (0)
 	{
 		VBVHNode *root = BuildBinaryVBVH<VBVHNode>(arena1, &obj->rayobj.control).transform(obj->builder);
 
-		if(RE_rayobjectcontrol_test_break(&obj->rayobj.control))
+		if (RE_rayobjectcontrol_test_break(&obj->rayobj.control))
 		{
 			BLI_memarena_free(arena1);
 			BLI_memarena_free(arena2);
@@ -106,14 +106,14 @@ void bvh_done<SVBVHTree>(SVBVHTree *obj)
 		//TODO this uses quite a lot of memory, find ways to reduce memory usage during building
 		OVBVHNode *root = BuildBinaryVBVH<OVBVHNode>(arena1,&obj->rayobj.control).transform(obj->builder);			
 
-		if(RE_rayobjectcontrol_test_break(&obj->rayobj.control))
+		if (RE_rayobjectcontrol_test_break(&obj->rayobj.control))
 		{
 			BLI_memarena_free(arena1);
 			BLI_memarena_free(arena2);
 			return;
 		}
 
-		if(root) {
+		if (root) {
 			VBVH_optimalPackSIMD<OVBVHNode,PackCost>(PackCost()).transform(root);
 			obj->root = Reorganize_SVBVH<OVBVHNode>(arena2).transform(root);
 		}
@@ -135,8 +135,8 @@ template<int StackSize>
 int intersect(SVBVHTree *obj, Isect* isec)
 {
 	//TODO renable hint support
-	if(RE_rayobject_isAligned(obj->root)) {
-		if(isec->mode == RE_RAY_SHADOW)
+	if (RE_rayobject_isAligned(obj->root)) {
+		if (isec->mode == RE_RAY_SHADOW)
 			return svbvh_node_stack_raycast<StackSize,true>(obj->root, isec);
 		else
 			return svbvh_node_stack_raycast<StackSize,false>(obj->root, isec);
@@ -177,9 +177,9 @@ RayObjectAPI* bvh_get_api(int maxstacksize)
 {
 	static RayObjectAPI bvh_api256 = make_api<Tree,1024>();
 	
-	if(maxstacksize <= 1024) return &bvh_api256;
+	if (maxstacksize <= 1024) return &bvh_api256;
 	assert(maxstacksize <= 256);
-	return 0;
+	return NULL;
 }
 
 RayObject *RE_rayobject_svbvh_create(int size)
diff --git a/source/blender/render/intern/raytrace/rayobject_vbvh.cpp b/source/blender/render/intern/raytrace/rayobject_vbvh.cpp
index 75323cf..e82623f 100644
--- a/source/blender/render/intern/raytrace/rayobject_vbvh.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_vbvh.cpp
@@ -87,16 +87,16 @@ void bvh_done<VBVHTree>(VBVHTree *obj)
 					   BLI_memarena_use_malloc(arena1);
 	
 	//Build and optimize the tree
-	if(1)
+	if (1)
 	{
 		VBVHNode *root = BuildBinaryVBVH<VBVHNode>(arena1,&obj->rayobj.control).transform(obj->builder);
-		if(RE_rayobjectcontrol_test_break(&obj->rayobj.control))
+		if (RE_rayobjectcontrol_test_break(&obj->rayobj.control))
 		{
 			BLI_memarena_free(arena1);
 			return;
 		}
 
-		if(root) {
+		if (root) {
 			reorganize(root);
 			remove_useless(root, &root);
 			bvh_refit(root);
@@ -137,8 +137,8 @@ template<int StackSize>
 int intersect(VBVHTree *obj, Isect* isec)
 {
 	//TODO renable hint support
-	if(RE_rayobject_isAligned(obj->root)) {
-		if(isec->mode == RE_RAY_SHADOW)
+	if (RE_rayobject_isAligned(obj->root)) {
+		if (isec->mode == RE_RAY_SHADOW)
 			return bvh_node_stack_raycast<VBVHNode,StackSize,false,true>( obj->root, isec);
 		else
 			return bvh_node_stack_raycast<VBVHNode,StackSize,false,false>( obj->root, isec);
@@ -159,9 +159,9 @@ void bvh_hint_bb(Tree *tree, LCTSHint *hint, float *UNUSED(min), float *UNUSED(m
 
 void bfree(VBVHTree *tree)
 {
-	if(tot_pushup + tot_pushdown + tot_hints + tot_moves)
+	if (tot_pushup + tot_pushdown + tot_hints + tot_moves)
 	{
-		if(G.f & G_DEBUG) {
+		if (G.debug & G_DEBUG) {
 			printf("tot pushups: %d\n", tot_pushup);
 			printf("tot pushdowns: %d\n", tot_pushdown);
 			printf("tot moves: %d\n", tot_moves);
@@ -199,7 +199,7 @@ RayObjectAPI* bvh_get_api(int maxstacksize)
 {
 	static RayObjectAPI bvh_api256 = make_api<Tree,1024>();
 	
-	if(maxstacksize <= 1024) return &bvh_api256;
+	if (maxstacksize <= 1024) return &bvh_api256;
 	assert(maxstacksize <= 256);
 	return 0;
 }
diff --git a/source/blender/render/intern/raytrace/reorganize.h b/source/blender/render/intern/raytrace/reorganize.h
index 5de88a9..68b2b22 100644
--- a/source/blender/render/intern/raytrace/reorganize.h
+++ b/source/blender/render/intern/raytrace/reorganize.h
@@ -144,7 +144,7 @@ void remove_useless(Node *node, Node **new_node)
 		{
 			Node *next = (*prev)->sibling;
 			remove_useless(*prev, prev);
-			if(*prev == 0)
+			if(*prev == NULL)
 				*prev = next;
 			else
 			{
@@ -158,8 +158,10 @@ void remove_useless(Node *node, Node **new_node)
 		if(RE_rayobject_isAligned(node->child) && node->child->sibling == 0)
 			*new_node = node->child;
 	}
-	else if(node->child == 0)
-		*new_node = 0;	
+	else if(node->child == NULL)
+	{
+		*new_node = NULL;
+	}
 }
 
 /*
@@ -175,8 +177,8 @@ void pushup(Node *parent)
 	Node **prev = &parent->child;
 	for(Node *child = parent->child; RE_rayobject_isAligned(child) && child; )
 	{
-		float c_area = bb_area(child->bb, child->bb+3) ;
-		int nchilds = count_childs(child);
+		const float c_area = bb_area(child->bb, child->bb + 3);
+		const int nchilds = count_childs(child);
 		float original_cost = ((p_area != 0.0f)? (c_area / p_area)*nchilds: 1.0f) + 1;
 		float flatten_cost = nchilds;
 		if(flatten_cost < original_cost && nchilds >= 2)
@@ -271,8 +273,9 @@ void pushdown(Node *parent)
 		s_child = next_s_child;
 	}
 	
-	for(Node *i = parent->child; RE_rayobject_isAligned(i) && i; i = i->sibling)
-		pushdown( i );	
+	for (Node *i = parent->child; RE_rayobject_isAligned(i) && i; i = i->sibling) {
+		pushdown(i);
+	}
 }
 
 
@@ -526,7 +529,7 @@ struct VBVH_optimalPackSIMD
 			if(num == 0) { num++; first = true; }
 			
 			calc_costs(node);
-			if((G.f & G_DEBUG) && first) printf("expected cost = %f (%d)\n", node->cut_cost[0], node->best_cutsize );
+			if((G.debug & G_DEBUG) && first) printf("expected cost = %f (%d)\n", node->cut_cost[0], node->best_cutsize );
 			node->optimize();
 		}
 		return node;		
diff --git a/source/blender/render/intern/raytrace/svbvh.h b/source/blender/render/intern/raytrace/svbvh.h
index 2f49531..e0e9678 100644
--- a/source/blender/render/intern/raytrace/svbvh.h
+++ b/source/blender/render/intern/raytrace/svbvh.h
@@ -32,8 +32,8 @@
 
 #ifdef __SSE__
  
-#ifndef RE_RAYTRACE_SVBVH_H
-#define RE_RAYTRACE_SVBVH_H
+#ifndef __SVBVH_H__
+#define __SVBVH_H__
 
 #include "bvh.h"
 #include "BLI_memarena.h"
@@ -224,7 +224,7 @@ struct Reorganize_SVBVH
 	
 	~Reorganize_SVBVH()
 	{
-		if(G.f & G_DEBUG) {
+		if(G.debug & G_DEBUG) {
 			printf("%f childs per node\n", childs_per_node / nodes);
 			printf("%d childs BB are useless\n", useless_bb);
 			for(int i=0; i<16; i++)
@@ -296,7 +296,7 @@ struct Reorganize_SVBVH
 		{
 			const static float def_bb[6] = { FLT_MAX, FLT_MAX, FLT_MAX, FLT_MIN, FLT_MIN, FLT_MIN };
 			alloc_childs--;
-			node->child[alloc_childs] = 0;
+			node->child[alloc_childs] = NULL;
 			copy_bb(node->child_bb+alloc_childs*6, def_bb);
 		}
 		
diff --git a/source/blender/render/intern/raytrace/vbvh.h b/source/blender/render/intern/raytrace/vbvh.h
index ab6a1bb..1c84cd2 100644
--- a/source/blender/render/intern/raytrace/vbvh.h
+++ b/source/blender/render/intern/raytrace/vbvh.h
@@ -65,14 +65,17 @@ inline static void bvh_node_push_childs(Node *node, Isect *UNUSED(isec), Node **
 	{
 		while(child)
 		{
-			//Skips BB tests on primitives
-/*
-			if(is_leaf(child->child))
+			/* Skips BB tests on primitives */
+#if 0
+			if(is_leaf(child->child)) {
 				stack[stack_pos++] = child->child;
+			}
 			else
-*/
+#endif
+			{
 				stack[stack_pos++] = child;
-				
+			}
+
 			child = child->sibling;
 		}
 	}
@@ -164,8 +167,8 @@ struct BuildBinaryVBVH
 		{
 			Node *node = create_node();
 			INIT_MINMAX(node->bb, node->bb+3);
-			rtbuild_merge_bb(builder, node->bb, node->bb+3);		
-			node->child = (Node*) rtbuild_get_primitive( builder, 0 );
+			rtbuild_merge_bb(builder, node->bb, node->bb+3);
+			node->child = (Node *) rtbuild_get_primitive(builder, 0);
 			return node;
 		}
 		else
@@ -191,13 +194,13 @@ struct BuildBinaryVBVH
 				child = &((*child)->sibling);
 			}
 
-			*child = 0;
+			*child = NULL;
 			return node;
 		}
 	}
 };
 
-/*
+#if 0
 template<class Tree,class OldNode>
 struct Reorganize_VBVH
 {
@@ -242,4 +245,4 @@ struct Reorganize_VBVH
 		return node;
 	}	
 };
-*/
+#endif
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index fa8540b..66ed0bd 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -126,7 +126,7 @@
 /* ------------------------------------------------------------------------- */
 
 /* Stuff for stars. This sits here because it uses gl-things. Part of
-this code may move down to the converter.  */
+ * this code may move down to the converter.  */
 /* ------------------------------------------------------------------------- */
 /* this is a bad beast, since it is misused by the 3d view drawing as well. */
 
@@ -149,10 +149,10 @@ static HaloRen *initstar(Render *re, ObjectRen *obr, float *vec, float hasize)
 }
 
 /* there must be a 'fixed' amount of stars generated between
-*         near and far
-* all stars must by preference lie on the far and solely
-*        differ in clarity/color
-*/
+ *         near and far
+ * all stars must by preference lie on the far and solely
+ *        differ in clarity/color
+ */
 
 void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
 				   void (*vertexfunc)(float*),  void (*termfunc)(void))
@@ -171,7 +171,7 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
 	int x, y, z, sx, sy, sz, ex, ey, ez, done = 0;
 	unsigned int totstar= 0;
 	
-	if(initfunc) {
+	if (initfunc) {
 		scene= scenev3d;
 		wrld= scene->world;
 	}
@@ -195,18 +195,18 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
 	if (re) re->flag |= R_HALO;
 	else stargrid *= 1.0f;				/* then it draws fewer */
 	
-	if(re) invert_m4_m4(mat, re->viewmat);
+	if (re) invert_m4_m4(mat, re->viewmat);
 	else unit_m4(mat);
 	
 	/* BOUNDING BOX CALCULATION
-		* bbox goes from z = loc_near_var | loc_far_var,
-		* x = -z | +z,
-		* y = -z | +z
-		*/
+	 * bbox goes from z = loc_near_var | loc_far_var,
+	 * x = -z | +z,
+	 * y = -z | +z
+	 */
 
 	camera= re ? RE_GetCamera(re) : scene->camera;
 
-	if(camera==NULL || camera->type != OB_CAMERA)
+	if (camera==NULL || camera->type != OB_CAMERA)
 		return;
 
 	cam = camera->data;
@@ -229,7 +229,7 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
 		initfunc();	
 	}
 
-	if(re) /* add render object for stars */
+	if (re) /* add render object for stars */
 		obr= RE_addRenderObject(re, NULL, NULL, 0, 0, 0);
 	
 	for (x = sx, fx = sx * stargrid; x <= ex; x++, fx += stargrid) {
@@ -243,16 +243,16 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
 				vec[3] = 1.0;
 				
 				if (vertexfunc) {
-					if(done & 1) vertexfunc(vec);
+					if (done & 1) vertexfunc(vec);
 					done++;
 				}
 				else {
 					mul_m4_v3(re->viewmat, vec);
 					
 					/* in vec are global coordinates
-					* calculate distance to camera
-					* and using that, define the alpha
-					*/
+					 * calculate distance to camera
+					 * and using that, define the alpha
+					 */
 					
 					{
 						float tx, ty, tz;
@@ -267,7 +267,8 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
 						else if (alpha <= starmindist) alpha = 0.0;
 						else if (alpha <= 2.0f * starmindist) {
 							alpha = (alpha - starmindist) / starmindist;
-						} else {
+						}
+						else {
 							alpha -= 2.0f * starmindist;
 							alpha /= (clipend - 2.0f * starmindist);
 							alpha = 1.0f - alpha;
@@ -298,8 +299,8 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
 				}
 
 				/* break out of the loop if generating stars takes too long */
-				if(re && !(totstar % 1000000)) {
-					if(re->test_break(re->tbh)) {
+				if (re && !(totstar % 1000000)) {
+					if (re->test_break(re->tbh)) {
 						x= ex + 1;
 						y= ey + 1;
 						z= ez + 1;
@@ -314,14 +315,14 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
 	}
 	if (termfunc) termfunc();
 
-	if(obr)
+	if (obr)
 		re->tothalo += obr->tothalo;
 }
 
 
 /* ------------------------------------------------------------------------- */
 /* tool functions/defines for ad hoc simplification and possible future 
-   cleanup      */
+ * cleanup      */
 /* ------------------------------------------------------------------------- */
 
 #define UVTOINDEX(u,v) (startvlak + (u) * sizev + (v))
@@ -354,11 +355,13 @@ static void split_v_renderfaces(ObjectRen *obr, int startvlak, int UNUSED(startv
 			if (v==vLen-1) {
 				VlakRen *vlr = RE_findOrAddVlak(obr, startvlak + vLen*uIndex + 0);
 				vlr->v1 = vert;
-			} else {
+			}
+			else {
 				VlakRen *vlr = RE_findOrAddVlak(obr, startvlak + vLen*uIndex + v+1);
 				vlr->v1 = vert;
 			}
-		} else {
+		}
+		else {
 			vlr->v2 = vert;
 
 			if (v<vLen-1) {
@@ -396,16 +399,16 @@ static void calc_edge_stress(Render *UNUSED(re), ObjectRen *obr, Mesh *me)
 	float loc[3], size[3], *accum, *acc, *accumoffs, *stress;
 	int a;
 	
-	if(obr->totvert==0) return;
+	if (obr->totvert==0) return;
 	
 	mesh_get_texspace(me, loc, NULL, size);
 	
 	accum= MEM_callocN(2*sizeof(float)*obr->totvert, "temp accum for stress");
 	
 	/* de-normalize orco */
-	for(a=0; a<obr->totvert; a++) {
+	for (a=0; a<obr->totvert; a++) {
 		VertRen *ver= RE_findOrAddVert(obr, a);
-		if(ver->orco) {
+		if (ver->orco) {
 			ver->orco[0]= ver->orco[0]*size[0] +loc[0];
 			ver->orco[1]= ver->orco[1]*size[1] +loc[1];
 			ver->orco[2]= ver->orco[2]*size[2] +loc[2];
@@ -414,14 +417,14 @@ static void calc_edge_stress(Render *UNUSED(re), ObjectRen *obr, Mesh *me)
 	
 	/* add stress values */
 	accumoffs= accum;	/* so we can use vertex index */
-	for(a=0; a<obr->totvlak; a++) {
+	for (a=0; a<obr->totvlak; a++) {
 		VlakRen *vlr= RE_findOrAddVlak(obr, a);
 
-		if(vlr->v1->orco && vlr->v4) {
+		if (vlr->v1->orco && vlr->v4) {
 			calc_edge_stress_add(accumoffs, vlr->v1, vlr->v2);
 			calc_edge_stress_add(accumoffs, vlr->v2, vlr->v3);
 			calc_edge_stress_add(accumoffs, vlr->v3, vlr->v1);
-			if(vlr->v4) {
+			if (vlr->v4) {
 				calc_edge_stress_add(accumoffs, vlr->v3, vlr->v4);
 				calc_edge_stress_add(accumoffs, vlr->v4, vlr->v1);
 				calc_edge_stress_add(accumoffs, vlr->v2, vlr->v4);
@@ -429,12 +432,12 @@ static void calc_edge_stress(Render *UNUSED(re), ObjectRen *obr, Mesh *me)
 		}
 	}
 	
-	for(a=0; a<obr->totvert; a++) {
+	for (a=0; a<obr->totvert; a++) {
 		VertRen *ver= RE_findOrAddVert(obr, a);
-		if(ver->orco) {
+		if (ver->orco) {
 			/* find stress value */
 			acc= accumoffs + 2*ver->index;
-			if(acc[1]!=0.0f)
+			if (acc[1]!=0.0f)
 				acc[0]/= acc[1];
 			stress= RE_vertren_get_stress(obr, ver, 1);
 			*stress= *acc;
@@ -458,25 +461,25 @@ static void calc_tangent_vector(ObjectRen *obr, VertexTangent **vtangents, MemAr
 	float *uv1, *uv2, *uv3, *uv4;
 	float uv[4][2];
 	
-	if(tface) {
+	if (tface) {
 		uv1= tface->uv[0];
 		uv2= tface->uv[1];
 		uv3= tface->uv[2];
 		uv4= tface->uv[3];
 	}
-	else if(v1->orco) {
+	else if (v1->orco) {
 		uv1= uv[0]; uv2= uv[1]; uv3= uv[2]; uv4= uv[3];
 		map_to_sphere( &uv[0][0], &uv[0][1],v1->orco[0], v1->orco[1], v1->orco[2]);
 		map_to_sphere( &uv[1][0], &uv[1][1],v2->orco[0], v2->orco[1], v2->orco[2]);
 		map_to_sphere( &uv[2][0], &uv[2][1],v3->orco[0], v3->orco[1], v3->orco[2]);
-		if(v4)
+		if (v4)
 			map_to_sphere( &uv[3][0], &uv[3][1],v4->orco[0], v4->orco[1], v4->orco[2]);
 	}
 	else return;
 
 	tangent_from_uv(uv1, uv2, uv3, v1->co, v2->co, v3->co, vlr->n, tang);
 	
-	if(do_tangent) {
+	if (do_tangent) {
 		tav= RE_vertren_get_tangent(obr, v1, 1);
 		add_v3_v3(tav, tang);
 		tav= RE_vertren_get_tangent(obr, v2, 1);
@@ -485,16 +488,16 @@ static void calc_tangent_vector(ObjectRen *obr, VertexTangent **vtangents, MemAr
 		add_v3_v3(tav, tang);
 	}
 	
-	if(do_nmap_tangent) {
+	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) {
+	if (v4) {
 		tangent_from_uv(uv1, uv3, uv4, v1->co, v3->co, v4->co, vlr->n, tang);
 		
-		if(do_tangent) {
+		if (do_tangent) {
 			tav= RE_vertren_get_tangent(obr, v1, 1);
 			add_v3_v3(tav, tang);
 			tav= RE_vertren_get_tangent(obr, v3, 1);
@@ -503,7 +506,7 @@ static void calc_tangent_vector(ObjectRen *obr, VertexTangent **vtangents, MemAr
 			add_v3_v3(tav, tang);
 		}
 
-		if(do_nmap_tangent) {
+		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);
@@ -514,8 +517,8 @@ static void calc_tangent_vector(ObjectRen *obr, VertexTangent **vtangents, MemAr
 
 
 /****************************************************************
-************ tangent space generation interface *****************
-****************************************************************/
+ ************ tangent space generation interface ****************
+ ****************************************************************/
 
 typedef struct
 {
@@ -556,11 +559,11 @@ static void GetTextureCoordinate(const SMikkTSpaceContext * pContext, float fUV[
 	MTFace *tface= RE_vlakren_get_tface(pMesh->obr, vlr, pMesh->obr->actmtface, NULL, 0);
 	const float *coord;
 	
-	if(tface != NULL)	{
+	if (tface != NULL)	{
 		coord= tface->uv[vert_index];
 		fUV[0]= coord[0]; fUV[1]= coord[1];
 	}
-	else if((coord= (&vlr->v1)[vert_index]->orco)) {
+	else if ((coord= (&vlr->v1)[vert_index]->orco)) {
 		map_to_sphere(&fUV[0], &fUV[1], coord[0], coord[1], coord[2]);
 	}
 	else { /* else we get un-initialized value, 0.0 ok default? */
@@ -582,7 +585,7 @@ static void SetTSpace(const SMikkTSpaceContext * pContext, const float fvTangent
 	SRenderMeshToTangent * pMesh = (SRenderMeshToTangent *) pContext->m_pUserData;
 	VlakRen *vlr= RE_findOrAddVlak(pMesh->obr, face_num);
 	float * ftang= RE_vlakren_get_nmap_tangent(pMesh->obr, vlr, 1);
-	if(ftang!=NULL)	{
+	if (ftang!=NULL)	{
 		copy_v3_v3(&ftang[iVert*4+0], fvTangent);
 		ftang[iVert*4+3]=fSign;
 	}
@@ -594,7 +597,7 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
 	VertexTangent **vtangents= NULL;
 	int a;
 
-	if(do_nmap_tangent) {
+	if (do_nmap_tangent) {
 		arena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "nmap tangent arena");
 		BLI_memarena_use_calloc(arena);
 
@@ -602,23 +605,23 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
 	}
 
 		/* clear all vertex normals */
-	for(a=0; a<obr->totvert; a++) {
+	for (a=0; a<obr->totvert; a++) {
 		VertRen *ver= RE_findOrAddVert(obr, a);
 		ver->n[0]=ver->n[1]=ver->n[2]= 0.0f;
 	}
 
 		/* calculate cos of angles and point-masses, use as weight factor to
-		   add face normal to vertex */
-	for(a=0; a<obr->totvlak; a++) {
+		 * add face normal to vertex */
+	for (a=0; a<obr->totvlak; a++) {
 		VlakRen *vlr= RE_findOrAddVlak(obr, a);
-		if(vlr->flag & ME_SMOOTH) {
+		if (vlr->flag & ME_SMOOTH) {
 			float *n4= (vlr->v4)? vlr->v4->n: NULL;
 			float *c4= (vlr->v4)? vlr->v4->co: NULL;
 
 			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_nmap_tangent || 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);
@@ -626,21 +629,21 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
 	}
 
 		/* do solid faces */
-	for(a=0; a<obr->totvlak; a++) {
+	for (a=0; a<obr->totvlak; a++) {
 		VlakRen *vlr= RE_findOrAddVlak(obr, a);
 
-		if((vlr->flag & ME_SMOOTH)==0) {
-			if(is_zero_v3(vlr->v1->n)) copy_v3_v3(vlr->v1->n, vlr->n);
-			if(is_zero_v3(vlr->v2->n)) copy_v3_v3(vlr->v2->n, vlr->n);
-			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 ((vlr->flag & ME_SMOOTH)==0) {
+			if (is_zero_v3(vlr->v1->n)) copy_v3_v3(vlr->v1->n, vlr->n);
+			if (is_zero_v3(vlr->v2->n)) copy_v3_v3(vlr->v2->n, vlr->n);
+			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) {
+		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) {
+			if (tface) {
 				int k=0;
 				float *vtang, *ftang= RE_vlakren_get_nmap_tangent(obr, vlr, 1);
 
@@ -653,21 +656,21 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
 				vtang= find_vertex_tangent(vtangents[v3->index], tface->uv[2]);
 				copy_v3_v3(ftang+8, vtang);
 				normalize_v3(ftang+8);
-				if(v4) {
+				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;
+				for (k=0; k<4; k++) ftang[4*k+3]=1;
 			}
 		}
 	}
 	
-		/* normalize vertex normals */
-	for(a=0; a<obr->totvert; a++) {
+	/* normalize vertex normals */
+	for (a=0; a<obr->totvert; a++) {
 		VertRen *ver= RE_findOrAddVert(obr, a);
 		normalize_v3(ver->n);
-		if(do_tangent) {
+		if (do_tangent) {
 			float *tav= RE_vertren_get_tangent(obr, ver, 0);
 			if (tav) {
 				/* orthonorm. */
@@ -680,8 +683,7 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
 		}
 	}
 
-	if(do_nmap_tangent!=0)
-	{
+	if (do_nmap_tangent != 0) {
 		SRenderMeshToTangent mesh2tangent;
 		SMikkTSpaceContext sContext;
 		SMikkTSpaceInterface sInterface;
@@ -703,9 +705,9 @@ static void calc_vertexnormals(Render *UNUSED(re), ObjectRen *obr, int do_tangen
 		genTangSpaceDefault(&sContext);
 	}
 
-	if(arena)
+	if (arena)
 		BLI_memarena_free(arena);
-	if(vtangents)
+	if (vtangents)
 		MEM_freeN(vtangents);
 }
 
@@ -729,16 +731,16 @@ static void as_addvert(ASvert *asv, VertRen *v1, VlakRen *vlr)
 	ASface *asf;
 	int a;
 	
-	if(v1 == NULL) return;
+	if (v1 == NULL) return;
 	
-	if(asv->faces.first==NULL) {
+	if (asv->faces.first==NULL) {
 		asf= MEM_callocN(sizeof(ASface), "asface");
 		BLI_addtail(&asv->faces, asf);
 	}
 	
 	asf= asv->faces.last;
-	for(a=0; a<4; a++) {
-		if(asf->vlr[a]==NULL) {
+	for (a=0; a<4; a++) {
+		if (asf->vlr[a]==NULL) {
 			asf->vlr[a]= vlr;
 			asv->totface++;
 			break;
@@ -746,7 +748,7 @@ static void as_addvert(ASvert *asv, VertRen *v1, VlakRen *vlr)
 	}
 	
 	/* new face struct */
-	if(a==4) {
+	if (a==4) {
 		asf= MEM_callocN(sizeof(ASface), "asface");
 		BLI_addtail(&asv->faces, asf);
 		asf->vlr[0]= vlr;
@@ -761,14 +763,14 @@ static int as_testvertex(VlakRen *vlr, VertRen *UNUSED(ver), ASvert *asv, float
 	float inp;
 	int a;
 	
-	if(vlr==0) return 0;
+	if (vlr==0) return 0;
 	
 	asf= asv->faces.first;
-	while(asf) {
-		for(a=0; a<4; a++) {
-			if(asf->vlr[a] && asf->vlr[a]!=vlr) {
+	while (asf) {
+		for (a=0; a<4; a++) {
+			if (asf->vlr[a] && asf->vlr[a]!=vlr) {
 				inp = fabsf(dot_v3v3(vlr->n, asf->vlr[a]->n));
-				if(inp < thresh) return 1;
+				if (inp < thresh) return 1;
 			}
 		}
 		asf= asf->next;
@@ -785,13 +787,13 @@ static VertRen *as_findvertex(VlakRen *vlr, VertRen *UNUSED(ver), ASvert *asv, f
 	int a;
 	
 	asf= asv->faces.first;
-	while(asf) {
-		for(a=0; a<4; a++) {
-			if(asf->vlr[a] && asf->vlr[a]!=vlr) {
+	while (asf) {
+		for (a=0; a<4; a++) {
+			if (asf->vlr[a] && asf->vlr[a]!=vlr) {
 				/* this face already made a copy for this vertex! */
-				if(asf->nver[a]) {
+				if (asf->nver[a]) {
 					inp = fabsf(dot_v3v3(vlr->n, asf->vlr[a]->n));
-					if(inp >= thresh) {
+					if (inp >= thresh) {
 						return asf->nver[a];
 					}
 				}
@@ -814,7 +816,7 @@ static void autosmooth(Render *UNUSED(re), ObjectRen *obr, float mat[][4], int d
 	float thresh;
 	int a, b, totvert;
 	
-	if(obr->totvert==0) return;
+	if (obr->totvert==0) return;
 	asverts= MEM_callocN(sizeof(ASvert)*obr->totvert, "all smooth verts");
 	
 	thresh= cosf(DEG2RADF((0.5f + (float)degr)));
@@ -823,43 +825,43 @@ static void autosmooth(Render *UNUSED(re), ObjectRen *obr, float mat[][4], int d
 	
 	
 	/* step one: construct listbase of all vertices and pointers to faces */
-	for(a=0; a<obr->totvlak; a++) {
+	for (a=0; a<obr->totvlak; a++) {
 		vlr= RE_findOrAddVlak(obr, a);
 		/* skip wire faces */
-		if(vlr->v2 != vlr->v3) {
+		if (vlr->v2 != vlr->v3) {
 			as_addvert(asverts+vlr->v1->index, vlr->v1, vlr);
 			as_addvert(asverts+vlr->v2->index, vlr->v2, vlr);
 			as_addvert(asverts+vlr->v3->index, vlr->v3, vlr);
-			if(vlr->v4) 
+			if (vlr->v4)
 				as_addvert(asverts+vlr->v4->index, vlr->v4, vlr);
 		}
 	}
 	
 	totvert= obr->totvert;
 	/* we now test all vertices, when faces have a normal too much different: they get a new vertex */
-	for(a=0, asv=asverts; a<totvert; a++, asv++) {
-		if(asv && asv->totface>1) {
+	for (a=0, asv=asverts; a<totvert; a++, asv++) {
+		if (asv && asv->totface>1) {
 			ver= RE_findOrAddVert(obr, a);
 
 			asf= asv->faces.first;
-			while(asf) {
-				for(b=0; b<4; b++) {
+			while (asf) {
+				for (b=0; b<4; b++) {
 				
 					/* is there a reason to make a new vertex? */
 					vlr= asf->vlr[b];
-					if( as_testvertex(vlr, ver, asv, thresh) ) {
+					if ( as_testvertex(vlr, ver, asv, thresh) ) {
 						
 						/* already made a new vertex within threshold? */
 						v1= as_findvertex(vlr, ver, asv, thresh);
-						if(v1==NULL) {
+						if (v1==NULL) {
 							/* make a new vertex */
 							v1= RE_vertren_copy(obr, ver);
 						}
 						asf->nver[b]= v1;
-						if(vlr->v1==ver) vlr->v1= v1;
-						if(vlr->v2==ver) vlr->v2= v1;
-						if(vlr->v3==ver) vlr->v3= v1;
-						if(vlr->v4==ver) vlr->v4= v1;
+						if (vlr->v1==ver) vlr->v1= v1;
+						if (vlr->v2==ver) vlr->v2= v1;
+						if (vlr->v3==ver) vlr->v3= v1;
+						if (vlr->v4==ver) vlr->v4= v1;
 					}
 				}
 				asf= asf->next;
@@ -868,22 +870,22 @@ static void autosmooth(Render *UNUSED(re), ObjectRen *obr, float mat[][4], int d
 	}
 	
 	/* free */
-	for(a=0; a<totvert; a++) {
+	for (a=0; a<totvert; a++) {
 		BLI_freelistN(&asverts[a].faces);
 	}
 	MEM_freeN(asverts);
 	
 	/* rotate vertices and calculate normal of faces */
-	for(a=0; a<obr->totvert; a++) {
+	for (a=0; a<obr->totvert; a++) {
 		ver= RE_findOrAddVert(obr, a);
 		mul_m4_v3(mat, ver->co);
 	}
-	for(a=0; a<obr->totvlak; a++) {
+	for (a=0; a<obr->totvlak; a++) {
 		vlr= RE_findOrAddVlak(obr, a);
 		
 		/* skip wire faces */
-		if(vlr->v2 != vlr->v3) {
-			if(vlr->v4) 
+		if (vlr->v2 != vlr->v3) {
+			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);
@@ -907,7 +909,8 @@ static float *get_object_orco(Render *re, Object *ob)
 	if (!orco) {
 		if (ELEM(ob->type, OB_CURVE, OB_FONT)) {
 			orco = make_orco_curve(re->scene, ob);
-		} else if (ob->type==OB_SURF) {
+		}
+		else if (ob->type==OB_SURF) {
 			orco = make_orco_surf(ob);
 		}
 
@@ -943,16 +946,16 @@ static void check_material_mapto(Material *ma)
 	 * this can avoid a bit of time spent iterating through all the texture slots, map inputs and map tos
 	 * every time a property which may or may not be textured is accessed */
 	
-	for(a=0; a<MAX_MTEX; a++) {
-		if(ma->mtex[a] && ma->mtex[a]->tex) {
+	for (a=0; a<MAX_MTEX; a++) {
+		if (ma->mtex[a] && ma->mtex[a]->tex) {
 			/* currently used only in volume render, so we'll check for those flags */
-			if(ma->mtex[a]->mapto & MAP_DENSITY) ma->mapto_textured |= MAP_DENSITY;
-			if(ma->mtex[a]->mapto & MAP_EMISSION) ma->mapto_textured |= MAP_EMISSION;
-			if(ma->mtex[a]->mapto & MAP_EMISSION_COL) ma->mapto_textured |= MAP_EMISSION_COL;
-			if(ma->mtex[a]->mapto & MAP_SCATTERING) ma->mapto_textured |= MAP_SCATTERING;
-			if(ma->mtex[a]->mapto & MAP_TRANSMISSION_COL) ma->mapto_textured |= MAP_TRANSMISSION_COL;
-			if(ma->mtex[a]->mapto & MAP_REFLECTION) ma->mapto_textured |= MAP_REFLECTION;
-			if(ma->mtex[a]->mapto & MAP_REFLECTION_COL) ma->mapto_textured |= MAP_REFLECTION_COL;
+			if (ma->mtex[a]->mapto & MAP_DENSITY) ma->mapto_textured |= MAP_DENSITY;
+			if (ma->mtex[a]->mapto & MAP_EMISSION) ma->mapto_textured |= MAP_EMISSION;
+			if (ma->mtex[a]->mapto & MAP_EMISSION_COL) ma->mapto_textured |= MAP_EMISSION_COL;
+			if (ma->mtex[a]->mapto & MAP_SCATTERING) ma->mapto_textured |= MAP_SCATTERING;
+			if (ma->mtex[a]->mapto & MAP_TRANSMISSION_COL) ma->mapto_textured |= MAP_TRANSMISSION_COL;
+			if (ma->mtex[a]->mapto & MAP_REFLECTION) ma->mapto_textured |= MAP_REFLECTION;
+			if (ma->mtex[a]->mapto & MAP_REFLECTION_COL) ma->mapto_textured |= MAP_REFLECTION_COL;
 		}
 	}
 }
@@ -960,17 +963,17 @@ static void flag_render_node_material(Render *re, bNodeTree *ntree)
 {
 	bNode *node;
 
-	for(node=ntree->nodes.first; node; node= node->next) {
-		if(node->id) {
-			if(GS(node->id->name)==ID_MA) {
+	for (node=ntree->nodes.first; node; node= node->next) {
+		if (node->id) {
+			if (GS(node->id->name)==ID_MA) {
 				Material *ma= (Material *)node->id;
 
-				if((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP))
+				if ((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP))
 					re->flag |= R_ZTRA;
 
 				ma->flag |= MA_IS_USED;
 			}
-			else if(node->type==NODE_GROUP)
+			else if (node->type==NODE_GROUP)
 				flag_render_node_material(re, (bNodeTree *)node->id);
 		}
 	}
@@ -982,22 +985,22 @@ static Material *give_render_material(Render *re, Object *ob, short nr)
 	Material *ma;
 	
 	ma= give_current_material(ob, nr);
-	if(ma==NULL) 
+	if (ma==NULL)
 		ma= &defmaterial;
 	
-	if(re->r.mode & R_SPEED) ma->texco |= NEED_UV;
+	if (re->r.mode & R_SPEED) ma->texco |= NEED_UV;
 	
-	if(ma->material_type == MA_TYPE_VOLUME) {
+	if (ma->material_type == MA_TYPE_VOLUME) {
 		ma->mode |= MA_TRANSP;
 		ma->mode &= ~MA_SHADBUF;
 	}
-	if((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP))
+	if ((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP))
 		re->flag |= R_ZTRA;
 	
 	/* for light groups and SSS */
 	ma->flag |= MA_IS_USED;
 
-	if(ma->nodetree && ma->use_nodes)
+	if (ma->nodetree && ma->use_nodes)
 		flag_render_node_material(re, ma->nodetree);
 	
 	check_material_mapto(ma);
@@ -1037,10 +1040,10 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
 	dy= re->winy*cross[1]*re->winmat[1][1];
 	w= sqrt(dx*dx + dy*dy)/w;
 	
-	if(w!=0.0f) {
+	if (w!=0.0f) {
 		float fac;
-		if(ma->strand_ease!=0.0f) {
-			if(ma->strand_ease<0.0f)
+		if (ma->strand_ease!=0.0f) {
+			if (ma->strand_ease<0.0f)
 				fac= pow(sd->time, 1.0f+ma->strand_ease);
 			else
 				fac= pow(sd->time, 1.0f/(1.0f-ma->strand_ease));
@@ -1050,11 +1053,11 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
 		width= ((1.0f-fac)*ma->strand_sta + (fac)*ma->strand_end);
 
 		/* use actual Blender units for strand width and fall back to minimum width */
-		if(ma->mode & MA_STR_B_UNITS){
+		if (ma->mode & MA_STR_B_UNITS) {
 			crosslen= len_v3(cross);
 			w= 2.0f*crosslen*ma->strand_min/w;
 
-			if(width < w)
+			if (width < w)
 				width= w;
 
 			/*cross is the radius of the strand so we want it to be half of full width */
@@ -1066,17 +1069,17 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
 		mul_v3_fl(cross, width);
 	}
 	
-	if(ma->mode & MA_TANGENT_STR)
+	if (ma->mode & MA_TANGENT_STR)
 		flag= R_SMOOTH|R_TANGENT;
 	else
 		flag= R_SMOOTH;
 	
 	/* only 1 pixel wide strands filled in as quads now, otherwise zbuf errors */
-	if(ma->strand_sta==1.0f)
+	if (ma->strand_sta==1.0f)
 		flag |= R_STRAND;
 	
 	/* single face line */
-	if(sd->line) {
+	if (sd->line) {
 		vlr= RE_findOrAddVlak(obr, obr->totvlak++);
 		vlr->flag= flag;
 		vlr->v1= RE_findOrAddVert(obr, obr->totvert++);
@@ -1113,13 +1116,13 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
 		vlr->mat= ma;
 		vlr->ec= ME_V2V3;
 
-		if(sd->surfnor) {
+		if (sd->surfnor) {
 			float *snor= RE_vlakren_get_surfnor(obr, vlr, 1);
 			copy_v3_v3(snor, sd->surfnor);
 		}
 
-		if(sd->uvco){
-			for(i=0; i<sd->totuv; i++){
+		if (sd->uvco) {
+			for (i=0; i<sd->totuv; i++) {
 				MTFace *mtf;
 				mtf=RE_vlakren_get_tface(obr,vlr,i,NULL,1);
 				mtf->uv[0][0]=mtf->uv[1][0]=
@@ -1127,7 +1130,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
 				mtf->uv[0][1]=mtf->uv[1][1]=
 				mtf->uv[2][1]=mtf->uv[3][1]=(sd->uvco+2*i)[1];
 			}
-			if(sd->override_uv>=0){
+			if (sd->override_uv>=0) {
 				MTFace *mtf;
 				mtf=RE_vlakren_get_tface(obr,vlr,sd->override_uv,NULL,0);
 				
@@ -1138,8 +1141,8 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
 				mtf->uv[2][1]=mtf->uv[3][1]=1.0f;
 			}
 		}
-		if(sd->mcol){
-			for(i=0; i<sd->totcol; i++){
+		if (sd->mcol) {
+			for (i=0; i<sd->totcol; i++) {
 				MCol *mc;
 				mc=RE_vlakren_get_mcol(obr,vlr,i,NULL,1);
 				mc[0]=mc[1]=mc[2]=mc[3]=sd->mcol[i];
@@ -1148,8 +1151,8 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
 		}
 	}
 	/* first two vertices of a strand */
-	else if(sd->first) {
-		if(sd->adapt){
+	else if (sd->first) {
+		if (sd->adapt) {
 			copy_v3_v3(anor, nor);
 			copy_v3_v3(avec, vec);
 			second=1;
@@ -1172,7 +1175,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
 	}
 	/* more vertices & faces to strand */
 	else {
-		if(sd->adapt==0 || second){
+		if (sd->adapt==0 || second) {
 			vlr= RE_findOrAddVlak(obr, obr->totvlak++);
 			vlr->flag= flag;
 			vlr->v1= v1;
@@ -1184,14 +1187,14 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
 			v2= vlr->v3; // cycle
 
 			
-			if(sd->adapt){
+			if (sd->adapt) {
 				second=0;
 				copy_v3_v3(anor,nor);
 				copy_v3_v3(avec,vec);
 			}
 
 		}
-		else if(sd->adapt){
+		else if (sd->adapt) {
 			float dvec[3],pvec[3];
 			sub_v3_v3v3(dvec,avec,vec);
 			project_v3_v3v3(pvec,dvec,vec);
@@ -1201,7 +1204,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
 			dx= re->winx*dvec[0]*re->winmat[0][0]/w;
 			dy= re->winy*dvec[1]*re->winmat[1][1]/w;
 			w= sqrt(dx*dx + dy*dy);
-			if(dot_v3v3(anor,nor)<sd->adapt_angle && w>sd->adapt_pix){
+			if (dot_v3v3(anor,nor)<sd->adapt_angle && w>sd->adapt_pix) {
 				vlr= RE_findOrAddVlak(obr, obr->totvlak++);
 				vlr->flag= flag;
 				vlr->v1= v1;
@@ -1215,7 +1218,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
 				copy_v3_v3(anor,nor);
 				copy_v3_v3(avec,vec);
 			}
-			else{
+			else {
 				vlr= RE_findOrAddVlak(obr, obr->totvlak-1);
 			}
 		}
@@ -1237,13 +1240,13 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
 		vlr->mat= ma;
 		vlr->ec= ME_V2V3;
 
-		if(sd->surfnor) {
+		if (sd->surfnor) {
 			float *snor= RE_vlakren_get_surfnor(obr, vlr, 1);
 			copy_v3_v3(snor, sd->surfnor);
 		}
 
-		if(sd->uvco){
-			for(i=0; i<sd->totuv; i++){
+		if (sd->uvco) {
+			for (i=0; i<sd->totuv; i++) {
 				MTFace *mtf;
 				mtf=RE_vlakren_get_tface(obr,vlr,i,NULL,1);
 				mtf->uv[0][0]=mtf->uv[1][0]=
@@ -1251,7 +1254,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
 				mtf->uv[0][1]=mtf->uv[1][1]=
 				mtf->uv[2][1]=mtf->uv[3][1]=(sd->uvco+2*i)[1];
 			}
-			if(sd->override_uv>=0){
+			if (sd->override_uv>=0) {
 				MTFace *mtf;
 				mtf=RE_vlakren_get_tface(obr,vlr,sd->override_uv,NULL,0);
 				
@@ -1262,8 +1265,8 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par
 				mtf->uv[2][1]=mtf->uv[3][1]=(vlr->v3->accum+1.0f)/2.0f;
 			}
 		}
-		if(sd->mcol){
-			for(i=0; i<sd->totcol; i++){
+		if (sd->mcol) {
+			for (i=0; i<sd->totcol; i++) {
 				MCol *mc;
 				mc=RE_vlakren_get_mcol(obr,vlr,i,NULL,1);
 				mc[0]=mc[1]=mc[2]=mc[3]=sd->mcol[i];
@@ -1278,7 +1281,7 @@ static void static_particle_wire(ObjectRen *obr, Material *ma, const float vec[3
 	VlakRen *vlr;
 	static VertRen *v1;
 
-	if(line) {
+	if (line) {
 		vlr= RE_findOrAddVlak(obr, obr->totvlak++);
 		vlr->v1= RE_findOrAddVert(obr, obr->totvert++);
 		vlr->v2= RE_findOrAddVert(obr, obr->totvert++);
@@ -1297,7 +1300,7 @@ static void static_particle_wire(ObjectRen *obr, Material *ma, const float vec[3
 		vlr->ec= ME_V1V2;
 
 	}
-	else if(first) {
+	else if (first) {
 		v1= RE_findOrAddVert(obr, obr->totvert++);
 		copy_v3_v3(v1->co, vec);
 	}
@@ -1325,11 +1328,11 @@ static void particle_curve(Render *re, ObjectRen *obr, DerivedMesh *dm, Material
 {
 	HaloRen *har=0;
 
-	if(ma->material_type == MA_TYPE_WIRE)
+	if (ma->material_type == MA_TYPE_WIRE)
 		static_particle_wire(obr, ma, loc, loc1, sd->first, sd->line);
-	else if(ma->material_type == MA_TYPE_HALO) {
+	else if (ma->material_type == MA_TYPE_HALO) {
 		har= RE_inithalo_particle(re, obr, dm, ma, loc, loc1, sd->orco, sd->uvco, sd->size, 1.0, seed, pa_co);
-		if(har) har->lay= obr->ob->lay;
+		if (har) har->lay= obr->ob->lay;
 	}
 	else
 		static_particle_strand(re, obr, ma, sd, loc, loc1);
@@ -1378,17 +1381,17 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl
 	vlr->mat= ma;
 	vlr->ec= ME_V2V3;
 
-	if(bb->uv_split > 1){
+	if (bb->uv_split > 1) {
 		uvdx = uvdy = 1.0f / (float)bb->uv_split;
 
-		if(ELEM(bb->anim, PART_BB_ANIM_AGE, PART_BB_ANIM_FRAME)) {
-			if(bb->anim == PART_BB_ANIM_FRAME)
+		if (ELEM(bb->anim, PART_BB_ANIM_AGE, PART_BB_ANIM_FRAME)) {
+			if (bb->anim == PART_BB_ANIM_FRAME)
 				time = ((int)(bb->time * bb->lifetime) % totsplit)/(float)totsplit;
 			else
 				time = bb->time;
 		}
-		else if(bb->anim == PART_BB_ANIM_ANGLE) {
-			if(bb->align == PART_BB_VIEW) {
+		else if (bb->anim == PART_BB_ANIM_ANGLE) {
+			if (bb->align == PART_BB_VIEW) {
 				time = (float)fmod((bb->tilt + 1.0f) / 2.0f, 1.0);
 			}
 			else {
@@ -1398,23 +1401,23 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl
 				axis1[(bb->align + 1) % 3] = 1.0f;
 				axis2[(bb->align + 2) % 3] = 1.0f;
 
-				if(bb->lock == 0) {
+				if (bb->lock == 0) {
 					zvec[bb->align] = 0.0f;
 					normalize_v3(zvec);
 				}
 				
 				time = saacos(dot_v3v3(zvec, axis1)) / (float)M_PI;
 				
-				if(dot_v3v3(zvec, axis2) < 0.0f)
+				if (dot_v3v3(zvec, axis2) < 0.0f)
 					time = 1.0f - time / 2.0f;
 				else
 					time /= 2.0f;
 			}
 		}
 
-		if(bb->split_offset == PART_BB_OFF_LINEAR)
+		if (bb->split_offset == PART_BB_OFF_LINEAR)
 			time = (float)fmod(time + (float)bb->num / (float)totsplit, 1.0f);
-		else if(bb->split_offset==PART_BB_OFF_RANDOM)
+		else if (bb->split_offset==PART_BB_OFF_RANDOM)
 			time = (float)fmod(time + bb->random, 1.0f);
 
 		/* Find the coordinates in tile space (integer), then convert to UV
@@ -1428,7 +1431,7 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl
 	}
 
 	/* normal UVs */
-	if(bb->uv[0] >= 0){
+	if (bb->uv[0] >= 0) {
 		mtf = RE_vlakren_get_tface(obr, vlr, bb->uv[0], NULL, 1);
 		mtf->uv[0][0] = 1.0f;
 		mtf->uv[0][1] = 1.0f;
@@ -1441,14 +1444,14 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl
 	}
 
 	/* time-index UVs */
-	if(bb->uv[1] >= 0){
+	if (bb->uv[1] >= 0) {
 		mtf = RE_vlakren_get_tface(obr, vlr, bb->uv[1], NULL, 1);
 		mtf->uv[0][0] = mtf->uv[1][0] = mtf->uv[2][0] = mtf->uv[3][0] = bb->time;
 		mtf->uv[0][1] = mtf->uv[1][1] = mtf->uv[2][1] = mtf->uv[3][1] = (float)bb->num/(float)bb->totnum;
 	}
 
 	/* split UVs */
-	if(bb->uv_split > 1 && bb->uv[2] >= 0){
+	if (bb->uv_split > 1 && bb->uv[2] >= 0) {
 		mtf = RE_vlakren_get_tface(obr, vlr, bb->uv[2], NULL, 1);
 		mtf->uv[0][0] = uvx + uvdx;
 		mtf->uv[0][1] = uvy + uvdy;
@@ -1466,7 +1469,7 @@ static void particle_normal_ren(short ren_as, ParticleSettings *part, Render *re
 	
 	copy_v3_v3(loc, state->co);
 
-	if(ren_as != PART_DRAW_BB)
+	if (ren_as != PART_DRAW_BB)
 		mul_m4_v3(re->viewmat, loc);
 
 	switch(ren_as) {
@@ -1479,7 +1482,7 @@ static void particle_normal_ren(short ren_as, ParticleSettings *part, Render *re
 			mul_mat3_m4_v3(re->viewmat, vel);
 			normalize_v3(vel);
 
-			if(part->draw & PART_DRAW_VEL_LENGTH)
+			if (part->draw & PART_DRAW_VEL_LENGTH)
 				mul_v3_fl(vel, len_v3(state->vel));
 
 			madd_v3_v3v3fl(loc0, loc, vel, -part->draw_line[0]);
@@ -1504,7 +1507,7 @@ static void particle_normal_ren(short ren_as, ParticleSettings *part, Render *re
 
 			har = RE_inithalo_particle(re, obr, dm, ma, loc, NULL, sd->orco, sd->uvco, hasize, 0.0, seed, pa_co);
 			
-			if(har) har->lay= obr->ob->lay;
+			if (har) har->lay= obr->ob->lay;
 
 			break;
 		}
@@ -1515,10 +1518,10 @@ static void get_particle_uvco_mcol(short from, DerivedMesh *dm, float *fuv, int
 	int i;
 
 	/* get uvco */
-	if(sd->uvco && ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)) {
-		for(i=0; i<sd->totuv; i++) {
-			if(num != DMCACHE_NOTFOUND) {
-				MFace *mface = dm->getFaceData(dm, num, CD_MFACE);
+	if (sd->uvco && ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)) {
+		for (i=0; i<sd->totuv; i++) {
+			if (num != DMCACHE_NOTFOUND) {
+				MFace *mface = dm->getTessFaceData(dm, num, CD_MFACE);
 				MTFace *mtface = (MTFace*)CustomData_get_layer_n(&dm->faceData, CD_MTFACE, i);
 				mtface += num;
 				
@@ -1532,10 +1535,10 @@ static void get_particle_uvco_mcol(short from, DerivedMesh *dm, float *fuv, int
 	}
 
 	/* get mcol */
-	if(sd->mcol && ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)) {
-		for(i=0; i<sd->totcol; i++) {
-			if(num != DMCACHE_NOTFOUND) {
-				MFace *mface = dm->getFaceData(dm, num, CD_MFACE);
+	if (sd->mcol && ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)) {
+		for (i=0; i<sd->totcol; i++) {
+			if (num != DMCACHE_NOTFOUND) {
+				MFace *mface = dm->getTessFaceData(dm, num, CD_MFACE);
 				MCol *mc = (MCol*)CustomData_get_layer_n(&dm->faceData, CD_MCOL, i);
 				mc += num * 4;
 
@@ -1579,23 +1582,23 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 	char **uv_name=0;
 
 /* 1. check that everything is ok & updated */
-	if(psys==NULL)
+	if (psys==NULL)
 		return 0;
 
 	part=psys->part;
 	pars=psys->particles;
 
-	if(part==NULL || pars==NULL || !psys_check_enabled(ob, psys))
+	if (part==NULL || pars==NULL || !psys_check_enabled(ob, psys))
 		return 0;
 	
-	if(part->ren_as==PART_DRAW_OB || part->ren_as==PART_DRAW_GR || part->ren_as==PART_DRAW_NOT)
+	if (part->ren_as==PART_DRAW_OB || part->ren_as==PART_DRAW_GR || part->ren_as==PART_DRAW_NOT)
 		return 1;
 
-/* 2. start initialising things */
+/* 2. start initializing things */
 
 	/* last possibility to bail out! */
 	psmd = psys_get_modifier(ob,psys);
-	if(!(psmd->modifier.mode & eModifierMode_Render))
+	if (!(psmd->modifier.mode & eModifierMode_Render))
 		return 0;
 
 	sim.scene= re->scene;
@@ -1603,16 +1606,16 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 	sim.psys= psys;
 	sim.psmd= psmd;
 
-	if(part->phystype==PART_PHYS_KEYED)
+	if (part->phystype==PART_PHYS_KEYED)
 		psys_count_keyed_targets(&sim);
 
 	totchild=psys->totchild;
 
 	/* can happen for disconnected/global hair */
-	if(part->type==PART_HAIR && !psys->childcache)
+	if (part->type==PART_HAIR && !psys->childcache)
 		totchild= 0;
 
-	if(G.rendering == 0) { /* preview render */
+	if (G.rendering == 0) { /* preview render */
 		totchild = (int)((float)totchild * (float)part->disp / 100.0f);
 	}
 
@@ -1629,7 +1632,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 	ma= give_render_material(re, ob, part->omat);
 	
 #if 0 // XXX old animation system
-	if(ma->ipo){
+	if (ma->ipo) {
 		calc_ipo(ma->ipo, cfra);
 		execute_ipo((ID *)ma, ma->ipo);
 	}
@@ -1644,10 +1647,10 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 	sd.totuv = CustomData_number_of_layers(&psmd->dm->faceData, CD_MTFACE);
 	sd.totcol = CustomData_number_of_layers(&psmd->dm->faceData, CD_MCOL);
 
-	if(ma->texco & TEXCO_UV && sd.totuv) {
+	if (ma->texco & TEXCO_UV && sd.totuv) {
 		sd.uvco = MEM_callocN(sd.totuv * 2 * sizeof(float), "particle_uvs");
 
-		if(ma->strand_uvname[0]) {
+		if (ma->strand_uvname[0]) {
 			sd.override_uv = CustomData_get_named_layer_index(&psmd->dm->faceData, CD_MTFACE, ma->strand_uvname);
 			sd.override_uv -= CustomData_get_layer_index(&psmd->dm->faceData, CD_MTFACE);
 		}
@@ -1655,22 +1658,22 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 	else
 		sd.uvco = NULL;
 
-	if(sd.totcol)
+	if (sd.totcol)
 		sd.mcol = MEM_callocN(sd.totcol * sizeof(MCol), "particle_mcols");
 
 /* 2.2 setup billboards */
-	if(part->ren_as == PART_DRAW_BB) {
+	if (part->ren_as == PART_DRAW_BB) {
 		int first_uv = CustomData_get_layer_index(&psmd->dm->faceData, CD_MTFACE);
 
 		bb.uv[0] = CustomData_get_named_layer_index(&psmd->dm->faceData, CD_MTFACE, psys->bb_uvname[0]);
-		if(bb.uv[0] < 0)
+		if (bb.uv[0] < 0)
 			bb.uv[0] = CustomData_get_active_layer_index(&psmd->dm->faceData, CD_MTFACE);
 
 		bb.uv[1] = CustomData_get_named_layer_index(&psmd->dm->faceData, CD_MTFACE, psys->bb_uvname[1]);
 
 		bb.uv[2] = CustomData_get_named_layer_index(&psmd->dm->faceData, CD_MTFACE, psys->bb_uvname[2]);
 
-		if(first_uv >= 0) {
+		if (first_uv >= 0) {
 			bb.uv[0] -= first_uv;
 			bb.uv[1] -= first_uv;
 			bb.uv[2] -= first_uv;
@@ -1691,24 +1694,24 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 	copy_m3_m4(nmat, ob->imat);
 	transpose_m3(nmat);
 
-	if(psys->flag & PSYS_USE_IMAT) {
+	if (psys->flag & PSYS_USE_IMAT) {
 		/* psys->imat is the original emitter's inverse matrix, ob->obmat is the duplicated object's matrix */
 		mult_m4_m4m4(duplimat, ob->obmat, psys->imat);
 		use_duplimat = 1;
 	}
 
 /* 2.6 setup strand rendering */
-	if(part->ren_as == PART_DRAW_PATH && psys->pathcache){
+	if (part->ren_as == PART_DRAW_PATH && psys->pathcache) {
 		path_nbr=(int)pow(2.0,(double) part->ren_step);
 
-		if(path_nbr) {
-			if(!ELEM(ma->material_type, MA_TYPE_HALO, MA_TYPE_WIRE)) {
+		if (path_nbr) {
+			if (!ELEM(ma->material_type, MA_TYPE_HALO, MA_TYPE_WIRE)) {
 				sd.orco = MEM_mallocN(3*sizeof(float)*(totpart+totchild), "particle orcos");
 				set_object_orco(re, psys, sd.orco);
 			}
 		}
 
-		if(part->draw & PART_DRAW_REN_ADAPT) {
+		if (part->draw & PART_DRAW_REN_ADAPT) {
 			sd.adapt = 1;
 			sd.adapt_pix = (float)part->adapt_pix;
 			sd.adapt_angle = cosf(DEG2RADF((float)part->adapt_angle));
@@ -1726,29 +1729,29 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 			strandbuf->overrideuv= sd.override_uv;
 			strandbuf->minwidth= ma->strand_min;
 
-			if(ma->strand_widthfade == 0.0f)
+			if (ma->strand_widthfade == 0.0f)
 				strandbuf->widthfade= 0.0f;
-			else if(ma->strand_widthfade >= 1.0f)
+			else if (ma->strand_widthfade >= 1.0f)
 				strandbuf->widthfade= 2.0f - ma->strand_widthfade;
 			else
 				strandbuf->widthfade= 1.0f/MAX2(ma->strand_widthfade, 1e-5f);
 
-			if(part->flag & PART_HAIR_BSPLINE)
+			if (part->flag & PART_HAIR_BSPLINE)
 				strandbuf->flag |= R_STRAND_BSPLINE;
-			if(ma->mode & MA_STR_B_UNITS)
+			if (ma->mode & MA_STR_B_UNITS)
 				strandbuf->flag |= R_STRAND_B_UNITS;
 
 			svert= strandbuf->vert;
 
-			if(re->r.mode & R_SPEED)
+			if (re->r.mode & R_SPEED)
 				dosurfacecache= 1;
-			else if((re->wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) && (re->wrld.ao_gather_method == WO_AOGATHER_APPROX))
-				if(ma->amb != 0.0f)
+			else if ((re->wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) && (re->wrld.ao_gather_method == WO_AOGATHER_APPROX))
+				if (ma->amb != 0.0f)
 					dosurfacecache= 1;
 
-			totface= psmd->dm->getNumFaces(psmd->dm);
-			origindex= psmd->dm->getFaceDataArray(psmd->dm, CD_ORIGINDEX);
-			for(a=0; a<totface; a++)
+			totface= psmd->dm->getNumTessFaces(psmd->dm);
+			origindex= psmd->dm->getTessFaceDataArray(psmd->dm, CD_ORIGINDEX);
+			for (a=0; a<totface; a++)
 				strandbuf->totbound= MAX2(strandbuf->totbound, (origindex)? origindex[a]: a);
 
 			strandbuf->totbound++;
@@ -1758,20 +1761,20 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 		}
 	}
 
-	if(sd.orco == 0) {
+	if (sd.orco == 0) {
 		sd.orco = MEM_mallocN(3 * sizeof(float), "particle orco");
 		orco1 = 1;
 	}
 
-	if(path_nbr == 0)
+	if (path_nbr == 0)
 		psys->lattice = psys_get_lattice(&sim);
 
 /* 3. start creating renderable things */
-	for(a=0,pa=pars; a<totpart+totchild; a++, pa++, seed++) {
+	for (a=0,pa=pars; a<totpart+totchild; a++, pa++, seed++) {
 		random = rng_getFloat(rng);
 		/* setup per particle individual stuff */
-		if(a<totpart){
-			if(pa->flag & PARS_UNEXIST) continue;
+		if (a<totpart) {
+			if (pa->flag & PARS_UNEXIST) continue;
 
 			pa_time=(cfra-pa->time)/pa->lifetime;
 			pa_birthtime = pa->time;
@@ -1779,9 +1782,10 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 
 			hasize = ma->hasize;
 
+			/* XXX 'tpsys' is alwyas NULL, this code won't run! */
 			/* get orco */
-			if(tpsys && part->phystype==PART_PHYS_NO){
-				tpa=tpsys->particles+pa->num;
+			if (tpsys && part->phystype == PART_PHYS_NO) {
+				tpa = tpsys->particles + pa->num;
 				psys_particle_on_emitter(psmd,tpart->from,tpa->num,pa->num_dmcache,tpa->fuv,tpa->foffset,co,nor,0,0,sd.orco,0);
 			}
 			else
@@ -1790,8 +1794,8 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 			/* get uvco & mcol */
 			num= pa->num_dmcache;
 
-			if(num == DMCACHE_NOTFOUND)
-				if(pa->num < psmd->dm->getNumFaces(psmd->dm))
+			if (num == DMCACHE_NOTFOUND)
+				if (pa->num < psmd->dm->getNumTessFaces(psmd->dm))
 					num= pa->num;
 
 			get_particle_uvco_mcol(part->from, psmd->dm, pa->fuv, num, &sd);
@@ -1801,20 +1805,20 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 			r_tilt = 2.0f*(PSYS_FRAND(a) - 0.5f);
 			r_length = PSYS_FRAND(a+1);
 
-			if(path_nbr) {
+			if (path_nbr) {
 				cache = psys->pathcache[a];
 				max_k = (int)cache->steps;
 			}
 
-			if(totchild && (part->draw&PART_DRAW_PARENT)==0) continue;
+			if (totchild && (part->draw&PART_DRAW_PARENT)==0) continue;
 		}
 		else {
 			ChildParticle *cpa= psys->child+a-totpart;
 
-			if(path_nbr) {
+			if (path_nbr) {
 				cache = psys->childcache[a-totpart];
 
-				if(cache->steps < 0)
+				if (cache->steps < 0)
 					continue;
 
 				max_k = (int)cache->steps;
@@ -1829,7 +1833,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 			num = cpa->num;
 
 			/* get orco */
-			if(part->childtype == PART_CHILD_FACES) {
+			if (part->childtype == PART_CHILD_FACES) {
 				psys_particle_on_emitter(psmd,
 					PART_FROM_FACE, cpa->num,DMCACHE_ISCHILD,
 					cpa->fuv,cpa->foffset,co,nor,0,0,sd.orco,0);
@@ -1842,15 +1846,15 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 			}
 
 			/* get uvco & mcol */
-			if(part->childtype==PART_CHILD_FACES) {
+			if (part->childtype==PART_CHILD_FACES) {
 				get_particle_uvco_mcol(PART_FROM_FACE, psmd->dm, cpa->fuv, cpa->num, &sd);
 			}
 			else {
 				ParticleData *parent = psys->particles + cpa->parent;
 				num = parent->num_dmcache;
 
-				if(num == DMCACHE_NOTFOUND)
-					if(parent->num < psmd->dm->getNumFaces(psmd->dm))
+				if (num == DMCACHE_NOTFOUND)
+					if (parent->num < psmd->dm->getNumTessFaces(psmd->dm))
 						num = parent->num;
 
 				get_particle_uvco_mcol(part->from, psmd->dm, parent->fuv, num, &sd);
@@ -1858,10 +1862,10 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 
 			dosimplify = psys_render_simplify_params(psys, cpa, simplify);
 
-			if(strandbuf) {
+			if (strandbuf) {
 				int orignum= (origindex)? origindex[cpa->num]: cpa->num;
 
-				if(orignum > sbound - strandbuf->bound) {
+				if (orignum > sbound - strandbuf->bound) {
 					sbound= strandbuf->bound + orignum;
 					sbound->start= sbound->end= obr->totstrand;
 				}
@@ -1874,7 +1878,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 		pa_co[2] = 0.f;
 
 		/* surface normal shading setup */
-		if(ma->mode_l & MA_STR_SURFDIFF) {
+		if (ma->mode_l & MA_STR_SURFDIFF) {
 			mul_m3_v3(nmat, nor);
 			sd.surfnor= nor;
 		}
@@ -1882,31 +1886,31 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 			sd.surfnor= NULL;
 
 		/* strand render setup */
-		if(strandbuf) {
+		if (strandbuf) {
 			strand= RE_findOrAddStrand(obr, obr->totstrand++);
 			strand->buffer= strandbuf;
 			strand->vert= svert;
 			copy_v3_v3(strand->orco, sd.orco);
 
-			if(dosimplify) {
+			if (dosimplify) {
 				float *ssimplify= RE_strandren_get_simplify(obr, strand, 1);
 				ssimplify[0]= simplify[0];
 				ssimplify[1]= simplify[1];
 			}
 
-			if(sd.surfnor) {
+			if (sd.surfnor) {
 				float *snor= RE_strandren_get_surfnor(obr, strand, 1);
 				copy_v3_v3(snor, sd.surfnor);
 			}
 
-			if(dosurfacecache && num >= 0) {
+			if (dosurfacecache && num >= 0) {
 				int *facenum= RE_strandren_get_face(obr, strand, 1);
 				*facenum= num;
 			}
 
-			if(sd.uvco) {
-				for(i=0; i<sd.totuv; i++) {
-					if(i != sd.override_uv) {
+			if (sd.uvco) {
+				for (i=0; i<sd.totuv; i++) {
+					if (i != sd.override_uv) {
 						float *uv= RE_strandren_get_uv(obr, strand, i, NULL, 1);
 
 						uv[0]= sd.uvco[2*i];
@@ -1914,8 +1918,8 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 					}
 				}
 			}
-			if(sd.mcol) {
-				for(i=0; i<sd.totcol; i++) {
+			if (sd.mcol) {
+				for (i=0; i<sd.totcol; i++) {
 					MCol *mc= RE_strandren_get_mcol(obr, strand, i, NULL, 1);
 					*mc = sd.mcol[i];
 				}
@@ -1925,43 +1929,43 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 		}
 
 		/* strandco computation setup */
-		if(path_nbr) {
+		if (path_nbr) {
 			strandlen= 0.0f;
 			curlen= 0.0f;
-			for(k=1; k<=path_nbr; k++)
-				if(k<=max_k)
+			for (k=1; k<=path_nbr; k++)
+				if (k<=max_k)
 					strandlen += len_v3v3((cache+k-1)->co, (cache+k)->co);
 		}
 
-		if(path_nbr) {
+		if (path_nbr) {
 			/* render strands */
-			for(k=0; k<=path_nbr; k++){
+			for (k=0; k<=path_nbr; k++) {
 				float time;
 
-				if(k<=max_k){
+				if (k<=max_k) {
 					copy_v3_v3(state.co,(cache+k)->co);
 					copy_v3_v3(state.vel,(cache+k)->vel);
 				}
 				else
 					continue;	
 
-				if(k > 0)
+				if (k > 0)
 					curlen += len_v3v3((cache+k-1)->co, (cache+k)->co);
 				time= curlen/strandlen;
 
 				copy_v3_v3(loc,state.co);
 				mul_m4_v3(re->viewmat,loc);
 
-				if(strandbuf) {
+				if (strandbuf) {
 					copy_v3_v3(svert->co, loc);
 					svert->strandco= -1.0f + 2.0f*time;
 					svert++;
 					strand->totvert++;
 				}
-				else{
+				else {
 					sd.size = hasize;
 
-					if(k==1){
+					if (k==1) {
 						sd.first = 1;
 						sd.time = 0.0f;
 						sub_v3_v3v3(loc0,loc1,loc);
@@ -1973,7 +1977,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 					sd.first = 0;
 					sd.time = time;
 
-					if(k)
+					if (k)
 						particle_curve(re, obr, psmd->dm, ma, &sd, loc, loc1, seed, pa_co);
 
 					copy_v3_v3(loc1,loc);
@@ -1983,7 +1987,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 		}
 		else {
 			/* render normal particles */
-			if(part->trail_count > 1) {
+			if (part->trail_count > 1) {
 				float length = part->path_end * (1.0f - part->randlength * r_length);
 				int trail_count = part->trail_count * (1.0f - part->randlength * r_length);
 				float ct = (part->draw & PART_ABS_PATH_TIME) ? cfra : pa_time;
@@ -1992,24 +1996,24 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 				/* make sure we have pointcache in memory before getting particle on path */
 				psys_make_temp_pointcache(ob, psys);
 
-				for(i=0; i < trail_count; i++, ct -= dt) {
-					if(part->draw & PART_ABS_PATH_TIME) {
-						if(ct < pa_birthtime || ct > pa_dietime)
+				for (i=0; i < trail_count; i++, ct -= dt) {
+					if (part->draw & PART_ABS_PATH_TIME) {
+						if (ct < pa_birthtime || ct > pa_dietime)
 							continue;
 					}
-					else if(ct < 0.0f || ct > 1.0f)
+					else if (ct < 0.0f || ct > 1.0f)
 						continue;
 
 					state.time = (part->draw & PART_ABS_PATH_TIME) ? -ct : ct;
 					psys_get_particle_on_path(&sim,a,&state,1);
 
-					if(psys->parent)
+					if (psys->parent)
 						mul_m4_v3(psys->parent->obmat, state.co);
 
-					if(use_duplimat)
+					if (use_duplimat)
 						mul_m4_v4(duplimat, state.co);
 
-					if(part->ren_as == PART_DRAW_BB) {
+					if (part->ren_as == PART_DRAW_BB) {
 						bb.random = random;
 						bb.offset[0] = part->bb_offset[0];
 						bb.offset[1] = part->bb_offset[1];
@@ -2038,16 +2042,16 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 			}
 			else {
 				state.time=cfra;
-				if(psys_get_particle_state(&sim,a,&state,0)==0)
+				if (psys_get_particle_state(&sim,a,&state,0)==0)
 					continue;
 
-				if(psys->parent)
+				if (psys->parent)
 					mul_m4_v3(psys->parent->obmat, state.co);
 
-				if(use_duplimat)
+				if (use_duplimat)
 					mul_m4_v3(duplimat, state.co);
 
-				if(part->ren_as == PART_DRAW_BB) {
+				if (part->ren_as == PART_DRAW_BB) {
 					bb.random = random;
 					bb.offset[0] = part->bb_offset[0];
 					bb.offset[1] = part->bb_offset[1];
@@ -2073,46 +2077,46 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
 			}
 		}
 
-		if(orco1==0)
+		if (orco1==0)
 			sd.orco+=3;
 
-		if(re->test_break(re->tbh))
+		if (re->test_break(re->tbh))
 			break;
 	}
 
-	if(dosurfacecache)
+	if (dosurfacecache)
 		strandbuf->surface= cache_strand_surface(re, obr, psmd->dm, mat, timeoffset);
 
 /* 4. clean up */
 #if 0 // XXX old animation system
-	if(ma) do_mat_ipo(re->scene, ma);
+	if (ma) do_mat_ipo(re->scene, ma);
 #endif // XXX old animation system
 	
-	if(orco1)
+	if (orco1)
 		MEM_freeN(sd.orco);
 
-	if(sd.uvco)
+	if (sd.uvco)
 		MEM_freeN(sd.uvco);
 	
-	if(sd.mcol)
+	if (sd.mcol)
 		MEM_freeN(sd.mcol);
 
-	if(uv_name)
+	if (uv_name)
 		MEM_freeN(uv_name);
 
-	if(states)
+	if (states)
 		MEM_freeN(states);
 	
 	rng_free(rng);
 
 	psys->flag &= ~PSYS_DRAWING;
 
-	if(psys->lattice){
+	if (psys->lattice) {
 		end_latt_deform(psys->lattice);
 		psys->lattice= NULL;
 	}
 
-	if(path_nbr && (ma->mode_l & MA_TANGENT_STR)==0)
+	if (path_nbr && (ma->mode_l & MA_TANGENT_STR)==0)
 		calc_vertexnormals(re, obr, 0, 0);
 
 	return 1;
@@ -2135,16 +2139,16 @@ static void make_render_halos(Render *re, ObjectRen *obr, Mesh *UNUSED(me), int
 
 	re->flag |= R_HALO;
 
-	for(a=0; a<totvert; a++, mvert++) {
+	for (a=0; a<totvert; a++, mvert++) {
 		ok= 1;
 
-		if(ok) {
+		if (ok) {
 			hasize= ma->hasize;
 
 			copy_v3_v3(vec, mvert->co);
 			mul_m4_v3(mat, vec);
 
-			if(ma->mode & MA_HALOPUNO) {
+			if (ma->mode & MA_HALOPUNO) {
 				xn= mvert->no[0];
 				yn= mvert->no[1];
 				zn= mvert->no[2];
@@ -2159,15 +2163,15 @@ static void make_render_halos(Render *re, ObjectRen *obr, Mesh *UNUSED(me), int
 				normalize_v3(view);
 
 				zn = dot_v3v3(nor, view);
-				if(zn>=0.0f) hasize= 0.0f;
+				if (zn>=0.0f) hasize= 0.0f;
 				else hasize*= zn*zn*zn*zn;
 			}
 
-			if(orco) har= RE_inithalo(re, obr, ma, vec, NULL, orco, hasize, 0.0, seed);
+			if (orco) har= RE_inithalo(re, obr, ma, vec, NULL, orco, hasize, 0.0, seed);
 			else har= RE_inithalo(re, obr, ma, vec, NULL, mvert->co, hasize, 0.0, seed);
-			if(har) har->lay= ob->lay;
+			if (har) har->lay= ob->lay;
 		}
-		if(orco) orco+= 3;
+		if (orco) orco+= 3;
 		seed++;
 	}
 }
@@ -2177,8 +2181,8 @@ static int verghalo(const void *a1, const void *a2)
 	const HaloRen *har1= *(const HaloRen**)a1;
 	const HaloRen *har2= *(const HaloRen**)a2;
 	
-	if(har1->zs < har2->zs) return 1;
-	else if(har1->zs > har2->zs) return -1;
+	if (har1->zs < har2->zs) return 1;
+	else if (har1->zs > har2->zs) return -1;
 	return 0;
 }
 
@@ -2188,14 +2192,14 @@ static void sort_halos(Render *re, int totsort)
 	HaloRen *har= NULL, **haso;
 	int a;
 
-	if(re->tothalo==0) return;
+	if (re->tothalo==0) return;
 
 	re->sortedhalos= MEM_callocN(sizeof(HaloRen*)*re->tothalo, "sorthalos");
 	haso= re->sortedhalos;
 
-	for(obr=re->objecttable.first; obr; obr=obr->next) {
-		for(a=0; a<obr->tothalo; a++) {
-			if((a & 255)==0) har= obr->bloha[a>>8];
+	for (obr=re->objecttable.first; obr; obr=obr->next) {
+		for (a=0; a<obr->tothalo; a++) {
+			if ((a & 255)==0) har= obr->bloha[a>>8];
 			else har++;
 
 			*(haso++)= har;
@@ -2218,7 +2222,7 @@ static short test_for_displace(Render *re, Object *ob)
 	for (i=1; i<=ob->totcol; i++) {
 		ma=give_render_material(re, ob, i);
 		/* ma->mapto is ORed total of all mapto channels */
-		if(ma && (ma->mapto & MAP_DISPLACE)) return 1;
+		if (ma && (ma->mapto & MAP_DISPLACE)) return 1;
 	}
 	return 0;
 }
@@ -2236,10 +2240,10 @@ static void displace_render_vert(Render *re, ObjectRen *obr, ShadeInput *shi, Ve
 	/* vertex normal is used for textures type 'col' and 'var' */
 	copy_v3_v3(shi->vn, vr->n);
 
-	if(mat)
+	if (mat)
 		mul_m4_v3(mat, shi->co);
 
-	if(imat) {
+	if (imat) {
 		shi->vn[0] = dot_v3v3(imat[0], vr->n);
 		shi->vn[1] = dot_v3v3(imat[1], vr->n);
 		shi->vn[2] = dot_v3v3(imat[2], vr->n);
@@ -2267,7 +2271,7 @@ static void displace_render_vert(Render *re, ObjectRen *obr, ShadeInput *shi, Ve
 	}
 	if (texco & TEXCO_STICKY) {
 		float *sticky= RE_vertren_get_sticky(obr, vr, 0);
-		if(sticky) {
+		if (sticky) {
 			shi->sticky[0]= sticky[0];
 			shi->sticky[1]= sticky[1];
 			shi->sticky[2]= 0.0f;
@@ -2280,15 +2284,15 @@ static void displace_render_vert(Render *re, ObjectRen *obr, ShadeInput *shi, Ve
 	if (texco & TEXCO_NORM) {
 		copy_v3_v3(shi->orn, shi->vn);
 	}
-	if(texco & TEXCO_REFL) {
+	if (texco & TEXCO_REFL) {
 		/* not (yet?) */
 	}
-	if(texco & TEXCO_STRESS) {
+	if (texco & TEXCO_STRESS) {
 		float *s= RE_vertren_get_stress(obr, vr, 0);
 
-		if(s) {
+		if (s) {
 			shi->stress= *s;
-			if(shi->stress<1.0f) shi->stress-= 1.0f;
+			if (shi->stress<1.0f) shi->stress-= 1.0f;
 			else shi->stress= (shi->stress-1.0f)/shi->stress;
 		}
 		else
@@ -2306,7 +2310,7 @@ static void displace_render_vert(Render *re, ObjectRen *obr, ShadeInput *shi, Ve
 	displace[1]= shi->displace[1] * scale[1];
 	displace[2]= shi->displace[2] * scale[2];
 	
-	if(mat)
+	if (mat)
 		mul_m3_v3(imat, displace);
 
 	/* 0.5 could become button once?  */
@@ -2317,7 +2321,7 @@ static void displace_render_vert(Render *re, ObjectRen *obr, ShadeInput *shi, Ve
 	//printf("after co=%f, %f, %f\n", vr->co[0], vr->co[1], vr->co[2]); 
 	
 	/* we just don't do this vertex again, bad luck for other face using same vertex with
-		different material... */
+	 * different material... */
 	vr->flag |= 1;
 	
 	/* Pass sample back so displace_face can decide which way to split the quad */
@@ -2335,13 +2339,13 @@ static void displace_render_face(Render *re, ObjectRen *obr, VlakRen *vlr, float
 	ShadeInput shi;
 
 	/* Warning, This is not that nice, and possibly a bit slow,
-	however some variables were not initialized properly in, unless using shade_input_initialize(...), we need to do a memset */
+	 * however some variables were not initialized properly in, unless using shade_input_initialize(...), we need to do a memset */
 	memset(&shi, 0, sizeof(ShadeInput)); 
 	/* end warning! - Campbell */
 	
 	/* set up shadeinput struct for multitex() */
 	
-	/* memset above means we dont need this */
+	/* memset above means we don't need this */
 	/*shi.osatex= 0;*/		/* signal not to use dx[] and dy[] texture AA vectors */
 
 	shi.obr= obr;
@@ -2378,7 +2382,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) {
+	if (vlr->v4) {
 		normal_quad_v3( vlr->n,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
 	}	
 	else {
@@ -2397,19 +2401,19 @@ static void do_displacement(Render *re, ObjectRen *obr, float mat[][4], float im
 		
 	/* Object Size with parenting */
 	obt=obr->ob;
-	while(obt){
+	while (obt) {
 		mul_v3_v3v3(temp, obt->size, obt->dscale);
 		scale[0]*=temp[0]; scale[1]*=temp[1]; scale[2]*=temp[2];
 		obt=obt->parent;
 	}
 	
 	/* Clear all flags */
-	for(i=0; i<obr->totvert; i++){ 
+	for (i=0; i<obr->totvert; i++) {
 		vr= RE_findOrAddVert(obr, i);
 		vr->flag= 0;
 	}
 
-	for(i=0; i<obr->totvlak; i++){
+	for (i=0; i<obr->totvlak; i++) {
 		vlr=RE_findOrAddVlak(obr, i);
 		displace_render_face(re, obr, vlr, scale, mat, imat);
 	}
@@ -2430,7 +2434,7 @@ static void init_render_mball(Render *re, ObjectRen *obr)
 	VlakRen *vlr, *vlr1;
 	Material *ma;
 	float *data, *nors, *orco=NULL, mat[4][4], imat[3][3], xn, yn, zn;
-	int a, need_orco, vlakindex, *index;
+	int a, need_orco, vlakindex, *index, negative_scale;
 	ListBase dispbase= {NULL, NULL};
 
 	if (ob!=find_basis_mball(re->scene, ob))
@@ -2439,21 +2443,22 @@ static void init_render_mball(Render *re, ObjectRen *obr)
 	mult_m4_m4m4(mat, re->viewmat, ob->obmat);
 	invert_m4_m4(ob->imat, mat);
 	copy_m3_m4(imat, ob->imat);
+	negative_scale = is_negative_m4(mat);
 
 	ma= give_render_material(re, ob, 1);
 
 	need_orco= 0;
-	if(ma->texco & TEXCO_ORCO) {
+	if (ma->texco & TEXCO_ORCO) {
 		need_orco= 1;
 	}
 
 	makeDispListMBall_forRender(re->scene, ob, &dispbase);
 	dl= dispbase.first;
-	if(dl==0) return;
+	if (dl==0) return;
 
 	data= dl->verts;
 	nors= dl->nors;
-	if(need_orco) {
+	if (need_orco) {
 		orco= get_object_orco(re, ob);
 
 		if (!orco) {
@@ -2463,7 +2468,7 @@ static void init_render_mball(Render *re, ObjectRen *obr)
 		}
 	}
 
-	for(a=0; a<dl->nr; a++, data+=3, nors+=3) {
+	for (a=0; a<dl->nr; a++, data+=3, nors+=3) {
 
 		ver= RE_findOrAddVert(obr, obr->totvert++);
 		copy_v3_v3(ver->co, data);
@@ -2479,16 +2484,16 @@ static void init_render_mball(Render *re, ObjectRen *obr)
 		ver->n[1]= imat[1][0]*xn+imat[1][1]*yn+imat[1][2]*zn;
 		ver->n[2]= imat[2][0]*xn+imat[2][1]*yn+imat[2][2]*zn;
 		normalize_v3(ver->n);
-		//if(ob->transflag & OB_NEG_SCALE) negate_v3(ver->n);
+		//if (ob->transflag & OB_NEG_SCALE) negate_v3(ver->n);
 		
-		if(need_orco) {
+		if (need_orco) {
 			ver->orco= orco;
 			orco+=3;
 		}
 	}
 
 	index= dl->index;
-	for(a=0; a<dl->parts; a++, index+=4) {
+	for (a=0; a<dl->parts; a++, index+=4) {
 
 		vlr= RE_findOrAddVlak(obr, obr->totvlak++);
 		vlr->v1= RE_findOrAddVert(obr, index[0]);
@@ -2496,7 +2501,7 @@ static void init_render_mball(Render *re, ObjectRen *obr)
 		vlr->v3= RE_findOrAddVert(obr, index[2]);
 		vlr->v4= 0;
 
-		if(ob->transflag & OB_NEG_SCALE) 
+		if (negative_scale)
 			normal_tri_v3( vlr->n,vlr->v1->co, vlr->v2->co, vlr->v3->co);
 		else
 			normal_tri_v3( vlr->n,vlr->v3->co, vlr->v2->co, vlr->v1->co);
@@ -2506,14 +2511,14 @@ static void init_render_mball(Render *re, ObjectRen *obr)
 		vlr->ec= 0;
 
 		/* mball -too bad- always has triangles, because quads can be non-planar */
-		if(index[3] && index[3]!=index[2]) {
+		if (index[3] && index[3]!=index[2]) {
 			vlr1= RE_findOrAddVlak(obr, obr->totvlak++);
 			vlakindex= vlr1->index;
 			*vlr1= *vlr;
 			vlr1->index= vlakindex;
 			vlr1->v2= vlr1->v3;
 			vlr1->v3= RE_findOrAddVert(obr, index[3]);
-			if(ob->transflag & OB_NEG_SCALE) 
+			if (negative_scale)
 				normal_tri_v3( vlr1->n,vlr1->v1->co, vlr1->v2->co, vlr1->v3->co);
 			else
 				normal_tri_v3( vlr1->n,vlr1->v3->co, vlr1->v2->co, vlr1->v1->co);
@@ -2546,7 +2551,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
 	for (u = 0; u < sizeu; u++) {
 		v1 = RE_findOrAddVert(obr, obr->totvert++); /* save this for possible V wrapping */
 		copy_v3_v3(v1->co, data); data += 3;
-		if(orco) {
+		if (orco) {
 			v1->orco= orco; orco+= 3; orcoret++;
 		}	
 		mul_m4_v3(mat, v1->co);
@@ -2554,7 +2559,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
 		for (v = 1; v < sizev; v++) {
 			ver= RE_findOrAddVert(obr, obr->totvert++);
 			copy_v3_v3(ver->co, data); data += 3;
-			if(orco) {
+			if (orco) {
 				ver->orco= orco; orco+= 3; orcoret++;
 			}	
 			mul_m4_v3(mat, ver->co);
@@ -2563,7 +2568,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
 		if (dl->flag & DL_CYCL_U) {
 			ver= RE_findOrAddVert(obr, obr->totvert++);
 			copy_v3_v3(ver->co, v1->co);
-			if(orco) {
+			if (orco) {
 				ver->orco= orco; orco+=3; orcoret++; //orcobase + 3*(u*sizev + 0);
 			}
 		}	
@@ -2579,7 +2584,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
 			v1= RE_findOrAddVert(obr, startvert + v);
 			ver= RE_findOrAddVert(obr, obr->totvert++);
 			copy_v3_v3(ver->co, v1->co);
-			if(orco) {
+			if (orco) {
 				ver->orco= orco; orco+=3; orcoret++; //ver->orco= orcobase + 3*(0*sizev + v);
 			}
 		}
@@ -2590,13 +2595,13 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
 	
 	startvlak= obr->totvlak;
 	
-	for(u = 0; u < sizeu - 1; u++) {
+	for (u = 0; u < sizeu - 1; u++) {
 		p1 = startvert + u * sizev; /* walk through face list */
 		p2 = p1 + 1;
 		p3 = p2 + sizev;
 		p4 = p3 - 1;
 		
-		for(v = 0; v < sizev - 1; v++) {
+		for (v = 0; v < sizev - 1; v++) {
 			v1= RE_findOrAddVert(obr, p1);
 			v2= RE_findOrAddVert(obr, p2);
 			v3= RE_findOrAddVert(obr, p3);
@@ -2649,25 +2654,25 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
 			add_v3_v3(vlr->v4->n, vlr1->n);
 		}
 	}
+
 	/* last vertex is an extra case: 
-		
-		^	()----()----()----()
-		|	|     |     ||     |
-		u	|     |(0,n)||(0,0)|
-		|     |     ||     |
-		()====()====[]====()
-		|     |     ||     |
-		|     |(m,n)||(m,0)|
-		|     |     ||     |
-		()----()----()----()
-		v ->
-		
-		vertex [] is no longer shared, therefore distribute
-		normals of the surrounding faces to all of the duplicates of []
-		*/
-	
-	if ((dl->flag & DL_CYCL_V) && (dl->flag & DL_CYCL_U))
-	{
+	 *
+	 *     ^     ()----()----()----()
+	 *     |     |     |     ||     |
+	 *     u     |     |(0,n)||(0,0)|
+	 *     |     |     ||     |
+	 *     ()====()====[]====()
+	 *     |     |     ||     |
+	 *     |     |(m,n)||(m,0)|
+	 *     |     |     ||     |
+	 *     ()----()----()----()
+	 *     v ->
+	 *  
+	 *  vertex [] is no longer shared, therefore distribute
+	 *  normals of the surrounding faces to all of the duplicates of []
+	 */
+
+	if ((dl->flag & DL_CYCL_V) && (dl->flag & DL_CYCL_U)) {
 		vlr= RE_findOrAddVlak(obr, UVTOINDEX(sizeu - 1, sizev - 1)); /* (m,n) */
 		vlr1= RE_findOrAddVlak(obr, UVTOINDEX(0,0));  /* (0,0) */
 		add_v3_v3v3(n1, vlr->n, vlr1->n);
@@ -2680,7 +2685,7 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar,
 		copy_v3_v3(vlr2->v2->n, n1);
 		copy_v3_v3(vlr3->v4->n, n1);
 	}
-	for(a = startvert; a < obr->totvert; a++) {
+	for (a = startvert; a < obr->totvert; a++) {
 		ver= RE_findOrAddVert(obr, a);
 		normalize_v3(ver->n);
 	}
@@ -2705,18 +2710,18 @@ static void init_render_dm(DerivedMesh *dm, Render *re, ObjectRen *obr,
 	mvert= dm->getVertArray(dm);
 	totvert= dm->getNumVerts(dm);
 
-	for(a=0; a<totvert; a++, mvert++) {
+	for (a=0; a<totvert; a++, mvert++) {
 		ver= RE_findOrAddVert(obr, obr->totvert++);
 		copy_v3_v3(ver->co, mvert->co);
 		mul_m4_v3(mat, ver->co);
 
-		if(orco) {
+		if (orco) {
 			ver->orco= orco;
 			orco+=3;
 		}
 	}
 
-	if(!timeoffset) {
+	if (!timeoffset) {
 		/* store customdata names, because DerivedMesh is freed */
 		RE_set_customdata_names(obr, &dm->faceData);
 
@@ -2724,16 +2729,16 @@ static void init_render_dm(DerivedMesh *dm, Render *re, ObjectRen *obr,
 
 		/* faces in order of color blocks */
 		vertofs= obr->totvert - totvert;
-		for(mat_iter= 0; (mat_iter < ob->totcol || (mat_iter==0 && ob->totcol==0)); mat_iter++) {
+		for (mat_iter= 0; (mat_iter < ob->totcol || (mat_iter==0 && ob->totcol==0)); mat_iter++) {
 
 			ma= give_render_material(re, ob, mat_iter+1);
-			end= dm->getNumFaces(dm);
-			mface= dm->getFaceArray(dm);
+			end= dm->getNumTessFaces(dm);
+			mface= dm->getTessFaceArray(dm);
 
-			for(a=0; a<end; a++, mface++) {
+			for (a=0; a<end; a++, mface++) {
 				int v1, v2, v3, v4, flag;
 
-				if(mface->mat_nr == mat_iter) {
+				if (mface->mat_nr == mat_iter) {
 					float len;
 
 					v1= mface->v1;
@@ -2746,11 +2751,11 @@ static void init_render_dm(DerivedMesh *dm, Render *re, ObjectRen *obr,
 					vlr->v1= RE_findOrAddVert(obr, vertofs+v1);
 					vlr->v2= RE_findOrAddVert(obr, vertofs+v2);
 					vlr->v3= RE_findOrAddVert(obr, vertofs+v3);
-					if(v4) vlr->v4= RE_findOrAddVert(obr, vertofs+v4);
+					if (v4) vlr->v4= RE_findOrAddVert(obr, vertofs+v4);
 					else vlr->v4= 0;
 
 					/* render normals are inverted in render */
-					if(vlr->v4)
+					if (vlr->v4)
 						len= normal_quad_v3( vlr->n,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
 					else
 						len= normal_tri_v3( vlr->n,vlr->v3->co, vlr->v2->co, vlr->v1->co);
@@ -2759,7 +2764,7 @@ static void init_render_dm(DerivedMesh *dm, Render *re, ObjectRen *obr,
 					vlr->flag= flag;
 					vlr->ec= 0; /* mesh edges rendered separately */
 
-					if(len==0) obr->totvlak--;
+					if (len==0) obr->totvlak--;
 					else {
 						CustomDataLayer *layer;
 						MTFace *mtface, *mtf;
@@ -2767,16 +2772,16 @@ static void init_render_dm(DerivedMesh *dm, Render *re, ObjectRen *obr,
 						int index, mtfn= 0, mcn= 0;
 						char *name;
 
-						for(index=0; index<dm->faceData.totlayer; index++) {
+						for (index=0; index<dm->faceData.totlayer; index++) {
 							layer= &dm->faceData.layers[index];
 							name= layer->name;
 
-							if(layer->type == CD_MTFACE && mtfn < MAX_MTFACE) {
+							if (layer->type == CD_MTFACE && mtfn < MAX_MTFACE) {
 								mtf= RE_vlakren_get_tface(obr, vlr, mtfn++, &name, 1);
 								mtface= (MTFace*)layer->data;
 								*mtf= mtface[a];
 							}
-							else if(layer->type == CD_MCOL && mcn < MAX_MCOL) {
+							else if (layer->type == CD_MCOL && mcn < MAX_MCOL) {
 								mc= RE_vlakren_get_mcol(obr, vlr, mcn++, &name, 1);
 								mcol= (MCol*)layer->data;
 								memcpy(mc, &mcol[a*4], sizeof(MCol)*4);
@@ -2807,7 +2812,7 @@ static void init_render_surf(Render *re, ObjectRen *obr, int timeoffset)
 
 	cu= ob->data;
 	nu= cu->nurb.first;
-	if(nu==0) return;
+	if (nu==0) return;
 
 	mult_m4_m4m4(mat, re->viewmat, ob->obmat);
 	invert_m4_m4(ob->imat, mat);
@@ -2816,36 +2821,37 @@ static void init_render_surf(Render *re, ObjectRen *obr, int timeoffset)
 	totmat= ob->totcol+1;
 	matar= MEM_callocN(sizeof(Material*)*totmat, "init_render_surf matar");
 
-	for(a=0; a<totmat; a++) {
+	for (a=0; a<totmat; a++) {
 		matar[a]= give_render_material(re, ob, a+1);
 
-		if(matar[a] && matar[a]->texco & TEXCO_ORCO)
+		if (matar[a] && matar[a]->texco & TEXCO_ORCO)
 			need_orco= 1;
 	}
 
-	if(ob->parent && (ob->parent->type==OB_LATTICE)) need_orco= 1;
+	if (ob->parent && (ob->parent->type==OB_LATTICE)) need_orco= 1;
 
 	makeDispListSurf(re->scene, ob, &displist, &dm, 1, 0);
 
 	if (dm) {
-		if(need_orco) {
+		if (need_orco) {
 			orco= makeOrcoDispList(re->scene, ob, dm, 1);
-			if(orco) {
+			if (orco) {
 				set_object_orco(re, ob, orco);
 			}
 		}
 
 		init_render_dm(dm, re, obr, timeoffset, orco, mat);
 		dm->release(dm);
-	} else {
-		if(need_orco) {
+	}
+	else {
+		if (need_orco) {
 			orco= get_object_orco(re, ob);
 		}
 
 		/* walk along displaylist and create rendervertices/-faces */
-		for(dl=displist.first; dl; dl=dl->next) {
+		for (dl=displist.first; dl; dl=dl->next) {
 			/* watch out: u ^= y, v ^= x !! */
-			if(dl->type==DL_SURF)
+			if (dl->type==DL_SURF)
 				orco+= 3*dl_surf_to_renderdata(obr, dl, matar, orco, mat);
 		}
 	}
@@ -2871,12 +2877,12 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
 	int need_orco=0, totmat;
 
 	cu= ob->data;
-	if(ob->type==OB_FONT && cu->str==NULL) return;
-	else if(ob->type==OB_CURVE && cu->nurb.first==NULL) return;
+	if (ob->type==OB_FONT && cu->str==NULL) return;
+	else if (ob->type==OB_CURVE && cu->nurb.first==NULL) return;
 
 	makeDispListCurveTypes_forRender(re->scene, ob, &disp, &dm, 0);
 	dl= disp.first;
-	if(dl==NULL) return;
+	if (dl==NULL) return;
 	
 	mult_m4_m4m4(mat, re->viewmat, ob->obmat);
 	invert_m4_m4(ob->imat, mat);
@@ -2885,39 +2891,40 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
 	totmat= ob->totcol+1;
 	matar= MEM_callocN(sizeof(Material*)*totmat, "init_render_surf matar");
 
-	for(a=0; a<totmat; a++) {
+	for (a=0; a<totmat; a++) {
 		matar[a]= give_render_material(re, ob, a+1);
 
-		if(matar[a] && matar[a]->texco & TEXCO_ORCO)
+		if (matar[a] && matar[a]->texco & TEXCO_ORCO)
 			need_orco= 1;
 	}
 
 	if (dm) {
-		if(need_orco) {
+		if (need_orco) {
 			orco= makeOrcoDispList(re->scene, ob, dm, 1);
-			if(orco) {
+			if (orco) {
 				set_object_orco(re, ob, orco);
 			}
 		}
 
 		init_render_dm(dm, re, obr, timeoffset, orco, mat);
 		dm->release(dm);
-	} else {
-		if(need_orco) {
+	}
+	else {
+		if (need_orco) {
 		  orco= get_object_orco(re, ob);
 		}
 
-		while(dl) {
-			if(dl->col > ob->totcol) {
+		while (dl) {
+			if (dl->col > ob->totcol) {
 				/* pass */
 			}
-			else if(dl->type==DL_INDEX3) {
+			else if (dl->type==DL_INDEX3) {
 				int *index;
 
 				startvert= obr->totvert;
 				data= dl->verts;
 
-				for(a=0; a<dl->nr; a++, data+=3) {
+				for (a=0; a<dl->nr; a++, data+=3) {
 					ver= RE_findOrAddVert(obr, obr->totvert++);
 					copy_v3_v3(ver->co, data);
 
@@ -2929,20 +2936,20 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
 					}
 				}
 
-				if(timeoffset==0) {
+				if (timeoffset==0) {
 					float tmp[3];
 					const int startvlak= obr->totvlak;
 
 					zero_v3(n);
 					index= dl->index;
-					for(a=0; a<dl->parts; a++, index+=3) {
+					for (a=0; a<dl->parts; a++, index+=3) {
 						vlr= RE_findOrAddVlak(obr, obr->totvlak++);
 						vlr->v1= RE_findOrAddVert(obr, startvert+index[0]);
 						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_EPSILON) {
 							normal_tri_v3(tmp, vlr->v3->co, vlr->v2->co, vlr->v1->co);
 							add_v3_v3(n, tmp);
 						}
@@ -2955,7 +2962,7 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
 					normalize_v3(n);
 
 					/* vertex normals */
-					for(a= startvlak; a<obr->totvlak; a++) {
+					for (a= startvlak; a<obr->totvlak; a++) {
 						vlr= RE_findOrAddVlak(obr, a);
 
 						copy_v3_v3(vlr->n, n);
@@ -2963,7 +2970,7 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
 						add_v3_v3(vlr->v3->n, vlr->n);
 						add_v3_v3(vlr->v2->n, vlr->n);
 					}
-					for(a=startvert; a<obr->totvert; a++) {
+					for (a=startvert; a<obr->totvert; a++) {
 						ver= RE_findOrAddVert(obr, a);
 						normalize_v3(ver->n);
 					}
@@ -2982,7 +2989,7 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
 					startvert= obr->totvert;
 					nr= dl->nr*dl->parts;
 
-					while(nr--) {
+					while (nr--) {
 						ver= RE_findOrAddVert(obr, obr->totvert++);
 
 						copy_v3_v3(ver->co, fp);
@@ -2995,10 +3002,10 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
 						}
 					}
 
-					if(dl->bevelSplitFlag || timeoffset==0) {
+					if (dl->bevelSplitFlag || timeoffset==0) {
 						const int startvlak= obr->totvlak;
 
-						for(a=0; a<dl->parts; a++) {
+						for (a=0; a<dl->parts; a++) {
 
 							if (surfindex_displist(dl, a, &b, &p1, &p2, &p3, &p4)==0)
 								break;
@@ -3008,7 +3015,7 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
 							p3+= startvert;
 							p4+= startvert;
 
-							for(; b<dl->nr; b++) {
+							for (; b<dl->nr; b++) {
 								vlr= RE_findOrAddVlak(obr, obr->totvlak++);
 								/* important 1 offset in order is kept [#24913] */
 								vlr->v1= RE_findOrAddVert(obr, p2);
@@ -3016,7 +3023,7 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
 								vlr->v3= RE_findOrAddVert(obr, p3);
 								vlr->v4= RE_findOrAddVert(obr, p4);
 								vlr->ec= ME_V2V3+ME_V3V4;
-								if(a==0) vlr->ec+= ME_V1V2;
+								if (a==0) vlr->ec+= ME_V1V2;
 
 								vlr->flag= dl->rt;
 
@@ -3031,13 +3038,13 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
 						}
 
 						if (dl->bevelSplitFlag) {
-							for(a=0; a<dl->parts-1+!!(dl->flag&DL_CYCL_V); a++)
-								if(dl->bevelSplitFlag[a>>5]&(1<<(a&0x1F)))
+							for (a=0; a<dl->parts-1+!!(dl->flag&DL_CYCL_V); a++)
+								if (dl->bevelSplitFlag[a>>5]&(1<<(a&0x1F)))
 									split_v_renderfaces(obr, startvlak, startvert, dl->parts, dl->nr, a, dl->flag&DL_CYCL_V, dl->flag&DL_CYCL_U);
 						}
 
 						/* vertex normals */
-						for(a= startvlak; a<obr->totvlak; a++) {
+						for (a= startvlak; a<obr->totvlak; a++) {
 							vlr= RE_findOrAddVlak(obr, a);
 
 							add_v3_v3(vlr->v1->n, vlr->n);
@@ -3045,7 +3052,7 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
 							add_v3_v3(vlr->v2->n, vlr->n);
 							add_v3_v3(vlr->v4->n, vlr->n);
 						}
-						for(a=startvert; a<obr->totvert; a++) {
+						for (a=startvert; a<obr->totvert; a++) {
 							ver= RE_findOrAddVert(obr, a);
 							normalize_v3(ver->n);
 						}
@@ -3093,10 +3100,10 @@ static int vergedgesort(const void *v1, const void *v2)
 {
 	const struct edgesort *x1=v1, *x2=v2;
 
-	if( x1->v1 > x2->v1) return 1;
-	else if( x1->v1 < x2->v1) return -1;
-	else if( x1->v2 > x2->v2) return 1;
-	else if( x1->v2 < x2->v2) return -1;
+	if ( x1->v1 > x2->v1) return 1;
+	else if ( x1->v1 < x2->v1) return -1;
+	else if ( x1->v2 > x2->v2) return 1;
+	else if ( x1->v2 < x2->v2) return -1;
 
 	return 0;
 }
@@ -3109,32 +3116,32 @@ static struct edgesort *make_mesh_edge_lookup(DerivedMesh *dm, int *totedgesort)
 	unsigned int *mcol=NULL;
 	int a, totedge=0, totface;
 
-	mface= dm->getFaceArray(dm);
-	totface= dm->getNumFaces(dm);
-	tface= dm->getFaceDataArray(dm, CD_MTFACE);
-	mcol= dm->getFaceDataArray(dm, CD_MCOL);
+	mface= dm->getTessFaceArray(dm);
+	totface= dm->getNumTessFaces(dm);
+	tface= dm->getTessFaceDataArray(dm, CD_MTFACE);
+	mcol= dm->getTessFaceDataArray(dm, CD_MCOL);
 
-	if(mcol==NULL && tface==NULL) return NULL;
+	if (mcol==NULL && tface==NULL) return NULL;
 
 	/* make sorted table with edges and face indices in it */
-	for(a= totface, mf= mface; a>0; a--, mf++) {
-		if(mf->v4) totedge+=4;
-		else if(mf->v3) totedge+=3;
+	for (a= totface, mf= mface; a>0; a--, mf++) {
+		if (mf->v4) totedge+=4;
+		else if (mf->v3) totedge+=3;
 	}
 
-	if(totedge==0)
+	if (totedge==0)
 		return NULL;
 
 	ed= edsort= MEM_callocN(totedge*sizeof(struct edgesort), "edgesort");
 
-	for(a=0, mf=mface; a<totface; a++, mf++) {
+	for (a=0, mf=mface; a<totface; a++, mf++) {
 		to_edgesort(ed++, 0, 1, mf->v1, mf->v2, a);
 		to_edgesort(ed++, 1, 2, mf->v2, mf->v3, a);
-		if(mf->v4) {
+		if (mf->v4) {
 			to_edgesort(ed++, 2, 3, mf->v3, mf->v4, a);
 			to_edgesort(ed++, 3, 0, mf->v4, mf->v1, a);
 		}
-		else if(mf->v3)
+		else if (mf->v3)
 			to_edgesort(ed++, 2, 3, mf->v3, mf->v1, a);
 	}
 
@@ -3154,7 +3161,7 @@ static void use_mesh_edge_lookup(ObjectRen *obr, DerivedMesh *dm, MEdge *medge,
 	int index, mtfn, mcn;
 	char *name;
 
-	if(medge->v1 < medge->v2) {
+	if (medge->v1 < medge->v2) {
 		ed.v1= medge->v1;
 		ed.v2= medge->v2;
 	}
@@ -3166,14 +3173,14 @@ static void use_mesh_edge_lookup(ObjectRen *obr, DerivedMesh *dm, MEdge *medge,
 	edp= bsearch(&ed, edgetable, totedge, sizeof(struct edgesort), vergedgesort);
 
 	/* since edges have different index ordering, we have to duplicate mcol and tface */
-	if(edp) {
+	if (edp) {
 		mtfn= mcn= 0;
 
-		for(index=0; index<dm->faceData.totlayer; index++) {
+		for (index=0; index<dm->faceData.totlayer; index++) {
 			layer= &dm->faceData.layers[index];
 			name= layer->name;
 
-			if(layer->type == CD_MTFACE && mtfn < MAX_MTFACE) {
+			if (layer->type == CD_MTFACE && mtfn < MAX_MTFACE) {
 				mtface= &((MTFace*)layer->data)[edp->f];
 				mtf= RE_vlakren_get_tface(obr, vlr, mtfn++, &name, 1);
 
@@ -3184,7 +3191,7 @@ static void use_mesh_edge_lookup(ObjectRen *obr, DerivedMesh *dm, MEdge *medge,
 				memcpy(mtf->uv[2], mtface->uv[1], sizeof(float)*2);
 				memcpy(mtf->uv[3], mtface->uv[1], sizeof(float)*2);
 			}
-			else if(layer->type == CD_MCOL && mcn < MAX_MCOL) {
+			else if (layer->type == CD_MCOL && mcn < MAX_MCOL) {
 				mcol= &((MCol*)layer->data)[edp->f*4];
 				mc= RE_vlakren_get_mcol(obr, vlr, mcn++, &name, 1);
 
@@ -3206,8 +3213,8 @@ static void init_camera_inside_volumes(Render *re)
 	VolumeOb *vo;
 	float co[3] = {0.f, 0.f, 0.f};
 
-	for(vo= re->volumes.first; vo; vo= vo->next) {
-		for(obi= re->instancetable.first; obi; obi= obi->next) {
+	for (vo= re->volumes.first; vo; vo= vo->next) {
+		for (obi= re->instancetable.first; obi; obi= obi->next) {
 			if (obi->obr == vo->obr) {
 				if (point_inside_volume_objectinstance(re, obi, co)) {
 					MatInside *mi;
@@ -3225,7 +3232,7 @@ static void init_camera_inside_volumes(Render *re)
 	/* debug {
 	MatInside *m;
 	for (m=re->render_volumes_inside.first; m; m=m->next) {
-		printf("matinside: ma: %s \n", m->ma->id.name+2);
+		printf("matinside: ma: %s\n", m->ma->id.name+2);
 	}
 	}*/
 }
@@ -3270,25 +3277,25 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
 	copy_m3_m4(imat, ob->imat);
 	negative_scale= is_negative_m4(mat);
 
-	if(me->totvert==0)
+	if (me->totvert==0)
 		return;
 	
 	need_orco= 0;
-	for(a=1; a<=ob->totcol; a++) {
+	for (a=1; a<=ob->totcol; a++) {
 		ma= give_render_material(re, ob, a);
-		if(ma) {
-			if(ma->texco & (TEXCO_ORCO|TEXCO_STRESS))
+		if (ma) {
+			if (ma->texco & (TEXCO_ORCO|TEXCO_STRESS))
 				need_orco= 1;
-			if(ma->texco & TEXCO_STRESS)
+			if (ma->texco & TEXCO_STRESS)
 				need_stress= 1;
 			/* normalmaps, test if tangents needed, separated from shading */
-			if(ma->mode_l & MA_TANGENT_V) {
+			if (ma->mode_l & MA_TANGENT_V) {
 				need_tangent= 1;
-				if(me->mtface==NULL)
+				if (me->mtface==NULL)
 					need_orco= 1;
 			}
-			if(ma->mode_l & MA_NORMAP_TANG) {
-				if(me->mtface==NULL) {
+			if (ma->mode_l & MA_NORMAP_TANG) {
+				if (me->mtface==NULL) {
 					need_orco= 1;
 					need_tangent= 1;
 				}
@@ -3297,9 +3304,9 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
 		}
 	}
 
-	if(re->flag & R_NEED_TANGENT) {
+	if (re->flag & R_NEED_TANGENT) {
 		/* exception for tangent space baking */
-		if(me->mtface==NULL) {
+		if (me->mtface==NULL) {
 			need_orco= 1;
 			need_tangent= 1;
 		}
@@ -3308,22 +3315,22 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
 	
 	/* check autosmooth and displacement, we then have to skip only-verts optimize */
 	do_autosmooth |= (me->flag & ME_AUTOSMOOTH);
-	if(do_autosmooth)
+	if (do_autosmooth)
 		timeoffset= 0;
-	if(test_for_displace(re, ob ) )
+	if (test_for_displace(re, ob ) )
 		timeoffset= 0;
 	
 	mask= CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL;
-	if(!timeoffset)
-		if(need_orco)
+	if (!timeoffset)
+		if (need_orco)
 			mask |= CD_MASK_ORCO;
 
 	dm= mesh_create_derived_render(re->scene, ob, mask);
-	if(dm==NULL) return;	/* in case duplicated object fails? */
+	if (dm==NULL) return;	/* in case duplicated object fails? */
 
-	if(mask & CD_MASK_ORCO) {
+	if (mask & CD_MASK_ORCO) {
 		orco= dm->getVertDataArray(dm, CD_ORCO);
-		if(orco) {
+		if (orco) {
 			orco= MEM_dupallocN(orco);
 			set_object_orco(re, ob, orco);
 		}
@@ -3333,7 +3340,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
 	totvert= dm->getNumVerts(dm);
 
 	/* attempt to autsmooth on original mesh, only without subsurf */
-	if(do_autosmooth && me->totvert==totvert && me->totface==dm->getNumFaces(dm))
+	if (do_autosmooth && me->totvert==totvert && me->totface==dm->getNumTessFaces(dm))
 		use_original_normals= 1;
 	
 	ms = (totvert==me->totvert)?me->msticky:NULL;
@@ -3341,15 +3348,15 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
 	ma= give_render_material(re, ob, 1);
 
 
-	if(ma->material_type == MA_TYPE_HALO) {
+	if (ma->material_type == MA_TYPE_HALO) {
 		make_render_halos(re, obr, me, totvert, mvert, ma, orco);
 	}
 	else {
 
-		for(a=0; a<totvert; a++, mvert++) {
+		for (a=0; a<totvert; a++, mvert++) {
 			ver= RE_findOrAddVert(obr, obr->totvert++);
 			copy_v3_v3(ver->co, mvert->co);
-			if(do_autosmooth==0) {	/* autosmooth on original unrotated data to prevent differences between frames */
+			if (do_autosmooth==0) {	/* autosmooth on original unrotated data to prevent differences between frames */
 				normal_short_to_float_v3(ver->n, mvert->no);
 				mul_m4_v3(mat, ver->co);
 				mul_transposed_m3_v3(imat, ver->n);
@@ -3357,60 +3364,59 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
 				negate_v3(ver->n);
 			}
   
-			if(orco) {
+			if (orco) {
 				ver->orco= orco;
 				orco+=3;
 			}
-			if(ms) {
+			if (ms) {
 				float *sticky= RE_vertren_get_sticky(obr, ver, 1);
-				sticky[0]= ms->co[0];
-				sticky[1]= ms->co[1];
+				copy_v2_v2(sticky, ms->co);
 				ms++;
 			}
 		}
 		
-		if(!timeoffset) {
+		if (!timeoffset) {
 			/* store customdata names, because DerivedMesh is freed */
 			RE_set_customdata_names(obr, &dm->faceData);
 
 			/* add tangent layer if we need one */
-			if(need_nmap_tangent!=0 && CustomData_get_layer_index(&dm->faceData, CD_TANGENT) == -1)
+			if (need_nmap_tangent!=0 && CustomData_get_layer_index(&dm->faceData, CD_TANGENT) == -1)
 				DM_add_tangent_layer(dm);
 			
 			/* still to do for keys: the correct local texture coordinate */
 
 			/* faces in order of color blocks */
 			vertofs= obr->totvert - totvert;
-			for(a1=0; (a1<ob->totcol || (a1==0 && ob->totcol==0)); a1++) {
+			for (a1=0; (a1<ob->totcol || (a1==0 && ob->totcol==0)); a1++) {
 
 				ma= give_render_material(re, ob, a1+1);
 				
 				/* test for 100% transparant */
 				ok= 1;
-				if(ma->alpha==0.0f && ma->spectra==0.0f && ma->filter==0.0f && (ma->mode & MA_TRANSP) && (ma->mode & MA_RAYMIRROR)==0) { 
+				if (ma->alpha==0.0f && ma->spectra==0.0f && ma->filter==0.0f && (ma->mode & MA_TRANSP) && (ma->mode & MA_RAYMIRROR)==0) {
 					ok= 0;
 					/* texture on transparency? */
-					for(a=0; a<MAX_MTEX; a++) {
-						if(ma->mtex[a] && ma->mtex[a]->tex) {
-							if(ma->mtex[a]->mapto & MAP_ALPHA) ok= 1;
+					for (a=0; a<MAX_MTEX; a++) {
+						if (ma->mtex[a] && ma->mtex[a]->tex) {
+							if (ma->mtex[a]->mapto & MAP_ALPHA) ok= 1;
 						}
 					}
 				}
 				
 				/* if wire material, and we got edges, don't do the faces */
-				if(ma->material_type == MA_TYPE_WIRE) {
+				if (ma->material_type == MA_TYPE_WIRE) {
 					end= dm->getNumEdges(dm);
-					if(end) ok= 0;
+					if (end) ok= 0;
 				}
 
-				if(ok) {
-					end= dm->getNumFaces(dm);
-					mface= dm->getFaceArray(dm);
+				if (ok) {
+					end= dm->getNumTessFaces(dm);
+					mface= dm->getTessFaceArray(dm);
 					
-					for(a=0; a<end; a++, mface++) {
+					for (a=0; a<end; a++, mface++) {
 						int v1, v2, v3, v4, flag;
 						
-						if( mface->mat_nr==a1 ) {
+						if ( mface->mat_nr==a1 ) {
 							float len;
 							int reverse_verts = negative_scale!=0 && do_autosmooth==0;
 							int rev_tab[] = {reverse_verts==0 ? 0 : 2, 1, reverse_verts==0 ? 2 : 0, 3};
@@ -3424,21 +3430,21 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
 							vlr->v1= RE_findOrAddVert(obr, vertofs+v1);
 							vlr->v2= RE_findOrAddVert(obr, vertofs+v2);
 							vlr->v3= RE_findOrAddVert(obr, vertofs+v3);
-							if(v4) vlr->v4= RE_findOrAddVert(obr, vertofs+v4);
+							if (v4) vlr->v4= RE_findOrAddVert(obr, vertofs+v4);
 							else vlr->v4= 0;
 
 							/* render normals are inverted in render */
-							if(use_original_normals) {
+							if (use_original_normals) {
 								MFace *mf= me->mface+a;
 								MVert *mv= me->mvert;
 								
-								if(vlr->v4) 
+								if (vlr->v4)
 									len= normal_quad_v3( vlr->n, mv[mf->v4].co, mv[mf->v3].co, mv[mf->v2].co, mv[mf->v1].co);
 								else 
 									len= normal_tri_v3( vlr->n,mv[mf->v3].co, mv[mf->v2].co, mv[mf->v1].co);
 							}
 							else {
-								if(vlr->v4) 
+								if (vlr->v4)
 									len= normal_quad_v3( vlr->n,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
 								else 
 									len= normal_tri_v3( vlr->n,vlr->v3->co, vlr->v2->co, vlr->v1->co);
@@ -3448,7 +3454,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
 							vlr->flag= flag;
 							vlr->ec= 0; /* mesh edges rendered separately */
 
-							if(len==0) obr->totvlak--;
+							if (len==0) obr->totvlak--;
 							else {
 								CustomDataLayer *layer;
 								MTFace *mtface, *mtf;
@@ -3457,32 +3463,30 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
 								char *name;
 								int nr_verts = v4!=0 ? 4 : 3;
 
-								for(index=0; index<dm->faceData.totlayer; index++) {
+								for (index=0; index<dm->faceData.totlayer; index++) {
 									layer= &dm->faceData.layers[index];
 									name= layer->name;
 									
-									if(layer->type == CD_MTFACE && mtfn < MAX_MTFACE) {
+									if (layer->type == CD_MTFACE && mtfn < MAX_MTFACE) {
 										int t;
 										mtf= RE_vlakren_get_tface(obr, vlr, mtfn++, &name, 1);
 										mtface= (MTFace*)layer->data;
 										*mtf= mtface[a];	// copy face info
-										for(vindex=0; vindex<nr_verts; vindex++)
-											for(t=0; t<2; t++)
+										for (vindex=0; vindex<nr_verts; vindex++)
+											for (t=0; t<2; t++)
 												mtf->uv[vindex][t]=mtface[a].uv[rev_tab[vindex]][t];
 									}
-									else if(layer->type == CD_MCOL && mcn < MAX_MCOL) {
+									else if (layer->type == CD_MCOL && mcn < MAX_MCOL) {
 										mc= RE_vlakren_get_mcol(obr, vlr, mcn++, &name, 1);
 										mcol= (MCol*)layer->data;
-										for(vindex=0; vindex<nr_verts; vindex++)
+										for (vindex=0; vindex<nr_verts; vindex++)
 											mc[vindex]=mcol[a*4+rev_tab[vindex]];
 									}
-									else if(layer->type == CD_TANGENT && mtng < 1)
-									{
-										if(need_nmap_tangent!=0)
-										{
+									else if (layer->type == CD_TANGENT && mtng < 1) {
+										if (need_nmap_tangent != 0) {
 											const float * tangent = (const float *) layer->data;
 											float * ftang = RE_vlakren_get_nmap_tangent(obr, vlr, 1);
-											for(vindex=0; vindex<nr_verts; vindex++)
+											for (vindex=0; vindex<nr_verts; vindex++)
 											{
 												copy_v4_v4(ftang+vindex*4, tangent+a*16+rev_tab[vindex]*4);
 												mul_mat3_m4_v3(mat, ftang+vindex*4);
@@ -3501,7 +3505,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
 			end= dm->getNumEdges(dm);
 			mvert= dm->getVertArray(dm);
 			ma= give_render_material(re, ob, 1);
-			if(end && (ma->material_type == MA_TYPE_WIRE)) {
+			if (end && (ma->material_type == MA_TYPE_WIRE)) {
 				MEdge *medge;
 				struct edgesort *edgetable;
 				int totedge= 0;
@@ -3512,7 +3516,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
 				/* we want edges to have UV and vcol too... */
 				edgetable= make_mesh_edge_lookup(dm, &totedge);
 				
-				for(a1=0; a1<end; a1++, medge++) {
+				for (a1=0; a1<end; a1++, medge++) {
 					if (medge->flag&ME_EDGERENDER) {
 						MVert *v0 = &mvert[medge->v1];
 						MVert *v1 = &mvert[medge->v2];
@@ -3523,7 +3527,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
 						vlr->v3= vlr->v2;
 						vlr->v4= NULL;
 						
-						if(edgetable)
+						if (edgetable)
 							use_mesh_edge_lookup(obr, dm, medge, vlr, edgetable, totedge);
 						
 						xn= -(v0->no[0]+v1->no[0]);
@@ -3540,31 +3544,31 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
 						vlr->ec= ME_V1V2;
 					}
 				}
-				if(edgetable)
+				if (edgetable)
 					MEM_freeN(edgetable);
 			}
 		}
 	}
 	
-	if(!timeoffset) {
-		if(need_stress)
+	if (!timeoffset) {
+		if (need_stress)
 			calc_edge_stress(re, obr, me);
 
 		if (test_for_displace(re, ob ) ) {
 			recalc_normals= 1;
 			calc_vertexnormals(re, obr, 0, 0);
-			if(do_autosmooth)
+			if (do_autosmooth)
 				do_displacement(re, obr, mat, imat);
 			else
 				do_displacement(re, obr, NULL, NULL);
 		}
 
-		if(do_autosmooth) {
+		if (do_autosmooth) {
 			recalc_normals= 1;
 			autosmooth(re, obr, mat, me->smoothresh);
 		}
 
-		if(recalc_normals!=0 || need_tangent!=0)
+		if (recalc_normals!=0 || need_tangent!=0)
 			calc_vertexnormals(re, obr, need_tangent, need_nmap_tangent);
 	}
 
@@ -3580,21 +3584,21 @@ static void initshadowbuf(Render *re, LampRen *lar, float mat[][4])
 	struct ShadBuf *shb;
 	float viewinv[4][4];
 	
-	/* if(la->spsi<16) return; */
+	/* if (la->spsi<16) return; */
 	
 	/* memory alloc */
 	shb= (struct ShadBuf *)MEM_callocN( sizeof(struct ShadBuf),"initshadbuf");
 	lar->shb= shb;
 	
-	if(shb==NULL) return;
+	if (shb==NULL) return;
 	
 	VECCOPY(shb->co, lar->co); /* int copy */
 	
 	/* percentage render: keep track of min and max */
 	shb->size= (lar->bufsize*re->r.size)/100;
 	
-	if(shb->size<512) shb->size= 512;
-	else if(shb->size > lar->bufsize) shb->size= lar->bufsize;
+	if (shb->size<512) shb->size= 512;
+	else if (shb->size > lar->bufsize) shb->size= lar->bufsize;
 	
 	shb->size &= ~15;	/* make sure its multiples of 16 */
 	
@@ -3619,7 +3623,7 @@ static void initshadowbuf(Render *re, LampRen *lar, float mat[][4])
 	shb->bias= (0.02f*lar->bias)*0x7FFFFFFF;
 	
 	/* halfway method (average of first and 2nd z) reduces bias issues */
-	if(ELEM(lar->buftype, LA_SHADBUF_HALFWAY, LA_SHADBUF_DEEP))
+	if (ELEM(lar->buftype, LA_SHADBUF_HALFWAY, LA_SHADBUF_DEEP))
 		shb->bias= 0.1f*shb->bias;
 	
 	shb->compressthresh= lar->compressthresh;
@@ -3668,11 +3672,11 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
 	int c;
 
 	/* previewrender sets this to zero... prevent accidents */
-	if(la==NULL) return NULL;
+	if (la==NULL) return NULL;
 	
 	/* prevent only shadow from rendering light */
-	if(la->mode & LA_ONLYSHADOW)
-		if((re->r.mode & R_SHADOW)==0)
+	if (la->mode & LA_ONLYSHADOW)
+		if ((re->r.mode & R_SHADOW)==0)
 			return NULL;
 	
 	re->totlamp++;
@@ -3695,7 +3699,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
 	lar->bufsize = la->bufsize;
 	lar->samp = la->samp;
 	lar->buffers= la->buffers;
-	if(lar->buffers==0) lar->buffers= 1;
+	if (lar->buffers==0) lar->buffers= 1;
 	lar->buftype= la->buftype;
 	lar->filtertype= la->filtertype;
 	lar->soft = la->soft;
@@ -3710,7 +3714,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
 	lar->mode= la->mode;
 
 	lar->energy= la->energy;
-	if(la->mode & LA_NEG) lar->energy= -lar->energy;
+	if (la->mode & LA_NEG) lar->energy= -lar->energy;
 
 	lar->vec[0]= -mat[2][0];
 	lar->vec[1]= -mat[2][1];
@@ -3743,7 +3747,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
 	
 	/* Annoying, lamp UI does this, but the UI might not have been used? - add here too.
 	 * make sure this matches buttons_shading.c's logic */
-	if(ELEM4(la->type, LA_AREA, LA_SPOT, LA_SUN, LA_LOCAL) && (la->mode & LA_SHAD_RAY))
+	if (ELEM4(la->type, LA_AREA, LA_SPOT, LA_SUN, LA_LOCAL) && (la->mode & LA_SHAD_RAY))
 		if (ELEM3(la->type, LA_SPOT, LA_SUN, LA_LOCAL))
 			if (la->ray_samp_method == LA_SAMP_CONSTANT) la->ray_samp_method = LA_SAMP_HALTON;
 	
@@ -3753,12 +3757,12 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
 	lar->adapt_thresh= la->adapt_thresh;
 	lar->sunsky = NULL;
 	
-	if( ELEM(lar->type, LA_SPOT, LA_LOCAL)) {
+	if ( ELEM(lar->type, LA_SPOT, LA_LOCAL)) {
 		lar->ray_totsamp= lar->ray_samp*lar->ray_samp;
 		lar->area_shape = LA_AREA_SQUARE;
 		lar->area_sizey= lar->area_size;
 	}
-	else if(lar->type==LA_AREA) {
+	else if (lar->type==LA_AREA) {
 		switch(lar->area_shape) {
 		case LA_AREA_SQUARE:
 			lar->ray_totsamp= lar->ray_samp*lar->ray_samp;
@@ -3783,13 +3787,13 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
 		area_lamp_vectors(lar);
 		init_jitter_plane(lar);	// subsamples
 	}
-	else if(lar->type==LA_SUN){
+	else if (lar->type==LA_SUN) {
 		lar->ray_totsamp= lar->ray_samp*lar->ray_samp;
 		lar->area_shape = LA_AREA_SQUARE;
 		lar->area_sizey= lar->area_size;
 
-		if((la->sun_effect_type & LA_SUN_EFFECT_SKY) ||
-				(la->sun_effect_type & LA_SUN_EFFECT_AP)){
+		if ((la->sun_effect_type & LA_SUN_EFFECT_SKY) ||
+				(la->sun_effect_type & LA_SUN_EFFECT_AP)) {
 			lar->sunsky = (struct SunSky*)MEM_callocN(sizeof(struct SunSky), "sunskyren");
 			lar->sunsky->effect_type = la->sun_effect_type;
 		
@@ -3807,8 +3811,8 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
 	else lar->ray_totsamp= 0;
 	
 	lar->spotsi= la->spotsize;
-	if(lar->mode & LA_HALO) {
-		if(lar->spotsi>170.0f) lar->spotsi= 170.0f;
+	if (lar->mode & LA_HALO) {
+		if (lar->spotsi>170.0f) lar->spotsi= 170.0f;
 	}
 	lar->spotsi= cosf( (float)M_PI*lar->spotsi/360.0f );
 	lar->spotbl= (1.0f-lar->spotsi)*la->spotblend;
@@ -3822,7 +3826,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
 	lar->ld2= la->att2;
 	lar->curfalloff = curvemapping_copy(la->curfalloff);
 
-	if(lar->type==LA_SPOT) {
+	if (lar->type==LA_SPOT) {
 
 		normalize_v3(lar->imat[0]);
 		normalize_v3(lar->imat[1]);
@@ -3832,15 +3836,15 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
 		xn= sin(xn)/cos(xn);
 		lar->spottexfac= 1.0f/(xn);
 
-		if(lar->mode & LA_ONLYSHADOW) {
-			if((lar->mode & (LA_SHAD_BUF|LA_SHAD_RAY))==0) lar->mode -= LA_ONLYSHADOW;
+		if (lar->mode & LA_ONLYSHADOW) {
+			if ((lar->mode & (LA_SHAD_BUF|LA_SHAD_RAY))==0) lar->mode -= LA_ONLYSHADOW;
 		}
 
 	}
 
 	/* set flag for spothalo en initvars */
-	if(la->type==LA_SPOT && (la->mode & LA_HALO) && (la->buftype != LA_SHADBUF_DEEP)) {
-		if(la->haint>0.0f) {
+	if (la->type==LA_SPOT && (la->mode & LA_HALO) && (la->buftype != LA_SHADBUF_DEEP)) {
+		if (la->haint>0.0f) {
 			re->flag |= R_LAMPHALO;
 
 			/* camera position (0,0,0) rotate around lamp */
@@ -3858,25 +3862,25 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
 			lar->sh_invcampos[2]*= lar->sh_zfac;
 
 			/* halfway shadow buffer doesn't work for volumetric effects */
-			if(lar->buftype == LA_SHADBUF_HALFWAY)
+			if (lar->buftype == LA_SHADBUF_HALFWAY)
 				lar->buftype = LA_SHADBUF_REGULAR;
 
 		}
 	}
-	else if(la->type==LA_HEMI) {
+	else if (la->type==LA_HEMI) {
 		lar->mode &= ~(LA_SHAD_RAY|LA_SHAD_BUF);
 	}
 
-	for(c=0; c<MAX_MTEX; c++) {
-		if(la->mtex[c] && la->mtex[c]->tex) {
+	for (c=0; c<MAX_MTEX; c++) {
+		if (la->mtex[c] && la->mtex[c]->tex) {
 			if (la->mtex[c]->mapto & LAMAP_COL) 
 				lar->mode |= LA_TEXTURE;
 			if (la->mtex[c]->mapto & LAMAP_SHAD)
 				lar->mode |= LA_SHAD_TEX;
 
-			if(G.rendering) {
-				if(re->osa) {
-					if(la->mtex[c]->tex->type==TEX_IMAGE) lar->mode |= LA_OSATEX;
+			if (G.rendering) {
+				if (re->osa) {
+					if (la->mtex[c]->tex->type==TEX_IMAGE) lar->mode |= LA_OSATEX;
 				}
 			}
 		}
@@ -3885,15 +3889,15 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
 	/* old code checked for internal render (aka not yafray) */
 	{
 		/* to make sure we can check ray shadow easily in the render code */
-		if(lar->mode & LA_SHAD_RAY) {
-			if( (re->r.mode & R_RAYTRACE)==0)
+		if (lar->mode & LA_SHAD_RAY) {
+			if ( (re->r.mode & R_RAYTRACE)==0)
 				lar->mode &= ~LA_SHAD_RAY;
 		}
 	
 
-		if(re->r.mode & R_SHADOW) {
+		if (re->r.mode & R_SHADOW) {
 			
-			if(la->type==LA_AREA && (lar->mode & LA_SHAD_RAY) && (lar->ray_samp_method == LA_SAMP_CONSTANT)) {
+			if (la->type==LA_AREA && (lar->mode & LA_SHAD_RAY) && (lar->ray_samp_method == LA_SAMP_CONSTANT)) {
 				init_jitter_plane(lar);
 			}
 			else if (la->type==LA_SPOT && (lar->mode & LA_SHAD_BUF) ) {
@@ -3905,7 +3909,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
 			
 			
 			/* this is the way used all over to check for shadow */
-			if(lar->shb || (lar->mode & LA_SHAD_RAY)) {
+			if (lar->shb || (lar->mode & LA_SHAD_RAY)) {
 				LampShadowSample *ls;
 				LampShadowSubSample *lss;
 				int a, b;
@@ -3916,9 +3920,9 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
 				ls= lar->shadsamp;
 
 				/* shadfacs actually mean light, let's put them to 1 to prevent unitialized accidents */
-				for(a=0; a<re->r.threads; a++, ls++) {
+				for (a=0; a<re->r.threads; a++, ls++) {
 					lss= ls->s;
-					for(b=0; b<re->r.osa; b++, lss++) {
+					for (b=0; b<re->r.osa; b++, lss++) {
 						lss->samplenr= -1;	/* used to detect whether we store or read */
 						lss->shadfac[0]= 1.0f;
 						lss->shadfac[1]= 1.0f;
@@ -3942,20 +3946,20 @@ static void add_lightgroup(Render *re, Group *group, int exclusive)
 
 	/* it's a bit too many loops in loops... but will survive */
 	/* note that 'exclusive' will remove it from the global list */
-	for(go= group->gobject.first; go; go= go->next) {
+	for (go= group->gobject.first; go; go= go->next) {
 		go->lampren= NULL;
 		
-		if(go->ob->lay & re->lay) {
-			if(go->ob && go->ob->type==OB_LAMP) {
-				for(gol= re->lights.first; gol; gol= gol->next) {
-					if(gol->ob==go->ob) {
+		if (go->ob->lay & re->lay) {
+			if (go->ob && go->ob->type==OB_LAMP) {
+				for (gol= re->lights.first; gol; gol= gol->next) {
+					if (gol->ob==go->ob) {
 						go->lampren= gol->lampren;
 						break;
 					}
 				}
-				if(go->lampren==NULL) 
+				if (go->lampren==NULL)
 					gol= add_render_lamp(re, go->ob);
-				if(gol && exclusive) {
+				if (gol && exclusive) {
 					BLI_remlink(&re->lights, gol);
 					MEM_freeN(gol);
 				}
@@ -3970,16 +3974,16 @@ static void set_material_lightgroups(Render *re)
 	Material *ma;
 	
 	/* not for preview render */
-	if(re->scene->r.scemode & R_PREVIEWBUTS)
+	if (re->scene->r.scemode & R_PREVIEWBUTS)
 		return;
 	
-	for(group= re->main->group.first; group; group=group->id.next)
+	for (group= re->main->group.first; group; group=group->id.next)
 		group->id.flag |= LIB_DOIT;
 	
 	/* it's a bit too many loops in loops... but will survive */
 	/* hola! materials not in use...? */
-	for(ma= re->main->mat.first; ma; ma=ma->id.next) {
-		if(ma->group && (ma->group->id.flag & LIB_DOIT))
+	for (ma= re->main->mat.first; ma; ma=ma->id.next) {
+		if (ma->group && (ma->group->id.flag & LIB_DOIT))
 			add_lightgroup(re, ma->group, ma->mode & MA_GROUP_NOLAY);
 	}
 }
@@ -3988,8 +3992,8 @@ static void set_renderlayer_lightgroups(Render *re, Scene *sce)
 {
 	SceneRenderLayer *srl;
 	
-	for(srl= sce->r.layers.first; srl; srl= srl->next) {
-		if(srl->light_override)
+	for (srl= sce->r.layers.first; srl; srl= srl->next) {
+		if (srl->light_override)
 			add_lightgroup(re, srl->light_override, 0);
 	}
 }
@@ -4003,7 +4007,7 @@ void init_render_world(Render *re)
 	int a;
 	char *cp;
 	
-	if(re->scene && re->scene->world) {
+	if (re->scene && re->scene->world) {
 		re->wrld= *(re->scene->world);
 		
 		cp= (char *)&re->wrld.fastcol;
@@ -4017,14 +4021,14 @@ void init_render_world(Render *re)
 		normalize_v3(re->grvec);
 		copy_m3_m4(re->imat, re->viewinv);
 		
-		for(a=0; a<MAX_MTEX; a++) 
-			if(re->wrld.mtex[a] && re->wrld.mtex[a]->tex) re->wrld.skytype |= WO_SKYTEX;
+		for (a=0; a<MAX_MTEX; a++)
+			if (re->wrld.mtex[a] && re->wrld.mtex[a]->tex) re->wrld.skytype |= WO_SKYTEX;
 		
 		/* AO samples should be OSA minimum */
-		if(re->osa)
-			while(re->wrld.aosamp*re->wrld.aosamp < re->osa) 
+		if (re->osa)
+			while (re->wrld.aosamp*re->wrld.aosamp < re->osa)
 				re->wrld.aosamp++;
-		if(!(re->r.mode & R_RAYTRACE) && (re->wrld.ao_gather_method == WO_AOGATHER_RAYTRACE))
+		if (!(re->r.mode & R_RAYTRACE) && (re->wrld.ao_gather_method == WO_AOGATHER_RAYTRACE))
 			re->wrld.mode &= ~(WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT);
 	}
 	else {
@@ -4057,47 +4061,47 @@ static void set_phong_threshold(ObjectRen *obr)
 	int tot=0, i;
 	
 	/* Added check for 'pointy' situations, only dotproducts of 0.9 and larger 
-	   are taken into account. This threshold is meant to work on smooth geometry, not
-	   for extreme cases (ton) */
+	 * are taken into account. This threshold is meant to work on smooth geometry, not
+	 * for extreme cases (ton) */
 	
-	for(i=0; i<obr->totvlak; i++) {
+	for (i=0; i<obr->totvlak; i++) {
 		vlr= RE_findOrAddVlak(obr, i);
-		if(vlr->flag & R_SMOOTH) {
+		if (vlr->flag & R_SMOOTH) {
 			dot= dot_v3v3(vlr->n, vlr->v1->n);
 			dot= ABS(dot);
-			if(dot>0.9f) {
+			if (dot>0.9f) {
 				thresh+= dot; tot++;
 			}
 			dot= dot_v3v3(vlr->n, vlr->v2->n);
 			dot= ABS(dot);
-			if(dot>0.9f) {
+			if (dot>0.9f) {
 				thresh+= dot; tot++;
 			}
 
 			dot= dot_v3v3(vlr->n, vlr->v3->n);
 			dot= ABS(dot);
-			if(dot>0.9f) {
+			if (dot>0.9f) {
 				thresh+= dot; tot++;
 			}
 
-			if(vlr->v4) {
+			if (vlr->v4) {
 				dot= dot_v3v3(vlr->n, vlr->v4->n);
 				dot= ABS(dot);
-				if(dot>0.9f) {
+				if (dot>0.9f) {
 					thresh+= dot; tot++;
 				}
 			}
 		}
 	}
 	
-	if(tot) {
+	if (tot) {
 		thresh/= (float)tot;
 		obr->ob->smoothresh= cosf(0.5f*(float)M_PI-saacos(thresh));
 	}
 }
 
 /* per face check if all samples should be taken.
-   if raytrace or multisample, do always for raytraced material, or when material full_osa set */
+ * if raytrace or multisample, do always for raytraced material, or when material full_osa set */
 static void set_fullsample_trace_flag(Render *re, ObjectRen *obr)
 {
 	VlakRen *vlr;
@@ -4106,21 +4110,21 @@ static void set_fullsample_trace_flag(Render *re, ObjectRen *obr)
 	osa= re->osa;
 	trace= re->r.mode & R_RAYTRACE;
 	
-	for(a=obr->totvlak-1; a>=0; a--) {
+	for (a=obr->totvlak-1; a>=0; a--) {
 		vlr= RE_findOrAddVlak(obr, a);
 		mode= vlr->mat->mode;
 
-		if(trace && (mode & MA_TRACEBLE))
+		if (trace && (mode & MA_TRACEBLE))
 			vlr->flag |= R_TRACEBLE;
 		
-		if(osa) {
-			if(mode & MA_FULL_OSA) {
+		if (osa) {
+			if (mode & MA_FULL_OSA) {
 				vlr->flag |= R_FULL_OSA;
 			}
-			else if(trace) {
-				if(mode & MA_SHLESS);
-				else if(vlr->mat->material_type == MA_TYPE_VOLUME);
-				else if((mode & MA_RAYMIRROR) || ((mode & MA_TRANSP) && (mode & MA_RAYTRANSP))) {
+			else if (trace) {
+				if (mode & MA_SHLESS);
+				else if (vlr->mat->material_type == MA_TYPE_VOLUME);
+				else if ((mode & MA_RAYMIRROR) || ((mode & MA_TRANSP) && (mode & MA_RAYTRANSP))) {
 					/* for blurry reflect/refract, better to take more samples 
 					 * inside the raytrace than as OSA samples */
 					if ((vlr->mat->gloss_mir == 1.0f) && (vlr->mat->gloss_tra == 1.0f))
@@ -4139,18 +4143,18 @@ static void split_quads(ObjectRen *obr, int dir)
 	VlakRen *vlr, *vlr1;
 	int a;
 
-	for(a=obr->totvlak-1; a>=0; a--) {
+	for (a=obr->totvlak-1; a>=0; a--) {
 		vlr= RE_findOrAddVlak(obr, a);
 		
 		/* test if rendering as a quad or triangle, skip wire */
-		if(vlr->v4 && (vlr->flag & R_STRAND)==0 && (vlr->mat->material_type != MA_TYPE_WIRE)) {
+		if (vlr->v4 && (vlr->flag & R_STRAND)==0 && (vlr->mat->material_type != MA_TYPE_WIRE)) {
 			
-			if(vlr->v4) {
+			if (vlr->v4) {
 
 				vlr1= RE_vlakren_copy(obr, vlr);
 				vlr1->flag |= R_FACE_SPLIT;
 				
-				if( dir==2 ) vlr->flag |= R_DIVIDE_24;
+				if ( dir==2 ) vlr->flag |= R_DIVIDE_24;
 				else vlr->flag &= ~R_DIVIDE_24;
 
 				/* new vertex pointers */
@@ -4189,11 +4193,11 @@ static void check_non_flat_quads(ObjectRen *obr)
 	float nor[3], xn, flen;
 	int a;
 
-	for(a=obr->totvlak-1; a>=0; a--) {
+	for (a=obr->totvlak-1; a>=0; a--) {
 		vlr= RE_findOrAddVlak(obr, a);
 		
 		/* test if rendering as a quad or triangle, skip wire */
-		if(vlr->v4 && (vlr->flag & R_STRAND)==0 && (vlr->mat->material_type != MA_TYPE_WIRE)) {
+		if (vlr->v4 && (vlr->flag & R_STRAND)==0 && (vlr->mat->material_type != MA_TYPE_WIRE)) {
 			
 			/* check if quad is actually triangle */
 			v1= vlr->v1;
@@ -4201,7 +4205,7 @@ static void check_non_flat_quads(ObjectRen *obr)
 			v3= vlr->v3;
 			v4= vlr->v4;
 			sub_v3_v3v3(nor, v1->co, v2->co);
-			if( ABS(nor[0])<FLT_EPSILON10 &&  ABS(nor[1])<FLT_EPSILON10 && ABS(nor[2])<FLT_EPSILON10 ) {
+			if ( ABS(nor[0])<FLT_EPSILON10 &&  ABS(nor[1])<FLT_EPSILON10 && ABS(nor[2])<FLT_EPSILON10 ) {
 				vlr->v1= v2;
 				vlr->v2= v3;
 				vlr->v3= v4;
@@ -4209,26 +4213,26 @@ static void check_non_flat_quads(ObjectRen *obr)
 			}
 			else {
 				sub_v3_v3v3(nor, v2->co, v3->co);
-				if( ABS(nor[0])<FLT_EPSILON10 &&  ABS(nor[1])<FLT_EPSILON10 && ABS(nor[2])<FLT_EPSILON10 ) {
+				if ( ABS(nor[0])<FLT_EPSILON10 &&  ABS(nor[1])<FLT_EPSILON10 && ABS(nor[2])<FLT_EPSILON10 ) {
 					vlr->v2= v3;
 					vlr->v3= v4;
 					vlr->v4= NULL;
 				}
 				else {
 					sub_v3_v3v3(nor, v3->co, v4->co);
-					if( ABS(nor[0])<FLT_EPSILON10 &&  ABS(nor[1])<FLT_EPSILON10 && ABS(nor[2])<FLT_EPSILON10 ) {
+					if ( ABS(nor[0])<FLT_EPSILON10 &&  ABS(nor[1])<FLT_EPSILON10 && ABS(nor[2])<FLT_EPSILON10 ) {
 						vlr->v4= NULL;
 					}
 					else {
 						sub_v3_v3v3(nor, v4->co, v1->co);
-						if( ABS(nor[0])<FLT_EPSILON10 &&  ABS(nor[1])<FLT_EPSILON10 && ABS(nor[2])<FLT_EPSILON10 ) {
+						if ( ABS(nor[0])<FLT_EPSILON10 &&  ABS(nor[1])<FLT_EPSILON10 && ABS(nor[2])<FLT_EPSILON10 ) {
 							vlr->v4= NULL;
 						}
 					}
 				}
 			}
 			
-			if(vlr->v4) {
+			if (vlr->v4) {
 				
 				/* Face is divided along edge with the least gradient 		*/
 				/* Flagged with R_DIVIDE_24 if divide is from vert 2 to 4 	*/
@@ -4239,11 +4243,11 @@ static void check_non_flat_quads(ObjectRen *obr)
 				
 				/* render normals are inverted in render! we calculate normal of single tria here */
 				flen= normal_tri_v3( nor,vlr->v4->co, vlr->v3->co, vlr->v1->co);
-				if(flen==0.0f) normal_tri_v3( nor,vlr->v4->co, vlr->v2->co, vlr->v1->co);
+				if (flen==0.0f) normal_tri_v3( nor,vlr->v4->co, vlr->v2->co, vlr->v1->co);
 				
 				xn = dot_v3v3(nor, vlr->n);
 
-				if(ABS(xn) < 0.999995f ) {	// checked on noisy fractal grid
+				if (ABS(xn) < 0.999995f ) {	// checked on noisy fractal grid
 					
 					float d1, d2;
 
@@ -4257,7 +4261,7 @@ static void check_non_flat_quads(ObjectRen *obr)
 					normal_tri_v3( nor,vlr->v2->co, vlr->v3->co, vlr->v4->co);
 					d2 = dot_v3v3(nor, vlr->v2->n);
 
-					if( fabs(d1) < fabs(d2) ) vlr->flag |= R_DIVIDE_24;
+					if ( fabs(d1) < fabs(d2) ) vlr->flag |= R_DIVIDE_24;
 					else vlr->flag &= ~R_DIVIDE_24;
 
 					/* new vertex pointers */
@@ -4299,25 +4303,26 @@ static void finalize_render_object(Render *re, ObjectRen *obr, int timeoffset)
 	float min[3], max[3], smin[3], smax[3];
 	int a, b;
 
-	if(obr->totvert || obr->totvlak || obr->tothalo || obr->totstrand) {
+	if (obr->totvert || obr->totvlak || obr->tothalo || obr->totstrand) {
 		/* the exception below is because displace code now is in init_render_mesh call, 
-		I will look at means to have autosmooth enabled for all object types 
-		and have it as general postprocess, like displace */
-		if(ob->type!=OB_MESH && test_for_displace(re, ob)) 
+		 * I will look at means to have autosmooth enabled for all object types
+		 * and have it as general postprocess, like displace */
+		if (ob->type!=OB_MESH && test_for_displace(re, ob))
 			do_displacement(re, obr, NULL, NULL);
 	
-		if(!timeoffset) {
+		if (!timeoffset) {
 			/* phong normal interpolation can cause error in tracing
 			 * (terminator problem) */
 			ob->smoothresh= 0.0;
-			if((re->r.mode & R_RAYTRACE) && (re->r.mode & R_SHADOW)) 
+			if ((re->r.mode & R_RAYTRACE) && (re->r.mode & R_SHADOW))
 				set_phong_threshold(obr);
 			
 			if (re->flag & R_BAKING && re->r.bake_quad_split != 0) {
 				/* Baking lets us define a quad split order */
 				split_quads(obr, re->r.bake_quad_split);
-			} else {
-				if((re->r.mode & R_SIMPLIFY && re->r.simplify_flag & R_SIMPLE_NO_TRIANGULATE) == 0)
+			}
+			else {
+				if ((re->r.mode & R_SIMPLIFY && re->r.simplify_flag & R_SIMPLE_NO_TRIANGULATE) == 0)
 					check_non_flat_quads(obr);
 			}
 			
@@ -4325,29 +4330,29 @@ static void finalize_render_object(Render *re, ObjectRen *obr, int timeoffset)
 
 			/* compute bounding boxes for clipping */
 			INIT_MINMAX(min, max);
-			for(a=0; a<obr->totvert; a++) {
-				if((a & 255)==0) ver= obr->vertnodes[a>>8].vert;
+			for (a=0; a<obr->totvert; a++) {
+				if ((a & 255)==0) ver= obr->vertnodes[a>>8].vert;
 				else ver++;
 
 				DO_MINMAX(ver->co, min, max);
 			}
 
-			if(obr->strandbuf) {
+			if (obr->strandbuf) {
 				float width;
 				
 				/* compute average bounding box of strandpoint itself (width) */
-				if(obr->strandbuf->flag & R_STRAND_B_UNITS)
+				if (obr->strandbuf->flag & R_STRAND_B_UNITS)
 					obr->strandbuf->maxwidth= MAX2(obr->strandbuf->ma->strand_sta, obr->strandbuf->ma->strand_end);
 				else
 					obr->strandbuf->maxwidth= 0.0f;
 				
 				width= obr->strandbuf->maxwidth;
 				sbound= obr->strandbuf->bound;
-				for(b=0; b<obr->strandbuf->totbound; b++, sbound++) {
+				for (b=0; b<obr->strandbuf->totbound; b++, sbound++) {
 					
 					INIT_MINMAX(smin, smax);
 
-					for(a=sbound->start; a<sbound->end; a++) {
+					for (a=sbound->start; a<sbound->end; a++) {
 						strand= RE_findOrAddStrand(obr, a);
 						strand_minmax(strand, smin, smax, width);
 					}
@@ -4387,8 +4392,8 @@ static void find_dupli_instances(Render *re, ObjectRen *obr)
 	/* for objects instanced by dupliverts/faces/particles, we go over the
 	 * list of instances to find ones that instance obr, and setup their
 	 * matrices and obr pointer */
-	for(obi=re->instancetable.last; obi; obi=obi->prev) {
-		if(!obi->obr && obi->ob == obr->ob && obi->psysindex == obr->psysindex) {
+	for (obi=re->instancetable.last; obi; obi=obi->prev) {
+		if (!obi->obr && obi->ob == obr->ob && obi->psysindex == obr->psysindex) {
 			obi->obr= obr;
 
 			/* compute difference between object matrix and
@@ -4400,7 +4405,7 @@ static void find_dupli_instances(Render *re, ObjectRen *obr)
 			invert_m3_m3(obi->nmat, nmat);
 			transpose_m3(obi->nmat);
 
-			if(!first) {
+			if (!first) {
 				re->totvert += obr->totvert;
 				re->totvlak += obr->totvlak;
 				re->tothalo += obr->tothalo;
@@ -4442,13 +4447,13 @@ static ObjectRen *find_dupligroup_dupli(Render *re, Object *ob, int psysindex)
 
 	/* if the object is itself instanced, we don't want to create an instance
 	 * for it */
-	if(ob->transflag & OB_RENDER_DUPLI)
+	if (ob->transflag & OB_RENDER_DUPLI)
 		return NULL;
 
 	/* try to find an object that was already created so we can reuse it
 	 * and save memory */
-	for(obr=re->objecttable.first; obr; obr=obr->next)
-		if(obr->ob == ob && obr->psysindex == psysindex && (obr->flag & R_INSTANCEABLE))
+	for (obr=re->objecttable.first; obr; obr=obr->next)
+		if (obr->ob == ob && obr->psysindex == psysindex && (obr->flag & R_INSTANCEABLE))
 			return obr;
 	
 	return NULL;
@@ -4464,14 +4469,14 @@ static void set_dupli_tex_mat(Render *re, ObjectInstanceRen *obi, DupliObject *d
 	static int needtexmat= 0;
 
 	/* init */
-	if(!re) {
+	if (!re) {
 		lastob= NULL;
 		needtexmat= 0;
 		return;
 	}
 
 	/* check if we actually need it */
-	if(lastob != dob->ob) {
+	if (lastob != dob->ob) {
 		Material ***material;
 		short a, *totmaterial;
 
@@ -4481,13 +4486,13 @@ static void set_dupli_tex_mat(Render *re, ObjectInstanceRen *obi, DupliObject *d
 		totmaterial= give_totcolp(dob->ob);
 		material= give_matarar(dob->ob);
 
-		if(totmaterial && material)
-			for(a= 0; a<*totmaterial; a++)
-				if((*material)[a] && (*material)[a]->texco & TEXCO_OBJECT)
+		if (totmaterial && material)
+			for (a= 0; a<*totmaterial; a++)
+				if ((*material)[a] && (*material)[a]->texco & TEXCO_OBJECT)
 					needtexmat= 1;
 	}
 
-	if(needtexmat) {
+	if (needtexmat) {
 		float imat[4][4];
 
 		obi->duplitexmat= BLI_memarena_alloc(re->memArena, sizeof(float)*4*4);
@@ -4502,8 +4507,8 @@ static void init_render_object_data(Render *re, ObjectRen *obr, int timeoffset)
 	ParticleSystem *psys;
 	int i;
 
-	if(obr->psysindex) {
-		if((!obr->prev || obr->prev->ob != ob || (obr->prev->flag & R_INSTANCEABLE)==0) && ob->type==OB_MESH) {
+	if (obr->psysindex) {
+		if ((!obr->prev || obr->prev->ob != ob || (obr->prev->flag & R_INSTANCEABLE)==0) && ob->type==OB_MESH) {
 			/* the emitter mesh wasn't rendered so the modifier stack wasn't
 			 * evaluated with render settings */
 			DerivedMesh *dm;
@@ -4511,19 +4516,19 @@ static void init_render_object_data(Render *re, ObjectRen *obr, int timeoffset)
 			dm->release(dm);
 		}
 
-		for(psys=ob->particlesystem.first, i=0; i<obr->psysindex-1; i++)
+		for (psys=ob->particlesystem.first, i=0; i<obr->psysindex-1; i++)
 			psys= psys->next;
 
 		render_new_particle_system(re, obr, psys, timeoffset);
 	}
 	else {
-		if ELEM(ob->type, OB_FONT, OB_CURVE)
+		if (ELEM(ob->type, OB_FONT, OB_CURVE))
 			init_render_curve(re, obr, timeoffset);
-		else if(ob->type==OB_SURF)
+		else if (ob->type==OB_SURF)
 			init_render_surf(re, obr, timeoffset);
-		else if(ob->type==OB_MESH)
+		else if (ob->type==OB_MESH)
 			init_render_mesh(re, obr, timeoffset);
-		else if(ob->type==OB_MBALL)
+		else if (ob->type==OB_MBALL)
 			init_render_mball(re, obr);
 	}
 
@@ -4546,31 +4551,31 @@ static void add_render_object(Render *re, Object *ob, Object *par, DupliObject *
 
 	/* the emitter has to be processed first (render levels of modifiers) */
 	/* so here we only check if the emitter should be rendered */
-	if(ob->particlesystem.first) {
+	if (ob->particlesystem.first) {
 		show_emitter= 0;
-		for(psys=ob->particlesystem.first; psys; psys=psys->next) {
+		for (psys=ob->particlesystem.first; psys; psys=psys->next) {
 			show_emitter += psys->part->draw & PART_DRAW_EMITTER;
 			psys_render_set(ob, psys, re->viewmat, re->winmat, re->winx, re->winy, timeoffset);
 		}
 
 		/* if no psys has "show emitter" selected don't render emitter */
-		if(show_emitter == 0)
+		if (show_emitter == 0)
 			allow_render= 0;
 	}
 
 	/* one render object for the data itself */
-	if(allow_render) {
+	if (allow_render) {
 		obr= RE_addRenderObject(re, ob, par, index, 0, ob->lay);
-		if((dob && !dob->animated) || (ob->transflag & OB_RENDER_DUPLI)) {
+		if ((dob && !dob->animated) || (ob->transflag & OB_RENDER_DUPLI)) {
 			obr->flag |= R_INSTANCEABLE;
 			copy_m4_m4(obr->obmat, ob->obmat);
 		}
 		init_render_object_data(re, obr, timeoffset);
 
 		/* only add instance for objects that have not been used for dupli */
-		if(!(ob->transflag & OB_RENDER_DUPLI)) {
+		if (!(ob->transflag & OB_RENDER_DUPLI)) {
 			obi= RE_addRenderInstance(re, obr, ob, par, index, 0, NULL, ob->lay);
-			if(dob) set_dupli_tex_mat(re, obi, dob);
+			if (dob) set_dupli_tex_mat(re, obi, dob);
 		}
 		else
 			find_dupli_instances(re, obr);
@@ -4583,24 +4588,24 @@ static void add_render_object(Render *re, Object *ob, Object *par, DupliObject *
 	}
 
 	/* and one render object per particle system */
-	if(ob->particlesystem.first) {
+	if (ob->particlesystem.first) {
 		psysindex= 1;
-		for(psys=ob->particlesystem.first; psys; psys=psys->next, psysindex++) {
+		for (psys=ob->particlesystem.first; psys; psys=psys->next, psysindex++) {
 			obr= RE_addRenderObject(re, ob, par, index, psysindex, ob->lay);
-			if((dob && !dob->animated) || (ob->transflag & OB_RENDER_DUPLI)) {
+			if ((dob && !dob->animated) || (ob->transflag & OB_RENDER_DUPLI)) {
 				obr->flag |= R_INSTANCEABLE;
 				copy_m4_m4(obr->obmat, ob->obmat);
 			}
-			if(dob)
+			if (dob)
 				psys->flag |= PSYS_USE_IMAT;
 			init_render_object_data(re, obr, timeoffset);
 			psys_render_restore(ob, psys);
 			psys->flag &= ~PSYS_USE_IMAT;
 
 			/* only add instance for objects that have not been used for dupli */
-			if(!(ob->transflag & OB_RENDER_DUPLI)) {
+			if (!(ob->transflag & OB_RENDER_DUPLI)) {
 				obi= RE_addRenderInstance(re, obr, ob, par, index, psysindex, NULL, ob->lay);
-				if(dob) set_dupli_tex_mat(re, obi, dob);
+				if (dob) set_dupli_tex_mat(re, obi, dob);
 			}
 			else
 				find_dupli_instances(re, obr);
@@ -4616,9 +4621,9 @@ static void init_render_object(Render *re, Object *ob, Object *par, DupliObject
 	double time;
 	float mat[4][4];
 
-	if(ob->type==OB_LAMP)
+	if (ob->type==OB_LAMP)
 		add_render_lamp(re, ob);
-	else if(render_object_type(ob->type))
+	else if (render_object_type(ob->type))
 		add_render_object(re, ob, par, dob, timeoffset);
 	else {
 		mult_m4_m4m4(mat, re->viewmat, ob->obmat);
@@ -4626,7 +4631,7 @@ static void init_render_object(Render *re, Object *ob, Object *par, DupliObject
 	}
 	
 	time= PIL_check_seconds_timer();
-	if(time - lasttime > 1.0) {
+	if (time - lasttime > 1.0) {
 		lasttime= time;
 		/* clumsy copying still */
 		re->i.totvert= re->totvert;
@@ -4645,8 +4650,8 @@ void RE_Database_Free(Render *re)
 	LampRen *lar;
 	
 	/* statistics for debugging render memory usage */
-	if((G.f & G_DEBUG) && (G.rendering)) {
-		if((re->r.scemode & R_PREVIEWBUTS)==0) {
+	if ((G.debug & G_DEBUG) && (G.rendering)) {
+		if ((re->r.scemode & R_PREVIEWBUTS)==0) {
 			BKE_image_print_memlist();
 			MEM_printmemlist_stats();
 		}
@@ -4654,11 +4659,11 @@ void RE_Database_Free(Render *re)
 
 	/* FREE */
 	
-	for(lar= re->lampren.first; lar; lar= lar->next) {
+	for (lar= re->lampren.first; lar; lar= lar->next) {
 		freeshadowbuf(lar);
-		if(lar->jitter) MEM_freeN(lar->jitter);
-		if(lar->shadsamp) MEM_freeN(lar->shadsamp);
-		if(lar->sunsky) MEM_freeN(lar->sunsky);
+		if (lar->jitter) MEM_freeN(lar->jitter);
+		if (lar->shadsamp) MEM_freeN(lar->shadsamp);
+		if (lar->sunsky) MEM_freeN(lar->sunsky);
 		curvemapping_free(lar->curfalloff);
 	}
 	
@@ -4671,9 +4676,7 @@ void RE_Database_Free(Render *re)
 
 	/* free orco */
 	free_mesh_orco_hash(re);
-#if 0	/* radio can be redone better */
-	end_radio_render();
-#endif
+
 	end_render_materials(re->main);
 	end_render_textures(re);
 	
@@ -4681,20 +4684,20 @@ void RE_Database_Free(Render *re)
 	
 	free_camera_inside_volumes(re);
 	
-	if(re->wrld.aosphere) {
+	if (re->wrld.aosphere) {
 		MEM_freeN(re->wrld.aosphere);
 		re->wrld.aosphere= NULL;
 		re->scene->world->aosphere= NULL;
 	}
-	if(re->wrld.aotables) {
+	if (re->wrld.aotables) {
 		MEM_freeN(re->wrld.aotables);
 		re->wrld.aotables= NULL;
 		re->scene->world->aotables= NULL;
 	}
-	if(re->r.mode & R_RAYTRACE)
+	if (re->r.mode & R_RAYTRACE)
 		free_render_qmcsampler(re);
 	
-	if(re->r.mode & R_RAYTRACE) freeraytree(re);
+	if (re->r.mode & R_RAYTRACE) freeraytree(re);
 
 	free_sss(re);
 	free_occ(re);
@@ -4705,12 +4708,12 @@ void RE_Database_Free(Render *re)
 
 	re->bakebuf= NULL;
 
-	if(re->scene)
-		if(re->scene->r.scemode & R_FREE_IMAGE)
-			if((re->r.scemode & R_PREVIEWBUTS)==0)
+	if (re->scene)
+		if (re->scene->r.scemode & R_FREE_IMAGE)
+			if ((re->r.scemode & R_PREVIEWBUTS)==0)
 				BKE_image_free_all_textures();
 
-	if(re->memArena) {
+	if (re->memArena) {
 		BLI_memarena_free(re->memArena);
 		re->memArena = NULL;
 	}
@@ -4719,19 +4722,19 @@ 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)
+	if (ob->transflag & OB_DUPLIPARTS)
 		; /* let particle system(s) handle showing vs. not showing */
-	else if((ob->transflag & OB_DUPLI) && !(ob->transflag & OB_DUPLIFRAMES))
+	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!=find_basis_mball(re->scene, ob))
 		return 0;
 	
-	if(nolamps && (ob->type==OB_LAMP))
+	if (nolamps && (ob->type==OB_LAMP))
 		return 0;
 	
-	if(onlyselected && (ob!=actob && !(ob->flag & SELECT)))
+	if (onlyselected && (ob!=actob && !(ob->flag & SELECT)))
 		return 0;
 	
 	return 1;
@@ -4747,16 +4750,16 @@ static int allow_render_dupli_instance(Render *UNUSED(re), DupliObject *dob, Obj
 	 * all halo's to sort them globally in advance */
 	totmaterial= give_totcolp(obd);
 
-	if(totmaterial) {
-		for(a= 0; a<*totmaterial; a++) {
+	if (totmaterial) {
+		for (a= 0; a<*totmaterial; a++) {
 			ma= give_current_material(obd, a);
-			if(ma && (ma->material_type == MA_TYPE_HALO))
+			if (ma && (ma->material_type == MA_TYPE_HALO))
 				return 0;
 		}
 	}
 
-	for(psys=obd->particlesystem.first; psys; psys=psys->next)
-		if(!ELEM5(psys->part->ren_as, PART_DRAW_BB, PART_DRAW_LINE, PART_DRAW_PATH, PART_DRAW_OB, PART_DRAW_GR))
+	for (psys=obd->particlesystem.first; psys; psys=psys->next)
+		if (!ELEM5(psys->part->ren_as, PART_DRAW_BB, PART_DRAW_LINE, PART_DRAW_PATH, PART_DRAW_OB, PART_DRAW_GR))
 			return 0;
 
 	/* don't allow lamp, animated duplis, or radio render */
@@ -4773,35 +4776,35 @@ static void dupli_render_particle_set(Render *re, Object *ob, int timeoffset, in
 	ParticleSystem *psys;
 	DerivedMesh *dm;
 
-	if(level >= MAX_DUPLI_RECUR)
+	if (level >= MAX_DUPLI_RECUR)
 		return;
 	
-	if(ob->transflag & OB_DUPLIPARTS) {
-		for(psys=ob->particlesystem.first; psys; psys=psys->next) {
-			if(ELEM(psys->part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
-				if(enable)
+	if (ob->transflag & OB_DUPLIPARTS) {
+		for (psys=ob->particlesystem.first; psys; psys=psys->next) {
+			if (ELEM(psys->part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
+				if (enable)
 					psys_render_set(ob, psys, re->viewmat, re->winmat, re->winx, re->winy, timeoffset);
 				else
 					psys_render_restore(ob, psys);
 			}
 		}
 
-		if(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 */
+			 * the derivedmesh must be created before init_render_mesh,
+			 * since object_duplilist does dupliparticles before that */
 			dm = mesh_create_derived_render(re->scene, ob, CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL);
 			dm->release(dm);
 
-			for(psys=ob->particlesystem.first; psys; psys=psys->next)
+			for (psys=ob->particlesystem.first; psys; psys=psys->next)
 				psys_get_modifier(ob, psys)->flag &= ~eParticleSystemFlag_psys_updated;
 		}
 	}
 
-	if(ob->dup_group==NULL) return;
+	if (ob->dup_group==NULL) return;
 	group= ob->dup_group;
 
-	for(go= group->gobject.first; go; go= go->next)
+	for (go= group->gobject.first; go; go= go->next)
 		dupli_render_particle_set(re, go->ob, timeoffset, level+1, enable);
 }
 
@@ -4810,8 +4813,8 @@ static int get_vector_renderlayers(Scene *sce)
 	SceneRenderLayer *srl;
 	unsigned int lay= 0;
 
-	for(srl= sce->r.layers.first; srl; srl= srl->next)
-		if(srl->passflag & SCE_PASS_VECTOR)
+	for (srl= sce->r.layers.first; srl; srl= srl->next)
+		if (srl->passflag & SCE_PASS_VECTOR)
 			lay |= srl->lay;
 
 	return lay;
@@ -4823,20 +4826,20 @@ static void add_group_render_dupli_obs(Render *re, Group *group, int nolamps, in
 	Object *ob;
 
 	/* simple preventing of too deep nested groups */
-	if(level>MAX_DUPLI_RECUR) return;
+	if (level>MAX_DUPLI_RECUR) return;
 
 	/* recursively go into dupligroups to find objects with OB_RENDER_DUPLI
 	 * that were not created yet */
-	for(go= group->gobject.first; go; go= go->next) {
+	for (go= group->gobject.first; go; go= go->next) {
 		ob= go->ob;
 
-		if(ob->flag & OB_DONE) {
-			if(ob->transflag & OB_RENDER_DUPLI) {
-				if(allow_render_object(re, ob, nolamps, onlyselected, actob)) {
+		if (ob->flag & OB_DONE) {
+			if (ob->transflag & OB_RENDER_DUPLI) {
+				if (allow_render_object(re, ob, nolamps, onlyselected, actob)) {
 					init_render_object(re, ob, NULL, 0, timeoffset);
 					ob->transflag &= ~OB_RENDER_DUPLI;
 
-					if(ob->dup_group)
+					if (ob->dup_group)
 						add_group_render_dupli_obs(re, ob->dup_group, nolamps, onlyselected, actob, timeoffset, level+1);
 				}
 			}
@@ -4860,12 +4863,12 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
 	set_dupli_tex_mat(NULL, NULL, NULL);
 
 	/* loop over all objects rather then using SETLOOPER because we may
-	 * reference an mtex-mapped object which isnt rendered or is an
+	 * reference an mtex-mapped object which isn't rendered or is an
 	 * empty in a dupli group. We could scan all render material/lamp/world
 	 * mtex's for mapto objects but its easier just to set the
 	 * 'imat' / 'imat_ren' on all and unlikely to be a performance hit
-	* See bug: [#28744] - campbell */
-	for(ob= re->main->object.first; ob; ob= ob->id.next) {
+	 * See bug: [#28744] - campbell */
+	for (ob= re->main->object.first; ob; ob= ob->id.next) {
 		/* imat objects has to be done here, since displace can have texture using Object map-input */
 		mult_m4_m4m4(mat, re->viewmat, ob->obmat);
 		invert_m4_m4(ob->imat_ren, mat);
@@ -4875,7 +4878,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
 		ob->transflag &= ~OB_RENDER_DUPLI;
 	}
 
-	for(SETLOOPER(re->scene, sce_iter, base)) {
+	for (SETLOOPER(re->scene, sce_iter, base)) {
 		ob= base->object;
 
 		/* in the prev/next pass for making speed vectors, avoid creating
@@ -4885,21 +4888,21 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
 		lay= (timeoffset)? renderlay & vectorlay: renderlay;
 
 		/* if the object has been restricted from rendering in the outliner, ignore it */
-		if(ob->restrictflag & OB_RESTRICT_RENDER) continue;
+		if (ob->restrictflag & OB_RESTRICT_RENDER) continue;
 
 		/* OB_DONE means the object itself got duplicated, so was already converted */
-		if(ob->flag & OB_DONE) {
+		if (ob->flag & OB_DONE) {
 			/* OB_RENDER_DUPLI means instances for it were already created, now
 			 * it still needs to create the ObjectRen containing the data */
-			if(ob->transflag & OB_RENDER_DUPLI) {
-				if(allow_render_object(re, ob, nolamps, onlyselected, actob)) {
+			if (ob->transflag & OB_RENDER_DUPLI) {
+				if (allow_render_object(re, ob, nolamps, onlyselected, actob)) {
 					init_render_object(re, ob, NULL, 0, timeoffset);
 					ob->transflag &= ~OB_RENDER_DUPLI;
 				}
 			}
 		}
-		else if((base->lay & lay) || (ob->type==OB_LAMP && (base->lay & re->lay)) ) {
-			if((ob->transflag & OB_DUPLI) && (ob->type!=OB_MBALL)) {
+		else if ((base->lay & lay) || (ob->type==OB_LAMP && (base->lay & re->lay)) ) {
+			if ((ob->transflag & OB_DUPLI) && (ob->type!=OB_MBALL)) {
 				DupliObject *dob;
 				ListBase *lb;
 
@@ -4909,25 +4912,25 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
 				lb= object_duplilist(re->scene, ob);
 				dupli_render_particle_set(re, ob, timeoffset, 0, 0);
 
-				for(dob= lb->first; dob; dob= dob->next) {
+				for (dob= lb->first; dob; dob= dob->next) {
 					Object *obd= dob->ob;
 					
 					copy_m4_m4(obd->obmat, dob->mat);
 
 					/* group duplis need to set ob matrices correct, for deform. so no_draw is part handled */
-					if(!(obd->transflag & OB_RENDER_DUPLI) && dob->no_draw)
+					if (!(obd->transflag & OB_RENDER_DUPLI) && dob->no_draw)
 						continue;
 
-					if(obd->restrictflag & OB_RESTRICT_RENDER)
+					if (obd->restrictflag & OB_RESTRICT_RENDER)
 						continue;
 
-					if(obd->type==OB_MBALL)
+					if (obd->type==OB_MBALL)
 						continue;
 
-					if(!allow_render_object(re, obd, nolamps, onlyselected, actob))
+					if (!allow_render_object(re, obd, nolamps, onlyselected, actob))
 						continue;
 
-					if(allow_render_dupli_instance(re, dob, obd)) {
+					if (allow_render_dupli_instance(re, dob, obd)) {
 						ParticleSystem *psys;
 						ObjectRen *obr = NULL;
 						int psysindex;
@@ -4938,13 +4941,13 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
 						/* instances instead of the actual object are added in two cases, either
 						 * this is a duplivert/face/particle, or it is a non-animated object in
 						 * a dupligroup that has already been created before */
-						if(dob->type != OB_DUPLIGROUP || (obr=find_dupligroup_dupli(re, obd, 0))) {
+						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);
 
 							/* fill in instance variables for texturing */
 							set_dupli_tex_mat(re, obi, dob);
-							if(dob->type != OB_DUPLIGROUP) {
+							if (dob->type != OB_DUPLIGROUP) {
 								copy_v3_v3(obi->dupliorco, dob->orco);
 								obi->dupliuv[0]= dob->uv[0];
 								obi->dupliuv[1]= dob->uv[1];
@@ -4955,7 +4958,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
 								 * itself was duplicated. for the first case find_dupli_instances
 								 * will be called later. */
 								assign_dupligroup_dupli(re, obi, obr);
-								if(obd->transflag & OB_RENDER_DUPLI)
+								if (obd->transflag & OB_RENDER_DUPLI)
 									find_dupli_instances(re, obr);
 							}
 						}
@@ -4963,31 +4966,31 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
 						/* same logic for particles, each particle system has it's own object, so
 						 * need to go over them separately */
 						psysindex= 1;
-						for(psys=obd->particlesystem.first; psys; psys=psys->next) {
-							if(dob->type != OB_DUPLIGROUP || (obr=find_dupligroup_dupli(re, obd, psysindex))) {
-								if(obi == NULL)
+						for (psys=obd->particlesystem.first; psys; psys=psys->next) {
+							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);
 
 								set_dupli_tex_mat(re, obi, dob);
-								if(dob->type != OB_DUPLIGROUP) {
+								if (dob->type != OB_DUPLIGROUP) {
 									copy_v3_v3(obi->dupliorco, dob->orco);
 									obi->dupliuv[0]= dob->uv[0];
 									obi->dupliuv[1]= dob->uv[1];
 								}
 								else {
 									assign_dupligroup_dupli(re, obi, obr);
-									if(obd->transflag & OB_RENDER_DUPLI)
+									if (obd->transflag & OB_RENDER_DUPLI)
 										find_dupli_instances(re, obr);
 								}
 							}
 						}
 
-						if(obi==NULL)
+						if (obi==NULL)
 							/* can't instance, just create the object */
 							init_render_object(re, obd, ob, dob, timeoffset);
 						
-						if(dob->type != OB_DUPLIGROUP) {
+						if (dob->type != OB_DUPLIGROUP) {
 							obd->flag |= OB_DONE;
 							obd->transflag |= OB_RENDER_DUPLI;
 						}
@@ -4995,26 +4998,26 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
 					else
 						init_render_object(re, obd, ob, dob, timeoffset);
 					
-					if(re->test_break(re->tbh)) break;
+					if (re->test_break(re->tbh)) break;
 				}
 				free_object_duplilist(lb);
 
-				if(allow_render_object(re, ob, nolamps, onlyselected, actob))
+				if (allow_render_object(re, ob, nolamps, onlyselected, actob))
 					init_render_object(re, ob, NULL, 0, timeoffset);
 			}
-			else if(allow_render_object(re, ob, nolamps, onlyselected, actob))
+			else if (allow_render_object(re, ob, nolamps, onlyselected, actob))
 				init_render_object(re, ob, NULL, 0, timeoffset);
 		}
 
-		if(re->test_break(re->tbh)) break;
+		if (re->test_break(re->tbh)) break;
 	}
 
 	/* objects in groups with OB_RENDER_DUPLI set still need to be created,
 	 * since they may not be part of the scene */
-	for(group= re->main->group.first; group; group=group->id.next)
+	for (group= re->main->group.first; group; group=group->id.next)
 		add_group_render_dupli_obs(re, group, nolamps, onlyselected, actob, timeoffset, 0);
 
-	if(!re->test_break(re->tbh))
+	if (!re->test_break(re->tbh))
 		RE_makeRenderInstances(re);
 }
 
@@ -5046,18 +5049,18 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l
 	re->i.partsdone= 0;	/* signal now in use for previewrender */
 	
 	/* in localview, lamps are using normal layers, objects only local bits */
-	if(re->lay & 0xFF000000)
+	if (re->lay & 0xFF000000)
 		lay &= 0xFF000000;
 	
 	/* applies changes fully */
-	if((re->r.scemode & (R_NO_FRAME_UPDATE|R_PREVIEWBUTS))==0)
+	if ((re->r.scemode & (R_NO_FRAME_UPDATE|R_PREVIEWBUTS))==0)
 		scene_update_for_newframe(re->main, re->scene, lay);
 	
 	/* if no camera, viewmat should have been set! */
-	if(use_camera_view && camera) {
-		/* called before but need to call again incase of lens animation from the
+	if (use_camera_view && camera) {
+		/* called before but need to call again in case of lens animation from the
 		 * above call to scene_update_for_newframe, fixes bug. [#22702].
-		 * following calls dont depend on 'RE_SetCamera' */
+		 * following calls don't depend on 'RE_SetCamera' */
 		RE_SetCamera(re, camera);
 
 		normalize_m4(camera->obmat);
@@ -5067,10 +5070,10 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l
 	}
 	
 	init_render_world(re);	/* do first, because of ambient. also requires re->osa set correct */
-	if(re->r.mode & R_RAYTRACE) {
+	if (re->r.mode & R_RAYTRACE) {
 		init_render_qmcsampler(re);
 
-		if(re->wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT))
+		if (re->wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT))
 			if (re->wrld.ao_samp_method == WO_AOSAMP_CONSTANT)
 				init_ao_sphere(&re->wrld);
 	}
@@ -5084,11 +5087,11 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l
 	/* MAKE RENDER DATA */
 	database_init_objects(re, lay, 0, 0, 0, 0);
 	
-	if(!re->test_break(re->tbh)) {
+	if (!re->test_break(re->tbh)) {
 		int tothalo;
 
 		set_material_lightgroups(re);
-		for(sce= re->scene; sce; sce= sce->set)
+		for (sce= re->scene; sce; sce= sce->set)
 			set_renderlayer_lightgroups(re, sce);
 		
 		slurph_opt= 1;
@@ -5103,8 +5106,8 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l
 		
 		/* don't sort stars */
 		tothalo= re->tothalo;
-		if(!re->test_break(re->tbh)) {
-			if(re->wrld.mode & WO_STARS) {
+		if (!re->test_break(re->tbh)) {
+			if (re->wrld.mode & WO_STARS) {
 				re->i.infostr= "Creating Starfield";
 				re->stats_draw(re->sdh, &re->i);
 				RE_make_stars(re, NULL, NULL, NULL, NULL);
@@ -5123,43 +5126,43 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l
 		/* old code checked for internal render (aka not yafray) */
 		{
 			/* raytree */
-			if(!re->test_break(re->tbh)) {
-				if(re->r.mode & R_RAYTRACE) {
+			if (!re->test_break(re->tbh)) {
+				if (re->r.mode & R_RAYTRACE) {
 					makeraytree(re);
 				}
 			}
 			/* ENVIRONMENT MAPS */
-			if(!re->test_break(re->tbh))
+			if (!re->test_break(re->tbh))
 				make_envmaps(re);
 				
 			/* point density texture */
-			if(!re->test_break(re->tbh))
+			if (!re->test_break(re->tbh))
 				make_pointdensities(re);
 			/* voxel data texture */
-			if(!re->test_break(re->tbh))
+			if (!re->test_break(re->tbh))
 				make_voxeldata(re);
 		}
 		
-		if(!re->test_break(re->tbh))
+		if (!re->test_break(re->tbh))
 			project_renderdata(re, projectverto, re->r.mode & R_PANORAMA, 0, 1);
 		
 		/* Occlusion */
-		if((re->wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) && !re->test_break(re->tbh))
-			if(re->wrld.ao_gather_method == WO_AOGATHER_APPROX)
-				if(re->r.mode & R_SHADOW)
+		if ((re->wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) && !re->test_break(re->tbh))
+			if (re->wrld.ao_gather_method == WO_AOGATHER_APPROX)
+				if (re->r.mode & R_SHADOW)
 					make_occ_tree(re);
 
 		/* SSS */
-		if((re->r.mode & R_SSS) && !re->test_break(re->tbh))
+		if ((re->r.mode & R_SSS) && !re->test_break(re->tbh))
 			make_sss_tree(re);
 		
-		if(!re->test_break(re->tbh))
-			if(re->r.mode & R_RAYTRACE)
+		if (!re->test_break(re->tbh))
+			if (re->r.mode & R_RAYTRACE)
 				volume_precache(re);
 		
 	}
 	
-	if(re->test_break(re->tbh))
+	if (re->test_break(re->tbh))
 		RE_Database_Free(re);
 	else
 		re->i.convertdone= 1;
@@ -5201,7 +5204,7 @@ static void database_fromscene_vectors(Render *re, Scene *scene, unsigned int la
 	slurph_opt= 0;
 	
 	/* in localview, lamps are using normal layers, objects only local bits */
-	if(re->lay & 0xFF000000)
+	if (re->lay & 0xFF000000)
 		lay &= 0xFF000000;
 	
 	/* applies changes fully */
@@ -5209,7 +5212,7 @@ static void database_fromscene_vectors(Render *re, Scene *scene, unsigned int la
 	scene_update_for_newframe(re->main, re->scene, lay);
 	
 	/* if no camera, viewmat should have been set! */
-	if(camera) {
+	if (camera) {
 		normalize_m4(camera->obmat);
 		invert_m4_m4(mat, camera->obmat);
 		RE_SetView(re, mat);
@@ -5218,7 +5221,7 @@ static void database_fromscene_vectors(Render *re, Scene *scene, unsigned int la
 	/* MAKE RENDER DATA */
 	database_init_objects(re, lay, 0, 0, 0, timeoffset);
 	
-	if(!re->test_break(re->tbh))
+	if (!re->test_break(re->tbh))
 		project_renderdata(re, projectverto, re->r.mode & R_PANORAMA, 0, 1);
 
 	/* do this in end, particles for example need cfra */
@@ -5233,11 +5236,11 @@ static void speedvector_project(Render *re, float zco[2], const float co[3], con
 	float div;
 	
 	/* initialize */
-	if(re) {
+	if (re) {
 		pano= re->r.mode & R_PANORAMA;
 		
 		/* precalculate amount of radians 1 pixel rotates */
-		if(pano) {
+		if (pano) {
 			/* size of 1 pixel mapped to viewplane coords */
 			float psize= (re->viewplane.xmax-re->viewplane.xmin)/(float)re->winx;
 			/* x angle of a pixel */
@@ -5254,17 +5257,17 @@ static void speedvector_project(Render *re, float zco[2], const float co[3], con
 	}
 	
 	/* now map hocos to screenspace, uses very primitive clip still */
-	if(ho[3]<0.1f) div= 10.0f;
+	if (ho[3]<0.1f) div= 10.0f;
 	else div= 1.0f/ho[3];
 	
 	/* use cylinder projection */
-	if(pano) {
+	if (pano) {
 		float vec[3], ang;
 		/* angle between (0,0,-1) and (co) */
 		copy_v3_v3(vec, co);
 
 		ang= saacos(-vec[2]/sqrtf(vec[0]*vec[0] + vec[2]*vec[2]));
-		if(vec[0]<0.0f) ang= -ang;
+		if (vec[0]<0.0f) ang= -ang;
 		zco[0]= ang/pixelphix + zmulx;
 		
 		ang= 0.5f*(float)M_PI - saacos(vec[1] / len_v3(vec));
@@ -5287,21 +5290,21 @@ static void calculate_speedvector(const float vectors[2], int step, float winsq,
 	zco[1]= vectors[1] - zco[1];
 	
 	/* enable nice masks for hardly moving stuff or float inaccuracy */
-	if(zco[0]<0.1f && zco[0]>-0.1f && zco[1]<0.1f && zco[1]>-0.1f ) {
+	if (zco[0]<0.1f && zco[0]>-0.1f && zco[1]<0.1f && zco[1]>-0.1f ) {
 		zco[0]= 0.0f;
 		zco[1]= 0.0f;
 	}
 	
 	/* maximize speed for image width, otherwise it never looks good */
 	len= zco[0]*zco[0] + zco[1]*zco[1];
-	if(len > winsq) {
+	if (len > winsq) {
 		len= winroot/sqrtf(len);
 		zco[0]*= len;
 		zco[1]*= len;
 	}
 	
 	/* note; in main vecblur loop speedvec is negated again */
-	if(step) {
+	if (step) {
 		speed[2]= -zco[0];
 		speed[3]= -zco[1];
 	}
@@ -5313,21 +5316,21 @@ static void calculate_speedvector(const float vectors[2], int step, float winsq,
 
 static float *calculate_strandsurface_speedvectors(Render *re, ObjectInstanceRen *obi, StrandSurface *mesh)
 {
-	if(mesh->co && mesh->prevco && mesh->nextco) {
+	if (mesh->co && mesh->prevco && mesh->nextco) {
 		float winsq= (float)re->winx*(float)re->winy; /* int's can wrap on large images */
 		float winroot= sqrt(winsq);
 		float (*winspeed)[4];
 		float ho[4], prevho[4], nextho[4], winmat[4][4], vec[2];
 		int a;
 
-		if(obi->flag & R_TRANSFORMED)
+		if (obi->flag & R_TRANSFORMED)
 			mult_m4_m4m4(winmat, re->winmat, obi->mat);
 		else
 			copy_m4_m4(winmat, re->winmat);
 
 		winspeed= MEM_callocN(sizeof(float)*4*mesh->totvert, "StrandSurfWin");
 
-		for(a=0; a<mesh->totvert; a++) {
+		for (a=0; a<mesh->totvert; a++) {
 			projectvert(mesh->co[a], winmat, ho);
 
 			projectvert(mesh->prevco[a], winmat, prevho);
@@ -5357,14 +5360,14 @@ static void calculate_speedvectors(Render *re, ObjectInstanceRen *obi, float *ve
 	float winsq= (float)re->winx*(float)re->winy, winroot= sqrt(winsq);  /* int's can wrap on large images */
 	int a, *face, *index;
 
-	if(obi->flag & R_TRANSFORMED)
+	if (obi->flag & R_TRANSFORMED)
 		mult_m4_m4m4(winmat, re->winmat, obi->mat);
 	else
 		copy_m4_m4(winmat, re->winmat);
 
-	if(obr->vertnodes) {
-		for(a=0; a<obr->totvert; a++, vectors+=2) {
-			if((a & 255)==0) ver= obr->vertnodes[a>>8].vert;
+	if (obr->vertnodes) {
+		for (a=0; a<obr->totvert; a++, vectors+=2) {
+			if ((a & 255)==0) ver= obr->vertnodes[a>>8].vert;
 			else ver++;
 
 			speed= RE_vertren_get_winspeed(obi, ver, 1);
@@ -5373,21 +5376,21 @@ static void calculate_speedvectors(Render *re, ObjectInstanceRen *obi, float *ve
 		}
 	}
 
-	if(obr->strandnodes) {
+	if (obr->strandnodes) {
 		strandbuf= obr->strandbuf;
 		mesh= (strandbuf)? strandbuf->surface: NULL;
 
 		/* compute speed vectors at surface vertices */
-		if(mesh)
+		if (mesh)
 			winspeed= (float(*)[4])calculate_strandsurface_speedvectors(re, obi, mesh);
 
-		if(winspeed) {
-			for(a=0; a<obr->totstrand; a++, vectors+=2) {
-				if((a & 255)==0) strand= obr->strandnodes[a>>8].strand;
+		if (winspeed) {
+			for (a=0; a<obr->totstrand; a++, vectors+=2) {
+				if ((a & 255)==0) strand= obr->strandnodes[a>>8].strand;
 				else strand++;
 
 				index= RE_strandren_get_face(obr, strand, 0);
-				if(index && *index < mesh->totface) {
+				if (index && *index < mesh->totface) {
 					speed= RE_strandren_get_winspeed(obi, strand, 1);
 
 					/* interpolate speed vectors from strand surface */
@@ -5404,7 +5407,7 @@ static void calculate_speedvectors(Render *re, ObjectInstanceRen *obi, float *ve
 					madd_v4_v4fl(speed, winspeed[face[0]], w[0]);
 					madd_v4_v4fl(speed, winspeed[face[1]], w[1]);
 					madd_v4_v4fl(speed, winspeed[face[2]], w[2]);
-					if(face[3])
+					if (face[3])
 						madd_v4_v4fl(speed, winspeed[face[3]], w[3]);
 				}
 			}
@@ -5431,9 +5434,9 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float *
 	FluidVertexVelocity *velarray = NULL;
 	
 	/* only one step needed */
-	if(step) return 1;
+	if (step) return 1;
 	
-	if(fluidmd)
+	if (fluidmd)
 		fss = fluidmd->fss;
 	else
 		return 0;
@@ -5442,45 +5445,44 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float *
 	invert_m4_m4(imat, mat);
 
 	/* set first vertex OK */
-	if(!fss->meshVelocities) return 0;
+	if (!fss->meshVelocities) return 0;
 	
-	if( obr->totvert != fss->totvert) {
+	if ( obr->totvert != fss->totvert) {
 		//fprintf(stderr, "load_fluidsimspeedvectors - modified fluidsim mesh, not using speed vectors (%d,%d)...\n", obr->totvert, fsob->fluidsimSettings->meshSurface->totvert); // DEBUG
 		return 0;
 	}
 	
 	velarray = fss->meshVelocities;
 
-	if(obi->flag & R_TRANSFORMED)
+	if (obi->flag & R_TRANSFORMED)
 		mult_m4_m4m4(winmat, re->winmat, obi->mat);
 	else
 		copy_m4_m4(winmat, re->winmat);
 	
 	/* (bad) HACK calculate average velocity */
 	/* better solution would be fixing getVelocityAt() in intern/elbeem/intern/solver_util.cpp
-	so that also small drops/little water volumes return a velocity != 0. 
-	But I had no luck in fixing that function - DG */
-	for(a=0; a<obr->totvert; a++) {
-		for(j=0;j<3;j++) avgvel[j] += velarray[a].vel[j];
+	 * so that also small drops/little water volumes return a velocity != 0.
+	 * But I had no luck in fixing that function - DG */
+	for (a=0; a<obr->totvert; a++) {
+		for (j=0;j<3;j++) avgvel[j] += velarray[a].vel[j];
 		
 	}
-	for(j=0;j<3;j++) avgvel[j] /= (float)(obr->totvert);
+	for (j=0;j<3;j++) avgvel[j] /= (float)(obr->totvert);
 	
 	
-	for(a=0; a<obr->totvert; a++, vectors+=2) {
-		if((a & 255)==0)
+	for (a=0; a<obr->totvert; a++, vectors+=2) {
+		if ((a & 255)==0)
 			ver= obr->vertnodes[a>>8].vert;
 		else
 			ver++;
 
 		// get fluid velocity
-		fsvec[3] = 0.; 
-		//fsvec[0] = fsvec[1] = fsvec[2] = fsvec[3] = 0.; fsvec[2] = 2.; // NT fixed test
-		for(j=0;j<3;j++) fsvec[j] = velarray[a].vel[j];
+		fsvec[3] = 0.0f;
+		//fsvec[0] = fsvec[1] = fsvec[2] = fsvec[3] = 0.0; fsvec[2] = 2.0f; // NT fixed test
+		for (j=0;j<3;j++) fsvec[j] = velarray[a].vel[j];
 		
 		/* (bad) HACK insert average velocity if none is there (see previous comment) */
-		if((fsvec[0] == 0.0f) && (fsvec[1] == 0.0f) && (fsvec[2] == 0.0f))
-		{
+		if ((fsvec[0] == 0.0f) && (fsvec[1] == 0.0f) && (fsvec[2] == 0.0f)) {
 			fsvec[0] = avgvel[0];
 			fsvec[1] = avgvel[1];
 			fsvec[2] = avgvel[2];
@@ -5497,14 +5499,14 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float *
 		
 		/* now map hocos to screenspace, uses very primitive clip still */
 		// use ho[3] of original vertex, xy component of vel. direction
-		if(ho[3]<0.1f) div= 10.0f;
+		if (ho[3]<0.1f) div= 10.0f;
 		else div= 1.0f/ho[3];
 		zco[0]= zmulx*hoco[0]*div;
 		zco[1]= zmuly*hoco[1]*div;
 		
 		// maximize speed as usual
 		len= zco[0]*zco[0] + zco[1]*zco[1];
-		if(len > winsq) {
+		if (len > winsq) {
 			len= winroot/sqrtf(len);
 			zco[0]*= len; zco[1]*= len;
 		}
@@ -5513,7 +5515,7 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float *
 		// set both to the same value
 		speed[0]= speed[2]= zco[0];
 		speed[1]= speed[3]= zco[1];
-		//if(a<20) fprintf(stderr,"speed %d %f,%f | camco %f,%f,%f | hoco %f,%f,%f,%f  \n", a, speed[0], speed[1], camco[0],camco[1], camco[2], hoco[0],hoco[1], hoco[2],hoco[3]); // NT DEBUG
+		//if (a < 20) fprintf(stderr,"speed %d %f,%f | camco %f,%f,%f | hoco %f,%f,%f,%f\n", a, speed[0], speed[1], camco[0],camco[1], camco[2], hoco[0],hoco[1], hoco[2],hoco[3]); // NT DEBUG
 	}
 
 	return 1;
@@ -5529,7 +5531,7 @@ static void copy_dbase_object_vectors(Render *re, ListBase *lb)
 	float *vec, ho[4], winmat[4][4];
 	int a, totvector;
 
-	for(obi= re->instancetable.first; obi; obi= obi->next) {
+	for (obi= re->instancetable.first; obi; obi= obi->next) {
 		obr= obi->obr;
 
 		obilb= MEM_mallocN(sizeof(ObjectInstanceRen), "ObInstanceVector");
@@ -5538,16 +5540,16 @@ static void copy_dbase_object_vectors(Render *re, ListBase *lb)
 
 		obilb->totvector= totvector= obr->totvert;
 
-		if(totvector > 0) {
+		if (totvector > 0) {
 			vec= obilb->vectors= MEM_mallocN(2*sizeof(float)*totvector, "vector array");
 
-			if(obi->flag & R_TRANSFORMED)
+			if (obi->flag & R_TRANSFORMED)
 				mult_m4_m4m4(winmat, re->winmat, obi->mat);
 			else
 				copy_m4_m4(winmat, re->winmat);
 
-			for(a=0; a<obr->totvert; a++, vec+=2) {
-				if((a & 255)==0) ver= obr->vertnodes[a>>8].vert;
+			for (a=0; a<obr->totvert; a++, vec+=2) {
+				if ((a & 255)==0) ver= obr->vertnodes[a>>8].vert;
 				else ver++;
 				
 				projectvert(ver->co, winmat, ho);
@@ -5561,8 +5563,8 @@ static void free_dbase_object_vectors(ListBase *lb)
 {
 	ObjectInstanceRen *obi;
 	
-	for(obi= lb->first; obi; obi= obi->next)
-		if(obi->vectors)
+	for (obi= lb->first; obi; obi= obi->next)
+		if (obi->vectors)
 			MEM_freeN(obi->vectors);
 	BLI_freelistN(lb);
 }
@@ -5593,7 +5595,7 @@ void RE_Database_FromScene_Vectors(Render *re, Main *bmain, Scene *sce, unsigned
 	RE_Database_Free(re);
 	re->strandsurface= strandsurface;
 	
-	if(!re->test_break(re->tbh)) {
+	if (!re->test_break(re->tbh)) {
 		/* creates entire dbase */
 		re->i.infostr= "Calculating next frame vectors";
 		
@@ -5608,55 +5610,55 @@ void RE_Database_FromScene_Vectors(Render *re, Main *bmain, Scene *sce, unsigned
 	RE_Database_Free(re);
 	re->strandsurface= strandsurface;
 	
-	if(!re->test_break(re->tbh))
+	if (!re->test_break(re->tbh))
 		RE_Database_FromScene(re, bmain, sce, lay, 1);
 	
-	if(!re->test_break(re->tbh)) {
+	if (!re->test_break(re->tbh)) {
 		int vectorlay= get_vector_renderlayers(re->scene);
 
-		for(step= 0; step<2; step++) {
+		for (step= 0; step<2; step++) {
 			
-			if(step)
+			if (step)
 				table= &newtable;
 			else
 				table= &oldtable;
 			
 			oldobi= table->first;
-			for(obi= re->instancetable.first; obi && oldobi; obi= obi->next) {
+			for (obi= re->instancetable.first; obi && oldobi; obi= obi->next) {
 				int ok= 1;
 				FluidsimModifierData *fluidmd;
 
-				if(!(obi->lay & vectorlay))
+				if (!(obi->lay & vectorlay))
 					continue;
 
 				obi->totvector= obi->obr->totvert;
 
 				/* find matching object in old table */
-				if(oldobi->ob!=obi->ob || oldobi->par!=obi->par || oldobi->index!=obi->index || oldobi->psysindex!=obi->psysindex) {
+				if (oldobi->ob!=obi->ob || oldobi->par!=obi->par || oldobi->index!=obi->index || oldobi->psysindex!=obi->psysindex) {
 					ok= 0;
-					for(oldobi= table->first; oldobi; oldobi= oldobi->next)
-						if(oldobi->ob==obi->ob && oldobi->par==obi->par && oldobi->index==obi->index && oldobi->psysindex==obi->psysindex)
+					for (oldobi= table->first; oldobi; oldobi= oldobi->next)
+						if (oldobi->ob==obi->ob && oldobi->par==obi->par && oldobi->index==obi->index && oldobi->psysindex==obi->psysindex)
 							break;
-					if(oldobi==NULL)
+					if (oldobi==NULL)
 						oldobi= table->first;
 					else
 						ok= 1;
 				}
-				if(ok==0) {
+				if (ok==0) {
 					 printf("speed table: missing object %s\n", obi->ob->id.name+2);
 					continue;
 				}
 
 				// NT check for fluidsim special treatment
 				fluidmd = (FluidsimModifierData *)modifiers_findByType(obi->ob, eModifierType_Fluidsim);
-				if(fluidmd && fluidmd->fss && (fluidmd->fss->type & OB_FLUIDSIM_DOMAIN)) {
+				if (fluidmd && fluidmd->fss && (fluidmd->fss->type & OB_FLUIDSIM_DOMAIN)) {
 					// use preloaded per vertex simulation data , only does calculation for step=1
 					// NOTE/FIXME - velocities and meshes loaded unnecessarily often during the database_fromscene_vectors calls...
 					load_fluidsimspeedvectors(re, obi, oldobi->vectors, step);
 				}
 				else {
 					/* check if both have same amounts of vertices */
-					if(obi->totvector==oldobi->totvector)
+					if (obi->totvector==oldobi->totvector)
 						calculate_speedvectors(re, obi, oldobi->vectors, step);
 					else
 						printf("Warning: object %s has different amount of vertices or strands on other frame\n", obi->ob->id.name+2);
@@ -5670,12 +5672,12 @@ void RE_Database_FromScene_Vectors(Render *re, Main *bmain, Scene *sce, unsigned
 	free_dbase_object_vectors(&oldtable);
 	free_dbase_object_vectors(&newtable);
 
-	for(mesh=re->strandsurface.first; mesh; mesh=mesh->next) {
-		if(mesh->prevco) {
+	for (mesh=re->strandsurface.first; mesh; mesh=mesh->next) {
+		if (mesh->prevco) {
 			MEM_freeN(mesh->prevco);
 			mesh->prevco= NULL;
 		}
-		if(mesh->nextco) {
+		if (mesh->nextco) {
 			MEM_freeN(mesh->nextco);
 			mesh->nextco= NULL;
 		}
@@ -5719,18 +5721,18 @@ void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay,
 	
 	re->flag |= R_BAKING;
 	re->excludeob= actob;
-	if(actob)
+	if (actob)
 		re->flag |= R_BAKE_TRACE;
 
-	if(type==RE_BAKE_NORMALS && re->r.bake_normal_space==R_BAKE_SPACE_TANGENT)
+	if (type==RE_BAKE_NORMALS && re->r.bake_normal_space==R_BAKE_SPACE_TANGENT)
 		re->flag |= R_NEED_TANGENT;
 	
-	if(!actob && ELEM4(type, RE_BAKE_LIGHT, RE_BAKE_NORMALS, RE_BAKE_TEXTURE, RE_BAKE_DISPLACEMENT)) {
+	if (!actob && ELEM4(type, RE_BAKE_LIGHT, RE_BAKE_NORMALS, RE_BAKE_TEXTURE, RE_BAKE_DISPLACEMENT)) {
 		re->r.mode &= ~R_SHADOW;
 		re->r.mode &= ~R_RAYTRACE;
 	}
 	
-	if(!actob && (type==RE_BAKE_SHADOW)) {
+	if (!actob && (type==RE_BAKE_SHADOW)) {
 		re->r.mode |= R_SHADOW;
 	}
 	
@@ -5742,13 +5744,13 @@ void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay,
 	re->lampren.first= re->lampren.last= NULL;
 
 	/* in localview, lamps are using normal layers, objects only local bits */
-	if(re->lay & 0xFF000000)
+	if (re->lay & 0xFF000000)
 		lay &= 0xFF000000;
 	
 	camera= RE_GetCamera(re);
 	
 	/* if no camera, set unit */
-	if(camera) {
+	if (camera) {
 		normalize_m4(camera->obmat);
 		invert_m4_m4(mat, camera->obmat);
 		RE_SetView(re, mat);
@@ -5767,10 +5769,10 @@ void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay,
 	/* done setting dummy values */
 
 	init_render_world(re);	/* do first, because of ambient. also requires re->osa set correct */
-	if(re->r.mode & R_RAYTRACE) {
+	if (re->r.mode & R_RAYTRACE) {
 		init_render_qmcsampler(re);
 		
-		if(re->wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT))
+		if (re->wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT))
 			if (re->wrld.ao_samp_method == WO_AOSAMP_CONSTANT)
 				init_ao_sphere(&re->wrld);
 	}
@@ -5789,27 +5791,27 @@ void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay,
 	set_material_lightgroups(re);
 	
 	/* SHADOW BUFFER */
-	if(type!=RE_BAKE_LIGHT)
-		if(re->r.mode & R_SHADOW)
+	if (type!=RE_BAKE_LIGHT)
+		if (re->r.mode & R_SHADOW)
 			threaded_makeshadowbufs(re);
 
 	/* raytree */
-	if(!re->test_break(re->tbh))
-		if(re->r.mode & R_RAYTRACE)
+	if (!re->test_break(re->tbh))
+		if (re->r.mode & R_RAYTRACE)
 			makeraytree(re);
 	
 	/* point density texture */
-	if(!re->test_break(re->tbh))
+	if (!re->test_break(re->tbh))
 		make_pointdensities(re);
 
 	/* voxel data texture */
-	if(!re->test_break(re->tbh))
+	if (!re->test_break(re->tbh))
 		make_voxeldata(re);
 
 	/* occlusion */
-	if((re->wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) && !re->test_break(re->tbh))
-		if(re->wrld.ao_gather_method == WO_AOGATHER_APPROX)
-			if(re->r.mode & R_SHADOW)
+	if ((re->wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) && !re->test_break(re->tbh))
+		if (re->wrld.ao_gather_method == WO_AOGATHER_APPROX)
+			if (re->r.mode & R_SHADOW)
 				make_occ_tree(re);
 }
 
@@ -5829,19 +5831,19 @@ void RE_make_sticky(Scene *scene, View3D *v3d)
 	int a;
 	Object *camera= NULL;
 
-	if(v3d==NULL) {
+	if (v3d==NULL) {
 		printf("Need a 3d view to make sticky\n");
 		return;
 	}
 
-	if(v3d)				camera= V3D_CAMERA_LOCAL(v3d);
-	if(camera == NULL)	camera= scene->camera;
+	if (v3d)				camera= V3D_CAMERA_LOCAL(v3d);
+	if (camera == NULL)	camera= scene->camera;
 
-	if(camera==NULL) {
+	if (camera==NULL) {
 		printf("Need camera to make sticky\n");
 		return;
 	}
-	if(scene->obedit) {
+	if (scene->obedit) {
 		printf("Unable to make sticky in Edit Mode\n");
 		return;
 	}
@@ -5857,14 +5859,14 @@ void RE_make_sticky(Scene *scene, View3D *v3d)
 	invert_m4_m4(mat, camera->obmat);
 	RE_SetView(re, mat);
 	
-	for(base= FIRSTBASE; base; base= base->next) {
-		if TESTBASELIB(v3d, base) {
-			if(base->object->type==OB_MESH) {
+	for (base= FIRSTBASE; base; base= base->next) {
+		if (TESTBASELIB(v3d, base)) {
+			if (base->object->type==OB_MESH) {
 				ob= base->object;
 				
 				me= ob->data;
 				mvert= me->mvert;
-				if(me->msticky)
+				if (me->msticky)
 					CustomData_free_layer_active(&me->vdata, CD_MSTICKY, me->totvert);
 				me->msticky= CustomData_add_layer(&me->vdata, CD_MSTICKY,
 					CD_CALLOC, NULL, me->totvert);
@@ -5873,7 +5875,7 @@ void RE_make_sticky(Scene *scene, View3D *v3d)
 				mult_m4_m4m4(mat, re->viewmat, ob->obmat);
 				
 				ms= me->msticky;
-				for(a=0; a<me->totvert; a++, ms++, mvert++) {
+				for (a=0; a<me->totvert; a++, ms++, mvert++) {
 					copy_v3_v3(ho, mvert->co);
 					mul_m4_v3(mat, ho);
 					projectverto(ho, re->winmat, ho);
diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c
index a45bb63..fa7b9cb 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)
 	
 	/* after lock we test cube[1], if set the other thread has done it fine */
 	BLI_lock_thread(LOCK_IMAGE);
-	if(env->cube[1]==NULL) {
+	if (env->cube[1]==NULL) {
 
 		BKE_free_envmapdata(env);	
 	
@@ -85,18 +85,20 @@ static void envmap_split_ima(EnvMap *env, ImBuf *ibuf)
 		if (3*dx == ibuf->x) {
 			env->type = ENV_CUBE;
 			env->ok= ENV_OSA;
-		} else if (ibuf->x == ibuf->y) {
+		}
+		else if (ibuf->x == ibuf->y) {
 			env->type = ENV_PLANE;
 			env->ok= ENV_OSA;
-		} else {
+		}
+		else {
 			printf("Incorrect envmap size\n");
 			env->ok= 0;
 			env->ima->ok= 0;
 		}
 		
-		if(env->ok) {
+		if (env->ok) {
 			if (env->type == ENV_CUBE) {
-				for(part=0; part<6; part++) {
+				for (part=0; part<6; part++) {
 					env->cube[part]= IMB_allocImBuf(dx, dx, 24, IB_rect|IB_rectfloat);
 				}
 				IMB_float_from_rect(ibuf);
@@ -214,19 +216,24 @@ static void envmap_transmatrix(float mat[][4], int part)
 	
 	eul[0]= eul[1]= eul[2]= 0.0;
 	
-	if(part==0) {			/* neg z */
+	if (part==0) {			/* neg z */
 		;
-	} else if(part==1) {	/* pos z */
+	}
+	else if (part==1) {	/* pos z */
 		eul[0]= M_PI;
-	} else if(part==2) {	/* pos y */
+	}
+	else if (part==2) {	/* pos y */
 		eul[0]= M_PI/2.0;
-	} else if(part==3) {	/* neg x */
+	}
+	else if (part==3) {	/* neg x */
 		eul[0]= M_PI/2.0;
 		eul[2]= M_PI/2.0;
-	} else if(part==4) {	/* neg y */
+	}
+	else if (part==4) {	/* neg y */
 		eul[0]= M_PI/2.0;
 		eul[2]= M_PI;
-	} else {				/* pos x */
+	}
+	else {				/* pos x */
 		eul[0]= M_PI/2.0;
 		eul[2]= -M_PI/2.0;
 	}
@@ -250,7 +257,7 @@ static void env_rotate_scene(Render *re, float mat[][4], int mode)
 	float imat[3][3], pmat[4][4], smat[4][4], tmat[4][4], cmat[3][3], tmpmat[4][4];
 	int a;
 	
-	if(mode==0) {
+	if (mode==0) {
 		invert_m4_m4(tmat, mat);
 		copy_m3_m4(imat, tmat);
 	}
@@ -259,13 +266,13 @@ static void env_rotate_scene(Render *re, float mat[][4], int mode)
 		copy_m3_m4(imat, mat);
 	}
 
-	for(obi=re->instancetable.first; obi; obi=obi->next) {
+	for (obi=re->instancetable.first; obi; obi=obi->next) {
 		/* append or set matrix depending on dupli */
-		if(obi->flag & R_DUPLI_TRANSFORMED) {
+		if (obi->flag & R_DUPLI_TRANSFORMED) {
 			copy_m4_m4(tmpmat, obi->mat);
 			mult_m4_m4m4(obi->mat, tmat, tmpmat);
 		}
-		else if(mode==1)
+		else if (mode==1)
 			copy_m4_m4(obi->mat, tmat);
 		else
 			unit_m4(obi->mat);
@@ -275,28 +282,28 @@ static void env_rotate_scene(Render *re, float mat[][4], int mode)
 		transpose_m3(obi->nmat);
 
 		/* indicate the renderer has to use transform matrices */
-		if(mode==0)
+		if (mode==0)
 			obi->flag &= ~R_ENV_TRANSFORMED;
 		else
 			obi->flag |= R_ENV_TRANSFORMED;
 	}
 	
 
-	for(obr=re->objecttable.first; obr; obr=obr->next) {
-		for(a=0; a<obr->tothalo; a++) {
-			if((a & 255)==0) har= obr->bloha[a>>8];
+	for (obr=re->objecttable.first; obr; obr=obr->next) {
+		for (a=0; a<obr->tothalo; a++) {
+			if ((a & 255)==0) har= obr->bloha[a>>8];
 			else har++;
 		
 			mul_m4_v3(tmat, har->co);
 		}
 	}
 	
-	for(go=re->lights.first; go; go= go->next) {
+	for (go=re->lights.first; go; go= go->next) {
 		lar= go->lampren;
 		
 		/* removed here some horrible code of someone in NaN who tried to fix
-		   prototypes... just solved by introducing a correct cmat[3][3] instead
-		   of using smat. this works, check square spots in reflections  (ton) */
+		 * prototypes... just solved by introducing a correct cmat[3][3] instead
+		 * of using smat. this works, check square spots in reflections  (ton) */
 		copy_m3_m3(cmat, lar->imat); 
 		mul_m3_m3m3(lar->imat, cmat, imat); 
 
@@ -309,8 +316,8 @@ static void env_rotate_scene(Render *re, float mat[][4], int mode)
 		mul_m3_v3(lar->imat, lar->sh_invcampos);
 		lar->sh_invcampos[2]*= lar->sh_zfac;
 		
-		if(lar->shb) {
-			if(mode==1) {
+		if (lar->shb) {
+			if (mode==1) {
 				invert_m4_m4(pmat, mat);
 				mult_m4_m4m4(smat, lar->shb->viewmat, pmat);
 				mult_m4_m4m4(lar->shb->persmat, lar->shb->winmat, smat);
@@ -330,19 +337,19 @@ static void env_layerflags(Render *re, unsigned int notlay)
 	int a;
 	
 	/* invert notlay, so if face is in multiple layers it will still be visible,
-	   unless all 'notlay' bits match the face bits.
-	   face: 0110
-	   not:  0100
-	   ~not: 1011
-	   now (face & ~not) is true
-	*/
+	 * unless all 'notlay' bits match the face bits.
+	 * face: 0110
+	 * not:  0100
+	 * ~not: 1011
+	 * now (face & ~not) is true
+	 */
 	
 	notlay= ~notlay;
 	
-	for(obr=re->objecttable.first; obr; obr=obr->next) {
-		if((obr->lay & notlay)==0) {
-			for(a=0; a<obr->totvlak; a++) {
-				if((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
+	for (obr=re->objecttable.first; obr; obr=obr->next) {
+		if ((obr->lay & notlay)==0) {
+			for (a=0; a<obr->totvlak; a++) {
+				if ((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
 				else vlr++;
 
 				vlr->flag |= R_HIDDEN;
@@ -357,12 +364,12 @@ static void env_hideobject(Render *re, Object *ob)
 	VlakRen *vlr = NULL;
 	int a;
 	
-	for(obr=re->objecttable.first; obr; obr=obr->next) {
-		for(a=0; a<obr->totvlak; a++) {
-			if((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
+	for (obr=re->objecttable.first; obr; obr=obr->next) {
+		for (a=0; a<obr->totvlak; a++) {
+			if ((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
 			else vlr++;
 
-			if(obr->ob == ob)
+			if (obr->ob == ob)
 				vlr->flag |= R_HIDDEN;
 		}
 	}
@@ -374,9 +381,9 @@ static void env_showobjects(Render *re)
 	VlakRen *vlr = NULL;
 	int a;
 	
-	for(obr=re->objecttable.first; obr; obr=obr->next) {
-		for(a=0; a<obr->totvlak; a++) {
-			if((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
+	for (obr=re->objecttable.first; obr; obr=obr->next) {
+		for (a=0; a<obr->totvlak; a++) {
+			if ((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
 			else vlr++;
 
 			vlr->flag &= ~R_HIDDEN;
@@ -392,7 +399,7 @@ static void env_set_imats(Render *re)
 	float mat[4][4];
 	
 	base= re->scene->base.first;
-	while(base) {
+	while (base) {
 		mult_m4_m4m4(mat, re->viewmat, base->object->obmat);
 		invert_m4_m4(base->object->imat, mat);
 		
@@ -426,8 +433,8 @@ static void render_envmap(Render *re, EnvMap *env)
 	invert_m4_m4(tmat, mat);
 	copy_m3_m4(env->obimat, tmat);
 
-	for(part=0; part<6; part++) {
-		if(env->type==ENV_PLANE && part!=1)
+	for (part=0; part<6; part++) {
+		if (env->type==ENV_PLANE && part!=1)
 			continue;
 		
 		re->display_clear(re->dch, envre->result);
@@ -451,7 +458,7 @@ static void render_envmap(Render *re, EnvMap *env)
 		env_hideobject(envre, env->object);
 		env_set_imats(envre);
 				
-		if(re->test_break(re->tbh)==0) {
+		if (re->test_break(re->tbh)==0) {
 			RE_TileProcessor(envre);
 		}
 		
@@ -459,7 +466,7 @@ static void render_envmap(Render *re, EnvMap *env)
 		env_showobjects(envre);
 		env_rotate_scene(envre, tmat, 0);
 
-		if(re->test_break(re->tbh)==0) {
+		if (re->test_break(re->tbh)==0) {
 			RenderLayer *rl= envre->result->layers.first;
 			int y;
 			float *alpha;
@@ -472,19 +479,19 @@ static void render_envmap(Render *re, EnvMap *env)
 			
 			/* envmap renders without alpha */
 			alpha= ((float *)ibuf->rect_float)+3;
-			for(y= ibuf->x*ibuf->y - 1; y>=0; y--, alpha+=4)
+			for (y= ibuf->x*ibuf->y - 1; y>=0; y--, alpha+=4)
 				*alpha= 1.0;
 			
 			env->cube[part]= ibuf;
 		}
 		
-		if(re->test_break(re->tbh)) break;
+		if (re->test_break(re->tbh)) break;
 
 	}
 	
-	if(re->test_break(re->tbh)) BKE_free_envmapdata(env);
+	if (re->test_break(re->tbh)) BKE_free_envmapdata(env);
 	else {
-		if(envre->r.mode & R_OSA) env->ok= ENV_OSA;
+		if (envre->r.mode & R_OSA) env->ok= ENV_OSA;
 		else env->ok= ENV_NORMAL;
 		env->lastframe= re->scene->r.cfra;
 	}
@@ -504,7 +511,7 @@ void make_envmaps(Render *re)
 	
 	if (!(re->r.mode & R_ENVMAP)) return;
 	
-	/* we dont raytrace, disabling the flag will cause ray_transp render solid */
+	/* we don't raytrace, disabling the flag will cause ray_transp render solid */
 	trace= (re->r.mode & R_RAYTRACE);
 	re->r.mode &= ~R_RAYTRACE;
 
@@ -512,15 +519,15 @@ void make_envmaps(Render *re)
 	re->stats_draw(re->sdh, &re->i);
 	
 	/* 5 = hardcoded max recursion level */
-	while(depth<5) {
+	while (depth<5) {
 		tex= re->main->tex.first;
-		while(tex) {
-			if(tex->id.us && tex->type==TEX_ENVMAP) {
-				if(tex->env && tex->env->object) {
+		while (tex) {
+			if (tex->id.us && tex->type==TEX_ENVMAP) {
+				if (tex->env && tex->env->object) {
 					EnvMap *env= tex->env;
 					
-					if(env->object->lay & re->lay) {
-						if(env->stype==ENV_LOAD) {
+					if (env->object->lay & re->lay) {
+						if (env->stype==ENV_LOAD) {
 							float orthmat[4][4], mat[4][4], tmat[4][4];
 							
 							/* precalc orthmat for object */
@@ -535,29 +542,29 @@ void make_envmaps(Render *re)
 						else {
 							
 							/* decide if to render an envmap (again) */
-							if(env->depth >= depth) {
+							if (env->depth >= depth) {
 								
 								/* set 'recalc' to make sure it does an entire loop of recalcs */
 								
-								if(env->ok) {
+								if (env->ok) {
 										/* free when OSA, and old one isn't OSA */
-									if((re->r.mode & R_OSA) && env->ok==ENV_NORMAL) 
+									if ((re->r.mode & R_OSA) && env->ok==ENV_NORMAL)
 										BKE_free_envmapdata(env);
 										/* free when size larger */
-									else if(env->lastsize < re->r.size) 
+									else if (env->lastsize < re->r.size)
 										BKE_free_envmapdata(env);
 										/* free when env is in recalcmode */
-									else if(env->recalc)
+									else if (env->recalc)
 										BKE_free_envmapdata(env);
 								}
 								
-								if(env->ok==0 && depth==0) env->recalc= 1;
+								if (env->ok==0 && depth==0) env->recalc= 1;
 								
-								if(env->ok==0) {
+								if (env->ok==0) {
 									do_init= 1;
 									render_envmap(re, env);
 									
-									if(depth==env->depth) env->recalc= 0;
+									if (depth==env->depth) env->recalc= 0;
 								}
 							}
 						}
@@ -569,7 +576,7 @@ void make_envmaps(Render *re)
 		depth++;
 	}
 
-	if(do_init) {
+	if (do_init) {
 		re->display_init(re->dih, re->result);
 		re->display_clear(re->dch, re->result);
 		// re->flag |= R_REDRAW_PRV;
@@ -586,7 +593,7 @@ static int envcube_isect(EnvMap *env, float *vec, float *answ)
 	float labda;
 	int face;
 	
-	if(env->type==ENV_PLANE) {
+	if (env->type==ENV_PLANE) {
 		face= 1;
 		
 		labda= 1.0f/vec[2];
@@ -595,7 +602,7 @@ static int envcube_isect(EnvMap *env, float *vec, float *answ)
 	}
 	else {
 		/* which face */
-		if( vec[2] <= -fabsf(vec[0]) && vec[2] <= -fabsf(vec[1]) ) {
+		if ( vec[2] <= -fabsf(vec[0]) && vec[2] <= -fabsf(vec[1]) ) {
 			face= 0;
 			labda= -1.0f/vec[2];
 			answ[0]= labda*vec[0];
@@ -642,13 +649,13 @@ static int envcube_isect(EnvMap *env, float *vec, float *answ)
 
 static void set_dxtdyt(float *dxts, float *dyts, float *dxt, float *dyt, int face)
 {
-	if(face==2 || face==4) {
+	if (face==2 || face==4) {
 		dxts[0]= dxt[0];
 		dyts[0]= dyt[0];
 		dxts[1]= dxt[2];
 		dyts[1]= dyt[2];
 	}
-	else if(face==3 || face==5) {
+	else if (face==3 || face==5) {
 		dxts[0]= dxt[1];
 		dxts[1]= dxt[2];
 		dyts[0]= dyt[1];
@@ -674,17 +681,17 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe
 	int face, face1;
 	
 	env= tex->env;
-	if(env==NULL || (env->stype!=ENV_LOAD && env->object==NULL)) {
+	if (env==NULL || (env->stype!=ENV_LOAD && env->object==NULL)) {
 		texres->tin= 0.0;
 		return 0;
 	}
 	
-	if(env->stype==ENV_LOAD) {
+	if (env->stype==ENV_LOAD) {
 		env->ima= tex->ima;
-		if(env->ima && env->ima->ok) {
-			if(env->cube[1]==NULL) {
+		if (env->ima && env->ima->ok) {
+			if (env->cube[1]==NULL) {
 				ImBuf *ibuf_ima= BKE_image_get_ibuf(env->ima, NULL);
-				if(ibuf_ima)
+				if (ibuf_ima)
 					envmap_split_ima(env, ibuf_ima);
 				else
 					env->ok= 0;
@@ -692,21 +699,21 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe
 		}
 	}
 
-	if(env->ok==0) {
+	if (env->ok==0) {
 		texres->tin= 0.0;
 		return 0;
 	}
 	
 	/* rotate to envmap space, if object is set */
 	copy_v3_v3(vec, texvec);
-	if(env->object) mul_m3_v3(env->obimat, vec);
+	if (env->object) mul_m3_v3(env->obimat, vec);
 	else mul_mat3_m4_v3(R.viewinv, vec);
 	
 	face= envcube_isect(env, vec, sco);
 	ibuf= env->cube[face];
 	
-	if(osatex) {
-		if(env->object) {
+	if (osatex) {
+		if (env->object) {
 			mul_m3_v3(env->obimat, dxt);
 			mul_m3_v3(env->obimat, dyt);
 		}
@@ -719,7 +726,7 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe
 		
 		/* edges? */
 		
-		if(texres->ta<1.0f) {
+		if (texres->ta<1.0f) {
 			TexResult texr1, texr2;
 	
 			texr1.nor= texr2.nor= NULL;
@@ -729,7 +736,7 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe
 			face1= envcube_isect(env, vec, sco);
 			sub_v3_v3(vec, dxt);
 			
-			if(face!=face1) {
+			if (face!=face1) {
 				ibuf= env->cube[face1];
 				set_dxtdyt(dxts, dyts, dxt, dyt, face1);
 				imagewraposa(tex, NULL, ibuf, sco, dxts, dyts, &texr1);
@@ -742,7 +749,7 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe
 			face1= envcube_isect(env, vec, sco);
 			sub_v3_v3(vec, dyt);
 			
-			if(face!=face1) {
+			if (face!=face1) {
 				ibuf= env->cube[face1];
 				set_dxtdyt(dxts, dyts, dxt, dyt, face1);
 				imagewraposa(tex, NULL, ibuf, sco, dxts, dyts, &texr2);
@@ -750,7 +757,7 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe
 			else texr2.tr= texr2.tg= texr2.tb= texr2.ta= 0.0;
 			
 			fac= (texres->ta+texr1.ta+texr2.ta);
-			if(fac!=0.0f) {
+			if (fac!=0.0f) {
 				fac= 1.0f/fac;
 
 				texres->tr= fac*(texres->ta*texres->tr + texr1.ta*texr1.tr + texr2.ta*texr2.tr );
diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c
index 703ca23..d8888cb 100644
--- a/source/blender/render/intern/source/external_engine.c
+++ b/source/blender/render/intern/source/external_engine.c
@@ -36,10 +36,13 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "BLF_translation.h"
+
 #include "BLI_listbase.h"
 #include "BLI_string.h"
 #include "BLI_utildefines.h"
 
+#include "BKE_global.h"
 #include "BKE_report.h"
 #include "BKE_scene.h"
 
@@ -60,7 +63,7 @@
 
 static RenderEngineType internal_render_type = {
 	NULL, NULL,
-	"BLENDER_RENDER", "Blender Render", RE_INTERNAL,
+	"BLENDER_RENDER", N_("Blender Render"), RE_INTERNAL,
 	NULL, NULL, NULL, NULL,
 	{NULL, NULL, NULL}};
 
@@ -68,7 +71,7 @@ static RenderEngineType internal_render_type = {
 
 static RenderEngineType internal_game_type = {
 	NULL, NULL,
-	"BLENDER_GAME", "Blender Game", RE_INTERNAL|RE_GAME,
+	"BLENDER_GAME", N_("Blender Game"), RE_INTERNAL|RE_GAME,
 	NULL, NULL, NULL, NULL,
 	{NULL, NULL, NULL}};
 
@@ -88,13 +91,13 @@ void RE_engines_exit(void)
 {
 	RenderEngineType *type, *next;
 
-	for(type=R_engines.first; type; type=next) {
+	for (type=R_engines.first; type; type=next) {
 		next= type->next;
 
 		BLI_remlink(&R_engines, type);
 
-		if(!(type->flag & RE_INTERNAL)) {
-			if(type->ext.free)
+		if (!(type->flag & RE_INTERNAL)) {
+			if (type->ext.free)
 				type->ext.free(type->ext.data);
 
 			MEM_freeN(type);
@@ -107,7 +110,7 @@ RenderEngineType *RE_engines_find(const char *idname)
 	RenderEngineType *type;
 	
 	type= BLI_findstring(&R_engines, idname, offsetof(RenderEngineType, idname));
-	if(!type)
+	if (!type)
 		type= &internal_render_type;
 
 	return type;
@@ -132,12 +135,12 @@ RenderEngine *RE_engine_create(RenderEngineType *type)
 void RE_engine_free(RenderEngine *engine)
 {
 #ifdef WITH_PYTHON
-	if(engine->py_instance) {
+	if (engine->py_instance) {
 		BPY_DECREF(engine->py_instance);
 	}
 #endif
 
-	if(engine->text)
+	if (engine->text)
 		MEM_freeN(engine->text);
 
 	MEM_freeN(engine);
@@ -157,16 +160,16 @@ RenderResult *RE_engine_begin_result(RenderEngine *engine, int x, int y, int w,
 	CLAMP(w, 0, re->result->rectx);
 	CLAMP(h, 0, re->result->recty);
 
-	if(x + w > re->result->rectx)
+	if (x + w > re->result->rectx)
 		w= re->result->rectx - x;
-	if(y + h > re->result->recty)
+	if (y + h > re->result->recty)
 		h= re->result->recty - y;
 
 	/* allocate a render result */
-	disprect.xmin= x;
-	disprect.xmax= x+w;
-	disprect.ymin= y;
-	disprect.ymax= y+h;
+	disprect.xmin = x;
+	disprect.xmax = x+w;
+	disprect.ymin = y;
+	disprect.ymax = y+h;
 
 	result= render_result_new(re, &disprect, 0, RR_USE_MEM);
 	BLI_addtail(&engine->fullresult, result);
@@ -183,7 +186,7 @@ void RE_engine_update_result(RenderEngine *engine, RenderResult *result)
 {
 	Render *re= engine->re;
 
-	if(result) {
+	if (result) {
 		result->renlay= result->layers.first; // weak, draws first layer always
 		re->display_draw(re->ddh, result, NULL);
 	}
@@ -193,15 +196,15 @@ void RE_engine_end_result(RenderEngine *engine, RenderResult *result)
 {
 	Render *re= engine->re;
 
-	if(!result)
+	if (!result)
 		return;
 
 	/* merge. on break, don't merge in result for preview renders, looks nicer */
-	if(!(re->test_break(re->tbh) && (re->r.scemode & R_PREVIEWBUTS)))
+	if (!(re->test_break(re->tbh) && (re->r.scemode & R_PREVIEWBUTS)))
 		render_result_merge(re->result, result);
 
 	/* draw */
-	if(!re->test_break(re->tbh)) {
+	if (!re->test_break(re->tbh)) {
 		result->renlay= result->layers.first; // weak, draws first layer always
 		re->display_draw(re->ddh, result, NULL);
 	}
@@ -216,7 +219,7 @@ int RE_engine_test_break(RenderEngine *engine)
 {
 	Render *re= engine->re;
 
-	if(re)
+	if (re)
 		return re->test_break(re->tbh);
 	
 	return 0;
@@ -229,7 +232,7 @@ void RE_engine_update_stats(RenderEngine *engine, const char *stats, const char
 	Render *re= engine->re;
 
 	/* stats draw callback */
-	if(re) {
+	if (re) {
 		re->i.statstr= stats;
 		re->i.infostr= info;
 		re->stats_draw(re->sdh, &re->i);
@@ -238,16 +241,16 @@ void RE_engine_update_stats(RenderEngine *engine, const char *stats, const char
 	}
 
 	/* set engine text */
-	if(engine->text) {
+	if (engine->text) {
 		MEM_freeN(engine->text);
 		engine->text= NULL;
 	}
 
-	if(stats && stats[0] && info && info[0])
+	if (stats && stats[0] && info && info[0])
 		engine->text= BLI_sprintfN("%s | %s", stats, info);
-	else if(info && info[0])
+	else if (info && info[0])
 		engine->text= BLI_strdup(info);
-	else if(stats && stats[0])
+	else if (stats && stats[0])
 		engine->text= BLI_strdup(stats);
 }
 
@@ -255,7 +258,7 @@ void RE_engine_update_progress(RenderEngine *engine, float progress)
 {
 	Render *re= engine->re;
 
-	if(re) {
+	if (re) {
 		CLAMP(progress, 0.0f, 1.0f);
 		re->progress(re->prh, progress);
 	}
@@ -274,25 +277,25 @@ int RE_engine_render(Render *re, int do_all)
 	RenderEngine *engine;
 
 	/* verify if we can render */
-	if(!type->render)
+	if (!type->render)
 		return 0;
-	if((re->r.scemode & R_PREVIEWBUTS) && !(type->flag & RE_USE_PREVIEW))
+	if ((re->r.scemode & R_PREVIEWBUTS) && !(type->flag & RE_USE_PREVIEW))
 		return 0;
-	if(do_all && !(type->flag & RE_USE_POSTPROCESS))
+	if (do_all && !(type->flag & RE_USE_POSTPROCESS))
 		return 0;
-	if(!do_all && (type->flag & RE_USE_POSTPROCESS))
+	if (!do_all && (type->flag & RE_USE_POSTPROCESS))
 		return 0;
 
 	/* create render result */
 	BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
-	if(re->result==NULL || !(re->r.scemode & R_PREVIEWBUTS)) {
-		if(re->result)
+	if (re->result==NULL || !(re->r.scemode & R_PREVIEWBUTS)) {
+		if (re->result)
 			render_result_free(re->result);
 		re->result= render_result_new(re, &re->disprect, 0, 0);
 	}
 	BLI_rw_mutex_unlock(&re->resultmutex);
 	
-	if(re->result==NULL)
+	if (re->result==NULL)
 		return 1;
 
 	/* set render info */
@@ -304,23 +307,27 @@ int RE_engine_render(Render *re, int do_all)
 	engine = RE_engine_create(type);
 	engine->re= re;
 
-	if(re->flag & R_ANIMATION)
+	if (re->flag & R_ANIMATION)
 		engine->flag |= RE_ENGINE_ANIMATION;
-	if(re->r.scemode & R_PREVIEWBUTS)
+	if (re->r.scemode & R_PREVIEWBUTS)
 		engine->flag |= RE_ENGINE_PREVIEW;
+	engine->camera_override = re->camera_override;
 
-	if((re->r.scemode & (R_NO_FRAME_UPDATE|R_PREVIEWBUTS))==0)
+	if ((re->r.scemode & (R_NO_FRAME_UPDATE|R_PREVIEWBUTS))==0)
 		scene_update_for_newframe(re->main, re->scene, re->lay);
 
-	if(type->update)
+	if (type->update)
 		type->update(engine, re->main, re->scene);
-	if(type->render)
+	if (type->render)
 		type->render(engine, re->scene);
 
 	render_result_free_list(&engine->fullresult, engine->fullresult.first);
 
 	RE_engine_free(engine);
 
+	if (BKE_reports_contain(re->reports, RPT_ERROR))
+		G.afbreek = 1;
+	
 	return 1;
 }
 
diff --git a/source/blender/render/intern/source/gammaCorrectionTables.c b/source/blender/render/intern/source/gammaCorrectionTables.c
index 68c4903..c0e6932 100644
--- a/source/blender/render/intern/source/gammaCorrectionTables.c
+++ b/source/blender/render/intern/source/gammaCorrectionTables.c
@@ -131,9 +131,9 @@ void makeGammaTables(float gamma)
 	/* multiplication factors used in scaling the interpolation.             */
 	for (i = 0; i < RE_GAMMA_TABLE_SIZE; i++ ) {
 		gamfactor_table[i] = inv_color_step
-			* (gamma_range_table[i + 1] - gamma_range_table[i]) ;
+			* (gamma_range_table[i + 1] - gamma_range_table[i]);
 		inv_gamfactor_table[i] = inv_color_step
-			* (inv_gamma_range_table[i + 1] - inv_gamma_range_table[i]) ;
+			* (inv_gamma_range_table[i + 1] - inv_gamma_range_table[i]);
 	}
 
 } /* end of void makeGammaTables(float gamma) */
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index 2d64828..260a2de 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -85,12 +85,12 @@ static void ibuf_get_color(float *col, struct ImBuf *ibuf, int x, int y)
 {
 	int ofs = y * ibuf->x + x;
 	
-	if(ibuf->rect_float) {
-		if(ibuf->channels==4) {
+	if (ibuf->rect_float) {
+		if (ibuf->channels==4) {
 			float *fp= ibuf->rect_float + 4*ofs;
 			copy_v4_v4(col, fp);
 		}
-		else if(ibuf->channels==3) {
+		else if (ibuf->channels==3) {
 			float *fp= ibuf->rect_float + 3*ofs;
 			copy_v3_v3(col, fp);
 			col[3]= 1.0f;
@@ -122,23 +122,23 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
 	retval= texres->nor?3:1;
 	
 	/* quick tests */
-	if(ibuf==NULL && ima==NULL)
+	if (ibuf==NULL && ima==NULL)
 		return retval;
-	if(ima) {
+	if (ima) {
 		
 		/* hack for icon render */
-		if(ima->ibufs.first==NULL && (R.r.scemode & R_NO_IMAGE_LOAD))
+		if (ima->ibufs.first==NULL && (R.r.scemode & R_NO_IMAGE_LOAD))
 			return retval;
 		
 		ibuf= BKE_image_get_ibuf(ima, &tex->iuser);
 
 		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))
 		return retval;
 	
 	/* setup mapping */
-	if(tex->imaflag & TEX_IMAROT) {
+	if (tex->imaflag & TEX_IMAROT) {
 		fy= texvec[0];
 		fx= texvec[1];
 	}
@@ -147,7 +147,7 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
 		fy= texvec[1];
 	}
 	
-	if(tex->extend == TEX_CHECKER) {
+	if (tex->extend == TEX_CHECKER) {
 		int xs, ys;
 		
 		xs= (int)floor(fx);
@@ -155,14 +155,14 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
 		fx-= xs;
 		fy-= ys;
 
-		if( (tex->flag & TEX_CHECKER_ODD)==0) {
-			if((xs+ys) & 1);else return retval;
+		if ( (tex->flag & TEX_CHECKER_ODD)==0) {
+			if ((xs+ys) & 1);else return retval;
 		}
-		if( (tex->flag & TEX_CHECKER_EVEN)==0) {
-			if((xs+ys) & 1) return retval; 
+		if ( (tex->flag & TEX_CHECKER_EVEN)==0) {
+			if ((xs+ys) & 1) return retval;
 		}
 		/* scale around center, (0.5, 0.5) */
-		if(tex->checkerdist<1.0f) {
+		if (tex->checkerdist<1.0f) {
 			fx= (fx-0.5f)/(1.0f-tex->checkerdist) +0.5f;
 			fy= (fy-0.5f)/(1.0f-tex->checkerdist) +0.5f;
 		}
@@ -171,37 +171,37 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
 	x= xi= (int)floorf(fx*ibuf->x);
 	y= yi= (int)floorf(fy*ibuf->y);
 
-	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 (tex->extend == TEX_CLIPCUBE) {
+		if (x<0 || y<0 || x>=ibuf->x || y>=ibuf->y || texvec[2]<-1.0f || texvec[2]>1.0f) {
 			return retval;
 		}
 	}
-	else if( tex->extend==TEX_CLIP || tex->extend==TEX_CHECKER) {
-		if(x<0 || y<0 || x>=ibuf->x || y>=ibuf->y) {
+	else if ( tex->extend==TEX_CLIP || tex->extend==TEX_CHECKER) {
+		if (x<0 || y<0 || x>=ibuf->x || y>=ibuf->y) {
 			return retval;
 		}
 	}
 	else {
-		if(tex->extend==TEX_EXTEND) {
-			if(x>=ibuf->x) x = ibuf->x-1;
-			else if(x<0) x= 0;
+		if (tex->extend==TEX_EXTEND) {
+			if (x>=ibuf->x) x = ibuf->x-1;
+			else if (x<0) x= 0;
 		}
 		else {
 			x= x % ibuf->x;
-			if(x<0) x+= ibuf->x;
+			if (x<0) x+= ibuf->x;
 		}
-		if(tex->extend==TEX_EXTEND) {
-			if(y>=ibuf->y) y = ibuf->y-1;
-			else if(y<0) y= 0;
+		if (tex->extend==TEX_EXTEND) {
+			if (y>=ibuf->y) y = ibuf->y-1;
+			else if (y<0) y= 0;
 		}
 		else {
 			y= y % ibuf->y;
-			if(y<0) y+= ibuf->y;
+			if (y<0) y+= ibuf->y;
 		}
 	}
 	
 	/* warning, no return before setting back! */
-	if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) {
+	if ( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) {
 		ibuf->rect+= (ibuf->x*ibuf->y);
 	}
 
@@ -230,12 +230,12 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
 		ibuf_get_color(&texres->tr, ibuf, x, y);
 	}
 	
-	if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) {
+	if ( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) {
 		ibuf->rect-= (ibuf->x*ibuf->y);
 	}
 
-	if(texres->nor) {
-		if(tex->imaflag & TEX_NORMALMAP) {
+	if (texres->nor) {
+		if (tex->imaflag & TEX_NORMALMAP) {
 			// qdn: normal from color
 			// The invert of the red channel is to make
 			// the normal map compliant with the outside world.
@@ -251,14 +251,14 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
 			/* bump: take three samples */
 			val1= texres->tr+texres->tg+texres->tb;
 
-			if(x<ibuf->x-1) {
+			if (x<ibuf->x-1) {
 				float col[4];
 				ibuf_get_color(col, ibuf, x+1, y);
 				val2= (col[0]+col[1]+col[2]);
 			}
 			else val2= val1;
 
-			if(y<ibuf->y-1) {
+			if (y<ibuf->y-1) {
 				float col[4];
 				ibuf_get_color(col, ibuf, x, y+1);
 				val3= (col[0]+col[1]+col[2]);
@@ -271,16 +271,16 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul
 		}
 	}
 
-	if(texres->talpha) texres->tin= texres->ta;
-	else if(tex->imaflag & TEX_CALCALPHA) {
+	if (texres->talpha) texres->tin= texres->ta;
+	else if (tex->imaflag & TEX_CALCALPHA) {
 		texres->ta= texres->tin= MAX3(texres->tr, texres->tg, texres->tb);
 	}
 	else texres->ta= texres->tin= 1.0;
 	
-	if(tex->flag & TEX_NEGALPHA) texres->ta= 1.0f-texres->ta;
+	if (tex->flag & TEX_NEGALPHA) texres->ta= 1.0f-texres->ta;
 
 	/* de-premul, this is being premulled in shade_input_do_shade() */
-	if(texres->ta!=1.0f && texres->ta>1e-4f) {
+	if (texres->ta!=1.0f && texres->ta>1e-4f) {
 		fx= 1.0f/texres->ta;
 		texres->tr*= fx;
 		texres->tg*= fx;
@@ -299,45 +299,45 @@ static void clipx_rctf_swap(rctf *stack, short *count, float x1, float x2)
 
 	a= *count;
 	rf= stack;
-	for(;a>0;a--) {
-		if(rf->xmin<x1) {
-			if(rf->xmax<x1) {
+	for (;a>0;a--) {
+		if (rf->xmin<x1) {
+			if (rf->xmax<x1) {
 				rf->xmin+= (x2-x1);
 				rf->xmax+= (x2-x1);
 			}
 			else {
-				if(rf->xmax>x2) rf->xmax= x2;
+				if (rf->xmax>x2) rf->xmax = x2;
 				newrct= stack+ *count;
 				(*count)++;
 
-				newrct->xmax= x2;
-				newrct->xmin= rf->xmin+(x2-x1);
-				newrct->ymin= rf->ymin;
-				newrct->ymax= rf->ymax;
+				newrct->xmax = x2;
+				newrct->xmin = rf->xmin+(x2-x1);
+				newrct->ymin = rf->ymin;
+				newrct->ymax = rf->ymax;
 				
-				if(newrct->xmin==newrct->xmax) (*count)--;
+				if (newrct->xmin ==newrct->xmax) (*count)--;
 				
-				rf->xmin= x1;
+				rf->xmin = x1;
 			}
 		}
-		else if(rf->xmax>x2) {
-			if(rf->xmin>x2) {
+		else if (rf->xmax>x2) {
+			if (rf->xmin>x2) {
 				rf->xmin-= (x2-x1);
 				rf->xmax-= (x2-x1);
 			}
 			else {
-				if(rf->xmin<x1) rf->xmin= x1;
+				if (rf->xmin<x1) rf->xmin = x1;
 				newrct= stack+ *count;
 				(*count)++;
 
-				newrct->xmin= x1;
-				newrct->xmax= rf->xmax-(x2-x1);
-				newrct->ymin= rf->ymin;
-				newrct->ymax= rf->ymax;
+				newrct->xmin = x1;
+				newrct->xmax = rf->xmax-(x2-x1);
+				newrct->ymin = rf->ymin;
+				newrct->ymax = rf->ymax;
 
-				if(newrct->xmin==newrct->xmax) (*count)--;
+				if (newrct->xmin ==newrct->xmax) (*count)--;
 
-				rf->xmax= x2;
+				rf->xmax = x2;
 			}
 		}
 		rf++;
@@ -352,45 +352,45 @@ static void clipy_rctf_swap(rctf *stack, short *count, float y1, float y2)
 
 	a= *count;
 	rf= stack;
-	for(;a>0;a--) {
-		if(rf->ymin<y1) {
-			if(rf->ymax<y1) {
+	for (;a>0;a--) {
+		if (rf->ymin<y1) {
+			if (rf->ymax<y1) {
 				rf->ymin+= (y2-y1);
 				rf->ymax+= (y2-y1);
 			}
 			else {
-				if(rf->ymax>y2) rf->ymax= y2;
+				if (rf->ymax>y2) rf->ymax = y2;
 				newrct= stack+ *count;
 				(*count)++;
 
-				newrct->ymax= y2;
-				newrct->ymin= rf->ymin+(y2-y1);
-				newrct->xmin= rf->xmin;
-				newrct->xmax= rf->xmax;
+				newrct->ymax = y2;
+				newrct->ymin = rf->ymin+(y2-y1);
+				newrct->xmin = rf->xmin;
+				newrct->xmax = rf->xmax;
 
-				if(newrct->ymin==newrct->ymax) (*count)--;
+				if (newrct->ymin==newrct->ymax) (*count)--;
 
-				rf->ymin= y1;
+				rf->ymin = y1;
 			}
 		}
-		else if(rf->ymax>y2) {
-			if(rf->ymin>y2) {
+		else if (rf->ymax>y2) {
+			if (rf->ymin>y2) {
 				rf->ymin-= (y2-y1);
 				rf->ymax-= (y2-y1);
 			}
 			else {
-				if(rf->ymin<y1) rf->ymin= y1;
+				if (rf->ymin<y1) rf->ymin = y1;
 				newrct= stack+ *count;
 				(*count)++;
 
-				newrct->ymin= y1;
-				newrct->ymax= rf->ymax-(y2-y1);
-				newrct->xmin= rf->xmin;
-				newrct->xmax= rf->xmax;
+				newrct->ymin = y1;
+				newrct->ymax = rf->ymax-(y2-y1);
+				newrct->xmin = rf->xmin;
+				newrct->xmax = rf->xmax;
 
-				if(newrct->ymin==newrct->ymax) (*count)--;
+				if (newrct->ymin==newrct->ymax) (*count)--;
 
-				rf->ymax= y2;
+				rf->ymax = y2;
 			}
 		}
 		rf++;
@@ -412,17 +412,17 @@ static float clipx_rctf(rctf *rf, float x1, float x2)
 
 	size= rf->xmax - rf->xmin;
 
-	if(rf->xmin<x1) {
-		rf->xmin= x1;
+	if (rf->xmin<x1) {
+		rf->xmin = x1;
 	}
-	if(rf->xmax>x2) {
-		rf->xmax= x2;
+	if (rf->xmax>x2) {
+		rf->xmax = x2;
 	}
-	if(rf->xmin > rf->xmax) {
+	if (rf->xmin > rf->xmax) {
 		rf->xmin = rf->xmax;
 		return 0.0;
 	}
-	else if(size!=0.0f) {
+	else if (size!=0.0f) {
 		return (rf->xmax - rf->xmin)/size;
 	}
 	return 1.0;
@@ -434,18 +434,18 @@ static float clipy_rctf(rctf *rf, float y1, float y2)
 
 	size= rf->ymax - rf->ymin;
 
-	if(rf->ymin<y1) {
-		rf->ymin= y1;
+	if (rf->ymin<y1) {
+		rf->ymin = y1;
 	}
-	if(rf->ymax>y2) {
-		rf->ymax= y2;
+	if (rf->ymax>y2) {
+		rf->ymax = y2;
 	}
 
-	if(rf->ymin > rf->ymax) {
+	if (rf->ymin > rf->ymax) {
 		rf->ymin = rf->ymax;
 		return 0.0;
 	}
-	else if(size!=0.0f) {
+	else if (size!=0.0f) {
 		return (rf->ymax - rf->ymin)/size;
 	}
 	return 1.0;
@@ -455,7 +455,7 @@ static float clipy_rctf(rctf *rf, float y1, float y2)
 static void boxsampleclip(struct ImBuf *ibuf, rctf *rf, TexResult *texres)
 {
 	/* sample box, is clipped already, and minx etc. have been set at ibuf size.
-	   Enlarge with antialiased edges of the pixels */
+	 * Enlarge with antialiased edges of the pixels */
 
 	float muly, mulx, div, col[4];
 	int x, y, startx, endx, starty, endy;
@@ -465,27 +465,27 @@ static void boxsampleclip(struct ImBuf *ibuf, rctf *rf, TexResult *texres)
 	starty= (int)floor(rf->ymin);
 	endy= (int)floor(rf->ymax);
 
-	if(startx < 0) startx= 0;
-	if(starty < 0) starty= 0;
-	if(endx>=ibuf->x) endx= ibuf->x-1;
-	if(endy>=ibuf->y) endy= ibuf->y-1;
+	if (startx < 0) startx= 0;
+	if (starty < 0) starty= 0;
+	if (endx>=ibuf->x) endx= ibuf->x-1;
+	if (endy>=ibuf->y) endy= ibuf->y-1;
 
-	if(starty==endy && startx==endx) {
+	if (starty==endy && startx==endx) {
 		ibuf_get_color(&texres->tr, ibuf, startx, starty);
 	}
 	else {
 		div= texres->tr= texres->tg= texres->tb= texres->ta= 0.0;
-		for(y=starty; y<=endy; y++) {
+		for (y=starty; y<=endy; y++) {
 			
 			muly= 1.0;
 
-			if(starty==endy);
+			if (starty==endy);
 			else {
-				if(y==starty) muly= 1.0f-(rf->ymin - y);
-				if(y==endy) muly= (rf->ymax - y);
+				if (y==starty) muly= 1.0f-(rf->ymin - y);
+				if (y==endy) muly= (rf->ymax - y);
 			}
 			
-			if(startx==endx) {
+			if (startx==endx) {
 				mulx= muly;
 				
 				ibuf_get_color(col, ibuf, startx, y);
@@ -497,14 +497,14 @@ static void boxsampleclip(struct ImBuf *ibuf, rctf *rf, TexResult *texres)
 				div+= mulx;
 			}
 			else {
-				for(x=startx; x<=endx; x++) {
+				for (x=startx; x<=endx; x++) {
 					mulx= muly;
-					if(x==startx) mulx*= 1.0f-(rf->xmin - x);
-					if(x==endx) mulx*= (rf->xmax - x);
+					if (x==startx) mulx*= 1.0f-(rf->xmin - x);
+					if (x==endx) mulx*= (rf->xmax - x);
 
 					ibuf_get_color(col, ibuf, x, y);
 					
-					if(mulx==1.0f) {
+					if (mulx==1.0f) {
 						texres->ta+= col[3];
 						texres->tr+= col[0];
 						texres->tg+= col[1];
@@ -522,7 +522,7 @@ static void boxsampleclip(struct ImBuf *ibuf, rctf *rf, TexResult *texres)
 			}
 		}
 
-		if(div!=0.0f) {
+		if (div!=0.0f) {
 			div= 1.0f/div;
 			texres->tb*= div;
 			texres->tg*= div;
@@ -542,7 +542,7 @@ static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float max
 	 * If variable 'imaprepeat' has been set, the
 	 * clipped-away parts are sampled as well.
 	 */
-	/* note: actually minx etc isnt in the proper range... this due to filter size and offset vectors for bump */
+	/* note: actually minx etc isn't in the proper range... this due to filter size and offset vectors for bump */
 	/* note: talpha must be initialized */
 	/* note: even when 'imaprepeat' is set, this can only repeate once in any direction.
 	 * the point which min/max is derived from is assumed to be wrapped */
@@ -552,46 +552,46 @@ static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float max
 	short count=1;
 
 	rf= stack;
-	rf->xmin= minx*(ibuf->x);
-	rf->xmax= maxx*(ibuf->x);
-	rf->ymin= miny*(ibuf->y);
-	rf->ymax= maxy*(ibuf->y);
+	rf->xmin = minx*(ibuf->x);
+	rf->xmax = maxx*(ibuf->x);
+	rf->ymin = miny*(ibuf->y);
+	rf->ymax = maxy*(ibuf->y);
 
 	texr.talpha= texres->talpha;	/* is read by boxsample_clip */
 	
-	if(imapextend) {
+	if (imapextend) {
 		CLAMP(rf->xmin, 0.0f, ibuf->x-1);
 		CLAMP(rf->xmax, 0.0f, ibuf->x-1);
 	}
-	else if(imaprepeat) 
+	else if (imaprepeat)
 		clipx_rctf_swap(stack, &count, 0.0, (float)(ibuf->x));
 	else {
 		alphaclip= clipx_rctf(rf, 0.0, (float)(ibuf->x));
 
-		if(alphaclip<=0.0f) {
+		if (alphaclip<=0.0f) {
 			texres->tr= texres->tb= texres->tg= texres->ta= 0.0;
 			return;
 		}
 	}
 
-	if(imapextend) {
+	if (imapextend) {
 		CLAMP(rf->ymin, 0.0f, ibuf->y-1);
 		CLAMP(rf->ymax, 0.0f, ibuf->y-1);
 	}
-	else if(imaprepeat) 
+	else if (imaprepeat)
 		clipy_rctf_swap(stack, &count, 0.0, (float)(ibuf->y));
 	else {
 		alphaclip*= clipy_rctf(rf, 0.0, (float)(ibuf->y));
 
-		if(alphaclip<=0.0f) {
+		if (alphaclip<=0.0f) {
 			texres->tr= texres->tb= texres->tg= texres->ta= 0.0;
 			return;
 		}
 	}
 
-	if(count>1) {
+	if (count>1) {
 		tot= texres->tr= texres->tb= texres->tg= texres->ta= 0.0;
-		while(count--) {
+		while (count--) {
 			boxsampleclip(ibuf, rf, &texr);
 			
 			opp= square_rctf(rf);
@@ -600,22 +600,22 @@ static void boxsample(ImBuf *ibuf, float minx, float miny, float maxx, float max
 			texres->tr+= opp*texr.tr;
 			texres->tg+= opp*texr.tg;
 			texres->tb+= opp*texr.tb;
-			if(texres->talpha) texres->ta+= opp*texr.ta;
+			if (texres->talpha) texres->ta+= opp*texr.ta;
 			rf++;
 		}
-		if(tot!= 0.0f) {
+		if (tot!= 0.0f) {
 			texres->tr/= tot;
 			texres->tg/= tot;
 			texres->tb/= tot;
-			if(texres->talpha) texres->ta/= tot;
+			if (texres->talpha) texres->ta/= tot;
 		}
 	}
 	else
 		boxsampleclip(ibuf, rf, texres);
 
-	if(texres->talpha==0) texres->ta= 1.0;
+	if (texres->talpha==0) texres->ta= 1.0;
 	
-	if(alphaclip!=1.0f) {
+	if (alphaclip!=1.0f) {
 		/* premul it all */
 		texres->tr*= alphaclip;
 		texres->tg*= alphaclip;
@@ -978,17 +978,17 @@ static void alpha_clip_aniso(ImBuf *ibuf, float minx, float miny, float maxx, fl
 	// TXF apha: we're doing the same alphaclip here as boxsample, but i'm doubting
 	// if this is actually correct for the all the filtering algorithms ..
 
-	if(!(extflag == TXC_REPT || extflag == TXC_EXTD)) {
-		rf.xmin= minx*(ibuf->x);
-		rf.xmax= maxx*(ibuf->x);
-		rf.ymin= miny*(ibuf->y);
-		rf.ymax= maxy*(ibuf->y);
+	if (!(extflag == TXC_REPT || extflag == TXC_EXTD)) {
+		rf.xmin = minx*(ibuf->x);
+		rf.xmax = maxx*(ibuf->x);
+		rf.ymin = miny*(ibuf->y);
+		rf.ymax = maxy*(ibuf->y);
 
 		alphaclip = clipx_rctf(&rf, 0.0, (float)(ibuf->x));
 		alphaclip*= clipy_rctf(&rf, 0.0, (float)(ibuf->y));
 		alphaclip= MAX2(alphaclip, 0.0f);
 
-		if(alphaclip!=1.0f) {
+		if (alphaclip!=1.0f) {
 			/* premul it all */
 			texres->tr*= alphaclip;
 			texres->tg*= alphaclip;
@@ -1213,9 +1213,9 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex
 	// brecht: added stupid clamping here, large dx/dy can give very large
 	// filter sizes which take ages to render, it may be better to do this
 	// more intelligently later in the code .. probably it's not noticeable
-	if(AFD.dxt[0]*AFD.dxt[0] + AFD.dxt[1]*AFD.dxt[1] > 2.0f*2.0f)
+	if (AFD.dxt[0]*AFD.dxt[0] + AFD.dxt[1]*AFD.dxt[1] > 2.0f*2.0f)
 		mul_v2_fl(AFD.dxt, 2.0f/len_v2(AFD.dxt));
-	if(AFD.dyt[0]*AFD.dyt[0] + AFD.dyt[1]*AFD.dyt[1] > 2.0f*2.0f)
+	if (AFD.dyt[0]*AFD.dyt[0] + AFD.dyt[1]*AFD.dyt[1] > 2.0f*2.0f)
 		mul_v2_fl(AFD.dyt, 2.0f/len_v2(AFD.dyt));
 
 	// choice:
@@ -1434,32 +1434,32 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
 	retval= texres->nor?3:1;
 	
 	/* quick tests */
-	if(ibuf==NULL && ima==NULL)
+	if (ibuf==NULL && ima==NULL)
 		return retval;
-	if(ima) {
+	if (ima) {
 
 		/* hack for icon render */
-		if(ima->ibufs.first==NULL && (R.r.scemode & R_NO_IMAGE_LOAD))
+		if (ima->ibufs.first==NULL && (R.r.scemode & R_NO_IMAGE_LOAD))
 			return retval;
 		
 		ibuf= BKE_image_get_ibuf(ima, &tex->iuser); 
 
 		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))
 		return retval;
 	
 	/* mipmap test */
 	image_mipmap_test(tex, ibuf);
 
-	if(tex->imaflag & TEX_USEALPHA) {
-		if(tex->imaflag & TEX_CALCALPHA);
+	if (tex->imaflag & TEX_USEALPHA) {
+		if (tex->imaflag & TEX_CALCALPHA);
 		else texres->talpha= 1;
 	}
 	
 	texr.talpha= texres->talpha;
 	
-	if(tex->imaflag & TEX_IMAROT) {
+	if (tex->imaflag & TEX_IMAROT) {
 		fy= texvec[0];
 		fx= texvec[1];
 	}
@@ -1468,9 +1468,9 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
 		fy= texvec[1];
 	}
 	
-	if(ibuf->flags & IB_fields) {
-		if(R.r.mode & R_FIELDS) {			/* field render */
-			if(R.flag & R_SEC_FIELD) {		/* correction for 2nd field */
+	if (ibuf->flags & IB_fields) {
+		if (R.r.mode & R_FIELDS) {			/* field render */
+			if (R.flag & R_SEC_FIELD) {		/* correction for 2nd field */
 				/* fac1= 0.5/( (float)ibuf->y ); */
 				/* fy-= fac1; */
 			}
@@ -1491,16 +1491,16 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
 	minx= (maxx-minx)/2.0f;
 	miny= (maxy-miny)/2.0f;
 	
-	if(tex->imaflag & TEX_FILTER_MIN) {
+	if (tex->imaflag & TEX_FILTER_MIN) {
 		/* make sure the filtersize is minimal in pixels (normal, ref map can have miniature pixel dx/dy) */
 		float addval= (0.5f * tex->filtersize) / (float) MIN2(ibuf->x, ibuf->y);
 
-		if(addval > minx)
+		if (addval > minx)
 			minx= addval;
-		if(addval > miny)
+		if (addval > miny)
 			miny= addval;
 	}
-	else if(tex->filtersize!=1.0f) {
+	else if (tex->filtersize!=1.0f) {
 		minx*= tex->filtersize;
 		miny*= tex->filtersize;
 		
@@ -1510,33 +1510,33 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
 		dyt[1]*= tex->filtersize;
 	}
 
-	if(tex->imaflag & TEX_IMAROT) SWAP(float, minx, miny);
+	if (tex->imaflag & TEX_IMAROT) SWAP(float, minx, miny);
 	
-	if(minx>0.25f) minx= 0.25f;
-	else if(minx<0.00001f) minx= 0.00001f;	/* side faces of unit-cube */
-	if(miny>0.25f) miny= 0.25f;
-	else if(miny<0.00001f) miny= 0.00001f;
+	if (minx>0.25f) minx= 0.25f;
+	else if (minx<0.00001f) minx= 0.00001f;	/* side faces of unit-cube */
+	if (miny>0.25f) miny= 0.25f;
+	else if (miny<0.00001f) miny= 0.00001f;
 
 	
 	/* repeat and clip */
 	imaprepeat= (tex->extend==TEX_REPEAT);
 	imapextend= (tex->extend==TEX_EXTEND);
 
-	if(tex->extend == TEX_REPEAT) {
-		if(tex->flag & (TEX_REPEAT_XMIR|TEX_REPEAT_YMIR)) {
+	if (tex->extend == TEX_REPEAT) {
+		if (tex->flag & (TEX_REPEAT_XMIR|TEX_REPEAT_YMIR)) {
 			imaprepeat= 0;
 			imapextend= 1;
 		}
 	}
 
-	if(tex->extend == TEX_CHECKER) {
+	if (tex->extend == TEX_CHECKER) {
 		int xs, ys, xs1, ys1, xs2, ys2, boundary;
 		
 		xs= (int)floor(fx);
 		ys= (int)floor(fy);
 		
 		// both checkers available, no boundary exceptions, checkerdist will eat aliasing
-		if( (tex->flag & TEX_CHECKER_ODD) && (tex->flag & TEX_CHECKER_EVEN) ) {
+		if ( (tex->flag & TEX_CHECKER_ODD) && (tex->flag & TEX_CHECKER_EVEN) ) {
 			fx-= xs;
 			fy-= ys;
 		}
@@ -1548,37 +1548,37 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
 			ys2= (int)floor(fy+miny);
 			boundary= (xs1!=xs2) || (ys1!=ys2);
 
-			if(boundary==0) {
-				if( (tex->flag & TEX_CHECKER_ODD)==0) {
-					if((xs+ys) & 1); 
+			if (boundary==0) {
+				if ( (tex->flag & TEX_CHECKER_ODD)==0) {
+					if ((xs+ys) & 1);
 					else return retval;
 				}
-				if( (tex->flag & TEX_CHECKER_EVEN)==0) {
-					if((xs+ys) & 1) return retval;
+				if ( (tex->flag & TEX_CHECKER_EVEN)==0) {
+					if ((xs+ys) & 1) return retval;
 				}
 				fx-= xs;
 				fy-= ys;
 			}
 			else {
-				if(tex->flag & TEX_CHECKER_ODD) {
-					if((xs1+ys) & 1) fx-= xs2;
+				if (tex->flag & TEX_CHECKER_ODD) {
+					if ((xs1+ys) & 1) fx-= xs2;
 					else fx-= xs1;
 					
-					if((ys1+xs) & 1) fy-= ys2;
+					if ((ys1+xs) & 1) fy-= ys2;
 					else fy-= ys1;
 				}
-				if(tex->flag & TEX_CHECKER_EVEN) {
-					if((xs1+ys) & 1) fx-= xs1;
+				if (tex->flag & TEX_CHECKER_EVEN) {
+					if ((xs1+ys) & 1) fx-= xs1;
 					else fx-= xs2;
 					
-					if((ys1+xs) & 1) fy-= ys1;
+					if ((ys1+xs) & 1) fy-= ys1;
 					else fy-= ys2;
 				}
 			}
 		}
 
 		/* scale around center, (0.5, 0.5) */
-		if(tex->checkerdist<1.0f) {
+		if (tex->checkerdist<1.0f) {
 			fx= (fx-0.5f)/(1.0f-tex->checkerdist) +0.5f;
 			fy= (fy-0.5f)/(1.0f-tex->checkerdist) +0.5f;
 			minx/= (1.0f-tex->checkerdist);
@@ -1586,74 +1586,74 @@ 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 (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) {
 			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) {
+	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) {
 			return retval;
 		}
 	}
 	else {
-		if(imapextend) {
-			if(fx>1.0f) fx = 1.0f;
-			else if(fx<0.0f) fx= 0.0f;
+		if (imapextend) {
+			if (fx>1.0f) fx = 1.0f;
+			else if (fx<0.0f) fx= 0.0f;
 		}
 		else {
-			if(fx>1.0f) fx -= (int)(fx);
-			else if(fx<0.0f) fx+= 1-(int)(fx);
+			if (fx>1.0f) fx -= (int)(fx);
+			else if (fx<0.0f) fx+= 1-(int)(fx);
 		}
 		
-		if(imapextend) {
-			if(fy>1.0f) fy = 1.0f;
-			else if(fy<0.0f) fy= 0.0f;
+		if (imapextend) {
+			if (fy>1.0f) fy = 1.0f;
+			else if (fy<0.0f) fy= 0.0f;
 		}
 		else {
-			if(fy>1.0f) fy -= (int)(fy);
-			else if(fy<0.0f) fy+= 1-(int)(fy);
+			if (fy>1.0f) fy -= (int)(fy);
+			else if (fy<0.0f) fy+= 1-(int)(fy);
 		}
 	}
 
 	/* warning no return! */
-	if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) {
+	if ( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) {
 		ibuf->rect+= (ibuf->x*ibuf->y);
 	}
 
 	/* choice:  */
-	if(tex->imaflag & TEX_MIPMAP) {
+	if (tex->imaflag & TEX_MIPMAP) {
 		ImBuf *previbuf, *curibuf;
 		float bumpscale;
 		
 		dx= minx;
 		dy= miny;
 		maxd= MAX2(dx, dy);
-		if(maxd>0.5f) maxd= 0.5f;
+		if (maxd>0.5f) maxd= 0.5f;
 
 		pixsize = 1.0f/ (float) MIN2(ibuf->x, ibuf->y);
 		
 		bumpscale= pixsize/maxd;
-		if(bumpscale>1.0f) bumpscale= 1.0f;
+		if (bumpscale>1.0f) bumpscale= 1.0f;
 		else bumpscale*=bumpscale;
 		
 		curmap= 0;
 		previbuf= curibuf= ibuf;
-		while(curmap<IB_MIPMAP_LEVELS && ibuf->mipmap[curmap]) {
-			if(maxd < pixsize) break;
+		while (curmap<IB_MIPMAP_LEVELS && ibuf->mipmap[curmap]) {
+			if (maxd < pixsize) break;
 			previbuf= curibuf;
 			curibuf= ibuf->mipmap[curmap];
 			pixsize= 1.0f / (float)MIN2(curibuf->x, curibuf->y);
 			curmap++;
 		}
 
-		if(previbuf!=curibuf || (tex->imaflag & TEX_INTERPOL)) {
+		if (previbuf!=curibuf || (tex->imaflag & TEX_INTERPOL)) {
 			/* sample at least 1 pixel */
 			if (minx < 0.5f / ibuf->x) minx = 0.5f / ibuf->x;
 			if (miny < 0.5f / ibuf->y) miny = 0.5f / ibuf->y;
 		}
 		
-		if(texres->nor && (tex->imaflag & TEX_NORMALMAP)==0) {
+		if (texres->nor && (tex->imaflag & TEX_NORMALMAP)==0) {
 			/* a bit extra filter */
 			//minx*= 1.35f;
 			//miny*= 1.35f;
@@ -1669,13 +1669,13 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
 			texres->nor[0]= (val1-val2);
 			texres->nor[1]= (val1-val3);
 			
-			if(previbuf!=curibuf) {  /* interpolate */
+			if (previbuf!=curibuf) {  /* interpolate */
 				
 				boxsample(previbuf, fx-minx, fy-miny, fx+minx, fy+miny, &texr, imaprepeat, imapextend);
 				
 				/* calc rgb */
 				dx= 2.0f*(pixsize-maxd)/pixsize;
-				if(dx>=1.0f) {
+				if (dx>=1.0f) {
 					texres->ta= texr.ta; texres->tb= texr.tb;
 					texres->tg= texr.tg; texres->tr= texr.tr;
 				}
@@ -1696,7 +1696,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
 				texres->nor[0]= (val1-val2);	/* vals have been interpolated above! */
 				texres->nor[1]= (val1-val3);
 				
-				if(dx<1.0f) {
+				if (dx<1.0f) {
 					dy= 1.0f-dx;
 					texres->tb= dy*texres->tb+ dx*texr.tb;
 					texres->tg= dy*texres->tg+ dx*texr.tg;
@@ -1715,15 +1715,16 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
 
 			boxsample(curibuf, minx, miny, maxx, maxy, texres, imaprepeat, imapextend);
 
-			if(previbuf!=curibuf) {  /* interpolate */
+			if (previbuf!=curibuf) {  /* interpolate */
 				boxsample(previbuf, minx, miny, maxx, maxy, &texr, imaprepeat, imapextend);
 				
 				fx= 2.0f*(pixsize-maxd)/pixsize;
 				
-				if(fx>=1.0f) {
+				if (fx>=1.0f) {
 					texres->ta= texr.ta; texres->tb= texr.tb;
 					texres->tg= texr.tg; texres->tr= texr.tr;
-				} else {
+				}
+				else {
 					fy= 1.0f-fx;
 					texres->tb= fy*texres->tb+ fx*texr.tb;
 					texres->tg= fy*texres->tg+ fx*texr.tg;
@@ -1741,7 +1742,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
 			if (miny < 0.5f / ibuf->y) miny = 0.5f / ibuf->y;
 		}
 
-		if(texres->nor && (tex->imaflag & TEX_NORMALMAP)==0) {
+		if (texres->nor && (tex->imaflag & TEX_NORMALMAP)==0) {
 			boxsample(ibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend);
 			val1= texres->tr+texres->tg+texres->tb;
 			boxsample(ibuf, fx-minx+dxt[0], fy-miny+dxt[1], fx+minx+dxt[0], fy+miny+dxt[1], &texr, imaprepeat, imapextend);
@@ -1757,18 +1758,18 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
 			boxsample(ibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend);
 	}
 	
-	if(tex->imaflag & TEX_CALCALPHA) {
+	if (tex->imaflag & TEX_CALCALPHA) {
 		texres->ta= texres->tin= texres->ta*MAX3(texres->tr, texres->tg, texres->tb);
 	}
 	else texres->tin= texres->ta;
 
-	if(tex->flag & TEX_NEGALPHA) texres->ta= 1.0f-texres->ta;
+	if (tex->flag & TEX_NEGALPHA) texres->ta= 1.0f-texres->ta;
 	
-	if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) {
+	if ( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) {
 		ibuf->rect-= (ibuf->x*ibuf->y);
 	}
 
-	if(texres->nor && (tex->imaflag & TEX_NORMALMAP)) {
+	if (texres->nor && (tex->imaflag & TEX_NORMALMAP)) {
 		// qdn: normal from color
 		// The invert of the red channel is to make
 		// the normal map compliant with the outside world.
@@ -1782,7 +1783,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
 	}
 	
 	/* de-premul, this is being premulled in shade_input_do_shade() */
-	if(texres->ta!=1.0f && texres->ta>1e-4f) {
+	if (texres->ta!=1.0f && texres->ta>1e-4f) {
 		fx= 1.0f/texres->ta;
 		texres->tr*= fx;
 		texres->tg*= fx;
@@ -1799,12 +1800,12 @@ void image_sample(Image *ima, float fx, float fy, float dx, float dy, float *res
 	TexResult texres;
 	ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
 	
-	if(ibuf==NULL) {
+	if (ibuf==NULL) {
 		result[0]= result[1]= result[2]= result[3]= 0.0f;
 		return;
 	}
 	
-	if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) )
+	if ( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) )
 		ibuf->rect+= (ibuf->x*ibuf->y);
 
 	texres.talpha= 1; /* boxsample expects to be initialized */
@@ -1814,7 +1815,7 @@ void image_sample(Image *ima, float fx, float fy, float dx, float dy, float *res
 	result[2]= texres.tb;
 	result[3]= texres.ta;
 	
-	if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) )
+	if ( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) )
 		ibuf->rect-= (ibuf->x*ibuf->y);
 
 	ima->flag|= IMA_USED_FOR_RENDER;
@@ -1825,7 +1826,7 @@ void ibuf_sample(ImBuf *ibuf, float fx, float fy, float dx, float dy, float *res
 	TexResult texres;
 	afdata_t AFD;
 	
-	if(ibuf==NULL) {
+	if (ibuf==NULL) {
 		return;
 	}
 	
diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c
index b7254cd..f7f592c 100644
--- a/source/blender/render/intern/source/initrender.c
+++ b/source/blender/render/intern/source/initrender.c
@@ -92,7 +92,7 @@ static void init_render_jit(Render *re)
 	static int lastjit= 0;
 	static int last_mblur_jit= 0;
 	
-	if(lastjit!=re->r.osa || last_mblur_jit != re->r.mblur_samples) {
+	if (lastjit!=re->r.osa || last_mblur_jit != re->r.mblur_samples) {
 		memset(jit, 0, sizeof(jit));
 		BLI_initjit(jit[0], re->r.osa);
 		
@@ -169,11 +169,11 @@ float RE_filter_value(int type, float x)
 	
 	switch(type) {
 		case R_FILTER_BOX:
-			if(x>1.0f) return 0.0f;
+			if (x>1.0f) return 0.0f;
 			return 1.0f;
 			
 		case R_FILTER_TENT:
-			if(x>1.0f) return 0.0f;
+			if (x>1.0f) return 0.0f;
 			return 1.0f-x;
 			
 		case R_FILTER_GAUSS:
@@ -200,7 +200,7 @@ static float calc_weight(Render *re, float *weight, int i, int j)
 	float x, y, dist, totw= 0.0;
 	int a;
 
-	for(a=0; a<re->osa; a++) {
+	for (a=0; a<re->osa; a++) {
 		x= re->jit[a][0] + i;
 		y= re->jit[a][1] + j;
 		dist= sqrt(x*x+y*y);
@@ -210,11 +210,11 @@ static float calc_weight(Render *re, float *weight, int i, int j)
 		/* Weighting choices */
 		switch(re->r.filtertype) {
 		case R_FILTER_BOX:
-			if(i==0 && j==0) weight[a]= 1.0;
+			if (i==0 && j==0) weight[a]= 1.0;
 			break;
 			
 		case R_FILTER_TENT:
-			if(dist < re->r.gauss)
+			if (dist < re->r.gauss)
 				weight[a]= re->r.gauss - dist;
 			break;
 			
@@ -251,8 +251,8 @@ void free_sample_tables(Render *re)
 {
 	int a;
 	
-	if(re->samples) {
-		for(a=0; a<9; a++) {
+	if (re->samples) {
+		for (a=0; a<9; a++) {
 			MEM_freeN(re->samples->fmask1[a]);
 			MEM_freeN(re->samples->fmask2[a]);
 		}
@@ -273,7 +273,7 @@ void make_sample_tables(Render *re)
 	int i, j, a;
 
 	/* optimization tables, only once */
-	if(firsttime) {
+	if (firsttime) {
 		firsttime= 0;
 	}
 	
@@ -281,7 +281,7 @@ void make_sample_tables(Render *re)
 	
 	init_render_jit(re);	/* needed for mblur too */
 	
-	if(re->osa==0) {
+	if (re->osa==0) {
 		/* just prevents cpu cycles for larger render and copying */
 		re->r.filtertype= 0;
 		return;
@@ -289,78 +289,78 @@ void make_sample_tables(Render *re)
 	
 	st= re->samples= MEM_callocN(sizeof(SampleTables), "sample tables");
 	
-	for(a=0; a<9;a++) {
+	for (a=0; a<9;a++) {
 		st->fmask1[a]= MEM_callocN(256*sizeof(float), "initfilt");
 		st->fmask2[a]= MEM_callocN(256*sizeof(float), "initfilt");
 	}
-	for(a=0; a<256; a++) {
+	for (a=0; a<256; a++) {
 		st->cmask[a]= 0;
-		if(a &   1) st->cmask[a]++;
-		if(a &   2) st->cmask[a]++;
-		if(a &   4) st->cmask[a]++;
-		if(a &   8) st->cmask[a]++;
-		if(a &  16) st->cmask[a]++;
-		if(a &  32) st->cmask[a]++;
-		if(a &  64) st->cmask[a]++;
-		if(a & 128) st->cmask[a]++;
+		if (a &   1) st->cmask[a]++;
+		if (a &   2) st->cmask[a]++;
+		if (a &   4) st->cmask[a]++;
+		if (a &   8) st->cmask[a]++;
+		if (a &  16) st->cmask[a]++;
+		if (a &  32) st->cmask[a]++;
+		if (a &  64) st->cmask[a]++;
+		if (a & 128) st->cmask[a]++;
 	}
 	
 	st->centmask= MEM_mallocN((1<<re->osa), "Initfilt3");
 	
-	for(a=0; a<16; a++) {
+	for (a=0; a<16; a++) {
 		st->centLut[a]= -0.45f+((float)a)/16.0f;
 	}
 
 	/* calculate totw */
 	totw= 0.0;
-	for(j= -1; j<2; j++) {
-		for(i= -1; i<2; i++) {
+	for (j= -1; j<2; j++) {
+		for (i= -1; i<2; i++) {
 			totw+= calc_weight(re, weight, i, j);
 		}
 	}
 
-	for(j= -1; j<2; j++) {
-		for(i= -1; i<2; i++) {
+	for (j= -1; j<2; j++) {
+		for (i= -1; i<2; i++) {
 			/* calculate using jit, with offset the weights */
 
 			memset(weight, 0, sizeof(weight));
 			calc_weight(re, weight, i, j);
 
-			for(a=0; a<16; a++) flweight[a]= weight[a]*(1.0f/totw);
+			for (a=0; a<16; a++) flweight[a]= weight[a]*(1.0f/totw);
 
 			m3= st->fmask1[ 3*(j+1)+i+1 ];
 			m4= st->fmask2[ 3*(j+1)+i+1 ];
 
-			for(a=0; a<256; a++) {
-				if(a &   1) {
+			for (a=0; a<256; a++) {
+				if (a &   1) {
 					m3[a]+= flweight[0];
 					m4[a]+= flweight[8];
 				}
-				if(a &   2) {
+				if (a &   2) {
 					m3[a]+= flweight[1];
 					m4[a]+= flweight[9];
 				}
-				if(a &   4) {
+				if (a &   4) {
 					m3[a]+= flweight[2];
 					m4[a]+= flweight[10];
 				}
-				if(a &   8) {
+				if (a &   8) {
 					m3[a]+= flweight[3];
 					m4[a]+= flweight[11];
 				}
-				if(a &  16) {
+				if (a &  16) {
 					m3[a]+= flweight[4];
 					m4[a]+= flweight[12];
 				}
-				if(a &  32) {
+				if (a &  32) {
 					m3[a]+= flweight[5];
 					m4[a]+= flweight[13];
 				}
-				if(a &  64) {
+				if (a &  64) {
 					m3[a]+= flweight[6];
 					m4[a]+= flweight[14];
 				}
-				if(a & 128) {
+				if (a & 128) {
 					m3[a]+= flweight[7];
 					m4[a]+= flweight[15];
 				}
@@ -374,52 +374,52 @@ void make_sample_tables(Render *re)
 	fpx2= MEM_mallocN(256*sizeof(float), "initgauss4");
 	fpy1= MEM_mallocN(256*sizeof(float), "initgauss4");
 	fpy2= MEM_mallocN(256*sizeof(float), "initgauss4");
-	for(a=0; a<256; a++) {
+	for (a=0; a<256; a++) {
 		fpx1[a]= fpx2[a]= 0.0;
 		fpy1[a]= fpy2[a]= 0.0;
-		if(a & 1) {
+		if (a & 1) {
 			fpx1[a]+= re->jit[0][0];
 			fpy1[a]+= re->jit[0][1];
 			fpx2[a]+= re->jit[8][0];
 			fpy2[a]+= re->jit[8][1];
 		}
-		if(a & 2) {
+		if (a & 2) {
 			fpx1[a]+= re->jit[1][0];
 			fpy1[a]+= re->jit[1][1];
 			fpx2[a]+= re->jit[9][0];
 			fpy2[a]+= re->jit[9][1];
 		}
-		if(a & 4) {
+		if (a & 4) {
 			fpx1[a]+= re->jit[2][0];
 			fpy1[a]+= re->jit[2][1];
 			fpx2[a]+= re->jit[10][0];
 			fpy2[a]+= re->jit[10][1];
 		}
-		if(a & 8) {
+		if (a & 8) {
 			fpx1[a]+= re->jit[3][0];
 			fpy1[a]+= re->jit[3][1];
 			fpx2[a]+= re->jit[11][0];
 			fpy2[a]+= re->jit[11][1];
 		}
-		if(a & 16) {
+		if (a & 16) {
 			fpx1[a]+= re->jit[4][0];
 			fpy1[a]+= re->jit[4][1];
 			fpx2[a]+= re->jit[12][0];
 			fpy2[a]+= re->jit[12][1];
 		}
-		if(a & 32) {
+		if (a & 32) {
 			fpx1[a]+= re->jit[5][0];
 			fpy1[a]+= re->jit[5][1];
 			fpx2[a]+= re->jit[13][0];
 			fpy2[a]+= re->jit[13][1];
 		}
-		if(a & 64) {
+		if (a & 64) {
 			fpx1[a]+= re->jit[6][0];
 			fpy1[a]+= re->jit[6][1];
 			fpx2[a]+= re->jit[14][0];
 			fpy2[a]+= re->jit[14][1];
 		}
-		if(a & 128) {
+		if (a & 128) {
 			fpx1[a]+= re->jit[7][0];
 			fpy1[a]+= re->jit[7][1];
 			fpx2[a]+= re->jit[15][0];
@@ -427,7 +427,7 @@ void make_sample_tables(Render *re)
 		}
 	}
 
-	for(a= (1<<re->osa)-1; a>0; a--) {
+	for (a= (1<<re->osa)-1; a>0; a--) {
 		val= st->cmask[a & 255] + st->cmask[a>>8];
 		i= 8+(15.9f*(fpy1[a & 255]+fpy2[a>>8])/val);
 		CLAMP(i, 0, 15);
@@ -531,9 +531,9 @@ void freeparts(Render *re)
 {
 	RenderPart *part= re->parts.first;
 	
-	while(part) {
-		if(part->rectp) MEM_freeN(part->rectp);
-		if(part->rectz) MEM_freeN(part->rectz);
+	while (part) {
+		if (part->rectp) MEM_freeN(part->rectp);
+		if (part->rectz) MEM_freeN(part->rectz);
 		part= part->next;
 	}
 	BLI_freelistN(&re->parts);
@@ -561,16 +561,16 @@ void initparts(Render *re)
 	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) 
+	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) 
+			if (ceil(re->rectx/(float)xparts) < 64) 
 				xparts= 1 + re->rectx/64;
 		
-		if(ceil(re->recty/(float)yparts) < 64) 
+		if (ceil(re->recty/(float)yparts) < 64) 
 			yparts= 1 + re->recty/64;
 	}
 	
@@ -584,43 +584,43 @@ void initparts(Render *re)
 	re->party= party;
 	
 	/* calculate rotation factor of 1 pixel */
-	if(re->r.mode & R_PANORAMA)
+	if (re->r.mode & R_PANORAMA)
 		re->panophi= panorama_pixel_rot(re);
 	
-	for(nr=0; nr<xparts*yparts; nr++) {
+	for (nr=0; nr<xparts*yparts; nr++) {
 		rcti disprect;
 		int rectx, recty;
 		
 		xd= (nr % xparts);
 		yd= (nr-xd)/xparts;
 		
-		disprect.xmin= xminb+ xd*partx;
-		disprect.ymin= yminb+ yd*party;
+		disprect.xmin = xminb+ xd*partx;
+		disprect.ymin = yminb+ yd*party;
 		
 		/* ensure we cover the entire picture, so last parts go to end */
-		if(xd<xparts-1) {
-			disprect.xmax= disprect.xmin + partx;
-			if(disprect.xmax > xmaxb)
+		if (xd<xparts-1) {
+			disprect.xmax = disprect.xmin + partx;
+			if (disprect.xmax > xmaxb)
 				disprect.xmax = xmaxb;
 		}
-		else disprect.xmax= xmaxb;
+		else disprect.xmax = xmaxb;
 		
-		if(yd<yparts-1) {
-			disprect.ymax= disprect.ymin + party;
-			if(disprect.ymax > ymaxb)
+		if (yd<yparts-1) {
+			disprect.ymax = disprect.ymin + party;
+			if (disprect.ymax > ymaxb)
 				disprect.ymax = ymaxb;
 		}
-		else disprect.ymax= ymaxb;
+		else disprect.ymax = ymaxb;
 		
 		rectx= disprect.xmax - disprect.xmin;
 		recty= disprect.ymax - disprect.ymin;
 		
 		/* so, now can we add this part? */
-		if(rectx>0 && recty>0) {
+		if (rectx>0 && recty>0) {
 			RenderPart *pa= MEM_callocN(sizeof(RenderPart), "new part");
 			
 			/* Non-box filters need 2 pixels extra to work */
-			if((re->r.filtertype || (re->r.mode & R_EDGE))) {
+			if ((re->r.filtertype || (re->r.mode & R_EDGE))) {
 				pa->crop= 2;
 				disprect.xmin -= pa->crop;
 				disprect.ymin -= pa->crop;
diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c
index 669355c..436eaef 100644
--- a/source/blender/render/intern/source/occlusion.c
+++ b/source/blender/render/intern/source/occlusion.c
@@ -148,7 +148,7 @@ static void occ_shade(ShadeSample *ssamp, ObjectInstanceRen *obi, VlakRen *vlr,
 	float l, u, v, *v1, *v2, *v3;
 	
 	/* init */
-	if(vlr->v4) {
+	if (vlr->v4) {
 		shi->u= u= 0.5f;
 		shi->v= v= 0.5f;
 	}
@@ -184,13 +184,13 @@ static void occ_shade(ShadeSample *ssamp, ObjectInstanceRen *obi, VlakRen *vlr,
 	shade_input_set_normals(shi);
 
 	/* no normal flip */
-	if(shi->flippednor)
+	if (shi->flippednor)
 		shade_input_flip_normals(shi);
 
 	madd_v3_v3fl(shi->co, shi->vn, 0.0001f); /* ugly.. */
 
 	/* not a pretty solution, but fixes common cases */
-	if(shi->obr->ob && shi->obr->ob->transflag & OB_NEG_SCALE) {
+	if (shi->obr->ob && shi->obr->ob->transflag & OB_NEG_SCALE) {
 		negate_v3(shi->vn);
 		negate_v3(shi->vno);
 		negate_v3(shi->nmapnorm);
@@ -224,7 +224,7 @@ static void occ_build_shade(Render *re, OcclusionTree *tree)
 	ssamp.shi[0].combinedflag= ~(SCE_PASS_SPEC);
 	ssamp.tot= 1;
 
-	for(a=0; a<tree->totface; a++) {
+	for (a=0; a<tree->totface; a++) {
 		obi= &R.objectinstance[tree->face[a].obi];
 		vlr= RE_findOrAddVlak(obi->obr, tree->face[a].facenr);
 
@@ -235,9 +235,9 @@ static void occ_build_shade(Render *re, OcclusionTree *tree)
 /* ------------------------- Spherical Harmonics --------------------------- */
 
 /* Use 2nd order SH => 9 coefficients, stored in this order:
-   0 = (0,0),
-   1 = (1,-1), 2 = (1,0), 3 = (1,1),
-   4 = (2,-2), 5 = (2,-1), 6 = (2,0), 7 = (2,1), 8 = (2,2) */
+ * 0 = (0,0),
+ * 1 = (1,-1), 2 = (1,0), 3 = (1,1),
+ * 4 = (2,-2), 5 = (2,-1), 6 = (2,0), 7 = (2,1), 8 = (2,2) */
 
 static void sh_copy(float *shresult, float *sh)
 {
@@ -248,7 +248,7 @@ static void sh_mul(float *sh, float f)
 {
 	int i;
 
-	for(i=0; i<9; i++)
+	for (i=0; i<9; i++)
 		sh[i] *= f;
 }
 
@@ -256,14 +256,14 @@ static void sh_add(float *shresult, float *sh1, float *sh2)
 {
 	int i;
 
-	for(i=0; i<9; i++)
+	for (i=0; i<9; i++)
 		shresult[i]= sh1[i] + sh2[i];
 }
 
 static void sh_from_disc(float *n, float area, float *shresult)
 {
 	/* See formula (3) in:
-	   "An Efficient Representation for Irradiance Environment Maps" */
+	 * "An Efficient Representation for Irradiance Environment Maps" */
 	float sh[9], x, y, z;
 
 	x= n[0];
@@ -289,7 +289,7 @@ static void sh_from_disc(float *n, float area, float *shresult)
 static float sh_eval(float *sh, float *v)
 {
 	/* See formula (13) in:
-	   "An Efficient Representation for Irradiance Environment Maps" */
+	 * "An Efficient Representation for Irradiance Environment Maps" */
 	static const float c1 = 0.429043f, c2 = 0.511664f, c3 = 0.743125f;
 	static const float c4 = 0.886227f, c5 = 0.247708f;
 	float x, y, z, sum;
@@ -319,40 +319,40 @@ static void occ_face(const OccFace *face, float co[3], float normal[3], float *a
 	obi= &R.objectinstance[face->obi];
 	vlr= RE_findOrAddVlak(obi->obr, face->facenr);
 	
-	if(co) {
-		if(vlr->v4)
+	if (co) {
+		if (vlr->v4)
 			mid_v3_v3v3(co, vlr->v1->co, vlr->v3->co);
 		else
 			cent_tri_v3(co, vlr->v1->co, vlr->v2->co, vlr->v3->co);
 
-		if(obi->flag & R_TRANSFORMED)
+		if (obi->flag & R_TRANSFORMED)
 			mul_m4_v3(obi->mat, co);
 	}
 	
-	if(normal) {
+	if (normal) {
 		normal[0]= -vlr->n[0];
 		normal[1]= -vlr->n[1];
 		normal[2]= -vlr->n[2];
 
-		if(obi->flag & R_TRANSFORMED)
+		if (obi->flag & R_TRANSFORMED)
 			mul_m3_v3(obi->nmat, normal);
 	}
 
-	if(area) {
+	if (area) {
 		copy_v3_v3(v1, vlr->v1->co);
 		copy_v3_v3(v2, vlr->v2->co);
 		copy_v3_v3(v3, vlr->v3->co);
-		if(vlr->v4) copy_v3_v3(v4, vlr->v4->co);
+		if (vlr->v4) copy_v3_v3(v4, vlr->v4->co);
 
-		if(obi->flag & R_TRANSFORMED) {
+		if (obi->flag & R_TRANSFORMED) {
 			mul_m4_v3(obi->mat, v1);
 			mul_m4_v3(obi->mat, v2);
 			mul_m4_v3(obi->mat, v3);
-			if(vlr->v4) mul_m4_v3(obi->mat, v4);
+			if (vlr->v4) mul_m4_v3(obi->mat, v4);
 		}
 
 		/* todo: correct area for instances */
-		if(vlr->v4)
+		if (vlr->v4)
 			*area= area_quad_v3(v1, v2, v3, v4);
 		else
 			*area= area_tri_v3(v1, v2, v3);
@@ -367,33 +367,33 @@ static void occ_sum_occlusion(OcclusionTree *tree, OccNode *node)
 
 	occ= 0.0f;
 	totarea= 0.0f;
-	if(indirect) zero_v3(rad);
+	if (indirect) zero_v3(rad);
 
-	for(b=0; b<TOTCHILD; b++) {
-		if(node->childflag & (1<<b)) {
+	for (b=0; b<TOTCHILD; b++) {
+		if (node->childflag & (1<<b)) {
 			a= node->child[b].face;
 			occ_face(&tree->face[a], 0, 0, &area);
 			occ += area*tree->occlusion[a];
-			if(indirect) madd_v3_v3fl(rad, tree->rad[a], area);
+			if (indirect) madd_v3_v3fl(rad, tree->rad[a], area);
 			totarea += area;
 		}
-		else if(node->child[b].node) {
+		else if (node->child[b].node) {
 			child= node->child[b].node;
 			occ_sum_occlusion(tree, child);
 
 			occ += child->area*child->occlusion;
-			if(indirect) madd_v3_v3fl(rad, child->rad, child->area);
+			if (indirect) madd_v3_v3fl(rad, child->rad, child->area);
 			totarea += child->area;
 		}
 	}
 
-	if(totarea != 0.0f) {
+	if (totarea != 0.0f) {
 		occ /= totarea;
-		if(indirect) mul_v3_fl(rad, 1.0f/totarea);
+		if (indirect) mul_v3_fl(rad, 1.0f/totarea);
 	}
 	
 	node->occlusion= occ;
-	if(indirect) copy_v3_v3(node->rad, rad);
+	if (indirect) copy_v3_v3(node->rad, rad);
 }
 
 static int occ_find_bbox_axis(OcclusionTree *tree, int begin, int end, float *min, float *max)
@@ -403,13 +403,14 @@ static int occ_find_bbox_axis(OcclusionTree *tree, int begin, int end, float *mi
 
 	INIT_MINMAX(min, max);
 
-	for(a=begin; a<end; a++)
-		DO_MINMAX(tree->co[a], min, max)
+	for (a = begin; a < end; a++) {
+		DO_MINMAX(tree->co[a], min, max);
+	}
 
-	for(a=0; a<3; a++) {
+	for (a=0; a<3; a++) {
 		len= max[a] - min[a];
 
-		if(len > maxlen) {
+		if (len > maxlen) {
 			maxlen= len;
 			axis= a;
 		}
@@ -430,13 +431,13 @@ static void occ_node_from_face(OccFace *face, OccNode *node)
 static void occ_build_dco(OcclusionTree *tree, OccNode *node, const float co[3], float *dco)
 {
 	int b;
-	for(b=0; b<TOTCHILD; b++) {
+	for (b=0; b<TOTCHILD; b++) {
 		float dist, d[3], nco[3];
 
-		if(node->childflag & (1<<b)) {
+		if (node->childflag & (1<<b)) {
 			occ_face(tree->face+node->child[b].face, nco, NULL, NULL);
 		}
-		else if(node->child[b].node) {
+		else if (node->child[b].node) {
 			OccNode *child= node->child[b].node;
 			occ_build_dco(tree, child, co, dco);
 			copy_v3_v3(nco, child->co);
@@ -447,7 +448,7 @@ static void occ_build_dco(OcclusionTree *tree, OccNode *node, const float co[3],
 
 		sub_v3_v3v3(d, nco, co);
 		dist= dot_v3v3(d, d);
-		if(dist > *dco)
+		if (dist > *dco)
 			*dco= dist;
 	}
 }
@@ -465,8 +466,8 @@ static void occ_build_split(OcclusionTree *tree, int begin, int end, int *split)
 
 	a= begin;
 	enda= end;
-	while(a<enda) {
-		if(tree->co[a][axis] > mid) {
+	while (a<enda) {
+		if (tree->co[a][axis] > mid) {
 			enda--;
 			SWAP(OccFace, tree->face[a], tree->face[enda]);
 			SWAP(float, tree->co[a][0], tree->co[enda][0]);
@@ -488,7 +489,7 @@ static void occ_build_8_split(OcclusionTree *tree, int begin, int end, int *offs
 	occ_build_split(tree, begin, end, &splitx);
 
 	/* force split if none found, to deal with degenerate geometry */
-	if(splitx == begin || splitx == end)
+	if (splitx == begin || splitx == end)
 		splitx= (begin+end)/2;
 
 	occ_build_split(tree, begin, splitx, &splity[0]);
@@ -508,7 +509,7 @@ static void occ_build_8_split(OcclusionTree *tree, int begin, int end, int *offs
 	offset[6]= splity[1];
 	offset[7]= splitz[3];
 
-	for(b=0; b<7; b++)
+	for (b=0; b<7; b++)
 		count[b]= offset[b+1] - offset[b];
 	count[7]= end - offset[7];
 }
@@ -536,8 +537,8 @@ static void occ_build_recursive(OcclusionTree *tree, OccNode *node, int begin, i
 	node->occlusion= 1.0f;
 
 	/* leaf node with only children */
-	if(end - begin <= TOTCHILD) {
-		for(a=begin, b=0; a<end; a++, b++) {
+	if (end - begin <= TOTCHILD) {
+		for (a=begin, b=0; a<end; a++, b++) {
 			/* face= &tree->face[a]; */
 			node->child[b].face= a;
 			node->childflag |= (1<<b);
@@ -547,33 +548,33 @@ static void occ_build_recursive(OcclusionTree *tree, OccNode *node, int begin, i
 		/* order faces */
 		occ_build_8_split(tree, begin, end, offset, count);
 
-		if(depth == 1 && tree->dothreadedbuild)
+		if (depth == 1 && tree->dothreadedbuild)
 			BLI_init_threads(&threads, exec_occ_build, tree->totbuildthread);
 
-		for(b=0; b<TOTCHILD; b++) {
-			if(count[b] == 0) {
+		for (b=0; b<TOTCHILD; b++) {
+			if (count[b] == 0) {
 				node->child[b].node= NULL;
 			}
-			else if(count[b] == 1) {
+			else if (count[b] == 1) {
 				/* face= &tree->face[offset[b]]; */
 				node->child[b].face= offset[b];
 				node->childflag |= (1<<b);
 			}
 			else {
-				if(tree->dothreadedbuild)
+				if (tree->dothreadedbuild)
 					BLI_lock_thread(LOCK_CUSTOM1);
 
 				child= BLI_memarena_alloc(tree->arena, sizeof(OccNode));
 				node->child[b].node= child;
 
 				/* keep track of maximum depth for stack */
-				if(depth+1 > tree->maxdepth)
+				if (depth+1 > tree->maxdepth)
 					tree->maxdepth= depth+1;
 
-				if(tree->dothreadedbuild)
+				if (tree->dothreadedbuild)
 					BLI_unlock_thread(LOCK_CUSTOM1);
 
-				if(depth == 1 && tree->dothreadedbuild) {
+				if (depth == 1 && tree->dothreadedbuild) {
 					othreads[totthread].tree= tree;
 					othreads[totthread].node= child;
 					othreads[totthread].begin= offset[b];
@@ -587,13 +588,13 @@ static void occ_build_recursive(OcclusionTree *tree, OccNode *node, int begin, i
 			}
 		}
 
-		if(depth == 1 && tree->dothreadedbuild)
+		if (depth == 1 && tree->dothreadedbuild)
 			BLI_end_threads(&threads);
 	}
 
 	/* combine area, position and sh */
-	for(b=0; b<TOTCHILD; b++) {
-		if(node->childflag & (1<<b)) {
+	for (b=0; b<TOTCHILD; b++) {
+		if (node->childflag & (1<<b)) {
 			child= &tmpnode;
 			occ_node_from_face(tree->face+node->child[b].face, &tmpnode);
 		}
@@ -601,19 +602,19 @@ static void occ_build_recursive(OcclusionTree *tree, OccNode *node, int begin, i
 			child= node->child[b].node;
 		}
 
-		if(child) {
+		if (child) {
 			node->area += child->area;
 			sh_add(node->sh, node->sh, child->sh);
 			madd_v3_v3fl(node->co, child->co, child->area);
 		}
 	}
 
-	if(node->area != 0.0f)
+	if (node->area != 0.0f)
 		mul_v3_fl(node->co, 1.0f/node->area);
 
 	/* compute maximum distance from center */
 	node->dco= 0.0f;
-	if(node->area > 0.0f)
+	if (node->area > 0.0f)
 		occ_build_dco(tree, node, node->co, &node->dco);
 }
 
@@ -623,12 +624,12 @@ static void occ_build_sh_normalize(OccNode *node)
 	 * we can clamp the dot product and then mutliply by area */
 	int b;
 
-	if(node->area != 0.0f)
+	if (node->area != 0.0f)
 		sh_mul(node->sh, 1.0f/node->area);
 
-	for(b=0; b<TOTCHILD; b++) {
-		if(node->childflag & (1<<b));
-		else if(node->child[b].node)
+	for (b=0; b<TOTCHILD; b++) {
+		if (node->childflag & (1<<b));
+		else if (node->child[b].node)
 			occ_build_sh_normalize(node->child[b].node);
 	}
 }
@@ -644,20 +645,20 @@ static OcclusionTree *occ_tree_build(Render *re)
 
 	/* count */
 	totface= 0;
-	for(obi=re->instancetable.first; obi; obi=obi->next) {
+	for (obi=re->instancetable.first; obi; obi=obi->next) {
 		obr= obi->obr;
-		for(a=0; a<obr->totvlak; a++) {
-			if((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
+		for (a=0; a<obr->totvlak; a++) {
+			if ((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
 			else vlr++;
 
 			ma= vlr->mat;
 
-			if((ma->shade_flag & MA_APPROX_OCCLUSION) && (ma->material_type == MA_TYPE_SURFACE))
+			if ((ma->shade_flag & MA_APPROX_OCCLUSION) && (ma->material_type == MA_TYPE_SURFACE))
 				totface++;
 		}
 	}
 
-	if(totface == 0)
+	if (totface == 0)
 		return NULL;
 	
 	tree= MEM_callocN(sizeof(OcclusionTree), "OcclusionTree");
@@ -672,26 +673,26 @@ static OcclusionTree *occ_tree_build(Render *re)
 	tree->arena= BLI_memarena_new(0x8000 * sizeof(OccNode), "occ tree arena");
 	BLI_memarena_use_calloc(tree->arena);
 
-	if(re->wrld.aomode & WO_AOCACHE)
+	if (re->wrld.aomode & WO_AOCACHE)
 		tree->cache= MEM_callocN(sizeof(OcclusionCache)*BLENDER_MAX_THREADS, "OcclusionCache");
 
 	tree->face= MEM_callocN(sizeof(OccFace)*totface, "OcclusionFace");
 	tree->co= MEM_callocN(sizeof(float)*3*totface, "OcclusionCo");
 	tree->occlusion= MEM_callocN(sizeof(float)*totface, "OcclusionOcclusion");
 
-	if(tree->doindirect)
+	if (tree->doindirect)
 		tree->rad= MEM_callocN(sizeof(float)*3*totface, "OcclusionRad");
 
 	/* make array of face pointers */
-	for(b=0, c=0, obi=re->instancetable.first; obi; obi=obi->next, c++) {
+	for (b=0, c=0, obi=re->instancetable.first; obi; obi=obi->next, c++) {
 		obr= obi->obr;
-		for(a=0; a<obr->totvlak; a++) {
-			if((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
+		for (a=0; a<obr->totvlak; a++) {
+			if ((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
 			else vlr++;
 
 			ma= vlr->mat;
 
-			if((ma->shade_flag & MA_APPROX_OCCLUSION) && (ma->material_type == MA_TYPE_SURFACE)) {
+			if ((ma->shade_flag & MA_APPROX_OCCLUSION) && (ma->material_type == MA_TYPE_SURFACE)) {
 				tree->face[b].obi= c;
 				tree->face[b].facenr= a;
 				tree->occlusion[b]= 1.0f;
@@ -710,7 +711,7 @@ static OcclusionTree *occ_tree_build(Render *re)
 	tree->maxdepth= 1;
 	occ_build_recursive(tree, tree->root, 0, totface, 1);
 
-	if(tree->doindirect) {
+	if (tree->doindirect) {
 		occ_build_shade(re, tree);
 		occ_sum_occlusion(tree, tree->root);
 	}
@@ -720,7 +721,7 @@ static OcclusionTree *occ_tree_build(Render *re)
 
 	occ_build_sh_normalize(tree->root);
 
-	for(a=0; a<BLENDER_MAX_THREADS; a++)
+	for (a=0; a<BLENDER_MAX_THREADS; a++)
 		tree->stack[a]= MEM_callocN(sizeof(OccNode)*TOTCHILD*(tree->maxdepth+1), "OccStack");
 
 	return tree;
@@ -730,15 +731,15 @@ static void occ_free_tree(OcclusionTree *tree)
 {
 	int a;
 
-	if(tree) {
-		if(tree->arena) BLI_memarena_free(tree->arena);
-		for(a=0; a<BLENDER_MAX_THREADS; a++)
-			if(tree->stack[a])
+	if (tree) {
+		if (tree->arena) BLI_memarena_free(tree->arena);
+		for (a=0; a<BLENDER_MAX_THREADS; a++)
+			if (tree->stack[a])
 				MEM_freeN(tree->stack[a]);
-		if(tree->occlusion) MEM_freeN(tree->occlusion);
-		if(tree->cache) MEM_freeN(tree->cache);
-		if(tree->face) MEM_freeN(tree->face);
-		if(tree->rad) MEM_freeN(tree->rad);
+		if (tree->occlusion) MEM_freeN(tree->occlusion);
+		if (tree->cache) MEM_freeN(tree->cache);
+		if (tree->face) MEM_freeN(tree->face);
+		if (tree->rad) MEM_freeN(tree->rad);
 		MEM_freeN(tree);
 	}
 }
@@ -781,20 +782,20 @@ static int occ_visible_quad(float *p, const float n[3], const float v0[3], const
 	sd[1]= dot_v3v3(n, v1) - c;
 	sd[2]= dot_v3v3(n, v2) - c;
 
-	if(fabsf(sd[0]) < epsilon) sd[0] = 0.0f;
-	if(fabsf(sd[1]) < epsilon) sd[1] = 0.0f;
-	if(fabsf(sd[2]) < epsilon) sd[2] = 0.0f;
+	if (fabsf(sd[0]) < epsilon) sd[0] = 0.0f;
+	if (fabsf(sd[1]) < epsilon) sd[1] = 0.0f;
+	if (fabsf(sd[2]) < epsilon) sd[2] = 0.0f;
 
-	if(sd[0] > 0) {
-		if(sd[1] > 0) {
-			if(sd[2] > 0) {
+	if (sd[0] > 0) {
+		if (sd[1] > 0) {
+			if (sd[2] > 0) {
 				// +++
 				copy_v3_v3(q0, v0);
 				copy_v3_v3(q1, v1);
 				copy_v3_v3(q2, v2);
 				copy_v3_v3(q3, q2);
 			}
-			else if(sd[2] < 0) {
+			else if (sd[2] < 0) {
 				// ++-
 				copy_v3_v3(q0, v0);
 				copy_v3_v3(q1, v1);
@@ -809,15 +810,15 @@ static int occ_visible_quad(float *p, const float n[3], const float v0[3], const
 				copy_v3_v3(q3, q2);
 			}
 		}
-		else if(sd[1] < 0) {
-			if(sd[2] > 0) {
+		else if (sd[1] < 0) {
+			if (sd[2] > 0) {
 				// +-+
 				copy_v3_v3(q0, v0);
 				VecAddDir(q1, v0, v1, (sd[0]/(sd[0]-sd[1])));
 				VecAddDir(q2, v1, v2, (sd[1]/(sd[1]-sd[2])));
 				copy_v3_v3(q3, v2);
 			}
-			else if(sd[2] < 0) {
+			else if (sd[2] < 0) {
 				// +--
 				copy_v3_v3(q0, v0);
 				VecAddDir(q1, v0, v1, (sd[0]/(sd[0]-sd[1])));
@@ -833,14 +834,14 @@ static int occ_visible_quad(float *p, const float n[3], const float v0[3], const
 			}
 		}
 		else {
-			if(sd[2] > 0) {
+			if (sd[2] > 0) {
 				// +0+
 				copy_v3_v3(q0, v0);
 				copy_v3_v3(q1, v1);
 				copy_v3_v3(q2, v2);
 				copy_v3_v3(q3, q2);
 			}
-			else if(sd[2] < 0) {
+			else if (sd[2] < 0) {
 				// +0-
 				copy_v3_v3(q0, v0);
 				copy_v3_v3(q1, v1);
@@ -856,16 +857,16 @@ static int occ_visible_quad(float *p, const float n[3], const float v0[3], const
 			}
 		}
 	}
-	else if(sd[0] < 0) {
-		if(sd[1] > 0) {
-			if(sd[2] > 0) {
+	else if (sd[0] < 0) {
+		if (sd[1] > 0) {
+			if (sd[2] > 0) {
 				// -++
 				VecAddDir(q0, v0, v1, (sd[0]/(sd[0]-sd[1])));
 				copy_v3_v3(q1, v1);
 				copy_v3_v3(q2, v2);
 				VecAddDir(q3, v0, v2, (sd[0]/(sd[0]-sd[2])));
 			}
-			else if(sd[2] < 0) {
+			else if (sd[2] < 0) {
 				// -+-
 				VecAddDir(q0, v0, v1, (sd[0]/(sd[0]-sd[1])));
 				copy_v3_v3(q1, v1);
@@ -880,15 +881,15 @@ static int occ_visible_quad(float *p, const float n[3], const float v0[3], const
 				copy_v3_v3(q3, q2);
 			}
 		}
-		else if(sd[1] < 0) {
-			if(sd[2] > 0) {
+		else if (sd[1] < 0) {
+			if (sd[2] > 0) {
 				// --+
 				VecAddDir(q0, v0, v2, (sd[0]/(sd[0]-sd[2])));
 				VecAddDir(q1, v1, v2, (sd[1]/(sd[1]-sd[2])));
 				copy_v3_v3(q2, v2);
 				copy_v3_v3(q3, q2);
 			}
-			else if(sd[2] < 0) {
+			else if (sd[2] < 0) {
 				// ---
 				return 0;
 			}
@@ -898,14 +899,14 @@ static int occ_visible_quad(float *p, const float n[3], const float v0[3], const
 			}
 		}
 		else {
-			if(sd[2] > 0) {
+			if (sd[2] > 0) {
 				// -0+
 				VecAddDir(q0, v0, v2, (sd[0]/(sd[0]-sd[2])));
 				copy_v3_v3(q1, v1);
 				copy_v3_v3(q2, v2);
 				copy_v3_v3(q3, q2);
 			}
-			else if(sd[2] < 0) {
+			else if (sd[2] < 0) {
 				// -0-
 				return 0;
 			}
@@ -916,15 +917,15 @@ static int occ_visible_quad(float *p, const float n[3], const float v0[3], const
 		}
 	}
 	else {
-		if(sd[1] > 0) {
-			if(sd[2] > 0) {
+		if (sd[1] > 0) {
+			if (sd[2] > 0) {
 				// 0++
 				copy_v3_v3(q0, v0);
 				copy_v3_v3(q1, v1);
 				copy_v3_v3(q2, v2);
 				copy_v3_v3(q3, q2);
 			}
-			else if(sd[2] < 0) {
+			else if (sd[2] < 0) {
 				// 0+-
 				copy_v3_v3(q0, v0);
 				copy_v3_v3(q1, v1);
@@ -939,15 +940,15 @@ static int occ_visible_quad(float *p, const float n[3], const float v0[3], const
 				copy_v3_v3(q3, q2);
 			}
 		}
-		else if(sd[1] < 0) {
-			if(sd[2] > 0) {
+		else if (sd[1] < 0) {
+			if (sd[2] > 0) {
 				// 0-+
 				copy_v3_v3(q0, v0);
 				VecAddDir(q1, v1, v2, (sd[1]/(sd[1]-sd[2])));
 				copy_v3_v3(q2, v2);
 				copy_v3_v3(q3, q2);
 			}
-			else if(sd[2] < 0) {
+			else if (sd[2] < 0) {
 				// 0--
 				return 0;
 			}
@@ -957,14 +958,14 @@ static int occ_visible_quad(float *p, const float n[3], const float v0[3], const
 			}
 		}
 		else {
-			if(sd[2] > 0) {
+			if (sd[2] > 0) {
 				// 00+
 				copy_v3_v3(q0, v0);
 				copy_v3_v3(q1, v1);
 				copy_v3_v3(q2, v2);
 				copy_v3_v3(q3, q2);
 			}
-			else if(sd[2] < 0) {
+			else if (sd[2] < 0) {
 				// 00-
 				return 0;
 			}
@@ -990,20 +991,20 @@ typedef union {
 
 static vFloat vec_splat_float(float val)
 {
-	return (vFloat){val, val, val, val};
+	return (vFloat) {val, val, val, val};
 }
 
 static float occ_quad_form_factor(float *p, float *n, float *q0, float *q1, float *q2, float *q3)
 {
 	vFloat vcos, rlen, vrx, vry, vrz, vsrx, vsry, vsrz, gx, gy, gz, vangle;
-	vUInt8 rotate = (vUInt8){4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3};
+	vUInt8 rotate = (vUInt8) {4,5,6,7,8,9,10,11,12,13,14,15,0,1,2,3};
 	vFloatResult vresult;
 	float result;
 
 	/* compute r* */
-	vrx = (vFloat){q0[0], q1[0], q2[0], q3[0]} - vec_splat_float(p[0]);
-	vry = (vFloat){q0[1], q1[1], q2[1], q3[1]} - vec_splat_float(p[1]);
-	vrz = (vFloat){q0[2], q1[2], q2[2], q3[2]} - vec_splat_float(p[2]);
+	vrx = (vFloat) {q0[0], q1[0], q2[0], q3[0]} - vec_splat_float(p[0]);
+	vry = (vFloat) {q0[1], q1[1], q2[1], q3[1]} - vec_splat_float(p[1]);
+	vrz = (vFloat) {q0[2], q1[2], q2[2], q3[2]} - vec_splat_float(p[2]);
 
 	/* normalize r* */
 	rlen = vec_rsqrte(vrx*vrx + vry*vry + vrz*vrz + vec_splat_float(1e-16f));
@@ -1119,7 +1120,7 @@ static void normalizef(float *n)
 	
 	d= dot_v3v3(n, n);
 
-	if(d > 1.0e-35F) {
+	if (d > 1.0e-35F) {
 		d= 1.0f/sqrtf(d);
 
 		n[0] *= d; 
@@ -1177,21 +1178,21 @@ static float occ_form_factor(OccFace *face, float *p, float *n)
 	copy_v3_v3(v2, vlr->v2->co);
 	copy_v3_v3(v3, vlr->v3->co);
 
-	if(obi->flag & R_TRANSFORMED) {
+	if (obi->flag & R_TRANSFORMED) {
 		mul_m4_v3(obi->mat, v1);
 		mul_m4_v3(obi->mat, v2);
 		mul_m4_v3(obi->mat, v3);
 	}
 
-	if(occ_visible_quad(p, n, v1, v2, v3, q0, q1, q2, q3))
+	if (occ_visible_quad(p, n, v1, v2, v3, q0, q1, q2, q3))
 		contrib += occ_quad_form_factor(p, n, q0, q1, q2, q3);
 
-	if(vlr->v4) {
+	if (vlr->v4) {
 		copy_v3_v3(v4, vlr->v4->co);
-		if(obi->flag & R_TRANSFORMED)
+		if (obi->flag & R_TRANSFORMED)
 			mul_m4_v3(obi->mat, v4);
 
-		if(occ_visible_quad(p, n, v1, v3, v4, q0, q1, q2, q3))
+		if (occ_visible_quad(p, n, v1, v3, v4, q0, q1, q2, q3))
 			contrib += occ_quad_form_factor(p, n, q0, q1, q2, q3);
 	}
 
@@ -1211,7 +1212,7 @@ static void occ_lookup(OcclusionTree *tree, int thread, OccFace *exclude, float
 	copy_v3_v3(n, pn);
 	madd_v3_v3fl(p, n, 1e-4f);
 
-	if(bentn)
+	if (bentn)
 		copy_v3_v3(bentn, n);
 	
 	error= tree->error;
@@ -1225,7 +1226,7 @@ static void occ_lookup(OcclusionTree *tree, int thread, OccFace *exclude, float
 	stack[0]= tree->root;
 	totstack= 1;
 
-	while(totstack) {
+	while (totstack) {
 		/* pop point off the stack */
 		node= stack[--totstack];
 
@@ -1233,10 +1234,10 @@ static void occ_lookup(OcclusionTree *tree, int thread, OccFace *exclude, float
 		d2= dot_v3v3(v, v) + 1e-16f;
 		emitarea= MAX2(node->area, node->dco);
 
-		if(d2*error > emitarea) {
-			if(distfac != 0.0f) {
+		if (d2*error > emitarea) {
+			if (distfac != 0.0f) {
 				fac= 1.0f/(1.0f + distfac*d2);
-				if(fac < 0.01f)
+				if (fac < 0.01f)
 					continue;
 			}
 			else
@@ -1246,12 +1247,12 @@ static void occ_lookup(OcclusionTree *tree, int thread, OccFace *exclude, float
 			invd2 = 1.0f/sqrtf(d2);
 			weight= occ_solid_angle(node, v, d2, invd2, n);
 
-			if(rad)
+			if (rad)
 				madd_v3_v3fl(resultrad, node->rad, weight*fac);
 
 			weight *= node->occlusion;
 
-			if(bentn) {
+			if (bentn) {
 				bentn[0] -= weight*invd2*v[0];
 				bentn[1] -= weight*invd2*v[1];
 				bentn[2] -= weight*invd2*v[2];
@@ -1261,20 +1262,20 @@ static void occ_lookup(OcclusionTree *tree, int thread, OccFace *exclude, float
 		}
 		else {
 			/* traverse into children */
-			for(b=0; b<TOTCHILD; b++) {
-				if(node->childflag & (1<<b)) {
+			for (b=0; b<TOTCHILD; b++) {
+				if (node->childflag & (1<<b)) {
 					f= node->child[b].face;
 					face= &tree->face[f];
 
 					/* accumulate occlusion with face form factor */
-					if(!exclude || !(face->obi == exclude->obi && face->facenr == exclude->facenr)) {
-						if(bentn || distfac != 0.0f) {
+					if (!exclude || !(face->obi == exclude->obi && face->facenr == exclude->facenr)) {
+						if (bentn || distfac != 0.0f) {
 							occ_face(face, co, NULL, NULL); 
 							sub_v3_v3v3(v, co, p);
 							d2= dot_v3v3(v, v) + 1e-16f;
 
 							fac= (distfac == 0.0f)? 1.0f: 1.0f/(1.0f + distfac*d2);
-							if(fac < 0.01f)
+							if (fac < 0.01f)
 								continue;
 						}
 						else
@@ -1282,12 +1283,12 @@ static void occ_lookup(OcclusionTree *tree, int thread, OccFace *exclude, float
 
 						weight= occ_form_factor(face, p, n);
 
-						if(rad)
+						if (rad)
 							madd_v3_v3fl(resultrad, tree->rad[f], weight*fac);
 
 						weight *= tree->occlusion[f];
 
-						if(bentn) {
+						if (bentn) {
 							invd2= 1.0f/sqrtf(d2);
 							bentn[0] -= weight*invd2*v[0];
 							bentn[1] -= weight*invd2*v[1];
@@ -1297,7 +1298,7 @@ static void occ_lookup(OcclusionTree *tree, int thread, OccFace *exclude, float
 						resultocc += weight*fac;
 					}
 				}
-				else if(node->child[b].node) {
+				else if (node->child[b].node) {
 					/* push child on the stack */
 					stack[totstack++]= node->child[b].node;
 				}
@@ -1305,15 +1306,17 @@ static void occ_lookup(OcclusionTree *tree, int thread, OccFace *exclude, float
 		}
 	}
 
-	if(occ) *occ= resultocc;
-	if(rad) copy_v3_v3(rad, resultrad);
-	/*if(rad && exclude) {
+	if (occ) *occ= resultocc;
+	if (rad) copy_v3_v3(rad, resultrad);
+#if 0
+	if (rad && exclude) {
 		int a;
-		for(a=0; a<tree->totface; a++)
-			if((tree->face[a].obi == exclude->obi && tree->face[a].facenr == exclude->facenr))
+		for (a=0; a<tree->totface; a++)
+			if ((tree->face[a].obi == exclude->obi && tree->face[a].facenr == exclude->facenr))
 				copy_v3_v3(rad, tree->rad[a]);
-	}*/
-	if(bentn) normalize_v3(bentn);
+	}
+#endif
+	if (bentn) normalize_v3(bentn);
 }
 
 static void occ_compute_bounces(Render *re, OcclusionTree *tree, int totbounce)
@@ -1324,8 +1327,8 @@ static void occ_compute_bounces(Render *re, OcclusionTree *tree, int totbounce)
 	rad= MEM_callocN(sizeof(float)*3*tree->totface, "OcclusionBounceRad");
 	sum= MEM_dupallocN(tree->rad);
 
-	for(bounce=1; bounce<totbounce; bounce++) {
-		for(i=0; i<tree->totface; i++) {
+	for (bounce=1; bounce<totbounce; bounce++) {
+		for (i=0; i<tree->totface; i++) {
 			occ_face(&tree->face[i], co, n, NULL);
 			madd_v3_v3fl(co, n, 1e-8f);
 
@@ -1335,11 +1338,11 @@ static void occ_compute_bounces(Render *re, OcclusionTree *tree, int totbounce)
 			rad[i][2]= MAX2(rad[i][2], 0.0f);
 			add_v3_v3(sum[i], rad[i]);
 
-			if(re->test_break(re->tbh))
+			if (re->test_break(re->tbh))
 				break;
 		}
 
-		if(re->test_break(re->tbh))
+		if (re->test_break(re->tbh))
 			break;
 
 		tmp= tree->rad;
@@ -1353,7 +1356,7 @@ static void occ_compute_bounces(Render *re, OcclusionTree *tree, int totbounce)
 	MEM_freeN(tree->rad);
 	tree->rad= sum;
 
-	if(!re->test_break(re->tbh))
+	if (!re->test_break(re->tbh))
 		occ_sum_occlusion(tree, tree->root);
 }
 
@@ -1364,23 +1367,23 @@ static void occ_compute_passes(Render *re, OcclusionTree *tree, int totpass)
 	
 	occ= MEM_callocN(sizeof(float)*tree->totface, "OcclusionPassOcc");
 
-	for(pass=0; pass<totpass; pass++) {
-		for(i=0; i<tree->totface; i++) {
+	for (pass=0; pass<totpass; pass++) {
+		for (i=0; i<tree->totface; i++) {
 			occ_face(&tree->face[i], co, n, NULL);
 			negate_v3(n);
 			madd_v3_v3fl(co, n, 1e-8f);
 
 			occ_lookup(tree, 0, &tree->face[i], co, n, &occ[i], NULL, NULL);
-			if(re->test_break(re->tbh))
+			if (re->test_break(re->tbh))
 				break;
 		}
 
-		if(re->test_break(re->tbh))
+		if (re->test_break(re->tbh))
 			break;
 
-		for(i=0; i<tree->totface; i++) {
+		for (i=0; i<tree->totface; i++) {
 			tree->occlusion[i] -= occ[i]; //MAX2(1.0f-occ[i], 0.0f);
-			if(tree->occlusion[i] < 0.0f)
+			if (tree->occlusion[i] < 0.0f)
 				tree->occlusion[i]= 0.0f;
 		}
 
@@ -1396,7 +1399,7 @@ static void sample_occ_tree(Render *re, OcclusionTree *tree, OccFace *exclude, f
 	int envcolor;
 
 	envcolor= re->wrld.aocolor;
-	if(onlyshadow)
+	if (onlyshadow)
 		envcolor= WO_AOPLAIN;
 
 	negate_v3_v3(nn, n);
@@ -1407,12 +1410,12 @@ static void sample_occ_tree(Render *re, OcclusionTree *tree, OccFace *exclude, f
 
 	occlusion= (1.0f-correction)*(1.0f-occ);
 	CLAMP(occlusion, 0.0f, 1.0f);
-	if(correction != 0.0f)
+	if (correction != 0.0f)
 		occlusion += correction*expf(-occ);
 
-	if(env) {
+	if (env) {
 		/* sky shading using bent normal */
-		if(ELEM(envcolor, WO_AOSKYCOL, WO_AOSKYTEX)) {
+		if (ELEM(envcolor, WO_AOSKYCOL, WO_AOSKYTEX)) {
 			fac= 0.5f * (1.0f + dot_v3v3(bn, re->grvec));
 			env[0]= (1.0f-fac)*re->wrld.horr + fac*re->wrld.zenr;
 			env[1]= (1.0f-fac)*re->wrld.horg + fac*re->wrld.zeng;
@@ -1439,13 +1442,13 @@ static void sample_occ_tree(Render *re, OcclusionTree *tree, OccFace *exclude, f
 #endif
 	}
 
-	if(ao) {
+	if (ao) {
 		ao[0]= occlusion;
 		ao[1]= occlusion;
 		ao[2]= occlusion;
 	}
 
-	if(tree->doindirect) copy_v3_v3(indirect, rad);
+	if (tree->doindirect) copy_v3_v3(indirect, rad);
 	else zero_v3(indirect);
 }
 
@@ -1461,7 +1464,7 @@ static OcclusionCacheSample *find_occ_sample(OcclusionCache *cache, int x, int y
 	x *= cache->step;
 	y *= cache->step;
 
-	if(x < 0 || x >= cache->w || y < 0 || y >= cache->h)
+	if (x < 0 || x >= cache->w || y < 0 || y >= cache->h)
 		return NULL;
 	else
 		return &cache->sample[y*cache->w + x];
@@ -1475,18 +1478,18 @@ static int sample_occ_cache(OcclusionTree *tree, float *co, float *n, int x, int
 	float d[3], dist2;
 	int i, x1, y1, x2, y2;
 
-	if(!tree->cache)
+	if (!tree->cache)
 		return 0;
 	
 	/* first try to find a sample in the same pixel */
 	cache= &tree->cache[thread];
 
-	if(cache->sample && cache->step) {
+	if (cache->sample && cache->step) {
 		sample= &cache->sample[(y-cache->y)*cache->w + (x-cache->x)];
-		if(sample->filled) {
+		if (sample->filled) {
 			sub_v3_v3v3(d, sample->co, co);
 			dist2= dot_v3v3(d, d);
-			if(dist2 < 0.5f*sample->dist2 && dot_v3v3(sample->n, n) > 0.98f) {
+			if (dist2 < 0.5f*sample->dist2 && dot_v3v3(sample->n, n) > 0.98f) {
 				copy_v3_v3(ao, sample->ao);
 				copy_v3_v3(env, sample->env);
 				copy_v3_v3(indirect, sample->indirect);
@@ -1497,21 +1500,21 @@ static int sample_occ_cache(OcclusionTree *tree, float *co, float *n, int x, int
 	else
 		return 0;
 
-	/* try to interpolate between 4 neighbouring pixels */
+	/* try to interpolate between 4 neighboring pixels */
 	samples[0]= find_occ_sample(cache, x, y);
 	samples[1]= find_occ_sample(cache, x+cache->step, y);
 	samples[2]= find_occ_sample(cache, x, y+cache->step);
 	samples[3]= find_occ_sample(cache, x+cache->step, y+cache->step);
 
-	for(i=0; i<4; i++)
-		if(!samples[i] || !samples[i]->filled)
+	for (i=0; i<4; i++)
+		if (!samples[i] || !samples[i]->filled)
 			return 0;
 
 	/* require intensities not being too different */
 	mino= MIN4(samples[0]->intensity, samples[1]->intensity, samples[2]->intensity, samples[3]->intensity);
 	maxo= MAX4(samples[0]->intensity, samples[1]->intensity, samples[2]->intensity, samples[3]->intensity);
 
-	if(maxo - mino > 0.05f)
+	if (maxo - mino > 0.05f)
 		return 0;
 
 	/* compute weighted interpolation between samples */
@@ -1533,7 +1536,7 @@ static int sample_occ_cache(OcclusionTree *tree, float *co, float *n, int x, int
 	wb[1]= (1.0f-tx)*(ty);
 	wb[0]= tx*ty;
 
-	for(i=0; i<4; i++) {
+	for (i=0; i<4; i++) {
 		sub_v3_v3v3(d, samples[i]->co, co);
 		//dist2= dot_v3v3(d, d);
 
@@ -1548,7 +1551,7 @@ static int sample_occ_cache(OcclusionTree *tree, float *co, float *n, int x, int
 		madd_v3_v3fl(indirect, samples[i]->indirect, w);
 	}
 
-	if(totw >= 0.9f) {
+	if (totw >= 0.9f) {
 		totw= 1.0f/totw;
 		mul_v3_fl(ao, totw);
 		mul_v3_fl(env, totw);
@@ -1566,7 +1569,7 @@ static void sample_occ_surface(ShadeInput *shi)
 	int *face, *index = RE_strandren_get_face(shi->obr, strand, 0);
 	float w[4], *co1, *co2, *co3, *co4;
 
-	if(mesh && mesh->face && mesh->co && mesh->ao && index) {
+	if (mesh && mesh->face && mesh->co && mesh->ao && index) {
 		face= mesh->face[*index];
 
 		co1= mesh->co[face[0]];
@@ -1589,7 +1592,7 @@ static void sample_occ_surface(ShadeInput *shi)
 		madd_v3_v3fl(shi->ao, mesh->ao[face[2]], w[2]);
 		madd_v3_v3fl(shi->env, mesh->env[face[2]], w[2]);
 		madd_v3_v3fl(shi->indirect, mesh->indirect[face[2]], w[2]);
-		if(face[3]) {
+		if (face[3]) {
 			madd_v3_v3fl(shi->ao, mesh->ao[face[3]], w[3]);
 			madd_v3_v3fl(shi->env, mesh->env[face[3]], w[3]);
 			madd_v3_v3fl(shi->indirect, mesh->indirect[face[3]], w[3]);
@@ -1614,13 +1617,13 @@ static void *exec_strandsurface_sample(void *data)
 	float ao[3], env[3], indirect[3], co[3], n[3], *co1, *co2, *co3, *co4;
 	int a, *face;
 
-	for(a=othread->begin; a<othread->end; a++) {
+	for (a=othread->begin; a<othread->end; a++) {
 		face= mesh->face[a];
 		co1= mesh->co[face[0]];
 		co2= mesh->co[face[1]];
 		co3= mesh->co[face[2]];
 
-		if(face[3]) {
+		if (face[3]) {
 			co4= mesh->co[face[3]];
 
 			mid_v3_v3v3(co, co1, co3);
@@ -1658,14 +1661,14 @@ void make_occ_tree(Render *re)
 	
 	re->occlusiontree= tree= occ_tree_build(re);
 	
-	if(tree) {
-		if(re->wrld.ao_approx_passes > 0)
+	if (tree) {
+		if (re->wrld.ao_approx_passes > 0)
 			occ_compute_passes(re, tree, re->wrld.ao_approx_passes);
-		if(tree->doindirect && (re->wrld.mode & WO_INDIRECT_LIGHT))
+		if (tree->doindirect && (re->wrld.mode & WO_INDIRECT_LIGHT))
 			occ_compute_bounces(re, tree, re->wrld.ao_indirect_bounces);
 
-		for(mesh=re->strandsurface.first; mesh; mesh=mesh->next) {
-			if(!mesh->face || !mesh->co || !mesh->ao)
+		for (mesh=re->strandsurface.first; mesh; mesh=mesh->next) {
+			if (!mesh->face || !mesh->co || !mesh->ao)
 				continue;
 
 			count= MEM_callocN(sizeof(int)*mesh->totvert, "OcclusionCount");
@@ -1675,7 +1678,7 @@ void make_occ_tree(Render *re)
 
 			totthread= (mesh->totface > 10000)? re->r.threads: 1;
 			totface= mesh->totface/totthread;
-			for(a=0; a<totthread; a++) {
+			for (a=0; a<totthread; a++) {
 				othreads[a].re= re;
 				othreads[a].faceao= faceao;
 				othreads[a].faceenv= faceenv;
@@ -1686,19 +1689,19 @@ void make_occ_tree(Render *re)
 				othreads[a].end= (a == totthread-1)? mesh->totface: (a+1)*totface;
 			}
 
-			if(totthread == 1) {
+			if (totthread == 1) {
 				exec_strandsurface_sample(&othreads[0]);
 			}
 			else {
 				BLI_init_threads(&threads, exec_strandsurface_sample, totthread);
 
-				for(a=0; a<totthread; a++)
+				for (a=0; a<totthread; a++)
 					BLI_insert_thread(&threads, &othreads[a]);
 
 				BLI_end_threads(&threads);
 			}
 
-			for(a=0; a<mesh->totface; a++) {
+			for (a=0; a<mesh->totface; a++) {
 				face= mesh->face[a];
 
 				copy_v3_v3(ao, faceao[a]);
@@ -1718,7 +1721,7 @@ void make_occ_tree(Render *re)
 				add_v3_v3(mesh->indirect[face[2]], indirect);
 				count[face[2]]++;
 
-				if(face[3]) {
+				if (face[3]) {
 					add_v3_v3(mesh->ao[face[3]], ao);
 					add_v3_v3(mesh->env[face[3]], env);
 					add_v3_v3(mesh->indirect[face[3]], indirect);
@@ -1726,8 +1729,8 @@ void make_occ_tree(Render *re)
 				}
 			}
 
-			for(a=0; a<mesh->totvert; a++) {
-				if(count[a]) {
+			for (a=0; a<mesh->totvert; a++) {
+				if (count[a]) {
 					mul_v3_fl(mesh->ao[a], 1.0f/count[a]);
 					mul_v3_fl(mesh->env[a], 1.0f/count[a]);
 					mul_v3_fl(mesh->indirect[a], 1.0f/count[a]);
@@ -1744,7 +1747,7 @@ void make_occ_tree(Render *re)
 
 void free_occ(Render *re)
 {
-	if(re->occlusiontree) {
+	if (re->occlusiontree) {
 		occ_free_tree(re->occlusiontree);
 		re->occlusiontree = NULL;
 	}
@@ -1758,12 +1761,12 @@ void sample_occ(Render *re, ShadeInput *shi)
 	OccFace exclude;
 	int onlyshadow;
 
-	if(tree) {
-		if(shi->strand) {
+	if (tree) {
+		if (shi->strand) {
 			sample_occ_surface(shi);
 		}
 		/* try to get result from the cache if possible */
-		else if(shi->depth!=0 || !sample_occ_cache(tree, shi->co, shi->vno, shi->xs, shi->ys, shi->thread, shi->ao, shi->env, shi->indirect)) {
+		else if (shi->depth!=0 || !sample_occ_cache(tree, shi->co, shi->vno, shi->xs, shi->ys, shi->thread, shi->ao, shi->env, shi->indirect)) {
 			/* no luck, let's sample the occlusion */
 			exclude.obi= shi->obi - re->objectinstance;
 			exclude.facenr= shi->vlr->index;
@@ -1771,10 +1774,10 @@ void sample_occ(Render *re, ShadeInput *shi)
 			sample_occ_tree(re, tree, &exclude, shi->co, shi->vno, shi->thread, onlyshadow, shi->ao, shi->env, shi->indirect);
 
 			/* fill result into sample, each time */
-			if(tree->cache) {
+			if (tree->cache) {
 				cache= &tree->cache[shi->thread];
 
-				if(cache->sample && cache->step) {
+				if (cache->sample && cache->step) {
 					sample= &cache->sample[(shi->ys-cache->y)*cache->w + (shi->xs-cache->x)];
 					copy_v3_v3(sample->co, shi->co);
 					copy_v3_v3(sample->n, shi->vno);
@@ -1817,7 +1820,7 @@ void cache_occ_samples(Render *re, RenderPart *pa, ShadeSample *ssamp)
 	int *ro=NULL, *rp=NULL, *rz=NULL, onlyshadow;
 	int x, y, step = CACHE_STEP;
 
-	if(!tree->cache)
+	if (!tree->cache)
 		return;
 
 	cache= &tree->cache[pa->thread];
@@ -1829,7 +1832,7 @@ void cache_occ_samples(Render *re, RenderPart *pa, ShadeSample *ssamp)
 	cache->sample= MEM_callocN(sizeof(OcclusionCacheSample)*cache->w*cache->h, "OcclusionCacheSample");
 	sample= cache->sample;
 
-	if(re->osa) {
+	if (re->osa) {
 		rd= pa->rectdaps;
 	}
 	else {
@@ -1843,20 +1846,20 @@ void cache_occ_samples(Render *re, RenderPart *pa, ShadeSample *ssamp)
 	}
 
 	/* compute a sample at every step pixels */
-	for(y=pa->disprect.ymin; y<pa->disprect.ymax; y++) {
-		for(x=pa->disprect.xmin; x<pa->disprect.xmax; x++, sample++, rd++, ro++, rp++, rz++) {
-			if(!(((x - pa->disprect.xmin + step) % step) == 0 || x == pa->disprect.xmax-1))
+	for (y=pa->disprect.ymin; y<pa->disprect.ymax; y++) {
+		for (x=pa->disprect.xmin; x<pa->disprect.xmax; x++, sample++, rd++, ro++, rp++, rz++) {
+			if (!(((x - pa->disprect.xmin + step) % step) == 0 || x == pa->disprect.xmax-1))
 				continue;
-			if(!(((y - pa->disprect.ymin + step) % step) == 0 || y == pa->disprect.ymax-1))
+			if (!(((y - pa->disprect.ymin + step) % step) == 0 || y == pa->disprect.ymax-1))
 				continue;
 
-			if(re->osa) {
-				if(!*rd) continue;
+			if (re->osa) {
+				if (!*rd) continue;
 
 				shade_samples_fill_with_ps(ssamp, (PixStr *)(*rd), x, y);
 			}
 			else {
-				if(!*rp) continue;
+				if (!*rp) continue;
 
 				ps.obi= *ro;
 				ps.facenr= *rp;
@@ -1865,7 +1868,7 @@ void cache_occ_samples(Render *re, RenderPart *pa, ShadeSample *ssamp)
 			}
 
 			shi= ssamp->shi;
-			if(shi->vlr) {
+			if (shi->vlr) {
 				onlyshadow= (shi->mat->mode & MA_ONLYSHADOW);
 				exclude.obi= shi->obi - re->objectinstance;
 				exclude.facenr= shi->vlr->index;
@@ -1885,7 +1888,7 @@ void cache_occ_samples(Render *re, RenderPart *pa, ShadeSample *ssamp)
 				sample->filled= 1;
 			}
 
-			if(re->test_break(re->tbh))
+			if (re->test_break(re->tbh))
 				break;
 		}
 	}
@@ -1896,10 +1899,10 @@ void free_occ_samples(Render *re, RenderPart *pa)
 	OcclusionTree *tree= re->occlusiontree;
 	OcclusionCache *cache;
 
-	if(tree->cache) {
+	if (tree->cache) {
 		cache= &tree->cache[pa->thread];
 
-		if(cache->sample)
+		if (cache->sample)
 			MEM_freeN(cache->sample);
 
 		cache->w= 0;
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 100b12a..a4a244d 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -86,31 +86,30 @@
 #include "pixelblending.h"
 #include "zbuf.h"
 
-
 /* render flow
-
-1) Initialize state
-- state data, tables
-- movie/image file init
-- everything that doesn't change during animation
-
-2) Initialize data
-- camera, world, matrices
-- make render verts, faces, halos, strands
-- everything can change per frame/field
-
-3) Render Processor
-- multiple layers
-- tiles, rect, baking
-- layers/tiles optionally to disk or directly in Render Result
-
-4) Composite Render Result
-- also read external files etc
-
-5) Image Files
-- save file or append in movie
-
-*/
+ *
+ * 1) Initialize state
+ * - state data, tables
+ * - movie/image file init
+ * - everything that doesn't change during animation
+ *
+ * 2) Initialize data
+ * - camera, world, matrices
+ * - make render verts, faces, halos, strands
+ * - everything can change per frame/field
+ *
+ * 3) Render Processor
+ * - multiple layers
+ * - tiles, rect, baking
+ * - layers/tiles optionally to disk or directly in Render Result
+ *
+ * 4) Composite Render Result
+ * - also read external files etc
+ *
+ * 5) Image Files
+ * - save file or append in movie
+ *
+ */
 
 
 /* ********* globals ******** */
@@ -159,16 +158,16 @@ static void stats_background(void *UNUSED(arg), RenderStats *rs)
 	fprintf(stdout, "Fra:%d Mem:%.2fM (%.2fM, peak %.2fM) ", rs->cfra,
 	        megs_used_memory, mmap_used_memory, megs_peak_memory);
 
-	if(rs->curfield)
+	if (rs->curfield)
 		fprintf(stdout, "Field %d ", rs->curfield);
-	if(rs->curblur)
+	if (rs->curblur)
 		fprintf(stdout, "Blur %d ", rs->curblur);
 
-	if(rs->infostr) {
+	if (rs->infostr) {
 		fprintf(stdout, "| %s", rs->infostr);
 	}
 	else {
-		if(rs->tothalo)
+		if (rs->tothalo)
 			fprintf(stdout, "Sce: %s Ve:%d Fa:%d Ha:%d La:%d", rs->scenename, rs->totvert, rs->totface, rs->tothalo, rs->totlamp);
 		else
 			fprintf(stdout, "Sce: %s Ve:%d Fa:%d La:%d", rs->scenename, rs->totvert, rs->totface, rs->totlamp);
@@ -189,8 +188,8 @@ float *RE_RenderLayerGetPass(RenderLayer *rl, int passtype)
 {
 	RenderPass *rpass;
 	
-	for(rpass=rl->passes.first; rpass; rpass= rpass->next)
-		if(rpass->passtype== passtype)
+	for (rpass=rl->passes.first; rpass; rpass= rpass->next)
+		if (rpass->passtype== passtype)
 			return rpass->rect;
 	return NULL;
 }
@@ -199,10 +198,10 @@ RenderLayer *RE_GetRenderLayer(RenderResult *rr, const char *name)
 {
 	RenderLayer *rl;
 	
-	if(rr==NULL) return NULL;
+	if (rr==NULL) return NULL;
 	
-	for(rl= rr->layers.first; rl; rl= rl->next)
-		if(strncmp(rl->name, name, RE_MAXNAME)==0)
+	for (rl= rr->layers.first; rl; rl= rl->next)
+		if (strncmp(rl->name, name, RE_MAXNAME)==0)
 			return rl;
 	return NULL;
 }
@@ -216,7 +215,7 @@ RenderLayer *render_get_active_layer(Render *re, RenderResult *rr)
 {
 	RenderLayer *rl= BLI_findlink(&rr->layers, re->r.actlay);
 	
-	if(rl) 
+	if (rl)
 		return rl;
 	else 
 		return rr->layers.first;
@@ -226,9 +225,9 @@ static int render_scene_needs_vector(Render *re)
 {
 	SceneRenderLayer *srl;
 	
-	for(srl= re->scene->r.layers.first; srl; srl= srl->next)
-		if(!(srl->layflag & SCE_LAY_DISABLE))
-			if(srl->passflag & SCE_PASS_VECTOR)
+	for (srl= re->scene->r.layers.first; srl; srl= srl->next)
+		if (!(srl->layflag & SCE_LAY_DISABLE))
+			if (srl->passflag & SCE_PASS_VECTOR)
 				return 1;
 
 	return 0;
@@ -241,8 +240,8 @@ Render *RE_GetRender(const char *name)
 	Render *re;
 
 	/* search for existing renders */
-	for(re= RenderGlobal.renderlist.first; re; re= re->next)
-		if(strncmp(re->name, name, RE_MAXNAME)==0)
+	for (re= RenderGlobal.renderlist.first; re; re= re->next)
+		if (strncmp(re->name, name, RE_MAXNAME)==0)
 			break;
 
 	return re;
@@ -251,7 +250,7 @@ Render *RE_GetRender(const char *name)
 /* if you want to know exactly what has been done */
 RenderResult *RE_AcquireResultRead(Render *re)
 {
-	if(re) {
+	if (re) {
 		BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_READ);
 		return re->result;
 	}
@@ -261,7 +260,7 @@ RenderResult *RE_AcquireResultRead(Render *re)
 
 RenderResult *RE_AcquireResultWrite(Render *re)
 {
-	if(re) {
+	if (re) {
 		BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
 		return re->result;
 	}
@@ -272,7 +271,7 @@ RenderResult *RE_AcquireResultWrite(Render *re)
 void RE_SwapResult(Render *re, RenderResult **rr)
 {
 	/* for keeping render buffers */
-	if(re) {
+	if (re) {
 		SWAP(RenderResult*, re->result, *rr);
 	}
 }
@@ -280,14 +279,14 @@ void RE_SwapResult(Render *re, RenderResult **rr)
 
 void RE_ReleaseResult(Render *re)
 {
-	if(re)
+	if (re)
 		BLI_rw_mutex_unlock(&re->resultmutex);
 }
 
 /* displist.c util.... */
 Scene *RE_GetScene(Render *re)
 {
-	if(re)
+	if (re)
 		return re->scene;
 	return NULL;
 }
@@ -297,10 +296,10 @@ void RE_AcquireResultImage(Render *re, RenderResult *rr)
 {
 	memset(rr, 0, sizeof(RenderResult));
 
-	if(re) {
+	if (re) {
 		BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_READ);
 
-		if(re->result) {
+		if (re->result) {
 			RenderLayer *rl;
 			
 			rr->rectx= re->result->rectx;
@@ -313,10 +312,10 @@ void RE_AcquireResultImage(Render *re, RenderResult *rr)
 			/* active layer */
 			rl= render_get_active_layer(re, re->result);
 
-			if(rl) {
-				if(rr->rectf==NULL)
+			if (rl) {
+				if (rr->rectf==NULL)
 					rr->rectf= rl->rectf;
-				if(rr->rectz==NULL)
+				if (rr->rectz==NULL)
 					rr->rectz= RE_RenderLayerGetPass(rl, SCE_PASS_Z);	
 			}
 
@@ -328,7 +327,7 @@ void RE_AcquireResultImage(Render *re, RenderResult *rr)
 
 void RE_ReleaseResultImage(Render *re)
 {
-	if(re)
+	if (re)
 		BLI_rw_mutex_unlock(&re->resultmutex);
 }
 
@@ -353,7 +352,7 @@ Render *RE_NewRender(const char *name)
 
 	/* only one render per name exists */
 	re= RE_GetRender(name);
-	if(re==NULL) {
+	if (re==NULL) {
 		
 		/* new render data struct */
 		re= MEM_callocN(sizeof(Render), "new render");
@@ -371,7 +370,7 @@ Render *RE_NewRender(const char *name)
 }
 
 /* called for new renders and when finishing rendering so
- * we calways have valid callbacks on a render */
+ * we always have valid callbacks on a render */
 void RE_InitRenderCB(Render *re)
 {
 	/* set default empty callbacks */
@@ -380,7 +379,7 @@ void RE_InitRenderCB(Render *re)
 	re->display_draw= result_rcti_nothing;
 	re->progress= float_nothing;
 	re->test_break= default_break;
-	if(G.background)
+	if (G.background)
 		re->stats_draw= stats_background;
 	else
 		re->stats_draw= stats_nothing;
@@ -406,11 +405,25 @@ void RE_FreeRender(Render *re)
 /* exit blender */
 void RE_FreeAllRender(void)
 {
-	while(RenderGlobal.renderlist.first) {
+	while (RenderGlobal.renderlist.first) {
 		RE_FreeRender(RenderGlobal.renderlist.first);
 	}
 }
 
+/* on file load, free all re */
+void RE_FreeAllRenderResults(void)
+{
+	Render *re;
+
+	for (re = RenderGlobal.renderlist.first; re; re = re->next) {
+		render_result_free(re->result);
+		render_result_free(re->pushedresult);
+
+		re->result = NULL;
+		re->pushedresult = NULL;
+	}
+}
+
 /* ********* initialize state ******** */
 
 
@@ -425,36 +438,35 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, SceneRenderLayer *
 	
 	re->winx= winx;
 	re->winy= winy;
-	if(disprect) {
+	if (disprect) {
 		re->disprect= *disprect;
 		re->rectx= disprect->xmax-disprect->xmin;
 		re->recty= disprect->ymax-disprect->ymin;
 	}
 	else {
-		re->disprect.xmin= re->disprect.ymin= 0;
-		re->disprect.xmax= winx;
-		re->disprect.ymax= winy;
+		re->disprect.xmin = re->disprect.ymin = 0;
+		re->disprect.xmax = winx;
+		re->disprect.ymax = winy;
 		re->rectx= winx;
 		re->recty= winy;
 	}
 	
-	if(re->rectx < 2 || re->recty < 2 || (BKE_imtype_is_movie(rd->im_format.imtype) &&
+	if (re->rectx < 2 || re->recty < 2 || (BKE_imtype_is_movie(rd->im_format.imtype) &&
 										  (re->rectx < 16 || re->recty < 16) )) {
 		BKE_report(re->reports, RPT_ERROR, "Image too small");
 		re->ok= 0;
 		return;
 	}
 
-	if((re->r.mode & (R_OSA))==0)
+	if ((re->r.mode & (R_OSA))==0)
 		re->r.scemode &= ~R_FULL_SAMPLE;
 
 #ifdef WITH_OPENEXR
-	if(re->r.scemode & R_FULL_SAMPLE)
+	if (re->r.scemode & R_FULL_SAMPLE)
 		re->r.scemode |= R_EXR_TILE_FILE;	/* enable automatic */
 
 	/* Until use_border is made compatible with save_buffers/full_sample, render without the later instead of not rendering at all.*/
-	if(re->r.mode & R_BORDER) 
-	{
+	if (re->r.mode & R_BORDER) {
 		re->r.scemode &= ~(R_EXR_TILE_FILE|R_FULL_SAMPLE);
 	}
 
@@ -464,18 +476,18 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, SceneRenderLayer *
 #endif
 	
 	/* fullsample wants uniform osa levels */
-	if(source && (re->r.scemode & R_FULL_SAMPLE)) {
+	if (source && (re->r.scemode & R_FULL_SAMPLE)) {
 		/* but, if source has no full sample we disable it */
-		if((source->r.scemode & R_FULL_SAMPLE)==0)
+		if ((source->r.scemode & R_FULL_SAMPLE)==0)
 			re->r.scemode &= ~R_FULL_SAMPLE;
 		else
 			re->r.osa= re->osa= source->osa;
 	}
 	else {
 		/* check state variables, osa? */
-		if(re->r.mode & (R_OSA)) {
+		if (re->r.mode & (R_OSA)) {
 			re->osa= re->r.osa;
-			if(re->osa>16) re->osa= 16;
+			if (re->osa>16) re->osa= 16;
 		}
 		else re->osa= 0;
 	}
@@ -494,8 +506,8 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, SceneRenderLayer *
 	/* if preview render, we try to keep old result */
 	BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
 
-	if(re->r.scemode & R_PREVIEWBUTS) {
-		if(re->result && re->result->rectx==re->rectx && re->result->recty==re->recty);
+	if (re->r.scemode & R_PREVIEWBUTS) {
+		if (re->result && re->result->rectx==re->rectx && re->result->recty==re->recty);
 		else {
 			render_result_free(re->result);
 			re->result= NULL;
@@ -608,7 +620,7 @@ void RE_AddObject(Render *UNUSED(re), Object *UNUSED(ob))
 static int render_display_draw_enabled(Render *re)
 {
 	/* don't show preprocess for previewrender sss */
-	if(re->sss_points)
+	if (re->sss_points)
 		return !(re->r.scemode & R_PREVIEWBUTS);
 	else
 		return 1;
@@ -620,27 +632,27 @@ static void *do_part_thread(void *pa_v)
 	RenderPart *pa= pa_v;
 	
 	/* need to return nicely all parts on esc */
-	if(R.test_break(R.tbh)==0) {
+	if (R.test_break(R.tbh)==0) {
 		
-		if(!R.sss_points && (R.r.scemode & R_FULL_SAMPLE))
+		if (!R.sss_points && (R.r.scemode & R_FULL_SAMPLE))
 			pa->result= render_result_new_full_sample(&R, &pa->fullresult, &pa->disprect, pa->crop, RR_USE_MEM);
 		else
 			pa->result= render_result_new(&R, &pa->disprect, pa->crop, RR_USE_MEM);
 
-		if(R.sss_points)
+		if (R.sss_points)
 			zbufshade_sss_tile(pa);
-		else if(R.osa)
+		else if (R.osa)
 			zbufshadeDA_tile(pa);
 		else
 			zbufshade_tile(pa);
 		
 		/* merge too on break! */
-		if(R.result->exrhandle) {
+		if (R.result->exrhandle) {
 			render_result_exr_file_merge(R.result, pa->result);
 		}
-		else if(render_display_draw_enabled(&R)) {
+		else if (render_display_draw_enabled(&R)) {
 			/* on break, don't merge in result for preview renders, looks nicer */
-			if(R.test_break(R.tbh) && (R.r.scemode & R_PREVIEWBUTS));
+			if (R.test_break(R.tbh) && (R.r.scemode & R_PREVIEWBUTS));
 			else render_result_merge(R.result, pa->result);
 		}
 	}
@@ -684,16 +696,16 @@ static RenderPart *find_next_pano_slice(Render *re, int *minx, rctf *viewplane)
 	*minx= re->winx;
 	
 	/* most left part of the non-rendering parts */
-	for(pa= re->parts.first; pa; pa= pa->next) {
-		if(pa->ready==0 && pa->nr==0) {
-			if(pa->disprect.xmin < *minx) {
+	for (pa= re->parts.first; pa; pa= pa->next) {
+		if (pa->ready==0 && pa->nr==0) {
+			if (pa->disprect.xmin < *minx) {
 				best= pa;
 				*minx= pa->disprect.xmin;
 			}
 		}
 	}
 			
-	if(best) {
+	if (best) {
 		float phi= panorama_pixel_rot(re);
 
 		R.panodxp= (re->winx - (best->disprect.xmin + best->disprect.xmax) )/2;
@@ -722,8 +734,8 @@ static RenderPart *find_next_part(Render *re, int minx)
 	long long int mindist= (long long int)re->winx * (long long int)re->winy;
 	
 	/* find center of rendered parts, image center counts for 1 too */
-	for(pa= re->parts.first; pa; pa= pa->next) {
-		if(pa->ready) {
+	for (pa= re->parts.first; pa; pa= pa->next) {
+		if (pa->ready) {
 			centx+= (pa->disprect.xmin+pa->disprect.xmax)/2;
 			centy+= (pa->disprect.ymin+pa->disprect.ymax)/2;
 			tot++;
@@ -733,14 +745,14 @@ static RenderPart *find_next_part(Render *re, int minx)
 	centy/=tot;
 	
 	/* closest of the non-rendering parts */
-	for(pa= re->parts.first; pa; pa= pa->next) {
-		if(pa->ready==0 && pa->nr==0) {
+	for (pa= re->parts.first; pa; pa= pa->next) {
+		if (pa->ready==0 && pa->nr==0) {
 			long long int distx= centx - (pa->disprect.xmin+pa->disprect.xmax)/2;
 			long long int disty= centy - (pa->disprect.ymin+pa->disprect.ymax)/2;
 			distx= (long long int)sqrt(distx*distx + disty*disty);
-			if(distx<mindist) {
-				if(re->r.mode & R_PANORAMA) {
-					if(pa->disprect.xmin==minx) {
+			if (distx<mindist) {
+				if (re->r.mode & R_PANORAMA) {
+					if (pa->disprect.xmin==minx) {
 						best= pa;
 						mindist= distx;
 					}
@@ -775,12 +787,12 @@ static void threaded_tile_processor(Render *re)
 	BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
 
 	/* first step; free the entire render result, make new, and/or prepare exr buffer saving */
-	if(re->result==NULL || !(re->r.scemode & R_PREVIEWBUTS)) {
+	if (re->result==NULL || !(re->r.scemode & R_PREVIEWBUTS)) {
 		render_result_free(re->result);
 	
-		if(re->sss_points && render_display_draw_enabled(re))
+		if (re->sss_points && render_display_draw_enabled(re))
 			re->result= render_result_new(re, &re->disprect, 0, RR_USE_MEM);
-		else if(re->r.scemode & R_FULL_SAMPLE)
+		else if (re->r.scemode & R_FULL_SAMPLE)
 			re->result= render_result_new_full_sample(re, &re->fullresult, &re->disprect, 0, RR_USE_EXR);
 		else
 			re->result= render_result_new(re, &re->disprect, 0,
@@ -789,14 +801,14 @@ static void threaded_tile_processor(Render *re)
 
 	BLI_rw_mutex_unlock(&re->resultmutex);
 	
-	if(re->result==NULL)
+	if (re->result==NULL)
 		return;
 	
 	/* warning; no return here without closing exr file */
 	
 	initparts(re);
 
-	if(re->result->exrhandle)
+	if (re->result->exrhandle)
 		render_result_exr_file_begin(re);
 	
 	BLI_init_threads(&threads, do_part_thread, re->r.threads);
@@ -808,16 +820,16 @@ static void threaded_tile_processor(Render *re)
 	R.test_break= thread_break;
 	
 	/* timer loop demands to sleep when no parts are left, so we enter loop with a part */
-	if(re->r.mode & R_PANORAMA)
+	if (re->r.mode & R_PANORAMA)
 		nextpa= find_next_pano_slice(re, &minx, &viewplane);
 	else
 		nextpa= find_next_part(re, 0);
 	
-	while(rendering) {
+	while (rendering) {
 		
-		if(re->test_break(re->tbh))
+		if (re->test_break(re->tbh))
 			PIL_sleep_ms(50);
-		else if(nextpa && BLI_available_threads(&threads)) {
+		else if (nextpa && BLI_available_threads(&threads)) {
 			drawtimer= 0;
 			nextpa->nr= counter++;	/* for nicest part, and for stats */
 			nextpa->thread= BLI_available_thread_index(&threads);	/* sample index */
@@ -825,8 +837,8 @@ static void threaded_tile_processor(Render *re)
 
 			nextpa= find_next_part(re, minx);
 		}
-		else if(re->r.mode & R_PANORAMA) {
-			if(nextpa==NULL && BLI_available_threads(&threads)==re->r.threads)
+		else if (re->r.mode & R_PANORAMA) {
+			if (nextpa==NULL && BLI_available_threads(&threads)==re->r.threads)
 				nextpa= find_next_pano_slice(re, &minx, &viewplane);
 			else {
 				PIL_sleep_ms(50);
@@ -841,13 +853,13 @@ static void threaded_tile_processor(Render *re)
 		/* check for ready ones to display, and if we need to continue */
 		rendering= 0;
 		hasdrawn= 0;
-		for(pa= re->parts.first; pa; pa= pa->next) {
-			if(pa->ready) {
+		for (pa= re->parts.first; pa; pa= pa->next) {
+			if (pa->ready) {
 				
 				BLI_remove_thread(&threads, pa);
 				
-				if(pa->result) {
-					if(render_display_draw_enabled(re))
+				if (pa->result) {
+					if (render_display_draw_enabled(re))
 						re->display_draw(re->ddh, pa->result, NULL);
 					print_part_stats(re, pa);
 					
@@ -860,23 +872,23 @@ static void threaded_tile_processor(Render *re)
 			}
 			else {
 				rendering= 1;
-				if(pa->nr && pa->result && drawtimer>20) {
-					if(render_display_draw_enabled(re))
+				if (pa->nr && pa->result && drawtimer>20) {
+					if (render_display_draw_enabled(re))
 						re->display_draw(re->ddh, pa->result, &pa->result->renrect);
 					hasdrawn= 1;
 				}
 			}
 		}
-		if(hasdrawn)
+		if (hasdrawn)
 			drawtimer= 0;
 
 		/* on break, wait for all slots to get freed */
-		if( (g_break=re->test_break(re->tbh)) && BLI_available_threads(&threads)==re->r.threads)
+		if ( (g_break=re->test_break(re->tbh)) && BLI_available_threads(&threads)==re->r.threads)
 			rendering= 0;
 		
 	}
 	
-	if(re->result->exrhandle) {
+	if (re->result->exrhandle) {
 		BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
 		render_result_exr_file_end(re);
 		BLI_rw_mutex_unlock(&re->resultmutex);
@@ -901,7 +913,7 @@ void RE_TileProcessor(Render *re)
 static void do_render_3d(Render *re)
 {
 	/* try external */
-	if(RE_engine_render(re, 0))
+	if (RE_engine_render(re, 0))
 		return;
 
 	/* internal */
@@ -910,24 +922,24 @@ static void do_render_3d(Render *re)
 	re->scene->r.subframe = re->mblur_offs + re->field_offs;
 	
 	/* lock drawing in UI during data phase */
-	if(re->draw_lock)
+	if (re->draw_lock)
 		re->draw_lock(re->dlh, 1);
 	
 	/* make render verts/faces/halos/lamps */
-	if(render_scene_needs_vector(re))
+	if (render_scene_needs_vector(re))
 		RE_Database_FromScene_Vectors(re, re->main, re->scene, re->lay);
 	else
 		RE_Database_FromScene(re, re->main, re->scene, re->lay, 1);
 	
 	/* clear UI drawing locks */
-	if(re->draw_lock)
+	if (re->draw_lock)
 		re->draw_lock(re->dlh, 0);
 	
 	threaded_tile_processor(re);
 	
 	/* do left-over 3d post effects (flares) */
-	if(re->flag & R_HALO)
-		if(!re->test_break(re->tbh))
+	if (re->flag & R_HALO)
+		if (!re->test_break(re->tbh))
 			add_halo_flare(re);
 	
 	/* free all render verts etc */
@@ -943,17 +955,17 @@ static void addblur_rect_key(RenderResult *rr, float *rectf, float *rectf1, floa
 	int a, b, stride= 4*rr->rectx;
 	int len= stride*sizeof(float);
 	
-	for(a=0; a<rr->recty; a++) {
-		if(blurfac==1.0f) {
+	for (a=0; a<rr->recty; a++) {
+		if (blurfac==1.0f) {
 			memcpy(rectf, rectf1, len);
 		}
 		else {
 			float *rf= rectf, *rf1= rectf1;
 			
-			for( b= rr->rectx; b>0; b--, rf+=4, rf1+=4) {
-				if(rf1[3]<0.01f)
+			for ( b= rr->rectx; b>0; b--, rf+=4, rf1+=4) {
+				if (rf1[3]<0.01f)
 					rf[3]= mfac*rf[3];
-				else if(rf[3]<0.01f) {
+				else if (rf[3]<0.01f) {
 					rf[0]= rf1[0];
 					rf[1]= rf1[1];
 					rf[2]= rf1[2];
@@ -979,14 +991,14 @@ static void addblur_rect(RenderResult *rr, float *rectf, float *rectf1, float bl
 	int a, b, stride= channels*rr->rectx;
 	int len= stride*sizeof(float);
 	
-	for(a=0; a<rr->recty; a++) {
-		if(blurfac==1.0f) {
+	for (a=0; a<rr->recty; a++) {
+		if (blurfac==1.0f) {
 			memcpy(rectf, rectf1, len);
 		}
 		else {
 			float *rf= rectf, *rf1= rectf1;
 			
-			for( b= rr->rectx*channels; b>0; b--, rf++, rf1++) {
+			for ( b= rr->rectx*channels; b>0; b--, rf++, rf1++) {
 				rf[0]= mfac*rf[0] + blurfac*rf1[0];
 			}
 		}
@@ -1003,11 +1015,11 @@ static void merge_renderresult_blur(RenderResult *rr, RenderResult *brr, float b
 	RenderPass *rpass, *rpass1;
 	
 	rl1= brr->layers.first;
-	for(rl= rr->layers.first; rl && rl1; rl= rl->next, rl1= rl1->next) {
+	for (rl= rr->layers.first; rl && rl1; rl= rl->next, rl1= rl1->next) {
 		
 		/* combined */
-		if(rl->rectf && rl1->rectf) {
-			if(key_alpha)
+		if (rl->rectf && rl1->rectf) {
+			if (key_alpha)
 				addblur_rect_key(rr, rl->rectf, rl1->rectf, blurfac);
 			else
 				addblur_rect(rr, rl->rectf, rl1->rectf, blurfac, 4);
@@ -1015,7 +1027,7 @@ static void merge_renderresult_blur(RenderResult *rr, RenderResult *brr, float b
 		
 		/* passes are allocated in sync */
 		rpass1= rl1->passes.first;
-		for(rpass= rl->passes.first; rpass && rpass1; rpass= rpass->next, rpass1= rpass1->next) {
+		for (rpass= rl->passes.first; rpass && rpass1; rpass= rpass->next, rpass1= rpass1->next) {
 			addblur_rect(rr, rpass->rect, rpass1->rect, blurfac, rpass->channels);
 		}
 	}
@@ -1032,7 +1044,7 @@ static void do_render_blur_3d(Render *re)
 	rres= render_result_new(re, &re->disprect, 0, RR_USE_MEM);
 	
 	/* do the blur steps */
-	while(blur--) {
+	while (blur--) {
 		re->mblur_offs = re->r.blurfac*((float)(re->r.mblur_samples-blur))/(float)re->r.mblur_samples;
 		
 		re->i.curblur= re->r.mblur_samples-blur;	/* stats */
@@ -1042,7 +1054,7 @@ static void do_render_blur_3d(Render *re)
 		blurfac= 1.0f/(float)(re->r.mblur_samples-blur);
 		
 		merge_renderresult_blur(rres, re->result, blurfac, re->r.alphamode & R_ALPHAKEY);
-		if(re->test_break(re->tbh)) break;
+		if (re->test_break(re->tbh)) break;
 	}
 	
 	/* swap results */
@@ -1066,7 +1078,7 @@ static void interleave_rect(RenderResult *rr, float *rectf, float *rectf1, float
 	int a, stride= channels*rr->rectx;
 	int len= stride*sizeof(float);
 	
-	for(a=0; a<rr->recty; a+=2) {
+	for (a=0; a<rr->recty; a+=2) {
 		memcpy(rectf, rectf1, len);
 		rectf+= stride;
 		rectf1+= stride;
@@ -1084,16 +1096,16 @@ static void merge_renderresult_fields(RenderResult *rr, RenderResult *rr1, Rende
 	
 	rl1= rr1->layers.first;
 	rl2= rr2->layers.first;
-	for(rl= rr->layers.first; rl && rl1 && rl2; rl= rl->next, rl1= rl1->next, rl2= rl2->next) {
+	for (rl= rr->layers.first; rl && rl1 && rl2; rl= rl->next, rl1= rl1->next, rl2= rl2->next) {
 		
 		/* combined */
-		if(rl->rectf && rl1->rectf && rl2->rectf)
+		if (rl->rectf && rl1->rectf && rl2->rectf)
 			interleave_rect(rr, rl->rectf, rl1->rectf, rl2->rectf, 4);
 		
 		/* passes are allocated in sync */
 		rpass1= rl1->passes.first;
 		rpass2= rl2->passes.first;
-		for(rpass= rl->passes.first; rpass && rpass1 && rpass2; rpass= rpass->next, rpass1= rpass1->next, rpass2= rpass2->next) {
+		for (rpass= rl->passes.first; rpass && rpass1 && rpass2; rpass= rpass->next, rpass1= rpass1->next, rpass2= rpass2->next) {
 			interleave_rect(rr, rpass->rect, rpass1->rect, rpass2->rect, rpass->channels);
 		}
 	}
@@ -1116,7 +1128,7 @@ static void do_render_fields_3d(Render *re)
 	
 	/* first field, we have to call camera routine for correct aspect and subpixel offset */
 	RE_SetCamera(re, camera);
-	if(re->r.mode & R_MBLUR && (re->r.scemode & R_FULL_SAMPLE)==0)
+	if (re->r.mode & R_MBLUR && (re->r.scemode & R_FULL_SAMPLE)==0)
 		do_render_blur_3d(re);
 	else
 		do_render_3d(re);
@@ -1127,16 +1139,16 @@ static void do_render_fields_3d(Render *re)
 	BLI_rw_mutex_unlock(&re->resultmutex);
 	
 	/* second field */
-	if(!re->test_break(re->tbh)) {
+	if (!re->test_break(re->tbh)) {
 		
 		re->i.curfield= 2;	/* stats */
 		
 		re->flag |= R_SEC_FIELD;
-		if((re->r.mode & R_FIELDSTILL)==0) {
+		if ((re->r.mode & R_FIELDSTILL)==0) {
 			re->field_offs = 0.5f;
 		}
 		RE_SetCamera(re, camera);
-		if(re->r.mode & R_MBLUR && (re->r.scemode & R_FULL_SAMPLE)==0)
+		if (re->r.mode & R_MBLUR && (re->r.scemode & R_FULL_SAMPLE)==0)
 			do_render_blur_3d(re);
 		else
 			do_render_3d(re);
@@ -1156,8 +1168,8 @@ static void do_render_fields_3d(Render *re)
 	BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
 	re->result= render_result_new(re, &re->disprect, 0, RR_USE_MEM);
 
-	if(rr2) {
-		if(re->r.mode & R_ODDFIELD)
+	if (rr2) {
+		if (re->r.mode & R_ODDFIELD)
 			merge_renderresult_fields(re->result, rr2, rr1);
 		else
 			merge_renderresult_fields(re->result, rr1, rr2);
@@ -1182,7 +1194,7 @@ static void do_render_fields_blur_3d(Render *re)
 {
 	Object *camera= RE_GetCamera(re);
 	/* also check for camera here */
-	if(camera == NULL) {
+	if (camera == NULL) {
 		printf("ERROR: Cannot render, no camera\n");
 		G.afbreek= 1;
 		return;
@@ -1191,17 +1203,17 @@ static void do_render_fields_blur_3d(Render *re)
 	/* now use renderdata and camera to set viewplane */
 	RE_SetCamera(re, camera);
 	
-	if(re->r.mode & R_FIELDS)
+	if (re->r.mode & R_FIELDS)
 		do_render_fields_3d(re);
-	else if(re->r.mode & R_MBLUR && (re->r.scemode & R_FULL_SAMPLE)==0)
+	else if (re->r.mode & R_MBLUR && (re->r.scemode & R_FULL_SAMPLE)==0)
 		do_render_blur_3d(re);
 	else
 		do_render_3d(re);
 	
 	/* when border render, check if we have to insert it in black */
-	if(re->result) {
-		if(re->r.mode & R_BORDER) {
-			if((re->r.mode & R_CROP)==0) {
+	if (re->result) {
+		if (re->r.mode & R_BORDER) {
+			if ((re->r.mode & R_CROP)==0) {
 				RenderResult *rres;
 				
 				BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
@@ -1211,9 +1223,9 @@ static void do_render_fields_blur_3d(Render *re)
 				
 				/* this copying sequence could become function? */
 				/* weak is: it chances disprect from border */
-				re->disprect.xmin= re->disprect.ymin= 0;
-				re->disprect.xmax= re->winx;
-				re->disprect.ymax= re->winy;
+				re->disprect.xmin = re->disprect.ymin = 0;
+				re->disprect.xmax = re->winx;
+				re->disprect.ymax = re->winy;
 				re->rectx= re->winx;
 				re->recty= re->winy;
 				
@@ -1242,8 +1254,8 @@ static void do_render_fields_blur_3d(Render *re)
 
 
 /* within context of current Render *re, render another scene.
-   it uses current render image size and disprect, but doesn't execute composite
-*/
+ * it uses current render image size and disprect, but doesn't execute composite
+ */
 static void render_scene(Render *re, Scene *sce, int cfra)
 {
 	Render *resc= RE_NewRender(sce->id.name);
@@ -1254,7 +1266,7 @@ static void render_scene(Render *re, Scene *sce, int cfra)
 	scene_camera_switch_update(sce);
 
 	/* exception: scene uses own size (unfinished code) */
-	if(0) {
+	if (0) {
 		winx= (sce->r.size*sce->r.xsch)/100;
 		winy= (sce->r.size*sce->r.ysch)/100;
 	}
@@ -1287,13 +1299,13 @@ static int composite_needs_render(Scene *sce, int this_scene)
 	bNodeTree *ntree= sce->nodetree;
 	bNode *node;
 	
-	if(ntree==NULL) return 1;
-	if(sce->use_nodes==0) return 1;
-	if((sce->r.scemode & R_DOCOMP)==0) return 1;
+	if (ntree==NULL) return 1;
+	if (sce->use_nodes==0) return 1;
+	if ((sce->r.scemode & R_DOCOMP)==0) return 1;
 	
-	for(node= ntree->nodes.first; node; node= node->next) {
-		if(node->type==CMP_NODE_R_LAYERS)
-			if(this_scene==0 || node->id==NULL || node->id==&sce->id)
+	for (node= ntree->nodes.first; node; node= node->next) {
+		if (node->type==CMP_NODE_R_LAYERS)
+			if (this_scene==0 || node->id==NULL || node->id==&sce->id)
 				return 1;
 	}
 	return 0;
@@ -1304,19 +1316,19 @@ static void tag_scenes_for_render(Render *re)
 	bNode *node;
 	Scene *sce;
 	
-	for(sce= re->main->scene.first; sce; sce= sce->id.next)
+	for (sce= re->main->scene.first; sce; sce= sce->id.next)
 		sce->id.flag &= ~LIB_DOIT;
 	
-	if(RE_GetCamera(re) && composite_needs_render(re->scene, 1))
+	if (RE_GetCamera(re) && composite_needs_render(re->scene, 1))
 		re->scene->id.flag |= LIB_DOIT;
 	
-	if(re->scene->nodetree==NULL) return;
+	if (re->scene->nodetree==NULL) return;
 	
 	/* check for render-layers nodes using other scenes, we tag them LIB_DOIT */
-	for(node= re->scene->nodetree->nodes.first; node; node= node->next) {
-		if(node->type==CMP_NODE_R_LAYERS) {
-			if(node->id) {
-				if(node->id != (ID *)re->scene)
+	for (node= re->scene->nodetree->nodes.first; node; node= node->next) {
+		if (node->type==CMP_NODE_R_LAYERS) {
+			if (node->id) {
+				if (node->id != (ID *)re->scene)
 					node->id->flag |= LIB_DOIT;
 			}
 		}
@@ -1330,16 +1342,16 @@ static void ntree_render_scenes(Render *re)
 	int cfra= re->scene->r.cfra;
 	int restore_scene= 0;
 	
-	if(re->scene->nodetree==NULL) return;
+	if (re->scene->nodetree==NULL) return;
 	
 	tag_scenes_for_render(re);
 	
 	/* now foreach render-result node tagged we do a full render */
 	/* results are stored in a way compisitor will find it */
-	for(node= re->scene->nodetree->nodes.first; node; node= node->next) {
-		if(node->type==CMP_NODE_R_LAYERS) {
-			if(node->id && node->id != (ID *)re->scene) {
-				if(node->id->flag & LIB_DOIT) {
+	for (node= re->scene->nodetree->nodes.first; node; node= node->next) {
+		if (node->type==CMP_NODE_R_LAYERS) {
+			if (node->id && node->id != (ID *)re->scene) {
+				if (node->id->flag & LIB_DOIT) {
 					Scene *scene = (Scene*)node->id;
 
 					render_scene(re, scene, cfra);
@@ -1353,7 +1365,7 @@ static void ntree_render_scenes(Render *re)
 	}
 
 	/* restore scene if we rendered another last */
-	if(restore_scene)
+	if (restore_scene)
 		set_scene_bg(re->main, re->scene);
 }
 
@@ -1373,7 +1385,7 @@ static void do_merge_fullsample(Render *re, bNodeTree *ntree)
 	int sample;
 	
 	/* interaction callbacks */
-	if(ntree) {
+	if (ntree) {
 		ntree->stats_draw= render_composit_stats;
 		ntree->test_break= re->test_break;
 		ntree->progress= re->progress;
@@ -1388,7 +1400,7 @@ static void do_merge_fullsample(Render *re, bNodeTree *ntree)
 	/* we accumulate in here */
 	rectf= MEM_mapallocN(re->rectx*re->recty*sizeof(float)*4, "fullsample rgba");
 	
-	for(sample=0; sample<re->r.osa; sample++) {
+	for (sample=0; sample<re->r.osa; sample++) {
 		Render *re1;
 		RenderResult rres;
 		int x, y, mask;
@@ -1400,10 +1412,10 @@ static void do_merge_fullsample(Render *re, bNodeTree *ntree)
 		/* also function below assumes this */
 			
 		tag_scenes_for_render(re);
-		for(re1= RenderGlobal.renderlist.first; re1; re1= re1->next) {
-			if(re1->scene->id.flag & LIB_DOIT) {
-				if(re1->r.scemode & R_FULL_SAMPLE) {
-					if(sample) {
+		for (re1= RenderGlobal.renderlist.first; re1; re1= re1->next) {
+			if (re1->scene->id.flag & LIB_DOIT) {
+				if (re1->r.scemode & R_FULL_SAMPLE) {
+					if (sample) {
 						BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
 						render_result_exr_file_read(re1, sample);
 						BLI_rw_mutex_unlock(&re->resultmutex);
@@ -1414,7 +1426,7 @@ static void do_merge_fullsample(Render *re, bNodeTree *ntree)
 		}
 		
 		/* composite */
-		if(ntree) {
+		if (ntree) {
 			ntreeCompositTagRender(re->scene);
 			ntreeCompositTagAnimated(ntree);
 			
@@ -1428,15 +1440,15 @@ static void do_merge_fullsample(Render *re, bNodeTree *ntree)
 		mask= (1<<sample);
 		mask_array(mask, filt);
 
-		for(y=0; y<re->recty; y++) {
+		for (y=0; y<re->recty; y++) {
 			float *rf= rectf + 4*y*re->rectx;
 			float *col= rres.rectf + 4*y*re->rectx;
 				
-			for(x=0; x<re->rectx; x++, rf+=4, col+=4) {
+			for (x=0; x<re->rectx; x++, rf+=4, col+=4) {
 				/* clamping to 1.0 is needed for correct AA */
-				if(col[0]<0.0f) col[0]=0.0f; else if(col[0] > 1.0f) col[0]= 1.0f;
-				if(col[1]<0.0f) col[1]=0.0f; else if(col[1] > 1.0f) col[1]= 1.0f;
-				if(col[2]<0.0f) col[2]=0.0f; else if(col[2] > 1.0f) col[2]= 1.0f;
+				if (col[0]<0.0f) col[0]=0.0f; else if (col[0] > 1.0f) col[0]= 1.0f;
+				if (col[1]<0.0f) col[1]=0.0f; else if (col[1] > 1.0f) col[1]= 1.0f;
+				if (col[2]<0.0f) col[2]=0.0f; else if (col[2] > 1.0f) col[2]= 1.0f;
 				
 				add_filt_fmask_coord(filt, col, rf, re->rectx, re->recty, x, y);
 			}
@@ -1445,18 +1457,18 @@ static void do_merge_fullsample(Render *re, bNodeTree *ntree)
 		RE_ReleaseResultImage(re);
 
 		/* show stuff */
-		if(sample!=re->osa-1) {
+		if (sample!=re->osa-1) {
 			/* 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);
 		}
 		
-		if(re->test_break(re->tbh))
+		if (re->test_break(re->tbh))
 			break;
 	}
 	
 	/* clear interaction callbacks */
-	if(ntree) {
+	if (ntree) {
 		ntree->stats_draw= NULL;
 		ntree->test_break= NULL;
 		ntree->progress= NULL;
@@ -1467,7 +1479,7 @@ static void do_merge_fullsample(Render *re, bNodeTree *ntree)
 	R.i.curfsa= 0;
 	
 	BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
-	if(re->result->rectf) 
+	if (re->result->rectf)
 		MEM_freeN(re->result->rectf);
 	re->result->rectf= rectf;
 	BLI_rw_mutex_unlock(&re->resultmutex);
@@ -1488,15 +1500,15 @@ void RE_MergeFullSample(Render *re, Main *bmain, Scene *sce, bNodeTree *ntree)
 	/* first call RE_ReadRenderResult on every renderlayer scene. this creates Render structs */
 	
 	/* tag scenes unread */
-	for(scene= re->main->scene.first; scene; scene= scene->id.next) 
+	for (scene= re->main->scene.first; scene; scene= scene->id.next)
 		scene->id.flag |= LIB_DOIT;
 	
-	for(node= ntree->nodes.first; node; node= node->next) {
-		if(node->type==CMP_NODE_R_LAYERS) {
+	for (node= ntree->nodes.first; node; node= node->next) {
+		if (node->type==CMP_NODE_R_LAYERS) {
 			Scene *nodescene= (Scene *)node->id;
 			
-			if(nodescene==NULL) nodescene= sce;
-			if(nodescene->id.flag & LIB_DOIT) {
+			if (nodescene==NULL) nodescene= sce;
+			if (nodescene->id.flag & LIB_DOIT) {
 				nodescene->r.mode |= R_OSA;	/* render struct needs tables */
 				RE_ReadRenderResult(sce, nodescene);
 				nodescene->id.flag &= ~LIB_DOIT;
@@ -1505,7 +1517,7 @@ void RE_MergeFullSample(Render *re, Main *bmain, Scene *sce, bNodeTree *ntree)
 	}
 	
 	/* own render result should be read/allocated */
-	if(re->scene->id.flag & LIB_DOIT) {
+	if (re->scene->id.flag & LIB_DOIT) {
 		RE_ReadRenderResult(re->scene, re->scene);
 		re->scene->id.flag &= ~LIB_DOIT;
 	}
@@ -1526,7 +1538,7 @@ static void do_render_composite_fields_blur_3d(Render *re)
 	/* INIT seeding, compositor can use random texture */
 	BLI_srandom(re->r.cfra);
 	
-	if(composite_needs_render(re->scene, 1)) {
+	if (composite_needs_render(re->scene, 1)) {
 		/* save memory... free all cached images */
 		ntreeFreeCache(ntree);
 		
@@ -1546,25 +1558,25 @@ static void do_render_composite_fields_blur_3d(Render *re)
 	}
 	
 	/* swap render result */
-	if(re->r.scemode & R_SINGLE_LAYER) {
+	if (re->r.scemode & R_SINGLE_LAYER) {
 		BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
 		render_result_single_layer_end(re);
 		BLI_rw_mutex_unlock(&re->resultmutex);
 	}
 	
-	if(!re->test_break(re->tbh)) {
+	if (!re->test_break(re->tbh)) {
 		
-		if(ntree) {
+		if (ntree) {
 			ntreeCompositTagRender(re->scene);
 			ntreeCompositTagAnimated(ntree);
 		}
 		
-		if(ntree && re->scene->use_nodes && re->r.scemode & R_DOCOMP) {
+		if (ntree && re->scene->use_nodes && re->r.scemode & R_DOCOMP) {
 			/* checks if there are render-result nodes that need scene */
-			if((re->r.scemode & R_SINGLE_LAYER)==0)
+			if ((re->r.scemode & R_SINGLE_LAYER)==0)
 				ntree_render_scenes(re);
 			
-			if(!re->test_break(re->tbh)) {
+			if (!re->test_break(re->tbh)) {
 				ntree->stats_draw= render_composit_stats;
 				ntree->test_break= re->test_break;
 				ntree->progress= re->progress;
@@ -1579,7 +1591,7 @@ static void do_render_composite_fields_blur_3d(Render *re)
 				if (update_newframe)
 					scene_update_for_newframe(re->main, re->scene, re->lay);
 				
-				if(re->r.scemode & R_FULL_SAMPLE) 
+				if (re->r.scemode & R_FULL_SAMPLE)
 					do_merge_fullsample(re, ntree);
 				else {
 					ntreeCompositExecTree(ntree, &re->r, G.background==0);
@@ -1591,7 +1603,7 @@ static void do_render_composite_fields_blur_3d(Render *re)
 				ntree->tbh= ntree->sdh= ntree->prh= NULL;
 			}
 		}
-		else if(re->r.scemode & R_FULL_SAMPLE)
+		else if (re->r.scemode & R_FULL_SAMPLE)
 			do_merge_fullsample(re, NULL);
 	}
 
@@ -1638,20 +1650,21 @@ static void do_render_seq(Render * re)
 
 	re->i.cfra= cfra;
 
-	if(recurs_depth==0) {
-		/* otherwise sequencer animation isnt updated */
+	if (recurs_depth==0) {
+		/* otherwise sequencer animation isn't updated */
 		BKE_animsys_evaluate_all_animation(re->main, re->scene, (float)cfra); // XXX, was BKE_curframe(re->scene)
 	}
 
 	recurs_depth++;
 
-	if((re->r.mode & R_BORDER) && (re->r.mode & R_CROP)==0) {
+	if ((re->r.mode & R_BORDER) && (re->r.mode & R_CROP)==0) {
 		/* if border rendering is used and cropping is disabled, final buffer should
-		    be as large as the whole frame */
+		 * be as large as the whole frame */
 		context = seq_new_render_data(re->main, re->scene,
 					      re->winx, re->winy,
 					      100);
-	} else {
+	}
+	else {
 		context = seq_new_render_data(re->main, re->scene,
 					      re->result->rectx, re->result->recty,
 					      100);
@@ -1665,7 +1678,7 @@ static void do_render_seq(Render * re)
 	
 	BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
 
-	if(ibuf) {
+	if (ibuf) {
 		/* copy ibuf into combined pixel rect */
 		render_result_rect_from_ibuf(rr, &re->r, ibuf);
 		
@@ -1687,7 +1700,7 @@ static void do_render_seq(Render * re)
 	re->r.scemode |= R_DOSEQ;
 
 	/* set overall progress of sequence rendering */
-	if(re->r.efra!=re->r.sfra)
+	if (re->r.efra!=re->r.sfra)
 		re->progress(re->prh, (float)(cfra-re->r.sfra) / (re->r.efra-re->r.sfra));
 	else
 		re->progress(re->prh, 1.0f);
@@ -1705,12 +1718,12 @@ static void do_render_all_options(Render *re)
 	/* ensure no images are in memory from previous animated sequences */
 	BKE_image_all_free_anim_ibufs(re->r.cfra);
 
-	if(RE_engine_render(re, 1)) {
+	if (RE_engine_render(re, 1)) {
 		/* in this case external render overrides all */
 	}
-	else if(RE_seq_render_active(re->scene, &re->r)) {
+	else if (RE_seq_render_active(re->scene, &re->r)) {
 		/* note: do_render_seq() frees rect32 when sequencer returns float images */
-		if(!re->test_break(re->tbh)) 
+		if (!re->test_break(re->tbh))
 			do_render_seq(re);
 		
 		re->stats_draw(re->sdh, &re->i);
@@ -1725,7 +1738,7 @@ static void do_render_all_options(Render *re)
 	re->stats_draw(re->sdh, &re->i);
 	
 	/* stamp image info here */
-	if((re->r.stamp & R_STAMP_ALL) && (re->r.stamp & R_STAMP_DRAW)) {
+	if ((re->r.stamp & R_STAMP_ALL) && (re->r.stamp & R_STAMP_DRAW)) {
 		renderresult_stampinfo(re);
 		re->display_draw(re->ddh, re->result, NULL);
 	}
@@ -1738,20 +1751,21 @@ static int check_valid_camera(Scene *scene, Object *camera_override)
 	if (camera_override == NULL && scene->camera == NULL)
 		scene->camera= scene_find_camera(scene);
 
-	if(scene->r.scemode&R_DOSEQ) {
-		if(scene->ed) {
+	if (scene->r.scemode&R_DOSEQ) {
+		if (scene->ed) {
 			Sequence *seq= scene->ed->seqbase.first;
 
 			check_comp= 0;
 
-			while(seq) {
-				if(seq->type == SEQ_SCENE && seq->scene) {
-					if(!seq->scene_camera) {
-						if(!seq->scene->camera && !scene_find_camera(seq->scene)) {
-							if(seq->scene == scene) {
+			while (seq) {
+				if (seq->type == SEQ_SCENE && seq->scene) {
+					if (!seq->scene_camera) {
+						if (!seq->scene->camera && !scene_find_camera(seq->scene)) {
+							if (seq->scene == scene) {
 								/* for current scene camera could be unneeded due to compisite nodes */
 								check_comp= 1;
-							} else {
+							}
+							else {
 								/* for other scenes camera is necessary */
 								return 0;
 							}
@@ -1764,15 +1778,15 @@ static int check_valid_camera(Scene *scene, Object *camera_override)
 		}
 	}
 
-	if(check_comp) { /* no sequencer or sequencer depends on compositor */
-		if(scene->r.scemode&R_DOCOMP && scene->use_nodes) {
+	if (check_comp) { /* no sequencer or sequencer depends on compositor */
+		if (scene->r.scemode&R_DOCOMP && scene->use_nodes) {
 			bNode *node= scene->nodetree->nodes.first;
 
-			while(node) {
-				if(node->type == CMP_NODE_R_LAYERS) {
+			while (node) {
+				if (node->type == CMP_NODE_R_LAYERS) {
 					Scene *sce= node->id ? (Scene*)node->id : scene;
 
-					if(!sce->camera && !scene_find_camera(sce)) {
+					if (!sce->camera && !scene_find_camera(sce)) {
 						/* all render layers nodes need camera */
 						return 0;
 					}
@@ -1780,7 +1794,8 @@ static int check_valid_camera(Scene *scene, Object *camera_override)
 
 				node= node->next;
 			}
-		} else {
+		}
+		else {
 			return (camera_override != NULL || scene->camera != NULL);
 		}
 	}
@@ -1792,15 +1807,15 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r
 {
 	SceneRenderLayer *srl;
 	
-	if(scene->r.mode & R_BORDER) {
-		if(scene->r.border.xmax <= scene->r.border.xmin ||
+	if (scene->r.mode & R_BORDER) {
+		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.");
 			return 0;
 		}
 	}
 	
-	if(scene->r.scemode & (R_EXR_TILE_FILE|R_FULL_SAMPLE)) {
+	if (scene->r.scemode & (R_EXR_TILE_FILE|R_FULL_SAMPLE)) {
 		char str[FILE_MAX];
 		
 		render_result_exr_file_path(scene, 0, str);
@@ -1811,7 +1826,7 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r
 		}
 		
 		/* no fullsample and edge */
-		if((scene->r.scemode & R_FULL_SAMPLE) && (scene->r.mode & R_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");
 			return 0;
 		}
@@ -1820,27 +1835,27 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r
 	else
 		scene->r.scemode &= ~R_FULL_SAMPLE;	/* clear to be sure */
 	
-	if(scene->r.scemode & R_DOCOMP) {
-		if(scene->use_nodes) {
+	if (scene->r.scemode & R_DOCOMP) {
+		if (scene->use_nodes) {
 			bNodeTree *ntree= scene->nodetree;
 			bNode *node;
 		
-			if(ntree==NULL) {
+			if (ntree==NULL) {
 				BKE_report(reports, RPT_ERROR, "No Nodetree in Scene");
 				return 0;
 			}
 			
-			for(node= ntree->nodes.first; node; node= node->next)
-				if(node->type==CMP_NODE_COMPOSITE)
+			for (node= ntree->nodes.first; node; node= node->next)
+				if (node->type==CMP_NODE_COMPOSITE)
 					break;
 			
-			if(node==NULL) {
+			if (node==NULL) {
 				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) {
+			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");
 					return 0;
 				}
@@ -1849,7 +1864,7 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r
 	}
 	
 	 /* check valid camera, without camera render is OK (compo, seq) */
-	if(!check_valid_camera(scene, camera_override)) {
+	if (!check_valid_camera(scene, camera_override)) {
 		BKE_report(reports, RPT_ERROR, "No camera");
 		return 0;
 	}
@@ -1858,24 +1873,24 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r
 	object_camera_mode(&scene->r, camera_override ? camera_override : scene->camera);
 
 	/* forbidden combinations */
-	if(scene->r.mode & R_PANORAMA) {
-		if(scene->r.mode & R_ORTHO) {
+	if (scene->r.mode & R_PANORAMA) {
+		if (scene->r.mode & R_ORTHO) {
 			BKE_report(reports, RPT_ERROR, "No Ortho render possible for Panorama");
 			return 0;
 		}
 	}
 
 	/* layer flag tests */
-	if(scene->r.scemode & R_SINGLE_LAYER) {
+	if (scene->r.scemode & R_SINGLE_LAYER) {
 		srl= BLI_findlink(&scene->r.layers, scene->r.actlay);
 		/* force layer to be enabled */
 		srl->layflag &= ~SCE_LAY_DISABLE;
 	}
 	
-	for(srl= scene->r.layers.first; srl; srl= srl->next)
-		if(!(srl->layflag & SCE_LAY_DISABLE))
+	for (srl= scene->r.layers.first; srl; srl= srl->next)
+		if (!(srl->layflag & SCE_LAY_DISABLE))
 			break;
-	if(srl==NULL) {
+	if (srl==NULL) {
 		BKE_report(reports, RPT_ERROR, "All RenderLayers are disabled");
 		return 0;
 	}
@@ -1885,16 +1900,17 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *r
 
 static void validate_render_settings(Render *re)
 {
-	if(re->r.scemode & (R_EXR_TILE_FILE|R_FULL_SAMPLE)) {
+	if (re->r.scemode & (R_EXR_TILE_FILE|R_FULL_SAMPLE)) {
 		/* no osa + fullsample won't work... */
-		if(re->r.osa==0)
+		if (re->r.osa==0)
 			re->r.scemode &= ~R_FULL_SAMPLE;
-	} else re->r.scemode &= ~R_FULL_SAMPLE;	/* clear to be sure */
+	}
+	else re->r.scemode &= ~R_FULL_SAMPLE;	/* clear to be sure */
 
-	if(RE_engine_is_external(re)) {
+	if (RE_engine_is_external(re)) {
 		/* not supported yet */
 		re->r.scemode &= ~(R_EXR_TILE_FILE|R_FULL_SAMPLE);
-		re->r.mode &= ~R_FIELDS;
+		re->r.mode &= ~(R_FIELDS|R_MBLUR);
 	}
 }
 
@@ -1922,24 +1938,24 @@ static int render_initialize_from_main(Render *re, Main *bmain, Scene *scene, Sc
 	rcti disprect;
 	
 	/* r.xsch and r.ysch has the actual view window size
-		r.border is the clipping rect */
+	 * r.border is the clipping rect */
 	
 	/* calculate actual render result and display size */
 	winx= (scene->r.size*scene->r.xsch)/100;
 	winy= (scene->r.size*scene->r.ysch)/100;
 	
 	/* we always render smaller part, inserting it in larger image is compositor bizz, it uses disprect for it */
-	if(scene->r.mode & R_BORDER) {
-		disprect.xmin= scene->r.border.xmin*winx;
-		disprect.xmax= scene->r.border.xmax*winx;
+	if (scene->r.mode & R_BORDER) {
+		disprect.xmin = scene->r.border.xmin*winx;
+		disprect.xmax = scene->r.border.xmax*winx;
 		
-		disprect.ymin= scene->r.border.ymin*winy;
-		disprect.ymax= scene->r.border.ymax*winy;
+		disprect.ymin = scene->r.border.ymin*winy;
+		disprect.ymax = scene->r.border.ymax*winy;
 	}
 	else {
-		disprect.xmin= disprect.ymin= 0;
-		disprect.xmax= winx;
-		disprect.ymax= winy;
+		disprect.xmin = disprect.ymin = 0;
+		disprect.xmax = winx;
+		disprect.ymax = winy;
 	}
 	
 	re->main= bmain;
@@ -1948,7 +1964,7 @@ static int render_initialize_from_main(Render *re, Main *bmain, Scene *scene, Sc
 	re->lay= lay;
 	
 	/* not too nice, but it survives anim-border render */
-	if(anim) {
+	if (anim) {
 		re->disprect= disprect;
 		return 1;
 	}
@@ -1960,20 +1976,20 @@ static int render_initialize_from_main(Render *re, Main *bmain, Scene *scene, Sc
 	 * Disabled completely for now,
 	 * can be later set as render profile option
 	 * and default for background render.
-	*/
-	if(0) {
+	 */
+	if (0) {
 		/* make sure dynamics are up to date */
 		update_physics_cache(re, scene, anim_init);
 	}
 	
-	if(srl || scene->r.scemode & R_SINGLE_LAYER) {
+	if (srl || scene->r.scemode & R_SINGLE_LAYER) {
 		BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
 		render_result_single_layer_begin(re);
 		BLI_rw_mutex_unlock(&re->resultmutex);
 	}
 	
 	RE_InitState(re, NULL, &scene->r, srl, winx, winy, &disprect);
-	if(!re->ok)  /* if an error was printed, abort */
+	if (!re->ok)  /* if an error was printed, abort */
 		return 0;
 	
 	/* initstate makes new result, have to send changed tags around */
@@ -2000,16 +2016,16 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr
 	
 	scene->r.cfra= frame;
 	
-	if(render_initialize_from_main(re, bmain, scene, srl, camera_override, lay, 0, 0)) {
+	if (render_initialize_from_main(re, bmain, scene, srl, camera_override, lay, 0, 0)) {
 		MEM_reset_peak_memory();
 
 		BLI_exec_cb(re->main, (ID *)scene, BLI_CB_EVT_RENDER_PRE);
 
 		do_render_all_options(re);
 
-		if(write_still && !G.afbreek) {
-			if(BKE_imtype_is_movie(scene->r.im_format.imtype)) {
-				/* operator checks this but incase its called from elsewhere */
+		if (write_still && !G.afbreek) {
+			if (BKE_imtype_is_movie(scene->r.im_format.imtype)) {
+				/* operator checks this but in case its called from elsewhere */
 				printf("Error: cant write single images with a movie format!\n");
 			}
 			else {
@@ -2024,6 +2040,8 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr
 		BLI_exec_cb(re->main, (ID *)scene, BLI_CB_EVT_RENDER_POST); /* keep after file save */
 	}
 
+	BLI_exec_cb(re->main, (ID *)scene, G.afbreek ? BLI_CB_EVT_RENDER_CANCEL : BLI_CB_EVT_RENDER_COMPLETE);
+
 	/* UGLY WARNING */
 	G.rendering= 0;
 }
@@ -2038,11 +2056,11 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie
 	RE_AcquireResultImage(re, &rres);
 
 	/* write movie or image */
-	if(BKE_imtype_is_movie(scene->r.im_format.imtype)) {
+	if (BKE_imtype_is_movie(scene->r.im_format.imtype)) {
 		int dofree = 0;
 		unsigned int *rect32 = (unsigned int *)rres.rect32;
 		/* note; the way it gets 32 bits rects is weak... */
-		if(rres.rect32 == NULL) {
+		if (rres.rect32 == NULL) {
 			rect32 = MEM_mapallocN(sizeof(int)*rres.rectx*rres.recty, "temp 32 bits rect");
 			RE_ResultGet32(re, rect32);
 			dofree = 1;
@@ -2050,20 +2068,20 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie
 
 		ok= mh->append_movie(&re->r, scene->r.sfra, scene->r.cfra, (int *)rect32,
 		                     rres.rectx, rres.recty, re->reports);
-		if(dofree) {
+		if (dofree) {
 			MEM_freeN(rect32);
 		}
 		printf("Append frame %d", scene->r.cfra);
 	} 
 	else {
-		if(name_override)
+		if (name_override)
 			BLI_strncpy(name, name_override, sizeof(name));
 		else
 			BKE_makepicstring(name, scene->r.pic, bmain->name, scene->r.cfra, scene->r.im_format.imtype, scene->r.scemode & R_EXTENSION, TRUE);
 		
-		if(re->r.im_format.imtype==R_IMF_IMTYPE_MULTILAYER) {
-			if(re->result) {
-				RE_WriteRenderResult(re->reports, re->result, name, scene->r.im_format.compress);
+		if (re->r.im_format.imtype==R_IMF_IMTYPE_MULTILAYER) {
+			if (re->result) {
+				RE_WriteRenderResult(re->reports, re->result, name, scene->r.im_format.exr_codec);
 				printf("Saved: %s", name);
 			}
 		}
@@ -2072,17 +2090,17 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie
 
 			ok= BKE_write_ibuf_stamp(scene, camera, ibuf, name, &scene->r.im_format);
 			
-			if(ok==0) {
+			if (ok==0) {
 				printf("Render error: cannot save %s\n", name);
 			}
 			else printf("Saved: %s", name);
 			
 			/* optional preview images for exr */
-			if(ok && scene->r.im_format.imtype==R_IMF_IMTYPE_OPENEXR && (scene->r.im_format.flag & R_IMF_FLAG_PREVIEW_JPG)) {
+			if (ok && scene->r.im_format.imtype==R_IMF_IMTYPE_OPENEXR && (scene->r.im_format.flag & R_IMF_FLAG_PREVIEW_JPG)) {
 				ImageFormatData imf= scene->r.im_format;
 				imf.imtype= R_IMF_IMTYPE_JPEG90;
 
-				if(BLI_testextensie(name, ".exr")) 
+				if (BLI_testextensie(name, ".exr"))
 					name[strlen(name)-4]= 0;
 				BKE_add_image_extension(name, R_IMF_IMTYPE_JPEG90);
 				ibuf->planes= 24;
@@ -2098,7 +2116,11 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie
 	RE_ReleaseResultImage(re);
 
 	BLI_timestr(re->i.lastframetime, name);
-	printf(" Time: %s\n", name);
+	printf(" Time: %s", name);
+
+	BLI_exec_cb(G.main, NULL, BLI_CB_EVT_RENDER_STATS);
+
+	fputc('\n', stdout);
 	fflush(stdout); /* needed for renderd !! (not anymore... (ton)) */
 
 	return ok;
@@ -2112,7 +2134,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
 	int nfra, totrendered= 0, totskipped= 0;
 	
 	/* do not fully call for each frame, it initializes & pops output window */
-	if(!render_initialize_from_main(re, bmain, scene, NULL, camera_override, lay, 0, 1))
+	if (!render_initialize_from_main(re, bmain, scene, NULL, camera_override, lay, 0, 1))
 		return;
 	
 	/* ugly global still... is to prevent renderwin events and signal subsurfs etc to make full resol */
@@ -2121,8 +2143,8 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
 
 	re->flag |= R_ANIMATION;
 
-	if(BKE_imtype_is_movie(scene->r.im_format.imtype))
-		if(!mh->start_movie(scene, &re->r, re->rectx, re->recty, re->reports))
+	if (BKE_imtype_is_movie(scene->r.im_format.imtype))
+		if (!mh->start_movie(scene, &re->r, re->rectx, re->recty, re->reports))
 			G.afbreek= 1;
 
 	if (mh->get_next_frame) {
@@ -2136,28 +2158,29 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
 				do_render_all_options(re);
 				totrendered++;
 
-				if(re->test_break(re->tbh) == 0) {
-					if(!do_write_image_or_movie(re, bmain, scene, mh, NULL))
+				if (re->test_break(re->tbh) == 0) {
+					if (!do_write_image_or_movie(re, bmain, scene, mh, NULL))
 						G.afbreek= 1;
 				}
 
-				if(G.afbreek == 0) {
+				if (G.afbreek == 0) {
 					BLI_exec_cb(re->main, (ID *)scene, BLI_CB_EVT_RENDER_POST); /* keep after file save */
 				}
 			}
 			else {
-				if(re->test_break(re->tbh))
+				if (re->test_break(re->tbh))
 					G.afbreek= 1;
 			}
 		}
-	} else {
-		for(nfra= sfra, scene->r.cfra= sfra; scene->r.cfra<=efra; scene->r.cfra++) {
+	}
+	else {
+		for (nfra= sfra, scene->r.cfra= sfra; scene->r.cfra<=efra; scene->r.cfra++) {
 			char name[FILE_MAX];
 			
 			/* only border now, todo: camera lens. (ton) */
 			render_initialize_from_main(re, bmain, scene, NULL, camera_override, lay, 1, 0);
 
-			if(nfra!=scene->r.cfra) {
+			if (nfra!=scene->r.cfra) {
 				/*
 				 * Skip this frame, but update for physics and particles system.
 				 * From convertblender.c:
@@ -2165,7 +2188,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
 				 */
 				unsigned int updatelay;
 
-				if(re->lay & 0xFF000000)
+				if (re->lay & 0xFF000000)
 					updatelay= re->lay & 0xFF000000;
 				else
 					updatelay= re->lay;
@@ -2177,16 +2200,16 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
 				nfra+= tfra;
 
 			/* Touch/NoOverwrite options are only valid for image's */
-			if(BKE_imtype_is_movie(scene->r.im_format.imtype) == 0) {
-				if(scene->r.mode & (R_NO_OVERWRITE | R_TOUCH))
+			if (BKE_imtype_is_movie(scene->r.im_format.imtype) == 0) {
+				if (scene->r.mode & (R_NO_OVERWRITE | R_TOUCH))
 					BKE_makepicstring(name, scene->r.pic, bmain->name, scene->r.cfra, scene->r.im_format.imtype, scene->r.scemode & R_EXTENSION, TRUE);
 
-				if(scene->r.mode & R_NO_OVERWRITE && BLI_exists(name)) {
+				if (scene->r.mode & R_NO_OVERWRITE && BLI_exists(name)) {
 					printf("skipping existing frame \"%s\"\n", name);
 					totskipped++;
 					continue;
 				}
-				if(scene->r.mode & R_TOUCH && !BLI_exists(name)) {
+				if (scene->r.mode & R_TOUCH && !BLI_exists(name)) {
 					BLI_make_existing_file(name); /* makes the dir if its not there */
 					BLI_file_touch(name);
 				}
@@ -2201,17 +2224,17 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
 			do_render_all_options(re);
 			totrendered++;
 			
-			if(re->test_break(re->tbh) == 0) {
-				if(!G.afbreek)
-					if(!do_write_image_or_movie(re, bmain, scene, mh, NULL))
+			if (re->test_break(re->tbh) == 0) {
+				if (!G.afbreek)
+					if (!do_write_image_or_movie(re, bmain, scene, mh, NULL))
 						G.afbreek= 1;
 			}
 			else
 				G.afbreek= 1;
 		
-			if(G.afbreek==1) {
+			if (G.afbreek==1) {
 				/* remove touched file */
-				if(BKE_imtype_is_movie(scene->r.im_format.imtype) == 0) {
+				if (BKE_imtype_is_movie(scene->r.im_format.imtype) == 0) {
 					if (scene->r.mode & R_TOUCH && BLI_exists(name) && BLI_file_size(name) == 0) {
 						BLI_delete(name, 0, 0);
 					}
@@ -2220,23 +2243,25 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
 				break;
 			}
 
-			if(G.afbreek==0) {
+			if (G.afbreek==0) {
 				BLI_exec_cb(re->main, (ID *)scene, BLI_CB_EVT_RENDER_POST); /* keep after file save */
 			}
 		}
 	}
 	
 	/* end movie */
-	if(BKE_imtype_is_movie(scene->r.im_format.imtype))
+	if (BKE_imtype_is_movie(scene->r.im_format.imtype))
 		mh->end_movie();
 	
-	if(totskipped && totrendered == 0)
+	if (totskipped && totrendered == 0)
 		BKE_report(re->reports, RPT_INFO, "No frames rendered, skipped to not overwrite");
 
 	scene->r.cfra= cfrao;
 
 	re->flag &= ~R_ANIMATION;
 
+	BLI_exec_cb(re->main, (ID *)scene, G.afbreek ? BLI_CB_EVT_RENDER_CANCEL : BLI_CB_EVT_RENDER_COMPLETE);
+
 	/* UGLY WARNING */
 	G.rendering= 0;
 }
@@ -2275,25 +2300,25 @@ int RE_ReadRenderResult(Scene *scene, Scene *scenode)
 	winy= (scene->r.size*scene->r.ysch)/100;
 	
 	/* only in movie case we render smaller part */
-	if(scene->r.mode & R_BORDER) {
-		disprect.xmin= scene->r.border.xmin*winx;
-		disprect.xmax= scene->r.border.xmax*winx;
+	if (scene->r.mode & R_BORDER) {
+		disprect.xmin = scene->r.border.xmin*winx;
+		disprect.xmax = scene->r.border.xmax*winx;
 		
-		disprect.ymin= scene->r.border.ymin*winy;
-		disprect.ymax= scene->r.border.ymax*winy;
+		disprect.ymin = scene->r.border.ymin*winy;
+		disprect.ymax = scene->r.border.ymax*winy;
 	}
 	else {
-		disprect.xmin= disprect.ymin= 0;
-		disprect.xmax= winx;
-		disprect.ymax= winy;
+		disprect.xmin = disprect.ymin = 0;
+		disprect.xmax = winx;
+		disprect.ymax = winy;
 	}
 	
-	if(scenode)
+	if (scenode)
 		scene= scenode;
 	
 	/* get render: it can be called from UI with draw callbacks */
 	re= RE_GetRender(scene->id.name);
-	if(re==NULL)
+	if (re==NULL)
 		re= RE_NewRender(scene->id.name);
 	RE_InitState(re, NULL, &scene->r, NULL, winx, winy, &disprect);
 	re->scene= scene;
@@ -2309,43 +2334,47 @@ void RE_set_max_threads(int threads)
 {
 	if (threads==0) {
 		RenderGlobal.threads = BLI_system_thread_count();
-	} else if(threads>=1 && threads<=BLENDER_MAX_THREADS) {
+	}
+	else if (threads>=1 && threads<=BLENDER_MAX_THREADS) {
 		RenderGlobal.threads= threads;
-	} else {
+	}
+	else {
 		printf("Error, threads has to be in range 0-%d\n", BLENDER_MAX_THREADS);
 	}
 }
 
 void RE_init_threadcount(Render *re) 
 {
-	if(RenderGlobal.threads >= 1) { /* only set as an arg in background mode */
+	if (RenderGlobal.threads >= 1) { /* only set as an arg in background mode */
 		re->r.threads= MIN2(RenderGlobal.threads, BLENDER_MAX_THREADS);
-	} else if ((re->r.mode & R_FIXED_THREADS)==0 || RenderGlobal.threads == 0) { /* Automatic threads */
+	}
+	else if ((re->r.mode & R_FIXED_THREADS)==0 || RenderGlobal.threads == 0) { /* Automatic threads */
 		re->r.threads = BLI_system_thread_count();
 	}
 }
 
 /* loads in image into a result, size must match
- * x/y offsets are only used on a partial copy when dimensions dont match */
+ * x/y offsets are only used on a partial copy when dimensions don't match */
 void RE_layer_load_from_file(RenderLayer *layer, ReportList *reports, const char *filename, int x, int y)
 {
 	ImBuf *ibuf = IMB_loadiffname(filename, IB_rect);
 
-	if(ibuf  && (ibuf->rect || ibuf->rect_float)) {
+	if (ibuf  && (ibuf->rect || ibuf->rect_float)) {
 		if (ibuf->x == layer->rectx && ibuf->y == layer->recty) {
-			if(ibuf->rect_float==NULL)
+			if (ibuf->rect_float==NULL)
 				IMB_float_from_rect(ibuf);
 
 			memcpy(layer->rectf, ibuf->rect_float, sizeof(float)*4*layer->rectx*layer->recty);
-		} else {
+		}
+		else {
 			if ((ibuf->x - x >= layer->rectx) && (ibuf->y - y >= layer->recty)) {
 				ImBuf *ibuf_clip;
 
-				if(ibuf->rect_float==NULL)
+				if (ibuf->rect_float==NULL)
 					IMB_float_from_rect(ibuf);
 
 				ibuf_clip = IMB_allocImBuf(layer->rectx, layer->recty, 32, IB_rectfloat);
-				if(ibuf_clip) {
+				if (ibuf_clip) {
 					IMB_rectcpy(ibuf_clip, ibuf, 0,0, x,y, layer->rectx, layer->recty);
 
 					memcpy(layer->rectf, ibuf_clip->rect_float, sizeof(float)*4*layer->rectx*layer->recty);
@@ -2369,7 +2398,7 @@ void RE_layer_load_from_file(RenderLayer *layer, ReportList *reports, const char
 
 void RE_result_load_from_file(RenderResult *result, ReportList *reports, const char *filename)
 {
-	if(!render_result_exr_file_read_path(result, filename)) {
+	if (!render_result_exr_file_read_path(result, filename)) {
 		BKE_reportf(reports, RPT_ERROR, "RE_result_rect_from_file: failed to load '%s'\n", filename);
 		return;
 	}
@@ -2386,7 +2415,7 @@ int RE_WriteEnvmapResult(struct ReportList *reports, Scene *scene, EnvMap *env,
 	int maxX=0,maxY=0,i=0;
 	char filepath[FILE_MAX];
 
-	if(env->cube[1]==NULL) {
+	if (env->cube[1]==NULL) {
 		BKE_report(reports, RPT_ERROR, "There is no generated environment map available to save");
 		return 0;
 	}
@@ -2428,7 +2457,7 @@ int RE_WriteEnvmapResult(struct ReportList *reports, Scene *scene, EnvMap *env,
 
 	IMB_freeImBuf(ibuf);
 
-	if(ok) {
+	if (ok) {
 		return TRUE;
 	}
 	else {
diff --git a/source/blender/render/intern/source/pixelblending.c b/source/blender/render/intern/source/pixelblending.c
index 708f469..48ce611 100644
--- a/source/blender/render/intern/source/pixelblending.c
+++ b/source/blender/render/intern/source/pixelblending.c
@@ -55,7 +55,7 @@ extern struct Render R;
 
 
 /* ------------------------------------------------------------------------- */
-/* Debug/behaviour defines                                                   */
+/* Debug/behavior defines                                                   */
 /* if defined: alpha blending with floats clips color, as with shorts       */
 /* #define RE_FLOAT_COLOR_CLIPPING  */
 /* if defined: alpha values are clipped                                      */
@@ -119,28 +119,28 @@ void addalphaAddfacFloat(float *dest, float *source, char addfac)
 	/* blend colors*/
 	c= (m * dest[0]) + source[0];
 #ifdef RE_FLOAT_COLOR_CLIPPING
-	if(c >= RE_FULL_COLOR_FLOAT) dest[0] = RE_FULL_COLOR_FLOAT; 
+	if (c >= RE_FULL_COLOR_FLOAT) dest[0] = RE_FULL_COLOR_FLOAT; 
 	else 
 #endif
 		dest[0]= c;
    
 	c= (m * dest[1]) + source[1];
 #ifdef RE_FLOAT_COLOR_CLIPPING
-	if(c >= RE_FULL_COLOR_FLOAT) dest[1] = RE_FULL_COLOR_FLOAT; 
+	if (c >= RE_FULL_COLOR_FLOAT) dest[1] = RE_FULL_COLOR_FLOAT; 
 	else 
 #endif
 		dest[1]= c;
 
 	c= (m * dest[2]) + source[2];
 #ifdef RE_FLOAT_COLOR_CLIPPING
-	if(c >= RE_FULL_COLOR_FLOAT) dest[2] = RE_FULL_COLOR_FLOAT; 
+	if (c >= RE_FULL_COLOR_FLOAT) dest[2] = RE_FULL_COLOR_FLOAT; 
 	else 
 #endif
 		dest[2]= c;
 
 	c= (m * dest[3]) + source[3];
 #ifdef RE_ALPHA_CLIPPING
-	if(c >= RE_FULL_COLOR_FLOAT) dest[3] = RE_FULL_COLOR_FLOAT; 
+	if (c >= RE_FULL_COLOR_FLOAT) dest[3] = RE_FULL_COLOR_FLOAT; 
 	else 
 #endif
 	dest[3]= c;
@@ -172,12 +172,12 @@ void add_filt_fmask(unsigned int mask, float *col, float *rowbuf, int row_w)
 	maskand= (mask & 255);
 	maskshift= (mask >>8);
 	
-	for(j=2; j>=0; j--) {
+	for (j=2; j>=0; j--) {
 		
 		a= j;
 		
 		val= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift);
-		if(val!=0.0f) {
+		if (val!=0.0f) {
 			rb1[0]+= val*r;
 			rb1[1]+= val*g;
 			rb1[2]+= val*b;
@@ -186,7 +186,7 @@ void add_filt_fmask(unsigned int mask, float *col, float *rowbuf, int row_w)
 		a+=3;
 		
 		val= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift);
-		if(val!=0.0f) {
+		if (val!=0.0f) {
 			rb2[0]+= val*r;
 			rb2[1]+= val*g;
 			rb2[2]+= val*b;
@@ -195,7 +195,7 @@ void add_filt_fmask(unsigned int mask, float *col, float *rowbuf, int row_w)
 		a+=3;
 		
 		val= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift);
-		if(val!=0.0f) {
+		if (val!=0.0f) {
 			rb3[0]+= val*r;
 			rb3[1]+= val*g;
 			rb3[2]+= val*b;
@@ -216,7 +216,7 @@ void mask_array(unsigned int mask, float filt[][3])
 	unsigned int maskshift= (mask >>8);
 	int a, j;
 	
-	for(j=2; j>=0; j--) {
+	for (j=2; j>=0; j--) {
 		
 		a= j;
 		
@@ -233,18 +233,17 @@ void mask_array(unsigned int mask, float filt[][3])
 }
 
 
-/* 
-
-index ordering, scanline based:
-
- ---    ---   ---  
-| 2,0 | 2,1 | 2,2 |
- ---    ---   ---  
-| 1,0 | 1,1 | 1,2 |
- ---    ---   ---  
-| 0,0 | 0,1 | 0,2 |
- ---    ---   ---  
-*/
+/**
+ * Index ordering, scanline based:
+ *
+ *      ---    ---   ---
+ *     | 2,0 | 2,1 | 2,2 |
+ *      ---    ---   ---
+ *     | 1,0 | 1,1 | 1,2 |
+ *      ---    ---   ---
+ *     | 0,0 | 0,1 | 0,2 |
+ *      ---    ---   ---
+ */
 
 void add_filt_fmask_coord(float filt[][3], float *col, float *rowbuf, int row_w, int col_h, int x, int y)
 {
@@ -270,7 +269,7 @@ void add_filt_fmask_coord(float filt[][3], float *col, float *rowbuf, int row_w,
 	fpoin[1][2]= fpoin[1][1] + 4;
 	fpoin[2][2]= fpoin[2][1] + 4;
 	
-	if(y==0) {
+	if (y==0) {
 		fpoin[0][0]= fpoin[1][0];
 		fpoin[0][1]= fpoin[1][1];
 		fpoin[0][2]= fpoin[1][2];
@@ -279,7 +278,7 @@ void add_filt_fmask_coord(float filt[][3], float *col, float *rowbuf, int row_w,
 		lfilt[0][1]= filt[2][1];
 		lfilt[0][2]= filt[2][2];
 	}
-	else if(y==col_h-1) {
+	else if (y==col_h-1) {
 		fpoin[2][0]= fpoin[1][0];
 		fpoin[2][1]= fpoin[1][1];
 		fpoin[2][2]= fpoin[1][2];
@@ -289,7 +288,7 @@ void add_filt_fmask_coord(float filt[][3], float *col, float *rowbuf, int row_w,
 		lfilt[2][2]= filt[0][2];
 	}
 	
-	if(x==0) {
+	if (x==0) {
 		fpoin[2][0]= fpoin[2][1];
 		fpoin[1][0]= fpoin[1][1];
 		fpoin[0][0]= fpoin[0][1];
@@ -298,7 +297,7 @@ void add_filt_fmask_coord(float filt[][3], float *col, float *rowbuf, int row_w,
 		lfilt[1][0]= filt[1][2];
 		lfilt[0][0]= filt[0][2];
 	}
-	else if(x==row_w-1) {
+	else if (x==row_w-1) {
 		fpoin[2][2]= fpoin[2][1];
 		fpoin[1][2]= fpoin[1][1];
 		fpoin[0][2]= fpoin[0][1];
@@ -310,7 +309,7 @@ void add_filt_fmask_coord(float filt[][3], float *col, float *rowbuf, int row_w,
 	
 	
 	/* loop unroll */
-#define MASKFILT(i, j) 	val= lfilt[i][j]; if(val!=0.0f) {float *fp= fpoin[i][j]; fp[0]+= val*r; fp[1]+= val*g; fp[2]+= val*b; fp[3]+= val*al; }
+#define MASKFILT(i, j) 	val= lfilt[i][j]; if (val!=0.0f) {float *fp= fpoin[i][j]; fp[0]+= val*r; fp[1]+= val*g; fp[2]+= val*b; fp[3]+= val*al; }
 	
 	MASKFILT(0, 0)
 	MASKFILT(0, 1)
@@ -339,27 +338,27 @@ void add_filt_fmask_pixsize(unsigned int mask, float *in, float *rowbuf, int row
 	maskand= (mask & 255);
 	maskshift= (mask >>8);
 	
-	for(j=2; j>=0; j--) {
+	for (j=2; j>=0; j--) {
 		
 		a= j;
 		
 		val= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift);
-		if(val!=0.0f) {
-			for(i= 0; i<pixsize; i++)
+		if (val!=0.0f) {
+			for (i= 0; i<pixsize; i++)
 				rb1[i]+= val*in[i];
 		}
 		a+=3;
 		
 		val= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift);
-		if(val!=0.0f) {
-			for(i= 0; i<pixsize; i++)
+		if (val!=0.0f) {
+			for (i= 0; i<pixsize; i++)
 				rb2[i]+= val*in[i];
 		}
 		a+=3;
 		
 		val= *(fmask1[a] +maskand) + *(fmask2[a] +maskshift);
-		if(val!=0.0f) {
-			for(i= 0; i<pixsize; i++)
+		if (val!=0.0f) {
+			for (i= 0; i<pixsize; i++)
 				rb3[i]+= val*in[i];
 		}
 		
@@ -374,7 +373,7 @@ void addalphaAddFloat(float *dest, float *source)
 {
 
 	/* Makes me wonder whether this is required... */
-	if( dest[3] < RE_EMPTY_COLOR_FLOAT) {
+	if ( dest[3] < RE_EMPTY_COLOR_FLOAT) {
 		dest[0] = source[0];
 		dest[1] = source[1];
 		dest[2] = source[2];
diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c
index 24683ec..826a31e 100644
--- a/source/blender/render/intern/source/pixelshading.c
+++ b/source/blender/render/intern/source/pixelshading.c
@@ -89,14 +89,14 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
 	
 	vn= har->no;
 	
-	for(go=R.lights.first; go; go= go->next) {
+	for (go=R.lights.first; go; go= go->next) {
 		lar= go->lampren;
 		
 		/* test for lamplayer */
-		if(lar->mode & LA_LAYER) if((lar->lay & har->lay)==0) continue;
+		if (lar->mode & LA_LAYER) if ((lar->lay & har->lay)==0) continue;
 		
 		/* lampdist cacluation */
-		if(lar->type==LA_SUN || lar->type==LA_HEMI) {
+		if (lar->type==LA_SUN || lar->type==LA_HEMI) {
 			copy_v3_v3(lv, lar->vec);
 			lampdist= 1.0;
 		}
@@ -111,11 +111,11 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
 			
 			/* ld is re-used further on (texco's) */
 			
-			if(lar->mode & LA_QUAD) {
+			if (lar->mode & LA_QUAD) {
 				t= 1.0;
-				if(lar->ld1>0.0f)
+				if (lar->ld1>0.0f)
 					t= lar->dist/(lar->dist+lar->ld1*ld);
-				if(lar->ld2>0.0f)
+				if (lar->ld2>0.0f)
 					t*= lar->distkw/(lar->distkw+lar->ld2*ld*ld);
 				
 				lampdist= t;
@@ -124,9 +124,9 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
 				lampdist= (lar->dist/(lar->dist+ld));
 			}
 			
-			if(lar->mode & LA_SPHERE) {
+			if (lar->mode & LA_SPHERE) {
 				t= lar->dist - ld;
-				if(t<0.0f) continue;
+				if (t<0.0f) continue;
 				
 				t/= lar->dist;
 				lampdist*= (t);
@@ -138,11 +138,12 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
 		lacol[1]= lar->g;
 		lacol[2]= lar->b;
 		
-		if(lar->mode & LA_TEXTURE) {
+		if (lar->mode & LA_TEXTURE) {
 			ShadeInput shi;
 			
 			/* Warning, This is not that nice, and possibly a bit slow,
-			however some variables were not initialized properly in, unless using shade_input_initialize(...), we need to do a memset */
+			 * however some variables were not initialized properly in, unless using shade_input_initialize(...),
+			 * we need to do a memset */
 			memset(&shi, 0, sizeof(ShadeInput)); 
 			/* end warning! - Campbell */
 			
@@ -151,17 +152,17 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
 			do_lamp_tex(lar, lv, &shi, lacol, LA_TEXTURE);
 		}
 		
-		if(lar->type==LA_SPOT) {
+		if (lar->type==LA_SPOT) {
 			
-			if(lar->mode & LA_SQUARE) {
-				if(lv[0]*lar->vec[0]+lv[1]*lar->vec[1]+lv[2]*lar->vec[2]>0.0f) {
+			if (lar->mode & LA_SQUARE) {
+				if (lv[0]*lar->vec[0]+lv[1]*lar->vec[1]+lv[2]*lar->vec[2]>0.0f) {
 					float x, lvrot[3];
 					
 					/* rotate view to lampspace */
 					copy_v3_v3(lvrot, lv);
 					mul_m3_v3(lar->imat, lvrot);
 					
-					x= MAX2(fabs(lvrot[0]/lvrot[2]) , fabs(lvrot[1]/lvrot[2]));
+					x = maxf(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));
@@ -173,25 +174,25 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
 			}
 			
 			t= lar->spotsi;
-			if(inpr<t) continue;
+			if (inpr<t) continue;
 			else {
 				t= inpr-t;
 				soft= 1.0;
-				if(t<lar->spotbl && lar->spotbl!=0.0f) {
+				if (t<lar->spotbl && lar->spotbl!=0.0f) {
 					/* soft area */
 					i= t/lar->spotbl;
 					t= i*i;
 					soft= (3.0f*t-2.0f*t*i);
 					inpr*= soft;
 				}
-				if(lar->mode & LA_ONLYSHADOW) {
-					/* if(ma->mode & MA_SHADOW) { */
+				if (lar->mode & LA_ONLYSHADOW) {
+					/* if (ma->mode & MA_SHADOW) { */
 					/* dot product positive: front side face! */
 					inp= vn[0]*lv[0] + vn[1]*lv[1] + vn[2]*lv[2];
-					if(inp>0.0f) {
+					if (inp>0.0f) {
 						/* testshadowbuf==0.0 : 100% shadow */
 						shadfac = testshadowbuf(&R, lar->shb, rco, dco, dco, inp, 0.0f);
-						if( shadfac>0.0f ) {
+						if ( shadfac>0.0f ) {
 							shadfac*= inp*soft*lar->energy;
 							ir -= shadfac;
 							ig -= shadfac;
@@ -204,7 +205,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
 				}
 				lampdist*=inpr;
 			}
-			if(lar->mode & LA_ONLYSHADOW) continue;
+			if (lar->mode & LA_ONLYSHADOW) continue;
 			
 		}
 		
@@ -216,32 +217,32 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
 		
 		i= inp;
 		
-		if(lar->type==LA_HEMI) {
+		if (lar->type==LA_HEMI) {
 			i= 0.5f*i+0.5f;
 		}
-		if(i>0.0f) {
+		if (i>0.0f) {
 			i*= lampdist;
 		}
 		
 		/* shadow  */
-		if(i> -0.41f) { /* heuristic valua! */
-			if(lar->shb) {
+		if (i> -0.41f) { /* heuristic valua! */
+			if (lar->shb) {
 				shadfac = testshadowbuf(&R, lar->shb, rco, dco, dco, inp, 0.0f);
-				if(shadfac==0.0f) continue;
+				if (shadfac==0.0f) continue;
 				i*= shadfac;
 			}
 		}
 		
-		if(i>0.0f) {
+		if (i>0.0f) {
 			ir+= i*lacol[0];
 			ig+= i*lacol[1];
 			ib+= i*lacol[2];
 		}
 	}
 	
-	if(ir<0.0f) ir= 0.0f;
-	if(ig<0.0f) ig= 0.0f;
-	if(ib<0.0f) ib= 0.0f;
+	if (ir<0.0f) ir= 0.0f;
+	if (ig<0.0f) ig= 0.0f;
+	if (ib<0.0f) ib= 0.0f;
 
 	col_r[0]*= ir;
 	col_r[1]*= ig;
@@ -252,18 +253,18 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
 
 /**
  * Converts a halo z-buffer value to distance from the camera's near plane
- * @param z The z-buffer value to convert
- * @return a distance from the camera's near plane in blender units
+ * \param z The z-buffer value to convert
+ * \return a distance from the camera's near plane in blender units
  */
 static float haloZtoDist(int z)
 {
 	float zco = 0;
 
-	if(z >= 0x7FFFFF)
+	if (z >= 0x7FFFFF)
 		return 10e10;
 	else {
 		zco = (float)z/(float)0x7FFFFF;
-		if(R.r.mode & R_ORTHO)
+		if (R.r.mode & R_ORTHO)
 			return (R.winmat[3][2] - zco*R.winmat[3][3])/(R.winmat[2][2]);
 		else
 			return (R.winmat[3][2])/(R.winmat[2][2] - R.winmat[2][3]*zco);
@@ -271,13 +272,13 @@ static float haloZtoDist(int z)
 }
 
 /**
- * @param col (float[4]) Store the rgb color here (with alpha)
+ * \param col (float[4]) Store the rgb color here (with alpha)
  * The alpha is used to blend the color to the background 
  * color_new = (1-alpha)*color_background + color
- * @param zz The current zbuffer value at the place of this pixel
- * @param dist Distance of the pixel from the center of the halo squared. Given in pixels
- * @param xn The x coordinate of the pixel relaticve to the center of the halo. given in pixels
- * @param yn The y coordinate of the pixel relaticve to the center of the halo. given in pixels
+ * \param zz The current zbuffer value at the place of this pixel
+ * \param dist Distance of the pixel from the center of the halo squared. Given in pixels
+ * \param xn The x coordinate of the pixel relaticve to the center of the halo. given in pixels
+ * \param yn The y coordinate of the pixel relaticve to the center of the halo. given in pixels
  */
 int shadeHaloFloat(HaloRen *har,  float *col, int zz, 
 					float dist, float xn,  float yn, short flarec)
@@ -286,8 +287,8 @@ int shadeHaloFloat(HaloRen *har,  float *col, int zz,
 	float t, zn, radist, ringf=0.0f, linef=0.0f, alpha, si, co;
 	int a;
    
-	if(R.wrld.mode & WO_MIST) {
-		if(har->type & HA_ONLYSKY) {
+	if (R.wrld.mode & WO_MIST) {
+		if (har->type & HA_ONLYSKY) {
 			/* stars but no mist */
 			alpha= har->alfa;
 		}
@@ -298,37 +299,37 @@ int shadeHaloFloat(HaloRen *har,  float *col, int zz,
 	}
 	else alpha= har->alfa;
 	
-	if(alpha==0.0f)
+	if (alpha==0.0f)
 		return 0;
 
 	/* soften the halo if it intersects geometry */
-	if(har->mat && har->mat->mode & MA_HALO_SOFT) {
+	if (har->mat && har->mat->mode & MA_HALO_SOFT) {
 		float segment_length, halo_depth, distance_from_z /* , visible_depth */ /* UNUSED */, soften;
 		
 		/* calculate halo depth */
 		segment_length= har->hasize*sasqrt(1.0f - dist/(har->rad*har->rad));
 		halo_depth= 2.0f*segment_length;
 
-		if(halo_depth < FLT_EPSILON)
+		if (halo_depth < FLT_EPSILON)
 			return 0;
 
 		/* calculate how much of this depth is visible */
 		distance_from_z = haloZtoDist(zz) - haloZtoDist(har->zs);
 		/* visible_depth = halo_depth; */ /* UNUSED */
-		if(distance_from_z < segment_length) {
+		if (distance_from_z < segment_length) {
 			soften= (segment_length + distance_from_z)/halo_depth;
 
 			/* apply softening to alpha */
-			if(soften < 1.0f)
+			if (soften < 1.0f)
 				alpha *= soften;
-			if(alpha <= 0.0f)
+			if (alpha <= 0.0f)
 				return 0;
 		}
 	}
 	else {
 		/* not a soft halo. use the old softening code */
 		/* halo being intersected? */
-		if(har->zs> zz-har->zd) {
+		if (har->zs> zz-har->zd) {
 			t= ((float)(zz-har->zs))/(float)har->zd;
 			alpha*= sqrtf(sqrtf(t));
 		}
@@ -337,31 +338,31 @@ int shadeHaloFloat(HaloRen *har,  float *col, int zz,
 	radist= sqrt(dist);
 
 	/* watch it: not used nicely: flarec is set at zero in pixstruct */
-	if(flarec) har->pixels+= (int)(har->rad-radist);
+	if (flarec) har->pixels+= (int)(har->rad-radist);
 
-	if(har->ringc) {
+	if (har->ringc) {
 		float *rc, fac;
 		int ofs;
 		
 		/* per ring an antialised circle */
 		ofs= har->seed;
 		
-		for(a= har->ringc; a>0; a--, ofs+=2) {
+		for (a= har->ringc; a>0; a--, ofs+=2) {
 			
 			rc= hashvectf + (ofs % 768);
 			
 			fac= fabsf( rc[1]*(har->rad*fabsf(rc[0]) - radist) );
 			
-			if(fac< 1.0f) {
+			if (fac< 1.0f) {
 				ringf+= (1.0f-fac);
 			}
 		}
 	}
 
-	if(har->type & HA_VECT) {
+	if (har->type & HA_VECT) {
 		dist= fabsf( har->cos*(yn) - har->sin*(xn) )/har->rad;
-		if(dist>1.0f) dist= 1.0f;
-		if(har->tex) {
+		if (dist>1.0f) dist= 1.0f;
+		if (har->tex) {
 			zn= har->sin*xn - har->cos*yn;
 			yn= har->cos*xn + har->sin*yn;
 			xn= zn;
@@ -369,49 +370,49 @@ int shadeHaloFloat(HaloRen *har,  float *col, int zz,
 	}
 	else dist= dist/har->radsq;
 
-	if(har->type & HA_FLARECIRC) {
+	if (har->type & HA_FLARECIRC) {
 		
 		dist= 0.5+fabs(dist-0.5f);
 		
 	}
 
-	if(har->hard>=30) {
+	if (har->hard>=30) {
 		dist= sqrt(dist);
-		if(har->hard>=40) {
+		if (har->hard>=40) {
 			dist= sinf(dist*(float)M_PI_2);
-			if(har->hard>=50) {
+			if (har->hard>=50) {
 				dist= sqrt(dist);
 			}
 		}
 	}
-	else if(har->hard<20) dist*=dist;
+	else if (har->hard<20) dist*=dist;
 
-	if(dist < 1.0f)
+	if (dist < 1.0f)
 		dist= (1.0f-dist);
 	else
 		dist= 0.0f;
 	
-	if(har->linec) {
+	if (har->linec) {
 		float *rc, fac;
 		int ofs;
 		
 		/* per starpoint an antialiased line */
 		ofs= har->seed;
 		
-		for(a= har->linec; a>0; a--, ofs+=3) {
+		for (a= har->linec; a>0; a--, ofs+=3) {
 			
 			rc= hashvectf + (ofs % 768);
 			
 			fac= fabs( (xn)*rc[0]+(yn)*rc[1]);
 			
-			if(fac< 1.0f )
+			if (fac< 1.0f )
 				linef+= (1.0f-fac);
 		}
 		
 		linef*= dist;
 	}
 
-	if(har->starpoints) {
+	if (har->starpoints) {
 		float ster, angle;
 		/* rotation */
 		angle= atan2(yn, xn);
@@ -423,15 +424,15 @@ int shadeHaloFloat(HaloRen *har,  float *col, int zz,
 		angle= (co*xn+si*yn)*(co*yn-si*xn);
 		
 		ster= fabs(angle);
-		if(ster>1.0f) {
+		if (ster>1.0f) {
 			ster= (har->rad)/(ster);
 			
-			if(ster<1.0f) dist*= sqrtf(ster);
+			if (ster<1.0f) dist*= sqrtf(ster);
 		}
 	}
 
 	/* disputable optimize... (ton) */
-	if(dist<=0.00001f)
+	if (dist<=0.00001f)
 		return 0;
 	
 	dist*= alpha;
@@ -440,7 +441,7 @@ int shadeHaloFloat(HaloRen *har,  float *col, int zz,
 	
 	/* The color is either the rgb spec-ed by the user, or extracted from   */
 	/* the texture                                                           */
-	if(har->tex) {
+	if (har->tex) {
 		col[0]= har->r; 
 		col[1]= har->g; 
 		col[2]= har->b;
@@ -457,41 +458,41 @@ int shadeHaloFloat(HaloRen *har,  float *col, int zz,
 		col[0]= dist*har->r;
 		col[1]= dist*har->g;
 		col[2]= dist*har->b;
-		if(har->type & HA_XALPHA) col[3]= dist*dist;
+		if (har->type & HA_XALPHA) col[3]= dist*dist;
 		else col[3]= dist;
 	}
 
-	if(har->mat) {
-		if(har->mat->mode & MA_HALO_SHADE) {
+	if (har->mat) {
+		if (har->mat->mode & MA_HALO_SHADE) {
 			/* we test for lights because of preview... */
-			if(R.lights.first) render_lighting_halo(har, col);
+			if (R.lights.first) render_lighting_halo(har, col);
 		}
 
 		/* Next, we do the line and ring factor modifications. */
-		if(linef!=0.0f) {
+		if (linef!=0.0f) {
 			Material *ma= har->mat;
 			
 			col[0]+= linef * ma->specr;
 			col[1]+= linef * ma->specg;
 			col[2]+= linef * ma->specb;
 			
-			if(har->type & HA_XALPHA) col[3]+= linef*linef;
+			if (har->type & HA_XALPHA) col[3]+= linef*linef;
 			else col[3]+= linef;
 		}
-		if(ringf!=0.0f) {
+		if (ringf!=0.0f) {
 			Material *ma= har->mat;
 
 			col[0]+= ringf * ma->mirr;
 			col[1]+= ringf * ma->mirg;
 			col[2]+= ringf * ma->mirb;
 			
-			if(har->type & HA_XALPHA) col[3]+= ringf*ringf;
+			if (har->type & HA_XALPHA) col[3]+= ringf*ringf;
 			else col[3]+= ringf;
 		}
 	}
 	
 	/* alpha requires clip, gives black dots */
-	if(col[3] > 1.0f)
+	if (col[3] > 1.0f)
 		col[3]= 1.0f;
 
 	return 1;
@@ -509,15 +510,15 @@ void shadeSkyView(float col_r[3], const float rco[3], const float view[3], const
 	skyflag = WO_ZENUP;
 	
 	/* Some view vector stuff. */
-	if(R.wrld.skytype & WO_SKYREAL) {
+	if (R.wrld.skytype & WO_SKYREAL) {
 		
 		blend = dot_v3v3(view, R.grvec);
 		
-		if(blend<0.0f) skyflag= 0;
+		if (blend<0.0f) skyflag= 0;
 		
 		blend= fabs(blend);
 	}
-	else if(R.wrld.skytype & WO_SKYPAPER) {
+	else if (R.wrld.skytype & WO_SKYPAPER) {
 		blend= 0.5f + 0.5f * view[1];
 	}
 	else {
@@ -530,9 +531,9 @@ void shadeSkyView(float col_r[3], const float rco[3], const float view[3], const
 
 	/* Careful: SKYTEX and SKYBLEND are NOT mutually exclusive! If           */
 	/* SKYBLEND is active, the texture and color blend are added.           */
-	if(R.wrld.skytype & WO_SKYTEX) {
+	if (R.wrld.skytype & WO_SKYTEX) {
 		copy_v3_v3(lo, view);
-		if(R.wrld.skytype & WO_SKYREAL) {
+		if (R.wrld.skytype & WO_SKYREAL) {
 			
 			mul_m3_v3(R.imat, lo);
 			
@@ -542,15 +543,16 @@ void shadeSkyView(float col_r[3], const float rco[3], const float view[3], const
 		do_sky_tex(rco, lo, dxyview, hor, zen, &blend, skyflag, thread);
 	}
 	
-	if(blend>1.0f) blend= 1.0f;
+	if (blend>1.0f) blend= 1.0f;
 	blendm= 1.0f-blend;
 	
 	/* No clipping, no conversion! */
-	if(R.wrld.skytype & WO_SKYBLEND) {
+	if (R.wrld.skytype & WO_SKYBLEND) {
 		col_r[0] = (blendm*hor[0] + blend*zen[0]);
 		col_r[1] = (blendm*hor[1] + blend*zen[1]);
 		col_r[2] = (blendm*hor[2] + blend*zen[2]);
-	} else {
+	}
+	else {
 		/* Done when a texture was grabbed. */
 		col_r[0]= hor[0];
 		col_r[1]= hor[1];
@@ -566,13 +568,13 @@ void shadeSunView(float col_r[3], const float view[3])
 	float sview[3];
 	int do_init= 1;
 	
-	for(go=R.lights.first; go; go= go->next) {
+	for (go=R.lights.first; go; go= go->next) {
 		lar= go->lampren;
-		if(lar->type==LA_SUN &&	lar->sunsky && (lar->sunsky->effect_type & LA_SUN_EFFECT_SKY)){
+		if (lar->type==LA_SUN &&	lar->sunsky && (lar->sunsky->effect_type & LA_SUN_EFFECT_SKY)) {
 			float sun_collector[3];
 			float colorxyz[3];
 			
-			if(do_init) {
+			if (do_init) {
 
 				normalize_v3_v3(sview, view);
 				mul_m3_v3(R.imat, sview);
@@ -593,21 +595,21 @@ void shadeSunView(float col_r[3], const float view[3])
 
 
 /*
-  Stuff the sky color into the collector.
+ * Stuff the sky color into the collector.
  */
 void shadeSkyPixel(float collector[4], float fx, float fy, short thread)
 {
 	float view[3], dxyview[2];
 
 	/*
-	  The rules for sky:
-	  1. Draw an image, if a background image was provided. Stop
-	  2. get texture and color blend, and combine these.
-	*/
+	 * The rules for sky:
+	 * 1. Draw an image, if a background image was provided. Stop
+	 * 2. get texture and color blend, and combine these.
+	 */
 
 	float fac;
 
-	if((R.wrld.skytype & (WO_SKYBLEND+WO_SKYTEX))==0) {
+	if ((R.wrld.skytype & (WO_SKYBLEND+WO_SKYTEX))==0) {
 		/* 1. solid color */
 		copy_v3_v3(collector, &R.wrld.horr);
 
@@ -617,7 +619,7 @@ void shadeSkyPixel(float collector[4], float fx, float fy, short thread)
 		/* 2. */
 
 		/* This one true because of the context of this routine  */
-		if(R.wrld.skytype & WO_SKYPAPER) {
+		if (R.wrld.skytype & WO_SKYPAPER) {
 			view[0]= -1.0f + 2.0f*(fx/(float)R.winx);
 			view[1]= -1.0f + 2.0f*(fy/(float)R.winy);
 			view[2]= 0.0;
@@ -629,7 +631,7 @@ void shadeSkyPixel(float collector[4], float fx, float fy, short thread)
 			calc_view_vector(view, fx, fy);
 			fac= normalize_v3(view);
 			
-			if(R.wrld.skytype & WO_SKYTEX) {
+			if (R.wrld.skytype & WO_SKYTEX) {
 				dxyview[0]= -R.viewdx/fac;
 				dxyview[1]= -R.viewdy/fac;
 			}
diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c
index ae37487..5d4f9db 100644
--- a/source/blender/render/intern/source/pointdensity.c
+++ b/source/blender/render/intern/source/pointdensity.c
@@ -151,7 +151,7 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa
 	for (i=0, pa=psys->particles; i < total_particles; i++, pa++) {
 
 		state.time = cfra;
-		if(psys_get_particle_state(&sim, i, &state, 0)) {
+		if (psys_get_particle_state(&sim, i, &state, 0)) {
 			
 			copy_v3_v3(partco, state.co);
 			
@@ -159,7 +159,8 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa
 				mul_m4_v3(ob->imat, partco);
 			else if (pd->psys_cache_space == TEX_PD_OBJECTLOC) {
 				sub_v3_v3(partco, ob->loc);
-			} else {
+			}
+			else {
 				/* TEX_PD_WORLDSPACE */
 			}
 			
@@ -175,7 +176,8 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa
 				
 				if (i < psys->totpart) {
 					pa_time = (cfra - pa->time)/pa->lifetime;
-				} else {
+				}
+				else {
 					ChildParticle *cpa= (psys->child + i) - psys->totpart;
 					float pa_birthtime, pa_dietime;
 					
@@ -191,7 +193,7 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa
 	BLI_bvhtree_balance(pd->point_tree);
 	dm->release(dm);
 	
-	if(psys->lattice){
+	if (psys->lattice) {
 		end_latt_deform(psys->lattice);
 		psys->lattice=0;
 	}
@@ -214,7 +216,7 @@ static void pointdensity_cache_object(Render *re, PointDensity *pd, Object *ob)
 
 	pd->point_tree = BLI_bvhtree_new(pd->totpoints, 0.0, 4, 6);
 	
-	for(i=0; i < pd->totpoints; i++, mvert++) {
+	for (i=0; i < pd->totpoints; i++, mvert++) {
 		float co[3];
 		
 		copy_v3_v3(co, mvert->co);
@@ -243,7 +245,7 @@ void cache_pointdensity(Render *re, Tex *tex)
 {
 	PointDensity *pd = tex->pd;
 	
-	if(!pd)
+	if (!pd)
 		return;
 
 	if (pd->point_tree) {
@@ -293,14 +295,14 @@ void make_pointdensities(Render *re)
 {
 	Tex *tex;
 	
-	if(re->scene->r.scemode & R_PREVIEWBUTS)
+	if (re->scene->r.scemode & R_PREVIEWBUTS)
 		return;
 	
 	re->i.infostr= "Caching Point Densities";
 	re->stats_draw(re->sdh, &re->i);
 
 	for (tex= re->main->tex.first; tex; tex= tex->id.next) {
-		if(tex->id.us && tex->type==TEX_POINTDENSITY) {
+		if (tex->id.us && tex->type==TEX_POINTDENSITY) {
 			cache_pointdensity(re, tex);
 		}
 	}
@@ -313,11 +315,11 @@ void free_pointdensities(Render *re)
 {
 	Tex *tex;
 	
-	if(re->scene->r.scemode & R_PREVIEWBUTS)
+	if (re->scene->r.scemode & R_PREVIEWBUTS)
 		return;
 	
 	for (tex= re->main->tex.first; tex; tex= tex->id.next) {
-		if(tex->id.us && tex->type==TEX_POINTDENSITY) {
+		if (tex->id.us && tex->type==TEX_POINTDENSITY) {
 			free_pointdensity(re, tex);
 		}
 	}
@@ -346,9 +348,9 @@ static void accum_density(void *userdata, int index, float squared_dist)
 	float density = 0.0f;
 	
 	if (pdr->point_data_used & POINT_DATA_VEL) {
-		pdr->vec[0] += pdr->point_data[index*3 + 0]; //* density;
-		pdr->vec[1] += pdr->point_data[index*3 + 1]; //* density;
-		pdr->vec[2] += pdr->point_data[index*3 + 2]; //* density;
+		pdr->vec[0] += pdr->point_data[index*3 + 0]; // * density;
+		pdr->vec[1] += pdr->point_data[index*3 + 1]; // * density;
+		pdr->vec[2] += pdr->point_data[index*3 + 2]; // * density;
 	}
 	if (pdr->point_data_used & POINT_DATA_LIFE) {
 		*pdr->age += pdr->point_data[pdr->offset + index]; // * density;
@@ -515,9 +517,9 @@ int pointdensitytex(Tex *tex, float *texvec, TexResult *texres)
 	
 	return retval;
 	
-	/*
+#if 0
 	if (texres->nor!=NULL) {
 		texres->nor[0] = texres->nor[1] = texres->nor[2] = 0.0f;
 	}
-	*/
+#endif
 }
diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c
index 6c0386c..0c735c1 100644
--- a/source/blender/render/intern/source/rayshade.c
+++ b/source/blender/render/intern/source/rayshade.c
@@ -87,7 +87,7 @@ static int test_break(void *data)
 
 static void RE_rayobject_config_control(RayObject *r, Render *re)
 {
-	if(RE_rayobject_isRayAPI(r))
+	if (RE_rayobject_isRayAPI(r))
 	{
 		r = RE_rayobject_align( r );
 		r->control.data = re;
@@ -99,10 +99,10 @@ static RayObject*  RE_rayobject_create(Render *re, int type, int size)
 {
 	RayObject * res = NULL;
 
-	if(type == R_RAYSTRUCTURE_AUTO)
+	if (type == R_RAYSTRUCTURE_AUTO)
 	{
 		//TODO
-		//if(detect_simd())
+		//if (detect_simd())
 #ifdef __SSE__
 		type = BLI_cpu_support_sse2()? R_RAYSTRUCTURE_SIMD_SVBVH: R_RAYSTRUCTURE_VBVH;
 #else
@@ -111,7 +111,7 @@ static RayObject*  RE_rayobject_create(Render *re, int type, int size)
 	}
 	
 #ifndef __SSE__
-	if(type == R_RAYSTRUCTURE_SIMD_SVBVH || type == R_RAYSTRUCTURE_SIMD_QBVH)
+	if (type == R_RAYSTRUCTURE_SIMD_SVBVH || type == R_RAYSTRUCTURE_SIMD_QBVH)
 	{
 		puts("Warning: Using VBVH (SSE was disabled at compile time)");
 		type = R_RAYSTRUCTURE_VBVH;
@@ -119,22 +119,22 @@ static RayObject*  RE_rayobject_create(Render *re, int type, int size)
 #endif
 	
 		
-	if(type == R_RAYSTRUCTURE_OCTREE) //TODO dynamic ocres
+	if (type == R_RAYSTRUCTURE_OCTREE) //TODO dynamic ocres
 		res = RE_rayobject_octree_create(re->r.ocres, size);
-	else if(type == R_RAYSTRUCTURE_BLIBVH)
+	else if (type == R_RAYSTRUCTURE_BLIBVH)
 		res = RE_rayobject_blibvh_create(size);
-	else if(type == R_RAYSTRUCTURE_VBVH)
+	else if (type == R_RAYSTRUCTURE_VBVH)
 		res = RE_rayobject_vbvh_create(size);
-	else if(type == R_RAYSTRUCTURE_SIMD_SVBVH)
+	else if (type == R_RAYSTRUCTURE_SIMD_SVBVH)
 		res = RE_rayobject_svbvh_create(size);
-	else if(type == R_RAYSTRUCTURE_SIMD_QBVH)
+	else if (type == R_RAYSTRUCTURE_SIMD_QBVH)
 		res = RE_rayobject_qbvh_create(size);
 	else
 		res = RE_rayobject_vbvh_create(size);	//Fallback
 	
 	
-	if(res)
-		RE_rayobject_config_control( res, re );
+	if (res)
+		RE_rayobject_config_control(res, re);
 	
 	return res;
 }
@@ -148,36 +148,36 @@ void freeraytree(Render *re)
 {
 	ObjectInstanceRen *obi;
 	
-	if(re->raytree)
+	if (re->raytree)
 	{
 		RE_rayobject_free(re->raytree);
 		re->raytree = NULL;
 	}
-	if(re->rayfaces)
+	if (re->rayfaces)
 	{
 		MEM_freeN(re->rayfaces);
 		re->rayfaces = NULL;
 	}
-	if(re->rayprimitives)
+	if (re->rayprimitives)
 	{
 		MEM_freeN(re->rayprimitives);
 		re->rayprimitives = NULL;
 	}
 
-	for(obi=re->instancetable.first; obi; obi=obi->next)
+	for (obi=re->instancetable.first; obi; obi=obi->next)
 	{
 		ObjectRen *obr = obi->obr;
-		if(obr->raytree)
+		if (obr->raytree)
 		{
 			RE_rayobject_free(obr->raytree);
 			obr->raytree = NULL;
 		}
-		if(obr->rayfaces)
+		if (obr->rayfaces)
 		{
 			MEM_freeN(obr->rayfaces);
 			obr->rayfaces = NULL;
 		}
-		if(obi->raytree)
+		if (obi->raytree)
 		{
 			RE_rayobject_free(obi->raytree);
 			obi->raytree = NULL;
@@ -189,7 +189,7 @@ void freeraytree(Render *re)
 		RayCounter sum;
 		memset( &sum, 0, sizeof(sum) );
 		int i;
-		for(i=0; i<BLENDER_MAX_THREADS; i++)
+		for (i=0; i<BLENDER_MAX_THREADS; i++)
 			RE_RC_MERGE(&sum, re_rc_counter+i);
 		RE_RC_INFO(&sum);
 	}
@@ -199,8 +199,8 @@ void freeraytree(Render *re)
 static int is_raytraceable_vlr(Render *re, VlakRen *vlr)
 {
 	/* note: volumetric must be tracable, wire must not */
-	if((re->flag & R_BAKE_TRACE) || (vlr->flag & R_TRACEBLE) || (vlr->mat->material_type == MA_TYPE_VOLUME))
-		if(vlr->mat->material_type != MA_TYPE_WIRE)
+	if ((re->flag & R_BAKE_TRACE) || (vlr->flag & R_TRACEBLE) || (vlr->mat->material_type == MA_TYPE_VOLUME))
+		if (vlr->mat->material_type != MA_TYPE_WIRE)
 			return 1;
 	return 0;
 }
@@ -210,13 +210,13 @@ static int is_raytraceable(Render *re, ObjectInstanceRen *obi)
 	int v;
 	ObjectRen *obr = obi->obr;
 
-	if(re->excludeob && obr->ob == re->excludeob)
+	if (re->excludeob && obr->ob == re->excludeob)
 		return 0;
 
-	for(v=0;v<obr->totvlak;v++) {
+	for (v=0;v<obr->totvlak;v++) {
 		VlakRen *vlr = obr->vlaknodes[v>>8].vlak + (v&255);
 
-		if(is_raytraceable_vlr(re, vlr))
+		if (is_raytraceable_vlr(re, vlr))
 			return 1;
 	}
 
@@ -232,7 +232,7 @@ RayObject* makeraytree_object(Render *re, ObjectInstanceRen *obi)
 	// update render stats
 	ObjectRen *obr = obi->obr;
 	
-	if(obr->raytree == NULL)
+	if (obr->raytree == NULL)
 	{
 		RayObject *raytree;
 		RayFace *face = NULL;
@@ -241,10 +241,10 @@ RayObject* makeraytree_object(Render *re, ObjectInstanceRen *obi)
 		
 		//Count faces
 		int faces = 0;
-		for(v=0;v<obr->totvlak;v++)
+		for (v=0;v<obr->totvlak;v++)
 		{
 			VlakRen *vlr = obr->vlaknodes[v>>8].vlak + (v&255);
-			if(is_raytraceable_vlr(re, vlr))
+			if (is_raytraceable_vlr(re, vlr))
 				faces++;
 		}
 		
@@ -253,26 +253,24 @@ RayObject* makeraytree_object(Render *re, ObjectInstanceRen *obi)
 
 		//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) )
+		if (  (re->r.raytrace_options & R_RAYTRACE_USE_LOCAL_COORDS) )
 			vlakprimitive = obr->rayprimitives = (VlakPrimitive*)MEM_callocN(faces*sizeof(VlakPrimitive), "ObjectRen primitives");
 		else
 			face = obr->rayfaces = (RayFace*)MEM_callocN(faces*sizeof(RayFace), "ObjectRen faces");
 
 		obr->rayobi = obi;
 		
-		for(v=0;v<obr->totvlak;v++)
+		for (v=0;v<obr->totvlak;v++)
 		{
 			VlakRen *vlr = obr->vlaknodes[v>>8].vlak + (v&255);
-			if(is_raytraceable_vlr(re, vlr))
+			if (is_raytraceable_vlr(re, vlr))
 			{
-				if(  (re->r.raytrace_options & R_RAYTRACE_USE_LOCAL_COORDS) )
-				{
+				if ((re->r.raytrace_options & R_RAYTRACE_USE_LOCAL_COORDS)) {
 					RE_rayobject_add( raytree, RE_vlakprimitive_from_vlak( vlakprimitive, obi, vlr ) );
 					vlakprimitive++;
 				}
-				else
-				{
-					RE_rayface_from_vlak( face, obi, vlr );				
+				else {
+					RE_rayface_from_vlak(face, obi, vlr);
 					RE_rayobject_add( raytree, RE_rayobject_unalignRayFace(face) );
 					face++;
 				}
@@ -281,38 +279,38 @@ RayObject* makeraytree_object(Render *re, ObjectInstanceRen *obi)
 		RE_rayobject_done( raytree );
 
 		/* in case of cancel during build, raytree is not usable */
-		if(test_break(re))
+		if (test_break(re))
 			RE_rayobject_free(raytree);
 		else
 			obr->raytree= raytree;
 	}
 
-	if(obr->raytree) {
-		if((obi->flag & R_TRANSFORMED) && obi->raytree == NULL)
+	if (obr->raytree) {
+		if ((obi->flag & R_TRANSFORMED) && obi->raytree == NULL)
 		{
 			obi->transform_primitives = 0;
 			obi->raytree = RE_rayobject_instance_create( obr->raytree, obi->mat, obi, obi->obr->rayobi );
 		}
 	}
 	
-	if(obi->raytree) return obi->raytree;
+	if (obi->raytree) return obi->raytree;
 	return obi->obr->raytree;
 }
 
 static int has_special_rayobject(Render *re, ObjectInstanceRen *obi)
 {
-	if( (obi->flag & R_TRANSFORMED) && (re->r.raytrace_options & R_RAYTRACE_USE_INSTANCES) )
+	if ( (obi->flag & R_TRANSFORMED) && (re->r.raytrace_options & R_RAYTRACE_USE_INSTANCES) )
 	{
 		ObjectRen *obr = obi->obr;
 		int v, faces = 0;
 		
-		for(v=0;v<obr->totvlak;v++)
+		for (v=0;v<obr->totvlak;v++)
 		{
 			VlakRen *vlr = obr->vlaknodes[v>>8].vlak + (v&255);
-			if(is_raytraceable_vlr(re, vlr))
+			if (is_raytraceable_vlr(re, vlr))
 			{
 				faces++;
-				if(faces > 4)
+				if (faces > 4)
 					return 1;
 			}
 		}
@@ -330,29 +328,27 @@ static void makeraytree_single(Render *re)
 	VlakPrimitive *vlakprimitive = NULL;
 	int faces = 0, obs = 0, special = 0;
 
-	for(obi=re->instancetable.first; obi; obi=obi->next)
-	if(is_raytraceable(re, obi))
+	for (obi=re->instancetable.first; obi; obi=obi->next)
+	if (is_raytraceable(re, obi))
 	{
 		ObjectRen *obr = obi->obr;
 		obs++;
 		
-		if(has_special_rayobject(re, obi))
-		{
+		if (has_special_rayobject(re, obi)) {
 			special++;
 		}
-		else
-		{
+		else {
 			int v;
-			for(v=0;v<obr->totvlak;v++)
+			for (v=0;v<obr->totvlak;v++)
 			{
 				VlakRen *vlr = obr->vlaknodes[v>>8].vlak + (v&255);
-				if(is_raytraceable_vlr(re, vlr))
+				if (is_raytraceable_vlr(re, vlr))
 					faces++;
 			}
 		}
 	}
 	
-	if(faces + special == 0)
+	if (faces + special == 0)
 	{
 		re->raytree = RE_rayobject_empty_create();
 		return;
@@ -361,61 +357,55 @@ static void makeraytree_single(Render *re)
 	//Create raytree
 	raytree = re->raytree = RE_rayobject_create( re, re->r.raytrace_structure, faces+special );
 
-	if( (re->r.raytrace_options & R_RAYTRACE_USE_LOCAL_COORDS) )
+	if ( (re->r.raytrace_options & R_RAYTRACE_USE_LOCAL_COORDS) )
 	{
 		vlakprimitive = re->rayprimitives = (VlakPrimitive*)MEM_callocN(faces*sizeof(VlakPrimitive), "Raytrace vlak-primitives");
 	}
-	else
-	{
+	else {
 		face = re->rayfaces	= (RayFace*)MEM_callocN(faces*sizeof(RayFace), "Render ray faces");
 	}
 	
-	for(obi=re->instancetable.first; obi; obi=obi->next)
-	if(is_raytraceable(re, obi))
+	for (obi=re->instancetable.first; obi; obi=obi->next)
+	if (is_raytraceable(re, obi))
 	{
-		if(test_break(re))
+		if (test_break(re))
 			break;
 
-		if(has_special_rayobject(re, obi))
-		{
+		if (has_special_rayobject(re, obi)) {
 			RayObject *obj = makeraytree_object(re, obi);
 
-			if(test_break(re))
+			if (test_break(re))
 				break;
 
 			if (obj)
 				RE_rayobject_add( re->raytree, obj );
 		}
-		else
-		{
+		else {
 			int v;
 			ObjectRen *obr = obi->obr;
 			
-			if(obi->flag & R_TRANSFORMED)
+			if (obi->flag & R_TRANSFORMED)
 			{
 				obi->transform_primitives = 1;
 			}
 
-			for(v=0;v<obr->totvlak;v++)
+			for (v=0;v<obr->totvlak;v++)
 			{
 				VlakRen *vlr = obr->vlaknodes[v>>8].vlak + (v&255);
-				if(is_raytraceable_vlr(re, vlr))
-				{
-					if( (re->r.raytrace_options & R_RAYTRACE_USE_LOCAL_COORDS) )
-					{
+				if (is_raytraceable_vlr(re, vlr)) {
+					if ((re->r.raytrace_options & R_RAYTRACE_USE_LOCAL_COORDS)) {
 						RayObject *obj = RE_vlakprimitive_from_vlak( vlakprimitive, obi, vlr );
 						RE_rayobject_add( raytree, obj );
 						vlakprimitive++;
 					}
-					else
-					{
+					else {
 						RE_rayface_from_vlak(face, obi, vlr);
-						if((obi->flag & R_TRANSFORMED))
+						if ((obi->flag & R_TRANSFORMED))
 						{
 							mul_m4_v3(obi->mat, face->v1);
 							mul_m4_v3(obi->mat, face->v2);
 							mul_m4_v3(obi->mat, face->v3);
-							if(RE_rayface_isQuad(face))
+							if (RE_rayface_isQuad(face))
 								mul_m4_v3(obi->mat, face->v4);
 						}
 
@@ -427,7 +417,7 @@ static void makeraytree_single(Render *re)
 		}
 	}
 	
-	if(!test_break(re))
+	if (!test_break(re))
 	{	
 		re->i.infostr= "Raytree.. building";
 		re->stats_draw(re->sdh, &re->i);
@@ -445,26 +435,24 @@ void makeraytree(Render *re)
 	re->stats_draw(re->sdh, &re->i);
 
 	/* disable options not yet supported by octree,
-	   they might actually never be supported (unless people really need it) */
-	if(re->r.raytrace_structure == R_RAYSTRUCTURE_OCTREE)
+	 * they might actually never be supported (unless people really need it) */
+	if (re->r.raytrace_structure == R_RAYSTRUCTURE_OCTREE)
 		re->r.raytrace_options &= ~( R_RAYTRACE_USE_INSTANCES | R_RAYTRACE_USE_LOCAL_COORDS);
 
 	makeraytree_single(re);
 
-	if(test_break(re))
-	{
+	if (test_break(re)) {
 		freeraytree(re);
 
 		re->i.infostr= "Raytree building canceled";
 		re->stats_draw(re->sdh, &re->i);
 	}
-	else
-	{
+	else {
 		//Calculate raytree max_size
-		//This is ONLY needed to kept a bogus behaviour of SUN and HEMI lights
+		//This is ONLY needed to kept a bogus behavior of SUN and HEMI lights
 		INIT_MINMAX(min, max);
 		RE_rayobject_merge_bb( re->raytree, min, max );
-		for(i=0; i<3; i++)
+		for (i=0; i<3; i++)
 		{
 			min[i] += 0.01f;
 			max[i] += 0.01f;
@@ -472,7 +460,7 @@ void makeraytree(Render *re)
 		}
 
 		re->maxdist = dot_v3v3(sub, sub);
-		if(re->maxdist > 0.0f) re->maxdist= sqrt(re->maxdist);
+		if (re->maxdist > 0.0f) re->maxdist= sqrt(re->maxdist);
 
 		re->i.infostr= "Raytree finished";
 		re->stats_draw(re->sdh, &re->i);
@@ -483,7 +471,7 @@ void makeraytree(Render *re)
 #endif
 }
 
-/* 	if(shi->osatex)  */
+/* 	if (shi->osatex)  */
 static void shade_ray_set_derivative(ShadeInput *shi)
 {
 	float detsh, t00, t10, t01, t11;
@@ -493,7 +481,7 @@ static void shade_ray_set_derivative(ShadeInput *shi)
 	axis_dominant_v3(&axis1, &axis2, shi->facenor);
 
 	/* compute u,v and derivatives */
-	if(shi->obi->flag & R_TRANSFORMED) {
+	if (shi->obi->flag & R_TRANSFORMED) {
 		float v1[3], v2[3], v3[3];
 
 		mul_v3_m3v3(v1, shi->obi->nmat, shi->v1->co);
@@ -547,7 +535,7 @@ void shade_ray(Isect *is, ShadeInput *shi, ShadeResult *shr)
 	shi->mat= vlr->mat;
 	shade_input_init_material(shi);
 	
-	if(is->isect==2) 
+	if (is->isect==2) 
 		shade_input_set_triangle_i(shi, obi, vlr, 0, 2, 3);
 	else
 		shade_input_set_triangle_i(shi, obi, vlr, 0, 1, 2);
@@ -556,21 +544,22 @@ void shade_ray(Isect *is, ShadeInput *shi, ShadeResult *shr)
 	shi->v= is->v;
 	shi->dx_u= shi->dx_v= shi->dy_u= shi->dy_v=  0.0f;
 
-	if(shi->osatex)
+	if (shi->osatex)
 		shade_ray_set_derivative(shi);
 	shade_input_set_normals(shi);
 
 	shade_input_set_shade_texco(shi);
 	if (shi->mat->material_type == MA_TYPE_VOLUME) {
-		if(ELEM(is->mode, RE_RAY_SHADOW, RE_RAY_SHADOW_TRA)) {
+		if (ELEM(is->mode, RE_RAY_SHADOW, RE_RAY_SHADOW_TRA)) {
 			shade_volume_shadow(shi, shr, is);
-		} else {
+		}
+		else {
 			shade_volume_outside(shi, shr);
 		}
 	}
-	else if(is->mode==RE_RAY_SHADOW_TRA) {
+	else if (is->mode==RE_RAY_SHADOW_TRA) {
 		/* temp hack to prevent recursion */
-		if(shi->nodes==0 && shi->mat->nodetree && shi->mat->use_nodes) {
+		if (shi->nodes==0 && shi->mat->nodetree && shi->mat->use_nodes) {
 			ntreeShaderExecTree(shi->mat->nodetree, shi, shr);
 			shi->mat= vlr->mat;		/* shi->mat is being set in nodetree */
 		}
@@ -578,7 +567,7 @@ void shade_ray(Isect *is, ShadeInput *shi, ShadeResult *shr)
 			shade_color(shi, shr);
 	}
 	else {
-		if(shi->mat->nodetree && shi->mat->use_nodes) {
+		if (shi->mat->nodetree && shi->mat->use_nodes) {
 			ntreeShaderExecTree(shi->mat->nodetree, shi, shr);
 			shi->mat= vlr->mat;		/* shi->mat is being set in nodetree */
 		}
@@ -600,15 +589,15 @@ static int refraction(float refract[3], const float n[3], const float view[3], f
 	
 	dot = dot_v3v3(view, n);
 
-	if(dot>0.0f) {
+	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);
 	}
 
@@ -634,7 +623,7 @@ static void reflection(float ref[3], float n[3], const float view[3], const floa
 
 	/* test phong normals, then we should prevent vector going to the back */
 	f1= dot_v3v3(ref, orn);
-	if(f1>0.0f) {
+	if (f1>0.0f) {
 		f1+= 0.01f;
 		ref[0]-= f1*orn[0];
 		ref[1]-= f1*orn[1];
@@ -684,7 +673,7 @@ static float shade_by_transmission(Isect *is, ShadeInput *shi, ShadeResult *shr)
 			d= shi->mat->tx_limit;
 
 		p = shi->mat->tx_falloff;
-		if(p < 0.0f) p= 0.0f;
+		if (p < 0.0f) p= 0.0f;
 		else if (p > 10.0f) p= 10.0f;
 
 		shr->alpha *= powf(d, p);
@@ -700,7 +689,8 @@ static void ray_fadeout_endcolor(float col[3], ShadeInput *origshi, ShadeInput *
 	/* un-intersected rays get either rendered material color or sky color */
 	if (origshi->mat->fadeto_mir == MA_RAYMIR_FADETOMAT) {
 		copy_v3_v3(col, shr->combined);
-	} else if (origshi->mat->fadeto_mir == MA_RAYMIR_FADETOSKY) {
+	}
+	else if (origshi->mat->fadeto_mir == MA_RAYMIR_FADETOSKY) {
 		copy_v3_v3(shi->view, vec);
 		normalize_v3(shi->view);
 		
@@ -741,7 +731,7 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, con
 	isec.orig.face = vlr;
 	RE_RC_INIT(isec, shi);
 
-	if(RE_rayobject_raycast(R.raytree, &isec)) {
+	if (RE_rayobject_raycast(R.raytree, &isec)) {
 		ShadeResult shr= {{0}};
 		float d= 1.0f;
 
@@ -753,13 +743,13 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, con
 		shi.osatex= origshi->osatex;
 		shi.depth= origshi->depth + 1;					/* only used to indicate tracing */
 		shi.thread= origshi->thread;
-		//shi.sample= 0; // memset above, so dont need this
+		//shi.sample= 0; // memset above, so don't need this
 		shi.xs= origshi->xs;
 		shi.ys= origshi->ys;
 		shi.lay= origshi->lay;
 		shi.passflag= SCE_PASS_COMBINED; /* result of tracing needs no pass info */
 		shi.combinedflag= 0xFFFFFF;		 /* ray trace does all options */
-		//shi.do_preview= 0; // memset above, so dont need this
+		//shi.do_preview= 0; // memset above, so don't need this
 		shi.light_override= origshi->light_override;
 		shi.mat_override= origshi->mat_override;
 		
@@ -768,10 +758,10 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, con
 		if (traflag & RAY_INSIDE)
 			d= shade_by_transmission(&isec, &shi, &shr);
 		
-		if(depth>0) {
+		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;
@@ -779,11 +769,11 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, con
 				tracol[2]= shi.b;
 				tracol[3]= col[3];	// we pass on and accumulate alpha
 				
-				if((shi.mat->mode & MA_TRANSP) && (shi.mat->mode & MA_RAYTRANSP)) {
+				if ((shi.mat->mode & MA_TRANSP) && (shi.mat->mode & MA_RAYTRANSP)) {
 					/* don't overwrite traflag, it's value is used in mirror reflection */
 					int new_traflag = traflag;
 					
-					if(new_traflag & RAY_INSIDE) {
+					if (new_traflag & RAY_INSIDE) {
 						/* inside the material, so use inverse normal */
 						float norm[3];
 						norm[0]= - shi.vn[0];
@@ -832,13 +822,13 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, con
 			else 
 				col[3]= 1.0f;
 
-			if(shi.mat->mode_l & MA_RAYMIRROR) {
+			if (shi.mat->mode_l & MA_RAYMIRROR) {
 				f= shi.ray_mirror;
-				if(f!=0.0f) f*= fresnel_fac(shi.view, shi.vn, shi.mat->fresnel_mir_i, shi.mat->fresnel_mir);
+				if (f!=0.0f) f*= fresnel_fac(shi.view, shi.vn, shi.mat->fresnel_mir_i, shi.mat->fresnel_mir);
 			}
 			else f= 0.0f;
 			
-			if(f!=0.0f) {
+			if (f!=0.0f) {
 				float mircol[4];
 				float ref[3];
 				
@@ -903,16 +893,16 @@ static void DP_energy(float *table, float vec[2], int tot, float xsize, float ys
 	min*= min;
 	result[0]= result[1]= 0.0f;
 	
-	for(y= -1; y<2; y++) {
+	for (y= -1; y<2; y++) {
 		dy= ysize*y;
-		for(x= -1; x<2; x++) {
+		for (x= -1; x<2; x++) {
 			dx= xsize*x;
 			fp= table;
-			for(a=0; a<tot; a++, fp+= 2) {
+			for (a=0; a<tot; a++, fp+= 2) {
 				force[0]= vec[0] - fp[0]-dx;
 				force[1]= vec[1] - fp[1]-dy;
 				dist= force[0]*force[0] + force[1]*force[1];
-				if(dist < min && dist>0.0f) {
+				if (dist < min && dist>0.0f) {
 					result[0]+= force[0]/dist;
 					result[1]+= force[1]/dist;
 				}
@@ -934,11 +924,11 @@ static void jitter_plane_offset(float *jitter1, float *jitter2, int tot, float s
 	float hsizex= 0.5f*sizex, hsizey= 0.5f*sizey;
 	int x;
 	
-	for(x=tot; x>0; x--, jitter1+=2, jitter2+=2) {
+	for (x=tot; x>0; x--, jitter1+=2, jitter2+=2) {
 		jitter2[0]= jitter1[0] + dsizex;
 		jitter2[1]= jitter1[1] + dsizey;
-		if(jitter2[0] > hsizex) jitter2[0]-= sizex;
-		if(jitter2[1] > hsizey) jitter2[1]-= sizey;
+		if (jitter2[0] > hsizex) jitter2[0]-= sizex;
+		if (jitter2[1] > hsizey) jitter2[1]-= sizey;
 	}
 }
 
@@ -950,29 +940,29 @@ void init_jitter_plane(LampRen *lar)
 	int x, tot= lar->ray_totsamp;
 	
 	/* test if already initialized */
-	if(lar->jitter) return;
+	if (lar->jitter) return;
 	
 	/* at least 4, or max threads+1 tables */
-	if(BLENDER_MAX_THREADS < 4) x= 4;
+	if (BLENDER_MAX_THREADS < 4) x= 4;
 	else x= BLENDER_MAX_THREADS+1;
 	fp= lar->jitter= MEM_callocN(x*tot*2*sizeof(float), "lamp jitter tab");
 	
 	/* if 1 sample, we leave table to be zero's */
-	if(tot>1) {
+	if (tot>1) {
 		int iter=12;
 
 		/* set per-lamp fixed seed */
 		BLI_srandom(tot);
 		
 		/* fill table with random locations, area_size large */
-		for(x=0; x<tot; x++, fp+=2) {
+		for (x=0; x<tot; x++, fp+=2) {
 			fp[0]= (BLI_frand()-0.5f)*lar->area_size;
 			fp[1]= (BLI_frand()-0.5f)*lar->area_sizey;
 		}
 		
-		while(iter--) {
+		while (iter--) {
 			fp= lar->jitter;
-			for(x=tot; x>0; x--, fp+=2) {
+			for (x=tot; x>0; x--, fp+=2) {
 				DP_energy(lar->jitter, fp, tot, lar->area_size, lar->area_sizey);
 			}
 		}
@@ -990,17 +980,17 @@ static float *give_jitter_plane(LampRen *lar, int thread, int xs, int ys)
 	
 	tot= lar->ray_totsamp;
 			
-	if(lar->ray_samp_type & LA_SAMP_JITTER) {
+	if (lar->ray_samp_type & LA_SAMP_JITTER) {
 		/* made it threadsafe */
 		
-		if(lar->xold[thread]!=xs || lar->yold[thread]!=ys) {
+		if (lar->xold[thread]!=xs || lar->yold[thread]!=ys) {
 			jitter_plane_offset(lar->jitter, lar->jitter+2*(thread+1)*tot, tot, lar->area_size, lar->area_sizey, BLI_thread_frand(thread), BLI_thread_frand(thread));
 			lar->xold[thread]= xs; 
 			lar->yold[thread]= ys;
 		}
 		return lar->jitter+2*(thread+1)*tot;
 	}
-	if(lar->ray_samp_type & LA_SAMP_DITHER) {
+	if (lar->ray_samp_type & LA_SAMP_DITHER) {
 		return lar->jitter + 2*tot*((xs & 1)+2*(ys & 1));
 	}
 	
@@ -1085,7 +1075,7 @@ static void QMC_initPixel(QMCSampler *qsa, int thread)
 	else { 	/* SAMP_TYPE_HALTON */
 		
 		/* generate a new randomised halton sequence per pixel
-		 * to alleviate qmc artifacts and make it reproducable 
+		 * to alleviate qmc artifacts and make it reproducible 
 		 * between threads/frames */
 		double ht_invprimes[2], ht_nums[2];
 		double r[2];
@@ -1215,8 +1205,8 @@ static QMCSampler *get_thread_qmcsampler(Render *re, int thread, int type, int t
 	/* create qmc samplers as needed, since recursion makes it hard to
 	 * predict how many are needed */
 
-	for(qsa=re->qmcsamplers[thread].first; qsa; qsa=qsa->next) {
-		if(qsa->type == type && qsa->tot == tot && !qsa->used) {
+	for (qsa=re->qmcsamplers[thread].first; qsa; qsa=qsa->next) {
+		if (qsa->type == type && qsa->tot == tot && !qsa->used) {
 			qsa->used= 1;
 			return qsa;
 		}
@@ -1236,11 +1226,11 @@ static void release_thread_qmcsampler(Render *UNUSED(re), int UNUSED(thread), QM
 
 void free_render_qmcsampler(Render *re)
 {
-	if(re->qmcsamplers) {
+	if (re->qmcsamplers) {
 		QMCSampler *qsa, *next;
 		int a;
-		for(a=0; a<BLENDER_MAX_THREADS; a++) {
-			for(qsa=re->qmcsamplers[a].first; qsa; qsa=next) {
+		for (a=0; a<BLENDER_MAX_THREADS; a++) {
+			for (qsa=re->qmcsamplers[a].first; qsa; qsa=next) {
 				next= qsa->next;
 				QMC_freeSampler(qsa);
 			}
@@ -1282,7 +1272,8 @@ static int adaptive_sample_contrast_val(int samples, float prev, float val, floa
 	 * going to be the same is wasting effort */
 	if (fabsf( prev/(float)(samples-1) - val/(float)samples ) < thresh) {
 		return 1;
-	} else
+	}
+	else
 		return 0;
 }
 
@@ -1330,16 +1321,18 @@ static void trace_refract(float col[4], ShadeInput *shi, ShadeResult *shr)
 		/* all samples are generated per pixel */
 		qsa = get_thread_qmcsampler(&R, shi->thread, samp_type, max_samples);
 		QMC_initPixel(qsa, shi->thread);
-	} else 
+	}
+	else
 		max_samples = 1;
 	
 
 	while (samples < max_samples) {		
-		if(refraction(v_refract, shi->vn, shi->view, shi->ang)) {
+		if (refraction(v_refract, shi->vn, shi->view, shi->ang)) {
 			traflag |= RAY_INSIDE;
-		} else {
+		}
+		else {
 			/* total external reflection can happen for materials with IOR < 1.0 */
-			if((shi->vlr->flag & R_SMOOTH)) 
+			if ((shi->vlr->flag & R_SMOOTH)) 
 				reflection(v_refract, shi->vn, shi->view, shi->facenor);
 			else
 				reflection_simple(v_refract, shi->vn, shi->view);
@@ -1361,7 +1354,8 @@ static void trace_refract(float col[4], ShadeInput *shi, ShadeResult *shr)
 			add_v3_v3(v_refract_new, orthy);
 			
 			normalize_v3(v_refract_new);
-		} else {
+		}
+		else {
 			/* no blurriness, use the original normal */
 			copy_v3_v3(v_refract_new, v_refract);
 		}
@@ -1429,7 +1423,8 @@ static void trace_reflect(float col[3], ShadeInput *shi, ShadeResult *shr, float
 		/* all samples are generated per pixel */
 		qsa = get_thread_qmcsampler(&R, shi->thread, samp_type, max_samples);
 		QMC_initPixel(qsa, shi->thread);
-	} else 
+	}
+	else
 		max_samples = 1;
 	
 	while (samples < max_samples) {
@@ -1445,7 +1440,8 @@ static void trace_reflect(float col[3], ShadeInput *shi, ShadeResult *shr, float
 				copy_v3_v3(orthy, shi->tang);
 				mul_v3_fl(orthx, samp3d[0]);
 				mul_v3_fl(orthy, samp3d[1]*aniso);
-			} else {
+			}
+			else {
 				ortho_basis_v3v3_v3( orthx, orthy,shi->vn);
 				mul_v3_fl(orthx, samp3d[0]);
 				mul_v3_fl(orthy, samp3d[1]);
@@ -1455,12 +1451,13 @@ static void trace_reflect(float col[3], ShadeInput *shi, ShadeResult *shr, float
 			add_v3_v3v3(v_nor_new, shi->vn, orthx);
 			add_v3_v3(v_nor_new, orthy);
 			normalize_v3(v_nor_new);
-		} else {
+		}
+		else {
 			/* no blurriness, use the original normal */
 			copy_v3_v3(v_nor_new, shi->vn);
 		}
 		
-		if((shi->vlr->flag & R_SMOOTH)) 
+		if ((shi->vlr->flag & R_SMOOTH)) 
 			reflection(v_reflect, v_nor_new, shi->view, shi->facenor);
 		else
 			reflection_simple(v_reflect, v_nor_new, shi->view);
@@ -1523,12 +1520,12 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr)
 	do_mir= ((shi->mat->mode & MA_RAYMIRROR) && shi->ray_mirror!=0.0f && (shi->depth <= shi->mat->ray_depth));
 	
 	/* raytrace mirror and refract like to separate the spec color */
-	if(shi->combinedflag & SCE_PASS_SPEC)
+	if (shi->combinedflag & SCE_PASS_SPEC)
 		sub_v3_v3v3(diff, shr->combined, shr->spec);
 	else
 		copy_v3_v3(diff, shr->combined);
 	
-	if(do_tra) {
+	if (do_tra) {
 		float olddiff[3], f;
 		
 		trace_refract(tracol, shi, shr);
@@ -1545,18 +1542,18 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr)
 		diff[1]= f*diff[1] + f1*fg*tracol[1];
 		diff[2]= f*diff[2] + f1*fb*tracol[2];
 		
-		if(shi->passflag & SCE_PASS_REFRACT)
+		if (shi->passflag & SCE_PASS_REFRACT)
 			sub_v3_v3v3(shr->refr, diff, olddiff);
 		
-		if(!(shi->combinedflag & SCE_PASS_REFRACT))
+		if (!(shi->combinedflag & SCE_PASS_REFRACT))
 			sub_v3_v3v3(diff, diff, shr->refr);
 		
 		shr->alpha= MIN2(1.0f, tracol[3]);
 	}
 	
-	if(do_mir) {
+	if (do_mir) {
 		const float i= shi->ray_mirror*fresnel_fac(shi->view, shi->vn, shi->mat->fresnel_mir_i, shi->mat->fresnel_mir);
-		if(i!=0.0f) {
+		if (i!=0.0f) {
 		
 			trace_reflect(mircol, shi, shr, i);
 			
@@ -1564,14 +1561,14 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr)
 			fg= i*shi->mirg;
 			fb= i*shi->mirb;
 
-			if(shi->passflag & SCE_PASS_REFLECT) {
+			if (shi->passflag & SCE_PASS_REFLECT) {
 				/* mirror pass is not blocked out with spec */
 				shr->refl[0]= fr*mircol[0] - fr*diff[0];
 				shr->refl[1]= fg*mircol[1] - fg*diff[1];
 				shr->refl[2]= fb*mircol[2] - fb*diff[2];
 			}
 			
-			if(shi->combinedflag & SCE_PASS_REFLECT) {
+			if (shi->combinedflag & SCE_PASS_REFLECT) {
 				/* values in shr->spec can be greater then 1.0.
 				 * In this case the mircol uses a zero blending factor, so ignoring it is ok.
 				 * Fixes bug #18837 - when the spec is higher then 1.0,
@@ -1583,14 +1580,14 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr)
 				diff[1] *= f1;
 				diff[2] *= f1;
 				
-				if(shr->spec[0]<1.0f)	diff[0] += mircol[0] * (fr*(1.0f-shr->spec[0]));
-				if(shr->spec[1]<1.0f)	diff[1] += mircol[1] * (fg*(1.0f-shr->spec[1]));
-				if(shr->spec[2]<1.0f)	diff[2] += mircol[2] * (fb*(1.0f-shr->spec[2]));
+				if (shr->spec[0]<1.0f)	diff[0] += mircol[0] * (fr*(1.0f-shr->spec[0]));
+				if (shr->spec[1]<1.0f)	diff[1] += mircol[1] * (fg*(1.0f-shr->spec[1]));
+				if (shr->spec[2]<1.0f)	diff[2] += mircol[2] * (fb*(1.0f-shr->spec[2]));
 			}
 		}
 	}
 	/* put back together */
-	if(shi->combinedflag & SCE_PASS_SPEC)
+	if (shi->combinedflag & SCE_PASS_SPEC)
 		add_v3_v3v3(shr->combined, diff, shr->spec);
 	else
 		copy_v3_v3(shr->combined, diff);
@@ -1616,10 +1613,10 @@ static void addAlphaLight(float shadfac[4], const float col[3], float alpha, flo
 static void ray_trace_shadow_tra(Isect *is, ShadeInput *origshi, int depth, int traflag, float col[4])
 {
 	/* ray to lamp, find first face that intersects, check alpha properties,
-	   if it has col[3]>0.0f  continue. so exit when alpha is full */
+	 * if it has col[3]>0.0f  continue. so exit when alpha is full */
 	const float initial_dist = is->dist;
 
-	if(RE_rayobject_raycast(R.raytree, is)) {
+	if (RE_rayobject_raycast(R.raytree, is)) {
 		/* Warning regarding initializing to zero's, This is not that nice,
 		 * and possibly a bit slow for every ray, however some variables were
 		 * not initialized properly in, unless using
@@ -1649,7 +1646,8 @@ static void ray_trace_shadow_tra(Isect *is, ShadeInput *origshi, int depth, int
 			            1.0f;
 			/* mix colors based on shadfac (rgb + amount of light factor) */
 			addAlphaLight(col, shr.diff, shr.alpha, d*shi.mat->filter);
-		} else if (shi.mat->material_type == MA_TYPE_VOLUME) {
+		}
+		else if (shi.mat->material_type == MA_TYPE_VOLUME) {
 			const float a = col[3];
 			
 			col[0] = a*col[0] + shr.alpha*shr.combined[0];
@@ -1659,7 +1657,7 @@ static void ray_trace_shadow_tra(Isect *is, ShadeInput *origshi, int depth, int
 			col[3] = (1.0f - shr.alpha)*a;
 		}
 		
-		if(depth>0 && col[3]>0.0f) {
+		if (depth>0 && col[3]>0.0f) {
 			
 			/* adapt isect struct */
 			copy_v3_v3(is->start, shi.co);
@@ -1688,7 +1686,7 @@ static int UNUSED_FUNCTION(ray_trace_shadow_rad)(ShadeInput *ship, ShadeResult *
 	
 	assert(0);
 	
-	if(only_one) {
+	if (only_one) {
 		return 0;
 	}
 	only_one= 1;
@@ -1703,7 +1701,7 @@ static int UNUSED_FUNCTION(ray_trace_shadow_rad)(ShadeInput *ship, ShadeResult *
 	
 	RE_RC_INIT(isec, shi);
 	
-	for(a=0; a<8*8; a++) {
+	for (a=0; a<8*8; a++) {
 		
 		counter+=3;
 		counter %= 768;
@@ -1717,11 +1715,11 @@ static int UNUSED_FUNCTION(ray_trace_shadow_rad)(ShadeInput *ship, ShadeResult *
 		copy_v3_v3(isec.dir, vec );
 		isec.dist = RE_RAYTRACE_MAXDIST;
 
-		if(RE_rayobject_raycast(R.raytree, &isec)) {
+		if (RE_rayobject_raycast(R.raytree, &isec)) {
 			float fac;
 			
 			/* Warning, This is not that nice, and possibly a bit slow for every ray,
-			however some variables were not initialized properly in, unless using shade_input_initialize(...), we need to do a memset */
+			 * however some variables were not initialized properly in, unless using shade_input_initialize(...), we need to do a memset */
 			memset(&shi, 0, sizeof(ShadeInput)); 
 			/* end warning! - Campbell */
 			
@@ -1736,7 +1734,7 @@ static int UNUSED_FUNCTION(ray_trace_shadow_rad)(ShadeInput *ship, ShadeResult *
 		else div+= 1.0f;
 	}
 	
-	if(div!=0.0f) {
+	if (div!=0.0f) {
 		shr->diff[0]+= accum[0]/div;
 		shr->diff[1]+= accum[1]/div;
 		shr->diff[2]+= accum[2]/div;
@@ -1769,10 +1767,10 @@ static void DS_energy(float *sphere, int tot, float vec[3])
 	
 	res[0]= res[1]= res[2]= 0.0f;
 	
-	for(a=0, fp=sphere; a<tot; a++, fp+=3) {
+	for (a=0, fp=sphere; a<tot; a++, fp+=3) {
 		sub_v3_v3v3(force, vec, fp);
 		fac = dot_v3v3(force, force);
-		if(fac!=0.0f) {
+		if (fac!=0.0f) {
 			fac= 1.0f/fac;
 			res[0]+= fac*force[0];
 			res[1]+= fac*force[1];
@@ -1804,12 +1802,12 @@ void init_ao_sphere(World *wrld)
 	
 	/* init */
 	fp= wrld->aosphere;
-	for(a=0; a<tot; a++, fp+= 3) {
+	for (a=0; a<tot; a++, fp+= 3) {
 		RandomSpherical(fp);
 	}
 	
-	while(iter--) {
-		for(a=0, fp= wrld->aosphere; a<tot; a++, fp+= 3) {
+	while (iter--) {
+		for (a=0, fp= wrld->aosphere; a<tot; a++, fp+= 3) {
 			DS_energy(wrld->aosphere, tot, fp);
 		}
 	}
@@ -1824,14 +1822,14 @@ static float *threadsafe_table_sphere(int test, int thread, int xs, int ys, int
 	static int xso[BLENDER_MAX_THREADS], yso[BLENDER_MAX_THREADS];
 	static int firsttime= 1;
 	
-	if(firsttime) {
+	if (firsttime) {
 		memset(xso, 255, sizeof(xso));
 		memset(yso, 255, sizeof(yso));
 		firsttime= 0;
 	}
 	
-	if(xs==xso[thread] && ys==yso[thread]) return R.wrld.aotables+ thread*tot*3;
-	if(test) return NULL;
+	if (xs==xso[thread] && ys==yso[thread]) return R.wrld.aotables+ thread*tot*3;
+	if (test) return NULL;
 	xso[thread]= xs; yso[thread]= ys;
 	return R.wrld.aotables+ thread*tot*3;
 }
@@ -1864,7 +1862,7 @@ static float *sphere_sampler(int type, int resol, int thread, int xs, int ys, in
 		
 		// returns table if xs and ys were equal to last call, and not resetting
 		sphere= (reset)? NULL: threadsafe_table_sphere(1, thread, xs, ys, tot);
-		if(sphere==NULL) {
+		if (sphere==NULL) {
 			float cosfi, sinfi, cost, sint;
 			float ang;
 			int a;
@@ -1932,16 +1930,16 @@ static void ray_ao_qmc(ShadeInput *shi, float ao[3], float env[3])
 	
 	/* prevent sky colors to be added for only shadow (shadow becomes alpha) */
 	envcolor= R.wrld.aocolor;
-	if(shi->mat->mode & MA_ONLYSHADOW)
+	if (shi->mat->mode & MA_ONLYSHADOW)
 		envcolor= WO_AOPLAIN;
 	
-	if(envcolor == WO_AOSKYTEX) {
+	if (envcolor == WO_AOSKYTEX) {
 		dxyview[0]= 1.0f/(float)R.wrld.aosamp;
 		dxyview[1]= 1.0f/(float)R.wrld.aosamp;
 		dxyview[2]= 0.0f;
 	}
 	
-	if(shi->vlr->flag & R_SMOOTH) {
+	if (shi->vlr->flag & R_SMOOTH) {
 		copy_v3_v3(nrm, shi->vn);
 	}
 	else {
@@ -1960,7 +1958,8 @@ static void ray_ao_qmc(ShadeInput *shi, float ao[3], float env[3])
 		if (max_samples < 5) max_samples = 5;
 		
 		qsa = get_thread_qmcsampler(&R, shi->thread, SAMP_TYPE_HALTON, max_samples);
-	} else if (R.wrld.ao_samp_method==WO_AOSAMP_HAMMERSLEY)
+	}
+	else if (R.wrld.ao_samp_method==WO_AOSAMP_HAMMERSLEY)
 		qsa = get_thread_qmcsampler(&R, shi->thread, SAMP_TYPE_HAMMERSLEY, max_samples);
 
 	QMC_initPixel(qsa, shi->thread);
@@ -1983,11 +1982,11 @@ static void ray_ao_qmc(ShadeInput *shi, float ao[3], float env[3])
 		
 		prev = fac;
 		
-		if(RE_rayobject_raycast(R.raytree, &isec)) {
+		if (RE_rayobject_raycast(R.raytree, &isec)) {
 			if (R.wrld.aomode & WO_AODIST) fac+= expf(-isec.dist*R.wrld.aodistfac);
 			else fac+= 1.0f;
 		}
-		else if(envcolor!=WO_AOPLAIN) {
+		else if (envcolor!=WO_AOPLAIN) {
 			float skycol[4];
 			float view[3];
 			
@@ -1996,7 +1995,7 @@ static void ray_ao_qmc(ShadeInput *shi, float ao[3], float env[3])
 			view[2]= -dir[2];
 			normalize_v3(view);
 			
-			if(envcolor==WO_AOSKYCOL) {
+			if (envcolor==WO_AOSKYCOL) {
 				const float skyfac= 0.5f * (1.0f + dot_v3v3(view, R.grvec));
 				env[0]+= (1.0f-skyfac)*R.wrld.horr + skyfac*R.wrld.zenr;
 				env[1]+= (1.0f-skyfac)*R.wrld.horg + skyfac*R.wrld.zeng;
@@ -2028,7 +2027,7 @@ static void ray_ao_qmc(ShadeInput *shi, float ao[3], float env[3])
 	/* average color times distances/hits formula */
 	ao[0]= ao[1]= ao[2]= 1.0f - fac/(float)samples;
 
-	if(envcolor!=WO_AOPLAIN && skyadded)
+	if (envcolor!=WO_AOPLAIN && skyadded)
 		mul_v3_fl(env, (1.0f - fac/(float)samples)/((float)skyadded));
 	else
 		copy_v3_v3(env, ao);
@@ -2070,7 +2069,7 @@ static void ray_ao_spheresamp(ShadeInput *shi, float ao[3], float env[3])
 	zero_v3(env);
 
 	/* bias prevents smoothed faces to appear flat */
-	if(shi->vlr->flag & R_SMOOTH) {
+	if (shi->vlr->flag & R_SMOOTH) {
 		bias= R.wrld.aobias;
 		nrm= shi->vn;
 	}
@@ -2081,32 +2080,32 @@ static void ray_ao_spheresamp(ShadeInput *shi, float ao[3], float env[3])
 
 	/* prevent sky colors to be added for only shadow (shadow becomes alpha) */
 	envcolor= R.wrld.aocolor;
-	if(shi->mat->mode & MA_ONLYSHADOW)
+	if (shi->mat->mode & MA_ONLYSHADOW)
 		envcolor= WO_AOPLAIN;
 	
-	if(resol>32) resol= 32;
+	if (resol>32) resol= 32;
 
 	/* get sphere samples. for faces we get the same samples for sample x/y values,
-	   for strand render we always require a new sampler because x/y are not set */
+	 * for strand render we always require a new sampler because x/y are not set */
 	vec= sphere_sampler(R.wrld.aomode, resol, shi->thread, shi->xs, shi->ys, shi->strand != NULL);
 	
 	// warning: since we use full sphere now, and dotproduct is below, we do twice as much
 	tot= 2*resol*resol;
 
-	if(envcolor == WO_AOSKYTEX) {
+	if (envcolor == WO_AOSKYTEX) {
 		dxyview[0]= 1.0f/(float)resol;
 		dxyview[1]= 1.0f/(float)resol;
 		dxyview[2]= 0.0f;
 	}
 	
-	while(tot--) {
+	while (tot--) {
 		
 		if (dot_v3v3(vec, nrm) > bias) {
 			/* only ao samples for mask */
-			if(R.r.mode & R_OSA) {
+			if (R.r.mode & R_OSA) {
 				j++;
-				if(j==R.osa) j= 0;
-				if(!(shi->mask & (1<<j))) {
+				if (j==R.osa) j= 0;
+				if (!(shi->mask & (1<<j))) {
 					vec+=3;
 					continue;
 				}
@@ -2121,11 +2120,11 @@ static void ray_ao_spheresamp(ShadeInput *shi, float ao[3], float env[3])
 			isec.dist = maxdist;
 			
 			/* do the trace */
-			if(RE_rayobject_raycast(R.raytree, &isec)) {
+			if (RE_rayobject_raycast(R.raytree, &isec)) {
 				if (R.wrld.aomode & WO_AODIST) sh+= expf(-isec.dist*R.wrld.aodistfac);
 				else sh+= 1.0f;
 			}
-			else if(envcolor!=WO_AOPLAIN) {
+			else if (envcolor!=WO_AOPLAIN) {
 				float skycol[4];
 				float view[3];
 				
@@ -2134,7 +2133,7 @@ static void ray_ao_spheresamp(ShadeInput *shi, float ao[3], float env[3])
 				view[2]= -vec[2];
 				normalize_v3(view);
 				
-				if(envcolor==WO_AOSKYCOL) {
+				if (envcolor==WO_AOSKYCOL) {
 					const float fac = 0.5f * (1.0f + dot_v3v3(view, R.grvec));
 					env[0]+= (1.0f-fac)*R.wrld.horr + fac*R.wrld.zenr;
 					env[1]+= (1.0f-fac)*R.wrld.horg + fac*R.wrld.zeng;
@@ -2154,13 +2153,13 @@ static void ray_ao_spheresamp(ShadeInput *shi, float ao[3], float env[3])
 		vec+= 3;
 	}
 	
-	if(actual==0) sh= 1.0f;
+	if (actual==0) sh= 1.0f;
 	else sh = 1.0f - sh/((float)actual);
 	
 	/* average color times distances/hits formula */
 	ao[0]= ao[1]= ao[2]= sh;
 
-	if(envcolor!=WO_AOPLAIN && skyadded)
+	if (envcolor!=WO_AOPLAIN && skyadded)
 		mul_v3_fl(env, sh/((float)skyadded));
 	else
 		copy_v3_v3(env, ao);
@@ -2189,17 +2188,17 @@ static void ray_shadow_jittered_coords(ShadeInput *shi, int max, float jitco[RE_
 
 	/* for better antialising shadow samples are distributed over the subpixel
 	 * sample coordinates, this only works for raytracing depth 0 though */
-	if(!shi->strand && shi->depth == 0 && count > 1 && count <= max) {
+	if (!shi->strand && shi->depth == 0 && count > 1 && count <= max) {
 		float xs, ys, zs, view[3];
 		int samp, ordsamp, tot= 0;
 
-		for(samp=0; samp<R.osa; samp++) {
-			if(R.osa == 8) ordsamp = order8[samp];
-			else if(R.osa == 11) ordsamp = order11[samp];
-			else if(R.osa == 16) ordsamp = order16[samp];
+		for (samp=0; samp<R.osa; samp++) {
+			if (R.osa == 8) ordsamp = order8[samp];
+			else if (R.osa == 11) ordsamp = order11[samp];
+			else if (R.osa == 16) ordsamp = order16[samp];
 			else ordsamp = samp;
 
-			if(shi->mask & (1<<ordsamp)) {
+			if (shi->mask & (1<<ordsamp)) {
 				/* zbuffer has this inverse corrected, ensures xs,ys are inside pixel */
 				xs= (float)shi->scanco[0] + R.jit[ordsamp][0] + 0.5f;
 				ys= (float)shi->scanco[1] + R.jit[ordsamp][1] + 0.5f;
@@ -2238,9 +2237,10 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, const float lampco[3],
 	int totjitco;
 
 	colsq[0] = colsq[1] = colsq[2] = 0.0;
-	if(isec->mode==RE_RAY_SHADOW_TRA) {
+	if (isec->mode==RE_RAY_SHADOW_TRA) {
 		shadfac[0]= shadfac[1]= shadfac[2]= shadfac[3]= 0.0f;
-	} else
+	}
+	else
 		shadfac[3]= 1.0f;
 	
 	if (lar->ray_totsamp < 2) do_soft = 0;
@@ -2249,7 +2249,8 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, const float lampco[3],
 	if (full_osa) {
 		if (do_soft) max_samples  = max_samples/R.osa + 1;
 		else max_samples = 1;
-	} else {
+	}
+	else {
 		if (do_soft) max_samples = lar->ray_totsamp;
 		else if (shi->depth == 0) max_samples = (R.osa > 4)?R.osa:5;
 		else max_samples = 1;
@@ -2266,7 +2267,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, const float lampco[3],
 	QMC_initPixel(qsa, shi->thread);
 
 	INIT_MINMAX(min, max);
-	for(i=0; i<totjitco; i++)
+	for (i=0; i<totjitco; i++)
 	{
 		DO_MINMAX(jitco[i], min, max);
 	}
@@ -2317,11 +2318,12 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, const float lampco[3],
 			end[0] = vec[0]+samp3d[0];
 			end[1] = vec[1]+samp3d[1];
 			end[2] = vec[2]+samp3d[2];
-		} else {
+		}
+		else {
 			copy_v3_v3(end, vec);
 		}
 
-		if(shi->strand) {
+		if (shi->strand) {
 			/* bias away somewhat to avoid self intersection */
 			float jitbias= 0.5f*(len_v3(shi->dxco) + len_v3(shi->dyco));
 			float v[3];
@@ -2341,7 +2343,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, const float lampco[3],
 		isec->dist = normalize_v3(isec->dir);
 		
 		/* trace the ray */
-		if(isec->mode==RE_RAY_SHADOW_TRA) {
+		if (isec->mode==RE_RAY_SHADOW_TRA) {
 			float col[4] = {1.0f, 1.0f, 1.0f, 1.0f};
 			
 			ray_trace_shadow_tra(isec, shi, DEPTH_SHADOW_TRA, 0, col);
@@ -2356,7 +2358,7 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, const float lampco[3],
 			colsq[2] += col[2]*col[2];
 		}
 		else {
-			if( RE_rayobject_raycast(R.raytree, isec) ) fac+= 1.0f;
+			if ( RE_rayobject_raycast(R.raytree, isec) ) fac+= 1.0f;
 		}
 		
 		samples++;
@@ -2370,7 +2372,8 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, const float lampco[3],
 						break;
 					else if (adaptive_sample_variance(samples, shadfac, colsq, adapt_thresh))
 						break;
-				} else {
+				}
+				else {
 					if ((fac / samples > (1.0f-adapt_thresh)) || (fac / samples < adapt_thresh))
 						break;
 				}
@@ -2378,12 +2381,13 @@ static void ray_shadow_qmc(ShadeInput *shi, LampRen *lar, const float lampco[3],
 		}
 	}
 	
-	if(isec->mode==RE_RAY_SHADOW_TRA) {
+	if (isec->mode==RE_RAY_SHADOW_TRA) {
 		shadfac[0] /= samples;
 		shadfac[1] /= samples;
 		shadfac[2] /= samples;
 		shadfac[3] /= samples;
-	} else
+	}
+	else
 		shadfac[3]= 1.0f-fac/samples;
 
 	if (qsa)
@@ -2398,7 +2402,7 @@ static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, const float lampco[
 	int a, j= -1, mask;
 	RayHint point_hint;
 	
-	if(isec->mode==RE_RAY_SHADOW_TRA) {
+	if (isec->mode==RE_RAY_SHADOW_TRA) {
 		shadfac[0]= shadfac[1]= shadfac[2]= shadfac[3]= 0.0f;
 	}
 	else shadfac[3]= 1.0f;
@@ -2410,8 +2414,8 @@ static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, const float lampco[
 	
 	/* this correction to make sure we always take at least 1 sample */
 	mask= shi->mask;
-	if(a==4) mask |= (mask>>4)|(mask>>8);
-	else if(a==9) mask |= (mask>>9);
+	if (a==4) mask |= (mask>>4)|(mask>>8);
+	else if (a==9) mask |= (mask>>9);
 	
 	copy_v3_v3(isec->start, shi->co);
 	isec->orig.ob   = shi->obi;
@@ -2419,12 +2423,12 @@ static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, const float lampco[
 	RE_rayobject_hint_bb( R.raytree, &point_hint, isec->start, isec->start );
 	isec->hint = &point_hint;
 	
-	while(a--) {
+	while (a--) {
 		
-		if(R.r.mode & R_OSA) {
+		if (R.r.mode & R_OSA) {
 			j++;
-			if(j>=R.osa) j= 0;
-			if(!(mask & (1<<j))) {
+			if (j>=R.osa) j= 0;
+			if (!(mask & (1<<j))) {
 				jitlamp+= 2;
 				continue;
 			}
@@ -2443,7 +2447,7 @@ static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, const float lampco[
 		isec->check = RE_CHECK_VLR_RENDER;
 		isec->skip = RE_SKIP_VLR_NEIGHBOUR;
 		
-		if(isec->mode==RE_RAY_SHADOW_TRA) {
+		if (isec->mode==RE_RAY_SHADOW_TRA) {
 			/* isec.col is like shadfac, so defines amount of light (0.0 is full shadow) */
 			float col[4] = {1.0f, 1.0f, 1.0f, 1.0f};
 			
@@ -2453,13 +2457,13 @@ static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, const float lampco[
 			shadfac[2] += col[2];
 			shadfac[3] += col[3];
 		}
-		else if( RE_rayobject_raycast(R.raytree, isec) ) fac+= 1.0f;
+		else if ( RE_rayobject_raycast(R.raytree, isec) ) fac+= 1.0f;
 		
 		div+= 1.0f;
 		jitlamp+= 2;
 	}
 	
-	if(isec->mode==RE_RAY_SHADOW_TRA) {
+	if (isec->mode==RE_RAY_SHADOW_TRA) {
 		shadfac[0] /= div;
 		shadfac[1] /= div;
 		shadfac[2] /= div;
@@ -2467,7 +2471,7 @@ static void ray_shadow_jitter(ShadeInput *shi, LampRen *lar, const float lampco[
 	}
 	else {
 		// sqrt makes nice umbra effect
-		if(lar->ray_samp_type & LA_SAMP_UMBRA)
+		if (lar->ray_samp_type & LA_SAMP_UMBRA)
 			shadfac[3]= sqrt(1.0f-fac/div);
 		else
 			shadfac[3]= 1.0f-fac/div;
@@ -2481,24 +2485,24 @@ void ray_shadow(ShadeInput *shi, LampRen *lar, float shadfac[4])
 
 	/* setup isec */
 	RE_RC_INIT(isec, *shi);
-	if(shi->mat->mode & MA_SHADOW_TRA) isec.mode= RE_RAY_SHADOW_TRA;
+	if (shi->mat->mode & MA_SHADOW_TRA) isec.mode= RE_RAY_SHADOW_TRA;
 	else isec.mode= RE_RAY_SHADOW;
 	isec.hint = 0;
 	
-	if(lar->mode & (LA_LAYER|LA_LAYER_SHADOW))
+	if (lar->mode & (LA_LAYER|LA_LAYER_SHADOW))
 		isec.lay= lar->lay;
 	else
 		isec.lay= -1;
 
 	/* only when not mir tracing, first hit optimm */
-	if(shi->depth==0) {
+	if (shi->depth==0) {
 		isec.last_hit = lar->last_hit[shi->thread];
 	}
 	else {
 		isec.last_hit = NULL;
 	}
 	
-	if(lar->type==LA_SUN || lar->type==LA_HEMI) {
+	if (lar->type==LA_SUN || lar->type==LA_HEMI) {
 		/* jitter and QMC sampling add a displace vector to the lamp position
 		 * that's incorrect because a SUN lamp does not has an exact position
 		 * and the displace should be done at the ray vector instead of the
@@ -2524,8 +2528,9 @@ void ray_shadow(ShadeInput *shi, LampRen *lar, float shadfac[4])
 		
 		ray_shadow_qmc(shi, lar, lampco, shadfac, &isec);
 		
-	} else {
-		if(lar->ray_totsamp<2) {
+	}
+	else {
+		if (lar->ray_totsamp<2) {
 			
 			isec.orig.ob   = shi->obi;
 			isec.orig.face = shi->vlr;
@@ -2537,14 +2542,14 @@ void ray_shadow(ShadeInput *shi, LampRen *lar, float shadfac[4])
 			sub_v3_v3v3(isec.dir, lampco, isec.start);
 			isec.dist = normalize_v3(isec.dir);
 
-			if(isec.mode==RE_RAY_SHADOW_TRA) {
+			if (isec.mode==RE_RAY_SHADOW_TRA) {
 				/* isec.col is like shadfac, so defines amount of light (0.0 is full shadow) */
 				float col[4] = {1.0f, 1.0f, 1.0f, 1.0f};
 
 				ray_trace_shadow_tra(&isec, shi, DEPTH_SHADOW_TRA, 0, col);
 				copy_v4_v4(shadfac, col);
 			}
-			else if(RE_rayobject_raycast(R.raytree, &isec))
+			else if (RE_rayobject_raycast(R.raytree, &isec))
 				shadfac[3]= 0.0f;
 		}
 		else {
@@ -2553,7 +2558,7 @@ void ray_shadow(ShadeInput *shi, LampRen *lar, float shadfac[4])
 	}
 		
 	/* for first hit optim, set last interesected shadow face */
-	if(shi->depth==0) {
+	if (shi->depth==0) {
 		lar->last_hit[shi->thread] = isec.last_hit;
 	}
 
@@ -2573,9 +2578,9 @@ static void ray_translucent(ShadeInput *shi, LampRen *lar, float *distfac, float
 	isec.mode= RE_RAY_SHADOW_TRA;
 	isec.hint = 0;
 	
-	if(lar->mode & LA_LAYER) isec.lay= lar->lay; else isec.lay= -1;
+	if (lar->mode & LA_LAYER) isec.lay= lar->lay; else isec.lay= -1;
 	
-	if(lar->type==LA_SUN || lar->type==LA_HEMI) {
+	if (lar->type==LA_SUN || lar->type==LA_HEMI) {
 		lampco[0]= shi->co[0] - RE_RAYTRACE_MAXDIST*lar->vec[0];
 		lampco[1]= shi->co[1] - RE_RAYTRACE_MAXDIST*lar->vec[1];
 		lampco[2]= shi->co[2] - RE_RAYTRACE_MAXDIST*lar->vec[2];
@@ -2591,7 +2596,7 @@ static void ray_translucent(ShadeInput *shi, LampRen *lar, float *distfac, float
 	copy_v3_v3(isec.start, shi->co);
 	copy_v3_v3(isec.end, lampco);
 	
-	if(RE_rayobject_raycast(R.raytree, &isec)) {
+	if (RE_rayobject_raycast(R.raytree, &isec)) {
 		/* we got a face */
 		
 		/* render co */
diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c
index 30853e8..37d6479 100644
--- a/source/blender/render/intern/source/render_result.c
+++ b/source/blender/render/intern/source/render_result.c
@@ -60,19 +60,19 @@
 
 void render_result_free(RenderResult *res)
 {
-	if(res==NULL) return;
+	if (res==NULL) return;
 
-	while(res->layers.first) {
+	while (res->layers.first) {
 		RenderLayer *rl= res->layers.first;
 		
-		if(rl->rectf) MEM_freeN(rl->rectf);
+		if (rl->rectf) MEM_freeN(rl->rectf);
 		/* acolrect and scolrect are optionally allocated in shade_tile, only free here since it can be used for drawing */
-		if(rl->acolrect) MEM_freeN(rl->acolrect);
-		if(rl->scolrect) MEM_freeN(rl->scolrect);
+		if (rl->acolrect) MEM_freeN(rl->acolrect);
+		if (rl->scolrect) MEM_freeN(rl->scolrect);
 		
-		while(rl->passes.first) {
+		while (rl->passes.first) {
 			RenderPass *rpass= rl->passes.first;
-			if(rpass->rect) MEM_freeN(rpass->rect);
+			if (rpass->rect) MEM_freeN(rpass->rect);
 			BLI_remlink(&rl->passes, rpass);
 			MEM_freeN(rpass);
 		}
@@ -80,13 +80,13 @@ void render_result_free(RenderResult *res)
 		MEM_freeN(rl);
 	}
 	
-	if(res->rect32)
+	if (res->rect32)
 		MEM_freeN(res->rect32);
-	if(res->rectz)
+	if (res->rectz)
 		MEM_freeN(res->rectz);
-	if(res->rectf)
+	if (res->rectf)
 		MEM_freeN(res->rectf);
-	if(res->text)
+	if (res->text)
 		MEM_freeN(res->text);
 	
 	MEM_freeN(res);
@@ -97,10 +97,10 @@ void render_result_free_list(ListBase *lb, RenderResult *rr)
 {
 	RenderResult *rrnext;
 	
-	for(; rr; rr= rrnext) {
+	for (; rr; rr= rrnext) {
 		rrnext= rr->next;
 		
-		if(lb && lb->first)
+		if (lb && lb->first)
 			BLI_remlink(lb, rr);
 		
 		render_result_free(rr);
@@ -110,172 +110,171 @@ void render_result_free_list(ListBase *lb, RenderResult *rr)
 /********************************* Names *************************************/
 
 /* NOTE: OpenEXR only supports 32 chars for layer+pass names
-   In blender we now use max 10 chars for pass, max 20 for layer */
+ * In blender we now use max 10 chars for pass, max 20 for layer */
 static const char *get_pass_name(int passtype, int channel)
 {
 	
-	if(passtype == SCE_PASS_COMBINED) {
-		if(channel==-1) return "Combined";
-		if(channel==0) return "Combined.R";
-		if(channel==1) return "Combined.G";
-		if(channel==2) return "Combined.B";
+	if (passtype == SCE_PASS_COMBINED) {
+		if (channel==-1) return "Combined";
+		if (channel==0) return "Combined.R";
+		if (channel==1) return "Combined.G";
+		if (channel==2) return "Combined.B";
 		return "Combined.A";
 	}
-	if(passtype == SCE_PASS_Z) {
-		if(channel==-1) return "Depth";
+	if (passtype == SCE_PASS_Z) {
+		if (channel==-1) return "Depth";
 		return "Depth.Z";
 	}
-	if(passtype == SCE_PASS_VECTOR) {
-		if(channel==-1) return "Vector";
-		if(channel==0) return "Vector.X";
-		if(channel==1) return "Vector.Y";
-		if(channel==2) return "Vector.Z";
+	if (passtype == SCE_PASS_VECTOR) {
+		if (channel==-1) return "Vector";
+		if (channel==0) return "Vector.X";
+		if (channel==1) return "Vector.Y";
+		if (channel==2) return "Vector.Z";
 		return "Vector.W";
 	}
-	if(passtype == SCE_PASS_NORMAL) {
-		if(channel==-1) return "Normal";
-		if(channel==0) return "Normal.X";
-		if(channel==1) return "Normal.Y";
+	if (passtype == SCE_PASS_NORMAL) {
+		if (channel==-1) return "Normal";
+		if (channel==0) return "Normal.X";
+		if (channel==1) return "Normal.Y";
 		return "Normal.Z";
 	}
-	if(passtype == SCE_PASS_UV) {
-		if(channel==-1) return "UV";
-		if(channel==0) return "UV.U";
-		if(channel==1) return "UV.V";
+	if (passtype == SCE_PASS_UV) {
+		if (channel==-1) return "UV";
+		if (channel==0) return "UV.U";
+		if (channel==1) return "UV.V";
 		return "UV.A";
 	}
-	if(passtype == SCE_PASS_RGBA) {
-		if(channel==-1) return "Color";
-		if(channel==0) return "Color.R";
-		if(channel==1) return "Color.G";
-		if(channel==2) return "Color.B";
+	if (passtype == SCE_PASS_RGBA) {
+		if (channel==-1) return "Color";
+		if (channel==0) return "Color.R";
+		if (channel==1) return "Color.G";
+		if (channel==2) return "Color.B";
 		return "Color.A";
 	}
-	if(passtype == SCE_PASS_EMIT) {
-		if(channel==-1) return "Emit";
-		if(channel==0) return "Emit.R";
-		if(channel==1) return "Emit.G";
+	if (passtype == SCE_PASS_EMIT) {
+		if (channel==-1) return "Emit";
+		if (channel==0) return "Emit.R";
+		if (channel==1) return "Emit.G";
 		return "Emit.B";
 	}
-	if(passtype == SCE_PASS_DIFFUSE) {
-		if(channel==-1) return "Diffuse";
-		if(channel==0) return "Diffuse.R";
-		if(channel==1) return "Diffuse.G";
+	if (passtype == SCE_PASS_DIFFUSE) {
+		if (channel==-1) return "Diffuse";
+		if (channel==0) return "Diffuse.R";
+		if (channel==1) return "Diffuse.G";
 		return "Diffuse.B";
 	}
-	if(passtype == SCE_PASS_SPEC) {
-		if(channel==-1) return "Spec";
-		if(channel==0) return "Spec.R";
-		if(channel==1) return "Spec.G";
+	if (passtype == SCE_PASS_SPEC) {
+		if (channel==-1) return "Spec";
+		if (channel==0) return "Spec.R";
+		if (channel==1) return "Spec.G";
 		return "Spec.B";
 	}
-	if(passtype == SCE_PASS_SHADOW) {
-		if(channel==-1) return "Shadow";
-		if(channel==0) return "Shadow.R";
-		if(channel==1) return "Shadow.G";
+	if (passtype == SCE_PASS_SHADOW) {
+		if (channel==-1) return "Shadow";
+		if (channel==0) return "Shadow.R";
+		if (channel==1) return "Shadow.G";
 		return "Shadow.B";
 	}
-	if(passtype == SCE_PASS_AO) {
-		if(channel==-1) return "AO";
-		if(channel==0) return "AO.R";
-		if(channel==1) return "AO.G";
+	if (passtype == SCE_PASS_AO) {
+		if (channel==-1) return "AO";
+		if (channel==0) return "AO.R";
+		if (channel==1) return "AO.G";
 		return "AO.B";
 	}
-	if(passtype == SCE_PASS_ENVIRONMENT) {
-		if(channel==-1) return "Env";
-		if(channel==0) return "Env.R";
-		if(channel==1) return "Env.G";
+	if (passtype == SCE_PASS_ENVIRONMENT) {
+		if (channel==-1) return "Env";
+		if (channel==0) return "Env.R";
+		if (channel==1) return "Env.G";
 		return "Env.B";
 	}
-	if(passtype == SCE_PASS_INDIRECT) {
-		if(channel==-1) return "Indirect";
-		if(channel==0) return "Indirect.R";
-		if(channel==1) return "Indirect.G";
+	if (passtype == SCE_PASS_INDIRECT) {
+		if (channel==-1) return "Indirect";
+		if (channel==0) return "Indirect.R";
+		if (channel==1) return "Indirect.G";
 		return "Indirect.B";
 	}
-	if(passtype == SCE_PASS_REFLECT) {
-		if(channel==-1) return "Reflect";
-		if(channel==0) return "Reflect.R";
-		if(channel==1) return "Reflect.G";
+	if (passtype == SCE_PASS_REFLECT) {
+		if (channel==-1) return "Reflect";
+		if (channel==0) return "Reflect.R";
+		if (channel==1) return "Reflect.G";
 		return "Reflect.B";
 	}
-	if(passtype == SCE_PASS_REFRACT) {
-		if(channel==-1) return "Refract";
-		if(channel==0) return "Refract.R";
-		if(channel==1) return "Refract.G";
+	if (passtype == SCE_PASS_REFRACT) {
+		if (channel==-1) return "Refract";
+		if (channel==0) return "Refract.R";
+		if (channel==1) return "Refract.G";
 		return "Refract.B";
 	}
-	if(passtype == SCE_PASS_INDEXOB) {
-		if(channel==-1) return "IndexOB";
+	if (passtype == SCE_PASS_INDEXOB) {
+		if (channel==-1) return "IndexOB";
 		return "IndexOB.X";
 	}
-	if(passtype == SCE_PASS_INDEXMA) {
-		if(channel==-1) return "IndexMA";
+	if (passtype == SCE_PASS_INDEXMA) {
+		if (channel==-1) return "IndexMA";
 		return "IndexMA.X";
 	}
-	if(passtype == SCE_PASS_MIST) {
-		if(channel==-1) return "Mist";
+	if (passtype == SCE_PASS_MIST) {
+		if (channel==-1) return "Mist";
 		return "Mist.Z";
 	}
-	if(passtype == SCE_PASS_RAYHITS)
-	{
-		if(channel==-1) return "Rayhits";
-		if(channel==0) return "Rayhits.R";
-		if(channel==1) return "Rayhits.G";
+	if (passtype == SCE_PASS_RAYHITS) {
+		if (channel==-1) return "Rayhits";
+		if (channel==0) return "Rayhits.R";
+		if (channel==1) return "Rayhits.G";
 		return "Rayhits.B";
 	}
-	if(passtype == SCE_PASS_DIFFUSE_DIRECT) {
-		if(channel==-1) return "DiffDir";
-		if(channel==0) return "DiffDir.R";
-		if(channel==1) return "DiffDir.G";
+	if (passtype == SCE_PASS_DIFFUSE_DIRECT) {
+		if (channel==-1) return "DiffDir";
+		if (channel==0) return "DiffDir.R";
+		if (channel==1) return "DiffDir.G";
 		return "DiffDir.B";
 	}
-	if(passtype == SCE_PASS_DIFFUSE_INDIRECT) {
-		if(channel==-1) return "DiffInd";
-		if(channel==0) return "DiffInd.R";
-		if(channel==1) return "DiffInd.G";
+	if (passtype == SCE_PASS_DIFFUSE_INDIRECT) {
+		if (channel==-1) return "DiffInd";
+		if (channel==0) return "DiffInd.R";
+		if (channel==1) return "DiffInd.G";
 		return "DiffInd.B";
 	}
-	if(passtype == SCE_PASS_DIFFUSE_COLOR) {
-		if(channel==-1) return "DiffCol";
-		if(channel==0) return "DiffCol.R";
-		if(channel==1) return "DiffCol.G";
+	if (passtype == SCE_PASS_DIFFUSE_COLOR) {
+		if (channel==-1) return "DiffCol";
+		if (channel==0) return "DiffCol.R";
+		if (channel==1) return "DiffCol.G";
 		return "DiffCol.B";
 	}
-	if(passtype == SCE_PASS_GLOSSY_DIRECT) {
-		if(channel==-1) return "GlossDir";
-		if(channel==0) return "GlossDir.R";
-		if(channel==1) return "GlossDir.G";
+	if (passtype == SCE_PASS_GLOSSY_DIRECT) {
+		if (channel==-1) return "GlossDir";
+		if (channel==0) return "GlossDir.R";
+		if (channel==1) return "GlossDir.G";
 		return "GlossDir.B";
 	}
-	if(passtype == SCE_PASS_GLOSSY_INDIRECT) {
-		if(channel==-1) return "GlossInd";
-		if(channel==0) return "GlossInd.R";
-		if(channel==1) return "GlossInd.G";
+	if (passtype == SCE_PASS_GLOSSY_INDIRECT) {
+		if (channel==-1) return "GlossInd";
+		if (channel==0) return "GlossInd.R";
+		if (channel==1) return "GlossInd.G";
 		return "GlossInd.B";
 	}
-	if(passtype == SCE_PASS_GLOSSY_COLOR) {
-		if(channel==-1) return "GlossCol";
-		if(channel==0) return "GlossCol.R";
-		if(channel==1) return "GlossCol.G";
+	if (passtype == SCE_PASS_GLOSSY_COLOR) {
+		if (channel==-1) return "GlossCol";
+		if (channel==0) return "GlossCol.R";
+		if (channel==1) return "GlossCol.G";
 		return "GlossCol.B";
 	}
-	if(passtype == SCE_PASS_TRANSM_DIRECT) {
-		if(channel==-1) return "TransDir";
-		if(channel==0) return "TransDir.R";
-		if(channel==1) return "TransDir.G";
+	if (passtype == SCE_PASS_TRANSM_DIRECT) {
+		if (channel==-1) return "TransDir";
+		if (channel==0) return "TransDir.R";
+		if (channel==1) return "TransDir.G";
 		return "TransDir.B";
 	}
-	if(passtype == SCE_PASS_TRANSM_INDIRECT) {
-		if(channel==-1) return "TransInd";
-		if(channel==0) return "TransInd.R";
-		if(channel==1) return "TransInd.G";
+	if (passtype == SCE_PASS_TRANSM_INDIRECT) {
+		if (channel==-1) return "TransInd";
+		if (channel==0) return "TransInd.R";
+		if (channel==1) return "TransInd.G";
 		return "TransInd.B";
 	}
-	if(passtype == SCE_PASS_TRANSM_COLOR) {
-		if(channel==-1) return "TransCol";
-		if(channel==0) return "TransCol.R";
-		if(channel==1) return "TransCol.G";
+	if (passtype == SCE_PASS_TRANSM_COLOR) {
+		if (channel==-1) return "TransCol";
+		if (channel==0) return "TransCol.R";
+		if (channel==1) return "TransCol.G";
 		return "TransCol.B";
 	}
 	return "Unknown";
@@ -284,88 +283,88 @@ static const char *get_pass_name(int passtype, int channel)
 static int passtype_from_name(const char *str)
 {
 	
-	if(strcmp(str, "Combined")==0)
+	if (strcmp(str, "Combined")==0)
 		return SCE_PASS_COMBINED;
 
-	if(strcmp(str, "Depth")==0)
+	if (strcmp(str, "Depth")==0)
 		return SCE_PASS_Z;
 
-	if(strcmp(str, "Vector")==0)
+	if (strcmp(str, "Vector")==0)
 		return SCE_PASS_VECTOR;
 
-	if(strcmp(str, "Normal")==0)
+	if (strcmp(str, "Normal")==0)
 		return SCE_PASS_NORMAL;
 
-	if(strcmp(str, "UV")==0)
+	if (strcmp(str, "UV")==0)
 		return SCE_PASS_UV;
 
-	if(strcmp(str, "Color")==0)
+	if (strcmp(str, "Color")==0)
 		return SCE_PASS_RGBA;
 
-	if(strcmp(str, "Emit")==0)
+	if (strcmp(str, "Emit")==0)
 		return SCE_PASS_EMIT;
 
-	if(strcmp(str, "Diffuse")==0)
+	if (strcmp(str, "Diffuse")==0)
 		return SCE_PASS_DIFFUSE;
 
-	if(strcmp(str, "Spec")==0)
+	if (strcmp(str, "Spec")==0)
 		return SCE_PASS_SPEC;
 
-	if(strcmp(str, "Shadow")==0)
+	if (strcmp(str, "Shadow")==0)
 		return SCE_PASS_SHADOW;
 	
-	if(strcmp(str, "AO")==0)
+	if (strcmp(str, "AO")==0)
 		return SCE_PASS_AO;
 
-	if(strcmp(str, "Env")==0)
+	if (strcmp(str, "Env")==0)
 		return SCE_PASS_ENVIRONMENT;
 
-	if(strcmp(str, "Indirect")==0)
+	if (strcmp(str, "Indirect")==0)
 		return SCE_PASS_INDIRECT;
 
-	if(strcmp(str, "Reflect")==0)
+	if (strcmp(str, "Reflect")==0)
 		return SCE_PASS_REFLECT;
 
-	if(strcmp(str, "Refract")==0)
+	if (strcmp(str, "Refract")==0)
 		return SCE_PASS_REFRACT;
 
-	if(strcmp(str, "IndexOB")==0)
+	if (strcmp(str, "IndexOB")==0)
 		return SCE_PASS_INDEXOB;
 
-	if(strcmp(str, "IndexMA")==0)
+	if (strcmp(str, "IndexMA")==0)
 		return SCE_PASS_INDEXMA;
 
-	if(strcmp(str, "Mist")==0)
+	if (strcmp(str, "Mist")==0)
 		return SCE_PASS_MIST;
 	
-	if(strcmp(str, "RayHits")==0)
+	if (strcmp(str, "RayHits")==0)
 		return SCE_PASS_RAYHITS;
 
-	if(strcmp(str, "DiffDir")==0)
+	if (strcmp(str, "DiffDir")==0)
 		return SCE_PASS_DIFFUSE_DIRECT;
 
-	if(strcmp(str, "DiffInd")==0)
+	if (strcmp(str, "DiffInd")==0)
 		return SCE_PASS_DIFFUSE_INDIRECT;
 
-	if(strcmp(str, "DiffCol")==0)
+	if (strcmp(str, "DiffCol")==0)
 		return SCE_PASS_DIFFUSE_COLOR;
 
-	if(strcmp(str, "GlossDir")==0)
+	if (strcmp(str, "GlossDir")==0)
 		return SCE_PASS_GLOSSY_DIRECT;
 
-	if(strcmp(str, "GlossInd")==0)
+	if (strcmp(str, "GlossInd")==0)
 		return SCE_PASS_GLOSSY_INDIRECT;
 
-	if(strcmp(str, "GlossCol")==0)
+	if (strcmp(str, "GlossCol")==0)
 		return SCE_PASS_GLOSSY_COLOR;
 
-	if(strcmp(str, "TransDir")==0)
+	if (strcmp(str, "TransDir")==0)
 		return SCE_PASS_TRANSM_DIRECT;
 
-	if(strcmp(str, "TransInd")==0)
+	if (strcmp(str, "TransInd")==0)
 		return SCE_PASS_TRANSM_INDIRECT;
 
-	if(strcmp(str, "TransCol")==0)
+	if (strcmp(str, "TransCol")==0)
 		return SCE_PASS_TRANSM_COLOR;
 
 	return 0;
@@ -386,9 +385,9 @@ static void render_layer_add_pass(RenderResult *rr, RenderLayer *rl, int channel
 	rpass->recty= rl->recty;
 	BLI_strncpy(rpass->name, get_pass_name(rpass->passtype, -1), sizeof(rpass->name));
 	
-	if(rr->exrhandle) {
+	if (rr->exrhandle) {
 		int a;
-		for(a=0; a<channels; a++)
+		for (a=0; a<channels; a++)
 			IMB_exr_add_channel(rr->exrhandle, rl->name, get_pass_name(passtype, a), 0, 0, NULL);
 	}
 	else {
@@ -397,15 +396,15 @@ static void render_layer_add_pass(RenderResult *rr, RenderLayer *rl, int channel
 		
 		rpass->rect= MEM_mapallocN(sizeof(float)*rectsize, typestr);
 		
-		if(passtype==SCE_PASS_VECTOR) {
+		if (passtype==SCE_PASS_VECTOR) {
 			/* initialize to max speed */
 			rect= rpass->rect;
-			for(x= rectsize-1; x>=0; x--)
+			for (x= rectsize-1; x>=0; x--)
 				rect[x]= PASS_VECTOR_MAX;
 		}
-		else if(passtype==SCE_PASS_Z) {
+		else if (passtype==SCE_PASS_Z) {
 			rect= rpass->rect;
-			for(x= rectsize-1; x>=0; x--)
+			for (x= rectsize-1; x>=0; x--)
 				rect[x]= 10e10;
 		}
 	}
@@ -425,32 +424,32 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf
 	rectx= partrct->xmax - partrct->xmin;
 	recty= partrct->ymax - partrct->ymin;
 	
-	if(rectx<=0 || recty<=0)
+	if (rectx<=0 || recty<=0)
 		return NULL;
 	
 	rr= MEM_callocN(sizeof(RenderResult), "new render result");
 	rr->rectx= rectx;
 	rr->recty= recty;
-	rr->renrect.xmin= 0; rr->renrect.xmax= rectx-2*crop;
+	rr->renrect.xmin = 0; rr->renrect.xmax = rectx-2*crop;
 	/* crop is one or two extra pixels rendered for filtering, is used for merging and display too */
 	rr->crop= crop;
 	
 	/* tilerect is relative coordinates within render disprect. do not subtract crop yet */
-	rr->tilerect.xmin= partrct->xmin - re->disprect.xmin;
-	rr->tilerect.xmax= partrct->xmax - re->disprect.xmax;
-	rr->tilerect.ymin= partrct->ymin - re->disprect.ymin;
-	rr->tilerect.ymax= partrct->ymax - re->disprect.ymax;
+	rr->tilerect.xmin = partrct->xmin - re->disprect.xmin;
+	rr->tilerect.xmax = partrct->xmax - re->disprect.xmax;
+	rr->tilerect.ymin = partrct->ymin - re->disprect.ymin;
+	rr->tilerect.ymax = partrct->ymax - re->disprect.ymax;
 	
-	if(savebuffers) {
+	if (savebuffers) {
 		rr->exrhandle= IMB_exr_get_handle();
 	}
 	
 	/* check renderdata for amount of layers */
-	for(nr=0, srl= re->r.layers.first; srl; srl= srl->next, nr++) {
+	for (nr=0, srl= re->r.layers.first; srl; srl= srl->next, nr++) {
 		
-		if((re->r.scemode & R_SINGLE_LAYER) && nr!=re->r.actlay)
+		if ((re->r.scemode & R_SINGLE_LAYER) && nr!=re->r.actlay)
 			continue;
-		if(srl->layflag & SCE_LAY_DISABLE)
+		if (srl->layflag & SCE_LAY_DISABLE)
 			continue;
 		
 		rl= MEM_callocN(sizeof(RenderLayer), "new render layer");
@@ -467,7 +466,7 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf
 		rl->rectx= rectx;
 		rl->recty= recty;
 		
-		if(rr->exrhandle) {
+		if (rr->exrhandle) {
 			IMB_exr_add_channel(rr->exrhandle, rl->name, "Combined.R", 0, 0, NULL);
 			IMB_exr_add_channel(rr->exrhandle, rl->name, "Combined.G", 0, 0, NULL);
 			IMB_exr_add_channel(rr->exrhandle, rl->name, "Combined.B", 0, 0, NULL);
@@ -476,64 +475,64 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf
 		else
 			rl->rectf= MEM_mapallocN(rectx*recty*sizeof(float)*4, "Combined rgba");
 		
-		if(srl->passflag  & SCE_PASS_Z)
+		if (srl->passflag  & SCE_PASS_Z)
 			render_layer_add_pass(rr, rl, 1, SCE_PASS_Z);
-		if(srl->passflag  & SCE_PASS_VECTOR)
+		if (srl->passflag  & SCE_PASS_VECTOR)
 			render_layer_add_pass(rr, rl, 4, SCE_PASS_VECTOR);
-		if(srl->passflag  & SCE_PASS_NORMAL)
+		if (srl->passflag  & SCE_PASS_NORMAL)
 			render_layer_add_pass(rr, rl, 3, SCE_PASS_NORMAL);
-		if(srl->passflag  & SCE_PASS_UV) 
+		if (srl->passflag  & SCE_PASS_UV) 
 			render_layer_add_pass(rr, rl, 3, SCE_PASS_UV);
-		if(srl->passflag  & SCE_PASS_RGBA)
+		if (srl->passflag  & SCE_PASS_RGBA)
 			render_layer_add_pass(rr, rl, 4, SCE_PASS_RGBA);
-		if(srl->passflag  & SCE_PASS_EMIT)
+		if (srl->passflag  & SCE_PASS_EMIT)
 			render_layer_add_pass(rr, rl, 3, SCE_PASS_EMIT);
-		if(srl->passflag  & SCE_PASS_DIFFUSE)
+		if (srl->passflag  & SCE_PASS_DIFFUSE)
 			render_layer_add_pass(rr, rl, 3, SCE_PASS_DIFFUSE);
-		if(srl->passflag  & SCE_PASS_SPEC)
+		if (srl->passflag  & SCE_PASS_SPEC)
 			render_layer_add_pass(rr, rl, 3, SCE_PASS_SPEC);
-		if(srl->passflag  & SCE_PASS_AO)
+		if (srl->passflag  & SCE_PASS_AO)
 			render_layer_add_pass(rr, rl, 3, SCE_PASS_AO);
-		if(srl->passflag  & SCE_PASS_ENVIRONMENT)
+		if (srl->passflag  & SCE_PASS_ENVIRONMENT)
 			render_layer_add_pass(rr, rl, 3, SCE_PASS_ENVIRONMENT);
-		if(srl->passflag  & SCE_PASS_INDIRECT)
+		if (srl->passflag  & SCE_PASS_INDIRECT)
 			render_layer_add_pass(rr, rl, 3, SCE_PASS_INDIRECT);
-		if(srl->passflag  & SCE_PASS_SHADOW)
+		if (srl->passflag  & SCE_PASS_SHADOW)
 			render_layer_add_pass(rr, rl, 3, SCE_PASS_SHADOW);
-		if(srl->passflag  & SCE_PASS_REFLECT)
+		if (srl->passflag  & SCE_PASS_REFLECT)
 			render_layer_add_pass(rr, rl, 3, SCE_PASS_REFLECT);
-		if(srl->passflag  & SCE_PASS_REFRACT)
+		if (srl->passflag  & SCE_PASS_REFRACT)
 			render_layer_add_pass(rr, rl, 3, SCE_PASS_REFRACT);
-		if(srl->passflag  & SCE_PASS_INDEXOB)
+		if (srl->passflag  & SCE_PASS_INDEXOB)
 			render_layer_add_pass(rr, rl, 1, SCE_PASS_INDEXOB);
-		if(srl->passflag  & SCE_PASS_INDEXMA)
+		if (srl->passflag  & SCE_PASS_INDEXMA)
 			render_layer_add_pass(rr, rl, 1, SCE_PASS_INDEXMA);
-		if(srl->passflag  & SCE_PASS_MIST)
+		if (srl->passflag  & SCE_PASS_MIST)
 			render_layer_add_pass(rr, rl, 1, SCE_PASS_MIST);
-		if(rl->passflag & SCE_PASS_RAYHITS)
+		if (rl->passflag & SCE_PASS_RAYHITS)
 			render_layer_add_pass(rr, rl, 4, SCE_PASS_RAYHITS);
-		if(srl->passflag  & SCE_PASS_DIFFUSE_DIRECT)
+		if (srl->passflag  & SCE_PASS_DIFFUSE_DIRECT)
 			render_layer_add_pass(rr, rl, 3, SCE_PASS_DIFFUSE_DIRECT);
-		if(srl->passflag  & SCE_PASS_DIFFUSE_INDIRECT)
+		if (srl->passflag  & SCE_PASS_DIFFUSE_INDIRECT)
 			render_layer_add_pass(rr, rl, 3, SCE_PASS_DIFFUSE_INDIRECT);
-		if(srl->passflag  & SCE_PASS_DIFFUSE_COLOR)
+		if (srl->passflag  & SCE_PASS_DIFFUSE_COLOR)
 			render_layer_add_pass(rr, rl, 3, SCE_PASS_DIFFUSE_COLOR);
-		if(srl->passflag  & SCE_PASS_GLOSSY_DIRECT)
+		if (srl->passflag  & SCE_PASS_GLOSSY_DIRECT)
 			render_layer_add_pass(rr, rl, 3, SCE_PASS_GLOSSY_DIRECT);
-		if(srl->passflag  & SCE_PASS_GLOSSY_INDIRECT)
+		if (srl->passflag  & SCE_PASS_GLOSSY_INDIRECT)
 			render_layer_add_pass(rr, rl, 3, SCE_PASS_GLOSSY_INDIRECT);
-		if(srl->passflag  & SCE_PASS_GLOSSY_COLOR)
+		if (srl->passflag  & SCE_PASS_GLOSSY_COLOR)
 			render_layer_add_pass(rr, rl, 3, SCE_PASS_GLOSSY_COLOR);
-		if(srl->passflag  & SCE_PASS_TRANSM_DIRECT)
+		if (srl->passflag  & SCE_PASS_TRANSM_DIRECT)
 			render_layer_add_pass(rr, rl, 3, SCE_PASS_TRANSM_DIRECT);
-		if(srl->passflag  & SCE_PASS_TRANSM_INDIRECT)
+		if (srl->passflag  & SCE_PASS_TRANSM_INDIRECT)
 			render_layer_add_pass(rr, rl, 3, SCE_PASS_TRANSM_INDIRECT);
-		if(srl->passflag  & SCE_PASS_TRANSM_COLOR)
+		if (srl->passflag  & SCE_PASS_TRANSM_COLOR)
 			render_layer_add_pass(rr, rl, 3, SCE_PASS_TRANSM_COLOR);
 		
 	}
 	/* sss, previewrender and envmap don't do layers, so we make a default one */
-	if(rr->layers.first==NULL) {
+	if (rr->layers.first==NULL) {
 		rl= MEM_callocN(sizeof(RenderLayer), "new render layer");
 		BLI_addtail(&rr->layers, rl);
 		
@@ -541,7 +540,7 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf
 		rl->recty= recty;
 
 		/* duplicate code... */
-		if(rr->exrhandle) {
+		if (rr->exrhandle) {
 			IMB_exr_add_channel(rr->exrhandle, rl->name, "Combined.R", 0, 0, NULL);
 			IMB_exr_add_channel(rr->exrhandle, rl->name, "Combined.G", 0, 0, NULL);
 			IMB_exr_add_channel(rr->exrhandle, rl->name, "Combined.B", 0, 0, NULL);
@@ -570,10 +569,10 @@ RenderResult *render_result_new_full_sample(Render *re, ListBase *lb, rcti *part
 {
 	int a;
 	
-	if(re->osa==0)
+	if (re->osa==0)
 		return render_result_new(re, partrct, crop, savebuffers);
 	
-	for(a=0; a<re->osa; a++) {
+	for (a=0; a<re->osa; a++) {
 		RenderResult *rr= render_result_new(re, partrct, crop, savebuffers);
 		BLI_addtail(lb, rr);
 		rr->sample_nr= a;
@@ -605,12 +604,12 @@ static void ml_addpass_cb(void *UNUSED(base), void *lay, char *str, float *rect,
 	rpass->channels= totchan;
 
 	rpass->passtype= passtype_from_name(str);
-	if(rpass->passtype==0) printf("unknown pass %s\n", str);
+	if (rpass->passtype==0) printf("unknown pass %s\n", str);
 	rl->passflag |= rpass->passtype;
 	
 	BLI_strncpy(rpass->name, str, EXR_PASS_MAXNAME);
 	/* channel id chars */
-	for(a=0; a<totchan; a++)
+	for (a=0; a<totchan; a++)
 		rpass->chan_id[a]= chan_id[a];
 	
 	rpass->rect= rect;
@@ -628,11 +627,11 @@ RenderResult *render_result_new_from_exr(void *exrhandle, int rectx, int recty)
 	
 	IMB_exr_multilayer_convert(exrhandle, rr, ml_addlayer_cb, ml_addpass_cb);
 
-	for(rl=rr->layers.first; rl; rl=rl->next) {
+	for (rl=rr->layers.first; rl; rl=rl->next) {
 		rl->rectx= rectx;
 		rl->recty= recty;
 
-		for(rpass=rl->passes.first; rpass; rpass=rpass->next) {
+		for (rpass=rl->passes.first; rpass; rpass=rpass->next) {
 			rpass->rectx= rectx;
 			rpass->recty= recty;
 		}
@@ -650,7 +649,7 @@ static void do_merge_tile(RenderResult *rr, RenderResult *rrpart, float *target,
 	copylen= tilex= rrpart->rectx;
 	tiley= rrpart->recty;
 	
-	if(rrpart->crop) {	/* filters add pixel extra */
+	if (rrpart->crop) {	/* filters add pixel extra */
 		tile+= pixsize*(rrpart->crop + rrpart->crop*tilex);
 		
 		copylen= tilex - 2*rrpart->crop;
@@ -668,7 +667,7 @@ static void do_merge_tile(RenderResult *rr, RenderResult *rrpart, float *target,
 	tilex *= pixsize;
 	ofs= pixsize*rr->rectx;
 
-	for(y=0; y<tiley; y++) {
+	for (y=0; y<tiley; y++) {
 		memcpy(target, tile, copylen);
 		target+= ofs;
 		tile+= tilex;
@@ -683,14 +682,14 @@ void render_result_merge(RenderResult *rr, RenderResult *rrpart)
 	RenderLayer *rl, *rlp;
 	RenderPass *rpass, *rpassp;
 	
-	for(rl= rr->layers.first, rlp= rrpart->layers.first; rl && rlp; rl= rl->next, rlp= rlp->next) {
+	for (rl= rr->layers.first, rlp= rrpart->layers.first; rl && rlp; rl= rl->next, rlp= rlp->next) {
 		
 		/* combined */
-		if(rl->rectf && rlp->rectf)
+		if (rl->rectf && rlp->rectf)
 			do_merge_tile(rr, rrpart, rl->rectf, rlp->rectf, 4);
 		
 		/* passes are allocated in sync */
-		for(rpass= rl->passes.first, rpassp= rlp->passes.first; rpass && rpassp; rpass= rpass->next, rpassp= rpassp->next) {
+		for (rpass= rl->passes.first, rpassp= rlp->passes.first; rpass && rpassp; rpass= rpass->next, rpassp= rpassp->next) {
 			do_merge_tile(rr, rrpart, rpass->rect, rpassp->rect, rpass->channels);
 		}
 	}
@@ -723,7 +722,7 @@ int RE_WriteRenderResult(ReportList *reports, RenderResult *rr, const char *file
 	BLI_make_existing_file(filename);
 	
 	/* composite result */
-	if(rr->rectf) {
+	if (rr->rectf) {
 		IMB_exr_add_channel(exrhandle, "Composite", "Combined.R", 4, 4*rr->rectx, rr->rectf);
 		IMB_exr_add_channel(exrhandle, "Composite", "Combined.G", 4, 4*rr->rectx, rr->rectf+1);
 		IMB_exr_add_channel(exrhandle, "Composite", "Combined.B", 4, 4*rr->rectx, rr->rectf+2);
@@ -731,21 +730,21 @@ int RE_WriteRenderResult(ReportList *reports, RenderResult *rr, const char *file
 	}
 	
 	/* add layers/passes and assign channels */
-	for(rl= rr->layers.first; rl; rl= rl->next) {
+	for (rl= rr->layers.first; rl; rl= rl->next) {
 		
 		/* combined */
-		if(rl->rectf) {
+		if (rl->rectf) {
 			int a, xstride= 4;
-			for(a=0; a<xstride; a++)
+			for (a=0; a<xstride; a++)
 				IMB_exr_add_channel(exrhandle, rl->name, get_pass_name(SCE_PASS_COMBINED, a), 
 									xstride, xstride*rr->rectx, rl->rectf+a);
 		}
 		
 		/* passes are allocated in sync */
-		for(rpass= rl->passes.first; rpass; rpass= rpass->next) {
+		for (rpass= rl->passes.first; rpass; rpass= rpass->next) {
 			int a, xstride= rpass->channels;
-			for(a=0; a<xstride; a++) {
-				if(rpass->passtype)
+			for (a=0; a<xstride; a++) {
+				if (rpass->passtype)
 					IMB_exr_add_channel(exrhandle, rl->name, get_pass_name(rpass->passtype, a), 
 										xstride, xstride*rr->rectx, rpass->rect+a);
 				else
@@ -756,7 +755,7 @@ int RE_WriteRenderResult(ReportList *reports, RenderResult *rr, const char *file
 	}
 
 	/* when the filename has no permissions, this can fail */
-	if(IMB_exr_begin_write(exrhandle, filename, rr->rectx, rr->recty, compress)) {
+	if (IMB_exr_begin_write(exrhandle, filename, rr->rectx, rr->recty, compress)) {
 		IMB_exr_write_channels(exrhandle);
 		success= TRUE;
 	}
@@ -791,15 +790,15 @@ void render_result_single_layer_end(Render *re)
 	RenderLayer *rl;
 	int nr;
 
-	if(re->result==NULL) {
+	if (re->result==NULL) {
 		printf("pop render result error; no current result!\n");
 		return;
 	}
 
-	if(!re->pushedresult)
+	if (!re->pushedresult)
 		return;
 
-	if(re->pushedresult->rectx==re->result->rectx && re->pushedresult->recty==re->result->recty) {
+	if (re->pushedresult->rectx==re->result->rectx && re->pushedresult->recty==re->result->recty) {
 		/* find which layer in re->pushedresult should be replaced */
 		rl= re->result->layers.first;
 		
@@ -807,12 +806,12 @@ void render_result_single_layer_end(Render *re)
 		BLI_remlink(&re->result->layers, rl);
 		
 		/* reconstruct render result layers */
-		for(nr=0, srl= re->scene->r.layers.first; srl; srl= srl->next, nr++) {
-			if(nr==re->r.actlay)
+		for (nr=0, srl= re->scene->r.layers.first; srl; srl= srl->next, nr++) {
+			if (nr==re->r.actlay)
 				BLI_addtail(&re->result->layers, rl);
 			else {
 				rlpush= RE_GetRenderLayer(re->pushedresult, srl->name);
-				if(rlpush) {
+				if (rlpush) {
 					BLI_remlink(&re->pushedresult->layers, rlpush);
 					BLI_addtail(&re->result->layers, rlpush);
 				}
@@ -834,9 +833,9 @@ static void save_render_result_tile(RenderResult *rr, RenderResult *rrpart)
 	
 	BLI_lock_thread(LOCK_IMAGE);
 	
-	for(rlp= rrpart->layers.first; rlp; rlp= rlp->next) {
+	for (rlp= rrpart->layers.first; rlp; rlp= rlp->next) {
 		
-		if(rrpart->crop) {	/* filters add pixel extra */
+		if (rrpart->crop) {	/* filters add pixel extra */
 			offs= (rrpart->crop + rrpart->crop*rrpart->rectx);
 		}
 		else {
@@ -844,17 +843,17 @@ static void save_render_result_tile(RenderResult *rr, RenderResult *rrpart)
 		}
 		
 		/* combined */
-		if(rlp->rectf) {
+		if (rlp->rectf) {
 			int a, xstride= 4;
-			for(a=0; a<xstride; a++)
+			for (a=0; a<xstride; a++)
 				IMB_exr_set_channel(rr->exrhandle, rlp->name, get_pass_name(SCE_PASS_COMBINED, a), 
 								xstride, xstride*rrpart->rectx, rlp->rectf+a + xstride*offs);
 		}
 		
 		/* passes are allocated in sync */
-		for(rpassp= rlp->passes.first; rpassp; rpassp= rpassp->next) {
+		for (rpassp= rlp->passes.first; rpassp; rpassp= rpassp->next) {
 			int a, xstride= rpassp->channels;
-			for(a=0; a<xstride; a++)
+			for (a=0; a<xstride; a++)
 				IMB_exr_set_channel(rr->exrhandle, rlp->name, get_pass_name(rpassp->passtype, a), 
 									xstride, xstride*rrpart->rectx, rpassp->rect+a + xstride*offs);
 		}
@@ -873,11 +872,11 @@ static void save_empty_result_tiles(Render *re)
 	RenderPart *pa;
 	RenderResult *rr;
 	
-	for(rr= re->result; rr; rr= rr->next) {
+	for (rr= re->result; rr; rr= rr->next) {
 		IMB_exrtile_clear_channels(rr->exrhandle);
 		
-		for(pa= re->parts.first; pa; pa= pa->next) {
-			if(pa->ready==0) {
+		for (pa= re->parts.first; pa; pa= pa->next) {
+			if (pa->ready==0) {
 				int party= pa->disprect.ymin - re->disprect.ymin + pa->crop;
 				int partx= pa->disprect.xmin - re->disprect.xmin + pa->crop;
 				IMB_exrtile_write_channels(rr->exrhandle, partx, party, 0);
@@ -892,7 +891,7 @@ void render_result_exr_file_begin(Render *re)
 	RenderResult *rr;
 	char str[FILE_MAX];
 	
-	for(rr= re->result; rr; rr= rr->next) {
+	for (rr= re->result; rr; rr= rr->next) {
 		render_result_exr_file_path(re->scene, rr->sample_nr, str);
 	
 		printf("write exr tmp file, %dx%d, %s\n", rr->rectx, rr->recty, str);
@@ -907,7 +906,7 @@ void render_result_exr_file_end(Render *re)
 
 	save_empty_result_tiles(re);
 	
-	for(rr= re->result; rr; rr= rr->next) {
+	for (rr= re->result; rr; rr= rr->next) {
 		IMB_exr_close(rr->exrhandle);
 		rr->exrhandle= NULL;
 	}
@@ -921,7 +920,7 @@ void render_result_exr_file_end(Render *re)
 /* save part into exr file */
 void render_result_exr_file_merge(RenderResult *rr, RenderResult *rrpart)
 {
-	for(; rr && rrpart; rr= rr->next, rrpart= rrpart->next)
+	for (; rr && rrpart; rr= rr->next, rrpart= rrpart->next)
 		save_render_result_tile(rr, rrpart);
 }
 
@@ -933,7 +932,7 @@ void render_result_exr_file_path(Scene *scene, int sample, char *filepath)
 	BLI_strncpy(di, G.main->name, FILE_MAX);
 	BLI_splitdirstring(di, fi);
 	
-	if(sample==0)
+	if (sample==0)
 		BLI_snprintf(name, sizeof(name), "%s_%s.exr", fi, scene->id.name+2);
 	else
 		BLI_snprintf(name, sizeof(name), "%s_%s%d.exr", fi, scene->id.name+2, sample);
@@ -953,7 +952,7 @@ int render_result_exr_file_read(Render *re, int sample)
 	render_result_exr_file_path(re->scene, sample, str);
 	printf("read exr tmp file: %s\n", str);
 
-	if(render_result_exr_file_read_path(re->result, str)) {
+	if (render_result_exr_file_read_path(re->result, str)) {
 		success= TRUE;
 	}
 	else {
@@ -973,14 +972,14 @@ int render_result_exr_file_read_path(RenderResult *rr, const char *filepath)
 	void *exrhandle= IMB_exr_get_handle();
 	int rectx, recty;
 
-	if(IMB_exr_begin_read(exrhandle, filepath, &rectx, &recty)==0) {
+	if (IMB_exr_begin_read(exrhandle, filepath, &rectx, &recty)==0) {
 		printf("failed being read %s\n", filepath);
 		IMB_exr_close(exrhandle);
 		return 0;
 	}
 
-	if(rr == NULL || rectx!=rr->rectx || recty!=rr->recty) {
-		if(rr)
+	if (rr == NULL || rectx!=rr->rectx || recty!=rr->recty) {
+		if (rr)
 			printf("error in reading render result: dimensions don't match\n");
 		else
 			printf("error in reading render result: NULL result pointer\n");
@@ -988,19 +987,19 @@ int render_result_exr_file_read_path(RenderResult *rr, const char *filepath)
 		return 0;
 	}
 
-	for(rl= rr->layers.first; rl; rl= rl->next) {
+	for (rl= rr->layers.first; rl; rl= rl->next) {
 		/* combined */
-		if(rl->rectf) {
+		if (rl->rectf) {
 			int a, xstride= 4;
-			for(a=0; a<xstride; a++)
+			for (a=0; a<xstride; a++)
 				IMB_exr_set_channel(exrhandle, rl->name, get_pass_name(SCE_PASS_COMBINED, a), 
 									xstride, xstride*rectx, rl->rectf+a);
 		}
 		
 		/* passes are allocated in sync */
-		for(rpass= rl->passes.first; rpass; rpass= rpass->next) {
+		for (rpass= rl->passes.first; rpass; rpass= rpass->next) {
 			int a, xstride= rpass->channels;
-			for(a=0; a<xstride; a++)
+			for (a=0; a<xstride; a++)
 				IMB_exr_set_channel(exrhandle, rl->name, get_pass_name(rpass->passtype, a), 
 									xstride, xstride*rectx, rpass->rect+a);
 
@@ -1036,14 +1035,15 @@ ImBuf *render_result_rect_to_ibuf(RenderResult *rr, RenderData *rd)
 			ibuf->profile = IB_PROFILE_SRGB;
 			if (BKE_imtype_valid_depths(rd->im_format.imtype) & (R_IMF_CHAN_DEPTH_12|R_IMF_CHAN_DEPTH_16|R_IMF_CHAN_DEPTH_24|R_IMF_CHAN_DEPTH_32))
 				IMB_float_from_rect(ibuf);
-		} else {				
+		}
+		else {
 			ibuf->profile = IB_PROFILE_LINEAR_RGB;
 		}
 	}
 
 	/* color -> greyscale */
 	/* editing directly would alter the render view */
-	if(rd->im_format.planes == R_IMF_PLANES_BW) {
+	if (rd->im_format.planes == R_IMF_PLANES_BW) {
 		ImBuf *ibuf_bw= IMB_dupImBuf(ibuf);
 		IMB_color_to_bw(ibuf_bw);
 		IMB_freeImBuf(ibuf);
@@ -1055,7 +1055,7 @@ ImBuf *render_result_rect_to_ibuf(RenderResult *rr, RenderData *rd)
 
 void render_result_rect_from_ibuf(RenderResult *rr, RenderData *rd, ImBuf *ibuf)
 {
-	if(ibuf->rect_float) {
+	if (ibuf->rect_float) {
 		/* color management: when off ensure rectf is non-lin, since thats what the internal
 		 * render engine delivers */
 		int profile_to= (rd->color_mgt_flag & R_COLOR_MANAGEMENT)? IB_PROFILE_LINEAR_RGB: IB_PROFILE_SRGB;
@@ -1070,20 +1070,20 @@ void render_result_rect_from_ibuf(RenderResult *rr, RenderData *rd, ImBuf *ibuf)
 			rr->rectx, rr->recty, rr->rectx, rr->rectx);
 		
 		/* TSK! Since sequence render doesn't free the *rr render result, the old rect32
-		   can hang around when sequence render has rendered a 32 bits one before */
-		if(rr->rect32) {
+		 * can hang around when sequence render has rendered a 32 bits one before */
+		if (rr->rect32) {
 			MEM_freeN(rr->rect32);
 			rr->rect32= NULL;
 		}
 	}
-	else if(ibuf->rect) {
+	else if (ibuf->rect) {
 		if (!rr->rect32)
 			rr->rect32= MEM_mallocN(sizeof(int)*rr->rectx*rr->recty, "render_seq rect");
 
 		memcpy(rr->rect32, ibuf->rect, 4*rr->rectx*rr->recty);
 
 		/* Same things as above, old rectf can hang around from previous render. */
-		if(rr->rectf) {
+		if (rr->rectf) {
 			MEM_freeN(rr->rectf);
 			rr->rectf= NULL;
 		}
@@ -1102,10 +1102,10 @@ void render_result_rect_fill_zero(RenderResult *rr)
 
 void render_result_rect_get_pixels(RenderResult *rr, RenderData *rd, unsigned int *rect, int rectx, int recty)
 {
-	if(rr->rect32) {
+	if (rr->rect32) {
 		memcpy(rect, rr->rect32, sizeof(int)*rr->rectx*rr->recty);
 	}
-	else if(rr->rectf) {
+	else if (rr->rectf) {
 		int profile_from= (rd->color_mgt_flag & R_COLOR_MANAGEMENT)? IB_PROFILE_LINEAR_RGB: IB_PROFILE_SRGB;
 		int predivide= (rd->color_mgt_flag & R_COLOR_MANAGEMENT_PREDIVIDE);
 		int dither= 0;
diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c
index 95cad5a..fedbce8 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -96,39 +96,39 @@ static void init_render_texture(Render *re, Tex *tex)
 {
 	int cfra= re->scene->r.cfra;
 	
-	if(re) cfra= re->r.cfra;
+	if (re) cfra= re->r.cfra;
 	
 	/* imap test */
-	if(tex->ima && ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
+	if (tex->ima && ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
 		BKE_image_user_calc_frame(&tex->iuser, cfra, re?re->flag & R_SEC_FIELD:0);
 	}
 	
-	if(tex->type==TEX_PLUGIN) {
-		if(tex->plugin && tex->plugin->doit) {
-			if(tex->plugin->cfra) {
+	if (tex->type==TEX_PLUGIN) {
+		if (tex->plugin && tex->plugin->doit) {
+			if (tex->plugin->cfra) {
 				*(tex->plugin->cfra)= (float)cfra; //BKE_curframe(re->scene); // XXX old animsys - timing stuff to be fixed 
 			}
 		}
 	}
-	else if(tex->type==TEX_ENVMAP) {
+	else if (tex->type==TEX_ENVMAP) {
 		/* just in case */
 		tex->imaflag |= TEX_INTERPOL | TEX_MIPMAP;
 		tex->extend= TEX_CLIP;
 		
-		if(tex->env) {
-			if(tex->env->type==ENV_PLANE)
+		if (tex->env) {
+			if (tex->env->type==ENV_PLANE)
 				tex->extend= TEX_EXTEND;
 			
 			/* only free envmap when rendermode was set to render envmaps, for previewrender */
-			if(G.rendering && re) {
+			if (G.rendering && re) {
 				if (re->r.mode & R_ENVMAP)
-					if(tex->env->stype==ENV_ANIM) 
+					if (tex->env->stype==ENV_ANIM)
 						BKE_free_envmapdata(tex->env);
 			}
 		}
 	}
 	
-	if(tex->nodetree && tex->use_nodes) {
+	if (tex->nodetree && tex->use_nodes) {
 		ntreeTexBeginExecTree(tex->nodetree, 1); /* has internal flag to detect it only does it once */
 	}
 }
@@ -140,23 +140,23 @@ void init_render_textures(Render *re)
 	Tex *tex;
 	
 	tex= re->main->tex.first;
-	while(tex) {
-		if(tex->id.us) init_render_texture(re, tex);
+	while (tex) {
+		if (tex->id.us) init_render_texture(re, tex);
 		tex= tex->id.next;
 	}
 }
 
 static void end_render_texture(Tex *tex)
 {
-	if(tex && tex->use_nodes && tex->nodetree && tex->nodetree->execdata)
+	if (tex && tex->use_nodes && tex->nodetree && tex->nodetree->execdata)
 		ntreeTexEndExecTree(tex->nodetree->execdata, 1);
 }
 
 void end_render_textures(Render *re)
 {
 	Tex *tex;
-	for(tex= re->main->tex.first; tex; tex= tex->id.next)
-		if(tex->id.us)
+	for (tex= re->main->tex.first; tex; tex= tex->id.next)
+		if (tex->id.us)
 			end_render_texture(tex);
 }
 
@@ -197,7 +197,7 @@ static int blend(Tex *tex, float *texvec, TexResult *texres)
 {
 	float x, y, t;
 
-	if(tex->flag & TEX_FLIPBLEND) {
+	if (tex->flag & TEX_FLIPBLEND) {
 		x= texvec[1];
 		y= texvec[0];
 	}
@@ -206,33 +206,33 @@ static int blend(Tex *tex, float *texvec, TexResult *texres)
 		y= texvec[1];
 	}
 
-	if(tex->stype==TEX_LIN) {	/* lin */
+	if (tex->stype==TEX_LIN) {	/* lin */
 		texres->tin= (1.0f+x)/2.0f;
 	}
-	else if(tex->stype==TEX_QUAD) {	/* quad */
+	else if (tex->stype==TEX_QUAD) {	/* quad */
 		texres->tin= (1.0f+x)/2.0f;
-		if(texres->tin<0.0f) texres->tin= 0.0f;
+		if (texres->tin<0.0f) texres->tin= 0.0f;
 		else texres->tin*= texres->tin;
 	}
-	else if(tex->stype==TEX_EASE) {	/* ease */
+	else if (tex->stype==TEX_EASE) {	/* ease */
 		texres->tin= (1.0f+x)/2.0f;
-		if(texres->tin<=0.0f) texres->tin= 0.0f;
-		else if(texres->tin>=1.0f) texres->tin= 1.0f;
+		if (texres->tin<=0.0f) texres->tin= 0.0f;
+		else if (texres->tin>=1.0f) texres->tin= 1.0f;
 		else {
 			t= texres->tin*texres->tin;
 			texres->tin= (3.0f*t-2.0f*t*texres->tin);
 		}
 	}
-	else if(tex->stype==TEX_DIAG) { /* diag */
+	else if (tex->stype==TEX_DIAG) { /* diag */
 		texres->tin= (2.0f+x+y)/4.0f;
 	}
-	else if(tex->stype==TEX_RAD) { /* radial */
+	else if (tex->stype==TEX_RAD) { /* radial */
 		texres->tin= (atan2(y,x) / (2*M_PI) + 0.5);
 	}
 	else {  /* sphere TEX_SPHERE */
 		texres->tin= 1.0-sqrt(x*x+	y*y+texvec[2]*texvec[2]);
-		if(texres->tin<0.0f) texres->tin= 0.0f;
-		if(tex->stype==TEX_HALO) texres->tin*= texres->tin;  /* halo */
+		if (texres->tin<0.0f) texres->tin= 0.0f;
+		if (tex->stype==TEX_HALO) texres->tin*= texres->tin;  /* halo */
 	}
 
 	BRICONT;
@@ -426,37 +426,37 @@ static int magic(Tex *tex, float *texvec, TexResult *texres)
 	x=  sin( ( texvec[0]+texvec[1]+texvec[2])*5.0f );
 	y=  cos( (-texvec[0]+texvec[1]-texvec[2])*5.0f );
 	z= -cos( (-texvec[0]-texvec[1]+texvec[2])*5.0f );
-	if(n>0) {
+	if (n>0) {
 		x*= turb;
 		y*= turb;
 		z*= turb;
 		y= -cos(x-y+z);
 		y*= turb;
-		if(n>1) {
+		if (n>1) {
 			x= cos(x-y-z);
 			x*= turb;
-			if(n>2) {
+			if (n>2) {
 				z= sin(-x-y-z);
 				z*= turb;
-				if(n>3) {
+				if (n>3) {
 					x= -cos(-x+y-z);
 					x*= turb;
-					if(n>4) {
+					if (n>4) {
 						y= -sin(-x+y+z);
 						y*= turb;
-						if(n>5) {
+						if (n>5) {
 							y= -cos(-x+y+z);
 							y*= turb;
-							if(n>6) {
+							if (n>6) {
 								x= cos(x+y+z);
 								x*= turb;
-								if(n>7) {
+								if (n>7) {
 									z= sin(x+y-z);
 									z*= turb;
-									if(n>8) {
+									if (n>8) {
 										x= -cos(-x-y+z);
 										x*= turb;
-										if(n>9) {
+										if (n>9) {
 											y= -sin(x-y+z);
 											y*= turb;
 										}
@@ -470,7 +470,7 @@ static int magic(Tex *tex, float *texvec, TexResult *texres)
 		}
 	}
 
-	if(turb!=0.0f) {
+	if (turb!=0.0f) {
 		turb*= 2.0f;
 		x/= turb; 
 		y/= turb; 
@@ -500,19 +500,19 @@ static int stucci(Tex *tex, float *texvec, TexResult *texres)
 	
 	ofs= tex->turbul/200.0f;
 
-	if(tex->stype) ofs*=(b2*b2);
+	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[2] = BLI_gNoise(tex->noisesize, texvec[0], texvec[1], texvec[2]+ofs, (tex->noisetype!=TEX_NOISESOFT), tex->noisebasis);
 
 	texres->tin= nor[2];
 	
-	if(texres->nor) { 
+	if (texres->nor) {
 		
 		copy_v3_v3(texres->nor, nor);
 		tex_normal_derivate(tex, texres);
 		
-		if(tex->stype==TEX_WALLOUT) {
+		if (tex->stype==TEX_WALLOUT) {
 			texres->nor[0]= -texres->nor[0];
 			texres->nor[1]= -texres->nor[1];
 			texres->nor[2]= -texres->nor[2];
@@ -521,10 +521,10 @@ static int stucci(Tex *tex, float *texvec, TexResult *texres)
 		retval |= TEX_NOR;
 	}
 	
-	if(tex->stype==TEX_WALLOUT) 
+	if (tex->stype==TEX_WALLOUT)
 		texres->tin= 1.0f-texres->tin;
 	
-	if(texres->tin<0.0f)
+	if (texres->tin<0.0f)
 		texres->tin= 0.0f;
 	
 	return retval;
@@ -651,7 +651,7 @@ static float mg_distNoiseTex(Tex *tex, float *texvec, TexResult *texres)
 static float voronoiTex(Tex *tex, float *texvec, TexResult *texres)
 {
 	int rv = TEX_INT;
-	float da[4], pa[12];	/* distance and point coordinate arrays of 4 nearest neighbours */
+	float da[4], pa[12];	/* distance and point coordinate arrays of 4 nearest neighbors */
 	float aw1 = fabs(tex->vn_w1);
 	float aw2 = fabs(tex->vn_w2);
 	float aw3 = fabs(tex->vn_w3);
@@ -733,7 +733,7 @@ static int texnoise(Tex *tex, TexResult *texres)
 	val= (ran & 3);
 	
 	loop= tex->noisedepth;
-	while(loop--) {
+	while (loop--) {
 		ran= (ran>>2);
 		val*= (ran & 3);
 		div*= 3.0f;
@@ -756,21 +756,23 @@ static int plugintex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex
 	texres->tin= 0.0;
 
 	pit= tex->plugin;
-	if(pit && pit->doit) {
-		if(texres->nor) {
+	if (pit && pit->doit) {
+		if (texres->nor) {
 			if (pit->version < 6) {
 				copy_v3_v3(pit->result+5, texres->nor);
-			} else {
+			}
+			else {
 				copy_v3_v3(result+5, texres->nor);
 			}
 		}
 		if (pit->version < 6) {
-			if(osatex) rgbnor= ((TexDoitold)pit->doit)(tex->stype, 
+			if (osatex) rgbnor= ((TexDoitold)pit->doit)(tex->stype,
 				pit->data, texvec, dxt, dyt);
 			else rgbnor= ((TexDoitold)pit->doit)(tex->stype, 
 				pit->data, texvec, NULL, NULL);
-		} else {
-			if(osatex) rgbnor= ((TexDoit)pit->doit)(tex->stype, 
+		}
+		else {
+			if (osatex) rgbnor= ((TexDoit)pit->doit)(tex->stype,
 				pit->data, texvec, dxt, dyt, result);
 			else rgbnor= ((TexDoit)pit->doit)(tex->stype, 
 				pit->data, texvec, NULL, NULL, result);
@@ -778,27 +780,30 @@ static int plugintex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex
 
 		if (pit->version < 6) {
 			texres->tin = pit->result[0];
-		} else {
+		}
+		else {
 			texres->tin = result[0]; /* XXX, assigning garbage value, fixme! */
 		}
 
-		if(rgbnor & TEX_NOR) {
-			if(texres->nor) {
+		if (rgbnor & TEX_NOR) {
+			if (texres->nor) {
 				if (pit->version < 6) {
 					copy_v3_v3(texres->nor, pit->result+5);
-				} else {
+				}
+				else {
 					copy_v3_v3(texres->nor, result+5);
 				}
 			}
 		}
 		
-		if(rgbnor & TEX_RGB) {
+		if (rgbnor & TEX_RGB) {
 			if (pit->version < 6) {
 				texres->tr = pit->result[1];
 				texres->tg = pit->result[2];
 				texres->tb = pit->result[3];
 				texres->ta = pit->result[4];
-			} else {
+			}
+			else {
 				texres->tr = result[1];
 				texres->tg = result[2];
 				texres->tb = result[3];
@@ -820,7 +825,7 @@ static int cubemap_glob(float *n, float x, float y, float z, float *adr1, float
 	float x1, y1, z1, nor[3];
 	int ret;
 	
-	if(n==NULL) {
+	if (n==NULL) {
 		nor[0]= x; nor[1]= y; nor[2]= z;	// use local render coord
 	}
 	else {
@@ -832,12 +837,12 @@ static int cubemap_glob(float *n, float x, float y, float z, float *adr1, float
 	y1= fabs(nor[1]);
 	z1= fabs(nor[2]);
 	
-	if(z1>=x1 && z1>=y1) {
+	if (z1>=x1 && z1>=y1) {
 		*adr1 = (x + 1.0f) / 2.0f;
 		*adr2 = (y + 1.0f) / 2.0f;
 		ret= 0;
 	}
-	else if(y1>=x1 && y1>=z1) {
+	else if (y1>=x1 && y1>=z1) {
 		*adr1 = (x + 1.0f) / 2.0f;
 		*adr2 = (z + 1.0f) / 2.0f;
 		ret= 1;
@@ -857,24 +862,24 @@ static int cubemap(MTex *mtex, VlakRen *vlr, float *n, float x, float y, float z
 {
 	int proj[4]={0, ME_PROJXY, ME_PROJXZ, ME_PROJYZ}, ret= 0;
 	
-	if(vlr) {
+	if (vlr) {
 		int index;
 		
 		/* Mesh vertices have such flags, for others we calculate it once based on orco */
-		if((vlr->puno & (ME_PROJXY|ME_PROJXZ|ME_PROJYZ))==0) {
+		if ((vlr->puno & (ME_PROJXY|ME_PROJXZ|ME_PROJYZ))==0) {
 			/* test for v1, vlr can be faked for baking */
-			if(vlr->v1 && vlr->v1->orco) {
+			if (vlr->v1 && vlr->v1->orco) {
 				float nor[3];
 				normal_tri_v3( nor,vlr->v1->orco, vlr->v2->orco, vlr->v3->orco);
 				
-				if( fabs(nor[0])<fabs(nor[2]) && fabs(nor[1])<fabs(nor[2]) ) vlr->puno |= ME_PROJXY;
-				else if( fabs(nor[0])<fabs(nor[1]) && fabs(nor[2])<fabs(nor[1]) ) vlr->puno |= ME_PROJXZ;
+				if ( fabs(nor[0])<fabs(nor[2]) && fabs(nor[1])<fabs(nor[2]) ) vlr->puno |= ME_PROJXY;
+				else if ( fabs(nor[0])<fabs(nor[1]) && fabs(nor[2])<fabs(nor[1]) ) vlr->puno |= ME_PROJXZ;
 				else vlr->puno |= ME_PROJYZ;
 			}
 			else return cubemap_glob(n, x, y, z, adr1, adr2);
 		}
 		
-		if(mtex) {
+		if (mtex) {
 			/* the mtex->proj{xyz} have type char. maybe this should be wider? */
 			/* casting to int ensures that the index type is right.            */
 			index = (int) mtex->projx;
@@ -887,11 +892,11 @@ static int cubemap(MTex *mtex, VlakRen *vlr, float *n, float x, float y, float z
 			proj[index]= ME_PROJYZ;
 		}
 		
-		if(vlr->puno & proj[1]) {
+		if (vlr->puno & proj[1]) {
 			*adr1 = (x + 1.0f) / 2.0f;
 			*adr2 = (y + 1.0f) / 2.0f;
 		}
-		else if(vlr->puno & proj[2]) {
+		else if (vlr->puno & proj[2]) {
 			*adr1 = (x + 1.0f) / 2.0f;
 			*adr2 = (z + 1.0f) / 2.0f;
 			ret= 1;
@@ -916,21 +921,21 @@ static int cubemap_ob(Object *ob, float *n, float x, float y, float z, float *ad
 	float x1, y1, z1, nor[3];
 	int ret;
 	
-	if(n==NULL) return 0;
+	if (n==NULL) return 0;
 	
 	copy_v3_v3(nor, n);
-	if(ob) mul_mat3_m4_v3(ob->imat, nor);
+	if (ob) mul_mat3_m4_v3(ob->imat, nor);
 	
 	x1= fabs(nor[0]);
 	y1= fabs(nor[1]);
 	z1= fabs(nor[2]);
 	
-	if(z1>=x1 && z1>=y1) {
+	if (z1>=x1 && z1>=y1) {
 		*adr1 = (x + 1.0f) / 2.0f;
 		*adr2 = (y + 1.0f) / 2.0f;
 		ret= 0;
 	}
-	else if(y1>=x1 && y1>=z1) {
+	else if (y1>=x1 && y1>=z1) {
 		*adr1 = (x + 1.0f) / 2.0f;
 		*adr2 = (z + 1.0f) / 2.0f;
 		ret= 1;
@@ -958,53 +963,53 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d
 	ob= mtex->object;
 	texco= mtex->texco;
 
-	if(R.osa==0) {
+	if (R.osa==0) {
 		
-		if(wrap==MTEX_FLAT) {
+		if (wrap==MTEX_FLAT) {
 			fx = (t[0] + 1.0f) / 2.0f;
 			fy = (t[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,t[0], t[1], t[2]);
+		else if (wrap==MTEX_SPHERE) map_to_sphere( &fx, &fy,t[0], t[1], t[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);
+			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);
 		}
 		
 		/* repeat */
-		if(tex->extend==TEX_REPEAT) {
-			if(tex->xrepeat>1) {
+		if (tex->extend==TEX_REPEAT) {
+			if (tex->xrepeat>1) {
 				float origf= fx *= tex->xrepeat;
 				
-				if(fx>1.0f) fx -= (int)(fx);
-				else if(fx<0.0f) fx+= 1-(int)(fx);
+				if (fx>1.0f) fx -= (int)(fx);
+				else if (fx<0.0f) fx+= 1-(int)(fx);
 				
-				if(tex->flag & TEX_REPEAT_XMIR) {
+				if (tex->flag & TEX_REPEAT_XMIR) {
 					int orig= (int)floor(origf);
-					if(orig & 1)
+					if (orig & 1)
 						fx= 1.0f-fx;
 				}
 			}
-			if(tex->yrepeat>1) {
+			if (tex->yrepeat>1) {
 				float origf= fy *= tex->yrepeat;
 				
-				if(fy>1.0f) fy -= (int)(fy);
-				else if(fy<0.0f) fy+= 1-(int)(fy);
+				if (fy>1.0f) fy -= (int)(fy);
+				else if (fy<0.0f) fy+= 1-(int)(fy);
 				
-				if(tex->flag & TEX_REPEAT_YMIR) {
+				if (tex->flag & TEX_REPEAT_YMIR) {
 					int orig= (int)floor(origf);
-					if(orig & 1) 
+					if (orig & 1)
 						fy= 1.0f-fy;
 				}
 			}
 		}
 		/* crop */
-		if(tex->cropxmin!=0.0f || tex->cropxmax!=1.0f) {
+		if (tex->cropxmin!=0.0f || tex->cropxmax!=1.0f) {
 			fac1= tex->cropxmax - tex->cropxmin;
 			fx= tex->cropxmin+ fx*fac1;
 		}
-		if(tex->cropymin!=0.0f || tex->cropymax!=1.0f) {
+		if (tex->cropymin!=0.0f || tex->cropymax!=1.0f) {
 			fac1= tex->cropymax - tex->cropymin;
 			fy= tex->cropymin+ fy*fac1;
 		}
@@ -1014,7 +1019,7 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d
 	}
 	else {
 		
-		if(wrap==MTEX_FLAT) {
+		if (wrap==MTEX_FLAT) {
 			fx= (t[0] + 1.0f) / 2.0f;
 			fy= (t[1] + 1.0f) / 2.0f;
 			dxt[0]/= 2.0f;
@@ -1024,18 +1029,18 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d
 			dyt[1]/= 2.0f;
 			dyt[2]/= 2.0f;
 		}
-		else if ELEM(wrap, MTEX_TUBE, MTEX_SPHERE) {
+		else if (ELEM(wrap, MTEX_TUBE, MTEX_SPHERE)) {
 			/* exception: the seam behind (y<0.0) */
 			ok= 1;
-			if(t[1]<=0.0f) {
+			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);
-				else if(fx<=0.0f && fy<=0.0f && t[0]<=0.0f);
+				if (fx>=0.0f && fy>=0.0f && t[0]>=0.0f);
+				else if (fx<=0.0f && fy<=0.0f && t[0]<=0.0f);
 				else ok= 0;
 			}
-			if(ok) {
-				if(wrap==MTEX_TUBE) {
+			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]);
@@ -1048,7 +1053,7 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d
 				areaflag= 1;
 			}
 			else {
-				if(wrap==MTEX_TUBE) map_to_tube( &fx, &fy,t[0], t[1], t[2]);
+				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]);
 				dxt[0]/= 2.0f;
 				dxt[1]/= 2.0f;
@@ -1058,15 +1063,15 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d
 		}
 		else {
 
-			if(texco==TEXCO_OBJECT) proj = cubemap_ob(ob, n, t[0], t[1], t[2], &fx, &fy);
+			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(proj==1) {
+			if (proj==1) {
 				SWAP(float, dxt[1], dxt[2]);
 				SWAP(float, dyt[1], dyt[2]);
 			}
-			else if(proj==2) {
+			else if (proj==2) {
 				float f1= dxt[0], f2= dyt[0];
 				dxt[0]= dxt[1];
 				dyt[0]= dyt[1];
@@ -1087,7 +1092,7 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d
 		}
 		
 		/* if area, then reacalculate dxt[] and dyt[] */
-		if(areaflag) {
+		if (areaflag) {
 			fx= area[0]; 
 			fy= area[1];
 			dxt[0]= area[2]-fx;
@@ -1097,19 +1102,19 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d
 		}
 		
 		/* repeat */
-		if(tex->extend==TEX_REPEAT) {
+		if (tex->extend==TEX_REPEAT) {
 			float max= 1.0f;
-			if(tex->xrepeat>1) {
+			if (tex->xrepeat>1) {
 				float origf= fx *= tex->xrepeat;
 				
 				// TXF: omit mirror here, see comments in do_material_tex() after do_2d_mapping() call
 				if (tex->texfilter == TXF_BOX) {
-					if(fx>1.0f) fx -= (int)(fx);
-					else if(fx<0.0f) fx+= 1-(int)(fx);
+					if (fx>1.0f) fx -= (int)(fx);
+					else if (fx<0.0f) fx+= 1-(int)(fx);
 				
-					if(tex->flag & TEX_REPEAT_XMIR) {
+					if (tex->flag & TEX_REPEAT_XMIR) {
 						int orig= (int)floor(origf);
-						if(orig & 1) 
+						if (orig & 1)
 							fx= 1.0f-fx;
 					}
 				}
@@ -1119,41 +1124,41 @@ static void do_2d_mapping(MTex *mtex, float *t, VlakRen *vlr, float *n, float *d
 				dxt[0]*= tex->xrepeat;
 				dyt[0]*= tex->xrepeat;
 			}
-			if(tex->yrepeat>1) {
+			if (tex->yrepeat>1) {
 				float origf= fy *= tex->yrepeat;
 				
 				// TXF: omit mirror here, see comments in do_material_tex() after do_2d_mapping() call
 				if (tex->texfilter == TXF_BOX) {
-					if(fy>1.0f) fy -= (int)(fy);
-					else if(fy<0.0f) fy+= 1-(int)(fy);
+					if (fy>1.0f) fy -= (int)(fy);
+					else if (fy<0.0f) fy+= 1-(int)(fy);
 				
-					if(tex->flag & TEX_REPEAT_YMIR) {
+					if (tex->flag & TEX_REPEAT_YMIR) {
 						int orig= (int)floor(origf);
-						if(orig & 1) 
+						if (orig & 1)
 							fy= 1.0f-fy;
 					}
 				}
 				
-				if(max<tex->yrepeat)
+				if (max<tex->yrepeat)
 					max= tex->yrepeat;
 
 				dxt[1]*= tex->yrepeat;
 				dyt[1]*= tex->yrepeat;
 			}
-			if(max!=1.0f) {
+			if (max!=1.0f) {
 				dxt[2]*= max;
 				dyt[2]*= max;
 			}
 			
 		}
 		/* crop */
-		if(tex->cropxmin!=0.0f || tex->cropxmax!=1.0f) {
+		if (tex->cropxmin!=0.0f || tex->cropxmax!=1.0f) {
 			fac1= tex->cropxmax - tex->cropxmin;
 			fx= tex->cropxmin+ fx*fac1;
 			dxt[0]*= fac1;
 			dyt[0]*= fac1;
 		}
-		if(tex->cropymin!=0.0f || tex->cropymax!=1.0f) {
+		if (tex->cropymin!=0.0f || tex->cropymax!=1.0f) {
 			fac1= tex->cropymax - tex->cropymin;
 			fy= tex->cropymin+ fy*fac1;
 			dxt[1]*= fac1;
@@ -1175,7 +1180,7 @@ static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex,
 
 	texres->talpha= 0;	/* is set when image texture returns alpha (considered premul) */
 	
-	if(tex->use_nodes && tex->nodetree) {
+	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);
 	}
@@ -1207,7 +1212,7 @@ static int multitex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex,
 		retval= texnoise(tex, texres); 
 		break;
 	case TEX_IMAGE:
-		if(osatex) retval= imagewraposa(tex, tex->ima, NULL, texvec, dxt, dyt, texres);
+		if (osatex) retval= imagewraposa(tex, tex->ima, NULL, texvec, dxt, dyt, texres);
 		else retval= imagewrap(tex, tex->ima, NULL, texvec, texres); 
 		tag_image_time(tex->ima); /* tag image as having being used */
 		break;
@@ -1287,27 +1292,27 @@ 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)
 {
-	if(tex==NULL) {
+	if (tex==NULL) {
 		memset(texres, 0, sizeof(TexResult));
 		return 0;
 	}
 
-	if(mtex)
+	if (mtex)
 		which_output= mtex->which_output;
 	
-	if(tex->type==TEX_IMAGE) {
+	if (tex->type==TEX_IMAGE) {
 		int rgbnor;
 
-		if(mtex) {
+		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);
 
-			if(mtex->mapto & (MAP_COL+MAP_COLSPEC+MAP_COLMIR)) {
+			if (mtex->mapto & (MAP_COL+MAP_COLSPEC+MAP_COLMIR)) {
 				ImBuf *ibuf = BKE_image_get_ibuf(tex->ima, &tex->iuser);
 				
 				/* don't linearize float buffers, assumed to be linear */
-				if(ibuf && !(ibuf->rect_float) && R.r.color_mgt_flag & R_COLOR_MANAGEMENT)
+				if (ibuf && !(ibuf->rect_float) && R.r.color_mgt_flag & R_COLOR_MANAGEMENT)
 					srgb_to_linearrgb_v3_v3(&texres->tr, &texres->tr);
 			}
 		}
@@ -1322,7 +1327,7 @@ int multitex_nodes(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex,
 			localmtex.texco= TEXCO_ORCO;
 			
 			copy_v3_v3(texvec_l, texvec);
-			if(dxt && dyt) {
+			if (dxt && dyt) {
 				copy_v3_v3(dxt_l, dxt);
 				copy_v3_v3(dyt_l, dyt);
 			}
@@ -1346,9 +1351,9 @@ int multitex_mtex(ShadeInput *shi, MTex *mtex, float *texvec, float *dxt, float
 {
 	Tex *tex= mtex->tex;
 
-	if(tex->use_nodes && tex->nodetree) {
+	if (tex->use_nodes && tex->nodetree) {
 		/* stupid exception here .. but we have to pass shi and mtex to
-		   textures nodes for 2d mapping and color management for images */
+		 * textures nodes for 2d mapping and color management for images */
 		return ntreeTexExecTree(tex->nodetree, texres, texvec, dxt, dyt, shi->osatex, shi->thread,
 			tex, mtex->which_output, R.r.cfra, (R.r.scemode & R_TEXNODE_PREVIEW) != 0, shi, mtex);
 	}
@@ -1414,15 +1419,15 @@ void texture_rgb_blend(float in[3], const float tex[3], const float out[3], floa
 		fact*= facg;
 		facm= 1.0f-facg;
 		
-		if(out[0] < 0.5f)
+		if (out[0] < 0.5f)
 			in[0] = out[0] * (facm + 2.0f*fact*tex[0]);
 		else
 			in[0] = 1.0f - (facm + 2.0f*fact*(1.0f - tex[0])) * (1.0f - out[0]);
-		if(out[1] < 0.5f)
+		if (out[1] < 0.5f)
 			in[1] = out[1] * (facm + 2.0f*fact*tex[1]);
 		else
 			in[1] = 1.0f - (facm + 2.0f*fact*(1.0f - tex[1])) * (1.0f - out[1]);
-		if(out[2] < 0.5f)
+		if (out[2] < 0.5f)
 			in[2] = out[2] * (facm + 2.0f*fact*tex[2]);
 		else
 			in[2] = 1.0f - (facm + 2.0f*fact*(1.0f - tex[2])) * (1.0f - out[2]);
@@ -1441,11 +1446,11 @@ void texture_rgb_blend(float in[3], const float tex[3], const float out[3], floa
 		fact*= facg;
 		facm= 1.0f-fact;
 		
-		if(tex[0]!=0.0f)
+		if (tex[0]!=0.0f)
 			in[0]= facm*out[0] + fact*out[0]/tex[0];
-		if(tex[1]!=0.0f)
+		if (tex[1]!=0.0f)
 			in[1]= facm*out[1] + fact*out[1]/tex[1];
-		if(tex[2]!=0.0f)
+		if (tex[2]!=0.0f)
 			in[2]= facm*out[2] + fact*out[2]/tex[2];
 
 		break;
@@ -1463,22 +1468,22 @@ void texture_rgb_blend(float in[3], const float tex[3], const float out[3], floa
 		facm= 1.0f-fact;
 		
 		col= tex[0]+((1-tex[0])*facm);
-		if(col < out[0]) in[0]= col; else in[0]= out[0];
+		if (col < out[0]) in[0]= col; else in[0]= out[0];
 		col= tex[1]+((1-tex[1])*facm);
-		if(col < out[1]) in[1]= col; else in[1]= out[1];
+		if (col < out[1]) in[1]= col; else in[1]= out[1];
 		col= tex[2]+((1-tex[2])*facm);
-		if(col < out[2]) in[2]= col; else in[2]= out[2];
+		if (col < out[2]) in[2]= col; else in[2]= out[2];
 		break;
 
 	case MTEX_LIGHT:
 		fact*= facg;
 		
 		col= fact*tex[0];
-		if(col > out[0]) in[0]= col; else in[0]= out[0];
+		if (col > out[0]) in[0]= col; else in[0]= out[0];
 		col= fact*tex[1];
-		if(col > out[1]) in[1]= col; else in[1]= out[1];
+		if (col > out[1]) in[1]= col; else in[1]= out[1];
 		col= fact*tex[2];
-		if(col > out[2]) in[2]= col; else in[2]= out[2];
+		if (col > out[2]) in[2]= col; else in[2]= out[2];
 		break;
 		
 	case MTEX_BLEND_HUE:
@@ -1523,7 +1528,7 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen
 	
 	fact*= facg;
 	facm= 1.0f-fact;
-	if(flip) SWAP(float, fact, facm);
+	if (flip) SWAP(float, fact, facm);
 
 	switch(blendtype) {
 	case MTEX_BLEND:
@@ -1542,7 +1547,7 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen
 
 	case MTEX_OVERLAY:
 		facm= 1.0f-facg;
-		if(out < 0.5f)
+		if (out < 0.5f)
 			in = out * (facm + 2.0f*fact*tex);
 		else
 			in = 1.0f - (facm + 2.0f*fact*(1.0f - tex)) * (1.0f - out);
@@ -1555,7 +1560,7 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen
 		break;
 
 	case MTEX_DIV:
-		if(tex!=0.0f)
+		if (tex!=0.0f)
 			in= facm*out + fact*out/tex;
 		break;
 
@@ -1565,12 +1570,12 @@ float texture_value_blend(float tex, float out, float fact, float facg, int blen
 
 	case MTEX_DARK:
 		col= fact*tex;
-		if(col < out) in= col; else in= out;
+		if (col < out) in= col; else in= out;
 		break;
 
 	case MTEX_LIGHT:
 		col= fact*tex;
-		if(col > out) in= col; else in= out;
+		if (col > out) in= col; else in= out;
 		break;
 
 	case MTEX_SOFT_LIGHT: 
@@ -1642,7 +1647,7 @@ static void texco_mapping(ShadeInput* shi, Tex* tex, MTex* mtex, float* co, floa
 			}
 		}
 		if (tex->extend == TEX_REPEAT && (tex->flag & TEX_REPEAT_YMIR)) {
-			if  (tex->texfilter == TXF_BOX)
+			if (tex->texfilter == TXF_BOX)
 				texvec[1] -= floorf(texvec[1]);
 			else if (texvec[1] < 0.f || texvec[1] > 1.f) {
 				const float ty = 0.5f*texvec[1];
@@ -1702,14 +1707,14 @@ static void compatible_bump_uv_derivs(CompatibleBump *compat_bump, ShadeInput *s
 	// NOTE: test for shi->obr->ob here, since vlr/obr/obi can be 'fake' when called from fastshade(), another reason to move it..
 	// NOTE: shi->v1 is NULL when called from displace_render_vert, assigning verts in this case is not trivial because the shi quad face side is not know.
 	if ((mtex->texflag & MTEX_COMPAT_BUMP) && shi->obr && shi->obr->ob && shi->v1) {
-		if(mtex->mapto & (MAP_NORM|MAP_WARP) && !((mtex->tex->type==TEX_IMAGE) && (mtex->tex->imaflag & TEX_NORMALMAP))) {
+		if (mtex->mapto & (MAP_NORM|MAP_WARP) && !((mtex->tex->type==TEX_IMAGE) && (mtex->tex->imaflag & TEX_NORMALMAP))) {
 			MTFace* tf = RE_vlakren_get_tface(shi->obr, shi->vlr, i, NULL, 0);
 			int j1 = shi->i1, j2 = shi->i2, j3 = shi->i3;
 
 			vlr_set_uv_indices(shi->vlr, &j1, &j2, &j3);
 
 			// compute ortho basis around normal
-			if(!compat_bump->nunvdone) {
+			if (!compat_bump->nunvdone) {
 				// render normal is negated
 				compat_bump->nn[0] = -shi->vn[0];
 				compat_bump->nn[1] = -shi->vn[1];
@@ -1763,7 +1768,7 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi,
 	du = dv = 0.01f;
 
 	// compute ortho basis around normal
-	if(!compat_bump->nunvdone) {
+	if (!compat_bump->nunvdone) {
 		// render normal is negated
 		negate_v3_v3(compat_bump->nn, shi->vn);
 		ortho_basis_v3v3_v3(compat_bump->nu, compat_bump->nv, compat_bump->nn);
@@ -1932,15 +1937,16 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
 	float *nvec = texres->nor;
 	texres->nor = NULL;
 
-	if(found_deriv_map==0) {
-		if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) {
-			if(tex->ima)
+	if (found_deriv_map==0) {
+		if ( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) {
+			if (tex->ima)
 				Hscale *= 13.0f; // appears to be a sensible default value
-		} else
+		}
+		else
 			Hscale *= 0.1f; // factor 0.1 proved to look like the previous bump code
 	}
 
-	if( !ntap_bump->init_done ) {
+	if ( !ntap_bump->init_done ) {
 		copy_v3_v3(ntap_bump->vNacc, shi->vn);
 		copy_v3_v3(ntap_bump->vNorg, shi->vn);
 		ntap_bump->fPrevMagnitude = 1.0f;
@@ -1950,7 +1956,7 @@ 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) {
+	if (found_deriv_map || (mtex->texflag&MTEX_BUMP_TEXTURESPACE)!=0) {
 		ImBuf* ibuf = BKE_image_get_ibuf(tex->ima, &tex->iuser);
 		if (ibuf) {
 			dimx = ibuf->x;
@@ -1959,16 +1965,16 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
 		}
 	}
 	
-	if(found_deriv_map) {
+	if (found_deriv_map) {
 		float dBdu, dBdv, auto_bump = 1.0f;
 		float s = 1;		// negate this if flipped texture coordinate
 		texco_mapping(shi, tex, mtex, co, dx, dy, texvec, dxt, dyt);
 		rgbnor = multitex_mtex(shi, mtex, texvec, dxt, dyt, texres);
 
-		if(shi->obr->ob->derivedFinal)
-		{
+		if (shi->obr->ob->derivedFinal) {
 			auto_bump = shi->obr->ob->derivedFinal->auto_bump_scale;
 		}
+
 		{
 			float fVirtDim = sqrtf(fabsf((float) (dimx*dimy)*mtex->size[0]*mtex->size[1]));
 			auto_bump /= MAX2(fVirtDim, FLT_EPSILON);
@@ -1982,14 +1988,14 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
 		dHdx = dBdu*dxt[0] + s * dBdv*dxt[1];
 		dHdy = dBdu*dyt[0] + s * dBdv*dyt[1];
 	}
-	else if(!(mtex->texflag & MTEX_5TAP_BUMP)) {
+	else if (!(mtex->texflag & MTEX_5TAP_BUMP)) {
 		// compute height derivatives with respect to output image pixel coordinates x and y
 		float STll[3], STlr[3], STul[3];
 		float Hll, Hlr, Hul;
 
 		texco_mapping(shi, tex, mtex, co, dx, dy, texvec, dxt, dyt);
 
-		for(c=0; c<nr_channels; c++) {
+		for (c=0; c<nr_channels; c++) {
 			// dx contains the derivatives (du/dx, dv/dx)
 			// dy contains the derivatives (du/dy, dv/dy)
 			STll[c] = texvec[c];
@@ -1998,7 +2004,7 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
 		}
 
 		// clear unused derivatives
-		for(c=nr_channels; c<3; c++) {
+		for (c=nr_channels; c<3; c++) {
 			STll[c] = 0.0f;
 			STlr[c] = 0.0f;
 			STul[c] = 0.0f;
@@ -2025,7 +2031,7 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
 
 		texco_mapping(shi, tex, mtex, co, dx, dy, texvec, dxt, dyt);
 
-		for(c=0; c<nr_channels; c++) {
+		for (c=0; c<nr_channels; c++) {
 			STc[c] = texvec[c];
 			STl[c] = texvec[c] - 0.5f*dxt[c];
 			STr[c] = texvec[c] + 0.5f*dxt[c];
@@ -2034,7 +2040,7 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
 		}
 
 		// clear unused derivatives
-		for(c=nr_channels; c<3; c++) {
+		for (c=nr_channels; c<3; c++) {
 			STc[c] = 0.0f;
 			STl[c] = 0.0f;
 			STr[c] = 0.0f;
@@ -2064,17 +2070,17 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
 	texres->nor = nvec;
 
 	/* replaced newbump with code based on listing 1 and 2 of
-		[Mik10] Mikkelsen M. S.: Bump Mapping Unparametrized Surfaces on the GPU.
-		-> http://jbit.net/~sparky/sfgrad_bump/mm_sfgrad_bump.pdf */
+	 * [Mik10] Mikkelsen M. S.: Bump Mapping Unparametrized Surfaces on the GPU.
+	 * -> http://jbit.net/~sparky/sfgrad_bump/mm_sfgrad_bump.pdf */
 
-	if( mtex->texflag & MTEX_BUMP_OBJECTSPACE )
+	if ( mtex->texflag & MTEX_BUMP_OBJECTSPACE )
 		iBumpSpace = 1;
-	else if( mtex->texflag & MTEX_BUMP_TEXTURESPACE )
+	else if ( mtex->texflag & MTEX_BUMP_TEXTURESPACE )
 		iBumpSpace = 2;
 	else
 		iBumpSpace = 4; // ViewSpace
 	
-	if( ntap_bump->iPrevBumpSpace != iBumpSpace ) {
+	if ( ntap_bump->iPrevBumpSpace != iBumpSpace ) {
 		
 		// initialize normal perturbation vectors
 		int xyz;
@@ -2087,7 +2093,7 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
 		copy_v3_v3(dPdy, shi->dyco);
 		copy_v3_v3(vN, ntap_bump->vNorg);
 		
-		if( mtex->texflag & MTEX_BUMP_OBJECTSPACE ) {
+		if ( mtex->texflag & MTEX_BUMP_OBJECTSPACE ) {
 			// TODO: these calculations happen for every pixel!
 			//	-> move to shi->obi
 			mult_m4_m4m4(tmp, R.viewmat, shi->obr->ob->obmat);
@@ -2108,8 +2114,8 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
 		ntap_bump->sgn_det = (fDet < 0)? -1.0f: 1.0f;
 		abs_fDet = ntap_bump->sgn_det * fDet;
 
-		if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) {
-			if(tex->ima) {
+		if ( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) {
+			if (tex->ima) {
 				// crazy hack solution that gives results similar to normal mapping - part 1
 				normalize_v3(ntap_bump->vR1);
 				normalize_v3(ntap_bump->vR2);
@@ -2118,7 +2124,7 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
 		}
 		
 		fMagnitude = abs_fDet;
-		if( mtex->texflag & MTEX_BUMP_OBJECTSPACE ) {
+		if ( mtex->texflag & MTEX_BUMP_OBJECTSPACE ) {
 			// pre do transform of texres->nor by the inverse transposed of obj2view
 			mul_transposed_m3_v3( view2obj, vN );
 			mul_transposed_m3_v3( view2obj, ntap_bump->vR1 );
@@ -2127,16 +2133,16 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
 			fMagnitude *= len_v3(vN);
 		}
 		
-		if(ntap_bump->fPrevMagnitude > 0.0f)
-			for(xyz=0; xyz<3; xyz++)
+		if (ntap_bump->fPrevMagnitude > 0.0f)
+			for (xyz=0; xyz<3; xyz++)
 				ntap_bump->vNacc[xyz] *= fMagnitude / ntap_bump->fPrevMagnitude;
 		
 		ntap_bump->fPrevMagnitude = fMagnitude;
 		ntap_bump->iPrevBumpSpace = iBumpSpace;
 	}
 
-	if( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) {
-		if(tex->ima) {
+	if ( mtex->texflag & MTEX_BUMP_TEXTURESPACE ) {
+		if (tex->ima) {
 			// crazy hack solution that gives results similar to normal mapping - part 2
 			float vec[2];
 			const float imag_tspace_dimension_y = aspect*imag_tspace_dimension_x;
@@ -2151,7 +2157,7 @@ static int ntap_bump_compute(NTapBump *ntap_bump, ShadeInput *shi, MTex *mtex, T
 	}
 	
 	// subtract the surface gradient from vNacc
-	for(c=0; c<3; c++) {
+	for (c=0; c<3; c++) {
 		float vSurfGrad_compi = ntap_bump->sgn_det * (dHdx * ntap_bump->vR1[c] + dHdy * ntap_bump->vR2[c]);
 		ntap_bump->vNacc[c] -= vSurfGrad_compi;
 		texres->nor[c] = ntap_bump->vNacc[c]; // copy
@@ -2182,42 +2188,42 @@ void do_material_tex(ShadeInput *shi, Render *re)
 	if (re->r.scemode & R_NO_TEX) return;
 	/* here: test flag if there's a tex (todo) */
 
-	for(tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
+	for (tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
 		
 		/* separate tex switching */
-		if(shi->mat->septex & (1<<tex_nr)) continue;
+		if (shi->mat->septex & (1<<tex_nr)) continue;
 		
-		if(shi->mat->mtex[tex_nr]) {
+		if (shi->mat->mtex[tex_nr]) {
 			mtex= shi->mat->mtex[tex_nr];
 			
 			tex= mtex->tex;
-			if(tex==0) continue;
+			if (tex==0) continue;
 
 			found_deriv_map = (tex->type==TEX_IMAGE) && (tex->imaflag & TEX_DERIVATIVEMAP);
 			use_compat_bump= (mtex->texflag & MTEX_COMPAT_BUMP);
 			use_ntap_bump= ((mtex->texflag & (MTEX_3TAP_BUMP|MTEX_5TAP_BUMP|MTEX_BICUBIC_BUMP))!=0 || found_deriv_map!=0) ? 1 : 0;
 
 			/* XXX texture node trees don't work for this yet */
-			if(tex->nodetree && tex->use_nodes) {
+			if (tex->nodetree && tex->use_nodes) {
 				use_compat_bump = 0;
 				use_ntap_bump = 0;
 			}
 			
 			/* case displacement mapping */
-			if(shi->osatex==0 && use_ntap_bump) {
+			if (shi->osatex==0 && use_ntap_bump) {
 				use_ntap_bump = 0;
 				use_compat_bump = 1;
 			}
 			
 			/* case ocean */
-			if(tex->type == TEX_OCEAN) {
+			if (tex->type == TEX_OCEAN) {
 				use_ntap_bump = 0;
 				use_compat_bump = 0;
 			}
 
 			/* which coords */
-			if(mtex->texco==TEXCO_ORCO) {
-				if(mtex->texflag & MTEX_DUPLI_MAPTO) {
+			if (mtex->texco==TEXCO_ORCO) {
+				if (mtex->texflag & MTEX_DUPLI_MAPTO) {
 					co= shi->duplilo; dx= dxt; dy= dyt;
 					dxt[0]= dxt[1]= dxt[2]= 0.0f;
 					dyt[0]= dyt[1]= dyt[2]= 0.0f;
@@ -2226,21 +2232,21 @@ void do_material_tex(ShadeInput *shi, Render *re)
 					co= shi->lo; dx= shi->dxlo; dy= shi->dylo;
 				}
 			}
-			else if(mtex->texco==TEXCO_STICKY) {
+			else if (mtex->texco==TEXCO_STICKY) {
 				co= shi->sticky; dx= shi->dxsticky; dy= shi->dysticky;
 			}
-			else if(mtex->texco==TEXCO_OBJECT) {
+			else if (mtex->texco==TEXCO_OBJECT) {
 				Object *ob= mtex->object;
-				if(ob) {
+				if (ob) {
 					co= tempvec;
 					dx= dxt;
 					dy= dyt;
 					copy_v3_v3(tempvec, shi->co);
-					if(mtex->texflag & MTEX_OB_DUPLI_ORIG)
-						if(shi->obi && shi->obi->duplitexmat)
+					if (mtex->texflag & MTEX_OB_DUPLI_ORIG)
+						if (shi->obi && shi->obi->duplitexmat)
 							mul_m4_v3(shi->obi->duplitexmat, tempvec);
 					mul_m4_v3(ob->imat_ren, tempvec);
-					if(shi->osatex) {
+					if (shi->osatex) {
 						copy_v3_v3(dxt, shi->dxco);
 						copy_v3_v3(dyt, shi->dyco);
 						mul_mat3_m4_v3(ob->imat_ren, dxt);
@@ -2253,21 +2259,21 @@ void do_material_tex(ShadeInput *shi, Render *re)
 					dx= shi->dxco; dy= shi->dyco;
 				}
 			}
-			else if(mtex->texco==TEXCO_REFL) {
+			else if (mtex->texco==TEXCO_REFL) {
 				calc_R_ref(shi);
 				co= shi->ref; dx= shi->dxref; dy= shi->dyref;
 			}
-			else if(mtex->texco==TEXCO_NORM) {
+			else if (mtex->texco==TEXCO_NORM) {
 				co= shi->orn; dx= shi->dxno; dy= shi->dyno;
 			}
-			else if(mtex->texco==TEXCO_TANGENT) {
+			else if (mtex->texco==TEXCO_TANGENT) {
 				co= shi->tang; dx= shi->dxno; dy= shi->dyno;
 			}
-			else if(mtex->texco==TEXCO_GLOB) {
+			else if (mtex->texco==TEXCO_GLOB) {
 				co= shi->gl; dx= shi->dxgl; dy= shi->dygl;
 			}
-			else if(mtex->texco==TEXCO_UV) {
-				if(mtex->texflag & MTEX_DUPLI_MAPTO) {
+			else if (mtex->texco==TEXCO_UV) {
+				if (mtex->texflag & MTEX_DUPLI_MAPTO) {
 					co= shi->dupliuv; dx= dxt; dy= dyt;
 					dxt[0]= dxt[1]= dxt[2]= 0.0f;
 					dyt[0]= dyt[1]= dyt[2]= 0.0f;
@@ -2276,9 +2282,9 @@ void do_material_tex(ShadeInput *shi, Render *re)
 					ShadeInputUV *suv= &shi->uv[shi->actuv];
 					int i = shi->actuv;
 
-					if(mtex->uvname[0] != 0) {
-						for(i = 0; i < shi->totuv; i++) {
-							if(strcmp(shi->uv[i].name, mtex->uvname)==0) {
+					if (mtex->uvname[0] != 0) {
+						for (i = 0; i < shi->totuv; i++) {
+							if (strcmp(shi->uv[i].name, mtex->uvname)==0) {
 								suv= &shi->uv[i];
 								break;
 							}
@@ -2292,10 +2298,10 @@ void do_material_tex(ShadeInput *shi, Render *re)
 					compatible_bump_uv_derivs(&compat_bump, shi, mtex, i);
 				}
 			}
-			else if(mtex->texco==TEXCO_WINDOW) {
+			else if (mtex->texco==TEXCO_WINDOW) {
 				co= shi->winco; dx= shi->dxwin; dy= shi->dywin;
 			}
-			else if(mtex->texco==TEXCO_STRAND) {
+			else if (mtex->texco==TEXCO_STRAND) {
 				co= tempvec; dx= dxt; dy= dyt;
 				co[0]= shi->strandco;
 				co[1]= co[2]= 0.0f;
@@ -2304,7 +2310,7 @@ void do_material_tex(ShadeInput *shi, Render *re)
 				dy[0]= shi->dystrand;
 				dy[1]= dy[2]= 0.0f;
 			}
-			else if(mtex->texco==TEXCO_STRESS) {
+			else if (mtex->texco==TEXCO_STRESS) {
 				co= tempvec; dx= dxt; dy= dyt;
 				co[0]= shi->stress;
 				co[1]= co[2]= 0.0f;
@@ -2316,24 +2322,24 @@ void do_material_tex(ShadeInput *shi, Render *re)
 			else continue;	// can happen when texco defines disappear and it renders old files
 
 			/* the pointer defines if bumping happens */
-			if(mtex->mapto & (MAP_NORM|MAP_WARP)) {
+			if (mtex->mapto & (MAP_NORM|MAP_WARP)) {
 				texres.nor= norvec;
 				norvec[0]= norvec[1]= norvec[2]= 0.0;
 			}
 			else texres.nor= NULL;
 			
-			if(warpdone) {
+			if (warpdone) {
 				add_v3_v3v3(tempvec, co, warpvec);
 				co= tempvec;
 			}
 
 			/* XXX texture node trees don't work for this yet */
-			if(texres.nor && !((tex->type==TEX_IMAGE) && (tex->imaflag & TEX_NORMALMAP))) {
-				if(use_compat_bump) {
+			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);
 				}
-				else if(use_ntap_bump) {
+				else if (use_ntap_bump) {
 					rgbnor = ntap_bump_compute(&ntap_bump, shi, mtex, tex,
 						&texres, Tnor*stencilTin, co, dx, dy, texvec, dxt, dyt);
 				}
@@ -2349,20 +2355,20 @@ void do_material_tex(ShadeInput *shi, Render *re)
 
 			/* texture output */
 
-			if( (rgbnor & TEX_RGB) && (mtex->texflag & MTEX_RGBTOINT)) {
+			if ( (rgbnor & TEX_RGB) && (mtex->texflag & MTEX_RGBTOINT)) {
 				texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
 				rgbnor-= TEX_RGB;
 			}
-			if(mtex->texflag & MTEX_NEGATIVE) {
-				if(rgbnor & TEX_RGB) {
+			if (mtex->texflag & MTEX_NEGATIVE) {
+				if (rgbnor & TEX_RGB) {
 					texres.tr= 1.0f-texres.tr;
 					texres.tg= 1.0f-texres.tg;
 					texres.tb= 1.0f-texres.tb;
 				}
 				texres.tin= 1.0f-texres.tin;
 			}
-			if(mtex->texflag & MTEX_STENCIL) {
-				if(rgbnor & TEX_RGB) {
+			if (mtex->texflag & MTEX_STENCIL) {
+				if (rgbnor & TEX_RGB) {
 					fact= texres.ta;
 					texres.ta*= stencilTin;
 					stencilTin*= fact;
@@ -2377,10 +2383,10 @@ void do_material_tex(ShadeInput *shi, Render *re)
 				Tnor*= stencilTin;
 			}
 			
-			if(texres.nor) {
-				if((rgbnor & TEX_NOR)==0) {
+			if (texres.nor) {
+				if ((rgbnor & TEX_NOR)==0) {
 					/* make our own normal */
-					if(rgbnor & TEX_RGB) {
+					if (rgbnor & TEX_RGB) {
 						texres.nor[0]= texres.tr;
 						texres.nor[1]= texres.tg;
 						texres.nor[2]= texres.tb;
@@ -2400,10 +2406,10 @@ void do_material_tex(ShadeInput *shi, Render *re)
 					}
 				}
 				// warping, local space
-				if(mtex->mapto & MAP_WARP) {
+				if (mtex->mapto & MAP_WARP) {
 					float *warpnor= texres.nor, warpnor_[3];
 					
-					if(use_ntap_bump) {
+					if (use_ntap_bump) {
 						copy_v3_v3(warpnor_, texres.nor);
 						warpnor= warpnor_;
 						normalize_v3(warpnor_);
@@ -2414,10 +2420,10 @@ void do_material_tex(ShadeInput *shi, Render *re)
 					warpdone= 1;
 				}
 #if 0				
-				if(mtex->texflag & MTEX_VIEWSPACE) {
+				if (mtex->texflag & MTEX_VIEWSPACE) {
 					// rotate to global coords
-					if(mtex->texco==TEXCO_ORCO || mtex->texco==TEXCO_UV) {
-						if(shi->vlr && shi->obr && shi->obr->ob) {
+					if (mtex->texco==TEXCO_ORCO || mtex->texco==TEXCO_UV) {
+						if (shi->vlr && shi->obr && shi->obr->ob) {
 							float len= normalize_v3(texres.nor);
 							// can be optimized... (ton)
 							mul_mat3_m4_v3(shi->obr->ob->obmat, texres.nor);
@@ -2431,19 +2437,19 @@ void do_material_tex(ShadeInput *shi, Render *re)
 			}
 
 			/* mapping */
-			if(mtex->mapto & (MAP_COL+MAP_COLSPEC+MAP_COLMIR)) {
+			if (mtex->mapto & (MAP_COL+MAP_COLSPEC+MAP_COLMIR)) {
 				float tcol[3];
 				
 				/* stencil maps on the texture control slider, not texture intensity value */
 				
 				tcol[0]=texres.tr; tcol[1]=texres.tg; tcol[2]=texres.tb;
 				
-				if((rgbnor & TEX_RGB)==0) {
+				if ((rgbnor & TEX_RGB)==0) {
 					tcol[0]= mtex->r;
 					tcol[1]= mtex->g;
 					tcol[2]= mtex->b;
 				}
-				else if(mtex->mapto & MAP_ALPHA) {
+				else if (mtex->mapto & MAP_ALPHA) {
 					texres.tin= stencilTin;
 				}
 				else texres.tin= texres.ta;
@@ -2458,19 +2464,19 @@ void do_material_tex(ShadeInput *shi, Render *re)
 						srgb_to_linearrgb_v3_v3(tcol, tcol);
 				}
 				
-				if(mtex->mapto & MAP_COL) {
+				if (mtex->mapto & MAP_COL) {
 					float colfac= mtex->colfac*stencilTin;
 					texture_rgb_blend(&shi->r, tcol, &shi->r, texres.tin, colfac, mtex->blendtype);
 				}
-				if(mtex->mapto & MAP_COLSPEC) {
+				if (mtex->mapto & MAP_COLSPEC) {
 					float colspecfac= mtex->colspecfac*stencilTin;
 					texture_rgb_blend(&shi->specr, tcol, &shi->specr, texres.tin, colspecfac, mtex->blendtype);
 				}
-				if(mtex->mapto & MAP_COLMIR) {
+				if (mtex->mapto & MAP_COLMIR) {
 					float mirrfac= mtex->mirrfac*stencilTin;
 
 					// exception for envmap only
-					if(tex->type==TEX_ENVMAP && mtex->blendtype==MTEX_BLEND) {
+					if (tex->type==TEX_ENVMAP && mtex->blendtype==MTEX_BLEND) {
 						fact= texres.tin*mirrfac;
 						facm= 1.0f- fact;
 						shi->refcol[0]= fact + facm*shi->refcol[0];
@@ -2483,8 +2489,8 @@ void do_material_tex(ShadeInput *shi, Render *re)
 					}
 				}
 			}
-			if( (mtex->mapto & MAP_NORM) ) {
-				if(texres.nor) {
+			if ( (mtex->mapto & MAP_NORM) ) {
+				if (texres.nor) {
 					float norfac= mtex->norfac;
 					
 					/* we need to code blending modes for normals too once.. now 1 exception hardcoded */
@@ -2494,7 +2500,7 @@ void do_material_tex(ShadeInput *shi, Render *re)
 						found_nmapping = 1;
 						
 						/* qdn: for normalmaps, to invert the normalmap vector,
-						   it is better to negate x & y instead of subtracting the vector as was done before */
+						 * it is better to negate x & y instead of subtracting the vector as was done before */
 						if (norfac < 0.0f) {
 							texres.nor[0] = -texres.nor[0];
 							texres.nor[1] = -texres.nor[1];
@@ -2502,7 +2508,7 @@ void do_material_tex(ShadeInput *shi, Render *re)
 						fact = Tnor*fabsf(norfac);
 						if (fact>1.f) fact = 1.f;
 						facm = 1.f-fact;
-						if(mtex->normapspace == MTEX_NSPACE_TANGENT) {
+						if (mtex->normapspace == MTEX_NSPACE_TANGENT) {
 							/* qdn: tangent space */
 							float B[3], tv[3];
 							const float * no = iFirstTimeNMap!=0 ? shi->nmapnorm : shi->vn;
@@ -2522,12 +2528,12 @@ void do_material_tex(ShadeInput *shi, Render *re)
 
 							copy_v3_v3(nor, texres.nor);
 
-							if(mtex->normapspace == MTEX_NSPACE_CAMERA);
-							else if(mtex->normapspace == MTEX_NSPACE_WORLD) {
+							if (mtex->normapspace == MTEX_NSPACE_CAMERA);
+							else if (mtex->normapspace == MTEX_NSPACE_WORLD) {
 								mul_mat3_m4_v3(re->viewmat, nor);
 							}
-							else if(mtex->normapspace == MTEX_NSPACE_OBJECT) {
-								if(shi->obr && shi->obr->ob)
+							else if (mtex->normapspace == MTEX_NSPACE_OBJECT) {
+								if (shi->obr && shi->obr->ob)
 									mul_mat3_m4_v3(shi->obr->ob->obmat, nor);
 								mul_mat3_m4_v3(re->viewmat, nor);
 							}
@@ -2550,7 +2556,7 @@ void do_material_tex(ShadeInput *shi, Render *re)
 						else {
 							float nor[3], dot;
 	
-							if(shi->mat->mode & MA_TANGENT_V) {
+							if (shi->mat->mode & MA_TANGENT_V) {
 								shi->tang[0]+= Tnor*norfac*texres.nor[0];
 								shi->tang[1]+= Tnor*norfac*texres.nor[1];
 								shi->tang[2]+= Tnor*norfac*texres.nor[2];
@@ -2577,10 +2583,10 @@ void do_material_tex(ShadeInput *shi, Render *re)
 				}
 			}
 
-			if( mtex->mapto & MAP_DISPLACE ) {
+			if ( mtex->mapto & MAP_DISPLACE ) {
 				/* Now that most textures offer both Nor and Intensity, allow  */
 				/* both to work, and let user select with slider.   */
-				if(texres.nor) {
+				if (texres.nor) {
 					float norfac= mtex->norfac;
 
 					shi->displace[0]+= 0.2f*Tnor*norfac*texres.nor[0];
@@ -2588,94 +2594,94 @@ void do_material_tex(ShadeInput *shi, Render *re)
 					shi->displace[2]+= 0.2f*Tnor*norfac*texres.nor[2];
 				}
 				
-				if(rgbnor & TEX_RGB) {
+				if (rgbnor & TEX_RGB) {
 					texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
 				}
 
 				factt= (0.5f-texres.tin)*mtex->dispfac*stencilTin; facmm= 1.0f-factt;
 
-				if(mtex->blendtype==MTEX_BLEND) {
+				if (mtex->blendtype==MTEX_BLEND) {
 					shi->displace[0]= factt*shi->vn[0] + facmm*shi->displace[0];
 					shi->displace[1]= factt*shi->vn[1] + facmm*shi->displace[1];
 					shi->displace[2]= factt*shi->vn[2] + facmm*shi->displace[2];
 				}
-				else if(mtex->blendtype==MTEX_MUL) {
+				else if (mtex->blendtype==MTEX_MUL) {
 					shi->displace[0]*= factt*shi->vn[0];
 					shi->displace[1]*= factt*shi->vn[1];
 					shi->displace[2]*= factt*shi->vn[2];
 				}
 				else { /* add or sub */
-					if(mtex->blendtype==MTEX_SUB) factt= -factt;
+					if (mtex->blendtype==MTEX_SUB) factt= -factt;
 					shi->displace[0]+= factt*shi->vn[0];
 					shi->displace[1]+= factt*shi->vn[1];
 					shi->displace[2]+= factt*shi->vn[2];
 				}
 			}
 
-			if(mtex->mapto & MAP_VARS) {
+			if (mtex->mapto & MAP_VARS) {
 				/* stencil maps on the texture control slider, not texture intensity value */
 				
-				if(rgbnor & TEX_RGB) {
-					if(texres.talpha) texres.tin= texres.ta;
+				if (rgbnor & TEX_RGB) {
+					if (texres.talpha) texres.tin= texres.ta;
 					else texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
 				}
 
-				if(mtex->mapto & MAP_REF) {
+				if (mtex->mapto & MAP_REF) {
 					float difffac= mtex->difffac*stencilTin;
 
 					shi->refl= texture_value_blend(mtex->def_var, shi->refl, texres.tin, difffac, mtex->blendtype);
-					if(shi->refl<0.0f) shi->refl= 0.0f;
+					if (shi->refl<0.0f) shi->refl= 0.0f;
 				}
-				if(mtex->mapto & MAP_SPEC) {
+				if (mtex->mapto & MAP_SPEC) {
 					float specfac= mtex->specfac*stencilTin;
 					
 					shi->spec= texture_value_blend(mtex->def_var, shi->spec, texres.tin, specfac, mtex->blendtype);
-					if(shi->spec<0.0f) shi->spec= 0.0f;
+					if (shi->spec<0.0f) shi->spec= 0.0f;
 				}
-				if(mtex->mapto & MAP_EMIT) {
+				if (mtex->mapto & MAP_EMIT) {
 					float emitfac= mtex->emitfac*stencilTin;
 
 					shi->emit= texture_value_blend(mtex->def_var, shi->emit, texres.tin, emitfac, mtex->blendtype);
-					if(shi->emit<0.0f) shi->emit= 0.0f;
+					if (shi->emit<0.0f) shi->emit= 0.0f;
 				}
-				if(mtex->mapto & MAP_ALPHA) {
+				if (mtex->mapto & MAP_ALPHA) {
 					float alphafac= mtex->alphafac*stencilTin;
 
 					shi->alpha= texture_value_blend(mtex->def_var, shi->alpha, texres.tin, alphafac, mtex->blendtype);
-					if(shi->alpha<0.0f) shi->alpha= 0.0f;
-					else if(shi->alpha>1.0f) shi->alpha= 1.0f;
+					if (shi->alpha<0.0f) shi->alpha= 0.0f;
+					else if (shi->alpha>1.0f) shi->alpha= 1.0f;
 				}
-				if(mtex->mapto & MAP_HAR) {
+				if (mtex->mapto & MAP_HAR) {
 					float har;  // have to map to 0-1
 					float hardfac= mtex->hardfac*stencilTin;
 					
 					har= ((float)shi->har)/128.0f;
 					har= 128.0f*texture_value_blend(mtex->def_var, har, texres.tin, hardfac, mtex->blendtype);
 					
-					if(har<1.0f) shi->har= 1;
-					else if(har>511) shi->har= 511;
+					if (har<1.0f) shi->har= 1;
+					else if (har>511) shi->har= 511;
 					else shi->har= (int)har;
 				}
-				if(mtex->mapto & MAP_RAYMIRR) {
+				if (mtex->mapto & MAP_RAYMIRR) {
 					float raymirrfac= mtex->raymirrfac*stencilTin;
 
 					shi->ray_mirror= texture_value_blend(mtex->def_var, shi->ray_mirror, texres.tin, raymirrfac, mtex->blendtype);
-					if(shi->ray_mirror<0.0f) shi->ray_mirror= 0.0f;
-					else if(shi->ray_mirror>1.0f) shi->ray_mirror= 1.0f;
+					if (shi->ray_mirror<0.0f) shi->ray_mirror= 0.0f;
+					else if (shi->ray_mirror>1.0f) shi->ray_mirror= 1.0f;
 				}
-				if(mtex->mapto & MAP_TRANSLU) {
+				if (mtex->mapto & MAP_TRANSLU) {
 					float translfac= mtex->translfac*stencilTin;
 
 					shi->translucency= texture_value_blend(mtex->def_var, shi->translucency, texres.tin, translfac, mtex->blendtype);
-					if(shi->translucency<0.0f) shi->translucency= 0.0f;
-					else if(shi->translucency>1.0f) shi->translucency= 1.0f;
+					if (shi->translucency<0.0f) shi->translucency= 0.0f;
+					else if (shi->translucency>1.0f) shi->translucency= 1.0f;
 				}
-				if(mtex->mapto & MAP_AMB) {
+				if (mtex->mapto & MAP_AMB) {
 					float ambfac= mtex->ambfac*stencilTin;
 
 					shi->amb= texture_value_blend(mtex->def_var, shi->amb, texres.tin, ambfac, mtex->blendtype);
-					if(shi->amb<0.0f) shi->amb= 0.0f;
-					else if(shi->amb>1.0f) shi->amb= 1.0f;
+					if (shi->amb<0.0f) shi->amb= 0.0f;
+					else if (shi->amb>1.0f) shi->amb= 1.0f;
 					
 					shi->ambr= shi->amb*re->wrld.ambr;
 					shi->ambg= shi->amb*re->wrld.ambg;
@@ -2705,35 +2711,35 @@ void do_volume_tex(ShadeInput *shi, const float *xyz, int mapto_flag, float *col
 	if (re->r.scemode & R_NO_TEX) return;
 	/* here: test flag if there's a tex (todo) */
 	
-	for(tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
+	for (tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
 		/* separate tex switching */
-		if(shi->mat->septex & (1<<tex_nr)) continue;
+		if (shi->mat->septex & (1<<tex_nr)) continue;
 		
-		if(shi->mat->mtex[tex_nr]) {
+		if (shi->mat->mtex[tex_nr]) {
 			mtex= shi->mat->mtex[tex_nr];
 			tex= mtex->tex;
-			if(tex==0) continue;
+			if (tex==0) continue;
 			
 			/* only process if this texture is mapped 
 			 * to one that we're interested in */
 			if (!(mtex->mapto & mapto_flag)) continue;
 			
 			/* which coords */
-			if(mtex->texco==TEXCO_OBJECT) { 
+			if (mtex->texco==TEXCO_OBJECT) {
 				Object *ob= mtex->object;
-				if(ob) {						
+				if (ob) {
 					copy_v3_v3(co, xyz);
-					if(mtex->texflag & MTEX_OB_DUPLI_ORIG) {
-						if(shi->obi && shi->obi->duplitexmat)
+					if (mtex->texflag & MTEX_OB_DUPLI_ORIG) {
+						if (shi->obi && shi->obi->duplitexmat)
 							mul_m4_v3(shi->obi->duplitexmat, co);					
 					} 
 					mul_m4_v3(ob->imat_ren, co);
 				}
 			}
 			/* not really orco, but 'local' */
-			else if(mtex->texco==TEXCO_ORCO) {
+			else if (mtex->texco==TEXCO_ORCO) {
 				
-				if(mtex->texflag & MTEX_DUPLI_MAPTO) {
+				if (mtex->texflag & MTEX_DUPLI_MAPTO) {
 					copy_v3_v3(co, shi->duplilo);
 				}
 				else {
@@ -2742,7 +2748,7 @@ void do_volume_tex(ShadeInput *shi, const float *xyz, int mapto_flag, float *col
 					mul_m4_v3(ob->imat_ren, co);
 				}
 			}
-			else if(mtex->texco==TEXCO_GLOB) {
+			else if (mtex->texco==TEXCO_GLOB) {
 				copy_v3_v3(co, xyz);
 				mul_m4_v3(re->viewinv, co);
 			}
@@ -2750,19 +2756,19 @@ void do_volume_tex(ShadeInput *shi, const float *xyz, int mapto_flag, float *col
 
 			texres.nor= NULL;
 			
-			if(tex->type==TEX_IMAGE) {
+			if (tex->type==TEX_IMAGE) {
 				continue;	/* not supported yet */				
 				//do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
 			}
 			else {
 				/* placement */
-				if(mtex->projx) texvec[0]= mtex->size[0]*(co[mtex->projx-1]+mtex->ofs[0]);
+				if (mtex->projx) texvec[0]= mtex->size[0]*(co[mtex->projx-1]+mtex->ofs[0]);
 				else texvec[0]= mtex->size[0]*(mtex->ofs[0]);
 
-				if(mtex->projy) texvec[1]= mtex->size[1]*(co[mtex->projy-1]+mtex->ofs[1]);
+				if (mtex->projy) texvec[1]= mtex->size[1]*(co[mtex->projy-1]+mtex->ofs[1]);
 				else texvec[1]= mtex->size[1]*(mtex->ofs[1]);
 
-				if(mtex->projz) texvec[2]= mtex->size[2]*(co[mtex->projz-1]+mtex->ofs[2]);
+				if (mtex->projz) texvec[2]= mtex->size[2]*(co[mtex->projz-1]+mtex->ofs[2]);
 				else texvec[2]= mtex->size[2]*(mtex->ofs[2]);
 			}
 			
@@ -2770,20 +2776,20 @@ void do_volume_tex(ShadeInput *shi, const float *xyz, int mapto_flag, float *col
 			
 			/* texture output */
 
-			if( (rgbnor & TEX_RGB) && (mtex->texflag & MTEX_RGBTOINT)) {
+			if ( (rgbnor & TEX_RGB) && (mtex->texflag & MTEX_RGBTOINT)) {
 				texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
 				rgbnor-= TEX_RGB;
 			}
-			if(mtex->texflag & MTEX_NEGATIVE) {
-				if(rgbnor & TEX_RGB) {
+			if (mtex->texflag & MTEX_NEGATIVE) {
+				if (rgbnor & TEX_RGB) {
 					texres.tr= 1.0f-texres.tr;
 					texres.tg= 1.0f-texres.tg;
 					texres.tb= 1.0f-texres.tb;
 				}
 				texres.tin= 1.0f-texres.tin;
 			}
-			if(mtex->texflag & MTEX_STENCIL) {
-				if(rgbnor & TEX_RGB) {
+			if (mtex->texflag & MTEX_STENCIL) {
+				if (rgbnor & TEX_RGB) {
 					fact= texres.ta;
 					texres.ta*= stencilTin;
 					stencilTin*= fact;
@@ -2796,70 +2802,71 @@ void do_volume_tex(ShadeInput *shi, const float *xyz, int mapto_flag, float *col
 			}
 			
 			
-			if((mapto_flag & (MAP_EMISSION_COL+MAP_TRANSMISSION_COL+MAP_REFLECTION_COL)) && (mtex->mapto & (MAP_EMISSION_COL+MAP_TRANSMISSION_COL+MAP_REFLECTION_COL))) {
+			if ((mapto_flag & (MAP_EMISSION_COL+MAP_TRANSMISSION_COL+MAP_REFLECTION_COL)) && (mtex->mapto & (MAP_EMISSION_COL+MAP_TRANSMISSION_COL+MAP_REFLECTION_COL))) {
 				float tcol[3];
 				
 				/* stencil maps on the texture control slider, not texture intensity value */
 				
-				if((rgbnor & TEX_RGB)==0) {
+				if ((rgbnor & TEX_RGB)==0) {
 					tcol[0]= mtex->r;
 					tcol[1]= mtex->g;
 					tcol[2]= mtex->b;
-				} else {
+				}
+				else {
 					tcol[0]=texres.tr;
 					tcol[1]=texres.tg;
 					tcol[2]=texres.tb;
-					if(texres.talpha)
+					if (texres.talpha)
 						texres.tin= texres.ta;
 				}
 				
 				/* used for emit */
-				if((mapto_flag & MAP_EMISSION_COL) && (mtex->mapto & MAP_EMISSION_COL)) {
+				if ((mapto_flag & MAP_EMISSION_COL) && (mtex->mapto & MAP_EMISSION_COL)) {
 					float colemitfac= mtex->colemitfac*stencilTin;
 					texture_rgb_blend(col, tcol, col, texres.tin, colemitfac, mtex->blendtype);
 				}
 				
-				if((mapto_flag & MAP_REFLECTION_COL) && (mtex->mapto & MAP_REFLECTION_COL)) {
+				if ((mapto_flag & MAP_REFLECTION_COL) && (mtex->mapto & MAP_REFLECTION_COL)) {
 					float colreflfac= mtex->colreflfac*stencilTin;
 					texture_rgb_blend(col, tcol, col, texres.tin, colreflfac, mtex->blendtype);
 				}
 				
-				if((mapto_flag & MAP_TRANSMISSION_COL) && (mtex->mapto & MAP_TRANSMISSION_COL)) {
+				if ((mapto_flag & MAP_TRANSMISSION_COL) && (mtex->mapto & MAP_TRANSMISSION_COL)) {
 					float coltransfac= mtex->coltransfac*stencilTin;
 					texture_rgb_blend(col, tcol, col, texres.tin, coltransfac, mtex->blendtype);
 				}
 			}
 			
-			if((mapto_flag & MAP_VARS) && (mtex->mapto & MAP_VARS)) {
+			if ((mapto_flag & MAP_VARS) && (mtex->mapto & MAP_VARS)) {
 				/* stencil maps on the texture control slider, not texture intensity value */
 				
 				/* convert RGB to intensity if intensity info isn't provided */
 				if (!(rgbnor & TEX_INT)) {
 					if (rgbnor & TEX_RGB) {
-						if(texres.talpha) texres.tin= texres.ta;
+						if (texres.talpha) texres.tin= texres.ta;
 						else texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
 					}
 				}
 				
-				if((mapto_flag & MAP_EMISSION) && (mtex->mapto & MAP_EMISSION)) {
+				if ((mapto_flag & MAP_EMISSION) && (mtex->mapto & MAP_EMISSION)) {
 					float emitfac= mtex->emitfac*stencilTin;
 
 					*val = texture_value_blend(mtex->def_var, *val, texres.tin, emitfac, mtex->blendtype);
-					if(*val<0.0f) *val= 0.0f;
+					if (*val<0.0f) *val= 0.0f;
 				}
-				if((mapto_flag & MAP_DENSITY) && (mtex->mapto & MAP_DENSITY)) {
+				if ((mapto_flag & MAP_DENSITY) && (mtex->mapto & MAP_DENSITY)) {
 					float densfac= mtex->densfac*stencilTin;
 
 					*val = texture_value_blend(mtex->def_var, *val, texres.tin, densfac, mtex->blendtype);
 					CLAMP(*val, 0.0f, 1.0f);
 				}
-				if((mapto_flag & MAP_SCATTERING) && (mtex->mapto & MAP_SCATTERING)) {
+				if ((mapto_flag & MAP_SCATTERING) && (mtex->mapto & MAP_SCATTERING)) {
 					float scatterfac= mtex->scatterfac*stencilTin;
 					
 					*val = texture_value_blend(mtex->def_var, *val, texres.tin, scatterfac, mtex->blendtype);
 					CLAMP(*val, 0.0f, 1.0f);
 				}
-				if((mapto_flag & MAP_REFLECTION) && (mtex->mapto & MAP_REFLECTION)) {
+				if ((mapto_flag & MAP_REFLECTION) && (mtex->mapto & MAP_REFLECTION)) {
 					float reflfac= mtex->reflfac*stencilTin;
 					
 					*val = texture_value_blend(mtex->def_var, *val, texres.tin, reflfac, mtex->blendtype);
@@ -2883,8 +2890,8 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float col_r[4])
 	if (R.r.scemode & R_NO_TEX) return;
 	
 	mtex= har->mat->mtex[0];
-	if(har->mat->septex & (1<<0)) return;
-	if(mtex->tex==NULL) return;
+	if (har->mat->septex & (1<<0)) return;
+	if (mtex->tex==NULL) return;
 	
 	/* no normal mapping */
 	texres.nor= NULL;
@@ -2896,32 +2903,32 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float col_r[4])
 	osatex= (har->mat->texco & TEXCO_OSA);
 
 	/* placement */
-	if(mtex->projx) texvec[0]= mtex->size[0]*(texvec[mtex->projx-1]+mtex->ofs[0]);
+	if (mtex->projx) texvec[0]= mtex->size[0]*(texvec[mtex->projx-1]+mtex->ofs[0]);
 	else texvec[0]= mtex->size[0]*(mtex->ofs[0]);
 	
-	if(mtex->projy) texvec[1]= mtex->size[1]*(texvec[mtex->projy-1]+mtex->ofs[1]);
+	if (mtex->projy) texvec[1]= mtex->size[1]*(texvec[mtex->projy-1]+mtex->ofs[1]);
 	else texvec[1]= mtex->size[1]*(mtex->ofs[1]);
 	
-	if(mtex->projz) texvec[2]= mtex->size[2]*(texvec[mtex->projz-1]+mtex->ofs[2]);
+	if (mtex->projz) texvec[2]= mtex->size[2]*(texvec[mtex->projz-1]+mtex->ofs[2]);
 	else texvec[2]= mtex->size[2]*(mtex->ofs[2]);
 	
-	if(osatex) {
+	if (osatex) {
 	
 		dx= 1.0f/har->rad;
 	
-		if(mtex->projx) {
+		if (mtex->projx) {
 			dxt[0]= mtex->size[0]*dx;
 			dyt[0]= mtex->size[0]*dx;
 		}
 		else dxt[0]= dyt[0]= 0.0;
 		
-		if(mtex->projy) {
+		if (mtex->projy) {
 			dxt[1]= mtex->size[1]*dx;
 			dyt[1]= mtex->size[1]*dx;
 		}
 		else dxt[1]= dyt[1]= 0.0;
 		
-		if(mtex->projz) {
+		if (mtex->projz) {
 			dxt[2]= 0.0;
 			dyt[2]= 0.0;
 		}
@@ -2929,17 +2936,17 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float col_r[4])
 
 	}
 
-	if(mtex->tex->type==TEX_IMAGE) do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
+	if (mtex->tex->type==TEX_IMAGE) do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
 	
 	rgb= multitex(mtex->tex, texvec, dxt, dyt, osatex, &texres, 0, mtex->which_output);
 
 	/* texture output */
-	if(rgb && (mtex->texflag & MTEX_RGBTOINT)) {
+	if (rgb && (mtex->texflag & MTEX_RGBTOINT)) {
 		texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
 		rgb= 0;
 	}
-	if(mtex->texflag & MTEX_NEGATIVE) {
-		if(rgb) {
+	if (mtex->texflag & MTEX_NEGATIVE) {
+		if (rgb) {
 			texres.tr= 1.0f-texres.tr;
 			texres.tg= 1.0f-texres.tg;
 			texres.tb= 1.0f-texres.tb;
@@ -2948,14 +2955,14 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float col_r[4])
 	}
 
 	/* mapping */
-	if(mtex->mapto & MAP_COL) {
+	if (mtex->mapto & MAP_COL) {
 		
-		if(rgb==0) {
+		if (rgb==0) {
 			texres.tr= mtex->r;
 			texres.tg= mtex->g;
 			texres.tb= mtex->b;
 		}
-		else if(mtex->mapto & MAP_ALPHA) {
+		else if (mtex->mapto & MAP_ALPHA) {
 			texres.tin= 1.0;
 		}
 		else texres.tin= texres.ta;
@@ -2973,18 +2980,18 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float col_r[4])
 		fact= texres.tin*mtex->colfac;
 		facm= 1.0f-fact;
 		
-		if(mtex->blendtype==MTEX_MUL) {
+		if (mtex->blendtype==MTEX_MUL) {
 			facm= 1.0f-mtex->colfac;
 		}
 		
-		if(mtex->blendtype==MTEX_SUB) fact= -fact;
+		if (mtex->blendtype==MTEX_SUB) fact= -fact;
 
-		if(mtex->blendtype==MTEX_BLEND) {
+		if (mtex->blendtype==MTEX_BLEND) {
 			col_r[0]= (fact*texres.tr + facm*har->r);
 			col_r[1]= (fact*texres.tg + facm*har->g);
 			col_r[2]= (fact*texres.tb + facm*har->b);
 		}
-		else if(mtex->blendtype==MTEX_MUL) {
+		else if (mtex->blendtype==MTEX_MUL) {
 			col_r[0]= (facm+fact*texres.tr)*har->r;
 			col_r[1]= (facm+fact*texres.tg)*har->g;
 			col_r[2]= (facm+fact*texres.tb)*har->b;
@@ -2999,9 +3006,9 @@ void do_halo_tex(HaloRen *har, float xn, float yn, float col_r[4])
 			CLAMP(col_r[2], 0.0f, 1.0f);
 		}
 	}
-	if(mtex->mapto & MAP_ALPHA) {
-		if(rgb) {
-			if(texres.talpha) texres.tin= texres.ta;
+	if (mtex->mapto & MAP_ALPHA) {
+		if (rgb) {
+			if (texres.talpha) texres.tin= texres.ta;
 			else texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
 		}
 				
@@ -3025,19 +3032,19 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
 	/* todo: add flag to test if there's a tex */
 	texres.nor= NULL;
 	
-	for(tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
-		if(R.wrld.mtex[tex_nr]) {
+	for (tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
+		if (R.wrld.mtex[tex_nr]) {
 			mtex= R.wrld.mtex[tex_nr];
 			
 			tex= mtex->tex;
-			if(tex==0) continue;
-			/* if(mtex->mapto==0) continue; */
+			if (tex==0) continue;
+			/* if (mtex->mapto==0) continue; */
 			
 			/* which coords */
 			co= lo;
 			
 			/* dxt dyt just from 1 value */
-			if(dxyview) {
+			if (dxyview) {
 				dxt[0]= dxt[1]= dxt[2]= dxyview[0];
 				dyt[0]= dyt[1]= dyt[2]= dxyview[1];
 			}
@@ -3051,7 +3058,7 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
 			case TEXCO_ANGMAP:
 				/* only works with texture being "real" */
 				/* use saacos(), fixes bug [#22398], float precision caused lo[2] to be slightly less then -1.0 */
-				if(lo[0] || lo[1]) { /* check for zero case [#24807] */
+				if (lo[0] || lo[1]) { /* check for zero case [#24807] */
 					fact= (1.0f/(float)M_PI)*saacos(lo[2])/(sqrtf(lo[0]*lo[0] + lo[1]*lo[1]));
 					tempvec[0]= lo[0]*fact;
 					tempvec[1]= lo[1]*fact;
@@ -3069,8 +3076,8 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
 				
 			case TEXCO_H_SPHEREMAP:
 			case TEXCO_H_TUBEMAP:
-				if(skyflag & WO_ZENUP) {
-					if(mtex->texco==TEXCO_H_TUBEMAP) map_to_tube( tempvec, tempvec+1,lo[0], lo[2], lo[1]);
+				if (skyflag & WO_ZENUP) {
+					if (mtex->texco==TEXCO_H_TUBEMAP) map_to_tube( tempvec, tempvec+1,lo[0], lo[2], lo[1]);
 					else map_to_sphere( tempvec, tempvec+1,lo[0], lo[2], lo[1]);
 					/* tube/spheremap maps for outside view, not inside */
 					tempvec[0]= 1.0f-tempvec[0];
@@ -3094,7 +3101,7 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
 				co= tempvec;
 				break;
 			case TEXCO_OBJECT:
-				if(mtex->object) {
+				if (mtex->object) {
 					copy_v3_v3(tempvec, lo);
 					mul_m4_v3(mtex->object->imat_ren, tempvec);
 					co= tempvec;
@@ -3102,7 +3109,7 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
 				break;
 				
 			case TEXCO_GLOB:
-				if(rco) {
+				if (rco) {
 					copy_v3_v3(tempvec, rco);
 					mul_m4_v3(R.viewinv, tempvec);
 					co= tempvec;
@@ -3118,35 +3125,35 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
 			}
 			
 			/* placement */			
-			if(mtex->projx) texvec[0]= mtex->size[0]*(co[mtex->projx-1]+mtex->ofs[0]);
+			if (mtex->projx) texvec[0]= mtex->size[0]*(co[mtex->projx-1]+mtex->ofs[0]);
 			else texvec[0]= mtex->size[0]*(mtex->ofs[0]);
 			
-			if(mtex->projy) texvec[1]= mtex->size[1]*(co[mtex->projy-1]+mtex->ofs[1]);
+			if (mtex->projy) texvec[1]= mtex->size[1]*(co[mtex->projy-1]+mtex->ofs[1]);
 			else texvec[1]= mtex->size[1]*(mtex->ofs[1]);
 			
-			if(mtex->projz) texvec[2]= mtex->size[2]*(co[mtex->projz-1]+mtex->ofs[2]);
+			if (mtex->projz) texvec[2]= mtex->size[2]*(co[mtex->projz-1]+mtex->ofs[2]);
 			else texvec[2]= mtex->size[2]*(mtex->ofs[2]);
 			
 			/* texture */
-			if(tex->type==TEX_IMAGE) do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
+			if (tex->type==TEX_IMAGE) do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
 		
 			rgb= multitex(mtex->tex, texvec, dxt, dyt, R.osa, &texres, thread, mtex->which_output);
 			
 			/* texture output */
-			if(rgb && (mtex->texflag & MTEX_RGBTOINT)) {
+			if (rgb && (mtex->texflag & MTEX_RGBTOINT)) {
 				texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
 				rgb= 0;
 			}
-			if(mtex->texflag & MTEX_NEGATIVE) {
-				if(rgb) {
+			if (mtex->texflag & MTEX_NEGATIVE) {
+				if (rgb) {
 					texres.tr= 1.0f-texres.tr;
 					texres.tg= 1.0f-texres.tg;
 					texres.tb= 1.0f-texres.tb;
 				}
 				else texres.tin= 1.0f-texres.tin;
 			}
-			if(mtex->texflag & MTEX_STENCIL) {
-				if(rgb) {
+			if (mtex->texflag & MTEX_STENCIL) {
+				if (rgb) {
 					fact= texres.ta;
 					texres.ta*= stencilTin;
 					stencilTin*= fact;
@@ -3158,15 +3165,15 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
 				}
 			}
 			else {
-				if(rgb) texres.ta *= stencilTin;
+				if (rgb) texres.ta *= stencilTin;
 				else texres.tin*= stencilTin;
 			}
 			
 			/* color mapping */
-			if(mtex->mapto & (WOMAP_HORIZ+WOMAP_ZENUP+WOMAP_ZENDOWN)) {
+			if (mtex->mapto & (WOMAP_HORIZ+WOMAP_ZENUP+WOMAP_ZENDOWN)) {
 				float tcol[3];
 				
-				if(rgb==0) {
+				if (rgb==0) {
 					texres.tr= mtex->r;
 					texres.tg= mtex->g;
 					texres.tb= mtex->b;
@@ -3185,29 +3192,29 @@ void do_sky_tex(const float rco[3], float lo[3], const float dxyview[2], float h
 						srgb_to_linearrgb_v3_v3(tcol, tcol);
 				}
 
-				if(mtex->mapto & WOMAP_HORIZ) {
+				if (mtex->mapto & WOMAP_HORIZ) {
 					texture_rgb_blend(hor, tcol, hor, texres.tin, mtex->colfac, mtex->blendtype);
 				}
-				if(mtex->mapto & (WOMAP_ZENUP+WOMAP_ZENDOWN)) {
+				if (mtex->mapto & (WOMAP_ZENUP+WOMAP_ZENDOWN)) {
 					float zenfac = 0.0f;
 
-					if(R.wrld.skytype & WO_SKYREAL) {
-						if((skyflag & WO_ZENUP)) {
-							if(mtex->mapto & WOMAP_ZENUP) zenfac= mtex->zenupfac;
+					if (R.wrld.skytype & WO_SKYREAL) {
+						if ((skyflag & WO_ZENUP)) {
+							if (mtex->mapto & WOMAP_ZENUP) zenfac= mtex->zenupfac;
 						}
-						else if(mtex->mapto & WOMAP_ZENDOWN) zenfac= mtex->zendownfac;
+						else if (mtex->mapto & WOMAP_ZENDOWN) zenfac= mtex->zendownfac;
 					}
 					else {
-						if(mtex->mapto & WOMAP_ZENUP) zenfac= mtex->zenupfac;
-						else if(mtex->mapto & WOMAP_ZENDOWN) zenfac= mtex->zendownfac;
+						if (mtex->mapto & WOMAP_ZENUP) zenfac= mtex->zenupfac;
+						else if (mtex->mapto & WOMAP_ZENDOWN) zenfac= mtex->zendownfac;
 					}
 					
-					if(zenfac != 0.0f)
+					if (zenfac != 0.0f)
 						texture_rgb_blend(zen, tcol, zen, texres.tin, zenfac, mtex->blendtype);
 				}
 			}
-			if(mtex->mapto & WOMAP_BLEND) {
-				if(rgb) texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
+			if (mtex->mapto & WOMAP_BLEND) {
+				if (rgb) texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
 				
 				*blend= texture_value_blend(mtex->def_var, *blend, texres.tin, mtex->blendfac, mtex->blendtype);
 			}
@@ -3231,25 +3238,25 @@ void do_lamp_tex(LampRen *la, const float lavec[3], ShadeInput *shi, float col_r
 	if (R.r.scemode & R_NO_TEX) return;
 	tex_nr= 0;
 	
-	for(; tex_nr<MAX_MTEX; tex_nr++) {
+	for (; tex_nr<MAX_MTEX; tex_nr++) {
 		
-		if(la->mtex[tex_nr]) {
+		if (la->mtex[tex_nr]) {
 			mtex= la->mtex[tex_nr];
 			
 			tex= mtex->tex;
-			if(tex==NULL) continue;
+			if (tex==NULL) continue;
 			texres.nor= NULL;
 			
 			/* which coords */
-			if(mtex->texco==TEXCO_OBJECT) {
+			if (mtex->texco==TEXCO_OBJECT) {
 				ob= mtex->object;
-				if(ob) {
+				if (ob) {
 					co= tempvec;
 					dx= dxt;
 					dy= dyt;
 					copy_v3_v3(tempvec, shi->co);
 					mul_m4_v3(ob->imat_ren, tempvec);
-					if(shi->osatex) {
+					if (shi->osatex) {
 						copy_v3_v3(dxt, shi->dxco);
 						copy_v3_v3(dyt, shi->dyco);
 						mul_mat3_m4_v3(ob->imat_ren, dxt);
@@ -3261,17 +3268,17 @@ void do_lamp_tex(LampRen *la, const float lavec[3], ShadeInput *shi, float col_r
 					dx= shi->dxco; dy= shi->dyco;
 				}
 			}
-			else if(mtex->texco==TEXCO_GLOB) {
+			else if (mtex->texco==TEXCO_GLOB) {
 				co= shi->gl; dx= shi->dxco; dy= shi->dyco;
 				copy_v3_v3(shi->gl, shi->co);
 				mul_m4_v3(R.viewinv, shi->gl);
 			}
-			else if(mtex->texco==TEXCO_VIEW) {
+			else if (mtex->texco==TEXCO_VIEW) {
 				
 				copy_v3_v3(tempvec, lavec);
 				mul_m3_v3(la->imat, tempvec);
 				
-				if(la->type==LA_SPOT) {
+				if (la->type==LA_SPOT) {
 					tempvec[0]*= la->spottexfac;
 					tempvec[1]*= la->spottexfac;
 				/* project from 3d to 2d */
@@ -3281,7 +3288,7 @@ void do_lamp_tex(LampRen *la, const float lavec[3], ShadeInput *shi, float col_r
 				co= tempvec; 
 				
 				dx= dxt; dy= dyt;	
-				if(shi->osatex) {
+				if (shi->osatex) {
 					copy_v3_v3(dxt, shi->dxlv);
 					copy_v3_v3(dyt, shi->dylv);
 					/* need some matrix conversion here? la->imat is a [3][3]  matrix!!! **/
@@ -3295,39 +3302,43 @@ void do_lamp_tex(LampRen *la, const float lavec[3], ShadeInput *shi, float col_r
 			
 			
 			/* placement */
-			if(mtex->projx && co) texvec[0]= mtex->size[0]*(co[mtex->projx-1]+mtex->ofs[0]);
+			if (mtex->projx && co) texvec[0]= mtex->size[0]*(co[mtex->projx-1]+mtex->ofs[0]);
 			else texvec[0]= mtex->size[0]*(mtex->ofs[0]);
 			
-			if(mtex->projy && co) texvec[1]= mtex->size[1]*(co[mtex->projy-1]+mtex->ofs[1]);
+			if (mtex->projy && co) texvec[1]= mtex->size[1]*(co[mtex->projy-1]+mtex->ofs[1]);
 			else texvec[1]= mtex->size[1]*(mtex->ofs[1]);
 			
-			if(mtex->projz && co) texvec[2]= mtex->size[2]*(co[mtex->projz-1]+mtex->ofs[2]);
+			if (mtex->projz && co) texvec[2]= mtex->size[2]*(co[mtex->projz-1]+mtex->ofs[2]);
 			else texvec[2]= mtex->size[2]*(mtex->ofs[2]);
 			
-			if(shi->osatex) {
+			if (shi->osatex) {
 				if (!dx) {
-					for(i=0;i<2;i++) { 
+					for (i=0;i<2;i++) {
 						dxt[i] = dyt[i] = 0.0;
 					}
-				} else {
-					if(mtex->projx) {
+				}
+				else {
+					if (mtex->projx) {
 						dxt[0]= mtex->size[0]*dx[mtex->projx-1];
 						dyt[0]= mtex->size[0]*dy[mtex->projx-1];
-					} else {
+					}
+					else {
 						dxt[0]= 0.0;
 						dyt[0]= 0.0;
 					}
-					if(mtex->projy) {
+					if (mtex->projy) {
 						dxt[1]= mtex->size[1]*dx[mtex->projy-1];
 						dyt[1]= mtex->size[1]*dy[mtex->projy-1];
-					} else {
+					}
+					else {
 						dxt[1]= 0.0;
 						dyt[1]= 0.0;
 					}
-					if(mtex->projz) {
+					if (mtex->projz) {
 						dxt[2]= mtex->size[2]*dx[mtex->projz-1];
 						dyt[2]= mtex->size[2]*dy[mtex->projz-1];
-					} else {
+					}
+					else {
 						dxt[2]= 0.0;
 						dyt[2]= 0.0;
 					}
@@ -3335,27 +3346,27 @@ void do_lamp_tex(LampRen *la, const float lavec[3], ShadeInput *shi, float col_r
 			}
 			
 			/* texture */
-			if(tex->type==TEX_IMAGE) {
+			if (tex->type==TEX_IMAGE) {
 				do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
 			}
 			
 			rgb= multitex(tex, texvec, dxt, dyt, shi->osatex, &texres, shi->thread, mtex->which_output);
 
 			/* texture output */
-			if(rgb && (mtex->texflag & MTEX_RGBTOINT)) {
+			if (rgb && (mtex->texflag & MTEX_RGBTOINT)) {
 				texres.tin= (0.35f*texres.tr+0.45f*texres.tg+0.2f*texres.tb);
 				rgb= 0;
 			}
-			if(mtex->texflag & MTEX_NEGATIVE) {
-				if(rgb) {
+			if (mtex->texflag & MTEX_NEGATIVE) {
+				if (rgb) {
 					texres.tr= 1.0f-texres.tr;
 					texres.tg= 1.0f-texres.tg;
 					texres.tb= 1.0f-texres.tb;
 				}
 				else texres.tin= 1.0f-texres.tin;
 			}
-			if(mtex->texflag & MTEX_STENCIL) {
-				if(rgb) {
+			if (mtex->texflag & MTEX_STENCIL) {
+				if (rgb) {
 					fact= texres.ta;
 					texres.ta*= stencilTin;
 					stencilTin*= fact;
@@ -3367,20 +3378,20 @@ void do_lamp_tex(LampRen *la, const float lavec[3], ShadeInput *shi, float col_r
 				}
 			}
 			else {
-				if(rgb) texres.ta*= stencilTin;
+				if (rgb) texres.ta*= stencilTin;
 				else texres.tin*= stencilTin;
 			}
 			
 			/* mapping */
-			if(((mtex->mapto & LAMAP_COL) && (effect & LA_TEXTURE))||((mtex->mapto & LAMAP_SHAD) && (effect & LA_SHAD_TEX))) {
+			if (((mtex->mapto & LAMAP_COL) && (effect & LA_TEXTURE))||((mtex->mapto & LAMAP_SHAD) && (effect & LA_SHAD_TEX))) {
 				float col[3];
 				
-				if(rgb==0) {
+				if (rgb==0) {
 					texres.tr= mtex->r;
 					texres.tg= mtex->g;
 					texres.tb= mtex->b;
 				}
-				else if(mtex->mapto & MAP_ALPHA) {
+				else if (mtex->mapto & MAP_ALPHA) {
 					texres.tin= stencilTin;
 				}
 				else texres.tin= texres.ta;
@@ -3416,27 +3427,27 @@ int externtex(MTex *mtex, const float vec[3], float *tin, float *tr, float *tg,
 	int rgb;
 	
 	tex= mtex->tex;
-	if(tex==NULL) return 0;
+	if (tex==NULL) return 0;
 	texr.nor= NULL;
 	
 	/* placement */
-	if(mtex->projx) texvec[0]= mtex->size[0]*(vec[mtex->projx-1]+mtex->ofs[0]);
+	if (mtex->projx) texvec[0]= mtex->size[0]*(vec[mtex->projx-1]+mtex->ofs[0]);
 	else texvec[0]= mtex->size[0]*(mtex->ofs[0]);
 	
-	if(mtex->projy) texvec[1]= mtex->size[1]*(vec[mtex->projy-1]+mtex->ofs[1]);
+	if (mtex->projy) texvec[1]= mtex->size[1]*(vec[mtex->projy-1]+mtex->ofs[1]);
 	else texvec[1]= mtex->size[1]*(mtex->ofs[1]);
 	
-	if(mtex->projz) texvec[2]= mtex->size[2]*(vec[mtex->projz-1]+mtex->ofs[2]);
+	if (mtex->projz) texvec[2]= mtex->size[2]*(vec[mtex->projz-1]+mtex->ofs[2]);
 	else texvec[2]= mtex->size[2]*(mtex->ofs[2]);
 	
 	/* texture */
-	if(tex->type==TEX_IMAGE) {
+	if (tex->type==TEX_IMAGE) {
 		do_2d_mapping(mtex, texvec, NULL, NULL, dxt, dyt);
 	}
 	
 	rgb= multitex(tex, texvec, dxt, dyt, 0, &texr, thread, mtex->which_output);
 	
-	if(rgb) {
+	if (rgb) {
 		texr.tin= (0.35f*texr.tr+0.45f*texr.tg+0.2f*texr.tb);
 	}
 	else {
@@ -3467,12 +3478,12 @@ void render_realtime_texture(ShadeInput *shi, Image *ima)
 	ShadeInputUV *suv= &shi->uv[shi->actuv];
 	int a;
 
-	if(R.r.scemode & R_NO_TEX) return;
+	if (R.r.scemode & R_NO_TEX) return;
 
-	if(firsttime) {
+	if (firsttime) {
 		BLI_lock_thread(LOCK_IMAGE);
-		if(firsttime) {
-			for(a=0; a<BLENDER_MAX_THREADS; a++) {
+		if (firsttime) {
+			for (a=0; a<BLENDER_MAX_THREADS; a++) {
 				memset(&imatex[a], 0, sizeof(Tex));
 				default_tex(&imatex[a]);
 				imatex[a].type= TEX_IMAGE;
@@ -3489,7 +3500,7 @@ void render_realtime_texture(ShadeInput *shi, Image *ima)
 	texvec[0]= 0.5f+0.5f*suv->uv[0];
 	texvec[1]= 0.5f+0.5f*suv->uv[1];
 	texvec[2] = 0.0f;  // initalize it because imagewrap looks at it.
-	if(shi->osatex) {
+	if (shi->osatex) {
 		dx[0]= 0.5f*suv->dxuv[0];
 		dx[1]= 0.5f*suv->dxuv[1];
 		dy[0]= 0.5f*suv->dyuv[0];
@@ -3498,7 +3509,7 @@ void render_realtime_texture(ShadeInput *shi, Image *ima)
 	
 	texr.nor= NULL;
 	
-	if(shi->osatex) imagewraposa(tex, ima, NULL, texvec, dx, dy, &texr);
+	if (shi->osatex) imagewraposa(tex, ima, NULL, texvec, dx, dy, &texr);
 	else imagewrap(tex, ima, NULL, texvec, &texr); 
 
 	shi->vcol[0]*= texr.tr;
@@ -3508,7 +3519,7 @@ void render_realtime_texture(ShadeInput *shi, Image *ima)
 }
 
 /* A modified part of shadeinput.c -> shade_input_set_uv()
-*  Used for sampling UV mapped texture color */
+ *  Used for sampling UV mapped texture color */
 static void textured_face_generate_uv(float *uv, float *normal, float *hit, float *v1, float *v2, float *v3)
 {
 
@@ -3550,12 +3561,14 @@ Material *RE_init_sample_material(Material *orig_mat, Scene *scene)
 	BKE_animsys_evaluate_animdata(scene, &mat->id, mat->adt, BKE_curframe(scene), ADT_RECALC_ANIM);
 
 	/* strip material copy from unsupported flags */
-	for(tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
-		if(mat->septex & (1<<tex_nr)) continue;
+	for (tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
+		if (mat->septex & (1<<tex_nr)) continue;
 	
-		if(mat->mtex[tex_nr]) {
+		if (mat->mtex[tex_nr]) {
 			MTex *mtex = mat->mtex[tex_nr];
 
+			if (!mtex->tex) continue;
+
 			/* only keep compatible texflags */
 			mtex->texflag = mtex->texflag & (MTEX_RGBTOINT | MTEX_STENCIL | MTEX_NEGATIVE | MTEX_ALPHAMIX);
 
@@ -3580,9 +3593,9 @@ Material *RE_init_sample_material(Material *orig_mat, Scene *scene)
 			}
 			
 			/* if mapped to an object, calculate inverse matrices */
-			if(mtex->texco==TEXCO_OBJECT) { 
+			if (mtex->texco==TEXCO_OBJECT) {
 				Object *ob= mtex->object;
-				if(ob) {
+				if (ob) {
 					invert_m4_m4(ob->imat, ob->obmat);
 					copy_m4_m4(ob->imat_ren, ob->imat);
 				}
@@ -3595,10 +3608,10 @@ Material *RE_init_sample_material(Material *orig_mat, Scene *scene)
 			BKE_animsys_evaluate_animdata(scene, &tex->id, tex->adt, BKE_curframe(scene), ADT_RECALC_ANIM);
 
 			/* update texture cache if required */
-			if(tex->type==TEX_VOXELDATA) {
+			if (tex->type==TEX_VOXELDATA) {
 				cache_voxeldata(tex, (int)scene->r.cfra);
 			}
-			if(tex->type==TEX_POINTDENSITY) {
+			if (tex->type==TEX_POINTDENSITY) {
 				/* set dummy values for render and do cache */
 				Render dummy_re = {0};
 				dummy_re.scene = scene;
@@ -3610,8 +3623,8 @@ Material *RE_init_sample_material(Material *orig_mat, Scene *scene)
 			}
 
 			/* update image sequences and movies */
-			if(tex->ima && ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
-				if(tex->iuser.flag & IMA_ANIM_ALWAYS)
+			if (tex->ima && ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
+				if (tex->iuser.flag & IMA_ANIM_ALWAYS)
 					BKE_image_user_calc_frame(&tex->iuser, (int)scene->r.cfra, 0);
 			}
 		}
@@ -3625,13 +3638,16 @@ void RE_free_sample_material(Material *mat)
 	int tex_nr;
 
 	/* free textures */
-	for(tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
-		if(mat->septex & (1<<tex_nr)) continue;
-		if(mat->mtex[tex_nr]) {
+	for (tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
+		if (mat->septex & (1<<tex_nr)) continue;
+		if (mat->mtex[tex_nr]) {
 			MTex *mtex= mat->mtex[tex_nr];
-			free_texture(mtex->tex);
-			MEM_freeN(mtex->tex);
-			mtex->tex = NULL;
+	
+			if (mtex->tex) {
+				free_texture(mtex->tex);
+				MEM_freeN(mtex->tex);
+				mtex->tex = NULL;
+			}
 		}
 	}
 
@@ -3642,15 +3658,15 @@ void RE_free_sample_material(Material *mat)
 
 
 /*
-*	Get material diffuse color and alpha (including linked textures) in given coordinates
-*	
-*	color,alpha : input/output color values
-*	volume_co : sample coordinate in global space. used by volumetric materials
-*	surface_co : sample surface coordinate in global space. used by "surface" materials
-*	face_index : surface face index
-*	hit_quad : whether point is on second "half" of a quad
-*	orcoDm : orco state derived mesh
-*/
+ *	Get material diffuse color and alpha (including linked textures) in given coordinates
+ *
+ *	color,alpha : input/output color values
+ *	volume_co : sample coordinate in global space. used by volumetric materials
+ *	surface_co : sample surface coordinate in global space. used by "surface" materials
+ *	face_index : surface face index
+ *	hit_quad : whether point is on second "half" of a quad
+ *	orcoDm : orco state derived mesh
+ */
 void RE_sample_material_color(Material *mat, float color[3], float *alpha, const float volume_co[3], const float surface_co[3], int face_index, short hit_quad, DerivedMesh *orcoDm, Object *ob)
 {
 	MFace *mface;
@@ -3662,7 +3678,7 @@ void RE_sample_material_color(Material *mat, float color[3], float *alpha, const
 
 	/* Get face data	*/
 	mvert = orcoDm->getVertArray(orcoDm);
-	mface = orcoDm->getFaceArray(orcoDm);
+	mface = orcoDm->getTessFaceArray(orcoDm);
 
 	if (!mvert || !mface || !mat) return;
 	v1=mface[face_index].v1, v2=mface[face_index].v2, v3=mface[face_index].v3;
@@ -3698,7 +3714,7 @@ void RE_sample_material_color(Material *mat, float color[3], float *alpha, const
 
 			/* for every uv map set coords and name */
 			for (i=0; i<layers; i++) {
-				if(layer_index >= 0) {
+				if (layer_index >= 0) {
 					float *uv1, *uv2, *uv3;
 					float l;
 					CustomData *data = &orcoDm->faceData;
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index 2d3837a..f5e3612 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -97,12 +97,12 @@ void calc_view_vector(float *view, float x, float y)
 
 	view[2]= -ABS(R.clipsta);
 	
-	if(R.r.mode & R_ORTHO) {
+	if (R.r.mode & R_ORTHO) {
 		view[0]= view[1]= 0.0f;
 	}
 	else {
 		
-		if(R.r.mode & R_PANORAMA) {
+		if (R.r.mode & R_PANORAMA) {
 			x-= R.panodxp;
 		}
 		
@@ -113,13 +113,13 @@ void calc_view_vector(float *view, float x, float y)
 		y= (y/(float)R.winy);
 		view[1]= R.viewplane.ymin + y*(R.viewplane.ymax - R.viewplane.ymin);
 		
-//		if(R.flag & R_SEC_FIELD) {
-//			if(R.r.mode & R_ODDFIELD) view[1]= (y+R.ystart)*R.ycor;
+//		if (R.flag & R_SEC_FIELD) {
+//			if (R.r.mode & R_ODDFIELD) view[1]= (y+R.ystart)*R.ycor;
 //			else view[1]= (y+R.ystart+1.0)*R.ycor;
 //		}
 //		else view[1]= (y+R.ystart+R.bluroffsy+0.5)*R.ycor;
 	
-		if(R.r.mode & R_PANORAMA) {
+		if (R.r.mode & R_PANORAMA) {
 			float u= view[0] + R.panodxv; float v= view[2];
 			view[0]= R.panoco*u + R.panosi*v;
 			view[2]= -R.panosi*u + R.panoco*v;
@@ -157,7 +157,7 @@ void calc_renderco_zbuf(float co[3], const float view[3], int z)
 /* also used in zbuf.c and shadbuf.c */
 int count_mask(unsigned short mask)
 {
-	if(R.samples)
+	if (R.samples)
 		return (R.samples->cmask[mask & 255]+R.samples->cmask[mask>>8]);
 	return 0;
 }
@@ -165,8 +165,8 @@ int count_mask(unsigned short mask)
 static int calchalo_z(HaloRen *har, int zz)
 {
 	
-	if(har->type & HA_ONLYSKY) {
-		if(zz < 0x7FFFFFF0) zz= - 0x7FFFFF;	/* edge render messes zvalues */
+	if (har->type & HA_ONLYSKY) {
+		if (zz < 0x7FFFFFF0) zz= - 0x7FFFFF;	/* edge render messes zvalues */
 	}
 	else {
 		zz= (zz>>8);
@@ -186,18 +186,18 @@ static void halo_pixelstruct(HaloRen *har, RenderLayer **rlpp, int totsample, in
 	accol[0]=accol[1]=accol[2]=accol[3]= 0.0f;
 	flarec= har->flarec;
 	
-	while(ps) {
+	while (ps) {
 		amountm= count_mask(ps->mask);
 		amount+= amountm;
 		
 		zz= calchalo_z(har, ps->z);
-		if((zz> har->zs) || (har->mat && (har->mat->mode & MA_HALO_SOFT))) {
-			if(shadeHaloFloat(har, col, zz, dist, xn, yn, flarec)) {
+		if ((zz> har->zs) || (har->mat && (har->mat->mode & MA_HALO_SOFT))) {
+			if (shadeHaloFloat(har, col, zz, dist, xn, yn, flarec)) {
 				flarec= 0;
 
-				if(fullsample) {
-					for(sample=0; sample<totsample; sample++)
-						if(ps->mask & (1 << sample))
+				if (fullsample) {
+					for (sample=0; sample<totsample; sample++)
+						if (ps->mask & (1 << sample))
 							addalphaAddfacFloat(rlpp[sample]->rectf + od*4, col, har->add);
 				}
 				else {
@@ -216,9 +216,9 @@ static void halo_pixelstruct(HaloRen *har, RenderLayer **rlpp, int totsample, in
 
 	/* now do the sky sub-pixels */
 	amount= R.osa-amount;
-	if(amount) {
-		if(shadeHaloFloat(har, col, 0x7FFFFF, dist, xn, yn, flarec)) {
-			if(!fullsample) {
+	if (amount) {
+		if (shadeHaloFloat(har, col, 0x7FFFFF, dist, xn, yn, flarec)) {
+			if (!fullsample) {
 				fac= ((float)amount)/(float)R.osa;
 				accol[0]+= fac*col[0];
 				accol[1]+= fac*col[1];
@@ -228,9 +228,9 @@ static void halo_pixelstruct(HaloRen *har, RenderLayer **rlpp, int totsample, in
 		}
 	}
 
-	if(fullsample) {
-		for(sample=0; sample<totsample; sample++)
-			if(!(mask & (1 << sample)))
+	if (fullsample) {
+		for (sample=0; sample<totsample; sample++)
+			if (!(mask & (1 << sample)))
 				addalphaAddfacFloat(rlpp[sample]->rectf + od*4, col, har->add);
 	}
 	else {
@@ -239,7 +239,7 @@ static void halo_pixelstruct(HaloRen *har, RenderLayer **rlpp, int totsample, in
 		col[2]= accol[2];
 		col[3]= accol[3];
 		
-		for(sample=0; sample<totsample; sample++)
+		for (sample=0; sample<totsample; sample++)
 			addalphaAddfacFloat(rlpp[sample]->rectf + od*4, col, har->add);
 	}
 }
@@ -257,7 +257,7 @@ static void halo_tile(RenderPart *pa, RenderLayer *rl)
 	unsigned int lay= rl->lay;
 
 	/* we don't render halos in the cropped area, gives errors in flare counter */
-	if(pa->crop) {
+	if (pa->crop) {
 		testrect.xmin+= pa->crop;
 		testrect.xmax-= pa->crop;
 		testrect.ymin+= pa->crop;
@@ -266,20 +266,20 @@ static void halo_tile(RenderPart *pa, RenderLayer *rl)
 	
 	totsample= get_sample_layers(pa, rl, rlpp);
 
-	for(a=0; a<R.tothalo; a++) {
+	for (a=0; a<R.tothalo; a++) {
 		har= R.sortedhalos[a];
 
 		/* layer test, clip halo with y */
-		if((har->lay & lay)==0);
-		else if(testrect.ymin > har->maxy);
-		else if(testrect.ymax < har->miny);
+		if ((har->lay & lay)==0);
+		else if (testrect.ymin > har->maxy);
+		else if (testrect.ymax < har->miny);
 		else {
 			
 			minx= floor(har->xs-har->rad);
 			maxx= ceil(har->xs+har->rad);
 			
-			if(testrect.xmin > maxx);
-			else if(testrect.xmax < minx);
+			if (testrect.xmin > maxx);
+			else if (testrect.xmax < minx);
 			else {
 				
 				minx= MAX2(minx, testrect.xmin);
@@ -288,41 +288,41 @@ static void halo_tile(RenderPart *pa, RenderLayer *rl)
 				miny= MAX2(har->miny, testrect.ymin);
 				maxy= MIN2(har->maxy, testrect.ymax);
 			
-				for(y=miny; y<maxy; y++) {
+				for (y=miny; y<maxy; y++) {
 					int rectofs= (y-disprect.ymin)*pa->rectx + (minx - disprect.xmin);
 					rz= pa->rectz + rectofs;
 					od= rectofs;
 					
-					if(pa->rectdaps)
+					if (pa->rectdaps)
 						rd= pa->rectdaps + rectofs;
 					
 					yn= (y-har->ys)*R.ycor;
 					ysq= yn*yn;
 					
-					for(x=minx; x<maxx; x++, rz++, od++) {
+					for (x=minx; x<maxx; x++, rz++, od++) {
 						xn= x- har->xs;
 						xsq= xn*xn;
 						dist= xsq+ysq;
-						if(dist<har->radsq) {
-							if(rd && *rd) {
+						if (dist<har->radsq) {
+							if (rd && *rd) {
 								halo_pixelstruct(har, rlpp, totsample, od, dist, xn, yn, (PixStr *)*rd);
 							}
 							else {
 								zz= calchalo_z(har, *rz);
-								if((zz> har->zs) || (har->mat && (har->mat->mode & MA_HALO_SOFT))) {
-									if(shadeHaloFloat(har, col, zz, dist, xn, yn, har->flarec)) {
-										for(sample=0; sample<totsample; sample++)
+								if ((zz> har->zs) || (har->mat && (har->mat->mode & MA_HALO_SOFT))) {
+									if (shadeHaloFloat(har, col, zz, dist, xn, yn, har->flarec)) {
+										for (sample=0; sample<totsample; sample++)
 											addalphaAddfacFloat(rlpp[sample]->rectf + od*4, col, har->add);
 									}
 								}
 							}
 						}
-						if(rd) rd++;
+						if (rd) rd++;
 					}
 				}
 			}
 		}
-		if(R.test_break(R.tbh) ) break; 
+		if (R.test_break(R.tbh) ) break; 
 	}
 }
 
@@ -341,17 +341,17 @@ static void lamphalo_tile(RenderPart *pa, RenderLayer *rl)
 
 	shade_input_initialize(&shi, pa, rl, 0); /* this zero's ShadeInput for us */
 	
-	for(od=0, y=pa->disprect.ymin; y<pa->disprect.ymax; y++) {
-		for(x=pa->disprect.xmin; x<pa->disprect.xmax; x++, rz++, od++) {
+	for (od=0, y=pa->disprect.ymin; y<pa->disprect.ymax; y++) {
+		for (x=pa->disprect.xmin; x<pa->disprect.xmax; x++, rz++, od++) {
 			
 			calc_view_vector(shi.view, x, y);
 			
-			if(rd && *rd) {
+			if (rd && *rd) {
 				PixStr *ps= (PixStr *)*rd;
 				int count, totsamp= 0, mask= 0;
 				
-				while(ps) {
-					if(R.r.mode & R_ORTHO)
+				while (ps) {
+					if (R.r.mode & R_ORTHO)
 						calc_renderco_ortho(shi.co, (float)x, (float)y, ps->z);
 					else
 						calc_renderco_zbuf(shi.co, shi.view, ps->z);
@@ -362,15 +362,15 @@ static void lamphalo_tile(RenderPart *pa, RenderLayer *rl)
 					col[0]= col[1]= col[2]= col[3]= 0.0f;
 					renderspothalo(&shi, col, 1.0f);
 
-					if(fullsample) {
-						for(sample=0; sample<totsample; sample++) {
-							if(ps->mask & (1 << sample)) {
+					if (fullsample) {
+						for (sample=0; sample<totsample; sample++) {
+							if (ps->mask & (1 << sample)) {
 								pass= rlpp[sample]->rectf + od*4;
 								pass[0]+= col[0];
 								pass[1]+= col[1];
 								pass[2]+= col[2];
 								pass[3]+= col[3];
-								if(pass[3]>1.0f) pass[3]= 1.0f;
+								if (pass[3]>1.0f) pass[3]= 1.0f;
 							}
 						}
 					}
@@ -381,27 +381,27 @@ static void lamphalo_tile(RenderPart *pa, RenderLayer *rl)
 						pass[1]+= fac*col[1];
 						pass[2]+= fac*col[2];
 						pass[3]+= fac*col[3];
-						if(pass[3]>1.0f) pass[3]= 1.0f;
+						if (pass[3]>1.0f) pass[3]= 1.0f;
 					}
 
 					ps= ps->next;
 				}
 
-				if(totsamp<R.osa) {
+				if (totsamp<R.osa) {
 					shi.co[2]= 0.0f;
 
 					col[0]= col[1]= col[2]= col[3]= 0.0f;
 					renderspothalo(&shi, col, 1.0f);
 
-					if(fullsample) {
-						for(sample=0; sample<totsample; sample++) {
-							if(!(mask & (1 << sample))) {
+					if (fullsample) {
+						for (sample=0; sample<totsample; sample++) {
+							if (!(mask & (1 << sample))) {
 								pass= rlpp[sample]->rectf + od*4;
 								pass[0]+= col[0];
 								pass[1]+= col[1];
 								pass[2]+= col[2];
 								pass[3]+= col[3];
-								if(pass[3]>1.0f) pass[3]= 1.0f;
+								if (pass[3]>1.0f) pass[3]= 1.0f;
 							}
 						}
 					}
@@ -412,12 +412,12 @@ static void lamphalo_tile(RenderPart *pa, RenderLayer *rl)
 						pass[1]+= fac*col[1];
 						pass[2]+= fac*col[2];
 						pass[3]+= fac*col[3];
-						if(pass[3]>1.0f) pass[3]= 1.0f;
+						if (pass[3]>1.0f) pass[3]= 1.0f;
 					}
 				}
 			}
 			else {
-				if(R.r.mode & R_ORTHO)
+				if (R.r.mode & R_ORTHO)
 					calc_renderco_ortho(shi.co, (float)x, (float)y, *rz);
 				else
 					calc_renderco_zbuf(shi.co, shi.view, *rz);
@@ -425,20 +425,20 @@ static void lamphalo_tile(RenderPart *pa, RenderLayer *rl)
 				col[0]= col[1]= col[2]= col[3]= 0.0f;
 				renderspothalo(&shi, col, 1.0f);
 
-				for(sample=0; sample<totsample; sample++) {
+				for (sample=0; sample<totsample; sample++) {
 					pass= rlpp[sample]->rectf + od*4;
 					pass[0]+= col[0];
 					pass[1]+= col[1];
 					pass[2]+= col[2];
 					pass[3]+= col[3];
-					if(pass[3]>1.0f) pass[3]= 1.0f;
+					if (pass[3]>1.0f) pass[3]= 1.0f;
 				}
 			}
 			
-			if(rd) rd++;
+			if (rd) rd++;
 		}
-		if(y&1)
-			if(R.test_break(R.tbh)) break; 
+		if (y&1)
+			if (R.test_break(R.tbh)) break; 
 	}
 }				
 
@@ -453,7 +453,7 @@ static void add_filt_passes(RenderLayer *rl, int curmask, int rectx, int offset,
 	/* combined rgb */
 	add_filt_fmask(curmask, shr->combined, rl->rectf + 4*offset, rectx);
 	
-	for(rpass= rl->passes.first; rpass; rpass= rpass->next) {
+	for (rpass= rl->passes.first; rpass; rpass= rpass->next) {
 		float *fp, *col= NULL;
 		int pixsize= 3;
 		
@@ -498,7 +498,7 @@ static void add_filt_passes(RenderLayer *rl, int curmask, int rectx, int offset,
 				break;
 			case SCE_PASS_UV:
 				/* box filter only, gauss will screwup UV too much */
-				if(shi->totuv) {
+				if (shi->totuv) {
 					float mult= (float)count_mask(curmask)/(float)R.osa;
 					fp= rpass->rect + 3*offset;
 					fp[0]+= mult*(0.5f + 0.5f*shi->uv[shi->actuv].uv[0]);
@@ -508,17 +508,17 @@ static void add_filt_passes(RenderLayer *rl, int curmask, int rectx, int offset,
 				break;
 			case SCE_PASS_INDEXOB:
 				/* no filter */
-				if(shi->vlr) {
+				if (shi->vlr) {
 					fp= rpass->rect + offset;
-					if(*fp==0.0f)
+					if (*fp==0.0f)
 						*fp= (float)shi->obr->ob->index;
 				}
 				break;
 			case SCE_PASS_INDEXMA:
 					/* no filter */
-					if(shi->vlr) {
+					if (shi->vlr) {
 							fp= rpass->rect + offset;
-							if(*fp==0.0f)
+							if (*fp==0.0f)
 									*fp= (float)shi->mat->index;
 					}
 					break;
@@ -532,11 +532,11 @@ static void add_filt_passes(RenderLayer *rl, int curmask, int rectx, int offset,
 			{
 				/* add minimum speed in pixel, no filter */
 				fp= rpass->rect + 4*offset;
-				if( (ABS(shr->winspeed[0]) + ABS(shr->winspeed[1]))< (ABS(fp[0]) + ABS(fp[1])) ) {
+				if ( (ABS(shr->winspeed[0]) + ABS(shr->winspeed[1]))< (ABS(fp[0]) + ABS(fp[1])) ) {
 					fp[0]= shr->winspeed[0];
 					fp[1]= shr->winspeed[1];
 				}
-				if( (ABS(shr->winspeed[2]) + ABS(shr->winspeed[3]))< (ABS(fp[2]) + ABS(fp[3])) ) {
+				if ( (ABS(shr->winspeed[2]) + ABS(shr->winspeed[3]))< (ABS(fp[2]) + ABS(fp[3])) ) {
 					fp[2]= shr->winspeed[2];
 					fp[3]= shr->winspeed[3];
 				}
@@ -549,7 +549,7 @@ static void add_filt_passes(RenderLayer *rl, int curmask, int rectx, int offset,
 				pixsize= 4;
 				break;
 		}
-		if(col) {
+		if (col) {
 			fp= rpass->rect + pixsize*offset;
 			add_filt_fmask_pixsize(curmask, col, fp, rectx, pixsize);
 		}
@@ -565,7 +565,7 @@ static void add_passes(RenderLayer *rl, int offset, ShadeInput *shi, ShadeResult
 	fp= rl->rectf + 4*offset;
 	copy_v4_v4(fp, shr->combined);
 	
-	for(rpass= rl->passes.first; rpass; rpass= rpass->next) {
+	for (rpass= rl->passes.first; rpass; rpass= rpass->next) {
 		float *col= NULL, uvcol[3];
 		int a, pixsize= 3;
 		
@@ -609,7 +609,7 @@ static void add_passes(RenderLayer *rl, int offset, ShadeInput *shi, ShadeResult
 				col= shr->nor;
 				break;
 			case SCE_PASS_UV:
-				if(shi->totuv) {
+				if (shi->totuv) {
 					uvcol[0]= 0.5f + 0.5f*shi->uv[shi->actuv].uv[0];
 					uvcol[1]= 0.5f + 0.5f*shi->uv[shi->actuv].uv[1];
 					uvcol[2]= 1.0f;
@@ -621,13 +621,13 @@ static void add_passes(RenderLayer *rl, int offset, ShadeInput *shi, ShadeResult
 				pixsize= 4;
 				break;
 			case SCE_PASS_INDEXOB:
-				if(shi->vlr) {
+				if (shi->vlr) {
 					fp= rpass->rect + offset;
 					*fp= (float)shi->obr->ob->index;
 				}
 				break;
 			case SCE_PASS_INDEXMA:
-				if(shi->vlr) {
+				if (shi->vlr) {
 					fp= rpass->rect + offset;
 					*fp= (float)shi->mat->index;
 				}
@@ -641,9 +641,9 @@ static void add_passes(RenderLayer *rl, int offset, ShadeInput *shi, ShadeResult
 				pixsize= 4;
 				break;
 		}
-		if(col) {
+		if (col) {
 			fp= rpass->rect + pixsize*offset;
-			for(a=0; a<pixsize; a++)
+			for (a=0; a<pixsize; a++)
 				fp[a]= col[a];
 		}
 	}
@@ -652,10 +652,10 @@ static void add_passes(RenderLayer *rl, int offset, ShadeInput *shi, ShadeResult
 int get_sample_layers(RenderPart *pa, RenderLayer *rl, RenderLayer **rlpp)
 {
 	
-	if(pa->fullresult.first) {
+	if (pa->fullresult.first) {
 		int sample, nr= BLI_findindex(&pa->result->layers, rl);
 		
-		for(sample=0; sample<R.osa; sample++) {
+		for (sample=0; sample<R.osa; sample++) {
 			RenderResult *rr= BLI_findlink(&pa->fullresult, sample);
 		
 			rlpp[sample]= BLI_findlink(&rr->layers, nr);
@@ -675,27 +675,27 @@ static void sky_tile(RenderPart *pa, RenderLayer *rl)
 	RenderLayer *rlpp[RE_MAX_OSA];
 	int x, y, od=0, totsample;
 	
-	if(R.r.alphamode!=R_ADDSKY)
+	if (R.r.alphamode!=R_ADDSKY)
 		return;
 	
 	totsample= get_sample_layers(pa, rl, rlpp);
 	
-	for(y=pa->disprect.ymin; y<pa->disprect.ymax; y++) {
-		for(x=pa->disprect.xmin; x<pa->disprect.xmax; x++, od+=4) {
+	for (y=pa->disprect.ymin; y<pa->disprect.ymax; y++) {
+		for (x=pa->disprect.xmin; x<pa->disprect.xmax; x++, od+=4) {
 			float col[4];
 			int sample, done= 0;
 			
-			for(sample= 0; sample<totsample; sample++) {
+			for (sample= 0; sample<totsample; sample++) {
 				float *pass= rlpp[sample]->rectf + od;
 				
-				if(pass[3]<1.0f) {
+				if (pass[3]<1.0f) {
 					
-					if(done==0) {
+					if (done==0) {
 						shadeSkyPixel(col, x, y, pa->thread);
 						done= 1;
 					}
 					
-					if(pass[3]==0.0f) {
+					if (pass[3]==0.0f) {
 						copy_v4_v4(pass, col);
 					}
 					else {
@@ -705,8 +705,8 @@ static void sky_tile(RenderPart *pa, RenderLayer *rl)
 			}			
 		}
 		
-		if(y&1)
-			if(R.test_break(R.tbh)) break; 
+		if (y&1)
+			if (R.test_break(R.tbh)) break; 
 	}
 }
 
@@ -722,67 +722,67 @@ static void atm_tile(RenderPart *pa, RenderLayer *rl)
 	totsample= get_sample_layers(pa, rl, rlpp);
 
 	/* check that z pass is enabled */
-	if(pa->rectz==NULL) return;
-	for(zpass= rl->passes.first; zpass; zpass= zpass->next)
-		if(zpass->passtype==SCE_PASS_Z)
+	if (pa->rectz==NULL) return;
+	for (zpass= rl->passes.first; zpass; zpass= zpass->next)
+		if (zpass->passtype==SCE_PASS_Z)
 			break;
 	
-	if(zpass==NULL) return;
+	if (zpass==NULL) return;
 
 	/* check for at least one sun lamp that its atmosphere flag is enabled */
-	for(go=R.lights.first; go; go= go->next) {
+	for (go=R.lights.first; go; go= go->next) {
 		lar= go->lampren;
-		if(lar->type==LA_SUN && lar->sunsky && (lar->sunsky->effect_type & LA_SUN_EFFECT_AP))
+		if (lar->type==LA_SUN && lar->sunsky && (lar->sunsky->effect_type & LA_SUN_EFFECT_AP))
 			break;
 	}
 	/* do nothign and return if there is no sun lamp */
-	if(go==NULL)
+	if (go==NULL)
 		return;
 	
 	/* for each x,y and each sample, and each sun lamp*/
-	for(y=pa->disprect.ymin; y<pa->disprect.ymax; y++) {
-		for(x=pa->disprect.xmin; x<pa->disprect.xmax; x++, od++) {
+	for (y=pa->disprect.ymin; y<pa->disprect.ymax; y++) {
+		for (x=pa->disprect.xmin; x<pa->disprect.xmax; x++, od++) {
 			int sample;
 			
-			for(sample=0; sample<totsample; sample++) {
+			for (sample=0; sample<totsample; sample++) {
 				float *zrect= RE_RenderLayerGetPass(rlpp[sample], SCE_PASS_Z) + od;
 				float *rgbrect = rlpp[sample]->rectf + 4*od;
 				float rgb[3] = {0};
 				int done= 0;
 				
-				for(go=R.lights.first; go; go= go->next) {
+				for (go=R.lights.first; go; go= go->next) {
 				
 					
 					lar= go->lampren;
-					if(lar->type==LA_SUN &&	lar->sunsky) {
+					if (lar->type==LA_SUN &&	lar->sunsky) {
 						
 						/* if it's sky continue and don't apply atmosphere effect on it */
-						if(*zrect >= 9.9e10f || rgbrect[3]==0.0f) {
+						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 */
-							if(go->ob->obmat[2][2] < 0.f) {
+							if (go->ob->obmat[2][2] < 0.f) {
 								continue;
 							}
 							
 							copy_v3_v3(tmp_rgb, rgbrect);
-							if(rgbrect[3]!=1.0f) {	/* de-premul */
+							if (rgbrect[3]!=1.0f) {	/* de-premul */
 								mul_v3_fl(tmp_rgb, 1.0f/rgbrect[3]);
 							}
 							shadeAtmPixel(lar->sunsky, tmp_rgb, x, y, *zrect);
-							if(rgbrect[3]!=1.0f) {	/* premul */
+							if (rgbrect[3]!=1.0f) {	/* premul */
 								mul_v3_fl(tmp_rgb, rgbrect[3]);
 							}
 							
-							if(done==0) {
+							if (done==0) {
 								copy_v3_v3(rgb, tmp_rgb);
 								done = 1;						
 							}
-							else{
+							else {
 								rgb[0] = 0.5f*rgb[0] + 0.5f*tmp_rgb[0];
 								rgb[1] = 0.5f*rgb[1] + 0.5f*tmp_rgb[1];
 								rgb[2] = 0.5f*rgb[2] + 0.5f*tmp_rgb[2];
@@ -792,7 +792,7 @@ static void atm_tile(RenderPart *pa, RenderLayer *rl)
 				}
 
 				/* if at least for one sun lamp aerial perspective was applied*/
-				if(done) {
+				if (done) {
 					copy_v3_v3(rgbrect, rgb);
 				}
 			}
@@ -808,10 +808,10 @@ static void shadeDA_tile(RenderPart *pa, RenderLayer *rl)
 	int samp;
 	int x, y, seed, crop=0, offs=0, od;
 	
-	if(R.test_break(R.tbh)) return; 
+	if (R.test_break(R.tbh)) return; 
 	
 	/* irregular shadowb buffer creation */
-	if(R.r.mode & R_SHADOW)
+	if (R.r.mode & R_SHADOW)
 		ISB_create(pa, NULL);
 	
 	/* we set per pixel a fixed seed, for random AO and shadow samples */
@@ -821,45 +821,45 @@ static void shadeDA_tile(RenderPart *pa, RenderLayer *rl)
 	shade_sample_initialize(&ssamp, pa, rl);
 
 	/* occlusion caching */
-	if(R.occlusiontree)
+	if (R.occlusiontree)
 		cache_occ_samples(&R, pa, &ssamp);
 		
 	/* filtered render, for now we assume only 1 filter size */
-	if(pa->crop) {
+	if (pa->crop) {
 		crop= 1;
 		rectdaps+= pa->rectx + 1;
 		offs= pa->rectx + 1;
 	}
 	
 	/* scanline updates have to be 2 lines behind */
-	rr->renrect.ymin= 0;
-	rr->renrect.ymax= -2*crop;
+	rr->renrect.ymin = 0;
+	rr->renrect.ymax = -2*crop;
 	rr->renlay= rl;
 				
-	for(y=pa->disprect.ymin+crop; y<pa->disprect.ymax-crop; y++, rr->renrect.ymax++) {
+	for (y=pa->disprect.ymin+crop; y<pa->disprect.ymax-crop; y++, rr->renrect.ymax++) {
 		rd= rectdaps;
 		od= offs;
 		
-		for(x=pa->disprect.xmin+crop; x<pa->disprect.xmax-crop; x++, rd++, od++) {
+		for (x=pa->disprect.xmin+crop; x<pa->disprect.xmax-crop; x++, rd++, od++) {
 			BLI_thread_srandom(pa->thread, seed++);
 			
-			if(*rd) {
-				if(shade_samples(&ssamp, (PixStr *)(*rd), x, y)) {
+			if (*rd) {
+				if (shade_samples(&ssamp, (PixStr *)(*rd), x, y)) {
 					
 					/* multisample buffers or filtered mask filling? */
-					if(pa->fullresult.first) {
+					if (pa->fullresult.first) {
 						int a;
-						for(samp=0; samp<ssamp.tot; samp++) {
+						for (samp=0; samp<ssamp.tot; samp++) {
 							int smask= ssamp.shi[samp].mask;
-							for(a=0; a<R.osa; a++) {
+							for (a=0; a<R.osa; a++) {
 								int mask= 1<<a;
-								if(smask & mask)
+								if (smask & mask)
 									add_passes(ssamp.rlpp[a], od, &ssamp.shi[samp], &ssamp.shr[samp]);
 							}
 						}
 					}
 					else {
-						for(samp=0; samp<ssamp.tot; samp++)
+						for (samp=0; samp<ssamp.tot; samp++)
 							add_filt_passes(rl, ssamp.shi[samp].mask, pa->rectx, od, &ssamp.shi[samp], &ssamp.shr[samp]);
 					}
 				}
@@ -869,16 +869,16 @@ static void shadeDA_tile(RenderPart *pa, RenderLayer *rl)
 		rectdaps+= pa->rectx;
 		offs+= pa->rectx;
 		
-		if(y&1) if(R.test_break(R.tbh)) break; 
+		if (y&1) if (R.test_break(R.tbh)) break; 
 	}
 	
 	/* disable scanline updating */
 	rr->renlay= NULL;
 	
-	if(R.r.mode & R_SHADOW)
+	if (R.r.mode & R_SHADOW)
 		ISB_free(pa);
 
-	if(R.occlusiontree)
+	if (R.occlusiontree)
 		free_occ_samples(&R, pa);
 }
 
@@ -902,9 +902,9 @@ static void freeps(ListBase *lb)
 {
 	PixStrMain *psm, *psmnext;
 	
-	for(psm= lb->first; psm; psm= psmnext) {
+	for (psm= lb->first; psm; psm= psmnext) {
 		psmnext= psm->next;
-		if(psm->ps)
+		if (psm->ps)
 			MEM_freeN(psm->ps);
 		MEM_freeN(psm);
 	}
@@ -916,11 +916,11 @@ 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) {
-			if( ps->obi == obi && ps->facenr == facenr ) {
+		while (ps) {
+			if ( ps->obi == obi && ps->facenr == facenr ) {
 				ps->mask |= mask;
 				return;
 			}
@@ -932,12 +932,12 @@ static void addps(ListBase *lb, intptr_t *rd, int obi, int facenr, int z, int ma
 	/* make new PS (pixel struct) */
 	psm= lb->last;
 	
-	if(psm->counter==4095)
+	if (psm->counter==4095)
 		psm= addpsmain(lb);
 	
 	ps= psm->ps + psm->counter++;
 	
-	if(last) last->next= ps;
+	if (last) last->next= ps;
 	else *rd= (intptr_t)ps;
 	
 	ps->next= NULL;
@@ -954,11 +954,11 @@ static void edge_enhance_add(RenderPart *pa, float *rectf, float *arect)
 	float addcol[4];
 	int pix;
 	
-	if(arect==NULL)
+	if (arect==NULL)
 		return;
 	
-	for(pix= pa->rectx*pa->recty; pix>0; pix--, arect++, rectf+=4) {
-		if(*arect != 0.0f) {
+	for (pix= pa->rectx*pa->recty; pix>0; pix--, arect++, rectf+=4) {
+		if (*arect != 0.0f) {
 			addcol[0]= *arect * R.r.edgeR;
 			addcol[1]= *arect * R.r.edgeG;
 			addcol[2]= *arect * R.r.edgeB;
@@ -975,12 +975,12 @@ static void convert_to_key_alpha(RenderPart *pa, RenderLayer *rl)
 	
 	totsample= get_sample_layers(pa, rl, rlpp);
 	
-	for(sample= 0; sample<totsample; sample++) {
+	for (sample= 0; sample<totsample; sample++) {
 		float *rectf= rlpp[sample]->rectf;
 		
-		for(y= pa->rectx*pa->recty; y>0; y--, rectf+=4) {
-			if(rectf[3] >= 1.0f);
-			else if(rectf[3] > 0.0f) {
+		for (y= pa->rectx*pa->recty; y>0; y--, rectf+=4) {
+			if (rectf[3] >= 1.0f);
+			else if (rectf[3] > 0.0f) {
 				rectf[0] /= rectf[3];
 				rectf[1] /= rectf[3];
 				rectf[2] /= rectf[3];
@@ -999,10 +999,10 @@ static void edge_enhance_tile(RenderPart *pa, float *rectf, int *rectz)
 	
 	/* shift values in zbuffer 4 to the right (anti overflows), for filter we need multiplying with 12 max */
 	rz= rectz;
-	if(rz==NULL) return;
+	if (rz==NULL) return;
 	
-	for(y=0; y<pa->recty; y++)
-		for(x=0; x<pa->rectx; x++, rz++) (*rz)>>= 4;
+	for (y=0; y<pa->recty; y++)
+		for (x=0; x<pa->rectx; x++, rz++) (*rz)>>= 4;
 	
 	rz1= rectz;
 	rz2= rz1+pa->rectx;
@@ -1010,8 +1010,8 @@ static void edge_enhance_tile(RenderPart *pa, float *rectf, int *rectz)
 	
 	rf= rectf+pa->rectx+1;
 	
-	for(y=0; y<pa->recty-2; y++) {
-		for(x=0; x<pa->rectx-2; x++, rz1++, rz2++, rz3++, rf++) {
+	for (y=0; y<pa->recty-2; y++) {
+		for (x=0; x<pa->rectx-2; x++, rz1++, rz2++, rz3++, rf++) {
 			
 			/* prevent overflow with sky z values */
 			zval1=   rz1[0] + 2*rz1[1] +   rz1[2];
@@ -1019,19 +1019,19 @@ static void edge_enhance_tile(RenderPart *pa, float *rectf, int *rectz)
 			zval3=   rz3[0] + 2*rz3[1] +   rz3[2];
 			
 			col= ( 4*rz2[1] - (zval1 + zval2 + zval3)/3 );
-			if(col<0) col= -col;
+			if (col<0) col= -col;
 			
 			col >>= 5;
-			if(col > (1<<16)) col= (1<<16);
+			if (col > (1<<16)) col= (1<<16);
 			else col= (R.r.edgeint*col)>>8;
 			
-			if(col>0) {
+			if (col>0) {
 				float fcol;
 				
-				if(col>255) fcol= 1.0f;
+				if (col>255) fcol= 1.0f;
 				else fcol= (float)col/255.0f;
 				
-				if(R.osa)
+				if (R.osa)
 					*rf+= fcol/(float)R.osa;
 				else
 					*rf= fcol;
@@ -1045,8 +1045,8 @@ static void edge_enhance_tile(RenderPart *pa, float *rectf, int *rectz)
 	
 	/* shift back zbuf values, we might need it still */
 	rz= rectz;
-	for(y=0; y<pa->recty; y++)
-		for(x=0; x<pa->rectx; x++, rz++) (*rz)<<= 4;
+	for (y=0; y<pa->recty; y++)
+		for (x=0; x<pa->rectx; x++, rz++) (*rz)<<= 4;
 	
 }
 
@@ -1059,12 +1059,12 @@ static void reset_sky_speed(RenderPart *pa, RenderLayer *rl)
 	
 	totsample= get_sample_layers(pa, rl, rlpp);
 
-	for(sample= 0; sample<totsample; sample++) {
+	for (sample= 0; sample<totsample; sample++) {
 		fp= RE_RenderLayerGetPass(rlpp[sample], SCE_PASS_VECTOR);
-		if(fp==NULL) break;
+		if (fp==NULL) break;
 
-		for(a= 4*pa->rectx*pa->recty - 1; a>=0; a--)
-			if(fp[a] == PASS_VECTOR_MAX) fp[a]= 0.0f;
+		for (a= 4*pa->rectx*pa->recty - 1; a>=0; a--)
+			if (fp[a] == PASS_VECTOR_MAX) fp[a]= 0.0f;
 	}
 }
 
@@ -1074,16 +1074,16 @@ static unsigned short *make_solid_mask(RenderPart *pa)
 	unsigned short *solidmask, *sp;
 	int x;
 
-	if(rd==NULL) return NULL;
+	if (rd==NULL) return NULL;
 
 	sp=solidmask= MEM_mallocN(sizeof(short)*pa->rectx*pa->recty, "solidmask");
 
-	for(x=pa->rectx*pa->recty; x>0; x--, rd++, sp++) {
-		if(*rd) {
+	for (x=pa->rectx*pa->recty; x>0; x--, rd++, sp++) {
+		if (*rd) {
 			PixStr *ps= (PixStr *)*rd;
 			
 			*sp= ps->mask;
-			for(ps= ps->next; ps; ps= ps->next)
+			for (ps= ps->next; ps; ps= ps->next)
 				*sp |= ps->mask;
 		}
 		else
@@ -1098,10 +1098,10 @@ static void addAlphaOverFloatMask(float *dest, float *source, unsigned short dma
 	unsigned short shared= dmask & smask;
 	float mul= 1.0f - source[3];
 	
-	if(shared) {	/* overlapping masks */
+	if (shared) {	/* overlapping masks */
 		
 		/* masks differ, we make a mixture of 'add' and 'over' */
-		if(shared!=dmask) {
+		if (shared!=dmask) {
 			float shared_bits= (float)count_mask(shared);		/* alpha over */
 			float tot_bits= (float)count_mask(smask|dmask);		/* alpha add */
 			
@@ -1109,7 +1109,7 @@ static void addAlphaOverFloatMask(float *dest, float *source, unsigned short dma
 			mul= add + (1.0f-add)*mul;
 		}
 	}
-	else if(dmask && smask) {
+	else if (dmask && smask) {
 		/* works for premul only, of course */
 		dest[0]+= source[0];
 		dest[1]+= source[1];
@@ -1143,16 +1143,16 @@ static void make_pixelstructs(RenderPart *pa, ZSpan *zspan, int sample, void *da
 	int x, y;
 	int mask= 1<<sample;
 
-	for(y=0; y<pa->recty; y++) {
-		for(x=0; x<pa->rectx; x++, rd++, rp++, ro++, rz++, rm++) {
-			if(*rp) {
+	for (y=0; y<pa->recty; y++) {
+		for (x=0; x<pa->rectx; x++, rd++, rp++, ro++, rz++, rm++) {
+			if (*rp) {
 				addps(lb, rd, *ro, *rp, *rz, (zspan->rectmask)? *rm: 0, mask);
 			}
 		}
 	}
 
-	if(sdata->rl->layflag & SCE_LAY_EDGE) 
-		if(R.r.mode & R_EDGE) 
+	if (sdata->rl->layflag & SCE_LAY_EDGE) 
+		if (R.r.mode & R_EDGE) 
 			edge_enhance_tile(pa, sdata->edgerect, zspan->rectz);
 }
 
@@ -1170,47 +1170,47 @@ void zbufshadeDA_tile(RenderPart *pa)
 	pa->recto= MEM_mallocN(sizeof(int)*pa->rectx*pa->recty, "recto");
 	pa->rectp= MEM_mallocN(sizeof(int)*pa->rectx*pa->recty, "rectp");
 	pa->rectz= MEM_mallocN(sizeof(int)*pa->rectx*pa->recty, "rectz");
-	for(rl= rr->layers.first; rl; rl= rl->next) {
-		if((rl->layflag & SCE_LAY_ZMASK) && (rl->layflag & SCE_LAY_NEG_ZMASK))
+	for (rl= rr->layers.first; rl; rl= rl->next) {
+		if ((rl->layflag & SCE_LAY_ZMASK) && (rl->layflag & SCE_LAY_NEG_ZMASK))
 			pa->rectmask= MEM_mallocN(sizeof(int)*pa->rectx*pa->recty, "rectmask");
 	
 		/* initialize pixelstructs and edge buffer */
 		addpsmain(&psmlist);
 		pa->rectdaps= MEM_callocN(sizeof(intptr_t)*pa->rectx*pa->recty+4, "zbufDArectd");
 		
-		if(rl->layflag & SCE_LAY_EDGE) 
-			if(R.r.mode & R_EDGE) 
+		if (rl->layflag & SCE_LAY_EDGE) 
+			if (R.r.mode & R_EDGE) 
 				edgerect= MEM_callocN(sizeof(float)*pa->rectx*pa->recty, "rectedge");
 		
 		/* always fill visibility */
-		for(pa->sample=0; pa->sample<R.osa; pa->sample+=4) {
+		for (pa->sample=0; pa->sample<R.osa; pa->sample+=4) {
 			ZbufSolidData sdata;
 
 			sdata.rl= rl;
 			sdata.psmlist= &psmlist;
 			sdata.edgerect= edgerect;
 			zbuffer_solid(pa, rl, make_pixelstructs, &sdata);
-			if(R.test_break(R.tbh)) break; 
+			if (R.test_break(R.tbh)) break; 
 		}
 		
 		/* shades solid */
-		if(rl->layflag & SCE_LAY_SOLID) 
+		if (rl->layflag & SCE_LAY_SOLID) 
 			shadeDA_tile(pa, rl);
 		
 		/* lamphalo after solid, before ztra, looks nicest because ztra does own halo */
-		if(R.flag & R_LAMPHALO)
-			if(rl->layflag & SCE_LAY_HALO)
+		if (R.flag & R_LAMPHALO)
+			if (rl->layflag & SCE_LAY_HALO)
 				lamphalo_tile(pa, rl);
 		
 		/* halo before ztra, because ztra fills in zbuffer now */
-		if(R.flag & R_HALO)
-			if(rl->layflag & SCE_LAY_HALO)
+		if (R.flag & R_HALO)
+			if (rl->layflag & SCE_LAY_HALO)
 				halo_tile(pa, rl);
 
 		/* transp layer */
-		if(R.flag & R_ZTRA || R.totstrand) {
-			if(rl->layflag & (SCE_LAY_ZTRA|SCE_LAY_STRAND)) {
-				if(pa->fullresult.first) {
+		if (R.flag & R_ZTRA || R.totstrand) {
+			if (rl->layflag & (SCE_LAY_ZTRA|SCE_LAY_STRAND)) {
+				if (pa->fullresult.first) {
 					zbuffer_transp_shade(pa, rl, rl->rectf, &psmlist);
 				}
 				else {
@@ -1225,17 +1225,17 @@ void zbufshadeDA_tile(RenderPart *pa)
 					SWAP(float *, rl->acolrect, rl->rectf);
 					
 					/* zbuffer transp only returns ztramask if there's solid rendered */
-					if(ztramask)
+					if (ztramask)
 						solidmask= make_solid_mask(pa);
 
-					if(ztramask && solidmask) {
+					if (ztramask && solidmask) {
 						unsigned short *sps= solidmask, *spz= ztramask;
 						unsigned short fullmask= (1<<R.osa)-1;
 						float *fcol= rl->rectf; float *acol= rl->acolrect;
 						int x;
 						
-						for(x=pa->rectx*pa->recty; x>0; x--, acol+=4, fcol+=4, sps++, spz++) {
-							if(*sps == fullmask)
+						for (x=pa->rectx*pa->recty; x>0; x--, acol+=4, fcol+=4, sps++, spz++) {
+							if (*sps == fullmask)
 								addAlphaOverFloat(fcol, acol);
 							else
 								addAlphaOverFloatMask(fcol, acol, *sps, *spz);
@@ -1244,44 +1244,44 @@ void zbufshadeDA_tile(RenderPart *pa)
 					else {
 						float *fcol= rl->rectf; float *acol= rl->acolrect;
 						int x;
-						for(x=pa->rectx*pa->recty; x>0; x--, acol+=4, fcol+=4) {
+						for (x=pa->rectx*pa->recty; x>0; x--, acol+=4, fcol+=4) {
 							addAlphaOverFloat(fcol, acol);
 						}
 					}
-					if(solidmask) MEM_freeN(solidmask);
-					if(ztramask) MEM_freeN(ztramask);
+					if (solidmask) MEM_freeN(solidmask);
+					if (ztramask) MEM_freeN(ztramask);
 				}
 			}
 		}
 
 		/* sun/sky */
-		if(rl->layflag & SCE_LAY_SKY)
+		if (rl->layflag & SCE_LAY_SKY)
 			atm_tile(pa, rl);
 		
 		/* sky before edge */
-		if(rl->layflag & SCE_LAY_SKY)
+		if (rl->layflag & SCE_LAY_SKY)
 			sky_tile(pa, rl);
 
 		/* extra layers */
-		if(rl->layflag & SCE_LAY_EDGE) 
-			if(R.r.mode & R_EDGE) 
+		if (rl->layflag & SCE_LAY_EDGE) 
+			if (R.r.mode & R_EDGE) 
 				edge_enhance_add(pa, rl->rectf, edgerect);
 		
-		if(rl->passflag & SCE_PASS_VECTOR)
+		if (rl->passflag & SCE_PASS_VECTOR)
 			reset_sky_speed(pa, rl);
 		
 		/* de-premul alpha */
-		if(R.r.alphamode & R_ALPHAKEY)
+		if (R.r.alphamode & R_ALPHAKEY)
 			convert_to_key_alpha(pa, rl);
 		
 		/* free stuff within loop! */
 		MEM_freeN(pa->rectdaps); pa->rectdaps= NULL;
 		freeps(&psmlist);
 		
-		if(edgerect) MEM_freeN(edgerect);
+		if (edgerect) MEM_freeN(edgerect);
 		edgerect= NULL;
 
-		if(pa->rectmask) {
+		if (pa->rectmask) {
 			MEM_freeN(pa->rectmask);
 			pa->rectmask= NULL;
 		}
@@ -1293,7 +1293,7 @@ void zbufshadeDA_tile(RenderPart *pa)
 	MEM_freeN(pa->rectz); pa->rectz= NULL;
 	
 	/* display active layer */
-	rr->renrect.ymin=rr->renrect.ymax= 0;
+	rr->renrect.ymin=rr->renrect.ymax = 0;
 	rr->renlay= render_get_active_layer(&R, rr);
 }
 
@@ -1319,8 +1319,8 @@ void zbufshade_tile(RenderPart *pa)
 	pa->rectp= MEM_mallocN(sizeof(int)*pa->rectx*pa->recty, "rectp");
 	pa->rectz= MEM_mallocN(sizeof(int)*pa->rectx*pa->recty, "rectz");
 
-	for(rl= rr->layers.first; rl; rl= rl->next) {
-		if((rl->layflag & SCE_LAY_ZMASK) && (rl->layflag & SCE_LAY_NEG_ZMASK))
+	for (rl= rr->layers.first; rl; rl= rl->next) {
+		if ((rl->layflag & SCE_LAY_ZMASK) && (rl->layflag & SCE_LAY_NEG_ZMASK))
 			pa->rectmask= MEM_mallocN(sizeof(int)*pa->rectx*pa->recty, "rectmask");
 
 		/* general shader info, passes */
@@ -1328,21 +1328,21 @@ void zbufshade_tile(RenderPart *pa)
 		
 		zbuffer_solid(pa, rl, NULL, NULL);
 		
-		if(!R.test_break(R.tbh)) {	/* NOTE: this if() is not consistent */
+		if (!R.test_break(R.tbh)) {	/* NOTE: this if () is not consistent */
 			
 			/* edges only for solid part, ztransp doesn't support it yet anti-aliased */
-			if(rl->layflag & SCE_LAY_EDGE) {
-				if(R.r.mode & R_EDGE) {
+			if (rl->layflag & SCE_LAY_EDGE) {
+				if (R.r.mode & R_EDGE) {
 					edgerect= MEM_callocN(sizeof(float)*pa->rectx*pa->recty, "rectedge");
 					edge_enhance_tile(pa, edgerect, pa->rectz);
 				}
 			}
 			
 			/* initialize scanline updates for main thread */
-			rr->renrect.ymin= 0;
+			rr->renrect.ymin = 0;
 			rr->renlay= rl;
 			
-			if(rl->layflag & SCE_LAY_SOLID) {
+			if (rl->layflag & SCE_LAY_SOLID) {
 				float *fcol= rl->rectf;
 				int *ro= pa->recto, *rp= pa->rectp, *rz= pa->rectz;
 				int x, y, offs=0, seed;
@@ -1351,35 +1351,35 @@ void zbufshade_tile(RenderPart *pa)
 				seed= pa->rectx*pa->disprect.ymin;
 				
 				/* irregular shadowb buffer creation */
-				if(R.r.mode & R_SHADOW)
+				if (R.r.mode & R_SHADOW)
 					ISB_create(pa, NULL);
 
-				if(R.occlusiontree)
+				if (R.occlusiontree)
 					cache_occ_samples(&R, pa, &ssamp);
 				
-				for(y=pa->disprect.ymin; y<pa->disprect.ymax; y++, rr->renrect.ymax++) {
-					for(x=pa->disprect.xmin; x<pa->disprect.xmax; x++, ro++, rz++, rp++, fcol+=4, offs++) {
+				for (y=pa->disprect.ymin; y<pa->disprect.ymax; y++, rr->renrect.ymax++) {
+					for (x=pa->disprect.xmin; x<pa->disprect.xmax; x++, ro++, rz++, rp++, fcol+=4, offs++) {
 						/* per pixel fixed seed */
 						BLI_thread_srandom(pa->thread, seed++);
 						
-						if(*rp) {
+						if (*rp) {
 							ps.obi= *ro;
 							ps.facenr= *rp;
 							ps.z= *rz;
-							if(shade_samples(&ssamp, &ps, x, y)) {
+							if (shade_samples(&ssamp, &ps, x, y)) {
 								/* combined and passes */
 								add_passes(rl, offs, ssamp.shi, ssamp.shr);
 							}
 						}
 					}
-					if(y&1)
-						if(R.test_break(R.tbh)) break; 
+					if (y&1)
+						if (R.test_break(R.tbh)) break; 
 				}
 				
-				if(R.occlusiontree)
+				if (R.occlusiontree)
 					free_occ_samples(&R, pa);
 				
-				if(R.r.mode & R_SHADOW)
+				if (R.r.mode & R_SHADOW)
 					ISB_free(pa);
 			}
 			
@@ -1388,17 +1388,17 @@ void zbufshade_tile(RenderPart *pa)
 		}
 		
 		/* lamphalo after solid, before ztra, looks nicest because ztra does own halo */
-		if(R.flag & R_LAMPHALO)
-			if(rl->layflag & SCE_LAY_HALO)
+		if (R.flag & R_LAMPHALO)
+			if (rl->layflag & SCE_LAY_HALO)
 				lamphalo_tile(pa, rl);
 		
 		/* halo before ztra, because ztra fills in zbuffer now */
-		if(R.flag & R_HALO)
-			if(rl->layflag & SCE_LAY_HALO)
+		if (R.flag & R_HALO)
+			if (rl->layflag & SCE_LAY_HALO)
 				halo_tile(pa, rl);
 		
-		if(R.flag & R_ZTRA || R.totstrand) {
-			if(rl->layflag & (SCE_LAY_ZTRA|SCE_LAY_STRAND)) {
+		if (R.flag & R_ZTRA || R.totstrand) {
+			if (rl->layflag & (SCE_LAY_ZTRA|SCE_LAY_STRAND)) {
 				float *fcol, *acol;
 				int x;
 				
@@ -1411,44 +1411,44 @@ void zbufshade_tile(RenderPart *pa)
 				SWAP(float *, rl->acolrect, rl->rectf);
 				
 				fcol= rl->rectf; acol= rl->acolrect;
-				for(x=pa->rectx*pa->recty; x>0; x--, acol+=4, fcol+=4) {
+				for (x=pa->rectx*pa->recty; x>0; x--, acol+=4, fcol+=4) {
 					addAlphaOverFloat(fcol, acol);
 				}
 			}
 		}
 		
 		/* sun/sky */
-		if(rl->layflag & SCE_LAY_SKY)
+		if (rl->layflag & SCE_LAY_SKY)
 			atm_tile(pa, rl);
 		
 		/* sky before edge */
-		if(rl->layflag & SCE_LAY_SKY)
+		if (rl->layflag & SCE_LAY_SKY)
 			sky_tile(pa, rl);
 		
-		if(!R.test_break(R.tbh)) {
-			if(rl->layflag & SCE_LAY_EDGE) 
-				if(R.r.mode & R_EDGE)
+		if (!R.test_break(R.tbh)) {
+			if (rl->layflag & SCE_LAY_EDGE) 
+				if (R.r.mode & R_EDGE)
 					edge_enhance_add(pa, rl->rectf, edgerect);
 		}
 		
-		if(rl->passflag & SCE_PASS_VECTOR)
+		if (rl->passflag & SCE_PASS_VECTOR)
 			reset_sky_speed(pa, rl);
 		
 		/* de-premul alpha */
-		if(R.r.alphamode & R_ALPHAKEY)
+		if (R.r.alphamode & R_ALPHAKEY)
 			convert_to_key_alpha(pa, rl);
 		
-		if(edgerect) MEM_freeN(edgerect);
+		if (edgerect) MEM_freeN(edgerect);
 		edgerect= NULL;
 
-		if(pa->rectmask) {
+		if (pa->rectmask) {
 			MEM_freeN(pa->rectmask);
 			pa->rectmask= NULL;
 		}
 	}
 
 	/* display active layer */
-	rr->renrect.ymin=rr->renrect.ymax= 0;
+	rr->renrect.ymin=rr->renrect.ymax = 0;
 	rr->renlay= render_get_active_layer(&R, rr);
 	
 	MEM_freeN(pa->recto); pa->recto= NULL;
@@ -1469,38 +1469,38 @@ static void addps_sss(void *cb_handle, int obi, int facenr, int x, int y, int z)
 	RenderPart *pa= handle->pa;
 
 	/* extra border for filter gives double samples on part edges,
-	   don't use those */
-	if(x<pa->crop || x>=pa->rectx-pa->crop)
+	 * don't use those */
+	if (x<pa->crop || x>=pa->rectx-pa->crop)
 		return;
-	if(y<pa->crop || y>=pa->recty-pa->crop)
+	if (y<pa->crop || y>=pa->recty-pa->crop)
 		return;
 	
-	if(pa->rectall) {
+	if (pa->rectall) {
 		intptr_t *rs= pa->rectall + pa->rectx*y + x;
 
 		addps(&handle->psmlist, rs, obi, facenr, z, 0, 0);
 		handle->totps++;
 	}
-	if(pa->rectz) {
+	if (pa->rectz) {
 		int *rz= pa->rectz + pa->rectx*y + x;
 		int *rp= pa->rectp + pa->rectx*y + x;
 		int *ro= pa->recto + pa->rectx*y + x;
 
-		if(z < *rz) {
-			if(*rp == 0)
+		if (z < *rz) {
+			if (*rp == 0)
 				handle->totps++;
 			*rz= z;
 			*rp= facenr;
 			*ro= obi;
 		}
 	}
-	if(pa->rectbackz) {
+	if (pa->rectbackz) {
 		int *rz= pa->rectbackz + pa->rectx*y + x;
 		int *rp= pa->rectbackp + pa->rectx*y + x;
 		int *ro= pa->rectbacko + pa->rectx*y + x;
 
-		if(z >= *rz) {
-			if(*rp == 0)
+		if (z >= *rz) {
+			if (*rp == 0)
 				handle->totps++;
 			*rz= z;
 			*rp= facenr;
@@ -1518,7 +1518,7 @@ static void shade_sample_sss(ShadeSample *ssamp, Material *mat, ObjectInstanceRe
 	/* cache for shadow */
 	shi->samplenr= R.shadowsamplenr[shi->thread]++;
 	
-	if(quad) 
+	if (quad) 
 		shade_input_set_triangle_i(shi, obi, vlr, 0, 2, 3);
 	else
 		shade_input_set_triangle_i(shi, obi, vlr, 0, 1, 2);
@@ -1528,9 +1528,9 @@ static void shade_sample_sss(ShadeSample *ssamp, Material *mat, ObjectInstanceRe
 	sy = y + 0.5f;
 
 	/* we estimate the area here using shi->dxco and shi->dyco. we need to
-	   enabled shi->osatex these are filled. we compute two areas, one with
-	   the normal pointed at the camera and one with the original normal, and
-	   then clamp to avoid a too large contribution from a single pixel */
+	 * enabled shi->osatex these are filled. we compute two areas, one with
+	 * the normal pointed at the camera and one with the original normal, and
+	 * then clamp to avoid a too large contribution from a single pixel */
 	shi->osatex= 1;
 
 	copy_v3_v3(nor, shi->facenor);
@@ -1548,19 +1548,19 @@ static void shade_sample_sss(ShadeSample *ssamp, Material *mat, ObjectInstanceRe
 	shade_input_set_normals(shi);
 
 	/* we don't want flipped normals, they screw up back scattering */
-	if(shi->flippednor)
+	if (shi->flippednor)
 		shade_input_flip_normals(shi);
 
 	/* not a pretty solution, but fixes common cases */
-	if(shi->obr->ob && shi->obr->ob->transflag & OB_NEG_SCALE) {
+	if (shi->obr->ob && shi->obr->ob->transflag & OB_NEG_SCALE) {
 		negate_v3(shi->vn);
 		negate_v3(shi->vno);
 		negate_v3(shi->nmapnorm);
 	}
 
 	/* if nodetree, use the material that we are currently preprocessing
-	   instead of the node material */
-	if(shi->mat->nodetree && shi->mat->use_nodes)
+	 * instead of the node material */
+	if (shi->mat->nodetree && shi->mat->use_nodes)
 		shi->mat= mat;
 
 	/* init material vars */
@@ -1638,7 +1638,7 @@ void zbufshade_sss_tile(RenderPart *pa)
 	shade_sample_initialize(&ssamp, pa, rr->layers.first);
 	ssamp.tot= 1;
 	
-	for(rl=rr->layers.first; rl; rl=rl->next) {
+	for (rl=rr->layers.first; rl; rl=rl->next) {
 		ssamp.shi[0].lay |= rl->lay;
 		ssamp.shi[0].layflag |= rl->layflag;
 		ssamp.shi[0].passflag |= rl->passflag;
@@ -1655,7 +1655,7 @@ void zbufshade_sss_tile(RenderPart *pa)
 	/* create the pixelstrs to be used later */
 	zbuffer_sss(pa, lay, &handle, addps_sss);
 
-	if(handle.totps==0) {
+	if (handle.totps==0) {
 		zbufshade_sss_free(pa);
 		return;
 	}
@@ -1668,13 +1668,13 @@ void zbufshade_sss_tile(RenderPart *pa)
 
 #if 0
 	/* create ISB (does not work currently!) */
-	if(re->r.mode & R_SHADOW)
+	if (re->r.mode & R_SHADOW)
 		ISB_create(pa, NULL);
 #endif
 
-	if(display) {
+	if (display) {
 		/* initialize scanline updates for main thread */
-		rr->renrect.ymin= 0;
+		rr->renrect.ymin = 0;
 		rr->renlay= rl;
 	}
 	
@@ -1691,15 +1691,15 @@ void zbufshade_sss_tile(RenderPart *pa)
 #endif
 	totpoint= 0;
 
-	for(y=pa->disprect.ymin; y<pa->disprect.ymax; y++, rr->renrect.ymax++) {
-		for(x=pa->disprect.xmin; x<pa->disprect.xmax; x++, fcol+=4) {
+	for (y=pa->disprect.ymin; y<pa->disprect.ymax; y++, rr->renrect.ymax++) {
+		for (x=pa->disprect.xmin; x<pa->disprect.xmax; x++, fcol+=4) {
 			/* per pixel fixed seed */
 			BLI_thread_srandom(pa->thread, seed++);
 			
 #if 0
-			if(rs) {
+			if (rs) {
 				/* for each sample in this pixel, shade it */
-				for(ps=(PixStr*)*rs; ps; ps=ps->next) {
+				for (ps=(PixStr*)*rs; ps; ps=ps->next) {
 					ObjectInstanceRen *obi= &re->objectinstance[ps->obi];
 					ObjectRen *obr= obi->obr;
 					vlr= RE_findOrAddVlak(obr, (ps->facenr-1) & RE_QUAD_MASK);
@@ -1718,8 +1718,8 @@ void zbufshade_sss_tile(RenderPart *pa)
 				rs++;
 			}
 #else
-			if(rp) {
-				if(*rp != 0) {
+			if (rp) {
+				if (*rp != 0) {
 					ObjectInstanceRen *obi= &re->objectinstance[*ro];
 					ObjectRen *obr= obi->obr;
 
@@ -1738,8 +1738,8 @@ void zbufshade_sss_tile(RenderPart *pa)
 				rp++; rz++; ro++;
 			}
 
-			if(rbp) {
-				if(*rbp != 0 && !(*rbp == *(rp-1) && *rbo == *(ro-1))) {
+			if (rbp) {
+				if (*rbp != 0 && !(*rbp == *(rp-1) && *rbo == *(ro-1))) {
 					ObjectInstanceRen *obi= &re->objectinstance[*rbo];
 					ObjectRen *obr= obi->obr;
 
@@ -1763,12 +1763,12 @@ void zbufshade_sss_tile(RenderPart *pa)
 #endif
 		}
 
-		if(y&1)
-			if(re->test_break(re->tbh)) break; 
+		if (y&1)
+			if (re->test_break(re->tbh)) break; 
 	}
 
 	/* note: after adding we do not free these arrays, sss keeps them */
-	if(totpoint > 0) {
+	if (totpoint > 0) {
 		sss_add_points(re, co, color, area, totpoint);
 	}
 	else {
@@ -1778,13 +1778,13 @@ void zbufshade_sss_tile(RenderPart *pa)
 	}
 	
 #if 0
-	if(re->r.mode & R_SHADOW)
+	if (re->r.mode & R_SHADOW)
 		ISB_free(pa);
 #endif
 		
-	if(display) {
+	if (display) {
 		/* display active layer */
-		rr->renrect.ymin=rr->renrect.ymax= 0;
+		rr->renrect.ymin=rr->renrect.ymax = 0;
 		rr->renlay= render_get_active_layer(&R, rr);
 	}
 	
@@ -1806,37 +1806,37 @@ static void renderhalo_post(RenderResult *rr, float *rectf, HaloRen *har)	/* pos
 	har->miny= miny= haloys - har->rad/R.ycor;
 	har->maxy= maxy= haloys + har->rad/R.ycor;
 	
-	if(maxy<0);
-	else if(rr->recty<miny);
+	if (maxy<0);
+	else if (rr->recty<miny);
 	else {
 		minx= floor(haloxs-har->rad);
 		maxx= ceil(haloxs+har->rad);
 			
-		if(maxx<0);
-		else if(rr->rectx<minx);
+		if (maxx<0);
+		else if (rr->rectx<minx);
 		else {
 		
-			if(minx<0) minx= 0;
-			if(maxx>=rr->rectx) maxx= rr->rectx-1;
-			if(miny<0) miny= 0;
-			if(maxy>rr->recty) maxy= rr->recty;
+			if (minx<0) minx= 0;
+			if (maxx>=rr->rectx) maxx= rr->rectx-1;
+			if (miny<0) miny= 0;
+			if (maxy>rr->recty) maxy= rr->recty;
 	
 			rectft= rectf+ 4*rr->rectx*miny;
 
-			for(y=miny; y<maxy; y++) {
+			for (y=miny; y<maxy; y++) {
 	
 				rtf= rectft+4*minx;
 				
 				yn= (y - haloys)*R.ycor;
 				ysq= yn*yn;
 				
-				for(x=minx; x<=maxx; x++) {
+				for (x=minx; x<=maxx; x++) {
 					xn= x - haloxs;
 					xsq= xn*xn;
 					dist= xsq+ysq;
-					if(dist<har->radsq) {
+					if (dist<har->radsq) {
 						
-						if(shadeHaloFloat(har, colf, 0x7FFFFF, dist, xn, yn, har->flarec))
+						if (shadeHaloFloat(har, colf, 0x7FFFFF, dist, xn, yn, har->flarec))
 							addalphaAddfacFloat(rtf, colf, har->add);
 					}
 					rtf+=4;
@@ -1844,7 +1844,7 @@ static void renderhalo_post(RenderResult *rr, float *rectf, HaloRen *har)	/* pos
 	
 				rectft+= 4*rr->rectx;
 				
-				if(R.test_break(R.tbh)) break; 
+				if (R.test_break(R.tbh)) break; 
 			}
 		}
 	}
@@ -1885,7 +1885,7 @@ static void renderflare(RenderResult *rr, float *rectf, HaloRen *har)
 	/* next halo's: the flares */
 	rc= hashvectf + ma->seed2;
 	
-	for(b=1; b<har->flarec; b++) {
+	for (b=1; b<har->flarec; b++) {
 		
 		fla.r= fabs(rc[0]);
 		fla.g= fabs(rc[1]);
@@ -1898,7 +1898,7 @@ static void renderflare(RenderResult *rr, float *rectf, HaloRen *har)
 
 		fla.rad= ma->subsize*sqrtf(fabs(2.0f*har->rad*rc[4]));
 		
-		if(type==3) {
+		if (type==3) {
 			fla.rad*= 3.0f;
 			fla.rad+= R.rectx/10;
 		}
@@ -1912,16 +1912,16 @@ static void renderflare(RenderResult *rr, float *rectf, HaloRen *har)
 		fla.xs= R.winx/2 + vec[0] + (1.2f+rc[8])*R.rectx*vec[0]/vec[2];
 		fla.ys= R.winy/2 + vec[1] + (1.2f+rc[8])*R.rectx*vec[1]/vec[2];
 
-		if(R.flag & R_SEC_FIELD) {
-			if(R.r.mode & R_ODDFIELD) fla.ys += 0.5f;
+		if (R.flag & R_SEC_FIELD) {
+			if (R.r.mode & R_ODDFIELD) fla.ys += 0.5f;
 			else fla.ys -= 0.5f;
 		}
-		if(type & 1) fla.type= HA_FLARECIRC;
+		if (type & 1) fla.type= HA_FLARECIRC;
 		else fla.type= 0;
 		renderhalo_post(rr, rectf, &fla);
 
 		fla.alfa*= 0.5f;
-		if(type & 2) fla.type= HA_FLARECIRC;
+		if (type & 2) fla.type= HA_FLARECIRC;
 		else fla.type= 0;
 		renderhalo_post(rr, rectf, &fla);
 		
@@ -1938,11 +1938,11 @@ void add_halo_flare(Render *re)
 	int a, mode, do_draw=0;
 	
 	/* for now, we get the first renderlayer in list with halos set */
-	for(rl= rr->layers.first; rl; rl= rl->next)
-		if(rl->layflag & SCE_LAY_HALO)
+	for (rl= rr->layers.first; rl; rl= rl->next)
+		if (rl->layflag & SCE_LAY_HALO)
 			break;
 
-	if(rl==NULL || rl->rectf==NULL)
+	if (rl==NULL || rl->rectf==NULL)
 		return;
 	
 	mode= R.r.mode;
@@ -1950,16 +1950,16 @@ void add_halo_flare(Render *re)
 	
 	project_renderdata(&R, projectverto, 0, 0, 0);
 	
-	for(a=0; a<R.tothalo; a++) {
+	for (a=0; a<R.tothalo; a++) {
 		har= R.sortedhalos[a];
 		
-		if(har->flarec) {
+		if (har->flarec) {
 			do_draw= 1;
 			renderflare(rr, rl->rectf, har);
 		}
 	}
 
-	if(do_draw) {
+	if (do_draw) {
 		/* weak... the display callback wants an active renderlayer pointer... */
 		rr->renlay= rl;
 		re->display_draw(re->ddh, rr, NULL);
@@ -1998,7 +1998,7 @@ typedef struct BakeShade {
 
 static void bake_set_shade_input(ObjectInstanceRen *obi, VlakRen *vlr, ShadeInput *shi, int quad, int UNUSED(isect), int x, int y, float u, float v)
 {
-	if(quad) 
+	if (quad) 
 		shade_input_set_triangle_i(shi, obi, vlr, 0, 2, 3);
 	else
 		shade_input_set_triangle_i(shi, obi, vlr, 0, 1, 2);
@@ -2017,7 +2017,7 @@ static void bake_set_shade_input(ObjectInstanceRen *obi, VlakRen *vlr, ShadeInpu
 	shade_input_set_normals(shi);
 
 	/* no normal flip */
-	if(shi->flippednor)
+	if (shi->flippednor)
 		shade_input_flip_normals(shi);
 
 	/* set up view vector to look right at the surface (note that the normal
@@ -2036,10 +2036,10 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua
 	
 	shade_input_init_material(shi);
 	
-	if(bs->type==RE_BAKE_AO) {
+	if (bs->type==RE_BAKE_AO) {
 		ambient_occlusion(shi);
 
-		if(R.r.bake_flag & R_BAKE_NORMALIZE) {
+		if (R.r.bake_flag & R_BAKE_NORMALIZE) {
 			copy_v3_v3(shr.combined, shi->ao);
 		}
 		else {
@@ -2054,28 +2054,28 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua
 		shade_input_set_shade_texco(shi);
 		
 		/* only do AO for a full bake (and obviously AO bakes)
-			AO for light bakes is a leftover and might not be needed */
-		if( ELEM3(bs->type, RE_BAKE_ALL, RE_BAKE_AO, RE_BAKE_LIGHT))
+		 * AO for light bakes is a leftover and might not be needed */
+		if ( ELEM3(bs->type, RE_BAKE_ALL, RE_BAKE_AO, RE_BAKE_LIGHT))
 			shade_samples_do_AO(ssamp);
 		
-		if(shi->mat->nodetree && shi->mat->use_nodes) {
+		if (shi->mat->nodetree && shi->mat->use_nodes) {
 			ntreeShaderExecTree(shi->mat->nodetree, shi, &shr);
 			shi->mat= vlr->mat;		/* shi->mat is being set in nodetree */
 		}
 		else
 			shade_material_loop(shi, &shr);
 		
-		if(bs->type==RE_BAKE_NORMALS) {
+		if (bs->type==RE_BAKE_NORMALS) {
 			float nor[3];
 
 			copy_v3_v3(nor, shi->vn);
 
-			if(R.r.bake_normal_space == R_BAKE_SPACE_CAMERA);
-			else if(R.r.bake_normal_space == R_BAKE_SPACE_TANGENT) {
+			if (R.r.bake_normal_space == R_BAKE_SPACE_CAMERA);
+			else if (R.r.bake_normal_space == R_BAKE_SPACE_TANGENT) {
 				float mat[3][3], imat[3][3];
 
 				/* bitangent */
-				if(tvn && ttang) {
+				if (tvn && ttang) {
 					copy_v3_v3(mat[0], ttang);
 					cross_v3_v3v3(mat[1], tvn, ttang);
 					mul_v3_fl(mat[1], ttang[3]);
@@ -2091,9 +2091,9 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua
 				invert_m3_m3(imat, mat);
 				mul_m3_v3(imat, nor);
 			}
-			else if(R.r.bake_normal_space == R_BAKE_SPACE_OBJECT)
+			else if (R.r.bake_normal_space == R_BAKE_SPACE_OBJECT)
 				mul_mat3_m4_v3(ob->imat_ren, nor); /* ob->imat_ren includes viewinv! */
-			else if(R.r.bake_normal_space == R_BAKE_SPACE_WORLD)
+			else if (R.r.bake_normal_space == R_BAKE_SPACE_WORLD)
 				mul_mat3_m4_v3(R.viewinv, nor);
 
 			normalize_v3(nor); /* in case object has scaling */
@@ -2108,47 +2108,47 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua
 			shr.combined[1]= nor[1]/2.0f + 0.5f;
 			shr.combined[2]= nor[2]/2.0f + 0.5f;
 		}
-		else if(bs->type==RE_BAKE_TEXTURE) {
+		else if (bs->type==RE_BAKE_TEXTURE) {
 			shr.combined[0]= shi->r;
 			shr.combined[1]= shi->g;
 			shr.combined[2]= shi->b;
 			shr.alpha = shi->alpha;
 		}
-		else if(bs->type==RE_BAKE_SHADOW) {
+		else if (bs->type==RE_BAKE_SHADOW) {
 			copy_v3_v3(shr.combined, shr.shad);
 			shr.alpha = shi->alpha;
 		}
-		else if(bs->type==RE_BAKE_SPEC_COLOR) {
+		else if (bs->type==RE_BAKE_SPEC_COLOR) {
 			shr.combined[0]= shi->specr;
 			shr.combined[1]= shi->specg;
 			shr.combined[2]= shi->specb;
 			shr.alpha = 1.0f;
 		}
-		else if(bs->type==RE_BAKE_SPEC_INTENSITY) {
+		else if (bs->type==RE_BAKE_SPEC_INTENSITY) {
 			shr.combined[0]=
 			shr.combined[1]=
 			shr.combined[2]= shi->spec;
 			shr.alpha = 1.0f;
 		}
-		else if(bs->type==RE_BAKE_MIRROR_COLOR) {
+		else if (bs->type==RE_BAKE_MIRROR_COLOR) {
 			shr.combined[0]= shi->mirr;
 			shr.combined[1]= shi->mirg;
 			shr.combined[2]= shi->mirb;
 			shr.alpha = 1.0f;
 		}
-		else if(bs->type==RE_BAKE_MIRROR_INTENSITY) {
+		else if (bs->type==RE_BAKE_MIRROR_INTENSITY) {
 			shr.combined[0]=
 			shr.combined[1]=
 			shr.combined[2]= shi->ray_mirror;
 			shr.alpha = 1.0f;
 		}
-		else if(bs->type==RE_BAKE_ALPHA) {
+		else if (bs->type==RE_BAKE_ALPHA) {
 			shr.combined[0]=
 			shr.combined[1]=
 			shr.combined[2]= shi->alpha;
 			shr.alpha = 1.0f;
 		}
-		else if(bs->type==RE_BAKE_EMIT) {
+		else if (bs->type==RE_BAKE_EMIT) {
 			shr.combined[0]=
 			shr.combined[1]=
 			shr.combined[2]= shi->emit;
@@ -2156,12 +2156,13 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua
 		}
 	}
 	
-	if(bs->rect_float) {
+	if (bs->rect_float) {
 		float *col= bs->rect_float + 4*(bs->rectx*y + x);
 		copy_v3_v3(col, shr.combined);
 		if (bs->type==RE_BAKE_ALL || bs->type==RE_BAKE_TEXTURE) {
 			col[3]= shr.alpha;
-		} else {
+		}
+		else {
 			col[3]= 1.0;
 		}
 	}
@@ -2177,7 +2178,8 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua
 		
 		if (ELEM(bs->type, RE_BAKE_ALL, RE_BAKE_TEXTURE)) {
 			col[3]= FTOCHAR(shr.alpha);
-		} else {
+		}
+		else {
 			col[3]= 255;
 		}
 	}
@@ -2192,17 +2194,19 @@ static void bake_displacement(void *handle, ShadeInput *UNUSED(shi), float dist,
 	BakeShade *bs= handle;
 	float disp;
 	
-	if(R.r.bake_flag & R_BAKE_NORMALIZE && R.r.bake_maxdist) {
+	if (R.r.bake_flag & R_BAKE_NORMALIZE && R.r.bake_maxdist) {
 		disp = (dist+R.r.bake_maxdist) / (R.r.bake_maxdist*2); /* alter the range from [-bake_maxdist, bake_maxdist] to [0, 1]*/
-	} else {
+	}
+	else {
 		disp = 0.5f + dist; /* alter the range from [-0.5,0.5] to [0,1]*/
 	}
 	
-	if(bs->rect_float) {
+	if (bs->rect_float) {
 		float *col= bs->rect_float + 4*(bs->rectx*y + x);
 		col[0] = col[1] = col[2] = disp;
 		col[3]= 1.0f;
-	} else {	
+	}
+	else {
 		char *col= (char *)(bs->rect + bs->rectx*y + x);
 		col[0] = col[1] = col[2] = FTOCHAR(disp);
 		col[3]= 255;
@@ -2218,7 +2222,7 @@ static int bake_intersect_tree(RayObject* raytree, Isect* isect, float *start, f
 	int hit;
 
 	/* might be useful to make a user setting for maxsize*/
-	if(R.r.bake_maxdist > 0.0f)
+	if (R.r.bake_maxdist > 0.0f)
 		maxdist= R.r.bake_maxdist;
 	else
 		maxdist= RE_RAYTRACE_MAXDIST + R.r.bake_biasdist;
@@ -2231,7 +2235,7 @@ static int bake_intersect_tree(RayObject* raytree, Isect* isect, float *start, f
 	isect->dist = maxdist;
 
 	hit = RE_rayobject_raycast(raytree, isect);
-	if(hit) {
+	if (hit) {
 		madd_v3_v3v3fl(hitco, isect->start, isect->dir, isect->dist);
 
 		*dist= isect->dist;
@@ -2245,7 +2249,7 @@ static void bake_set_vlr_dxyco(BakeShade *bs, float *uv1, float *uv2, float *uv3
 	VlakRen *vlr= bs->vlr;
 	float A, d1, d2, d3, *v1, *v2, *v3;
 
-	if(bs->quad) {
+	if (bs->quad) {
 		v1= vlr->v1->co;
 		v2= vlr->v3->co;
 		v3= vlr->v4->co;
@@ -2261,7 +2265,7 @@ static void bake_set_vlr_dxyco(BakeShade *bs, float *uv1, float *uv2, float *uv3
 	 * then taking u and v partial derivatives to get dxco and dyco */
 	A= (uv2[0] - uv1[0])*(uv3[1] - uv1[1]) - (uv3[0] - uv1[0])*(uv2[1] - uv1[1]);
 
-	if(fabsf(A) > FLT_EPSILON) {
+	if (fabsf(A) > FLT_EPSILON) {
 		A= 0.5f/A;
 
 		d1= uv2[1] - uv3[1];
@@ -2283,7 +2287,7 @@ static void bake_set_vlr_dxyco(BakeShade *bs, float *uv1, float *uv2, float *uv3
 		bs->dyco[0]= bs->dyco[1]= bs->dyco[2]= 0.0f;
 	}
 
-	if(bs->obi->flag & R_TRANSFORMED) {
+	if (bs->obi->flag & R_TRANSFORMED) {
 		mul_m3_v3(bs->obi->nmat, bs->dxco);
 		mul_m3_v3(bs->obi->nmat, bs->dyco);
 	}
@@ -2301,11 +2305,11 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v)
 	ShadeInput *shi= ssamp->shi;
 	
 	/* fast threadsafe break test */
-	if(R.test_break(R.tbh))
+	if (R.test_break(R.tbh))
 		return;
 	
 	/* setup render coordinates */
-	if(bs->quad) {
+	if (bs->quad) {
 		v1= vlr->v1->co;
 		v2= vlr->v3->co;
 		v3= vlr->v4->co;
@@ -2323,7 +2327,7 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v)
 	shi->co[1]= l*v3[1]+u*v1[1]+v*v2[1];
 	shi->co[2]= l*v3[2]+u*v1[2]+v*v2[2];
 	
-	if(obi->flag & R_TRANSFORMED)
+	if (obi->flag & R_TRANSFORMED)
 		mul_m4_v3(obi->mat, shi->co);
 	
 	copy_v3_v3(shi->dxco, bs->dxco);
@@ -2332,14 +2336,14 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v)
 	quad= bs->quad;
 	bake_set_shade_input(obi, vlr, shi, quad, 0, x, y, u, v);
 
-	if(bs->type==RE_BAKE_NORMALS && R.r.bake_normal_space==R_BAKE_SPACE_TANGENT) {
+	if (bs->type==RE_BAKE_NORMALS && R.r.bake_normal_space==R_BAKE_SPACE_TANGENT) {
 		shade_input_set_shade_texco(shi);
 		copy_v3_v3(tvn, shi->nmapnorm);
 		copy_v4_v4(ttang, shi->nmaptang);
 	}
 
 	/* if we are doing selected to active baking, find point on other face */
-	if(bs->actob) {
+	if (bs->actob) {
 		Isect isec, minisec;
 		float co[3], minco[3], dist, mindist=0.0f;
 		int hit, sign, dir=1;
@@ -2351,7 +2355,7 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v)
 		
 		copy_v3_v3(bs->dir, shi->vn);
 		
-		for(sign=-1; sign<=1; sign+=2) {
+		for (sign=-1; sign<=1; sign+=2) {
 			memset(&isec, 0, sizeof(isec));
 			isec.mode= RE_RAY_MIRROR;
 
@@ -2361,8 +2365,8 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v)
 			isec.check = RE_CHECK_VLR_BAKE;
 			isec.skip = RE_SKIP_VLR_NEIGHBOUR;
 			
-			if(bake_intersect_tree(R.raytree, &isec, shi->co, shi->vn, sign, co, &dist)) {
-				if(!hit || len_squared_v3v3(shi->co, co) < len_squared_v3v3(shi->co, minco)) {
+			if (bake_intersect_tree(R.raytree, &isec, shi->co, shi->vn, sign, co, &dist)) {
+				if (!hit || len_squared_v3v3(shi->co, co) < len_squared_v3v3(shi->co, minco)) {
 					minisec= isec;
 					mindist= dist;
 					copy_v3_v3(minco, co);
@@ -2373,7 +2377,7 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v)
 		}
 
 		if (bs->type==RE_BAKE_DISPLACEMENT) {
-			if(hit)
+			if (hit)
 				bake_displacement(handle, shi, (dir==-1)? mindist:-mindist, x, y);
 			else
 				bake_displacement(handle, shi, 0.0f, x, y);
@@ -2381,7 +2385,7 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v)
 		}
 
 		/* if hit, we shade from the new point, otherwise from point one starting face */
-		if(hit) {
+		if (hit) {
 			obi= (ObjectInstanceRen*)minisec.hit.ob;
 			vlr= (VlakRen*)minisec.hit.face;
 			quad= (minisec.isect == 2);
@@ -2393,7 +2397,7 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v)
 		}
 	}
 
-	if(bs->type==RE_BAKE_NORMALS && R.r.bake_normal_space==R_BAKE_SPACE_TANGENT)
+	if (bs->type==RE_BAKE_NORMALS && R.r.bake_normal_space==R_BAKE_SPACE_TANGENT)
 		bake_shade(handle, ob, shi, quad, x, y, u, v, tvn, ttang);
 	else
 		bake_shade(handle, ob, shi, quad, x, y, u, v, 0, 0);
@@ -2407,7 +2411,7 @@ static int get_next_bake_face(BakeShade *bs)
 	static int v= 0, vdone= 0;
 	static ObjectInstanceRen *obi= NULL;
 	
-	if(bs==NULL) {
+	if (bs==NULL) {
 		vlr= NULL;
 		v= vdone= 0;
 		obi= R.instancetable.first;
@@ -2416,44 +2420,44 @@ static int get_next_bake_face(BakeShade *bs)
 	
 	BLI_lock_thread(LOCK_CUSTOM1);	
 
-	for(; obi; obi=obi->next, v=0) {
+	for (; obi; obi=obi->next, v=0) {
 		obr= obi->obr;
 
-		for(; v<obr->totvlak; v++) {
+		for (; v<obr->totvlak; v++) {
 			vlr= RE_findOrAddVlak(obr, v);
 
-			if((bs->actob && bs->actob == obr->ob) || (!bs->actob && (obr->ob->flag & SELECT))) {
+			if ((bs->actob && bs->actob == obr->ob) || (!bs->actob && (obr->ob->flag & SELECT))) {
 				tface= RE_vlakren_get_tface(obr, vlr, obr->bakemtface, NULL, 0);
 
-				if(tface && tface->tpage) {
+				if (tface && tface->tpage) {
 					Image *ima= tface->tpage;
 					ImBuf *ibuf= BKE_image_get_ibuf(ima, 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)
+					if (ibuf==NULL)
 						continue;
 					
-					if(ibuf->rect==NULL && ibuf->rect_float==NULL)
+					if (ibuf->rect==NULL && ibuf->rect_float==NULL)
 						continue;
 					
-					if(ibuf->rect_float && !(ibuf->channels==0 || ibuf->channels==4))
+					if (ibuf->rect_float && !(ibuf->channels==0 || ibuf->channels==4))
 						continue;
 					
-					if(ima->flag & IMA_USED_FOR_RENDER) {
+					if (ima->flag & IMA_USED_FOR_RENDER) {
 						ima->id.flag &= ~LIB_DOIT;
 						continue;
 					}
 					
 					/* find the image for the first time? */
-					if(ima->id.flag & LIB_DOIT) {
+					if (ima->id.flag & LIB_DOIT) {
 						ima->id.flag &= ~LIB_DOIT;
 						
 						/* we either fill in float or char, this ensures things go fine */
-						if(ibuf->rect_float)
+						if (ibuf->rect_float)
 							imb_freerectImBuf(ibuf);
 						/* clear image */
-						if(R.r.bake_flag & R_BAKE_CLEAR)
+						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 */
@@ -2489,7 +2493,7 @@ static void shade_tface(BakeShade *bs)
 	int a, i1, i2, i3;
 	
 	/* check valid zspan */
-	if(ima!=bs->ima) {
+	if (ima!=bs->ima) {
 		bs->ima= ima;
 		bs->ibuf= BKE_image_get_ibuf(ima, NULL);
 		/* note, these calls only free/fill contents of zspan struct, not zspan itself */
@@ -2510,13 +2514,14 @@ static void shade_tface(BakeShade *bs)
 				bs->ibuf->userdata = (void *)MEM_callocN(sizeof(char)*bs->rectx*bs->recty, "BakeMask");
 			bs->rect_mask= (char *)bs->ibuf->userdata;
 			BLI_unlock_thread(LOCK_CUSTOM1);
-		} else {
+		}
+		else {
 			bs->rect_mask= (char *)bs->ibuf->userdata;
 		}
 	}
 	
 	/* get pixel level vertex coordinates */
-	for(a=0; a<4; a++) {
+	for (a=0; a<4; a++) {
 		/* Note, workaround for pixel aligned UVs which are common and can screw up our intersection tests
 		 * where a pixel gets in between 2 faces or the middle of a quad,
 		 * camera aligned quads also have this problem but they are less common.
@@ -2531,7 +2536,7 @@ static void shade_tface(BakeShade *bs)
 	bake_set_vlr_dxyco(bs, vec[i1], vec[i2], vec[i3]);
 	zspan_scanconvert(bs->zspan, bs, vec[i1], vec[i2], vec[i3], do_bake_shade);
 	
-	if(vlr->v4) {
+	if (vlr->v4) {
 		bs->quad= 1;
 		bake_set_vlr_dxyco(bs, vec[0], vec[2], vec[3]);
 		zspan_scanconvert(bs->zspan, bs, vec[0], vec[2], vec[3], do_bake_shade);
@@ -2542,16 +2547,16 @@ static void *do_bake_thread(void *bs_v)
 {
 	BakeShade *bs= bs_v;
 	
-	while(get_next_bake_face(bs)) {
+	while (get_next_bake_face(bs)) {
 		shade_tface(bs);
 		
 		/* fast threadsafe break test */
-		if(R.test_break(R.tbh))
+		if (R.test_break(R.tbh))
 			break;
 
 		/* access is not threadsafe but since its just true/false probably ok
 		 * only used for interactive baking */
-		if(bs->do_update)
+		if (bs->do_update)
 			*bs->do_update= TRUE;
 	}
 	bs->ready= 1;
@@ -2565,16 +2570,16 @@ void RE_bake_ibuf_filter(ImBuf *ibuf, char *mask, const int filter)
 	const short is_new_alpha= (ibuf->planes != R_IMF_PLANES_RGBA) && BKE_alphatest_ibuf(ibuf);
 
 	/* Margin */
-	if(filter) {
+	if (filter) {
 		IMB_filter_extend(ibuf, mask, filter);
 	}
 
 	/* if the bake results in new alpha then change the image setting */
-	if(is_new_alpha) {
+	if (is_new_alpha) {
 		ibuf->planes= R_IMF_PLANES_RGBA;
 	}
 	else {
-		if(filter && ibuf->planes != R_IMF_PLANES_RGBA) {
+		if (filter && ibuf->planes != R_IMF_PLANES_RGBA) {
 			/* clear alpha added by filtering */
 			IMB_rectfill_alpha(ibuf, 1.0f);
 		}
@@ -2603,13 +2608,13 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
 		usemask = 1;
 	
 	/* baker uses this flag to detect if image was initialized */
-	for(ima= G.main->image.first; ima; ima= ima->id.next) {
+	for (ima= G.main->image.first; ima; ima= ima->id.next) {
 		ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
 		ima->id.flag |= LIB_DOIT;
 		ima->flag&= ~IMA_USED_FOR_RENDER;
-		if(ibuf) {
+		if (ibuf) {
 			ibuf->userdata = NULL; /* use for masking if needed */
-			if(ibuf->rect_float)
+			if (ibuf->rect_float)
 				ibuf->profile = IB_PROFILE_LINEAR_RGB;
 		}
 	}
@@ -2619,13 +2624,14 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
 	handles= MEM_callocN(sizeof(BakeShade)*re->r.threads, "BakeShade");
 
 	/* get the threads running */
-	for(a=0; a<re->r.threads; a++) {
+	for (a=0; a<re->r.threads; a++) {
 		/* set defaults in handles */
 		handles[a].ssamp.shi[0].lay= re->lay;
 		
 		if (type==RE_BAKE_SHADOW) {
 			handles[a].ssamp.shi[0].passflag= SCE_PASS_SHADOW;
-		} else {
+		}
+		else {
 			handles[a].ssamp.shi[0].passflag= SCE_PASS_COMBINED;
 		}
 		handles[a].ssamp.shi[0].combinedflag= ~(SCE_PASS_SPEC);
@@ -2645,30 +2651,30 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
 	
 	/* wait for everything to be done */
 	a= 0;
-	while(a!=re->r.threads) {
+	while (a!=re->r.threads) {
 		PIL_sleep_ms(50);
 
 		/* calculate progress */
-		for(vdone=0, a=0; a<re->r.threads; a++)
+		for (vdone=0, a=0; a<re->r.threads; a++)
 			vdone+= handles[a].vdone;
 		if (progress)
 			*progress = (float)(vdone / (float)re->totvlak);
 		
-		for(a=0; a<re->r.threads; a++) {
-			if(handles[a].ready==0)
+		for (a=0; a<re->r.threads; a++) {
+			if (handles[a].ready==0)
 				break;
 		}
 	}
 	
 	/* filter and refresh images */
-	for(ima= G.main->image.first; ima; ima= ima->id.next) {
-		if((ima->id.flag & LIB_DOIT)==0) {
+	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);
 
-			if(ima->flag & IMA_USED_FOR_RENDER)
+			if (ima->flag & IMA_USED_FOR_RENDER)
 				result= BAKE_RESULT_FEEDBACK_LOOP;
 
-			if(!ibuf)
+			if (!ibuf)
 				continue;
 
 			RE_bake_ibuf_filter(ibuf, (char *)ibuf->userdata, re->r.bake_filter);
@@ -2679,7 +2685,7 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
 	}
 	
 	/* calculate return value */
-	for(a=0; a<re->r.threads; a++) {
+	for (a=0; a<re->r.threads; a++) {
 		zbuf_free_span(handles[a].zspan);
 		MEM_freeN(handles[a].zspan);
 	}
@@ -2688,7 +2694,7 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
 	
 	BLI_end_threads(&threads);
 
-	if(vdone==0)
+	if (vdone==0)
 		result= BAKE_RESULT_NO_OBJECTS;
 
 	return result;
diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c
index 43761be..6a0c8e3 100644
--- a/source/blender/render/intern/source/renderdatabase.c
+++ b/source/blender/render/intern/source/renderdatabase.c
@@ -90,11 +90,11 @@
 
 /* ------------------------------------------------------------------------- */
 
-/* More dynamic allocation of options for render vertices and faces, so we dont
-   have to reserve this space inside vertices.
-   Important; vertices and faces, should have been created already (to get tables
-   checked) that's a reason why the calls demand VertRen/VlakRen * as arg, not
-   the index */
+/* More dynamic allocation of options for render vertices and faces, so we don't
+ * have to reserve this space inside vertices.
+ * Important; vertices and faces, should have been created already (to get tables
+ * checked) that's a reason why the calls demand VertRen/VlakRen * as arg, not
+ * the index */
 
 /* NOTE! the hardcoded table size 256 is used still in code for going quickly over vertices/faces */
 
@@ -120,8 +120,8 @@ float *RE_vertren_get_sticky(ObjectRen *obr, VertRen *ver, int verify)
 	int nr= ver->index>>8;
 	
 	sticky= obr->vertnodes[nr].sticky;
-	if(sticky==NULL) {
-		if(verify) 
+	if (sticky==NULL) {
+		if (verify) 
 			sticky= obr->vertnodes[nr].sticky= MEM_mallocN(256*RE_STICKY_ELEMS*sizeof(float), "sticky table");
 		else
 			return NULL;
@@ -135,8 +135,8 @@ float *RE_vertren_get_stress(ObjectRen *obr, VertRen *ver, int verify)
 	int nr= ver->index>>8;
 	
 	stress= obr->vertnodes[nr].stress;
-	if(stress==NULL) {
-		if(verify) 
+	if (stress==NULL) {
+		if (verify) 
 			stress= obr->vertnodes[nr].stress= MEM_mallocN(256*RE_STRESS_ELEMS*sizeof(float), "stress table");
 		else
 			return NULL;
@@ -151,8 +151,8 @@ float *RE_vertren_get_rad(ObjectRen *obr, VertRen *ver, int verify)
 	int nr= ver->index>>8;
 	
 	rad= obr->vertnodes[nr].rad;
-	if(rad==NULL) {
-		if(verify) 
+	if (rad==NULL) {
+		if (verify) 
 			rad= obr->vertnodes[nr].rad= MEM_callocN(256*RE_RAD_ELEMS*sizeof(float), "rad table");
 		else
 			return NULL;
@@ -166,8 +166,8 @@ float *RE_vertren_get_strand(ObjectRen *obr, VertRen *ver, int verify)
 	int nr= ver->index>>8;
 	
 	strand= obr->vertnodes[nr].strand;
-	if(strand==NULL) {
-		if(verify) 
+	if (strand==NULL) {
+		if (verify) 
 			strand= obr->vertnodes[nr].strand= MEM_mallocN(256*RE_STRAND_ELEMS*sizeof(float), "strand table");
 		else
 			return NULL;
@@ -182,8 +182,8 @@ float *RE_vertren_get_tangent(ObjectRen *obr, VertRen *ver, int verify)
 	int nr= ver->index>>8;
 	
 	tangent= obr->vertnodes[nr].tangent;
-	if(tangent==NULL) {
-		if(verify) 
+	if (tangent==NULL) {
+		if (verify) 
 			tangent= obr->vertnodes[nr].tangent= MEM_callocN(256*RE_TANGENT_ELEMS*sizeof(float), "tangent table");
 		else
 			return NULL;
@@ -199,8 +199,8 @@ float *RE_vertren_get_winspeed(ObjectInstanceRen *obi, VertRen *ver, int verify)
 	int totvector;
 	
 	winspeed= obi->vectors;
-	if(winspeed==NULL) {
-		if(verify) {
+	if (winspeed==NULL) {
+		if (verify) {
 			totvector= obi->obr->totvert + obi->obr->totstrand;
 			winspeed= obi->vectors= MEM_callocN(totvector*RE_WINSPEED_ELEMS*sizeof(float), "winspeed table");
 		}
@@ -220,27 +220,27 @@ VertRen *RE_vertren_copy(ObjectRen *obr, VertRen *ver)
 	v1->index= index;
 	
 	fp1= RE_vertren_get_sticky(obr, ver, 0);
-	if(fp1) {
+	if (fp1) {
 		fp2= RE_vertren_get_sticky(obr, v1, 1);
 		memcpy(fp2, fp1, RE_STICKY_ELEMS*sizeof(float));
 	}
 	fp1= RE_vertren_get_stress(obr, ver, 0);
-	if(fp1) {
+	if (fp1) {
 		fp2= RE_vertren_get_stress(obr, v1, 1);
 		memcpy(fp2, fp1, RE_STRESS_ELEMS*sizeof(float));
 	}
 	fp1= RE_vertren_get_rad(obr, ver, 0);
-	if(fp1) {
+	if (fp1) {
 		fp2= RE_vertren_get_rad(obr, v1, 1);
 		memcpy(fp2, fp1, RE_RAD_ELEMS*sizeof(float));
 	}
 	fp1= RE_vertren_get_strand(obr, ver, 0);
-	if(fp1) {
+	if (fp1) {
 		fp2= RE_vertren_get_strand(obr, v1, 1);
 		memcpy(fp2, fp1, RE_STRAND_ELEMS*sizeof(float));
 	}
 	fp1= RE_vertren_get_tangent(obr, ver, 0);
-	if(fp1) {
+	if (fp1) {
 		fp2= RE_vertren_get_tangent(obr, v1, 1);
 		memcpy(fp2, fp1, RE_TANGENT_ELEMS*sizeof(float));
 	}
@@ -253,7 +253,7 @@ VertRen *RE_findOrAddVert(ObjectRen *obr, int nr)
 	VertRen *v;
 	int a;
 
-	if(nr<0) {
+	if (nr<0) {
 		printf("error in findOrAddVert: %d\n",nr);
 		return NULL;
 	}
@@ -263,21 +263,21 @@ VertRen *RE_findOrAddVert(ObjectRen *obr, int nr)
 		temp= obr->vertnodes;
 		
 		obr->vertnodes= MEM_mallocN(sizeof(VertTableNode)*(obr->vertnodeslen+TABLEINITSIZE) , "vertnodes");
-		if(temp) memcpy(obr->vertnodes, temp, obr->vertnodeslen*sizeof(VertTableNode));
+		if (temp) memcpy(obr->vertnodes, temp, obr->vertnodeslen*sizeof(VertTableNode));
 		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;
-	if(v==NULL) {
+	if (v==NULL) {
 		int i;
 		
 		v= (VertRen *)MEM_callocN(256*sizeof(VertRen),"findOrAddVert");
 		obr->vertnodes[a].vert= v;
 		
-		for(i= (nr & 0xFFFFFF00), a=0; a<256; a++, i++) {
+		for (i= (nr & 0xFFFFFF00), a=0; a<256; a++, i++) {
 			v[a].index= i;
 		}
 	}
@@ -295,14 +295,14 @@ MTFace *RE_vlakren_get_tface(ObjectRen *obr, VlakRen *vlr, int n, char **name, i
 
 	node= &obr->vlaknodes[nr];
 
-	if(verify) {
-		if(n>=node->totmtface) {
+	if (verify) {
+		if (n>=node->totmtface) {
 			MTFace *mtface= node->mtface;
 			int size= (n+1)*256;
 
 			node->mtface= MEM_callocN(size*sizeof(MTFace), "Vlak mtface");
 
-			if(mtface) {
+			if (mtface) {
 				size= node->totmtface*256;
 				memcpy(node->mtface, mtface, size*sizeof(MTFace));
 				MEM_freeN(mtface);
@@ -312,10 +312,10 @@ MTFace *RE_vlakren_get_tface(ObjectRen *obr, VlakRen *vlr, int n, char **name, i
 		}
 	}
 	else {
-		if(n>=node->totmtface)
+		if (n>=node->totmtface)
 			return NULL;
 
-		if(name) *name= obr->mtface[n];
+		if (name) *name= obr->mtface[n];
 	}
 
 	return node->mtface + index;
@@ -329,14 +329,14 @@ MCol *RE_vlakren_get_mcol(ObjectRen *obr, VlakRen *vlr, int n, char **name, int
 
 	node= &obr->vlaknodes[nr];
 
-	if(verify) {
-		if(n>=node->totmcol) {
+	if (verify) {
+		if (n>=node->totmcol) {
 			MCol *mcol= node->mcol;
 			int size= (n+1)*256;
 
 			node->mcol= MEM_callocN(size*sizeof(MCol)*RE_MCOL_ELEMS, "Vlak mcol");
 
-			if(mcol) {
+			if (mcol) {
 				size= node->totmcol*256;
 				memcpy(node->mcol, mcol, size*sizeof(MCol)*RE_MCOL_ELEMS);
 				MEM_freeN(mcol);
@@ -346,10 +346,10 @@ MCol *RE_vlakren_get_mcol(ObjectRen *obr, VlakRen *vlr, int n, char **name, int
 		}
 	}
 	else {
-		if(n>=node->totmcol)
+		if (n>=node->totmcol)
 			return NULL;
 
-		if(name) *name= obr->mcol[n];
+		if (name) *name= obr->mcol[n];
 	}
 
 	return node->mcol + index*RE_MCOL_ELEMS;
@@ -361,8 +361,8 @@ float *RE_vlakren_get_surfnor(ObjectRen *obr, VlakRen *vlak, int verify)
 	int nr= vlak->index>>8;
 	
 	surfnor= obr->vlaknodes[nr].surfnor;
-	if(surfnor==NULL) {
-		if(verify) 
+	if (surfnor==NULL) {
+		if (verify) 
 			surfnor= obr->vlaknodes[nr].surfnor= MEM_callocN(256*RE_SURFNOR_ELEMS*sizeof(float), "surfnor table");
 		else
 			return NULL;
@@ -376,8 +376,8 @@ float *RE_vlakren_get_nmap_tangent(ObjectRen *obr, VlakRen *vlak, int verify)
 	int nr= vlak->index>>8;
 
 	tangent= obr->vlaknodes[nr].tangent;
-	if(tangent==NULL) {
-		if(verify) 
+	if (tangent==NULL) {
+		if (verify) 
 			tangent= obr->vlaknodes[nr].tangent= MEM_callocN(256*RE_NMAP_TANGENT_ELEMS*sizeof(float), "tangent table");
 		else
 			return NULL;
@@ -391,8 +391,8 @@ RadFace **RE_vlakren_get_radface(ObjectRen *obr, VlakRen *vlak, int verify)
 	int nr= vlak->index>>8;
 	
 	radface= obr->vlaknodes[nr].radface;
-	if(radface==NULL) {
-		if(verify) 
+	if (radface==NULL) {
+		if (verify) 
 			radface= obr->vlaknodes[nr].radface= MEM_callocN(256*RE_RADFACE_ELEMS*sizeof(void*), "radface table");
 		else
 			return NULL;
@@ -424,19 +424,19 @@ VlakRen *RE_vlakren_copy(ObjectRen *obr, VlakRen *vlr)
 	}
 
 	surfnor= RE_vlakren_get_surfnor(obr, vlr, 0);
-	if(surfnor) {
+	if (surfnor) {
 		surfnor1= RE_vlakren_get_surfnor(obr, vlr1, 1);
 		copy_v3_v3(surfnor1, surfnor);
 	}
 
 	tangent= RE_vlakren_get_nmap_tangent(obr, vlr, 0);
-	if(tangent) {
+	if (tangent) {
 		tangent1= RE_vlakren_get_nmap_tangent(obr, vlr1, 1);
 		memcpy(tangent1, tangent, sizeof(float)*RE_NMAP_TANGENT_ELEMS);
 	}
 
 	radface= RE_vlakren_get_radface(obr, vlr, 0);
-	if(radface) {
+	if (radface) {
 		radface1= RE_vlakren_get_radface(obr, vlr1, 1);
 		*radface1= *radface;
 	}
@@ -448,7 +448,7 @@ void RE_vlakren_get_normal(Render *UNUSED(re), ObjectInstanceRen *obi, VlakRen *
 {
 	float (*nmat)[3]= obi->nmat;
 
-	if(obi->flag & R_TRANSFORMED) {
+	if (obi->flag & R_TRANSFORMED) {
 		mul_v3_m3v3(nor, nmat, vlr->n);
 		normalize_v3(nor);
 	}
@@ -460,7 +460,7 @@ void RE_vlakren_get_normal(Render *UNUSED(re), ObjectInstanceRen *obi, VlakRen *
 void RE_set_customdata_names(ObjectRen *obr, CustomData *data)
 {
 	/* CustomData layer names are stored per object here, because the
-	   DerivedMesh which stores the layers is freed */
+	 * DerivedMesh which stores the layers is freed */
 	
 	CustomDataLayer *layer;
 	int numtf = 0, numcol = 0, i, mtfn, mcn;
@@ -496,32 +496,32 @@ VlakRen *RE_findOrAddVlak(ObjectRen *obr, int nr)
 	VlakRen *v;
 	int a;
 
-	if(nr<0) {
+	if (nr<0) {
 		printf("error in findOrAddVlak: %d\n",nr);
 		return obr->vlaknodes[0].vlak;
 	}
 	a= nr>>8;
 	
-	if (a>=obr->vlaknodeslen-1){  /* Need to allocate more columns..., and keep last element NULL for free loop */
+	if (a>=obr->vlaknodeslen-1) {  /* Need to allocate more columns..., and keep last element NULL for free loop */
 		temp= obr->vlaknodes;
 		
 		obr->vlaknodes= MEM_mallocN(sizeof(VlakTableNode)*(obr->vlaknodeslen+TABLEINITSIZE) , "vlaknodes");
-		if(temp) memcpy(obr->vlaknodes, temp, obr->vlaknodeslen*sizeof(VlakTableNode));
+		if (temp) memcpy(obr->vlaknodes, temp, obr->vlaknodeslen*sizeof(VlakTableNode));
 		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;
 	
-	if(v==NULL) {
+	if (v==NULL) {
 		int i;
 
 		v= (VlakRen *)MEM_callocN(256*sizeof(VlakRen),"findOrAddVlak");
 		obr->vlaknodes[a].vlak= v;
 
-		for(i= (nr & 0xFFFFFF00), a=0; a<256; a++, i++)
+		for (i= (nr & 0xFFFFFF00), a=0; a<256; a++, i++)
 			v[a].index= i;
 	}
 	v+= (nr & 255);
@@ -536,8 +536,8 @@ float *RE_strandren_get_surfnor(ObjectRen *obr, StrandRen *strand, int verify)
 	int nr= strand->index>>8;
 	
 	surfnor= obr->strandnodes[nr].surfnor;
-	if(surfnor==NULL) {
-		if(verify) 
+	if (surfnor==NULL) {
+		if (verify) 
 			surfnor= obr->strandnodes[nr].surfnor= MEM_callocN(256*RE_SURFNOR_ELEMS*sizeof(float), "surfnor strand table");
 		else
 			return NULL;
@@ -553,14 +553,14 @@ float *RE_strandren_get_uv(ObjectRen *obr, StrandRen *strand, int n, char **name
 
 	node= &obr->strandnodes[nr];
 
-	if(verify) {
-		if(n>=node->totuv) {
+	if (verify) {
+		if (n>=node->totuv) {
 			float *uv= node->uv;
 			int size= (n+1)*256;
 
 			node->uv= MEM_callocN(size*sizeof(float)*RE_UV_ELEMS, "strand uv table");
 
-			if(uv) {
+			if (uv) {
 				size= node->totuv*256;
 				memcpy(node->uv, uv, size*sizeof(float)*RE_UV_ELEMS);
 				MEM_freeN(uv);
@@ -570,10 +570,10 @@ float *RE_strandren_get_uv(ObjectRen *obr, StrandRen *strand, int n, char **name
 		}
 	}
 	else {
-		if(n>=node->totuv)
+		if (n>=node->totuv)
 			return NULL;
 
-		if(name) *name= obr->mtface[n];
+		if (name) *name= obr->mtface[n];
 	}
 
 	return node->uv + index*RE_UV_ELEMS;
@@ -587,14 +587,14 @@ MCol *RE_strandren_get_mcol(ObjectRen *obr, StrandRen *strand, int n, char **nam
 
 	node= &obr->strandnodes[nr];
 
-	if(verify) {
-		if(n>=node->totmcol) {
+	if (verify) {
+		if (n>=node->totmcol) {
 			MCol *mcol= node->mcol;
 			int size= (n+1)*256;
 
 			node->mcol= MEM_callocN(size*sizeof(MCol)*RE_MCOL_ELEMS, "strand mcol table");
 
-			if(mcol) {
+			if (mcol) {
 				size= node->totmcol*256;
 				memcpy(node->mcol, mcol, size*sizeof(MCol)*RE_MCOL_ELEMS);
 				MEM_freeN(mcol);
@@ -604,10 +604,10 @@ MCol *RE_strandren_get_mcol(ObjectRen *obr, StrandRen *strand, int n, char **nam
 		}
 	}
 	else {
-		if(n>=node->totmcol)
+		if (n>=node->totmcol)
 			return NULL;
 
-		if(name) *name= obr->mcol[n];
+		if (name) *name= obr->mcol[n];
 	}
 
 	return node->mcol + index*RE_MCOL_ELEMS;
@@ -619,8 +619,8 @@ float *RE_strandren_get_simplify(struct ObjectRen *obr, struct StrandRen *strand
 	int nr= strand->index>>8;
 	
 	simplify= obr->strandnodes[nr].simplify;
-	if(simplify==NULL) {
-		if(verify) 
+	if (simplify==NULL) {
+		if (verify) 
 			simplify= obr->strandnodes[nr].simplify= MEM_callocN(256*RE_SIMPLIFY_ELEMS*sizeof(float), "simplify strand table");
 		else
 			return NULL;
@@ -634,8 +634,8 @@ int *RE_strandren_get_face(ObjectRen *obr, StrandRen *strand, int verify)
 	int nr= strand->index>>8;
 	
 	face= obr->strandnodes[nr].face;
-	if(face==NULL) {
-		if(verify) 
+	if (face==NULL) {
+		if (verify) 
 			face= obr->strandnodes[nr].face= MEM_callocN(256*RE_FACE_ELEMS*sizeof(int), "face strand table");
 		else
 			return NULL;
@@ -650,8 +650,8 @@ float *RE_strandren_get_winspeed(ObjectInstanceRen *obi, StrandRen *strand, int
 	int totvector;
 	
 	winspeed= obi->vectors;
-	if(winspeed==NULL) {
-		if(verify) {
+	if (winspeed==NULL) {
+		if (verify) {
 			totvector= obi->obr->totvert + obi->obr->totstrand;
 			winspeed= obi->vectors= MEM_callocN(totvector*RE_WINSPEED_ELEMS*sizeof(float), "winspeed strand table");
 		}
@@ -667,32 +667,32 @@ StrandRen *RE_findOrAddStrand(ObjectRen *obr, int nr)
 	StrandRen *v;
 	int a;
 
-	if(nr<0) {
+	if (nr<0) {
 		printf("error in findOrAddStrand: %d\n",nr);
 		return obr->strandnodes[0].strand;
 	}
 	a= nr>>8;
 	
-	if (a>=obr->strandnodeslen-1){  /* Need to allocate more columns..., and keep last element NULL for free loop */
+	if (a>=obr->strandnodeslen-1) {  /* Need to allocate more columns..., and keep last element NULL for free loop */
 		temp= obr->strandnodes;
 		
 		obr->strandnodes= MEM_mallocN(sizeof(StrandTableNode)*(obr->strandnodeslen+TABLEINITSIZE) , "strandnodes");
-		if(temp) memcpy(obr->strandnodes, temp, obr->strandnodeslen*sizeof(StrandTableNode));
+		if (temp) memcpy(obr->strandnodes, temp, obr->strandnodeslen*sizeof(StrandTableNode));
 		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;
 	
-	if(v==NULL) {
+	if (v==NULL) {
 		int i;
 
 		v= (StrandRen *)MEM_callocN(256*sizeof(StrandRen),"findOrAddStrand");
 		obr->strandnodes[a].strand= v;
 
-		for(i= (nr & 0xFFFFFF00), a=0; a<256; a++, i++)
+		for (i= (nr & 0xFFFFFF00), a=0; a<256; a++, i++)
 			v[a].index= i;
 	}
 	v+= (nr & 255);
@@ -733,22 +733,22 @@ void free_renderdata_vertnodes(VertTableNode *vertnodes)
 {
 	int a;
 	
-	if(vertnodes==NULL) return;
+	if (vertnodes==NULL) return;
 	
-	for(a=0; vertnodes[a].vert; a++) {
+	for (a=0; vertnodes[a].vert; a++) {
 		MEM_freeN(vertnodes[a].vert);
 		
-		if(vertnodes[a].rad)
+		if (vertnodes[a].rad)
 			MEM_freeN(vertnodes[a].rad);
-		if(vertnodes[a].sticky)
+		if (vertnodes[a].sticky)
 			MEM_freeN(vertnodes[a].sticky);
-		if(vertnodes[a].strand)
+		if (vertnodes[a].strand)
 			MEM_freeN(vertnodes[a].strand);
-		if(vertnodes[a].tangent)
+		if (vertnodes[a].tangent)
 			MEM_freeN(vertnodes[a].tangent);
-		if(vertnodes[a].stress)
+		if (vertnodes[a].stress)
 			MEM_freeN(vertnodes[a].stress);
-		if(vertnodes[a].winspeed)
+		if (vertnodes[a].winspeed)
 			MEM_freeN(vertnodes[a].winspeed);
 	}
 	
@@ -759,20 +759,20 @@ void free_renderdata_vlaknodes(VlakTableNode *vlaknodes)
 {
 	int a;
 	
-	if(vlaknodes==NULL) return;
+	if (vlaknodes==NULL) return;
 	
-	for(a=0; vlaknodes[a].vlak; a++) {
+	for (a=0; vlaknodes[a].vlak; a++) {
 		MEM_freeN(vlaknodes[a].vlak);
 		
-		if(vlaknodes[a].mtface)
+		if (vlaknodes[a].mtface)
 			MEM_freeN(vlaknodes[a].mtface);
-		if(vlaknodes[a].mcol)
+		if (vlaknodes[a].mcol)
 			MEM_freeN(vlaknodes[a].mcol);
-		if(vlaknodes[a].surfnor)
+		if (vlaknodes[a].surfnor)
 			MEM_freeN(vlaknodes[a].surfnor);
-		if(vlaknodes[a].tangent)
+		if (vlaknodes[a].tangent)
 			MEM_freeN(vlaknodes[a].tangent);
-		if(vlaknodes[a].radface)
+		if (vlaknodes[a].radface)
 			MEM_freeN(vlaknodes[a].radface);
 	}
 	
@@ -783,22 +783,22 @@ static void free_renderdata_strandnodes(StrandTableNode *strandnodes)
 {
 	int a;
 	
-	if(strandnodes==NULL) return;
+	if (strandnodes==NULL) return;
 	
-	for(a=0; strandnodes[a].strand; a++) {
+	for (a=0; strandnodes[a].strand; a++) {
 		MEM_freeN(strandnodes[a].strand);
 		
-		if(strandnodes[a].uv)
+		if (strandnodes[a].uv)
 			MEM_freeN(strandnodes[a].uv);
-		if(strandnodes[a].mcol)
+		if (strandnodes[a].mcol)
 			MEM_freeN(strandnodes[a].mcol);
-		if(strandnodes[a].winspeed)
+		if (strandnodes[a].winspeed)
 			MEM_freeN(strandnodes[a].winspeed);
-		if(strandnodes[a].surfnor)
+		if (strandnodes[a].surfnor)
 			MEM_freeN(strandnodes[a].surfnor);
-		if(strandnodes[a].simplify)
+		if (strandnodes[a].simplify)
 			MEM_freeN(strandnodes[a].simplify);
-		if(strandnodes[a].face)
+		if (strandnodes[a].face)
 			MEM_freeN(strandnodes[a].face);
 	}
 	
@@ -812,22 +812,22 @@ void free_renderdata_tables(Render *re)
 	StrandBuffer *strandbuf;
 	int a=0;
 	
-	for(obr=re->objecttable.first; obr; obr=obr->next) {
-		if(obr->vertnodes) {
+	for (obr=re->objecttable.first; obr; obr=obr->next) {
+		if (obr->vertnodes) {
 			free_renderdata_vertnodes(obr->vertnodes);
 			obr->vertnodes= NULL;
 			obr->vertnodeslen= 0;
 		}
 
-		if(obr->vlaknodes) {
+		if (obr->vlaknodes) {
 			free_renderdata_vlaknodes(obr->vlaknodes);
 			obr->vlaknodes= NULL;
 			obr->vlaknodeslen= 0;
 			obr->totvlak= 0;
 		}
 
-		if(obr->bloha) {
-			for(a=0; obr->bloha[a]; a++)
+		if (obr->bloha) {
+			for (a=0; obr->bloha[a]; a++)
 				MEM_freeN(obr->bloha[a]);
 
 			MEM_freeN(obr->bloha);
@@ -835,48 +835,48 @@ void free_renderdata_tables(Render *re)
 			obr->blohalen= 0;
 		}
 
-		if(obr->strandnodes) {
+		if (obr->strandnodes) {
 			free_renderdata_strandnodes(obr->strandnodes);
 			obr->strandnodes= NULL;
 			obr->strandnodeslen= 0;
 		}
 
 		strandbuf= obr->strandbuf;
-		if(strandbuf) {
-			if(strandbuf->vert) MEM_freeN(strandbuf->vert);
-			if(strandbuf->bound) MEM_freeN(strandbuf->bound);
+		if (strandbuf) {
+			if (strandbuf->vert) MEM_freeN(strandbuf->vert);
+			if (strandbuf->bound) MEM_freeN(strandbuf->bound);
 			MEM_freeN(strandbuf);
 		}
 
-		if(obr->mtface)
+		if (obr->mtface)
 			MEM_freeN(obr->mtface);
-		if(obr->mcol)
+
+		if (obr->mcol)
 			MEM_freeN(obr->mcol);
 			
-		if(obr->rayfaces)
-		{
+		if (obr->rayfaces) {
 			MEM_freeN(obr->rayfaces);
 			obr->rayfaces = NULL;
 		}
-		if(obr->rayprimitives)
-		{
+
+		if (obr->rayprimitives) {
 			MEM_freeN(obr->rayprimitives);
 			obr->rayprimitives = NULL;
 		}
-		if(obr->raytree)
-		{
+
+		if (obr->raytree) {
 			RE_rayobject_free(obr->raytree);
 			obr->raytree = NULL;
 		}
 	}
 
-	if(re->objectinstance) {
-		for(obi=re->instancetable.first; obi; obi=obi->next)
+	if (re->objectinstance) {
+		for (obi=re->instancetable.first; obi; obi=obi->next)
 		{
-			if(obi->vectors)
+			if (obi->vectors)
 				MEM_freeN(obi->vectors);
 
-			if(obi->raytree)
+			if (obi->raytree)
 				RE_rayobject_free(obi->raytree);
 		}
 
@@ -886,7 +886,7 @@ void free_renderdata_tables(Render *re)
 		re->instancetable.first= re->instancetable.last= NULL;
 	}
 
-	if(re->sortedhalos) {
+	if (re->sortedhalos) {
 		MEM_freeN(re->sortedhalos);
 		re->sortedhalos= NULL;
 	}
@@ -903,26 +903,26 @@ HaloRen *RE_findOrAddHalo(ObjectRen *obr, int nr)
 	HaloRen *h, **temp;
 	int a;
 
-	if(nr<0) {
+	if (nr<0) {
 		printf("error in findOrAddHalo: %d\n",nr);
 		return NULL;
 	}
 	a= nr>>8;
 	
-	if (a>=obr->blohalen-1){  /* Need to allocate more columns..., and keep last element NULL for free loop */
+	if (a>=obr->blohalen-1) {  /* Need to allocate more columns..., and keep last element NULL for free loop */
 		//printf("Allocating %i more halo groups.  %i total.\n", 
 		//	TABLEINITSIZE, obr->blohalen+TABLEINITSIZE );
 		temp=obr->bloha;
 		
 		obr->bloha=(HaloRen**)MEM_callocN(sizeof(void*)*(obr->blohalen+TABLEINITSIZE) , "Bloha");
-		if(temp) memcpy(obr->bloha, temp, obr->blohalen*sizeof(void*));
+		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];
-	if(h==NULL) {
+	if (h==NULL) {
 		h= (HaloRen *)MEM_callocN(256*sizeof(HaloRen),"findOrAdHalo");
 		obr->bloha[a]= h;
 	}
@@ -940,13 +940,13 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma,   float *vec,   f
 	float tin, tr, tg, tb, ta;
 	float xn, yn, zn, texvec[3], hoco[4], hoco1[4];
 
-	if(hasize==0.0f) return NULL;
+	if (hasize==0.0f) return NULL;
 
 	projectverto(vec, re->winmat, hoco);
-	if(hoco[3]==0.0f) return NULL;
-	if(vec1) {
+	if (hoco[3]==0.0f) return NULL;
+	if (vec1) {
 		projectverto(vec1, re->winmat, hoco1);
-		if(hoco1[3]==0.0f) return NULL;
+		if (hoco1[3]==0.0f) return NULL;
 	}
 
 	har= RE_findOrAddHalo(obr, obr->tothalo++);
@@ -963,13 +963,13 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma,   float *vec,   f
 	har->zBufDist = 0x7FFFFFFF*(hoco[2]/zn); 
 	
 	/* halovect */
-	if(vec1) {
+	if (vec1) {
 
 		har->type |= HA_VECT;
 
 		xn=  har->xs - 0.5f*re->winx*(hoco1[0]/hoco1[3]);
 		yn=  har->ys - 0.5f*re->winy*(hoco1[1]/hoco1[3]);
-		if(xn==0.0f || (xn==0.0f && yn==0.0f)) zn= 0.0f;
+		if (xn==0.0f || (xn==0.0f && yn==0.0f)) zn= 0.0f;
 		else zn= atan2(yn, xn);
 
 		har->sin= sin(zn);
@@ -982,7 +982,7 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma,   float *vec,   f
 		normalize_v3(har->no);
 	}
 
-	if(ma->mode & MA_HALO_XALPHA) har->type |= HA_XALPHA;
+	if (ma->mode & MA_HALO_XALPHA) har->type |= HA_XALPHA;
 
 	har->alfa= ma->alpha;
 	har->r= ma->r;
@@ -993,32 +993,32 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma,   float *vec,   f
 	har->hard= ma->har;
 	har->seed= seed % 256;
 
-	if(ma->mode & MA_STAR) har->starpoints= ma->starc;
-	if(ma->mode & MA_HALO_LINES) har->linec= ma->linec;
-	if(ma->mode & MA_HALO_RINGS) har->ringc= ma->ringc;
-	if(ma->mode & MA_HALO_FLARE) har->flarec= ma->flarec;
+	if (ma->mode & MA_STAR) har->starpoints= ma->starc;
+	if (ma->mode & MA_HALO_LINES) har->linec= ma->linec;
+	if (ma->mode & MA_HALO_RINGS) har->ringc= ma->ringc;
+	if (ma->mode & MA_HALO_FLARE) har->flarec= ma->flarec;
 
 
-	if(ma->mtex[0]) {
+	if (ma->mtex[0]) {
 
-		if( (ma->mode & MA_HALOTEX) ) har->tex= 1;
-		else if(har->mat->septex & (1<<0));	/* only 1 level textures */
+		if ( (ma->mode & MA_HALOTEX) ) har->tex= 1;
+		else if (har->mat->septex & (1<<0));	/* only 1 level textures */
 		else {
 
 			mtex= ma->mtex[0];
 			copy_v3_v3(texvec, vec);
 
-			if(mtex->texco & TEXCO_NORM) {
+			if (mtex->texco & TEXCO_NORM) {
 				;
 			}
-			else if(mtex->texco & TEXCO_OBJECT) {
+			else if (mtex->texco & TEXCO_OBJECT) {
 				/* texvec[0]+= imatbase->ivec[0]; */
 				/* texvec[1]+= imatbase->ivec[1]; */
 				/* texvec[2]+= imatbase->ivec[2]; */
 				/* mul_m3_v3(imatbase->imat, texvec); */
 			}
 			else {
-				if(orco) {
+				if (orco) {
 					copy_v3_v3(texvec, orco);
 				}
 			}
@@ -1028,16 +1028,16 @@ HaloRen *RE_inithalo(Render *re, ObjectRen *obr, Material *ma,   float *vec,   f
 			yn= tin*mtex->colfac;
 			//zn= tin*mtex->alphafac;
 
-			if(mtex->mapto & MAP_COL) {
+			if (mtex->mapto & MAP_COL) {
 				zn= 1.0f-yn;
 				har->r= (yn*tr+ zn*ma->r);
 				har->g= (yn*tg+ zn*ma->g);
 				har->b= (yn*tb+ zn*ma->b);
 			}
-			if(mtex->texco & TEXCO_UV) {
+			if (mtex->texco & TEXCO_UV) {
 				har->alfa= tin;
 			}
-			if(mtex->mapto & MAP_ALPHA)
+			if (mtex->mapto & MAP_ALPHA)
 				har->alfa= tin;
 		}
 	}
@@ -1054,13 +1054,13 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
 	float xn, yn, zn, texvec[3], hoco[4], hoco1[4], in[3],tex[3],out[3];
 	int i, hasrgb;
 
-	if(hasize==0.0f) return NULL;
+	if (hasize==0.0f) return NULL;
 
 	projectverto(vec, re->winmat, hoco);
-	if(hoco[3]==0.0f) return NULL;
-	if(vec1) {
+	if (hoco[3]==0.0f) return NULL;
+	if (vec1) {
 		projectverto(vec1, re->winmat, hoco1);
-		if(hoco1[3]==0.0f) return NULL;
+		if (hoco1[3]==0.0f) return NULL;
 	}
 
 	har= RE_findOrAddHalo(obr, obr->tothalo++);
@@ -1077,13 +1077,13 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
 	har->zBufDist = 0x7FFFFFFF*(hoco[2]/zn); 
 	
 	/* halovect */
-	if(vec1) {
+	if (vec1) {
 
 		har->type |= HA_VECT;
 
 		xn=  har->xs - 0.5f*re->winx*(hoco1[0]/hoco1[3]);
 		yn=  har->ys - 0.5f*re->winy*(hoco1[1]/hoco1[3]);
-		if(xn==0.0f || (xn==0.0f && yn==0.0f)) zn= 0.0;
+		if (xn==0.0f || (xn==0.0f && yn==0.0f)) zn= 0.0;
 		else zn= atan2(yn, xn);
 
 		har->sin= sin(zn);
@@ -1096,7 +1096,7 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
 		normalize_v3(har->no);
 	}
 
-	if(ma->mode & MA_HALO_XALPHA) har->type |= HA_XALPHA;
+	if (ma->mode & MA_HALO_XALPHA) har->type |= HA_XALPHA;
 
 	har->alfa= ma->alpha;
 	har->r= ma->r;
@@ -1107,32 +1107,32 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
 	har->hard= ma->har;
 	har->seed= seed % 256;
 
-	if(ma->mode & MA_STAR) har->starpoints= ma->starc;
-	if(ma->mode & MA_HALO_LINES) har->linec= ma->linec;
-	if(ma->mode & MA_HALO_RINGS) har->ringc= ma->ringc;
-	if(ma->mode & MA_HALO_FLARE) har->flarec= ma->flarec;
+	if (ma->mode & MA_STAR) har->starpoints= ma->starc;
+	if (ma->mode & MA_HALO_LINES) har->linec= ma->linec;
+	if (ma->mode & MA_HALO_RINGS) har->ringc= ma->ringc;
+	if (ma->mode & MA_HALO_FLARE) har->flarec= ma->flarec;
 
-	if((ma->mode & MA_HALOTEX) && ma->mtex[0])
+	if ((ma->mode & MA_HALOTEX) && ma->mtex[0])
 		har->tex= 1;
 	
-	for(i=0; i<MAX_MTEX; i++)
-		if(ma->mtex[i] && (ma->septex & (1<<i))==0) {
+	for (i=0; i<MAX_MTEX; i++)
+		if (ma->mtex[i] && (ma->septex & (1<<i))==0) {
 			mtex= ma->mtex[i];
 			copy_v3_v3(texvec, vec);
 
-			if(mtex->texco & TEXCO_NORM) {
+			if (mtex->texco & TEXCO_NORM) {
 				;
 			}
-			else if(mtex->texco & TEXCO_OBJECT) {
-				if(mtex->object)
+			else if (mtex->texco & TEXCO_OBJECT) {
+				if (mtex->object)
 					mul_m4_v3(mtex->object->imat_ren,texvec);
 			}
-			else if(mtex->texco & TEXCO_GLOB){
+			else if (mtex->texco & TEXCO_GLOB) {
 				copy_v3_v3(texvec,vec);
 			}
-			else if(mtex->texco & TEXCO_UV && uvco){
+			else if (mtex->texco & TEXCO_UV && uvco) {
 				int uv_index=CustomData_get_named_layer_index(&dm->faceData,CD_MTFACE,mtex->uvname);
-				if(uv_index<0)
+				if (uv_index<0)
 					uv_index=CustomData_get_active_layer_index(&dm->faceData,CD_MTFACE);
 
 				uv_index-=CustomData_get_layer_index(&dm->faceData,CD_MTFACE);
@@ -1141,13 +1141,13 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
 				texvec[1]=2.0f*uvco[2*uv_index+1]-1.0f;
 				texvec[2]=0.0f;
 			}
-			else if(mtex->texco & TEXCO_PARTICLE) {
+			else if (mtex->texco & TEXCO_PARTICLE) {
 				/* particle coordinates in range [0,1] */
 				texvec[0] = 2.f * pa_co[0] - 1.f;
 				texvec[1] = 2.f * pa_co[1] - 1.f;
 				texvec[2] = pa_co[2];
 			}
-			else if(orco) {
+			else if (orco) {
 				copy_v3_v3(texvec, orco);
 			}
 
@@ -1155,7 +1155,7 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
 
 			//yn= tin*mtex->colfac;
 			//zn= tin*mtex->alphafac;
-			if(mtex->mapto & MAP_COL) {
+			if (mtex->mapto & MAP_COL) {
 				tex[0]=tr;
 				tex[1]=tg;
 				tex[2]=tb;
@@ -1174,22 +1174,22 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
 			}
 
 			/* alpha returned, so let's use it instead of intensity */
-			if(hasrgb)
+			if (hasrgb)
 				tin = ta;
 
-			if(mtex->mapto & MAP_ALPHA)
+			if (mtex->mapto & MAP_ALPHA)
 				har->alfa = texture_value_blend(mtex->def_var,har->alfa,tin,mtex->alphafac,mtex->blendtype);
-			if(mtex->mapto & MAP_HAR)
+			if (mtex->mapto & MAP_HAR)
 				har->hard = 1.0f+126.0f*texture_value_blend(mtex->def_var,((float)har->hard)/127.0f,tin,mtex->hardfac,mtex->blendtype);
-			if(mtex->mapto & MAP_RAYMIRR)
+			if (mtex->mapto & MAP_RAYMIRR)
 				har->hasize = 100.0f*texture_value_blend(mtex->def_var,har->hasize/100.0f,tin,mtex->raymirrfac,mtex->blendtype);
-			if(mtex->mapto & MAP_TRANSLU) {
+			if (mtex->mapto & MAP_TRANSLU) {
 				float add = texture_value_blend(mtex->def_var,(float)har->add/255.0f,tin,mtex->translfac,mtex->blendtype);
 				CLAMP(add, 0.f, 1.f);
 				har->add = 255.0f*add;
 			}
 			/* now what on earth is this good for?? */
-			//if(mtex->texco & 16) {
+			//if (mtex->texco & 16) {
 			//	har->alfa= tin;
 			//}
 		}
@@ -1206,32 +1206,32 @@ static int panotestclip(Render *re, int do_pano, float *v)
 	float abs4;
 	short c=0;
 
-	if(do_pano==0) return testclip(v);
+	if (do_pano==0) return testclip(v);
 
 	abs4= fabs(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;
+	if ( v[0]>abs4) c+=2;
+	else if ( v[0]< -abs4) c+=1;
 
 	return c;
 }
 
-/*
-  This adds the hcs coordinates to vertices. It iterates over all
-  vertices, halos and faces. After the conversion, we clip in hcs.
-
-  Elsewhere, all primites are converted to vertices. 
-  Called in 
-  - envmapping (envmap.c)
-  - shadow buffering (shadbuf.c)
-*/
+/**
+ * This adds the hcs coordinates to vertices. It iterates over all
+ * vertices, halos and faces. After the conversion, we clip in hcs.
+ *
+ * Elsewhere, all primites are converted to vertices.
+ * Called in
+ * - envmapping (envmap.c)
+ * - shadow buffering (shadbuf.c)
+ */
 
 void project_renderdata(Render *re, void (*projectfunc)(const float *, float mat[][4], float *),  int do_pano, float xoffs, int UNUSED(do_buckets))
 {
@@ -1240,20 +1240,20 @@ void project_renderdata(Render *re, void (*projectfunc)(const float *, float mat
 	float zn, vec[3], hoco[4];
 	int a;
 
-	if(do_pano) {
+	if (do_pano) {
 		float panophi= xoffs;
 		
 		re->panosi= sin(panophi);
 		re->panoco= cos(panophi);
 	}
 
-	for(obr=re->objecttable.first; obr; obr=obr->next) {
+	for (obr=re->objecttable.first; obr; obr=obr->next) {
 		/* calculate view coordinates (and zbuffer value) */
-		for(a=0; a<obr->tothalo; a++) {
-			if((a & 255)==0) har= obr->bloha[a>>8];
+		for (a=0; a<obr->tothalo; a++) {
+			if ((a & 255)==0) har= obr->bloha[a>>8];
 			else har++;
 
-			if(do_pano) {
+			if (do_pano) {
 				vec[0]= re->panoco*har->co[0] + re->panosi*har->co[2];
 				vec[1]= har->co[1];
 				vec[2]= -re->panosi*har->co[0] + re->panoco*har->co[2];
@@ -1268,10 +1268,10 @@ void project_renderdata(Render *re, void (*projectfunc)(const float *, float mat
 			hoco[0]*= 0.5f;
 			hoco[1]*= 0.5f;
 			
-			if( panotestclip(re, do_pano, hoco) ) {
+			if ( panotestclip(re, do_pano, hoco) ) {
 				har->miny= har->maxy= -10000;	/* that way render clips it */
 			}
-			else if(hoco[3]<0.0f) {
+			else if (hoco[3]<0.0f) {
 				har->miny= har->maxy= -10000;	/* render clips it */
 			}
 			else /* do the projection...*/
@@ -1296,8 +1296,8 @@ void project_renderdata(Render *re, void (*projectfunc)(const float *, float mat
 				har->rad= fabsf(har->xs- 0.5f*re->winx*(1.0f+hoco[0]/zn));
 			
 				/* this clip is not really OK, to prevent stars to become too large */
-				if(har->type & HA_ONLYSKY) {
-					if(har->rad>3.0f) har->rad= 3.0f;
+				if (har->type & HA_ONLYSKY) {
+					if (har->rad>3.0f) har->rad= 3.0f;
 				}
 			
 				har->radsq= har->rad*har->rad;
@@ -1334,7 +1334,7 @@ ObjectInstanceRen *RE_addRenderInstance(Render *re, ObjectRen *obr, Object *ob,
 	obi->psysindex= psysindex;
 	obi->lay= lay;
 
-	if(mat) {
+	if (mat) {
 		copy_m4_m4(obi->mat, mat);
 		copy_m3_m4(mat3, mat);
 		invert_m3_m3(obi->nmat, mat3);
@@ -1360,10 +1360,10 @@ void RE_makeRenderInstances(Render *re)
 	newlist.first= newlist.last= NULL;
 
 	obi= re->objectinstance;
-	for(oldobi=re->instancetable.first; oldobi; oldobi=oldobi->next) {
+	for (oldobi=re->instancetable.first; oldobi; oldobi=oldobi->next) {
 		*obi= *oldobi;
 
-		if(obi->obr) {
+		if (obi->obr) {
 			obi->prev= obi->next= NULL;
 			BLI_addtail(&newlist, obi);
 			obi++;
@@ -1383,7 +1383,7 @@ int clip_render_object(float boundbox[][3], float *bounds, float winmat[][4])
 
 	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];
@@ -1391,25 +1391,25 @@ int clip_render_object(float boundbox[][3], float *bounds, float winmat[][4])
 		mul_m4_v4(mat, vec);
 
 		fl= 0;
-		if(bounds) {
-			if(vec[0] < bounds[0]*vec[3]) fl |= 1;
-			else if(vec[0] > bounds[1]*vec[3]) fl |= 2;
+		if (bounds) {
+			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;
-			else if(vec[1] < -vec[3]) fl |= 8;
+			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 88d86d5..7b17c78 100644
--- a/source/blender/render/intern/source/shadbuf.c
+++ b/source/blender/render/intern/source/shadbuf.c
@@ -59,8 +59,7 @@
 #include "shading.h"
 #include "zbuf.h"
 
-/* XXX, could be better implemented... this is for endian issues
-*/
+/* XXX, could be better implemented... this is for endian issues */
 #ifdef __BIG_ENDIAN__
 #  define RCOMP	3
 #  define GCOMP	2
@@ -92,14 +91,14 @@ static void copy_to_ztile(int *rectz, int size, int x1, int y1, int tile, char *
 	
 	x2= x1+tile;
 	y2= y1+tile;
-	if(x2>=size) x2= size-1;
-	if(y2>=size) y2= size-1;
+	if (x2>=size) x2= size-1;
+	if (y2>=size) y2= size-1;
 
-	if(x1>=x2 || y1>=y2) return;
+	if (x1>=x2 || y1>=y2) return;
 
 	len4= 4*(x2- x1);
 	rz= rectz + size*y1 + x1;
-	for(; y1<y2; y1++) {
+	for (; y1<y2; y1++) {
 		memcpy(r1, rz, len4);
 		rz+= size;
 		r1+= len4;
@@ -115,7 +114,7 @@ static int sizeoflampbuf(ShadBuf *shb)
 	cp= shb->cbuf;
 	num= (shb->size*shb->size)/256;
 
-	while(num--) count+= *(cp++);
+	while (num--) count+= *(cp++);
 	
 	return 256*count;
 }
@@ -133,12 +132,12 @@ static float *give_jitter_tab(int samp)
 	static char ctab[17]= {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
 	int a, offset=0;
 	
-	if(samp<2) samp= 2;
-	else if(samp>16) samp= 16;
+	if (samp<2) samp= 2;
+	else if (samp>16) samp= 16;
 
-	for(a=0; a<samp-1; a++) offset+= tab[a];
+	for (a=0; a<samp-1; a++) offset+= tab[a];
 
-	if(ctab[samp]==0) {
+	if (ctab[samp]==0) {
 		ctab[samp]= 1;
 		BLI_initjit(jit[offset], samp*samp);
 	}
@@ -155,10 +154,10 @@ static void make_jitter_weight_tab(Render *re, ShadBuf *shb, short filtertype)
 	
 	shb->weight= MEM_mallocN(sizeof(float)*tot, "weight tab lamp");
 	
-	for(jit= shb->jit, a=0; a<tot; a++, jit+=2) {
-		if(filtertype==LA_SHADBUF_TENT) 
+	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]);
-		else if(filtertype==LA_SHADBUF_GAUSS) 
+		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]));
 		else
 			shb->weight[a]= 1.0f;
@@ -167,7 +166,7 @@ static void make_jitter_weight_tab(Render *re, ShadBuf *shb, short filtertype)
 	}
 	
 	totw= 1.0f/totw;
-	for(a=0; a<tot; a++) {
+	for (a=0; a<tot; a++) {
 		shb->weight[a]*= totw;
 	}
 }
@@ -177,25 +176,27 @@ static int verg_deepsample(const void *poin1, const void *poin2)
 	const DeepSample *ds1= (const DeepSample*)poin1;
 	const DeepSample *ds2= (const DeepSample*)poin2;
 
-	if(ds1->z < ds2->z) return -1;
-	else if(ds1->z == ds2->z) return 0;
+	if (ds1->z < ds2->z) return -1;
+	else if (ds1->z == ds2->z) return 0;
 	else return 1;
 }
 
 static int compress_deepsamples(DeepSample *dsample, int tot, float epsilon)
 {
 	/* uses doubles to avoid overflows and other numerical issues,
-	   could be improved */
+	 * could be improved */
 	DeepSample *ds, *newds;
 	float v;
 	double slope, slopemin, slopemax, min, max, div, newmin, newmax;
 	int a, first, z, newtot= 0;
 
-	/*if(print) {
-		for(a=0, ds=dsample; a<tot; a++, ds++)
+#if 0
+	if (print) {
+		for (a=0, ds=dsample; a<tot; a++, ds++)
 			printf("%lf,%f ", ds->z/(double)0x7FFFFFFF, ds->v);
 		printf("\n");
-	}*/
+	}
+#endif
 
 	/* read from and write into same array */
 	ds= dsample;
@@ -203,17 +204,17 @@ static int compress_deepsamples(DeepSample *dsample, int tot, float epsilon)
 	a= 0;
 
 	/* as long as we are not at the end of the array */
-	for(a++, ds++; a<tot; a++, ds++) {
+	for (a++, ds++; a<tot; a++, ds++) {
 		slopemin= 0.0f;
 		slopemax= 0.0f;
 		first= 1;
 
-		for(; a<tot; a++, ds++) {
+		for (; a<tot; a++, ds++) {
 			//dz= ds->z - newds->z;
-			if(ds->z == newds->z) {
+			if (ds->z == newds->z) {
 				/* still in same z position, simply check
-				   visibility difference against epsilon */
-				if(!(fabs(newds->v - ds->v) <= epsilon)) {
+				 * visibility difference against epsilon */
+				if (!(fabs(newds->v - ds->v) <= epsilon)) {
 					break;
 				}
 			}
@@ -224,7 +225,7 @@ static int compress_deepsamples(DeepSample *dsample, int tot, float epsilon)
 				max= ((ds->v + epsilon) - newds->v)*div;
 
 				/* adapt existing slopes */
-				if(first) {
+				if (first) {
 					newmin= min;
 					newmax= max;
 					first= 0;
@@ -234,7 +235,7 @@ static int compress_deepsamples(DeepSample *dsample, int tot, float epsilon)
 					newmax= MIN2(slopemax, max);
 
 					/* verify if there is still space between the slopes */
-					if(newmin > newmax) {
+					if (newmin > newmax) {
 						ds--;
 						a--;
 						break;
@@ -246,7 +247,7 @@ static int compress_deepsamples(DeepSample *dsample, int tot, float epsilon)
 			}
 		}
 
-		if(a == tot) {
+		if (a == tot) {
 			ds--;
 			a--;
 		}
@@ -254,7 +255,7 @@ static int compress_deepsamples(DeepSample *dsample, int tot, float epsilon)
 		/* always previous z */
 		z= ds->z;
 
-		if(first || a==tot-1) {
+		if (first || a==tot-1) {
 			/* if slopes were not initialized, use last visibility */
 			v= ds->v;
 		}
@@ -271,14 +272,16 @@ static int compress_deepsamples(DeepSample *dsample, int tot, float epsilon)
 		newds->v= v;
 	}
 
-	if(newtot == 0 || (newds->v != (newds-1)->v))
+	if (newtot == 0 || (newds->v != (newds-1)->v))
 		newtot++;
 
-	/*if(print) {
-		for(a=0, ds=dsample; a<newtot; a++, ds++)
+#if 0
+	if (print) {
+		for (a=0, ds=dsample; a<newtot; a++, ds++)
 			printf("%lf,%f ", ds->z/(double)0x7FFFFFFF, ds->v);
 		printf("\n");
-	}*/
+	}
+#endif
 
 	return newtot;
 }
@@ -288,7 +291,7 @@ static float deep_alpha(Render *re, int obinr, int facenr, int strand)
 	ObjectInstanceRen *obi= &re->objectinstance[obinr];
 	Material *ma;
 
-	if(strand) {
+	if (strand) {
 		StrandRen *strand= RE_findOrAddStrand(obi->obr, facenr-1);
 		ma= strand->buffer->ma;
 	}
@@ -324,32 +327,32 @@ static void compress_deepshadowbuf(Render *re, ShadBuf *shb, APixstr *apixbuf, A
 
 	ap= apixbuf;
 	aps= apixbufstrand;
-	for(a=0; a<size*size; a++, ap++, aps++) {
+	for (a=0; a<size*size; a++, ap++, aps++) {
 		/* count number of samples */
-		for(c=0; c<totbuf; c++)
+		for (c=0; c<totbuf; c++)
 			sampletot[c]= 0;
 
 		tot= 0;
-		for(apn=ap; apn; apn=apn->next)
-			for(b=0; b<4; b++)
-				if(apn->p[b])
-					for(c=0; c<totbuf; c++)
-						if(apn->mask[b] & (1<<c))
+		for (apn=ap; apn; apn=apn->next)
+			for (b=0; b<4; b++)
+				if (apn->p[b])
+					for (c=0; c<totbuf; c++)
+						if (apn->mask[b] & (1<<c))
 							sampletot[c]++;
 
-		if(apixbufstrand) {
-			for(apns=aps; apns; apns=apns->next)
-				for(b=0; b<4; b++)
-					if(apns->p[b])
-						for(c=0; c<totbuf; c++)
-							if(apns->mask[b] & (1<<c))
+		if (apixbufstrand) {
+			for (apns=aps; apns; apns=apns->next)
+				for (b=0; b<4; b++)
+					if (apns->p[b])
+						for (c=0; c<totbuf; c++)
+							if (apns->mask[b] & (1<<c))
 								sampletot[c]++;
 		}
 
-		for(c=0; c<totbuf; c++)
+		for (c=0; c<totbuf; c++)
 			tot += sampletot[c];
 
-		if(tot == 0) {
+		if (tot == 0) {
 			shsample->deepbuf[a]= NULL;
 			shsample->totbuf[a]= 0;
 			continue;
@@ -357,14 +360,14 @@ static void compress_deepshadowbuf(Render *re, ShadBuf *shb, APixstr *apixbuf, A
 
 		/* fill samples */
 		ds[0]= sampleds[0]= MEM_callocN(sizeof(DeepSample)*tot*2, "deepsample");
-		for(c=1; c<totbuf; c++)
+		for (c=1; c<totbuf; c++)
 			ds[c]= sampleds[c]= sampleds[c-1] + sampletot[c-1]*2;
 
-		for(apn=ap; apn; apn=apn->next) {
-			for(b=0; b<4; b++) {
-				if(apn->p[b]) {
-					for(c=0; c<totbuf; c++) {
-						if(apn->mask[b] & (1<<c)) {
+		for (apn=ap; apn; apn=apn->next) {
+			for (b=0; b<4; b++) {
+				if (apn->p[b]) {
+					for (c=0; c<totbuf; c++) {
+						if (apn->mask[b] & (1<<c)) {
 							/* two entries to create step profile */
 							ds[c]->z= apn->z[b];
 							ds[c]->v= 1.0f; /* not used */
@@ -378,12 +381,12 @@ static void compress_deepshadowbuf(Render *re, ShadBuf *shb, APixstr *apixbuf, A
 			}
 		}
 
-		if(apixbufstrand) {
-			for(apns=aps; apns; apns=apns->next) {
-				for(b=0; b<4; b++) {
-					if(apns->p[b]) {
-						for(c=0; c<totbuf; c++) {
-							if(apns->mask[b] & (1<<c)) {
+		if (apixbufstrand) {
+			for (apns=aps; apns; apns=apns->next) {
+				for (b=0; b<4; b++) {
+					if (apns->p[b]) {
+						for (c=0; c<totbuf; c++) {
+							if (apns->mask[b] & (1<<c)) {
 								/* two entries to create step profile */
 								ds[c]->z= apns->z[b];
 								ds[c]->v= 1.0f; /* not used */
@@ -398,7 +401,7 @@ static void compress_deepshadowbuf(Render *re, ShadBuf *shb, APixstr *apixbuf, A
 			}
 		}
 
-		for(c=0; c<totbuf; c++) {
+		for (c=0; c<totbuf; c++) {
 			/* sort by increasing z */
 			qsort(sampleds[c], sampletot[c], sizeof(DeepSample)*2, verg_deepsample);
 
@@ -406,7 +409,7 @@ static void compress_deepshadowbuf(Render *re, ShadBuf *shb, APixstr *apixbuf, A
 			visibility= 1.0f;
 			ds[c]= sampleds[c];
 
-			for(b=0; b<sampletot[c]; b++) {
+			for (b=0; b<sampletot[c]; b++) {
 				/* two entries creating step profile */
 				ds[c]->v= visibility;
 				ds[c]++;
@@ -418,8 +421,8 @@ static void compress_deepshadowbuf(Render *re, ShadBuf *shb, APixstr *apixbuf, A
 
 			/* halfway trick, probably won't work well for volumes? */
 			ds[c]= sampleds[c];
-			for(b=0; b<sampletot[c]; b++) {
-				if(b+1 < sampletot[c]) {
+			for (b=0; b<sampletot[c]; b++) {
+				if (b+1 < sampletot[c]) {
 					ds[c]->z= (ds[c]->z>>1) + ((ds[c]+2)->z>>1);
 					ds[c]++;
 					ds[c]->z= (ds[c]->z>>1) + ((ds[c]+2)->z>>1);
@@ -443,31 +446,31 @@ static void compress_deepshadowbuf(Render *re, ShadBuf *shb, APixstr *apixbuf, A
 
 		/* merge buffers */
 		dsb= shsample->deepbuf[a];
-		while(1) {
+		while (1) {
 			minz= 0;
 			found= 0;
 
-			for(c=0; c<totbuf; c++) {
-				if(sampletot[c] && (!found || ds[c]->z < minz)) {
+			for (c=0; c<totbuf; c++) {
+				if (sampletot[c] && (!found || ds[c]->z < minz)) {
 					minz= ds[c]->z;
 					found= 1;
 				}
 			}
 
-			if(!found)
+			if (!found)
 				break;
 
 			dsb->z= minz;
 			dsb->v= 0.0f;
 
 			visibility= 0.0f;
-			for(c=0; c<totbuf; c++) {
-				if(sampletot[c] && ds[c]->z == minz) {
+			for (c=0; c<totbuf; c++) {
+				if (sampletot[c] && ds[c]->z == minz) {
 					ds[c]++;
 					sampletot[c]--;
 				}
 
-				if(sampleds[c] == ds[c])
+				if (sampleds[c] == ds[c])
 					visibility += totbuf_f_inv;
 				else
 					visibility += (ds[c]-1)->v / totbuf_f;
@@ -485,7 +488,7 @@ static void compress_deepshadowbuf(Render *re, ShadBuf *shb, APixstr *apixbuf, A
 		shsample->totbuf[a]= newtot;
 		totsamplec += newtot;
 
-		if(newtot < prevtot) {
+		if (newtot < prevtot) {
 			newbuf= MEM_mallocN(sizeof(DeepSample)*newtot, "cdeepsample");
 			memcpy(newbuf, shsample->deepbuf[a], sizeof(DeepSample)*newtot);
 			MEM_freeN(shsample->deepbuf[a]);
@@ -520,20 +523,20 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
 	/* help buffer */
 	rcline= MEM_mallocN(256*4+sizeof(int), "makeshadbuf2");
 	
-	for(y=0; y<size; y+=16) {
-		if(y< size/2) miny= y+15-size/2;
+	for (y=0; y<size; y+=16) {
+		if (y< size/2) miny= y+15-size/2;
 		else miny= y-size/2;	
 		
-		for(x=0; x<size; x+=16) {
+		for (x=0; x<size; x+=16) {
 			
 			/* is tile within spotbundle? */
 			a= size/2;
-			if(x< a) minx= x+15-a;
+			if (x< a) minx= x+15-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 */
+			if (square==0 && dist>(float)(a+12)) {	/* 12, tested with a onlyshadow lamp */
 				a= 256; verg= 0; /* 0x80000000; */ /* 0x7FFFFFFF; */
 				rz1= (&verg)+1;
 			} 
@@ -543,11 +546,11 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
 				
 				verg= (*rz1 & 0xFFFFFF00);
 				
-				for(a=0;a<256;a++,rz1++) {
-					if( (*rz1 & 0xFFFFFF00) !=verg) break;
+				for (a=0;a<256;a++,rz1++) {
+					if ( (*rz1 & 0xFFFFFF00) !=verg) break;
 				}
 			}
-			if(a==256) { /* complete empty tile */
+			if (a==256) { /* complete empty tile */
 				*ctile= 0;
 				*ztile= *(rz1-1);
 			}
@@ -561,13 +564,13 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
 				verg1= rc[BCOMP];
 				rc+= 4;
 				byt1= 1; byt2= 1;
-				for(a=1;a<256;a++,rc+=4) {
+				for (a=1;a<256;a++,rc+=4) {
 					byt1 &= (verg==rc[ACOMP]);
 					byt2 &= (verg1==rc[BCOMP]);
 					
-					if(byt1==0) break;
+					if (byt1==0) break;
 				}
-				if(byt1 && byt2) {	/* only store byte */
+				if (byt1 && byt2) {	/* only store byte */
 					*ctile= 1;
 					*ztile= (uintptr_t)MEM_mallocN(256+4, "tile1");
 					rz= (int *)*ztile;
@@ -575,9 +578,9 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
 					
 					zt= (char *)(rz+1);
 					rc= rcline;
-					for(a=0; a<256; a++, zt++, rc+=4) *zt= rc[GCOMP];	
+					for (a=0; a<256; a++, zt++, rc+=4) *zt= rc[GCOMP];
 				}
-				else if(byt1) {		/* only store short */
+				else if (byt1) {		/* only store short */
 					*ctile= 2;
 					*ztile= (uintptr_t)MEM_mallocN(2*256+4,"Tile2");
 					rz= (int *)*ztile;
@@ -585,7 +588,7 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
 					
 					zt= (char *)(rz+1);
 					rc= rcline;
-					for(a=0; a<256; a++, zt+=2, rc+=4) {
+					for (a=0; a<256; a++, zt+=2, rc+=4) {
 						zt[0]= rc[BCOMP];
 						zt[1]= rc[GCOMP];
 					}
@@ -596,7 +599,7 @@ static void compress_shadowbuf(ShadBuf *shb, int *rectz, int square)
 
 					zt= (char *)*ztile;
 					rc= rcline;
-					for(a=0; a<256; a++, zt+=3, rc+=4) {
+					for (a=0; a<256; a++, zt+=3, rc+=4) {
 						zt[0]= rc[ACOMP];
 						zt[1]= rc[BCOMP];
 						zt[2]= rc[GCOMP];
@@ -627,19 +630,19 @@ static void shadowbuf_autoclip(Render *re, LampRen *lar)
 	minz= 1.0e30f; maxz= -1.0e30f;
 	copy_m4_m4(viewmat, lar->shb->viewmat);
 	
-	if(lar->mode & (LA_LAYER|LA_LAYER_SHADOW)) lay= lar->lay;
+	if (lar->mode & (LA_LAYER|LA_LAYER_SHADOW)) lay= lar->lay;
 
 	maxtotvert= 0;
-	for(obr=re->objecttable.first; obr; obr=obr->next)
+	for (obr=re->objecttable.first; obr; obr=obr->next)
 		maxtotvert= MAX2(obr->totvert, maxtotvert);
 
 	clipflag= MEM_callocN(sizeof(char)*maxtotvert, "autoclipflag");
 
 	/* set clip in vertices when face visible */
-	for(i=0, obi=re->instancetable.first; obi; i++, obi=obi->next) {
+	for (i=0, obi=re->instancetable.first; obi; i++, obi=obi->next) {
 		obr= obi->obr;
 
-		if(obi->flag & R_TRANSFORMED)
+		if (obi->flag & R_TRANSFORMED)
 			mult_m4_m4m4(obviewmat, viewmat, obi->mat);
 		else
 			copy_m4_m4(obviewmat, viewmat);
@@ -647,35 +650,35 @@ static void shadowbuf_autoclip(Render *re, LampRen *lar)
 		memset(clipflag, 0, sizeof(char)*obr->totvert);
 
 		/* clear clip, is being set if face is visible (clip is calculated for real later) */
-		for(a=0; a<obr->totvlak; a++) {
-			if((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
+		for (a=0; a<obr->totvlak; a++) {
+			if ((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
 			else vlr++;
 			
 			/* note; these conditions are copied from zbuffer_shadow() */
-			if(vlr->mat!= ma) {
+			if (vlr->mat!= ma) {
 				ma= vlr->mat;
 				ok= 1;
-				if((ma->mode & MA_SHADBUF)==0) ok= 0;
+				if ((ma->mode & MA_SHADBUF)==0) ok= 0;
 			}
 			
-			if(ok && (obi->lay & lay)) {
+			if (ok && (obi->lay & lay)) {
 				clipflag[vlr->v1->index]= 1;
 				clipflag[vlr->v2->index]= 1;
 				clipflag[vlr->v3->index]= 1;
-				if(vlr->v4) clipflag[vlr->v4->index]= 1;
+				if (vlr->v4) clipflag[vlr->v4->index]= 1;
 			}				
 		}		
 		
 		/* calculate min and max */
-		for(a=0; a< obr->totvert;a++) {
-			if((a & 255)==0) ver= RE_findOrAddVert(obr, a);
+		for (a=0; a< obr->totvert;a++) {
+			if ((a & 255)==0) ver= RE_findOrAddVert(obr, a);
 			else ver++;
 			
-			if(clipflag[a]) {
+			if (clipflag[a]) {
 				copy_v3_v3(vec, ver->co);
 				mul_m4_v3(obviewmat, vec);
 				/* Z on visible side of lamp space */
-				if(vec[2] < 0.0f) {
+				if (vec[2] < 0.0f) {
 					float inpr, z= -vec[2];
 					
 					/* since vec is rotated in lampspace, this is how to get the cosine of angle */
@@ -684,9 +687,9 @@ static void shadowbuf_autoclip(Render *re, LampRen *lar)
 					normalize_v3(vec);
 					inpr= - vec[2];
 
-					if(inpr>=lar->spotsi) {
-						if(z<minz) minz= z;
-						if(z>maxz) maxz= z;
+					if (inpr>=lar->spotsi) {
+						if (z<minz) minz= z;
+						if (z>maxz) maxz= z;
 					}
 				}
 			}
@@ -696,13 +699,13 @@ static void shadowbuf_autoclip(Render *re, LampRen *lar)
 	MEM_freeN(clipflag);
 	
 	/* set clipping min and max */
-	if(minz < maxz) {
+	if (minz < maxz) {
 		float delta= (maxz - minz);	/* threshold to prevent precision issues */
 		
 		//printf("minz %f maxz %f delta %f\n", minz, maxz, delta);
-		if(lar->bufflag & LA_SHADBUF_AUTO_START)
+		if (lar->bufflag & LA_SHADBUF_AUTO_START)
 			lar->shb->d= minz - delta*0.02f;	/* 0.02 is arbitrary... needs more thinking! */
-		if(lar->bufflag & LA_SHADBUF_AUTO_END)
+		if (lar->bufflag & LA_SHADBUF_AUTO_END)
 			lar->shb->clipend= maxz + delta*0.1f;
 		
 		/* bias was calculated as percentage, we scale it to prevent animation issues */
@@ -720,12 +723,12 @@ static void makeflatshadowbuf(Render *re, LampRen *lar, float *jitbuf)
 	/* zbuffering */
 	rectz= MEM_mapallocN(sizeof(int)*shb->size*shb->size, "makeshadbuf");
 	
-	for(samples=0; samples<shb->totbuf; samples++) {
+	for (samples=0; samples<shb->totbuf; samples++) {
 		zbuffer_shadow(re, shb->persmat, lar, rectz, shb->size, jitbuf[2*samples], jitbuf[2*samples+1]);
 		/* create Z tiles (for compression): this system is 24 bits!!! */
 		compress_shadowbuf(shb, rectz, lar->mode & LA_SQUARE);
 
-		if(re->test_break(re->tbh))
+		if (re->test_break(re->tbh))
 			break;
 	}
 	
@@ -741,7 +744,7 @@ static void makedeepshadowbuf(Render *re, LampRen *lar, float *jitbuf)
 
 	/* zbuffering */
 	apixbuf= MEM_callocN(sizeof(APixstr)*shb->size*shb->size, "APixbuf");
-	if(re->totstrand)
+	if (re->totstrand)
 		apixbufstrand= MEM_callocN(sizeof(APixstrand)*shb->size*shb->size, "APixbufstrand");
 
 	zbuffer_abuf_shadow(re, lar, shb->persmat, apixbuf, apixbufstrand, &apsmbase, shb->size,
@@ -751,7 +754,7 @@ static void makedeepshadowbuf(Render *re, LampRen *lar, float *jitbuf)
 	compress_deepshadowbuf(re, shb, apixbuf, apixbufstrand);
 	
 	MEM_freeN(apixbuf);
-	if(apixbufstrand)
+	if (apixbufstrand)
 		MEM_freeN(apixbufstrand);
 	freepsA(&apsmbase);
 }
@@ -761,15 +764,15 @@ void makeshadowbuf(Render *re, LampRen *lar)
 	ShadBuf *shb= lar->shb;
 	float wsize, *jitbuf, twozero[2]= {0.0f, 0.0f}, angle, temp;
 	
-	if(lar->bufflag & (LA_SHADBUF_AUTO_START|LA_SHADBUF_AUTO_END))
+	if (lar->bufflag & (LA_SHADBUF_AUTO_START|LA_SHADBUF_AUTO_END))
 		shadowbuf_autoclip(re, lar);
 	
-	/* just to enforce identical behaviour of all irregular buffers */
-	if(lar->buftype==LA_SHADBUF_IRREGULAR)
+	/* just to enforce identical behavior of all irregular buffers */
+	if (lar->buftype==LA_SHADBUF_IRREGULAR)
 		shb->size= 1024;
 	
 	/* matrices and window: in winmat the transformation is being put,
-		transforming from observer view to lamp view, including lamp window matrix */
+	 * transforming from observer view to lamp view, including lamp window matrix */
 	
 	angle= saacos(lar->spotsi);
 	temp= 0.5f*shb->size*cos(angle)/sin(angle);
@@ -779,7 +782,7 @@ void makeshadowbuf(Render *re, LampRen *lar)
 	perspective_m4( shb->winmat,-wsize, wsize, -wsize, wsize, shb->d, shb->clipend);
 	mult_m4_m4m4(shb->persmat, shb->winmat, shb->viewmat);
 
-	if(ELEM3(lar->buftype, LA_SHADBUF_REGULAR, LA_SHADBUF_HALFWAY, LA_SHADBUF_DEEP)) {
+	if (ELEM3(lar->buftype, LA_SHADBUF_REGULAR, LA_SHADBUF_HALFWAY, LA_SHADBUF_DEEP)) {
 		shb->totbuf= lar->buffers;
 
 		/* jitter, weights - not threadsafe! */
@@ -788,12 +791,12 @@ void makeshadowbuf(Render *re, LampRen *lar)
 		make_jitter_weight_tab(re, shb, lar->filtertype);
 		BLI_unlock_thread(LOCK_CUSTOM1);
 		
-		if(shb->totbuf==4) jitbuf= give_jitter_tab(2);
-		else if(shb->totbuf==9) jitbuf= give_jitter_tab(3);
+		if (shb->totbuf==4) jitbuf= give_jitter_tab(2);
+		else if (shb->totbuf==9) jitbuf= give_jitter_tab(3);
 		else jitbuf= twozero;
 		
 		/* zbuffering */
-		if(lar->buftype == LA_SHADBUF_DEEP) {
+		if (lar->buftype == LA_SHADBUF_DEEP) {
 			makedeepshadowbuf(re, lar, jitbuf);
 			shb->totbuf= 1;
 		}
@@ -811,8 +814,8 @@ static void *do_shadow_thread(void *re_v)
 
 	do {
 		BLI_lock_thread(LOCK_CUSTOM1);
-		for(lar=re->lampren.first; lar; lar=lar->next) {
-			if(lar->shb && !lar->thread_assigned) {
+		for (lar=re->lampren.first; lar; lar=lar->next) {
+			if (lar->shb && !lar->thread_assigned) {
 				lar->thread_assigned= 1;
 				break;
 			}
@@ -820,13 +823,13 @@ static void *do_shadow_thread(void *re_v)
 		BLI_unlock_thread(LOCK_CUSTOM1);
 
 		/* if type is irregular, this only sets the perspective matrix and autoclips */
-		if(lar) {
+		if (lar) {
 			makeshadowbuf(re, lar);
 			BLI_lock_thread(LOCK_CUSTOM1);
 			lar->thread_ready= 1;
 			BLI_unlock_thread(LOCK_CUSTOM1);
 		}
-	} while(lar && !re->test_break(re->tbh));
+	} while (lar && !re->test_break(re->tbh));
 
 	return NULL;
 }
@@ -845,9 +848,9 @@ void threaded_makeshadowbufs(Render *re)
 	int (*test_break)(void *);
 
 	/* count number of threads to use */
-	if(G.rendering) {
-		for(lar=re->lampren.first; lar; lar= lar->next)
-			if(lar->shb)
+	if (G.rendering) {
+		for (lar=re->lampren.first; lar; lar= lar->next)
+			if (lar->shb)
 				totthread++;
 		
 		totthread= MIN2(totthread, re->r.threads);
@@ -855,10 +858,10 @@ void threaded_makeshadowbufs(Render *re)
 	else
 		totthread= 1; /* preview render */
 
-	if(totthread <= 1) {
-		for(lar=re->lampren.first; lar; lar= lar->next) {
-			if(re->test_break(re->tbh)) break;
-			if(lar->shb) {
+	if (totthread <= 1) {
+		for (lar=re->lampren.first; lar; lar= lar->next) {
+			if (re->test_break(re->tbh)) break;
+			if (lar->shb) {
 				/* if type is irregular, this only sets the perspective matrix and autoclips */
 				makeshadowbuf(re, lar);
 			}
@@ -869,29 +872,29 @@ void threaded_makeshadowbufs(Render *re)
 		test_break= re->test_break;
 		re->test_break= thread_break;
 
-		for(lar=re->lampren.first; lar; lar= lar->next) {
+		for (lar=re->lampren.first; lar; lar= lar->next) {
 			lar->thread_assigned= 0;
 			lar->thread_ready= 0;
 		}
 
 		BLI_init_threads(&threads, do_shadow_thread, totthread);
 		
-		for(a=0; a<totthread; a++)
+		for (a=0; a<totthread; a++)
 			BLI_insert_thread(&threads, re);
 
 		/* keep rendering as long as there are shadow buffers not ready */
 		do {
-			if((g_break=test_break(re->tbh)))
+			if ((g_break=test_break(re->tbh)))
 				break;
 
 			PIL_sleep_ms(50);
 
 			BLI_lock_thread(LOCK_CUSTOM1);
-			for(lar=re->lampren.first; lar; lar= lar->next)
-				if(lar->shb && !lar->thread_ready)
+			for (lar=re->lampren.first; lar; lar= lar->next)
+				if (lar->shb && !lar->thread_ready)
 					break;
 			BLI_unlock_thread(LOCK_CUSTOM1);
-		} while(lar);
+		} while (lar);
 	
 		BLI_end_threads(&threads);
 
@@ -903,16 +906,16 @@ void threaded_makeshadowbufs(Render *re)
 
 void freeshadowbuf(LampRen *lar)
 {
-	if(lar->shb) {
+	if (lar->shb) {
 		ShadBuf *shb= lar->shb;
 		ShadSampleBuf *shsample;
 		int b, v;
 		
-		for(shsample= shb->buffers.first; shsample; shsample= shsample->next) {
-			if(shsample->deepbuf) {
+		for (shsample= shb->buffers.first; shsample; shsample= shsample->next) {
+			if (shsample->deepbuf) {
 				v= shb->size*shb->size;
-				for(b=0; b<v; b++)
-					if(shsample->deepbuf[b])
+				for (b=0; b<v; b++)
+					if (shsample->deepbuf[b])
 						MEM_freeN(shsample->deepbuf[b]);
 					
 				MEM_freeN(shsample->deepbuf);
@@ -923,8 +926,8 @@ void freeshadowbuf(LampRen *lar)
 				char *ctile= shsample->cbuf;
 				
 				v= (shb->size*shb->size)/256;
-				for(b=0; b<v; b++, ztile++, ctile++)
-					if(*ctile) MEM_freeN((void *) *ztile);
+				for (b=0; b<v; b++, ztile++, ctile++)
+					if (*ctile) MEM_freeN((void *) *ztile);
 				
 				MEM_freeN(shsample->zbuf);
 				MEM_freeN(shsample->cbuf);
@@ -932,7 +935,7 @@ void freeshadowbuf(LampRen *lar)
 		}
 		BLI_freelistN(&shb->buffers);
 		
-		if(shb->weight) MEM_freeN(shb->weight);
+		if (shb->weight) MEM_freeN(shb->weight);
 		MEM_freeN(lar->shb);
 		
 		lar->shb= NULL;
@@ -946,22 +949,22 @@ static int firstreadshadbuf(ShadBuf *shb, ShadSampleBuf *shsample, int **rz, int
 	int ofs;
 	char *ct;
 
-	if(shsample->deepbuf)
+	if (shsample->deepbuf)
 		return 0;
 
 	/* always test borders of shadowbuffer */
-	if(xs<0) xs= 0; else if(xs>=shb->size) xs= shb->size-1;
-	if(ys<0) ys= 0; else if(ys>=shb->size) ys= shb->size-1;
+	if (xs<0) xs= 0; else if (xs>=shb->size) xs= shb->size-1;
+	if (ys<0) ys= 0; else if (ys>=shb->size) ys= shb->size-1;
 
 	/* calc z */
 	ofs= (ys>>4)*(shb->size>>4) + (xs>>4);
 	ct= shsample->cbuf+ofs;
-	if(*ct==0) {
-		if(nr==0) {
+	if (*ct==0) {
+		if (nr==0) {
 			*rz= *( (int **)(shsample->zbuf+ofs) );
 			return 1;
 		}
-		else if(*rz!= *( (int **)(shsample->zbuf+ofs) )) return 0;
+		else if (*rz!= *( (int **)(shsample->zbuf+ofs) )) return 0;
 		
 		return 1;
 	}
@@ -978,24 +981,23 @@ static float readdeepvisibility(DeepSample *dsample, int tot, int z, int bias, f
 	/* tricky stuff here; we use ints which can overflow easily with bias values */
 
 	ds= dsample;
-	for(a=0; a<tot && (z-bias > ds->z); a++, ds++)
-		;
+	for (a=0; a<tot && (z-bias > ds->z); a++, ds++) {}
 
-	if(a == tot) {
-		if(biast)
+	if (a == tot) {
+		if (biast)
 			*biast= 0.0f;
 		return (ds-1)->v; /* completely behind all samples */
 	}
 	
 	/* check if this read needs bias blending */
-	if(biast) {
-		if(z > ds->z)
+	if (biast) {
+		if (z > ds->z)
 			*biast= (float)(z - ds->z)/(float)bias;
 		else
 			*biast= 0.0f;
 	}
 
-	if(a == 0)
+	if (a == 0)
 		return 1.0f; /* completely in front of all samples */
 
 	/* converting to float early here because ds->z - prevds->z can overflow */
@@ -1009,18 +1011,18 @@ static float readdeepshadowbuf(ShadBuf *shb, ShadSampleBuf *shsample, int bias,
 	float v, biasv, biast;
 	int ofs, tot;
 
-	if(zs < - 0x7FFFFE00 + bias)
+	if (zs < - 0x7FFFFE00 + bias)
 		return 1.0;	/* extreme close to clipstart */
 
 	/* calc z */
 	ofs= ys*shb->size + xs;
 	tot= shsample->totbuf[ofs];
-	if(tot == 0)
+	if (tot == 0)
 		return 1.0f;
 
 	v= readdeepvisibility(shsample->deepbuf[ofs], tot, zs, bias, &biast);
 
-	if(biast != 0.0f) {
+	if (biast != 0.0f) {
 		/* in soft bias area */
 		biasv= readdeepvisibility(shsample->deepbuf[ofs], tot, zs, 0, 0);
 
@@ -1040,14 +1042,14 @@ static float readshadowbuf(ShadBuf *shb, ShadSampleBuf *shsample, int bias, int
 	char *ct, *cz;
 
 	/* simpleclip */
-	/* if(xs<0 || ys<0) return 1.0; */
-	/* if(xs>=shb->size || ys>=shb->size) return 1.0; */
+	/* if (xs<0 || ys<0) return 1.0; */
+	/* if (xs>=shb->size || ys>=shb->size) return 1.0; */
 	
 	/* always test borders of shadowbuffer */
-	if(xs<0) xs= 0; else if(xs>=shb->size) xs= shb->size-1;
-	if(ys<0) ys= 0; else if(ys>=shb->size) ys= shb->size-1;
+	if (xs<0) xs= 0; else if (xs>=shb->size) xs= shb->size-1;
+	if (ys<0) ys= 0; else if (ys>=shb->size) ys= shb->size-1;
 
-	if(shsample->deepbuf)
+	if (shsample->deepbuf)
 		return readdeepshadowbuf(shb, shsample, bias, xs, ys, zs);
 
 	/* calc z */
@@ -1055,14 +1057,14 @@ static float readshadowbuf(ShadBuf *shb, ShadSampleBuf *shsample, int bias, int
 	ct= shsample->cbuf+ofs;
 	rz= *( (int **)(shsample->zbuf+ofs) );
 
-	if(*ct==3) {
+	if (*ct==3) {
 		ct= ((char *)rz)+3*16*(ys & 15)+3*(xs & 15);
 		cz= (char *)&zsamp;
 		cz[ACOMP]= ct[0];
 		cz[BCOMP]= ct[1];
 		cz[GCOMP]= ct[2];
 	}
-	else if(*ct==2) {
+	else if (*ct==2) {
 		ct= ((char *)rz);
 		ct+= 4+2*16*(ys & 15)+2*(xs & 15);
 		zsamp= *rz;
@@ -1071,7 +1073,7 @@ static float readshadowbuf(ShadBuf *shb, ShadSampleBuf *shsample, int bias, int
 		cz[BCOMP]= ct[0];
 		cz[GCOMP]= ct[1];
 	}
-	else if(*ct==1) {
+	else if (*ct==1) {
 		ct= ((char *)rz);
 		ct+= 4+16*(ys & 15)+(xs & 15);
 		zsamp= *rz;
@@ -1088,9 +1090,9 @@ static float readshadowbuf(ShadBuf *shb, ShadSampleBuf *shsample, int bias, int
 
 	/* tricky stuff here; we use ints which can overflow easily with bias values */
 	
-	if(zsamp > zs) return 1.0; 		/* absolute no shadow */
-	else if(zs < - 0x7FFFFE00 + bias) return 1.0;	/* extreme close to clipstart */
-	else if(zsamp < zs-bias) return 0.0 ;	/* absolute in shadow */
+	if (zsamp > zs) return 1.0; 		/* absolute no shadow */
+	else if (zs < - 0x7FFFFE00 + bias) return 1.0;	/* extreme close to clipstart */
+	else if (zsamp < zs-bias) return 0.0;	/* absolute in shadow */
 	else {					/* soft area */
 		
 		temp=  ( (float)(zs- zsamp) )/(float)bias;
@@ -1110,7 +1112,7 @@ static void shadowbuf_project_co(float *x, float *y, float *z, ShadBuf *shb, con
 
 	*x= size*(1.0f+hco[0]/hco[3]);
 	*y= size*(1.0f+hco[1]/hco[3]);
-	if(z) *z= (hco[2]/hco[3]);
+	if (z) *z= (hco[2]/hco[3]);
 }
 
 /* the externally called shadow testing (reading) function */
@@ -1124,21 +1126,21 @@ float testshadowbuf(Render *re, ShadBuf *shb, const float co[3], const float dxc
 	short a, num;
 	
 	/* crash preventer */
-	if(shb->buffers.first==NULL)
+	if (shb->buffers.first==NULL)
 		return 1.0f;
 	
 	/* when facing away, assume fully in shadow */
-	if(inp <= 0.0f)
+	if (inp <= 0.0f)
 		return 0.0f;
 
 	/* project coordinate to pixel space */
 	shadowbuf_project_co(&xs1, &ys1, &zs1, shb, co);
 
 	/* clip z coordinate, z is projected so that (-1.0, 1.0) matches
-	   (clipstart, clipend), so we can do this simple test */
-	if(zs1>=1.0f)
+	 * (clipstart, clipend), so we can do this simple test */
+	if (zs1>=1.0f)
 		return 0.0f;
-	else if(zs1<= -1.0f)
+	else if (zs1<= -1.0f)
 		return 1.0f;
 
 	zs= ((float)0x7FFFFFFF)*zs1;
@@ -1149,15 +1151,15 @@ float testshadowbuf(Render *re, ShadBuf *shb, const float co[3], const float dxc
 	fac= shb->soft;
 	
 	/* compute z bias */
-	if(mat_bias!=0.0f) biasf= shb->bias*mat_bias;
+	if (mat_bias!=0.0f) biasf= shb->bias*mat_bias;
 	else biasf= shb->bias;
 	/* with inp==1.0, bias is half the size. correction value was 1.1, giving errors 
-	   on cube edges, with one side being almost frontal lighted (ton)  */
+	 * on cube edges, with one side being almost frontal lighted (ton)  */
 	bias= (1.5f-inp*inp)*biasf;
 	
 	/* in case of no filtering we can do things simpler */
-	if(num==1) {
-		for(shsample= shb->buffers.first; shsample; shsample= shsample->next)
+	if (num==1) {
+		for (shsample= shb->buffers.first; shsample; shsample= shsample->next)
 			shadfac += readshadowbuf(shb, shsample, bias, (int)xs1, (int)ys1, zs);
 		
 		return shadfac/(float)shb->totbuf;
@@ -1176,20 +1178,20 @@ float testshadowbuf(Render *re, ShadBuf *shb, const float co[3], const float dxc
 	
 	xres= fac*(fabs(dx[0]) + fabs(dy[0]));
 	yres= fac*(fabs(dx[1]) + fabs(dy[1]));
-	if(xres<1.0f) xres= 1.0f;
-	if(yres<1.0f) yres= 1.0f;
+	if (xres<1.0f) xres= 1.0f;
+	if (yres<1.0f) yres= 1.0f;
 	
 	/* make xs1/xs1 corner of sample area */
 	xs1 -= xres*0.5f;
 	ys1 -= yres*0.5f;
 
 	/* in case we have a constant value in a tile, we can do quicker lookup */
-	if(xres<16.0f && yres<16.0f) {
+	if (xres<16.0f && yres<16.0f) {
 		shsample= shb->buffers.first;
-		if(firstreadshadbuf(shb, shsample, &rz, (int)xs1, (int)ys1, 0)) {
-			if(firstreadshadbuf(shb, shsample, &rz, (int)(xs1+xres), (int)ys1, 1)) {
-				if(firstreadshadbuf(shb, shsample, &rz, (int)xs1, (int)(ys1+yres), 1)) {
-					if(firstreadshadbuf(shb, shsample, &rz, (int)(xs1+xres), (int)(ys1+yres), 1)) {
+		if (firstreadshadbuf(shb, shsample, &rz, (int)xs1, (int)ys1, 0)) {
+			if (firstreadshadbuf(shb, shsample, &rz, (int)(xs1+xres), (int)ys1, 1)) {
+				if (firstreadshadbuf(shb, shsample, &rz, (int)xs1, (int)(ys1+yres), 1)) {
+					if (firstreadshadbuf(shb, shsample, &rz, (int)(xs1+xres), (int)(ys1+yres), 1)) {
 						return readshadowbuf(shb, shsample, bias,(int)xs1, (int)ys1, zs);
 					}
 				}
@@ -1198,11 +1200,11 @@ float testshadowbuf(Render *re, ShadBuf *shb, const float co[3], const float dxc
 	}
 	
 	/* full jittered shadow buffer lookup */
-	for(shsample= shb->buffers.first; shsample; shsample= shsample->next) {
+	for (shsample= shb->buffers.first; shsample; shsample= shsample->next) {
 		jit= shb->jit;
 		weight= shb->weight;
 		
-		for(a=num; a>0; a--, jit+=2, weight++) {
+		for (a=num; a>0; a--, jit+=2, weight++) {
 			/* instead of jit i tried random: ugly! */
 			/* note: the plus 0.5 gives best sampling results, jit goes from -0.5 to 0.5 */
 			/* xs1 and ys1 are already corrected to be corner of sample area */
@@ -1230,15 +1232,15 @@ static float readshadowbuf_halo(ShadBuf *shb, ShadSampleBuf *shsample, int xs, i
 	bias= -shb->bias;
 	
 	/* simpleclip */
-	if(xs<0 || ys<0) return 0.0;
-	if(xs>=shb->size || ys>=shb->size) return 0.0;
+	if (xs<0 || ys<0) return 0.0;
+	if (xs>=shb->size || ys>=shb->size) return 0.0;
 
 	/* calc z */
 	ofs= (ys>>4)*(shb->size>>4) + (xs>>4);
 	ct= shsample->cbuf+ofs;
 	rz= *( (int **)(shsample->zbuf+ofs) );
 
-	if(*ct==3) {
+	if (*ct==3) {
 		ct= ((char *)rz)+3*16*(ys & 15)+3*(xs & 15);
 		cz= (char *)&zsamp;
 		zsamp= 0;
@@ -1246,7 +1248,7 @@ static float readshadowbuf_halo(ShadBuf *shb, ShadSampleBuf *shsample, int xs, i
 		cz[BCOMP]= ct[1];
 		cz[GCOMP]= ct[2];
 	}
-	else if(*ct==2) {
+	else if (*ct==2) {
 		ct= ((char *)rz);
 		ct+= 4+2*16*(ys & 15)+2*(xs & 15);
 		zsamp= *rz;
@@ -1255,7 +1257,7 @@ static float readshadowbuf_halo(ShadBuf *shb, ShadSampleBuf *shsample, int xs, i
 		cz[BCOMP]= ct[0];
 		cz[GCOMP]= ct[1];
 	}
-	else if(*ct==1) {
+	else if (*ct==1) {
 		ct= ((char *)rz);
 		ct+= 4+16*(ys & 15)+(xs & 15);
 		zsamp= *rz;
@@ -1272,16 +1274,16 @@ static float readshadowbuf_halo(ShadBuf *shb, ShadSampleBuf *shsample, int xs, i
 
 	/* NO schadow when sampled at 'eternal' distance */
 
-	if(zsamp >= 0x7FFFFE00) return 1.0; 
+	if (zsamp >= 0x7FFFFE00) return 1.0;
 
-	if(zsamp > zs) return 1.0; 		/* absolute no shadww */
+	if (zsamp > zs) return 1.0; 		/* absolute no shadww */
 	else {
 		/* bias is negative, so the (zs-bias) can be beyond 0x7fffffff */
 		zbias= 0x7fffffff - zs;
-		if(zbias > -bias) {
-			if( zsamp < zs-bias) return 0.0 ;	/* absolute in shadow */
+		if (zbias > -bias) {
+			if ( zsamp < zs-bias) return 0.0;	/* absolute in shadow */
 		}
-		else return 0.0 ;	/* absolute shadow */
+		else return 0.0;	/* absolute shadow */
 	}
 
 	/* soft area */
@@ -1329,8 +1331,8 @@ float shadow_halo(LampRen *lar, const float p1[3], const float p2[3])
 	xs1= (int)xf1;
 	ys1= (int)yf1;
 
-	if(xf1 != xf2) {
-		if(xf2-xf1 > 0.0f) {
+	if (xf1 != xf2) {
+		if (xf2-xf1 > 0.0f) {
 			labdax= (xf1-xs1-1.0f)/(xf1-xf2);
 			ldx= -shb->shadhalostep/(xf1-xf2);
 			dx= shb->shadhalostep;
@@ -1346,8 +1348,8 @@ float shadow_halo(LampRen *lar, const float p1[3], const float p2[3])
 		ldx= 0.0;
 	}
 
-	if(yf1 != yf2) {
-		if(yf2-yf1 > 0.0f) {
+	if (yf1 != yf2) {
+		if (yf2-yf1 > 0.0f) {
 			labday= (yf1-ys1-1.0f)/(yf1-yf2);
 			ldy= -shb->shadhalostep/(yf1-yf2);
 			dy= shb->shadhalostep;
@@ -1369,45 +1371,46 @@ float shadow_halo(LampRen *lar, const float p1[3], const float p2[3])
 
 /* printf("start %x %x	\n", (int)(0x7FFFFFFF*zf1), (int)(0x7FFFFFFF*zf2)); */
 
-	while(1) {
+	while (1) {
 		labdao= labda;
 		
-		if(labdax==labday) {
+		if (labdax==labday) {
 			labdax+= ldx;
 			x+= dx;
 			labday+= ldy;
 			y+= dy;
 		}
 		else {
-			if(labdax<labday) {
+			if (labdax<labday) {
 				labdax+= ldx;
 				x+= dx;
-			} else {
+			}
+			else {
 				labday+= ldy;
 				y+= dy;
 			}
 		}
 		
 		labda= MIN2(labdax, labday);
-		if(labda==labdao || labda>=1.0f) break;
+		if (labda==labdao || labda>=1.0f) break;
 		
 		zf= zf1 + labda*(zf2-zf1);
 		count+= (float)shb->totbuf;
 
-		if(zf<= -1.0f) lightcount += 1.0f;	/* close to the spot */
+		if (zf<= -1.0f) lightcount += 1.0f;	/* close to the spot */
 		else {
 		
 			/* make sure, behind the clipend we extend halolines. */
-			if(zf>=1.0f) z= 0x7FFFF000;
+			if (zf>=1.0f) z= 0x7FFFF000;
 			else z= (int)(0x7FFFF000*zf);
 			
-			for(shsample= shb->buffers.first; shsample; shsample= shsample->next)
+			for (shsample= shb->buffers.first; shsample; shsample= shsample->next)
 				lightcount+= readshadowbuf_halo(shb, shsample, x, y, z);
 			
 		}
 	}
 	
-	if(count!=0.0f) return (lightcount/count);
+	if (count!=0.0f) return (lightcount/count);
 	return 0.0f;
 	
 }
@@ -1417,12 +1420,12 @@ float shadow_halo(LampRen *lar, const float p1[3], const float p2[3])
 /* ********** storage of all view samples in a raster of lists ***** */
 
 /* based on several articles describing this method, like:
-The Irregular Z-Buffer and its Application to Shadow Mapping
-Gregory S. Johnson - William R. Mark - Christopher A. Burns 
-and
-Alias-Free Shadow Maps
-Timo Aila and Samuli Laine
-*/
+ * The Irregular Z-Buffer and its Application to Shadow Mapping
+ * Gregory S. Johnson - William R. Mark - Christopher A. Burns
+ * and
+ * Alias-Free Shadow Maps
+ * Timo Aila and Samuli Laine
+ */
 
 /* bsp structure (actually kd tree) */
 
@@ -1460,10 +1463,10 @@ typedef struct BSPFace {
 /* boxes are in lamp projection */
 static void init_box(Boxf *box)
 {
-	box->xmin= 1000000.0f;
-	box->xmax= 0;
-	box->ymin= 1000000.0f;
-	box->ymax= 0;
+	box->xmin = 1000000.0f;
+	box->xmax = 0;
+	box->ymin = 1000000.0f;
+	box->ymax = 0;
 	box->zmin= 0x7FFFFFFF;
 	box->zmax= - 0x7FFFFFFF;
 }
@@ -1471,21 +1474,21 @@ static void init_box(Boxf *box)
 /* use v1 to calculate boundbox */
 static void bound_boxf(Boxf *box, const float v1[3])
 {
-	if(v1[0] < box->xmin) box->xmin= v1[0];
-	if(v1[0] > box->xmax) box->xmax= v1[0];
-	if(v1[1] < box->ymin) box->ymin= v1[1];
-	if(v1[1] > box->ymax) box->ymax= v1[1];
-	if(v1[2] < box->zmin) box->zmin= v1[2];
-	if(v1[2] > box->zmax) box->zmax= v1[2];
+	if (v1[0] < box->xmin) box->xmin = v1[0];
+	if (v1[0] > box->xmax) box->xmax = v1[0];
+	if (v1[1] < box->ymin) box->ymin = v1[1];
+	if (v1[1] > box->ymax) box->ymax = v1[1];
+	if (v1[2] < box->zmin) box->zmin= v1[2];
+	if (v1[2] > box->zmax) box->zmax= v1[2];
 }
 
 /* use v1 to calculate boundbox */
 static void bound_rectf(rctf *box, const float v1[2])
 {
-	if(v1[0] < box->xmin) box->xmin= v1[0];
-	if(v1[0] > box->xmax) box->xmax= v1[0];
-	if(v1[1] < box->ymin) box->ymin= v1[1];
-	if(v1[1] > box->ymax) box->ymax= v1[1];
+	if (v1[0] < box->xmin) box->xmin = v1[0];
+	if (v1[0] > box->xmax) box->xmax = v1[0];
+	if (v1[1] < box->ymin) box->ymin = v1[1];
+	if (v1[1] > box->ymax) box->ymax = v1[1];
 }
 
 
@@ -1494,7 +1497,7 @@ static void isb_bsp_split_init(ISBBranch *root, MemArena *mem, int level)
 {
 	
 	/* if level > 0 we create new branches and go deeper*/
-	if(level > 0) {
+	if (level > 0) {
 		ISBBranch *left, *right;
 		int i;
 		
@@ -1503,7 +1506,7 @@ static void isb_bsp_split_init(ISBBranch *root, MemArena *mem, int level)
 		root->divider[1]= 0.5f*(root->box.ymin+root->box.ymax);
 		
 		/* find best splitpoint */
-		if(root->box.xmax-root->box.xmin > root->box.ymax-root->box.ymin)
+		if (root->box.xmax-root->box.xmin > root->box.ymax-root->box.ymin)
 			i= root->index= 0;
 		else
 			i= root->index= 1;
@@ -1514,13 +1517,13 @@ static void isb_bsp_split_init(ISBBranch *root, MemArena *mem, int level)
 		/* box info */
 		left->box= root->box;
 		right->box= root->box;
-		if(i==0) {
-			left->box.xmax= root->divider[0];
-			right->box.xmin= root->divider[0];
+		if (i==0) {
+			left->box.xmax = root->divider[0];
+			right->box.xmin = root->divider[0];
 		}
 		else {
-			left->box.ymax= root->divider[1];
-			right->box.ymin= root->divider[1];
+			left->box.ymax = root->divider[1];
+			right->box.ymin = root->divider[1];
 		}
 		isb_bsp_split_init(left, mem, level-1);
 		isb_bsp_split_init(right, mem, level-1);
@@ -1540,7 +1543,7 @@ static void isb_bsp_split(ISBBranch *root, MemArena *mem)
 
 	/* splitpoint */
 	root->divider[0]= root->divider[1]= 0.0f;
-	for(a=BSPMAX_SAMPLE-1; a>=0; a--) {
+	for (a=BSPMAX_SAMPLE-1; a>=0; a--) {
 		root->divider[0]+= root->samples[a]->zco[0];
 		root->divider[1]+= root->samples[a]->zco[1];
 	}
@@ -1548,7 +1551,7 @@ static void isb_bsp_split(ISBBranch *root, MemArena *mem)
 	root->divider[1]/= BSPMAX_SAMPLE;
 	
 	/* find best splitpoint */
-	if(root->box.xmax-root->box.xmin > root->box.ymax-root->box.ymin)
+	if (root->box.xmax-root->box.xmin > root->box.ymax-root->box.ymin)
 		i= root->index= 0;
 	else
 		i= root->index= 1;
@@ -1562,15 +1565,15 @@ static void isb_bsp_split(ISBBranch *root, MemArena *mem)
 	right->samples= samples; // tmp
 	
 	/* split samples */
-	for(a=BSPMAX_SAMPLE-1; a>=0; a--) {
+	for (a=BSPMAX_SAMPLE-1; a>=0; a--) {
 		int comp= 0;
 		/* this prevents adding samples all to 1 branch when divider is equal to samples */
-		if(root->samples[a]->zco[i] == root->divider[i])
+		if (root->samples[a]->zco[i] == root->divider[i])
 			comp= a & 1;
-		else if(root->samples[a]->zco[i] < root->divider[i])
+		else if (root->samples[a]->zco[i] < root->divider[i])
 			comp= 1;
 		
-		if(comp==1) {
+		if (comp==1) {
 			left->samples[left->totsamp]= root->samples[a];
 			left->totsamp++;
 		}
@@ -1588,13 +1591,13 @@ static void isb_bsp_split(ISBBranch *root, MemArena *mem)
 	/* box info */
 	left->box= root->box;
 	right->box= root->box;
-	if(i==0) {
-		left->box.xmax= root->divider[0];
-		right->box.xmin= root->divider[0];
+	if (i==0) {
+		left->box.xmax = root->divider[0];
+		right->box.xmin = root->divider[0];
 	}
 	else {
-		left->box.ymax= root->divider[1];
-		right->box.ymin= root->divider[1];
+		left->box.ymax = root->divider[1];
+		right->box.ymin = root->divider[1];
 	}
 }
 
@@ -1610,8 +1613,8 @@ static int isb_bsp_insert(ISBBranch *root, MemArena *memarena, ISBSample *sample
 	root->totsamp++;
 	
 	/* going over branches until last one found */
-	while(bspn->left) {
-		if(zco[bspn->index] <= bspn->divider[bspn->index])
+	while (bspn->left) {
+		if (zco[bspn->index] <= bspn->divider[bspn->index])
 			bspn= bspn->left;
 		else
 			bspn= bspn->right;
@@ -1619,7 +1622,7 @@ static int isb_bsp_insert(ISBBranch *root, MemArena *memarena, ISBSample *sample
 	}
 	/* bspn now is the last branch */
 	
-	if(bspn->totsamp==BSPMAX_SAMPLE) {
+	if (bspn->totsamp==BSPMAX_SAMPLE) {
 		printf("error in bsp branch\n");	/* only for debug, cannot happen */
 		return 1;
 	}
@@ -1629,8 +1632,8 @@ static int isb_bsp_insert(ISBBranch *root, MemArena *memarena, ISBSample *sample
 	bspn->totsamp++;
 
 	/* split if allowed and needed */
-	if(bspn->totsamp==BSPMAX_SAMPLE) {
-		if(i==BSPMAX_DEPTH) {
+	if (bspn->totsamp==BSPMAX_SAMPLE) {
+		if (i==BSPMAX_DEPTH) {
 			bspn->totsamp--;	/* stop filling in... will give errors */
 			return 1;
 		}
@@ -1646,7 +1649,7 @@ static void bspface_init_strand(BSPFace *face)
 	face->radline= 0.5f* len_v2v2(face->v1, face->v2);
 	
 	mid_v3_v3v3(face->vec1, face->v1, face->v2);
-	if(face->v4)
+	if (face->v4)
 		mid_v3_v3v3(face->vec2, face->v3, face->v4);
 	else
 		copy_v3_v3(face->vec2, face->v3);
@@ -1657,7 +1660,7 @@ 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) {
+	if (face->len!=0.0f) {
 		face->radline_end= face->radline/sqrt(face->len);
 		face->len= 1.0f/face->len;
 	}
@@ -1671,18 +1674,18 @@ static int point_behind_strand(const float p[3], BSPFace *face)
 	
 	/* using code from dist_to_line_segment_v2(), distance vec to line-piece */
 
-	if(face->len==0.0f) {
+	if (face->len==0.0f) {
 		rc[0]= p[0]-face->vec1[0];
 		rc[1]= p[1]-face->vec1[1];
 		dist= (float)(sqrt(rc[0]*rc[0]+ rc[1]*rc[1]));
 		
-		if(dist < face->radline)
+		if (dist < face->radline)
 			return 1;
 	}
 	else {
 		float labda= ( face->rc[0]*(p[0]-face->vec1[0]) + face->rc[1]*(p[1]-face->vec1[1]) )*face->len;
 		
-		if(labda > -face->radline_end && labda < 1.0f+face->radline_end) { 
+		if (labda > -face->radline_end && labda < 1.0f+face->radline_end) {
 			/* hesse for dist: */
 			//dist= (float)(fabs( (p[0]-vec2[0])*rc[1] + (p[1]-vec2[1])*rc[0])/len);
 			
@@ -1693,9 +1696,9 @@ static int point_behind_strand(const float p[3], BSPFace *face)
 			rc[1]= pt[1]-p[1];
 			dist= (float)sqrt(rc[0]*rc[0]+ rc[1]*rc[1]);
 			
-			if(dist < face->radline) {
+			if (dist < face->radline) {
 				float zval= face->vec1[2] + labda*face->rc[2];
-				if(p[2] > zval)
+				if (p[2] > zval)
 					return 1;
 			}
 		}
@@ -1716,7 +1719,7 @@ static int point_behind_tria2d(const float p[3], const float v1[3], const float
 	c[1] = v3[1] - v1[1];
 	
 	div = a[0]*c[1] - a[1]*c[0];
-	if(div==0.0f)
+	if (div==0.0f)
 		return 0;
 	
 	h[0] = p[0] - v1[0];
@@ -1725,13 +1728,13 @@ static int point_behind_tria2d(const float p[3], const float v1[3], const float
 	div = 1.0f/div;
 	
 	u = (h[0]*c[1] - h[1]*c[0])*div;
-	if(u >= 0.0f) {
+	if (u >= 0.0f) {
 		v = (a[0]*h[1] - a[1]*h[0])*div;
-		if(v >= 0.0f) {
-			if( u + v <= 1.0f) {
+		if (v >= 0.0f) {
+			if ( u + v <= 1.0f) {
 				/* inside, now check if point p is behind */
 				float z=  (1.0f-u-v)*v1[2] + u*v2[2] + v*v3[2];
-				if(z <= p[2])
+				if (z <= p[2])
 					return 1;
 			}
 		}
@@ -1756,10 +1759,10 @@ static int rect_outside_line(rctf *rect, const float v1[3], const float v2[3], c
 	side= a*v3[0] + b*v3[1] + c < 0.0f;
 	
 	/* the four quad points */
-	if( side==(rect->xmin*a + rect->ymin*b + c >= 0.0f) )
-		if( side==(rect->xmax*a + rect->ymin*b + c >= 0.0f) )
-			if( side==(rect->xmax*a + rect->ymax*b + c >= 0.0f) )
-				if( side==(rect->xmin*a + rect->ymax*b + c >= 0.0f) )
+	if ( side==(rect->xmin*a + rect->ymin*b + c >= 0.0f) )
+		if ( side==(rect->xmax*a + rect->ymin*b + c >= 0.0f) )
+			if ( side==(rect->xmax*a + rect->ymax*b + c >= 0.0f) )
+				if ( side==(rect->xmin*a + rect->ymax*b + c >= 0.0f) )
 					return 1;
 	return 0;
 }
@@ -1767,11 +1770,11 @@ static int rect_outside_line(rctf *rect, const float v1[3], const float v2[3], c
 /* check if one of the triangle edges separates all rect points on 1 side */
 static int rect_isect_tria(rctf *rect, const float v1[3], const float v2[3], const float v3[3])
 {
-	if(rect_outside_line(rect, v1, v2, v3))
+	if (rect_outside_line(rect, v1, v2, v3))
 		return 0;
-	if(rect_outside_line(rect, v2, v3, v1))
+	if (rect_outside_line(rect, v2, v3, v1))
 		return 0;
-	if(rect_outside_line(rect, v3, v1, v2))
+	if (rect_outside_line(rect, v3, v1, v2))
 		return 0;
 	return 1;
 }
@@ -1782,18 +1785,18 @@ static void isb_bsp_face_inside(ISBBranch *bspn, BSPFace *face)
 {
 	
 	/* are we descending? */
-	if(bspn->left) {
+	if (bspn->left) {
 		/* hrmf, the box struct cannot be addressed with index */
-		if(bspn->index==0) {
-			if(face->box.xmin <= bspn->divider[0])
+		if (bspn->index==0) {
+			if (face->box.xmin <= bspn->divider[0])
 				isb_bsp_face_inside(bspn->left, face);
-			if(face->box.xmax > bspn->divider[0])
+			if (face->box.xmax > bspn->divider[0])
 				isb_bsp_face_inside(bspn->right, face);
 		}
 		else {
-			if(face->box.ymin <= bspn->divider[1])
+			if (face->box.ymin <= bspn->divider[1])
 				isb_bsp_face_inside(bspn->left, face);
-			if(face->box.ymax > bspn->divider[1])
+			if (face->box.ymax > bspn->divider[1])
 				isb_bsp_face_inside(bspn->right, face);
 		}
 	}
@@ -1801,42 +1804,42 @@ static void isb_bsp_face_inside(ISBBranch *bspn, BSPFace *face)
 		/* else: end branch reached */
 		int a;
 		
-		if(bspn->totsamp==0) return;
+		if (bspn->totsamp==0) return;
 		
 		/* check for nodes entirely in shadow, can be skipped */
-		if(bspn->totsamp==bspn->full)
+		if (bspn->totsamp==bspn->full)
 			return;
 		
 		/* if bsp node is entirely in front of face, give up */
-		if(bspn->box.zmax < face->box.zmin)
+		if (bspn->box.zmax < face->box.zmin)
 			return;
 		
 		/* if face boundbox is outside of branch rect, give up */
-		if(0==BLI_isect_rctf((rctf *)&face->box, (rctf *)&bspn->box, NULL))
+		if (0==BLI_isect_rctf((rctf *)&face->box, (rctf *)&bspn->box, NULL))
 			return;
 		
 		/* test all points inside branch */
-		for(a=bspn->totsamp-1; a>=0; a--) {
+		for (a=bspn->totsamp-1; a>=0; a--) {
 			ISBSample *samp= bspn->samples[a];
 			
-			if((samp->facenr!=face->facenr || samp->obi!=face->obi) && samp->shadfac) {
-				if(face->box.zmin < samp->zco[2]) {
-					if(BLI_in_rctf((rctf *)&face->box, samp->zco[0], samp->zco[1])) {
+			if ((samp->facenr!=face->facenr || samp->obi!=face->obi) && samp->shadfac) {
+				if (face->box.zmin < samp->zco[2]) {
+					if (BLI_in_rctf((rctf *)&face->box, samp->zco[0], samp->zco[1])) {
 						int inshadow= 0;
 						
-						if(face->type) {
-							if(point_behind_strand(samp->zco, face)) 
+						if (face->type) {
+							if (point_behind_strand(samp->zco, face))
 								inshadow= 1;
 						}
-						else if( point_behind_tria2d(samp->zco, face->v1, face->v2, face->v3))
+						else if ( point_behind_tria2d(samp->zco, face->v1, face->v2, face->v3))
 							inshadow= 1;
-						else if(face->v4 && point_behind_tria2d(samp->zco, face->v1, face->v3, face->v4))
+						else if (face->v4 && point_behind_tria2d(samp->zco, face->v1, face->v3, face->v4))
 							inshadow= 1;
 
-						if(inshadow) {
+						if (inshadow) {
 							*(samp->shadfac) += face->shad_alpha;
 							/* optimize; is_full means shad_alpha==4096 */
-							if(*(samp->shadfac) >= 4096 || face->is_full) {
+							if (*(samp->shadfac) >= 4096 || face->is_full) {
 								bspn->full++;
 								samp->shadfac= NULL;
 							}
@@ -1851,15 +1854,15 @@ static void isb_bsp_face_inside(ISBBranch *bspn, BSPFace *face)
 /* based on available samples, recalculate the bounding box for bsp nodes, recursive */
 static void isb_bsp_recalc_box(ISBBranch *root)
 {
-	if(root->left) {
+	if (root->left) {
 		isb_bsp_recalc_box(root->left);
 		isb_bsp_recalc_box(root->right);
 	}
-	else if(root->totsamp) {
+	else if (root->totsamp) {
 		int a;
 		
 		init_box(&root->box);
-		for(a=root->totsamp-1; a>=0; a--)
+		for (a=root->totsamp-1; a>=0; a--)
 			bound_boxf(&root->box, root->samples[a]->zco);
 	}	
 }
@@ -1876,7 +1879,7 @@ static void isb_bsp_test_strand(ZSpan *zspan, int obi, int zvlnr, float *v1, flo
 	face.obi= obi;
 	face.facenr= zvlnr & ~RE_QUAD_OFFS;
 	face.type= R_STRAND;
-	if(R.osa)
+	if (R.osa)
 		face.shad_alpha= (short)ceil(4096.0f*zspan->shad_alpha/(float)R.osa);
 	else
 		face.shad_alpha= (short)ceil(4096.0f*zspan->shad_alpha);
@@ -1888,7 +1891,7 @@ static void isb_bsp_test_strand(ZSpan *zspan, int obi, int zvlnr, float *v1, flo
 	bound_boxf(&face.box, v1);
 	bound_boxf(&face.box, v2);
 	bound_boxf(&face.box, v3);
-	if(v4)
+	if (v4)
 		bound_boxf(&face.box, v4);
 	
 	/* optimize values */
@@ -1910,7 +1913,7 @@ static void isb_bsp_test_face(ZSpan *zspan, int obi, int zvlnr, float *v1, float
 	face.obi= obi;
 	face.facenr= zvlnr & ~RE_QUAD_OFFS;
 	face.type= 0;
-	if(R.osa)
+	if (R.osa)
 		face.shad_alpha= (short)ceil(4096.0f*zspan->shad_alpha/(float)R.osa);
 	else
 		face.shad_alpha= (short)ceil(4096.0f*zspan->shad_alpha);
@@ -1922,7 +1925,7 @@ static void isb_bsp_test_face(ZSpan *zspan, int obi, int zvlnr, float *v1, float
 	bound_boxf(&face.box, v1);
 	bound_boxf(&face.box, v2);
 	bound_boxf(&face.box, v3);
-	if(v4)
+	if (v4)
 		bound_boxf(&face.box, v4);
 
 	isb_bsp_face_inside((ISBBranch *)zspan->rectz, &face);
@@ -1933,11 +1936,11 @@ static int testclip_minmax(const float ho[4], const float minmax[4])
 	float wco= ho[3];
 	int flag= 0;
 	
-	if( ho[0] > minmax[1]*wco) flag = 1;
-	else if( ho[0]< minmax[0]*wco) flag = 2;
+	if ( ho[0] > minmax[1]*wco) flag = 1;
+	else if ( ho[0]< minmax[0]*wco) flag = 2;
 	
-	if( ho[1] > minmax[3]*wco) flag |= 4;
-	else if( ho[1]< minmax[2]*wco) flag |= 8;
+	if ( ho[1] > minmax[3]*wco) flag |= 4;
+	else if ( ho[1]< minmax[2]*wco) flag |= 8;
 	
 	return flag;
 }
@@ -1964,7 +1967,7 @@ static void isb_bsp_fillfaces(Render *re, LampRen *lar, ISBBranch *root)
 	minmaxf[2]= (2.0f*root->box.ymin - size-2.0f)/size;
 	minmaxf[3]= (2.0f*root->box.ymax - size+2.0f)/size;
 	
-	if(lar->mode & (LA_LAYER|LA_LAYER_SHADOW)) lay= lar->lay;
+	if (lar->mode & (LA_LAYER|LA_LAYER_SHADOW)) lay= lar->lay;
 	
 	/* (ab)use zspan, since we use zbuffer clipping code */
 	zbuf_alloc_span(&zspan, size, size, re->clipcrop);
@@ -1983,29 +1986,29 @@ static void isb_bsp_fillfaces(Render *re, LampRen *lar, ISBBranch *root)
 	zspan.zbuffunc= isb_bsp_test_face;
 	zspanstrand.zbuffunc= isb_bsp_test_strand;
 	
-	for(i=0, obi=re->instancetable.first; obi; i++, obi=obi->next) {
+	for (i=0, obi=re->instancetable.first; obi; i++, obi=obi->next) {
 		obr= obi->obr;
 
-		if(obi->flag & R_TRANSFORMED)
+		if (obi->flag & R_TRANSFORMED)
 			mult_m4_m4m4(winmat, shb->persmat, obi->mat);
 		else
 			copy_m4_m4(winmat, shb->persmat);
 
-		for(a=0; a<obr->totvlak; a++) {
+		for (a=0; a<obr->totvlak; a++) {
 			
-			if((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
+			if ((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
 			else vlr++;
 			
 			/* note, these conditions are copied in shadowbuf_autoclip() */
-			if(vlr->mat!= ma) {
+			if (vlr->mat!= ma) {
 				ma= vlr->mat;
 				ok= 1;
-				if((ma->mode & MA_SHADBUF)==0) ok= 0;
-				if(ma->material_type == MA_TYPE_WIRE) ok= 0;
+				if ((ma->mode & MA_SHADBUF)==0) ok= 0;
+				if (ma->material_type == MA_TYPE_WIRE) ok= 0;
 				zspanstrand.shad_alpha= zspan.shad_alpha= ma->shad_alpha;
 			}
 			
-			if(ok && (obi->lay & lay)) {
+			if (ok && (obi->lay & lay)) {
 				float hoco[4][4];
 				int c1, c2, c3, c4=0;
 				int d1, d2, d3, d4=0;
@@ -2015,32 +2018,32 @@ static void isb_bsp_fillfaces(Render *re, LampRen *lar, ISBBranch *root)
 				projectvert(vlr->v1->co, winmat, hoco[0]); d1= testclip_minmax(hoco[0], minmaxf);
 				projectvert(vlr->v2->co, winmat, hoco[1]); d2= testclip_minmax(hoco[1], minmaxf);
 				projectvert(vlr->v3->co, winmat, hoco[2]); d3= testclip_minmax(hoco[2], minmaxf);
-				if(vlr->v4) {
+				if (vlr->v4) {
 					projectvert(vlr->v4->co, winmat, hoco[3]); d4= testclip_minmax(hoco[3], minmaxf);
 				}
 
 				/* minmax clipping */
-				if(vlr->v4) partclip= d1 & d2 & d3 & d4;
+				if (vlr->v4) partclip= d1 & d2 & d3 & d4;
 				else partclip= d1 & d2 & d3;
 				
-				if(partclip==0) {
+				if (partclip==0) {
 					
 					/* window clipping */
 					c1= testclip(hoco[0]); 
 					c2= testclip(hoco[1]); 
 					c3= testclip(hoco[2]); 
-					if(vlr->v4)
+					if (vlr->v4)
 						c4= testclip(hoco[3]); 
 					
 					/* ***** NO WIRE YET */			
-					if(ma->material_type == MA_TYPE_WIRE) {
-						if(vlr->v4)
+					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);
 						else
 							zbufclipwire(&zspan, i, a+1, vlr->ec, hoco[0], hoco[1], hoco[2], 0, c1, c2, c3, 0);
 					}
-					else if(vlr->v4) {
-						if(vlr->flag & R_STRAND)
+					else if (vlr->v4) {
+						if (vlr->flag & R_STRAND)
 							zbufclip4(&zspanstrand, i, a+1, hoco[0], hoco[1], hoco[2], hoco[3], c1, c2, c3, c4);
 						else
 							zbufclip4(&zspan, i, a+1, hoco[0], hoco[1], hoco[2], hoco[3], c1, c2, c3, c4);
@@ -2064,7 +2067,7 @@ static int viewpixel_to_lampbuf(ShadBuf *shb, ObjectInstanceRen *obi, VlakRen *v
 	
 	RE_vlakren_get_normal(&R, obi, vlr, nor);
 	copy_v3_v3(v1, vlr->v1->co);
-	if(obi->flag & R_TRANSFORMED)
+	if (obi->flag & R_TRANSFORMED)
 		mul_m4_v3(obi->mat, v1);
 
 	/* from shadepixel() */
@@ -2072,7 +2075,7 @@ static int viewpixel_to_lampbuf(ShadBuf *shb, ObjectInstanceRen *obi, VlakRen *v
 	hoco[3]= 1.0f;
 	
 	/* ortho viewplane cannot intersect using view vector originating in (0,0,0) */
-	if(R.r.mode & R_ORTHO) {
+	if (R.r.mode & R_ORTHO) {
 		/* x and y 3d coordinate can be derived from pixel coord and winmat */
 		float fx= 2.0f/(R.winx*R.winmat[0][0]);
 		float fy= 2.0f/(R.winy*R.winmat[1][1]);
@@ -2081,7 +2084,7 @@ static int viewpixel_to_lampbuf(ShadBuf *shb, ObjectInstanceRen *obi, VlakRen *v
 		hoco[1]= (y - 0.5f*R.winy)*fy - R.winmat[3][1]/R.winmat[1][1];
 		
 		/* using a*x + b*y + c*z = d equation, (a b c) is normal */
-		if(nor[2]!=0.0f)
+		if (nor[2]!=0.0f)
 			hoco[2]= (dface - nor[0]*hoco[0] - nor[1]*hoco[1])/nor[2];
 		else
 			hoco[2]= 0.0f;
@@ -2108,11 +2111,11 @@ static int viewpixel_to_lampbuf(ShadBuf *shb, ObjectInstanceRen *obi, VlakRen *v
 	/* clip We can test for -1.0/1.0 because of the properties of the
 	 * coordinate transformations. */
 	fac= fabs(hoco[3]);
-	if(hoco[0]<-fac || hoco[0]>fac)
+	if (hoco[0]<-fac || hoco[0]>fac)
 		return 0;
-	if(hoco[1]<-fac || hoco[1]>fac)
+	if (hoco[1]<-fac || hoco[1]>fac)
 		return 0;
-	if(hoco[2]<-fac || hoco[2]>fac)
+	if (hoco[2]<-fac || hoco[2]>fac)
 		return 0;
 	
 	siz= 0.5f*(float)shb->size;
@@ -2133,7 +2136,7 @@ static void isb_add_shadfac(ISBShadfacA **isbsapp, MemArena *mem, int obi, int f
 	float shadfacf;
 	
 	/* in osa case, the samples were filled in with factor 1.0/R.osa. if fewer samples we have to correct */
-	if(R.osa)
+	if (R.osa)
 		shadfacf= ((float)shadfac*R.osa)/(4096.0f*samples);
 	else
 		shadfacf= ((float)shadfac)/(4096.0f);
@@ -2142,7 +2145,7 @@ static void isb_add_shadfac(ISBShadfacA **isbsapp, MemArena *mem, int obi, int f
 	new->obi= obi;
 	new->facenr= facenr & ~RE_QUAD_OFFS;
 	new->shadfac= shadfacf;
-	if(*isbsapp)
+	if (*isbsapp)
 		new->next= (*isbsapp);
 	else
 		new->next= NULL;
@@ -2159,25 +2162,25 @@ static int isb_add_samples(RenderPart *pa, ISBBranch *root, MemArena *memarena,
 	/* bsp split doesn't like to handle regular sequences */
 	xcos= MEM_mallocN( pa->rectx*sizeof(int), "xcos");
 	ycos= MEM_mallocN( pa->recty*sizeof(int), "ycos");
-	for(xi=0; xi<pa->rectx; xi++)
+	for (xi=0; xi<pa->rectx; xi++)
 		xcos[xi]= xi;
-	for(yi=0; yi<pa->recty; yi++)
+	for (yi=0; yi<pa->recty; yi++)
 		ycos[yi]= yi;
 	BLI_array_randomize(xcos, sizeof(int), pa->rectx, 12345);
 	BLI_array_randomize(ycos, sizeof(int), pa->recty, 54321);
 	
-	for(sample=0; sample<(R.osa?R.osa:1); sample++) {
+	for (sample=0; sample<(R.osa?R.osa:1); sample++) {
 		ISBSample *samp= samplebuf[sample], *samp1;
 		
-		for(yi=0; yi<pa->recty; yi++) {
+		for (yi=0; yi<pa->recty; yi++) {
 			int y= ycos[yi];
-			for(xi=0; xi<pa->rectx; xi++) {
+			for (xi=0; xi<pa->rectx; xi++) {
 				int x= xcos[xi];
 				samp1= samp + y*pa->rectx + x;
-				if(samp1->facenr)
+				if (samp1->facenr)
 					bsp_err |= isb_bsp_insert(root, memarena, samp1);
 			}
-			if(bsp_err) break;
+			if (bsp_err) break;
 		}
 	}	
 	
@@ -2213,47 +2216,47 @@ static void isb_make_buffer(RenderPart *pa, LampRen *lar)
 	BLI_memarena_use_calloc(memarena);
 	
 	/* samplebuf is in camera view space (pixels) */
-	for(sample=0; sample<(R.osa?R.osa:1); sample++)
+	for (sample=0; sample<(R.osa?R.osa:1); sample++)
 		samplebuf[sample]= MEM_callocN(sizeof(ISBSample)*pa->rectx*pa->recty, "isb samplebuf");
 	
 	/* for end result, ISBSamples point to this in non OSA case, otherwise to pixstruct->shadfac */
-	if(R.osa==0)
+	if (R.osa==0)
 		isbdata->shadfacs= MEM_callocN(pa->rectx*pa->recty*sizeof(short), "isb shadfacs");
 	
 	/* setup bsp root */
 	memset(&root, 0, sizeof(ISBBranch));
-	root.box.xmin= (float)shb->size;
-	root.box.ymin= (float)shb->size;
+	root.box.xmin = (float)shb->size;
+	root.box.ymin = (float)shb->size;
 	
 	/* create the sample buffers */
-	for(sindex=0, y=0; y<pa->recty; y++) {
-		for(x=0; x<pa->rectx; x++, sindex++) {
+	for (sindex=0, y=0; y<pa->recty; y++) {
+		for (x=0; x<pa->rectx; x++, sindex++) {
 			
 			/* this makes it a long function, but splitting it out would mean 10+ arguments */
 			/* first check OSA case */
-			if(R.osa) {
+			if (R.osa) {
 				rd= pa->rectdaps + sindex;
-				if(*rd) {
+				if (*rd) {
 					float xs= (float)(x + pa->disprect.xmin);
 					float ys= (float)(y + pa->disprect.ymin);
 					
-					for(sample=0; sample<R.osa; sample++) {
+					for (sample=0; sample<R.osa; sample++) {
 						PixStr *ps= (PixStr *)(*rd);
 						int mask= (1<<sample);
 						
-						while(ps) {
-							if(ps->mask & mask)
+						while (ps) {
+							if (ps->mask & mask)
 								break;
 							ps= ps->next;
 						}
-						if(ps && ps->facenr>0) {
+						if (ps && ps->facenr>0) {
 							ObjectInstanceRen *obi= &R.objectinstance[ps->obi];
 							ObjectRen *obr= obi->obr;
 							VlakRen *vlr= RE_findOrAddVlak(obr, (ps->facenr-1) & RE_QUAD_MASK);
 							
 							samp= samplebuf[sample] + sindex;
 							/* convert image plane pixel location to lamp buffer space */
-							if(viewpixel_to_lampbuf(shb, obi, vlr, xs + R.jit[sample][0], ys + R.jit[sample][1], samp->zco)) {
+							if (viewpixel_to_lampbuf(shb, obi, vlr, xs + R.jit[sample][0], ys + R.jit[sample][1], samp->zco)) {
 								samp->obi= ps->obi;
 								samp->facenr= ps->facenr & ~RE_QUAD_OFFS;
 								ps->shadfac= 0;
@@ -2267,7 +2270,7 @@ static void isb_make_buffer(RenderPart *pa, LampRen *lar)
 			else {
 				rectp= pa->rectp + sindex;
 				recto= pa->recto + sindex;
-				if(*rectp>0) {
+				if (*rectp>0) {
 					ObjectInstanceRen *obi= &R.objectinstance[*recto];
 					ObjectRen *obr= obi->obr;
 					VlakRen *vlr= RE_findOrAddVlak(obr, (*rectp-1) & RE_QUAD_MASK);
@@ -2276,7 +2279,7 @@ static void isb_make_buffer(RenderPart *pa, LampRen *lar)
 					
 					samp= samplebuf[0] + sindex;
 					/* convert image plane pixel location to lamp buffer space */
-					if(viewpixel_to_lampbuf(shb, obi, vlr, xs, ys, samp->zco)) {
+					if (viewpixel_to_lampbuf(shb, obi, vlr, xs, ys, samp->zco)) {
 						samp->obi= *recto;
 						samp->facenr= *rectp & ~RE_QUAD_OFFS;
 						samp->shadfac= isbdata->shadfacs + sindex;
@@ -2288,7 +2291,7 @@ static void isb_make_buffer(RenderPart *pa, LampRen *lar)
 	}
 	
 	/* simple method to see if we have samples */
-	if(root.box.xmin != (float)shb->size) {
+	if (root.box.xmin != (float)shb->size) {
 		/* now create a regular split, root.box has the initial bounding box of all pixels */
 		/* split bsp 8 levels deep, in regular grid (16 x 16) */
 		isb_bsp_split_init(&root, memarena, 8);
@@ -2296,24 +2299,24 @@ static void isb_make_buffer(RenderPart *pa, LampRen *lar)
 		/* insert all samples in BSP now */
 		bsp_err= isb_add_samples(pa, &root, memarena, samplebuf);
 			
-		if(bsp_err==0) {
+		if (bsp_err==0) {
 			/* go over all faces and fill in shadow values */
 			
 			isb_bsp_fillfaces(&R, lar, &root);	/* shb->persmat should have been calculated */
 			
 			/* copy shadow samples to persistent buffer, reduce memory overhead */
-			if(R.osa) {
+			if (R.osa) {
 				ISBShadfacA **isbsa= isbdata->shadfaca= MEM_callocN(pa->rectx*pa->recty*sizeof(void *), "isb shadfacs");
 				
 				isbdata->memarena = BLI_memarena_new(0x8000 * sizeof(ISBSampleA), "isb arena");
 				BLI_memarena_use_calloc(isbdata->memarena);
 
-				for(rd= pa->rectdaps, x=pa->rectx*pa->recty; x>0; x--, rd++, isbsa++) {
+				for (rd= pa->rectdaps, x=pa->rectx*pa->recty; x>0; x--, rd++, isbsa++) {
 					
-					if(*rd) {
+					if (*rd) {
 						PixStr *ps= (PixStr *)(*rd);
-						while(ps) {
-							if(ps->shadfac)
+						while (ps) {
+							if (ps->shadfac)
 								isb_add_shadfac(isbsa, isbdata->memarena, ps->obi, ps->facenr, ps->shadfac, count_mask(ps->mask));
 							ps= ps->next;
 						}
@@ -2323,7 +2326,7 @@ static void isb_make_buffer(RenderPart *pa, LampRen *lar)
 		}
 	}
 	else {
-		if(isbdata->shadfacs) {
+		if (isbdata->shadfacs) {
 			MEM_freeN(isbdata->shadfacs);
 			isbdata->shadfacs= NULL;
 		}
@@ -2333,10 +2336,10 @@ static void isb_make_buffer(RenderPart *pa, LampRen *lar)
 	BLI_memarena_free(memarena);
 	
 	/* free samples */
-	for(x=0; x<(R.osa?R.osa:1); x++)
+	for (x=0; x<(R.osa?R.osa:1); x++)
 		MEM_freeN(samplebuf[x]);
 	
-	if(bsp_err) printf("error in filling bsp\n");
+	if (bsp_err) printf("error in filling bsp\n");
 }
 
 /* add sample to buffer, isbsa is the root sample in a buffer */
@@ -2345,7 +2348,7 @@ static ISBSampleA *isb_alloc_sample_transp(ISBSampleA **isbsa, MemArena *mem)
 	ISBSampleA *new;
 	
 	new= BLI_memarena_alloc(mem, sizeof(ISBSampleA));
-	if(*isbsa)
+	if (*isbsa)
 		new->next= (*isbsa);
 	else
 		new->next= NULL;
@@ -2363,28 +2366,28 @@ static int isb_add_samples_transp(RenderPart *pa, ISBBranch *root, MemArena *mem
 	/* bsp split doesn't like to handle regular sequences */
 	xcos= MEM_mallocN( pa->rectx*sizeof(int), "xcos");
 	ycos= MEM_mallocN( pa->recty*sizeof(int), "ycos");
-	for(xi=0; xi<pa->rectx; xi++)
+	for (xi=0; xi<pa->rectx; xi++)
 		xcos[xi]= xi;
-	for(yi=0; yi<pa->recty; yi++)
+	for (yi=0; yi<pa->recty; yi++)
 		ycos[yi]= yi;
 	BLI_array_randomize(xcos, sizeof(int), pa->rectx, 12345);
 	BLI_array_randomize(ycos, sizeof(int), pa->recty, 54321);
 	
-	for(sample=0; sample<(R.osa?R.osa:1); sample++) {
+	for (sample=0; sample<(R.osa?R.osa:1); sample++) {
 		ISBSampleA **samp= samplebuf[sample], *samp1;
 		
-		for(yi=0; yi<pa->recty; yi++) {
+		for (yi=0; yi<pa->recty; yi++) {
 			int y= ycos[yi];
-			for(xi=0; xi<pa->rectx; xi++) {
+			for (xi=0; xi<pa->rectx; xi++) {
 				int x= xcos[xi];
 				
 				samp1= *(samp + y*pa->rectx + x);
-				while(samp1) {
+				while (samp1) {
 					bsp_err |= isb_bsp_insert(root, memarena, (ISBSample *)samp1);
 					samp1= samp1->next;
 				}
 			}
-			if(bsp_err) break;
+			if (bsp_err) break;
 		}
 	}	
 	
@@ -2421,27 +2424,27 @@ static void isb_make_buffer_transp(RenderPart *pa, APixstr *apixbuf, LampRen *la
 	BLI_memarena_use_calloc(memarena);
 	
 	/* samplebuf is in camera view space (pixels) */
-	for(sample=0; sample<(R.osa?R.osa:1); sample++)
+	for (sample=0; sample<(R.osa?R.osa:1); sample++)
 		samplebuf[sample]= MEM_callocN(sizeof(void *)*pa->rectx*pa->recty, "isb alpha samplebuf");
 	
 	/* setup bsp root */
 	memset(&root, 0, sizeof(ISBBranch));
-	root.box.xmin= (float)shb->size;
-	root.box.ymin= (float)shb->size;
+	root.box.xmin = (float)shb->size;
+	root.box.ymin = (float)shb->size;
 
 	/* create the sample buffers */
-	for(ap= apixbuf, sindex=0, y=0; y<pa->recty; y++) {
-		for(x=0; x<pa->rectx; x++, sindex++, ap++) {
+	for (ap= apixbuf, sindex=0, y=0; y<pa->recty; y++) {
+		for (x=0; x<pa->rectx; x++, sindex++, ap++) {
 			
-			if(ap->p[0]) {
+			if (ap->p[0]) {
 				APixstr *apn;
 				float xs= (float)(x + pa->disprect.xmin);
 				float ys= (float)(y + pa->disprect.ymin);
 				
-				for(apn=ap; apn; apn= apn->next) {
+				for (apn=ap; apn; apn= apn->next) {
 					int a;
-					for(a=0; a<4; a++) {
-						if(apn->p[a]) {
+					for (a=0; a<4; a++) {
+						if (apn->p[a]) {
 							ObjectInstanceRen *obi= &R.objectinstance[apn->obi[a]];
 							ObjectRen *obr= obi->obr;
 							VlakRen *vlr= RE_findOrAddVlak(obr, (apn->p[a]-1) & RE_QUAD_MASK);
@@ -2450,14 +2453,14 @@ static void isb_make_buffer_transp(RenderPart *pa, APixstr *apixbuf, LampRen *la
 							/* here we store shadfac, easier to create the end storage buffer. needs zero'ed, multiple shadowbufs use it */
 							apn->shadfac[a]= 0;
 							
-							if(R.osa) {
-								for(sample=0; sample<R.osa; sample++) {
+							if (R.osa) {
+								for (sample=0; sample<R.osa; sample++) {
 									int mask= (1<<sample);
 									
-									if(apn->mask[a] & mask) {
+									if (apn->mask[a] & mask) {
 										
 										/* convert image plane pixel location to lamp buffer space */
-										if(viewpixel_to_lampbuf(shb, obi, vlr, xs + R.jit[sample][0], ys + R.jit[sample][1], zco)) {
+										if (viewpixel_to_lampbuf(shb, obi, vlr, xs + R.jit[sample][0], ys + R.jit[sample][1], zco)) {
 											samp= isb_alloc_sample_transp(samplebuf[sample] + sindex, memarena);
 											samp->obi= apn->obi[a];
 											samp->facenr= apn->p[a] & ~RE_QUAD_OFFS;
@@ -2472,7 +2475,7 @@ static void isb_make_buffer_transp(RenderPart *pa, APixstr *apixbuf, LampRen *la
 							else {
 								
 								/* convert image plane pixel location to lamp buffer space */
-								if(viewpixel_to_lampbuf(shb, obi, vlr, xs, ys, zco)) {
+								if (viewpixel_to_lampbuf(shb, obi, vlr, xs, ys, zco)) {
 									
 									samp= isb_alloc_sample_transp(samplebuf[0] + sindex, memarena);
 									samp->obi= apn->obi[a];
@@ -2491,7 +2494,7 @@ static void isb_make_buffer_transp(RenderPart *pa, APixstr *apixbuf, LampRen *la
 	}
 	
 	/* simple method to see if we have samples */
-	if(root.box.xmin != (float)shb->size) {
+	if (root.box.xmin != (float)shb->size) {
 		/* now create a regular split, root.box has the initial bounding box of all pixels */
 		/* split bsp 8 levels deep, in regular grid (16 x 16) */
 		isb_bsp_split_init(&root, memarena, 8);
@@ -2499,7 +2502,7 @@ static void isb_make_buffer_transp(RenderPart *pa, APixstr *apixbuf, LampRen *la
 		/* insert all samples in BSP now */
 		bsp_err= isb_add_samples_transp(pa, &root, memarena, samplebuf);
 		
-		if(bsp_err==0) {
+		if (bsp_err==0) {
 			ISBShadfacA **isbsa;
 			
 			/* go over all faces and fill in shadow values */
@@ -2510,15 +2513,15 @@ static void isb_make_buffer_transp(RenderPart *pa, APixstr *apixbuf, LampRen *la
 			
 			isbdata->memarena = BLI_memarena_new(0x8000 * sizeof(ISBSampleA), "isb arena");
 			
-			for(ap= apixbuf, x=pa->rectx*pa->recty; x>0; x--, ap++, isbsa++) {
+			for (ap= apixbuf, x=pa->rectx*pa->recty; x>0; x--, ap++, isbsa++) {
 					
-				if(ap->p[0]) {
+				if (ap->p[0]) {
 					APixstr *apn;
-					for(apn=ap; apn; apn= apn->next) {
+					for (apn=ap; apn; apn= apn->next) {
 						int a;
-						for(a=0; a<4; a++) {
-							if(apn->p[a] && apn->shadfac[a]) {
-								if(R.osa)
+						for (a=0; a<4; a++) {
+							if (apn->p[a] && apn->shadfac[a]) {
+								if (R.osa)
 									isb_add_shadfac(isbsa, isbdata->memarena, apn->obi[a], apn->p[a], apn->shadfac[a], count_mask(apn->mask[a]));
 								else
 									isb_add_shadfac(isbsa, isbdata->memarena, apn->obi[a], apn->p[a], apn->shadfac[a], 0);
@@ -2534,10 +2537,10 @@ static void isb_make_buffer_transp(RenderPart *pa, APixstr *apixbuf, LampRen *la
 	BLI_memarena_free(memarena);
 
 	/* free samples */
-	for(x=0; x<(R.osa?R.osa:1); x++)
+	for (x=0; x<(R.osa?R.osa:1); x++)
 		MEM_freeN(samplebuf[x]);
 
-	if(bsp_err) printf("error in filling bsp\n");
+	if (bsp_err) printf("error in filling bsp\n");
 }
 
 
@@ -2549,18 +2552,18 @@ static void isb_make_buffer_transp(RenderPart *pa, APixstr *apixbuf, LampRen *la
 float ISB_getshadow(ShadeInput *shi, ShadBuf *shb)
 {
 	/* if raytracing, we can't accept irregular shadow */
-	if(shi->depth==0) {
+	if (shi->depth==0) {
 		ISBData *isbdata= shb->isb_result[shi->thread];
 		
-		if(isbdata) {
-			if(isbdata->shadfacs || isbdata->shadfaca) {
+		if (isbdata) {
+			if (isbdata->shadfacs || isbdata->shadfaca) {
 				int x= shi->xs - isbdata->minx;
 				
-				if(x >= 0 && x < isbdata->rectx) {
+				if (x >= 0 && x < isbdata->rectx) {
 					int y= shi->ys - isbdata->miny;
 			
-					if(y >= 0 && y < isbdata->recty) {
-						if(isbdata->shadfacs) {
+					if (y >= 0 && y < isbdata->recty) {
+						if (isbdata->shadfacs) {
 							short *sp= isbdata->shadfacs + y*isbdata->rectx + x;
 							return *sp>=4096?0.0f:1.0f - ((float)*sp)/4096.0f;
 						}
@@ -2569,8 +2572,8 @@ float ISB_getshadow(ShadeInput *shi, ShadBuf *shb)
 							int obi= shi->obi - R.objectinstance;
 							ISBShadfacA *isbsa= *(isbdata->shadfaca + sindex);
 							
-							while(isbsa) {
-								if(isbsa->facenr==shi->facenr+1 && isbsa->obi==obi)
+							while (isbsa) {
+								if (isbsa->facenr==shi->facenr+1 && isbsa->obi==obi)
 									return isbsa->shadfac>=1.0f?0.0f:1.0f - isbsa->shadfac;
 								isbsa= isbsa->next;
 							}
@@ -2589,15 +2592,15 @@ void ISB_create(RenderPart *pa, APixstr *apixbuf)
 	GroupObject *go;
 	
 	/* go over all lamps, and make the irregular buffers */
-	for(go=R.lights.first; go; go= go->next) {
+	for (go=R.lights.first; go; go= go->next) {
 		LampRen *lar= go->lampren;
 		
-		if(lar->type==LA_SPOT && lar->shb && lar->buftype==LA_SHADBUF_IRREGULAR) {
+		if (lar->type==LA_SPOT && lar->shb && lar->buftype==LA_SHADBUF_IRREGULAR) {
 			
 			/* create storage for shadow, per thread */
 			lar->shb->isb_result[pa->thread]= MEM_callocN(sizeof(ISBData), "isb data");
 			
-			if(apixbuf)
+			if (apixbuf)
 				isb_make_buffer_transp(pa, apixbuf, lar);
 			else
 				isb_make_buffer(pa, lar);
@@ -2612,19 +2615,19 @@ void ISB_free(RenderPart *pa)
 	GroupObject *go;
 	
 	/* go over all lamps, and free the irregular buffers */
-	for(go=R.lights.first; go; go= go->next) {
+	for (go=R.lights.first; go; go= go->next) {
 		LampRen *lar= go->lampren;
 		
-		if(lar->type==LA_SPOT && lar->shb && lar->buftype==LA_SHADBUF_IRREGULAR) {
+		if (lar->type==LA_SPOT && lar->shb && lar->buftype==LA_SHADBUF_IRREGULAR) {
 			ISBData *isbdata= lar->shb->isb_result[pa->thread];
 
-			if(isbdata) {
-				if(isbdata->shadfacs)
+			if (isbdata) {
+				if (isbdata->shadfacs)
 					MEM_freeN(isbdata->shadfacs);
-				if(isbdata->shadfaca)
+				if (isbdata->shadfaca)
 					MEM_freeN(isbdata->shadfaca);
 				
-				if(isbdata->memarena)
+				if (isbdata->memarena)
 					BLI_memarena_free(isbdata->memarena);
 				
 				MEM_freeN(isbdata);
diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c
index e0b5da8..038394b 100644
--- a/source/blender/render/intern/source/shadeinput.c
+++ b/source/blender/render/intern/source/shadeinput.c
@@ -66,32 +66,33 @@
 extern struct Render R;
 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
 
-
-#define VECADDISFAC(v1,v3,fac) {*(v1)+= *(v3)*(fac); *(v1+1)+= *(v3+1)*(fac); *(v1+2)+= *(v3+2)*(fac);}
-
-
-
 /* Shade Sample order:
+ *
+ * - shade_samples_fill_with_ps()
+ *     - for each sample
+ *         - shade_input_set_triangle()  <- if prev sample-face is same, use shade_input_copy_triangle()
+ *         - if vlr
+ *             - shade_input_set_viewco()    <- not for ray or bake
+ *             - shade_input_set_uv()        <- not for ray or bake
+ *             - shade_input_set_normals()
+ * - shade_samples()
+ *     - if AO
+ *         - shade_samples_do_AO()
+ *     - if shading happens
+ *         - for each sample
+ *             - shade_input_set_shade_texco()
+ *             - shade_samples_do_shade()
+ * - OSA: distribute sample result with filter masking
+ *
+ */
 
-- shade_samples_fill_with_ps()
-	- for each sample
-		- shade_input_set_triangle()  <- if prev sample-face is same, use shade_input_copy_triangle()
-		- if vlr
-			- shade_input_set_viewco()    <- not for ray or bake
-			- shade_input_set_uv()        <- not for ray or bake
-			- shade_input_set_normals()
-- shade_samples()
-	- if AO
-		- shade_samples_do_AO()
-	- if shading happens
-		- for each sample
-			- shade_input_set_shade_texco()
-			- shade_samples_do_shade()
-- OSA: distribute sample result with filter masking
-
-	*/
-
-/* initialise material variables in shadeinput, 
+#define VECADDISFAC(v1,v3,fac)  {   \
+	*(v1 + 0) += *(v3 + 0) * (fac); \
+	*(v1 + 1) += *(v3 + 1) * (fac); \
+	*(v1 + 2) += *(v3 + 2) * (fac); \
+}
+
+/* initialize material variables in shadeinput, 
  * doing inverse gamma correction where applicable */
 void shade_input_init_material(ShadeInput *shi)
 {
@@ -107,7 +108,7 @@ void shade_material_loop(ShadeInput *shi, ShadeResult *shr)
 
 	shade_lamp_loop(shi, shr);	/* clears shr */
 	
-	if(shi->translucency!=0.0f) {
+	if (shi->translucency!=0.0f) {
 		ShadeResult shr_t;
 		float fac= shi->translucency;
 		
@@ -120,11 +121,11 @@ void shade_material_loop(ShadeInput *shi, ShadeResult *shr)
 
 		/* a couple of passes */
 		VECADDISFAC(shr->combined, shr_t.combined, fac);
-		if(shi->passflag & SCE_PASS_SPEC)
+		if (shi->passflag & SCE_PASS_SPEC)
 			VECADDISFAC(shr->spec, shr_t.spec, fac);
-		if(shi->passflag & SCE_PASS_DIFFUSE)
+		if (shi->passflag & SCE_PASS_DIFFUSE)
 			VECADDISFAC(shr->diff, shr_t.diff, fac);
-		if(shi->passflag & SCE_PASS_SHADOW)
+		if (shi->passflag & SCE_PASS_SHADOW)
 			VECADDISFAC(shr->shad, shr_t.shad, fac);
 
 		negate_v3(shi->vn);
@@ -132,20 +133,20 @@ void shade_material_loop(ShadeInput *shi, ShadeResult *shr)
 	}
 	
 	/* depth >= 1 when ray-shading */
-	if(shi->depth==0 || shi->volume_depth > 0) {
-		if(R.r.mode & R_RAYTRACE) {
-			if(shi->ray_mirror!=0.0f || ((shi->mode & MA_TRANSP) && (shi->mode & MA_RAYTRANSP) && shr->alpha!=1.0f)) {
+	if (shi->depth==0 || shi->volume_depth > 0) {
+		if (R.r.mode & R_RAYTRACE) {
+			if (shi->ray_mirror!=0.0f || ((shi->mode & MA_TRANSP) && (shi->mode & MA_RAYTRANSP) && shr->alpha!=1.0f)) {
 				/* ray trace works on combined, but gives pass info */
 				ray_trace(shi, shr);
 			}
 		}
 		/* disable adding of sky for raytransp */
-		if((shi->mode & MA_TRANSP) && (shi->mode & MA_RAYTRANSP))
-			if((shi->layflag & SCE_LAY_SKY) && (R.r.alphamode==R_ADDSKY))
+		if ((shi->mode & MA_TRANSP) && (shi->mode & MA_RAYTRANSP))
+			if ((shi->layflag & SCE_LAY_SKY) && (R.r.alphamode==R_ADDSKY))
 				shr->alpha= 1.0f;
 	}
 	
-	if(R.r.mode & R_RAYTRACE) {
+	if (R.r.mode & R_RAYTRACE) {
 		if (R.render_volumes_inside.first)
 			shade_volume_inside(shi, shr);
 	}
@@ -162,7 +163,7 @@ void shade_input_do_shade(ShadeInput *shi, ShadeResult *shr)
 	memset(&shi->raycounter, 0, sizeof(shi->raycounter));
 #endif
 	
-	if(shi->mat->nodetree && shi->mat->use_nodes) {
+	if (shi->mat->nodetree && shi->mat->use_nodes) {
 		ntreeShaderExecTree(shi->mat->nodetree, shi, shr);
 	}
 	else {
@@ -170,36 +171,37 @@ void shade_input_do_shade(ShadeInput *shi, ShadeResult *shr)
 		shade_input_init_material(shi);
 		
 		if (shi->mat->material_type == MA_TYPE_VOLUME) {
-			if(R.r.mode & R_RAYTRACE) {
+			if (R.r.mode & R_RAYTRACE) {
 				shade_volume_outside(shi, shr);
 			}
-		} else { /* MA_TYPE_SURFACE, MA_TYPE_WIRE */
+		}
+		else { /* MA_TYPE_SURFACE, MA_TYPE_WIRE */
 			shade_material_loop(shi, shr);
 		}
 	}
 	
 	/* copy additional passes */
-	if(shi->passflag & (SCE_PASS_VECTOR|SCE_PASS_NORMAL)) {
+	if (shi->passflag & (SCE_PASS_VECTOR|SCE_PASS_NORMAL)) {
 		copy_v4_v4(shr->winspeed, shi->winspeed);
 		copy_v3_v3(shr->nor, shi->vn);
 	}
 	
 	/* MIST */
-	if((shi->passflag & SCE_PASS_MIST) || ((R.wrld.mode & WO_MIST) && (shi->mat->mode & MA_NOMIST)==0))  {
-		if(R.r.mode & R_ORTHO)
+	if ((shi->passflag & SCE_PASS_MIST) || ((R.wrld.mode & WO_MIST) && (shi->mat->mode & MA_NOMIST)==0)) {
+		if (R.r.mode & R_ORTHO)
 			shr->mist= mistfactor(-shi->co[2], shi->co);
 		else
 			shr->mist= mistfactor(len_v3(shi->co), shi->co);
 	}
 	else shr->mist= 0.0f;
 	
-	if((R.wrld.mode & WO_MIST) && (shi->mat->mode & MA_NOMIST)==0 ) {
+	if ((R.wrld.mode & WO_MIST) && (shi->mat->mode & MA_NOMIST)==0 ) {
 		alpha= shr->mist;
 	}
 	else alpha= 1.0f;
 	
 	/* add mist and premul color */
-	if(shr->alpha!=1.0f || alpha!=1.0f) {
+	if (shr->alpha!=1.0f || alpha!=1.0f) {
 		float fac= alpha*(shr->alpha);
 		shr->combined[3]= fac;
 		
@@ -213,15 +215,15 @@ void shade_input_do_shade(ShadeInput *shi, ShadeResult *shr)
 	shr->z= -shi->co[2];
 	
 	/* RAYHITS */
-/*
-	if(1 || shi->passflag & SCE_PASS_RAYHITS)
-	{
+#if 0
+	if (1 || shi->passflag & SCE_PASS_RAYHITS) {
 		shr->rayhits[0] = (float)shi->raycounter.faces.test;
 		shr->rayhits[1] = (float)shi->raycounter.bb.hit;
 		shr->rayhits[2] = 0.0;
 		shr->rayhits[3] = 1.0;
 	}
- */
+#endif
+
 	RE_RC_MERGE(&re_rc_counter[shi->thread], &shi->raycounter);
 }
 
@@ -239,15 +241,15 @@ 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_FACE_SPLIT) {
+	if (vlr->flag & R_DIVIDE_24) {  
+		if (vlr->flag & R_FACE_SPLIT) {
 			(*i1)++; (*i2)++; (*i3)++;
 		}
 		else {
 			(*i3)++;
 		}
 	}
-	else if(vlr->flag & R_FACE_SPLIT) {
+	else if (vlr->flag & R_FACE_SPLIT) {
 		(*i2)++; (*i3)++; 
 	}
 }
@@ -281,12 +283,12 @@ void shade_input_set_triangle_i(ShadeInput *shi, ObjectInstanceRen *obi, VlakRen
 	RE_vlakren_get_normal(&R, obi, vlr, shi->facenor);
 	
 	/* calculate vertexnormals */
-	if(vlr->flag & R_SMOOTH) {
+	if (vlr->flag & R_SMOOTH) {
 		copy_v3_v3(shi->n1, shi->v1->n);
 		copy_v3_v3(shi->n2, shi->v2->n);
 		copy_v3_v3(shi->n3, shi->v3->n);
 
-		if(obi->flag & R_TRANSFORMED) {
+		if (obi->flag & R_TRANSFORMED) {
 			mul_m3_v3(obi->nmat, shi->n1); normalize_v3(shi->n1);
 			mul_m3_v3(obi->nmat, shi->n2); normalize_v3(shi->n2);
 			mul_m3_v3(obi->nmat, shi->n3); normalize_v3(shi->n3);
@@ -294,21 +296,21 @@ void shade_input_set_triangle_i(ShadeInput *shi, ObjectInstanceRen *obi, VlakRen
 	}
 }
 
-/* note, facenr declared volatile due to over-eager -O2 optimizations
+/* note, facenr declared volatile due to over-eager -O2 optimization's
  * on cygwin (particularly -frerun-cse-after-loop)
  */
 
 /* copy data from face to ShadeInput, scanline case */
 void shade_input_set_triangle(ShadeInput *shi, volatile int obi, volatile int facenr, int UNUSED(normal_flip))
 {
-	if(facenr>0) {
+	if (facenr>0) {
 		shi->obi= &R.objectinstance[obi];
 		shi->obr= shi->obi->obr;
 		shi->facenr= (facenr-1) & RE_QUAD_MASK;
-		if( shi->facenr < shi->obr->totvlak ) {
+		if ( shi->facenr < shi->obr->totvlak ) {
 			VlakRen *vlr= RE_findOrAddVlak(shi->obr, shi->facenr);
 			
-			if(facenr & RE_QUAD_OFFS)
+			if (facenr & RE_QUAD_OFFS)
 				shade_input_set_triangle_i(shi, shi->obi, vlr, 0, 2, 3);
 			else
 				shade_input_set_triangle_i(shi, shi->obi, vlr, 0, 1, 2);
@@ -344,7 +346,7 @@ void shade_input_set_strand(ShadeInput *shi, StrandRen *strand, StrandPoint *spo
 	shi->xs= (int)spoint->x;
 	shi->ys= (int)spoint->y;
 
-	if(shi->osatex || (R.r.mode & R_SHADOW)) {
+	if (shi->osatex || (R.r.mode & R_SHADOW)) {
 		copy_v3_v3(shi->dxco, spoint->dtco);
 		copy_v3_v3(shi->dyco, spoint->dsco);
 	}
@@ -355,7 +357,7 @@ void shade_input_set_strand(ShadeInput *shi, StrandRen *strand, StrandPoint *spo
 	copy_v3_v3(shi->facenor, spoint->nor);
 
 	/* shade_input_set_normals equivalent */
-	if(shi->mat->mode & MA_TANGENT_STR) {
+	if (shi->mat->mode & MA_TANGENT_STR) {
 		copy_v3_v3(shi->vn, spoint->tan);
 	}
 	else {
@@ -365,7 +367,7 @@ void shade_input_set_strand(ShadeInput *shi, StrandRen *strand, StrandPoint *spo
 		cross_v3_v3v3(shi->vn, cross, spoint->tan);
 		normalize_v3(shi->vn);
 
-		if(dot_v3v3(shi->vn, shi->view) < 0.0f)
+		if (dot_v3v3(shi->vn, shi->view) < 0.0f)
 			negate_v3(shi->vn);
 	}
 
@@ -380,57 +382,57 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
 	int mode= shi->mode;		/* or-ed result for all nodes */
 	short texco= shi->mat->texco;
 
-	if((shi->mat->texco & TEXCO_REFL)) {
+	if ((shi->mat->texco & TEXCO_REFL)) {
 		/* shi->dxview, shi->dyview, not supported */
 	}
 
-	if(shi->osatex && (texco & (TEXCO_NORM|TEXCO_REFL))) {
+	if (shi->osatex && (texco & (TEXCO_NORM|TEXCO_REFL))) {
 		/* not supported */
 	}
 
-	if(mode & (MA_TANGENT_V|MA_NORMAP_TANG)) {
+	if (mode & (MA_TANGENT_V|MA_NORMAP_TANG)) {
 		copy_v3_v3(shi->tang, spoint->tan);
 		copy_v3_v3(shi->nmaptang, spoint->tan);
 	}
 
-	if(mode & MA_STR_SURFDIFF) {
+	if (mode & MA_STR_SURFDIFF) {
 		float *surfnor= RE_strandren_get_surfnor(obr, strand, 0);
 
-		if(surfnor)
+		if (surfnor)
 			copy_v3_v3(shi->surfnor, surfnor);
 		else
 			copy_v3_v3(shi->surfnor, shi->vn);
 
-		if(shi->mat->strand_surfnor > 0.0f) {
+		if (shi->mat->strand_surfnor > 0.0f) {
 			shi->surfdist= 0.0f;
-			for(sv=strand->vert; sv!=svert; sv++)
+			for (sv=strand->vert; sv!=svert; sv++)
 				shi->surfdist+=len_v3v3(sv->co, (sv+1)->co);
 			shi->surfdist += spoint->t*len_v3v3(sv->co, (sv+1)->co);
 		}
 	}
 
-	if(R.r.mode & R_SPEED) {
+	if (R.r.mode & R_SPEED) {
 		float *speed;
 		
 		speed= RE_strandren_get_winspeed(shi->obi, strand, 0);
-		if(speed)
+		if (speed)
 			copy_v4_v4(shi->winspeed, speed);
 		else
 			shi->winspeed[0]= shi->winspeed[1]= shi->winspeed[2]= shi->winspeed[3]= 0.0f;
 	}
 
 	/* shade_input_set_shade_texco equivalent */
-	if(texco & NEED_UV) {
-		if(texco & TEXCO_ORCO) {
+	if (texco & NEED_UV) {
+		if (texco & TEXCO_ORCO) {
 			copy_v3_v3(shi->lo, strand->orco);
 			/* no shi->osatex, orco derivatives are zero */
 		}
 
-		if(texco & TEXCO_GLOB) {
+		if (texco & TEXCO_GLOB) {
 			copy_v3_v3(shi->gl, shi->co);
 			mul_m4_v3(R.viewinv, shi->gl);
 			
-			if(shi->osatex) {
+			if (shi->osatex) {
 				copy_v3_v3(shi->dxgl, shi->dxco);
 				mul_mat3_m4_v3(R.viewinv, shi->dxgl); 
 				copy_v3_v3(shi->dygl, shi->dyco);
@@ -438,16 +440,16 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
 			}
 		}
 
-		if(texco & TEXCO_STRAND) {
+		if (texco & TEXCO_STRAND) {
 			shi->strandco= spoint->strandco;
 
-			if(shi->osatex) {
+			if (shi->osatex) {
 				shi->dxstrand= spoint->dtstrandco;
 				shi->dystrand= 0.0f;
 			}
 		}
 
-		if((texco & TEXCO_UV) || (mode & (MA_VERTEXCOL|MA_VERTEXCOLP|MA_FACETEXTURE)))  {
+		if ((texco & TEXCO_UV) || (mode & (MA_VERTEXCOL|MA_VERTEXCOLP|MA_FACETEXTURE))) {
 			MCol *mcol;
 			float *uv;
 			char *name;
@@ -458,7 +460,7 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
 			shi->actuv= obr->actmtface;
 			shi->actcol= obr->actmcol;
 
-			if(mode & (MA_VERTEXCOL|MA_VERTEXCOLP)) {
+			if (mode & (MA_VERTEXCOL|MA_VERTEXCOLP)) {
 				for (i=0; (mcol=RE_strandren_get_mcol(obr, strand, i, &name, 0)); i++) {
 					ShadeInputCol *scol= &shi->col[i];
 					char *cp= (char*)mcol;
@@ -472,7 +474,7 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
 					scol->col[3]= cp[0]/255.0f;
 				}
 
-				if(shi->totcol) {
+				if (shi->totcol) {
 					shi->vcol[0]= shi->col[shi->actcol].col[0];
 					shi->vcol[1]= shi->col[shi->actcol].col[1];
 					shi->vcol[2]= shi->col[shi->actcol].col[2];
@@ -492,7 +494,7 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
 				shi->totuv++;
 				suv->name= name;
 
-				if(strandbuf->overrideuv == i) {
+				if (strandbuf->overrideuv == i) {
 					suv->uv[0]= -1.0f;
 					suv->uv[1]= spoint->strandco;
 					suv->uv[2]= 0.0f;
@@ -503,15 +505,15 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
 					suv->uv[2]= 0.0f;	/* texture.c assumes there are 3 coords */
 				}
 
-				if(shi->osatex) {
+				if (shi->osatex) {
 					suv->dxuv[0]= 0.0f;
 					suv->dxuv[1]= 0.0f;
 					suv->dyuv[0]= 0.0f;
 					suv->dyuv[1]= 0.0f;
 				}
 
-				if((mode & MA_FACETEXTURE) && i==obr->actmtface) {
-					if((mode & (MA_VERTEXCOL|MA_VERTEXCOLP))==0) {
+				if ((mode & MA_FACETEXTURE) && i==obr->actmtface) {
+					if ((mode & (MA_VERTEXCOL|MA_VERTEXCOLP))==0) {
 						shi->vcol[0]= 1.0f;
 						shi->vcol[1]= 1.0f;
 						shi->vcol[2]= 1.0f;
@@ -520,14 +522,14 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
 				}
 			}
 
-			if(shi->totuv == 0) {
+			if (shi->totuv == 0) {
 				ShadeInputUV *suv= &shi->uv[0];
 
 				suv->uv[0]= 0.0f;
 				suv->uv[1]= spoint->strandco;
 				suv->uv[2]= 0.0f;	/* texture.c assumes there are 3 coords */
 				
-				if(mode & MA_FACETEXTURE) {
+				if (mode & MA_FACETEXTURE) {
 					/* no tface? set at 1.0f */
 					shi->vcol[0]= 1.0f;
 					shi->vcol[1]= 1.0f;
@@ -538,18 +540,18 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
 
 		}
 
-		if(texco & TEXCO_NORM) {
+		if (texco & TEXCO_NORM) {
 			shi->orn[0]= -shi->vn[0];
 			shi->orn[1]= -shi->vn[1];
 			shi->orn[2]= -shi->vn[2];
 		}
 
-		if(texco & TEXCO_STRESS) {
+		if (texco & TEXCO_STRESS) {
 			/* not supported */
 		}
 
-		if(texco & TEXCO_TANGENT) {
-			if((mode & MA_TANGENT_V)==0) {
+		if (texco & TEXCO_TANGENT) {
+			if ((mode & MA_TANGENT_V)==0) {
 				/* just prevent surprises */
 				shi->tang[0]= shi->tang[1]= shi->tang[2]= 0.0f;
 				shi->nmaptang[0]= shi->nmaptang[1]= shi->nmaptang[2]= 0.0f;
@@ -558,14 +560,14 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
 	}
 
 	/* this only avalailable for scanline renders */
-	if(shi->depth==0) {
-		if(texco & TEXCO_WINDOW) {
+	if (shi->depth==0) {
+		if (texco & TEXCO_WINDOW) {
 			shi->winco[0]= -1.0f + 2.0f*spoint->x/(float)R.winx;
 			shi->winco[1]= -1.0f + 2.0f*spoint->y/(float)R.winy;
 			shi->winco[2]= 0.0f;
 
 			/* not supported */
-			if(shi->osatex) {
+			if (shi->osatex) {
 				shi->dxwin[0]= 0.0f;
 				shi->dywin[1]= 0.0f;
 				shi->dxwin[0]= 0.0f;
@@ -573,13 +575,13 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
 			}
 		}
 
-		if(texco & TEXCO_STICKY) {
+		if (texco & TEXCO_STICKY) {
 			/* not supported */
 		}
 	}
 	
 	if (shi->do_manage) {
-		if(mode & (MA_VERTEXCOL|MA_VERTEXCOLP|MA_FACETEXTURE)) {
+		if (mode & (MA_VERTEXCOL|MA_VERTEXCOLP|MA_FACETEXTURE)) {
 			srgb_to_linearrgb_v3_v3(shi->vcol, shi->vcol);
 		}
 	}
@@ -592,10 +594,10 @@ void shade_input_calc_viewco(ShadeInput *shi, float x, float y, float z, float v
 	/* returns not normalized, so is in viewplane coords */
 	calc_view_vector(view, x, y);
 	
-	if(shi->mat->material_type == MA_TYPE_WIRE) {
+	if (shi->mat->material_type == MA_TYPE_WIRE) {
 		/* wire cannot use normal for calculating shi->co, so
 		 * we reconstruct the coordinate less accurate */
-		if(R.r.mode & R_ORTHO)
+		if (R.r.mode & R_ORTHO)
 			calc_renderco_ortho(co, x, y, z);
 		else
 			calc_renderco_zbuf(co, view, z);
@@ -605,13 +607,13 @@ void shade_input_calc_viewco(ShadeInput *shi, float x, float y, float z, float v
 		float fac, dface, v1[3];
 		
 		copy_v3_v3(v1, shi->v1->co);
-		if(shi->obi->flag & R_TRANSFORMED)
+		if (shi->obi->flag & R_TRANSFORMED)
 			mul_m4_v3(shi->obi->mat, v1);
 		
 		dface = dot_v3v3(v1, shi->facenor);
 		
 		/* ortho viewplane cannot intersect using view vector originating in (0,0,0) */
-		if(R.r.mode & R_ORTHO) {
+		if (R.r.mode & R_ORTHO) {
 			/* x and y 3d coordinate can be derived from pixel coord and winmat */
 			float fx= 2.0f/(R.winx*R.winmat[0][0]);
 			float fy= 2.0f/(R.winy*R.winmat[1][1]);
@@ -620,28 +622,28 @@ void shade_input_calc_viewco(ShadeInput *shi, float x, float y, float z, float v
 			co[1]= (y - 0.5f*R.winy)*fy - R.winmat[3][1]/R.winmat[1][1];
 			
 			/* using a*x + b*y + c*z = d equation, (a b c) is normal */
-			if(shi->facenor[2]!=0.0f)
+			if (shi->facenor[2]!=0.0f)
 				co[2]= (dface - shi->facenor[0]*co[0] - shi->facenor[1]*co[1])/shi->facenor[2];
 			else
 				co[2]= 0.0f;
 			
-			if(dxco && dyco) {
+			if (dxco && dyco) {
 				dxco[0]= fx;
 				dxco[1]= 0.0f;
-				if(shi->facenor[2]!=0.0f)
+				if (shi->facenor[2]!=0.0f)
 					dxco[2]= -(shi->facenor[0]*fx)/shi->facenor[2];
 				else 
 					dxco[2]= 0.0f;
 				
 				dyco[0]= 0.0f;
 				dyco[1]= fy;
-				if(shi->facenor[2]!=0.0f)
+				if (shi->facenor[2]!=0.0f)
 					dyco[2]= -(shi->facenor[1]*fy)/shi->facenor[2];
 				else 
 					dyco[2]= 0.0f;
 				
-				if(dxyview) {
-					if(co[2]!=0.0f) fac= 1.0f/co[2]; else fac= 0.0f;
+				if (dxyview) {
+					if (co[2]!=0.0f) fac= 1.0f/co[2]; else fac= 0.0f;
 					dxyview[0]= -R.viewdx*fac;
 					dxyview[1]= -R.viewdy*fac;
 				}
@@ -659,7 +661,7 @@ void shade_input_calc_viewco(ShadeInput *shi, float x, float y, float z, float v
 			co[2]= fac*view[2];
 			
 			/* pixel dx/dy for render coord */
-			if(dxco && dyco) {
+			if (dxco && dyco) {
 				float u= dface/(div - R.viewdx*shi->facenor[0]);
 				float v= dface/(div - R.viewdy*shi->facenor[1]);
 				
@@ -671,8 +673,8 @@ void shade_input_calc_viewco(ShadeInput *shi, float x, float y, float z, float v
 				dyco[1]= co[1]- (view[1]-R.viewdy)*v;
 				dyco[2]= co[2]- (view[2])*v;
 				
-				if(dxyview) {
-					if(fac!=0.0f) fac= 1.0f/fac;
+				if (dxyview) {
+					if (fac!=0.0f) fac= 1.0f/fac;
 					dxyview[0]= -R.viewdx*fac;
 					dxyview[1]= -R.viewdy*fac;
 				}
@@ -703,11 +705,11 @@ void shade_input_set_viewco(ShadeInput *shi, float x, float y, float xs, float y
 	shi->scanco[2]= z;
 
 	/* check if we need derivatives */
-	if(shi->osatex || (R.r.mode & R_SHADOW)) {
+	if (shi->osatex || (R.r.mode & R_SHADOW)) {
 		dxco= shi->dxco;
 		dyco= shi->dyco;
 
-		if((shi->mat->texco & TEXCO_REFL))
+		if ((shi->mat->texco & TEXCO_REFL))
 			dxyview= &shi->dxview;
 	}
 
@@ -719,27 +721,27 @@ void shade_input_set_uv(ShadeInput *shi)
 {
 	VlakRen *vlr= shi->vlr;
 	
-	if((vlr->flag & R_SMOOTH) || (shi->mat->texco & NEED_UV) || (shi->passflag & SCE_PASS_UV)) {
+	if ((vlr->flag & R_SMOOTH) || (shi->mat->texco & NEED_UV) || (shi->passflag & SCE_PASS_UV)) {
 		float v1[3], v2[3], v3[3];
 
 		copy_v3_v3(v1, shi->v1->co);
 		copy_v3_v3(v2, shi->v2->co);
 		copy_v3_v3(v3, shi->v3->co);
 
-		if(shi->obi->flag & R_TRANSFORMED) {
+		if (shi->obi->flag & R_TRANSFORMED) {
 			mul_m4_v3(shi->obi->mat, v1);
 			mul_m4_v3(shi->obi->mat, v2);
 			mul_m4_v3(shi->obi->mat, v3);
 		}
 
 		/* exception case for wire render of edge */
-		if(vlr->v2==vlr->v3) {
+		if (vlr->v2==vlr->v3) {
 			float lend, lenc;
 			
 			lend= len_v3v3(v2, v1);
 			lenc= len_v3v3(shi->co, v1);
 			
-			if(lend==0.0f) {
+			if (lend==0.0f) {
 				shi->u=shi->v= 0.0f;
 			}
 			else {
@@ -747,7 +749,7 @@ void shade_input_set_uv(ShadeInput *shi)
 				shi->v= 0.0f;
 			}
 			
-			if(shi->osatex) {
+			if (shi->osatex) {
 				shi->dx_u=  0.0f;
 				shi->dx_v=  0.0f;
 				shi->dy_u=  0.0f;
@@ -773,7 +775,7 @@ void shade_input_set_uv(ShadeInput *shi)
 
 			shi->u= (shi->co[axis1]-v3[axis1])*t11-(shi->co[axis2]-v3[axis2])*t10;
 			shi->v= (shi->co[axis2]-v3[axis2])*t00-(shi->co[axis1]-v3[axis1])*t01;
-			if(shi->osatex) {
+			if (shi->osatex) {
 				shi->dx_u=  shi->dxco[axis1]*t11- shi->dxco[axis2]*t10;
 				shi->dx_v=  shi->dxco[axis2]*t00- shi->dxco[axis1]*t01;
 				shi->dy_u=  shi->dyco[axis1]*t11- shi->dyco[axis2]*t10;
@@ -795,18 +797,18 @@ void shade_input_set_normals(ShadeInput *shi)
 	shi->flippednor = 0;
 
 	/* test flip normals to viewing direction */
-	if(!(shi->vlr->flag & R_TANGENT)) {
-		if(dot_v3v3(shi->facenor, shi->view) < 0.0f) {
+	if (!(shi->vlr->flag & R_TANGENT)) {
+		if (dot_v3v3(shi->facenor, shi->view) < 0.0f) {
 			negate_v3(shi->facenor);
 			shi->flippednor= 1;
 		}
 	}
 	
 	/* calculate vertexnormals */
-	if(shi->vlr->flag & R_SMOOTH) {
+	if (shi->vlr->flag & R_SMOOTH) {
 		float *n1= shi->n1, *n2= shi->n2, *n3= shi->n3;
 
-		if(shi->flippednor) {
+		if (shi->flippednor) {
 			negate_v3(n1);
 			negate_v3(n2);
 			negate_v3(n3);
@@ -821,8 +823,7 @@ void shade_input_set_normals(ShadeInput *shi)
 		
 		normalize_v3(shi->vn);
 	}
-	else
-	{
+	else {
 		copy_v3_v3(shi->vn, shi->facenor);
 		copy_v3_v3(shi->nmapnorm, shi->vn);
 	}
@@ -831,8 +832,8 @@ void shade_input_set_normals(ShadeInput *shi)
 	copy_v3_v3(shi->vno, shi->vn);
 
 	/* flip normals to viewing direction */
-	if(!(shi->vlr->flag & R_TANGENT))
-		if(dot_v3v3(shi->facenor, shi->view) < 0.0f)
+	if (!(shi->vlr->flag & R_TANGENT))
+		if (dot_v3v3(shi->facenor, shi->view) < 0.0f)
 			shade_input_flip_normals(shi);
 }
 
@@ -843,7 +844,7 @@ void shade_input_set_vertex_normals(ShadeInput *shi)
 	float l= 1.0f+u+v;
 	
 	/* calculate vertexnormals */
-	if(shi->vlr->flag & R_SMOOTH) {
+	if (shi->vlr->flag & R_SMOOTH) {
 		float *n1= shi->n1, *n2= shi->n2, *n3= shi->n3;
 		
 		shi->vn[0]= l*n3[0]-u*n1[0]-v*n2[0];
@@ -855,8 +856,7 @@ void shade_input_set_vertex_normals(ShadeInput *shi)
 		
 		normalize_v3(shi->vn);
 	}
-	else
-	{
+	else {
 		copy_v3_v3(shi->vn, shi->facenor);
 		copy_v3_v3(shi->nmapnorm, shi->vn);
 	}
@@ -899,9 +899,9 @@ void shade_input_set_shade_texco(ShadeInput *shi)
 	short texco= shi->mat->texco;
 
 	/* calculate dxno */
-	if(shi->vlr->flag & R_SMOOTH) {
+	if (shi->vlr->flag & R_SMOOTH) {
 		
-		if(shi->osatex && (texco & (TEXCO_NORM|TEXCO_REFL)) ) {
+		if (shi->osatex && (texco & (TEXCO_NORM|TEXCO_REFL)) ) {
 			float *n1= shi->n1, *n2= shi->n2, *n3= shi->n3;
 			
 			dl= shi->dx_u+shi->dx_v;
@@ -921,14 +921,14 @@ void shade_input_set_shade_texco(ShadeInput *shi)
 		float *tangent, *s1, *s2, *s3;
 		float tl, tu, tv;
 
-		if(shi->vlr->flag & R_SMOOTH) {
+		if (shi->vlr->flag & R_SMOOTH) {
 			tl= l;
 			tu= u;
 			tv= v;
 		}
 		else {
 			/* qdn: flat faces have tangents too,
-			   could pick either one, using average here */
+			 * could pick either one, using average here */
 			tl= 1.0f/3.0f;
 			tu= -1.0f/3.0f;
 			tv= -1.0f/3.0f;
@@ -937,17 +937,17 @@ void shade_input_set_shade_texco(ShadeInput *shi)
 		shi->tang[0]= shi->tang[1]= shi->tang[2]= 0.0f;
 		shi->nmaptang[0]= shi->nmaptang[1]= shi->nmaptang[2]= 0.0f;
 
-		if(mode & MA_TANGENT_V) {
+		if (mode & MA_TANGENT_V) {
 			s1 = RE_vertren_get_tangent(obr, v1, 0);
 			s2 = RE_vertren_get_tangent(obr, v2, 0);
 			s3 = RE_vertren_get_tangent(obr, v3, 0);
 
-			if(s1 && s2 && s3) {
+			if (s1 && s2 && s3) {
 				shi->tang[0]= (tl*s3[0] - tu*s1[0] - tv*s2[0]);
 				shi->tang[1]= (tl*s3[1] - tu*s1[1] - tv*s2[1]);
 				shi->tang[2]= (tl*s3[2] - tu*s1[2] - tv*s2[2]);
 
-				if(obi->flag & R_TRANSFORMED)
+				if (obi->flag & R_TRANSFORMED)
 					mul_m3_v3(obi->nmat, shi->tang);
 
 				normalize_v3(shi->tang);
@@ -955,10 +955,10 @@ void shade_input_set_shade_texco(ShadeInput *shi)
 			}
 		}
 
-		if(mode & MA_NORMAP_TANG || R.flag & R_NEED_TANGENT) {
+		if (mode & MA_NORMAP_TANG || R.flag & R_NEED_TANGENT) {
 			tangent= RE_vlakren_get_nmap_tangent(obr, shi->vlr, 0);
 
-			if(tangent) {
+			if (tangent) {
 				int j1= shi->i1, j2= shi->i2, j3= shi->i3;
 				float c0[3], c1[3], c2[3];
 
@@ -970,8 +970,7 @@ void shade_input_set_shade_texco(ShadeInput *shi)
 
 				// keeping tangents normalized at vertex level
 				// corresponds better to how it's done in game engines
-				if(obi->flag & R_TRANSFORMED)
-				{
+				if (obi->flag & R_TRANSFORMED) {
 					mul_mat3_m4_v3(obi->mat, c0); normalize_v3(c0);
 					mul_mat3_m4_v3(obi->mat, c1); normalize_v3(c1);
 					mul_mat3_m4_v3(obi->mat, c2); normalize_v3(c2);
@@ -990,12 +989,12 @@ void shade_input_set_shade_texco(ShadeInput *shi)
 		}
 	}
 
-	if(mode & MA_STR_SURFDIFF) {
+	if (mode & MA_STR_SURFDIFF) {
 		float *surfnor= RE_vlakren_get_surfnor(obr, shi->vlr, 0);
 
-		if(surfnor) {
+		if (surfnor) {
 			copy_v3_v3(shi->surfnor, surfnor);
-			if(obi->flag & R_TRANSFORMED)
+			if (obi->flag & R_TRANSFORMED)
 				mul_m3_v3(obi->nmat, shi->surfnor);
 		}
 		else
@@ -1004,13 +1003,13 @@ void shade_input_set_shade_texco(ShadeInput *shi)
 		shi->surfdist= 0.0f;
 	}
 	
-	if(R.r.mode & R_SPEED) {
+	if (R.r.mode & R_SPEED) {
 		float *s1, *s2, *s3;
 		
 		s1= RE_vertren_get_winspeed(obi, v1, 0);
 		s2= RE_vertren_get_winspeed(obi, v2, 0);
 		s3= RE_vertren_get_winspeed(obi, v3, 0);
-		if(s1 && s2 && s3) {
+		if (s1 && s2 && s3) {
 			shi->winspeed[0]= (l*s3[0] - u*s1[0] - v*s2[0]);
 			shi->winspeed[1]= (l*s3[1] - u*s1[1] - v*s2[1]);
 			shi->winspeed[2]= (l*s3[2] - u*s1[2] - v*s2[2]);
@@ -1022,14 +1021,14 @@ void shade_input_set_shade_texco(ShadeInput *shi)
 	}
 
 	/* pass option forces UV calc */
-	if(shi->passflag & SCE_PASS_UV)
+	if (shi->passflag & SCE_PASS_UV)
 		texco |= (NEED_UV|TEXCO_UV);
 	
 	/* texture coordinates. shi->dxuv shi->dyuv have been set */
-	if(texco & NEED_UV) {
+	if (texco & NEED_UV) {
 		
-		if(texco & TEXCO_ORCO) {
-			if(v1->orco) {
+		if (texco & TEXCO_ORCO) {
+			if (v1->orco) {
 				float *o1, *o2, *o3;
 				
 				o1= v1->orco;
@@ -1040,7 +1039,7 @@ void shade_input_set_shade_texco(ShadeInput *shi)
 				shi->lo[1]= l*o3[1]-u*o1[1]-v*o2[1];
 				shi->lo[2]= l*o3[2]-u*o1[2]-v*o2[2];
 				
-				if(shi->osatex) {
+				if (shi->osatex) {
 					dl= shi->dx_u+shi->dx_v;
 					shi->dxlo[0]= dl*o3[0]-shi->dx_u*o1[0]-shi->dx_v*o2[0];
 					shi->dxlo[1]= dl*o3[1]-shi->dx_u*o1[1]-shi->dx_v*o2[1];
@@ -1055,10 +1054,10 @@ void shade_input_set_shade_texco(ShadeInput *shi)
 			copy_v3_v3(shi->duplilo, obi->dupliorco);
 		}
 		
-		if(texco & TEXCO_GLOB) {
+		if (texco & TEXCO_GLOB) {
 			copy_v3_v3(shi->gl, shi->co);
 			mul_m4_v3(R.viewinv, shi->gl);
-			if(shi->osatex) {
+			if (shi->osatex) {
 				copy_v3_v3(shi->dxgl, shi->dxco);
 				mul_mat3_m4_v3(R.viewinv, shi->dxgl); 
 				copy_v3_v3(shi->dygl, shi->dyco);
@@ -1066,9 +1065,9 @@ void shade_input_set_shade_texco(ShadeInput *shi)
 			}
 		}
 		
-		if(texco & TEXCO_STRAND) {
+		if (texco & TEXCO_STRAND) {
 			shi->strandco= (l*v3->accum - u*v1->accum - v*v2->accum);
-			if(shi->osatex) {
+			if (shi->osatex) {
 				dl= shi->dx_u+shi->dx_v;
 				shi->dxstrand= dl*v3->accum-shi->dx_u*v1->accum-shi->dx_v*v2->accum;
 				dl= shi->dy_u+shi->dy_v;
@@ -1076,7 +1075,7 @@ void shade_input_set_shade_texco(ShadeInput *shi)
 			}
 		}
 				
-		if((texco & TEXCO_UV) || (mode & (MA_VERTEXCOL|MA_VERTEXCOLP|MA_FACETEXTURE)))  {
+		if ((texco & TEXCO_UV) || (mode & (MA_VERTEXCOL|MA_VERTEXCOLP|MA_FACETEXTURE))) {
 			VlakRen *vlr= shi->vlr;
 			MTFace *tface;
 			MCol *mcol;
@@ -1091,7 +1090,7 @@ void shade_input_set_shade_texco(ShadeInput *shi)
 			shi->actuv= obr->actmtface;
 			shi->actcol= obr->actmcol;
 
-			if(mode & (MA_VERTEXCOL|MA_VERTEXCOLP)) {
+			if (mode & (MA_VERTEXCOL|MA_VERTEXCOLP)) {
 				for (i=0; (mcol=RE_vlakren_get_mcol(obr, vlr, i, &name, 0)); i++) {
 					ShadeInputCol *scol= &shi->col[i];
 					char *cp1, *cp2, *cp3;
@@ -1121,7 +1120,7 @@ void shade_input_set_shade_texco(ShadeInput *shi)
 					}
 				}
 
-				if(shi->totcol) {
+				if (shi->totcol) {
 					shi->vcol[0]= shi->col[shi->actcol].col[0];
 					shi->vcol[1]= shi->col[shi->actcol].col[1];
 					shi->vcol[2]= shi->col[shi->actcol].col[2];
@@ -1150,7 +1149,7 @@ void shade_input_set_shade_texco(ShadeInput *shi)
 				suv->uv[1]= -1.0f + 2.0f*(l*uv3[1]-u*uv1[1]-v*uv2[1]);
 				suv->uv[2]= 0.0f;	/* texture.c assumes there are 3 coords */
 
-				if(shi->osatex) {
+				if (shi->osatex) {
 					float duv[2];
 					
 					dl= shi->dx_u+shi->dx_v;
@@ -1168,14 +1167,14 @@ void shade_input_set_shade_texco(ShadeInput *shi)
 					suv->dyuv[1]= 2.0f*(dl*uv3[1]-duv[0]*uv1[1]-duv[1]*uv2[1]);
 				}
 
-				if((mode & MA_FACETEXTURE) && i==obr->actmtface) {
-					if((mode & (MA_VERTEXCOL|MA_VERTEXCOLP))==0) {
+				if ((mode & MA_FACETEXTURE) && i==obr->actmtface) {
+					if ((mode & (MA_VERTEXCOL|MA_VERTEXCOLP))==0) {
 						shi->vcol[0]= 1.0f;
 						shi->vcol[1]= 1.0f;
 						shi->vcol[2]= 1.0f;
 						shi->vcol[3]= 1.0f;
 					}
-					if(tface->tpage) {
+					if (tface->tpage) {
 						render_realtime_texture(shi, tface->tpage);
 					}
 				}
@@ -1187,14 +1186,14 @@ void shade_input_set_shade_texco(ShadeInput *shi)
 			shi->dupliuv[1]= -1.0f + 2.0f*obi->dupliuv[1];
 			shi->dupliuv[2]= 0.0f;
 
-			if(shi->totuv == 0) {
+			if (shi->totuv == 0) {
 				ShadeInputUV *suv= &shi->uv[0];
 
 				suv->uv[0]= 2.0f*(u+.5f);
 				suv->uv[1]= 2.0f*(v+.5f);
 				suv->uv[2]= 0.0f;	/* texture.c assumes there are 3 coords */
 				
-				if(mode & MA_FACETEXTURE) {
+				if (mode & MA_FACETEXTURE) {
 					/* no tface? set at 1.0f */
 					shi->vcol[0]= 1.0f;
 					shi->vcol[1]= 1.0f;
@@ -1204,28 +1203,28 @@ void shade_input_set_shade_texco(ShadeInput *shi)
 			}
 		}
 		
-		if(texco & TEXCO_NORM) {
+		if (texco & TEXCO_NORM) {
 			shi->orn[0]= -shi->vn[0];
 			shi->orn[1]= -shi->vn[1];
 			shi->orn[2]= -shi->vn[2];
 		}
 		
-		if(texco & TEXCO_STRESS) {
+		if (texco & TEXCO_STRESS) {
 			float *s1, *s2, *s3;
 			
 			s1= RE_vertren_get_stress(obr, v1, 0);
 			s2= RE_vertren_get_stress(obr, v2, 0);
 			s3= RE_vertren_get_stress(obr, v3, 0);
-			if(s1 && s2 && s3) {
+			if (s1 && s2 && s3) {
 				shi->stress= l*s3[0] - u*s1[0] - v*s2[0];
-				if(shi->stress<1.0f) shi->stress-= 1.0f;
+				if (shi->stress<1.0f) shi->stress-= 1.0f;
 				else shi->stress= (shi->stress-1.0f)/shi->stress;
 			}
 			else shi->stress= 0.0f;
 		}
 		
-		if(texco & TEXCO_TANGENT) {
-			if((mode & MA_TANGENT_V)==0) {
+		if (texco & TEXCO_TANGENT) {
+			if ((mode & MA_TANGENT_V)==0) {
 				/* just prevent surprises */
 				shi->tang[0]= shi->tang[1]= shi->tang[2]= 0.0f;
 				shi->nmaptang[0]= shi->nmaptang[1]= shi->nmaptang[2]= 0.0f;
@@ -1234,15 +1233,15 @@ void shade_input_set_shade_texco(ShadeInput *shi)
 	}
 	
 	/* this only avalailable for scanline renders */
-	if(shi->depth==0) {
+	if (shi->depth==0) {
 		float x= shi->xs;
 		float y= shi->ys;
 		
-		if(texco & TEXCO_WINDOW) {
+		if (texco & TEXCO_WINDOW) {
 			shi->winco[0]= -1.0f + 2.0f*x/(float)R.winx;
 			shi->winco[1]= -1.0f + 2.0f*y/(float)R.winy;
 			shi->winco[2]= 0.0f;
-			if(shi->osatex) {
+			if (shi->osatex) {
 				shi->dxwin[0]= 2.0f/(float)R.winx;
 				shi->dywin[1]= 2.0f/(float)R.winy;
 				shi->dxwin[1]= shi->dxwin[2]= 0.0f;
@@ -1250,14 +1249,14 @@ void shade_input_set_shade_texco(ShadeInput *shi)
 			}
 		}
 
-		if(texco & TEXCO_STICKY) {
+		if (texco & TEXCO_STICKY) {
 			float *s1, *s2, *s3;
 			
 			s1= RE_vertren_get_sticky(obr, v1, 0);
 			s2= RE_vertren_get_sticky(obr, v2, 0);
 			s3= RE_vertren_get_sticky(obr, v3, 0);
 			
-			if(s1 && s2 && s3) {
+			if (s1 && s2 && s3) {
 				float obwinmat[4][4], winmat[4][4], ho1[4], ho2[4], ho3[4];
 				float Zmulx, Zmuly;
 				float hox, hoy, l, dl, u, v;
@@ -1267,7 +1266,7 @@ void shade_input_set_shade_texco(ShadeInput *shi)
 				Zmulx=  ((float)R.winx)/2.0f; Zmuly=  ((float)R.winy)/2.0f;
 
 				zbuf_make_winmat(&R, winmat);
-				if(shi->obi->flag & R_TRANSFORMED)
+				if (shi->obi->flag & R_TRANSFORMED)
 					mult_m4_m4m4(obwinmat, winmat, obi->mat);
 				else
 					copy_m4_m4(obwinmat, winmat);
@@ -1297,7 +1296,7 @@ void shade_input_set_shade_texco(ShadeInput *shi)
 				shi->sticky[1]= l*s3[1]-u*s1[1]-v*s2[1];
 				shi->sticky[2]= 0.0f;
 				
-				if(shi->osatex) {
+				if (shi->osatex) {
 					float dxuv[2], dyuv[2];
 					dxuv[0]=  s11/Zmulx;
 					dxuv[1]=  - s01/Zmulx;
@@ -1313,11 +1312,14 @@ void shade_input_set_shade_texco(ShadeInput *shi)
 				}
 			}
 		}
-	} /* else {
-	 Note! For raytracing winco is not set, important because thus means all shader input's need to have their variables set to zero else in-initialized values are used
-	*/
+	}
+	/* else {
+	 * Note! For raytracing winco is not set,
+	 * important because thus means all shader input's need to have their variables set to zero
+	 * else un-initialized values are used
+	 */
 	if (shi->do_manage) {
-		if(mode & (MA_VERTEXCOL|MA_VERTEXCOLP|MA_FACETEXTURE)) {
+		if (mode & (MA_VERTEXCOL|MA_VERTEXCOLP|MA_FACETEXTURE)) {
 			srgb_to_linearrgb_v3_v3(shi->vcol, shi->vcol);
 		}
 	}
@@ -1354,7 +1356,7 @@ void shade_sample_initialize(ShadeSample *ssamp, RenderPart *pa, RenderLayer *rl
 	
 	tot= R.osa==0?1:R.osa;
 	
-	for(a=0; a<tot; a++) {
+	for (a=0; a<tot; a++) {
 		shade_input_initialize(&ssamp->shi[a], pa, rl, a);
 		memset(&ssamp->shr[a], 0, sizeof(ShadeResult));
 	}
@@ -1365,20 +1367,22 @@ void shade_sample_initialize(ShadeSample *ssamp, RenderPart *pa, RenderLayer *rl
 /* Do AO or (future) GI */
 void shade_samples_do_AO(ShadeSample *ssamp)
 {
-	if(!(R.r.mode & R_SHADOW))
+	if (!(R.r.mode & R_SHADOW))
 		return;
-	if(!(R.r.mode & R_RAYTRACE) && !(R.wrld.ao_gather_method == WO_AOGATHER_APPROX))
+	if (!(R.r.mode & R_RAYTRACE) && !(R.wrld.ao_gather_method == WO_AOGATHER_APPROX))
 		return;
 	
-	if(R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) {
+	if (R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) {
 		ShadeInput *shi= &ssamp->shi[0];
 		int sample;
 
-		if(((shi->passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT)))
-			|| (shi->passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT)))
-			for(sample=0; sample<ssamp->tot; shi++, sample++)
-				if(!(shi->mode & MA_SHLESS))
+		if (((shi->passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) ||
+		    (shi->passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT)))
+		{
+			for (sample=0; sample<ssamp->tot; shi++, sample++)
+				if (!(shi->mode & MA_SHLESS))
 					ambient_occlusion(shi);		/* stores in shi->ao[] */
+		}
 	}
 }
 
@@ -1390,23 +1394,23 @@ void shade_samples_fill_with_ps(ShadeSample *ssamp, PixStr *ps, int x, int y)
 	
 	ssamp->tot= 0;
 	
-	for(shi= ssamp->shi; ps; ps= ps->next) {
+	for (shi= ssamp->shi; ps; ps= ps->next) {
 		shade_input_set_triangle(shi, ps->obi, ps->facenr, 1);
 		
-		if(shi->vlr) {	/* NULL happens for env material or for 'all z' */
+		if (shi->vlr) {	/* NULL happens for env material or for 'all z' */
 			unsigned short curmask= ps->mask;
 			
 			/* full osa is only set for OSA renders */
-			if(shi->vlr->flag & R_FULL_OSA) {
+			if (shi->vlr->flag & R_FULL_OSA) {
 				short shi_cp= 0, samp;
 				
-				for(samp=0; samp<R.osa; samp++) {
-					if(curmask & (1<<samp)) {
+				for (samp=0; samp<R.osa; samp++) {
+					if (curmask & (1<<samp)) {
 						/* zbuffer has this inverse corrected, ensures xs,ys are inside pixel */
 						xs= (float)x + R.jit[samp][0] + 0.5f;
 						ys= (float)y + R.jit[samp][1] + 0.5f;
 						
-						if(shi_cp)
+						if (shi_cp)
 							shade_input_copy_triangle(shi, shi-1);
 						
 						shi->mask= (1<<samp);
@@ -1414,7 +1418,7 @@ void shade_samples_fill_with_ps(ShadeSample *ssamp, PixStr *ps, int x, int y)
 						shi->samplenr= R.shadowsamplenr[shi->thread]++;	/* this counter is not being reset per pixel */
 						shade_input_set_viewco(shi, x, y, xs, ys, (float)ps->z);
 						shade_input_set_uv(shi);
-						if(shi_cp==0)
+						if (shi_cp==0)
 							shade_input_set_normals(shi);
 						else  /* XXX shi->flippednor messes up otherwise */
 							shade_input_set_vertex_normals(shi);
@@ -1425,7 +1429,7 @@ void shade_samples_fill_with_ps(ShadeSample *ssamp, PixStr *ps, int x, int y)
 				}
 			}
 			else {
-				if(R.osa) {
+				if (R.osa) {
 					short b= R.samples->centmask[curmask];
 					xs= (float)x + R.samples->centLut[b & 15] + 0.5f;
 					ys= (float)y + R.samples->centLut[b>>4] + 0.5f;
@@ -1444,7 +1448,7 @@ void shade_samples_fill_with_ps(ShadeSample *ssamp, PixStr *ps, int x, int y)
 			}
 			
 			/* total sample amount, shi->sample is static set in initialize */
-			if(shi!=ssamp->shi)
+			if (shi!=ssamp->shi)
 				ssamp->tot= (shi-1)->sample + 1;
 		}
 	}
@@ -1455,7 +1459,7 @@ int shade_samples(ShadeSample *ssamp, PixStr *ps, int x, int y)
 {
 	shade_samples_fill_with_ps(ssamp, ps, x, y);
 	
-	if(ssamp->tot) {
+	if (ssamp->tot) {
 		ShadeInput *shi= ssamp->shi;
 		ShadeResult *shr= ssamp->shr;
 		int samp;
@@ -1464,15 +1468,15 @@ int shade_samples(ShadeSample *ssamp, PixStr *ps, int x, int y)
 		shade_samples_do_AO(ssamp);
 		
 		/* if shade (all shadepinputs have same passflag) */
-		if(ssamp->shi[0].passflag & ~(SCE_PASS_Z|SCE_PASS_INDEXOB|SCE_PASS_INDEXMA)) {
+		if (ssamp->shi[0].passflag & ~(SCE_PASS_Z|SCE_PASS_INDEXOB|SCE_PASS_INDEXMA)) {
 
-			for(samp=0; samp<ssamp->tot; samp++, shi++, shr++) {
+			for (samp=0; samp<ssamp->tot; samp++, shi++, shr++) {
 				shade_input_set_shade_texco(shi);
 				shade_input_do_shade(shi, shr);
 			}
 		}
-		else if(shi->passflag & SCE_PASS_Z) {
-			for(samp=0; samp<ssamp->tot; samp++, shi++, shr++)
+		else if (shi->passflag & SCE_PASS_Z) {
+			for (samp=0; samp<ssamp->tot; samp++, shi++, shr++)
 				shr->z= -shi->co[2];
 		}
 		
diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c
index 9aac7aa..cf68898 100644
--- a/source/blender/render/intern/source/shadeoutput.c
+++ b/source/blender/render/intern/source/shadeoutput.c
@@ -66,11 +66,11 @@ extern struct Render R;
 ListBase *get_lights(ShadeInput *shi)
 {
 	
-	if(R.r.scemode & R_PREVIEWBUTS)
+	if (R.r.scemode & R_PREVIEWBUTS)
 		return &R.lights;
-	if(shi->light_override)
+	if (shi->light_override)
 		return &shi->light_override->gobject;
-	if(shi->mat && shi->mat->group)
+	if (shi->mat && shi->mat->group)
 		return &shi->mat->group->gobject;
 	
 	return &R.lights;
@@ -96,7 +96,7 @@ static void fogcolor(float *colf, float *rco, float *view)
 	dview[2]= -stepsize;
 
 	startdist= -rco[2] + BLI_frand();
-	for(dist= startdist; dist>R.wrld.miststa; dist-= stepsize) {
+	for (dist= startdist; dist>R.wrld.miststa; dist-= stepsize) {
 		
 		hor[0]= R.wrld.horr; hor[1]= R.wrld.horg; hor[2]= R.wrld.horb;
 		alpha= 1.0f;
@@ -113,7 +113,7 @@ static void fogcolor(float *colf, float *rco, float *view)
 		hor[2]= hor[2]*alpha;
 		addAlphaOverFloat(colf, hor);
 		
-		VECSUB(vec, vec, dview);
+		sub_v3_v3(vec, dview);
 	}	
 }
 #endif
@@ -127,13 +127,13 @@ float mistfactor(float zcor, float const co[3])
 
 	/* fac= -co[2]-R.wrld.miststa; */
 
-	if(fac>0.0f) {
-		if(fac< R.wrld.mistdist) {
+	if (fac>0.0f) {
+		if (fac< R.wrld.mistdist) {
 			
 			fac= (fac/(R.wrld.mistdist));
 			
-			if(R.wrld.mistype==0) fac*= fac;
-			else if(R.wrld.mistype==1);
+			if (R.wrld.mistype==0) fac*= fac;
+			else if (R.wrld.mistype==1);
 			else fac= sqrt(fac);
 		}
 		else fac= 1.0f;
@@ -141,13 +141,13 @@ float mistfactor(float zcor, float const co[3])
 	else fac= 0.0f;
 	
 	/* height switched off mist */
-	if(R.wrld.misthi!=0.0f && fac!=0.0f) {
+	if (R.wrld.misthi!=0.0f && fac!=0.0f) {
 		/* at height misthi the mist is completely gone */
 
 		hi= R.viewinv[0][2]*co[0]+R.viewinv[1][2]*co[1]+R.viewinv[2][2]*co[2]+R.viewinv[3][2];
 		
-		if(hi>R.wrld.misthi) fac= 0.0f;
-		else if(hi>0.0f) {
+		if (hi>R.wrld.misthi) fac= 0.0f;
+		else if (hi>0.0f) {
 			hi= (R.wrld.misthi-hi)/R.wrld.misthi;
 			fac*= hi*hi;
 		}
@@ -166,37 +166,37 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
 	*intens= 0.0f;
 	haint= lar->haint;
 	
-	if(R.r.mode & R_ORTHO) {
+	if (R.r.mode & R_ORTHO) {
 		/* camera pos (view vector) cannot be used... */
 		/* camera position (cox,coy,0) rotate around lamp */
 		p1[0]= shi->co[0]-lar->co[0];
 		p1[1]= shi->co[1]-lar->co[1];
 		p1[2]= -lar->co[2];
 		mul_m3_v3(lar->imat, p1);
-		VECCOPY(npos, p1);	// npos is double!
+		copy_v3db_v3fl(npos, p1);	// npos is double!
 		
 		/* pre-scale */
 		npos[2] *= (double)lar->sh_zfac;
 	}
 	else {
-		VECCOPY(npos, lar->sh_invcampos);	/* in initlamp calculated */
+		copy_v3db_v3fl(npos, lar->sh_invcampos);	/* in initlamp calculated */
 	}
 	
 	/* rotate view */
-	VECCOPY(nray, shi->view);
+	copy_v3db_v3fl(nray, shi->view);
 	mul_m3_v3_double(lar->imat, nray);
 	
-	if(R.wrld.mode & WO_MIST) {
+	if (R.wrld.mode & WO_MIST) {
 		/* patchy... */
 		haint *= mistfactor(-lar->co[2], lar->co);
-		if(haint==0.0f) {
+		if (haint==0.0f) {
 			return;
 		}
 	}
 
 
 	/* rotate maxz */
-	if(shi->co[2]==0.0f) doclip= 0;	/* for when halo at sky */
+	if (shi->co[2]==0.0f) doclip= 0;	/* for when halo at sky */
 	else {
 		p1[0]= shi->co[0]-lar->co[0];
 		p1[1]= shi->co[1]-lar->co[1];
@@ -206,7 +206,7 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
 		maxz*= lar->sh_zfac;
 		maxy= lar->imat[0][1]*p1[0]+lar->imat[1][1]*p1[1]+lar->imat[2][1]*p1[2];
 
-		if( fabsf(nray[2]) < FLT_EPSILON ) use_yco= 1;
+		if ( fabs(nray[2]) < FLT_EPSILON ) use_yco= 1;
 	}
 	
 	/* scale z to make sure volume is normalized */	
@@ -230,7 +230,7 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
 	else {
 		disc = b*b - a*c;
 		
-		if(disc==0.0) {
+		if (disc==0.0) {
 			t1=t2= (-b)/ a;
 			snijp= 2;
 		}
@@ -241,11 +241,11 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
 			snijp= 2;
 		}
 	}
-	if(snijp==2) {
+	if (snijp==2) {
 		int ok1=0, ok2=0;
 
 		/* sort */
-		if(t1>t2) {
+		if (t1>t2) {
 			a= t1; t1= t2; t2= a;
 		}
 
@@ -254,52 +254,52 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
 		p2[2]= npos[2] + t2*nray[2];
 
 		/* evaluate both points */
-		if(p1[2]<=0.0f) ok1= 1;
-		if(p2[2]<=0.0f && t1!=t2) ok2= 1;
+		if (p1[2]<=0.0f) ok1= 1;
+		if (p2[2]<=0.0f && t1!=t2) ok2= 1;
 		
 		/* at least 1 point with negative z */
-		if(ok1==0 && ok2==0) return;
+		if (ok1==0 && ok2==0) return;
 		
 		/* intersction point with -ladist, the bottom of the cone */
-		if(use_yco==0) {
+		if (use_yco==0) {
 			t3= ((double)(-ladist)-npos[2])/nray[2];
 				
 			/* de we have to replace one of the intersection points? */
-			if(ok1) {
-				if(p1[2]<-ladist) t1= t3;
+			if (ok1) {
+				if (p1[2]<-ladist) t1= t3;
 			}
 			else {
 				t1= t3;
 			}
-			if(ok2) {
-				if(p2[2]<-ladist) t2= t3;
+			if (ok2) {
+				if (p2[2]<-ladist) t2= t3;
 			}
 			else {
 				t2= t3;
 			}
 		}
-		else if(ok1==0 || ok2==0) return;
+		else if (ok1==0 || ok2==0) return;
 		
 		/* at least 1 visible interesction point */
-		if(t1<0.0 && t2<0.0) return;
+		if (t1<0.0 && t2<0.0) return;
 		
-		if(t1<0.0) t1= 0.0;
-		if(t2<0.0) t2= 0.0;
+		if (t1<0.0) t1= 0.0;
+		if (t2<0.0) t2= 0.0;
 		
-		if(t1==t2) return;
+		if (t1==t2) return;
 		
 		/* sort again to be sure */
-		if(t1>t2) {
+		if (t1>t2) {
 			a= t1; t1= t2; t2= a;
 		}
 		
 		/* calculate t0: is the maximum visible z (when halo is intersected by face) */ 
-		if(doclip) {
-			if(use_yco==0) t0= (maxz-npos[2])/nray[2];
+		if (doclip) {
+			if (use_yco==0) t0= (maxz-npos[2])/nray[2];
 			else t0= (maxy-npos[1])/nray[1];
 
-			if(t0<t1) return;
-			if(t0<t2) t2= t0;
+			if (t0<t1) return;
+			if (t0<t2) t2= t0;
 		}
 
 		/* calc points */
@@ -326,18 +326,18 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
 		*intens= c*( (1.0-a)+(1.0-b) );
 
 		/* WATCH IT: do not clip a,b en c at 1.0, this gives nasty little overflows
-			at the edges (especially with narrow halos) */
-		if(*intens<=0.0f) return;
+		 * at the edges (especially with narrow halos) */
+		if (*intens<=0.0f) return;
 
 		/* soft area */
 		/* not needed because t0 has been used for p1/p2 as well */
-		/* if(doclip && t0<t2) { */
+		/* if (doclip && t0<t2) { */
 		/* 	*intens *= (t0-t1)/(t2-t1); */
 		/* } */
 		
 		*intens *= haint;
 		
-		if(lar->shb && lar->shb->shadhalostep) {
+		if (lar->shb && lar->shb->shadhalostep) {
 			*intens *= shadow_halo(lar, p1, p2);
 		}
 		
@@ -351,23 +351,23 @@ void renderspothalo(ShadeInput *shi, float col[4], float alpha)
 	LampRen *lar;
 	float i;
 	
-	if(alpha==0.0f) return;
+	if (alpha==0.0f) return;
 	
 	lights= get_lights(shi);
-	for(go=lights->first; go; go= go->next) {
+	for (go=lights->first; go; go= go->next) {
 		lar= go->lampren;
-		if(lar==NULL) continue;
+		if (lar==NULL) continue;
 		
-		if(lar->type==LA_SPOT && (lar->mode & LA_HALO) && (lar->buftype != LA_SHADBUF_DEEP) && lar->haint>0) {
+		if (lar->type==LA_SPOT && (lar->mode & LA_HALO) && (lar->buftype != LA_SHADBUF_DEEP) && lar->haint>0) {
 			
-			if(lar->mode & LA_LAYER) 
-				if(shi->vlr && (lar->lay & shi->obi->lay)==0) 
+			if (lar->mode & LA_LAYER) 
+				if (shi->vlr && (lar->lay & shi->obi->lay)==0) 
 					continue;
-			if((lar->lay & shi->lay)==0) 
+			if ((lar->lay & shi->lay)==0) 
 				continue;
 			
 			spothalo(lar, shi, &i);
-			if(i>0.0f) {
+			if (i>0.0f) {
 				col[3]+= i*alpha;			// all premul
 				col[0]+= i*lar->r*alpha;
 				col[1]+= i*lar->g*alpha;
@@ -376,7 +376,7 @@ void renderspothalo(ShadeInput *shi, float col[4], float alpha)
 		}
 	}
 	/* clip alpha, is needed for unified 'alpha threshold' (vanillaRenderPipe.c) */
-	if(col[3]>1.0f) col[3]= 1.0f;
+	if (col[3]>1.0f) col[3]= 1.0f;
 }
 
 
@@ -389,13 +389,14 @@ static double Normalize_d(double *n)
 	
 	d= n[0]*n[0]+n[1]*n[1]+n[2]*n[2];
 
-	if(d>0.00000000000000001) {
+	if (d>0.00000000000000001) {
 		d= sqrt(d);
 
 		n[0]/=d; 
 		n[1]/=d; 
 		n[2]/=d;
-	} else {
+	}
+	else {
 		n[0]=n[1]=n[2]= 0.0;
 		d= 0.0;
 	}
@@ -407,23 +408,23 @@ float fresnel_fac(float *view, float *vn, float grad, float fac)
 {
 	float t1, t2;
 	
-	if(fac==0.0f) return 1.0f;
+	if (fac==0.0f) return 1.0f;
 	
 	t1= (view[0]*vn[0] + view[1]*vn[1] + view[2]*vn[2]);
-	if(t1>0.0f)  t2= 1.0f+t1;
+	if (t1>0.0f)  t2= 1.0f+t1;
 	else t2= 1.0f-t1;
 	
 	t2= grad + (1.0f-grad)*powf(t2, fac);
 	
-	if(t2<0.0f) return 0.0f;
-	else if(t2>1.0f) return 1.0f;
+	if (t2<0.0f) return 0.0f;
+	else if (t2>1.0f) return 1.0f;
 	return t2;
 }
 
 static double saacos_d(double fac)
 {
-	if(fac<= -1.0) return M_PI;
-	else if(fac>=1.0) return 0.0;
+	if (fac<= -1.0) return M_PI;
+	else if (fac>=1.0) return 0.0;
 	else return acos(fac);
 }
 
@@ -473,7 +474,7 @@ static float area_lamp_energy(float (*area)[3], float *co, float *vn)
 	fac+= rad[2]*(vn[0]*cross[2][0]+ vn[1]*cross[2][1]+ vn[2]*cross[2][2]);
 	fac+= rad[3]*(vn[0]*cross[3][0]+ vn[1]*cross[3][1]+ vn[2]*cross[3][2]);
 
-	if(fac<=0.0) return 0.0;
+	if (fac<=0.0) return 0.0;
 	return fac;
 }
 
@@ -486,10 +487,10 @@ static float area_lamp_energy_multisample(LampRen *lar, float *co, float *vn)
 
 	/* test if co is behind lamp */
 	sub_v3_v3v3(vec, co, lar->co);
-	if(dot_v3v3(vec, lar->vec) < 0.0f)
+	if (dot_v3v3(vec, lar->vec) < 0.0f)
 		return 0.0f;
 
-	while(a--) {
+	while (a--) {
 		vec[0]= jitlamp[0];
 		vec[1]= jitlamp[1];
 		vec[2]= 0.0f;
@@ -513,35 +514,35 @@ static float spec(float inp, int hard)
 {
 	float b1;
 	
-	if(inp>=1.0f) return 1.0f;
+	if (inp>=1.0f) return 1.0f;
 	else if (inp<=0.0f) return 0.0f;
 	
 	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;
+	if ((hard & 1)==0)  inp= 1.0f;
+	if (hard & 2)  inp*= b1;
 	b1*= b1;
-	if(hard & 4)  inp*= b1;
+	if (hard & 4)  inp*= b1;
 	b1*= b1;
-	if(hard & 8)  inp*= b1;
+	if (hard & 8)  inp*= b1;
 	b1*= b1;
-	if(hard & 16) inp*= b1;
+	if (hard & 16) inp*= b1;
 	b1*= b1;
 
 	/* avoid FPE */
-	if(b1<0.001f) b1= 0.0f;	
+	if (b1<0.001f) b1= 0.0f;	
 
-	if(hard & 32) inp*= b1;
+	if (hard & 32) inp*= b1;
 	b1*= b1;
-	if(hard & 64) inp*=b1;
+	if (hard & 64) inp*=b1;
 	b1*= b1;
-	if(hard & 128) inp*=b1;
+	if (hard & 128) inp*=b1;
 
-	if(b1<0.001f) b1= 0.0f;	
+	if (b1<0.001f) b1= 0.0f;	
 
-	if(hard & 256) {
+	if (hard & 256) {
 		b1*= b1;
 		inp*=b1;
 	}
@@ -560,9 +561,9 @@ static float Phong_Spec( float *n, float *l, float *v, int hard, int tangent )
 	normalize_v3(h);
 	
 	rslt = h[0]*n[0] + h[1]*n[1] + h[2]*n[2];
-	if(tangent) rslt= sasqrt(1.0f - rslt*rslt);
+	if (tangent) rslt= sasqrt(1.0f - rslt*rslt);
 		
-	if( rslt > 0.0f ) rslt= spec(rslt, hard);
+	if ( rslt > 0.0f ) rslt= spec(rslt, hard);
 	else rslt = 0.0f;
 	
 	return rslt;
@@ -580,12 +581,12 @@ static float CookTorr_Spec(float *n, float *l, float *v, int hard, int tangent)
 	normalize_v3(h);
 
 	nh= n[0]*h[0]+n[1]*h[1]+n[2]*h[2];
-	if(tangent) nh= sasqrt(1.0f - nh*nh);
-	else if(nh<0.0f) return 0.0f;
+	if (tangent) nh= sasqrt(1.0f - nh*nh);
+	else if (nh<0.0f) return 0.0f;
 	
 	nv= n[0]*v[0]+n[1]*v[1]+n[2]*v[2];
-	if(tangent) nv= sasqrt(1.0f - nv*nv);
-	else if(nv<0.0f) nv= 0.0f;
+	if (tangent) nv= sasqrt(1.0f - nv*nv);
+	else if (nv<0.0f) nv= 0.0f;
 
 	i= spec(nh, hard);
 
@@ -599,11 +600,11 @@ static float Blinn_Spec(float *n, float *l, float *v, float refrac, float spec_p
 	float i, nh, nv, nl, vh, h[3];
 	float a, b, c, g=0.0f, p, f, ang;
 
-	if(refrac < 1.0f) return 0.0f;
-	if(spec_power == 0.0f) return 0.0f;
+	if (refrac < 1.0f) return 0.0f;
+	if (spec_power == 0.0f) return 0.0f;
 	
 	/* conversion from 'hardness' (1-255) to 'spec_power' (50 maps at 0.1) */
-	if(spec_power<100.0f)
+	if (spec_power<100.0f)
 		spec_power= sqrt(1.0f/spec_power);
 	else spec_power= 10.0f/spec_power;
 	
@@ -613,36 +614,36 @@ static float Blinn_Spec(float *n, float *l, float *v, float refrac, float spec_p
 	normalize_v3(h);
 
 	nh= n[0]*h[0]+n[1]*h[1]+n[2]*h[2]; /* Dot product between surface normal and half-way vector */
-	if(tangent) nh= sasqrt(1.0f - nh*nh);
-	else if(nh<0.0f) return 0.0f;
+	if (tangent) nh= sasqrt(1.0f - nh*nh);
+	else if (nh<0.0f) return 0.0f;
 
 	nv= n[0]*v[0]+n[1]*v[1]+n[2]*v[2]; /* Dot product between surface normal and view vector */
-	if(tangent) nv= sasqrt(1.0f - nv*nv);
-	if(nv<=0.01f) nv= 0.01f;				/* hrms... */
+	if (tangent) nv= sasqrt(1.0f - nv*nv);
+	if (nv<=0.01f) nv= 0.01f;				/* hrms... */
 
 	nl= n[0]*l[0]+n[1]*l[1]+n[2]*l[2]; /* Dot product between surface normal and light vector */
-	if(tangent) nl= sasqrt(1.0f - nl*nl);
-	if(nl<=0.01f) {
+	if (tangent) nl= sasqrt(1.0f - nl*nl);
+	if (nl<=0.01f) {
 		return 0.0f;
 	}
 
 	vh= v[0]*h[0]+v[1]*h[1]+v[2]*h[2]; /* Dot product between view vector and half-way vector */
-	if(vh<=0.0f) vh= 0.01f;
+	if (vh<=0.0f) vh= 0.01f;
 
 	a = 1.0f;
 	b = (2.0f*nh*nv)/vh;
 	c = (2.0f*nh*nl)/vh;
 
-	if( a < b && a < c ) g = a;
-	else if( b < a && b < c ) g = b;
-	else if( c < a && c < b ) g = c;
+	if ( a < b && a < c ) g = a;
+	else if ( b < a && b < c ) g = b;
+	else if ( c < a && c < b ) g = c;
 
 	p = sqrt( (double)((refrac * refrac)+(vh*vh)-1.0f) );
 	f = (((p-vh)*(p-vh))/((p+vh)*(p+vh)))*(1+((((vh*(p+vh))-1.0f)*((vh*(p+vh))-1.0f))/(((vh*(p-vh))+1.0f)*((vh*(p-vh))+1.0f))));
 	ang = saacos(nh);
 
 	i= f * g * exp((double)(-(ang*ang) / (2.0f*spec_power*spec_power)));
-	if(i<0.0f) i= 0.0f;
+	if (i<0.0f) i= 0.0f;
 	
 	return i;
 }
@@ -660,12 +661,12 @@ static float Toon_Spec( float *n, float *l, float *v, float size, float smooth,
 	normalize_v3(h);
 	
 	rslt = h[0]*n[0] + h[1]*n[1] + h[2]*n[2];
-	if(tangent) rslt = sasqrt(1.0f - rslt*rslt);
+	if (tangent) rslt = sasqrt(1.0f - rslt*rslt);
 	
 	ang = saacos( rslt ); 
 	
-	if( ang < size ) rslt = 1.0f;
-	else if( ang >= (size + smooth) || smooth == 0.0f ) rslt = 0.0f;
+	if ( ang < size ) rslt = 1.0f;
+	else if ( ang >= (size + smooth) || smooth == 0.0f ) rslt = 0.0f;
 	else rslt = 1.0f - ((ang - size) / smooth);
 	
 	return rslt;
@@ -684,16 +685,16 @@ static float WardIso_Spec( float *n, float *l, float *v, float rms, int tangent)
 	normalize_v3(h);
 
 	nh = n[0]*h[0]+n[1]*h[1]+n[2]*h[2]; /* Dot product between surface normal and half-way vector */
-	if(tangent) nh = sasqrt(1.0f - nh*nh);
-	if(nh<=0.0f) nh = 0.001f;
+	if (tangent) nh = sasqrt(1.0f - nh*nh);
+	if (nh<=0.0f) nh = 0.001f;
 	
 	nv = n[0]*v[0]+n[1]*v[1]+n[2]*v[2]; /* Dot product between surface normal and view vector */
-	if(tangent) nv = sasqrt(1.0f - nv*nv);
-	if(nv<=0.0f) nv = 0.001f;
+	if (tangent) nv = sasqrt(1.0f - nv*nv);
+	if (nv<=0.0f) nv = 0.001f;
 
 	nl = n[0]*l[0]+n[1]*l[1]+n[2]*l[2]; /* Dot product between surface normal and light vector */
-	if(tangent) nl = sasqrt(1.0f - nl*nl);
-	if(nl<=0.0f) nl = 0.001f;
+	if (tangent) nl = sasqrt(1.0f - nl*nl);
+	if (nl<=0.0f) nl = 0.001f;
 
 	angle = tan(saacos(nh));
 	alpha = MAX2(rms, 0.001f);
@@ -712,8 +713,8 @@ static float Toon_Diff( float *n, float *l, float *UNUSED(v), float size, float
 
 	ang = saacos( (double)(rslt) );
 
-	if( ang < size ) rslt = 1.0f;
-	else if( ang >= (size + smooth) || smooth == 0.0f ) rslt = 0.0f;
+	if ( ang < size ) rslt = 1.0f;
+	else if ( ang >= (size + smooth) || smooth == 0.0f ) rslt = 0.0f;
 	else rslt = 1.0f - ((ang - size) / smooth);
 
 	return rslt;
@@ -735,17 +736,17 @@ static float OrenNayar_Diff(float nl, float *n, float *l, float *v, float rough
 	normalize_v3(h);
 	
 	/* nh= n[0]*h[0]+n[1]*h[1]+n[2]*h[2]; */ /* Dot product between surface normal and half-way vector */
-	/* if(nh<0.0f) nh = 0.0f; */
+	/* if (nh<0.0f) nh = 0.0f; */
 	
 	nv= n[0]*v[0]+n[1]*v[1]+n[2]*v[2]; /* Dot product between surface normal and view vector */
-	if(nv<=0.0f) nv= 0.0f;
+	if (nv<=0.0f) nv= 0.0f;
 	
 	realnl= n[0]*l[0]+n[1]*l[1]+n[2]*l[2]; /* Dot product between surface normal and light vector */
-	if(realnl<=0.0f) return 0.0f;
-	if(nl<0.0f) return 0.0f;		/* value from area light */
+	if (realnl<=0.0f) return 0.0f;
+	if (nl<0.0f) return 0.0f;		/* value from area light */
 	
 	/* vh= v[0]*h[0]+v[1]*h[1]+v[2]*h[2]; */ /* Dot product between view vector and halfway vector */
-	/* if(vh<=0.0f) vh= 0.0f; */
+	/* if (vh<=0.0f) vh= 0.0f; */
 	
 	Lit_A = saacos(realnl);
 	View_A = saacos( nv );
@@ -761,9 +762,9 @@ static float OrenNayar_Diff(float nl, float *n, float *l, float *v, float rough
 	normalize_v3( View_B );
 	
 	t = Lit_B[0]*View_B[0] + Lit_B[1]*View_B[1] + Lit_B[2]*View_B[2];
-	if( t < 0 ) t = 0;
+	if ( t < 0 ) t = 0;
 	
-	if( Lit_A > View_A ) {
+	if ( Lit_A > View_A ) {
 		a = Lit_A;
 		b = View_A;
 	}
@@ -822,8 +823,8 @@ void calc_R_ref(ShadeInput *shi)
 	shi->ref[0]= (shi->view[0]+i*shi->vn[0]);
 	shi->ref[1]= (shi->view[1]+i*shi->vn[1]);
 	shi->ref[2]= (shi->view[2]+i*shi->vn[2]);
-	if(shi->osatex) {
-		if(shi->vlr->flag & R_SMOOTH) {
+	if (shi->osatex) {
+		if (shi->vlr->flag & R_SMOOTH) {
 			i= -2*( (shi->vn[0]+shi->dxno[0])*(shi->view[0]+shi->dxview) +
 				(shi->vn[1]+shi->dxno[1])*shi->view[1]+ (shi->vn[2]+shi->dxno[2])*shi->view[2] );
 
@@ -864,24 +865,24 @@ void shade_color(ShadeInput *shi, ShadeResult *shr)
 {
 	Material *ma= shi->mat;
 
-	if(ma->mode & (MA_FACETEXTURE)) {
+	if (ma->mode & (MA_FACETEXTURE)) {
 		shi->r= shi->vcol[0];
 		shi->g= shi->vcol[1];
 		shi->b= shi->vcol[2];
-		if(ma->mode & (MA_FACETEXTURE_ALPHA))
+		if (ma->mode & (MA_FACETEXTURE_ALPHA))
 			shi->alpha= shi->vcol[3];
 	}
-	else if(ma->mode & (MA_VERTEXCOLP)) {
+	else if (ma->mode & (MA_VERTEXCOLP)) {
 		float neg_alpha = 1.0f - shi->vcol[3];
 		shi->r= shi->r*neg_alpha + shi->vcol[0]*shi->vcol[3];
 		shi->g= shi->g*neg_alpha + shi->vcol[1]*shi->vcol[3];
 		shi->b= shi->b*neg_alpha + shi->vcol[2]*shi->vcol[3];
 	}
 	
-	if(ma->texco)
+	if (ma->texco)
 		do_material_tex(shi, &R);
 
-	if(ma->fresnel_tra!=0.0f) 
+	if (ma->fresnel_tra!=0.0f) 
 		shi->alpha*= fresnel_fac(shi->view, shi->vn, ma->fresnel_tra_i, ma->fresnel_tra);
 	
 	if (!(shi->mode & MA_TRANSP)) shi->alpha= 1.0f;
@@ -898,8 +899,8 @@ static void ramp_diffuse_result(float *diff, ShadeInput *shi)
 	Material *ma= shi->mat;
 	float col[4];
 
-	if(ma->ramp_col) {
-		if(ma->rampin_col==MA_RAMP_IN_RESULT) {
+	if (ma->ramp_col) {
+		if (ma->rampin_col==MA_RAMP_IN_RESULT) {
 			float fac = rgb_to_grayscale(diff);
 			do_colorband(ma->ramp_col, fac, col);
 			
@@ -916,10 +917,10 @@ static void add_to_diffuse(float *diff, ShadeInput *shi, float is, float r, floa
 {
 	Material *ma= shi->mat;
 
-	if(ma->ramp_col && (ma->mode & MA_RAMP_COL)) {
+	if (ma->ramp_col && (ma->mode & MA_RAMP_COL)) {
 		
 		/* MA_RAMP_IN_RESULT is exceptional */
-		if(ma->rampin_col==MA_RAMP_IN_RESULT) {
+		if (ma->rampin_col==MA_RAMP_IN_RESULT) {
 			// normal add
 			diff[0] += r * shi->r;
 			diff[1] += g * shi->g;
@@ -973,7 +974,7 @@ static void ramp_spec_result(float spec_col[3], ShadeInput *shi)
 {
 	Material *ma= shi->mat;
 
-	if(ma->ramp_spec && (ma->rampin_spec==MA_RAMP_IN_RESULT)) {
+	if (ma->ramp_spec && (ma->rampin_spec==MA_RAMP_IN_RESULT)) {
 		float col[4];
 		float fac = rgb_to_grayscale(spec_col);
 
@@ -997,7 +998,7 @@ static void do_specular_ramp(ShadeInput *shi, float is, float t, float spec[3])
 	spec[2]= shi->specb;
 
 	/* MA_RAMP_IN_RESULT is exception */
-	if(ma->ramp_spec && (ma->rampin_spec!=MA_RAMP_IN_RESULT)) {
+	if (ma->ramp_spec && (ma->rampin_spec!=MA_RAMP_IN_RESULT)) {
 		float fac;
 		float col[4];
 
@@ -1030,10 +1031,10 @@ static void do_specular_ramp(ShadeInput *shi, float is, float t, float spec[3])
 /* preprocess, textures were not done, don't use shi->amb for that reason */
 void ambient_occlusion(ShadeInput *shi)
 {
-	if((R.wrld.ao_gather_method == WO_AOGATHER_APPROX) && shi->mat->amb!=0.0f) {
+	if ((R.wrld.ao_gather_method == WO_AOGATHER_APPROX) && shi->mat->amb!=0.0f) {
 		sample_occ(&R, shi);
 	}
-	else if((R.r.mode & R_RAYTRACE) && shi->mat->amb!=0.0f) {
+	else if ((R.r.mode & R_RAYTRACE) && shi->mat->amb!=0.0f) {
 		ray_ao(shi, shi->ao, shi->env);
 	}
 	else {
@@ -1050,21 +1051,21 @@ static void ambient_occlusion_apply(ShadeInput *shi, ShadeResult *shr)
 	float f= R.wrld.aoenergy;
 	float tmp[3], tmpspec[3];
 
-	if(!((R.r.mode & R_RAYTRACE) || R.wrld.ao_gather_method == WO_AOGATHER_APPROX))
+	if (!((R.r.mode & R_RAYTRACE) || R.wrld.ao_gather_method == WO_AOGATHER_APPROX))
 		return;
-	if(f == 0.0f)
+	if (f == 0.0f)
 		return;
 
-	if(R.wrld.aomix==WO_AOADD) {
+	if (R.wrld.aomix==WO_AOADD) {
 		shr->combined[0] += shi->ao[0]*shi->r*shi->refl*f;
 		shr->combined[1] += shi->ao[1]*shi->g*shi->refl*f;
 		shr->combined[2] += shi->ao[2]*shi->b*shi->refl*f;
 	}
-	else if(R.wrld.aomix==WO_AOMUL) {
+	else if (R.wrld.aomix==WO_AOMUL) {
 		mul_v3_v3v3(tmp, shr->combined, shi->ao);
 		mul_v3_v3v3(tmpspec, shr->spec, shi->ao);
 
-		if(f == 1.0f) {
+		if (f == 1.0f) {
 			copy_v3_v3(shr->combined, tmp);
 			copy_v3_v3(shr->spec, tmpspec);
 		}
@@ -1079,9 +1080,9 @@ void environment_lighting_apply(ShadeInput *shi, ShadeResult *shr)
 {
 	float f= R.wrld.ao_env_energy*shi->amb;
 
-	if(!((R.r.mode & R_RAYTRACE) || R.wrld.ao_gather_method == WO_AOGATHER_APPROX))
+	if (!((R.r.mode & R_RAYTRACE) || R.wrld.ao_gather_method == WO_AOGATHER_APPROX))
 		return;
-	if(f == 0.0f)
+	if (f == 0.0f)
 		return;
 	
 	shr->combined[0] += shi->env[0]*shi->r*shi->refl*f;
@@ -1093,9 +1094,9 @@ static void indirect_lighting_apply(ShadeInput *shi, ShadeResult *shr)
 {
 	float f= R.wrld.ao_indirect_energy;
 
-	if(!((R.r.mode & R_RAYTRACE) || R.wrld.ao_gather_method == WO_AOGATHER_APPROX))
+	if (!((R.r.mode & R_RAYTRACE) || R.wrld.ao_gather_method == WO_AOGATHER_APPROX))
 		return;
-	if(f == 0.0f)
+	if (f == 0.0f)
 		return;
 
 	shr->combined[0] += shi->indirect[0]*shi->r*shi->refl*f;
@@ -1108,21 +1109,21 @@ void lamp_get_shadow(LampRen *lar, ShadeInput *shi, float inp, float shadfac[4],
 {
 	LampShadowSubSample *lss= &(lar->shadsamp[shi->thread].s[shi->sample]);
 	
-	if(do_real || lss->samplenr!=shi->samplenr) {
+	if (do_real || lss->samplenr!=shi->samplenr) {
 		
 		shadfac[0]= shadfac[1]= shadfac[2]= shadfac[3]= 1.0f;
 		
-		if(lar->shb) {
-			if(lar->buftype==LA_SHADBUF_IRREGULAR)
+		if (lar->shb) {
+			if (lar->buftype==LA_SHADBUF_IRREGULAR)
 				shadfac[3]= ISB_getshadow(shi, lar->shb);
 			else
 				shadfac[3] = testshadowbuf(&R, lar->shb, shi->co, shi->dxco, shi->dyco, inp, shi->mat->lbias);
 		}
-		else if(lar->mode & LA_SHAD_RAY) {
+		else if (lar->mode & LA_SHAD_RAY) {
 			ray_shadow(shi, lar, shadfac);
 		}
 		
-		if(shi->depth==0) {
+		if (shi->depth==0) {
 			copy_v4_v4(lss->shadfac, shadfac);
 			lss->samplenr= shi->samplenr;
 		}
@@ -1135,7 +1136,7 @@ void lamp_get_shadow(LampRen *lar, ShadeInput *shi, float inp, float shadfac[4],
 /* lampdistance and spot angle, writes in lv and dist */
 float lamp_get_visibility(LampRen *lar, const float co[3], float lv[3], float *dist)
 {
-	if(lar->type==LA_SUN || lar->type==LA_HEMI) {
+	if (lar->type==LA_SUN || lar->type==LA_HEMI) {
 		*dist= 1.0f;
 		copy_v3_v3(lv, lar->vec);
 		return 1.0f;
@@ -1149,9 +1150,9 @@ float lamp_get_visibility(LampRen *lar, const float co[3], float lv[3], float *d
 		mul_v3_fl(lv, t);
 		
 		/* area type has no quad or sphere option */
-		if(lar->type==LA_AREA) {
+		if (lar->type==LA_AREA) {
 			/* area is single sided */
-			//if(dot_v3v3(lv, lar->vec) > 0.0f)
+			//if (dot_v3v3(lv, lar->vec) > 0.0f)
 			//	visifac= 1.0f;
 			//else
 			//	visifac= 0.0f;
@@ -1174,9 +1175,9 @@ float lamp_get_visibility(LampRen *lar, const float co[3], float lv[3], float *d
 					visifac = lar->dist / (lar->dist + dist[0]*dist[0]);
 					break;
 				case LA_FALLOFF_SLIDERS:
-					if(lar->ld1>0.0f)
+					if (lar->ld1>0.0f)
 						visifac= lar->dist/(lar->dist+lar->ld1*dist[0]);
-					if(lar->ld2>0.0f)
+					if (lar->ld2>0.0f)
 						visifac*= lar->distkw/(lar->distkw+lar->ld2*dist[0]*dist[0]);
 					break;
 				case LA_FALLOFF_CURVE:
@@ -1184,27 +1185,27 @@ float lamp_get_visibility(LampRen *lar, const float co[3], float lv[3], float *d
 					break;
 			}
 			
-			if(lar->mode & LA_SPHERE) {
+			if (lar->mode & LA_SPHERE) {
 				float t= lar->dist - dist[0];
-				if(t<=0.0f) 
+				if (t<=0.0f) 
 					visifac= 0.0f;
 				else
 					visifac*= t/lar->dist;
 			}
 			
-			if(visifac > 0.0f) {
-				if(lar->type==LA_SPOT) {
+			if (visifac > 0.0f) {
+				if (lar->type==LA_SPOT) {
 					float inpr;
 					
-					if(lar->mode & LA_SQUARE) {
-						if(dot_v3v3(lv, lar->vec) > 0.0f) {
+					if (lar->mode & LA_SQUARE) {
+						if (dot_v3v3(lv, lar->vec) > 0.0f) {
 							float lvrot[3], x;
 							
 							/* rotate view to lampspace */
 							copy_v3_v3(lvrot, lv);
 							mul_m3_v3(lar->imat, lvrot);
 							
-							x= MAX2(fabs(lvrot[0]/lvrot[2]) , fabs(lvrot[1]/lvrot[2]));
+							x = maxf(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));
@@ -1216,11 +1217,11 @@ float lamp_get_visibility(LampRen *lar, const float co[3], float lv[3], float *d
 					}
 					
 					t= lar->spotsi;
-					if(inpr<=t) 
+					if (inpr<=t) 
 						visifac= 0.0f;
 					else {
 						t= inpr-t;
-						if(t<lar->spotbl && lar->spotbl!=0.0f) {
+						if (t<lar->spotbl && lar->spotbl!=0.0f) {
 							/* soft area */
 							float i= t/lar->spotbl;
 							t= i*i;
@@ -1253,17 +1254,17 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
 	/* only shadow lamps shouldn't affect shadow-less materials at all */
 	if ((lar->mode & LA_ONLYSHADOW) && (!(ma->mode & MA_SHADOW) || !(R.r.mode & R_SHADOW)))
 		return;
-	/* optimisation, don't render fully black lamps */
+	/* optimization, don't render fully black lamps */
 	if (!(lar->mode & LA_TEXTURE) && (lar->r + lar->g + lar->b == 0.0f))
 		return;
 	
 	/* lampdist, spot angle, area side, ... */
 	visifac= lamp_get_visibility(lar, shi->co, lv, &lampdist);
-	if(visifac==0.0f)
+	if (visifac==0.0f)
 		return;
 	
-	if(lar->type==LA_SPOT) {
-		if(lar->mode & LA_OSATEX) {
+	if (lar->type==LA_SPOT) {
+		if (lar->mode & LA_OSATEX) {
 			shi->osatex= 1;	/* signal for multitex() */
 			
 			shi->dxlv[0]= lv[0] - (shi->co[0]-lar->co[0]+shi->dxco[0])/lampdist;
@@ -1285,15 +1286,15 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
 	lashdw[1]= lar->shdwg;
 	lashdw[2]= lar->shdwb;
 	
-	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);
+	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 */	
 		/* note, vnor==vn is used as tangent trigger for buffer shadow */
-	if(vlr->flag & R_TANGENT) {
+	if (vlr->flag & R_TANGENT) {
 		float cross[3], nstrand[3], blend;
 
-		if(ma->mode & MA_STR_SURFDIFF) {
+		if (ma->mode & MA_STR_SURFDIFF) {
 			cross_v3_v3v3(cross, shi->surfnor, vn);
 			cross_v3_v3v3(nstrand, vn, cross);
 
@@ -1310,8 +1311,8 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
 			normalize_v3(vnor);
 		}
 
-		if(ma->strand_surfnor > 0.0f) {
-			if(ma->strand_surfnor > shi->surfdist) {
+		if (ma->strand_surfnor > 0.0f) {
+			if (ma->strand_surfnor > shi->surfdist) {
 				blend= (ma->strand_surfnor - shi->surfdist)/ma->strand_surfnor;
 				interp_v3_v3v3(vnor, vnor, shi->surfnor, blend);
 				normalize_v3(vnor);
@@ -1336,18 +1337,18 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
 
 	/* phong threshold to prevent backfacing faces having artefacts 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) {
-			if(lar->type==LA_HEMI || lar->type==LA_AREA);
-			else if((ma->mode & MA_RAYBIAS) && (lar->mode & LA_SHAD_RAY) && (vlr->flag & R_SMOOTH)) {
+	if (R.r.mode & R_SHADOW) {
+		if (ma->mode & MA_SHADOW) {
+			if (lar->type==LA_HEMI || lar->type==LA_AREA);
+			else if ((ma->mode & MA_RAYBIAS) && (lar->mode & LA_SHAD_RAY) && (vlr->flag & R_SMOOTH)) {
 				float thresh= shi->obr->ob->smoothresh;
-				if(inp>thresh)
+				if (inp>thresh)
 					phongcorr= (inp-thresh)/(inp*(1.0f-thresh));
 				else
 					phongcorr= 0.0f;
 			}
-			else if(ma->sbias!=0.0f && ((lar->mode & LA_SHAD_RAY) || lar->shb)) {
-				if(inp>ma->sbias)
+			else if (ma->sbias!=0.0f && ((lar->mode & LA_SHAD_RAY) || lar->shb)) {
+				if (inp>ma->sbias)
 					phongcorr= (inp-ma->sbias)/(inp*(1.0f-ma->sbias));
 				else
 					phongcorr= 0.0f;
@@ -1356,57 +1357,57 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
 	}
 	
 	/* diffuse shaders */
-	if(lar->mode & LA_NO_DIFF) {
+	if (lar->mode & LA_NO_DIFF) {
 		is= 0.0f;	// skip shaders
 	}
-	else if(lar->type==LA_HEMI) {
+	else if (lar->type==LA_HEMI) {
 		is= 0.5f*inp + 0.5f;
 	}
 	else {
 		
-		if(lar->type==LA_AREA)
+		if (lar->type==LA_AREA)
 			inp= area_lamp_energy_multisample(lar, shi->co, vn);
 		
 		/* diffuse shaders (oren nayer gets inp from area light) */
-		if(ma->diff_shader==MA_DIFF_ORENNAYAR) is= OrenNayar_Diff(inp, vn, lv, view, ma->roughness);
-		else if(ma->diff_shader==MA_DIFF_TOON) is= Toon_Diff(vn, lv, view, ma->param[0], ma->param[1]);
-		else if(ma->diff_shader==MA_DIFF_MINNAERT) is= Minnaert_Diff(inp, vn, view, ma->darkness);
-		else if(ma->diff_shader==MA_DIFF_FRESNEL) is= Fresnel_Diff(vn, lv, view, ma->param[0], ma->param[1]);
+		if (ma->diff_shader==MA_DIFF_ORENNAYAR) is= OrenNayar_Diff(inp, vn, lv, view, ma->roughness);
+		else if (ma->diff_shader==MA_DIFF_TOON) is= Toon_Diff(vn, lv, view, ma->param[0], ma->param[1]);
+		else if (ma->diff_shader==MA_DIFF_MINNAERT) is= Minnaert_Diff(inp, vn, view, ma->darkness);
+		else if (ma->diff_shader==MA_DIFF_FRESNEL) is= Fresnel_Diff(vn, lv, view, ma->param[0], ma->param[1]);
 		else is= inp;	// Lambert
 	}
 	
 	/* 'is' is diffuse */
-	if((ma->shade_flag & MA_CUBIC) && is>0.0f && is<1.0f)
+	if ((ma->shade_flag & MA_CUBIC) && is>0.0f && is<1.0f)
 		is= 3.0f*is*is - 2.0f*is*is*is;	// nicer termination of shades
 
 	i= is*phongcorr;
 	
-	if(i>0.0f) {
+	if (i>0.0f) {
 		i*= visifac*shi->refl;
 	}
 	i_noshad= i;
 	
 	vn= shi->vn;	// bring back original vector, we use special specular shaders for tangent
-	if(ma->mode & MA_TANGENT_V)
+	if (ma->mode & MA_TANGENT_V)
 		vn= shi->tang;
 	
 	/* init transp shadow */
 	shadfac[0]= shadfac[1]= shadfac[2]= shadfac[3]= 1.0f;
 	
 	/* shadow and spec, (visifac==0 outside spot) */
-	if(visifac> 0.0f) {
+	if (visifac> 0.0f) {
 		
-		if((R.r.mode & R_SHADOW)) {
-			if(ma->mode & MA_SHADOW) {
-				if(lar->shb || (lar->mode & LA_SHAD_RAY)) {
+		if ((R.r.mode & R_SHADOW)) {
+			if (ma->mode & MA_SHADOW) {
+				if (lar->shb || (lar->mode & LA_SHAD_RAY)) {
 					
-					if(vn==vnor)	/* tangent trigger */
+					if (vn==vnor)	/* tangent trigger */
 						lamp_get_shadow(lar, shi, dot_v3v3(shi->vn, lv), shadfac, shi->depth);
 					else
 						lamp_get_shadow(lar, shi, inp, shadfac, shi->depth);
 						
 					/* warning, here it skips the loop */
-					if((lar->mode & LA_ONLYSHADOW) && i>0.0f) {
+					if ((lar->mode & LA_ONLYSHADOW) && i>0.0f) {
 						
 						shadfac[3]= i*lar->energy*(1.0f-shadfac[3]);
 						shr->shad[0] -= shadfac[3]*shi->r*(1.0f-lashdw[0]);
@@ -1427,9 +1428,9 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
 		}
 		
 		/* in case 'no diffuse' we still do most calculus, spec can be in shadow.*/
-		if(!(lar->mode & LA_NO_DIFF)) {
-			if(i>0.0f) {
-				if(ma->mode & MA_SHADOW_TRA)
+		if (!(lar->mode & LA_NO_DIFF)) {
+			if (i>0.0f) {
+				if (ma->mode & MA_SHADOW_TRA)
 					add_to_diffuse(shr->shad, shi, is, i*shadfac[0]*lacol[0], i*shadfac[1]*lacol[1], i*shadfac[2]*lacol[2]);
 				else
 					add_to_diffuse(shr->shad, shi, is, i*lacol[0], i*lacol[1], i*lacol[2]);
@@ -1438,8 +1439,8 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
 			if (i_noshad>i && !(lashdw[0]==0 && lashdw[1]==0 && lashdw[2]==0)) {
 				add_to_diffuse(shr->shad, shi, is, lashdw[0]*(i_noshad-i)*lacol[0], lashdw[1]*(i_noshad-i)*lacol[1], lashdw[2]*(i_noshad-i)*lacol[2]);
 			}
-			if(i_noshad>0.0f) {
-				if(passflag & (SCE_PASS_DIFFUSE|SCE_PASS_SHADOW)) {
+			if (i_noshad>0.0f) {
+				if (passflag & (SCE_PASS_DIFFUSE|SCE_PASS_SHADOW)) {
 					add_to_diffuse(shr->diff, shi, is, i_noshad*lacol[0], i_noshad*lacol[1], i_noshad*lacol[2]);
 				}
 				else
@@ -1450,10 +1451,10 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
 		/* specularity */
 		shadfac[3]*= phongcorr;	/* note, shadfac not allowed to be stored nonlocal */
 		
-		if(shadfac[3]>0.0f && shi->spec!=0.0f && !(lar->mode & LA_NO_SPEC) && !(lar->mode & LA_ONLYSHADOW)) {
+		if (shadfac[3]>0.0f && shi->spec!=0.0f && !(lar->mode & LA_NO_SPEC) && !(lar->mode & LA_ONLYSHADOW)) {
 			
-			if(!(passflag & (SCE_PASS_COMBINED|SCE_PASS_SPEC)));
-			else if(lar->type==LA_HEMI) {
+			if (!(passflag & (SCE_PASS_COMBINED|SCE_PASS_SPEC)));
+			else if (lar->type==LA_HEMI) {
 				float t;
 				/* hemi uses no spec shaders (yet) */
 				
@@ -1465,7 +1466,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
 				
 				t= vn[0]*lv[0]+vn[1]*lv[1]+vn[2]*lv[2];
 				
-				if(lar->type==LA_HEMI) {
+				if (lar->type==LA_HEMI) {
 					t= 0.5f*t+0.5f;
 				}
 				
@@ -1479,23 +1480,23 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
 				/* specular shaders */
 				float specfac, t;
 				
-				if(ma->spec_shader==MA_SPEC_PHONG) 
+				if (ma->spec_shader==MA_SPEC_PHONG) 
 					specfac= Phong_Spec(vn, lv, view, shi->har, (vlr->flag & R_TANGENT) || (ma->mode & MA_TANGENT_V));
-				else if(ma->spec_shader==MA_SPEC_COOKTORR) 
+				else if (ma->spec_shader==MA_SPEC_COOKTORR) 
 					specfac= CookTorr_Spec(vn, lv, view, shi->har, (vlr->flag & R_TANGENT) || (ma->mode & MA_TANGENT_V));
-				else if(ma->spec_shader==MA_SPEC_BLINN) 
+				else if (ma->spec_shader==MA_SPEC_BLINN) 
 					specfac= Blinn_Spec(vn, lv, view, ma->refrac, (float)shi->har, (vlr->flag & R_TANGENT) || (ma->mode & MA_TANGENT_V));
-				else if(ma->spec_shader==MA_SPEC_WARDISO)
+				else if (ma->spec_shader==MA_SPEC_WARDISO)
 					specfac= WardIso_Spec( vn, lv, view, ma->rms, (vlr->flag & R_TANGENT) || (ma->mode & MA_TANGENT_V));
 				else 
 					specfac= Toon_Spec(vn, lv, view, ma->param[2], ma->param[3], (vlr->flag & R_TANGENT) || (ma->mode & MA_TANGENT_V));
 				
 				/* area lamp correction */
-				if(lar->type==LA_AREA) specfac*= inp;
+				if (lar->type==LA_AREA) specfac*= inp;
 				
 				t= shadfac[3]*shi->spec*visifac*specfac;
 				
-				if(ma->mode & MA_RAMP_SPEC) {
+				if (ma->mode & MA_RAMP_SPEC) {
 					float spec[3];
 					do_specular_ramp(shi, specfac, t, spec);
 					shr->spec[0]+= t*(lacol[0] * spec[0]);
@@ -1515,7 +1516,7 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
 static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr)
 {
 	
-	if(R.r.mode & R_SHADOW) {
+	if (R.r.mode & R_SHADOW) {
 		ListBase *lights;
 		LampRen *lar;
 		GroupObject *go;
@@ -1529,28 +1530,28 @@ static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr)
 		accum= ir= 0.0f;
 		
 		lights= get_lights(shi);
-		for(go=lights->first; go; go= go->next) {
+		for (go=lights->first; go; go= go->next) {
 			lar= go->lampren;
-			if(lar==NULL) continue;
+			if (lar==NULL) continue;
 			
 			/* yafray: ignore shading by photonlights, not used in Blender */
 			if (lar->type==LA_YF_PHOTON) continue;
 			
-			if(lar->mode & LA_LAYER) if((lar->lay & shi->obi->lay)==0) continue;
-			if((lar->lay & shi->lay)==0) continue;
+			if (lar->mode & LA_LAYER) if ((lar->lay & shi->obi->lay)==0) continue;
+			if ((lar->lay & shi->lay)==0) continue;
 			
-			if(lar->shb || (lar->mode & LA_SHAD_RAY)) {
+			if (lar->shb || (lar->mode & LA_SHAD_RAY)) {
 				visifac= lamp_get_visibility(lar, shi->co, lv, &lampdist);
 				ir+= 1.0f;
 
-				if(visifac <= 0.0f) {
+				if (visifac <= 0.0f) {
 					if (shi->mat->shadowonly_flag == MA_SO_OLD)
 						accum+= 1.0f;
 
 					continue;
 				}
 				inpr= dot_v3v3(shi->vn, lv);
-				if(inpr <= 0.0f) {
+				if (inpr <= 0.0f) {
 					if (shi->mat->shadowonly_flag == MA_SO_OLD)
 						accum+= 1.0f;
 
@@ -1574,7 +1575,7 @@ static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr)
 		}
 
 		/* Apply shadows as alpha */
-		if(ir>0.0f) {
+		if (ir>0.0f) {
 			if (shi->mat->shadowonly_flag == MA_SO_OLD) {
 				accum = 1.0f - accum/ir;
 			}
@@ -1604,13 +1605,13 @@ static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr)
 	}
 	
 	/* quite disputable this...  also note it doesn't mirror-raytrace */	
-	if((R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT)) && shi->amb!=0.0f) {
+	if ((R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT)) && shi->amb!=0.0f) {
 		float f;
 		
-		if(R.wrld.mode & WO_AMB_OCC) {
+		if (R.wrld.mode & WO_AMB_OCC) {
 			f= R.wrld.aoenergy*shi->amb;
 			
-			if(R.wrld.aomix==WO_AOADD) {
+			if (R.wrld.aomix==WO_AOADD) {
 				if (shi->mat->shadowonly_flag == MA_SO_OLD) {
 					f= f*(1.0f - rgb_to_grayscale(shi->ao));
 					shr->alpha= (shr->alpha + f)*f;
@@ -1624,7 +1625,7 @@ static void shade_lamp_loop_only_shadow(ShadeInput *shi, ShadeResult *shr)
 				shr->alpha= (1.0f - f)*shr->alpha + f*(1.0f - (1.0f - shr->alpha)*rgb_to_grayscale(shi->ao));
 		}
 
-		if(R.wrld.mode & WO_ENV_LIGHT) {
+		if (R.wrld.mode & WO_ENV_LIGHT) {
 			if (shi->mat->shadowonly_flag == MA_SO_OLD) {
 				f= R.wrld.ao_env_energy*shi->amb*(1.0f - rgb_to_grayscale(shi->env));
 				shr->alpha= (shr->alpha + f)*f;
@@ -1654,10 +1655,10 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
 	
 	memset(shr, 0, sizeof(ShadeResult));
 	
-	if(!(shi->mode & MA_TRANSP)) shi->alpha = 1.0f;
+	if (!(shi->mode & MA_TRANSP)) shi->alpha = 1.0f;
 	
 	/* separate loop */
-	if(ma->mode & MA_ONLYSHADOW) {
+	if (ma->mode & MA_ONLYSHADOW) {
 		shade_lamp_loop_only_shadow(shi, shr);
 		return;
 	}
@@ -1666,21 +1667,21 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
 	shi->refcol[0]= shi->refcol[1]= shi->refcol[2]= shi->refcol[3]= 0.0f;
 	
 	/* material color itself */
-	if(passflag & (SCE_PASS_COMBINED|SCE_PASS_RGBA)) {
-		if(ma->mode & (MA_FACETEXTURE)) {
+	if (passflag & (SCE_PASS_COMBINED|SCE_PASS_RGBA)) {
+		if (ma->mode & (MA_FACETEXTURE)) {
 			shi->r= shi->vcol[0];
 			shi->g= shi->vcol[1];
 			shi->b= shi->vcol[2];
-			if(ma->mode & (MA_FACETEXTURE_ALPHA))
+			if (ma->mode & (MA_FACETEXTURE_ALPHA))
 				shi->alpha= shi->vcol[3];
 		}
-		else if(ma->mode & (MA_VERTEXCOLP)) {
+		else if (ma->mode & (MA_VERTEXCOLP)) {
 			float neg_alpha = 1.0f - shi->vcol[3];
 			shi->r= shi->r*neg_alpha + shi->vcol[0]*shi->vcol[3];
 			shi->g= shi->g*neg_alpha + shi->vcol[1]*shi->vcol[3];
 			shi->b= shi->b*neg_alpha + shi->vcol[2]*shi->vcol[3];
 		}
-		if(ma->texco){
+		if (ma->texco) {
 			do_material_tex(shi, &R);
 			if (!(shi->mode & MA_TRANSP)) shi->alpha = 1.0f;
 		}
@@ -1690,8 +1691,8 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
 		shr->col[2]= shi->b*shi->alpha;
 		shr->col[3]= shi->alpha;
 
-		if((ma->sss_flag & MA_DIFF_SSS) && !sss_pass_done(&R, ma)) {
-			if(ma->sss_texfac == 0.0f) {
+		if ((ma->sss_flag & MA_DIFF_SSS) && !sss_pass_done(&R, ma)) {
+			if (ma->sss_texfac == 0.0f) {
 				shi->r= shi->g= shi->b= shi->alpha= 1.0f;
 				shr->col[0]= shr->col[1]= shr->col[2]= shr->col[3]= 1.0f;
 			}
@@ -1709,7 +1710,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
 		}
 	}
 	
-	if(ma->mode & MA_SHLESS) {
+	if (ma->mode & MA_SHLESS) {
 		shr->combined[0]= shi->r;
 		shr->combined[1]= shi->g;
 		shr->combined[2]= shi->b;
@@ -1717,7 +1718,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
 		return;
 	}
 
-	if( (ma->mode & (MA_VERTEXCOL|MA_VERTEXCOLP))== MA_VERTEXCOL ) {	// vertexcolor light
+	if ( (ma->mode & (MA_VERTEXCOL|MA_VERTEXCOLP))== MA_VERTEXCOL ) {	// vertexcolor light
 		shr->emit[0]= shi->r*(shi->emit+shi->vcol[0]*shi->vcol[3]);
 		shr->emit[1]= shi->g*(shi->emit+shi->vcol[1]*shi->vcol[3]);
 		shr->emit[2]= shi->b*(shi->emit+shi->vcol[2]*shi->vcol[3]);
@@ -1729,12 +1730,13 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
 	}
 	
 	/* AO pass */
-	if(R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) {
-		if(((passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT)))
-			|| (passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) {
-			if(R.r.mode & R_SHADOW) {
+	if (R.wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) {
+		if (((passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) ||
+		    (passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT)))
+		{
+			if (R.r.mode & R_SHADOW) {
 				/* AO was calculated for scanline already */
-				if(shi->depth || shi->volume_depth)
+				if (shi->depth || shi->volume_depth)
 					ambient_occlusion(shi);
 				copy_v3_v3(shr->ao, shi->ao);
 				copy_v3_v3(shr->env, shi->env); // XXX multiply
@@ -1744,29 +1746,29 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
 	}
 	
 	/* lighting pass */
-	if(passflag & (SCE_PASS_COMBINED|SCE_PASS_DIFFUSE|SCE_PASS_SPEC|SCE_PASS_SHADOW)) {
+	if (passflag & (SCE_PASS_COMBINED|SCE_PASS_DIFFUSE|SCE_PASS_SPEC|SCE_PASS_SHADOW)) {
 		GroupObject *go;
 		ListBase *lights;
 		LampRen *lar;
 		
 		lights= get_lights(shi);
-		for(go=lights->first; go; go= go->next) {
+		for (go=lights->first; go; go= go->next) {
 			lar= go->lampren;
-			if(lar==NULL) continue;
+			if (lar==NULL) continue;
 			
 			/* yafray: ignore shading by photonlights, not used in Blender */
 			if (lar->type==LA_YF_PHOTON) continue;
 			
 			/* test for lamp layer */
-			if(lar->mode & LA_LAYER) if((lar->lay & shi->obi->lay)==0) continue;
-			if((lar->lay & shi->lay)==0) continue;
+			if (lar->mode & LA_LAYER) if ((lar->lay & shi->obi->lay)==0) continue;
+			if ((lar->lay & shi->lay)==0) continue;
 			
 			/* accumulates in shr->diff and shr->spec and shr->shad (diffuse with shadow!) */
 			shade_one_light(lar, shi, shr, passflag);
 		}
 
-		/*this check is to prevent only shadow lamps from producing negative
-		  colors.*/
+		/* this check is to prevent only shadow lamps from producing negative
+		 * colors.*/
 		if (shr->spec[0] < 0) shr->spec[0] = 0;
 		if (shr->spec[1] < 0) shr->spec[1] = 0;
 		if (shr->spec[2] < 0) shr->spec[2] = 0;
@@ -1775,18 +1777,18 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
 		if (shr->shad[1] < 0) shr->shad[1] = 0;
 		if (shr->shad[2] < 0) shr->shad[2] = 0;
 						
-		if(ma->sss_flag & MA_DIFF_SSS) {
+		if (ma->sss_flag & MA_DIFF_SSS) {
 			float sss[3], col[3], invalpha, texfac= ma->sss_texfac;
 
 			/* this will return false in the preprocess stage */
-			if(sample_sss(&R, ma, shi->co, sss)) {
+			if (sample_sss(&R, ma, shi->co, sss)) {
 				invalpha= (shr->col[3] > FLT_EPSILON)? 1.0f/shr->col[3]: 1.0f;
 
-				if(texfac==0.0f) {
+				if (texfac==0.0f) {
 					copy_v3_v3(col, shr->col);
 					mul_v3_fl(col, invalpha);
 				}
-				else if(texfac==1.0f) {
+				else if (texfac==1.0f) {
 					col[0]= col[1]= col[2]= 1.0f;
 					mul_v3_fl(col, invalpha);
 				}
@@ -1802,7 +1804,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
 				shr->diff[1]= sss[1]*col[1];
 				shr->diff[2]= sss[2]*col[2];
 
-				if(shi->combinedflag & SCE_PASS_SHADOW)	{
+				if (shi->combinedflag & SCE_PASS_SHADOW)	{
 					shr->shad[0]= shr->diff[0];
 					shr->shad[1]= shr->diff[1];
 					shr->shad[2]= shr->diff[2];
@@ -1810,63 +1812,63 @@ 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);
 			
 		/* calculate shadow pass, we use a multiplication mask */
 		/* if diff = 0,0,0 it doesn't matter what the shadow pass is, so leave it as is */
-		if(passflag & SCE_PASS_SHADOW && !(shr->diff[0]==0.0f && shr->diff[1]==0.0f && shr->diff[2]==0.0f)) {
-			if(shr->diff[0]!=0.0f) shr->shad[0]= shr->shad[0]/shr->diff[0];
+		if (passflag & SCE_PASS_SHADOW && !(shr->diff[0]==0.0f && shr->diff[1]==0.0f && shr->diff[2]==0.0f)) {
+			if (shr->diff[0]!=0.0f) shr->shad[0]= shr->shad[0]/shr->diff[0];
 			/* can't determine proper shadow from shad/diff (0/0), so use shadow intensity */
-			else if(shr->shad[0]==0.0f) shr->shad[0]= shr->shad[3];
+			else if (shr->shad[0]==0.0f) shr->shad[0]= shr->shad[3];
 
-			if(shr->diff[1]!=0.0f) shr->shad[1]= shr->shad[1]/shr->diff[1];
-			else if(shr->shad[1]==0.0f) shr->shad[1]= shr->shad[3];
+			if (shr->diff[1]!=0.0f) shr->shad[1]= shr->shad[1]/shr->diff[1];
+			else if (shr->shad[1]==0.0f) shr->shad[1]= shr->shad[3];
 
-			if(shr->diff[2]!=0.0f) shr->shad[2]= shr->shad[2]/shr->diff[2];
-			else if(shr->shad[2]==0.0f) shr->shad[2]= shr->shad[3];
+			if (shr->diff[2]!=0.0f) shr->shad[2]= shr->shad[2]/shr->diff[2];
+			else if (shr->shad[2]==0.0f) shr->shad[2]= shr->shad[3];
 		}
 		
 		/* exposure correction */
-		if((R.wrld.exp!=0.0f || R.wrld.range!=1.0f) && !R.sss_points) {
+		if ((R.wrld.exp!=0.0f || R.wrld.range!=1.0f) && !R.sss_points) {
 			wrld_exposure_correct(shr->combined);	/* has no spec! */
 			wrld_exposure_correct(shr->spec);
 		}
 	}
 	
 	/* alpha in end, spec can influence it */
-	if(passflag & (SCE_PASS_COMBINED)) {
-		if((ma->fresnel_tra!=0.0f) && (shi->mode & MA_TRANSP))
+	if (passflag & (SCE_PASS_COMBINED)) {
+		if ((ma->fresnel_tra!=0.0f) && (shi->mode & MA_TRANSP))
 			shi->alpha*= fresnel_fac(shi->view, shi->vn, ma->fresnel_tra_i, ma->fresnel_tra);
 			
 		/* note: shi->mode! */
-		if(shi->mode & MA_TRANSP && (shi->mode & (MA_ZTRANSP|MA_RAYTRANSP))) {
-			if(shi->spectra!=0.0f) {
+		if (shi->mode & MA_TRANSP && (shi->mode & (MA_ZTRANSP|MA_RAYTRANSP))) {
+			if (shi->spectra!=0.0f) {
 				float t = MAX3(shr->spec[0], shr->spec[1], shr->spec[2]);
 				t *= shi->spectra;
-				if(t>1.0f) t= 1.0f;
+				if (t>1.0f) t= 1.0f;
 				shi->alpha= (1.0f-t)*shi->alpha+t;
 			}
 		}
 	}
 	shr->alpha= shi->alpha;
 	
-	/* from now stuff everything in shr->combined: ambient, AO, radio, ramps, exposure */
-	if(!(ma->sss_flag & MA_DIFF_SSS) || !sss_pass_done(&R, ma)) {
-		if(R.r.mode & R_SHADOW) {
+	/* from now stuff everything in shr->combined: ambient, AO, ramps, exposure */
+	if (!(ma->sss_flag & MA_DIFF_SSS) || !sss_pass_done(&R, ma)) {
+		if (R.r.mode & R_SHADOW) {
 			/* add AO in combined? */
-			if(R.wrld.mode & WO_AMB_OCC)
-				if(shi->combinedflag & SCE_PASS_AO)
+			if (R.wrld.mode & WO_AMB_OCC)
+				if (shi->combinedflag & SCE_PASS_AO)
 					ambient_occlusion_apply(shi, shr);
 
-			if(R.wrld.mode & WO_ENV_LIGHT)
-				if(shi->combinedflag & SCE_PASS_ENVIRONMENT)
+			if (R.wrld.mode & WO_ENV_LIGHT)
+				if (shi->combinedflag & SCE_PASS_ENVIRONMENT)
 					environment_lighting_apply(shi, shr);
 
-			if(R.wrld.mode & WO_INDIRECT_LIGHT)
-				if(shi->combinedflag & SCE_PASS_INDIRECT)
+			if (R.wrld.mode & WO_INDIRECT_LIGHT)
+				if (shi->combinedflag & SCE_PASS_INDIRECT)
 					indirect_lighting_apply(shi, shr);
 		}
 		
@@ -1874,36 +1876,36 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
 		shr->combined[1]+= shi->ambg;
 		shr->combined[2]+= shi->ambb;
 		
-		if(ma->mode & MA_RAMP_COL) ramp_diffuse_result(shr->combined, shi);
+		if (ma->mode & MA_RAMP_COL) ramp_diffuse_result(shr->combined, shi);
 	}
 
-	if(ma->mode & MA_RAMP_SPEC) ramp_spec_result(shr->spec, shi);
+	if (ma->mode & MA_RAMP_SPEC) ramp_spec_result(shr->spec, shi);
 	
 	/* refcol is for envmap only */
-	if(shi->refcol[0]!=0.0f) {
+	if (shi->refcol[0]!=0.0f) {
 		float result[3];
 		
 		result[0]= shi->mirr*shi->refcol[1] + (1.0f - shi->mirr*shi->refcol[0])*shr->combined[0];
 		result[1]= shi->mirg*shi->refcol[2] + (1.0f - shi->mirg*shi->refcol[0])*shr->combined[1];
 		result[2]= shi->mirb*shi->refcol[3] + (1.0f - shi->mirb*shi->refcol[0])*shr->combined[2];
 		
-		if(passflag & SCE_PASS_REFLECT)
+		if (passflag & SCE_PASS_REFLECT)
 			sub_v3_v3v3(shr->refl, result, shr->combined);
 		
-		if(shi->combinedflag & SCE_PASS_REFLECT)
+		if (shi->combinedflag & SCE_PASS_REFLECT)
 			copy_v3_v3(shr->combined, result);
 			
 	}
 	
 	/* and add emit and spec */
-	if(shi->combinedflag & SCE_PASS_EMIT)
+	if (shi->combinedflag & SCE_PASS_EMIT)
 		add_v3_v3(shr->combined, shr->emit);
-	if(shi->combinedflag & SCE_PASS_SPEC)
+	if (shi->combinedflag & SCE_PASS_SPEC)
 		add_v3_v3(shr->combined, shr->spec);
 	
 	/* modulate by the object color */
-	if((ma->shade_flag & MA_OBCOLOR) && shi->obr->ob) {
-		if(!(ma->sss_flag & MA_DIFF_SSS) || !sss_pass_done(&R, ma)) {
+	if ((ma->shade_flag & MA_OBCOLOR) && shi->obr->ob) {
+		if (!(ma->sss_flag & MA_DIFF_SSS) || !sss_pass_done(&R, ma)) {
 			float obcol[4];
 
 			copy_v4_v4(obcol, shi->obr->ob->col);
diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c
index 4192aaf..b6eccc3 100644
--- a/source/blender/render/intern/source/sss.c
+++ b/source/blender/render/intern/source/sss.c
@@ -32,16 +32,16 @@
 
 
 /* Possible Improvements:
-   - add fresnel terms
-   - adapt Rd table to scale, now with small scale there are a lot of misses?
-   - possible interesting method: perform sss on all samples in the tree,
-	 and then use those values interpolated somehow later. can also do this
-	 filtering on demand for speed. since we are doing things in screen
-	 space now there is an exact correspondence
-   - avoid duplicate shading (filtering points in advance, irradiance cache
-	 like lookup?)
-   - lower resolution samples
-*/
+ * - add fresnel terms
+ * - adapt Rd table to scale, now with small scale there are a lot of misses?
+ * - possible interesting method: perform sss on all samples in the tree,
+ *   and then use those values interpolated somehow later. can also do this
+ *   filtering on demand for speed. since we are doing things in screen
+ *   space now there is an exact correspondence
+ * - avoid duplicate shading (filtering points in advance, irradiance cache
+ *   like lookup?)
+ * - lower resolution samples
+ */
 
 #include <math.h>
 #include <string.h>
@@ -77,16 +77,14 @@
 #include "sss.h"
 #include "zbuf.h"
 
-extern Render R; // meh
-
 /* Generic Multiple Scattering API */
 
 /* Relevant papers:
-	[1] A Practical Model for Subsurface Light Transport
-	[2] A Rapid Hierarchical Rendering Technique for Translucent Materials
-	[3] Efficient Rendering of Local Subsurface Scattering
-	[4] Implementing a skin BSSRDF (or several...)
-*/
+ * [1] A Practical Model for Subsurface Light Transport
+ * [2] A Rapid Hierarchical Rendering Technique for Translucent Materials
+ * [3] Efficient Rendering of Local Subsurface Scattering
+ * [4] Implementing a skin BSSRDF (or several...)
+ */
 
 /* Defines */
 
@@ -164,7 +162,7 @@ typedef struct ScatterResult {
 } ScatterResult;
 
 /* Functions for BSSRDF reparametrization in to more intuitive parameters,
-   see [2] section 4 for more info. */
+ * see [2] section 4 for more info. */
 
 static float f_Rd(float alpha_, float A, float ro)
 {
@@ -182,30 +180,30 @@ static float compute_reduced_albedo(ScatterSettings *ss)
 	int i;
 
 	/* use secant method to compute reduced albedo using Rd function inverse
-	   with a given reflectance */
+	 * with a given reflectance */
 	fxn= f_Rd(xn, ss->A, ss->ro);
 	fxn_1= f_Rd(xn_1, ss->A, ss->ro);
 
-	for(i= 0; i < max_iteration_count; i++) {
+	for (i= 0; i < max_iteration_count; i++) {
 		fsub= (fxn - fxn_1);
-		if(fabsf(fsub) < tolerance)
+		if (fabsf(fsub) < tolerance)
 			break;
 		d= ((xn - xn_1)/fsub)*fxn;
-		if(fabsf(d) < tolerance)
+		if (fabsf(d) < tolerance)
 			break;
 
 		xn_1= xn;
 		fxn_1= fxn;
 		xn= xn - d;
 
-		if(xn > 1.0f) xn= 1.0f;
-		if(xn_1 > 1.0f) xn_1= 1.0f;
+		if (xn > 1.0f) xn= 1.0f;
+		if (xn_1 > 1.0f) xn_1= 1.0f;
 		
 		fxn= f_Rd(xn, ss->A, ss->ro);
 	}
 
 	/* avoid division by zero later */
-	if(xn <= 0.0f)
+	if (xn <= 0.0f)
 		xn= 0.00001f;
 
 	return xn;
@@ -232,25 +230,25 @@ static float Rd(ScatterSettings *ss, float r)
 }
 
 /* table lookups for Rd. this avoids expensive exp calls. we use two
-   separate tables as well for lower and higher numbers to improve
-   precision, since the number are poorly distributed because we do
-   a lookup with the squared distance for smaller distances, saving
-   another sqrt. */
+ * separate tables as well for lower and higher numbers to improve
+ * precision, since the number are poorly distributed because we do
+ * a lookup with the squared distance for smaller distances, saving
+ * another sqrt. */
 
 static void approximate_Rd_rgb(ScatterSettings **ss, float rr, float *rd)
 {
 	float indexf, t, idxf;
 	int index;
 
-	if(rr > (RD_TABLE_RANGE_2*RD_TABLE_RANGE_2));
-	else if(rr > RD_TABLE_RANGE) {
+	if (rr > (RD_TABLE_RANGE_2*RD_TABLE_RANGE_2));
+	else if (rr > RD_TABLE_RANGE) {
 		rr= sqrt(rr);
 		indexf= rr*(RD_TABLE_SIZE/RD_TABLE_RANGE_2);
 		index= (int)indexf;
 		idxf= (float)index;
 		t= indexf - idxf;
 
-		if(index >= 0 && index < RD_TABLE_SIZE) {
+		if (index >= 0 && index < RD_TABLE_SIZE) {
 			rd[0]= (ss[0]->tableRd2[index]*(1-t) + ss[0]->tableRd2[index+1]*t);
 			rd[1]= (ss[1]->tableRd2[index]*(1-t) + ss[1]->tableRd2[index+1]*t);
 			rd[2]= (ss[2]->tableRd2[index]*(1-t) + ss[2]->tableRd2[index+1]*t);
@@ -263,7 +261,7 @@ static void approximate_Rd_rgb(ScatterSettings **ss, float rr, float *rd)
 		idxf= (float)index;
 		t= indexf - idxf;
 
-		if(index >= 0 && index < RD_TABLE_SIZE) {
+		if (index >= 0 && index < RD_TABLE_SIZE) {
 			rd[0]= (ss[0]->tableRd[index]*(1-t) + ss[0]->tableRd[index+1]*t);
 			rd[1]= (ss[1]->tableRd[index]*(1-t) + ss[1]->tableRd[index+1]*t);
 			rd[2]= (ss[2]->tableRd[index]*(1-t) + ss[2]->tableRd[index+1]*t);
@@ -285,14 +283,14 @@ static void build_Rd_table(ScatterSettings *ss)
 	ss->tableRd= MEM_mallocN(sizeof(float)*size, "scatterTableRd");
 	ss->tableRd2= MEM_mallocN(sizeof(float)*size, "scatterTableRd");
 
-	for(i= 0; i < size; i++) {
+	for (i= 0; i < size; i++) {
 		r= i*(RD_TABLE_RANGE/RD_TABLE_SIZE);
-		/*if(r < ss->invsigma_t_*ss->invsigma_t_)
+		/*if (r < ss->invsigma_t_*ss->invsigma_t_)
 			r= ss->invsigma_t_*ss->invsigma_t_;*/
 		ss->tableRd[i]= Rd(ss, sqrt(r));
 
 		r= i*(RD_TABLE_RANGE_2/RD_TABLE_SIZE);
-		/*if(r < ss->invsigma_t_)
+		/*if (r < ss->invsigma_t_)
 			r= ss->invsigma_t_;*/
 		ss->tableRd2[i]= Rd(ss, r);
 	}
@@ -355,7 +353,7 @@ static void add_radiance(ScatterTree *tree, float *frontrad, float *backrad, flo
 
 	approximate_Rd_rgb(tree->ss, rr, rd);
 
-	if(frontrad && area) {
+	if (frontrad && area) {
 		frontrd[0] = rd[0]*area;
 		frontrd[1] = rd[1]*area;
 		frontrd[2] = rd[2]*area;
@@ -368,7 +366,7 @@ static void add_radiance(ScatterTree *tree, float *frontrad, float *backrad, flo
 		result->rdsum[1] += frontrd[1];
 		result->rdsum[2] += frontrd[2];
 	}
-	if(backrad && backarea) {
+	if (backrad && backarea) {
 		backrd[0] = rd[0]*backarea;
 		backrd[1] = rd[1]*backarea;
 		backrd[2] = rd[2]*backarea;
@@ -388,15 +386,15 @@ static void traverse_octree(ScatterTree *tree, ScatterNode *node, float *co, int
 	float sub[3], dist;
 	int i, index = 0;
 
-	if(node->totpoint > 0) {
+	if (node->totpoint > 0) {
 		/* leaf - add radiance from all samples */
-		for(i=0; i<node->totpoint; i++) {
+		for (i=0; i<node->totpoint; i++) {
 			ScatterPoint *p= &node->points[i];
 
 			sub_v3_v3v3(sub, co, p->co);
 			dist= dot_v3v3(sub, sub);
 
-			if(p->back)
+			if (p->back)
 				add_radiance(tree, NULL, p->rad, 0.0f, p->area, dist, result);
 			else
 				add_radiance(tree, p->rad, NULL, p->area, 0.0f, dist, result);
@@ -407,11 +405,11 @@ static void traverse_octree(ScatterTree *tree, ScatterNode *node, float *co, int
 		if (self)
 			index = SUBNODE_INDEX(co, node->split);
 
-		for(i=0; i<8; i++) {
-			if(node->child[i]) {
+		for (i=0; i<8; i++) {
+			if (node->child[i]) {
 				ScatterNode *subnode= node->child[i];
 
-				if(self && index == i) {
+				if (self && index == i) {
 					/* always traverse node containing the point */
 					traverse_octree(tree, subnode, co, 1, result);
 				}
@@ -421,7 +419,7 @@ static void traverse_octree(ScatterTree *tree, ScatterNode *node, float *co, int
 					dist= dot_v3v3(sub, sub);
 
 					/* actually area/dist > error, but this avoids division */
-					if(subnode->area+subnode->backarea>tree->error*dist) {
+					if (subnode->area+subnode->backarea>tree->error*dist) {
 						traverse_octree(tree, subnode, co, 0, result);
 					}
 					else {
@@ -444,10 +442,10 @@ static void compute_radiance(ScatterTree *tree, float *co, float *rad)
 	traverse_octree(tree, tree->root, co, 1, &result);
 
 	/* the original paper doesn't do this, but we normalize over the
-	   sampled area and multiply with the reflectance. this is because
-	   our point samples are incomplete, there are no samples on parts
-	   of the mesh not visible from the camera. this can not only make
-	   it darker, but also lead to ugly color shifts */
+	 * sampled area and multiply with the reflectance. this is because
+	 * our point samples are incomplete, there are no samples on parts
+	 * of the mesh not visible from the camera. this can not only make
+	 * it darker, but also lead to ugly color shifts */
 
 	mul_v3_fl(result.rad, tree->ss[0]->frontweight);
 	mul_v3_fl(result.backrad, tree->ss[0]->backweight);
@@ -458,13 +456,13 @@ static void compute_radiance(ScatterTree *tree, float *co, float *rad)
 	copy_v3_v3(rdsum, result.rdsum);
 	add_v3_v3v3(backrdsum, result.rdsum, result.backrdsum);
 
-	if(rdsum[0] > 1e-16f) rad[0]= tree->ss[0]->color*rad[0]/rdsum[0];
-	if(rdsum[1] > 1e-16f) rad[1]= tree->ss[1]->color*rad[1]/rdsum[1];
-	if(rdsum[2] > 1e-16f) rad[2]= tree->ss[2]->color*rad[2]/rdsum[2];
+	if (rdsum[0] > 1e-16f) rad[0]= tree->ss[0]->color*rad[0]/rdsum[0];
+	if (rdsum[1] > 1e-16f) rad[1]= tree->ss[1]->color*rad[1]/rdsum[1];
+	if (rdsum[2] > 1e-16f) rad[2]= tree->ss[2]->color*rad[2]/rdsum[2];
 
-	if(backrdsum[0] > 1e-16f) backrad[0]= tree->ss[0]->color*backrad[0]/backrdsum[0];
-	if(backrdsum[1] > 1e-16f) backrad[1]= tree->ss[1]->color*backrad[1]/backrdsum[1];
-	if(backrdsum[2] > 1e-16f) backrad[2]= tree->ss[2]->color*backrad[2]/backrdsum[2];
+	if (backrdsum[0] > 1e-16f) backrad[0]= tree->ss[0]->color*backrad[0]/backrdsum[0];
+	if (backrdsum[1] > 1e-16f) backrad[1]= tree->ss[1]->color*backrad[1]/backrdsum[1];
+	if (backrdsum[2] > 1e-16f) backrad[2]= tree->ss[2]->color*backrad[2]/backrdsum[2];
 
 	rad[0]= MAX2(rad[0], backrad[0]);
 	rad[1]= MAX2(rad[1], backrad[1]);
@@ -484,8 +482,8 @@ static void sum_leaf_radiance(ScatterTree *UNUSED(tree), ScatterNode *node)
 	node->backrad[0]= node->backrad[1]= node->backrad[2]= 0.0;
 
 	/* compute total rad, rad weighted average position,
-	   and total area */
-	for(i=0; i<node->totpoint; i++) {
+	 * and total area */
+	for (i=0; i<node->totpoint; i++) {
 		p= &node->points[i];
 
 		rad= p->area*fabsf(p->rad[0] + p->rad[1] + p->rad[2]);
@@ -495,7 +493,7 @@ static void sum_leaf_radiance(ScatterTree *UNUSED(tree), ScatterNode *node)
 		node->co[1] += rad*p->co[1];
 		node->co[2] += rad*p->co[2];
 
-		if(p->back) {
+		if (p->back) {
 			node->backrad[0] += p->rad[0]*p->area;
 			node->backrad[1] += p->rad[1]*p->area;
 			node->backrad[2] += p->rad[2]*p->area;
@@ -511,20 +509,20 @@ static void sum_leaf_radiance(ScatterTree *UNUSED(tree), ScatterNode *node)
 		}
 	}
 
-	if(node->area > 1e-16f) {
+	if (node->area > 1e-16f) {
 		inv= 1.0f/node->area;
 		node->rad[0] *= inv;
 		node->rad[1] *= inv;
 		node->rad[2] *= inv;
 	}
-	if(node->backarea > 1e-16f) {
+	if (node->backarea > 1e-16f) {
 		inv= 1.0f/node->backarea;
 		node->backrad[0] *= inv;
 		node->backrad[1] *= inv;
 		node->backrad[2] *= inv;
 	}
 
-	if(totrad > 1e-16f) {
+	if (totrad > 1e-16f) {
 		inv= 1.0f/totrad;
 		node->co[0] *= inv;
 		node->co[1] *= inv;
@@ -532,8 +530,8 @@ static void sum_leaf_radiance(ScatterTree *UNUSED(tree), ScatterNode *node)
 	}
 	else {
 		/* make sure that if radiance is 0.0f, we still have these points in
-		   the tree at a good position, they count for rdsum too */
-		for(i=0; i<node->totpoint; i++) {
+		 * the tree at a good position, they count for rdsum too */
+		for (i=0; i<node->totpoint; i++) {
 			p= &node->points[i];
 
 			node->co[0] += p->co[0];
@@ -558,9 +556,9 @@ static void sum_branch_radiance(ScatterTree *UNUSED(tree), ScatterNode *node)
 	node->backrad[0]= node->backrad[1]= node->backrad[2]= 0.0;
 
 	/* compute total rad, rad weighted average position,
-	   and total area */
-	for(i=0; i<8; i++) {
-		if(node->child[i] == NULL)
+	 * and total area */
+	for (i=0; i<8; i++) {
+		if (node->child[i] == NULL)
 			continue;
 
 		subnode= node->child[i];
@@ -585,20 +583,20 @@ static void sum_branch_radiance(ScatterTree *UNUSED(tree), ScatterNode *node)
 		node->backarea += subnode->backarea;
 	}
 
-	if(node->area > 1e-16f) {
+	if (node->area > 1e-16f) {
 		inv= 1.0f/node->area;
 		node->rad[0] *= inv;
 		node->rad[1] *= inv;
 		node->rad[2] *= inv;
 	}
-	if(node->backarea > 1e-16f) {
+	if (node->backarea > 1e-16f) {
 		inv= 1.0f/node->backarea;
 		node->backrad[0] *= inv;
 		node->backrad[1] *= inv;
 		node->backrad[2] *= inv;
 	}
 
-	if(totrad > 1e-16f) {
+	if (totrad > 1e-16f) {
 		inv= 1.0f/totrad;
 		node->co[0] *= inv;
 		node->co[1] *= inv;
@@ -606,11 +604,11 @@ static void sum_branch_radiance(ScatterTree *UNUSED(tree), ScatterNode *node)
 	}
 	else {
 		/* make sure that if radiance is 0.0f, we still have these points in
-		   the tree at a good position, they count for rdsum too */
+		 * the tree at a good position, they count for rdsum too */
 		totnode= 0;
 
-		for(i=0; i<8; i++) {
-			if(node->child[i]) {
+		for (i=0; i<8; i++) {
+			if (node->child[i]) {
 				subnode= node->child[i];
 
 				node->co[0] += subnode->co[0];
@@ -629,14 +627,14 @@ static void sum_branch_radiance(ScatterTree *UNUSED(tree), ScatterNode *node)
 
 static void sum_radiance(ScatterTree *tree, ScatterNode *node)
 {
-	if(node->totpoint > 0) {
+	if (node->totpoint > 0) {
 		sum_leaf_radiance(tree, node);
 	}
 	else {
 		int i;
 
-		for(i=0; i<8; i++)
-			if(node->child[i])
+		for (i=0; i<8; i++)
+			if (node->child[i])
 				sum_radiance(tree, node->child[i]);
 
 		sum_branch_radiance(tree, node);
@@ -660,8 +658,8 @@ static void create_octree_node(ScatterTree *tree, ScatterNode *node, float *mid,
 	float submid[3], subsize[3];
 
 	/* stopping condition */
-	if(node->totpoint <= MAX_OCTREE_NODE_POINTS || depth == MAX_OCTREE_DEPTH) {
-		for(i=0; i<node->totpoint; i++)
+	if (node->totpoint <= MAX_OCTREE_NODE_POINTS || depth == MAX_OCTREE_DEPTH) {
+		for (i=0; i<node->totpoint; i++)
 			node->points[i]= *(refpoints[i]);
 
 		return;
@@ -679,40 +677,40 @@ static void create_octree_node(ScatterTree *tree, ScatterNode *node, float *mid,
 	memset(noffset, 0, sizeof(noffset));
 
 	/* count points in subnodes */
-	for(i=0; i<node->totpoint; i++) {
+	for (i=0; i<node->totpoint; i++) {
 		index= SUBNODE_INDEX(refpoints[i]->co, node->split);
 		tmppoints[i]= refpoints[i];
 		nsize[index]++;
 	}
 
 	/* here we check if only one subnode is used. if this is the case, we don't
-	   create a new node, but rather call this function again, with different 
-	   size and middle position for the same node. */
-	for(usedi=0, usednodes=0, i=0; i<8; i++) {
-		if(nsize[i]) {
+	 * create a new node, but rather call this function again, with different
+	 * size and middle position for the same node. */
+	for (usedi=0, usednodes=0, i=0; i<8; i++) {
+		if (nsize[i]) {
 			usednodes++;
 			usedi = i;
 		}
-		if(i != 0)
+		if (i != 0)
 			noffset[i]= noffset[i-1]+nsize[i-1];
 	}
 	
-	if(usednodes<=1) {
+	if (usednodes<=1) {
 		subnode_middle(usedi, mid, subsize, submid);
 		create_octree_node(tree, node, submid, subsize, refpoints, depth+1);
 		return;
 	}
 
 	/* reorder refpoints by subnode */
-	for(i=0; i<node->totpoint; i++) {
+	for (i=0; i<node->totpoint; i++) {
 		index= SUBNODE_INDEX(tmppoints[i]->co, node->split);
 		refpoints[noffset[index]]= tmppoints[i];
 		noffset[index]++;
 	}
 
 	/* create subnodes */
-	for(subco=0, i=0; i<8; subco+=nsize[i], i++) {
-		if(nsize[i] > 0) {
+	for (subco=0, i=0; i<8; subco+=nsize[i], i++) {
+		if (nsize[i] > 0) {
 			subnode= BLI_memarena_alloc(tree->arena, sizeof(ScatterNode));
 			node->child[i]= subnode;
 			subnode->points= node->points + subco;
@@ -760,7 +758,7 @@ ScatterTree *scatter_tree_new(ScatterSettings *ss[3], float scale, float error,
 	/* build points */
 	INIT_MINMAX(tree->min, tree->max);
 
-	for(i=0; i<totpoint; i++) {
+	for (i=0; i<totpoint; i++) {
 		copy_v3_v3(points[i].co, co[i]);
 		copy_v3_v3(points[i].rad, color[i]);
 		points[i].area= fabsf(area[i])/(tree->scale*tree->scale);
@@ -859,13 +857,13 @@ static void sss_create_tree_mat(Render *re, Material *mat)
 	float (*co)[3] = NULL, (*color)[3] = NULL, *area = NULL;
 	int totpoint = 0, osa, osaflag, partsdone;
 
-	if(re->test_break(re->tbh))
+	if (re->test_break(re->tbh))
 		return;
 	
 	points.first= points.last= NULL;
 
 	/* TODO: this is getting a bit ugly, copying all those variables and
-	   setting them back, maybe we need to create our own Render? */
+	 * setting them back, maybe we need to create our own Render? */
 
 	/* do SSS preprocessing render */
 	BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
@@ -880,14 +878,14 @@ static void sss_create_tree_mat(Render *re, Material *mat)
 	re->sss_mat= mat;
 	re->i.partsdone= 0;
 
-	if(!(re->r.scemode & R_PREVIEWBUTS))
+	if (!(re->r.scemode & R_PREVIEWBUTS))
 		re->result= NULL;
 	BLI_rw_mutex_unlock(&re->resultmutex);
 
 	RE_TileProcessor(re);
 	
 	BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
-	if(!(re->r.scemode & R_PREVIEWBUTS)) {
+	if (!(re->r.scemode & R_PREVIEWBUTS)) {
 		RE_FreeRenderResult(re->result);
 		re->result= rr;
 	}
@@ -900,19 +898,19 @@ static void sss_create_tree_mat(Render *re, Material *mat)
 	if (osaflag) re->r.mode |= R_OSA;
 
 	/* no points? no tree */
-	if(!points.first)
+	if (!points.first)
 		return;
 
 	/* merge points together into a single buffer */
-	if(!re->test_break(re->tbh)) {
-		for(totpoint=0, p=points.first; p; p=p->next)
+	if (!re->test_break(re->tbh)) {
+		for (totpoint=0, p=points.first; p; p=p->next)
 			totpoint += p->totpoint;
 		
 		co= MEM_mallocN(sizeof(*co)*totpoint, "SSSCo");
 		color= MEM_mallocN(sizeof(*color)*totpoint, "SSSColor");
 		area= MEM_mallocN(sizeof(*area)*totpoint, "SSSArea");
 
-		for(totpoint=0, p=points.first; p; p=p->next) {
+		for (totpoint=0, p=points.first; p; p=p->next) {
 			memcpy(co+totpoint, p->co, sizeof(*co)*p->totpoint);
 			memcpy(color+totpoint, p->color, sizeof(*color)*p->totpoint);
 			memcpy(area+totpoint, p->area, sizeof(*area)*p->totpoint);
@@ -921,7 +919,7 @@ static void sss_create_tree_mat(Render *re, Material *mat)
 	}
 
 	/* free points */
-	for(p=points.first; p; p=p->next) {
+	for (p=points.first; p; p=p->next) {
 		MEM_freeN(p->co);
 		MEM_freeN(p->color);
 		MEM_freeN(p->area);
@@ -929,7 +927,7 @@ static void sss_create_tree_mat(Render *re, Material *mat)
 	BLI_freelistN(&points);
 
 	/* build tree */
-	if(!re->test_break(re->tbh)) {
+	if (!re->test_break(re->tbh)) {
 		SSSData *sss= MEM_callocN(sizeof(*sss), "SSSData");
 		float ior= mat->sss_ior, cfac= mat->sss_colfac;
 		float *radius= mat->sss_radius;
@@ -937,7 +935,7 @@ static void sss_create_tree_mat(Render *re, Material *mat)
 		float error = mat->sss_error;
 
 		error= get_render_aosss_error(&re->r, error);
-		if((re->r.scemode & R_PREVIEWBUTS) && error < 0.5f)
+		if ((re->r.scemode & R_PREVIEWBUTS) && error < 0.5f)
 			error= 0.5f;
 		
 		sss->ss[0]= scatter_settings_new(mat->sss_col[0], radius[0], ior, cfac, fw, bw);
@@ -965,7 +963,7 @@ void sss_add_points(Render *re, float (*co)[3], float (*color)[3], float *area,
 {
 	SSSPoints *p;
 	
-	if(totpoint > 0) {
+	if (totpoint > 0) {
 		p= MEM_callocN(sizeof(SSSPoints), "SSSPoints");
 
 		p->co= co;
@@ -999,15 +997,15 @@ void make_sss_tree(Render *re)
 	re->i.infostr= "SSS preprocessing";
 	re->stats_draw(re->sdh, &re->i);
 	
-	for(mat= re->main->mat.first; mat; mat= mat->id.next)
-		if(mat->id.us && (mat->flag & MA_IS_USED) && (mat->sss_flag & MA_DIFF_SSS))
+	for (mat= re->main->mat.first; mat; mat= mat->id.next)
+		if (mat->id.us && (mat->flag & MA_IS_USED) && (mat->sss_flag & MA_DIFF_SSS))
 			sss_create_tree_mat(re, mat);
 	
 	/* XXX preview exception */
 	/* localizing preview render data is not fun for node trees :( */
-	if(re->main!=G.main) {
-		for(mat= G.main->mat.first; mat; mat= mat->id.next)
-			if(mat->id.us && (mat->flag & MA_IS_USED) && (mat->sss_flag & MA_DIFF_SSS))
+	if (re->main!=G.main) {
+		for (mat= G.main->mat.first; mat; mat= mat->id.next)
+			if (mat->id.us && (mat->flag & MA_IS_USED) && (mat->sss_flag & MA_DIFF_SSS))
 				sss_create_tree_mat(re, mat);
 	}
 	
@@ -1015,10 +1013,10 @@ void make_sss_tree(Render *re)
 
 void free_sss(Render *re)
 {
-	if(re->sss_hash) {
+	if (re->sss_hash) {
 		GHashIterator *it= BLI_ghashIterator_new(re->sss_hash);
 
-		while(!BLI_ghashIterator_isDone(it)) {
+		while (!BLI_ghashIterator_isDone(it)) {
 			sss_free_tree(BLI_ghashIterator_getValue(it));
 			BLI_ghashIterator_step(it);
 		}
@@ -1031,10 +1029,10 @@ void free_sss(Render *re)
 
 int sample_sss(Render *re, Material *mat, float *co, float *color)
 {
-	if(re->sss_hash) {
+	if (re->sss_hash) {
 		SSSData *sss= BLI_ghash_lookup(re->sss_hash, mat);
 
-		if(sss) {
+		if (sss) {
 			scatter_tree_sample(sss->tree, co, color);
 			return 1;
 		}
diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c
index 89f7441..ea6b099 100644
--- a/source/blender/render/intern/source/strand.c
+++ b/source/blender/render/intern/source/strand.c
@@ -74,8 +74,8 @@ static float strand_eval_width(Material *ma, float strandco)
 
 	strandco= 0.5f*(strandco + 1.0f);
 
-	if(ma->strand_ease!=0.0f) {
-		if(ma->strand_ease<0.0f)
+	if (ma->strand_ease!=0.0f) {
+		if (ma->strand_ease<0.0f)
 			fac= pow(strandco, 1.0f+ma->strand_ease);
 		else
 			fac= pow(strandco, 1.0f/(1.0f-ma->strand_ease));
@@ -103,27 +103,27 @@ void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint)
 	copy_v3_v3(p[2], sseg->v[2]->co);
 	copy_v3_v3(p[3], sseg->v[3]->co);
 
-	if(sseg->obi->flag & R_TRANSFORMED) {
+	if (sseg->obi->flag & R_TRANSFORMED) {
 		mul_m4_v3(sseg->obi->mat, p[0]);
 		mul_m4_v3(sseg->obi->mat, p[1]);
 		mul_m4_v3(sseg->obi->mat, p[2]);
 		mul_m4_v3(sseg->obi->mat, p[3]);
 	}
 
-	if(t == 0.0f) {
+	if (t == 0.0f) {
 		copy_v3_v3(spoint->co, p[1]);
 		spoint->strandco= sseg->v[1]->strandco;
 
 		spoint->dtstrandco= (sseg->v[2]->strandco - sseg->v[0]->strandco);
-		if(sseg->v[0] != sseg->v[1])
+		if (sseg->v[0] != sseg->v[1])
 			spoint->dtstrandco *= 0.5f;
 	}
-	else if(t == 1.0f) {
+	else if (t == 1.0f) {
 		copy_v3_v3(spoint->co, p[2]);
 		spoint->strandco= sseg->v[2]->strandco;
 
 		spoint->dtstrandco= (sseg->v[3]->strandco - sseg->v[1]->strandco);
-		if(sseg->v[3] != sseg->v[2])
+		if (sseg->v[3] != sseg->v[2])
 			spoint->dtstrandco *= 0.5f;
 	}
 	else {
@@ -157,17 +157,17 @@ void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint)
 	dy= strandbuf->winy*cross[1]*strandbuf->winmat[1][1]/w;
 	w= sqrt(dx*dx + dy*dy);
 
-	if(w > 0.0f) {
-		if(strandbuf->flag & R_STRAND_B_UNITS) {
+	if (w > 0.0f) {
+		if (strandbuf->flag & R_STRAND_B_UNITS) {
 			const float crosslen= len_v3(cross);
 			w= 2.0f*crosslen*strandbuf->minwidth/w;
 
-			if(spoint->width < w) {
+			if (spoint->width < w) {
 				spoint->alpha= spoint->width/w;
 				spoint->width= w;
 			}
 
-			if(simplify)
+			if (simplify)
 				/* squared because we only change width, not length */
 				spoint->width *= simplify[0]*simplify[0];
 
@@ -211,45 +211,45 @@ static void interpolate_shade_result(ShadeResult *shr1, ShadeResult *shr2, float
 
 	interpolate_vec4(shr1->combined, shr2->combined, t, negt, shr->combined);
 
-	if(addpassflag & SCE_PASS_VECTOR) {
+	if (addpassflag & SCE_PASS_VECTOR) {
 		interpolate_vec4(shr1->winspeed, shr2->winspeed, t, negt, shr->winspeed);
 	}
 	/* optim... */
-	if(addpassflag & ~(SCE_PASS_VECTOR)) {
-		if(addpassflag & SCE_PASS_Z)
+	if (addpassflag & ~(SCE_PASS_VECTOR)) {
+		if (addpassflag & SCE_PASS_Z)
 			interpolate_vec1(&shr1->z, &shr2->z, t, negt, &shr->z);
-		if(addpassflag & SCE_PASS_RGBA)
+		if (addpassflag & SCE_PASS_RGBA)
 			interpolate_vec4(shr1->col, shr2->col, t, negt, shr->col);
-		if(addpassflag & SCE_PASS_NORMAL) {
+		if (addpassflag & SCE_PASS_NORMAL) {
 			interpolate_vec3(shr1->nor, shr2->nor, t, negt, shr->nor);
 			normalize_v3(shr->nor);
 		}
-		if(addpassflag & SCE_PASS_EMIT)
+		if (addpassflag & SCE_PASS_EMIT)
 			interpolate_vec3(shr1->emit, shr2->emit, t, negt, shr->emit);
-		if(addpassflag & SCE_PASS_DIFFUSE)
+		if (addpassflag & SCE_PASS_DIFFUSE)
 			interpolate_vec3(shr1->diff, shr2->diff, t, negt, shr->diff);
-		if(addpassflag & SCE_PASS_SPEC)
+		if (addpassflag & SCE_PASS_SPEC)
 			interpolate_vec3(shr1->spec, shr2->spec, t, negt, shr->spec);
-		if(addpassflag & SCE_PASS_SHADOW)
+		if (addpassflag & SCE_PASS_SHADOW)
 			interpolate_vec3(shr1->shad, shr2->shad, t, negt, shr->shad);
-		if(addpassflag & SCE_PASS_AO)
+		if (addpassflag & SCE_PASS_AO)
 			interpolate_vec3(shr1->ao, shr2->ao, t, negt, shr->ao);
-		if(addpassflag & SCE_PASS_ENVIRONMENT)
+		if (addpassflag & SCE_PASS_ENVIRONMENT)
 			interpolate_vec3(shr1->env, shr2->env, t, negt, shr->env);
-		if(addpassflag & SCE_PASS_INDIRECT)
+		if (addpassflag & SCE_PASS_INDIRECT)
 			interpolate_vec3(shr1->indirect, shr2->indirect, t, negt, shr->indirect);
-		if(addpassflag & SCE_PASS_REFLECT)
+		if (addpassflag & SCE_PASS_REFLECT)
 			interpolate_vec3(shr1->refl, shr2->refl, t, negt, shr->refl);
-		if(addpassflag & SCE_PASS_REFRACT)
+		if (addpassflag & SCE_PASS_REFRACT)
 			interpolate_vec3(shr1->refr, shr2->refr, t, negt, shr->refr);
-		if(addpassflag & SCE_PASS_MIST)
+		if (addpassflag & SCE_PASS_MIST)
 			interpolate_vec1(&shr1->mist, &shr2->mist, t, negt, &shr->mist);
 	}
 }
 
 static void strand_apply_shaderesult_alpha(ShadeResult *shr, float alpha)
 {
-	if(alpha < 1.0f) {
+	if (alpha < 1.0f) {
 		shr->combined[0] *= alpha;
 		shr->combined[1] *= alpha;
 		shr->combined[2] *= alpha;
@@ -273,7 +273,7 @@ static void strand_shade_point(Render *re, ShadeSample *ssamp, StrandSegment *ss
 
 	memset(&vlr, 0, sizeof(vlr));
 	vlr.flag= R_SMOOTH;
-	if(sseg->buffer->ma->mode & MA_TANGENT_STR)
+	if (sseg->buffer->ma->mode & MA_TANGENT_STR)
 		vlr.flag |= R_TANGENT;
 
 	shi->vlr= &vlr;
@@ -308,8 +308,8 @@ static void strand_shade_point(Render *re, ShadeSample *ssamp, StrandSegment *ss
 	strand_apply_shaderesult_alpha(shr, spoint->alpha);
 
 	/* include lamphalos for strand, since halo layer was added already */
-	if(re->flag & R_LAMPHALO)
-		if(shi->layflag & SCE_LAY_HALO)
+	if (re->flag & R_LAMPHALO)
+		if (shi->layflag & SCE_LAY_HALO)
 			renderspothalo(shi, shr->combined, shr->combined[3]);
 	
 	shi->strand= NULL;
@@ -352,7 +352,7 @@ static void strand_shade_get(Render *re, StrandShadeCache *cache, ShadeSample *s
 	hashshr= BLI_ghash_lookup(cache->resulthash, svert);
 	refcount= BLI_ghash_lookup(cache->refcounthash, svert);
 
-	if(!hashshr) {
+	if (!hashshr) {
 		/* not shaded yet, shade and insert into hash */
 		p.t= (sseg->v[1] == svert)? 0.0f: 1.0f;
 		strand_eval_point(sseg, &p);
@@ -368,7 +368,7 @@ static void strand_shade_get(Render *re, StrandShadeCache *cache, ShadeSample *s
 	
 	/* lower reference count and remove if not needed anymore by any samples */
 	(*refcount)--;
-	if(*refcount == 0) {
+	if (*refcount == 0) {
 		BLI_ghash_remove(cache->resulthash, svert, NULL, (GHashValFreeFP)MEM_freeN);
 		BLI_ghash_remove(cache->refcounthash, svert, NULL, NULL);
 	}
@@ -387,7 +387,7 @@ void strand_shade_segment(Render *re, StrandShadeCache *cache, StrandSegment *ss
 	interpolate_shade_result(&shr1, &shr2, t, ssamp->shr, addpassflag);
 
 	/* apply alpha along width */
-	if(sseg->buffer->widthfade != 0.0f) {
+	if (sseg->buffer->widthfade != 0.0f) {
 		s = 1.0f - pow(fabs(s), sseg->buffer->widthfade);
 
 		strand_apply_shaderesult_alpha(ssamp->shr, s);
@@ -402,7 +402,7 @@ void strand_shade_unref(StrandShadeCache *cache, StrandVert *svert)
 	refcount= BLI_ghash_lookup(cache->refcounthash, svert);
 
 	(*refcount)--;
-	if(*refcount == 0) {
+	if (*refcount == 0) {
 		BLI_ghash_remove(cache->resulthash, svert, NULL, (GHashValFreeFP)MEM_freeN);
 		BLI_ghash_remove(cache->refcounthash, svert, NULL, NULL);
 	}
@@ -412,7 +412,7 @@ static void strand_shade_refcount(StrandShadeCache *cache, StrandVert *svert)
 {
 	int *refcount= BLI_ghash_lookup(cache->refcounthash, svert);
 
-	if(!refcount) {
+	if (!refcount) {
 		refcount= BLI_memarena_alloc(cache->memarena, sizeof(int));
 		*refcount= 1;
 		BLI_ghash_insert(cache->refcounthash, svert, refcount);
@@ -454,9 +454,9 @@ static int compare_strand_segment(const void *poin1, const void *poin2)
 	const StrandSortSegment *seg1= (const StrandSortSegment*)poin1;
 	const StrandSortSegment *seg2= (const StrandSortSegment*)poin2;
 
-	if(seg1->z < seg2->z)
+	if (seg1->z < seg2->z)
 		return -1;
-	else if(seg1->z == seg2->z)
+	else if (seg1->z == seg2->z)
 		return 0;
 	else
 		return 1;
@@ -493,7 +493,7 @@ static APixstrand *addpsmainAstrand(ListBase *lb)
 static APixstrand *addpsAstrand(ZSpan *zspan)
 {
 	/* make new PS */
-	if(zspan->apstrandmcounter==0) {
+	if (zspan->apstrandmcounter==0) {
 		zspan->curpstrand= addpsmainAstrand(zspan->apsmbase);
 		zspan->apstrandmcounter= 4095;
 	}
@@ -524,19 +524,19 @@ static void do_strand_fillac(void *handle, int x, int y, float u, float v, float
 	/* check against solid z-buffer */
 	zverg= (int)z;
 
-	if(spart->rectdaps) {
+	if (spart->rectdaps) {
 		/* find the z of the sample */
 		PixStr *ps;
 		intptr_t *rd= spart->rectdaps + offset;
 		
 		bufferz= 0x7FFFFFFF;
-		if(spart->rectmask) maskz= 0x7FFFFFFF;
+		if (spart->rectmask) maskz= 0x7FFFFFFF;
 		
-		if(*rd) {	
-			for(ps= (PixStr *)(*rd); ps; ps= ps->next) {
-				if(mask & ps->mask) {
+		if (*rd) {	
+			for (ps= (PixStr *)(*rd); ps; ps= ps->next) {
+				if (mask & ps->mask) {
 					bufferz= ps->z;
-					if(spart->rectmask)
+					if (spart->rectmask)
 						maskz= ps->maskz;
 					break;
 				}
@@ -545,25 +545,25 @@ static void do_strand_fillac(void *handle, int x, int y, float u, float v, float
 	}
 	else {
 		bufferz= (spart->rectz)? spart->rectz[offset]: 0x7FFFFFFF;
-		if(spart->rectmask)
+		if (spart->rectmask)
 			maskz= spart->rectmask[offset];
 	}
 
 #define CHECK_ADD(n) \
-	if(apn->p[n]==strnr && apn->obi[n]==obi && apn->seg[n]==seg) \
-	{ if(!(apn->mask[n] & mask)) { apn->mask[n] |= mask; apn->v[n] += t; apn->u[n] += s; } break; }
+	if (apn->p[n]==strnr && apn->obi[n]==obi && apn->seg[n]==seg) \
+	{ if (!(apn->mask[n] & mask)) { apn->mask[n] |= mask; apn->v[n] += t; apn->u[n] += s; } break; }
 #define CHECK_ASSIGN(n) \
-	if(apn->p[n]==0) \
+	if (apn->p[n]==0) \
 	{apn->obi[n]= obi; apn->p[n]= strnr; apn->z[n]= zverg; apn->mask[n]= mask; apn->v[n]= t; apn->u[n]= s; apn->seg[n]= seg; break; }
 
 	/* add to pixel list */
-	if(zverg < bufferz && (spart->totapixbuf[offset] < MAX_ZROW)) {
-		if(!spart->rectmask || zverg > maskz) {
+	if (zverg < bufferz && (spart->totapixbuf[offset] < MAX_ZROW)) {
+		if (!spart->rectmask || zverg > maskz) {
 			t = u*spart->t[0] + v*spart->t[1] + (1.0f-u-v)*spart->t[2];
 			s = fabs(u*spart->s[0] + v*spart->s[1] + (1.0f-u-v)*spart->s[2]);
 
 			apn= spart->apixbuf + offset;
-			while(apn) {
+			while (apn) {
 				CHECK_ADD(0);
 				CHECK_ADD(1);
 				CHECK_ADD(2);
@@ -579,7 +579,7 @@ static void do_strand_fillac(void *handle, int x, int y, float u, float v, float
 				CHECK_ASSIGN(0);
 			}
 
-			if(cache) {
+			if (cache) {
 				strand_shade_refcount(cache, sseg->v[1]);
 				strand_shade_refcount(cache, sseg->v[2]);
 			}
@@ -599,11 +599,11 @@ static int strand_test_clip(float winmat[][4], ZSpan *UNUSED(zspan), float *boun
 	/* we compare z without perspective division for segment sorting */
 	*zcomp= hoco[2];
 
-	if(hoco[0]+widthx < bounds[0]*hoco[3]) clipflag |= 1;
-	else if(hoco[0]-widthx > bounds[1]*hoco[3]) clipflag |= 2;
+	if (hoco[0]+widthx < bounds[0]*hoco[3]) clipflag |= 1;
+	else if (hoco[0]-widthx > bounds[1]*hoco[3]) clipflag |= 2;
 	
-	if(hoco[1]-widthy > bounds[3]*hoco[3]) clipflag |= 4;
-	else if(hoco[1]+widthy < bounds[2]*hoco[3]) clipflag |= 8;
+	if (hoco[1]-widthy > bounds[3]*hoco[3]) clipflag |= 4;
+	else if (hoco[1]+widthy < bounds[2]*hoco[3]) clipflag |= 8;
 
 	clipflag |= testclip(hoco);
 
@@ -619,7 +619,7 @@ static void do_scanconvert_strand(Render *UNUSED(re), StrandPart *spart, ZSpan *
 	copy_v3_v3(jco3, co3);
 	copy_v3_v3(jco4, co4);
 
-	if(spart->jit) {
+	if (spart->jit) {
 		jx= -spart->jit[sample][0];
 		jy= -spart->jit[sample][1];
 
@@ -651,13 +651,13 @@ static void do_scanconvert_strand(Render *UNUSED(re), StrandPart *spart, ZSpan *
 
 static void strand_render(Render *re, StrandSegment *sseg, float winmat[][4], StrandPart *spart, ZSpan *zspan, int totzspan, StrandPoint *p1, StrandPoint *p2)
 {
-	if(spart) {
+	if (spart) {
 		float t= p2->t;
 		float dt= p2->t - p1->t;
 		int a;
 
-		if(re->osa) {
-			for(a=0; a<re->osa; 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
@@ -674,13 +674,13 @@ static void strand_render(Render *re, StrandSegment *sseg, float winmat[][4], St
 		projectvert(p2->co, winmat, hoco2);
 
   
-		for(a=0; a<totzspan; a++) {
+		for (a=0; a<totzspan; a++) {
 #if 0
 			/* render both strand and single pixel wire to counter aliasing */
 			zbufclip4(re, &zspan[a], obi, index, p1->hoco2, p1->hoco1, p2->hoco1, p2->hoco2, p1->clip2, p1->clip1, p2->clip1, p2->clip2);
 #endif
 			/* only render a line for now, which makes the shadow map more
-			   similiar across frames, and so reduces flicker */
+			 * similar across frames, and so reduces flicker */
 			zbufsinglewire(&zspan[a], obi, index, hoco1, hoco2);
 		}
 	}
@@ -692,7 +692,7 @@ static int strand_segment_recursive(Render *re, float winmat[][4], StrandPart *s
 	StrandBuffer *buffer= sseg->buffer;
 	float dot, d1[2], d2[2], len1, len2;
 
-	if(depth == buffer->maxdepth)
+	if (depth == buffer->maxdepth)
 		return 0;
 
 	p.t= (p1->t + p2->t)*0.5f;
@@ -707,14 +707,14 @@ static int strand_segment_recursive(Render *re, float winmat[][4], StrandPart *s
 	d2[1]= (p2->y - p.y);
 	len2= d2[0]*d2[0] + d2[1]*d2[1];
 
-	if(len1 == 0.0f || len2 == 0.0f)
+	if (len1 == 0.0f || len2 == 0.0f)
 		return 0;
 	
 	dot= d1[0]*d2[0] + d1[1]*d2[1];
-	if(dot*dot > sseg->sqadaptcos*len1*len2)
+	if (dot*dot > sseg->sqadaptcos*len1*len2)
 		return 0;
 
-	if(spart) {
+	if (spart) {
 		do_strand_point_project(winmat, zspan, p.co1, p.hoco1, p.zco1);
 		do_strand_point_project(winmat, zspan, p.co2, p.hoco2, p.zco2);
 	}
@@ -727,9 +727,9 @@ static int strand_segment_recursive(Render *re, float winmat[][4], StrandPart *s
 #endif
 	}
 
-	if(!strand_segment_recursive(re, winmat, spart, zspan, totzspan, sseg, p1, &p, depth+1))
+	if (!strand_segment_recursive(re, winmat, spart, zspan, totzspan, sseg, p1, &p, depth+1))
 		strand_render(re, sseg, winmat, spart, zspan, totzspan, p1, &p);
-	if(!strand_segment_recursive(re, winmat, spart, zspan, totzspan, sseg, &p, p2, depth+1))
+	if (!strand_segment_recursive(re, winmat, spart, zspan, totzspan, sseg, &p, p2, depth+1))
 		strand_render(re, sseg, winmat, spart, zspan, totzspan, &p, p2);
 	
 	return 1;
@@ -749,7 +749,7 @@ void render_strand_segment(Render *re, float winmat[][4], StrandPart *spart, ZSp
 	strand_eval_point(sseg, p2);
 	strand_project_point(buffer->winmat, buffer->winx, buffer->winy, p2);
 
-	if(spart) {
+	if (spart) {
 		do_strand_point_project(winmat, zspan, p1->co1, p1->hoco1, p1->zco1);
 		do_strand_point_project(winmat, zspan, p1->co2, p1->hoco2, p1->zco2);
 		do_strand_point_project(winmat, zspan, p2->co1, p2->hoco1, p2->zco1);
@@ -768,7 +768,7 @@ void render_strand_segment(Render *re, float winmat[][4], StrandPart *spart, ZSp
 #endif
 	}
 
-	if(!strand_segment_recursive(re, winmat, spart, zspan, totzspan, sseg, p1, p2, 0))
+	if (!strand_segment_recursive(re, winmat, spart, zspan, totzspan, sseg, p1, p2, 0))
 		strand_render(re, sseg, winmat, spart, zspan, totzspan, p1, p2);
 }
 
@@ -788,9 +788,9 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
 	float z[4], bounds[4], obwinmat[4][4];
 	int a, b, c, i, totsegment, clip[4];
 
-	if(re->test_break(re->tbh))
+	if (re->test_break(re->tbh))
 		return 0;
-	if(re->totstrand == 0)
+	if (re->totstrand == 0)
 		return 0;
 
 	/* setup StrandPart */
@@ -818,7 +818,7 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
 	zspan.zofsy= -pa->disprect.ymin;
 
 	/* to center the sample position */
-	if(!shadow) {
+	if (!shadow) {
 		zspan.zofsx -= 0.5f;
 		zspan.zofsy -= 0.5f;
 	}
@@ -836,17 +836,17 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
 	totsegment= 0;
 
 	/* for all object instances */
-	for(obi=re->instancetable.first, i=0; obi; obi=obi->next, i++) {
+	for (obi=re->instancetable.first, i=0; obi; obi=obi->next, i++) {
 		Material *ma;
 		float widthx, widthy;
 
 		obr= obi->obr;
 
-		if(!obr->strandbuf || !(obr->strandbuf->lay & lay))
+		if (!obr->strandbuf || !(obr->strandbuf->lay & lay))
 			continue;
 
 		/* compute matrix and try clipping whole object */
-		if(obi->flag & R_TRANSFORMED)
+		if (obi->flag & R_TRANSFORMED)
 			mult_m4_m4m4(obwinmat, winmat, obi->mat);
 		else
 			copy_m4_m4(obwinmat, winmat);
@@ -854,12 +854,12 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
 		/* test if we should skip it */
 		ma = obr->strandbuf->ma;
 
-		if(shadow && !(ma->mode & MA_SHADBUF))
+		if (shadow && !(ma->mode & MA_SHADBUF))
 			continue;
-		else if(!shadow && (ma->mode & MA_ONLYCAST))
+		else if (!shadow && (ma->mode & MA_ONLYCAST))
 			continue;
 
-		if(clip_render_object(obi->obr->boundbox, bounds, obwinmat))
+		if (clip_render_object(obi->obr->boundbox, bounds, obwinmat))
 			continue;
 		
 		widthx= obr->strandbuf->maxwidth*obwinmat[0][0];
@@ -867,12 +867,12 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
 
 		/* for each bounding box containing a number of strands */
 		sbound= obr->strandbuf->bound;
-		for(c=0; c<obr->strandbuf->totbound; c++, sbound++) {
-			if(clip_render_object(sbound->boundbox, bounds, obwinmat))
+		for (c=0; c<obr->strandbuf->totbound; c++, sbound++) {
+			if (clip_render_object(sbound->boundbox, bounds, obwinmat))
 				continue;
 
 			/* for each strand in this bounding box */
-			for(a=sbound->start; a<sbound->end; a++) {
+			for (a=sbound->start; a<sbound->end; a++) {
 				strand= RE_findOrAddStrand(obr, a);
 				svert= strand->vert;
 
@@ -881,9 +881,9 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
 				clip[2]= strand_test_clip(obwinmat, &zspan, bounds, (svert+1)->co, &z[2], widthx, widthy);
 				clip[0]= clip[1]; z[0]= z[1];
 
-				for(b=0; b<strand->totvert-1; b++, svert++) {
+				for (b=0; b<strand->totvert-1; b++, svert++) {
 					/* compute 4th point clipping and z depth */
-					if(b < strand->totvert-2) {
+					if (b < strand->totvert-2) {
 						clip[3]= strand_test_clip(obwinmat, &zspan, bounds, (svert+2)->co, &z[3], widthx, widthy);
 					}
 					else {
@@ -891,7 +891,7 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
 					}
 
 					/* check clipping and add to sortsegments buffer */
-					if(!(clip[0] & clip[1] & clip[2] & clip[3])) {
+					if (!(clip[0] & clip[1] & clip[2] & clip[3])) {
 						sortseg= BLI_memarena_alloc(memarena, sizeof(StrandSortSegment));
 						sortseg->obi= i;
 						sortseg->strand= strand->index;
@@ -913,10 +913,10 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
 		}
 	}
 
-	if(!re->test_break(re->tbh)) {
+	if (!re->test_break(re->tbh)) {
 		/* convert list to array and sort */
 		sortsegments= MEM_mallocN(sizeof(StrandSortSegment)*totsegment, "StrandSortSegment");
-		for(a=0, sortseg=firstseg; a<totsegment; a++, sortseg=sortseg->next)
+		for (a=0, sortseg=firstseg; a<totsegment; a++, sortseg=sortseg->next)
 			sortsegments[a]= *sortseg;
 		qsort(sortsegments, totsegment, sizeof(StrandSortSegment), compare_strand_segment);
 	}
@@ -925,11 +925,11 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
 
 	spart.totapixbuf= MEM_callocN(sizeof(int)*pa->rectx*pa->recty, "totapixbuf");
 
-	if(!re->test_break(re->tbh)) {
+	if (!re->test_break(re->tbh)) {
 		/* render segments in sorted order */
 		sortseg= sortsegments;
-		for(a=0; a<totsegment; a++, sortseg++) {
-			if(re->test_break(re->tbh))
+		for (a=0; a<totsegment; a++, sortseg++) {
+			if (re->test_break(re->tbh))
 				break;
 
 			obi= &re->objectinstance[sortseg->obi];
@@ -954,7 +954,7 @@ int zbuffer_strands_abuf(Render *re, RenderPart *pa, APixstrand *apixbuf, ListBa
 		}
 	}
 
-	if(sortsegments)
+	if (sortsegments)
 		MEM_freeN(sortsegments);
 	MEM_freeN(spart.totapixbuf);
 	
@@ -974,14 +974,20 @@ StrandSurface *cache_strand_surface(Render *re, ObjectRen *obr, DerivedMesh *dm,
 	int a, totvert, totface;
 
 	totvert= dm->getNumVerts(dm);
-	totface= dm->getNumFaces(dm);
-
-	for(mesh=re->strandsurface.first; mesh; mesh=mesh->next)
-		if(mesh->obr.ob == obr->ob && mesh->obr.par == obr->par
-			&& mesh->obr.index == obr->index && mesh->totvert==totvert && mesh->totface==totface)
+	totface= dm->getNumTessFaces(dm);
+
+	for (mesh = re->strandsurface.first; mesh; mesh = mesh->next) {
+		if ((mesh->obr.ob    == obr->ob) &&
+		    (mesh->obr.par   == obr->par) &&
+		    (mesh->obr.index == obr->index) &&
+		    (mesh->totvert   == totvert) &&
+		    (mesh->totface   == totface))
+		{
 			break;
+		}
+	}
 
-	if(!mesh) {
+	if (!mesh) {
 		mesh= MEM_callocN(sizeof(StrandSurface), "StrandSurface");
 		mesh->obr= *obr;
 		mesh->totvert= totvert;
@@ -993,23 +999,23 @@ StrandSurface *cache_strand_surface(Render *re, ObjectRen *obr, DerivedMesh *dm,
 		BLI_addtail(&re->strandsurface, mesh);
 	}
 
-	if(timeoffset == -1 && !mesh->prevco)
+	if (timeoffset == -1 && !mesh->prevco)
 		mesh->prevco= co= MEM_callocN(sizeof(float)*3*mesh->totvert, "StrandSurfCo");
-	else if(timeoffset == 0 && !mesh->co)
+	else if (timeoffset == 0 && !mesh->co)
 		mesh->co= co= MEM_callocN(sizeof(float)*3*mesh->totvert, "StrandSurfCo");
-	else if(timeoffset == 1 && !mesh->nextco)
+	else if (timeoffset == 1 && !mesh->nextco)
 		mesh->nextco= co= MEM_callocN(sizeof(float)*3*mesh->totvert, "StrandSurfCo");
 	else
 		return mesh;
 
 	mvert= dm->getVertArray(dm);
-	for(a=0; a<mesh->totvert; a++, mvert++) {
+	for (a=0; a<mesh->totvert; a++, mvert++) {
 		copy_v3_v3(co[a], mvert->co);
 		mul_m4_v3(mat, co[a]);
 	}
 
-	mface= dm->getFaceArray(dm);
-	for(a=0; a<mesh->totface; a++, mface++) {
+	mface= dm->getTessFaceArray(dm);
+	for (a=0; a<mesh->totface; a++, mface++) {
 		mesh->face[a][0]= mface->v1;
 		mesh->face[a][1]= mface->v2;
 		mesh->face[a][2]= mface->v3;
@@ -1023,14 +1029,14 @@ void free_strand_surface(Render *re)
 {
 	StrandSurface *mesh;
 
-	for(mesh=re->strandsurface.first; mesh; mesh=mesh->next) {
-		if(mesh->co) MEM_freeN(mesh->co);
-		if(mesh->prevco) MEM_freeN(mesh->prevco);
-		if(mesh->nextco) MEM_freeN(mesh->nextco);
-		if(mesh->ao) MEM_freeN(mesh->ao);
-		if(mesh->env) MEM_freeN(mesh->env);
-		if(mesh->indirect) MEM_freeN(mesh->indirect);
-		if(mesh->face) MEM_freeN(mesh->face);
+	for (mesh=re->strandsurface.first; mesh; mesh=mesh->next) {
+		if (mesh->co) MEM_freeN(mesh->co);
+		if (mesh->prevco) MEM_freeN(mesh->prevco);
+		if (mesh->nextco) MEM_freeN(mesh->nextco);
+		if (mesh->ao) MEM_freeN(mesh->ao);
+		if (mesh->env) MEM_freeN(mesh->env);
+		if (mesh->indirect) MEM_freeN(mesh->indirect);
+		if (mesh->face) MEM_freeN(mesh->face);
 	}
 
 	BLI_freelistN(&re->strandsurface);
@@ -1042,11 +1048,11 @@ void strand_minmax(StrandRen *strand, float *min, float *max, float width)
 	float vec[3], width2= 2.0f*width;
 	int a;
 
-	for(a=0, svert=strand->vert; a<strand->totvert; a++, svert++) {
+	for (a=0, svert=strand->vert; a<strand->totvert; a++, svert++) {
 		copy_v3_v3(vec, svert->co);
 		DO_MINMAX(vec, min, max);
 		
-		if(width!=0.0f) {
+		if (width!=0.0f) {
 			vec[0]+= width; vec[1]+= width; vec[2]+= width;
 			DO_MINMAX(vec, min, max);
 			vec[0]-= width2; vec[1]-= width2; vec[2]-= width2;
diff --git a/source/blender/render/intern/source/sunsky.c b/source/blender/render/intern/source/sunsky.c
index e824b81..8097628 100644
--- a/source/blender/render/intern/source/sunsky.c
+++ b/source/blender/render/intern/source/sunsky.c
@@ -20,12 +20,13 @@
 
 /** \file blender/render/intern/source/sunsky.c
  *  \ingroup render
+ *
+ * This feature comes from Preetham paper on "A Practical Analytic Model for Daylight"
+ * and example code from Brian Smits, another author of that paper in
+ * http://www.cs.utah.edu/vissim/papers/sunsky/code/
  */
 
-
-
 #include "sunsky.h"
-#include "math.h"
 #include "BLI_math.h"
 #include "BKE_global.h"
 
@@ -37,30 +38,36 @@
  * compute v1 = v2 op v3
  * v1, v2 and v3 are vectors contains 3 float
  * */
-#define vec3opv(v1, v2, op, v3) \
-	v1[0] = (v2[0] op v3[0]); \
-	v1[1] = (v2[1] op v3[1]);\
-	v1[2] = (v2[2] op v3[2]);
+#define VEC3OPV(v1, v2, op, v3)                                               \
+	{                                                                         \
+		v1[0] = (v2[0] op v3[0]);                                             \
+		v1[1] = (v2[1] op v3[1]);                                             \
+		v1[2] = (v2[2] op v3[2]);                                             \
+	} (void)0
 
 /**
  * compute v1 = v2 op f1
  * v1, v2 are vectors contains 3 float
  * and f1 is a float
  * */
-#define vec3opf(v1, v2, op, f1)\
-	v1[0] = (v2[0] op (f1));\
-	v1[1] = (v2[1] op (f1));\
-	v1[2] = (v2[2] op (f1));
+#define VEC3OPF(v1, v2, op, f1)                                               \
+	{                                                                         \
+		v1[0] = (v2[0] op (f1));                                              \
+		v1[1] = (v2[1] op (f1));                                              \
+		v1[2] = (v2[2] op (f1));                                              \
+	} (void)0
 
 /**
  * compute v1 = f1 op v2
  * v1, v2 are vectors contains 3 float
  * and f1 is a float
  * */
-#define fopvec3(v1, f1, op, v2)\
-	v1[0] = ((f1) op v2[0]);\
-	v1[1] = ((f1) op v2[1]);\
-	v1[2] = ((f1) op v2[2]);
+#define FOPVEC3(v1, f1, op, v2)                                               \
+	{                                                                         \
+		v1[0] = ((f1) op v2[0]);                                              \
+		v1[1] = ((f1) op v2[1]);                                              \
+		v1[2] = ((f1) op v2[2]);                                              \
+	} (void)0
 
 /**
  * ClipColor:
@@ -129,7 +136,7 @@ static float PerezFunction(struct SunSky *sunsky, const float *lam, float theta,
  * InitSunSky:
  * this function compute some sun,sky parameters according to input parameters and also initiate some other sun, sky parameters
  * parameters:
- * sunSky, is a structure that contains informtion about sun, sky and atmosphere, in this function, most of its values initiated
+ * sunSky, is a structure that contains information about sun, sky and atmosphere, in this function, most of its values initiated
  * turb, is atmosphere turbidity
  * toSun, contains sun direction
  * horizon_brighness, controls the brightness of the horizon colors
@@ -269,7 +276,7 @@ void GetSkyXYZRadiance(struct SunSky* sunsky, float theta, float phi, float colo
 	y = PerezFunction(sunsky, sunsky->perez_y, theta, gamma, sunsky->zenith_y);
 	Y = 6.666666667e-5f * nfade * hfade * PerezFunction(sunsky, sunsky->perez_Y, theta, gamma, sunsky->zenith_Y);
 
-	if(sunsky->sky_exposure!=0.0f)
+	if (sunsky->sky_exposure!=0.0f)
 		Y = 1.0 - exp(Y*sunsky->sky_exposure);
 	
 	X = (x / y) * Y;
@@ -315,9 +322,9 @@ void GetSkyXYZRadiancef(struct SunSky* sunsky, const float varg[3], float color_
  * */
 static void ComputeAttenuatedSunlight(float theta, int turbidity, float fTau[3])
 {
-	float fBeta ;
+	float fBeta;
 	float fTauR, fTauA;
-	float m ;
+	float m;
 	float fAlpha;
 
 	int i;
@@ -331,7 +338,7 @@ static void ComputeAttenuatedSunlight(float theta, int turbidity, float fTau[3])
 	
 	m =  1.0f/(cosf(theta) + 0.15f*powf(93.885f-theta/(float)M_PI*180.0f,-1.253f));
 
-	for(i = 0; i < 3; i++)
+	for (i = 0; i < 3; i++)
 	{
 		// Rayleigh Scattering
 		fTauR = expf( -m * 0.008735f * powf(fLambda[i], (float)(-4.08f)));
@@ -345,7 +352,7 @@ static void ComputeAttenuatedSunlight(float theta, int turbidity, float fTau[3])
 
 /**
  * InitAtmosphere:
- * this function intiate sunSky structure with user input parameters.
+ * this function initiate sunSky structure with user input parameters.
  * parameters:
  * sunSky, contains information about sun, and in this function some atmosphere parameters will initiated
  * sun_intens, shows sun intensity value
@@ -404,19 +411,19 @@ void InitAtmosphere(struct SunSky *sunSky, float sun_intens, float mief, float r
 	fTemp = pi*pi*(n*n-1)*(n*n-1)*(6+3*pn)/(6-7*pn)/N;
 	fBeta = 8*fTemp*pi/3;
 		
-	vec3opf(sunSky->atm_BetaRay, vLambda4, *, fBeta);
+	VEC3OPF(sunSky->atm_BetaRay, vLambda4, *, fBeta);
 	fBetaDash = fTemp/2;
-	vec3opf(sunSky->atm_BetaDashRay, vLambda4,*, fBetaDash);
+	VEC3OPF(sunSky->atm_BetaDashRay, vLambda4,*, fBetaDash);
 	
 
 	// Mie scattering constants.
 	fTemp2 = 0.434f*c*(2*pi)*(2*pi)*0.5f;
-	vec3opf(sunSky->atm_BetaDashMie, vLambda2, *, fTemp2);
+	VEC3OPF(sunSky->atm_BetaDashMie, vLambda2, *, fTemp2);
 	
 	fTemp3 = 0.434f*c*pi*(2*pi)*(2*pi);
 	
-	vec3opv(vBetaMieTemp, K, *, fLambda);
-	vec3opf(sunSky->atm_BetaMie, vBetaMieTemp,*, fTemp3);
+	VEC3OPV(vBetaMieTemp, K, *, fLambda);
+	VEC3OPF(sunSky->atm_BetaMie, vBetaMieTemp,*, fTemp3);
 	
 }
 
@@ -455,12 +462,12 @@ void AtmospherePixleShader( struct SunSky* sunSky, float view[3], float s, float
 	costheta = dot_v3v3(view, sunDirection); // cos(theta)
 	Phase_1 = 1 + (costheta * costheta); // Phase_1
 	
-	vec3opf(sunSky->atm_BetaRay, sunSky->atm_BetaRay, *, sunSky->atm_BetaRayMultiplier);
-	vec3opf(sunSky->atm_BetaMie, sunSky->atm_BetaMie, *, sunSky->atm_BetaMieMultiplier);
-	vec3opv(sunSky->atm_BetaRM, sunSky->atm_BetaRay, +, sunSky->atm_BetaMie);
+	VEC3OPF(sunSky->atm_BetaRay, sunSky->atm_BetaRay, *, sunSky->atm_BetaRayMultiplier);
+	VEC3OPF(sunSky->atm_BetaMie, sunSky->atm_BetaMie, *, sunSky->atm_BetaMieMultiplier);
+	VEC3OPV(sunSky->atm_BetaRM, sunSky->atm_BetaRay, +, sunSky->atm_BetaMie);
 	
 	//e^(-(beta_1 + beta_2) * s) = E1
-	vec3opf(E1, sunSky->atm_BetaRM, *, -s/(float)M_LN2);
+	VEC3OPF(E1, sunSky->atm_BetaRM, *, -s/(float)M_LN2);
 	E1[0] = exp(E1[0]);
 	E1[1] = exp(E1[1]);
 	E1[2] = exp(E1[2]);
@@ -472,32 +479,32 @@ void AtmospherePixleShader( struct SunSky* sunSky, float view[3], float s, float
 	fTemp = fTemp * sqrtf(fTemp);
 	Phase_2 = (1 - sunSky->atm_HGg * sunSky->atm_HGg)/fTemp;
 	
-	vec3opf(vTemp1, sunSky->atm_BetaDashRay, *, Phase_1);
-	vec3opf(vTemp2, sunSky->atm_BetaDashMie, *, Phase_2);	
+	VEC3OPF(vTemp1, sunSky->atm_BetaDashRay, *, Phase_1);
+	VEC3OPF(vTemp2, sunSky->atm_BetaDashMie, *, Phase_2);
 
-	vec3opv(vTemp1, vTemp1, +, vTemp2);
-	fopvec3(vTemp2, 1.0f, -, E1);
-	vec3opv(vTemp1, vTemp1, *, vTemp2);
+	VEC3OPV(vTemp1, vTemp1, +, vTemp2);
+	FOPVEC3(vTemp2, 1.0f, -, E1);
+	VEC3OPV(vTemp1, vTemp1, *, vTemp2);
 
-	fopvec3(vTemp2, 1.0f, / , sunSky->atm_BetaRM);
+	FOPVEC3(vTemp2, 1.0f, / , sunSky->atm_BetaRM);
 
-	vec3opv(I, vTemp1, *, vTemp2);
+	VEC3OPV(I, vTemp1, *, vTemp2);
 		
-	vec3opf(I, I, *, sunSky->atm_InscatteringMultiplier);
-	vec3opf(E, E, *, sunSky->atm_ExtinctionMultiplier);
+	VEC3OPF(I, I, *, sunSky->atm_InscatteringMultiplier);
+	VEC3OPF(E, E, *, sunSky->atm_ExtinctionMultiplier);
 		
 	//scale to color sun
 	ComputeAttenuatedSunlight(sunSky->theta, sunSky->turbidity, sunColor);
-	vec3opv(E, E, *, sunColor);
+	VEC3OPV(E, E, *, sunColor);
 
-	vec3opf(I, I, *, sunSky->atm_SunIntensity);
+	VEC3OPF(I, I, *, sunSky->atm_SunIntensity);
 
-	vec3opv(rgb, rgb, *, E);
-	vec3opv(rgb, rgb, +, I);
+	VEC3OPV(rgb, rgb, *, E);
+	VEC3OPV(rgb, rgb, +, I);
 }
 
-#undef vec3opv
-#undef vec3opf
-#undef fopvec3
+#undef VEC3OPV
+#undef VEC3OPF
+#undef FOPVEC3
 
 /* EOF */
diff --git a/source/blender/render/intern/source/volume_precache.c b/source/blender/render/intern/source/volume_precache.c
index 8b3c3ec..8b059d4 100644
--- a/source/blender/render/intern/source/volume_precache.c
+++ b/source/blender/render/intern/source/volume_precache.c
@@ -57,10 +57,6 @@
 #include "volumetric.h"
 #include "volume_precache.h"
 
-#if defined( _MSC_VER ) && !defined( __cplusplus )
-# define inline __inline
-#endif // defined( _MSC_VER ) && !defined( __cplusplus )
-
 #include "BKE_global.h"
 
 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
@@ -89,7 +85,8 @@ static int intersect_outside_volume(RayObject *tree, Isect *isect, float *offset
 		isect->orig.ob= isect->hit.ob;
 		
 		return intersect_outside_volume(tree, isect, offset, limit-1, depth+1);
-	} else {
+	}
+	else {
 		return depth;
 	}
 }
@@ -140,14 +137,14 @@ void global_bounds_obi(Render *re, ObjectInstanceRen *obi, float *bbmin, float *
 	
 	INIT_MINMAX(bbmin, bbmax);
 	
-	for(a=0; a<obr->totvert; a++) {
-		if((a & 255)==0) ver= obr->vertnodes[a>>8].vert;
+	for (a=0; a<obr->totvert; a++) {
+		if ((a & 255)==0) ver= obr->vertnodes[a>>8].vert;
 		else ver++;
 		
 		copy_v3_v3(co, ver->co);
 		
 		/* transformed object instance in camera space */
-		if(obi->flag & R_TRANSFORMED)
+		if (obi->flag & R_TRANSFORMED)
 			mul_m4_v3(obi->mat, co);
 		
 		/* convert to global space */
@@ -264,19 +261,19 @@ static void lightcache_filter2(VolumePrecache *vp)
 }
 #endif
 
-static inline int ms_I(int x, int y, int z, int *n) //has a pad of 1 voxel surrounding the core for boundary simulation
+BLI_INLINE int ms_I(int x, int y, int z, int *n) //has a pad of 1 voxel surrounding the core for boundary simulation
 { 
 	/* different ordering to light cache */
 	return x*(n[1]+2)*(n[2]+2) + y*(n[2]+2) + z; 	
 }
 
-static 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
+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;  	
 }
 
-static inline int lc_to_ms_I(int x, int y, int z, int *n)
+BLI_INLINE int lc_to_ms_I(int x, int y, int z, int *n)
 { 
 	/* converting light cache index to multiple scattering index */
 	return (x-1)*(n[1]*n[2]) + (y-1)*(n[2]) + z-1;
@@ -284,7 +281,7 @@ static inline int lc_to_ms_I(int x, int y, int z, int *n)
 
 /* *** multiple scattering approximation *** */
 
-/* get the total amount of light energy in the light cache. used to normalise after multiple scattering */
+/* get the total amount of light energy in the light cache. used to normalize after multiple scattering */
 static float total_ss_energy(Render *re, int do_test_break, VolumePrecache *vp)
 {
 	int x, y, z;
@@ -409,7 +406,7 @@ static void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Materi
 						sb[j] += vp->data_b[i];
 					
 					/* Displays progress every second */
-					if(time-lasttime>1.0) {
+					if (time-lasttime>1.0) {
 						char str[64];
 						BLI_snprintf(str, sizeof(str), "Simulating multiple scattering: %d%%", (int)(100.0f * (c / total)));
 						re->i.infostr= str;
@@ -437,7 +434,7 @@ static void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Materi
 		if (re->test_break(re->tbh)) break;
 	}
 	
-	/* normalisation factor to conserve energy */
+	/* normalization factor to conserve energy */
 	energy_ms = total_ms_energy(re, do_test_break, sr, sg, sb, n);
 	fac *= (energy_ss / energy_ms);
 	
@@ -446,7 +443,8 @@ static void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Materi
 		/* conserve energy - half single, half multiple */
 		origf = 0.5f;
 		fac *= 0.5f;
-	} else {
+	}
+	else {
 		origf = 0.0f;
 	}
 
@@ -483,11 +481,11 @@ static void *vol_precache_part_test(void *data)
 {
 	VolPrecachePart *pa = data;
 
-	printf("part number: %d \n", pa->num);
-	printf("done: %d \n", pa->done);
-	printf("x min: %d   x max: %d \n", pa->minx, pa->maxx);
-	printf("y min: %d   y max: %d \n", pa->miny, pa->maxy);
-	printf("z min: %d   z max: %d \n", pa->minz, pa->maxz);
+	printf("part number: %d\n", pa->num);
+	printf("done: %d\n", pa->done);
+	printf("x min: %d   x max: %d\n", pa->minx, pa->maxx);
+	printf("y min: %d   y max: %d\n", pa->miny, pa->maxy);
+	printf("z min: %d   z max: %d\n", pa->minz, pa->maxz);
 
 	return NULL;
 }
@@ -735,25 +733,25 @@ static void vol_precache_objectinstance_threads(Render *re, ObjectInstanceRen *o
 	queue.done = BLI_thread_queue_init();
 	BLI_thread_queue_nowait(queue.work);
 
-	for(pa= re->volume_precache_parts.first; pa; pa= pa->next)
+	for (pa= re->volume_precache_parts.first; pa; pa= pa->next)
 		BLI_thread_queue_push(queue.work, pa);
 	
 	/* launch threads */
 	BLI_init_threads(&threads, vol_precache_part, totthread);
 
-	for(thread= 0; thread<totthread; thread++)
+	for (thread= 0; thread<totthread; thread++)
 		BLI_insert_thread(&threads, &queue);
 	
 	/* loop waiting for work to be done */
-	while(counter < totparts) {
-		if(re->test_break && re->test_break(re->tbh))
+	while (counter < totparts) {
+		if (re->test_break && re->test_break(re->tbh))
 			break;
 
-		if(BLI_thread_queue_pop_timeout(queue.done, 50))
+		if (BLI_thread_queue_pop_timeout(queue.done, 50))
 			counter++;
 
 		time= PIL_check_seconds_timer();
-		if(time-lasttime>1.0) {
+		if (time-lasttime>1.0) {
 			char str[64];
 			BLI_snprintf(str, sizeof(str), "Precaching volume: %d%%", (int)(100.0f * ((float)counter / (float)totparts)));
 			re->i.infostr= str;
@@ -769,14 +767,13 @@ static void vol_precache_objectinstance_threads(Render *re, ObjectInstanceRen *o
 	BLI_thread_queue_free(queue.done);
 	BLI_freelistN(&re->volume_precache_parts);
 	
-	if(tree) {
+	if (tree) {
 		//TODO: makeraytree_object creates a tree and saves it on OBI, if we free this tree we should also clear other pointers to it
 		//RE_rayobject_free(tree);
 		//tree= NULL;
 	}
 	
-	if (ELEM(ma->vol.shade_type, MA_VOL_SHADE_MULTIPLE, MA_VOL_SHADE_SHADEDPLUSMULTIPLE))
-	{
+	if (ELEM(ma->vol.shade_type, MA_VOL_SHADE_MULTIPLE, MA_VOL_SHADE_SHADEDPLUSMULTIPLE)) {
 		/* this should be before the filtering */
 		multiple_scattering_diffusion(re, obi->volume_precache, ma);
 	}
@@ -786,8 +783,8 @@ static void vol_precache_objectinstance_threads(Render *re, ObjectInstanceRen *o
 
 static int using_lightcache(Material *ma)
 {
-	return (((ma->vol.shadeflag & MA_VOL_PRECACHESHADING) && (ma->vol.shade_type == MA_VOL_SHADE_SHADED))
-		|| (ELEM(ma->vol.shade_type, MA_VOL_SHADE_MULTIPLE, MA_VOL_SHADE_SHADEDPLUSMULTIPLE)));
+	return (((ma->vol.shadeflag & MA_VOL_PRECACHESHADING) && (ma->vol.shade_type == MA_VOL_SHADE_SHADED)) ||
+	        (ELEM(ma->vol.shade_type, MA_VOL_SHADE_MULTIPLE, MA_VOL_SHADE_SHADEDPLUSMULTIPLE)));
 }
 
 /* loop through all objects (and their associated materials)
@@ -800,18 +797,18 @@ void volume_precache(Render *re)
 	re->i.infostr= "Volume preprocessing";
 	re->stats_draw(re->sdh, &re->i);
 
-	for(vo= re->volumes.first; vo; vo= vo->next) {
+	for (vo= re->volumes.first; vo; vo= vo->next) {
 		if (using_lightcache(vo->ma)) {
-			for(obi= re->instancetable.first; obi; obi= obi->next) {
+			for (obi= re->instancetable.first; obi; obi= obi->next) {
 				if (obi->obr == vo->obr) {
 					vol_precache_objectinstance_threads(re, obi, vo->ma);
 
-					if(re->test_break && re->test_break(re->tbh))
+					if (re->test_break && re->test_break(re->tbh))
 						break;
 				}
 			}
 
-			if(re->test_break && re->test_break(re->tbh))
+			if (re->test_break && re->test_break(re->tbh))
 				break;
 		}
 	}
@@ -824,7 +821,7 @@ void free_volume_precache(Render *re)
 {
 	ObjectInstanceRen *obi;
 	
-	for(obi= re->instancetable.first; obi; obi= obi->next) {
+	for (obi= re->instancetable.first; obi; obi= obi->next) {
 		if (obi->volume_precache != NULL) {
 			MEM_freeN(obi->volume_precache->data_r);
 			MEM_freeN(obi->volume_precache->data_g);
diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c
index 66cbb18..fa0326e 100644
--- a/source/blender/render/intern/source/volumetric.c
+++ b/source/blender/render/intern/source/volumetric.c
@@ -69,7 +69,7 @@ extern struct Render R;
 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
 
 /* luminance rec. 709 */
-BM_INLINE float luminance(const float col[3])
+BLI_INLINE float luminance(const float col[3])
 {
 	return (0.212671f*col[0] + 0.71516f*col[1] + 0.072169f*col[2]);
 }
@@ -79,21 +79,23 @@ static float vol_get_shadow(ShadeInput *shi, LampRen *lar, const float co[3])
 {
 	float visibility = 1.f;
 	
-	if(lar->shb) {
+	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);		
-	} else if (lar->mode & LA_SHAD_RAY) {
+	}
+	else if (lar->mode & LA_SHAD_RAY) {
 		/* trace shadow manually, no good lamp api atm */
 		Isect is;
 		
 		copy_v3_v3(is.start, co);
-		if(lar->type==LA_SUN || lar->type==LA_HEMI) {
+		if (lar->type==LA_SUN || lar->type==LA_HEMI) {
 			is.dir[0] = -lar->vec[0];
 			is.dir[1] = -lar->vec[1];
 			is.dir[2] = -lar->vec[2];
 			is.dist = R.maxdist;
-		} else {
+		}
+		else {
 			sub_v3_v3v3(is.dir, lar->co, is.start);
 			is.dist = normalize_v3( is.dir );
 		}
@@ -102,7 +104,7 @@ static float vol_get_shadow(ShadeInput *shi, LampRen *lar, const float co[3])
 		is.check = RE_CHECK_VLR_NON_SOLID_MATERIAL;
 		is.skip = 0;
 		
-		if(lar->mode & (LA_LAYER|LA_LAYER_SHADOW))
+		if (lar->mode & (LA_LAYER|LA_LAYER_SHADOW))
 			is.lay= lar->lay;	
 		else
 			is.lay= -1;
@@ -111,7 +113,7 @@ static float vol_get_shadow(ShadeInput *shi, LampRen *lar, const float co[3])
 		is.orig.face = NULL;
 		is.last_hit = lar->last_hit[shi->thread];
 		
-		if(RE_rayobject_raycast(R.raytree,&is)) {
+		if (RE_rayobject_raycast(R.raytree,&is)) {
 			visibility = 0.f;
 		}
 		
@@ -135,19 +137,20 @@ static int vol_get_bounds(ShadeInput *shi, const float co[3], const float vec[3]
 		isect->skip = RE_SKIP_VLR_NEIGHBOUR;
 		isect->orig.face = (void*)shi->vlr;
 		isect->orig.ob = (void*)shi->obi;
-	} else { // if (intersect_type == VOL_BOUNDS_SS) {
+	}
+	else { // if (intersect_type == VOL_BOUNDS_SS) {
 		isect->skip= 0;
 		isect->orig.face= NULL;
 		isect->orig.ob = NULL;
 	}
 	
-	if(RE_rayobject_raycast(R.raytree, isect))
-	{
+	if (RE_rayobject_raycast(R.raytree, isect)) {
 		hitco[0] = isect->start[0] + isect->dist*isect->dir[0];
 		hitco[1] = isect->start[1] + isect->dist*isect->dir[1];
 		hitco[2] = isect->start[2] + isect->dist*isect->dir[2];
 		return 1;
-	} else {
+	}
+	else {
 		return 0;
 	}
 }
@@ -202,9 +205,10 @@ static void vol_trace_behind(ShadeInput *shi, VlakRen *vlr, const float co[3], f
 	isect.lay= -1;
 	
 	/* check to see if there's anything behind the volume, otherwise shade the sky */
-	if(RE_rayobject_raycast(R.raytree, &isect)) {
+	if (RE_rayobject_raycast(R.raytree, &isect)) {
 		shade_intersection(shi, col_r, &isect);
-	} else {
+	}
+	else {
 		shadeSkyView(col_r, co, shi->view, NULL, shi->thread);
 		shadeSunView(col_r, shi->view);
 	} 
@@ -365,7 +369,7 @@ static float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, const float w[3
 	const float normalize = 0.25f; // = 1.f/4.f = M_PI/(4.f*M_PI)
 	
 	/* normalization constant is 1/4 rather than 1/4pi, since
-	 * Blender's shading system doesn't normalise for
+	 * Blender's shading system doesn't normalize for
 	 * energy conservation - eg. multiplying by pdf ( 1/pi for a lambert brdf ).
 	 * This means that lambert surfaces in Blender are pi times brighter than they 'should be'
 	 * and therefore, with correct energy conservation, volumes will darker than other solid objects,
@@ -376,14 +380,15 @@ static float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, const float w[3
 	
 	if (g == 0.f) {	/* isotropic */
 		return normalize * 1.f;
-	} else {		/* schlick */
+	}
+	else {		/* schlick */
 		const float k = 1.55f * g - .55f * g * g * g;
 		const float kcostheta = k * dot_v3v3(w, wp);
 		return normalize * (1.f - k*k) / ((1.f - kcostheta) * (1.f - kcostheta));
 	}
 	
-	/*
-	 * not used, but here for reference:
+	/* not used, but here for reference: */
+#if 0
 	switch (phasefunc_type) {
 		case MA_VOL_PH_MIEHAZY:
 			return normalize * (0.5f + 4.5f * powf(0.5 * (1.f + costheta), 8.f));
@@ -392,7 +397,7 @@ static float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, const float w[3
 		case MA_VOL_PH_RAYLEIGH:
 			return normalize * 3.f/4.f * (1 + costheta * costheta);
 		case MA_VOL_PH_HG:
-			return normalize * (1.f - g*g) / powf(1.f + g*g - 2.f * g * costheta, 1.5f));
+			return normalize * (1.f - g * g) / powf(1.f + g * g - 2.f * g * costheta, 1.5f);
 		case MA_VOL_PH_SCHLICK:
 		{
 			const float k = 1.55f * g - .55f * g * g * g;
@@ -403,7 +408,7 @@ static float vol_get_phasefunc(ShadeInput *UNUSED(shi), float g, const float w[3
 		default:
 			return normalize * 1.f;
 	}
-	*/
+#endif
 }
 
 /* Compute transmittance = e^(-attenuation) */
@@ -470,7 +475,7 @@ static void vol_shade_one_lamp(struct ShadeInput *shi, const float co[3], const
 	float hitco[3], *atten_co;
 	float p, ref_col[3];
 	
-	if (lar->mode & LA_LAYER) if((lar->lay & shi->obi->lay)==0) return;
+	if (lar->mode & LA_LAYER) if ((lar->lay & shi->obi->lay)==0) return;
 	if ((lar->lay & shi->lay)==0) return;
 	if (lar->energy == 0.0f) return;
 	
@@ -478,7 +483,7 @@ static void vol_shade_one_lamp(struct ShadeInput *shi, const float co[3], const
 	
 	copy_v3_v3(lacol, &lar->r);
 	
-	if(lar->mode & LA_TEXTURE) {
+	if (lar->mode & LA_TEXTURE) {
 		shi->osatex= 0;
 		do_lamp_tex(lar, lv, shi, lacol, LA_TEXTURE);
 	}
@@ -492,8 +497,7 @@ static void vol_shade_one_lamp(struct ShadeInput *shi, const float co[3], const
 	if (shi->mat->vol.shade_type == MA_VOL_SHADE_SHADOWED) {
 		mul_v3_fl(lacol, vol_get_shadow(shi, lar, co));
 	}
-	else if (ELEM3(shi->mat->vol.shade_type, MA_VOL_SHADE_SHADED, MA_VOL_SHADE_MULTIPLE, MA_VOL_SHADE_SHADEDPLUSMULTIPLE))
-	{
+	else if (ELEM3(shi->mat->vol.shade_type, MA_VOL_SHADE_SHADED, MA_VOL_SHADE_MULTIPLE, MA_VOL_SHADE_SHADEDPLUSMULTIPLE)) {
 		Isect is;
 		
 		if (shi->mat->vol.shadeflag & MA_VOL_RECV_EXT_SHADOW) {
@@ -517,7 +521,8 @@ static void vol_shade_one_lamp(struct ShadeInput *shi, const float co[3], const
 				atten_co = hitco;
 			else if ( lampdist < dist ) {
 				atten_co = lar->co;
-			} else
+			}
+			else
 				atten_co = hitco;
 			
 			vol_get_transmittance(shi, tr, co, atten_co);
@@ -554,7 +559,7 @@ void vol_get_scattering(ShadeInput *shi, float scatter_col[3], const float co[3]
 	zero_v3(scatter_col);
 
 	lights= get_lights(shi);
-	for(go=lights->first; go; go= go->next)
+	for (go=lights->first; go; go= go->next)
 	{
 		float lacol[3] = {0.f, 0.f, 0.f};
 		lar= go->lampren;
@@ -568,15 +573,15 @@ void vol_get_scattering(ShadeInput *shi, float scatter_col[3], const float co[3]
 
 	
 /*
-The main volumetric integrator, using an emission/absorption/scattering model.
-
-Incoming radiance = 
-
-outgoing radiance from behind surface * beam transmittance/attenuation
-+ added radiance from all points along the ray due to participating media
-	--> radiance for each segment = 
-		(radiance added by scattering + radiance added by emission) * beam transmittance/attenuation
-*/
+ * The main volumetric integrator, using an emission/absorption/scattering model.
+ *
+ * Incoming radiance =
+ *
+ * outgoing radiance from behind surface * beam transmittance/attenuation
+ * + added radiance from all points along the ray due to participating media
+ *     --> radiance for each segment =
+ *         (radiance added by scattering + radiance added by emission) * beam transmittance/attenuation
+ */
 
 /* For ease of use, I've also introduced a 'reflection' and 'reflection color' parameter, which isn't 
  * physically correct. This works as an RGB tint/gain on out-scattered light, but doesn't affect the light 
@@ -627,7 +632,8 @@ static void volumeintegrate(struct ShadeInput *shi, float col[4], const float co
 				p2[2] = p[2] + (step_vec[2] * 0.5f);
 				
 				vol_get_precached_scattering(&R, shi, scatter_col, p2);
-			} else
+			}
+			else
 				vol_get_scattering(shi, scatter_col, p, shi->view);
 			
 			radiance[0] += stepd * tr[0] * (emit_col[0] + scatter_col[0]);
@@ -667,12 +673,12 @@ static void volume_trace(struct ShadeInput *shi, struct ShadeResult *shr, int in
 		int render_this=0;
 		
 		/* don't render the backfaces of ztransp volume materials.
-		 
+		 *
 		 * volume shading renders the internal volume from between the
 		 * ' view intersection of the solid volume to the
 		 * intersection on the other side, as part of the shading of
 		 * the front face.
-		 
+		 *
 		 * Because ztransp renders both front and back faces independently
 		 * this will double up, so here we prevent rendering the backface as well, 
 		 * which would otherwise render the volume in between the camera and the backface
@@ -686,8 +692,7 @@ static void volume_trace(struct ShadeInput *shi, struct ShadeResult *shr, int in
 	}
 	
 
-	if (inside_volume == VOL_SHADE_INSIDE)
-	{
+	if (inside_volume == VOL_SHADE_INSIDE) {
 		startco = shi->camera_co;
 		endco = shi->co;
 		
@@ -695,7 +700,8 @@ static void volume_trace(struct ShadeInput *shi, struct ShadeResult *shr, int in
 			if (!ztransp)
 				/* trace behind the volume object */
 				vol_trace_behind(shi, shi->vlr, endco, col);
-		} else {
+		}
+		else {
 			/* we're tracing through the volume between the camera 
 			 * and a solid surface, so use that pre-shaded radiance */
 			copy_v4_v4(col, shr->combined);
@@ -706,8 +712,7 @@ static void volume_trace(struct ShadeInput *shi, struct ShadeResult *shr, int in
 	}
 	/* trace to find a backface, the other side bounds of the volume */
 	/* (ray intersect ignores front faces here) */
-	else if (vol_get_bounds(shi, shi->co, shi->view, hitco, &is, VOL_BOUNDS_DEPTH))
-	{
+	else if (vol_get_bounds(shi, shi->co, shi->view, hitco, &is, VOL_BOUNDS_DEPTH)) {
 		VlakRen *vlr = (VlakRen *)is.hit.face;
 		
 		startco = shi->co;
@@ -718,7 +723,8 @@ static void volume_trace(struct ShadeInput *shi, struct ShadeResult *shr, int in
 			if (vlr->mat == shi->mat) {
 				/* trace behind the 2nd (raytrace) hit point */
 				vol_trace_behind(shi, (VlakRen *)is.hit.face, endco, col);
-			} else {
+			}
+			else {
 				shade_intersection(shi, col, &is);
 			}
 		}
diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c
index ce5561b..1f49b65 100644
--- a/source/blender/render/intern/source/voxeldata.c
+++ b/source/blender/render/intern/source/voxeldata.c
@@ -65,7 +65,7 @@
 
 static int is_vd_res_ok(VoxelData *vd)
 {
-	/* arbitrary large value so corrupt headers dont break */
+	/* arbitrary large value so corrupt headers don't break */
 	const int min= 1, max= 100000;
 	return	(vd->resol[0] >= min && vd->resol[0] <= max) &&
 			(vd->resol[1] >= min && vd->resol[1] <= max) &&
@@ -83,15 +83,15 @@ static int load_frame_blendervoxel(VoxelData *vd, FILE *fp, int frame)
 	const size_t size = vd_resol_size(vd);
 	size_t offset = sizeof(VoxelDataHeader);
 	
-	if(is_vd_res_ok(vd) == FALSE)
+	if (is_vd_res_ok(vd) == FALSE)
 		return 0;
 
 	vd->dataset = MEM_mapallocN(sizeof(float)*size, "voxel dataset");
-	if(vd->dataset == NULL) return 0;
+	if (vd->dataset == NULL) return 0;
 
-	if(fseek(fp, frame*size*sizeof(float)+offset, 0) == -1)
+	if (fseek(fp, frame*size*sizeof(float)+offset, 0) == -1)
 		return 0;
-	if(fread(vd->dataset, sizeof(float), size, fp) != size)
+	if (fread(vd->dataset, sizeof(float), size, fp) != size)
 		return 0;
 	
 	vd->cachedframe = frame;
@@ -105,25 +105,25 @@ static int load_frame_raw8(VoxelData *vd, FILE *fp, int frame)
 	char *data_c;
 	int i;
 
-	if(is_vd_res_ok(vd) == FALSE)
+	if (is_vd_res_ok(vd) == FALSE)
 		return 0;
 
 	vd->dataset = MEM_mapallocN(sizeof(float)*size, "voxel dataset");
-	if(vd->dataset == NULL) return 0;
+	if (vd->dataset == NULL) return 0;
 	data_c = (char *)MEM_mallocN(sizeof(char)*size, "temporary voxel file reading storage");
-	if(data_c == NULL) {
+	if (data_c == NULL) {
 		MEM_freeN(vd->dataset);
 		vd->dataset= NULL;
 		return 0;
 	}
 
-	if(fseek(fp,(frame-1)*size*sizeof(char),0) == -1) {
+	if (fseek(fp,(frame-1)*size*sizeof(char),0) == -1) {
 		MEM_freeN(data_c);
 		MEM_freeN(vd->dataset);
 		vd->dataset= NULL;
 		return 0;
 	}
-	if(fread(data_c, sizeof(char), size, fp) != size) {
+	if (fread(data_c, sizeof(char), size, fp) != size) {
 		MEM_freeN(data_c);
 		MEM_freeN(vd->dataset);
 		vd->dataset= NULL;
@@ -155,7 +155,7 @@ static void load_frame_image_sequence(VoxelData *vd, Tex *tex)
 	ima->source = IMA_SRC_SEQUENCE;
 	iuser.framenr = 1 + iuser.offset;
 
-	/* find the first valid ibuf and use it to initialise the resolution of the data set */
+	/* 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);
 	while (!ibuf && (iuser.framenr < iuser.frames)) {
@@ -204,7 +204,7 @@ static int read_voxeldata_header(FILE *fp, struct VoxelData *vd)
 	VoxelDataHeader *h=(VoxelDataHeader *)MEM_mallocN(sizeof(VoxelDataHeader), "voxel data header");
 	
 	rewind(fp);
-	if(fread(h,sizeof(VoxelDataHeader),1,fp) != 1) {
+	if (fread(h,sizeof(VoxelDataHeader),1,fp) != 1) {
 		MEM_freeN(h);
 		return 0;
 	}
@@ -228,13 +228,12 @@ static void init_frame_smoke(VoxelData *vd, float cfra)
 	ob= vd->object;
 	
 	/* draw code for smoke */
-	if( (md = (ModifierData *)modifiers_findByType(ob, eModifierType_Smoke)) )
-	{
+	if ((md = (ModifierData *)modifiers_findByType(ob, eModifierType_Smoke))) {
 		SmokeModifierData *smd = (SmokeModifierData *)md;
 
 		
-		if(smd->domain && smd->domain->fluid) {
-			if(cfra < smd->domain->point_cache[0]->startframe)
+		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 (vd->smoked_type == TEX_VD_SMOKEHEAT) {
 				size_t totRes;
@@ -285,7 +284,8 @@ static void init_frame_smoke(VoxelData *vd, float cfra)
 				if (smd->domain->flags & MOD_SMOKE_HIGHRES) {
 					smoke_turbulence_get_res(smd->domain->wt, vd->resol);
 					density = smoke_turbulence_get_density(smd->domain->wt);
-				} else {
+				}
+				else {
 					copy_v3_v3_int(vd->resol, smd->domain->res);
 					density = smoke_get_density(smd->domain->fluid);
 				}
@@ -343,10 +343,10 @@ void cache_voxeldata(Tex *tex, int scene_frame)
 		case TEX_VD_BLENDERVOXEL:
 			BLI_path_abs(path, G.main->name);
 			if (!BLI_exists(path)) return;
-			fp = fopen(path,"rb");
+			fp = BLI_fopen(path,"rb");
 			if (!fp) return;
 			
-			if(read_voxeldata_header(fp, vd))
+			if (read_voxeldata_header(fp, vd))
 				load_frame_blendervoxel(vd, fp, curframe-1);
 
 			fclose(fp);
@@ -354,7 +354,7 @@ void cache_voxeldata(Tex *tex, int scene_frame)
 		case TEX_VD_RAW_8BIT:
 			BLI_path_abs(path, G.main->name);
 			if (!BLI_exists(path)) return;
-			fp = fopen(path,"rb");
+			fp = BLI_fopen(path,"rb");
 			if (!fp) return;
 			
 			load_frame_raw8(vd, fp, curframe);
@@ -372,7 +372,7 @@ void make_voxeldata(struct Render *re)
 	
 	/* XXX: should be doing only textures used in this render */
 	for (tex= re->main->tex.first; tex; tex= tex->id.next) {
-		if(tex->id.us && tex->type==TEX_VOXELDATA) {
+		if (tex->id.us && tex->type==TEX_VOXELDATA) {
 			cache_voxeldata(tex, re->r.cfra);
 		}
 	}
diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c
index 807a3d7..74c4bf1 100644
--- a/source/blender/render/intern/source/zbuf.c
+++ b/source/blender/render/intern/source/zbuf.c
@@ -101,9 +101,9 @@ void zbuf_alloc_span(ZSpan *zspan, int rectx, int recty, float clipcrop)
 
 void zbuf_free_span(ZSpan *zspan)
 {
-	if(zspan) {
-		if(zspan->span1) MEM_freeN(zspan->span1);
-		if(zspan->span2) MEM_freeN(zspan->span2);
+	if (zspan) {
+		if (zspan->span1) MEM_freeN(zspan->span1);
+		if (zspan->span2) MEM_freeN(zspan->span2);
 		zspan->span1= zspan->span2= NULL;
 	}
 }
@@ -122,7 +122,7 @@ static void zbuf_add_to_span(ZSpan *zspan, float *v1, float *v2)
 	float xx1, dx0, xs0;
 	int y, my0, my2;
 	
-	if(v1[1]<v2[1]) {
+	if (v1[1]<v2[1]) {
 		minv= v1; maxv= v2;
 	}
 	else {
@@ -132,18 +132,18 @@ static void zbuf_add_to_span(ZSpan *zspan, float *v1, float *v2)
 	my0= ceil(minv[1]);
 	my2= floor(maxv[1]);
 	
-	if(my2<0 || my0>= zspan->recty) return;
+	if (my2<0 || my0>= zspan->recty) return;
 	
 	/* clip top */
-	if(my2>=zspan->recty) my2= zspan->recty-1;
+	if (my2>=zspan->recty) my2= zspan->recty-1;
 	/* clip bottom */
-	if(my0<0) my0= 0;
+	if (my0<0) my0= 0;
 	
-	if(my0>my2) return;
-	/* if(my0>my2) should still fill in, that way we get spans that skip nicely */
+	if (my0>my2) return;
+	/* if (my0>my2) should still fill in, that way we get spans that skip nicely */
 	
 	xx1= maxv[1]-minv[1];
-	if(xx1>FLT_EPSILON) {
+	if (xx1>FLT_EPSILON) {
 		dx0= (minv[0]-maxv[0])/xx1;
 		xs0= dx0*(minv[1]-my2) + minv[0];
 	}
@@ -153,11 +153,11 @@ static void zbuf_add_to_span(ZSpan *zspan, float *v1, float *v2)
 	}
 	
 	/* empty span */
-	if(zspan->maxp1 == NULL) {
+	if (zspan->maxp1 == NULL) {
 		span= zspan->span1;
 	}
 	else {	/* does it complete left span? */
-		if( maxv == zspan->minp1 || minv==zspan->maxp1) {
+		if ( maxv == zspan->minp1 || minv==zspan->maxp1) {
 			span= zspan->span1;
 		}
 		else {
@@ -165,30 +165,30 @@ static void zbuf_add_to_span(ZSpan *zspan, float *v1, float *v2)
 		}
 	}
 
-	if(span==zspan->span1) {
+	if (span==zspan->span1) {
 //		printf("left span my0 %d my2 %d\n", my0, my2);
-		if(zspan->minp1==NULL || zspan->minp1[1] > minv[1] ) {
+		if (zspan->minp1==NULL || zspan->minp1[1] > minv[1] ) {
 			zspan->minp1= minv;
 		}
-		if(zspan->maxp1==NULL || zspan->maxp1[1] < maxv[1] ) {
+		if (zspan->maxp1==NULL || zspan->maxp1[1] < maxv[1] ) {
 			zspan->maxp1= maxv;
 		}
-		if(my0<zspan->miny1) zspan->miny1= my0;
-		if(my2>zspan->maxy1) zspan->maxy1= my2;
+		if (my0<zspan->miny1) zspan->miny1= my0;
+		if (my2>zspan->maxy1) zspan->maxy1= my2;
 	}
 	else {
 //		printf("right span my0 %d my2 %d\n", my0, my2);
-		if(zspan->minp2==NULL || zspan->minp2[1] > minv[1] ) {
+		if (zspan->minp2==NULL || zspan->minp2[1] > minv[1] ) {
 			zspan->minp2= minv;
 		}
-		if(zspan->maxp2==NULL || zspan->maxp2[1] < maxv[1] ) {
+		if (zspan->maxp2==NULL || zspan->maxp2[1] < maxv[1] ) {
 			zspan->maxp2= maxv;
 		}
-		if(my0<zspan->miny2) zspan->miny2= my0;
-		if(my2>zspan->maxy2) zspan->maxy2= my2;
+		if (my0<zspan->miny2) zspan->miny2= my0;
+		if (my2>zspan->maxy2) zspan->maxy2= my2;
 	}
 
-	for(y=my2; y>=my0; y--, xs0+= dx0) {
+	for (y=my2; y>=my0; y--, xs0+= dx0) {
 		/* xs0 is the xcoord! */
 		span[y]= xs0;
 	}
@@ -204,7 +204,7 @@ void fillrect(int *rect, int x, int y, int val)
 
 	len= x*y;
 	drect= rect;
-	while(len>0) {
+	while (len>0) {
 		len--;
 		*drect= val;
 		drect++;
@@ -216,24 +216,24 @@ static short cliptestf(float a, float b, float c, float d, float *u1, float *u2)
 {
 	float p= a + b, q= c + d, r;
 	
-	if(p<0.0f) {
-		if(q<p) return 0;
-		else if(q<0.0f) {
+	if (p<0.0f) {
+		if (q<p) return 0;
+		else if (q<0.0f) {
 			r= q/p;
-			if(r>*u2) return 0;
-			else if(r>*u1) *u1=r;
+			if (r>*u2) return 0;
+			else if (r>*u1) *u1=r;
 		}
 	}
 	else {
-		if(p>0.0f) {
-			if(q<0.0f) return 0;
-			else if(q<p) {
+		if (p>0.0f) {
+			if (q<0.0f) return 0;
+			else if (q<p) {
 				r= q/p;
-				if(r<*u1) return 0;
-				else if(r<*u2) *u2=r;
+				if (r<*u1) return 0;
+				else if (r<*u2) *u2=r;
 			}
 		}
-		else if(q<0.0f) return 0;
+		else if (q<0.0f) return 0;
 	}
 	return 1;
 }
@@ -244,17 +244,17 @@ int testclip(const float v[4])
 	short c=0;
 	
 	/* if we set clip flags, the clipping should be at least larger than epsilon. 
-	   prevents issues with vertices lying exact on borders */
+	 * prevents issues with vertices lying exact on borders */
 	abs4= fabsf(v[3]) + FLT_EPSILON;
 	
-	if( v[0] < -abs4) c+=1;
-	else if( v[0] > abs4) c+=2;
+	if ( v[0] < -abs4) c+=1;
+	else if ( v[0] > abs4) c+=2;
 	
-	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;
 	
-	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;
 	
 	return c;
 }
@@ -279,9 +279,9 @@ void freepsA(ListBase *lb)
 {
 	APixstrMain *psm, *psmnext;
 
-	for(psm= lb->first; psm; psm= psmnext) {
+	for (psm= lb->first; psm; psm= psmnext) {
 		psmnext= psm->next;
-		if(psm->ps)
+		if (psm->ps)
 			MEM_freeN(psm->ps);
 		MEM_freeN(psm);
 	}
@@ -290,7 +290,7 @@ void freepsA(ListBase *lb)
 static APixstr *addpsA(ZSpan *zspan)
 {
 	/* make new PS */
-	if(zspan->apsmcounter==0) {
+	if (zspan->apsmcounter==0) {
 		zspan->curpstr= addpsmainA(zspan->apsmbase);
 		zspan->apsmcounter= 4095;
 	}
@@ -317,7 +317,7 @@ static void zbuffillAc4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
 	/* set spans */
 	zbuf_add_to_span(zspan, v1, v2);
 	zbuf_add_to_span(zspan, v2, v3);
-	if(v4) {
+	if (v4) {
 		zbuf_add_to_span(zspan, v3, v4);
 		zbuf_add_to_span(zspan, v4, v1);
 	}
@@ -325,12 +325,12 @@ static void zbuffillAc4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
 		zbuf_add_to_span(zspan, v3, v1);
 	
 	/* clipped */
-	if(zspan->minp2==NULL || zspan->maxp2==NULL) return;
+	if (zspan->minp2==NULL || zspan->maxp2==NULL) return;
 
-	if(zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
-	if(zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
+	if (zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
+	if (zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
 	
-	if(my2<my0) return;
+	if (my2<my0) return;
 	
 	/* ZBUF DX DY, in floats still */
 	x1= v1[0]- v2[0];
@@ -343,7 +343,7 @@ static void zbuffillAc4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
 	y0= z1*x2-x1*z2;
 	z0= x1*y2-y1*x2;
 	
-	if(z0==0.0f) return;
+	if (z0==0.0f) return;
 	
 	xx1= (x0*v1[0] + y0*v1[1])/z0 + v1[2];
 	
@@ -360,7 +360,7 @@ static void zbuffillAc4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
 
 	/* correct span */
 	sn1= (my0 + my2)/2;
-	if(zspan->span1[sn1] < zspan->span2[sn1]) {
+	if (zspan->span1[sn1] < zspan->span2[sn1]) {
 		span1= zspan->span1+my2;
 		span2= zspan->span2+my2;
 	}
@@ -369,16 +369,16 @@ static void zbuffillAc4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
 		span2= zspan->span1+my2;
 	}
 	
-	for(y=my2; y>=my0; y--, span1--, span2--) {
+	for (y=my2; y>=my0; y--, span1--, span2--) {
 		
 		sn1= floor(*span1);
 		sn2= floor(*span2);
 		sn1++; 
 		
-		if(sn2>=rectx) sn2= rectx-1;
-		if(sn1<0) sn1= 0;
+		if (sn2>=rectx) sn2= rectx-1;
+		if (sn1<0) sn1= 0;
 		
-		if(sn2>=sn1) {
+		if (sn2>=sn1) {
 			int intzverg;
 			
 			zverg= (double)sn1*zxd + zy0;
@@ -389,23 +389,23 @@ static void zbuffillAc4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
 			
 			zverg-= zspan->polygon_offset;
 			
-			while(x>=0) {
+			while (x>=0) {
 				intzverg= (int)CLAMPIS(zverg, INT_MIN, INT_MAX);
 
-				if( intzverg < *rz) {
-					if(!zspan->rectmask || intzverg > *rm) {
+				if ( intzverg < *rz) {
+					if (!zspan->rectmask || intzverg > *rm) {
 						
 						apn= ap;
-						while(apn) {
-							if(apn->p[0]==0) {apn->obi[0]= obi; apn->p[0]= zvlnr; apn->z[0]= intzverg; apn->mask[0]= mask; break; }
-							if(apn->p[0]==zvlnr && apn->obi[0]==obi) {apn->mask[0]|= mask; break; }
-							if(apn->p[1]==0) {apn->obi[1]= obi; apn->p[1]= zvlnr; apn->z[1]= intzverg; apn->mask[1]= mask; break; }
-							if(apn->p[1]==zvlnr && apn->obi[1]==obi) {apn->mask[1]|= mask; break; }
-							if(apn->p[2]==0) {apn->obi[2]= obi; apn->p[2]= zvlnr; apn->z[2]= intzverg; apn->mask[2]= mask; break; }
-							if(apn->p[2]==zvlnr && apn->obi[2]==obi) {apn->mask[2]|= mask; break; }
-							if(apn->p[3]==0) {apn->obi[3]= obi; apn->p[3]= zvlnr; apn->z[3]= intzverg; apn->mask[3]= mask; break; }
-							if(apn->p[3]==zvlnr && apn->obi[3]==obi) {apn->mask[3]|= mask; break; }
-							if(apn->next==NULL) apn->next= addpsA(zspan);
+						while (apn) {
+							if (apn->p[0]==0) {apn->obi[0]= obi; apn->p[0]= zvlnr; apn->z[0]= intzverg; apn->mask[0]= mask; break; }
+							if (apn->p[0]==zvlnr && apn->obi[0]==obi) {apn->mask[0]|= mask; break; }
+							if (apn->p[1]==0) {apn->obi[1]= obi; apn->p[1]= zvlnr; apn->z[1]= intzverg; apn->mask[1]= mask; break; }
+							if (apn->p[1]==zvlnr && apn->obi[1]==obi) {apn->mask[1]|= mask; break; }
+							if (apn->p[2]==0) {apn->obi[2]= obi; apn->p[2]= zvlnr; apn->z[2]= intzverg; apn->mask[2]= mask; break; }
+							if (apn->p[2]==zvlnr && apn->obi[2]==obi) {apn->mask[2]|= mask; break; }
+							if (apn->p[3]==0) {apn->obi[3]= obi; apn->p[3]= zvlnr; apn->z[3]= intzverg; apn->mask[3]= mask; break; }
+							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;
 						}				
 					}
@@ -441,10 +441,10 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec
 	
 	mask= zspan->mask;
 	
-	if(fabs(dx) > fabs(dy)) {
+	if (fabs(dx) > fabs(dy)) {
 
 		/* all lines from left to right */
-		if(vec1[0]<vec2[0]) {
+		if (vec1[0]<vec2[0]) {
 			copy_v3_v3(v1, vec1);
 			copy_v3_v3(v2, vec2);
 		}
@@ -456,7 +456,7 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec
 
 		start= floor(v1[0]);
 		end= start+floor(dx);
-		if(end>=zspan->rectx) end= zspan->rectx-1;
+		if (end>=zspan->rectx) end= zspan->rectx-1;
 		
 		oldy= floor(v1[1]);
 		dy/= dx;
@@ -464,40 +464,40 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec
 		vergz= v1[2];
 		vergz-= zspan->polygon_offset;
 		dz= (v2[2]-v1[2])/dx;
-		if(vergz>0x50000000 && dz>0) maxtest= 1;		// prevent overflow
+		if (vergz>0x50000000 && dz>0) maxtest= 1;		// prevent overflow
 		
 		rectz= (int *)(zspan->arectz+zspan->rectx*(oldy) +start);
 		rectmask= (int *)(zspan->rectmask+zspan->rectx*(oldy) +start);
 		ap= (zspan->apixbuf+ zspan->rectx*(oldy) +start);
 
-		if(dy<0) ofs= -zspan->rectx;
+		if (dy<0) ofs= -zspan->rectx;
 		else ofs= zspan->rectx;
 		
-		for(x= start; x<=end; x++, rectz++, rectmask++, ap++) {
+		for (x= start; x<=end; x++, rectz++, rectmask++, ap++) {
 			
 			y= floor(v1[1]);
-			if(y!=oldy) {
+			if (y!=oldy) {
 				oldy= y;
 				rectz+= ofs;
 				rectmask+= ofs;
 				ap+= ofs;
 			}
 			
-			if(x>=0 && y>=0 && y<zspan->recty) {
-				if(vergz<*rectz) {
-					if(!zspan->rectmask || vergz>*rectmask) {
+			if (x>=0 && y>=0 && y<zspan->recty) {
+				if (vergz<*rectz) {
+					if (!zspan->rectmask || vergz>*rectmask) {
 					
 						apn= ap;
-						while(apn) {	/* loop unrolled */
-							if(apn->p[0]==0) {apn->obi[0]= obi; apn->p[0]= zvlnr; apn->z[0]= vergz; apn->mask[0]= mask; break; }
-							if(apn->p[0]==zvlnr && apn->obi[0]==obi) {apn->mask[0]|= mask; break; }
-							if(apn->p[1]==0) {apn->obi[1]= obi; apn->p[1]= zvlnr; apn->z[1]= vergz; apn->mask[1]= mask; break; }
-							if(apn->p[1]==zvlnr && apn->obi[1]==obi) {apn->mask[1]|= mask; break; }
-							if(apn->p[2]==0) {apn->obi[2]= obi; apn->p[2]= zvlnr; apn->z[2]= vergz; apn->mask[2]= mask; break; }
-							if(apn->p[2]==zvlnr && apn->obi[2]==obi) {apn->mask[2]|= mask; break; }
-							if(apn->p[3]==0) {apn->obi[3]= obi; apn->p[3]= zvlnr; apn->z[3]= vergz; apn->mask[3]= mask; break; }
-							if(apn->p[3]==zvlnr && apn->obi[3]==obi) {apn->mask[3]|= mask; break; }
-							if(apn->next==0) apn->next= addpsA(zspan);
+						while (apn) {	/* loop unrolled */
+							if (apn->p[0]==0) {apn->obi[0]= obi; apn->p[0]= zvlnr; apn->z[0]= vergz; apn->mask[0]= mask; break; }
+							if (apn->p[0]==zvlnr && apn->obi[0]==obi) {apn->mask[0]|= mask; break; }
+							if (apn->p[1]==0) {apn->obi[1]= obi; apn->p[1]= zvlnr; apn->z[1]= vergz; apn->mask[1]= mask; break; }
+							if (apn->p[1]==zvlnr && apn->obi[1]==obi) {apn->mask[1]|= mask; break; }
+							if (apn->p[2]==0) {apn->obi[2]= obi; apn->p[2]= zvlnr; apn->z[2]= vergz; apn->mask[2]= mask; break; }
+							if (apn->p[2]==zvlnr && apn->obi[2]==obi) {apn->mask[2]|= mask; break; }
+							if (apn->p[3]==0) {apn->obi[3]= obi; apn->p[3]= zvlnr; apn->z[3]= vergz; apn->mask[3]= mask; break; }
+							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;
 						}				
 					}
@@ -505,14 +505,14 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec
 			}
 			
 			v1[1]+= dy;
-			if(maxtest && (vergz > 0x7FFFFFF0 - dz)) vergz= 0x7FFFFFF0;
+			if (maxtest && (vergz > 0x7FFFFFF0 - dz)) vergz= 0x7FFFFFF0;
 			else vergz+= dz;
 		}
 	}
 	else {
 	
 		/* all lines from top to bottom */
-		if(vec1[1]<vec2[1]) {
+		if (vec1[1]<vec2[1]) {
 			copy_v3_v3(v1, vec1);
 			copy_v3_v3(v2, vec2);
 		}
@@ -525,9 +525,9 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec
 		start= floor(v1[1]);
 		end= start+floor(dy);
 		
-		if(start>=zspan->recty || end<0) return;
+		if (start>=zspan->recty || end<0) return;
 		
-		if(end>=zspan->recty) end= zspan->recty-1;
+		if (end>=zspan->recty) end= zspan->recty-1;
 		
 		oldx= floor(v1[0]);
 		dx/= dy;
@@ -535,40 +535,40 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec
 		vergz= v1[2];
 		vergz-= zspan->polygon_offset;
 		dz= (v2[2]-v1[2])/dy;
-		if(vergz>0x50000000 && dz>0) maxtest= 1;		// prevent overflow
+		if (vergz>0x50000000 && dz>0) maxtest= 1;		// prevent overflow
 
 		rectz= (int *)( zspan->arectz+ (start)*zspan->rectx+ oldx );
 		rectmask= (int *)( zspan->rectmask+ (start)*zspan->rectx+ oldx );
 		ap= (zspan->apixbuf+ zspan->rectx*(start) +oldx);
 				
-		if(dx<0) ofs= -1;
+		if (dx<0) ofs= -1;
 		else ofs= 1;
 
-		for(y= start; y<=end; y++, rectz+=zspan->rectx, rectmask+=zspan->rectx, ap+=zspan->rectx) {
+		for (y= start; y<=end; y++, rectz+=zspan->rectx, rectmask+=zspan->rectx, ap+=zspan->rectx) {
 			
 			x= floor(v1[0]);
-			if(x!=oldx) {
+			if (x!=oldx) {
 				oldx= x;
 				rectz+= ofs;
 				rectmask+= ofs;
 				ap+= ofs;
 			}
 			
-			if(x>=0 && y>=0 && x<zspan->rectx) {
-				if(vergz<*rectz) {
-					if(!zspan->rectmask || vergz>*rectmask) {
+			if (x>=0 && y>=0 && x<zspan->rectx) {
+				if (vergz<*rectz) {
+					if (!zspan->rectmask || vergz>*rectmask) {
 						
 						apn= ap;
-						while(apn) {	/* loop unrolled */
-							if(apn->p[0]==0) {apn->obi[0]= obi; apn->p[0]= zvlnr; apn->z[0]= vergz; apn->mask[0]= mask; break; }
-							if(apn->p[0]==zvlnr) {apn->mask[0]|= mask; break; }
-							if(apn->p[1]==0) {apn->obi[1]= obi; apn->p[1]= zvlnr; apn->z[1]= vergz; apn->mask[1]= mask; break; }
-							if(apn->p[1]==zvlnr) {apn->mask[1]|= mask; break; }
-							if(apn->p[2]==0) {apn->obi[2]= obi; apn->p[2]= zvlnr; apn->z[2]= vergz; apn->mask[2]= mask; break; }
-							if(apn->p[2]==zvlnr) {apn->mask[2]|= mask; break; }
-							if(apn->p[3]==0) {apn->obi[3]= obi; apn->p[3]= zvlnr; apn->z[3]= vergz; apn->mask[3]= mask; break; }
-							if(apn->p[3]==zvlnr) {apn->mask[3]|= mask; break; }
-							if(apn->next==0) apn->next= addpsA(zspan);
+						while (apn) {	/* loop unrolled */
+							if (apn->p[0]==0) {apn->obi[0]= obi; apn->p[0]= zvlnr; apn->z[0]= vergz; apn->mask[0]= mask; break; }
+							if (apn->p[0]==zvlnr) {apn->mask[0]|= mask; break; }
+							if (apn->p[1]==0) {apn->obi[1]= obi; apn->p[1]= zvlnr; apn->z[1]= vergz; apn->mask[1]= mask; break; }
+							if (apn->p[1]==zvlnr) {apn->mask[1]|= mask; break; }
+							if (apn->p[2]==0) {apn->obi[2]= obi; apn->p[2]= zvlnr; apn->z[2]= vergz; apn->mask[2]= mask; break; }
+							if (apn->p[2]==zvlnr) {apn->mask[2]|= mask; break; }
+							if (apn->p[3]==0) {apn->obi[3]= obi; apn->p[3]= zvlnr; apn->z[3]= vergz; apn->mask[3]= mask; break; }
+							if (apn->p[3]==zvlnr) {apn->mask[3]|= mask; break; }
+							if (apn->next==0) apn->next= addpsA(zspan);
 							apn= apn->next;
 						}	
 					}
@@ -576,7 +576,7 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec
 			}
 			
 			v1[0]+= dx;
-			if(maxtest && (vergz > 0x7FFFFFF0 - dz)) vergz= 0x7FFFFFF0;
+			if (maxtest && (vergz > 0x7FFFFFF0 - dz)) vergz= 0x7FFFFFF0;
 			else vergz+= dz;
 		}
 	}
@@ -595,10 +595,10 @@ static void zbufline(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec2)
 	dx= vec2[0]-vec1[0];
 	dy= vec2[1]-vec1[1];
 	
-	if(fabs(dx) > fabs(dy)) {
+	if (fabs(dx) > fabs(dy)) {
 
 		/* all lines from left to right */
-		if(vec1[0]<vec2[0]) {
+		if (vec1[0]<vec2[0]) {
 			copy_v3_v3(v1, vec1);
 			copy_v3_v3(v2, vec2);
 		}
@@ -610,27 +610,27 @@ static void zbufline(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec2)
 
 		start= floor(v1[0]);
 		end= start+floor(dx);
-		if(end>=zspan->rectx) end= zspan->rectx-1;
+		if (end>=zspan->rectx) end= zspan->rectx-1;
 		
 		oldy= floor(v1[1]);
 		dy/= dx;
 		
 		vergz= floor(v1[2]);
 		dz= floor((v2[2]-v1[2])/dx);
-		if(vergz>0x50000000 && dz>0) maxtest= 1;		// prevent overflow
+		if (vergz>0x50000000 && dz>0) maxtest= 1;		// prevent overflow
 		
 		rectz= zspan->rectz + oldy*zspan->rectx+ start;
 		rectp= zspan->rectp + oldy*zspan->rectx+ start;
 		recto= zspan->recto + oldy*zspan->rectx+ start;
 		rectmask= zspan->rectmask + oldy*zspan->rectx+ start;
 		
-		if(dy<0) ofs= -zspan->rectx;
+		if (dy<0) ofs= -zspan->rectx;
 		else ofs= zspan->rectx;
 		
-		for(x= start; x<=end; x++, rectz++, rectp++, recto++, rectmask++) {
+		for (x= start; x<=end; x++, rectz++, rectp++, recto++, rectmask++) {
 			
 			y= floor(v1[1]);
-			if(y!=oldy) {
+			if (y!=oldy) {
 				oldy= y;
 				rectz+= ofs;
 				rectp+= ofs;
@@ -638,9 +638,9 @@ static void zbufline(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec2)
 				rectmask+= ofs;
 			}
 			
-			if(x>=0 && y>=0 && y<zspan->recty) {
-				if(vergz<*rectz) {
-					if(!zspan->rectmask || vergz>*rectmask) {
+			if (x>=0 && y>=0 && y<zspan->recty) {
+				if (vergz<*rectz) {
+					if (!zspan->rectmask || vergz>*rectmask) {
 						*recto= obi;
 						*rectz= vergz;
 						*rectp= zvlnr;
@@ -650,13 +650,13 @@ static void zbufline(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec2)
 			
 			v1[1]+= dy;
 			
-			if(maxtest && (vergz > 0x7FFFFFF0 - dz)) vergz= 0x7FFFFFF0;
+			if (maxtest && (vergz > 0x7FFFFFF0 - dz)) vergz= 0x7FFFFFF0;
 			else vergz+= dz;
 		}
 	}
 	else {
 		/* all lines from top to bottom */
-		if(vec1[1]<vec2[1]) {
+		if (vec1[1]<vec2[1]) {
 			copy_v3_v3(v1, vec1);
 			copy_v3_v3(v2, vec2);
 		}
@@ -669,27 +669,27 @@ static void zbufline(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec2)
 		start= floor(v1[1]);
 		end= start+floor(dy);
 		
-		if(end>=zspan->recty) end= zspan->recty-1;
+		if (end>=zspan->recty) end= zspan->recty-1;
 		
 		oldx= floor(v1[0]);
 		dx/= dy;
 		
 		vergz= floor(v1[2]);
 		dz= floor((v2[2]-v1[2])/dy);
-		if(vergz>0x50000000 && dz>0) maxtest= 1;		// prevent overflow
+		if (vergz>0x50000000 && dz>0) maxtest= 1;		// prevent overflow
 		
 		rectz= zspan->rectz + start*zspan->rectx+ oldx;
 		rectp= zspan->rectp + start*zspan->rectx+ oldx;
 		recto= zspan->recto + start*zspan->rectx+ oldx;
 		rectmask= zspan->rectmask + start*zspan->rectx+ oldx;
 		
-		if(dx<0) ofs= -1;
+		if (dx<0) ofs= -1;
 		else ofs= 1;
 
-		for(y= start; y<=end; y++, rectz+=zspan->rectx, rectp+=zspan->rectx, recto+=zspan->rectx, rectmask+=zspan->rectx) {
+		for (y= start; y<=end; y++, rectz+=zspan->rectx, rectp+=zspan->rectx, recto+=zspan->rectx, rectmask+=zspan->rectx) {
 			
 			x= floor(v1[0]);
-			if(x!=oldx) {
+			if (x!=oldx) {
 				oldx= x;
 				rectz+= ofs;
 				rectp+= ofs;
@@ -697,9 +697,9 @@ static void zbufline(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec2)
 				rectmask+= ofs;
 			}
 			
-			if(x>=0 && y>=0 && x<zspan->rectx) {
-				if(vergz<*rectz) {
-					if(!zspan->rectmask || vergz>*rectmask) {
+			if (x>=0 && y>=0 && x<zspan->rectx) {
+				if (vergz<*rectz) {
+					if (!zspan->rectmask || vergz>*rectmask) {
 						*rectz= vergz;
 						*rectp= zvlnr;
 						*recto= obi;
@@ -708,7 +708,7 @@ static void zbufline(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec2)
 			}
 			
 			v1[0]+= dx;
-			if(maxtest && (vergz > 0x7FFFFFF0 - dz)) vergz= 0x7FFFFFF0;
+			if (maxtest && (vergz > 0x7FFFFFF0 - dz)) vergz= 0x7FFFFFF0;
 			else vergz+= dz;
 		}
 	}
@@ -725,10 +725,10 @@ static void zbufline_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), flo
 	dx= vec2[0]-vec1[0];
 	dy= vec2[1]-vec1[1];
 	
-	if(fabs(dx) > fabs(dy)) {
+	if (fabs(dx) > fabs(dy)) {
 		
 		/* all lines from left to right */
-		if(vec1[0]<vec2[0]) {
+		if (vec1[0]<vec2[0]) {
 			copy_v3_v3(v1, vec1);
 			copy_v3_v3(v2, vec2);
 		}
@@ -740,51 +740,51 @@ static void zbufline_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), flo
 		
 		start= floor(v1[0]);
 		end= start+floor(dx);
-		if(end>=zspan->rectx) end= zspan->rectx-1;
+		if (end>=zspan->rectx) end= zspan->rectx-1;
 		
 		oldy= floor(v1[1]);
 		dy/= dx;
 		
 		vergz= floor(v1[2]);
 		dz= floor((v2[2]-v1[2])/dx);
-		if(vergz>0x50000000 && dz>0) maxtest= 1;		// prevent overflow
+		if (vergz>0x50000000 && dz>0) maxtest= 1;		// prevent overflow
 		
 		rectz= zspan->rectz + oldy*zspan->rectx+ start;
-		if(zspan->rectz1)
+		if (zspan->rectz1)
 			rectz1= zspan->rectz1 + oldy*zspan->rectx+ start;
 		
-		if(dy<0) ofs= -zspan->rectx;
+		if (dy<0) ofs= -zspan->rectx;
 		else ofs= zspan->rectx;
 		
-		for(x= start; x<=end; x++, rectz++) {
+		for (x= start; x<=end; x++, rectz++) {
 			
 			y= floor(v1[1]);
-			if(y!=oldy) {
+			if (y!=oldy) {
 				oldy= y;
 				rectz+= ofs;
-				if(rectz1) rectz1+= ofs;
+				if (rectz1) rectz1+= ofs;
 			}
 			
-			if(x>=0 && y>=0 && y<zspan->recty) {
-				if(vergz < *rectz) {
-					if(rectz1) *rectz1= *rectz;
+			if (x>=0 && y>=0 && y<zspan->recty) {
+				if (vergz < *rectz) {
+					if (rectz1) *rectz1= *rectz;
 					*rectz= vergz;
 				}
-				else if(rectz1 && vergz < *rectz1)
+				else if (rectz1 && vergz < *rectz1)
 					*rectz1= vergz;
 			}
 			
 			v1[1]+= dy;
 			
-			if(maxtest && (vergz > 0x7FFFFFF0 - dz)) vergz= 0x7FFFFFF0;
+			if (maxtest && (vergz > 0x7FFFFFF0 - dz)) vergz= 0x7FFFFFF0;
 			else vergz+= dz;
 			
-			if(rectz1) rectz1++;
+			if (rectz1) rectz1++;
 		}
 	}
 	else {
 		/* all lines from top to bottom */
-		if(vec1[1]<vec2[1]) {
+		if (vec1[1]<vec2[1]) {
 			copy_v3_v3(v1, vec1);
 			copy_v3_v3(v2, vec2);
 		}
@@ -797,45 +797,45 @@ static void zbufline_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), flo
 		start= floor(v1[1]);
 		end= start+floor(dy);
 		
-		if(end>=zspan->recty) end= zspan->recty-1;
+		if (end>=zspan->recty) end= zspan->recty-1;
 		
 		oldx= floor(v1[0]);
 		dx/= dy;
 		
 		vergz= floor(v1[2]);
 		dz= floor((v2[2]-v1[2])/dy);
-		if(vergz>0x50000000 && dz>0) maxtest= 1;		// prevent overflow
+		if (vergz>0x50000000 && dz>0) maxtest= 1;		// prevent overflow
 		
 		rectz= zspan->rectz + start*zspan->rectx+ oldx;
-		if(zspan->rectz1)
+		if (zspan->rectz1)
 			rectz1= zspan->rectz1 + start*zspan->rectx+ oldx;
 		
-		if(dx<0) ofs= -1;
+		if (dx<0) ofs= -1;
 		else ofs= 1;
 		
-		for(y= start; y<=end; y++, rectz+=zspan->rectx) {
+		for (y= start; y<=end; y++, rectz+=zspan->rectx) {
 			
 			x= floor(v1[0]);
-			if(x!=oldx) {
+			if (x!=oldx) {
 				oldx= x;
 				rectz+= ofs;
-				if(rectz1) rectz1+= ofs;
+				if (rectz1) rectz1+= ofs;
 			}
 			
-			if(x>=0 && y>=0 && x<zspan->rectx) {
-				if(vergz < *rectz) {
-					if(rectz1) *rectz1= *rectz;
+			if (x>=0 && y>=0 && x<zspan->rectx) {
+				if (vergz < *rectz) {
+					if (rectz1) *rectz1= *rectz;
 					*rectz= vergz;
 				}
-				else if(rectz1 && vergz < *rectz1)
+				else if (rectz1 && vergz < *rectz1)
 					*rectz1= vergz;
 			}
 			
 			v1[0]+= dx;
-			if(maxtest && (vergz > 0x7FFFFFF0 - dz)) vergz= 0x7FFFFFF0;
+			if (maxtest && (vergz > 0x7FFFFFF0 - dz)) vergz= 0x7FFFFFF0;
 			else vergz+= dz;
 			
-			if(rectz1)
+			if (rectz1)
 				rectz1+=zspan->rectx;
 		}
 	}
@@ -851,31 +851,31 @@ static int clipline(float v1[4], float v2[4])	/* return 0: do not draw */
 	dw= v2[3]-v1[3];
 	
 	/* this 1.01 is for clipping x and y just a tinsy larger. that way it is
-		filled in with zbufwire correctly when rendering in parts. otherwise
-		you see line endings at edges... */
+	 * filled in with zbufwire correctly when rendering in parts. otherwise
+	 * you see line endings at edges... */
 	
-	if(cliptestf(-dz, -dw, v1[3], v1[2], &u1,&u2)) {
-		if(cliptestf(dz, -dw, v1[3], -v1[2], &u1,&u2)) {
+	if (cliptestf(-dz, -dw, v1[3], v1[2], &u1,&u2)) {
+		if (cliptestf(dz, -dw, v1[3], -v1[2], &u1,&u2)) {
 			
 			dx= v2[0]-v1[0];
 			dz= 1.01f*(v2[3]-v1[3]);
 			v13= 1.01f*v1[3];
 			
-			if(cliptestf(-dx, -dz, v1[0], v13, &u1,&u2)) {
-				if(cliptestf(dx, -dz, v13, -v1[0], &u1,&u2)) {
+			if (cliptestf(-dx, -dz, v1[0], v13, &u1,&u2)) {
+				if (cliptestf(dx, -dz, v13, -v1[0], &u1,&u2)) {
 					
 					dy= v2[1]-v1[1];
 					
-					if(cliptestf(-dy, -dz, v1[1], v13, &u1,&u2)) {
-						if(cliptestf(dy, -dz, v13, -v1[1], &u1,&u2)) {
+					if (cliptestf(-dy, -dz, v1[1], v13, &u1,&u2)) {
+						if (cliptestf(dy, -dz, v13, -v1[1], &u1,&u2)) {
 							
-							if(u2<1.0f) {
+							if (u2<1.0f) {
 								v2[0]= v1[0]+u2*dx;
 								v2[1]= v1[1]+u2*dy;
 								v2[2]= v1[2]+u2*dz;
 								v2[3]= v1[3]+u2*dw;
 							}
-							if(u1>0.0f) {
+							if (u1>0.0f) {
 								v1[0]= v1[0]+u1*dx;
 								v1[1]= v1[1]+u1*dy;
 								v1[2]= v1[2]+u1*dz;
@@ -908,9 +908,9 @@ void zbufclipwire(ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, float *h
 	int and, or;
 
 	/* edgecode: 1= draw */
-	if(ec==0) return;
+	if (ec==0) return;
 
-	if(ho4) {
+	if (ho4) {
 		and= (c1 & c2 & c3 & c4);
 		or= (c1 | c2 | c3 | c4);
 	}
@@ -919,44 +919,44 @@ void zbufclipwire(ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, float *h
 		or= (c1 | c2 | c3);
 	}
 	
-	if(or) {	/* not in the middle */
-		if(and) {	/* out completely */
+	if (or) {	/* not in the middle */
+		if (and) {	/* out completely */
 			return;
 		}
 		else {	/* clipping */
 
-			if(ec & ME_V1V2) {
+			if (ec & ME_V1V2) {
 				copy_v4_v4(vez, ho1);
 				copy_v4_v4(vez+4, ho2);
-				if( clipline(vez, vez+4)) {
+				if ( clipline(vez, vez+4)) {
 					hoco_to_zco(zspan, vez, vez);
 					hoco_to_zco(zspan, vez+4, vez+4);
 					zspan->zbuflinefunc(zspan, obi, zvlnr, vez, vez+4);
 				}
 			}
-			if(ec & ME_V2V3) {
+			if (ec & ME_V2V3) {
 				copy_v4_v4(vez, ho2);
 				copy_v4_v4(vez+4, ho3);
-				if( clipline(vez, vez+4)) {
+				if ( clipline(vez, vez+4)) {
 					hoco_to_zco(zspan, vez, vez);
 					hoco_to_zco(zspan, vez+4, vez+4);
 					zspan->zbuflinefunc(zspan, obi, zvlnr, vez, vez+4);
 				}
 			}
-			if(ho4) {
-				if(ec & ME_V3V4) {
+			if (ho4) {
+				if (ec & ME_V3V4) {
 					copy_v4_v4(vez, ho3);
 					copy_v4_v4(vez+4, ho4);
-					if( clipline(vez, vez+4)) {
+					if ( clipline(vez, vez+4)) {
 						hoco_to_zco(zspan, vez, vez);
 						hoco_to_zco(zspan, vez+4, vez+4);
 						zspan->zbuflinefunc(zspan, obi, zvlnr, vez, vez+4);
 					}
 				}
-				if(ec & ME_V4V1) {
+				if (ec & ME_V4V1) {
 					copy_v4_v4(vez, ho4);
 					copy_v4_v4(vez+4, ho1);
-					if( clipline(vez, vez+4)) {
+					if ( clipline(vez, vez+4)) {
 						hoco_to_zco(zspan, vez, vez);
 						hoco_to_zco(zspan, vez+4, vez+4);
 						zspan->zbuflinefunc(zspan, obi, zvlnr, vez, vez+4);
@@ -964,10 +964,10 @@ void zbufclipwire(ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, float *h
 				}
 			}
 			else {
-				if(ec & ME_V3V1) {
+				if (ec & ME_V3V1) {
 					copy_v4_v4(vez, ho3);
 					copy_v4_v4(vez+4, ho1);
-					if( clipline(vez, vez+4)) {
+					if ( clipline(vez, vez+4)) {
 						hoco_to_zco(zspan, vez, vez);
 						hoco_to_zco(zspan, vez+4, vez+4);
 						zspan->zbuflinefunc(zspan, obi, zvlnr, vez, vez+4);
@@ -982,18 +982,18 @@ void zbufclipwire(ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, float *h
 	hoco_to_zco(zspan, vez, ho1);
 	hoco_to_zco(zspan, vez+4, ho2);
 	hoco_to_zco(zspan, vez+8, ho3);
-	if(ho4) {
+	if (ho4) {
 		hoco_to_zco(zspan, vez+12, ho4);
 
-		if(ec & ME_V3V4)  zspan->zbuflinefunc(zspan, obi, zvlnr, vez+8, vez+12);
-		if(ec & ME_V4V1)  zspan->zbuflinefunc(zspan, obi, zvlnr, vez+12, vez);
+		if (ec & ME_V3V4)  zspan->zbuflinefunc(zspan, obi, zvlnr, vez+8, vez+12);
+		if (ec & ME_V4V1)  zspan->zbuflinefunc(zspan, obi, zvlnr, vez+12, vez);
 	}
 	else {
-		if(ec & ME_V3V1)  zspan->zbuflinefunc(zspan, obi, zvlnr, vez+8, vez);
+		if (ec & ME_V3V1)  zspan->zbuflinefunc(zspan, obi, zvlnr, vez+8, vez);
 	}
 
-	if(ec & ME_V1V2)  zspan->zbuflinefunc(zspan, obi, zvlnr, vez, vez+4);
-	if(ec & ME_V2V3)  zspan->zbuflinefunc(zspan, obi, zvlnr, vez+4, vez+8);
+	if (ec & ME_V1V2)  zspan->zbuflinefunc(zspan, obi, zvlnr, vez, vez+4);
+	if (ec & ME_V2V3)  zspan->zbuflinefunc(zspan, obi, zvlnr, vez+4, vez+8);
 
 }
 
@@ -1005,12 +1005,12 @@ void zbufsinglewire(ZSpan *zspan, int obi, int zvlnr, const float ho1[4], const
 	c1= testclip(ho1);
 	c2= testclip(ho2);
 
-	if(c1 | c2) {	/* not in the middle */
-		if(!(c1 & c2)) {	/* not out completely */
+	if (c1 | c2) {	/* not in the middle */
+		if (!(c1 & c2)) {	/* not out completely */
 			copy_v4_v4(f1, ho1);
 			copy_v4_v4(f2, ho2);
 
-			if(clipline(f1, f2)) {
+			if (clipline(f1, f2)) {
 				hoco_to_zco(zspan, f1, f1);
 				hoco_to_zco(zspan, f2, f2);
 				zspan->zbuflinefunc(zspan, obi, zvlnr, f1, f2);
@@ -1032,9 +1032,9 @@ void zbufsinglewire(ZSpan *zspan, int obi, int zvlnr, const float ho1[4], const
  * This is one of the z buffer fill functions called in zbufclip() and
  * zbufwireclip(). 
  *
- * @param v1 [4 floats, world coordinates] first vertex
- * @param v2 [4 floats, world coordinates] second vertex
- * @param v3 [4 floats, world coordinates] third vertex
+ * \param v1 [4 floats, world coordinates] first vertex
+ * \param v2 [4 floats, world coordinates] second vertex
+ * \param v3 [4 floats, world coordinates] third vertex
  */
 
 /* WATCH IT: zbuffillGLinv4 and zbuffillGL4 are identical except for a 2 lines,
@@ -1057,7 +1057,7 @@ static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v
 	/* set spans */
 	zbuf_add_to_span(zspan, v1, v2);
 	zbuf_add_to_span(zspan, v2, v3);
-	if(v4) {
+	if (v4) {
 		zbuf_add_to_span(zspan, v3, v4);
 		zbuf_add_to_span(zspan, v4, v1);
 	}
@@ -1065,13 +1065,13 @@ static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v
 		zbuf_add_to_span(zspan, v3, v1);
 
 	/* clipped */
-	if(zspan->minp2==NULL || zspan->maxp2==NULL) return;
+	if (zspan->minp2==NULL || zspan->maxp2==NULL) return;
 
-	if(zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
-	if(zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
+	if (zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
+	if (zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
 
 	//	printf("my %d %d\n", my0, my2);
-	if(my2<my0) return;
+	if (my2<my0) return;
 
 
 	/* ZBUF DX DY, in floats still */
@@ -1085,7 +1085,7 @@ static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v
 	y0= z1*x2-x1*z2;
 	z0= x1*y2-y1*x2;
 
-	if(z0==0.0f) return;
+	if (z0==0.0f) return;
 
 	xx1= (x0*v1[0] + y0*v1[1])/z0 + v1[2];
 
@@ -1102,7 +1102,7 @@ static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v
 
 	/* correct span */
 	sn1= (my0 + my2)/2;
-	if(zspan->span1[sn1] < zspan->span2[sn1]) {
+	if (zspan->span1[sn1] < zspan->span2[sn1]) {
 		span1= zspan->span1+my2;
 		span2= zspan->span2+my2;
 	}
@@ -1111,16 +1111,16 @@ static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v
 		span2= zspan->span1+my2;
 	}
 
-	for(y=my2; y>=my0; y--, span1--, span2--) {
+	for (y=my2; y>=my0; y--, span1--, span2--) {
 
 		sn1= floor(*span1);
 		sn2= floor(*span2);
 		sn1++;
 
-		if(sn2>=rectx) sn2= rectx-1;
-		if(sn1<0) sn1= 0;
+		if (sn2>=rectx) sn2= rectx-1;
+		if (sn1<0) sn1= 0;
 
-		if(sn2>=sn1) {
+		if (sn2>=sn1) {
 			int intzverg;
 
 			zverg= (double)sn1*zxd + zy0;
@@ -1130,11 +1130,11 @@ static void zbuffillGLinv4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v
 			rm= rectmaskofs+sn1;
 			x= sn2-sn1;
 
-			while(x>=0) {
+			while (x>=0) {
 				intzverg= (int)CLAMPIS(zverg, INT_MIN, INT_MAX);
 
-				if( intzverg > *rz || *rz==0x7FFFFFFF) { /* UNIQUE LINE: see comment above */
-					if(!zspan->rectmask || intzverg > *rm) {
+				if ( intzverg > *rz || *rz==0x7FFFFFFF) { /* UNIQUE LINE: see comment above */
+					if (!zspan->rectmask || intzverg > *rm) {
 						*ro= obi; /* UNIQUE LINE: see comment above (order differs) */
 						*rz= intzverg;
 						*rp= zvlnr;
@@ -1179,7 +1179,7 @@ static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
 	/* set spans */
 	zbuf_add_to_span(zspan, v1, v2);
 	zbuf_add_to_span(zspan, v2, v3);
-	if(v4) {
+	if (v4) {
 		zbuf_add_to_span(zspan, v3, v4);
 		zbuf_add_to_span(zspan, v4, v1);
 	}
@@ -1187,13 +1187,13 @@ static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
 		zbuf_add_to_span(zspan, v3, v1);
 
 	/* clipped */
-	if(zspan->minp2==NULL || zspan->maxp2==NULL) return;
+	if (zspan->minp2==NULL || zspan->maxp2==NULL) return;
 
-	if(zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
-	if(zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
+	if (zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
+	if (zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
 
 	//	printf("my %d %d\n", my0, my2);
-	if(my2<my0) return;
+	if (my2<my0) return;
 
 
 	/* ZBUF DX DY, in floats still */
@@ -1207,7 +1207,7 @@ static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
 	y0= z1*x2-x1*z2;
 	z0= x1*y2-y1*x2;
 
-	if(z0==0.0f) return;
+	if (z0==0.0f) return;
 
 	xx1= (x0*v1[0] + y0*v1[1])/z0 + v1[2];
 
@@ -1224,7 +1224,7 @@ static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
 
 	/* correct span */
 	sn1= (my0 + my2)/2;
-	if(zspan->span1[sn1] < zspan->span2[sn1]) {
+	if (zspan->span1[sn1] < zspan->span2[sn1]) {
 		span1= zspan->span1+my2;
 		span2= zspan->span2+my2;
 	}
@@ -1233,16 +1233,16 @@ static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
 		span2= zspan->span1+my2;
 	}
 
-	for(y=my2; y>=my0; y--, span1--, span2--) {
+	for (y=my2; y>=my0; y--, span1--, span2--) {
 
 		sn1= floor(*span1);
 		sn2= floor(*span2);
 		sn1++;
 
-		if(sn2>=rectx) sn2= rectx-1;
-		if(sn1<0) sn1= 0;
+		if (sn2>=rectx) sn2= rectx-1;
+		if (sn1<0) sn1= 0;
 
-		if(sn2>=sn1) {
+		if (sn2>=sn1) {
 			int intzverg;
 
 			zverg= (double)sn1*zxd + zy0;
@@ -1252,11 +1252,11 @@ static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
 			rm= rectmaskofs+sn1;
 			x= sn2-sn1;
 
-			while(x>=0) {
+			while (x>=0) {
 				intzverg= (int)CLAMPIS(zverg, INT_MIN, INT_MAX);
 
-				if(intzverg < *rz) { /* ONLY UNIQUE LINE: see comment above */
-					if(!zspan->rectmask || intzverg > *rm) {
+				if (intzverg < *rz) { /* ONLY UNIQUE LINE: see comment above */
+					if (!zspan->rectmask || intzverg > *rm) {
 						*rz= intzverg;
 						*rp= zvlnr;
 						*ro= obi; /* UNIQUE LINE: see comment above (order differs) */
@@ -1285,9 +1285,9 @@ static void zbuffillGL4(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
  * This is one of the z buffer fill functions called in zbufclip() and
  * zbufwireclip(). 
  *
- * @param v1 [4 floats, world coordinates] first vertex
- * @param v2 [4 floats, world coordinates] second vertex
- * @param v3 [4 floats, world coordinates] third vertex
+ * \param v1 [4 floats, world coordinates] first vertex
+ * \param v2 [4 floats, world coordinates] second vertex
+ * \param v3 [4 floats, world coordinates] third vertex
  */
 
 /* now: filling two Z values, the closest and 2nd closest */
@@ -1306,7 +1306,7 @@ static void zbuffillGL_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), f
 	/* set spans */
 	zbuf_add_to_span(zspan, v1, v2);
 	zbuf_add_to_span(zspan, v2, v3);
-	if(v4) {
+	if (v4) {
 		zbuf_add_to_span(zspan, v3, v4);
 		zbuf_add_to_span(zspan, v4, v1);
 	}
@@ -1314,13 +1314,13 @@ static void zbuffillGL_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), f
 		zbuf_add_to_span(zspan, v3, v1);
 	
 	/* clipped */
-	if(zspan->minp2==NULL || zspan->maxp2==NULL) return;
+	if (zspan->minp2==NULL || zspan->maxp2==NULL) return;
 	
-	if(zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
-	if(zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
+	if (zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
+	if (zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
 	
 	//	printf("my %d %d\n", my0, my2);
-	if(my2<my0) return;
+	if (my2<my0) return;
 	
 	
 	/* ZBUF DX DY, in floats still */
@@ -1334,7 +1334,7 @@ static void zbuffillGL_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), f
 	y0= z1*x2-x1*z2;
 	z0= x1*y2-y1*x2;
 	
-	if(z0==0.0f) return;
+	if (z0==0.0f) return;
 	
 	xx1= (x0*v1[0] + y0*v1[1])/z0 + v1[2];
 	
@@ -1345,12 +1345,12 @@ static void zbuffillGL_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), f
 	/* start-offset in rect */
 	rectx= zspan->rectx;
 	rectzofs= (zspan->rectz+rectx*my2);
-	if(zspan->rectz1)
+	if (zspan->rectz1)
 		rectzofs1= (zspan->rectz1+rectx*my2);
 	
 	/* correct span */
 	sn1= (my0 + my2)/2;
-	if(zspan->span1[sn1] < zspan->span2[sn1]) {
+	if (zspan->span1[sn1] < zspan->span2[sn1]) {
 		span1= zspan->span1+my2;
 		span2= zspan->span2+my2;
 	}
@@ -1359,30 +1359,30 @@ static void zbuffillGL_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), f
 		span2= zspan->span1+my2;
 	}
 	
-	for(y=my2; y>=my0; y--, span1--, span2--) {
+	for (y=my2; y>=my0; y--, span1--, span2--) {
 		
 		sn1= floor(*span1);
 		sn2= floor(*span2);
 		sn1++; 
 		
-		if(sn2>=rectx) sn2= rectx-1;
-		if(sn1<0) sn1= 0;
+		if (sn2>=rectx) sn2= rectx-1;
+		if (sn1<0) sn1= 0;
 		
-		if(sn2>=sn1) {
+		if (sn2>=sn1) {
 			zverg= (double)sn1*zxd + zy0;
 			rz= rectzofs+sn1;
 			rz1= rectzofs1+sn1;
 			x= sn2-sn1;
 			
-			while(x>=0) {
+			while (x>=0) {
 				int zvergi= (int)CLAMPIS(zverg, INT_MIN, INT_MAX);
 
 				/* option: maintain two depth values, closest and 2nd closest */
-				if(zvergi < *rz) {
-					if(rectzofs1) *rz1= *rz;
+				if (zvergi < *rz) {
+					if (rectzofs1) *rz1= *rz;
 					*rz= zvergi;
 				}
-				else if(rectzofs1 && zvergi < *rz1)
+				else if (rectzofs1 && zvergi < *rz1)
 					*rz1= zvergi;
 
 				zverg+= zxd;
@@ -1395,7 +1395,7 @@ static void zbuffillGL_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), f
 		
 		zy0-=zyd;
 		rectzofs-= rectx;
-		if(rectzofs1) rectzofs1-= rectx;
+		if (rectzofs1) rectzofs1-= rectx;
 	}
 }
 
@@ -1416,13 +1416,13 @@ void zspan_scanconvert_strand(ZSpan *zspan, void *handle, float *v1, float *v2,
 	zbuf_add_to_span(zspan, v3, v1);
 	
 	/* clipped */
-	if(zspan->minp2==NULL || zspan->maxp2==NULL) return;
+	if (zspan->minp2==NULL || zspan->maxp2==NULL) return;
 	
-	if(zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
-	if(zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
+	if (zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
+	if (zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
 	
 	//	printf("my %d %d\n", my0, my2);
-	if(my2<my0) return;
+	if (my2<my0) return;
 	
 	/* ZBUF DX DY, in floats still */
 	x1= v1[0]- v2[0];
@@ -1436,7 +1436,7 @@ void zspan_scanconvert_strand(ZSpan *zspan, void *handle, float *v1, float *v2,
 	y0= z1*x2-x1*z2;
 	z0= x1*y2-y1*x2;
 	
-	if(z0==0.0f) return;
+	if (z0==0.0f) return;
 
 	xx1= (x0*v1[0] + y0*v1[1])/z0 + v1[2];
 	zxd= -(double)x0/(double)z0;
@@ -1467,7 +1467,7 @@ void zspan_scanconvert_strand(ZSpan *zspan, void *handle, float *v1, float *v2,
 	
 	/* correct span */
 	sn1= (my0 + my2)/2;
-	if(zspan->span1[sn1] < zspan->span2[sn1]) {
+	if (zspan->span1[sn1] < zspan->span2[sn1]) {
 		span1= zspan->span1+my2;
 		span2= zspan->span2+my2;
 	}
@@ -1476,20 +1476,20 @@ void zspan_scanconvert_strand(ZSpan *zspan, void *handle, float *v1, float *v2,
 		span2= zspan->span1+my2;
 	}
 	
-	for(y=my2; y>=my0; y--, span1--, span2--) {
+	for (y=my2; y>=my0; y--, span1--, span2--) {
 		
 		sn1= floor(*span1);
 		sn2= floor(*span2);
 		sn1++; 
 		
-		if(sn2>=rectx) sn2= rectx-1;
-		if(sn1<0) sn1= 0;
+		if (sn2>=rectx) sn2= rectx-1;
+		if (sn1<0) sn1= 0;
 		
 		u= (double)sn1*uxd + uy0;
 		v= (double)sn1*vxd + vy0;
 		z= (double)sn1*zxd + zy0;
 		
-		for(x= sn1; x<=sn2; x++, u+=uxd, v+=vxd, z+=zxd)
+		for (x= sn1; x<=sn2; x++, u+=uxd, v+=vxd, z+=zxd)
 			func(handle, x, y, u, v, z);
 		
 		uy0 -= uyd;
@@ -1516,13 +1516,13 @@ void zspan_scanconvert(ZSpan *zspan, void *handle, float *v1, float *v2, float *
 	zbuf_add_to_span(zspan, v3, v1);
 	
 	/* clipped */
-	if(zspan->minp2==NULL || zspan->maxp2==NULL) return;
+	if (zspan->minp2==NULL || zspan->maxp2==NULL) return;
 	
-	if(zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
-	if(zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
+	if (zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
+	if (zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
 	
 	//	printf("my %d %d\n", my0, my2);
-	if(my2<my0) return;
+	if (my2<my0) return;
 	
 	/* ZBUF DX DY, in floats still */
 	x1= v1[0]- v2[0];
@@ -1537,7 +1537,7 @@ void zspan_scanconvert(ZSpan *zspan, void *handle, float *v1, float *v2, float *
 	y0= z1*x2-x1*z2;
 	z0= x1*y2-y1*x2;
 	
-	if(z0==0.0f) return;
+	if (z0==0.0f) return;
 	
 	xx1= (x0*v1[0] + y0*v1[1])/z0 + 1.0f;	
 	uxd= -(double)x0/(double)z0;
@@ -1557,7 +1557,7 @@ void zspan_scanconvert(ZSpan *zspan, void *handle, float *v1, float *v2, float *
 	
 	/* correct span */
 	sn1= (my0 + my2)/2;
-	if(zspan->span1[sn1] < zspan->span2[sn1]) {
+	if (zspan->span1[sn1] < zspan->span2[sn1]) {
 		span1= zspan->span1+my2;
 		span2= zspan->span2+my2;
 	}
@@ -1566,19 +1566,19 @@ void zspan_scanconvert(ZSpan *zspan, void *handle, float *v1, float *v2, float *
 		span2= zspan->span1+my2;
 	}
 	
-	for(y=my2; y>=my0; y--, span1--, span2--) {
+	for (y=my2; y>=my0; y--, span1--, span2--) {
 		
 		sn1= floor(*span1);
 		sn2= floor(*span2);
 		sn1++; 
 		
-		if(sn2>=rectx) sn2= rectx-1;
-		if(sn1<0) sn1= 0;
+		if (sn2>=rectx) sn2= rectx-1;
+		if (sn1<0) sn1= 0;
 		
 		u= (double)sn1*uxd + uy0;
 		v= (double)sn1*vxd + vy0;
 		
-		for(x= sn1; x<=sn2; x++, u+=uxd, v+=vxd)
+		for (x= sn1; x<=sn2; x++, u+=uxd, v+=vxd)
 			func(handle, x, y, u, v);
 		
 		uy0 -= uyd;
@@ -1591,15 +1591,14 @@ void zspan_scanconvert(ZSpan *zspan, void *handle, float *v1, float *v2, float *
 /**
  * (clip pyramid)
  * Sets labda: flag, and parametrize the clipping of vertices in
- * viewspace coordinates. labda = -1 means no clipping, labda in [0,
-	 * 1] means a clipping.
+ * viewspace coordinates. labda = -1 means no clipping, labda in [0, 1] means a clipping.
  * Note: uses globals.
- * @param v1 start coordinate s
- * @param v2 target coordinate t
- * @param b1 
- * @param b2 
- * @param b3
- * @param a index for coordinate (x, y, or z)
+ * \param v1 start coordinate s
+ * \param v2 target coordinate t
+ * \param b1 
+ * \param b2 
+ * \param b3
+ * \param a index for coordinate (x, y, or z)
  */
 
 static void clippyra(float *labda, float *v1, float *v2, int *b2, int *b3, int a, float clipcrop)
@@ -1613,7 +1612,7 @@ static void clippyra(float *labda, float *v1, float *v2, int *b2, int *b3, int a
 	da= v2[a]-v1[a];
 	/* prob; we clip slightly larger, osa renders add 2 pixels on edges, should become variable? */
 	/* or better; increase r.winx/y size, but thats quite a complex one. do it later */
-	if(a==2) {
+	if (a==2) {
 		dw= (v2[3]-v1[3]);
 		v13= v1[3];
 	}
@@ -1628,18 +1627,21 @@ static void clippyra(float *labda, float *v1, float *v2, int *b2, int *b3, int a
 	 * who would have thought that of L&B!
 	 */
 
-	if(cliptestf(-da, -dw, v13, v1[a], &u1,&u2)) {
-		if(cliptestf(da, -dw, v13, -v1[a], &u1,&u2)) {
+	if (cliptestf(-da, -dw, v13, v1[a], &u1,&u2)) {
+		if (cliptestf(da, -dw, v13, -v1[a], &u1,&u2)) {
 			*b3=1;
-			if(u2<1.0f) {
+			if (u2<1.0f) {
 				labda[1]= u2;
 				*b2=1;
 			}
 			else labda[1]=1.0;  /* u2 */
-			if(u1>0.0f) {
-				labda[0]= u1;
-				*b2=1;
-			} else labda[0]=0.0;
+			if (u1>0.0f) {
+				labda[0] = u1;
+				*b2 = 1;
+			}
+			else {
+				labda[0] = 0.0;
+			}
 		}
 	}
 }
@@ -1652,11 +1654,11 @@ static void clippyra(float *labda, float *v1, float *v2, int *b2, int *b3, int a
  * vertex list of this face.
  * 
  * 
- * @param v1 start coordinate s
- * @param v2 target coordinate t
- * @param b1 
- * @param b2 
- * @param clve vertex vector.
+ * \param v1 start coordinate s
+ * \param v2 target coordinate t
+ * \param b1 
+ * \param b2 
+ * \param clve vertex vector.
  */
 
 static void makevertpyra(float *vez, float *labda, float **trias, float *v1, float *v2, int *b1, int *clve)
@@ -1666,8 +1668,8 @@ static void makevertpyra(float *vez, float *labda, float **trias, float *v1, flo
 	l1= labda[0];
 	l2= labda[1];
 
-	if(l1!= -1.0f) {
-		if(l1!= 0.0f) {
+	if (l1!= -1.0f) {
+		if (l1!= 0.0f) {
 			adr= vez+4*(*clve);
 			trias[*b1]=adr;
 			(*clve)++;
@@ -1680,8 +1682,8 @@ static void makevertpyra(float *vez, float *labda, float **trias, float *v1, flo
 		
 		(*b1)++;
 	}
-	if(l2!= -1.0f) {
-		if(l2!= 1.0f) {
+	if (l2!= -1.0f) {
+		if (l2!= 1.0f) {
 			adr= vez+4*(*clve);
 			trias[*b1]=adr;
 			(*clve)++;
@@ -1741,11 +1743,11 @@ static void zbuf_project_cache_clear(ZbufProjectCache *cache, int size)
 {
 	int i;
 
-	if(size > ZBUF_PROJECT_CACHE_SIZE)
+	if (size > ZBUF_PROJECT_CACHE_SIZE)
 		size= ZBUF_PROJECT_CACHE_SIZE;
 
 	memset(cache, 0, sizeof(ZbufProjectCache)*size);
-	for(i=0; i<size; i++)
+	for (i=0; i<size; i++)
 		cache[i].index= -1;
 }
 
@@ -1753,7 +1755,7 @@ static int zbuf_shadow_project(ZbufProjectCache *cache, int index, float winmat[
 {
 	int cindex= index & 255;
 
-	if(cache[cindex].index == index) {
+	if (cache[cindex].index == index) {
 		copy_v4_v4(ho, cache[cindex].ho);
 		return cache[cindex].clip;
 	}
@@ -1783,7 +1785,7 @@ static int zbuf_part_project(ZbufProjectCache *cache, int index, float winmat[][
 	float vec[3];
 	int cindex= index & 255;
 
-	if(cache[cindex].index == index) {
+	if (cache[cindex].index == index) {
 		copy_v4_v4(ho, cache[cindex].ho);
 		return cache[cindex].clip;
 	}
@@ -1794,10 +1796,10 @@ static int zbuf_part_project(ZbufProjectCache *cache, int index, float winmat[][
 		projectvert(co, winmat, ho);
 
 		wco= ho[3];
-		if(ho[0] < bounds[0]*wco) clipflag |= 1;
-		else if(ho[0] > bounds[1]*wco) clipflag |= 2;
-		if(ho[1] > bounds[3]*wco) clipflag |= 4;
-		else if(ho[1] < bounds[2]*wco) clipflag |= 8;
+		if (ho[0] < bounds[0]*wco) clipflag |= 1;
+		else if (ho[0] > bounds[1]*wco) clipflag |= 2;
+		if (ho[1] > bounds[3]*wco) clipflag |= 4;
+		else if (ho[1] < bounds[2]*wco) clipflag |= 8;
 
 		copy_v4_v4(cache[cindex].ho, ho);
 		cache[cindex].clip= clipflag;
@@ -1817,7 +1819,7 @@ void zbuf_render_project(float winmat[][4], const float co[3], float ho[4])
 
 void zbuf_make_winmat(Render *re, float winmat[][4])
 {
-	if(re->r.mode & R_PANORAMA) {
+	if (re->r.mode & R_PANORAMA) {
 		float panomat[4][4]= MAT4_UNITY;
 
 		panomat[0][0]= re->panoco;
@@ -1838,10 +1840,11 @@ void zbufclip(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3,
 	float *vlzp[32][3], labda[3][2];
 	float vez[400], *trias[40];
 	
-	if(c1 | c2 | c3) {	/* not in middle */
-		if(c1 & c2 & c3) {	/* completely out */
+	if (c1 | c2 | c3) {	/* not in middle */
+		if (c1 & c2 & c3) {	/* completely out */
 			return;
-		} else {	/* clipping */
+		}
+		else {	/* clipping */
 			int arg, v, b, clipflag[3], b1, b2, b3, c4, clve=3, clvlo, clvl=1;
 
 			vez[0]= f1[0]; vez[1]= f1[1]; vez[2]= f1[2]; vez[3]= f1[3];
@@ -1853,24 +1856,24 @@ void zbufclip(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3,
 			vlzp[0][2]= vez+8;
 
 			clipflag[0]= ( (c1 & 48) | (c2 & 48) | (c3 & 48) );
-			if(clipflag[0]==0) {	/* othwerwise it needs to be calculated again, after the first (z) clip */
+			if (clipflag[0]==0) {	/* othwerwise it needs to be calculated again, after the first (z) clip */
 				clipflag[1]= ( (c1 & 3) | (c2 & 3) | (c3 & 3) );
 				clipflag[2]= ( (c1 & 12) | (c2 & 12) | (c3 & 12) );
 			}
 			else clipflag[1]=clipflag[2]= 0;
 			
-			for(b=0;b<3;b++) {
+			for (b=0;b<3;b++) {
 				
-				if(clipflag[b]) {
+				if (clipflag[b]) {
 				
 					clvlo= clvl;
 					
-					for(v=0; v<clvlo; v++) {
+					for (v=0; v<clvlo; v++) {
 					
-						if(vlzp[v][0]!=NULL) {	/* face is still there */
+						if (vlzp[v][0]!=NULL) {	/* face is still there */
 							b2= b3 =0;	/* clip flags */
 
-							if(b==0) arg= 2;
+							if (b==0) arg= 2;
 							else if (b==1) arg= 0;
 							else arg= 1;
 							
@@ -1878,27 +1881,29 @@ void zbufclip(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3,
 							clippyra(labda[1], vlzp[v][1],vlzp[v][2], &b2,&b3, arg, zspan->clipcrop);
 							clippyra(labda[2], vlzp[v][2],vlzp[v][0], &b2,&b3, arg, zspan->clipcrop);
 
-							if(b2==0 && b3==1) {
-								/* completely 'in', but we copy because of last for() loop in this section */;
+							if (b2==0 && b3==1) {
+								/* completely 'in', but we copy because of last for () loop in this section */;
 								vlzp[clvl][0]= vlzp[v][0];
 								vlzp[clvl][1]= vlzp[v][1];
 								vlzp[clvl][2]= vlzp[v][2];
 								vlzp[v][0]= NULL;
 								clvl++;
-							} else if(b3==0) {
+							}
+							else if (b3==0) {
 								vlzp[v][0]= NULL;
 								/* completely 'out' */;
-							} else {
+							}
+							else {
 								b1=0;
 								makevertpyra(vez, labda[0], trias, vlzp[v][0],vlzp[v][1], &b1,&clve);
 								makevertpyra(vez, labda[1], trias, vlzp[v][1],vlzp[v][2], &b1,&clve);
 								makevertpyra(vez, labda[2], trias, vlzp[v][2],vlzp[v][0], &b1,&clve);
 
 								/* after front clip done: now set clip flags */
-								if(b==0) {
+								if (b==0) {
 									clipflag[1]= clipflag[2]= 0;
 									f1= vez;
-									for(b3=0; b3<clve; b3++) {
+									for (b3=0; b3<clve; b3++) {
 										c4= testclip(f1);
 										clipflag[1] |= (c4 & 3);
 										clipflag[2] |= (c4 & 12);
@@ -1907,8 +1912,8 @@ void zbufclip(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3,
 								}
 								
 								vlzp[v][0]= NULL;
-								if(b1>2) {
-									for(b3=3; b3<=b1; b3++) {
+								if (b1>2) {
+									for (b3=3; b3<=b1; b3++) {
 										vlzp[clvl][0]= trias[0];
 										vlzp[clvl][1]= trias[b3-2];
 										vlzp[clvl][2]= trias[b3-1];
@@ -1922,16 +1927,16 @@ void zbufclip(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3,
 			}
 
 			/* warning, this should never happen! */
-			if(clve>38 || clvl>31) printf("clip overflow: clve clvl %d %d\n",clve,clvl);
+			if (clve>38 || clvl>31) printf("clip overflow: clve clvl %d %d\n",clve,clvl);
 
 			/* perspective division */
 			f1=vez;
-			for(c1=0;c1<clve;c1++) {
+			for (c1=0;c1<clve;c1++) {
 				hoco_to_zco(zspan, f1, f1);
 				f1+=4;
 			}
-			for(b=1;b<clvl;b++) {
-				if(vlzp[b][0]) {
+			for (b=1;b<clvl;b++) {
+				if (vlzp[b][0]) {
 					zspan->zbuffunc(zspan, obi, zvlnr, vlzp[b][0],vlzp[b][1],vlzp[b][2], NULL);
 				}
 			}
@@ -1950,10 +1955,11 @@ void zbufclip4(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3
 {
 	float vez[16];
 	
-	if(c1 | c2 | c3 | c4) {	/* not in middle */
-		if(c1 & c2 & c3 & c4) {	/* completely out */
+	if (c1 | c2 | c3 | c4) {	/* not in middle */
+		if (c1 & c2 & c3 & c4) {	/* completely out */
 			return;
-		} else {	/* clipping */
+		}
+		else {	/* clipping */
 			zbufclip(zspan, obi, zvlnr, f1, f2, f3, c1, c2, c3);
 			zbufclip(zspan, obi, zvlnr, f1, f3, f4, c1, c3, c4);
 		}
@@ -1971,7 +1977,7 @@ void zbufclip4(ZSpan *zspan, int obi, int zvlnr, float *f1, float *f2, float *f3
 
 /* ************** ZMASK ******************************** */
 
-#define EXTEND_PIXEL(a)	if(temprectp[a]) {z+= rectz[a]; tot++;}
+#define EXTEND_PIXEL(a)	if (temprectp[a]) {z+= rectz[a]; tot++;}
 
 /* changes the zbuffer to be ready for z-masking: applies an extend-filter, and then clears */
 static void zmask_rect(int *rectz, int *rectp, int xs, int ys, int neg)
@@ -1984,21 +1990,21 @@ static void zmask_rect(int *rectz, int *rectp, int xs, int ys, int neg)
 	
 	/* extend: if pixel is not filled in, we check surrounding pixels and average z value  */
 	
-	for(y=1; y<=ys; y++) {
+	for (y=1; y<=ys; y++) {
 		/* setup row indices */
 		row1= (y-2)*xs;
 		row2= row1 + xs;
 		row3= row2 + xs;
-		if(y==1)
+		if (y==1)
 			row1= row2;
-		else if(y==ys)
+		else if (y==ys)
 			row3= row2;
 		
 		curp= rectp + (y-1)*xs;
 		curz= rectz + (y-1)*xs;
 		
-		for(x=0; x<xs; x++, curp++, curz++) {
-			if(curp[0]==0) {
+		for (x=0; x<xs; x++, curp++, curz++) {
+			if (curp[0]==0) {
 				int tot= 0;
 				float z= 0.0f;
 				
@@ -2007,19 +2013,19 @@ static void zmask_rect(int *rectz, int *rectp, int xs, int ys, int neg)
 				EXTEND_PIXEL(row3);
 				EXTEND_PIXEL(row1 + 1);
 				EXTEND_PIXEL(row3 + 1);
-				if(x!=xs-1) {
+				if (x!=xs-1) {
 					EXTEND_PIXEL(row1 + 2);
 					EXTEND_PIXEL(row2 + 2);
 					EXTEND_PIXEL(row3 + 2);
 				}					
-				if(tot) {
+				if (tot) {
 					len++;
 					curz[0]= (int)(z/(float)tot);
 					curp[0]= -1;	/* env */
 				}
 			}
 			
-			if(x!=0) {
+			if (x!=0) {
 				row1++; row2++; row3++;
 			}
 		}
@@ -2027,11 +2033,11 @@ static void zmask_rect(int *rectz, int *rectp, int xs, int ys, int neg)
 
 	MEM_freeN(temprectp);
 	
-	if(neg); /* z values for negative are already correct */
+	if (neg); /* z values for negative are already correct */
 	else {
 		/* clear not filled z values */
-		for(len= xs*ys -1; len>=0; len--) {
-			if(rectp[len]==0) {
+		for (len= xs*ys -1; len>=0; len--) {
+			if (rectp[len]==0) {
 				rectz[len] = -0x7FFFFFFF;
 				rectp[len]= -1;	/* env code */
 			}	
@@ -2066,7 +2072,7 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart*,
 	samples= (R.osa? R.osa: 1);
 	samples= MIN2(4, samples-pa->sample);
 
-	for(zsample=0; zsample<samples; zsample++) {
+	for (zsample=0; zsample<samples; zsample++) {
 		zspan= &zspans[zsample];
 
 		zbuffer_part_bounds(R.winx, R.winy, pa, bounds);
@@ -2076,11 +2082,11 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart*,
 		zspan->zmulx= ((float)R.winx)/2.0f;
 		zspan->zmuly= ((float)R.winy)/2.0f;
 		
-		if(R.osa) {
+		if (R.osa) {
 			zspan->zofsx= -pa->disprect.xmin - R.jit[pa->sample+zsample][0];
 			zspan->zofsy= -pa->disprect.ymin - R.jit[pa->sample+zsample][1];
 		}
-		else if(R.i.curblur) {
+		else if (R.i.curblur) {
 			zspan->zofsx= -pa->disprect.xmin - R.mblur_jit[R.i.curblur-1][0];
 			zspan->zofsy= -pa->disprect.ymin - R.mblur_jit[R.i.curblur-1][1];
 		}
@@ -2093,11 +2099,11 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart*,
 		zspan->zofsy -= 0.5f;
 		
 		/* the buffers */
-		if(zsample == samples-1) {
+		if (zsample == samples-1) {
 			zspan->rectp= pa->rectp;
 			zspan->recto= pa->recto;
 
-			if(neg_zmask)
+			if (neg_zmask)
 				zspan->rectz= pa->rectmask;
 			else
 				zspan->rectz= pa->rectz;
@@ -2114,17 +2120,17 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart*,
 	}
 
 	/* in case zmask we fill Z for objects in lay_zmask first, then clear Z, and then do normal zbuffering */
-	if(rl->layflag & SCE_LAY_ZMASK)
+	if (rl->layflag & SCE_LAY_ZMASK)
 		zmaskpass= 1;
 	
-	for(; zmaskpass >=0; zmaskpass--) {
+	for (; zmaskpass >=0; zmaskpass--) {
 		ma= NULL;
 
 		/* filling methods */
-		for(zsample=0; zsample<samples; zsample++) {
+		for (zsample=0; zsample<samples; zsample++) {
 			zspan= &zspans[zsample];
 
-			if(zmaskpass && neg_zmask)
+			if (zmaskpass && neg_zmask)
 				zspan->zbuffunc= zbuffillGLinv4;
 			else
 				zspan->zbuffunc= zbuffillGL4;
@@ -2132,48 +2138,48 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart*,
 		}
 
 		/* regular zbuffering loop, does all sample buffers */
-		for(i=0, obi=R.instancetable.first; obi; i++, obi=obi->next) {
+		for (i=0, obi=R.instancetable.first; obi; i++, obi=obi->next) {
 			obr= obi->obr;
 
 			/* continue happens in 2 different ways... zmaskpass only does lay_zmask stuff */
-			if(zmaskpass) {
-				if((obi->lay & lay_zmask)==0)
+			if (zmaskpass) {
+				if ((obi->lay & lay_zmask)==0)
 					continue;
 			}
-			else if(!all_z && !(obi->lay & (lay|lay_zmask)))
+			else if (!all_z && !(obi->lay & (lay|lay_zmask)))
 				continue;
 			
-			if(obi->flag & R_TRANSFORMED)
+			if (obi->flag & R_TRANSFORMED)
 				mult_m4_m4m4(obwinmat, winmat, obi->mat);
 			else
 				copy_m4_m4(obwinmat, winmat);
 
-			if(clip_render_object(obi->obr->boundbox, bounds, obwinmat))
+			if (clip_render_object(obi->obr->boundbox, bounds, obwinmat))
 				continue;
 
 			zbuf_project_cache_clear(cache, obr->totvert);
 
-			for(v=0; v<obr->totvlak; v++) {
-				if((v & 255)==0) vlr= obr->vlaknodes[v>>8].vlak;
+			for (v=0; v<obr->totvlak; v++) {
+				if ((v & 255)==0) vlr= obr->vlaknodes[v>>8].vlak;
 				else vlr++;
 
 				/* the cases: visible for render, only z values, zmask, nothing */
-				if(obi->lay & lay) {
-					if(vlr->mat!=ma) {
+				if (obi->lay & lay) {
+					if (vlr->mat!=ma) {
 						ma= vlr->mat;
 						nofill= (ma->mode & MA_ONLYCAST) || ((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP));
 						env= (ma->mode & MA_ENV);
 						wire= (ma->material_type == MA_TYPE_WIRE);
 						
-						for(zsample=0; zsample<samples; zsample++) {
-							if(ma->mode & MA_ZINV || (zmaskpass && neg_zmask))
+						for (zsample=0; zsample<samples; zsample++) {
+							if (ma->mode & MA_ZINV || (zmaskpass && neg_zmask))
 								zspans[zsample].zbuffunc= zbuffillGLinv4;
 							else
 								zspans[zsample].zbuffunc= zbuffillGL4;
 						}
 					}
 				}
-				else if(all_z || (obi->lay & lay_zmask)) {
+				else if (all_z || (obi->lay & lay_zmask)) {
 					env= 1;
 					nofill= 0;
 					ma= NULL; 
@@ -2183,7 +2189,7 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart*,
 					ma= NULL;	/* otherwise nofill can hang */
 				}
 
-				if(!(vlr->flag & R_HIDDEN) && nofill==0) {
+				if (!(vlr->flag & R_HIDDEN) && nofill==0) {
 					unsigned short partclip;
 					
 					v1= vlr->v1;
@@ -2197,39 +2203,39 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart*,
 
 					/* partclipping doesn't need viewplane clipping */
 					partclip= c1 & c2 & c3;
-					if(v4) {
+					if (v4) {
 						c4= zbuf_part_project(cache, v4->index, obwinmat, bounds, v4->co, ho4);
 						partclip &= c4;
 					}
 
-					if(partclip==0) {
+					if (partclip==0) {
 						
-						if(env) zvlnr= -1;
+						if (env) zvlnr= -1;
 						else zvlnr= v+1;
 
 						c1= testclip(ho1);
 						c2= testclip(ho2);
 						c3= testclip(ho3);
-						if(v4)
+						if (v4)
 							c4= testclip(ho4);
 
-						for(zsample=0; zsample<samples; zsample++) {
+						for (zsample=0; zsample<samples; zsample++) {
 							zspan= &zspans[zsample];
 
-							if(wire) {
-								if(v4)
+							if (wire) {
+								if (v4)
 									zbufclipwire(zspan, i, zvlnr, vlr->ec, ho1, ho2, ho3, ho4, c1, c2, c3, c4);
 								else
 									zbufclipwire(zspan, i, zvlnr, vlr->ec, ho1, ho2, ho3, 0, c1, c2, c3, 0);
 							}
 							else {
 								/* strands allow to be filled in as quad */
-								if(v4 && (vlr->flag & R_STRAND)) {
+								if (v4 && (vlr->flag & R_STRAND)) {
 									zbufclip4(zspan, i, zvlnr, ho1, ho2, ho3, ho4, c1, c2, c3, c4);
 								}
 								else {
 									zbufclip(zspan, i, zvlnr, ho1, ho2, ho3, c1, c2, c3);
-									if(v4)
+									if (v4)
 										zbufclip(zspan, i, (env)? zvlnr: zvlnr+RE_QUAD_OFFS, ho1, ho3, ho4, c1, c3, c4);
 								}
 							}
@@ -2240,13 +2246,13 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart*,
 		}
 		
 		/* clear all z to close value, so it works as mask for next passes (ztra+strand) */
-		if(zmaskpass) {
-			for(zsample=0; zsample<samples; zsample++) {
+		if (zmaskpass) {
+			for (zsample=0; zsample<samples; zsample++) {
 				zspan= &zspans[zsample];
 
-				if(neg_zmask) {
+				if (neg_zmask) {
 					zspan->rectmask= zspan->rectz;
-					if(zsample == samples-1)
+					if (zsample == samples-1)
 						zspan->rectz= pa->rectz;
 					else
 						zspan->rectz= MEM_mallocN(sizeof(int)*pa->rectx*pa->recty, "rectz");
@@ -2260,17 +2266,17 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart*,
 		}
 	}
 
-	for(zsample=0; zsample<samples; zsample++) {
+	for (zsample=0; zsample<samples; zsample++) {
 		zspan= &zspans[zsample];
 
-		if(fillfunc)
+		if (fillfunc)
 			fillfunc(pa, zspan, pa->sample+zsample, data);
 
-		if(zsample != samples-1) {
+		if (zsample != samples-1) {
 			MEM_freeN(zspan->rectz);
 			MEM_freeN(zspan->rectp);
 			MEM_freeN(zspan->recto);
-			if(zspan->rectmask)
+			if (zspan->rectmask)
 				MEM_freeN(zspan->rectmask);
 		}
 
@@ -2293,7 +2299,7 @@ void zbuffer_shadow(Render *re, float winmat[][4], LampRen *lar, int *rectz, int
 	float obwinmat[4][4], ho1[4], ho2[4], ho3[4], ho4[4];
 	int a, b, c, i, c1, c2, c3, c4, ok=1, lay= -1;
 
-	if(lar->mode & (LA_LAYER|LA_LAYER_SHADOW)) lay= lar->lay;
+	if (lar->mode & (LA_LAYER|LA_LAYER_SHADOW)) lay= lar->lay;
 
 	/* 1.0f for clipping in clippyra()... bad stuff actually */
 	zbuf_alloc_span(&zspan, size, size, 1.0f);
@@ -2306,7 +2312,7 @@ void zbuffer_shadow(Render *re, float winmat[][4], LampRen *lar, int *rectz, int
 	/* the buffers */
 	zspan.rectz= rectz;
 	fillrect(rectz, size, size, 0x7FFFFFFE);
-	if(lar->buftype==LA_SHADBUF_HALFWAY) {
+	if (lar->buftype==LA_SHADBUF_HALFWAY) {
 		zspan.rectz1= MEM_mallocN(size*size*sizeof(int), "seconday z buffer");
 		fillrect(zspan.rectz1, size, size, 0x7FFFFFFE);
 	}
@@ -2315,44 +2321,44 @@ void zbuffer_shadow(Render *re, float winmat[][4], LampRen *lar, int *rectz, int
 	zspan.zbuflinefunc= zbufline_onlyZ;
 	zspan.zbuffunc= zbuffillGL_onlyZ;
 
-	for(i=0, obi=re->instancetable.first; obi; i++, obi=obi->next) {
+	for (i=0, obi=re->instancetable.first; obi; i++, obi=obi->next) {
 		obr= obi->obr;
 
-		if(obr->ob==re->excludeob)
+		if (obr->ob==re->excludeob)
 			continue;
-		else if(!(obi->lay & lay))
+		else if (!(obi->lay & lay))
 			continue;
 
-		if(obi->flag & R_TRANSFORMED)
+		if (obi->flag & R_TRANSFORMED)
 			mult_m4_m4m4(obwinmat, winmat, obi->mat);
 		else
 			copy_m4_m4(obwinmat, winmat);
 
-		if(clip_render_object(obi->obr->boundbox, NULL, obwinmat))
+		if (clip_render_object(obi->obr->boundbox, NULL, obwinmat))
 			continue;
 
 		zbuf_project_cache_clear(cache, obr->totvert);
 
 		/* faces */
-		for(a=0; a<obr->totvlak; a++) {
+		for (a=0; a<obr->totvlak; a++) {
 
-			if((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
+			if ((a & 255)==0) vlr= obr->vlaknodes[a>>8].vlak;
 			else vlr++;
 
 			/* note, these conditions are copied in shadowbuf_autoclip() */
-			if(vlr->mat!= ma) {
+			if (vlr->mat!= ma) {
 				ma= vlr->mat;
 				ok= 1;
-				if((ma->mode & MA_SHADBUF)==0) ok= 0;
+				if ((ma->mode & MA_SHADBUF)==0) ok= 0;
 			}
 
-			if(ok && (obi->lay & lay) && !(vlr->flag & R_HIDDEN)) {
+			if (ok && (obi->lay & lay) && !(vlr->flag & R_HIDDEN)) {
 				c1= zbuf_shadow_project(cache, vlr->v1->index, obwinmat, vlr->v1->co, ho1);
 				c2= zbuf_shadow_project(cache, vlr->v2->index, obwinmat, vlr->v2->co, ho2);
 				c3= zbuf_shadow_project(cache, vlr->v3->index, obwinmat, vlr->v3->co, ho3);
 
-				if((ma->material_type == MA_TYPE_WIRE) || (vlr->flag & R_STRAND)) {
-					if(vlr->v4) {
+				if ((ma->material_type == MA_TYPE_WIRE) || (vlr->flag & R_STRAND)) {
+					if (vlr->v4) {
 						c4= zbuf_shadow_project(cache, vlr->v4->index, obwinmat, vlr->v4->co, ho4);
 						zbufclipwire(&zspan, 0, a+1, vlr->ec, ho1, ho2, ho3, ho4, c1, c2, c3, c4);
 					}
@@ -2360,7 +2366,7 @@ void zbuffer_shadow(Render *re, float winmat[][4], LampRen *lar, int *rectz, int
 						zbufclipwire(&zspan, 0, a+1, vlr->ec, ho1, ho2, ho3, 0, c1, c2, c3, 0);
 				}
 				else {
-					if(vlr->v4) {
+					if (vlr->v4) {
 						c4= zbuf_shadow_project(cache, vlr->v4->index, obwinmat, vlr->v4->co, ho4);
 						zbufclip4(&zspan, 0, 0, ho1, ho2, ho3, ho4, c1, c2, c3, c4);
 					}
@@ -2369,20 +2375,20 @@ void zbuffer_shadow(Render *re, float winmat[][4], LampRen *lar, int *rectz, int
 				}
 			}
 
-			if((a & 255)==255 && re->test_break(re->tbh)) 
+			if ((a & 255)==255 && re->test_break(re->tbh)) 
 				break;
 		}
 
 		/* strands */
-		if(obr->strandbuf) {
+		if (obr->strandbuf) {
 			/* for each bounding box containing a number of strands */
 			sbound= obr->strandbuf->bound;
-			for(c=0; c<obr->strandbuf->totbound; c++, sbound++) {
-				if(clip_render_object(sbound->boundbox, NULL, obwinmat))
+			for (c=0; c<obr->strandbuf->totbound; c++, sbound++) {
+				if (clip_render_object(sbound->boundbox, NULL, obwinmat))
 					continue;
 
 				/* for each strand in this bounding box */
-				for(a=sbound->start; a<sbound->end; a++) {
+				for (a=sbound->start; a<sbound->end; a++) {
 					strand= RE_findOrAddStrand(obr, a);
 
 					sseg.obi= obi;
@@ -2393,16 +2399,16 @@ void zbuffer_shadow(Render *re, float winmat[][4], LampRen *lar, int *rectz, int
 					svert= strand->vert;
 
 					/* note, these conditions are copied in shadowbuf_autoclip() */
-					if(sseg.buffer->ma!= ma) {
+					if (sseg.buffer->ma!= ma) {
 						ma= sseg.buffer->ma;
 						ok= 1;
-						if((ma->mode & MA_SHADBUF)==0) ok= 0;
+						if ((ma->mode & MA_SHADBUF)==0) ok= 0;
 					}
 
-					if(ok && (sseg.buffer->lay & lay)) {
+					if (ok && (sseg.buffer->lay & lay)) {
 						zbuf_project_cache_clear(cache, strand->totvert);
 
-						for(b=0; b<strand->totvert-1; b++, svert++) {
+						for (b=0; b<strand->totvert-1; b++, svert++) {
 							sseg.v[0]= (b > 0)? (svert-1): svert;
 							sseg.v[1]= svert;
 							sseg.v[2]= svert+1;
@@ -2413,24 +2419,24 @@ void zbuffer_shadow(Render *re, float winmat[][4], LampRen *lar, int *rectz, int
 							c3= zbuf_shadow_project(cache, sseg.v[2]-strand->vert, obwinmat, sseg.v[2]->co, ho3);
 							c4= zbuf_shadow_project(cache, sseg.v[3]-strand->vert, obwinmat, sseg.v[3]->co, ho4);
 
-							if(!(c1 & c2 & c3 & c4))
+							if (!(c1 & c2 & c3 & c4))
 								render_strand_segment(re, winmat, NULL, &zspan, 1, &sseg);
 						}
 					}
 
-					if((a & 255)==255 && re->test_break(re->tbh)) 
+					if ((a & 255)==255 && re->test_break(re->tbh)) 
 						break;
 				}
 			}
 		}
 
-		if(re->test_break(re->tbh)) 
+		if (re->test_break(re->tbh)) 
 			break;
 	}
 	
 	/* merge buffers */
-	if(lar->buftype==LA_SHADBUF_HALFWAY) {
-		for(a=size*size -1; a>=0; a--)
+	if (lar->buftype==LA_SHADBUF_HALFWAY) {
+		for (a=size*size -1; a>=0; a--)
 			rectz[a]= (rectz[a]>>1) + (zspan.rectz1[a]>>1);
 		
 		MEM_freeN(zspan.rectz1);
@@ -2450,7 +2456,7 @@ static void zbuffill_sss(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
 	/* set spans */
 	zbuf_add_to_span(zspan, v1, v2);
 	zbuf_add_to_span(zspan, v2, v3);
-	if(v4) {
+	if (v4) {
 		zbuf_add_to_span(zspan, v3, v4);
 		zbuf_add_to_span(zspan, v4, v1);
 	}
@@ -2458,12 +2464,12 @@ static void zbuffill_sss(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
 		zbuf_add_to_span(zspan, v3, v1);
 	
 	/* clipped */
-	if(zspan->minp2==NULL || zspan->maxp2==NULL) return;
+	if (zspan->minp2==NULL || zspan->maxp2==NULL) return;
 	
-	if(zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
-	if(zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
+	if (zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
+	if (zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
 	
-	if(my2<my0) return;
+	if (my2<my0) return;
 	
 	/* ZBUF DX DY, in floats still */
 	x1= v1[0]- v2[0];
@@ -2477,7 +2483,7 @@ static void zbuffill_sss(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
 	y0= z1*x2-x1*z2;
 	z0= x1*y2-y1*x2;
 	
-	if(z0==0.0f) return;
+	if (z0==0.0f) return;
 	
 	xx1= (x0*v1[0] + y0*v1[1])/z0 + v1[2];
 	zxd= -(double)x0/(double)z0;
@@ -2486,7 +2492,7 @@ static void zbuffill_sss(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
 	
 	/* correct span */
 	sn1= (my0 + my2)/2;
-	if(zspan->span1[sn1] < zspan->span2[sn1]) {
+	if (zspan->span1[sn1] < zspan->span2[sn1]) {
 		span1= zspan->span1+my2;
 		span2= zspan->span2+my2;
 	}
@@ -2495,17 +2501,17 @@ static void zbuffill_sss(ZSpan *zspan, int obi, int zvlnr, float *v1, float *v2,
 		span2= zspan->span1+my2;
 	}
 	
-	for(y=my2; y>=my0; y--, span1--, span2--) {
+	for (y=my2; y>=my0; y--, span1--, span2--) {
 		sn1= floor(*span1);
 		sn2= floor(*span2);
 		sn1++; 
 		
-		if(sn2>=rectx) sn2= rectx-1;
-		if(sn1<0) sn1= 0;
+		if (sn2>=rectx) sn2= rectx-1;
+		if (sn1<0) sn1= 0;
 		
 		z= (double)sn1*zxd + zy0;
 		
-		for(x= sn1; x<=sn2; x++, z+=zxd)
+		for (x= sn1; x<=sn2; x++, z+=zxd)
 			zspan->sss_func(zspan->sss_handle, obi, zvlnr, x, y, z);
 		
 		zy0 -= zyd;
@@ -2545,41 +2551,41 @@ void zbuffer_sss(RenderPart *pa, unsigned int lay, void *handle, void (*func)(vo
 	zspan.zbuffunc= zbuffill_sss;
 
 	/* fill front and back zbuffer */
-	if(pa->rectz) {
+	if (pa->rectz) {
 		fillrect(pa->recto, pa->rectx, pa->recty, 0); 
 		fillrect(pa->rectp, pa->rectx, pa->recty, 0); 
 		fillrect(pa->rectz, pa->rectx, pa->recty, 0x7FFFFFFF);
 	}
-	if(pa->rectbackz) {
+	if (pa->rectbackz) {
 		fillrect(pa->rectbacko, pa->rectx, pa->recty, 0); 
 		fillrect(pa->rectbackp, pa->rectx, pa->recty, 0); 
 		fillrect(pa->rectbackz, pa->rectx, pa->recty, -0x7FFFFFFF);
 	}
 
-	for(i=0, obi=R.instancetable.first; obi; i++, obi=obi->next) {
+	for (i=0, obi=R.instancetable.first; obi; i++, obi=obi->next) {
 		obr= obi->obr;
 
-		if(!(obi->lay & lay))
+		if (!(obi->lay & lay))
 			continue;
 
-		if(obi->flag & R_TRANSFORMED)
+		if (obi->flag & R_TRANSFORMED)
 			mult_m4_m4m4(obwinmat, winmat, obi->mat);
 		else
 			copy_m4_m4(obwinmat, winmat);
 
-		if(clip_render_object(obi->obr->boundbox, bounds, obwinmat))
+		if (clip_render_object(obi->obr->boundbox, bounds, obwinmat))
 			continue;
 
 		zbuf_project_cache_clear(cache, obr->totvert);
 
-		for(v=0; v<obr->totvlak; v++) {
-			if((v & 255)==0) vlr= obr->vlaknodes[v>>8].vlak;
+		for (v=0; v<obr->totvlak; v++) {
+			if ((v & 255)==0) vlr= obr->vlaknodes[v>>8].vlak;
 			else vlr++;
 			
-			if(material_in_material(vlr->mat, sss_ma)) {
+			if (material_in_material(vlr->mat, sss_ma)) {
 				/* three cases, visible for render, only z values and nothing */
-				if(obi->lay & lay) {
-					if(vlr->mat!=ma) {
+				if (obi->lay & lay) {
+					if (vlr->mat!=ma) {
 						ma= vlr->mat;
 						nofill= ma->mode & MA_ONLYCAST;
 						env= (ma->mode & MA_ENV);
@@ -2591,7 +2597,7 @@ void zbuffer_sss(RenderPart *pa, unsigned int lay, void *handle, void (*func)(vo
 					ma= NULL;	/* otherwise nofill can hang */
 				}
 				
-				if(nofill==0 && wire==0 && env==0) {
+				if (nofill==0 && wire==0 && env==0) {
 					unsigned short partclip;
 					
 					v1= vlr->v1;
@@ -2605,19 +2611,19 @@ void zbuffer_sss(RenderPart *pa, unsigned int lay, void *handle, void (*func)(vo
 
 					/* partclipping doesn't need viewplane clipping */
 					partclip= c1 & c2 & c3;
-					if(v4) {
+					if (v4) {
 						c4= zbuf_part_project(cache, v4->index, obwinmat, bounds, v4->co, ho4);
 						partclip &= c4;
 					}
 
-					if(partclip==0) {
+					if (partclip==0) {
 						c1= testclip(ho1);
 						c2= testclip(ho2);
 						c3= testclip(ho3);
 
 						zvlnr= v+1;
 						zbufclip(&zspan, i, zvlnr, ho1, ho2, ho3, c1, c2, c3);
-						if(v4) {
+						if (v4) {
 							c4= testclip(ho4);
 							zbufclip(&zspan, i, zvlnr+RE_QUAD_OFFS, ho1, ho3, ho4, c1, c3, c4);
 						}
@@ -2659,13 +2665,13 @@ static void zbuf_fill_in_rgba(ZSpan *zspan, DrawBufPixel *col, float *v1, float
 	zbuf_add_to_span(zspan, v4, v1);
 	
 	/* clipped */
-	if(zspan->minp2==NULL || zspan->maxp2==NULL) return;
+	if (zspan->minp2==NULL || zspan->maxp2==NULL) return;
 	
-	if(zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
-	if(zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
+	if (zspan->miny1 < zspan->miny2) my0= zspan->miny2; else my0= zspan->miny1;
+	if (zspan->maxy1 > zspan->maxy2) my2= zspan->maxy2; else my2= zspan->maxy1;
 	
 	//	printf("my %d %d\n", my0, my2);
-	if(my2<my0) return;
+	if (my2<my0) return;
 	
 	/* ZBUF DX DY, in floats still */
 	x1= v1[0]- v2[0];
@@ -2678,7 +2684,7 @@ static void zbuf_fill_in_rgba(ZSpan *zspan, DrawBufPixel *col, float *v1, float
 	y0= z1*x2-x1*z2;
 	z0= x1*y2-y1*x2;
 	
-	if(z0==0.0f) return;
+	if (z0==0.0f) return;
 	
 	xx1= (x0*v1[0] + y0*v1[1])/z0 + v1[2];
 	
@@ -2693,7 +2699,7 @@ static void zbuf_fill_in_rgba(ZSpan *zspan, DrawBufPixel *col, float *v1, float
 	
 	/* correct span */
 	sn1= (my0 + my2)/2;
-	if(zspan->span1[sn1] < zspan->span2[sn1]) {
+	if (zspan->span1[sn1] < zspan->span2[sn1]) {
 		span1= zspan->span1+my2;
 		span2= zspan->span2+my2;
 	}
@@ -2702,23 +2708,23 @@ static void zbuf_fill_in_rgba(ZSpan *zspan, DrawBufPixel *col, float *v1, float
 		span2= zspan->span1+my2;
 	}
 	
-	for(y=my2; y>=my0; y--, span1--, span2--) {
+	for (y=my2; y>=my0; y--, span1--, span2--) {
 		
 		sn1= floor(*span1);
 		sn2= floor(*span2);
 		sn1++; 
 		
-		if(sn2>=rectx) sn2= rectx-1;
-		if(sn1<0) sn1= 0;
+		if (sn2>=rectx) sn2= rectx-1;
+		if (sn1<0) sn1= 0;
 		
-		if(sn2>=sn1) {
+		if (sn2>=sn1) {
 			zverg= (double)sn1*zxd + zy0;
 			rz= rectzofs+sn1;
 			rp= rectpofs+sn1;
 			x= sn2-sn1;
 			
-			while(x>=0) {
-				if( zverg < *rz) {
+			while (x>=0) {
+				if ( zverg < *rz) {
 					*rz= zverg;
 					*rp= *col;
 				}
@@ -2736,7 +2742,7 @@ static void zbuf_fill_in_rgba(ZSpan *zspan, DrawBufPixel *col, float *v1, float
 }
 
 /* char value==255 is filled in, rest should be zero */
-/* returns alpha values, but sets alpha to 1 for zero alpha pixels that have an alpha value as neighbour */
+/* returns alpha values, but sets alpha to 1 for zero alpha pixels that have an alpha value as neighbor */
 void antialias_tagbuf(int xsize, int ysize, char *rectmove)
 {
 	char *row1, *row2, *row3;
@@ -2744,14 +2750,14 @@ void antialias_tagbuf(int xsize, int ysize, char *rectmove)
 	int a, x, y, step;
 	
 	/* 1: tag pixels to be candidate for AA */
-	for(y=2; y<ysize; y++) {
+	for (y=2; y<ysize; y++) {
 		/* setup rows */
 		row1= rectmove + (y-2)*xsize;
 		row2= row1 + xsize;
 		row3= row2 + xsize;
-		for(x=2; x<xsize; x++, row1++, row2++, row3++) {
-			if(row2[1]) {
-				if(row2[0]==0 || row2[2]==0 || row1[1]==0 || row3[1]==0)
+		for (x=2; x<xsize; x++, row1++, row2++, row3++) {
+			if (row2[1]) {
+				if (row2[0]==0 || row2[2]==0 || row1[1]==0 || row3[1]==0)
 					row2[1]= 128;
 			}
 		}
@@ -2759,22 +2765,22 @@ void antialias_tagbuf(int xsize, int ysize, char *rectmove)
 	
 	/* 2: evaluate horizontal scanlines and calculate alphas */
 	row1= rectmove;
-	for(y=0; y<ysize; y++) {
+	for (y=0; y<ysize; y++) {
 		row1++;
-		for(x=1; x<xsize; x++, row1++) {
-			if(row1[0]==128 && row1[1]==128) {
+		for (x=1; x<xsize; x++, row1++) {
+			if (row1[0]==128 && row1[1]==128) {
 				/* find previous color and next color and amount of steps to blend */
 				prev= row1[-1];
 				step= 1;
-				while(x+step<xsize && row1[step]==128)
+				while (x+step<xsize && row1[step]==128)
 					step++;
 				
-				if(x+step!=xsize) {
+				if (x+step!=xsize) {
 					/* now we can blend values */
 					next= row1[step];
 
 					/* note, prev value can be next value, but we do this loop to clear 128 then */
-					for(a=0; a<step; a++) {
+					for (a=0; a<step; a++) {
 						int fac, mfac;
 						
 						fac= ((a+1)<<8)/(step+1);
@@ -2789,22 +2795,22 @@ void antialias_tagbuf(int xsize, int ysize, char *rectmove)
 	
 	/* 3: evaluate vertical scanlines and calculate alphas */
 	/*    use for reading a copy of the original tagged buffer */
-	for(x=0; x<xsize; x++) {
+	for (x=0; x<xsize; x++) {
 		row1= rectmove + x+xsize;
 		
-		for(y=1; y<ysize; y++, row1+=xsize) {
-			if(row1[0]==128 && row1[xsize]==128) {
+		for (y=1; y<ysize; y++, row1+=xsize) {
+			if (row1[0]==128 && row1[xsize]==128) {
 				/* find previous color and next color and amount of steps to blend */
 				prev= row1[-xsize];
 				step= 1;
-				while(y+step<ysize && row1[step*xsize]==128)
+				while (y+step<ysize && row1[step*xsize]==128)
 					step++;
 				
-				if(y+step!=ysize) {
+				if (y+step!=ysize) {
 					/* now we can blend values */
 					next= row1[step*xsize];
 					/* note, prev value can be next value, but we do this loop to clear 128 then */
-					for(a=0; a<step; a++) {
+					for (a=0; a<step; a++) {
 						int fac, mfac;
 						
 						fac= ((a+1)<<8)/(step+1);
@@ -2818,14 +2824,14 @@ void antialias_tagbuf(int xsize, int ysize, char *rectmove)
 	}
 	
 	/* last: pixels with 0 we fill in zbuffer, with 1 we skip for mask */
-	for(y=2; y<ysize; y++) {
+	for (y=2; y<ysize; y++) {
 		/* setup rows */
 		row1= rectmove + (y-2)*xsize;
 		row2= row1 + xsize;
 		row3= row2 + xsize;
-		for(x=2; x<xsize; x++, row1++, row2++, row3++) {
-			if(row2[1]==0) {
-				if(row2[0]>1 || row2[2]>1 || row1[1]>1 || row3[1]>1)
+		for (x=2; x<xsize; x++, row1++, row2++, row3++) {
+			if (row2[1]==0) {
+				if (row2[0]>1 || row2[2]>1 || row1[1]>1 || row3[1]>1)
 					row2[1]= 1;
 			}
 		}
@@ -2896,16 +2902,16 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
 	
 	/* debug... check if PASS_VECTOR_MAX still is in buffers */
 	dvec1= vecbufrect;
-	for(x= 4*xsize*ysize; x>0; x--, dvec1++) {
-		if(dvec1[0]==PASS_VECTOR_MAX) {
+	for (x= 4*xsize*ysize; x>0; x--, dvec1++) {
+		if (dvec1[0]==PASS_VECTOR_MAX) {
 			dvec1[0]= 0.0f;
 			tsktsk= 1;
 		}
 	}
-	if(tsktsk) printf("Found uninitialized speed in vector buffer... fixed.\n");
+	if (tsktsk) printf("Found uninitialized speed in vector buffer... fixed.\n");
 	
 	/* min speed? then copy speedbuffer to recalculate speed vectors */
-	if(nbd->minspeed) {
+	if (nbd->minspeed) {
 		float minspeed= (float)nbd->minspeed;
 		float minspeedsq= minspeed*minspeed;
 		
@@ -2913,14 +2919,14 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
 		
 		dvec1= vecbufrect;
 		dvec2= minvecbufrect;
-		for(x= 2*xsize*ysize; x>0; x--, dvec1+=2, dvec2+=2) {
-			if(dvec1[0]==0.0f && dvec1[1]==0.0f) {
+		for (x= 2*xsize*ysize; x>0; x--, dvec1+=2, dvec2+=2) {
+			if (dvec1[0]==0.0f && dvec1[1]==0.0f) {
 				dvec2[0]= dvec1[0];
 				dvec2[1]= dvec1[1];
 			}
 			else {
 				float speedsq= dvec1[0]*dvec1[0] + dvec1[1]*dvec1[1];
-				if(speedsq <= minspeedsq) {
+				if (speedsq <= minspeedsq) {
 					dvec2[0]= 0.0f;
 					dvec2[1]= 0.0f;
 				}
@@ -2937,70 +2943,70 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
 	/* make vertex buffer with averaged speed and zvalues */
 	rectvz= MEM_mapallocN(4*sizeof(float)*(xsize+1)*(ysize+1), "vertices");
 	dvz= rectvz;
-	for(y=0; y<=ysize; y++) {
+	for (y=0; y<=ysize; y++) {
 		
-		if(y==0)
+		if (y==0)
 			dvec1= vecbufrect + 4*y*xsize;
 		else
 			dvec1= vecbufrect + 4*(y-1)*xsize;
 		
-		if(y==ysize)
+		if (y==ysize)
 			dvec2= vecbufrect + 4*(y-1)*xsize;
 		else
 			dvec2= vecbufrect + 4*y*xsize;
 		
-		for(x=0; x<=xsize; x++) {
+		for (x=0; x<=xsize; x++) {
 			
 			/* two vectors, so a step loop */
-			for(step=0; step<2; step++, dvec1+=2, dvec2+=2, dvz+=2) {
+			for (step=0; step<2; step++, dvec1+=2, dvec2+=2, dvz+=2) {
 				/* average on minimal speed */
 				int div= 0;
 				
-				if(x!=0) {
-					if(dvec1[-4]!=0.0f || dvec1[-3]!=0.0f) {
+				if (x!=0) {
+					if (dvec1[-4]!=0.0f || dvec1[-3]!=0.0f) {
 						dvz[0]= dvec1[-4];
 						dvz[1]= dvec1[-3];
 						div++;
 					}
-					if(dvec2[-4]!=0.0f || dvec2[-3]!=0.0f) {
-						if(div==0) {
+					if (dvec2[-4]!=0.0f || dvec2[-3]!=0.0f) {
+						if (div==0) {
 							dvz[0]= dvec2[-4];
 							dvz[1]= dvec2[-3];
 							div++;
 						}
-						else if( (ABS(dvec2[-4]) + ABS(dvec2[-3]))< (ABS(dvz[0]) + ABS(dvz[1])) ) {
+						else if ( (ABS(dvec2[-4]) + ABS(dvec2[-3]))< (ABS(dvz[0]) + ABS(dvz[1])) ) {
 							dvz[0]= dvec2[-4];
 							dvz[1]= dvec2[-3];
 						}
 					}
 				}
 
-				if(x!=xsize) {
-					if(dvec1[0]!=0.0f || dvec1[1]!=0.0f) {
-						if(div==0) {
+				if (x!=xsize) {
+					if (dvec1[0]!=0.0f || dvec1[1]!=0.0f) {
+						if (div==0) {
 							dvz[0]= dvec1[0];
 							dvz[1]= dvec1[1];
 							div++;
 						}
-						else if( (ABS(dvec1[0]) + ABS(dvec1[1]))< (ABS(dvz[0]) + ABS(dvz[1])) ) {
+						else if ( (ABS(dvec1[0]) + ABS(dvec1[1]))< (ABS(dvz[0]) + ABS(dvz[1])) ) {
 							dvz[0]= dvec1[0];
 							dvz[1]= dvec1[1];
 						}
 					}
-					if(dvec2[0]!=0.0f || dvec2[1]!=0.0f) {
-						if(div==0) {
+					if (dvec2[0]!=0.0f || dvec2[1]!=0.0f) {
+						if (div==0) {
 							dvz[0]= dvec2[0];
 							dvz[1]= dvec2[1];
 						}
-						else if( (ABS(dvec2[0]) + ABS(dvec2[1]))< (ABS(dvz[0]) + ABS(dvz[1])) ) {
+						else if ( (ABS(dvec2[0]) + ABS(dvec2[1]))< (ABS(dvz[0]) + ABS(dvz[1])) ) {
 							dvz[0]= dvec2[0];
 							dvz[1]= dvec2[1];
 						}
 					}
 				}
-				if(maxspeed) {
+				if (maxspeed) {
 					float speedsq= dvz[0]*dvz[0] + dvz[1]*dvz[1];
-					if(speedsq > maxspeedsq) {
+					if (speedsq > maxspeedsq) {
 						speedsq= (float)maxspeed/sqrt(speedsq);
 						dvz[0]*= speedsq;
 						dvz[1]*= speedsq;
@@ -3013,7 +3019,7 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
 	/* set border speeds to keep border speeds on border */
 	dz1= rectvz;
 	dz2= rectvz+4*(ysize)*(xsize+1);
-	for(x=0; x<=xsize; x++, dz1+=4, dz2+=4) {
+	for (x=0; x<=xsize; x++, dz1+=4, dz2+=4) {
 		dz1[1]= 0.0f;
 		dz2[1]= 0.0f;
 		dz1[3]= 0.0f;
@@ -3021,7 +3027,7 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
 	}
 	dz1= rectvz;
 	dz2= rectvz+4*(xsize);
-	for(y=0; y<=ysize; y++, dz1+=4*(xsize+1), dz2+=4*(xsize+1)) {
+	for (y=0; y<=ysize; y++, dz1+=4*(xsize+1), dz2+=4*(xsize+1)) {
 		dz1[0]= 0.0f;
 		dz2[0]= 0.0f;
 		dz1[2]= 0.0f;
@@ -3031,15 +3037,15 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
 	/* tag moving pixels, only these faces we draw */
 	dm= rectmove;
 	dvec1= vecbufrect;
-	for(x=xsize*ysize; x>0; x--, dm++, dvec1+=4) {
-		if((dvec1[0]!=0.0f || dvec1[1]!=0.0f || dvec1[2]!=0.0f || dvec1[3]!=0.0f))
+	for (x=xsize*ysize; x>0; x--, dm++, dvec1+=4) {
+		if ((dvec1[0]!=0.0f || dvec1[1]!=0.0f || dvec1[2]!=0.0f || dvec1[3]!=0.0f))
 			*dm= 255;
 	}
 	
 	antialias_tagbuf(xsize, ysize, rectmove);
 	
 	/* has to become static, the init-jit calls a random-seed, screwing up texture noise node */
-	if(firsttime) {
+	if (firsttime) {
 		firsttime= 0;
 		BLI_initjit(jit[0], 256);
 	}
@@ -3048,26 +3054,26 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
 
 	/* accumulate */
 	samples/= 2;
-	for(step= 1; step<=samples; step++) {
+	for (step= 1; step<=samples; step++) {
 		float speedfac= 0.5f*nbd->fac*(float)step/(float)(samples+1);
 		int side;
 		
-		for(side=0; side<2; side++) {
+		for (side=0; side<2; side++) {
 			float blendfac, ipodata[4];
 			
 			/* clear zbuf, if we draw future we fill in not moving pixels */
-			if(0)
-				for(x= xsize*ysize-1; x>=0; x--) rectz[x]= 10e16;
+			if (0)
+				for (x= xsize*ysize-1; x>=0; x--) rectz[x]= 10e16;
 			else 
-				for(x= xsize*ysize-1; x>=0; x--) {
-					if(rectmove[x]==0)
+				for (x= xsize*ysize-1; x>=0; x--) {
+					if (rectmove[x]==0)
 						rectz[x]= zbufrect[x];
 					else
 						rectz[x]= 10e16;
 				}
 			
 			/* clear drawing buffer */
-			for(x= xsize*ysize-1; x>=0; x--) rectdraw[x].colpoin= NULL;
+			for (x= xsize*ysize-1; x>=0; x--) rectdraw[x].colpoin= NULL;
 			
 			dimg= imgrect;
 			dm= rectmove;
@@ -3075,8 +3081,8 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
 			dz1= rectvz;
 			dz2= rectvz + 4*(xsize + 1);
 			
-			if(side) {
-				if(nbd->curved==0) {
+			if (side) {
+				if (nbd->curved==0) {
 					dz1+= 2;
 					dz2+= 2;
 				}
@@ -3085,15 +3091,15 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
 			
 			set_quad_bezier_ipo(0.5f + 0.5f*speedfac, ipodata);
 			
-			for(fy= -0.5f+jit[step & 255][0], y=0; y<ysize; y++, fy+=1.0f) {
-				for(fx= -0.5f+jit[step & 255][1], x=0; x<xsize; x++, fx+=1.0f, dimg+=4, dz1+=4, dz2+=4, dm++, dz++) {
-					if(*dm>1) {
+			for (fy= -0.5f+jit[step & 255][0], y=0; y<ysize; y++, fy+=1.0f) {
+				for (fx= -0.5f+jit[step & 255][1], x=0; x<xsize; x++, fx+=1.0f, dimg+=4, dz1+=4, dz2+=4, dm++, dz++) {
+					if (*dm>1) {
 						float jfx = fx + 0.5f;
 						float jfy = fy + 0.5f;
 						DrawBufPixel col;
 						
 						/* make vertices */
-						if(nbd->curved) {	/* curved */
+						if (nbd->curved) {	/* curved */
 							quad_bezier_2d(v1, dz1, dz1+2, ipodata);
 							v1[0]+= jfx; v1[1]+= jfy; v1[2]= *dz;
 
@@ -3112,8 +3118,8 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
 							v3[0]= speedfac*dz2[4]+jfx+1.0f;		v3[1]= speedfac*dz2[5]+jfy+1.0f;		v3[2]= *dz;
 							v4[0]= speedfac*dz2[0]+jfx;			v4[1]= speedfac*dz2[1]+jfy+1.0f;		v4[2]= *dz;
 						}
-						if(*dm==255) col.alpha= 1.0f;
-						else if(*dm<2) col.alpha= 0.0f;
+						if (*dm==255) col.alpha= 1.0f;
+						else if (*dm<2) col.alpha= 0.0f;
 						else col.alpha= ((float)*dm)/255.0f;
 						col.colpoin= dimg;
 
@@ -3138,8 +3144,8 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
 			/* accum */
 			rw= rectweight;
 			rm= rectmax;
-			for(dr= rectdraw, dz2=newrect, x= xsize*ysize-1; x>=0; x--, dr++, dz2+=4, rw++, rm++) {
-				if(dr->colpoin) {
+			for (dr= rectdraw, dz2=newrect, x= xsize*ysize-1; x>=0; x--, dr++, dz2+=4, rw++, rm++) {
+				if (dr->colpoin) {
 					float bfac= dr->alpha*blendfac;
 					
 					dz2[0] += bfac*dr->colpoin[0];
@@ -3159,7 +3165,7 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
 	rm= rectmax;
 	ro= imgrect;
 	dm= rectmove;
-	for(dz2=newrect, x= xsize*ysize-1; x>=0; x--, dz2+=4, ro+=4, rw++, rm++, dm++) {
+	for (dz2=newrect, x= xsize*ysize-1; x>=0; x--, dz2+=4, ro+=4, rw++, rm++, dm++) {
 		float mfac = *rm;
 		float fac = (*rw == 0.0f)? 0.0f: mfac/(*rw);
 		float nfac = 1.0f - mfac;
@@ -3176,7 +3182,7 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
 	MEM_freeN(rectvz);
 	MEM_freeN(rectweight);
 	MEM_freeN(rectmax);
-	if(minvecbufrect) MEM_freeN(vecbufrect);  /* rects were swapped! */
+	if (minvecbufrect) MEM_freeN(vecbufrect);  /* rects were swapped! */
 	zbuf_free_span(&zspan);
 }
 
@@ -3192,18 +3198,18 @@ static void copyto_abufz(RenderPart *pa, int *arectz, int *rectmask, int sample)
 	int x, y, *rza, *rma;
 	intptr_t *rd;
 	
-	if(R.osa==0) {
-		if(!pa->rectz)
+	if (R.osa==0) {
+		if (!pa->rectz)
 			fillrect(arectz, pa->rectx, pa->recty, 0x7FFFFFFE);
 		else
 			memcpy(arectz, pa->rectz, sizeof(int)*pa->rectx*pa->recty);
 
-		if(rectmask && pa->rectmask)
+		if (rectmask && pa->rectmask)
 			memcpy(rectmask, pa->rectmask, sizeof(int)*pa->rectx*pa->recty);
 
 		return;
 	}
-	else if(!pa->rectdaps) {
+	else if (!pa->rectdaps) {
 		fillrect(arectz, pa->rectx, pa->recty, 0x7FFFFFFE);
 		return;
 	}
@@ -3214,17 +3220,17 @@ static void copyto_abufz(RenderPart *pa, int *arectz, int *rectmask, int sample)
 
 	sample= (1<<sample);
 	
-	for(y=0; y<pa->recty; y++) {
-		for(x=0; x<pa->rectx; x++) {
+	for (y=0; y<pa->recty; y++) {
+		for (x=0; x<pa->rectx; x++) {
 			
 			*rza= 0x7FFFFFFF;
-			if(rectmask) *rma= 0x7FFFFFFF;
-			if(*rd) {	
+			if (rectmask) *rma= 0x7FFFFFFF;
+			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) {
+				for (ps= (PixStr *)(*rd); ps; ps= ps->next) {
+					if (sample & ps->mask) {
 						*rza= ps->z;
-						if(rectmask) *rma= ps->maskz;
+						if (rectmask) *rma= ps->maskz;
 						break;
 					}
 				}
@@ -3258,7 +3264,7 @@ static int zbuffer_abuf(Render *re, RenderPart *pa, APixstr *APixbuf, ListBase *
 
 	zbuffer_part_bounds(winx, winy, pa, bounds);
 
-	for(zsample=0; zsample<samples; zsample++) {
+	for (zsample=0; zsample<samples; zsample++) {
 		zspan= &zspans[zsample];
 
 		zbuf_alloc_span(zspan, pa->rectx, pa->recty, re->clipcrop);
@@ -3272,7 +3278,7 @@ static int zbuffer_abuf(Render *re, RenderPart *pa, APixstr *APixbuf, ListBase *
 		zspan->apixbuf= APixbuf;
 		zspan->apsmbase= apsmbase;
 		
-		if(negzmask)
+		if (negzmask)
 			zspan->rectmask= MEM_mallocN(sizeof(int)*pa->rectx*pa->recty, "Arectmask");
 
 		/* filling methods */
@@ -3282,7 +3288,7 @@ static int zbuffer_abuf(Render *re, RenderPart *pa, APixstr *APixbuf, ListBase *
 		copyto_abufz(pa, zspan->arectz, zspan->rectmask, zsample);	/* init zbuffer */
 		zspan->mask= 1<<zsample;
 
-		if(jit) {
+		if (jit) {
 			zspan->zofsx= -pa->disprect.xmin - jit[zsample][0];
 			zspan->zofsy= -pa->disprect.ymin - jit[zsample][1];
 		}
@@ -3299,37 +3305,37 @@ static int zbuffer_abuf(Render *re, RenderPart *pa, APixstr *APixbuf, ListBase *
 	/* we use this to test if nothing was filled in */
 	zvlnr= 0;
 		
-	for(i=0, obi=re->instancetable.first; obi; i++, obi=obi->next) {
+	for (i=0, obi=re->instancetable.first; obi; i++, obi=obi->next) {
 		obr= obi->obr;
 
-		if(!(obi->lay & lay))
+		if (!(obi->lay & lay))
 			continue;
 
-		if(obi->flag & R_TRANSFORMED)
+		if (obi->flag & R_TRANSFORMED)
 			mult_m4_m4m4(obwinmat, winmat, obi->mat);
 		else
 			copy_m4_m4(obwinmat, winmat);
 
-		if(clip_render_object(obi->obr->boundbox, bounds, obwinmat))
+		if (clip_render_object(obi->obr->boundbox, bounds, obwinmat))
 			continue;
 
 		zbuf_project_cache_clear(cache, obr->totvert);
 
-		for(v=0; v<obr->totvlak; v++) {
-			if((v & 255)==0)
+		for (v=0; v<obr->totvlak; v++) {
+			if ((v & 255)==0)
 				vlr= obr->vlaknodes[v>>8].vlak;
 			else vlr++;
 			
-			if(vlr->mat!=ma) {
+			if (vlr->mat!=ma) {
 				ma= vlr->mat;
-				if(shadow)
+				if (shadow)
 					dofill= (ma->mode & MA_SHADBUF);
 				else
 					dofill= (((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP)) && !(ma->mode & MA_ONLYCAST));
 			}
 			
-			if(dofill) {
-				if(!(vlr->flag & R_HIDDEN) && (obi->lay & lay)) {
+			if (dofill) {
+				if (!(vlr->flag & R_HIDDEN) && (obi->lay & lay)) {
 					unsigned short partclip;
 					
 					v1= vlr->v1;
@@ -3343,14 +3349,14 @@ static int zbuffer_abuf(Render *re, RenderPart *pa, APixstr *APixbuf, ListBase *
 
 					/* partclipping doesn't need viewplane clipping */
 					partclip= c1 & c2 & c3;
-					if(v4) {
+					if (v4) {
 						c4= zbuf_part_project(cache, v4->index, obwinmat, bounds, v4->co, ho4);
 						partclip &= c4;
 					}
 
-					if(partclip==0) {
+					if (partclip==0) {
 						/* a little advantage for transp rendering (a z offset) */
-						if(!shadow && ma->zoffs != 0.0f) {
+						if (!shadow && ma->zoffs != 0.0f) {
 							mul= 0x7FFFFFFF;
 							zval= mul*(1.0f+ho1[2]/ho1[3]);
 
@@ -3369,45 +3375,45 @@ static int zbuffer_abuf(Render *re, RenderPart *pa, APixstr *APixbuf, ListBase *
 						c1= testclip(ho1);
 						c2= testclip(ho2);
 						c3= testclip(ho3);
-						if(v4)
+						if (v4)
 							c4= testclip(ho4);
 
-						for(zsample=0; zsample<samples; zsample++) {
+						for (zsample=0; zsample<samples; zsample++) {
 							zspan= &zspans[zsample];
 							zspan->polygon_offset= polygon_offset;
 				
-							if(ma->material_type == MA_TYPE_WIRE) {
-								if(v4)
+							if (ma->material_type == MA_TYPE_WIRE) {
+								if (v4)
 									zbufclipwire(zspan, i, zvlnr, vlr->ec, ho1, ho2, ho3, ho4, c1, c2, c3, c4);
 								else
 									zbufclipwire(zspan, i, zvlnr, vlr->ec, ho1, ho2, ho3, 0, c1, c2, c3, 0);
 							}
 							else {
-								if(v4 && (vlr->flag & R_STRAND)) {
+								if (v4 && (vlr->flag & R_STRAND)) {
 									zbufclip4(zspan, i, zvlnr, ho1, ho2, ho3, ho4, c1, c2, c3, c4);
 								}
 								else {
 									zbufclip(zspan, i, zvlnr, ho1, ho2, ho3, c1, c2, c3);
-									if(v4)
+									if (v4)
 										zbufclip(zspan, i, zvlnr+RE_QUAD_OFFS, ho1, ho3, ho4, c1, c3, c4);
 								}
 							}
 						}
 					}
-					if((v & 255)==255) 
-						if(re->test_break(re->tbh)) 
+					if ((v & 255)==255) 
+						if (re->test_break(re->tbh)) 
 							break; 
 				}
 			}
 		}
 
-		if(re->test_break(re->tbh)) break;
+		if (re->test_break(re->tbh)) break;
 	}
 	
-	for(zsample=0; zsample<samples; zsample++) {
+	for (zsample=0; zsample<samples; zsample++) {
 		zspan= &zspans[zsample];
 		MEM_freeN(zspan->arectz);
-		if(zspan->rectmask)
+		if (zspan->rectmask)
 			MEM_freeN(zspan->rectmask);
 		zbuf_free_span(zspan);
 	}
@@ -3423,18 +3429,18 @@ static int zbuffer_abuf_render(RenderPart *pa, APixstr *APixbuf, APixstrand *APi
 	samples= (R.osa)? R.osa: 1;
 	negzmask= ((rl->layflag & SCE_LAY_ZMASK) && (rl->layflag & SCE_LAY_NEG_ZMASK));
 
-	if(R.osa)
+	if (R.osa)
 		jit= R.jit;
-	else if(R.i.curblur)
+	else if (R.i.curblur)
 		jit= &R.mblur_jit[R.i.curblur-1];
 	else
 		jit= NULL;
 	
 	zbuf_make_winmat(&R, winmat);
 
-	if(rl->layflag & SCE_LAY_ZTRA)
+	if (rl->layflag & SCE_LAY_ZTRA)
 		doztra+= zbuffer_abuf(&R, pa, APixbuf, apsmbase, rl->lay, negzmask, winmat, R.winx, R.winy, samples, jit, R.clipcrop, 0);
-	if((rl->layflag & SCE_LAY_STRAND) && APixbufstrand)
+	if ((rl->layflag & SCE_LAY_STRAND) && APixbufstrand)
 		doztra+= zbuffer_strands_abuf(&R, pa, APixbufstrand, apsmbase, rl->lay, negzmask, winmat, R.winx, R.winy, samples, jit, R.clipcrop, 0, sscache);
 
 	return doztra;
@@ -3445,18 +3451,18 @@ void zbuffer_abuf_shadow(Render *re, LampRen *lar, float winmat[][4], APixstr *A
 	RenderPart pa;
 	int lay= -1;
 
-	if(lar->mode & LA_LAYER) lay= lar->lay;
+	if (lar->mode & LA_LAYER) lay= lar->lay;
 
 	memset(&pa, 0, sizeof(RenderPart));
 	pa.rectx= size;
 	pa.recty= size;
-	pa.disprect.xmin= 0;
-	pa.disprect.ymin= 0;
-	pa.disprect.xmax= size;
-	pa.disprect.ymax= size;
+	pa.disprect.xmin = 0;
+	pa.disprect.ymin = 0;
+	pa.disprect.xmax = size;
+	pa.disprect.ymax = size;
 
 	zbuffer_abuf(re, &pa, APixbuf, apsmbase, lay, 0, winmat, size, size, samples, jit, 1.0f, 1);
-	if(APixbufstrand)
+	if (APixbufstrand)
 		zbuffer_strands_abuf(re, &pa, APixbufstrand, apsmbase, lay, 0, winmat, size, size, samples, jit, 1.0f, 1, NULL);
 }
 
@@ -3468,27 +3474,27 @@ void add_transp_speed(RenderLayer *rl, int offset, float *speed, float alpha, in
 {
 	RenderPass *rpass;
 	
-	for(rpass= rl->passes.first; rpass; rpass= rpass->next) {
-		if(rpass->passtype==SCE_PASS_VECTOR) {
+	for (rpass= rl->passes.first; rpass; rpass= rpass->next) {
+		if (rpass->passtype==SCE_PASS_VECTOR) {
 			float *fp= rpass->rect + 4*offset;
 			
-			if(speed==NULL) {
+			if (speed==NULL) {
 				/* clear */
-				if(fp[0]==PASS_VECTOR_MAX) fp[0]= 0.0f;
-				if(fp[1]==PASS_VECTOR_MAX) fp[1]= 0.0f;
-				if(fp[2]==PASS_VECTOR_MAX) fp[2]= 0.0f;
-				if(fp[3]==PASS_VECTOR_MAX) fp[3]= 0.0f;
+				if (fp[0]==PASS_VECTOR_MAX) fp[0]= 0.0f;
+				if (fp[1]==PASS_VECTOR_MAX) fp[1]= 0.0f;
+				if (fp[2]==PASS_VECTOR_MAX) fp[2]= 0.0f;
+				if (fp[3]==PASS_VECTOR_MAX) fp[3]= 0.0f;
 			}
-			else if(rdrect==NULL || rdrect[offset]==0 || alpha>0.95f) {
+			else if (rdrect==NULL || rdrect[offset]==0 || alpha>0.95f) {
 				copy_v4_v4(fp, speed);
 			}
 			else {
 				/* add minimum speed in pixel */
-				if( (ABS(speed[0]) + ABS(speed[1]))< (ABS(fp[0]) + ABS(fp[1])) ) {
+				if ( (ABS(speed[0]) + ABS(speed[1]))< (ABS(fp[0]) + ABS(fp[1])) ) {
 					fp[0]= speed[0];
 					fp[1]= speed[1];
 				}
-				if( (ABS(speed[2]) + ABS(speed[3]))< (ABS(fp[2]) + ABS(fp[3])) ) {
+				if ( (ABS(speed[2]) + ABS(speed[3]))< (ABS(fp[2]) + ABS(fp[3])) ) {
 					fp[2]= speed[2];
 					fp[3]= speed[3];
 				}
@@ -3502,8 +3508,8 @@ 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) {
+	for (rpass= rl->passes.first; rpass; rpass= rpass->next) {
+		if (rpass->passtype == SCE_PASS_INDEXOB||rpass->passtype == SCE_PASS_INDEXMA) {
 			float *fp= rpass->rect + offset;
 			*fp= (float)ob->index;
 			break;
@@ -3519,7 +3525,7 @@ void merge_transp_passes(RenderLayer *rl, ShadeResult *shr)
 	float weight= 1.0f/((float)R.osa);
 	int delta= sizeof(ShadeResult)/4;
 	
-	for(rpass= rl->passes.first; rpass; rpass= rpass->next) {
+	for (rpass= rl->passes.first; rpass; rpass= rpass->next) {
 		float *col= NULL;
 		int pixsize= 3;
 		
@@ -3574,16 +3580,16 @@ void merge_transp_passes(RenderLayer *rl, ShadeResult *shr)
 					int samp;
 					
 					/* add minimum speed in pixel */
-					for(samp= 1; samp<R.osa; samp++, shr_t++) {
+					for (samp= 1; samp<R.osa; samp++, shr_t++) {
 						
-						if(shr_t->combined[3] > 0.0f) {
+						if (shr_t->combined[3] > 0.0f) {
 							float *speed= shr_t->winspeed;
 							
-							if( (ABS(speed[0]) + ABS(speed[1]))< (ABS(fp[0]) + ABS(fp[1])) ) {
+							if ( (ABS(speed[0]) + ABS(speed[1]))< (ABS(fp[0]) + ABS(fp[1])) ) {
 								fp[0]= speed[0];
 								fp[1]= speed[1];
 							}
-							if( (ABS(speed[2]) + ABS(speed[3]))< (ABS(fp[2]) + ABS(fp[3])) ) {
+							if ( (ABS(speed[2]) + ABS(speed[3]))< (ABS(fp[2]) + ABS(fp[3])) ) {
 								fp[2]= speed[2];
 								fp[3]= speed[3];
 							}
@@ -3592,23 +3598,23 @@ void merge_transp_passes(RenderLayer *rl, ShadeResult *shr)
 				}
 				break;
 		}
-		if(col) {
+		if (col) {
 			float *fp= col+delta;
 			int samp;
 			
-			for(samp= 1; samp<R.osa; samp++, fp+=delta) {
+			for (samp= 1; samp<R.osa; samp++, fp+=delta) {
 				col[0]+= fp[0];
-				if(pixsize>1) {
+				if (pixsize>1) {
 					col[1]+= fp[1];
 					col[2]+= fp[2];
-					if(pixsize==4) col[3]+= fp[3];
+					if (pixsize==4) col[3]+= fp[3];
 				}
 			}
 			col[0]*= weight;
-			if(pixsize>1) {
+			if (pixsize>1) {
 				col[1]*= weight;
 				col[2]*= weight;
-				if(pixsize==4) col[3]*= weight;
+				if (pixsize==4) col[3]*= weight;
 			}
 		}
 	}
@@ -3619,14 +3625,14 @@ void add_transp_passes(RenderLayer *rl, int offset, ShadeResult *shr, float alph
 {
 	RenderPass *rpass;
 	
-	for(rpass= rl->passes.first; rpass; rpass= rpass->next) {
+	for (rpass= rl->passes.first; rpass; rpass= rpass->next) {
 		float *fp, *col= NULL;
 		int pixsize= 3;
 		
 		switch(rpass->passtype) {
 			case SCE_PASS_Z:
 				fp= rpass->rect + offset;
-				if(shr->z < *fp)
+				if (shr->z < *fp)
 					*fp= shr->z;
 				break;
 			case SCE_PASS_RGBA:
@@ -3668,11 +3674,11 @@ void add_transp_passes(RenderLayer *rl, int offset, ShadeResult *shr, float alph
 				pixsize= 1;
 				break;
 		}
-		if(col) {
+		if (col) {
 
 			fp= rpass->rect + pixsize*offset;
 			fp[0]= col[0] + (1.0f-alpha)*fp[0];
-			if(pixsize==3) {
+			if (pixsize==3) {
 				fp[1]= col[1] + (1.0f-alpha)*fp[1];
 				fp[2]= col[2] + (1.0f-alpha)*fp[2];
 			}
@@ -3693,8 +3699,8 @@ static int vergzvlak(const void *a1, const void *a2)
 {
 	const ZTranspRow *r1 = a1, *r2 = a2;
 
-	if(r1->z < r2->z) return 1;
-	else if(r1->z > r2->z) return -1;
+	if (r1->z < r2->z) return 1;
+	else if (r1->z > r2->z) return -1;
 	return 0;
 }
 
@@ -3733,10 +3739,10 @@ static void unref_strand_samples(StrandShadeCache *cache, ZTranspRow *row, int t
 	/* remove references to samples that are not being rendered, but we still
 	 * need to remove them so that the reference count of strand vertex shade
 	 * samples correctly drops to zero */
-	while(totface > 0) {
+	while (totface > 0) {
 		totface--;
 
-		if(row[totface].segment != -1) {
+		if (row[totface].segment != -1) {
 			obi= R.objectinstance + row[totface].obi;
 			obr= obi->obr;
 			strand= RE_findOrAddStrand(obr, row[totface].p-1);
@@ -3758,18 +3764,18 @@ static void shade_tra_samples_fill(ShadeSample *ssamp, int x, int y, int z, int
 	shade_input_set_triangle(shi, obi, facenr, 1);
 		
 	/* officially should always be true... we have no sky info */
-	if(shi->vlr) {
+	if (shi->vlr) {
 		
 		/* full osa is only set for OSA renders */
-		if(shi->vlr->flag & R_FULL_OSA) {
+		if (shi->vlr->flag & R_FULL_OSA) {
 			short shi_inc= 0, samp;
 			
-			for(samp=0; samp<R.osa; samp++) {
-				if(curmask & (1<<samp)) {
+			for (samp=0; samp<R.osa; samp++) {
+				if (curmask & (1<<samp)) {
 					xs= (float)x + R.jit[samp][0] + 0.5f;	/* zbuffer has this inverse corrected, ensures xs,ys are inside pixel */
 					ys= (float)y + R.jit[samp][1] + 0.5f;
 					
-					if(shi_inc) {
+					if (shi_inc) {
 						shade_input_copy_triangle(shi+1, shi);
 						shi++;
 					}
@@ -3777,7 +3783,7 @@ static void shade_tra_samples_fill(ShadeSample *ssamp, int x, int y, int z, int
 					shi->samplenr= R.shadowsamplenr[shi->thread]++;
 					shade_input_set_viewco(shi, x, y, xs, ys, (float)z);
 					shade_input_set_uv(shi);
-					if(shi_inc==0)
+					if (shi_inc==0)
 						shade_input_set_normals(shi);
 					else /* XXX shi->flippednor messes up otherwise */
 						shade_input_set_vertex_normals(shi);
@@ -3787,7 +3793,7 @@ static void shade_tra_samples_fill(ShadeSample *ssamp, int x, int y, int z, int
 			}
 		}
 		else {
-			if(R.osa) {
+			if (R.osa) {
 				short b= R.samples->centmask[curmask];
 				xs= (float)x + R.samples->centLut[b & 15] + 0.5f;
 				ys= (float)y + R.samples->centLut[b>>4] + 0.5f;
@@ -3810,14 +3816,14 @@ static void shade_tra_samples_fill(ShadeSample *ssamp, int x, int y, int z, int
 
 static int shade_tra_samples(ShadeSample *ssamp, StrandShadeCache *cache, int x, int y, ZTranspRow *row, int addpassflag)
 {
-	if(row->segment != -1) {
+	if (row->segment != -1) {
 		shade_strand_samples(cache, ssamp, x, y, row, addpassflag);
 		return 1;
 	}
 
 	shade_tra_samples_fill(ssamp, x, y, row->z, row->obi, row->p, row->mask);
 	
-	if(ssamp->tot) {
+	if (ssamp->tot) {
 		ShadeInput *shi= ssamp->shi;
 		ShadeResult *shr= ssamp->shr;
 		int samp;
@@ -3826,19 +3832,19 @@ static int shade_tra_samples(ShadeSample *ssamp, StrandShadeCache *cache, int x,
 		shade_samples_do_AO(ssamp);
 		
 		/* if shade (all shadepinputs have same passflag) */
-		if(shi->passflag & ~(SCE_PASS_Z|SCE_PASS_INDEXOB|SCE_PASS_INDEXMA)) {
-			for(samp=0; samp<ssamp->tot; samp++, shi++, shr++) {
+		if (shi->passflag & ~(SCE_PASS_Z|SCE_PASS_INDEXOB|SCE_PASS_INDEXMA)) {
+			for (samp=0; samp<ssamp->tot; samp++, shi++, shr++) {
 				shade_input_set_shade_texco(shi);
 				shade_input_do_shade(shi, shr);
 				
 				/* include lamphalos for ztra, since halo layer was added already */
-				if(R.flag & R_LAMPHALO)
-					if(shi->layflag & SCE_LAY_HALO)
+				if (R.flag & R_LAMPHALO)
+					if (shi->layflag & SCE_LAY_HALO)
 						renderspothalo(shi, shr->combined, shr->combined[3]);
 			}
 		}
-		else if(shi->passflag & SCE_PASS_Z) {
-			for(samp=0; samp<ssamp->tot; samp++, shi++, shr++)
+		else if (shi->passflag & SCE_PASS_Z) {
+			for (samp=0; samp<ssamp->tot; samp++, shi++, shr++)
 				shr->z= -shi->co[2];
 		}
 
@@ -3858,66 +3864,66 @@ static int addtosamp_shr(ShadeResult *samp_shr, ShadeSample *ssamp, int addpassf
 {
 	int a, sample, osa = (R.osa? R.osa: 1), retval = osa;
 	
-	for(a=0; a < osa; a++, samp_shr++) {
+	for (a=0; a < osa; a++, samp_shr++) {
 		ShadeInput *shi= ssamp->shi;
 		ShadeResult *shr= ssamp->shr;
 		
-		for(sample=0; sample<ssamp->tot; sample++, shi++, shr++) {
+		for (sample=0; sample<ssamp->tot; sample++, shi++, shr++) {
 		
-			if(shi->mask & (1<<a)) {
+			if (shi->mask & (1<<a)) {
 				float fac= (1.0f - samp_shr->combined[3])*shr->combined[3];
 				
 				addAlphaUnderFloat(samp_shr->combined, shr->combined);
 				
 				samp_shr->z= MIN2(samp_shr->z, shr->z);
 
-				if(addpassflag & SCE_PASS_VECTOR) {
+				if (addpassflag & SCE_PASS_VECTOR) {
 					copy_v4_v4(samp_shr->winspeed, shr->winspeed);
 				}
 				/* optim... */
-				if(addpassflag & ~(SCE_PASS_VECTOR)) {
+				if (addpassflag & ~(SCE_PASS_VECTOR)) {
 					
-					if(addpassflag & SCE_PASS_RGBA)
+					if (addpassflag & SCE_PASS_RGBA)
 						addAlphaUnderFloat(samp_shr->col, shr->col);
 					
-					if(addpassflag & SCE_PASS_NORMAL)
+					if (addpassflag & SCE_PASS_NORMAL)
 						addvecmul(samp_shr->nor, shr->nor, fac);
 
-					if(addpassflag & SCE_PASS_EMIT)
+					if (addpassflag & SCE_PASS_EMIT)
 						addvecmul(samp_shr->emit, shr->emit, fac);
 
-					if(addpassflag & SCE_PASS_DIFFUSE)
+					if (addpassflag & SCE_PASS_DIFFUSE)
 						addvecmul(samp_shr->diff, shr->diff, fac);
 					
-					if(addpassflag & SCE_PASS_SPEC)
+					if (addpassflag & SCE_PASS_SPEC)
 						addvecmul(samp_shr->spec, shr->spec, fac);
 
-					if(addpassflag & SCE_PASS_SHADOW)
+					if (addpassflag & SCE_PASS_SHADOW)
 						addvecmul(samp_shr->shad, shr->shad, fac);
 
-					if(addpassflag & SCE_PASS_AO)
+					if (addpassflag & SCE_PASS_AO)
 						addvecmul(samp_shr->ao, shr->ao, fac);
 
-					if(addpassflag & SCE_PASS_ENVIRONMENT)
+					if (addpassflag & SCE_PASS_ENVIRONMENT)
 						addvecmul(samp_shr->env, shr->env, fac);
 
-					if(addpassflag & SCE_PASS_INDIRECT)
+					if (addpassflag & SCE_PASS_INDIRECT)
 						addvecmul(samp_shr->indirect, shr->indirect, fac);
 
-					if(addpassflag & SCE_PASS_REFLECT)
+					if (addpassflag & SCE_PASS_REFLECT)
 						addvecmul(samp_shr->refl, shr->refl, fac);
 					
-					if(addpassflag & SCE_PASS_REFRACT)
+					if (addpassflag & SCE_PASS_REFRACT)
 						addvecmul(samp_shr->refr, shr->refr, fac);
 					
-					if(addpassflag & SCE_PASS_MIST)
+					if (addpassflag & SCE_PASS_MIST)
 						samp_shr->mist= samp_shr->mist+fac*shr->mist;
 
 				}
 			}
 		}
 		
-		if(samp_shr->combined[3]>0.999f) retval--;
+		if (samp_shr->combined[3]>0.999f) retval--;
 	}
 	return retval;
 }
@@ -3930,11 +3936,11 @@ static void reset_sky_speedvectors(RenderPart *pa, RenderLayer *rl, float *rectf
 	int a;
 	
 	fp= RE_RenderLayerGetPass(rl, SCE_PASS_VECTOR);
-	if(fp==NULL) return;
+	if (fp==NULL) return;
 	col= rectf+3;
 	
-	for(a= 4*pa->rectx*pa->recty -4; a>=0; a-=4) {
-		if(col[a]==0.0f) {
+	for (a= 4*pa->rectx*pa->recty -4; a>=0; a-=4) {
+		if (col[a]==0.0f) {
 			fp[a]= PASS_VECTOR_MAX;
 			fp[a+1]= PASS_VECTOR_MAX;
 			fp[a+2]= PASS_VECTOR_MAX;
@@ -3967,17 +3973,17 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
 	unsigned short *ztramask= NULL, filled;
 
 	/* looks nicer for calling code */
-	if(R.test_break(R.tbh))
+	if (R.test_break(R.tbh))
 		return NULL;
 	
-	if(R.osa>16) { /* MAX_OSA */
+	if (R.osa>16) { /* MAX_OSA */
 		printf("zbuffer_transp_shade: osa too large\n");
 		G.afbreek= 1;
 		return NULL;
 	}
 	
 	APixbuf= MEM_callocN(pa->rectx*pa->recty*sizeof(APixstr), "APixbuf");
-	if(R.totstrand && (rl->layflag & SCE_LAY_STRAND)) {
+	if (R.totstrand && (rl->layflag & SCE_LAY_STRAND)) {
 		APixbufstrand= MEM_callocN(pa->rectx*pa->recty*sizeof(APixstrand), "APixbufstrand");
 		sscache= strand_shade_cache_create();
 	}
@@ -3986,7 +3992,7 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
 	shade_sample_initialize(&ssamp, pa, rl);
 	addpassflag= rl->passflag & ~(SCE_PASS_COMBINED);
 	
-	if(R.osa)
+	if (R.osa)
 		sampalpha= 1.0f/(float)R.osa;
 	else
 		sampalpha= 1.0f;
@@ -3994,12 +4000,12 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
 	/* fill the Apixbuf */
 	doztra= zbuffer_abuf_render(pa, APixbuf, APixbufstrand, &apsmbase, rl, sscache);
 
-	if(doztra == 0) {
+	if (doztra == 0) {
 		/* nothing filled in */
 		MEM_freeN(APixbuf);
-		if(APixbufstrand)
+		if (APixbufstrand)
 			MEM_freeN(APixbufstrand);
-		if(sscache)
+		if (sscache)
 			strand_shade_cache_free(sscache);
 		freepsA(&apsmbase);
 		return NULL;
@@ -4013,20 +4019,20 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
 	totfullsample= get_sample_layers(pa, rl, rlpp);
 	
 	/* irregular shadowb buffer creation */
-	if(R.r.mode & R_SHADOW)
+	if (R.r.mode & R_SHADOW)
 		ISB_create(pa, APixbuf);
 
 	/* masks, to have correct alpha combine */
-	if(R.osa && (rl->layflag & SCE_LAY_SOLID) && pa->fullresult.first==NULL)
+	if (R.osa && (rl->layflag & SCE_LAY_SOLID) && pa->fullresult.first==NULL)
 		ztramask= MEM_callocN(pa->rectx*pa->recty*sizeof(short), "ztramask");
 
 	/* zero alpha pixels get speed vector max again */
-	if(addpassflag & SCE_PASS_VECTOR)
-		if(rl->layflag & SCE_LAY_SOLID)
+	if (addpassflag & SCE_PASS_VECTOR)
+		if (rl->layflag & SCE_LAY_SOLID)
 			reset_sky_speedvectors(pa, rl, rl->acolrect?rl->acolrect:rl->rectf);	/* if acolrect is set we use it */
 
 	/* filtered render, for now we assume only 1 filter size */
-	if(pa->crop) {
+	if (pa->crop) {
 		crop= 1;
 		offs= pa->rectx + 1;
 		passrect+= 4*offs;
@@ -4035,40 +4041,40 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
 	}
 	
 	/* init scanline updates */
-	rr->renrect.ymin= 0;
-	rr->renrect.ymax= -pa->crop;
+	rr->renrect.ymin = 0;
+	rr->renrect.ymax = -pa->crop;
 	rr->renlay= rl;
 				
 	/* render the tile */
-	for(y=pa->disprect.ymin+crop; y<pa->disprect.ymax-crop; y++, rr->renrect.ymax++) {
+	for (y=pa->disprect.ymin+crop; y<pa->disprect.ymax-crop; y++, rr->renrect.ymax++) {
 		pass= passrect;
 		ap= aprect;
 		apstrand= aprectstrand;
 		od= offs;
 		
-		if(R.test_break(R.tbh))
+		if (R.test_break(R.tbh))
 			break;
 		
-		for(x=pa->disprect.xmin+crop; x<pa->disprect.xmax-crop; x++, ap++, apstrand++, pass+=4, od++) {
+		for (x=pa->disprect.xmin+crop; x<pa->disprect.xmax-crop; x++, ap++, apstrand++, pass+=4, od++) {
 			
-			if(ap->p[0]==0 && (!APixbufstrand || apstrand->p[0]==0)) {
-				if(addpassflag & SCE_PASS_VECTOR) 
+			if (ap->p[0]==0 && (!APixbufstrand || apstrand->p[0]==0)) {
+				if (addpassflag & SCE_PASS_VECTOR) 
 					add_transp_speed(rl, od, NULL, 0.0f, rdrect);
 			}
 			else {
 				/* sort in z */
 				totface= 0;
 				apn= ap;
-				while(apn) {
-					for(a=0; a<4; a++) {
-						if(apn->p[a]) {
+				while (apn) {
+					for (a=0; a<4; a++) {
+						if (apn->p[a]) {
 							zrow[totface].obi= apn->obi[a];
 							zrow[totface].z= apn->z[a];
 							zrow[totface].p= apn->p[a];
 							zrow[totface].mask= apn->mask[a];
 							zrow[totface].segment= -1;
 							totface++;
-							if(totface>=MAX_ZROW) totface= MAX_ZROW-1;
+							if (totface>=MAX_ZROW) totface= MAX_ZROW-1;
 						}
 						else break;
 					}
@@ -4076,19 +4082,19 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
 				}
 
 				apnstrand= (APixbufstrand)? apstrand: NULL;
-				while(apnstrand) {
-					for(a=0; a<4; a++) {
-						if(apnstrand->p[a]) {
+				while (apnstrand) {
+					for (a=0; a<4; a++) {
+						if (apnstrand->p[a]) {
 							zrow[totface].obi= apnstrand->obi[a];
 							zrow[totface].z= apnstrand->z[a];
 							zrow[totface].p= apnstrand->p[a];
 							zrow[totface].mask= apnstrand->mask[a];
 							zrow[totface].segment= apnstrand->seg[a];
 
-							if(R.osa) {
+							if (R.osa) {
 								totsample= 0;
-								for(b=0; b<R.osa; b++)
-									if(zrow[totface].mask & (1<<b))
+								for (b=0; b<R.osa; b++)
+									if (zrow[totface].mask & (1<<b))
 										totsample++;
 							}
 							else
@@ -4097,43 +4103,43 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
 							zrow[totface].u= apnstrand->u[a]/totsample;
 							zrow[totface].v= apnstrand->v[a]/totsample;
 							totface++;
-							if(totface>=MAX_ZROW) totface= MAX_ZROW-1;
+							if (totface>=MAX_ZROW) totface= MAX_ZROW-1;
 						}
 					}
 					apnstrand= apnstrand->next;
 				}
 
-				if(totface==2) {
-					if(zrow[0].z < zrow[1].z) {
+				if (totface==2) {
+					if (zrow[0].z < zrow[1].z) {
 						SWAP(ZTranspRow, zrow[0], zrow[1]);
 					}
 					
 				}
-				else if(totface>2) {
+				else if (totface>2) {
 					qsort(zrow, totface, sizeof(ZTranspRow), vergzvlak);
 				}
 				
 				/* front face does index pass for transparent, no AA or filters, but yes FSA */
-				if(addpassflag & SCE_PASS_INDEXOB) {
+				if (addpassflag & SCE_PASS_INDEXOB) {
 					ObjectRen *obr= R.objectinstance[zrow[totface-1].obi].obr;
-					if(obr->ob) {
-						for(a= 0; a<totfullsample; a++)
+					if (obr->ob) {
+						for (a= 0; a<totfullsample; a++)
 							add_transp_obindex(rlpp[a], od, obr->ob);
 					}
 				}
-				if(addpassflag & SCE_PASS_INDEXMA) {
+				if (addpassflag & SCE_PASS_INDEXMA) {
 					ObjectRen *obr= R.objectinstance[zrow[totface-1].obi].obr;
-					if(obr->ob) {
-						for(a= 0; a<totfullsample; a++)
+					if (obr->ob) {
+						for (a= 0; a<totfullsample; a++)
 							add_transp_obindex(rlpp[a], od, obr->ob);
 					}
 				}
 
 				/* for each mask-sample we alpha-under colors. then in end it's added using filter */
 				memset(samp_shr, 0, sizeof(ShadeResult)*osa);
-				for(a=0; a<osa; a++) {
+				for (a=0; a<osa; a++) {
 					samp_shr[a].z= 10e10f;
-					if(addpassflag & SCE_PASS_VECTOR) {
+					if (addpassflag & SCE_PASS_VECTOR) {
 						samp_shr[a].winspeed[0]= PASS_VECTOR_MAX;
 						samp_shr[a].winspeed[1]= PASS_VECTOR_MAX;
 						samp_shr[a].winspeed[2]= PASS_VECTOR_MAX;
@@ -4141,16 +4147,16 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
 					}
 				}
 
-				if(R.osa==0) {
-					while(totface>0) {
+				if (R.osa==0) {
+					while (totface>0) {
 						totface--;
 						
-						if(shade_tra_samples(&ssamp, sscache, x, y, &zrow[totface], addpassflag)) {
+						if (shade_tra_samples(&ssamp, sscache, x, y, &zrow[totface], addpassflag)) {
 							filled= addtosamp_shr(samp_shr, &ssamp, addpassflag);
 							addAlphaUnderFloat(pass, ssamp.shr[0].combined);
 							
-							if(filled == 0) {
-								if(sscache)
+							if (filled == 0) {
+								if (sscache)
 									unref_strand_samples(sscache, zrow, totface);
 								break;
 							}
@@ -4158,25 +4164,25 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
 					}
 
 					alpha= samp_shr->combined[3];
-					if(alpha!=0.0f) {
+					if (alpha!=0.0f) {
 						add_transp_passes(rl, od, samp_shr, alpha);
-						if(addpassflag & SCE_PASS_VECTOR)
+						if (addpassflag & SCE_PASS_VECTOR)
 							add_transp_speed(rl, od, samp_shr->winspeed, alpha, rdrect);
 					}
 				}
 				else {
 					short *sp= (short *)(ztramask+od);
 					
-					while(totface>0) {
+					while (totface>0) {
 						totface--;
 						
-						if(shade_tra_samples(&ssamp, sscache, x, y, &zrow[totface], addpassflag)) {
+						if (shade_tra_samples(&ssamp, sscache, x, y, &zrow[totface], addpassflag)) {
 							filled= addtosamp_shr(samp_shr, &ssamp, addpassflag);
 							
-							if(ztramask)
+							if (ztramask)
 								*sp |= zrow[totface].mask;
-							if(filled==0) {
-								if(sscache)
+							if (filled==0) {
+								if (sscache)
 									unref_strand_samples(sscache, zrow, totface);
 								break;
 							}
@@ -4184,16 +4190,16 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
 					}
 					
 					/* multisample buffers or filtered mask filling? */
-					if(pa->fullresult.first) {
-						for(a=0; a<R.osa; a++) {
+					if (pa->fullresult.first) {
+						for (a=0; a<R.osa; a++) {
 							alpha= samp_shr[a].combined[3];
-							if(alpha!=0.0f) {
+							if (alpha!=0.0f) {
 								RenderLayer *rl= ssamp.rlpp[a];
 								
 								addAlphaOverFloat(rl->rectf + 4*od, samp_shr[a].combined);
 				
 								add_transp_passes(rl, od, &samp_shr[a], alpha);
-								if(addpassflag & SCE_PASS_VECTOR)
+								if (addpassflag & SCE_PASS_VECTOR)
 									add_transp_speed(rl, od, samp_shr[a].winspeed, alpha, rdrect);
 							}
 						}
@@ -4202,19 +4208,19 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
 						alpha= 0.0f;
 
 						/* note; cannot use pass[3] for alpha due to filtermask */
-						for(a=0; a<R.osa; a++) {
+						for (a=0; a<R.osa; a++) {
 							add_filt_fmask(1<<a, samp_shr[a].combined, pass, rr->rectx);
 							alpha+= samp_shr[a].combined[3];
 						}
 						
-						if(addpassflag) {
+						if (addpassflag) {
 							alpha*= sampalpha;
 							
 							/* merge all in one, and then add */
 							merge_transp_passes(rl, samp_shr);
 							add_transp_passes(rl, od, samp_shr, alpha);
 
-							if(addpassflag & SCE_PASS_VECTOR)
+							if (addpassflag & SCE_PASS_VECTOR)
 								add_transp_speed(rl, od, samp_shr[0].winspeed, alpha, rdrect);
 						}
 					}
@@ -4232,13 +4238,13 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
 	rr->renlay= NULL;
 
 	MEM_freeN(APixbuf);
-	if(APixbufstrand)
+	if (APixbufstrand)
 		MEM_freeN(APixbufstrand);
-	if(sscache)
+	if (sscache)
 		strand_shade_cache_free(sscache);
 	freepsA(&apsmbase);	
 
-	if(R.r.mode & R_SHADOW)
+	if (R.r.mode & R_SHADOW)
 		ISB_free(pa);
 
 	return ztramask;
diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt
index 5210744..2a1a1d5 100644
--- a/source/blender/windowmanager/CMakeLists.txt
+++ b/source/blender/windowmanager/CMakeLists.txt
@@ -136,4 +136,10 @@ if(WITH_BUILDINFO)
 	add_definitions(-DWITH_BUILDINFO)
 endif()
 
+if(WIN322)
+	list(APPEND INC
+		../../../intern/utfconv
+	)
+endif()
+
 blender_add_lib_nolist(bf_windowmanager "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/windowmanager/SConscript b/source/blender/windowmanager/SConscript
index ef6ddd1..57d632c 100644
--- a/source/blender/windowmanager/SConscript
+++ b/source/blender/windowmanager/SConscript
@@ -10,7 +10,7 @@ sources = env.Glob('intern/*.c')
 incs = '. ../editors/include ../python ../makesdna ../blenlib ../blenkernel'
 incs += ' ../nodes ../imbuf ../blenloader ../render/extern/include'
 incs += ' ../radiosity/extern/include'
-incs += ' ../makesrna ../gpu ../blenfont'
+incs += ' ../makesrna ../gpu ../blenfont ../bmesh'
 
 incs += ' #/intern/guardedalloc #/intern/memutil #/intern/ghost'
 incs += ' #/intern/elbeem #/extern/glew/include'
@@ -30,8 +30,9 @@ if env['OURPLATFORM'] == 'linux':
     cflags='-pthread'
     incs += ' ../../../extern/binreloc/include'
 
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
     incs += ' ' + env['BF_PTHREADS_INC']
+    incs += ' ../../intern/utfconv'
 
 if env['OURPLATFORM'] != 'darwin' or env['WITH_GHOST_COCOA']:
     sources.remove('intern' + os.sep + 'wm_apple.c')
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 132b576..4c81a0a 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -23,8 +23,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef WM_API_H
-#define WM_API_H
+#ifndef __WM_API_H__
+#define __WM_API_H__
 
 /** \file WM_api.h
  *  \ingroup wm
@@ -97,7 +97,6 @@ int			WM_read_homefile	(struct bContext *C, struct ReportList *reports, short fr
 int			WM_write_homefile	(struct bContext *C, struct wmOperator *op);
 void		WM_read_file		(struct bContext *C, const char *filepath, struct ReportList *reports);
 int			WM_write_file		(struct bContext *C, const char *target, int fileflags, struct ReportList *reports, int copy);
-void		WM_read_autosavefile(struct bContext *C);
 void		WM_autosave_init	(struct wmWindowManager *wm);
 
 			/* mouse cursors */
@@ -109,7 +108,11 @@ void		WM_cursor_grab(struct wmWindow *win, int wrap, int hide, int *bounds);
 void		WM_cursor_ungrab(struct wmWindow *win);
 void		WM_timecursor		(struct wmWindow *win, int nr);
 
-void		*WM_paint_cursor_activate(struct wmWindowManager *wm, int (*poll)(struct bContext *C), void (*draw)(struct bContext *C, int, int, void *customdata), void *customdata);
+void		*WM_paint_cursor_activate(struct wmWindowManager *wm,
+                                      int (*poll)(struct bContext *C),
+                                      void (*draw)(struct bContext *C, int, int, void *customdata),
+                                      void *customdata);
+
 void		WM_paint_cursor_end(struct wmWindowManager *wm, void *handle);
 
 void		WM_cursor_warp		(struct wmWindow *win, int x, int y);
@@ -163,6 +166,7 @@ int			WM_enum_search_invoke(struct bContext *C, struct wmOperator *op, struct wm
 int			WM_operator_confirm		(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
 		/* invoke callback, file selector "filepath" unset + exec */
 int			WM_operator_filesel		(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
+int         WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const char imtype);
 			/* poll callback, context checks */
 int			WM_operator_winactive	(struct bContext *C);
 			/* invoke callback, exec + redo popup */
@@ -211,6 +215,9 @@ void		WM_operator_properties_select_all(struct wmOperatorType *ot);
 int         WM_operator_check_ui_enabled(const struct bContext *C, const char *idname);
 wmOperator *WM_operator_last_redo(const struct bContext *C);
 
+int         WM_operator_last_properties_init(struct wmOperator *op);
+int         WM_operator_last_properties_store(struct wmOperator *op);
+
 /* MOVE THIS SOMEWHERE ELSE */
 #define	SEL_TOGGLE		0
 #define	SEL_SELECT		1
@@ -227,7 +234,7 @@ wmOperator *WM_operator_last_redo(const struct bContext *C);
 #define WM_FILESEL_FILES		(1 << 4)
 
 
-		/* operator as a python command (resultuing string must be free'd) */
+		/* operator as a python command (resultuing string must be freed) */
 char		*WM_operator_pystring(struct bContext *C, struct wmOperatorType *ot, struct PointerRNA *opptr, int all_args);
 void		WM_operator_bl_idname(char *to, const char *from);
 void		WM_operator_py_idname(char *to, const char *from);
@@ -256,9 +263,6 @@ int			WM_gesture_straightline_invoke(struct bContext *C, struct wmOperator *op,
 int			WM_gesture_straightline_modal(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
 int			WM_gesture_straightline_cancel(struct bContext *C, struct wmOperator *op);
 
-			/* default operator for arearegions, generates event */
-void		WM_OT_tweak_gesture(struct wmOperatorType *ot);
-
 			/* Gesture manager API */
 struct wmGesture *WM_gesture_new(struct bContext *C, struct wmEvent *event, int type);
 void		WM_gesture_end(struct bContext *C, struct wmGesture *gesture);
@@ -329,11 +333,6 @@ void		WM_clipboard_text_set(char *buf, int selection);
 void		WM_progress_set(struct wmWindow *win, float progress);
 void		WM_progress_clear(struct wmWindow *win);
 
-#ifdef WIN32
-			/* Windows System Console */
-void		WM_console_toggle(struct bContext *C, short show);
-#endif
-
 			/* Draw (for screenshot) */
 void		WM_redraw_windows(struct bContext *C);
 
@@ -344,5 +343,5 @@ int write_crash_blend(void);
 }
 #endif
 
-#endif /* WM_API_H */
+#endif /* __WM_API_H__ */
 
diff --git a/source/blender/windowmanager/WM_keymap.h b/source/blender/windowmanager/WM_keymap.h
index f254358..78dbd25 100644
--- a/source/blender/windowmanager/WM_keymap.h
+++ b/source/blender/windowmanager/WM_keymap.h
@@ -23,8 +23,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef WM_KEYMAP_H
-#define WM_KEYMAP_H
+#ifndef __WM_KEYMAP_H__
+#define __WM_KEYMAP_H__
 
 /** \file WM_keymap.h
  *  \ingroup wm
@@ -80,6 +80,7 @@ int			WM_keymap_item_compare(struct wmKeyMapItem *k1, struct wmKeyMapItem *k2);
 wmKeyMap	*WM_modalkeymap_add(struct wmKeyConfig *keyconf, const char *idname, struct EnumPropertyItem *items);
 wmKeyMap	*WM_modalkeymap_get(struct wmKeyConfig *keyconf, const char *idname);
 wmKeyMapItem *WM_modalkeymap_add_item(struct wmKeyMap *km, int type, int val, int modifier, int keymodifier, int value);
+wmKeyMapItem *WM_modalkeymap_add_item_str(struct wmKeyMap *km, int type, int val, int modifier, int keymodifier, const char *value);
 void		WM_modalkeymap_assign(struct wmKeyMap *km, const char *opname);
 
 /* Keymap Editor */
@@ -98,5 +99,5 @@ char		*WM_key_event_operator_string(const struct bContext *C, const char *opname
 }
 #endif
 
-#endif /* WM_KEYMAP_H */
+#endif /* __WM_KEYMAP_H__ */
 
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 357eaf2..7cbeab6 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -28,8 +28,8 @@
  *  \ingroup wm
  */
 
-#ifndef WM_TYPES_H
-#define WM_TYPES_H
+#ifndef __WM_TYPES_H__
+#define __WM_TYPES_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -137,13 +137,13 @@ typedef struct wmNotifier {
 } wmNotifier;
 
 
-/* 4 levels 
-
-0xFF000000; category
-0x00FF0000; data
-0x0000FF00; data subtype (unused?)
-0x000000FF; action
-*/
+/* 4 levels
+ *
+ * 0xFF000000; category
+ * 0x00FF0000; data
+ * 0x0000FF00; data subtype (unused?)
+ * 0x000000FF; action
+ */
 
 /* category */
 #define NOTE_CATEGORY		0xFF000000
@@ -348,8 +348,8 @@ typedef struct wmEvent {
 	int mval[2];		/* region mouse position, name convention pre 2.5 :) */
 	char utf8_buf[6];	/* from, ghost if utf8 is enabled for the platform,
 						 * BLI_str_utf8_size() must _always_ be valid, check
-						 * when assigning s we dont need to check on every access after */
-	char ascii;			/* from ghost, fallback if utf8 isnt set */
+						 * when assigning s we don't need to check on every access after */
+	char ascii;			/* from ghost, fallback if utf8 isn't set */
 	char pad;
 
 	/* previous state */
@@ -428,7 +428,6 @@ typedef struct wmTimer {
 	int sleep;				/* internal, put timers to sleep when needed */
 } wmTimer;
 
-
 typedef struct wmOperatorType {
 	const char *name;		/* text for ui, undo */
 	const char *idname;		/* unique identifier */
@@ -448,7 +447,7 @@ typedef struct wmOperatorType {
 
 	/* for modal temporary operators, initially invoke is called. then
 	 * any further events are handled in modal. if the operation is
-	 * cancelled due to some external reason, cancel is called
+	 * canceled due to some external reason, cancel is called
 	 * - see defines below for return values */
 	int (*invoke)(struct bContext *, struct wmOperator *, struct wmEvent *);
 	int (*cancel)(struct bContext *, struct wmOperator *);
@@ -464,6 +463,9 @@ typedef struct wmOperatorType {
 	/* rna for properties */
 	struct StructRNA *srna;
 
+	/* previous settings - for initializing on re-use */
+	struct IDProperty *last_properties;
+
 	/* rna property to use for generic invoke functions.
 	 * menus, enum search... etc */
 	PropertyRNA *prop;
@@ -569,5 +571,5 @@ typedef struct RecentFile {
 }
 #endif
 
-#endif /* WM_TYPES_H */
+#endif /* __WM_TYPES_H__ */
 
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index c6c67e2..638dd4c 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -69,37 +69,37 @@
 
 /* ****************************************************** */
 
-#define MAX_OP_REGISTERED	32
+#define MAX_OP_REGISTERED   32
 
 void WM_operator_free(wmOperator *op)
 {
 
 #ifdef WITH_PYTHON
-	if(op->py_instance) {
-		/* do this first incase there are any __del__ functions or
+	if (op->py_instance) {
+		/* do this first in case there are any __del__ functions or
 		 * similar that use properties */
 		BPY_DECREF(op->py_instance);
 	}
 #endif
 
-	if(op->ptr) {
-		op->properties= op->ptr->data;
+	if (op->ptr) {
+		op->properties = op->ptr->data;
 		MEM_freeN(op->ptr);
 	}
 
-	if(op->properties) {
+	if (op->properties) {
 		IDP_FreeProperty(op->properties);
 		MEM_freeN(op->properties);
 	}
 
-	if(op->reports && (op->reports->flag & RPT_FREE)) {
+	if (op->reports && (op->reports->flag & RPT_FREE)) {
 		BKE_reports_clear(op->reports);
 		MEM_freeN(op->reports);
 	}
 
-	if(op->macro.first) {
+	if (op->macro.first) {
 		wmOperator *opm, *opmnext;
-		for(opm= op->macro.first; opm; opm= opmnext) {
+		for (opm = op->macro.first; opm; opm = opmnext) {
 			opmnext = opm->next;
 			WM_operator_free(opm);
 		}
@@ -118,22 +118,22 @@ static void wm_reports_free(wmWindowManager *wm)
 /* called on event handling by event_system.c */
 void wm_operator_register(bContext *C, wmOperator *op)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 	int tot;
 
 	BLI_addtail(&wm->operators, op);
-	tot= BLI_countlist(&wm->operators);
+	tot = BLI_countlist(&wm->operators);
 	
-	while(tot>MAX_OP_REGISTERED) {
-		wmOperator *opt= wm->operators.first;
+	while (tot > MAX_OP_REGISTERED) {
+		wmOperator *opt = wm->operators.first;
 		BLI_remlink(&wm->operators, opt);
 		WM_operator_free(opt);
 		tot--;
 	}
 	
 	/* so the console is redrawn */
-	WM_event_add_notifier(C, NC_SPACE|ND_SPACE_INFO_REPORT, NULL);
-	WM_event_add_notifier(C, NC_WM|ND_HISTORY, NULL);
+	WM_event_add_notifier(C, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
+	WM_event_add_notifier(C, NC_WM | ND_HISTORY, NULL);
 }
 
 
@@ -141,41 +141,41 @@ void WM_operator_stack_clear(wmWindowManager *wm)
 {
 	wmOperator *op;
 	
-	while((op= wm->operators.first)) {
+	while ((op = wm->operators.first)) {
 		BLI_remlink(&wm->operators, op);
 		WM_operator_free(op);
 	}
 	
-	WM_main_add_notifier(NC_WM|ND_HISTORY, NULL);
+	WM_main_add_notifier(NC_WM | ND_HISTORY, NULL);
 }
 
 /* ****************************************** */
 
-static GHash *menutypes_hash= NULL;
+static GHash *menutypes_hash = NULL;
 
 MenuType *WM_menutype_find(const char *idname, int quiet)
 {
-	MenuType* mt;
+	MenuType *mt;
 
 	if (idname[0]) {
-		mt= BLI_ghash_lookup(menutypes_hash, idname);
-		if(mt)
+		mt = BLI_ghash_lookup(menutypes_hash, idname);
+		if (mt)
 			return mt;
 	}
 
-	if(!quiet)
+	if (!quiet)
 		printf("search for unknown menutype %s\n", idname);
 
 	return NULL;
 }
 
-int WM_menutype_add(MenuType* mt)
+int WM_menutype_add(MenuType *mt)
 {
 	BLI_ghash_insert(menutypes_hash, (void *)mt->idname, mt);
 	return 1;
 }
 
-void WM_menutype_freelink(MenuType* mt)
+void WM_menutype_freelink(MenuType *mt)
 {
 	BLI_ghash_remove(menutypes_hash, mt->idname, NULL, (GHashValFreeFP)MEM_freeN);
 }
@@ -183,45 +183,45 @@ void WM_menutype_freelink(MenuType* mt)
 /* called on initialize WM_init() */
 void WM_menutype_init(void)
 {
-	menutypes_hash= BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "menutypes_hash gh");
+	menutypes_hash = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "menutypes_hash gh");
 }
 
 void WM_menutype_free(void)
 {
-	GHashIterator *iter= BLI_ghashIterator_new(menutypes_hash);
+	GHashIterator *iter = BLI_ghashIterator_new(menutypes_hash);
 
-	for( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
-		MenuType *mt= BLI_ghashIterator_getValue(iter);
-		if(mt->ext.free) {
+	for (; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
+		MenuType *mt = BLI_ghashIterator_getValue(iter);
+		if (mt->ext.free) {
 			mt->ext.free(mt->ext.data);
 		}
 	}
 	BLI_ghashIterator_free(iter);
 
 	BLI_ghash_free(menutypes_hash, NULL, (GHashValFreeFP)MEM_freeN);
-	menutypes_hash= NULL;
+	menutypes_hash = NULL;
 }
 
 /* ****************************************** */
 
 void WM_keymap_init(bContext *C)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 
 	/* create standard key configs */
-	if(!wm->defaultconf)
-		wm->defaultconf= WM_keyconfig_new(wm, "Blender");
-	if(!wm->addonconf)
-		wm->addonconf= WM_keyconfig_new(wm, "Blender Addon");
-	if(!wm->userconf)
-		wm->userconf= WM_keyconfig_new(wm, "Blender User");
+	if (!wm->defaultconf)
+		wm->defaultconf = WM_keyconfig_new(wm, "Blender");
+	if (!wm->addonconf)
+		wm->addonconf = WM_keyconfig_new(wm, "Blender Addon");
+	if (!wm->userconf)
+		wm->userconf = WM_keyconfig_new(wm, "Blender User");
 	
 	/* initialize only after python init is done, for keymaps that
-	   use python operators */
-	if(CTX_py_init_get(C) && (wm->initialized & WM_INIT_KEYMAP) == 0) {
+	 * use python operators */
+	if (CTX_py_init_get(C) && (wm->initialized & WM_INIT_KEYMAP) == 0) {
 		/* create default key config, only initialize once,
-		   it's persistent across sessions */
-		if(!(wm->defaultconf->flag & KEYCONF_INIT_DEFAULT)) {
+		 * it's persistent across sessions */
+		if (!(wm->defaultconf->flag & KEYCONF_INIT_DEFAULT)) {
 			wm_window_keymap(wm->defaultconf);
 			ED_spacetypes_keymap(wm->defaultconf);
 
@@ -237,30 +237,30 @@ void WM_keymap_init(bContext *C)
 
 void WM_check(bContext *C)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 	
 	/* wm context */
-	if(wm==NULL) {
-		wm= CTX_data_main(C)->wm.first;
+	if (wm == NULL) {
+		wm = CTX_data_main(C)->wm.first;
 		CTX_wm_manager_set(C, wm);
 	}
-	if(wm==NULL) return;
-	if(wm->windows.first==NULL) return;
+	if (wm == NULL) return;
+	if (wm->windows.first == NULL) return;
 
 	if (!G.background) {
 		/* case: fileread */
-		if((wm->initialized & WM_INIT_WINDOW) == 0) {
+		if ((wm->initialized & WM_INIT_WINDOW) == 0) {
 			WM_keymap_init(C);
 			WM_autosave_init(wm);
 		}
 
 		/* case: no open windows at all, for old file reads */
-		wm_window_add_ghostwindows(C, wm);
+		wm_window_add_ghostwindows(wm);
 	}
 
 	/* case: fileread */
 	/* note: this runs in bg mode to set the screen context cb */
-	if((wm->initialized & WM_INIT_WINDOW) == 0) {
+	if ((wm->initialized & WM_INIT_WINDOW) == 0) {
 		ED_screens_initialize(wm);
 		wm->initialized |= WM_INIT_WINDOW;
 	}
@@ -268,18 +268,18 @@ void WM_check(bContext *C)
 
 void wm_clear_default_size(bContext *C)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 	wmWindow *win;
 	
 	/* wm context */
-	if(wm==NULL) {
-		wm= CTX_data_main(C)->wm.first;
+	if (wm == NULL) {
+		wm = CTX_data_main(C)->wm.first;
 		CTX_wm_manager_set(C, wm);
 	}
-	if(wm==NULL) return;
-	if(wm->windows.first==NULL) return;
+	if (wm == NULL) return;
+	if (wm->windows.first == NULL) return;
 	
-	for(win= wm->windows.first; win; win= win->next) {
+	for (win = wm->windows.first; win; win = win->next) {
 		win->sizex = 0;
 		win->sizey = 0;
 		win->posx = 0;
@@ -291,18 +291,18 @@ void wm_clear_default_size(bContext *C)
 /* on startup, it adds all data, for matching */
 void wm_add_default(bContext *C)
 {
-	wmWindowManager *wm= alloc_libblock(&CTX_data_main(C)->wm, ID_WM, "WinMan");
+	wmWindowManager *wm = alloc_libblock(&CTX_data_main(C)->wm, ID_WM, "WinMan");
 	wmWindow *win;
-	bScreen *screen= CTX_wm_screen(C); /* XXX from file read hrmf */
+	bScreen *screen = CTX_wm_screen(C); /* XXX from file read hrmf */
 	
 	CTX_wm_manager_set(C, wm);
-	win= wm_window_new(C);
-	win->screen= screen;
-	screen->winid= win->winid;
-	BLI_strncpy(win->screenname, screen->id.name+2, sizeof(win->screenname));
+	win = wm_window_new(C);
+	win->screen = screen;
+	screen->winid = win->winid;
+	BLI_strncpy(win->screenname, screen->id.name + 2, sizeof(win->screenname));
 	
-	wm->winactive= win;
-	wm->file_saved= 1;
+	wm->winactive = win;
+	wm->file_saved = 1;
 	wm_window_make_drawable(C, win); 
 }
 
@@ -314,22 +314,22 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
 	wmOperator *op;
 	wmKeyConfig *keyconf;
 
-	if(wm->autosavetimer)
+	if (wm->autosavetimer)
 		wm_autosave_timer_ended(wm);
 
-	while((win= wm->windows.first)) {
+	while ((win = wm->windows.first)) {
 		BLI_remlink(&wm->windows, win);
-		win->screen= NULL; /* prevent draw clear to use screen */
+		win->screen = NULL; /* prevent draw clear to use screen */
 		wm_draw_window_clear(win);
 		wm_window_free(C, wm, win);
 	}
 	
-	while((op= wm->operators.first)) {
+	while ((op = wm->operators.first)) {
 		BLI_remlink(&wm->operators, op);
 		WM_operator_free(op);
 	}
 
-	while((keyconf=wm->keyconfigs.first)) {
+	while ((keyconf = wm->keyconfigs.first)) {
 		BLI_remlink(&wm->keyconfigs, keyconf);
 		WM_keyconfig_free(keyconf);
 	}
@@ -341,14 +341,14 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
 	
 	wm_reports_free(wm);
 	
-	if(C && CTX_wm_manager(C)==wm) CTX_wm_manager_set(C, NULL);
+	if (C && CTX_wm_manager(C) == wm) CTX_wm_manager_set(C, NULL);
 }
 
 void wm_close_and_free_all(bContext *C, ListBase *wmlist)
 {
 	wmWindowManager *wm;
 	
-	while((wm=wmlist->first)) {
+	while ((wm = wmlist->first)) {
 		wm_close_and_free(C, wm);
 		BLI_remlink(wmlist, wm);
 		MEM_freeN(wm);
@@ -357,7 +357,7 @@ void wm_close_and_free_all(bContext *C, ListBase *wmlist)
 
 void WM_main(bContext *C)
 {
-	while(1) {
+	while (1) {
 		
 		/* get events from ghost, handle window events, add to window queues */
 		wm_window_process_events(C); 
diff --git a/source/blender/windowmanager/intern/wm_apple.c b/source/blender/windowmanager/intern/wm_apple.c
index e174418..1617253 100644
--- a/source/blender/windowmanager/intern/wm_apple.c
+++ b/source/blender/windowmanager/intern/wm_apple.c
@@ -40,15 +40,15 @@
 #define ID ID_
 #include <Carbon/Carbon.h>
 
-
 /* To avoid killing small end comps, we want to allow
-blender to start maximised if all the followings are true :
-- Renderer is OpenGL capable
-- Hardware acceleration
-- VRAM > 16 Mo
+ * blender to start maximised if all the followings are true :
+ * - Renderer is OpenGL capable
+ * - Hardware acceleration
+ * - VRAM > 16 Mo
+ *
+ * We will bail out if VRAM is less than 8Mo
+ */
 
-	We will bail out if VRAM is less than 8Mo
-	*/
 /* bad global, used in wm_window.c to open windows */
 int macPrefState = 0;
 
@@ -62,23 +62,23 @@ static int checkAppleVideoCard(void)
 	long value;
 	long maxvram = 0;   /* we get always more than 1 renderer, check one, at least, has 8 Mo */
 	
-	display_mask = CGDisplayIDToOpenGLDisplayMask (CGMainDisplayID() );	
+	display_mask = CGDisplayIDToOpenGLDisplayMask(CGMainDisplayID() );
 	
-	theErr = CGLQueryRendererInfo( display_mask, &rend, &nrend);
+	theErr = CGLQueryRendererInfo(display_mask, &rend, &nrend);
 	if (theErr == 0) {
-		theErr = CGLDescribeRenderer (rend, 0, kCGLRPRendererCount, &nrend);
+		theErr = CGLDescribeRenderer(rend, 0, kCGLRPRendererCount, &nrend);
 		if (theErr == 0) {
 			for (j = 0; j < nrend; j++) {
-				theErr = CGLDescribeRenderer (rend, j, kCGLRPVideoMemory, &value); 
+				theErr = CGLDescribeRenderer(rend, j, kCGLRPVideoMemory, &value);
 				if (value > maxvram)
 					maxvram = value;
 				if ((theErr == 0) && (value >= 20000000)) {
-					theErr = CGLDescribeRenderer (rend, j, kCGLRPAccelerated, &value); 
+					theErr = CGLDescribeRenderer(rend, j, kCGLRPAccelerated, &value);
 					if ((theErr == 0) && (value != 0)) {
-						theErr = CGLDescribeRenderer (rend, j, kCGLRPCompliant, &value); 
+						theErr = CGLDescribeRenderer(rend, j, kCGLRPCompliant, &value);
 						if ((theErr == 0) && (value != 0)) {
 							/*fprintf(stderr,"make it big\n");*/
-							CGLDestroyRendererInfo (rend);
+							CGLDestroyRendererInfo(rend);
 							macPrefState = 8;
 							return 1;
 						}
@@ -87,18 +87,18 @@ static int checkAppleVideoCard(void)
 			}
 		}
 	}
-	if (maxvram < 7500000 ) {       /* put a standard alert and quit*/ 
+	if (maxvram < 7500000) {        /* put a standard alert and quit*/
 		SInt16 junkHit;
-		char  inError[] = "* Not enough VRAM    ";
-		char  inText[] = "* blender needs at least 8Mb    ";
+		char inError[] = "* Not enough VRAM    ";
+		char inText[] = "* blender needs at least 8Mb    ";
 		inError[0] = 16;
 		inText[0] = 28;
 		
 		fprintf(stderr, " vram is %li . not enough, aborting\n", maxvram);
-		StandardAlert (   kAlertStopAlert, (ConstStr255Param) &inError, (ConstStr255Param)&inText,NULL,&junkHit);
+		StandardAlert(kAlertStopAlert, (ConstStr255Param) & inError, (ConstStr255Param) & inText, NULL, &junkHit);
 		abort();
 	}
-	CGLDestroyRendererInfo (rend);
+	CGLDestroyRendererInfo(rend);
 	return 0;
 }
 
@@ -106,7 +106,7 @@ static void getMacAvailableBounds(short *top, short *left, short *bottom, short
 {
 	Rect outAvailableRect;
 	
-	GetAvailableWindowPositioningBounds ( GetMainDevice(), &outAvailableRect);
+	GetAvailableWindowPositioningBounds(GetMainDevice(), &outAvailableRect);
 	
 	*top = outAvailableRect.top;  
 	*left = outAvailableRect.left;
@@ -124,13 +124,14 @@ void wm_set_apple_prefsize(int scr_x, int scr_y)
 		short top, left, bottom, right;
 		
 		getMacAvailableBounds(&top, &left, &bottom, &right);
-		WM_setprefsize(left +10,scr_y - bottom +10,right-left -20,bottom - 64);
-		G.windowstate= 0;
+		WM_setprefsize(left + 10, scr_y - bottom + 10, right - left - 20, bottom - 64);
+		G.windowstate = 0;
 		
-	} else {
+	}
+	else {
 		
 		/* 40 + 684 + (headers) 22 + 22 = 768, the powerbook screen height */
 		WM_setprefsize(120, 40, 850, 684);
-		G.windowstate= 0;
+		G.windowstate = 0;
 	}
 }
diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c
index 0770faa..f97391c 100644
--- a/source/blender/windowmanager/intern/wm_cursors.c
+++ b/source/blender/windowmanager/intern/wm_cursors.c
@@ -55,27 +55,27 @@
 /* Some simple ghost <-> blender conversions */
 static GHOST_TStandardCursor convert_cursor(int curs) 
 {
-	switch(curs) {
+	switch (curs) {
 		default:
-		case CURSOR_STD:		return GHOST_kStandardCursorDefault;
-		case CURSOR_FACESEL:	return GHOST_kStandardCursorRightArrow;
-		case CURSOR_WAIT:		return GHOST_kStandardCursorWait;
-		case CURSOR_EDIT:		return GHOST_kStandardCursorCrosshair;
+		case CURSOR_STD:        return GHOST_kStandardCursorDefault;
+		case CURSOR_FACESEL:    return GHOST_kStandardCursorRightArrow;
+		case CURSOR_WAIT:       return GHOST_kStandardCursorWait;
+		case CURSOR_EDIT:       return GHOST_kStandardCursorCrosshair;
 		case CURSOR_HELP:		
 #ifdef __APPLE__
 			return GHOST_kStandardCursorLeftRight;
 #else
 			return GHOST_kStandardCursorHelp;
 #endif
-		case CURSOR_X_MOVE:		return GHOST_kStandardCursorLeftRight;
-		case CURSOR_Y_MOVE:		return GHOST_kStandardCursorUpDown;
-		case CURSOR_PENCIL:		return GHOST_kStandardCursorPencil;
-		case CURSOR_COPY:		return GHOST_kStandardCursorCopy;
+		case CURSOR_X_MOVE:     return GHOST_kStandardCursorLeftRight;
+		case CURSOR_Y_MOVE:     return GHOST_kStandardCursorUpDown;
+		case CURSOR_PENCIL:     return GHOST_kStandardCursorPencil;
+		case CURSOR_COPY:       return GHOST_kStandardCursorCopy;
 	}
 }
 
 static void window_set_custom_cursor(wmWindow *win, unsigned char mask[16][2], 
-							  unsigned char bitmap[16][2], int hotx, int hoty) 
+                                     unsigned char bitmap[16][2], int hotx, int hoty)
 {
 	GHOST_SetCustomCursorShape(win->ghostwin, bitmap, mask, hotx, hoty);
 }
@@ -84,16 +84,17 @@ static void window_set_custom_cursor_ex(wmWindow *win, BCursor *cursor, int useB
 {
 	if (useBig) {
 		GHOST_SetCustomCursorShapeEx(win->ghostwin, 
-									 (GHOST_TUns8 *)cursor->big_bm, (GHOST_TUns8 *)cursor->big_mask, 
-									 cursor->big_sizex,cursor->big_sizey,
-									 cursor->big_hotx,cursor->big_hoty,
-									 cursor->fg_color, cursor->bg_color);
-	} else {
+		                             (GHOST_TUns8 *)cursor->big_bm, (GHOST_TUns8 *)cursor->big_mask,
+		                             cursor->big_sizex, cursor->big_sizey,
+		                             cursor->big_hotx, cursor->big_hoty,
+		                             cursor->fg_color, cursor->bg_color);
+	}
+	else {
 		GHOST_SetCustomCursorShapeEx(win->ghostwin, 
-									 (GHOST_TUns8 *)cursor->small_bm, (GHOST_TUns8 *)cursor->small_mask, 
-									 cursor->small_sizex,cursor->small_sizey,
-									 cursor->small_hotx,cursor->small_hoty,
-									 cursor->fg_color, cursor->bg_color);
+		                             (GHOST_TUns8 *)cursor->small_bm, (GHOST_TUns8 *)cursor->small_mask,
+		                             cursor->small_sizex, cursor->small_sizey,
+		                             cursor->small_hotx, cursor->small_hoty,
+		                             cursor->fg_color, cursor->bg_color);
 	}
 }
 
@@ -104,9 +105,9 @@ static BCursor *BlenderCursor[BC_NUMCURSORS]; /*Points to static BCursor Structs
 void WM_cursor_set(wmWindow *win, int curs)
 {
 
-	if (win==NULL) return; /* Can't set custom cursor before Window init */
+	if (win == NULL) return;  /* Can't set custom cursor before Window init */
 
-	if (curs==CURSOR_NONE) {
+	if (curs == CURSOR_NONE) {
 		GHOST_SetCursorVisibility(win->ghostwin, 0);
 		return;
 	}
@@ -114,28 +115,28 @@ void WM_cursor_set(wmWindow *win, int curs)
 #ifdef _WIN32
 	/* the default win32 cross cursor is barely visible,
 	 * only 1 pixel thick, use another one instead */
-	if(curs==CURSOR_EDIT)
-		curs= BC_CROSSCURSOR;
+	if (curs == CURSOR_EDIT)
+		curs = BC_CROSSCURSOR;
 #endif
 
 	GHOST_SetCursorVisibility(win->ghostwin, 1);
 	
-	if(curs == CURSOR_STD && win->modalcursor)
-		curs= win->modalcursor;
+	if (curs == CURSOR_STD && win->modalcursor)
+		curs = win->modalcursor;
 	
-	win->cursor= curs;
+	win->cursor = curs;
 	
 	/* detect if we use system cursor or Blender cursor */
-	if(curs>=BC_GHOST_CURSORS) {
+	if (curs >= BC_GHOST_CURSORS) {
 		GHOST_SetCursorShape(win->ghostwin, convert_cursor(curs));
 	}
 	else {
-		if ((curs<SYSCURSOR) || (curs>=BC_NUMCURSORS)) return;	
+		if ((curs < SYSCURSOR) || (curs >= BC_NUMCURSORS)) return;
 
-		if (curs==SYSCURSOR) {  /* System default Cursor */
+		if (curs == SYSCURSOR) {  /* System default Cursor */
 			GHOST_SetCursorShape(win->ghostwin, convert_cursor(CURSOR_STD));
 		}
-		else if ( (U.curssize==0) || (BlenderCursor[curs]->big_bm == NULL) ) {
+		else if ( (U.curssize == 0) || (BlenderCursor[curs]->big_bm == NULL) ) {
 			window_set_custom_cursor_ex(win, BlenderCursor[curs], 0);
 		}
 		else {
@@ -146,7 +147,7 @@ void WM_cursor_set(wmWindow *win, int curs)
 
 void WM_cursor_modal(wmWindow *win, int val)
 {
-	if(win->lastcursor == 0)
+	if (win->lastcursor == 0)
 		win->lastcursor = win->cursor;
 	win->modalcursor = val;
 	WM_cursor_set(win, val);
@@ -155,7 +156,7 @@ void WM_cursor_modal(wmWindow *win, int val)
 void WM_cursor_restore(wmWindow *win)
 {
 	win->modalcursor = 0;
-	if(win->lastcursor)
+	if (win->lastcursor)
 		WM_cursor_set(win, win->lastcursor);
 	win->lastcursor = 0;
 }
@@ -163,14 +164,15 @@ void WM_cursor_restore(wmWindow *win)
 /* to allow usage all over, we do entire WM */
 void WM_cursor_wait(int val)
 {
-	if(!G.background) {
-		wmWindowManager *wm= G.main->wm.first;
-		wmWindow *win= wm?wm->windows.first:NULL; 
+	if (!G.background) {
+		wmWindowManager *wm = G.main->wm.first;
+		wmWindow *win = wm ? wm->windows.first : NULL;
 		
-		for(; win; win= win->next) {
-			if(val) {
+		for (; win; win = win->next) {
+			if (val) {
 				WM_cursor_modal(win, BC_WAITCURSOR);
-			} else {
+			}
+			else {
 				WM_cursor_restore(win);
 			}
 		}
@@ -184,11 +186,11 @@ void WM_cursor_grab(wmWindow *win, int wrap, int hide, int *bounds)
 	 * */
 	GHOST_TGrabCursorMode mode = GHOST_kGrabNormal;
 
-	if(hide)		mode = GHOST_kGrabHide;
-	else if(wrap)	mode = GHOST_kGrabWrap;
-	if ((G.f & G_DEBUG) == 0) {
+	if (hide) mode = GHOST_kGrabHide;
+	else if (wrap) mode = GHOST_kGrabWrap;
+	if ((G.debug & G_DEBUG) == 0) {
 		if (win && win->ghostwin) {
-			const GHOST_TabletData *tabletdata= GHOST_GetTabletData(win->ghostwin);
+			const GHOST_TabletData *tabletdata = GHOST_GetTabletData(win->ghostwin);
 			// Note: There is no tabletdata on Windows if no tablet device is connected.
 			if (!tabletdata)
 				GHOST_SetCursorGrab(win->ghostwin, mode, bounds);
@@ -202,8 +204,8 @@ void WM_cursor_grab(wmWindow *win, int wrap, int hide, int *bounds)
 
 void WM_cursor_ungrab(wmWindow *win)
 {
-	if ((G.f & G_DEBUG) == 0) {
-		if(win && win->ghostwin) {
+	if ((G.debug & G_DEBUG) == 0) {
+		if (win && win->ghostwin) {
 			GHOST_SetCursorGrab(win->ghostwin, GHOST_kGrabDisable, NULL);
 			win->grabcursor = GHOST_kGrabDisable;
 		}
@@ -213,19 +215,22 @@ void WM_cursor_ungrab(wmWindow *win)
 /* give it a modal keymap one day? */
 int wm_cursor_arrow_move(wmWindow *win, wmEvent *event)
 {
-	if(win && event->val==KM_PRESS) {
+	if (win && event->val == KM_PRESS) {
 		
-		if(event->type==UPARROWKEY) {
-			WM_cursor_warp(win, event->x, event->y+1);
+		if (event->type == UPARROWKEY) {
+			WM_cursor_warp(win, event->x, event->y + 1);
 			return 1;
-		} else if(event->type==DOWNARROWKEY) {
-			WM_cursor_warp(win, event->x, event->y-1);
+		}
+		else if (event->type == DOWNARROWKEY) {
+			WM_cursor_warp(win, event->x, event->y - 1);
 			return 1;
-		} else if(event->type==LEFTARROWKEY) {
-			WM_cursor_warp(win, event->x-1, event->y);
+		}
+		else if (event->type == LEFTARROWKEY) {
+			WM_cursor_warp(win, event->x - 1, event->y);
 			return 1;
-		} else if(event->type==RIGHTARROWKEY) {
-			WM_cursor_warp(win, event->x+1, event->y);
+		}
+		else if (event->type == RIGHTARROWKEY) {
+			WM_cursor_warp(win, event->x + 1, event->y);
 			return 1;
 		}
 	}
@@ -237,80 +242,80 @@ int wm_cursor_arrow_move(wmWindow *win, wmEvent *event)
 void WM_timecursor(wmWindow *win, int nr)
 {
 	/* 10 8x8 digits */
-	static char number_bitmaps[10][8]= {
-	{0,  56,  68,  68,  68,  68,  68,  56}, 
-	{0,  24,  16,  16,  16,  16,  16,  56}, 
-	{0,  60,  66,  32,  16,   8,   4, 126}, 
-	{0, 124,  32,  16,  56,  64,  66,  60}, 
-	{0,  32,  48,  40,  36, 126,  32,  32}, 
-	{0, 124,   4,  60,  64,  64,  68,  56}, 
-	{0,  56,   4,   4,  60,  68,  68,  56}, 
-	{0, 124,  64,  32,  16,   8,   8,   8}, 
-	{0,  60,  66,  66,  60,  66,  66,  60}, 
-	{0,  56,  68,  68, 120,  64,  68,  56} 
+	static char number_bitmaps[10][8] = {
+		{0,  56,  68,  68,  68,  68,  68,  56},
+		{0,  24,  16,  16,  16,  16,  16,  56},
+		{0,  60,  66,  32,  16,   8,   4, 126},
+		{0, 124,  32,  16,  56,  64,  66,  60},
+		{0,  32,  48,  40,  36, 126,  32,  32},
+		{0, 124,   4,  60,  64,  64,  68,  56},
+		{0,  56,   4,   4,  60,  68,  68,  56},
+		{0, 124,  64,  32,  16,   8,   8,   8},
+		{0,  60,  66,  66,  60,  66,  66,  60},
+		{0,  56,  68,  68, 120,  64,  68,  56}
 	};
 	unsigned char mask[16][2];
-	unsigned char bitmap[16][2]= {{0}};
+	unsigned char bitmap[16][2] = {{0}};
 	int i, idx;
 	
-	if(win->lastcursor == 0)
-		win->lastcursor= win->cursor; 
+	if (win->lastcursor == 0)
+		win->lastcursor = win->cursor;
 	
 	memset(&mask, 0xFF, sizeof(mask));
 	
 	/* print number bottom right justified */
-	for (idx= 3; nr && idx>=0; idx--) {
-		char *digit= number_bitmaps[nr%10];
-		int x = idx%2;
-		int y = idx/2;
-		
-		for (i=0; i<8; i++)
-			bitmap[i + y*8][x]= digit[i];
-		nr/= 10;
+	for (idx = 3; nr && idx >= 0; idx--) {
+		char *digit = number_bitmaps[nr % 10];
+		int x = idx % 2;
+		int y = idx / 2;
+
+		for (i = 0; i < 8; i++)
+			bitmap[i + y * 8][x] = digit[i];
+		nr /= 10;
 	}
 	
 	window_set_custom_cursor(win, mask, bitmap, 7, 7);
 }
 
 
-/* ****************************************************************** 
-Custom Cursor Description:
-
-Each bit represents a pixel, so 1 byte = 8 pixels, 
-the bytes go Left to Right. Top to bottom
-the bits in a byte go right to left
-(ie;  0x01, 0x80  represents a line of 16 pix with the first and last pix set.) 
-
-A 0 in the bitmap = bg_color, a 1 fg_color
-a 0 in the mask   = transparent pix.
-
-Until 32x32 cursors are supported on all platforms, the size of the 
-small cursors MUST be 16x16.
-
-Large cursors have a MAXSIZE of 32x32.
-
-Other than that, the specified size of the cursors is just a guideline, 
-However, the char array that defines the BM and MASK must be byte aligned.
-ie a 17x17 cursor needs 3 bytes (cols) * 17 bytes (rows) 
-(3 bytes = 17 bits rounded up to nearest whole byte).  Pad extra bits
-in mask with 0's.
-
-Setting big_bm=NULL disables the large version of the cursor.
-
-******************************************************************* 
-
-There is a nice Python GUI utility that can be used for drawing cursors in
-this format in the Blender source distribution, in 
-blender/source/tools/MakeCursor.py . Start it with $ python MakeCursor.py
-It will copy its output to the console when you press 'Do it'.
-
-*/
+/* ******************************************************************
+ * Custom Cursor Description:
+ *
+ * Each bit represents a pixel, so 1 byte = 8 pixels,
+ * the bytes go Left to Right. Top to bottom
+ * the bits in a byte go right to left
+ * (ie;  0x01, 0x80  represents a line of 16 pix with the first and last pix set.)
+ *
+ * A 0 in the bitmap = bg_color, a 1 fg_color
+ * a 0 in the mask   = transparent pix.
+ *
+ * Until 32x32 cursors are supported on all platforms, the size of the
+ * small cursors MUST be 16x16.
+ *
+ * Large cursors have a MAXSIZE of 32x32.
+ *
+ * Other than that, the specified size of the cursors is just a guideline,
+ * However, the char array that defines the BM and MASK must be byte aligned.
+ * ie a 17x17 cursor needs 3 bytes (cols) * 17 bytes (rows)
+ * (3 bytes = 17 bits rounded up to nearest whole byte).  Pad extra bits
+ * in mask with 0's.
+ *
+ * Setting big_bm=NULL disables the large version of the cursor.
+ *
+ * *******************************************************************
+ *
+ * There is a nice Python GUI utility that can be used for drawing cursors in
+ * this format in the Blender source distribution, in
+ * blender/source/tools/MakeCursor.py . Start it with $ python MakeCursor.py
+ * It will copy its output to the console when you press 'Do it'.
+ *
+ */
 
 /* 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 "[]"
-are for */
+ * 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 "[]"
+ * are for */
 
 #define BEGIN_CURSOR_BLOCK {
 #define END_CURSOR_BLOCK   }
@@ -319,78 +324,78 @@ void wm_init_cursor_data(void)
 {
 	/********************** NW_ARROW Cursor **************************/
 BEGIN_CURSOR_BLOCK
-		static char nw_sbm[]={
-			0x03,  0x00,  0x05,  0x00,  0x09,  0x00,  0x11,  0x00,
-				0x21,  0x00,  0x41,  0x00,  0x81,  0x00,  0x01,  0x01,
-				0x01,  0x02,  0xc1,  0x03,  0x49,  0x00,  0x8d,  0x00,
-				0x8b,  0x00,  0x10,  0x01,  0x90,  0x01,  0x60,  0x00,
-		};
-
-		static char nw_smsk[]={
-			0x03,  0x00,  0x07,  0x00,  0x0f,  0x00,  0x1f,  0x00,
-				0x3f,  0x00,  0x7f,  0x00,  0xff,  0x00,  0xff,  0x01,
-				0xff,  0x03,  0xff,  0x03,  0x7f,  0x00,  0xff,  0x00,
-				0xfb,  0x00,  0xf0,  0x01,  0xf0,  0x01,  0x60,  0x00,
-		};
-
-		static BCursor NWArrowCursor = {
-			/*small*/
-			nw_sbm, nw_smsk,
-				16, 16, 
-				6,  7,
-				/*big*/
-				NULL, NULL,
-				32,32, 
-				15, 15,
-				/*color*/
-				BC_BLACK, BC_WHITE
-		};
-
-		BlenderCursor[BC_NW_ARROWCURSOR]=&NWArrowCursor;
+	static char nw_sbm[] = {
+		0x03,  0x00,  0x05,  0x00,  0x09,  0x00,  0x11,  0x00,
+		0x21,  0x00,  0x41,  0x00,  0x81,  0x00,  0x01,  0x01,
+		0x01,  0x02,  0xc1,  0x03,  0x49,  0x00,  0x8d,  0x00,
+		0x8b,  0x00,  0x10,  0x01,  0x90,  0x01,  0x60,  0x00,
+	};
+
+	static char nw_smsk[] = {
+		0x03,  0x00,  0x07,  0x00,  0x0f,  0x00,  0x1f,  0x00,
+		0x3f,  0x00,  0x7f,  0x00,  0xff,  0x00,  0xff,  0x01,
+		0xff,  0x03,  0xff,  0x03,  0x7f,  0x00,  0xff,  0x00,
+		0xfb,  0x00,  0xf0,  0x01,  0xf0,  0x01,  0x60,  0x00,
+	};
+
+	static BCursor NWArrowCursor = {
+		/*small*/
+		nw_sbm, nw_smsk,
+		16, 16,
+		6,  7,
+		/*big*/
+		NULL, NULL,
+		32, 32,
+		15, 15,
+		/*color*/
+		BC_BLACK, BC_WHITE
+	};
+
+	BlenderCursor[BC_NW_ARROWCURSOR] = &NWArrowCursor;
 END_CURSOR_BLOCK
 
 	///********************** NS_ARROW Cursor *************************/
 BEGIN_CURSOR_BLOCK
-		static char ns_sbm[]={
-			0x40,  0x01,  0x20,  0x02,  0x10,  0x04,  0x08,  0x08,
-				0x04,  0x10,  0x3c,  0x1e,  0x20,  0x02,  0x20,  0x02,
-				0x20,  0x02,  0x20,  0x02,  0x3c,  0x1e,  0x04,  0x10,
-				0x08,  0x08,  0x10,  0x04,  0x20,  0x02,  0x40,  0x01
-		};
-
-		static char ns_smsk[]={
-			0xc0,  0x01,  0xe0,  0x03,  0xf0,  0x07,  0xf8,  0x0f,
-				0xfc,  0x1f,  0xfc,  0x1f,  0xe0,  0x03,  0xe0,  0x03,
-				0xe0,  0x03,  0xe0,  0x03,  0xfc,  0x1f,  0xfc,  0x1f,
-				0xf8,  0x0f,  0xf0,  0x07,  0xe0,  0x03,  0xc0,  0x01
-		};
-
-		static BCursor NSArrowCursor = {
-			/*small*/
-			ns_sbm, ns_smsk,
-				16, 16, 
-				6,  7,
-				/*big*/
-				NULL, NULL,
-				32,32, 
-				15, 15,
-				/*color*/
-				BC_BLACK, BC_WHITE
-		};
-
-		BlenderCursor[BC_NS_ARROWCURSOR]=&NSArrowCursor;
+	static char ns_sbm[] = {
+		0x40,  0x01,  0x20,  0x02,  0x10,  0x04,  0x08,  0x08,
+		0x04,  0x10,  0x3c,  0x1e,  0x20,  0x02,  0x20,  0x02,
+		0x20,  0x02,  0x20,  0x02,  0x3c,  0x1e,  0x04,  0x10,
+		0x08,  0x08,  0x10,  0x04,  0x20,  0x02,  0x40,  0x01
+	};
+
+	static char ns_smsk[] = {
+		0xc0,  0x01,  0xe0,  0x03,  0xf0,  0x07,  0xf8,  0x0f,
+		0xfc,  0x1f,  0xfc,  0x1f,  0xe0,  0x03,  0xe0,  0x03,
+		0xe0,  0x03,  0xe0,  0x03,  0xfc,  0x1f,  0xfc,  0x1f,
+		0xf8,  0x0f,  0xf0,  0x07,  0xe0,  0x03,  0xc0,  0x01
+	};
+
+	static BCursor NSArrowCursor = {
+		/*small*/
+		ns_sbm, ns_smsk,
+		16, 16,
+		6,  7,
+		/*big*/
+		NULL, NULL,
+		32, 32,
+		15, 15,
+		/*color*/
+		BC_BLACK, BC_WHITE
+	};
+
+	BlenderCursor[BC_NS_ARROWCURSOR] = &NSArrowCursor;
 		
 END_CURSOR_BLOCK
 	/********************** EW_ARROW Cursor *************************/
 BEGIN_CURSOR_BLOCK
-	static char ew_sbm[]={
+	static char ew_sbm[] = {
 		0x00,  0x00,  0x00,  0x00,  0x10,  0x08,  0x38,  0x1c,
 		0x2c,  0x34,  0xe6,  0x67,  0x03,  0xc0,  0x01,  0x80,
 		0x03,  0xc0,  0xe6,  0x67,  0x2c,  0x34,  0x38,  0x1c,
 		0x10,  0x08,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
 	};
 
-	static char ew_smsk[]={
+	static char ew_smsk[] = {
 		0x00,  0x00,  0x00,  0x00,  0x10,  0x08,  0x38,  0x1c,
 		0x3c,  0x3c,  0xfe,  0x7f,  0xff,  0xff,  0xff,  0xff,
 		0xff,  0xff,  0xfe,  0x7f,  0x3c,  0x3c,  0x38,  0x1c,
@@ -404,32 +409,32 @@ BEGIN_CURSOR_BLOCK
 		7,  6,
 		/*big*/
 		NULL, NULL,
-		32,32, 
+		32, 32,
 		15, 15,
 		/*color*/
 		BC_BLACK, BC_WHITE
 	};
 
-	BlenderCursor[BC_EW_ARROWCURSOR]=&EWArrowCursor;
+	BlenderCursor[BC_EW_ARROWCURSOR] = &EWArrowCursor;
 END_CURSOR_BLOCK
 
 	/********************** Wait Cursor *****************************/
 BEGIN_CURSOR_BLOCK
-	static char wait_sbm[]={
+	static char wait_sbm[] = {
 		0xfe,  0x7f,  0x02,  0x40,  0x02,  0x40,  0x84,  0x21,
 		0xc8,  0x13,  0xd0,  0x0b,  0xa0,  0x04,  0x20,  0x05,
 		0xa0,  0x04,  0x10,  0x09,  0x88,  0x11,  0xc4,  0x23,
 		0xe2,  0x47,  0xfa,  0x5f,  0x02,  0x40,  0xfe,  0x7f,
 	};
 
-	static char wait_smsk[]={
+	static char wait_smsk[] = {
 		0xfe,  0x7f,  0xfe,  0x7f,  0x06,  0x60,  0x8c,  0x31,
 		0xd8,  0x1b,  0xf0,  0x0f,  0xe0,  0x06,  0x60,  0x07,
 		0xe0,  0x06,  0x30,  0x0d,  0x98,  0x19,  0xcc,  0x33,
 		0xe6,  0x67,  0xfe,  0x7f,  0xfe,  0x7f,  0xfe,  0x7f,
 	};
 
-	static char wait_lbm[]={
+	static char wait_lbm[] = {
 		0xfc,  0xff,  0xff,  0x3f,  0xfc,  0xff,  0xff,  0x3f,
 		0x0c,  0x00,  0x00,  0x30,  0x0c,  0x00,  0x00,  0x30,
 		0x0c,  0x00,  0x00,  0x30,  0x0c,  0x00,  0x00,  0x18,
@@ -448,7 +453,7 @@ BEGIN_CURSOR_BLOCK
 		0xfc,  0xff,  0xff,  0x3f,  0xfc,  0xff,  0xff,  0x3f,
 	};
 
-	static char wait_lmsk[]={
+	static char wait_lmsk[] = {
 		0xfc,  0xff,  0xff,  0x3f,  0xfc,  0xff,  0xff,  0x3f,
 		0xfc,  0xff,  0xff,  0x3f,  0xfc,  0xff,  0xff,  0x3f,
 		0x3c,  0x00,  0x00,  0x3c,  0x3c,  0x00,  0x00,  0x1e,
@@ -469,36 +474,36 @@ BEGIN_CURSOR_BLOCK
 
 	static BCursor WaitCursor = {
 		/*small*/
-	wait_sbm, wait_smsk,
+		wait_sbm, wait_smsk,
 		16, 16, 
 		7,  7,
 		/*big*/
 		wait_lbm, wait_lmsk,
-		32,32, 
+		32, 32,
 		15, 15,
 		/*color*/
 		BC_BLACK, BC_WHITE
 	};
 
-	BlenderCursor[BC_WAITCURSOR]=&WaitCursor;
+	BlenderCursor[BC_WAITCURSOR] = &WaitCursor;
 END_CURSOR_BLOCK
 
 	/********************** Cross Cursor ***************************/
 BEGIN_CURSOR_BLOCK
-	static char cross_sbm[]={
+	static char cross_sbm[] = {
 		0x00,  0x00,  0x80,  0x01,  0x80,  0x01,  0x80,  0x01,
 		0x80,  0x01,  0x80,  0x01,  0x80,  0x01,  0x7e,  0x7e,
 		0x7e,  0x7e,  0x80,  0x01,  0x80,  0x01,  0x80,  0x01,
 		0x80,  0x01,  0x80,  0x01,  0x80,  0x01,  0x00,  0x00,
 	};
 
-	static char cross_smsk[]={
+	static char cross_smsk[] = {
 		0x80,  0x01,  0x80,  0x01,  0x80,  0x01,  0x80,  0x01,
 		0x80,  0x01,  0x80,  0x01,  0xc0,  0x03,  0x7f,  0xfe,
 		0x7f,  0xfe,  0xc0,  0x03,  0x80,  0x01,  0x80,  0x01,
 		0x80,  0x01,  0x80,  0x01,  0x80,  0x01,  0x80,  0x01,
 	};
-	static char cross_lbm[]={
+	static char cross_lbm[] = {
 		0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
 		0x00,  0x80,  0x01,  0x00,  0x00,  0x80,  0x01,  0x00,
 		0x00,  0x80,  0x01,  0x00,  0x00,  0x80,  0x01,  0x00,
@@ -517,7 +522,7 @@ BEGIN_CURSOR_BLOCK
 		0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
 	};
 
-	static char cross_lmsk[]={
+	static char cross_lmsk[] = {
 		0x00,  0x80,  0x01,  0x00,  0x00,  0x80,  0x01,  0x00,
 		0x00,  0x80,  0x01,  0x00,  0x00,  0x80,  0x01,  0x00,
 		0x00,  0x80,  0x01,  0x00,  0x00,  0x80,  0x01,  0x00,
@@ -543,25 +548,25 @@ BEGIN_CURSOR_BLOCK
 		7,  7,
 		/*big*/
 		cross_lbm, cross_lmsk,
-		32,32, 
+		32, 32,
 		15, 15,
 		/*color*/
 		BC_BLACK, BC_WHITE
 	};
 
-	BlenderCursor[BC_CROSSCURSOR]=&CrossCursor;
+	BlenderCursor[BC_CROSSCURSOR] = &CrossCursor;
 END_CURSOR_BLOCK
 
 	/********************** EditCross Cursor ***********************/	
 BEGIN_CURSOR_BLOCK
-	static char editcross_sbm[]={
+	static char editcross_sbm[] = {
 		0x0e,  0x00,  0x11,  0x00,  0x1d,  0x00,  0x19,  0x03,
 		0x1d,  0x03,  0x11,  0x03,  0x0e,  0x03,  0x00,  0x03,
 		0xf8,  0x7c,  0xf8,  0x7c,  0x00,  0x03,  0x00,  0x03,
 		0x00,  0x03,  0x00,  0x03,  0x00,  0x03,  0x00,  0x00,
 	};
 
-	static char editcross_smsk[]={
+	static char editcross_smsk[] = {
 		0x0e,  0x00,  0x1f,  0x00,  0x1f,  0x03,  0x1f,  0x03,
 		0x1f,  0x03,  0x1f,  0x03,  0x0e,  0x03,  0x80,  0x07,
 		0xfc,  0xfc,  0xfc,  0xfc,  0x80,  0x07,  0x00,  0x03,
@@ -575,26 +580,26 @@ BEGIN_CURSOR_BLOCK
 		9,  8,
 		/*big*/
 		NULL, NULL,
-		32,32, 
+		32, 32,
 		15, 15,
 		/*color*/
 		BC_BLACK, BC_WHITE
 	};
 
-	BlenderCursor[BC_EDITCROSSCURSOR]=&EditCrossCursor;
+	BlenderCursor[BC_EDITCROSSCURSOR] = &EditCrossCursor;
 END_CURSOR_BLOCK
 
 	/********************** Box Select *************************/
 BEGIN_CURSOR_BLOCK
-	static char box_sbm[32]={
-	0x7f,  0x00,  0x41,  0x00,  0x41,  0x00,  0x41,  0x06,
+	static char box_sbm[32] = {
+		0x7f,  0x00,  0x41,  0x00,  0x41,  0x00,  0x41,  0x06,
 		0x41,  0x06,  0x41,  0x06,  0x7f,  0x06,  0x00,  0x06,
 		0xe0,  0x79,  0xe0,  0x79,  0x00,  0x06,  0x00,  0x06,
 		0x00,  0x06,  0x00,  0x06,  0x00,  0x06,  0x00,  0x00,
 	};
 
-	static char box_smsk[32]={
-	0x7f,  0x00,  0x7f,  0x00,  0x63,  0x06,  0x63,  0x06,
+	static char box_smsk[32] = {
+		0x7f,  0x00,  0x7f,  0x00,  0x63,  0x06,  0x63,  0x06,
 		0x63,  0x06,  0x7f,  0x06,  0x7f,  0x06,  0x00,  0x0f,
 		0xf0,  0xf9,  0xf0,  0xf9,  0x00,  0x0f,  0x00,  0x06,
 		0x00,  0x06,  0x00,  0x06,  0x00,  0x06,  0x00,  0x06,
@@ -608,32 +613,32 @@ BEGIN_CURSOR_BLOCK
 		9,  8,
 		/*big*/
 		NULL, NULL,
-		32,32, 
+		32, 32,
 		15, 15,
 		/*color*/
 		BC_BLACK, BC_WHITE
 	};
 
-	BlenderCursor[BC_BOXSELCURSOR]=&BoxSelCursor;
+	BlenderCursor[BC_BOXSELCURSOR] = &BoxSelCursor;
 
 END_CURSOR_BLOCK
 	/********************** Knife Cursor ***********************/
 BEGIN_CURSOR_BLOCK
-	static char knife_sbm[]={
+	static char knife_sbm[] = {
 		0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x2c,
 		0x00, 0x5a, 0x00, 0x34, 0x00, 0x2a, 0x00, 0x17,
 		0x80, 0x06, 0x40, 0x03, 0xa0, 0x03, 0xd0, 0x01,
 		0x68, 0x00, 0x1c, 0x00, 0x06, 0x00, 0x00, 0x00
 	};
 
-	static char knife_smsk[]={
+	static char knife_smsk[] = {
 		0x00, 0x60, 0x00, 0xf0, 0x00, 0xfc, 0x00, 0xfe,
 		0x00, 0xfe, 0x00, 0x7e, 0x00, 0x7f, 0x80, 0x3f,
 		0xc0, 0x0e, 0x60, 0x07, 0xb0, 0x07, 0xd8, 0x03,
 		0xec, 0x01, 0x7e, 0x00, 0x1f, 0x00, 0x07, 0x00
 	};
 
-	static char knife_lbm[]={
+	static char knife_lbm[] = {
 		0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
 		0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
 		0x00,  0x00,  0x00,  0x08,  0x00,  0x00,  0x00,  0x1c,
@@ -653,7 +658,7 @@ BEGIN_CURSOR_BLOCK
 
 	};
 
-	static char knife_lmsk[]={
+	static char knife_lmsk[] = {
 		0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
 		0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x18,
 		0x00,  0x00,  0x00,  0x3c,  0x00,  0x00,  0x00,  0x7e,
@@ -675,41 +680,41 @@ BEGIN_CURSOR_BLOCK
 
 	static BCursor KnifeCursor = {
 		/*small*/
-	knife_sbm, knife_smsk,
+		knife_sbm, knife_smsk,
 		16, 16, 
 		0,  15,
 		/*big*/
 		knife_lbm, knife_lmsk,
-		32,32, 
+		32, 32,
 		0, 31,
 		/*color*/
 		BC_BLACK, BC_WHITE
 	};
 
-	BlenderCursor[BC_KNIFECURSOR]=&KnifeCursor;
+	BlenderCursor[BC_KNIFECURSOR] = &KnifeCursor;
 
 END_CURSOR_BLOCK
 	
 	/********************** Loop Select Cursor ***********************/
 BEGIN_CURSOR_BLOCK
 
-static char vloop_sbm[]={
+	static char vloop_sbm[] = {
 		0x00,  0x00,  0x7e,  0x00,  0x3e,  0x00,  0x1e,  0x00,
 		0x0e,  0x00,  0x66,  0x60,  0x62,  0x6f,  0x00,  0x00,
 		0x20,  0x20,  0x20,  0x20,  0x20,  0x20,  0x20,  0x20,
 		0x00,  0x00,  0x60,  0x60,  0x60,  0x6f,  0x00,  0x00,
-};
+	};
 
-static char vloop_smsk[]={
+	static char vloop_smsk[] = {
 		0xff,  0x01,  0xff,  0x00,  0x7f,  0x00,  0x3f,  0x00,
 		0xff,  0xf0,  0xff,  0xff,  0xf7,  0xff,  0xf3,  0xf0,
 		0x61,  0x60,  0x60,  0x60,  0x60,  0x60,  0x60,  0x60,
 		0xf0,  0xf0,  0xf0,  0xff,  0xf0,  0xff,  0xf0,  0xf0,
-};
+	};
 
 
 
-static char vloop_lbm[]={
+	static char vloop_lbm[] = {
 		0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
 		0xfc,  0x3f,  0x00,  0x00,  0xfc,  0x3f,  0x00,  0x00,
 		0xfc,  0x0f,  0x00,  0x00,  0xfc,  0x0f,  0x00,  0x00,
@@ -726,9 +731,9 @@ static char vloop_lbm[]={
 		0x00,  0x3c,  0x00,  0x3c,  0x00,  0x3c,  0x00,  0x3c,
 		0x00,  0x3c,  0xff,  0x3c,  0x00,  0x3c,  0xff,  0x3c,
 		0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
-};
+	};
 
-static char vloop_lmsk[]={
+	static char vloop_lmsk[] = {
 		0xff,  0xff,  0x03,  0x00,  0xff,  0xff,  0x03,  0x00,
 		0xff,  0xff,  0x00,  0x00,  0xff,  0xff,  0x00,  0x00,
 		0xff,  0x3f,  0x00,  0x00,  0xff,  0x3f,  0x00,  0x00,
@@ -745,38 +750,38 @@ static char vloop_lmsk[]={
 		0x00,  0xff,  0xff,  0xff,  0x00,  0xff,  0xff,  0xff,
 		0x00,  0xff,  0xff,  0xff,  0x00,  0xff,  0xff,  0xff,
 		0x00,  0xff,  0x00,  0xff,  0x00,  0xff,  0x00,  0xff,
-};
+	};
 
 
 
 	static BCursor VLoopCursor = {
 		/*small*/
-	vloop_sbm, vloop_smsk,
+		vloop_sbm, vloop_smsk,
 		16, 16, 
 		0,  0,
 		/*big*/
 		vloop_lbm, vloop_lmsk,
-		32,32, 
+		32, 32,
 		0, 0,
 		/*color*/
 		BC_BLACK, BC_WHITE
 	};
 
-	BlenderCursor[BC_VLOOPCURSOR]=&VLoopCursor;
+	BlenderCursor[BC_VLOOPCURSOR] = &VLoopCursor;
 
-END_CURSOR_BLOCK	
+END_CURSOR_BLOCK
 	
 
 	/********************** TextEdit Cursor ***********************/	
 BEGIN_CURSOR_BLOCK
-	static char textedit_sbm[]={
+	static char textedit_sbm[] = {
 		0xe0,  0x03,  0x10,  0x04,  0x60,  0x03,  0x40,  0x01,
 		0x40,  0x01,  0x40,  0x01,  0x40,  0x01,  0x40,  0x01,
 		0x40,  0x01,  0x40,  0x01,  0x40,  0x01,  0x40,  0x01,
 		0x40,  0x01,  0x60,  0x03,  0x10,  0x04,  0xe0,  0x03,
 	};
 
-	static char textedit_smsk[]={
+	static char textedit_smsk[] = {
 		0xe0,  0x03,  0xf0,  0x07,  0xe0,  0x03,  0xc0,  0x01,
 		0xc0,  0x01,  0xc0,  0x01,  0xc0,  0x01,  0xc0,  0x01,
 		0xc0,  0x01,  0xc0,  0x01,  0xc0,  0x01,  0xc0,  0x01,
@@ -790,19 +795,19 @@ BEGIN_CURSOR_BLOCK
 		9,  8,
 		/*big*/
 		NULL, NULL,
-		32,32, 
+		32, 32,
 		15, 15,
 		/*color*/
 		BC_BLACK, BC_WHITE
 	};
 
-	BlenderCursor[BC_TEXTEDITCURSOR]=&TextEditCursor;
+	BlenderCursor[BC_TEXTEDITCURSOR] = &TextEditCursor;
 END_CURSOR_BLOCK
 
 
 	/********************** Paintbrush Cursor ***********************/	
 BEGIN_CURSOR_BLOCK
-	static char paintbrush_sbm[]={
+	static char paintbrush_sbm[] = {
 
 		0x00,  0xe0,  0x00,  0x98,  0x00,  0x44,  0x00,  0x42,
 		0x00,  0x21,  0x80,  0x20,  0x40,  0x13,  0x40,  0x17,
@@ -813,7 +818,7 @@ BEGIN_CURSOR_BLOCK
 
 	};
 
-	static char paintbrush_smsk[]={
+	static char paintbrush_smsk[] = {
 		0x00,  0xe0,  0x00,  0xf8,  0x00,  0x7c,  0x00,  0x7e,
 		0x00,  0x3f,  0x80,  0x3f,  0xc0,  0x1f,  0xc0,  0x1f,
 		0xe0,  0x0f,  0xf8,  0x07,  0xfc,  0x03,  0xfe,  0x01,
@@ -829,83 +834,83 @@ BEGIN_CURSOR_BLOCK
 		0,  15,
 		/*big*/
 		NULL, NULL,
-		32,32, 
+		32, 32,
 		15, 15,
 		/*color*/
 		BC_BLACK, BC_WHITE
 	};
 
-	BlenderCursor[BC_PAINTBRUSHCURSOR]=&PaintBrushCursor;
+	BlenderCursor[BC_PAINTBRUSHCURSOR] = &PaintBrushCursor;
 END_CURSOR_BLOCK
 
 
 /********************** Hand Cursor ***********************/
 BEGIN_CURSOR_BLOCK
 
-static char hand_sbm[]={ 
-	0x00,  0x00,  0x00,  0x00,  0x80,  0x01,  0x80,  0x0d,  
-	0x98,  0x6d,  0x98,  0x6d,  0xb0,  0x6d,  0xb0,  0x6d,  
-	0xe0,  0x6f,  0xe6,  0x7f,  0xee,  0x7f,  0xfc,  0x3f,  
-	0xf8,  0x3f,  0xf0,  0x1f,  0xc0,  0x1f,  0xc0,  0x1f,  
-};
-
-static char hand_smsk[]={ 
-	0x00,  0x00,  0x80,  0x01,  0xc0,  0x0f,  0xd8,  0x7f,  
-	0xfc,  0xff,  0xfc,  0xff,  0xf8,  0xff,  0xf8,  0xff,  
-	0xf6,  0xff,  0xff,  0xff,  0xff,  0xff,  0xfe,  0x7f,  
-	0xfc,  0x7f,  0xf8,  0x3f,  0xf0,  0x3f,  0xe0,  0x3f,  
-};
-
-
-static BCursor HandCursor = {
-	/*small*/
-	hand_sbm, hand_smsk,
-	16, 16, 
-	8,  8,
-	/*big*/
-	NULL, NULL,
-	32,32, 
-	15, 15,
-	/*color*/
-	BC_BLACK, BC_WHITE
-};
-
-BlenderCursor[BC_HANDCURSOR]=&HandCursor;
+	static char hand_sbm[] = {
+		0x00,  0x00,  0x00,  0x00,  0x80,  0x01,  0x80,  0x0d,
+		0x98,  0x6d,  0x98,  0x6d,  0xb0,  0x6d,  0xb0,  0x6d,
+		0xe0,  0x6f,  0xe6,  0x7f,  0xee,  0x7f,  0xfc,  0x3f,
+		0xf8,  0x3f,  0xf0,  0x1f,  0xc0,  0x1f,  0xc0,  0x1f,
+	};
+
+	static char hand_smsk[] = {
+		0x00,  0x00,  0x80,  0x01,  0xc0,  0x0f,  0xd8,  0x7f,
+		0xfc,  0xff,  0xfc,  0xff,  0xf8,  0xff,  0xf8,  0xff,
+		0xf6,  0xff,  0xff,  0xff,  0xff,  0xff,  0xfe,  0x7f,
+		0xfc,  0x7f,  0xf8,  0x3f,  0xf0,  0x3f,  0xe0,  0x3f,
+	};
+
+
+	static BCursor HandCursor = {
+		/*small*/
+		hand_sbm, hand_smsk,
+		16, 16,
+		8,  8,
+		/*big*/
+		NULL, NULL,
+		32, 32,
+		15, 15,
+		/*color*/
+		BC_BLACK, BC_WHITE
+	};
+
+	BlenderCursor[BC_HANDCURSOR] = &HandCursor;
 
 END_CURSOR_BLOCK
 
 /********************** NSEW Scroll Cursor ***********************/
 BEGIN_CURSOR_BLOCK
 
-static char nsewscroll_sbm[]={ 
-	0x00,  0x00,  0x80,  0x01,  0xc0,  0x03,  0xc0,  0x03,  
-	0x00,  0x00,  0x00,  0x00,  0x0c,  0x30,  0x0e,  0x70,  
-	0x0e,  0x70,  0x0c,  0x30,  0x00,  0x00,  0x00,  0x00,  
-	0xc0,  0x03,  0xc0,  0x03,  0x80,  0x01,  0x00,  0x00, 
-};
-
-static char nsewscroll_smsk[]={ 
-	0x80,  0x01,  0xc0,  0x03,  0xe0,  0x07,  0xe0,  0x07,  
-	0xc0,  0x03,  0x0c,  0x30,  0x1e,  0x78,  0x1f,  0xf8,  
-	0x1f,  0xf8,  0x1e,  0x78,  0x0c,  0x30,  0xc0,  0x03,  
-	0xe0,  0x07,  0xe0,  0x07,  0xc0,  0x03,  0x80,  0x01, 
-};
-
-
-static BCursor NSEWScrollCursor = {
-	/*small*/
-	nsewscroll_sbm, nsewscroll_smsk,
-	16, 16, 
-	8, 8,
-	/*big*/
-	NULL, NULL,
-	32,32, 
-	15, 15,
-	/*color*/
-	BC_BLACK, BC_WHITE
-};
-
-BlenderCursor[BC_NSEW_SCROLLCURSOR]=&NSEWScrollCursor;
+	static char nsewscroll_sbm[] = {
+		0x00,  0x00,  0x80,  0x01,  0xc0,  0x03,  0xc0,  0x03,
+		0x00,  0x00,  0x00,  0x00,  0x0c,  0x30,  0x0e,  0x70,
+		0x0e,  0x70,  0x0c,  0x30,  0x00,  0x00,  0x00,  0x00,
+		0xc0,  0x03,  0xc0,  0x03,  0x80,  0x01,  0x00,  0x00,
+	};
+
+	static char nsewscroll_smsk[] = {
+		0x80,  0x01,  0xc0,  0x03,  0xe0,  0x07,  0xe0,  0x07,
+		0xc0,  0x03,  0x0c,  0x30,  0x1e,  0x78,  0x1f,  0xf8,
+		0x1f,  0xf8,  0x1e,  0x78,  0x0c,  0x30,  0xc0,  0x03,
+		0xe0,  0x07,  0xe0,  0x07,  0xc0,  0x03,  0x80,  0x01,
+	};
+
+
+	static BCursor NSEWScrollCursor = {
+		/*small*/
+		nsewscroll_sbm, nsewscroll_smsk,
+		16, 16,
+		8, 8,
+		/*big*/
+		NULL, NULL,
+		32, 32,
+		15, 15,
+		/*color*/
+		BC_BLACK, BC_WHITE
+	};
+
+	BlenderCursor[BC_NSEW_SCROLLCURSOR] = &NSEWScrollCursor;
 
 END_CURSOR_BLOCK
 
@@ -913,35 +918,35 @@ END_CURSOR_BLOCK
 /********************** NS Scroll Cursor ***********************/
 BEGIN_CURSOR_BLOCK
 
-static char nsscroll_sbm[]={ 
-	0x00,  0x00,  0x80,  0x01,  0xc0,  0x03,  0xc0,  0x03,  
-	0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  
-	0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  
-	0xc0,  0x03,  0xc0,  0x03,  0x80,  0x01,  0x00,  0x00,
-};
-
-static char nsscroll_smsk[]={ 
-	0x80,  0x01,  0xc0,  0x03,  0xe0,  0x07,  0xe0,  0x07,  
-	0xc0,  0x03,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  
-	0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0xc0,  0x03,  
-	0xe0,  0x07,  0xe0,  0x07,  0xc0,  0x03,  0x80,  0x01,
-};
-
-
-static BCursor NSScrollCursor = {
-	/*small*/
-	nsscroll_sbm, nsscroll_smsk,
-	16, 16, 
-	8, 8,
-	/*big*/
-	NULL, NULL,
-	32,32, 
-	15, 15,
-	/*color*/
-	BC_BLACK, BC_WHITE
-};
-
-BlenderCursor[BC_NS_SCROLLCURSOR]=&NSScrollCursor;
+	static char nsscroll_sbm[] = {
+		0x00,  0x00,  0x80,  0x01,  0xc0,  0x03,  0xc0,  0x03,
+		0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
+		0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
+		0xc0,  0x03,  0xc0,  0x03,  0x80,  0x01,  0x00,  0x00,
+	};
+
+	static char nsscroll_smsk[] = {
+		0x80,  0x01,  0xc0,  0x03,  0xe0,  0x07,  0xe0,  0x07,
+		0xc0,  0x03,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
+		0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0xc0,  0x03,
+		0xe0,  0x07,  0xe0,  0x07,  0xc0,  0x03,  0x80,  0x01,
+	};
+
+
+	static BCursor NSScrollCursor = {
+		/*small*/
+		nsscroll_sbm, nsscroll_smsk,
+		16, 16,
+		8, 8,
+		/*big*/
+		NULL, NULL,
+		32, 32,
+		15, 15,
+		/*color*/
+		BC_BLACK, BC_WHITE
+	};
+
+	BlenderCursor[BC_NS_SCROLLCURSOR] = &NSScrollCursor;
 
 END_CURSOR_BLOCK
 
@@ -949,110 +954,105 @@ END_CURSOR_BLOCK
 /********************** EW Scroll Cursor ***********************/
 BEGIN_CURSOR_BLOCK
 
-static char ewscroll_sbm[]={ 
-	0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  
-	0x00,  0x00,  0x00,  0x00,  0x0c,  0x30,  0x0e,  0x70,  
-	0x0e,  0x70,  0x0c,  0x30,  0x00,  0x00,  0x00,  0x00,  
-	0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
-};
-
-static char ewscroll_smsk[]={ 
-	0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  
-	0x00,  0x00,  0x0c,  0x30,  0x1e,  0x78,  0x1f,  0xf8,  
-	0x1f,  0xf8,  0x1e,  0x78,  0x0c,  0x30,  0x00,  0x00,  
-	0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
-};
-
-
-static BCursor EWScrollCursor = {
-	/*small*/
-	ewscroll_sbm, ewscroll_smsk,
-	16, 16, 
-	8, 8,
-	/*big*/
-	NULL, NULL,
-	32,32, 
-	15, 15,
-	/*color*/
-	BC_BLACK, BC_WHITE
-};
-
-BlenderCursor[BC_EW_SCROLLCURSOR]=&EWScrollCursor;
+	static char ewscroll_sbm[] = {
+		0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
+		0x00,  0x00,  0x00,  0x00,  0x0c,  0x30,  0x0e,  0x70,
+		0x0e,  0x70,  0x0c,  0x30,  0x00,  0x00,  0x00,  0x00,
+		0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
+	};
+
+	static char ewscroll_smsk[] = {
+		0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
+		0x00,  0x00,  0x0c,  0x30,  0x1e,  0x78,  0x1f,  0xf8,
+		0x1f,  0xf8,  0x1e,  0x78,  0x0c,  0x30,  0x00,  0x00,
+		0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
+	};
+
+
+	static BCursor EWScrollCursor = {
+		/*small*/
+		ewscroll_sbm, ewscroll_smsk,
+		16, 16,
+		8, 8,
+		/*big*/
+		NULL, NULL,
+		32, 32,
+		15, 15,
+		/*color*/
+		BC_BLACK, BC_WHITE
+	};
+
+	BlenderCursor[BC_EW_SCROLLCURSOR] = &EWScrollCursor;
 
 END_CURSOR_BLOCK
 
 /********************** Eyedropper Cursor ***********************/
 BEGIN_CURSOR_BLOCK
 
-static char eyedropper_sbm[]={ 
-	0x00,  0x30,  0x00,  0x48,  0x00,  0x85,  0x80,  0x82,  
-	0x40,  0x40,  0x80,  0x20,  0x40,  0x11,  0xa0,  0x23,  
-	0xd0,  0x15,  0xe8,  0x0a,  0x74,  0x01,  0xb4,  0x00,  
-	0x4a,  0x00,  0x35,  0x00,  0x08,  0x00,  0x04,  0x00,
-};
-
-static char eyedropper_smsk[]={ 
-	0x00,  0x30,  0x00,  0x78,  0x00,  0xfd,  0x80,  0xff,  
-	0xc0,  0x7f,  0x80,  0x3f,  0xc0,  0x1f,  0xe0,  0x3f,  
-	0xf0,  0x1f,  0xf8,  0x0b,  0xfc,  0x01,  0xfc,  0x00,  
-	0x7e,  0x00,  0x3f,  0x00,  0x0c,  0x00,  0x04,  0x00, 
-};
-
-
-static BCursor EyedropperCursor = {
-	/*small*/
-	eyedropper_sbm, eyedropper_smsk,
-	16, 16, 
-	1, 15,
-	/*big*/
-	NULL, NULL,
-	32,32, 
-	15, 15,
-	/*color*/
-	BC_BLACK, BC_WHITE
-};
-
-BlenderCursor[BC_EYEDROPPER_CURSOR]=&EyedropperCursor;
+	static char eyedropper_sbm[] = {
+		0x00,  0x30,  0x00,  0x48,  0x00,  0x85,  0x80,  0x82,
+		0x40,  0x40,  0x80,  0x20,  0x40,  0x11,  0xa0,  0x23,
+		0xd0,  0x15,  0xe8,  0x0a,  0x74,  0x01,  0xb4,  0x00,
+		0x4a,  0x00,  0x35,  0x00,  0x08,  0x00,  0x04,  0x00,
+	};
+
+	static char eyedropper_smsk[] = {
+		0x00,  0x30,  0x00,  0x78,  0x00,  0xfd,  0x80,  0xff,
+		0xc0,  0x7f,  0x80,  0x3f,  0xc0,  0x1f,  0xe0,  0x3f,
+		0xf0,  0x1f,  0xf8,  0x0b,  0xfc,  0x01,  0xfc,  0x00,
+		0x7e,  0x00,  0x3f,  0x00,  0x0c,  0x00,  0x04,  0x00,
+	};
+
+	
+	static BCursor EyedropperCursor = {
+		/*small*/
+		eyedropper_sbm, eyedropper_smsk,
+		16, 16,
+		1, 15,
+		/*big*/
+		NULL, NULL,
+		32, 32,
+		15, 15,
+		/*color*/
+		BC_BLACK, BC_WHITE
+	};
+
+	BlenderCursor[BC_EYEDROPPER_CURSOR] = &EyedropperCursor;
 
 END_CURSOR_BLOCK
 
 /********************** Swap Area Cursor ***********************/
 BEGIN_CURSOR_BLOCK
-static char swap_sbm[]={
-	0xc0,  0xff,  0x40,  0x80,  0x40,  0x80,  0x40,  0x9c,
-	0x40,  0x98,  0x40,  0x94,  0x00,  0x82,  0xfe,  0x80,
-	0x7e,  0xfd,  0xbe,  0x01,  0xda,  0x01,  0xe2,  0x01,
-	0xe2,  0x01,  0xc2,  0x01,  0xfe,  0x01,  0x00,  0x00,
-};
-
-static char swap_smsk[]={
-	0xc0,  0xff,  0xc0,  0xff,  0xc0,  0xff,  0xc0,  0xff,
-	0xc0,  0xff,  0xc0,  0xff,  0xff,  0xff,  0xff,  0xff,
-	0xff,  0xff,  0xff,  0x03,  0xff,  0x03,  0xff,  0x03,
-	0xff,  0x03,  0xff,  0x03,  0xff,  0x03,  0xff,  0x03,
-};
-
-static BCursor SwapCursor = {
-	/*small*/
-	swap_sbm, swap_smsk,
-	16, 16, 
-	8,  8,
-	/*big*/
-	NULL, NULL,
-	32,32, 
-	15, 15,
-	/*color*/
-	BC_YELLOW, BC_BLUE
-};
-
-BlenderCursor[BC_SWAPAREA_CURSOR]=&SwapCursor;
-
-END_CURSOR_BLOCK
-/********************** Put the cursors in the array ***********************/
-	
+	static char swap_sbm[] = {
+		0xc0,  0xff,  0x40,  0x80,  0x40,  0x80,  0x40,  0x9c,
+		0x40,  0x98,  0x40,  0x94,  0x00,  0x82,  0xfe,  0x80,
+		0x7e,  0xfd,  0xbe,  0x01,  0xda,  0x01,  0xe2,  0x01,
+		0xe2,  0x01,  0xc2,  0x01,  0xfe,  0x01,  0x00,  0x00,
+	};
 
+	static char swap_smsk[] = {
+		0xc0,  0xff,  0xc0,  0xff,  0xc0,  0xff,  0xc0,  0xff,
+		0xc0,  0xff,  0xc0,  0xff,  0xff,  0xff,  0xff,  0xff,
+		0xff,  0xff,  0xff,  0x03,  0xff,  0x03,  0xff,  0x03,
+		0xff,  0x03,  0xff,  0x03,  0xff,  0x03,  0xff,  0x03,
+	};
 
-}
+	static BCursor SwapCursor = {
+		/*small*/
+		swap_sbm, swap_smsk,
+		16, 16,
+		8,  8,
+		/*big*/
+		NULL, NULL,
+		32, 32,
+		15, 15,
+		/*color*/
+		BC_YELLOW, BC_BLUE
+	};
 
+	BlenderCursor[BC_SWAPAREA_CURSOR] = &SwapCursor;
 
+END_CURSOR_BLOCK
+/********************** Put the cursors in the array ***********************/
 
+}
diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c
index 2992661..bbb2a54 100644
--- a/source/blender/windowmanager/intern/wm_dragdrop.c
+++ b/source/blender/windowmanager/intern/wm_dragdrop.c
@@ -36,6 +36,8 @@
 
 #include "MEM_guardedalloc.h"
 
+#include "BLF_translation.h"
+
 #include "BLI_blenlib.h"
 
 #include "BIF_gl.h"
@@ -55,6 +57,8 @@
 #include "UI_interface.h"
 #include "UI_interface_icons.h"
 
+#include "RNA_access.h"
+
 #include "WM_api.h"
 #include "WM_types.h"
 #include "wm_event_system.h"
@@ -63,7 +67,7 @@
 
 /* ****************************************************** */
 
-static ListBase dropboxes= {NULL, NULL};
+static ListBase dropboxes = {NULL, NULL};
 
 /* drop box maps are stored global for now */
 /* these are part of blender's UI/space specs, and not like keymaps */
@@ -83,15 +87,15 @@ ListBase *WM_dropboxmap_find(const char *idname, int spaceid, int regionid)
 {
 	wmDropBoxMap *dm;
 	
-	for(dm= dropboxes.first; dm; dm= dm->next)
-		if(dm->spaceid==spaceid && dm->regionid==regionid)
-			if(0==strncmp(idname, dm->idname, KMAP_MAX_NAME))
+	for (dm = dropboxes.first; dm; dm = dm->next)
+		if (dm->spaceid == spaceid && dm->regionid == regionid)
+			if (0 == strncmp(idname, dm->idname, KMAP_MAX_NAME))
 				return &dm->dropboxes;
 	
-	dm= MEM_callocN(sizeof(struct wmDropBoxMap), "dropmap list");
+	dm = MEM_callocN(sizeof(struct wmDropBoxMap), "dropmap list");
 	BLI_strncpy(dm->idname, idname, KMAP_MAX_NAME);
-	dm->spaceid= spaceid;
-	dm->regionid= regionid;
+	dm->spaceid = spaceid;
+	dm->regionid = regionid;
 	BLI_addtail(&dropboxes, dm);
 	
 	return &dm->dropboxes;
@@ -100,16 +104,16 @@ ListBase *WM_dropboxmap_find(const char *idname, int spaceid, int regionid)
 
 
 wmDropBox *WM_dropbox_add(ListBase *lb, const char *idname, int (*poll)(bContext *, wmDrag *, wmEvent *),
-						  void (*copy)(wmDrag *, wmDropBox *))
+                          void (*copy)(wmDrag *, wmDropBox *))
 {
-	wmDropBox *drop= MEM_callocN(sizeof(wmDropBox), "wmDropBox");
+	wmDropBox *drop = MEM_callocN(sizeof(wmDropBox), "wmDropBox");
 	
-	drop->poll= poll;
-	drop->copy= copy;
-	drop->ot= WM_operatortype_find(idname, 0);
-	drop->opcontext= WM_OP_INVOKE_DEFAULT;
+	drop->poll = poll;
+	drop->copy = copy;
+	drop->ot = WM_operatortype_find(idname, 0);
+	drop->opcontext = WM_OP_INVOKE_DEFAULT;
 	
-	if(drop->ot==NULL) {
+	if (drop->ot == NULL) {
 		MEM_freeN(drop);
 		printf("Error: dropbox with unknown operator: %s\n", idname);
 		return NULL;
@@ -125,11 +129,11 @@ void wm_dropbox_free(void)
 {
 	wmDropBoxMap *dm;
 	
-	for(dm= dropboxes.first; dm; dm= dm->next) {
+	for (dm = dropboxes.first; dm; dm = dm->next) {
 		wmDropBox *drop;
 		
-		for(drop= dm->dropboxes.first; drop; drop= drop->next) {
-			if(drop->ptr) {
+		for (drop = dm->dropboxes.first; drop; drop = drop->next) {
+			if (drop->ptr) {
 				WM_operator_properties_free(drop->ptr);
 				MEM_freeN(drop->ptr);
 			}
@@ -145,42 +149,44 @@ void wm_dropbox_free(void)
 /* note that the pointer should be valid allocated and not on stack */
 wmDrag *WM_event_start_drag(struct bContext *C, int icon, int type, void *poin, double value)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
-	wmDrag *drag= MEM_callocN(sizeof(struct wmDrag), "new drag");
+	wmWindowManager *wm = CTX_wm_manager(C);
+	wmDrag *drag = MEM_callocN(sizeof(struct wmDrag), "new drag");
 	
 	/* keep track of future multitouch drag too, add a mousepointer id or so */
 	/* if multiple drags are added, they're drawn as list */
 	
 	BLI_addtail(&wm->drags, drag);
-	drag->icon= icon;
-	drag->type= type;
-	if(type==WM_DRAG_PATH)
+	drag->icon = icon;
+	drag->type = type;
+	if (type == WM_DRAG_PATH)
 		BLI_strncpy(drag->path, poin, FILE_MAX);
 	else
-		drag->poin= poin;
-	drag->value= value;
+		drag->poin = poin;
+	drag->value = value;
 	
 	return drag;
 }
 
 void WM_event_drag_image(wmDrag *drag, ImBuf *imb, float scale, int sx, int sy)
 {
-	drag->imb= imb;
-	drag->scale= scale;
-	drag->sx= sx;
-	drag->sy= sy;
+	drag->imb = imb;
+	drag->scale = scale;
+	drag->sx = sx;
+	drag->sy = sy;
 }
 
 
 static const char *dropbox_active(bContext *C, ListBase *handlers, wmDrag *drag, wmEvent *event)
 {
-	wmEventHandler *handler= handlers->first;
-	for(; handler; handler= handler->next) {
-		if(handler->dropboxes) {
-			wmDropBox *drop= handler->dropboxes->first;
-			for(; drop; drop= drop->next) {
-				if(drop->poll(C, drag, event)) 
-					return drop->ot->name;
+	wmEventHandler *handler = handlers->first;
+	for (; handler; handler = handler->next) {
+		if (handler->dropboxes) {
+			wmDropBox *drop = handler->dropboxes->first;
+			for (; drop; drop = drop->next) {
+				if (drop->poll(C, drag, event))
+					/* XXX Doing translation here might not be ideal, but later we have no more
+					 *     access to ot (and hence op context)... */
+					return RNA_struct_ui_name(drop->ot->srna);
 			}
 		}
 	}
@@ -190,19 +196,19 @@ static const char *dropbox_active(bContext *C, ListBase *handlers, wmDrag *drag,
 /* return active operator name when mouse is in box */
 static const char *wm_dropbox_active(bContext *C, wmDrag *drag, wmEvent *event)
 {
-	wmWindow *win= CTX_wm_window(C);
-	ScrArea *sa= CTX_wm_area(C);
-	ARegion *ar= CTX_wm_region(C);
+	wmWindow *win = CTX_wm_window(C);
+	ScrArea *sa = CTX_wm_area(C);
+	ARegion *ar = CTX_wm_region(C);
 	const char *name;
 	
-	name= dropbox_active(C, &win->handlers, drag, event);
-	if(name) return name;
+	name = dropbox_active(C, &win->handlers, drag, event);
+	if (name) return name;
 	
-	name= dropbox_active(C, &sa->handlers, drag, event);
-	if(name) return name;
+	name = dropbox_active(C, &sa->handlers, drag, event);
+	if (name) return name;
 	
-	name= dropbox_active(C, &ar->handlers, drag, event);
-	if(name) return name;
+	name = dropbox_active(C, &ar->handlers, drag, event);
+	if (name) return name;
 
 	return NULL;
 }
@@ -210,22 +216,22 @@ static const char *wm_dropbox_active(bContext *C, wmDrag *drag, wmEvent *event)
 
 static void wm_drop_operator_options(bContext *C, wmDrag *drag, wmEvent *event)
 {
-	wmWindow *win= CTX_wm_window(C);
+	wmWindow *win = CTX_wm_window(C);
 	
 	/* for multiwin drags, we only do this if mouse inside */
-	if(event->x<0 || event->y<0 || event->x>win->sizex || event->y>win->sizey)
+	if (event->x < 0 || event->y < 0 || event->x > win->sizex || event->y > win->sizey)
 		return;
 	
-	drag->opname[0]= 0;
+	drag->opname[0] = 0;
 	
 	/* check buttons (XXX todo rna and value) */
-	if( UI_but_active_drop_name(C) ) {
-		strcpy(drag->opname, "Paste name");
+	if (UI_but_active_drop_name(C) ) {
+		strcpy(drag->opname, IFACE_("Paste name"));
 	}
 	else {
-		const char *opname= wm_dropbox_active(C, drag, event);
+		const char *opname = wm_dropbox_active(C, drag, event);
 		
-		if(opname) {
+		if (opname) {
 			BLI_strncpy(drag->opname, opname, FILE_MAX);
 			// WM_cursor_modal(win, CURSOR_COPY);
 		}
@@ -238,10 +244,10 @@ static void wm_drop_operator_options(bContext *C, wmDrag *drag, wmEvent *event)
 /* called in inner handler loop, region context */
 void wm_drags_check_ops(bContext *C, wmEvent *event)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 	wmDrag *drag;
 	
-	for(drag= wm->drags.first; drag; drag= drag->next) {
+	for (drag = wm->drags.first; drag; drag = drag->next) {
 		wm_drop_operator_options(C, drag, event);
 	}
 }
@@ -250,7 +256,7 @@ void wm_drags_check_ops(bContext *C, wmEvent *event)
 
 static void wm_drop_operator_draw(const char *name, int x, int y)
 {
-	int width= UI_GetStringWidth(name);
+	int width = UI_GetStringWidth(name);
 	
 	glColor4ub(0, 0, 0, 50);
 	
@@ -258,16 +264,16 @@ static void wm_drop_operator_draw(const char *name, int x, int y)
 	uiRoundBox(x, y, x + width + 8, y + 15, 4);
 	
 	glColor4ub(255, 255, 255, 255);
-	UI_DrawString(x+4, y+4, name);
+	UI_DrawString(x + 4, y + 4, name);
 }
 
 static const char *wm_drag_name(wmDrag *drag)
 {
-	switch(drag->type) {
+	switch (drag->type) {
 		case WM_DRAG_ID:
 		{
-			ID *id= (ID *)drag->poin;
-			return id->name+2;
+			ID *id = (ID *)drag->poin;
+			return id->name + 2;
 		}
 		case WM_DRAG_PATH:
 			return drag->path;
@@ -279,71 +285,71 @@ static const char *wm_drag_name(wmDrag *drag)
 
 static void drag_rect_minmax(rcti *rect, int x1, int y1, int x2, int y2)
 {
-	if(rect->xmin > x1)
-		rect->xmin= x1;
-	if(rect->xmax < x2)
-		rect->xmax= x2;
-	if(rect->ymin > y1)
-		rect->ymin= y1;
-	if(rect->ymax < y2)
-		rect->ymax= y2;
+	if (rect->xmin > x1)
+		rect->xmin = x1;
+	if (rect->xmax < x2)
+		rect->xmax = x2;
+	if (rect->ymin > y1)
+		rect->ymin = y1;
+	if (rect->ymax < y2)
+		rect->ymax = y2;
 }
 
 /* called in wm_draw.c */
 /* if rect set, do not draw */
 void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 	wmDrag *drag;
 	int cursorx, cursory, x, y;
 	
-	cursorx= win->eventstate->x;
-	cursory= win->eventstate->y;
-	if(rect) {
-		rect->xmin= rect->xmax= cursorx;
-		rect->ymin= rect->ymax= cursory;
+	cursorx = win->eventstate->x;
+	cursory = win->eventstate->y;
+	if (rect) {
+		rect->xmin = rect->xmax = cursorx;
+		rect->ymin = rect->ymax = cursory;
 	}
 	
 	/* XXX todo, multiline drag draws... but maybe not, more types mixed wont work well */
 	glEnable(GL_BLEND);
-	for(drag= wm->drags.first; drag; drag= drag->next) {
+	for (drag = wm->drags.first; drag; drag = drag->next) {
 		
 		/* image or icon */
-		if(drag->imb) {
-			x= cursorx - drag->sx/2;
-			y= cursory - drag->sy/2;
+		if (drag->imb) {
+			x = cursorx - drag->sx / 2;
+			y = cursory - drag->sy / 2;
 			
-			if(rect)
-				drag_rect_minmax(rect, x, y, x+drag->sx, y+drag->sy);
+			if (rect)
+				drag_rect_minmax(rect, x, y, x + drag->sx, y + drag->sy);
 			else {
-				glColor4f(1.0, 1.0, 1.0, 0.65);	/* this blends texture */
+				glColor4f(1.0, 1.0, 1.0, 0.65); /* this blends texture */
 				glaDrawPixelsTexScaled(x, y, drag->imb->x, drag->imb->y, GL_UNSIGNED_BYTE, drag->imb->rect, drag->scale, drag->scale);
 			}
 		}
 		else {
-			x= cursorx - 8;
-			y= cursory - 2;
+			x = cursorx - 8;
+			y = cursory - 2;
 			
 			/* icons assumed to be 16 pixels */
-			if(rect)
-				drag_rect_minmax(rect, x, y, x+16, y+16);
+			if (rect)
+				drag_rect_minmax(rect, x, y, x + 16, y + 16);
 			else
 				UI_icon_draw_aspect(x, y, drag->icon, 1.0, 0.8);
 		}
 		
 		/* item name */
-		if(drag->imb) {
-			x= cursorx - drag->sx/2;
-			y= cursory - drag->sy/2 - 16;
+		if (drag->imb) {
+			x = cursorx - drag->sx / 2;
+			y = cursory - drag->sy / 2 - 16;
 		}
 		else {
-			x= cursorx + 10;
-			y= cursory + 1;
+			x = cursorx + 10;
+			y = cursory + 1;
 		}
 		
-		if(rect) {
-			int w=  UI_GetStringWidth(wm_drag_name(drag));
-			drag_rect_minmax(rect, x, y, x+w, y+16);
+		if (rect) {
+			int w =  UI_GetStringWidth(wm_drag_name(drag));
+			drag_rect_minmax(rect, x, y, x + w, y + 16);
 		}
 		else {
 			glColor4ub(255, 255, 255, 255);
@@ -351,19 +357,19 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
 		}
 		
 		/* operator name with roundbox */
-		if(drag->opname[0]) {
-			if(drag->imb) {
-				x= cursorx - drag->sx/2;
-				y= cursory + drag->sy/2 + 4;
+		if (drag->opname[0]) {
+			if (drag->imb) {
+				x = cursorx - drag->sx / 2;
+				y = cursory + drag->sy / 2 + 4;
 			}
 			else {
-				x= cursorx - 8;
-				y= cursory + 16;
+				x = cursorx - 8;
+				y = cursory + 16;
 			}
 			
-			if(rect) {
-				int w=  UI_GetStringWidth(wm_drag_name(drag));
-				drag_rect_minmax(rect, x, y, x+w, y+16);
+			if (rect) {
+				int w =  UI_GetStringWidth(wm_drag_name(drag));
+				drag_rect_minmax(rect, x, y, x + w, y + 16);
 			}
 			else 
 				wm_drop_operator_draw(drag->opname, x, y);
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 4fe1104..66cadf1 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -66,33 +66,40 @@
 #include "wm_event_system.h"
 
 /* swap */
-#define WIN_NONE_OK		0
+#define WIN_NONE_OK     0
 #define WIN_BACK_OK     1
 #define WIN_FRONT_OK    2
-#define WIN_BOTH_OK		3
+#define WIN_BOTH_OK     3
 
 /* ******************* drawing, overlays *************** */
 
 
 static void wm_paintcursor_draw(bContext *C, ARegion *ar)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 	
-	if(wm->paintcursors.first) {
-		wmWindow *win= CTX_wm_window(C);
-		bScreen *screen= win->screen;
+	if (wm->paintcursors.first) {
+		wmWindow *win = CTX_wm_window(C);
+		bScreen *screen = win->screen;
 		wmPaintCursor *pc;
 
-		if(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);
+		if (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);
 					if (ELEM(win->grabcursor, GHOST_kGrabWrap, GHOST_kGrabHide)) {
 						int x = 0, y = 0;
 						wm_get_cursor_position(win, &x, &y);
-						pc->draw(C, x - ar_other->winrct.xmin, y - ar_other->winrct.ymin, pc->customdata);
-					} else {
-						pc->draw(C, win->eventstate->x - ar_other->winrct.xmin, win->eventstate->y - ar_other->winrct.ymin, pc->customdata);
+						pc->draw(C,
+						         x - ar_other->winrct.xmin,
+						         y - ar_other->winrct.ymin,
+						         pc->customdata);
+					}
+					else {
+						pc->draw(C,
+						         win->eventstate->x - ar_other->winrct.xmin,
+						         win->eventstate->y - ar_other->winrct.ymin,
+						         pc->customdata);
 					}
 				}
 			}
@@ -104,25 +111,25 @@ static void wm_paintcursor_draw(bContext *C, ARegion *ar)
 
 static void wm_area_mark_invalid_backbuf(ScrArea *sa)
 {
-	if(sa->spacetype == SPACE_VIEW3D)
-		((View3D*)sa->spacedata.first)->flag |= V3D_INVALID_BACKBUF;
+	if (sa->spacetype == SPACE_VIEW3D)
+		((View3D *)sa->spacedata.first)->flag |= V3D_INVALID_BACKBUF;
 }
 
 static int wm_area_test_invalid_backbuf(ScrArea *sa)
 {
-	if(sa->spacetype == SPACE_VIEW3D)
-		return (((View3D*)sa->spacedata.first)->flag & V3D_INVALID_BACKBUF);
+	if (sa->spacetype == SPACE_VIEW3D)
+		return (((View3D *)sa->spacedata.first)->flag & V3D_INVALID_BACKBUF);
 	else
 		return 1;
 }
 
 static void wm_region_test_render_do_draw(ScrArea *sa, ARegion *ar)
 {
-	if(sa->spacetype == SPACE_VIEW3D) {
+	if (sa->spacetype == SPACE_VIEW3D) {
 		RegionView3D *rv3d = ar->regiondata;
-		RenderEngine *engine = (rv3d)? rv3d->render_engine: NULL;
+		RenderEngine *engine = (rv3d) ? rv3d->render_engine : NULL;
 
-		if(engine && (engine->flag & RE_ENGINE_DO_DRAW)) {
+		if (engine && (engine->flag & RE_ENGINE_DO_DRAW)) {
 			ar->do_draw = 1;
 			engine->flag &= ~RE_ENGINE_DO_DRAW;
 		}
@@ -134,16 +141,16 @@ static void wm_region_test_render_do_draw(ScrArea *sa, ARegion *ar)
 
 static void wm_method_draw_full(bContext *C, wmWindow *win)
 {
-	bScreen *screen= win->screen;
+	bScreen *screen = win->screen;
 	ScrArea *sa;
 	ARegion *ar;
 
 	/* draw area regions */
-	for(sa= screen->areabase.first; sa; sa= sa->next) {
+	for (sa = screen->areabase.first; sa; sa = sa->next) {
 		CTX_wm_area_set(C, sa);
 
-		for(ar=sa->regionbase.first; ar; ar= ar->next) {
-			if(ar->swinid) {
+		for (ar = sa->regionbase.first; ar; ar = ar->next) {
+			if (ar->swinid) {
 				CTX_wm_region_set(C, ar);
 				ED_region_do_draw(C, ar);
 				wm_paintcursor_draw(C, ar);
@@ -160,15 +167,15 @@ static void wm_method_draw_full(bContext *C, wmWindow *win)
 	ED_area_overdraw(C);
 
 	/* draw overlapping regions */
-	for(ar=screen->regionbase.first; ar; ar= ar->next) {
-		if(ar->swinid) {
+	for (ar = screen->regionbase.first; ar; ar = ar->next) {
+		if (ar->swinid) {
 			CTX_wm_menu_set(C, ar);
 			ED_region_do_draw(C, ar);
 			CTX_wm_menu_set(C, NULL);
 		}
 	}
 
-	if(screen->do_draw_gesture)
+	if (screen->do_draw_gesture)
 		wm_gesture_draw(win);
 }
 
@@ -184,12 +191,12 @@ static void wm_flush_regions_down(bScreen *screen, rcti *dirty)
 	ScrArea *sa;
 	ARegion *ar;
 
-	for(sa= screen->areabase.first; sa; sa= sa->next) {
-		for(ar= sa->regionbase.first; ar; ar= ar->next) {
-			if(BLI_isect_rcti(dirty, &ar->winrct, NULL)) {
-				ar->do_draw= RGN_DRAW;
+	for (sa = screen->areabase.first; sa; sa = sa->next) {
+		for (ar = sa->regionbase.first; ar; ar = ar->next) {
+			if (BLI_isect_rcti(dirty, &ar->winrct, NULL)) {
+				ar->do_draw = RGN_DRAW;
 				memset(&ar->drawrct, 0, sizeof(ar->drawrct));
-				ar->swap= WIN_NONE_OK;
+				ar->swap = WIN_NONE_OK;
 			}
 		}
 	}
@@ -200,88 +207,88 @@ static void wm_flush_regions_up(bScreen *screen, rcti *dirty)
 {
 	ARegion *ar;
 	
-	for(ar= screen->regionbase.first; ar; ar= ar->next) {
-		if(BLI_isect_rcti(dirty, &ar->winrct, NULL)) {
-			ar->do_draw= RGN_DRAW;
+	for (ar = screen->regionbase.first; ar; ar = ar->next) {
+		if (BLI_isect_rcti(dirty, &ar->winrct, NULL)) {
+			ar->do_draw = RGN_DRAW;
 			memset(&ar->drawrct, 0, sizeof(ar->drawrct));
-			ar->swap= WIN_NONE_OK;
+			ar->swap = WIN_NONE_OK;
 		}
 	}
 }
 
 static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
-	bScreen *screen= win->screen;
+	wmWindowManager *wm = CTX_wm_manager(C);
+	bScreen *screen = win->screen;
 	ScrArea *sa;
 	ARegion *ar;
-	static rcti rect= {0, 0, 0, 0};
+	static rcti rect = {0, 0, 0, 0};
 
 	/* after backbuffer selection draw, we need to redraw */
-	for(sa= screen->areabase.first; sa; sa= sa->next)
-		for(ar= sa->regionbase.first; ar; ar= ar->next)
-			if(ar->swinid && !wm_area_test_invalid_backbuf(sa))
+	for (sa = screen->areabase.first; sa; sa = sa->next)
+		for (ar = sa->regionbase.first; ar; ar = ar->next)
+			if (ar->swinid && !wm_area_test_invalid_backbuf(sa))
 				ED_region_tag_redraw(ar);
 
 	/* flush overlapping regions */
-	if(screen->regionbase.first) {
+	if (screen->regionbase.first) {
 		/* flush redraws of area regions up to overlapping regions */
-		for(sa= screen->areabase.first; sa; sa= sa->next)
-			for(ar= sa->regionbase.first; ar; ar= ar->next)
-				if(ar->swinid && ar->do_draw)
+		for (sa = screen->areabase.first; sa; sa = sa->next)
+			for (ar = sa->regionbase.first; ar; ar = ar->next)
+				if (ar->swinid && ar->do_draw)
 					wm_flush_regions_up(screen, &ar->winrct);
 		
 		/* flush between overlapping regions */
-		for(ar= screen->regionbase.last; ar; ar= ar->prev)
-			if(ar->swinid && ar->do_draw)
+		for (ar = screen->regionbase.last; ar; ar = ar->prev)
+			if (ar->swinid && ar->do_draw)
 				wm_flush_regions_up(screen, &ar->winrct);
 		
 		/* flush redraws of overlapping regions down to area regions */
-		for(ar= screen->regionbase.last; ar; ar= ar->prev)
-			if(ar->swinid && ar->do_draw)
+		for (ar = screen->regionbase.last; ar; ar = ar->prev)
+			if (ar->swinid && ar->do_draw)
 				wm_flush_regions_down(screen, &ar->winrct);
 	}
 
 	/* flush drag item */
-	if(rect.xmin!=rect.xmax) {
+	if (rect.xmin != rect.xmax) {
 		wm_flush_regions_down(screen, &rect);
-		rect.xmin= rect.xmax = 0;
+		rect.xmin = rect.xmax = 0;
 	}
-	if(wm->drags.first) {
+	if (wm->drags.first) {
 		/* doesnt draw, fills rect with boundbox */
 		wm_drags_draw(C, win, &rect);
 	}
 	
 	/* draw marked area regions */
-	for(sa= screen->areabase.first; sa; sa= sa->next) {
+	for (sa = screen->areabase.first; sa; sa = sa->next) {
 		CTX_wm_area_set(C, sa);
 
-		for(ar=sa->regionbase.first; ar; ar= ar->next) {
-			if(ar->swinid) {
-				if(ar->do_draw) {
+		for (ar = sa->regionbase.first; ar; ar = ar->next) {
+			if (ar->swinid) {
+				if (ar->do_draw) {
 					CTX_wm_region_set(C, ar);
 					ED_region_do_draw(C, ar);
 					wm_paintcursor_draw(C, ar);
 					ED_area_overdraw_flush(sa, ar);
 					CTX_wm_region_set(C, NULL);
 
-					if(exchange)
-						ar->swap= WIN_FRONT_OK;
+					if (exchange)
+						ar->swap = WIN_FRONT_OK;
 				}
-				else if(exchange) {
-					if(ar->swap == WIN_FRONT_OK) {
+				else if (exchange) {
+					if (ar->swap == WIN_FRONT_OK) {
 						CTX_wm_region_set(C, ar);
 						ED_region_do_draw(C, ar);
 						wm_paintcursor_draw(C, ar);
 						ED_area_overdraw_flush(sa, ar);
 						CTX_wm_region_set(C, NULL);
 
-						ar->swap= WIN_BOTH_OK;
+						ar->swap = WIN_BOTH_OK;
 					}
-					else if(ar->swap == WIN_BACK_OK)
-						ar->swap= WIN_FRONT_OK;
-					else if(ar->swap == WIN_BOTH_OK)
-						ar->swap= WIN_BOTH_OK;
+					else if (ar->swap == WIN_BACK_OK)
+						ar->swap = WIN_FRONT_OK;
+					else if (ar->swap == WIN_BOTH_OK)
+						ar->swap = WIN_BOTH_OK;
 				}
 			}
 		}
@@ -291,39 +298,39 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange)
 	}
 
 	/* after area regions so we can do area 'overlay' drawing */
-	if(screen->do_draw) {
+	if (screen->do_draw) {
 		ED_screen_draw(win);
 
-		if(exchange)
-			screen->swap= WIN_FRONT_OK;
+		if (exchange)
+			screen->swap = WIN_FRONT_OK;
 	}
-	else if(exchange) {
-		if(screen->swap==WIN_FRONT_OK) {
+	else if (exchange) {
+		if (screen->swap == WIN_FRONT_OK) {
 			ED_screen_draw(win);
-			screen->swap= WIN_BOTH_OK;
+			screen->swap = WIN_BOTH_OK;
 		}
-		else if(screen->swap==WIN_BACK_OK)
-			screen->swap= WIN_FRONT_OK;
-		else if(screen->swap==WIN_BOTH_OK)
-			screen->swap= WIN_BOTH_OK;
+		else if (screen->swap == WIN_BACK_OK)
+			screen->swap = WIN_FRONT_OK;
+		else if (screen->swap == WIN_BOTH_OK)
+			screen->swap = WIN_BOTH_OK;
 	}
 
 	ED_area_overdraw(C);
 
 	/* draw marked overlapping regions */
-	for(ar=screen->regionbase.first; ar; ar= ar->next) {
-		if(ar->swinid && ar->do_draw) {
+	for (ar = screen->regionbase.first; ar; ar = ar->next) {
+		if (ar->swinid && ar->do_draw) {
 			CTX_wm_menu_set(C, ar);
 			ED_region_do_draw(C, ar);
 			CTX_wm_menu_set(C, NULL);
 		}
 	}
 
-	if(screen->do_draw_gesture)
+	if (screen->do_draw_gesture)
 		wm_gesture_draw(win);
 	
 	/* needs pixel coords in screen */
-	if(wm->drags.first) {
+	if (wm->drags.first) {
 		wm_drags_draw(C, win, NULL);
 	}
 }
@@ -350,7 +357,7 @@ static void wm_method_draw_damage(bContext *C, wmWindow *win)
 #define MAX_N_TEX 3
 
 typedef struct wmDrawTriple {
-	GLuint bind[MAX_N_TEX*MAX_N_TEX];
+	GLuint bind[MAX_N_TEX * MAX_N_TEX];
 	int x[MAX_N_TEX], y[MAX_N_TEX];
 	int nx, ny;
 	GLenum target;
@@ -361,47 +368,47 @@ static void split_width(int x, int n, int *splitx, int *nx)
 	int a, newnx, waste;
 
 	/* if already power of two just use it */
-	if(is_power_of_2_i(x)) {
-		splitx[0]= x;
+	if (is_power_of_2_i(x)) {
+		splitx[0] = x;
 		(*nx)++;
 		return;
 	}
 
-	if(n == 1) {
+	if (n == 1) {
 		/* last part, we have to go larger */
-		splitx[0]= power_of_2_max_i(x);
+		splitx[0] = power_of_2_max_i(x);
 		(*nx)++;
 	}
 	else {
 		/* two or more parts to go, use smaller part */
-		splitx[0]= power_of_2_min_i(x);
-		newnx= ++(*nx);
-		split_width(x-splitx[0], n-1, splitx+1, &newnx);
+		splitx[0] = power_of_2_min_i(x);
+		newnx = ++(*nx);
+		split_width(x - splitx[0], n - 1, splitx + 1, &newnx);
 
-		for(waste=0, a=0; a<n; a++)
+		for (waste = 0, a = 0; a < n; a++)
 			waste += splitx[a];
 
 		/* if we waste more space or use the same amount,
 		 * revert deeper splits and just use larger */
-		if(waste >= power_of_2_max_i(x)) {
-			splitx[0]= power_of_2_max_i(x);
-			memset(splitx+1, 0, sizeof(int)*(n-1));
+		if (waste >= power_of_2_max_i(x)) {
+			splitx[0] = power_of_2_max_i(x);
+			memset(splitx + 1, 0, sizeof(int) * (n - 1));
 		}
 		else
-			*nx= newnx;
+			*nx = newnx;
 	}
 }
 
 static void wm_draw_triple_free(wmWindow *win)
 {
-	if(win->drawdata) {
-		wmDrawTriple *triple= win->drawdata;
+	if (win->drawdata) {
+		wmDrawTriple *triple = win->drawdata;
 
-		glDeleteTextures(triple->nx*triple->ny, triple->bind);
+		glDeleteTextures(triple->nx * triple->ny, triple->bind);
 
 		MEM_freeN(triple);
 
-		win->drawdata= NULL;
+		win->drawdata = NULL;
 	}
 }
 
@@ -409,7 +416,7 @@ static void wm_draw_triple_fail(bContext *C, wmWindow *win)
 {
 	wm_draw_window_clear(win);
 
-	win->drawfail= 1;
+	win->drawfail = 1;
 	wm_method_draw_overlap_all(C, win, 0);
 }
 
@@ -419,51 +426,52 @@ static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple)
 	int x, y;
 
 	/* compute texture sizes */
-	if(GLEW_ARB_texture_rectangle || GLEW_NV_texture_rectangle || GLEW_EXT_texture_rectangle) {
-		triple->target= GL_TEXTURE_RECTANGLE_ARB;
-		triple->nx= 1;
-		triple->ny= 1;
-		triple->x[0]= win->sizex;
-		triple->y[0]= win->sizey;
-	}
-	else if(GPU_non_power_of_two_support()) {
-		triple->target= GL_TEXTURE_2D;
-		triple->nx= 1;
-		triple->ny= 1;
-		triple->x[0]= win->sizex;
-		triple->y[0]= win->sizey;
+	if (GLEW_ARB_texture_rectangle || GLEW_NV_texture_rectangle || GLEW_EXT_texture_rectangle) {
+		triple->target = GL_TEXTURE_RECTANGLE_ARB;
+		triple->nx = 1;
+		triple->ny = 1;
+		triple->x[0] = win->sizex;
+		triple->y[0] = win->sizey;
+	}
+	else if (GPU_non_power_of_two_support()) {
+		triple->target = GL_TEXTURE_2D;
+		triple->nx = 1;
+		triple->ny = 1;
+		triple->x[0] = win->sizex;
+		triple->y[0] = win->sizey;
 	}
 	else {
-		triple->target= GL_TEXTURE_2D;
-		triple->nx= 0;
-		triple->ny= 0;
+		triple->target = GL_TEXTURE_2D;
+		triple->nx = 0;
+		triple->ny = 0;
 		split_width(win->sizex, MAX_N_TEX, triple->x, &triple->nx);
 		split_width(win->sizey, MAX_N_TEX, triple->y, &triple->ny);
 	}
 
 	/* generate texture names */
-	glGenTextures(triple->nx*triple->ny, triple->bind);
+	glGenTextures(triple->nx * triple->ny, triple->bind);
 
-	if(!triple->bind[0]) {
+	if (!triple->bind[0]) {
 		/* not the typical failure case but we handle it anyway */
 		printf("WM: failed to allocate texture for triple buffer drawing (glGenTextures).\n");
 		return 0;
 	}
 
-	for(y=0; y<triple->ny; y++) {
-		for(x=0; x<triple->nx; x++) {
+	for (y = 0; y < triple->ny; y++) {
+		for (x = 0; x < triple->nx; x++) {
 			/* proxy texture is only guaranteed to test for the cases that
 			 * there is only one texture in use, which may not be the case */
 			glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxsize);
 
-			if(triple->x[x] > maxsize || triple->y[y] > maxsize) {
+			if (triple->x[x] > maxsize || triple->y[y] > maxsize) {
 				glBindTexture(triple->target, 0);
-				printf("WM: failed to allocate texture for triple buffer drawing (texture too large for graphics card).\n");
+				printf("WM: failed to allocate texture for triple buffer drawing "
+				       "(texture too large for graphics card).\n");
 				return 0;
 			}
 
 			/* setup actual texture */
-			glBindTexture(triple->target, triple->bind[x + y*triple->nx]);
+			glBindTexture(triple->target, triple->bind[x + y * triple->nx]);
 			glTexImage2D(triple->target, 0, GL_RGB8, triple->x[x], triple->y[y], 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
 			glTexParameteri(triple->target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
 			glTexParameteri(triple->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -472,7 +480,7 @@ static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple)
 			glBindTexture(triple->target, 0);
 
 			/* not sure if this works everywhere .. */
-			if(glGetError() == GL_OUT_OF_MEMORY) {
+			if (glGetError() == GL_OUT_OF_MEMORY) {
 				printf("WM: failed to allocate texture for triple buffer drawing (out of memory).\n");
 				return 0;
 			}
@@ -489,40 +497,40 @@ static void wm_triple_draw_textures(wmWindow *win, wmDrawTriple *triple)
 
 	glEnable(triple->target);
 
-	for(y=0, offy=0; y<triple->ny; offy+=triple->y[y], y++) {
-		for(x=0, offx=0; x<triple->nx; offx+=triple->x[x], x++) {
-			sizex= (x == triple->nx-1)? win->sizex-offx: triple->x[x];
-			sizey= (y == triple->ny-1)? win->sizey-offy: triple->y[y];
+	for (y = 0, offy = 0; y < triple->ny; offy += triple->y[y], y++) {
+		for (x = 0, offx = 0; x < triple->nx; offx += triple->x[x], x++) {
+			sizex = (x == triple->nx - 1) ? win->sizex - offx : triple->x[x];
+			sizey = (y == triple->ny - 1) ? win->sizey - offy : triple->y[y];
 
 			/* wmOrtho for the screen has this same offset */
-			ratiox= sizex;
-			ratioy= sizey;
-			halfx= 0.375f;
-			halfy= 0.375f;
+			ratiox = sizex;
+			ratioy = sizey;
+			halfx = 0.375f;
+			halfy = 0.375f;
 
 			/* texture rectangle has unnormalized coordinates */
-			if(triple->target == GL_TEXTURE_2D) {
+			if (triple->target == GL_TEXTURE_2D) {
 				ratiox /= triple->x[x];
 				ratioy /= triple->y[y];
 				halfx /= triple->x[x];
 				halfy /= triple->y[y];
 			}
 
-			glBindTexture(triple->target, triple->bind[x + y*triple->nx]);
+			glBindTexture(triple->target, triple->bind[x + y * triple->nx]);
 
 			glColor3f(1.0f, 1.0f, 1.0f);
 			glBegin(GL_QUADS);
-				glTexCoord2f(halfx, halfy);
-				glVertex2f(offx, offy);
+			glTexCoord2f(halfx, halfy);
+			glVertex2f(offx, offy);
 
-				glTexCoord2f(ratiox+halfx, halfy);
-				glVertex2f(offx+sizex, offy);
+			glTexCoord2f(ratiox + halfx, halfy);
+			glVertex2f(offx + sizex, offy);
 
-				glTexCoord2f(ratiox+halfx, ratioy+halfy);
-				glVertex2f(offx+sizex, offy+sizey);
+			glTexCoord2f(ratiox + halfx, ratioy + halfy);
+			glVertex2f(offx + sizex, offy + sizey);
 
-				glTexCoord2f(halfx, ratioy+halfy);
-				glVertex2f(offx, offy+sizey);
+			glTexCoord2f(halfx, ratioy + halfy);
+			glVertex2f(offx, offy + sizey);
 			glEnd();
 		}
 	}
@@ -535,12 +543,12 @@ static void wm_triple_copy_textures(wmWindow *win, wmDrawTriple *triple)
 {
 	int x, y, sizex, sizey, offx, offy;
 
-	for(y=0, offy=0; y<triple->ny; offy+=triple->y[y], y++) {
-		for(x=0, offx=0; x<triple->nx; offx+=triple->x[x], x++) {
-			sizex= (x == triple->nx-1)? win->sizex-offx: triple->x[x];
-			sizey= (y == triple->ny-1)? win->sizey-offy: triple->y[y];
+	for (y = 0, offy = 0; y < triple->ny; offy += triple->y[y], y++) {
+		for (x = 0, offx = 0; x < triple->nx; offx += triple->x[x], x++) {
+			sizex = (x == triple->nx - 1) ? win->sizex - offx : triple->x[x];
+			sizey = (y == triple->ny - 1) ? win->sizey - offy : triple->y[y];
 
-			glBindTexture(triple->target, triple->bind[x + y*triple->nx]);
+			glBindTexture(triple->target, triple->bind[x + y * triple->nx]);
 			glCopyTexSubImage2D(triple->target, 0, 0, 0, offx, offy, sizex, sizey);
 		}
 	}
@@ -550,44 +558,43 @@ static void wm_triple_copy_textures(wmWindow *win, wmDrawTriple *triple)
 
 static void wm_method_draw_triple(bContext *C, wmWindow *win)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 	wmDrawTriple *triple;
-	bScreen *screen= win->screen;
+	bScreen *screen = win->screen;
 	ScrArea *sa;
 	ARegion *ar;
-	int copytex= 0, paintcursor= 1;
+	int copytex = 0, paintcursor = 1;
 
-	if(win->drawdata) {
+	if (win->drawdata) {
 		glClearColor(0, 0, 0, 0);
-		glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
+		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
 		wmSubWindowSet(win, screen->mainwin);
 
 		wm_triple_draw_textures(win, win->drawdata);
 	}
 	else {
-		win->drawdata= MEM_callocN(sizeof(wmDrawTriple), "wmDrawTriple");
+		win->drawdata = MEM_callocN(sizeof(wmDrawTriple), "wmDrawTriple");
 
-		if(!wm_triple_gen_textures(win, win->drawdata))
-		{
+		if (!wm_triple_gen_textures(win, win->drawdata)) {
 			wm_draw_triple_fail(C, win);
 			return;
 		}
 	}
 
-	triple= win->drawdata;
+	triple = win->drawdata;
 
 	/* draw marked area regions */
-	for(sa= screen->areabase.first; sa; sa= sa->next) {
+	for (sa = screen->areabase.first; sa; sa = sa->next) {
 		CTX_wm_area_set(C, sa);
 
-		for(ar=sa->regionbase.first; ar; ar= ar->next) {
-			if(ar->swinid && ar->do_draw) {
+		for (ar = sa->regionbase.first; ar; ar = ar->next) {
+			if (ar->swinid && ar->do_draw) {
 				CTX_wm_region_set(C, ar);
 				ED_region_do_draw(C, ar);
 				ED_area_overdraw_flush(sa, ar);
 				CTX_wm_region_set(C, NULL);
-				copytex= 1;
+				copytex = 1;
 			}
 		}
 		
@@ -595,7 +602,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
 		CTX_wm_area_set(C, NULL);
 	}
 
-	if(copytex) {
+	if (copytex) {
 		wmSubWindowSet(win, screen->mainwin);
 		ED_area_overdraw(C);
 
@@ -606,24 +613,24 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
 	ED_screen_draw(win);
 
 	/* draw overlapping regions */
-	for(ar=screen->regionbase.first; ar; ar= ar->next) {
-		if(ar->swinid) {
+	for (ar = screen->regionbase.first; ar; ar = ar->next) {
+		if (ar->swinid) {
 			CTX_wm_menu_set(C, ar);
 			ED_region_do_draw(C, ar);
 			CTX_wm_menu_set(C, NULL);
 			/* when a menu is being drawn, don't do the paint cursors */
-			paintcursor= 0;
+			paintcursor = 0;
 		}
 	}
 
 	/* always draw, not only when screen tagged */
-	if(win->gesture.first)
+	if (win->gesture.first)
 		wm_gesture_draw(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 (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) {
 					CTX_wm_area_set(C, sa);
 					CTX_wm_region_set(C, ar);
 
@@ -641,7 +648,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
 	}
 	
 	/* needs pixel coords in screen */
-	if(wm->drags.first) {
+	if (wm->drags.first) {
 		wm_drags_draw(C, win, NULL);
 	}
 
@@ -654,38 +661,38 @@ static int wm_draw_update_test_window(wmWindow *win)
 {
 	ScrArea *sa;
 	ARegion *ar;
-	int do_draw= 0;
+	int do_draw = 0;
 
-	for(ar= win->screen->regionbase.first; ar; ar= ar->next) {
-		if(ar->do_draw_overlay) {
+	for (ar = win->screen->regionbase.first; ar; ar = ar->next) {
+		if (ar->do_draw_overlay) {
 			wm_tag_redraw_overlay(win, ar);
-			ar->do_draw_overlay= 0;
+			ar->do_draw_overlay = 0;
 		}
-		if(ar->swinid && ar->do_draw)
-			do_draw= 1;
+		if (ar->swinid && ar->do_draw)
+			do_draw = 1;
 	}
 
-	for(sa= win->screen->areabase.first; sa; sa= sa->next) {
-		for(ar=sa->regionbase.first; ar; ar= ar->next) {
+	for (sa = win->screen->areabase.first; sa; sa = sa->next) {
+		for (ar = sa->regionbase.first; ar; ar = ar->next) {
 			wm_region_test_render_do_draw(sa, ar);
 
-			if(ar->swinid && ar->do_draw)
+			if (ar->swinid && ar->do_draw)
 				do_draw = 1;
 		}
 	}
 
-	if(do_draw)
+	if (do_draw)
 		return 1;
 	
-	if(win->screen->do_refresh)
+	if (win->screen->do_refresh)
 		return 1;
-	if(win->screen->do_draw)
+	if (win->screen->do_draw)
 		return 1;
-	if(win->screen->do_draw_gesture)
+	if (win->screen->do_draw_gesture)
 		return 1;
-	if(win->screen->do_draw_paintcursor)
+	if (win->screen->do_draw_paintcursor)
 		return 1;
-	if(win->screen->do_draw_drag)
+	if (win->screen->do_draw_drag)
 		return 1;
 	
 	return 0;
@@ -694,28 +701,28 @@ static int wm_draw_update_test_window(wmWindow *win)
 static int wm_automatic_draw_method(wmWindow *win)
 {
 	/* Ideally all cards would work well with triple buffer, since if it works
-	   well gives the least redraws and is considerably faster at partial redraw
-	   for sculpting or drawing overlapping menus. For typically lower end cards
-	   copy to texture is slow though and so we use overlap instead there. */
+	 * well gives the least redraws and is considerably faster at partial redraw
+	 * for sculpting or drawing overlapping menus. For typically lower end cards
+	 * copy to texture is slow though and so we use overlap instead there. */
 
-	if(win->drawmethod == USER_DRAW_AUTOMATIC) {
+	if (win->drawmethod == USER_DRAW_AUTOMATIC) {
 		/* ATI opensource driver is known to be very slow at this */
-		if(GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE))
+		if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE))
 			return USER_DRAW_OVERLAP;
 		/* also Intel drivers are slow */
-		else if(GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_UNIX, GPU_DRIVER_ANY))
+		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))
+		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))
+		else if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_MAC, GPU_DRIVER_ANY))
 			return USER_DRAW_OVERLAP_FLIP;
 		/* Windows software driver darkens color on each redraw */
-		else if(GPU_type_matches(GPU_DEVICE_SOFTWARE, GPU_OS_WIN, GPU_DRIVER_SOFTWARE))
+		else if (GPU_type_matches(GPU_DEVICE_SOFTWARE, GPU_OS_WIN, GPU_DRIVER_SOFTWARE))
 			return USER_DRAW_OVERLAP_FLIP;
-		else if(GPU_type_matches(GPU_DEVICE_SOFTWARE, GPU_OS_UNIX, GPU_DRIVER_SOFTWARE))
+		else if (GPU_type_matches(GPU_DEVICE_SOFTWARE, GPU_OS_UNIX, GPU_DRIVER_SOFTWARE))
 			return USER_DRAW_OVERLAP;
 		/* drawing lower color depth again degrades colors each time */
-		else if(GPU_color_depth() < 24)
+		else if (GPU_color_depth() < 24)
 			return USER_DRAW_OVERLAP;
 		else
 			return USER_DRAW_TRIPLE;
@@ -727,53 +734,53 @@ static int wm_automatic_draw_method(wmWindow *win)
 void wm_tag_redraw_overlay(wmWindow *win, ARegion *ar)
 {
 	/* for draw triple gestures, paint cursors don't need region redraw */
-	if(ar && win) {
-		if(wm_automatic_draw_method(win) != USER_DRAW_TRIPLE)
+	if (ar && win) {
+		if (wm_automatic_draw_method(win) != USER_DRAW_TRIPLE)
 			ED_region_tag_redraw(ar);
-		win->screen->do_draw_paintcursor= 1;
+		win->screen->do_draw_paintcursor = 1;
 	}
 }
 
 void wm_draw_update(bContext *C)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 	wmWindow *win;
 	int drawmethod;
 
 	GPU_free_unused_buffers();
 	
-	for(win= wm->windows.first; win; win= win->next) {
-		if(win->drawmethod != U.wmdrawmethod) {
+	for (win = wm->windows.first; win; win = win->next) {
+		if (win->drawmethod != U.wmdrawmethod) {
 			wm_draw_window_clear(win);
-			win->drawmethod= U.wmdrawmethod;
+			win->drawmethod = U.wmdrawmethod;
 		}
 
-		if(wm_draw_update_test_window(win)) {
+		if (wm_draw_update_test_window(win)) {
 			CTX_wm_window_set(C, win);
 			
 			/* sets context window+screen */
 			wm_window_make_drawable(C, win);
 
 			/* notifiers for screen redraw */
-			if(win->screen->do_refresh)
+			if (win->screen->do_refresh)
 				ED_screen_refresh(wm, win);
 
-			drawmethod= wm_automatic_draw_method(win);
+			drawmethod = wm_automatic_draw_method(win);
 
-			if(win->drawfail)
+			if (win->drawfail)
 				wm_method_draw_overlap_all(C, win, 0);
-			else if(drawmethod == USER_DRAW_FULL)
+			else if (drawmethod == USER_DRAW_FULL)
 				wm_method_draw_full(C, win);
-			else if(drawmethod == USER_DRAW_OVERLAP)
+			else if (drawmethod == USER_DRAW_OVERLAP)
 				wm_method_draw_overlap_all(C, win, 0);
-			else if(drawmethod == USER_DRAW_OVERLAP_FLIP)
+			else if (drawmethod == USER_DRAW_OVERLAP_FLIP)
 				wm_method_draw_overlap_all(C, win, 1);
-			else // if(drawmethod == USER_DRAW_TRIPLE)
+			else // if (drawmethod == USER_DRAW_TRIPLE)
 				wm_method_draw_triple(C, win);
 
-			win->screen->do_draw_gesture= 0;
-			win->screen->do_draw_paintcursor= 0;
-			win->screen->do_draw_drag= 0;
+			win->screen->do_draw_gesture = 0;
+			win->screen->do_draw_paintcursor = 0;
+			win->screen->do_draw_drag = 0;
 		
 			wm_window_swap_buffers(win);
 
@@ -784,39 +791,39 @@ void wm_draw_update(bContext *C)
 
 void wm_draw_window_clear(wmWindow *win)
 {
-	bScreen *screen= win->screen;
+	bScreen *screen = win->screen;
 	ScrArea *sa;
 	ARegion *ar;
-	int drawmethod= wm_automatic_draw_method(win);
+	int drawmethod = wm_automatic_draw_method(win);
 
-	if(drawmethod == USER_DRAW_TRIPLE)
+	if (drawmethod == USER_DRAW_TRIPLE)
 		wm_draw_triple_free(win);
 
 	/* clear screen swap flags */
-	if(screen) {
-		for(sa= screen->areabase.first; sa; sa= sa->next)
-			for(ar=sa->regionbase.first; ar; ar= ar->next)
-				ar->swap= WIN_NONE_OK;
+	if (screen) {
+		for (sa = screen->areabase.first; sa; sa = sa->next)
+			for (ar = sa->regionbase.first; ar; ar = ar->next)
+				ar->swap = WIN_NONE_OK;
 		
-		screen->swap= WIN_NONE_OK;
+		screen->swap = WIN_NONE_OK;
 	}
 }
 
 void wm_draw_region_clear(wmWindow *win, ARegion *ar)
 {
-	int drawmethod= wm_automatic_draw_method(win);
+	int drawmethod = wm_automatic_draw_method(win);
 
-	if(ELEM(drawmethod, USER_DRAW_OVERLAP, USER_DRAW_OVERLAP_FLIP))
+	if (ELEM(drawmethod, USER_DRAW_OVERLAP, USER_DRAW_OVERLAP_FLIP))
 		wm_flush_regions_down(win->screen, &ar->winrct);
 
-	win->screen->do_draw= 1;
+	win->screen->do_draw = 1;
 }
 
 void WM_redraw_windows(bContext *C)
 {
-	wmWindow *win_prev= CTX_wm_window(C);
-	ScrArea *area_prev= CTX_wm_area(C);
-	ARegion *ar_prev= CTX_wm_region(C);
+	wmWindow *win_prev = CTX_wm_window(C);
+	ScrArea *area_prev = CTX_wm_area(C);
+	ARegion *ar_prev = CTX_wm_region(C);
 
 	wm_draw_update(C);
 
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index f7da70b..ae02ff3 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -82,24 +82,25 @@
 #  include "RNA_enum_types.h"
 #endif
 
-static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA *properties, ReportList *reports, short context, short poll_only);
+static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA *properties, ReportList *reports,
+                                     short context, short poll_only);
 
 /* ************ event management ************** */
 
 void wm_event_add(wmWindow *win, wmEvent *event_to_add)
 {
-	wmEvent *event= MEM_callocN(sizeof(wmEvent), "wmEvent");
+	wmEvent *event = MEM_callocN(sizeof(wmEvent), "wmEvent");
 	
-	*event= *event_to_add;
+	*event = *event_to_add;
 	BLI_addtail(&win->queue, event);
 }
 
 void wm_event_free(wmEvent *event)
 {
-	if(event->customdata) {
-		if(event->customdatafree) {
+	if (event->customdata) {
+		if (event->customdatafree) {
 			/* note: pointer to listbase struct elsewhere */
-			if(event->custom==EVT_DATA_LISTBASE)
+			if (event->custom == EVT_DATA_LISTBASE)
 				BLI_freelistN(event->customdata);
 			else
 				MEM_freeN(event->customdata);
@@ -112,7 +113,7 @@ void wm_event_free_all(wmWindow *win)
 {
 	wmEvent *event;
 	
-	while((event= win->queue.first)) {
+	while ((event = win->queue.first)) {
 		BLI_remlink(&win->queue, event);
 		wm_event_free(event);
 	}
@@ -124,8 +125,8 @@ static int wm_test_duplicate_notifier(wmWindowManager *wm, unsigned int type, vo
 {
 	wmNotifier *note;
 
-	for(note=wm->queue.first; note; note=note->next)
-		if((note->category|note->data|note->subtype|note->action) == type && note->reference == reference)
+	for (note = wm->queue.first; note; note = note->next)
+		if ((note->category | note->data | note->subtype | note->action) == type && note->reference == reference)
 			return 1;
 	
 	return 0;
@@ -134,112 +135,114 @@ 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)
 {
-	wmNotifier *note= MEM_callocN(sizeof(wmNotifier), "notifier");
+	wmNotifier *note = MEM_callocN(sizeof(wmNotifier), "notifier");
 	
-	note->wm= CTX_wm_manager(C);
+	note->wm = CTX_wm_manager(C);
 	BLI_addtail(&note->wm->queue, note);
 	
-	note->window= CTX_wm_window(C);
+	note->window = CTX_wm_window(C);
 	
-	if(CTX_wm_region(C))
-		note->swinid= CTX_wm_region(C)->swinid;
+	if (CTX_wm_region(C))
+		note->swinid = CTX_wm_region(C)->swinid;
 	
-	note->category= type & NOTE_CATEGORY;
-	note->data= type & NOTE_DATA;
-	note->subtype= type & NOTE_SUBTYPE;
-	note->action= type & NOTE_ACTION;
+	note->category = type & NOTE_CATEGORY;
+	note->data = type & NOTE_DATA;
+	note->subtype = type & NOTE_SUBTYPE;
+	note->action = type & NOTE_ACTION;
 	
-	note->reference= reference;
+	note->reference = reference;
 }
 
 void WM_main_add_notifier(unsigned int type, void *reference)
 {
-	Main *bmain= G.main;
-	wmWindowManager *wm= bmain->wm.first;
+	Main *bmain = G.main;
+	wmWindowManager *wm = bmain->wm.first;
 
-	if(wm && !wm_test_duplicate_notifier(wm, type, reference)) {
-		wmNotifier *note= MEM_callocN(sizeof(wmNotifier), "notifier");
+	if (wm && !wm_test_duplicate_notifier(wm, type, reference)) {
+		wmNotifier *note = MEM_callocN(sizeof(wmNotifier), "notifier");
 		
-		note->wm= wm;
+		note->wm = wm;
 		BLI_addtail(&note->wm->queue, note);
 		
-		note->category= type & NOTE_CATEGORY;
-		note->data= type & NOTE_DATA;
-		note->subtype= type & NOTE_SUBTYPE;
-		note->action= type & NOTE_ACTION;
+		note->category = type & NOTE_CATEGORY;
+		note->data = type & NOTE_DATA;
+		note->subtype = type & NOTE_SUBTYPE;
+		note->action = type & NOTE_ACTION;
 		
-		note->reference= reference;
+		note->reference = reference;
 	}
 }
 
 static wmNotifier *wm_notifier_next(wmWindowManager *wm)
 {
-	wmNotifier *note= wm->queue.first;
+	wmNotifier *note = wm->queue.first;
 	
-	if(note) BLI_remlink(&wm->queue, note);
+	if (note) BLI_remlink(&wm->queue, note);
 	return note;
 }
 
 /* called in mainloop */
 void wm_event_do_notifiers(bContext *C)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 	wmNotifier *note, *next;
 	wmWindow *win;
-	uint64_t win_combine_v3d_datamask= 0;
+	uint64_t win_combine_v3d_datamask = 0;
 	
-	if(wm==NULL)
+	if (wm == NULL)
 		return;
 	
 	/* cache & catch WM level notifiers, such as frame change, scene/screen set */
-	for(win= wm->windows.first; win; win= win->next) {
-		int do_anim= 0;
+	for (win = wm->windows.first; win; win = win->next) {
+		int do_anim = 0;
 		
 		CTX_wm_window_set(C, win);
 		
-		for(note= wm->queue.first; note; note= next) {
-			next= note->next;
+		for (note = wm->queue.first; note; note = next) {
+			next = note->next;
 
-			if(note->category==NC_WM) {
-				if( ELEM(note->data, ND_FILEREAD, ND_FILESAVE)) {
-					wm->file_saved= 1;
+			if (note->category == NC_WM) {
+				if (ELEM(note->data, ND_FILEREAD, ND_FILESAVE)) {
+					wm->file_saved = 1;
 					wm_window_title(wm, win);
 				}
-				else if(note->data==ND_DATACHANGED)
+				else if (note->data == ND_DATACHANGED)
 					wm_window_title(wm, win);
 			}
-			if(note->window==win) {
-				if(note->category==NC_SCREEN) {
-					if(note->data==ND_SCREENBROWSE) {
-						ED_screen_set(C, note->reference);	// XXX hrms, think this over!
-						if(G.f & G_DEBUG)
-							printf("screen set %p\n", note->reference);
+			if (note->window == win) {
+				if (note->category == NC_SCREEN) {
+					if (note->data == ND_SCREENBROWSE) {
+						ED_screen_set(C, note->reference);  // XXX hrms, think this over!
+						if (G.debug & G_DEBUG_EVENTS)
+							printf("%s: screen set %p\n", __func__, note->reference);
 					}
-					else if(note->data==ND_SCREENDELETE) {
-						ED_screen_delete(C, note->reference);	// XXX hrms, think this over!
-						if(G.f & G_DEBUG)
-							printf("screen delete %p\n", note->reference);
+					else if (note->data == ND_SCREENDELETE) {
+						ED_screen_delete(C, note->reference);   // XXX hrms, think this over!
+						if (G.debug & G_DEBUG_EVENTS)
+							printf("%s: screen delete %p\n", __func__, note->reference);
 					}
 				}
 			}
 
-			if(note->window==win || (note->window == NULL && (note->reference == NULL || note->reference == CTX_data_scene(C)))) {
-				if(note->category==NC_SCENE) {
-					if(note->data==ND_FRAME)
-						do_anim= 1;
+			if (note->window == win ||
+			    (note->window == NULL && (note->reference == NULL || note->reference == CTX_data_scene(C))))
+			{
+				if (note->category == NC_SCENE) {
+					if (note->data == ND_FRAME)
+						do_anim = 1;
 				}
 			}
-			if(ELEM5(note->category, NC_SCENE, NC_OBJECT, NC_GEOM, NC_SCENE, NC_WM)) {
+			if (ELEM5(note->category, NC_SCENE, NC_OBJECT, NC_GEOM, NC_SCENE, NC_WM)) {
 				ED_info_stats_clear(CTX_data_scene(C));
-				WM_event_add_notifier(C, NC_SPACE|ND_SPACE_INFO, NULL);
+				WM_event_add_notifier(C, NC_SPACE | ND_SPACE_INFO, NULL);
 			}
 		}
-		if(do_anim) {
+		if (do_anim) {
 
 			/* XXX, quick frame changes can cause a crash if framechange and rendering
 			 * collide (happens on slow scenes), scene_update_for_newframe can be called
 			 * twice which can depgraph update the same object at once */
-			if(!G.rendering) {
+			if (!G.rendering) {
 
 				/* depsgraph gets called, might send more notifiers */
 				ED_update_for_newframe(CTX_data_main(C), win->screen->scene, win->screen, 1);
@@ -248,12 +251,12 @@ void wm_event_do_notifiers(bContext *C)
 	}
 	
 	/* the notifiers are sent without context, to keep it clean */
-	while( (note=wm_notifier_next(wm)) ) {
-		for(win= wm->windows.first; win; win= win->next) {
+	while ( (note = wm_notifier_next(wm)) ) {
+		for (win = wm->windows.first; win; win = win->next) {
 			
 			/* filter out notifiers */
-			if(note->category==NC_SCREEN && note->reference && note->reference!=win->screen);
-			else if(note->category==NC_SCENE && note->reference && note->reference!=win->screen->scene);
+			if (note->category == NC_SCREEN && note->reference && note->reference != win->screen) ;
+			else if (note->category == NC_SCENE && note->reference && note->reference != win->screen->scene) ;
 			else {
 				ScrArea *sa;
 				ARegion *ar;
@@ -264,13 +267,13 @@ void wm_event_do_notifiers(bContext *C)
 				/* printf("notifier win %d screen %s cat %x\n", win->winid, win->screen->id.name+2, note->category); */
 				ED_screen_do_listen(C, note);
 
-				for(ar=win->screen->regionbase.first; ar; ar= ar->next) {
+				for (ar = win->screen->regionbase.first; ar; ar = ar->next) {
 					ED_region_do_listen(ar, note);
 				}
 				
-				for(sa= win->screen->areabase.first; sa; sa= sa->next) {
+				for (sa = win->screen->areabase.first; sa; sa = sa->next) {
 					ED_area_do_listen(sa, note);
-					for(ar=sa->regionbase.first; ar; ar= ar->next) {
+					for (ar = sa->regionbase.first; ar; ar = ar->next) {
 						ED_region_do_listen(ar, note);
 					}
 				}
@@ -281,29 +284,29 @@ void wm_event_do_notifiers(bContext *C)
 	}
 	
 	/* combine datamasks so 1 win doesn't disable UV's in another [#26448] */
-	for(win= wm->windows.first; win; win= win->next) {
+	for (win = wm->windows.first; win; win = win->next) {
 		win_combine_v3d_datamask |= ED_view3d_screen_datamask(win->screen);
 	}
 
 	/* cached: editor refresh callbacks now, they get context */
-	for(win= wm->windows.first; win; win= win->next) {
+	for (win = wm->windows.first; win; win = win->next) {
 		ScrArea *sa;
 		
 		CTX_wm_window_set(C, win);
-		for(sa= win->screen->areabase.first; sa; sa= sa->next) {
-			if(sa->do_refresh) {
+		for (sa = win->screen->areabase.first; sa; sa = sa->next) {
+			if (sa->do_refresh) {
 				CTX_wm_area_set(C, sa);
 				ED_area_do_refresh(C, sa);
 			}
 		}
 		
 		/* XXX make lock in future, or separated derivedmesh users in scene */
-		if(!G.rendering) {
+		if (!G.rendering) {
 			/* depsgraph & animation: update tagged datablocks */
 			Main *bmain = CTX_data_main(C);
 
 			/* copied to set's in scene_update_tagged_recursive() */
-			win->screen->scene->customdata_mask= win_combine_v3d_datamask;
+			win->screen->scene->customdata_mask = win_combine_v3d_datamask;
 
 			/* XXX, hack so operators can enforce datamasks [#26482], gl render */
 			win->screen->scene->customdata_mask |= win->screen->scene->customdata_mask_modal;
@@ -325,31 +328,31 @@ static int wm_event_always_pass(wmEvent *event)
 
 static int wm_handler_ui_call(bContext *C, wmEventHandler *handler, wmEvent *event, int always_pass)
 {
-	ScrArea *area= CTX_wm_area(C);
-	ARegion *region= CTX_wm_region(C);
-	ARegion *menu= CTX_wm_menu(C);
-	static int do_wheel_ui= 1;
-	int is_wheel= ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE);
+	ScrArea *area = CTX_wm_area(C);
+	ARegion *region = CTX_wm_region(C);
+	ARegion *menu = CTX_wm_menu(C);
+	static int do_wheel_ui = 1;
+	int is_wheel = ELEM(event->type, WHEELUPMOUSE, WHEELDOWNMOUSE);
 	int retval;
 	
 	/* 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==0) {
-		if(is_wheel)
+	if (do_wheel_ui == 0) {
+		if (is_wheel)
 			return WM_HANDLER_CONTINUE;
-		else if(wm_event_always_pass(event)==0)
-			do_wheel_ui= 1;
+		else if (wm_event_always_pass(event) == 0)
+			do_wheel_ui = 1;
 	}
 	
 	/* we set context to where ui handler came from */
-	if(handler->ui_area) CTX_wm_area_set(C, handler->ui_area);
-	if(handler->ui_region) CTX_wm_region_set(C, handler->ui_region);
-	if(handler->ui_menu) CTX_wm_menu_set(C, handler->ui_menu);
+	if (handler->ui_area) CTX_wm_area_set(C, handler->ui_area);
+	if (handler->ui_region) CTX_wm_region_set(C, handler->ui_region);
+	if (handler->ui_menu) CTX_wm_menu_set(C, handler->ui_menu);
 
-	retval= handler->ui_handle(C, event, handler->ui_userdata);
+	retval = handler->ui_handle(C, event, handler->ui_userdata);
 
 	/* putting back screen context */
-	if((retval != WM_UI_HANDLER_BREAK) || always_pass) {
+	if ((retval != WM_UI_HANDLER_BREAK) || always_pass) {
 		CTX_wm_area_set(C, area);
 		CTX_wm_region_set(C, region);
 		CTX_wm_menu_set(C, menu);
@@ -361,31 +364,31 @@ static int wm_handler_ui_call(bContext *C, wmEventHandler *handler, wmEvent *eve
 		CTX_wm_menu_set(C, NULL);
 	}
 	
-	if(retval == WM_UI_HANDLER_BREAK)
+	if (retval == WM_UI_HANDLER_BREAK)
 		return WM_HANDLER_BREAK;
 	
 	/* event not handled in UI, if wheel then we temporarily disable it */
-	if(is_wheel)
-		do_wheel_ui= 0;
+	if (is_wheel)
+		do_wheel_ui = 0;
 	
 	return WM_HANDLER_CONTINUE;
 }
 
 static void wm_handler_ui_cancel(bContext *C)
 {
-	wmWindow *win= CTX_wm_window(C);
-	ARegion *ar= CTX_wm_region(C);
+	wmWindow *win = CTX_wm_window(C);
+	ARegion *ar = CTX_wm_region(C);
 	wmEventHandler *handler, *nexthandler;
 
-	if(!ar)
+	if (!ar)
 		return;
 
-	for(handler= ar->handlers.first; handler; handler= nexthandler) {
-		nexthandler= handler->next;
+	for (handler = ar->handlers.first; handler; handler = nexthandler) {
+		nexthandler = handler->next;
 
-		if(handler->ui_handle) {
-			wmEvent event= *(win->eventstate);
-			event.type= EVT_BUT_CANCEL;
+		if (handler->ui_handle) {
+			wmEvent event = *(win->eventstate);
+			event.type = EVT_BUT_CANCEL;
 			handler->ui_handle(C, &event, handler->ui_userdata);
 		}
 	}
@@ -397,17 +400,17 @@ int WM_operator_poll(bContext *C, wmOperatorType *ot)
 {
 	wmOperatorTypeMacro *otmacro;
 	
-	for(otmacro= ot->macro.first; otmacro; otmacro= otmacro->next) {
-		wmOperatorType *ot_macro= WM_operatortype_find(otmacro->idname, 0);
+	for (otmacro = ot->macro.first; otmacro; otmacro = otmacro->next) {
+		wmOperatorType *ot_macro = WM_operatortype_find(otmacro->idname, 0);
 		
-		if(0==WM_operator_poll(C, ot_macro))
+		if (0 == WM_operator_poll(C, ot_macro))
 			return 0;
 	}
 	
 	/* python needs operator type, so we added exception for it */
-	if(ot->pyop_poll)
+	if (ot->pyop_poll)
 		return ot->pyop_poll(C, ot);
-	else if(ot->poll)
+	else if (ot->poll)
 		return ot->poll(C);
 
 	return 1;
@@ -432,10 +435,10 @@ static void wm_operator_print(bContext *C, wmOperator *op)
 
 void WM_event_print(wmEvent *event)
 {
-	if(event) {
-		const char *unknown= "UNKNOWN";
-		const char *type_id= unknown;
-		const char *val_id= unknown;
+	if (event) {
+		const char *unknown = "UNKNOWN";
+		const char *type_id = unknown;
+		const char *val_id = unknown;
 
 		RNA_enum_identifier(event_type_items, event->type, &type_id);
 		RNA_enum_identifier(event_value_items, event->val, &val_id);
@@ -461,13 +464,13 @@ void WM_event_print(wmEvent *event)
 static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int caller_owns_reports)
 {
 	if (caller_owns_reports == FALSE) { /* popup */
-		if(op->reports->list.first) {
+		if (op->reports->list.first) {
 			/* FIXME, temp setting window, see other call to uiPupMenuReports for why */
-			wmWindow *win_prev= CTX_wm_window(C);
-			ScrArea *area_prev= CTX_wm_area(C);
-			ARegion *ar_prev= CTX_wm_region(C);
+			wmWindow *win_prev = CTX_wm_window(C);
+			ScrArea *area_prev = CTX_wm_area(C);
+			ARegion *ar_prev = CTX_wm_region(C);
 
-			if(win_prev==NULL)
+			if (win_prev == NULL)
 				CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first);
 
 			uiPupMenuReports(C, op->reports);
@@ -478,8 +481,8 @@ static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int cal
 		}
 	}
 	
-	if(retval & OPERATOR_FINISHED) {
-		if(G.f & G_DEBUG) {
+	if (retval & OPERATOR_FINISHED) {
+		if (G.debug & G_DEBUG_WM) {
 			/* todo - this print may double up, might want to check more flags then the FINISHED */
 			wm_operator_print(C, op);
 		}
@@ -489,7 +492,7 @@ static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int cal
 		}
 
 		if (op->type->flag & OPTYPE_REGISTER) {
-			if(G.background == 0) { /* ends up printing these in the terminal, gets annoying */
+			if (G.background == 0) { /* ends up printing these in the terminal, gets annoying */
 				/* Report the python string representation of the operator */
 				char *buf = WM_operator_pystring(C, op->type, op->ptr, 1);
 				BKE_report(CTX_wm_reports(C), RPT_OPERATOR, buf);
@@ -502,7 +505,7 @@ static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int cal
 	if (op->reports->list.first && (op->reports->flag & RPT_OP_HOLD) == 0) {
 
 		wmWindowManager *wm = CTX_wm_manager(C);
-		ReportList *wm_reports= CTX_wm_reports(C);
+		ReportList *wm_reports = CTX_wm_reports(C);
 		ReportTimerInfo *rti;
 
 		/* add reports to the global list, otherwise they are not seen */
@@ -512,7 +515,7 @@ static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int cal
 		WM_event_remove_timer(wm, NULL, wm_reports->reporttimer);
 		
 		/* Records time since last report was added */
-		wm_reports->reporttimer= WM_event_add_timer(wm, CTX_wm_window(C), TIMERREPORT, 0.05);
+		wm_reports->reporttimer = WM_event_add_timer(wm, CTX_wm_window(C), TIMERREPORT, 0.05);
 		
 		rti = MEM_callocN(sizeof(ReportTimerInfo), "ReportTimerInfo");
 		wm_reports->reporttimer->customdata = rti;
@@ -529,25 +532,25 @@ static int wm_operator_register_check(wmWindowManager *wm, wmOperatorType *ot)
 
 static void wm_operator_finished(bContext *C, wmOperator *op, int repeat)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 
-	op->customdata= NULL;
+	op->customdata = NULL;
 
 	/* we don't want to do undo pushes for operators that are being
-	   called from operators that already do an undo push. usually
-	   this will happen for python operators that call C operators */
-	if(wm->op_undo_depth == 0)
-		if(op->type->flag & OPTYPE_UNDO)
+	 * called from operators that already do an undo push. usually
+	 * this will happen for python operators that call C operators */
+	if (wm->op_undo_depth == 0)
+		if (op->type->flag & OPTYPE_UNDO)
 			ED_undo_push_op(C, op);
 	
-	if(repeat==0) {
-		if(G.f & G_DEBUG) {
+	if (repeat == 0) {
+		if (G.debug & G_DEBUG_WM) {
 			char *buf = WM_operator_pystring(C, op->type, op->ptr, 1);
 			BKE_report(CTX_wm_reports(C), RPT_OPERATOR, buf);
 			MEM_freeN(buf);
 		}
 
-		if(wm_operator_register_check(wm, op->type))
+		if (wm_operator_register_check(wm, op->type))
 			wm_operator_register(C, op);
 		else
 			WM_operator_free(op);
@@ -557,35 +560,42 @@ static void wm_operator_finished(bContext *C, wmOperator *op, int repeat)
 /* if repeat is true, it doesn't register again, nor does it free */
 static int wm_operator_exec(bContext *C, wmOperator *op, int repeat)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
-	int retval= OPERATOR_CANCELLED;
+	wmWindowManager *wm = CTX_wm_manager(C);
+	int retval = OPERATOR_CANCELLED;
 	
 	CTX_wm_operator_poll_msg_set(C, NULL);
 	
-	if(op==NULL || op->type==NULL)
+	if (op == NULL || op->type == NULL)
 		return retval;
 	
-	if(0==WM_operator_poll(C, op->type))
+	if (0 == WM_operator_poll(C, op->type))
 		return retval;
 	
-	if(op->type->exec) {
-		if(op->type->flag & OPTYPE_UNDO)
+	if (op->type->exec) {
+		if (op->type->flag & OPTYPE_UNDO)
 			wm->op_undo_depth++;
 
-		retval= op->type->exec(C, op);
+		retval = op->type->exec(C, op);
 		OPERATOR_RETVAL_CHECK(retval);
 
-		if(op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
+		if (op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
 			wm->op_undo_depth--;
 	}
 	
-	if (retval & (OPERATOR_FINISHED|OPERATOR_CANCELLED) && repeat == 0)
+	if (retval & (OPERATOR_FINISHED | OPERATOR_CANCELLED) && repeat == 0)
 		wm_operator_reports(C, op, retval, FALSE);
 	
-	if(retval & OPERATOR_FINISHED)
+	if (retval & OPERATOR_FINISHED) {
+		if (repeat) {
+			if (wm->op_undo_depth == 0) { /* not called by py script */
+				WM_operator_last_properties_store(op);
+			}
+		}
 		wm_operator_finished(C, op, repeat);
-	else if(repeat==0)
+	}
+	else if (repeat == 0) {
 		WM_operator_free(op);
+	}
 	
 	return retval | OPERATOR_HANDLED;
 	
@@ -594,12 +604,12 @@ static int wm_operator_exec(bContext *C, wmOperator *op, int repeat)
 /* simply calls exec with basic checks */
 static int wm_operator_exec_notest(bContext *C, wmOperator *op)
 {
-	int retval= OPERATOR_CANCELLED;
+	int retval = OPERATOR_CANCELLED;
 
-	if(op==NULL || op->type==NULL || op->type->exec==NULL)
+	if (op == NULL || op->type == NULL || op->type->exec == NULL)
 		return retval;
 
-	retval= op->type->exec(C, op);
+	retval = op->type->exec(C, op);
 	OPERATOR_RETVAL_CHECK(retval);
 
 	return retval;
@@ -637,40 +647,41 @@ int WM_operator_repeat_check(const bContext *UNUSED(C), wmOperator *op)
 
 static wmOperator *wm_operator_create(wmWindowManager *wm, wmOperatorType *ot, PointerRNA *properties, ReportList *reports)
 {
-	wmOperator *op= MEM_callocN(sizeof(wmOperator), ot->idname);	/* XXX operatortype names are static still. for debug */
+	/* XXX operatortype names are static still. for debug */
+	wmOperator *op = MEM_callocN(sizeof(wmOperator), ot->idname);
 	
 	/* XXX adding new operator could be function, only happens here now */
-	op->type= ot;
+	op->type = ot;
 	BLI_strncpy(op->idname, ot->idname, OP_MAX_TYPENAME);
 	
 	/* initialize properties, either copy or create */
-	op->ptr= MEM_callocN(sizeof(PointerRNA), "wmOperatorPtrRNA");
-	if(properties && properties->data) {
-		op->properties= IDP_CopyProperty(properties->data);
+	op->ptr = MEM_callocN(sizeof(PointerRNA), "wmOperatorPtrRNA");
+	if (properties && properties->data) {
+		op->properties = IDP_CopyProperty(properties->data);
 	}
 	else {
 		IDPropertyTemplate val = {0};
-		op->properties= IDP_New(IDP_GROUP, &val, "wmOperatorProperties");
+		op->properties = IDP_New(IDP_GROUP, &val, "wmOperatorProperties");
 	}
 	RNA_pointer_create(&wm->id, ot->srna, op->properties, op->ptr);
 
 	/* initialize error reports */
 	if (reports) {
-		op->reports= reports; /* must be initialized already */
+		op->reports = reports; /* must be initialized already */
 	}
 	else {
-		op->reports= MEM_mallocN(sizeof(ReportList), "wmOperatorReportList");
-		BKE_reports_init(op->reports, RPT_STORE|RPT_FREE);
+		op->reports = MEM_mallocN(sizeof(ReportList), "wmOperatorReportList");
+		BKE_reports_init(op->reports, RPT_STORE | RPT_FREE);
 	}
 	
 	/* recursive filling of operator macro list */
-	if(ot->macro.first) {
-		static wmOperator *motherop= NULL;
+	if (ot->macro.first) {
+		static wmOperator *motherop = NULL;
 		wmOperatorTypeMacro *otmacro;
 		int root = 0;
 		
 		/* ensure all ops are in execution order in 1 list */
-		if(motherop==NULL) {
+		if (motherop == NULL) {
 			motherop = op;
 			root = 1;
 		}
@@ -678,41 +689,42 @@ static wmOperator *wm_operator_create(wmWindowManager *wm, wmOperatorType *ot, P
 		
 		/* if properties exist, it will contain everything needed */
 		if (properties) {
-			otmacro= ot->macro.first;
+			otmacro = ot->macro.first;
 
-			RNA_STRUCT_BEGIN(properties, prop) {
+			RNA_STRUCT_BEGIN(properties, prop)
+			{
 
 				if (otmacro == NULL)
 					break;
 
 				/* skip invalid properties */
-				if (strcmp(RNA_property_identifier(prop), otmacro->idname) == 0)
-				{
-					wmOperatorType *otm= WM_operatortype_find(otmacro->idname, 0);
+				if (strcmp(RNA_property_identifier(prop), otmacro->idname) == 0) {
+					wmOperatorType *otm = WM_operatortype_find(otmacro->idname, 0);
 					PointerRNA someptr = RNA_property_pointer_get(properties, prop);
-					wmOperator *opm= wm_operator_create(wm, otm, &someptr, NULL);
+					wmOperator *opm = wm_operator_create(wm, otm, &someptr, NULL);
 
 					IDP_ReplaceGroupInGroup(opm->properties, otmacro->properties);
 
 					BLI_addtail(&motherop->macro, opm);
-					opm->opm= motherop; /* pointer to mom, for modal() */
+					opm->opm = motherop; /* pointer to mom, for modal() */
 
-					otmacro= otmacro->next;
+					otmacro = otmacro->next;
 				}
 			}
 			RNA_STRUCT_END;
-		} else {
+		}
+		else {
 			for (otmacro = ot->macro.first; otmacro; otmacro = otmacro->next) {
-				wmOperatorType *otm= WM_operatortype_find(otmacro->idname, 0);
-				wmOperator *opm= wm_operator_create(wm, otm, otmacro->ptr, NULL);
+				wmOperatorType *otm = WM_operatortype_find(otmacro->idname, 0);
+				wmOperator *opm = wm_operator_create(wm, otm, otmacro->ptr, NULL);
 
 				BLI_addtail(&motherop->macro, opm);
-				opm->opm= motherop; /* pointer to mom, for modal() */
+				opm->opm = motherop; /* pointer to mom, for modal() */
 			}
 		}
 		
 		if (root)
-			motherop= NULL;
+			motherop = NULL;
 	}
 	
 	WM_operator_properties_sanitize(op->ptr, 0);
@@ -722,42 +734,40 @@ static wmOperator *wm_operator_create(wmWindowManager *wm, wmOperatorType *ot, P
 
 static void wm_region_mouse_co(bContext *C, wmEvent *event)
 {
-	ARegion *ar= CTX_wm_region(C);
-	if(ar) {
+	ARegion *ar = CTX_wm_region(C);
+	if (ar) {
 		/* compatibility convention */
-		event->mval[0]= event->x - ar->winrct.xmin;
-		event->mval[1]= event->y - ar->winrct.ymin;
+		event->mval[0] = event->x - ar->winrct.xmin;
+		event->mval[1] = event->y - ar->winrct.ymin;
 	}
 	else {
 		/* these values are invalid (avoid odd behavior by relying on old mval values) */
-		event->mval[0]= -1;
-		event->mval[1]= -1;
+		event->mval[0] = -1;
+		event->mval[1] = -1;
 	}
 }
 
-static int wm_operator_init_from_last(wmWindowManager *wm, wmOperator *op)
+#if 0 /* disabling for 2.63 release, since we keep getting reports some menu items are leaving props undefined */
+int WM_operator_last_properties_init(wmOperator *op)
 {
-	int change= FALSE;
-	wmOperator *lastop;
+	int change = FALSE;
 
-	for(lastop= wm->operators.last; lastop; lastop= lastop->prev) {
-		/* equality check is a bit paranoid but just incase */
-		if((op != lastop) && (op->type == (lastop->type))) {
-			break;
+	if (op->type->last_properties) {
+		PropertyRNA *iterprop;
+
+		if (G.debug & G_DEBUG_WM) {
+			printf("%s: loading previous properties for '%s'\n", __func__, op->type->idname);
 		}
-	}
 
-	if (lastop && op != lastop) {
-		PropertyRNA *iterprop;
-		iterprop= RNA_struct_iterator_property(op->type->srna);
+		iterprop = RNA_struct_iterator_property(op->type->srna);
 
 		RNA_PROP_BEGIN(op->ptr, itemptr, iterprop) {
-			PropertyRNA *prop= itemptr.data;
-			if((RNA_property_flag(prop) & PROP_SKIP_SAVE) == 0) {
+			PropertyRNA *prop = itemptr.data;
+			if ((RNA_property_flag(prop) & PROP_SKIP_SAVE) == 0) {
 				if (!RNA_property_is_set(op->ptr, prop)) { /* don't override a setting already set */
-					const char *identifier= RNA_property_identifier(prop);
-					IDProperty *idp_src= IDP_GetPropertyFromGroup(lastop->properties, identifier);
-					if(idp_src) {
+					const char *identifier = RNA_property_identifier(prop);
+					IDProperty *idp_src = IDP_GetPropertyFromGroup(op->type->last_properties, identifier);
+					if (idp_src) {
 						IDProperty *idp_dst = IDP_CopyProperty(idp_src);
 
 						/* note - in the future this may need to be done recursively,
@@ -765,7 +775,7 @@ static int wm_operator_init_from_last(wmWindowManager *wm, wmOperator *op)
 						idp_dst->flag |= IDP_FLAG_GHOST;
 
 						IDP_ReplaceInGroup(op->properties, idp_dst);
-						change= TRUE;
+						change = TRUE;
 					}
 				}
 			}
@@ -776,102 +786,148 @@ static int wm_operator_init_from_last(wmWindowManager *wm, wmOperator *op)
 	return change;
 }
 
+int WM_operator_last_properties_store(wmOperator *op)
+{
+	if (op->type->last_properties) {
+		IDP_FreeProperty(op->type->last_properties);
+		MEM_freeN(op->type->last_properties);
+		op->type->last_properties = NULL;
+	}
+
+	if (op->properties) {
+		if (G.debug & G_DEBUG_WM) {
+			printf("%s: storing properties for '%s'\n", __func__, op->type->idname);
+		}
+		op->type->last_properties = IDP_CopyProperty(op->properties);
+		return TRUE;
+	}
+	else {
+		return FALSE;
+	}
+}
+
+#else
+
+int WM_operator_last_properties_init(wmOperator *UNUSED(op))
+{
+	return FALSE;
+}
+
+int WM_operator_last_properties_store(wmOperator *UNUSED(op))
+{
+	return FALSE;
+}
+
+#endif
+
 static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, PointerRNA *properties, ReportList *reports, short poll_only)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
-	int retval= OPERATOR_PASS_THROUGH;
+	wmWindowManager *wm = CTX_wm_manager(C);
+	int retval = OPERATOR_PASS_THROUGH;
 
 	/* this is done because complicated setup is done to call this function that is better not duplicated */
-	if(poll_only)
+	if (poll_only)
 		return WM_operator_poll(C, ot);
 
-	if(WM_operator_poll(C, ot)) {
-		wmOperator *op= wm_operator_create(wm, ot, properties, reports); /* if reports==NULL, theyll be initialized */
+	if (WM_operator_poll(C, ot)) {
+		wmOperator *op = wm_operator_create(wm, ot, properties, reports); /* if reports==NULL, theyll be initialized */
+		const short is_nested_call = (wm->op_undo_depth != 0);
 		
 		/* initialize setting from previous run */
-		if(wm->op_undo_depth == 0 && (ot->flag & OPTYPE_REGISTER)) { /* not called by py script */
-			wm_operator_init_from_last(wm, op);
+		if (!is_nested_call) { /* not called by py script */
+			WM_operator_last_properties_init(op);
 		}
 
-		if((G.f & G_DEBUG) && event && event->type!=MOUSEMOVE)
-			printf("handle evt %d win %d op %s\n", event?event->type:0, CTX_wm_screen(C)->subwinactive, ot->idname); 
+		if ((G.debug & G_DEBUG_EVENTS) && 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);
+		}
 		
-		if(op->type->invoke && event) {
+		if (op->type->invoke && event) {
 			wm_region_mouse_co(C, event);
 
-			if(op->type->flag & OPTYPE_UNDO)
+			if (op->type->flag & OPTYPE_UNDO)
 				wm->op_undo_depth++;
 
-			retval= op->type->invoke(C, op, event);
+			retval = op->type->invoke(C, op, event);
 			OPERATOR_RETVAL_CHECK(retval);
 
-			if(op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
+			if (op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
 				wm->op_undo_depth--;
 		}
-		else if(op->type->exec) {
-			if(op->type->flag & OPTYPE_UNDO)
+		else if (op->type->exec) {
+			if (op->type->flag & OPTYPE_UNDO)
 				wm->op_undo_depth++;
 
-			retval= op->type->exec(C, op);
+			retval = op->type->exec(C, op);
 			OPERATOR_RETVAL_CHECK(retval);
 
-			if(op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
+			if (op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
 				wm->op_undo_depth--;
 		}
-		else
-			printf("invalid operator call %s\n", ot->idname); /* debug, important to leave a while, should never happen */
+		else {
+			/* debug, important to leave a while, should never happen */
+			printf("invalid operator call '%s'\n", ot->idname);
+		}
 		
 		/* Note, if the report is given as an argument then assume the caller will deal with displaying them
 		 * currently python only uses this */
-		if (!(retval & OPERATOR_HANDLED) && (retval & (OPERATOR_FINISHED|OPERATOR_CANCELLED))) {
+		if (!(retval & OPERATOR_HANDLED) && (retval & (OPERATOR_FINISHED | OPERATOR_CANCELLED))) {
 			/* only show the report if the report list was not given in the function */
 			wm_operator_reports(C, op, retval, (reports != NULL));
 		}
 
-		if(retval & OPERATOR_HANDLED)
-			; /* do nothing, wm_operator_exec() has been called somewhere */
-		else if(retval & OPERATOR_FINISHED) {
+		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);
+			}
 			wm_operator_finished(C, op, 0);
 		}
-		else if(retval & OPERATOR_RUNNING_MODAL) {
+		else if (retval & OPERATOR_RUNNING_MODAL) {
 			/* grab cursor during blocking modal ops (X11)
 			 * Also check for macro
 			 */
-			if(ot->flag & OPTYPE_BLOCKING || (op->opm && op->opm->type->flag & OPTYPE_BLOCKING)) {
-				int bounds[4] = {-1,-1,-1,-1};
+			if (ot->flag & OPTYPE_BLOCKING || (op->opm && op->opm->type->flag & OPTYPE_BLOCKING)) {
+				int bounds[4] = {-1, -1, -1, -1};
 				int wrap;
 
 				if (op->opm) {
-					wrap = (U.uiflag & USER_CONTINUOUS_MOUSE) && ((op->opm->flag & OP_GRAB_POINTER) || (op->opm->type->flag & OPTYPE_GRAB_POINTER));
-				} else {
-					wrap = (U.uiflag & USER_CONTINUOUS_MOUSE) && ((op->flag & OP_GRAB_POINTER) || (ot->flag & OPTYPE_GRAB_POINTER));
+					wrap = (U.uiflag & USER_CONTINUOUS_MOUSE) &&
+					       ((op->opm->flag & OP_GRAB_POINTER) || (op->opm->type->flag & OPTYPE_GRAB_POINTER));
+				}
+				else {
+					wrap = (U.uiflag & USER_CONTINUOUS_MOUSE) &&
+					       ((op->flag & OP_GRAB_POINTER) || (ot->flag & OPTYPE_GRAB_POINTER));
 				}
 
 				/* exception, cont. grab in header is annoying */
-				if(wrap) {
-					ARegion *ar= CTX_wm_region(C);
-					if(ar && ar->regiontype == RGN_TYPE_HEADER) {
-						wrap= FALSE;
+				if (wrap) {
+					ARegion *ar = CTX_wm_region(C);
+					if (ar && ar->regiontype == RGN_TYPE_HEADER) {
+						wrap = FALSE;
 					}
 				}
 
-				if(wrap) {
-					rcti *winrect= NULL;
-					ARegion *ar= CTX_wm_region(C);
-					ScrArea *sa= CTX_wm_area(C);
+				if (wrap) {
+					rcti *winrect = NULL;
+					ARegion *ar = CTX_wm_region(C);
+					ScrArea *sa = CTX_wm_area(C);
 
-					if(ar && ar->regiontype == RGN_TYPE_WINDOW && event && BLI_in_rcti(&ar->winrct, event->x, event->y)) {
-						winrect= &ar->winrct;
+					if (ar && ar->regiontype == RGN_TYPE_WINDOW && event &&
+					    BLI_in_rcti(&ar->winrct, event->x, event->y))
+					{
+						winrect = &ar->winrct;
 					}
-					else if(sa) {
-						winrect= &sa->totrct;
+					else if (sa) {
+						winrect = &sa->totrct;
 					}
 
-					if(winrect) {
-						bounds[0]= winrect->xmin;
-						bounds[1]= winrect->ymax;
-						bounds[2]= winrect->xmax;
-						bounds[3]= winrect->ymin;
+					if (winrect) {
+						bounds[0] = winrect->xmin;
+						bounds[1] = winrect->ymax;
+						bounds[2] = winrect->xmax;
+						bounds[3] = winrect->ymin;
 					}
 				}
 
@@ -879,13 +935,14 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P
 			}
 
 			/* cancel UI handlers, typically tooltips that can hang around
-			   while dragging the view or worse, that stay there permanently
-			   after the modal operator has swallowed all events and passed
-			   none to the UI handler */
+			 * while dragging the view or worse, that stay there permanently
+			 * after the modal operator has swallowed all events and passed
+			 * none to the UI handler */
 			wm_handler_ui_cancel(C);
 		}
-		else
+		else {
 			WM_operator_free(op);
+		}
 	}
 
 	return retval;
@@ -895,9 +952,10 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P
  * this is for python to access since its done the operator lookup
  * 
  * invokes operator in context */
-static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA *properties, ReportList *reports, short context, short poll_only)
+static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA *properties, ReportList *reports,
+                                     short context, short poll_only)
 {
-	wmWindow *window= CTX_wm_window(C);
+	wmWindow *window = CTX_wm_window(C);
 	wmEvent *event;
 	
 	int retval;
@@ -905,8 +963,8 @@ static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA
 	CTX_wm_operator_poll_msg_set(C, NULL);
 
 	/* dummie test */
-	if(ot && C) {
-		switch(context) {
+	if (ot && C) {
+		switch (context) {
 			case WM_OP_INVOKE_DEFAULT:
 			case WM_OP_INVOKE_REGION_WIN:
 			case WM_OP_INVOKE_AREA:
@@ -915,13 +973,13 @@ static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA
 				if (window == NULL)
 					return 0;
 				else
-					event= window->eventstate;
+					event = window->eventstate;
 				break;
 			default:
 				event = NULL;
 		}
 
-		switch(context) {
+		switch (context) {
 			
 			case WM_OP_EXEC_REGION_WIN:
 			case WM_OP_INVOKE_REGION_WIN: 
@@ -933,8 +991,8 @@ static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA
 				/* forces operator to go to the region window/channels/preview, for header menus
 				 * but we stay in the same region if we are already in one 
 				 */
-				ARegion *ar= CTX_wm_region(C);
-				ScrArea *area= CTX_wm_area(C);
+				ARegion *ar = CTX_wm_region(C);
+				ScrArea *area = CTX_wm_area(C);
 				int type = RGN_TYPE_WINDOW;
 				
 				switch (context) {
@@ -955,13 +1013,13 @@ static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA
 						break;
 				}
 				
-				if(!(ar && ar->regiontype == type) && area) {
-					ARegion *ar1= BKE_area_find_region_type(area, type);
-					if(ar1)
+				if (!(ar && ar->regiontype == type) && area) {
+					ARegion *ar1 = BKE_area_find_region_type(area, type);
+					if (ar1)
 						CTX_wm_region_set(C, ar1);
 				}
 				
-				retval= wm_operator_invoke(C, ot, event, properties, reports, poll_only);
+				retval = wm_operator_invoke(C, ot, event, properties, reports, poll_only);
 				
 				/* set region back */
 				CTX_wm_region_set(C, ar);
@@ -971,11 +1029,11 @@ static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA
 			case WM_OP_EXEC_AREA:
 			case WM_OP_INVOKE_AREA:
 			{
-					/* remove region from context */
-				ARegion *ar= CTX_wm_region(C);
+				/* remove region from context */
+				ARegion *ar = CTX_wm_region(C);
 
 				CTX_wm_region_set(C, NULL);
-				retval= wm_operator_invoke(C, ot, event, properties, reports, poll_only);
+				retval = wm_operator_invoke(C, ot, event, properties, reports, poll_only);
 				CTX_wm_region_set(C, ar);
 
 				return retval;
@@ -984,12 +1042,12 @@ static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA
 			case WM_OP_INVOKE_SCREEN:
 			{
 				/* remove region + area from context */
-				ARegion *ar= CTX_wm_region(C);
-				ScrArea *area= CTX_wm_area(C);
+				ARegion *ar = CTX_wm_region(C);
+				ScrArea *area = CTX_wm_area(C);
 
 				CTX_wm_region_set(C, NULL);
 				CTX_wm_area_set(C, NULL);
-				retval= wm_operator_invoke(C, ot, event, properties, reports, poll_only);
+				retval = wm_operator_invoke(C, ot, event, properties, reports, poll_only);
 				CTX_wm_area_set(C, area);
 				CTX_wm_region_set(C, ar);
 
@@ -1008,46 +1066,56 @@ static int wm_operator_call_internal(bContext *C, wmOperatorType *ot, PointerRNA
 /* invokes operator in context */
 int WM_operator_name_call(bContext *C, const char *opstring, int context, PointerRNA *properties)
 {
-	wmOperatorType *ot= WM_operatortype_find(opstring, 0);
-	if(ot)
+	wmOperatorType *ot = WM_operatortype_find(opstring, 0);
+	if (ot)
 		return wm_operator_call_internal(C, ot, properties, NULL, context, FALSE);
 
 	return 0;
 }
 
 /* Similar to WM_operator_name_call called with WM_OP_EXEC_DEFAULT context.
-   - wmOperatorType is used instead of operator name since python already has the operator type
-   - poll() must be called by python before this runs.
-   - reports can be passed to this function (so python can report them as exceptions)
-*/
+ * - wmOperatorType is used instead of operator name since python already has the operator type
+ * - poll() must be called by python before this runs.
+ * - reports can be passed to this function (so python can report them as exceptions)
+ */
 int WM_operator_call_py(bContext *C, wmOperatorType *ot, int context, PointerRNA *properties, ReportList *reports)
 {
-	int retval= OPERATOR_CANCELLED;
+	int retval = OPERATOR_CANCELLED;
 
 #if 0
 	wmOperator *op;
-	op= wm_operator_create(wm, ot, properties, reports);
+	op = wm_operator_create(wm, ot, properties, reports);
 
 	if (op->type->exec) {
-		if(op->type->flag & OPTYPE_UNDO)
+		if (op->type->flag & OPTYPE_UNDO)
 			wm->op_undo_depth++;
 
-		retval= op->type->exec(C, op);
+		retval = op->type->exec(C, op);
 		OPERATOR_RETVAL_CHECK(retval);
 
-		if(op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
+		if (op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
 			wm->op_undo_depth--;
 	}
 	else
 		printf("error \"%s\" operator has no exec function, python cannot call it\n", op->type->name);
 #endif
 
-	retval= wm_operator_call_internal(C, ot, properties, reports, context, FALSE);
+	/* not especially nice using undo depth here, its used so py never
+	 * triggers undo or stores operators last used state.
+	 *
+	 * we could have some more obvious way of doing this like passing a flag.
+	 */
+	wmWindowManager *wm = CTX_wm_manager(C);
+	if (wm) wm->op_undo_depth++;
+
+	retval = wm_operator_call_internal(C, ot, properties, reports, context, FALSE);
 	
+	if (wm && (wm == CTX_wm_manager(C))) wm->op_undo_depth--;
+
 	/* keep the reports around if needed later */
-	if (	(retval & OPERATOR_RUNNING_MODAL) ||
-			((retval & OPERATOR_FINISHED) && wm_operator_register_check(CTX_wm_manager(C), ot))
-	) {
+	if ((retval & OPERATOR_RUNNING_MODAL) ||
+	    ((retval & OPERATOR_FINISHED) && wm_operator_register_check(CTX_wm_manager(C), ot)))
+	{
 		reports->flag |= RPT_FREE; /* let blender manage freeing */
 	}
 	
@@ -1066,31 +1134,31 @@ void wm_event_free_handler(wmEventHandler *handler)
 /* only set context when area/region is part of screen */
 static void wm_handler_op_context(bContext *C, wmEventHandler *handler)
 {
-	bScreen *screen= CTX_wm_screen(C);
+	bScreen *screen = CTX_wm_screen(C);
 	
-	if(screen && handler->op) {
-		if(handler->op_area==NULL)
+	if (screen && handler->op) {
+		if (handler->op_area == NULL)
 			CTX_wm_area_set(C, NULL);
 		else {
 			ScrArea *sa;
 			
-			for(sa= screen->areabase.first; sa; sa= sa->next)
-				if(sa==handler->op_area)
+			for (sa = screen->areabase.first; sa; sa = sa->next)
+				if (sa == handler->op_area)
 					break;
-			if(sa==NULL) {
+			if (sa == NULL) {
 				/* when changing screen layouts with running modal handlers (like render display), this
-				   is not an error to print */
-				if(handler->op==NULL)
+				 * is not an error to print */
+				if (handler->op == NULL)
 					printf("internal error: handler (%s) has invalid area\n", handler->op->type->idname);
 			}
 			else {
 				ARegion *ar;
 				CTX_wm_area_set(C, sa);
-				for(ar= sa->regionbase.first; ar; ar= ar->next)
-					if(ar==handler->op_region)
+				for (ar = sa->regionbase.first; ar; ar = ar->next)
+					if (ar == handler->op_region)
 						break;
 				/* XXX no warning print here, after full-area and back regions are remade */
-				if(ar)
+				if (ar)
 					CTX_wm_region_set(C, ar);
 			}
 		}
@@ -1101,25 +1169,25 @@ static void wm_handler_op_context(bContext *C, wmEventHandler *handler)
 void WM_event_remove_handlers(bContext *C, ListBase *handlers)
 {
 	wmEventHandler *handler;
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 	
 	/* C is zero on freeing database, modal handlers then already were freed */
-	while((handler=handlers->first)) {
+	while ((handler = handlers->first)) {
 		BLI_remlink(handlers, handler);
 		
-		if(handler->op) {
-			if(handler->op->type->cancel) {
-				ScrArea *area= CTX_wm_area(C);
-				ARegion *region= CTX_wm_region(C);
+		if (handler->op) {
+			if (handler->op->type->cancel) {
+				ScrArea *area = CTX_wm_area(C);
+				ARegion *region = CTX_wm_region(C);
 				
 				wm_handler_op_context(C, handler);
 
-				if(handler->op->type->flag & OPTYPE_UNDO)
+				if (handler->op->type->flag & OPTYPE_UNDO)
 					wm->op_undo_depth++;
 
 				handler->op->type->cancel(C, handler->op);
 
-				if(handler->op->type->flag & OPTYPE_UNDO)
+				if (handler->op->type->flag & OPTYPE_UNDO)
 					wm->op_undo_depth--;
 
 				CTX_wm_area_set(C, area);
@@ -1129,14 +1197,14 @@ void WM_event_remove_handlers(bContext *C, ListBase *handlers)
 			WM_cursor_ungrab(CTX_wm_window(C));
 			WM_operator_free(handler->op);
 		}
-		else if(handler->ui_remove) {
-			ScrArea *area= CTX_wm_area(C);
-			ARegion *region= CTX_wm_region(C);
-			ARegion *menu= CTX_wm_menu(C);
+		else if (handler->ui_remove) {
+			ScrArea *area = CTX_wm_area(C);
+			ARegion *region = CTX_wm_region(C);
+			ARegion *menu = CTX_wm_menu(C);
 			
-			if(handler->ui_area) CTX_wm_area_set(C, handler->ui_area);
-			if(handler->ui_region) CTX_wm_region_set(C, handler->ui_region);
-			if(handler->ui_menu) CTX_wm_menu_set(C, handler->ui_menu);
+			if (handler->ui_area) CTX_wm_area_set(C, handler->ui_area);
+			if (handler->ui_region) CTX_wm_region_set(C, handler->ui_region);
+			if (handler->ui_menu) CTX_wm_menu_set(C, handler->ui_menu);
 
 			handler->ui_remove(C, handler->ui_userdata);
 
@@ -1152,39 +1220,39 @@ void WM_event_remove_handlers(bContext *C, ListBase *handlers)
 /* do userdef mappings */
 int WM_userdef_event_map(int kmitype)
 {
-	switch(kmitype) {
+	switch (kmitype) {
 		case SELECTMOUSE:
-			if(U.flag & USER_LMOUSESELECT)
+			if (U.flag & USER_LMOUSESELECT)
 				return LEFTMOUSE;
 			else
 				return RIGHTMOUSE;
 			
 		case ACTIONMOUSE:
-			if(U.flag & USER_LMOUSESELECT)
+			if (U.flag & USER_LMOUSESELECT)
 				return RIGHTMOUSE;
 			else
 				return LEFTMOUSE;
 			
 		case WHEELOUTMOUSE:
-			if(U.uiflag & USER_WHEELZOOMDIR)
+			if (U.uiflag & USER_WHEELZOOMDIR)
 				return WHEELUPMOUSE;
 			else
 				return WHEELDOWNMOUSE;
 			
 		case WHEELINMOUSE:
-			if(U.uiflag & USER_WHEELZOOMDIR)
+			if (U.uiflag & USER_WHEELZOOMDIR)
 				return WHEELDOWNMOUSE;
 			else
 				return WHEELUPMOUSE;
 			
 		case EVT_TWEAK_A:
-			if(U.flag & USER_LMOUSESELECT)
+			if (U.flag & USER_LMOUSESELECT)
 				return EVT_TWEAK_R;
 			else
 				return EVT_TWEAK_L;
 			
 		case EVT_TWEAK_S:
-			if(U.flag & USER_LMOUSESELECT)
+			if (U.flag & USER_LMOUSESELECT)
 				return EVT_TWEAK_L;
 			else
 				return EVT_TWEAK_R;
@@ -1198,8 +1266,8 @@ 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)) {
+	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;
@@ -1208,8 +1276,8 @@ static void wm_eventemulation(wmEvent *event)
 
 #ifdef __APPLE__
 	/* rightmouse emulation */
-	if(U.flag & USER_TWOBUTTONMOUSE) {
-		if(event->type == LEFTMOUSE && (event->oskey || mmb_emulated == KM_PRESS)) {
+	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;
@@ -1218,8 +1286,8 @@ static void wm_eventemulation(wmEvent *event)
 #endif
 
 	/* numpad emulation */
-	if(U.flag & USER_NONUMPAD) {
-		switch(event->type) {
+	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;
@@ -1239,37 +1307,37 @@ static void wm_eventemulation(wmEvent *event)
 
 static int wm_eventmatch(wmEvent *winevent, wmKeyMapItem *kmi)
 {
-	int kmitype= WM_userdef_event_map(kmi->type);
+	int kmitype = WM_userdef_event_map(kmi->type);
 
-	if(kmi->flag & KMI_INACTIVE) return 0;
+	if (kmi->flag & KMI_INACTIVE) return 0;
 
 	/* the matching rules */
-	if(kmitype==KM_TEXTINPUT)
-		if(ISTEXTINPUT(winevent->type) && (winevent->ascii || winevent->utf8_buf[0])) return 1;
-	if(kmitype!=KM_ANY)
-		if(winevent->type!=kmitype) return 0;
+	if (kmitype == KM_TEXTINPUT)
+		if (ISTEXTINPUT(winevent->type) && (winevent->ascii || winevent->utf8_buf[0])) return 1;
+	if (kmitype != KM_ANY)
+		if (winevent->type != kmitype) return 0;
 	
-	if(kmi->val!=KM_ANY)
-		if(winevent->val!=kmi->val) return 0;
+	if (kmi->val != KM_ANY)
+		if (winevent->val != kmi->val) return 0;
 	
 	/* modifiers also check bits, so it allows modifier order */
-	if(kmi->shift!=KM_ANY)
-		if(winevent->shift != kmi->shift && !(winevent->shift & kmi->shift)) return 0;
-	if(kmi->ctrl!=KM_ANY)
-		if(winevent->ctrl != kmi->ctrl && !(winevent->ctrl & kmi->ctrl)) return 0;
-	if(kmi->alt!=KM_ANY)
-		if(winevent->alt != kmi->alt && !(winevent->alt & kmi->alt)) return 0;
-	if(kmi->oskey!=KM_ANY)
-		if(winevent->oskey != kmi->oskey && !(winevent->oskey & kmi->oskey)) return 0;
-	
-	if(kmi->keymodifier)
-		if(winevent->keymodifier!=kmi->keymodifier) return 0;
+	if (kmi->shift != KM_ANY)
+		if (winevent->shift != kmi->shift && !(winevent->shift & kmi->shift)) return 0;
+	if (kmi->ctrl != KM_ANY)
+		if (winevent->ctrl != kmi->ctrl && !(winevent->ctrl & kmi->ctrl)) return 0;
+	if (kmi->alt != KM_ANY)
+		if (winevent->alt != kmi->alt && !(winevent->alt & kmi->alt)) return 0;
+	if (kmi->oskey != KM_ANY)
+		if (winevent->oskey != kmi->oskey && !(winevent->oskey & kmi->oskey)) return 0;
+	
+	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;
+	if (winevent->keymodifier)
+		if (ISTEXTINPUT(winevent->type)) 
+			if (winevent->keymodifier != kmi->keymodifier) return 0;
 	
 	return 1;
 }
@@ -1282,56 +1350,57 @@ static void wm_event_modalkeymap(const bContext *C, wmOperator *op, wmEvent *eve
 	if (op->opm)
 		op = op->opm;
 
-	if(op->type->modalkeymap) {
-		wmKeyMap *keymap= WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap);
+	if (op->type->modalkeymap) {
+		wmKeyMap *keymap = WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap);
 		wmKeyMapItem *kmi;
 
-		for(kmi= keymap->items.first; kmi; kmi= kmi->next) {
-			if(wm_eventmatch(event, kmi)) {
+		for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
+			if (wm_eventmatch(event, kmi)) {
 					
-				event->type= EVT_MODAL_MAP;
-				event->val= kmi->propvalue;
+				event->type = EVT_MODAL_MAP;
+				event->val = kmi->propvalue;
 			}
 		}
 	}
 }
 
 /* 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)
+static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHandler *handler,
+                                    wmEvent *event, PointerRNA *properties)
 {
-	int retval= OPERATOR_PASS_THROUGH;
+	int retval = OPERATOR_PASS_THROUGH;
 	
 	/* derived, modal or blocking operator */
-	if(handler->op) {
-		wmOperator *op= handler->op;
-		wmOperatorType *ot= op->type;
+	if (handler->op) {
+		wmOperator *op = handler->op;
+		wmOperatorType *ot = op->type;
 
-		if(ot->modal) {
+		if (ot->modal) {
 			/* we set context to where modal handler came from */
-			wmWindowManager *wm= CTX_wm_manager(C);
-			ScrArea *area= CTX_wm_area(C);
-			ARegion *region= CTX_wm_region(C);
+			wmWindowManager *wm = CTX_wm_manager(C);
+			ScrArea *area = CTX_wm_area(C);
+			ARegion *region = CTX_wm_region(C);
 			
 			wm_handler_op_context(C, handler);
 			wm_region_mouse_co(C, event);
 			wm_event_modalkeymap(C, op, event);
 			
-			if(ot->flag & OPTYPE_UNDO)
+			if (ot->flag & OPTYPE_UNDO)
 				wm->op_undo_depth++;
 
-			retval= ot->modal(C, op, event);
+			retval = ot->modal(C, op, event);
 			OPERATOR_RETVAL_CHECK(retval);
 
 			/* 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 */
-			if(CTX_wm_manager(C) == wm) {
+			if (CTX_wm_manager(C) == wm) {
 
-				if(ot->flag & OPTYPE_UNDO)
+				if (ot->flag & OPTYPE_UNDO)
 					wm->op_undo_depth--;
 
 				/* putting back screen context, reval can pass trough after modal failures! */
-				if((retval & OPERATOR_PASS_THROUGH) || wm_event_always_pass(event)) {
+				if ((retval & OPERATOR_PASS_THROUGH) || wm_event_always_pass(event)) {
 					CTX_wm_area_set(C, area);
 					CTX_wm_region_set(C, region);
 				}
@@ -1341,20 +1410,20 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
 					CTX_wm_region_set(C, NULL);
 				}
 
-				if(retval & (OPERATOR_CANCELLED|OPERATOR_FINISHED))
+				if (retval & (OPERATOR_CANCELLED | OPERATOR_FINISHED))
 					wm_operator_reports(C, op, retval, FALSE);
 
-				if(retval & OPERATOR_FINISHED) {
+				if (retval & OPERATOR_FINISHED) {
 					wm_operator_finished(C, op, 0);
-					handler->op= NULL;
+					handler->op = NULL;
 				}
-				else if(retval & (OPERATOR_CANCELLED|OPERATOR_FINISHED)) {
+				else if (retval & (OPERATOR_CANCELLED | OPERATOR_FINISHED)) {
 					WM_operator_free(op);
-					handler->op= NULL;
+					handler->op = NULL;
 				}
 
-				/* remove modal handler, operator itself should have been cancelled and freed */
-				if(retval & (OPERATOR_CANCELLED|OPERATOR_FINISHED)) {
+				/* remove modal handler, operator itself should have been canceled and freed */
+				if (retval & (OPERATOR_CANCELLED | OPERATOR_FINISHED)) {
 					WM_cursor_ungrab(CTX_wm_window(C));
 
 					BLI_remlink(handlers, handler);
@@ -1370,22 +1439,22 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
 			printf("wm_handler_operator_call error\n");
 	}
 	else {
-		wmOperatorType *ot= WM_operatortype_find(event->keymap_idname, 0);
+		wmOperatorType *ot = WM_operatortype_find(event->keymap_idname, 0);
 
-		if(ot)
-			retval= wm_operator_invoke(C, ot, event, properties, NULL, FALSE);
+		if (ot)
+			retval = wm_operator_invoke(C, ot, event, properties, NULL, FALSE);
 	}
 	/* Finished and pass through flag as handled */
 
 	/* Finished and pass through flag as handled */
-	if(retval == (OPERATOR_FINISHED|OPERATOR_PASS_THROUGH))
+	if (retval == (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH))
 		return WM_HANDLER_HANDLED;
 
 	/* Modal unhandled, break */
-	if(retval == (OPERATOR_PASS_THROUGH|OPERATOR_RUNNING_MODAL))
-		return (WM_HANDLER_BREAK|WM_HANDLER_MODAL);
+	if (retval == (OPERATOR_PASS_THROUGH | OPERATOR_RUNNING_MODAL))
+		return (WM_HANDLER_BREAK | WM_HANDLER_MODAL);
 
-	if(retval & OPERATOR_PASS_THROUGH)
+	if (retval & OPERATOR_PASS_THROUGH)
 		return WM_HANDLER_CONTINUE;
 
 	return WM_HANDLER_BREAK;
@@ -1394,159 +1463,163 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand
 /* fileselect handlers are only in the window queue, so it's save to switch screens or area types */
 static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHandler *handler, wmEvent *event)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 	SpaceFile *sfile;
-	int action= WM_HANDLER_CONTINUE;
+	int action = WM_HANDLER_CONTINUE;
 	
-	if(event->type != EVT_FILESELECT)
+	if (event->type != EVT_FILESELECT)
 		return action;
-	if(handler->op != (wmOperator *)event->customdata)
+	if (handler->op != (wmOperator *)event->customdata)
 		return action;
 	
-	switch(event->val) {
+	switch (event->val) {
 		case EVT_FILESELECT_OPEN: 
 		case EVT_FILESELECT_FULL_OPEN: 
-			{	
-				ScrArea *sa;
+		{
+			ScrArea *sa;
 				
-				/* sa can be null when window A is active, but mouse is over window B */
-				/* in this case, open file select in original window A */
-				if (handler->op_area == NULL) {
-					bScreen *screen = CTX_wm_screen(C);
-					sa = (ScrArea *)screen->areabase.first;
-				}
-				else {
-					sa = handler->op_area;
-				}
+			/* sa can be null when window A is active, but mouse is over window B */
+			/* in this case, open file select in original window A */
+			if (handler->op_area == NULL) {
+				bScreen *screen = CTX_wm_screen(C);
+				sa = (ScrArea *)screen->areabase.first;
+			}
+			else {
+				sa = handler->op_area;
+			}
 					
-				if(event->val==EVT_FILESELECT_OPEN) {
-					ED_area_newspace(C, sa, SPACE_FILE); /* 'sa' is modified in-place */
-				}
-				else {
-					sa= ED_screen_full_newspace(C, sa, SPACE_FILE);	/* sets context */
-				}
+			if (event->val == EVT_FILESELECT_OPEN) {
+				ED_area_newspace(C, sa, SPACE_FILE);     /* 'sa' is modified in-place */
+			}
+			else {
+				sa = ED_screen_full_newspace(C, sa, SPACE_FILE);    /* sets context */
+			}
 
-				/* note, getting the 'sa' back from the context causes a nasty bug where the newly created
-				 * 'sa' != CTX_wm_area(C). removed the line below and set 'sa' in the 'if' above */
-				/* sa = CTX_wm_area(C); */
+			/* note, getting the 'sa' back from the context causes a nasty bug where the newly created
+			 * 'sa' != CTX_wm_area(C). removed the line below and set 'sa' in the 'if' above */
+			/* sa = CTX_wm_area(C); */
 
-				/* settings for filebrowser, sfile is not operator owner but sends events */
-				sfile= (SpaceFile*)sa->spacedata.first;
-				sfile->op= handler->op;
+			/* settings for filebrowser, sfile is not operator owner but sends events */
+			sfile = (SpaceFile *)sa->spacedata.first;
+			sfile->op = handler->op;
 
-				ED_fileselect_set_params(sfile);
+			ED_fileselect_set_params(sfile);
 				
-				action= WM_HANDLER_BREAK;
-			}
-			break;
+			action = WM_HANDLER_BREAK;
+		}
+		break;
 			
 		case EVT_FILESELECT_EXEC:
 		case EVT_FILESELECT_CANCEL:
 		case EVT_FILESELECT_EXTERNAL_CANCEL:
-			{
-				/* XXX validate area and region? */
-				bScreen *screen= CTX_wm_screen(C);
+		{
+			/* XXX validate area and region? */
+			bScreen *screen = CTX_wm_screen(C);
 
-				/* remlink now, for load file case before removing*/
-				BLI_remlink(handlers, handler);
+			/* remlink now, for load file case before removing*/
+			BLI_remlink(handlers, handler);
 				
-				if(event->val!=EVT_FILESELECT_EXTERNAL_CANCEL) {
-					if(screen != handler->filescreen) {
-						ED_screen_full_prevspace(C, CTX_wm_area(C));
-					}
-					else {
-						ED_area_prevspace(C, CTX_wm_area(C));
-					}
+			if (event->val != EVT_FILESELECT_EXTERNAL_CANCEL) {
+				if (screen != handler->filescreen) {
+					ED_screen_full_prevspace(C, CTX_wm_area(C));
 				}
+				else {
+					ED_area_prevspace(C, CTX_wm_area(C));
+				}
+			}
 				
-				wm_handler_op_context(C, handler);
+			wm_handler_op_context(C, handler);
 
-				/* needed for uiPupMenuReports */
+			/* needed for uiPupMenuReports */
 
-				if(event->val==EVT_FILESELECT_EXEC) {
-#if 0				// use REDALERT now
+			if (event->val == EVT_FILESELECT_EXEC) {
+#if 0               // use REDALERT now
 
-					/* 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
+				/* 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;
+				{
+					int retval;
+						
+					if (handler->op->type->flag & OPTYPE_UNDO)
+						wm->op_undo_depth++;
 						
-						if(handler->op->type->flag & OPTYPE_UNDO)
-							wm->op_undo_depth++;
+					retval = handler->op->type->exec(C, handler->op);
 
-						retval= handler->op->type->exec(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(handler->op->type->flag & OPTYPE_UNDO && CTX_wm_manager(C) == wm)
-							wm->op_undo_depth--;
-						
-						if (retval & OPERATOR_FINISHED)
-							if(G.f & G_DEBUG)
-								wm_operator_print(C, handler->op);
-						
-						/* 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);
 
-						WM_operator_free(handler->op);
+						CTX_wm_window_set(C, win_prev);
+						CTX_wm_area_set(C, area_prev);
+						CTX_wm_region_set(C, ar_prev);
 					}
-				}
-				else {
-					if(handler->op->type->cancel) {
-						if(handler->op->type->flag & OPTYPE_UNDO)
-							wm->op_undo_depth++;
-
-						handler->op->type->cancel(C, handler->op);
 
-						if(handler->op->type->flag & OPTYPE_UNDO)
-							wm->op_undo_depth--;
+					if (retval & OPERATOR_FINISHED) {
+						WM_operator_last_properties_store(handler->op);
 					}
 
 					WM_operator_free(handler->op);
 				}
+			}
+			else {
+				if (handler->op->type->cancel) {
+					if (handler->op->type->flag & OPTYPE_UNDO)
+						wm->op_undo_depth++;
 
-				CTX_wm_area_set(C, NULL);
+					handler->op->type->cancel(C, handler->op);
 				
-				wm_event_free_handler(handler);
+					if (handler->op->type->flag & OPTYPE_UNDO)
+						wm->op_undo_depth--;
+				}
 				
-				action= WM_HANDLER_BREAK;
+				WM_operator_free(handler->op);
 			}
-			break;
+
+			CTX_wm_area_set(C, NULL);
+
+			wm_event_free_handler(handler);
+
+			action = WM_HANDLER_BREAK;
+		}
+		break;
 	}
 	
 	return action;
@@ -1554,22 +1627,22 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa
 
 static int handler_boundbox_test(wmEventHandler *handler, wmEvent *event)
 {
-	if(handler->bbwin) {
-		if(handler->bblocal) {
-			rcti rect= *handler->bblocal;
+	if (handler->bbwin) {
+		if (handler->bblocal) {
+			rcti rect = *handler->bblocal;
 			BLI_translate_rcti(&rect, handler->bbwin->xmin, handler->bbwin->ymin);
 
-			if(BLI_in_rcti(&rect, event->x, event->y))
+			if (BLI_in_rcti(&rect, event->x, event->y))
 				return 1;
-			else if(event->type==MOUSEMOVE && BLI_in_rcti(&rect, event->prevx, event->prevy))
+			else if (event->type == MOUSEMOVE && BLI_in_rcti(&rect, event->prevx, event->prevy))
 				return 1;
 			else
 				return 0;
 		}
 		else {
-			if(BLI_in_rcti(handler->bbwin, event->x, event->y))
+			if (BLI_in_rcti(handler->bbwin, event->x, event->y))
 				return 1;
-			else if(event->type==MOUSEMOVE && BLI_in_rcti(handler->bbwin, event->prevx, event->prevy))
+			else if (event->type == MOUSEMOVE && BLI_in_rcti(handler->bbwin, event->prevx, event->prevy))
 				return 1;
 			else
 				return 0;
@@ -1580,82 +1653,83 @@ static int handler_boundbox_test(wmEventHandler *handler, wmEvent *event)
 
 static int wm_action_not_handled(int action)
 {
-	return action == WM_HANDLER_CONTINUE || action == (WM_HANDLER_BREAK|WM_HANDLER_MODAL);
+	return action == WM_HANDLER_CONTINUE || action == (WM_HANDLER_BREAK | WM_HANDLER_MODAL);
 }
 
 static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 	wmEventHandler *handler, *nexthandler;
-	int action= WM_HANDLER_CONTINUE;
+	int action = WM_HANDLER_CONTINUE;
 	int always_pass;
 
-	if(handlers==NULL) return action;
+	if (handlers == NULL) return action;
 
 	/* modal handlers can get removed in this loop, we keep the loop this way */
-	for(handler= handlers->first; handler; handler= nexthandler) {
+	for (handler = handlers->first; handler; handler = nexthandler) {
 		
-		nexthandler= handler->next;
+		nexthandler = handler->next;
 		
 		/* during this loop, ui handlers for nested menus can tag multiple handlers free */
-		if(handler->flag & WM_HANDLER_DO_FREE);
-			/* optional boundbox */
-		else if(handler_boundbox_test(handler, event)) {
+		if (handler->flag & WM_HANDLER_DO_FREE) ;
+		/* optional boundbox */
+		else if (handler_boundbox_test(handler, event)) {
 			/* in advance to avoid access to freed event on window close */
-			always_pass= wm_event_always_pass(event);
+			always_pass = wm_event_always_pass(event);
 		
 			/* modal+blocking handler */
-			if(handler->flag & WM_HANDLER_BLOCKING)
+			if (handler->flag & WM_HANDLER_BLOCKING)
 				action |= WM_HANDLER_BREAK;
 
-			if(handler->keymap) {
-				wmKeyMap *keymap= WM_keymap_active(wm, handler->keymap);
+			if (handler->keymap) {
+				wmKeyMap *keymap = WM_keymap_active(wm, handler->keymap);
 				wmKeyMapItem *kmi;
 				
-				if(!keymap->poll || keymap->poll(C)) {
-					for(kmi= keymap->items.first; kmi; kmi= kmi->next) {
-						if(wm_eventmatch(event, kmi)) {
-							
-							event->keymap_idname= kmi->idname;	/* weak, but allows interactive callback to not use rawkey */
-							
+				if (!keymap->poll || keymap->poll(C)) {
+					for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
+						if (wm_eventmatch(event, kmi)) {
+
+							/* weak, but allows interactive callback to not use rawkey */
+							event->keymap_idname = kmi->idname;
+
 							action |= wm_handler_operator_call(C, handlers, handler, event, kmi->ptr);
-							if(action & WM_HANDLER_BREAK)  /* not always_pass here, it denotes removed handler */
+							if (action & WM_HANDLER_BREAK)  /* not always_pass here, it denotes removed handler */
 								break;
 						}
 					}
 				}
 			}
-			else if(handler->ui_handle) {
+			else if (handler->ui_handle) {
 				action |= wm_handler_ui_call(C, handler, event, always_pass);
 			}
-			else if(handler->type==WM_HANDLER_FILESELECT) {
+			else if (handler->type == WM_HANDLER_FILESELECT) {
 				/* screen context changes here */
 				action |= wm_handler_fileselect_call(C, handlers, handler, event);
 			}
-			else if(handler->dropboxes) {
-				if(event->type==EVT_DROP) {
-					wmDropBox *drop= handler->dropboxes->first;
-					for(; drop; drop= drop->next) {
+			else if (handler->dropboxes) {
+				if (event->type == EVT_DROP) {
+					wmDropBox *drop = handler->dropboxes->first;
+					for (; drop; drop = drop->next) {
 						/* other drop custom types allowed */
-						if(event->custom==EVT_DATA_LISTBASE) {
-							ListBase *lb= (ListBase *)event->customdata;
+						if (event->custom == EVT_DATA_LISTBASE) {
+							ListBase *lb = (ListBase *)event->customdata;
 							wmDrag *drag;
 							
-							for(drag= lb->first; drag; drag= drag->next) {
-								if(drop->poll(C, drag, event)) {
+							for (drag = lb->first; drag; drag = drag->next) {
+								if (drop->poll(C, drag, event)) {
 									
 									drop->copy(drag, drop);
 									
 									/* free the drags before calling operator */
 									BLI_freelistN(event->customdata);
-									event->customdata= NULL;
-									event->custom= 0;
+									event->customdata = NULL;
+									event->custom = 0;
 									
 									WM_operator_name_call(C, drop->ot->idname, drop->opcontext, drop->ptr);
 									action |= WM_HANDLER_BREAK;
 									
 									/* XXX fileread case */
-									if(CTX_wm_window(C)==NULL)
+									if (CTX_wm_window(C) == NULL)
 										return action;
 									
 									/* escape from drag loop, got freed */
@@ -1671,8 +1745,8 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
 				action |= wm_handler_operator_call(C, handlers, handler, event, NULL);
 			}
 
-			if(action & WM_HANDLER_BREAK) {
-				if(always_pass)
+			if (action & WM_HANDLER_BREAK) {
+				if (always_pass)
 					action &= ~WM_HANDLER_BREAK;
 				else
 					break;
@@ -1681,15 +1755,15 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
 		
 		/* XXX fileread case, if the wm is freed then the handler's
 		 * will have been too so the code below need not run. */
-		if(CTX_wm_window(C)==NULL) {
+		if (CTX_wm_window(C) == NULL) {
 			return action;
 		}
 
 		/* XXX code this for all modal ops, and ensure free only happens here */
 		
 		/* modal ui handler can be tagged to be freed */ 
-		if(BLI_findindex(handlers, handler) != -1) { /* could be free'd already by regular modal ops */
-			if(handler->flag & WM_HANDLER_DO_FREE) {
+		if (BLI_findindex(handlers, handler) != -1) { /* could be freed already by regular modal ops */
+			if (handler->flag & WM_HANDLER_DO_FREE) {
 				BLI_remlink(handlers, handler);
 				wm_event_free_handler(handler);
 			}
@@ -1710,13 +1784,14 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
 			 *   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)
-			) {
+			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, 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);
@@ -1735,7 +1810,7 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
 		}
 	}
 	
-	if(action == (WM_HANDLER_BREAK|WM_HANDLER_MODAL))
+	if (action == (WM_HANDLER_BREAK | WM_HANDLER_MODAL))
 		wm_cursor_arrow_move(CTX_wm_window(C), event);
 
 	return action;
@@ -1743,12 +1818,12 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
 
 static int wm_event_inside_i(wmEvent *event, rcti *rect)
 {
-	if(wm_event_always_pass(event))
+	if (wm_event_always_pass(event))
 		return 1;
-	if(BLI_in_rcti(rect, event->x, event->y))
+	if (BLI_in_rcti(rect, event->x, event->y))
 		return 1;
-	if(event->type==MOUSEMOVE) {
-		if( BLI_in_rcti(rect, event->prevx, event->prevy)) {
+	if (event->type == MOUSEMOVE) {
+		if (BLI_in_rcti(rect, event->prevx, event->prevy)) {
 			return 1;
 		}
 		return 0;
@@ -1758,36 +1833,36 @@ static int wm_event_inside_i(wmEvent *event, rcti *rect)
 
 static ScrArea *area_event_inside(bContext *C, int x, int y)
 {
-	bScreen *screen= CTX_wm_screen(C);
+	bScreen *screen = CTX_wm_screen(C);
 	ScrArea *sa;
 	
-	if(screen)
-		for(sa= screen->areabase.first; sa; sa= sa->next)
-			if(BLI_in_rcti(&sa->totrct, x, y))
+	if (screen)
+		for (sa = screen->areabase.first; sa; sa = sa->next)
+			if (BLI_in_rcti(&sa->totrct, x, y))
 				return sa;
 	return NULL;
 }
 
 static ARegion *region_event_inside(bContext *C, int x, int y)
 {
-	bScreen *screen= CTX_wm_screen(C);
-	ScrArea *area= CTX_wm_area(C);
+	bScreen *screen = CTX_wm_screen(C);
+	ScrArea *area = CTX_wm_area(C);
 	ARegion *ar;
 	
-	if(screen && area)
-		for(ar= area->regionbase.first; ar; ar= ar->next)
-			if(BLI_in_rcti(&ar->winrct, x, y))
+	if (screen && area)
+		for (ar = area->regionbase.first; ar; ar = ar->next)
+			if (BLI_in_rcti(&ar->winrct, x, y))
 				return ar;
 	return NULL;
 }
 
 static void wm_paintcursor_tag(bContext *C, wmPaintCursor *pc, ARegion *ar)
 {
-	if(ar) {
-		for(; pc; pc= pc->next) {
-			if(pc->poll == NULL || pc->poll(C)) {
-				wmWindow *win= CTX_wm_window(C);
-				win->screen->do_draw_paintcursor= 1;
+	if (ar) {
+		for (; pc; pc = pc->next) {
+			if (pc->poll == NULL || pc->poll(C)) {
+				wmWindow *win = CTX_wm_window(C);
+				win->screen->do_draw_paintcursor = 1;
 				wm_tag_redraw_overlay(win, ar);
 			}
 		}
@@ -1798,17 +1873,17 @@ static void wm_paintcursor_tag(bContext *C, wmPaintCursor *pc, ARegion *ar)
 /* context was set on active area and region */
 static void wm_paintcursor_test(bContext *C, wmEvent *event)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 	
-	if(wm->paintcursors.first) {
-		ARegion *ar= CTX_wm_region(C);
+	if (wm->paintcursors.first) {
+		ARegion *ar = CTX_wm_region(C);
 		
-		if(ar)
+		if (ar)
 			wm_paintcursor_tag(C, wm->paintcursors.first, ar);
 		
 		/* if previous position was not in current region, we have to set a temp new context */
-		if(ar==NULL || !BLI_in_rcti(&ar->winrct, event->prevx, event->prevy)) {
-			ScrArea *sa= CTX_wm_area(C);
+		if (ar == NULL || !BLI_in_rcti(&ar->winrct, event->prevx, event->prevy)) {
+			ScrArea *sa = CTX_wm_area(C);
 			
 			CTX_wm_area_set(C, area_event_inside(C, event->prevx, event->prevy));
 			CTX_wm_region_set(C, region_event_inside(C, event->prevx, event->prevy));
@@ -1823,38 +1898,38 @@ static void wm_paintcursor_test(bContext *C, wmEvent *event)
 
 static void wm_event_drag_test(wmWindowManager *wm, wmWindow *win, wmEvent *event)
 {
-	if(wm->drags.first==NULL) return;
+	if (wm->drags.first == NULL) return;
 	
-	if(event->type==MOUSEMOVE)
-		win->screen->do_draw_drag= 1;
-	else if(event->type==ESCKEY) {
+	if (event->type == MOUSEMOVE)
+		win->screen->do_draw_drag = 1;
+	else if (event->type == ESCKEY) {
 		BLI_freelistN(&wm->drags);
-		win->screen->do_draw_drag= 1;
+		win->screen->do_draw_drag = 1;
 	}
-	else if(event->type==LEFTMOUSE && event->val==KM_RELEASE) {
-		event->type= EVT_DROP;
+	else if (event->type == LEFTMOUSE && event->val == KM_RELEASE) {
+		event->type = EVT_DROP;
 		
 		/* create customdata, first free existing */
-		if(event->customdata) {
-			if(event->customdatafree)
+		if (event->customdata) {
+			if (event->customdatafree)
 				MEM_freeN(event->customdata);
 		}
 		
-		event->custom= EVT_DATA_LISTBASE;
-		event->customdata= &wm->drags;
-		event->customdatafree= 1;
+		event->custom = EVT_DATA_LISTBASE;
+		event->customdata = &wm->drags;
+		event->customdatafree = 1;
 		
 		/* clear drop icon */
-		win->screen->do_draw_drag= 1;
+		win->screen->do_draw_drag = 1;
 		
 		/* restore cursor (disabled, see wm_dragdrop.c) */
 		// WM_cursor_restore(win);
 	}
 	
 	/* overlap fails otherwise */
-	if(win->screen->do_draw_drag)
-		if(win->drawmethod == USER_DRAW_OVERLAP)
-			win->screen->do_draw= 1;
+	if (win->screen->do_draw_drag)
+		if (win->drawmethod == USER_DRAW_OVERLAP)
+			win->screen->do_draw = 1;
 	
 }
 
@@ -1862,37 +1937,37 @@ static void wm_event_drag_test(wmWindowManager *wm, wmWindow *win, wmEvent *even
 /* goes over entire hierarchy:  events -> window -> screen -> area -> region */
 void wm_event_do_handlers(bContext *C)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 	wmWindow *win;
 
 	/* update key configuration before handling events */
 	WM_keyconfig_update(wm);
 
-	for(win= wm->windows.first; win; win= win->next) {
+	for (win = wm->windows.first; win; win = win->next) {
 		wmEvent *event;
 		
-		if( win->screen==NULL )
+		if (win->screen == NULL)
 			wm_event_free_all(win);
 		else {
-			Scene* scene = win->screen->scene;
+			Scene *scene = win->screen->scene;
 			
-			if(scene) {
+			if (scene) {
 				int playing = sound_scene_playing(win->screen->scene);
 				
-				if(playing != -1) {
+				if (playing != -1) {
 					CTX_wm_window_set(C, win);
 					CTX_wm_screen_set(C, win->screen);
 					CTX_data_scene_set(C, scene);
 					
-					if(((playing == 1) && (!win->screen->animtimer)) || ((playing == 0) && (win->screen->animtimer))){
+					if (((playing == 1) && (!win->screen->animtimer)) || ((playing == 0) && (win->screen->animtimer))) {
 						ED_screen_animation_play(C, -1, 1);
 					}
 					
-					if(playing == 0) {
+					if (playing == 0) {
 						float time = sound_sync_scene(scene);
-						if(finite(time)) {
+						if (finite(time)) {
 							int ncfra = sound_sync_scene(scene) * (float)FPS + 0.5f;
-							if(ncfra != scene->r.cfra)	{
+							if (ncfra != scene->r.cfra) {
 								scene->r.cfra = ncfra;
 								ED_update_for_newframe(CTX_data_main(C), scene, win->screen, 1);
 								WM_event_add_notifier(C, NC_WINDOW, NULL);
@@ -1907,12 +1982,13 @@ void wm_event_do_handlers(bContext *C)
 			}
 		}
 		
-		while( (event= win->queue.first) ) {
+		while ( (event = win->queue.first) ) {
 			int action = WM_HANDLER_CONTINUE;
 
-			if((G.f & G_DEBUG) && event && !ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE))
-				printf("pass on evt %d val %d\n", event->type, event->val); 
-			
+			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);
+			}
+
 			wm_eventemulation(event);
 
 			CTX_wm_window_set(C, win);
@@ -1930,7 +2006,7 @@ void wm_event_do_handlers(bContext *C)
 			action |= wm_handlers_do(C, event, &win->modalhandlers);
 			
 			/* fileread case */
-			if(CTX_wm_window(C)==NULL)
+			if (CTX_wm_window(C) == NULL)
 				return;
 			
 			/* check dragging, creates new event or frees, adds draw tag */
@@ -1939,29 +2015,29 @@ void wm_event_do_handlers(bContext *C)
 			/* builtin tweak, if action is break it removes tweak */
 			wm_tweakevent_test(C, event, action);
 
-			if((action & WM_HANDLER_BREAK) == 0) {
+			if ((action & WM_HANDLER_BREAK) == 0) {
 				ScrArea *sa;
 				ARegion *ar;
-				int doit= 0;
+				int doit = 0;
 	
 				/* Note: setting subwin active should be done here, after modal handlers have been done */
-				if(event->type==MOUSEMOVE) {
+				if (event->type == MOUSEMOVE) {
 					/* state variables in screen, cursors. Also used in wm_draw.c, fails for modal handlers though */
 					ED_screen_set_subwinactive(C, event);	
 					/* for regions having custom cursors */
 					wm_paintcursor_test(C, event);
 				}
-				else if (event->type==NDOF_MOTION) {
+				else if (event->type == NDOF_MOTION) {
 					win->addmousemove = TRUE;
 				}
 
-				for(sa= win->screen->areabase.first; sa; sa= sa->next) {
-					if(wm_event_inside_i(event, &sa->totrct)) {
+				for (sa = win->screen->areabase.first; sa; sa = sa->next) {
+					if (wm_event_inside_i(event, &sa->totrct)) {
 						CTX_wm_area_set(C, sa);
 
-						if((action & WM_HANDLER_BREAK) == 0) {
-							for(ar=sa->regionbase.first; ar; ar= ar->next) {
-								if(wm_event_inside_i(event, &ar->winrct)) {
+						if ((action & WM_HANDLER_BREAK) == 0) {
+							for (ar = sa->regionbase.first; ar; ar = ar->next) {
+								if (wm_event_inside_i(event, &ar->winrct)) {
 									CTX_wm_region_set(C, ar);
 									
 									/* call even on non mouse events, since the */
@@ -1969,19 +2045,19 @@ void wm_event_do_handlers(bContext *C)
 
 									/* does polls for drop regions and checks uibuts */
 									/* need to be here to make sure region context is true */
-									if(ELEM(event->type, MOUSEMOVE, EVT_DROP)) {
+									if (ELEM(event->type, MOUSEMOVE, EVT_DROP)) {
 										wm_drags_check_ops(C, event);
 									}
 									
 									action |= wm_handlers_do(C, event, &ar->handlers);
 
 									/* fileread case (python), [#29489] */
-									if(CTX_wm_window(C)==NULL)
+									if (CTX_wm_window(C) == NULL)
 										return;
 
 									doit |= (BLI_in_rcti(&ar->winrct, event->x, event->y));
 									
-									if(action & WM_HANDLER_BREAK)
+									if (action & WM_HANDLER_BREAK)
 										break;
 								}
 							}
@@ -1989,7 +2065,7 @@ void wm_event_do_handlers(bContext *C)
 
 						CTX_wm_region_set(C, NULL);
 
-						if((action & WM_HANDLER_BREAK) == 0) {
+						if ((action & WM_HANDLER_BREAK) == 0) {
 							wm_region_mouse_co(C, event); /* only invalidates event->mval in this case */
 							action |= wm_handlers_do(C, event, &sa->handlers);
 						}
@@ -1999,7 +2075,7 @@ void wm_event_do_handlers(bContext *C)
 					}
 				}
 				
-				if((action & WM_HANDLER_BREAK) == 0) {
+				if ((action & WM_HANDLER_BREAK) == 0) {
 					/* also some non-modal handlers need active area/region */
 					CTX_wm_area_set(C, area_event_inside(C, event->x, event->y));
 					CTX_wm_region_set(C, region_event_inside(C, event->x, event->y));
@@ -2009,15 +2085,15 @@ void wm_event_do_handlers(bContext *C)
 					action |= wm_handlers_do(C, event, &win->handlers);
 
 					/* fileread case */
-					if(CTX_wm_window(C)==NULL)
+					if (CTX_wm_window(C) == NULL)
 						return;
 				}
 
 				/* XXX hrmf, this gives reliable previous mouse coord for area change, feels bad? 
-				   doing it on ghost queue gives errors when mousemoves go over area borders */
-				if(doit && win->screen && win->screen->subwinactive != win->screen->mainwin) {
-					win->eventstate->prevx= event->x;
-					win->eventstate->prevy= event->y;
+				 * doing it on ghost queue gives errors when mousemoves go over area borders */
+				if (doit && win->screen && win->screen->subwinactive != win->screen->mainwin) {
+					win->eventstate->prevx = event->x;
+					win->eventstate->prevy = event->y;
 					//printf("win->eventstate->prev = %d %d\n", event->x, event->y);
 				}
 				else {
@@ -2036,20 +2112,23 @@ void wm_event_do_handlers(bContext *C)
 							win->eventstate->prevclickx = event->x;
 							win->eventstate->prevclicky = event->y;
 						}
-					} else {
+					}
+					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 */
+				}
+				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 */
+				}
+				else { /* reset if not */
 					win->eventstate->prevtype = -1;
 					win->eventstate->prevval = 0;
 					win->eventstate->prevclicktime = 0;
@@ -2063,14 +2142,14 @@ void wm_event_do_handlers(bContext *C)
 		}
 		
 		/* only add mousemove when queue was read entirely */
-		if(win->addmousemove && win->eventstate) {
-			wmEvent tevent= *(win->eventstate);
+		if (win->addmousemove && win->eventstate) {
+			wmEvent tevent = *(win->eventstate);
 			//printf("adding MOUSEMOVE %d %d\n", tevent.x, tevent.y);
-			tevent.type= MOUSEMOVE;
-			tevent.prevx= tevent.x;
-			tevent.prevy= tevent.y;
+			tevent.type = MOUSEMOVE;
+			tevent.prevx = tevent.x;
+			tevent.prevy = tevent.y;
 			wm_event_add(win, &tevent);
-			win->addmousemove= 0;
+			win->addmousemove = 0;
 		}
 		
 		CTX_wm_window_set(C, NULL);
@@ -2087,12 +2166,12 @@ void WM_event_fileselect_event(bContext *C, void *ophandle, int eventval)
 	/* add to all windows! */
 	wmWindow *win;
 	
-	for(win= CTX_wm_manager(C)->windows.first; win; win= win->next) {
-		wmEvent event= *win->eventstate;
+	for (win = CTX_wm_manager(C)->windows.first; win; win = win->next) {
+		wmEvent event = *win->eventstate;
 		
-		event.type= EVT_FILESELECT;
-		event.val= eventval;
-		event.customdata= ophandle;		// only as void pointer type check
+		event.type = EVT_FILESELECT;
+		event.val = eventval;
+		event.customdata = ophandle;     // only as void pointer type check
 
 		wm_event_add(win, &event);
 	}
@@ -2102,22 +2181,22 @@ void WM_event_fileselect_event(bContext *C, void *ophandle, int eventval)
 /* optional property: filetype (XXX enum?) */
 
 /* Idea is to keep a handler alive on window queue, owning the operator.
-   The filewindow can send event to make it execute, thus ensuring
-   executing happens outside of lower level queues, with UI refreshed. 
-   Should also allow multiwin solutions */
+ * The filewindow can send event to make it execute, thus ensuring
+ * executing happens outside of lower level queues, with UI refreshed.
+ * Should also allow multiwin solutions */
 
 void WM_event_add_fileselect(bContext *C, wmOperator *op)
 {
 	wmEventHandler *handler, *handlernext;
-	wmWindow *win= CTX_wm_window(C);
-	int full= 1;	// XXX preset?
+	wmWindow *win = CTX_wm_window(C);
+	int full = 1;    // XXX preset?
 
 	/* only allow 1 file selector open per window */
-	for(handler= win->modalhandlers.first; handler; handler=handlernext) {
-		handlernext= handler->next;
+	for (handler = win->modalhandlers.first; handler; handler = handlernext) {
+		handlernext = handler->next;
 		
-		if(handler->type == WM_HANDLER_FILESELECT) {
-			if(handler->op)
+		if (handler->type == WM_HANDLER_FILESELECT) {
+			if (handler->op)
 				WM_operator_free(handler->op);
 			BLI_remlink(&win->modalhandlers, handler);
 			wm_event_free_handler(handler);
@@ -2126,48 +2205,48 @@ void WM_event_add_fileselect(bContext *C, wmOperator *op)
 	
 	handler = MEM_callocN(sizeof(wmEventHandler), "fileselect handler");
 	
-	handler->type= WM_HANDLER_FILESELECT;
-	handler->op= op;
-	handler->op_area= CTX_wm_area(C);
-	handler->op_region= CTX_wm_region(C);
-	handler->filescreen= CTX_wm_screen(C);
+	handler->type = WM_HANDLER_FILESELECT;
+	handler->op = op;
+	handler->op_area = CTX_wm_area(C);
+	handler->op_region = CTX_wm_region(C);
+	handler->filescreen = CTX_wm_screen(C);
 	
 	BLI_addhead(&win->modalhandlers, handler);
 	
 	/* check props once before invoking if check is available
 	 * ensures initial properties are valid */
-	if(op->type->check) {
+	if (op->type->check) {
 		op->type->check(C, op); /* ignore return value */
 	}
 
-	WM_event_fileselect_event(C, op, full?EVT_FILESELECT_FULL_OPEN:EVT_FILESELECT_OPEN);
+	WM_event_fileselect_event(C, op, full ? EVT_FILESELECT_FULL_OPEN : EVT_FILESELECT_OPEN);
 }
 
 #if 0
 /* lets not expose struct outside wm? */
 static void WM_event_set_handler_flag(wmEventHandler *handler, int flag)
 {
-	handler->flag= flag;
+	handler->flag = flag;
 }
 #endif
 
 wmEventHandler *WM_event_add_modal_handler(bContext *C, wmOperator *op)
 {
-	wmEventHandler *handler= MEM_callocN(sizeof(wmEventHandler), "event modal handler");
-	wmWindow *win= CTX_wm_window(C);
+	wmEventHandler *handler = MEM_callocN(sizeof(wmEventHandler), "event modal handler");
+	wmWindow *win = CTX_wm_window(C);
 	
 	/* operator was part of macro */
-	if(op->opm) {
+	if (op->opm) {
 		/* give the mother macro to the handler */
-		handler->op= op->opm;
+		handler->op = op->opm;
 		/* mother macro opm becomes the macro element */
-		handler->op->opm= op;
+		handler->op->opm = op;
 	}
 	else
-		handler->op= op;
+		handler->op = op;
 	
-	handler->op_area= CTX_wm_area(C);		/* means frozen screen context for modal handlers! */
-	handler->op_region= CTX_wm_region(C);
+	handler->op_area = CTX_wm_area(C);       /* means frozen screen context for modal handlers! */
+	handler->op_region = CTX_wm_region(C);
 	
 	BLI_addhead(&win->modalhandlers, handler);
 
@@ -2178,19 +2257,19 @@ wmEventHandler *WM_event_add_keymap_handler(ListBase *handlers, wmKeyMap *keymap
 {
 	wmEventHandler *handler;
 
-	if(!keymap) {
+	if (!keymap) {
 		printf("WM_event_add_keymap_handler called with NULL keymap\n");
 		return NULL;
 	}
 
 	/* only allow same keymap once */
-	for(handler= handlers->first; handler; handler= handler->next)
-		if(handler->keymap==keymap)
+	for (handler = handlers->first; handler; handler = handler->next)
+		if (handler->keymap == keymap)
 			return handler;
 	
-	handler= MEM_callocN(sizeof(wmEventHandler), "event keymap handler");
+	handler = MEM_callocN(sizeof(wmEventHandler), "event keymap handler");
 	BLI_addtail(handlers, handler);
-	handler->keymap= keymap;
+	handler->keymap = keymap;
 
 	return handler;
 }
@@ -2202,20 +2281,20 @@ wmEventHandler *WM_event_add_keymap_handler_priority(ListBase *handlers, wmKeyMa
 	
 	WM_event_remove_keymap_handler(handlers, keymap);
 	
-	handler= MEM_callocN(sizeof(wmEventHandler), "event keymap handler");
+	handler = MEM_callocN(sizeof(wmEventHandler), "event keymap handler");
 	BLI_addhead(handlers, handler);
-	handler->keymap= keymap;
+	handler->keymap = keymap;
 	
 	return handler;
 }
 
 wmEventHandler *WM_event_add_keymap_handler_bb(ListBase *handlers, wmKeyMap *keymap, rcti *bblocal, rcti *bbwin)
 {
-	wmEventHandler *handler= WM_event_add_keymap_handler(handlers, keymap);
+	wmEventHandler *handler = WM_event_add_keymap_handler(handlers, keymap);
 	
-	if(handler) {
-		handler->bblocal= bblocal;
-		handler->bbwin= bbwin;
+	if (handler) {
+		handler->bblocal = bblocal;
+		handler->bbwin = bbwin;
 	}
 	return handler;
 }
@@ -2224,8 +2303,8 @@ void WM_event_remove_keymap_handler(ListBase *handlers, wmKeyMap *keymap)
 {
 	wmEventHandler *handler;
 	
-	for(handler= handlers->first; handler; handler= handler->next) {
-		if(handler->keymap==keymap) {
+	for (handler = handlers->first; handler; handler = handler->next) {
+		if (handler->keymap == keymap) {
 			BLI_remlink(handlers, handler);
 			wm_event_free_handler(handler);
 			break;
@@ -2233,30 +2312,32 @@ void WM_event_remove_keymap_handler(ListBase *handlers, wmKeyMap *keymap)
 	}
 }
 
-wmEventHandler *WM_event_add_ui_handler(const bContext *C, ListBase *handlers, wmUIHandlerFunc func, wmUIHandlerRemoveFunc remove, void *userdata)
+wmEventHandler *WM_event_add_ui_handler(const bContext *C, ListBase *handlers,
+                                        wmUIHandlerFunc func, wmUIHandlerRemoveFunc remove, void *userdata)
 {
-	wmEventHandler *handler= MEM_callocN(sizeof(wmEventHandler), "event ui handler");
-	handler->ui_handle= func;
-	handler->ui_remove= remove;
-	handler->ui_userdata= userdata;
-	handler->ui_area= (C)? CTX_wm_area(C): NULL;
-	handler->ui_region= (C)? CTX_wm_region(C): NULL;
-	handler->ui_menu= (C)? CTX_wm_menu(C): NULL;
+	wmEventHandler *handler = MEM_callocN(sizeof(wmEventHandler), "event ui handler");
+	handler->ui_handle = func;
+	handler->ui_remove = remove;
+	handler->ui_userdata = userdata;
+	handler->ui_area = (C) ? CTX_wm_area(C) : NULL;
+	handler->ui_region = (C) ? CTX_wm_region(C) : NULL;
+	handler->ui_menu = (C) ? CTX_wm_menu(C) : NULL;
 	
 	BLI_addhead(handlers, handler);
 	
 	return handler;
 }
 
-/* set "postpone" for win->modalhandlers, this is in a running for() loop in wm_handlers_do() */
-void WM_event_remove_ui_handler(ListBase *handlers, wmUIHandlerFunc func, wmUIHandlerRemoveFunc remove, void *userdata, int postpone)
+/* set "postpone" for win->modalhandlers, this is in a running for () loop in wm_handlers_do() */
+void WM_event_remove_ui_handler(ListBase *handlers,
+                                wmUIHandlerFunc func, wmUIHandlerRemoveFunc remove, void *userdata, int postpone)
 {
 	wmEventHandler *handler;
 	
-	for(handler= handlers->first; handler; handler= handler->next) {
-		if(handler->ui_handle == func && handler->ui_remove == remove && handler->ui_userdata == userdata) {
+	for (handler = handlers->first; handler; handler = handler->next) {
+		if (handler->ui_handle == func && handler->ui_remove == remove && handler->ui_userdata == userdata) {
 			/* handlers will be freed in wm_handlers_do() */
-			if(postpone) {
+			if (postpone) {
 				handler->flag |= WM_HANDLER_DO_FREE;
 			}
 			else {
@@ -2273,14 +2354,14 @@ wmEventHandler *WM_event_add_dropbox_handler(ListBase *handlers, ListBase *dropb
 	wmEventHandler *handler;
 
 	/* only allow same dropbox once */
-	for(handler= handlers->first; handler; handler= handler->next)
-		if(handler->dropboxes==dropboxes)
+	for (handler = handlers->first; handler; handler = handler->next)
+		if (handler->dropboxes == dropboxes)
 			return handler;
 	
-	handler= MEM_callocN(sizeof(wmEventHandler), "dropbox handler");
+	handler = MEM_callocN(sizeof(wmEventHandler), "dropbox handler");
 	
 	/* dropbox stored static, no free or copy */
-	handler->dropboxes= dropboxes;
+	handler->dropboxes = dropboxes;
 	BLI_addhead(handlers, handler);
 	
 	return handler;
@@ -2291,7 +2372,7 @@ void WM_event_remove_area_handler(ListBase *handlers, void *area)
 {
 	wmEventHandler *handler, *nexthandler;
 
-	for(handler = handlers->first; handler; handler= nexthandler) {
+	for (handler = handlers->first; handler; handler = nexthandler) {
 		nexthandler = handler->next;
 		if (handler->type != WM_HANDLER_FILESELECT) {
 			if (handler->ui_area == area) {
@@ -2312,16 +2393,16 @@ static void WM_event_remove_handler(ListBase *handlers, wmEventHandler *handler)
 
 void WM_event_add_mousemove(bContext *C)
 {
-	wmWindow *window= CTX_wm_window(C);
+	wmWindow *window = CTX_wm_window(C);
 	
-	window->addmousemove= 1;
+	window->addmousemove = 1;
 }
 
 /* for modal callbacks, check configuration for how to interpret exit with tweaks  */
 int WM_modal_tweak_exit(wmEvent *evt, int tweak_event)
 {
 	/* if the release-confirm userpref setting is enabled, 
-	 * tweak events can be cancelled when mouse is released
+	 * tweak events can be canceled when mouse is released
 	 */
 	if (U.flag & USER_RELEASECONFIRM) {
 		/* option on, so can exit with km-release */
@@ -2336,7 +2417,7 @@ int WM_modal_tweak_exit(wmEvent *evt, int tweak_event)
 		else {
 			/* if the initial event wasn't a tweak event then
 			 * ignore USER_RELEASECONFIRM setting: see [#26756] */
-			if(ELEM3(tweak_event, EVT_TWEAK_L, EVT_TWEAK_M, EVT_TWEAK_R) == 0) {
+			if (ELEM3(tweak_event, EVT_TWEAK_L, EVT_TWEAK_M, EVT_TWEAK_R) == 0) {
 				return 1;
 			}
 		}
@@ -2357,81 +2438,85 @@ int WM_modal_tweak_exit(wmEvent *evt, int tweak_event)
 
 static int convert_key(GHOST_TKey key) 
 {
-	if (key>=GHOST_kKeyA && key<=GHOST_kKeyZ) {
+	if (key >= GHOST_kKeyA && key <= GHOST_kKeyZ) {
 		return (AKEY + ((int) key - GHOST_kKeyA));
-	} else if (key>=GHOST_kKey0 && key<=GHOST_kKey9) {
+	}
+	else if (key >= GHOST_kKey0 && key <= GHOST_kKey9) {
 		return (ZEROKEY + ((int) key - GHOST_kKey0));
-	} else if (key>=GHOST_kKeyNumpad0 && key<=GHOST_kKeyNumpad9) {
+	}
+	else if (key >= GHOST_kKeyNumpad0 && key <= GHOST_kKeyNumpad9) {
 		return (PAD0 + ((int) key - GHOST_kKeyNumpad0));
-	} else if (key>=GHOST_kKeyF1 && key<=GHOST_kKeyF19) {
+	}
+	else if (key >= GHOST_kKeyF1 && key <= GHOST_kKeyF19) {
 		return (F1KEY + ((int) key - GHOST_kKeyF1));
-	} else {
+	}
+	else {
 		switch (key) {
-			case GHOST_kKeyBackSpace:		return BACKSPACEKEY;
-			case GHOST_kKeyTab:				return TABKEY;
-			case GHOST_kKeyLinefeed:		return LINEFEEDKEY;
-			case GHOST_kKeyClear:			return 0;
-			case GHOST_kKeyEnter:			return RETKEY;
-				
-			case GHOST_kKeyEsc:				return ESCKEY;
-			case GHOST_kKeySpace:			return SPACEKEY;
-			case GHOST_kKeyQuote:			return QUOTEKEY;
-			case GHOST_kKeyComma:			return COMMAKEY;
-			case GHOST_kKeyMinus:			return MINUSKEY;
-			case GHOST_kKeyPeriod:			return PERIODKEY;
-			case GHOST_kKeySlash:			return SLASHKEY;
-				
-			case GHOST_kKeySemicolon:		return SEMICOLONKEY;
-			case GHOST_kKeyEqual:			return EQUALKEY;
-				
-			case GHOST_kKeyLeftBracket:		return LEFTBRACKETKEY;
-			case GHOST_kKeyRightBracket:	return RIGHTBRACKETKEY;
-			case GHOST_kKeyBackslash:		return BACKSLASHKEY;
-			case GHOST_kKeyAccentGrave:		return ACCENTGRAVEKEY;
-				
-			case GHOST_kKeyLeftShift:		return LEFTSHIFTKEY;
-			case GHOST_kKeyRightShift:		return RIGHTSHIFTKEY;
-			case GHOST_kKeyLeftControl:		return LEFTCTRLKEY;
-			case GHOST_kKeyRightControl:	return RIGHTCTRLKEY;
-			case GHOST_kKeyOS:				return OSKEY;
-			case GHOST_kKeyLeftAlt:			return LEFTALTKEY;
-			case GHOST_kKeyRightAlt:		return RIGHTALTKEY;
-				
-			case GHOST_kKeyCapsLock:		return CAPSLOCKKEY;
-			case GHOST_kKeyNumLock:			return 0;
-			case GHOST_kKeyScrollLock:		return 0;
-				
-			case GHOST_kKeyLeftArrow:		return LEFTARROWKEY;
-			case GHOST_kKeyRightArrow:		return RIGHTARROWKEY;
-			case GHOST_kKeyUpArrow:			return UPARROWKEY;
-			case GHOST_kKeyDownArrow:		return DOWNARROWKEY;
-				
-			case GHOST_kKeyPrintScreen:		return 0;
-			case GHOST_kKeyPause:			return PAUSEKEY;
-				
-			case GHOST_kKeyInsert:			return INSERTKEY;
-			case GHOST_kKeyDelete:			return DELKEY;
-			case GHOST_kKeyHome:			return HOMEKEY;
-			case GHOST_kKeyEnd:				return ENDKEY;
-			case GHOST_kKeyUpPage:			return PAGEUPKEY;
-			case GHOST_kKeyDownPage:		return PAGEDOWNKEY;
-				
-			case GHOST_kKeyNumpadPeriod:	return PADPERIOD;
-			case GHOST_kKeyNumpadEnter:		return PADENTER;
-			case GHOST_kKeyNumpadPlus:		return PADPLUSKEY;
-			case GHOST_kKeyNumpadMinus:		return PADMINUS;
-			case GHOST_kKeyNumpadAsterisk:	return PADASTERKEY;
-			case GHOST_kKeyNumpadSlash:		return PADSLASHKEY;
-				
-			case GHOST_kKeyGrLess:		    return GRLESSKEY; 
-			
-			case GHOST_kKeyMediaPlay:		return MEDIAPLAY;
-			case GHOST_kKeyMediaStop:		return MEDIASTOP;
-			case GHOST_kKeyMediaFirst:		return MEDIAFIRST;
-			case GHOST_kKeyMediaLast:		return MEDIALAST;
+			case GHOST_kKeyBackSpace:       return BACKSPACEKEY;
+			case GHOST_kKeyTab:             return TABKEY;
+			case GHOST_kKeyLinefeed:        return LINEFEEDKEY;
+			case GHOST_kKeyClear:           return 0;
+			case GHOST_kKeyEnter:           return RETKEY;
+
+			case GHOST_kKeyEsc:             return ESCKEY;
+			case GHOST_kKeySpace:           return SPACEKEY;
+			case GHOST_kKeyQuote:           return QUOTEKEY;
+			case GHOST_kKeyComma:           return COMMAKEY;
+			case GHOST_kKeyMinus:           return MINUSKEY;
+			case GHOST_kKeyPeriod:          return PERIODKEY;
+			case GHOST_kKeySlash:           return SLASHKEY;
+
+			case GHOST_kKeySemicolon:       return SEMICOLONKEY;
+			case GHOST_kKeyEqual:           return EQUALKEY;
+
+			case GHOST_kKeyLeftBracket:     return LEFTBRACKETKEY;
+			case GHOST_kKeyRightBracket:    return RIGHTBRACKETKEY;
+			case GHOST_kKeyBackslash:       return BACKSLASHKEY;
+			case GHOST_kKeyAccentGrave:     return ACCENTGRAVEKEY;
+
+			case GHOST_kKeyLeftShift:       return LEFTSHIFTKEY;
+			case GHOST_kKeyRightShift:      return RIGHTSHIFTKEY;
+			case GHOST_kKeyLeftControl:     return LEFTCTRLKEY;
+			case GHOST_kKeyRightControl:    return RIGHTCTRLKEY;
+			case GHOST_kKeyOS:              return OSKEY;
+			case GHOST_kKeyLeftAlt:         return LEFTALTKEY;
+			case GHOST_kKeyRightAlt:        return RIGHTALTKEY;
+
+			case GHOST_kKeyCapsLock:        return CAPSLOCKKEY;
+			case GHOST_kKeyNumLock:         return 0;
+			case GHOST_kKeyScrollLock:      return 0;
+
+			case GHOST_kKeyLeftArrow:       return LEFTARROWKEY;
+			case GHOST_kKeyRightArrow:      return RIGHTARROWKEY;
+			case GHOST_kKeyUpArrow:         return UPARROWKEY;
+			case GHOST_kKeyDownArrow:       return DOWNARROWKEY;
+
+			case GHOST_kKeyPrintScreen:     return 0;
+			case GHOST_kKeyPause:           return PAUSEKEY;
+
+			case GHOST_kKeyInsert:          return INSERTKEY;
+			case GHOST_kKeyDelete:          return DELKEY;
+			case GHOST_kKeyHome:            return HOMEKEY;
+			case GHOST_kKeyEnd:             return ENDKEY;
+			case GHOST_kKeyUpPage:          return PAGEUPKEY;
+			case GHOST_kKeyDownPage:        return PAGEDOWNKEY;
+
+			case GHOST_kKeyNumpadPeriod:    return PADPERIOD;
+			case GHOST_kKeyNumpadEnter:     return PADENTER;
+			case GHOST_kKeyNumpadPlus:      return PADPLUSKEY;
+			case GHOST_kKeyNumpadMinus:     return PADMINUS;
+			case GHOST_kKeyNumpadAsterisk:  return PADASTERKEY;
+			case GHOST_kKeyNumpadSlash:     return PADSLASHKEY;
+
+			case GHOST_kKeyGrLess:          return GRLESSKEY;
+
+			case GHOST_kKeyMediaPlay:       return MEDIAPLAY;
+			case GHOST_kKeyMediaStop:       return MEDIASTOP;
+			case GHOST_kKeyMediaFirst:      return MEDIAFIRST;
+			case GHOST_kKeyMediaLast:       return MEDIALAST;
 			
 			default:
-				return UNKNOWNKEY;	/* GHOST_kKeyUnknown */
+				return UNKNOWNKEY;  /* GHOST_kKeyUnknown */
 		}
 	}
 }
@@ -2439,27 +2524,27 @@ static int convert_key(GHOST_TKey key)
 /* adds customdata to event */
 static void update_tablet_data(wmWindow *win, wmEvent *event)
 {
-	const GHOST_TabletData *td= GHOST_GetTabletData(win->ghostwin);
+	const GHOST_TabletData *td = GHOST_GetTabletData(win->ghostwin);
 	
 	/* if there's tablet data from an active tablet device then add it */
 	if ((td != NULL) && td->Active != GHOST_kTabletModeNone) {
-		struct wmTabletData *wmtab= MEM_mallocN(sizeof(wmTabletData), "customdata tablet");
+		struct wmTabletData *wmtab = MEM_mallocN(sizeof(wmTabletData), "customdata tablet");
 		
 		wmtab->Active = (int)td->Active;
 		wmtab->Pressure = td->Pressure;
 		wmtab->Xtilt = td->Xtilt;
 		wmtab->Ytilt = td->Ytilt;
 		
-		event->custom= EVT_DATA_TABLET;
-		event->customdata= wmtab;
-		event->customdatafree= 1;
+		event->custom = EVT_DATA_TABLET;
+		event->customdata = wmtab;
+		event->customdatafree = 1;
 	} 
 }
 
 /* adds customdata to event */
-static void attach_ndof_data(wmEvent* event, const GHOST_TEventNDOFMotionData* ghost)
+static void attach_ndof_data(wmEvent *event, const GHOST_TEventNDOFMotionData *ghost)
 {
-	wmNDOFMotionData* data = MEM_mallocN(sizeof(wmNDOFMotionData), "customdata NDOF");
+	wmNDOFMotionData *data = MEM_mallocN(sizeof(wmNDOFMotionData), "customdata NDOF");
 
 	const float s = U.ndof_sensitivity;
 
@@ -2469,8 +2554,7 @@ static void attach_ndof_data(wmEvent* event, const GHOST_TEventNDOFMotionData* g
 	data->ry = s * ghost->ry;
 	data->rz = s * ghost->rz;
 
-	if (U.ndof_flag & NDOF_ZOOM_UPDOWN)
-		{
+	if (U.ndof_flag & NDOF_ZOOM_UPDOWN) {
 		/* rotate so Y is where Z was */
 		data->ty = s * ghost->tz;
 		data->tz = s * ghost->ty;
@@ -2484,12 +2568,11 @@ static void attach_ndof_data(wmEvent* event, const GHOST_TEventNDOFMotionData* g
 		data->ry = s * ghost->rz;
 		data->rz = s * ghost->ry;
 #endif
-		}
-	else
-		{
+	}
+	else {
 		data->ty = s * ghost->ty;
 		data->tz = s * ghost->tz;
-		}
+	}
 
 	data->dt = ghost->dt;
 
@@ -2503,20 +2586,20 @@ static void attach_ndof_data(wmEvent* event, const GHOST_TEventNDOFMotionData* g
 /* imperfect but probably usable... draw/enable drags to other windows */
 static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *win, wmEvent *evt)
 {
-	int mx= evt->x, my= evt->y;
+	int mx = evt->x, my = evt->y;
 	
-	if(wm->windows.first== wm->windows.last)
+	if (wm->windows.first == wm->windows.last)
 		return NULL;
 	
 	/* top window bar... */
-	if(mx<0 || my<0 || mx>win->sizex || my>win->sizey+30) {	
+	if (mx < 0 || my < 0 || mx > win->sizex || my > win->sizey + 30) {
 		wmWindow *owin;
 		wmEventHandler *handler;
 		
 		/* let's skip windows having modal handlers now */
 		/* potential XXX ugly... I wouldn't have added a modalhandlers list (introduced in rev 23331, ton) */
-		for(handler= win->modalhandlers.first; handler; handler= handler->next)
-			if(handler->ui_handle || handler->op)
+		for (handler = win->modalhandlers.first; handler; handler = handler->next)
+			if (handler->ui_handle || handler->op)
 				return NULL;
 		
 		/* to desktop space */
@@ -2524,13 +2607,13 @@ static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *wi
 		my += (int)win->posy;
 		
 		/* check other windows to see if it has mouse inside */
-		for(owin= wm->windows.first; owin; owin= owin->next) {
+		for (owin = wm->windows.first; owin; owin = owin->next) {
 			
-			if(owin!=win) {
-				if(mx-owin->posx >= 0 && my-owin->posy >= 0 &&
-				   mx-owin->posx <= owin->sizex && my-owin->posy <= owin->sizey) {
-					evt->x= mx - (int)owin->posx;
-					evt->y= my - (int)owin->posy;
+			if (owin != win) {
+				if (mx - owin->posx >= 0 && my - owin->posy >= 0 &&
+				    mx - owin->posx <= owin->sizex && my - owin->posy <= owin->sizey) {
+					evt->x = mx - (int)owin->posx;
+					evt->y = my - (int)owin->posy;
 					
 					return owin;
 				}
@@ -2545,32 +2628,32 @@ static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *wi
 void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int UNUSED(time), void *customdata)
 {
 	wmWindow *owin;
-	wmEvent event, *evt= win->eventstate;
+	wmEvent event, *evt = win->eventstate;
 
 	/* initialize and copy state (only mouse x y and modifiers) */
-	event= *evt;
+	event = *evt;
 	
 	switch (type) {
 		/* mouse move */
 		case GHOST_kEventCursorMove: {
-			if(win->active) {
-				GHOST_TEventCursorData *cd= customdata;
-				wmEvent *lastevent= win->queue.last;
+			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;
+				evt->x = cx;
+				evt->y = (win->sizey - 1) - cy;
 				
-				event.x= evt->x;
-				event.y= evt->y;
+				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)
+				 * 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);
@@ -2580,13 +2663,13 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
 				
 				/* 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);
+				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;
+					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);
@@ -2596,7 +2679,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
 			break;
 		}
 		case GHOST_kEventTrackpad: {
-			GHOST_TEventTrackpadData * pd = customdata;
+			GHOST_TEventTrackpadData *pd = customdata;
 			switch (pd->subtype) {
 				case GHOST_kTrackpadEventMagnify:
 					event.type = MOUSEZOOM;
@@ -2606,20 +2689,20 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
 					break;
 				case GHOST_kTrackpadEventScroll:
 				default:
-					event.type= MOUSEPAN;
+					event.type = MOUSEPAN;
 					break;
 			}
 
 			{
 				int cx, cy;
 				GHOST_ScreenToClient(win->ghostwin, pd->x, pd->y, &cx, &cy);
-				event.x= evt->x= cx;
-				event.y= evt->y= (win->sizey-1) - cy;
+				event.x = evt->x = cx;
+				event.y = evt->y = (win->sizey - 1) - cy;
 			}
 
 			// Use prevx/prevy so we can calculate the delta later
-			event.prevx= event.x - pd->deltaX;
-			event.prevy= event.y - (-pd->deltaY);
+			event.prevx = event.x - pd->deltaX;
+			event.prevy = event.y - (-pd->deltaY);
 			
 			update_tablet_data(win, &event);
 			wm_event_add(win, &event);
@@ -2628,39 +2711,41 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
 		/* mouse button */
 		case GHOST_kEventButtonDown:
 		case GHOST_kEventButtonUp: {
-			GHOST_TEventButtonData *bd= customdata;
-			event.val= (type==GHOST_kEventButtonDown) ? KM_PRESS:KM_RELEASE; /* Note!, this starts as 0/1 but later is converted to KM_PRESS/KM_RELEASE by tweak */
+			GHOST_TEventButtonData *bd = customdata;
+
+			/* Note!, this starts as 0/1 but later is converted to KM_PRESS/KM_RELEASE by tweak */
+			event.val = (type == GHOST_kEventButtonDown) ? KM_PRESS : KM_RELEASE;
 			
 			if (bd->button == GHOST_kButtonMaskLeft)
-				event.type= LEFTMOUSE;
+				event.type = LEFTMOUSE;
 			else if (bd->button == GHOST_kButtonMaskRight)
-				event.type= RIGHTMOUSE;
+				event.type = RIGHTMOUSE;
 			else if (bd->button == GHOST_kButtonMaskButton4)
-				event.type= BUTTON4MOUSE;
+				event.type = BUTTON4MOUSE;
 			else if (bd->button == GHOST_kButtonMaskButton5)
-				event.type= BUTTON5MOUSE;
+				event.type = BUTTON5MOUSE;
 			else
-				event.type= MIDDLEMOUSE;
+				event.type = MIDDLEMOUSE;
 			
-			if(win->active==0) {
+			if (win->active == 0) {
 				int cx, cy;
 				
 				/* entering window, update mouse pos. (ghost sends win-activate *after* the mouseclick in window!) */
 				wm_get_cursor_position(win, &cx, &cy);
 
-				event.x= evt->x= cx;
-				event.y= evt->y= cy;
+				event.x = evt->x = cx;
+				event.y = evt->y = cy;
 			}
 			
 			/* add to other window if event is there (not to both!) */
-			owin= wm_event_cursor_other_windows(wm, win, &event);
-			if(owin) {
-				wmEvent oevent= *(owin->eventstate);
+			owin = wm_event_cursor_other_windows(wm, win, &event);
+			if (owin) {
+				wmEvent oevent = *(owin->eventstate);
 				
-				oevent.x= event.x;
-				oevent.y= event.y;
-				oevent.type= event.type;
-				oevent.val= event.val;
+				oevent.x = event.x;
+				oevent.y = event.y;
+				oevent.type = event.type;
+				oevent.val = event.val;
 				
 				update_tablet_data(owin, &oevent);
 				wm_event_add(owin, &oevent);
@@ -2675,97 +2760,106 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
 		/* keyboard */
 		case GHOST_kEventKeyDown:
 		case GHOST_kEventKeyUp: {
-			GHOST_TEventKeyData *kd= customdata;
-			event.type= convert_key(kd->key);
-			event.ascii= kd->ascii;
-			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;
+			GHOST_TEventKeyData *kd = customdata;
+			event.type = convert_key(kd->key);
+			event.ascii = kd->ascii;
+			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;
 			
 			/* exclude arrow keys, esc, etc from text input */
-			if(type==GHOST_kEventKeyUp) {
-				event.ascii= '\0';
+			if (type == GHOST_kEventKeyUp) {
+				event.ascii = '\0';
 
 				/* ghost should do this already for key up */
 				if (event.utf8_buf[0]) {
 					printf("%s: ghost on your platform is misbehaving, utf8 events on key up!\n", __func__);
 				}
-				event.utf8_buf[0]= '\0';
+				event.utf8_buf[0] = '\0';
 			}
 			else {
-				if (event.ascii<32 && event.ascii > 0)
-					event.ascii= '\0';
-				if (event.utf8_buf[0]<32 && event.utf8_buf[0] > 0)
-					event.utf8_buf[0]= '\0';
+				if (event.ascii < 32 && event.ascii > 0)
+					event.ascii = '\0';
+				if (event.utf8_buf[0] < 32 && event.utf8_buf[0] > 0)
+					event.utf8_buf[0] = '\0';
 			}
 
 			if (event.utf8_buf[0]) {
 				if (BLI_str_utf8_size(event.utf8_buf) == -1) {
-					printf("%s: ghost detected an invalid unicode character '%d'!\n", __func__, (int)(unsigned char)event.utf8_buf[0]);
-					event.utf8_buf[0]= '\0';
+					printf("%s: ghost detected an invalid unicode character '%d'!\n",
+					       __func__, (int)(unsigned char)event.utf8_buf[0]);
+					event.utf8_buf[0] = '\0';
 				}
 			}
 
 			/* modifiers */
 			/* 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;
-				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;
-				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;
-				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;
-				break;
-			default:
-				if(event.val==KM_PRESS && event.keymodifier==0)
-					evt->keymodifier= event.type; /* only set in eventstate, for next event */
-				else if(event.val==KM_RELEASE && event.keymodifier==event.type)
-					event.keymodifier= evt->keymodifier= 0;
-				break;
+			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;
+					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;
+					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;
+					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;
+					break;
+				default:
+					if (event.val == KM_PRESS && event.keymodifier == 0)
+						evt->keymodifier = event.type;  /* only set in eventstate, for next event */
+					else if (event.val == KM_RELEASE && event.keymodifier == event.type)
+						event.keymodifier = evt->keymodifier = 0;
+					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 */
-			if(event.keymodifier == event.type)
-				event.keymodifier= 0;
+			 * 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 */
+			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;
+			 * 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)
-				G.afbreek= 1;
+			if (event.type == ESCKEY)
+				G.afbreek = 1;
 			
 			wm_event_add(win, &event);
 			
 			break;
 		}
 			
-		case GHOST_kEventWheel:	{
-			GHOST_TEventWheelData* wheelData = customdata;
+		case GHOST_kEventWheel: {
+			GHOST_TEventWheelData *wheelData = customdata;
 			
 			if (wheelData->z > 0)
-				event.type= WHEELUPMOUSE;
+				event.type = WHEELUPMOUSE;
 			else
-				event.type= WHEELDOWNMOUSE;
+				event.type = WHEELDOWNMOUSE;
 			
-			event.val= KM_PRESS;
+			event.val = KM_PRESS;
 			wm_event_add(win, &event);
 			
 			break;
 		}
 		case GHOST_kEventTimer: {
-			event.type= TIMER;
-			event.custom= EVT_DATA_TIMER;
-			event.customdata= customdata;
+			event.type = TIMER;
+			event.custom = EVT_DATA_TIMER;
+			event.customdata = customdata;
 			wm_event_add(win, &event);
 
 			break;
@@ -2782,7 +2876,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
 		}
 
 		case GHOST_kEventNDOFButton: {
-			GHOST_TEventNDOFButtonData* e = customdata;
+			GHOST_TEventNDOFButtonData *e = customdata;
 
 			event.type = NDOF_BUTTON_NONE + e->button;
 
@@ -2793,7 +2887,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
 				case GHOST_kRelease:
 					event.val = KM_RELEASE;
 					break;
-				}
+			}
 
 			event.custom = 0;
 			event.customdata = NULL;
@@ -2808,7 +2902,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
 			break;
 
 		case GHOST_kEventWindowDeactivate: {
-			event.type= WINDEACTIVATE;
+			event.type = WINDEACTIVATE;
 			wm_event_add(win, &event);
 
 			break;
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index a4c9088..e50fbaa 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -28,9 +28,9 @@
  */
 
 
-	/* placed up here because of crappy
-	 * winsock stuff.
-	 */
+/* placed up here because of crappy
+ * winsock stuff.
+ */
 #include <stddef.h>
 #include <string.h>
 #include <errno.h>
@@ -38,15 +38,16 @@
 #include "zlib.h" /* wm_read_exotic() */
 
 #ifdef WIN32
-#include <windows.h> /* need to include windows.h so _WIN32_IE is defined  */
-#ifndef _WIN32_IE
-#define _WIN32_IE 0x0400 /* minimal requirements for SHGetSpecialFolderPath on MINGW MSVC has this defined already */
-#endif
-#include <shlobj.h> /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff because 'near' is disabled through BLI_windstuff */
-#include <process.h> /* getpid */
-#include "BLI_winstuff.h"
+#  include <windows.h> /* need to include windows.h so _WIN32_IE is defined  */
+#  ifndef _WIN32_IE
+#    define _WIN32_IE 0x0400 /* minimal requirements for SHGetSpecialFolderPath on MINGW MSVC has this defined already */
+#  endif
+#  include <shlobj.h>  /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff
+                        * because 'near' is disabled through BLI_windstuff */
+#  include <process.h> /* getpid */
+#  include "BLI_winstuff.h"
 #else
-#include <unistd.h> /* getpid */
+#  include <unistd.h> /* getpid */
 #endif
 
 #include "MEM_guardedalloc.h"
@@ -79,6 +80,7 @@
 #include "BKE_packedFile.h"
 #include "BKE_report.h"
 #include "BKE_sound.h"
+#include "BKE_screen.h"
 #include "BKE_texture.h"
 
 
@@ -120,31 +122,31 @@
 
 static void write_history(void);
 
-/* To be able to read files without windows closing, opening, moving 
-   we try to prepare for worst case:
-   - active window gets active screen from file 
-   - restoring the screens from non-active windows 
-   Best case is all screens match, in that case they get assigned to proper window  
-*/
+/* To be able to read files without windows closing, opening, moving
+ * we try to prepare for worst case:
+ * - active window gets active screen from file
+ * - restoring the screens from non-active windows
+ * Best case is all screens match, in that case they get assigned to proper window
+ */
 static void wm_window_match_init(bContext *C, ListBase *wmlist)
 {
 	wmWindowManager *wm;
 	wmWindow *win, *active_win;
 	
-	*wmlist= G.main->wm;
-	G.main->wm.first= G.main->wm.last= NULL;
+	*wmlist = G.main->wm;
+	G.main->wm.first = G.main->wm.last = NULL;
 	
 	active_win = CTX_wm_window(C);
 
 	/* first wrap up running stuff */
 	/* code copied from wm_init_exit.c */
-	for(wm= wmlist->first; wm; wm= wm->id.next) {
+	for (wm = wmlist->first; wm; wm = wm->id.next) {
 		
 		WM_jobs_stop_all(wm);
 		
-		for(win= wm->windows.first; win; win= win->next) {
+		for (win = wm->windows.first; win; win = win->next) {
 		
-			CTX_wm_window_set(C, win);	/* needed by operator close callbacks */
+			CTX_wm_window_set(C, win);  /* needed by operator close callbacks */
 			WM_event_remove_handlers(C, &win->handlers);
 			WM_event_remove_handlers(C, &win->modalhandlers);
 			ED_screen_exit(C, win, win->screen);
@@ -158,13 +160,13 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist)
 
 	/* just had return; here from r12991, this code could just get removed?*/
 #if 0
-	if(wm==NULL) return;
-	if(G.fileflags & G_FILE_NO_UI) return;
+	if (wm == NULL) return;
+	if (G.fileflags & G_FILE_NO_UI) return;
 	
 	/* we take apart the used screens from non-active window */
-	for(win= wm->windows.first; win; win= win->next) {
+	for (win = wm->windows.first; win; win = win->next) {
 		BLI_strncpy(win->screenname, win->screen->id.name, MAX_ID_NAME);
-		if(win!=wm->winactive) {
+		if (win != wm->winactive) {
 			BLI_remlink(&G.main->screen, win->screen);
 			//BLI_addtail(screenbase, win->screen);
 		}
@@ -173,11 +175,11 @@ static void wm_window_match_init(bContext *C, ListBase *wmlist)
 }
 
 /* match old WM with new, 4 cases:
-  1- no current wm, no read wm: make new default
-  2- no current wm, but read wm: that's OK, do nothing
-  3- current wm, but not in file: try match screen names
-  4- current wm, and wm in file: try match ghostwin 
-*/
+ * 1- no current wm, no read wm: make new default
+ * 2- no current wm, but read wm: that's OK, do nothing
+ * 3- current wm, but not in file: try match screen names
+ * 4- current wm, and wm in file: try match ghostwin
+ */
 
 static void wm_window_match_do(bContext *C, ListBase *oldwmlist)
 {
@@ -185,8 +187,8 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist)
 	wmWindow *oldwin, *win;
 	
 	/* cases 1 and 2 */
-	if(oldwmlist->first==NULL) {
-		if(G.main->wm.first); /* nothing todo */
+	if (oldwmlist->first == NULL) {
+		if (G.main->wm.first) ;  /* nothing todo */
 		else
 			wm_add_default(C);
 	}
@@ -194,29 +196,29 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist)
 		/* cases 3 and 4 */
 		
 		/* we've read file without wm..., keep current one entirely alive */
-		if(G.main->wm.first==NULL) {
-			bScreen *screen= NULL;
+		if (G.main->wm.first == NULL) {
+			bScreen *screen = NULL;
 
 			/* when loading without UI, no matching needed */
-			if(!(G.fileflags & G_FILE_NO_UI) && (screen= CTX_wm_screen(C))) {
+			if (!(G.fileflags & G_FILE_NO_UI) && (screen = CTX_wm_screen(C))) {
 
 				/* match oldwm to new dbase, only old files */
-				for(wm= oldwmlist->first; wm; wm= wm->id.next) {
+				for (wm = oldwmlist->first; wm; wm = wm->id.next) {
 					
-					for(win= wm->windows.first; win; win= win->next) {
+					for (win = wm->windows.first; win; win = win->next) {
 						/* all windows get active screen from file */
-						if(screen->winid==0)
-							win->screen= screen;
+						if (screen->winid == 0)
+							win->screen = screen;
 						else 
-							win->screen= ED_screen_duplicate(win, screen);
+							win->screen = ED_screen_duplicate(win, screen);
 						
-						BLI_strncpy(win->screenname, win->screen->id.name+2, sizeof(win->screenname));
-						win->screen->winid= win->winid;
+						BLI_strncpy(win->screenname, win->screen->id.name + 2, sizeof(win->screenname));
+						win->screen->winid = win->winid;
 					}
 				}
 			}
 			
-			G.main->wm= *oldwmlist;
+			G.main->wm = *oldwmlist;
 			
 			/* screens were read from file! */
 			ED_screens_initialize(G.main->wm.first);
@@ -224,47 +226,47 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist)
 		else {
 			/* what if old was 3, and loaded 1? */
 			/* this code could move to setup_appdata */
-			oldwm= oldwmlist->first;
-			wm= G.main->wm.first;
+			oldwm = oldwmlist->first;
+			wm = G.main->wm.first;
 
 			/* preserve key configurations in new wm, to preserve their keymaps */
-			wm->keyconfigs= oldwm->keyconfigs;
-			wm->addonconf= oldwm->addonconf;
-			wm->defaultconf= oldwm->defaultconf;
-			wm->userconf= oldwm->userconf;
+			wm->keyconfigs = oldwm->keyconfigs;
+			wm->addonconf = oldwm->addonconf;
+			wm->defaultconf = oldwm->defaultconf;
+			wm->userconf = oldwm->userconf;
 
-			oldwm->keyconfigs.first= oldwm->keyconfigs.last= NULL;
-			oldwm->addonconf= NULL;
-			oldwm->defaultconf= NULL;
-			oldwm->userconf= NULL;
+			oldwm->keyconfigs.first = oldwm->keyconfigs.last = NULL;
+			oldwm->addonconf = NULL;
+			oldwm->defaultconf = NULL;
+			oldwm->userconf = NULL;
 
 			/* ensure making new keymaps and set space types */
-			wm->initialized= 0;
-			wm->winactive= NULL;
+			wm->initialized = 0;
+			wm->winactive = NULL;
 			
 			/* only first wm in list has ghostwins */
-			for(win= wm->windows.first; win; win= win->next) {
-				for(oldwin= oldwm->windows.first; oldwin; oldwin= oldwin->next) {
+			for (win = wm->windows.first; win; win = win->next) {
+				for (oldwin = oldwm->windows.first; oldwin; oldwin = oldwin->next) {
 					
-					if(oldwin->winid == win->winid ) {
-						win->ghostwin= oldwin->ghostwin;
-						win->active= oldwin->active;
-						if(win->active)
-							wm->winactive= win;
+					if (oldwin->winid == win->winid) {
+						win->ghostwin = oldwin->ghostwin;
+						win->active = oldwin->active;
+						if (win->active)
+							wm->winactive = win;
 
-						if(!G.background) /* file loading in background mode still calls this */
-							GHOST_SetWindowUserData(win->ghostwin, win);	/* pointer back */
+						if (!G.background) /* file loading in background mode still calls this */
+							GHOST_SetWindowUserData(win->ghostwin, win);    /* pointer back */
 
-						oldwin->ghostwin= NULL;
+						oldwin->ghostwin = NULL;
 						
-						win->eventstate= oldwin->eventstate;
-						oldwin->eventstate= NULL;
+						win->eventstate = oldwin->eventstate;
+						oldwin->eventstate = NULL;
 						
 						/* ensure proper screen rescaling */
-						win->sizex= oldwin->sizex;
-						win->sizey= oldwin->sizey;
-						win->posx= oldwin->posx;
-						win->posy= oldwin->posy;
+						win->sizex = oldwin->sizex;
+						win->sizey = oldwin->sizey;
+						win->posx = oldwin->posx;
+						win->posy = oldwin->posy;
 					}
 				}
 			}
@@ -281,14 +283,14 @@ static void wm_init_userdef(bContext *C)
 	sound_init(CTX_data_main(C));
 
 	/* needed so loading a file from the command line respects user-pref [#26156] */
-	if(U.flag & USER_FILENOUI)	G.fileflags |= G_FILE_NO_UI;
-	else						G.fileflags &= ~G_FILE_NO_UI;
+	if (U.flag & USER_FILENOUI) G.fileflags |= G_FILE_NO_UI;
+	else G.fileflags &= ~G_FILE_NO_UI;
 
 	/* set the python auto-execute setting from user prefs */
 	/* enabled by default, unless explicitly enabled in the command line which overrides */
-	if((G.f & G_SCRIPT_OVERRIDE_PREF) == 0) {
+	if ((G.f & G_SCRIPT_OVERRIDE_PREF) == 0) {
 		if ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) G.f |=  G_SCRIPT_AUTOEXEC;
-		else											  G.f &= ~G_SCRIPT_AUTOEXEC;
+		else G.f &= ~G_SCRIPT_AUTOEXEC;
 	}
 
 	/* update tempdir from user preferences */
@@ -298,11 +300,12 @@ static void wm_init_userdef(bContext *C)
 
 
 /* return codes */
-#define BKE_READ_EXOTIC_FAIL_PATH		-3 /* file format is not supported */
-#define BKE_READ_EXOTIC_FAIL_FORMAT		-2 /* file format is not supported */
-#define BKE_READ_EXOTIC_FAIL_OPEN		-1 /* Can't open the file */
-#define BKE_READ_EXOTIC_OK_BLEND		 0 /* .blend file */
-#define BKE_READ_EXOTIC_OK_OTHER		 1 /* other supported formats */
+#define BKE_READ_EXOTIC_FAIL_PATH       -3 /* file format is not supported */
+#define BKE_READ_EXOTIC_FAIL_FORMAT     -2 /* file format is not supported */
+#define BKE_READ_EXOTIC_FAIL_OPEN       -1 /* Can't open the file */
+#define BKE_READ_EXOTIC_OK_BLEND         0 /* .blend file */
+#define BKE_READ_EXOTIC_OK_OTHER         1 /* other supported formats */
+
 
 /* intended to check for non-blender formats but for now it only reads blends */
 static int wm_read_exotic(Scene *UNUSED(scene), const char *name)
@@ -314,33 +317,32 @@ static int wm_read_exotic(Scene *UNUSED(scene), const char *name)
 
 	// make sure we're not trying to read a directory....
 
-	len= strlen(name);
-	if (ELEM(name[len-1], '/', '\\')) {
-		retval= BKE_READ_EXOTIC_FAIL_PATH;
+	len = strlen(name);
+	if (ELEM(name[len - 1], '/', '\\')) {
+		retval = BKE_READ_EXOTIC_FAIL_PATH;
 	}
 	else {
-		gzfile = gzopen(name,"rb");
-
+		gzfile = BLI_gzopen(name, "rb");
 		if (gzfile == NULL) {
-			retval= BKE_READ_EXOTIC_FAIL_OPEN;
+			retval = BKE_READ_EXOTIC_FAIL_OPEN;
 		}
 		else {
-			len= gzread(gzfile, header, sizeof(header));
+			len = gzread(gzfile, header, sizeof(header));
 			gzclose(gzfile);
 			if (len == sizeof(header) && strncmp(header, "BLENDER", 7) == 0) {
-				retval= BKE_READ_EXOTIC_OK_BLEND;
+				retval = BKE_READ_EXOTIC_OK_BLEND;
 			}
 			else {
 				//XXX waitcursor(1);
-				/*
-				if(is_foo_format(name)) {
+#if 0           /* historic stuff - no longer used */
+				if (is_foo_format(name)) {
 					read_foo(name);
-					retval= BKE_READ_EXOTIC_OK_OTHER;
+					retval = BKE_READ_EXOTIC_OK_OTHER;
 				}
 				else
-				 */
+#endif
 				{
-					retval= BKE_READ_EXOTIC_FAIL_FORMAT;
+					retval = BKE_READ_EXOTIC_FAIL_FORMAT;
 				}
 				//XXX waitcursor(0);
 			}
@@ -364,25 +366,25 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports)
 	/* first try to append data from exotic file formats... */
 	/* it throws error box when file doesn't exist and returns -1 */
 	/* note; it should set some error message somewhere... (ton) */
-	retval= wm_read_exotic(CTX_data_scene(C), filepath);
+	retval = wm_read_exotic(CTX_data_scene(C), filepath);
 	
 	/* we didn't succeed, now try to read Blender file */
 	if (retval == BKE_READ_EXOTIC_OK_BLEND) {
-		int G_f= G.f;
+		int G_f = G.f;
 		ListBase wmbase;
 
 		/* put aside screens to match with persistent windows later */
 		/* also exit screens and editors */
 		wm_window_match_init(C, &wmbase); 
 		
-		retval= BKE_read_file(C, filepath, reports);
+		retval = BKE_read_file(C, filepath, reports);
 		G.save_over = 1;
 
 		/* this flag is initialized by the operator but overwritten on read.
 		 * need to re-enable it here else drivers + registered scripts wont work. */
-		if(G.f != G_f) {
-			const int flags_keep= (G_SCRIPT_AUTOEXEC | G_SCRIPT_OVERRIDE_PREF);
-			G.f= (G.f & ~flags_keep) | (G_f & flags_keep);
+		if (G.f != G_f) {
+			const int flags_keep = (G_SCRIPT_AUTOEXEC | G_SCRIPT_OVERRIDE_PREF);
+			G.f = (G.f & ~flags_keep) | (G_f & flags_keep);
 		}
 
 		/* match the read WM with current WM */
@@ -391,16 +393,19 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports)
 		
 // XXX		mainwindow_set_filename_to_title(G.main->name);
 
-		if(retval == BKE_READ_FILE_OK_USERPREFS) wm_init_userdef(C);	// in case a userdef is read from regular .blend
+		if (retval == BKE_READ_FILE_OK_USERPREFS) {
+			/* in case a userdef is read from regular .blend */
+			wm_init_userdef(C);
+		}
 		
 		if (retval != BKE_READ_FILE_FAIL) {
 			G.relbase_valid = 1;
-			if(!G.background) /* assume automated tasks with background, dont write recent file list */
+			if (!G.background) /* assume automated tasks with background, don't write recent file list */
 				write_history();
 		}
 
 
-		WM_event_add_notifier(C, NC_WM|ND_FILEREAD, NULL);
+		WM_event_add_notifier(C, NC_WM | ND_FILEREAD, NULL);
 //		refresh_interface_font();
 
 		CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first);
@@ -418,15 +423,27 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports)
 		/* important to do before NULL'ing the context */
 		BLI_exec_cb(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_POST);
 
-		CTX_wm_window_set(C, NULL); /* exits queues */
+		if (!G.background) {
+			/* in background mode this makes it hard to load
+			 * a blend file and do anything since the screen
+			 * won't be set to a valid value again */
+			CTX_wm_window_set(C, NULL); /* exits queues */
+		}
 
-#if 0	/* gives popups on windows but not linux, bug in report API but disable for now to stop users getting annoyed  */
+#if 0
+		/* gives popups on windows but not linux, bug in report API
+		 * but disable for now to stop users getting annoyed  */
 		/* TODO, make this show in header info window */
 		{
 			Scene *sce;
-			for(sce= G.main->scene.first; sce; sce= sce->id.next) {
-				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", sce->r.engine, sce->id.name+2);
+			for (sce = G.main->scene.first; sce; sce = sce->id.next) {
+				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",
+					            sce->r.engine, sce->id.name + 2);
 				}
 			}
 		}
@@ -434,18 +451,18 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports)
 
 		// XXX		undo_editmode_clear();
 		BKE_reset_undo();
-		BKE_write_undo(C, "original");	/* save current state */
+		BKE_write_undo(C, "original");  /* save current state */
 	}
-	else if(retval == BKE_READ_EXOTIC_OK_OTHER)
+	else if (retval == BKE_READ_EXOTIC_OK_OTHER)
 		BKE_write_undo(C, "Import file");
-	else if(retval == BKE_READ_EXOTIC_FAIL_OPEN) {
+	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"));
+		            errno ? strerror(errno) : IFACE_("Unable to open the file"));
 	}
-	else if(retval == BKE_READ_EXOTIC_FAIL_FORMAT) {
+	else if (retval == BKE_READ_EXOTIC_FAIL_FORMAT) {
 		BKE_reportf(reports, RPT_ERROR, IFACE_("File format is not supported in file: \"%s\"."), filepath);
 	}
-	else if(retval == BKE_READ_EXOTIC_FAIL_PATH) {
+	else if (retval == BKE_READ_EXOTIC_FAIL_PATH) {
 		BKE_reportf(reports, RPT_ERROR, IFACE_("File path invalid: \"%s\"."), filepath);
 	}
 	else {
@@ -465,7 +482,7 @@ int WM_read_homefile(bContext *C, ReportList *UNUSED(reports), short from_memory
 {
 	ListBase wmbase;
 	char tstr[FILE_MAX];
-	int success= 0;
+	int success = 0;
 	
 	free_ttfont(); /* still weird... what does it here? */
 		
@@ -474,7 +491,8 @@ int WM_read_homefile(bContext *C, ReportList *UNUSED(reports), short from_memory
 		char *cfgdir = BLI_get_folder(BLENDER_USER_CONFIG, NULL);
 		if (cfgdir) {
 			BLI_make_file_string(G.main->name, tstr, cfgdir, BLENDER_STARTUP_FILE);
-		} else {
+		}
+		else {
 			tstr[0] = '\0';
 			from_memory = 1;
 		}
@@ -489,12 +507,12 @@ int WM_read_homefile(bContext *C, ReportList *UNUSED(reports), short from_memory
 	if (!from_memory && BLI_exists(tstr)) {
 		success = (BKE_read_file(C, tstr, NULL) != BKE_READ_FILE_FAIL);
 		
-		if(U.themes.first==NULL) {
-			printf("\nError: No valid "STRINGIFY(BLENDER_STARTUP_FILE)", fall back to built-in default.\n\n");
+		if (U.themes.first == NULL) {
+			printf("\nError: No valid "STRINGIFY (BLENDER_STARTUP_FILE)", fall back to built-in default.\n\n");
 			success = 0;
 		}
 	}
-	if(success==0) {
+	if (success == 0) {
 		success = BKE_read_file_from_memory(C, datatoc_startup_blend, datatoc_startup_blend_size, NULL);
 		if (wmbase.first == NULL) wm_clear_default_size(C);
 
@@ -516,27 +534,27 @@ int WM_read_homefile(bContext *C, ReportList *UNUSED(reports), short from_memory
 	wm_window_match_do(C, &wmbase); 
 	WM_check(C); /* opens window(s), checks keymaps */
 
-	G.main->name[0]= '\0';
+	G.main->name[0] = '\0';
 
 	/* When loading factory settings, the reset solid OpenGL lights need to be applied. */
 	if (!G.background) GPU_default_lights();
 	
 	/* XXX */
-	G.save_over = 0;	// start with save preference untitled.blend
-	G.fileflags &= ~G_FILE_AUTOPLAY;	/*  disable autoplay in startup.blend... */
+	G.save_over = 0;    // start with save preference untitled.blend
+	G.fileflags &= ~G_FILE_AUTOPLAY;    /*  disable autoplay in startup.blend... */
 //	mainwindow_set_filename_to_title("");	// empty string re-initializes title to "Blender"
 	
 //	refresh_interface_font();
 	
 //	undo_editmode_clear();
 	BKE_reset_undo();
-	BKE_write_undo(C, "original");	/* save current state */
+	BKE_write_undo(C, "original");  /* save current state */
 
 	ED_editors_init(C);
 	DAG_on_visible_update(CTX_data_main(C), TRUE);
 
 #ifdef WITH_PYTHON
-	if(CTX_py_init_get(C)) {
+	if (CTX_py_init_get(C)) {
 		/* sync addons, these may have changed from the defaults */
 		BPY_string_exec(C, "__import__('addon_utils').reset_all()");
 
@@ -546,10 +564,10 @@ int WM_read_homefile(bContext *C, ReportList *UNUSED(reports), short from_memory
 	}
 #endif
 
-	WM_event_add_notifier(C, NC_WM|ND_FILEREAD, NULL);
+	WM_event_add_notifier(C, NC_WM | ND_FILEREAD, NULL);
 
 	/* in background mode the scene will stay NULL */
-	if(!G.background) {
+	if (!G.background) {
 		CTX_wm_window_set(C, NULL); /* exits queues */
 	}
 
@@ -558,7 +576,7 @@ int WM_read_homefile(bContext *C, ReportList *UNUSED(reports), short from_memory
 
 int WM_read_homefile_exec(bContext *C, wmOperator *op)
 {
-	int from_memory= strcmp(op->type->idname, "WM_OT_read_factory_settings") == 0;
+	int from_memory = strcmp(op->type->idname, "WM_OT_read_factory_settings") == 0;
 	return WM_read_homefile(C, op->reports, from_memory) ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
 }
 
@@ -575,15 +593,15 @@ void WM_read_history(void)
 
 	BLI_make_file_string("/", name, cfgdir, BLENDER_HISTORY_FILE);
 
-	lines= BLI_file_read_as_lines(name);
+	lines = BLI_file_read_as_lines(name);
 
 	G.recent_files.first = G.recent_files.last = NULL;
 
 	/* read list of recent opened files from recent-files.txt to memory */
-	for (l= lines, num= 0; l && (num<U.recent_files); l= l->next) {
+	for (l = lines, num = 0; l && (num < U.recent_files); l = l->next) {
 		line = l->link;
 		if (line[0] && BLI_exists(line)) {
-			recent = (RecentFile*)MEM_mallocN(sizeof(RecentFile),"RecentFile");
+			recent = (RecentFile *)MEM_mallocN(sizeof(RecentFile), "RecentFile");
 			BLI_addtail(&(G.recent_files), recent);
 			recent->filepath = BLI_strdup(line);
 			num++;
@@ -604,28 +622,28 @@ static void write_history(void)
 
 	/* will be NULL in background mode */
 	user_config_dir = BLI_get_folder_create(BLENDER_USER_CONFIG, NULL);
-	if(!user_config_dir)
+	if (!user_config_dir)
 		return;
 
 	BLI_make_file_string("/", name, user_config_dir, BLENDER_HISTORY_FILE);
 
 	recent = G.recent_files.first;
 	/* refresh recent-files.txt of recent opened files, when current file was changed */
-	if(!(recent) || (BLI_path_cmp(recent->filepath, G.main->name)!=0)) {
-		fp= fopen(name, "w");
+	if (!(recent) || (BLI_path_cmp(recent->filepath, G.main->name) != 0)) {
+		fp = BLI_fopen(name, "w");
 		if (fp) {
 			/* add current file to the beginning of list */
-			recent = (RecentFile*)MEM_mallocN(sizeof(RecentFile),"RecentFile");
+			recent = (RecentFile *)MEM_mallocN(sizeof(RecentFile), "RecentFile");
 			recent->filepath = BLI_strdup(G.main->name);
 			BLI_addhead(&(G.recent_files), recent);
 			/* write current file to recent-files.txt */
 			fprintf(fp, "%s\n", recent->filepath);
 			recent = recent->next;
-			i=1;
+			i = 1;
 			/* write rest of recent opened files to recent-files.txt */
-			while((i<U.recent_files) && (recent)){
+			while ((i < U.recent_files) && (recent)) {
 				/* this prevents to have duplicities in list */
-				if (BLI_path_cmp(recent->filepath, G.main->name)!=0) {
+				if (BLI_path_cmp(recent->filepath, G.main->name) != 0) {
 					fprintf(fp, "%s\n", recent->filepath);
 					recent = recent->next;
 				}
@@ -645,24 +663,50 @@ static void write_history(void)
 	}
 }
 
-static ImBuf *blend_file_thumb(Scene *scene, int **thumb_pt)
+/* screen can be NULL */
+static ImBuf *blend_file_thumb(Scene *scene, bScreen *screen, int **thumb_pt)
 {
 	/* will be scaled down, but gives some nice oversampling */
 	ImBuf *ibuf;
 	int *thumb;
-	char err_out[256]= "unknown";
+	char err_out[256] = "unknown";
 
-	*thumb_pt= NULL;
+	/* screen if no camera found */
+	ScrArea *sa = NULL;
+	ARegion *ar = NULL;
+	View3D *v3d = NULL;
+
+	*thumb_pt = NULL;
 
 	/* scene can be NULL if running a script at startup and calling the save operator */
-	if(G.background || scene==NULL || scene->camera==NULL)
+	if (G.background || scene == NULL)
 		return NULL;
 
+	if ((scene->camera == NULL) && (screen != NULL)) {
+		sa = BKE_screen_find_big_area(screen, SPACE_VIEW3D, 0);
+		ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+		if (ar) {
+			v3d = sa->spacedata.first;
+		}
+	}
+
+	if (scene->camera == NULL && v3d == NULL) {
+		return NULL;
+	}
+
 	/* gets scaled to BLEN_THUMB_SIZE */
-	ibuf= ED_view3d_draw_offscreen_imbuf_simple(scene, scene->camera, BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2, IB_rect, OB_SOLID, err_out);
-	
-	if(ibuf) {		
-		float aspect= (scene->r.xsch*scene->r.xasp) / (scene->r.ysch*scene->r.yasp);
+	if (scene->camera) {
+		ibuf = ED_view3d_draw_offscreen_imbuf_simple(scene, scene->camera,
+		                                             BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2,
+		                                             IB_rect, OB_SOLID, FALSE, err_out);
+	}
+	else {
+		ibuf = ED_view3d_draw_offscreen_imbuf(scene, v3d, ar, BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2,
+		                                      IB_rect, FALSE, err_out);
+	}
+
+	if (ibuf) {		
+		float aspect = (scene->r.xsch * scene->r.xasp) / (scene->r.ysch * scene->r.yasp);
 
 		/* dirty oversampling */
 		IMB_scaleImBuf(ibuf, BLEN_THUMB_SIZE, BLEN_THUMB_SIZE);
@@ -671,7 +715,7 @@ static ImBuf *blend_file_thumb(Scene *scene, int **thumb_pt)
 		IMB_overlayblend_thumb(ibuf->rect, ibuf->x, ibuf->y, aspect);
 		
 		/* first write into thumb buffer */
-		thumb= MEM_mallocN(((2 + (BLEN_THUMB_SIZE * BLEN_THUMB_SIZE))) * sizeof(int), "write_file thumb");
+		thumb = MEM_mallocN(((2 + (BLEN_THUMB_SIZE * BLEN_THUMB_SIZE))) * sizeof(int), "write_file thumb");
 
 		thumb[0] = BLEN_THUMB_SIZE;
 		thumb[1] = BLEN_THUMB_SIZE;
@@ -681,11 +725,11 @@ static ImBuf *blend_file_thumb(Scene *scene, int **thumb_pt)
 	else {
 		/* '*thumb_pt' needs to stay NULL to prevent a bad thumbnail from being handled */
 		fprintf(stderr, "blend_file_thumb failed to create thumbnail: %s\n", err_out);
-		thumb= NULL;
+		thumb = NULL;
 	}
 	
 	/* must be freed by caller */
-	*thumb_pt= thumb;
+	*thumb_pt = thumb;
 	
 	return ibuf;
 }
@@ -698,7 +742,7 @@ int write_crash_blend(void)
 
 	BLI_strncpy(path, G.main->name, sizeof(path));
 	BLI_replace_extension(path, sizeof(path), "_crash.blend");
-	if(BLO_write_file(G.main, path, fileflags, NULL, NULL)) {
+	if (BLO_write_file(G.main, path, fileflags, NULL, NULL)) {
 		printf("written: %s\n", path);
 		return 1;
 	}
@@ -714,8 +758,8 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
 	int len;
 	char filepath[FILE_MAX];
 
-	int *thumb= NULL;
-	ImBuf *ibuf_thumb= NULL;
+	int *thumb = NULL;
+	ImBuf *ibuf_thumb = NULL;
 
 	len = strlen(target);
 	
@@ -731,10 +775,10 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
  
 	BLI_strncpy(filepath, target, FILE_MAX);
 	BLI_replace_extension(filepath, FILE_MAX, ".blend");
-	/* dont use 'target' anymore */
+	/* don't use 'target' anymore */
 	
 	/* send the OnSave event */
-	for (li= G.main->library.first; li; li= li->id.next) {
+	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);
 			return -1;
@@ -743,8 +787,8 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
 
 	/* blend file thumbnail */
 	/* save before exit_editmode, otherwise derivedmeshes for shared data corrupt #27765) */
-	if(U.flag & USER_SAVE_PREVIEWS) {
-		ibuf_thumb= blend_file_thumb(CTX_data_scene(C), &thumb);
+	if (U.flag & USER_SAVE_PREVIEWS) {
+		ibuf_thumb = blend_file_thumb(CTX_data_scene(C), CTX_wm_screen(C), &thumb);
 	}
 
 	BLI_exec_cb(G.main, NULL, BLI_CB_EVT_SAVE_PRE);
@@ -764,21 +808,21 @@ int WM_write_file(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 (!copy) {
 			G.relbase_valid = 1;
-			BLI_strncpy(G.main->name, filepath, sizeof(G.main->name));	/* is guaranteed current file */
+			BLI_strncpy(G.main->name, filepath, sizeof(G.main->name));  /* is guaranteed current file */
 	
 			G.save_over = 1; /* disable untitled.blend convention */
 		}
 
-		if(fileflags & G_FILE_COMPRESS) G.fileflags |= G_FILE_COMPRESS;
+		if (fileflags & G_FILE_COMPRESS) G.fileflags |= G_FILE_COMPRESS;
 		else G.fileflags &= ~G_FILE_COMPRESS;
 		
-		if(fileflags & G_FILE_AUTOPLAY) G.fileflags |= G_FILE_AUTOPLAY;
+		if (fileflags & G_FILE_AUTOPLAY) G.fileflags |= G_FILE_AUTOPLAY;
 		else G.fileflags &= ~G_FILE_AUTOPLAY;
 
 		/* prevent background mode scripts from clobbering history */
-		if(!G.background) {
+		if (!G.background) {
 			write_history();
 		}
 
@@ -786,15 +830,16 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
 
 		/* run this function after because the file cant be written before the blend is */
 		if (ibuf_thumb) {
-			ibuf_thumb= IMB_thumb_create(filepath, THB_NORMAL, THB_SOURCE_BLEND, ibuf_thumb);
+			IMB_thumb_delete(filepath, THB_FAIL); /* without this a failed thumb overrides */
+			ibuf_thumb = IMB_thumb_create(filepath, THB_NORMAL, THB_SOURCE_BLEND, ibuf_thumb);
 			IMB_freeImBuf(ibuf_thumb);
 		}
 
-		if(thumb) MEM_freeN(thumb);
+		if (thumb) MEM_freeN(thumb);
 	}
 	else {
-		if(ibuf_thumb) IMB_freeImBuf(ibuf_thumb);
-		if(thumb) MEM_freeN(thumb);
+		if (ibuf_thumb) IMB_freeImBuf(ibuf_thumb);
+		if (thumb) MEM_freeN(thumb);
 		
 		WM_cursor_wait(0);
 		return -1;
@@ -808,13 +853,13 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re
 /* operator entry */
 int WM_write_homefile(bContext *C, wmOperator *op)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
-	wmWindow *win= CTX_wm_window(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
+	wmWindow *win = CTX_wm_window(C);
 	char filepath[FILE_MAX];
 	int fileflags;
 
 	/* check current window and close it if temp */
-	if(win->screen->temp)
+	if (win->screen->temp)
 		wm_window_close(C, wm, win);
 	
 	/* update keymaps in user preferences */
@@ -826,14 +871,14 @@ int WM_write_homefile(bContext *C, wmOperator *op)
 	/*  force save as regular blend file */
 	fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_AUTOPLAY | G_FILE_LOCK | G_FILE_SIGN | G_FILE_HISTORY);
 
-	if(BLO_write_file(CTX_data_main(C), filepath, fileflags, op->reports, NULL) == 0) {
+	if (BLO_write_file(CTX_data_main(C), filepath, fileflags, op->reports, NULL) == 0) {
 		printf("fail\n");
 		return OPERATOR_CANCELLED;
 	}
 	
 	printf("ok\n");
 
-	G.save_over= 0;
+	G.save_over = 0;
 
 	return OPERATOR_FINISHED;
 }
@@ -872,8 +917,8 @@ void WM_autosave_init(wmWindowManager *wm)
 {
 	wm_autosave_timer_ended(wm);
 
-	if(U.flag & USER_AUTOSAVE)
-		wm->autosavetimer= WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, U.savetime*60.0);
+	if (U.flag & USER_AUTOSAVE)
+		wm->autosavetimer = WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, U.savetime * 60.0);
 }
 
 void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(wt))
@@ -886,10 +931,10 @@ void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(w
 	WM_event_remove_timer(wm, NULL, wm->autosavetimer);
 
 	/* if a modal operator is running, don't autosave, but try again in 10 seconds */
-	for(win=wm->windows.first; win; win=win->next) {
-		for(handler=win->modalhandlers.first; handler; handler=handler->next) {
-			if(handler->op) {
-				wm->autosavetimer= WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, 10.0);
+	for (win = wm->windows.first; win; win = win->next) {
+		for (handler = win->modalhandlers.first; handler; handler = handler->next) {
+			if (handler->op) {
+				wm->autosavetimer = WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, 10.0);
 				return;
 			}
 		}
@@ -898,20 +943,20 @@ void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(w
 	wm_autosave_location(filepath);
 
 	/*  force save as regular blend file */
-	fileflags = G.fileflags & ~(G_FILE_COMPRESS|G_FILE_AUTOPLAY |G_FILE_LOCK|G_FILE_SIGN|G_FILE_HISTORY);
+	fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_AUTOPLAY | G_FILE_LOCK | G_FILE_SIGN | G_FILE_HISTORY);
 
 	/* no error reporting to console */
 	BLO_write_file(CTX_data_main(C), filepath, fileflags, NULL, NULL);
 
 	/* do timer after file write, just in case file write takes a long time */
-	wm->autosavetimer= WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, U.savetime*60.0);
+	wm->autosavetimer = WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, U.savetime * 60.0);
 }
 
 void wm_autosave_timer_ended(wmWindowManager *wm)
 {
-	if(wm->autosavetimer) {
+	if (wm->autosavetimer) {
 		WM_event_remove_timer(wm, NULL, wm->autosavetimer);
-		wm->autosavetimer= NULL;
+		wm->autosavetimer = NULL;
 	}
 }
 
@@ -921,12 +966,12 @@ void wm_autosave_delete(void)
 	
 	wm_autosave_location(filename);
 
-	if(BLI_exists(filename)) {
+	if (BLI_exists(filename)) {
 		char str[FILE_MAX];
 		BLI_make_file_string("/", str, BLI_temporary_dir(), "quit.blend");
 
 		/* if global undo; remove tempsave, otherwise rename */
-		if(U.uiflag & USER_GLOBALUNDO) BLI_delete(filename, 0, 0);
+		if (U.uiflag & USER_GLOBALUNDO) BLI_delete(filename, 0, 0);
 		else BLI_rename(filename, str);
 	}
 }
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index 4fb8751..bfa3645 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -37,9 +37,8 @@
 #include "MEM_guardedalloc.h"
 
 #include "BLI_blenlib.h"
-#include "BLI_editVert.h"	/* lasso tessellation */
 #include "BLI_math.h"
-#include "BLI_scanfill.h"	/* lasso tessellation */
+#include "BLI_scanfill.h"   /* lasso tessellation */
 #include "BLI_utildefines.h"
 
 #include "BKE_context.h"
@@ -61,42 +60,45 @@
 /* context checked on having screen, window and area */
 wmGesture *WM_gesture_new(bContext *C, wmEvent *event, int type)
 {
-	wmGesture *gesture= MEM_callocN(sizeof(wmGesture), "new gesture");
-	wmWindow *window= CTX_wm_window(C);
-	ARegion *ar= CTX_wm_region(C);
+	wmGesture *gesture = MEM_callocN(sizeof(wmGesture), "new gesture");
+	wmWindow *window = CTX_wm_window(C);
+	ARegion *ar = CTX_wm_region(C);
 	int sx, sy;
 	
 	BLI_addtail(&window->gesture, gesture);
 	
-	gesture->type= type;
-	gesture->event_type= event->type;
-	gesture->swinid= ar->swinid;	/* means only in area-region context! */
+	gesture->type = type;
+	gesture->event_type = event->type;
+	gesture->swinid = ar->swinid;    /* means only in area-region context! */
 	
 	wm_subwindow_getorigin(window, gesture->swinid, &sx, &sy);
 	
-	if( ELEM5(type, WM_GESTURE_RECT, WM_GESTURE_CROSS_RECT, WM_GESTURE_TWEAK, WM_GESTURE_CIRCLE, WM_GESTURE_STRAIGHTLINE)) {
-		rcti *rect= MEM_callocN(sizeof(rcti), "gesture rect new");
+	if (ELEM5(type, WM_GESTURE_RECT, WM_GESTURE_CROSS_RECT, WM_GESTURE_TWEAK,
+	          WM_GESTURE_CIRCLE, WM_GESTURE_STRAIGHTLINE))
+	{
+		rcti *rect = MEM_callocN(sizeof(rcti), "gesture rect new");
 		
-		gesture->customdata= rect;
-		rect->xmin= event->x - sx;
-		rect->ymin= event->y - sy;
-		if(type==WM_GESTURE_CIRCLE) {
+		gesture->customdata = rect;
+		rect->xmin = event->x - sx;
+		rect->ymin = event->y - sy;
+		if (type == WM_GESTURE_CIRCLE) {
 #ifdef GESTURE_MEMORY
-			rect->xmax= circle_select_size;
+			rect->xmax = circle_select_size;
 #else
-			rect->xmax= 25;	// XXX temp
+			rect->xmax = 25;    // XXX temp
 #endif
-		} else {
-			rect->xmax= event->x - sx;
-			rect->ymax= event->y - sy;
+		}
+		else {
+			rect->xmax = event->x - sx;
+			rect->ymax = event->y - sy;
 		}
 	}
 	else if (ELEM(type, WM_GESTURE_LINES, WM_GESTURE_LASSO)) {
 		short *lasso;
-		gesture->customdata= lasso= MEM_callocN(2*sizeof(short)*WM_LASSO_MIN_POINTS, "lasso points");
+		gesture->customdata = lasso = MEM_callocN(2 * sizeof(short) * WM_LASSO_MIN_POINTS, "lasso points");
 		lasso[0] = event->x - sx;
 		lasso[1] = event->y - sy;
-		gesture->points= 1;
+		gesture->points = 1;
 		gesture->size = WM_LASSO_MIN_POINTS;
 	}
 	
@@ -105,10 +107,10 @@ wmGesture *WM_gesture_new(bContext *C, wmEvent *event, int type)
 
 void WM_gesture_end(bContext *C, wmGesture *gesture)
 {
-	wmWindow *win= CTX_wm_window(C);
+	wmWindow *win = CTX_wm_window(C);
 	
-	if(win->tweak==gesture)
-		win->tweak= NULL;
+	if (win->tweak == gesture)
+		win->tweak = NULL;
 	BLI_remlink(&win->gesture, gesture);
 	MEM_freeN(gesture->customdata);
 	MEM_freeN(gesture);
@@ -116,9 +118,9 @@ void WM_gesture_end(bContext *C, wmGesture *gesture)
 
 void WM_gestures_remove(bContext *C)
 {
-	wmWindow *win= CTX_wm_window(C);
+	wmWindow *win = CTX_wm_window(C);
 	
-	while(win->gesture.first)
+	while (win->gesture.first)
 		WM_gesture_end(C, win->gesture.first);
 }
 
@@ -126,32 +128,32 @@ void WM_gestures_remove(bContext *C)
 /* tweak and line gestures */
 int wm_gesture_evaluate(wmGesture *gesture)
 {
-	if(gesture->type==WM_GESTURE_TWEAK) {
-		rcti *rect= gesture->customdata;
-		int dx= rect->xmax - rect->xmin;
-		int dy= rect->ymax - rect->ymin;
-		if(ABS(dx)+ABS(dy) > U.tweak_threshold) {
-			int theta= (int)floor(4.0f*atan2f((float)dy, (float)dx)/(float)M_PI + 0.5f);
-			int val= EVT_GESTURE_W;
-			
-			if(theta==0) val= EVT_GESTURE_E;
-			else if(theta==1) val= EVT_GESTURE_NE;
-			else if(theta==2) val= EVT_GESTURE_N;
-			else if(theta==3) val= EVT_GESTURE_NW;
-			else if(theta==-1) val= EVT_GESTURE_SE;
-			else if(theta==-2) val= EVT_GESTURE_S;
-			else if(theta==-3) val= EVT_GESTURE_SW;
+	if (gesture->type == WM_GESTURE_TWEAK) {
+		rcti *rect = gesture->customdata;
+		int dx = rect->xmax - rect->xmin;
+		int dy = rect->ymax - rect->ymin;
+		if (ABS(dx) + ABS(dy) > U.tweak_threshold) {
+			int theta = (int)floor(4.0f * atan2f((float)dy, (float)dx) / (float)M_PI + 0.5f);
+			int val = EVT_GESTURE_W;
+
+			if (theta == 0) val = EVT_GESTURE_E;
+			else if (theta == 1) val = EVT_GESTURE_NE;
+			else if (theta == 2) val = EVT_GESTURE_N;
+			else if (theta == 3) val = EVT_GESTURE_NW;
+			else if (theta == -1) val = EVT_GESTURE_SE;
+			else if (theta == -2) val = EVT_GESTURE_S;
+			else if (theta == -3) val = EVT_GESTURE_SW;
 			
 #if 0
 			/* debug */
-			if(val==1) printf("tweak north\n");
-			if(val==2) printf("tweak north-east\n");
-			if(val==3) printf("tweak east\n");
-			if(val==4) printf("tweak south-east\n");
-			if(val==5) printf("tweak south\n");
-			if(val==6) printf("tweak south-west\n");
-			if(val==7) printf("tweak west\n");
-			if(val==8) printf("tweak north-west\n");
+			if (val == 1) printf("tweak north\n");
+			if (val == 2) printf("tweak north-east\n");
+			if (val == 3) printf("tweak east\n");
+			if (val == 4) printf("tweak south-east\n");
+			if (val == 5) printf("tweak south\n");
+			if (val == 6) printf("tweak south-west\n");
+			if (val == 7) printf("tweak west\n");
+			if (val == 8) printf("tweak north-west\n");
 #endif			
 			return val;
 		}
@@ -164,7 +166,7 @@ int wm_gesture_evaluate(wmGesture *gesture)
 
 static void wm_gesture_draw_rect(wmGesture *gt)
 {
-	rcti *rect= (rcti *)gt->customdata;
+	rcti *rect = (rcti *)gt->customdata;
 	
 	glEnable(GL_BLEND);
 	glColor4f(1.0, 1.0, 1.0, 0.05);
@@ -188,7 +190,7 @@ static void wm_gesture_draw_rect(wmGesture *gt)
 
 static void wm_gesture_draw_line(wmGesture *gt)
 {
-	rcti *rect= (rcti *)gt->customdata;
+	rcti *rect = (rcti *)gt->customdata;
 	
 	glEnable(GL_LINE_STIPPLE);
 	glColor3ub(96, 96, 96);
@@ -204,22 +206,22 @@ static void wm_gesture_draw_line(wmGesture *gt)
 
 static void wm_gesture_draw_circle(wmGesture *gt)
 {
-	rcti *rect= (rcti *)gt->customdata;
+	rcti *rect = (rcti *)gt->customdata;
 
 	glTranslatef((float)rect->xmin, (float)rect->ymin, 0.0f);
 
 	glEnable(GL_BLEND);
 	glColor4f(1.0, 1.0, 1.0, 0.05);
-	glutil_draw_filled_arc(0.0, M_PI*2.0, rect->xmax, 40);
+	glutil_draw_filled_arc(0.0, M_PI * 2.0, rect->xmax, 40);
 	glDisable(GL_BLEND);
 	
 	glEnable(GL_LINE_STIPPLE);
 	glColor3ub(96, 96, 96);
 	glLineStipple(1, 0xAAAA);
-	glutil_draw_lined_arc(0.0, M_PI*2.0, rect->xmax, 40);
+	glutil_draw_lined_arc(0.0, M_PI * 2.0, rect->xmax, 40);
 	glColor3ub(255, 255, 255);
 	glLineStipple(1, 0x5555);
-	glutil_draw_lined_arc(0.0, M_PI*2.0, rect->xmax, 40);
+	glutil_draw_lined_arc(0.0, M_PI * 2.0, rect->xmax, 40);
 	
 	glDisable(GL_LINE_STIPPLE);
 	glTranslatef((float)-rect->xmin, (float)-rect->ymin, 0.0f);
@@ -228,35 +230,37 @@ static void wm_gesture_draw_circle(wmGesture *gt)
 
 static void draw_filled_lasso(wmGesture *gt)
 {
-	EditVert *v=NULL, *lastv=NULL, *firstv=NULL;
-	/* EditEdge *e; */ /* UNUSED */
-	EditFace *efa;
-	short *lasso= (short *)gt->customdata;
+	ScanFillContext sf_ctx;
+	ScanFillVert *v = NULL, *lastv = NULL, *firstv = NULL;
+	ScanFillFace *efa;
+	short *lasso = (short *)gt->customdata;
 	int i;
 	
-	for (i=0; i<gt->points; i++, lasso+=2) {
+	BLI_begin_edgefill(&sf_ctx);
+	for (i = 0; i < gt->points; i++, lasso += 2) {
 		float co[3];
 
-		co[0]= (float)lasso[0];
-		co[1]= (float)lasso[1];
-		co[2]= 0.0f;
+		co[0] = (float)lasso[0];
+		co[1] = (float)lasso[1];
+		co[2] = 0.0f;
 
-		v = BLI_addfillvert(co);
+		v = BLI_addfillvert(&sf_ctx, co);
 		if (lastv)
-			/* e = */ /* UNUSED */ BLI_addfilledge(lastv, v);
+			/* e = */ /* UNUSED */ BLI_addfilledge(&sf_ctx, lastv, v);
 		lastv = v;
-		if (firstv==NULL) firstv = v;
+		if (firstv == NULL) firstv = v;
 	}
 	
 	/* highly unlikely this will fail, but could crash if (gt->points == 0) */
-	if(firstv) {
-		BLI_addfilledge(firstv, v);
-		BLI_edgefill(0);
+	if (firstv) {
+		float zvec[3] = {0.0f, 0.0f, 1.0f};
+		BLI_addfilledge(&sf_ctx, firstv, v);
+		BLI_edgefill_ex(&sf_ctx, FALSE, zvec);
 	
 		glEnable(GL_BLEND);
 		glColor4f(1.0, 1.0, 1.0, 0.05);
 		glBegin(GL_TRIANGLES);
-		for (efa = fillfacebase.first; efa; efa=efa->next) {
+		for (efa = sf_ctx.fillfacebase.first; efa; efa = efa->next) {
 			glVertex2fv(efa->v1->co);
 			glVertex2fv(efa->v2->co);
 			glVertex2fv(efa->v3->co);
@@ -264,13 +268,13 @@ static void draw_filled_lasso(wmGesture *gt)
 		glEnd();
 		glDisable(GL_BLEND);
 	
-		BLI_end_edgefill();
+		BLI_end_edgefill(&sf_ctx);
 	}
 }
 
 static void wm_gesture_draw_lasso(wmGesture *gt)
 {
-	short *lasso= (short *)gt->customdata;
+	short *lasso = (short *)gt->customdata;
 	int i;
 
 	draw_filled_lasso(gt);
@@ -279,19 +283,19 @@ static void wm_gesture_draw_lasso(wmGesture *gt)
 	glColor3ub(96, 96, 96);
 	glLineStipple(1, 0xAAAA);
 	glBegin(GL_LINE_STRIP);
-	for(i=0; i<gt->points; i++, lasso+=2)
+	for (i = 0; i < gt->points; i++, lasso += 2)
 		glVertex2sv(lasso);
-	if(gt->type==WM_GESTURE_LASSO)
+	if (gt->type == WM_GESTURE_LASSO)
 		glVertex2sv((short *)gt->customdata);
 	glEnd();
 	
 	glColor3ub(255, 255, 255);
 	glLineStipple(1, 0x5555);
 	glBegin(GL_LINE_STRIP);
-	lasso= (short *)gt->customdata;
-	for(i=0; i<gt->points; i++, lasso+=2)
+	lasso = (short *)gt->customdata;
+	for (i = 0; i < gt->points; i++, lasso += 2)
 		glVertex2sv(lasso);
-	if(gt->type==WM_GESTURE_LASSO)
+	if (gt->type == WM_GESTURE_LASSO)
 		glVertex2sv((short *)gt->customdata);
 	glEnd();
 	
@@ -301,7 +305,7 @@ static void wm_gesture_draw_lasso(wmGesture *gt)
 
 static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt)
 {
-	rcti *rect= (rcti *)gt->customdata;
+	rcti *rect = (rcti *)gt->customdata;
 	
 	glEnable(GL_LINE_STIPPLE);
 	glColor3ub(96, 96, 96);
@@ -319,41 +323,41 @@ static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt)
 /* called in wm_draw.c */
 void wm_gesture_draw(wmWindow *win)
 {
-	wmGesture *gt= (wmGesture *)win->gesture.first;
+	wmGesture *gt = (wmGesture *)win->gesture.first;
 	
-	for(; gt; gt= gt->next) {
+	for (; gt; gt = gt->next) {
 		/* all in subwindow space */
 		wmSubWindowSet(win, gt->swinid);
 		
-		if(gt->type==WM_GESTURE_RECT)
+		if (gt->type == WM_GESTURE_RECT)
 			wm_gesture_draw_rect(gt);
-//		else if(gt->type==WM_GESTURE_TWEAK)
+//		else if (gt->type==WM_GESTURE_TWEAK)
 //			wm_gesture_draw_line(gt);
-		else if(gt->type==WM_GESTURE_CIRCLE)
+		else if (gt->type == WM_GESTURE_CIRCLE)
 			wm_gesture_draw_circle(gt);
-		else if(gt->type==WM_GESTURE_CROSS_RECT) {
-			if(gt->mode==1)
+		else if (gt->type == WM_GESTURE_CROSS_RECT) {
+			if (gt->mode == 1)
 				wm_gesture_draw_rect(gt);
 			else
 				wm_gesture_draw_cross(win, gt);
 		}
-		else if(gt->type==WM_GESTURE_LINES) 
+		else if (gt->type == WM_GESTURE_LINES)
 			wm_gesture_draw_lasso(gt);
-		else if(gt->type==WM_GESTURE_LASSO) 
+		else if (gt->type == WM_GESTURE_LASSO)
 			wm_gesture_draw_lasso(gt);
-		else if(gt->type==WM_GESTURE_STRAIGHTLINE)
+		else if (gt->type == WM_GESTURE_STRAIGHTLINE)
 			wm_gesture_draw_line(gt);
 	}
 }
 
 void wm_gesture_tag_redraw(bContext *C)
 {
-	wmWindow *win= CTX_wm_window(C);
-	bScreen *screen= CTX_wm_screen(C);
-	ARegion *ar= CTX_wm_region(C);
+	wmWindow *win = CTX_wm_window(C);
+	bScreen *screen = CTX_wm_screen(C);
+	ARegion *ar = CTX_wm_region(C);
 	
-	if(screen)
-		screen->do_draw_gesture= 1;
+	if (screen)
+		screen->do_draw_gesture = 1;
 
 	wm_tag_redraw_overlay(win, ar);
 }
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index e36d9c0..0c95cce 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -63,11 +63,12 @@
 #include "BKE_tracking.h" /* free tracking clipboard */
 
 #include "BLI_listbase.h"
+// #include "BLI_scanfill.h"
 #include "BLI_string.h"
 #include "BLI_utildefines.h"
 
 #include "RE_engine.h"
-#include "RE_pipeline.h"		/* RE_ free stuff */
+#include "RE_pipeline.h"        /* RE_ free stuff */
 
 #ifdef WITH_PYTHON
 #include "BPY_extern.h"
@@ -124,20 +125,20 @@ int wm_start_with_console = 0; /* used in creator.c */
 void WM_init(bContext *C, int argc, const char **argv)
 {
 	if (!G.background) {
-		wm_ghost_init(C);	/* note: it assigns C to ghost! */
+		wm_ghost_init(C);   /* note: it assigns C to ghost! */
 		wm_init_cursor_data();
 	}
 	GHOST_CreateSystemPaths();
 	wm_operatortype_init();
 	WM_menutype_init();
 
-	set_free_windowmanager_cb(wm_close_and_free);	/* library.c */
+	set_free_windowmanager_cb(wm_close_and_free);   /* library.c */
 	set_blender_test_break_cb(wm_window_testbreak); /* blender.c */
 	DAG_editors_update_cb(ED_render_id_flush_update, ED_render_scene_update); /* depsgraph.c */
 	
-	ED_spacetypes_init();	/* editors/space_api/spacetype.c */
+	ED_spacetypes_init();   /* editors/space_api/spacetype.c */
 	
-	ED_file_init();			/* for fsmenu */
+	ED_file_init();         /* for fsmenu */
 	ED_init_node_butfuncs();	
 	
 	BLF_init(11, U.dpi); /* Please update source/gamengine/GamePlayer/GPG_ghost.cpp if you change this */
@@ -161,7 +162,7 @@ void WM_init(bContext *C, int argc, const char **argv)
 
 	BPY_driver_reset();
 	BPY_app_handlers_reset(FALSE); /* causes addon callbacks to be freed [#28068],
-	                           * but this is actually what we want. */
+	                                * but this is actually what we want. */
 	BPY_modules_load_user(C);
 #else
 	(void)argc; /* unused */
@@ -191,21 +192,21 @@ void WM_init(bContext *C, int argc, const char **argv)
 	WM_read_history();
 
 	/* allow a path of "", this is what happens when making a new file */
-	/*
-	if(G.main->name[0] == 0)
+#if 0
+	if (G.main->name[0] == 0)
 		BLI_make_file_string("/", G.main->name, BLI_getDefaultDocumentFolder(), "untitled.blend");
-	*/
+#endif
 
 	BLI_strncpy(G.lib, G.main->name, FILE_MAX);
 }
 
 void WM_init_splash(bContext *C)
 {
-	if((U.uiflag & USER_SPLASH_DISABLE) == 0) {
-		wmWindowManager *wm= CTX_wm_manager(C);
-		wmWindow *prevwin= CTX_wm_window(C);
+	if ((U.uiflag & USER_SPLASH_DISABLE) == 0) {
+		wmWindowManager *wm = CTX_wm_manager(C);
+		wmWindow *prevwin = CTX_wm_window(C);
 	
-		if(wm->windows.first) {
+		if (wm->windows.first) {
 			CTX_wm_window_set(C, wm->windows.first);
 			WM_operator_name_call(C, "WM_OT_splash", WM_OP_INVOKE_DEFAULT, NULL);
 			CTX_wm_window_set(C, prevwin);
@@ -215,28 +216,28 @@ void WM_init_splash(bContext *C)
 
 int WM_init_game(bContext *C)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
-	wmWindow* win;
+	wmWindowManager *wm = CTX_wm_manager(C);
+	wmWindow *win;
 
 	ScrArea *sa;
-	ARegion *ar= NULL;
+	ARegion *ar = NULL;
 
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 
 	if (!scene) {
 		// XXX, this should not be needed.
 		Main *bmain = CTX_data_main(C);
-		scene= bmain->scene.first;
+		scene = bmain->scene.first;
 	}
 
 	win = wm->windows.first;
 
 	//first to get a valid window
-	if(win)
+	if (win)
 		CTX_wm_window_set(C, win);
 
 	sa = BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_VIEW3D, 0);
-	ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+	ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
 
 	// if we have a valid 3D view
 	if (sa && ar) {
@@ -246,32 +247,31 @@ int WM_init_game(bContext *C)
 		CTX_wm_region_set(C, ar);
 
 		/* disable quad view */
-		if(ar->alignment == RGN_ALIGN_QSPLIT)
+		if (ar->alignment == RGN_ALIGN_QSPLIT)
 			WM_operator_name_call(C, "SCREEN_OT_region_quadview", WM_OP_EXEC_DEFAULT, NULL);
 
 		/* toolbox, properties panel and header are hidden */
-		for(arhide=sa->regionbase.first; arhide; arhide=arhide->next) {
-			if(arhide->regiontype != RGN_TYPE_WINDOW) {
-				if(!(arhide->flag & RGN_FLAG_HIDDEN)) {
+		for (arhide = sa->regionbase.first; arhide; arhide = arhide->next) {
+			if (arhide->regiontype != RGN_TYPE_WINDOW) {
+				if (!(arhide->flag & RGN_FLAG_HIDDEN)) {
 					ED_region_toggle_hidden(C, arhide);
 				}
 			}
 		}
 
 		/* full screen the area */
-		if(!sa->full) {
+		if (!sa->full) {
 			ED_screen_full_toggle(C, win, sa);
 		}
 
 		/* Fullscreen */
-		if((scene->gm.playerflag & GAME_PLAYER_FULLSCREEN)) {
+		if ((scene->gm.playerflag & GAME_PLAYER_FULLSCREEN)) {
 			WM_operator_name_call(C, "WM_OT_window_fullscreen_toggle", WM_OP_EXEC_DEFAULT, NULL);
 			wm_get_screensize(&ar->winrct.xmax, &ar->winrct.ymax);
 			ar->winx = ar->winrct.xmax + 1;
 			ar->winy = ar->winrct.ymax + 1;
 		}
-		else
-		{
+		else {
 			GHOST_RectangleHandle rect = GHOST_GetClientBounds(win->ghostwin);
 			ar->winrct.ymax = GHOST_GetHeightRectangle(rect);
 			ar->winrct.xmax = GHOST_GetWidthRectangle(rect);
@@ -286,8 +286,7 @@ int WM_init_game(bContext *C)
 
 		return 1;
 	}
-	else
-	{
+	else {
 		ReportTimerInfo *rti;
 
 		BKE_report(&wm->reports, RPT_ERROR, "No valid 3D View found. Game auto start is not possible.");
@@ -309,7 +308,7 @@ static void free_openrecent(void)
 {
 	struct RecentFile *recent;
 	
-	for(recent = G.recent_files.first; recent; recent=recent->next)
+	for (recent = G.recent_files.first; recent; recent = recent->next)
 		MEM_freeN(recent->filepath);
 	
 	BLI_freelistN(&(G.recent_files));
@@ -318,10 +317,7 @@ static void free_openrecent(void)
 
 /* bad stuff*/
 
-extern wchar_t *copybuf;
-extern wchar_t *copybufinfo;
-
-	// XXX copy/paste buffer stuff...
+// XXX copy/paste buffer stuff...
 extern void free_anim_copybuf(void); 
 extern void free_anim_drivers_copybuf(void); 
 extern void free_fmodifiers_copybuf(void); 
@@ -339,13 +335,13 @@ void WM_exit_ext(bContext *C, const short do_python)
 	/* first wrap up running stuff, we assume only the active WM is running */
 	/* modal handlers are on window level freed, others too? */
 	/* note; same code copied in wm_files.c */
-	if(C && CTX_wm_manager(C)) {
+	if (C && CTX_wm_manager(C)) {
 		
 		WM_jobs_stop_all(CTX_wm_manager(C));
 		
-		for(win= CTX_wm_manager(C)->windows.first; win; win= win->next) {
+		for (win = CTX_wm_manager(C)->windows.first; win; win = win->next) {
 			
-			CTX_wm_window_set(C, win);	/* needed by operator close callbacks */
+			CTX_wm_window_set(C, win);  /* needed by operator close callbacks */
 			WM_event_remove_handlers(C, &win->handlers);
 			WM_event_remove_handlers(C, &win->modalhandlers);
 			ED_screen_exit(C, win, win->screen);
@@ -356,7 +352,7 @@ void WM_exit_ext(bContext *C, const short do_python)
 	WM_menutype_free();
 	
 	/* all non-screen and non-space stuff editors did, like editmode */
-	if(C)
+	if (C)
 		ED_editors_exit(C);
 
 //	XXX	
@@ -370,15 +366,15 @@ void WM_exit_ext(bContext *C, const short do_python)
 	
 	BKE_freecubetable();
 	
-	ED_preview_free_dbase();	/* frees a Main dbase, before free_blender! */
+	ED_preview_free_dbase();  /* frees a Main dbase, before free_blender! */
 
-	if(C && CTX_wm_manager(C))
-		wm_free_reports(C);			/* before free_blender! - since the ListBases get freed there */
+	if (C && CTX_wm_manager(C))
+		wm_free_reports(C);  /* before free_blender! - since the ListBases get freed there */
 
 	seq_free_clipboard(); /* sequencer.c */
 	BKE_tracking_free_clipboard();
 		
-	free_blender();				/* blender.c, does entire library and spacetypes */
+	free_blender();  /* blender.c, does entire library and spacetypes */
 //	free_matcopybuf();
 	free_anim_copybuf();
 	free_anim_drivers_copybuf();
@@ -401,7 +397,7 @@ void WM_exit_ext(bContext *C, const short do_python)
 
 #ifdef WITH_PYTHON
 	/* option not to close python so we can use 'atexit' */
-	if(do_python) {
+	if (do_python) {
 		/* XXX - old note */
 		/* before free_blender so py's gc happens while library still exists */
 		/* needed at least for a rare sigsegv that can happen in pydrivers */
@@ -418,11 +414,9 @@ void WM_exit_ext(bContext *C, const short do_python)
 	GPU_global_buffer_pool_free();
 	GPU_free_unused_buffers();
 	GPU_extensions_exit();
-	
-//	if (copybuf) MEM_freeN(copybuf);
-//	if (copybufinfo) MEM_freeN(copybufinfo);
+
 	if (!G.background) {
-		BKE_undo_save_quit();	// saves quit.blend if global undo is on
+		BKE_undo_save_quit();  /* saves quit.blend if global undo is on */
 	}
 	BKE_reset_undo(); 
 	
@@ -442,7 +436,7 @@ void WM_exit_ext(bContext *C, const short do_python)
 	
 	GHOST_DisposeSystemPaths();
 
-	if(MEM_get_memory_blocks_in_use()!=0) {
+	if (MEM_get_memory_blocks_in_use() != 0) {
 		printf("Error: Not freed memory blocks: %d\n", MEM_get_memory_blocks_in_use());
 		MEM_printmemlist();
 	}
@@ -452,7 +446,7 @@ void WM_exit_ext(bContext *C, const short do_python)
 	
 #ifdef WIN32   
 	/* ask user to press enter when in debug mode */
-	if(G.f & G_DEBUG) {
+	if (G.debug & G_DEBUG) {
 		printf("press enter key to exit...\n\n");
 		getchar();
 	}
@@ -462,5 +456,5 @@ void WM_exit_ext(bContext *C, const short do_python)
 void WM_exit(bContext *C)
 {
 	WM_exit_ext(C, 1);
-	exit(G.afbreek==1);
+	exit(G.afbreek == 1);
 }
diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c
index f2ee5a3..877b8a9 100644
--- a/source/blender/windowmanager/intern/wm_jobs.c
+++ b/source/blender/windowmanager/intern/wm_jobs.c
@@ -58,29 +58,29 @@
 /* ********************** Threaded Jobs Manager ****************************** */
 
 /*
-Add new job
-- register in WM
-- configure callbacks
-
-Start or re-run job
-- if job running
-  - signal job to end
-  - add timer notifier to verify when it has ended, to start it
-- else
-  - start job
-  - add timer notifier to handle progress
-
-Stop job
-  - signal job to end
-	on end, job will tag itself as sleeping
-
-Remove job
-- signal job to end
-	on end, job will remove itself
-
-When job is done:
-- it puts timer to sleep (or removes?)
-
+ * Add new job
+ * - register in WM
+ * - configure callbacks
+ *
+ * Start or re-run job
+ * - if job running
+ *   - signal job to end
+ *   - add timer notifier to verify when it has ended, to start it
+ * - else
+ *   - start job
+ *   - add timer notifier to handle progress
+ *
+ * Stop job
+ *   - signal job to end
+ *  on end, job will tag itself as sleeping
+ *
+ * Remove job
+ * - signal job to end
+ *  on end, job will remove itself
+ *
+ * When job is done:
+ * - it puts timer to sleep (or removes?)
+ *
  */
  
 struct wmJob {
@@ -134,12 +134,12 @@ struct wmJob {
  */
 static wmJob *wm_job_find(wmWindowManager *wm, void *owner, const char *name)
 {
-	wmJob *steve, *found=NULL;
+	wmJob *steve, *found = NULL;
 	
-	for(steve= wm->jobs.first; steve; steve= steve->next)
-		if(steve->owner==owner) {
-			found= steve;
-			if (name && strcmp(steve->name, name)==0)
+	for (steve = wm->jobs.first; steve; steve = steve->next)
+		if (steve->owner == owner) {
+			found = steve;
+			if (name && strcmp(steve->name, name) == 0)
 				return steve;
 		}
 	
@@ -150,18 +150,18 @@ static wmJob *wm_job_find(wmWindowManager *wm, void *owner, const char *name)
 
 /* 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 
-   when stopped it starts the new one */
+ * when stopped it starts the new one */
 wmJob *WM_jobs_get(wmWindowManager *wm, wmWindow *win, void *owner, const char *name, int flag)
 {
-	wmJob *steve= wm_job_find(wm, owner, name);
+	wmJob *steve = wm_job_find(wm, owner, name);
 	
-	if(steve==NULL) {
-		steve= MEM_callocN(sizeof(wmJob), "new job");
+	if (steve == NULL) {
+		steve = MEM_callocN(sizeof(wmJob), "new job");
 	
 		BLI_addtail(&wm->jobs, steve);
-		steve->win= win;
-		steve->owner= owner;
-		steve->flag= flag;
+		steve->win = win;
+		steve->owner = owner;
+		steve->flag = flag;
 		BLI_strncpy(steve->name, name, sizeof(steve->name));
 	}
 	
@@ -173,16 +173,18 @@ int WM_jobs_test(wmWindowManager *wm, void *owner)
 {
 	wmJob *steve;
 	
-	for(steve= wm->jobs.first; steve; steve= steve->next)
-		if(steve->owner==owner)
-			if(steve->running)
+	/* job can be running or about to run (suspended) */
+	for (steve = wm->jobs.first; steve; steve = steve->next)
+		if (steve->owner == owner)
+			if (steve->running || steve->suspended)
 				return 1;
+
 	return 0;
 }
 
 float WM_jobs_progress(wmWindowManager *wm, void *owner)
 {
-	wmJob *steve= wm_job_find(wm, owner, NULL);
+	wmJob *steve = wm_job_find(wm, owner, NULL);
 	
 	if (steve && steve->flag & WM_JOB_PROGRESS)
 		return steve->progress;
@@ -192,7 +194,7 @@ float WM_jobs_progress(wmWindowManager *wm, void *owner)
 
 char *WM_jobs_name(wmWindowManager *wm, void *owner)
 {
-	wmJob *steve= wm_job_find(wm, owner, NULL);
+	wmJob *steve = wm_job_find(wm, owner, NULL);
 	
 	if (steve)
 		return steve->name;
@@ -205,11 +207,12 @@ int WM_jobs_is_running(wmJob *steve)
 	return steve->running;
 }
 
-void* WM_jobs_get_customdata(wmJob * steve)
+void *WM_jobs_get_customdata(wmJob *steve)
 {
 	if (!steve->customdata) {
 		return steve->run_customdata;
-	} else {
+	}
+	else {
 		return steve->customdata;
 	}
 }
@@ -217,15 +220,15 @@ void* WM_jobs_get_customdata(wmJob * steve)
 void WM_jobs_customdata(wmJob *steve, void *customdata, void (*free)(void *))
 {
 	/* pending job? just free */
-	if(steve->customdata)
+	if (steve->customdata)
 		steve->free(steve->customdata);
 	
-	steve->customdata= customdata;
-	steve->free= free;
+	steve->customdata = customdata;
+	steve->free = free;
 
-	if(steve->running) {
+	if (steve->running) {
 		/* signal job to end */
-		steve->stop= 1;
+		steve->stop = 1;
 	}
 }
 
@@ -237,98 +240,98 @@ void WM_jobs_timer(wmJob *steve, double timestep, unsigned int note, unsigned in
 }
 
 void WM_jobs_callbacks(wmJob *steve, 
-					   void (*startjob)(void *, short *, short *, float *),
-					   void (*initjob)(void *),
-					   void (*update)(void  *),
-					   void (*endjob)(void  *))
+                       void (*startjob)(void *, short *, short *, float *),
+                       void (*initjob)(void *),
+                       void (*update)(void *),
+                       void (*endjob)(void *))
 {
-	steve->startjob= startjob;
-	steve->initjob= initjob;
-	steve->update= update;
-	steve->endjob= endjob;
+	steve->startjob = startjob;
+	steve->initjob = initjob;
+	steve->update = update;
+	steve->endjob = endjob;
 }
 
 static void *do_job_thread(void *job_v)
 {
-	wmJob *steve= job_v;
+	wmJob *steve = job_v;
 	
 	steve->startjob(steve->run_customdata, &steve->stop, &steve->do_update, &steve->progress);
-	steve->ready= 1;
+	steve->ready = 1;
 	
 	return NULL;
 }
 
-/* dont allow same startjob to be executed twice */
+/* don't allow same startjob to be executed twice */
 static void wm_jobs_test_suspend_stop(wmWindowManager *wm, wmJob *test)
 {
 	wmJob *steve;
-	int suspend= 0;
+	int suspend = 0;
 	
 	/* job added with suspend flag, we wait 1 timer step before activating it */
-	if(test->flag & WM_JOB_SUSPEND) {
-		suspend= 1;
+	if (test->flag & WM_JOB_SUSPEND) {
+		suspend = 1;
 		test->flag &= ~WM_JOB_SUSPEND;
 	}
 	else {
 		/* check other jobs */
-		for(steve= wm->jobs.first; steve; steve= steve->next) {
+		for (steve = wm->jobs.first; steve; steve = steve->next) {
 			/* obvious case, no test needed */
-			if(steve==test || !steve->running) continue;
+			if (steve == test || !steve->running) continue;
 			
 			/* if new job is not render, then check for same startjob */
-			if(0==(test->flag & WM_JOB_EXCL_RENDER)) 
-				if(steve->startjob!=test->startjob)
+			if (0 == (test->flag & WM_JOB_EXCL_RENDER))
+				if (steve->startjob != test->startjob)
 					continue;
 			
 			/* if new job is render, any render job should be stopped */
-			if(test->flag & WM_JOB_EXCL_RENDER)
-				if(0==(steve->flag & WM_JOB_EXCL_RENDER))
+			if (test->flag & WM_JOB_EXCL_RENDER)
+				if (0 == (steve->flag & WM_JOB_EXCL_RENDER))
 					continue;
 
-			suspend= 1;
+			suspend = 1;
 
 			/* if this job has higher priority, stop others */
-			if(test->flag & WM_JOB_PRIORITY) {
-				steve->stop= 1;
+			if (test->flag & WM_JOB_PRIORITY) {
+				steve->stop = 1;
 				// printf("job stopped: %s\n", steve->name);
 			}
 		}
 	}
 	
 	/* possible suspend ourselfs, waiting for other jobs, or de-suspend */
-	test->suspended= suspend;
-	// if(suspend) printf("job suspended: %s\n", test->name);
+	test->suspended = suspend;
+	// if (suspend) printf("job suspended: %s\n", test->name);
 }
 
 /* if job running, the same owner gave it a new job */
 /* if different owner starts existing startjob, it suspends itself */
 void WM_jobs_start(wmWindowManager *wm, wmJob *steve)
 {
-	if(steve->running) {
+	if (steve->running) {
 		/* signal job to end and restart */
-		steve->stop= 1;
+		steve->stop = 1;
 		// printf("job started a running job, ending... %s\n", steve->name);
 	}
 	else {
 		
-		if(steve->customdata && steve->startjob) {
+		if (steve->customdata && steve->startjob) {
 			
 			wm_jobs_test_suspend_stop(wm, steve);
 			
-			if(steve->suspended==0) {
+			if (steve->suspended == 0) {
 				/* copy to ensure proper free in end */
-				steve->run_customdata= steve->customdata;
-				steve->run_free= steve->free;
-				steve->free= NULL;
-				steve->customdata= NULL;
-				steve->running= 1;
+				steve->run_customdata = steve->customdata;
+				steve->run_free = steve->free;
+				steve->free = NULL;
+				steve->customdata = NULL;
+				steve->running = 1;
 				
-				if(steve->initjob)
+				if (steve->initjob)
 					steve->initjob(steve->run_customdata);
 				
-				steve->stop= 0;
-				steve->ready= 0;
-				steve->progress= 0.0;
+				steve->stop = 0;
+				steve->ready = 0;
+				steve->progress = 0.0;
 
 				// printf("job started: %s\n", steve->name);
 				
@@ -337,8 +340,8 @@ void WM_jobs_start(wmWindowManager *wm, wmJob *steve)
 			}
 			
 			/* restarted job has timer already */
-			if(steve->wt==NULL)
-				steve->wt= WM_event_add_timer(wm, steve->win, TIMERJOBS, steve->timestep);
+			if (steve->wt == NULL)
+				steve->wt = WM_event_add_timer(wm, steve->win, TIMERJOBS, steve->timestep);
 		}
 		else printf("job fails, not initialized\n");
 	}
@@ -347,20 +350,20 @@ void WM_jobs_start(wmWindowManager *wm, wmJob *steve)
 /* stop job, free data completely */
 static void wm_jobs_kill_job(wmWindowManager *wm, wmJob *steve)
 {
-	if(steve->running) {
+	if (steve->running) {
 		/* signal job to end */
-		steve->stop= 1;
+		steve->stop = 1;
 		BLI_end_threads(&steve->threads);
 
-		if(steve->endjob)
+		if (steve->endjob)
 			steve->endjob(steve->run_customdata);
 	}
 	
-	if(steve->wt)
+	if (steve->wt)
 		WM_event_remove_timer(wm, steve->win, steve->wt);
-	if(steve->customdata)
+	if (steve->customdata)
 		steve->free(steve->customdata);
-	if(steve->run_customdata)
+	if (steve->run_customdata)
 		steve->run_free(steve->run_customdata);
 	
 	/* remove steve */
@@ -373,7 +376,7 @@ void WM_jobs_stop_all(wmWindowManager *wm)
 {
 	wmJob *steve;
 	
-	while((steve= wm->jobs.first))
+	while ((steve = wm->jobs.first))
 		wm_jobs_kill_job(wm, steve);
 	
 }
@@ -383,10 +386,10 @@ void WM_jobs_stop(wmWindowManager *wm, void *owner, void *startjob)
 {
 	wmJob *steve;
 	
-	for(steve= wm->jobs.first; steve; steve= steve->next)
-		if(steve->owner==owner || steve->startjob==startjob)
-			if(steve->running)
-				steve->stop= 1;
+	for (steve = wm->jobs.first; steve; steve = steve->next)
+		if (steve->owner == owner || steve->startjob == startjob)
+			if (steve->running)
+				steve->stop = 1;
 }
 
 /* actually terminate thread and job timer */
@@ -394,14 +397,15 @@ void WM_jobs_kill(wmWindowManager *wm, void *owner, void (*startjob)(void *, sho
 {
 	wmJob *steve;
 	
-	steve= wm->jobs.first;
-	while(steve) {
-		if(steve->owner==owner || steve->startjob==startjob) {
-			wmJob* bill = steve;
-			steve= steve->next;
+	steve = wm->jobs.first;
+	while (steve) {
+		if (steve->owner == owner || steve->startjob == startjob) {
+			wmJob *bill = steve;
+			steve = steve->next;
 			wm_jobs_kill_job(wm, bill);
-		} else {
-			steve= steve->next;
+		}
+		else {
+			steve = steve->next;
 		}
 	}
 }
@@ -412,8 +416,8 @@ void wm_jobs_timer_ended(wmWindowManager *wm, wmTimer *wt)
 {
 	wmJob *steve;
 	
-	for(steve= wm->jobs.first; steve; steve= steve->next) {
-		if(steve->wt==wt) {
+	for (steve = wm->jobs.first; steve; steve = steve->next) {
+		if (steve->wt == wt) {
 			wm_jobs_kill_job(wm, steve);
 			return;
 		}
@@ -423,76 +427,77 @@ void wm_jobs_timer_ended(wmWindowManager *wm, wmTimer *wt)
 /* hardcoded to event TIMERJOBS */
 void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
 {
-	wmJob *steve= wm->jobs.first, *stevenext;
-	float total_progress= 0.f;
-	float jobs_progress=0;
+	wmJob *steve = wm->jobs.first, *stevenext;
+	float total_progress = 0.f;
+	float jobs_progress = 0;
 	
 	
-	for(; steve; steve= stevenext) {
-		stevenext= steve->next;
+	for (; steve; steve = stevenext) {
+		stevenext = steve->next;
 		
-		if(steve->wt==wt) {
+		if (steve->wt == wt) {
 			
 			/* running threads */
-			if(steve->threads.first) {
+			if (steve->threads.first) {
 				
 				/* always call note and update when ready */
-				if(steve->do_update || steve->ready) {
-					if(steve->update)
+				if (steve->do_update || steve->ready) {
+					if (steve->update)
 						steve->update(steve->run_customdata);
-					if(steve->note)
+					if (steve->note)
 						WM_event_add_notifier(C, steve->note, NULL);
 
 					if (steve->flag & WM_JOB_PROGRESS)
-						WM_event_add_notifier(C, NC_WM|ND_JOB, NULL);
-					steve->do_update= 0;
+						WM_event_add_notifier(C, NC_WM | ND_JOB, NULL);
+					steve->do_update = 0;
 				}	
 				
-				if(steve->ready) {
-					if(steve->endjob)
+				if (steve->ready) {
+					if (steve->endjob)
 						steve->endjob(steve->run_customdata);
 
 					/* free own data */
 					steve->run_free(steve->run_customdata);
-					steve->run_customdata= NULL;
-					steve->run_free= NULL;
+					steve->run_customdata = NULL;
+					steve->run_free = NULL;
 					
-					// if(steve->stop) printf("job ready but stopped %s\n", steve->name);
+					// if (steve->stop) printf("job ready but stopped %s\n", steve->name);
 					// else printf("job finished %s\n", steve->name);
 
-					steve->running= 0;
+					steve->running = 0;
 					BLI_end_threads(&steve->threads);
 					
-					if(steve->endnote)
+					if (steve->endnote)
 						WM_event_add_notifier(C, steve->endnote, NULL);
 					
-					WM_event_add_notifier(C, NC_WM|ND_JOB, NULL);
+					WM_event_add_notifier(C, NC_WM | ND_JOB, NULL);
 					
 					/* new job added for steve? */
-					if(steve->customdata) {
+					if (steve->customdata) {
 						// printf("job restarted with new data %s\n", steve->name);
 						WM_jobs_start(wm, steve);
 					}
 					else {
 						WM_event_remove_timer(wm, steve->win, steve->wt);
-						steve->wt= NULL;
+						steve->wt = NULL;
 						
 						/* remove steve */
 						BLI_remlink(&wm->jobs, steve);
 						MEM_freeN(steve);
 					}
-				} else if (steve->flag & WM_JOB_PROGRESS) {
+				}
+				else if (steve->flag & WM_JOB_PROGRESS) {
 					/* accumulate global progress for running jobs */
 					jobs_progress++;
 					total_progress += steve->progress;
 				}
 			}
-			else if(steve->suspended) {
+			else if (steve->suspended) {
 				WM_jobs_start(wm, steve);
 			}
 		}
-		else if(steve->threads.first && !steve->ready) {
-			if(steve->flag & WM_JOB_PROGRESS) {
+		else if (steve->threads.first && !steve->ready) {
+			if (steve->flag & WM_JOB_PROGRESS) {
 				/* accumulate global progress for running jobs */
 				jobs_progress++;
 				total_progress += steve->progress;
@@ -501,12 +506,13 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
 	}
 	
 	/* on file load 'winactive' can be NULL, possibly it should not happen but for now do a NULL check - campbell */
-	if(wm->winactive) {
+	if (wm->winactive) {
 		/* if there are running jobs, set the global progress indicator */
 		if (jobs_progress > 0) {
 			float progress = total_progress / (float)jobs_progress;
 			WM_progress_set(wm->winactive, progress);
-		} else {
+		}
+		else {
 			WM_progress_clear(wm->winactive);
 		}
 	}
@@ -516,8 +522,8 @@ int WM_jobs_has_running(wmWindowManager *wm)
 {
 	wmJob *steve;
 
-	for(steve= wm->jobs.first; steve; steve= steve->next)
-		if(steve->running)
+	for (steve = wm->jobs.first; steve; steve = steve->next)
+		if (steve->running)
 			return 1;
 
 	return 0;
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 661bd90..4800202 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -67,15 +67,15 @@ static wmKeyMapItem *wm_keymap_item_copy(wmKeyMapItem *kmi)
 {
 	wmKeyMapItem *kmin = MEM_dupallocN(kmi);
 
-	kmin->prev= kmin->next= NULL;
+	kmin->prev = kmin->next = NULL;
 	kmin->flag &= ~KMI_UPDATE;
 
-	if(kmin->properties) {
-		kmin->ptr= MEM_callocN(sizeof(PointerRNA), "UserKeyMapItemPtr");
+	if (kmin->properties) {
+		kmin->ptr = MEM_callocN(sizeof(PointerRNA), "UserKeyMapItemPtr");
 		WM_operator_properties_create(kmin->ptr, kmin->idname);
 
-		kmin->properties= IDP_CopyProperty(kmin->properties);
-		kmin->ptr->data= kmin->properties;
+		kmin->properties = IDP_CopyProperty(kmin->properties);
+		kmin->ptr->data = kmin->properties;
 	}
 
 	return kmin;
@@ -84,7 +84,7 @@ static wmKeyMapItem *wm_keymap_item_copy(wmKeyMapItem *kmi)
 static void wm_keymap_item_free(wmKeyMapItem *kmi)
 {
 	/* not kmi itself */
-	if(kmi->ptr) {
+	if (kmi->ptr) {
 		WM_operator_properties_free(kmi->ptr);
 		MEM_freeN(kmi->ptr);
 	}
@@ -98,14 +98,14 @@ static void wm_keymap_item_properties_set(wmKeyMapItem *kmi)
 
 static int wm_keymap_item_equals_result(wmKeyMapItem *a, wmKeyMapItem *b)
 {
-	if(strcmp(a->idname, b->idname) != 0)
+	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 (!((a->ptr == NULL && b->ptr == NULL) ||
+	      (a->ptr && b->ptr && IDP_EqualsProperties(a->ptr->data, b->ptr->data))))
 		return 0;
 	
-	if((a->flag & KMI_INACTIVE) != (b->flag & KMI_INACTIVE))
+	if ((a->flag & KMI_INACTIVE) != (b->flag & KMI_INACTIVE))
 		return 0;
 	
 	return (a->propvalue == b->propvalue);
@@ -144,9 +144,9 @@ static wmKeyMapDiffItem *wm_keymap_diff_item_copy(wmKeyMapDiffItem *kmdi)
 	wmKeyMapDiffItem *kmdin = MEM_dupallocN(kmdi);
 
 	kmdin->next = kmdin->prev = NULL;
-	if(kmdi->add_item)
+	if (kmdi->add_item)
 		kmdin->add_item = wm_keymap_item_copy(kmdi->add_item);
-	if(kmdi->remove_item)
+	if (kmdi->remove_item)
 		kmdin->remove_item = wm_keymap_item_copy(kmdi->remove_item);
 	
 	return kmdin;
@@ -154,11 +154,11 @@ static wmKeyMapDiffItem *wm_keymap_diff_item_copy(wmKeyMapDiffItem *kmdi)
 
 static void wm_keymap_diff_item_free(wmKeyMapDiffItem *kmdi)
 {
-	if(kmdi->remove_item) {
+	if (kmdi->remove_item) {
 		wm_keymap_item_free(kmdi->remove_item);
 		MEM_freeN(kmdi->remove_item);
 	}
-	if(kmdi->add_item) {
+	if (kmdi->add_item) {
 		wm_keymap_item_free(kmdi->add_item);
 		MEM_freeN(kmdi->add_item);
 	}
@@ -172,7 +172,7 @@ wmKeyConfig *WM_keyconfig_new(wmWindowManager *wm, const char *idname)
 {
 	wmKeyConfig *keyconf;
 	
-	keyconf= MEM_callocN(sizeof(wmKeyConfig), "wmKeyConfig");
+	keyconf = MEM_callocN(sizeof(wmKeyConfig), "wmKeyConfig");
 	BLI_strncpy(keyconf->idname, idname, sizeof(keyconf->idname));
 	BLI_addtail(&wm->keyconfigs, keyconf);
 
@@ -205,7 +205,7 @@ void WM_keyconfig_free(wmKeyConfig *keyconf)
 {
 	wmKeyMap *km;
 
-	while((km= keyconf->keymaps.first)) {
+	while ((km = keyconf->keymaps.first)) {
 		WM_keymap_free(km);
 		BLI_freelinkN(&keyconf->keymaps, km);
 	}
@@ -217,8 +217,8 @@ static wmKeyConfig *wm_keyconfig_list_find(ListBase *lb, char *idname)
 {
 	wmKeyConfig *kc;
 
-	for(kc= lb->first; kc; kc= kc->next)
-		if(0==strncmp(idname, kc->idname, KMAP_MAX_NAME))
+	for (kc = lb->first; kc; kc = kc->next)
+		if (0 == strncmp(idname, kc->idname, KMAP_MAX_NAME))
 			return kc;
 	
 	return NULL;
@@ -229,8 +229,8 @@ static wmKeyConfig *WM_keyconfig_active(wmWindowManager *wm)
 	wmKeyConfig *keyconf;
 
 	/* first try from preset */
-	keyconf= wm_keyconfig_list_find(&wm->keyconfigs, U.keyconfigstr);
-	if(keyconf)
+	keyconf = wm_keyconfig_list_find(&wm->keyconfigs, U.keyconfigstr);
+	if (keyconf)
 		return keyconf;
 	
 	/* otherwise use default */
@@ -240,7 +240,7 @@ static wmKeyConfig *WM_keyconfig_active(wmWindowManager *wm)
 void WM_keyconfig_set_active(wmWindowManager *wm, const char *idname)
 {
 	/* setting a different key configuration as active: we ensure all is
-	   updated properly before and after making the change */
+	 * updated properly before and after making the change */
 
 	WM_keyconfig_update(wm);
 
@@ -255,11 +255,11 @@ void WM_keyconfig_set_active(wmWindowManager *wm, const char *idname)
 
 static wmKeyMap *wm_keymap_new(const char *idname, int spaceid, int regionid)
 {
-	wmKeyMap *km= MEM_callocN(sizeof(struct wmKeyMap), "keymap list");
+	wmKeyMap *km = MEM_callocN(sizeof(struct wmKeyMap), "keymap list");
 
 	BLI_strncpy(km->idname, idname, KMAP_MAX_NAME);
-	km->spaceid= spaceid;
-	km->regionid= regionid;
+	km->spaceid = spaceid;
+	km->regionid = regionid;
 
 	return km;
 }
@@ -270,18 +270,18 @@ static wmKeyMap *wm_keymap_copy(wmKeyMap *keymap)
 	wmKeyMapItem *kmi, *kmin;
 	wmKeyMapDiffItem *kmdi, *kmdin;
 
-	keymapn->modal_items= keymap->modal_items;
-	keymapn->poll= keymap->poll;
-	keymapn->items.first= keymapn->items.last= NULL;
-	keymapn->flag &= ~(KEYMAP_UPDATE|KEYMAP_EXPANDED);
+	keymapn->modal_items = keymap->modal_items;
+	keymapn->poll = keymap->poll;
+	keymapn->items.first = keymapn->items.last = NULL;
+	keymapn->flag &= ~(KEYMAP_UPDATE | KEYMAP_EXPANDED);
 
-	for(kmdi=keymap->diff_items.first; kmdi; kmdi=kmdi->next) {
-		kmdin= wm_keymap_diff_item_copy(kmdi);
+	for (kmdi = keymap->diff_items.first; kmdi; kmdi = kmdi->next) {
+		kmdin = wm_keymap_diff_item_copy(kmdi);
 		BLI_addtail(&keymapn->items, kmdin);
 	}
 
-	for(kmi=keymap->items.first; kmi; kmi=kmi->next) {
-		kmin= wm_keymap_item_copy(kmi);
+	for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
+		kmin = wm_keymap_item_copy(kmi);
 		BLI_addtail(&keymapn->items, kmin);
 	}
 
@@ -293,10 +293,10 @@ void WM_keymap_free(wmKeyMap *keymap)
 	wmKeyMapItem *kmi;
 	wmKeyMapDiffItem *kmdi;
 
-	for(kmdi=keymap->diff_items.first; kmdi; kmdi=kmdi->next)
+	for (kmdi = keymap->diff_items.first; kmdi; kmdi = kmdi->next)
 		wm_keymap_diff_item_free(kmdi);
 
-	for(kmi=keymap->items.first; kmi; kmi=kmi->next)
+	for (kmi = keymap->items.first; kmi; kmi = kmi->next)
 		wm_keymap_item_free(kmi);
 
 	BLI_freelistN(&keymap->diff_items);
@@ -305,18 +305,18 @@ void WM_keymap_free(wmKeyMap *keymap)
 
 static void keymap_event_set(wmKeyMapItem *kmi, short type, short val, int modifier, short keymodifier)
 {
-	kmi->type= type;
-	kmi->val= val;
-	kmi->keymodifier= keymodifier;
+	kmi->type = type;
+	kmi->val = val;
+	kmi->keymodifier = keymodifier;
 
-	if(modifier == KM_ANY) {
-		kmi->shift= kmi->ctrl= kmi->alt= kmi->oskey= KM_ANY;
+	if (modifier == KM_ANY) {
+		kmi->shift = kmi->ctrl = kmi->alt = kmi->oskey = KM_ANY;
 	}
 	else {
-		kmi->shift= (modifier & KM_SHIFT) ? KM_MOD_FIRST : ((modifier & KM_SHIFT2) ? KM_MOD_SECOND : FALSE);
-		kmi->ctrl=  (modifier & KM_CTRL)  ? KM_MOD_FIRST : ((modifier & KM_CTRL2)  ? KM_MOD_SECOND : FALSE);
-		kmi->alt=   (modifier & KM_ALT)   ? KM_MOD_FIRST : ((modifier & KM_ALT2)   ? KM_MOD_SECOND : FALSE);
-		kmi->oskey= (modifier & KM_OSKEY) ? KM_MOD_FIRST : ((modifier & KM_OSKEY2) ? KM_MOD_SECOND : FALSE);
+		kmi->shift = (modifier & KM_SHIFT) ? KM_MOD_FIRST : ((modifier & KM_SHIFT2) ? KM_MOD_SECOND : FALSE);
+		kmi->ctrl =  (modifier & KM_CTRL)  ? KM_MOD_FIRST : ((modifier & KM_CTRL2)  ? KM_MOD_SECOND : FALSE);
+		kmi->alt =   (modifier & KM_ALT)   ? KM_MOD_FIRST : ((modifier & KM_ALT2)   ? KM_MOD_SECOND : FALSE);
+		kmi->oskey = (modifier & KM_OSKEY) ? KM_MOD_FIRST : ((modifier & KM_OSKEY2) ? KM_MOD_SECOND : FALSE);
 	}
 }
 
@@ -325,7 +325,8 @@ static void keymap_item_set_id(wmKeyMap *keymap, wmKeyMapItem *kmi)
 	keymap->kmi_id++;
 	if ((keymap->flag & KEYMAP_USER) == 0) {
 		kmi->id = keymap->kmi_id;
-	} else {
+	}
+	else {
 		kmi->id = -keymap->kmi_id; // User defined keymap entries have negative ids
 	}
 }
@@ -335,11 +336,11 @@ wmKeyMapItem *WM_keymap_verify_item(wmKeyMap *keymap, const char *idname, int ty
 {
 	wmKeyMapItem *kmi;
 	
-	for(kmi= keymap->items.first; kmi; kmi= kmi->next)
-		if(strncmp(kmi->idname, idname, OP_MAX_TYPENAME)==0)
+	for (kmi = keymap->items.first; kmi; kmi = kmi->next)
+		if (strncmp(kmi->idname, idname, OP_MAX_TYPENAME) == 0)
 			break;
-	if(kmi==NULL) {
-		kmi= MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
+	if (kmi == NULL) {
+		kmi = MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
 		
 		BLI_addtail(&keymap->items, kmi);
 		BLI_strncpy(kmi->idname, idname, OP_MAX_TYPENAME);
@@ -355,7 +356,7 @@ wmKeyMapItem *WM_keymap_verify_item(wmKeyMap *keymap, const char *idname, int ty
 /* always add item */
 wmKeyMapItem *WM_keymap_add_item(wmKeyMap *keymap, const char *idname, int type, int val, int modifier, int keymodifier)
 {
-	wmKeyMapItem *kmi= MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
+	wmKeyMapItem *kmi = MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
 	
 	BLI_addtail(&keymap->items, kmi);
 	BLI_strncpy(kmi->idname, idname, OP_MAX_TYPENAME);
@@ -373,15 +374,15 @@ wmKeyMapItem *WM_keymap_add_item(wmKeyMap *keymap, const char *idname, int type,
 /* menu wrapper for WM_keymap_add_item */
 wmKeyMapItem *WM_keymap_add_menu(wmKeyMap *keymap, const char *idname, int type, int val, int modifier, int keymodifier)
 {
-	wmKeyMapItem *kmi= WM_keymap_add_item(keymap, "WM_OT_call_menu", type, val, modifier, keymodifier);
+	wmKeyMapItem *kmi = WM_keymap_add_item(keymap, "WM_OT_call_menu", type, val, modifier, keymodifier);
 	RNA_string_set(kmi->ptr, "name", idname);
 	return kmi;
 }
 
 void WM_keymap_remove_item(wmKeyMap *keymap, wmKeyMapItem *kmi)
 {
-	if(BLI_findindex(&keymap->items, kmi) != -1) {
-		if(kmi->ptr) {
+	if (BLI_findindex(&keymap->items, kmi) != -1) {
+		if (kmi->ptr) {
 			WM_operator_properties_free(kmi->ptr);
 			MEM_freeN(kmi->ptr);
 		}
@@ -401,7 +402,7 @@ static void wm_keymap_addon_add(wmKeyMap *keymap, wmKeyMap *addonmap)
 {
 	wmKeyMapItem *kmi, *kmin;
 
-	for(kmi=addonmap->items.first; kmi; kmi=kmi->next) {
+	for (kmi = addonmap->items.first; kmi; kmi = kmi->next) {
 		kmin = wm_keymap_item_copy(kmi);
 		keymap_item_set_id(keymap, kmin);
 		BLI_addhead(&keymap->items, kmin);
@@ -412,8 +413,8 @@ static wmKeyMapItem *wm_keymap_find_item_equals(wmKeyMap *km, wmKeyMapItem *need
 {
 	wmKeyMapItem *kmi;
 
-	for(kmi=km->items.first; kmi; kmi=kmi->next)
-		if(wm_keymap_item_equals(kmi, needle))
+	for (kmi = km->items.first; kmi; kmi = kmi->next)
+		if (wm_keymap_item_equals(kmi, needle))
 			return kmi;
 	
 	return NULL;
@@ -423,8 +424,8 @@ static wmKeyMapItem *wm_keymap_find_item_equals_result(wmKeyMap *km, wmKeyMapIte
 {
 	wmKeyMapItem *kmi;
 
-	for(kmi=km->items.first; kmi; kmi=kmi->next)
-		if(wm_keymap_item_equals_result(kmi, needle))
+	for (kmi = km->items.first; kmi; kmi = kmi->next)
+		if (wm_keymap_item_equals_result(kmi, needle))
 			return kmi;
 	
 	return NULL;
@@ -435,16 +436,16 @@ static void wm_keymap_diff(wmKeyMap *diff_km, wmKeyMap *from_km, wmKeyMap *to_km
 	wmKeyMapItem *kmi, *to_kmi, *orig_kmi;
 	wmKeyMapDiffItem *kmdi;
 
-	for(kmi=from_km->items.first; kmi; kmi=kmi->next) {
+	for (kmi = from_km->items.first; kmi; kmi = kmi->next) {
 		to_kmi = WM_keymap_item_find_id(to_km, kmi->id);
 
-		if(!to_kmi) {
+		if (!to_kmi) {
 			/* remove item */
 			kmdi = MEM_callocN(sizeof(wmKeyMapDiffItem), "wmKeyMapDiffItem");
 			kmdi->remove_item = wm_keymap_item_copy(kmi);
 			BLI_addtail(&diff_km->diff_items, kmdi);
 		}
-		else if(to_kmi && !wm_keymap_item_equals(kmi, to_kmi)) {
+		else if (to_kmi && !wm_keymap_item_equals(kmi, to_kmi)) {
 			/* replace item */
 			kmdi = MEM_callocN(sizeof(wmKeyMapDiffItem), "wmKeyMapDiffItem");
 			kmdi->remove_item = wm_keymap_item_copy(kmi);
@@ -453,21 +454,21 @@ static void wm_keymap_diff(wmKeyMap *diff_km, wmKeyMap *from_km, wmKeyMap *to_km
 		}
 
 		/* sync expanded flag back to original so we don't loose it on repatch */
-		if(to_kmi) {
+		if (to_kmi) {
 			orig_kmi = WM_keymap_item_find_id(orig_km, kmi->id);
 
-			if(!orig_kmi)
+			if (!orig_kmi)
 				orig_kmi = wm_keymap_find_item_equals(addon_km, kmi);
 
-			if(orig_kmi) {
+			if (orig_kmi) {
 				orig_kmi->flag &= ~KMI_EXPANDED;
 				orig_kmi->flag |= (to_kmi->flag & KMI_EXPANDED);
 			}
 		}
 	}
 
-	for(kmi=to_km->items.first; kmi; kmi=kmi->next) {
-		if(kmi->id < 0) {
+	for (kmi = to_km->items.first; kmi; kmi = kmi->next) {
+		if (kmi->id < 0) {
 			/* add item */
 			kmdi = MEM_callocN(sizeof(wmKeyMapDiffItem), "wmKeyMapDiffItem");
 			kmdi->add_item = wm_keymap_item_copy(kmi);
@@ -481,23 +482,23 @@ static void wm_keymap_patch(wmKeyMap *km, wmKeyMap *diff_km)
 	wmKeyMapDiffItem *kmdi;
 	wmKeyMapItem *kmi_remove, *kmi_add;
 
-	for(kmdi=diff_km->diff_items.first; kmdi; kmdi=kmdi->next) {
+	for (kmdi = diff_km->diff_items.first; kmdi; kmdi = kmdi->next) {
 		/* find item to remove */
 		kmi_remove = NULL;
-		if(kmdi->remove_item) {
+		if (kmdi->remove_item) {
 			kmi_remove = wm_keymap_find_item_equals(km, kmdi->remove_item);
-			if(!kmi_remove)
+			if (!kmi_remove)
 				kmi_remove = wm_keymap_find_item_equals_result(km, kmdi->remove_item);
 		}
 
 		/* add item */
-		if(kmdi->add_item) {
+		if (kmdi->add_item) {
 			/* only if nothing to remove or item to remove found */
-			if(!kmdi->remove_item || kmi_remove) {
+			if (!kmdi->remove_item || kmi_remove) {
 				kmi_add = wm_keymap_item_copy(kmdi->add_item);
 				kmi_add->flag |= KMI_USER_MODIFIED;
 
-				if(kmi_remove) {
+				if (kmi_remove) {
 					kmi_add->flag &= ~KMI_EXPANDED;
 					kmi_add->flag |= (kmi_remove->flag & KMI_EXPANDED);
 					kmi_add->id = kmi_remove->id;
@@ -511,7 +512,7 @@ static void wm_keymap_patch(wmKeyMap *km, wmKeyMap *diff_km)
 		}
 
 		/* remove item */
-		if(kmi_remove) {
+		if (kmi_remove) {
 			wm_keymap_item_free(kmi_remove);
 			BLI_freelinkN(&km->items, kmi_remove);
 		}
@@ -525,27 +526,27 @@ static wmKeyMap *wm_keymap_patch_update(ListBase *lb, wmKeyMap *defaultmap, wmKe
 
 	/* remove previous keymap in list, we will replace it */
 	km = WM_keymap_list_find(lb, defaultmap->idname, defaultmap->spaceid, defaultmap->regionid);
-	if(km) {
-		expanded = (km->flag & (KEYMAP_EXPANDED|KEYMAP_CHILDREN_EXPANDED));
+	if (km) {
+		expanded = (km->flag & (KEYMAP_EXPANDED | KEYMAP_CHILDREN_EXPANDED));
 		WM_keymap_free(km);
 		BLI_freelinkN(lb, km);
 	}
 
 	/* copy new keymap from an existing one */
-	if(usermap && !(usermap->flag & KEYMAP_DIFF)) {
+	if (usermap && !(usermap->flag & KEYMAP_DIFF)) {
 		/* for compatibiltiy with old user preferences with non-diff
-		   keymaps we override the original entirely */
+		 * keymaps we override the original entirely */
 		wmKeyMapItem *kmi, *orig_kmi;
 
 		km = wm_keymap_copy(usermap);
 
 		/* try to find corresponding id's for items */
-		for(kmi=km->items.first; kmi; kmi=kmi->next) {
+		for (kmi = km->items.first; kmi; kmi = kmi->next) {
 			orig_kmi = wm_keymap_find_item_equals(defaultmap, kmi);
-			if(!orig_kmi)
+			if (!orig_kmi)
 				orig_kmi = wm_keymap_find_item_equals_result(defaultmap, kmi);
 
-			if(orig_kmi)
+			if (orig_kmi)
 				kmi->id = orig_kmi->id;
 			else
 				kmi->id = -(km->kmi_id++);
@@ -557,16 +558,16 @@ static wmKeyMap *wm_keymap_patch_update(ListBase *lb, wmKeyMap *defaultmap, wmKe
 		km = wm_keymap_copy(defaultmap);
 
 	/* add addon keymap items */
-	if(addonmap)
+	if (addonmap)
 		wm_keymap_addon_add(km, addonmap);
 
 	/* tag as being user edited */
-	if(usermap)
+	if (usermap)
 		km->flag |= KEYMAP_USER_MODIFIED;
-	km->flag |= KEYMAP_USER|expanded;
+	km->flag |= KEYMAP_USER | expanded;
 
 	/* apply user changes of diff keymap */
-	if(usermap && (usermap->flag & KEYMAP_DIFF))
+	if (usermap && (usermap->flag & KEYMAP_DIFF))
 		wm_keymap_patch(km, usermap);
 
 	/* add to list */
@@ -582,27 +583,27 @@ static void wm_keymap_diff_update(ListBase *lb, wmKeyMap *defaultmap, wmKeyMap *
 	/* create temporary default + addon keymap for diff */
 	origmap = defaultmap;
 
-	if(addonmap) {
+	if (addonmap) {
 		defaultmap = wm_keymap_copy(defaultmap);
 		wm_keymap_addon_add(defaultmap, addonmap);
 	}
 
 	/* remove previous diff keymap in list, we will replace it */
 	prevmap = WM_keymap_list_find(lb, km->idname, km->spaceid, km->regionid);
-	if(prevmap) {
+	if (prevmap) {
 		WM_keymap_free(prevmap);
 		BLI_freelinkN(lb, prevmap);
 	}
 
 	/* create diff keymap */
-	diffmap= wm_keymap_new(km->idname, km->spaceid, km->regionid);
+	diffmap = wm_keymap_new(km->idname, km->spaceid, km->regionid);
 	diffmap->flag |= KEYMAP_DIFF;
-	if(defaultmap->flag & KEYMAP_MODAL)
+	if (defaultmap->flag & KEYMAP_MODAL)
 		diffmap->flag |= KEYMAP_MODAL;
 	wm_keymap_diff(diffmap, defaultmap, km, origmap, addonmap);
 
 	/* add to list if not empty */
-	if(diffmap->diff_items.first) {
+	if (diffmap->diff_items.first) {
 		BLI_addtail(lb, diffmap);
 	}
 	else {
@@ -611,7 +612,7 @@ static void wm_keymap_diff_update(ListBase *lb, wmKeyMap *defaultmap, wmKeyMap *
 	}
 
 	/* free temporary default map */
-	if(addonmap) {
+	if (addonmap) {
 		WM_keymap_free(defaultmap);
 		MEM_freeN(defaultmap);
 	}
@@ -620,16 +621,16 @@ static void wm_keymap_diff_update(ListBase *lb, wmKeyMap *defaultmap, wmKeyMap *
 /* ****************** storage in WM ************ */
 
 /* name id's are for storing general or multiple keymaps, 
-   space/region ids are same as DNA_space_types.h */
-/* gets free'd in wm.c */
+ * space/region ids are same as DNA_space_types.h */
+/* gets freed in wm.c */
 
 wmKeyMap *WM_keymap_list_find(ListBase *lb, const char *idname, int spaceid, int regionid)
 {
 	wmKeyMap *km;
 
-	for(km= lb->first; km; km= km->next)
-		if(km->spaceid==spaceid && km->regionid==regionid)
-			if(0==strncmp(idname, km->idname, KMAP_MAX_NAME))
+	for (km = lb->first; km; km = km->next)
+		if (km->spaceid == spaceid && km->regionid == regionid)
+			if (0 == strncmp(idname, km->idname, KMAP_MAX_NAME))
 				return km;
 	
 	return NULL;
@@ -637,10 +638,10 @@ wmKeyMap *WM_keymap_list_find(ListBase *lb, const char *idname, int spaceid, int
 
 wmKeyMap *WM_keymap_find(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
 {
-	wmKeyMap *km= WM_keymap_list_find(&keyconf->keymaps, idname, spaceid, regionid);
+	wmKeyMap *km = WM_keymap_list_find(&keyconf->keymaps, idname, spaceid, regionid);
 	
-	if(km==NULL) {
-		km= wm_keymap_new(idname, spaceid, regionid);
+	if (km == NULL) {
+		km = wm_keymap_new(idname, spaceid, regionid);
 		BLI_addtail(&keyconf->keymaps, km);
 
 		WM_keyconfig_update_tag(km, NULL);
@@ -651,7 +652,7 @@ wmKeyMap *WM_keymap_find(wmKeyConfig *keyconf, const char *idname, int spaceid,
 
 wmKeyMap *WM_keymap_find_all(const bContext *C, const char *idname, int spaceid, int regionid)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 
 	return WM_keymap_list_find(&wm->userconf->keymaps, idname, spaceid, regionid);
 }
@@ -662,16 +663,16 @@ wmKeyMap *WM_keymap_find_all(const bContext *C, const char *idname, int spaceid,
 
 wmKeyMap *WM_modalkeymap_add(wmKeyConfig *keyconf, const char *idname, EnumPropertyItem *items)
 {
-	wmKeyMap *km= WM_keymap_find(keyconf, idname, 0, 0);
+	wmKeyMap *km = WM_keymap_find(keyconf, idname, 0, 0);
 	km->flag |= KEYMAP_MODAL;
-	km->modal_items= items;
+	km->modal_items = items;
 
-	if(!items) {
+	if (!items) {
 		/* init modal items from default config */
 		wmWindowManager *wm = G.main->wm.first;
-		wmKeyMap *defaultkm= WM_keymap_list_find(&wm->defaultconf->keymaps, km->idname, 0, 0);
+		wmKeyMap *defaultkm = WM_keymap_list_find(&wm->defaultconf->keymaps, km->idname, 0, 0);
 
-		if(defaultkm) {
+		if (defaultkm) {
 			km->modal_items = defaultkm->modal_items;
 			km->poll = defaultkm->poll;
 		}
@@ -684,9 +685,9 @@ wmKeyMap *WM_modalkeymap_get(wmKeyConfig *keyconf, const char *idname)
 {
 	wmKeyMap *km;
 	
-	for(km= keyconf->keymaps.first; km; km= km->next)
-		if(km->flag & KEYMAP_MODAL)
-			if(0==strncmp(idname, km->idname, KMAP_MAX_NAME))
+	for (km = keyconf->keymaps.first; km; km = km->next)
+		if (km->flag & KEYMAP_MODAL)
+			if (0 == strncmp(idname, km->idname, KMAP_MAX_NAME))
 				break;
 	
 	return km;
@@ -695,10 +696,10 @@ wmKeyMap *WM_modalkeymap_get(wmKeyConfig *keyconf, const char *idname)
 
 wmKeyMapItem *WM_modalkeymap_add_item(wmKeyMap *km, int type, int val, int modifier, int keymodifier, int value)
 {
-	wmKeyMapItem *kmi= MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
+	wmKeyMapItem *kmi = MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
 	
 	BLI_addtail(&km->items, kmi);
-	kmi->propvalue= value;
+	kmi->propvalue = value;
 	
 	keymap_event_set(kmi, type, val, modifier, keymodifier);
 
@@ -709,22 +710,65 @@ wmKeyMapItem *WM_modalkeymap_add_item(wmKeyMap *km, int type, int val, int modif
 	return kmi;
 }
 
+wmKeyMapItem *WM_modalkeymap_add_item_str(wmKeyMap *km, int type, int val, int modifier, int keymodifier, const char *value)
+{
+	wmKeyMapItem *kmi = MEM_callocN(sizeof(wmKeyMapItem), "keymap entry");
+
+	BLI_addtail(&km->items, kmi);
+	BLI_strncpy(kmi->propvalue_str, value, sizeof(kmi->propvalue_str));
+
+	keymap_event_set(kmi, type, val, modifier, keymodifier);
+
+	keymap_item_set_id(km, kmi);
+
+	WM_keyconfig_update_tag(km, kmi);
+
+	return kmi;
+}
+
 void WM_modalkeymap_assign(wmKeyMap *km, const char *opname)
 {
-	wmOperatorType *ot= WM_operatortype_find(opname, 0);
+	wmOperatorType *ot = WM_operatortype_find(opname, 0);
 	
-	if(ot)
-		ot->modalkeymap= km;
+	if (ot)
+		ot->modalkeymap = km;
 	else
 		printf("error: modalkeymap_assign, unknown operator %s\n", opname);
 }
 
+static void wm_user_modal_keymap_set_items(wmWindowManager *wm, wmKeyMap *km)
+{
+	/* here we convert propvalue string values delayed, due to python keymaps
+	 * being created before the actual modal keymaps, so no modal_items */
+	wmKeyMap *defaultkm;
+	wmKeyMapItem *kmi;
+	int propvalue;
+
+	if (km && (km->flag & KEYMAP_MODAL) && !km->modal_items) {
+		defaultkm = WM_keymap_list_find(&wm->defaultconf->keymaps, km->idname, 0, 0);
+
+		if (!defaultkm)
+			return;
+
+		km->modal_items = defaultkm->modal_items;
+		km->poll = defaultkm->poll;
+
+		for (kmi = km->items.first; kmi; kmi = kmi->next) {
+			if (kmi->propvalue_str[0]) {
+				if (RNA_enum_value_from_id(km->modal_items, kmi->propvalue_str, &propvalue))
+					kmi->propvalue = propvalue;
+				kmi->propvalue_str[0] = '\0';
+			}
+		}
+	}
+}
+
 /* ***************** get string from key events **************** */
 
 const char *WM_key_event_string(short type)
 {
-	const char *name= NULL;
-	if(RNA_enum_name(event_type_items, (int)type, &name))
+	const char *name = NULL;
+	if (RNA_enum_name(event_type_items, (int)type, &name))
 		return name;
 	
 	return "";
@@ -734,29 +778,30 @@ char *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len)
 {
 	char buf[128];
 
-	buf[0]= 0;
+	buf[0] = 0;
 
 	if (kmi->shift == KM_ANY &&
-		kmi->ctrl == KM_ANY &&
-		kmi->alt == KM_ANY &&
-		kmi->oskey == KM_ANY) {
+	    kmi->ctrl == KM_ANY &&
+	    kmi->alt == KM_ANY &&
+	    kmi->oskey == KM_ANY) {
 
 		strcat(buf, "Any ");
-	} else {
-		if(kmi->shift)
+	}
+	else {
+		if (kmi->shift)
 			strcat(buf, "Shift ");
 
-		if(kmi->ctrl)
+		if (kmi->ctrl)
 			strcat(buf, "Ctrl ");
 
-		if(kmi->alt)
+		if (kmi->alt)
 			strcat(buf, "Alt ");
 
-		if(kmi->oskey)
+		if (kmi->oskey)
 			strcat(buf, "Cmd ");
 	}
 		
-	if(kmi->keymodifier) {
+	if (kmi->keymodifier) {
 		strcat(buf, WM_key_event_string(kmi->keymodifier));
 		strcat(buf, " ");
 	}
@@ -767,33 +812,35 @@ char *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len)
 	return str;
 }
 
-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)
+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)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 	wmEventHandler *handler;
 	wmKeyMap *keymap;
 	wmKeyMapItem *kmi;
 
 	/* find keymap item in handlers */
-	for(handler=handlers->first; handler; handler=handler->next) {
-		keymap= WM_keymap_active(wm, handler->keymap);
+	for (handler = handlers->first; handler; handler = handler->next) {
+		keymap = WM_keymap_active(wm, handler->keymap);
 
-		if(keymap && (!keymap->poll || keymap->poll((bContext*)C))) {
-			for(kmi=keymap->items.first; kmi; kmi=kmi->next) {
+		if (keymap && (!keymap->poll || keymap->poll((bContext *)C))) {
+			for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
 				
-				if(strcmp(kmi->idname, opname) == 0 && WM_key_event_string(kmi->type)[0]) {
+				if (strcmp(kmi->idname, opname) == 0 && WM_key_event_string(kmi->type)[0]) {
 					if (hotkey)
 						if (!ISHOTKEY(kmi->type))
 							continue;
 					
-					if(compare_props) {
-						if(kmi->ptr && IDP_EqualsProperties(properties, kmi->ptr->data)) {
-							if(keymap_r) *keymap_r= keymap;
+					if (compare_props) {
+						if (kmi->ptr && IDP_EqualsProperties(properties, kmi->ptr->data)) {
+							if (keymap_r) *keymap_r = keymap;
 							return kmi;
 						}
 					}
 					else {
-						if(keymap_r) *keymap_r= keymap;
+						if (keymap_r) *keymap_r = keymap;
 						return kmi;
 					}
 				}
@@ -802,73 +849,79 @@ static wmKeyMapItem *wm_keymap_item_find_handlers(const bContext *C, ListBase *h
 	}
 	
 	/* ensure un-initialized keymap is never used */
-	if(keymap_r) *keymap_r= NULL;
+	if (keymap_r) *keymap_r = NULL;
 	return NULL;
 }
 
-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)
+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)
 {
-	wmWindow *win= CTX_wm_window(C);
-	ScrArea *sa= CTX_wm_area(C);
-	ARegion *ar= CTX_wm_region(C);
-	wmKeyMapItem *found= NULL;
+	wmWindow *win = CTX_wm_window(C);
+	ScrArea *sa = CTX_wm_area(C);
+	ARegion *ar = CTX_wm_region(C);
+	wmKeyMapItem *found = NULL;
 
 	/* 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);
+	if (win)
+		found = wm_keymap_item_find_handlers(C, &win->handlers, opname, opcontext, properties, compare_props, hotkey, keymap_r);
 	
 
-	if(sa && found==NULL)
-		found= wm_keymap_item_find_handlers(C, &sa->handlers, opname, opcontext, properties, compare_props, hotkey, keymap_r);
+	if (sa && found == NULL)
+		found = wm_keymap_item_find_handlers(C, &sa->handlers, opname, opcontext, properties, compare_props, hotkey, keymap_r);
 
-	if(found==NULL) {
-		if(ELEM(opcontext, WM_OP_EXEC_REGION_WIN, WM_OP_INVOKE_REGION_WIN)) {
-			if(sa) {
+	if (found == NULL) {
+		if (ELEM(opcontext, WM_OP_EXEC_REGION_WIN, WM_OP_INVOKE_REGION_WIN)) {
+			if (sa) {
 				if (!(ar && ar->regiontype == RGN_TYPE_WINDOW))
-					ar= BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+					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);
+				if (ar)
+					found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, compare_props, hotkey, keymap_r);
 			}
 		}
-		else if(ELEM(opcontext, WM_OP_EXEC_REGION_CHANNELS, WM_OP_INVOKE_REGION_CHANNELS)) {
+		else if (ELEM(opcontext, WM_OP_EXEC_REGION_CHANNELS, WM_OP_INVOKE_REGION_CHANNELS)) {
 			if (!(ar && ar->regiontype == RGN_TYPE_CHANNELS))
-				ar= BKE_area_find_region_type(sa, RGN_TYPE_CHANNELS);
+				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);
+			if (ar)
+				found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, compare_props, hotkey, keymap_r);
 		}
-		else if(ELEM(opcontext, WM_OP_EXEC_REGION_PREVIEW, WM_OP_INVOKE_REGION_PREVIEW)) {
+		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);
+				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);
+			if (ar)
+				found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, compare_props, hotkey, keymap_r);
 		}
 		else {
-			if(ar)
-				found= wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, compare_props, hotkey, keymap_r);
+			if (ar)
+				found = wm_keymap_item_find_handlers(C, &ar->handlers, opname, opcontext, properties, compare_props, hotkey, keymap_r);
 		}
 	}
 	
 	return found;
 }
 
-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)
+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)
 {
-	wmKeyMapItem *found= wm_keymap_item_find_props(C, opname, opcontext, properties, 1, hotkey, 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 && sloppy)
+		found = wm_keymap_item_find_props(C, opname, opcontext, NULL, 0, hotkey, keymap_r);
 
 	return found;
 }
 
-char *WM_key_event_operator_string(const bContext *C, const char *opname, int opcontext, IDProperty *properties, const short sloppy, char *str, int len)
+char *WM_key_event_operator_string(
+    const bContext *C, const char *opname, int opcontext,
+    IDProperty *properties, const short sloppy, char *str, int len)
 {
-	wmKeyMapItem *kmi= wm_keymap_item_find(C, opname, opcontext, properties, 0, sloppy, NULL);
+	wmKeyMapItem *kmi = wm_keymap_item_find(C, opname, opcontext, properties, 0, sloppy, NULL);
 	
-	if(kmi) {
+	if (kmi) {
 		WM_keymap_item_to_string(kmi, str, len);
 		return str;
 	}
@@ -876,17 +929,19 @@ char *WM_key_event_operator_string(const bContext *C, const char *opname, int op
 	return NULL;
 }
 
-int WM_key_event_operator_id(const bContext *C, const char *opname, int opcontext, IDProperty *properties, int hotkey, wmKeyMap **keymap_r)
+int WM_key_event_operator_id(
+    const bContext *C, const char *opname, int opcontext,
+    IDProperty *properties, int hotkey, wmKeyMap **keymap_r)
 {
-	wmKeyMapItem *kmi= wm_keymap_item_find(C, opname, opcontext, properties, hotkey, TRUE, keymap_r);
+	wmKeyMapItem *kmi = wm_keymap_item_find(C, opname, opcontext, properties, hotkey, TRUE, keymap_r);
 	
-	if(kmi)
+	if (kmi)
 		return kmi->id;
 	else
 		return 0;
 }
 
-int	WM_keymap_item_compare(wmKeyMapItem *k1, wmKeyMapItem *k2)
+int WM_keymap_item_compare(wmKeyMapItem *k1, wmKeyMapItem *k2)
 {
 	int k1type, k2type;
 
@@ -897,10 +952,10 @@ int	WM_keymap_item_compare(wmKeyMapItem *k1, wmKeyMapItem *k2)
 	k1type = WM_userdef_event_map(k1->type);
 	k2type = WM_userdef_event_map(k2->type);
 
-	if(k1type != KM_ANY && k2type != KM_ANY && k1type != k2type)
+	if (k1type != KM_ANY && k2type != KM_ANY && k1type != k2type)
 		return 0;
 
-	if(k1->val != KM_ANY && k2->val != KM_ANY) {
+	if (k1->val != KM_ANY && k2->val != KM_ANY) {
 		/* take click, press, release conflict into account */
 		if (k1->val == KM_CLICK && ELEM3(k2->val, KM_PRESS, KM_RELEASE, KM_CLICK) == 0)
 			return 0;
@@ -910,19 +965,19 @@ int	WM_keymap_item_compare(wmKeyMapItem *k1, wmKeyMapItem *k2)
 			return 0;
 	}
 
-	if(k1->shift != KM_ANY && k2->shift != KM_ANY && k1->shift != k2->shift)
+	if (k1->shift != KM_ANY && k2->shift != KM_ANY && k1->shift != k2->shift)
 		return 0;
 
-	if(k1->ctrl != KM_ANY && k2->ctrl != KM_ANY && k1->ctrl != k2->ctrl)
+	if (k1->ctrl != KM_ANY && k2->ctrl != KM_ANY && k1->ctrl != k2->ctrl)
 		return 0;
 
-	if(k1->alt != KM_ANY && k2->alt != KM_ANY && k1->alt != k2->alt)
+	if (k1->alt != KM_ANY && k2->alt != KM_ANY && k1->alt != k2->alt)
 		return 0;
 
-	if(k1->oskey != KM_ANY && k2->oskey != KM_ANY && k1->oskey != k2->oskey)
+	if (k1->oskey != KM_ANY && k2->oskey != KM_ANY && k1->oskey != k2->oskey)
 		return 0;
 
-	if(k1->keymodifier != k2->keymodifier)
+	if (k1->keymodifier != k2->keymodifier)
 		return 0;
 
 	return 1;
@@ -938,11 +993,11 @@ static int WM_KEYMAP_UPDATE = 0;
 void WM_keyconfig_update_tag(wmKeyMap *km, wmKeyMapItem *kmi)
 {
 	/* quick tag to do delayed keymap updates */
-	WM_KEYMAP_UPDATE= 1;
+	WM_KEYMAP_UPDATE = 1;
 
-	if(km)
+	if (km)
 		km->flag |= KEYMAP_UPDATE;
-	if(kmi)
+	if (kmi)
 		kmi->flag |= KMI_UPDATE;
 }
 
@@ -951,11 +1006,11 @@ static int wm_keymap_test_and_clear_update(wmKeyMap *km)
 	wmKeyMapItem *kmi;
 	int update;
 	
-	update= (km->flag & KEYMAP_UPDATE);
+	update = (km->flag & KEYMAP_UPDATE);
 	km->flag &= ~KEYMAP_UPDATE;
 
-	for(kmi=km->items.first; kmi; kmi=kmi->next) {
-		update= update || (kmi->flag & KMI_UPDATE);
+	for (kmi = km->items.first; kmi; kmi = kmi->next) {
+		update = update || (kmi->flag & KMI_UPDATE);
 		kmi->flag &= ~KMI_UPDATE;
 	}
 	
@@ -964,12 +1019,12 @@ static int wm_keymap_test_and_clear_update(wmKeyMap *km)
 
 static wmKeyMap *wm_keymap_preset(wmWindowManager *wm, wmKeyMap *km)
 {
-	wmKeyConfig *keyconf= WM_keyconfig_active(wm);
+	wmKeyConfig *keyconf = WM_keyconfig_active(wm);
 	wmKeyMap *keymap;
 
-	keymap= WM_keymap_list_find(&keyconf->keymaps, km->idname, km->spaceid, km->regionid);
-	if(!keymap)
-		keymap= WM_keymap_list_find(&wm->defaultconf->keymaps, km->idname, km->spaceid, km->regionid);
+	keymap = WM_keymap_list_find(&keyconf->keymaps, km->idname, km->spaceid, km->regionid);
+	if (!keymap)
+		keymap = WM_keymap_list_find(&wm->defaultconf->keymaps, km->idname, km->spaceid, km->regionid);
 
 	return keymap;
 }
@@ -981,62 +1036,64 @@ void WM_keyconfig_update(wmWindowManager *wm)
 	wmKeyMapDiffItem *kmdi;
 	int compat_update = 0;
 
-	if(G.background)
+	if (G.background)
 		return;
-	if(!WM_KEYMAP_UPDATE)
+	if (!WM_KEYMAP_UPDATE)
 		return;
 	
 	/* update operator properties for non-modal user keymaps */
-	for(km=U.user_keymaps.first; km; km=km->next) {
-		if((km->flag & KEYMAP_MODAL) == 0) {
-			for(kmdi=km->diff_items.first; kmdi; kmdi=kmdi->next) {
-				if(kmdi->add_item)
+	for (km = U.user_keymaps.first; km; km = km->next) {
+		if ((km->flag & KEYMAP_MODAL) == 0) {
+			for (kmdi = km->diff_items.first; kmdi; kmdi = kmdi->next) {
+				if (kmdi->add_item)
 					wm_keymap_item_properties_set(kmdi->add_item);
-				if(kmdi->remove_item)
+				if (kmdi->remove_item)
 					wm_keymap_item_properties_set(kmdi->remove_item);
 			}
 
-			for(kmi=km->items.first; kmi; kmi=kmi->next)
+			for (kmi = km->items.first; kmi; kmi = kmi->next)
 				wm_keymap_item_properties_set(kmi);
 		}
 	}
 
 	/* update U.user_keymaps with user key configuration changes */
-	for(km=wm->userconf->keymaps.first; km; km=km->next) {
+	for (km = wm->userconf->keymaps.first; km; km = km->next) {
 		/* only diff if the user keymap was modified */
-		if(wm_keymap_test_and_clear_update(km)) {
+		if (wm_keymap_test_and_clear_update(km)) {
 			/* find keymaps */
-			defaultmap= wm_keymap_preset(wm, km);
-			addonmap= WM_keymap_list_find(&wm->addonconf->keymaps, km->idname, km->spaceid, km->regionid);
+			defaultmap = wm_keymap_preset(wm, km);
+			addonmap = WM_keymap_list_find(&wm->addonconf->keymaps, km->idname, km->spaceid, km->regionid);
 
 			/* diff */
-			if(defaultmap)
+			if (defaultmap)
 				wm_keymap_diff_update(&U.user_keymaps, defaultmap, addonmap, km);
 		}
 	}
 
 	/* create user key configuration from preset + addon + user preferences */
-	for(km=wm->defaultconf->keymaps.first; km; km=km->next) {
+	for (km = wm->defaultconf->keymaps.first; km; km = km->next) {
 		/* find keymaps */
-		defaultmap= wm_keymap_preset(wm, km);
-		addonmap= WM_keymap_list_find(&wm->addonconf->keymaps, km->idname, km->spaceid, km->regionid);
-		usermap= WM_keymap_list_find(&U.user_keymaps, km->idname, km->spaceid, km->regionid);
+		defaultmap = wm_keymap_preset(wm, km);
+		addonmap = WM_keymap_list_find(&wm->addonconf->keymaps, km->idname, km->spaceid, km->regionid);
+		usermap = WM_keymap_list_find(&U.user_keymaps, km->idname, km->spaceid, km->regionid);
+
+		wm_user_modal_keymap_set_items(wm, defaultmap);
 
 		/* add */
-		kmn= wm_keymap_patch_update(&wm->userconf->keymaps, defaultmap, addonmap, usermap);
+		kmn = wm_keymap_patch_update(&wm->userconf->keymaps, defaultmap, addonmap, usermap);
 
-		if(kmn) {
-			kmn->modal_items= km->modal_items;
-			kmn->poll= km->poll;
+		if (kmn) {
+			kmn->modal_items = km->modal_items;
+			kmn->poll = km->poll;
 		}
 
 		/* in case of old non-diff keymaps, force extra update to create diffs */
 		compat_update = compat_update || (usermap && !(usermap->flag & KEYMAP_DIFF));
 	}
 
-	WM_KEYMAP_UPDATE= 0;
+	WM_KEYMAP_UPDATE = 0;
 
-	if(compat_update) {
+	if (compat_update) {
 		WM_keyconfig_update_tag(NULL, NULL);
 		WM_keyconfig_update(wm);
 	}
@@ -1051,13 +1108,13 @@ wmKeyMap *WM_keymap_active(wmWindowManager *wm, wmKeyMap *keymap)
 {
 	wmKeyMap *km;
 
-	if(!keymap)
+	if (!keymap)
 		return NULL;
 	
 	/* first user defined keymaps */
-	km= WM_keymap_list_find(&wm->userconf->keymaps, keymap->idname, keymap->spaceid, keymap->regionid);
+	km = WM_keymap_list_find(&wm->userconf->keymaps, keymap->idname, keymap->spaceid, keymap->regionid);
 
-	if(km)
+	if (km)
 		return km;
 
 	return keymap;
@@ -1072,14 +1129,14 @@ void WM_keymap_restore_item_to_default(bContext *C, wmKeyMap *keymap, wmKeyMapIt
 	wmKeyMap *defaultmap, *addonmap;
 	wmKeyMapItem *orig;
 
-	if(!keymap)
+	if (!keymap)
 		return;
 
 	/* construct default keymap from preset + addons */
-	defaultmap= wm_keymap_preset(wm, keymap);
-	addonmap= WM_keymap_list_find(&wm->addonconf->keymaps, keymap->idname, keymap->spaceid, keymap->regionid);
+	defaultmap = wm_keymap_preset(wm, keymap);
+	addonmap = WM_keymap_list_find(&wm->addonconf->keymaps, keymap->idname, keymap->spaceid, keymap->regionid);
 
-	if(addonmap) {
+	if (addonmap) {
 		defaultmap = wm_keymap_copy(defaultmap);
 		wm_keymap_addon_add(defaultmap, addonmap);
 	}
@@ -1087,22 +1144,22 @@ void WM_keymap_restore_item_to_default(bContext *C, wmKeyMap *keymap, wmKeyMapIt
 	/* find original item */
 	orig = WM_keymap_item_find_id(defaultmap, kmi->id);
 
-	if(orig) {
+	if (orig) {
 		/* restore to original */
-		if(strcmp(orig->idname, kmi->idname) != 0) {
+		if (strcmp(orig->idname, kmi->idname) != 0) {
 			BLI_strncpy(kmi->idname, orig->idname, sizeof(kmi->idname));
 			WM_keymap_properties_reset(kmi, NULL);
 		}
 
 		if (orig->properties) {
-			if(kmi->properties) {
+			if (kmi->properties) {
 				IDP_FreeProperty(kmi->properties);
 				MEM_freeN(kmi->properties);
-				kmi->properties= NULL;
+				kmi->properties = NULL;
 			}
 
-			kmi->properties= IDP_CopyProperty(orig->properties);
-			kmi->ptr->data= kmi->properties;
+			kmi->properties = IDP_CopyProperty(orig->properties);
+			kmi->ptr->data = kmi->properties;
 		}
 
 		kmi->propvalue = orig->propvalue;
@@ -1119,7 +1176,7 @@ void WM_keymap_restore_item_to_default(bContext *C, wmKeyMap *keymap, wmKeyMapIt
 	}
 
 	/* free temporary keymap */
-	if(addonmap) {
+	if (addonmap) {
 		WM_keymap_free(defaultmap);
 		MEM_freeN(defaultmap);
 	}
@@ -1131,9 +1188,9 @@ void WM_keymap_restore_to_default(wmKeyMap *keymap, bContext *C)
 	wmKeyMap *usermap;
 
 	/* remove keymap from U.user_keymaps and update */
-	usermap= WM_keymap_list_find(&U.user_keymaps, keymap->idname, keymap->spaceid, keymap->regionid);
+	usermap = WM_keymap_list_find(&U.user_keymaps, keymap->idname, keymap->spaceid, keymap->regionid);
 
-	if(usermap) {
+	if (usermap) {
 		WM_keymap_free(usermap);
 		BLI_freelinkN(&U.user_keymaps, usermap);
 
@@ -1146,7 +1203,7 @@ wmKeyMapItem *WM_keymap_item_find_id(wmKeyMap *keymap, int id)
 {
 	wmKeyMapItem *kmi;
 	
-	for (kmi=keymap->items.first; kmi; kmi=kmi->next) {
+	for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
 		if (kmi->id == id) {
 			return kmi;
 		}
@@ -1159,7 +1216,7 @@ wmKeyMapItem *WM_keymap_item_find_id(wmKeyMap *keymap, int id)
 /* Needs to be kept up to date with Keymap and Operator naming */
 wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
 {
-	wmKeyMap *km=NULL;
+	wmKeyMap *km = NULL;
 	SpaceLink *sl = CTX_wm_space_data(C);
 	
 	/* Window */
@@ -1178,6 +1235,10 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
 	else if (strstr(opname, "MARKER_OT")) {
 		km = WM_keymap_find_all(C, "Markers", 0, 0);
 	}
+	/* Import/Export*/
+	else if (strstr(opname, "IMPORT_") || strstr(opname, "EXPORT_")) {
+		km = WM_keymap_find_all(C, "Window", 0, 0);
+	}
 	
 	
 	/* 3D View */
@@ -1194,7 +1255,7 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
 		km = WM_keymap_find_all(C, "Mesh", 0, 0);
 		
 		/* some mesh operators are active in object mode too, like add-prim */
-		if(km && km->poll && km->poll((bContext *)C)==0) {
+		if (km && km->poll && km->poll((bContext *)C) == 0) {
 			km = WM_keymap_find_all(C, "Object Mode", 0, 0);
 		}
 	}
@@ -1202,7 +1263,7 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
 		km = WM_keymap_find_all(C, "Curve", 0, 0);
 		
 		/* some curve operators are active in object mode too, like add-prim */
-		if(km && km->poll && km->poll((bContext *)C)==0) {
+		if (km && km->poll && km->poll((bContext *)C) == 0) {
 			km = WM_keymap_find_all(C, "Object Mode", 0, 0);
 		}
 	}
@@ -1213,7 +1274,7 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
 		km = WM_keymap_find_all(C, "Pose", 0, 0);
 	}
 	else if (strstr(opname, "SCULPT_OT")) {
-		switch(CTX_data_mode_enum(C)) {
+		switch (CTX_data_mode_enum(C)) {
 			case OB_MODE_SCULPT:
 				km = WM_keymap_find_all(C, "Sculpt", 0, 0);
 				break;
@@ -1226,7 +1287,7 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
 		km = WM_keymap_find_all(C, "Metaball", 0, 0);
 		
 		/* some mball operators are active in object mode too, like add-prim */
-		if(km && km->poll && km->poll((bContext *)C)==0) {
+		if (km && km->poll && km->poll((bContext *)C) == 0) {
 			km = WM_keymap_find_all(C, "Object Mode", 0, 0);
 		}
 	}
@@ -1242,7 +1303,7 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
 	else if (strstr(opname, "PAINT_OT")) {
 		
 		/* check for relevant mode */
-		switch(CTX_data_mode_enum(C)) {
+		switch (CTX_data_mode_enum(C)) {
 			case OB_MODE_WEIGHT_PAINT:
 				km = WM_keymap_find_all(C, "Weight Paint", 0, 0);
 				break;
@@ -1319,7 +1380,7 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname)
 	else if (strstr(opname, "TRANSFORM_OT")) {
 		
 		/* check for relevant editor */
-		switch(sl->spacetype) {
+		switch (sl->spacetype) {
 			case SPACE_VIEW3D:
 				km = WM_keymap_find_all(C, "3D View", sl->spacetype, 0);
 				break;
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 19c4516..514c159 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -65,6 +65,7 @@
 #include "BKE_context.h"
 #include "BKE_depsgraph.h"
 #include "BKE_idprop.h"
+#include "BKE_image.h"
 #include "BKE_library.h"
 #include "BKE_global.h"
 #include "BKE_main.h"
@@ -101,31 +102,31 @@
 #include "wm_subwindow.h"
 #include "wm_window.h"
 
-static GHash *global_ops_hash= NULL;
+static GHash *global_ops_hash = NULL;
 
 /* ************ operator API, exported ********** */
 
 
 wmOperatorType *WM_operatortype_find(const char *idname, int quiet)
 {
-	if(idname[0]) {
+	if (idname[0]) {
 		wmOperatorType *ot;
 
 		/* needed to support python style names without the _OT_ syntax */
 		char idname_bl[OP_MAX_TYPENAME];
 		WM_operator_bl_idname(idname_bl, idname);
 
-		ot= BLI_ghash_lookup(global_ops_hash, idname_bl);
-		if(ot) {
+		ot = BLI_ghash_lookup(global_ops_hash, idname_bl);
+		if (ot) {
 			return ot;
 		}
 
-		if(!quiet) {
+		if (!quiet) {
 			printf("search for unknown operator '%s', '%s'\n", idname_bl, idname);
 		}
 	}
 	else {
-		if(!quiet) {
+		if (!quiet) {
 			printf("search for empty operator\n");
 		}
 	}
@@ -140,33 +141,38 @@ GHashIterator *WM_operatortype_iter(void)
 }
 
 /* all ops in 1 list (for time being... needs evaluation later) */
-void WM_operatortype_append(void (*opfunc)(wmOperatorType*))
+void WM_operatortype_append(void (*opfunc)(wmOperatorType *))
 {
 	wmOperatorType *ot;
 	
-	ot= MEM_callocN(sizeof(wmOperatorType), "operatortype");
-	ot->srna= RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties");
+	ot = MEM_callocN(sizeof(wmOperatorType), "operatortype");
+	ot->srna = RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties");
+	/* Set the default i18n context now, so that opfunc can redefine it if needed! */
+	RNA_def_struct_translation_context(ot->srna, BLF_I18NCONTEXT_OPERATOR_DEFAULT);
 	opfunc(ot);
 
-	if(ot->name==NULL) {
+	if (ot->name == NULL) {
 		fprintf(stderr, "ERROR: Operator %s has no name property!\n", ot->idname);
-		ot->name= IFACE_("Dummy Name");
+		ot->name = N_("Dummy Name");
 	}
 
-	RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:IFACE_("(undocumented operator)")); // XXX All ops should have a description but for now allow them not to.
+	// XXX All ops should have a description but for now allow them not to.
+	RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description : N_("(undocumented operator)"));
 	RNA_def_struct_identifier(ot->srna, ot->idname);
 
 	BLI_ghash_insert(global_ops_hash, (void *)ot->idname, ot);
 }
 
-void WM_operatortype_append_ptr(void (*opfunc)(wmOperatorType*, void*), void *userdata)
+void WM_operatortype_append_ptr(void (*opfunc)(wmOperatorType *, void *), void *userdata)
 {
 	wmOperatorType *ot;
 
-	ot= MEM_callocN(sizeof(wmOperatorType), "operatortype");
-	ot->srna= RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties");
+	ot = MEM_callocN(sizeof(wmOperatorType), "operatortype");
+	ot->srna = RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties");
+	/* Set the default i18n context now, so that opfunc can redefine it if needed! */
+	RNA_def_struct_translation_context(ot->srna, BLF_I18NCONTEXT_OPERATOR_DEFAULT);
 	opfunc(ot, userdata);
-	RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description:IFACE_("(undocumented operator)"));
+	RNA_def_struct_ui_text(ot->srna, ot->name, ot->description ? ot->description : N_("(undocumented operator)"));
 	RNA_def_struct_identifier(ot->srna, ot->idname);
 
 	BLI_ghash_insert(global_ops_hash, (void *)ot->idname, ot);
@@ -197,7 +203,7 @@ static int wm_macro_end(wmOperator *op, int retval)
 	}
 
 	/* if modal is ending, free custom data */
-	if (retval & (OPERATOR_FINISHED|OPERATOR_CANCELLED)) {
+	if (retval & (OPERATOR_FINISHED | OPERATOR_CANCELLED)) {
 		if (op->customdata) {
 			MEM_freeN(op->customdata);
 			op->customdata = NULL;
@@ -211,20 +217,21 @@ static int wm_macro_end(wmOperator *op, int retval)
 static int wm_macro_exec(bContext *C, wmOperator *op)
 {
 	wmOperator *opm;
-	int retval= OPERATOR_FINISHED;
+	int retval = OPERATOR_FINISHED;
 	
 	wm_macro_start(op);
 
-	for(opm= op->macro.first; opm; opm= opm->next) {
+	for (opm = op->macro.first; opm; opm = opm->next) {
 		
-		if(opm->type->exec) {
-			retval= opm->type->exec(C, opm);
+		if (opm->type->exec) {
+			retval = opm->type->exec(C, opm);
 			OPERATOR_RETVAL_CHECK(retval);
 		
 			if (retval & OPERATOR_FINISHED) {
 				MacroData *md = op->customdata;
 				md->retval = OPERATOR_FINISHED; /* keep in mind that at least one operator finished */
-			} else {
+			}
+			else {
 				break; /* operator didn't finish, end macro */
 			}
 		}
@@ -235,14 +242,14 @@ static int wm_macro_exec(bContext *C, wmOperator *op)
 
 static int wm_macro_invoke_internal(bContext *C, wmOperator *op, wmEvent *event, wmOperator *opm)
 {
-	int retval= OPERATOR_FINISHED;
+	int retval = OPERATOR_FINISHED;
 
 	/* start from operator received as argument */
-	for( ; opm; opm= opm->next) {
-		if(opm->type->invoke)
-			retval= opm->type->invoke(C, opm, event);
-		else if(opm->type->exec)
-			retval= opm->type->exec(C, opm);
+	for (; opm; opm = opm->next) {
+		if (opm->type->invoke)
+			retval = opm->type->invoke(C, opm, event);
+		else if (opm->type->exec)
+			retval = opm->type->exec(C, opm);
 
 		OPERATOR_RETVAL_CHECK(retval);
 
@@ -251,7 +258,8 @@ static int wm_macro_invoke_internal(bContext *C, wmOperator *op, wmEvent *event,
 		if (retval & OPERATOR_FINISHED) {
 			MacroData *md = op->customdata;
 			md->retval = OPERATOR_FINISHED; /* keep in mind that at least one operator finished */
-		} else {
+		}
+		else {
 			break; /* operator didn't finish, end macro */
 		}
 	}
@@ -268,9 +276,9 @@ static int wm_macro_invoke(bContext *C, wmOperator *op, wmEvent *event)
 static int wm_macro_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
 	wmOperator *opm = op->opm;
-	int retval= OPERATOR_FINISHED;
+	int retval = OPERATOR_FINISHED;
 	
-	if(opm==NULL)
+	if (opm == NULL)
 		printf("%s: macro error, calling NULL modal()\n", __func__);
 	else {
 		retval = opm->type->modal(C, opm, event);
@@ -303,17 +311,17 @@ static int wm_macro_modal(bContext *C, wmOperator *op, wmEvent *event)
 				/* if operator is blocking, grab cursor
 				 * This may end up grabbing twice, but we don't care.
 				 * */
-				if(op->opm->type->flag & OPTYPE_BLOCKING) {
-					int bounds[4] = {-1,-1,-1,-1};
+				if (op->opm->type->flag & OPTYPE_BLOCKING) {
+					int bounds[4] = {-1, -1, -1, -1};
 					int wrap = (U.uiflag & USER_CONTINUOUS_MOUSE) && ((op->opm->flag & OP_GRAB_POINTER) || (op->opm->type->flag & OPTYPE_GRAB_POINTER));
 
-					if(wrap) {
-						ARegion *ar= CTX_wm_region(C);
-						if(ar) {
-							bounds[0]= ar->winrct.xmin;
-							bounds[1]= ar->winrct.ymax;
-							bounds[2]= ar->winrct.xmax;
-							bounds[3]= ar->winrct.ymin;
+					if (wrap) {
+						ARegion *ar = CTX_wm_region(C);
+						if (ar) {
+							bounds[0] = ar->winrct.xmin;
+							bounds[1] = ar->winrct.ymax;
+							bounds[2] = ar->winrct.xmax;
+							bounds[3] = ar->winrct.ymin;
 						}
 					}
 
@@ -341,52 +349,55 @@ wmOperatorType *WM_operatortype_append_macro(const char *idname, const char *nam
 {
 	wmOperatorType *ot;
 	
-	if(WM_operatortype_find(idname, TRUE)) {
+	if (WM_operatortype_find(idname, TRUE)) {
 		printf("%s: macro error: operator %s exists\n", __func__, idname);
 		return NULL;
 	}
 	
-	ot= MEM_callocN(sizeof(wmOperatorType), "operatortype");
-	ot->srna= RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties");
+	ot = MEM_callocN(sizeof(wmOperatorType), "operatortype");
+	ot->srna = RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties");
 	
-	ot->idname= idname;
-	ot->name= name;
-	ot->flag= OPTYPE_MACRO|flag;
+	ot->idname = idname;
+	ot->name = name;
+	ot->flag = OPTYPE_MACRO | flag;
 	
-	ot->exec= wm_macro_exec;
-	ot->invoke= wm_macro_invoke;
-	ot->modal= wm_macro_modal;
-	ot->cancel= wm_macro_cancel;
-	ot->poll= NULL;
+	ot->exec = wm_macro_exec;
+	ot->invoke = wm_macro_invoke;
+	ot->modal = wm_macro_modal;
+	ot->cancel = wm_macro_cancel;
+	ot->poll = NULL;
 
-	if(!ot->description)
-		ot->description= IFACE_("(undocumented operator)");
+	if (!ot->description) /* XXX All ops should have a description but for now allow them not to. */
+		ot->description = N_("(undocumented operator)");
 	
-	RNA_def_struct_ui_text(ot->srna, ot->name, ot->description); // XXX All ops should have a description but for now allow them not to.
+	RNA_def_struct_ui_text(ot->srna, ot->name, ot->description);
 	RNA_def_struct_identifier(ot->srna, ot->idname);
+	RNA_def_struct_translation_context(ot->srna, BLF_I18NCONTEXT_OPERATOR_DEFAULT);
 
 	BLI_ghash_insert(global_ops_hash, (void *)ot->idname, ot);
 
 	return ot;
 }
 
-void WM_operatortype_append_macro_ptr(void (*opfunc)(wmOperatorType*, void*), void *userdata)
+void WM_operatortype_append_macro_ptr(void (*opfunc)(wmOperatorType *, void *), void *userdata)
 {
 	wmOperatorType *ot;
 
-	ot= MEM_callocN(sizeof(wmOperatorType), "operatortype");
-	ot->srna= RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties");
+	ot = MEM_callocN(sizeof(wmOperatorType), "operatortype");
+	ot->srna = RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties");
 
-	ot->flag= OPTYPE_MACRO;
-	ot->exec= wm_macro_exec;
-	ot->invoke= wm_macro_invoke;
-	ot->modal= wm_macro_modal;
-	ot->cancel= wm_macro_cancel;
-	ot->poll= NULL;
+	ot->flag = OPTYPE_MACRO;
+	ot->exec = wm_macro_exec;
+	ot->invoke = wm_macro_invoke;
+	ot->modal = wm_macro_modal;
+	ot->cancel = wm_macro_cancel;
+	ot->poll = NULL;
 
-	if(!ot->description)
-		ot->description= IFACE_("(undocumented operator)");
+	if (!ot->description)
+		ot->description = N_("(undocumented operator)");
 
+	/* Set the default i18n context now, so that opfunc can redefine it if needed! */
+	RNA_def_struct_translation_context(ot->srna, BLF_I18NCONTEXT_OPERATOR_DEFAULT);
 	opfunc(ot, userdata);
 
 	RNA_def_struct_ui_text(ot->srna, ot->name, ot->description);
@@ -397,7 +408,7 @@ void WM_operatortype_append_macro_ptr(void (*opfunc)(wmOperatorType*, void*), vo
 
 wmOperatorTypeMacro *WM_operatortype_macro_define(wmOperatorType *ot, const char *idname)
 {
-	wmOperatorTypeMacro *otmacro= MEM_callocN(sizeof(wmOperatorTypeMacro), "wmOperatorTypeMacro");
+	wmOperatorTypeMacro *otmacro = MEM_callocN(sizeof(wmOperatorTypeMacro), "wmOperatorTypeMacro");
 
 	BLI_strncpy(otmacro->idname, idname, OP_MAX_TYPENAME);
 
@@ -408,11 +419,11 @@ wmOperatorTypeMacro *WM_operatortype_macro_define(wmOperatorType *ot, const char
 	BLI_addtail(&ot->macro, otmacro);
 
 	{
-		/* operator should always be found but in the event its not. dont segfault */
+		/* operator should always be found but in the event its not. don't segfault */
 		wmOperatorType *otsub = WM_operatortype_find(idname, 0);
-		if(otsub) {
+		if (otsub) {
 			RNA_def_pointer_runtime(ot->srna, otsub->idname, otsub->srna,
-			otsub->name, otsub->description);
+			                        otsub->name, otsub->description);
 		}
 	}
 
@@ -423,8 +434,8 @@ static void wm_operatortype_free_macro(wmOperatorType *ot)
 {
 	wmOperatorTypeMacro *otmacro;
 	
-	for(otmacro= ot->macro.first; otmacro; otmacro= otmacro->next) {
-		if(otmacro->ptr) {
+	for (otmacro = ot->macro.first; otmacro; otmacro = otmacro->next) {
+		if (otmacro->ptr) {
 			WM_operator_properties_free(otmacro->ptr);
 			MEM_freeN(otmacro->ptr);
 		}
@@ -437,12 +448,17 @@ int WM_operatortype_remove(const char *idname)
 {
 	wmOperatorType *ot = WM_operatortype_find(idname, 0);
 
-	if (ot==NULL)
+	if (ot == NULL)
 		return 0;
 	
 	RNA_struct_free(&BLENDER_RNA, ot->srna);
-	
-	if(ot->macro.first)
+
+	if (ot->last_properties) {
+		IDP_FreeProperty(ot->last_properties);
+		MEM_freeN(ot->last_properties);
+	}
+
+	if (ot->macro.first)
 		wm_operatortype_free_macro(ot);
 
 	BLI_ghash_remove(global_ops_hash, (void *)ot->idname, NULL, NULL);
@@ -454,20 +470,20 @@ int WM_operatortype_remove(const char *idname)
 /* SOME_OT_op -> some.op */
 void WM_operator_py_idname(char *to, const char *from)
 {
-	char *sep= strstr(from, "_OT_");
-	if(sep) {
-		int ofs= (sep-from);
+	char *sep = strstr(from, "_OT_");
+	if (sep) {
+		int ofs = (sep - from);
 		
 		/* note, we use ascii tolower instead of system tolower, because the
-		   latter depends on the locale, and can lead to idname mistmatch */
-		memcpy(to, from, sizeof(char)*ofs);
+		 * latter depends on the locale, and can lead to idname mistmatch */
+		memcpy(to, from, sizeof(char) * ofs);
 		BLI_ascii_strtolower(to, ofs);
 
 		to[ofs] = '.';
-		BLI_strncpy(to+(ofs+1), sep+4, OP_MAX_TYPENAME);
+		BLI_strncpy(to + (ofs + 1), sep + 4, OP_MAX_TYPENAME);
 	}
 	else {
-		/* should not happen but support just incase */
+		/* should not happen but support just in case */
 		BLI_strncpy(to, from, OP_MAX_TYPENAME);
 	}
 }
@@ -476,24 +492,24 @@ void WM_operator_py_idname(char *to, const char *from)
 void WM_operator_bl_idname(char *to, const char *from)
 {
 	if (from) {
-		char *sep= strchr(from, '.');
+		char *sep = strchr(from, '.');
 
-		if(sep) {
-			int ofs= (sep-from);
+		if (sep) {
+			int ofs = (sep - from);
 
-			memcpy(to, from, sizeof(char)*ofs);
+			memcpy(to, from, sizeof(char) * ofs);
 			BLI_ascii_strtoupper(to, ofs);
 
-			BLI_strncpy(to+ofs, "_OT_", OP_MAX_TYPENAME);
-			BLI_strncpy(to+(ofs+4), sep+1, OP_MAX_TYPENAME);
+			BLI_strncpy(to + ofs, "_OT_", OP_MAX_TYPENAME);
+			BLI_strncpy(to + (ofs + 4), sep + 1, OP_MAX_TYPENAME);
 		}
 		else {
-			/* should not happen but support just incase */
+			/* should not happen but support just in case */
 			BLI_strncpy(to, from, OP_MAX_TYPENAME);
 		}
 	}
 	else
-		to[0]= 0;
+		to[0] = 0;
 }
 
 /* print a string representation of the operator, with the args that it runs 
@@ -504,70 +520,31 @@ void WM_operator_bl_idname(char *to, const char *from)
  */
 char *WM_operator_pystring(bContext *C, wmOperatorType *ot, PointerRNA *opptr, int all_args)
 {
-	const char *arg_name= NULL;
 	char idname_py[OP_MAX_TYPENAME];
 
-	PropertyRNA *prop, *iterprop;
-
 	/* for building the string */
-	DynStr *dynstr= BLI_dynstr_new();
-	char *cstring, *buf;
-	int first_iter=1, ok= 1;
-
+	DynStr *dynstr = BLI_dynstr_new();
+	char *cstring;
+	char *cstring_args;
 
 	/* only to get the orginal props for comparisons */
 	PointerRNA opptr_default;
-	PropertyRNA *prop_default;
-	char *buf_default;
-	if(all_args==0 || opptr==NULL) {
+
+	if (all_args == 0 || opptr == NULL) {
 		WM_operator_properties_create_ptr(&opptr_default, ot);
 
-		if(opptr==NULL)
+		if (opptr == NULL)
 			opptr = &opptr_default;
 	}
 
-
 	WM_operator_py_idname(idname_py, ot->idname);
 	BLI_dynstr_appendf(dynstr, "bpy.ops.%s(", idname_py);
 
-	iterprop= RNA_struct_iterator_property(opptr->type);
-
-	RNA_PROP_BEGIN(opptr, propptr, iterprop) {
-		prop= propptr.data;
-		arg_name= RNA_property_identifier(prop);
-
-		if (strcmp(arg_name, "rna_type")==0) continue;
-
-		buf= RNA_property_as_string(C, opptr, prop);
-		
-		ok= 1;
-
-		if(!all_args) {
-			/* not verbose, so only add in attributes that use non-default values
-			 * slow but good for tooltips */
-			prop_default= RNA_struct_find_property(&opptr_default, arg_name);
-
-			if(prop_default) {
-				buf_default= RNA_property_as_string(C, &opptr_default, prop_default);
-
-				if(strcmp(buf, buf_default)==0)
-					ok= 0; /* values match, dont bother printing */
-
-				MEM_freeN(buf_default);
-			}
-
-		}
-		if(ok) {
-			BLI_dynstr_appendf(dynstr, first_iter?"%s=%s":", %s=%s", arg_name, buf);
-			first_iter = 0;
-		}
-
-		MEM_freeN(buf);
+	cstring_args = RNA_pointer_as_string_keywords(C, opptr, &opptr_default, FALSE, all_args);
+	BLI_dynstr_append(dynstr, cstring_args);
+	MEM_freeN(cstring_args);
 
-	}
-	RNA_PROP_END;
-
-	if(all_args==0 || opptr==&opptr_default )
+	if (all_args == 0 || opptr == &opptr_default)
 		WM_operator_properties_free(&opptr_default);
 
 	BLI_dynstr_append(dynstr, ")");
@@ -584,9 +561,9 @@ void WM_operator_properties_create_ptr(PointerRNA *ptr, wmOperatorType *ot)
 
 void WM_operator_properties_create(PointerRNA *ptr, const char *opstring)
 {
-	wmOperatorType *ot= WM_operatortype_find(opstring, 0);
+	wmOperatorType *ot = WM_operatortype_find(opstring, 0);
 
-	if(ot)
+	if (ot)
 		WM_operator_properties_create_ptr(ptr, ot);
 	else
 		RNA_pointer_create(NULL, &RNA_OperatorProperties, NULL, ptr);
@@ -596,33 +573,33 @@ void WM_operator_properties_create(PointerRNA *ptr, const char *opstring)
  * used for keymaps and macros */
 void WM_operator_properties_alloc(PointerRNA **ptr, IDProperty **properties, const char *opstring)
 {
-	if(*properties==NULL) {
+	if (*properties == NULL) {
 		IDPropertyTemplate val = {0};
-		*properties= IDP_New(IDP_GROUP, &val, "wmOpItemProp");
+		*properties = IDP_New(IDP_GROUP, &val, "wmOpItemProp");
 	}
 
-	if(*ptr==NULL) {
-		*ptr= MEM_callocN(sizeof(PointerRNA), "wmOpItemPtr");
+	if (*ptr == NULL) {
+		*ptr = MEM_callocN(sizeof(PointerRNA), "wmOpItemPtr");
 		WM_operator_properties_create(*ptr, opstring);
 	}
 
-	(*ptr)->data= *properties;
+	(*ptr)->data = *properties;
 
 }
 
 void WM_operator_properties_sanitize(PointerRNA *ptr, const short no_context)
 {
 	RNA_STRUCT_BEGIN(ptr, prop) {
-		switch(RNA_property_type(prop)) {
-		case PROP_ENUM:
-			if (no_context)
-				RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
-			else
-				RNA_def_property_clear_flag(prop, PROP_ENUM_NO_CONTEXT);
-			break;
-		case PROP_POINTER:
+		switch (RNA_property_type(prop)) {
+			case PROP_ENUM:
+				if (no_context)
+					RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
+				else
+					RNA_def_property_clear_flag(prop, PROP_ENUM_NO_CONTEXT);
+				break;
+			case PROP_POINTER:
 			{
-				StructRNA *ptype= RNA_property_pointer_type(ptr, prop);
+				StructRNA *ptype = RNA_property_pointer_type(ptr, prop);
 
 				/* recurse into operator properties */
 				if (RNA_struct_is_a(ptype, &RNA_OperatorProperties)) {
@@ -631,8 +608,8 @@ void WM_operator_properties_sanitize(PointerRNA *ptr, const short no_context)
 				}
 				break;
 			}
-		default:
-			break;
+			default:
+				break;
 		}
 	}
 	RNA_STRUCT_END;
@@ -643,12 +620,12 @@ void WM_operator_properties_reset(wmOperator *op)
 {
 	if (op->ptr->data) {
 		PropertyRNA *iterprop;
-		iterprop= RNA_struct_iterator_property(op->type->srna);
+		iterprop = RNA_struct_iterator_property(op->type->srna);
 
 		RNA_PROP_BEGIN(op->ptr, itemptr, iterprop) {
-			PropertyRNA *prop= itemptr.data;
+			PropertyRNA *prop = itemptr.data;
 
-			if((RNA_property_flag(prop) & PROP_SKIP_SAVE) == 0) {
+			if ((RNA_property_flag(prop) & PROP_SKIP_SAVE) == 0) {
 				const char *identifier = RNA_property_identifier(prop);
 				RNA_struct_idprops_unset(op->ptr, identifier);
 			}
@@ -659,12 +636,12 @@ void WM_operator_properties_reset(wmOperator *op)
 
 void WM_operator_properties_free(PointerRNA *ptr)
 {
-	IDProperty *properties= ptr->data;
+	IDProperty *properties = ptr->data;
 
-	if(properties) {
+	if (properties) {
 		IDP_FreeProperty(properties);
 		MEM_freeN(properties);
-		ptr->data= NULL; /* just incase */
+		ptr->data = NULL; /* just in case */
 	}
 }
 
@@ -673,11 +650,11 @@ void WM_operator_properties_free(PointerRNA *ptr)
 /* invoke callback, uses enum property named "type" */
 int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	PropertyRNA *prop= op->type->prop;
+	PropertyRNA *prop = op->type->prop;
 	uiPopupMenu *pup;
 	uiLayout *layout;
 
-	if(prop==NULL) {
+	if (prop == NULL) {
 		printf("%s: %s has no enum property set\n", __func__, op->type->idname);
 	}
 	else if (RNA_property_type(prop) != PROP_ENUM) {
@@ -685,13 +662,13 @@ int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 		       __func__, op->type->idname, RNA_property_identifier(prop));
 	}
 	else if (RNA_property_is_set(op->ptr, prop)) {
-		const int retval= op->type->exec(C, op);
+		const int retval = op->type->exec(C, op);
 		OPERATOR_RETVAL_CHECK(retval);
 		return retval;
 	}
 	else {
-		pup= uiPupMenuBegin(C, op->type->name, ICON_NONE);
-		layout= uiPupMenuLayout(pup);
+		pup = uiPupMenuBegin(C, RNA_struct_ui_name(op->type->srna), ICON_NONE);
+		layout = uiPupMenuLayout(pup);
 		uiItemsFullEnumO(layout, op->type->idname, RNA_property_identifier(prop), op->ptr->data, WM_OP_EXEC_REGION_WIN, 0);
 		uiPupMenuEnd(C, pup);
 	}
@@ -704,9 +681,9 @@ int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 static void operator_enum_search_cb(const struct bContext *C, void *arg_ot, const char *str, uiSearchItems *items)
 {
 	wmOperatorType *ot = (wmOperatorType *)arg_ot;
-	PropertyRNA *prop= ot->prop;
+	PropertyRNA *prop = ot->prop;
 
-	if(prop==NULL) {
+	if (prop == NULL) {
 		printf("%s: %s has no enum property set\n",
 		       __func__, ot->idname);
 	}
@@ -723,24 +700,24 @@ static void operator_enum_search_cb(const struct bContext *C, void *arg_ot, cons
 		RNA_pointer_create(NULL, ot->srna, NULL, &ptr);
 		RNA_property_enum_items((bContext *)C, &ptr, prop, &item_array, NULL, &do_free);
 
-		for(item= item_array; item->identifier; item++) {
-			/* note: need to give the intex rather than the dientifier because the enum can be freed */
-			if(BLI_strcasestr(item->name, str))
-				if(0==uiSearchItemAdd(items, item->name, SET_INT_IN_POINTER(item->value), 0))
+		for (item = item_array; item->identifier; item++) {
+			/* note: need to give the index rather than the identifier because the enum can be freed */
+			if (BLI_strcasestr(item->name, str))
+				if (0 == uiSearchItemAdd(items, item->name, SET_INT_IN_POINTER(item->value), 0))
 					break;
 		}
 
-		if(do_free)
+		if (do_free)
 			MEM_freeN(item_array);
 	}
 }
 
 static void operator_enum_call_cb(struct bContext *C, void *arg1, void *arg2)
 {
-	wmOperatorType *ot= arg1;
+	wmOperatorType *ot = arg1;
 
-	if(ot) {
-		if(ot->prop) {
+	if (ot) {
+		if (ot->prop) {
 			PointerRNA props_ptr;
 			WM_operator_properties_create_ptr(&props_ptr, ot);
 			RNA_property_enum_set(&props_ptr, ot->prop, GET_INT_FROM_POINTER(arg2));
@@ -755,31 +732,33 @@ static void operator_enum_call_cb(struct bContext *C, void *arg1, void *arg2)
 
 static uiBlock *wm_enum_search_menu(bContext *C, ARegion *ar, void *arg_op)
 {
-	static char search[256]= "";
+	static char search[256] = "";
 	wmEvent event;
-	wmWindow *win= CTX_wm_window(C);
+	wmWindow *win = CTX_wm_window(C);
 	uiBlock *block;
 	uiBut *but;
-	wmOperator *op= (wmOperator *)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);
+	block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
+	uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_RET_1 | UI_BLOCK_MOVEMOUSE_QUIT);
 
-	//uiDefBut(block, LABEL, 0, op->type->name, 10, 10, 180, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); // ok, this isnt so easy...
-	but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 10, 9*UI_UNIT_X, UI_UNIT_Y, 0, 0, "");
+#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, "");
+#endif
+	but = uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 10, 9 * UI_UNIT_X, UI_UNIT_Y, 0, 0, "");
 	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 - uiSearchBoxhHeight(), 9 * UI_UNIT_X, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL);
 
 	uiPopupBoundsBlock(block, 6, 0, -UI_UNIT_Y); /* move it downwards, mouse over button */
 	uiEndBlock(C, block);
 
-	event= *(win->eventstate);	/* XXX huh huh? make api call */
-	event.type= EVT_BUT_OPEN;
-	event.val= KM_PRESS;
-	event.customdata= but;
-	event.customdatafree= FALSE;
+	event = *(win->eventstate);  /* XXX huh huh? make api call */
+	event.type = EVT_BUT_OPEN;
+	event.val = KM_PRESS;
+	event.customdata = but;
+	event.customdatafree = FALSE;
 	wm_event_add(win, &event);
 
 	return block;
@@ -797,15 +776,15 @@ int WM_operator_confirm_message(bContext *C, wmOperator *op, const char *message
 {
 	uiPopupMenu *pup;
 	uiLayout *layout;
-	IDProperty *properties= op->ptr->data;
+	IDProperty *properties = op->ptr->data;
 
-	if(properties && properties->len)
-		properties= IDP_CopyProperty(op->ptr->data);
+	if (properties && properties->len)
+		properties = IDP_CopyProperty(op->ptr->data);
 	else
-		properties= NULL;
+		properties = NULL;
 
-	pup= uiPupMenuBegin(C, IFACE_("OK?"), ICON_QUESTION);
-	layout= uiPupMenuLayout(pup);
+	pup = uiPupMenuBegin(C, IFACE_("OK?"), ICON_QUESTION);
+	layout = uiPupMenuLayout(pup);
 	uiItemFullO_ptr(layout, op->type, message, ICON_NONE, properties, WM_OP_EXEC_REGION_WIN, 0);
 	uiPupMenuEnd(C, pup);
 	
@@ -830,6 +809,22 @@ int WM_operator_filesel(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 	}
 }
 
+int WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const char imtype)
+{
+	PropertyRNA *prop;
+	char filepath[FILE_MAX];
+	/* dont NULL check prop, this can only run on ops with a 'filepath' */
+	prop = RNA_struct_find_property(op->ptr, "filepath");
+	RNA_property_string_get(op->ptr, prop, filepath);
+	if (BKE_add_image_extension(filepath, imtype)) {
+		RNA_property_string_set(op->ptr, prop, filepath);
+		/* note, we could check for and update 'filename' here,
+		 * but so far nothing needs this. */
+		return TRUE;
+	}
+	return FALSE;
+}
+
 /* default properties for fileselect */
 void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type, short action, short flag, short display)
 {
@@ -840,67 +835,68 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type,
 		{FILE_SHORTDISPLAY, "FILE_SHORTDISPLAY", ICON_SHORTDISPLAY, "Short List", "Display files as short list"},
 		{FILE_LONGDISPLAY, "FILE_LONGDISPLAY", ICON_LONGDISPLAY, "Long List", "Display files as a detailed list"},
 		{FILE_IMGDISPLAY, "FILE_IMGDISPLAY", ICON_IMGDISPLAY, "Thumbnails", "Display files as thumbnails"},
-		{0, NULL, 0, NULL, NULL}};
+		{0, NULL, 0, NULL, NULL}
+	};
 
 
-	if(flag & WM_FILESEL_FILEPATH)
+	if (flag & WM_FILESEL_FILEPATH)
 		RNA_def_string_file_path(ot->srna, "filepath", "", FILE_MAX, "File Path", "Path to file");
 
-	if(flag & WM_FILESEL_DIRECTORY)
+	if (flag & WM_FILESEL_DIRECTORY)
 		RNA_def_string_dir_path(ot->srna, "directory", "", FILE_MAX, "Directory", "Directory of the file");
 
-	if(flag & WM_FILESEL_FILENAME)
+	if (flag & WM_FILESEL_FILENAME)
 		RNA_def_string_file_name(ot->srna, "filename", "", FILE_MAX, "File Name", "Name of the file");
 
-	if(flag & WM_FILESEL_FILES)
+	if (flag & WM_FILESEL_FILES)
 		RNA_def_collection_runtime(ot->srna, "files", &RNA_OperatorFileListElement, "Files", "");
 
 	if (action == FILE_SAVE) {
-		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= RNA_def_boolean(ot->srna, "filter_blender", (filter & BLENDERFILE), "Filter .blend files", "");
-	RNA_def_property_flag(prop, PROP_HIDDEN);
-	prop= RNA_def_boolean(ot->srna, "filter_image", (filter & IMAGEFILE), "Filter image files", "");
-	RNA_def_property_flag(prop, PROP_HIDDEN);
-	prop= RNA_def_boolean(ot->srna, "filter_movie", (filter & MOVIEFILE), "Filter movie files", "");
-	RNA_def_property_flag(prop, PROP_HIDDEN);
-	prop= RNA_def_boolean(ot->srna, "filter_python", (filter & PYSCRIPTFILE), "Filter python files", "");
-	RNA_def_property_flag(prop, PROP_HIDDEN);
-	prop= RNA_def_boolean(ot->srna, "filter_font", (filter & FTFONTFILE), "Filter font files", "");
-	RNA_def_property_flag(prop, PROP_HIDDEN);
-	prop= RNA_def_boolean(ot->srna, "filter_sound", (filter & SOUNDFILE), "Filter sound files", "");
-	RNA_def_property_flag(prop, PROP_HIDDEN);
-	prop= RNA_def_boolean(ot->srna, "filter_text", (filter & TEXTFILE), "Filter text files", "");
-	RNA_def_property_flag(prop, PROP_HIDDEN);
-	prop= RNA_def_boolean(ot->srna, "filter_btx", (filter & BTXFILE), "Filter btx files", "");
-	RNA_def_property_flag(prop, PROP_HIDDEN);
-	prop= RNA_def_boolean(ot->srna, "filter_collada", (filter & COLLADAFILE), "Filter COLLADA files", "");
-	RNA_def_property_flag(prop, PROP_HIDDEN);
-	prop= RNA_def_boolean(ot->srna, "filter_folder", (filter & FOLDERFILE), "Filter folders", "");
-	RNA_def_property_flag(prop, PROP_HIDDEN);
-
-	prop= RNA_def_int(ot->srna, "filemode", type, FILE_LOADLIB, FILE_SPECIAL, 
-		"File Browser Mode", "The setting for the file browser mode to load a .blend file, a library or a special file",
-		FILE_LOADLIB, FILE_SPECIAL);
-	RNA_def_property_flag(prop, PROP_HIDDEN);
-
-	if(flag & WM_FILESEL_RELPATH)
+		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_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", "");
+	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+	prop = RNA_def_boolean(ot->srna, "filter_python", (filter & PYSCRIPTFILE), "Filter python files", "");
+	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+	prop = RNA_def_boolean(ot->srna, "filter_font", (filter & FTFONTFILE), "Filter font files", "");
+	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+	prop = RNA_def_boolean(ot->srna, "filter_sound", (filter & SOUNDFILE), "Filter sound files", "");
+	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+	prop = RNA_def_boolean(ot->srna, "filter_text", (filter & TEXTFILE), "Filter text files", "");
+	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+	prop = RNA_def_boolean(ot->srna, "filter_btx", (filter & BTXFILE), "Filter btx files", "");
+	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+	prop = RNA_def_boolean(ot->srna, "filter_collada", (filter & COLLADAFILE), "Filter COLLADA files", "");
+	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+	prop = RNA_def_boolean(ot->srna, "filter_folder", (filter & FOLDERFILE), "Filter folders", "");
+	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+
+	prop = RNA_def_int(ot->srna, "filemode", type, FILE_LOADLIB, FILE_SPECIAL,
+	                   "File Browser Mode", "The setting for the file browser mode to load a .blend file, a library or a special file",
+	                   FILE_LOADLIB, FILE_SPECIAL);
+	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+
+	if (flag & WM_FILESEL_RELPATH)
 		RNA_def_boolean(ot->srna, "relative_path", TRUE, "Relative Path", "Select the file relative to the blend file");
 
-	prop= RNA_def_enum(ot->srna, "display_type", file_display_items, display, "Display Type", "");
-	RNA_def_property_flag(prop, PROP_HIDDEN);
+	prop = RNA_def_enum(ot->srna, "display_type", file_display_items, display, "Display Type", "");
+	RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
 }
 
 void WM_operator_properties_select_all(wmOperatorType *ot)
 {
 	static EnumPropertyItem select_all_actions[] = {
-			{SEL_TOGGLE, "TOGGLE", 0, "Toggle", "Toggle selection for all elements"},
-			{SEL_SELECT, "SELECT", 0, "Select", "Select all elements"},
-			{SEL_DESELECT, "DESELECT", 0, "Deselect", "Deselect all elements"},
-			{SEL_INVERT, "INVERT", 0, "Invert", "Invert selection of all elements"},
-			{0, NULL, 0, NULL, NULL}
+		{SEL_TOGGLE, "TOGGLE", 0, "Toggle", "Toggle selection for all elements"},
+		{SEL_SELECT, "SELECT", 0, "Select", "Select all elements"},
+		{SEL_DESELECT, "DESELECT", 0, "Deselect", "Deselect all elements"},
+		{SEL_INVERT, "INVERT", 0, "Invert", "Invert selection of all elements"},
+		{0, NULL, 0, NULL, NULL}
 	};
 
 	RNA_def_enum(ot->srna, "action", select_all_actions, SEL_TOGGLE, "Action", "Selection action to execute");
@@ -914,7 +910,7 @@ void WM_operator_properties_gesture_border(wmOperatorType *ot, int extend)
 	RNA_def_int(ot->srna, "ymin", 0, INT_MIN, INT_MAX, "Y Min", "", INT_MIN, INT_MAX);
 	RNA_def_int(ot->srna, "ymax", 0, INT_MIN, INT_MAX, "Y Max", "", INT_MIN, INT_MAX);
 
-	if(extend)
+	if (extend)
 		RNA_def_boolean(ot->srna, "extend", 1, "Extend", "Extend selection instead of deselecting everything first");
 }
 
@@ -925,7 +921,7 @@ void WM_operator_properties_gesture_straightline(wmOperatorType *ot, int cursor)
 	RNA_def_int(ot->srna, "ystart", 0, INT_MIN, INT_MAX, "Y Start", "", INT_MIN, INT_MAX);
 	RNA_def_int(ot->srna, "yend", 0, INT_MIN, INT_MAX, "Y End", "", INT_MIN, INT_MAX);
 	
-	if(cursor)
+	if (cursor)
 		RNA_def_int(ot->srna, "cursor", cursor, 0, INT_MAX, "Cursor", "Mouse cursor style to use during the modal operator", 0, INT_MAX);
 }
 
@@ -933,27 +929,27 @@ void WM_operator_properties_gesture_straightline(wmOperatorType *ot, int cursor)
 /* op->poll */
 int WM_operator_winactive(bContext *C)
 {
-	if(CTX_wm_window(C)==NULL) return 0;
+	if (CTX_wm_window(C) == NULL) return 0;
 	return 1;
 }
 
 /* return FALSE, if the UI should be disabled */
 int WM_operator_check_ui_enabled(const bContext *C, const char *idname)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
-	Scene *scene= CTX_data_scene(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
+	Scene *scene = CTX_data_scene(C);
 
-	return !(ED_undo_valid(C, idname)==0 || WM_jobs_test(wm, scene));
+	return !(ED_undo_valid(C, idname) == 0 || WM_jobs_test(wm, scene));
 }
 
 wmOperator *WM_operator_last_redo(const bContext *C)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 	wmOperator *op;
 
 	/* only for operators that are registered and did an undo push */
-	for(op= wm->operators.last; op; op= op->prev)
-		if((op->type->flag & OPTYPE_REGISTER) && (op->type->flag & OPTYPE_UNDO))
+	for (op = wm->operators.last; op; op = op->prev)
+		if ((op->type->flag & OPTYPE_REGISTER) && (op->type->flag & OPTYPE_UNDO))
 			break;
 
 	return op;
@@ -961,30 +957,30 @@ wmOperator *WM_operator_last_redo(const bContext *C)
 
 static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
 {
-	wmOperator *op= arg_op;
+	wmOperator *op = arg_op;
 	uiBlock *block;
 	uiLayout *layout;
-	uiStyle *style= UI_GetStyle();
-	int width= 300;
+	uiStyle *style = UI_GetStyle();
+	int width = 300;
 	
 
-	block= uiBeginBlock(C, ar, __func__, UI_EMBOSS);
+	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_RET_1 | 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);
-	layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, width, UI_UNIT_Y, style);
+	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, 0);
 
-	if(op->type->flag & OPTYPE_MACRO) {
-		for(op= op->macro.first; op; op= op->next) {
-			uiItemL(layout, op->type->name, ICON_NONE);
+	if (op->type->flag & OPTYPE_MACRO) {
+		for (op = op->macro.first; op; op = op->next) {
+			uiItemL(layout, RNA_struct_ui_name(op->type->srna), ICON_NONE);
 			uiLayoutOperatorButs(C, layout, op, NULL, 'H', UI_LAYOUT_OP_SHOW_TITLE);
 		}
 	}
@@ -999,8 +995,7 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op)
 	return block;
 }
 
-typedef struct wmOpPopUp
-{
+typedef struct wmOpPopUp {
 	wmOperator *op;
 	int width;
 	int height;
@@ -1010,8 +1005,8 @@ typedef struct wmOpPopUp
 /* Only invoked by OK button in popups created with wm_block_dialog_create() */
 static void dialog_exec_cb(bContext *C, void *arg1, void *arg2)
 {
-	wmOpPopUp *data= arg1;
-	uiBlock *block= arg2;
+	wmOpPopUp *data = arg1;
+	uiBlock *block = arg2;
 
 	WM_operator_call(C, data->op);
 
@@ -1027,9 +1022,9 @@ static void dialog_exec_cb(bContext *C, void *arg1, void *arg2)
 
 static void dialog_check_cb(bContext *C, void *op_ptr, void *UNUSED(arg))
 {
-	wmOperator *op= op_ptr;
-	if(op->type->check) {
-		if(op->type->check(C, op)) {
+	wmOperator *op = op_ptr;
+	if (op->type->check) {
+		if (op->type->check(C, op)) {
 			/* refresh */
 		}
 	}
@@ -1038,17 +1033,17 @@ static void dialog_check_cb(bContext *C, void *op_ptr, void *UNUSED(arg))
 /* Dialogs are popups that require user verification (click OK) before exec */
 static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData)
 {
-	wmOpPopUp *data= userData;
-	wmOperator *op= data->op;
+	wmOpPopUp *data = userData;
+	wmOperator *op = data->op;
 	uiBlock *block;
 	uiLayout *layout;
-	uiStyle *style= UI_GetStyle();
+	uiStyle *style = UI_GetStyle();
 
 	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_RET_1 | UI_BLOCK_MOVEMOUSE_QUIT);
 
-	layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, style);
+	layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, style);
 	
 	uiBlockSetFunc(block, dialog_check_cb, op, NULL);
 
@@ -1063,15 +1058,15 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData)
 		uiLayout *col;
 		uiBut *btn;
 
-		col= uiLayoutColumn(layout, FALSE);
-		col_block= uiLayoutGetBlock(col);
+		col = uiLayoutColumn(layout, FALSE);
+		col_block = uiLayoutGetBlock(col);
 		/* Create OK button, the callback of which will execute op */
-		btn= uiDefBut(col_block, BUT, 0, IFACE_("OK"), 0, -30, 0, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
+		btn = uiDefBut(col_block, BUT, 0, IFACE_("OK"), 0, -30, 0, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
 		uiButSetFunc(btn, dialog_exec_cb, data, col_block);
 	}
 
 	/* center around the mouse */
-	uiPopupBoundsBlock(block, 4, data->width/-2, data->height/2);
+	uiPopupBoundsBlock(block, 4, data->width / -2, data->height / 2);
 	uiEndBlock(C, block);
 
 	return block;
@@ -1079,17 +1074,17 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData)
 
 static uiBlock *wm_operator_ui_create(bContext *C, ARegion *ar, void *userData)
 {
-	wmOpPopUp *data= userData;
-	wmOperator *op= data->op;
+	wmOpPopUp *data = userData;
+	wmOperator *op = data->op;
 	uiBlock *block;
 	uiLayout *layout;
-	uiStyle *style= UI_GetStyle();
+	uiStyle *style = UI_GetStyle();
 
-	block= uiBeginBlock(C, ar, __func__, UI_EMBOSS);
+	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_RET_1 | UI_BLOCK_MOVEMOUSE_QUIT);
 
-	layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, style);
+	layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, style);
 
 	/* since ui is defined the auto-layout args are not used */
 	uiLayoutOperatorButs(C, layout, op, NULL, 'V', 0);
@@ -1102,9 +1097,9 @@ static uiBlock *wm_operator_ui_create(bContext *C, ARegion *ar, void *userData)
 
 static void wm_operator_ui_popup_cancel(void *userData)
 {
-	wmOpPopUp *data= userData;
-	if(data->free_op && data->op) {
-		wmOperator *op= data->op;
+	wmOpPopUp *data = userData;
+	if (data->free_op && data->op) {
+		wmOperator *op = data->op;
 		WM_operator_free(op);
 	}
 
@@ -1113,20 +1108,20 @@ static void wm_operator_ui_popup_cancel(void *userData)
 
 static void wm_operator_ui_popup_ok(struct bContext *C, void *arg, int retval)
 {
-	wmOpPopUp *data= arg;
-	wmOperator *op= data->op;
+	wmOpPopUp *data = arg;
+	wmOperator *op = data->op;
 
-	if(op && retval > 0)
+	if (op && retval > 0)
 		WM_operator_call(C, op);
 }
 
 int WM_operator_ui_popup(bContext *C, wmOperator *op, int width, int height)
 {
-	wmOpPopUp *data= MEM_callocN(sizeof(wmOpPopUp), "WM_operator_ui_popup");
-	data->op= op;
-	data->width= width;
-	data->height= height;
-	data->free_op= TRUE; /* if this runs and gets registered we may want not to free it */
+	wmOpPopUp *data = MEM_callocN(sizeof(wmOpPopUp), "WM_operator_ui_popup");
+	data->op = op;
+	data->width = width;
+	data->height = height;
+	data->free_op = TRUE; /* if this runs and gets registered we may want not to free it */
 	uiPupBlockEx(C, wm_operator_ui_create, NULL, wm_operator_ui_popup_cancel, data);
 	return OPERATOR_RUNNING_MODAL;
 }
@@ -1135,8 +1130,9 @@ int WM_operator_ui_popup(bContext *C, wmOperator *op, int width, int height)
 int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
 	
-	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);
+	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);
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -1150,12 +1146,12 @@ int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 
 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");
+	wmOpPopUp *data = MEM_callocN(sizeof(wmOpPopUp), "WM_operator_props_dialog_popup");
 	
-	data->op= op;
-	data->width= width;
-	data->height= height;
-	data->free_op= TRUE; /* if this runs and gets registered we may want not to free it */
+	data->op = op;
+	data->width = width;
+	data->height = height;
+	data->free_op = TRUE; /* if this runs and gets registered we may want not to free it */
 
 	/* op is not executed until popup OK but is clicked */
 	uiPupBlockEx(C, wm_block_dialog_create, wm_operator_ui_popup_ok, wm_operator_ui_popup_cancel, data);
@@ -1166,11 +1162,11 @@ int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width, int h
 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) {
+	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);
 		return OPERATOR_CANCELLED;
 	}
-	if(op->type->poll && op->type->poll(C)==0) {
+	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);
 		return OPERATOR_CANCELLED;
 	}
@@ -1184,7 +1180,7 @@ int WM_operator_redo_popup(bContext *C, wmOperator *op)
 
 static int wm_debug_menu_exec(bContext *C, wmOperator *op)
 {
-	G.rt= RNA_int_get(op->ptr, "debug_value");
+	G.rt = RNA_int_get(op->ptr, "debug_value");
 	ED_screen_refresh(CTX_wm_manager(C), CTX_wm_window(C));
 	WM_event_add_notifier(C, NC_WINDOW, NULL);
 
@@ -1194,18 +1190,18 @@ static int wm_debug_menu_exec(bContext *C, wmOperator *op)
 static int wm_debug_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
 	RNA_int_set(op->ptr, "debug_value", G.rt);
-	return WM_operator_props_dialog_popup(C, op, 9*UI_UNIT_X, UI_UNIT_Y);
+	return WM_operator_props_dialog_popup(C, op, 9 * UI_UNIT_X, UI_UNIT_Y);
 }
 
 static void WM_OT_debug_menu(wmOperatorType *ot)
 {
-	ot->name= "Debug Menu";
-	ot->idname= "WM_OT_debug_menu";
-	ot->description= "Open a popup to set the debug level";
+	ot->name = "Debug Menu";
+	ot->idname = "WM_OT_debug_menu";
+	ot->description = "Open a popup to set the debug level";
 	
-	ot->invoke= wm_debug_menu_invoke;
-	ot->exec= wm_debug_menu_exec;
-	ot->poll= WM_operator_winactive;
+	ot->invoke = wm_debug_menu_invoke;
+	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);
 }
@@ -1222,31 +1218,32 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse
 
 /* XXX: hack to refresh splash screen with updated prest menu name,
  * since popup blocks don't get regenerated like panels do */
-static void wm_block_splash_refreshmenu (bContext *UNUSED(C), void *UNUSED(arg_block), void *UNUSED(arg))
+static void wm_block_splash_refreshmenu(bContext *UNUSED(C), void *UNUSED(arg_block), void *UNUSED(arg))
 {
 	/* ugh, causes crashes in other buttons, disabling for now until 
-	 * a better fix
+	 * a better fix */
+#if 0
 	uiPupBlockClose(C, arg_block);
 	uiPupBlock(C, wm_block_create_splash, NULL);
-	  */
+#endif
 }
 
 static int wm_resource_check_prev(void)
 {
 
-	char *res= BLI_get_folder_version(BLENDER_RESOURCE_PATH_USER, BLENDER_VERSION, TRUE);
+	char *res = BLI_get_folder_version(BLENDER_RESOURCE_PATH_USER, BLENDER_VERSION, TRUE);
 
-	// if(res) printf("USER: %s\n", res);
+	// if (res) printf("USER: %s\n", res);
 
 #if 0 /* ignore the local folder */
-	if(res == NULL) {
-		/* with a local dir, copying old files isnt useful since local dir get priority for config */
-		res= BLI_get_folder_version(BLENDER_RESOURCE_PATH_LOCAL, BLENDER_VERSION, TRUE);
+	if (res == NULL) {
+		/* with a local dir, copying old files isn't useful since local dir get priority for config */
+		res = BLI_get_folder_version(BLENDER_RESOURCE_PATH_LOCAL, BLENDER_VERSION, TRUE);
 	}
 #endif
 
-	// if(res) printf("LOCAL: %s\n", res);
-	if(res) {
+	// if (res) printf("LOCAL: %s\n", res);
+	if (res) {
 		return FALSE;
 	}
 	else {
@@ -1259,19 +1256,19 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
 	uiBlock *block;
 	uiBut *but;
 	uiLayout *layout, *split, *col;
-	uiStyle *style= UI_GetStyle();
+	uiStyle *style = UI_GetStyle();
 	struct RecentFile *recent;
 	int i;
-	MenuType *mt= WM_menutype_find("USERPREF_MT_splash", TRUE);
+	MenuType *mt = WM_menutype_find("USERPREF_MT_splash", TRUE);
 	char url[96];
 
 #ifndef WITH_HEADLESS
 	extern char datatoc_splash_png[];
 	extern int datatoc_splash_png_size;
 
-	ImBuf *ibuf= IMB_ibImageFromMemory((unsigned char*)datatoc_splash_png, datatoc_splash_png_size, IB_rect, "<splash screen>");
+	ImBuf *ibuf = IMB_ibImageFromMemory((unsigned char *)datatoc_splash_png, datatoc_splash_png_size, IB_rect, "<splash screen>");
 #else
-	ImBuf *ibuf= NULL;
+	ImBuf *ibuf = NULL;
 #endif
 
 
@@ -1282,7 +1279,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
 	extern char build_rev[];
 	
 	BLI_snprintf(version_buf, sizeof(version_buf),
-	             "%d.%02d.%d", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
+	             "%d.%02d.%d", BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION);
 	BLI_snprintf(revision_buf, sizeof(revision_buf), "r%s", build_rev);
 	
 	BLF_size(style->widgetlabel.uifont_id, style->widgetlabel.points, U.dpi);
@@ -1290,26 +1287,26 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
 	rev_width = (int)BLF_width(style->widgetlabel.uifont_id, revision_buf) + 5;
 #endif //WITH_BUILDINFO
 
-	block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
+	block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
 	uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN);
 	
-	but= uiDefBut(block, BUT_IMAGE, 0, "", 0, 10, 501, 282, ibuf, 0.0, 0.0, 0, 0, ""); /* button owns the imbuf now */
+	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);
 	uiBlockSetFunc(block, wm_block_splash_refreshmenu, block, NULL);
 	
 #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);
+	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
 	
-	layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 10, 2, 480, 110, style);
+	layout = uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 10, 2, 480, 110, style);
 	
 	uiBlockSetEmboss(block, UI_EMBOSS);
 	/* show the splash menu (containing interaction presets), using python */
 	if (mt) {
-		Menu menu= {NULL};
-		menu.layout= layout;
-		menu.type= mt;
+		Menu menu = {NULL};
+		menu.layout = layout;
+		menu.type = mt;
 		mt->draw(C, &menu);
 
 //		wmWindowManager *wm= CTX_wm_manager(C);
@@ -1324,28 +1321,28 @@ 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-262");
-	uiItemStringO(col, IFACE_("Manual"), ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:2.5/Manual");
+	uiItemStringO(col, IFACE_("Release Log"), ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-263");
+	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");
-	if(strcmp(STRINGIFY(BLENDER_VERSION_CYCLE), "release")==0) {
-		BLI_snprintf(url, sizeof(url), "http://www.blender.org/documentation/blender_python_api_%d_%d" STRINGIFY(BLENDER_VERSION_CHAR) "_release", BLENDER_VERSION/100, BLENDER_VERSION%100);
+	if (strcmp(STRINGIFY(BLENDER_VERSION_CYCLE), "release") == 0) {
+		BLI_snprintf(url, sizeof(url), "http://www.blender.org/documentation/blender_python_api_%d_%d" STRINGIFY(BLENDER_VERSION_CHAR) "_release", BLENDER_VERSION / 100, BLENDER_VERSION % 100);
 	}
 	else {
-		BLI_snprintf(url, sizeof(url), "http://www.blender.org/documentation/blender_python_api_%d_%d_%d", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
+		BLI_snprintf(url, sizeof(url), "http://www.blender.org/documentation/blender_python_api_%d_%d_%d", BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION);
 	}
 	uiItemStringO(col, IFACE_("Python API Reference"), ICON_URL, "WM_OT_url_open", "url", url);
 	uiItemL(col, "", ICON_NONE);
 
 	col = uiLayoutColumn(split, 0);
 
-	if(wm_resource_check_prev()) {
+	if (wm_resource_check_prev()) {
 		uiItemO(col, NULL, ICON_NEW, "WM_OT_copy_prev_settings");
 		uiItemS(col);
 	}
 
 	uiItemL(col, IFACE_("Recent"), ICON_NONE);
-	for(recent = G.recent_files.first, i=0; (i<5) && (recent); recent = recent->next, i++) {
+	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);
 	}
 
@@ -1368,38 +1365,38 @@ static int wm_splash_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED
 
 static void WM_OT_splash(wmOperatorType *ot)
 {
-	ot->name= "Splash Screen";
-	ot->idname= "WM_OT_splash";
-	ot->description= "Opens a blocking popup region with release info";
+	ot->name = "Splash Screen";
+	ot->idname = "WM_OT_splash";
+	ot->description = "Opens a blocking popup region with release info";
 	
-	ot->invoke= wm_splash_invoke;
-	ot->poll= WM_operator_winactive;
+	ot->invoke = wm_splash_invoke;
+	ot->poll = WM_operator_winactive;
 }
 
 
 /* ***************** Search menu ************************* */
 static void operator_call_cb(struct bContext *C, void *UNUSED(arg1), void *arg2)
 {
-	wmOperatorType *ot= arg2;
+	wmOperatorType *ot = arg2;
 	
-	if(ot)
+	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();
+	GHashIterator *iter = WM_operatortype_iter();
 
-	for( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
-		wmOperatorType *ot= BLI_ghashIterator_getValue(iter);
+	for (; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
+		wmOperatorType *ot = BLI_ghashIterator_getValue(iter);
 
-		if((ot->flag & OPTYPE_INTERNAL) && (G.f & G_DEBUG) == 0)
+		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)) {
+		if (BLI_strcasestr(ot->name, str)) {
+			if (WM_operator_poll((bContext *)C, ot)) {
 				char name[256];
-				int len= strlen(ot->name);
+				int len = strlen(ot->name);
 				
 				/* display name for menu, can hold hotkey */
 				BLI_strncpy(name, ot->name, sizeof(name));
@@ -1407,13 +1404,13 @@ static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), cons
 				/* 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 + 1], sizeof(name) - len - 1))
 					{
-						name[len]= '|';
+						name[len] = '|';
 					}
 				}
 				
-				if(0==uiSearchItemAdd(items, name, ot, 0))
+				if (0 == uiSearchItemAdd(items, name, ot, 0))
 					break;
 			}
 		}
@@ -1423,29 +1420,29 @@ static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), cons
 
 static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *UNUSED(arg_op))
 {
-	static char search[256]= "";
+	static char search[256] = "";
 	wmEvent event;
-	wmWindow *win= CTX_wm_window(C);
+	wmWindow *win = CTX_wm_window(C);
 	uiBlock *block;
 	uiBut *but;
 	
-	block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
-	uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_RET_1|UI_BLOCK_MOVEMOUSE_QUIT);
+	block = uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
+	uiBlockSetFlag(block, UI_BLOCK_LOOP | UI_BLOCK_RET_1 | UI_BLOCK_MOVEMOUSE_QUIT);
 	
-	but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 10, 9*UI_UNIT_X, UI_UNIT_Y, 0, 0, "");
+	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);
 	
 	/* 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 - uiSearchBoxhHeight(), 9 * UI_UNIT_X, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL);
 	
 	uiPopupBoundsBlock(block, 6, 0, -UI_UNIT_Y); /* move it downwards, mouse over button */
 	uiEndBlock(C, block);
 	
-	event= *(win->eventstate);	/* XXX huh huh? make api call */
-	event.type= EVT_BUT_OPEN;
-	event.val= KM_PRESS;
-	event.customdata= but;
-	event.customdatafree= FALSE;
+	event = *(win->eventstate);  /* XXX huh huh? make api call */
+	event.type = EVT_BUT_OPEN;
+	event.val = KM_PRESS;
+	event.customdata = but;
+	event.customdatafree = FALSE;
 	wm_event_add(win, &event);
 	
 	return block;
@@ -1466,18 +1463,18 @@ static int wm_search_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev
 /* op->poll */
 static int wm_search_menu_poll(bContext *C)
 {
-	if(CTX_wm_window(C)==NULL) {
+	if (CTX_wm_window(C) == NULL) {
 		return 0;
 	}
 	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			
+		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
 		}
 		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
+			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
 		}
 	}
 	return 1;
@@ -1485,12 +1482,12 @@ static int wm_search_menu_poll(bContext *C)
 
 static void WM_OT_search_menu(wmOperatorType *ot)
 {
-	ot->name= "Search Menu";
-	ot->idname= "WM_OT_search_menu";
+	ot->name = "Search Menu";
+	ot->idname = "WM_OT_search_menu";
 	
-	ot->invoke= wm_search_menu_invoke;
-	ot->exec= wm_search_menu_exec;
-	ot->poll= wm_search_menu_poll;
+	ot->invoke = wm_search_menu_invoke;
+	ot->exec = wm_search_menu_exec;
+	ot->poll = wm_search_menu_poll;
 }
 
 static int wm_call_menu_exec(bContext *C, wmOperator *op)
@@ -1505,13 +1502,13 @@ static int wm_call_menu_exec(bContext *C, wmOperator *op)
 
 static void WM_OT_call_menu(wmOperatorType *ot)
 {
-	ot->name= "Call Menu";
-	ot->idname= "WM_OT_call_menu";
+	ot->name = "Call Menu";
+	ot->idname = "WM_OT_call_menu";
 
-	ot->exec= wm_call_menu_exec;
-	ot->poll= WM_operator_winactive;
+	ot->exec = wm_call_menu_exec;
+	ot->poll = WM_operator_winactive;
 
-	ot->flag= OPTYPE_INTERNAL;
+	ot->flag = OPTYPE_INTERNAL;
 
 	RNA_def_string(ot->srna, "name", "", BKE_ST_MAXNAME, "Name", "Name of the menu");
 }
@@ -1522,9 +1519,9 @@ static void WM_OT_call_menu(wmOperatorType *ot)
  * while it crashes on full screen */
 static int wm_operator_winactive_normal(bContext *C)
 {
-	wmWindow *win= CTX_wm_window(C);
+	wmWindow *win = CTX_wm_window(C);
 
-	if(win==NULL || win->screen==NULL || win->screen->full != SCREENNORMAL)
+	if (win == NULL || win->screen == NULL || win->screen->full != SCREENNORMAL)
 		return 0;
 
 	return 1;
@@ -1532,44 +1529,44 @@ static int wm_operator_winactive_normal(bContext *C)
 
 static void WM_OT_window_duplicate(wmOperatorType *ot)
 {
-	ot->name= "Duplicate Window";
-	ot->idname= "WM_OT_window_duplicate";
-	ot->description="Duplicate the current Blender window";
+	ot->name = "Duplicate Window";
+	ot->idname = "WM_OT_window_duplicate";
+	ot->description = "Duplicate the current Blender window";
 		
-	ot->exec= wm_window_duplicate_exec;
-	ot->poll= wm_operator_winactive_normal;
+	ot->exec = wm_window_duplicate_exec;
+	ot->poll = wm_operator_winactive_normal;
 }
 
 static void WM_OT_save_homefile(wmOperatorType *ot)
 {
-	ot->name= "Save User Settings";
-	ot->idname= "WM_OT_save_homefile";
-	ot->description="Make the current file the default .blend file";
+	ot->name = "Save User Settings";
+	ot->idname = "WM_OT_save_homefile";
+	ot->description = "Make the current file the default .blend file";
 		
-	ot->invoke= WM_operator_confirm;
-	ot->exec= WM_write_homefile;
-	ot->poll= WM_operator_winactive;
+	ot->invoke = WM_operator_confirm;
+	ot->exec = WM_write_homefile;
+	ot->poll = WM_operator_winactive;
 }
 
 static void WM_OT_read_homefile(wmOperatorType *ot)
 {
-	ot->name= "Reload Start-Up File";
-	ot->idname= "WM_OT_read_homefile";
-	ot->description="Open the default file (doesn't save the current file)";
+	ot->name = "Reload Start-Up File";
+	ot->idname = "WM_OT_read_homefile";
+	ot->description = "Open the default file (doesn't save the current file)";
 	
-	ot->invoke= WM_operator_confirm;
-	ot->exec= WM_read_homefile_exec;
+	ot->invoke = WM_operator_confirm;
+	ot->exec = WM_read_homefile_exec;
 	/* ommit poll to run in background mode */
 }
 
 static void WM_OT_read_factory_settings(wmOperatorType *ot)
 {
-	ot->name= "Load Factory Settings";
-	ot->idname= "WM_OT_read_factory_settings";
-	ot->description="Load default file and user preferences";
+	ot->name = "Load Factory Settings";
+	ot->idname = "WM_OT_read_factory_settings";
+	ot->description = "Load default file and user preferences";
 	
-	ot->invoke= WM_operator_confirm;
-	ot->exec= WM_read_homefile_exec;
+	ot->invoke = WM_operator_confirm;
+	ot->exec = WM_read_homefile_exec;
 	/* ommit poll to run in background mode */
 }
 
@@ -1577,13 +1574,13 @@ static void WM_OT_read_factory_settings(wmOperatorType *ot)
 
 static void open_set_load_ui(wmOperator *op)
 {
-	if(!RNA_struct_property_is_set(op->ptr, "load_ui"))
+	if (!RNA_struct_property_is_set(op->ptr, "load_ui"))
 		RNA_boolean_set(op->ptr, "load_ui", !(U.flag & USER_FILENOUI));
 }
 
 static void open_set_use_scripts(wmOperator *op)
 {
-	if(!RNA_struct_property_is_set(op->ptr, "use_scripts")) {
+	if (!RNA_struct_property_is_set(op->ptr, "use_scripts")) {
 		/* use G_SCRIPT_AUTOEXEC rather than the userpref because this means if
 		 * the flag has been disabled from the command line, then opening
 		 * from the menu wont enable this setting. */
@@ -1593,9 +1590,9 @@ static void open_set_use_scripts(wmOperator *op)
 
 static int wm_open_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	const char *openname= G.main->name;
+	const char *openname = G.main->name;
 
-	if(CTX_wm_window(C) == NULL) {
+	if (CTX_wm_window(C) == NULL) {
 		/* in rare cases this could happen, when trying to invoke in background
 		 * mode on load for example. Don't use poll for this because exec()
 		 * can still run without a window */
@@ -1626,12 +1623,12 @@ static int wm_open_mainfile_exec(bContext *C, wmOperator *op)
 	open_set_load_ui(op);
 	open_set_use_scripts(op);
 
-	if(RNA_boolean_get(op->ptr, "load_ui"))
+	if (RNA_boolean_get(op->ptr, "load_ui"))
 		G.fileflags &= ~G_FILE_NO_UI;
 	else
 		G.fileflags |= G_FILE_NO_UI;
 		
-	if(RNA_boolean_get(op->ptr, "use_scripts"))
+	if (RNA_boolean_get(op->ptr, "use_scripts"))
 		G.f |= G_SCRIPT_AUTOEXEC;
 	else
 		G.f &= ~G_SCRIPT_AUTOEXEC;
@@ -1647,30 +1644,32 @@ static int wm_open_mainfile_exec(bContext *C, wmOperator *op)
 
 static void WM_OT_open_mainfile(wmOperatorType *ot)
 {
-	ot->name= "Open Blender File";
-	ot->idname= "WM_OT_open_mainfile";
-	ot->description="Open a Blender file";
-	
-	ot->invoke= wm_open_mainfile_invoke;
-	ot->exec= wm_open_mainfile_exec;
+	ot->name = "Open Blender File";
+	ot->idname = "WM_OT_open_mainfile";
+	ot->description = "Open a Blender file";
+
+	ot->invoke = wm_open_mainfile_invoke;
+	ot->exec = wm_open_mainfile_exec;
 	/* ommit window poll so this can work in background mode */
-	
-	WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
+
+	WM_operator_properties_filesel(ot, FOLDERFILE | BLENDERFILE, FILE_BLENDER, FILE_OPENFILE,
+	                               WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
 
 	RNA_def_boolean(ot->srna, "load_ui", 1, "Load UI", "Load user interface setup in the .blend file");
-	RNA_def_boolean(ot->srna, "use_scripts", 1, "Trusted Source", "Allow blend file execute scripts automatically, default available from system preferences");
+	RNA_def_boolean(ot->srna, "use_scripts", 1, "Trusted Source",
+	                "Allow .blend file to execute scripts automatically, default available from system preferences");
 }
 
 /* **************** link/append *************** */
 
 int wm_link_append_poll(bContext *C)
 {
-	if(WM_operator_winactive(C)) {
+	if (WM_operator_winactive(C)) {
 		/* linking changes active object which is pretty useful in general,
-		   but which totally confuses edit mode (i.e. it becoming not so obvious
-		   to leave from edit mode and inwalid tools in toolbar might be displayed)
-		   so disable link/append when in edit mode (sergey) */
-		if(CTX_data_edit_object(C))
+		 * but which totally confuses edit mode (i.e. it becoming not so obvious
+		 * to leave from edit mode and inwalid tools in toolbar might be displayed)
+		 * so disable link/append when in edit mode (sergey) */
+		if (CTX_data_edit_object(C))
 			return 0;
 
 		return 1;
@@ -1681,15 +1680,15 @@ int wm_link_append_poll(bContext *C)
 
 static int wm_link_append_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
-	if(RNA_struct_property_is_set(op->ptr, "filepath")) {
+	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') {
+		if (G.lib[0] != '\0') {
 			RNA_string_set(op->ptr, "filepath", G.lib);
 		}
-		else if(G.relbase_valid) {
+		else if (G.relbase_valid) {
 			char path[FILE_MAX];
 			BLI_strncpy(path, G.main->name, sizeof(G.main->name));
 			BLI_parent_dir(path);
@@ -1702,64 +1701,64 @@ static int wm_link_append_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(ev
 
 static short wm_link_append_flag(wmOperator *op)
 {
-	short flag= 0;
+	short flag = 0;
 
-	if(RNA_boolean_get(op->ptr, "autoselect")) flag |= FILE_AUTOSELECT;
-	if(RNA_boolean_get(op->ptr, "active_layer")) flag |= FILE_ACTIVELAY;
-	if(RNA_boolean_get(op->ptr, "relative_path")) flag |= FILE_RELPATH;
-	if(RNA_boolean_get(op->ptr, "link")) flag |= FILE_LINK;
-	if(RNA_boolean_get(op->ptr, "instance_groups")) flag |= FILE_GROUP_INSTANCE;
+	if (RNA_boolean_get(op->ptr, "autoselect")) flag |= FILE_AUTOSELECT;
+	if (RNA_boolean_get(op->ptr, "active_layer")) flag |= FILE_ACTIVELAY;
+	if (RNA_boolean_get(op->ptr, "relative_path")) flag |= FILE_RELPATH;
+	if (RNA_boolean_get(op->ptr, "link")) flag |= FILE_LINK;
+	if (RNA_boolean_get(op->ptr, "instance_groups")) flag |= FILE_GROUP_INSTANCE;
 
 	return flag;
 }
 
 static int wm_link_append_exec(bContext *C, wmOperator *op)
 {
-	Main *bmain= CTX_data_main(C);
-	Scene *scene= CTX_data_scene(C);
-	Main *mainl= NULL;
+	Main *bmain = CTX_data_main(C);
+	Scene *scene = CTX_data_scene(C);
+	Main *mainl = NULL;
 	BlendHandle *bh;
 	PropertyRNA *prop;
 	char name[FILE_MAX], dir[FILE_MAX], libname[FILE_MAX], group[GROUP_MAX];
-	int idcode, totfiles=0;
+	int idcode, totfiles = 0;
 	short flag;
 
 	RNA_string_get(op->ptr, "filename", name);
 	RNA_string_get(op->ptr, "directory", dir);
 
 	/* test if we have a valid data */
-	if(BLO_is_a_library(dir, libname, group) == 0) {
+	if (BLO_is_a_library(dir, libname, group) == 0) {
 		BKE_report(op->reports, RPT_ERROR, "Not a library");
 		return OPERATOR_CANCELLED;
 	}
-	else if(group[0] == 0) {
+	else if (group[0] == 0) {
 		BKE_report(op->reports, RPT_ERROR, "Nothing indicated");
 		return OPERATOR_CANCELLED;
 	}
-	else if(BLI_path_cmp(bmain->name, libname) == 0) {
+	else if (BLI_path_cmp(bmain->name, libname) == 0) {
 		BKE_report(op->reports, RPT_ERROR, "Cannot use current file as library");
 		return OPERATOR_CANCELLED;
 	}
 
 	/* check if something is indicated for append/link */
 	prop = RNA_struct_find_property(op->ptr, "files");
-	if(prop) {
-		totfiles= RNA_property_collection_length(op->ptr, prop);
-		if(totfiles == 0) {
-			if(name[0] == '\0') {
+	if (prop) {
+		totfiles = RNA_property_collection_length(op->ptr, prop);
+		if (totfiles == 0) {
+			if (name[0] == '\0') {
 				BKE_report(op->reports, RPT_ERROR, "Nothing indicated");
 				return OPERATOR_CANCELLED;
 			}
 		}
 	}
-	else if(name[0] == '\0') {
+	else if (name[0] == '\0') {
 		BKE_report(op->reports, RPT_ERROR, "Nothing indicated");
 		return OPERATOR_CANCELLED;
 	}
 
 	bh = BLO_blendhandle_from_file(libname, op->reports);
 
-	if(bh == NULL) {
+	if (bh == NULL) {
 		/* unlikely since we just browsed it, but possible
 		 * error reports will have been made by BLO_blendhandle_from_file() */
 		return OPERATOR_CANCELLED;
@@ -1771,16 +1770,16 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
 	idcode = BKE_idcode_from_name(group);
 
 	/* now we have or selected, or an indicated file */
-	if(RNA_boolean_get(op->ptr, "autoselect"))
+	if (RNA_boolean_get(op->ptr, "autoselect"))
 		scene_deselect_all(scene);
 
 	
 	flag = wm_link_append_flag(op);
 
 	/* sanity checks for flag */
-	if(scene->id.lib && (flag & FILE_GROUP_INSTANCE)) {
+	if (scene->id.lib && (flag & FILE_GROUP_INSTANCE)) {
 		/* TODO, user never gets this message */
-		BKE_reportf(op->reports, RPT_WARNING, "Scene '%s' is linked, group instance disabled", scene->id.name+2);
+		BKE_reportf(op->reports, RPT_WARNING, "Scene '%s' is linked, group instance disabled", scene->id.name + 2);
 		flag &= ~FILE_GROUP_INSTANCE;
 	}
 
@@ -1793,7 +1792,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
 
 	/* here appending/linking starts */
 	mainl = BLO_library_append_begin(bmain, &bh, libname);
-	if(totfiles == 0) {
+	if (totfiles == 0) {
 		BLO_library_append_named_part_ex(C, mainl, &bh, name, idcode, flag);
 	}
 	else {
@@ -1809,10 +1808,10 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
 	recalc_all_library_objects(bmain);
 
 	/* append, rather than linking */
-	if((flag & FILE_LINK)==0) {
-		Library *lib= BLI_findstring(&bmain->library, libname, offsetof(Library, filepath));
-		if(lib)	BKE_library_make_local(bmain, lib, 1);
-		else	BLI_assert(!"cant find name of just added library!");
+	if ((flag & FILE_LINK) == 0) {
+		Library *lib = BLI_findstring(&bmain->library, libname, offsetof(Library, filepath));
+		if (lib) BKE_library_make_local(bmain, lib, 1);
+		else BLI_assert(!"cant find name of just added library!");
 	}
 
 	/* important we unset, otherwise these object wont
@@ -1835,17 +1834,20 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
 
 static void WM_OT_link_append(wmOperatorType *ot)
 {
-	ot->name= "Link/Append from Library";
-	ot->idname= "WM_OT_link_append";
-	ot->description= "Link or Append from a Library .blend file";
+	ot->name = "Link/Append from Library";
+	ot->idname = "WM_OT_link_append";
+	ot->description = "Link or Append from a Library .blend file";
 	
-	ot->invoke= wm_link_append_invoke;
-	ot->exec= wm_link_append_exec;
-	ot->poll= wm_link_append_poll;
+	ot->invoke = wm_link_append_invoke;
+	ot->exec = wm_link_append_exec;
+	ot->poll = wm_link_append_poll;
 	
 	ot->flag |= OPTYPE_UNDO;
 
-	WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_LOADLIB, FILE_OPENFILE, WM_FILESEL_FILEPATH|WM_FILESEL_DIRECTORY|WM_FILESEL_FILENAME| WM_FILESEL_RELPATH|WM_FILESEL_FILES, FILE_DEFAULTDISPLAY);
+	WM_operator_properties_filesel(
+	    ot, FOLDERFILE | BLENDERFILE, FILE_LOADLIB, FILE_OPENFILE,
+	    WM_FILESEL_FILEPATH | WM_FILESEL_DIRECTORY | WM_FILESEL_FILENAME | WM_FILESEL_RELPATH | WM_FILESEL_FILES,
+	    FILE_DEFAULTDISPLAY);
 	
 	RNA_def_boolean(ot->srna, "link", 1, "Link", "Link the objects or datablocks rather than appending");
 	RNA_def_boolean(ot->srna, "autoselect", 1, "Select", "Select the linked objects");
@@ -1875,12 +1877,12 @@ static int wm_recover_last_session_exec(bContext *C, wmOperator *op)
 
 static void WM_OT_recover_last_session(wmOperatorType *ot)
 {
-	ot->name= "Recover Last Session";
-	ot->idname= "WM_OT_recover_last_session";
-	ot->description="Open the last closed file (\"quit.blend\")";
+	ot->name = "Recover Last Session";
+	ot->idname = "WM_OT_recover_last_session";
+	ot->description = "Open the last closed file (\"quit.blend\")";
 	
-	ot->exec= wm_recover_last_session_exec;
-	ot->poll= WM_operator_winactive;
+	ot->exec = wm_recover_last_session_exec;
+	ot->poll = WM_operator_winactive;
 }
 
 /* *************** recover auto save **************** */
@@ -1918,13 +1920,13 @@ static int wm_recover_auto_save_invoke(bContext *C, wmOperator *op, wmEvent *UNU
 
 static void WM_OT_recover_auto_save(wmOperatorType *ot)
 {
-	ot->name= "Recover Auto Save";
-	ot->idname= "WM_OT_recover_auto_save";
-	ot->description="Open an automatically saved file to recover it";
+	ot->name = "Recover Auto Save";
+	ot->idname = "WM_OT_recover_auto_save";
+	ot->description = "Open an automatically saved file to recover it";
 	
-	ot->exec= wm_recover_auto_save_exec;
-	ot->invoke= wm_recover_auto_save_invoke;
-	ot->poll= WM_operator_winactive;
+	ot->exec = wm_recover_auto_save_exec;
+	ot->invoke = wm_recover_auto_save_invoke;
+	ot->poll = WM_operator_winactive;
 
 	WM_operator_properties_filesel(ot, BLENDERFILE, FILE_BLENDER, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_LONGDISPLAY);
 }
@@ -1933,10 +1935,10 @@ static void WM_OT_recover_auto_save(wmOperatorType *ot)
 
 static void untitled(char *name)
 {
-	if(G.save_over == 0 && strlen(name) < FILE_MAX-16) {
-		char *c= BLI_last_slash(name);
+	if (G.save_over == 0 && strlen(name) < FILE_MAX - 16) {
+		char *c = BLI_last_slash(name);
 		
-		if(c)
+		if (c)
 			strcpy(&c[1], "untitled.blend");
 		else
 			strcpy(name, "untitled.blend");
@@ -1945,8 +1947,8 @@ static void untitled(char *name)
 
 static void save_set_compress(wmOperator *op)
 {
-	if(!RNA_struct_property_is_set(op->ptr, "compress")) {
-		if(G.save_over) /* keep flag for existing file */
+	if (!RNA_struct_property_is_set(op->ptr, "compress")) {
+		if (G.save_over) /* keep flag for existing file */
 			RNA_boolean_set(op->ptr, "compress", G.fileflags & G_FILE_COMPRESS);
 		else /* use userdef for new file */
 			RNA_boolean_set(op->ptr, "compress", U.flag & USER_FILECOMPRESS);
@@ -1960,7 +1962,7 @@ static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
 	save_set_compress(op);
 	
 	/* if not saved before, get the name of the most recently used .blend file */
-	if(G.main->name[0]==0 && G.recent_files.first) {
+	if (G.main->name[0] == 0 && G.recent_files.first) {
 		struct RecentFile *recent = G.recent_files.first;
 		BLI_strncpy(name, recent->filepath, FILE_MAX);
 	}
@@ -1980,36 +1982,42 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
 {
 	char path[FILE_MAX];
 	int fileflags;
-	int copy=0;
+	int copy = 0;
 
 	save_set_compress(op);
 	
-	if(RNA_struct_property_is_set(op->ptr, "filepath"))
+	if (RNA_struct_property_is_set(op->ptr, "filepath"))
 		RNA_string_get(op->ptr, "filepath", path);
 	else {
 		BLI_strncpy(path, G.main->name, FILE_MAX);
 		untitled(path);
 	}
 
-	if(RNA_struct_property_is_set(op->ptr, "copy"))
+	if (RNA_struct_property_is_set(op->ptr, "copy"))
 		copy = RNA_boolean_get(op->ptr, "copy");
 	
-	fileflags= G.fileflags;
+	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;
+	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;
 #ifdef USE_BMESH_SAVE_AS_COMPAT
-	if(RNA_boolean_get(op->ptr, "use_mesh_compat"))	fileflags |=  G_FILE_MESH_COMPAT;
-	else											fileflags &= ~G_FILE_MESH_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;
+	}
 #endif
 
-	if ( WM_write_file(C, path, fileflags, op->reports, copy) != 0)
+	if (WM_write_file(C, path, fileflags, op->reports, copy) != 0)
 		return OPERATOR_CANCELLED;
 
-	WM_event_add_notifier(C, NC_WM|ND_FILESAVE, NULL);
+	WM_event_add_notifier(C, NC_WM | ND_FILESAVE, NULL);
 
 	return OPERATOR_FINISHED;
 }
@@ -2019,7 +2027,7 @@ static int blend_save_check(bContext *UNUSED(C), wmOperator *op)
 {
 	char filepath[FILE_MAX];
 	RNA_string_get(op->ptr, "filepath", filepath);
-	if(!BLO_has_bfile_extension(filepath)) {
+	if (!BLO_has_bfile_extension(filepath)) {
 		/* some users would prefer BLI_replace_extension(),
 		 * we keep getting knit-picking bug reports about this - campbell */
 		BLI_ensure_extension(filepath, FILE_MAX, ".blend");
@@ -2031,16 +2039,16 @@ static int blend_save_check(bContext *UNUSED(C), wmOperator *op)
 
 static void WM_OT_save_as_mainfile(wmOperatorType *ot)
 {
-	ot->name= "Save As Blender File";
-	ot->idname= "WM_OT_save_as_mainfile";
-	ot->description="Save the current file in the desired location";
+	ot->name = "Save As Blender File";
+	ot->idname = "WM_OT_save_as_mainfile";
+	ot->description = "Save the current file in the desired location";
 	
-	ot->invoke= wm_save_as_mainfile_invoke;
-	ot->exec= wm_save_as_mainfile_exec;
-	ot->check= blend_save_check;
+	ot->invoke = wm_save_as_mainfile_invoke;
+	ot->exec = wm_save_as_mainfile_exec;
+	ot->check = blend_save_check;
 	/* ommit window poll so this can work in background mode */
 
-	WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
+	WM_operator_properties_filesel(ot, FOLDERFILE | BLENDERFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
 	RNA_def_boolean(ot->srna, "compress", 0, "Compress", "Write compressed .blend file");
 	RNA_def_boolean(ot->srna, "relative_remap", 1, "Remap Relative", "Remap relative paths when saving in a different directory");
 	RNA_def_boolean(ot->srna, "copy", 0, "Save Copy", "Save a copy of the actual working state but does not make saved file active");
@@ -2054,7 +2062,7 @@ 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 check_existing = 1;
 	int ret;
 	
 	/* cancel if no active window */
@@ -2064,7 +2072,7 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(
 	save_set_compress(op);
 
 	/* if not saved before, get the name of the most recently used .blend file */
-	if(G.main->name[0]==0 && G.recent_files.first) {
+	if (G.main->name[0] == 0 && G.recent_files.first) {
 		struct RecentFile *recent = G.recent_files.first;
 		BLI_strncpy(name, recent->filepath, FILE_MAX);
 	}
@@ -2076,21 +2084,21 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(
 	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)
+		if (RNA_boolean_get(op->ptr, "check_existing") == 0)
 			check_existing = 0;
 	
 	if (G.save_over) {
 		if (check_existing && BLI_exists(name)) {
 			uiPupMenuSaveOver(C, op, name);
-			ret= OPERATOR_RUNNING_MODAL;
+			ret = OPERATOR_RUNNING_MODAL;
 		}
 		else {
-			ret= wm_save_as_mainfile_exec(C, op);
+			ret = wm_save_as_mainfile_exec(C, op);
 		}
 	}
 	else {
 		WM_event_add_fileselect(C, op);
-		ret= OPERATOR_RUNNING_MODAL;
+		ret = OPERATOR_RUNNING_MODAL;
 	}
 	
 	return ret;
@@ -2098,16 +2106,16 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(
 
 static void WM_OT_save_mainfile(wmOperatorType *ot)
 {
-	ot->name= "Save Blender File";
-	ot->idname= "WM_OT_save_mainfile";
-	ot->description="Save the current Blender file";
+	ot->name = "Save Blender File";
+	ot->idname = "WM_OT_save_mainfile";
+	ot->description = "Save the current Blender file";
 	
-	ot->invoke= wm_save_mainfile_invoke;
-	ot->exec= wm_save_as_mainfile_exec;
-	ot->check= blend_save_check;
+	ot->invoke = wm_save_mainfile_invoke;
+	ot->exec = wm_save_as_mainfile_exec;
+	ot->check = blend_save_check;
 	/* ommit window poll so this can work in background mode */
 	
-	WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
+	WM_operator_properties_filesel(ot, FOLDERFILE | BLENDERFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
 	RNA_def_boolean(ot->srna, "compress", 0, "Compress", "Write compressed .blend file");
 	RNA_def_boolean(ot->srna, "relative_remap", 0, "Remap Relative", "Remap relative paths when saving in a different directory");
 }
@@ -2119,7 +2127,7 @@ static void WM_OT_save_mainfile(wmOperatorType *ot)
 
 static int wm_collada_export_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {	
-	if(!RNA_struct_property_is_set(op->ptr, "filepath")) {
+	if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
 		char filepath[FILE_MAX];
 		BLI_strncpy(filepath, G.main->name, sizeof(filepath));
 		BLI_replace_extension(filepath, sizeof(filepath), ".dae");
@@ -2137,7 +2145,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
 	char filename[FILE_MAX];
 	int selected, second_life;
 	
-	if(!RNA_struct_property_is_set(op->ptr, "filepath")) {
+	if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
 		BKE_report(op->reports, RPT_ERROR, "No filename given");
 		return OPERATOR_CANCELLED;
 	}
@@ -2145,7 +2153,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
 	RNA_string_get(op->ptr, "filepath", filename);
 	selected = RNA_boolean_get(op->ptr, "selected");
 	second_life = RNA_boolean_get(op->ptr, "second_life");
-	if(collada_export(CTX_data_scene(C), filename, selected, second_life)) {
+	if (collada_export(CTX_data_scene(C), filename, selected, second_life)) {
 		return OPERATOR_FINISHED;
 	}
 	else {
@@ -2155,18 +2163,19 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
 
 static void WM_OT_collada_export(wmOperatorType *ot)
 {
-	ot->name= "Export COLLADA";
-	ot->idname= "WM_OT_collada_export";
+	ot->name = "Export COLLADA";
+	ot->description = "Save a Collada file";
+	ot->idname = "WM_OT_collada_export";
 	
-	ot->invoke= wm_collada_export_invoke;
-	ot->exec= wm_collada_export_exec;
-	ot->poll= WM_operator_winactive;
+	ot->invoke = wm_collada_export_invoke;
+	ot->exec = wm_collada_export_exec;
+	ot->poll = WM_operator_winactive;
 	
-	WM_operator_properties_filesel(ot, FOLDERFILE|COLLADAFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
+	WM_operator_properties_filesel(ot, FOLDERFILE | COLLADAFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
 	RNA_def_boolean(ot->srna, "selected", 0, "Export only selected",
-		"Export only selected elements");
+	                "Export only selected elements");
 	RNA_def_boolean(ot->srna, "second_life", 0, "Export for Second Life",
-		"Compatibility mode for Second Life");
+	                "Compatibility mode for Second Life");
 }
 
 /* function used for WM_OT_save_mainfile too */
@@ -2174,13 +2183,13 @@ static int wm_collada_import_exec(bContext *C, wmOperator *op)
 {
 	char filename[FILE_MAX];
 	
-	if(!RNA_struct_property_is_set(op->ptr, "filepath")) {
+	if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
 		BKE_report(op->reports, RPT_ERROR, "No filename given");
 		return OPERATOR_CANCELLED;
 	}
 
 	RNA_string_get(op->ptr, "filepath", filename);
-	if(collada_import(C, filename)) return OPERATOR_FINISHED;
+	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.");
 	
@@ -2189,14 +2198,15 @@ static int wm_collada_import_exec(bContext *C, wmOperator *op)
 
 static void WM_OT_collada_import(wmOperatorType *ot)
 {
-	ot->name= "Import COLLADA";
-	ot->idname= "WM_OT_collada_import";
+	ot->name = "Import COLLADA";
+	ot->description = "Load a Collada file";
+	ot->idname = "WM_OT_collada_import";
 	
-	ot->invoke= WM_operator_filesel;
-	ot->exec= wm_collada_import_exec;
-	ot->poll= WM_operator_winactive;
+	ot->invoke = WM_operator_filesel;
+	ot->exec = wm_collada_import_exec;
+	ot->poll = WM_operator_winactive;
 	
-	WM_operator_properties_filesel(ot, FOLDERFILE|COLLADAFILE, FILE_BLENDER, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
+	WM_operator_properties_filesel(ot, FOLDERFILE | COLLADAFILE, FILE_BLENDER, FILE_OPENFILE, WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
 }
 
 #endif
@@ -2206,12 +2216,12 @@ static void WM_OT_collada_import(wmOperatorType *ot)
 
 static void WM_OT_window_fullscreen_toggle(wmOperatorType *ot)
 {
-	ot->name= "Toggle Fullscreen";
-	ot->idname= "WM_OT_window_fullscreen_toggle";
-	ot->description="Toggle the current window fullscreen";
+	ot->name = "Toggle Fullscreen";
+	ot->idname = "WM_OT_window_fullscreen_toggle";
+	ot->description = "Toggle the current window fullscreen";
 
-	ot->exec= wm_window_fullscreen_toggle_exec;
-	ot->poll= WM_operator_winactive;
+	ot->exec = wm_window_fullscreen_toggle_exec;
+	ot->poll = WM_operator_winactive;
 }
 
 static int wm_exit_blender_op(bContext *C, wmOperator *op)
@@ -2225,13 +2235,13 @@ static int wm_exit_blender_op(bContext *C, wmOperator *op)
 
 static void WM_OT_quit_blender(wmOperatorType *ot)
 {
-	ot->name= "Quit Blender";
-	ot->idname= "WM_OT_quit_blender";
-	ot->description= "Quit Blender";
+	ot->name = "Quit Blender";
+	ot->idname = "WM_OT_quit_blender";
+	ot->description = "Quit Blender";
 
-	ot->invoke= WM_operator_confirm;
-	ot->exec= wm_exit_blender_op;
-	ot->poll= WM_operator_winactive;
+	ot->invoke = WM_operator_confirm;
+	ot->exec = wm_exit_blender_op;
+	ot->poll = WM_operator_winactive;
 }
 
 /* *********************** */
@@ -2246,33 +2256,35 @@ static int wm_console_toggle_op(bContext *UNUSED(C), wmOperator *UNUSED(op))
 
 static void WM_OT_console_toggle(wmOperatorType *ot)
 {
-	ot->name= "Toggle System Console";
-	ot->idname= "WM_OT_console_toggle";
-	ot->description= "Toggle System Console";
+	/* XXX Have to mark these for xgettext, as under linux they do not exists...
+	 *     And even worth, have to give the context as text, as xgettext doesn't expand macros. :( */
+	ot->name = CTX_N_("Operator"/* BLF_I18NCONTEXT_OPERATOR_DEFAULT */, "Toggle System Console");
+	ot->idname = "WM_OT_console_toggle";
+	ot->description = N_("Toggle System Console");
 	
-	ot->exec= wm_console_toggle_op;
-	ot->poll= WM_operator_winactive;
+	ot->exec = wm_console_toggle_op;
+	ot->poll = WM_operator_winactive;
 }
 
 #endif
 
 /* ************ default paint cursors, draw always around cursor *********** */
 /*
- - returns handler to free 
- - poll(bContext): returns 1 if draw should happen
- - draw(bContext): drawing callback for paint cursor
-*/
+ * - returns handler to free
+ * - poll(bContext): returns 1 if draw should happen
+ * - draw(bContext): drawing callback for paint cursor
+ */
 
 void *WM_paint_cursor_activate(wmWindowManager *wm, int (*poll)(bContext *C),
-				   wmPaintCursorDraw draw, void *customdata)
+                               wmPaintCursorDraw draw, void *customdata)
 {
-	wmPaintCursor *pc= MEM_callocN(sizeof(wmPaintCursor), "paint cursor");
+	wmPaintCursor *pc = MEM_callocN(sizeof(wmPaintCursor), "paint cursor");
 	
 	BLI_addtail(&wm->paintcursors, pc);
 	
 	pc->customdata = customdata;
-	pc->poll= poll;
-	pc->draw= draw;
+	pc->poll = poll;
+	pc->draw = draw;
 	
 	return pc;
 }
@@ -2281,8 +2293,8 @@ void WM_paint_cursor_end(wmWindowManager *wm, void *handle)
 {
 	wmPaintCursor *pc;
 	
-	for(pc= wm->paintcursors.first; pc; pc= pc->next) {
-		if(pc == (wmPaintCursor *)handle) {
+	for (pc = wm->paintcursors.first; pc; pc = pc->next) {
+		if (pc == (wmPaintCursor *)handle) {
 			BLI_remlink(&wm->paintcursors, pc);
 			MEM_freeN(pc);
 			return;
@@ -2298,18 +2310,18 @@ void WM_paint_cursor_end(wmWindowManager *wm, void *handle)
 /* **************** Border gesture *************** */
 
 /* Border gesture has two types:
-   1) WM_GESTURE_CROSS_RECT: starts a cross, on mouse click it changes to border 
-   2) WM_GESTURE_RECT: starts immediate as a border, on mouse click or release it ends
-
-   It stores 4 values (xmin, xmax, ymin, ymax) and event it ended with (event_type)
-*/
+ * 1) WM_GESTURE_CROSS_RECT: starts a cross, on mouse click it changes to border
+ * 2) WM_GESTURE_RECT: starts immediate as a border, on mouse click or release it ends
+ *
+ * It stores 4 values (xmin, xmax, ymin, ymax) and event it ended with (event_type)
+ */
 
 static int border_apply_rect(wmOperator *op)
 {
-	wmGesture *gesture= op->customdata;
-	rcti *rect= gesture->customdata;
+	wmGesture *gesture = op->customdata;
+	rcti *rect = gesture->customdata;
 	
-	if(rect->xmin==rect->xmax || rect->ymin==rect->ymax)
+	if (rect->xmin == rect->xmax || rect->ymin == rect->ymax)
 		return 0;
 
 	
@@ -2328,7 +2340,7 @@ static int border_apply(bContext *C, wmOperator *op, int gesture_mode)
 		return 0;
 	
 	/* XXX weak; border should be configured for this without reading event types */
-	if( RNA_struct_find_property(op->ptr, "gesture_mode") )
+	if (RNA_struct_find_property(op->ptr, "gesture_mode") )
 		RNA_int_set(op->ptr, "gesture_mode", gesture_mode);
 
 	op->type->exec(C, op);
@@ -2337,23 +2349,23 @@ static int border_apply(bContext *C, wmOperator *op, int gesture_mode)
 
 static void wm_gesture_end(bContext *C, wmOperator *op)
 {
-	wmGesture *gesture= op->customdata;
+	wmGesture *gesture = op->customdata;
 	
-	WM_gesture_end(C, gesture);	/* frees gesture itself, and unregisters from window */
-	op->customdata= NULL;
+	WM_gesture_end(C, gesture); /* frees gesture itself, and unregisters from window */
+	op->customdata = NULL;
 
 	ED_area_tag_redraw(CTX_wm_area(C));
 	
-	if( RNA_struct_find_property(op->ptr, "cursor") )
+	if (RNA_struct_find_property(op->ptr, "cursor") )
 		WM_cursor_restore(CTX_wm_window(C));
 }
 
 int WM_border_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	if(ISTWEAK(event->type))
-		op->customdata= WM_gesture_new(C, event, WM_GESTURE_RECT);
+	if (ISTWEAK(event->type))
+		op->customdata = WM_gesture_new(C, event, WM_GESTURE_RECT);
 	else
-		op->customdata= WM_gesture_new(C, event, WM_GESTURE_CROSS_RECT);
+		op->customdata = WM_gesture_new(C, event, WM_GESTURE_CROSS_RECT);
 
 	/* add modal handler */
 	WM_event_add_modal_handler(C, op);
@@ -2365,48 +2377,48 @@ int WM_border_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 int WM_border_select_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
-	wmGesture *gesture= op->customdata;
-	rcti *rect= gesture->customdata;
+	wmGesture *gesture = op->customdata;
+	rcti *rect = gesture->customdata;
 	int sx, sy;
 	
-	if(event->type== MOUSEMOVE) {
+	if (event->type == MOUSEMOVE) {
 		wm_subwindow_getorigin(CTX_wm_window(C), gesture->swinid, &sx, &sy);
 
-		if(gesture->type==WM_GESTURE_CROSS_RECT && gesture->mode==0) {
-			rect->xmin= rect->xmax= event->x - sx;
-			rect->ymin= rect->ymax= event->y - sy;
+		if (gesture->type == WM_GESTURE_CROSS_RECT && gesture->mode == 0) {
+			rect->xmin = rect->xmax = event->x - sx;
+			rect->ymin = rect->ymax = event->y - sy;
 		}
 		else {
-			rect->xmax= event->x - sx;
-			rect->ymax= event->y - sy;
+			rect->xmax = event->x - sx;
+			rect->ymax = event->y - sy;
 		}
 		border_apply_rect(op);
 
 		wm_gesture_tag_redraw(C);
 	}
-	else if (event->type==EVT_MODAL_MAP) {
+	else if (event->type == EVT_MODAL_MAP) {
 		switch (event->val) {
-		case GESTURE_MODAL_BEGIN:
-			if(gesture->type==WM_GESTURE_CROSS_RECT && gesture->mode==0) {
-				gesture->mode= 1;
-				wm_gesture_tag_redraw(C);
-			}
-			break;
-		case GESTURE_MODAL_SELECT:
-		case GESTURE_MODAL_DESELECT:
-		case GESTURE_MODAL_IN:
-		case GESTURE_MODAL_OUT:
-			if(border_apply(C, op, event->val)) {
+			case GESTURE_MODAL_BEGIN:
+				if (gesture->type == WM_GESTURE_CROSS_RECT && gesture->mode == 0) {
+					gesture->mode = 1;
+					wm_gesture_tag_redraw(C);
+				}
+				break;
+			case GESTURE_MODAL_SELECT:
+			case GESTURE_MODAL_DESELECT:
+			case GESTURE_MODAL_IN:
+			case GESTURE_MODAL_OUT:
+				if (border_apply(C, op, event->val)) {
+					wm_gesture_end(C, op);
+					return OPERATOR_FINISHED;
+				}
 				wm_gesture_end(C, op);
-				return OPERATOR_FINISHED;
-			}
-			wm_gesture_end(C, op);
-			return OPERATOR_CANCELLED;
-			break;
+				return OPERATOR_CANCELLED;
+				break;
 
-		case GESTURE_MODAL_CANCEL:
-			wm_gesture_end(C, op);
-			return OPERATOR_CANCELLED;
+			case GESTURE_MODAL_CANCEL:
+				wm_gesture_end(C, op);
+				return OPERATOR_CANCELLED;
 		}
 
 	}
@@ -2429,12 +2441,12 @@ int WM_border_select_cancel(bContext *C, wmOperator *op)
 /* works now only for selection or modal paint stuff, calls exec while hold mouse, exit on release */
 
 #ifdef GESTURE_MEMORY
-int circle_select_size= 25; // XXX - need some operator memory thing\!
+int circle_select_size = 25; // XXX - need some operator memory thing\!
 #endif
 
 int WM_gesture_circle_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	op->customdata= WM_gesture_new(C, event, WM_GESTURE_CIRCLE);
+	op->customdata = WM_gesture_new(C, event, WM_GESTURE_CIRCLE);
 	
 	/* add modal handler */
 	WM_event_add_modal_handler(C, op);
@@ -2446,10 +2458,10 @@ int WM_gesture_circle_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 static void gesture_circle_apply(bContext *C, wmOperator *op)
 {
-	wmGesture *gesture= op->customdata;
-	rcti *rect= gesture->customdata;
+	wmGesture *gesture = op->customdata;
+	rcti *rect = gesture->customdata;
 	
-	if(RNA_int_get(op->ptr, "gesture_mode")==GESTURE_MODAL_NOP)
+	if (RNA_int_get(op->ptr, "gesture_mode") == GESTURE_MODAL_NOP)
 		return;
 
 	/* operator arguments and storage. */
@@ -2457,59 +2469,59 @@ static void gesture_circle_apply(bContext *C, wmOperator *op)
 	RNA_int_set(op->ptr, "y", rect->ymin);
 	RNA_int_set(op->ptr, "radius", rect->xmax);
 	
-	if(op->type->exec)
+	if (op->type->exec)
 		op->type->exec(C, op);
 #ifdef GESTURE_MEMORY
-	circle_select_size= rect->xmax;
+	circle_select_size = rect->xmax;
 #endif
 }
 
 int WM_gesture_circle_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
-	wmGesture *gesture= op->customdata;
-	rcti *rect= gesture->customdata;
+	wmGesture *gesture = op->customdata;
+	rcti *rect = gesture->customdata;
 	int sx, sy;
 
-	if(event->type== MOUSEMOVE) {
+	if (event->type == MOUSEMOVE) {
 		wm_subwindow_getorigin(CTX_wm_window(C), gesture->swinid, &sx, &sy);
 
-		rect->xmin= event->x - sx;
-		rect->ymin= event->y - sy;
+		rect->xmin = event->x - sx;
+		rect->ymin = event->y - sy;
 
 		wm_gesture_tag_redraw(C);
 
-		if(gesture->mode)
+		if (gesture->mode)
 			gesture_circle_apply(C, op);
 	}
-	else if (event->type==EVT_MODAL_MAP) {
+	else if (event->type == EVT_MODAL_MAP) {
 		switch (event->val) {
-		case GESTURE_MODAL_CIRCLE_ADD:
-			rect->xmax += 2 + rect->xmax/10;
-			wm_gesture_tag_redraw(C);
-			break;
-		case GESTURE_MODAL_CIRCLE_SUB:
-			rect->xmax -= 2 + rect->xmax/10;
-			if(rect->xmax < 1) rect->xmax= 1;
-			wm_gesture_tag_redraw(C);
-			break;
-		case GESTURE_MODAL_SELECT:
-		case GESTURE_MODAL_DESELECT:
-		case GESTURE_MODAL_NOP:
-			if(RNA_struct_find_property(op->ptr, "gesture_mode"))
-				RNA_int_set(op->ptr, "gesture_mode", event->val);
-
-			if(event->val != GESTURE_MODAL_NOP) {
-				/* apply first click */
-				gesture_circle_apply(C, op);
-				gesture->mode= 1;
+			case GESTURE_MODAL_CIRCLE_ADD:
+				rect->xmax += 2 + rect->xmax / 10;
 				wm_gesture_tag_redraw(C);
-			}
-			break;
+				break;
+			case GESTURE_MODAL_CIRCLE_SUB:
+				rect->xmax -= 2 + rect->xmax / 10;
+				if (rect->xmax < 1) rect->xmax = 1;
+				wm_gesture_tag_redraw(C);
+				break;
+			case GESTURE_MODAL_SELECT:
+			case GESTURE_MODAL_DESELECT:
+			case GESTURE_MODAL_NOP:
+				if (RNA_struct_find_property(op->ptr, "gesture_mode"))
+					RNA_int_set(op->ptr, "gesture_mode", event->val);
+
+				if (event->val != GESTURE_MODAL_NOP) {
+					/* apply first click */
+					gesture_circle_apply(C, op);
+					gesture->mode = 1;
+					wm_gesture_tag_redraw(C);
+				}
+				break;
 
-		case GESTURE_MODAL_CANCEL:
-		case GESTURE_MODAL_CONFIRM:
-			wm_gesture_end(C, op);
-			return OPERATOR_FINISHED; /* use finish or we dont get an undo */
+			case GESTURE_MODAL_CANCEL:
+			case GESTURE_MODAL_CONFIRM:
+				wm_gesture_end(C, op);
+				return OPERATOR_FINISHED; /* use finish or we don't get an undo */
 		}
 	}
 //	// Allow view navigation???
@@ -2531,14 +2543,14 @@ int WM_gesture_circle_cancel(bContext *C, wmOperator *op)
 /* template to copy from */
 void WM_OT_circle_gesture(wmOperatorType *ot)
 {
-	ot->name= "Circle Gesture";
-	ot->idname= "WM_OT_circle_gesture";
-	ot->description="Enter rotate mode with a circular gesture";
+	ot->name = "Circle Gesture";
+	ot->idname = "WM_OT_circle_gesture";
+	ot->description = "Enter rotate mode with a circular gesture";
 	
-	ot->invoke= WM_gesture_circle_invoke;
-	ot->modal= WM_gesture_circle_modal;
+	ot->invoke = WM_gesture_circle_invoke;
+	ot->modal = WM_gesture_circle_modal;
 	
-	ot->poll= WM_operator_winactive;
+	ot->poll = WM_operator_winactive;
 	
 	RNA_def_property(ot->srna, "x", PROP_INT, PROP_NONE);
 	RNA_def_property(ot->srna, "y", PROP_INT, PROP_NONE);
@@ -2551,35 +2563,35 @@ void WM_OT_circle_gesture(wmOperatorType *ot)
 
 static void tweak_gesture_modal(bContext *C, wmEvent *event)
 {
-	wmWindow *window= CTX_wm_window(C);
-	wmGesture *gesture= window->tweak;
-	rcti *rect= gesture->customdata;
+	wmWindow *window = CTX_wm_window(C);
+	wmGesture *gesture = window->tweak;
+	rcti *rect = gesture->customdata;
 	int sx, sy, val;
 	
-	switch(event->type) {
+	switch (event->type) {
 		case MOUSEMOVE:
 		case INBETWEEN_MOUSEMOVE:
 			
 			wm_subwindow_getorigin(window, gesture->swinid, &sx, &sy);
 			
-			rect->xmax= event->x - sx;
-			rect->ymax= event->y - sy;
+			rect->xmax = event->x - sx;
+			rect->ymax = event->y - sy;
 			
-			if((val= wm_gesture_evaluate(gesture))) {
+			if ((val = wm_gesture_evaluate(gesture))) {
 				wmEvent tevent;
 
-				tevent= *(window->eventstate);
-				if(gesture->event_type==LEFTMOUSE)
-					tevent.type= EVT_TWEAK_L;
-				else if(gesture->event_type==RIGHTMOUSE)
-					tevent.type= EVT_TWEAK_R;
+				tevent = *(window->eventstate);
+				if (gesture->event_type == LEFTMOUSE)
+					tevent.type = EVT_TWEAK_L;
+				else if (gesture->event_type == RIGHTMOUSE)
+					tevent.type = EVT_TWEAK_R;
 				else
-					tevent.type= EVT_TWEAK_M;
-				tevent.val= val;
+					tevent.type = EVT_TWEAK_M;
+				tevent.val = val;
 				/* mouse coords! */
 				wm_event_add(window, &tevent);
 				
-				WM_gesture_end(C, gesture);	/* frees gesture itself, and unregisters from window */
+				WM_gesture_end(C, gesture); /* frees gesture itself, and unregisters from window */
 			}
 			
 			break;
@@ -2587,15 +2599,15 @@ static void tweak_gesture_modal(bContext *C, wmEvent *event)
 		case LEFTMOUSE:
 		case RIGHTMOUSE:
 		case MIDDLEMOUSE:
-			if(gesture->event_type==event->type) {
+			if (gesture->event_type == event->type) {
 				WM_gesture_end(C, gesture);
 
 				/* when tweak fails we should give the other keymap entries a chance */
-				event->val= KM_RELEASE;
+				event->val = KM_RELEASE;
 			}
 			break;
 		default:
-			if(!ISTIMER(event->type)) {
+			if (!ISTIMER(event->type)) {
 				WM_gesture_end(C, gesture);
 			}
 			break;
@@ -2605,19 +2617,19 @@ static void tweak_gesture_modal(bContext *C, wmEvent *event)
 /* standard tweak, called after window handlers passed on event */
 void wm_tweakevent_test(bContext *C, wmEvent *event, int action)
 {
-	wmWindow *win= CTX_wm_window(C);
+	wmWindow *win = CTX_wm_window(C);
 	
-	if(win->tweak==NULL) {
-		if(CTX_wm_region(C)) {
-			if(event->val==KM_PRESS) { 
-				if( ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE) )
-					win->tweak= WM_gesture_new(C, event, WM_GESTURE_TWEAK);
+	if (win->tweak == NULL) {
+		if (CTX_wm_region(C)) {
+			if (event->val == KM_PRESS) {
+				if (ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE) )
+					win->tweak = WM_gesture_new(C, event, WM_GESTURE_TWEAK);
 			}
 		}
 	}
 	else {
 		/* no tweaks if event was handled */
-		if((action & WM_HANDLER_BREAK)) {
+		if ((action & WM_HANDLER_BREAK)) {
 			WM_gesture_end(C, win->tweak);
 		}
 		else
@@ -2629,14 +2641,14 @@ void wm_tweakevent_test(bContext *C, wmEvent *event, int action)
 
 int WM_gesture_lasso_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	op->customdata= WM_gesture_new(C, event, WM_GESTURE_LASSO);
+	op->customdata = WM_gesture_new(C, event, WM_GESTURE_LASSO);
 	
 	/* add modal handler */
 	WM_event_add_modal_handler(C, op);
 	
 	wm_gesture_tag_redraw(C);
 	
-	if( RNA_struct_find_property(op->ptr, "cursor") )
+	if (RNA_struct_find_property(op->ptr, "cursor") )
 		WM_cursor_modal(CTX_wm_window(C), RNA_int_get(op->ptr, "cursor"));
 	
 	return OPERATOR_RUNNING_MODAL;
@@ -2644,14 +2656,14 @@ int WM_gesture_lasso_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 int WM_gesture_lines_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	op->customdata= WM_gesture_new(C, event, WM_GESTURE_LINES);
+	op->customdata = WM_gesture_new(C, event, WM_GESTURE_LINES);
 	
 	/* add modal handler */
 	WM_event_add_modal_handler(C, op);
 	
 	wm_gesture_tag_redraw(C);
 	
-	if( RNA_struct_find_property(op->ptr, "cursor") )
+	if (RNA_struct_find_property(op->ptr, "cursor") )
 		WM_cursor_modal(CTX_wm_window(C), RNA_int_get(op->ptr, "cursor"));
 	
 	return OPERATOR_RUNNING_MODAL;
@@ -2660,33 +2672,34 @@ int WM_gesture_lines_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 static void gesture_lasso_apply(bContext *C, wmOperator *op)
 {
-	wmGesture *gesture= op->customdata;
+	wmGesture *gesture = op->customdata;
 	PointerRNA itemptr;
 	float loc[2];
 	int i;
-	short *lasso= gesture->customdata;
+	short *lasso = gesture->customdata;
 	
 	/* operator storage as path. */
 
-	for(i=0; i<gesture->points; i++, lasso+=2) {
-		loc[0]= lasso[0];
-		loc[1]= lasso[1];
+	RNA_collection_clear(op->ptr, "path");
+	for (i = 0; i < gesture->points; i++, lasso += 2) {
+		loc[0] = lasso[0];
+		loc[1] = lasso[1];
 		RNA_collection_add(op->ptr, "path", &itemptr);
 		RNA_float_set_array(&itemptr, "loc", loc);
 	}
 	
 	wm_gesture_end(C, op);
 		
-	if(op->type->exec)
+	if (op->type->exec)
 		op->type->exec(C, op);
 }
 
 int WM_gesture_lasso_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
-	wmGesture *gesture= op->customdata;
+	wmGesture *gesture = op->customdata;
 	int sx, sy;
 	
-	switch(event->type) {
+	switch (event->type) {
 		case MOUSEMOVE:
 		case INBETWEEN_MOUSEMOVE:
 			
@@ -2694,10 +2707,10 @@ int WM_gesture_lasso_modal(bContext *C, wmOperator *op, wmEvent *event)
 			
 			wm_subwindow_getorigin(CTX_wm_window(C), gesture->swinid, &sx, &sy);
 
-			if(gesture->points == gesture->size) {
+			if (gesture->points == gesture->size) {
 				short *old_lasso = gesture->customdata;
-				gesture->customdata= MEM_callocN(2*sizeof(short)*(gesture->size + WM_LASSO_MIN_POINTS), "lasso points");
-				memcpy(gesture->customdata, old_lasso, 2*sizeof(short)*gesture->size);
+				gesture->customdata = MEM_callocN(2 * sizeof(short) * (gesture->size + WM_LASSO_MIN_POINTS), "lasso points");
+				memcpy(gesture->customdata, old_lasso, 2 * sizeof(short) * gesture->size);
 				gesture->size = gesture->size + WM_LASSO_MIN_POINTS;
 				MEM_freeN(old_lasso);
 				// printf("realloc\n");
@@ -2705,15 +2718,15 @@ int WM_gesture_lasso_modal(bContext *C, wmOperator *op, wmEvent *event)
 
 			{
 				int x, y;
-				short *lasso= gesture->customdata;
+				short *lasso = gesture->customdata;
 				
 				lasso += (2 * gesture->points - 2);
 				x = (event->x - sx - lasso[0]);
 				y = (event->y - sy - lasso[1]);
 				
 				/* make a simple distance check to get a smoother lasso
-				   add only when at least 2 pixels between this and previous location */
-				if((x*x+y*y) > 4) {
+				 * add only when at least 2 pixels between this and previous location */
+				if ((x * x + y * y) > 4) {
 					lasso += 2;
 					lasso[0] = event->x - sx;
 					lasso[1] = event->y - sy;
@@ -2725,7 +2738,7 @@ int WM_gesture_lasso_modal(bContext *C, wmOperator *op, wmEvent *event)
 		case LEFTMOUSE:
 		case MIDDLEMOUSE:
 		case RIGHTMOUSE:
-			if(event->val==KM_RELEASE) {	/* key release */
+			if (event->val == KM_RELEASE) {   /* key release */
 				gesture_lasso_apply(C, op);
 				return OPERATOR_FINISHED;
 			}
@@ -2761,7 +2774,8 @@ int WM_gesture_lines_cancel(bContext *C, wmOperator *op)
 
 static int gesture_lasso_exec(bContext *C, wmOperator *op)
 {
-	RNA_BEGIN(op->ptr, itemptr, "path") {
+	RNA_BEGIN(op->ptr, itemptr, "path")
+	{
 		float loc[2];
 		
 		RNA_float_get_array(&itemptr, "loc", loc);
@@ -2776,17 +2790,17 @@ void WM_OT_lasso_gesture(wmOperatorType *ot)
 {
 	PropertyRNA *prop;
 	
-	ot->name= "Lasso Gesture";
-	ot->idname= "WM_OT_lasso_gesture";
-	ot->description="Select objects within the lasso as you move the pointer";
+	ot->name = "Lasso Gesture";
+	ot->idname = "WM_OT_lasso_gesture";
+	ot->description = "Select objects within the lasso as you move the pointer";
 	
-	ot->invoke= WM_gesture_lasso_invoke;
-	ot->modal= WM_gesture_lasso_modal;
-	ot->exec= gesture_lasso_exec;
+	ot->invoke = WM_gesture_lasso_invoke;
+	ot->modal = WM_gesture_lasso_modal;
+	ot->exec = gesture_lasso_exec;
 	
-	ot->poll= WM_operator_winactive;
+	ot->poll = WM_operator_winactive;
 	
-	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);
 }
 #endif
@@ -2795,10 +2809,10 @@ void WM_OT_lasso_gesture(wmOperatorType *ot)
 
 static int straightline_apply(bContext *C, wmOperator *op)
 {
-	wmGesture *gesture= op->customdata;
-	rcti *rect= gesture->customdata;
+	wmGesture *gesture = op->customdata;
+	rcti *rect = gesture->customdata;
 	
-	if(rect->xmin==rect->xmax && rect->ymin==rect->ymax)
+	if (rect->xmin == rect->xmax && rect->ymin == rect->ymax)
 		return 0;
 	
 	/* operator arguments and storage. */
@@ -2807,7 +2821,7 @@ static int straightline_apply(bContext *C, wmOperator *op)
 	RNA_int_set(op->ptr, "xend", rect->xmax);
 	RNA_int_set(op->ptr, "yend", rect->ymax);
 
-	if(op->type->exec)
+	if (op->type->exec)
 		op->type->exec(C, op);
 	
 	return 1;
@@ -2816,14 +2830,14 @@ static int straightline_apply(bContext *C, wmOperator *op)
 
 int WM_gesture_straightline_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
-	op->customdata= WM_gesture_new(C, event, WM_GESTURE_STRAIGHTLINE);
+	op->customdata = WM_gesture_new(C, event, WM_GESTURE_STRAIGHTLINE);
 	
 	/* add modal handler */
 	WM_event_add_modal_handler(C, op);
 	
 	wm_gesture_tag_redraw(C);
 	
-	if( RNA_struct_find_property(op->ptr, "cursor") )
+	if (RNA_struct_find_property(op->ptr, "cursor") )
 		WM_cursor_modal(CTX_wm_window(C), RNA_int_get(op->ptr, "cursor"));
 		
 	return OPERATOR_RUNNING_MODAL;
@@ -2831,35 +2845,35 @@ int WM_gesture_straightline_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 int WM_gesture_straightline_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
-	wmGesture *gesture= op->customdata;
-	rcti *rect= gesture->customdata;
+	wmGesture *gesture = op->customdata;
+	rcti *rect = gesture->customdata;
 	int sx, sy;
 	
-	if(event->type== MOUSEMOVE) {
+	if (event->type == MOUSEMOVE) {
 		wm_subwindow_getorigin(CTX_wm_window(C), gesture->swinid, &sx, &sy);
 		
-		if(gesture->mode==0) {
-			rect->xmin= rect->xmax= event->x - sx;
-			rect->ymin= rect->ymax= event->y - sy;
+		if (gesture->mode == 0) {
+			rect->xmin = rect->xmax = event->x - sx;
+			rect->ymin = rect->ymax = event->y - sy;
 		}
 		else {
-			rect->xmax= event->x - sx;
-			rect->ymax= event->y - sy;
+			rect->xmax = event->x - sx;
+			rect->ymax = event->y - sy;
 			straightline_apply(C, op);
 		}
 		
 		wm_gesture_tag_redraw(C);
 	}
-	else if (event->type==EVT_MODAL_MAP) {
+	else if (event->type == EVT_MODAL_MAP) {
 		switch (event->val) {
 			case GESTURE_MODAL_BEGIN:
-				if(gesture->mode==0) {
-					gesture->mode= 1;
+				if (gesture->mode == 0) {
+					gesture->mode = 1;
 					wm_gesture_tag_redraw(C);
 				}
 				break;
 			case GESTURE_MODAL_SELECT:
-				if(straightline_apply(C, op)) {
+				if (straightline_apply(C, op)) {
 					wm_gesture_end(C, op);
 					return OPERATOR_FINISHED;
 				}
@@ -2890,15 +2904,15 @@ void WM_OT_straightline_gesture(wmOperatorType *ot)
 {
 	PropertyRNA *prop;
 	
-	ot->name= "Straight Line Gesture";
-	ot->idname= "WM_OT_straightline_gesture";
-	ot->description="Draw a straight line as you move the pointer";
+	ot->name = "Straight Line Gesture";
+	ot->idname = "WM_OT_straightline_gesture";
+	ot->description = "Draw a straight line as you move the pointer";
 	
-	ot->invoke= WM_gesture_straightline_invoke;
-	ot->modal= WM_gesture_straightline_modal;
-	ot->exec= gesture_straightline_exec;
+	ot->invoke = WM_gesture_straightline_invoke;
+	ot->modal = WM_gesture_straightline_modal;
+	ot->exec = gesture_straightline_exec;
 	
-	ot->poll= WM_operator_winactive;
+	ot->poll = WM_operator_winactive;
 	
 	WM_operator_properties_gesture_straightline(ot, 0);
 }
@@ -2926,51 +2940,51 @@ static void radial_control_set_initial_mouse(RadialControl *rc, wmEvent *event)
 	float d[2] = {0, 0};
 	float zoom[2] = {1, 1};
 
-	rc->initial_mouse[0]= event->x;
-	rc->initial_mouse[1]= event->y;
-
-	switch(rc->subtype) {
-	case PROP_DISTANCE:
-		d[0] = rc->initial_value;
-		break;
-	case PROP_FACTOR:
-		d[0] = WM_RADIAL_CONTROL_DISPLAY_SIZE * (1 - rc->initial_value);
-		break;
-	case PROP_ANGLE:
-		d[0] = WM_RADIAL_CONTROL_DISPLAY_SIZE * cos(rc->initial_value);
-		d[1] = WM_RADIAL_CONTROL_DISPLAY_SIZE * sin(rc->initial_value);
-		break;
-	default:
-		return;
+	rc->initial_mouse[0] = event->x;
+	rc->initial_mouse[1] = event->y;
+
+	switch (rc->subtype) {
+		case PROP_DISTANCE:
+			d[0] = rc->initial_value;
+			break;
+		case PROP_FACTOR:
+			d[0] = WM_RADIAL_CONTROL_DISPLAY_SIZE * (1 - rc->initial_value);
+			break;
+		case PROP_ANGLE:
+			d[0] = WM_RADIAL_CONTROL_DISPLAY_SIZE * cos(rc->initial_value);
+			d[1] = WM_RADIAL_CONTROL_DISPLAY_SIZE * sin(rc->initial_value);
+			break;
+		default:
+			return;
 	}
 
-	if(rc->zoom_prop) {
+	if (rc->zoom_prop) {
 		RNA_property_float_get_array(&rc->zoom_ptr, rc->zoom_prop, zoom);
 		d[0] *= zoom[0];
 		d[1] *= zoom[1];
 	}
 
-	rc->initial_mouse[0]-= d[0];
-	rc->initial_mouse[1]-= d[1];
+	rc->initial_mouse[0] -= d[0];
+	rc->initial_mouse[1] -= d[1];
 }
 
 static void radial_control_set_tex(RadialControl *rc)
 {
 	ImBuf *ibuf;
 
-	switch(RNA_type_to_ID_code(rc->image_id_ptr.type)) {
-	case ID_BR:
-		if((ibuf = brush_gen_radial_control_imbuf(rc->image_id_ptr.data))) {
-			glGenTextures(1, &rc->gltex);
-			glBindTexture(GL_TEXTURE_2D, rc->gltex);
-			glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, ibuf->x, ibuf->y, 0,
-				     GL_ALPHA, GL_FLOAT, ibuf->rect_float);
-			MEM_freeN(ibuf->rect_float);
-			MEM_freeN(ibuf);
-		}
-		break;
-	default:
-		break;
+	switch (RNA_type_to_ID_code(rc->image_id_ptr.type)) {
+		case ID_BR:
+			if ((ibuf = brush_gen_radial_control_imbuf(rc->image_id_ptr.data))) {
+				glGenTextures(1, &rc->gltex);
+				glBindTexture(GL_TEXTURE_2D, rc->gltex);
+				glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, ibuf->x, ibuf->y, 0,
+				             GL_ALPHA, GL_FLOAT, ibuf->rect_float);
+				MEM_freeN(ibuf->rect_float);
+				MEM_freeN(ibuf);
+			}
+			break;
+		default:
+			break;
 	}
 }
 
@@ -2980,18 +2994,18 @@ static void radial_control_paint_tex(RadialControl *rc, float radius, float alph
 	float rot;
 
 	/* set fill color */
-	if(rc->fill_col_prop)
+	if (rc->fill_col_prop)
 		RNA_property_float_get_array(&rc->fill_col_ptr, rc->fill_col_prop, col);
 	glColor4f(col[0], col[1], col[2], alpha);
 
-	if(rc->gltex) {
+	if (rc->gltex) {
 		glBindTexture(GL_TEXTURE_2D, rc->gltex);
 
 		glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 		glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 
 		/* set up rotation if available */
-		if(rc->rot_prop) {
+		if (rc->rot_prop) {
 			rot = RNA_property_float_get(&rc->rot_ptr, rc->rot_prop);
 			glPushMatrix();
 			glRotatef(RAD2DEGF(rot), 0, 0, 1);
@@ -3000,19 +3014,19 @@ static void radial_control_paint_tex(RadialControl *rc, float radius, float alph
 		/* draw textured quad */
 		glEnable(GL_TEXTURE_2D);
 		glBegin(GL_QUADS);
-		glTexCoord2f(0,0);
+		glTexCoord2f(0, 0);
 		glVertex2f(-radius, -radius);
-		glTexCoord2f(1,0);
+		glTexCoord2f(1, 0);
 		glVertex2f(radius, -radius);
-		glTexCoord2f(1,1);
+		glTexCoord2f(1, 1);
 		glVertex2f(radius, radius);
-		glTexCoord2f(0,1);
+		glTexCoord2f(0, 1);
 		glVertex2f(-radius, radius);
 		glEnd();
 		glDisable(GL_TEXTURE_2D);
 
 		/* undo rotation */
-		if(rc->rot_prop)
+		if (rc->rot_prop)
 			glPopMatrix();
 	}
 	else {
@@ -3025,29 +3039,29 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd
 {
 	RadialControl *rc = customdata;
 	ARegion *ar = CTX_wm_region(C);
-	float r1=0.0f, r2=0.0f, tex_radius, alpha;
+	float r1 = 0.0f, r2 = 0.0f, tex_radius, alpha;
 	float zoom[2], col[3] = {1, 1, 1};
 
-	switch(rc->subtype) {
-	case PROP_DISTANCE:
-		r1= rc->current_value;
-		r2= rc->initial_value;
-		tex_radius= r1;
-		alpha = 0.75;
-		break;
-	case PROP_FACTOR:
-		r1= (1 - rc->current_value) * WM_RADIAL_CONTROL_DISPLAY_SIZE;
-		r2= tex_radius= WM_RADIAL_CONTROL_DISPLAY_SIZE;
-		alpha = rc->current_value / 2.0f + 0.5f;
-		break;
-	case PROP_ANGLE:
-		r1= r2= tex_radius= WM_RADIAL_CONTROL_DISPLAY_SIZE;
-		alpha = 0.75;
-		break;
-	default:
-		tex_radius= WM_RADIAL_CONTROL_DISPLAY_SIZE; /* note, this is a dummy value */
-		alpha = 0.75;
-		break;
+	switch (rc->subtype) {
+		case PROP_DISTANCE:
+			r1 = rc->current_value;
+			r2 = rc->initial_value;
+			tex_radius = r1;
+			alpha = 0.75;
+			break;
+		case PROP_FACTOR:
+			r1 = (1 - rc->current_value) * WM_RADIAL_CONTROL_DISPLAY_SIZE;
+			r2 = tex_radius = WM_RADIAL_CONTROL_DISPLAY_SIZE;
+			alpha = rc->current_value / 2.0f + 0.5f;
+			break;
+		case PROP_ANGLE:
+			r1 = r2 = tex_radius = WM_RADIAL_CONTROL_DISPLAY_SIZE;
+			alpha = 0.75;
+			break;
+		default:
+			tex_radius = WM_RADIAL_CONTROL_DISPLAY_SIZE; /* note, this is a dummy value */
+			alpha = 0.75;
+			break;
 	}
 
 	/* Keep cursor in the original place */
@@ -3059,7 +3073,7 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd
 	glEnable(GL_LINE_SMOOTH);
 
 	/* apply zoom if available */
-	if(rc->zoom_prop) {
+	if (rc->zoom_prop) {
 		RNA_property_float_get_array(&rc->zoom_ptr, rc->zoom_prop, zoom);
 		glScalef(zoom[0], zoom[1], 1);
 	}
@@ -3068,11 +3082,11 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd
 	radial_control_paint_tex(rc, tex_radius, alpha);
 
 	/* set line color */
-	if(rc->col_prop)
+	if (rc->col_prop)
 		RNA_property_float_get_array(&rc->col_ptr, rc->col_prop, col);
 	glColor4f(col[0], col[1], col[2], 0.5);
 
-	if(rc->subtype == PROP_ANGLE) {
+	if (rc->subtype == PROP_ANGLE) {
 		glPushMatrix();
 		/* draw original angle line */
 		glRotatef(RAD2DEGF(rc->initial_value), 0, 0, 1);
@@ -3084,8 +3098,8 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd
 	}
 
 	/* draw circles on top */
-	glutil_draw_lined_arc(0.0, (float)(M_PI*2.0), r1, 40);
-	glutil_draw_lined_arc(0.0, (float)(M_PI*2.0), r2, 40);
+	glutil_draw_lined_arc(0.0, (float)(M_PI * 2.0), r1, 40);
+	glutil_draw_lined_arc(0.0, (float)(M_PI * 2.0), r2, 40);
 
 	glDisable(GL_BLEND);
 	glDisable(GL_LINE_SMOOTH);
@@ -3098,39 +3112,39 @@ typedef enum {
 } RCPropFlags;
 
 /* attempt to retrieve the rna pointer/property from an rna path;
-   returns 0 for failure, 1 for success, and also 1 if property is not
-   set */
+ * returns 0 for failure, 1 for success, and also 1 if property is not
+ * set */
 static int radial_control_get_path(PointerRNA *ctx_ptr, wmOperator *op,
-				   const char *name, PointerRNA *r_ptr,
-				   PropertyRNA **r_prop, int req_length, RCPropFlags flags)
+                                   const char *name, PointerRNA *r_ptr,
+                                   PropertyRNA **r_prop, int req_length, RCPropFlags flags)
 {
 	PropertyRNA *unused_prop;
 	int len;
 	char *str;
 
 	/* check flags */
-	if((flags & RC_PROP_REQUIRE_BOOL) && (flags & RC_PROP_REQUIRE_FLOAT)) {
+	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");
 		return 0;
 	}
 
 	/* get an rna string path from the operator's properties */
-	if(!(str = RNA_string_get_alloc(op->ptr, name, NULL, 0)))
+	if (!(str = RNA_string_get_alloc(op->ptr, name, NULL, 0)))
 		return 1;
 
-	if(str[0] == '\0') {
-		if(r_prop) *r_prop = NULL;
+	if (str[0] == '\0') {
+		if (r_prop) *r_prop = NULL;
 		MEM_freeN(str);
 		return 1;
 	}
 
-	if(!r_prop)
+	if (!r_prop)
 		r_prop = &unused_prop;
 
 	/* get rna from path */
-	if(!RNA_path_resolve(ctx_ptr, str, r_ptr, r_prop)) {
+	if (!RNA_path_resolve(ctx_ptr, str, r_ptr, r_prop)) {
 		MEM_freeN(str);
-		if(flags & RC_PROP_ALLOW_MISSING)
+		if (flags & RC_PROP_ALLOW_MISSING)
 			return 1;
 		else {
 			BKE_reportf(op->reports, RPT_ERROR, "Couldn't resolve path %s", name);
@@ -3139,20 +3153,20 @@ static int radial_control_get_path(PointerRNA *ctx_ptr, wmOperator *op,
 	}
 
 	/* check property type */
-	if(flags & (RC_PROP_REQUIRE_BOOL | RC_PROP_REQUIRE_FLOAT)) {
+	if (flags & (RC_PROP_REQUIRE_BOOL | RC_PROP_REQUIRE_FLOAT)) {
 		PropertyType prop_type = RNA_property_type(*r_prop);
 
-		if(((flags & RC_PROP_REQUIRE_BOOL) && (prop_type != PROP_BOOLEAN)) ||
-		   ((flags & RC_PROP_REQUIRE_FLOAT) && prop_type != PROP_FLOAT)) {
+		if (((flags & RC_PROP_REQUIRE_BOOL) && (prop_type != PROP_BOOLEAN)) ||
+		    ((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);
+			            "Property from path %s is not a float", name);
 			return 0;
 		}
 	}
 	
 	/* check property's array length */
-	if(*r_prop && (len = RNA_property_array_length(r_ptr, *r_prop)) != req_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",
@@ -3176,49 +3190,50 @@ static int radial_control_get_properties(bContext *C, wmOperator *op)
 	RNA_pointer_create(NULL, &RNA_Context, C, &ctx_ptr);
 
 	/* check if we use primary or secondary path */
-	if(!radial_control_get_path(&ctx_ptr, op, "use_secondary",
-								&use_secondary_ptr, &use_secondary_prop,
-								0, (RC_PROP_ALLOW_MISSING|
-									RC_PROP_REQUIRE_BOOL))) {
+	if (!radial_control_get_path(&ctx_ptr, op, "use_secondary",
+	                             &use_secondary_ptr, &use_secondary_prop,
+	                             0, (RC_PROP_ALLOW_MISSING |
+	                                 RC_PROP_REQUIRE_BOOL)))
+	{
 		return 0;
 	}
 	else {
-		if(use_secondary_prop &&
-		   RNA_property_boolean_get(&use_secondary_ptr, use_secondary_prop))
+		if (use_secondary_prop &&
+		    RNA_property_boolean_get(&use_secondary_ptr, use_secondary_prop))
 			data_path = "data_path_secondary";
 		else
 			data_path = "data_path_primary";
 	}
 
-	if(!radial_control_get_path(&ctx_ptr, op, data_path, &rc->ptr, &rc->prop, 0, 0))
+	if (!radial_control_get_path(&ctx_ptr, op, data_path, &rc->ptr, &rc->prop, 0, 0))
 		return 0;
 
 	/* data path is required */
-	if(!rc->prop)
+	if (!rc->prop)
 		return 0;
 	
-	if(!radial_control_get_path(&ctx_ptr, op, "rotation_path", &rc->rot_ptr, &rc->rot_prop, 0, RC_PROP_REQUIRE_FLOAT))
+	if (!radial_control_get_path(&ctx_ptr, op, "rotation_path", &rc->rot_ptr, &rc->rot_prop, 0, RC_PROP_REQUIRE_FLOAT))
 		return 0;
-	if(!radial_control_get_path(&ctx_ptr, op, "color_path", &rc->col_ptr, &rc->col_prop, 3, RC_PROP_REQUIRE_FLOAT))
+	if (!radial_control_get_path(&ctx_ptr, op, "color_path", &rc->col_ptr, &rc->col_prop, 3, RC_PROP_REQUIRE_FLOAT))
 		return 0;
-	if(!radial_control_get_path(&ctx_ptr, op, "fill_color_path", &rc->fill_col_ptr, &rc->fill_col_prop, 3, RC_PROP_REQUIRE_FLOAT))
+	if (!radial_control_get_path(&ctx_ptr, op, "fill_color_path", &rc->fill_col_ptr, &rc->fill_col_prop, 3, RC_PROP_REQUIRE_FLOAT))
 		return 0;
 	
 	/* slightly ugly; allow this property to not resolve
-	   correctly. needed because 3d texture paint shares the same
-	   keymap as 2d image paint */
-	if(!radial_control_get_path(&ctx_ptr, op, "zoom_path",
-								&rc->zoom_ptr, &rc->zoom_prop, 2,
-								RC_PROP_REQUIRE_FLOAT|RC_PROP_ALLOW_MISSING))
+	 * correctly. needed because 3d texture paint shares the same
+	 * keymap as 2d image paint */
+	if (!radial_control_get_path(&ctx_ptr, op, "zoom_path",
+	                             &rc->zoom_ptr, &rc->zoom_prop, 2,
+	                             RC_PROP_REQUIRE_FLOAT | RC_PROP_ALLOW_MISSING))
 		return 0;
 	
-	if(!radial_control_get_path(&ctx_ptr, op, "image_id", &rc->image_id_ptr, NULL, 0, 0))
+	if (!radial_control_get_path(&ctx_ptr, op, "image_id", &rc->image_id_ptr, NULL, 0, 0))
 		return 0;
-	else if(rc->image_id_ptr.data) {
+	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)) {
+		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");
+			           "Pointer from path image_id is not an ID");
 			return 0;
 		}
 	}
@@ -3233,37 +3248,37 @@ static int radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event)
 	int min_value_int, max_value_int, step_int;
 	float step_float, precision;
 
-	if(!(op->customdata = rc = MEM_callocN(sizeof(RadialControl), "RadialControl")))
+	if (!(op->customdata = rc = MEM_callocN(sizeof(RadialControl), "RadialControl")))
 		return OPERATOR_CANCELLED;
 
-	if(!radial_control_get_properties(C, op)) {
+	if (!radial_control_get_properties(C, op)) {
 		MEM_freeN(rc);
 		return OPERATOR_CANCELLED;
 	}
 
 	/* get type, initial, min, and max values of the property */
-	switch((rc->type = RNA_property_type(rc->prop))) {
-	case PROP_INT:
-		rc->initial_value = RNA_property_int_get(&rc->ptr, rc->prop);
-		RNA_property_int_ui_range(&rc->ptr, rc->prop, &min_value_int,
-					  &max_value_int, &step_int);
-		rc->min_value = min_value_int;
-		rc->max_value = max_value_int;
-		break;
-	case PROP_FLOAT:
-		rc->initial_value = RNA_property_float_get(&rc->ptr, rc->prop);
-		RNA_property_float_ui_range(&rc->ptr, rc->prop, &rc->min_value,
-					    &rc->max_value, &step_float, &precision);
-		break;
-	default:
-		BKE_report(op->reports, RPT_ERROR, "Property must be an integer or a float");
-		MEM_freeN(rc);
-		return OPERATOR_CANCELLED;
+	switch ((rc->type = RNA_property_type(rc->prop))) {
+		case PROP_INT:
+			rc->initial_value = RNA_property_int_get(&rc->ptr, rc->prop);
+			RNA_property_int_ui_range(&rc->ptr, rc->prop, &min_value_int,
+			                          &max_value_int, &step_int);
+			rc->min_value = min_value_int;
+			rc->max_value = max_value_int;
+			break;
+		case PROP_FLOAT:
+			rc->initial_value = RNA_property_float_get(&rc->ptr, rc->prop);
+			RNA_property_float_ui_range(&rc->ptr, rc->prop, &rc->min_value,
+			                            &rc->max_value, &step_float, &precision);
+			break;
+		default:
+			BKE_report(op->reports, RPT_ERROR, "Property must be an integer or a float");
+			MEM_freeN(rc);
+			return OPERATOR_CANCELLED;
 	}
 
 	/* get subtype of property */
 	rc->subtype = RNA_property_subtype(rc->prop);
-	if(!ELEM3(rc->subtype, PROP_DISTANCE, PROP_FACTOR, PROP_ANGLE)) {
+	if (!ELEM3(rc->subtype, PROP_DISTANCE, PROP_FACTOR, PROP_ANGLE)) {
 		BKE_report(op->reports, RPT_ERROR, "Property must be a distance, a factor, or an angle");
 		MEM_freeN(rc);
 		return OPERATOR_CANCELLED;
@@ -3280,7 +3295,7 @@ static int radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 	/* add radial control paint cursor */
 	rc->cursor = WM_paint_cursor_activate(wm, op->type->poll,
-					      radial_control_paint_cursor, rc);
+	                                      radial_control_paint_cursor, rc);
 
 	WM_event_add_modal_handler(C, op);
 
@@ -3289,15 +3304,15 @@ static int radial_control_invoke(bContext *C, wmOperator *op, wmEvent *event)
 
 static void radial_control_set_value(RadialControl *rc, float val)
 {
-	switch(rc->type) {
-	case PROP_INT:
-		RNA_property_int_set(&rc->ptr, rc->prop, val);
-		break;
-	case PROP_FLOAT:
-		RNA_property_float_set(&rc->ptr, rc->prop, val);
-		break;
-	default:
-		break;
+	switch (rc->type) {
+		case PROP_INT:
+			RNA_property_int_set(&rc->ptr, rc->prop, val);
+			break;
+		case PROP_FLOAT:
+			RNA_property_float_set(&rc->ptr, rc->prop, val);
+			break;
+		default:
+			break;
 	}
 }
 
@@ -3312,8 +3327,8 @@ static int radial_control_cancel(bContext *C, wmOperator *op)
 	wm->paintcursors = rc->orig_paintcursors;
 
 	/* not sure if this is a good notifier to use;
-	   intended purpose is to update the UI so that the
-	   new value is displayed in sliders/numfields */
+	 * intended purpose is to update the UI so that the
+	 * new value is displayed in sliders/numfields */
 	WM_event_add_notifier(C, NC_WINDOW, NULL);
 
 	glDeleteTextures(1, &rc->gltex);
@@ -3333,61 +3348,61 @@ static int radial_control_modal(bContext *C, wmOperator *op, wmEvent *event)
 
 	snap = event->ctrl;
 
-	switch(event->type) {
-	case MOUSEMOVE:
-		delta[0]= rc->initial_mouse[0] - event->x;
-		delta[1]= rc->initial_mouse[1] - event->y;
+	switch (event->type) {
+		case MOUSEMOVE:
+			delta[0] = rc->initial_mouse[0] - event->x;
+			delta[1] = rc->initial_mouse[1] - event->y;
 
-		if(rc->zoom_prop) {
-			RNA_property_float_get_array(&rc->zoom_ptr, rc->zoom_prop, zoom);
-			delta[0] /= zoom[0];
-			delta[1] /= zoom[1];
-		}
+			if (rc->zoom_prop) {
+				RNA_property_float_get_array(&rc->zoom_ptr, rc->zoom_prop, zoom);
+				delta[0] /= zoom[0];
+				delta[1] /= zoom[1];
+			}
 
-		dist= sqrt(delta[0]*delta[0]+delta[1]*delta[1]);
+			dist = sqrt(delta[0] * delta[0] + delta[1] * delta[1]);
 
-		/* calculate new value and apply snapping  */
-		switch(rc->subtype) {
-		case PROP_DISTANCE:
-			new_value = dist;
-			if(snap) new_value = ((int)new_value + 5) / 10*10;
-			break;
-		case PROP_FACTOR:
-			new_value = 1 - dist / WM_RADIAL_CONTROL_DISPLAY_SIZE;
-			if(snap) new_value = ((int)ceil(new_value * 10.f) * 10.0f) / 100.f;
-			break;
-		case PROP_ANGLE:
-			new_value = atan2(delta[1], delta[0]) + M_PI;
-			if(snap) new_value = DEG2RADF(((int)RAD2DEGF(new_value) + 5) / 10*10);
+			/* calculate new value and apply snapping  */
+			switch (rc->subtype) {
+				case PROP_DISTANCE:
+					new_value = dist;
+					if (snap) new_value = ((int)new_value + 5) / 10 * 10;
+					break;
+				case PROP_FACTOR:
+					new_value = 1 - dist / WM_RADIAL_CONTROL_DISPLAY_SIZE;
+					if (snap) new_value = ((int)ceil(new_value * 10.f) * 10.0f) / 100.f;
+					break;
+				case PROP_ANGLE:
+					new_value = atan2(delta[1], delta[0]) + M_PI;
+					if (snap) new_value = DEG2RADF(((int)RAD2DEGF(new_value) + 5) / 10 * 10);
+					break;
+				default:
+					new_value = dist; /* dummy value, should this ever happen? - campbell */
+					break;
+			}
+
+			/* clamp and update */
+			CLAMP(new_value, rc->min_value, rc->max_value);
+			radial_control_set_value(rc, new_value);
+			rc->current_value = new_value;
 			break;
-		default:
-			new_value = dist; /* dummy value, should this ever happen? - campbell */
+
+		case ESCKEY:
+		case RIGHTMOUSE:
+			/* canceled; restore original value */
+			radial_control_set_value(rc, rc->initial_value);
+			ret = OPERATOR_CANCELLED;
 			break;
-		}
 
-		/* clamp and update */
-		CLAMP(new_value, rc->min_value, rc->max_value);
-		radial_control_set_value(rc, new_value);
-		rc->current_value = new_value;
-		break;
-
-	case ESCKEY:
-	case RIGHTMOUSE:
-		/* cancelled; restore original value */
-		radial_control_set_value(rc, rc->initial_value);
-		ret = OPERATOR_CANCELLED;
-		break;
-		
-	case LEFTMOUSE:
-	case PADENTER:
-		/* done; value already set */
-		ret = OPERATOR_FINISHED;
-		break;
+		case LEFTMOUSE:
+		case PADENTER:
+			/* done; value already set */
+			ret = OPERATOR_FINISHED;
+			break;
 	}
 
 	ED_region_tag_redraw(CTX_wm_region(C));
 
-	if(ret != OPERATOR_RUNNING_MODAL)
+	if (ret != OPERATOR_RUNNING_MODAL)
 		radial_control_cancel(C, op);
 
 	return ret;
@@ -3395,14 +3410,14 @@ static int radial_control_modal(bContext *C, wmOperator *op, wmEvent *event)
 
 static void WM_OT_radial_control(wmOperatorType *ot)
 {
-	ot->name= "Radial Control";
-	ot->idname= "WM_OT_radial_control";
+	ot->name = "Radial Control";
+	ot->idname = "WM_OT_radial_control";
 
-	ot->invoke= radial_control_invoke;
-	ot->modal= radial_control_modal;
-	ot->cancel= radial_control_cancel;
+	ot->invoke = radial_control_invoke;
+	ot->modal = radial_control_modal;
+	ot->cancel = radial_control_cancel;
 
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
 
 	/* all paths relative to the context */
 	RNA_def_string(ot->srna, "data_path_primary", "", 0, "Primary Data Path", "Primary path of property to be set by the radial control");
@@ -3421,14 +3436,14 @@ static void WM_OT_radial_control(wmOperatorType *ot)
 
 static void redraw_timer_window_swap(bContext *C)
 {
-	wmWindow *win= CTX_wm_window(C);
+	wmWindow *win = CTX_wm_window(C);
 	ScrArea *sa;
 
-	for(sa= CTX_wm_screen(C)->areabase.first; sa; sa= sa->next)
+	for (sa = CTX_wm_screen(C)->areabase.first; sa; sa = sa->next)
 		ED_area_tag_redraw(sa);
 	wm_draw_update(C);
 
-	CTX_wm_window_set(C, win);	/* XXX context manipulation warning! */
+	CTX_wm_window_set(C, win);  /* XXX context manipulation warning! */
 }
 
 static EnumPropertyItem redraw_timer_type_items[] = {
@@ -3439,80 +3454,81 @@ static EnumPropertyItem redraw_timer_type_items[] = {
 	{4, "ANIM_STEP", 0, "Anim Step", "Animation Steps"},
 	{5, "ANIM_PLAY", 0, "Anim Play", "Animation Playback"},
 	{6, "UNDO", 0, "Undo/Redo", "Undo/Redo"},
-	{0, NULL, 0, NULL, NULL}};
+	{0, NULL, 0, NULL, NULL}
+};
 
 static int redraw_timer_exec(bContext *C, wmOperator *op)
 {
-	ARegion *ar= CTX_wm_region(C);
-	double stime= PIL_check_seconds_timer();
+	ARegion *ar = CTX_wm_region(C);
+	double stime = PIL_check_seconds_timer();
 	int type = RNA_enum_get(op->ptr, "type");
 	int iter = RNA_int_get(op->ptr, "iterations");
 	int a;
 	float time;
-	const char *infostr= "";
+	const char *infostr = "";
 	
 	WM_cursor_wait(1);
 
-	for(a=0; a<iter; a++) {
-		if (type==0) {
-			if(ar)
+	for (a = 0; a < iter; a++) {
+		if (type == 0) {
+			if (ar)
 				ED_region_do_draw(C, ar);
 		} 
-		else if (type==1) {
-			wmWindow *win= CTX_wm_window(C);
+		else if (type == 1) {
+			wmWindow *win = CTX_wm_window(C);
 			
 			ED_region_tag_redraw(ar);
 			wm_draw_update(C);
 			
-			CTX_wm_window_set(C, win);	/* XXX context manipulation warning! */
+			CTX_wm_window_set(C, win);  /* XXX context manipulation warning! */
 		}
-		else if (type==2) {
-			wmWindow *win= CTX_wm_window(C);
+		else if (type == 2) {
+			wmWindow *win = CTX_wm_window(C);
 			ScrArea *sa;
 			
-			ScrArea *sa_back= CTX_wm_area(C);
-			ARegion *ar_back= CTX_wm_region(C);
+			ScrArea *sa_back = CTX_wm_area(C);
+			ARegion *ar_back = CTX_wm_region(C);
 
-			for(sa= CTX_wm_screen(C)->areabase.first; sa; sa= sa->next) {
+			for (sa = CTX_wm_screen(C)->areabase.first; sa; sa = sa->next) {
 				ARegion *ar_iter;
 				CTX_wm_area_set(C, sa);
 
-				for(ar_iter= sa->regionbase.first; ar_iter; ar_iter= ar_iter->next) {
-					if(ar_iter->swinid) {
+				for (ar_iter = sa->regionbase.first; ar_iter; ar_iter = ar_iter->next) {
+					if (ar_iter->swinid) {
 						CTX_wm_region_set(C, ar_iter);
 						ED_region_do_draw(C, ar_iter);
 					}
 				}
 			}
 
-			CTX_wm_window_set(C, win);	/* XXX context manipulation warning! */
+			CTX_wm_window_set(C, win);  /* XXX context manipulation warning! */
 
 			CTX_wm_area_set(C, sa_back);
 			CTX_wm_region_set(C, ar_back);
 		}
-		else if (type==3) {
+		else if (type == 3) {
 			redraw_timer_window_swap(C);
 		}
-		else if (type==4) {
-			Main *bmain= CTX_data_main(C);
-			Scene *scene= CTX_data_scene(C);
+		else if (type == 4) {
+			Main *bmain = CTX_data_main(C);
+			Scene *scene = CTX_data_scene(C);
 			
-			if(a & 1) scene->r.cfra--;
+			if (a & 1) scene->r.cfra--;
 			else scene->r.cfra++;
 			scene_update_for_newframe(bmain, scene, scene->lay);
 		}
-		else if (type==5) {
+		else if (type == 5) {
 
 			/* play anim, return on same frame as started with */
-			Main *bmain= CTX_data_main(C);
-			Scene *scene= CTX_data_scene(C);
-			int tot= (scene->r.efra - scene->r.sfra) + 1;
+			Main *bmain = CTX_data_main(C);
+			Scene *scene = CTX_data_scene(C);
+			int tot = (scene->r.efra - scene->r.sfra) + 1;
 
-			while(tot--) {
+			while (tot--) {
 				/* todo, ability to escape! */
 				scene->r.cfra++;
-				if(scene->r.cfra > scene->r.efra)
-					scene->r.cfra= scene->r.sfra;
+				if (scene->r.cfra > scene->r.efra)
+					scene->r.cfra = scene->r.sfra;
 
 				scene_update_for_newframe(bmain, scene, scene->lay);
 				redraw_timer_window_swap(C);
@@ -3524,29 +3540,29 @@ static int redraw_timer_exec(bContext *C, wmOperator *op)
 		}
 	}
 	
-	time= (float)((PIL_check_seconds_timer()-stime)*1000);
+	time = (float)((PIL_check_seconds_timer() - stime) * 1000);
 
 	RNA_enum_description(redraw_timer_type_items, type, &infostr);
 
 	WM_cursor_wait(0);
 
-	BKE_reportf(op->reports, RPT_WARNING, "%d x %s: %.2f ms,  average: %.4f", iter, infostr, time, time/iter);
+	BKE_reportf(op->reports, RPT_WARNING, "%d x %s: %.2f ms,  average: %.4f", iter, infostr, time, time / iter);
 	
 	return OPERATOR_FINISHED;
 }
 
 static void WM_OT_redraw_timer(wmOperatorType *ot)
 {
-	ot->name= "Redraw Timer";
-	ot->idname= "WM_OT_redraw_timer";
-	ot->description="Simple redraw timer to test the speed of updating the interface";
+	ot->name = "Redraw Timer";
+	ot->idname = "WM_OT_redraw_timer";
+	ot->description = "Simple redraw timer to test the speed of updating the interface";
 
-	ot->invoke= WM_menu_invoke;
-	ot->exec= redraw_timer_exec;
-	ot->poll= WM_operator_winactive;
+	ot->invoke = WM_menu_invoke;
+	ot->exec = redraw_timer_exec;
+	ot->poll = WM_operator_winactive;
 
-	ot->prop= RNA_def_enum(ot->srna, "type", redraw_timer_type_items, 0, "Type", "");
-	RNA_def_int(ot->srna, "iterations", 10, 1,INT_MAX, "Iterations", "Number of times to redraw", 1,1000);
+	ot->prop = RNA_def_enum(ot->srna, "type", redraw_timer_type_items, 0, "Type", "");
+	RNA_def_int(ot->srna, "iterations", 10, 1, INT_MAX, "Iterations", "Number of times to redraw", 1, 1000);
 
 }
 
@@ -3560,20 +3576,20 @@ static int memory_statistics_exec(bContext *UNUSED(C), wmOperator *UNUSED(op))
 
 static void WM_OT_memory_statistics(wmOperatorType *ot)
 {
-	ot->name= "Memory Statistics";
-	ot->idname= "WM_OT_memory_statistics";
-	ot->description= "Print memory statistics to the console";
+	ot->name = "Memory Statistics";
+	ot->idname = "WM_OT_memory_statistics";
+	ot->description = "Print memory statistics to the console";
 	
-	ot->exec= memory_statistics_exec;
+	ot->exec = memory_statistics_exec;
 }
 
 /* ************************** memory statistics for testing ***************** */
 
 static int dependency_relations_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Main *bmain= CTX_data_main(C);
-	Scene *scene= CTX_data_scene(C);
-	Object *ob= CTX_data_active_object(C);
+	Main *bmain = CTX_data_main(C);
+	Scene *scene = CTX_data_scene(C);
+	Object *ob = CTX_data_active_object(C);
 
 	DAG_print_dependencies(bmain, scene, ob);
 
@@ -3582,11 +3598,11 @@ static int dependency_relations_exec(bContext *C, wmOperator *UNUSED(op))
 
 static void WM_OT_dependency_relations(wmOperatorType *ot)
 {
-	ot->name= "Dependency Relations";
-	ot->idname= "WM_OT_dependency_relations";
-	ot->description= "Print dependency graph relations to the console";
+	ot->name = "Dependency Relations";
+	ot->idname = "WM_OT_dependency_relations";
+	ot->description = "Print dependency graph relations to the console";
 	
-	ot->exec= dependency_relations_exec;
+	ot->exec = dependency_relations_exec;
 }
 
 /* ******************************************************* */
@@ -3597,12 +3613,12 @@ static int wm_ndof_sensitivity_exec(bContext *UNUSED(C), wmOperator *op)
 	float change;
 	float sensitivity = U.ndof_sensitivity;
 
-	if(RNA_boolean_get(op->ptr, "fast"))
-		change = 0.5f; // 50% change
+	if (RNA_boolean_get(op->ptr, "fast"))
+		change = 0.5f;  // 50% change
 	else
-		change = 0.1f; // 10%
+		change = 0.1f;  // 10%
 
-	if(RNA_boolean_get(op->ptr, "decrease")) {
+	if (RNA_boolean_get(op->ptr, "decrease")) {
 		sensitivity -= sensitivity * change; 
 		if (sensitivity < min)
 			sensitivity = min;
@@ -3622,11 +3638,11 @@ static int wm_ndof_sensitivity_exec(bContext *UNUSED(C), wmOperator *op)
 
 static void WM_OT_ndof_sensitivity_change(wmOperatorType *ot)
 {
-	ot->name= "Change NDOF sensitivity";
-	ot->idname= "WM_OT_ndof_sensitivity_change";
-	ot->description="Change NDOF sensitivity";
+	ot->name = "Change NDOF sensitivity";
+	ot->idname = "WM_OT_ndof_sensitivity_change";
+	ot->description = "Change NDOF sensitivity";
 	
-	ot->exec= wm_ndof_sensitivity_exec;
+	ot->exec = wm_ndof_sensitivity_exec;
 
 	RNA_def_boolean(ot->srna, "decrease", 1, "Decrease NDOF sensitivity", "If true then action decreases NDOF sensitivity instead of increasing");
 	RNA_def_boolean(ot->srna, "fast", 0, "Fast NDOF sensitivity change", "If true then sensitivity changes 50%, otherwise 10%");
@@ -3635,10 +3651,15 @@ static void WM_OT_ndof_sensitivity_change(wmOperatorType *ot)
 
 static void operatortype_ghash_free_cb(wmOperatorType *ot)
 {
-	if(ot->macro.first)
+	if (ot->last_properties) {
+		IDP_FreeProperty(ot->last_properties);
+		MEM_freeN(ot->last_properties);
+	}
+
+	if (ot->macro.first)
 		wm_operatortype_free_macro(ot);
 
-	if(ot->ext.srna) /* python operator, allocs own string */
+	if (ot->ext.srna) /* python operator, allocs own string */
 		MEM_freeN((void *)ot->idname);
 
 	MEM_freeN(ot);
@@ -3649,13 +3670,13 @@ static void operatortype_ghash_free_cb(wmOperatorType *ot)
 void wm_operatortype_free(void)
 {
 	BLI_ghash_free(global_ops_hash, NULL, (GHashValFreeFP)operatortype_ghash_free_cb);
-	global_ops_hash= NULL;
+	global_ops_hash = NULL;
 }
 
 /* called on initialize WM_init() */
 void wm_operatortype_init(void)
 {
-	global_ops_hash= BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "wm_operatortype_init gh");
+	global_ops_hash = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp, "wm_operatortype_init gh");
 
 	WM_operatortype_append(WM_OT_window_duplicate);
 	WM_operatortype_append(WM_OT_read_homefile);
@@ -3693,24 +3714,23 @@ void wm_operatortype_init(void)
 static void gesture_circle_modal_keymap(wmKeyConfig *keyconf)
 {
 	static EnumPropertyItem modal_items[] = {
-	{GESTURE_MODAL_CANCEL,	"CANCEL", 0, "Cancel", ""},
-	{GESTURE_MODAL_CONFIRM,	"CONFIRM", 0, "Confirm", ""},
-	{GESTURE_MODAL_CIRCLE_ADD, "ADD", 0, "Add", ""},
-	{GESTURE_MODAL_CIRCLE_SUB, "SUBTRACT", 0, "Subtract", ""},
+		{GESTURE_MODAL_CANCEL,  "CANCEL", 0, "Cancel", ""},
+		{GESTURE_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""},
+		{GESTURE_MODAL_CIRCLE_ADD, "ADD", 0, "Add", ""},
+		{GESTURE_MODAL_CIRCLE_SUB, "SUBTRACT", 0, "Subtract", ""},
 
-	{GESTURE_MODAL_SELECT,	"SELECT", 0, "Select", ""},
-	{GESTURE_MODAL_DESELECT,"DESELECT", 0, "DeSelect", ""},
-	{GESTURE_MODAL_NOP,"NOP", 0, "No Operation", ""},
+		{GESTURE_MODAL_SELECT,  "SELECT", 0, "Select", ""},
+		{GESTURE_MODAL_DESELECT, "DESELECT", 0, "DeSelect", ""},
+		{GESTURE_MODAL_NOP, "NOP", 0, "No Operation", ""},
 
+		{0, NULL, 0, NULL, NULL}};
 
-	{0, NULL, 0, NULL, NULL}};
-
-	wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "View3D Gesture Circle");
+	wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "View3D Gesture Circle");
 
 	/* this function is called for each spacetype, only needs to add map once */
-	if(keymap) return;
+	if (keymap && keymap->modal_items) return;
 
-	keymap= WM_modalkeymap_add(keyconf, "View3D Gesture Circle", modal_items);
+	keymap = WM_modalkeymap_add(keyconf, "View3D Gesture Circle", modal_items);
 
 	/* items for modal map */
 	WM_modalkeymap_add_item(keymap, ESCKEY,    KM_PRESS, KM_ANY, 0, GESTURE_MODAL_CANCEL);
@@ -3747,17 +3767,17 @@ static void gesture_circle_modal_keymap(wmKeyConfig *keyconf)
 static void gesture_straightline_modal_keymap(wmKeyConfig *keyconf)
 {
 	static EnumPropertyItem modal_items[] = {
-		{GESTURE_MODAL_CANCEL,	"CANCEL", 0, "Cancel", ""},
-		{GESTURE_MODAL_SELECT,	"SELECT", 0, "Select", ""},
-		{GESTURE_MODAL_BEGIN,	"BEGIN", 0, "Begin", ""},
+		{GESTURE_MODAL_CANCEL,  "CANCEL", 0, "Cancel", ""},
+		{GESTURE_MODAL_SELECT,  "SELECT", 0, "Select", ""},
+		{GESTURE_MODAL_BEGIN,   "BEGIN", 0, "Begin", ""},
 		{0, NULL, 0, NULL, NULL}};
 	
-	wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Gesture Straight Line");
+	wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Gesture Straight Line");
 	
 	/* this function is called for each spacetype, only needs to add map once */
-	if(keymap) return;
+	if (keymap && keymap->modal_items) return;
 	
-	keymap= WM_modalkeymap_add(keyconf, "Gesture Straight Line", modal_items);
+	keymap = WM_modalkeymap_add(keyconf, "Gesture Straight Line", modal_items);
 	
 	/* items for modal map */
 	WM_modalkeymap_add_item(keymap, ESCKEY,    KM_PRESS, KM_ANY, 0, GESTURE_MODAL_CANCEL);
@@ -3775,22 +3795,22 @@ static void gesture_straightline_modal_keymap(wmKeyConfig *keyconf)
 static void gesture_border_modal_keymap(wmKeyConfig *keyconf)
 {
 	static EnumPropertyItem modal_items[] = {
-	{GESTURE_MODAL_CANCEL,	"CANCEL", 0, "Cancel", ""},
-	{GESTURE_MODAL_SELECT,	"SELECT", 0, "Select", ""},
-	{GESTURE_MODAL_DESELECT,"DESELECT", 0, "DeSelect", ""},
-	{GESTURE_MODAL_BEGIN,	"BEGIN", 0, "Begin", ""},
-	{0, NULL, 0, NULL, NULL}};
+		{GESTURE_MODAL_CANCEL,  "CANCEL", 0, "Cancel", ""},
+		{GESTURE_MODAL_SELECT,  "SELECT", 0, "Select", ""},
+		{GESTURE_MODAL_DESELECT, "DESELECT", 0, "DeSelect", ""},
+		{GESTURE_MODAL_BEGIN,   "BEGIN", 0, "Begin", ""},
+		{0, NULL, 0, NULL, NULL}};
 
-	wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Gesture Border");
+	wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Gesture Border");
 
 	/* this function is called for each spacetype, only needs to add map once */
-	if(keymap) return;
+	if (keymap && keymap->modal_items) return;
 
-	keymap= WM_modalkeymap_add(keyconf, "Gesture Border", modal_items);
+	keymap = WM_modalkeymap_add(keyconf, "Gesture Border", modal_items);
 
 	/* items for modal map */
 	WM_modalkeymap_add_item(keymap, ESCKEY,    KM_PRESS, KM_ANY, 0, GESTURE_MODAL_CANCEL);
-			/* Note: cancel only on press otherwise you cannot map this to RMB-gesture */
+	/* Note: cancel only on press otherwise you cannot map this to RMB-gesture */
 	WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_PRESS, KM_ANY, 0, GESTURE_MODAL_CANCEL);
 
 	WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_BEGIN);
@@ -3815,12 +3835,14 @@ static void gesture_border_modal_keymap(wmKeyConfig *keyconf)
 	WM_modalkeymap_assign(keymap, "MARKER_OT_select_border");
 	WM_modalkeymap_assign(keymap, "NLA_OT_select_border");
 	WM_modalkeymap_assign(keymap, "NODE_OT_select_border");
+	WM_modalkeymap_assign(keymap, "PAINT_OT_hide_show");
 	WM_modalkeymap_assign(keymap, "OUTLINER_OT_select_border");
 //	WM_modalkeymap_assign(keymap, "SCREEN_OT_border_select"); // template
 	WM_modalkeymap_assign(keymap, "SEQUENCER_OT_select_border");
 	WM_modalkeymap_assign(keymap, "SEQUENCER_OT_view_ghost_border");
 	WM_modalkeymap_assign(keymap, "UV_OT_select_border");
 	WM_modalkeymap_assign(keymap, "CLIP_OT_select_border");
+	WM_modalkeymap_assign(keymap, "CLIP_OT_graph_select_border");
 	WM_modalkeymap_assign(keymap, "VIEW2D_OT_zoom_border");
 	WM_modalkeymap_assign(keymap, "VIEW3D_OT_clip_border");
 	WM_modalkeymap_assign(keymap, "VIEW3D_OT_render_border");
@@ -3832,18 +3854,18 @@ static void gesture_border_modal_keymap(wmKeyConfig *keyconf)
 static void gesture_zoom_border_modal_keymap(wmKeyConfig *keyconf)
 {
 	static EnumPropertyItem modal_items[] = {
-	{GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
-	{GESTURE_MODAL_IN,	"IN", 0, "In", ""},
-	{GESTURE_MODAL_OUT, "OUT", 0, "Out", ""},
-	{GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""},
-	{0, NULL, 0, NULL, NULL}};
+		{GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
+		{GESTURE_MODAL_IN,  "IN", 0, "In", ""},
+		{GESTURE_MODAL_OUT, "OUT", 0, "Out", ""},
+		{GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""},
+		{0, NULL, 0, NULL, NULL}};
 
-	wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Gesture Zoom Border");
+	wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Gesture Zoom Border");
 
 	/* this function is called for each spacetype, only needs to add map once */
-	if(keymap) return;
+	if (keymap && keymap->modal_items) return;
 
-	keymap= WM_modalkeymap_add(keyconf, "Gesture Zoom Border", modal_items);
+	keymap = WM_modalkeymap_add(keyconf, "Gesture Zoom Border", modal_items);
 
 	/* items for modal map */
 	WM_modalkeymap_add_item(keymap, ESCKEY,    KM_PRESS, KM_ANY, 0, GESTURE_MODAL_CANCEL);
@@ -3863,42 +3885,42 @@ static void gesture_zoom_border_modal_keymap(wmKeyConfig *keyconf)
 /* default keymap for windows and screens, only call once per WM */
 void wm_window_keymap(wmKeyConfig *keyconf)
 {
-	wmKeyMap *keymap= WM_keymap_find(keyconf, "Window", 0, 0);
+	wmKeyMap *keymap = WM_keymap_find(keyconf, "Window", 0, 0);
 	wmKeyMapItem *kmi;
 	
 	/* note, this doesn't replace existing keymap items */
-	WM_keymap_verify_item(keymap, "WM_OT_window_duplicate", WKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
+	WM_keymap_verify_item(keymap, "WM_OT_window_duplicate", WKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
 	#ifdef __APPLE__
 	WM_keymap_add_item(keymap, "WM_OT_read_homefile", NKEY, KM_PRESS, KM_OSKEY, 0);
-	WM_keymap_add_menu(keymap, "INFO_MT_file_open_recent", OKEY, KM_PRESS, KM_SHIFT|KM_OSKEY, 0);
+	WM_keymap_add_menu(keymap, "INFO_MT_file_open_recent", OKEY, KM_PRESS, KM_SHIFT | KM_OSKEY, 0);
 	WM_keymap_add_item(keymap, "WM_OT_open_mainfile", OKEY, KM_PRESS, KM_OSKEY, 0);
 	WM_keymap_add_item(keymap, "WM_OT_save_mainfile", SKEY, KM_PRESS, KM_OSKEY, 0);
-	WM_keymap_add_item(keymap, "WM_OT_save_as_mainfile", SKEY, KM_PRESS, KM_SHIFT|KM_OSKEY, 0);
+	WM_keymap_add_item(keymap, "WM_OT_save_as_mainfile", SKEY, KM_PRESS, KM_SHIFT | KM_OSKEY, 0);
 	WM_keymap_add_item(keymap, "WM_OT_quit_blender", QKEY, KM_PRESS, KM_OSKEY, 0);
 	#endif
 	WM_keymap_add_item(keymap, "WM_OT_read_homefile", NKEY, KM_PRESS, KM_CTRL, 0);
 	WM_keymap_add_item(keymap, "WM_OT_save_homefile", UKEY, KM_PRESS, KM_CTRL, 0); 
-	WM_keymap_add_menu(keymap, "INFO_MT_file_open_recent", OKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+	WM_keymap_add_menu(keymap, "INFO_MT_file_open_recent", OKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
 	WM_keymap_add_item(keymap, "WM_OT_open_mainfile", OKEY, KM_PRESS, KM_CTRL, 0);
 	WM_keymap_add_item(keymap, "WM_OT_open_mainfile", F1KEY, KM_PRESS, 0, 0);
-	WM_keymap_add_item(keymap, "WM_OT_link_append", OKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
-	kmi= WM_keymap_add_item(keymap, "WM_OT_link_append", F1KEY, KM_PRESS, KM_SHIFT, 0);
+	WM_keymap_add_item(keymap, "WM_OT_link_append", OKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
+	kmi = WM_keymap_add_item(keymap, "WM_OT_link_append", F1KEY, KM_PRESS, KM_SHIFT, 0);
 	RNA_boolean_set(kmi->ptr, "link", FALSE);
 	RNA_boolean_set(kmi->ptr, "instance_groups", FALSE);
 
 	WM_keymap_add_item(keymap, "WM_OT_save_mainfile", SKEY, KM_PRESS, KM_CTRL, 0);
 	WM_keymap_add_item(keymap, "WM_OT_save_mainfile", WKEY, KM_PRESS, KM_CTRL, 0);
-	WM_keymap_add_item(keymap, "WM_OT_save_as_mainfile", SKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+	WM_keymap_add_item(keymap, "WM_OT_save_as_mainfile", SKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
 	WM_keymap_add_item(keymap, "WM_OT_save_as_mainfile", F2KEY, KM_PRESS, 0, 0);
-	kmi= WM_keymap_add_item(keymap, "WM_OT_save_as_mainfile", SKEY, KM_PRESS, KM_ALT|KM_CTRL, 0);
+	kmi = WM_keymap_add_item(keymap, "WM_OT_save_as_mainfile", SKEY, KM_PRESS, KM_ALT | KM_CTRL, 0);
 	RNA_boolean_set(kmi->ptr, "copy", TRUE);
 
 	WM_keymap_verify_item(keymap, "WM_OT_window_fullscreen_toggle", F11KEY, KM_PRESS, KM_ALT, 0);
 	WM_keymap_add_item(keymap, "WM_OT_quit_blender", QKEY, KM_PRESS, KM_CTRL, 0);
 
 	/* debug/testing */
-	WM_keymap_verify_item(keymap, "WM_OT_redraw_timer", TKEY, KM_PRESS, KM_ALT|KM_CTRL, 0);
-	WM_keymap_verify_item(keymap, "WM_OT_debug_menu", DKEY, KM_PRESS, KM_ALT|KM_CTRL, 0);
+	WM_keymap_verify_item(keymap, "WM_OT_redraw_timer", TKEY, KM_PRESS, KM_ALT | KM_CTRL, 0);
+	WM_keymap_verify_item(keymap, "WM_OT_debug_menu", DKEY, KM_PRESS, KM_ALT | KM_CTRL, 0);
 
 	/* menus that can be accessed anywhere in blender */
 	WM_keymap_verify_item(keymap, "WM_OT_search_menu", SPACEKEY, KM_PRESS, 0, 0);
@@ -3950,19 +3972,19 @@ void wm_window_keymap(wmKeyConfig *keyconf)
 	RNA_string_set(kmi->ptr, "value", "DOPESHEET_EDITOR");
 	
 	/* ndof speed */
-	kmi= WM_keymap_add_item(keymap, "WM_OT_ndof_sensitivity_change", NDOF_BUTTON_PLUS, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "WM_OT_ndof_sensitivity_change", NDOF_BUTTON_PLUS, KM_PRESS, 0, 0);
 	RNA_boolean_set(kmi->ptr, "decrease", FALSE);
 	RNA_boolean_set(kmi->ptr, "fast", FALSE);
 
-	kmi= WM_keymap_add_item(keymap, "WM_OT_ndof_sensitivity_change", NDOF_BUTTON_MINUS, KM_PRESS, 0, 0);
+	kmi = WM_keymap_add_item(keymap, "WM_OT_ndof_sensitivity_change", NDOF_BUTTON_MINUS, KM_PRESS, 0, 0);
 	RNA_boolean_set(kmi->ptr, "decrease", TRUE);
 	RNA_boolean_set(kmi->ptr, "fast", FALSE);
 
-	kmi= WM_keymap_add_item(keymap, "WM_OT_ndof_sensitivity_change", NDOF_BUTTON_PLUS, KM_PRESS, KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "WM_OT_ndof_sensitivity_change", NDOF_BUTTON_PLUS, KM_PRESS, KM_SHIFT, 0);
 	RNA_boolean_set(kmi->ptr, "decrease", FALSE);
 	RNA_boolean_set(kmi->ptr, "fast", TRUE);
 
-	kmi= WM_keymap_add_item(keymap, "WM_OT_ndof_sensitivity_change", NDOF_BUTTON_MINUS, KM_PRESS, KM_SHIFT, 0);
+	kmi = WM_keymap_add_item(keymap, "WM_OT_ndof_sensitivity_change", NDOF_BUTTON_MINUS, KM_PRESS, KM_SHIFT, 0);
 	RNA_boolean_set(kmi->ptr, "decrease", TRUE);
 	RNA_boolean_set(kmi->ptr, "fast", TRUE);
 
@@ -3975,20 +3997,20 @@ void wm_window_keymap(wmKeyConfig *keyconf)
 /* Generic itemf's for operators that take library args */
 static EnumPropertyItem *rna_id_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), int *do_free, ID *id, int local)
 {
-	EnumPropertyItem item_tmp= {0}, *item= NULL;
-	int totitem= 0;
-	int i= 0;
+	EnumPropertyItem item_tmp = {0}, *item = NULL;
+	int totitem = 0;
+	int i = 0;
 
-	for( ; id; id= id->next) {
-		if(local==FALSE || id->lib==NULL) {
-			item_tmp.identifier= item_tmp.name= id->name+2;
-			item_tmp.value= i++;
+	for (; id; id = id->next) {
+		if (local == FALSE || id->lib == NULL) {
+			item_tmp.identifier = item_tmp.name = id->name + 2;
+			item_tmp.value = i++;
 			RNA_enum_item_add(&item, &totitem, &item_tmp);
 		}
 	}
 
 	RNA_enum_item_end(&item, &totitem);
-	*do_free= 1;
+	*do_free = 1;
 
 	return item;
 }
@@ -3998,10 +4020,12 @@ EnumPropertyItem *RNA_action_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UN
 {
 	return rna_id_itemf(C, ptr, do_free, C ? (ID *)CTX_data_main(C)->action.first : NULL, FALSE);
 }
+#if 0 /* UNUSED */
 EnumPropertyItem *RNA_action_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *do_free)
 {
 	return rna_id_itemf(C, ptr, do_free, C ? (ID *)CTX_data_main(C)->action.first : NULL, TRUE);
 }
+#endif
 
 EnumPropertyItem *RNA_group_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *do_free)
 {
@@ -4029,3 +4053,12 @@ EnumPropertyItem *RNA_scene_local_itemf(bContext *C, PointerRNA *ptr, PropertyRN
 {
 	return rna_id_itemf(C, ptr, do_free, C ? (ID *)CTX_data_main(C)->scene.first : NULL, TRUE);
 }
+
+EnumPropertyItem *RNA_movieclip_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *do_free)
+{
+	return rna_id_itemf(C, ptr, do_free, C ? (ID *)CTX_data_main(C)->movieclip.first : NULL, FALSE);
+}
+EnumPropertyItem *RNA_movieclip_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *do_free)
+{
+	return rna_id_itemf(C, ptr, do_free, C ? (ID *)CTX_data_main(C)->movieclip.first : NULL, TRUE);
+}
diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c
index 8a4dd3d..6ffb28b 100644
--- a/source/blender/windowmanager/intern/wm_subwindow.c
+++ b/source/blender/windowmanager/intern/wm_subwindow.c
@@ -58,14 +58,14 @@
 
 /* wmSubWindow stored in wmWindow... but not exposed outside this C file */
 /* it seems a bit redundant (area regions can store it too, but we keep it
-   because we can store all kind of future opengl fanciness here */
+ * because we can store all kind of future opengl fanciness here */
 
 /* we use indices and array because:
-   - index has safety, no pointers from this C file hanging around
-   - fast lookups of indices with array, list would give overhead
-   - old code used it this way...
-   - keep option open to have 2 screens using same window
-*/
+ * - index has safety, no pointers from this C file hanging around
+ * - fast lookups of indices with array, list would give overhead
+ * - old code used it this way...
+ * - keep option open to have 2 screens using same window
+ */
 
 typedef struct wmSubWindow {
 	struct wmSubWindow *next, *prev;
@@ -87,7 +87,7 @@ void wm_subwindows_free(wmWindow *win)
 {
 	wmSubWindow *swin;
 	
-	for(swin= win->subwindows.first; swin; swin= swin->next)
+	for (swin = win->subwindows.first; swin; swin = swin->next)
 		wm_subwindow_free(swin);
 	
 	BLI_freelistN(&win->subwindows);
@@ -96,7 +96,7 @@ void wm_subwindows_free(wmWindow *win)
 
 int wm_subwindow_get(wmWindow *win)	
 {
-	if(win->curswin)
+	if (win->curswin)
 		return win->curswin->swinid;
 	return 0;
 }
@@ -105,46 +105,46 @@ static wmSubWindow *swin_from_swinid(wmWindow *win, int swinid)
 {
 	wmSubWindow *swin;
 	
-	for(swin= win->subwindows.first; swin; swin= swin->next)
-		if(swin->swinid==swinid)
+	for (swin = win->subwindows.first; swin; swin = swin->next)
+		if (swin->swinid == swinid)
 			break;
 	return swin;
 }
 
 void wm_subwindow_getsize(wmWindow *win, int swinid, int *x, int *y) 
 {
-	wmSubWindow *swin= swin_from_swinid(win, swinid);
+	wmSubWindow *swin = swin_from_swinid(win, swinid);
 
-	if(swin) {
-		*x= swin->winrct.xmax - swin->winrct.xmin + 1;
-		*y= swin->winrct.ymax - swin->winrct.ymin + 1;
+	if (swin) {
+		*x = swin->winrct.xmax - swin->winrct.xmin + 1;
+		*y = swin->winrct.ymax - swin->winrct.ymin + 1;
 	}
 }
 
 void wm_subwindow_getorigin(wmWindow *win, int swinid, int *x, int *y)
 {
-	wmSubWindow *swin= swin_from_swinid(win, swinid);
+	wmSubWindow *swin = swin_from_swinid(win, swinid);
 
-	if(swin) {
-		*x= swin->winrct.xmin;
-		*y= swin->winrct.ymin;
+	if (swin) {
+		*x = swin->winrct.xmin;
+		*y = swin->winrct.ymin;
 	}
 }
 
 void wm_subwindow_getmatrix(wmWindow *win, int swinid, float mat[][4])
 {
-	wmSubWindow *swin= swin_from_swinid(win, swinid);
+	wmSubWindow *swin = swin_from_swinid(win, swinid);
 
-	if(swin) {
+	if (swin) {
 		/* used by UI, should find a better way to get the matrix there */
-		if(swinid == win->screen->mainwin) {
+		if (swinid == win->screen->mainwin) {
 			int width, height;
 
 			wm_subwindow_getsize(win, swin->swinid, &width, &height);
-			orthographic_m4(mat, -0.375f, (float)width-0.375f, -0.375f, (float)height-0.375f, -100, 100);
+			orthographic_m4(mat, -0.375f, (float)width - 0.375f, -0.375f, (float)height - 0.375f, -100, 100);
 		}
 		else
-			glGetFloatv(GL_PROJECTION_MATRIX, (float*)mat);
+			glGetFloatv(GL_PROJECTION_MATRIX, (float *)mat);
 	}
 }
 
@@ -154,25 +154,28 @@ int wm_subwindow_open(wmWindow *win, rcti *winrct)
 {
 	wmSubWindow *swin;
 	int width, height;
-	int freewinid= 1;
+	int freewinid = 1;
 	
-	for(swin= win->subwindows.first; swin; swin= swin->next)
-		if(freewinid <= swin->swinid)
-			freewinid= swin->swinid+1;
+	for (swin = win->subwindows.first; swin; swin = swin->next)
+		if (freewinid <= swin->swinid)
+			freewinid = swin->swinid + 1;
 
-	win->curswin= swin= MEM_callocN(sizeof(wmSubWindow), "swinopen");
+	win->curswin = swin = MEM_callocN(sizeof(wmSubWindow), "swinopen");
 	BLI_addtail(&win->subwindows, swin);
 	
-	if(G.f & G_DEBUG) printf("swin %d added\n", freewinid);
-	swin->swinid= freewinid;
-	swin->winrct= *winrct;
+	if (G.debug & G_DEBUG_EVENTS) {
+		printf("%s: swin %d added\n", __func__, freewinid);
+	}
+
+	swin->swinid = freewinid;
+	swin->winrct = *winrct;
 
 	/* and we appy it all right away */
 	wmSubWindowSet(win, swin->swinid);
 	
 	/* extra service */
 	wm_subwindow_getsize(win, swin->swinid, &width, &height);
-	wmOrtho2(-0.375f, (float)width-0.375f, -0.375f, (float)height-0.375f);
+	wmOrtho2(-0.375f, (float)width - 0.375f, -0.375f, (float)height - 0.375f);
 	glLoadIdentity();
 
 	return swin->swinid;
@@ -181,11 +184,11 @@ int wm_subwindow_open(wmWindow *win, rcti *winrct)
 
 void wm_subwindow_close(wmWindow *win, int swinid)
 {
-	wmSubWindow *swin= swin_from_swinid(win, swinid);
+	wmSubWindow *swin = swin_from_swinid(win, swinid);
 
 	if (swin) {
-		if (swin==win->curswin)
-			win->curswin= NULL;
+		if (swin == win->curswin)
+			win->curswin = NULL;
 		wm_subwindow_free(swin);
 		BLI_remlink(&win->subwindows, swin);
 		MEM_freeN(swin);
@@ -199,35 +202,35 @@ void wm_subwindow_close(wmWindow *win, int swinid)
 /* pixels go from 0-99 for a 100 pixel window */
 void wm_subwindow_position(wmWindow *win, int swinid, rcti *winrct)
 {
-	wmSubWindow *swin= swin_from_swinid(win, swinid);
+	wmSubWindow *swin = swin_from_swinid(win, swinid);
 	
-	if(swin) {
+	if (swin) {
 		int width, height;
 		
-		swin->winrct= *winrct;
+		swin->winrct = *winrct;
 		
 		/* CRITICAL, this clamping ensures that
-			* the viewport never goes outside the screen
-			* edges (assuming the x, y coords aren't
-					 * outside). This caused a hardware lock
-			* on Matrox cards if it happens.
-			* 
-			* Really Blender should never _ever_ try
-			* to do such a thing, but just to be safe
-			* clamp it anyway (or fix the bScreen
-			* scaling routine, and be damn sure you
-			* fixed it). - zr  (2001!)
-			*/
+		 * the viewport never goes outside the screen
+		 * edges (assuming the x, y coords aren't
+		 *        outside). This caused a hardware lock
+		 * on Matrox cards if it happens.
+		 *
+		 * Really Blender should never _ever_ try
+		 * to do such a thing, but just to be safe
+		 * clamp it anyway (or fix the bScreen
+		 * scaling routine, and be damn sure you
+		 * fixed it). - zr  (2001!)
+		 */
 		
 		if (swin->winrct.xmax > win->sizex)
-			swin->winrct.xmax= win->sizex;
+			swin->winrct.xmax = win->sizex;
 		if (swin->winrct.ymax > win->sizey)
-			swin->winrct.ymax= win->sizey;
+			swin->winrct.ymax = win->sizey;
 		
 		/* extra service */
 		wmSubWindowSet(win, swinid);
 		wm_subwindow_getsize(win, swinid, &width, &height);
-		wmOrtho2(-0.375f, (float)width-0.375f, -0.375f, (float)height-0.375f);
+		wmOrtho2(-0.375f, (float)width - 0.375f, -0.375f, (float)height - 0.375f);
 	}
 	else {
 		printf("wm_subwindow_position: Internal error, bad winid: %d\n", swinid);
@@ -238,35 +241,35 @@ void wm_subwindow_position(wmWindow *win, int swinid, rcti *winrct)
 /* ----------------- exported in WM_api.h ------------------------------------------------------ */
 
 /* internal state, no threaded opengl! XXX */
-static wmWindow *_curwindow= NULL;
-static wmSubWindow *_curswin= NULL;
+static wmWindow *_curwindow = NULL;
+static wmSubWindow *_curswin = NULL;
 
 void wmSubWindowScissorSet(wmWindow *win, int swinid, rcti *srct)
 {
 	int width, height;
-	_curswin= swin_from_swinid(win, swinid);
+	_curswin = swin_from_swinid(win, swinid);
 	
-	if(_curswin==NULL) {
+	if (_curswin == NULL) {
 		printf("wmSubWindowSet %d: doesn't exist\n", swinid);
 		return;
 	}
 	
-	win->curswin= _curswin;
-	_curwindow= win;
+	win->curswin = _curswin;
+	_curwindow = win;
 	
-	width= _curswin->winrct.xmax - _curswin->winrct.xmin + 1;
-	height= _curswin->winrct.ymax - _curswin->winrct.ymin + 1;
+	width = _curswin->winrct.xmax - _curswin->winrct.xmin + 1;
+	height = _curswin->winrct.ymax - _curswin->winrct.ymin + 1;
 	glViewport(_curswin->winrct.xmin, _curswin->winrct.ymin, width, height);
 
-	if(srct) {
-		width= srct->xmax - srct->xmin + 1;
-		height= srct->ymax - srct->ymin + 1;
+	if (srct) {
+		width = srct->xmax - srct->xmin + 1;
+		height = srct->ymax - srct->ymin + 1;
 		glScissor(srct->xmin, srct->ymin, width, height);
 	}
 	else
 		glScissor(_curswin->winrct.xmin, _curswin->winrct.ymin, width, height);
 	
-	wmOrtho2(-0.375f, (float)width-0.375f, -0.375f, (float)height-0.375f);
+	wmOrtho2(-0.375f, (float)width - 0.375f, -0.375f, (float)height - 0.375f);
 	glLoadIdentity();
 
 	glFlush();
@@ -300,8 +303,8 @@ void wmOrtho(float x1, float x2, float y1, float y2, float n, float f)
 void wmOrtho2(float x1, float x2, float y1, float y2)
 {
 	/* prevent opengl from generating errors */
-	if(x1==x2) x2+=1.0f;
-	if(y1==y2) y2+=1.0f;
+	if (x1 == x2) x2 += 1.0f;
+	if (y1 == y2) y2 += 1.0f;
 
 	wmOrtho(x1, x2, y1, y2, -100, 100);
 }
@@ -314,25 +317,25 @@ void wmOrtho2(float x1, float x2, float y1, float y2)
 
 unsigned int index_to_framebuffer(int index)
 {
-	unsigned int i= index;
-
-	switch(GPU_color_depth()) {
-	case 12:
-		i= ((i & 0xF00)<<12) + ((i & 0xF0)<<8) + ((i & 0xF)<<4);
-		/* sometimes dithering subtracts! */
-		i |= 0x070707;
-		break;
-	case 15:
-	case 16:
-		i= ((i & 0x7C00)<<9) + ((i & 0x3E0)<<6) + ((i & 0x1F)<<3);
-		i |= 0x030303;
-		break;
-	case 24:
-		break;
-	default:	// 18 bits... 
-		i= ((i & 0x3F000)<<6) + ((i & 0xFC0)<<4) + ((i & 0x3F)<<2);
-		i |= 0x010101;
-		break;
+	unsigned int i = index;
+
+	switch (GPU_color_depth()) {
+		case 12:
+			i = ((i & 0xF00) << 12) + ((i & 0xF0) << 8) + ((i & 0xF) << 4);
+			/* sometimes dithering subtracts! */
+			i |= 0x070707;
+			break;
+		case 15:
+		case 16:
+			i = ((i & 0x7C00) << 9) + ((i & 0x3E0) << 6) + ((i & 0x1F) << 3);
+			i |= 0x030303;
+			break;
+		case 24:
+			break;
+		default: // 18 bits...
+			i = ((i & 0x3F000) << 6) + ((i & 0xFC0) << 4) + ((i & 0x3F) << 2);
+			i |= 0x010101;
+			break;
 	}
 	
 	return i;
@@ -344,27 +347,27 @@ unsigned int index_to_framebuffer(int index)
 
 unsigned int index_to_framebuffer(int index)
 {
-	unsigned int i= index;
+	unsigned int i = index;
 	
-	switch(GPU_color_depth()) {
+	switch (GPU_color_depth()) {
 		case 8:
-			i= ((i & 48)<<18) + ((i & 12)<<12) + ((i & 3)<<6);
+			i = ((i & 48) << 18) + ((i & 12) << 12) + ((i & 3) << 6);
 			i |= 0x3F3F3F;
 			break;
 		case 12:
-			i= ((i & 0xF00)<<12) + ((i & 0xF0)<<8) + ((i & 0xF)<<4);
+			i = ((i & 0xF00) << 12) + ((i & 0xF0) << 8) + ((i & 0xF) << 4);
 			/* sometimes dithering subtracts! */
 			i |= 0x0F0F0F;
 			break;
 		case 15:
 		case 16:
-			i= ((i & 0x7C00)<<9) + ((i & 0x3E0)<<6) + ((i & 0x1F)<<3);
+			i = ((i & 0x7C00) << 9) + ((i & 0x3E0) << 6) + ((i & 0x1F) << 3);
 			i |= 0x070707;
 			break;
 		case 24:
 			break;
-		default:	// 18 bits... 
-			i= ((i & 0x3F000)<<6) + ((i & 0xFC0)<<4) + ((i & 0x3F)<<2);
+		default:    // 18 bits...
+			i = ((i & 0x3F000) << 6) + ((i & 0xFC0) << 4) + ((i & 0x3F) << 2);
 			i |= 0x030303;
 			break;
 	}
@@ -376,26 +379,26 @@ unsigned int index_to_framebuffer(int index)
 
 void WM_set_framebuffer_index_color(int index)
 {
-	const int col= index_to_framebuffer(index);
+	const int col = index_to_framebuffer(index);
 	cpack(col);
 }
 
 int WM_framebuffer_to_index(unsigned int col)
 {
-	if (col==0) return 0;
-
-	switch(GPU_color_depth()) {
-	case 8:
-		return ((col & 0xC00000)>>18) + ((col & 0xC000)>>12) + ((col & 0xC0)>>6);
-	case 12:
-		return ((col & 0xF00000)>>12) + ((col & 0xF000)>>8) + ((col & 0xF0)>>4);
-	case 15:
-	case 16:
-		return ((col & 0xF80000)>>9) + ((col & 0xF800)>>6) + ((col & 0xF8)>>3);
-	case 24:
-		return col & 0xFFFFFF;
-	default: // 18 bits...
-		return ((col & 0xFC0000)>>6) + ((col & 0xFC00)>>4) + ((col & 0xFC)>>2);
+	if (col == 0) return 0;
+
+	switch (GPU_color_depth()) {
+		case 8:
+			return ((col & 0xC00000) >> 18) + ((col & 0xC000) >> 12) + ((col & 0xC0) >> 6);
+		case 12:
+			return ((col & 0xF00000) >> 12) + ((col & 0xF000) >> 8) + ((col & 0xF0) >> 4);
+		case 15:
+		case 16:
+			return ((col & 0xF80000) >> 9) + ((col & 0xF800) >> 6) + ((col & 0xF8) >> 3);
+		case 24:
+			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 fe967bb..031cfe9 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -76,24 +76,35 @@
 #include "UI_interface.h"
 
 /* the global to talk to ghost */
-static GHOST_SystemHandle g_system= NULL;
+static GHOST_SystemHandle g_system = NULL;
+
+typedef enum WinOverrideFlag {
+	WIN_OVERRIDE_GEOM     = (1 << 0),
+	WIN_OVERRIDE_WINSTATE = (1 << 1)
+} WinOverrideFlag;
 
 /* set by commandline */
-static int prefsizx= 0, prefsizy= 0, prefstax= 0, prefstay= 0, initialstate= GHOST_kWindowStateNormal;
-static unsigned short useprefsize= 0;
+static struct WMInitStruct {
+	/* window geometry */
+	int size_x, size_y;
+	int start_x, start_y;
+
+	int windowstate;
+	WinOverrideFlag override_flag;
+} wm_init_state = {0, 0, 0, 0, GHOST_kWindowStateNormal, 0};
 
 /* ******** win open & close ************ */
 
 /* XXX this one should correctly check for apple top header...
- done for Cocoa : returns window contents (and not frame) max size*/
+ * done for Cocoa : returns window contents (and not frame) max size*/
 void wm_get_screensize(int *width_r, int *height_r)
 {
 	unsigned int uiwidth;
 	unsigned int uiheight;
 	
 	GHOST_GetMainDisplayDimensions(g_system, &uiwidth, &uiheight);
-	*width_r= uiwidth;
-	*height_r= uiheight;
+	*width_r = uiwidth;
+	*height_r = uiheight;
 }
 
 /* keeps offset and size within monitor bounds */
@@ -108,77 +119,78 @@ static void wm_window_check_position(rcti *rect)
 	height -= 70;
 #endif
 	
-	if(rect->xmin < 0) {
+	if (rect->xmin < 0) {
 		rect->xmax -= rect->xmin;
 		rect->xmin  = 0;
 	}
-	if(rect->ymin < 0) {
+	if (rect->ymin < 0) {
 		rect->ymax -= rect->ymin;
 		rect->ymin  = 0;
 	}
-	if(rect->xmax > width) {
-		d= rect->xmax - width;
+	if (rect->xmax > width) {
+		d = rect->xmax - width;
 		rect->xmax -= d;
 		rect->xmin -= d;
 	}
-	if(rect->ymax > height) {
-		d= rect->ymax - height;
+	if (rect->ymax > height) {
+		d = rect->ymax - height;
 		rect->ymax -= d;
 		rect->ymin -= d;
 	}
 	
-	if(rect->xmin < 0) rect->xmin= 0;
-	if(rect->ymin < 0) rect->ymin= 0;
+	if (rect->xmin < 0) rect->xmin = 0;
+	if (rect->ymin < 0) rect->ymin = 0;
 }
 
 
 static void wm_ghostwindow_destroy(wmWindow *win) 
 {
-	if(win->ghostwin) {
+	if (win->ghostwin) {
 		GHOST_DisposeWindow(g_system, win->ghostwin);
-		win->ghostwin= NULL;
+		win->ghostwin = NULL;
 	}
 }
 
 /* including window itself, C can be NULL. 
-   ED_screen_exit should have been called */
+ * ED_screen_exit should have been called */
 void wm_window_free(bContext *C, wmWindowManager *wm, wmWindow *win)
 {
 	wmTimer *wt, *wtnext;
 	
 	/* update context */
-	if(C) {
+	if (C) {
 		WM_event_remove_handlers(C, &win->handlers);
 		WM_event_remove_handlers(C, &win->modalhandlers);
 
-		if(CTX_wm_window(C)==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) */
-	wm->windrawable= NULL;
-	wm->winactive= NULL;
+	/* always set drawable and active to NULL,
+	 * prevents non-drawable state of main windows (bugs #22967 and #25071, possibly #22477 too) */
+	wm->windrawable = NULL;
+	wm->winactive = NULL;
 
 	/* end running jobs, a job end also removes its timer */
-	for(wt= wm->timers.first; wt; wt= wtnext) {
-		wtnext= wt->next;
-		if(wt->win==win && wt->event_type==TIMERJOBS)
+	for (wt = wm->timers.first; wt; wt = wtnext) {
+		wtnext = wt->next;
+		if (wt->win == win && wt->event_type == TIMERJOBS)
 			wm_jobs_timer_ended(wm, wt);
 	}
 	
 	/* timer removing, need to call this api function */
-	for(wt= wm->timers.first; wt; wt=wtnext) {
-		wtnext= wt->next;
-		if(wt->win==win)
+	for (wt = wm->timers.first; wt; wt = wtnext) {
+		wtnext = wt->next;
+		if (wt->win == win)
 			WM_event_remove_timer(wm, win, wt);
 	}
 
-	if(win->eventstate) MEM_freeN(win->eventstate);
+	if (win->eventstate) MEM_freeN(win->eventstate);
 	
 	wm_event_free_all(win);
 	wm_subwindows_free(win);
 	
-	if(win->drawdata)
+	if (win->drawdata)
 		MEM_freeN(win->drawdata);
 	
 	wm_ghostwindow_destroy(win);
@@ -189,23 +201,23 @@ void wm_window_free(bContext *C, wmWindowManager *wm, wmWindow *win)
 static int find_free_winid(wmWindowManager *wm)
 {
 	wmWindow *win;
-	int id= 1;
+	int id = 1;
 	
-	for(win= wm->windows.first; win; win= win->next)
-		if(id <= win->winid)
-			id= win->winid+1;
+	for (win = wm->windows.first; win; win = win->next)
+		if (id <= win->winid)
+			id = win->winid + 1;
 	
 	return id;
 }
 
-/* dont change context itself */
+/* don't change context itself */
 wmWindow *wm_window_new(bContext *C)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
-	wmWindow *win= MEM_callocN(sizeof(wmWindow), "window");
+	wmWindowManager *wm = CTX_wm_manager(C);
+	wmWindow *win = MEM_callocN(sizeof(wmWindow), "window");
 	
 	BLI_addtail(&wm->windows, win);
-	win->winid= find_free_winid(wm);
+	win->winid = find_free_winid(wm);
 
 	return win;
 }
@@ -214,23 +226,23 @@ wmWindow *wm_window_new(bContext *C)
 /* part of wm_window.c api */
 wmWindow *wm_window_copy(bContext *C, wmWindow *winorig)
 {
-	wmWindow *win= wm_window_new(C);
+	wmWindow *win = wm_window_new(C);
 	
-	win->posx= winorig->posx+10;
-	win->posy= winorig->posy;
-	win->sizex= winorig->sizex;
-	win->sizey= winorig->sizey;
+	win->posx = winorig->posx + 10;
+	win->posy = winorig->posy;
+	win->sizex = winorig->sizex;
+	win->sizey = winorig->sizey;
 	
 	/* duplicate assigns to window */
-	win->screen= ED_screen_duplicate(win, winorig->screen);
-	BLI_strncpy(win->screenname, win->screen->id.name+2, sizeof(win->screenname));
-	win->screen->winid= win->winid;
+	win->screen = ED_screen_duplicate(win, winorig->screen);
+	BLI_strncpy(win->screenname, win->screen->id.name + 2, sizeof(win->screenname));
+	win->screen->winid = win->winid;
 
-	win->screen->do_refresh= 1;
-	win->screen->do_draw= 1;
+	win->screen->do_refresh = 1;
+	win->screen->do_draw = 1;
 
-	win->drawmethod= -1;
-	win->drawdata= NULL;
+	win->drawmethod = -1;
+	win->drawdata = NULL;
 	
 	return win;
 }
@@ -238,12 +250,29 @@ wmWindow *wm_window_copy(bContext *C, wmWindow *winorig)
 /* this is event from ghost, or exit-blender op */
 void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win)
 {
-	bScreen *screen= win->screen;
-	
+	wmWindow *tmpwin;
+	bScreen *screen = win->screen;
+	
+	/* first check if we have any non-temp remaining windows */
+	if ((U.uiflag & USER_QUIT_PROMPT) && !wm->file_saved) {
+		if (wm->windows.first) {
+			for (tmpwin = wm->windows.first; tmpwin; tmpwin = tmpwin->next) {
+				if (tmpwin == win)
+					continue;
+				if (tmpwin->screen->temp == 0)
+					break;
+			}
+			if (tmpwin == NULL) {
+				if (!GHOST_confirmQuit(win->ghostwin))
+					return;
+			}
+		}
+	}
+
 	BLI_remlink(&wm->windows, win);
 	
 	wm_draw_window_clear(win);
-	CTX_wm_window_set(C, win);	/* needed by handlers */
+	CTX_wm_window_set(C, win);  /* needed by handlers */
 	WM_event_remove_handlers(C, &win->handlers);
 	WM_event_remove_handlers(C, &win->modalhandlers);
 	ED_screen_exit(C, win, win->screen); 
@@ -251,18 +280,18 @@ void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win)
 	wm_window_free(C, wm, win);
 	
 	/* if temp screen, delete it after window free (it stops jobs that can access it) */
-	if(screen->temp) {
-		Main *bmain= CTX_data_main(C);
+	if (screen->temp) {
+		Main *bmain = CTX_data_main(C);
 		free_libblock(&bmain->screen, screen);
 	}
 	
 	/* check remaining windows */
-	if(wm->windows.first) {
-		for(win= wm->windows.first; win; win= win->next)
-			if(win->screen->temp == 0)
+	if (wm->windows.first) {
+		for (win = wm->windows.first; win; win = win->next)
+			if (win->screen->temp == 0)
 				break;
 		/* in this case we close all */
-		if(win==NULL)
+		if (win == NULL)
 			WM_exit(C);
 	}
 	else
@@ -272,29 +301,29 @@ void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win)
 void wm_window_title(wmWindowManager *wm, wmWindow *win)
 {
 	/* handle the 'temp' window, only set title when not set before */
-	if(win->screen && win->screen->temp) {
-		char *title= GHOST_GetTitle(win->ghostwin);
-		if(title==NULL || title[0]==0)
+	if (win->screen && win->screen->temp) {
+		char *title = GHOST_GetTitle(win->ghostwin);
+		if (title == NULL || title[0] == 0)
 			GHOST_SetTitle(win->ghostwin, "Blender");
 	}
 	else {
 		
 		/* this is set to 1 if you don't have startup.blend open */
-		if(G.save_over && G.main->name[0]) {
+		if (G.save_over && G.main->name[0]) {
 			char str[sizeof(G.main->name) + 12];
-			BLI_snprintf(str, sizeof(str), "Blender%s [%s]", wm->file_saved ? "":"*", G.main->name);
+			BLI_snprintf(str, sizeof(str), "Blender%s [%s]", wm->file_saved ? "" : "*", G.main->name);
 			GHOST_SetTitle(win->ghostwin, str);
 		}
 		else
 			GHOST_SetTitle(win->ghostwin, "Blender");
 
 		/* Informs GHOST of unsaved changes, to set window modified visual indicator (MAC OS X)
-		 and to give hint of unsaved changes for a user warning mechanism
-		 in case of OS application terminate request (e.g. OS Shortcut Alt+F4, Cmd+Q, (...), or session end) */
-		GHOST_SetWindowModifiedState(win->ghostwin, (GHOST_TUns8)!wm->file_saved);
+		 * and to give hint of unsaved changes for a user warning mechanism
+		 * in case of OS application terminate request (e.g. OS Shortcut Alt+F4, Cmd+Q, (...), or session end) */
+		GHOST_SetWindowModifiedState(win->ghostwin, (GHOST_TUns8) !wm->file_saved);
 		
 #if defined(__APPLE__) && !defined(GHOST_COCOA)
-		if(wm->file_saved)
+		if (wm->file_saved)
 			GHOST_SetWindowState(win->ghostwin, GHOST_kWindowStateUnModified);
 		else
 			GHOST_SetWindowState(win->ghostwin, GHOST_kWindowStateModified);
@@ -303,20 +332,13 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win)
 }
 
 /* belongs to below */
-static void wm_window_add_ghostwindow(bContext *C, const char *title, wmWindow *win)
+static void wm_window_add_ghostwindow(const char *title, wmWindow *win)
 {
 	GHOST_WindowHandle ghostwin;
 	int scr_w, scr_h, posy;
-	GHOST_TWindowState initial_state;
-
-	/* when there is no window open uses the initial state */
-	if(!CTX_wm_window(C))
-		initial_state= initialstate;
-	else
-		initial_state= GHOST_kWindowStateNormal;
 	
 	wm_get_screensize(&scr_w, &scr_h);
-	posy= (scr_h - win->posy - win->sizey);
+	posy = (scr_h - win->posy - win->sizey);
 	
 #if defined(__APPLE__) && !defined(GHOST_COCOA)
 	{
@@ -325,31 +347,31 @@ static void wm_window_add_ghostwindow(bContext *C, const char *title, wmWindow *
 	}
 #endif
 	/* Disable AA for now, as GL_SELECT (used for border, lasso, ... select)
-	 doesn't work well when AA is initialized, even if not used. */
-	ghostwin= GHOST_CreateWindow(g_system, title, 
-								 win->posx, posy, win->sizex, win->sizey, 
-								 initial_state, 
-								 GHOST_kDrawingContextTypeOpenGL,
-								 0 /* no stereo */,
-								 0 /* no AA */);
+	 * doesn't work well when AA is initialized, even if not used. */
+	ghostwin = GHOST_CreateWindow(g_system, title,
+	                              win->posx, posy, win->sizex, win->sizey,
+	                              (GHOST_TWindowState)win->windowstate,
+	                              GHOST_kDrawingContextTypeOpenGL,
+	                              0 /* no stereo */,
+	                              0 /* no AA */);
 	
 	if (ghostwin) {
 		/* needed so we can detect the graphics card below */
 		GPU_extensions_init();
 		
 		/* set the state*/
-		GHOST_SetWindowState(ghostwin, initial_state);
+		GHOST_SetWindowState(ghostwin, (GHOST_TWindowState)win->windowstate);
 
-		win->ghostwin= ghostwin;
-		GHOST_SetWindowUserData(ghostwin, win);	/* pointer back */
+		win->ghostwin = ghostwin;
+		GHOST_SetWindowUserData(ghostwin, win); /* pointer back */
 		
-		if(win->eventstate==NULL)
-			win->eventstate= MEM_callocN(sizeof(wmEvent), "window event state");
+		if (win->eventstate == NULL)
+			win->eventstate = MEM_callocN(sizeof(wmEvent), "window event state");
 		
 		/* until screens get drawn, make it nice grey */
 		glClearColor(.55, .55, .55, 0.0);
 		/* Crash on OSS ATI: bugs.launchpad.net/ubuntu/+source/mesa/+bug/656100 */
-		if(!GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE)) {
+		if (!GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE)) {
 			glClear(GL_COLOR_BUFFER_BIT);
 		}
 
@@ -367,7 +389,7 @@ static void wm_window_add_ghostwindow(bContext *C, const char *title, wmWindow *
 /* for wmWindows without ghostwin, open these and clear */
 /* window size is read from window, if 0 it uses prefsize */
 /* called in WM_check, also inits stuff after file read */
-void wm_window_add_ghostwindows(bContext* C, wmWindowManager *wm)
+void wm_window_add_ghostwindows(wmWindowManager *wm)
 {
 	wmKeyMap *keymap;
 	wmWindow *win;
@@ -376,52 +398,57 @@ void wm_window_add_ghostwindows(bContext* C, wmWindowManager *wm)
 	 * Note that these values will be used only
 	 * when there is no startup.blend yet.
 	 */
-	if (!prefsizx) {
-		wm_get_screensize(&prefsizx, &prefsizy);
+	if (wm_init_state.size_x == 0) {
+		wm_get_screensize(&wm_init_state.size_x, &wm_init_state.size_y);
 		
 #if defined(__APPLE__) && !defined(GHOST_COCOA)
 //Cocoa provides functions to get correct max window size
 		{
-			extern void wm_set_apple_prefsize(int, int);	/* wm_apple.c */
+			extern void wm_set_apple_prefsize(int, int);    /* wm_apple.c */
 			
-			wm_set_apple_prefsize(prefsizx, prefsizy);
+			wm_set_apple_prefsize(wm_init_state.size_x, wm_init_state.size_y);
 		}
 #else
-		prefstax= 0;
-		prefstay= 0;
+		wm_init_state.start_x = 0;
+		wm_init_state.start_y = 0;
 		
 #endif
 	}
 	
-	for(win= wm->windows.first; win; win= win->next) {
-		if(win->ghostwin==NULL) {
-			if(win->sizex==0 || useprefsize) {
-				win->posx= prefstax;
-				win->posy= prefstay;
-				win->sizex= prefsizx;
-				win->sizey= prefsizy;
-				win->windowstate= initialstate;
-				useprefsize= 0;
+	for (win = wm->windows.first; win; win = win->next) {
+		if (win->ghostwin == NULL) {
+			if ((win->sizex == 0) || (wm_init_state.override_flag & WIN_OVERRIDE_GEOM)) {
+				win->posx = wm_init_state.start_x;
+				win->posy = wm_init_state.start_y;
+				win->sizex = wm_init_state.size_x;
+				win->sizey = wm_init_state.size_y;
+				wm_init_state.override_flag &= ~WIN_OVERRIDE_GEOM;
 			}
-			wm_window_add_ghostwindow(C, "Blender", win);
+
+			if (wm_init_state.override_flag & WIN_OVERRIDE_WINSTATE) {
+				win->windowstate = wm_init_state.windowstate;
+				wm_init_state.override_flag &= ~WIN_OVERRIDE_WINSTATE;
+			}
+
+			wm_window_add_ghostwindow("Blender", win);
 		}
 		/* happens after fileread */
-		if(win->eventstate==NULL)
-			win->eventstate= MEM_callocN(sizeof(wmEvent), "window event state");
+		if (win->eventstate == NULL)
+			win->eventstate = MEM_callocN(sizeof(wmEvent), "window event state");
 
 		/* add keymap handlers (1 handler for all keys in map!) */
-		keymap= WM_keymap_find(wm->defaultconf, "Window", 0, 0);
+		keymap = WM_keymap_find(wm->defaultconf, "Window", 0, 0);
 		WM_event_add_keymap_handler(&win->handlers, keymap);
 		
-		keymap= WM_keymap_find(wm->defaultconf, "Screen", 0, 0);
+		keymap = WM_keymap_find(wm->defaultconf, "Screen", 0, 0);
 		WM_event_add_keymap_handler(&win->handlers, keymap);
 
-		keymap= WM_keymap_find(wm->defaultconf, "Screen Editing", 0, 0);
+		keymap = WM_keymap_find(wm->defaultconf, "Screen Editing", 0, 0);
 		WM_event_add_keymap_handler(&win->modalhandlers, keymap);
 		
 		/* add drop boxes */
 		{
-			ListBase *lb= WM_dropboxmap_find("Window", 0, 0);
+			ListBase *lb = WM_dropboxmap_find("Window", 0, 0);
 			WM_event_add_dropbox_handler(&win->handlers, lb);
 		}
 		wm_window_title(wm, win);
@@ -433,15 +460,15 @@ void wm_window_add_ghostwindows(bContext* C, wmWindowManager *wm)
 /* area-rip calls this */
 wmWindow *WM_window_open(bContext *C, rcti *rect)
 {
-	wmWindow *win= wm_window_new(C);
+	wmWindow *win = wm_window_new(C);
 	
-	win->posx= rect->xmin;
-	win->posy= rect->ymin;
-	win->sizex= rect->xmax - rect->xmin;
-	win->sizey= rect->ymax - rect->ymin;
+	win->posx = rect->xmin;
+	win->posy = rect->ymin;
+	win->sizex = rect->xmax - rect->xmin;
+	win->sizey = rect->ymax - rect->ymin;
 
-	win->drawmethod= -1;
-	win->drawdata= NULL;
+	win->drawmethod = -1;
+	win->drawdata = NULL;
 	
 	WM_check(C);
 	
@@ -449,7 +476,7 @@ wmWindow *WM_window_open(bContext *C, rcti *rect)
 }
 
 /* uses screen->temp tag to define what to do, currently it limits
-   to only one "temp" window for render out, preferences, filewindow, etc */
+ * to only one "temp" window for render out, preferences, filewindow, etc */
 /* type is #define in WM_api.h */
 
 void WM_window_open_temp(bContext *C, rcti *position, int type)
@@ -461,29 +488,29 @@ void WM_window_open_temp(bContext *C, rcti *position, int type)
 	wm_window_check_position(position);
 	
 	/* test if we have a temp screen already */
-	for(win= CTX_wm_manager(C)->windows.first; win; win= win->next)
-		if(win->screen->temp)
+	for (win = CTX_wm_manager(C)->windows.first; win; win = win->next)
+		if (win->screen->temp)
 			break;
 	
 	/* add new window? */
-	if(win==NULL) {
-		win= wm_window_new(C);
+	if (win == NULL) {
+		win = wm_window_new(C);
 		
-		win->posx= position->xmin;
-		win->posy= position->ymin;
+		win->posx = position->xmin;
+		win->posy = position->ymin;
 	}
 	
-	win->sizex= position->xmax - position->xmin;
-	win->sizey= position->ymax - position->ymin;
+	win->sizex = position->xmax - position->xmin;
+	win->sizey = position->ymax - position->ymin;
 	
-	if(win->ghostwin) {
-		wm_window_set_size(win, win->sizex, win->sizey) ;
+	if (win->ghostwin) {
+		wm_window_set_size(win, win->sizex, win->sizey);
 		wm_window_raise(win);
 	}
 	
 	/* add new screen? */
-	if(win->screen==NULL)
-		win->screen= ED_screen_add(win, CTX_data_scene(C), "temp");
+	if (win->screen == NULL)
+		win->screen = ED_screen_add(win, CTX_data_scene(C), "temp");
 	win->screen->temp = 1; 
 	
 	/* make window active, and validate/resize */
@@ -491,10 +518,10 @@ void WM_window_open_temp(bContext *C, rcti *position, int type)
 	WM_check(C);
 	
 	/* ensure it shows the right spacetype editor */
-	sa= win->screen->areabase.first;
+	sa = win->screen->areabase.first;
 	CTX_wm_area_set(C, sa);
 	
-	if(type==WM_WINDOW_RENDER) {
+	if (type == WM_WINDOW_RENDER) {
 		ED_area_newspace(C, sa, SPACE_IMAGE);
 	}
 	else {
@@ -503,11 +530,11 @@ void WM_window_open_temp(bContext *C, rcti *position, int type)
 	
 	ED_screen_set(C, win->screen);
 	
-	if(sa->spacetype==SPACE_IMAGE)
+	if (sa->spacetype == SPACE_IMAGE)
 		GHOST_SetTitle(win->ghostwin, IFACE_("Blender Render"));
-	else if(ELEM(sa->spacetype, SPACE_OUTLINER, SPACE_USERPREF))
+	else if (ELEM(sa->spacetype, SPACE_OUTLINER, SPACE_USERPREF))
 		GHOST_SetTitle(win->ghostwin, IFACE_("Blender User Preferences"));
-	else if(sa->spacetype==SPACE_FILE)
+	else if (sa->spacetype == SPACE_FILE)
 		GHOST_SetTitle(win->ghostwin, IFACE_("Blender File View"));
 	else
 		GHOST_SetTitle(win->ghostwin, "Blender");
@@ -522,7 +549,7 @@ int wm_window_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
 	wm_window_copy(C, CTX_wm_window(C));
 	WM_check(C);
 	
-	WM_event_add_notifier(C, NC_WINDOW|NA_ADDED, NULL);
+	WM_event_add_notifier(C, NC_WINDOW | NA_ADDED, NULL);
 	
 	return OPERATOR_FINISHED;
 }
@@ -531,14 +558,14 @@ int wm_window_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
 /* fullscreen operator callback */
 int wm_window_fullscreen_toggle_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	wmWindow *window= CTX_wm_window(C);
+	wmWindow *window = CTX_wm_window(C);
 	GHOST_TWindowState state;
 
-	if(G.background)
+	if (G.background)
 		return OPERATOR_CANCELLED;
 
-	state= GHOST_GetWindowState(window->ghostwin);
-	if(state!=GHOST_kWindowStateFullScreen)
+	state = GHOST_GetWindowState(window->ghostwin);
+	if (state != GHOST_kWindowStateFullScreen)
 		GHOST_SetWindowState(window->ghostwin, GHOST_kWindowStateFullScreen);
 	else
 		GHOST_SetWindowState(window->ghostwin, GHOST_kWindowStateNormal);
@@ -562,24 +589,24 @@ typedef enum
 static int query_qual(modifierKeyType qual) 
 {
 	GHOST_TModifierKeyMask left, right;
-	int val= 0;
+	int val = 0;
 	
-	switch(qual) {
+	switch (qual) {
 		case SHIFT:
-			left= GHOST_kModifierKeyLeftShift;
-			right= GHOST_kModifierKeyRightShift;
+			left = GHOST_kModifierKeyLeftShift;
+			right = GHOST_kModifierKeyRightShift;
 			break;
 		case CONTROL:
-			left= GHOST_kModifierKeyLeftControl;
-			right= GHOST_kModifierKeyRightControl;
+			left = GHOST_kModifierKeyLeftControl;
+			right = GHOST_kModifierKeyRightControl;
 			break;
 		case OS:
-			left= right= GHOST_kModifierKeyOS;
+			left = right = GHOST_kModifierKeyOS;
 			break;
 		case ALT:
 		default:
-			left= GHOST_kModifierKeyLeftAlt;
-			right= GHOST_kModifierKeyRightAlt;
+			left = GHOST_kModifierKeyLeftAlt;
+			right = GHOST_kModifierKeyRightAlt;
 			break;
 	}
 	
@@ -592,13 +619,15 @@ static int query_qual(modifierKeyType qual)
 
 void wm_window_make_drawable(bContext *C, wmWindow *win) 
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 
 	if (win != wm->windrawable && win->ghostwin) {
 //		win->lmbut= 0;	/* keeps hanging when mousepressed while other window opened */
 		
-		wm->windrawable= win;
-		if(G.f & G_DEBUG) printf("set drawable %d\n", win->winid);
+		wm->windrawable = win;
+		if (G.debug & G_DEBUG_EVENTS) {
+			printf("%s: set drawable %d\n", __func__, win->winid);
+		}
 		GHOST_ActivateWindowDrawingContext(win->ghostwin);
 	}
 }
@@ -606,16 +635,17 @@ void wm_window_make_drawable(bContext *C, wmWindow *win)
 /* called by ghost, here we handle events for windows themselves or send to event system */
 static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private) 
 {
-	bContext *C= private;
-	wmWindowManager *wm= CTX_wm_manager(C);
-	GHOST_TEventType type= GHOST_GetEventType(evt);
-	int time= GHOST_GetEventTime(evt);
+	bContext *C = private;
+	wmWindowManager *wm = CTX_wm_manager(C);
+	GHOST_TEventType type = GHOST_GetEventType(evt);
+	int time = GHOST_GetEventTime(evt);
 	
 	if (type == GHOST_kEventQuit) {
 		WM_exit(C);
-	} else {
-		GHOST_WindowHandle ghostwin= GHOST_GetEventWindow(evt);
-		GHOST_TEventDataPtr data= GHOST_GetEventData(evt);
+	}
+	else {
+		GHOST_WindowHandle ghostwin = GHOST_GetEventWindow(evt);
+		GHOST_TEventDataPtr data = GHOST_GetEventData(evt);
 		wmWindow *win;
 		
 		if (!ghostwin) {
@@ -623,60 +653,62 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
 			//	what is it?
 			puts("<!> event has no window");
 			return 1;
-		} else if (!GHOST_ValidWindow(g_system, ghostwin)) {
+		}
+		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");			
 			return 1;
-		} else {
-			win= GHOST_GetWindowUserData(ghostwin);
+		}
+		else {
+			win = GHOST_GetWindowUserData(ghostwin);
 		}
 		
-		switch(type) {
+		switch (type) {
 			case GHOST_kEventWindowDeactivate:
 				wm_event_add_ghostevent(wm, win, type, time, data);
-				win->active= 0; /* XXX */
+				win->active = 0; /* XXX */
 				break;
 			case GHOST_kEventWindowActivate: 
 			{
 				GHOST_TEventKeyData kdata;
 				int cx, cy, wx, wy;
 				
-				wm->winactive= win; /* no context change! c->wm->windrawable is drawable, or for area queues */
+				wm->winactive = win; /* no context change! c->wm->windrawable is drawable, or for area queues */
 				
-				win->active= 1;
+				win->active = 1;
 //				window_handle(win, INPUTCHANGE, win->active);
 				
 				/* bad ghost support for modifier keys... so on activate we set the modifiers again */
-				kdata.ascii= '\0';
-				kdata.utf8_buf[0]= '\0';
+				kdata.ascii = '\0';
+				kdata.utf8_buf[0] = '\0';
 				if (win->eventstate->shift && !query_qual(SHIFT)) {
-					kdata.key= GHOST_kKeyLeftShift;
+					kdata.key = GHOST_kKeyLeftShift;
 					wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata);
 				}
 				if (win->eventstate->ctrl && !query_qual(CONTROL)) {
-					kdata.key= GHOST_kKeyLeftControl;
+					kdata.key = GHOST_kKeyLeftControl;
 					wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata);
 				}
 				if (win->eventstate->alt && !query_qual(ALT)) {
-					kdata.key= GHOST_kKeyLeftAlt;
+					kdata.key = GHOST_kKeyLeftAlt;
 					wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata);
 				}
 				if (win->eventstate->oskey && !query_qual(OS)) {
-					kdata.key= GHOST_kKeyOS;
+					kdata.key = GHOST_kKeyOS;
 					wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata);
 				}
 				/* keymodifier zero, it hangs on hotkeys that open windows otherwise */
-				win->eventstate->keymodifier= 0;
+				win->eventstate->keymodifier = 0;
 				
 				/* entering window, update mouse pos. but no event */
 				GHOST_GetCursorPosition(g_system, &wx, &wy);
 				
 				GHOST_ScreenToClient(win->ghostwin, wx, wy, &cx, &cy);
-				win->eventstate->x= cx;
-				win->eventstate->y= (win->sizey-1) - cy;
+				win->eventstate->x = cx;
+				win->eventstate->y = (win->sizey - 1) - cy;
 				
-				win->addmousemove= 1;	/* enables highlighted buttons */
+				win->addmousemove = 1;   /* enables highlighted buttons */
 				
 				wm_window_make_drawable(C, win);
 				break;
@@ -686,7 +718,9 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
 				break;
 			}
 			case GHOST_kEventWindowUpdate: {
-				if(G.f & G_DEBUG) printf("ghost redraw\n");
+				if (G.debug & G_DEBUG_EVENTS) {
+					printf("%s: ghost redraw %d\n", __func__, win->winid);
+				}
 				
 				wm_window_make_drawable(C, win);
 				WM_event_add_notifier(C, NC_WINDOW, NULL);
@@ -697,23 +731,24 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
 			case GHOST_kEventWindowMove: {
 				GHOST_TWindowState state;
 				state = GHOST_GetWindowState(win->ghostwin);
+				win->windowstate = state;
 
-				 /* win32: gives undefined window size when minimized */
-				if(state!=GHOST_kWindowStateMinimized) {
+				/* win32: gives undefined window size when minimized */
+				if (state != GHOST_kWindowStateMinimized) {
 					GHOST_RectangleHandle client_rect;
 					int l, t, r, b, scr_w, scr_h;
 					int sizex, sizey, posx, posy;
 					
-					client_rect= GHOST_GetClientBounds(win->ghostwin);
+					client_rect = GHOST_GetClientBounds(win->ghostwin);
 					GHOST_GetRectangle(client_rect, &l, &t, &r, &b);
 					
 					GHOST_DisposeRectangle(client_rect);
 					
 					wm_get_screensize(&scr_w, &scr_h);
-					sizex= r-l;
-					sizey= b-t;
-					posx= l;
-					posy= scr_h - t - win->sizey;
+					sizex = r - l;
+					sizey = b - t;
+					posx = l;
+					posy = scr_h - t - win->sizey;
 
 					/*
 					 * Ghost sometimes send size or move events when the window hasn't changed.
@@ -724,42 +759,48 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
 					 * another time.
 					 */
 					if (win->sizex != sizex ||
-							win->sizey != sizey ||
-							win->posx != posx ||
-							win->posy != posy)
+					    win->sizey != sizey ||
+					    win->posx != posx ||
+					    win->posy != posy)
 					{
-						win->sizex= sizex;
-						win->sizey= sizey;
-						win->posx= posx;
-						win->posy= posy;
+						win->sizex = sizex;
+						win->sizey = sizey;
+						win->posx = posx;
+						win->posy = posy;
 
 						/* debug prints */
-						if(0) {
+						if (G.debug & G_DEBUG_EVENTS) {
+							const char *state_str;
 							state = GHOST_GetWindowState(win->ghostwin);
-	
-							if(state==GHOST_kWindowStateNormal) {
-								if(G.f & G_DEBUG) printf("window state: normal\n");
+
+							if (state == GHOST_kWindowStateNormal) {
+								state_str = "normal";
+							}
+							else if (state == GHOST_kWindowStateMinimized) {
+								state_str = "minimized";
 							}
-							else if(state==GHOST_kWindowStateMinimized) {
-								if(G.f & G_DEBUG) printf("window state: minimized\n");
+							else if (state == GHOST_kWindowStateMaximized) {
+								state_str = "maximized";
 							}
-							else if(state==GHOST_kWindowStateMaximized) {
-								if(G.f & G_DEBUG) printf("window state: maximized\n");
+							else if (state == GHOST_kWindowStateFullScreen) {
+								state_str = "fullscreen";
 							}
-							else if(state==GHOST_kWindowStateFullScreen) {
-								if(G.f & G_DEBUG) printf("window state: fullscreen\n");
+							else {
+								state_str = "<unknown>";
 							}
-							
-							if(type!=GHOST_kEventWindowSize) {
-								if(G.f & G_DEBUG) printf("win move event pos %d %d size %d %d\n", win->posx, win->posy, win->sizex, win->sizey);
+
+							printf("%s: window %d state = %s\n", __func__, win->winid, state_str);
+
+							if (type != GHOST_kEventWindowSize) {
+								printf("win move event pos %d %d size %d %d\n",
+								       win->posx, win->posy, win->sizex, win->sizey);
 							}
-							
 						}
 					
 						wm_window_make_drawable(C, win);
 						wm_draw_window_clear(win);
-						WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
-						WM_event_add_notifier(C, NC_WINDOW|NA_EDITED, NULL);
+						WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
+						WM_event_add_notifier(C, NC_WINDOW | NA_EDITED, NULL);
 					}
 				}
 				break;
@@ -773,7 +814,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
 				
 				if (path) {
 					/* operator needs a valid window in context, ensures
-					 it is correctly set */
+					 * it is correctly set */
 					oldWindow = CTX_wm_window(C);
 					CTX_wm_window_set(C, win);
 					
@@ -789,35 +830,35 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
 			case GHOST_kEventDraggingDropDone:
 			{
 				wmEvent event;
-				GHOST_TEventDragnDropData *ddd= GHOST_GetEventData(evt);
+				GHOST_TEventDragnDropData *ddd = GHOST_GetEventData(evt);
 				int cx, cy, wx, wy;
 				
 				/* entering window, update mouse pos */
 				GHOST_GetCursorPosition(g_system, &wx, &wy);
 				
 				GHOST_ScreenToClient(win->ghostwin, wx, wy, &cx, &cy);
-				win->eventstate->x= cx;
-				win->eventstate->y= (win->sizey-1) - cy;
+				win->eventstate->x = cx;
+				win->eventstate->y = (win->sizey - 1) - cy;
 				
-				event= *(win->eventstate);	/* copy last state, like mouse coords */
+				event = *(win->eventstate);  /* copy last state, like mouse coords */
 				
 				// activate region
-				event.type= MOUSEMOVE;
-				event.prevx= event.x;
-				event.prevy= event.y;
+				event.type = MOUSEMOVE;
+				event.prevx = event.x;
+				event.prevy = event.y;
 				
-				wm->winactive= win; /* no context change! c->wm->windrawable is drawable, or for area queues */
-				win->active= 1;
+				wm->winactive = win; /* no context change! c->wm->windrawable is drawable, or for area queues */
+				win->active = 1;
 				
 				wm_event_add(win, &event);
 				
 				
 				/* make blender drop event with custom data pointing to wm drags */
-				event.type= EVT_DROP;
-				event.val= KM_RELEASE;
-				event.custom= EVT_DATA_LISTBASE;
-				event.customdata= &wm->drags;
-				event.customdatafree= 1;
+				event.type = EVT_DROP;
+				event.val = KM_RELEASE;
+				event.custom = EVT_DATA_LISTBASE;
+				event.customdata = &wm->drags;
+				event.customdatafree = 1;
 				
 				wm_event_add(win, &event);
 				
@@ -825,14 +866,14 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
 				
 				/* add drag data to wm for paths: */
 				
-				if(ddd->dataType == GHOST_kDragnDropTypeFilenames) {
-					GHOST_TStringArray *stra= ddd->data;
+				if (ddd->dataType == GHOST_kDragnDropTypeFilenames) {
+					GHOST_TStringArray *stra = ddd->data;
 					int a, icon;
 					
-					for(a=0; a<stra->count; a++) {
+					for (a = 0; a < stra->count; a++) {
 						printf("drop file %s\n", stra->strings[a]);
 						/* try to get icon type from extension */
-						icon= ED_file_extension_icon((char *)stra->strings[a]);
+						icon = ED_file_extension_icon((char *)stra->strings[a]);
 						
 						WM_event_start_drag(C, icon, WM_DRAG_PATH, stra->strings[a], 0.0);
 						/* void poin should point to string, it makes a copy */
@@ -856,43 +897,43 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
 
 
 /* This timer system only gives maximum 1 timer event per redraw cycle,
-   to prevent queues to get overloaded. 
-   Timer handlers should check for delta to decide if they just
-   update, or follow real time.
-   Timer handlers can also set duration to match frames passed
-*/
+ * to prevent queues to get overloaded.
+ * Timer handlers should check for delta to decide if they just
+ * update, or follow real time.
+ * Timer handlers can also set duration to match frames passed
+ */
 static int wm_window_timer(const bContext *C)
 {
-	wmWindowManager *wm= CTX_wm_manager(C);
+	wmWindowManager *wm = CTX_wm_manager(C);
 	wmTimer *wt, *wtnext;
 	wmWindow *win;
-	double time= PIL_check_seconds_timer();
-	int retval= 0;
+	double time = PIL_check_seconds_timer();
+	int retval = 0;
 	
-	for(wt= wm->timers.first; wt; wt= wtnext) {
-		wtnext= wt->next; /* in case timer gets removed */
-		win= wt->win;
+	for (wt = wm->timers.first; wt; wt = wtnext) {
+		wtnext = wt->next; /* in case timer gets removed */
+		win = wt->win;
 
-		if(wt->sleep==0) {
-			if(time > wt->ntime) {
-				wt->delta= time - wt->ltime;
+		if (wt->sleep== 0) {
+			if (time > wt->ntime) {
+				wt->delta = time - wt->ltime;
 				wt->duration += wt->delta;
-				wt->ltime= time;
-				wt->ntime= wt->stime + wt->timestep*ceil(wt->duration/wt->timestep);
+				wt->ltime = time;
+				wt->ntime = wt->stime + wt->timestep *ceil(wt->duration / wt->timestep);
 
-				if(wt->event_type == TIMERJOBS)
+				if (wt->event_type == TIMERJOBS)
 					wm_jobs_timer(C, wm, wt);
-				else if(wt->event_type == TIMERAUTOSAVE)
+				else if (wt->event_type == TIMERAUTOSAVE)
 					wm_autosave_timer(C, wm, wt);
-				else if(win) {
-					wmEvent event= *(win->eventstate);
+				else if (win) {
+					wmEvent event = *(win->eventstate);
 					
-					event.type= wt->event_type;
-					event.custom= EVT_DATA_TIMER;
-					event.customdata= wt;
+					event.type = wt->event_type;
+					event.custom = EVT_DATA_TIMER;
+					event.customdata = wt;
 					wm_event_add(win, &event);
 
-					retval= 1;
+					retval = 1;
 				}
 			}
 		}
@@ -902,40 +943,40 @@ static int wm_window_timer(const bContext *C)
 
 void wm_window_process_events(const bContext *C) 
 {
-	int hasevent= GHOST_ProcessEvents(g_system, 0);	/* 0 is no wait */
+	int hasevent = GHOST_ProcessEvents(g_system, 0); /* 0 is no wait */
 	
-	if(hasevent)
+	if (hasevent)
 		GHOST_DispatchEvents(g_system);
 	
 	hasevent |= wm_window_timer(C);
 
 	/* no event, we sleep 5 milliseconds */
-	if(hasevent==0)
+	if (hasevent == 0)
 		PIL_sleep_ms(5);
 }
 
 void wm_window_process_events_nosleep(void) 
 {
-	if(GHOST_ProcessEvents(g_system, 0))
+	if (GHOST_ProcessEvents(g_system, 0))
 		GHOST_DispatchEvents(g_system);
 }
 
 /* exported as handle callback to bke blender.c */
 void wm_window_testbreak(void)
 {
-	static double ltime= 0;
-	double curtime= PIL_check_seconds_timer();
+	static double ltime = 0;
+	double curtime = PIL_check_seconds_timer();
 	
 	/* only check for breaks every 50 milliseconds
-		* if we get called more often.
-		*/
-	if ((curtime-ltime)>.05) {
-		int hasevent= GHOST_ProcessEvents(g_system, 0);	/* 0 is no wait */
+	 * if we get called more often.
+	 */
+	if ((curtime - ltime) > .05) {
+		int hasevent = GHOST_ProcessEvents(g_system, 0); /* 0 is no wait */
 		
-		if(hasevent)
+		if (hasevent)
 			GHOST_DispatchEvents(g_system);
 		
-		ltime= curtime;
+		ltime = curtime;
 	}
 }
 
@@ -944,19 +985,19 @@ void wm_window_testbreak(void)
 void wm_ghost_init(bContext *C)
 {
 	if (!g_system) {
-		GHOST_EventConsumerHandle consumer= GHOST_CreateEventConsumer(ghost_event_proc, C);
+		GHOST_EventConsumerHandle consumer = GHOST_CreateEventConsumer(ghost_event_proc, C);
 		
-		g_system= GHOST_CreateSystem();
+		g_system = GHOST_CreateSystem();
 		GHOST_AddEventConsumer(g_system, consumer);
 	}	
 }
 
 void wm_ghost_exit(void)
 {
-	if(g_system)
+	if (g_system)
 		GHOST_DisposeSystem(g_system);
 
-	g_system= NULL;
+	g_system = NULL;
 }
 
 /* **************** timer ********************** */
@@ -966,24 +1007,24 @@ void WM_event_timer_sleep(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *t
 {
 	wmTimer *wt;
 	
-	for(wt= wm->timers.first; wt; wt= wt->next)
-		if(wt==timer)
+	for (wt = wm->timers.first; wt; wt = wt->next)
+		if (wt == timer)
 			break;
 
-	if(wt)
-		wt->sleep= dosleep;
+	if (wt)
+		wt->sleep = dosleep;
 }
 
 wmTimer *WM_event_add_timer(wmWindowManager *wm, wmWindow *win, int event_type, double timestep)
 {
-	wmTimer *wt= MEM_callocN(sizeof(wmTimer), "window timer");
+	wmTimer *wt = MEM_callocN(sizeof(wmTimer), "window timer");
 	
-	wt->event_type= event_type;
-	wt->ltime= PIL_check_seconds_timer();
-	wt->ntime= wt->ltime + timestep;
-	wt->stime= wt->ltime;
-	wt->timestep= timestep;
-	wt->win= win;
+	wt->event_type = event_type;
+	wt->ltime = PIL_check_seconds_timer();
+	wt->ntime = wt->ltime + timestep;
+	wt->stime = wt->ltime;
+	wt->timestep = timestep;
+	wt->win = win;
 	
 	BLI_addtail(&wm->timers, wt);
 	
@@ -995,15 +1036,15 @@ void WM_event_remove_timer(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *
 	wmTimer *wt;
 	
 	/* extra security check */
-	for(wt= wm->timers.first; wt; wt= wt->next)
-		if(wt==timer)
+	for (wt = wm->timers.first; wt; wt = wt->next)
+		if (wt == timer)
 			break;
-	if(wt) {
-		if(wm->reports.reporttimer == wt)
-			wm->reports.reporttimer= NULL;
+	if (wt) {
+		if (wm->reports.reporttimer == wt)
+			wm->reports.reporttimer = NULL;
 		
 		BLI_remlink(&wm->timers, wt);
-		if(wt->customdata)
+		if (wt->customdata)
 			MEM_freeN(wt->customdata);
 		MEM_freeN(wt);
 	}
@@ -1015,21 +1056,21 @@ char *WM_clipboard_text_get(int selection)
 {
 	char *p, *p2, *buf, *newbuf;
 
-	if(G.background)
+	if (G.background)
 		return NULL;
 
-	buf= (char*)GHOST_getClipboard(selection);
-	if(!buf)
+	buf = (char *)GHOST_getClipboard(selection);
+	if (!buf)
 		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, "WM_clipboard_text_get");
 
-	for(p= buf, p2= newbuf; *p; p++) {
-		if(*p != '\r')
-			*(p2++)= *p;
+	for (p = buf, p2 = newbuf; *p; p++) {
+		if (*p != '\r')
+			*(p2++) = *p;
 	}
-	*p2= '\0';
+	*p2 = '\0';
 
 	free(buf); /* ghost uses regular malloc */
 	
@@ -1038,33 +1079,33 @@ char *WM_clipboard_text_get(int selection)
 
 void WM_clipboard_text_set(char *buf, int selection)
 {
-	if(!G.background) {
+	if (!G.background) {
 #ifdef _WIN32
 		/* do conversion from \n to \r\n on Windows */
 		char *p, *p2, *newbuf;
-		int newlen= 0;
+		int newlen = 0;
 		
-		for(p= buf; *p; p++) {
-			if(*p == '\n')
+		for (p = buf; *p; p++) {
+			if (*p == '\n')
 				newlen += 2;
 			else
 				newlen++;
 		}
 		
-		newbuf= MEM_callocN(newlen+1, "WM_clipboard_text_set");
+		newbuf = MEM_callocN(newlen + 1, "WM_clipboard_text_set");
 	
-		for(p= buf, p2= newbuf; *p; p++, p2++) {
-			if(*p == '\n') { 
-				*(p2++)= '\r'; *p2= '\n';
+		for (p = buf, p2 = newbuf; *p; p++, p2++) {
+			if (*p == '\n') {
+				*(p2++) = '\r'; *p2 = '\n';
 			}
-			else *p2= *p;
+			else *p2 = *p;
 		}
-		*p2= '\0';
+		*p2 = '\0';
 	
-		GHOST_putClipboard((GHOST_TInt8*)newbuf, selection);
+		GHOST_putClipboard((GHOST_TInt8 *)newbuf, selection);
 		MEM_freeN(newbuf);
 #else
-		GHOST_putClipboard((GHOST_TInt8*)buf, selection);
+		GHOST_putClipboard((GHOST_TInt8 *)buf, selection);
 #endif
 	}
 }
@@ -1085,23 +1126,23 @@ void WM_progress_clear(wmWindow *win)
 
 void wm_window_get_position(wmWindow *win, int *posx_r, int *posy_r) 
 {
-	*posx_r= win->posx;
-	*posy_r= win->posy;
+	*posx_r = win->posx;
+	*posy_r = win->posy;
 }
 
 void wm_window_get_size(wmWindow *win, int *width_r, int *height_r) 
 {
-	*width_r= win->sizex;
-	*height_r= win->sizey;
+	*width_r = win->sizex;
+	*height_r = win->sizey;
 }
 
 /* exceptional case: - splash is called before events are processed
- * this means we dont actually know the window size so get this from GHOST */
+ * this means we don't actually know the window size so get this from GHOST */
 void wm_window_get_size_ghost(wmWindow *win, int *width_r, int *height_r)
 {
-	GHOST_RectangleHandle bounds= GHOST_GetClientBounds(win->ghostwin);
-	*width_r= GHOST_GetWidthRectangle(bounds);
-	*height_r= GHOST_GetHeightRectangle(bounds);
+	GHOST_RectangleHandle bounds = GHOST_GetClientBounds(win->ghostwin);
+	*width_r = GHOST_GetWidthRectangle(bounds);
+	*height_r = GHOST_GetHeightRectangle(bounds);
 	
 	GHOST_DisposeRectangle(bounds);
 }
@@ -1137,7 +1178,7 @@ void wm_get_cursor_position(wmWindow *win, int *x, int *y)
 {
 	GHOST_GetCursorPosition(g_system, x, y);
 	GHOST_ScreenToClient(win->ghostwin, *x, *y, x, y);
-	*y = (win->sizey-1) - *y;
+	*y = (win->sizey - 1) - *y;
 }
 
 /* ******************* exported api ***************** */
@@ -1146,37 +1187,39 @@ void wm_get_cursor_position(wmWindow *win, int *x, int *y)
 /* called whem no ghost system was initialized */
 void WM_setprefsize(int stax, int stay, int sizx, int sizy)
 {
-	prefstax= stax;
-	prefstay= stay;
-	prefsizx= sizx;
-	prefsizy= sizy;
-	useprefsize= 1;
+	wm_init_state.start_x = stax; /* left hand pos */
+	wm_init_state.start_y = stay; /* bottom pos */
+	wm_init_state.size_x = sizx;
+	wm_init_state.size_y = sizy;
+	wm_init_state.override_flag |= WIN_OVERRIDE_GEOM;
 }
 
 /* for borderless and border windows set from command-line */
 void WM_setinitialstate_fullscreen(void)
 {
-	initialstate= GHOST_kWindowStateFullScreen;
+	wm_init_state.windowstate = GHOST_kWindowStateFullScreen;
+	wm_init_state.override_flag |= WIN_OVERRIDE_WINSTATE;
 }
 
 void WM_setinitialstate_normal(void)
 {
-	initialstate= GHOST_kWindowStateNormal;
+	wm_init_state.windowstate = GHOST_kWindowStateNormal;
+	wm_init_state.override_flag |= WIN_OVERRIDE_WINSTATE;
 }
 
 /* This function requires access to the GHOST_SystemHandle (g_system) */
 void WM_cursor_warp(wmWindow *win, int x, int y)
 {
 	if (win && win->ghostwin) {
-		int oldx=x, oldy=y;
+		int oldx = x, oldy = y;
 
-		y= win->sizey -y - 1;
+		y = win->sizey - y - 1;
 
 		GHOST_ClientToScreen(win->ghostwin, x, y, &x, &y);
 		GHOST_SetCursorPosition(g_system, x, y);
 
-		win->eventstate->prevx= oldx;
-		win->eventstate->prevy= oldy;
+		win->eventstate->prevx = oldx;
+		win->eventstate->prevy = oldy;
 	}
 }
 
diff --git a/source/blender/windowmanager/wm.h b/source/blender/windowmanager/wm.h
index d9dcb9e..aa246c9 100644
--- a/source/blender/windowmanager/wm.h
+++ b/source/blender/windowmanager/wm.h
@@ -28,8 +28,8 @@
  *  \ingroup wm
  */
 
-#ifndef WM_H
-#define WM_H
+#ifndef __WM_H__
+#define __WM_H__
 
 struct wmWindow;
 struct ReportList;
@@ -52,8 +52,6 @@ extern void wm_clear_default_size(bContext *C);
 			/* register to windowmanager for redo or macro */
 void		wm_operator_register(bContext *C, wmOperator *op);
 
-extern void wm_report_free(wmReport *report);
-
 /* wm_operator.c, for init/exit */
 void wm_operatortype_free(void);
 void wm_operatortype_init(void);
@@ -85,5 +83,5 @@ void wm_autosave_location(char *filepath);
 extern int circle_select_size;
 #endif
 
-#endif /* WM_H */
+#endif /* __WM_H__ */
 
diff --git a/source/blender/windowmanager/wm_cursors.h b/source/blender/windowmanager/wm_cursors.h
index c179483..f41b15a 100644
--- a/source/blender/windowmanager/wm_cursors.h
+++ b/source/blender/windowmanager/wm_cursors.h
@@ -32,8 +32,8 @@
 
 
 
-#ifndef WM_CURSORS_H
-#define WM_CURSORS_H
+#ifndef __WM_CURSORS_H__
+#define __WM_CURSORS_H__
 
 void wm_init_cursor_data(void);
 
@@ -120,5 +120,5 @@ struct wmEvent;
 int wm_cursor_arrow_move(struct wmWindow *win, struct wmEvent *event);
 
 
-#endif /* WM_CURSORS_H */
+#endif /* __WM_CURSORS_H__ */
 
diff --git a/source/blender/windowmanager/wm_draw.h b/source/blender/windowmanager/wm_draw.h
index 9e22fc8..3d72fe1 100644
--- a/source/blender/windowmanager/wm_draw.h
+++ b/source/blender/windowmanager/wm_draw.h
@@ -29,8 +29,8 @@
  */
 
 
-#ifndef WM_DRAW_H
-#define WM_DRAW_H
+#ifndef __WM_DRAW_H__
+#define __WM_DRAW_H__
 
 struct bContext;
 struct wmWindow;
@@ -43,5 +43,5 @@ void		wm_draw_region_clear	(struct wmWindow *win, struct ARegion *ar);
 
 void		wm_tag_redraw_overlay	(struct wmWindow *win, struct ARegion *ar);
 
-#endif /* WM_DRAW_H */
+#endif /* __WM_DRAW_H__ */
 
diff --git a/source/blender/windowmanager/wm_event_system.h b/source/blender/windowmanager/wm_event_system.h
index 9c0d2ae..a33d37a 100644
--- a/source/blender/windowmanager/wm_event_system.h
+++ b/source/blender/windowmanager/wm_event_system.h
@@ -28,8 +28,8 @@
  *  \ingroup wm
  */
 
-#ifndef WM_EVENT_SYSTEM_H
-#define WM_EVENT_SYSTEM_H
+#ifndef __WM_EVENT_SYSTEM_H__
+#define __WM_EVENT_SYSTEM_H__
 
 /* return value of handler-operator call */
 #define WM_HANDLER_CONTINUE	0
@@ -107,5 +107,5 @@ 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 */
+#endif /* __WM_EVENT_SYSTEM_H__ */
 
diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h
index 47081b6..30f6c56 100644
--- a/source/blender/windowmanager/wm_event_types.h
+++ b/source/blender/windowmanager/wm_event_types.h
@@ -35,8 +35,8 @@
  */ 
 
 
-#ifndef WM_EVENT_TYPES_H
-#define WM_EVENT_TYPES_H
+#ifndef __WM_EVENT_TYPES_H__
+#define __WM_EVENT_TYPES_H__
 
 /* customdata type */
 #define EVT_DATA_TABLET		1
@@ -78,8 +78,8 @@
 
 
 /* NDOF (from SpaceNavigator & friends)
-   These should be kept in sync with GHOST_NDOFManager.h
-   Ordering matters, exact values do not. */
+ * These should be kept in sync with GHOST_NDOFManager.h
+ * Ordering matters, exact values do not. */
 
 #define NDOF_MOTION 400
 
@@ -112,6 +112,11 @@ enum {
 	NDOF_BUTTON_DOMINANT,
 	NDOF_BUTTON_PLUS,
 	NDOF_BUTTON_MINUS,
+	// keyboard emulation
+	NDOF_BUTTON_ESC,
+	NDOF_BUTTON_ALT,
+	NDOF_BUTTON_SHIFT,
+	NDOF_BUTTON_CTRL,
 	// general-purpose buttons
 	NDOF_BUTTON_1,
 	NDOF_BUTTON_2,
@@ -123,6 +128,11 @@ enum {
 	NDOF_BUTTON_8,
 	NDOF_BUTTON_9,
 	NDOF_BUTTON_10,
+	// more general-purpose buttons
+	NDOF_BUTTON_A,
+	NDOF_BUTTON_B,
+	NDOF_BUTTON_C,
+	// the end
 	NDOF_LAST
 	};
 
@@ -365,5 +375,5 @@ enum {
 #define GESTURE_MODAL_OUT			10
 
 
-#endif	/* WM_EVENT_TYPES_H */
+#endif	/* __WM_EVENT_TYPES_H__ */
 
diff --git a/source/blender/windowmanager/wm_files.h b/source/blender/windowmanager/wm_files.h
index 64f05e7..f373530 100644
--- a/source/blender/windowmanager/wm_files.h
+++ b/source/blender/windowmanager/wm_files.h
@@ -28,10 +28,10 @@
  *  \ingroup wm
  */
 
-#ifndef WM_FILES_H
-#define WM_FILES_H
+#ifndef __WM_FILES_H__
+#define __WM_FILES_H__
 
 void WM_read_history(void);
 
-#endif /* WM_FILES_H */
+#endif /* __WM_FILES_H__ */
 
diff --git a/source/blender/windowmanager/wm_subwindow.h b/source/blender/windowmanager/wm_subwindow.h
index 6fecefe..5017977 100644
--- a/source/blender/windowmanager/wm_subwindow.h
+++ b/source/blender/windowmanager/wm_subwindow.h
@@ -29,8 +29,8 @@
  */
 
 
-#ifndef WM_SUBWINDOW_H
-#define WM_SUBWINDOW_H
+#ifndef __WM_SUBWINDOW_H__
+#define __WM_SUBWINDOW_H__
 
 
 /* *************** internal api ************** */
@@ -50,5 +50,5 @@ void	wm_subwindow_getmatrix(wmWindow *win, int swinid, float mat[][4]);
 
 unsigned int index_to_framebuffer(int index);
 
-#endif /* WM_SUBWINDOW_H */
+#endif /* __WM_SUBWINDOW_H__ */
 
diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h
index ec6d815..6fd4ced 100644
--- a/source/blender/windowmanager/wm_window.h
+++ b/source/blender/windowmanager/wm_window.h
@@ -29,8 +29,8 @@
  */
 
 
-#ifndef WM_WINDOW_H
-#define WM_WINDOW_H
+#ifndef __WM_WINDOW_H__
+#define __WM_WINDOW_H__
 
 struct bScreen;
 struct wmOperator;
@@ -46,7 +46,7 @@ void		wm_window_free			(bContext *C, wmWindowManager *wm, wmWindow *win);
 void		wm_window_close			(bContext *C, wmWindowManager *wm, wmWindow *win);
 
 void		wm_window_title				(wmWindowManager *wm, wmWindow *win);
-void		wm_window_add_ghostwindows	(bContext *C, wmWindowManager *wm);
+void		wm_window_add_ghostwindows	(wmWindowManager *wm);
 void		wm_window_process_events	(const bContext *C);
 void		wm_window_process_events_nosleep(void);
 
@@ -70,5 +70,5 @@ void		wm_window_testbreak		(void);
 int			wm_window_duplicate_exec(bContext *C, struct wmOperator *op);
 int			wm_window_fullscreen_toggle_exec(bContext *C, struct wmOperator *op);
 
-#endif /* WM_WINDOW_H */
+#endif /* __WM_WINDOW_H__ */
 
diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt
index 223df9c..7edf531 100644
--- a/source/blenderplayer/CMakeLists.txt
+++ b/source/blenderplayer/CMakeLists.txt
@@ -100,6 +100,7 @@ endif()
 		bf_intern_string 
 		bf_intern_ghost
 		bf_rna
+		bf_bmesh
 		bf_blenkernel
 		bf_blenloader 
 		bf_blenpluginapi 
@@ -133,7 +134,9 @@ endif()
 		bf_intern_memutil 
 		bf_python_ext
 		bf_python_mathutils
+		bf_python_bmesh
 		bf_blenlib 
+		bf_intern_utfconv
 		bf_imbuf_cineon
 		bf_imbuf_openexr 
 		extern_openjpeg
@@ -144,6 +147,7 @@ endif()
 		bf_blenfont
 		bf_intern_audaspace
 		blenkernel_blc
+		bf_bmesh
 		extern_binreloc
 		extern_minilzo
 		bf_intern_ghost # duplicate for linking
@@ -184,6 +188,10 @@ endif()
 		list(APPEND BLENDER_SORTED_LIBS extern_carve)
 	endif()
 
+	if(WITH_GHOST_XDND)
+		list(APPEND BLENDER_SORTED_LIBS extern_xdnd)
+	endif()
+
 	if(WITH_CODEC_QUICKTIME)
 		list(APPEND BLENDER_SORTED_LIBS bf_quicktime)
 	endif()
diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c
index ea551e4..90d490d 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -38,32 +38,33 @@
 
 struct ARegion;
 struct ARegionType;
+struct BMEditMesh;
 struct Base;
 struct Brush;
-struct bNodeTree;
-struct bNodeSocket;
 struct CSG_FaceIteratorDescriptor;
 struct CSG_VertexIteratorDescriptor;
+struct ChannelDriver;
 struct ColorBand;
-struct CurveMapping;
+struct Context;
 struct Curve;
+struct CurveMapping;
 struct DerivedMesh;
 struct EditBone;
-struct EditFace;
-struct EditMesh;
 struct EnvMap;
-struct ID;
 struct FCurve;
+struct Heap;
+struct HeapNode;
+struct ID;
 struct ImBuf;
 struct Image;
 struct ImageUser;
-struct KeyingSetInfo;
 struct KeyingSet;
+struct KeyingSetInfo;
 struct LOD_Decimation_Info;
+struct MCol;
 struct MTex;
 struct Main;
 struct Material;
-struct MCol;
 struct MenuType;
 struct Mesh;
 struct ModifierData;
@@ -79,21 +80,32 @@ struct RenderEngineType;
 struct RenderLayer;
 struct RenderResult;
 struct Scene;
+struct Scene;
 struct ScrArea;
 struct SculptSession;
 struct ShadeInput;
 struct ShadeResult;
+struct SmallHash;
+struct SmallHashIter;
 struct SpaceClip;
 struct SpaceImage;
 struct SpaceNode;
 struct Tex;
 struct TexResult;
 struct Text;
+struct ToolSettings;
+struct View3D;
 struct bAction;
 struct bArmature;
 struct bConstraint;
+struct bConstraintOb;
+struct bConstraintTarget;
+struct bContextDataResult;
 struct bNode;
+struct bNodeSocket;
+struct bNodeTree;
 struct bPoseChannel;
+struct bPythonConstraint;
 struct uiLayout;
 struct wmEvent;
 struct wmKeyConfig;
@@ -101,16 +113,33 @@ struct wmKeyMap;
 struct wmOperator;
 struct wmWindow;
 struct wmWindowManager;
-struct View3D;
-struct ToolSettings;
-struct bContextDataResult;
-struct bConstraintTarget;
-struct bPythonConstraint;
-struct bConstraintOb;
-struct Context;
-struct ChannelDriver;
 
 /*new render funcs */
+void EDBM_selectmode_set(struct BMEditMesh *em) {}
+void EDBM_mesh_load(struct Object *ob) {}
+void EDBM_mesh_make(struct ToolSettings *ts, struct Scene *scene, struct Object *ob) {}
+void EDBM_mesh_normals_update(struct BMEditMesh *em) {}
+void *g_system;
+
+struct Heap* BLI_heap_new (void){return NULL;}
+void BLI_heap_free (struct Heap *heap, void *ptrfreefp) {}
+struct HeapNode* BLI_heap_insert (struct Heap *heap, float value, void *ptr){return NULL;}
+void BLI_heap_remove (struct Heap *heap, struct HeapNode *node) {}
+int BLI_heap_empty (struct Heap *heap) {return 0;}
+int BLI_heap_size (struct Heap *heap){return 0;}
+struct HeapNode* BLI_heap_top (struct Heap *heap){return NULL;}
+void* BLI_heap_popmin (struct Heap *heap){return NULL;}
+
+void BLI_smallhash_init(struct SmallHash *hash) {}
+void BLI_smallhash_release(struct SmallHash *hash) {}
+void BLI_smallhash_insert(struct SmallHash *hash, uintptr_t key, void *item) {}
+void BLI_smallhash_remove(struct SmallHash *hash, uintptr_t key) {}
+void *BLI_smallhash_lookup(struct SmallHash *hash, uintptr_t key) { return NULL; }
+int BLI_smallhash_haskey(struct SmallHash *hash, uintptr_t key) { return 0; }
+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; }
+
 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;}
@@ -139,6 +168,7 @@ struct Render *RE_GetRender(const char *name){return (struct Render *) NULL;}
 
 /* blenkernel */
 void RE_FreeRenderResult(struct RenderResult *res){}
+void RE_FreeAllRenderResults(void){}
 struct RenderResult *RE_MultilayerConvert(void *exrhandle, int rectx, int recty){return (struct RenderResult *) NULL;}
 void RE_GetResultImage(struct Render *re, struct RenderResult *rr){}
 int RE_RenderInProgress(struct Render *re){return 0;}
@@ -228,11 +258,12 @@ void WM_keymap_restore_to_default(struct wmKeyMap *keymap){}
 void WM_keymap_restore_item_to_default(struct bContext *C, struct wmKeyMap *keymap, struct wmKeyMapItem *kmi){}
 void WM_keymap_properties_reset(struct wmKeyMapItem *kmi){}
 void WM_keyconfig_update_tag(struct wmKeyMap *keymap, struct wmKeyMapItem *kmi) {}
-int WM_keymap_user_init(struct wmWindowManager *wm, struct wmKeyMap *keymap) {return 0;}
 int WM_keymap_item_compare(struct wmKeyMapItem *k1, struct wmKeyMapItem *k2){return 0;}
 
 
 /* rna editors */
+struct EditMesh;
+
 struct FCurve *verify_fcurve (struct bAction *act, const char group[], const char rna_path[], const int array_index, short add){return (struct FCurve *) NULL;}
 int insert_vert_fcurve(struct FCurve *fcu, float x, float y, short flag){return 0;}
 void delete_fcurve_key(struct FCurve *fcu, int index, short do_recalc){}
@@ -266,6 +297,7 @@ void ED_view3d_from_m4(float mat[][4], float ofs[3], float quat[4], float *dist)
 struct BGpic *ED_view3D_background_image_new(struct View3D *v3d){return (struct BGpic *) NULL;}
 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]){}
 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){}
@@ -296,7 +328,9 @@ void ED_mesh_transform(struct Mesh *me, float *mat){}
 void ED_mesh_update(struct Mesh *mesh, struct bContext *C){}
 void ED_mesh_vertices_add(struct Mesh *mesh, struct ReportList *reports, int count){}
 void ED_mesh_edges_add(struct Mesh *mesh, struct ReportList *reports, int count){}
-void ED_mesh_faces_add(struct Mesh *mesh, struct ReportList *reports, int count){}
+void ED_mesh_tessfaces_add(struct Mesh *mesh, struct ReportList *reports, int count){}
+void ED_mesh_loops_add(struct Mesh *mesh, struct ReportList *reports, int count){}
+void ED_mesh_polys_add(struct Mesh *mesh, struct ReportList *reports, int count){}
 void ED_mesh_vertices_remove(struct Mesh *mesh, struct ReportList *reports, int count){}
 void ED_mesh_edges_remove(struct Mesh *mesh, struct ReportList *reports, int count){}
 void ED_mesh_faces_remove(struct Mesh *mesh, struct ReportList *reports, int count){}
@@ -312,6 +346,8 @@ void ED_vgroup_vert_weight(struct Object *ob, struct bDeformGroup *dg, int vertn
 void ED_vgroup_delete(struct Object *ob, struct bDeformGroup *defgroup){}
 void ED_vgroup_clear(struct Object *ob){}
 void ED_vgroup_object_is_edit_mode(struct Object *ob){}
+long mesh_mirrtopo_table(struct Object *ob, char mode) { return 0; }
+intptr_t mesh_octree_table(struct Object *ob, struct BMEditMesh *em, float *co, char mode) { return 0; }
 
 void ED_sequencer_update_view(struct bContext *C, int view){}
 float ED_rollBoneToVector(struct EditBone *bone, float new_up_axis[3]){return 0.0f;}
@@ -319,12 +355,6 @@ void ED_space_image_size(struct SpaceImage *sima, int *width, int *height){}
 
 void ED_nurb_set_spline_type(struct Nurb *nu, int type){}
 
-void EM_selectmode_set(struct EditMesh *em){}
-int EM_texFaceCheck(struct EditMesh *em){return 0;}
-struct MTFace *EM_get_active_mtface(struct EditMesh *em, struct EditFace **act_efa, struct MCol **mcol, int sloopy){return (struct MTFace *)NULL;}
-void make_editMesh(struct Scene *scene, struct Object *ob){}
-void load_editMesh(struct Scene *scene, struct Object *ob){}
-
 void make_editLatt(struct Object *obedit){}
 void load_editLatt(struct Object *obedit){}
 
@@ -334,7 +364,7 @@ void make_editNurb	(struct Object *obedit){}
 
 void uiItemR(struct uiLayout *layout, struct PointerRNA *ptr, char *propname, int flag, char *name, int icon){}
 
-struct PointerRNA uiItemFullO(struct uiLayout *layout, char *idname, char *name, int icon, struct IDProperty *properties, int context, int flag){struct PointerRNA a; return a;}
+struct PointerRNA uiItemFullO(struct uiLayout *layout, char *idname, char *name, int icon, struct IDProperty *properties, int context, int flag){struct PointerRNA a = {{0}}; return a;}
 struct uiLayout *uiLayoutRow(struct uiLayout *layout, int align){return (struct uiLayout *) NULL;}
 struct uiLayout *uiLayoutColumn(struct uiLayout *layout, int align){return (struct uiLayout *) NULL;}
 struct uiLayout *uiLayoutColumnFlow(struct uiLayout *layout, int number, int align){return (struct uiLayout *) NULL;}
@@ -443,6 +473,7 @@ short insert_keyframe (struct ID *id, struct bAction *act, const char group[], c
 short delete_keyframe(struct ID *id, struct bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short flag){return 0;};
 char *WM_operator_pystring(struct bContext *C, struct wmOperatorType *ot, struct PointerRNA *opptr, int all_args){return (char *)NULL;}
 struct wmKeyMapItem *WM_modalkeymap_add_item(struct wmKeyMap *km, int type, int val, int modifier, int keymodifier, int value){return (struct wmKeyMapItem *)NULL;}
+struct wmKeyMapItem *WM_modalkeymap_add_item_str(struct wmKeyMap *km, int type, int val, int modifier, int keymodifier, const char *value){return (struct wmKeyMapItem *)NULL;}
 struct wmKeyMap *WM_modalkeymap_add(struct wmKeyConfig *keyconf, char *idname, EnumPropertyItem *items){return (struct wmKeyMap *) NULL;}
 
 /* RNA COLLADA dependency */
@@ -455,8 +486,8 @@ float sculpt_get_brush_unprojected_radius(struct Brush *brush){return 0.0f;}
 void sculpt_set_brush_unprojected_radius(struct Brush *brush, float unprojected_radius){}
 float sculpt_get_brush_alpha(struct Brush *brush){return 0.0f;}
 void sculpt_set_brush_alpha(struct Brush *brush, float alpha){}
-void ED_sculpt_modifiers_changed(struct Object *ob){};
-
+void ED_sculpt_modifiers_changed(struct Object *ob){}
+void ED_mesh_calc_tessface(struct Mesh *mesh){}
 
 /* bpy/python internal api */
 void operator_wrapper(struct wmOperatorType *ot, void *userdata) {}
@@ -467,7 +498,7 @@ void BPY_pyconstraint_target(struct bPythonConstraint *con, struct bConstraintTa
 float BPY_driver_exec(struct ChannelDriver *driver, const float evaltime) {return 0.0f;} /* might need this one! */
 void BPY_DECREF(void *pyob_ptr) {}
 void BPY_pyconstraint_exec(struct bPythonConstraint *con, struct bConstraintOb *cob, struct ListBase *targets) {}
-void macro_wrapper(struct wmOperatorType *ot, void *userdata) {} ;
+void macro_wrapper(struct wmOperatorType *ot, void *userdata) {}
 
 /* intern/dualcon */
 struct DualConMesh;
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 1b4d88a..0168c06 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -40,11 +40,19 @@ blender_include_dirs(
 	../blender/windowmanager
 )
 
+if(WIN32)
+	blender_include_dirs(../../intern/utfconv)
+endif()
+
 if(WITH_LIBMV)
 	blender_include_dirs(../../extern/libmv)
 	add_definitions(-DWITH_LIBMV)
 endif()
 
+if(WITH_CODEC_FFMPEG)
+	add_definitions(-DWITH_FFMPEG)
+endif()
+
 if(WITH_PYTHON)
 	blender_include_dirs(../blender/python)
 	add_definitions(-DWITH_PYTHON)
@@ -226,7 +234,7 @@ set(BLENDER_TEXT_FILES
 
 
 # -----------------------------------------------------------------------------
-# Platform Spesific Var: TARGETDIR_VER
+# Platform Specific Var: TARGETDIR_VER
 
 if(UNIX AND NOT APPLE)
 	if(WITH_INSTALL_PORTABLE)
@@ -388,7 +396,7 @@ if(UNIX AND NOT APPLE)
 		)
 	endif()
 
-		# plugins in blender 2.5 don't work at the moment.
+		# plugins in blender 2.6 don't work at the moment.
 		#
 		# install(
 		# 	DIRECTORY ${CMAKE_SOURCE_DIR}/release/plugins
@@ -440,7 +448,7 @@ elseif(WIN32)
 		DESTINATION ${TARGETDIR}
 	)
 
-	if(WITH_INTERNATIONAL)
+	if(WITH_INTERNATIONAL AND (NOT WITH_MINGW64))
 		install(
 			FILES ${LIBDIR}/gettext/lib/gnu_gettext.dll
 			DESTINATION ${TARGETDIR}
@@ -454,7 +462,7 @@ elseif(WIN32)
 		endif()
 	endif()
 
-	# plugins in blender 2.5 don't work at the moment.
+	# plugins in blender 2.6 don't work at the moment.
 	#
 	# install(
 	# 	DIRECTORY ${CMAKE_SOURCE_DIR}/release/plugins
@@ -515,11 +523,14 @@ elseif(WIN32)
 			DESTINATION ${TARGETDIR}
 		)
 	else()
-		install(
-			FILES
-				${LIBDIR}/zlib/lib/zlib.dll
-			DESTINATION ${TARGETDIR}
-		)
+		#not needed since we link statically, maybe also unneeded for MinGW?
+		if(NOT WITH_MINGW64)
+			install(
+				FILES
+					${LIBDIR}/zlib/lib/zlib.dll
+				DESTINATION ${TARGETDIR}
+			)
+		endif()
 	endif()
 
 	if(MSVC)
@@ -528,10 +539,13 @@ elseif(WIN32)
 			DESTINATION ${TARGETDIR}
 		)
 	else()
-		install(
-			FILES ${LIBDIR}/pthreads/lib/pthreadGC2.dll
-			DESTINATION ${TARGETDIR}
-		)
+		#MinGW64 comes with own version. For portable builds it will probaly have to be copied to work
+		if(NOT WITH_MINGW64)
+			install(
+				FILES ${LIBDIR}/pthreads/lib/pthreadGC2.dll
+				DESTINATION ${TARGETDIR}
+			)
+		endif()
 	endif()
 
 	if(WITH_CODEC_FFMPEG)
@@ -558,6 +572,7 @@ elseif(WIN32)
 		install(
 			FILES
 				${LIBDIR}/openal/lib/OpenAL32.dll
+				${LIBDIR}/openal/lib/wrap_oal.dll
 			DESTINATION ${TARGETDIR}
 		)
 	endif()
@@ -584,12 +599,14 @@ elseif(WIN32)
 	)	
 
 	if(WITH_OPENIMAGEIO)
-		set_lib_path(OIIOBIN "openimageio/bin")
-		install(
-			FILES
-				${OIIOBIN}/OpenImageIO.dll
-			DESTINATION ${TARGETDIR}
-		)
+		if(NOT MINGW)
+			set_lib_path(OIIOBIN "openimageio/bin")
+			install(
+				FILES
+					${OIIOBIN}/OpenImageIO.dll
+				DESTINATION ${TARGETDIR}
+			)
+		endif()
 	endif()
 
 elseif(APPLE)
@@ -796,8 +813,10 @@ endif()
 		bf_python
 		bf_python_ext
 		bf_python_mathutils
+		bf_python_bmesh
 		bf_ikplugin
 		bf_modifiers
+		bf_bmesh
 		bf_blenkernel
 		bf_nodes
 		bf_gpu
@@ -820,6 +839,7 @@ endif()
 		bf_intern_memutil
 		bf_intern_guardedalloc
 		bf_intern_ctr
+		bf_intern_utfconv
 		ge_blen_routines
 		ge_converter
 		ge_phys_dummy
@@ -891,6 +911,10 @@ endif()
 		list(APPEND BLENDER_SORTED_LIBS extern_carve)
 	endif()
 
+	if(WITH_GHOST_XDND)
+		list(APPEND BLENDER_SORTED_LIBS extern_xdnd)
+	endif()
+
 	foreach(SORTLIB ${BLENDER_SORTED_LIBS})
 		set(REMLIB ${SORTLIB})
 		foreach(SEARCHLIB ${BLENDER_LINK_LIBS})
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 68a7bc4..13daeec 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -40,6 +40,11 @@
 #include <xmmintrin.h>
 #endif
 
+#ifdef WIN32
+#include <Windows.h>
+#include "utfconv.h"
+#endif
+
 #include <stdlib.h>
 #include <stddef.h>
 #include <string.h>
@@ -49,12 +54,11 @@
 #include "MEM_guardedalloc.h"
 
 #ifdef WIN32
-#include "BLI_winstuff.h"
+#  include "BLI_winstuff.h"
 #endif
 
 #include "BLI_args.h"
 #include "BLI_threads.h"
-#include "BLI_scanfill.h" // for BLI_setErrorCallBack, TODO, move elsewhere
 #include "BLI_utildefines.h"
 #include "BLI_callbacks.h"
 
@@ -67,7 +71,7 @@
 #include "BKE_utildefines.h"
 #include "BKE_blender.h"
 #include "BKE_context.h"
-#include "BKE_depsgraph.h" // for DAG_on_visible_update
+#include "BKE_depsgraph.h" /* for DAG_on_visible_update */
 #include "BKE_font.h"
 #include "BKE_global.h"
 #include "BKE_main.h"
@@ -79,7 +83,7 @@
 #include "BKE_sound.h"
 #include "BKE_image.h"
 
-#include "IMB_imbuf.h"	// for IMB_init
+#include "IMB_imbuf.h"  /* for IMB_init */
 
 #ifdef WITH_PYTHON
 #include "BPY_extern.h"
@@ -98,6 +102,8 @@
 #include "GPU_draw.h"
 #include "GPU_extensions.h"
 
+#include "BLI_scanfill.h" /* for BLI_setErrorCallBack, TODO, move elsewhere */
+
 #ifdef WITH_BUILDINFO_HEADER
 #define BUILD_DATE
 #endif
@@ -125,7 +131,7 @@
 #include "libmv-capi.h"
 #endif
 
-// from buildinfo.c
+/* from buildinfo.c */
 #ifdef BUILD_DATE
 extern char build_date[];
 extern char build_time[];
@@ -167,7 +173,7 @@ static void blender_esc(int sig)
 {
 	static int count = 0;
 	
-	G.afbreek = 1;	/* forces render loop to read queue, not sure if its needed */
+	G.afbreek = 1;  /* forces render loop to read queue, not sure if its needed */
 	
 	if (sig == 2) {
 		if (count) {
@@ -182,17 +188,17 @@ static void blender_esc(int sig)
 
 static int print_version(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
 {
-	printf (BLEND_VERSION_STRING_FMT);
+	printf(BLEND_VERSION_STRING_FMT);
 #ifdef BUILD_DATE
-	printf ("\tbuild date: %s\n", build_date);
-	printf ("\tbuild time: %s\n", build_time);
-	printf ("\tbuild revision: %s\n", build_rev);
-	printf ("\tbuild platform: %s\n", build_platform);
-	printf ("\tbuild type: %s\n", build_type);
-	printf ("\tbuild c flags: %s\n", build_cflags);
-	printf ("\tbuild c++ flags: %s\n", build_cxxflags);
-	printf ("\tbuild link flags: %s\n", build_linkflags);
-	printf ("\tbuild system: %s\n", build_system);
+	printf("\tbuild date: %s\n", build_date);
+	printf("\tbuild time: %s\n", build_time);
+	printf("\tbuild revision: %s\n", build_rev);
+	printf("\tbuild platform: %s\n", build_platform);
+	printf("\tbuild type: %s\n", build_type);
+	printf("\tbuild c flags: %s\n", build_cflags);
+	printf("\tbuild c++ flags: %s\n", build_cxxflags);
+	printf("\tbuild link flags: %s\n", build_linkflags);
+	printf("\tbuild system: %s\n", build_system);
 #endif
 	exit(0);
 
@@ -201,12 +207,12 @@ static int print_version(int UNUSED(argc), const char **UNUSED(argv), void *UNUS
 
 static int print_help(int UNUSED(argc), const char **UNUSED(argv), void *data)
 {
-	bArgs *ba = (bArgs*)data;
+	bArgs *ba = (bArgs *)data;
 
-	printf (BLEND_VERSION_STRING_FMT);
-	printf ("Usage: blender [args ...] [file] [args ...]\n\n");
+	printf(BLEND_VERSION_STRING_FMT);
+	printf("Usage: blender [args ...] [file] [args ...]\n\n");
 
-	printf ("Render Options:\n");
+	printf("Render Options:\n");
 	BLI_argsPrintArgDoc(ba, "--background");
 	BLI_argsPrintArgDoc(ba, "--render-anim");
 	BLI_argsPrintArgDoc(ba, "--scene");
@@ -218,30 +224,39 @@ static int print_help(int UNUSED(argc), const char **UNUSED(argv), void *data)
 	BLI_argsPrintArgDoc(ba, "--engine");
 	
 	printf("\n");
-	printf ("Format Options:\n");
+	printf("Format Options:\n");
 	BLI_argsPrintArgDoc(ba, "--render-format");
 	BLI_argsPrintArgDoc(ba, "--use-extension");
 	BLI_argsPrintArgDoc(ba, "--threads");
 
 	printf("\n");
-	printf ("Animation Playback Options:\n");
+	printf("Animation Playback Options:\n");
 	BLI_argsPrintArgDoc(ba, "-a");
 				
 	printf("\n");
-	printf ("Window Options:\n");
+	printf("Window Options:\n");
 	BLI_argsPrintArgDoc(ba, "--window-border");
 	BLI_argsPrintArgDoc(ba, "--window-borderless");
 	BLI_argsPrintArgDoc(ba, "--window-geometry");
 	BLI_argsPrintArgDoc(ba, "--start-console");
 
 	printf("\n");
-	printf ("Game Engine Specific Options:\n");
+	printf("Game Engine Specific Options:\n");
 	BLI_argsPrintArgDoc(ba, "-g");
 
 	printf("\n");
-	printf ("Misc Options:\n");
+	printf("Misc Options:\n");
 	BLI_argsPrintArgDoc(ba, "--debug");
 	BLI_argsPrintArgDoc(ba, "--debug-fpe");
+
+#ifdef WITH_FFMPEG
+	BLI_argsPrintArgDoc(ba, "--debug-ffmpeg");
+#endif
+
+#ifdef WITH_LIBMV
+	BLI_argsPrintArgDoc(ba, "--debug-libmv");
+#endif
+
 	printf("\n");
 	BLI_argsPrintArgDoc(ba, "--factory-startup");
 	printf("\n");
@@ -279,49 +294,46 @@ static int print_help(int UNUSED(argc), const char **UNUSED(argv), void *data)
 
 	BLI_argsPrintArgDoc(ba, "--");
 
-	printf ("Other Options:\n");
+	printf("Other Options:\n");
 	BLI_argsPrintOtherDoc(ba);
 
-	printf ("Argument Parsing:\n");
-	printf ("\targuments must be separated by white space. eg\n");
-	printf ("\t\t\"blender -ba test.blend\"\n");
-	printf ("\t...will ignore the 'a'\n");
-	printf ("\t\t\"blender -b test.blend -f8\"\n");
-	printf ("\t...will ignore 8 because there is no space between the -f and the frame value\n\n");
-
-	printf ("Argument Order:\n");
-	printf ("Arguments are executed in the order they are given. eg\n");
-	printf ("\t\t\"blender --background test.blend --render-frame 1 --render-output /tmp\"\n");
-	printf ("\t...will not render to /tmp because '--render-frame 1' renders before the output path is set\n");
-	printf ("\t\t\"blender --background --render-output /tmp test.blend --render-frame 1\"\n");
-	printf ("\t...will not render to /tmp because loading the blend file overwrites the render output that was set\n");
-	printf ("\t\t\"blender --background test.blend --render-output /tmp --render-frame 1\" works as expected.\n\n");
-
-	printf ("\nEnvironment Variables:\n");
-	printf ("  $BLENDER_USER_CONFIG      Directory for user configuration files.\n");
-	printf ("  $BLENDER_USER_SCRIPTS     Directory for user scripts.\n");
-	printf ("  $BLENDER_SYSTEM_SCRIPTS   Directory for system wide scripts.\n");
-	printf ("  $Directory for user data files (icons, translations, ..).\n");
-	printf ("  $BLENDER_SYSTEM_DATAFILES Directory for system wide data files.\n");
-	printf ("  $BLENDER_SYSTEM_PYTHON    Directory for system python libraries.\n");
+	printf("Argument Parsing:\n");
+	printf("\targuments must be separated by white space. eg\n");
+	printf("\t\t\"blender -ba test.blend\"\n");
+	printf("\t...will ignore the 'a'\n");
+	printf("\t\t\"blender -b test.blend -f8\"\n");
+	printf("\t...will ignore 8 because there is no space between the -f and the frame value\n\n");
+
+	printf("Argument Order:\n");
+	printf("Arguments are executed in the order they are given. eg\n");
+	printf("\t\t\"blender --background test.blend --render-frame 1 --render-output /tmp\"\n");
+	printf("\t...will not render to /tmp because '--render-frame 1' renders before the output path is set\n");
+	printf("\t\t\"blender --background --render-output /tmp test.blend --render-frame 1\"\n");
+	printf("\t...will not render to /tmp because loading the blend file overwrites the render output that was set\n");
+	printf("\t\t\"blender --background test.blend --render-output /tmp --render-frame 1\" works as expected.\n\n");
+
+	printf("\nEnvironment Variables:\n");
+	printf("  $BLENDER_USER_CONFIG      Directory for user configuration files.\n");
+	printf("  $BLENDER_USER_SCRIPTS     Directory for user scripts.\n");
+	printf("  $BLENDER_SYSTEM_SCRIPTS   Directory for system wide scripts.\n");
+	printf("  $Directory for user data files (icons, translations, ..).\n");
+	printf("  $BLENDER_SYSTEM_DATAFILES Directory for system wide data files.\n");
+	printf("  $BLENDER_SYSTEM_PYTHON    Directory for system python libraries.\n");
 #ifdef WIN32
-	printf ("  $TEMP                     Store temporary files here.\n");
+	printf("  $TEMP                     Store temporary files here.\n");
 #else
-	printf ("  $TMP or $TMPDIR           Store temporary files here.\n");
+	printf("  $TMP or $TMPDIR           Store temporary files here.\n");
 #endif
 #ifdef WITH_SDL
-	printf ("  $SDL_AUDIODRIVER          LibSDL audio driver - alsa, esd, dma.\n");
+	printf("  $SDL_AUDIODRIVER          LibSDL audio driver - alsa, esd, dma.\n");
 #endif
-	printf ("  $PYTHONHOME               Path to the python directory, eg. /usr/lib/python.\n\n");
+	printf("  $PYTHONHOME               Path to the python directory, eg. /usr/lib/python.\n\n");
 
 	exit(0);
 
 	return 0;
 }
 
-
-double PIL_check_seconds_timer(void);
-
 static int end_arguments(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
 {
 	return -1;
@@ -349,7 +361,7 @@ static int background_mode(int UNUSED(argc), const char **UNUSED(argv), void *UN
 
 static int debug_mode(int UNUSED(argc), const char **UNUSED(argv), void *data)
 {
-	G.f |= G_DEBUG;		/* std output printf's */
+	G.debug |= G_DEBUG;  /* std output printf's */
 	printf(BLEND_VERSION_STRING_FMT);
 	MEM_set_memory_debug();
 
@@ -357,13 +369,24 @@ static int debug_mode(int UNUSED(argc), const char **UNUSED(argv), void *data)
 	printf("Build: %s %s %s %s\n", build_date, build_time, build_platform, build_type);
 #endif // WITH_BUILDINFO
 
+	BLI_argsPrint(data);
+	return 0;
+}
+
+static int debug_mode_generic(int UNUSED(argc), const char **UNUSED(argv), void *data)
+{
+	G.debug |= GET_INT_FROM_POINTER(data);
+	return 0;
+}
+
 #ifdef WITH_LIBMV
+static int debug_mode_libmv(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
+{
 	libmv_startDebugLogging();
-#endif
 
-	BLI_argsPrint(data);
 	return 0;
 }
+#endif
 
 static int set_fpe(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
 {
@@ -373,14 +396,14 @@ static int set_fpe(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(dat
 	signal(SIGFPE, fpe_handler);
 
 # if defined(__linux__) && defined(__GNUC__)
-	feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW );
-# endif	/* defined(__linux__) && defined(__GNUC__) */
+	feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
+# endif /* defined(__linux__) && defined(__GNUC__) */
 # if defined(OSX_SSE_FPE)
 	/* OSX uses SSE for floating point by default, so here 
 	 * use SSE instructions to throw floating point exceptions */
-	_MM_SET_EXCEPTION_MASK(_MM_MASK_MASK &~
-			(_MM_MASK_OVERFLOW|_MM_MASK_INVALID|_MM_MASK_DIV_ZERO));
-# endif	/* OSX_SSE_FPE */
+	_MM_SET_EXCEPTION_MASK(_MM_MASK_MASK & ~
+	                       (_MM_MASK_OVERFLOW | _MM_MASK_INVALID | _MM_MASK_DIV_ZERO));
+# endif /* OSX_SSE_FPE */
 # if defined(_WIN32) && defined(_MSC_VER)
 	_controlfp_s(NULL, 0, _MCW_EM); /* enables all fp exceptions */
 	_controlfp_s(NULL, _EM_DENORMAL | _EM_UNDERFLOW | _EM_INEXACT, _MCW_EM); /* hide the ones we don't care about */
@@ -392,7 +415,7 @@ static int set_fpe(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(dat
 
 static int set_factory_startup(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
 {
-	G.factory_startup= 1;
+	G.factory_startup = 1;
 	return 0;
 }
 
@@ -400,20 +423,20 @@ static int set_env(int argc, const char **argv, void *UNUSED(data))
 {
 	/* "--env-system-scripts" --> "BLENDER_SYSTEM_SCRIPTS" */
 
-	char env[64]= "BLENDER";
-	char *ch_dst= env + 7; /* skip BLENDER */
-	const char *ch_src= argv[0] + 5; /* skip --env */
+	char env[64] = "BLENDER";
+	char *ch_dst = env + 7; /* skip BLENDER */
+	const char *ch_src = argv[0] + 5; /* skip --env */
 
 	if (argc < 2) {
 		printf("%s requires one argument\n", argv[0]);
 		exit(1);
 	}
 
-	for(; *ch_src; ch_src++, ch_dst++) {
-		*ch_dst= (*ch_src == '-') ? '_' : (*ch_src)-32; /* toupper() */
+	for (; *ch_src; ch_src++, ch_dst++) {
+		*ch_dst = (*ch_src == '-') ? '_' : (*ch_src) - 32; /* toupper() */
 	}
 
-	*ch_dst= '\0';
+	*ch_dst = '\0';
 	BLI_setenv(env, argv[1]);
 	return 1;
 }
@@ -422,10 +445,10 @@ static int playback_mode(int UNUSED(argc), const char **UNUSED(argv), void *UNUS
 {
 	/* not if -b was given first */
 	if (G.background == 0) {
-#if 0	/* TODO, bring player back? */
+#if 0   /* TODO, bring player back? */
 		playanim(argc, argv); /* not the same argc and argv as before */
 #else
-		fprintf(stderr, "Playback mode not supported in blender 2.5x\n");
+		fprintf(stderr, "Playback mode not supported in blender 2.6x\n");
 		exit(0);
 #endif
 	}
@@ -438,14 +461,14 @@ static int prefsize(int argc, const char **argv, void *UNUSED(data))
 	int stax, stay, sizx, sizy;
 
 	if (argc < 5) {
-		fprintf (stderr, "-p requires four arguments\n");
+		fprintf(stderr, "-p requires four arguments\n");
 		exit(1);
 	}
 
-	stax= atoi(argv[1]);
-	stay= atoi(argv[2]);
-	sizx= atoi(argv[3]);
-	sizy= atoi(argv[4]);
+	stax = atoi(argv[1]);
+	stay = atoi(argv[2]);
+	sizx = atoi(argv[3]);
+	sizy = atoi(argv[4]);
 
 	WM_setprefsize(stax, stay, sizx, sizy);
 
@@ -464,7 +487,7 @@ static int without_borders(int UNUSED(argc), const char **UNUSED(argv), void *UN
 	return 0;
 }
 
-extern int wm_start_with_console; // blender/windowmanager/intern/wm_init_exit.c
+extern int wm_start_with_console; /* wm_init_exit.c */
 static int start_with_console(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
 {
 	wm_start_with_console = 1;
@@ -491,11 +514,11 @@ static int no_joystick(int UNUSED(argc), const char **UNUSED(argv), void *data)
 	SYS_SystemHandle *syshandle = data;
 
 	/**
-		don't initialize joysticks if user doesn't want to use joysticks
-		failed joystick initialization delays over 5 seconds, before game engine start
-	*/
-	SYS_WriteCommandLineInt(*syshandle, "nojoystick",1);
-	if (G.f & G_DEBUG) printf("disabling nojoystick\n");
+	 * don't initialize joysticks if user doesn't want to use joysticks
+	 * failed joystick initialization delays over 5 seconds, before game engine start
+	 */
+	SYS_WriteCommandLineInt(*syshandle, "nojoystick", 1);
+	if (G.debug & G_DEBUG) printf("disabling nojoystick\n");
 #endif
 
 	return 0;
@@ -527,15 +550,17 @@ static int set_audio(int argc, const char **argv, void *UNUSED(data))
 static int set_output(int argc, const char **argv, void *data)
 {
 	bContext *C = data;
-	if (argc >= 1){
-		Scene *scene= CTX_data_scene(C);
+	if (argc >= 1) {
+		Scene *scene = CTX_data_scene(C);
 		if (scene) {
 			BLI_strncpy(scene->r.pic, argv[1], sizeof(scene->r.pic));
-		} else {
+		}
+		else {
 			printf("\nError: no blend loaded. cannot use '-o / --render-output'.\n");
 		}
 		return 1;
-	} else {
+	}
+	else {
 		printf("\nError: you must specify a path after '-o  / --render-output'.\n");
 		return 0;
 	}
@@ -548,17 +573,17 @@ static int set_engine(int argc, const char **argv, void *data)
 		if (!strcmp(argv[1], "help")) {
 			RenderEngineType *type = NULL;
 			printf("Blender Engine Listing:\n");
-			for( type = R_engines.first; type; type = type->next ) {
+			for (type = R_engines.first; type; type = type->next) {
 				printf("\t%s\n", type->idname);
 			}
 			exit(0);
 		}
 		else {
-			Scene *scene= CTX_data_scene(C);
+			Scene *scene = CTX_data_scene(C);
 			if (scene) {
 				RenderData *rd = &scene->r;
 
-				if(BLI_findstring(&R_engines, argv[1], offsetof(RenderEngineType, idname))) {
+				if (BLI_findstring(&R_engines, argv[1], offsetof(RenderEngineType, idname))) {
 					BLI_strncpy_utf8(rd->engine, argv[1], sizeof(rd->engine));
 				}
 			}
@@ -569,8 +594,7 @@ static int set_engine(int argc, const char **argv, void *data)
 
 		return 1;
 	}
-	else
-	{
+	else {
 		printf("\nEngine not specified, give 'help' for a list of available engines.\n");
 		return 0;
 	}
@@ -579,24 +603,25 @@ static int set_engine(int argc, const char **argv, void *data)
 static int set_image_type(int argc, const char **argv, void *data)
 {
 	bContext *C = data;
-	if (argc >= 1){
+	if (argc >= 1) {
 		const char *imtype = argv[1];
-		Scene *scene= CTX_data_scene(C);
+		Scene *scene = CTX_data_scene(C);
 		if (scene) {
-			const char imtype_new= BKE_imtype_from_arg(imtype);
+			const char imtype_new = BKE_imtype_from_arg(imtype);
 
 			if (imtype_new == R_IMF_IMTYPE_INVALID) {
 				printf("\nError: Format from '-F / --render-format' not known or not compiled in this release.\n");
 			}
 			else {
-				scene->r.im_format.imtype= imtype_new;
+				scene->r.im_format.imtype = imtype_new;
 			}
 		}
 		else {
 			printf("\nError: no blend loaded. order the arguments so '-F  / --render-format' is after the blend is loaded.\n");
 		}
 		return 1;
-	} else {
+	}
+	else {
 		printf("\nError: you must specify a format after '-F  / --render-foramt'.\n");
 		return 0;
 	}
@@ -605,13 +630,15 @@ static int set_image_type(int argc, const char **argv, void *data)
 static int set_threads(int argc, const char **argv, void *UNUSED(data))
 {
 	if (argc >= 1) {
-		if(G.background) {
+		if (G.background) {
 			RE_set_max_threads(atoi(argv[1]));
-		} else {
+		}
+		else {
 			printf("Warning: threads can only be set in background mode\n");
 		}
 		return 1;
-	} else {
+	}
+	else {
 		printf("\nError: you must specify a number of threads between 0 and 8 '-t  / --threads'.\n");
 		return 0;
 	}
@@ -621,20 +648,24 @@ static int set_extension(int argc, const char **argv, void *data)
 {
 	bContext *C = data;
 	if (argc >= 1) {
-		Scene *scene= CTX_data_scene(C);
+		Scene *scene = CTX_data_scene(C);
 		if (scene) {
 			if (argv[1][0] == '0') {
 				scene->r.scemode &= ~R_EXTENSION;
-			} else if (argv[1][0] == '1') {
+			}
+			else if (argv[1][0] == '1') {
 				scene->r.scemode |= R_EXTENSION;
-			} else {
+			}
+			else {
 				printf("\nError: Use '-x 1 / -x 0' To set the extension option or '--use-extension'\n");
 			}
-		} else {
+		}
+		else {
 			printf("\nError: no blend loaded. order the arguments so '-o ' is after '-x '.\n");
 		}
 		return 1;
-	} else {
+	}
+	else {
 		printf("\nError: you must specify a path after '- '.\n");
 		return 0;
 	}
@@ -644,53 +675,49 @@ static int set_ge_parameters(int argc, const char **argv, void *data)
 {
 	int a = 0;
 #ifdef WITH_GAMEENGINE
-	SYS_SystemHandle syshandle = *(SYS_SystemHandle*)data;
+	SYS_SystemHandle syshandle = *(SYS_SystemHandle *)data;
 #else
 	(void)data;
 #endif
 
-/**
-gameengine parameters are automaticly put into system
--g [paramname = value]
--g [boolparamname]
-example:
--g novertexarrays
--g maxvertexarraysize = 512
-*/
+	/**
+	 * gameengine parameters are automatically put into system
+	 * -g [paramname = value]
+	 * -g [boolparamname]
+	 * example:
+	 * -g novertexarrays
+	 * -g maxvertexarraysize = 512
+	 */
 
-	if(argc >= 1)
-	{
+	if (argc >= 1) {
 		const char *paramname = argv[a];
 		/* check for single value versus assignment */
-		if (a+1 < argc && (*(argv[a+1]) == '='))
-		{
+		if (a + 1 < argc && (*(argv[a + 1]) == '=')) {
 			a++;
-			if (a+1 < argc)
-			{
+			if (a + 1 < argc) {
 				a++;
 				/* assignment */
 #ifdef WITH_GAMEENGINE
-				SYS_WriteCommandLineString(syshandle,paramname,argv[a]);
+				SYS_WriteCommandLineString(syshandle, paramname, argv[a]);
 #endif
-			}  else
-			{
-				printf("error: argument assignment (%s) without value.\n",paramname);
+			}
+			else {
+				printf("error: argument assignment (%s) without value.\n", paramname);
 				return 0;
 			}
 			/* name arg eaten */
 
-		} else {
+		}
+		else {
 #ifdef WITH_GAMEENGINE
-			SYS_WriteCommandLineInt(syshandle,argv[a],1);
+			SYS_WriteCommandLineInt(syshandle, argv[a], 1);
 #endif
 			/* doMipMap */
-			if (!strcmp(argv[a],"nomipmap"))
-			{
+			if (!strcmp(argv[a], "nomipmap")) {
 				GPU_set_mipmap(0); //doMipMap = 0;
 			}
 			/* linearMipMap */
-			if (!strcmp(argv[a],"linearmipmap"))
-			{
+			if (!strcmp(argv[a], "linearmipmap")) {
 				GPU_set_linear_mipmap(1); //linearMipMap = 1;
 			}
 
@@ -704,40 +731,42 @@ example:
 static int render_frame(int argc, const char **argv, void *data)
 {
 	bContext *C = data;
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	if (scene) {
-		Main *bmain= CTX_data_main(C);
+		Main *bmain = CTX_data_main(C);
 
 		if (argc > 1) {
 			Render *re = RE_NewRender(scene->id.name);
 			int frame;
 			ReportList reports;
 
-			switch(*argv[1]) {
-			case '+':
-				frame= scene->r.sfra + atoi(argv[1]+1);
-				break;
-			case '-':
-				frame= (scene->r.efra - atoi(argv[1]+1)) + 1;
-				break;
-			default:
-				frame= atoi(argv[1]);
-				break;
+			switch (*argv[1]) {
+				case '+':
+					frame = scene->r.sfra + atoi(argv[1] + 1);
+					break;
+				case '-':
+					frame = (scene->r.efra - atoi(argv[1] + 1)) + 1;
+					break;
+				default:
+					frame = atoi(argv[1]);
+					break;
 			}
 
 			BKE_reports_init(&reports, RPT_PRINT);
 
-			frame = MIN2(MAXFRAME, MAX2(MINAFRAME, frame));
+			frame = CLAMPIS(frame, MINAFRAME, MAXFRAME);
 
 			RE_SetReports(re, &reports);
 			RE_BlenderAnim(re, bmain, scene, NULL, scene->lay, frame, frame, scene->r.frame_step);
 			RE_SetReports(re, NULL);
 			return 1;
-		} else {
+		}
+		else {
 			printf("\nError: frame number must follow '-f / --render-frame'.\n");
 			return 0;
 		}
-	} else {
+	}
+	else {
 		printf("\nError: no blend loaded. cannot use '-f / --render-frame'.\n");
 		return 0;
 	}
@@ -746,16 +775,17 @@ static int render_frame(int argc, const char **argv, void *data)
 static int render_animation(int UNUSED(argc), const char **UNUSED(argv), void *data)
 {
 	bContext *C = data;
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	if (scene) {
-		Main *bmain= CTX_data_main(C);
-		Render *re= RE_NewRender(scene->id.name);
+		Main *bmain = CTX_data_main(C);
+		Render *re = RE_NewRender(scene->id.name);
 		ReportList reports;
 		BKE_reports_init(&reports, RPT_PRINT);
 		RE_SetReports(re, &reports);
 		RE_BlenderAnim(re, bmain, scene, NULL, scene->lay, scene->r.sfra, scene->r.efra, scene->r.frame_step);
 		RE_SetReports(re, NULL);
-	} else {
+	}
+	else {
 		printf("\nError: no blend loaded. cannot use '-a'.\n");
 	}
 	return 0;
@@ -763,14 +793,15 @@ static int render_animation(int UNUSED(argc), const char **UNUSED(argv), void *d
 
 static int set_scene(int argc, const char **argv, void *data)
 {
-	if(argc > 1) {
-		bContext *C= data;
-		Scene *scene= set_scene_name(CTX_data_main(C), argv[1]);
-		if(scene) {
+	if (argc > 1) {
+		bContext *C = data;
+		Scene *scene = set_scene_name(CTX_data_main(C), argv[1]);
+		if (scene) {
 			CTX_data_scene_set(C, scene);
 		}
 		return 1;
-	} else {
+	}
+	else {
 		printf("\nError: Scene name must follow '-S / --scene'.\n");
 		return 0;
 	}
@@ -779,17 +810,19 @@ static int set_scene(int argc, const char **argv, void *data)
 static int set_start_frame(int argc, const char **argv, void *data)
 {
 	bContext *C = data;
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	if (scene) {
 		if (argc > 1) {
 			int frame = atoi(argv[1]);
 			(scene->r.sfra) = CLAMPIS(frame, MINFRAME, MAXFRAME);
 			return 1;
-		} else {
+		}
+		else {
 			printf("\nError: frame number must follow '-s / --frame-start'.\n");
 			return 0;
 		}
-	} else {
+	}
+	else {
 		printf("\nError: no blend loaded. cannot use '-s / --frame-start'.\n");
 		return 0;
 	}
@@ -798,17 +831,19 @@ static int set_start_frame(int argc, const char **argv, void *data)
 static int set_end_frame(int argc, const char **argv, void *data)
 {
 	bContext *C = data;
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	if (scene) {
 		if (argc > 1) {
 			int frame = atoi(argv[1]);
 			(scene->r.efra) = CLAMPIS(frame, MINFRAME, MAXFRAME);
 			return 1;
-		} else {
+		}
+		else {
 			printf("\nError: frame number must follow '-e / --frame-end'.\n");
 			return 0;
 		}
-	} else {
+	}
+	else {
 		printf("\nError: no blend loaded. cannot use '-e / --frame-end'.\n");
 		return 0;
 	}
@@ -817,17 +852,19 @@ static int set_end_frame(int argc, const char **argv, void *data)
 static int set_skip_frame(int argc, const char **argv, void *data)
 {
 	bContext *C = data;
-	Scene *scene= CTX_data_scene(C);
+	Scene *scene = CTX_data_scene(C);
 	if (scene) {
 		if (argc > 1) {
 			int frame = atoi(argv[1]);
 			(scene->r.frame_step) = CLAMPIS(frame, 1, MAXFRAME);
 			return 1;
-		} else {
+		}
+		else {
 			printf("\nError: number of frames to step must follow '-j / --frame-jump'.\n");
 			return 0;
 		}
-	} else {
+	}
+	else {
 		printf("\nError: no blend loaded. cannot use '-j / --frame-jump'.\n");
 		return 0;
 	}
@@ -836,22 +873,22 @@ static int set_skip_frame(int argc, const char **argv, void *data)
 /* macro for ugly context setup/reset */
 #ifdef WITH_PYTHON
 #define BPY_CTX_SETUP(_cmd)                                                   \
-{                                                                             \
-	wmWindowManager *wm= CTX_wm_manager(C);                                   \
-	wmWindow *prevwin= CTX_wm_window(C);                                      \
-	Scene *prevscene= CTX_data_scene(C);                                      \
-	if(wm->windows.first) {                                                   \
-		CTX_wm_window_set(C, wm->windows.first);                              \
-		_cmd;                                                                 \
-		CTX_wm_window_set(C, prevwin);                                        \
-	}                                                                         \
-	else {                                                                    \
-		fprintf(stderr, "Python script \"%s\" "                               \
-		                "running with missing context data.\n", argv[1]);     \
-		_cmd;                                                                 \
+	{                                                                         \
+		wmWindowManager *wm = CTX_wm_manager(C);                              \
+		wmWindow *prevwin = CTX_wm_window(C);                                 \
+		Scene *prevscene = CTX_data_scene(C);                                 \
+		if (wm->windows.first) {                                              \
+			CTX_wm_window_set(C, wm->windows.first);                          \
+			_cmd;                                                             \
+			CTX_wm_window_set(C, prevwin);                                    \
+		}                                                                     \
+		else {                                                                \
+			fprintf(stderr, "Python script \"%s\" "                           \
+			        "running with missing context data.\n", argv[1]);         \
+			_cmd;                                                             \
+		}                                                                     \
+		CTX_data_scene_set(C, prevscene);                                     \
 	}                                                                         \
-	CTX_data_scene_set(C, prevscene);                                         \
-}                                                                             \
 
 #endif /* WITH_PYTHON */
 
@@ -870,7 +907,8 @@ static int run_python(int argc, const char **argv, void *data)
 		BPY_CTX_SETUP(BPY_filepath_exec(C, filename, NULL))
 
 		return 1;
-	} else {
+	}
+	else {
 		printf("\nError: you must specify a Python script after '-P / --python'.\n");
 		return 0;
 	}
@@ -901,9 +939,9 @@ static int set_addons(int argc, const char **argv, void *data)
 	/* workaround for scripts not getting a bpy.context.scene, causes internal errors elsewhere */
 	if (argc > 1) {
 #ifdef WITH_PYTHON
-		const int slen= strlen(argv[1]) + 128;
-		char *str= malloc(slen);
-		bContext *C= data;
+		const int slen = strlen(argv[1]) + 128;
+		char *str = malloc(slen);
+		bContext *C = data;
 		BLI_snprintf(str, slen, "[__import__('addon_utils').enable(i, default_set=False) for i in '%s'.split(',')]", argv[1]);
 		BPY_CTX_SETUP(BPY_string_exec(C, str));
 		free(str);
@@ -937,13 +975,13 @@ static int load_file(int UNUSED(argc), const char **argv, void *data)
 	if (G.background) {
 		int retval = BKE_read_file(C, filename, NULL);
 
-		/*we successfully loaded a blend file, get sure that
-		pointcache works */
+		/* we successfully loaded a blend file, get sure that
+		 * pointcache works */
 		if (retval != BKE_READ_FILE_FAIL) {
-			wmWindowManager *wm= CTX_wm_manager(C);
+			wmWindowManager *wm = CTX_wm_manager(C);
 
 			/* special case, 2.4x files */
-			if(wm==NULL && CTX_data_main(C)->wm.first==NULL) {
+			if (wm == NULL && CTX_data_main(C)->wm.first == NULL) {
 				extern void wm_add_default(bContext *C);
 
 				/* wm_add_default() needs the screen to be set. */
@@ -954,7 +992,7 @@ static int load_file(int UNUSED(argc), const char **argv, void *data)
 			CTX_wm_manager_set(C, NULL); /* remove wm to force check */
 			WM_check(C);
 			G.relbase_valid = 1;
-			if (CTX_wm_manager(C) == NULL) CTX_wm_manager_set(C, wm); /* reset wm */
+			if (CTX_wm_manager(C) == NULL) CTX_wm_manager_set(C, wm);  /* reset wm */
 
 			DAG_on_visible_update(CTX_data_main(C), TRUE);
 		}
@@ -972,11 +1010,12 @@ static int load_file(int UNUSED(argc), const char **argv, void *data)
 #endif
 
 		/* happens for the UI on file reading too (huh? (ton))*/
-	// XXX			BKE_reset_undo();
-	//				BKE_write_undo("original");	/* save current state */
-	} else {
+		// XXX		BKE_reset_undo();
+		//			BKE_write_undo("original");	/* save current state */
+	}
+	else {
 		/* we are not running in background mode here, but start blender in UI mode with
-		   a file - this should do everything a 'load file' does */
+		 * a file - this should do everything a 'load file' does */
 		ReportList reports;
 		BKE_reports_init(&reports, RPT_PRINT);
 		WM_read_file(C, filename, &reports);
@@ -1041,11 +1080,11 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle)
 	
 	/* only to give help message */
 #ifndef WITH_PYTHON_SECURITY /* default */
-#  define 	PY_ENABLE_AUTO ", (default)"
-#  define 	PY_DISABLE_AUTO ""
+#  define   PY_ENABLE_AUTO ", (default)"
+#  define   PY_DISABLE_AUTO ""
 #else
-#  define 	PY_ENABLE_AUTO ""
-#  define 	PY_DISABLE_AUTO ", (compiled as non-standard default)"
+#  define   PY_ENABLE_AUTO ""
+#  define   PY_DISABLE_AUTO ", (compiled as non-standard default)"
 #endif
 
 	BLI_argsAdd(ba, 1, "-y", "--enable-autoexec", "\n\tEnable automatic python script execution" PY_ENABLE_AUTO, enable_python, NULL);
@@ -1059,15 +1098,27 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle)
 	BLI_argsAdd(ba, 1, "-a", NULL, playback_doc, playback_mode, NULL);
 
 	BLI_argsAdd(ba, 1, "-d", "--debug", debug_doc, debug_mode, ba);
+#ifdef WITH_FFMPEG
+	BLI_argsAdd(ba, 1, NULL, "--debug-ffmpeg", "\n\tEnable debug messages from FFmpeg library", debug_mode_generic, (void *)G_DEBUG_FFMPEG);
+#endif
+	BLI_argsAdd(ba, 1, NULL, "--debug-python", "\n\tEnable debug messages for python", debug_mode_generic, (void *)G_DEBUG_FFMPEG);
+	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-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);
+
 	BLI_argsAdd(ba, 1, NULL, "--debug-fpe", "\n\tEnable floating point exceptions", set_fpe, NULL);
 
-	BLI_argsAdd(ba, 1, NULL, "--factory-startup", "\n\tSkip reading the "STRINGIFY(BLENDER_STARTUP_FILE)" in the users home directory", set_factory_startup, NULL);
+#ifdef WITH_LIBMV
+	BLI_argsAdd(ba, 1, NULL, "--debug-libmv", "\n\tEnable debug messages from libmv library", debug_mode_libmv, NULL);
+#endif
+
+	BLI_argsAdd(ba, 1, NULL, "--factory-startup", "\n\tSkip reading the "STRINGIFY (BLENDER_STARTUP_FILE)" in the users home directory", set_factory_startup, NULL);
 
 	/* TODO, add user env vars? */
-	BLI_argsAdd(ba, 1, NULL, "--env-system-datafiles",	"\n\tSet the "STRINGIFY_ARG(BLENDER_SYSTEM_DATAFILES)" environment variable", set_env, NULL);
-	BLI_argsAdd(ba, 1, NULL, "--env-system-scripts",	"\n\tSet the "STRINGIFY_ARG(BLENDER_SYSTEM_SCRIPTS)" environment variable", set_env, NULL);
-	BLI_argsAdd(ba, 1, NULL, "--env-system-plugins",	"\n\tSet the "STRINGIFY_ARG(BLENDER_SYSTEM_PLUGINS)" environment variable", set_env, NULL);
-	BLI_argsAdd(ba, 1, NULL, "--env-system-python",		"\n\tSet the "STRINGIFY_ARG(BLENDER_SYSTEM_PYTHON)" environment variable", set_env, NULL);
+	BLI_argsAdd(ba, 1, NULL, "--env-system-datafiles",  "\n\tSet the "STRINGIFY_ARG (BLENDER_SYSTEM_DATAFILES)" environment variable", set_env, NULL);
+	BLI_argsAdd(ba, 1, NULL, "--env-system-scripts",    "\n\tSet the "STRINGIFY_ARG (BLENDER_SYSTEM_SCRIPTS)" environment variable", set_env, NULL);
+	BLI_argsAdd(ba, 1, NULL, "--env-system-plugins",    "\n\tSet the "STRINGIFY_ARG (BLENDER_SYSTEM_PLUGINS)" environment variable", set_env, NULL);
+	BLI_argsAdd(ba, 1, NULL, "--env-system-python",     "\n\tSet the "STRINGIFY_ARG (BLENDER_SYSTEM_PYTHON)" environment variable", set_env, NULL);
 
 	/* second pass: custom window stuff */
 	BLI_argsAdd(ba, 2, "-p", "--window-geometry", "<sx> <sy> <w> <h>\n\tOpen with lower left corner at <sx>, <sy> and width and height as <w>, <h>", prefsize, NULL);
@@ -1107,7 +1158,7 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle)
 #ifdef WITH_PYTHON_MODULE
 /* allow python module to call main */
 #define main main_python_enter
-static void *evil_C= NULL;
+static void *evil_C = NULL;
 
 #ifdef __APPLE__
 /* environ is not available in mac shared libraries */
@@ -1117,23 +1168,40 @@ char **environ = NULL;
 
 #endif
 
+
+#ifdef WIN32
+int main(int argc, const char **UNUSED(argv_c)) /* Do not mess with const */
+#else
 int main(int argc, const char **argv)
+#endif
 {
 	SYS_SystemHandle syshandle;
-	bContext *C= CTX_create();
+	bContext *C = CTX_create();
 	bArgs *ba;
 
+#ifdef WIN32
+	wchar_t **argv_16 = CommandLineToArgvW(GetCommandLineW(), &argc);
+	int argci = 0;
+	char **argv = MEM_mallocN(argc * sizeof(char *), "argv array");
+	for (argci = 0; argci < argc; argci++) {
+		argv[argci] = alloc_utf_8_from_16(argv_16[argci], 0);
+	}
+	LocalFree(argv_16);
+#endif	
+
 #ifdef WITH_PYTHON_MODULE
 #ifdef __APPLE__
 	environ = *_NSGetEnviron();
 #endif
 
 #undef main
-	evil_C= C;
+	evil_C = C;
 #endif
 
+
+
 #ifdef WITH_BINRELOC
-	br_init( NULL );
+	br_init(NULL);
 #endif
 
 #ifdef WITH_LIBMV
@@ -1142,16 +1210,16 @@ int main(int argc, const char **argv)
 
 	setCallbacks();
 #if defined(__APPLE__) && !defined(WITH_PYTHON_MODULE)
-		/* patch to ignore argument finder gives us (pid?) */
-	if (argc==2 && strncmp(argv[1], "-psn_", 5)==0) {
+	/* patch to ignore argument finder gives us (pid?) */
+	if (argc == 2 && strncmp(argv[1], "-psn_", 5) == 0) {
 		extern int GHOST_HACK_getFirstFile(char buf[]);
 		static char firstfilebuf[512];
 
-		argc= 1;
+		argc = 1;
 
 		if (GHOST_HACK_getFirstFile(firstfilebuf)) {
-			argc= 2;
-			argv[1]= firstfilebuf;
+			argc = 2;
+			argv[1] = firstfilebuf;
 		}
 	}
 
@@ -1161,7 +1229,7 @@ int main(int argc, const char **argv)
 	fpsetmask(0);
 #endif
 
-	// initialize path to executable
+	/* initialize path to executable */
 	BLI_init_program_path(argv[0]);
 
 	BLI_threadapi_init();
@@ -1169,14 +1237,14 @@ int main(int argc, const char **argv)
 	RNA_init();
 	RE_engines_init();
 
-		/* Hack - force inclusion of the plugin api functions,
-		 * see blenpluginapi:pluginapi.c
-		 */
+	/* Hack - force inclusion of the plugin api functions,
+	 * see blenpluginapi:pluginapi.c
+	 */
 	pluginapi_force_ref();
 
 	init_nodesystem();
 	
-	initglobals();	/* blender.c */
+	initglobals();  /* blender.c */
 
 	IMB_init();
 
@@ -1185,49 +1253,49 @@ int main(int argc, const char **argv)
 #ifdef WITH_GAMEENGINE
 	syshandle = SYS_GetSystem();
 #else
-	syshandle= 0;
+	syshandle = 0;
 #endif
 
 	/* first test for background */
-	ba = BLI_argsInit(argc, argv); /* skip binary path */
+	ba = BLI_argsInit(argc, (const char **)argv); /* skip binary path */
 	setupArguments(C, ba, &syshandle);
 
 	BLI_argsParse(ba, 1, NULL, NULL);
 
 #if defined(WITH_PYTHON_MODULE) || defined(WITH_HEADLESS)
-	G.background= 1; /* python module mode ALWAYS runs in background mode (for now) */
+	G.background = 1; /* python module mode ALWAYS runs in background mode (for now) */
 #else
 	/* for all platforms, even windos has it! */
-	if(G.background) signal(SIGINT, blender_esc);	/* ctrl c out bg render */
+	if (G.background) signal(SIGINT, blender_esc);  /* ctrl c out bg render */
 #endif
 
 	/* background render uses this font too */
 	BKE_font_register_builtin(datatoc_Bfont, datatoc_Bfont_size);
 
-	/* Initialiaze ffmpeg if built in, also needed for bg mode if videos are
-	   rendered via ffmpeg */
+	/* Initialize ffmpeg if built in, also needed for bg mode if videos are
+	 * rendered via ffmpeg */
 	sound_init_once();
 	
 	init_def_material();
 
-	if(G.background==0) {
+	if (G.background == 0) {
 		BLI_argsParse(ba, 2, NULL, NULL);
 		BLI_argsParse(ba, 3, NULL, NULL);
 
-		WM_init(C, argc, argv);
+		WM_init(C, argc, (const char **)argv);
 
 		/* this is properly initialized with user defs, but this is default */
 		/* call after loading the startup.blend so we can read U.tempdir */
 		BLI_init_temporary_dir(U.tempdir);
 
 #ifdef WITH_SDL
-	BLI_setenv("SDL_VIDEODRIVER", "dummy");
+		BLI_setenv("SDL_VIDEODRIVER", "dummy");
 #endif
 	}
 	else {
 		BLI_argsParse(ba, 3, NULL, NULL);
 
-		WM_init(C, argc, argv);
+		WM_init(C, argc, (const char **)argv);
 
 		/* don't use user preferences temp dir */
 		BLI_init_temporary_dir(NULL);
@@ -1236,10 +1304,8 @@ int main(int argc, const char **argv)
 	/**
 	 * NOTE: the U.pythondir string is NULL until WM_init() is executed,
 	 * so we provide the BPY_ function below to append the user defined
-	 * pythondir to Python's sys.path at this point.  Simply putting
-	 * WM_init() before BPY_python_start() crashes Blender at startup.
-	 * Update: now this function also inits the bpymenus, which also depend
-	 * on U.pythondir.
+	 * python-dir to Python's sys.path at this point.  Simply putting
+	 * WM_init() before #BPY_python_start() crashes Blender at startup.
 	 */
 
 	// TODO - U.pythondir
@@ -1255,34 +1321,35 @@ int main(int argc, const char **argv)
 
 	BLI_argsFree(ba);
 
+#ifdef WIN32
+	while (argci)
+	{
+		free(argv[--argci]);
+	}
+	MEM_freeN(argv);
+	argv = NULL;
+#endif
+
 #ifdef WITH_PYTHON_MODULE
 	return 0; /* keep blender in background mode running */
 #endif
 
-	if(G.background) {
+	if (G.background) {
 		/* actually incorrect, but works for now (ton) */
 		WM_exit(C);
 	}
-
 	else {
-		if((G.fileflags & G_FILE_AUTOPLAY) && (G.f & G_SCRIPT_AUTOEXEC))
-		{
-			if(WM_init_game(C))
+		if ((G.fileflags & G_FILE_AUTOPLAY) && (G.f & G_SCRIPT_AUTOEXEC)) {
+			if (WM_init_game(C))
 				return 0;
 		}
-		else if(!G.file_loaded)
+		else if (!G.file_loaded) {
 			WM_init_splash(C);
+		}
 	}
 
 	WM_main(C);
 
-
-	/*XXX if (scr_init==0) {
-		main_init_screen();
-	}
-	
-	screenmain();*/ /* main display loop */
-
 	return 0;
 } /* end of int main(argc,argv)	*/
 
@@ -1290,14 +1357,14 @@ int main(int argc, const char **argv)
 void main_python_exit(void)
 {
 	WM_exit((bContext *)evil_C);
-	evil_C= NULL;
+	evil_C = NULL;
 }
 #endif
 
 static void error_cb(const char *err)
 {
 	
-	printf("%s\n", err);	/* XXX do this in WM too */
+	printf("%s\n", err);    /* XXX do this in WM too */
 }
 
 static void mem_error_cb(const char *errorStr)
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
index 493516a..8b21138 100644
--- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
+++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
@@ -192,7 +192,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
 		bool mouse_state = startscene->gm.flag & GAME_SHOW_MOUSE;
 		bool restrictAnimFPS = startscene->gm.flag & GAME_RESTRICT_ANIM_UPDATES;
 
-		if(animation_record) usefixed= true; /* override since you's always want fixed time for sim recording */
+		if (animation_record) usefixed= false; /* override since you don't want to run full-speed for sim recording */
 
 		// create the canvas, rasterizer and rendertools
 		RAS_ICanvas* canvas = new KX_BlenderCanvas(win, area_rect, ar);
@@ -205,7 +205,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
 		RAS_IRenderTools* rendertools = new KX_BlenderRenderTools();
 		RAS_IRasterizer* rasterizer = NULL;
 		
-		if(displaylists) {
+		if (displaylists) {
 			if (GLEW_VERSION_1_1 && !novertexarrays)
 				rasterizer = new RAS_ListRasterizer(canvas, true, true);
 			else
@@ -254,7 +254,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
 		int tmp_lay= startscene->lay;
 		Object *tmp_camera = startscene->camera;
 
-		if (v3d->scenelock==0){
+		if (v3d->scenelock==0) {
 			startscene->lay= v3d->lay;
 			startscene->camera= v3d->camera;
 		}
@@ -263,13 +263,13 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
 		float camzoom;
 		int draw_letterbox = 0;
 		
-		if(rv3d->persp==RV3D_CAMOB) {
-			if(startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) { /* Letterbox */
+		if (rv3d->persp==RV3D_CAMOB) {
+			if (startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) { /* Letterbox */
 				camzoom = 1.0f;
 				draw_letterbox = 1;
 			}
 			else {
-				camzoom = 1.0 / BKE_screen_view3d_zoom_to_fac(rv3d->camzoom);
+				camzoom = 1.0f / BKE_screen_view3d_zoom_to_fac(rv3d->camzoom);
 			}
 		}
 		else {
@@ -318,7 +318,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
 				blenderdata = bfd->main;
 				startscenename = bfd->curscene->id.name + 2;
 
-				if(blenderdata) {
+				if (blenderdata) {
 					BLI_strncpy(G.main->name, blenderdata->name, sizeof(G.main->name));
 					BLI_strncpy(pathname, blenderdata->name, sizeof(pathname));
 #ifdef WITH_PYTHON
@@ -341,7 +341,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
 			ketsjiengine->SetAnimRecordMode(animation_record, startFrame);
 			
 			// Quad buffered needs a special window.
-			if(scene->gm.stereoflag == STEREO_ENABLED){
+			if (scene->gm.stereoflag == STEREO_ENABLED) {
 				if (scene->gm.stereomode != RAS_IRasterizer::RAS_STEREO_QUADBUFFERED)
 					rasterizer->SetStereoMode((RAS_IRasterizer::StereoMode) scene->gm.stereomode);
 
@@ -359,7 +359,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
 				ketsjiengine->SetCameraOverrideUseOrtho((rv3d->persp == RV3D_ORTHO));
 				ketsjiengine->SetCameraOverrideProjectionMatrix(MT_CmMatrix4x4(rv3d->winmat));
 				ketsjiengine->SetCameraOverrideViewMatrix(MT_CmMatrix4x4(rv3d->viewmat));
-				if(rv3d->persp == RV3D_ORTHO)
+				if (rv3d->persp == RV3D_ORTHO)
 				{
 					ketsjiengine->SetCameraOverrideClipping(-v3d->far, v3d->far);
 				}
@@ -379,17 +379,17 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
 
 			bool usemat = false, useglslmat = false;
 
-			if(GLEW_ARB_multitexture && GLEW_VERSION_1_1)
+			if (GLEW_ARB_multitexture && GLEW_VERSION_1_1)
 				usemat = true;
 
-			if(GPU_glsl_support())
+			if (GPU_glsl_support())
 				useglslmat = true;
-			else if(gs.matmode == GAME_MAT_GLSL)
+			else if (gs.matmode == GAME_MAT_GLSL)
 				usemat = false;
 
-			if(usemat && (gs.matmode != GAME_MAT_TEXFACE))
+			if (usemat && (gs.matmode != GAME_MAT_TEXFACE))
 				sceneconverter->SetMaterials(true);
-			if(useglslmat && (gs.matmode == GAME_MAT_GLSL))
+			if (useglslmat && (gs.matmode == GAME_MAT_GLSL))
 				sceneconverter->SetGLSLMaterials(true);
 					
 			KX_Scene* startscene = new KX_Scene(keyboarddevice,
@@ -406,12 +406,12 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
 #endif // WITH_PYTHON
 
 			//initialize Dome Settings
-			if(scene->gm.stereoflag == STEREO_DOME)
+			if (scene->gm.stereoflag == STEREO_DOME)
 				ketsjiengine->InitDome(scene->gm.dome.res, scene->gm.dome.mode, scene->gm.dome.angle, scene->gm.dome.resbuf, scene->gm.dome.tilt, scene->gm.dome.warptext);
 
 			// initialize 3D Audio Settings
 			AUD_I3DDevice* dev = AUD_get3DDevice();
-			if(dev)
+			if (dev)
 			{
 				dev->setSpeedOfSound(scene->audio.speed_of_sound);
 				dev->setDopplerFactor(scene->audio.doppler_factor);
@@ -457,7 +457,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
 					
 					if (render)
 					{
-						if(draw_letterbox) {
+						if (draw_letterbox) {
 							// Clear screen to border color
 							// We do this here since we set the canvas to be within the frames. This means the engine
 							// itself is unaware of the extra space, so we clear the whole region for it.
@@ -502,7 +502,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
 						wm_event_free(event);
 					}
 					
-					if(win != CTX_wm_window(C)) {
+					if (win != CTX_wm_window(C)) {
 						exitrequested= KX_EXIT_REQUEST_OUTSIDE; /* window closed while bge runs */
 					}
 				}
@@ -552,12 +552,12 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
 #endif
 		}
 		//lock frame and camera enabled - restoring global values
-		if (v3d->scenelock==0){
+		if (v3d->scenelock==0) {
 			startscene->lay= tmp_lay;
 			startscene->camera= tmp_camera;
 		}
 
-		if(exitrequested != KX_EXIT_REQUEST_OUTSIDE)
+		if (exitrequested != KX_EXIT_REQUEST_OUTSIDE)
 		{
 			// set the cursor back to normal
 			canvas->SetMouseState(RAS_ICanvas::MOUSE_NORMAL);
diff --git a/source/gameengine/BlenderRoutines/BL_System.cpp b/source/gameengine/BlenderRoutines/BL_System.cpp
index a97d1a6..251182a 100644
--- a/source/gameengine/BlenderRoutines/BL_System.cpp
+++ b/source/gameengine/BlenderRoutines/BL_System.cpp
@@ -44,7 +44,7 @@ static SingletonSystem *_system_instance = NULL;
 
 SYS_SystemHandle SYS_GetSystem()
 {
-	if(!_system_instance)
+	if (!_system_instance)
 		_system_instance = new SingletonSystem();
 
 	return (SYS_SystemHandle)_system_instance;
@@ -52,7 +52,7 @@ SYS_SystemHandle SYS_GetSystem()
 
 void SYS_DeleteSystem(SYS_SystemHandle sys)
 {
-	if(_system_instance) {
+	if (_system_instance) {
 		delete _system_instance;
 		_system_instance = NULL;
 	}
@@ -61,7 +61,7 @@ void SYS_DeleteSystem(SYS_SystemHandle sys)
 int SYS_GetCommandLineInt(SYS_SystemHandle sys, const char *paramname, int defaultvalue)
 {
 	int *result = ((SingletonSystem *)sys)->int_params[paramname];
-	if(result)
+	if (result)
 		return *result;
 
 	return defaultvalue;
@@ -70,7 +70,7 @@ int SYS_GetCommandLineInt(SYS_SystemHandle sys, const char *paramname, int defau
 float SYS_GetCommandLineFloat(SYS_SystemHandle sys, const char *paramname, float defaultvalue)
 {
 	float *result = ((SingletonSystem *)sys)->float_params[paramname];
-	if(result)
+	if (result)
 		return *result;
 
 	return defaultvalue;
@@ -79,7 +79,7 @@ float SYS_GetCommandLineFloat(SYS_SystemHandle sys, const char *paramname, float
 const char *SYS_GetCommandLineString(SYS_SystemHandle sys, const char *paramname, const char *defaultvalue)
 {
 	STR_String *result = ((SingletonSystem *)sys)->string_params[paramname];
-	if(result)
+	if (result)
 		return *result;
 
 	return defaultvalue;
diff --git a/source/gameengine/BlenderRoutines/BL_System.h b/source/gameengine/BlenderRoutines/BL_System.h
index 7e523ea..b9f5139 100644
--- a/source/gameengine/BlenderRoutines/BL_System.h
+++ b/source/gameengine/BlenderRoutines/BL_System.h
@@ -31,8 +31,8 @@
  *  \ingroup blroutines
  */
 
-#ifndef BL_SYSTEM_H
-#define BL_SYSTEM_H
+#ifndef __BL_SYSTEM_H__
+#define __BL_SYSTEM_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -66,5 +66,5 @@ extern void StartKetsjiShell(struct bContext *C, struct ARegion *ar,
 }
 #endif
 
-#endif /* BL_SYSTEM_H */
+#endif /* __BL_SYSTEM_H__ */
 
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
index 7e7b3d2..6236923 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
@@ -39,6 +39,8 @@ KX_BlenderCanvas::KX_BlenderCanvas(struct wmWindow *win, RAS_Rect &rect, struct
 m_win(win),
 m_frame_rect(rect)
 {
+	// initialize area so that it's available for game logic on frame 1 (ImageViewport)
+	m_area_rect = rect;
 	// area boundaries needed for mouse coordinates in Letterbox framing mode
 	m_area_left = ar->winrct.xmin;
 	m_area_top = ar->winrct.ymax;
@@ -139,7 +141,7 @@ float KX_BlenderCanvas::GetMouseNormalizedY(int y)
 RAS_Rect &
 KX_BlenderCanvas::
 GetWindowArea(
-){
+) {
 	return m_area_rect;
 }	
 
@@ -148,7 +150,7 @@ KX_BlenderCanvas::
 SetViewPort(
 	int x1, int y1,
 	int x2, int y2
-){
+) {
 	/*	x1 and y1 are the min pixel coordinate (e.g. 0)
 		x2 and y2 are the max pixel coordinate
 		the width,height is calculated including both pixels
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h
index 44dffb5..a9a12f5 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h
@@ -29,8 +29,8 @@
  *  \ingroup blroutines
  */
 
-#ifndef __KX_BLENDERCANVAS
-#define __KX_BLENDERCANVAS
+#ifndef __KX_BLENDERCANVAS_H__
+#define __KX_BLENDERCANVAS_H__
 
 #ifdef WIN32
 #include <windows.h>
@@ -65,7 +65,7 @@ private:
 public:
 	/* Construct a new canvas.
 	 * 
-	 * @param area The Blender ARegion to run the game within.
+	 * \param area The Blender ARegion to run the game within.
 	 */
 	KX_BlenderCanvas(struct wmWindow* win, class RAS_Rect &rect, struct ARegion* ar);
 	~KX_BlenderCanvas();
@@ -106,11 +106,11 @@ public:
 
 		int 
 	GetWidth(
-	) const ;
+	) const;
 
 		int 
 	GetHeight(
-	) const ;
+	) const;
 
 		int
 	GetMouseX(int x
@@ -200,5 +200,5 @@ public:
 #endif
 };
 
-#endif // __KX_BLENDERCANVAS
+#endif // __KX_BLENDERCANVAS_H__
 
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
index 7a99a4a..19a84ac 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
@@ -95,34 +95,34 @@ 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);
+	if (glIsEnabled(GL_BLEND)) glDisable(GL_BLEND);
+	if (glIsEnabled(GL_ALPHA_TEST)) glDisable(GL_ALPHA_TEST);
 
-	if(glIsEnabled(GL_LIGHTING)) {
+	if (glIsEnabled(GL_LIGHTING)) {
 		glDisable(GL_LIGHTING);
 		glDisable(GL_COLOR_MATERIAL);
 	}
 
-	if(GLEW_ARB_multitexture) {
-		for(int i=0; i<MAXTEX; i++) {
+	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))
+			if (GLEW_ARB_texture_cube_map)
+				if (glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB))
 					glDisable(GL_TEXTURE_CUBE_MAP_ARB);
 
-			if(glIsEnabled(GL_TEXTURE_2D))
+			if (glIsEnabled(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))
+		if (GLEW_ARB_texture_cube_map)
+			if (glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB))
 				glDisable(GL_TEXTURE_CUBE_MAP_ARB);
 
-		if(glIsEnabled(GL_TEXTURE_2D))
+		if (glIsEnabled(GL_TEXTURE_2D))
 			glDisable(GL_TEXTURE_2D);
 	}
 }
@@ -261,7 +261,7 @@ void BL_MakeScreenShot(ScrArea *curarea, const char* filename)
 	int dumpsx, dumpsy;
 	
 	dumprect= screenshot(curarea, &dumpsx, &dumpsy);
-	if(dumprect) {
+	if (dumprect) {
 		ImBuf *ibuf;
 		BLI_path_abs(path, G.main->name);
 		/* BKE_add_image_extension() checks for if extension was already set */
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderGL.h b/source/gameengine/BlenderRoutines/KX_BlenderGL.h
index 6d8e240..3b89538 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderGL.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderGL.h
@@ -29,8 +29,8 @@
  *  \ingroup blroutines
  */
 
-#ifndef __BLENDERGL
-#define __BLENDERGL
+#ifndef __KX_BLENDERGL_H__
+#define __KX_BLENDERGL_H__
 
 #ifdef __cplusplus
 extern "C" {
@@ -60,5 +60,5 @@ void BL_print_gamedebug_line_padded(const char* text, int xco, int yco, int widt
 }
 #endif //__cplusplus
 
-#endif //__BLENDERGL
+#endif //__KX_BLENDERGL_H__
 
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h b/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h
index 93bf133..18f163d 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h
@@ -29,8 +29,8 @@
  *  \ingroup blroutines
  */
 
-#ifndef __KX_BLENDERINPUTDEVICE
-#define __KX_BLENDERINPUTDEVICE
+#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
@@ -77,5 +77,5 @@ public:
 	void operator delete(void *mem) { MEM_freeN(mem); }
 #endif
 };
-#endif //__KX_BLENDERINPUTDEVICE
+#endif //__KX_BLENDERINPUTDEVICE_H__
 
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h b/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h
index 3039e69..84991b9 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h
@@ -29,8 +29,8 @@
  *  \ingroup blroutines
  */
 
-#ifndef __KX_BLENDERKEYBOARDDEVICE
-#define __KX_BLENDERKEYBOARDDEVICE
+#ifndef __KX_BLENDERKEYBOARDDEVICE_H__
+#define __KX_BLENDERKEYBOARDDEVICE_H__
 
 #include "KX_BlenderInputDevice.h"
 
@@ -61,5 +61,5 @@ public:
 #endif
 };
 
-#endif //__KX_BLENDERKEYBOARDDEVICE
+#endif //__KX_BLENDERKEYBOARDDEVICE_H__
 
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp b/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp
index 718db0b..5cd2038 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.cpp
@@ -98,7 +98,7 @@ void	KX_BlenderMouseDevice::NextFrame()
 			if (oldevent.m_status == SCA_InputEvent::KX_JUSTRELEASED)
 			{
 				
-				m_eventStatusTables[m_currentTable][mousemove].m_status = SCA_InputEvent::KX_NO_INPUTSTATUS ;
+				m_eventStatusTables[m_currentTable][mousemove].m_status = SCA_InputEvent::KX_NO_INPUTSTATUS;
 			}
 		}
 	}
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.h b/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.h
index 9f0277f..1c54b2f 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderMouseDevice.h
@@ -29,8 +29,8 @@
  *  \ingroup blroutines
  */
 
-#ifndef __KX_BLENDERMOUSEDEVICE
-#define __KX_BLENDERMOUSEDEVICE
+#ifndef __KX_BLENDERMOUSEDEVICE_H__
+#define __KX_BLENDERMOUSEDEVICE_H__
 
 #include "KX_BlenderInputDevice.h"
 
@@ -57,5 +57,5 @@ public:
 #endif
 };
 
-#endif //__KX_BLENDERMOUSEDEVICE
+#endif //__KX_BLENDERMOUSEDEVICE_H__
 
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
index 43166c0..9156102 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
+++ b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
@@ -92,23 +92,23 @@ void KX_BlenderRenderTools::ProcessLighting(RAS_IRasterizer *rasty, bool useligh
 	int layer= -1;
 
 	/* find the layer */
-	if(uselights) {
-		if(m_clientobject)
+	if (uselights) {
+		if (m_clientobject)
 			layer = static_cast<KX_GameObject*>(m_clientobject)->GetLayer();
 	}
 
 	/* avoid state switching */
-	if(m_lastlightlayer == layer && m_lastauxinfo == m_auxilaryClientInfo)
+	if (m_lastlightlayer == layer && m_lastauxinfo == m_auxilaryClientInfo)
 		return;
 
 	m_lastlightlayer = layer;
 	m_lastauxinfo = m_auxilaryClientInfo;
 
 	/* enable/disable lights as needed */
-	if(layer >= 0)
+	if (layer >= 0)
 		enable = applyLights(layer, viewmat);
 
-	if(enable)
+	if (enable)
 		EnableOpenGLLights(rasty);
 	else
 		DisableOpenGLLights();
@@ -116,7 +116,7 @@ void KX_BlenderRenderTools::ProcessLighting(RAS_IRasterizer *rasty, bool useligh
 
 void KX_BlenderRenderTools::EnableOpenGLLights(RAS_IRasterizer *rasty)
 {
-	if(m_lastlighting == true)
+	if (m_lastlighting == true)
 		return;
 
 	glEnable(GL_LIGHTING);
@@ -133,7 +133,7 @@ void KX_BlenderRenderTools::EnableOpenGLLights(RAS_IRasterizer *rasty)
 
 void KX_BlenderRenderTools::DisableOpenGLLights()
 {
-	if(m_lastlighting == false)
+	if (m_lastlighting == false)
 		return;
 
 	glDisable(GL_LIGHTING);
@@ -297,7 +297,7 @@ void KX_BlenderRenderTools::RenderText2D(RAS_TEXT_RENDER_MODE mode,
 										 int width,
 										 int height)
 {
-	if(mode == RAS_IRenderTools::RAS_TEXT_PADDED)
+	if (mode == RAS_IRenderTools::RAS_TEXT_PADDED)
 		BL_print_gamedebug_line_padded(text, xco, yco, width, height);
 	else
 		BL_print_gamedebug_line(text, xco, yco, width, height);
@@ -317,7 +317,7 @@ void KX_BlenderRenderTools::RenderText(
 	struct MTFace* tface = 0;
 	unsigned int *col = 0;
 
-	if(flag & RAS_BLENDERMAT) {
+	if (flag & RAS_BLENDERMAT) {
 		KX_BlenderMaterial *bl_mat = static_cast<KX_BlenderMaterial*>(polymat);
 		tface = bl_mat->GetMTFace();
 		col = bl_mat->GetMCol();
@@ -350,7 +350,7 @@ int KX_BlenderRenderTools::applyLights(int objectlayer, const MT_Transform& view
 	unsigned int count;
 	std::vector<struct	RAS_LightObject*>::iterator lit = m_lights.begin();
 
-	for(count=0; count<m_numgllights; count++)
+	for (count=0; count<m_numgllights; count++)
 		glDisable((GLenum)(GL_LIGHT0+count));
 
 	viewmat.getValue(glviewmat);
@@ -362,7 +362,7 @@ int KX_BlenderRenderTools::applyLights(int objectlayer, const MT_Transform& view
 		RAS_LightObject* lightdata = (*lit);
 		KX_LightObject *kxlight = (KX_LightObject*)lightdata->m_light;
 
-		if(kxlight->ApplyLight(kxscene, objectlayer, count))
+		if (kxlight->ApplyLight(kxscene, objectlayer, count))
 			count++;
 	}
 	glPopMatrix();
@@ -374,16 +374,16 @@ void KX_BlenderRenderTools::MotionBlur(RAS_IRasterizer* rasterizer)
 {
 	int state = rasterizer->GetMotionBlurState();
 	float motionblurvalue;
-	if(state)
+	if (state)
 	{
 		motionblurvalue = rasterizer->GetMotionBlurValue();
-		if(state==1)
+		if (state==1)
 		{
 			//bugfix:load color buffer into accum buffer for the first time(state=1)
 			glAccum(GL_LOAD, 1.0);
 			rasterizer->SetMotionBlurState(2);
 		}
-		else if(motionblurvalue>=0.0 && motionblurvalue<=1.0)
+		else if (motionblurvalue>=0.0 && motionblurvalue<=1.0)
 		{
 			glAccum(GL_MULT, motionblurvalue);
 			glAccum(GL_ACCUM, 1-motionblurvalue);
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h
index f259e0c..a470e02 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h
@@ -29,8 +29,8 @@
  *  \ingroup blroutines
  */
 
-#ifndef __KX_BLENDERRENDERTOOLS
-#define __KX_BLENDERRENDERTOOLS
+#ifndef __KX_BLENDERRENDERTOOLS_H__
+#define __KX_BLENDERRENDERTOOLS_H__
 
 #if defined(WIN32) && !defined(FREE_WINDOWS)
 // don't show stl-warnings
@@ -114,7 +114,7 @@ public:
 #endif
 };
 
-#endif //__KX_BLENDERRENDERTOOLS
+#endif //__KX_BLENDERRENDERTOOLS_H__
 
 
 
diff --git a/source/gameengine/BlenderRoutines/KX_BlenderSystem.h b/source/gameengine/BlenderRoutines/KX_BlenderSystem.h
index 526a7b1..2674c9a 100644
--- a/source/gameengine/BlenderRoutines/KX_BlenderSystem.h
+++ b/source/gameengine/BlenderRoutines/KX_BlenderSystem.h
@@ -30,8 +30,8 @@
  *  \brief Blender System embedding. Needed when gameengine runs embedded within Blender.
  */
 
-#ifndef __KX_BLENDERSYSTEM
-#define __KX_BLENDERSYSTEM
+#ifndef __KX_BLENDERSYSTEM_H__
+#define __KX_BLENDERSYSTEM_H__
 
 #include "KX_ISystem.h"
 
@@ -45,7 +45,7 @@ class KX_BlenderSystem : public KX_ISystem
 
 public:
 	KX_BlenderSystem();
-	virtual ~KX_BlenderSystem() {};
+	virtual ~KX_BlenderSystem() {}
 	virtual double GetTimeInSeconds();
 
 #ifdef WITH_CXX_GUARDEDALLOC
@@ -55,5 +55,5 @@ public:
 #endif
 };
 
-#endif //__KX_BLENDERSYSTEM
+#endif //__KX_BLENDERSYSTEM_H__
 
diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp
index 1d4edb4..6137920 100644
--- a/source/gameengine/Converter/BL_ActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ActionActuator.cpp
@@ -175,7 +175,8 @@ void BL_ActionActuator::ResetStartTime(float curtime)
 	//SetLocalTime(curtime);
 }
 
-CValue* BL_ActionActuator::GetReplica() {
+CValue* BL_ActionActuator::GetReplica()
+{
 	BL_ActionActuator* replica = new BL_ActionActuator(*this);//m_float,GetName());
 	replica->ProcessReplica();
 	return replica;
@@ -364,14 +365,14 @@ PyObject* BL_ActionActuator::PyGetChannel(PyObject* value)
 	
 	bPoseChannel *pchan;
 	
-	if(m_userpose==NULL && m_pose==NULL) {
+	if (m_userpose==NULL && m_pose==NULL) {
 		BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent();
 		obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
 	}
 	
-	// get_pose_channel accounts for NULL pose, run on both incase one exists but
+	// get_pose_channel accounts for NULL pose, run on both in case one exists but
 	// the channel doesnt
-	if(		!(pchan=get_pose_channel(m_userpose, string)) &&
+	if (		!(pchan=get_pose_channel(m_userpose, string)) &&
 			!(pchan=get_pose_channel(m_pose, string))  )
 	{
 		PyErr_SetString(PyExc_ValueError, "channel doesnt exist");
@@ -400,12 +401,12 @@ PyObject* BL_ActionActuator::PyGetChannel(PyObject* value)
 	PyTuple_SET_ITEM(ret, 2, list);
 
 	return ret;
-/*
+#if 0
 	return Py_BuildValue("([fff][fff][ffff])",
 		pchan->loc[0], pchan->loc[1], pchan->loc[2],
 		pchan->size[0], pchan->size[1], pchan->size[2],
 		pchan->quat[0], pchan->quat[1], pchan->quat[2], pchan->quat[3] );
-*/
+#endif
 }
 
 /*     setChannel                                                         */
@@ -427,11 +428,11 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel,
 		return NULL;
 	}
 	
-	if(PyTuple_Size(args)==2) {
+	if (PyTuple_Size(args)==2) {
 		if (!PyArg_ParseTuple(args,"sO:setChannel", &string, &pymat)) // matrix
 			return NULL;
 	}
-	else if(PyTuple_Size(args)==4) {
+	else if (PyTuple_Size(args)==4) {
 		if (!PyArg_ParseTuple(args,"sOOO:setChannel", &string, &pyloc, &pysize, &pyquat)) // loc/size/quat
 			return NULL;
 	}
@@ -440,11 +441,11 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel,
 		return NULL;
 	}
 	
-	if(pymat) {
+	if (pymat) {
 		float matrix[4][4];
 		MT_Matrix4x4 mat;
 		
-		if(!PyMatTo(pymat, mat))
+		if (!PyMatTo(pymat, mat))
 			return NULL;
 		
 		mat.getValue((float*)matrix);
@@ -452,14 +453,14 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel,
 		BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent();
 		
 		if (!m_userpose) {
-			if(!m_pose)
+			if (!m_pose)
 				obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
 			game_copy_pose(&m_userpose, m_pose, 0);
 		}
 		// pchan= verify_pose_channel(m_userpose, string); // adds the channel if its not there.
 		pchan= get_pose_channel(m_userpose, string); // adds the channel if its not there.
 		
-		if(pchan) {
+		if (pchan) {
 			copy_v3_v3(pchan->loc, matrix[3]);
 			mat4_to_size(pchan->size, matrix);
 			mat4_to_quat(pchan->quat, matrix);
@@ -475,7 +476,7 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel,
 		
 		// same as above
 		if (!m_userpose) {
-			if(!m_pose)
+			if (!m_pose)
 				obj->GetPose(&m_pose); /* Get the underlying pose from the armature */
 			game_copy_pose(&m_userpose, m_pose, 0);
 		}
@@ -483,14 +484,14 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel,
 		pchan= get_pose_channel(m_userpose, string); // adds the channel if its not there.
 		
 		// for some reason loc.setValue(pchan->loc) fails
-		if(pchan) {
+		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 */
 		}
 	}
 	
-	if(pchan==NULL) {
+	if (pchan==NULL) {
 		PyErr_SetString(PyExc_ValueError, "Channel could not be found, use the 'channelNames' attribute to get a list of valid channels");
 		return NULL;
 	}
@@ -594,9 +595,9 @@ PyObject* BL_ActionActuator::pyattr_get_channel_names(void *self_v, const KX_PYA
 
 	bPose *pose= ((BL_ArmatureObject*)self->GetParent())->GetOrigPose();
 	
-	if(pose) {
+	if (pose) {
 		bPoseChannel *pchan;
-		for(pchan= (bPoseChannel *)pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) {
+		for (pchan= (bPoseChannel *)pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) {
 			item= PyUnicode_FromString(pchan->name);
 			PyList_Append(ret, item);
 			Py_DECREF(item);
diff --git a/source/gameengine/Converter/BL_ActionActuator.h b/source/gameengine/Converter/BL_ActionActuator.h
index 2930028..640a9a9 100644
--- a/source/gameengine/Converter/BL_ActionActuator.h
+++ b/source/gameengine/Converter/BL_ActionActuator.h
@@ -29,8 +29,8 @@
  *  \ingroup bgeconv
  */
 
-#ifndef BL_ACTIONACTUATOR
-#define BL_ACTIONACTUATOR
+#ifndef __BL_ACTIONACTUATOR_H__
+#define __BL_ACTIONACTUATOR_H__
 
 #include "CTR_HashedPtr.h"
 #include "SCA_IActuator.h"
diff --git a/source/gameengine/Converter/BL_ArmatureActuator.cpp b/source/gameengine/Converter/BL_ArmatureActuator.cpp
index 73403ba..3f4a261 100644
--- a/source/gameengine/Converter/BL_ArmatureActuator.cpp
+++ b/source/gameengine/Converter/BL_ArmatureActuator.cpp
@@ -53,7 +53,8 @@ BL_ArmatureActuator::BL_ArmatureActuator(SCA_IObject* obj,
 						const char *constraintname,
 						KX_GameObject* targetobj,
 						KX_GameObject* subtargetobj,
-						float weight) :
+						float weight,
+						float influence) :
 	SCA_IActuator(obj, KX_ACT_ARMATURE),
 	m_constraint(NULL),
 	m_gametarget(targetobj),
@@ -61,6 +62,7 @@ BL_ArmatureActuator::BL_ArmatureActuator(SCA_IObject* obj,
 	m_posechannel(posechannel),
 	m_constraintname(constraintname),
 	m_weight(weight),
+	m_influence(influence),
 	m_type(type)
 {
 	if (m_gametarget)
@@ -173,6 +175,10 @@ bool BL_ArmatureActuator::Update(double curtime, bool frame)
 			if (m_constraint)
 				m_constraint->SetWeight(m_weight);
 			break;
+		case ACT_ARM_SETINFLUENCE:
+			if (m_constraint)
+				m_constraint->SetInfluence(m_influence);
+			break;
 		}
 	}
 	return result;
@@ -216,6 +222,7 @@ PyAttributeDef BL_ArmatureActuator::Attributes[] = {
 	KX_PYATTRIBUTE_RW_FUNCTION("target", BL_ArmatureActuator, pyattr_get_object, pyattr_set_object),
 	KX_PYATTRIBUTE_RW_FUNCTION("subtarget", BL_ArmatureActuator, pyattr_get_object, pyattr_set_object),
 	KX_PYATTRIBUTE_FLOAT_RW("weight",0.0f,1.0f,BL_ArmatureActuator,m_weight),
+	KX_PYATTRIBUTE_FLOAT_RW("influence",0.0f,1.0f,BL_ArmatureActuator,m_influence),
 	KX_PYATTRIBUTE_INT_RW("type",0,ACT_ARM_MAXTYPE,false,BL_ArmatureActuator,m_type),
 	{ NULL }	//Sentinel
 };
diff --git a/source/gameengine/Converter/BL_ArmatureActuator.h b/source/gameengine/Converter/BL_ArmatureActuator.h
index 344b76e..638640c 100644
--- a/source/gameengine/Converter/BL_ArmatureActuator.h
+++ b/source/gameengine/Converter/BL_ArmatureActuator.h
@@ -29,8 +29,8 @@
  *  \ingroup bgeconv
  */
 
-#ifndef BL_ARMATUREACTUATOR
-#define BL_ARMATUREACTUATOR
+#ifndef __BL_ARMATUREACTUATOR_H__
+#define __BL_ARMATUREACTUATOR_H__
 
 #include "SCA_IActuator.h"
 #include "BL_ArmatureConstraint.h"
@@ -54,7 +54,8 @@ public:
 						const char *constraintname,
 						KX_GameObject* targetobj,
 						KX_GameObject* subtargetobj,
-						float weight);
+						float weight,
+						float influence);
 
 	virtual ~BL_ArmatureActuator();
 
@@ -88,9 +89,10 @@ private:
 	STR_String		m_posechannel;
 	STR_String		m_constraintname;
 	float			m_weight;
+	float			m_influence;
 	int				m_type;
 };
 
-#endif //BL_ARMATUREACTUATOR
+#endif //__BL_ARMATUREACTUATOR_H__
 
 
diff --git a/source/gameengine/Converter/BL_ArmatureChannel.cpp b/source/gameengine/Converter/BL_ArmatureChannel.cpp
index 80a9db4..f464d6c 100644
--- a/source/gameengine/Converter/BL_ArmatureChannel.cpp
+++ b/source/gameengine/Converter/BL_ArmatureChannel.cpp
@@ -307,7 +307,7 @@ int BL_ArmatureChannel::py_attr_set_joint_rotation(void *self_v, const struct KX
 	float quat[4];
 
 	if (!PySequence_Check(value) || PySequence_Size(value) != 3) {
-		PyErr_SetString(PyExc_AttributeError, "expected a sequence of [3] floats");
+		PyErr_SetString(PyExc_AttributeError, "expected a sequence of 3 floats");
 		return PY_SET_ATTR_FAIL;
 	}
 	for (int i=0; i<3; i++) {
@@ -315,7 +315,7 @@ int BL_ArmatureChannel::py_attr_set_joint_rotation(void *self_v, const struct KX
 		joints[i] = PyFloat_AsDouble(item);
 		Py_DECREF(item);
 		if (joints[i] == -1.0f && PyErr_Occurred()) {
-			PyErr_SetString(PyExc_AttributeError, "expected a sequence of [3] floats");
+			PyErr_SetString(PyExc_AttributeError, "expected a sequence of 3 floats");
 			return PY_SET_ATTR_FAIL;
 		}
 	}
diff --git a/source/gameengine/Converter/BL_ArmatureChannel.h b/source/gameengine/Converter/BL_ArmatureChannel.h
index 585b609..cd38ee2 100644
--- a/source/gameengine/Converter/BL_ArmatureChannel.h
+++ b/source/gameengine/Converter/BL_ArmatureChannel.h
@@ -29,8 +29,8 @@
  *  \ingroup bgeconv
  */
 
-#ifndef __BL_ARMATURECHANNEL
-#define __BL_ARMATURECHANNEL
+#ifndef __BL_ARMATURECHANNEL_H__
+#define __BL_ARMATURECHANNEL_H__
 
 #include "DNA_action_types.h"
 #include "CTR_HashedPtr.h"
@@ -72,8 +72,8 @@ public:
 };
 
 /* this is a factory class to access bBone data field in the GE.
-   It's not supposed to be instantiated, we only need it for the Attributes and Method array.
-   The actual proxy object will be manually created using NewProxyPtr */
+ * It's not supposed to be instantiated, we only need it for the Attributes and Method array.
+ * The actual proxy object will be manually created using NewProxyPtr */
 class BL_ArmatureBone : public PyObjectPlus
 {
 	// use Py_HeaderPtr since we use generic pointer in proxy
@@ -94,5 +94,5 @@ public:
 };
 
 
-#endif //__BL_ARMATURECHANNEL
+#endif //__BL_ARMATURECHANNEL_H__
 
diff --git a/source/gameengine/Converter/BL_ArmatureConstraint.h b/source/gameengine/Converter/BL_ArmatureConstraint.h
index 2abb36f..0d79bb1 100644
--- a/source/gameengine/Converter/BL_ArmatureConstraint.h
+++ b/source/gameengine/Converter/BL_ArmatureConstraint.h
@@ -29,8 +29,8 @@
  *  \ingroup bgeconv
  */
 
-#ifndef __BL_ARMATURECONSTRAINT
-#define __BL_ARMATURECONSTRAINT
+#ifndef __BL_ARMATURECONSTRAINT_H__
+#define __BL_ARMATURECONSTRAINT_H__
 
 #include "DNA_constraint_types.h"
 #include "CTR_HashedPtr.h"
@@ -104,6 +104,11 @@ public:
 			con->weight = weight;
 		}
 	}
+	void SetInfluence(float influence)
+	{
+		if (m_constraint)
+			m_constraint->enforce = influence;
+	}
 	void SetTarget(KX_GameObject* target);
 	void SetSubtarget(KX_GameObject* subtarget);
 
@@ -117,5 +122,5 @@ public:
 #endif // WITH_PYTHON
 };
 
-#endif //__BL_ARMATURECONSTRAINT
+#endif //__BL_ARMATURECONSTRAINT_H__
 
diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp
index 5a44e10..f9ddc25 100644
--- a/source/gameengine/Converter/BL_ArmatureObject.cpp
+++ b/source/gameengine/Converter/BL_ArmatureObject.cpp
@@ -120,8 +120,10 @@ void game_copy_pose(bPose **dst, bPose *src, int copy_constraint)
 		}
 
 		// fails to link, props are not used in the BGE yet.
-		/* if(pchan->prop)
-			pchan->prop= IDP_CopyProperty(pchan->prop); */
+#if 0
+		if (pchan->prop)
+			pchan->prop= IDP_CopyProperty(pchan->prop);
+#endif
 		pchan->prop= NULL;
 	}
 
@@ -144,7 +146,7 @@ void game_blend_poses(bPose *dst, bPose *src, float srcweight/*, short mode*/)
 	float dstweight;
 	int i;
 
-	switch (mode){
+	switch (mode) {
 	case ACTSTRIPMODE_BLEND:
 		dstweight = 1.0F - srcweight;
 		break;
@@ -156,7 +158,7 @@ void game_blend_poses(bPose *dst, bPose *src, float srcweight/*, short mode*/)
 	}
 	
 	schan= (bPoseChannel*)src->chanbase.first;
-	for (dchan = (bPoseChannel*)dst->chanbase.first; dchan; dchan=(bPoseChannel*)dchan->next, schan= (bPoseChannel*)schan->next){
+	for (dchan = (bPoseChannel*)dst->chanbase.first; dchan; dchan=(bPoseChannel*)dchan->next, schan= (bPoseChannel*)schan->next) {
 		// always blend on all channels since we don't know which one has been set
 		/* quat interpolation done separate */
 		if (schan->rotmode == ROT_MODE_QUAT) {
@@ -184,7 +186,7 @@ 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= (bConstraint*)dcon->next, scon= (bConstraint*)scon->next) {
 			/* no 'add' option for constraint blending */
 			dcon->enforce= dcon->enforce*(1.0f-srcweight) + scon->enforce*srcweight;
 		}
@@ -287,6 +289,7 @@ void BL_ArmatureObject::LoadConstraints(KX_BlenderSceneConverter* converter)
 			// which constraint should we support?
 			switch (pcon->type) {
 			case CONSTRAINT_TYPE_TRACKTO:
+			case CONSTRAINT_TYPE_DAMPTRACK:
 			case CONSTRAINT_TYPE_KINEMATIC:
 			case CONSTRAINT_TYPE_ROTLIKE:
 			case CONSTRAINT_TYPE_LOCLIKE:
@@ -466,7 +469,7 @@ void BL_ArmatureObject::ApplyPose()
 	// in the GE, we use ctime to store the timestep
 	m_pose->ctime = (float)m_timestep;
 	//m_scene->r.cfra++;
-	if(m_lastapplyframe != m_lastframe) {
+	if (m_lastapplyframe != m_lastframe) {
 		// update the constraint if any, first put them all off so that only the active ones will be updated
 		SG_DList::iterator<BL_ArmatureConstraint> cit(m_controlledConstraints);
 		for (cit.begin(); !cit.end(); ++cit) {
@@ -499,7 +502,7 @@ void BL_ArmatureObject::SetPose(bPose *pose)
 
 bool BL_ArmatureObject::SetActiveAction(BL_ActionActuator *act, short priority, double curtime)
 {
-	if (curtime != m_lastframe){
+	if (curtime != m_lastframe) {
 		m_activePriority = 9999;
 		// compute the timestep for the underlying IK algorithm
 		m_timestep = curtime-m_lastframe;
@@ -545,11 +548,11 @@ void BL_ArmatureObject::GetPose(bPose **pose)
 	/* Otherwise, copy the armature's pose channels into the caller-supplied pose */
 		
 	if (!*pose) {
-		/*	probably not to good of an idea to
-			duplicate everying, but it clears up 
-			a crash and memory leakage when 
-			&BL_ActionActuator::m_pose is freed
-		*/
+		/* probably not to good of an idea to
+		 * duplicate everything, but it clears up 
+		 * a crash and memory leakage when 
+		 * &BL_ActionActuator::m_pose is freed
+		 */
 		game_copy_pose(pose, m_pose, 0);
 	}
 	else {
@@ -588,7 +591,7 @@ bool BL_ArmatureObject::GetBoneMatrix(Bone* bone, MT_Matrix4x4& matrix)
 
 	ApplyPose();
 	pchan = get_pose_channel(m_objArma->pose, bone->name);
-	if(pchan)
+	if (pchan)
 		matrix.setValue(&pchan->pose_mat[0][0]);
 	RestorePose();
 
diff --git a/source/gameengine/Converter/BL_ArmatureObject.h b/source/gameengine/Converter/BL_ArmatureObject.h
index 745ffac..a6848cf 100644
--- a/source/gameengine/Converter/BL_ArmatureObject.h
+++ b/source/gameengine/Converter/BL_ArmatureObject.h
@@ -29,8 +29,8 @@
  *  \ingroup bgeconv
  */
 
-#ifndef BL_ARMATUREOBJECT
-#define BL_ARMATUREOBJECT
+#ifndef __BL_ARMATUREOBJECT_H__
+#define __BL_ARMATUREOBJECT_H__
 
 #include "KX_GameObject.h"
 #include "BL_ArmatureConstraint.h"
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index c22dc1a..3821650 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -414,7 +414,7 @@ static void SetDefaultLightMode(Scene* scene)
 	Scene *sce_iter;
 	Base *base;
 
-	for(SETLOOPER(scene, sce_iter, base))
+	for (SETLOOPER(scene, sce_iter, base))
 	{
 		if (base->object->type == OB_LAMP)
 		{
@@ -440,7 +440,7 @@ static void GetRGB(short type,
 	{
 		case 0:	// vertex colors
 		{
-			if(mmcol) {
+			if (mmcol) {
 				c0 = KX_Mcol2uint_new(mmcol[0]);
 				c1 = KX_Mcol2uint_new(mmcol[1]);
 				c2 = KX_Mcol2uint_new(mmcol[2]);
@@ -511,7 +511,7 @@ bool ConvertMaterial(
 	bool validface	= (tface!=0);
 	
 	short type = 0;
-	if( validmat )
+	if ( validmat )
 		type = 1; // material color 
 	
 	material->IdMode = DEFAULT_BLENDER;
@@ -519,10 +519,10 @@ bool ConvertMaterial(
 	material->materialindex = mface->mat_nr;
 
 	// --------------------------------
-	if(validmat) {
+	if (validmat) {
 
 		// use vertex colors by explicitly setting
-		if(mat->mode &MA_VERTEXCOLP || glslmat)
+		if (mat->mode &MA_VERTEXCOLP || glslmat)
 			type = 0;
 
 		// use lighting?
@@ -536,24 +536,24 @@ bool ConvertMaterial(
 		int valid_index = 0;
 		
 		/* In Multitexture use the face texture if and only if
-		*  it is set in the buttons
-		*  In GLSL is not working yet :/ 3.2011 */
+		 * it is set in the buttons
+		 * In GLSL is not working yet :/ 3.2011 */
 		bool facetex = false;
-		if(validface && mat->mode &MA_FACETEXTURE) 
+		if (validface && mat->mode &MA_FACETEXTURE) 
 			facetex = true;
 
 		numchan = numchan>MAXTEX?MAXTEX:numchan;
 		if (facetex && numchan == 0) numchan = 1;
 	
 		// foreach MTex
-		for(int i=0; i<numchan; i++) {
+		for (int i=0; i<numchan; i++) {
 			// use face tex
 
-			if(i==0 && facetex ) {
+			if (i==0 && facetex ) {
 				facetex = false;
 				Image*tmp = (Image*)(tface->tpage);
 
-				if(tmp) {
+				if (tmp) {
 					material->img[i] = tmp;
 					material->texname[i] = material->img[i]->id.name;
 					material->flag[i] |= MIPMAP;
@@ -562,12 +562,12 @@ bool ConvertMaterial(
 					material->flag[i] |= ( mat->game.alpha_blend & GEMAT_ALPHA )?USEALPHA:0;
 					material->flag[i] |= ( mat->game.alpha_blend & GEMAT_ADD )?CALCALPHA:0;
 
-					if(material->img[i]->flag & IMA_REFLECT)
+					if (material->img[i]->flag & IMA_REFLECT)
 						material->mapping[i].mapping |= USEREFL;
 					else
 					{
 						mttmp = getImageFromMaterial( mat, i );
-						if(mttmp && mttmp->texco &TEXCO_UV)
+						if (mttmp && mttmp->texco &TEXCO_UV)
 						{
 							STR_String uvName = mttmp->uvname;
 
@@ -589,24 +589,24 @@ bool ConvertMaterial(
 			}
 
 			mttmp = getImageFromMaterial( mat, i );
-			if( mttmp ) {
-				if( mttmp->tex ) {
-					if( mttmp->tex->type == TEX_IMAGE ) {
+			if ( mttmp ) {
+				if ( mttmp->tex ) {
+					if ( mttmp->tex->type == TEX_IMAGE ) {
 						material->mtexname[i] = mttmp->tex->id.name;
 						material->img[i] = mttmp->tex->ima;
-						if( material->img[i] ) {
+						if ( material->img[i] ) {
 
 							material->texname[i] = material->img[i]->id.name;
 							material->flag[i] |= ( mttmp->tex->imaflag &TEX_MIPMAP )?MIPMAP:0;
 							// -----------------------
-							if( mttmp->tex->imaflag &TEX_USEALPHA ) {
+							if ( mttmp->tex->imaflag &TEX_USEALPHA ) {
 								material->flag[i]	|= USEALPHA;
 							}
 							// -----------------------
-							else if( mttmp->tex->imaflag &TEX_CALCALPHA ) {
+							else if ( mttmp->tex->imaflag &TEX_CALCALPHA ) {
 								material->flag[i]	|= CALCALPHA;
 							}
-							else if(mttmp->tex->flag &TEX_NEGALPHA) {
+							else if (mttmp->tex->flag &TEX_NEGALPHA) {
 								material->flag[i]	|= USENEGALPHA;
 							}
 
@@ -614,12 +614,12 @@ bool ConvertMaterial(
 							material->flag[i] |= ( mttmp->mapto  & MAP_ALPHA		)?TEXALPHA:0;
 							material->flag[i] |= ( mttmp->texflag& MTEX_NEGATIVE	)?TEXNEG:0;
 
-							if(!glslmat && (material->flag[i] & TEXALPHA))
+							if (!glslmat && (material->flag[i] & TEXALPHA))
 								texalpha = 1;
 						}
 					}
-					else if(mttmp->tex->type == TEX_ENVMAP) {
-						if( mttmp->tex->env->stype == ENV_LOAD ) {
+					else if (mttmp->tex->type == TEX_ENVMAP) {
+						if ( mttmp->tex->env->stype == ENV_LOAD ) {
 					
 							material->mtexname[i]     = mttmp->tex->id.name;
 							EnvMap *env = mttmp->tex->env;
@@ -636,23 +636,23 @@ bool ConvertMaterial(
 							}
 						}
 					}
-#if 0				/* this flag isnt used anymore */
+#if 0				/* this flag isn't used anymore */
 					material->flag[i] |= (BKE_animdata_from_id(mat->id) != NULL) ? HASIPO : 0;
 #endif
 					/// --------------------------------
 					// mapping methods
 					material->mapping[i].mapping |= ( mttmp->texco  & TEXCO_REFL	)?USEREFL:0;
 					
-					if(mttmp->texco & TEXCO_OBJECT) {
+					if (mttmp->texco & TEXCO_OBJECT) {
 						material->mapping[i].mapping |= USEOBJ;
-						if(mttmp->object)
+						if (mttmp->object)
 							material->mapping[i].objconame = mttmp->object->id.name;
 					}
-					else if(mttmp->texco &TEXCO_REFL)
+					else if (mttmp->texco &TEXCO_REFL)
 						material->mapping[i].mapping |= USEREFL;
-					else if(mttmp->texco &(TEXCO_ORCO|TEXCO_GLOB))
+					else if (mttmp->texco &(TEXCO_ORCO|TEXCO_GLOB))
 						material->mapping[i].mapping |= USEORCO;
-					else if(mttmp->texco &TEXCO_UV)
+					else if (mttmp->texco &TEXCO_UV)
 					{
 						STR_String uvName = mttmp->uvname;
 
@@ -662,9 +662,9 @@ bool ConvertMaterial(
 							material->mapping[i].uvCoName = "";
 						material->mapping[i].mapping |= USEUV;
 					}
-					else if(mttmp->texco &TEXCO_NORM)
+					else if (mttmp->texco &TEXCO_NORM)
 						material->mapping[i].mapping |= USENORM;
-					else if(mttmp->texco &TEXCO_TANGENT)
+					else if (mttmp->texco &TEXCO_TANGENT)
 						material->mapping[i].mapping |= USETANG;
 					else
 						material->mapping[i].mapping |= DISABLE;
@@ -740,15 +740,15 @@ bool ConvertMaterial(
 		int valid = 0;
 
 		// check for tface tex to fallback on
-		if( validface ){
+		if ( validface ) {
 			material->img[0] = (Image*)(tface->tpage);
 			// ------------------------
-			if(material->img[0]) {
+			if (material->img[0]) {
 				material->texname[0] = material->img[0]->id.name;
 				material->mapping[0].mapping |= ( (material->img[0]->flag & IMA_REFLECT)!=0 )?USEREFL:0;
 
 				/* see if depth of the image is 32bits */
-				if(BKE_image_has_alpha(material->img[0])) {
+				if (BKE_image_has_alpha(material->img[0])) {
 					material->flag[0] |= USEALPHA;
 					material->alphablend = GEMAT_ALPHA;
 				}
@@ -784,9 +784,9 @@ bool ConvertMaterial(
 	
 	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( validface ) {
+	/* 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]);
@@ -811,17 +811,17 @@ bool ConvertMaterial(
 	}
 
 	// with ztransp enabled, enforce alpha blending mode
-	if(validmat && (mat->mode & MA_TRANSP) && (mat->mode & MA_ZTRANSP) && (material->alphablend == GEMAT_SOLID))
+	if (validmat && (mat->mode & MA_TRANSP) && (mat->mode & MA_ZTRANSP) && (material->alphablend == GEMAT_SOLID))
 		material->alphablend = GEMAT_ALPHA;
 
 	// always zsort alpha + add
-	if((ELEM3(material->alphablend, GEMAT_ALPHA, GEMAT_ALPHA_SORT, GEMAT_ADD) || texalpha) && (material->alphablend != GEMAT_CLIP )) {
+	if ((ELEM3(material->alphablend, GEMAT_ALPHA, GEMAT_ALPHA_SORT, GEMAT_ADD) || texalpha) && (material->alphablend != GEMAT_CLIP )) {
 		material->ras_mode |= ALPHA;
 		material->ras_mode |= (mat && (mat->game.alpha_blend & GEMAT_ALPHA_SORT))? ZSORT: 0;
 	}
 
 	// get uv sets
-	if(validmat) 
+	if (validmat) 
 	{
 		bool isFirstSet = true;
 
@@ -860,7 +860,7 @@ bool ConvertMaterial(
 							isFirstSet = false;
 							uvName = layer.name;
 						}
-						else if(strcmp(layer.name, uvName) != 0)
+						else if (strcmp(layer.name, uvName) != 0)
 						{
 							uv2[0] = uvSet[0]; uv2[1] = uvSet[1];
 							uv2[2] = uvSet[2]; uv2[3] = uvSet[3];
@@ -889,10 +889,15 @@ bool ConvertMaterial(
 	material->SetConversionUV(uvName, uv);
 	material->SetConversionUV2(uv2Name, uv2);
 
-	if(validmat)
+	if (validmat)
 		material->matname	=(mat->id.name);
 
-	material->tface		= tface;
+	if (tface) {
+		material->tface		= *tface;
+	}
+	else {
+		memset(&material->tface, 0, sizeof(material->tface));
+	}
 	material->material	= mat;
 	return true;
 }
@@ -907,20 +912,21 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
 		return meshobj;
 	// Get DerivedMesh data
 	DerivedMesh *dm = CDDM_from_mesh(mesh, blenderobj);
+	DM_ensure_tessface(dm);
 
 	MVert *mvert = dm->getVertArray(dm);
 	int totvert = dm->getNumVerts(dm);
 
-	MFace *mface = dm->getFaceArray(dm);
-	MTFace *tface = static_cast<MTFace*>(dm->getFaceDataArray(dm, CD_MTFACE));
-	MCol *mcol = static_cast<MCol*>(dm->getFaceDataArray(dm, CD_MCOL));
+	MFace *mface = dm->getTessFaceArray(dm);
+	MTFace *tface = static_cast<MTFace*>(dm->getTessFaceDataArray(dm, CD_MTFACE));
+	MCol *mcol = static_cast<MCol*>(dm->getTessFaceDataArray(dm, CD_MCOL));
 	float (*tangent)[4] = NULL;
-	int totface = dm->getNumFaces(dm);
+	int totface = dm->getNumTessFaces(dm);
 	const char *tfaceName = "";
 
-	if(tface) {
+	if (tface) {
 		DM_add_tangent_layer(dm);
-		tangent = (float(*)[4])dm->getFaceDataArray(dm, CD_TANGENT);
+		tangent = (float(*)[4])dm->getTessFaceDataArray(dm, CD_TANGENT);
 	}
 
 	meshobj = new RAS_MeshObject(mesh);
@@ -941,7 +947,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
 
 			layers[validLayers].face = (MTFace*)(dm->faceData.layers[i].data);
 			layers[validLayers].name = dm->faceData.layers[i].name;
-			if(tface == layers[validLayers].face)
+			if (tface == layers[validLayers].face)
 				tfaceName = layers[validLayers].name;
 			validLayers++;
 		}
@@ -975,7 +981,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
 		pt2.setValue(mvert[mface->v3].co);
 		if (mface->v4) pt3.setValue(mvert[mface->v4].co);
 
-		if(mface->flag & ME_SMOOTH) {
+		if (mface->flag & ME_SMOOTH) {
 			float n0[3], n1[3], n2[3], n3[3];
 
 			normal_short_to_float_v3(n0, mvert[mface->v1].no);
@@ -985,7 +991,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
 			no1 = n1;
 			no2 = n2;
 
-			if(mface->v4) {
+			if (mface->v4) {
 				normal_short_to_float_v3(n3, mvert[mface->v4].no);
 				no3 = n3;
 			}
@@ -993,7 +999,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
 		else {
 			float fno[3];
 
-			if(mface->v4)
+			if (mface->v4)
 				normal_quad_v3( fno,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co, mvert[mface->v4].co);
 			else
 				normal_tri_v3( fno,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co);
@@ -1001,7 +1007,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
 			no0 = no1 = no2 = no3 = MT_Vector3(fno);
 		}
 
-		if(tangent) {
+		if (tangent) {
 			tan0 = tangent[f*4 + 0];
 			tan1 = tangent[f*4 + 1];
 			tan2 = tangent[f*4 + 2];
@@ -1009,13 +1015,13 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
 			if (mface->v4)
 				tan3 = tangent[f*4 + 3];
 		}
-		if(blenderobj)
+		if (blenderobj)
 			ma = give_current_material(blenderobj, mface->mat_nr+1);
 		else
 			ma = mesh->mat ? mesh->mat[mface->mat_nr]:NULL;
 
 		/* ckeck for texface since texface _only_ is used as a fallback */
-		if(ma == NULL && tface == NULL) {
+		if (ma == NULL && tface == NULL) {
 			ma= &defmaterial;
 		}
 
@@ -1023,7 +1029,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
 			bool visible = true;
 			bool twoside = false;
 
-			if(converter->GetMaterials()) {
+			if (converter->GetMaterials()) {
 				/* do Blender Multitexture and Blender GLSL materials */
 				unsigned int rgb[4];
 				MT_Point2 uv[4];
@@ -1070,15 +1076,16 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
 					 * "Texture Face/Singletexture" we can then think about it */
 
 					/* Texture Face mode ignores texture but requires "Face Textures to be True "*/
-					/**
+#if 0
 					if ((ma->mode &MA_FACETEXTURE)==0 && (ma->game.flag &GEMAT_TEXT)==0) {
 						bima = NULL;
 						imastr = "";
 						alpha_blend = GEMAT_SOLID;	 
 					}
-					else
+					else {
 						alpha_blend = ma->game.alpha_blend;
-					*/
+					}
+#endif
 				}
 				/* check for tface tex to fallback on */
 				else {
@@ -1100,7 +1107,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
 				}
 
 				/* set UV properties */
-				if(tface) {
+				if (tface) {
 					uv0.setValue(tface->uv[0]);
 					uv1.setValue(tface->uv[1]);
 					uv2.setValue(tface->uv[2]);
@@ -1202,7 +1209,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
 			if (bucketCreated) {
 				// this is needed to free up memory afterwards
 				converter->RegisterPolyMaterial(polymat);
-				if(converter->GetMaterials()) {
+				if (converter->GetMaterials()) {
 					converter->RegisterBlenderMaterial(bl_mat);
 					// the poly material has been stored in the bucket, next time we must create a new one
 					bl_mat = NULL;
@@ -1252,7 +1259,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
 	meshobj->EndConversion();
 
 	// pre calculate texture generation
-	for(list<RAS_MeshMaterial>::iterator mit = meshobj->GetFirstMaterial();
+	for (list<RAS_MeshMaterial>::iterator mit = meshobj->GetFirstMaterial();
 		mit != meshobj->GetLastMaterial(); ++ mit) {
 		mit->m_bucket->GetPolyMaterial()->OnConstruction(lightlayer);
 	}
@@ -1359,7 +1366,7 @@ static float my_boundbox_mesh(Mesh *me, float *loc, float *size)
 	float radius=0.0f, vert_radius, *co;
 	int a;
 	
-	if(me->bb==0) me->bb= (struct BoundBox *)MEM_callocN(sizeof(BoundBox), "boundbox");
+	if (me->bb==0) me->bb= (struct BoundBox *)MEM_callocN(sizeof(BoundBox), "boundbox");
 	bb= me->bb;
 	
 	INIT_MINMAX(min, max);
@@ -1368,7 +1375,7 @@ static float my_boundbox_mesh(Mesh *me, float *loc, float *size)
 	if (!size) size= msize;
 	
 	mvert= me->mvert;
-	for(a=0; a<me->totvert; a++, mvert++) {
+	for (a=0; a<me->totvert; a++, mvert++) {
 		co= mvert->co;
 		
 		/* bounds */
@@ -1380,7 +1387,7 @@ static float my_boundbox_mesh(Mesh *me, float *loc, float *size)
 			radius= vert_radius;
 	}
 		
-	if(me->totvert) {
+	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;
@@ -1417,18 +1424,18 @@ static void my_tex_space_mesh(Mesh *me)
 
 	my_boundbox_mesh(me, loc, size);
 	
-	if(me->texflag & AUTOSPACE) {
-		if(me->key) {
+	if (me->texflag & ME_AUTOSPACE) {
+		if (me->key) {
 			kb= me->key->refkey;
 			if (kb) {
 
 				INIT_MINMAX(min, max);
 
 				fp= (float *)kb->data;
-				for(a=0; a<kb->totelem; a++, fp+=3) {
+				for (a=0; a<kb->totelem; a++, fp+=3) {
 					DO_MINMAX(fp, min, max);
 				}
-				if(kb->totelem) {
+				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;
 				}
@@ -1444,17 +1451,17 @@ static void my_tex_space_mesh(Mesh *me)
 		copy_v3_v3(me->size, size);
 		me->rot[0]= me->rot[1]= me->rot[2]= 0.0f;
 
-		if(me->size[0]==0.0) me->size[0]= 1.0f;
-		else if(me->size[0]>0.0 && me->size[0]< 0.00001f) me->size[0]= 0.00001f;
-		else if(me->size[0]<0.0 && me->size[0]> -0.00001f) me->size[0]= -0.00001f;
+		if (me->size[0]==0.0) me->size[0]= 1.0f;
+		else if (me->size[0]>0.0 && me->size[0]< 0.00001f) me->size[0]= 0.00001f;
+		else if (me->size[0]<0.0 && me->size[0]> -0.00001f) me->size[0]= -0.00001f;
 
-		if(me->size[1]==0.0) me->size[1]= 1.0f;
-		else if(me->size[1]>0.0 && me->size[1]< 0.00001f) me->size[1]= 0.00001f;
-		else if(me->size[1]<0.0 && me->size[1]> -0.00001f) me->size[1]= -0.00001f;
+		if (me->size[1]==0.0) me->size[1]= 1.0f;
+		else if (me->size[1]>0.0 && me->size[1]< 0.00001f) me->size[1]= 0.00001f;
+		else if (me->size[1]<0.0 && me->size[1]> -0.00001f) me->size[1]= -0.00001f;
 
-		if(me->size[2]==0.0) me->size[2]= 1.0f;
-		else if(me->size[2]>0.0 && me->size[2]< 0.00001f) me->size[2]= 0.00001f;
-		else if(me->size[2]<0.0 && me->size[2]> -0.00001f) me->size[2]= -0.00001f;
+		if (me->size[2]==0.0) me->size[2]= 1.0f;
+		else if (me->size[2]>0.0 && me->size[2]< 0.00001f) me->size[2]= 0.00001f;
+		else if (me->size[2]<0.0 && me->size[2]> -0.00001f) me->size[2]= -0.00001f;
 	}
 	
 }
@@ -1482,7 +1489,7 @@ static void my_get_local_bounds(Object *ob, DerivedMesh *dm, float *center, floa
 			} else
 			{
 				bb= ( (Mesh *)ob->data )->bb;
-				if(bb==0) 
+				if (bb==0) 
 				{
 					my_tex_space_mesh((struct Mesh *)ob->data);
 					bb= ( (Mesh *)ob->data )->bb;
@@ -1503,7 +1510,7 @@ static void my_get_local_bounds(Object *ob, DerivedMesh *dm, float *center, floa
 			break;
 	}
 	
-	if(bb==NULL) 
+	if (bb==NULL) 
 	{
 		center[0]= center[1]= center[2]= 0.0;
 		size[0] = size[1]=size[2]=1.0;
@@ -1832,10 +1839,6 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj,
 			break;
 
 #endif
-		case UseDynamo:
-			//KX_ConvertDynamoObject(gameobj,meshobj,kxscene,shapeprops,	smmaterial,	&objprop);
-			break;
-			
 		case UseNone:
 		default:
 			break;
@@ -1874,7 +1877,7 @@ static KX_LightObject *gamelight_from_blamp(Object *ob, Lamp *la, unsigned int l
 	bool glslmat = converter->GetGLSLMaterials();
 
 	// in GLSL NEGATIVE LAMP is handled inside the lamp update function
-	if(glslmat==0) {
+	if (glslmat==0) {
 		if (la->mode & LA_NEG)
 		{
 			lightobj.m_red = -lightobj.m_red;
@@ -1916,16 +1919,20 @@ static KX_GameObject *gameobject_from_blenderobject(
 								KX_BlenderSceneConverter *converter) 
 {
 	KX_GameObject *gameobj = NULL;
+	Scene *blenderscene = kxscene->GetBlenderScene();
 	
 	switch(ob->type)
 	{
 	case OB_LAMP:
 	{
-		KX_LightObject* gamelight= gamelight_from_blamp(ob, static_cast<Lamp*>(ob->data), ob->lay, kxscene, rendertools, converter);
+		KX_LightObject* gamelight = gamelight_from_blamp(ob, static_cast<Lamp*>(ob->data), ob->lay, kxscene, rendertools, converter);
 		gameobj = gamelight;
 		
-		gamelight->AddRef();
-		kxscene->GetLightList()->Add(gamelight);
+		if (blenderscene->lay & ob->lay)
+		{
+			gamelight->AddRef();
+			kxscene->GetLightList()->Add(gamelight);
+		}
 
 		break;
 	}
@@ -2047,7 +2054,7 @@ static KX_GameObject *gameobject_from_blenderobject(
 		gameobj = new KX_FontObject(kxscene,KX_Scene::m_callbacks, rendertools, ob);
 
 		/* add to the list only the visible fonts */
-		if((ob->lay & kxscene->GetBlenderScene()->lay) != 0)
+		if ((ob->lay & kxscene->GetBlenderScene()->lay) != 0)
 			kxscene->AddFont(static_cast<KX_FontObject*>(gameobj));
 		break;
 	}
@@ -2058,7 +2065,7 @@ static KX_GameObject *gameobject_from_blenderobject(
 		gameobj->SetLayer(ob->lay);
 		gameobj->SetBlenderObject(ob);
 		/* set the visibility state based on the objects render option in the outliner */
-		if(ob->restrictflag & OB_RESTRICT_RENDER) gameobj->SetVisible(0, 0);
+		if (ob->restrictflag & OB_RESTRICT_RENDER) gameobj->SetVisible(0, 0);
 	}
 	return gameobj;
 }
@@ -2077,8 +2084,8 @@ bPoseChannel *get_active_posechannel2 (Object *ob)
 	bPoseChannel *pchan;
 	
 	/* find active */
-	for(pchan= (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan= pchan->next) {
-		if(pchan->bone && (pchan->bone == arm->act_bone) && (pchan->bone->layer & arm->layer))
+	for (pchan= (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+		if (pchan->bone && (pchan->bone == arm->act_bone) && (pchan->bone->layer & arm->layer))
 			return pchan;
 	}
 	
@@ -2126,7 +2133,7 @@ void RBJconstraints(Object *ob)//not used
 #include "KX_IPhysicsController.h"
 #include "PHY_DynamicTypes.h"
 
-KX_IPhysicsController* getPhId(CListValue* sumolist,STR_String busc){//not used
+KX_IPhysicsController* getPhId(CListValue* sumolist,STR_String busc) {//not used
 
 	for (int j=0;j<sumolist->GetCount();j++)
 	{
@@ -2139,7 +2146,8 @@ KX_IPhysicsController* getPhId(CListValue* sumolist,STR_String busc){//not used
 
 }
 
-KX_GameObject* getGameOb(STR_String busc,CListValue* sumolist){
+KX_GameObject* getGameOb(STR_String busc,CListValue* sumolist)
+{
 
 	for (int j=0;j<sumolist->GetCount();j++)
 	{
@@ -2177,7 +2185,7 @@ static void bl_ConvertBlenderObject_Single(
 	);
 	MT_Vector3 eulxyz(blenderobject->rot);
 	MT_Vector3 scale(blenderobject->size);
-	if (converter->addInitFromFrame){//rcruiz
+	if (converter->addInitFromFrame) {//rcruiz
 		float eulxyzPrev[3];
 		blenderscene->r.cfra=blenderscene->r.sfra-1;
 		//XXX update_for_newframe();
@@ -2274,7 +2282,7 @@ static void bl_ConvertBlenderObject_Single(
 
 	logicbrick_conversionlist->Add(gameobj->AddRef());
 
-	if (converter->addInitFromFrame){
+	if (converter->addInitFromFrame) {
 		posPrev=gameobj->NodeGetWorldPosition();
 		angor=gameobj->NodeGetWorldOrientation();
 	}
@@ -2356,8 +2364,8 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
 			frame_type = RAS_FrameSettings::e_frame_scale;
 		}
 		
-		aspect_width = blenderscene->r.xsch*blenderscene->r.xasp;
-		aspect_height = blenderscene->r.ysch*blenderscene->r.yasp;
+		aspect_width  = (int)(blenderscene->r.xsch * blenderscene->r.xasp);
+		aspect_height = (int)(blenderscene->r.ysch * blenderscene->r.yasp);
 	}
 	
 	RAS_FrameSettings frame_settings(
@@ -2467,7 +2475,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
 			{
 				Group* group = *git;
 				GroupObject* go;
-				for(go=(GroupObject*)group->gobject.first; go; go=(GroupObject*)go->next) 
+				for (go=(GroupObject*)group->gobject.first; go; go=(GroupObject*)go->next)
 				{
 					Object* blenderobject = go->ob;
 					if (converter->FindGameObject(blenderobject) == NULL)
@@ -2518,22 +2526,22 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
 	if (blenderscene->camera && blenderscene->camera->type == OB_CAMERA) {
 		KX_Camera *gamecamera= (KX_Camera*) converter->FindGameObject(blenderscene->camera);
 		
-		if(gamecamera)
+		if (gamecamera)
 			kxscene->SetActiveCamera(gamecamera);
 	}
 
 	//	Set up armatures
 	set<Object*>::iterator oit;
-	for(oit=allblobj.begin(); oit!=allblobj.end(); oit++)
+	for (oit=allblobj.begin(); oit!=allblobj.end(); oit++)
 	{
 		Object* blenderobj = *oit;
 		if (blenderobj->type==OB_MESH) {
 			Mesh *me = (Mesh*)blenderobj->data;
 	
-			if (me->dvert){
+			if (me->dvert) {
 				BL_DeformableGameObject *obj = (BL_DeformableGameObject*)converter->FindGameObject(blenderobj);
 
-				if (obj && BL_ModifierDeformer::HasArmatureDeformer(blenderobj) && blenderobj->parent && blenderobj->parent->type==OB_ARMATURE){
+				if (obj && BL_ModifierDeformer::HasArmatureDeformer(blenderobj) && blenderobj->parent && blenderobj->parent->type==OB_ARMATURE) {
 					KX_GameObject *par = converter->FindGameObject(blenderobj->parent);
 					if (par && obj->GetDeformer())
 						((BL_SkinDeformer*)obj->GetDeformer())->SetArmature((BL_ArmatureObject*) par);
@@ -2607,7 +2615,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
 				// parent this to a bone
 				Bone *parent_bone = get_named_bone( (bArmature *)(blenderchild->parent)->data, blenderchild->parsubstr);
 
-				if(parent_bone) {
+				if (parent_bone) {
 					KX_BoneParentRelation *bone_parent_relation = KX_BoneParentRelation::New(parent_bone);
 					pcit->m_gamechildnode->SetParentRelation(bone_parent_relation);
 				}
@@ -2719,7 +2727,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
 		for (i=0;i<sumolist->GetCount();i++)
 		{
 			KX_GameObject* gameobj = (KX_GameObject*) sumolist->GetValue(i);
-			if (gameobj->IsDynamic()){
+			if (gameobj->IsDynamic()) {
 				gameobj->setLinearVelocity(inivel[i],false);
 				gameobj->setAngularVelocity(iniang[i],false);
 			}
@@ -2736,16 +2744,16 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
 		bConstraint *curcon;
 		conlist = get_active_constraints2(blenderobject);
 
-		if((gameobj->GetLayer()&activeLayerBitInfo)==0)
+		if ((gameobj->GetLayer()&activeLayerBitInfo)==0)
 			continue;
 
 		if (conlist) {
 			for (curcon = (bConstraint *)conlist->first; curcon; curcon=(bConstraint *)curcon->next) {
-				if (curcon->type==CONSTRAINT_TYPE_RIGIDBODYJOINT){
+				if (curcon->type==CONSTRAINT_TYPE_RIGIDBODYJOINT) {
 
 					bRigidBodyJointConstraint *dat=(bRigidBodyJointConstraint *)curcon->data;
 
-					if (!dat->child){
+					if (!dat->child && !(curcon->flag & CONSTRAINT_OFF)) {
 
 						PHY_IPhysicsController* physctr2 = 0;
 
@@ -2792,14 +2800,14 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
 										dofbit<<=1;
 									}
 								}
-								else if(dat->type == PHY_CONE_TWIST_CONSTRAINT)
+								else if (dat->type == PHY_CONE_TWIST_CONSTRAINT)
 								{
 									int dof;
 									int dofbit = 1<<3; // bitflag use_angular_limit_x
 									
 									for (dof=3;dof<6;dof++)
 									{
-										if(dat->flag & dofbit)
+										if (dat->flag & dofbit)
 										{
 											kxscene->GetPhysicsEnvironment()->setConstraintParam(constraintId,dof,dat->minLimit[dof],dat->maxLimit[dof]);
 										}
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.h b/source/gameengine/Converter/BL_BlenderDataConversion.h
index 6da3ac9..e6c35c2 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.h
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.h
@@ -29,8 +29,8 @@
  *  \ingroup bgeconv
  */
 
-#ifndef __BLENDER_CONVERT
-#define __BLENDER_CONVERT
+#ifndef __BL_BLENDERDATACONVERSION_H__
+#define __BL_BLENDERDATACONVERSION_H__
 
 #include "CTR_HashedPtr.h"
 #include "STR_String.h"
@@ -52,5 +52,5 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
 
 SCA_IInputDevice::KX_EnumInputs ConvertKeyCode(int key_code);
 
-#endif // __BLENDER_CONVERT
+#endif // __BL_BLENDERDATACONVERSION_H__
 
diff --git a/source/gameengine/Converter/BL_DeformableGameObject.cpp b/source/gameengine/Converter/BL_DeformableGameObject.cpp
index 9d514e9..dd4c51b 100644
--- a/source/gameengine/Converter/BL_DeformableGameObject.cpp
+++ b/source/gameengine/Converter/BL_DeformableGameObject.cpp
@@ -60,7 +60,7 @@ CValue*		BL_DeformableGameObject::GetReplica()
 
 bool BL_DeformableGameObject::SetActiveAction(BL_ShapeActionActuator *act, short priority, double curtime)
 {
-	if (curtime != m_lastframe){
+	if (curtime != m_lastframe) {
 		m_activePriority = 9999;
 		m_lastframe= curtime;
 		m_activeAct = NULL;
@@ -108,7 +108,7 @@ void BL_DeformableGameObject::SetDeformer(class RAS_Deformer* deformer)
 	m_pDeformer = deformer;
 
 	SG_QList::iterator<RAS_MeshSlot> mit(m_meshSlots);
-	for(mit.begin(); !mit.end(); ++mit)
+	for (mit.begin(); !mit.end(); ++mit)
 	{
 		(*mit)->SetDeformer(deformer);
 	}
diff --git a/source/gameengine/Converter/BL_DeformableGameObject.h b/source/gameengine/Converter/BL_DeformableGameObject.h
index e86fff4..d0fe741 100644
--- a/source/gameengine/Converter/BL_DeformableGameObject.h
+++ b/source/gameengine/Converter/BL_DeformableGameObject.h
@@ -29,8 +29,8 @@
  *  \ingroup bgeconv
  */
 
-#ifndef BL_DEFORMABLEGAMEOBJECT
-#define BL_DEFORMABLEGAMEOBJECT
+#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
@@ -70,7 +70,7 @@ public:
 		KX_GameObject(sgReplicationInfo,callbacks),
 		m_pDeformer(NULL),
 		m_activeAct(NULL),
-		m_lastframe(0.),
+		m_lastframe(0.0),
 		m_blendobj(blendobj),
 		m_activePriority(9999)
 	{
diff --git a/source/gameengine/Converter/BL_MeshDeformer.cpp b/source/gameengine/Converter/BL_MeshDeformer.cpp
index c4e7fd9..682ff57 100644
--- a/source/gameengine/Converter/BL_MeshDeformer.cpp
+++ b/source/gameengine/Converter/BL_MeshDeformer.cpp
@@ -53,21 +53,21 @@ bool BL_MeshDeformer::Apply(RAS_IPolyMaterial*)
 	size_t i;
 
 	// only apply once per frame if the mesh is actually modified
-	if(m_pMeshObject->MeshModified() &&
+	if (m_pMeshObject->MeshModified() &&
 	   m_lastDeformUpdate != m_gameobj->GetLastFrame()) {
 		// For each material
-		for(list<RAS_MeshMaterial>::iterator mit= m_pMeshObject->GetFirstMaterial();
+		for (list<RAS_MeshMaterial>::iterator mit= m_pMeshObject->GetFirstMaterial();
 			mit != m_pMeshObject->GetLastMaterial(); ++ mit) {
-			if(!mit->m_slots[(void*)m_gameobj])
+			if (!mit->m_slots[(void*)m_gameobj])
 				continue;
 
 			RAS_MeshSlot *slot = *mit->m_slots[(void*)m_gameobj];
 			RAS_MeshSlot::iterator it;
 
 			// for each array
-			for(slot->begin(it); !slot->end(it); slot->next(it)) {
+			for (slot->begin(it); !slot->end(it); slot->next(it)) {
 				//	For each vertex
-				for(i=it.startvertex; i<it.endvertex; i++) {
+				for (i=it.startvertex; i<it.endvertex; i++) {
 					RAS_TexVert& v = it.vertex[i];
 					v.SetXYZ(m_bmesh->mvert[v.getOrigIndex()].co);
 				}
@@ -110,7 +110,7 @@ void BL_MeshDeformer::Relink(CTR_Map<class CTR_HashedPtr, void*>*map)
 }
 
 /**
- * @warning This function is expensive!
+ * \warning This function is expensive!
  */
 void BL_MeshDeformer::RecalcNormals()
 {
@@ -126,17 +126,17 @@ void BL_MeshDeformer::RecalcNormals()
 	memset(m_transnors, 0, sizeof(float)*3*m_bmesh->totvert);
 
 	/* add face normals to vertices. */
-	for(mit = m_pMeshObject->GetFirstMaterial();
+	for (mit = m_pMeshObject->GetFirstMaterial();
 		mit != m_pMeshObject->GetLastMaterial(); ++ mit) {
-		if(!mit->m_slots[(void*)m_gameobj])
+		if (!mit->m_slots[(void*)m_gameobj])
 			continue;
 
 		RAS_MeshSlot *slot = *mit->m_slots[(void*)m_gameobj];
 
-		for(slot->begin(it); !slot->end(it); slot->next(it)) {
+		for (slot->begin(it); !slot->end(it); slot->next(it)) {
 			int nvert = (int)it.array->m_type;
 
-			for(i=0; i<it.totindex; i+=nvert) {
+			for (i=0; i<it.totindex; i+=nvert) {
 				RAS_TexVert& v1 = it.vertex[it.index[i]];
 				RAS_TexVert& v2 = it.vertex[it.index[i+1]];
 				RAS_TexVert& v3 = it.vertex[it.index[i+2]];
@@ -150,7 +150,7 @@ void BL_MeshDeformer::RecalcNormals()
 				/* compute face normal */
 				float fnor[3], n1[3], n2[3];
 
-				if(nvert == 4) {
+				if (nvert == 4) {
 					v4 = &it.vertex[it.index[i+3]];
 					co4 = m_transverts[v4->getOrigIndex()];
 
@@ -186,17 +186,17 @@ void BL_MeshDeformer::RecalcNormals()
 				vn2[0] += fnor[0]; vn2[1] += fnor[1]; vn2[2] += fnor[2];
 				vn3[0] += fnor[0]; vn3[1] += fnor[1]; vn3[2] += fnor[2];
 
-				if(v4) {
+				if (v4) {
 					float *vn4 = m_transnors[v4->getOrigIndex()];
 					vn4[0] += fnor[0]; vn4[1] += fnor[1]; vn4[2] += fnor[2];
 				}
 
 				/* in case of flat - just assign, the vertices are split */
-				if(v1.getFlag() & RAS_TexVert::FLAT) {
+				if (v1.getFlag() & RAS_TexVert::FLAT) {
 					v1.SetNormal(fnor);
 					v2.SetNormal(fnor);
 					v3.SetNormal(fnor);
-					if(v4)
+					if (v4)
 						v4->SetNormal(fnor);
 				}
 			}
@@ -204,18 +204,18 @@ void BL_MeshDeformer::RecalcNormals()
 	}
 
 	/* assign smooth vertex normals */
-	for(mit = m_pMeshObject->GetFirstMaterial();
+	for (mit = m_pMeshObject->GetFirstMaterial();
 		mit != m_pMeshObject->GetLastMaterial(); ++ mit) {
-		if(!mit->m_slots[(void*)m_gameobj])
+		if (!mit->m_slots[(void*)m_gameobj])
 			continue;
 
 		RAS_MeshSlot *slot = *mit->m_slots[(void*)m_gameobj];
 
-		for(slot->begin(it); !slot->end(it); slot->next(it)) {
-			for(i=it.startvertex; i<it.endvertex; i++) {
+		for (slot->begin(it); !slot->end(it); slot->next(it)) {
+			for (i=it.startvertex; i<it.endvertex; i++) {
 				RAS_TexVert& v = it.vertex[i];
 
-				if(!(v.getFlag() & RAS_TexVert::FLAT))
+				if (!(v.getFlag() & RAS_TexVert::FLAT))
 					v.SetNormal(m_transnors[v.getOrigIndex()]); //.safe_normalized()
 			}
 		}
@@ -225,7 +225,7 @@ void BL_MeshDeformer::RecalcNormals()
 void BL_MeshDeformer::VerifyStorage()
 {
 	/* Ensure that we have the right number of verts assigned */
-	if (m_tvtot!=m_bmesh->totvert){
+	if (m_tvtot!=m_bmesh->totvert) {
 		if (m_transverts)
 			delete [] m_transverts;
 		if (m_transnors)
diff --git a/source/gameengine/Converter/BL_MeshDeformer.h b/source/gameengine/Converter/BL_MeshDeformer.h
index 9c2065b..b7d527d 100644
--- a/source/gameengine/Converter/BL_MeshDeformer.h
+++ b/source/gameengine/Converter/BL_MeshDeformer.h
@@ -29,8 +29,8 @@
  *  \ingroup bgeconv
  */
 
-#ifndef BL_MESHDEFORMER
-#define BL_MESHDEFORMER
+#ifndef __BL_MESHDEFORMER_H__
+#define __BL_MESHDEFORMER_H__
 
 #include "RAS_Deformer.h"
 #include "DNA_object_types.h"
@@ -63,16 +63,16 @@ public:
 		m_lastDeformUpdate(-1)
 	{};
 	virtual ~BL_MeshDeformer();
-	virtual void SetSimulatedTime(double time){};
+	virtual void SetSimulatedTime(double time){}
 	virtual bool Apply(class RAS_IPolyMaterial *mat);
-	virtual bool Update(void){ return false; };
-	virtual bool UpdateBuckets(void){ return false; };
-	virtual	RAS_Deformer*	GetReplica(){return NULL;};
+	virtual bool Update(void){ return false; }
+	virtual bool UpdateBuckets(void){ return false; }
+	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; };
+	struct Mesh* GetMesh() { return m_bmesh; }
+	virtual class RAS_MeshObject* GetRasMesh() { return (RAS_MeshObject*)m_pMeshObject; }
 	virtual float (* GetTransVerts(int *tot))[3]	{	*tot= m_tvtot; return m_transverts; }
-	//	virtual void InitDeform(double time){};
+	//	virtual void InitDeform(double time){}
 
 protected:
 	class RAS_MeshObject*		m_pMeshObject;
diff --git a/source/gameengine/Converter/BL_ModifierDeformer.cpp b/source/gameengine/Converter/BL_ModifierDeformer.cpp
index 08e96f4..c1c94c2 100644
--- a/source/gameengine/Converter/BL_ModifierDeformer.cpp
+++ b/source/gameengine/Converter/BL_ModifierDeformer.cpp
@@ -132,7 +132,7 @@ bool BL_ModifierDeformer::HasArmatureDeformer(Object *ob)
 		return false;
 
 	ModifierData* md = (ModifierData*)ob->modifiers.first;
-	if(md->type == eModifierType_Armature )
+	if (md->type == eModifierType_Armature )
 		return true;
 
 	return false;
@@ -141,17 +141,17 @@ bool BL_ModifierDeformer::HasArmatureDeformer(Object *ob)
 // return a deformed mesh that supports mapping (with a valid CD_ORIGINDEX layer)
 struct DerivedMesh* BL_ModifierDeformer::GetPhysicsMesh()
 {
-	// we need to compute the deformed mesh taking into account the current
-	// shape and skin deformers, we cannot just call mesh_create_derived_physics()
-	// because that would use the m_transvers already deformed previously by BL_ModifierDeformer::Update(),
-	// so restart from scratch by forcing a full update the shape/skin deformers 
-	// (will do nothing if there is no such deformer)
+	/* we need to compute the deformed mesh taking into account the current
+	 * shape and skin deformers, we cannot just call mesh_create_derived_physics()
+	 * because that would use the m_transvers already deformed previously by BL_ModifierDeformer::Update(),
+	 * so restart from scratch by forcing a full update the shape/skin deformers 
+	 * (will do nothing if there is no such deformer) */
 	BL_ShapeDeformer::ForceUpdate();
 	BL_ShapeDeformer::Update();
 	// now apply the modifiers but without those that don't support mapping
 	Object* blendobj = m_gameobj->GetBlendObject();
 	/* hack: the modifiers require that the mesh is attached to the object
-	   It may not be the case here because of replace mesh actuator */
+	 * It may not be the case here because of replace mesh actuator */
 	Mesh *oldmesh = (Mesh*)blendobj->data;
 	blendobj->data = m_bmesh;
 	DerivedMesh *dm = mesh_create_derived_physics(m_scene, blendobj, m_transverts, CD_MASK_MESH);
@@ -172,7 +172,7 @@ bool BL_ModifierDeformer::Update(void)
 			/* execute the modifiers */
 			Object* blendobj = m_gameobj->GetBlendObject();
 			/* hack: the modifiers require that the mesh is attached to the object
-			   It may not be the case here because of replace mesh actuator */
+			 * It may not be the case here because of replace mesh actuator */
 			Mesh *oldmesh = (Mesh*)blendobj->data;
 			blendobj->data = m_bmesh;
 			/* execute the modifiers */		
@@ -218,7 +218,7 @@ bool BL_ModifierDeformer::Apply(RAS_IPolyMaterial *mat)
 	for (int imat=0; imat<nmat; imat++) {
 		RAS_MeshMaterial *mmat = m_pMeshObject->GetMeshMaterial(imat);
 		RAS_MeshSlot **slot = mmat->m_slots[(void*)m_gameobj];
-		if(!slot || !*slot)
+		if (!slot || !*slot)
 			continue;
 		(*slot)->m_pDerivedMesh = m_dm;
 	}
diff --git a/source/gameengine/Converter/BL_ModifierDeformer.h b/source/gameengine/Converter/BL_ModifierDeformer.h
index c9cd915..163b2dd 100644
--- a/source/gameengine/Converter/BL_ModifierDeformer.h
+++ b/source/gameengine/Converter/BL_ModifierDeformer.h
@@ -29,8 +29,8 @@
  *  \ingroup bgeconv
  */
 
-#ifndef BL_MODIFIERDEFORMER
-#define BL_MODIFIERDEFORMER
+#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
diff --git a/source/gameengine/Converter/BL_ShapeActionActuator.cpp b/source/gameengine/Converter/BL_ShapeActionActuator.cpp
index d679d1a..13e79b1 100644
--- a/source/gameengine/Converter/BL_ShapeActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ShapeActionActuator.cpp
@@ -221,23 +221,23 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
 	
 	priority = m_priority;
 	
-	/* Determine pre-incrementation behaviour and set appropriate flags */
-	switch (m_playtype){
+	/* Determine pre-incrementation behavior and set appropriate flags */
+	switch (m_playtype) {
 	case ACT_ACTION_MOTION:
-		if (bNegativeEvent){
+		if (bNegativeEvent) {
 			keepgoing=false;
 			apply=false;
 		};
 		break;
 	case ACT_ACTION_FROM_PROP:
-		if (bNegativeEvent){
+		if (bNegativeEvent) {
 			apply=false;
 			keepgoing=false;
 		}
 		break;
 	case ACT_ACTION_LOOP_END:
-		if (bPositiveEvent){
-			if (!(m_flag & ACT_FLAG_LOCKINPUT)){
+		if (bPositiveEvent) {
+			if (!(m_flag & ACT_FLAG_LOCKINPUT)) {
 				m_flag &= ~ACT_FLAG_KEYUP;
 				m_flag &= ~ACT_FLAG_REVERSE;
 				m_flag |= ACT_FLAG_LOCKINPUT;
@@ -245,20 +245,20 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
 				m_starttime = curtime;
 			}
 		}
-		if (bNegativeEvent){
+		if (bNegativeEvent) {
 			m_flag |= ACT_FLAG_KEYUP;
 		}
 		break;
 	case ACT_ACTION_LOOP_STOP:
-		if (bPositiveEvent){
-			if (!(m_flag & ACT_FLAG_LOCKINPUT)){
+		if (bPositiveEvent) {
+			if (!(m_flag & ACT_FLAG_LOCKINPUT)) {
 				m_flag &= ~ACT_FLAG_REVERSE;
 				m_flag &= ~ACT_FLAG_KEYUP;
 				m_flag |= ACT_FLAG_LOCKINPUT;
 				SetStartTime(curtime);
 			}
 		}
-		if (bNegativeEvent){
+		if (bNegativeEvent) {
 			m_flag |= ACT_FLAG_KEYUP;
 			m_flag &= ~ACT_FLAG_LOCKINPUT;
 			keepgoing=false;
@@ -266,8 +266,8 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
 		}
 		break;
 	case ACT_ACTION_PINGPONG:
-		if (bPositiveEvent){
-			if (!(m_flag & ACT_FLAG_LOCKINPUT)){
+		if (bPositiveEvent) {
+			if (!(m_flag & ACT_FLAG_LOCKINPUT)) {
 				m_flag &= ~ACT_FLAG_KEYUP;
 				m_localtime = m_starttime;
 				m_starttime = curtime;
@@ -276,22 +276,22 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
 		}
 		break;
 	case ACT_ACTION_FLIPPER:
-		if (bPositiveEvent){
-			if (!(m_flag & ACT_FLAG_LOCKINPUT)){
+		if (bPositiveEvent) {
+			if (!(m_flag & ACT_FLAG_LOCKINPUT)) {
 				m_flag &= ~ACT_FLAG_REVERSE;
 				m_flag |= ACT_FLAG_LOCKINPUT;
 				SetStartTime(curtime);
 			}
 		}
-		else if (bNegativeEvent){
+		else if (bNegativeEvent) {
 			m_flag |= ACT_FLAG_REVERSE;
 			m_flag &= ~ACT_FLAG_LOCKINPUT;
 			SetStartTime(curtime);
 		}
 		break;
 	case ACT_ACTION_PLAY:
-		if (bPositiveEvent){
-			if (!(m_flag & ACT_FLAG_LOCKINPUT)){
+		if (bPositiveEvent) {
+			if (!(m_flag & ACT_FLAG_LOCKINPUT)) {
 				m_flag &= ~ACT_FLAG_REVERSE;
 				m_localtime = m_starttime;
 				m_starttime = curtime;
@@ -304,8 +304,8 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
 	}
 	
 	/* Perform increment */
-	if (keepgoing){
-		if (m_playtype == ACT_ACTION_MOTION){
+	if (keepgoing) {
+		if (m_playtype == ACT_ACTION_MOTION) {
 			MT_Point3	newpos;
 			MT_Point3	deltapos;
 			
@@ -322,7 +322,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
 	}
 	
 	/* Check if a wrapping response is needed */
-	if (length){
+	if (length) {
 		if (m_localtime < m_startframe || m_localtime > m_endframe)
 		{
 			m_localtime = m_startframe + fmod(m_localtime, length);
@@ -333,14 +333,14 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
 		m_localtime = m_startframe;
 	
 	/* Perform post-increment tasks */
-	switch (m_playtype){
+	switch (m_playtype) {
 	case ACT_ACTION_FROM_PROP:
 		{
 			CValue* propval = GetParent()->GetProperty(m_propname);
 			if (propval)
 				m_localtime = propval->GetNumber();
 			
-			if (bNegativeEvent){
+			if (bNegativeEvent) {
 				keepgoing=false;
 			}
 		}
@@ -350,7 +350,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
 	case ACT_ACTION_LOOP_STOP:
 		break;
 	case ACT_ACTION_PINGPONG:
-		if (wrap){
+		if (wrap) {
 			if (!(m_flag & ACT_FLAG_REVERSE))
 				m_localtime = m_endframe;
 			else 
@@ -362,8 +362,8 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
 		}
 		break;
 	case ACT_ACTION_FLIPPER:
-		if (wrap){
-			if (!(m_flag & ACT_FLAG_REVERSE)){
+		if (wrap) {
+			if (!(m_flag & ACT_FLAG_REVERSE)) {
 				m_localtime=m_endframe;
 				//keepgoing = false;
 			}
@@ -374,8 +374,8 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
 		}
 		break;
 	case ACT_ACTION_LOOP_END:
-		if (wrap){
-			if (m_flag & ACT_FLAG_KEYUP){
+		if (wrap) {
+			if (m_flag & ACT_FLAG_KEYUP) {
 				keepgoing = false;
 				m_localtime = m_endframe;
 				m_flag &= ~ACT_FLAG_LOCKINPUT;
@@ -384,7 +384,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
 		}
 		break;
 	case ACT_ACTION_PLAY:
-		if (wrap){
+		if (wrap) {
 			m_localtime = m_endframe;
 			keepgoing = false;
 			m_flag &= ~ACT_FLAG_LOCKINPUT;
@@ -415,7 +415,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
 	if (apply) {
 
 		/* Priority test */
-		if (obj->SetActiveAction(this, priority, curtime)){
+		if (obj->SetActiveAction(this, priority, curtime)) {
 			BL_ShapeDeformer *shape_deformer = dynamic_cast<BL_ShapeDeformer*>(obj->GetDeformer());
 			Key *key = NULL;
 
@@ -430,7 +430,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
 			else {
 				ListBase tchanbase= {NULL, NULL};
 			
-				if (m_blendin && m_blendframe==0.0f){
+				if (m_blendin && m_blendframe==0.0f) {
 					// this is the start of the blending, remember the startup shape
 					obj->GetShape(m_blendshape);
 					m_blendstart = curtime;
@@ -451,7 +451,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
 				} 
 				else {
 					// the key have changed, apply blending if needed
-					if (m_blendin && (m_blendframe<m_blendin)){
+					if (m_blendin && (m_blendframe<m_blendin)) {
 						newweight = (m_blendframe/(float)m_blendin);
 
 						BlendShape(key, 1.0f - newweight);
@@ -471,7 +471,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
 		}
 	}
 	
-	if (!keepgoing){
+	if (!keepgoing) {
 		m_blendframe = 0.0f;
 	}
 	return keepgoing;
diff --git a/source/gameengine/Converter/BL_ShapeActionActuator.h b/source/gameengine/Converter/BL_ShapeActionActuator.h
index 90f44ac..b88631c 100644
--- a/source/gameengine/Converter/BL_ShapeActionActuator.h
+++ b/source/gameengine/Converter/BL_ShapeActionActuator.h
@@ -29,8 +29,8 @@
  *  \ingroup bgeconv
  */
 
-#ifndef BL_SHAPEACTIONACTUATOR
-#define BL_SHAPEACTIONACTUATOR
+#ifndef __BL_SHAPEACTIONACTUATOR_H__
+#define __BL_SHAPEACTIONACTUATOR_H__
 
 #include "CTR_HashedPtr.h"
 #include "SCA_IActuator.h"
diff --git a/source/gameengine/Converter/BL_ShapeDeformer.h b/source/gameengine/Converter/BL_ShapeDeformer.h
index c768b2e..6b55d5b 100644
--- a/source/gameengine/Converter/BL_ShapeDeformer.h
+++ b/source/gameengine/Converter/BL_ShapeDeformer.h
@@ -29,8 +29,8 @@
  *  \ingroup bgeconv
  */
 
-#ifndef BL_SHAPEDEFORMER
-#define BL_SHAPEDEFORMER
+#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
diff --git a/source/gameengine/Converter/BL_SkinDeformer.cpp b/source/gameengine/Converter/BL_SkinDeformer.cpp
index f320df1..2aa9737 100644
--- a/source/gameengine/Converter/BL_SkinDeformer.cpp
+++ b/source/gameengine/Converter/BL_SkinDeformer.cpp
@@ -111,9 +111,9 @@ BL_SkinDeformer::BL_SkinDeformer(
 
 BL_SkinDeformer::~BL_SkinDeformer()
 {
-	if(m_releaseobject && m_armobj)
+	if (m_releaseobject && m_armobj)
 		m_armobj->Release();
-	if(m_dfnrToPC)
+	if (m_dfnrToPC)
 		delete [] m_dfnrToPC;
 }
 
@@ -149,16 +149,16 @@ bool BL_SkinDeformer::Apply(RAS_IPolyMaterial *mat)
 		nmat = m_pMeshObject->NumMaterials();
 		for (imat=0; imat<nmat; imat++) {
 			mmat = m_pMeshObject->GetMeshMaterial(imat);
-			if(!mmat->m_slots[(void*)m_gameobj])
+			if (!mmat->m_slots[(void*)m_gameobj])
 				continue;
 
 			slot = *mmat->m_slots[(void*)m_gameobj];
 
 			// for each array
-			for(slot->begin(it); !slot->end(it); slot->next(it)) {
+			for (slot->begin(it); !slot->end(it); slot->next(it)) {
 				// for each vertex
 				// copy the untransformed data from the original mvert
-				for(i=it.startvertex; i<it.endvertex; i++) {
+				for (i=it.startvertex; i<it.endvertex; i++) {
 					RAS_TexVert& v = it.vertex[i];
 					v.SetXYZ(m_transverts[v.getOrigIndex()]);
 					if (m_copyNormals)
@@ -305,9 +305,9 @@ void BL_SkinDeformer::BGEDeformVerts()
 bool BL_SkinDeformer::UpdateInternal(bool shape_applied)
 {
 	/* See if the armature has been updated for this frame */
-	if (PoseUpdated()){	
+	if (PoseUpdated()) {	
 
-		if(!shape_applied) {
+		if (!shape_applied) {
 			/* store verts locally */
 			VerifyStorage();
 		
diff --git a/source/gameengine/Converter/BL_SkinDeformer.h b/source/gameengine/Converter/BL_SkinDeformer.h
index afec027..dd8577b 100644
--- a/source/gameengine/Converter/BL_SkinDeformer.h
+++ b/source/gameengine/Converter/BL_SkinDeformer.h
@@ -29,8 +29,8 @@
  *  \ingroup bgeconv
  */
 
-#ifndef BL_SKINDEFORMER
-#define BL_SKINDEFORMER
+#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
diff --git a/source/gameengine/Converter/BlenderWorldInfo.cpp b/source/gameengine/Converter/BlenderWorldInfo.cpp
index 2225c78..fc3b75c 100644
--- a/source/gameengine/Converter/BlenderWorldInfo.cpp
+++ b/source/gameengine/Converter/BlenderWorldInfo.cpp
@@ -90,7 +90,7 @@ BlenderWorldInfo::BlenderWorldInfo(struct Scene *blenderscene, struct World* ble
 		copy_v3_v3(m_backgroundcolor, &blenderworld->horr);
 		copy_v3_v3(m_ambientcolor, &blenderworld->ambr);
 
-		if(blenderscene->r.color_mgt_flag & R_COLOR_MANAGEMENT) {
+		if (blenderscene->r.color_mgt_flag & R_COLOR_MANAGEMENT) {
 			linearrgb_to_srgb_v3_v3(m_mistcolor, m_mistcolor);
 			linearrgb_to_srgb_v3_v3(m_backgroundcolor, m_backgroundcolor);
 			linearrgb_to_srgb_v3_v3(m_ambientcolor, m_ambientcolor);
diff --git a/source/gameengine/Converter/BlenderWorldInfo.h b/source/gameengine/Converter/BlenderWorldInfo.h
index 5d6ee6e..e6f274b 100644
--- a/source/gameengine/Converter/BlenderWorldInfo.h
+++ b/source/gameengine/Converter/BlenderWorldInfo.h
@@ -29,8 +29,8 @@
  *  \ingroup bgeconv
  */
 
-#ifndef __BLENDERWORLDINFO_H
-#define __BLENDERWORLDINFO_H
+#ifndef __BLENDERWORLDINFO_H__
+#define __BLENDERWORLDINFO_H__
 #include "MT_CmMatrix4x4.h"
 #include "KX_WorldInfo.h"
 #include "KX_BlenderGL.h"
@@ -106,5 +106,5 @@ public:
 #endif
 };
 
-#endif //__BLENDERWORLDINFO_H
+#endif //__BLENDERWORLDINFO_H__
 
diff --git a/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp b/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp
index 343cf02..f020aab 100644
--- a/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp
+++ b/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp
@@ -41,17 +41,19 @@ extern "C" {
 #include "BKE_fcurve.h"
 }
 
-float BL_ScalarInterpolator::GetValue(float currentTime) const {
+float BL_ScalarInterpolator::GetValue(float currentTime) const
+{
 	// XXX 2.4x IPO_GetFloatValue(m_blender_adt, m_channel, currentTime);
 	return evaluate_fcurve(m_fcu, currentTime);
 }
 
-BL_InterpolatorList::BL_InterpolatorList(bAction *action) {
-	if(action==NULL)
+BL_InterpolatorList::BL_InterpolatorList(bAction *action)
+{
+	if (action==NULL)
 		return;
 	
-	for(FCurve *fcu= (FCurve *)action->curves.first; fcu; fcu= (FCurve *)fcu->next) {
-		if(fcu->rna_path) {
+	for (FCurve *fcu= (FCurve *)action->curves.first; fcu; fcu= (FCurve *)fcu->next) {
+		if (fcu->rna_path) {
 			BL_ScalarInterpolator *new_ipo = new BL_ScalarInterpolator(fcu); 
 			//assert(new_ipo);
 			push_back(new_ipo);
@@ -59,7 +61,8 @@ BL_InterpolatorList::BL_InterpolatorList(bAction *action) {
 	}
 }
 
-BL_InterpolatorList::~BL_InterpolatorList() {
+BL_InterpolatorList::~BL_InterpolatorList()
+{
 	BL_InterpolatorList::iterator i;
 	for (i = begin(); !(i == end()); ++i) {
 		delete *i;
@@ -68,10 +71,10 @@ BL_InterpolatorList::~BL_InterpolatorList() {
 
 KX_IScalarInterpolator *BL_InterpolatorList::GetScalarInterpolator(const char *rna_path, int array_index)
 {
-	for(BL_InterpolatorList::iterator i = begin(); (i != end()) ; i++ )
+	for (BL_InterpolatorList::iterator i = begin(); (i != end()) ; i++ )
 	{
 		FCurve *fcu= (static_cast<BL_ScalarInterpolator *>(*i))->GetFCurve();
-		if(array_index==fcu->array_index && strcmp(rna_path, fcu->rna_path)==0)
+		if (array_index==fcu->array_index && strcmp(rna_path, fcu->rna_path)==0)
 			return *i;
 	}
 	return NULL;
diff --git a/source/gameengine/Converter/KX_BlenderScalarInterpolator.h b/source/gameengine/Converter/KX_BlenderScalarInterpolator.h
index 23aef75..cd18bd8 100644
--- a/source/gameengine/Converter/KX_BlenderScalarInterpolator.h
+++ b/source/gameengine/Converter/KX_BlenderScalarInterpolator.h
@@ -29,8 +29,8 @@
  *  \ingroup bgeconv
  */
 
-#ifndef __KX_SCALARINTERPOLATOR_H
-#define __KX_SCALARINTERPOLATOR_H
+#ifndef __KX_BLENDERSCALARINTERPOLATOR_H__
+#define __KX_BLENDERSCALARINTERPOLATOR_H__
 
 #include <vector>
 
@@ -48,7 +48,7 @@ public:
 	virtual ~BL_ScalarInterpolator() {}
 	
 	virtual float GetValue(float currentTime) const;
-	struct FCurve *GetFCurve() { return m_fcu;};
+	struct FCurve *GetFCurve() { return m_fcu; }
 
 private:
 	struct FCurve *m_fcu;
@@ -77,5 +77,5 @@ public:
 #endif
 };
 
-#endif //__KX_SCALARINTERPOLATOR_H
+#endif //__KX_BLENDERSCALARINTERPOLATOR_H__
 
diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
index bed9e53..df6be14 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
@@ -214,13 +214,13 @@ Scene *KX_BlenderSceneConverter::GetBlenderSceneForName(const STR_String& name)
 	 * Find the specified scene by name, or the first
 	 * scene if nothing matches (shouldn't happen).
 	 */
-	if((sce= (Scene *)BLI_findstring(&m_maggie->scene, name.ReadPtr(), offsetof(ID, name) + 2)))
+	if ((sce= (Scene *)BLI_findstring(&m_maggie->scene, name.ReadPtr(), offsetof(ID, name) + 2)))
 		return sce;
 
 	for (vector<Main*>::iterator it=m_DynamicMaggie.begin(); !(it==m_DynamicMaggie.end()); it++) {
 		Main *main= *it;
 
-		if((sce= (Scene *)BLI_findstring(&main->scene, name.ReadPtr(), offsetof(ID, name) + 2)))
+		if ((sce= (Scene *)BLI_findstring(&main->scene, name.ReadPtr(), offsetof(ID, name) + 2)))
 			return sce;
 	}
 
@@ -308,25 +308,11 @@ void KX_BlenderSceneConverter::ConvertScene(class KX_Scene* destinationscene,
 				useDbvtCulling = (blenderscene->gm.mode & WO_DBVT_CULLING) != 0;
 				break;
 			}
-							
-			case WOPHY_ODE:
-			{
-				physics_engine = UseODE;
-				break;
-			}
-			case WOPHY_DYNAMO:
-			{
-				physics_engine = UseDynamo;
-				break;
-			}
-			case WOPHY_SUMO:
-			{
-				physics_engine = UseSumo; 
-				break;
-			}
+			default:
 			case WOPHY_NONE:
 			{
 				physics_engine = UseNone;
+				break;
 			}
 		}
 	}
@@ -352,11 +338,7 @@ void KX_BlenderSceneConverter::ConvertScene(class KX_Scene* destinationscene,
 				destinationscene->SetPhysicsEnvironment(ccdPhysEnv);
 				break;
 			}
-#endif	
-		case UseDynamo:
-		{
-		}
-		
+#endif
 		default:
 		case UseNone:
 			physics_engine = UseNone;
@@ -537,7 +519,7 @@ void KX_BlenderSceneConverter::RegisterGameMesh(
 									RAS_MeshObject *gamemesh,
 									struct Mesh *for_blendermesh)
 {
-	if(for_blendermesh) { /* dynamically loaded meshes we dont want to keep lookups for */
+	if (for_blendermesh) { /* dynamically loaded meshes we don't want to keep lookups for */
 		m_map_mesh_to_gamemesh.insert(CHashedPtr(for_blendermesh),gamemesh);
 	}
 	m_meshobjects.push_back(pair<KX_Scene*,RAS_MeshObject*>(m_currentScene,gamemesh));
@@ -661,17 +643,17 @@ void	KX_BlenderSceneConverter::ResetPhysicsObjectsAnimationIpo(bool clearIpo)
 					Ipo* ipo = blenderObject->ipo;//findIpoForName(blenderObject->id.name+2);
 					if (ipo)
 					{ 	//clear the curve data
-						if (clearIpo){//rcruiz
+						if (clearIpo) {//rcruiz
 							IpoCurve *icu1;
 														
 							int numCurves = 0;
-							for( icu1 = (IpoCurve*)ipo->curve.first; icu1;  ) {
+							for ( icu1 = (IpoCurve*)ipo->curve.first; icu1;  ) {
 							
 								IpoCurve* tmpicu = icu1;
 								
 								/*int i;
 								BezTriple *bezt;
-								for( bezt = tmpicu->bezt, i = 0;	i < tmpicu->totvert; i++, bezt++){
+								for ( bezt = tmpicu->bezt, i = 0;	i < tmpicu->totvert; i++, bezt++) {
 									printf("(%f,%f,%f),(%f,%f,%f),(%f,%f,%f)\n",bezt->vec[0][0],bezt->vec[0][1],bezt->vec[0][2],bezt->vec[1][0],bezt->vec[1][1],bezt->vec[1][2],bezt->vec[2][0],bezt->vec[2][1],bezt->vec[2][2]);
 								}*/
 								
@@ -679,7 +661,7 @@ void	KX_BlenderSceneConverter::ResetPhysicsObjectsAnimationIpo(bool clearIpo)
 								numCurves++;
 			
 								BLI_remlink( &( blenderObject->ipo->curve ), tmpicu );
-								if( tmpicu->bezt )
+								if ( tmpicu->bezt )
 									MEM_freeN( tmpicu->bezt );
 								MEM_freeN( tmpicu );
 								localDel_ipoCurve( tmpicu );
@@ -705,15 +687,15 @@ void	KX_BlenderSceneConverter::ResetPhysicsObjectsAnimationIpo(bool clearIpo)
 
 void	KX_BlenderSceneConverter::resetNoneDynamicObjectToIpo()
 {
-	if (addInitFromFrame){		
+	if (addInitFromFrame) {		
 		KX_SceneList* scenes = m_ketsjiEngine->CurrentScenes();
 		int numScenes = scenes->size();
-		if (numScenes>=0){
+		if (numScenes>=0) {
 			KX_Scene* scene = scenes->at(0);
 			CListValue* parentList = scene->GetRootParentList();
-			for (int ix=0;ix<parentList->GetCount();ix++){
+			for (int ix=0;ix<parentList->GetCount();ix++) {
 				KX_GameObject* gameobj = (KX_GameObject*)parentList->GetValue(ix);
-				if (!gameobj->IsDynamic()){
+				if (!gameobj->IsDynamic()) {
 					Object* blenderobject = gameobj->GetBlenderObject();
 					if (!blenderobject)
 						continue;
@@ -769,7 +751,7 @@ void	KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber)
 			{
 				//KX_IPhysicsController* physCtrl = gameObj->GetPhysicsController();
 
-				if(blenderObject->adt==NULL)
+				if (blenderObject->adt==NULL)
 					BKE_id_add_animdata(&blenderObject->id);
 
 				if (blenderObject->adt)
@@ -807,37 +789,37 @@ void	KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber)
 					IpoCurve *icu_lx = findIpoCurve((IpoCurve *)ipo->curve.first,"LocX");
 					if (!icu_lx) {
 						icu_lx = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_X, 1);
-						if(icu_lx) icu_lx->ipo = IPO_LIN;
+						if (icu_lx) icu_lx->ipo = IPO_LIN;
 					}
 					IpoCurve *icu_ly = findIpoCurve((IpoCurve *)ipo->curve.first,"LocY");
 					if (!icu_ly) {
 						icu_ly = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_Y, 1);
-						if(icu_ly) icu_ly->ipo = IPO_LIN;
+						if (icu_ly) icu_ly->ipo = IPO_LIN;
 					}
 					IpoCurve *icu_lz = findIpoCurve((IpoCurve *)ipo->curve.first,"LocZ");
 					if (!icu_lz) {
 						icu_lz = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_Z, 1);
-						if(icu_lz) icu_lz->ipo = IPO_LIN;
+						if (icu_lz) icu_lz->ipo = IPO_LIN;
 					}
 					IpoCurve *icu_rx = findIpoCurve((IpoCurve *)ipo->curve.first,"RotX");
 					if (!icu_rx) {
 						icu_rx = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_X, 1);
-						if(icu_rx) icu_rx->ipo = IPO_LIN;
+						if (icu_rx) icu_rx->ipo = IPO_LIN;
 					}
 					IpoCurve *icu_ry = findIpoCurve((IpoCurve *)ipo->curve.first,"RotY");
 					if (!icu_ry) {
 						icu_ry = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_Y, 1);
-						if(icu_ry) icu_ry->ipo = IPO_LIN;
+						if (icu_ry) icu_ry->ipo = IPO_LIN;
 					}
 					IpoCurve *icu_rz = findIpoCurve((IpoCurve *)ipo->curve.first,"RotZ");
 					if (!icu_rz) {
 						icu_rz = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_Z, 1);
-						if(icu_rz) icu_rz->ipo = IPO_LIN;
+						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++)
@@ -848,7 +830,7 @@ void	KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber)
 					mat3_to_compatible_eul( eulerAngles, eulerAnglesOld,tmat);
 					
 					//eval_icu
-					for(int x = 0; x < 3; x++)
+					for (int x = 0; x < 3; x++)
 						eulerAngles[x] *= (float) ((180 / 3.14159265f) / 10.0);
 					
 					//fill the curves with data
@@ -859,7 +841,7 @@ void	KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber)
 					if (icu_ry) insert_vert_icu(icu_ry, frameNumber, eulerAngles[1], 1);
 					if (icu_rz) insert_vert_icu(icu_rz, frameNumber, eulerAngles[2], 1);
 					
-					// Handles are corrected at the end, testhandles_ipocurve isnt needed yet
+					// Handles are corrected at the end, testhandles_ipocurve isn't needed yet
 #endif
 				}
 			}
@@ -925,7 +907,7 @@ vector<Main*> &KX_BlenderSceneConverter::GetMainDynamic()
 Main* KX_BlenderSceneConverter::GetMainDynamicPath(const char *path)
 {
 	for (vector<Main*>::iterator it=m_DynamicMaggie.begin(); !(it==m_DynamicMaggie.end()); it++)
-		if(BLI_path_cmp((*it)->name, path) == 0)
+		if (BLI_path_cmp((*it)->name, path) == 0)
 			return *it;
 	
 	return NULL;
@@ -953,26 +935,26 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha
 	Main *main_tmp= NULL; /* created only for linking, then freed */
 	LinkNode *names = NULL;
 	int idcode= BKE_idcode_from_name(group);
-	short flag= 0; /* dont need any special options */
+	short flag= 0; /* don't need any special options */
 	ReportList reports;
 	static char err_local[255];
 	
 	/* only scene and mesh supported right now */
-	if(idcode!=ID_SCE && idcode!=ID_ME &&idcode!=ID_AC) {
+	if (idcode!=ID_SCE && idcode!=ID_ME &&idcode!=ID_AC) {
 		snprintf(err_local, sizeof(err_local), "invalid ID type given \"%s\"\n", group);
 		*err_str= err_local;
 		BLO_blendhandle_close(bpy_openlib);
 		return false;
 	}
 	
-	if(GetMainDynamicPath(path)) {
+	if (GetMainDynamicPath(path)) {
 		snprintf(err_local, sizeof(err_local), "blend file already open \"%s\"\n", path);
 		*err_str= err_local;
 		BLO_blendhandle_close(bpy_openlib);
 		return false;
 	}
 
-	if(bpy_openlib==NULL) {
+	if (bpy_openlib==NULL) {
 		snprintf(err_local, sizeof(err_local), "could not open blendfile \"%s\"\n", path);
 		*err_str= err_local;
 		return false;
@@ -1027,31 +1009,31 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha
 	strncpy(main_newlib->name, path, sizeof(main_newlib->name));	
 	
 	
-	if(idcode==ID_ME) {
+	if (idcode==ID_ME) {
 		/* Convert all new meshes into BGE meshes */
 		ID* mesh;
 	
-		for(mesh= (ID *)main_newlib->mesh.first; mesh; mesh= (ID *)mesh->next ) {
+		for (mesh= (ID *)main_newlib->mesh.first; mesh; mesh= (ID *)mesh->next ) {
 			if (options & LIB_LOAD_VERBOSE)
 				printf("MeshName: %s\n", mesh->name+2);
 			RAS_MeshObject *meshobj = BL_ConvertMesh((Mesh *)mesh, NULL, scene_merge, this);
 			scene_merge->GetLogicManager()->RegisterMeshName(meshobj->GetName(),meshobj);
 		}
 	}
-	else if(idcode==ID_AC) {
+	else if (idcode==ID_AC) {
 		/* Convert all actions */
 		ID *action;
 
-		for(action= (ID *)main_newlib->action.first; action; action= (ID *)action->next) {
+		for (action= (ID *)main_newlib->action.first; action; action= (ID *)action->next) {
 			if (options & LIB_LOAD_VERBOSE)
 				printf("ActionName: %s\n", action->name+2);
 			scene_merge->GetLogicManager()->RegisterActionName(action->name+2, action);
 		}
 	}
-	else if(idcode==ID_SCE) {		
+	else if (idcode==ID_SCE) {		
 		/* Merge all new linked in scene into the existing one */
 		ID *scene;
-		for(scene= (ID *)main_newlib->scene.first; scene; scene= (ID *)scene->next ) {
+		for (scene= (ID *)main_newlib->scene.first; scene; scene= (ID *)scene->next ) {
 			if (options & LIB_LOAD_VERBOSE)
 				printf("SceneName: %s\n", scene->name+2);
 			
@@ -1059,7 +1041,7 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha
 			KX_Scene* other= m_ketsjiEngine->CreateScene((Scene *)scene);
 			scene_merge->MergeScene(other);
 			
-			// RemoveScene(other); // Dont run this, it frees the entire scene converter data, just delete the scene
+			// RemoveScene(other); // Don't run this, it frees the entire scene converter data, just delete the scene
 			delete other;
 		}
 
@@ -1067,7 +1049,7 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha
 		if (options & LIB_LOAD_LOAD_ACTIONS) {
 			ID *action;
 
-			for(action= (ID *)main_newlib->action.first; action; action= (ID *)action->next) {
+			for (action= (ID *)main_newlib->action.first; action; action= (ID *)action->next) {
 				if (options & LIB_LOAD_VERBOSE)
 					printf("ActionName: %s\n", action->name+2);
 				scene_merge->GetLogicManager()->RegisterActionName(action->name+2, action);
@@ -1078,20 +1060,20 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha
 	return true;
 }
 
-/* Note m_map_*** are all ok and dont need to be freed
+/* Note m_map_*** are all ok and don't need to be freed
  * most are temp and NewRemoveObject frees m_map_gameobject_to_blender */
 bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
 {
 	int maggie_index= -1;
 	int i=0;
 
-	if(maggie==NULL)
+	if (maggie==NULL)
 		return false;
 	
 	/* tag all false except the one we remove */
 	for (vector<Main*>::iterator it=m_DynamicMaggie.begin(); !(it==m_DynamicMaggie.end()); it++) {
 		Main *main= *it;
-		if(main != maggie) {
+		if (main != maggie) {
 			tag_main(main, 0);
 		}
 		else {
@@ -1101,7 +1083,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
 	}
 
 	/* should never happen but just to be safe */
-	if(maggie_index == -1)
+	if (maggie_index == -1)
 		return false;
 
 	m_DynamicMaggie.erase(m_DynamicMaggie.begin() + maggie_index);
@@ -1116,21 +1098,21 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
 	for (int scene_idx=0;scene_idx<numScenes;scene_idx++)
 	{
 		KX_Scene* scene = scenes->at(scene_idx);
-		if(IS_TAGGED(scene->GetBlenderScene())) {
+		if (IS_TAGGED(scene->GetBlenderScene())) {
 			RemoveScene(scene); // XXX - not tested yet
 			scene_idx--;
 			numScenes--;
 		}
 		else {
 			
-			/* incase the mesh might be refered to later */
+			/* in case the mesh might be refered to later */
 			{
 				CTR_Map<STR_HashedString,void*> &mapStringToMeshes = scene->GetLogicManager()->GetMeshMap();
 				
-				for(int i=0; i<mapStringToMeshes.size(); i++)
+				for (int i=0; i<mapStringToMeshes.size(); i++)
 				{
 					RAS_MeshObject *meshobj= (RAS_MeshObject *) *mapStringToMeshes.at(i);
-					if(meshobj && IS_TAGGED(meshobj->GetMesh()))
+					if (meshobj && IS_TAGGED(meshobj->GetMesh()))
 					{	
 						STR_HashedString mn = meshobj->GetName();
 						mapStringToMeshes.remove(mn);
@@ -1144,11 +1126,11 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
 			{
 				CTR_Map<STR_HashedString,void*> &mapStringToActions = scene->GetLogicManager()->GetActionMap();
 
-				for(int i=0; i<mapStringToActions.size(); i++)
+				for (int i=0; i<mapStringToActions.size(); i++)
 				{
 					ID *action= (ID*) *mapStringToActions.at(i);
 
-					if(IS_TAGGED(action))
+					if (IS_TAGGED(action))
 					{
 						STR_HashedString an = action->name+2;
 						mapStringToActions.remove(an);
@@ -1160,7 +1142,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
 			//scene->FreeTagged(); /* removed tagged objects and meshes*/
 			CListValue *obj_lists[] = {scene->GetObjectList(), scene->GetInactiveList(), NULL};
 
-			for(int ob_ls_idx=0; obj_lists[ob_ls_idx]; ob_ls_idx++)
+			for (int ob_ls_idx=0; obj_lists[ob_ls_idx]; ob_ls_idx++)
 			{
 				CListValue *obs= obj_lists[ob_ls_idx];
 				RAS_MeshObject* mesh;
@@ -1168,7 +1150,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
 				for (int ob_idx = 0; ob_idx < obs->GetCount(); ob_idx++)
 				{
 					KX_GameObject* gameobj = (KX_GameObject*)obs->GetValue(ob_idx);
-					if(IS_TAGGED(gameobj->GetBlenderObject())) {
+					if (IS_TAGGED(gameobj->GetBlenderObject())) {
 
 						int size_before = obs->GetCount();
 
@@ -1176,7 +1158,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
 						 * frees m_map_gameobject_to_blender from UnregisterGameObject */
 						scene->RemoveObject(gameobj);
 
-						if(size_before != obs->GetCount())
+						if (size_before != obs->GetCount())
 							ob_idx--;
 						else {
 							printf("ERROR COULD NOT REMOVE \"%s\"\n", gameobj->GetName().ReadPtr());
@@ -1187,7 +1169,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
 						int mesh_index= gameobj->GetMeshCount();
 						while(mesh_index--) {
 							mesh= gameobj->GetMesh(mesh_index);
-							if(IS_TAGGED(mesh->GetMesh())) {
+							if (IS_TAGGED(mesh->GetMesh())) {
 								gameobj->RemoveMeshes(); /* XXX - slack, should only remove meshes that are library items but mostly objects only have 1 mesh */
 								break;
 							}
@@ -1199,7 +1181,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
 							if (gameobj->GetActuators()[act_idx]->IsType(SCA_IActuator::KX_ACT_ACTION))
 							{
 								BL_ActionActuator *act = (BL_ActionActuator*)gameobj->GetActuators()[act_idx];
-								if(IS_TAGGED(act->GetAction()))
+								if (IS_TAGGED(act->GetAction()))
 									act->SetAction(NULL);
 							}
 						}
@@ -1214,7 +1196,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
 
 	// delete the entities of this scene
 	/* TODO - */
-	/*
+#if 0
 	vector<pair<KX_Scene*,KX_WorldInfo*> >::iterator worldit;
 	size = m_worldinfos.size();
 	for (i=0, worldit=m_worldinfos.begin(); i<size; ) {
@@ -1227,16 +1209,17 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
 			i++;
 			worldit++;
 		}
-	}*/
+	}
+#endif
 
 
-	/* Worlds dont reference original blender data so we need to make a set from them */
+	/* Worlds don't reference original blender data so we need to make a set from them */
 	typedef std::set<KX_WorldInfo*> KX_WorldInfoSet;
 	KX_WorldInfoSet worldset;
 	for (int scene_idx=0;scene_idx<numScenes;scene_idx++)
 	{
 		KX_Scene* scene = scenes->at(scene_idx);
-		if(scene->GetWorldInfo())
+		if (scene->GetWorldInfo())
 			worldset.insert( scene->GetWorldInfo() );
 	}
 
@@ -1269,7 +1252,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
 		Material *bmat= NULL;
 
 		/* Why do we need to check for RAS_BLENDERMAT if both are cast to a (PyObject*)? - Campbell */
-		if(mat->GetFlag() & RAS_BLENDERMAT) {
+		if (mat->GetFlag() & RAS_BLENDERMAT) {
 			KX_BlenderMaterial *bl_mat = static_cast<KX_BlenderMaterial*>(mat);
 			bmat= bl_mat->GetBlenderMaterial();
 
@@ -1294,7 +1277,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
 		Material *bmat= NULL;
 
 		/* Why do we need to check for RAS_BLENDERMAT if both are cast to a (PyObject*)? - Campbell */
-		if(mat->GetFlag() & RAS_BLENDERMAT) {
+		if (mat->GetFlag() & RAS_BLENDERMAT) {
 			KX_BlenderMaterial *bl_mat = static_cast<KX_BlenderMaterial*>(mat);
 			bmat= bl_mat->GetBlenderMaterial();
 
@@ -1303,7 +1286,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie)
 			bmat= kx_mat->GetBlenderMaterial();
 		}
 
-		if(bmat) {
+		if (bmat) {
 			//printf("FOUND MAT '%s' !!! ", ((ID*)bmat)->name+2);
 		}
 		else {
@@ -1418,13 +1401,13 @@ RAS_MeshObject *KX_BlenderSceneConverter::ConvertMeshSpecial(KX_Scene* kx_scene,
 	/* Find a mesh in the current main */
 	ID *me= static_cast<ID *>(BLI_findstring(&m_maggie->mesh, name, offsetof(ID, name) + 2));
 	
-	if(me==NULL) {
+	if (me==NULL) {
 		printf("Could not be found \"%s\"\n", name);
 		return NULL;
 	}
 	
 	/* Watch this!, if its used in the original scene can cause big troubles */
-	if(me->us > 0) {
+	if (me->us > 0) {
 		printf("Mesh has a user \"%s\"\n", name);
 		me = (ID*)copy_mesh((Mesh*)me);
 		me->us--;
@@ -1438,16 +1421,16 @@ RAS_MeshObject *KX_BlenderSceneConverter::ConvertMeshSpecial(KX_Scene* kx_scene,
 		Mesh *mesh= (Mesh *)me;
 		
 		/* ensure all materials are tagged */
-		for(int i=0; i<mesh->totcol; i++)
-			if(mesh->mat[i])
+		for (int i=0; i<mesh->totcol; i++)
+			if (mesh->mat[i])
 				mesh->mat[i]->id.flag &= ~LIB_DOIT;
 		
-		for(int i=0; i<mesh->totcol; i++)
+		for (int i=0; i<mesh->totcol; i++)
 		{
 			Material *mat_old= mesh->mat[i];
 			
 			/* if its tagged its a replaced material */
-			if(mat_old && (mat_old->id.flag & LIB_DOIT)==0)
+			if (mat_old && (mat_old->id.flag & LIB_DOIT)==0)
 			{
 				Material *mat_old= mesh->mat[i];
 				Material *mat_new= copy_material( mat_old );
@@ -1461,9 +1444,9 @@ RAS_MeshObject *KX_BlenderSceneConverter::ConvertMeshSpecial(KX_Scene* kx_scene,
 				mesh->mat[i]= mat_new;
 				
 				/* the same material may be used twice */
-				for(int j=i+1; j<mesh->totcol; j++)
+				for (int j=i+1; j<mesh->totcol; j++)
 				{
-					if(mesh->mat[j]==mat_old)
+					if (mesh->mat[j]==mat_old)
 					{
 						mesh->mat[j]= mat_new;
 						mat_new->id.us++;
diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.h b/source/gameengine/Converter/KX_BlenderSceneConverter.h
index f9b0d58..258fb1e 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.h
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.h
@@ -29,8 +29,8 @@
  *  \ingroup bgeconv
  */
 
-#ifndef __KX_BLENDERSCENECONVERTER_H
-#define __KX_BLENDERSCENECONVERTER_H
+#ifndef __KX_BLENDERSCENECONVERTER_H__
+#define __KX_BLENDERSCENECONVERTER_H__
 
 #include "KX_HashedPtr.h"
 #include "CTR_Map.h"
@@ -39,6 +39,8 @@
 #include "KX_ISceneConverter.h"
 #include "KX_IpoConvert.h"
 
+using namespace std;
+
 class KX_WorldInfo;
 class SCA_IActuator;
 class SCA_IController;
@@ -141,7 +143,7 @@ public:
 
 	struct Scene* GetBlenderSceneForName(const STR_String& name);
 
-//	struct Main* GetMain() { return m_maggie; };
+//	struct Main* GetMain() { return m_maggie; }
 	struct Main*		  GetMainDynamicPath(const char *path);
 	vector<struct Main*> &GetMainDynamic();
 	
@@ -195,5 +197,5 @@ public:
 #endif
 };
 
-#endif //__KX_BLENDERSCENECONVERTER_H
+#endif //__KX_BLENDERSCENECONVERTER_H__
 
diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp
index e577a5e..0768029 100644
--- a/source/gameengine/Converter/KX_ConvertActuators.cpp
+++ b/source/gameengine/Converter/KX_ConvertActuators.cpp
@@ -106,8 +106,8 @@
 #include "BL_BlenderDataConversion.h"
 
 /** 
-KX_BLENDERTRUNC needed to round 'almost' zero values to zero, else velocities etc. are incorrectly set 
-*/
+ * KX_BLENDERTRUNC needed to round 'almost' zero values to zero, else velocities etc. are incorrectly set
+ */
 
 #define KX_BLENDERTRUNC(x)  (( x < 0.0001 && x > -0.0001 )  ? 0.0 : x)
 
@@ -232,7 +232,7 @@ void BL_ConvertActuators(const char* maggiename,
 			}
 		case ACT_SHAPEACTION:
 			{
-				if (blenderobject->type==OB_MESH){
+				if (blenderobject->type==OB_MESH) {
 					bActionActuator* actact = (bActionActuator*) bact->data;
 					STR_String propname = (actact->name ? actact->name : "");
 					STR_String propframe = (actact->frameProp ? actact->frameProp : "");
@@ -310,30 +310,26 @@ void BL_ConvertActuators(const char* maggiename,
 			{
 				bMessageActuator *msgAct = (bMessageActuator *) bact->data;
 				
-				/**
-				* Get the name of the properties that objects must own that
-				* we're sending to, if present
-				*/
+				/* Get the name of the properties that objects must own that
+				 * we're sending to, if present
+				 */
 				STR_String toPropName = (msgAct->toPropName
 					? (char*) msgAct->toPropName
 					: "");
 				
-				/**
-				* Get the Message Subject to send.
-				*/
+				/* Get the Message Subject to send.
+				 */
 				STR_String subject = (msgAct->subject
 					? (char*) msgAct->subject
 					: "");
 				
-				/**
-				* Get the bodyType
-				*/
+				/* Get the bodyType
+				 */
 				int bodyType = msgAct->bodyType;
 				
-				/**
-				* Get the body (text message or property name whose value
-				* we'll be sending, might be empty
-				*/
+				/* Get the body (text message or property name whose value
+				 * we'll be sending, might be empty
+				 */
 				STR_String body = (msgAct->body
 					? (char*) msgAct->body
 					: "");
@@ -400,7 +396,7 @@ void BL_ConvertActuators(const char* maggiename,
 					settings.reference_distance = soundact->sound3D.reference_distance;
 					settings.rolloff_factor = soundact->sound3D.rolloff_factor;
 
-					if(!sound)
+					if (!sound)
 					{
 						std::cout <<	"WARNING: Sound actuator \"" << bact->name <<
 										"\" from object \"" <<  blenderobject->id.name+2 <<
@@ -411,12 +407,12 @@ void BL_ConvertActuators(const char* maggiename,
 						snd_sound = *reinterpret_cast<AUD_Reference<AUD_IFactory>*>(sound->playback_handle);
 
 						// if sound shall be 3D but isn't mono, we have to make it mono!
-						if(is3d)
+						if (is3d)
 						{
 							try
 							{
 								AUD_Reference<AUD_IReader> reader = snd_sound->createReader();
-								if(reader->getSpecs().channels != AUD_CHANNELS_MONO)
+								if (reader->getSpecs().channels != AUD_CHANNELS_MONO)
 								{
 									AUD_DeviceSpecs specs;
 									specs.channels = AUD_CHANNELS_MONO;
@@ -451,13 +447,13 @@ void BL_ConvertActuators(const char* maggiename,
 				SCA_IObject* destinationObj = NULL;
 				
 				/*
-				here the destinationobject is searched. problem with multiple scenes: other scenes
-				have not been converted yet, so the destobj will not be found, so the prop will
-				not be copied.
-				possible solutions:
-				- convert everything when possible and not realtime only when needed.
-				- let the object-with-property report itself to the act when converted
-				*/
+				 * here the destinationobject is searched. problem with multiple scenes: other scenes
+				 * have not been converted yet, so the destobj will not be found, so the prop will
+				 * not be copied.
+				 * possible solutions:
+				 * - convert everything when possible and not realtime only when needed.
+				 * - let the object-with-property report itself to the act when converted
+				 */
 				if (propact->ob)
 					destinationObj = converter->FindGameObject(propact->ob);
 				
@@ -1060,7 +1056,7 @@ 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);
+				BL_ArmatureActuator* tmparmact = new BL_ArmatureActuator(gameobj, armAct->type, armAct->posechannel, armAct->constraint, tmpgob, subgob, armAct->weight, armAct->influence);
 				baseact = tmparmact;
 				break;
 			}
diff --git a/source/gameengine/Converter/KX_ConvertActuators.h b/source/gameengine/Converter/KX_ConvertActuators.h
index 836bcd8..b7c8904 100644
--- a/source/gameengine/Converter/KX_ConvertActuators.h
+++ b/source/gameengine/Converter/KX_ConvertActuators.h
@@ -29,8 +29,8 @@
  *  \ingroup bgeconv
  */
 
-#ifndef __KX_CONVERTACTUATORS_H
-#define __KX_CONVERTACTUATORS_H
+#ifndef __KX_CONVERTACTUATORS_H__
+#define __KX_CONVERTACTUATORS_H__
 
 void BL_ConvertActuators(const char* maggiename,
 	 struct Object* blenderobject,
@@ -44,5 +44,5 @@ void BL_ConvertActuators(const char* maggiename,
 	 class KX_BlenderSceneConverter* converter);
 
 
-#endif //__KX_CONVERTACTUATORS_H
+#endif //__KX_CONVERTACTUATORS_H__
 
diff --git a/source/gameengine/Converter/KX_ConvertControllers.cpp b/source/gameengine/Converter/KX_ConvertControllers.cpp
index 9ba79e2..8177892 100644
--- a/source/gameengine/Converter/KX_ConvertControllers.cpp
+++ b/source/gameengine/Converter/KX_ConvertControllers.cpp
@@ -161,7 +161,7 @@ void BL_ConvertControllers(
 
 				pyctrl->SetNamespace(converter->GetPyNamespace());
 				
-				if(pycont->mode==SCA_PythonController::SCA_PYEXEC_SCRIPT) {
+				if (pycont->mode==SCA_PythonController::SCA_PYEXEC_SCRIPT) {
 					if (pycont->text)
 					{
 						char *buf;
@@ -181,7 +181,7 @@ void BL_ConvertControllers(
 					pyctrl->SetScriptText(STR_String(pycont->module)); 
 					pyctrl->SetScriptName(pycont->module); /* will be something like module.func so using it as the name is OK */
 
-					if(pycont->flag & CONT_PY_DEBUG) {
+					if (pycont->flag & CONT_PY_DEBUG) {
 						printf("\nDebuging \"%s\", module for object %s\n\texpect worse performance.\n", pycont->module, blenderobject->id.name+2);
 						pyctrl->SetDebug(true);
 					}
@@ -223,12 +223,12 @@ void BL_ConvertControllers(
 				SCA_PythonController *pyctrl= static_cast<SCA_PythonController*>(gamecontroller);
 				/* not strictly needed but gives syntax errors early on and
 				 * gives more predictable performance for larger scripts */
-				if(pyctrl->m_mode==SCA_PythonController::SCA_PYEXEC_SCRIPT)
+				if (pyctrl->m_mode==SCA_PythonController::SCA_PYEXEC_SCRIPT)
 					pyctrl->Compile();
 				else {
 					/* We cant do this because importing runs the script which could end up accessing
 					 * internal BGE functions, this is unstable while we're converting the scene.
-					 * This is a pitty because its useful to see errors at startup but cant help it */
+					 * This is a pity because its useful to see errors at startup but cant help it */
 					
 					// pyctrl->Import();
 				}
diff --git a/source/gameengine/Converter/KX_ConvertControllers.h b/source/gameengine/Converter/KX_ConvertControllers.h
index 19045dc..d1d52f8 100644
--- a/source/gameengine/Converter/KX_ConvertControllers.h
+++ b/source/gameengine/Converter/KX_ConvertControllers.h
@@ -29,8 +29,8 @@
  *  \ingroup bgeconv
  */
 
-#ifndef __KX_CONVERTCONTROLLERS_H
-#define __KX_CONVERTCONTROLLERS_H
+#ifndef __KX_CONVERTCONTROLLERS_H__
+#define __KX_CONVERTCONTROLLERS_H__
 
 #include "KX_Python.h"
 
@@ -44,5 +44,5 @@ void BL_ConvertControllers(
 );
 
 
-#endif //__KX_CONVERTCONTROLLERS_H
+#endif //__KX_CONVERTCONTROLLERS_H__
 
diff --git a/source/gameengine/Converter/KX_ConvertProperties.cpp b/source/gameengine/Converter/KX_ConvertProperties.cpp
index 8eea39c..faa7780 100644
--- a/source/gameengine/Converter/KX_ConvertProperties.cpp
+++ b/source/gameengine/Converter/KX_ConvertProperties.cpp
@@ -141,15 +141,15 @@ void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventMan
 		}
 		
 #ifdef WITH_PYTHON
-		/* Warn if we double up on attributes, this isnt quite right since it wont find inherited attributes however there arnt many */
-		for(PyAttributeDef *attrdef = KX_GameObject::Attributes; attrdef->m_name; attrdef++) {
-			if(strcmp(prop->name, attrdef->m_name)==0) {
+		/* Warn if we double up on attributes, this isn't quite right since it wont find inherited attributes however there arnt many */
+		for (PyAttributeDef *attrdef = KX_GameObject::Attributes; attrdef->m_name; attrdef++) {
+			if (strcmp(prop->name, attrdef->m_name)==0) {
 				printf("Warning! user defined property name \"%s\" is also a python attribute for object \"%s\"\n\tUse ob[\"%s\"] syntax to avoid conflict\n", prop->name, object->id.name+2, prop->name);
 				break;
 			}
 		}
-		for(PyMethodDef *methdef = KX_GameObject::Methods; methdef->ml_name; methdef++) {
-			if(strcmp(prop->name, methdef->ml_name)==0) {
+		for (PyMethodDef *methdef = KX_GameObject::Methods; methdef->ml_name; methdef++) {
+			if (strcmp(prop->name, methdef->ml_name)==0) {
 				printf("Warning! user defined property name \"%s\" is also a python method for object \"%s\"\n\tUse ob[\"%s\"] syntax to avoid conflict\n", prop->name, object->id.name+2, prop->name);
 				break;
 			}
@@ -176,9 +176,9 @@ void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventMan
 void BL_ConvertTextProperty(Object* object, KX_FontObject* fontobj,SCA_TimeEventManager* timemgr,SCA_IScene* scene, bool isInActiveLayer)
 {
 	CValue* tprop = fontobj->GetProperty("Text");
-	if(!tprop) return;
+	if (!tprop) return;
 	bProperty* prop = get_ob_property(object, "Text");
-	if(!prop) return;
+	if (!prop) return;
 
 	Curve *curve = static_cast<Curve *>(object->data);
 	STR_String str = curve->str;
@@ -201,7 +201,7 @@ void BL_ConvertTextProperty(Object* object, KX_FontObject* fontobj,SCA_TimeEvent
 		}
 		case GPROP_FLOAT:
 		{
-			float floatprop = atof(str);
+			float floatprop = (float)atof(str);
 			propval = new CFloatValue(floatprop);
 			tprop->SetValue(propval);
 			break;
@@ -214,7 +214,7 @@ void BL_ConvertTextProperty(Object* object, KX_FontObject* fontobj,SCA_TimeEvent
 		}
 		case GPROP_TIME:
 		{
-			float floatprop = atof(str);
+			float floatprop = (float)atof(str);
 
 			CValue* timeval = new CFloatValue(floatprop);
 			// set a subproperty called 'timer' so that
diff --git a/source/gameengine/Converter/KX_ConvertProperties.h b/source/gameengine/Converter/KX_ConvertProperties.h
index b151b70..5bfe202 100644
--- a/source/gameengine/Converter/KX_ConvertProperties.h
+++ b/source/gameengine/Converter/KX_ConvertProperties.h
@@ -29,8 +29,8 @@
  *  \ingroup bgeconv
  */
 
-#ifndef __KX_CONVERTPROPERTIES
-#define __KX_CONVERTPROPERTIES
+#ifndef __KX_CONVERTPROPERTIES_H__
+#define __KX_CONVERTPROPERTIES_H__
 
 void BL_ConvertProperties(struct Object* object,
   class KX_GameObject* gameobj,
@@ -38,5 +38,5 @@ void BL_ConvertProperties(struct Object* object,
   class SCA_IScene* scene,
   bool isInActiveLayer);
 
-#endif //__KX_CONVERTPROPERTIES
+#endif //__KX_CONVERTPROPERTIES_H__
 
diff --git a/source/gameengine/Converter/KX_ConvertSensors.cpp b/source/gameengine/Converter/KX_ConvertSensors.cpp
index 9391d12..fa9eb53 100644
--- a/source/gameengine/Converter/KX_ConvertSensors.cpp
+++ b/source/gameengine/Converter/KX_ConvertSensors.cpp
@@ -50,7 +50,7 @@
 #include "DNA_material_types.h"
 #include "DNA_sensor_types.h"
 #include "DNA_actuator_types.h" /* for SENS_ALL_KEYS ? this define is
-probably misplaced */
+                                 * probably misplaced */
 /* end of blender include block */
 
 #include "RAS_IPolygonMaterial.h"
@@ -315,9 +315,9 @@ void BL_ConvertSensors(struct Object* blenderobject,
 				bMouseSensor *bmouse = (bMouseSensor *)sens->data;
 				
 				/* There are two main types of mouse sensors. If there is
-				* no focus-related behaviour requested, we can make do
-				* with a basic sensor. This cuts down memory usage and
-				* gives a slight performance gain. */
+				 * no focus-related behavior requested, we can make do
+				 * with a basic sensor. This cuts down memory usage and
+				 * gives a slight performance gain. */
 				
 				SCA_MouseManager *eventmgr 
 					= (SCA_MouseManager*) logicmgr->FindEventManager(SCA_EventManager::MOUSE_EVENTMGR);
diff --git a/source/gameengine/Converter/KX_ConvertSensors.h b/source/gameengine/Converter/KX_ConvertSensors.h
index 1405aee..0694815 100644
--- a/source/gameengine/Converter/KX_ConvertSensors.h
+++ b/source/gameengine/Converter/KX_ConvertSensors.h
@@ -29,8 +29,8 @@
  *  \ingroup bgeconv
  */
 
-#ifndef __KX_CONVERTSENSOR_H
-#define __KX_CONVERTSENSOR_H
+#ifndef __KX_CONVERTSENSORS_H__
+#define __KX_CONVERTSENSORS_H__
 
 void BL_ConvertSensors(struct Object* blenderobject,
 	   class KX_GameObject* gameobj,
@@ -42,5 +42,5 @@ void BL_ConvertSensors(struct Object* blenderobject,
 	   class RAS_ICanvas* canvas, 
 	   class KX_BlenderSceneConverter* converter);
 
-#endif //__KX_CONVERTSENSOR_H
+#endif //__KX_CONVERTSENSORS_H__
 
diff --git a/source/gameengine/Converter/KX_IpoConvert.cpp b/source/gameengine/Converter/KX_IpoConvert.cpp
index a56fbe5..309959b 100644
--- a/source/gameengine/Converter/KX_IpoConvert.cpp
+++ b/source/gameengine/Converter/KX_IpoConvert.cpp
@@ -102,7 +102,7 @@ SG_Controller *BL_CreateIPO(struct bAction *action, KX_GameObject* gameobj, KX_B
 		rotmode = "rotation_axis_angle";
 		drotmode = "delta_rotation_axis_angle";
 		break;
-	case ROT_MODE_QUAT: /* XXX, this isnt working, currently only eulers are supported [#28853] */
+	case ROT_MODE_QUAT: /* XXX, this isn't working, currently only eulers are supported [#28853] */
 		rotmode = "rotation_quaternion";
 		drotmode = "delta_rotation_quaternion";
 		break;
@@ -120,42 +120,42 @@ SG_Controller *BL_CreateIPO(struct bAction *action, KX_GameObject* gameobj, KX_B
 	KX_IInterpolator *interpolator;
 	KX_IScalarInterpolator *interp;
 		
-	for(int i=0; i<3; i++) {
+	for (int i=0; i<3; i++) {
 		if ((interp = adtList->GetScalarInterpolator("location", i))) {
 			interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetPosition()[i]), interp);
 			ipocontr->AddInterpolator(interpolator);
 			ipocontr->SetIPOChannelActive(OB_LOC_X+i, true);
 		}
 	}
-	for(int i=0; i<3; i++) {
+	for (int i=0; i<3; i++) {
 		if ((interp = adtList->GetScalarInterpolator("delta_location", i))) {
 			interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetDeltaPosition()[i]), interp);
 			ipocontr->AddInterpolator(interpolator);
 			ipocontr->SetIPOChannelActive(OB_DLOC_X+i, true);
 		}
 	}
-	for(int i=0; i<3; i++) {
+	for (int i=0; i<3; i++) {
 		if ((interp = adtList->GetScalarInterpolator(rotmode, i))) {
 			interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetEulerAngles()[i]), interp);
 			ipocontr->AddInterpolator(interpolator);
 			ipocontr->SetIPOChannelActive(OB_ROT_X+i, true);
 		}
 	}
-	for(int i=0; i<3; i++) {
+	for (int i=0; i<3; i++) {
 		if ((interp = adtList->GetScalarInterpolator(drotmode, i))) {
 			interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetDeltaEulerAngles()[i]), interp);
 			ipocontr->AddInterpolator(interpolator);
 			ipocontr->SetIPOChannelActive(OB_DROT_X+i, true);
 		}
 	}
-	for(int i=0; i<3; i++) {
+	for (int i=0; i<3; i++) {
 		if ((interp = adtList->GetScalarInterpolator("scale", i))) {
 			interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetScaling()[i]), interp);
 			ipocontr->AddInterpolator(interpolator);
 			ipocontr->SetIPOChannelActive(OB_SIZE_X+i, true);
 		}
 	}
-	for(int i=0; i<3; i++) {
+	for (int i=0; i<3; i++) {
 		if ((interp = adtList->GetScalarInterpolator("delta_scale", i))) {
 			interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetDeltaScaling()[i]), interp);
 			ipocontr->AddInterpolator(interpolator);
@@ -166,7 +166,7 @@ SG_Controller *BL_CreateIPO(struct bAction *action, KX_GameObject* gameobj, KX_B
 	{
 		KX_ObColorIpoSGController* ipocontr_obcol=NULL;
 			
-		for(int i=0; i<4; i++) {
+		for (int i=0; i<4; i++) {
 			if ((interp = adtList->GetScalarInterpolator("color", i))) {
 				if (!ipocontr_obcol) {
 					ipocontr_obcol = new KX_ObColorIpoSGController();
@@ -223,7 +223,7 @@ SG_Controller *BL_CreateLampIPO(struct bAction *action, KX_GameObject*  lightobj
 		ipocontr->SetModifyDist(true);
 	}
 		
-	for(int i=0; i<3; i++) {
+	for (int i=0; i<3; i++) {
 		if ((interp = adtList->GetScalarInterpolator("color", i))) {
 			interpolator= new KX_ScalarInterpolator(&ipocontr->m_col_rgb[i], interp);
 			ipocontr->AddInterpolator(interpolator);
@@ -323,7 +323,7 @@ void BL_ConvertWorldIpos(struct World* blenderworld,KX_BlenderSceneConverter *co
 		KX_IInterpolator *interpolator;
 		KX_IScalarInterpolator *interp;
 		
-		for(int i=0; i<3; i++) {
+		for (int i=0; i<3; i++) {
 			if ((interp = adtList->GetScalarInterpolator("horizon_color", i))) {
 				interpolator= new KX_ScalarInterpolator(&ipocontr->m_mist_rgb[i], interp);
 				ipocontr->AddInterpolator(interpolator);
@@ -379,7 +379,7 @@ static void ConvertMaterialIpos(
 		KX_IScalarInterpolator *sinterp;
 		
 		// --
-		for(int i=0; i<3; i++) {
+		for (int i=0; i<3; i++) {
 			if ((sinterp = adtList->GetScalarInterpolator("diffuse_color", i))) {
 				if (!ipocontr) {
 					ipocontr = new KX_MaterialIpoController(matname_hash);
@@ -401,7 +401,7 @@ static void ConvertMaterialIpos(
 			ipocontr->AddInterpolator(interpolator);
 		}
 
-		for(int i=0; i<3; i++) {
+		for (int i=0; i<3; i++) {
 			if ((sinterp = adtList->GetScalarInterpolator("specular_color", i))) {
 				if (!ipocontr) {
 					ipocontr = new KX_MaterialIpoController(matname_hash);
@@ -467,7 +467,7 @@ void BL_ConvertMaterialIpos(
 		// if there is only one material attached to the mesh then set material_index in BL_ConvertMaterialIpos to NULL
 		// --> this makes the UpdateMaterialData function in KX_GameObject.cpp use the old hack of using SetObjectColor
 		// because this yields a better performance as not all the vertex colors need to be edited
-		if(mat) ConvertMaterialIpos(mat, 0, gameobj, converter);
+		if (mat) ConvertMaterialIpos(mat, 0, gameobj, converter);
 	}
 	else
 	{
@@ -475,7 +475,7 @@ void BL_ConvertMaterialIpos(
 		{
 			Material *mat = give_current_material(blenderobject, material_index);
 			STR_HashedString matname;
-			if(mat) {
+			if (mat) {
 				matname= mat->id.name; // who is using this name? can we remove the MA here?
 				ConvertMaterialIpos(mat, matname.hash(), gameobj, converter);
 			}
diff --git a/source/gameengine/Converter/KX_IpoConvert.h b/source/gameengine/Converter/KX_IpoConvert.h
index 49ac6f0..7bb2df9 100644
--- a/source/gameengine/Converter/KX_IpoConvert.h
+++ b/source/gameengine/Converter/KX_IpoConvert.h
@@ -29,8 +29,8 @@
  *  \ingroup bgeconv
  */
 
-#ifndef __KX_IPOCONVERT_H
-#define __KX_IPOCONVERT_H
+#ifndef __KX_IPOCONVERT_H__
+#define __KX_IPOCONVERT_H__
 
 struct Object;
 
@@ -66,5 +66,5 @@ void BL_ConvertMaterialIpos(struct Object* blenderobject,
 	class KX_BlenderSceneConverter *converter);
 
 
-#endif //__KX_IPOCONVERT_H
+#endif //__KX_IPOCONVERT_H__
 
diff --git a/source/gameengine/Converter/KX_SoftBodyDeformer.cpp b/source/gameengine/Converter/KX_SoftBodyDeformer.cpp
index 6fe662a..e3c12c2 100644
--- a/source/gameengine/Converter/KX_SoftBodyDeformer.cpp
+++ b/source/gameengine/Converter/KX_SoftBodyDeformer.cpp
@@ -88,18 +88,18 @@ bool KX_SoftBodyDeformer::Apply(class RAS_IPolyMaterial *polymat)
 	// share the same mesh (=the same cache). As the rendering is done per polymaterial
 	// cycling through the objects, the entire mesh cache cannot be updated in one shot.
 	mmat = m_pMeshObject->GetMeshMaterial(polymat);
-	if(!mmat->m_slots[(void*)m_gameobj])
+	if (!mmat->m_slots[(void*)m_gameobj])
 		return true;
 
 	slot = *mmat->m_slots[(void*)m_gameobj];
 
 	// for each array
-	for(slot->begin(it); !slot->end(it); slot->next(it)) 
+	for (slot->begin(it); !slot->end(it); slot->next(it)) 
 	{
 		btSoftBody::tNodeArray&   nodes(softBody->m_nodes);
 
 		int index = 0;
-		for(i=it.startvertex; i<it.endvertex; i++,index++) {
+		for (i=it.startvertex; i<it.endvertex; i++,index++) {
 			RAS_TexVert& v = it.vertex[i];
 			btAssert(v.getSoftBodyIndex() >= 0);
 
diff --git a/source/gameengine/Converter/KX_SoftBodyDeformer.h b/source/gameengine/Converter/KX_SoftBodyDeformer.h
index 6e3ca73..5235c91 100644
--- a/source/gameengine/Converter/KX_SoftBodyDeformer.h
+++ b/source/gameengine/Converter/KX_SoftBodyDeformer.h
@@ -29,8 +29,8 @@
  *  \ingroup bgeconv
  */
 
-#ifndef KX_SOFTBODYDEFORMER
-#define KX_SOFTBODYDEFORMER
+#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
diff --git a/source/gameengine/Converter/SConscript b/source/gameengine/Converter/SConscript
index 5d8e2bc..4e2adbd 100644
--- a/source/gameengine/Converter/SConscript
+++ b/source/gameengine/Converter/SConscript
@@ -26,7 +26,7 @@ incs += ' #extern/Eigen3'
 incs += ' ' + env['BF_BULLET_INC']
 
 if env['BF_DEBUG']:
-    if env['OURPLATFORM'] in ('win32-mingw', 'win32-vc', 'win64-vc'):
+    if env['OURPLATFORM'] in ('win32-mingw', 'win32-vc', 'win64-vc', 'win64-mingw'):
         defs.append('_DEBUG')
         
 if env['WITH_BF_PYTHON']:
diff --git a/source/gameengine/Expressions/BoolValue.cpp b/source/gameengine/Expressions/BoolValue.cpp
index 113d12b..b3c4dc1 100644
--- a/source/gameengine/Expressions/BoolValue.cpp
+++ b/source/gameengine/Expressions/BoolValue.cpp
@@ -30,9 +30,9 @@ const STR_String CBoolValue::sFalseString = "FALSE";
 
 CBoolValue::CBoolValue()
 /*
-pre: false
-effect: constructs a new CBoolValue
-*/
+ * pre: false
+ * effect: constructs a new CBoolValue
+ */
 {
 	trace("Bool constructor error");
 }
diff --git a/source/gameengine/Expressions/BoolValue.h b/source/gameengine/Expressions/BoolValue.h
index 00baeba..4823826 100644
--- a/source/gameengine/Expressions/BoolValue.h
+++ b/source/gameengine/Expressions/BoolValue.h
@@ -16,8 +16,8 @@
  *  \ingroup expressions
  */
 
-#if !defined _BOOLVALUE_H
-#define _BOOLVALUE_H
+#ifndef __BOOLVALUE_H__
+#define __BOOLVALUE_H__
 
 #include "Value.h"
 
@@ -64,5 +64,5 @@ public:
 #endif
 };
 
-#endif // !defined _BOOLVALUE_H
+#endif // !defined __BOOLVALUE_H__
 
diff --git a/source/gameengine/Expressions/EXP_C-Api.h b/source/gameengine/Expressions/EXP_C-Api.h
index 2f17954..6be1e57 100644
--- a/source/gameengine/Expressions/EXP_C-Api.h
+++ b/source/gameengine/Expressions/EXP_C-Api.h
@@ -29,8 +29,8 @@
  *  \ingroup expressions
  */
 
-#ifndef __EXPRESSION_INCLUDE
-#define __EXPRESSION_INCLUDE
+#ifndef __EXP_C_API_H__
+#define __EXP_C_API_H__
 
 #define EXP_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name
 
@@ -64,5 +64,5 @@ const char*					EXP_GetText(EXP_ValueHandle);
 }
 #endif
 
-#endif //__EXPRESSION_INCLUDE
+#endif //__EXP_C_API_H__
 
diff --git a/source/gameengine/Expressions/EmptyValue.h b/source/gameengine/Expressions/EmptyValue.h
index 1da0ee8..73946da 100644
--- a/source/gameengine/Expressions/EmptyValue.h
+++ b/source/gameengine/Expressions/EmptyValue.h
@@ -16,8 +16,8 @@
  *  \ingroup expressions
  */
 
-#if !defined _EMPTYVALUE_H
-#define _EMPTYVALUE_H
+#ifndef __EMPTYVALUE_H__
+#define __EMPTYVALUE_H__
 
 #include "Value.h"
 
@@ -47,5 +47,5 @@ public:
 #endif
 };
 
-#endif // !defined _EMPTYVALUE_H
+#endif // !defined __EMPTYVALUE_H__
 
diff --git a/source/gameengine/Expressions/ErrorValue.cpp b/source/gameengine/Expressions/ErrorValue.cpp
index db5be0d..ba9c52b 100644
--- a/source/gameengine/Expressions/ErrorValue.cpp
+++ b/source/gameengine/Expressions/ErrorValue.cpp
@@ -39,10 +39,10 @@ pre:
 effect: constructs a new CErrorValue containing errormessage errmsg
 */
 {
-  m_strErrorText = "[";
-  m_strErrorText += errmsg;
-  m_strErrorText += "]";
-  SetError(true);
+	m_strErrorText = "[";
+	m_strErrorText += errmsg;
+	m_strErrorText += "]";
+	SetError(true);
 }
 
 
diff --git a/source/gameengine/Expressions/ErrorValue.h b/source/gameengine/Expressions/ErrorValue.h
index ec81fc2..484d135 100644
--- a/source/gameengine/Expressions/ErrorValue.h
+++ b/source/gameengine/Expressions/ErrorValue.h
@@ -16,8 +16,8 @@
  *  \ingroup expressions
  */
 
-#if !defined _ERRORVALUE_H
-#define _ERRORVALUE_H
+#ifndef __ERRORVALUE_H__
+#define __ERRORVALUE_H__
 
 #include "Value.h"
 
@@ -45,5 +45,5 @@ public:
 #endif
 };
 
-#endif // !defined _ERRORVALUE_H
+#endif // !defined __ERRORVALUE_H__
 
diff --git a/source/gameengine/Expressions/Expression.cpp b/source/gameengine/Expressions/Expression.cpp
index 9ed0ae9..c1146aa 100644
--- a/source/gameengine/Expressions/Expression.cpp
+++ b/source/gameengine/Expressions/Expression.cpp
@@ -55,7 +55,7 @@ void CBrokenLinkInfo::RestoreLink()
 
 	if (m_pExpr)
 	{
-		if (!m_bRestored){
+		if (!m_bRestored) {
 			m_bRestored=true;
 			
 		}
diff --git a/source/gameengine/Expressions/Expression.h b/source/gameengine/Expressions/Expression.h
index b923247..8a4ba8b 100644
--- a/source/gameengine/Expressions/Expression.h
+++ b/source/gameengine/Expressions/Expression.h
@@ -16,8 +16,8 @@
  *  \ingroup expressions
  */
 
-#if !defined _EXPRESSION_H
-#define _EXPRESSION_H
+#ifndef __EXPRESSION_H__
+#define __EXPRESSION_H__
 
 #include "Value.h"
 
@@ -150,5 +150,5 @@ public:
 #endif
 };
 
-#endif // !defined _EXPRESSION_H
+#endif // !defined __EXPRESSION_H__
 
diff --git a/source/gameengine/Expressions/FloatValue.h b/source/gameengine/Expressions/FloatValue.h
index 8dfb42d..75b2202 100644
--- a/source/gameengine/Expressions/FloatValue.h
+++ b/source/gameengine/Expressions/FloatValue.h
@@ -16,8 +16,8 @@
  *  \ingroup expressions
  */
 
-#if !defined _FLOATVALUE_H
-#define _FLOATVALUE_H
+#ifndef __FLOATVALUE_H__
+#define __FLOATVALUE_H__
 
 #include "Value.h"
 
@@ -56,5 +56,5 @@ public:
 #endif
 };
 
-#endif // !defined _FLOATVALUE_H
+#endif // !defined __FLOATVALUE_H__
 
diff --git a/source/gameengine/Expressions/IdentifierExpr.h b/source/gameengine/Expressions/IdentifierExpr.h
index bf996f5..632a1e0 100644
--- a/source/gameengine/Expressions/IdentifierExpr.h
+++ b/source/gameengine/Expressions/IdentifierExpr.h
@@ -29,8 +29,8 @@
  *  \ingroup expressions
  */
 
-#ifndef __IDENTIFIER_EXPR
-#define __IDENTIFIER_EXPR
+#ifndef __IDENTIFIEREXPR_H__
+#define __IDENTIFIEREXPR_H__
 
 #include "Expression.h"
 
@@ -58,5 +58,5 @@ public:
 #endif
 };
 
-#endif //__IDENTIFIER_EXPR
+#endif //__IDENTIFIEREXPR_H__
 
diff --git a/source/gameengine/Expressions/IfExpr.cpp b/source/gameengine/Expressions/IfExpr.cpp
index 9e6d80a..baf91e4 100644
--- a/source/gameengine/Expressions/IfExpr.cpp
+++ b/source/gameengine/Expressions/IfExpr.cpp
@@ -31,11 +31,11 @@ CIfExpr::CIfExpr()
 
 
 
-CIfExpr::CIfExpr(CExpression *guard, CExpression *e1, CExpression *e2)
 /*
-pre:
-effect: constructs an CifExpr-object corresponding to IF(guard, e1, e2)
-*/
+ * pre:
+ * effect: constructs an CifExpr-object corresponding to IF(guard, e1, e2)
+ */
+CIfExpr::CIfExpr(CExpression *guard, CExpression *e1, CExpression *e2)
 {
 	m_guard = guard;
 	m_e1 = e1;
@@ -44,11 +44,11 @@ effect: constructs an CifExpr-object corresponding to IF(guard, e1, e2)
 
 
 
-CIfExpr::~CIfExpr()
 /*
-pre:
-effect: dereferences the object
-*/
+ * pre:
+ * effect: dereferences the object
+ */
+CIfExpr::~CIfExpr()
 {
 	if (m_guard)
 		m_guard->Release();
@@ -62,13 +62,13 @@ effect: dereferences the object
 
 
 
+/**
+ * pre:
+ * ret: a new object containing the value of m_e1 if m_guard is a boolean TRUE
+ *      a new object containing the value of m_e2 if m_guard is a boolean FALSE
+ *      an new errorvalue if m_guard is not a boolean
+ */
 CValue* CIfExpr::Calculate()
-/*
-pre:
-ret: a new object containing the value of m_e1 if m_guard is a boolean TRUE
-	 a new object containing the value of m_e2 if m_guard is a boolean FALSE
-	 an new errorvalue if m_guard is not a boolean
-*/
 {
 	CValue *guardval;
 	guardval = m_guard->Calculate();
diff --git a/source/gameengine/Expressions/InputParser.cpp b/source/gameengine/Expressions/InputParser.cpp
index 726fea7..5883723 100644
--- a/source/gameengine/Expressions/InputParser.cpp
+++ b/source/gameengine/Expressions/InputParser.cpp
@@ -108,7 +108,7 @@ void CParser::TermChar(char c)
 {
 	// generates an error if the next char isn't the specified char c,
 	// otherwise, skip the char
-	if(ch == c)
+	if (ch == c)
 	{
 		NextCh();
 	}
@@ -166,7 +166,7 @@ void CParser::GrabRealString(int start)
 	const_as_string = STR_String();
 	for (i=start;i<chcount;i++) {
 		tmpch= text[i];
-		if ((tmpch =='\\') && (text[i+1] == 'n')){
+		if ((tmpch =='\\') && (text[i+1] == 'n')) {
 			tmpch = '\n';
 			i++;
 		}
@@ -379,7 +379,7 @@ void CParser::Term(int s)
 {
 	// generates an error if the next symbol isn't the specified symbol s
 	// otherwise, skip the symbol
-	if(s == sym) NextSym();
+	if (s == sym) NextSym();
 	else {
 		STR_String msg;
 		msg.Format("Warning: " + Symbol2Str(s) + " expected\ncontinuing without it");
@@ -579,12 +579,12 @@ CExpression* CParser::ProcessText
 	}
 	
 	ch = text[0];
-	/*if (ch != '=') {
-	expr = new CConstExpr(new CStringValue(text));
-	*dependant = deplist;
-	return expr;
-	} else 
-	*/
+	/* if (ch != '=') {
+	 * expr = new CConstExpr(new CStringValue(text));
+	 * *dependent = deplist;
+	 * return expr;
+	 * } else
+	 */
 	//	NextCh();
 	NextSym();
 	expr = Expr();
diff --git a/source/gameengine/Expressions/IntValue.cpp b/source/gameengine/Expressions/IntValue.cpp
index cf0aed1..2d42744 100644
--- a/source/gameengine/Expressions/IntValue.cpp
+++ b/source/gameengine/Expressions/IntValue.cpp
@@ -278,12 +278,11 @@ this object
 }
 
 
-
+/**
+ * pre:
+ * ret: the cInt stored in the object
+ */
 cInt CIntValue::GetInt()
-/*
-pre:
-ret: the cInt stored in the object
-*/
 {
 	return m_int;
 }
@@ -308,7 +307,8 @@ const STR_String & CIntValue::GetText()
 
 
 
-CValue* CIntValue::GetReplica() { 
+CValue* CIntValue::GetReplica()
+{
 	CIntValue* replica = new CIntValue(*this);
 	replica->ProcessReplica();
 	replica->m_pstrRep = NULL;
@@ -328,7 +328,7 @@ void CIntValue::SetValue(CValue* newval)
 #ifdef WITH_PYTHON
 PyObject* CIntValue::ConvertValueToPython()
 {
-	if((m_int > INT_MIN) && (m_int < INT_MAX))
+	if ((m_int > INT_MIN) && (m_int < INT_MAX))
 		return PyLong_FromSsize_t(m_int);
 	else
 		return PyLong_FromLongLong(m_int);
diff --git a/source/gameengine/Expressions/IntValue.h b/source/gameengine/Expressions/IntValue.h
index e6802b6..733ee8b 100644
--- a/source/gameengine/Expressions/IntValue.h
+++ b/source/gameengine/Expressions/IntValue.h
@@ -16,8 +16,8 @@
  *  \ingroup expressions
  */
 
-#if !defined _INTVALUE_H
-#define _INTVALUE_H
+#ifndef __INTVALUE_H__
+#define __INTVALUE_H__
 
 
 #include "Value.h"
@@ -71,5 +71,5 @@ public:
 #endif
 };
 
-#endif // !defined _INTVALUE_H
+#endif // !defined __INTVALUE_H__
 
diff --git a/source/gameengine/Expressions/KX_HashedPtr.cpp b/source/gameengine/Expressions/KX_HashedPtr.cpp
index 988b78b..51550d5 100644
--- a/source/gameengine/Expressions/KX_HashedPtr.cpp
+++ b/source/gameengine/Expressions/KX_HashedPtr.cpp
@@ -34,7 +34,7 @@
 
 unsigned int KX_Hash(void * inDWord)
 {
-#if defined(_WIN64)
+#if defined(_WIN64) && !defined(FREE_WINDOWS64)
 	unsigned __int64 key = (unsigned __int64)inDWord;
 #else
 	unsigned long key = (unsigned long)inDWord;
diff --git a/source/gameengine/Expressions/KX_HashedPtr.h b/source/gameengine/Expressions/KX_HashedPtr.h
index 8f2b524..edb68f2 100644
--- a/source/gameengine/Expressions/KX_HashedPtr.h
+++ b/source/gameengine/Expressions/KX_HashedPtr.h
@@ -29,8 +29,8 @@
  *  \ingroup expressions
  */
 
-#ifndef __KX_HASHEDPTR
-#define __KX_HASHEDPTR
+#ifndef __KX_HASHEDPTR_H__
+#define __KX_HASHEDPTR_H__
 
 #ifdef WITH_CXX_GUARDEDALLOC
 #include "MEM_guardedalloc.h"
@@ -60,5 +60,5 @@ public:
 #endif
 };
 
-#endif //__KX_HASHEDPTR
+#endif //__KX_HASHEDPTR_H__
 
diff --git a/source/gameengine/Expressions/KX_Python.h b/source/gameengine/Expressions/KX_Python.h
index 98f8d92..4a7ce4d 100644
--- a/source/gameengine/Expressions/KX_Python.h
+++ b/source/gameengine/Expressions/KX_Python.h
@@ -29,8 +29,8 @@
  *  \ingroup expressions
  */
 
-#ifndef KX_PYTHON_H
-#define KX_PYTHON_H
+#ifndef __KX_PYTHON_H__
+#define __KX_PYTHON_H__
 
 //#define USE_DL_EXPORT
 
@@ -79,5 +79,5 @@
 #undef toupper
 #endif
 
-#endif // KX_PYTHON_H
+#endif // __KX_PYTHON_H__
 
diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp
index cdd8723..f43625a 100644
--- a/source/gameengine/Expressions/ListValue.cpp
+++ b/source/gameengine/Expressions/ListValue.cpp
@@ -71,7 +71,8 @@ const STR_String & CListValue::GetText()
 
 
 
-CValue* CListValue::GetReplica() {
+CValue* CListValue::GetReplica()
+{
 	CListValue* replica = new CListValue(*this);
 
 	replica->ProcessReplica();
@@ -214,7 +215,7 @@ CValue* CListValue::Calc(VALUE_OPERATOR op,CValue *val)
 	//assert(false); // todo: implement me!
 	static int error_printed =  0;
 	if (error_printed==0) {
-		fprintf(stderr, "CValueList::Calc not yet implimented\n");
+		fprintf(stderr, "CValueList::Calc not yet implemented\n");
 		error_printed = 1;
 	}
 	return NULL;
@@ -227,7 +228,7 @@ CValue* CListValue::CalcFinal(VALUE_DATA_TYPE dtype,
 	//assert(false); // todo: implement me!
 	static int error_printed =  0;
 	if (error_printed==0) {
-		fprintf(stderr, "CValueList::CalcFinal not yet implimented\n");
+		fprintf(stderr, "CValueList::CalcFinal not yet implemented\n");
 		error_printed = 1;
 	}
 	return NULL;
@@ -328,7 +329,7 @@ PyObject* listvalue_mapping_subscript(PyObject* self, PyObject* pyindex)
 		CValue *item = ((CListValue*) list)->FindValue(_PyUnicode_AsString(pyindex));
 		if (item) {
 			PyObject* pyobj = item->ConvertValueToPython();
-			if(pyobj)
+			if (pyobj)
 				return pyobj;
 			else
 				return item->GetProxy();
@@ -399,7 +400,7 @@ static PyObject *listvalue_buffer_concat(PyObject * self, PyObject * other)
 	// and CListValue concatenated to Python Lists
 	// and CListValue concatenated with another CListValue
 	
-	/* Shallow copy, dont use listval->GetReplica(), it will screw up with KX_GameObjects */
+	/* Shallow copy, don't use listval->GetReplica(), it will screw up with KX_GameObjects */
 	CListValue* listval_new = new CListValue();
 	
 	if (PyList_Check(other))
@@ -427,7 +428,7 @@ static PyObject *listvalue_buffer_concat(PyObject * self, PyObject * other)
 		}
 		
 		if (error) {
-			listval_new->Resize(numitems_orig+i); /* resize so we dont try release NULL pointers */
+			listval_new->Resize(numitems_orig+i); /* resize so we don't try release NULL pointers */
 			listval_new->Release();
 			return NULL; /* ConvertPythonToValue above sets the error */ 
 		}
@@ -436,7 +437,7 @@ static PyObject *listvalue_buffer_concat(PyObject * self, PyObject * other)
 	else if (PyObject_TypeCheck(other, &CListValue::Type)) {
 		// add items from otherlist to this list
 		CListValue* otherval = static_cast<CListValue *>(BGE_PROXY_REF(other));
-		if(otherval==NULL) {
+		if (otherval==NULL) {
 			listval_new->Release();
 			PyErr_SetString(PyExc_SystemError, "CList+other, "BGE_PROXY_ERROR_MSG);
 			return NULL;
@@ -445,7 +446,7 @@ static PyObject *listvalue_buffer_concat(PyObject * self, PyObject * other)
 		numitems = otherval->GetCount();
 		
 		/* copy the first part of the list */
-		listval_new->Resize(numitems_orig + numitems); /* resize so we dont try release NULL pointers */
+		listval_new->Resize(numitems_orig + numitems); /* resize so we don't try release NULL pointers */
 		for (i=0;i<numitems_orig;i++)
 			listval_new->SetValue(i, listval->GetValue(i)->AddRef());
 		
diff --git a/source/gameengine/Expressions/ListValue.h b/source/gameengine/Expressions/ListValue.h
index 26c11cc..83f8232 100644
--- a/source/gameengine/Expressions/ListValue.h
+++ b/source/gameengine/Expressions/ListValue.h
@@ -16,8 +16,8 @@
  *  \ingroup expressions
  */
 
-#if !defined _LISTVALUE_H
-#define _LISTVALUE_H
+#ifndef __LISTVALUE_H__
+#define __LISTVALUE_H__
 
 #include "Value.h"
 
@@ -34,7 +34,7 @@ public:
 	void Configure(CValue* menuvalue);
 	void Add(CValue* value);
 
-	/** @attention not implemented yet :( */
+	/** \attention not implemented yet :( */
 	virtual CValue* Calc(VALUE_OPERATOR op,CValue *val);
 	virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype,
 							  VALUE_OPERATOR op,
@@ -87,5 +87,5 @@ private:
 	bool	m_bReleaseContents;
 };
 
-#endif // !defined _LISTVALUE_H
+#endif // !defined __LISTVALUE_H__
 
diff --git a/source/gameengine/Expressions/Operator1Expr.cpp b/source/gameengine/Expressions/Operator1Expr.cpp
index 4e93ee0..98228df 100644
--- a/source/gameengine/Expressions/Operator1Expr.cpp
+++ b/source/gameengine/Expressions/Operator1Expr.cpp
@@ -103,7 +103,8 @@ bool COperator1Expr::NeedsRecalculated()
 	return m_lhs->NeedsRecalculated();
 }
 
-CExpression* COperator1Expr::CheckLink(std::vector<CBrokenLinkInfo*>& brokenlinks) {
+CExpression* COperator1Expr::CheckLink(std::vector<CBrokenLinkInfo*>& brokenlinks)
+{
 
 	CExpression* newlhs = m_lhs->CheckLink(brokenlinks);
 
diff --git a/source/gameengine/Expressions/Operator1Expr.h b/source/gameengine/Expressions/Operator1Expr.h
index c2e005c..9815ce1 100644
--- a/source/gameengine/Expressions/Operator1Expr.h
+++ b/source/gameengine/Expressions/Operator1Expr.h
@@ -31,7 +31,7 @@ public:
 	virtual bool MergeExpression(CExpression* otherexpr);
 	virtual void BroadcastOperators(VALUE_OPERATOR op);
 
-	virtual unsigned char GetExpressionID() { return COPERATOR1EXPRESSIONID;};
+	virtual unsigned char GetExpressionID() { return COPERATOR1EXPRESSIONID; }
 	CExpression* CheckLink(std::vector<CBrokenLinkInfo*>& brokenlinks);
 	//virtual bool IsInside(float x,float y,float z,bool bBorderInclude = true);
 	virtual	bool NeedsRecalculated();
diff --git a/source/gameengine/Expressions/Operator2Expr.cpp b/source/gameengine/Expressions/Operator2Expr.cpp
index 11a509e..2224b0f 100644
--- a/source/gameengine/Expressions/Operator2Expr.cpp
+++ b/source/gameengine/Expressions/Operator2Expr.cpp
@@ -127,14 +127,14 @@ bool COperator2Expr::IsInside(float x, float y, float z,bool bBorderInclude)
 			
 		bool second;//first ;//,second;
 		
-		//first = m_lhs->IsInside(x,y,z) ;
-		second = m_rhs->IsInside(x,y,z,bBorderInclude) ;
+		//first = m_lhs->IsInside(x,y,z);
+		second = m_rhs->IsInside(x,y,z,bBorderInclude);
 		if (second)
 			return true; //early out
 	
-	//	second = m_rhs->IsInside(x,y,z) ;
+	//	second = m_rhs->IsInside(x,y,z);
 
-		return m_lhs->IsInside(x,y,z,bBorderInclude) ;
+		return m_lhs->IsInside(x,y,z,bBorderInclude);
 			
 		break;
 							 }
@@ -144,7 +144,7 @@ bool COperator2Expr::IsInside(float x, float y, float z,bool bBorderInclude)
 		// todo: same as with add_operator: calc smallest leaf first
 
 		bool second;//first ;//,second;
-		//first = m_lhs->IsInside(x,y,z) ;
+		//first = m_lhs->IsInside(x,y,z);
 		second = m_rhs->IsInside(x,y,z,bBorderInclude);
 		if (second)
 			return false;
@@ -170,7 +170,7 @@ bool COperator2Expr::IsInside(float x, float y, float z,bool bBorderInclude)
 
 bool COperator2Expr::IsRightInside(float x, float y, float z,bool bBorderInclude)
 {
-	return m_rhs->IsInside(x,y,z,bBorderInclude) ;
+	return m_rhs->IsInside(x,y,z,bBorderInclude);
 }
 
 bool COperator2Expr::IsLeftInside(float x, float y, float z,bool bBorderInclude)
@@ -197,7 +197,8 @@ bool COperator2Expr::NeedsRecalculated()
 
 
 
-CExpression* COperator2Expr::CheckLink(std::vector<CBrokenLinkInfo*>& brokenlinks) {
+CExpression* COperator2Expr::CheckLink(std::vector<CBrokenLinkInfo*>& brokenlinks)
+{
 // if both children are 'dead', return NULL
 // if only one child is alive, return that child
 // if both childresn are alive, return this
@@ -243,10 +244,7 @@ CExpression* COperator2Expr::CheckLink(std::vector<CBrokenLinkInfo*>& brokenlink
 /		
 
   */
-  return Release();
-
-  
-	
+	return Release();
 }
 
 
diff --git a/source/gameengine/Expressions/Operator2Expr.h b/source/gameengine/Expressions/Operator2Expr.h
index 8064aee..8b1c552 100644
--- a/source/gameengine/Expressions/Operator2Expr.h
+++ b/source/gameengine/Expressions/Operator2Expr.h
@@ -16,8 +16,8 @@
  *  \ingroup expressions
  */
 
-#if !defined _OPERATOR2EXPR_H
-#define _OPERATOR2EXPR_H
+#ifndef __OPERATOR2EXPR_H__
+#define __OPERATOR2EXPR_H__
 
 
 #include "Expression.h"
@@ -29,7 +29,7 @@ class COperator2Expr : public CExpression
 
 public:
 	virtual bool MergeExpression(CExpression* otherexpr);
-	virtual unsigned char GetExpressionID() { return COPERATOR2EXPRESSIONID;};
+	virtual unsigned char GetExpressionID() { return COPERATOR2EXPRESSIONID; }
 	virtual void BroadcastOperators(VALUE_OPERATOR op);
 	CExpression* CheckLink(std::vector<CBrokenLinkInfo*>& brokenlinks);
 	//virtual bool IsInside(float x,float y,float z,bool bBorderInclude=true);
@@ -64,5 +64,5 @@ public:
 #endif
 };
 
-#endif // !defined _OPERATOR2EXPR_H
+#endif // !defined __OPERATOR2EXPR_H__
 
diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp
index d50ec0f..5347aaa 100644
--- a/source/gameengine/Expressions/PyObjectPlus.cpp
+++ b/source/gameengine/Expressions/PyObjectPlus.cpp
@@ -55,7 +55,7 @@
 PyObjectPlus::~PyObjectPlus()
 {
 #ifdef WITH_PYTHON
-	if(m_proxy) {
+	if (m_proxy) {
 		BGE_PROXY_REF(m_proxy)= NULL;
 		Py_DECREF(m_proxy);			/* Remove own reference, python may still have 1 */
 	}
@@ -90,7 +90,7 @@ void PyObjectPlus::ProcessReplica()
 void PyObjectPlus::InvalidateProxy()		// check typename of each parent
 {
 #ifdef WITH_PYTHON
-	if(m_proxy) {
+	if (m_proxy) {
 		BGE_PROXY_REF(m_proxy)=NULL;
 		Py_DECREF(m_proxy);
 		m_proxy= NULL;
@@ -137,7 +137,7 @@ PyTypeObject PyObjectPlus::Type = {
 PyObject *PyObjectPlus::py_base_repr(PyObject *self)			// This should be the entry in Type.
 {
 	PyObjectPlus *self_plus= BGE_PROXY_REF(self);
-	if(self_plus==NULL) {
+	if (self_plus==NULL) {
 		PyErr_SetString(PyExc_SystemError, BGE_PROXY_ERROR_MSG);
 		return NULL;
 	}
@@ -173,13 +173,13 @@ PyObject * PyObjectPlus::py_base_new(PyTypeObject *type, PyObject *args, PyObjec
 	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)) {
+	if (base_type==NULL || !BGE_PROXY_CHECK_TYPE(base_type)) {
 		PyErr_SetString(PyExc_TypeError, "can't subclass from a blender game type because the argument given is not a game class or subclass");
 		return NULL;
 	}
 
 	/* use base_type rather than Py_TYPE(base) because we could already be subtyped */
-	if(!PyType_IsSubtype(type, base_type)) {
+	if (!PyType_IsSubtype(type, base_type)) {
 		PyErr_Format(PyExc_TypeError, "can't subclass blender game type <%s> from <%s> because it is not a subclass", base_type->tp_name, type->tp_name);
 		return NULL;
 	}
@@ -199,7 +199,7 @@ PyObject * PyObjectPlus::py_base_new(PyTypeObject *type, PyObject *args, PyObjec
 		base->ptr = NULL;
 		if (ret->ref)
 			ret->ref->m_proxy= NULL;
-		/* 'base' may be free'd after this func finished but not necessarily
+		/* 'base' may be freed after this func finished but not necessarily
 		 * there is no reference to the BGE data now so it will throw an error on access */
 		Py_DECREF(base);
 		if (ret->ref) {
@@ -217,7 +217,7 @@ PyObject * PyObjectPlus::py_base_new(PyTypeObject *type, PyObject *args, PyObjec
 }
 
 /**
-  * @param self A PyObjectPlus_Proxy
+  * \param self A PyObjectPlus_Proxy
   */
 void PyObjectPlus::py_base_dealloc(PyObject *self)				// python wrapper
 {
@@ -228,8 +228,8 @@ void PyObjectPlus::py_base_dealloc(PyObject *self)				// python wrapper
 
 	if (BGE_PROXY_PYREF(self)) {
 		PyObjectPlus *self_plus= BGE_PROXY_REF(self);
-		if(self_plus) {
-			if(BGE_PROXY_PYOWNS(self)) { /* Does python own this?, then delete it  */
+		if (self_plus) {
+			if (BGE_PROXY_PYOWNS(self)) { /* Does python own this?, then delete it  */
 				self_plus->m_proxy = NULL; /* Need this to stop ~PyObjectPlus from decrefing m_proxy otherwise its decref'd twice and py-debug crashes */
 				delete self_plus;
 			}
@@ -239,8 +239,8 @@ void PyObjectPlus::py_base_dealloc(PyObject *self)				// python wrapper
 		BGE_PROXY_PTR(self)= NULL; // not really needed
 	} else {
 		void *ptr= BGE_PROXY_PTR(self);
-		if(ptr) {
-			if(BGE_PROXY_PYOWNS(self)) { /* Does python own this?, then delete it  */
+		if (ptr) {
+			if (BGE_PROXY_PYOWNS(self)) { /* Does python own this?, then delete it  */
 				// generic structure owned by python MUST be created though MEM_alloc
 				MEM_freeN(ptr);
 			}
@@ -280,9 +280,9 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
 {
 	PyObjectPlus *ref= (BGE_PROXY_REF(self_py));
 	char* ptr = (attrdef->m_usePtr) ? (char*)BGE_PROXY_PTR(self_py) : (char*)ref;
-	if(ptr == NULL || (BGE_PROXY_PYREF(self_py) && (ref==NULL || !ref->py_is_valid()))) {
-		if(attrdef == attr_invalid)
-			Py_RETURN_TRUE; // dont bother running the function
+	if (ptr == NULL || (BGE_PROXY_PYREF(self_py) && (ref==NULL || !ref->py_is_valid()))) {
+		if (attrdef == attr_invalid)
+			Py_RETURN_TRUE; // don't bother running the function
 
 		PyErr_SetString(PyExc_SystemError, BGE_PROXY_ERROR_MSG);
 		return NULL;
@@ -295,7 +295,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
 	}
 	if (attrdef->m_type == KX_PYATTRIBUTE_TYPE_FUNCTION)
 	{
-		// the attribute has no field correspondance, handover processing to function.
+		// the attribute has no field correspondence, handover processing to function.
 		if (attrdef->m_getFunction == NULL)
 			return NULL;
 		return (*attrdef->m_getFunction)(ptr, attrdef);
@@ -456,7 +456,8 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
 			{
 				MT_Vector3 *val = reinterpret_cast<MT_Vector3*>(ptr);
 #ifdef USE_MATHUTILS
-				float fval[3]= {(*val)[0], (*val)[1], (*val)[2]};
+				float fval[3];
+				val->getValue(fval);
 				return Vector_CreatePyObject(fval, 3, Py_NEW, NULL);
 #else
 				PyObject* resultlist = PyList_New(3);
@@ -512,7 +513,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
 {
 	PyObjectPlus *ref= (BGE_PROXY_REF(self_py));
 	char* ptr = (attrdef->m_usePtr) ? (char*)BGE_PROXY_PTR(self_py) : (char*)ref;
-	if(ref==NULL || !ref->py_is_valid() || ptr==NULL) {
+	if (ref==NULL || !ref->py_is_valid() || ptr==NULL) {
 		PyErr_SetString(PyExc_SystemError, BGE_PROXY_ERROR_MSG);
 		return PY_SET_ATTR_FAIL;
 	}
@@ -698,7 +699,7 @@ int PyObjectPlus::py_set_attrdef(PyObject *self_py, PyObject *value, const PyAtt
 		{
 			if ((*attrdef->m_checkFunction)(ref, attrdef) != 0)
 			{
-				// if the checing function didnt set an error then set a generic one here so we dont set an error with no exception
+				// if the checing function didnt set an error then set a generic one here so we don't set an error with no exception
 				if (PyErr_Occurred()==0)
 					PyErr_Format(PyExc_AttributeError, "type check error for attribute \"%s\", reasion unknown", attrdef->m_name);
 				
@@ -1150,7 +1151,7 @@ PyObject *PyObjectPlus::NewProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, v
 	}
 	if (self->m_proxy)
 	{
-		if(py_owns)
+		if (py_owns)
 		{	/* Free */
 			BGE_PROXY_REF(self->m_proxy) = NULL;
 			Py_DECREF(self->m_proxy);
@@ -1164,7 +1165,7 @@ PyObject *PyObjectPlus::NewProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, v
 	}
 	
 	GetProxyPlus_Ext(self, tp, ptr);
-	if(py_owns) {
+	if (py_owns) {
 		BGE_PROXY_PYOWNS(self->m_proxy) = py_owns;
 		Py_DECREF(self->m_proxy); /* could avoid thrashing here but for now its ok */
 	}
diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h
index 107ae45..278febe 100644
--- a/source/gameengine/Expressions/PyObjectPlus.h
+++ b/source/gameengine/Expressions/PyObjectPlus.h
@@ -29,8 +29,8 @@
  *  \ingroup expressions
  */
 
-#ifndef _PY_OBJECT_PLUS_H
-#define _PY_OBJECT_PLUS_H
+#ifndef __PYOBJECTPLUS_H__
+#define __PYOBJECTPLUS_H__
 
 /* for now keep weakrefs optional */
 #define USE_WEAKREFS
@@ -56,13 +56,6 @@ extern "C" {
 
 #define MAX_PROP_NAME 64
 
-static inline void Py_Fatal(const char *M)
-{
-	fprintf(stderr, "%s\n", M);
-	exit(-1);
-};
-
-
 /* Use with ShowDeprecationWarning macro */
 typedef struct {
 	bool warn_done;
@@ -113,7 +106,7 @@ typedef struct PyObjectPlus_Proxy {
 #  define BGE_PROXY_WKREF(_self) (((PyObjectPlus_Proxy *)_self)->in_weakreflist)
 #endif
 
-/* Note, sometimes we dont care what BGE type this is as long as its a proxy */
+/* Note, sometimes we don't care what BGE type this is as long as its a proxy */
 #define BGE_PROXY_CHECK_TYPE(_type) ((_type)->tp_dealloc == PyObjectPlus::py_base_dealloc)
 
 /* Opposite of BGE_PROXY_REF */
@@ -193,7 +186,7 @@ public:                                                                       \
 #define PY_SET_ATTR_SUCCESS		 0
 
 /**
- * These macros are helpfull when embedding Python routines. The second
+ * These macros are helpful when embedding Python routines. The second
  * macro is one that also requires a documentation string
  */
 #define KX_PYMETHOD(class_name, method_name)                                   \
@@ -616,10 +609,10 @@ public:
 
 	static PyObject *GetProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, void *ptr);
 	/* self=NULL => proxy to generic pointer detached from GE object
-	                if py_owns is true, the memory pointed by ptr will be deleted automatially with MEM_freeN 
-	   self!=NULL=> proxy attached to GE object, ptr is optional and point to a struct from which attributes can be defined
-	                if py_owns is true, the object will be deleted automatically, ptr will NOT be deleted 
-					(assume object destructor takes care of it) */
+	 *              if py_owns is true, the memory pointed by ptr will be deleted automatically with MEM_freeN
+	 * self!=NULL=> proxy attached to GE object, ptr is optional and point to a struct from which attributes can be defined
+	 *              if py_owns is true, the object will be deleted automatically, ptr will NOT be deleted
+	 *              (assume object destructor takes care of it) */
 	static PyObject *NewProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, void *ptr, bool py_owns);
 
 	static	WarnLink*		GetDeprecationWarningLinkFirst(void);
@@ -647,9 +640,7 @@ public:
 };
 
 #ifdef WITH_PYTHON
-PyObject *py_getattr_dict(PyObject *pydict, PyObject *tp_dict);
-
 PyObject *PyUnicode_From_STR_String(const STR_String& str);
 #endif
 
-#endif //  _PY_OBJECT_PLUS_H
+#endif //  __PYOBJECTPLUS_H__
diff --git a/source/gameengine/Expressions/StringValue.cpp b/source/gameengine/Expressions/StringValue.cpp
index 29c72a2..2e29a39 100644
--- a/source/gameengine/Expressions/StringValue.cpp
+++ b/source/gameengine/Expressions/StringValue.cpp
@@ -24,20 +24,20 @@
 // Construction/Destruction
 //////////////////////////////////////////////////////////////////////
 
+/**
+ * pre: false
+ * effect: constructs a new CStringValue
+ */
 CStringValue::CStringValue()
-/*
-pre: false
-effect: constructs a new CStringValue
-*/
 {
 	m_strString = "[Illegal String constructor call]";
 }
 
+/**
+ * pre:
+ * effect: constructs a new CStringValue containing text txt
+ */
 CStringValue::CStringValue(const char *txt,const char *name,AllocationTYPE alloctype)
-/*
-pre:
-effect: constructs a new CStringValue containing text txt
-*/
 {
 	m_strString = txt;
 	SetName(name);
@@ -52,23 +52,23 @@ effect: constructs a new CStringValue containing text txt
 }
 
 
+/**
+ * pre:
+ * ret: a new object containing the result of applying operator op to this
+ * object and val
+ */
 CValue* CStringValue::Calc(VALUE_OPERATOR op, CValue *val)
-/*
-pre:
-ret: a new object containing the result of applying operator op to this
-object and val
-*/
 {
 	//return val->CalrcString(op, this);
 	return val->CalcFinal(VALUE_STRING_TYPE, op, this);
 }
 
+/**
+ * pre: the type of val is dtype
+ * ret: a new object containing the result of applying operator op to val and
+ * this object
+ */
 CValue* CStringValue::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
-*/
 {
 	CValue *ret;
 	
diff --git a/source/gameengine/Expressions/Value.cpp b/source/gameengine/Expressions/Value.cpp
index 49150fc..30bc33a 100644
--- a/source/gameengine/Expressions/Value.cpp
+++ b/source/gameengine/Expressions/Value.cpp
@@ -325,7 +325,7 @@ bool CValue::RemoveProperty(const char *inName)
 vector<STR_String> CValue::GetPropertyNames()
 {
 	vector<STR_String> result;
-	if(!m_pNamedPropertyArray) return result;
+	if (!m_pNamedPropertyArray) return result;
 	result.reserve(m_pNamedPropertyArray->size());
 	
 	std::map<STR_String,CValue*>::iterator it;
@@ -366,7 +366,7 @@ void CValue::ClearProperties()
 //
 void CValue::SetPropertiesModified(bool inModified)
 {
-	if(!m_pNamedPropertyArray) return;
+	if (!m_pNamedPropertyArray) return;
 	std::map<STR_String,CValue*>::iterator it;
 	
 	for (it= m_pNamedPropertyArray->begin();(it != m_pNamedPropertyArray->end()); it++)
@@ -380,7 +380,7 @@ void CValue::SetPropertiesModified(bool inModified)
 //
 bool CValue::IsAnyPropertyModified()
 {
-	if(!m_pNamedPropertyArray) return false;
+	if (!m_pNamedPropertyArray) return false;
 	std::map<STR_String,CValue*>::iterator it;
 	
 	for (it= m_pNamedPropertyArray->begin();(it != m_pNamedPropertyArray->end()); it++)
@@ -433,7 +433,7 @@ int CValue::GetPropertyCount()
 
 double*		CValue::GetVector3(bool bGetTransformedVec)
 {
-	assertd(false); // don;t get vector from me
+	assertd(false); // don't get vector from me
 	return m_sZeroVec;//::sZero;
 }
 
@@ -585,7 +585,7 @@ CValue* CValue::ConvertPythonToValue(PyObject* pyobj, const char *error_prefix)
 	{
 		vallie = new CStringValue(_PyUnicode_AsString(pyobj),"");
 	} else
-	if (PyObject_TypeCheck(pyobj, &CValue::Type)) /* Note, dont let these get assigned to GameObject props, must check elsewhere */
+	if (PyObject_TypeCheck(pyobj, &CValue::Type)) /* Note, don't let these get assigned to GameObject props, must check elsewhere */
 	{
 		vallie = (static_cast<CValue *>(BGE_PROXY_REF(pyobj)))->AddRef();
 	} else
diff --git a/source/gameengine/Expressions/Value.h b/source/gameengine/Expressions/Value.h
index 10d8a8a..00320ff 100644
--- a/source/gameengine/Expressions/Value.h
+++ b/source/gameengine/Expressions/Value.h
@@ -26,6 +26,8 @@
 #include <map>		// array functionality for the propertylist
 #include "STR_String.h"	// STR_String class
 
+using namespace std;
+
 #ifdef WITH_CXX_GUARDEDALLOC
 #include "MEM_guardedalloc.h"
 #endif
@@ -150,7 +152,7 @@ struct ValueFlags {
 
 /**
  *	Base Class for all Actions performed on CValue's. Can be extended for undo/redo system in future.
-*/
+ */
 class CAction
 {
 public:
@@ -179,7 +181,7 @@ public:
  *
  * Together with CExpression, CValue and it's derived classes can be used to
  * parse expressions into a parsetree with error detecting/correcting capabilities
- * also expandible by a CFactory pluginsystem 
+ * also expandable by a CFactory pluginsystem 
  *
  * Base class for all editor functionality, flexible object type that allows
  * calculations and uses reference counting for memory management.
@@ -314,7 +316,7 @@ public:
 	virtual CValue*		FindIdentifier(const STR_String& identifiername);
 	/** Set the wireframe color of this value depending on the CSG
 	 * operator type <op>
-	 * @attention: not implemented */
+	 * \attention: not implemented */
 	virtual void		SetColorOperator(VALUE_OPERATOR op);
 
 	virtual const STR_String &	GetText() = 0;
@@ -325,7 +327,7 @@ public:
 	virtual STR_String&	GetName() = 0;											// Retrieve the name of the value
 	virtual void		SetName(const char *name) = 0;								// Set the name of the value
 	/** Sets the value to this cvalue.
-	 * @attention this particular function should never be called. Why not abstract? */
+	 * \attention this particular function should never be called. Why not abstract? */
 	virtual void		SetValue(CValue* newval);
 	virtual CValue*		GetReplica() =0;
 	virtual void			ProcessReplica();
diff --git a/source/gameengine/Expressions/VectorValue.cpp b/source/gameengine/Expressions/VectorValue.cpp
index 96cc5b4..65f5d7d 100644
--- a/source/gameengine/Expressions/VectorValue.cpp
+++ b/source/gameengine/Expressions/VectorValue.cpp
@@ -47,7 +47,8 @@ CVectorValue::CVectorValue(float x,float y,float z, AllocationTYPE alloctype)
 	m_vec[KX_Z] = m_transformedvec[KX_Z] = z;
 	
 }
-CVectorValue::CVectorValue(double vec[],const char *name,AllocationTYPE alloctype) {
+CVectorValue::CVectorValue(double vec[],const char *name,AllocationTYPE alloctype)
+{
 	
 	SetCustomFlag1(false);//FancyOutput=false;
 	
@@ -64,7 +65,8 @@ CVectorValue::CVectorValue(double vec[],const char *name,AllocationTYPE alloctyp
 	SetName(name);
 }
 
-CVectorValue::CVectorValue(double vec[],AllocationTYPE alloctype) {
+CVectorValue::CVectorValue(double vec[],AllocationTYPE alloctype)
+{
 	
 	SetCustomFlag1(false);//FancyOutput=false;
 	
@@ -85,12 +87,12 @@ CVectorValue::~CVectorValue()
 
 }
 
+/**
+ * pre: the type of val is dtype
+ * ret: a new object containing the result of applying operator op to val and
+ * this object
+ */
 CValue* CVectorValue::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
-*/
 {
 	CValue *ret = NULL;
 	
@@ -201,16 +203,16 @@ const STR_String & CVectorValue::GetText()
 	return gstrVectorStr;
 }
 
-CValue* CVectorValue::GetReplica() { 
+CValue* CVectorValue::GetReplica()
+{
 	CVectorValue* replica = new CVectorValue(*this);
 	replica->ProcessReplica();
 	return replica;
 };
 
-/*void CVectorValue::Transform(rcMatrix4x4 mat)
+#if 0
+void CVectorValue::Transform(rcMatrix4x4 mat)
 {
 	m_transformedvec = mat*m_vec;
 }
-*/
-
-
+#endif
diff --git a/source/gameengine/Expressions/VectorValue.h b/source/gameengine/Expressions/VectorValue.h
index 6ff4784..5d0e0c0 100644
--- a/source/gameengine/Expressions/VectorValue.h
+++ b/source/gameengine/Expressions/VectorValue.h
@@ -16,8 +16,8 @@
  *  \ingroup expressions
  */
 
-#if !defined _VECTORVALUE_H
-#define _VECTORVALUE_H
+#ifndef __VECTORVALUE_H__
+#define __VECTORVALUE_H__
 
 #include "Value.h"
 
@@ -59,7 +59,7 @@ public:
 	virtual CValue* GetReplica();
 	virtual const STR_String & GetText();
 
-/*
+#if 0
 	void			SnapPoint(float num,int snap)
 	{
 		if (num > 0) num += ((float)snap / 2);
@@ -78,8 +78,8 @@ public:
 			SnapPoint(m_vec[KX_Z],snapvec[KX_Z]);
 			
 	}
-*/
-	
+#endif
+
 protected:
 	double				m_vec[3];
 	double				m_transformedvec[3];
@@ -92,5 +92,5 @@ public:
 #endif
 };
 
-#endif // !defined _VECTORVALUE_H
+#endif // !defined __VECTORVALUE_H__
 
diff --git a/source/gameengine/GameLogic/CMakeLists.txt b/source/gameengine/GameLogic/CMakeLists.txt
index 98255bb..64f198f 100644
--- a/source/gameengine/GameLogic/CMakeLists.txt
+++ b/source/gameengine/GameLogic/CMakeLists.txt
@@ -28,6 +28,7 @@ set(INC
 	../Expressions
 	../Rasterizer
 	../SceneGraph
+	../../blender/blenlib
 	../../../intern/container
 	../../../intern/moto/include
 	../../../intern/string
diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
index 15aeef2..46ebd0e 100644
--- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
+++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp
@@ -51,10 +51,10 @@ SCA_Joystick::SCA_Joystick(short int index)
 	m_istrig_button(0),
 	m_istrig_hat(0)
 {
-	for(int i=0; i<JOYAXIS_MAX; i++)
+	for (int i=0; i<JOYAXIS_MAX; i++)
 		m_axis_array[i]= 0;
 	
-	for(int i=0; i<JOYHAT_MAX; i++)
+	for (int i=0; i<JOYHAT_MAX; i++)
 		m_hat_array[i]= 0;
 	
 #ifdef WITH_SDL
@@ -89,12 +89,12 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex )
 	{
 		int i;
 		// The video subsystem is required for joystick input to work. However,
-		// when GHOST is running under SDL, video is initialised elsewhere.
+		// 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 ){
+		if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1 ) {
 #  else
-		if(SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO) == -1 ){
+		if (SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO) == -1 ) {
 #  endif
 			echo("Error-Initializing-SDL: " << SDL_GetError());
 			return NULL;
@@ -239,7 +239,7 @@ bool SCA_Joystick::CreateJoystickDevice(void)
 	m_axismax = m_buttonmax = m_hatmax = 0;
 	return false;
 #else /* WITH_SDL */
-	if(m_isinit == false){
+	if (m_isinit == false) {
 		if (m_joyindex>=m_joynum) {
 			// don't print a message, because this is done anyway
 			//echo("Joystick-Error: " << SDL_NumJoysticks() << " avaiable joystick(s)");
@@ -264,9 +264,9 @@ bool SCA_Joystick::CreateJoystickDevice(void)
 		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;
+		else if (m_hatmax<0) m_hatmax= 0;
 		
-		if(m_buttonmax<0) m_buttonmax= 0;
+		if (m_buttonmax<0) m_buttonmax= 0;
 		
 	}
 	return true;
@@ -277,8 +277,8 @@ bool SCA_Joystick::CreateJoystickDevice(void)
 void SCA_Joystick::DestroyJoystickDevice(void)
 {
 #ifdef WITH_SDL
-	if (m_isinit){
-		if(SDL_JoystickOpened(m_joyindex)){
+	if (m_isinit) {
+		if (SDL_JoystickOpened(m_joyindex)) {
 			echo("Closing-joystick " << m_joyindex);
 			SDL_JoystickClose(m_private->m_joystick);
 		}
diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.h b/source/gameengine/GameLogic/Joystick/SCA_Joystick.h
index 4e3e3ef..a680971 100644
--- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.h
+++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.h
@@ -29,8 +29,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef _SCA_JOYSTICK_H_
-#define _SCA_JOYSTICK_H_
+#ifndef __SCA_JOYSTICK_H__
+#define __SCA_JOYSTICK_H__
 
 #include "SCA_JoystickDefines.h"
 #ifdef WITH_SDL
@@ -74,7 +74,7 @@ class SCA_Joystick
 
 	/**
 	 * max # of buttons avail
-	*/
+	 */
 	
 	int 			m_axismax;
 	int 			m_buttonmax;
@@ -114,7 +114,7 @@ class SCA_Joystick
 	void DestroyJoystickDevice(void);
 
 	/**
-	 * fills the axis mnember values 
+	 * fills the axis member values
 	 */
 	void pFillButtons(void);
 
@@ -134,8 +134,8 @@ class SCA_Joystick
 	
 public:
 
-	static SCA_Joystick *GetInstance( short int joyindex );
-	static void HandleEvents( void );
+	static SCA_Joystick *GetInstance(short int joyindex);
+	static void HandleEvents(void);
 	void ReleaseInstance();
 	
 
@@ -193,9 +193,6 @@ public:
 	 */
 	int Connected(void);
 };
-#ifdef WITH_SDL
-void Joystick_HandleEvents( void );
-#endif
 
 #endif
 
diff --git a/source/gameengine/GameLogic/Joystick/SCA_JoystickDefines.h b/source/gameengine/GameLogic/Joystick/SCA_JoystickDefines.h
index 69fc393..45766eb 100644
--- a/source/gameengine/GameLogic/Joystick/SCA_JoystickDefines.h
+++ b/source/gameengine/GameLogic/Joystick/SCA_JoystickDefines.h
@@ -29,8 +29,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef _SCA_JOYSTICKDEFINES_H_
-#define _SCA_JOYSTICKDEFINES_H_
+#ifndef __SCA_JOYSTICKDEFINES_H__
+#define __SCA_JOYSTICKDEFINES_H__
 
 #ifdef main
 #undef main
diff --git a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
index e1ab364..efe76c3 100644
--- a/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
+++ b/source/gameengine/GameLogic/Joystick/SCA_JoystickEvents.cpp
@@ -40,7 +40,7 @@
 #ifdef WITH_SDL
 void SCA_Joystick::OnAxisMotion(SDL_Event* sdl_event)
 {
-	if(sdl_event->jaxis.axis >= JOYAXIS_MAX)
+	if (sdl_event->jaxis.axis >= JOYAXIS_MAX)
 		return;
 	
 	m_axis_array[sdl_event->jaxis.axis]= sdl_event->jaxis.value;
@@ -50,7 +50,7 @@ void SCA_Joystick::OnAxisMotion(SDL_Event* sdl_event)
 /* See notes below in the event loop */
 void SCA_Joystick::OnHatMotion(SDL_Event* sdl_event)
 {
-	if(sdl_event->jhat.hat >= JOYHAT_MAX)
+	if (sdl_event->jhat.hat >= JOYHAT_MAX)
 		return;
 
 	m_hat_array[sdl_event->jhat.hat]= sdl_event->jhat.value;
@@ -66,7 +66,7 @@ void SCA_Joystick::OnButtonUp(SDL_Event* sdl_event)
 
 void SCA_Joystick::OnButtonDown(SDL_Event* sdl_event)
 {
-	//if(sdl_event->jbutton.button > m_buttonmax) /* unsigned int so always above 0 */
+	//if (sdl_event->jbutton.button > m_buttonmax) /* unsigned int so always above 0 */
 	//	return;
 	// sdl_event->jbutton.button;
 	
@@ -85,7 +85,7 @@ void SCA_Joystick::HandleEvents(void)
 	
 	int i;
 	for (i=0; i<m_joynum; i++) { /* could use JOYINDEX_MAX but no reason to */
-		if(SCA_Joystick::m_instance[i])
+		if (SCA_Joystick::m_instance[i])
 			SCA_Joystick::m_instance[i]->OnNothing(&sdl_event);
 	}
 	
diff --git a/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp b/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
index 05422ed..5ad5aed 100644
--- a/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
+++ b/source/gameengine/GameLogic/SCA_2DFilterActuator.cpp
@@ -55,7 +55,7 @@ SCA_2DFilterActuator::SCA_2DFilterActuator(
       m_scene(scene)
 {
 	m_gameobj = NULL;
-	if(gameobj){
+	if (gameobj) {
 		m_propNames = gameobj->GetPropertyNames();
 		m_gameobj = gameobj;
 	}
@@ -79,16 +79,16 @@ bool SCA_2DFilterActuator::Update()
 	if (bNegativeEvent)
 		return false; // do nothing on negative events
 
-	if( m_type == RAS_2DFilterManager::RAS_2DFILTER_MOTIONBLUR )
+	if ( m_type == RAS_2DFilterManager::RAS_2DFILTER_MOTIONBLUR )
 	{
-		if(!m_disableMotionBlur)
+		if (!m_disableMotionBlur)
 			m_rasterizer->EnableMotionBlur(m_float_arg);
 		else
 			m_rasterizer->DisableMotionBlur();
 
 		return false;
 	}
-	else if(m_type < RAS_2DFilterManager::RAS_2DFILTER_NUMBER_OF_FILTERS)
+	else if (m_type < RAS_2DFilterManager::RAS_2DFILTER_NUMBER_OF_FILTERS)
 	{
 		m_scene->Update2DFilter(m_propNames, m_gameobj, m_type, m_int_arg, m_shaderText);
 	}
diff --git a/source/gameengine/GameLogic/SCA_2DFilterActuator.h b/source/gameengine/GameLogic/SCA_2DFilterActuator.h
index 42446b7..a754d95 100644
--- a/source/gameengine/GameLogic/SCA_2DFilterActuator.h
+++ b/source/gameengine/GameLogic/SCA_2DFilterActuator.h
@@ -28,8 +28,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef __SCA_2DFILETRACTUATOR_H__
-#define __SCA_2DFILETRACTUATOR_H__
+#ifndef __SCA_2DFILTERACTUATOR_H__
+#define __SCA_2DFILTERACTUATOR_H__
 
 #include "RAS_IRasterizer.h"
 #include "SCA_IActuator.h"
diff --git a/source/gameengine/GameLogic/SCA_ANDController.h b/source/gameengine/GameLogic/SCA_ANDController.h
index 363bca6..ccc3f9b 100644
--- a/source/gameengine/GameLogic/SCA_ANDController.h
+++ b/source/gameengine/GameLogic/SCA_ANDController.h
@@ -32,8 +32,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef __KX_ANDCONTROLLER
-#define __KX_ANDCONTROLLER
+#ifndef __SCA_ANDCONTROLLER_H__
+#define __SCA_ANDCONTROLLER_H__
 
 #include "SCA_IController.h"
 
@@ -48,5 +48,5 @@ public:
 	virtual void Trigger(SCA_LogicManager* logicmgr);
 };
 
-#endif //__KX_ANDCONTROLLER
+#endif //__SCA_ANDCONTROLLER_H__
 
diff --git a/source/gameengine/GameLogic/SCA_ActuatorEventManager.h b/source/gameengine/GameLogic/SCA_ActuatorEventManager.h
index f4d2d7d..b91e6f8 100644
--- a/source/gameengine/GameLogic/SCA_ActuatorEventManager.h
+++ b/source/gameengine/GameLogic/SCA_ActuatorEventManager.h
@@ -29,8 +29,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef __KX_ACTUATOREVENTMANAGER
-#define __KX_ACTUATOREVENTMANAGER
+#ifndef __SCA_ACTUATOREVENTMANAGER_H__
+#define __SCA_ACTUATOREVENTMANAGER_H__
 
 #include "SCA_EventManager.h"
 
@@ -55,5 +55,5 @@ public:
 #endif
 };
 
-#endif //__KX_ACTUATOREVENTMANAGER
+#endif //__SCA_ACTUATOREVENTMANAGER_H__
 
diff --git a/source/gameengine/GameLogic/SCA_ActuatorSensor.h b/source/gameengine/GameLogic/SCA_ActuatorSensor.h
index e7a7525..e40c249 100644
--- a/source/gameengine/GameLogic/SCA_ActuatorSensor.h
+++ b/source/gameengine/GameLogic/SCA_ActuatorSensor.h
@@ -32,8 +32,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef __KX_ACTUATORSENSOR
-#define __KX_ACTUATORSENSOR
+#ifndef __SCA_ACTUATORSENSOR_H__
+#define __SCA_ACTUATORSENSOR_H__
 
 #include "SCA_ISensor.h"
 #include "SCA_IActuator.h"
diff --git a/source/gameengine/GameLogic/SCA_AlwaysEventManager.h b/source/gameengine/GameLogic/SCA_AlwaysEventManager.h
index 2801d64..21ac55d 100644
--- a/source/gameengine/GameLogic/SCA_AlwaysEventManager.h
+++ b/source/gameengine/GameLogic/SCA_AlwaysEventManager.h
@@ -29,8 +29,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef __KX_ALWAYSEVENTMGR
-#define __KX_ALWAYSEVENTMGR
+#ifndef __SCA_ALWAYSEVENTMANAGER_H__
+#define __SCA_ALWAYSEVENTMANAGER_H__
 #include "SCA_EventManager.h"
 #include <vector>
 
@@ -49,5 +49,5 @@ public:
 #endif
 };
 
-#endif //__KX_ALWAYSEVENTMGR
+#endif //__SCA_ALWAYSEVENTMANAGER_H__
 
diff --git a/source/gameengine/GameLogic/SCA_AlwaysSensor.h b/source/gameengine/GameLogic/SCA_AlwaysSensor.h
index 8748793..d0963fd 100644
--- a/source/gameengine/GameLogic/SCA_AlwaysSensor.h
+++ b/source/gameengine/GameLogic/SCA_AlwaysSensor.h
@@ -32,8 +32,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef __KX_ALWAYSSENSOR
-#define __KX_ALWAYSSENSOR
+#ifndef __SCA_ALWAYSSENSOR_H__
+#define __SCA_ALWAYSSENSOR_H__
 #include "SCA_ISensor.h"
 
 class SCA_AlwaysSensor : public SCA_ISensor
@@ -50,5 +50,5 @@ public:
 	virtual void Init();
 };
 
-#endif //__KX_ALWAYSSENSOR
+#endif //__SCA_ALWAYSSENSOR_H__
 
diff --git a/source/gameengine/GameLogic/SCA_BasicEventManager.h b/source/gameengine/GameLogic/SCA_BasicEventManager.h
index 73e3bab..9d08a77 100644
--- a/source/gameengine/GameLogic/SCA_BasicEventManager.h
+++ b/source/gameengine/GameLogic/SCA_BasicEventManager.h
@@ -32,8 +32,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef __SCA_BASICEVENTMGR
-#define __SCA_BASICEVENTMGR
+#ifndef __SCA_BASICEVENTMANAGER_H__
+#define __SCA_BASICEVENTMANAGER_H__
 
 #include "SCA_EventManager.h"
 #include <vector>
@@ -56,5 +56,5 @@ public:
 #endif
 };
 
-#endif //__SCA_BASICEVENTMGR
+#endif //__SCA_BASICEVENTMANAGER_H__
 
diff --git a/source/gameengine/GameLogic/SCA_DelaySensor.h b/source/gameengine/GameLogic/SCA_DelaySensor.h
index ccb8f00..2c40892 100644
--- a/source/gameengine/GameLogic/SCA_DelaySensor.h
+++ b/source/gameengine/GameLogic/SCA_DelaySensor.h
@@ -32,8 +32,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef __KX_DELAYSENSOR
-#define __KX_DELAYSENSOR
+#ifndef __SCA_DELAYSENSOR_H__
+#define __SCA_DELAYSENSOR_H__
 #include "SCA_ISensor.h"
 
 class SCA_DelaySensor : public SCA_ISensor
diff --git a/source/gameengine/GameLogic/SCA_EventManager.h b/source/gameengine/GameLogic/SCA_EventManager.h
index ea24b5c..933fdc5 100644
--- a/source/gameengine/GameLogic/SCA_EventManager.h
+++ b/source/gameengine/GameLogic/SCA_EventManager.h
@@ -29,8 +29,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef __KX_EVENTMANAGER
-#define __KX_EVENTMANAGER
+#ifndef __SCA_EVENTMANAGER_H__
+#define __SCA_EVENTMANAGER_H__
 
 #include <vector>
 #include <set>
diff --git a/source/gameengine/GameLogic/SCA_ExpressionController.h b/source/gameengine/GameLogic/SCA_ExpressionController.h
index 93a3f08..47401ea 100644
--- a/source/gameengine/GameLogic/SCA_ExpressionController.h
+++ b/source/gameengine/GameLogic/SCA_ExpressionController.h
@@ -32,8 +32,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef __KX_EXPRESSIONCONTROLLER
-#define __KX_EXPRESSIONCONTROLLER
+#ifndef __SCA_EXPRESSIONCONTROLLER_H__
+#define __SCA_EXPRESSIONCONTROLLER_H__
 
 #include "SCA_IController.h"
 
@@ -65,5 +65,5 @@ public:
 #endif
 };
 
-#endif //__KX_EXPRESSIONCONTROLLER
+#endif //__SCA_EXPRESSIONCONTROLLER_H__
 
diff --git a/source/gameengine/GameLogic/SCA_IActuator.h b/source/gameengine/GameLogic/SCA_IActuator.h
index feb21a7..211a25b 100644
--- a/source/gameengine/GameLogic/SCA_IActuator.h
+++ b/source/gameengine/GameLogic/SCA_IActuator.h
@@ -29,8 +29,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef __KX_IACTUATOR
-#define __KX_IACTUATOR
+#ifndef __SCA_IACTUATOR_H__
+#define __SCA_IACTUATOR_H__
 
 #include "SCA_IController.h"
 #include <vector>
@@ -166,5 +166,5 @@ public:
 #endif
 };
 
-#endif //__KX_IACTUATOR
+#endif //__SCA_IACTUATOR_H__
 
diff --git a/source/gameengine/GameLogic/SCA_IController.h b/source/gameengine/GameLogic/SCA_IController.h
index 5481f2a..1b15547 100644
--- a/source/gameengine/GameLogic/SCA_IController.h
+++ b/source/gameengine/GameLogic/SCA_IController.h
@@ -29,8 +29,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef __KX_ICONTROLLER
-#define __KX_ICONTROLLER
+#ifndef __SCA_ICONTROLLER_H__
+#define __SCA_ICONTROLLER_H__
 
 #include "SCA_ILogicBrick.h"
 #include "PyObjectPlus.h"
diff --git a/source/gameengine/GameLogic/SCA_IInputDevice.cpp b/source/gameengine/GameLogic/SCA_IInputDevice.cpp
index 181889f..16626b0 100644
--- a/source/gameengine/GameLogic/SCA_IInputDevice.cpp
+++ b/source/gameengine/GameLogic/SCA_IInputDevice.cpp
@@ -62,7 +62,7 @@ void SCA_IInputDevice::ClearStatusTable(int tableid)
 
 const SCA_InputEvent& SCA_IInputDevice::GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode)
 {
-  //	cerr << "SCA_IInputDevice::GetEventValue" << endl;
+//	cerr << "SCA_IInputDevice::GetEventValue" << endl;
 	return m_eventStatusTables[m_currentTable][inputcode];
 }
 
diff --git a/source/gameengine/GameLogic/SCA_IInputDevice.h b/source/gameengine/GameLogic/SCA_IInputDevice.h
index 5c36d88..443faef 100644
--- a/source/gameengine/GameLogic/SCA_IInputDevice.h
+++ b/source/gameengine/GameLogic/SCA_IInputDevice.h
@@ -32,8 +32,8 @@
  *
  */
 
-#ifndef KX_INPUTDEVICE_H
-#define KX_INPUTDEVICE_H
+#ifndef __SCA_IINPUTDEVICE_H__
+#define __SCA_IINPUTDEVICE_H__
 
 #ifdef WITH_CXX_GUARDEDALLOC
 #include "MEM_guardedalloc.h"
@@ -295,7 +295,7 @@ public:
 	virtual int		GetNumActiveEvents();
 
 	/**
-	 * Get the number of ramping events (just_activated, just_released)
+	 * Get the number of remapping events (just_activated, just_released)
 	 */
 	virtual int		GetNumJustEvents();
 	
@@ -322,5 +322,5 @@ public:
 #endif
 };
 
-#endif	//KX_INPUTDEVICE_H
+#endif	//__SCA_IINPUTDEVICE_H__
 
diff --git a/source/gameengine/GameLogic/SCA_ILogicBrick.h b/source/gameengine/GameLogic/SCA_ILogicBrick.h
index 051bc2a..9a23244 100644
--- a/source/gameengine/GameLogic/SCA_ILogicBrick.h
+++ b/source/gameengine/GameLogic/SCA_ILogicBrick.h
@@ -29,8 +29,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef __KX_ILOGICBRICK
-#define __KX_ILOGICBRICK
+#ifndef __SCA_ILOGICBRICK_H__
+#define __SCA_ILOGICBRICK_H__
 
 #include "Value.h"
 #include "SCA_IObject.h"
diff --git a/source/gameengine/GameLogic/SCA_IObject.h b/source/gameengine/GameLogic/SCA_IObject.h
index b0a03de..0e65779 100644
--- a/source/gameengine/GameLogic/SCA_IObject.h
+++ b/source/gameengine/GameLogic/SCA_IObject.h
@@ -31,8 +31,8 @@
  *   SceneGraph
  */
 
-#ifndef SCA_IOBJECT_H
-#define SCA_IOBJECT_H
+#ifndef __SCA_IOBJECT_H__
+#define __SCA_IOBJECT_H__
 
 #include "Value.h"
 #include <vector>
@@ -225,5 +225,5 @@ public:
 
 };
 
-#endif //SCA_IOBJECT_H
+#endif //__SCA_IOBJECT_H__
 
diff --git a/source/gameengine/GameLogic/SCA_IScene.h b/source/gameengine/GameLogic/SCA_IScene.h
index 78dd3f7..e7806ea 100644
--- a/source/gameengine/GameLogic/SCA_IScene.h
+++ b/source/gameengine/GameLogic/SCA_IScene.h
@@ -29,8 +29,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef __KX_ISCENE_H
-#define __KX_ISCENE_H
+#ifndef __SCA_ISCENE_H__
+#define __SCA_ISCENE_H__
 
 #include <vector>
 
@@ -68,7 +68,7 @@ public:
 	void			AddDebugProperty(class CValue* debugprop,
 									 const STR_String &name);
 	void			RemoveAllDebugProperties();
-	virtual void	Update2DFilter(vector<STR_String>& propNames, void* gameObj, 
+	virtual void	Update2DFilter(std::vector<STR_String>& propNames, void* gameObj, 
 									RAS_2DFilterManager::RAS_2DFILTER_MODE filtermode, 
 									int pass, STR_String& text) {}
 
@@ -80,5 +80,5 @@ public:
 #endif
 };
 
-#endif //__KX_ISCENE_H
+#endif //__SCA_ISCENE_H__
 
diff --git a/source/gameengine/GameLogic/SCA_ISensor.cpp b/source/gameengine/GameLogic/SCA_ISensor.cpp
index 2a903e4..4728729 100644
--- a/source/gameengine/GameLogic/SCA_ISensor.cpp
+++ b/source/gameengine/GameLogic/SCA_ISensor.cpp
@@ -174,7 +174,7 @@ void SCA_ISensor::RegisterToManager()
 
 void SCA_ISensor::Replace_EventManager(class SCA_LogicManager* logicmgr)
 {
-	if(m_links) { /* true if we're used currently */
+	if (m_links) { /* true if we're used currently */
 
 		m_eventmgr->RemoveSensor(this);
 		m_eventmgr= logicmgr->FindEventManager(m_eventmgr->GetType());
@@ -225,7 +225,7 @@ void SCA_ISensor::UnregisterToManager()
 
 void SCA_ISensor::ActivateControllers(class SCA_LogicManager* logicmgr)
 {
-	for(vector<SCA_IController*>::const_iterator c= m_linkedcontrollers.begin();
+	for (vector<SCA_IController*>::const_iterator c= m_linkedcontrollers.begin();
 	    c!=m_linkedcontrollers.end();++c)
 	{
 		SCA_IController* contr = *c;
@@ -257,7 +257,7 @@ void SCA_ISensor::Activate(class SCA_LogicManager* logicmgr)
 			}
 		} else
 		{
-			/* First, the pulsing behaviour, if pulse mode is
+			/* First, the pulsing behavior, if pulse mode is
 			 * active. It seems something goes wrong if pulse mode is
 			 * not set :( */
 			if (m_pos_pulsemode) {
@@ -305,7 +305,7 @@ void SCA_ISensor::Activate(class SCA_LogicManager* logicmgr)
 		{
 			// This level sensor is connected to at least one controller that was just made 
 			// active but it did not generate an event yet, do it now to those controllers only 
-			for(vector<SCA_IController*>::const_iterator c= m_linkedcontrollers.begin();
+			for (vector<SCA_IController*>::const_iterator c= m_linkedcontrollers.begin();
 				c!=m_linkedcontrollers.end();++c)
 			{
 				SCA_IController* contr = *c;
diff --git a/source/gameengine/GameLogic/SCA_ISensor.h b/source/gameengine/GameLogic/SCA_ISensor.h
index ef08209..3bb29f3 100644
--- a/source/gameengine/GameLogic/SCA_ISensor.h
+++ b/source/gameengine/GameLogic/SCA_ISensor.h
@@ -31,8 +31,8 @@
  *   pulsemode and pulsefrequency, and event suppression.
  */
 
-#ifndef __SCA_ISENSOR
-#define __SCA_ISENSOR
+#ifndef __SCA_ISENSOR_H__
+#define __SCA_ISENSOR_H__
 
 #include "SCA_IController.h"
 
@@ -107,7 +107,7 @@ public:
 	~SCA_ISensor();
 	virtual void	ReParent(SCA_IObject* parent);
 
-	/** Because we want sensors to share some behaviour, the Activate has     */
+	/** Because we want sensors to share some behavior, the Activate has     */
 	/* an implementation on this level. It requires an evaluate on the lower */
 	/* level of individual sensors. Mapping the old activate()s is easy.     */
 	/* The IsPosTrig() also has to change, to keep things consistent.        */
@@ -118,10 +118,10 @@ public:
 
 	virtual CValue* GetReplica()=0;
 
-	/** Set parameters for the pulsing behaviour.
-	 * @param posmode Trigger positive pulses?
-	 * @param negmode Trigger negative pulses?
-	 * @param freq    Frequency to use when doing pulsing.
+	/** Set parameters for the pulsing behavior.
+	 * \param posmode Trigger positive pulses?
+	 * \param negmode Trigger negative pulses?
+	 * \param freq    Frequency to use when doing pulsing.
 	 */
 	void SetPulseMode(bool posmode,
 					  bool negmode,
@@ -215,5 +215,5 @@ public:
 #endif // WITH_PYTHON
 };
 
-#endif //__SCA_ISENSOR
+#endif //__SCA_ISENSOR_H__
 
diff --git a/source/gameengine/GameLogic/SCA_JoystickManager.cpp b/source/gameengine/GameLogic/SCA_JoystickManager.cpp
index 2942384..c21db79 100644
--- a/source/gameengine/GameLogic/SCA_JoystickManager.cpp
+++ b/source/gameengine/GameLogic/SCA_JoystickManager.cpp
@@ -52,7 +52,7 @@ SCA_JoystickManager::~SCA_JoystickManager()
 {
 	int i;
 	for (i=0; i<JOYINDEX_MAX; i++) {
-		if(m_joystick[i])
+		if (m_joystick[i])
 			m_joystick[i]->ReleaseInstance();
 	}
 }
@@ -72,7 +72,7 @@ void SCA_JoystickManager::NextFrame(double curtime,double deltatime)
 		for (it.begin();!it.end();++it)
 		{
 			SCA_JoystickSensor* joysensor = *it;
-			if(!joysensor->IsSuspended())
+			if (!joysensor->IsSuspended())
 			{
 				joysensor->Activate(m_logicmgr);
 			}
diff --git a/source/gameengine/GameLogic/SCA_JoystickManager.h b/source/gameengine/GameLogic/SCA_JoystickManager.h
index dc778f2..dcdd667 100644
--- a/source/gameengine/GameLogic/SCA_JoystickManager.h
+++ b/source/gameengine/GameLogic/SCA_JoystickManager.h
@@ -29,8 +29,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef __JOYSTICKMANAGER_H_
-#define __JOYSTICKMANAGER_H_
+#ifndef __SCA_JOYSTICKMANAGER_H__
+#define __SCA_JOYSTICKMANAGER_H__
 
 #include "SCA_EventManager.h"
 #include "Joystick/SCA_Joystick.h"
diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
index 6aee6bd..07fad3b 100644
--- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
@@ -109,7 +109,7 @@ bool SCA_JoystickSensor::Evaluate()
 	bool result = false;
 	bool reset = m_reset && m_level;
 	
-	if(js==NULL) /* no joystick - dont do anything */
+	if (js==NULL) /* no joystick - don't do anything */
 		return false;
 	
 	m_reset = false;
@@ -129,27 +129,27 @@ bool SCA_JoystickSensor::Evaluate()
 				with expect a zero index.
 			*/
 			
-			if (!js->IsTrigAxis() && !reset) /* No events from SDL? - dont bother */
+			if (!js->IsTrigAxis() && !reset) /* No events from SDL? - don't bother */
 				return false;
 			
 			js->cSetPrecision(m_precision);
 			if (m_bAllEvents) {
-				if(js->aAxisPairIsPositive(m_axis-1)){ /* use zero based axis index internally */
+				if (js->aAxisPairIsPositive(m_axis-1)) { /* use zero based axis index internally */
 					m_istrig = 1;
 					result = true;
 				}else{
-					if(m_istrig){
+					if (m_istrig) {
 						m_istrig = 0;
 						result = true;
 					}
 				}
 			}
 			else {
-				if(js->aAxisPairDirectionIsPositive(m_axis-1, m_axisf)){ /* use zero based axis index internally */
+				if (js->aAxisPairDirectionIsPositive(m_axis-1, m_axisf)) { /* use zero based axis index internally */
 					m_istrig = 1;
 					result = true;
 				}else{
-					if(m_istrig){
+					if (m_istrig) {
 						m_istrig = 0;
 						result = true;
 					}
@@ -159,17 +159,17 @@ bool SCA_JoystickSensor::Evaluate()
 		}
 	case KX_JOYSENSORMODE_AXIS_SINGLE:
 		{
-			/* Like KX_JOYSENSORMODE_AXIS but dont pair up axis */
-			if (!js->IsTrigAxis() && !reset) /* No events from SDL? - dont bother */
+			/* Like KX_JOYSENSORMODE_AXIS but don't pair up axis */
+			if (!js->IsTrigAxis() && !reset) /* No events from SDL? - don't bother */
 				return false;
 			
 			/* No need for 'm_bAllEvents' check here since were only checking 1 axis */
 			js->cSetPrecision(m_precision);
-			if(js->aAxisIsPositive(m_axis-1)){ /* use zero based axis index internally */
+			if (js->aAxisIsPositive(m_axis-1)) { /* use zero based axis index internally */
 				m_istrig = 1;
 				result = true;
 			}else{
-				if(m_istrig){
+				if (m_istrig) {
 					m_istrig = 0;
 					result = true;
 				}
@@ -182,14 +182,14 @@ bool SCA_JoystickSensor::Evaluate()
 		/* what is what!
 			m_button = the actual button in question
 			*/
-			if (!js->IsTrigButton() && !reset) /* No events from SDL? - dont bother */
+			if (!js->IsTrigButton() && !reset) /* No events from SDL? - don't bother */
 				return false;
 			
-			if(( m_bAllEvents && js->aAnyButtonPressIsPositive()) || (!m_bAllEvents && js->aButtonPressIsPositive(m_button))) {
+			if (( m_bAllEvents && js->aAnyButtonPressIsPositive()) || (!m_bAllEvents && js->aButtonPressIsPositive(m_button))) {
 				m_istrig = 1;
 				result = true;
 			}else {
-				if(m_istrig){
+				if (m_istrig) {
 					m_istrig = 0;
 					result = true;
 				}
@@ -203,14 +203,14 @@ bool SCA_JoystickSensor::Evaluate()
 			direction= m_hatf -- max 12
 			*/
 			
-			if (!js->IsTrigHat() && !reset) /* No events from SDL? - dont bother */
+			if (!js->IsTrigHat() && !reset) /* No events from SDL? - don't bother */
 				return false;
 			
-			if((m_bAllEvents && js->GetHat(m_hat-1)) || js->aHatIsPositive(m_hat-1, m_hatf)) {
+			if ((m_bAllEvents && js->GetHat(m_hat-1)) || js->aHatIsPositive(m_hat-1, m_hatf)) {
 				m_istrig = 1;
 				result = true;
 			}else{
-				if(m_istrig){
+				if (m_istrig) {
 					m_istrig = 0;
 					result = true;
 				}
@@ -303,13 +303,14 @@ PyAttributeDef SCA_JoystickSensor::Attributes[] = {
 const char SCA_JoystickSensor::GetButtonActiveList_doc[] = 
 "getButtonActiveList\n"
 "\tReturns a list containing the indices of the button currently pressed.\n";
-PyObject* SCA_JoystickSensor::PyGetButtonActiveList( ) {
+PyObject* SCA_JoystickSensor::PyGetButtonActiveList( )
+{
 	SCA_Joystick *joy = ((SCA_JoystickManager *)m_eventmgr)->GetJoystickDevice(m_joyindex);
 	PyObject *ls = PyList_New(0);
 	PyObject *value;
 	int i;
 	
-	if(joy) {
+	if (joy) {
 		for (i=0; i < joy->GetNumberOfButtons(); i++) {
 			if (joy->aButtonPressIsPositive(i)) {
 				value = PyLong_FromSsize_t(i);
@@ -325,14 +326,15 @@ PyObject* SCA_JoystickSensor::PyGetButtonActiveList( ) {
 const char SCA_JoystickSensor::GetButtonStatus_doc[] = 
 "getButtonStatus(buttonIndex)\n"
 "\tReturns a bool of the current pressed state of the specified button.\n";
-PyObject* SCA_JoystickSensor::PyGetButtonStatus( PyObject* args ) {
+PyObject* SCA_JoystickSensor::PyGetButtonStatus( PyObject* args )
+{
 	SCA_Joystick *joy = ((SCA_JoystickManager *)m_eventmgr)->GetJoystickDevice(m_joyindex);
 	int index;
 	
-	if(!PyArg_ParseTuple(args, "i:getButtonStatus", &index)){
+	if (!PyArg_ParseTuple(args, "i:getButtonStatus", &index)) {
 		return NULL;
 	}
-	if(joy && index >= 0 && index < joy->GetNumberOfButtons()) {
+	if (joy && index >= 0 && index < joy->GetNumberOfButtons()) {
 		return PyBool_FromLong(joy->aButtonPressIsPositive(index) ? 1 : 0);
 	}
 	return PyBool_FromLong(0);
@@ -358,7 +360,7 @@ PyObject* SCA_JoystickSensor::pyattr_get_axis_single(void *self_v, const KX_PYAT
 	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) {
+	if (self->m_joymode != KX_JOYSENSORMODE_AXIS_SINGLE) {
 		PyErr_SetString(PyExc_TypeError, "val = sensor.axisSingle: Joystick Sensor, not 'Single Axis' type");
 		return NULL;
 	}
diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.h b/source/gameengine/GameLogic/SCA_JoystickSensor.h
index db34ce4..eecbf2c 100644
--- a/source/gameengine/GameLogic/SCA_JoystickSensor.h
+++ b/source/gameengine/GameLogic/SCA_JoystickSensor.h
@@ -65,7 +65,7 @@ class SCA_JoystickSensor :public SCA_ISensor
 	 */
 	int 	m_hatf;
 	/**
-	 * The threshold value the axis acts opon
+	 * The threshold value the axis acts upon
 	 */
 	int 	m_precision;
 	/**
diff --git a/source/gameengine/GameLogic/SCA_KeyboardManager.cpp b/source/gameengine/GameLogic/SCA_KeyboardManager.cpp
index 3111ad0..edf1f30 100644
--- a/source/gameengine/GameLogic/SCA_KeyboardManager.cpp
+++ b/source/gameengine/GameLogic/SCA_KeyboardManager.cpp
@@ -64,7 +64,7 @@ SCA_IInputDevice* SCA_KeyboardManager::GetInputDevice()
 void SCA_KeyboardManager::NextFrame()
 {
 	//const SCA_InputEvent& event =	GetEventValue(SCA_IInputDevice::KX_EnumInputs inputcode)=0;
-  //	cerr << "SCA_KeyboardManager::NextFrame"<< endl;
+//	cerr << "SCA_KeyboardManager::NextFrame"<< endl;
 	SG_DList::iterator<SCA_ISensor> it(m_sensors);
 	for (it.begin();!it.end();++it)
 	{
diff --git a/source/gameengine/GameLogic/SCA_KeyboardManager.h b/source/gameengine/GameLogic/SCA_KeyboardManager.h
index 55dd189..5706d16 100644
--- a/source/gameengine/GameLogic/SCA_KeyboardManager.h
+++ b/source/gameengine/GameLogic/SCA_KeyboardManager.h
@@ -31,8 +31,8 @@
  *
  */
 
-#ifndef __KX_KEYBOARDMANAGER
-#define __KX_KEYBOARDMANAGER
+#ifndef __SCA_KEYBOARDMANAGER_H__
+#define __SCA_KEYBOARDMANAGER_H__
 
 
 #include "SCA_EventManager.h"
@@ -65,5 +65,5 @@ public:
 #endif
 };
 
-#endif //__KX_KEYBOARDMANAGER
+#endif //__SCA_KEYBOARDMANAGER_H__
 
diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
index 97cd01d..b39ae20 100644
--- a/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
@@ -39,6 +39,10 @@
 #include "StringValue.h"
 #include "SCA_IInputDevice.h"
 
+extern "C" {
+	#include "BLI_string_cursor_utf8.h"
+}
+
 /* ------------------------------------------------------------------------- */
 /* Native functions                                                          */
 /* ------------------------------------------------------------------------- */
@@ -294,7 +298,7 @@ bool SCA_KeyboardSensor::Evaluate()
 		}
 		
 		/* Modify the key state based on qual(s)
-		 * Tested carefuly. dont touch unless your really sure.
+		 * Tested carefully. don't touch unless your really sure.
 		 * note, this will only change the results if key modifiers are set.
 		 *
 		 * When all modifiers and keys are positive
@@ -338,7 +342,11 @@ void SCA_KeyboardSensor::AddToTargetProp(int keyIndex)
 				STR_String newprop = tprop->GetText();
 				int oldlength = newprop.Length();
 				if (oldlength >= 1 ) {
-					newprop.SetLength(oldlength - 1);
+					int newlength=oldlength;
+
+					BLI_str_cursor_step_prev_utf8(newprop, newprop.Length(), &newlength);
+					newprop.SetLength(newlength);
+
 					CStringValue * newstringprop = new CStringValue(newprop, m_targetprop);
 					GetParent()->SetProperty(m_targetprop, newstringprop);
 					newstringprop->Release();
@@ -432,7 +440,7 @@ KX_PYMETHODDEF_DOC_O(SCA_KeyboardSensor, getKeyStatus,
 	int keycode = PyLong_AsSsize_t(value);
 	
 	if ((keycode < SCA_IInputDevice::KX_BEGINKEY)
-		|| (keycode > SCA_IInputDevice::KX_ENDKEY)){
+		|| (keycode > SCA_IInputDevice::KX_ENDKEY)) {
 		PyErr_SetString(PyExc_AttributeError, "sensor.getKeyStatus(int): Keyboard Sensor, invalid keycode specified!");
 		return NULL;
 	}
diff --git a/source/gameengine/GameLogic/SCA_KeyboardSensor.h b/source/gameengine/GameLogic/SCA_KeyboardSensor.h
index 441c833..8e21d6b 100644
--- a/source/gameengine/GameLogic/SCA_KeyboardSensor.h
+++ b/source/gameengine/GameLogic/SCA_KeyboardSensor.h
@@ -30,8 +30,8 @@
  *  \brief Sensor for keyboard input
  */
 
-#ifndef __KX_KEYBOARDSENSOR
-#define __KX_KEYBOARDSENSOR
+#ifndef __SCA_KEYBOARDSENSOR_H__
+#define __SCA_KEYBOARDSENSOR_H__
 
 #include "SCA_ISensor.h"
 #include "BoolValue.h"
@@ -137,7 +137,7 @@ bool IsPrintable(int keyIndex);
 bool IsDelete(int keyIndex);
 
 
-#endif //__KX_KEYBOARDSENSOR
+#endif //__SCA_KEYBOARDSENSOR_H__
 
 
 
diff --git a/source/gameengine/GameLogic/SCA_LogicManager.cpp b/source/gameengine/GameLogic/SCA_LogicManager.cpp
index a684ce9..6543d16 100644
--- a/source/gameengine/GameLogic/SCA_LogicManager.cpp
+++ b/source/gameengine/GameLogic/SCA_LogicManager.cpp
@@ -23,7 +23,7 @@
  * Contributor(s): none yet.
  *
  * ***** END GPL LICENSE BLOCK *****
- * Regulates the top-level logic behaviour for one scene.
+ * Regulates the top-level logic behavior for one scene.
  */
 
 /** \file gameengine/GameLogic/SCA_LogicManager.cpp
@@ -189,11 +189,11 @@ void SCA_LogicManager::BeginFrame(double curtime, double fixedtime)
 	for (vector<SCA_EventManager*>::const_iterator ie=m_eventmanagers.begin(); !(ie==m_eventmanagers.end()); ie++)
 		(*ie)->NextFrame(curtime, fixedtime);
 
-	for(SG_QList* obj = (SG_QList*)m_triggeredControllerSet.Remove();
+	for (SG_QList* obj = (SG_QList*)m_triggeredControllerSet.Remove();
 		obj != NULL;
 		obj = (SG_QList*)m_triggeredControllerSet.Remove())
 	{
-		for(SCA_IController* contr = (SCA_IController*)obj->QRemove();
+		for (SCA_IController* contr = (SCA_IController*)obj->QRemove();
 			contr != NULL;
 			contr = (SCA_IController*)obj->QRemove())
 		{
diff --git a/source/gameengine/GameLogic/SCA_LogicManager.h b/source/gameengine/GameLogic/SCA_LogicManager.h
index ec83430..751c03b 100644
--- a/source/gameengine/GameLogic/SCA_LogicManager.h
+++ b/source/gameengine/GameLogic/SCA_LogicManager.h
@@ -26,10 +26,10 @@
  */
 /** \file SCA_IController.h
  *  \ingroup gamelogic
- *  \brief Regulates the top-level logic behaviour for one scene.
+ *  \brief Regulates the top-level logic behavior for one scene.
  */
-#ifndef __KX_LOGICMANAGER
-#define __KX_LOGICMANAGER
+#ifndef __SCA_LOGICMANAGER_H__
+#define __SCA_LOGICMANAGER_H__
 
 #if defined(WIN32) && !defined(FREE_WINDOWS)
 #pragma warning (disable:4786)
@@ -127,8 +127,8 @@ public:
 	// for the scripting... needs a FactoryManager later (if we would have time... ;)
 	void	RegisterMeshName(const STR_String& meshname,void* mesh);
 	void	UnregisterMeshName(const STR_String& meshname,void* mesh);
-	CTR_Map<STR_HashedString,void*>&	GetMeshMap() { return m_mapStringToMeshes; };
-	CTR_Map<STR_HashedString,void*>&	GetActionMap() { return m_mapStringToActions; };
+	CTR_Map<STR_HashedString,void*>&	GetMeshMap() { return m_mapStringToMeshes; }
+	CTR_Map<STR_HashedString,void*>&	GetActionMap() { return m_mapStringToActions; }
 	
 	void	RegisterActionName(const STR_String& actname,void* action);
 
@@ -153,5 +153,5 @@ public:
 #endif
 };
 
-#endif //__KX_LOGICMANAGER
+#endif //__SCA_LOGICMANAGER_H__
 
diff --git a/source/gameengine/GameLogic/SCA_MouseManager.h b/source/gameengine/GameLogic/SCA_MouseManager.h
index d22d27b..4b40ab8 100644
--- a/source/gameengine/GameLogic/SCA_MouseManager.h
+++ b/source/gameengine/GameLogic/SCA_MouseManager.h
@@ -32,8 +32,8 @@
  */
 
 
-#ifndef __KX_MOUSEMANAGER
-#define __KX_MOUSEMANAGER
+#ifndef __SCA_MOUSEMANAGER_H__
+#define __SCA_MOUSEMANAGER_H__
 
 
 #include "SCA_EventManager.h"
@@ -60,7 +60,7 @@ public:
 
 	/**
 	 * Checks whether a mouse button is depressed. Ignores requests on non-
-	 * mouse related evenst. Can also flag mouse movement.
+	 * mouse related events. Can also flag mouse movement.
 	 */
 	bool IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode);
 	virtual void 	NextFrame();	
@@ -74,5 +74,5 @@ public:
 #endif
 };
 
-#endif //__KX_MOUSEMANAGER
+#endif //__SCA_MOUSEMANAGER_H__
 
diff --git a/source/gameengine/GameLogic/SCA_MouseSensor.cpp b/source/gameengine/GameLogic/SCA_MouseSensor.cpp
index 919247d..f4ee54c 100644
--- a/source/gameengine/GameLogic/SCA_MouseSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_MouseSensor.cpp
@@ -156,7 +156,7 @@ bool SCA_MouseSensor::Evaluate()
 	case KX_MOUSESENSORMODE_WHEELDOWN:
 		{
 			const SCA_InputEvent& mevent = mousedev->GetEventValue(m_hotkey);
-			switch (mevent.m_status){	
+			switch (mevent.m_status) {	
 			case SCA_InputEvent::KX_JUSTACTIVATED:
 				m_val = 1;
 				result = true;
@@ -253,7 +253,7 @@ KX_PYMETHODDEF_DOC_O(SCA_MouseSensor, getButtonStatus,
 		int button = PyLong_AsSsize_t(value);
 		
 		if ((button < SCA_IInputDevice::KX_LEFTMOUSE)
-			|| (button > SCA_IInputDevice::KX_RIGHTMOUSE)){
+			|| (button > SCA_IInputDevice::KX_RIGHTMOUSE)) {
 			PyErr_SetString(PyExc_ValueError, "sensor.getButtonStatus(int): Mouse Sensor, invalid button specified!");
 			return NULL;
 		}
diff --git a/source/gameengine/GameLogic/SCA_MouseSensor.h b/source/gameengine/GameLogic/SCA_MouseSensor.h
index 91352ce..d4eff37 100644
--- a/source/gameengine/GameLogic/SCA_MouseSensor.h
+++ b/source/gameengine/GameLogic/SCA_MouseSensor.h
@@ -30,8 +30,8 @@
  *  \brief Senses mouse events
  */
 
-#ifndef __KX_MOUSESENSOR
-#define __KX_MOUSESENSOR
+#ifndef __SCA_MOUSESENSOR_H__
+#define __SCA_MOUSESENSOR_H__
 
 #include "SCA_ISensor.h"
 #include "BoolValue.h"
@@ -117,5 +117,5 @@ class SCA_MouseSensor : public SCA_ISensor
 #endif
 };
 
-#endif //__KX_MOUSESENSOR
+#endif //__SCA_MOUSESENSOR_H__
 
diff --git a/source/gameengine/GameLogic/SCA_NANDController.h b/source/gameengine/GameLogic/SCA_NANDController.h
index 723d2a5..040df7f 100644
--- a/source/gameengine/GameLogic/SCA_NANDController.h
+++ b/source/gameengine/GameLogic/SCA_NANDController.h
@@ -29,8 +29,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef __KX_NANDCONTROLLER
-#define __KX_NANDCONTROLLER
+#ifndef __SCA_NANDCONTROLLER_H__
+#define __SCA_NANDCONTROLLER_H__
 
 #include "SCA_IController.h"
 
@@ -49,5 +49,5 @@ public:
 	/* --------------------------------------------------------------------- */
 };
 
-#endif //__KX_NANDCONTROLLER
+#endif //__SCA_NANDCONTROLLER_H__
 
diff --git a/source/gameengine/GameLogic/SCA_NORController.h b/source/gameengine/GameLogic/SCA_NORController.h
index 26d7e92..1630f80 100644
--- a/source/gameengine/GameLogic/SCA_NORController.h
+++ b/source/gameengine/GameLogic/SCA_NORController.h
@@ -29,8 +29,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef __KX_NORCONTROLLER
-#define __KX_NORCONTROLLER
+#ifndef __SCA_NORCONTROLLER_H__
+#define __SCA_NORCONTROLLER_H__
 
 #include "SCA_IController.h"
 
@@ -45,5 +45,5 @@ public:
 	virtual void Trigger(SCA_LogicManager* logicmgr);
 };
 
-#endif //__KX_NORCONTROLLER
+#endif //__SCA_NORCONTROLLER_H__
 
diff --git a/source/gameengine/GameLogic/SCA_ORController.h b/source/gameengine/GameLogic/SCA_ORController.h
index 53debf8..9a4e4c7 100644
--- a/source/gameengine/GameLogic/SCA_ORController.h
+++ b/source/gameengine/GameLogic/SCA_ORController.h
@@ -29,8 +29,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef __KX_ORCONTROLLER
-#define __KX_ORCONTROLLER
+#ifndef __SCA_ORCONTROLLER_H__
+#define __SCA_ORCONTROLLER_H__
 
 #include "SCA_IController.h"
 
@@ -46,5 +46,5 @@ public:
 	virtual void Trigger(SCA_LogicManager* logicmgr);
 };
 
-#endif //__KX_ORCONTROLLER
+#endif //__SCA_ORCONTROLLER_H__
 
diff --git a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp
index 544b1da..31f988f 100644
--- a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp
+++ b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp
@@ -83,7 +83,7 @@ bool SCA_PropertyActuator::Update()
 	
 	if (m_type==KX_ACT_PROP_TOGGLE)
 	{
-		/* dont use */
+		/* don't use */
 		CValue* newval;
 		CValue* oldprop = propowner->GetProperty(m_propname);
 		if (oldprop)
@@ -172,7 +172,7 @@ isValid(
 
 	SCA_PropertyActuator::KX_ACT_PROP_MODE mode
 
-){
+) {
 	bool res = false;	
 	res = ((mode > KX_ACT_PROP_NODEF) && (mode < KX_ACT_PROP_MAX));
 	return res;
@@ -183,7 +183,8 @@ isValid(
 
 SCA_PropertyActuator::
 
-GetReplica() {
+GetReplica()
+{
 
 	SCA_PropertyActuator* replica = new SCA_PropertyActuator(*this);
 
diff --git a/source/gameengine/GameLogic/SCA_PropertyActuator.h b/source/gameengine/GameLogic/SCA_PropertyActuator.h
index 17419e3..e465098 100644
--- a/source/gameengine/GameLogic/SCA_PropertyActuator.h
+++ b/source/gameengine/GameLogic/SCA_PropertyActuator.h
@@ -29,8 +29,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef __KX_PROPERTYACTUATOR
-#define __KX_PROPERTYACTUATOR
+#ifndef __SCA_PROPERTYACTUATOR_H__
+#define __SCA_PROPERTYACTUATOR_H__
 
 #include "SCA_IActuator.h"
 
diff --git a/source/gameengine/GameLogic/SCA_PropertyEventManager.h b/source/gameengine/GameLogic/SCA_PropertyEventManager.h
index 3e8a947..7d5e13f 100644
--- a/source/gameengine/GameLogic/SCA_PropertyEventManager.h
+++ b/source/gameengine/GameLogic/SCA_PropertyEventManager.h
@@ -29,8 +29,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef __KX_PROPERTYEVENTMANAGER
-#define __KX_PROPERTYEVENTMANAGER
+#ifndef __SCA_PROPERTYEVENTMANAGER_H__
+#define __SCA_PROPERTYEVENTMANAGER_H__
 
 #include "SCA_EventManager.h"
 
@@ -54,5 +54,5 @@ public:
 #endif
 };
 
-#endif //__KX_PROPERTYEVENTMANAGER
+#endif //__SCA_PROPERTYEVENTMANAGER_H__
 
diff --git a/source/gameengine/GameLogic/SCA_PropertySensor.cpp b/source/gameengine/GameLogic/SCA_PropertySensor.cpp
index 8e324bb..d0d940a 100644
--- a/source/gameengine/GameLogic/SCA_PropertySensor.cpp
+++ b/source/gameengine/GameLogic/SCA_PropertySensor.cpp
@@ -198,10 +198,10 @@ bool	SCA_PropertySensor::CheckPropertyCondition()
 				/* Patch: floating point values cant use strings usefully since you can have "0.0" == "0.0000"
 				 * this could be made into a generic Value class function for comparing values with a string.
 				 */
-				if(result==false && dynamic_cast<CFloatValue *>(orgprop) != NULL) {
+				if (result==false && dynamic_cast<CFloatValue *>(orgprop) != NULL) {
 					float f;
 					
-					if(EOF == sscanf(m_checkpropval.ReadPtr(), "%f", &f))
+					if (EOF == sscanf(m_checkpropval.ReadPtr(), "%f", &f))
 					{
 						//error
 					} 
diff --git a/source/gameengine/GameLogic/SCA_PropertySensor.h b/source/gameengine/GameLogic/SCA_PropertySensor.h
index bf7b1e8..ca94207 100644
--- a/source/gameengine/GameLogic/SCA_PropertySensor.h
+++ b/source/gameengine/GameLogic/SCA_PropertySensor.h
@@ -30,8 +30,8 @@
  *  \brief Property sensor
  */
 
-#ifndef __KX_PROPERTYSENSOR
-#define __KX_PROPERTYSENSOR
+#ifndef __SCA_PROPERTYSENSOR_H__
+#define __SCA_PROPERTYSENSOR_H__
 
 #include "SCA_ISensor.h"
 
diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp
index 8a87a73..6f1e6e3 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonController.cpp
@@ -182,7 +182,7 @@ int SCA_PythonController::IsTriggered(class SCA_ISensor* sensor)
 /* warning, self is not the SCA_PythonController, its a PyObjectPlus_Proxy */
 PyObject* SCA_PythonController::sPyGetCurrentController(PyObject *self)
 {
-	if(m_sCurrentController==NULL)
+	if (m_sCurrentController==NULL)
 	{
 		PyErr_SetString(PyExc_SystemError, "bge.logic.getCurrentController(), this function is being run outside the python controllers context, or blenders internal state is corrupt.");
 		return NULL;
@@ -200,16 +200,16 @@ SCA_IActuator* SCA_PythonController::LinkedActuatorFromPy(PyObject *value)
 	if (PyUnicode_Check(value)) {
 		/* get the actuator from the name */
 		const char *name= _PyUnicode_AsString(value);
-		for(it = lacts.begin(); it!= lacts.end(); ++it) {
-			if( name == (*it)->GetName() ) {
+		for (it = lacts.begin(); it!= lacts.end(); ++it) {
+			if ( name == (*it)->GetName() ) {
 				return *it;
 			}
 		}
 	}
 	else if (PyObject_TypeCheck(value, &SCA_IActuator::Type)) {
 		PyObjectPlus *value_plus= BGE_PROXY_REF(value);
-		for(it = lacts.begin(); it!= lacts.end(); ++it) {
-			if( static_cast<SCA_IActuator*>(value_plus) == (*it) ) {
+		for (it = lacts.begin(); it!= lacts.end(); ++it) {
+			if ( static_cast<SCA_IActuator*>(value_plus) == (*it) ) {
 				return *it;
 			}
 		}
@@ -265,7 +265,7 @@ void SCA_PythonController::ErrorPrint(const char *error_msg)
 	
 	/* Added in 2.48a, the last_traceback can reference Objects for example, increasing
 	 * their user count. Not to mention holding references to wrapped data.
-	 * This is especially bad when the PyObject for the wrapped data is free'd, after blender 
+	 * This is especially bad when the PyObject for the wrapped data is freed, after blender
 	 * has already dealocated the pointer */
 	PySys_SetObject( (char *)"last_traceback", NULL);
 	PyErr_Clear(); /* just to be sure */
@@ -298,7 +298,7 @@ bool SCA_PythonController::Import()
 	//printf("py module modified '%s'\n", m_scriptName.Ptr());
 	m_bModified= false;
 
-	/* incase we re-import */
+	/* in case we re-import */
 	Py_XDECREF(m_function);
 	m_function= NULL;
 	
@@ -308,7 +308,7 @@ bool SCA_PythonController::Import()
 
 	function_string= strrchr(mod_path, '.');
 
-	if(function_string == NULL) {
+	if (function_string == NULL) {
 		printf("Python module name formatting error in object '%s', controller '%s':\n\texpected 'SomeModule.Func', got '%s'\n", GetParent()->GetName().Ptr(), GetName().Ptr(), m_scriptText.Ptr());
 		return false;
 	}
@@ -324,7 +324,7 @@ bool SCA_PythonController::Import()
 		return false;
 	}
 
-	if(m_debug)
+	if (m_debug)
 		mod = PyImport_ReloadModule(mod);
 
 	if (mod == NULL) {
@@ -338,27 +338,27 @@ bool SCA_PythonController::Import()
 	// DECREF the module as we don't need it anymore
 	Py_DECREF(mod);
 
-	if(m_function==NULL) {
-		if(PyErr_Occurred())
+	if (m_function==NULL) {
+		if (PyErr_Occurred())
 			ErrorPrint("Python controller found the module but could not access the function");
 		else
 			printf("Python module error in object '%s', controller '%s':\n '%s' module found but function missing\n", GetParent()->GetName().Ptr(), GetName().Ptr(), m_scriptText.Ptr());
 		return false;
 	}
 	
-	if(!PyCallable_Check(m_function)) {
+	if (!PyCallable_Check(m_function)) {
 		Py_DECREF(m_function);
 		m_function = NULL;
 		printf("Python module function error in object '%s', controller '%s':\n '%s' not callable\n", GetParent()->GetName().Ptr(), GetName().Ptr(), m_scriptText.Ptr());
 		return false;
 	}
 	
-	m_function_argc = 0; /* rare cases this could be a function that isnt defined in python, assume zero args */
+	m_function_argc = 0; /* rare cases this could be a function that isn't defined in python, assume zero args */
 	if (PyFunction_Check(m_function)) {
 		m_function_argc= ((PyCodeObject *)PyFunction_GET_CODE(m_function))->co_argcount;
 	}
 	
-	if(m_function_argc > 1) {
+	if (m_function_argc > 1) {
 		Py_DECREF(m_function);
 		m_function = NULL;
 		printf("Python module function in object '%s', controller '%s':\n '%s' takes %d args, should be zero or 1 controller arg\n", GetParent()->GetName().Ptr(), GetName().Ptr(), m_scriptText.Ptr(), m_function_argc);
@@ -421,7 +421,7 @@ void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr)
 		
 		PyObject *args= NULL;
 		
-		if(m_function_argc==1) {
+		if (m_function_argc==1) {
 			args = PyTuple_New(1);
 			PyTuple_SET_ITEM(args, 0, GetProxy());
 		}
@@ -441,7 +441,7 @@ void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr)
 	else
 		ErrorPrint("Python script error");
 	
-	if(excdict) /* Only for SCA_PYEXEC_SCRIPT types */
+	if (excdict) /* Only for SCA_PYEXEC_SCRIPT types */
 	{
 		/* clear after PyErrPrint - seems it can be using
 		 * something in this dictionary and crash? */
@@ -456,13 +456,13 @@ void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr)
 
 PyObject* SCA_PythonController::PyActivate(PyObject *value)
 {
-	if(m_sCurrentController != this) {
+	if (m_sCurrentController != this) {
 		PyErr_SetString(PyExc_SystemError, "Cannot add an actuator from a non-active controller");
 		return NULL;
 	}
 	
 	SCA_IActuator* actu = LinkedActuatorFromPy(value);
-	if(actu==NULL)
+	if (actu==NULL)
 		return NULL;
 	
 	m_sCurrentLogicManager->AddActiveActuator((SCA_IActuator*)actu, true);
@@ -471,13 +471,13 @@ PyObject* SCA_PythonController::PyActivate(PyObject *value)
 
 PyObject* SCA_PythonController::PyDeActivate(PyObject *value)
 {
-	if(m_sCurrentController != this) {
+	if (m_sCurrentController != this) {
 		PyErr_SetString(PyExc_SystemError, "Cannot add an actuator from a non-active controller");
 		return NULL;
 	}
 	
 	SCA_IActuator* actu = LinkedActuatorFromPy(value);
-	if(actu==NULL)
+	if (actu==NULL)
 		return NULL;
 	
 	m_sCurrentLogicManager->AddActiveActuator((SCA_IActuator*)actu, false);
diff --git a/source/gameengine/GameLogic/SCA_PythonController.h b/source/gameengine/GameLogic/SCA_PythonController.h
index 521a676..ccdb82a 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.h
+++ b/source/gameengine/GameLogic/SCA_PythonController.h
@@ -30,8 +30,8 @@
  *  \brief Execute Python scripts
  */
 
-#ifndef KX_PYTHONCONTROLLER_H
-#define KX_PYTHONCONTROLLER_H
+#ifndef __SCA_PYTHONCONTROLLER_H__
+#define __SCA_PYTHONCONTROLLER_H__
 
 #include "SCA_IController.h"
 #include "SCA_LogicManager.h"
@@ -115,5 +115,5 @@ class SCA_PythonController : public SCA_IController
 #endif
 };
 
-#endif //KX_PYTHONCONTROLLER_H
+#endif //__SCA_PYTHONCONTROLLER_H__
 
diff --git a/source/gameengine/GameLogic/SCA_PythonKeyboard.h b/source/gameengine/GameLogic/SCA_PythonKeyboard.h
index f44bb40..df5e46f 100644
--- a/source/gameengine/GameLogic/SCA_PythonKeyboard.h
+++ b/source/gameengine/GameLogic/SCA_PythonKeyboard.h
@@ -24,8 +24,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef __KX_PYKEYBOARD
-#define __KX_PYKEYBOARD
+#ifndef __SCA_PYTHONKEYBOARD_H__
+#define __SCA_PYTHONKEYBOARD_H__
 
 #include "PyObjectPlus.h"
 
@@ -47,5 +47,5 @@ public:
 #endif
 };
 
-#endif //__KX_PYKEYBOARD
+#endif //__SCA_PYTHONKEYBOARD_H__
 
diff --git a/source/gameengine/GameLogic/SCA_PythonMouse.h b/source/gameengine/GameLogic/SCA_PythonMouse.h
index 41d286a..1313d55 100644
--- a/source/gameengine/GameLogic/SCA_PythonMouse.h
+++ b/source/gameengine/GameLogic/SCA_PythonMouse.h
@@ -24,8 +24,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef __KX_PYMOUSE
-#define __KX_PYMOUSE
+#ifndef __SCA_PYTHONMOUSE_H__
+#define __SCA_PYTHONMOUSE_H__
 
 #include "PyObjectPlus.h"
 
@@ -56,5 +56,5 @@ public:
 #endif
 };
 
-#endif //__KX_PYMOUSE
+#endif //__SCA_PYTHONMOUSE_H__
 
diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.cpp b/source/gameengine/GameLogic/SCA_RandomActuator.cpp
index 59925f4..40dba3b 100644
--- a/source/gameengine/GameLogic/SCA_RandomActuator.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomActuator.cpp
@@ -392,7 +392,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setBoolConst,
 "\tSet this generator to produce a constant boolean value.\n") 
 {
 	int paraArg;
-	if(!PyArg_ParseTuple(args, "i:setBoolConst", &paraArg)) {
+	if (!PyArg_ParseTuple(args, "i:setBoolConst", &paraArg)) {
 		return NULL;
 	}
 	
@@ -404,7 +404,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setBoolConst,
 /* 12. setBoolUniform, */
 KX_PYMETHODDEF_DOC_NOARGS(SCA_RandomActuator, setBoolUniform,
 "setBoolUniform()\n"
-"\tSet this generator to produce true and false, each with 50%% chance of occuring\n") 
+"\tSet this generator to produce true and false, each with 50%% chance of occurring\n") 
 {
 	/* no args */
 	m_distribution = KX_RANDOMACT_BOOL_UNIFORM;
@@ -418,7 +418,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setBoolBernouilli,
 "\tReturn false value * 100%% of the time.\n")
 {
 	float paraArg;
-	if(!PyArg_ParseTuple(args, "f:setBoolBernouilli", &paraArg)) {
+	if (!PyArg_ParseTuple(args, "f:setBoolBernouilli", &paraArg)) {
 		return NULL;
 	}
 	
@@ -434,7 +434,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setIntConst,
 "\tAlways return value\n") 
 {
 	int paraArg;
-	if(!PyArg_ParseTuple(args, "i:setIntConst", &paraArg)) {
+	if (!PyArg_ParseTuple(args, "i:setIntConst", &paraArg)) {
 		return NULL;
 	}
 	
@@ -452,7 +452,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setIntUniform,
 "\tupper_bound. The boundaries are included.\n")
 {
 	int paraArg1, paraArg2;
-	if(!PyArg_ParseTuple(args, "ii:setIntUniform", &paraArg1, &paraArg2)) {
+	if (!PyArg_ParseTuple(args, "ii:setIntUniform", &paraArg1, &paraArg2)) {
 		return NULL;
 	}
 	
@@ -471,7 +471,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setIntPoisson,
 "\tnumber of tries needed to achieve succes.\n")
 {
 	float paraArg;
-	if(!PyArg_ParseTuple(args, "f:setIntPoisson", &paraArg)) {
+	if (!PyArg_ParseTuple(args, "f:setIntPoisson", &paraArg)) {
 		return NULL;
 	}
 	
@@ -487,7 +487,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setFloatConst,
 "\tAlways return value\n")
 {
 	float paraArg;
-	if(!PyArg_ParseTuple(args, "f:setFloatConst", &paraArg)) {
+	if (!PyArg_ParseTuple(args, "f:setFloatConst", &paraArg)) {
 		return NULL;
 	}
 	
@@ -505,7 +505,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setFloatUniform,
 "\tupper_bound.\n")
 {
 	float paraArg1, paraArg2;
-	if(!PyArg_ParseTuple(args, "ff:setFloatUniform", &paraArg1, &paraArg2)) {
+	if (!PyArg_ParseTuple(args, "ff:setFloatUniform", &paraArg1, &paraArg2)) {
 		return NULL;
 	}
 	
@@ -524,7 +524,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setFloatNormal,
 "\tdeviation from the mean is characterized by standard_deviation.\n")
 {
 	float paraArg1, paraArg2;
-	if(!PyArg_ParseTuple(args, "ff:setFloatNormal", &paraArg1, &paraArg2)) {
+	if (!PyArg_ParseTuple(args, "ff:setFloatNormal", &paraArg1, &paraArg2)) {
 		return NULL;
 	}
 	
@@ -542,7 +542,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setFloatNegativeExponential,
 "\tis characterized by half_life.\n")
 {
 	float paraArg;
-	if(!PyArg_ParseTuple(args, "f:setFloatNegativeExponential", &paraArg)) {
+	if (!PyArg_ParseTuple(args, "f:setFloatNegativeExponential", &paraArg)) {
 		return NULL;
 	}
 	
diff --git a/source/gameengine/GameLogic/SCA_RandomActuator.h b/source/gameengine/GameLogic/SCA_RandomActuator.h
index c439b44..5226636 100644
--- a/source/gameengine/GameLogic/SCA_RandomActuator.h
+++ b/source/gameengine/GameLogic/SCA_RandomActuator.h
@@ -30,8 +30,8 @@
  *  \brief Draw a random number, and put it in a property
  */
 
-#ifndef __KX_RANDOMACTUATOR
-#define __KX_RANDOMACTUATOR
+#ifndef __SCA_RANDOMACTUATOR_H__
+#define __SCA_RANDOMACTUATOR_H__
 
 #include "SCA_IActuator.h"
 #include "SCA_RandomNumberGenerator.h"
diff --git a/source/gameengine/GameLogic/SCA_RandomEventManager.h b/source/gameengine/GameLogic/SCA_RandomEventManager.h
index 31e0877..7205363 100644
--- a/source/gameengine/GameLogic/SCA_RandomEventManager.h
+++ b/source/gameengine/GameLogic/SCA_RandomEventManager.h
@@ -30,8 +30,8 @@
  *  \brief Manager for random events
  */
 
-#ifndef __KX_RANDOMEVENTMGR
-#define __KX_RANDOMEVENTMGR
+#ifndef __SCA_RANDOMEVENTMANAGER_H__
+#define __SCA_RANDOMEVENTMANAGER_H__
 
 #include "SCA_EventManager.h"
 #include <vector>
@@ -53,5 +53,5 @@ public:
 #endif
 };
 
-#endif //__KX_RANDOMEVENTMGR
+#endif //__SCA_RANDOMEVENTMANAGER_H__
 
diff --git a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp
index a12619a..eca678f 100644
--- a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp
+++ b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.cpp
@@ -54,14 +54,16 @@
 #define TEMPERING_SHIFT_T(y)  (y << 15)
 #define TEMPERING_SHIFT_L(y)  (y >> 18)
 
-SCA_RandomNumberGenerator::SCA_RandomNumberGenerator(long seed) {
+SCA_RandomNumberGenerator::SCA_RandomNumberGenerator(long seed)
+{
 	// int mti = N + 1; /*unused*/
 	m_seed = seed;
 	m_refcount = 1;
 	SetStartVector();
 }
 
-SCA_RandomNumberGenerator::~SCA_RandomNumberGenerator() {
+SCA_RandomNumberGenerator::~SCA_RandomNumberGenerator()
+{
 	/* intentionally empty */
 }
 
diff --git a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.h b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.h
index 87461b1..4391dcb 100644
--- a/source/gameengine/GameLogic/SCA_RandomNumberGenerator.h
+++ b/source/gameengine/GameLogic/SCA_RandomNumberGenerator.h
@@ -32,8 +32,8 @@
  * on a per-generator basis.
  */
 
-#ifndef __KX_RANDOMNUMBERGENERATOR
-#define __KX_RANDOMNUMBERGENERATOR
+#ifndef __SCA_RANDOMNUMBERGENERATOR_H__
+#define __SCA_RANDOMNUMBERGENERATOR_H__
 
 #ifdef WITH_CXX_GUARDEDALLOC
 #include "MEM_guardedalloc.h"
@@ -53,7 +53,7 @@ class SCA_RandomNumberGenerator {
 	unsigned long mt[624];
 
 	/** mti==N+1 means mt[KX_MT_VectorLenght] is not initialized */
-	int mti; /* initialised in the cpp file */
+	int mti; /* initialized in the cpp file */
 
 	/** Calculate a start vector */
 	void SetStartVector(void);
@@ -83,5 +83,5 @@ public:
 #endif
 };
 
-#endif /* __KX_RANDOMNUMBERGENERATOR */
+#endif /* __SCA_RANDOMNUMBERGENERATOR_H__ */
 
diff --git a/source/gameengine/GameLogic/SCA_RandomSensor.h b/source/gameengine/GameLogic/SCA_RandomSensor.h
index cec8bcd..008445e 100644
--- a/source/gameengine/GameLogic/SCA_RandomSensor.h
+++ b/source/gameengine/GameLogic/SCA_RandomSensor.h
@@ -30,8 +30,8 @@
  *  \brief Generate random pulses
  */
 
-#ifndef __KX_RANDOMSENSOR
-#define __KX_RANDOMSENSOR
+#ifndef __SCA_RANDOMSENSOR_H__
+#define __SCA_RANDOMSENSOR_H__
 
 #include "SCA_ISensor.h"
 #include "BoolValue.h"
@@ -68,5 +68,5 @@ public:
 #endif
 };
 
-#endif //__KX_RANDOMSENSOR
+#endif //__SCA_RANDOMSENSOR_H__
 
diff --git a/source/gameengine/GameLogic/SCA_TimeEventManager.h b/source/gameengine/GameLogic/SCA_TimeEventManager.h
index cac52fb..7c81378 100644
--- a/source/gameengine/GameLogic/SCA_TimeEventManager.h
+++ b/source/gameengine/GameLogic/SCA_TimeEventManager.h
@@ -29,8 +29,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef __KX_TIMEEVENTMANAGER
-#define __KX_TIMEEVENTMANAGER
+#ifndef __SCA_TIMEEVENTMANAGER_H__
+#define __SCA_TIMEEVENTMANAGER_H__
 
 #include "SCA_EventManager.h"
 #include "Value.h"
@@ -61,5 +61,5 @@ public:
 #endif
 };
 
-#endif //__KX_TIMEEVENTMANAGER
+#endif //__SCA_TIMEEVENTMANAGER_H__
 
diff --git a/source/gameengine/GameLogic/SCA_XNORController.h b/source/gameengine/GameLogic/SCA_XNORController.h
index c2cdad2..5ef4dc6 100644
--- a/source/gameengine/GameLogic/SCA_XNORController.h
+++ b/source/gameengine/GameLogic/SCA_XNORController.h
@@ -29,8 +29,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef __KX_XNORCONTROLLER
-#define __KX_XNORCONTROLLER
+#ifndef __SCA_XNORCONTROLLER_H__
+#define __SCA_XNORCONTROLLER_H__
 
 #include "SCA_IController.h"
 
@@ -50,5 +50,5 @@ public:
 
 };
 
-#endif //__KX_XNORCONTROLLER
+#endif //__SCA_XNORCONTROLLER_H__
 
diff --git a/source/gameengine/GameLogic/SCA_XORController.h b/source/gameengine/GameLogic/SCA_XORController.h
index 1f38a51..56cd244 100644
--- a/source/gameengine/GameLogic/SCA_XORController.h
+++ b/source/gameengine/GameLogic/SCA_XORController.h
@@ -29,8 +29,8 @@
  *  \ingroup gamelogic
  */
 
-#ifndef __KX_XORCONTROLLER
-#define __KX_XORCONTROLLER
+#ifndef __SCA_XORCONTROLLER_H__
+#define __SCA_XORCONTROLLER_H__
 
 #include "SCA_IController.h"
 
@@ -45,5 +45,5 @@ public:
 	virtual void Trigger(SCA_LogicManager* logicmgr);
 };
 
-#endif //__KX_XORCONTROLLER
+#endif //__SCA_XORCONTROLLER_H__
 
diff --git a/source/gameengine/GameLogic/SConscript b/source/gameengine/GameLogic/SConscript
index 62bdbc2..e33169b 100644
--- a/source/gameengine/GameLogic/SConscript
+++ b/source/gameengine/GameLogic/SConscript
@@ -6,6 +6,7 @@ sources = env.Glob('*.cpp') + env.Glob('Joystick/*.cpp')
 incs = '. #/intern/string #intern/container'
 incs += ' #/source/gameengine/Expressions #/intern/moto/include'
 incs += ' #/source/gameengine/Rasterizer #/source/gameengine/SceneGraph'
+incs += ' #/source/blender/blenlib'
 
 defs = []
 
diff --git a/source/gameengine/GamePlayer/common/GPC_Canvas.cpp b/source/gameengine/GamePlayer/common/GPC_Canvas.cpp
index df1bf31..eccfefe 100644
--- a/source/gameengine/GamePlayer/common/GPC_Canvas.cpp
+++ b/source/gameengine/GamePlayer/common/GPC_Canvas.cpp
@@ -52,6 +52,11 @@ GPC_Canvas::GPC_Canvas(
 	m_height(height),
 	m_bannersEnabled(false)
 {
+	// initialize area so that it's available for game logic on frame 1 (ImageViewport)
+	m_displayarea.m_x1 = 0;
+	m_displayarea.m_y1 = 0;
+	m_displayarea.m_x2 = width;
+	m_displayarea.m_y2 = height;
 }
 
 
@@ -106,7 +111,7 @@ void GPC_Canvas::SetViewPort(int x1, int y1, int x2, int y2)
 		*/
 		
 		/* XXX, nasty, this needs to go somewhere else,
-		 * but where... definitly need to clean up this
+		 * but where... definitely need to clean up this
 		 * whole canvas/rendertools mess.
 		 */
 	glEnable(GL_SCISSOR_TEST);
@@ -118,7 +123,7 @@ void GPC_Canvas::SetViewPort(int x1, int y1, int x2, int y2)
 
 void GPC_Canvas::ClearBuffer(
 	int type
-){
+) {
 
 	int ogltype = 0;
 	if (type & RAS_ICanvas::COLOR_BUFFER )
@@ -200,7 +205,7 @@ void GPC_Canvas::DisposeBanner(TBannerData& banner)
 
 void GPC_Canvas::DrawAllBanners(void)
 {
-	if(!m_bannersEnabled || (m_banners.size() < 1))
+	if (!m_bannersEnabled || (m_banners.size() < 1))
 		return;
 	
 	// Save the old rendering parameters.
@@ -234,7 +239,7 @@ void GPC_Canvas::DrawAllBanners(void)
 
 void GPC_Canvas::DrawBanner(TBannerData& banner)
 {
-	if(!banner.enabled)
+	if (!banner.enabled)
 		return;
 
 	// Set up coordinates
@@ -307,7 +312,7 @@ void GPC_Canvas::DrawBanner(TBannerData& banner)
 GPC_Canvas::
 PushRenderState(
 	CanvasRenderState & render_state
-){
+) {
 #if 0
 
 	::glMatrixMode(GL_PROJECTION);
@@ -337,7 +342,7 @@ PushRenderState(
 GPC_Canvas::
 PopRenderState(
 	const CanvasRenderState & render_state
-){
+) {
 #if 0
 	// Restore OpenGL settings
 	render_state.oldLighting ? ::glEnable(GL_LIGHTING) : glDisable(GL_LIGHTING);
@@ -366,7 +371,7 @@ PopRenderState(
 	void
 GPC_Canvas::
 SetOrthoProjection(
-){
+) {
 	// Set up OpenGL matrices 
 	::glViewport(0, 0, m_width, m_height);
 	::glScissor(0, 0, m_width, m_height);
@@ -383,7 +388,7 @@ SetOrthoProjection(
 GPC_Canvas::
 MakeScreenShot(
 	const char* filename
-){
+) {
 	png_structp png_ptr;
 	png_infop info_ptr;
 	unsigned char *pixels = 0;
@@ -437,17 +442,17 @@ MakeScreenShot(
 
 	png_init_io(png_ptr, fp);
 
-	/*
+#if 0
 	png_set_filter(png_ptr, 0,
-		PNG_FILTER_NONE  | PNG_FILTER_VALUE_NONE |
-		PNG_FILTER_SUB   | PNG_FILTER_VALUE_SUB  |
-		PNG_FILTER_UP    | PNG_FILTER_VALUE_UP   |
-		PNG_FILTER_AVG   | PNG_FILTER_VALUE_AVG  |
-		PNG_FILTER_PAETH | PNG_FILTER_VALUE_PAETH|
-		PNG_ALL_FILTERS);
+	               PNG_FILTER_NONE  | PNG_FILTER_VALUE_NONE |
+	               PNG_FILTER_SUB   | PNG_FILTER_VALUE_SUB  |
+	               PNG_FILTER_UP    | PNG_FILTER_VALUE_UP   |
+	               PNG_FILTER_AVG   | PNG_FILTER_VALUE_AVG  |
+	               PNG_FILTER_PAETH | PNG_FILTER_VALUE_PAETH|
+	               PNG_ALL_FILTERS);
 
 	png_set_compression_level(png_ptr, Z_BEST_COMPRESSION);
-	*/
+#endif
 
 	// png image settings
 	png_set_IHDR(png_ptr,
diff --git a/source/gameengine/GamePlayer/common/GPC_Canvas.h b/source/gameengine/GamePlayer/common/GPC_Canvas.h
index a9d7ab1..cd2bc7e 100644
--- a/source/gameengine/GamePlayer/common/GPC_Canvas.h
+++ b/source/gameengine/GamePlayer/common/GPC_Canvas.h
@@ -29,8 +29,8 @@
  *  \ingroup player
  */
 
-#ifndef _GPC_CANVAS_H_
-#define _GPC_CANVAS_H_
+#ifndef __GPC_CANVAS_H__
+#define __GPC_CANVAS_H__
 
 #include "RAS_ICanvas.h"
 #include "RAS_Rect.h"
@@ -106,7 +106,7 @@ public:
 	virtual void ResizeWindow(int width, int height){};
 
 	/**
-	 * @section Methods inherited from abstract base class RAS_ICanvas.
+	 * \section Methods inherited from abstract base class RAS_ICanvas.
 	 */
 	
 		int 
@@ -157,8 +157,8 @@ public:
 	void ClearColor(float r, float g, float b, float a);
 
 	/**
-	 * @section Methods inherited from abstract base class RAS_ICanvas.
-	 * Semantics are not yet honoured.
+	 * \section Methods inherited from abstract base class RAS_ICanvas.
+	 * Semantics are not yet honored.
 	 */
 	
 	void SetMouseState(RAS_MouseState mousestate)
@@ -176,20 +176,20 @@ public:
 	void ClearBuffer(int type);
 
 	/**
-	 * @section Services provided by this class.
+	 * \section Services provided by this class.
 	 */
 
 	/**
 	 * Enables display of a banner.
 	 * The image data is copied inside.
-	 * @param bannerWidth		Display width of the banner.
-	 * @param bannerHeight		Display height of the banner.
-	 * @param imageWidth		Width of the banner image in pixels.
-	 * @param imageHeight		Height of the banner image in pixels.
-	 * @param imageData			Pointer to the pixels of the image to display.
-	 * @param alignement		Where the banner will be positioned on the canvas.
-	 * @param enabled			Whether the banner will be displayed intiallly.
-	 * @return A banner id.
+	 * \param bannerWidth		Display width of the banner.
+	 * \param bannerHeight		Display height of the banner.
+	 * \param imageWidth		Width of the banner image in pixels.
+	 * \param imageHeight		Height of the banner image in pixels.
+	 * \param imageData			Pointer to the pixels of the image to display.
+	 * \param alignment		Where the banner will be positioned on the canvas.
+	 * \param enabled			Whether the banner will be displayed initially.
+	 * \return A banner id.
 	 */
 	TBannerId AddBanner(
 		unsigned int bannerWidth, unsigned int bannerHeight,
@@ -199,7 +199,7 @@ public:
 
 	/**
 	 * Disposes a banner.
-	 * @param id Bannner to be disposed.
+	 * \param id Banner to be disposed.
 	 */
 	void DisposeBanner(TBannerId id);
 
@@ -210,21 +210,21 @@ public:
 
 	/**
 	 * Enables or disables display of a banner.
-	 * @param id		Banner id of the banner to be enabled/disabled.
-	 * @param enabled	New state of the banner.
+	 * \param id		Banner id of the banner to be enabled/disabled.
+	 * \param enabled	New state of the banner.
 	 */
 	void SetBannerEnabled(TBannerId id, bool enabled = true);
 
 	/**
 	 * Enables or disables display of all banners.
-	 * @param enabled	New state of the banners.
+	 * \param enabled	New state of the banners.
 	 */
 	void SetBannerDisplayEnabled(bool enabled = true);
 
 protected:
 	/**
 	 * Disposes a banner.
-	 * @param it Bannner to be disposed.
+	 * \param it Banner to be disposed.
 	 */
 	void DisposeBanner(TBannerData& banner);
 
@@ -270,5 +270,5 @@ protected:
 	static TBannerId s_bannerId;
 };
 
-#endif // _GPC_CANVAS_H_
+#endif // __GPC_CANVAS_H__
 
diff --git a/source/gameengine/GamePlayer/common/GPC_Engine.cpp b/source/gameengine/GamePlayer/common/GPC_Engine.cpp
index 6548310..11d6487 100644
--- a/source/gameengine/GamePlayer/common/GPC_Engine.cpp
+++ b/source/gameengine/GamePlayer/common/GPC_Engine.cpp
@@ -78,7 +78,7 @@ GPC_Engine::GPC_Engine(char *customLoadingAnimationURL,
 		m_frameRate(frameRate),
 		m_BlenderLogo(0), m_Blender3DLogo(0)/*, m_NaNLogo(0)*/
 {
-	if(customLoadingAnimationURL[0] != '\0')
+	if (customLoadingAnimationURL[0] != '\0')
 	{
 		m_customLoadingAnimationURL = new char[sizeof(customLoadingAnimationURL)];
 // not yet, need to be implemented first...		m_customLoadingAnimation = true;
@@ -87,13 +87,13 @@ GPC_Engine::GPC_Engine(char *customLoadingAnimationURL,
 	// load the Blender logo into memory
 	m_BlenderLogo = new GPC_RawImage();
 	// blender3d size is 115 x 32 so make resulting texture 128 x 128
-	if(!m_BlenderLogo->Load("BlenderLogo", 128, 128, GPC_RawImage::alignTopLeft, 8, 8))
+	if (!m_BlenderLogo->Load("BlenderLogo", 128, 128, GPC_RawImage::alignTopLeft, 8, 8))
 		m_BlenderLogo = 0;
 
 	// load the Blender3D logo into memory
 	m_Blender3DLogo = new GPC_RawImage();
 	// blender3d size is 136 x 11 so make resulting texture 256 x 256
-	if(!m_Blender3DLogo->Load("Blender3DLogo", 256, 256, GPC_RawImage::alignBottomRight, 8, 8))
+	if (!m_Blender3DLogo->Load("Blender3DLogo", 256, 256, GPC_RawImage::alignBottomRight, 8, 8))
 		m_Blender3DLogo = 0;
 
 #if 0
@@ -101,7 +101,7 @@ GPC_Engine::GPC_Engine(char *customLoadingAnimationURL,
 	// load the NaN logo into memory
 	m_NaNLogo = new GPC_RawImage();
 	// blender3d size is 32 x 31 so make resulting texture 64 x 64
-	if(!m_NaNLogo->Load("NaNLogo", 64, 64, GPC_RawImage::alignBottomRight, 8, 8))
+	if (!m_NaNLogo->Load("NaNLogo", 64, 64, GPC_RawImage::alignBottomRight, 8, 8))
 		m_NaNLogo = 0;
 #endif
 }
@@ -148,7 +148,7 @@ bool GPC_Engine::Start(const char *filename)
 
 	StartKetsji();
 
-	if(bfd->type == BLENFILETYPE_PUB)
+	if (bfd->type == BLENFILETYPE_PUB)
 		m_canvas->SetBannerDisplayEnabled(false);
 
 	return true;
@@ -173,7 +173,7 @@ bool GPC_Engine::Start(unsigned char *blenderDataBuffer,
 	
 	StartKetsji();
 
-	if(bfd->type == BLENFILETYPE_PUB)
+	if (bfd->type == BLENFILETYPE_PUB)
 		m_canvas->SetBannerDisplayEnabled(false);
 
 	return true;
@@ -210,7 +210,7 @@ bool GPC_Engine::StartKetsji(void)
 
 void GPC_Engine::StartLoadingAnimation()
 {
-	if(m_customLoadingAnimation)
+	if (m_customLoadingAnimation)
 	{
 	}
 	else
@@ -218,14 +218,14 @@ void GPC_Engine::StartLoadingAnimation()
 		unsigned char *blenderDataBuffer;
 		int blenderDataBufferSize;
 		GetRawLoadingAnimation(&blenderDataBuffer, &blenderDataBufferSize);
-		if(!Start(blenderDataBuffer, blenderDataBufferSize))
+		if (!Start(blenderDataBuffer, blenderDataBufferSize))
 			cout << "something went wrong when starting the engine" << endl;
 		delete blenderDataBuffer;  // created with 'new' in GetRawLoadingAnimation()
 	}
 }
 
 	
-// will be platform dependant
+// will be platform dependent
 float GPC_Engine::DetermineProgress(void)
 {
 #if 0
@@ -239,7 +239,7 @@ float GPC_Engine::DetermineProgress(void)
 		progress = 0.f;
 	}
 	progress *= 100.f;
-	return (unsigned int) progress ;
+	return (unsigned int) progress;
 #endif
 	return m_previousProgress + 0.01;  // temporary TODO
 }
@@ -251,11 +251,11 @@ void GPC_Engine::UpdateLoadingAnimation(void)
 
 	float progress = DetermineProgress();
 
-	if(progress > m_previousProgress)
+	if (progress > m_previousProgress)
 	{
 //		delta = progress - m_previousProgress;
 		m_previousProgress = progress;
-		if(m_previousProgress > 1.0)
+		if (m_previousProgress > 1.0)
 			m_previousProgress = 1.0;  // limit to 1.0 (has to change !)
 //			m_engine->m_previousProgress = 0.0;
 	}
@@ -266,7 +266,7 @@ void GPC_Engine::UpdateLoadingAnimation(void)
 	STR_String body;
 	body.Format("%f", progress);  // a number between 0.0 and 1.0
 
-	if(m_networkdev)
+	if (m_networkdev)
 	{
 		// Store a progress message in the network device.
 		NG_NetworkMessage* msg = new NG_NetworkMessage(to, from, subject, body);
@@ -279,19 +279,19 @@ void GPC_Engine::UpdateLoadingAnimation(void)
 void GPC_Engine::Stop()
 {
 	// only delete things that are created in StartKetsji()
-/*	if(m_portal)
+/*	if (m_portal)
 	{
 		m_portal->Leave();
 		delete m_portal;  // also gets rid of KX_KetsjiEngine (says Maarten)
 		m_portal = 0;
 	}
-*/	if(m_sceneconverter)
+*/	if (m_sceneconverter)
 	{
 		delete m_sceneconverter;
 		m_sceneconverter = 0;
 	}
 #if 0
-	if(m_frameTimerID)
+	if (m_frameTimerID)
 	{
 		::KillTimer(0, m_frameTimerID);
 		m_frameTimerID = 0;
@@ -305,7 +305,7 @@ void GPC_Engine::Stop()
 
 void GPC_Engine::Exit()
 {
-	if(m_running)
+	if (m_running)
 		Stop();
 
 	if (m_system) {
diff --git a/source/gameengine/GamePlayer/common/GPC_Engine.h b/source/gameengine/GamePlayer/common/GPC_Engine.h
index 70e5a3e..60f0d2a 100644
--- a/source/gameengine/GamePlayer/common/GPC_Engine.h
+++ b/source/gameengine/GamePlayer/common/GPC_Engine.h
@@ -29,8 +29,8 @@
  *  \ingroup player
  */
 
-#ifndef __GPC_ENGINE_H
-#define __GPC_ENGINE_H
+#ifndef __GPC_ENGINE_H__
+#define __GPC_ENGINE_H__
 
 #include "GPC_Canvas.h"
 #include "GPC_System.h"
@@ -113,7 +113,7 @@ public:
 	bool Loading(void) {return m_loading;}
 	bool Running(void) const {return m_running;}
 
-	virtual float DetermineProgress(void);  // will be platform dependant
+	virtual float DetermineProgress(void);  // will be platform dependent
 	void UpdateLoadingAnimation(void);
 
 private:
@@ -121,5 +121,5 @@ private:
 
 };
 
-#endif  // __GPC_ENGINE_H
+#endif  // __GPC_ENGINE_H__
 
diff --git a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.cpp b/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.cpp
index fc436ab..ecb58ed 100644
--- a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.cpp
+++ b/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.cpp
@@ -53,7 +53,7 @@ void GPC_KeyboardDevice::NextFrame()
 		{
 			m_eventStatusTables[m_currentTable][keyevent] = oldevent;
 			m_eventStatusTables[m_currentTable][keyevent].m_status = SCA_InputEvent::KX_ACTIVE;
-			//m_eventStatusTables[m_currentTable][keyevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED ;
+			//m_eventStatusTables[m_currentTable][keyevent].m_status = SCA_InputEvent::KX_JUSTACTIVATED;
 		}
 	}
 }
diff --git a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h b/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h
index 3d88dc4..63e051d 100644
--- a/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h
+++ b/source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h
@@ -29,8 +29,8 @@
  *  \ingroup player
  */
 
-#ifndef __GPC_KEYBOARDDEVICE_H
-#define __GPC_KEYBOARDDEVICE_H
+#ifndef __GPC_KEYBOARDDEVICE_H__
+#define __GPC_KEYBOARDDEVICE_H__
 
 #ifdef WIN32
 #pragma warning (disable : 4786)
@@ -45,7 +45,7 @@
  * System independent implementation of SCA_IInputDevice.
  * System dependent keyboard devices need only to inherit this class
  * and fill the m_reverseKeyTranslateTable key translation map.
- * @see SCA_IInputDevice
+ * \see SCA_IInputDevice
  */
 
 class GPC_KeyboardDevice : public SCA_IInputDevice
diff --git a/source/gameengine/GamePlayer/common/GPC_MouseDevice.cpp b/source/gameengine/GamePlayer/common/GPC_MouseDevice.cpp
index 6146be1..a38bba7 100644
--- a/source/gameengine/GamePlayer/common/GPC_MouseDevice.cpp
+++ b/source/gameengine/GamePlayer/common/GPC_MouseDevice.cpp
@@ -81,7 +81,7 @@ void GPC_MouseDevice::NextFrame()
 		}
 		else {
 			if (oldevent.m_status == SCA_InputEvent::KX_JUSTRELEASED) {
-				m_eventStatusTables[m_currentTable][mousemove].m_status = SCA_InputEvent::KX_NO_INPUTSTATUS ;
+				m_eventStatusTables[m_currentTable][mousemove].m_status = SCA_InputEvent::KX_NO_INPUTSTATUS;
 			}
 		}
 	}
diff --git a/source/gameengine/GamePlayer/common/GPC_MouseDevice.h b/source/gameengine/GamePlayer/common/GPC_MouseDevice.h
index a4f0032..2db1b1e 100644
--- a/source/gameengine/GamePlayer/common/GPC_MouseDevice.h
+++ b/source/gameengine/GamePlayer/common/GPC_MouseDevice.h
@@ -29,8 +29,8 @@
  *  \ingroup player
  */
 
-#ifndef __GPC_MOUSE_DEVICE_H
-#define __GPC_MOUSE_DEVICE_H
+#ifndef __GPC_MOUSEDEVICE_H__
+#define __GPC_MOUSEDEVICE_H__
 
 #ifdef WIN32
 #pragma warning (disable : 4786)
@@ -41,7 +41,7 @@
 
 /**
  * Generic Ketsji mouse device.
- * @see SCA_IInputDevice
+ * \see SCA_IInputDevice
  */
 class GPC_MouseDevice : public SCA_IInputDevice
 {
@@ -65,42 +65,42 @@ public:
 
 	/**
 	 * Call this routine to update the mouse device when a button state changes.
-	 * @param button	Which button state changes.
-	 * @param isDown	The new state of the button.
-	 * @param x			Position x-coordinate of the cursor at the time of the state change.
-	 * @param y			Position y-coordinate of the cursor at the time of the state change.
-	 * @return Indication as to whether the event was processed.
+	 * \param button	Which button state changes.
+	 * \param isDown	The new state of the button.
+	 * \param x			Position x-coordinate of the cursor at the time of the state change.
+	 * \param y			Position y-coordinate of the cursor at the time of the state change.
+	 * \return Indication as to whether the event was processed.
 	 */
 	virtual bool ConvertButtonEvent(TButtonId button, bool isDown);
 
 	/**
 	 * Call this routine to update the mouse device when a button state and
 	 * cursor position changes at the same time (e.g. in Win32 messages).
-	 * @param button	Which button state changes.
-	 * @param isDown	The new state of the button.
-	 * @param x			Position x-coordinate of the cursor at the time of the state change.
-	 * @param y			Position y-coordinate of the cursor at the time of the state change.
-	 * @return Indication as to whether the event was processed.
+	 * \param button	Which button state changes.
+	 * \param isDown	The new state of the button.
+	 * \param x			Position x-coordinate of the cursor at the time of the state change.
+	 * \param y			Position y-coordinate of the cursor at the time of the state change.
+	 * \return Indication as to whether the event was processed.
 	 */
 	virtual bool ConvertButtonEvent(TButtonId button, bool isDown, int x, int y);
 
 	/**
 	 * Call this routine to update the mouse device when the cursor has moved.
-	 * @param x			Position x-coordinate of the cursor.
-	 * @param y			Position y-coordinate of the cursor.
-	 * @return Indication as to whether the event was processed.
+	 * \param x			Position x-coordinate of the cursor.
+	 * \param y			Position y-coordinate of the cursor.
+	 * \return Indication as to whether the event was processed.
 	 */
 	virtual bool ConvertMoveEvent(int x, int y);
 
 protected:
 	/**
 	 * This routine converts a single mouse event to a Ketsji mouse event.
-	 * @param kxevent	Ketsji event code.
-	 * @param eventval	Value for this event.
-	 * @return Indication as to whether the event was processed.
+	 * \param kxevent	Ketsji event code.
+	 * \param eventval	Value for this event.
+	 * \return Indication as to whether the event was processed.
 	 */
 	virtual bool ConvertEvent(KX_EnumInputs kxevent, int eventval);
 };
 
-#endif  // __GPC_MOUSE_DEVICE_H
+#endif  // __GPC_MOUSEDEVICE_H__
 
diff --git a/source/gameengine/GamePlayer/common/GPC_RawImage.cpp b/source/gameengine/GamePlayer/common/GPC_RawImage.cpp
index 5bd3a19..9f129c1 100644
--- a/source/gameengine/GamePlayer/common/GPC_RawImage.cpp
+++ b/source/gameengine/GamePlayer/common/GPC_RawImage.cpp
@@ -50,26 +50,26 @@ bool GPC_RawImage::Load(
 {
 	int srcWidth, srcHeight;
 	bool success = true;
-	if(strcmp(srcName, "BlenderLogo") == 0)
+	if (strcmp(srcName, "BlenderLogo") == 0)
 		GetRawBlenderLogo(&m_data, &srcWidth, &srcHeight);
 	else
-		if(strcmp(srcName, "Blender3DLogo") == 0)
+		if (strcmp(srcName, "Blender3DLogo") == 0)
 			GetRawBlender3DLogo(&m_data, &srcWidth, &srcHeight);
 #if 0
 	else
-		if(strcmp(srcName, "NaNLogo") == 0)
+		if (strcmp(srcName, "NaNLogo") == 0)
 			GetRawNaNLogo(&m_data, &srcWidth, &srcHeight);
 #endif
 		else  // unknown image
 			success = false;
 
-	if(success)
+	if (success)
 	{
 		unsigned char *tempData = m_data;
 
 		int numBytes = destWidth * destHeight * 4;
 		m_data = new unsigned char[numBytes];  // re-use m_data ('unsigned char' was 'char')
-		if(m_data)
+		if (m_data)
 		{
 			::memset(m_data, 0x00000000, numBytes);
 			m_width = destWidth;
@@ -80,11 +80,11 @@ bool GPC_RawImage::Load(
 			int numRows = (srcHeight + offsetY) < m_height ? srcHeight : m_height - offsetY;
 			numBytes = (srcWidth + offsetX) < m_width ? srcBytesWidth : (m_width - offsetX) * 4;
 
-			if((offsetX < m_width) && (offsetY < m_height))
+			if ((offsetX < m_width) && (offsetY < m_height))
 			{
 				unsigned char* src = (unsigned char*)tempData;
 				unsigned char* dst = (unsigned char*)m_data;
-				if(alignment == alignTopLeft)
+				if (alignment == alignTopLeft)
 				{
 					// Put original in upper left corner
 
diff --git a/source/gameengine/GamePlayer/common/GPC_RawImage.h b/source/gameengine/GamePlayer/common/GPC_RawImage.h
index 6fa5a9f..4d3f455 100644
--- a/source/gameengine/GamePlayer/common/GPC_RawImage.h
+++ b/source/gameengine/GamePlayer/common/GPC_RawImage.h
@@ -52,16 +52,16 @@ public:
 	/**
 	 * Loads the image form the resource into memory.
 	 * Converts size of the image and places it with given alignment.
-	 * @param hInstApp	The application's instance (location of the resources).
-	 * @param lpName	Name of the resource.
-	 * @param lpType	Type of the resource.
-	 * @param srcWidth	The width of the resource image.
-	 * @param srcHeight	The height of the resource image.
-	 * @param width		The width of the image created.
-	 * @param height	The height of the image created.
-	 * @param alignment How the resource image is located in the image created.
-	 * @param offsetX	Amount of horzontal offset applied to the resource image.
-	 * @param offsetY	Amount of vertical offset applied to the resource image.
+	 * \param hInstApp	The application's instance (location of the resources).
+	 * \param lpName	Name of the resource.
+	 * \param lpType	Type of the resource.
+	 * \param srcWidth	The width of the resource image.
+	 * \param srcHeight	The height of the resource image.
+	 * \param width		The width of the image created.
+	 * \param height	The height of the image created.
+	 * \param alignment How the resource image is located in the image created.
+	 * \param offsetX	Amount of horizontal offset applied to the resource image.
+	 * \param offsetY	Amount of vertical offset applied to the resource image.
 	 */
 	virtual bool Load(const char *srcName,
 		int destWidth, int destHeight,
@@ -70,7 +70,7 @@ public:
 
 	/**
 	 * Returns the width of the image.
-	 * @return The width of the image.
+	 * \return The width of the image.
 	 */
 	virtual int Width() const
 	{
@@ -79,7 +79,7 @@ public:
 
 	/**
 	 * Returns the height of the image.
-	 * @return The height of the image.
+	 * \return The height of the image.
 	 */
 	virtual int Height() const
 	{
@@ -88,7 +88,7 @@ public:
 
 	/**
 	 * Returns a pointer to the data loaded from the resource.
-	 * @return A pointer to the data loaded from the resource.
+	 * \return A pointer to the data loaded from the resource.
 	 */
 	virtual unsigned char *Data() const
 	{
@@ -97,7 +97,7 @@ public:
 
 	/**
 	 * Returns the size of the data loaded from the resource.
-	 * @return The size of the  loaded from the resource.
+	 * \return The size of the  loaded from the resource.
 	 */
 	virtual int DataSize() const
 	{
diff --git a/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.cpp b/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.cpp
index 16f984c..adf0bcd 100644
--- a/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.cpp
+++ b/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.cpp
@@ -9299,7 +9299,7 @@ void GetRawLoadingAnimation(unsigned char **data, int *dataSize)
 	*data = new unsigned char[138801];
 	// and copy it. Now we are certain that the calling function
 	// can control the memory location
-	for(int i = 0; i < 138801 /* tmp array size */; i++)
+	for (int i = 0; i < 138801 /* tmp array size */; i++)
 	{
 		(*data)[i] = load_blend[i];
 	}
diff --git a/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.h b/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.h
index 9b27ba3..6f15276 100644
--- a/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.h
+++ b/source/gameengine/GamePlayer/common/GPC_RawLoadDotBlendArray.h
@@ -29,10 +29,10 @@
  *  \ingroup player
  */
 
-#ifndef __GPC_RAWLOADDOTBLENDARRAY_H
-#define __GPC_RAWLOADDOTBLENDARRAY_H
+#ifndef __GPC_RAWLOADDOTBLENDARRAY_H__
+#define __GPC_RAWLOADDOTBLENDARRAY_H__
 
 void GetRawLoadingAnimation(unsigned char **data, int *dataSize);
 
-#endif  // __GPC_RAWLOADDOTBLENDARRAY_H
+#endif  // __GPC_RAWLOADDOTBLENDARRAY_H__
 
diff --git a/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.cpp b/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.cpp
index 52a033c..2471b52 100644
--- a/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.cpp
+++ b/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.cpp
@@ -1029,7 +1029,7 @@ void GetRawBlenderLogo(unsigned char **data, int *width, int *height)
 	*data = new unsigned char[14720];
 	// and copy it. Now we are certain that the calling function
 	// can control the memory location
-	for(int i = 0; i < 14720 /* tmp array size */; i++)
+	for (int i = 0; i < 14720 /* tmp array size */; i++)
 	{
 		(*data)[i] = logo_blender_raw[i];
 	}
@@ -1449,7 +1449,7 @@ void GetRawBlender3DLogo(unsigned char **data, int *width, int *height)
 	*data = new unsigned char[5984];
 	// and copy it. Now we are certain that the calling function
 	// can control the memory location
-	for(int i = 0; i < 5984 /* tmp array size */; i++)
+	for (int i = 0; i < 5984 /* tmp array size */; i++)
 	{
 		(*data)[i] = logo_blender3d_raw[i];
 	}
diff --git a/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.h b/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.h
index 43bd6d2..ade0002 100644
--- a/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.h
+++ b/source/gameengine/GamePlayer/common/GPC_RawLogoArrays.h
@@ -29,8 +29,8 @@
  *  \ingroup player
  */
 
-#ifndef __GPC_RAWLOGOARRAYS_H
-#define __GPC_RAWLOGOARRAYS_H
+#ifndef __GPC_RAWLOGOARRAYS_H__
+#define __GPC_RAWLOGOARRAYS_H__
 
 void GetRawBlenderLogo(unsigned char **data, int *width, int *height);
 void GetRawBlender3DLogo(unsigned char **data, int *width, int *height);
@@ -38,5 +38,5 @@ void GetRawBlender3DLogo(unsigned char **data, int *width, int *height);
 void GetRawNaNLogo(unsigned char **data, int *width, int *height);
 #endif
 
-#endif  // __GPC_RAWLOGOARRAYS_H
+#endif  // __GPC_RAWLOGOARRAYS_H__
 
diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
index 54e2efd..ed2fa8a 100644
--- a/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
+++ b/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
@@ -101,23 +101,23 @@ void GPC_RenderTools::ProcessLighting(RAS_IRasterizer *rasty, bool uselights, co
 	int layer= -1;
 
 	/* find the layer */
-	if(uselights) {
-		if(m_clientobject)
+	if (uselights) {
+		if (m_clientobject)
 			layer = static_cast<KX_GameObject*>(m_clientobject)->GetLayer();
 	}
 
 	/* avoid state switching */
-	if(m_lastlightlayer == layer && m_lastauxinfo == m_auxilaryClientInfo)
+	if (m_lastlightlayer == layer && m_lastauxinfo == m_auxilaryClientInfo)
 		return;
 
 	m_lastlightlayer = layer;
 	m_lastauxinfo = m_auxilaryClientInfo;
 
 	/* enable/disable lights as needed */
-	if(layer >= 0)
+	if (layer >= 0)
 		enable = applyLights(layer, viewmat);
 
-	if(enable)
+	if (enable)
 		EnableOpenGLLights(rasty);
 	else
 		DisableOpenGLLights();
@@ -125,7 +125,7 @@ void GPC_RenderTools::ProcessLighting(RAS_IRasterizer *rasty, bool uselights, co
 
 void GPC_RenderTools::EnableOpenGLLights(RAS_IRasterizer *rasty)
 {
-	if(m_lastlighting == true)
+	if (m_lastlighting == true)
 		return;
 
 	glEnable(GL_LIGHTING);
@@ -142,7 +142,7 @@ void GPC_RenderTools::EnableOpenGLLights(RAS_IRasterizer *rasty)
 
 void GPC_RenderTools::DisableOpenGLLights()
 {
-	if(m_lastlighting == false)
+	if (m_lastlighting == false)
 		return;
 
 	glDisable(GL_LIGHTING);
@@ -291,26 +291,26 @@ void GPC_RenderTools::RenderText3D(	int fontid,
 									double* mat,
 									float aspect)
 {
-	if(GLEW_ARB_multitexture) {
-		for(int i=0; i<MAXTEX; i++) {
+	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))
+			if (GLEW_ARB_texture_cube_map)
+				if (glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB))
 					glDisable(GL_TEXTURE_CUBE_MAP_ARB);
 
-			if(glIsEnabled(GL_TEXTURE_2D))
+			if (glIsEnabled(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))
+		if (GLEW_ARB_texture_cube_map)
+			if (glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB))
 				glDisable(GL_TEXTURE_CUBE_MAP_ARB);
 
-		if(glIsEnabled(GL_TEXTURE_2D))
+		if (glIsEnabled(GL_TEXTURE_2D))
 			glDisable(GL_TEXTURE_2D);
 	}
 
@@ -415,7 +415,7 @@ void GPC_RenderTools::RenderText(
 	struct MTFace* tface = 0;
 	unsigned int *col = 0;
 
-	if(flag & RAS_BLENDERMAT) {
+	if (flag & RAS_BLENDERMAT) {
 		KX_BlenderMaterial *bl_mat = static_cast<KX_BlenderMaterial*>(polymat);
 		tface = bl_mat->GetMTFace();
 		col = bl_mat->GetMCol();
@@ -448,7 +448,7 @@ int GPC_RenderTools::applyLights(int objectlayer, const MT_Transform& viewmat)
 	unsigned int count;
 	std::vector<struct	RAS_LightObject*>::iterator lit = m_lights.begin();
 
-	for(count=0; count<m_numgllights; count++)
+	for (count=0; count<m_numgllights; count++)
 		glDisable((GLenum)(GL_LIGHT0+count));
 
 	viewmat.getValue(glviewmat);
@@ -460,7 +460,7 @@ int GPC_RenderTools::applyLights(int objectlayer, const MT_Transform& viewmat)
 		RAS_LightObject* lightdata = (*lit);
 		KX_LightObject *kxlight = (KX_LightObject*)lightdata->m_light;
 
-		if(kxlight->ApplyLight(kxscene, objectlayer, count))
+		if (kxlight->ApplyLight(kxscene, objectlayer, count))
 			count++;
 	}
 	glPopMatrix();
@@ -472,16 +472,16 @@ void GPC_RenderTools::MotionBlur(RAS_IRasterizer* rasterizer)
 {
 	int state = rasterizer->GetMotionBlurState();
 	float motionblurvalue;
-	if(state)
+	if (state)
 	{
 		motionblurvalue = rasterizer->GetMotionBlurValue();
-		if(state==1)
+		if (state==1)
 		{
 			//bugfix:load color buffer into accum buffer for the first time(state=1)
 			glAccum(GL_LOAD, 1.0);
 			rasterizer->SetMotionBlurState(2);
 		}
-		else if(motionblurvalue>=0.0 && motionblurvalue<=1.0)
+		else if (motionblurvalue>=0.0 && motionblurvalue<=1.0)
 		{
 			glAccum(GL_MULT, motionblurvalue);
 			glAccum(GL_ACCUM, 1-motionblurvalue);
diff --git a/source/gameengine/GamePlayer/common/GPC_RenderTools.h b/source/gameengine/GamePlayer/common/GPC_RenderTools.h
index e3c6902..166a931 100644
--- a/source/gameengine/GamePlayer/common/GPC_RenderTools.h
+++ b/source/gameengine/GamePlayer/common/GPC_RenderTools.h
@@ -29,8 +29,8 @@
  *  \ingroup player
  */
 
-#ifndef __GPC_RENDERTOOLS_H
-#define __GPC_RENDERTOOLS_H
+#ifndef __GPC_RENDERTOOLS_H__
+#define __GPC_RENDERTOOLS_H__
 
 #ifdef WIN32
 // don't show stl-warnings
@@ -77,7 +77,7 @@ public:
 									 float* color,
 									 double* mat,
 									 float aspect);
-	/* @attention mode is ignored here */
+	/* \attention mode is ignored here */
 	void			    RenderText2D(RAS_TEXT_RENDER_MODE mode,
 									 const char* text,
 									 int xco,
@@ -106,7 +106,7 @@ public:
 	virtual void SetClientObject(RAS_IRasterizer *rasty, void* obj);
 };
 
-#endif  // __GPC_RENDERTOOLS_H
+#endif  // __GPC_RENDERTOOLS_H__
 
 
 
diff --git a/source/gameengine/GamePlayer/common/GPC_System.h b/source/gameengine/GamePlayer/common/GPC_System.h
index 9f7a56a..03bb774 100644
--- a/source/gameengine/GamePlayer/common/GPC_System.h
+++ b/source/gameengine/GamePlayer/common/GPC_System.h
@@ -29,8 +29,8 @@
  *  \ingroup player
  */
 
-#ifndef __GPC_SYSTEM_H
-#define __GPC_SYSTEM_H
+#ifndef __GPC_SYSTEM_H__
+#define __GPC_SYSTEM_H__
 
 #if defined(WIN32)
 #pragma warning (disable:4786) // suppress stl-MSVC debug info warning
@@ -59,5 +59,5 @@ public:
 //	NG_NetworkDeviceInterface* m_ndi;
 };
 
-#endif  // __GPC_SYSTEM_H
+#endif  // __GPC_SYSTEM_H__
 
diff --git a/source/gameengine/GamePlayer/common/bmfont.cpp b/source/gameengine/GamePlayer/common/bmfont.cpp
index dd7126b..4c1c6ae 100644
--- a/source/gameengine/GamePlayer/common/bmfont.cpp
+++ b/source/gameengine/GamePlayer/common/bmfont.cpp
@@ -147,7 +147,7 @@ void readBitmapFontVersion0(ImBuf * ibuf, unsigned char * rect, int step)
 			bmfont->glyphs[i].advance  = buffer[index++];
 			bmfont->glyphs[i].reserved = buffer[index++];
 			/* MAART:
-			if (G.f & G_DEBUG) {
+			if (G.debug & G_DEBUG) {
 				printfGlyph(&bmfont->glyphs[i]);
 			}
 			*/
@@ -156,7 +156,7 @@ void readBitmapFontVersion0(ImBuf * ibuf, unsigned char * rect, int step)
 		MEM_freeN(buffer);
 		
 		/* MAART:
-		if (G.f & G_DEBUG) {
+		if (G.debug & G_DEBUG) {
 			printf("Oldy = %d Newy = %d\n", ibuf->y, ibuf->y - ysize);
 			printf("glyphcount = %d\n", glyphcount);
 			printf("bytes = %d\n", bytes);
@@ -295,7 +295,7 @@ void matrixGlyph(ImBuf * ibuf, unsigned short unicode,
 				*advance = (float)(2.0 * bmfont->glyphs[index].advance / (float) bmfont->glyphs[0].advance);
 
 				// printfGlyph(&bmfont->glyphs[index]);
-				// printf("%c %d %0.5f %0.5f %0.5f %0.5f %0.5f \n", unicode, index, *sizex, *sizey, *transx, *transy, *advance);
+				// printf("%c %d %0.5f %0.5f %0.5f %0.5f %0.5f\n", unicode, index, *sizex, *sizey, *transx, *transy, *advance);
 			}
 		}
 	}
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
index f7c3665..eccb83f 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
@@ -138,7 +138,7 @@ GPG_Application::GPG_Application(GHOST_ISystem* system)
 
 GPG_Application::~GPG_Application(void)
 {
-	if(m_pyGlobalDictString) {
+	if (m_pyGlobalDictString) {
 		delete [] m_pyGlobalDictString;
 		m_pyGlobalDictString = 0;
 		m_pyGlobalDictString_Length = 0;
@@ -558,12 +558,12 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode)
 		bool nodepwarnings = (SYS_GetCommandLineInt(syshandle, "ignore_deprecation_warnings", 1) != 0);
 		bool restrictAnimFPS = gm->flag & GAME_RESTRICT_ANIM_UPDATES;
 
-		if(GLEW_ARB_multitexture && GLEW_VERSION_1_1)
+		if (GLEW_ARB_multitexture && GLEW_VERSION_1_1)
 			m_blendermat = (SYS_GetCommandLineInt(syshandle, "blender_material", 1) != 0);
 
-		if(GPU_glsl_support())
+		if (GPU_glsl_support())
 			m_blenderglslmat = (SYS_GetCommandLineInt(syshandle, "blender_glsl_material", 1) != 0);
-		else if(m_globalSettings->matmode == GAME_MAT_GLSL)
+		else if (m_globalSettings->matmode == GAME_MAT_GLSL)
 			m_blendermat = false;
 
 		// create the canvas, rasterizer and rendertools
@@ -579,8 +579,8 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode)
 		if (!m_rendertools)
 			goto initFailed;
 		
-		if(useLists) {
-			if(GLEW_VERSION_1_1)
+		if (useLists) {
+			if (GLEW_VERSION_1_1)
 				m_rasterizer = new RAS_ListRasterizer(m_canvas, true);
 			else
 				m_rasterizer = new RAS_ListRasterizer(m_canvas);
@@ -701,9 +701,9 @@ bool GPG_Application::startEngine(void)
 
 		//	if (always_use_expand_framing)
 		//		sceneconverter->SetAlwaysUseExpandFraming(true);
-		if(m_blendermat && (m_globalSettings->matmode != GAME_MAT_TEXFACE))
+		if (m_blendermat && (m_globalSettings->matmode != GAME_MAT_TEXFACE))
 			m_sceneconverter->SetMaterials(true);
-		if(m_blenderglslmat && (m_globalSettings->matmode == GAME_MAT_GLSL))
+		if (m_blenderglslmat && (m_globalSettings->matmode == GAME_MAT_GLSL))
 			m_sceneconverter->SetGLSLMaterials(true);
 
 		KX_Scene* startscene = new KX_Scene(m_keyboard,
@@ -720,7 +720,7 @@ bool GPG_Application::startEngine(void)
 #endif // WITH_PYTHON
 
 		//initialize Dome Settings
-		if(m_startScene->gm.stereoflag == STEREO_DOME)
+		if (m_startScene->gm.stereoflag == STEREO_DOME)
 			m_ketsjiengine->InitDome(m_startScene->gm.dome.res, m_startScene->gm.dome.mode, m_startScene->gm.dome.angle, m_startScene->gm.dome.resbuf, m_startScene->gm.dome.tilt, m_startScene->gm.dome.warptext);
 
 #ifdef WITH_PYTHON
@@ -764,7 +764,7 @@ void GPG_Application::stopEngine()
 	// GameLogic.globalDict gets converted into a buffer, and sorted in
 	// m_pyGlobalDictString so we can restore after python has stopped
 	// and started between .blend file loads.
-	if(m_pyGlobalDictString) {
+	if (m_pyGlobalDictString) {
 		delete [] m_pyGlobalDictString;
 		m_pyGlobalDictString = 0;
 	}
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Canvas.h b/source/gameengine/GamePlayer/ghost/GPG_Canvas.h
index 217cfc5..d931f60 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Canvas.h
+++ b/source/gameengine/GamePlayer/ghost/GPG_Canvas.h
@@ -29,8 +29,8 @@
  *  \ingroup player
  */
 
-#ifndef _GPG_CANVAS_H_
-#define _GPG_CANVAS_H_
+#ifndef __GPG_CANVAS_H__
+#define __GPG_CANVAS_H__
 
 #ifdef WIN32
 #pragma warning (disable : 4786)
@@ -55,16 +55,16 @@ public:
 	virtual void SetMousePosition(int x, int y);
 	virtual void SetMouseState(RAS_MouseState mousestate);
 	virtual void SwapBuffers();
-	virtual int GetMouseX(int x){return x;};
-	virtual int GetMouseY(int y){return y;};
+	virtual int GetMouseX(int x) { return x; }
+	virtual int GetMouseY(int y) { return y; }
 	virtual float GetMouseNormalizedX(int x);
 	virtual float GetMouseNormalizedY(int y);
 
 	virtual void ResizeWindow(int width, int height);
 
-	bool BeginDraw() { return true;};
+	bool BeginDraw() { return true; }
 	void EndDraw() {};
 };
 
-#endif // _GPG_CANVAS_H_
+#endif // __GPG_CANVAS_H__
 
diff --git a/source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.cpp b/source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.cpp
index 1d67ce0..b31803b 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.cpp
@@ -35,71 +35,71 @@
 
 GPG_KeyboardDevice::GPG_KeyboardDevice(void)
 {
-	m_reverseKeyTranslateTable[GHOST_kKeyA                     ] = KX_AKEY                    ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyB                     ] = KX_BKEY                    ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyC                     ] = KX_CKEY                    ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyD                     ] = KX_DKEY                    ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyE                     ] = KX_EKEY                    ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyF                     ] = KX_FKEY                    ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyG                     ] = KX_GKEY                    ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyH                     ] = KX_HKEY                    ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyI                     ] = KX_IKEY                    ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyJ                     ] = KX_JKEY                    ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyK                     ] = KX_KKEY                    ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyL                     ] = KX_LKEY                    ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyM                     ] = KX_MKEY                    ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyN                     ] = KX_NKEY                    ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyO                     ] = KX_OKEY                    ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyP                     ] = KX_PKEY                    ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyQ                     ] = KX_QKEY                    ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyR                     ] = KX_RKEY                    ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyS                     ] = KX_SKEY                    ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyT                     ] = KX_TKEY                    ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyU                     ] = KX_UKEY                    ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyV                     ] = KX_VKEY                    ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyW                     ] = KX_WKEY                    ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyX                     ] = KX_XKEY                    ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyY                     ] = KX_YKEY                    ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyZ                     ] = KX_ZKEY                    ;                  
+	m_reverseKeyTranslateTable[GHOST_kKeyA                     ] = KX_AKEY                    ;
+	m_reverseKeyTranslateTable[GHOST_kKeyB                     ] = KX_BKEY                    ;
+	m_reverseKeyTranslateTable[GHOST_kKeyC                     ] = KX_CKEY                    ;
+	m_reverseKeyTranslateTable[GHOST_kKeyD                     ] = KX_DKEY                    ;
+	m_reverseKeyTranslateTable[GHOST_kKeyE                     ] = KX_EKEY                    ;
+	m_reverseKeyTranslateTable[GHOST_kKeyF                     ] = KX_FKEY                    ;
+	m_reverseKeyTranslateTable[GHOST_kKeyG                     ] = KX_GKEY                    ;
+	m_reverseKeyTranslateTable[GHOST_kKeyH                     ] = KX_HKEY                    ;
+	m_reverseKeyTranslateTable[GHOST_kKeyI                     ] = KX_IKEY                    ;
+	m_reverseKeyTranslateTable[GHOST_kKeyJ                     ] = KX_JKEY                    ;
+	m_reverseKeyTranslateTable[GHOST_kKeyK                     ] = KX_KKEY                    ;
+	m_reverseKeyTranslateTable[GHOST_kKeyL                     ] = KX_LKEY                    ;
+	m_reverseKeyTranslateTable[GHOST_kKeyM                     ] = KX_MKEY                    ;
+	m_reverseKeyTranslateTable[GHOST_kKeyN                     ] = KX_NKEY                    ;
+	m_reverseKeyTranslateTable[GHOST_kKeyO                     ] = KX_OKEY                    ;
+	m_reverseKeyTranslateTable[GHOST_kKeyP                     ] = KX_PKEY                    ;
+	m_reverseKeyTranslateTable[GHOST_kKeyQ                     ] = KX_QKEY                    ;
+	m_reverseKeyTranslateTable[GHOST_kKeyR                     ] = KX_RKEY                    ;
+	m_reverseKeyTranslateTable[GHOST_kKeyS                     ] = KX_SKEY                    ;
+	m_reverseKeyTranslateTable[GHOST_kKeyT                     ] = KX_TKEY                    ;
+	m_reverseKeyTranslateTable[GHOST_kKeyU                     ] = KX_UKEY                    ;
+	m_reverseKeyTranslateTable[GHOST_kKeyV                     ] = KX_VKEY                    ;
+	m_reverseKeyTranslateTable[GHOST_kKeyW                     ] = KX_WKEY                    ;
+	m_reverseKeyTranslateTable[GHOST_kKeyX                     ] = KX_XKEY                    ;
+	m_reverseKeyTranslateTable[GHOST_kKeyY                     ] = KX_YKEY                    ;
+	m_reverseKeyTranslateTable[GHOST_kKeyZ                     ] = KX_ZKEY                    ;
 
-	m_reverseKeyTranslateTable[GHOST_kKey0                     ] = KX_ZEROKEY                 ;                  
-	m_reverseKeyTranslateTable[GHOST_kKey1                     ] = KX_ONEKEY                  ;                  
-	m_reverseKeyTranslateTable[GHOST_kKey2                     ] = KX_TWOKEY                  ;                  
-	m_reverseKeyTranslateTable[GHOST_kKey3                     ] = KX_THREEKEY                ;                  
-	m_reverseKeyTranslateTable[GHOST_kKey4                     ] = KX_FOURKEY                 ;                  
-	m_reverseKeyTranslateTable[GHOST_kKey5                     ] = KX_FIVEKEY                 ;                  
-	m_reverseKeyTranslateTable[GHOST_kKey6                     ] = KX_SIXKEY                  ;                  
-	m_reverseKeyTranslateTable[GHOST_kKey7                     ] = KX_SEVENKEY                ;                  
-	m_reverseKeyTranslateTable[GHOST_kKey8                     ] = KX_EIGHTKEY                ;                  
+	m_reverseKeyTranslateTable[GHOST_kKey0                     ] = KX_ZEROKEY                 ;
+	m_reverseKeyTranslateTable[GHOST_kKey1                     ] = KX_ONEKEY                  ;
+	m_reverseKeyTranslateTable[GHOST_kKey2                     ] = KX_TWOKEY                  ;
+	m_reverseKeyTranslateTable[GHOST_kKey3                     ] = KX_THREEKEY                ;
+	m_reverseKeyTranslateTable[GHOST_kKey4                     ] = KX_FOURKEY                 ;
+	m_reverseKeyTranslateTable[GHOST_kKey5                     ] = KX_FIVEKEY                 ;
+	m_reverseKeyTranslateTable[GHOST_kKey6                     ] = KX_SIXKEY                  ;
+	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               ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyDelete                ] = KX_DELKEY                  ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyHome                  ] = KX_HOMEKEY                 ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyEnd                   ] = KX_ENDKEY                  ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyUpPage                ] = KX_PAGEUPKEY               ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyDownPage              ] = KX_PAGEDOWNKEY             ;                  
+	m_reverseKeyTranslateTable[GHOST_kKeyPause                 ] = KX_PAUSEKEY                ;
+	m_reverseKeyTranslateTable[GHOST_kKeyInsert                ] = KX_INSERTKEY               ;
+	m_reverseKeyTranslateTable[GHOST_kKeyDelete                ] = KX_DELKEY                  ;
+	m_reverseKeyTranslateTable[GHOST_kKeyHome                  ] = KX_HOMEKEY                 ;
+	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            ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyLeftArrow             ] = KX_LEFTARROWKEY            ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyRightArrow            ] = KX_RIGHTARROWKEY           ;                  
+	m_reverseKeyTranslateTable[GHOST_kKeyUpArrow               ] = KX_UPARROWKEY              ;
+	m_reverseKeyTranslateTable[GHOST_kKeyDownArrow             ] = KX_DOWNARROWKEY            ;
+	m_reverseKeyTranslateTable[GHOST_kKeyLeftArrow             ] = KX_LEFTARROWKEY            ;
+	m_reverseKeyTranslateTable[GHOST_kKeyRightArrow            ] = KX_RIGHTARROWKEY           ;
 
 	// Function keys
-	m_reverseKeyTranslateTable[GHOST_kKeyF1                    ] = KX_F1KEY                   ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyF2                    ] = KX_F2KEY                   ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyF3                    ] = KX_F3KEY                   ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyF4                    ] = KX_F4KEY                   ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyF5                    ] = KX_F5KEY                   ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyF6                    ] = KX_F6KEY                   ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyF7                    ] = KX_F7KEY                   ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyF8                    ] = KX_F8KEY                   ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyF9                    ] = KX_F9KEY                   ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyF10                   ] = KX_F10KEY                  ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyF11                   ] = KX_F11KEY                  ;                  
+	m_reverseKeyTranslateTable[GHOST_kKeyF1                    ] = KX_F1KEY                   ;
+	m_reverseKeyTranslateTable[GHOST_kKeyF2                    ] = KX_F2KEY                   ;
+	m_reverseKeyTranslateTable[GHOST_kKeyF3                    ] = KX_F3KEY                   ;
+	m_reverseKeyTranslateTable[GHOST_kKeyF4                    ] = KX_F4KEY                   ;
+	m_reverseKeyTranslateTable[GHOST_kKeyF5                    ] = KX_F5KEY                   ;
+	m_reverseKeyTranslateTable[GHOST_kKeyF6                    ] = KX_F6KEY                   ;
+	m_reverseKeyTranslateTable[GHOST_kKeyF7                    ] = KX_F7KEY                   ;
+	m_reverseKeyTranslateTable[GHOST_kKeyF8                    ] = KX_F8KEY                   ;
+	m_reverseKeyTranslateTable[GHOST_kKeyF9                    ] = KX_F9KEY                   ;
+	m_reverseKeyTranslateTable[GHOST_kKeyF10                   ] = KX_F10KEY                  ;
+	m_reverseKeyTranslateTable[GHOST_kKeyF11                   ] = KX_F11KEY                  ;
 	m_reverseKeyTranslateTable[GHOST_kKeyF12                   ] = KX_F12KEY                  ;
 	m_reverseKeyTranslateTable[GHOST_kKeyF13                   ] = KX_F13KEY                  ;
 	m_reverseKeyTranslateTable[GHOST_kKeyF14                   ] = KX_F14KEY                  ;
@@ -111,49 +111,49 @@ GPG_KeyboardDevice::GPG_KeyboardDevice(void)
 	
 
 	// 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_kKeyNumpadAsterisk        ] = KX_PADASTERKEY              ;                                                                                                                     	                                                                                                       
-	m_reverseKeyTranslateTable[GHOST_kKeyNumpadPlus            ] = KX_PADPLUSKEY               ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyNumpadPeriod          ] = KX_PADPERIOD                ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyNumpadMinus           ] = KX_PADMINUS                 ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyNumpadSlash           ] = KX_PADSLASHKEY            ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyNumpadEnter           ] = KX_PADENTER                 ;                  
+	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                ;
+	m_reverseKeyTranslateTable[GHOST_kKeyNumpadMinus           ] = KX_PADMINUS                 ;
+	m_reverseKeyTranslateTable[GHOST_kKeyNumpadSlash           ] = KX_PADSLASHKEY              ;
+	m_reverseKeyTranslateTable[GHOST_kKeyNumpadEnter           ] = KX_PADENTER                 ;
 
 	// Other keys
-	m_reverseKeyTranslateTable[GHOST_kKeyCapsLock              ] = KX_CAPSLOCKKEY              ;                  
-	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_kKeyBackSpace             ] = KX_BACKSPACEKEY             ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeySemicolon             ] = KX_SEMICOLONKEY             ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyPeriod                ] = KX_PERIODKEY                ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyComma                 ] = KX_COMMAKEY                 ;                  
-	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_kKeyBackslash             ] = KX_BACKSLASHKEY             ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyEqual                 ] = KX_EQUALKEY                 ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyLeftBracket	       ] = KX_LEFTBRACKETKEY           ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyRightBracket	       ] = KX_RIGHTBRACKETKEY          ;                  
+	m_reverseKeyTranslateTable[GHOST_kKeyCapsLock              ] = KX_CAPSLOCKKEY              ;
+	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_kKeyBackSpace             ] = KX_BACKSPACEKEY             ;
+	m_reverseKeyTranslateTable[GHOST_kKeySemicolon             ] = KX_SEMICOLONKEY             ;
+	m_reverseKeyTranslateTable[GHOST_kKeyPeriod                ] = KX_PERIODKEY                ;
+	m_reverseKeyTranslateTable[GHOST_kKeyComma                 ] = KX_COMMAKEY                 ;
+	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_kKeyBackslash             ] = KX_BACKSLASHKEY             ;
+	m_reverseKeyTranslateTable[GHOST_kKeyEqual                 ] = KX_EQUALKEY                 ;
+	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_kKeyLeftAlt               ] = KX_LEFTALTKEY               ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyRightAlt              ] = KX_RIGHTALTKEY              ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyLeftShift             ] = KX_LEFTSHIFTKEY             ;                  
-	m_reverseKeyTranslateTable[GHOST_kKeyRightShift	           ] = KX_RIGHTSHIFTKEY            ;                  
+	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            ;
 }
 
 
diff --git a/source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.h b/source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.h
index 2c7ba86..8d72a62 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.h
+++ b/source/gameengine/GamePlayer/ghost/GPG_KeyboardDevice.h
@@ -30,8 +30,8 @@
  *  \brief GHOST Blender Player keyboard device.
  */
 
-#ifndef _GPG_KEYBOARDDEVICE_H_
-#define _GPG_KEYBOARDDEVICE_H_
+#ifndef __GPG_KEYBOARDDEVICE_H__
+#define __GPG_KEYBOARDDEVICE_H__
 
 #ifdef WIN32
 #pragma warning (disable : 4786)
@@ -44,7 +44,7 @@
  * GHOST implementation of GPC_KeyboardDevice.
  * The contructor fills the keyboard code translation map.
  * Base class GPC_KeyboardDevice does the rest.
- * @see SCA_IInputDevice
+ * \see SCA_IInputDevice
  */
 class GPG_KeyboardDevice : public GPC_KeyboardDevice
 {
@@ -53,5 +53,5 @@ public:
 	virtual ~GPG_KeyboardDevice(void);
 };
 
-#endif //_GPG_KEYBOARDDEVICE_H_
+#endif //__GPG_KEYBOARDDEVICE_H__
 
diff --git a/source/gameengine/GamePlayer/ghost/GPG_System.cpp b/source/gameengine/GamePlayer/ghost/GPG_System.cpp
index d5e4502..6710572 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_System.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_System.cpp
@@ -46,7 +46,7 @@ double GPG_System::GetTimeInSeconds()
 {
 	GHOST_TInt64 millis = (GHOST_TInt64)m_system->getMilliSeconds();
 	double time = (double)millis;
-	time /= 1000.;
+	time /= 1000.0f;
 	return time;
 }
 
diff --git a/source/gameengine/GamePlayer/ghost/GPG_System.h b/source/gameengine/GamePlayer/ghost/GPG_System.h
index d7f3093..796ad0c 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_System.h
+++ b/source/gameengine/GamePlayer/ghost/GPG_System.h
@@ -30,8 +30,8 @@
  *  \brief Blender Player system on GHOST.
  */
 
-#ifndef _GPG_SYSTEM_H_
-#define _GPG_SYSTEM_H_
+#ifndef __GPG_SYSTEM_H__
+#define __GPG_SYSTEM_H__
 
 #ifdef WIN32
 #pragma warning (disable:4786) // suppress stl-MSVC debug info warning
@@ -51,5 +51,5 @@ public:
 	virtual double GetTimeInSeconds();
 };
 
-#endif // _GPG_SYSTEM_H_
+#endif // __GPG_SYSTEM_H__
 
diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
index 9166f0d..b5e165a 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
@@ -232,7 +232,7 @@ void usage(const char* program, bool isBlenderPlayer)
 	printf("             sphericalpanoramic     (Spherical Panoramic)\n");
 	printf("                             depending on the type of dome you are using\n\n");
 	printf("  -m: maximum anti-aliasing (eg. 2,4,8,16)\n\n");
-	printf("  -i: parent windows ID \n\n");
+	printf("  -i: parent windows ID\n\n");
 #ifdef _WIN32
 	printf("  -c: keep console window open\n\n");
 #endif
@@ -297,7 +297,7 @@ static void get_filename(int argc, char **argv, char *filename)
 #else
 	filename[0] = '\0';
 
-	if(argc > 1)
+	if (argc > 1)
 		BLI_strncpy(filename, argv[argc-1], FILE_MAX);
 #endif // !_APPLE
 }
@@ -437,7 +437,7 @@ int main(int argc, char** argv)
 			break;
 		case SCREEN_SAVER_MODE_PASSWORD:
 			/* This is W95 only, which we currently do not support.
-			   Fall-back to normal screen saver behaviour in that case... */
+			   Fall-back to normal screen saver behavior in that case... */
 		case SCREEN_SAVER_MODE_SAVER:
 			fullScreen = true;
 			fullScreenParFound = true;
@@ -527,7 +527,7 @@ int main(int argc, char** argv)
 
 			case 'd':
 				i++;
-				G.f |= G_DEBUG;     /* std output printf's */
+				G.debug |= G_DEBUG;     /* std output printf's */
 				MEM_set_memory_debug();
 				break;
 
@@ -606,29 +606,29 @@ int main(int argc, char** argv)
 					if (stereomode < RAS_IRasterizer::RAS_STEREO_NOSTEREO || stereomode >= RAS_IRasterizer::RAS_STEREO_MAXSTEREO)
 						stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO;
 					
-					if(!strcmp(argv[i], "nostereo"))  // ok, redundant but clear
+					if (!strcmp(argv[i], "nostereo"))  // ok, redundant but clear
 						stereomode = RAS_IRasterizer::RAS_STEREO_NOSTEREO;
 					
 					// only the hardware pageflip method needs a stereo window
-					else if(!strcmp(argv[i], "hwpageflip")) {
+					else if (!strcmp(argv[i], "hwpageflip")) {
 						stereomode = RAS_IRasterizer::RAS_STEREO_QUADBUFFERED;
 						stereoWindow = true;
 					}
-					else if(!strcmp(argv[i], "syncdoubling"))
+					else if (!strcmp(argv[i], "syncdoubling"))
 						stereomode = RAS_IRasterizer::RAS_STEREO_ABOVEBELOW;
 					
-					else if(!strcmp(argv[i], "anaglyph"))
+					else if (!strcmp(argv[i], "anaglyph"))
 						stereomode = RAS_IRasterizer::RAS_STEREO_ANAGLYPH;
 					
-					else if(!strcmp(argv[i], "sidebyside"))
+					else if (!strcmp(argv[i], "sidebyside"))
 						stereomode = RAS_IRasterizer::RAS_STEREO_SIDEBYSIDE;
 					
-					else if(!strcmp(argv[i], "vinterlace"))
+					else if (!strcmp(argv[i], "vinterlace"))
 						stereomode = RAS_IRasterizer::RAS_STEREO_VINTERLACE;
 					
 #if 0
 					// future stuff
-					else if(!strcmp(argv[i], "stencil")
+					else if (!strcmp(argv[i], "stencil")
 						stereomode = RAS_STEREO_STENCIL;
 #endif
 					
@@ -648,33 +648,33 @@ int main(int argc, char** argv)
 				i++;
 				if ((i + 1) <= validArguments)
 				{
-					if(!strcmp(argv[i], "angle")){
+					if (!strcmp(argv[i], "angle")) {
 						i++;
 						domeFov = atoi(argv[i++]);
 					}
-					if(!strcmp(argv[i], "tilt")){
+					if (!strcmp(argv[i], "tilt")) {
 						i++;
 						domeTilt = atoi(argv[i++]);
 					}
-					if(!strcmp(argv[i], "warpdata")){
+					if (!strcmp(argv[i], "warpdata")) {
 						i++;
 						domeWarp = argv[i++];
 					}
-					if(!strcmp(argv[i], "mode")){
+					if (!strcmp(argv[i], "mode")) {
 						i++;
-						if(!strcmp(argv[i], "fisheye"))
+						if (!strcmp(argv[i], "fisheye"))
 							domeMode = DOME_FISHEYE;
 							
-						else if(!strcmp(argv[i], "truncatedfront"))
+						else if (!strcmp(argv[i], "truncatedfront"))
 							domeMode = DOME_TRUNCATED_FRONT;
 							
-						else if(!strcmp(argv[i], "truncatedrear"))
+						else if (!strcmp(argv[i], "truncatedrear"))
 							domeMode = DOME_TRUNCATED_REAR;
 							
-						else if(!strcmp(argv[i], "cubemap"))
+						else if (!strcmp(argv[i], "cubemap"))
 							domeMode = DOME_ENVMAP;
 							
-						else if(!strcmp(argv[i], "sphericalpanoramic"))
+						else if (!strcmp(argv[i], "sphericalpanoramic"))
 							domeMode = DOME_PANORAM_SPH;
 
 						else
@@ -749,7 +749,7 @@ int main(int argc, char** argv)
 				char *titlename;
 
 				get_filename(argc_py_clamped, argv, filename);
-				if(filename[0])
+				if (filename[0])
 					BLI_path_cwd(filename);
 				
 
@@ -802,7 +802,7 @@ int main(int argc, char** argv)
 #if !defined(DEBUG)
 						if (closeConsole)
 						{
-							//::FreeConsole();    // Close a console window
+							system->toggleConsole(0); // Close a console window
 						}
 #endif // !defined(DEBUG)
 #endif // WIN32
@@ -846,7 +846,7 @@ int main(int argc, char** argv)
 						// Check whether the game should be displayed in stereo
 						if (!stereoParFound)
 						{
-							if(scene->gm.stereoflag == STEREO_ENABLED){
+							if (scene->gm.stereoflag == STEREO_ENABLED) {
 								stereomode = (RAS_IRasterizer::StereoMode) scene->gm.stereomode;
 								if (stereomode != RAS_IRasterizer::RAS_STEREO_QUADBUFFERED)
 									stereoWindow = true;
@@ -858,7 +858,7 @@ int main(int argc, char** argv)
 						if (!samplesParFound)
 							aasamples = scene->gm.aasamples;
 
-						if (stereoFlag == STEREO_DOME){
+						if (stereoFlag == STEREO_DOME) {
 							stereomode = RAS_IRasterizer::RAS_STEREO_DOME;
 							scene->gm.stereoflag = STEREO_DOME;
 							if (domeFov > 89)
@@ -871,7 +871,7 @@ int main(int argc, char** argv)
 							{
 								//XXX to do: convert relative to absolute path
 								domeText= add_text(domeWarp, "");
-								if(!domeText)
+								if (!domeText)
 									printf("error: invalid warpdata text file - %s\n", domeWarp);
 								else
 									scene->gm.dome.warptext = domeText;
@@ -881,7 +881,7 @@ int main(int argc, char** argv)
 						//					GPG_Application app (system, maggie, startscenename);
 						app.SetGameEngineData(maggie, scene, &gs, argc, argv); /* this argc cant be argc_py_clamped, since python uses it */
 						BLI_strncpy(pathname, maggie->name, sizeof(pathname));
-						if(G.main != maggie) {
+						if (G.main != maggie) {
 							BLI_strncpy(G.main->name, maggie->name, sizeof(G.main->name));
 						}
 #ifdef WITH_PYTHON
@@ -1014,7 +1014,7 @@ int main(int argc, char** argv)
 	SYS_DeleteSystem(syshandle);
 
 	int totblock= MEM_get_memory_blocks_in_use();
-	if(totblock!=0) {
+	if (totblock!=0) {
 		printf("Error Totblock: %d\n",totblock);
 		MEM_set_error_callback(mem_error_cb);
 		MEM_printmemlist();
diff --git a/source/gameengine/GamePlayer/xembed/UnixShell.c b/source/gameengine/GamePlayer/xembed/UnixShell.c
index afdb258..d79b8b4 100644
--- a/source/gameengine/GamePlayer/xembed/UnixShell.c
+++ b/source/gameengine/GamePlayer/xembed/UnixShell.c
@@ -76,7 +76,7 @@ execute_blenderplayer(BlenderPluginInstance*);
 /* NPP_GetMIMEDescription() and NPP_GetValue() are called to determine
  * the mime types supported by this plugin. */
 char*
-NPP_GetMIMEDescription( void )
+NPP_GetMIMEDescription(void)
 {
 	log_entry("NPP_GetMIMEDescription");
 	return("application/x-blender-plugin:blend:Blender 3D web plugin");
@@ -194,8 +194,10 @@ NPP_New(
 					NPN_Status(instance, "Cannot read animation file");
 					This->blend_file = NULL;
 					return NPERR_NO_ERROR;
-				} else
-					log_entry("Animation loaded"); 
+				}
+				else {
+					log_entry("Animation loaded");
+				}
 			}
 		} 		
 		i++;
@@ -203,8 +205,10 @@ NPP_New(
 		
 	if (This != NULL) {
 		return NPERR_NO_ERROR;
-	} else
+	}
+	else {
 		return NPERR_OUT_OF_MEMORY_ERROR;
+	}
 }
 
 
@@ -234,7 +238,7 @@ NPP_Destroy( NPP instance, NPSavedData** save )
 		}
 
 		// sometimes FF doesn't delete it's own window...
-		//printf("%s \n", NPN_UserAgent(instance));
+		//printf("%s\n", NPN_UserAgent(instance));
 		/*if (This->display != NULL && This->window != 0)
 			XDestroyWindow(This->display, This->window);
 		*/
@@ -278,7 +282,8 @@ NPP_SetWindow( NPP instance,NPWindow* window )
 
 		printf("ID window 0x%x %d\n", window->window, window->window);
 		return NPERR_NO_ERROR;
-	} else {
+	}
+	else {
 		return NPERR_INVALID_INSTANCE_ERROR;
 	}
 }
@@ -403,7 +408,8 @@ NPP_Write(
 			log_entry("NPP_Write: main_file_stream loaded"); 
 			execute_blenderplayer(This);
 		}
-	} else {
+	}
+	else {
 		/* the stream ref wasn't set yet..*/
 		log_entry("NPP_Write: not main stream"); 
 		log_entry(stream->url);
@@ -440,7 +446,8 @@ NPP_DestroyStream(
 			}
 		}
 		return NPERR_NO_ERROR;
-	} else {
+	}
+	else {
 		return NPERR_INVALID_INSTANCE_ERROR;
 	}
 
@@ -462,7 +469,7 @@ NPP_Print(NPP instance, NPPrint* printInfo )
 {
 	
 	log_entry("NPP_Print");
-	if(printInfo == NULL)
+	if (printInfo == NULL)
 		return;
 	if (instance != NULL) {
 		if (printInfo->mode == NP_FULL) {
@@ -475,7 +482,8 @@ NPP_Print(NPP instance, NPPrint* printInfo )
 
 
 void
-execute_blenderplayer(BlenderPluginInstance* instance){
+execute_blenderplayer(BlenderPluginInstance* instance)
+{
 
 	char file_name[] = "/tmp/blender.XXXXXX";
 	int fd = mkstemp(file_name);
@@ -509,13 +517,14 @@ execute_blenderplayer(BlenderPluginInstance* instance){
 		execlp(executable, executable, "-i", window_id, file_name, (char*)NULL);
 #endif
 	
-	} else if (instance->pID < 0) {           // failed to fork
+	}
+	else if (instance->pID < 0) {           // failed to fork
 		printf("Failed to fork!!!\n");					
 	}
 
 	/*XEvent e;
 	int started = 0;
-	while(!started) {
+	while (!started) {
 		XNextEvent(This->display, &e);
 		printf("Event type %d\n", e.type);					
 		if (e.type == MapNotify) {
diff --git a/source/gameengine/GamePlayer/xembed/blender_plugin_types.h b/source/gameengine/GamePlayer/xembed/blender_plugin_types.h
index a522e5e..85dc697 100644
--- a/source/gameengine/GamePlayer/xembed/blender_plugin_types.h
+++ b/source/gameengine/GamePlayer/xembed/blender_plugin_types.h
@@ -26,8 +26,8 @@
  * Plugin-instance related data
  */
 
-#ifndef BLENDER_PLUGIN_TYPES_H
-#define BLENDER_PLUGIN_TYPES_H
+#ifndef __BLENDER_PLUGIN_TYPES_H__
+#define __BLENDER_PLUGIN_TYPES_H__
 
 #include <stdio.h>
 
diff --git a/source/gameengine/GamePlayer/xembed/blenderplayer-wrapper.c b/source/gameengine/GamePlayer/xembed/blenderplayer-wrapper.c
index 434a50c..d2dd420 100644
--- a/source/gameengine/GamePlayer/xembed/blenderplayer-wrapper.c
+++ b/source/gameengine/GamePlayer/xembed/blenderplayer-wrapper.c
@@ -122,7 +122,7 @@ int main(int argc, char *argv[])
 		exit(EXIT_FAILURE);
 	}
 
-	if (fchown(fd, new_id, -1) != 0 ){
+	if (fchown(fd, new_id, -1) != 0 ) {
 		perror("Cannot chown file\n");
 		exit(EXIT_FAILURE);
 	}
@@ -171,7 +171,8 @@ int main(int argc, char *argv[])
 		perror("Cannot fork!\n");
 		exit(EXIT_FAILURE);
 	
-	} else { // parent
+	}
+	else { // parent
 		int status;
 		fprintf(stderr, "Waiting for xauth....\n");
 		wait(&status);
@@ -179,7 +180,7 @@ int main(int argc, char *argv[])
 	}
 
 	/* xauth file must be readable by the privsep user */
-	if (chown(auth_file_name, new_id, -1) != 0 ){
+	if (chown(auth_file_name, new_id, -1) != 0 ) {
 		perror("Cannot chown auth file\n");
 		exit(EXIT_FAILURE);
 	}
@@ -209,7 +210,8 @@ int main(int argc, char *argv[])
 	
 		const char* blenderplayer = "/usr/bin/blenderplayer";
 		execl(blenderplayer, "blenderplayer", "-i", window_id, file_name, (char*)NULL);
-	} else {
+	}
+	else {
 		/** Still running with higher privileges */
 		int status;
 		fprintf(stderr, "Waiting for blenderplayer....\n");
@@ -217,7 +219,7 @@ int main(int argc, char *argv[])
 		fprintf(stderr, "blenderplayer done!\n");
 
 		// We have to remove xauth file and I have to chown blender file back to the original user
-		if (chown(file_name, caller_id, -1) != 0 ){
+		if (chown(file_name, caller_id, -1) != 0 ) {
 			perror("Cannot chown file back to original user\n");
 			exit(EXIT_FAILURE);
 		}
diff --git a/source/gameengine/GamePlayer/xembed/npunix.c b/source/gameengine/GamePlayer/xembed/npunix.c
index 629114c..ca3bf84 100644
--- a/source/gameengine/GamePlayer/xembed/npunix.c
+++ b/source/gameengine/GamePlayer/xembed/npunix.c
@@ -314,7 +314,7 @@ NP_GetValue(void *future, NPPVariable variable, void *value)
  *
  * PARAMETERS
  *    nsTable	- The netscape function table. If developers just use these
- *		  wrappers, they dont need to worry about all these function
+ *		  wrappers, they don't need to worry about all these function
  *		  tables.
  * RETURN
  *    pluginFuncs
diff --git a/source/gameengine/Ketsji/BL_Action.cpp b/source/gameengine/Ketsji/BL_Action.cpp
index 1d5a3dd..c187199 100644
--- a/source/gameengine/Ketsji/BL_Action.cpp
+++ b/source/gameengine/Ketsji/BL_Action.cpp
@@ -25,6 +25,7 @@
  */
 
 #include <cstdlib>
+#include <stdio.h>
 
 #include "BL_Action.h"
 #include "BL_ArmatureObject.h"
diff --git a/source/gameengine/Ketsji/BL_Action.h b/source/gameengine/Ketsji/BL_Action.h
index 3efea05..e5e325a 100644
--- a/source/gameengine/Ketsji/BL_Action.h
+++ b/source/gameengine/Ketsji/BL_Action.h
@@ -24,8 +24,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __BL_ACTION
-#define __BL_ACTION
+#ifndef __BL_ACTION_H__
+#define __BL_ACTION_H__
 
 
 #include <vector>
diff --git a/source/gameengine/Ketsji/BL_ActionManager.h b/source/gameengine/Ketsji/BL_ActionManager.h
index 2ba8486..d4351e3 100644
--- a/source/gameengine/Ketsji/BL_ActionManager.h
+++ b/source/gameengine/Ketsji/BL_ActionManager.h
@@ -24,8 +24,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __BL_ACTIONMANAGER
-#define __BL_ACTIONMANAGER
+#ifndef __BL_ACTIONMANAGER_H__
+#define __BL_ACTIONMANAGER_H__
 
 #include "BL_Action.h"
 
diff --git a/source/gameengine/Ketsji/BL_BlenderShader.cpp b/source/gameengine/Ketsji/BL_BlenderShader.cpp
index 0f97898..122d692 100644
--- a/source/gameengine/Ketsji/BL_BlenderShader.cpp
+++ b/source/gameengine/Ketsji/BL_BlenderShader.cpp
@@ -35,7 +35,7 @@ BL_BlenderShader::BL_BlenderShader(KX_Scene *scene, struct Material *ma, int lig
 
 BL_BlenderShader::~BL_BlenderShader()
 {
-	if(mGPUMat)
+	if (mGPUMat)
 		GPU_material_unbind(mGPUMat);
 }
 
@@ -46,8 +46,8 @@ void BL_BlenderShader::ReloadMaterial()
 
 void BL_BlenderShader::SetProg(bool enable, double time)
 {
-	if(VerifyShader()) {
-		if(enable)
+	if (VerifyShader()) {
+		if (enable)
 			GPU_material_bind(mGPUMat, mLightLayer, mBlenderScene->lay, time, 1);
 		else
 			GPU_material_unbind(mGPUMat);
@@ -59,16 +59,16 @@ int BL_BlenderShader::GetAttribNum()
 	GPUVertexAttribs attribs;
 	int i, enabled = 0;
 
-	if(!VerifyShader())
+	if (!VerifyShader())
 		return enabled;
 
 	GPU_material_vertex_attributes(mGPUMat, &attribs);
 
-	for(i = 0; i < attribs.totlayer; i++)
-		if(attribs.layer[i].glindex+1 > enabled)
+	for (i = 0; i < attribs.totlayer; i++)
+		if (attribs.layer[i].glindex+1 > enabled)
 			enabled= attribs.layer[i].glindex+1;
 	
-	if(enabled > BL_MAX_ATTRIB)
+	if (enabled > BL_MAX_ATTRIB)
 		enabled = BL_MAX_ATTRIB;
 
 	return enabled;
@@ -82,39 +82,39 @@ void BL_BlenderShader::SetAttribs(RAS_IRasterizer* ras, const BL_Material *mat)
 
 	ras->SetAttribNum(0);
 
-	if(!VerifyShader())
+	if (!VerifyShader())
 		return;
 	
 	gpumat = mGPUMat;
 
-	if(ras->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED) {
+	if (ras->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED) {
 		GPU_material_vertex_attributes(gpumat, &attribs);
 		attrib_num = GetAttribNum();
 
 		ras->SetTexCoordNum(0);
 		ras->SetAttribNum(attrib_num);
-		for(i=0; i<attrib_num; i++)
+		for (i=0; i<attrib_num; i++)
 			ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_DISABLE, i);
 
-		for(i = 0; i < attribs.totlayer; i++) {
-			if(attribs.layer[i].glindex > attrib_num)
+		for (i = 0; i < attribs.totlayer; i++) {
+			if (attribs.layer[i].glindex > attrib_num)
 				continue;
 
-			if(attribs.layer[i].type == CD_MTFACE) {
-				if(!mat->uvName.IsEmpty() && strcmp(mat->uvName.ReadPtr(), attribs.layer[i].name) == 0)
+			if (attribs.layer[i].type == CD_MTFACE) {
+				if (!mat->uvName.IsEmpty() && strcmp(mat->uvName.ReadPtr(), attribs.layer[i].name) == 0)
 					ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_UV1, attribs.layer[i].glindex);
-				else if(!mat->uv2Name.IsEmpty() && strcmp(mat->uv2Name.ReadPtr(), attribs.layer[i].name) == 0)
+				else if (!mat->uv2Name.IsEmpty() && strcmp(mat->uv2Name.ReadPtr(), attribs.layer[i].name) == 0)
 					ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_UV2, attribs.layer[i].glindex);
 				else
 					ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_UV1, attribs.layer[i].glindex);
 			}
-			else if(attribs.layer[i].type == CD_TANGENT)
+			else if (attribs.layer[i].type == CD_TANGENT)
 				ras->SetAttrib(RAS_IRasterizer::RAS_TEXTANGENT, attribs.layer[i].glindex);
-			else if(attribs.layer[i].type == CD_ORCO)
+			else if (attribs.layer[i].type == CD_ORCO)
 				ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_ORCO, attribs.layer[i].glindex);
-			else if(attribs.layer[i].type == CD_NORMAL)
+			else if (attribs.layer[i].type == CD_NORMAL)
 				ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_NORM, attribs.layer[i].glindex);
-			else if(attribs.layer[i].type == CD_MCOL)
+			else if (attribs.layer[i].type == CD_MCOL)
 				ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_VCOL, attribs.layer[i].glindex);
 			else
 				ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_DISABLE, attribs.layer[i].glindex);
@@ -129,7 +129,7 @@ void BL_BlenderShader::Update(const RAS_MeshSlot & ms, RAS_IRasterizer* rasty )
 
 	gpumat = mGPUMat;
 
-	if(!gpumat || !GPU_material_bound(gpumat))
+	if (!gpumat || !GPU_material_bound(gpumat))
 		return;
 
 	MT_Matrix4x4 model;
@@ -142,7 +142,7 @@ void BL_BlenderShader::Update(const RAS_MeshSlot & ms, RAS_IRasterizer* rasty )
 	view.getValue((float*)viewmat);
 	viewinv.getValue((float*)viewinvmat);
 
-	if(ms.m_bObjectColor)
+	if (ms.m_bObjectColor)
 		ms.m_RGBAcolor.getValue((float*)obcol);
 	else
 		obcol[0]= obcol[1]= obcol[2]= obcol[3]= 1.0f;
diff --git a/source/gameengine/Ketsji/BL_BlenderShader.h b/source/gameengine/Ketsji/BL_BlenderShader.h
index 1331899..d309b12 100644
--- a/source/gameengine/Ketsji/BL_BlenderShader.h
+++ b/source/gameengine/Ketsji/BL_BlenderShader.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __BL_GPUSHADER_H__
-#define __BL_GPUSHADER_H__
+#ifndef __BL_BLENDERSHADER_H__
+#define __BL_BLENDERSHADER_H__
 
 #include "GPU_material.h"
 
@@ -103,4 +103,4 @@ public:
 #endif
 };
 
-#endif//__BL_GPUSHADER_H__
+#endif//__BL_BLENDERSHADER_H__
diff --git a/source/gameengine/Ketsji/BL_Material.cpp b/source/gameengine/Ketsji/BL_Material.cpp
index 092f927..4c75187 100644
--- a/source/gameengine/Ketsji/BL_Material.cpp
+++ b/source/gameengine/Ketsji/BL_Material.cpp
@@ -12,9 +12,9 @@
 
 MTex* getImageFromMaterial(Material *mat, int index)
 {
-	if(!mat) return 0;
+	if (!mat) return 0;
 	
-	if(!(index >=0 && index < MAX_MTEX) ) return 0;
+	if (!(index >=0 && index < MAX_MTEX) ) return 0;
 	
 	MTex *m = mat->mtex[index];
 	return m?m:0;
@@ -23,9 +23,9 @@ MTex* getImageFromMaterial(Material *mat, int index)
 int getNumTexChannels( Material *mat )
 {
 	int count = -1;
-	if(!mat) return -1;
+	if (!mat) return -1;
 
-	for(count =0; (count < 10) && mat->mtex[count] != 0; count++) {}
+	for (count =0; (count < 10) && mat->mtex[count] != 0; count++) {}
 	return count;
 }
 
@@ -58,7 +58,7 @@ void BL_Material::Initialize()
 	alpha = 1.f;
 	emit = 0.f;
 	material = 0;
-	tface = 0;
+	memset(&tface, 0, sizeof(tface));
 	materialindex = 0;
 	amb=0.5f;
 	num_enabled = 0;
@@ -66,13 +66,13 @@ void BL_Material::Initialize()
 	share = false;
 
 	int i;
-	for(i=0; i<4; 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++) // :(
+	for (i=0; i<MAXTEX; i++) // :(
 	{
 		mapping[i].mapping = 0;
 		mapping[i].offsets[0] = 0.f;
@@ -150,7 +150,7 @@ void BL_Material::GetConversionUV2(MT_Point2 *nuv)
 
 void BL_Material::SetSharedMaterial(bool v)
 {
-	if((v && num_users == -1) || num_users > 1 )
+	if ((v && num_users == -1) || num_users > 1 )
 		share = true;
 	else 
 		share = false;
diff --git a/source/gameengine/Ketsji/BL_Material.h b/source/gameengine/Ketsji/BL_Material.h
index 2c6316e..70fd640 100644
--- a/source/gameengine/Ketsji/BL_Material.h
+++ b/source/gameengine/Ketsji/BL_Material.h
@@ -8,6 +8,7 @@
 
 #include "STR_String.h"
 #include "MT_Point2.h"
+#include "DNA_meshdata_types.h"
 
 #ifdef WITH_CXX_GUARDEDALLOC
 #include "MEM_guardedalloc.h"
@@ -24,11 +25,11 @@ struct EnvMap;
 // --
 
 /** max units
-	this will default to users available units
-	to build with more available, just increment this value
-	although the more you add the slower the search time will be.
-	we will go for eight, which should be enough
-*/
+ * this will default to users available units
+ * to build with more available, just increment this value
+ * although the more you add the slower the search time will be.
+ * we will go for eight, which should be enough
+ */
 #define MAXTEX			8	//match in RAS_TexVert & RAS_OpenGLRasterizer
 
 // different mapping modes
@@ -83,7 +84,7 @@ public:
 
 
 	Material*			material;
-	MTFace*				tface;
+	MTFace				tface; /* copy of the derived meshes tface */
 	Image*				img[MAXTEX];
 	EnvMap*				cubemap[MAXTEX];
 
diff --git a/source/gameengine/Ketsji/BL_Shader.cpp b/source/gameengine/Ketsji/BL_Shader.cpp
index b1e3737..9885411 100644
--- a/source/gameengine/Ketsji/BL_Shader.cpp
+++ b/source/gameengine/Ketsji/BL_Shader.cpp
@@ -40,7 +40,7 @@ BL_Uniform::BL_Uniform(int data_size)
 BL_Uniform::~BL_Uniform()
 {
 #ifdef SORT_UNIFORMS
-	if(mData) {
+	if (mData) {
 		MEM_freeN(mData);
 		mData=0;
 	}
@@ -52,7 +52,7 @@ 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)
@@ -136,15 +136,15 @@ BL_Shader::BL_Shader()
 
 BL_Shader::~BL_Shader()
 {
-	//for (int i=0; i<MAXTEX; i++){
-	//	if(mSampler[i].mOwn) {
-	//		if(mSampler[i].mTexture)
+	//for (int i=0; i<MAXTEX; i++) {
+	//	if (mSampler[i].mOwn) {
+	//		if (mSampler[i].mTexture)
 	//			mSampler[i].mTexture->DeleteTex();
 	//	}
 	//}
 	ClearUniforms();
 
-	if( mShader ) {
+	if ( mShader ) {
 		glDeleteObjectARB(mShader);
 		mShader = 0;
 	}
@@ -157,7 +157,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++;
 	}
@@ -179,7 +179,7 @@ BL_Uniform  *BL_Shader::FindUniform(const int location)
 #ifdef SORT_UNIFORMS
 	BL_UniformVec::iterator it = mUniforms.begin();
 	while(it != mUniforms.end()) {
-		if((*it)->GetLocation() == location)
+		if ((*it)->GetLocation() == location)
 			return (*it);
 		it++;
 	}
@@ -191,7 +191,7 @@ void BL_Shader::SetUniformfv(int location, int type, float *param,int size, bool
 {
 #ifdef SORT_UNIFORMS
 	BL_Uniform *uni= FindUniform(location);
-	if(uni) {
+	if (uni) {
 		memcpy(uni->getData(), param, size);
 		uni->SetData(location, type, transpose);
 	}
@@ -210,7 +210,7 @@ void BL_Shader::SetUniformiv(int location, int type, int *param,int size, bool t
 {
 #ifdef SORT_UNIFORMS
 	BL_Uniform *uni= FindUniform(location);
-	if(uni) {
+	if (uni) {
 		memcpy(uni->getData(), param, size);
 		uni->SetData(location, type, transpose);
 	}
@@ -228,10 +228,10 @@ void BL_Shader::SetUniformiv(int location, int type, int *param,int size, bool t
 void BL_Shader::ApplyShader()
 {
 #ifdef SORT_UNIFORMS
-	if(!mDirty) 
+	if (!mDirty) 
 		return;
 
-	for(unsigned int i=0; i<mUniforms.size(); i++)
+	for (unsigned int i=0; i<mUniforms.size(); i++)
 		mUniforms[i]->Apply(this);
 
 	mDirty = false;
@@ -252,18 +252,18 @@ bool BL_Shader::LinkProgram()
 	int char_len=0;
 	char *logInf =0;
 
-	if(mError)
+	if (mError)
 		goto programError;
 
-	if(!vertProg || !fragProg){
+	if (!vertProg || !fragProg) {
 		spit("Invalid GLSL sources");
 		return false;
 	}
-	if( !GLEW_ARB_fragment_shader) {
+	if ( !GLEW_ARB_fragment_shader) {
 		spit("Fragment shaders not supported");
 		return false;
 	}
-	if( !GLEW_ARB_vertex_shader) {
+	if ( !GLEW_ARB_vertex_shader) {
 		spit("Vertex shaders not supported");
 		return false;
 	}
@@ -275,10 +275,10 @@ bool BL_Shader::LinkProgram()
 	glGetObjectParameterivARB(tmpVert, GL_OBJECT_INFO_LOG_LENGTH_ARB,(GLint*) &vertlen);
 	
 	// print info if any
-	if( vertlen > 0 && vertlen < MAX_LOG_LEN){
+	if ( vertlen > 0 && vertlen < MAX_LOG_LEN) {
 		logInf = (char*)MEM_mallocN(vertlen, "vert-log");
 		glGetInfoLogARB(tmpVert, vertlen, (GLsizei*)&char_len, logInf);
-		if(char_len >0) {
+		if (char_len >0) {
 			spit("---- Vertex Shader Error ----");
 			spit(logInf);
 		}
@@ -287,7 +287,7 @@ bool BL_Shader::LinkProgram()
 	}
 	// check for compile errors
 	glGetObjectParameterivARB(tmpVert, GL_OBJECT_COMPILE_STATUS_ARB,(GLint*)&vertstatus);
-	if(!vertstatus) {
+	if (!vertstatus) {
 		spit("---- Vertex shader failed to compile ----");
 		goto programError;
 	}
@@ -297,10 +297,10 @@ bool BL_Shader::LinkProgram()
 	glShaderSourceARB(tmpFrag, 1,(const char**)&fragProg, 0);
 	glCompileShaderARB(tmpFrag);
 	glGetObjectParameterivARB(tmpFrag, GL_OBJECT_INFO_LOG_LENGTH_ARB, (GLint*) &fraglen);
-	if(fraglen >0 && fraglen < MAX_LOG_LEN){
+	if (fraglen >0 && fraglen < MAX_LOG_LEN) {
 		logInf = (char*)MEM_mallocN(fraglen, "frag-log");
 		glGetInfoLogARB(tmpFrag, fraglen,(GLsizei*) &char_len, logInf);
-		if(char_len >0) {
+		if (char_len >0) {
 			spit("---- Fragment Shader Error ----");
 			spit(logInf);
 		}
@@ -309,7 +309,7 @@ bool BL_Shader::LinkProgram()
 	}
 
 	glGetObjectParameterivARB(tmpFrag, GL_OBJECT_COMPILE_STATUS_ARB, (GLint*) &fragstatus);
-	if(!fragstatus){
+	if (!fragstatus) {
 		spit("---- Fragment shader failed to compile ----");
 		goto programError;
 	}
@@ -325,10 +325,10 @@ bool BL_Shader::LinkProgram()
 	glGetObjectParameterivARB(tmpProg, GL_OBJECT_LINK_STATUS_ARB, (GLint*) &progstatus);
 	
 
-	if(proglen > 0 && proglen < MAX_LOG_LEN) {
+	if (proglen > 0 && proglen < MAX_LOG_LEN) {
 		logInf = (char*)MEM_mallocN(proglen, "prog-log");
 		glGetInfoLogARB(tmpProg, proglen, (GLsizei*)&char_len, logInf);
-		if(char_len >0) {
+		if (char_len >0) {
 			spit("---- GLSL Program ----");
 			spit(logInf);
 		}
@@ -336,7 +336,7 @@ bool BL_Shader::LinkProgram()
 		logInf=0;
 	}
 
-	if(!progstatus){
+	if (!progstatus) {
 		spit("---- GLSL program failed to link ----");
 		goto programError;
 	}
@@ -350,16 +350,16 @@ bool BL_Shader::LinkProgram()
 	return true;
 
 programError:
-	if(tmpVert) {
+	if (tmpVert) {
 		glDeleteObjectARB(tmpVert);
 		tmpVert=0;
 	}
-	if(tmpFrag) {
+	if (tmpFrag) {
 		glDeleteObjectARB(tmpFrag);
 		tmpFrag=0;
 	}
 
-	if(tmpProg) {
+	if (tmpProg) {
 		glDeleteObjectARB(tmpProg);
 		tmpProg=0;
 	}
@@ -403,7 +403,7 @@ unsigned int BL_Shader::GetProg()
 
 void BL_Shader::SetSampler(int loc, int unit)
 {
-	if( GLEW_ARB_fragment_shader &&
+	if ( GLEW_ARB_fragment_shader &&
 		GLEW_ARB_vertex_shader &&
 		GLEW_ARB_shader_objects 
 		)
@@ -422,12 +422,12 @@ void BL_Shader::SetSampler(int loc, int unit)
 
 void BL_Shader::SetProg(bool enable)
 {
-	if( GLEW_ARB_fragment_shader &&
+	if ( GLEW_ARB_fragment_shader &&
 		GLEW_ARB_vertex_shader &&
 		GLEW_ARB_shader_objects 
 		)
 	{
-		if(	mShader != 0 && mOk && enable) {
+		if (	mShader != 0 && mOk && enable) {
 			glUseProgramObjectARB(mShader);
 		}
 		else {
@@ -438,10 +438,10 @@ void BL_Shader::SetProg(bool enable)
 
 void BL_Shader::Update( const RAS_MeshSlot & ms, RAS_IRasterizer* rasty )
 {
-	if(!Ok() || !mPreDef.size()) 
+	if (!Ok() || !mPreDef.size()) 
 		return;
 
-	if( GLEW_ARB_fragment_shader &&
+	if ( GLEW_ARB_fragment_shader &&
 		GLEW_ARB_vertex_shader &&
 		GLEW_ARB_shader_objects 
 		)
@@ -450,14 +450,14 @@ void BL_Shader::Update( const RAS_MeshSlot & ms, RAS_IRasterizer* rasty )
 		model.setValue(ms.m_OpenGLMatrix);
 		const MT_Matrix4x4& view = rasty->GetViewMatrix();
 
-		if(mAttr==SHD_TANGENT)
+		if (mAttr==SHD_TANGENT)
 			ms.m_mesh->SetMeshModified(true);
 
 		BL_UniformVecDef::iterator it;
-		for(it = mPreDef.begin(); it!= mPreDef.end(); it++)
+		for (it = mPreDef.begin(); it!= mPreDef.end(); it++)
 		{
 			BL_DefUniform *uni = (*it);
-			if(uni->mLoc == -1) continue;
+			if (uni->mLoc == -1) continue;
 
 			switch (uni->mType)
 			{
@@ -554,7 +554,7 @@ void BL_Shader::Update( const RAS_MeshSlot & ms, RAS_IRasterizer* rasty )
 
 int BL_Shader::GetAttribLocation(const STR_String& name)
 {
-	if( GLEW_ARB_fragment_shader &&
+	if ( GLEW_ARB_fragment_shader &&
 		GLEW_ARB_vertex_shader &&
 		GLEW_ARB_shader_objects 
 		)
@@ -567,7 +567,7 @@ int BL_Shader::GetAttribLocation(const STR_String& name)
 
 void BL_Shader::BindAttribute(const STR_String& attr, int loc)
 {
-	if( GLEW_ARB_fragment_shader &&
+	if ( GLEW_ARB_fragment_shader &&
 		GLEW_ARB_vertex_shader &&
 		GLEW_ARB_shader_objects 
 		)
@@ -578,14 +578,14 @@ void BL_Shader::BindAttribute(const STR_String& attr, int loc)
 
 int BL_Shader::GetUniformLocation(const STR_String& name)
 {
-	if( GLEW_ARB_fragment_shader &&
+	if ( GLEW_ARB_fragment_shader &&
 		GLEW_ARB_vertex_shader &&
 		GLEW_ARB_shader_objects 
 		)
 	{
 		MT_assert(mShader!=0);
 		int location = glGetUniformLocationARB(mShader, name.ReadPtr());
-		if(location == -1)
+		if (location == -1)
 			spit("Invalid uniform value: " << name.ReadPtr() << ".");
 		return location;
 	}
@@ -595,7 +595,7 @@ int BL_Shader::GetUniformLocation(const STR_String& name)
 
 void BL_Shader::SetUniform(int uniform, const MT_Tuple2& vec)
 {
-	if( GLEW_ARB_fragment_shader &&
+	if ( GLEW_ARB_fragment_shader &&
 		GLEW_ARB_vertex_shader &&
 		GLEW_ARB_shader_objects 
 		)
@@ -609,7 +609,7 @@ void BL_Shader::SetUniform(int uniform, const MT_Tuple2& vec)
 
 void BL_Shader::SetUniform(int uniform, const MT_Tuple3& vec)
 {
-	if( GLEW_ARB_fragment_shader &&
+	if ( GLEW_ARB_fragment_shader &&
 		GLEW_ARB_vertex_shader &&
 		GLEW_ARB_shader_objects 
 		)
@@ -622,7 +622,7 @@ void BL_Shader::SetUniform(int uniform, const MT_Tuple3& vec)
 
 void BL_Shader::SetUniform(int uniform, const MT_Tuple4& vec)
 {
-	if( GLEW_ARB_fragment_shader &&
+	if ( GLEW_ARB_fragment_shader &&
 		GLEW_ARB_vertex_shader &&
 		GLEW_ARB_shader_objects 
 		)
@@ -635,7 +635,7 @@ void BL_Shader::SetUniform(int uniform, const MT_Tuple4& vec)
 
 void BL_Shader::SetUniform(int uniform, const unsigned int& val)
 {
-	if( GLEW_ARB_fragment_shader &&
+	if ( GLEW_ARB_fragment_shader &&
 		GLEW_ARB_vertex_shader &&
 		GLEW_ARB_shader_objects 
 		)
@@ -646,7 +646,7 @@ void BL_Shader::SetUniform(int uniform, const unsigned int& val)
 
 void BL_Shader::SetUniform(int uniform, const int val)
 {
-	if( GLEW_ARB_fragment_shader &&
+	if ( GLEW_ARB_fragment_shader &&
 		GLEW_ARB_vertex_shader &&
 		GLEW_ARB_shader_objects 
 		)
@@ -657,7 +657,7 @@ void BL_Shader::SetUniform(int uniform, const int val)
 
 void BL_Shader::SetUniform(int uniform, const float& val)
 {
-	if( GLEW_ARB_fragment_shader &&
+	if ( GLEW_ARB_fragment_shader &&
 		GLEW_ARB_vertex_shader &&
 		GLEW_ARB_shader_objects 
 		)
@@ -668,7 +668,7 @@ void BL_Shader::SetUniform(int uniform, const float& val)
 
 void BL_Shader::SetUniform(int uniform, const MT_Matrix4x4& vec, bool transpose)
 {
-	if( GLEW_ARB_fragment_shader &&
+	if ( GLEW_ARB_fragment_shader &&
 		GLEW_ARB_vertex_shader &&
 		GLEW_ARB_shader_objects 
 		)
@@ -682,7 +682,7 @@ void BL_Shader::SetUniform(int uniform, const MT_Matrix4x4& vec, bool transpose)
 
 void BL_Shader::SetUniform(int uniform, const MT_Matrix3x3& vec, bool transpose)
 {
-	if( GLEW_ARB_fragment_shader &&
+	if ( GLEW_ARB_fragment_shader &&
 		GLEW_ARB_vertex_shader &&
 		GLEW_ARB_shader_objects 
 		)
@@ -697,12 +697,12 @@ void BL_Shader::SetUniform(int uniform, const MT_Matrix3x3& vec, bool transpose)
 
 void BL_Shader::SetUniform(int uniform, const float* val, int len)
 {
-	if( GLEW_ARB_fragment_shader &&
+	if ( GLEW_ARB_fragment_shader &&
 		GLEW_ARB_vertex_shader &&
 		GLEW_ARB_shader_objects 
 		)
 	{
-		if(len == 2) 
+		if (len == 2) 
 			glUniform2fvARB(uniform, 1,(GLfloat*)val);
 		else if (len == 3)
 			glUniform3fvARB(uniform, 1,(GLfloat*)val);
@@ -715,12 +715,12 @@ void BL_Shader::SetUniform(int uniform, const float* val, int len)
 
 void BL_Shader::SetUniform(int uniform, const int* val, int len)
 {
-	if( GLEW_ARB_fragment_shader &&
+	if ( GLEW_ARB_fragment_shader &&
 		GLEW_ARB_vertex_shader &&
 		GLEW_ARB_shader_objects 
 		)
 	{
-		if(len == 2) 
+		if (len == 2) 
 			glUniform2ivARB(uniform, 1, (GLint*)val);
 		else if (len == 3)
 			glUniform3ivARB(uniform, 1, (GLint*)val);
@@ -793,18 +793,18 @@ PyTypeObject BL_Shader::Type = {
 
 KX_PYMETHODDEF_DOC( BL_Shader, setSource," setSource(vertexProgram, fragmentProgram)" )
 {
-	if(mShader !=0 && mOk  )
+	if (mShader !=0 && mOk  )
 	{
 		// already set...
 		Py_RETURN_NONE;
 	}
 	char *v,*f;
 	int apply=0;
-	if( PyArg_ParseTuple(args, "ssi:setSource", &v, &f, &apply) )
+	if ( PyArg_ParseTuple(args, "ssi:setSource", &v, &f, &apply) )
 	{
 		vertProg = v;
 		fragProg = f;
-		if( LinkProgram() ) {
+		if ( LinkProgram() ) {
 			glUseProgramObjectARB( mShader );
 			mUse = apply!=0;
 			Py_RETURN_NONE;
@@ -847,10 +847,10 @@ KX_PYMETHODDEF_DOC( BL_Shader, getFragmentProg ,"getFragmentProg( )" )
 
 KX_PYMETHODDEF_DOC( BL_Shader, validate, "validate()")
 {
-	if(mError) {
+	if (mError) {
 		Py_RETURN_NONE;
 	}
-	if(mShader==0) {
+	if (mShader==0) {
 		PyErr_SetString(PyExc_TypeError, "shader.validate(): BL_Shader, invalid shader object");
 		return NULL;
 	}
@@ -859,12 +859,12 @@ KX_PYMETHODDEF_DOC( BL_Shader, validate, "validate()")
 	glGetObjectParameterivARB(mShader, GL_OBJECT_VALIDATE_STATUS_ARB,(GLint*) &stat);
 
 
-	if(stat > 0 && stat < MAX_LOG_LEN) {
+	if (stat > 0 && stat < MAX_LOG_LEN) {
 		int char_len=0;
 		char *logInf = (char*)MEM_mallocN(stat, "validate-log");
 
 		glGetInfoLogARB(mShader, stat,(GLsizei*) &char_len, logInf);
-		if(char_len >0) {
+		if (char_len >0) {
 			spit("---- GLSL Validation ----");
 			spit(logInf);
 		}
@@ -877,17 +877,17 @@ KX_PYMETHODDEF_DOC( BL_Shader, validate, "validate()")
 
 KX_PYMETHODDEF_DOC( BL_Shader, setSampler, "setSampler(name, index)" )
 {
-	if(mError) {
+	if (mError) {
 		Py_RETURN_NONE;
 	}
 
 	const char *uniform="";
 	int index=-1;
-	if(PyArg_ParseTuple(args, "si:setSampler", &uniform, &index)) 
+	if (PyArg_ParseTuple(args, "si:setSampler", &uniform, &index)) 
 	{
 		int loc = GetUniformLocation(uniform);
-		if(loc != -1) {
-			if(index >= MAXTEX || index < 0)
+		if (loc != -1) {
+			if (index >= MAXTEX || index < 0)
 				spit("Invalid texture sample index: " << index);
 
 #ifdef SORT_UNIFORMS
@@ -895,7 +895,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setSampler, "setSampler(name, index)" )
 #else
 			SetUniform(loc, index);
 #endif
-			//if(index <= MAXTEX)
+			//if (index <= MAXTEX)
 			//	mSampler[index].mLoc = loc;
 			//else
 			//	spit("Invalid texture sample index: " << index);
@@ -908,7 +908,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setSampler, "setSampler(name, index)" )
 KX_PYMETHODDEF_DOC( BL_Shader, setNumberOfPasses, "setNumberOfPasses( max-pass )" )
 {
 	int pass = 1;
-	if(!PyArg_ParseTuple(args, "i:setNumberOfPasses", &pass))
+	if (!PyArg_ParseTuple(args, "i:setNumberOfPasses", &pass))
 		return NULL;
 
 	mPass = 1;
@@ -918,16 +918,16 @@ KX_PYMETHODDEF_DOC( BL_Shader, setNumberOfPasses, "setNumberOfPasses( max-pass )
 /// access functions
 KX_PYMETHODDEF_DOC( BL_Shader, setUniform1f, "setUniform1f(name, fx)" )
 {
-	if(mError) {
+	if (mError) {
 		Py_RETURN_NONE;
 	}
 
 	const char *uniform="";
 	float value=0;
-	if(PyArg_ParseTuple(args, "sf:setUniform1f", &uniform, &value ))
+	if (PyArg_ParseTuple(args, "sf:setUniform1f", &uniform, &value ))
 	{
 		int loc = GetUniformLocation(uniform);
-		if(loc != -1)
+		if (loc != -1)
 		{
 #ifdef SORT_UNIFORMS
 			SetUniformfv(loc, BL_Uniform::UNI_FLOAT, &value, sizeof(float));
@@ -943,15 +943,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform1f, "setUniform1f(name, fx)" )
 
 KX_PYMETHODDEF_DOC( BL_Shader, setUniform2f , "setUniform2f(name, fx, fy)")
 {
-	if(mError) {
+	if (mError) {
 		Py_RETURN_NONE;
 	}
 	const char *uniform="";
 	float array[2]={ 0,0 };
-	if(PyArg_ParseTuple(args, "sff:setUniform2f", &uniform, &array[0],&array[1] ))
+	if (PyArg_ParseTuple(args, "sff:setUniform2f", &uniform, &array[0],&array[1] ))
 	{
 		int loc = GetUniformLocation(uniform);
-		if(loc != -1)
+		if (loc != -1)
 		{
 #ifdef SORT_UNIFORMS
 			SetUniformfv(loc, BL_Uniform::UNI_FLOAT2, array, (sizeof(float)*2) );
@@ -967,15 +967,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform2f , "setUniform2f(name, fx, fy)")
 
 KX_PYMETHODDEF_DOC( BL_Shader, setUniform3f, "setUniform3f(name, fx,fy,fz) ")
 {
-	if(mError) {
+	if (mError) {
 		Py_RETURN_NONE;
 	}
 	const char *uniform="";
 	float array[3]={0,0,0};
-	if(PyArg_ParseTuple(args, "sfff:setUniform3f", &uniform, &array[0],&array[1],&array[2]))
+	if (PyArg_ParseTuple(args, "sfff:setUniform3f", &uniform, &array[0],&array[1],&array[2]))
 	{
 		int loc = GetUniformLocation(uniform);
-		if(loc != -1)
+		if (loc != -1)
 		{
 #ifdef SORT_UNIFORMS
 			SetUniformfv(loc, BL_Uniform::UNI_FLOAT3, array, (sizeof(float)*3) );
@@ -992,15 +992,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform3f, "setUniform3f(name, fx,fy,fz) ")
 
 KX_PYMETHODDEF_DOC( BL_Shader, setUniform4f, "setUniform4f(name, fx,fy,fz, fw) ")
 {
-	if(mError) {
+	if (mError) {
 		Py_RETURN_NONE;
 	}
 	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]))
+	if (PyArg_ParseTuple(args, "sffff:setUniform4f", &uniform, &array[0],&array[1],&array[2], &array[3]))
 	{
 		int loc = GetUniformLocation(uniform);
-		if(loc != -1)
+		if (loc != -1)
 		{
 #ifdef SORT_UNIFORMS
 			SetUniformfv(loc, BL_Uniform::UNI_FLOAT4, array, (sizeof(float)*4) );
@@ -1016,15 +1016,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform4f, "setUniform4f(name, fx,fy,fz, fw) "
 
 KX_PYMETHODDEF_DOC( BL_Shader, setUniform1i, "setUniform1i(name, ix)" )
 {
-	if(mError) {
+	if (mError) {
 		Py_RETURN_NONE;
 	}
 	const char *uniform="";
 	int value=0;
-	if(PyArg_ParseTuple(args, "si:setUniform1i", &uniform, &value ))
+	if (PyArg_ParseTuple(args, "si:setUniform1i", &uniform, &value ))
 	{
 		int loc = GetUniformLocation(uniform);
-		if(loc != -1)
+		if (loc != -1)
 		{
 #ifdef SORT_UNIFORMS
 			SetUniformiv(loc, BL_Uniform::UNI_INT, &value, sizeof(int));
@@ -1040,15 +1040,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform1i, "setUniform1i(name, ix)" )
 
 KX_PYMETHODDEF_DOC( BL_Shader, setUniform2i , "setUniform2i(name, ix, iy)")
 {
-	if(mError) {
+	if (mError) {
 		Py_RETURN_NONE;
 	}
 	const char *uniform="";
 	int array[2]={ 0,0 };
-	if(PyArg_ParseTuple(args, "sii:setUniform2i", &uniform, &array[0],&array[1] ))
+	if (PyArg_ParseTuple(args, "sii:setUniform2i", &uniform, &array[0],&array[1] ))
 	{
 		int loc = GetUniformLocation(uniform);
-		if(loc != -1)
+		if (loc != -1)
 		{
 #ifdef SORT_UNIFORMS
 			SetUniformiv(loc, BL_Uniform::UNI_INT2, array, sizeof(int)*2);
@@ -1064,16 +1064,16 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform2i , "setUniform2i(name, ix, iy)")
 
 KX_PYMETHODDEF_DOC( BL_Shader, setUniform3i, "setUniform3i(name, ix,iy,iz) ")
 {
-	if(mError) {
+	if (mError) {
 		Py_RETURN_NONE;
 	}
 
 	const char *uniform="";
 	int array[3]={0,0,0};
-	if(PyArg_ParseTuple(args, "siii:setUniform3i", &uniform, &array[0],&array[1],&array[2]))
+	if (PyArg_ParseTuple(args, "siii:setUniform3i", &uniform, &array[0],&array[1],&array[2]))
 	{
 		int loc = GetUniformLocation(uniform);
-		if(loc != -1)
+		if (loc != -1)
 		{
 #ifdef SORT_UNIFORMS
 			SetUniformiv(loc, BL_Uniform::UNI_INT3, array, sizeof(int)*3);
@@ -1088,15 +1088,15 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform3i, "setUniform3i(name, ix,iy,iz) ")
 
 KX_PYMETHODDEF_DOC( BL_Shader, setUniform4i, "setUniform4i(name, ix,iy,iz, iw) ")
 {
-	if(mError) {
+	if (mError) {
 		Py_RETURN_NONE;
 	}
 	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] ))
+	if (PyArg_ParseTuple(args, "siiii:setUniform4i", &uniform, &array[0],&array[1],&array[2], &array[3] ))
 	{
 		int loc = GetUniformLocation(uniform);
-		if(loc != -1)
+		if (loc != -1)
 		{
 #ifdef SORT_UNIFORMS
 			SetUniformiv(loc, BL_Uniform::UNI_INT4, array, sizeof(int)*4);
@@ -1111,23 +1111,23 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniform4i, "setUniform4i(name, ix,iy,iz, iw) "
 
 KX_PYMETHODDEF_DOC( BL_Shader, setUniformfv , "setUniformfv( float (list2 or list3 or list4) )")
 {
-	if(mError) {
+	if (mError) {
 		Py_RETURN_NONE;
 	}
 	const char *uniform = "";
 	PyObject *listPtr =0;
 	float array_data[4] = {0.f,0.f,0.f,0.f};
 
-	if(PyArg_ParseTuple(args, "sO:setUniformfv", &uniform, &listPtr))
+	if (PyArg_ParseTuple(args, "sO:setUniformfv", &uniform, &listPtr))
 	{
 		int loc = GetUniformLocation(uniform);
-		if(loc != -1)
+		if (loc != -1)
 		{
-			if(PySequence_Check(listPtr))
+			if (PySequence_Check(listPtr))
 			{
 				unsigned int list_size = PySequence_Size(listPtr);
 				
-				for(unsigned int i=0; (i<list_size && i<4); i++)
+				for (unsigned int i=0; (i<list_size && i<4); i++)
 				{
 					PyObject *item = PySequence_GetItem(listPtr, i);
 					array_data[i] = (float)PyFloat_AsDouble(item);
@@ -1180,38 +1180,38 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformfv , "setUniformfv( float (list2 or lis
 
 KX_PYMETHODDEF_DOC( BL_Shader, setUniformiv, "setUniformiv( uniform_name, (list2 or list3 or list4) )")
 {
-	if(mError) {
+	if (mError) {
 		Py_RETURN_NONE;
 	}
 	const char *uniform = "";
 	PyObject *listPtr =0;
 	int array_data[4] = {0,0,0,0};
 
-	if(!PyArg_ParseTuple(args, "sO:setUniformiv", &uniform, &listPtr))
+	if (!PyArg_ParseTuple(args, "sO:setUniformiv", &uniform, &listPtr))
 		return NULL;
 	
 	int loc = GetUniformLocation(uniform);
 	
-	if(loc == -1) {
+	if (loc == -1) {
 		PyErr_SetString(PyExc_TypeError, "shader.setUniformiv(...): BL_Shader, first string argument is not a valid uniform value");
 		return NULL;
 	}
 	
-	if(!PySequence_Check(listPtr)) {
+	if (!PySequence_Check(listPtr)) {
 		PyErr_SetString(PyExc_TypeError, "shader.setUniformiv(...): BL_Shader, second argument is not a sequence");
 		return NULL;
 	}
 	
 	unsigned int list_size = PySequence_Size(listPtr);
 	
-	for(unsigned int i=0; (i<list_size && i<4); i++)
+	for (unsigned int i=0; (i<list_size && i<4); i++)
 	{
 		PyObject *item = PySequence_GetItem(listPtr, i);
 		array_data[i] = PyLong_AsSsize_t(item);
 		Py_DECREF(item);
 	}
 	
-	if(PyErr_Occurred()) {
+	if (PyErr_Occurred()) {
 		PyErr_SetString(PyExc_TypeError, "shader.setUniformiv(...): BL_Shader, one or more values in the list is not an int");
 		return NULL;
 	}
@@ -1266,7 +1266,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformiv, "setUniformiv( uniform_name, (list2
 KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix4, 
 "setUniformMatrix4(uniform_name, mat-4x4, transpose(row-major=true, col-major=false)" )
 {
-	if(mError) {
+	if (mError) {
 		Py_RETURN_NONE;
 	}
 
@@ -1281,12 +1281,12 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix4,
 	PyObject *matrix=0;
 	int transp=0; // python use column major by default, so no transpose....
 	
-	if(!PyArg_ParseTuple(args, "sO|i:setUniformMatrix4",&uniform, &matrix,&transp))
+	if (!PyArg_ParseTuple(args, "sO|i:setUniformMatrix4",&uniform, &matrix,&transp))
 		return NULL;
 
 	int loc = GetUniformLocation(uniform);
 	
-	if(loc == -1) {
+	if (loc == -1) {
 		PyErr_SetString(PyExc_TypeError, "shader.setUniformMatrix4(...): BL_Shader, first string argument is not a valid uniform value");
 		return NULL;
 	}
@@ -1313,7 +1313,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix4,
 KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix3,
 "setUniformMatrix3(uniform_name, list[3x3], transpose(row-major=true, col-major=false)" )
 {
-	if(mError) {
+	if (mError) {
 		Py_RETURN_NONE;
 	}
 
@@ -1326,12 +1326,12 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix3,
 	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))
+	if (!PyArg_ParseTuple(args, "sO|i:setUniformMatrix3",&uniform, &matrix,&transp))
 		return NULL;
 	
 	int loc = GetUniformLocation(uniform);
 	
-	if(loc == -1) {
+	if (loc == -1) {
 		PyErr_SetString(PyExc_TypeError, "shader.setUniformMatrix3(...): BL_Shader, first string argument is not a valid uniform value");
 		return NULL;
 	}
@@ -1356,18 +1356,18 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformMatrix3,
 
 KX_PYMETHODDEF_DOC( BL_Shader, setAttrib, "setAttrib(enum)" )
 {
-	if(mError) {
+	if (mError) {
 		Py_RETURN_NONE;
 	}
 	
 	int attr=0;
 	
-	if(!PyArg_ParseTuple(args, "i:setAttrib", &attr))
+	if (!PyArg_ParseTuple(args, "i:setAttrib", &attr))
 		return NULL;
 
 	attr= SHD_TANGENT; /* user input is ignored for now, there is only 1 attr */
 
-	if(mShader==0) {
+	if (mShader==0) {
 		PyErr_SetString(PyExc_ValueError, "shader.setAttrib() BL_Shader, invalid shader object");
 		return NULL;
 	}
@@ -1381,27 +1381,27 @@ KX_PYMETHODDEF_DOC( BL_Shader, setAttrib, "setAttrib(enum)" )
 
 KX_PYMETHODDEF_DOC( BL_Shader, setUniformDef, "setUniformDef(name, enum)" )
 {
-	if(mError) {
+	if (mError) {
 		Py_RETURN_NONE;
 	}
 
 	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)
+		if (loc != -1)
 		{
 			bool defined = false;
 			BL_UniformVecDef::iterator it = mPreDef.begin();
 			while(it != mPreDef.end()) {
-				if((*it)->mLoc == loc) {
+				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 3287259..3015dd2 100644
--- a/source/gameengine/Ketsji/BL_Shader.h
+++ b/source/gameengine/Ketsji/BL_Shader.h
@@ -194,7 +194,7 @@ public:
 	bool				Ok()const;
 	unsigned int		GetProg();
 	void				SetProg(bool enable);
-	int					GetAttribute(){return mAttr;};
+	int					GetAttribute() { return mAttr; }
 
 	// -- 
 	// Apply methods : sets colected uniforms
diff --git a/source/gameengine/Ketsji/BL_Texture.cpp b/source/gameengine/Ketsji/BL_Texture.cpp
index 2c57004..576da0d 100644
--- a/source/gameengine/Ketsji/BL_Texture.cpp
+++ b/source/gameengine/Ketsji/BL_Texture.cpp
@@ -79,18 +79,18 @@ BL_Texture::~BL_Texture()
 
 void BL_Texture::DeleteTex()
 {
-	if( mNeedsDeleted ) {
+	if ( mNeedsDeleted ) {
 		glDeleteTextures(1, (GLuint*)&mTexture);
 		mNeedsDeleted = 0;
 		mOk = 0;
 	}
 
-	if(mEnvState) {
+	if (mEnvState) {
 		glDeleteLists((GLuint)mEnvState, 1);
 		mEnvState =0;
 	}
 
-	if(mDisableState) {
+	if (mDisableState) {
 		glDeleteLists((GLuint)mDisableState, 1);
 		mDisableState =0;
 	}
@@ -167,7 +167,7 @@ void BL_Texture::InitGLTex(unsigned int *pix,int x,int y,bool mipmap)
 	}
 
 	glBindTexture(GL_TEXTURE_2D, mTexture );
-	if( mipmap ) {
+	if ( mipmap ) {
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 		gluBuild2DMipmaps( GL_TEXTURE_2D, GL_RGBA, x, y, GL_RGBA, GL_UNSIGNED_BYTE, pix );
@@ -194,7 +194,7 @@ void BL_Texture::InitNonPow2Tex(unsigned int *pix,int x,int y,bool mipmap)
 	gluScaleImage(GL_RGBA, x, y, GL_UNSIGNED_BYTE, pix, nx,ny, GL_UNSIGNED_BYTE, newPixels);
 	glBindTexture(GL_TEXTURE_2D, mTexture );
 
-	if( mipmap ) {
+	if ( mipmap ) {
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 		gluBuild2DMipmaps( GL_TEXTURE_2D, GL_RGBA, nx, ny, GL_RGBA, GL_UNSIGNED_BYTE, newPixels );
@@ -304,7 +304,7 @@ bool BL_Texture::InitCubeMap(int unit,  EnvMap *cubemap)
 	glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
 	glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_S,	 GL_CLAMP_TO_EDGE );
 	glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_T,	 GL_CLAMP_TO_EDGE );
-	if(GLEW_VERSION_1_2)
+	if (GLEW_VERSION_1_2)
 		glTexParameteri( GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_R,	 GL_CLAMP_TO_EDGE );
 
 	if (needs_split)
@@ -346,7 +346,7 @@ int BL_Texture::GetMaxUnits()
 {
 	GLint unit=0;
 
-	if(GLEW_ARB_multitexture) {
+	if (GLEW_ARB_multitexture) {
 		glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &unit);
 		return (MAXTEX>=unit?unit:MAXTEX);
 	}
@@ -356,28 +356,28 @@ int BL_Texture::GetMaxUnits()
 
 void BL_Texture::ActivateFirst()
 {
-	if(GLEW_ARB_multitexture)
+	if (GLEW_ARB_multitexture)
 		glActiveTextureARB(GL_TEXTURE0_ARB);
 }
 
 void BL_Texture::ActivateUnit(int unit)
 {
-	if(GLEW_ARB_multitexture)
-		if(unit <= MAXTEX)
+	if (GLEW_ARB_multitexture)
+		if (unit <= MAXTEX)
 			glActiveTextureARB(GL_TEXTURE0_ARB+unit);
 }
 
 
 void BL_Texture::DisableUnit()
 {
-	if(GLEW_ARB_multitexture)
+	if (GLEW_ARB_multitexture)
 		glActiveTextureARB(GL_TEXTURE0_ARB+mUnit);
 
 	glMatrixMode(GL_TEXTURE);
 	glLoadIdentity();
 	glMatrixMode(GL_MODELVIEW);
 
-	if(GLEW_ARB_texture_cube_map && glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB))
+	if (GLEW_ARB_texture_cube_map && glIsEnabled(GL_TEXTURE_CUBE_MAP_ARB))
 		glDisable(GL_TEXTURE_CUBE_MAP_ARB);
 	else
 	{
@@ -395,8 +395,8 @@ void BL_Texture::DisableUnit()
 
 void BL_Texture::DisableAllTextures()
 {
-	for(int i=0; i<MAXTEX; i++) {
-		if(GLEW_ARB_multitexture)
+	for (int i=0; i<MAXTEX; i++) {
+		if (GLEW_ARB_multitexture)
 			glActiveTextureARB(GL_TEXTURE0_ARB+i);
 
 		glMatrixMode(GL_TEXTURE);
@@ -410,14 +410,14 @@ void BL_Texture::DisableAllTextures()
 		glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
 	}
 
-	if(GLEW_ARB_multitexture)
+	if (GLEW_ARB_multitexture)
 		glActiveTextureARB(GL_TEXTURE0_ARB);
 }
 
 
 void BL_Texture::ActivateTexture()
 {
-	if(GLEW_ARB_multitexture)
+	if (GLEW_ARB_multitexture)
 		glActiveTextureARB(GL_TEXTURE0_ARB+mUnit);
 
 	if (mType == GL_TEXTURE_CUBE_MAP_ARB && GLEW_ARB_texture_cube_map)
@@ -426,7 +426,7 @@ void BL_Texture::ActivateTexture()
 		glEnable(GL_TEXTURE_CUBE_MAP_ARB);
 	}
 	else {
-		if(GLEW_ARB_texture_cube_map )
+		if (GLEW_ARB_texture_cube_map )
 			glDisable(GL_TEXTURE_CUBE_MAP_ARB);
 
 		glBindTexture( GL_TEXTURE_2D, mTexture );	
@@ -437,7 +437,7 @@ void BL_Texture::ActivateTexture()
 void BL_Texture::SetMapping(int mode)
 {
 
-	if(!(mode &USEREFL)) {
+	if (!(mode &USEREFL)) {
 		glDisable(GL_TEXTURE_GEN_S);
 		glDisable(GL_TEXTURE_GEN_T);
 		glDisable(GL_TEXTURE_GEN_R);
@@ -445,7 +445,7 @@ void BL_Texture::SetMapping(int mode)
 		return;
 	}
 
-	if( mType == GL_TEXTURE_CUBE_MAP_ARB && 
+	if ( mType == GL_TEXTURE_CUBE_MAP_ARB && 
 		GLEW_ARB_texture_cube_map &&
 		mode &USEREFL) 
 	{
@@ -474,17 +474,17 @@ void BL_Texture::SetMapping(int mode)
 
 void BL_Texture::setTexEnv(BL_Material *mat, bool modulate)
 {
-	if(modulate || !GLEW_ARB_texture_env_combine){
+	if (modulate || !GLEW_ARB_texture_env_combine) {
 		glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
 		return;
 	}
 
-	if(glIsList(mEnvState))
+	if (glIsList(mEnvState))
 	{
 		glCallList(mEnvState);
 		return;
 	}
-	if(!mEnvState)
+	if (!mEnvState)
 		mEnvState = glGenLists(1);
 
 	glNewList(mEnvState, GL_COMPILE_AND_EXECUTE);
@@ -504,7 +504,7 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate)
 	GLenum op2		= GL_OPERAND2_RGB_ARB;
 
 	// switch to alpha combiners
-	if( mat->flag[mUnit]  &TEXALPHA ) {
+	if ( mat->flag[mUnit]  &TEXALPHA ) {
 		combiner = GL_COMBINE_ALPHA_ARB;
 		source0	= GL_SOURCE0_ALPHA_ARB;
 		source1 = GL_SOURCE1_ALPHA_ARB;
@@ -515,24 +515,24 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate)
 		blend_operand = GL_SRC_ALPHA;
 		blend_operand_prev = GL_SRC_ALPHA;
 		// invert
-		if(mat->flag[mUnit] &TEXNEG) {
+		if (mat->flag[mUnit] &TEXNEG) {
 			blend_operand_prev = GL_ONE_MINUS_SRC_ALPHA;
 			blend_operand = GL_ONE_MINUS_SRC_ALPHA;
 		}
 	}
 	else {
-		if(mat->flag[mUnit] &TEXNEG) {
+		if (mat->flag[mUnit] &TEXNEG) {
 			blend_operand_prev=GL_ONE_MINUS_SRC_COLOR;
 			blend_operand = GL_ONE_MINUS_SRC_COLOR;
 		}
 	}
 	bool using_alpha = false;
 
-	if(mat->flag[mUnit]  &USEALPHA){
+	if (mat->flag[mUnit]  &USEALPHA) {
 		alphaOp = GL_ONE_MINUS_SRC_ALPHA;
 		using_alpha=true;
 	}
-	else if(mat->flag[mUnit]  &USENEGALPHA){
+	else if (mat->flag[mUnit]  &USENEGALPHA) {
 		alphaOp = GL_SRC_ALPHA;
 		using_alpha = true;
 	}
@@ -541,7 +541,7 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate)
 		case BLEND_MIX:
 			{
 				// ------------------------------
-				if(!using_alpha) {
+				if (!using_alpha) {
 					GLfloat base_col[4];
 					base_col[0]	 = base_col[1]  = base_col[2]  = 0.f;
 					base_col[3]	 = 1.f-mat->color_blend[mUnit];
@@ -552,7 +552,7 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate)
 				glTexEnvf(	GL_TEXTURE_ENV, op0,		blend_operand_prev );
 				glTexEnvf(	GL_TEXTURE_ENV, source1,	GL_TEXTURE );
 				glTexEnvf(	GL_TEXTURE_ENV, op1,		blend_operand);
-				if(!using_alpha)
+				if (!using_alpha)
 					glTexEnvf(	GL_TEXTURE_ENV, source2,	GL_CONSTANT_ARB );
 				else
 					glTexEnvf(	GL_TEXTURE_ENV, source2,	GL_TEXTURE );
@@ -566,7 +566,7 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate)
 				glTexEnvf(	GL_TEXTURE_ENV, source0,	GL_PREVIOUS_ARB);
 				glTexEnvf(	GL_TEXTURE_ENV, op0,		blend_operand_prev);
 				glTexEnvf(	GL_TEXTURE_ENV, source1,	GL_TEXTURE );
-				if(using_alpha)
+				if (using_alpha)
 					glTexEnvf(	GL_TEXTURE_ENV, op1,		alphaOp);
 				else
 					glTexEnvf(	GL_TEXTURE_ENV, op1,		blend_operand);
@@ -578,7 +578,7 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate)
 				glTexEnvf(	GL_TEXTURE_ENV, source0,	GL_PREVIOUS_ARB );
 				glTexEnvf(	GL_TEXTURE_ENV, op0,		blend_operand_prev );
 				glTexEnvf(	GL_TEXTURE_ENV, source1,	GL_TEXTURE );
-				if(using_alpha)
+				if (using_alpha)
 					glTexEnvf(	GL_TEXTURE_ENV, op1,		alphaOp);
 				else
 					glTexEnvf(	GL_TEXTURE_ENV, op1,		blend_operand);
@@ -599,7 +599,7 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate)
 				glTexEnvf(	GL_TEXTURE_ENV, source0,	GL_PREVIOUS_ARB );
 				glTexEnvf(	GL_TEXTURE_ENV, op0,		blend_operand_prev );
 				glTexEnvf(	GL_TEXTURE_ENV, source1,	GL_TEXTURE );
-				if(using_alpha)
+				if (using_alpha)
 					glTexEnvf(	GL_TEXTURE_ENV, op1,		alphaOp);
 				else
 					glTexEnvf(	GL_TEXTURE_ENV, op1,		blend_operand);
@@ -612,7 +612,7 @@ void BL_Texture::setTexEnv(BL_Material *mat, bool modulate)
 
 int BL_Texture::GetPow2(int n)
 {
-	if(!is_power_of_2_i(n))
+	if (!is_power_of_2_i(n))
 		n = power_of_2_min_i(n);
 
 	return n;
@@ -638,13 +638,13 @@ void my_envmap_split_ima(EnvMap *env, ImBuf *ibuf)
 	
 	dx= ibuf->y;
 	dx/= 2;
-	if(3*dx != ibuf->x) {
+	if (3*dx != ibuf->x) {
 		printf("Incorrect envmap size\n");
 		env->ok= 0;
 		env->ima->ok= 0;
 	}
 	else {
-		for(part=0; part<6; part++) {
+		for (part=0; part<6; part++) {
 			env->cube[part]= IMB_allocImBuf(dx, dx, 24, IB_rect);
 		}
 		IMB_rectcpy(env->cube[0], ibuf, 
@@ -669,9 +669,9 @@ void my_free_envmapdata(EnvMap *env)
 {
 	unsigned int part;
 	
-	for(part=0; part<6; part++) {
+	for (part=0; part<6; part++) {
 		ImBuf *ibuf= env->cube[part];
-		if(ibuf) {
+		if (ibuf) {
 			IMB_freeImBuf(ibuf);
 			env->cube[part]= NULL;
 		}
diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.cpp
index 014641a..8c6392e 100644
--- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.cpp
+++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.cpp
@@ -23,7 +23,7 @@
  * Contributor(s): none yet.
  *
  * ***** END GPL LICENSE BLOCK *****
- * Ketsji Logic Extenstion: Network Event Manager generic implementation
+ * Ketsji Logic Extension: Network Event Manager generic implementation
  */
 
 /** \file gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.cpp
diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.h b/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.h
index d14d360..3202785 100644
--- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.h
+++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkEventManager.h
@@ -27,11 +27,11 @@
 
 /** \file KX_NetworkEventManager.h
  *  \ingroup ketsjinet
- *  \brief Ketsji Logic Extenstion: Network Event Manager class
+ *  \brief Ketsji Logic Extension: Network Event Manager class
  */
 
-#ifndef KX_NETWORK_EVENTMANAGER_H
-#define KX_NETWORK_EVENTMANAGER_H
+#ifndef __KX_NETWORKEVENTMANAGER_H__
+#define __KX_NETWORKEVENTMANAGER_H__
 
 #include "SCA_EventManager.h"
 
@@ -52,5 +52,5 @@ public:
 		return m_ndi; }
 };
 
-#endif //KX_NETWORK_EVENTMANAGER_H
+#endif //__KX_NETWORKEVENTMANAGER_H__
 
diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
index 9d5a690..2741907 100644
--- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
+++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
@@ -23,7 +23,7 @@
  * Contributor(s): none yet.
  *
  * ***** END GPL LICENSE BLOCK *****
- * Ketsji Logic Extenstion: Network Message Actuator generic implementation
+ * Ketsji Logic Extension: Network Message Actuator generic implementation
  */
 
 /** \file gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.cpp
diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.h b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.h
index f344735..980e1cd 100644
--- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.h
+++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageActuator.h
@@ -27,11 +27,11 @@
 
 /** \file KX_NetworkMessageActuator.h
  *  \ingroup ketsjinet
- *  \brief Ketsji Logic Extenstion: Network Message Actuator class
+ *  \brief Ketsji Logic Extension: Network Message Actuator class
  */
 
-#ifndef __KX_NETWORKMESSAGEACTUATOR_H
-#define __KX_NETWORKMESSAGEACTUATOR_H
+#ifndef __KX_NETWORKMESSAGEACTUATOR_H__
+#define __KX_NETWORKMESSAGEACTUATOR_H__
 
 #include "STR_String.h"
 #include "SCA_IActuator.h"
@@ -69,5 +69,5 @@ public:
 
 };
 
-#endif //__KX_NETWORKMESSAGEACTUATOR_H
+#endif //__KX_NETWORKMESSAGEACTUATOR_H__
 
diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
index f548eae..a69f02b 100644
--- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
+++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
@@ -23,7 +23,7 @@
  * Contributor(s): none yet.
  *
  * ***** END GPL LICENSE BLOCK *****
- * Ketsji Logic Extenstion: Network Message Sensor generic implementation
+ * Ketsji Logic Extension: Network Message Sensor generic implementation
  */
 
 /** \file gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.cpp
@@ -72,7 +72,8 @@ KX_NetworkMessageSensor::~KX_NetworkMessageSensor()
 {
 }
 
-CValue* KX_NetworkMessageSensor::GetReplica() {
+CValue* KX_NetworkMessageSensor::GetReplica()
+{
 	// This is the standard sensor implementation of GetReplica
 	// There may be more network message sensor specific stuff to do here.
 	CValue* replica = new KX_NetworkMessageSensor(*this);
diff --git a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h
index 75800d9..66f723d 100644
--- a/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h
+++ b/source/gameengine/Ketsji/KXNetwork/KX_NetworkMessageSensor.h
@@ -27,10 +27,10 @@
 
 /** \file KX_NetworkMessageSensor.h
  *  \ingroup ketsjinet
- *  \brief Ketsji Logic Extenstion: Network Message Sensor class
+ *  \brief Ketsji Logic Extension: Network Message Sensor class
  */
-#ifndef __KX_NETWORKMESSAGE_SENSOR_H
-#define __KX_NETWORKMESSAGE_SENSOR_H
+#ifndef __KX_NETWORKMESSAGESENSOR_H__
+#define __KX_NETWORKMESSAGESENSOR_H__
 
 #include "SCA_ISensor.h"
 
@@ -87,5 +87,5 @@ public:
 
 };
 
-#endif //__KX_NETWORKMESSAGE_SENSOR_H
+#endif //__KX_NETWORKMESSAGESENSOR_H__
 
diff --git a/source/gameengine/Ketsji/KX_ArmatureSensor.h b/source/gameengine/Ketsji/KX_ArmatureSensor.h
index 683a54f..9c3faa3 100644
--- a/source/gameengine/Ketsji/KX_ArmatureSensor.h
+++ b/source/gameengine/Ketsji/KX_ArmatureSensor.h
@@ -30,8 +30,8 @@
  *  \brief Property sensor
  */
 
-#ifndef __KX_ARMATURESENSOR
-#define __KX_ARMATURESENSOR
+#ifndef __KX_ARMATURESENSOR_H__
+#define __KX_ARMATURESENSOR_H__
 
 struct bConstraint;
 
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
index 1a1e046..018a8d4 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
@@ -101,7 +101,7 @@ void KX_BlenderMaterial::Initialize(
 	// so we can ether accept or reject this material
 	// as being equal, this is rather important to
 	// prevent material bleeding
-	for(int i=0; i<mMaterial->num_enabled; i++) {
+	for (int i=0; i<mMaterial->num_enabled; i++) {
 		m_multimode	+= (mMaterial->flag[i] + mMaterial->blend_mode[i]);
 	}
 	m_multimode += mMaterial->IdMode+ (mMaterial->ras_mode & ~(USE_LIGHT));
@@ -118,8 +118,7 @@ KX_BlenderMaterial::~KX_BlenderMaterial()
 MTFace* KX_BlenderMaterial::GetMTFace(void) const 
 {
 	// fonts on polys
-	MT_assert(mMaterial->tface);
-	return mMaterial->tface;
+	return &mMaterial->tface;
 }
 
 unsigned int* KX_BlenderMaterial::GetMCol(void) const 
@@ -161,25 +160,25 @@ void KX_BlenderMaterial::OnConstruction(int layer)
 		// when material are reused between objects
 		return;
 	
-	if(mMaterial->glslmat)
+	if (mMaterial->glslmat)
 		SetBlenderGLSLShader(layer);
 
 	// for each unique material...
 	int i;
-	for(i=0; i<mMaterial->num_enabled; i++) {
-		if( mMaterial->mapping[i].mapping & USEENV ) {
-			if(!GLEW_ARB_texture_cube_map) {
+	for (i=0; i<mMaterial->num_enabled; i++) {
+		if ( mMaterial->mapping[i].mapping & USEENV ) {
+			if (!GLEW_ARB_texture_cube_map) {
 				spit("CubeMap textures not supported");
 				continue;
 			}
-			if(!mTextures[i].InitCubeMap(i, mMaterial->cubemap[i] ) )
+			if (!mTextures[i].InitCubeMap(i, mMaterial->cubemap[i] ) )
 				spit("unable to initialize image("<<i<<") in "<< 
 						 mMaterial->matname<< ", image will not be available");
 		} 
 	
 		else {
-			if( mMaterial->img[i] ) {
-				if( ! mTextures[i].InitFromImage(i, mMaterial->img[i], (mMaterial->flag[i] &MIPMAP)!=0 ))
+			if ( mMaterial->img[i] ) {
+				if ( ! mTextures[i].InitFromImage(i, mMaterial->img[i], (mMaterial->flag[i] &MIPMAP)!=0 ))
 					spit("unable to initialize image("<<i<<") in "<< 
 						mMaterial->matname<< ", image will not be available");
 			}
@@ -193,12 +192,12 @@ void KX_BlenderMaterial::OnConstruction(int layer)
 
 void KX_BlenderMaterial::EndFrame()
 {
-	if(mLastBlenderShader) {
+	if (mLastBlenderShader) {
 		mLastBlenderShader->SetProg(false);
 		mLastBlenderShader = NULL;
 	}
 
-	if(mLastShader) {
+	if (mLastShader) {
 		mLastShader->SetProg(false);
 		mLastShader = NULL;
 	}
@@ -206,10 +205,10 @@ void KX_BlenderMaterial::EndFrame()
 
 void KX_BlenderMaterial::OnExit()
 {
-	if( mShader ) {
+	if ( mShader ) {
 		//note, the shader here is allocated, per unique material
 		//and this function is called per face
-		if(mShader == mLastShader) {
+		if (mShader == mLastShader) {
 			mShader->SetProg(false);
 			mLastShader = NULL;
 		}
@@ -218,8 +217,8 @@ void KX_BlenderMaterial::OnExit()
 		mShader = 0;
 	}
 
-	if( mBlenderShader ) {
-		if(mBlenderShader == mLastBlenderShader) {
+	if ( mBlenderShader ) {
+		if (mBlenderShader == mLastBlenderShader) {
 			mBlenderShader->SetProg(false);
 			mLastBlenderShader = NULL;
 		}
@@ -229,14 +228,16 @@ void KX_BlenderMaterial::OnExit()
 	}
 
 	BL_Texture::ActivateFirst();
-	for(int i=0; i<mMaterial->num_enabled; i++) {
+	for (int i=0; i<mMaterial->num_enabled; i++) {
 		BL_Texture::ActivateUnit(i);
 		mTextures[i].DeleteTex();
 		mTextures[i].DisableUnit();
 	}
 
-	if( mMaterial->tface ) 
-		GPU_set_tpage(mMaterial->tface, 1, mMaterial->alphablend);
+	/* used to call with 'mMaterial->tface' but this can be a freed array,
+	 * see: [#30493], so just call with NULL, this is best since it clears
+	 * the 'lastface' pointer in GPU too - campbell */
+	GPU_set_tpage(NULL, 1, mMaterial->alphablend);
 }
 
 
@@ -245,9 +246,9 @@ void KX_BlenderMaterial::setShaderData( bool enable, RAS_IRasterizer *ras)
 	MT_assert(GLEW_ARB_shader_objects && mShader);
 
 	int i;
-	if( !enable || !mShader->Ok() ) {
+	if ( !enable || !mShader->Ok() ) {
 		// frame cleanup.
-		if(mShader == mLastShader) {
+		if (mShader == mLastShader) {
 			mShader->SetProg(false);
 			mLastShader = NULL;
 		}
@@ -266,13 +267,13 @@ void KX_BlenderMaterial::setShaderData( bool enable, RAS_IRasterizer *ras)
 	mShader->ApplyShader();
 
 	// for each enabled unit
-	for(i=0; i<mMaterial->num_enabled; i++) {
-		if(!mTextures[i].Ok()) continue;
+	for (i=0; i<mMaterial->num_enabled; i++) {
+		if (!mTextures[i].Ok()) continue;
 		mTextures[i].ActivateTexture();
 		mTextures[0].SetMapping(mMaterial->mapping[i].mapping);
 	}
 
-	if(!mUserDefBlend) {
+	if (!mUserDefBlend) {
 		ras->SetAlphaBlend(mMaterial->alphablend);
 	}
 	else {
@@ -287,11 +288,11 @@ void KX_BlenderMaterial::setShaderData( bool enable, RAS_IRasterizer *ras)
 
 void KX_BlenderMaterial::setBlenderShaderData( bool enable, RAS_IRasterizer *ras)
 {
-	if( !enable || !mBlenderShader->Ok() ) {
+	if ( !enable || !mBlenderShader->Ok() ) {
 		ras->SetAlphaBlend(TF_SOLID);
 
 		// frame cleanup.
-		if(mLastBlenderShader) {
+		if (mLastBlenderShader) {
 			mLastBlenderShader->SetProg(false);
 			mLastBlenderShader= NULL;
 		}
@@ -301,10 +302,10 @@ void KX_BlenderMaterial::setBlenderShaderData( bool enable, RAS_IRasterizer *ras
 		return;
 	}
 
-	if(!mBlenderShader->Equals(mLastBlenderShader)) {
+	if (!mBlenderShader->Equals(mLastBlenderShader)) {
 		ras->SetAlphaBlend(mMaterial->alphablend);
 
-		if(mLastBlenderShader)
+		if (mLastBlenderShader)
 			mLastBlenderShader->SetProg(false);
 		else
 			BL_Texture::DisableAllTextures();
@@ -318,21 +319,21 @@ void KX_BlenderMaterial::setTexData( bool enable, RAS_IRasterizer *ras)
 {
 	BL_Texture::DisableAllTextures();
 
-	if( !enable ) {
+	if ( !enable ) {
 		ras->SetAlphaBlend(TF_SOLID);
 		return;
 	}
 
 	BL_Texture::ActivateFirst();
 
-	if( mMaterial->IdMode == DEFAULT_BLENDER ) {
+	if ( mMaterial->IdMode == DEFAULT_BLENDER ) {
 		ras->SetAlphaBlend(mMaterial->alphablend);
 		return;
 	}
 
-	if( mMaterial->IdMode == TEXFACE ) {
+	if ( mMaterial->IdMode == TEXFACE ) {
 		// no material connected to the object
-		if( mTextures[0].Ok() ) {
+		if ( mTextures[0].Ok() ) {
 			mTextures[0].ActivateTexture();
 			mTextures[0].setTexEnv(0, true);
 			mTextures[0].SetMapping(mMaterial->mapping[0].mapping);
@@ -342,23 +343,23 @@ void KX_BlenderMaterial::setTexData( bool enable, RAS_IRasterizer *ras)
 	}
 
 	int mode = 0,i=0;
-	for(i=0; (i<mMaterial->num_enabled && i<MAXTEX); i++) {
-		if( !mTextures[i].Ok() ) continue;
+	for (i=0; (i<mMaterial->num_enabled && i<MAXTEX); i++) {
+		if ( !mTextures[i].Ok() ) continue;
 
 		mTextures[i].ActivateTexture();
 		mTextures[i].setTexEnv(mMaterial);
 		mode = mMaterial->mapping[i].mapping;
 
-		if(mode &USEOBJ)
+		if (mode &USEOBJ)
 			setObjectMatrixData(i, ras);
 		else
 			mTextures[i].SetMapping(mode);
 		
-		if(!(mode &USEOBJ))
+		if (!(mode &USEOBJ))
 			setTexMatrixData( i );
 	}
 
-	if(!mUserDefBlend) {
+	if (!mUserDefBlend) {
 		ras->SetAlphaBlend(mMaterial->alphablend);
 	}
 	else {
@@ -378,10 +379,10 @@ KX_BlenderMaterial::ActivatShaders(
 	KX_BlenderMaterial *tmp = const_cast<KX_BlenderMaterial*>(this);
 
 	// reset... 
-	if(tmp->mMaterial->IsShared()) 
+	if (tmp->mMaterial->IsShared()) 
 		cachingInfo =0;
 
-	if(mLastBlenderShader) {
+	if (mLastBlenderShader) {
 		mLastBlenderShader->SetProg(false);
 		mLastBlenderShader= NULL;
 	}
@@ -393,7 +394,7 @@ KX_BlenderMaterial::ActivatShaders(
 		
 		cachingInfo = GetCachingInfo();
 	
-		if(rasty->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED)
+		if (rasty->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED)
 			tmp->setShaderData(true, rasty);
 		else
 			tmp->setShaderData(false, rasty);
@@ -427,7 +428,7 @@ KX_BlenderMaterial::ActivateBlenderShaders(
 {
 	KX_BlenderMaterial *tmp = const_cast<KX_BlenderMaterial*>(this);
 
-	if(mLastShader) {
+	if (mLastShader) {
 		mLastShader->SetProg(false);
 		mLastShader= NULL;
 	}
@@ -438,7 +439,7 @@ KX_BlenderMaterial::ActivateBlenderShaders(
 		
 		cachingInfo = GetCachingInfo();
 	
-		if(rasty->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED)
+		if (rasty->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED)
 			tmp->setBlenderShaderData(true, rasty);
 		else
 			tmp->setBlenderShaderData(false, rasty);
@@ -471,12 +472,12 @@ KX_BlenderMaterial::ActivateMat(
 {
 	KX_BlenderMaterial *tmp = const_cast<KX_BlenderMaterial*>(this);
 
-	if(mLastShader) {
+	if (mLastShader) {
 		mLastShader->SetProg(false);
 		mLastShader= NULL;
 	}
 
-	if(mLastBlenderShader) {
+	if (mLastBlenderShader) {
 		mLastBlenderShader->SetProg(false);
 		mLastBlenderShader= NULL;
 	}
@@ -520,13 +521,13 @@ KX_BlenderMaterial::Activate(
 	TCachingInfo& cachingInfo
 	)const
 {
-	if(GLEW_ARB_shader_objects && (mShader && mShader->Ok())) {
-		if((mPass++) < mShader->getNumPass() ) {
+	if (GLEW_ARB_shader_objects && (mShader && mShader->Ok())) {
+		if ((mPass++) < mShader->getNumPass() ) {
 			ActivatShaders(rasty, cachingInfo);
 			return true;
 		}
 		else {
-			if(mShader == mLastShader) {
+			if (mShader == mLastShader) {
 				mShader->SetProg(false);
 				mLastShader = NULL;
 			}
@@ -534,8 +535,8 @@ KX_BlenderMaterial::Activate(
 			return false;
 		}
 	}
-	else if( GLEW_ARB_shader_objects && (mBlenderShader && mBlenderShader->Ok() ) ) {
-		if(mPass++ == 0) {
+	else if ( GLEW_ARB_shader_objects && (mBlenderShader && mBlenderShader->Ok() ) ) {
+		if (mPass++ == 0) {
 			ActivateBlenderShaders(rasty, cachingInfo);
 			return true;
 		}
@@ -545,7 +546,7 @@ KX_BlenderMaterial::Activate(
 		}
 	}
 	else {
-		if(mPass++ == 0) {
+		if (mPass++ == 0) {
 			ActivateMat(rasty, cachingInfo);
 			return true;
 		}
@@ -558,12 +559,12 @@ KX_BlenderMaterial::Activate(
 
 bool KX_BlenderMaterial::UsesLighting(RAS_IRasterizer *rasty) const
 {
-	if(!RAS_IPolyMaterial::UsesLighting(rasty))
+	if (!RAS_IPolyMaterial::UsesLighting(rasty))
 		return false;
 
-	if(mShader && mShader->Ok())
+	if (mShader && mShader->Ok())
 		return true;
-	else if(mBlenderShader && mBlenderShader->Ok())
+	else if (mBlenderShader && mBlenderShader->Ok())
 		return false;
 	else
 		return true;
@@ -571,10 +572,10 @@ bool KX_BlenderMaterial::UsesLighting(RAS_IRasterizer *rasty) const
 
 void KX_BlenderMaterial::ActivateMeshSlot(const RAS_MeshSlot & ms, RAS_IRasterizer* rasty) const
 {
-	if(mShader && GLEW_ARB_shader_objects) {
+	if (mShader && GLEW_ARB_shader_objects) {
 		mShader->Update(ms, rasty);
 	}
-	else if(mBlenderShader && GLEW_ARB_shader_objects) {
+	else if (mBlenderShader && GLEW_ARB_shader_objects) {
 		int alphablend;
 
 		mBlenderShader->Update(ms, rasty);
@@ -582,7 +583,7 @@ void KX_BlenderMaterial::ActivateMeshSlot(const RAS_MeshSlot & ms, RAS_IRasteriz
 		/* we do blend modes here, because they can change per object
 		 * with the same material due to obcolor/obalpha */
 		alphablend = mBlenderShader->GetAlphaBlend();
-		if(ELEM3(alphablend, GEMAT_SOLID, GEMAT_ALPHA, GEMAT_ALPHA_SORT) && mMaterial->alphablend != GEMAT_SOLID)
+		if (ELEM3(alphablend, GEMAT_SOLID, GEMAT_ALPHA, GEMAT_ALPHA_SORT) && mMaterial->alphablend != GEMAT_SOLID)
 			alphablend = mMaterial->alphablend;
 
 		rasty->SetAlphaBlend(alphablend);
@@ -591,7 +592,7 @@ void KX_BlenderMaterial::ActivateMeshSlot(const RAS_MeshSlot & ms, RAS_IRasteriz
 
 void KX_BlenderMaterial::ActivatGLMaterials( RAS_IRasterizer* rasty )const
 {
-	if(mShader || !mBlenderShader) {
+	if (mShader || !mBlenderShader) {
 		rasty->SetSpecularity(
 			mMaterial->speccolor[0]*mMaterial->spec_f,
 			mMaterial->speccolor[1]*mMaterial->spec_f,
@@ -623,10 +624,10 @@ void KX_BlenderMaterial::ActivatGLMaterials( RAS_IRasterizer* rasty )const
 
 void KX_BlenderMaterial::ActivateTexGen(RAS_IRasterizer *ras) const
 {
-	if(ras->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED) {
+	if (ras->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED) {
 		ras->SetAttribNum(0);
-		if(mShader && GLEW_ARB_shader_objects) {
-			if(mShader->GetAttribute() == BL_Shader::SHD_TANGENT) {
+		if (mShader && GLEW_ARB_shader_objects) {
+			if (mShader->GetAttribute() == BL_Shader::SHD_TANGENT) {
 				ras->SetAttrib(RAS_IRasterizer::RAS_TEXCO_DISABLE, 0);
 				ras->SetAttrib(RAS_IRasterizer::RAS_TEXTANGENT, 1);
 				ras->SetAttribNum(2);
@@ -635,7 +636,7 @@ void KX_BlenderMaterial::ActivateTexGen(RAS_IRasterizer *ras) const
 
 		ras->SetTexCoordNum(mMaterial->num_enabled);
 
-		for(int i=0; i<mMaterial->num_enabled; i++) {
+		for (int i=0; i<mMaterial->num_enabled; i++) {
 			int mode = mMaterial->mapping[i].mapping;
 
 			if (mode &USECUSTOMUV)
@@ -645,15 +646,15 @@ void KX_BlenderMaterial::ActivateTexGen(RAS_IRasterizer *ras) const
 				continue;
 			}
 
-			if( mode &(USEREFL|USEOBJ))
+			if ( mode &(USEREFL|USEOBJ))
 				ras->SetTexCoord(RAS_IRasterizer::RAS_TEXCO_GEN, i);
-			else if(mode &USEORCO)
+			else if (mode &USEORCO)
 				ras->SetTexCoord(RAS_IRasterizer::RAS_TEXCO_ORCO, i);
-			else if(mode &USENORM)
+			else if (mode &USENORM)
 				ras->SetTexCoord(RAS_IRasterizer::RAS_TEXCO_NORM, i);
-			else if(mode &USEUV)
+			else if (mode &USEUV)
 				ras->SetTexCoord(RAS_IRasterizer::RAS_TEXCO_UV1, i);
-			else if(mode &USETANG)
+			else if (mode &USETANG)
 				ras->SetTexCoord(RAS_IRasterizer::RAS_TEXTANGENT, i);
 			else 
 				ras->SetTexCoord(RAS_IRasterizer::RAS_TEXCO_DISABLE, i);
@@ -666,7 +667,7 @@ void KX_BlenderMaterial::setTexMatrixData(int i)
 	glMatrixMode(GL_TEXTURE);
 	glLoadIdentity();
 
-	if( GLEW_ARB_texture_cube_map && 
+	if ( GLEW_ARB_texture_cube_map && 
 		mTextures[i].GetTextureType() == GL_TEXTURE_CUBE_MAP_ARB && 
 		mMaterial->mapping[i].mapping & USEREFL) {
 		glScalef( 
@@ -696,11 +697,11 @@ void KX_BlenderMaterial::setTexMatrixData(int i)
 static void GetProjPlane(BL_Material *mat, int index,int num, float*param)
 {
 	param[0]=param[1]=param[2]=param[3]=0.f;
-	if( mat->mapping[index].projplane[num] == PROJX )
+	if ( mat->mapping[index].projplane[num] == PROJX )
 		param[0] = 1.f;
-	else if( mat->mapping[index].projplane[num] == PROJY )
+	else if ( mat->mapping[index].projplane[num] == PROJY )
 		param[1] = 1.f;
-	else if( mat->mapping[index].projplane[num] == PROJZ)
+	else if ( mat->mapping[index].projplane[num] == PROJZ)
 		param[2] = 1.f;
 }
 
@@ -710,7 +711,7 @@ void KX_BlenderMaterial::setObjectMatrixData(int i, RAS_IRasterizer *ras)
 		(KX_GameObject*)
 		mScene->GetObjectList()->FindValue(mMaterial->mapping[i].objconame);
 
-	if(!obj) return;
+	if (!obj) return;
 
 	glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR );
 	glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR );
@@ -780,10 +781,10 @@ void KX_BlenderMaterial::UpdateIPO(
 
 void KX_BlenderMaterial::SetBlenderGLSLShader(int layer)
 {
-	if(!mBlenderShader)
+	if (!mBlenderShader)
 		mBlenderShader = new BL_BlenderShader(mScene, mMaterial->material, layer);
 
-	if(!mBlenderShader->Ok()) {
+	if (!mBlenderShader->Ok()) {
 		delete mBlenderShader;
 		mBlenderShader = 0;
 	}
@@ -851,7 +852,7 @@ int KX_BlenderMaterial::pyattr_set_blending(void *self_v, const KX_PYATTRIBUTE_D
 {
 	KX_BlenderMaterial* self= static_cast<KX_BlenderMaterial*>(self_v);
 	PyObject* obj = self->PysetBlending(value, NULL);
-	if(obj)
+	if (obj)
 	{
 		Py_DECREF(obj);
 		return 0;
@@ -861,24 +862,24 @@ int KX_BlenderMaterial::pyattr_set_blending(void *self_v, const KX_PYATTRIBUTE_D
 
 KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()")
 {
-	if( !GLEW_ARB_fragment_shader) {
-		if(!mModified)
+	if ( !GLEW_ARB_fragment_shader) {
+		if (!mModified)
 			spit("Fragment shaders not supported");
 	
 		mModified = true;
 		Py_RETURN_NONE;
 	}
 
-	if( !GLEW_ARB_vertex_shader) {
-		if(!mModified)
+	if ( !GLEW_ARB_vertex_shader) {
+		if (!mModified)
 			spit("Vertex shaders not supported");
 
 		mModified = true;
 		Py_RETURN_NONE;
 	}
 
-	if(!GLEW_ARB_shader_objects)  {
-		if(!mModified)
+	if (!GLEW_ARB_shader_objects)  {
+		if (!mModified)
 			spit("GLSL not supported");
 		mModified = true;
 		Py_RETURN_NONE;
@@ -887,12 +888,12 @@ KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()")
 		// returns Py_None on error
 		// the calling script will need to check
 
-		if(!mShader && !mModified) {
+		if (!mShader && !mModified) {
 			mShader = new BL_Shader();
 			mModified = true;
 		}
 
-		if(mShader && !mShader->GetError()) {
+		if (mShader && !mShader->GetError()) {
 			m_flag &= ~RAS_BLENDERGLSL;
 			mMaterial->SetSharedMaterial(true);
 			mScene->GetBucketManager()->ReleaseDisplayLists(this);
@@ -903,7 +904,7 @@ KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()")
 			// then delete it!
 			// We will then go back to fixed functionality
 			// for this material
-			if(mShader) {
+			if (mShader) {
 				delete mShader; /* will handle python de-referencing */
 				mShader=0;
 			}
@@ -948,22 +949,22 @@ static unsigned int GL_array[11] = {
 KX_PYMETHODDEF_DOC( KX_BlenderMaterial, setBlending , "setBlending( bge.logic.src, bge.logic.dest)")
 {
 	unsigned int b[2];
-	if(PyArg_ParseTuple(args, "ii:setBlending", &b[0], &b[1]))
+	if (PyArg_ParseTuple(args, "ii:setBlending", &b[0], &b[1]))
 	{
 		bool value_found[2] = {false, false};
-		for(int i=0; i<11; i++)
+		for (int i=0; i<11; i++)
 		{
-			if(b[0] == GL_array[i]) {
+			if (b[0] == GL_array[i]) {
 				value_found[0] = true;
 				mBlendFunc[0] = b[0];
 			}
-			if(b[1] == GL_array[i]) {
+			if (b[1] == GL_array[i]) {
 				value_found[1] = true;
 				mBlendFunc[1] = b[1];
 			}
-			if(value_found[0] && value_found[1]) break;
+			if (value_found[0] && value_found[1]) break;
 		}
-		if(!value_found[0] || !value_found[1]) {
+		if (!value_found[0] || !value_found[1]) {
 			PyErr_SetString(PyExc_ValueError, "material.setBlending(int, int): KX_BlenderMaterial, invalid enum.");
 			return NULL;
 		}
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.h b/source/gameengine/Ketsji/KX_BlenderMaterial.h
index 18f9875..af67719 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.h
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.h
@@ -3,8 +3,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_BLENDER_MATERIAL_H__
-#define __KX_BLENDER_MATERIAL_H__
+#ifndef __KX_BLENDERMATERIAL_H__
+#define __KX_BLENDERMATERIAL_H__
 
 #include <vector>
 
diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
index 3febff9..9940b40 100644
--- a/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
+++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
@@ -235,9 +235,9 @@ void	KX_BulletPhysicsController::setRigidBody(bool rigid)
 }
 
 /* This function dynamically adds the collision shape of another controller to
-   the current controller shape provided it is a compound shape.
-   The idea is that dynamic parenting on a compound object will dynamically extend the shape
-*/
+ * the current controller shape provided it is a compound shape.
+ * The idea is that dynamic parenting on a compound object will dynamically extend the shape
+ */
 void    KX_BulletPhysicsController::AddCompoundChild(KX_IPhysicsController* child)
 { 
 	if (child == NULL || !IsCompound())
@@ -308,8 +308,8 @@ void    KX_BulletPhysicsController::AddCompoundChild(KX_IPhysicsController* chil
 }
 
 /* Reverse function of the above, it will remove a shape from a compound shape
-   provided that the former was added to the later using  AddCompoundChild()
-*/
+ * provided that the former was added to the later using  AddCompoundChild()
+ */
 void    KX_BulletPhysicsController::RemoveCompoundChild(KX_IPhysicsController* child)
 { 
 	if (child == NULL || !IsCompound())
diff --git a/source/gameengine/Ketsji/KX_BulletPhysicsController.h b/source/gameengine/Ketsji/KX_BulletPhysicsController.h
index c0ff143..d2f56bc 100644
--- a/source/gameengine/Ketsji/KX_BulletPhysicsController.h
+++ b/source/gameengine/Ketsji/KX_BulletPhysicsController.h
@@ -3,8 +3,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef KX_BULLET2PHYSICS_CONTROLLER
-#define KX_BULLET2PHYSICS_CONTROLLER
+#ifndef __KX_BULLETPHYSICSCONTROLLER_H__
+#define __KX_BULLETPHYSICSCONTROLLER_H__
 
 
 #include "KX_IPhysicsController.h"
@@ -98,5 +98,5 @@ public:
 #endif
 };
 
-#endif //KX_BULLET2PHYSICS_CONTROLLER
+#endif //__KX_BULLETPHYSICSCONTROLLER_H__
 
diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp
index 14a3077..a9602d1 100644
--- a/source/gameengine/Ketsji/KX_Camera.cpp
+++ b/source/gameengine/Ketsji/KX_Camera.cpp
@@ -133,8 +133,8 @@ const MT_Quaternion KX_Camera::GetCameraOrientation() const
 
 
 /**
-* Sets the projection matrix that is used by the rasterizer.
-*/
+ * Sets the projection matrix that is used by the rasterizer.
+ */
 void KX_Camera::SetProjectionMatrix(const MT_Matrix4x4 & mat)
 {
 	m_projection_matrix = mat;
@@ -146,8 +146,8 @@ void KX_Camera::SetProjectionMatrix(const MT_Matrix4x4 & mat)
 
 
 /**
-* Sets the modelview matrix that is used by the rasterizer.
-*/
+ * Sets the modelview matrix that is used by the rasterizer.
+ */
 void KX_Camera::SetModelviewMatrix(const MT_Matrix4x4 & mat)
 {
 	m_modelview_matrix = mat;
@@ -158,8 +158,8 @@ void KX_Camera::SetModelviewMatrix(const MT_Matrix4x4 & mat)
 
 
 /**
-* Gets the projection matrix that is used by the rasterizer.
-*/
+ * Gets the projection matrix that is used by the rasterizer.
+ */
 const MT_Matrix4x4& KX_Camera::GetProjectionMatrix() const
 {
 	return m_projection_matrix;
@@ -168,8 +168,8 @@ const MT_Matrix4x4& KX_Camera::GetProjectionMatrix() const
 
 
 /**
-* Gets the modelview matrix that is used by the rasterizer.
-*/
+ * Gets the modelview matrix that is used by the rasterizer.
+ */
 const MT_Matrix4x4& KX_Camera::GetModelviewMatrix() const
 {
 	return m_modelview_matrix;
@@ -187,9 +187,9 @@ void KX_Camera::InvalidateProjectionMatrix(bool valid)
 }
 
 
-/*
-* These getters retrieve the clip data and the focal length
-*/
+/**
+ * These getters retrieve the clip data and the focal length
+ */
 float KX_Camera::GetLens() const
 {
 	return m_camdata.m_lens;
@@ -200,17 +200,17 @@ float KX_Camera::GetScale() const
 	return m_camdata.m_scale;
 }
 
-/*
-* Gets the horizontal size of the sensor - for camera matching.
-*/
+/**
+ * Gets the horizontal size of the sensor - for camera matching.
+ */
 float KX_Camera::GetSensorWidth() const
 {
 	return m_camdata.m_sensor_x;
 }
 
-/*
-* Gets the vertical size of the sensor - for camera matching.
-*/
+/**
+ * Gets the vertical size of the sensor - for camera matching.
+ */
 float KX_Camera::GetSensorHeight() const
 {
 	return m_camdata.m_sensor_y;
@@ -306,14 +306,14 @@ void KX_Camera::ExtractFrustumSphere()
 		MT_Vector4 nfar;    // far point in device normalized coordinate
 		MT_Point3 farpoint; // most extreme far point in camera coordinate
 		MT_Point3 nearpoint;// most extreme near point in camera coordinate
-		MT_Point3 farcenter(0.,0.,0.);// center of far cliping plane in camera coordinate
+		MT_Point3 farcenter(0.0, 0.0, 0.0);// center of far cliping plane in camera coordinate
 		MT_Scalar F=-1.0, N; // square distance of far and near point to origin
 		MT_Scalar f, n;     // distance of far and near point to z axis. f is always > 0 but n can be < 0
 		MT_Scalar e, s;     // far and near clipping distance (<0)
 		MT_Scalar c;        // slope of center line = distance of far clipping center to z axis / far clipping distance
 		MT_Scalar z;        // projection of sphere center on z axis (<0)
 		// tmp value
-		MT_Vector4 npoint(1., 1., 1., 1.);
+		MT_Vector4 npoint(1.0, 1.0, 1.0, 1.0);
 		MT_Vector4 hpoint;
 		MT_Point3 point;
 		MT_Scalar len;
@@ -337,7 +337,7 @@ void KX_Camera::ExtractFrustumSphere()
 		// the far center is the average of the far clipping points
 		farcenter *= 0.25;
 		// the extreme near point is the opposite point on the near clipping plane
-		nfar.setValue(-nfar[0], -nfar[1], -1., 1.);
+		nfar.setValue(-nfar[0], -nfar[1], -1.0, 1.0);
 		nfar = clip_camcs_matrix*nfar;
 		nearpoint.setValue(nfar[0]/nfar[3], nfar[1]/nfar[3], nfar[2]/nfar[3]);
 		// this is a frustrum projection
@@ -362,7 +362,7 @@ void KX_Camera::ExtractFrustumSphere()
 	{
 		// orthographic projection
 		// The most extreme points on the near and far plane. (normalized device coords)
-		MT_Vector4 hnear(1., 1., 1., 1.), hfar(-1., -1., -1., 1.);
+		MT_Vector4 hnear(1.0, 1.0, 1.0, 1.0), hfar(-1.0, -1.0, -1.0, 1.0);
 		
 		// Transform to hom camera local space
 		hnear = clip_camcs_matrix*hnear;
@@ -387,9 +387,9 @@ bool KX_Camera::PointInsideFrustum(const MT_Point3& x)
 {
 	ExtractClipPlanes();
 	
-	for( unsigned int i = 0; i < 6 ; i++ )
+	for ( unsigned int i = 0; i < 6 ; i++ )
 	{
-		if (m_planes[i][0]*x[0] + m_planes[i][1]*x[1] + m_planes[i][2]*x[2] + m_planes[i][3] < 0.)
+		if (m_planes[i][0] * x[0] + m_planes[i][1] * x[1] + m_planes[i][2] * x[2] + m_planes[i][3] < 0.0)
 			return false;
 	}
 	return true;
@@ -401,13 +401,13 @@ int KX_Camera::BoxInsideFrustum(const MT_Point3 *box)
 	
 	unsigned int insideCount = 0;
 	// 6 view frustum planes
-	for( unsigned int p = 0; p < 6 ; p++ )
+	for ( unsigned int p = 0; p < 6 ; p++ )
 	{
 		unsigned int behindCount = 0;
 		// 8 box vertices.
 		for (unsigned int v = 0; v < 8 ; v++)
 		{
-			if (m_planes[p][0]*box[v][0] + m_planes[p][1]*box[v][1] + m_planes[p][2]*box[v][2] + m_planes[p][3] < 0.)
+			if (m_planes[p][0] * box[v][0] + m_planes[p][1] * box[v][1] + m_planes[p][2] * box[v][2] + m_planes[p][3] < 0.0)
 				behindCount++;
 		}
 		
@@ -944,7 +944,7 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, getScreenPosition,
 	{
 		PyErr_Clear();
 
-		if(ConvertPythonToGameObject(value, &obj, true, ""))
+		if (ConvertPythonToGameObject(value, &obj, true, ""))
 		{
 			PyErr_Clear();
 			vect = MT_Vector3(obj->NodeGetWorldPosition());
@@ -977,7 +977,7 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, getScreenPosition,
 	vect[1] = 1.0 - vect[1]; //to follow Blender window coordinate system (Top-Down)
 
 	PyObject* ret = PyTuple_New(2);
-	if(ret){
+	if (ret) {
 		PyTuple_SET_ITEM(ret, 0, PyFloat_FromDouble(vect[0]));
 		PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(vect[1]));
 		return ret;
@@ -1044,7 +1044,7 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, getScreenRay,
 	PyTuple_SET_ITEM(argValue, 0, PyFloat_FromDouble(x));
 	PyTuple_SET_ITEM(argValue, 1, PyFloat_FromDouble(y));
 
-	if(!PyVecTo(PygetScreenVect(argValue), vect))
+	if (!PyVecTo(PygetScreenVect(argValue), vect))
 	{
 		Py_DECREF(argValue);
 		PyErr_SetString(PyExc_TypeError,
diff --git a/source/gameengine/Ketsji/KX_Camera.h b/source/gameengine/Ketsji/KX_Camera.h
index e9c4e99..7481b2e 100644
--- a/source/gameengine/Ketsji/KX_Camera.h
+++ b/source/gameengine/Ketsji/KX_Camera.h
@@ -30,8 +30,8 @@
  *  \brief Camera in the gameengine. Cameras are also used for views.
  */
 
-#ifndef __KX_CAMERA
-#define __KX_CAMERA
+#ifndef __KX_CAMERA_H__
+#define __KX_CAMERA_H__
 
 
 #include "MT_Transform.h"
@@ -63,12 +63,13 @@ protected:
 	// Never used, I think...
 //	void MoveTo(const MT_Point3& movevec)
 //	{
-		/*MT_Transform camtrans;
+#if 0
+		MT_Transform camtrans;
 		camtrans.invert(m_trans1);
 		MT_Matrix3x3 camorient = camtrans.getBasis();
 		camtrans.translate(camorient.inverse()*movevec);
 		m_trans1.invert(camtrans);
-		*/
+#endif
 //	}
 
 	/**
@@ -145,7 +146,7 @@ protected:
 
 public:
 
-	enum { INSIDE, INTERSECT, OUTSIDE } ;
+	enum { INSIDE, INTERSECT, OUTSIDE };
 
 	KX_Camera(void* sgReplicationInfo,SG_Callbacks callbacks,const RAS_CameraData& camdata, bool frustum_culling = true, bool delete_node = false);
 	virtual ~KX_Camera();
@@ -185,13 +186,13 @@ public:
 	bool				hasValidProjectionMatrix() const;
 	
 	/** Sets the validity of the projection matrix.  Call this if you change camera
-	    data (eg lens, near plane, far plane) and require the projection matrix to be
-	    recalculated.
+	 *  data (eg lens, near plane, far plane) and require the projection matrix to be
+	 *  recalculated.
 	 */
 	void				InvalidateProjectionMatrix(bool valid = false);
 	
 	/** Gets the modelview matrix that is used by the rasterizer. 
-	 *  @warning If the Camera is a dynamic object then this method may return garbage.  Use GetCameraToWorld() instead.
+	 *  \warning If the Camera is a dynamic object then this method may return garbage.  Use GetCameraToWorld() instead.
 	 */
 	const MT_Matrix4x4&		GetModelviewMatrix() const;
 
@@ -217,21 +218,21 @@ public:
 	/**
 	 * Tests if the given sphere is inside this camera's view frustum.
 	 *
-	 * @param center The center of the sphere, in world coordinates.
-	 * @param radius The radius of the sphere.
-	 * @return INSIDE, INTERSECT, or OUTSIDE depending on the sphere's relation to the frustum.
+	 * \param center The center of the sphere, in world coordinates.
+	 * \param radius The radius of the sphere.
+	 * \return INSIDE, INTERSECT, or OUTSIDE depending on the sphere's relation to the frustum.
 	 */
 	int SphereInsideFrustum(const MT_Point3& center, const MT_Scalar &radius);
 	/**
 	 * Tests the given eight corners of a box with the view frustum.
 	 *
-	 * @param box a pointer to eight MT_Point3 representing the world coordinates of the corners of the box.
-	 * @return INSIDE, INTERSECT, or OUTSIDE depending on the box's relation to the frustum.
+	 * \param box a pointer to eight MT_Point3 representing the world coordinates of the corners of the box.
+	 * \return INSIDE, INTERSECT, or OUTSIDE depending on the box's relation to the frustum.
 	 */
 	int BoxInsideFrustum(const MT_Point3 *box);
 	/**
 	 * Tests the given point against the view frustum.
-	 * @return true if the given point is inside or on the view frustum; false if it is outside.
+	 * \return true if the given point is inside or on the view frustum; false if it is outside.
 	 */
 	bool PointInsideFrustum(const MT_Point3& x);
 	
@@ -320,5 +321,5 @@ public:
 #endif
 };
 
-#endif //__KX_CAMERA
+#endif //__KX_CAMERA_H__
 
diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp
index cd0aff0..dfe45b8 100644
--- a/source/gameengine/Ketsji/KX_CameraActuator.cpp
+++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp
@@ -121,7 +121,7 @@ static float Kx_Normalize(float *n)
 	
 	d= n[0]*n[0]+n[1]*n[1]+n[2]*n[2];
 	/* FLT_EPSILON is too large! A larger value causes normalize errors in a scaled down utah teapot */
-	if(d>0.0000000000001) {
+	if (d>0.0000000000001) {
 		d= sqrt(d);
 
 		n[0]/=d; 
@@ -142,7 +142,7 @@ static void Kx_Crossf(float *c, float *a, float *b)
 }
 
 
-static void Kx_VecUpMat3(float *vec, float mat[][3], short axis)
+static void Kx_VecUpMat3(float vec[3], float mat[][3], short axis)
 {
 
 	// Construct a camera matrix s.t. the specified axis
@@ -155,29 +155,29 @@ static void Kx_VecUpMat3(float *vec, float mat[][3], short axis)
 	float inp;
 	short cox = 0, coy = 0, coz = 0;
 	
-	/* up varieeren heeft geen zin, is eigenlijk helemaal geen up!
-	 * zie VecUpMat3old
+	/* up range has no meaning, is not really up!
+	 * see: VecUpMat3old
 	 */
 
-	if(axis==0) {
+	if (axis==0) {
 		cox= 0; coy= 1; coz= 2;		/* Y up Z tr */
 	}
-	if(axis==1) {
+	if (axis==1) {
 		cox= 1; coy= 2; coz= 0;		/* Z up X tr */
 	}
-	if(axis==2) {
+	if (axis==2) {
 		cox= 2; coy= 0; coz= 1;		/* X up Y tr */
 	}
-	if(axis==3) {
+	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];
 	}
-	if(axis==4) {
+	if (axis==4) {
 		cox= 1; coy= 0; coz= 2;		/*  */
 	}
-	if(axis==5) {
+	if (axis==5) {
 		cox= 2; coy= 1; coz= 0;		/* Y up X tr */
 	}
 
@@ -186,7 +186,7 @@ static void Kx_VecUpMat3(float *vec, float mat[][3], short axis)
 	mat[coz][2]= vec[2];
 	if (Kx_Normalize((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 */
+		 * We will choose a completely arbitrary direction */
 		mat[coz][0] = 1.0f;
 		mat[coz][1] = 0.0f;
 		mat[coz][2] = 0.0f;
@@ -210,7 +210,7 @@ static void Kx_VecUpMat3(float *vec, float mat[][3], short axis)
 
 bool KX_CameraActuator::Update(double curtime, bool frame)
 {
-	/* wondering... is it really neccesary/desirable to suppress negative    */
+	/* wondering... is it really necessary/desirable to suppress negative    */
 	/* events here?                                                          */
 	bool bNegativeEvent = IsNegativeEvent();
 	RemoveAllEvents();
@@ -239,9 +239,9 @@ bool KX_CameraActuator::Update(double curtime, bool frame)
 	/* CONSTRAINT 6: again: fixed height relative to floor below actor        */
 	/* CONSTRAINT 7: track to floor below actor                               */
 	/* CONSTRAINT 8: look a little bit left or right, depending on how the
-
-	   character is looking (horizontal x)
- */
+	 *
+	 * character is looking (horizontal x)
+	 */
 
 	/* ...and then set the camera position. Since we assume the parent of    */
 	/* this actuator is always a camera, just set the parent position and    */
@@ -318,8 +318,8 @@ bool KX_CameraActuator::Update(double curtime, bool frame)
 	from[2]+= fac*fp1[2];
 	
 	/* alleen alstie ervoor ligt: cross testen en loodrechte bijtellen */
-	if(inp<0.0) {
-		if(fp1[0]*fp2[1] - fp1[1]*fp2[0] > 0.0) {
+	if (inp<0.0) {
+		if (fp1[0]*fp2[1] - fp1[1]*fp2[0] > 0.0) {
 			from[0]-= fac*fp1[1];
 			from[1]+= fac*fp1[0];
 		}
@@ -336,14 +336,14 @@ bool KX_CameraActuator::Update(double curtime, bool frame)
 	rc[2]= (lookat[2]-from[2]);
 	distsq= rc[0]*rc[0] + rc[1]*rc[1] + rc[2]*rc[2];
 
-	if(distsq > maxdistsq) {
+	if (distsq > maxdistsq) {
 		distsq = 0.15*(distsq-maxdistsq)/distsq;
 		
 		from[0] += distsq*rc[0];
 		from[1] += distsq*rc[1];
 		from[2] += distsq*rc[2];
 	}
-	else if(distsq < mindistsq) {
+	else if (distsq < mindistsq) {
 		distsq = 0.15*(mindistsq-distsq)/mindistsq;
 		
 		from[0] -= distsq*rc[0];
diff --git a/source/gameengine/Ketsji/KX_CameraActuator.h b/source/gameengine/Ketsji/KX_CameraActuator.h
index 1cae676..c67174d 100644
--- a/source/gameengine/Ketsji/KX_CameraActuator.h
+++ b/source/gameengine/Ketsji/KX_CameraActuator.h
@@ -32,15 +32,15 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_CAMERAACTUATOR
-#define __KX_CAMERAACTUATOR
+#ifndef __KX_CAMERAACTUATOR_H__
+#define __KX_CAMERAACTUATOR_H__
 
 #include "SCA_IActuator.h"
 #include "MT_Scalar.h"
 #include "SCA_LogicManager.h"
 
 /**
- * The camera actuator does a Robbie Muller prespective for you. This is a 
+ * The camera actuator does a Robbie Muller perspective for you. This is a
  * weird set of rules that positions the camera sort of behind the object,
  * tracking, while avoiding any objects between the 'ideal' position and the
  * actor being tracked.
@@ -135,5 +135,5 @@ private :
 
 };
 
-#endif //__KX_CAMERAACTUATOR
+#endif //__KX_CAMERAACTUATOR_H__
 
diff --git a/source/gameengine/Ketsji/KX_CameraIpoSGController.h b/source/gameengine/Ketsji/KX_CameraIpoSGController.h
index fb91455..f24d094 100644
--- a/source/gameengine/Ketsji/KX_CameraIpoSGController.h
+++ b/source/gameengine/Ketsji/KX_CameraIpoSGController.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef KX_CAMERAIPOSGCONTROLLER_H
-#define KX_CAMERAIPOSGCONTROLLER_H
+#ifndef __KX_CAMERAIPOSGCONTROLLER_H__
+#define __KX_CAMERAIPOSGCONTROLLER_H__
 
 #include "SG_Controller.h"
 #include "SG_Spatial.h"
@@ -96,5 +96,5 @@ public:
 #endif
 };
 
-#endif // KX_CAMERAIPOSGCONTROLLER_H
+#endif // __KX_CAMERAIPOSGCONTROLLER_H__
 
diff --git a/source/gameengine/Ketsji/KX_ClientObjectInfo.h b/source/gameengine/Ketsji/KX_ClientObjectInfo.h
index 78f2f54..1a94c39 100644
--- a/source/gameengine/Ketsji/KX_ClientObjectInfo.h
+++ b/source/gameengine/Ketsji/KX_ClientObjectInfo.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_CLIENTOBJECT_INFO_H
-#define __KX_CLIENTOBJECT_INFO_H
+#ifndef __KX_CLIENTOBJECTINFO_H__
+#define __KX_CLIENTOBJECTINFO_H__
 
 /* Note, the way this works with/without sumo is a bit odd */
 
@@ -86,5 +86,5 @@ public:
 #endif
 };
 
-#endif //__KX_CLIENTOBJECT_INFO_H
+#endif //__KX_CLIENTOBJECTINFO_H__
 
diff --git a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp
index da8df24..322d6e6 100644
--- a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp
+++ b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp
@@ -147,8 +147,8 @@ bool KX_ConstraintActuator::RayHit(KX_ClientObjectInfo* client, KX_RayCast* resu
 	return true;
 }
 
-/* this function is used to pre-filter the object before casting the ray on them.
-   This is useful for "X-Ray" option when we want to see "through" unwanted object.
+/* This function is used to pre-filter the object before casting the ray on them.
+ * This is useful for "X-Ray" option when we want to see "through" unwanted object.
  */
 bool KX_ConstraintActuator::NeedRayCast(KX_ClientObjectInfo* client)
 {
@@ -175,7 +175,7 @@ bool KX_ConstraintActuator::Update(double curtime, bool frame)
 		/* low-pass filtered time response, if the damp time is unequal to 0.     */
 
 		/* Having to retrieve location/rotation and setting it afterwards may not */
-		/* be efficient enough... Somthing to look at later.                      */
+		/* be efficient enough... Something to look at later.                     */
 		KX_GameObject  *obj = (KX_GameObject*) GetParent();
 		MT_Point3    position = obj->NodeGetWorldPosition();
 		MT_Point3    newposition;
diff --git a/source/gameengine/Ketsji/KX_ConstraintActuator.h b/source/gameengine/Ketsji/KX_ConstraintActuator.h
index b513b14..f491aed 100644
--- a/source/gameengine/Ketsji/KX_ConstraintActuator.h
+++ b/source/gameengine/Ketsji/KX_ConstraintActuator.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_CONSTRAINTACTUATOR
-#define __KX_CONSTRAINTACTUATOR
+#ifndef __KX_CONSTRAINTACTUATOR_H__
+#define __KX_CONSTRAINTACTUATOR_H__
 
 #include "SCA_IActuator.h"
 #include "MT_Scalar.h"
@@ -145,5 +145,5 @@ protected:
 
 };
 
-#endif //__KX_CONSTRAINTACTUATOR
+#endif //__KX_CONSTRAINTACTUATOR_H__
 
diff --git a/source/gameengine/Ketsji/KX_ConstraintWrapper.h b/source/gameengine/Ketsji/KX_ConstraintWrapper.h
index 980221b..a92ae83 100644
--- a/source/gameengine/Ketsji/KX_ConstraintWrapper.h
+++ b/source/gameengine/Ketsji/KX_ConstraintWrapper.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef KX_CONSTRAINT_WRAPPER
-#define KX_CONSTRAINT_WRAPPER
+#ifndef __KX_CONSTRAINTWRAPPER_H__
+#define __KX_CONSTRAINTWRAPPER_H__
 
 #include "Value.h"
 #include "PHY_DynamicTypes.h"
@@ -41,7 +41,7 @@ class	KX_ConstraintWrapper : public PyObjectPlus
 public:
 	KX_ConstraintWrapper(PHY_ConstraintType ctype,int constraintId,class PHY_IPhysicsEnvironment* physenv);
 	virtual ~KX_ConstraintWrapper ();
-	int			getConstraintId() { return m_constraintId;};
+	int			getConstraintId() { return m_constraintId; }
 	
 #ifdef WITH_PYTHON
 	KX_PYMETHOD_NOARGS(KX_ConstraintWrapper,GetConstraintId);
@@ -57,5 +57,5 @@ private:
 	PHY_IPhysicsEnvironment* m_physenv;
 };
 
-#endif //KX_CONSTRAINT_WRAPPER
+#endif //__KX_CONSTRAINTWRAPPER_H__
 
diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h b/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h
index 9471d58..f1f58d7 100644
--- a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h
+++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef KX_CONVERTPHYSICSOBJECTS
-#define KX_CONVERTPHYSICSOBJECTS
+#ifndef __KX_CONVERTPHYSICSOBJECT_H__
+#define __KX_CONVERTPHYSICSOBJECT_H__
 
 class RAS_MeshObject;
 class KX_Scene;
@@ -158,4 +158,4 @@ void	KX_ClearBulletSharedShapes();
 bool KX_ReInstanceBulletShapeFromMesh(KX_GameObject *gameobj, KX_GameObject *from_gameobj, RAS_MeshObject* from_meshobj);
 
 #endif
-#endif //KX_CONVERTPHYSICSOBJECTS
+#endif //__KX_CONVERTPHYSICSOBJECT_H__
diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
index f21a7f8..e0e8e2d 100644
--- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
+++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
@@ -209,7 +209,7 @@ void	KX_ConvertBulletObject(	class	KX_GameObject* gameobj,
 				shapeInfo->SetMesh(meshobj, dm, false);
 			}
 
-			// Soft bodies require welding. Only avoid remove doubles for non-soft bodies!
+			// Soft bodies can benefit from welding, don't do it on non-soft bodies
 			if (objprop->m_softbody)
 			{
 				shapeInfo->setVertexWeldingThreshold1(objprop->m_soft_welding); //todo: expose this to the UI
@@ -344,7 +344,7 @@ void	KX_ConvertBulletObject(	class	KX_GameObject* gameobj,
 	ci.m_linearDamping = 1.f - shapeprops->m_lin_drag;
 	ci.m_angularDamping = 1.f - shapeprops->m_ang_drag;
 	//need a bit of damping, else system doesn't behave well
-	ci.m_inertiaFactor = shapeprops->m_inertia/0.4f;//defaults to 0.4, don't want to change behaviour
+	ci.m_inertiaFactor = shapeprops->m_inertia/0.4f;//defaults to 0.4, don't want to change behavior
 	
 	ci.m_do_anisotropic = shapeprops->m_do_anisotropic;
 	ci.m_anisotropicFriction.setValue(shapeprops->m_friction_scaling[0],shapeprops->m_friction_scaling[1],shapeprops->m_friction_scaling[2]);
@@ -353,7 +353,7 @@ void	KX_ConvertBulletObject(	class	KX_GameObject* gameobj,
 //////////
 	//do Fh, do Rot Fh
 	ci.m_do_fh = shapeprops->m_do_fh;
-	ci.m_do_rot_fh = shapeprops->m_do_rot_fh ;
+	ci.m_do_rot_fh = shapeprops->m_do_rot_fh;
 	ci.m_fh_damping = smmaterial->m_fh_damping;
 	ci.m_fh_distance = smmaterial->m_fh_distance;
 	ci.m_fh_normal = smmaterial->m_fh_normal;
@@ -464,7 +464,7 @@ void	KX_ConvertBulletObject(	class	KX_GameObject* gameobj,
 	
 	if (objprop->m_dyna && !objprop->m_angular_rigidbody)
 	{
-		/*
+#if 0
 		//setting the inertia could achieve similar results to constraint the up
 		//but it is prone to instability, so use special 'Angular' constraint
 		btVector3 inertia = physicscontroller->GetRigidBody()->getInvInertiaDiagLocal();
@@ -473,7 +473,7 @@ void	KX_ConvertBulletObject(	class	KX_GameObject* gameobj,
 
 		physicscontroller->GetRigidBody()->setInvInertiaDiagLocal(inertia);
 		physicscontroller->GetRigidBody()->updateInertiaTensor();
-		*/
+#endif
 
 		//env->createConstraint(physicscontroller,0,PHY_ANGULAR_CONSTRAINT,0,0,0,0,0,1);
 	
@@ -543,18 +543,18 @@ bool KX_ReInstanceBulletShapeFromMesh(KX_GameObject *gameobj, KX_GameObject *fro
 	CcdShapeConstructionInfo	*shapeInfo;
 
 	/* if this is the child of a compound shape this can happen
-	 * dont support compound shapes for now */
-	if(spc==NULL)
+	 * don't support compound shapes for now */
+	if (spc==NULL)
 		return false;
 	
 	shapeInfo = spc->GetShapeInfo();
 	
-	if(shapeInfo->m_shapeType != PHY_SHAPE_MESH/* || spc->GetSoftBody()*/)
+	if (shapeInfo->m_shapeType != PHY_SHAPE_MESH/* || spc->GetSoftBody()*/)
 		return false;
 	
 	spc->DeleteControllerShape();
 	
-	if(from_gameobj==NULL && from_meshobj==NULL)
+	if (from_gameobj==NULL && from_meshobj==NULL)
 		from_gameobj= gameobj;
 	
 	/* updates the arrays used for making the new bullet mesh */
diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp
index 4f959d9..eaabbdd 100644
--- a/source/gameengine/Ketsji/KX_Dome.cpp
+++ b/source/gameengine/Ketsji/KX_Dome.cpp
@@ -1,26 +1,26 @@
 /*
------------------------------------------------------------------------------
-
-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 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.
------------------------------------------------------------------------------
-*/
+ * -----------------------------------------------------------------------------
+ *
+ * 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 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.
+ * -----------------------------------------------------------------------------
+ */
 
 /** \file gameengine/Ketsji/KX_Dome.cpp
  *  \ingroup ketsji
@@ -95,9 +95,9 @@ KX_Dome::KX_Dome (
 
 	SetViewPort(viewport);
 
-	switch(m_mode){
+	switch(m_mode) {
 		case DOME_FISHEYE:
-			if (m_angle <= 180){
+			if (m_angle <= 180) {
 				cubetop.resize(1);
 				cubebottom.resize(1);
 				cubeleft.resize(2);
@@ -105,7 +105,7 @@ KX_Dome::KX_Dome (
 
 				CreateMeshDome180();
 				m_numfaces = 4;
-			}else if (m_angle > 180){
+			}else if (m_angle > 180) {
 				cubetop.resize(2);
 				cubebottom.resize(2);
 				cubeleft.resize(2);
@@ -132,7 +132,7 @@ KX_Dome::KX_Dome (
 			m_numfaces = 6;
 			break;
 		default: //DOME_TRUNCATED_FRONT and DOME_TRUNCATED_REAR
-			if (m_angle <= 180){
+			if (m_angle <= 180) {
 				cubetop.resize(1);
 				cubebottom.resize(1);
 				cubeleft.resize(2);
@@ -140,7 +140,7 @@ KX_Dome::KX_Dome (
 
 				CreateMeshDome180();
 				m_numfaces = 4;
-			}else if (m_angle > 180){
+			}else if (m_angle > 180) {
 				cubetop.resize(2);
 				cubebottom.resize(2);
 				cubeleft.resize(2);
@@ -158,7 +158,7 @@ KX_Dome::KX_Dome (
 
 	CreateGLImages();
 
-	if(warp.usemesh)
+	if (warp.usemesh)
 		fboSupported = CreateFBO();
 
 	dlistSupported = CreateDL();
@@ -169,16 +169,16 @@ KX_Dome::~KX_Dome (void)
 {
 	ClearGLImages();
 
-	if(fboSupported)
+	if (fboSupported)
 		glDeleteFramebuffersEXT(1, &warp.fboId);
 
-	if(dlistSupported)
+	if (dlistSupported)
 		glDeleteLists(dlistId, (GLsizei) m_numimages);
 }
 
 void KX_Dome::SetViewPort(GLuint viewport[4])
 {
-	if(canvaswidth != m_viewport.GetWidth() || canvasheight != m_viewport.GetHeight())
+	if (canvaswidth != m_viewport.GetWidth() || canvasheight != m_viewport.GetHeight())
 	{
 		m_viewport.SetLeft(viewport[0]); 
 		m_viewport.SetBottom(viewport[1]);
@@ -193,7 +193,7 @@ void KX_Dome::CreateGLImages(void)
 {
 	glGenTextures(m_numimages, (GLuint*)&domefacesId);
 
-	for (int j=0;j<m_numfaces;j++){
+	for (int j=0;j<m_numfaces;j++) {
 		glBindTexture(GL_TEXTURE_2D, domefacesId[j]);
 		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, m_imagesize, m_imagesize, 0, GL_RGB8,
 				GL_UNSIGNED_BYTE, 0);
@@ -203,7 +203,7 @@ void KX_Dome::CreateGLImages(void)
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
 	}
-	if(warp.usemesh){
+	if (warp.usemesh) {
 		glBindTexture(GL_TEXTURE_2D, domefacesId[m_numfaces]);
 		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, warp.imagesize, warp.imagesize, 0, GL_RGB8,
 				GL_UNSIGNED_BYTE, 0);
@@ -218,20 +218,20 @@ void KX_Dome::CreateGLImages(void)
 void KX_Dome::ClearGLImages(void)
 {
 	glDeleteTextures(m_numimages, (GLuint*)&domefacesId);
-/*
+#if 0
 	for (int i=0;i<m_numimages;i++)
-		if(glIsTexture(domefacesId[i]))
+		if (glIsTexture(domefacesId[i]))
 			glDeleteTextures(1, (GLuint*)&domefacesId[i]);
-*/
+#endif
 }
 
 void KX_Dome::CalculateImageSize(void)
 {
-/*
-- determine the minimum buffer size
-- reduce the buffer for better performace
-- create a power of 2 texture bigger than the buffer
-*/
+	/*
+	 * - determine the minimum buffer size
+	 * - reduce the buffer for better performance
+	 * - create a power of 2 texture bigger than the buffer
+	 */
 	canvaswidth = m_canvas->GetWidth();
 	canvasheight = m_canvas->GetHeight();
 
@@ -243,7 +243,7 @@ void KX_Dome::CalculateImageSize(void)
 		i++;
 	m_imagesize = (1 << i);
 
-	if (warp.usemesh){
+	if (warp.usemesh) {
 		// warp FBO needs to be up to twice as big as m_buffersize to get more resolution
 		warp.imagesize = m_imagesize;
 		if (m_buffersize == m_imagesize)
@@ -259,7 +259,7 @@ bool KX_Dome::CreateDL()
 {
 	dlistId = glGenLists((GLsizei) m_numimages);
 	if (dlistId != 0) {
-		if(m_mode == DOME_FISHEYE || m_mode == DOME_TRUNCATED_FRONT || m_mode == DOME_TRUNCATED_REAR){
+		if (m_mode == DOME_FISHEYE || m_mode == DOME_TRUNCATED_FRONT || m_mode == DOME_TRUNCATED_REAR) {
 			glNewList(dlistId, GL_COMPILE);
 				GLDrawTriangles(cubetop, nfacestop);
 			glEndList();
@@ -276,7 +276,7 @@ bool KX_Dome::CreateDL()
 				GLDrawTriangles(cuberight, nfacesright);
 			glEndList();
 
-			if (m_angle > 180){
+			if (m_angle > 180) {
 				glNewList(dlistId+4, GL_COMPILE);
 					GLDrawTriangles(cubefront, nfacesfront);
 				glEndList();
@@ -309,7 +309,7 @@ bool KX_Dome::CreateDL()
 			glEndList();
 		}
 
-		if(warp.usemesh){
+		if (warp.usemesh) {
 			glNewList((dlistId + m_numfaces), GL_COMPILE);
 				GLDrawWarpQuads();
 			glEndList();
@@ -340,7 +340,7 @@ bool KX_Dome::CreateFBO(void)
 	}
 
 	glGenFramebuffersEXT(1, &warp.fboId);
-	if(warp.fboId==0)
+	if (warp.fboId==0)
 	{
 		printf("Dome Error: Invalid frame buffer object. Using low resolution warp image.");
 		return false;
@@ -353,12 +353,12 @@ bool KX_Dome::CreateFBO(void)
 
 	GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
 
-	if(status == GL_FRAMEBUFFER_UNSUPPORTED_EXT)
+	if (status == GL_FRAMEBUFFER_UNSUPPORTED_EXT)
 	{
 		printf("Dome Error: FrameBuffer settings unsupported. Using low resolution warp image.");
 		return false;
 	}
-	else if(status != GL_FRAMEBUFFER_COMPLETE_EXT)
+	else if (status != GL_FRAMEBUFFER_COMPLETE_EXT)
 	{
 		glDeleteFramebuffersEXT(1, &warp.fboId);
 		return false;
@@ -391,11 +391,11 @@ void KX_Dome::GLDrawWarpQuads(void)
 	float uv_width = (float)(warp.bufferwidth) / warp.imagesize;
 	float uv_height = (float)(warp.bufferheight) / warp.imagesize;
 
-	if(warp.mode ==2 ){
+	if (warp.mode ==2 ) {
 		glBegin(GL_QUADS);
 		for (i=0;i<warp.n_height-1;i++) {
 			for (j=0;j<warp.n_width-1;j++) {
-				if(warp.nodes[i][j].i < 0 || warp.nodes[i+1][j].i < 0 || warp.nodes[i+1][j+1].i < 0 || warp.nodes[i][j+1].i < 0)
+				if (warp.nodes[i][j].i < 0 || warp.nodes[i+1][j].i < 0 || warp.nodes[i+1][j+1].i < 0 || warp.nodes[i][j+1].i < 0)
 					continue;
 
 				glColor3f(warp.nodes[i][j].i, warp.nodes[i][j].i, warp.nodes[i][j].i);
@@ -417,7 +417,7 @@ void KX_Dome::GLDrawWarpQuads(void)
 		}
 		glEnd();
 	}
-	else if (warp.mode == 1){
+	else if (warp.mode == 1) {
 		glBegin(GL_QUADS);
 		for (i=0;i<warp.n_height-1;i++) {
 			for (j=0;j<warp.n_width-1;j++) {
@@ -453,43 +453,43 @@ void KX_Dome::GLDrawWarpQuads(void)
 
 bool KX_Dome::ParseWarpMesh(STR_String text)
 {
-/*
-//Notes about the supported data format:
-File example::
-	mode
-	width height
-	n0_x n0_y n0_u n0_v n0_i
-	n1_x n1_y n1_u n1_v n1_i
-	n2_x n1_y n2_u n2_v n2_i
-	n3_x n3_y n3_u n3_v n3_i
-	(...)
-First line is the image type the mesh is support to be applied to: 2 = fisheye, 1=radial
-Tthe next line has the mesh dimensions
-Rest of the lines are the nodes of the mesh. Each line has x y u v i
-  (x,y) are the normalised screen coordinates
-  (u,v) texture coordinates
-  i a multiplicative intensity factor
-
-x varies from -screen aspect to screen aspect
-y varies from -1 to 1
-u and v vary from 0 to 1
-i ranges from 0 to 1, if negative don't draw that mesh node
-*/
+	/*
+	 * //Notes about the supported data format:
+	 * File example::
+	 * 	mode
+	 * 	width height
+	 * 	n0_x n0_y n0_u n0_v n0_i
+	 * 	n1_x n1_y n1_u n1_v n1_i
+	 * 	n2_x n1_y n2_u n2_v n2_i
+	 * 	n3_x n3_y n3_u n3_v n3_i
+	 * 	(...)
+	 * First line is the image type the mesh is support to be applied to: 2 = fisheye, 1=radial
+	 * Tthe next line has the mesh dimensions
+	 * Rest of the lines are the nodes of the mesh. Each line has x y u v i
+	 *   (x,y) are the normalised screen coordinates
+	 *   (u,v) texture coordinates
+	 *   i a multiplicative intensity factor
+	 *
+	 * x varies from -screen aspect to screen aspect
+	 * y varies from -1 to 1
+	 * u and v vary from 0 to 1
+	 * i ranges from 0 to 1, if negative don't draw that mesh node
+	 */
 	int i;
 	int nodeX=0, nodeY=0;
 
 	vector<STR_String> columns, lines;
 
 	lines = text.Explode('\n');
-	if(lines.size() < 6){
+	if (lines.size() < 6) {
 		printf("Dome Error: Warp Mesh File with insufficient data!\n");
 		return false;
 	}
 	columns = lines[1].Explode(' ');
-	if(columns.size() == 1)
+	if (columns.size() == 1)
 		columns = lines[1].Explode('\t');
 
-	if(columns.size() !=2){
+	if (columns.size() !=2) {
 		printf("Dome Error: Warp Mesh File incorrect. The second line should contain: width height.\n");
 		return false;
 	}
@@ -499,18 +499,18 @@ i ranges from 0 to 1, if negative don't draw that mesh node
 	warp.n_width = atoi(columns[0]);
 	warp.n_height = atoi(columns[1]);
 
-	if ((int)lines.size() < 2 + (warp.n_width * warp.n_height)){
+	if ((int)lines.size() < 2 + (warp.n_width * warp.n_height)) {
 		printf("Dome Error: Warp Mesh File with insufficient data!\n");
 		return false;
 	}else{
 		warp.nodes = vector<vector<WarpMeshNode> > (warp.n_height, vector<WarpMeshNode>(warp.n_width));
 
-		for(i=2; i-2 < (warp.n_width*warp.n_height); i++){
+		for (i=2; i-2 < (warp.n_width*warp.n_height); i++) {
 			columns = lines[i].Explode(' ');
-			if(columns.size() == 1)
+			if (columns.size() == 1)
 				columns = lines[i].Explode('\t');
 
-			if (columns.size() == 5){
+			if (columns.size() == 5) {
 				nodeX = (i-2)%warp.n_width;
 				nodeY = ((i-2) - nodeX) / warp.n_width;
 
@@ -532,16 +532,16 @@ i ranges from 0 to 1, if negative don't draw that mesh node
 
 void KX_Dome::CreateMeshDome180(void)
 {
-/*
-1)-  Define the faces of half of a cube 
- - each face is made out of 2 triangles
-2) Subdivide the faces
- - more resolution == more curved lines
-3) Spherize the cube
- - normalize the verts
-4) Flatten onto xz plane
- - transform it onto an equidistant spherical projection techniques to transform the sphere onto a dome image
-*/
+	/*
+	 * 1)-  Define the faces of half of a cube
+	 *  - each face is made out of 2 triangles
+	 * 2) Subdivide the faces
+	 *  - more resolution == more curved lines
+	 * 3) Spherize the cube
+	 *  - normalize the verts
+	 * 4) Flatten onto xz plane
+	 *  - transform it onto an equidistant spherical projection techniques to transform the sphere onto a dome image
+	 */
 	int i,j;
 	float uv_ratio = (float)(m_buffersize-1) / m_imagesize;
 
@@ -674,7 +674,7 @@ void KX_Dome::CreateMeshDome180(void)
 	//Refine a triangular mesh by bisecting each edge forms 3 new triangles for each existing triangle on each iteration
 	//Could be made more efficient for drawing if the triangles were ordered in a fan. Not that important since we are using DisplayLists
 
-	for(i=0;i<m_resolution;i++){
+	for (i=0;i<m_resolution;i++) {
 		cubetop.resize(4*nfacestop);
 		SplitFace(cubetop,&nfacestop);
 		cubebottom.resize(4*nfacesbottom);
@@ -686,41 +686,41 @@ void KX_Dome::CreateMeshDome180(void)
 	}		
 
 	// Turn into a hemisphere
-	for(j=0;j<3;j++){
-		for(i=0;i<nfacestop;i++)
+	for (j=0;j<3;j++) {
+		for (i=0;i<nfacestop;i++)
 			cubetop[i].verts[j].normalize();
-		for(i=0;i<nfacesbottom;i++)
+		for (i=0;i<nfacesbottom;i++)
 			cubebottom[i].verts[j].normalize();
-		for(i=0;i<nfacesleft;i++)
+		for (i=0;i<nfacesleft;i++)
 			cubeleft[i].verts[j].normalize();
-		for(i=0;i<nfacesright;i++)
+		for (i=0;i<nfacesright;i++)
 			cuberight[i].verts[j].normalize();
 	}
 
 	//flatten onto xz plane
-	for(i=0;i<nfacestop;i++)
+	for (i=0;i<nfacestop;i++)
 		FlattenDome(cubetop[i].verts);
-	for(i=0;i<nfacesbottom;i++)
+	for (i=0;i<nfacesbottom;i++)
 		FlattenDome(cubebottom[i].verts);
-	for(i=0;i<nfacesleft;i++)
+	for (i=0;i<nfacesleft;i++)
 		FlattenDome(cubeleft[i].verts);
-	for(i=0;i<nfacesright;i++)
+	for (i=0;i<nfacesright;i++)
 		FlattenDome(cuberight[i].verts);
 
 }
 
 void KX_Dome::CreateMeshDome250(void)
 {
-/*
-1)-  Define the faces of a cube without the back face
- - each face is made out of 2 triangles
-2) Subdivide the faces
- - more resolution == more curved lines
-3) Spherize the cube
- - normalize the verts
-4) Flatten onto xz plane
- - transform it onto an equidistant spherical projection techniques to transform the sphere onto a dome image
-*/
+	/*
+	 * 1)-  Define the faces of a cube without the back face
+	 *  - each face is made out of 2 triangles
+	 * 2) Subdivide the faces
+	 *  - more resolution == more curved lines
+	 * 3) Spherize the cube
+	 *  - normalize the verts
+	 * 4) Flatten onto xz plane
+	 *  - transform it onto an equidistant spherical projection techniques to transform the sphere onto a dome image
+	 */
 
 	int i,j;
 	float uv_height, uv_base;
@@ -730,20 +730,20 @@ void KX_Dome::CreateMeshDome250(void)
 	float uv_ratio = (float)(m_buffersize-1) / m_imagesize;
 
 	m_radangle = m_angle * M_PI/180.0;//calculates the radians angle, used for flattening
-/*
-verts_height is the exactly needed height of the cube faces (not always 1.0).
-When we want some horizontal information (e.g. for horizontal 220deg domes) we don't need to create and tesselate the whole cube.
-Therefore the lateral cube faces could be small, and the tesselate mesh would be completely used.
-(if we always worked with verts_height = 1.0, we would be discarding a lot of the calculated and tesselated geometry).
-
-So I came out with this formula:
-verts_height = tan((rad_ang/2) - (MT_PI/2))*sqrt(2.0);
-
-Here we take half the sphere(rad_ang/2) and subtract a quarter of it (MT_PI/2)
-Therefore we have the length in radians of the dome/sphere over the horizon.
-Once we take the tangent of that angle, you have the verts coordinate corresponding to the verts on the side faces.
-Then we need to multiply it by sqrt(2.0) to get the coordinate of the verts on the diagonal of the original cube.
-*/
+	/*
+	 * verts_height is the exactly needed height of the cube faces (not always 1.0).
+	 * When we want some horizontal information (e.g. for horizontal 220deg domes) we don't need to create and tessellate the whole cube.
+	 * Therefore the lateral cube faces could be small, and the tessellate mesh would be completely used.
+	 * (if we always worked with verts_height = 1.0, we would be discarding a lot of the calculated and tessellated geometry).
+	 *
+	 * So I came out with this formula:
+	 * verts_height = tan((rad_ang/2) - (MT_PI/2))*sqrt(2.0);
+	 *
+	 * Here we take half the sphere(rad_ang/2) and subtract a quarter of it (MT_PI/2)
+	 * Therefore we have the length in radians of the dome/sphere over the horizon.
+	 * Once we take the tangent of that angle, you have the verts coordinate corresponding to the verts on the side faces.
+	 * Then we need to multiply it by sqrt(2.0) to get the coordinate of the verts on the diagonal of the original cube.
+	 */
 	verts_height = tan((rad_ang/2) - (MT_PI/2))*M_SQRT2;
 
 	uv_height = uv_ratio * ((verts_height/2) + 0.5);
@@ -953,7 +953,7 @@ Then we need to multiply it by sqrt(2.0) to get the coordinate of the verts on t
 	//Refine a triangular mesh by bisecting each edge forms 3 new triangles for each existing triangle on each iteration
 	//It could be made more efficient for drawing if the triangles were ordered in a strip!
 
-	for(i=0;i<m_resolution;i++){
+	for (i=0;i<m_resolution;i++) {
 		cubefront.resize(4*nfacesfront);
 		SplitFace(cubefront,&nfacesfront);
 		cubetop.resize(4*nfacestop);
@@ -967,44 +967,44 @@ Then we need to multiply it by sqrt(2.0) to get the coordinate of the verts on t
 	}
 
 	// Turn into a hemisphere/sphere
-	for(j=0;j<3;j++){
-		for(i=0;i<nfacesfront;i++)
+	for (j=0;j<3;j++) {
+		for (i=0;i<nfacesfront;i++)
 			cubefront[i].verts[j].normalize();
-		for(i=0;i<nfacestop;i++)
+		for (i=0;i<nfacestop;i++)
 			cubetop[i].verts[j].normalize();
-		for(i=0;i<nfacesbottom;i++)
+		for (i=0;i<nfacesbottom;i++)
 			cubebottom[i].verts[j].normalize();
-		for(i=0;i<nfacesleft;i++)
+		for (i=0;i<nfacesleft;i++)
 			cubeleft[i].verts[j].normalize();
-		for(i=0;i<nfacesright;i++)
+		for (i=0;i<nfacesright;i++)
 			cuberight[i].verts[j].normalize();
 	}
 
 	//flatten onto xz plane
-	for(i=0;i<nfacesfront;i++)
+	for (i=0;i<nfacesfront;i++)
 		FlattenDome(cubefront[i].verts);	
-	for(i=0;i<nfacestop;i++)
+	for (i=0;i<nfacestop;i++)
 		FlattenDome(cubetop[i].verts);
-	for(i=0;i<nfacesbottom;i++)
+	for (i=0;i<nfacesbottom;i++)
 		FlattenDome(cubebottom[i].verts);
-	for(i=0;i<nfacesleft;i++)
+	for (i=0;i<nfacesleft;i++)
 		FlattenDome(cubeleft[i].verts);		
-	for(i=0;i<nfacesright;i++)
+	for (i=0;i<nfacesright;i++)
 		FlattenDome(cuberight[i].verts);
 }
 
 void KX_Dome::CreateMeshPanorama(void)
 {
-/*
-1)-  Define the faces of a cube without the top and bottom faces
- - each face is made out of 2 triangles
-2) Subdivide the faces
- - more resolution == more curved lines
-3) Spherize the cube
- - normalize the verts t
-4) Flatten onto xz plane
- - use spherical projection techniques to transform the sphere onto a flat panorama
-*/
+	/*
+	 * 1)-  Define the faces of a cube without the top and bottom faces
+	 *  - each face is made out of 2 triangles
+	 * 2) Subdivide the faces
+	 *  - more resolution == more curved lines
+	 * 3) Spherize the cube
+	 *  - normalize the verts t
+	 * 4) Flatten onto xz plane
+	 *  - use spherical projection techniques to transform the sphere onto a flat panorama
+	 */
 	int i,j;
 
 	float uv_ratio = (float)(m_buffersize-1) / m_imagesize;
@@ -1252,7 +1252,7 @@ void KX_Dome::CreateMeshPanorama(void)
 	nfacesrightback = 2;
 
 	// Subdivide the faces
-	for(i=0;i<m_resolution;i++)
+	for (i=0;i<m_resolution;i++)
 	{
 		cubetop.resize(4*nfacestop);
 		SplitFace(cubetop,&nfacestop);
@@ -1274,44 +1274,44 @@ void KX_Dome::CreateMeshPanorama(void)
 	}
 
 	// Spherize the cube
-	for(j=0;j<3;j++)
+	for (j=0;j<3;j++)
 	{
-		for(i=0;i<nfacestop;i++)
+		for (i=0;i<nfacestop;i++)
 			cubetop[i].verts[j].normalize();
 
-		for(i=0;i<nfacesbottom;i++)
+		for (i=0;i<nfacesbottom;i++)
 			cubebottom[i].verts[j].normalize();
 
-		for(i=0;i<nfacesleftback;i++)
+		for (i=0;i<nfacesleftback;i++)
 			cubeleftback[i].verts[j].normalize();
 
-		for(i=0;i<nfacesleft;i++)
+		for (i=0;i<nfacesleft;i++)
 			cubeleft[i].verts[j].normalize();
 
-		for(i=0;i<nfacesright;i++)
+		for (i=0;i<nfacesright;i++)
 			cuberight[i].verts[j].normalize();
 
-		for(i=0;i<nfacesrightback;i++)
+		for (i=0;i<nfacesrightback;i++)
 			cuberightback[i].verts[j].normalize();
 	}
 
 	//Flatten onto xz plane
-	for(i=0;i<nfacesleftback;i++)
+	for (i=0;i<nfacesleftback;i++)
 		FlattenPanorama(cubeleftback[i].verts);
 
-	for(i=0;i<nfacesleft;i++)
+	for (i=0;i<nfacesleft;i++)
 		FlattenPanorama(cubeleft[i].verts);
 
-	for(i=0;i<nfacesright;i++)
+	for (i=0;i<nfacesright;i++)
 		FlattenPanorama(cuberight[i].verts);
 
-	for(i=0;i<nfacesrightback;i++)
+	for (i=0;i<nfacesrightback;i++)
 		FlattenPanorama(cuberightback[i].verts);
 
-	for(i=0;i<nfacestop;i++)
+	for (i=0;i<nfacestop;i++)
 		FlattenPanorama(cubetop[i].verts);
 
-	for(i=0;i<nfacesbottom;i++)
+	for (i=0;i<nfacesbottom;i++)
 		FlattenPanorama(cubebottom[i].verts);
 }
 
@@ -1319,7 +1319,7 @@ void KX_Dome::FlattenDome(MT_Vector3 verts[3])
 {
 	double phi, r;
 
-	for (int i=0;i<3;i++){
+	for (int i=0;i<3;i++) {
 		r = atan2(sqrt(verts[i][0]*verts[i][0] + verts[i][2]*verts[i][2]), verts[i][1]);
 		r /= m_radangle/2;
 
@@ -1329,7 +1329,7 @@ void KX_Dome::FlattenDome(MT_Vector3 verts[3])
 		verts[i][1] = 0;
 		verts[i][2] = r * sin(phi);
 
-		if (r > 1.0){
+		if (r > 1.0) {
 		//round the border
 			verts[i][0] = cos(phi);
 			verts[i][1] = -3.0;
@@ -1342,10 +1342,10 @@ void KX_Dome::FlattenPanorama(MT_Vector3 verts[3])
 {
 // it creates a full spherical panoramic (360deg)
 	int i;
-	double phi;
+	double phi, theta;
 	bool edge=false;
 
-	for (i=0;i<3;i++){
+	for (i=0;i<3;i++) {
 		phi = atan2(verts[i][1], verts[i][0]);
 		phi *= -1.0; //flipping
 
@@ -1355,21 +1355,21 @@ void KX_Dome::FlattenPanorama(MT_Vector3 verts[3])
 		verts[i][0] = phi / MT_PI;
 		verts[i][1] = 0;
 
-		verts[i][2] = atan2(verts[i][2], 1.0);
-		verts[i][2] /= MT_PI / 2;
+		theta = asin(verts[i][2]);
+		verts[i][2] = theta / MT_PI;
 	}
-	if(edge){
+	if (edge) {
 		bool right=false;
 
-		for (i=0;i<3;i++){
-			if(fmod(verts[i][0],1.0) > 0.0){
+		for (i=0;i<3;i++) {
+			if (fmod(verts[i][0],1.0) > 0.0) {
 				right=true;
 				break;
 			}
 		}
-		if(right){
-			for (i=0;i<3;i++){
-				if(verts[i][0] < 0.0)
+		if (right) {
+			for (i=0;i<3;i++) {
+				if (verts[i][0] < 0.0)
 					verts[i][0] *= -1.0;
 			}
 		}
@@ -1383,7 +1383,7 @@ void KX_Dome::SplitFace(vector <DomeFace>& face, int *nfaces)
 
 	n1 = n2 = *nfaces;
 
-	for(i=0;i<n1;i++){
+	for (i=0;i<n1;i++) {
 
 		face[n2].verts[0] = (face[i].verts[0] + face[i].verts[1]) /2;
 		face[n2].verts[1] =  face[i].verts[1];
@@ -1415,13 +1415,13 @@ void KX_Dome::SplitFace(vector <DomeFace>& face, int *nfaces)
 		face[n2+2].v[1]	  = (face[i].v[1] + face[i].v[2]) /2;
 		face[n2+2].v[2]	  = (face[i].v[2] + face[i].v[0]) /2;		
 
-		//face[i].verts[0] = face[i].verts[0] ;
+		//face[i].verts[0] = face[i].verts[0];
 		face[i].verts[1] = (face[i].verts[0] + face[i].verts[1]) /2;
 		face[i].verts[2] = (face[i].verts[0] + face[i].verts[2]) /2;
 		//face[i].u[0]	 =  face[i].u[0];
 		face[i].u[1]	 = (face[i].u[0] + face[i].u[1]) /2;
 		face[i].u[2]	 = (face[i].u[0] + face[i].u[2]) /2;
-		//face[i].v[0]	 = face[i].v[0] ;
+		//face[i].v[0]	 = face[i].v[0];
 		face[i].v[1]	 = (face[i].v[0] + face[i].v[1]) /2;
 		face[i].v[2]	 = (face[i].v[0] + face[i].v[2]) /2;		
 
@@ -1432,10 +1432,10 @@ void KX_Dome::SplitFace(vector <DomeFace>& face, int *nfaces)
 
 void KX_Dome::CalculateFrustum(KX_Camera * cam)
 {
-	/*
+#if 0
 	// manually creating a 90deg Field of View Frustum 
 
-	the original formula:
+	// the original formula:
 	top = tan(fov*3.14159/360.0) * near [for fov in degrees]
 	fov*0.5 = arctan ((top-bottom)*0.5 / near) [for fov in radians]
 	bottom = -top
@@ -1446,7 +1446,7 @@ void KX_Dome::CalculateFrustum(KX_Camera * cam)
 	glMatrixMode(GL_PROJECTION);
 	glLoadIdentity();
 	gluPerspective(90.0,1.0,cam->GetCameraNear(),cam->GetCameraFar());
-	*/
+#endif
 
 	RAS_FrameFrustum m_frustrum; //90 deg. Frustum
 
@@ -1469,10 +1469,10 @@ void KX_Dome::CalculateFrustum(KX_Camera * cam)
 void KX_Dome::CalculateCameraOrientation()
 {
 /*
-Uses 4 cameras for angles up to 180deg
-Uses 5 cameras for angles up to 250deg
-Uses 6 cameras for angles up to 360deg
-*/
+ * Uses 4 cameras for angles up to 180deg
+ * Uses 5 cameras for angles up to 250deg
+ * Uses 6 cameras for angles up to 360deg
+ */
 	int i;
 	float deg45 = MT_PI / 4;
 	MT_Scalar c = cos(deg45);
@@ -1480,7 +1480,7 @@ Uses 6 cameras for angles up to 360deg
 
 	if (m_angle <= 180 && (m_mode == DOME_FISHEYE 
 		|| m_mode == DOME_TRUNCATED_FRONT
-		|| m_mode == DOME_TRUNCATED_REAR)){
+		|| m_mode == DOME_TRUNCATED_REAR)) {
 
 		m_locRot[0] = MT_Matrix3x3( // 90deg - Top
 						c, -s, 0.0,
@@ -1504,7 +1504,7 @@ Uses 6 cameras for angles up to 360deg
 
 	} else if (m_mode == DOME_ENVMAP || (m_angle > 180 && (m_mode == DOME_FISHEYE
 		|| m_mode == DOME_TRUNCATED_FRONT 
-		|| m_mode == DOME_TRUNCATED_REAR))){
+		|| m_mode == DOME_TRUNCATED_REAR))) {
 
 		m_locRot[0] = MT_Matrix3x3( // 90deg - Top
 						 1.0, 0.0, 0.0,
@@ -1536,7 +1536,7 @@ Uses 6 cameras for angles up to 360deg
 						 0.0, 1.0, 0.0,
 						 0.0, 0.0,-1.0);
 
-	} else if (m_mode == DOME_PANORAM_SPH){
+	} else if (m_mode == DOME_PANORAM_SPH) {
 
 		m_locRot[0] = MT_Matrix3x3( // Top 
 						c, s, 0.0,
@@ -1610,14 +1610,14 @@ void KX_Dome::RotateCamera(KX_Camera* cam, int i)
 void KX_Dome::Draw(void)
 {
 
-	if (fboSupported){
+	if (fboSupported) {
 		glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, warp.fboId);
 
 		glViewport(0,0,warp.imagesize, warp.imagesize);
 		glScissor(0,0,warp.imagesize, warp.imagesize);
 	}
 
-	switch(m_mode){
+	switch(m_mode) {
 		case DOME_FISHEYE:
 			DrawDomeFisheye();
 			break;
@@ -1635,9 +1635,9 @@ void KX_Dome::Draw(void)
 			break;
 	}
 
-	if(warp.usemesh)
+	if (warp.usemesh)
 	{
-		if(fboSupported)
+		if (fboSupported)
 		{
 			m_canvas->SetViewPort(0, 0, m_canvas->GetWidth(), m_canvas->GetHeight());
 			glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
@@ -1668,7 +1668,7 @@ void KX_Dome::DrawEnvMap(void)
 		glOrtho((-1.0), 1.0, (-0.66), 0.66, -20.0, 10.0); //stretch the image to reduce resolution lost
 
 	else {
-		if (can_width/3 <= can_height/2){
+		if (can_width/3 <= can_height/2) {
 			ortho_width = 1.0;
 			ortho_height = (float)can_height/can_width;
 		}else{
@@ -1793,12 +1793,12 @@ void KX_Dome::DrawDomeFisheye(void)
 
 	float ortho_width, ortho_height;
 
-	if(m_mode == DOME_FISHEYE) {
+	if (m_mode == DOME_FISHEYE) {
 		if (warp.usemesh)
 			glOrtho((-1.0), 1.0, (-1.0), 1.0, -20.0, 10.0); //stretch the image to reduce resolution lost
 
 		else {
-			if (can_width < can_height){
+			if (can_width < can_height) {
 				ortho_width = 1.0;
 				ortho_height = (float)can_height/can_width;
 			}else{
@@ -1809,16 +1809,16 @@ void KX_Dome::DrawDomeFisheye(void)
 			glOrtho((-ortho_width), ortho_width, (-ortho_height), ortho_height, -20.0, 10.0);
 		}
 	}
-	else if(m_mode == DOME_TRUNCATED_FRONT)
+	else if (m_mode == DOME_TRUNCATED_FRONT)
 	{
 		ortho_width = 1.0;
-		ortho_height = 2 * ((float)can_height/can_width) - 1.0 ;
+		ortho_height = 2 * ((float)can_height / can_width) - 1.0;
 
 		glOrtho((-ortho_width), ortho_width, (-ortho_height), ortho_width, -20.0, 10.0);
 	}
 	else { //m_mode == DOME_TRUNCATED_REAR
 		ortho_width = 1.0;
-		ortho_height = 2 * ((float)can_height/can_width) - 1.0 ;
+		ortho_height = 2 * ((float)can_height / can_width) - 1.0;
 
 		glOrtho((-ortho_width), ortho_width, (-ortho_width), ortho_height, -20.0, 10.0);
 	}
@@ -1829,7 +1829,7 @@ void KX_Dome::DrawDomeFisheye(void)
 	glLoadIdentity();
 	gluLookAt(0.0,-1.0,0.0, 0.0,0.0,0.0, 0.0,0.0,1.0);
 
-	if(m_drawingmode == RAS_IRasterizer::KX_WIREFRAME)
+	if (m_drawingmode == RAS_IRasterizer::KX_WIREFRAME)
 		glPolygonMode(GL_FRONT, GL_LINE);
 	else
 		glPolygonMode(GL_FRONT, GL_FILL);
@@ -1841,8 +1841,8 @@ void KX_Dome::DrawDomeFisheye(void)
 	glEnable(GL_TEXTURE_2D);
 	glColor3f(1.0,1.0,1.0);
 
-	if (dlistSupported){
-		for(i=0;i<m_numfaces;i++){
+	if (dlistSupported) {
+		for (i=0;i<m_numfaces;i++) {
 			glBindTexture(GL_TEXTURE_2D, domefacesId[i]);
 			glCallList(dlistId+i);
 		}
@@ -1864,7 +1864,7 @@ void KX_Dome::DrawDomeFisheye(void)
 		glBindTexture(GL_TEXTURE_2D, domefacesId[3]);
 		GLDrawTriangles(cuberight, nfacesright);
 
-		if (m_angle > 180){
+		if (m_angle > 180) {
 			// front triangle
 			glBindTexture(GL_TEXTURE_2D, domefacesId[4]);
 			GLDrawTriangles(cubefront, nfacesfront);
@@ -1894,7 +1894,7 @@ void KX_Dome::DrawPanorama(void)
 
 	else {
 		//using all the screen
-		if ((can_width / 2) <= (can_height)){
+		if ((can_width / 2) <= (can_height)) {
 			ortho_width = 1.0;
 			ortho_height = (float)can_height/can_width;
 		}else{
@@ -1911,7 +1911,7 @@ void KX_Dome::DrawPanorama(void)
 	glLoadIdentity();
 	gluLookAt(0.0,-1.0,0.0, 0.0,0.0,0.0, 0.0,0.0,1.0);
 
-	if(m_drawingmode == RAS_IRasterizer::KX_WIREFRAME)
+	if (m_drawingmode == RAS_IRasterizer::KX_WIREFRAME)
 		glPolygonMode(GL_FRONT, GL_LINE);
 	else
 		glPolygonMode(GL_FRONT, GL_FILL);
@@ -1923,8 +1923,8 @@ void KX_Dome::DrawPanorama(void)
 	glEnable(GL_TEXTURE_2D);
 	glColor3f(1.0,1.0,1.0);
 
-	if (dlistSupported){
-		for(i=0;i<m_numfaces;i++){
+	if (dlistSupported) {
+		for (i=0;i<m_numfaces;i++) {
 			glBindTexture(GL_TEXTURE_2D, domefacesId[i]);
 			glCallList(dlistId+i);
 		}
@@ -1979,7 +1979,7 @@ void KX_Dome::DrawDomeWarped(void)
 	glLoadIdentity();
 	gluLookAt(0.0, 0.0, 1.0, 0.0,0.0,0.0, 0.0,1.0,0.0);
 
-	if(m_drawingmode == RAS_IRasterizer::KX_WIREFRAME)
+	if (m_drawingmode == RAS_IRasterizer::KX_WIREFRAME)
 		glPolygonMode(GL_FRONT, GL_LINE);
 	else
 		glPolygonMode(GL_FRONT, GL_FILL);
@@ -1991,7 +1991,7 @@ void KX_Dome::DrawDomeWarped(void)
 	glEnable(GL_TEXTURE_2D);
 	glColor3f(1.0,1.0,1.0);
 
-	if (dlistSupported){
+	if (dlistSupported) {
 		glBindTexture(GL_TEXTURE_2D, domefacesId[m_numfaces]);
 		glCallList(dlistId + m_numfaces);
 	}
diff --git a/source/gameengine/Ketsji/KX_Dome.h b/source/gameengine/Ketsji/KX_Dome.h
index 0436e91..313d6fd 100644
--- a/source/gameengine/Ketsji/KX_Dome.h
+++ b/source/gameengine/Ketsji/KX_Dome.h
@@ -26,8 +26,8 @@ Developed as part of a Research and Development project for SAT - La Soci�t�
  *  \ingroup ketsji
  */
 
-#if !defined KX_DOME_H
-#define KX_DOME_H
+#ifndef __KX_DOME_H__
+#define __KX_DOME_H__
 
 #include "KX_Scene.h"
 #include "KX_Camera.h"
@@ -112,7 +112,7 @@ public:
 	int nfacestop, nfacesbottom, nfacesleft, nfacesright, nfacesfront, nfacesback;
 	int nfacesleftback, nfacesrightback;
 
-	int GetNumberRenders(){return m_numfaces;};
+	int GetNumberRenders() { return m_numfaces; }
 
 	void RenderDome(void);
 	void RenderDomeFrame(KX_Scene* scene, KX_Camera* cam, int i);
@@ -163,7 +163,7 @@ protected:
 	int m_numfaces;		// 4 to 6 depending on the kind of dome image
 	int m_numimages;	//numfaces +1 if we have warp mesh
 
-	short m_resolution;	//resolution to tesselate the mesh
+	short m_resolution;	//resolution to tessellate the mesh
 	short m_mode;		// the mode (truncated, warped, panoramic,...)
 	short m_angle;		//the angle of the fisheye
 	float m_radangle;	//the angle of the fisheye in radians
@@ -174,7 +174,7 @@ protected:
 
 	MT_Matrix4x4 m_projmat;
 
-	MT_Matrix3x3 m_locRot [6];// the rotation matrix
+	MT_Matrix3x3 m_locRot[6]; // the rotation matrix
 
 	/// rendered scene
 	KX_Scene * m_scene;
@@ -196,5 +196,4 @@ public:
 #endif
 };
 
-#endif
-
+#endif /* __KX_DOME_H__ */
diff --git a/source/gameengine/Ketsji/KX_EmptyObject.h b/source/gameengine/Ketsji/KX_EmptyObject.h
index 845a37f..7ad9984 100644
--- a/source/gameengine/Ketsji/KX_EmptyObject.h
+++ b/source/gameengine/Ketsji/KX_EmptyObject.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_EMPTYOBJECT
-#define  __KX_EMPTYOBJECT
+#ifndef __KX_EMPTYOBJECT_H__
+#define  __KX_EMPTYOBJECT_H__
 #include "KX_GameObject.h"
 
 class KX_EmptyObject : public KX_GameObject
@@ -49,5 +49,5 @@ public:
 #endif
 };
 
-#endif //__KX_EMPTYOBJECT
+#endif //__KX_EMPTYOBJECT_H__
 
diff --git a/source/gameengine/Ketsji/KX_FontObject.cpp b/source/gameengine/Ketsji/KX_FontObject.cpp
index 519ff97..308154d 100644
--- a/source/gameengine/Ketsji/KX_FontObject.cpp
+++ b/source/gameengine/Ketsji/KX_FontObject.cpp
@@ -60,7 +60,7 @@ std::vector<STR_String> split_string(STR_String str)
 	int begin=0, end=0;
 	while (end < str.Length())
 	{
-		if(str.GetAt(end) == '\n')
+		if (str.GetAt(end) == '\n')
 		{
 			text.push_back(str.Mid(begin, end-begin));
 			begin = end+1;
@@ -92,8 +92,8 @@ KX_FontObject::KX_FontObject(	void* sgReplicationInfo,
 	m_fontid = GetFontId(text->vfont);
 	
 	/* initialize the color with the object color and store it in the KX_Object class
-	   This is a workaround waiting for the fix:
-	   [#25487] BGE: Object Color only works when it has a keyed frame */
+	 * This is a workaround waiting for the fix:
+	 * [#25487] BGE: Object Color only works when it has a keyed frame */
 	copy_v4_v4(m_color, (const float*) ob->col);
 	this->SetObjectColor((const MT_Vector4&) m_color);
 }
@@ -104,7 +104,8 @@ KX_FontObject::~KX_FontObject()
 	//it's handled in KX_Scene::NewRemoveObject
 }
 
-CValue* KX_FontObject::GetReplica() {
+CValue* KX_FontObject::GetReplica()
+{
 	KX_FontObject* replica = new KX_FontObject(*this);
 	replica->ProcessReplica();
 	return replica;
@@ -116,7 +117,8 @@ void KX_FontObject::ProcessReplica()
 	KX_GetActiveScene()->AddFont(this);
 }
 
-int GetFontId (VFont *font) {
+int GetFontId (VFont *font)
+{
 	PackedFile *packedfile=NULL;
 	int fontid = -1;
 
@@ -163,11 +165,11 @@ int GetFontId (VFont *font) {
 void KX_FontObject::DrawText()
 {
 	/* Allow for some logic brick control */
-	if(this->GetProperty("Text"))
+	if (this->GetProperty("Text"))
 		m_text = split_string(this->GetProperty("Text")->GetText());
 
 	/* only draws the text if visible */
-	if(this->GetVisible() == 0) return;
+	if (this->GetVisible() == 0) return;
 
 	/* update the animated color */
 	this->GetObjectColor().getValue(m_color);
@@ -191,7 +193,7 @@ void KX_FontObject::DrawText()
 	spacing = this->NodeGetWorldOrientation() * spacing * this->NodeGetWorldScaling()[1];
 
 	/* Draw each line, taking spacing into consideration */
-	for(int i=0; i<m_text.size(); ++i)
+	for (int i=0; i<m_text.size(); ++i)
 	{
 		if (i!=0)
 		{
@@ -254,9 +256,9 @@ PyObject* KX_FontObject::pyattr_get_text(void *self_v, const KX_PYATTRIBUTE_DEF
 {
 	KX_FontObject* self= static_cast<KX_FontObject*>(self_v);
 	STR_String str = STR_String();
-	for(int i=0; i<self->m_text.size(); ++i)
+	for (int i=0; i<self->m_text.size(); ++i)
 	{
-		if(i!=0)
+		if (i!=0)
 			str += '\n';
 		str += self->m_text[i];
 	}
@@ -266,13 +268,13 @@ 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);
-	if(!PyUnicode_Check(value))
+	if (!PyUnicode_Check(value))
 		return PY_SET_ATTR_FAIL;
 	char* chars = _PyUnicode_AsString(value);
 
 	/* Allow for some logic brick control */
 	CValue* tprop = self->GetProperty("Text");
-	if(tprop) {
+	if (tprop) {
 		CValue *newstringprop = new CStringValue(STR_String(chars), "Text");
 		self->SetProperty("Text", newstringprop);
 		newstringprop->Release();
diff --git a/source/gameengine/Ketsji/KX_FontObject.h b/source/gameengine/Ketsji/KX_FontObject.h
index 958a6cd..affa882 100644
--- a/source/gameengine/Ketsji/KX_FontObject.h
+++ b/source/gameengine/Ketsji/KX_FontObject.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_FONTOBJECT
-#define  __KX_FONTOBJECT
+#ifndef __KX_FONTOBJECT_H__
+#define  __KX_FONTOBJECT_H__
 #include "KX_GameObject.h"
 #include "DNA_vfont_types.h"
 #include "RAS_IRenderTools.h"
@@ -69,13 +69,13 @@ protected:
 
 	class RAS_IRenderTools*	m_rendertools;	//needed for drawing routine
 
-/*
+#if 0 // WHY COMMENTED? - campbell
 #ifdef WITH_CXX_GUARDEDALLOC
 public:
 	void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_FontObject"); }
 	void operator delete( void *mem ) { MEM_freeN(mem); }
 #endif
-*/
+#endif
 
 #ifdef WITH_PYTHON
 	static PyObject*	pyattr_get_text(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
@@ -84,4 +84,4 @@ public:
 
 };
 
-#endif //__KX_FONTOBJECT
+#endif //__KX_FONTOBJECT_H__
diff --git a/source/gameengine/Ketsji/KX_GameActuator.h b/source/gameengine/Ketsji/KX_GameActuator.h
index ebc6712..8356bc1 100644
--- a/source/gameengine/Ketsji/KX_GameActuator.h
+++ b/source/gameengine/Ketsji/KX_GameActuator.h
@@ -30,8 +30,8 @@
  *  \brief actuator for global game stuff
  */
 
-#ifndef __KX_GAMEACTUATOR
-#define __KX_GAMEACTUATOR
+#ifndef __KX_GAMEACTUATOR_H__
+#define __KX_GAMEACTUATOR_H__
 
 #include "SCA_IActuator.h"
 
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index 023c3dc..c5145ef 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -31,7 +31,7 @@
  */
 
 
-#if defined(_WIN64)
+#if defined(_WIN64) && !defined(FREE_WINDOWS64)
 typedef unsigned __int64 uint_ptr;
 #else
 typedef unsigned long uint_ptr;
@@ -170,7 +170,7 @@ KX_GameObject::~KX_GameObject()
 	}
 #ifdef WITH_PYTHON
 	if (m_attr_dict) {
-		PyDict_Clear(m_attr_dict); /* incase of circular refs or other weird cases */
+		PyDict_Clear(m_attr_dict); /* in case of circular refs or other weird cases */
 		/* Py_CLEAR: Py_DECREF's and NULL's */
 		Py_CLEAR(m_attr_dict);
 	}
@@ -445,7 +445,7 @@ void KX_GameObject::ProcessReplica()
 	}
 
 #ifdef WITH_PYTHON
-	if(m_attr_dict)
+	if (m_attr_dict)
 		m_attr_dict= PyDict_Copy(m_attr_dict);
 #endif
 		
@@ -540,8 +540,8 @@ void KX_GameObject::ApplyRotation(const MT_Vector3& drot,bool local)
 
 
 /**
-GetOpenGL Matrix, returns an OpenGL 'compatible' matrix
-*/
+ * GetOpenGL Matrix, returns an OpenGL 'compatible' matrix
+ */
 double*	KX_GameObject::GetOpenGLMatrix()
 {
 	// todo: optimize and only update if necessary
@@ -588,7 +588,7 @@ void KX_GameObject::AddMeshUser()
 
 	SG_QList::iterator<RAS_MeshSlot> mit(m_meshSlots);
 //	RAS_MeshSlot* ms;
-	for(mit.begin(); !mit.end(); ++mit)
+	for (mit.begin(); !mit.end(); ++mit)
 	{
 		(*mit)->m_OpenGLMatrix = fl;
 	}
@@ -621,7 +621,7 @@ void KX_GameObject::UpdateBuckets( bool recursive )
 			GetOpenGLMatrix();
 
 		SG_QList::iterator<RAS_MeshSlot> mit(m_meshSlots);
-		for(mit.begin(); !mit.end(); ++mit)
+		for (mit.begin(); !mit.end(); ++mit)
 		{
 			ms = *mit;
 			ms->m_bObjectColor = m_bUseObjectColor;
@@ -742,11 +742,11 @@ KX_GameObject::UpdateMaterialData(
 	if (((unsigned int)mesh < m_meshes.size()) && mesh >= 0) {
 		list<RAS_MeshMaterial>::iterator mit = m_meshes[mesh]->GetFirstMaterial();
 
-		for(; mit != m_meshes[mesh]->GetLastMaterial(); ++mit)
+		for (; mit != m_meshes[mesh]->GetLastMaterial(); ++mit)
 		{
 			RAS_IPolyMaterial* poly = mit->m_bucket->GetPolyMaterial();
 
-			if(poly->GetFlag() & RAS_BLENDERMAT )
+			if (poly->GetFlag() & RAS_BLENDERMAT )
 			{
 				KX_BlenderMaterial *m =  static_cast<KX_BlenderMaterial*>(poly);
 				
@@ -890,7 +890,7 @@ void KX_GameObject::ResolveCombinedVelocities(
 	const MT_Vector3 & ang_vel,
 	bool lin_vel_local,
 	bool ang_vel_local
-){
+) {
 	if (m_pPhysicsController1)
 	{
 
@@ -1169,8 +1169,6 @@ void KX_GameObject::NodeSetWorldScale(const MT_Vector3& scale)
 			return; 
 		}
 
-		MT_Vector3 *local = new MT_Vector3(scale);
-
 		p_scale[0] = 1/p_scale[0];
 		p_scale[1] = 1/p_scale[1];
 		p_scale[2] = 1/p_scale[2];
@@ -1273,7 +1271,7 @@ const MT_Point3& KX_GameObject::NodeGetLocalPosition() const
 }
 
 
-/* Suspend/ resume: for the dynamic behaviour, there is a simple
+/* Suspend/ resume: for the dynamic behavior, there is a simple
  * method. For the residual motion, there is not. I wonder what the
  * correct solution is for Sumo. Remove from the motion-update tree?
  *
@@ -1284,7 +1282,7 @@ void KX_GameObject::Resume(void)
 {
 	if (m_suspended) {
 		SCA_IObject::Resume();
-		if(GetPhysicsController())
+		if (GetPhysicsController())
 			GetPhysicsController()->RestoreDynamics();
 
 		m_suspended = false;
@@ -1296,7 +1294,7 @@ void KX_GameObject::Suspend()
 	if ((!m_ignore_activity_culling) 
 		&& (!m_suspended))  {
 		SCA_IObject::Suspend();
-		if(GetPhysicsController())
+		if (GetPhysicsController())
 			GetPhysicsController()->SuspendDynamics();
 		m_suspended = true;
 	}
@@ -1376,12 +1374,12 @@ void KX_GameObject::Relink(CTR_Map<CTR_HashedPtr, void*> *map_parameter)
 #define MATHUTILS_VEC_CB_ANGVEL_LOCAL 9
 #define MATHUTILS_VEC_CB_ANGVEL_GLOBAL 10
 
-static int mathutils_kxgameob_vector_cb_index= -1; /* index for our callbacks */
+static unsigned char mathutils_kxgameob_vector_cb_index= -1; /* index for our callbacks */
 
 static int mathutils_kxgameob_generic_check(BaseMathObject *bmo)
 {
 	KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user);
-	if(self==NULL)
+	if (self==NULL)
 		return -1;
 	
 	return 0;
@@ -1390,7 +1388,7 @@ 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)
+	if (self==NULL)
 		return -1;
 
 #define PHYS_ERR(attr) PyErr_SetString(PyExc_AttributeError, "KX_GameObject." attr ", is missing a physics controller")
@@ -1409,26 +1407,26 @@ static int mathutils_kxgameob_vector_get(BaseMathObject *bmo, int subtype)
 			self->NodeGetWorldScaling().getValue(bmo->data);
 			break;
 		case MATHUTILS_VEC_CB_INERTIA_LOCAL:
-			if(!self->GetPhysicsController()) return PHYS_ERR("localInertia"), -1;
+			if (!self->GetPhysicsController()) return PHYS_ERR("localInertia"), -1;
 			self->GetPhysicsController()->GetLocalInertia().getValue(bmo->data);
 			break;
 		case MATHUTILS_VEC_CB_OBJECT_COLOR:
 			self->GetObjectColor().getValue(bmo->data);
 			break;
 		case MATHUTILS_VEC_CB_LINVEL_LOCAL:
-			if(!self->GetPhysicsController()) return PHYS_ERR("localLinearVelocity"), -1;
+			if (!self->GetPhysicsController()) return PHYS_ERR("localLinearVelocity"), -1;
 			self->GetLinearVelocity(true).getValue(bmo->data);
 			break;
 		case MATHUTILS_VEC_CB_LINVEL_GLOBAL:
-			if(!self->GetPhysicsController()) return PHYS_ERR("worldLinearVelocity"), -1;
+			if (!self->GetPhysicsController()) return PHYS_ERR("worldLinearVelocity"), -1;
 			self->GetLinearVelocity(false).getValue(bmo->data);
 			break;
 		case MATHUTILS_VEC_CB_ANGVEL_LOCAL:
-			if(!self->GetPhysicsController()) return PHYS_ERR("localLinearVelocity"), -1;
+			if (!self->GetPhysicsController()) return PHYS_ERR("localLinearVelocity"), -1;
 			self->GetAngularVelocity(true).getValue(bmo->data);
 			break;
 		case MATHUTILS_VEC_CB_ANGVEL_GLOBAL:
-			if(!self->GetPhysicsController()) return PHYS_ERR("worldLinearVelocity"), -1;
+			if (!self->GetPhysicsController()) return PHYS_ERR("worldLinearVelocity"), -1;
 			self->GetAngularVelocity(false).getValue(bmo->data);
 			break;
 			
@@ -1442,7 +1440,7 @@ 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)
+	if (self==NULL)
 		return -1;
 	
 	switch(subtype) {
@@ -1487,7 +1485,7 @@ static int mathutils_kxgameob_vector_set(BaseMathObject *bmo, int subtype)
 static int mathutils_kxgameob_vector_get_index(BaseMathObject *bmo, int subtype, int index)
 {
 	/* lazy, avoid repeteing the case statement */
-	if(mathutils_kxgameob_vector_get(bmo, subtype) == -1)
+	if (mathutils_kxgameob_vector_get(bmo, subtype) == -1)
 		return -1;
 	return 0;
 }
@@ -1497,7 +1495,7 @@ static int mathutils_kxgameob_vector_set_index(BaseMathObject *bmo, int subtype,
 	float f= bmo->data[index];
 	
 	/* lazy, avoid repeteing the case statement */
-	if(mathutils_kxgameob_vector_get(bmo, subtype) == -1)
+	if (mathutils_kxgameob_vector_get(bmo, subtype) == -1)
 		return -1;
 	
 	bmo->data[index]= f;
@@ -1516,12 +1514,12 @@ Mathutils_Callback mathutils_kxgameob_vector_cb = {
 #define MATHUTILS_MAT_CB_ORI_LOCAL 1
 #define MATHUTILS_MAT_CB_ORI_GLOBAL 2
 
-static int mathutils_kxgameob_matrix_cb_index= -1; /* index for our callbacks */
+static unsigned char mathutils_kxgameob_matrix_cb_index= -1; /* index for our callbacks */
 
 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)
+	if (self==NULL)
 		return -1;
 
 	switch(subtype) {
@@ -1540,7 +1538,7 @@ 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)
+	if (self==NULL)
 		return -1;
 	
 	MT_Matrix3x3 mat3x3;
@@ -1664,7 +1662,7 @@ PyAttributeDef KX_GameObject::Attributes[] = {
 	KX_PYATTRIBUTE_RO_FUNCTION("attrDict",	KX_GameObject, pyattr_get_attrDict),
 	KX_PYATTRIBUTE_RW_FUNCTION("color", KX_GameObject, pyattr_get_obcolor, pyattr_set_obcolor),
 	
-	/* Experemental, dont rely on these yet */
+	/* experimental, don't rely on these yet */
 	KX_PYATTRIBUTE_RO_FUNCTION("sensors",		KX_GameObject, pyattr_get_sensors),
 	KX_PYATTRIBUTE_RO_FUNCTION("controllers",	KX_GameObject, pyattr_get_controllers),
 	KX_PYATTRIBUTE_RO_FUNCTION("actuators",		KX_GameObject, pyattr_get_actuators),
@@ -1715,7 +1713,7 @@ PyObject* KX_GameObject::PyReinstancePhysicsMesh(PyObject* args)
 	}
 #ifdef USE_BULLET
 	/* gameobj and mesh can be NULL */
-	if(KX_ReInstanceBulletShapeFromMesh(this, gameobj, mesh))
+	if (KX_ReInstanceBulletShapeFromMesh(this, gameobj, mesh))
 		Py_RETURN_TRUE;
 #endif
 	Py_RETURN_FALSE;
@@ -1734,7 +1732,7 @@ static PyObject *Map_GetItem(PyObject *self_v, PyObject *item)
 	}
 	
 	/* first see if the attributes a string and try get the cvalue attribute */
-	if(attr_str && (resultattr=self->GetProperty(attr_str))) {
+	if (attr_str && (resultattr=self->GetProperty(attr_str))) {
 		pyconvert = resultattr->ConvertValueToPython();			
 		return pyconvert ? pyconvert:resultattr->GetProxy();
 	}
@@ -1747,7 +1745,7 @@ static PyObject *Map_GetItem(PyObject *self_v, PyObject *item)
 		return pyconvert;
 	}
 	else {
-		if(attr_str)	PyErr_Format(PyExc_KeyError, "value = gameOb[key]: KX_GameObject, key \"%s\" does not exist", attr_str);
+		if (attr_str)	PyErr_Format(PyExc_KeyError, "value = gameOb[key]: KX_GameObject, key \"%s\" does not exist", attr_str);
 		else			PyErr_SetString(PyExc_KeyError, "value = gameOb[key]: KX_GameObject, key does not exist");
 		return NULL;
 	}
@@ -1759,7 +1757,7 @@ static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val)
 {
 	KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(self_v);
 	const char *attr_str= _PyUnicode_AsString(key);
-	if(attr_str==NULL)
+	if (attr_str==NULL)
 		PyErr_Clear();
 	
 	if (self==NULL) {
@@ -1770,15 +1768,15 @@ static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val)
 	if (val==NULL) { /* del ob["key"] */
 		int del= 0;
 		
-		/* try remove both just incase */
-		if(attr_str)
+		/* try remove both just in case */
+		if (attr_str)
 			del |= (self->RemoveProperty(attr_str)==true) ? 1:0;
 		
-		if(self->m_attr_dict)
+		if (self->m_attr_dict)
 			del |= (PyDict_DelItem(self->m_attr_dict, key)==0) ? 1:0;
 		
 		if (del==0) {
-			if(attr_str)	PyErr_Format(PyExc_KeyError, "gameOb[key] = value: KX_GameObject, key \"%s\" could not be set", attr_str);
+			if (attr_str)	PyErr_Format(PyExc_KeyError, "gameOb[key] = value: KX_GameObject, key \"%s\" could not be set", attr_str);
 			else			PyErr_SetString(PyExc_KeyError, "del gameOb[key]: KX_GameObject, key could not be deleted");
 			return -1;
 		}
@@ -1790,11 +1788,11 @@ static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val)
 		int set= 0;
 		
 		/* as CValue */
-		if(attr_str && PyObject_TypeCheck(val, &PyObjectPlus::Type)==0) /* dont allow GameObjects for eg to be assigned to CValue props */
+		if (attr_str && PyObject_TypeCheck(val, &PyObjectPlus::Type)==0) /* don't allow GameObjects for eg to be assigned to CValue props */
 		{
 			CValue* vallie = self->ConvertPythonToValue(val, ""); /* error unused */
 			
-			if(vallie)
+			if (vallie)
 			{
 				CValue* oldprop = self->GetProperty(attr_str);
 				
@@ -1807,7 +1805,7 @@ static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val)
 				set= 1;
 				
 				/* try remove dict value to avoid double ups */
-				if (self->m_attr_dict){
+				if (self->m_attr_dict) {
 					if (PyDict_DelItem(self->m_attr_dict, key) != 0)
 						PyErr_Clear();
 				}
@@ -1817,25 +1815,25 @@ static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val)
 			}
 		}
 		
-		if(set==0)
+		if (set==0)
 		{
 			if (self->m_attr_dict==NULL) /* lazy init */
 				self->m_attr_dict= PyDict_New();
 			
 			
-			if(PyDict_SetItem(self->m_attr_dict, key, val)==0)
+			if (PyDict_SetItem(self->m_attr_dict, key, val)==0)
 			{
-				if(attr_str)
+				if (attr_str)
 					self->RemoveProperty(attr_str); /* overwrite the CValue if it exists */
 				set= 1;
 			}
 			else {
-				if(attr_str)	PyErr_Format(PyExc_KeyError, "gameOb[key] = value: KX_GameObject, key \"%s\" not be added to internal dictionary", attr_str);
+				if (attr_str)	PyErr_Format(PyExc_KeyError, "gameOb[key] = value: KX_GameObject, key \"%s\" not be added to internal dictionary", attr_str);
 				else			PyErr_SetString(PyExc_KeyError, "gameOb[key] = value: KX_GameObject, key not be added to internal dictionary");
 			}
 		}
 		
-		if(set==0)
+		if (set==0)
 			return -1; /* pythons error value */
 		
 	}
@@ -1852,7 +1850,7 @@ static int Seq_Contains(PyObject *self_v, PyObject *value)
 		return -1;
 	}
 	
-	if(PyUnicode_Check(value) && self->GetProperty(_PyUnicode_AsString(value)))
+	if (PyUnicode_Check(value) && self->GetProperty(_PyUnicode_AsString(value)))
 		return 1;
 	
 	if (self->m_attr_dict && PyDict_GetItem(self->m_attr_dict, value))
@@ -2408,7 +2406,7 @@ PyObject* KX_GameObject::pyattr_get_meshes(void *self_v, const KX_PYATTRIBUTE_DE
 	PyObject *meshes= PyList_New(self->m_meshes.size());
 	int i;
 	
-	for(i=0; i < (int)self->m_meshes.size(); i++)
+	for (i=0; i < (int)self->m_meshes.size(); i++)
 	{
 		KX_MeshProxy* meshproxy = new KX_MeshProxy(self->m_meshes[i]);
 		PyList_SET_ITEM(meshes, i, meshproxy->NewProxy(true));
@@ -2471,7 +2469,7 @@ PyObject* KX_GameObject::pyattr_get_attrDict(void *self_v, const KX_PYATTRIBUTE_
 {
 	KX_GameObject* self= static_cast<KX_GameObject*>(self_v);
 	
-	if(self->m_attr_dict==NULL)
+	if (self->m_attr_dict==NULL)
 		self->m_attr_dict= PyDict_New();
 	
 	Py_INCREF(self->m_attr_dict);
@@ -2655,7 +2653,7 @@ PyObject* KX_GameObject::PyGetReactionForce()
 
 PyObject* KX_GameObject::PyEnableRigidBody()
 {
-	if(GetPhysicsController())
+	if (GetPhysicsController())
 		GetPhysicsController()->setRigidBody(true);
 
 	Py_RETURN_NONE;
@@ -2665,7 +2663,7 @@ PyObject* KX_GameObject::PyEnableRigidBody()
 
 PyObject* KX_GameObject::PyDisableRigidBody()
 {
-	if(GetPhysicsController())
+	if (GetPhysicsController())
 		GetPhysicsController()->setRigidBody(false);
 
 	Py_RETURN_NONE;
@@ -2808,7 +2806,7 @@ PyObject* KX_GameObject::PyGetPropertyNames()
 {
 	PyObject *list= ConvertKeysToPython();
 	
-	if(m_attr_dict) {
+	if (m_attr_dict) {
 		PyObject *key, *value;
 		Py_ssize_t pos = 0;
 
@@ -2903,7 +2901,7 @@ bool KX_GameObject::RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void
 }
 
 /* this function is used to pre-filter the object before casting the ray on them.
-   This is useful for "X-Ray" option when we want to see "through" unwanted object.
+ * This is useful for "X-Ray" option when we want to see "through" unwanted object.
  */
 bool KX_GameObject::NeedRayCast(KX_ClientObjectInfo* client)
 {
@@ -3313,11 +3311,11 @@ PyObject* KX_GameObject::Pyget(PyObject *args)
 		return NULL;
 	
 	
-	if(PyUnicode_Check(key)) {
+	if (PyUnicode_Check(key)) {
 		CValue *item = GetProperty(_PyUnicode_AsString(key));
 		if (item) {
 			ret = item->ConvertValueToPython();
-			if(ret)
+			if (ret)
 				return ret;
 			else
 				return item->GetProxy();
diff --git a/source/gameengine/Ketsji/KX_GameObject.h b/source/gameengine/Ketsji/KX_GameObject.h
index a35e6f1..a173ef1 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -30,8 +30,8 @@
  *  \brief General KX game object.
  */
 
-#ifndef __KX_GAMEOBJECT
-#define __KX_GAMEOBJECT
+#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
@@ -155,7 +155,7 @@ public:
 	);
 
 	/**
-	 * Compute an OpenGl compatable 4x4 matrix. Has the
+	 * Compute an OpenGl compatible 4x4 matrix. Has the
 	 * side effect of storing the result internally. The
 	 * memory for the matrix remains the property of this class.
 	 */ 
@@ -284,7 +284,7 @@ public:
 	);
 
 	/** 
-	 * @section Stuff which is here due to poor design.
+	 * \section Stuff which is here due to poor design.
 	 * Inherited from CValue and needs an implementation. 
 	 * Do not expect these functions do to anything sensible.
 	 */
@@ -324,7 +324,7 @@ public:
 	);
 
 	/**
-	 * @section Inherited from CValue. These are the useful
+	 * \section Inherited from CValue. These are the useful
 	 * part of the CValue interface that this class implements. 
 	 */
 
@@ -428,10 +428,10 @@ public:
 	);
 
 	/**
-	 * @return a pointer to the physics controller owned by this class.
+	 * \return a pointer to the physics controller owned by this class.
 	 */
 
-	KX_IPhysicsController* GetPhysicsController() ;
+	KX_IPhysicsController* GetPhysicsController();
 
 	void	SetPhysicsController(KX_IPhysicsController*	physicscontroller,bool isDynamic) 
 	{ 
@@ -449,7 +449,7 @@ public:
 	}
 
 	/**
-	 * @return a pointer to the graphic controller owner by this class 
+	 * \return a pointer to the graphic controller owner by this class 
 	 */
 	PHY_IGraphicController* GetGraphicController()
 	{
@@ -466,7 +466,7 @@ public:
 	void ActivateGraphicController(bool recurse);
 
 	/**
-	 * @section Coordinate system manipulation functions
+	 * \section Coordinate system manipulation functions
 	 */
 
 	void	NodeSetLocalPosition(const MT_Point3& trans	);
@@ -496,7 +496,7 @@ public:
 	const MT_Point3& NodeGetLocalPosition(  ) const;
 
 	/**
-	 * @section scene graph node accessor functions.
+	 * \section scene graph node accessor functions.
 	 */
 
 	SG_Node*	GetSGNode(	) 
@@ -510,7 +510,7 @@ public:
 	}
 
 	/**
-	 * @section blender object accessor functions.
+	 * \section blender object accessor functions.
 	 */
 
 	struct Object* GetBlenderObject( )
@@ -518,7 +518,7 @@ public:
 		return m_pBlenderObject;
 	}
 
-	void SetBlenderObject( struct Object* obj)
+	void SetBlenderObject(struct Object* obj)
 	{
 		m_pBlenderObject = obj;
 	}
@@ -528,7 +528,7 @@ public:
 		return m_pBlenderGroupObject;
 	}
 
-	void SetBlenderGroupObject( struct Object* obj)
+	void SetBlenderGroupObject(struct Object* obj)
 	{
 		m_pBlenderGroupObject = obj;
 	}
@@ -572,7 +572,7 @@ public:
 
 
 	/**
-	 * @section Physics accessors for this node.
+	 * \section Physics accessors for this node.
 	 *
 	 * All these calls get passed directly to the physics controller 
 	 * owned by this object.
@@ -673,7 +673,7 @@ public:
 	);
 
 	/**
-	 * @section Mesh accessor functions.
+	 * \section Mesh accessor functions.
 	 */
 
 	/**	
@@ -829,7 +829,7 @@ public:
 	) { return m_bIsNegativeScaling; }
 
 	/**
-	 * @section Logic bubbling methods.
+	 * \section Logic bubbling methods.
 	 */
 
 	/**
@@ -885,7 +885,7 @@ public:
 
 #ifdef WITH_PYTHON
 	/**
-	 * @section Python interface functions.
+	 * \section Python interface functions.
 	 */
 	virtual PyObject* py_repr(void)
 	{
@@ -995,7 +995,7 @@ public:
 	static PyObject*	pyattr_get_obcolor(void *selv_v, const KX_PYATTRIBUTE_DEF *attrdef);
 	static int			pyattr_set_obcolor(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
 	
-	/* Experemental! */
+	/* Experimental! */
 	static PyObject*	pyattr_get_sensors(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
 	static PyObject*	pyattr_get_controllers(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
 	static PyObject*	pyattr_get_actuators(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
@@ -1008,5 +1008,5 @@ public:
 
 
 
-#endif //__KX_GAMEOBJECT
+#endif //__KX_GAMEOBJECT_H__
 
diff --git a/source/gameengine/Ketsji/KX_IInterpolator.h b/source/gameengine/Ketsji/KX_IInterpolator.h
index ed84396..2e30d77 100644
--- a/source/gameengine/Ketsji/KX_IInterpolator.h
+++ b/source/gameengine/Ketsji/KX_IInterpolator.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef KX_IINTERPOLATOR_H
-#define KX_IINTERPOLATOR_H
+#ifndef __KX_IINTERPOLATOR_H__
+#define __KX_IINTERPOLATOR_H__
 
 #include <vector>
 
diff --git a/source/gameengine/Ketsji/KX_IPOTransform.h b/source/gameengine/Ketsji/KX_IPOTransform.h
index c028b4c..43019f3 100644
--- a/source/gameengine/Ketsji/KX_IPOTransform.h
+++ b/source/gameengine/Ketsji/KX_IPOTransform.h
@@ -30,8 +30,8 @@
  *  \brief An abstract object you can move around in a 3d world, and has some logic
  */
 
-#ifndef KX_IPOTRANSFORM_H
-#define KX_IPOTRANSFORM_H
+#ifndef __KX_IPOTRANSFORM_H__
+#define __KX_IPOTRANSFORM_H__
 
 #include "MT_Transform.h"
 
diff --git a/source/gameengine/Ketsji/KX_IPO_SGController.cpp b/source/gameengine/Ketsji/KX_IPO_SGController.cpp
index 728d0fb..950e3c8 100644
--- a/source/gameengine/Ketsji/KX_IPO_SGController.cpp
+++ b/source/gameengine/Ketsji/KX_IPO_SGController.cpp
@@ -31,7 +31,7 @@
  */
 
 
-#if defined(_WIN64)
+#if defined(_WIN64) && !defined(FREE_WINDOWS64)
 typedef unsigned __int64 uint_ptr;
 #else
 typedef unsigned long uint_ptr;
diff --git a/source/gameengine/Ketsji/KX_IPO_SGController.h b/source/gameengine/Ketsji/KX_IPO_SGController.h
index f7e5701..3abcaa3 100644
--- a/source/gameengine/Ketsji/KX_IPO_SGController.h
+++ b/source/gameengine/Ketsji/KX_IPO_SGController.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __IPO_SGCONTROLLER_H
-#define __IPO_SGCONTROLLER_H
+#ifndef __KX_IPO_SGCONTROLLER_H__
+#define __KX_IPO_SGCONTROLLER_H__
 
 #include "SG_Controller.h"
 #include "SG_Spatial.h"
@@ -127,6 +127,6 @@ public:
 #endif
 };
 
-#endif //__IPO_SGCONTROLLER_H
+#endif //__KX_IPO_SGCONTROLLER_H__
 
 
diff --git a/source/gameengine/Ketsji/KX_IPhysicsController.cpp b/source/gameengine/Ketsji/KX_IPhysicsController.cpp
index 62e3c34..bd75246 100644
--- a/source/gameengine/Ketsji/KX_IPhysicsController.cpp
+++ b/source/gameengine/Ketsji/KX_IPhysicsController.cpp
@@ -1,6 +1,4 @@
 /*
- * @file KX_IPhysicsController.cpp
- *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -48,5 +46,3 @@ KX_IPhysicsController::KX_IPhysicsController(bool dyna, bool sensor, bool compou
 KX_IPhysicsController::~KX_IPhysicsController()
 {
 }
-
-
diff --git a/source/gameengine/Ketsji/KX_IPhysicsController.h b/source/gameengine/Ketsji/KX_IPhysicsController.h
index 2d08ef3..68577f0 100644
--- a/source/gameengine/Ketsji/KX_IPhysicsController.h
+++ b/source/gameengine/Ketsji/KX_IPhysicsController.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_IPHYSICSCONTROLLER_H
-#define __KX_IPHYSICSCONTROLLER_H
+#ifndef __KX_IPHYSICSCONTROLLER_H__
+#define __KX_IPHYSICSCONTROLLER_H__
 
 #include "SG_Controller.h"
 #include "MT_Vector3.h"
@@ -41,11 +41,11 @@
 struct KX_ClientObjectInfo;
 
 /**
-	Physics Controller, a special kind of Scene Graph Transformation Controller.
-	It get's callbacks from Physics in case a transformation change took place.
-	Each time the scene graph get's updated, the controller get's a chance
-	in the 'Update' method to reflect changed.
-*/
+ * Physics Controller, a special kind of Scene Graph Transformation Controller.
+ * It get's callbacks from Physics in case a transformation change took place.
+ * Each time the scene graph get's updated, the controller get's a chance
+ * in the 'Update' method to reflect changed.
+ */
 
 class KX_IPhysicsController : public SG_Controller
 							 
@@ -138,5 +138,5 @@ public:
 #endif
 };
 
-#endif //__KX_IPHYSICSCONTROLLER_H
+#endif //__KX_IPHYSICSCONTROLLER_H__
 
diff --git a/source/gameengine/Ketsji/KX_IScalarInterpolator.h b/source/gameengine/Ketsji/KX_IScalarInterpolator.h
index 0ac765a..72842f3 100644
--- a/source/gameengine/Ketsji/KX_IScalarInterpolator.h
+++ b/source/gameengine/Ketsji/KX_IScalarInterpolator.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef KX_ISCALARINTERPOLATOR_H
-#define KX_ISCALARINTERPOLATOR_H
+#ifndef __KX_ISCALARINTERPOLATOR_H__
+#define __KX_ISCALARINTERPOLATOR_H__
 
 #ifdef WITH_CXX_GUARDEDALLOC
 #include "MEM_guardedalloc.h"
diff --git a/source/gameengine/Ketsji/KX_ISceneConverter.h b/source/gameengine/Ketsji/KX_ISceneConverter.h
index 5afdaa9..5039000 100644
--- a/source/gameengine/Ketsji/KX_ISceneConverter.h
+++ b/source/gameengine/Ketsji/KX_ISceneConverter.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_ISCENECONVERTER_H
-#define __KX_ISCENECONVERTER_H
+#ifndef __KX_ISCENECONVERTER_H__
+#define __KX_ISCENECONVERTER_H__
 
 #include "STR_String.h"
 #include "KX_Python.h"
@@ -49,11 +49,11 @@ public:
 	virtual ~KX_ISceneConverter () {};
 
 	/*
-	scenename: name of the scene to be converted,
-		if the scenename is empty, convert the 'default' scene (whatever this means)
-	destinationscene: pass an empty scene, everything goes into this
-	dictobj: python dictionary (for pythoncontrollers)
-	*/
+	 * scenename: name of the scene to be converted,
+	 * if the scenename is empty, convert the 'default' scene (whatever this means)
+	 * destinationscene: pass an empty scene, everything goes into this
+	 * dictobj: python dictionary (for pythoncontrollers)
+	 */
 	virtual void ConvertScene(
 		class KX_Scene* destinationscene,
 		class RAS_IRenderTools* rendertools, 
@@ -95,5 +95,5 @@ public:
 #endif
 };
 
-#endif //__KX_ISCENECONVERTER_H
+#endif //__KX_ISCENECONVERTER_H__
 
diff --git a/source/gameengine/Ketsji/KX_ISystem.h b/source/gameengine/Ketsji/KX_ISystem.h
index d0a5149..4a6f722 100644
--- a/source/gameengine/Ketsji/KX_ISystem.h
+++ b/source/gameengine/Ketsji/KX_ISystem.h
@@ -30,8 +30,8 @@
  *  \brief Abstract system
  */
 
-#ifndef __KX_ISYSTEM
-#define __KX_ISYSTEM
+#ifndef __KX_ISYSTEM_H__
+#define __KX_ISYSTEM_H__
 
 #include <vector>
 using namespace std;
diff --git a/source/gameengine/Ketsji/KX_IpoActuator.cpp b/source/gameengine/Ketsji/KX_IpoActuator.cpp
index e0cd972..9777eaf 100644
--- a/source/gameengine/Ketsji/KX_IpoActuator.cpp
+++ b/source/gameengine/Ketsji/KX_IpoActuator.cpp
@@ -282,13 +282,13 @@ bool KX_IpoActuator::Update(double curtime, bool frame)
 	}
 	case KX_ACT_IPO_LOOPEND:
 	{
-		if (numevents){
-			if (bNegativeEvent && m_bIpoPlaying){
+		if (numevents) {
+			if (bNegativeEvent && m_bIpoPlaying) {
 				m_bNegativeEvent = true;
 			}
 		}
 		
-		if (bNegativeEvent && !m_bIpoPlaying){
+		if (bNegativeEvent && !m_bIpoPlaying) {
 			result = false;
 		} 
 		else
@@ -298,7 +298,7 @@ bool KX_IpoActuator::Update(double curtime, bool frame)
 				SetLocalTime(curtime);
 			}
 			else{
-				if (!m_bNegativeEvent){
+				if (!m_bNegativeEvent) {
 					/* Perform wraparound */
 					SetLocalTime(curtime);
 					if (start_smaller_then_end > 0.f)
diff --git a/source/gameengine/Ketsji/KX_IpoActuator.h b/source/gameengine/Ketsji/KX_IpoActuator.h
index 6b172ba..58cdfc2 100644
--- a/source/gameengine/Ketsji/KX_IpoActuator.h
+++ b/source/gameengine/Ketsji/KX_IpoActuator.h
@@ -30,8 +30,8 @@
  *  \brief Do an object ipo
  */
 
-#ifndef __KX_IPOACTUATOR
-#define __KX_IPOACTUATOR
+#ifndef __KX_IPOACTUATOR_H__
+#define __KX_IPOACTUATOR_H__
 
 #include "SCA_IActuator.h"
 
@@ -40,13 +40,13 @@ class KX_IpoActuator : public SCA_IActuator
 	Py_Header
 private:
 	/** Computes the IPO start time from the current time
-	    and the current frame. */
+	 *  and the current frame. */
 	void SetStartTime(float curtime);
 	/** Computes the current frame from the current time
-	    and the IPO start time. */
+	 *  and the IPO start time. */
 	void SetLocalTime(float curtime);
 	/** Ensures the current frame is between the start and
-	    end frames. */
+	 *  end frames. */
 	bool ClampLocalTime();
 
 protected:
@@ -150,5 +150,5 @@ public:
 	
 };
 
-#endif //__KX_IPOACTUATOR
+#endif //__KX_IPOACTUATOR_H__
 
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index 29727dc..dbcfe79 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
@@ -194,7 +194,7 @@ KX_KetsjiEngine::KX_KetsjiEngine(KX_ISystem* system)
 KX_KetsjiEngine::~KX_KetsjiEngine()
 {
 	delete m_logger;
-	if(m_usedome)
+	if (m_usedome)
 		delete m_dome;
 }
 
@@ -300,7 +300,7 @@ void KX_KetsjiEngine::RenderDome()
 	KX_Scene* scene;
 
 	int n_renders=m_dome->GetNumberRenders();// usually 4 or 6
-	for (int i=0;i<n_renders;i++){
+	for (int i=0;i<n_renders;i++) {
 		m_canvas->ClearBuffer(RAS_ICanvas::COLOR_BUFFER|RAS_ICanvas::DEPTH_BUFFER);
 		for (sceneit = m_scenes.begin();sceneit != m_scenes.end(); sceneit++)
 		// for each scene, call the proceed functions
@@ -313,11 +313,11 @@ void KX_KetsjiEngine::RenderDome()
 			SetWorldSettings(scene->GetWorldInfo());
 
 			// shadow buffers
-			if (i == 0){
+			if (i == 0) {
 				RenderShadowBuffers(scene);
 			}
 			// Avoid drawing the scene with the active camera twice when it's viewport is enabled
-			if(cam && !cam->GetViewport())
+			if (cam && !cam->GetViewport())
 			{
 				if (scene->IsClearingZBuffer())
 					m_rasterizer->ClearDepthBuffer();
@@ -336,7 +336,7 @@ void KX_KetsjiEngine::RenderDome()
 			list<KX_Camera*>::iterator it = cameras->begin();
 			while(it != cameras->end())
 			{
-				if((*it)->GetViewport())
+				if ((*it)->GetViewport())
 				{
 					if (scene->IsClearingZBuffer())
 						m_rasterizer->ClearDepthBuffer();
@@ -393,7 +393,7 @@ void KX_KetsjiEngine::RenderDome()
 }
 
 /**
- * Ketsji Init(), Initializes datastructures and converts data from
+ * Ketsji Init(), Initializes data-structures and converts data from
  * Blender into Ketsji native (realtime) format also sets up the
  * graphics context
  */
@@ -431,7 +431,7 @@ void KX_KetsjiEngine::StartEngine(bool clearIpo)
 void KX_KetsjiEngine::ClearFrame()
 {
 	// clear unless we're drawing overlapping stereo
-	if(m_rasterizer->InterlacedStereo() &&
+	if (m_rasterizer->InterlacedStereo() &&
 		m_rasterizer->GetEye() == RAS_IRasterizer::RAS_STEREO_RIGHTEYE)
 		return;
 
@@ -447,29 +447,29 @@ void KX_KetsjiEngine::ClearFrame()
 		list<class KX_Camera*>* cameras = scene->GetCameras();
 
 		list<KX_Camera*>::iterator it;
-		for(it = cameras->begin(); it != cameras->end(); it++)
+		for (it = cameras->begin(); it != cameras->end(); it++)
 		{
 			GetSceneViewport(scene, (*it), area, viewport);
 
-			if(!doclear) {
+			if (!doclear) {
 				clearvp = viewport;
 				doclear = true;
 			}
 			else {
-				if(viewport.GetLeft() < clearvp.GetLeft())
+				if (viewport.GetLeft() < clearvp.GetLeft())
 					clearvp.SetLeft(viewport.GetLeft());
-				if(viewport.GetBottom() < clearvp.GetBottom())
+				if (viewport.GetBottom() < clearvp.GetBottom())
 					clearvp.SetBottom(viewport.GetBottom());
-				if(viewport.GetRight() > clearvp.GetRight())
+				if (viewport.GetRight() > clearvp.GetRight())
 					clearvp.SetRight(viewport.GetRight());
-				if(viewport.GetTop() > clearvp.GetTop())
+				if (viewport.GetTop() > clearvp.GetTop())
 					clearvp.SetTop(viewport.GetTop());
 
 			}
 		}
 	}
 
-	if(doclear) {
+	if (doclear) {
 		KX_Scene* firstscene = *m_scenes.begin();
 		SetBackGround(firstscene->GetWorldInfo());
 
@@ -599,9 +599,9 @@ else
 			KX_Scene* scene = *sceneit;
 	
 			/* Suspension holds the physics and logic processing for an
-			* entire scene. Objects can be suspended individually, and
-			* the settings for that preceed the logic and physics
-			* update. */
+			 * entire scene. Objects can be suspended individually, and
+			 * the settings for that preceed the logic and physics
+			 * update. */
 			m_logger->StartLog(tc_logic, m_kxsystem->GetTimeInSeconds(), true);
 
 			m_sceneconverter->resetNoneDynamicObjectToIpo();//this is for none dynamic objects with ipo
@@ -694,7 +694,7 @@ else
 				scene->setSuspendedTime(0.0);
 			} // suspended
 			else
-				if(scene->getSuspendedTime()==0.0)
+				if (scene->getSuspendedTime()==0.0)
 					scene->setSuspendedTime(m_clockTime);
 			
 			m_logger->StartLog(tc_services, m_kxsystem->GetTimeInSeconds(), true);
@@ -768,7 +768,7 @@ else
 				scene->setSuspendedTime(0.0);
 			} // suspended
 			else
-				if(scene->getSuspendedTime()==0.0)
+				if (scene->getSuspendedTime()==0.0)
 					scene->setSuspendedTime(m_clockTime);
 
 			m_logger->StartLog(tc_services, m_kxsystem->GetTimeInSeconds(), true);
@@ -806,7 +806,7 @@ else
 
 void KX_KetsjiEngine::Render()
 {
-	if(m_usedome){
+	if (m_usedome) {
 		RenderDome();
 		return;
 	}
@@ -872,7 +872,7 @@ void KX_KetsjiEngine::Render()
 		RenderShadowBuffers(scene);
 
 		// Avoid drawing the scene with the active camera twice when it's viewport is enabled
-		if(cam && !cam->GetViewport())
+		if (cam && !cam->GetViewport())
 		{
 			if (scene->IsClearingZBuffer())
 				m_rasterizer->ClearDepthBuffer();
@@ -889,7 +889,7 @@ void KX_KetsjiEngine::Render()
 		list<KX_Camera*>::iterator it = cameras->begin();
 		while(it != cameras->end())
 		{
-			if((*it)->GetViewport())
+			if ((*it)->GetViewport())
 			{
 				if (scene->IsClearingZBuffer())
 					m_rasterizer->ClearDepthBuffer();
@@ -906,7 +906,7 @@ void KX_KetsjiEngine::Render()
 	}
 
 	// only one place that checks for stereo
-	if(m_rasterizer->Stereo())
+	if (m_rasterizer->Stereo())
 	{
 		m_rasterizer->SetEye(RAS_IRasterizer::RAS_STEREO_RIGHTEYE);
 
@@ -939,7 +939,7 @@ void KX_KetsjiEngine::Render()
 			list<KX_Camera*>::iterator it = cameras->begin();
 			while(it != cameras->end())
 			{
-				if((*it)->GetViewport())
+				if ((*it)->GetViewport())
 				{
 					if (scene->IsClearingZBuffer())
 						m_rasterizer->ClearDepthBuffer();
@@ -954,7 +954,7 @@ void KX_KetsjiEngine::Render()
 			}
 			PostRenderScene(scene);
 		}
-	} // if(m_rasterizer->Stereo())
+	} // if (m_rasterizer->Stereo())
 
 	EndFrame();
 }
@@ -985,9 +985,9 @@ int KX_KetsjiEngine::GetExitCode()
 	}
 	
 	// check if the window has been closed.
-	if(!m_exitcode)
+	if (!m_exitcode)
 	{
-		//if(!m_canvas->Check()) {
+		//if (!m_canvas->Check()) {
 		//	m_exitcode = KX_EXIT_REQUEST_OUTSIDE;
 		//}
 	}
@@ -1119,7 +1119,7 @@ void KX_KetsjiEngine::GetSceneViewport(KX_Scene *scene, KX_Camera* cam, RAS_Rect
 
 		// Don't do bars on user specified viewport
 		RAS_FrameSettings settings = scene->GetFramingType();
-		if(settings.FrameType() == RAS_FrameSettings::e_frame_bars)
+		if (settings.FrameType() == RAS_FrameSettings::e_frame_bars)
 			settings.SetFrameType(RAS_FrameSettings::e_frame_extend);
 
 		RAS_FramingManager::ComputeViewport(
@@ -1155,14 +1155,14 @@ void KX_KetsjiEngine::RenderShadowBuffers(KX_Scene *scene)
 
 	m_rendertools->SetAuxilaryClientInfo(scene);
 
-	for(i=0; i<lightlist->GetCount(); i++) {
+	for (i=0; i<lightlist->GetCount(); i++) {
 		KX_GameObject *gameobj = (KX_GameObject*)lightlist->GetValue(i);
 
 		KX_LightObject *light = (KX_LightObject*)gameobj;
 
 		light->Update();
 
-		if(m_drawingmode == RAS_IRasterizer::KX_TEXTURED && light->HasShadowBuffer()) {
+		if (m_drawingmode == RAS_IRasterizer::KX_TEXTURED && light->HasShadowBuffer()) {
 			/* make temporary camera */
 			RAS_CameraData camdata = RAS_CameraData();
 			KX_Camera *cam = new KX_Camera(scene, scene->m_callbacks, camdata, true, true);
@@ -1238,7 +1238,7 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam)
 		focallength = cam->GetFocalLength();
 		MT_Matrix4x4 projmat;
 
-		if(override_camera) {
+		if (override_camera) {
 			nearfrust = m_overrideCamNear;
 			farfrust = m_overrideCamFar;
 		}
@@ -1340,8 +1340,8 @@ void KX_KetsjiEngine::RenderFonts(KX_Scene* scene)
 }
 
 /*
-To run once per scene
-*/
+ * To run once per scene
+ */
 void KX_KetsjiEngine::PostRenderScene(KX_Scene* scene)
 {
 	// We need to first make sure our viewport is correct (enabling multiple viewports can mess this up)
@@ -1447,7 +1447,7 @@ void KX_KetsjiEngine::RenderDebugProperties()
 {
 	STR_String debugtxt;
 	int xcoord = 10;	// mmmm, these constants were taken from blender source
-	int ycoord = 14;	// to 'mimic' behaviour
+	int ycoord = 14;	// to 'mimic' behavior
 
 	float tottime = m_logger->GetAverage();
 	if (tottime < 1e-6f) {
@@ -1772,8 +1772,8 @@ void	KX_KetsjiEngine::SetAnimRecordMode(bool animation_record, int startFrame)
 	m_animation_record = animation_record;
 	if (animation_record)
 	{
-		//when recording physics keyframes, always run at a fixed framerate
-		m_bFixedTime = true;
+		//when recording physics keyframes, run at a variable (capped) frame rate (fixed time == full speed)
+		m_bFixedTime = false;
 	}
 	m_currentFrame = startFrame;
 }
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h b/source/gameengine/Ketsji/KX_KetsjiEngine.h
index 96b737b..0a50ab0 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.h
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.h
@@ -30,8 +30,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_KETSJI_ENGINE
-#define __KX_KETSJI_ENGINE
+#ifndef __KX_KETSJIENGINE_H__
+#define __KX_KETSJIENGINE_H__
 
 #include "MT_CmMatrix4x4.h"
 #include "MT_Matrix4x4.h"
@@ -72,14 +72,14 @@ class KX_KetsjiEngine
 {
 
 private:
-	class RAS_ICanvas*				m_canvas; // 2D Canvas (2D Rendering Device Context)
+	class RAS_ICanvas*					m_canvas; // 2D Canvas (2D Rendering Device Context)
 	class RAS_IRasterizer*				m_rasterizer;  // 3D Rasterizer (3D Rendering)
-	class KX_ISystem*				m_kxsystem;
+	class KX_ISystem*					m_kxsystem;
 	class RAS_IRenderTools*				m_rendertools;
 	class KX_ISceneConverter*			m_sceneconverter;
-	class NG_NetworkDeviceInterface*		m_networkdevice;
+	class NG_NetworkDeviceInterface*	m_networkdevice;
 #ifdef WITH_PYTHON
-	/* borrowed from sys.modules["__main__"], dont manage ref's */
+	/* borrowed from sys.modules["__main__"], don't manage ref's */
 	PyObject*					m_pythondictionary;
 #endif
 	class SCA_IInputDevice*				m_keyboarddevice;
@@ -222,16 +222,16 @@ public:
 	void			SetRasterizer(RAS_IRasterizer* rasterizer);
 #ifdef WITH_PYTHON
 	void			SetPyNamespace(PyObject* pythondictionary);
-	PyObject*		GetPyNamespace(){return m_pythondictionary;};
+	PyObject*		GetPyNamespace() { return m_pythondictionary; }
 #endif
 	void			SetSceneConverter(KX_ISceneConverter* sceneconverter);
 	void			SetAnimRecordMode(bool animation_record, int startFrame);
 
-	RAS_IRasterizer*		GetRasterizer(){return m_rasterizer;};
-	RAS_ICanvas*		    GetCanvas(){return m_canvas;};
-	RAS_IRenderTools*	    GetRenderTools(){return m_rendertools;};
-	SCA_IInputDevice*		GetKeyboardDevice(){return m_keyboarddevice;};
-	SCA_IInputDevice*		GetMouseDevice(){return m_mousedevice;};
+	RAS_IRasterizer*		GetRasterizer() { return m_rasterizer; }
+	RAS_ICanvas*		    GetCanvas() { return m_canvas; }
+	RAS_IRenderTools*	    GetRenderTools() { return m_rendertools; }
+	SCA_IInputDevice*		GetKeyboardDevice() { return m_keyboarddevice; }
+	SCA_IInputDevice*		GetMouseDevice() { return m_mousedevice; }
 
 	/// Dome functions
 	void			InitDome(short res, short mode, short angle, float resbuf, short tilt, struct Text* text); 
@@ -265,7 +265,7 @@ public:
 	void			GetSceneViewport(KX_Scene* scene, KX_Camera* cam, RAS_Rect& area, RAS_Rect& viewport);
 
 	void SetDrawType(int drawingtype);
-	int  GetDrawType(){return m_drawingmode;};
+	int  GetDrawType() { return m_drawingmode; }
 
 	void SetCameraZoom(float camzoom);
 	
@@ -279,13 +279,13 @@ public:
 	
 	/**
 	 * Sets display of all frames.
-	 * @param bUseFixedTime	New setting for display all frames.
+	 * \param bUseFixedTime	New setting for display all frames.
 	 */ 
 	void SetUseFixedTime(bool bUseFixedTime);
 
 	/**
 	 * Returns display of all frames.
-	 * @return Current setting for display all frames.
+	 * \return Current setting for display all frames.
 	 */ 
 	bool GetUseFixedTime(void) const;
 
@@ -360,35 +360,35 @@ public:
 
 	/**
 	 * Activates or deactivates timing information display.
-	 * @param frameRate		Display for frame rate on or off.
-	 * @param profile		Display for individual components on or off.
-	 * @param properties	Display of scene object debug properties on or off.
+	 * \param frameRate		Display for frame rate on or off.
+	 * \param profile		Display for individual components on or off.
+	 * \param properties	Display of scene object debug properties on or off.
 	 */ 
 	void SetTimingDisplay(bool frameRate, bool profile, bool properties);
 
 	/**
 	 * Returns status of timing information display.
-	 * @param frameRate		Display for frame rate on or off.
-	 * @param profile		Display for individual components on or off.
-	 * @param properties	Display of scene object debug properties on or off.
+	 * \param frameRate		Display for frame rate on or off.
+	 * \param profile		Display for individual components on or off.
+	 * \param properties	Display of scene object debug properties on or off.
 	 */ 
 	void GetTimingDisplay(bool& frameRate, bool& profile, bool& properties) const;
 
 	/** 
 	 * Sets cursor hiding on every frame.
-	 * @param hideCursor Turns hiding on or off.
+	 * \param hideCursor Turns hiding on or off.
 	 */
 	void SetHideCursor(bool hideCursor);
 
 	/** 
 	 * Returns the current setting for cursor hiding.
-	 * @return The current setting for cursor hiding.
+	 * \return The current setting for cursor hiding.
 	 */
 	bool GetHideCursor(void) const;
 
 	/** 
 	 * Enables/disables the use of the framing bar color of the Blender file's scenes.
-	 * @param overrideFrameColor The new setting.
+	 * \param overrideFrameColor The new setting.
 	 */
 	void SetUseOverrideFrameColor(bool overrideFrameColor);
 
@@ -399,17 +399,17 @@ public:
 
 	/** 
 	 * Set the color used for framing bar color instead of the one in the Blender file's scenes.
-	 * @param r Red component of the override color.
-	 * @param g Green component of the override color.
-	 * @param b Blue component of the override color.
+	 * \param r Red component of the override color.
+	 * \param g Green component of the override color.
+	 * \param b Blue component of the override color.
 	 */
 	void SetOverrideFrameColor(float r, float g, float b);
 
 	/** 
 	 * Returns the color used for framing bar color instead of the one in the Blender file's scenes.
-	 * @param r Red component of the override color.
-	 * @param g Green component of the override color.
-	 * @param b Blue component of the override color.
+	 * \param r Red component of the override color.
+	 * \param g Green component of the override color.
+	 * \param b Blue component of the override color.
 	 */
 	void GetOverrideFrameColor(float& r, float& g, float& b) const;
 
@@ -424,7 +424,7 @@ protected:
 	 * Processes all scheduled scene activity.
 	 * At the end, if the scene lists have changed,
 	 * SceneListsChanged(void) is called.
-	 * @see SceneListsChanged(void).
+	 * \see SceneListsChanged(void).
 	 */
 	void			ProcessScheduledScenes(void);
 
@@ -450,6 +450,6 @@ public:
 #endif
 };
 
-#endif //__KX_KETSJI_ENGINE
+#endif //__KX_KETSJIENGINE_H__
 
 
diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp
index b174b4f..7e9d95b 100644
--- a/source/gameengine/Ketsji/KX_Light.cpp
+++ b/source/gameengine/Ketsji/KX_Light.cpp
@@ -67,7 +67,7 @@ KX_LightObject::~KX_LightObject()
 {
 	GPULamp *lamp;
 
-	if((lamp = GetGPULamp())) {
+	if ((lamp = GetGPULamp())) {
 		float obmat[4][4] = {{0}};
 		GPU_lamp_update(lamp, 0, 0, obmat);
 	}
@@ -95,18 +95,18 @@ bool KX_LightObject::ApplyLight(KX_Scene *kxscene, int oblayer, int slot)
 	float vec[4];
 	int scenelayer = ~0;
 
-	if(kxscene && kxscene->GetBlenderScene())
+	if (kxscene && kxscene->GetBlenderScene())
 		scenelayer = kxscene->GetBlenderScene()->lay;
 	
 	/* only use lights in the same layer as the object */
-	if(!(m_lightobj.m_layer & oblayer))
+	if (!(m_lightobj.m_layer & oblayer))
 		return false;
 	/* only use lights in the same scene, and in a visible layer */
-	if(kxscene != lightscene || !(m_lightobj.m_layer & scenelayer))
+	if (kxscene != lightscene || !(m_lightobj.m_layer & scenelayer))
 		return false;
 
 	// lights don't get their openGL matrix updated, do it now
-	if(GetSGNode()->IsDirty())
+	if (GetSGNode()->IsDirty())
 		GetOpenGLMatrix();
 
 	MT_CmMatrix4x4& worldmatrix= *GetOpenGLMatrixPtr();
@@ -116,7 +116,7 @@ bool KX_LightObject::ApplyLight(KX_Scene *kxscene, int oblayer, int slot)
 	vec[2] = worldmatrix(2,3);
 	vec[3] = 1.0f;
 
-	if(m_lightobj.m_type==RAS_LightObject::LIGHT_SUN) {
+	if (m_lightobj.m_type==RAS_LightObject::LIGHT_SUN) {
 		
 		vec[0] = worldmatrix(0,2);
 		vec[1] = worldmatrix(1,2);
@@ -136,7 +136,7 @@ bool KX_LightObject::ApplyLight(KX_Scene *kxscene, int oblayer, int slot)
 		//attennuation still is acceptable 
 		glLightf((GLenum)(GL_LIGHT0+slot), GL_QUADRATIC_ATTENUATION, m_lightobj.m_att2/(m_lightobj.m_distance*m_lightobj.m_distance)); 
 		
-		if(m_lightobj.m_type==RAS_LightObject::LIGHT_SPOT) {
+		if (m_lightobj.m_type==RAS_LightObject::LIGHT_SPOT) {
 			vec[0] = -worldmatrix(0,2);
 			vec[1] = -worldmatrix(1,2);
 			vec[2] = -worldmatrix(2,2);
@@ -162,7 +162,7 @@ bool KX_LightObject::ApplyLight(KX_Scene *kxscene, int oblayer, int slot)
 	}
 
 	glLightfv((GLenum)(GL_LIGHT0+slot), GL_DIFFUSE, vec);
-	if(m_lightobj.m_nospecular)
+	if (m_lightobj.m_nospecular)
 	{
 		vec[0] = vec[1] = vec[2] = vec[3] = 0.0;
 	}
@@ -181,7 +181,7 @@ bool KX_LightObject::ApplyLight(KX_Scene *kxscene, int oblayer, int slot)
 
 GPULamp *KX_LightObject::GetGPULamp()
 {
-	if(m_glsl)
+	if (m_glsl)
 		return GPU_lamp_from_blender(m_blenderscene, GetBlenderObject(), GetBlenderGroupObject());
 	else
 		return NULL;
@@ -191,15 +191,15 @@ void KX_LightObject::Update()
 {
 	GPULamp *lamp;
 
-	if((lamp = GetGPULamp()) != NULL && GetSGNode()) {
+	if ((lamp = GetGPULamp()) != NULL && GetSGNode()) {
 		float obmat[4][4];
 		// lights don't get their openGL matrix updated, do it now
 		if (GetSGNode()->IsDirty())
 			GetOpenGLMatrix();
 		double *dobmat = GetOpenGLMatrixPtr()->getPointer();
 
-		for(int i=0; i<4; i++)
-			for(int j=0; j<4; j++, dobmat++)
+		for (int i=0; i<4; i++)
+			for (int j=0; j<4; j++, dobmat++)
 				obmat[i][j] = (float)*dobmat;
 
 		GPU_lamp_update(lamp, m_lightobj.m_layer, 0, obmat);
@@ -212,7 +212,7 @@ bool KX_LightObject::HasShadowBuffer()
 {
 	GPULamp *lamp;
 
-	if((lamp = GetGPULamp()))
+	if ((lamp = GetGPULamp()))
 		return GPU_lamp_has_shadow_buffer(lamp);
 	else
 		return false;
@@ -222,7 +222,7 @@ int KX_LightObject::GetShadowLayer()
 {
 	GPULamp *lamp;
 
-	if((lamp = GetGPULamp()))
+	if ((lamp = GetGPULamp()))
 		return GPU_lamp_shadow_layer(lamp);
 	else
 		return 0;
@@ -347,7 +347,7 @@ PyObject* KX_LightObject::pyattr_get_typeconst(void *self_v, const KX_PYATTRIBUT
 
 	const char* type = attrdef->m_name;
 
-	if(!strcmp(type, "SPOT")) {
+	if (!strcmp(type, "SPOT")) {
 		retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_SPOT);
 	} else if (!strcmp(type, "SUN")) {
 		retvalue = PyLong_FromSsize_t(RAS_LightObject::LIGHT_SUN);
@@ -373,7 +373,7 @@ int KX_LightObject::pyattr_set_type(void* self_v, const KX_PYATTRIBUTE_DEF *attr
 {
 	KX_LightObject* self = static_cast<KX_LightObject*>(self_v);
 	int val = PyLong_AsSsize_t(value);
-	if((val==-1 && PyErr_Occurred()) || val<0 || val>2) {
+	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;
 	}
diff --git a/source/gameengine/Ketsji/KX_Light.h b/source/gameengine/Ketsji/KX_Light.h
index bb081e6..c2815e7 100644
--- a/source/gameengine/Ketsji/KX_Light.h
+++ b/source/gameengine/Ketsji/KX_Light.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_LIGHT
-#define __KX_LIGHT
+#ifndef __KX_LIGHT_H__
+#define __KX_LIGHT_H__
 
 #include "RAS_LightObject.h"
 #include "KX_GameObject.h"
@@ -82,5 +82,5 @@ public:
 #endif
 };
 
-#endif //__KX_LIGHT
+#endif //__KX_LIGHT_H__
 
diff --git a/source/gameengine/Ketsji/KX_LightIpoSGController.h b/source/gameengine/Ketsji/KX_LightIpoSGController.h
index 61618c2..78466e8 100644
--- a/source/gameengine/Ketsji/KX_LightIpoSGController.h
+++ b/source/gameengine/Ketsji/KX_LightIpoSGController.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef KX_LIGHTIPOSGCONTROLLER_H
-#define KX_LIGHTIPOSGCONTROLLER_H
+#ifndef __KX_LIGHTIPOSGCONTROLLER_H__
+#define __KX_LIGHTIPOSGCONTROLLER_H__
 
 #include "SG_Controller.h"
 #include "SG_Spatial.h"
@@ -104,5 +104,5 @@ public:
 #endif
 };
 
-#endif // KX_LIGHTIPOSGCONTROLLER_H
+#endif // __KX_LIGHTIPOSGCONTROLLER_H__
 
diff --git a/source/gameengine/Ketsji/KX_MeshProxy.cpp b/source/gameengine/Ketsji/KX_MeshProxy.cpp
index fa13668..f1a9a93 100644
--- a/source/gameengine/Ketsji/KX_MeshProxy.cpp
+++ b/source/gameengine/Ketsji/KX_MeshProxy.cpp
@@ -184,7 +184,7 @@ PyObject* KX_MeshProxy::PyGetVertex(PyObject* args, PyObject* kwds)
 	
 	RAS_TexVert* vertex = m_meshobj->GetVertex(matindex,vertexindex);
 	
-	if(vertex==NULL) {
+	if (vertex==NULL) {
 		PyErr_SetString(PyExc_ValueError, "mesh.getVertex(mat_idx, vert_idx): KX_MeshProxy, could not get a vertex at the given indices");
 		return NULL;
 	}
@@ -230,11 +230,11 @@ PyObject* KX_MeshProxy::pyattr_get_materials(void *self_v, const KX_PYATTRIBUTE_
 	list<RAS_MeshMaterial>::iterator mit= self->m_meshobj->GetFirstMaterial();
 	
 	
-	for(i=0; i<tot; mit++, i++) {
+	for (i=0; i<tot; mit++, i++) {
 		RAS_IPolyMaterial *polymat = mit->m_bucket->GetPolyMaterial(); 	 
 		
 		/* Why do we need to check for RAS_BLENDERMAT if both are cast to a (PyObject*)? - Campbell */
-		if(polymat->GetFlag() & RAS_BLENDERMAT) 	 
+		if (polymat->GetFlag() & RAS_BLENDERMAT) 	 
 		{ 	 
 			KX_BlenderMaterial *mat = static_cast<KX_BlenderMaterial*>(polymat); 	 
 			PyList_SET_ITEM(materials, i, mat->GetProxy());
diff --git a/source/gameengine/Ketsji/KX_MeshProxy.h b/source/gameengine/Ketsji/KX_MeshProxy.h
index f59418a..58b5c87 100644
--- a/source/gameengine/Ketsji/KX_MeshProxy.h
+++ b/source/gameengine/Ketsji/KX_MeshProxy.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_MESHPROXY
-#define __KX_MESHPROXY
+#ifndef __KX_MESHPROXY_H__
+#define __KX_MESHPROXY_H__
 
 #ifdef WITH_PYTHON
 
@@ -51,7 +51,7 @@ public:
 	void SetMeshModified(bool v);
 
 	// stuff for cvalue related things
-	virtual CValue*		Calc(VALUE_OPERATOR op, CValue *val) ;
+	virtual CValue*		Calc(VALUE_OPERATOR op, CValue *val);
 	virtual CValue*		CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val);
 	virtual const STR_String &	GetText();
 	virtual double		GetNumber();
@@ -79,5 +79,5 @@ public:
 
 #endif // WITH_PYTHON
 
-#endif //__KX_MESHPROXY
+#endif //__KX_MESHPROXY_H__
 
diff --git a/source/gameengine/Ketsji/KX_MotionState.h b/source/gameengine/Ketsji/KX_MotionState.h
index b18a745..02470f8 100644
--- a/source/gameengine/Ketsji/KX_MotionState.h
+++ b/source/gameengine/Ketsji/KX_MotionState.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_MOTIONSTATE
-#define __KX_MOTIONSTATE
+#ifndef __KX_MOTIONSTATE_H__
+#define __KX_MOTIONSTATE_H__
 
 #include "PHY_IMotionState.h"
 
@@ -63,5 +63,5 @@ public:
 #endif
 };
 
-#endif //__KX_MOTIONSTATE
+#endif //__KX_MOTIONSTATE_H__
 
diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
index ed38694..bfee124 100644
--- a/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
+++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
@@ -100,7 +100,7 @@ bool KX_MouseFocusSensor::Evaluate()
 //  	cout << "evaluate focus mouse sensor "<<endl;
 	m_reset = false;
 	if (m_focusmode) {
-		/* Focus behaviour required. Test mouse-on. The rest is
+		/* Focus behavior required. Test mouse-on. The rest is
 		 * equivalent to handling a key. */
 		obHasFocus = ParentObjectHasFocus();
 		
@@ -114,7 +114,7 @@ bool KX_MouseFocusSensor::Evaluate()
 			if (!m_mouse_over_in_previous_frame) {
 				result = true;
 			}
-			else if(m_bTouchPulse && (m_hitObject != m_hitObject_Last)) {
+			else if (m_bTouchPulse && (m_hitObject != m_hitObject_Last)) {
 				result = true;
 			}
 		} 
@@ -123,7 +123,7 @@ bool KX_MouseFocusSensor::Evaluate()
 			result = true;
 		}
 	} else {
-		/* No focus behaviour required: revert to the basic mode. This
+		/* No focus behavior required: revert to the basic mode. This
 		 * mode is never used, because the converter never makes this
 		 * sensor for a mouse-key event. It is here for
 		 * completeness. */
@@ -142,11 +142,11 @@ 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
-	* 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.)
-	* Hitspots now become valid. */
+	 * for aliasing artefacts 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.)
+	 * Hitspots now become valid. */
 	KX_GameObject* thisObj = (KX_GameObject*) GetParent();
 	if ((m_focusmode == 2) || hitKXObj == thisObj)
 	{
@@ -303,7 +303,7 @@ bool KX_MouseFocusSensor::ParentObjectHasFocus()
 	
 	KX_Camera *cam= m_kxscene->GetActiveCamera();
 	
-	if(ParentObjectHasFocusCamera(cam))
+	if (ParentObjectHasFocusCamera(cam))
 		return true;
 
 	list<class KX_Camera*>* cameras = m_kxscene->GetCameras();
@@ -311,7 +311,7 @@ bool KX_MouseFocusSensor::ParentObjectHasFocus()
 	
 	while(it != cameras->end())
 	{
-		if(((*it) != cam) && (*it)->GetViewport())
+		if (((*it) != cam) && (*it)->GetViewport())
 			if (ParentObjectHasFocusCamera(*it))
 				return true;
 		
@@ -408,7 +408,7 @@ PyObject* KX_MouseFocusSensor::pyattr_get_ray_direction(void *self_v, const KX_P
 {
 	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);
+	if (MT_fuzzyZero(dir))	dir.setValue(0,0,0);
 	else					dir.normalize();
 	return PyObjectFrom(dir);
 }
@@ -417,7 +417,7 @@ PyObject* KX_MouseFocusSensor::pyattr_get_hit_object(void *self_v, const KX_PYAT
 {
 	KX_MouseFocusSensor* self= static_cast<KX_MouseFocusSensor*>(self_v);
 	
-	if(self->m_hitObject)
+	if (self->m_hitObject)
 		return self->m_hitObject->GetProxy();
 	
 	Py_RETURN_NONE;
diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.h b/source/gameengine/Ketsji/KX_MouseFocusSensor.h
index 43bf6bc..db9e369 100644
--- a/source/gameengine/Ketsji/KX_MouseFocusSensor.h
+++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.h
@@ -30,8 +30,8 @@
  *  \brief KX_MouseFocusSensor determines mouse in/out/over events.
  */
 
-#ifndef __KX_MOUSEFOCUSSENSOR
-#define __KX_MOUSEFOCUSSENSOR
+#ifndef __KX_MOUSEFOCUSSENSOR_H__
+#define __KX_MOUSEFOCUSSENSOR_H__
 
 #include "SCA_MouseSensor.h"
 
@@ -61,7 +61,7 @@ class KX_MouseFocusSensor : public SCA_MouseSensor
 						KX_KetsjiEngine* kxengine,
 						SCA_IObject* gameobj);
 
-	virtual ~KX_MouseFocusSensor() { ; };
+	virtual ~KX_MouseFocusSensor() { }
 	virtual CValue* GetReplica() {
 		CValue* replica = new KX_MouseFocusSensor(*this);
 		// this will copy properties and so on...
@@ -76,7 +76,7 @@ class KX_MouseFocusSensor : public SCA_MouseSensor
 
 
 	/**
-	 * @attention Overrides default evaluate. 
+	 * \attention Overrides default evaluate. 
 	 */
 	virtual bool Evaluate();
 	virtual void Init();
@@ -120,7 +120,7 @@ class KX_MouseFocusSensor : public SCA_MouseSensor
  private:
 	/**
 	 * The focus mode. 1 for handling focus, 0 for not handling, 2 for focus on any object
-	*/
+	 */
 	int	m_focusmode;
 
 	/**
diff --git a/source/gameengine/Ketsji/KX_NavMeshObject.cpp b/source/gameengine/Ketsji/KX_NavMeshObject.cpp
index f92319e..35058e5 100644
--- a/source/gameengine/Ketsji/KX_NavMeshObject.cpp
+++ b/source/gameengine/Ketsji/KX_NavMeshObject.cpp
@@ -112,7 +112,8 @@ bool KX_NavMeshObject::BuildVertIndArrays(float *&vertices, int& nverts,
 {
 	DerivedMesh* dm = mesh_create_derived_no_virtual(KX_GetActiveScene()->GetBlenderScene(), GetBlenderObject(), 
 													NULL, CD_MASK_MESH);
-	int* recastData = (int*) dm->getFaceDataArray(dm, CD_RECAST);
+	CustomData *pdata = dm->getPolyDataLayout(dm);
+	int* recastData = (int*) CustomData_get_layer(pdata, CD_RECAST);
 	if (recastData)
 	{
 		int *dtrisToPolysMap=NULL, *dtrisToTrisMap=NULL, *trisToFacesMap=NULL;
@@ -287,7 +288,7 @@ bool KX_NavMeshObject::BuildNavMesh()
 
 	if (GetMeshCount()==0)
 	{
-		printf("Can't find mesh for navmesh object: %s \n", m_name.ReadPtr());
+		printf("Can't find mesh for navmesh object: %s\n", m_name.ReadPtr());
 		return false;
 	}
 
@@ -299,7 +300,7 @@ bool KX_NavMeshObject::BuildNavMesh()
 							dmeshes, dvertices, ndvertsuniq, dtris, ndtris, vertsPerPoly ) 
 			|| vertsPerPoly<3)
 	{
-		printf("Can't build navigation mesh data for object:%s \n", m_name.ReadPtr());
+		printf("Can't build navigation mesh data for object:%s\n", m_name.ReadPtr());
 		return false;
 	}
 	
@@ -420,7 +421,7 @@ bool KX_NavMeshObject::BuildNavMesh()
 		}
 		// setup triangles.
 		unsigned char* tri = navDTris;
-		for(size_t i=0; i<ndtris; i++)
+		for (size_t i=0; i<ndtris; i++)
 		{
 			for (size_t j=0; j<3; j++)
 				tri[4*i+j] = j;
@@ -432,7 +433,7 @@ bool KX_NavMeshObject::BuildNavMesh()
 		memcpy(navDVerts, dvertices, ndvertsuniq*3*sizeof(float));
 		//tris
 		unsigned char* tri = navDTris;
-		for(size_t i=0; i<ndtris; i++)
+		for (size_t i=0; i<ndtris; i++)
 		{
 			for (size_t j=0; j<3; j++)
 				tri[4*i+j] = dtris[6*i+j];
@@ -620,7 +621,7 @@ void KX_NavMeshObject::DrawPath(const float *path, int pathLen, const MT_Vector3
 }
 
 
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
 //----------------------------------------------------------------------------
 //Python
 
@@ -718,4 +719,4 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_NavMeshObject, rebuild,
 	Py_RETURN_NONE;
 }
 
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
diff --git a/source/gameengine/Ketsji/KX_NavMeshObject.h b/source/gameengine/Ketsji/KX_NavMeshObject.h
index ad128a0..db35a01 100644
--- a/source/gameengine/Ketsji/KX_NavMeshObject.h
+++ b/source/gameengine/Ketsji/KX_NavMeshObject.h
@@ -24,8 +24,8 @@
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef __KX_NAVMESHOBJECT
-#define __KX_NAVMESHOBJECT
+#ifndef __KX_NAVMESHOBJECT_H__
+#define __KX_NAVMESHOBJECT_H__
 #include "DetourStatNavMesh.h"
 #include "KX_GameObject.h"
 #include "PyObjectPlus.h"
@@ -65,7 +65,7 @@ public:
 
 	MT_Point3 TransformToLocalCoords(const MT_Point3& wpos);
 	MT_Point3 TransformToWorldCoords(const MT_Point3& lpos);
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
 	/* --------------------------------------------------------------------- */
 	/* Python interface ---------------------------------------------------- */
 	/* --------------------------------------------------------------------- */
@@ -74,8 +74,8 @@ public:
 	KX_PYMETHOD_DOC(KX_NavMeshObject, raycast);
 	KX_PYMETHOD_DOC(KX_NavMeshObject, draw);
 	KX_PYMETHOD_DOC_NOARGS(KX_NavMeshObject, rebuild);
-#endif
+#endif // WITH_PYTHON
 };
 
-#endif //__KX_NAVMESHOBJECT
+#endif //__KX_NAVMESHOBJECT_H__
 
diff --git a/source/gameengine/Ketsji/KX_NearSensor.h b/source/gameengine/Ketsji/KX_NearSensor.h
index a81d621..8655d93 100644
--- a/source/gameengine/Ketsji/KX_NearSensor.h
+++ b/source/gameengine/Ketsji/KX_NearSensor.h
@@ -30,8 +30,8 @@
  *  \brief Sense if other objects are near
  */
 
-#ifndef KX_NEARSENSOR_H
-#define KX_NEARSENSOR_H
+#ifndef __KX_NEARSENSOR_H__
+#define __KX_NEARSENSOR_H__
 
 #include "KX_TouchSensor.h"
 #include "KX_ClientObjectInfo.h"
@@ -55,7 +55,7 @@ public:
 	              bool bFindMaterial,
 	              const STR_String& touchedpropname,
 	              PHY_IPhysicsController*	ctrl);
-/*
+#if 0
 public:
 	KX_NearSensor(class SCA_EventManager* eventmgr,
 			class KX_GameObject* gameobj,
@@ -64,7 +64,7 @@ public:
 			bool bFindMaterial,
 			const STR_String& touchedpropname,
 			class KX_Scene* scene);
-*/
+#endif
 	virtual ~KX_NearSensor(); 
 	virtual void SynchronizeTransform();
 	virtual CValue* GetReplica();
@@ -76,7 +76,7 @@ public:
 	virtual bool	NewHandleCollision(void* obj1,void* obj2,
 						 const PHY_CollData * coll_data); 
 	virtual bool	BroadPhaseFilterCollision(void*obj1,void*obj2);
-	virtual bool	BroadPhaseSensorFilterCollision(void*obj1,void*obj2) { return false; };
+	virtual bool	BroadPhaseSensorFilterCollision(void* obj1,void* obj2) { return false; }
 	virtual sensortype GetSensorType() { return ST_NEAR; }
 
 #ifdef WITH_PYTHON
@@ -104,5 +104,5 @@ public:
 
 };
 
-#endif //KX_NEARSENSOR_H
+#endif //__KX_NEARSENSOR_H__
 
diff --git a/source/gameengine/Ketsji/KX_ObColorIpoSGController.h b/source/gameengine/Ketsji/KX_ObColorIpoSGController.h
index 230ef93..d2d69d6 100644
--- a/source/gameengine/Ketsji/KX_ObColorIpoSGController.h
+++ b/source/gameengine/Ketsji/KX_ObColorIpoSGController.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef KX_OBCOLORIPOSGCONTROLLER_H
-#define KX_OBCOLORIPOSGCONTROLLER_H
+#ifndef __KX_OBCOLORIPOSGCONTROLLER_H__
+#define __KX_OBCOLORIPOSGCONTROLLER_H__
 
 #include "SG_Controller.h"
 #include "SG_Spatial.h"
@@ -79,5 +79,5 @@ public:
 #endif
 };
 
-#endif // KX_OBCOLORIPOSGCONTROLLER_H
+#endif // __KX_OBCOLORIPOSGCONTROLLER_H__
 
diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.cpp b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
index aed9ff2..a3f098c 100644
--- a/source/gameengine/Ketsji/KX_ObjectActuator.cpp
+++ b/source/gameengine/Ketsji/KX_ObjectActuator.cpp
@@ -385,12 +385,12 @@ PyAttributeDef KX_ObjectActuator::Attributes[] = {
 #define MATHUTILS_VEC_CB_LINV 1
 #define MATHUTILS_VEC_CB_ANGV 2
 
-static int mathutils_kxobactu_vector_cb_index= -1; /* index for our callbacks */
+static unsigned char mathutils_kxobactu_vector_cb_index = -1; /* index for our callbacks */
 
 static int mathutils_obactu_generic_check(BaseMathObject *bmo)
 {
 	KX_ObjectActuator* self= static_cast<KX_ObjectActuator*>BGE_PROXY_REF(bmo->cb_user);
-	if(self==NULL)
+	if (self==NULL)
 		return -1;
 
 	return 0;
@@ -399,7 +399,7 @@ 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)
+	if (self==NULL)
 		return -1;
 
 	switch(subtype) {
@@ -417,7 +417,7 @@ 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)
+	if (self==NULL)
 		return -1;
 
 	switch(subtype) {
@@ -435,7 +435,7 @@ static int mathutils_obactu_vector_set(BaseMathObject *bmo, int subtype)
 static int mathutils_obactu_vector_get_index(BaseMathObject *bmo, int subtype, int index)
 {
 	/* lazy, avoid repeteing the case statement */
-	if(mathutils_obactu_vector_get(bmo, subtype) == -1)
+	if (mathutils_obactu_vector_get(bmo, subtype) == -1)
 		return -1;
 	return 0;
 }
@@ -445,7 +445,7 @@ static int mathutils_obactu_vector_set_index(BaseMathObject *bmo, int subtype, i
 	float f= bmo->data[index];
 
 	/* lazy, avoid repeteing the case statement */
-	if(mathutils_obactu_vector_get(bmo, subtype) == -1)
+	if (mathutils_obactu_vector_get(bmo, subtype) == -1)
 		return -1;
 
 	bmo->data[index]= f;
@@ -496,7 +496,7 @@ int KX_ObjectActuator::pyattr_set_angV(void *self_v, const KX_PYATTRIBUTE_DEF *a
 void KX_ObjectActuator_Mathutils_Callback_Init(void)
 {
 	// register mathutils callbacks, ok to run more then once.
-	mathutils_kxobactu_vector_cb_index= Mathutils_RegisterCallback(&mathutils_obactu_vector_cb);
+	mathutils_kxobactu_vector_cb_index = Mathutils_RegisterCallback(&mathutils_obactu_vector_cb);
 }
 
 #endif // USE_MATHUTILS
@@ -629,7 +629,7 @@ int KX_ObjectActuator::pyattr_set_reference(void *self, const struct KX_PYATTRIB
 	if (actuator->m_reference)
 		actuator->m_reference->UnregisterActuator(actuator);
 	
-	if(refOb==NULL) {
+	if (refOb==NULL) {
 		actuator->m_reference= NULL;
 	}
 	else {	
diff --git a/source/gameengine/Ketsji/KX_ObjectActuator.h b/source/gameengine/Ketsji/KX_ObjectActuator.h
index aa0f844..3972344 100644
--- a/source/gameengine/Ketsji/KX_ObjectActuator.h
+++ b/source/gameengine/Ketsji/KX_ObjectActuator.h
@@ -30,8 +30,8 @@
  *  \brief Do translation/rotation actions
  */
 
-#ifndef __KX_OBJECTACTUATOR
-#define __KX_OBJECTACTUATOR
+#ifndef __KX_OBJECTACTUATOR_H__
+#define __KX_OBJECTACTUATOR_H__
 
 #include "SCA_IActuator.h"
 #include "MT_Vector3.h"
@@ -222,5 +222,5 @@ public:
 
 };
 
-#endif //__KX_OBJECTACTUATOR
+#endif //__KX_OBJECTACTUATOR_H__
 
diff --git a/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp b/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp
index f9d60c5..b816989 100644
--- a/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp
+++ b/source/gameengine/Ketsji/KX_ObstacleSimulation.cpp
@@ -343,7 +343,7 @@ void KX_ObstacleSimulation::DrawObstacles()
 	if (!m_enableVisualization)
 		return;
 	static const MT_Vector3 bluecolor(0,0,1);
-	static const MT_Vector3 normal(0.,0.,1.);
+	static const MT_Vector3 normal(0.0, 0.0, 1.0);
 	static const int SECTORS_NUM = 32;
 	for (size_t i=0; i<m_obstacles.size(); i++)
 	{
diff --git a/source/gameengine/Ketsji/KX_ObstacleSimulation.h b/source/gameengine/Ketsji/KX_ObstacleSimulation.h
index f429d74..5b359fc 100644
--- a/source/gameengine/Ketsji/KX_ObstacleSimulation.h
+++ b/source/gameengine/Ketsji/KX_ObstacleSimulation.h
@@ -23,8 +23,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef __KX_OBSTACLESIMULATION
-#define __KX_OBSTACLESIMULATION
+#ifndef __KX_OBSTACLESIMULATION_H__
+#define __KX_OBSTACLESIMULATION_H__
 
 #include <vector>
 #include "MT_Point2.h"
@@ -90,7 +90,7 @@ public:
 	virtual void AdjustObstacleVelocity(KX_Obstacle* activeObst, KX_NavMeshObject* activeNavMeshObj, 
 								MT_Vector3& velocity, MT_Scalar maxDeltaSpeed,MT_Scalar maxDeltaAngle);
 
-}; 
+};
 class KX_ObstacleSimulationTOI: public KX_ObstacleSimulation
 {
 protected:
diff --git a/source/gameengine/Ketsji/KX_OrientationInterpolator.cpp b/source/gameengine/Ketsji/KX_OrientationInterpolator.cpp
index 4e0e04b..d2468d0 100644
--- a/source/gameengine/Ketsji/KX_OrientationInterpolator.cpp
+++ b/source/gameengine/Ketsji/KX_OrientationInterpolator.cpp
@@ -34,7 +34,8 @@
 #include "MT_Matrix3x3.h"
 #include "KX_IScalarInterpolator.h"
 
-void KX_OrientationInterpolator::Execute(float currentTime) const {
+void KX_OrientationInterpolator::Execute(float currentTime) const
+{
 	MT_Vector3 eul(m_ipos[0]->GetValue(currentTime),
 				   m_ipos[1]->GetValue(currentTime),
 				   m_ipos[2]->GetValue(currentTime));
diff --git a/source/gameengine/Ketsji/KX_OrientationInterpolator.h b/source/gameengine/Ketsji/KX_OrientationInterpolator.h
index c9aacba..1a4ed53 100644
--- a/source/gameengine/Ketsji/KX_OrientationInterpolator.h
+++ b/source/gameengine/Ketsji/KX_OrientationInterpolator.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef KX_ORIENTATIONINTERPOLATOR
-#define KX_ORIENTATIONINTERPOLATOR
+#ifndef __KX_ORIENTATIONINTERPOLATOR_H__
+#define __KX_ORIENTATIONINTERPOLATOR_H__
 
 #include "KX_IInterpolator.h"
 
diff --git a/source/gameengine/Ketsji/KX_ParentActuator.h b/source/gameengine/Ketsji/KX_ParentActuator.h
index d950989..6191b88 100644
--- a/source/gameengine/Ketsji/KX_ParentActuator.h
+++ b/source/gameengine/Ketsji/KX_ParentActuator.h
@@ -30,8 +30,8 @@
  *  \brief Set or remove an objects parent
  */
 
-#ifndef __KX_PARENTACTUATOR
-#define __KX_PARENTACTUATOR
+#ifndef __KX_PARENTACTUATOR_H__
+#define __KX_PARENTACTUATOR_H__
 
 #include "SCA_IActuator.h"
 #include "SCA_LogicManager.h"
diff --git a/source/gameengine/Ketsji/KX_PhysicsEngineEnums.h b/source/gameengine/Ketsji/KX_PhysicsEngineEnums.h
index 11474c6..5cebedf 100644
--- a/source/gameengine/Ketsji/KX_PhysicsEngineEnums.h
+++ b/source/gameengine/Ketsji/KX_PhysicsEngineEnums.h
@@ -29,19 +29,15 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_PHYSICSENGINEENUMS
-#define __KX_PHYSICSENGINEENUMS
+#ifndef __KX_PHYSICSENGINEENUMS_H__
+#define __KX_PHYSICSENGINEENUMS_H__
 
 enum	e_PhysicsEngine
 {
 		NoSelection = -1,
 		UseNone     =  0,
-		UseEnji     =  1,
-		UseSumo     =  2,
-		UseDynamo   =  3,
-		UseODE      =  4,
-		UseBullet	=	5,
+		UseBullet   =  5,
 };
 
-#endif //__KX_PHYSICSENGINEENUMS
+#endif //__KX_PHYSICSENGINEENUMS_H__
 
diff --git a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h b/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h
index 4f03c8f..a074ff9 100644
--- a/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h
+++ b/source/gameengine/Ketsji/KX_PhysicsObjectWrapper.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef PHYP_PHYSICSOBJECT_WRAPPER
-#define PHYP_PHYSICSOBJECT_WRAPPER
+#ifndef __KX_PHYSICSOBJECTWRAPPER_H__
+#define __KX_PHYSICSOBJECTWRAPPER_H__
 
 #include "Value.h"
 #include "PHY_DynamicTypes.h"
@@ -56,5 +56,5 @@ private:
 	PHY_IPhysicsEnvironment* m_physenv;
 };
 
-#endif //PHYP_PHYSICSOBJECT_WRAPPER
+#endif //__KX_PHYSICSOBJECTWRAPPER_H__
 
diff --git a/source/gameengine/Ketsji/KX_PhysicsPropertiesobsolete.h b/source/gameengine/Ketsji/KX_PhysicsPropertiesobsolete.h
index bb2fb08..86ba250 100644
--- a/source/gameengine/Ketsji/KX_PhysicsPropertiesobsolete.h
+++ b/source/gameengine/Ketsji/KX_PhysicsPropertiesobsolete.h
@@ -30,8 +30,8 @@
  *  \todo check if this file is still needed
  */
 
-#ifndef KX_PROPSH
-#define KX_PROPSH
+#ifndef __KX_PHYSICSPROPERTIESOBSOLETE_H__
+#define __KX_PHYSICSPROPERTIESOBSOLETE_H__
 
 #include <MT_Scalar.h>
 
@@ -58,5 +58,5 @@ struct KX_MaterialProps {
 	bool      m_fh_normal;             // Should the object slide off slopes?
 };
 
-#endif //KX_PROPSH
+#endif //__KX_PHYSICSPROPERTIESOBSOLETE_H__
 
diff --git a/source/gameengine/Ketsji/KX_PolyProxy.cpp b/source/gameengine/Ketsji/KX_PolyProxy.cpp
index caef8ba..85c8833 100644
--- a/source/gameengine/Ketsji/KX_PolyProxy.cpp
+++ b/source/gameengine/Ketsji/KX_PolyProxy.cpp
@@ -259,7 +259,7 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMaterial,
 "getMaterial() : returns a material\n")
 {
 	RAS_IPolyMaterial *polymat = m_polygon->GetMaterial()->GetPolyMaterial();
-	if(polymat->GetFlag() & RAS_BLENDERMAT)
+	if (polymat->GetFlag() & RAS_BLENDERMAT)
 	{
 		KX_BlenderMaterial* mat = static_cast<KX_BlenderMaterial*>(polymat);
 		return mat->GetProxy();
diff --git a/source/gameengine/Ketsji/KX_PolyProxy.h b/source/gameengine/Ketsji/KX_PolyProxy.h
index 44945e5..83c3bff 100644
--- a/source/gameengine/Ketsji/KX_PolyProxy.h
+++ b/source/gameengine/Ketsji/KX_PolyProxy.h
@@ -47,7 +47,7 @@ public:
 	virtual ~KX_PolyProxy();
 
 	// stuff for cvalue related things
-	CValue*		Calc(VALUE_OPERATOR op, CValue *val) ;
+	CValue*		Calc(VALUE_OPERATOR op, CValue *val);
 	CValue*		CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val);
 	const STR_String &	GetText();
 	double		GetNumber();
diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
index 29127ec..2e39190 100644
--- a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
@@ -60,14 +60,14 @@ KX_PolygonMaterial::KX_PolygonMaterial()
 		: PyObjectPlus(),
 		  RAS_IPolyMaterial(),
 
-	m_tface(NULL),
-	m_mcol(NULL),
 	m_material(NULL),
 #ifdef WITH_PYTHON
 	m_pymaterial(NULL),
 #endif
 	m_pass(0)
 {
+	memset(&m_tface, 0, sizeof(m_tface));
+	memset(&m_mcol, 0, sizeof(m_mcol));
 }
 
 void KX_PolygonMaterial::Initialize(
@@ -98,8 +98,20 @@ void KX_PolygonMaterial::Initialize(
 							light,
 							(texname && texname != ""?true:false), /* if we have a texture we have image */
 							ma?&ma->game:NULL);
-	m_tface = tface;
-	m_mcol = mcol;
+
+	if (tface) {
+		m_tface = *tface;
+	}
+	else {
+		memset(&m_tface, 0, sizeof(m_tface));
+	}
+	if (mcol) {
+		m_mcol = *mcol;
+	}
+	else {
+		memset(&m_mcol, 0, sizeof(m_mcol));
+	}
+
 	m_material = ma;
 #ifdef WITH_PYTHON
 	m_pymaterial = 0;
@@ -119,7 +131,7 @@ KX_PolygonMaterial::~KX_PolygonMaterial()
 
 Image *KX_PolygonMaterial::GetBlenderImage() const
 {
-	return (m_tface) ? m_tface->tpage : NULL;
+	return m_tface.tpage;
 }
 
 bool KX_PolygonMaterial::Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingInfo) const 
@@ -175,14 +187,14 @@ void KX_PolygonMaterial::DefaultActivate(RAS_IRasterizer* rasty, TCachingInfo& c
 
 		if ((m_drawingmode & RAS_IRasterizer::KX_TEX)&& (rasty->GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED))
 		{
-			Image *ima = (Image*)m_tface->tpage;
+			Image *ima = m_tface.tpage;
 			GPU_update_image_time(ima, rasty->GetTime());
-			GPU_set_tpage(m_tface, 1, m_alphablend);
+			GPU_set_tpage(&m_tface, 1, m_alphablend);
 		}
 		else
 			GPU_set_tpage(NULL, 0, 0);
 		
-		if(m_drawingmode & RAS_IRasterizer::KX_BACKCULL)
+		if (m_drawingmode & RAS_IRasterizer::KX_BACKCULL)
 			rasty->SetCullFace(true);
 		else
 			rasty->SetCullFace(false);
@@ -359,15 +371,15 @@ PyObject* KX_PolygonMaterial::pyattr_get_material(void *self_v, const KX_PYATTRI
 PyObject* KX_PolygonMaterial::pyattr_get_tface(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
 	KX_PolygonMaterial* self= static_cast<KX_PolygonMaterial*>(self_v);
-	return PyCapsule_New(self->m_tface, KX_POLYGONMATERIAL_CAPSULE_ID, NULL);
+	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);
 	int bindcode= 0;
-	if (self->m_tface && self->m_tface->tpage)
-		bindcode= self->m_tface->tpage->bindcode;
+	if (self->m_tface.tpage)
+		bindcode= self->m_tface.tpage->bindcode;
 	
 	return PyLong_FromSsize_t(bindcode);
 }
diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.h b/source/gameengine/Ketsji/KX_PolygonMaterial.h
index f20a90f..f7ad397 100644
--- a/source/gameengine/Ketsji/KX_PolygonMaterial.h
+++ b/source/gameengine/Ketsji/KX_PolygonMaterial.h
@@ -37,6 +37,7 @@
 #include "RAS_MaterialBucket.h"
 #include "RAS_IRasterizer.h"
 #include "DNA_ID.h"
+#include "DNA_meshdata_types.h"
 
 #ifdef WITH_CXX_GUARDEDALLOC
 #include "MEM_guardedalloc.h"
@@ -58,9 +59,9 @@ class KX_PolygonMaterial : public PyObjectPlus, public RAS_IPolyMaterial
 	Py_Header
 private:
 	/** Blender texture face structure. */
-	MTFace*			m_tface;
-	unsigned int*	m_mcol;
-	Material*		m_material;
+	mutable MTFace       m_tface;
+	mutable unsigned int m_mcol;
+	Material*            m_material;
 
 #ifdef WITH_PYTHON
 	PyObject*		m_pymaterial;
@@ -89,7 +90,7 @@ public:
 	/**
 	 * Returns the caching information for this material,
 	 * This can be used to speed up the rasterizing process.
-	 * @return The caching information.
+	 * \return The caching information.
 	 */
 	virtual TCachingInfo GetCachingInfo(void) const
 	{
@@ -100,8 +101,8 @@ public:
 	 * Activates the material in the (OpenGL) rasterizer.
 	 * On entry, the cachingInfo contains info about the last activated material.
 	 * On exit, the cachingInfo should contain updated info about this material.
-	 * @param rasty			The rasterizer in which the material should be active.
-	 * @param cachingInfo	The information about the material used to speed up rasterizing.
+	 * \param rasty			The rasterizer in which the material should be active.
+	 * \param cachingInfo	The information about the material used to speed up rasterizing.
 	 */
 	void DefaultActivate(RAS_IRasterizer* rasty, TCachingInfo& cachingInfo) const;
 	virtual bool Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingInfo) const;
@@ -115,16 +116,16 @@ public:
 
 	/**
 	 * Returns the Blender texture face structure that is used for this material.
-	 * @return The material's texture face.
+	 * \return The material's texture face.
 	 */
 	MTFace* GetMTFace(void) const
 	{
-		return m_tface;
+		return &m_tface;
 	}
 
 	unsigned int* GetMCol(void) const
 	{
-		return m_mcol;
+		return &m_mcol;
 	}
 	virtual void GetMaterialRGBAColor(unsigned char *rgba) const;
 
diff --git a/source/gameengine/Ketsji/KX_PositionInterpolator.cpp b/source/gameengine/Ketsji/KX_PositionInterpolator.cpp
index be70ee8..1e217ec 100644
--- a/source/gameengine/Ketsji/KX_PositionInterpolator.cpp
+++ b/source/gameengine/Ketsji/KX_PositionInterpolator.cpp
@@ -34,7 +34,8 @@
 #include "MT_Point3.h"
 #include "KX_IScalarInterpolator.h"
 
-void KX_PositionInterpolator::Execute(float currentTime) const {
+void KX_PositionInterpolator::Execute(float currentTime) const
+{
 	m_target.setValue(m_ipos[0]->GetValue(currentTime),
 					  m_ipos[1]->GetValue(currentTime),
 					  m_ipos[2]->GetValue(currentTime));
diff --git a/source/gameengine/Ketsji/KX_PositionInterpolator.h b/source/gameengine/Ketsji/KX_PositionInterpolator.h
index 88124cf..ef5dfc8 100644
--- a/source/gameengine/Ketsji/KX_PositionInterpolator.h
+++ b/source/gameengine/Ketsji/KX_PositionInterpolator.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef KX_POSITIONINTERPOLATOR
-#define KX_POSITIONINTERPOLATOR
+#ifndef __KX_POSITIONINTERPOLATOR_H__
+#define __KX_POSITIONINTERPOLATOR_H__
 
 #include "KX_IInterpolator.h"
 
diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
index deb69fe..556d451 100644
--- a/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
+++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.cpp
@@ -666,7 +666,7 @@ PyObject* initPythonConstraintBinding()
 	/* Use existing module where possible
 	 * be careful not to init any runtime vars after this */
 	m = PyImport_ImportModule( "PhysicsConstraints" );
-	if(m) {
+	if (m) {
 		Py_DECREF(m);
 		return m;
 	}
diff --git a/source/gameengine/Ketsji/KX_PyConstraintBinding.h b/source/gameengine/Ketsji/KX_PyConstraintBinding.h
index a5846d9..69a6e33 100644
--- a/source/gameengine/Ketsji/KX_PyConstraintBinding.h
+++ b/source/gameengine/Ketsji/KX_PyConstraintBinding.h
@@ -29,18 +29,17 @@
  *  \ingroup ketsji
  */
 
-#ifndef PHY_PYTHON_CONSTRAINTBINDING
-#define PHY_PYTHON_CONSTRAINTBINDING
+#ifndef __KX_PYCONSTRAINTBINDING_H__
+#define __KX_PYCONSTRAINTBINDING_H__
 
 #ifdef WITH_PYTHON
 
 #include <Python.h>
 
 PyObject*				initPythonConstraintBinding();
-void	PHY_RemovePythonConstraintBinding();
 void	PHY_SetActiveEnvironment(class	PHY_IPhysicsEnvironment* env);
 PHY_IPhysicsEnvironment*	PHY_GetActiveEnvironment();
 #endif // WITH_PYTHON
 
-#endif //PHY_PYTHON_CONSTRAINTBINDING
+#endif //__KX_PYCONSTRAINTBINDING_H__
 
diff --git a/source/gameengine/Ketsji/KX_PyMath.cpp b/source/gameengine/Ketsji/KX_PyMath.cpp
index dd32284..f459b80 100644
--- a/source/gameengine/Ketsji/KX_PyMath.cpp
+++ b/source/gameengine/Ketsji/KX_PyMath.cpp
@@ -82,7 +82,7 @@ bool PyOrientationTo(PyObject* pyval, MT_Matrix3x3 &rot, const char *error_prefi
 
 bool PyQuatTo(PyObject* pyval, MT_Quaternion &qrot)
 {
-	if(!PyVecTo(pyval, qrot))
+	if (!PyVecTo(pyval, qrot))
 		return false;
 
 	/* annoying!, Blender/Mathutils have the W axis first! */
@@ -106,7 +106,7 @@ PyObject* PyObjectFrom(const MT_Matrix4x4 &mat)
 	PyObject *col;
 	int i;
 	
-	for(i=0; i < 4; i++) {
+	for (i=0; i < 4; i++) {
 		col = PyList_New(4);
 		PyList_SET_ITEM(col, 0, PyFloat_FromDouble(mat[0][i]));
 		PyList_SET_ITEM(col, 1, PyFloat_FromDouble(mat[1][i]));
@@ -130,7 +130,7 @@ PyObject* PyObjectFrom(const MT_Matrix3x3 &mat)
 	PyObject *col;
 	int i;
 	
-	for(i=0; i < 3; i++) {
+	for (i=0; i < 3; i++) {
 		col = PyList_New(3);
 		PyList_SET_ITEM(col, 0, PyFloat_FromDouble(mat[0][i]));
 		PyList_SET_ITEM(col, 1, PyFloat_FromDouble(mat[1][i]));
@@ -146,7 +146,8 @@ PyObject* PyObjectFrom(const MT_Matrix3x3 &mat)
 PyObject* PyObjectFrom(const MT_Quaternion &qrot)
 {
 	/* NOTE, were re-ordering here for Mathutils compat */
-	float fvec[4]= {qrot[3], qrot[0], qrot[1], qrot[2]};
+	float fvec[4];
+	qrot.getValue(fvec);
 	return Quaternion_CreatePyObject(fvec, Py_NEW, NULL);
 }
 #endif
@@ -154,7 +155,8 @@ PyObject* PyObjectFrom(const MT_Quaternion &qrot)
 PyObject* PyObjectFrom(const MT_Tuple4 &vec)
 {
 #ifdef USE_MATHUTILS
-	float fvec[4]= {vec[0], vec[1], vec[2], vec[3]};
+	float fvec[4];
+	vec.getValue(fvec);
 	return Vector_CreatePyObject(fvec, 4, Py_NEW, NULL);
 #else
 	PyObject *list = PyList_New(4);
@@ -169,7 +171,8 @@ PyObject* PyObjectFrom(const MT_Tuple4 &vec)
 PyObject* PyObjectFrom(const MT_Tuple3 &vec)
 {
 #ifdef USE_MATHUTILS
-	float fvec[3]= {vec[0], vec[1], vec[2]};
+	float fvec[3];
+	vec.getValue(fvec);
 	return Vector_CreatePyObject(fvec, 3, Py_NEW, NULL);
 #else
 	PyObject *list = PyList_New(3);
@@ -183,7 +186,8 @@ PyObject* PyObjectFrom(const MT_Tuple3 &vec)
 PyObject* PyObjectFrom(const MT_Tuple2 &vec)
 {
 #ifdef USE_MATHUTILS
-	float fvec[2]= {vec[0], vec[1]};
+	float fvec[2];
+	vec.getValue(fvec);
 	return Vector_CreatePyObject(fvec, 2, Py_NEW, NULL);
 #else
 	PyObject *list = PyList_New(2);
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp
index 401474b..a707886 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -523,7 +523,7 @@ static PyObject* gPyGetBlendFileList(PyObject*, PyObject* args)
 		BLI_split_dir_part(gp_GamePythonPath, cpath, sizeof(cpath));
 	}
 
-	if((dp  = opendir(cpath)) == NULL) {
+	if ((dp  = opendir(cpath)) == NULL) {
 		/* todo, show the errno, this shouldnt happen anyway if the blendfile is readable */
 		fprintf(stderr, "Could not read directoty (%s) failed, code %d (%s)\n", cpath, errno, strerror(errno));
 		return list;
@@ -607,7 +607,7 @@ static PyObject *pyPrintExt(PyObject *,PyObject *,PyObject *)
 	support= GLEW_ARB_vertex_shader;
 	pprint(" GL_ARB_vertex_shader supported?        "<< (support?"yes.":"no."));
 	count = 1;
-	if(support){
+	if (support) {
 		pprint(" ----------Details----------");
 		int max=0;
 		glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, (GLint*)&max);
@@ -627,7 +627,7 @@ static PyObject *pyPrintExt(PyObject *,PyObject *,PyObject *)
 	support=GLEW_ARB_fragment_shader;
 	pprint(" GL_ARB_fragment_shader supported?      "<< (support?"yes.":"no."));
 	count = 1;
-	if(support){
+	if (support) {
 		pprint(" ----------Details----------");
 		int max=0;
 		glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB, (GLint*)&max);
@@ -638,7 +638,7 @@ static PyObject *pyPrintExt(PyObject *,PyObject *,PyObject *)
 	support = GLEW_ARB_texture_cube_map;
 	pprint(" GL_ARB_texture_cube_map supported?     "<< (support?"yes.":"no."));
 	count = 1;
-	if(support){
+	if (support) {
 		pprint(" ----------Details----------");
 		int size=0;
 		glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, (GLint*)&size);
@@ -649,7 +649,7 @@ static PyObject *pyPrintExt(PyObject *,PyObject *,PyObject *)
 	support = GLEW_ARB_multitexture;
 	count = 1;
 	pprint(" GL_ARB_multitexture supported?         "<< (support?"yes.":"no."));
-	if(support){
+	if (support) {
 		pprint(" ----------Details----------");
 		int units=0;
 		glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, (GLint*)&units);
@@ -660,7 +660,7 @@ static PyObject *pyPrintExt(PyObject *,PyObject *,PyObject *)
 	pprint(" GL_ARB_texture_env_combine supported?  "<< (GLEW_ARB_texture_env_combine?"yes.":"no."));
 	count = 1;
 
-	if(!count)
+	if (!count)
 		pprint("No extenstions are used in this build");
 
 	Py_RETURN_NONE;
@@ -697,14 +697,14 @@ static PyObject *gLibLoad(PyObject*, PyObject* args, PyObject* kwds)
 		BLI_strncpy(abs_path, path, sizeof(abs_path));
 		BLI_path_abs(abs_path, gp_GamePythonPath);
 
-		if(kx_scene->GetSceneConverter()->LinkBlendFilePath(abs_path, group, kx_scene, &err_str, options)) {
+		if (kx_scene->GetSceneConverter()->LinkBlendFilePath(abs_path, group, kx_scene, &err_str, options)) {
 			Py_RETURN_TRUE;
 		}
 	}
 	else
 	{
 
-		if(kx_scene->GetSceneConverter()->LinkBlendFileMemory(py_buffer.buf, py_buffer.len, path, group, kx_scene, &err_str, options))	{
+		if (kx_scene->GetSceneConverter()->LinkBlendFileMemory(py_buffer.buf, py_buffer.len, path, group, kx_scene, &err_str, options))	{
 			PyBuffer_Release(&py_buffer);
 			Py_RETURN_TRUE;
 		}
@@ -712,7 +712,7 @@ static PyObject *gLibLoad(PyObject*, PyObject* args, PyObject* kwds)
 		PyBuffer_Release(&py_buffer);
 	}
 	
-	if(err_str) {
+	if (err_str) {
 		PyErr_SetString(PyExc_ValueError, err_str);
 		return NULL;
 	}
@@ -732,14 +732,14 @@ static PyObject *gLibNew(PyObject*, PyObject* args)
 	if (!PyArg_ParseTuple(args,"ssO!:LibNew",&path, &group, &PyList_Type, &names))
 		return NULL;
 	
-	if(kx_scene->GetSceneConverter()->GetMainDynamicPath(path))
+	if (kx_scene->GetSceneConverter()->GetMainDynamicPath(path))
 	{
 		PyErr_SetString(PyExc_KeyError, "the name of the path given exists");
 		return NULL;
 	}
 	
 	idcode= BKE_idcode_from_name(group);
-	if(idcode==0) {
+	if (idcode==0) {
 		PyErr_Format(PyExc_ValueError, "invalid group given \"%s\"", group);
 		return NULL;
 	}
@@ -749,14 +749,14 @@ static PyObject *gLibNew(PyObject*, PyObject* args)
 	strncpy(maggie->name, path, sizeof(maggie->name)-1);
 	
 	/* Copy the object into main */
-	if(idcode==ID_ME) {
+	if (idcode==ID_ME) {
 		PyObject *ret= PyList_New(0);
 		PyObject *item;
-		for(Py_ssize_t i= 0; i < PyList_GET_SIZE(names); i++) {
+		for (Py_ssize_t i= 0; i < PyList_GET_SIZE(names); i++) {
 			name= _PyUnicode_AsString(PyList_GET_ITEM(names, i));
-			if(name) {
+			if (name) {
 				RAS_MeshObject *meshobj= kx_scene->GetSceneConverter()->ConvertMeshSpecial(kx_scene, maggie, name);
-				if(meshobj) {
+				if (meshobj) {
 					KX_MeshProxy* meshproxy = new KX_MeshProxy(meshobj);
 					item= meshproxy->NewProxy(true);
 					PyList_Append(ret, item);
@@ -1113,17 +1113,17 @@ static PyObject* gPyDisableMotionBlur(PyObject*)
 
 static int getGLSLSettingFlag(const char *setting)
 {
-	if(strcmp(setting, "lights") == 0)
+	if (strcmp(setting, "lights") == 0)
 		return GAME_GLSL_NO_LIGHTS;
-	else if(strcmp(setting, "shaders") == 0)
+	else if (strcmp(setting, "shaders") == 0)
 		return GAME_GLSL_NO_SHADERS;
-	else if(strcmp(setting, "shadows") == 0)
+	else if (strcmp(setting, "shadows") == 0)
 		return GAME_GLSL_NO_SHADOWS;
-	else if(strcmp(setting, "ramps") == 0)
+	else if (strcmp(setting, "ramps") == 0)
 		return GAME_GLSL_NO_RAMPS;
-	else if(strcmp(setting, "nodes") == 0)
+	else if (strcmp(setting, "nodes") == 0)
 		return GAME_GLSL_NO_NODES;
-	else if(strcmp(setting, "extra_textures") == 0)
+	else if (strcmp(setting, "extra_textures") == 0)
 		return GAME_GLSL_NO_EXTRA_TEX;
 	else
 		return -1;
@@ -1155,14 +1155,14 @@ static PyObject* gPySetGLSLMaterialSetting(PyObject*,
 		gs->glslflag |= flag;
 
 	/* display lists and GLSL materials need to be remade */
-	if(sceneflag != gs->glslflag) {
+	if (sceneflag != gs->glslflag) {
 		GPU_materials_free();
-		if(gp_KetsjiEngine) {
+		if (gp_KetsjiEngine) {
 			KX_SceneList *scenes = gp_KetsjiEngine->CurrentScenes();
 			KX_SceneList::iterator it;
 
-			for(it=scenes->begin(); it!=scenes->end(); it++)
-				if((*it)->GetBucketManager()) {
+			for (it=scenes->begin(); it!=scenes->end(); it++)
+				if ((*it)->GetBucketManager()) {
 					(*it)->GetBucketManager()->ReleaseDisplayLists();
 					(*it)->GetBucketManager()->ReleaseMaterials();
 				}
@@ -1208,11 +1208,11 @@ static PyObject* gPySetMaterialType(PyObject*,
 	if (!PyArg_ParseTuple(args,"i:setMaterialType",&type))
 		return NULL;
 
-	if(type == KX_BLENDER_GLSL_MATERIAL)
+	if (type == KX_BLENDER_GLSL_MATERIAL)
 		gs->matmode= GAME_MAT_GLSL;
-	else if(type == KX_BLENDER_MULTITEX_MATERIAL)
+	else if (type == KX_BLENDER_MULTITEX_MATERIAL)
 		gs->matmode= GAME_MAT_MULTITEX;
-	else if(type == KX_TEXFACE_MATERIAL)
+	else if (type == KX_TEXFACE_MATERIAL)
 		gs->matmode= GAME_MAT_TEXFACE;
 	else {
 		PyErr_SetString(PyExc_ValueError, "Rasterizer.setMaterialType(int): material type is not known");
@@ -1227,9 +1227,9 @@ static PyObject* gPyGetMaterialType(PyObject*)
 	GlobalSettings *gs= gp_KetsjiEngine->GetGlobalSettings();
 	int flag;
 
-	if(gs->matmode == GAME_MAT_GLSL)
+	if (gs->matmode == GAME_MAT_GLSL)
 		flag = KX_BLENDER_GLSL_MATERIAL;
-	else if(gs->matmode == GAME_MAT_MULTITEX)
+	else if (gs->matmode == GAME_MAT_MULTITEX)
 		flag = KX_BLENDER_MULTITEX_MATERIAL;
 	else
 		flag = KX_TEXFACE_MATERIAL;
@@ -1381,7 +1381,7 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
 	/* Use existing module where possible
 	 * be careful not to init any runtime vars after this */
 	m = PyImport_ImportModule( "GameLogic" );
-	if(m) {
+	if (m) {
 		Py_DECREF(m);
 		return m;
 	}
@@ -1720,7 +1720,7 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
  * These exist so the current blend dir "//" can always be used to import modules from.
  * the reason we need a few functions for this is that python is not only used by the game engine
  * so we cant just add to sys.path all the time, it would leave pythons state in a mess.
- * It would also be incorrect since loading blend files for new levels etc would alwasy add to sys.path
+ * It would also be incorrect since loading blend files for new levels etc would always add to sys.path
  * 
  * To play nice with blenders python, the sys.path is backed up and the current blendfile along
  * with all its lib paths are added to the sys path.
@@ -1736,11 +1736,11 @@ static void backupPySysObjects(void)
 	PyObject *sys_mods= PySys_GetObject("modules"); /* should never fail */
 	
 	/* paths */
-	Py_XDECREF(gp_OrigPythonSysPath); /* just incase its set */
+	Py_XDECREF(gp_OrigPythonSysPath); /* just in case its set */
 	gp_OrigPythonSysPath = PyList_GetSlice(sys_path, 0, INT_MAX); /* copy the list */
 	
 	/* modules */
-	Py_XDECREF(gp_OrigPythonSysModules); /* just incase its set */
+	Py_XDECREF(gp_OrigPythonSysModules); /* just in case its set */
 	gp_OrigPythonSysModules = PyDict_Copy(sys_mods); /* copy the list */
 	
 }
@@ -1757,12 +1757,12 @@ static void initPySysObjects__append(PyObject *sys_path, const char *filename)
 	
 	BLI_split_dir_part(filename, expanded, sizeof(expanded)); /* get the dir part of filename only */
 	BLI_path_abs(expanded, gp_GamePythonPath); /* filename from lib->filename is (always?) absolute, so this may not be needed but it wont hurt */
-	BLI_cleanup_file(gp_GamePythonPath, expanded); /* Dont use BLI_cleanup_dir because it adds a slash - BREAKS WIN32 ONLY */
+	BLI_cleanup_file(gp_GamePythonPath, expanded); /* Don't use BLI_cleanup_dir because it adds a slash - BREAKS WIN32 ONLY */
 	item= PyUnicode_DecodeFSDefault(expanded);
 	
 //	printf("SysPath - '%s', '%s', '%s'\n", expanded, filename, gp_GamePythonPath);
 	
-	if(PySequence_Index(sys_path, item) == -1) {
+	if (PySequence_Index(sys_path, item) == -1) {
 		PyErr_Clear(); /* PySequence_Index sets a ValueError */
 		PyList_Insert(sys_path, 0, item);
 	}
@@ -1831,7 +1831,7 @@ static struct _inittab bge_internal_modules[]= {
 };
 
 /**
- * Python is not initialised.
+ * Python is not initialized.
  * see bpy_interface.c's BPY_python_start() which shares the same functionality in blender.
  */
 PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecurityLevel level, Main *maggie, int argc, char** argv)
@@ -1859,7 +1859,7 @@ PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur
 
 	Py_Initialize();
 	
-	if(argv && first_time) { /* browser plugins dont currently set this */
+	if (argv && first_time) { /* browser plugins don't currently set this */
 		// Until python support ascii again, we use our own.
 		// PySys_SetArgv(argc, argv);
 		int i;
@@ -1874,14 +1874,14 @@ PyObject* initGamePlayerPythonScripting(const STR_String& progname, TPythonSecur
 
 	bpy_import_init(PyEval_GetBuiltins());
 
-	/* mathutils types are used by the BGE even if we dont import them */
+	/* mathutils types are used by the BGE even if we don't import them */
 	{
 		PyObject *mod= PyImport_ImportModuleLevel((char *)"mathutils", NULL, NULL, NULL, 0);
 		Py_DECREF(mod);
 	}
 
 #ifdef WITH_AUDASPACE
-	/* accessing a SoundActuator's sound results in a crash if aud is not initialised... */
+	/* accessing a SoundActuator's sound results in a crash if aud is not initialized... */
 	{
 		PyObject *mod= PyImport_ImportModuleLevel((char *)"aud", NULL, NULL, NULL, 0);
 		Py_DECREF(mod);
@@ -1933,7 +1933,7 @@ PyObject* initGamePythonScripting(const STR_String& progname, TPythonSecurityLev
 	Py_FrozenFlag=1;
 
 #ifdef WITH_AUDASPACE
-	/* accessing a SoundActuator's sound results in a crash if aud is not initialised... */
+	/* accessing a SoundActuator's sound results in a crash if aud is not initialized... */
 	{
 		PyObject *mod= PyImport_ImportModuleLevel((char *)"aud", NULL, NULL, NULL, 0);
 		Py_DECREF(mod);
@@ -1971,7 +1971,7 @@ void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene* startscene, Main *
 {
 	PyObject* dictionaryobject;
 
-	if(argv) /* player only */
+	if (argv) /* player only */
 		dictionaryobject= initGamePlayerPythonScripting("Ketsji", psl_Lowest, blenderdata, argc, argv);
 	else
 		dictionaryobject= initGamePythonScripting("Ketsji", psl_Lowest, blenderdata);
@@ -1981,7 +1981,7 @@ void setupGamePython(KX_KetsjiEngine* ketsjiengine, KX_Scene* startscene, Main *
 	*gameLogic = initGameLogic(ketsjiengine, startscene);
 
 	/* is set in initGameLogic so only set here if we want it to persist between scenes */
-	if(pyGlobalDict)
+	if (pyGlobalDict)
 		PyDict_SetItemString(PyModule_GetDict(*gameLogic), "globalDict", pyGlobalDict); // Same as importing the module.
 
 	*gameLogic_keys = PyDict_Keys(PyModule_GetDict(*gameLogic));
@@ -2025,9 +2025,9 @@ PyObject* initRasterizer(RAS_IRasterizer* rasty,RAS_ICanvas* canvas)
 	PyObject* item;
 
 	/* Use existing module where possible
-  * be careful not to init any runtime vars after this */
+	 * be careful not to init any runtime vars after this */
 	m = PyImport_ImportModule( "Rasterizer" );
-	if(m) {
+	if (m) {
 		Py_DECREF(m);
 		return m;
 	}
@@ -2093,7 +2093,7 @@ static PyObject* gPyEventToString(PyObject*, PyObject* value)
 		}
 	}
 	
-	PyErr_Clear(); // incase there was an error clearing
+	PyErr_Clear(); // in case there was an error clearing
 	Py_DECREF(mod);
 	if (!ret)	PyErr_SetString(PyExc_ValueError, "GameKeys.EventToString(int): expected a valid int keyboard event");
 	else		Py_INCREF(ret);
@@ -2111,7 +2111,7 @@ static PyObject* gPyEventToCharacter(PyObject*, PyObject* args)
 	if (!PyArg_ParseTuple(args,"ii:EventToCharacter", &event, &shift))
 		return NULL;
 	
-	if(IsPrintable(event)) {
+	if (IsPrintable(event)) {
 		char ch[2] = {'\0', '\0'};
 		ch[0] = ToCharacter(event, (bool)shift);
 		return PyUnicode_FromString(ch);
@@ -2148,7 +2148,7 @@ PyObject* initGameKeys()
 	
 	/* Use existing module where possible */
 	m = PyImport_ImportModule( "GameKeys" );
-	if(m) {
+	if (m) {
 		Py_DECREF(m);
 		return m;
 	}
diff --git a/source/gameengine/Ketsji/KX_PythonInit.h b/source/gameengine/Ketsji/KX_PythonInit.h
index 40d2d38..d834601 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.h
+++ b/source/gameengine/Ketsji/KX_PythonInit.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_PYTHON_INIT
-#define __KX_PYTHON_INIT
+#ifndef __KX_PYTHONINIT_H__
+#define __KX_PYTHONINIT_H__
 
 #include "KX_Python.h"
 #include "STR_String.h"
@@ -74,5 +74,5 @@ void		KX_RasterizerDrawDebugCircle(const MT_Vector3& center, const MT_Scalar rad
 										 const MT_Vector3& normal, int nsector);
 
 
-#endif //__KX_PYTHON_INIT
+#endif //__KX_PYTHONINIT_H__
 
diff --git a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
index e367ef8..3033c53 100644
--- a/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInitTypes.cpp
@@ -107,7 +107,7 @@ static void PyType_Attr_Set(PyGetSetDef *attr_getset, PyAttributeDef *attr)
 
 	attr_getset->get= reinterpret_cast<getter>(PyObjectPlus::py_get_attrdef);
 
-	if(attr->m_access==KX_PYATTRIBUTE_RO)
+	if (attr->m_access==KX_PYATTRIBUTE_RO)
 		attr_getset->set= NULL;
 	else
 		attr_getset->set= reinterpret_cast<setter>(PyObjectPlus::py_set_attrdef);
@@ -119,35 +119,35 @@ static void PyType_Ready_ADD(PyObject *dict, PyTypeObject *tp, PyAttributeDef *a
 {
 	PyAttributeDef *attr;
 
-	if(init_getset) {
+	if (init_getset) {
 		/* we need to do this for all types before calling PyType_Ready
 		 * since they will call the parents PyType_Ready and those might not have initialized vars yet */
 
-		//if(tp->tp_base==NULL)
+		//if (tp->tp_base==NULL)
 		//	printf("Debug: No Parents - '%s'\n" , tp->tp_name);
 
-		if(tp->tp_getset==NULL && ((attributes && attributes->m_name) || (attributesPtr && attributesPtr->m_name))) {
+		if (tp->tp_getset==NULL && ((attributes && attributes->m_name) || (attributesPtr && attributesPtr->m_name))) {
 			PyGetSetDef *attr_getset;
 			int attr_tot= 0;
 
 			if (attributes) {
-				for(attr= attributes; attr->m_name; attr++, attr_tot++)
+				for (attr= attributes; attr->m_name; attr++, attr_tot++)
 					attr->m_usePtr = false;
 			}
 			if (attributesPtr) {
-				for(attr= attributesPtr; attr->m_name; attr++, attr_tot++)
+				for (attr= attributesPtr; attr->m_name; attr++, attr_tot++)
 					attr->m_usePtr = true;
 			}
 
 			tp->tp_getset = attr_getset = reinterpret_cast<PyGetSetDef *>(PyMem_Malloc((attr_tot+1) * sizeof(PyGetSetDef))); // XXX - Todo, free
 
 			if (attributes) {
-				for(attr= attributes; attr->m_name; attr++, attr_getset++) {
+				for (attr= attributes; attr->m_name; attr++, attr_getset++) {
 					PyType_Attr_Set(attr_getset, attr);
 				}
 			}
 			if (attributesPtr) {
-				for(attr= attributesPtr; attr->m_name; attr++, attr_getset++) {
+				for (attr= attributesPtr; attr->m_name; attr++, attr_getset++) {
 					PyType_Attr_Set(attr_getset, attr);
 				}
 			}
@@ -168,9 +168,9 @@ void initPyTypes(void)
 {
 	
 /*
-	initPyObjectPlusType(BL_ActionActuator::Parents);
-	.....
-*/
+ * initPyObjectPlusType(BL_ActionActuator::Parents);
+ * .....
+ */
 
 	/* For now just do PyType_Ready */
 	PyObject *mod= PyModule_New("GameTypes");
@@ -179,7 +179,7 @@ void initPyTypes(void)
 	Py_DECREF(mod);
 	
 	
-	for(int init_getset= 1; init_getset > -1; init_getset--) { /* run twice, once to init the getsets another to run PyType_Ready */
+	for (int init_getset= 1; init_getset > -1; init_getset--) { /* run twice, once to init the getsets another to run PyType_Ready */
 		PyType_Ready_Attr(dict, BL_ActionActuator, init_getset);
 		PyType_Ready_Attr(dict, BL_Shader, init_getset);
 		PyType_Ready_Attr(dict, BL_ShapeActionActuator, init_getset);
diff --git a/source/gameengine/Ketsji/KX_PythonSeq.cpp b/source/gameengine/Ketsji/KX_PythonSeq.cpp
index 430dcdb..6eadc0c 100644
--- a/source/gameengine/Ketsji/KX_PythonSeq.cpp
+++ b/source/gameengine/Ketsji/KX_PythonSeq.cpp
@@ -73,7 +73,7 @@ static Py_ssize_t KX_PythonSeq_len( PyObject * self )
 {
 	PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base);
 	 
-	if(self_plus==NULL) {
+	if (self_plus==NULL) {
 		PyErr_SetString(PyExc_SystemError, "len(seq): "BGE_PROXY_ERROR_MSG);
 		return -1;
 	}
@@ -104,7 +104,7 @@ static PyObject *KX_PythonSeq_getIndex(PyObject* self, int index)
 {
 	PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base);
 	 
-	if(self_plus==NULL) {
+	if (self_plus==NULL) {
 		PyErr_SetString(PyExc_SystemError, "val = seq[i]: "BGE_PROXY_ERROR_MSG);
 		return NULL;
 	}
@@ -113,8 +113,8 @@ static PyObject *KX_PythonSeq_getIndex(PyObject* self, int index)
 		case KX_PYGENSEQ_CONT_TYPE_SENSORS:
 		{
 			vector<SCA_ISensor*>& linkedsensors = ((SCA_IController *)self_plus)->GetLinkedSensors();
-			if(index<0) index += linkedsensors.size();
-			if(index<0 || index>= linkedsensors.size()) {
+			if (index<0) index += linkedsensors.size();
+			if (index<0 || index>= linkedsensors.size()) {
 				PyErr_SetString(PyExc_IndexError, "seq[i]: index out of range");
 				return NULL;
 			}
@@ -123,8 +123,8 @@ static PyObject *KX_PythonSeq_getIndex(PyObject* self, int index)
 		case KX_PYGENSEQ_CONT_TYPE_ACTUATORS:
 		{
 			vector<SCA_IActuator*>& linkedactuators = ((SCA_IController *)self_plus)->GetLinkedActuators();
-			if(index<0) index += linkedactuators.size();
-			if(index<0 || index>= linkedactuators.size()) {
+			if (index<0) index += linkedactuators.size();
+			if (index<0 || index>= linkedactuators.size()) {
 				PyErr_SetString(PyExc_IndexError, "seq[i]: index out of range");
 				return NULL;
 			}
@@ -133,8 +133,8 @@ static PyObject *KX_PythonSeq_getIndex(PyObject* self, int index)
 		case KX_PYGENSEQ_OB_TYPE_SENSORS:
 		{
 			SCA_SensorList& linkedsensors= ((KX_GameObject *)self_plus)->GetSensors();
-			if(index<0) index += linkedsensors.size();
-			if(index<0 || index>= linkedsensors.size()) {
+			if (index<0) index += linkedsensors.size();
+			if (index<0 || index>= linkedsensors.size()) {
 				PyErr_SetString(PyExc_IndexError, "seq[i]: index out of range");
 				return NULL;
 			}
@@ -143,8 +143,8 @@ static PyObject *KX_PythonSeq_getIndex(PyObject* self, int index)
 		case KX_PYGENSEQ_OB_TYPE_CONTROLLERS:
 		{
 			SCA_ControllerList& linkedcontrollers= ((KX_GameObject *)self_plus)->GetControllers();
-			if(index<0) index += linkedcontrollers.size();
-			if(index<0 || index>= linkedcontrollers.size()) {
+			if (index<0) index += linkedcontrollers.size();
+			if (index<0 || index>= linkedcontrollers.size()) {
 				PyErr_SetString(PyExc_IndexError, "seq[i]: index out of range");
 				return NULL;
 			}
@@ -153,8 +153,8 @@ static PyObject *KX_PythonSeq_getIndex(PyObject* self, int index)
 		case KX_PYGENSEQ_OB_TYPE_ACTUATORS:
 		{
 			SCA_ActuatorList& linkedactuators= ((KX_GameObject *)self_plus)->GetActuators();
-			if(index<0) index += linkedactuators.size();
-			if(index<0 || index>= linkedactuators.size()) {
+			if (index<0) index += linkedactuators.size();
+			if (index<0 || index>= linkedactuators.size()) {
 				PyErr_SetString(PyExc_IndexError, "seq[i]: index out of range");
 				return NULL;
 			}
@@ -163,9 +163,9 @@ static PyObject *KX_PythonSeq_getIndex(PyObject* self, int index)
 		case KX_PYGENSEQ_OB_TYPE_CONSTRAINTS:
 		{
 			int nb_constraint = ((BL_ArmatureObject *)self_plus)->GetConstraintNumber();
-			if(index<0) 
+			if (index<0) 
 				index += nb_constraint;
-			if(index<0 || index>= nb_constraint) {
+			if (index<0 || index>= nb_constraint) {
 				PyErr_SetString(PyExc_IndexError, "seq[i]: index out of range");
 				return NULL;
 			}
@@ -174,9 +174,9 @@ static PyObject *KX_PythonSeq_getIndex(PyObject* self, int index)
 		case KX_PYGENSEQ_OB_TYPE_CHANNELS:
 		{
 			int nb_channel = ((BL_ArmatureObject *)self_plus)->GetChannelNumber();
-			if(index<0) 
+			if (index<0) 
 				index += nb_channel;
-			if(index<0 || index>= nb_channel) {
+			if (index<0 || index>= nb_channel) {
 				PyErr_SetString(PyExc_IndexError, "seq[i]: index out of range");
 				return NULL;
 			}
@@ -268,7 +268,7 @@ static PyObject * KX_PythonSeq_subscript(PyObject * self, PyObject *key)
 {
 	PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base);
 	
-	if(self_plus==NULL) {
+	if (self_plus==NULL) {
 		PyErr_SetString(PyExc_SystemError, "val = seq[key], KX_PythonSeq: "BGE_PROXY_ERROR_MSG);
 		return NULL;
 	}
@@ -280,7 +280,7 @@ static PyObject * KX_PythonSeq_subscript(PyObject * self, PyObject *key)
 		const char *name = _PyUnicode_AsString(key);
 		PyObjectPlus *ret = KX_PythonSeq_subscript__internal(self, name);
 		
-		if(ret) {
+		if (ret) {
 			return ret->GetProxy();
 		} else {
 			PyErr_Format( PyExc_KeyError, "requested item \"%s\" does not exist", name);
@@ -298,16 +298,16 @@ static int KX_PythonSeq_contains(PyObject *self, PyObject *key)
 {
 	PyObjectPlus *self_plus= BGE_PROXY_REF(((KX_PythonSeq *)self)->base);
 	
-	if(self_plus==NULL) {
+	if (self_plus==NULL) {
 		PyErr_SetString(PyExc_SystemError, "key in seq, KX_PythonSeq: "BGE_PROXY_ERROR_MSG);
 		return -1;
 	}
-	if(!PyUnicode_Check(key)) {
+	if (!PyUnicode_Check(key)) {
 		PyErr_SetString(PyExc_SystemError, "key in seq, KX_PythonSeq: key must be a string");
 		return -1;
 	}
 	
-	if(KX_PythonSeq_subscript__internal(self, _PyUnicode_AsString(key)))
+	if (KX_PythonSeq_subscript__internal(self, _PyUnicode_AsString(key)))
 		return 1;
 	
 	return 0;
@@ -323,7 +323,7 @@ PyObject* KX_PythonSeq_get(PyObject * self, PyObject *args)
 	if (!PyArg_ParseTuple(args, "s|O:get", &key, &def))
 		return NULL;
 	
-	if((ret_plus = KX_PythonSeq_subscript__internal(self, key)))
+	if ((ret_plus = KX_PythonSeq_subscript__internal(self, key)))
 		return ret_plus->GetProxy();
 	
 	Py_INCREF(def);
@@ -356,12 +356,12 @@ PyMethodDef KX_PythonSeq_methods[] = {
 };
 
 /*
- * Initialize the interator index
+ * Initialize the iterator index
  */
 
 static PyObject *KX_PythonSeq_getIter(KX_PythonSeq *self)
 {
-	if(BGE_PROXY_REF(self->base)==NULL) {
+	if (BGE_PROXY_REF(self->base)==NULL) {
 		PyErr_SetString(PyExc_SystemError, "for i in seq: "BGE_PROXY_ERROR_MSG);
 		return NULL;
 	}
@@ -386,7 +386,7 @@ static PyObject *KX_PythonSeq_nextIter(KX_PythonSeq *self)
 	PyObject *object = KX_PythonSeq_getIndex((PyObject *)self, self->iter);
 	
 	self->iter++;
-	if( object==NULL ) {
+	if ( object==NULL ) {
 		self->iter= -1; /* for reuse */
 		PyErr_SetString(PyExc_StopIteration,	"iterator at end");
 	}
@@ -404,7 +404,7 @@ static PyObject *KX_PythonSeq_richcmp(PyObject *a, PyObject *b, int op)
 	PyObject *res;
 	int ok= -1; /* zero is true */
 
-	if(BPy_KX_PythonSeq_Check(a) && BPy_KX_PythonSeq_Check(b))
+	if (BPy_KX_PythonSeq_Check(a) && BPy_KX_PythonSeq_Check(b))
 		ok= KX_PythonSeq_compare((KX_PythonSeq *)a, (KX_PythonSeq *)b);
 	
 	switch (op) {
diff --git a/source/gameengine/Ketsji/KX_RadarSensor.h b/source/gameengine/Ketsji/KX_RadarSensor.h
index ee803d9..903413c 100644
--- a/source/gameengine/Ketsji/KX_RadarSensor.h
+++ b/source/gameengine/Ketsji/KX_RadarSensor.h
@@ -29,15 +29,15 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_RADAR_SENSOR_H
-#define __KX_RADAR_SENSOR_H
+#ifndef __KX_RADARSENSOR_H__
+#define __KX_RADARSENSOR_H__
 
 #include "KX_NearSensor.h"
 #include "MT_Point3.h"
 
 /**
-* Radar 'cone' sensor. Very similar to a near-sensor, but instead of a sphere, a cone is used.
-*/
+ * Radar 'cone' sensor. Very similar to a near-sensor, but instead of a sphere, a cone is used.
+ */
 class KX_RadarSensor : public KX_NearSensor
 {
  protected:
@@ -95,5 +95,5 @@ public:
 
 };
 
-#endif //__KX_RADAR_SENSOR_H
+#endif //__KX_RADARSENSOR_H__
 
diff --git a/source/gameengine/Ketsji/KX_RayCast.cpp b/source/gameengine/Ketsji/KX_RayCast.cpp
index 6e8a2cb..459600f 100644
--- a/source/gameengine/Ketsji/KX_RayCast.cpp
+++ b/source/gameengine/Ketsji/KX_RayCast.cpp
@@ -61,7 +61,7 @@ void KX_RayCast::reportHit(PHY_RayCastResult* result)
 
 bool KX_RayCast::RayTest(PHY_IPhysicsEnvironment* physics_environment, const MT_Point3& _frompoint, const MT_Point3& topoint, KX_RayCast& callback)
 {
-	if(physics_environment==NULL) return false; /* prevents crashing in some cases */
+	if (physics_environment==NULL) return false; /* prevents crashing in some cases */
 	
 	// Loops over all physics objects between frompoint and topoint,
 	// calling callback.RayHit for each one.
@@ -103,7 +103,7 @@ bool KX_RayCast::RayTest(PHY_IPhysicsEnvironment* physics_environment, const MT_
 		// Note that retrieving in a single shot multiple hit points would be possible 
 		// but it would require some change in Bullet.
 		prevpoint = callback.m_hitPoint;
-		/* We add 0.001 of fudge, so that if the margin && radius == 0., we don't endless loop. */
+		/* We add 0.001 of fudge, so that if the margin && radius == 0.0, we don't endless loop. */
 		MT_Scalar marg = 0.001 + hit_controller->GetMargin();
 		marg *= 2.f;
 		/* Calculate the other side of this object */
diff --git a/source/gameengine/Ketsji/KX_RayEventManager.h b/source/gameengine/Ketsji/KX_RayEventManager.h
index 0b1e525..fee2fe5 100644
--- a/source/gameengine/Ketsji/KX_RayEventManager.h
+++ b/source/gameengine/Ketsji/KX_RayEventManager.h
@@ -30,8 +30,8 @@
  *  \brief Manager for ray events
  */
 
-#ifndef __KX_RAYEVENTMGR
-#define __KX_RAYEVENTMGR
+#ifndef __KX_RAYEVENTMANAGER_H__
+#define __KX_RAYEVENTMANAGER_H__
 #include "SCA_EventManager.h"
 #include <vector>
 using namespace std;
@@ -52,5 +52,5 @@ public:
 #endif
 };
 
-#endif //__KX_RAYEVENTMGR
+#endif //__KX_RAYEVENTMANAGER_H__
 
diff --git a/source/gameengine/Ketsji/KX_RaySensor.cpp b/source/gameengine/Ketsji/KX_RaySensor.cpp
index 0cc0e73..58ca847 100644
--- a/source/gameengine/Ketsji/KX_RaySensor.cpp
+++ b/source/gameengine/Ketsji/KX_RaySensor.cpp
@@ -151,7 +151,7 @@ bool KX_RaySensor::RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void
 }
 
 /* this function is used to pre-filter the object before casting the ray on them.
-   This is useful for "X-Ray" option when we want to see "through" unwanted object.
+ * This is useful for "X-Ray" option when we want to see "through" unwanted object.
  */
 bool KX_RaySensor::NeedRayCast(KX_ClientObjectInfo* client)
 {
diff --git a/source/gameengine/Ketsji/KX_RaySensor.h b/source/gameengine/Ketsji/KX_RaySensor.h
index 4c0009a..f5d1c72 100644
--- a/source/gameengine/Ketsji/KX_RaySensor.h
+++ b/source/gameengine/Ketsji/KX_RaySensor.h
@@ -30,8 +30,8 @@
  *  \brief Cast a ray and feel for objects
  */
 
-#ifndef __KX_RAYSENSOR_H
-#define __KX_RAYSENSOR_H
+#ifndef __KX_RAYSENSOR_H__
+#define __KX_RAYSENSOR_H__
 
 #include "SCA_ISensor.h"
 #include "MT_Point3.h"
@@ -100,5 +100,5 @@ public:
 
 };
 
-#endif //__KX_RAYSENSOR_H
+#endif //__KX_RAYSENSOR_H__
 
diff --git a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h
index ec5cf30..40136f4 100644
--- a/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h
+++ b/source/gameengine/Ketsji/KX_SCA_AddObjectActuator.h
@@ -30,8 +30,8 @@
  * Please look here for revision history.
  */
 
-#ifndef __KX_SCA_AddObjectActuator
-#define __KX_SCA_AddObjectActuator
+#ifndef __KX_SCA_ADDOBJECTACTUATOR_H__
+#define __KX_SCA_ADDOBJECTACTUATOR_H__
 
 /* Actuator tree */
 #include "SCA_IActuator.h"
@@ -93,7 +93,7 @@ public:
 
 		CValue* 
 	GetReplica(
-	) ;
+	);
 
 	virtual void 
 	ProcessReplica();
@@ -114,7 +114,7 @@ public:
 
 		SCA_IObject*	
 	GetLastCreatedObject(
-	) const ;
+	) const;
 
 	void	InstantAddObject();
 
diff --git a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h
index 5fefbb8..885c7a0 100644
--- a/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h
+++ b/source/gameengine/Ketsji/KX_SCA_DynamicActuator.h
@@ -30,8 +30,8 @@
  *  \brief Add object to the game world on action of this actuator
  */
 
-#ifndef __KX_SCA_DYNAMICACTUATOR
-#define __KX_SCA_DYNAMICACTUATOR
+#ifndef __KX_SCA_DYNAMICACTUATOR_H__
+#define __KX_SCA_DYNAMICACTUATOR_H__
 
 #include "SCA_IActuator.h"
 #include "SCA_PropertyActuator.h"
diff --git a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h b/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h
index 7a32525..374d5f2 100644
--- a/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h
+++ b/source/gameengine/Ketsji/KX_SCA_EndObjectActuator.h
@@ -32,8 +32,8 @@
  * Please look here for revision history.
  */
 
-#ifndef __KX_SCA_ENDOBJECTACTUATOR
-#define __KX_SCA_ENDOBJECTACTUATOR
+#ifndef __KX_SCA_ENDOBJECTACTUATOR_H__
+#define __KX_SCA_ENDOBJECTACTUATOR_H__
 
 #include "SCA_IActuator.h"
 
diff --git a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h
index 3e07ec2..c8e6123 100644
--- a/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h
+++ b/source/gameengine/Ketsji/KX_SCA_ReplaceMeshActuator.h
@@ -32,8 +32,8 @@
  *  Please look here for revision history.
  */
 
-#ifndef __KX_SCA_REPLACEMESHACTUATOR
-#define __KX_SCA_REPLACEMESHACTUATOR
+#ifndef __KX_SCA_REPLACEMESHACTUATOR_H__
+#define __KX_SCA_REPLACEMESHACTUATOR_H__
 
 #include "SCA_IActuator.h"
 #include "SCA_PropertyActuator.h"
diff --git a/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp b/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp
index 2f41794..1320069 100644
--- a/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp
+++ b/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.cpp
@@ -59,7 +59,7 @@ UpdateChildCoordinates(
 	SG_Spatial * child,
 	const SG_Spatial * parent,
 	bool& parentUpdated	
-){
+) {
 	MT_assert(child != NULL);
 	
 	// This way of accessing child coordinates is a bit cumbersome
@@ -134,14 +134,14 @@ UpdateChildCoordinates(
 	SG_ParentRelation *
 KX_BoneParentRelation::
 NewCopy(
-){
+) {
 	KX_BoneParentRelation* bone_parent = new KX_BoneParentRelation(m_bone);
 	return bone_parent;
 }
 
 KX_BoneParentRelation::
 ~KX_BoneParentRelation(
-){
+) {
 	//nothing to do
 }
 
diff --git a/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.h b/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.h
index 0eff0ea..734f827 100644
--- a/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.h
+++ b/source/gameengine/Ketsji/KX_SG_BoneParentNodeRelationship.h
@@ -30,8 +30,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_SG_BONEPARENTRELATION_H__
-#define __KX_SG_BONEPARENTRELATION_H__
+#ifndef __KX_SG_BONEPARENTNODERELATIONSHIP_H__
+#define __KX_SG_BONEPARENTNODERELATIONSHIP_H__
  
 #include "SG_Spatial.h"
 #include "SG_ParentRelation.h"
diff --git a/source/gameengine/Ketsji/KX_SG_NodeRelationships.cpp b/source/gameengine/Ketsji/KX_SG_NodeRelationships.cpp
index 99477ea..699b267 100644
--- a/source/gameengine/Ketsji/KX_SG_NodeRelationships.cpp
+++ b/source/gameengine/Ketsji/KX_SG_NodeRelationships.cpp
@@ -53,7 +53,7 @@ UpdateChildCoordinates(
 	SG_Spatial * child,
 	const SG_Spatial * parent,
 	bool& parentUpdated	
-){
+) {
 	MT_assert(child != NULL);
 
 	if (!parentUpdated && !child->IsModified())
@@ -83,20 +83,20 @@ UpdateChildCoordinates(
 	SG_ParentRelation *
 KX_NormalParentRelation::
 NewCopy(
-){
+) {
 	return new KX_NormalParentRelation();
 }
 
 KX_NormalParentRelation::
 ~KX_NormalParentRelation(
-){
+) {
 	//nothing to do
 }
 
 
 KX_NormalParentRelation::
 KX_NormalParentRelation(
-){
+) {
 	// nothing to do
 }
 
@@ -108,7 +108,7 @@ KX_NormalParentRelation(
 	KX_VertexParentRelation *
 KX_VertexParentRelation::
 New(
-){
+) {
 	return new KX_VertexParentRelation();
 }
 		
@@ -122,7 +122,7 @@ UpdateChildCoordinates(
 	SG_Spatial * child,
 	const SG_Spatial * parent,
 	bool& parentUpdated	
-){
+) {
 
 	MT_assert(child != NULL);
 
@@ -148,20 +148,20 @@ UpdateChildCoordinates(
 	SG_ParentRelation *
 KX_VertexParentRelation::
 NewCopy(
-){
+) {
 	return new KX_VertexParentRelation();
 };
 
 KX_VertexParentRelation::
 ~KX_VertexParentRelation(
-){
+) {
 	//nothing to do
 }
 
 
 KX_VertexParentRelation::
 KX_VertexParentRelation(
-){
+) {
 	//nothing to do
 }
 
@@ -174,7 +174,7 @@ KX_VertexParentRelation(
 KX_SlowParentRelation::
 New(
 	MT_Scalar relaxation
-){
+) {
 	return new 	KX_SlowParentRelation(relaxation);
 }	
 
@@ -188,7 +188,7 @@ UpdateChildCoordinates(
 	SG_Spatial * child,
 	const SG_Spatial * parent,
 	bool& parentUpdated	
-){
+) {
 	MT_assert(child != NULL);
 
 	// the child will move even if the parent is not
@@ -273,7 +273,7 @@ UpdateChildCoordinates(
 	SG_ParentRelation *
 KX_SlowParentRelation::
 NewCopy(
-){
+) {
 	return new 	KX_SlowParentRelation(m_relax);
 }
 
@@ -289,7 +289,7 @@ KX_SlowParentRelation(
 
 KX_SlowParentRelation::
 ~KX_SlowParentRelation(
-){
+) {
 	//nothing to do
 }
 
diff --git a/source/gameengine/Ketsji/KX_SG_NodeRelationships.h b/source/gameengine/Ketsji/KX_SG_NodeRelationships.h
index 94fea96..44864c8 100644
--- a/source/gameengine/Ketsji/KX_SG_NodeRelationships.h
+++ b/source/gameengine/Ketsji/KX_SG_NodeRelationships.h
@@ -39,8 +39,8 @@
  * inherited by the child. 
  */
 
-#ifndef __KX_SG_NODERELATIONS_H__
-#define __KX_SG_NODERELATIONS_H__
+#ifndef __KX_SG_NODERELATIONSHIPS_H__
+#define __KX_SG_NODERELATIONSHIPS_H__
 
 #include "SG_Spatial.h"
 #include "SG_ParentRelation.h"
diff --git a/source/gameengine/Ketsji/KX_ScalarInterpolator.cpp b/source/gameengine/Ketsji/KX_ScalarInterpolator.cpp
index 2b0f112..e234a96 100644
--- a/source/gameengine/Ketsji/KX_ScalarInterpolator.cpp
+++ b/source/gameengine/Ketsji/KX_ScalarInterpolator.cpp
@@ -33,6 +33,7 @@
 #include "KX_ScalarInterpolator.h"
 #include "KX_IScalarInterpolator.h"
 
-void KX_ScalarInterpolator::Execute(float currentTime) const {
+void KX_ScalarInterpolator::Execute(float currentTime) const
+{
 	*m_target = m_ipo->GetValue(currentTime);
 }
diff --git a/source/gameengine/Ketsji/KX_ScalarInterpolator.h b/source/gameengine/Ketsji/KX_ScalarInterpolator.h
index 9e5a43e..d08a32c 100644
--- a/source/gameengine/Ketsji/KX_ScalarInterpolator.h
+++ b/source/gameengine/Ketsji/KX_ScalarInterpolator.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef KX_SCALARINTERPOLATOR
-#define KX_SCALARINTERPOLATOR
+#ifndef __KX_SCALARINTERPOLATOR_H__
+#define __KX_SCALARINTERPOLATOR_H__
 
 #include "MT_Scalar.h"
 #include "KX_IInterpolator.h"
diff --git a/source/gameengine/Ketsji/KX_ScalingInterpolator.cpp b/source/gameengine/Ketsji/KX_ScalingInterpolator.cpp
index 51c2a87..dd40cbd 100644
--- a/source/gameengine/Ketsji/KX_ScalingInterpolator.cpp
+++ b/source/gameengine/Ketsji/KX_ScalingInterpolator.cpp
@@ -34,7 +34,8 @@
 #include "MT_Vector3.h"
 #include "KX_IScalarInterpolator.h"
 
-void KX_ScalingInterpolator::Execute(float currentTime) const {
+void KX_ScalingInterpolator::Execute(float currentTime) const
+{
 	m_target.setValue(m_ipos[0]->GetValue(currentTime),
 					  m_ipos[1]->GetValue(currentTime),
 					  m_ipos[2]->GetValue(currentTime));
diff --git a/source/gameengine/Ketsji/KX_ScalingInterpolator.h b/source/gameengine/Ketsji/KX_ScalingInterpolator.h
index 520706b..ae8b25f 100644
--- a/source/gameengine/Ketsji/KX_ScalingInterpolator.h
+++ b/source/gameengine/Ketsji/KX_ScalingInterpolator.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef KX_SCALINGINTERPOLATOR
-#define KX_SCALINGINTERPOLATOR
+#ifndef __KX_SCALINGINTERPOLATOR_H__
+#define __KX_SCALINGINTERPOLATOR_H__
 
 #include "KX_IInterpolator.h"
 
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index 2074350..503c16f 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -102,7 +102,7 @@ void* KX_SceneReplicationFunc(SG_IObject* node,void* gameobj,void* scene)
 {
 	KX_GameObject* replica = ((KX_Scene*)scene)->AddNodeReplicaObject(node,(KX_GameObject*)gameobj);
 
-	if(replica)
+	if (replica)
 		replica->Release();
 
 	return (void*)replica;
@@ -251,7 +251,7 @@ KX_Scene::~KX_Scene()
 	if (m_obstacleSimulation)
 		delete m_obstacleSimulation;
 
-	if(m_objectlist)
+	if (m_objectlist)
 		m_objectlist->Release();
 
 	if (m_parentlist)
@@ -362,7 +362,7 @@ void KX_Scene::SetFramingType(RAS_FrameSettings & frame_settings)
 /**
  * Return a const reference to the framing 
  * type set by the above call.
- * The contents are not guarenteed to be sensible
+ * The contents are not guaranteed to be sensible
  * if you don't call the above function.
  */
 const RAS_FrameSettings& KX_Scene::GetFramingType() const 
@@ -688,7 +688,7 @@ void KX_Scene::DupliGroupRecurse(CValue* obj, int level)
 	m_groupGameObjects.clear();
 
 	group = blgroupobj->dup_group;
-	for(go=(GroupObject*)group->gobject.first; go; go=(GroupObject*)go->next) 
+	for (go=(GroupObject*)group->gobject.first; go; go=(GroupObject*)go->next) 
 	{
 		Object* blenderobj = go->ob;
 		if (blgroupobj == blenderobj)
@@ -1048,7 +1048,7 @@ int KX_Scene::NewRemoveObject(class CValue* gameobj)
 	// in case this is a font
 	m_fonts.remove((KX_FontObject*)newobj);
 
-	/* currently does nothing, keep incase we need to Unregister something */
+	/* currently does nothing, keep in case we need to Unregister something */
 #if 0
 	if (m_sceneConverter)
 		m_sceneConverter->UnregisterGameObject(newobj);
@@ -1066,12 +1066,12 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u
 	KX_GameObject* gameobj = static_cast<KX_GameObject*>(obj);
 	RAS_MeshObject* mesh = static_cast<RAS_MeshObject*>(meshobj);
 
-	if(!gameobj) {
+	if (!gameobj) {
 		std::cout << "KX_Scene::ReplaceMesh Warning: invalid object, doing nothing" << std::endl;
 		return;
 	}
 
-	if(use_gfx && mesh != NULL)
+	if (use_gfx && mesh != NULL)
 	{		
 	gameobj->RemoveMeshes();
 	gameobj->AddMesh(mesh);
@@ -1207,7 +1207,7 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u
 #endif
 
 			// release parent reference if its not being used 
-			if( releaseParent && parentobj)
+			if ( releaseParent && parentobj)
 				parentobj->Release();
 		}
 	}
@@ -1216,7 +1216,7 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* meshobj, bool use_gfx, bool u
 	}
 
 #ifdef USE_BULLET
-	if(use_phys) { /* update the new assigned mesh with the physics mesh */
+	if (use_phys) { /* update the new assigned mesh with the physics mesh */
 		KX_ReInstanceBulletShapeFromMesh(gameobj, NULL, use_gfx?NULL:mesh);
 	}
 #endif
@@ -1287,7 +1287,7 @@ KX_Camera* KX_Scene::GetActiveCamera()
 void KX_Scene::SetActiveCamera(KX_Camera* cam)
 {
 	// only set if the cam is in the active list? Or add it otherwise?
-	if (!FindCamera(cam)){
+	if (!FindCamera(cam)) {
 		AddCamera(cam);
 		if (cam) std::cout << "Added cam " << cam->GetName() << std::endl;
 	} 
@@ -1297,7 +1297,7 @@ void KX_Scene::SetActiveCamera(KX_Camera* cam)
 
 void KX_Scene::SetCameraOnTop(KX_Camera* cam)
 {
-	if (!FindCamera(cam)){
+	if (!FindCamera(cam)) {
 		// adding is always done at the back, so that's all that needs to be done
 		AddCamera(cam);
 		if (cam) std::cout << "Added cam " << cam->GetName() << std::endl;
@@ -1393,7 +1393,7 @@ void KX_Scene::MarkVisible(RAS_IRasterizer* rasty, KX_GameObject* gameobj,KX_Cam
 		return;
 	
 	// Shadow lamp layers
-	if(layer && !(gameobj->GetLayer() & layer)) {
+	if (layer && !(gameobj->GetLayer() & layer)) {
 		gameobj->SetCulled(true);
 		gameobj->UpdateBuckets(false);
 		return;
@@ -1455,7 +1455,7 @@ void KX_Scene::PhysicsCullingCallback(KX_ClientObjectInfo* objectInfo, void* cul
 	if (!gameobj->GetVisible())
 		// ideally, invisible objects should be removed from the culling tree temporarily
 		return;
-	if(((CullingInfo*)cullingInfo)->m_layer && !(gameobj->GetLayer() & ((CullingInfo*)cullingInfo)->m_layer))
+	if (((CullingInfo*)cullingInfo)->m_layer && !(gameobj->GetLayer() & ((CullingInfo*)cullingInfo)->m_layer))
 		// used for shadow: object is not in shadow layer
 		return;
 
@@ -1574,8 +1574,8 @@ void KX_Scene::LogicEndFrame()
 
 
 /**
-  * UpdateParents: SceneGraph transformation update.
-  */
+ * UpdateParents: SceneGraph transformation update.
+ */
 void KX_Scene::UpdateParents(double curtime)
 {
 	// we use the SG dynamic list
@@ -1688,7 +1688,7 @@ void KX_Scene::SetSceneConverter(class KX_BlenderSceneConverter* sceneConverter)
 void KX_Scene::SetPhysicsEnvironment(class PHY_IPhysicsEnvironment* physEnv)
 {
 	m_physicsEnvironment = physEnv;
-	if(m_physicsEnvironment) {
+	if (m_physicsEnvironment) {
 		KX_TouchEventManager* touchmgr = new KX_TouchEventManager(m_logicmgr, physEnv);
 		m_logicmgr->RegisterEventManager(touchmgr);
 	}
@@ -1728,14 +1728,14 @@ static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *to)
 	brick->Replace_NetworkScene(to->GetNetworkScene());
 
 	SCA_ISensor *sensor=  dynamic_cast<class SCA_ISensor *>(brick);
-	if(sensor) {
+	if (sensor) {
 		sensor->Replace_EventManager(logicmgr);
 	}
 
 	/* near sensors have physics controllers */
 #ifdef USE_BULLET
 	KX_TouchSensor *touch_sensor = dynamic_cast<class KX_TouchSensor *>(brick);
-	if(touch_sensor) {
+	if (touch_sensor) {
 		touch_sensor->GetPhysicsController()->SetPhysicsEnvironment(to->GetPhysicsEnvironment());
 	}
 #endif
@@ -1794,15 +1794,15 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, KX_Scene
 
 	/* graphics controller */
 	PHY_IGraphicController *ctrl = gameobj->GetGraphicController();
-	if(ctrl) {
+	if (ctrl) {
 		/* SHOULD update the m_cullingTree */
 		ctrl->SetPhysicsEnvironment(to->GetPhysicsEnvironment());
 	}
 
 	/* SG_Node can hold a scene reference */
 	SG_Node *sg= gameobj->GetSGNode();
-	if(sg) {
-		if(sg->GetSGClientInfo() == from) {
+	if (sg) {
+		if (sg->GetSGClientInfo() == from) {
 			sg->SetSGClientInfo(to);
 
 			/* Make sure to grab the children too since they might not be tied to a game object */
@@ -1839,7 +1839,7 @@ bool KX_Scene::MergeScene(KX_Scene *other)
 	CcdPhysicsEnvironment *env=			dynamic_cast<CcdPhysicsEnvironment *>(this->GetPhysicsEnvironment());
 	CcdPhysicsEnvironment *env_other=	dynamic_cast<CcdPhysicsEnvironment *>(other->GetPhysicsEnvironment());
 
-	if((env==NULL) != (env_other==NULL)) /* TODO - even when both scenes have NONE physics, the other is loaded with bullet enabled, ??? */
+	if ((env==NULL) != (env_other==NULL)) /* TODO - even when both scenes have NONE physics, the other is loaded with bullet enabled, ??? */
 	{
 		printf("KX_Scene::MergeScene: physics scenes type differ, aborting\n");
 		printf("\tsource %d, terget %d\n", (int)(env!=NULL), (int)(env_other!=NULL));
@@ -1847,7 +1847,7 @@ bool KX_Scene::MergeScene(KX_Scene *other)
 	}
 #endif // USE_BULLET
 
-	if(GetSceneConverter() != other->GetSceneConverter()) {
+	if (GetSceneConverter() != other->GetSceneConverter()) {
 		printf("KX_Scene::MergeScene: converters differ, aborting\n");
 		return false;
 	}
@@ -1889,7 +1889,7 @@ bool KX_Scene::MergeScene(KX_Scene *other)
 	other->GetLightList()->ReleaseAndRemoveAll();
 
 #ifdef USE_BULLET
-	if(env) /* bullet scene? - dummy scenes dont need touching */
+	if (env) /* bullet scene? - dummy scenes don't need touching */
 		env->MergeEnvironment(env_other);
 #endif
 	
@@ -1904,13 +1904,13 @@ bool KX_Scene::MergeScene(KX_Scene *other)
 		//SCA_EventManager *evtmgr;
 		SCA_EventManager *evtmgr_other;
 
-		for(unsigned int i= 0; i < evtmgrs.size(); i++) {
+		for (unsigned int i= 0; i < evtmgrs.size(); i++) {
 			evtmgr_other= logicmgr_other->FindEventManager(evtmgrs[i]->GetType());
 
-			if(evtmgr_other) /* unlikely but possible one scene has a joystick and not the other */
+			if (evtmgr_other) /* unlikely but possible one scene has a joystick and not the other */
 				evtmgr_other->Replace_LogicManager(logicmgr);
 
-			/* when merging objects sensors are moved across into the new manager, dont need to do this here */
+			/* when merging objects sensors are moved across into the new manager, don't need to do this here */
 		}
 
 		/* grab any timer properties from the other scene */
@@ -1918,7 +1918,7 @@ bool KX_Scene::MergeScene(KX_Scene *other)
 		SCA_TimeEventManager *timemgr_other=	other->GetTimeEventManager();
 		vector<CValue*> times = timemgr_other->GetTimeValues();
 
-		for(unsigned int i= 0; i < times.size(); i++) {
+		for (unsigned int i= 0; i < times.size(); i++) {
 			timemgr->AddTimeProperty(times[i]);
 		}
 		
@@ -2028,7 +2028,7 @@ static PyObject *Map_GetItem(PyObject *self_v, PyObject *item)
 		return pyconvert;
 	}
 	else {
-		if(attr_str)	PyErr_Format(PyExc_KeyError, "value = scene[key]: KX_Scene, key \"%s\" does not exist", attr_str);
+		if (attr_str)	PyErr_Format(PyExc_KeyError, "value = scene[key]: KX_Scene, key \"%s\" does not exist", attr_str);
 		else			PyErr_SetString(PyExc_KeyError, "value = scene[key]: KX_Scene, key does not exist");
 		return NULL;
 	}
@@ -2039,7 +2039,7 @@ static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val)
 {
 	KX_Scene* self= static_cast<KX_Scene*>BGE_PROXY_REF(self_v);
 	const char *attr_str= _PyUnicode_AsString(key);
-	if(attr_str==NULL)
+	if (attr_str==NULL)
 		PyErr_Clear();
 	
 	if (self==NULL) {
@@ -2050,11 +2050,11 @@ static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val)
 	if (val==NULL) { /* del ob["key"] */
 		int del= 0;
 		
-		if(self->m_attr_dict)
+		if (self->m_attr_dict)
 			del |= (PyDict_DelItem(self->m_attr_dict, key)==0) ? 1:0;
 		
 		if (del==0) {
-			if(attr_str)	PyErr_Format(PyExc_KeyError, "scene[key] = value: KX_Scene, key \"%s\" could not be set", attr_str);
+			if (attr_str)	PyErr_Format(PyExc_KeyError, "scene[key] = value: KX_Scene, key \"%s\" could not be set", attr_str);
 			else			PyErr_SetString(PyExc_KeyError, "del scene[key]: KX_Scene, key could not be deleted");
 			return -1;
 		}
@@ -2069,12 +2069,12 @@ static int Map_SetItem(PyObject *self_v, PyObject *key, PyObject *val)
 			self->m_attr_dict= PyDict_New();
 		
 		
-		if(PyDict_SetItem(self->m_attr_dict, key, val)==0)
+		if (PyDict_SetItem(self->m_attr_dict, key, val)==0)
 			set= 1;
 		else
 			PyErr_SetString(PyExc_KeyError, "scene[key] = value: KX_Scene, key not be added to internal dictionary");
 	
-		if(set==0)
+		if (set==0)
 			return -1; /* pythons error value */
 		
 	}
@@ -2184,7 +2184,7 @@ PyObject* KX_Scene::pyattr_get_drawing_callback_pre(void *self_v, const KX_PYATT
 {
 	KX_Scene* self = static_cast<KX_Scene*>(self_v);
 
-	if(self->m_draw_call_pre==NULL)
+	if (self->m_draw_call_pre==NULL)
 		self->m_draw_call_pre= PyList_New(0);
 	Py_INCREF(self->m_draw_call_pre);
 	return self->m_draw_call_pre;
@@ -2194,7 +2194,7 @@ PyObject* KX_Scene::pyattr_get_drawing_callback_post(void *self_v, const KX_PYAT
 {
 	KX_Scene* self = static_cast<KX_Scene*>(self_v);
 
-	if(self->m_draw_call_post==NULL)
+	if (self->m_draw_call_post==NULL)
 		self->m_draw_call_post= PyList_New(0);
 	Py_INCREF(self->m_draw_call_post);
 	return self->m_draw_call_post;
@@ -2271,7 +2271,7 @@ KX_PYMETHODDEF_DOC(KX_Scene, addObject,
 	SCA_IObject* replica = AddReplicaObject((SCA_IObject*)ob, other, time);
 	
 	// release here because AddReplicaObject AddRef's
-	// the object is added to the scene so we dont want python to own a reference
+	// the object is added to the scene so we don't want python to own a reference
 	replica->Release();
 	return replica->GetProxy();
 }
diff --git a/source/gameengine/Ketsji/KX_Scene.h b/source/gameengine/Ketsji/KX_Scene.h
index c3e6fa3..7e3378b 100644
--- a/source/gameengine/Ketsji/KX_Scene.h
+++ b/source/gameengine/Ketsji/KX_Scene.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_SCENE_H
-#define __KX_SCENE_H
+#ifndef __KX_SCENE_H__
+#define __KX_SCENE_H__
 
 
 #include "KX_PhysicsEngineEnums.h"
@@ -53,7 +53,7 @@
 #include "RAS_2DFilterManager.h"
 
 /**
- * @section Forward declarations
+ * \section Forward declarations
  */
 struct SM_MaterialProps;
 struct SM_ShapeProps;
@@ -140,12 +140,12 @@ protected:
 	/**
 	 * The set of cameras for this scene
 	 */
-	list<class KX_Camera*>       m_cameras;
+	std::list<class KX_Camera*>       m_cameras;
 
 	/**
 	 * The set of fonts for this scene
 	 */
-	list<class KX_FontObject*>       m_fonts;
+	std::list<class KX_FontObject*>   m_fonts;
 
 
 	/**
@@ -160,8 +160,8 @@ protected:
 	// Used to deregister objects that are deleted
 	class KX_BlenderSceneConverter*		m_sceneConverter;
 	/**
-	* physics engine abstraction
-	*/
+	 * physics engine abstraction
+	 */
 	//e_PhysicsEngine m_physicsEngine; //who needs this ?
 	class PHY_IPhysicsEnvironment*		m_physicsEnvironment;
 
@@ -176,12 +176,12 @@ protected:
 	STR_String	m_sceneName;
 	
 	/**
-	 * stores the worldsettings for a scene
+	 * stores the world-settings for a scene
 	 */
 	KX_WorldInfo* m_worldinfo;
 
 	/**
-	 * @section Different scenes, linked to ketsji scene
+	 * \section Different scenes, linked to ketsji scene
 	 */
 
 	/**
@@ -191,7 +191,7 @@ protected:
 	NG_NetworkScene* m_networkScene;
 
 	/**
-	 * A temoprary variable used to parent objects together on
+	 * A temporary variable used to parent objects together on
 	 * replication. Don't get confused by the name it is not
 	 * the scene's root node!
 	 */
@@ -342,7 +342,7 @@ public:
 	void RemoveAnimatedObject(CValue* gameobj);
 
 	/**
-	 * @section Logic stuff
+	 * \section Logic stuff
 	 * Initiate an update of the logic system.
 	 */
 	void LogicBeginFrame(double curtime);
@@ -383,7 +383,7 @@ public:
 
 	/** Font Routines */
 		
-		list<class KX_FontObject*>*
+		std::list<class KX_FontObject*>*
 	GetFonts(
 	);
 
@@ -402,7 +402,7 @@ public:
 
 	/** Camera Routines */
 
-		list<class KX_Camera*>*
+		std::list<class KX_Camera*>*
 	GetCameras(
 	);
  
@@ -451,7 +451,7 @@ public:
 
 	/**
 	 * Activates new desired canvas width set at design time.
-	 * @param width	The new desired width.
+	 * \param width	The new desired width.
 	 */
 		void					
 	SetCanvasDesignWidth(
@@ -459,7 +459,7 @@ public:
 	);
 	/**
 	 * Activates new desired canvas height set at design time.
-	 * @param width	The new desired height.
+	 * \param width	The new desired height.
 	 */
 		void					
 	SetCanvasDesignHeight(
@@ -467,7 +467,7 @@ public:
 	);
 	/**
 	 * Returns the current desired canvas width set at design time.
-	 * @return The desired width.
+	 * \return The desired width.
 	 */
 		unsigned int			
 	GetCanvasDesignWidth(
@@ -476,7 +476,7 @@ public:
 
 	/**
 	 * Returns the current desired canvas height set at design time.
-	 * @return The desired height.
+	 * \return The desired height.
 	 */
 		unsigned int			
 	GetCanvasDesignHeight(
@@ -495,7 +495,7 @@ public:
 	/**
 	 * Return a const reference to the framing 
 	 * type set by the above call.
-	 * The contents are not guarenteed to be sensible
+	 * The contents are not guaranteed to be sensible
 	 * if you don't call the above function.
 	 */
 
@@ -518,7 +518,7 @@ public:
 	const RAS_Rect& GetSceneViewport() const;
 	
 	/**
-	 * @section Accessors to different scenes of this scene
+	 * \section Accessors to different scenes of this scene
 	 */
 	void SetNetworkDeviceInterface(NG_NetworkDeviceInterface* newInterface);
 	void SetNetworkScene(NG_NetworkScene *newScene);
@@ -558,10 +558,10 @@ public:
 	bool IsClearingZBuffer();
 	void EnableZBufferClearing(bool isclearingZbuffer);
 	// use of DBVT tree for camera culling
-	void SetDbvtCulling(bool b) { m_dbvt_culling = b; };
-	bool GetDbvtCulling() { return m_dbvt_culling; };
-	void SetDbvtOcclusionRes(int i) { m_dbvt_occlusion_res = i; };
-	int GetDbvtOcclusionRes() { return m_dbvt_occlusion_res; };
+	void SetDbvtCulling(bool b) { m_dbvt_culling = b; }
+	bool GetDbvtCulling() { return m_dbvt_culling; }
+	void SetDbvtOcclusionRes(int i) { m_dbvt_occlusion_res = i; }
+	int GetDbvtOcclusionRes() { return m_dbvt_occlusion_res; }
 	
 	void SetSceneConverter(class KX_BlenderSceneConverter* sceneConverter);
 
@@ -582,12 +582,12 @@ public:
 	void SetNodeTree(SG_Tree* root);
 
 	/**
-	* 2D Filters
-	*/
-	void Update2DFilter(vector<STR_String>& propNames, void* gameObj, RAS_2DFilterManager::RAS_2DFILTER_MODE filtermode, int pass, STR_String& text);
+	 * 2D Filters
+	 */
+	void Update2DFilter(std::vector<STR_String>& propNames, void* gameObj, RAS_2DFilterManager::RAS_2DFILTER_MODE filtermode, int pass, STR_String& text);
 	void Render2DFilters(RAS_ICanvas* canvas);
 
-	KX_ObstacleSimulation* GetObstacleSimulation() {return m_obstacleSimulation;};
+	KX_ObstacleSimulation* GetObstacleSimulation() { return m_obstacleSimulation; }
 
 #ifdef WITH_PYTHON
 	/* --------------------------------------------------------------------- */
@@ -628,8 +628,8 @@ public:
 	 */
 	void RunDrawingCallbacks(PyObject* cb_list);
 	
-	PyObject* GetPreDrawCB() { return m_draw_call_pre; };
-	PyObject* GetPostDrawCB() { return m_draw_call_post; };
+	PyObject* GetPreDrawCB() { return m_draw_call_pre; }
+	PyObject* GetPostDrawCB() { return m_draw_call_post; }
 #endif
 
 	/**
@@ -665,5 +665,5 @@ public:
 
 typedef std::vector<KX_Scene*> KX_SceneList;
 
-#endif //__KX_SCENE_H
+#endif //__KX_SCENE_H__
 
diff --git a/source/gameengine/Ketsji/KX_SceneActuator.cpp b/source/gameengine/Ketsji/KX_SceneActuator.cpp
index 3370805..781c1fd 100644
--- a/source/gameengine/Ketsji/KX_SceneActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SceneActuator.cpp
@@ -276,7 +276,7 @@ int KX_SceneActuator::pyattr_set_camera(void *self, const struct KX_PYATTRIBUTE_
 	if (actuator->m_camera)
 		actuator->m_camera->UnregisterActuator(actuator);
 	
-	if(camOb==NULL) {
+	if (camOb==NULL) {
 		actuator->m_camera= NULL;
 	}
 	else {	
diff --git a/source/gameengine/Ketsji/KX_SceneActuator.h b/source/gameengine/Ketsji/KX_SceneActuator.h
index 9064146..774f740 100644
--- a/source/gameengine/Ketsji/KX_SceneActuator.h
+++ b/source/gameengine/Ketsji/KX_SceneActuator.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_SCENEACTUATOR
-#define __KX_SCENEACTUATOR
+#ifndef __KX_SCENEACTUATOR_H__
+#define __KX_SCENEACTUATOR_H__
 
 #include "SCA_IActuator.h"
 #include "SCA_IScene.h" /* Replace_IScene only */
diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp
index c47c45d..91f6224 100644
--- a/source/gameengine/Ketsji/KX_SoundActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp
@@ -74,16 +74,16 @@ KX_SoundActuator::KX_SoundActuator(SCA_IObject* gameobj,
 
 KX_SoundActuator::~KX_SoundActuator()
 {
-	if(!m_handle.isNull())
+	if (!m_handle.isNull())
 		m_handle->stop();
 }
 
 void KX_SoundActuator::play()
 {
-	if(!m_handle.isNull())
+	if (!m_handle.isNull())
 		m_handle->stop();
 
-	if(m_sound.isNull())
+	if (m_sound.isNull())
 		return;
 
 	// this is the sound that will be played and not deleted afterwards
@@ -119,7 +119,7 @@ void KX_SoundActuator::play()
 
 	AUD_Reference<AUD_I3DHandle> handle3d = AUD_Reference<AUD_I3DHandle>(m_handle);
 
-	if(m_is3d && !handle3d.isNull())
+	if (m_is3d && !handle3d.isNull())
 	{
 		handle3d->setRelative(true);
 		handle3d->setVolumeMaximum(m_3d.max_gain);
@@ -132,7 +132,7 @@ void KX_SoundActuator::play()
 		handle3d->setConeVolumeOuter(m_3d.cone_outer_gain);
 	}
 
-	if(loop)
+	if (loop)
 		m_handle->setLoopCount(-1);
 	m_handle->setPitch(m_pitch);
 	m_handle->setVolume(m_volume);
@@ -164,7 +164,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame)
 	
 	RemoveAllEvents();
 
-	if(m_sound.isNull())
+	if (m_sound.isNull())
 		return false;
 
 	// actual audio device playing state
@@ -182,7 +182,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame)
 			case KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP:
 				{
 					// stop immediately
-					if(!m_handle.isNull())
+					if (!m_handle.isNull())
 						m_handle->stop();
 					m_handle = AUD_Reference<AUD_IHandle>();
 					break;
@@ -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.isNull())
 						m_handle->setLoopCount(0);
 					break;
 				}
@@ -214,7 +214,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame)
 	// m_posevent==false && m_posevent==false, in this case IsNegativeEvent() returns false 
 	// and assumes this is a positive event.
 	// check that we actually have a positive event so as not to play sounds when being disabled.
-	else if(bPositiveEvent) { // <- added since 2.49
+	else if (bPositiveEvent) { // <- added since 2.49
 #else
 	else {	// <- works in most cases except a loop-end sound will never stop unless
 			// the negative pulse is done continuesly
@@ -229,7 +229,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame)
 	{
 		AUD_Reference<AUD_I3DHandle> handle3d = AUD_Reference<AUD_I3DHandle>(m_handle);
 
-		if(m_is3d && !handle3d.isNull())
+		if (m_is3d && !handle3d.isNull())
 		{
 			KX_Camera* cam = KX_GetActiveScene()->GetActiveCamera();
 			if (cam)
@@ -325,18 +325,15 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_SoundActuator, startSound,
 "startSound()\n"
 "\tStarts the sound.\n")
 {
-	if(!m_handle.isNull())
+	switch(m_handle.isNull() ? AUD_STATUS_INVALID : m_handle->getStatus())
 	{
-		switch(m_handle->getStatus())
-		{
-		case AUD_STATUS_PLAYING:
-			break;
-		case AUD_STATUS_PAUSED:
-			m_handle->resume();
-			break;
-		default:
-			play();
-		}
+	case AUD_STATUS_PLAYING:
+		break;
+	case AUD_STATUS_PAUSED:
+		m_handle->resume();
+		break;
+	default:
+		play();
 	}
 	Py_RETURN_NONE;
 }
@@ -345,7 +342,7 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_SoundActuator, pauseSound,
 "pauseSound()\n"
 "\tPauses the sound.\n")
 {
-	if(!m_handle.isNull())
+	if (!m_handle.isNull())
 		m_handle->pause();
 	Py_RETURN_NONE;
 }
@@ -354,7 +351,7 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_SoundActuator, stopSound,
 "stopSound()\n"
 "\tStops the sound.\n")
 {
-	if(!m_handle.isNull())
+	if (!m_handle.isNull())
 		m_handle->stop();
 	m_handle = AUD_Reference<AUD_IHandle>();
 	Py_RETURN_NONE;
@@ -367,7 +364,7 @@ PyObject* KX_SoundActuator::pyattr_get_3d_property(void *self, const struct KX_P
 	const char* prop = attrdef->m_name;
 	float result_value = 0.0;
 
-	if(!strcmp(prop, "volume_maximum")) {
+	if (!strcmp(prop, "volume_maximum")) {
 		result_value = actuator->m_3d.max_gain;
 
 	} else if (!strcmp(prop, "volume_minimum")) {
@@ -404,7 +401,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.isNull())
 		position = actuator->m_handle->getPosition();
 
 	PyObject* result = PyFloat_FromDouble(position);
@@ -435,7 +432,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.isNull())
 		return AUD_getPythonFactory(&actuator->m_sound);
 	else
 		Py_RETURN_NONE;
@@ -452,47 +449,47 @@ int KX_SoundActuator::pyattr_set_3d_property(void *self, const struct KX_PYATTRI
 
 	AUD_Reference<AUD_I3DHandle> handle3d = AUD_Reference<AUD_I3DHandle>(actuator->m_handle);
 	// if sound is working and 3D, set the new setting
-	if(!actuator->m_is3d)
+	if (!actuator->m_is3d)
 		return PY_SET_ATTR_FAIL;
 
-	if(!strcmp(prop, "volume_maximum")) {
+	if (!strcmp(prop, "volume_maximum")) {
 		actuator->m_3d.max_gain = prop_value;
-		if(!handle3d.isNull())
+		if (!handle3d.isNull())
 			handle3d->setVolumeMaximum(prop_value);
 
 	} else if (!strcmp(prop, "volume_minimum")) {
 		actuator->m_3d.min_gain = prop_value;
-		if(!handle3d.isNull())
+		if (!handle3d.isNull())
 			handle3d->setVolumeMinimum(prop_value);
 
 	} else if (!strcmp(prop, "distance_reference")) {
 		actuator->m_3d.reference_distance = prop_value;
-		if(!handle3d.isNull())
+		if (!handle3d.isNull())
 			handle3d->setDistanceReference(prop_value);
 
 	} else if (!strcmp(prop, "distance_maximum")) {
 		actuator->m_3d.max_distance = prop_value;
-		if(!handle3d.isNull())
+		if (!handle3d.isNull())
 			handle3d->setDistanceMaximum(prop_value);
 
 	} else if (!strcmp(prop, "attenuation")) {
 		actuator->m_3d.rolloff_factor = prop_value;
-		if(!handle3d.isNull())
+		if (!handle3d.isNull())
 			handle3d->setAttenuation(prop_value);
 
 	} else if (!!strcmp(prop, "cone_angle_inner")) {
 		actuator->m_3d.cone_inner_angle = prop_value;
-		if(!handle3d.isNull())
+		if (!handle3d.isNull())
 			handle3d->setConeAngleInner(prop_value);
 
 	} else if (!strcmp(prop, "cone_angle_outer")) {
 		actuator->m_3d.cone_outer_angle = prop_value;
-		if(!handle3d.isNull())
+		if (!handle3d.isNull())
 			handle3d->setConeAngleOuter(prop_value);
 
 	} else if (!strcmp(prop, "cone_volume_outer")) {
 		actuator->m_3d.cone_outer_gain = prop_value;
-		if(!handle3d.isNull())
+		if (!handle3d.isNull())
 			handle3d->setConeVolumeOuter(prop_value);
 
 	} else {
@@ -510,7 +507,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.isNull())
 		actuator->m_handle->seek(position);
 	return PY_SET_ATTR_SUCCESS;
 }
@@ -523,7 +520,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.isNull())
 		actuator->m_handle->setVolume(gain);
 
 	return PY_SET_ATTR_SUCCESS;
@@ -537,7 +534,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.isNull())
 		actuator->m_handle->setPitch(pitch);
 
 	return PY_SET_ATTR_SUCCESS;
@@ -551,7 +548,7 @@ int KX_SoundActuator::pyattr_set_sound(void *self, const struct KX_PYATTRIBUTE_D
 		return PY_SET_ATTR_FAIL;
 
 	AUD_Reference<AUD_IFactory>* snd = reinterpret_cast<AUD_Reference<AUD_IFactory>*>(AUD_getPythonSound(sound));
-	if(snd)
+	if (snd)
 	{
 		actuator->m_sound = *snd;
 		delete snd;
diff --git a/source/gameengine/Ketsji/KX_SoundActuator.h b/source/gameengine/Ketsji/KX_SoundActuator.h
index b911967..71ec3ae 100644
--- a/source/gameengine/Ketsji/KX_SoundActuator.h
+++ b/source/gameengine/Ketsji/KX_SoundActuator.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_SOUNDACTUATOR
-#define __KX_SOUNDACTUATOR
+#ifndef __KX_SOUNDACTUATOR_H__
+#define __KX_SOUNDACTUATOR_H__
 
 #include "SCA_IActuator.h"
 
@@ -127,5 +127,5 @@ public:
 
 };
 
-#endif //__KX_SOUNDACTUATOR
+#endif //__KX_SOUNDACTUATOR_H__
 
diff --git a/source/gameengine/Ketsji/KX_StateActuator.h b/source/gameengine/Ketsji/KX_StateActuator.h
index aa17b68..5ed065d 100644
--- a/source/gameengine/Ketsji/KX_StateActuator.h
+++ b/source/gameengine/Ketsji/KX_StateActuator.h
@@ -30,8 +30,8 @@
  *  \brief Actuator to toggle visibility/invisibility of objects
  */
 
-#ifndef __KX_STATEACTUATOR
-#define __KX_STATEACTUATOR
+#ifndef __KX_STATEACTUATOR_H__
+#define __KX_STATEACTUATOR_H__
 
 #include "SCA_IActuator.h"
 
diff --git a/source/gameengine/Ketsji/KX_SteeringActuator.cpp b/source/gameengine/Ketsji/KX_SteeringActuator.cpp
index 232b907..16b9285 100644
--- a/source/gameengine/Ketsji/KX_SteeringActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SteeringActuator.cpp
@@ -117,6 +117,12 @@ void KX_SteeringActuator::ProcessReplica()
 	SCA_IActuator::ProcessReplica();
 }
 
+void KX_SteeringActuator::ReParent(SCA_IObject* parent)
+{
+	SCA_IActuator::ReParent(parent);
+	if (m_simulation)
+		m_obstacle = m_simulation->GetObstacle((KX_GameObject*)m_gameobj);
+}
 
 bool KX_SteeringActuator::UnlinkObject(SCA_IObject* clientobj)
 {
@@ -266,11 +272,11 @@ bool KX_SteeringActuator::Update(double curtime, bool frame)
 			if (m_simulation && m_obstacle /*&& !newvel.fuzzyZero()*/)
 			{
 				if (m_enableVisualization)
-					KX_RasterizerDrawDebugLine(mypos, mypos + newvel, MT_Vector3(1.,0.,0.));
+					KX_RasterizerDrawDebugLine(mypos, mypos + newvel, MT_Vector3(1.0, 0.0, 0.0));
 				m_simulation->AdjustObstacleVelocity(m_obstacle, m_mode!=KX_STEERING_PATHFOLLOWING ? m_navmesh : NULL, 
 								newvel, m_acceleration*delta, m_turnspeed/180.0f*M_PI*delta);
 				if (m_enableVisualization)
-					KX_RasterizerDrawDebugLine(mypos, mypos + newvel, MT_Vector3(0.,1.,0.));
+					KX_RasterizerDrawDebugLine(mypos, mypos + newvel, MT_Vector3(0.0, 1.0, 0.0));
 			}
 
 			HandleActorFace(newvel);
@@ -338,7 +344,7 @@ static bool barDistSqPointToTri(const float* p, const float* a, const float* b,
 
 	float ud = u<0.f ? -u : (u>1.f ? u-1.f : 0.f);
 	float vd = v<0.f ? -v : (v>1.f ? v-1.f : 0.f);
-	return ud*ud+vd*vd ;
+	return ud * ud + vd * vd;
 }
 
 inline void flipAxes(float* vec)
@@ -484,7 +490,7 @@ void KX_SteeringActuator::HandleActorFace(MT_Vector3& velocity)
 	
 	
 	KX_GameObject* parentObject = curobj->GetParent();
-	if(parentObject)
+	if (parentObject)
 	{ 
 		MT_Point3 localpos;
 		localpos = curobj->GetSGNode()->GetLocalPosition();
@@ -502,7 +508,7 @@ void KX_SteeringActuator::HandleActorFace(MT_Vector3& velocity)
 
 }
 
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
 
 /* ------------------------------------------------------------------------- */
 /* Python functions                                                          */
@@ -536,7 +542,7 @@ PyMethodDef KX_SteeringActuator::Methods[] = {
 };
 
 PyAttributeDef KX_SteeringActuator::Attributes[] = {
-	KX_PYATTRIBUTE_INT_RW("behaviour", KX_STEERING_NODEF+1, KX_STEERING_MAX-1, true, KX_SteeringActuator, m_mode),
+	KX_PYATTRIBUTE_INT_RW("behavior", KX_STEERING_NODEF+1, KX_STEERING_MAX-1, true, KX_SteeringActuator, m_mode),
 	KX_PYATTRIBUTE_RW_FUNCTION("target", KX_SteeringActuator, pyattr_get_target, pyattr_set_target),
 	KX_PYATTRIBUTE_RW_FUNCTION("navmesh", KX_SteeringActuator, pyattr_get_navmesh, pyattr_set_navmesh),
 	KX_PYATTRIBUTE_FLOAT_RW("distance", 0.0f, 1000.0f, KX_SteeringActuator, m_distance),
@@ -620,7 +626,7 @@ PyObject* KX_SteeringActuator::pyattr_get_steeringVec(void *self, const struct K
 	return PyObjectFrom(steeringVec);
 }
 
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
 
 /* eof */
 
diff --git a/source/gameengine/Ketsji/KX_SteeringActuator.h b/source/gameengine/Ketsji/KX_SteeringActuator.h
index 0e9d4c7..c22a636 100644
--- a/source/gameengine/Ketsji/KX_SteeringActuator.h
+++ b/source/gameengine/Ketsji/KX_SteeringActuator.h
@@ -24,8 +24,8 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef __KX_STEERINGACTUATOR
-#define __KX_STEERINGACTUATOR
+#ifndef __KX_STEERINGACTUATOR_H__
+#define __KX_STEERINGACTUATOR_H__
 
 #include "SCA_IActuator.h"
 #include "SCA_LogicManager.h"
@@ -95,11 +95,12 @@ public:
 
 	virtual CValue* GetReplica();
 	virtual void ProcessReplica();
+	virtual void ReParent(SCA_IObject* parent);
 	virtual void Relink(CTR_Map<CTR_HashedPtr, void*> *obj_map);
 	virtual bool UnlinkObject(SCA_IObject* clientobj);
 	const MT_Vector3& GetSteeringVec();
 
-#ifndef DISABLE_PYTHON
+#ifdef WITH_PYTHON
 
 	/* --------------------------------------------------------------------- */
 	/* Python interface ---------------------------------------------------- */
@@ -113,7 +114,7 @@ public:
 	static PyObject* pyattr_get_steeringVec(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
 	
 
-#endif // DISABLE_PYTHON
+#endif // WITH_PYTHON
 
 }; /* end of class KX_SteeringActuator : public SCA_PropertyActuator */
 
diff --git a/source/gameengine/Ketsji/KX_TimeCategoryLogger.cpp b/source/gameengine/Ketsji/KX_TimeCategoryLogger.cpp
index 2b09fe0..1371799 100644
--- a/source/gameengine/Ketsji/KX_TimeCategoryLogger.cpp
+++ b/source/gameengine/Ketsji/KX_TimeCategoryLogger.cpp
@@ -120,7 +120,7 @@ double KX_TimeCategoryLogger::GetAverage(TimeCategory tc)
 
 double KX_TimeCategoryLogger::GetAverage(void)
 {
-	double time = 0.;
+	double time = 0.0;
 
 	KX_TimeLoggerMap::iterator it;
 	for (it = m_loggers.begin(); it != m_loggers.end(); it++) {
diff --git a/source/gameengine/Ketsji/KX_TimeCategoryLogger.h b/source/gameengine/Ketsji/KX_TimeCategoryLogger.h
index 9c9df29..62b7487 100644
--- a/source/gameengine/Ketsji/KX_TimeCategoryLogger.h
+++ b/source/gameengine/Ketsji/KX_TimeCategoryLogger.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_TIME_CATEGORY_LOGGER_H
-#define __KX_TIME_CATEGORY_LOGGER_H
+#ifndef __KX_TIMECATEGORYLOGGER_H__
+#define __KX_TIMECATEGORYLOGGER_H__
 
 #if defined(WIN32) && !defined(FREE_WINDOWS)
 #pragma warning (disable:4786) // suppress stl-MSVC debug info warning
@@ -52,7 +52,7 @@ public:
 
 	/**
 	 * Constructor.
-	 * @param maxNumMesasurements Maximum number of measurements stored (> 1).
+	 * \param maxNumMesasurements Maximum number of measurements stored (> 1).
 	 */
 	KX_TimeCategoryLogger(unsigned int maxNumMeasurements = 10);
 
@@ -73,40 +73,40 @@ public:
 
 	/**
 	 * Adds a category.
-	 * @param category	The new category.
+	 * \param category	The new category.
 	 */
 	virtual void AddCategory(TimeCategory tc);
 
 	/**
 	 * Starts logging in current measurement for the given category.
-	 * @param tc					The category to log to.
-	 * @param now					The current time.
-	 * @param endOtherCategories	Whether to stop logging to other categories.
+	 * \param tc					The category to log to.
+	 * \param now					The current time.
+	 * \param endOtherCategories	Whether to stop logging to other categories.
 	 */
 	virtual void StartLog(TimeCategory tc, double now, bool endOtherCategories = true);
 
 	/**
 	 * End logging in current measurement for the given category.
-	 * @param tc	The category to log to.
-	 * @param now	The current time.
+	 * \param tc	The category to log to.
+	 * \param now	The current time.
 	 */
 	virtual void EndLog(TimeCategory tc, double now);
 
 	/**
 	 * End logging in current measurement for all categories.
-	 * @param now	The current time.
+	 * \param now	The current time.
 	 */
 	virtual void EndLog(double now);
 
 	/**
 	 * Logs time in next measurement.
-	 * @param now	The current time.
+	 * \param now	The current time.
 	 */
 	virtual void NextMeasurement(double now);
 
 	/**
 	 * Returns average of all but the current measurement time.
-	 * @return The average of all but the current measurement.
+	 * \return The average of all but the current measurement.
 	 */
 	virtual double GetAverage(TimeCategory tc);
 
@@ -135,5 +135,5 @@ public:
 #endif
 };
 
-#endif // __KX_TIME_CATEGORY_LOGGER_H
+#endif // __KX_TIMECATEGORYLOGGER_H__
 
diff --git a/source/gameengine/Ketsji/KX_TimeLogger.cpp b/source/gameengine/Ketsji/KX_TimeLogger.cpp
index e0aea45..1a0d3d2 100644
--- a/source/gameengine/Ketsji/KX_TimeLogger.cpp
+++ b/source/gameengine/Ketsji/KX_TimeLogger.cpp
@@ -87,7 +87,7 @@ void KX_TimeLogger::NextMeasurement(double now)
 	EndLog(now);
 
 	// Add a new measurement at the front
-	double m = 0.;
+	double m = 0.0;
 	m_measurements.push_front(m);
 
 	// Remove measurement if we grow beyond the maximum size
@@ -102,7 +102,7 @@ void KX_TimeLogger::NextMeasurement(double now)
 
 double KX_TimeLogger::GetAverage(void) const
 {
-	double avg = 0.;
+	double avg = 0.0;
 
 	unsigned int numMeasurements = m_measurements.size();
 	if (numMeasurements > 1) {
diff --git a/source/gameengine/Ketsji/KX_TimeLogger.h b/source/gameengine/Ketsji/KX_TimeLogger.h
index 0f29f44..b2336c2 100644
--- a/source/gameengine/Ketsji/KX_TimeLogger.h
+++ b/source/gameengine/Ketsji/KX_TimeLogger.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_TIME_LOGGER_H
-#define __KX_TIME_LOGGER_H
+#ifndef __KX_TIMELOGGER_H__
+#define __KX_TIMELOGGER_H__
 
 #if defined(WIN32) && !defined(FREE_WINDOWS)
 #pragma warning (disable:4786) // suppress stl-MSVC debug info warning
@@ -49,7 +49,7 @@ class KX_TimeLogger {
 public:
 	/**
 	 * Constructor.
-	 * @param maxNumMesasurements Maximum number of measurements stored (>1).
+	 * \param maxNumMesasurements Maximum number of measurements stored (>1).
 	 */
 	KX_TimeLogger(unsigned int maxNumMeasurements = 10);
 
@@ -70,25 +70,25 @@ public:
 
 	/**
 	 * Starts logging in current measurement.
-	 * @param now	The current time.
+	 * \param now	The current time.
 	 */
 	virtual void StartLog(double now);
 
 	/**
 	 * End logging in current measurement.
-	 * @param now	The current time.
+	 * \param now	The current time.
 	 */
 	virtual void EndLog(double now);
 
 	/**
 	 * Logs time in next measurement.
-	 * @param now	The current time.
+	 * \param now	The current time.
 	 */
 	virtual void NextMeasurement(double now);
 
 	/**
 	 * Returns average of all but the current measurement.
-	 * @return The average of all but the current measurement.
+	 * \return The average of all but the current measurement.
 	 */
 	virtual double GetAverage(void) const;
 
@@ -113,5 +113,5 @@ public:
 #endif
 };
 
-#endif // __KX_TIME_LOGGER_H
+#endif // __KX_TIMELOGGER_H__
 
diff --git a/source/gameengine/Ketsji/KX_TouchEventManager.cpp b/source/gameengine/Ketsji/KX_TouchEventManager.cpp
index 939aa5d..d2a5ce5 100644
--- a/source/gameengine/Ketsji/KX_TouchEventManager.cpp
+++ b/source/gameengine/Ketsji/KX_TouchEventManager.cpp
@@ -101,7 +101,7 @@ bool	 KX_TouchEventManager::newBroadphaseResponse(void *client_data,
 	case KX_ClientObjectInfo::OBACTORSENSOR:
 		// this object may have multiple collision sensors, 
 		// check is any of them is interested in this object
-		for(std::list<SCA_ISensor*>::iterator it = info->m_sensors.begin();
+		for (std::list<SCA_ISensor*>::iterator it = info->m_sensors.begin();
 			it != info->m_sensors.end();
 			++it)
 		{
diff --git a/source/gameengine/Ketsji/KX_TouchEventManager.h b/source/gameengine/Ketsji/KX_TouchEventManager.h
index b219f33..38286cb 100644
--- a/source/gameengine/Ketsji/KX_TouchEventManager.h
+++ b/source/gameengine/Ketsji/KX_TouchEventManager.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_TOUCHEVENTMANAGER
-#define __KX_TOUCHEVENTMANAGER
+#ifndef __KX_TOUCHEVENTMANAGER_H__
+#define __KX_TOUCHEVENTMANAGER_H__
 
 
 #include "SCA_EventManager.h"
@@ -87,5 +87,5 @@ public:
 #endif
 };
 
-#endif //__KX_TOUCHEVENTMANAGER
+#endif //__KX_TOUCHEVENTMANAGER_H__
 
diff --git a/source/gameengine/Ketsji/KX_TouchSensor.h b/source/gameengine/Ketsji/KX_TouchSensor.h
index 1fae766..1a22067 100644
--- a/source/gameengine/Ketsji/KX_TouchSensor.h
+++ b/source/gameengine/Ketsji/KX_TouchSensor.h
@@ -30,8 +30,8 @@
  *  \brief Senses touch and collision events
  */
 
-#ifndef __KX_TOUCHSENSOR
-#define __KX_TOUCHSENSOR
+#ifndef __KX_TOUCHSENSOR_H__
+#define __KX_TOUCHSENSOR_H__
 
 #include "SCA_ISensor.h"
 #include "ListValue.h"
@@ -68,7 +68,7 @@ protected:
 
 	// Use with m_bTouchPulse to detect changes
 	int						m_bLastCount;		/* size of m_colliders last tick */
-	uint_ptr				m_bColliderHash;	/* hash collision objects pointers to trigger incase one object collides and another takes its place */
+	uint_ptr				m_bColliderHash;	/* hash collision objects pointers to trigger in case one object collides and another takes its place */
 	uint_ptr				m_bLastColliderHash;
 
 	SCA_IObject*		    m_hitObject;
@@ -79,7 +79,7 @@ public:
 		class KX_GameObject* gameobj,
 		bool bFindMaterial,
 		bool bTouchPulse,
-		const STR_String& touchedpropname) ;
+		const STR_String& touchedpropname);
 	virtual ~KX_TouchSensor();
 
 	virtual CValue* GetReplica();
@@ -132,5 +132,5 @@ public:
 	
 };
 
-#endif //__KX_TOUCHSENSOR
+#endif //__KX_TOUCHSENSOR_H__
 
diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.cpp b/source/gameengine/Ketsji/KX_TrackToActuator.cpp
index a08e57c..af93121 100644
--- a/source/gameengine/Ketsji/KX_TrackToActuator.cpp
+++ b/source/gameengine/Ketsji/KX_TrackToActuator.cpp
@@ -72,7 +72,7 @@ KX_TrackToActuator::KX_TrackToActuator(SCA_IObject *gameobj,
 
 	{
 		// if the object is vertex parented, don't check parent orientation as the link is broken
-		if (!((KX_GameObject*)gameobj)->IsVertexParent()){
+		if (!((KX_GameObject*)gameobj)->IsVertexParent()) {
 			m_parentobj = ((KX_GameObject*)gameobj)->GetParent(); // check if the object is parented 
 			if (m_parentobj) {  
 				// if so, store the initial local rotation
@@ -153,14 +153,14 @@ void compatible_eulFast(float *eul, float *oldrot)
 	dy= eul[1] - oldrot[1];
 	dz= eul[2] - oldrot[2];
 
-	if( fabs(dx) > MT_PI) {
-		if(dx > 0.0) eul[0] -= MT_2_PI; else eul[0]+= MT_2_PI;
+	if ( fabs(dx) > MT_PI) {
+		if (dx > 0.0) eul[0] -= MT_2_PI; else eul[0]+= MT_2_PI;
 	}
-	if( fabs(dy) > MT_PI) {
-		if(dy > 0.0) eul[1] -= MT_2_PI; else eul[1]+= MT_2_PI;
+	if ( fabs(dy) > MT_PI) {
+		if (dy > 0.0) eul[1] -= MT_2_PI; else eul[1]+= MT_2_PI;
 	}
-	if( fabs(dz) > MT_PI ) {
-		if(dz > 0.0) eul[2] -= MT_2_PI; else eul[2]+= MT_2_PI;
+	if ( fabs(dz) > MT_PI ) {
+		if (dz > 0.0) eul[2] -= MT_2_PI; else eul[2]+= MT_2_PI;
 	}
 }
 
@@ -391,7 +391,7 @@ bool KX_TrackToActuator::Update(double curtime, bool frame)
 		mat= matrix3x3_interpol(oldmat, mat, m_time);
 		
 
-		if(m_parentobj){ // check if the model is parented and calculate the child transform
+		if (m_parentobj) { // check if the model is parented and calculate the child transform
 				
 			MT_Point3 localpos;
 			localpos = curobj->GetSGNode()->GetLocalPosition();
diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.h b/source/gameengine/Ketsji/KX_TrackToActuator.h
index 30e276c..8eb69b1 100644
--- a/source/gameengine/Ketsji/KX_TrackToActuator.h
+++ b/source/gameengine/Ketsji/KX_TrackToActuator.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_TrackToActuator
-#define __KX_TrackToActuator
+#ifndef __KX_TRACKTOACTUATOR_H__
+#define __KX_TRACKTOACTUATOR_H__
 
 #include "SCA_IActuator.h"
 #include "SCA_IObject.h"
diff --git a/source/gameengine/Ketsji/KX_VehicleWrapper.h b/source/gameengine/Ketsji/KX_VehicleWrapper.h
index f6e360d..3684019 100644
--- a/source/gameengine/Ketsji/KX_VehicleWrapper.h
+++ b/source/gameengine/Ketsji/KX_VehicleWrapper.h
@@ -3,8 +3,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef KX_VEHICLE_WRAPPER
-#define KX_VEHICLE_WRAPPER
+#ifndef __KX_VEHICLEWRAPPER_H__
+#define __KX_VEHICLEWRAPPER_H__
 
 #include "Value.h"
 #include "PHY_DynamicTypes.h"
@@ -59,4 +59,4 @@ private:
 	PHY_IPhysicsEnvironment* m_physenv;
 };
 
-#endif //KX_VEHICLE_WRAPPER
+#endif //__KX_VEHICLEWRAPPER_H__
diff --git a/source/gameengine/Ketsji/KX_VertexProxy.cpp b/source/gameengine/Ketsji/KX_VertexProxy.cpp
index a07e328..1739f26 100644
--- a/source/gameengine/Ketsji/KX_VertexProxy.cpp
+++ b/source/gameengine/Ketsji/KX_VertexProxy.cpp
@@ -548,7 +548,7 @@ PyObject* KX_VertexProxy::PySetUV2(PyObject* args)
 	unsigned int unit= RAS_TexVert::SECOND_UV;
 
 	PyObject* list= NULL;
-	if(!PyArg_ParseTuple(args, "O|i:setUV2", &list, &unit))
+	if (!PyArg_ParseTuple(args, "O|i:setUV2", &list, &unit))
 		return NULL;
 
 	if (!PyVecTo(list, vec))
diff --git a/source/gameengine/Ketsji/KX_VertexProxy.h b/source/gameengine/Ketsji/KX_VertexProxy.h
index 905a4e0..3084e5f 100644
--- a/source/gameengine/Ketsji/KX_VertexProxy.h
+++ b/source/gameengine/Ketsji/KX_VertexProxy.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_VERTEXPROXY
-#define __KX_VERTEXPROXY
+#ifndef __KX_VERTEXPROXY_H__
+#define __KX_VERTEXPROXY_H__
 
 #ifdef WITH_PYTHON
 
@@ -48,7 +48,7 @@ public:
 	virtual ~KX_VertexProxy();
 
 	// stuff for cvalue related things
-	CValue*		Calc(VALUE_OPERATOR op, CValue *val) ;
+	CValue*		Calc(VALUE_OPERATOR op, CValue *val);
 	CValue*		CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val);
 	const STR_String &	GetText();
 	double		GetNumber();
@@ -107,5 +107,5 @@ public:
 
 #endif // WITH_PYTHON
 
-#endif //__KX_VERTEXPROXY
+#endif //__KX_VERTEXPROXY_H__
 
diff --git a/source/gameengine/Ketsji/KX_VisibilityActuator.h b/source/gameengine/Ketsji/KX_VisibilityActuator.h
index f5c45ec..a207844 100644
--- a/source/gameengine/Ketsji/KX_VisibilityActuator.h
+++ b/source/gameengine/Ketsji/KX_VisibilityActuator.h
@@ -30,8 +30,8 @@
  *  \brief Actuator to toggle visibility/invisibility of objects
  */
 
-#ifndef __KX_VISIBILITYACTUATOR
-#define __KX_VISIBILITYACTUATOR
+#ifndef __KX_VISIBILITYACTUATOR_H__
+#define __KX_VISIBILITYACTUATOR_H__
 
 #include "SCA_IActuator.h"
 
diff --git a/source/gameengine/Ketsji/KX_WorldInfo.h b/source/gameengine/Ketsji/KX_WorldInfo.h
index c5ce548..cb4e9de 100644
--- a/source/gameengine/Ketsji/KX_WorldInfo.h
+++ b/source/gameengine/Ketsji/KX_WorldInfo.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef __KX_WORLDINFO_H
-#define __KX_WORLDINFO_H
+#ifndef __KX_WORLDINFO_H__
+#define __KX_WORLDINFO_H__
 
 #include "MT_Scalar.h"
 
@@ -76,5 +76,5 @@ public:
 #endif
 };
 
-#endif //__KX_WORLDINFO_H
+#endif //__KX_WORLDINFO_H__
 
diff --git a/source/gameengine/Ketsji/KX_WorldIpoController.h b/source/gameengine/Ketsji/KX_WorldIpoController.h
index 5c55e4f..1f60280 100644
--- a/source/gameengine/Ketsji/KX_WorldIpoController.h
+++ b/source/gameengine/Ketsji/KX_WorldIpoController.h
@@ -29,8 +29,8 @@
  *  \ingroup ketsji
  */
 
-#ifndef KX_WORLDIPOCONTROLLER_H
-#define KX_WORLDIPOCONTROLLER_H
+#ifndef __KX_WORLDIPOCONTROLLER_H__
+#define __KX_WORLDIPOCONTROLLER_H__
 
 #include "SG_Controller.h"
 #include "SG_Spatial.h"
@@ -102,5 +102,5 @@ public:
 #endif
 };
 
-#endif // KX_LIGHTIPOSGCONTROLLER_H
+#endif // __KX_WORLDIPOCONTROLLER_H__
 
diff --git a/source/gameengine/Ketsji/SConscript b/source/gameengine/Ketsji/SConscript
index 064f09d..2943acd 100644
--- a/source/gameengine/Ketsji/SConscript
+++ b/source/gameengine/Ketsji/SConscript
@@ -36,7 +36,7 @@ if env['WITH_BF_PYTHON']:
 if env['WITH_BF_FFMPEG']:
     defs.append('WITH_FFMPEG')
 
-if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'):
+if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'win64-mingw'):
     if env['BF_DEBUG']:
         defs.append('_DEBUG') # for Python
 
diff --git a/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.cpp b/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.cpp
index 0dc468a..c57bd30 100644
--- a/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.cpp
+++ b/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.cpp
@@ -34,6 +34,8 @@
 #include "NG_LoopBackNetworkDeviceInterface.h"
 #include "NG_NetworkMessage.h"
 
+using namespace std;
+
 // temporary debugging printf's
 #ifdef NAN_NET_DEBUG
   #include <stdio.h>
diff --git a/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.h b/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.h
index b03fc8e..a356b20 100644
--- a/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.h
+++ b/source/gameengine/Network/LoopBackNetwork/NG_LoopBackNetworkDeviceInterface.h
@@ -29,8 +29,8 @@
  *  \ingroup bgenetlb
  *  \brief LoopbackNetworkDeviceInterface derived from NG_NetworkDeviceInterface
  */
-#ifndef NG_LOOPBACKNETWORKDEVICEINTERFACE_H
-#define NG_LOOPBACKNETWORKDEVICEINTERFACE_H
+#ifndef __NG_LOOPBACKNETWORKDEVICEINTERFACE_H__
+#define __NG_LOOPBACKNETWORKDEVICEINTERFACE_H__
 
 #include <deque>
 #include "NG_NetworkDeviceInterface.h"
@@ -55,8 +55,8 @@ public:
 	bool Disconnect(void) {return true;}
 
 	virtual void SendNetworkMessage(class NG_NetworkMessage* msg);
-	virtual vector<NG_NetworkMessage*>		RetrieveNetworkMessages();
+	virtual std::vector<NG_NetworkMessage*>		RetrieveNetworkMessages();
 };
 
-#endif //NG_LOOPBACKNETWORKDEVICEINTERFACE_H
+#endif //__NG_LOOPBACKNETWORKDEVICEINTERFACE_H__
 
diff --git a/source/gameengine/Network/NG_NetworkDeviceInterface.h b/source/gameengine/Network/NG_NetworkDeviceInterface.h
index ce5720c..d4a3d12 100644
--- a/source/gameengine/Network/NG_NetworkDeviceInterface.h
+++ b/source/gameengine/Network/NG_NetworkDeviceInterface.h
@@ -31,8 +31,8 @@
  * To be derived by loopback and network libraries
  */
 
-#ifndef NG_NETWORKDEVICEINTERFACE_H
-#define NG_NETWORKDEVICEINTERFACE_H
+#ifndef __NG_NETWORKDEVICEINTERFACE_H__
+#define __NG_NETWORKDEVICEINTERFACE_H__
 
 #include "NG_NetworkMessage.h"
 #include <vector>
@@ -81,5 +81,5 @@ public:
 #endif
 };
 
-#endif //NG_NETWORKDEVICEINTERFACE_H
+#endif //__NG_NETWORKDEVICEINTERFACE_H__
 
diff --git a/source/gameengine/Network/NG_NetworkMessage.h b/source/gameengine/Network/NG_NetworkMessage.h
index 75da167..7a55891 100644
--- a/source/gameengine/Network/NG_NetworkMessage.h
+++ b/source/gameengine/Network/NG_NetworkMessage.h
@@ -29,8 +29,8 @@
  *  \ingroup bgenet
  *  \brief generic Network Message class
  */
-#ifndef NG_NETWORKMESSAGE_H
-#define NG_NETWORKMESSAGE_H
+#ifndef __NG_NETWORKMESSAGE_H__
+#define __NG_NETWORKMESSAGE_H__
 
 #include "STR_HashedString.h"
 
@@ -84,17 +84,17 @@ public:
 	/**
 	 * get the (read-only) To part of this message
 	 */
-	const STR_String& GetDestinationName() { return m_to;};
+	const STR_String& GetDestinationName() { return m_to; }
 
 	/**
 	 * get the (read-only) From part of this message
 	 */
-	const STR_String& GetSenderName() { return m_from;};
+	const STR_String& GetSenderName() { return m_from; }
 
 	/**
 	 * get the (read-only) Subject part of this message
 	 */
-	const STR_String& GetSubject() { return m_subject;};
+	const STR_String& GetSubject() { return m_subject; }
 
 	/**
 	 * get the (read-only) Body part of this message
@@ -137,5 +137,5 @@ public:
 #endif
 };
 
-#endif //NG_NETWORKMESSAGE_H
+#endif //__NG_NETWORKMESSAGE_H__
 
diff --git a/source/gameengine/Network/NG_NetworkObject.h b/source/gameengine/Network/NG_NetworkObject.h
index b3f5a18..b7b01bd 100644
--- a/source/gameengine/Network/NG_NetworkObject.h
+++ b/source/gameengine/Network/NG_NetworkObject.h
@@ -29,8 +29,8 @@
  *  \ingroup bgenet
  *  \brief generic Network Object class
  */
-#ifndef NG_NETWORKOBJECT_H
-#define NG_NETWORKOBJECT_H
+#ifndef __NG_NETWORKOBJECT_H__
+#define __NG_NETWORKOBJECT_H__
 
 #include "STR_String.h"
 
@@ -54,5 +54,5 @@ public:
 #endif
 };
 
-#endif //NG_NETWORKOBJECT_H
+#endif //__NG_NETWORKOBJECT_H__
 
diff --git a/source/gameengine/Network/NG_NetworkScene.cpp b/source/gameengine/Network/NG_NetworkScene.cpp
index 4c5206e..3dbfb53 100644
--- a/source/gameengine/Network/NG_NetworkScene.cpp
+++ b/source/gameengine/Network/NG_NetworkScene.cpp
@@ -144,7 +144,8 @@ void NG_NetworkScene::RemoveAllObjects()
 /**
  * get a single network object given its name
  */
-NG_NetworkObject* NG_NetworkScene::FindNetworkObject(const STR_String& objname) {
+NG_NetworkObject* NG_NetworkScene::FindNetworkObject(const STR_String& objname)
+{
 	NG_NetworkObject *nwobj = NULL;
 	if (! m_networkdevice->IsOnline()) return nwobj;
 
diff --git a/source/gameengine/Network/NG_NetworkScene.h b/source/gameengine/Network/NG_NetworkScene.h
index 01a0d18..b3ca4df 100644
--- a/source/gameengine/Network/NG_NetworkScene.h
+++ b/source/gameengine/Network/NG_NetworkScene.h
@@ -29,8 +29,8 @@
  *  \ingroup bgenet
  *  \brief NetworkSceneManagement generic class
  */
-#ifndef __NG_NETWORKSCENE_H
-#define __NG_NETWORKSCENE_H
+#ifndef __NG_NETWORKSCENE_H__
+#define __NG_NETWORKSCENE_H__
 
 #include "CTR_Map.h"
 #include "STR_HashedString.h"
@@ -45,6 +45,8 @@
 	#undef SendMessage
 #endif
 
+using namespace std;
+
 class NG_NetworkDeviceInterface;
 
 class NG_NetworkScene
@@ -103,7 +105,7 @@ protected:
 
 	/**
 	 * Releases messages for the given message map.
-	 * @param map	Message map with messages.
+	 * \param map	Message map with messages.
 	 */
 	void ClearMessageMap(TMessageMap& map);	
 
@@ -115,5 +117,5 @@ public:
 #endif
 };
 
-#endif //__NG_NETWORKSCENE_H
+#endif //__NG_NETWORKSCENE_H__
 
diff --git a/source/gameengine/Physics/Bullet/CcdGraphicController.cpp b/source/gameengine/Physics/Bullet/CcdGraphicController.cpp
index a5577d5..36e7b0d 100644
--- a/source/gameengine/Physics/Bullet/CcdGraphicController.cpp
+++ b/source/gameengine/Physics/Bullet/CcdGraphicController.cpp
@@ -86,12 +86,12 @@ void CcdGraphicController::getAabb(btVector3& aabbMin, btVector3& aabbMax)
 	btVector3 tmpAabbMin = m_localAabbMin * scale;
 	btVector3 tmpAabbMax = m_localAabbMax * scale;
 
-	localAabbMin[0] = (scale.getX() >= 0.) ? tmpAabbMin[0] : tmpAabbMax[0];
-	localAabbMin[1] = (scale.getY() >= 0.) ? tmpAabbMin[1] : tmpAabbMax[1];
-	localAabbMin[2] = (scale.getZ() >= 0.) ? tmpAabbMin[2] : tmpAabbMax[2];
-	localAabbMax[0] = (scale.getX() <= 0.) ? tmpAabbMin[0] : tmpAabbMax[0];
-	localAabbMax[1] = (scale.getY() <= 0.) ? tmpAabbMin[1] : tmpAabbMax[1];
-	localAabbMax[2] = (scale.getZ() <= 0.) ? tmpAabbMin[2] : tmpAabbMax[2];
+	localAabbMin[0] = (scale.getX() >= 0.0) ? tmpAabbMin[0] : tmpAabbMax[0];
+	localAabbMin[1] = (scale.getY() >= 0.0) ? tmpAabbMin[1] : tmpAabbMax[1];
+	localAabbMin[2] = (scale.getZ() >= 0.0) ? tmpAabbMin[2] : tmpAabbMax[2];
+	localAabbMax[0] = (scale.getX() <= 0.0) ? tmpAabbMin[0] : tmpAabbMax[0];
+	localAabbMax[1] = (scale.getY() <= 0.0) ? tmpAabbMin[1] : tmpAabbMax[1];
+	localAabbMax[2] = (scale.getZ() <= 0.0) ? tmpAabbMin[2] : tmpAabbMax[2];
 
 	btVector3 localHalfExtents = btScalar(0.5)*(localAabbMax-localAabbMin);
 	btVector3 localCenter = btScalar(0.5)*(localAabbMax+localAabbMin);
@@ -131,7 +131,7 @@ void CcdGraphicController::SetPhysicsEnvironment(class PHY_IPhysicsEnvironment*
 {
 	CcdPhysicsEnvironment* phyEnv = static_cast<CcdPhysicsEnvironment*>(env);
 	/* Updates the m_phyEnv's m_cullingTree & m_cullingCache */
-	if(getBroadphaseHandle()) {
+	if (getBroadphaseHandle()) {
 		/* insert into the new physics scene */
 		Activate(false);
 		m_phyEnv= phyEnv;
diff --git a/source/gameengine/Physics/Bullet/CcdGraphicController.h b/source/gameengine/Physics/Bullet/CcdGraphicController.h
index d0cb899..07878b7 100644
--- a/source/gameengine/Physics/Bullet/CcdGraphicController.h
+++ b/source/gameengine/Physics/Bullet/CcdGraphicController.h
@@ -18,8 +18,8 @@ subject to the following restrictions:
  */
 
 
-#ifndef BULLET2_GRAPHICCONTROLLER_H
-#define BULLET2_GRAPHICCONTROLLER_H
+#ifndef __CCDGRAPHICCONTROLLER_H__
+#define __CCDGRAPHICCONTROLLER_H__
 
 #include "PHY_IGraphicController.h"
 
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
index 4b3e2ea..6c1e299 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
@@ -207,14 +207,14 @@ bool CcdPhysicsController::CreateSoftbody()
 			
 			psb=new btSoftBody(&worldInfo,(int)hres.mNumOutputVertices,
 				&hres.m_OutputVertices[0],0);
-			for(int i=0;i<(int)hres.mNumFaces;++i)
+			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]);
+				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);
@@ -379,10 +379,10 @@ bool CcdPhysicsController::CreateSoftbody()
 				mmat = rasMesh->GetMeshMaterial(m);
 
 				slot = mmat->m_baseslot;
-				for(slot->begin(it); !slot->end(it); slot->next(it))
+				for (slot->begin(it); !slot->end(it); slot->next(it))
 				{
 					int index = 0;
-					for(i=it.startvertex; i<it.endvertex; i++,index++) 
+					for (i=it.startvertex; i<it.endvertex; i++,index++) 
 					{
 						RAS_TexVert* vertex = &it.vertex[i];
 						//search closest index, and store it in vertex
@@ -492,7 +492,7 @@ static void DeleteBulletShape(btCollisionShape* shape, bool free)
 		if (meshInterface)
 			delete meshInterface;
 	}
-	if(free) {
+	if (free) {
 		delete shape;
 	}
 }
@@ -555,12 +555,12 @@ bool CcdPhysicsController::ReplaceControllerShape(btCollisionShape *newShape)
 	btCollisionObject *ob;
 	btBroadphaseProxy* proxy;
 
-	for(int i= 0; i < obarr.size(); i++) {
+	for (int i= 0; i < obarr.size(); i++) {
 		ob= obarr[i];
 		if (ob->getCollisionShape() == newShape) {
 			proxy = ob->getBroadphaseHandle();
 			
-			if(proxy)
+			if (proxy)
 				dw->getPairCache()->cleanProxyFromPairs(proxy,dw->getDispatcher());
 		}
 	}
@@ -629,7 +629,7 @@ bool		CcdPhysicsController::SynchronizeMotionStates(float time)
 			const btVector3& linvel = body->getLinearVelocity();
 			float len= linvel.length();
 			
-			if((m_cci.m_clamp_vel_max>0.0) && (len > m_cci.m_clamp_vel_max))
+			if ((m_cci.m_clamp_vel_max>0.0) && (len > m_cci.m_clamp_vel_max))
 					body->setLinearVelocity(linvel * (m_cci.m_clamp_vel_max / len));
 			
 			else if ((m_cci.m_clamp_vel_min>0.0) && btFuzzyZero(len)==0 && (len < m_cci.m_clamp_vel_min))
@@ -863,9 +863,9 @@ void		CcdPhysicsController::RelativeRotate(const float rotval[9],bool local)
 			return;
 		}
 
-		btMatrix3x3 drotmat(	rotval[0],rotval[4],rotval[8],
-								rotval[1],rotval[5],rotval[9],
-								rotval[2],rotval[6],rotval[10]);
+		btMatrix3x3 drotmat(rotval[0], rotval[3], rotval[6],
+		                    rotval[1], rotval[4], rotval[7],
+		                    rotval[2], rotval[5], rotval[8]);
 
 
 		btMatrix3x3 currentOrn;
@@ -1431,14 +1431,15 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
 	if (!dm) {
 		free_dm = true;
 		dm = CDDM_from_mesh(meshobj->GetMesh(), NULL);
+		DM_ensure_tessface(dm);
 	}
 
 	MVert *mvert = dm->getVertArray(dm);
-	MFace *mface = dm->getFaceArray(dm);
-	numpolys = dm->getNumFaces(dm);
+	MFace *mface = dm->getTessFaceArray(dm);
+	numpolys = dm->getNumTessFaces(dm);
 	numverts = dm->getNumVerts(dm);
-	int* index = (int*)dm->getFaceDataArray(dm, CD_ORIGINDEX);
-	MTFace *tface = (MTFace *)dm->getFaceDataArray(dm, CD_MTFACE);
+	int* index = (int*)dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
+	MTFace *tface = (MTFace *)dm->getTessFaceDataArray(dm, CD_MTFACE);
 
 	m_shapeType = (polytope) ? PHY_SHAPE_POLYTOPE : PHY_SHAPE_MESH;
 
@@ -1565,7 +1566,7 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
 				MVert *v2= &mvert[mf->v2];
 				MVert *v3= &mvert[mf->v3];
 
-				// the face indicies
+				// 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];
@@ -1643,12 +1644,12 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
 		/* If this ever gets confusing, print out an OBJ file for debugging */
 #if 0
 		printf("# vert count %d\n", m_vertexArray.size());
-		for(i=0; i<m_vertexArray.size(); i+=1) {
+		for (i=0; i<m_vertexArray.size(); i+=1) {
 			printf("v %.6f %.6f %.6f\n", m_vertexArray[i].x(), m_vertexArray[i].y(), m_vertexArray[i].z());
 		}
 
 		printf("# face count %d\n", m_triFaceArray.size());
-		for(i=0; i<m_triFaceArray.size(); i+=3) {
+		for (i=0; i<m_triFaceArray.size(); i+=3) {
 			printf("f %d %d %d\n", m_triFaceArray[i]+1, m_triFaceArray[i+1]+1, m_triFaceArray[i+2]+1);
 		}
 #endif
@@ -1700,10 +1701,10 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
 	const int tri_verts[4]=	{0,1,2,		-1};
 	const int *fv_pt;
 
-	if(gameobj==NULL && meshobj==NULL)
+	if (gameobj==NULL && meshobj==NULL)
 		return false;
 	
-	if(m_shapeType != PHY_SHAPE_MESH)
+	if (m_shapeType != PHY_SHAPE_MESH)
 		return false;
 
 	RAS_Deformer *deformer= gameobj ? gameobj->GetDeformer():NULL;
@@ -1713,49 +1714,49 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
 		dm = deformer->GetPhysicsMesh();
 	
 	/* get the mesh from the object if not defined */
-	if(meshobj==NULL) {
+	if (meshobj==NULL) {
 		
 		/* modifier mesh */
-		if(dm)
+		if (dm)
 			meshobj= deformer->GetRasMesh();
 		
 		/* game object first mesh */
-		if(meshobj==NULL) {
-			if(gameobj->GetMeshCount() > 0) {
+		if (meshobj==NULL) {
+			if (gameobj->GetMeshCount() > 0) {
 				meshobj= gameobj->GetMesh(0);
 			}
 		}
 	}
 	
-	if(dm && deformer->GetRasMesh() == meshobj)
+	if (dm && deformer->GetRasMesh() == meshobj)
 	{	/*
 		 * Derived Mesh Update
 		 *
 		 * */
 
 		MVert *mvert = dm->getVertArray(dm);
-		MFace *mface = dm->getFaceArray(dm);
-		numpolys = dm->getNumFaces(dm);
+		MFace *mface = dm->getTessFaceArray(dm);
+		numpolys = dm->getNumTessFaces(dm);
 		numverts = dm->getNumVerts(dm);
-		int* index = (int*)dm->getFaceDataArray(dm, CD_ORIGINDEX);
+		int* index = (int*)dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
 
 		MFace *mf;
 		MVert *mv;
 
 		int flen;
 
-		if(CustomData_has_layer(&dm->faceData, CD_MTFACE))
+		if (CustomData_has_layer(&dm->faceData, CD_MTFACE))
 		{
-			MTFace *tface = (MTFace *)dm->getFaceDataArray(dm, CD_MTFACE);
+			MTFace *tface = (MTFace *)dm->getTessFaceDataArray(dm, CD_MTFACE);
 			MTFace *tf;
 
 			vector<bool> vert_tag_array(numverts, false);
 			vector<int> vert_remap_array(numverts, 0);
 
-			for(mf= mface, tf= tface, i=0; i < numpolys; mf++, tf++, i++) {
-				if(tf->mode & TF_DYNAMIC)
+			for (mf= mface, tf= tface, i=0; i < numpolys; mf++, tf++, i++) {
+				if (tf->mode & TF_DYNAMIC)
 				{
-					if(mf->v4) {
+					if (mf->v4) {
 						tot_bt_tris+= 2;
 						flen= 4;
 					} else {
@@ -1763,11 +1764,11 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
 						flen= 3;
 					}
 
-					for(j=0; j<flen; j++)
+					for (j=0; j<flen; j++)
 					{
 						v_orig = (*(&mf->v1 + j));
 
-						if(vert_tag_array[v_orig]==false)
+						if (vert_tag_array[v_orig]==false)
 						{
 							vert_tag_array[v_orig]= true;
 							vert_remap_array[v_orig]= tot_bt_verts;
@@ -1789,13 +1790,13 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
 			m_polygonIndexArray.resize(tot_bt_tris);
 			int *poly_index_pt= &m_polygonIndexArray[0];
 
-			for(mf= mface, tf= tface, i=0; i < numpolys; mf++, tf++, i++)
+			for (mf= mface, tf= tface, i=0; i < numpolys; mf++, tf++, i++)
 			{
-				if(tf->mode & TF_DYNAMIC)
+				if (tf->mode & TF_DYNAMIC)
 				{
 					int origi = (index)? index[i]: i;
 
-					if(mf->v4) {
+					if (mf->v4) {
 						fv_pt= quad_verts;
 						*poly_index_pt++ = origi;
 						*poly_index_pt++ = origi;
@@ -1806,11 +1807,11 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
 						flen= 3;
 					}
 
-					for(; *fv_pt > -1; fv_pt++)
+					for (; *fv_pt > -1; fv_pt++)
 					{
 						v_orig = (*(&mf->v1 + (*fv_pt)));
 
-						if(vert_tag_array[v_orig])
+						if (vert_tag_array[v_orig])
 						{
 							mv= mvert + v_orig;
 							*bt++ = mv->co[0];
@@ -1832,7 +1833,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
 
 			tot_bt_verts= numverts;
 
-			for(mf= mface, i=0; i < numpolys; mf++, i++) {
+			for (mf= mface, i=0; i < numpolys; mf++, i++) {
 				tot_bt_tris += (mf->v4 ? 2:1);
 			}
 
@@ -1847,14 +1848,14 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
 
 			m_triFaceUVcoArray.clear();
 
-			for(mv= mvert, i=0; i < numverts; mv++, i++) {
+			for (mv= mvert, i=0; i < numverts; mv++, i++) {
 				*bt++ = mv->co[0]; *bt++ = mv->co[1]; *bt++ = mv->co[2];
 			}
 
-			for(mf= mface, i=0; i < numpolys; mf++, i++) {
+			for (mf= mface, i=0; i < numpolys; mf++, i++) {
 				int origi = (index)? index[i]: i;
 
-				if(mf->v4) {
+				if (mf->v4) {
 					fv_pt= quad_verts;
 					*poly_index_pt++ = origi;
 					*poly_index_pt++ = origi;
@@ -1864,7 +1865,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
 					*poly_index_pt++ = origi;
 				}
 
-				for(; *fv_pt > -1; fv_pt++)
+				for (; *fv_pt > -1; fv_pt++)
 					*tri_pt++ = (*(&mf->v1 + (*fv_pt)));
 			}
 		}
@@ -1881,7 +1882,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
 		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) {
+		if (deformer) {
 			/* map locations from the deformed array
 			 *
 			 * Could call deformer->Update(); but rely on redraw updating.
@@ -1898,15 +1899,15 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
 		vector<bool> vert_tag_array(numverts, false);
 		vector<int> vert_remap_array(numverts, 0);
 
-		for(int p=0; p<numpolys; p++)
+		for (int p=0; p<numpolys; p++)
 		{
 			RAS_Polygon* poly= meshobj->GetPolygon(p);
 			if (poly->IsCollider())
 			{
-				for(i=0; i < poly->VertexCount(); i++)
+				for (i=0; i < poly->VertexCount(); i++)
 				{
 					v_orig= poly->GetVertex(i)->getOrigIndex();
-					if(vert_tag_array[v_orig]==false)
+					if (vert_tag_array[v_orig]==false)
 					{
 						vert_tag_array[v_orig]= true;
 						vert_remap_array[v_orig]= tot_bt_verts;
@@ -1917,18 +1918,22 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
 			}
 		}
 
+		// This case happens when none of the polys are colliders
+		if (tot_bt_tris == 0 || tot_bt_verts == 0)
+			return false;
+
 		m_vertexArray.resize(tot_bt_verts*3);
 		btScalar *bt= &m_vertexArray[0];
 
 		m_triFaceArray.resize(tot_bt_tris*3);
 		int *tri_pt= &m_triFaceArray[0];
 
-		/* cant be used for anything useful in this case, since we dont rely on the original mesh
+		/* cant be used for anything useful in this case, since we don't rely on the original mesh
 		 * will just be an array like pythons range(tot_bt_tris) */
 		m_polygonIndexArray.resize(tot_bt_tris);
 
 
-		for(int p=0; p<numpolys; p++)
+		for (int p=0; p<numpolys; p++)
 		{
 			RAS_Polygon* poly= meshobj->GetPolygon(p);
 
@@ -1937,13 +1942,13 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
 				/* quad or tri loop */
 				fv_pt= (poly->VertexCount()==3 ? tri_verts:quad_verts);
 
-				for(; *fv_pt > -1; fv_pt++)
+				for (; *fv_pt > -1; fv_pt++)
 				{
 					v_orig= poly->GetVertex(*fv_pt)->getOrigIndex();
 
-					if(vert_tag_array[v_orig])
+					if (vert_tag_array[v_orig])
 					{
-						if(transverts) {
+						if (transverts) {
 							/* deformed mesh, using RAS_TexVert locations would be too troublesome
 							 * because they are use the gameob as a hash in the material slot */
 							*bt++ = transverts[v_orig][0];
@@ -1972,20 +1977,20 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
 #if 0
 	/* needs #include <cstdio> */
 	printf("# vert count %d\n", m_vertexArray.size());
-	for(int i=0; i<m_vertexArray.size(); i+=3) {
+	for (int i=0; i<m_vertexArray.size(); i+=3) {
 		printf("v %.6f %.6f %.6f\n", m_vertexArray[i], m_vertexArray[i+1], m_vertexArray[i+2]);
 	}
 
 	printf("# face count %d\n", m_triFaceArray.size());
-	for(int i=0; i<m_triFaceArray.size(); i+=3) {
+	for (int i=0; i<m_triFaceArray.size(); i+=3) {
 		printf("f %d %d %d\n", m_triFaceArray[i]+1, m_triFaceArray[i+1]+1, m_triFaceArray[i+2]+1);
 	}
 #endif
 
 	/* force recreation of the m_unscaledShape.
 	 * If this has multiple users we cant delete */
-	if(m_unscaledShape) {
-		// dont free now so it can re-allocate under the same location and not break pointers.
+	if (m_unscaledShape) {
+		// don't free now so it can re-allocate under the same location and not break pointers.
 		// DeleteBulletShape(m_unscaledShape); 
 		m_forceReInstance= true;
 	}
@@ -2093,7 +2098,7 @@ btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin, b
 					collisionMeshData->m_weldingThreshold = m_weldingThreshold1;
 					bool removeDuplicateVertices=true;
 					// m_vertexArray not in multiple of 3 anymore, use m_triFaceArray
-					for(unsigned int i=0; i<m_triFaceArray.size(); i+=3) {
+					for (unsigned int i=0; i<m_triFaceArray.size(); i+=3) {
 						btScalar *bt = &m_vertexArray[3*m_triFaceArray[i]];
 						btVector3 v1(bt[0], bt[1], bt[2]);
 						bt = &m_vertexArray[3*m_triFaceArray[i+1]];
@@ -2118,7 +2123,7 @@ btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin, b
 				// this shape will be shared and not deleted until shapeInfo is deleted
 				
 				// for UpdateMesh, reuse the last memory location so instancing wont crash.
-				if(m_unscaledShape) {
+				if (m_unscaledShape) {
 					DeleteBulletShape(m_unscaledShape, false);
 					m_unscaledShape->~btBvhTriangleMeshShape();
 					m_unscaledShape = new(m_unscaledShape) btBvhTriangleMeshShape( indexVertexArrays, true, useBvh );
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.h b/source/gameengine/Physics/Bullet/CcdPhysicsController.h
index 82acd64..2228b65 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.h
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.h
@@ -18,8 +18,8 @@ subject to the following restrictions:
  */
 
 
-#ifndef BULLET2_PHYSICSCONTROLLER_H
-#define BULLET2_PHYSICSCONTROLLER_H
+#ifndef __CCDPHYSICSCONTROLLER_H__
+#define __CCDPHYSICSCONTROLLER_H__
 
 #include <vector>
 #include <map>
@@ -178,7 +178,7 @@ public:
 													// original mesh that correspond to shape triangles.
 													// only set for concave mesh shape.
 	
-	std::vector<int>		m_triFaceArray;	// Contains an array of triplets of face indicies
+	std::vector<int>		m_triFaceArray;	// Contains an array of triplets of face indices
 											// quads turn into 2 tris
 
 	std::vector<UVco>		m_triFaceUVcoArray;	// Contains an array of pair of UV coordinate for each vertex of faces
@@ -525,7 +525,7 @@ protected:
 			return m_cci.m_collisionFilterMask;
 		}
 
-		virtual void	calcXform() {} ;
+		virtual void calcXform() {}
 		virtual void SetMargin(float margin) 
 		{
 			if (m_collisionShape)
@@ -656,4 +656,4 @@ public:
 };
 
 
-#endif //BULLET2_PHYSICSCONTROLLER_H
+#endif //__CCDPHYSICSCONTROLLER_H__
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index 39b2022..ba0d3f1 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -122,7 +122,7 @@ public:
 		for (i=0;i<numWheels;i++)
 		{
 			btWheelInfo& info = m_vehicle->getWheelInfo(i);
-			PHY_IMotionState* motionState = (PHY_IMotionState*)info.m_clientInfo ;
+			PHY_IMotionState* motionState = (PHY_IMotionState*)info.m_clientInfo;
 	//		m_vehicle->updateWheelTransformsWS(info,false);
 			m_vehicle->updateWheelTransform(i,false);
 			btTransform trans = m_vehicle->getWheelInfo(i).m_worldTransform;
@@ -785,7 +785,7 @@ void	CcdPhysicsEnvironment::processFhSprings(double curTime,float interval)
 
 void		CcdPhysicsEnvironment::setDebugMode(int debugMode)
 {
-	if (m_debugDrawer){
+	if (m_debugDrawer) {
 		m_debugDrawer->setDebugMode(debugMode);
 	}
 }
@@ -873,7 +873,7 @@ void		CcdPhysicsEnvironment::setSolverType(int solverType)
 
 	};
 
-	m_solverType = solverType ;
+	m_solverType = solverType;
 }
 
 
@@ -1247,7 +1247,7 @@ struct OcclusionBuffer
 {
 	struct WriteOCL
 	{
-		static inline bool Process(btScalar& q,btScalar v) { if(q<v) q=v;return(false); }
+		static inline bool Process(btScalar& q,btScalar v) { if (q<v) q=v;return(false); }
 		static inline void Occlusion(bool& flag) { flag = true; }
 	};
 	struct QueryOCL
@@ -1377,7 +1377,7 @@ struct OcclusionBuffer
 	// convert polygon to device coordinates
 	static bool	project(btVector4* p,int n)
 	{
-		for(int i=0;i<n;++i)
+		for (int i=0;i<n;++i)
 		{			
 			p[i][2]=1/p[i][3];
 			p[i][0]*=p[i][2];
@@ -1394,21 +1394,21 @@ struct OcclusionBuffer
 		btVector4	pn[2*NP];
 		int			i, j, m, n, ni;
 		// deal with near clipping
-		for(i=0, m=0;i<NP;++i)
+		for (i=0, m=0;i<NP;++i)
 		{
 			s[i]=pi[i][2]+pi[i][3];
-			if(s[i]<0) m+=1<<i;
+			if (s[i]<0) m+=1<<i;
 		}
-		if(m==((1<<NP)-1)) 
+		if (m==((1<<NP)-1)) 
 			return(0);
-		if(m!=0)
+		if (m!=0)
 		{
-			for(i=NP-1,j=0,n=0;j<NP;i=j++)
+			for (i=NP-1,j=0,n=0;j<NP;i=j++)
 			{
 				const btVector4&	a=pi[i];
 				const btVector4&	b=pi[j];
 				const btScalar		t=s[i]/(a[3]+a[2]-b[3]-b[2]);
-				if((t>0)&&(t<1))
+				if ((t>0)&&(t<1))
 				{
 					pn[n][0]	=	a[0]+(b[0]-a[0])*t;
 					pn[n][1]	=	a[1]+(b[1]-a[1])*t;
@@ -1416,7 +1416,7 @@ struct OcclusionBuffer
 					pn[n][3]	=	a[3]+(b[3]-a[3])*t;
 					++n;
 				}
-				if(s[j]>0) pn[n++]=b;
+				if (s[j]>0) pn[n++]=b;
 			}
 			// ready to test far clipping, start from the modified polygon
 			pi = pn;
@@ -1427,21 +1427,21 @@ struct OcclusionBuffer
 			ni = NP;
 		}
 		// now deal with far clipping
-		for(i=0, m=0;i<ni;++i)
+		for (i=0, m=0;i<ni;++i)
 		{
 			s[i]=pi[i][2]-pi[i][3];
-			if(s[i]>0) m+=1<<i;
+			if (s[i]>0) m+=1<<i;
 		}
-		if(m==((1<<ni)-1)) 
+		if (m==((1<<ni)-1)) 
 			return(0);
-		if(m!=0)
+		if (m!=0)
 		{
-			for(i=ni-1,j=0,n=0;j<ni;i=j++)
+			for (i=ni-1,j=0,n=0;j<ni;i=j++)
 			{
 				const btVector4&	a=pi[i];
 				const btVector4&	b=pi[j];
 				const btScalar		t=s[i]/(a[2]-a[3]-b[2]+b[3]);
-				if((t>0)&&(t<1))
+				if ((t>0)&&(t<1))
 				{
 					po[n][0]	=	a[0]+(b[0]-a[0])*t;
 					po[n][1]	=	a[1]+(b[1]-a[1])*t;
@@ -1449,11 +1449,11 @@ struct OcclusionBuffer
 					po[n][3]	=	a[3]+(b[3]-a[3])*t;
 					++n;
 				}
-				if(s[j]<0) po[n++]=b;
+				if (s[j]<0) po[n++]=b;
 			}
 			return(n);
 		}
-		for(int i=0;i<ni;++i) po[i]=pi[i];
+		for (int i=0;i<ni;++i) po[i]=pi[i];
 		return(ni);
 	}
 	// write or check a triangle to buffer. a,b,c in device coordinates (-1,+1)
@@ -1465,7 +1465,7 @@ struct OcclusionBuffer
 						const btScalar minarea)
 	{
 		const btScalar		a2=btCross(b-a,c-a)[2];
-		if((face*a2)<0.f || btFabs(a2)<minarea)
+		if ((face*a2)<0.f || btFabs(a2)<minarea)
 			return false;
 		// further down we are normally going to write to the Zbuffer, mark it so
 		POLICY::Occlusion(m_occlusion);
@@ -1499,15 +1499,15 @@ struct OcclusionBuffer
 			// degenerated in at most one single pixel
 			btScalar* scan=&m_buffer[miy*m_sizes[0]+mix];
 			// use for loop to detect the case where width or height == 0
-			for(int iy=miy;iy<mxy;++iy)
+			for (int iy=miy;iy<mxy;++iy)
 			{
-				for(int ix=mix;ix<mxx;++ix)
+				for (int ix=mix;ix<mxx;++ix)
 				{
-					if(POLICY::Process(*scan,z[0])) 
+					if (POLICY::Process(*scan,z[0])) 
 						return(true);
-					if(POLICY::Process(*scan,z[1])) 
+					if (POLICY::Process(*scan,z[1])) 
 						return(true);
-					if(POLICY::Process(*scan,z[2])) 
+					if (POLICY::Process(*scan,z[2])) 
 						return(true);
 				}
 			}
@@ -1537,13 +1537,13 @@ struct OcclusionBuffer
 			dy[1] = y[0]-y[1];
 			dy[2] = y[2]-y[0];
 			btScalar* scan=&m_buffer[miy*m_sizes[0]+mix];
-			for(int iy=miy;iy<mxy;++iy)
+			for (int iy=miy;iy<mxy;++iy)
 			{
-				if(dy[0] >= 0 && POLICY::Process(*scan,v[0])) 
+				if (dy[0] >= 0 && POLICY::Process(*scan,v[0])) 
 					return(true);
-				if(dy[1] >= 0 && POLICY::Process(*scan,v[1])) 
+				if (dy[1] >= 0 && POLICY::Process(*scan,v[1])) 
 					return(true);
-				if(dy[2] >= 0 && POLICY::Process(*scan,v[2])) 
+				if (dy[2] >= 0 && POLICY::Process(*scan,v[2])) 
 					return(true);
 				scan+=m_sizes[0];
 				v[0] += dzy[0]; v[1] += dzy[1]; v[2] += dzy[2];
@@ -1574,13 +1574,13 @@ struct OcclusionBuffer
 			dx[1] = x[0]-x[1];
 			dx[2] = x[2]-x[0];
 			btScalar* scan=&m_buffer[miy*m_sizes[0]+mix];
-			for(int ix=mix;ix<mxx;++ix)
+			for (int ix=mix;ix<mxx;++ix)
 			{
-				if(dx[0] >= 0 && POLICY::Process(*scan,v[0])) 
+				if (dx[0] >= 0 && POLICY::Process(*scan,v[0])) 
 					return(true);
-				if(dx[1] >= 0 && POLICY::Process(*scan,v[1])) 
+				if (dx[1] >= 0 && POLICY::Process(*scan,v[1])) 
 					return(true);
-				if(dx[2] >= 0 && POLICY::Process(*scan,v[2])) 
+				if (dx[2] >= 0 && POLICY::Process(*scan,v[2])) 
 					return(true);
 				scan++;
 				v[0] += dzx[0]; v[1] += dzx[1]; v[2] += dzx[2];
@@ -1604,13 +1604,13 @@ struct OcclusionBuffer
 									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 iy=miy;iy<mxy;++iy)
 			{
-				for(int ix=mix;ix<mxx;++ix)
+				for (int ix=mix;ix<mxx;++ix)
 				{
-					if((c[0]>=0)&&(c[1]>=0)&&(c[2]>=0))
+					if ((c[0]>=0)&&(c[1]>=0)&&(c[2]>=0))
 					{
-						if(POLICY::Process(scan[ix],v)) 
+						if (POLICY::Process(scan[ix],v)) 
 							return(true);
 					}
 					c[0]+=dx[0];c[1]+=dx[1];c[2]+=dx[2];v+=dzx;
@@ -1633,7 +1633,7 @@ struct OcclusionBuffer
 		if (n)
 		{
 			project(o,n);
-			for(int i=2;i<n && !earlyexit;++i)
+			for (int i=2;i<n && !earlyexit;++i)
 			{
 				earlyexit|=draw<POLICY>(o[0],o[i-1],o[i],face,minarea);
 			}
@@ -1685,10 +1685,10 @@ struct OcclusionBuffer
 		transformW(btVector3(c[0]+e[0],c[1]-e[1],c[2]+e[2]),x[5]);
 		transformW(btVector3(c[0]+e[0],c[1]+e[1],c[2]+e[2]),x[6]);
 		transformW(btVector3(c[0]-e[0],c[1]+e[1],c[2]+e[2]),x[7]);
-		for(int i=0;i<8;++i)
+		for (int i=0;i<8;++i)
 		{
 			// 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);
+			if ((x[i][2]+x[i][3])<=0) return(true);
 		}
 		static const int	d[]={	1,0,3,2,
 									4,5,6,7,
@@ -1696,13 +1696,13 @@ struct OcclusionBuffer
 									6,5,1,2,
 									7,6,2,3,
 									5,4,0,1};
-		for(unsigned int i=0;i<(sizeof(d)/sizeof(d[0]));)
+		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++]]};
-			if(clipDraw<4,QueryOCL>(p,1.f,0.f)) 
+			if (clipDraw<4,QueryOCL>(p,1.f,0.f)) 
 				return(true);
 		}
 		return(false);
@@ -2008,7 +2008,7 @@ void	CcdPhysicsEnvironment::setConstraintParam(int constraintId,int param,float
 				{
 					//param = 3,4,5 are constraint limits, high limit values
 					btConeTwistConstraint* coneTwist = (btConeTwistConstraint*)typedConstraint;
-					if(value1<0.0f)
+					if (value1<0.0f)
 						coneTwist->setLimit(param,btScalar(BT_LARGE_FLOAT));
 					else
 						coneTwist->setLimit(param,value1);
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
index 1eed066..552cca8 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
@@ -18,8 +18,8 @@ subject to the following restrictions:
  *  See also \ref bulletdoc
  */
 
-#ifndef CCDPHYSICSENVIRONMENT
-#define CCDPHYSICSENVIRONMENT
+#ifndef __CCDPHYSICSENVIRONMENT_H__
+#define __CCDPHYSICSENVIRONMENT_H__
 
 #include "PHY_IPhysicsEnvironment.h"
 #include <vector>
@@ -106,19 +106,19 @@ protected:
 			m_numTimeSubSteps = numTimeSubSteps;
 		}
 		virtual void		setDeactivationTime(float dTime);
-		virtual	void		setDeactivationLinearTreshold(float linTresh) ;
-		virtual	void		setDeactivationAngularTreshold(float angTresh) ;
-		virtual void		setContactBreakingTreshold(float contactBreakingTreshold) ;
+		virtual	void		setDeactivationLinearTreshold(float linTresh);
+		virtual	void		setDeactivationAngularTreshold(float angTresh);
+		virtual void		setContactBreakingTreshold(float contactBreakingTreshold);
 		virtual void		setCcdMode(int ccdMode);
 		virtual void		setSolverType(int solverType);
 		virtual void		setSolverSorConstant(float sor);
 		virtual void		setSolverTau(float tau);
 		virtual void		setSolverDamping(float damping);
 		virtual void		setLinearAirDamping(float damping);
-		virtual void		setUseEpa(bool epa) ;
+		virtual void		setUseEpa(bool epa);
 
 		virtual	void		beginFrame();
-		virtual void		endFrame() {};
+		virtual void		endFrame() {}
 		/// Perform an integration step of duration 'timeStep'.
 		virtual	bool		proceedDeltaTime(double curTime,float timeStep,float interval);
 		
@@ -132,7 +132,7 @@ protected:
 		}
 		//returns 0.f if no fixed timestep is used
 
-		virtual	float		getFixedTimeStep(){ return 0.f;};
+		virtual	float		getFixedTimeStep() { return 0.f; }
 
 		virtual void		setDebugMode(int debugMode);
 
@@ -294,4 +294,4 @@ public:
 #endif
 };
 
-#endif //CCDPHYSICSENVIRONMENT
+#endif //__CCDPHYSICSENVIRONMENT_H__
diff --git a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h
index d0073d7..8e55c4a 100644
--- a/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h
+++ b/source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h
@@ -29,8 +29,8 @@
  *  \ingroup physdummy
  */
 
-#ifndef _DUMMYPHYSICSENVIRONMENT
-#define _DUMMYPHYSICSENVIRONMENT
+#ifndef __DUMMYPHYSICSENVIRONMENT_H__
+#define __DUMMYPHYSICSENVIRONMENT_H__
 
 #include "PHY_IPhysicsEnvironment.h"
 
@@ -104,5 +104,5 @@ public:
 #endif
 };
 
-#endif //_DUMMYPHYSICSENVIRONMENT
+#endif //__DUMMYPHYSICSENVIRONMENT_H__
 
diff --git a/source/gameengine/Physics/common/PHY_DynamicTypes.h b/source/gameengine/Physics/common/PHY_DynamicTypes.h
index a176113..a72929d 100644
--- a/source/gameengine/Physics/common/PHY_DynamicTypes.h
+++ b/source/gameengine/Physics/common/PHY_DynamicTypes.h
@@ -17,8 +17,8 @@ subject to the following restrictions:
  *  \ingroup phys
  */
 
-#ifndef __PHY_DYNAMIC_TYPES
-#define __PHY_DYNAMIC_TYPES
+#ifndef __PHY_DYNAMICTYPES_H__
+#define __PHY_DYNAMICTYPES_H__
 
 
 
@@ -151,4 +151,4 @@ typedef enum PHY_ShapeType {
 
 typedef float	PHY_Vector3[3];
 
-#endif //__PHY_DYNAMIC_TYPES
+#endif //__PHY_DYNAMICTYPES_H__
diff --git a/source/gameengine/Physics/common/PHY_IController.h b/source/gameengine/Physics/common/PHY_IController.h
index 672f2e5..d25af9f 100644
--- a/source/gameengine/Physics/common/PHY_IController.h
+++ b/source/gameengine/Physics/common/PHY_IController.h
@@ -29,8 +29,8 @@
  *  \ingroup phys
  */
 
-#ifndef PHY_ICONTROLLER_H
-#define PHY_ICONTROLLER_H
+#ifndef __PHY_ICONTROLLER_H__
+#define __PHY_ICONTROLLER_H__
 
 #include "PHY_DynamicTypes.h"
 
@@ -62,5 +62,5 @@ public:
 #endif
 };
 
-#endif //PHY_ICONTROLLER_H
+#endif //__PHY_ICONTROLLER_H__
 
diff --git a/source/gameengine/Physics/common/PHY_IGraphicController.h b/source/gameengine/Physics/common/PHY_IGraphicController.h
index 46f1701..6a94b3d 100644
--- a/source/gameengine/Physics/common/PHY_IGraphicController.h
+++ b/source/gameengine/Physics/common/PHY_IGraphicController.h
@@ -29,8 +29,8 @@
  *  \ingroup phys
  */
 
-#ifndef PHY_IGRAPHICCONTROLLER_H
-#define PHY_IGRAPHICCONTROLLER_H
+#ifndef __PHY_IGRAPHICCONTROLLER_H__
+#define __PHY_IGRAPHICCONTROLLER_H__
 
 #include "PHY_IController.h"
 
@@ -59,5 +59,5 @@ class PHY_IGraphicController : public PHY_IController
 #endif
 };
 
-#endif //PHY_IGRAPHICCONTROLLER_H
+#endif //__PHY_IGRAPHICCONTROLLER_H__
 
diff --git a/source/gameengine/Physics/common/PHY_IMotionState.h b/source/gameengine/Physics/common/PHY_IMotionState.h
index 1ffd3ad..77c51eb 100644
--- a/source/gameengine/Physics/common/PHY_IMotionState.h
+++ b/source/gameengine/Physics/common/PHY_IMotionState.h
@@ -29,8 +29,8 @@
  *  \ingroup phys
  */
 
-#ifndef PHY__MOTIONSTATE_H
-#define PHY__MOTIONSTATE_H
+#ifndef __PHY_IMOTIONSTATE_H__
+#define __PHY_IMOTIONSTATE_H__
 
 #ifdef WITH_CXX_GUARDEDALLOC
 #include "MEM_guardedalloc.h"
@@ -67,5 +67,5 @@ public:
 #endif
 };
 
-#endif //PHY__MOTIONSTATE_H
+#endif //__PHY_IMOTIONSTATE_H__
 
diff --git a/source/gameengine/Physics/common/PHY_IPhysicsController.h b/source/gameengine/Physics/common/PHY_IPhysicsController.h
index 31a7d71..727cbda 100644
--- a/source/gameengine/Physics/common/PHY_IPhysicsController.h
+++ b/source/gameengine/Physics/common/PHY_IPhysicsController.h
@@ -29,8 +29,8 @@
  *  \ingroup phys
  */
 
-#ifndef PHY_IPHYSICSCONTROLLER_H
-#define PHY_IPHYSICSCONTROLLER_H
+#ifndef __PHY_IPHYSICSCONTROLLER_H__
+#define __PHY_IPHYSICSCONTROLLER_H__
 
 #include "PHY_IController.h"
 
@@ -109,5 +109,5 @@ public:
 #endif
 };
 
-#endif //PHY_IPHYSICSCONTROLLER_H
+#endif //__PHY_IPHYSICSCONTROLLER_H__
 
diff --git a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
index adf6fb0..a2597f9 100644
--- a/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
+++ b/source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h
@@ -29,8 +29,8 @@
  *  \ingroup phys
  */
 
-#ifndef _IPHYSICSENVIRONMENT
-#define _IPHYSICSENVIRONMENT
+#ifndef __PHY_IPHYSICSENVIRONMENT_H__
+#define __PHY_IPHYSICSENVIRONMENT_H__
 
 #include <vector>
 #include "PHY_DynamicTypes.h"
@@ -129,7 +129,7 @@ class PHY_IPhysicsEnvironment
 		virtual void		setContactBreakingTreshold(float contactBreakingTreshold) {}
 		///continuous collision detection mode, very experimental for Bullet
 		virtual void		setCcdMode(int ccdMode) {}
-		///successive overrelaxation constant, in case PSOR is used, values in between 1 and 2 guarantee converging behaviour
+		///successive overrelaxation constant, in case PSOR is used, values in between 1 and 2 guarantee converging behavior
 		virtual void		setSolverSorConstant(float sor) {}
 		///setSolverType, internal setting, chooses solvertype, PSOR, Dantzig, impulse based, penalty based
 		virtual void		setSolverType(int solverType) {}
@@ -187,5 +187,5 @@ public:
 #endif
 };
 
-#endif //_IPHYSICSENVIRONMENT
+#endif //__PHY_IPHYSICSENVIRONMENT_H__
 
diff --git a/source/gameengine/Physics/common/PHY_IVehicle.h b/source/gameengine/Physics/common/PHY_IVehicle.h
index da9daa2..735ce5a 100644
--- a/source/gameengine/Physics/common/PHY_IVehicle.h
+++ b/source/gameengine/Physics/common/PHY_IVehicle.h
@@ -3,8 +3,8 @@
  *  \ingroup phys
  */
 
-#ifndef PHY_IVEHICLE_H
-#define PHY_IVEHICLE_H
+#ifndef __PHY_IVEHICLE_H__
+#define __PHY_IVEHICLE_H__
 
 //PHY_IVehicle provides a generic interface for (raycast based) vehicles. Mostly targetting 4 wheel cars and 2 wheel motorbikes.
 
@@ -68,4 +68,4 @@ public:
 #endif
 };
 
-#endif //PHY_IVEHICLE_H
+#endif //__PHY_IVEHICLE_H__
diff --git a/source/gameengine/Physics/common/PHY_Pro.h b/source/gameengine/Physics/common/PHY_Pro.h
index 4189db2..110d473 100644
--- a/source/gameengine/Physics/common/PHY_Pro.h
+++ b/source/gameengine/Physics/common/PHY_Pro.h
@@ -29,8 +29,8 @@
  *  \ingroup phys
  */
 
-#ifndef PHY_PROPSH
-#define PHY_PROPSH
+#ifndef __PHY_PRO_H__
+#define __PHY_PRO_H__
 
 #include <MT_Scalar.h>
 
@@ -59,5 +59,5 @@ struct PHY_MaterialProps {
 	bool      m_fh_normal;             // Should the object slide off slopes?
 };
 
-#endif //PHY_PROPSH
+#endif //__PHY_PRO_H__
 
diff --git a/source/gameengine/PyDoc/.cvsignore b/source/gameengine/PyDoc/.cvsignore
deleted file mode 100644
index b38362e..0000000
--- a/source/gameengine/PyDoc/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*.html
-*.pyc
diff --git a/source/gameengine/PyDoc/API_intro.py b/source/gameengine/PyDoc/API_intro.py
deleted file mode 100644
index 097abbf..0000000
--- a/source/gameengine/PyDoc/API_intro.py
+++ /dev/null
@@ -1,110 +0,0 @@
-# This is not a real module, it's simply an introductory text.
-
-"""
-The Blender Game Engine Python API Reference
-============================================
-
-	See U{release notes<http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.49/Game_Engine>} for updates, changes and new functionality in the Game Engine Python API.
-
-	Blender Game Engine Modules:
-	----------------------------
-	
-		Modules that include methods for accessing GameEngine data and functions.
-		
-			- L{GameLogic} utility functons for game logic.
-			- L{GameKeys} keyboard input and event conversion.
-			- L{Rasterizer} display and rendering.
-			- L{GameTypes} contains all the python types spesific to the GameEngine.
-	
-	Modules with documentation in progress:
-	---------------------
-		- L{VideoTexture}
-		- L{PhysicsConstraints}
-	
-	Additional Modules:
-	-------------------
-	
-		These modules have no GameEngine specific functionality but are useful in many cases.
-		
-			- L{mathutils}
-			- L{Geometry}
-			- L{BGL}
-
-
-Introduction:
-=============
-
-	This reference documents the Blender Python API, a growing collection of
-	Python modules (libraries) that give access to part of the program's internal
-	data and functions.
-	
-	Through scripting Blender can be extended in real-time via
-	U{Python <www.python.org>}, an impressive high level, multi-paradigm, open
-	source language.  Newcomers are recommended to start with the tutorial that
-	comes with it.
-
-	This opens many interesting possibilities not available with logic bricks.
-
-	Game Engine API Stability:
-	--------------------------
-
-	When writing python scripts there are a number of situations you should avoid to prevent crashes or unstable behavior.
-	While the API tries to prevent problems there are some situations where error checking would be too time consuming.
-	
-	Known cases:
-		- Memory Limits.
-
-				There is nothing stopping you from filling a list or making a string so big that that causes blender to run out of memory, in this case python should rasie a MemoryError, but its likely blender will crash before this point.
-				
-		- Accessing any data that has been freed.
-
-				For instance accessing a KX_GameObject after its End Object actuator runs.
-				This will cause a SystemError, however for L{KX_MeshProxy}, L{KX_VertexProxy} and L{KX_VertexProxy} it will crash the blender game engine.
-				
-				See: L{GameTypes.PyObjectPlus.invalid} which many types inherit.
-
-		- Mixing L{KX_GameObject} between scenes.
-
-				For instance tracking/parenting an L{KX_GameObject} object to an object from other scene.
-
-	External Modules:
-	-----------------
-	
-	Since 2.49 support for importing modules has been added.
-
-	This allows you to import any blender textblock with a .py extension.
-	
-	External python scripts may be imported as modules when the script is in the same directory as the blend file.
-	
-	The current blend files path is included in the sys.path for loading modules.
-	All linked libraries will also be included so you can be sure when linking in assets from another blend file the scripts will load too.
-	
-	A note to newbie script writers:
-	--------------------------------
-
-	Interpreted languages are known to be much slower than compiled code, but for
-	many applications the difference is negligible or acceptable.  Also, with
-	profiling (or even simple direct timing with L{Blender.sys.time<Sys.time>}) to
-	identify slow areas and well thought optimizations, the speed can be
-	I{considerably} improved in many cases.  Try some of the best BPython scripts
-	to get an idea of what can be done, you may be surprised.
-
- at author: The Blender Python Team
- at requires: Blender 2.49 or newer.
- at version: 2.49
- at see: U{www.blender.org<http://www.blender.org>}: documentation and forum
- at see: U{blenderartists.org<http://blenderartists.org>}: user forum
- at see: U{projects.blender.org<http://projects.blender.org>}
- at see: U{www.python.org<http://www.python.org>}
- at see: U{www.python.org/doc<http://www.python.org/doc>}
- at see: U{Blending into Python<en.wikibooks.org/wiki/Blender_3D:_Blending_Into_Python>}: User contributed documentation, featuring a blender/python cookbook with many examples.
-
- at note: the official version of this reference guide is only updated for each
-	new Blender release.  But you can build the current SVN
-	version yourself: install epydoc, grab all files in the
-	source/gameengine/PyDoc/ folder of Blender's SVN and use the
-	epy_docgen.sh script also found there to generate the html docs.
-	Naturally you will also need a recent Blender binary to try the new
-	features.  If you prefer not to compile it yourself, there is a testing
-	builds forum at U{blender.org<http://www.blender.org>}.
-"""
diff --git a/source/gameengine/PyDoc/PhysicsConstraints.py b/source/gameengine/PyDoc/PhysicsConstraints.py
deleted file mode 100644
index bec8973..0000000
--- a/source/gameengine/PyDoc/PhysicsConstraints.py
+++ /dev/null
@@ -1,293 +0,0 @@
-"""
-Documentation for the PhysicsConstraints module.
-================================================
-
-Example::
-	
-	
-	#  Adding a point constraint  #
-	###############################
-	
-	
-	# import BGE internal module
-	import PhysicsConstraints
-	
-	# get object list
-	obj_list = GameLogic.getCurrentScene().objects
-	
-	# get object named Obj_1
-	root = obj_list["root"]
-	obj = obj_list["obj"]
-
-	# get object physics ID
-	phido = obj.getPhysicsId()
-	
-	# get root physics ID
-	phidr = root.getPhysicsId()
-
-	# want to use point constraint type
-	constraint_type = 1
-	
-	# Use bottom right front corner of object for point constraint position
-	point_pos_x = 1.0
-	point_pos_y = -1.0
-	point_pos_z = -1.0
-	
-	# create a point constraint
-	const =	PhysicsConstraints.createConstraint( phido, phidr, constraint_type, point_pos_x, point_pos_y, point_pos_z)
-
-	# stores the new constraint ID to be used later
-	obj["constraint_ID"] = const.getConstraintId()	
-	
-	
-Example::
-	
-	
-	#  Removing a point constraint  #
-	#################################
-	
-	
-	# import BGE internal module
-	import PhysicsConstraints
-	
-	# get object list
-	obj_list = GameLogic.getCurrentScene().objects
-	
-	# get object 1
-	obj = obj_list["obj"]
-	
-	# get constraint ID that was saved as an obj property
-	# when the constraint was created
-	constraint_ID = obj["constraint_ID"]
-	
-	# remove constraint
-	PhysicsConstraints.removeConstraint(constraint_ID)
-
-"""
-
-def createConstraint(obj_PhysicsID, root_PhysicsID, constraintType, pointPos_x, pointPos_y, pointPos_z, edgePos_x, edgePos_y, edgePos_z, edgeAngle_x, edgeAngle_y, edgeAngle_z):
-	"""	
-	Create a point constraint between two objects, an edge constraint between two objects, or a vehicle constraint on an object.
-	
-	You only have to input the needed parammeters depending on the type of constraint you are trying to create.
-	
-
-	B{Point Constraint} ::
-	
-		While creating a point constraint, the "pointPos" values define where you want the pivot point to be located.
-		If you are creating a point constraint be sure to assing the integer "1" as the constraintType value.
-	
-		Parameters to use:
-		obj_PhysicsID, root_PhysicsID, constraintType, pointPos_x, pointPos_y, pointPos_z
-	
-	B{Edge Constraint} ::
-		
-		While creating an edge constraint, the "edgePos" values define where you want the center of the edge constraint to be.
-		Also, the "edgeAngle" values define in which direction you want the edge constraint to point (As a 3 dimensions vector).
-		If you want to create an edge constraint be sure to assing the integer "2" as the constraintType value.
-
-		Parameters to use:
-		obj_PhysicsID, root_PhysicsID, constraintType, edgePos_x, edgePos_y, edgePos_z, edgeAngle_x, edgeAngle_y, edgeAngle_z}		
-	
-	B{Vehicle Constraint} ::
-		
-		While creating a point constraint, the "pointPos" values define where you want the pivot point to be located.
-		If you want to create an edge constraint be sure to assing the integer "0" as the constraintType value.
-
-		Parameters to use :
-		obj_PhysicsID, root_PhysicsID, constraintType
-	
-	@type obj_PhysicsID: integer
-	@param obj_PhysicsID: The physic ID of the first object to constraint.
-
-	@type root_PhysicsID: integer
-	@param root_PhysicsID: The physic ID of the second object to constraint.
-
-	@type constraintType: integer
-	@param constraintType: The type of constraint.
-
-	@type pointPos_x: float
-	@param pointPos_x: The X position of the point constraint.
-
-	@type pointPos_y: float
-	@param pointPos_y: The Y position of the point constraint.
-
-	@type pointPos_z: float
-	@param pointPos_z: The Z position of the point constraint.
-
-	@type edgePos_x: float
-	@param edgePos_x: The X value of the center of the edge constraint.
-
-	@type edgePos_y: float
-	@param edgePos_y: The Y value of the center of the edge constraint.
-
-	@type edgePos_z: float
-	@param edgePos_z: The Z value of the center of the edge constraint.
-
-	@type edgeAngle_x: float
-	@param edgeAngle_x: The X value of the edge's orientation vector.
-
-	@type edgeAngle_y: float
-	@param edgeAngle_y: The Y value of the edge's orientation vector.
-
-	@type edgeAngle_z: float
-	@param edgeAngle_z: The Z value of the edge's orientation vector.
-
-	@rtype: integer
-	@return: The created constraint ID
-	"""
-	
-
-def getAppliedImpulse(constraint_ID):
-	"""
-	Returns the applied impulse.
-	
-	@param constraint_ID: The constraint ID that was saved on the creation of the constraint.
-	@type constraint_ID: integer
-	@rtype: float
-	@return: Measure the stress on a constraint.
-	"""
-
-
-def getVehicleConstraint(constraint_ID):
-	"""
-	Returns the vehicle constraint ID.
-	
-	@param constraint_ID: The constraint ID that was saved on the creation of the constraint.
-	@type constraint_ID: integer
-	@rtype: integer
-	"""
-def removeConstraint(constraint_ID):
-	"""
-	
-	Removes the constraint between 2 game objects (point and edge constraints).
-	
-	It does not remove vehicle constraints.
-	
-	@param constraint_ID: The constraint ID that was saved on the creation of the constraint.
-	@type constraint_ID: integer
-	"""
-def setDeactivationLinearTreshold(linearTreshold):
-	"""
-	
-	Sets the linear velocity that an object must be below before the deactivation timer can start.
-	
-	This affects every object in the scene, except for game objects that have 'No sleeping' turned on.
-	
-	@param linearTreshold: The linear velocity.
-	@type linearTreshold: float
-	"""
-def setDeactivationAngularTreshold(angularTreshold):
-	"""
-	
-	Sets the angular velocity that an object must be below before the deactivation timer can start.
-	
-	This affects every object in the scene, except for game objects that have 'No sleeping' turned on.
-	
-	@param angularTreshold: The angular velocity.
-	@type angularTreshold: float
-	"""
-def setDeactivationTime(time):
-	"""
-	
-	Time (in seconds) after objects with velocity less then thresholds (see below) are deactivated.
-	
-	This affects every object in the scene, except for game objects that have 'No sleeping' turned on.
-	
-	This function is directly related with the 2 above functions.
-	
-	
-	@param time: The time in seconds.
-	@type time: float
-	"""
-def setGravity(gx, gy, gz):
-	"""
-	Sets the gravity for the actual scene only.
-	
-	All other scenes remain unaffected.
-	
-	This affects every object in the scene that has physics enabled.
-	
-	@param gx: The force of gravity on world x axis.
-	@type gx: float
-	@param gy: The force of gravity on world y axis.
-	@type gy: float
-	@param gz: The force of gravity on world z axis.
-	@type gz: float
-	"""
-def setLinearAirDamping(damping):
-	"""
-	
-	Sets the linear air resistance for all objects in the scene.
-	
-	@param damping: The linear air resistance.
-	@type damping: float
-	"""
-def setNumIterations(numIter):
-	"""
-	Sets the number of times an iterative constraint solver is repeated.
-	
-	Increasing the number of iterations improves the constraint solver at the cost of performances & the speed of the game engine.
-	
-	@param numIter: The number of timesubsteps. (Input 0 to suspend simulation numSubStep)
-	@type numIter: integer
-	"""
-def setNumTimeSubSteps(numSubStep):
-	"""
-	Set the quality of the entire physics simulation including collision detection and constraint solver.
-	
-	Increase the number of time substeps to improves the quality of the entire physics simulation at the cost of the performance & the speed of the game engine.
-	
-	@param numSubStep: The number of timesubsteps. (Input 0 to suspend simulation numSubStep)
-	@type numSubStep: integer
-	"""
-#def setDebugMode():
-#	"""
-#	
-#	
-#	
-#	@param numIter: 
-#	@type numIter: 
-#	"""
-#def setCcdMode():
-#	"""
-#	Does something
-#	
-#	@rtype: 
-#	"""
-#def setContactBreakingTreshold():
-#	"""
-#	Does something
-#	
-#	@rtype: 
-#	"""
-#def setSolverDamping():
-#	"""
-#	Does something
-#	
-#	@rtype: 
-#	"""
-#def setSolverTau():
-#	"""
-#	Does something
-#	
-#	@rtype: 
-#	"""
-#def setSolverType():
-#	"""
-#	Does something
-#	
-#	@rtype: 
-#	"""
-#def setSorConstant():
-#	"""
-#	Does something
-#	
-#	@rtype: 
-#	"""
-#def setUseEpa():
-#	"""
-#	Does something
-#	
-#	@rtype: 
-#	"""
diff --git a/source/gameengine/PyDoc/VideoTexture.py b/source/gameengine/PyDoc/VideoTexture.py
deleted file mode 100644
index 9d2148d..0000000
--- a/source/gameengine/PyDoc/VideoTexture.py
+++ /dev/null
@@ -1,217 +0,0 @@
-"""
-The VideoTexture module allows you to manipulate textures during the game.
-
-Several sources for texture are possible: video files, image files, 
-video capture, memory buffer, camera render or a mix of that.
-
-The video and image files can be loaded from the internet using an URL 
-instead of a file name.
-
-In addition, you can apply filters on the images before sending them to the GPU, allowing video effect: blue screen, 
-color band, gray, normal map.
-
-VideoTexture uses FFmpeg to load images and videos. All the formats and codecs
-that FFmpeg supports are supported by VideoTexture, including but not limited to::
-
-	* AVI
-	* Ogg
-	* Xvid
-	* Theora
-	* dv1394 camera
-	* video4linux capture card (this includes many webcams)
-	* videoForWindows capture card (this includes many webcams)
-	* JPG 
-
-The principle is simple: first you identify a texture on an existing object using 
-the L{materialID} function, then you create a new texture with dynamic content
-and swap the two textures in the GPU.
-
-The GE is not aware of the substitution and continues to display the object as always, 
-except that you are now in control of the texture.
-
-When the texture object is deleted, the new texture is deleted and the old texture restored. 
-
-Example::
-	import VideoTexture
-	import GameLogic
-
-	contr = GameLogic.getCurrentController()
-	obj = contr.owner
-	
-	# the creation of the texture must be done once: save the 
-	# texture object in an attribute of GameLogic module makes it persistent
-	if not hasattr(GameLogic, 'video'):
-	
-		# identify a static texture by name
-		matID = VideoTexture.materialID(obj, 'IMvideo.png')
-		
-		# create a dynamic texture that will replace the static texture
-		GameLogic.video = VideoTexture.Texture(obj, matID)
-		
-		# define a source of image for the texture, here a movie
-		movie = GameLogic.expandPath('//trailer_400p.ogg')
-		GameLogic.video.source = VideoTexture.VideoFFmpeg(movie)
-		GameLogic.video.source.scale = True
-		
-		# quick off the movie, but it wont play in the background
-		GameLogic.video.source.play()	
-		
-		# you need to call this function every frame to ensure update of the texture.
-		GameLogic.video.refresh(True)
-	
-
-"""
-def getLastError():
-	"""
-	Returns the description of the last error that occurred in a VideoTexture function.
-	
-	@rtype: string
-	"""
-def imageToArray(image,mode):
-	"""
-	Returns a BGL.buffer corresponding to the current image stored in a texture source object
-
-	@param image: Image source object.
-	@type image: object of type L{VideoFFmpeg}, L{ImageFFmpeg}, L{ImageBuff}, L{ImageMix}, L{ImageRender}, L{ImageMirror} or L{ImageViewport}
-	@param mode: optional argument representing the pixel format. 
-	             You can use the characters R, G, B for the 3 color channels, A for the alpha channel, 
-	             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.
-	             The default mode is "RGBA".
-	@type mode: string
-	@rtype: BGL.buffer
-	@returns: 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.
-	"""
-
-def materialID(object,name):
-	"""
-	Returns a numeric value that can be used in L{Texture} to create a dynamic texture.
-
-	The value corresponds to an internal material number that uses the texture identified
-	by name. name is a string representing a texture name with IM prefix if you want to
-	identify the texture directly. 	This method works for basic tex face and for material,
-	provided the material has a texture channel using that particular texture in first
-	position of the texture stack. 	name can also have MA prefix if you want to identify
-	the texture by material. In that case the material must have a texture channel in first
-	position.
-	
-	If the object has no material that matches name, it generates a runtime error. Use try/except to catch the exception.
-	
-	Ex: VideoTexture.materialID(obj, 'IMvideo.png')
-	
-	@param object: the game object that uses the texture you want to make dynamic
-	@type object: game object
-	@param name: name of the texture/material you want to make dynamic. 
-	@type name: string
-	@rtype: integer
-	"""
-def setLogFile(filename):
-	"""
-	Sets the name of a text file in which runtime error messages will be written, in addition to the printing
-	of the messages on the Python console. Only the runtime errors specific to the VideoTexture module
-	are written in that file, ordinary runtime time errors are not written. 
-
-	@param filename: name of error log file
-	@type filename: string
-	@rtype: integer
-	"""
-def FilterBGR24():
-	"""
-	Returns a new input filter object to be used with L{ImageBuff} object when the image passed 
-	to the ImageBuff.load() function has the 3-bytes pixel format BGR. 
-	
-	@rtype: object of type FilterBGR24
-	"""
-def FilterBlueScreen():
-	"""
-	Does something
-	
-	@rtype: 
-	"""
-def FilterColor():
-	"""
-	Does something
-	
-	@rtype: 
-	"""
-def FilterGray():
-	"""
-	Does something
-	
-	@rtype: 
-	"""
-def FilterLevel():
-	"""
-	Does something
-	
-	@rtype: 
-	"""
-def FilterNormal():
-	"""
-	Does something
-	
-	@rtype: 
-	"""
-def FilterRGB24():
-	"""
-	Returns a new input filter object to be used with L{ImageBuff} object when the image passed 
-	to the ImageBuff.load() function has the 3-bytes pixel format RBG.
-	
-	@rtype: object of type FilterRGB24
-	"""
-def FilterRGBA32():
-	"""
-	Returns a new input filter object to be used with L{ImageBuff} object when the image passed 
-	to the ImageBuff.load() function has the 4-bytes pixel format RGBA.
-	
-	@rtype: object of type FilterRGBA32
-	"""
-def ImageBuff():
-	"""
-	Does something
-	
-	@rtype: 
-	"""
-def ImageFFmpeg():
-	"""
-	Does something
-	
-	@rtype: 
-	"""
-def ImageMirror():
-	"""
-	Does something
-	
-	@rtype: 
-	"""
-def ImageMix():
-	"""
-	Does something
-	
-	@rtype: 
-	"""
-def ImageRender():
-	"""
-	Does something
-	
-	@rtype: 
-	"""
-def ImageViewport():
-	"""
-	Does something
-	
-	@rtype: 
-	"""
-def Texture():
-	"""
-	Does something
-	
-	@rtype: L{Texture}
-	"""
-def VideoFFmpeg():
-	"""
-	Does something
-	
-	@rtype: 
-	"""
diff --git a/source/gameengine/PyDoc/bge_api_validate_py.txt b/source/gameengine/PyDoc/bge_api_validate_py.txt
deleted file mode 100644
index ebd74c0..0000000
--- a/source/gameengine/PyDoc/bge_api_validate_py.txt
+++ /dev/null
@@ -1,136 +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; version 2 of the License.
-
-#~ This program is distributed in the hope that it will be useful,
-#~ but WITHOUT 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 script must run from a logic brick so it has access to the game engine api
-# it assumes the root blender source directory is the current working directory
-# 
-# Currently it only prints missing modules and methods (not attributes)
-
-import sys, os
-
-BGE_API_DOC_PATH = 'source/gameengine/PyDoc'
-
-
-mods = ['GameLogic', 'Rasterizer', 'GameKeys']
-mods_dict = {}
-for m in mods:
-	mods_dict[m] = sys.modules[m]
-
-
-import GameTypes
-type_members = {}
-
-for type_name in dir(GameTypes):
-	if type_name.startswith('__'):
-		continue
-	
-	type_object = getattr(GameTypes, type_name)
-	
-	members = []
-	type_members[type_object.__name__] = members
-	
-	for member in type_object.__dict__.keys():
-		if member.startswith('__'):
-			continue
-		
-		# print type_object.__name__ + '.' + k
-		members.append(member)
-
-
-
-doc_dir= os.path.join(os.getcwd(), BGE_API_DOC_PATH)
-
-if doc_dir not in sys.path:
-	sys.path.append(doc_dir)
-
-
-def check_attribute(class_ob, member):
-	doc = class_ob.__doc__
-	if not doc:
-		return False
-	
-	for l in doc.split('\n'):
-		l = l.strip()
-		
-		'''
-			@ivar foo: blah blah
-		to
-			foo
-			
-		'''
-		
-		if l.startswith('@ivar') or l.startswith('@var'):
-			var = l.split()[1].split(':')[0]
-			
-			if var == member:
-				return True
-	
-	return False
-	
-	
-	
-	
-
-
-print '\n\n\nChecking Docs'
-
-PRINT_OK = False
-
-pymod = sys.modules['GameTypes']
-del sys.modules['GameTypes'] # temp remove
-mod = __import__('GameTypes') # get the python module
-reload(mod) # incase were editing it
-sys.modules['GameTypes'] = pymod
-
-for type_name in sorted(type_members.keys()):
-	members = type_members[type_name]
-	
-	try:
-		type_class = getattr(mod, type_name)
-	except:
-		print "missing class: %s.%s - %s" % (type_name, type_name, str(sorted(members)))
-		continue
-	
-	for member in sorted(members):
-		try:
-			getattr(type_class, member)
-			if PRINT_OK:
-				print "\tfound: %s.%s" % (type_name, member)
-		except:
-			if check_attribute(type_class, member):
-				if PRINT_OK:
-					print "\tfound attr: %s.%s" % (type_name, member)
-			else:
-				print "\tmissing: %s.%s" % (type_name, member)
-
-
-# Now check the modules
-for mod_name, pymod in mods_dict.iteritems():
-	print pymod
-	del sys.modules[mod_name]
-		
-	# Now well get the python version
-	pydoc = __import__(mod_name)
-	pydoc = reload(pydoc) # avoid using the out dated pyc file only
-	print pydoc.__file__
-	
-	for member in sorted(dir(pymod)):
-		if hasattr(pydoc, member) or check_attribute(pydoc, member):
-			if PRINT_OK:
-				print "\tfound module attr: %s.%s" % (mod_name, member)
-		else:
-			print "\tmissing module attr: %s.%s" % (mod_name, member)
-	
-	# Restore real module
-	sys.modules[mod_name] = pymod
-
-
-sys.path.pop() # remove the pydoc dir from our import paths
-
-
diff --git a/source/gameengine/PyDoc/epy_docgen.sh b/source/gameengine/PyDoc/epy_docgen.sh
deleted file mode 100755
index dd30256..0000000
--- a/source/gameengine/PyDoc/epy_docgen.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-# epy_docgen.sh
-# generates blender python doc using epydoc
-# requires epydoc in your PATH.
-# run from the doc directory containing the .py files
-# usage:  sh epy_docgen.sh
-
-# set posix locale so regex works properly for [A-Z]*.py
-LC_ALL=POSIX
-
-epydoc --debug -v  -o BPY_GE --url "http://www.blender.org" --top API_intro \
- --name "Blender GameEngine" --no-private --no-sourcecode --inheritance=included \
- *.py \
- ../../../source/blender/python/api2_2x/doc/BGL.py \
- ../../../source/blender/python/api2_2x/doc/Mathutils.py \
- ../../../source/blender/python/api2_2x/doc/Geometry.py
- 
diff --git a/source/gameengine/PyDoc/how_to_build_win.txt b/source/gameengine/PyDoc/how_to_build_win.txt
deleted file mode 100644
index 5610ced..0000000
--- a/source/gameengine/PyDoc/how_to_build_win.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-How To Build the BGE Documentation in Windows
--------------------------------------------------------------------------
-1) download and install Python 2.6 - http://www.python.org
-2) download and install Epydocs - http://epydoc.sourceforge.net
-
-* for the following lines we will assume that your installation of Python is in C:\Python26 and epydocs is installed in the default folder Scripts\epydoc.
-
-3) creates a epy_docgen.bat file in this folder (source\gameengine\PyDoc\) and paste the following line into it:
-
-::::::
-C:\Python26\python.exe C:\Python26\Scripts\epydoc.py --debug -v  -o BPY_GE --url "http://www.blender.org" --top API_intro  --name "Blender GameEngine" --no-private --no-sourcecode --inheritance=included  *.py  ../../../source/blender/python/api2_2x/doc/BGL.py  ../../../source/blender/python/api2_2x/doc/Mathutils.py  ../../../source/blender/python/api2_2x/doc/Geometry.py
-::::::
-
-4) run your created batch file. If everything goes well it creates a folder named BPY_GE with all the generated documentation.
-
-Documentation valid in March of 2010 - Blender 2.5alpha2
diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
index 30344ce..95a2dc5 100644
--- a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
@@ -58,12 +58,12 @@ numberoffilters(0), need_tex_update(true)
 	isshadersupported = GLEW_ARB_shader_objects &&
 		GLEW_ARB_fragment_shader && GLEW_ARB_multitexture;
 
-	/* used to return before 2.49 but need to initialize values so dont */
-	if(!isshadersupported)
+	/* used to return before 2.49 but need to initialize values so don't */
+	if (!isshadersupported)
 		std::cout<<"shaders not supported!" << std::endl;
 
 	int passindex;
-	for(passindex =0; passindex<MAX_RENDER_PASS; passindex++)
+	for (passindex =0; passindex<MAX_RENDER_PASS; passindex++)
 	{
 		m_filters[passindex] = 0;
 		m_enabled[passindex] = 0;
@@ -86,7 +86,7 @@ void RAS_2DFilterManager::PrintShaderErrors(unsigned int shader, const char *tas
 	const char *c, *pos, *end;
 	int line = 1;
 
-	if(errorprinted)
+	if (errorprinted)
 		return;
 	
 	errorprinted= true;
@@ -103,9 +103,10 @@ void RAS_2DFilterManager::PrintShaderErrors(unsigned int shader, const char *tas
 		c = pos+1;
 		line++;
 	}
-	printf("%s", c);
 
-	printf("%s\n", log);
+	puts(c);
+	puts(log);
+	puts("\n");
 }
 
 unsigned int RAS_2DFilterManager::CreateShaderProgram(const char* shadersource)
@@ -120,7 +121,7 @@ unsigned int RAS_2DFilterManager::CreateShaderProgram(const char* shadersource)
 
 
 	glGetObjectParameterivARB(fShader, GL_COMPILE_STATUS, &success);
-	if(!success)
+	if (!success)
 	{
 		/*Shader Comile Error*/
 		PrintShaderErrors(fShader, "compile", shadersource);
@@ -182,22 +183,22 @@ unsigned int RAS_2DFilterManager::CreateShaderProgram(int filtermode)
 void RAS_2DFilterManager::AnalyseShader(int passindex, vector<STR_String>& propNames)
 {
 	texflag[passindex] = 0;
-	if(glGetUniformLocationARB(m_filters[passindex], "bgl_DepthTexture") != -1)
+	if (glGetUniformLocationARB(m_filters[passindex], "bgl_DepthTexture") != -1)
 	{
-		if(GLEW_ARB_depth_texture)
+		if (GLEW_ARB_depth_texture)
 			texflag[passindex] |= 0x1;
 	}
-	if(glGetUniformLocationARB(m_filters[passindex], "bgl_LuminanceTexture") != -1)
+	if (glGetUniformLocationARB(m_filters[passindex], "bgl_LuminanceTexture") != -1)
 	{
 		texflag[passindex] |= 0x2;
 	}
 
-	if(m_gameObjects[passindex])
+	if (m_gameObjects[passindex])
 	{
 		int objProperties = propNames.size();
 		int i;
-		for(i=0; i<objProperties; i++)
-			if(glGetUniformLocationARB(m_filters[passindex], propNames[i]) != -1)
+		for (i=0; i<objProperties; i++)
+			if (glGetUniformLocationARB(m_filters[passindex], propNames[i]) != -1)
 				m_properties[passindex].push_back(propNames[i]);
 	}
 }
@@ -216,7 +217,7 @@ void RAS_2DFilterManager::StartShaderProgram(int passindex)
 	}
 
 	/* send depth texture to glsl program if it needs */
-	if(texflag[passindex] & 0x1){
+	if (texflag[passindex] & 0x1) {
 		uniformLoc = glGetUniformLocationARB(m_filters[passindex], "bgl_DepthTexture");
 		glActiveTextureARB(GL_TEXTURE1);
 		glBindTexture(GL_TEXTURE_2D, texname[1]);
@@ -228,7 +229,7 @@ void RAS_2DFilterManager::StartShaderProgram(int passindex)
 	}
 
 	/* send luminance texture to glsl program if it needs */
-	if(texflag[passindex] & 0x2){
+	if (texflag[passindex] & 0x2) {
 		uniformLoc = glGetUniformLocationARB(m_filters[passindex], "bgl_LuminanceTexture");
 		glActiveTextureARB(GL_TEXTURE2);
 		glBindTexture(GL_TEXTURE_2D, texname[2]);
@@ -256,10 +257,10 @@ void RAS_2DFilterManager::StartShaderProgram(int passindex)
 	}
 
 	int i, objProperties = m_properties[passindex].size();
-	for(i=0; i<objProperties; i++)
+	for (i=0; i<objProperties; i++)
 	{
 		uniformLoc = glGetUniformLocationARB(m_filters[passindex], m_properties[passindex][i]);
-		if(uniformLoc != -1)
+		if (uniformLoc != -1)
 		{
 			float value = ((CValue*)m_gameObjects[passindex])->GetPropertyNumber(m_properties[passindex][i], 0.0);
 			glUniform1fARB(uniformLoc,value);
@@ -274,11 +275,11 @@ void RAS_2DFilterManager::EndShaderProgram()
 
 void RAS_2DFilterManager::FreeTextures()
 {
-	if(texname[0]!=(unsigned int)-1)
+	if (texname[0]!=(unsigned int)-1)
 		glDeleteTextures(1, (GLuint*)&texname[0]);
-	if(texname[1]!=(unsigned int)-1)
+	if (texname[1]!=(unsigned int)-1)
 		glDeleteTextures(1, (GLuint*)&texname[1]);
-	if(texname[2]!=(unsigned int)-1)
+	if (texname[2]!=(unsigned int)-1)
 		glDeleteTextures(1, (GLuint*)&texname[2]);
 }
 
@@ -295,7 +296,7 @@ void RAS_2DFilterManager::SetupTextures(bool depth, bool luminance)
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
 
-	if(depth){
+	if (depth) {
 		glGenTextures(1, (GLuint*)&texname[1]);
 		glBindTexture(GL_TEXTURE_2D, texname[1]);
 		glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32, texturewidth,textureheight,
@@ -308,7 +309,7 @@ void RAS_2DFilterManager::SetupTextures(bool depth, bool luminance)
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
 	}
 
-	if(luminance){
+	if (luminance) {
 		glGenTextures(1, (GLuint*)&texname[2]);
 		glBindTexture(GL_TEXTURE_2D, texname[2]);
 		glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE16, texturewidth, textureheight,
@@ -356,11 +357,11 @@ void RAS_2DFilterManager::UpdateOffsetMatrix(RAS_ICanvas* canvas)
 void RAS_2DFilterManager::UpdateCanvasTextureCoord(unsigned int * viewport)
 {
 	/*
-	This function update canvascoord[].
-	These parameters are used to create texcoord[1]
-	That way we can access the texcoord relative to the canvas:
-	(0.0,0.0) bottom left, (1.0,1.0) top right, (0.5,0.5) center
-	*/
+	 * This function update canvascoord[].
+	 * These parameters are used to create texcoord[1]
+	 * That way we can access the texcoord relative to the canvas:
+	 * (0.0,0.0) bottom left, (1.0,1.0) top right, (0.5,0.5) center
+	 */
 	canvascoord[0] = (GLfloat) viewport[0] / viewport[2];
 	canvascoord[0] *= -1;
 	canvascoord[1] = (GLfloat) (texturewidth - viewport[0]) / viewport[2];
@@ -378,48 +379,48 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
 
 	int passindex;
 
-	if(!isshadersupported)
+	if (!isshadersupported)
 		return;
 
-	for(passindex =0; passindex<MAX_RENDER_PASS; passindex++)
+	for (passindex =0; passindex<MAX_RENDER_PASS; passindex++)
 	{
-		if(m_filters[passindex] && m_enabled[passindex]){
+		if (m_filters[passindex] && m_enabled[passindex]) {
 			num_filters ++;
-			if(texflag[passindex] & 0x1)
+			if (texflag[passindex] & 0x1)
 				need_depth = true;
-			if(texflag[passindex] & 0x2)
+			if (texflag[passindex] & 0x2)
 				need_luminance = true;
-			if(need_depth && need_luminance)
+			if (need_depth && need_luminance)
 				break;
 		}
 	}
 
-	if(num_filters <= 0)
+	if (num_filters <= 0)
 		return;
 
 	GLuint	viewport[4]={0};
 	glGetIntegerv(GL_VIEWPORT,(GLint *)viewport);
 
-	if(canvaswidth != canvas->GetWidth() || canvasheight != canvas->GetHeight())
+	if (canvaswidth != canvas->GetWidth() || canvasheight != canvas->GetHeight())
 	{
 		UpdateOffsetMatrix(canvas);
 		UpdateCanvasTextureCoord((unsigned int*)viewport);
 		need_tex_update = true;
 	}
 	
-	if(need_tex_update)
+	if (need_tex_update)
 	{
 		SetupTextures(need_depth, need_luminance);
 		need_tex_update = false;
 	}
 
-	if(need_depth){
+	if (need_depth) {
 		glActiveTextureARB(GL_TEXTURE1);
 		glBindTexture(GL_TEXTURE_2D, texname[1]);
 		glCopyTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT, 0, 0, texturewidth,textureheight, 0);
 	}
 	
-	if(need_luminance){
+	if (need_luminance) {
 		glActiveTextureARB(GL_TEXTURE2);
 		glBindTexture(GL_TEXTURE_2D, texname[2]);
 		glCopyTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE16, 0, 0, texturewidth,textureheight, 0);
@@ -443,9 +444,9 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
 	glPushMatrix();
 	glLoadIdentity();
 
-	for(passindex =0; passindex<MAX_RENDER_PASS; passindex++)
+	for (passindex =0; passindex<MAX_RENDER_PASS; passindex++)
 	{
-		if(m_filters[passindex] && m_enabled[passindex])
+		if (m_filters[passindex] && m_enabled[passindex])
 		{
 			StartShaderProgram(passindex);
 
@@ -474,26 +475,26 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
 
 void RAS_2DFilterManager::EnableFilter(vector<STR_String>& propNames, void* gameObj, RAS_2DFILTER_MODE mode, int pass, STR_String& text)
 {
-	if(!isshadersupported)
+	if (!isshadersupported)
 		return;
-	if(pass<0 || pass>=MAX_RENDER_PASS)
+	if (pass<0 || pass>=MAX_RENDER_PASS)
 		return;
 	need_tex_update = true;
-	if(mode == RAS_2DFILTER_DISABLED)
+	if (mode == RAS_2DFILTER_DISABLED)
 	{
 		m_enabled[pass] = 0;
 		return;
 	}
 
-	if(mode == RAS_2DFILTER_ENABLED)
+	if (mode == RAS_2DFILTER_ENABLED)
 	{
 		m_enabled[pass] = 1;
 		return;
 	}
 
-	if(mode == RAS_2DFILTER_NOFILTER)
+	if (mode == RAS_2DFILTER_NOFILTER)
 	{
-		if(m_filters[pass])
+		if (m_filters[pass])
 			glDeleteObjectARB(m_filters[pass]);
 		m_enabled[pass] = 0;
 		m_filters[pass] = 0;
@@ -503,9 +504,9 @@ void RAS_2DFilterManager::EnableFilter(vector<STR_String>& propNames, void* game
 		return;
 	}
 	
-	if(mode == RAS_2DFILTER_CUSTOMFILTER)
+	if (mode == RAS_2DFILTER_CUSTOMFILTER)
 	{
-		if(m_filters[pass])
+		if (m_filters[pass])
 			glDeleteObjectARB(m_filters[pass]);
 		m_filters[pass] = CreateShaderProgram(text.Ptr());
 		m_gameObjects[pass] = gameObj;
@@ -515,7 +516,7 @@ void RAS_2DFilterManager::EnableFilter(vector<STR_String>& propNames, void* game
 	}
 
 	// We've checked all other cases, which means we must be dealing with a builtin filter
-	if(m_filters[pass])
+	if (m_filters[pass])
 		glDeleteObjectARB(m_filters[pass]);
 	m_filters[pass] = CreateShaderProgram(mode);
 	m_gameObjects[pass] = NULL;
diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.h b/source/gameengine/Rasterizer/RAS_2DFilterManager.h
index a18df8b..d3b23de 100644
--- a/source/gameengine/Rasterizer/RAS_2DFilterManager.h
+++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerast
  */
 
-#ifndef __RAS_I2DFILTER
-#define __RAS_I2DFILTER
+#ifndef __RAS_2DFILTERMANAGER_H__
+#define __RAS_2DFILTERMANAGER_H__
 
 #include "RAS_ICanvas.h"
 #define MAX_RENDER_PASS	100
@@ -44,7 +44,7 @@ class RAS_2DFilterManager
 private:
 	unsigned int	CreateShaderProgram(const char* shadersource);
 	unsigned int	CreateShaderProgram(int filtermode);
-	void		AnalyseShader(int passindex, vector<STR_String>& propNames);
+	void		AnalyseShader(int passindex, std::vector<STR_String>& propNames);
 	void			StartShaderProgram(int passindex);
 	void			EndShaderProgram();
 	void			PrintShaderErrors(unsigned int shader, const char *task, const char *code);
@@ -77,7 +77,7 @@ private:
 	short		m_enabled[MAX_RENDER_PASS];
 
 	// stores object properties to send to shaders in each pass
-	vector<STR_String>	m_properties[MAX_RENDER_PASS];
+	std::vector<STR_String>	m_properties[MAX_RENDER_PASS];
 	void* m_gameObjects[MAX_RENDER_PASS];
 public:
 	enum RAS_2DFILTER_MODE {
@@ -105,7 +105,7 @@ public:
 
 	void RenderFilters(RAS_ICanvas* canvas);
 
-	void EnableFilter(vector<STR_String>& propNames, void* gameObj, RAS_2DFILTER_MODE mode, int pass, STR_String& text);
+	void EnableFilter(std::vector<STR_String>& propNames, void* gameObj, RAS_2DFILTER_MODE mode, int pass, STR_String& text);
 	
 	
 #ifdef WITH_CXX_GUARDEDALLOC
diff --git a/source/gameengine/Rasterizer/RAS_BucketManager.cpp b/source/gameengine/Rasterizer/RAS_BucketManager.cpp
index f7cc47d..90587bb 100644
--- a/source/gameengine/Rasterizer/RAS_BucketManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_BucketManager.cpp
@@ -119,7 +119,7 @@ void RAS_BucketManager::OrderBuckets(const MT_Transform& cameratrans, BucketList
 	for (bit = buckets.begin(); bit != buckets.end(); ++bit)
 	{
 		SG_DList::iterator<RAS_MeshSlot> mit((*bit)->GetActiveMeshSlots());
-		for(mit.begin(); !mit.end(); ++mit)
+		for (mit.begin(); !mit.end(); ++mit)
 			size++;
 	}
 
@@ -135,7 +135,7 @@ void RAS_BucketManager::OrderBuckets(const MT_Transform& cameratrans, BucketList
 		}
 	}
 		
-	if(alpha)
+	if (alpha)
 		sort(slots.begin(), slots.end(), backtofront());
 	else
 		sort(slots.begin(), slots.end(), fronttoback());
@@ -154,7 +154,7 @@ void RAS_BucketManager::RenderAlphaBuckets(
 
 	OrderBuckets(cameratrans, m_AlphaBuckets, slots, true);
 	
-	for(sit=slots.begin(); sit!=slots.end(); ++sit) {
+	for (sit=slots.begin(); sit!=slots.end(); ++sit) {
 		rendertools->SetClientObject(rasty, sit->m_ms->m_clientObj);
 
 		while(sit->m_bucket->ActivateMaterial(cameratrans, rasty, rendertools))
@@ -217,7 +217,7 @@ void RAS_BucketManager::RenderSolidBuckets(
 
 	OrderBuckets(cameratrans, m_SolidBuckets, slots, false);
 
-	for(sit=slots.begin(); sit!=slots.end(); ++sit) {
+	for (sit=slots.begin(); sit!=slots.end(); ++sit) {
 		rendertools->SetClientObject(rasty, sit->m_ms->m_clientObj);
 
 		while(sit->m_bucket->ActivateMaterial(cameratrans, rasty, rendertools))
@@ -283,7 +283,7 @@ void RAS_BucketManager::ReleaseDisplayLists(RAS_IPolyMaterial *mat)
 	for (bit = m_SolidBuckets.begin(); bit != m_SolidBuckets.end(); ++bit) {
 		if (mat == NULL || (mat == (*bit)->GetPolyMaterial())) {
 			for (mit = (*bit)->msBegin(); mit != (*bit)->msEnd(); ++mit) {
-				if(mit->m_DisplayList) {
+				if (mit->m_DisplayList) {
 					mit->m_DisplayList->Release();
 					mit->m_DisplayList = NULL;
 				}
@@ -294,7 +294,7 @@ void RAS_BucketManager::ReleaseDisplayLists(RAS_IPolyMaterial *mat)
 	for (bit = m_AlphaBuckets.begin(); bit != m_AlphaBuckets.end(); ++bit) {
 		if (mat == NULL || (mat == (*bit)->GetPolyMaterial())) {
 			for (mit = (*bit)->msBegin(); mit != (*bit)->msEnd(); ++mit) {
-				if(mit->m_DisplayList) {
+				if (mit->m_DisplayList) {
 					mit->m_DisplayList->Release();
 					mit->m_DisplayList = NULL;
 				}
@@ -329,7 +329,7 @@ void RAS_BucketManager::RemoveMaterial(RAS_IPolyMaterial * mat)
 	int i;
 
 
-	for(i=0; i<m_SolidBuckets.size(); i++) {
+	for (i=0; i<m_SolidBuckets.size(); i++) {
 		RAS_MaterialBucket *bucket = m_SolidBuckets[i];
 		if (mat == bucket->GetPolyMaterial()) {
 			m_SolidBuckets.erase(m_SolidBuckets.begin()+i);
@@ -338,7 +338,7 @@ void RAS_BucketManager::RemoveMaterial(RAS_IPolyMaterial * mat)
 		}
 	}
 
-	for(int i=0; i<m_AlphaBuckets.size(); i++) {
+	for (int i=0; i<m_AlphaBuckets.size(); i++) {
 		RAS_MaterialBucket *bucket = m_AlphaBuckets[i];
 		if (mat == bucket->GetPolyMaterial()) {
 			m_AlphaBuckets.erase(m_AlphaBuckets.begin()+i);
diff --git a/source/gameengine/Rasterizer/RAS_BucketManager.h b/source/gameengine/Rasterizer/RAS_BucketManager.h
index b4b5465..dade2ad 100644
--- a/source/gameengine/Rasterizer/RAS_BucketManager.h
+++ b/source/gameengine/Rasterizer/RAS_BucketManager.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerast
  */
 
-#ifndef __RAS_BUCKETMANAGER
-#define __RAS_BUCKETMANAGER
+#ifndef __RAS_BUCKETMANAGER_H__
+#define __RAS_BUCKETMANAGER_H__
 
 #include "MT_Transform.h"
 #include "RAS_MaterialBucket.h"
@@ -65,8 +65,8 @@ public:
 
 	/* for merging */
 	void MergeBucketManager(RAS_BucketManager *other, SCA_IScene *scene);
-	BucketList & GetSolidBuckets() {return m_SolidBuckets;};
-	BucketList & GetAlphaBuckets() {return m_AlphaBuckets;};
+	BucketList & GetSolidBuckets() {return m_SolidBuckets;}
+	BucketList & GetAlphaBuckets() {return m_AlphaBuckets;}
 
 	/*void PrintStats(int verbose_level) {
 		printf("\nMappings...\n");
@@ -91,5 +91,5 @@ public:
 #endif
 };
 
-#endif //__RAS_BUCKETMANAGER
+#endif //__RAS_BUCKETMANAGER_H__
 
diff --git a/source/gameengine/Rasterizer/RAS_CameraData.h b/source/gameengine/Rasterizer/RAS_CameraData.h
index 2120a18..4a70df6 100644
--- a/source/gameengine/Rasterizer/RAS_CameraData.h
+++ b/source/gameengine/Rasterizer/RAS_CameraData.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerast
  */
 
-#ifndef __RAS_CAMERADATA_H
-#define __RAS_CAMERADATA_H
+#ifndef __RAS_CAMERADATA_H__
+#define __RAS_CAMERADATA_H__
 
 struct RAS_CameraData
 {
@@ -71,5 +71,5 @@ struct RAS_CameraData
 	}
 };
 
-#endif //__RAS_CAMERADATA_H
+#endif //__RAS_CAMERADATA_H__
 
diff --git a/source/gameengine/Rasterizer/RAS_Deformer.h b/source/gameengine/Rasterizer/RAS_Deformer.h
index 6113589..1e9a792 100644
--- a/source/gameengine/Rasterizer/RAS_Deformer.h
+++ b/source/gameengine/Rasterizer/RAS_Deformer.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerast
  */
 
-#ifndef RAS_DEFORMER
-#define RAS_DEFORMER
+#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
diff --git a/source/gameengine/Rasterizer/RAS_FramingManager.cpp b/source/gameengine/Rasterizer/RAS_FramingManager.cpp
index 8a5c10b..1cd110f 100644
--- a/source/gameengine/Rasterizer/RAS_FramingManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_FramingManager.cpp
@@ -43,12 +43,12 @@ ComputeDefaultFrustum(
 	const short sensor_fit,
 	const float design_aspect_ratio,
 	RAS_FrameFrustum & frustum
-){		
+) {		
 	float halfSize;
 	float sizeX;
 	float sizeY;
 
-	if(sensor_fit==RAS_SENSORFIT_AUTO) {
+	if (sensor_fit==RAS_SENSORFIT_AUTO) {
 		halfSize = (sensor_x / 2.f) * camnear / lens;
 
 		if (design_aspect_ratio > 1.f) {
@@ -61,7 +61,7 @@ ComputeDefaultFrustum(
 			sizeY = halfSize;
 		}
 	}
-	else if(sensor_fit==RAS_SENSORFIT_HOR) {
+	else if (sensor_fit==RAS_SENSORFIT_HOR) {
 		halfSize = (sensor_x / 2.f) * camnear / lens;
 		sizeX = halfSize;
 		sizeY = halfSize/design_aspect_ratio;
@@ -95,7 +95,7 @@ ComputeDefaultOrtho(
 	float sizeX;
 	float sizeY;
 
-	if(sensor_fit==RAS_SENSORFIT_AUTO) {
+	if (sensor_fit==RAS_SENSORFIT_AUTO) {
 		if (design_aspect_ratio > 1.f) {
 			// halfsize defines the width
 			sizeX = halfSize;
@@ -106,7 +106,7 @@ ComputeDefaultOrtho(
 			sizeY = halfSize;
 		}
 	}
-	else if(sensor_fit==RAS_SENSORFIT_HOR) {
+	else if (sensor_fit==RAS_SENSORFIT_HOR) {
 		sizeX = halfSize;
 		sizeY = halfSize/design_aspect_ratio;
 	}
@@ -130,7 +130,7 @@ ComputeBestFitViewRect(
 	const RAS_Rect &availableViewport,
 	const float design_aspect_ratio,
 	RAS_Rect &viewport
-){
+) {
 	// try and honour the aspect ratio when setting the 
 	// drawable area. If we don't do this we are liable
 	// to get a lot of distortion in the rendered image.
@@ -165,7 +165,7 @@ ComputeViewport(
 	const RAS_FrameSettings &settings,
 	const RAS_Rect &availableViewport,
 	RAS_Rect &viewport
-){
+) {
 
 	RAS_FrameSettings::RAS_FrameType type = settings.FrameType();
 	const int winx = availableViewport.GetWidth();
@@ -224,7 +224,7 @@ ComputeFrustum(
 	const float camnear,
 	const float camfar,
 	RAS_FrameFrustum &frustum
-){
+) {
 
 	RAS_FrameSettings::RAS_FrameType type = settings.FrameType();
 
diff --git a/source/gameengine/Rasterizer/RAS_FramingManager.h b/source/gameengine/Rasterizer/RAS_FramingManager.h
index 6121422..fc5adc9 100644
--- a/source/gameengine/Rasterizer/RAS_FramingManager.h
+++ b/source/gameengine/Rasterizer/RAS_FramingManager.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerast
  */
 
-#ifndef RAS_FRAMINGMANAGER_H
-#define RAS_FRAMINGMANAGER_H
+#ifndef __RAS_FRAMINGMANAGER_H__
+#define __RAS_FRAMINGMANAGER_H__
 
 #ifdef WITH_CXX_GUARDEDALLOC
 #include "MEM_guardedalloc.h"
@@ -39,7 +39,7 @@
 class RAS_Rect;
 
 /**
- * @section RAS_FrameSettings
+ * \section RAS_FrameSettings
  * This is a value type describing the framing used
  * by a particular scene in the game engine.
  * Each KX_Scene contains a RAS_FrameSetting describing
@@ -174,7 +174,7 @@ struct RAS_FrameFrustum
 	float camnear,camfar;
 	float x1,y1;
 	float x2,y2;
-};	
+};
 
 /* must match R_CULLING_... from DNA_scene_types.h */
 enum RAS_CullingMode
@@ -193,7 +193,7 @@ enum RAS_SensorFit
 };
 
 /**
- * @section RAS_FramingManager
+ * \section RAS_FramingManager
  * This class helps to compute a view frustum
  * and a viewport rectangle given the 
  * above settings and a description of the 
@@ -307,7 +307,7 @@ public:
 	void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_FramingManager"); }
 	void operator delete( void *mem ) { MEM_freeN(mem); }
 #endif
-};		
-		
+};
+
 #endif
 
diff --git a/source/gameengine/Rasterizer/RAS_ICanvas.h b/source/gameengine/Rasterizer/RAS_ICanvas.h
index 2c2f62c..337ea24 100644
--- a/source/gameengine/Rasterizer/RAS_ICanvas.h
+++ b/source/gameengine/Rasterizer/RAS_ICanvas.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerast
  */
 
-#ifndef __RAS_ICANVAS
-#define __RAS_ICANVAS
+#ifndef __RAS_ICANVAS_H__
+#define __RAS_ICANVAS_H__
 
 #ifdef WITH_CXX_GUARDEDALLOC
 #include "MEM_guardedalloc.h"
@@ -80,8 +80,8 @@ public:
 	 * Initializes the canvas for drawing.  Drawing to the canvas is
 	 * only allowed between BeginDraw() and EndDraw().
 	 *
-	 * @retval false Acquiring the canvas failed.
-	 * @retval true Acquiring the canvas succeeded.
+	 * \retval false Acquiring the canvas failed.
+	 * \retval true Acquiring the canvas succeeded.
 	 *
 	 */
 
@@ -170,7 +170,7 @@ public:
 	) = 0;
 
 	/**
-	 * Set the visible vieport 
+	 * Set the visible view-port 
 	 */
 
 	virtual
@@ -225,5 +225,5 @@ public:
 #endif
 };
 
-#endif //__RAS_ICANVAS
+#endif //__RAS_ICANVAS_H__
 
diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
index 48251b2..4af1753 100644
--- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
+++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
@@ -124,7 +124,7 @@ RAS_IPolyMaterial::RAS_IPolyMaterial(const STR_String& texname,
 
 bool RAS_IPolyMaterial::Equals(const RAS_IPolyMaterial& lhs) const
 {
-	if(m_flag &RAS_BLENDERMAT)
+	if (m_flag &RAS_BLENDERMAT)
 	{
 		bool test = (
 			this->m_multimode			==		lhs.m_multimode &&
@@ -254,10 +254,10 @@ bool RAS_IPolyMaterial::UsesLighting(RAS_IRasterizer *rasty) const
 {
 	bool dolights = false;
 
-	if(m_flag & RAS_BLENDERMAT)
+	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 (rasty->GetDrawingMode() < RAS_IRasterizer::KX_SOLID);
+	else if (rasty->GetDrawingMode() == RAS_IRasterizer::KX_SHADOW);
 	else
 		dolights = m_light;
 	
diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
index 6527b0d..527114b 100644
--- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
+++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerast
  */
 
-#ifndef __RAS_IPOLYGONMATERIAL
-#define __RAS_IPOLYGONMATERIAL
+#ifndef __RAS_IPOLYGONMATERIAL_H__
+#define __RAS_IPOLYGONMATERIAL_H__
 
 #include "STR_HashedString.h"
 
@@ -130,12 +130,12 @@ public:
 					bool image,
 					struct GameSettings* game);
 
-	virtual ~RAS_IPolyMaterial() {};
+	virtual ~RAS_IPolyMaterial() {}
  
 	/**
 	 * Returns the caching information for this material,
 	 * This can be used to speed up the rasterizing process.
-	 * @return The caching information.
+	 * \return The caching information.
 	 */
 	virtual TCachingInfo GetCachingInfo(void) const { return 0; }
 
@@ -143,8 +143,8 @@ public:
 	 * Activates the material in the rasterizer.
 	 * On entry, the cachingInfo contains info about the last activated material.
 	 * On exit, the cachingInfo should contain updated info about this material.
-	 * @param rasty			The rasterizer in which the material should be active.
-	 * @param cachingInfo	The information about the material used to speed up rasterizing.
+	 * \param rasty			The rasterizer in which the material should be active.
+	 * \param cachingInfo	The information about the material used to speed up rasterizing.
 	 */
 	virtual bool Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingInfo) const 
 	{ 
@@ -177,7 +177,7 @@ public:
 	virtual void		Replace_IScene(SCA_IScene *val) {}; /* overridden by KX_BlenderMaterial */
 
 	/**
-	* @return the equivalent drawing mode for the material settings (equivalent to old TexFace tface->mode).
+	* \return the equivalent drawing mode for the material settings (equivalent to old TexFace tface->mode).
 	*/
 	int					ConvertFaceMode(struct GameSettings *game, bool image) const;
 
@@ -204,5 +204,5 @@ inline  bool operator < ( const RAS_IPolyMaterial & lhs, const RAS_IPolyMaterial
 	return lhs.Less(rhs);
 }
 
-#endif //__RAS_IPOLYGONMATERIAL
+#endif //__RAS_IPOLYGONMATERIAL_H__
 
diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h
index 70b91cc..592ddbe 100644
--- a/source/gameengine/Rasterizer/RAS_IRasterizer.h
+++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerast
  */
 
-#ifndef __RAS_IRASTERIZER
-#define __RAS_IRASTERIZER
+#ifndef __RAS_IRASTERIZER_H__
+#define __RAS_IRASTERIZER_H__
 
 #if defined(WIN32) && !defined(FREE_WINDOWS)
 #pragma warning (disable:4786)
@@ -162,7 +162,7 @@ public:
 	 */
 	virtual bool	SetMaterial(const RAS_IPolyMaterial& mat)=0;
 	/**
-	 * Init initialises the renderer.
+	 * Init initializes the renderer.
 	 */
 	virtual bool	Init()=0;
 	/**
@@ -202,7 +202,7 @@ public:
 	virtual void	SetStereoMode(const StereoMode stereomode)=0;
 	/**
 	 * Stereo can be used to query if the rasterizer is in stereo mode.
-	 * @return true if stereo mode is enabled.
+	 * \return true if stereo mode is enabled.
 	 */
 	virtual bool	Stereo()=0;
 	virtual StereoMode GetStereoMode()=0;
@@ -236,7 +236,7 @@ public:
 
 	/**
 	 * IndexPrimitives_3DText will render text into the polygons.
-	 * The text to be rendered is from @param rendertools client object's text property.
+	 * The text to be rendered is from \param rendertools client object's text property.
 	 */
 	virtual void	IndexPrimitives_3DText(class RAS_MeshSlot& ms,
 							class RAS_IPolyMaterial* polymat,
@@ -247,7 +247,7 @@ public:
 	/**
 	 * Set the projection matrix for the rasterizer. This projects
 	 * from camera coordinates to window coordinates.
-	 * @param mat The projection matrix.
+	 * \param mat The projection matrix.
 	 */
 	virtual void	SetProjectionMatrix(const MT_Matrix4x4 & mat)=0;
 	/**
@@ -292,11 +292,11 @@ public:
 								 float alpha)=0;
 	
 	/**
-	 * @param drawingmode = KX_BOUNDINGBOX, KX_WIREFRAME, KX_SOLID, KX_SHADED or KX_TEXTURED.
+	 * \param drawingmode = KX_BOUNDINGBOX, KX_WIREFRAME, KX_SOLID, KX_SHADED or KX_TEXTURED.
 	 */
 	virtual void	SetDrawingMode(int drawingmode)=0;
 	/**
-	 * @return the current drawing mode: KX_BOUNDINGBOX, KX_WIREFRAME, KX_SOLID, KX_SHADED or KX_TEXTURED.
+	 * \return the current drawing mode: KX_BOUNDINGBOX, KX_WIREFRAME, KX_SOLID, KX_SHADED or KX_TEXTURED.
 	 */
 	virtual int	GetDrawingMode()=0;
 	/**
@@ -312,13 +312,13 @@ public:
 	virtual double	GetTime()=0;
 	/**
 	 * Generates a projection matrix from the specified frustum.
-	 * @param left the left clipping plane
-	 * @param right the right clipping plane
-	 * @param bottom the bottom clipping plane
-	 * @param top the top clipping plane
-	 * @param frustnear the near clipping plane
-	 * @param frustfar the far clipping plane
-	 * @return a 4x4 matrix representing the projection transform.
+	 * \param left the left clipping plane
+	 * \param right the right clipping plane
+	 * \param bottom the bottom clipping plane
+	 * \param top the top clipping plane
+	 * \param frustnear the near clipping plane
+	 * \param frustfar the far clipping plane
+	 * \return a 4x4 matrix representing the projection transform.
 	 */
 	virtual MT_Matrix4x4 GetFrustumMatrix(
 		float left,
@@ -333,13 +333,13 @@ public:
 
 	/**
 	 * Generates a orthographic projection matrix from the specified frustum.
-	 * @param left the left clipping plane
-	 * @param right the right clipping plane
-	 * @param bottom the bottom clipping plane
-	 * @param top the top clipping plane
-	 * @param frustnear the near clipping plane
-	 * @param frustfar the far clipping plane
-	 * @return a 4x4 matrix representing the projection transform.
+	 * \param left the left clipping plane
+	 * \param right the right clipping plane
+	 * \param bottom the bottom clipping plane
+	 * \param top the top clipping plane
+	 * \param frustnear the near clipping plane
+	 * \param frustfar the far clipping plane
+	 * \return a 4x4 matrix representing the projection transform.
 	 */
 	virtual MT_Matrix4x4 GetOrthoMatrix(
 		float left,
@@ -425,6 +425,6 @@ public:
 #endif
 };
 
-#endif //__RAS_IRASTERIZER
+#endif //__RAS_IRASTERIZER_H__
 
 
diff --git a/source/gameengine/Rasterizer/RAS_IRenderTools.h b/source/gameengine/Rasterizer/RAS_IRenderTools.h
index b7e81e1..1d9f705 100644
--- a/source/gameengine/Rasterizer/RAS_IRenderTools.h
+++ b/source/gameengine/Rasterizer/RAS_IRenderTools.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerast
  */
 
-#ifndef __RAS_IRENDERTOOLS
-#define __RAS_IRENDERTOOLS
+#ifndef __RAS_IRENDERTOOLS_H__
+#define __RAS_IRENDERTOOLS_H__
 
 #include "MT_Transform.h"
 #include "RAS_IRasterizer.h"
@@ -103,13 +103,13 @@ public:
 
 	/**
 	 * Renders 3D text string using BFL.
-	 * @param fontid	The id of the font.
-	 * @param text		The string to render.
-	 * @param size		The size of the text.
-	 * @param dpi		The resolution of the text.
-	 * @param color		The color of the object.
-	 * @param mat		The Matrix of the text object.
-	 * @param aspect	A scaling factor to compensate for the size.
+	 * \param fontid	The id of the font.
+	 * \param text		The string to render.
+	 * \param size		The size of the text.
+	 * \param dpi		The resolution of the text.
+	 * \param color		The color of the object.
+	 * \param mat		The Matrix of the text object.
+	 * \param aspect	A scaling factor to compensate for the size.
 	 */
 	virtual 
 		void	
@@ -125,12 +125,12 @@ public:
 
 	/**
 	 * Renders 2D text string.
-	 * @param mode      The type of text
-	 * @param text		The string to render.
-	 * @param xco		Position on the screen (origin in lower left corner).
-	 * @param yco		Position on the screen (origin in lower left corner).
-	 * @param width		Width of the canvas to draw to.
-	 * @param height	Height of the canvas to draw to.
+	 * \param mode      The type of text
+	 * \param text		The string to render.
+	 * \param xco		Position on the screen (origin in lower left corner).
+	 * \param yco		Position on the screen (origin in lower left corner).
+	 * \param width		Width of the canvas to draw to.
+	 * \param height	Height of the canvas to draw to.
 	 */
 	virtual 
 		void	
@@ -210,7 +210,7 @@ public:
 #endif
 };
 
-#endif //__RAS_IRENDERTOOLS
+#endif //__RAS_IRENDERTOOLS_H__
 
 
 
diff --git a/source/gameengine/Rasterizer/RAS_LightObject.h b/source/gameengine/Rasterizer/RAS_LightObject.h
index 78e57e2..c378a9e 100644
--- a/source/gameengine/Rasterizer/RAS_LightObject.h
+++ b/source/gameengine/Rasterizer/RAS_LightObject.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerast
  */
 
-#ifndef __RAS_LIGHTOBJECT_H
-#define __RAS_LIGHTOBJECT_H
+#ifndef __RAS_LIGHTOBJECT_H__
+#define __RAS_LIGHTOBJECT_H__
 
 #include "MT_CmMatrix4x4.h"
 
@@ -64,5 +64,5 @@ struct RAS_LightObject
 	bool	m_nospecular;
 };
 
-#endif //__RAS_LIGHTOBJECT_H
+#endif //__RAS_LIGHTOBJECT_H__
 
diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
index ad26ed5..a18adfd 100644
--- a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
+++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
@@ -77,9 +77,9 @@ RAS_MeshSlot::~RAS_MeshSlot()
 		m_joinedSlots.front()->Split(true);
 #endif
 
-	for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) {
+	for (it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) {
 		(*it)->m_users--;
-		if((*it)->m_users == 0)
+		if ((*it)->m_users == 0)
 			delete *it;
 	}
 
@@ -117,7 +117,7 @@ RAS_MeshSlot::RAS_MeshSlot(const RAS_MeshSlot& slot) : SG_QList()
 	m_endvertex = slot.m_endvertex;
 	m_endindex = slot.m_endindex;
 
-	for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) {
+	for (it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) {
 		// don't copy display arrays for now because it breaks python 
 		// access to vertices, but we'll need a solution if we want to
 		// join display arrays for reducing draw calls.
@@ -149,7 +149,7 @@ void RAS_MeshSlot::begin(RAS_MeshSlot::iterator& it)
 
 	it.array = (m_displayArrays.size() > 0)? m_displayArrays[m_startarray]: NULL;
 
-	if(it.array == NULL || it.array->m_index.size() == 0 || it.array->m_vertex.size() == 0) {
+	if (it.array == NULL || it.array->m_index.size() == 0 || it.array->m_vertex.size() == 0) {
 		it.array = NULL;
 		it.vertex = NULL;
 		it.index = NULL;
@@ -177,7 +177,7 @@ void RAS_MeshSlot::next(RAS_MeshSlot::iterator& it)
 	int startvertex, endvertex;
 	int startindex, endindex;
 
-	if(it.arraynum == (size_t)m_endarray) {
+	if (it.arraynum == (size_t)m_endarray) {
 		it.array = NULL;
 		it.vertex = NULL;
 		it.index = NULL;
@@ -217,13 +217,13 @@ void RAS_MeshSlot::SetDisplayArray(int numverts)
 	RAS_DisplayArrayList::iterator it;
 	RAS_DisplayArray *darray = NULL;
 	
-	for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) {
+	for (it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) {
 		darray = *it;
 
-		if(darray->m_type == numverts) {
-			if(darray->m_index.size()+numverts >= RAS_DisplayArray::BUCKET_MAX_INDEX)
+		if (darray->m_type == numverts) {
+			if (darray->m_index.size()+numverts >= RAS_DisplayArray::BUCKET_MAX_INDEX)
 				darray = NULL;
-			else if(darray->m_vertex.size()+numverts >= RAS_DisplayArray::BUCKET_MAX_VERTEX)
+			else if (darray->m_vertex.size()+numverts >= RAS_DisplayArray::BUCKET_MAX_VERTEX)
 				darray = NULL;
 			else
 				break;
@@ -232,21 +232,21 @@ void RAS_MeshSlot::SetDisplayArray(int numverts)
 			darray = NULL;
 	}
 
-	if(!darray) {
+	if (!darray) {
 		darray = new RAS_DisplayArray();
 		darray->m_users = 1;
 
-		if(numverts == 2) darray->m_type = RAS_DisplayArray::LINE;
-		else if(numverts == 3) darray->m_type = RAS_DisplayArray::TRIANGLE;
+		if (numverts == 2) darray->m_type = RAS_DisplayArray::LINE;
+		else if (numverts == 3) darray->m_type = RAS_DisplayArray::TRIANGLE;
 		else darray->m_type = RAS_DisplayArray::QUAD;
 
 		m_displayArrays.push_back(darray);
 
-		if(numverts == 2)
+		if (numverts == 2)
 			darray->m_type = RAS_DisplayArray::LINE;
-		else if(numverts == 3)
+		else if (numverts == 3)
 			darray->m_type = RAS_DisplayArray::TRIANGLE;
-		else if(numverts == 4)
+		else if (numverts == 4)
 			darray->m_type = RAS_DisplayArray::QUAD;
 		
 		m_endarray = m_displayArrays.size()-1;
@@ -271,7 +271,7 @@ int RAS_MeshSlot::AddVertex(const RAS_TexVert& tv)
 	darray->m_vertex.push_back(tv);
 	offset = darray->m_vertex.size()-1;
 
-	if(darray == m_displayArrays[m_endarray])
+	if (darray == m_displayArrays[m_endarray])
 		m_endvertex++;
 
 	return offset;
@@ -284,7 +284,7 @@ void RAS_MeshSlot::AddPolygonVertex(int offset)
 	darray = m_currentArray;
 	darray->m_index.push_back(offset);
 
-	if(darray == m_displayArrays[m_endarray])
+	if (darray == m_displayArrays[m_endarray])
 		m_endindex++;
 }
 
@@ -294,9 +294,9 @@ void RAS_MeshSlot::SetDeformer(RAS_Deformer* deformer)
 		RAS_DisplayArrayList::iterator it;
 		if (deformer->ShareVertexArray()) {
 			// this deformer uses the base vertex array, first release the current ones
-			for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) {
+			for (it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) {
 				(*it)->m_users--;
-				if((*it)->m_users == 0)
+				if ((*it)->m_users == 0)
 					delete *it;
 			}
 			m_displayArrays.clear();
@@ -304,7 +304,7 @@ void RAS_MeshSlot::SetDeformer(RAS_Deformer* deformer)
 			RAS_MeshMaterial *mmat = m_mesh->GetMeshMaterial(m_bucket->GetPolyMaterial());
 			if (mmat && mmat->m_baseslot) {
 				m_displayArrays = mmat->m_baseslot->m_displayArrays;
-				for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) {
+				for (it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) {
 					(*it)->m_users++;
 				}
 			}
@@ -313,7 +313,7 @@ void RAS_MeshSlot::SetDeformer(RAS_Deformer* deformer)
 			// no sharing
 			// we create local copy of RAS_DisplayArray when we have a deformer:
 			// this way we can avoid conflict between the vertex cache of duplicates
-			for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) {
+			for (it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) {
 				if (deformer->UseVertexArray()) {
 					// the deformer makes use of vertex array, make sure we have our local copy
 					if ((*it)->m_users > 1) {
@@ -327,7 +327,7 @@ void RAS_MeshSlot::SetDeformer(RAS_Deformer* deformer)
 				} else {
 					// the deformer is not using vertex array (Modifier), release them
 					(*it)->m_users--;
-					if((*it)->m_users == 0)
+					if ((*it)->m_users == 0)
 						delete *it;
 				}
 			}
@@ -347,15 +347,15 @@ void RAS_MeshSlot::SetDeformer(RAS_Deformer* deformer)
 
 bool RAS_MeshSlot::Equals(RAS_MeshSlot *target)
 {
-	if(!m_OpenGLMatrix || !target->m_OpenGLMatrix)
+	if (!m_OpenGLMatrix || !target->m_OpenGLMatrix)
 		return false;
-	if(m_pDeformer || target->m_pDeformer)
+	if (m_pDeformer || target->m_pDeformer)
 		return false;
-	if(m_bVisible != target->m_bVisible)
+	if (m_bVisible != target->m_bVisible)
 		return false;
-	if(m_bObjectColor != target->m_bObjectColor)
+	if (m_bObjectColor != target->m_bObjectColor)
 		return false;
-	if(m_bObjectColor && !(m_RGBAcolor == target->m_RGBAcolor))
+	if (m_bObjectColor && !(m_RGBAcolor == target->m_RGBAcolor))
 		return false;
 	
 	return true;
@@ -368,16 +368,16 @@ bool RAS_MeshSlot::Join(RAS_MeshSlot *target, MT_Scalar distance)
 	size_t i;
 
 	// verify if we can join
-	if(m_joinSlot || m_joinedSlots.size() || target->m_joinSlot)
+	if (m_joinSlot || m_joinedSlots.size() || target->m_joinSlot)
 		return false;
 
-	if(!Equals(target))
+	if (!Equals(target))
 		return false;
 	
 	MT_Vector3 co(&m_OpenGLMatrix[12]);
 	MT_Vector3 targetco(&target->m_OpenGLMatrix[12]);
 
-	if((co - targetco).length() > distance)
+	if ((co - targetco).length() > distance)
 		return false;
 
 	MT_Matrix4x4 mat(m_OpenGLMatrix);
@@ -395,14 +395,14 @@ bool RAS_MeshSlot::Join(RAS_MeshSlot *target, MT_Scalar distance)
 	MT_Matrix4x4 ntransform = m_joinInvTransform.transposed();
 	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++)
+	for (begin(mit); !end(mit); next(mit))
+		for (i=mit.startvertex; i<mit.endvertex; i++)
 			mit.vertex[i].Transform(transform, ntransform);
 	
 	/* We know we'll need a list at least this big, reserve in advance */
 	target->m_displayArrays.reserve(target->m_displayArrays.size() + m_displayArrays.size());
 
-	for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) {
+	for (it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) {
 		target->m_displayArrays.push_back(*it);
 		target->m_endarray++;
 		target->m_endvertex = target->m_displayArrays.back()->m_vertex.size();
@@ -432,24 +432,24 @@ bool RAS_MeshSlot::Split(bool force)
 	iterator mit;
 	size_t i, found0 = 0, found1 = 0;
 
-	if(target && (force || !Equals(target))) {
+	if (target && (force || !Equals(target))) {
 		m_joinSlot = NULL;
 
-		for(jit=target->m_joinedSlots.begin(); jit!=target->m_joinedSlots.end(); jit++) {
-			if(*jit == this) {
+		for (jit=target->m_joinedSlots.begin(); jit!=target->m_joinedSlots.end(); jit++) {
+			if (*jit == this) {
 				target->m_joinedSlots.erase(jit);
 				found0 = 1;
 				break;
 			}
 		}
 
-		if(!found0)
+		if (!found0)
 			abort();
 
-		for(it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) {
+		for (it=m_displayArrays.begin(); it!=m_displayArrays.end(); it++) {
 			found1 = 0;
-			for(jt=target->m_displayArrays.begin(); jt!=target->m_displayArrays.end(); jt++) {
-				if(*jt == *it) {
+			for (jt=target->m_displayArrays.begin(); jt!=target->m_displayArrays.end(); jt++) {
+				if (*jt == *it) {
 					target->m_displayArrays.erase(jt);
 					target->m_endarray--;
 					found1 = 1;
@@ -457,11 +457,11 @@ bool RAS_MeshSlot::Split(bool force)
 				}
 			}
 
-			if(!found1)
+			if (!found1)
 				abort();
 		}
 
-		if(target->m_displayArrays.size()) {
+		if (target->m_displayArrays.size()) {
 			target->m_endvertex = target->m_displayArrays.back()->m_vertex.size();
 			target->m_endindex = target->m_displayArrays.back()->m_index.size();
 		}
@@ -473,8 +473,8 @@ bool RAS_MeshSlot::Split(bool force)
 		MT_Matrix4x4 ntransform = m_joinInvTransform.inverse().transposed();
 		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++)
+		for (begin(mit); !end(mit); next(mit))
+			for (i=mit.startvertex; i<mit.endvertex; i++)
 				mit.vertex[i].Transform(m_joinInvTransform, ntransform);
 
 		if (target->m_DisplayList) {
@@ -492,13 +492,13 @@ bool RAS_MeshSlot::Split(bool force)
 #ifdef USE_SPLIT	
 bool RAS_MeshSlot::IsCulled()
 {
-	if(m_joinSlot)
+	if (m_joinSlot)
 		return true;
-	if(!m_bCulled)
+	if (!m_bCulled)
 		return false;
 	list<RAS_MeshSlot*>::iterator it;
-	for(it=m_joinedSlots.begin(); it!=m_joinedSlots.end(); it++)
-		if(!(*it)->m_bCulled)
+	for (it=m_joinedSlots.begin(); it!=m_joinedSlots.end(); it++)
+		if (!(*it)->m_bCulled)
 			return false;
 	return true;
 }
@@ -563,8 +563,8 @@ void RAS_MaterialBucket::RemoveMesh(RAS_MeshSlot* ms)
 {
 	list<RAS_MeshSlot>::iterator it;
 
-	for(it=m_meshSlots.begin(); it!=m_meshSlots.end(); it++) {
-		if(&*it == ms) {
+	for (it=m_meshSlots.begin(); it!=m_meshSlots.end(); it++) {
+		if (&*it == ms) {
 			m_meshSlots.erase(it);
 			return;
 		}
@@ -586,10 +586,10 @@ bool RAS_MaterialBucket::ActivateMaterial(const MT_Transform& cameratrans, RAS_I
 {
 	bool uselights;
 	
-	if(rasty->GetDrawingMode() == RAS_IRasterizer::KX_SHADOW && !m_material->CastsShadows())
+	if (rasty->GetDrawingMode() == RAS_IRasterizer::KX_SHADOW && !m_material->CastsShadows())
 		return false;
 
-	if(!rasty->SetMaterial(*m_material))
+	if (!rasty->SetMaterial(*m_material))
 		return false;
 	
 	uselights= m_material->UsesLighting(rasty);
@@ -609,7 +609,7 @@ void RAS_MaterialBucket::RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRa
 	//	KX_ReInstanceShapeFromMesh(ms.m_mesh); // Recompute the physics mesh. (Can't call KX_* from RAS_)
 	}
 	
-	if(IsZSort() && rasty->GetDrawingMode() >= RAS_IRasterizer::KX_SOLID)
+	if (IsZSort() && rasty->GetDrawingMode() >= RAS_IRasterizer::KX_SOLID)
 		ms.m_mesh->SortPolygons(ms, cameratrans*MT_Transform(ms.m_OpenGLMatrix));
 
 	rendertools->PushMatrix();
@@ -618,8 +618,8 @@ void RAS_MaterialBucket::RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRa
 		rendertools->applyTransform(rasty,ms.m_OpenGLMatrix,m_material->GetDrawingMode());
 	}
 
-	if(rasty->QueryLists())
-		if(ms.m_DisplayList)
+	if (rasty->QueryLists())
+		if (ms.m_DisplayList)
 			ms.m_DisplayList->SetModified(ms.m_mesh->MeshModified());
 
 	// verify if we can use display list, not for deformed object, and
@@ -627,13 +627,13 @@ void RAS_MaterialBucket::RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRa
 	// then it won't have texture coordinates for actual drawing. also
 	// for zsort we can't make a display list, since the polygon order
 	// changes all the time.
-	if(ms.m_pDeformer && ms.m_pDeformer->IsDynamic())
+	if (ms.m_pDeformer && ms.m_pDeformer->IsDynamic())
 		ms.m_bDisplayList = false;
-	else if(!ms.m_DisplayList && rasty->GetDrawingMode() == RAS_IRasterizer::KX_SHADOW)
+	else if (!ms.m_DisplayList && rasty->GetDrawingMode() == RAS_IRasterizer::KX_SHADOW)
 		ms.m_bDisplayList = false;
 	else if (IsZSort())
 		ms.m_bDisplayList = false;
-	else if(m_material->UsesObjectColor() && ms.m_bObjectColor)
+	else if (m_material->UsesObjectColor() && ms.m_bObjectColor)
 		ms.m_bDisplayList = false;
 	else
 		ms.m_bDisplayList = true;
@@ -642,14 +642,14 @@ void RAS_MaterialBucket::RenderMeshSlot(const MT_Transform& cameratrans, RAS_IRa
 	if (m_material->GetDrawingMode() & RAS_IRasterizer::RAS_RENDER_3DPOLYGON_TEXT)
 		rasty->IndexPrimitives_3DText(ms, m_material, rendertools);
 	// for multitexturing
-	else if((m_material->GetFlag() & (RAS_MULTITEX|RAS_BLENDERGLSL)))
+	else if ((m_material->GetFlag() & (RAS_MULTITEX|RAS_BLENDERGLSL)))
 		rasty->IndexPrimitivesMulti(ms);
 	// use normal IndexPrimitives
 	else
 		rasty->IndexPrimitives(ms);
 
-	if(rasty->QueryLists())
-		if(ms.m_DisplayList)
+	if (rasty->QueryLists())
+		if (ms.m_DisplayList)
 			ms.m_mesh->SetMeshModified(false);
 
 	rendertools->PopMatrix();
@@ -666,8 +666,8 @@ void RAS_MaterialBucket::Optimize(MT_Scalar distance)
 	list<RAS_MeshSlot>::iterator jt;
 
 	// greed joining on all following buckets
-	for(it=m_meshSlots.begin(); it!=m_meshSlots.end(); it++)
-		for(jt=it, jt++; jt!=m_meshSlots.end(); jt++)
+	for (it=m_meshSlots.begin(); it!=m_meshSlots.end(); it++)
+		for (jt=it, jt++; jt!=m_meshSlots.end(); jt++)
 			jt->Join(&*it, distance);
 #endif
 }
diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.h b/source/gameengine/Rasterizer/RAS_MaterialBucket.h
index 5c8e2f2..cff4d67 100644
--- a/source/gameengine/Rasterizer/RAS_MaterialBucket.h
+++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerast
  */
 
-#ifndef __RAS_MATERIALBUCKET
-#define __RAS_MATERIALBUCKET
+#ifndef __RAS_MATERIALBUCKET_H__
+#define __RAS_MATERIALBUCKET_H__
 
 #include "RAS_TexVert.h"
 #include "CTR_Map.h"
@@ -82,7 +82,7 @@ class RAS_DisplayArray
 public:
 	vector<RAS_TexVert> m_vertex;
 	vector<unsigned short> m_index;
-	/* LINE currently isnt used */
+	/* LINE currently isn't used */
 	enum { LINE = 2, TRIANGLE = 3, QUAD = 4 } m_type;
 	//RAS_MeshSlot *m_origSlot;
 	
diff --git a/source/gameengine/Rasterizer/RAS_MeshObject.cpp b/source/gameengine/Rasterizer/RAS_MeshObject.cpp
index afa62a9..7da0be3 100644
--- a/source/gameengine/Rasterizer/RAS_MeshObject.cpp
+++ b/source/gameengine/Rasterizer/RAS_MeshObject.cpp
@@ -64,7 +64,7 @@ struct RAS_MeshObject::polygonSlot
 		MT_Vector3 center(0, 0, 0);
 		int i;
 
-		for(i=0; i<nvert; i++) {
+		for (i=0; i<nvert; i++) {
 			m_index[i] = indexarray[offset+i];
 			center += vertexarray[m_index[i]].getXYZ();
 		}
@@ -79,7 +79,7 @@ struct RAS_MeshObject::polygonSlot
 	{
 		int i;
 
-		for(i=0; i<nvert; i++)
+		for (i=0; i<nvert; i++)
 			indexarray[offset+i] = m_index[i];
 	}
 };
@@ -115,7 +115,7 @@ RAS_MeshObject::RAS_MeshObject(Mesh* mesh)
 		int count=0;
 		// initialize weight cache for shape objects
 		// count how many keys in this mesh
-		for(kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next)
+		for (kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next)
 			count++;
 		m_cacheWeightIndex.resize(count,-1);
 	}
@@ -129,14 +129,14 @@ RAS_MeshObject::~RAS_MeshObject()
 	{
 		KeyBlock *kb;
 		// remove the weight cache to avoid memory leak 
-		for(kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next) {
-			if(kb->weights) 
+		for (kb= (KeyBlock*)m_mesh->key->block.first; kb; kb= (KeyBlock*)kb->next) {
+			if (kb->weights) 
 				MEM_freeN(kb->weights);
 			kb->weights= NULL;
 		}
 	}
 
-	for(it=m_Polygons.begin(); it!=m_Polygons.end(); it++)
+	for (it=m_Polygons.begin(); it!=m_Polygons.end(); it++)
 		delete (*it);
 
 	m_sharedvertex_map.clear();
@@ -165,7 +165,7 @@ const STR_String& RAS_MeshObject::GetMaterialName(unsigned int matid)
 { 
 	RAS_MeshMaterial* mmat = GetMeshMaterial(matid);
 
-	if(mmat)
+	if (mmat)
 		return mmat->m_bucket->GetPolyMaterial()->GetMaterialName();
 	
 	return s_emptyname;
@@ -234,7 +234,7 @@ const STR_String& RAS_MeshObject::GetTextureName(unsigned int matid)
 { 
 	RAS_MeshMaterial* mmat = GetMeshMaterial(matid);
 	
-	if(mmat)
+	if (mmat)
 		return mmat->m_bucket->GetPolyMaterial()->GetTextureName();
 
 	return s_emptyname;
@@ -245,8 +245,8 @@ RAS_MeshMaterial *RAS_MeshObject::GetMeshMaterial(RAS_IPolyMaterial *mat)
 	list<RAS_MeshMaterial>::iterator mit;
 
 	/* find a mesh material */
-	for(mit = m_materials.begin(); mit != m_materials.end(); mit++)
-		if(mit->m_bucket->GetPolyMaterial() == mat)
+	for (mit = m_materials.begin(); mit != m_materials.end(); mit++)
+		if (mit->m_bucket->GetPolyMaterial() == mat)
 			return &*mit;
 
 	return NULL;
@@ -258,8 +258,8 @@ int RAS_MeshObject::GetMaterialId(RAS_IPolyMaterial *mat)
 	int imat;
 
 	/* find a mesh material */
-	for(imat=0, mit = m_materials.begin(); mit != m_materials.end(); mit++, imat++)
-		if(mit->m_bucket->GetPolyMaterial() == mat)
+	for (imat=0, mit = m_materials.begin(); mit != m_materials.end(); mit++, imat++)
+		if (mit->m_bucket->GetPolyMaterial() == mat)
 			return imat;
 
 	return -1;
@@ -275,7 +275,7 @@ RAS_Polygon* RAS_MeshObject::AddPolygon(RAS_MaterialBucket *bucket, int numverts
 	mmat = GetMeshMaterial(bucket->GetPolyMaterial());
 
 	/* none found, create a new one */
-	if(!mmat) {
+	if (!mmat) {
 		RAS_MeshMaterial meshmat;
 		meshmat.m_bucket = bucket;
 		meshmat.m_baseslot = meshmat.m_bucket->AddMesh(numverts);
@@ -317,8 +317,8 @@ void RAS_MeshObject::SetVertexColor(RAS_IPolyMaterial* mat,MT_Vector4 rgba)
 	RAS_MeshSlot::iterator it;
 	size_t i;
 
-	for(slot->begin(it); !slot->end(it); slot->next(it))
-		for(i=it.startvertex; i<it.endvertex; i++)
+	for (slot->begin(it); !slot->end(it); slot->next(it))
+		for (i=it.startvertex; i<it.endvertex; i++)
 			it.vertex[i].SetRGBA(rgba);
 }
 
@@ -349,15 +349,15 @@ void RAS_MeshObject::AddVertex(RAS_Polygon *poly, int i,
 		vector<SharedVertex>& sharedmap = m_sharedvertex_map[origindex];
 		vector<SharedVertex>::iterator it;
 
-		for(it = sharedmap.begin(); it != sharedmap.end(); it++)
+		for (it = sharedmap.begin(); it != sharedmap.end(); it++)
 		{
-			if(it->m_darray != darray)
+			if (it->m_darray != darray)
 				continue;
-			if(!it->m_darray->m_vertex[it->m_offset].closeTo(&texvert))
+			if (!it->m_darray->m_vertex[it->m_offset].closeTo(&texvert))
 				continue;
 
 			/* found one, add it and we're done */
-			if(poly->IsVisible())
+			if (poly->IsVisible())
 				slot->AddPolygonVertex(it->m_offset);
 			poly->SetVertexOffset(i, it->m_offset);
 			return;
@@ -366,7 +366,7 @@ void RAS_MeshObject::AddVertex(RAS_Polygon *poly, int i,
 
 	/* no shared vertex found, add a new one */
 	offset = slot->AddVertex(texvert);
-	if(poly->IsVisible())
+	if (poly->IsVisible())
 		slot->AddPolygonVertex(offset);
 	poly->SetVertexOffset(i, offset);
 
@@ -387,7 +387,7 @@ int RAS_MeshObject::NumVertices(RAS_IPolyMaterial* mat)
 
 	mmat = GetMeshMaterial(mat);
 	slot = mmat->m_baseslot;
-	for(slot->begin(it); !slot->end(it); slot->next(it))
+	for (slot->begin(it); !slot->end(it); slot->next(it))
 		len += it.endvertex - it.startvertex;
 	
 	return len;
@@ -404,13 +404,13 @@ RAS_TexVert* RAS_MeshObject::GetVertex(unsigned int matid,
 
 	mmat = GetMeshMaterial(matid);
 
-	if(!mmat)
+	if (!mmat)
 		return NULL;
 	
 	slot = mmat->m_baseslot;
 	len = 0;
-	for(slot->begin(it); !slot->end(it); slot->next(it)) {
-		if(index >= len + it.endvertex - it.startvertex)
+	for (slot->begin(it); !slot->end(it); slot->next(it)) {
+		if (index >= len + it.endvertex - it.startvertex)
 			len += it.endvertex - it.startvertex;
 		else
 			return &it.vertex[index - len];
@@ -431,7 +431,7 @@ void RAS_MeshObject::AddMeshUser(void *clientobj, SG_QList *head, RAS_Deformer*
 	list<RAS_MeshMaterial>::iterator it;
 	list<RAS_MeshMaterial>::iterator mit;
 
-	for(it = m_materials.begin();it!=m_materials.end();++it) {
+	for (it = m_materials.begin();it!=m_materials.end();++it) {
 		/* always copy from the base slot, which is never removed 
 		 * since new objects can be created with the same mesh data */
 		if (deformer && !deformer->UseVertexArray())
@@ -444,7 +444,7 @@ void RAS_MeshObject::AddMeshUser(void *clientobj, SG_QList *head, RAS_Deformer*
 			RAS_IPolyMaterial* curmat = it->m_bucket->GetPolyMaterial();
 			if (curmat->GetFlag() & RAS_BLENDERGLSL) 
 			{
-				for(mit = m_materials.begin(); mit != it; ++mit)
+				for (mit = m_materials.begin(); mit != it; ++mit)
 				{
 					RAS_IPolyMaterial* mat = mit->m_bucket->GetPolyMaterial();
 					if ((mat->GetFlag() & RAS_BLENDERGLSL) && 
@@ -468,10 +468,10 @@ void RAS_MeshObject::RemoveFromBuckets(void *clientobj)
 {
 	list<RAS_MeshMaterial>::iterator it;
 	
-	for(it = m_materials.begin();it!=m_materials.end();++it) {
+	for (it = m_materials.begin();it!=m_materials.end();++it) {
 		RAS_MeshSlot **msp = it->m_slots[clientobj];
 
-		if(!msp)
+		if (!msp)
 			continue;
 
 		RAS_MeshSlot *ms = *msp;
@@ -523,13 +523,13 @@ void RAS_MeshObject::SortPolygons(RAS_MeshSlot& ms, const MT_Transform &transfor
 	RAS_MeshSlot::iterator it;
 	size_t j;
 
-	for(ms.begin(it); !ms.end(it); ms.next(it)) {
+	for (ms.begin(it); !ms.end(it); ms.next(it)) {
 		unsigned int nvert = (int)it.array->m_type;
 		unsigned int totpoly = it.totindex/nvert;
 
-		if(totpoly <= 1)
+		if (totpoly <= 1)
 			continue;
-		if(it.array->m_type == RAS_DisplayArray::LINE)
+		if (it.array->m_type == RAS_DisplayArray::LINE)
 			continue;
 
 		// Extract camera Z plane...
@@ -539,14 +539,14 @@ void RAS_MeshObject::SortPolygons(RAS_MeshSlot& ms, const MT_Transform &transfor
 		vector<polygonSlot> slots(totpoly);
 
 		/* get indices and z into temporary array */
-		for(j=0; j<totpoly; j++)
+		for (j=0; j<totpoly; j++)
 			slots[j].get(it.vertex, it.index, j*nvert, nvert, pnorm);
 
 		/* sort (stable_sort might be better, if flickering happens?) */
 		std::sort(slots.begin(), slots.end(), backtofront());
 
 		/* get indices from temporary array again */
-		for(j=0; j<totpoly; j++)
+		for (j=0; j<totpoly; j++)
 			slots[j].set(it.index, j*nvert, nvert);
 	}
 }
@@ -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= (KeyBlock*)kb->next, kbindex++)
 	{
 		// first check the cases where the weight must be cleared
 		if (kb->vgroup[0] == 0 ||
diff --git a/source/gameengine/Rasterizer/RAS_MeshObject.h b/source/gameengine/Rasterizer/RAS_MeshObject.h
index 982ce48..b3e84c4 100644
--- a/source/gameengine/Rasterizer/RAS_MeshObject.h
+++ b/source/gameengine/Rasterizer/RAS_MeshObject.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerast
  */
 
-#ifndef __RAS_MESHOBJECT
-#define __RAS_MESHOBJECT
+#ifndef __RAS_MESHOBJECT_H__
+#define __RAS_MESHOBJECT_H__
 
 #if defined(WIN32) && !defined(FREE_WINDOWS)
 // disable the STL warnings ("debug information length > 255")
@@ -179,5 +179,5 @@ public:
 #endif
 };
 
-#endif //__RAS_MESHOBJECT
+#endif //__RAS_MESHOBJECT_H__
 
diff --git a/source/gameengine/Rasterizer/RAS_ObjectColor.h b/source/gameengine/Rasterizer/RAS_ObjectColor.h
index ad2002e..f8fbe69 100644
--- a/source/gameengine/Rasterizer/RAS_ObjectColor.h
+++ b/source/gameengine/Rasterizer/RAS_ObjectColor.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerast
  */
 
-#ifndef __RAS_OBJECTCOLOR_H
-#define __RAS_OBJECTCOLOR_H
+#ifndef __RAS_OBJECTCOLOR_H__
+#define __RAS_OBJECTCOLOR_H__
 
 struct	RAS_ObjectColor {
 	float	m_red;
@@ -38,5 +38,5 @@ struct	RAS_ObjectColor {
 	float	m_blue;
 };
 
-#endif //__RAS_OBJECTCOLOR_H
+#endif //__RAS_OBJECTCOLOR_H__
 
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Blur2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Blur2DFilter.h
index 3a3ea57..c2595fb 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Blur2DFilter.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Blur2DFilter.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerastoglfilters
  */
 
-#ifndef __RAS_BLUR2DFILTER
-#define __RAS_BLUR2DFILTER
+#ifndef __RAS_BLUR2DFILTER_H__
+#define __RAS_BLUR2DFILTER_H__
 
 const char * BlurFragmentShader=STRINGIFY(
 uniform sampler2D bgl_RenderedTexture;
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Dilation2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Dilation2DFilter.h
index f486be4..12b815a 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Dilation2DFilter.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Dilation2DFilter.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerastoglfilters
  */
 
-#ifndef __RAS_DILATION2DFILTER
-#define __RAS_DILATION2DFILTER
+#ifndef __RAS_DILATION2DFILTER_H__
+#define __RAS_DILATION2DFILTER_H__
 
 const char * DilationFragmentShader=STRINGIFY(
 uniform sampler2D bgl_RenderedTexture;
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Erosion2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Erosion2DFilter.h
index a1755dc..6319be6 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Erosion2DFilter.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Erosion2DFilter.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerastoglfilters
  */
 
-#ifndef __RAS_EROSION2DFILTER
-#define __RAS_EROSION2DFILTER
+#ifndef __RAS_EROSION2DFILTER_H__
+#define __RAS_EROSION2DFILTER_H__
 
 const char * ErosionFragmentShader=STRINGIFY(
             uniform sampler2D bgl_RenderedTexture;
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h
index baf3d9c..f3c3aec 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_GrayScale2DFilter.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerastoglfilters
  */
 
-#ifndef __RAS_GRAYSCALE2DFILTER
-#define __RAS_GRAYSCALE2DFILTER
+#ifndef __RAS_GRAYSCALE2DFILTER_H__
+#define __RAS_GRAYSCALE2DFILTER_H__
 
 const char * GrayScaleFragmentShader=STRINGIFY(
 uniform sampler2D bgl_RenderedTexture;
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Invert2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Invert2DFilter.h
index 7df271c..c04d954 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Invert2DFilter.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Invert2DFilter.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerastoglfilters
  */
 
-#ifndef __RAS_INVERT2DFILTER
-#define __RAS_INVERT2DFILTER
+#ifndef __RAS_INVERT2DFILTER_H__
+#define __RAS_INVERT2DFILTER_H__
 
 const char * InvertFragmentShader=STRINGIFY(
 uniform sampler2D bgl_RenderedTexture;
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Laplacian2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Laplacian2DFilter.h
index 45c94d3..47f7d80 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Laplacian2DFilter.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Laplacian2DFilter.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerastoglfilters
  */
 
-#ifndef __RAS_LAPLACION2DFILTER
-#define __RAS_LAPLACION2DFILTER
+#ifndef __RAS_LAPLACIAN2DFILTER_H__
+#define __RAS_LAPLACIAN2DFILTER_H__
 
 const char * LaplacionFragmentShader=STRINGIFY(
 uniform sampler2D bgl_RenderedTexture;
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Prewitt2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Prewitt2DFilter.h
index 8d08d90..8b2fdc7 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Prewitt2DFilter.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Prewitt2DFilter.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerastoglfilters
  */
 
-#ifndef __RAS_PREWITT2DFILTER
-#define __RAS_PREWITT2DFILTER
+#ifndef __RAS_PREWITT2DFILTER_H__
+#define __RAS_PREWITT2DFILTER_H__
 
 const char * PrewittFragmentShader=STRINGIFY(
 uniform sampler2D bgl_RenderedTexture;
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sepia2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sepia2DFilter.h
index 5c1c18c..b38d14a 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sepia2DFilter.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sepia2DFilter.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerastoglfilters
  */
 
-#ifndef __RAS_SEPIA2DFILTER
-#define __RAS_SEPIA2DFILTER
+#ifndef __RAS_SEPIA2DFILTER_H__
+#define __RAS_SEPIA2DFILTER_H__
 
 const char * SepiaFragmentShader=STRINGIFY(
 uniform sampler2D bgl_RenderedTexture;
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sharpen2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sharpen2DFilter.h
index a9c827f..2e0edae 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sharpen2DFilter.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sharpen2DFilter.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerastoglfilters
  */
 
-#ifndef __RAS_SHARPEN2DFILTER
-#define __RAS_SHARPEN2DFILTER
+#ifndef __RAS_SHARPEN2DFILTER_H__
+#define __RAS_SHARPEN2DFILTER_H__
 
 const char * SharpenFragmentShader=STRINGIFY(
 uniform sampler2D bgl_RenderedTexture;
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sobel2DFilter.h b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sobel2DFilter.h
index 350ce19..ba30e49 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sobel2DFilter.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Sobel2DFilter.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerastoglfilters
  */
 
-#ifndef __RAS_SOBEL2DFILTER
-#define __RAS_SOBEL2DFILTER
+#ifndef __RAS_SOBEL2DFILTER_H__
+#define __RAS_SOBEL2DFILTER_H__
 
 const char * SobelFragmentShader=STRINGIFY(
 uniform sampler2D bgl_RenderedTexture;
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp
index e1fff5f..6650539 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp
@@ -40,29 +40,29 @@ namespace bgl
 	{
 		static bool firsttime = true;
 		
-		if(firsttime) {
+		if (firsttime) {
 			firsttime = false;
 
-			if(debug) {
-				if(GLEW_ATI_pn_triangles)
+			if (debug) {
+				if (GLEW_ATI_pn_triangles)
 					std::cout << "Enabled GL_ATI_pn_triangles" << std::endl;
-				if(GLEW_ARB_texture_env_combine)
+				if (GLEW_ARB_texture_env_combine)
 					std::cout << "Detected GL_ARB_texture_env_combine" << std::endl;
-				if(GLEW_ARB_texture_cube_map)
+				if (GLEW_ARB_texture_cube_map)
 					std::cout << "Detected GL_ARB_texture_cube_map" << std::endl;
-				if(GLEW_ARB_multitexture)
+				if (GLEW_ARB_multitexture)
 					std::cout << "Detected GL_ARB_multitexture" << std::endl;
-				if(GLEW_ARB_shader_objects)
+				if (GLEW_ARB_shader_objects)
 					std::cout << "Detected GL_ARB_shader_objects" << std::endl;
-				if(GLEW_ARB_vertex_shader)
+				if (GLEW_ARB_vertex_shader)
 					std::cout << "Detected GL_ARB_vertex_shader" << std::endl;
-				if(GLEW_ARB_fragment_shader)
+				if (GLEW_ARB_fragment_shader)
 					std::cout << "Detected GL_ARB_fragment_shader" << std::endl;
-				if(GLEW_ARB_vertex_program)
+				if (GLEW_ARB_vertex_program)
 					std::cout << "Detected GL_ARB_vertex_program" << std::endl;
-				if(GLEW_ARB_depth_texture)
+				if (GLEW_ARB_depth_texture)
 					std::cout << "Detected GL_ARB_depth_texture" << std::endl;
-				if(GLEW_EXT_separate_specular_color)
+				if (GLEW_EXT_separate_specular_color)
 					std::cout << "Detected GL_EXT_separate_specular_color" << std::endl;
 			}
 		}
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
index e5ca40c..1f411a0 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
@@ -50,7 +50,7 @@ RAS_ListSlot::~RAS_ListSlot()
 
 void RAS_ListSlot::RemoveList()
 {
-	if(m_list != 0) {
+	if (m_list != 0) {
 		spit("Releasing display list (" << m_list << ")");
 		glDeleteLists((GLuint)m_list, 1);
 		m_list =0;
@@ -59,19 +59,19 @@ void RAS_ListSlot::RemoveList()
 
 void RAS_ListSlot::DrawList()
 {
-	if(m_flag &LIST_STREAM || m_flag& LIST_NOCREATE) {
+	if (m_flag &LIST_STREAM || m_flag& LIST_NOCREATE) {
 		RemoveList();
 		return;
 	}
-	if(m_flag &LIST_MODIFY) {
-		if(m_flag &LIST_CREATE) {
-			if(m_list == 0) {
+	if (m_flag &LIST_MODIFY) {
+		if (m_flag &LIST_CREATE) {
+			if (m_list == 0) {
 				m_list = (unsigned int)glGenLists(1);
 				m_flag =  m_flag &~ LIST_CREATE;
 				spit("Created display list (" << m_list << ")");
 			}
 		}
-		if(m_list != 0)
+		if (m_list != 0)
 			glNewList((GLuint)m_list, GL_COMPILE);
 	
 		m_flag |= LIST_BEGIN;
@@ -82,7 +82,7 @@ void RAS_ListSlot::DrawList()
 
 void RAS_ListSlot::EndList()
 {
-	if(m_flag & LIST_BEGIN) {
+	if (m_flag & LIST_BEGIN) {
 		glEndList();
 		m_flag = m_flag &~(LIST_BEGIN|LIST_MODIFY);
 		m_flag |= LIST_END;
@@ -92,7 +92,7 @@ void RAS_ListSlot::EndList()
 
 void RAS_ListSlot::SetModified(bool mod)
 {
-	if(mod && !(m_flag & LIST_MODIFY)) {
+	if (mod && !(m_flag & LIST_MODIFY)) {
 		spit("Modifying list (" << m_list << ")");
 		m_flag = m_flag &~ LIST_END;
 		m_flag |= LIST_STREAM;
@@ -158,13 +158,13 @@ void RAS_ListRasterizer::RemoveListSlot(RAS_ListSlot* list)
 RAS_ListSlot* RAS_ListRasterizer::FindOrAdd(RAS_MeshSlot& ms)
 {
 	/*
-	 Keep a copy of constant lists submitted for rendering,
-		this guards against (replicated)new...delete every frame,
-		and we can reuse lists!
-		:: sorted by mesh slot
-	*/
+	 * Keep a copy of constant lists submitted for rendering,
+	 * this guards against (replicated)new...delete every frame,
+	 * and we can reuse lists!
+	 * :: sorted by mesh slot
+	 */
 	RAS_ListSlot* localSlot = (RAS_ListSlot*)ms.m_DisplayList;
-	if(!localSlot) {
+	if (!localSlot) {
 		if (ms.m_pDerivedMesh) {
 			// that means that we draw based on derived mesh, a display list is possible
 			// Note that we come here only for static derived mesh
@@ -172,7 +172,7 @@ RAS_ListSlot* RAS_ListRasterizer::FindOrAdd(RAS_MeshSlot& ms)
 			RAS_ListSlot* nullSlot = NULL;
 			RAS_ListSlots *listVector;
 			RAS_DerivedMeshLists::iterator it = mDerivedMeshLists.find(ms.m_pDerivedMesh);
-			if(it == mDerivedMeshLists.end()) {
+			if (it == mDerivedMeshLists.end()) {
 				listVector = new RAS_ListSlots(matnr+4, nullSlot);
 				localSlot = new RAS_ListSlot(this);
 				localSlot->m_flag |= LIST_DERIVEDMESH;
@@ -194,7 +194,7 @@ RAS_ListSlot* RAS_ListRasterizer::FindOrAdd(RAS_MeshSlot& ms)
 			}
 		} else {
 			RAS_ArrayLists::iterator it = mArrayLists.find(ms.m_displayArrays);
-			if(it == mArrayLists.end()) {
+			if (it == mArrayLists.end()) {
 				localSlot = new RAS_ListSlot(this);
 				mArrayLists.insert(std::pair<RAS_DisplayArrayList, RAS_ListSlot*>(ms.m_displayArrays, localSlot));
 			} else {
@@ -208,7 +208,7 @@ RAS_ListSlot* RAS_ListRasterizer::FindOrAdd(RAS_MeshSlot& ms)
 
 void RAS_ListRasterizer::ReleaseAlloc()
 {
-	for(RAS_ArrayLists::iterator it = mArrayLists.begin();it != mArrayLists.end();++it)
+	for (RAS_ArrayLists::iterator it = mArrayLists.begin();it != mArrayLists.end();++it)
 		delete it->second;
 	mArrayLists.clear();
 	for (RAS_DerivedMeshLists::iterator it = mDerivedMeshLists.begin();it != mDerivedMeshLists.end();++it) {
@@ -228,10 +228,10 @@ void RAS_ListRasterizer::IndexPrimitives(RAS_MeshSlot& ms)
 {
 	RAS_ListSlot* localSlot =0;
 
-	if(ms.m_bDisplayList) {
+	if (ms.m_bDisplayList) {
 		localSlot = FindOrAdd(ms);
 		localSlot->DrawList();
-		if(localSlot->End()) {
+		if (localSlot->End()) {
 			// save slot here too, needed for replicas and object using same mesh
 			// => they have the same vertexarray but different mesh slot
 			ms.m_DisplayList = localSlot;
@@ -244,7 +244,7 @@ void RAS_ListRasterizer::IndexPrimitives(RAS_MeshSlot& ms)
 	else
 		RAS_OpenGLRasterizer::IndexPrimitives(ms);
 
-	if(ms.m_bDisplayList) {
+	if (ms.m_bDisplayList) {
 		localSlot->EndList();
 		ms.m_DisplayList = localSlot;
 	}
@@ -255,11 +255,11 @@ void RAS_ListRasterizer::IndexPrimitivesMulti(RAS_MeshSlot& ms)
 {
 	RAS_ListSlot* localSlot =0;
 
-	if(ms.m_bDisplayList) {
+	if (ms.m_bDisplayList) {
 		localSlot = FindOrAdd(ms);
 		localSlot->DrawList();
 
-		if(localSlot->End()) {
+		if (localSlot->End()) {
 			// save slot here too, needed for replicas and object using same mesh
 			// => they have the same vertexarray but different mesh slot
 			ms.m_DisplayList = localSlot;
@@ -275,7 +275,7 @@ void RAS_ListRasterizer::IndexPrimitivesMulti(RAS_MeshSlot& ms)
 	else
 		RAS_OpenGLRasterizer::IndexPrimitivesMulti(ms);
 
-	if(ms.m_bDisplayList) {
+	if (ms.m_bDisplayList) {
 		localSlot->EndList();
 		ms.m_DisplayList = localSlot;
 	}
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
index f5787da..7db433b 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
@@ -323,7 +323,7 @@ void RAS_OpenGLRasterizer::SetDrawingMode(int drawingmode)
 {
 	m_drawingmode = drawingmode;
 
-	if(m_drawingmode == KX_WIREFRAME)
+	if (m_drawingmode == KX_WIREFRAME)
 		glDisable(GL_CULL_FACE);
 }
 
@@ -359,7 +359,7 @@ void RAS_OpenGLRasterizer::ClearCachingInfo(void)
 
 void RAS_OpenGLRasterizer::FlushDebugShapes()
 {
-	if(!m_debugShapes.size())
+	if (!m_debugShapes.size())
 		return;
 
 	// DrawDebugLines
@@ -368,8 +368,8 @@ void RAS_OpenGLRasterizer::FlushDebugShapes()
 	light= glIsEnabled(GL_LIGHTING);
 	tex= glIsEnabled(GL_TEXTURE_2D);
 
-	if(light) glDisable(GL_LIGHTING);
-	if(tex) glDisable(GL_TEXTURE_2D);
+	if (light) glDisable(GL_LIGHTING);
+	if (tex) glDisable(GL_TEXTURE_2D);
 
 	//draw lines
 	glBegin(GL_LINES);
@@ -393,7 +393,7 @@ void RAS_OpenGLRasterizer::FlushDebugShapes()
 		glBegin(GL_LINE_LOOP);
 		glColor4f(m_debugShapes[i].m_color[0],m_debugShapes[i].m_color[1],m_debugShapes[i].m_color[2],1.f);
 
-		static const MT_Vector3 worldUp(0.,0.,1.);
+		static const MT_Vector3 worldUp(0.0, 0.0, 1.0);
 		MT_Vector3 norm = m_debugShapes[i].m_param;
 		MT_Matrix3x3 tr;
 		if (norm.fuzzyZero() || norm == worldUp)
@@ -414,7 +414,7 @@ void RAS_OpenGLRasterizer::FlushDebugShapes()
 		for (int j = 0; j<n; j++)
 		{
 			MT_Scalar theta = j*M_PI*2/n;
-			MT_Vector3 pos(cos(theta)*rad, sin(theta)*rad, 0.);
+			MT_Vector3 pos(cos(theta) * rad, sin(theta) * rad, 0.0);
 			pos = pos*tr;
 			pos += m_debugShapes[i].m_pos;
 			const MT_Scalar* posPtr = &pos.x();
@@ -423,8 +423,8 @@ void RAS_OpenGLRasterizer::FlushDebugShapes()
 		glEnd();
 	}
 
-	if(light) glEnable(GL_LIGHTING);
-	if(tex) glEnable(GL_TEXTURE_2D);
+	if (light) glEnable(GL_LIGHTING);
+	if (tex) glEnable(GL_TEXTURE_2D);
 
 	m_debugShapes.clear();
 }
@@ -513,7 +513,7 @@ RAS_IRasterizer::StereoMode RAS_OpenGLRasterizer::GetStereoMode()
 
 bool RAS_OpenGLRasterizer::Stereo()
 {
-	if(m_stereomode > RAS_STEREO_NOSTEREO) // > 0
+	if (m_stereomode > RAS_STEREO_NOSTEREO) // > 0
 		return true;
 	else
 		return false;
@@ -624,17 +624,17 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(RAS_MeshSlot& ms,
 	else
 		glEnableClientState(GL_COLOR_ARRAY);
 
-	for(ms.begin(it); !ms.end(it); ms.next(it)) {
+	for (ms.begin(it); !ms.end(it); ms.next(it)) {
 		RAS_TexVert *vertex;
 		size_t i, j, numvert;
 		
 		numvert = it.array->m_type;
 
-		if(it.array->m_type == RAS_DisplayArray::LINE) {
+		if (it.array->m_type == RAS_DisplayArray::LINE) {
 			// line drawing, no text
 			glBegin(GL_LINES);
 
-			for(i=0; i<it.totindex; i+=2)
+			for (i=0; i<it.totindex; i+=2)
 			{
 				vertex = &it.vertex[it.index[i]];
 				glVertex3fv(vertex->getXYZ());
@@ -647,12 +647,12 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(RAS_MeshSlot& ms,
 		}
 		else {
 			// triangle and quad text drawing
-			for(i=0; i<it.totindex; i+=numvert)
+			for (i=0; i<it.totindex; i+=numvert)
 			{
 				float v[4][3];
 				int glattrib, unit;
 
-				for(j=0; j<numvert; j++) {
+				for (j=0; j<numvert; j++) {
 					vertex = &it.vertex[it.index[i+j]];
 
 					v[j][0] = vertex->getXYZ()[0];
@@ -662,9 +662,9 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(RAS_MeshSlot& ms,
 
 				// find the right opengl attribute
 				glattrib = -1;
-				if(GLEW_ARB_vertex_program)
-					for(unit=0; unit<m_attrib_num; unit++)
-						if(m_attrib[unit] == RAS_TEXCO_UV1)
+				if (GLEW_ARB_vertex_program)
+					for (unit=0; unit<m_attrib_num; unit++)
+						if (m_attrib[unit] == RAS_TEXCO_UV1)
 							glattrib = unit;
 				
 				rendertools->RenderText(polymat->GetDrawingMode(), polymat,
@@ -681,28 +681,28 @@ void RAS_OpenGLRasterizer::IndexPrimitives_3DText(RAS_MeshSlot& ms,
 void RAS_OpenGLRasterizer::SetTexCoordNum(int num)
 {
 	m_texco_num = num;
-	if(m_texco_num > RAS_MAX_TEXCO)
+	if (m_texco_num > RAS_MAX_TEXCO)
 		m_texco_num = RAS_MAX_TEXCO;
 }
 
 void RAS_OpenGLRasterizer::SetAttribNum(int num)
 {
 	m_attrib_num = num;
-	if(m_attrib_num > RAS_MAX_ATTRIB)
+	if (m_attrib_num > RAS_MAX_ATTRIB)
 		m_attrib_num = RAS_MAX_ATTRIB;
 }
 
 void RAS_OpenGLRasterizer::SetTexCoord(TexCoGen coords, int unit)
 {
 	// this changes from material to material
-	if(unit < RAS_MAX_TEXCO)
+	if (unit < RAS_MAX_TEXCO)
 		m_texco[unit] = coords;
 }
 
 void RAS_OpenGLRasterizer::SetAttrib(TexCoGen coords, int unit)
 {
 	// this changes from material to material
-	if(unit < RAS_MAX_ATTRIB)
+	if (unit < RAS_MAX_ATTRIB)
 		m_attrib[unit] = coords;
 }
 
@@ -710,9 +710,9 @@ void RAS_OpenGLRasterizer::TexCoord(const RAS_TexVert &tv)
 {
 	int unit;
 
-	if(GLEW_ARB_multitexture) {
-		for(unit=0; unit<m_texco_num; unit++) {
-			if(tv.getFlag() & RAS_TexVert::SECOND_UV && (int)tv.getUnit() == unit) {
+	if (GLEW_ARB_multitexture) {
+		for (unit=0; unit<m_texco_num; unit++) {
+			if (tv.getFlag() & RAS_TexVert::SECOND_UV && (int)tv.getUnit() == unit) {
 				glMultiTexCoord2fvARB(GL_TEXTURE0_ARB+unit, tv.getUV2());
 				continue;
 			}
@@ -739,8 +739,8 @@ void RAS_OpenGLRasterizer::TexCoord(const RAS_TexVert &tv)
 		}
 	}
 
-	if(GLEW_ARB_vertex_program) {
-		for(unit=0; unit<m_attrib_num; unit++) {
+	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:
@@ -828,7 +828,7 @@ static int CheckTexfaceDM(void *mcol, int index)
 }
 */
 
-static int CheckTexDM(MTFace *tface, int has_mcol, int matnr)
+static DMDrawOption CheckTexDM(MTFace *tface, int has_mcol, int matnr)
 {
 
 	// index is the original face index, retrieve the polygon
@@ -836,23 +836,23 @@ static int CheckTexDM(MTFace *tface, int has_mcol, int matnr)
 		(tface == NULL || tface->tpage == current_image)) {
 		// must handle color.
 		if (current_wireframe)
-			return 2;
+			return DM_DRAW_OPTION_NO_MCOL;
 		if (current_ms->m_bObjectColor) {
 			MT_Vector4& rgba = current_ms->m_RGBAcolor;
 			glColor4d(rgba[0], rgba[1], rgba[2], rgba[3]);
 			// don't use mcol
-			return 2;
+			return DM_DRAW_OPTION_NO_MCOL;
 		}
 		if (!has_mcol) {
 			// we have to set the color from the material
 			unsigned char rgba[4];
 			current_polymat->GetMaterialRGBAColor(rgba);
 			glColor4ubv((const GLubyte *)rgba);
-			return 2;
+			return DM_DRAW_OPTION_NO_MCOL;
 		}
-		return 1;
+		return DM_DRAW_OPTION_NORMAL;
 	}
-	return 0;
+	return DM_DRAW_OPTION_SKIP;
 }
 
 void RAS_OpenGLRasterizer::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi)
@@ -901,17 +901,17 @@ void RAS_OpenGLRasterizer::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi)
 		return;
 	}
 	// iterate over display arrays, each containing an index + vertex array
-	for(ms.begin(it); !ms.end(it); ms.next(it)) {
+	for (ms.begin(it); !ms.end(it); ms.next(it)) {
 		RAS_TexVert *vertex;
 		size_t i, j, numvert;
 		
 		numvert = it.array->m_type;
 
-		if(it.array->m_type == RAS_DisplayArray::LINE) {
+		if (it.array->m_type == RAS_DisplayArray::LINE) {
 			// line drawing
 			glBegin(GL_LINES);
 
-			for(i=0; i<it.totindex; i+=2)
+			for (i=0; i<it.totindex; i+=2)
 			{
 				vertex = &it.vertex[it.index[i]];
 				glVertex3fv(vertex->getXYZ());
@@ -924,26 +924,26 @@ void RAS_OpenGLRasterizer::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi)
 		}
 		else {
 			// triangle and quad drawing
-			if(it.array->m_type == RAS_DisplayArray::TRIANGLE)
+			if (it.array->m_type == RAS_DisplayArray::TRIANGLE)
 				glBegin(GL_TRIANGLES);
 			else
 				glBegin(GL_QUADS);
 
-			for(i=0; i<it.totindex; i+=numvert)
+			for (i=0; i<it.totindex; i+=numvert)
 			{
-				if(obcolor)
+				if (obcolor)
 					glColor4d(rgba[0], rgba[1], rgba[2], rgba[3]);
 
-				for(j=0; j<numvert; j++) {
+				for (j=0; j<numvert; j++) {
 					vertex = &it.vertex[it.index[i+j]];
 
-					if(!wireframe) {
-						if(!obcolor)
+					if (!wireframe) {
+						if (!obcolor)
 							glColor4ubv((const GLubyte *)(vertex->getRGBA()));
 
 						glNormal3fv(vertex->getNormal());
 
-						if(multi)
+						if (multi)
 							TexCoord(*vertex);
 						else
 							glTexCoord2fv(vertex->getUV1());
@@ -988,12 +988,12 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix(
 	float frustfar,
 	float focallength,
 	bool 
-){
+) {
 	MT_Matrix4x4 result;
 	double mat[16];
 
 	// correction for stereo
-	if(Stereo())
+	if (Stereo())
 	{
 			float near_div_focallength;
 			float offset;
@@ -1037,7 +1037,7 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetOrthoMatrix(
 	float top,
 	float frustnear,
 	float frustfar
-){
+) {
 	MT_Matrix4x4 result;
 	double mat[16];
 
@@ -1062,7 +1062,7 @@ void RAS_OpenGLRasterizer::SetViewMatrix(const MT_Matrix4x4 &mat,
 	m_viewmatrix = mat;
 
 	// correction for stereo
-	if(Stereo() && perspective)
+	if (Stereo() && perspective)
 	{
 		MT_Vector3 unitViewDir(0.0, -1.0, 0.0);  // minus y direction, Blender convention
 		MT_Vector3 unitViewupVec(0.0, 0.0, 1.0);
@@ -1192,7 +1192,7 @@ void RAS_OpenGLRasterizer::EnableMotionBlur(float motionblurvalue)
 {
 	/* don't just set m_motionblur to 1, but check if it is 0 so
 	 * we don't reset a motion blur that is already enabled */
-	if(m_motionblur == 0)
+	if (m_motionblur == 0)
 		m_motionblur = 1;
 	m_motionblurvalue = motionblurvalue;
 }
@@ -1207,26 +1207,26 @@ void RAS_OpenGLRasterizer::SetAlphaBlend(int alphablend)
 {
 	GPU_set_material_alpha_blend(alphablend);
 /*
-	if(alphablend == m_last_alphablend)
+	if (alphablend == m_last_alphablend)
 		return;
 
-	if(alphablend == GPU_BLEND_SOLID) {
+	if (alphablend == GPU_BLEND_SOLID) {
 		glDisable(GL_BLEND);
 		glDisable(GL_ALPHA_TEST);
 		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 	}
-	else if(alphablend == GPU_BLEND_ADD) {
+	else if (alphablend == GPU_BLEND_ADD) {
 		glBlendFunc(GL_ONE, GL_ONE);
 		glEnable(GL_BLEND);
 		glDisable(GL_ALPHA_TEST);
 	}
-	else if(alphablend == GPU_BLEND_ALPHA) {
+	else if (alphablend == GPU_BLEND_ALPHA) {
 		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 		glEnable(GL_BLEND);
 		glEnable(GL_ALPHA_TEST);
 		glAlphaFunc(GL_GREATER, 0.0f);
 	}
-	else if(alphablend == GPU_BLEND_CLIP) {
+	else if (alphablend == GPU_BLEND_CLIP) {
 		glDisable(GL_BLEND); 
 		glEnable(GL_ALPHA_TEST);
 		glAlphaFunc(GL_GREATER, 0.5f);
@@ -1238,10 +1238,10 @@ void RAS_OpenGLRasterizer::SetAlphaBlend(int alphablend)
 
 void RAS_OpenGLRasterizer::SetFrontFace(bool ccw)
 {
-	if(m_last_frontface == ccw)
+	if (m_last_frontface == ccw)
 		return;
 
-	if(ccw)
+	if (ccw)
 		glFrontFace(GL_CCW);
 	else
 		glFrontFace(GL_CW);
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
index 48705c3..3b4a6c4 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerastogl
  */
 
-#ifndef __RAS_OPENGLRASTERIZER
-#define __RAS_OPENGLRASTERIZER
+#ifndef __RAS_OPENGLRASTERIZER_H__
+#define __RAS_OPENGLRASTERIZER_H__
 
 #if defined(WIN32) && !defined(FREE_WINDOWS)
 #pragma warning (disable:4786)
@@ -298,8 +298,8 @@ public:
 	
 	virtual void	EnableMotionBlur(float motionblurvalue);
 	virtual void	DisableMotionBlur();
-	virtual float	GetMotionBlurValue(){return m_motionblurvalue;};
-	virtual int		GetMotionBlurState(){return m_motionblur;};
+	virtual float	GetMotionBlurValue() { return m_motionblurvalue; }
+	virtual int		GetMotionBlurState() { return m_motionblur; }
 	virtual void	SetMotionBlurState(int newstate)
 	{
 		if(newstate<0) 
@@ -324,6 +324,6 @@ public:
 #endif
 };
 
-#endif //__RAS_OPENGLRASTERIZER
+#endif //__RAS_OPENGLRASTERIZER_H__
 
 
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp
index 06f3d12..ff24bd6 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.cpp
@@ -116,18 +116,18 @@ void RAS_VAOpenGLRasterizer::IndexPrimitives(RAS_MeshSlot& ms)
 		return;
 	}
 
-	if(!wireframe)
+	if (!wireframe)
 		glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 
 	// use glDrawElements to draw each vertexarray
-	for(ms.begin(it); !ms.end(it); ms.next(it)) {
-		if(it.totindex == 0)
+	for (ms.begin(it); !ms.end(it); ms.next(it)) {
+		if (it.totindex == 0)
 			continue;
 
 		// drawing mode
-		if(it.array->m_type == RAS_DisplayArray::TRIANGLE)
+		if (it.array->m_type == RAS_DisplayArray::TRIANGLE)
 			drawmode = GL_TRIANGLES;
-		else if(it.array->m_type == RAS_DisplayArray::QUAD)
+		else if (it.array->m_type == RAS_DisplayArray::QUAD)
 			drawmode = GL_QUADS;
 		else
 			drawmode = GL_LINES;
@@ -150,9 +150,9 @@ void RAS_VAOpenGLRasterizer::IndexPrimitives(RAS_MeshSlot& ms)
 
 		glVertexPointer(3, GL_FLOAT, stride, it.vertex->getXYZ());
 		glNormalPointer(GL_FLOAT, stride, it.vertex->getNormal());
-		if(!wireframe) {
+		if (!wireframe) {
 			glTexCoordPointer(2, GL_FLOAT, stride, it.vertex->getUV1());
-			if(glIsEnabled(GL_COLOR_ARRAY))
+			if (glIsEnabled(GL_COLOR_ARRAY))
 				glColorPointer(4, GL_UNSIGNED_BYTE, stride, it.vertex->getRGBA());
 		}
 
@@ -160,7 +160,7 @@ void RAS_VAOpenGLRasterizer::IndexPrimitives(RAS_MeshSlot& ms)
 		glDrawElements(drawmode, it.totindex, GL_UNSIGNED_SHORT, it.index);
 	}
 
-	if(!wireframe) {
+	if (!wireframe) {
 		glDisableClientState(GL_TEXTURE_COORD_ARRAY);
 		glDisableClientState(GL_COLOR_ARRAY);
 	}
@@ -179,18 +179,18 @@ void RAS_VAOpenGLRasterizer::IndexPrimitivesMulti(RAS_MeshSlot& ms)
 		return;
 	}
 
-	if(!wireframe)
+	if (!wireframe)
 		EnableTextures(true);
 
 	// use glDrawElements to draw each vertexarray
-	for(ms.begin(it); !ms.end(it); ms.next(it)) {
-		if(it.totindex == 0)
+	for (ms.begin(it); !ms.end(it); ms.next(it)) {
+		if (it.totindex == 0)
 			continue;
 
 		// drawing mode
-		if(it.array->m_type == RAS_DisplayArray::TRIANGLE)
+		if (it.array->m_type == RAS_DisplayArray::TRIANGLE)
 			drawmode = GL_TRIANGLES;
-		else if(it.array->m_type == RAS_DisplayArray::QUAD)
+		else if (it.array->m_type == RAS_DisplayArray::QUAD)
 			drawmode = GL_QUADS;
 		else
 			drawmode = GL_LINES;
@@ -213,9 +213,9 @@ void RAS_VAOpenGLRasterizer::IndexPrimitivesMulti(RAS_MeshSlot& ms)
 
 		glVertexPointer(3, GL_FLOAT, stride, it.vertex->getXYZ());
 		glNormalPointer(GL_FLOAT, stride, it.vertex->getNormal());
-		if(!wireframe) {
+		if (!wireframe) {
 			TexCoordPtr(it.vertex);
-			if(glIsEnabled(GL_COLOR_ARRAY))
+			if (glIsEnabled(GL_COLOR_ARRAY))
 				glColorPointer(4, GL_UNSIGNED_BYTE, stride, it.vertex->getRGBA());
 		}
 
@@ -223,7 +223,7 @@ void RAS_VAOpenGLRasterizer::IndexPrimitivesMulti(RAS_MeshSlot& ms)
 		glDrawElements(drawmode, it.totindex, GL_UNSIGNED_SHORT, it.index);
 	}
 
-	if(!wireframe) {
+	if (!wireframe) {
 		glDisableClientState(GL_COLOR_ARRAY);
 		EnableTextures(false);
 	}
@@ -236,12 +236,12 @@ void RAS_VAOpenGLRasterizer::TexCoordPtr(const RAS_TexVert *tv)
 	 * materials can still be used and cause crashes */
 	int unit;
 
-	if(GLEW_ARB_multitexture)
+	if (GLEW_ARB_multitexture)
 	{
-		for(unit=0; unit<m_texco_num; unit++)
+		for (unit=0; unit<m_texco_num; unit++)
 		{
 			glClientActiveTextureARB(GL_TEXTURE0_ARB+unit);
-			if(tv->getFlag() & RAS_TexVert::SECOND_UV && (int)tv->getUnit() == unit) {
+			if (tv->getFlag() & RAS_TexVert::SECOND_UV && (int)tv->getUnit() == unit) {
 				glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 				glTexCoordPointer(2, GL_FLOAT, sizeof(RAS_TexVert), tv->getUV2());
 				continue;
@@ -272,8 +272,8 @@ void RAS_VAOpenGLRasterizer::TexCoordPtr(const RAS_TexVert *tv)
 		glClientActiveTextureARB(GL_TEXTURE0_ARB);
 	}
 
-	if(GLEW_ARB_vertex_program) {
-		for(unit=0; unit<m_attrib_num; unit++) {
+	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:
@@ -308,7 +308,7 @@ void RAS_VAOpenGLRasterizer::EnableTextures(bool enable)
 
 	/* we cache last texcoords and attribs to ensure we disable the ones that
 	 * were actually last set */
-	if(enable) {
+	if (enable) {
 		texco = m_texco;
 		texco_num = m_texco_num;
 		attrib = m_attrib;
@@ -326,8 +326,8 @@ void RAS_VAOpenGLRasterizer::EnableTextures(bool enable)
 		attrib_num = m_last_attrib_num;
 	}
 
-	if(GLEW_ARB_multitexture) {
-		for(unit=0; unit<texco_num; unit++) {
+	if (GLEW_ARB_multitexture) {
+		for (unit=0; unit<texco_num; unit++) {
 			glClientActiveTextureARB(GL_TEXTURE0_ARB+unit);
 
 			switch(texco[unit])
@@ -338,7 +338,7 @@ void RAS_VAOpenGLRasterizer::EnableTextures(bool enable)
 			case RAS_TEXCO_NORM:
 			case RAS_TEXTANGENT:
 			case RAS_TEXCO_UV2:
-				if(enable) glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+				if (enable) glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 				else glDisableClientState(GL_TEXTURE_COORD_ARRAY);
 				break;
 			default:
@@ -350,14 +350,14 @@ void RAS_VAOpenGLRasterizer::EnableTextures(bool enable)
 		glClientActiveTextureARB(GL_TEXTURE0_ARB);
 	}
 	else {
-		if(texco_num) {
-			if(enable) glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+		if (texco_num) {
+			if (enable) glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 			else glDisableClientState(GL_TEXTURE_COORD_ARRAY);
 		}
 	}
 
-	if(GLEW_ARB_vertex_program) {
-		for(unit=0; unit<attrib_num; unit++) {
+	if (GLEW_ARB_vertex_program) {
+		for (unit=0; unit<attrib_num; unit++) {
 			switch(attrib[unit]) {
 			case RAS_TEXCO_ORCO:
 			case RAS_TEXCO_GLOB:
@@ -366,7 +366,7 @@ void RAS_VAOpenGLRasterizer::EnableTextures(bool enable)
 			case RAS_TEXTANGENT:
 			case RAS_TEXCO_UV2:
 			case RAS_TEXCO_VCOL:
-				if(enable) glEnableVertexAttribArrayARB(unit);
+				if (enable) glEnableVertexAttribArrayARB(unit);
 				else glDisableVertexAttribArrayARB(unit);
 				break;
 			default:
@@ -376,7 +376,7 @@ void RAS_VAOpenGLRasterizer::EnableTextures(bool enable)
 		}
 	}
 
-	if(!enable) {
+	if (!enable) {
 		m_last_texco_num = 0;
 		m_last_attrib_num = 0;
 	}
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h
index c0c6f5d..d96f390 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_VAOpenGLRasterizer.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerastogl
  */
 
-#ifndef __KX_VERTEXARRAYOPENGLRASTERIZER
-#define __KX_VERTEXARRAYOPENGLRASTERIZER
+#ifndef __RAS_VAOPENGLRASTERIZER_H__
+#define __RAS_VAOPENGLRASTERIZER_H__
 
 #include "RAS_OpenGLRasterizer.h"
 
@@ -69,5 +69,5 @@ public:
 #endif
 };
 
-#endif //__KX_VERTEXARRAYOPENGLRASTERIZER
+#endif //__RAS_VAOPENGLRASTERIZER_H__
 
diff --git a/source/gameengine/Rasterizer/RAS_Polygon.cpp b/source/gameengine/Rasterizer/RAS_Polygon.cpp
index 2f9c7c6..a6912c0 100644
--- a/source/gameengine/Rasterizer/RAS_Polygon.cpp
+++ b/source/gameengine/Rasterizer/RAS_Polygon.cpp
@@ -72,11 +72,11 @@ int RAS_Polygon::GetVertexOffsetAbs(RAS_MeshObject *mesh, int i)
 {
 	/* hack that only works because there can only ever be 2 different
 	 * GetDisplayArray's per mesh. if this uses a different display array to the first
-	 * then its incices are offset.
+	 * then its indices are offset.
 	 * if support for edges is added back this would need to be changed. */
 	RAS_DisplayArray* darray= mesh->GetPolygon(0)->GetDisplayArray();
 	
-	if(m_darray != darray)
+	if (m_darray != darray)
 		return m_offset[i] + darray->m_vertex.size();
 	
 	return m_offset[i];
@@ -101,7 +101,7 @@ bool RAS_Polygon::IsVisible()
 
 void RAS_Polygon::SetVisible(bool visible)
 {
-	if(visible) m_polyflags |= VISIBLE;
+	if (visible) m_polyflags |= VISIBLE;
 	else m_polyflags &= ~VISIBLE;
 }
 
@@ -112,7 +112,7 @@ bool RAS_Polygon::IsCollider()
 
 void RAS_Polygon::SetCollider(bool visible)
 {
-	if(visible) m_polyflags |= COLLIDER;
+	if (visible) m_polyflags |= COLLIDER;
 	else m_polyflags &= ~COLLIDER;
 }
 
@@ -123,7 +123,7 @@ bool RAS_Polygon::IsTwoside()
 
 void RAS_Polygon::SetTwoside(bool twoside)
 {
-	if(twoside) m_polyflags |= TWOSIDE;
+	if (twoside) m_polyflags |= TWOSIDE;
 	else m_polyflags &= ~TWOSIDE;
 }
 
diff --git a/source/gameengine/Rasterizer/RAS_Polygon.h b/source/gameengine/Rasterizer/RAS_Polygon.h
index 6e2d724..a3bd6b6 100644
--- a/source/gameengine/Rasterizer/RAS_Polygon.h
+++ b/source/gameengine/Rasterizer/RAS_Polygon.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerast
  */
 
-#ifndef __RAS_POLYGON
-#define __RAS_POLYGON
+#ifndef __RAS_POLYGON_H__
+#define __RAS_POLYGON_H__
 
 #include "RAS_TexVert.h"
 #include "RAS_MaterialBucket.h"
diff --git a/source/gameengine/Rasterizer/RAS_Rect.h b/source/gameengine/Rasterizer/RAS_Rect.h
index d307a1f..c845c2c 100644
--- a/source/gameengine/Rasterizer/RAS_Rect.h
+++ b/source/gameengine/Rasterizer/RAS_Rect.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerast
  */
 
-#ifndef _RAS_RECT
-#define _RAS_RECT
+#ifndef __RAS_RECT_H__
+#define __RAS_RECT_H__
 
 #ifdef WITH_CXX_GUARDEDALLOC
 #include "MEM_guardedalloc.h"
@@ -102,5 +102,5 @@ public:
 #endif
 };
 
-#endif // _RAS_RECT
+#endif // __RAS_RECT_H__
 
diff --git a/source/gameengine/Rasterizer/RAS_TexMatrix.h b/source/gameengine/Rasterizer/RAS_TexMatrix.h
index 125e859..44ae1b0 100644
--- a/source/gameengine/Rasterizer/RAS_TexMatrix.h
+++ b/source/gameengine/Rasterizer/RAS_TexMatrix.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerast
  */
 
-#ifndef __RASTEXMATRIX
-#define __RASTEXMATRIX
+#ifndef __RAS_TEXMATRIX_H__
+#define __RAS_TEXMATRIX_H__
 
 #include "MT_Matrix3x3.h"
 #include "MT_Point3.h"
@@ -39,5 +39,5 @@
 
 void RAS_CalcTexMatrix(RAS_TexVert p[3],MT_Point3& origin,MT_Vector3& udir,MT_Vector3& vdir);
 
-#endif //__RASTEXMATRIX
+#endif //__RAS_TEXMATRIX_H__
 
diff --git a/source/gameengine/Rasterizer/RAS_TexVert.cpp b/source/gameengine/Rasterizer/RAS_TexVert.cpp
index 1e8630c..f74aa24 100644
--- a/source/gameengine/Rasterizer/RAS_TexVert.cpp
+++ b/source/gameengine/Rasterizer/RAS_TexVert.cpp
@@ -123,14 +123,14 @@ bool RAS_TexVert::closeTo(const RAS_TexVert* other)
 {
 	return (
 		/* m_flag == other->m_flag && */
-		/* at the moment the face only stores the smooth/flat setting so dont bother comparing it */
+		/* at the moment the face only stores the smooth/flat setting so don't bother comparing it */
 		m_rgba == other->m_rgba &&
 		MT_fuzzyEqual(MT_Vector3(m_normal), MT_Vector3(other->m_normal)) &&
 		MT_fuzzyEqual(MT_Vector3(m_tangent), MT_Vector3(other->m_tangent)) &&
 		MT_fuzzyEqual(MT_Vector2(m_uv1), MT_Vector2(other->m_uv1)) &&
 		MT_fuzzyEqual(MT_Vector2(m_uv2), MT_Vector2(other->m_uv2)) /* &&
-		MT_fuzzyEqual(MT_Vector3(m_localxyz), MT_Vector3(other->m_localxyz))*/) ;
-	/* dont bother comparing m_localxyz since we know there from the same vert */
+		MT_fuzzyEqual(MT_Vector3(m_localxyz), MT_Vector3(other->m_localxyz))*/);
+	/* don't bother comparing m_localxyz since we know there from the same vert */
 }
 
 short RAS_TexVert::getFlag() const
diff --git a/source/gameengine/Rasterizer/RAS_TexVert.h b/source/gameengine/Rasterizer/RAS_TexVert.h
index 64ebb53..f76c6a6 100644
--- a/source/gameengine/Rasterizer/RAS_TexVert.h
+++ b/source/gameengine/Rasterizer/RAS_TexVert.h
@@ -29,8 +29,8 @@
  *  \ingroup bgerast
  */
 
-#ifndef __RAS_TEXVERT
-#define __RAS_TEXVERT
+#ifndef __RAS_TEXVERT_H__
+#define __RAS_TEXVERT_H__
 
 
 #include "MT_Point3.h"
@@ -149,5 +149,5 @@ public:
 #endif
 };
 
-#endif //__RAS_TEXVERT
+#endif //__RAS_TEXVERT_H__
 
diff --git a/source/gameengine/SceneGraph/SG_BBox.cpp b/source/gameengine/SceneGraph/SG_BBox.cpp
index b1e3a32..4b2fc54 100644
--- a/source/gameengine/SceneGraph/SG_BBox.cpp
+++ b/source/gameengine/SceneGraph/SG_BBox.cpp
@@ -37,8 +37,8 @@
  #include "SG_Node.h"
  
 SG_BBox::SG_BBox() :
-	m_min(0., 0., 0.),
-	m_max(0., 0., 0.)
+	m_min(0.0, 0.0, 0.0),
+	m_max(0.0, 0.0, 0.0)
 {
 }
 
diff --git a/source/gameengine/SceneGraph/SG_BBox.h b/source/gameengine/SceneGraph/SG_BBox.h
index 08c242b..33e29b8 100644
--- a/source/gameengine/SceneGraph/SG_BBox.h
+++ b/source/gameengine/SceneGraph/SG_BBox.h
@@ -81,7 +81,7 @@ public:
 	/**
 	 * Scales the bounding box about the optional point.
 	 */
-	void scale(const MT_Vector3 &size, const MT_Point3 &point = MT_Point3(0., 0., 0.));
+	void scale(const MT_Vector3 &size, const MT_Point3 &point = MT_Point3(0.0, 0.0, 0.0));
 #endif
 	SG_BBox transform(const MT_Transform &world) const;
 	/**
@@ -117,14 +117,14 @@ public:
 	/**
 	 * Get the eight points that define this bounding box.
 	 *
-	 * @param world a world transform to apply to the produced points bounding box.
+	 * \param world a world transform to apply to the produced points bounding box.
 	 */
 	void get(MT_Point3 *box, const MT_Transform &world) const;
 	/**
 	 * Get the eight points that define this axis aligned bounding box.
 	 * This differs from SG_BBox::get() in that the produced box will be world axis aligned.
 	 * The maximum & minimum local points will be transformed *before* splitting to 8 points.
-	 * @param world a world transform to be applied.
+	 * \param world a world transform to be applied.
 	 */
 	void getaa(MT_Point3 *box, const MT_Transform &world) const;
 	
diff --git a/source/gameengine/SceneGraph/SG_Controller.cpp b/source/gameengine/SceneGraph/SG_Controller.cpp
index 5299c86..2649424 100644
--- a/source/gameengine/SceneGraph/SG_Controller.cpp
+++ b/source/gameengine/SceneGraph/SG_Controller.cpp
@@ -1,5 +1,4 @@
 /*
- * @file SG_Controller.cpp
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -30,7 +29,6 @@
  *  \ingroup bgesg
  */
 
-
 #include "SG_Controller.h"
 
 	void 
@@ -43,8 +41,6 @@ SetObject(SG_IObject* obj)
 	void
 SG_Controller::
 ClearObject(
-){
+) {
 	m_pObject = NULL;
 }
-
-
diff --git a/source/gameengine/SceneGraph/SG_Controller.h b/source/gameengine/SceneGraph/SG_Controller.h
index dd4ed07..7100deb 100644
--- a/source/gameengine/SceneGraph/SG_Controller.h
+++ b/source/gameengine/SceneGraph/SG_Controller.h
@@ -32,8 +32,8 @@
  *  \ingroup bgesg
  */
  
-#ifndef __SG_CONTROLLER_H
-#define __SG_CONTROLLER_H
+#ifndef __SG_CONTROLLER_H__
+#define __SG_CONTROLLER_H__
 
 #include "SG_IObject.h"
 
@@ -88,12 +88,12 @@ public:
 
 	/**
 	 * Hacky way of passing options to specific controllers
-	 * @param option An integer identifying the option.
-	 * @param value  The value of this option.
-	 * @attention This has been placed here to give sca-elements 
-	 * @attention some control over the controllers. This is 
-	 * @attention necessary because the identity of the controller
-	 * @attention is lost on the way here.
+	 * \param option An integer identifying the option.
+	 * \param value  The value of this option.
+	 * \attention This has been placed here to give sca-elements 
+	 * \attention some control over the controllers. This is 
+	 * \attention necessary because the identity of the controller
+	 * \attention is lost on the way here.
 	 */
 	virtual
 		void
@@ -124,5 +124,5 @@ protected:
 
 };
 
-#endif //__SG_CONTROLLER_H
+#endif //__SG_CONTROLLER_H__
 
diff --git a/source/gameengine/SceneGraph/SG_DList.h b/source/gameengine/SceneGraph/SG_DList.h
index c4c71ca..90e3226 100644
--- a/source/gameengine/SceneGraph/SG_DList.h
+++ b/source/gameengine/SceneGraph/SG_DList.h
@@ -29,8 +29,8 @@
  *  \ingroup bgesg
  */
  
-#ifndef __SG_DLIST
-#define __SG_DLIST
+#ifndef __SG_DLIST_H__
+#define __SG_DLIST_H__
 
 #include <stdlib.h>
 
@@ -250,5 +250,5 @@ public:
 
 };
 
-#endif //__SG_DLIST
+#endif //__SG_DLIST_H__
 
diff --git a/source/gameengine/SceneGraph/SG_IObject.cpp b/source/gameengine/SceneGraph/SG_IObject.cpp
index ae6208b..afd647c 100644
--- a/source/gameengine/SceneGraph/SG_IObject.cpp
+++ b/source/gameengine/SceneGraph/SG_IObject.cpp
@@ -66,7 +66,7 @@ SG_IObject(
 SG_IObject::
 AddSGController(
 	SG_Controller* cont
-){
+) {
 	m_SGcontrollers.push_back(cont);
 }
 
diff --git a/source/gameengine/SceneGraph/SG_IObject.h b/source/gameengine/SceneGraph/SG_IObject.h
index 764d92b..a1d4207 100644
--- a/source/gameengine/SceneGraph/SG_IObject.h
+++ b/source/gameengine/SceneGraph/SG_IObject.h
@@ -29,8 +29,8 @@
  *  \ingroup bgesg
  */
  
-#ifndef __SG_IOBJECT
-#define __SG_IOBJECT
+#ifndef __SG_IOBJECT_H__
+#define __SG_IOBJECT_H__
 
 #include "SG_QList.h"
 #include <vector>
@@ -105,10 +105,10 @@ typedef bool  (*SG_RescheduleUpdateCallback)(
 /**
  * SG_Callbacks hold 2 call backs to the outside world.
  * The first is meant to be called when objects are replicated.
- * And allows the outside world to syncronise external objects
+ * And allows the outside world to synchronize external objects
  * with replicated nodes and their children.
- * The second is called when a node is detroyed and again
- * is their for synconisation purposes
+ * The second is called when a node is destroyed and again
+ * is their for synchronization purposes
  * These callbacks may both be NULL. 
  * The efficacy of this approach has not been proved some 
  * alternatives might be to perform all replication and destruction
@@ -226,9 +226,9 @@ public:
 	/**
 	 * Get the client object associated with this
 	 * node. This interface allows you to associate
-	 * arbitray external objects with this node. They are
+	 * arbitrary external objects with this node. They are
 	 * passed to the callback functions when they are 
-	 * activated so you can syncronise these external objects
+	 * activated so you can synchronize these external objects
 	 * upon replication and destruction
 	 * This may be NULL.
 	 */
@@ -246,7 +246,7 @@ public:
 	/**
 	 * Set the client object for this node. This is just a 
 	 * pointer to an object allocated that should exist for 
-	 * the duration of the lifetime of this object, or untill
+	 * the duration of the lifetime of this object, or until
 	 * this function is called again.
 	 */
 	
@@ -373,5 +373,5 @@ public:
 #endif
 };
 
-#endif //__SG_IOBJECT
+#endif //__SG_IOBJECT_H__
 
diff --git a/source/gameengine/SceneGraph/SG_Node.cpp b/source/gameengine/SceneGraph/SG_Node.cpp
index 40f4e9b..33af9f1 100644
--- a/source/gameengine/SceneGraph/SG_Node.cpp
+++ b/source/gameengine/SceneGraph/SG_Node.cpp
@@ -78,7 +78,7 @@ SG_Node* SG_Node::GetSGReplica()
 SG_Node::
 ProcessSGReplica(
 	SG_Node** replica
-){
+) {
 	// Apply the replication call back function.
 	if (!ActivateReplicationCallback(*replica)) 
 	{
@@ -159,7 +159,7 @@ bool SG_Node::IsAncessor(const SG_Node* child) const
 	void 
 SG_Node::
 DisconnectFromParent(
-){
+) {
 	if (m_SGparent)
 	{
 		m_SGparent->RemoveChild(this);
diff --git a/source/gameengine/SceneGraph/SG_Node.h b/source/gameengine/SceneGraph/SG_Node.h
index ad4c351..4113349 100644
--- a/source/gameengine/SceneGraph/SG_Node.h
+++ b/source/gameengine/SceneGraph/SG_Node.h
@@ -29,8 +29,8 @@
  *  \ingroup bgesg
  */
  
-#ifndef __SG_NODE_H
-#define __SG_NODE_H
+#ifndef __SG_NODE_H__
+#define __SG_NODE_H__
 
 #include "SG_Spatial.h"
 #include <vector>
@@ -81,7 +81,7 @@ public:
 	);
 
 	/**
-	 * Return true if the node is the ancessor of child
+	 * Return true if the node is the ancestor of child
 	 */
 		bool
 	IsAncessor(
@@ -91,7 +91,7 @@ public:
 	 * Get the current list of children. Do not use this interface for
 	 * adding or removing children please use the methods of this class for
 	 * that.
-	 * @return a reference to the list of children of this node.
+	 * \return a reference to the list of children of this node.
 	 */
 	
 	NodeList& GetSGChildren()
@@ -101,7 +101,7 @@ public:
 
 	/**
 	 * Get the current list of children.
-	 * @return a const reference to the current list of children of this node.
+	 * \return a const reference to the current list of children of this node.
 	 */
 
 	const NodeList& GetSGChildren() const
@@ -277,5 +277,5 @@ public:
 #endif
 };
 
-#endif //__SG_NODE_H
+#endif //__SG_NODE_H__
 
diff --git a/source/gameengine/SceneGraph/SG_ParentRelation.h b/source/gameengine/SceneGraph/SG_ParentRelation.h
index c704146..689ada8 100644
--- a/source/gameengine/SceneGraph/SG_ParentRelation.h
+++ b/source/gameengine/SceneGraph/SG_ParentRelation.h
@@ -28,9 +28,9 @@
 
 /** \file SG_ParentRelation.h
  *  \ingroup bgesg
- * @page SG_ParentRelationPage SG_ParentRelation   
+ * \page SG_ParentRelationPage SG_ParentRelation   
 
- * @section SG_ParentRelationSection SG_ParentRelation
+ * \section SG_ParentRelationSection SG_ParentRelation
  * 
  * This is an abstract interface class to the Scene Graph library. 
  * It allows you to specify how child nodes react to parent nodes.
@@ -49,8 +49,8 @@
  *
  */
  
-#ifndef __SG_ParentRelation_h
-#define __SG_ParentRelation_h
+#ifndef __SG_PARENTRELATION_H__
+#define __SG_PARENTRELATION_H__
 
 class SG_Spatial;
 
@@ -136,7 +136,7 @@ public:
 	void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:SG_ParentRelation"); }
 	void operator delete( void *mem ) { MEM_freeN(mem); }
 #endif
-};	
+};
 
 #endif
 
diff --git a/source/gameengine/SceneGraph/SG_QList.h b/source/gameengine/SceneGraph/SG_QList.h
index 9df8f35..e128887 100644
--- a/source/gameengine/SceneGraph/SG_QList.h
+++ b/source/gameengine/SceneGraph/SG_QList.h
@@ -29,8 +29,8 @@
  *  \ingroup bgesg
  */
  
-#ifndef __SG_QLIST
-#define __SG_QLIST
+#ifndef __SG_QLIST_H__
+#define __SG_QLIST_H__
 
 #include "SG_DList.h"
 
@@ -163,5 +163,5 @@ public:
 #endif
 };
 
-#endif //__SG_QLIST
+#endif //__SG_QLIST_H__
 
diff --git a/source/gameengine/SceneGraph/SG_Spatial.cpp b/source/gameengine/SceneGraph/SG_Spatial.cpp
index 6e93547..b5b38fd 100644
--- a/source/gameengine/SceneGraph/SG_Spatial.cpp
+++ b/source/gameengine/SceneGraph/SG_Spatial.cpp
@@ -94,7 +94,7 @@ SG_Spatial::
 SG_Spatial::
 SetParentRelation(
 	SG_ParentRelation *relation
-){
+) {
 	delete (m_parent_relation);
 	m_parent_relation = relation;
 	SetModified();
@@ -113,7 +113,7 @@ UpdateSpatialData(
 	        const SG_Spatial *parent,
 	        double time,
 	        bool& parentUpdated
-	        ){
+	        ) {
 	bool bComputesWorldTransform = false;
 
 	// update spatial controllers
@@ -148,7 +148,7 @@ RelativeTranslate(
 	const MT_Vector3& trans,
 	const SG_Spatial *parent,
 	bool local
-){
+) {
 	if (local) {
 			m_localPosition += m_localRotation * trans;
 	} else {
@@ -177,7 +177,7 @@ SG_Spatial::
 RelativeRotate(
 	const MT_Matrix3x3& rot,
 	bool local
-){
+) {
 	m_localRotation = m_localRotation * (
 	local ? 
 		rot 
diff --git a/source/gameengine/SceneGraph/SG_Spatial.h b/source/gameengine/SceneGraph/SG_Spatial.h
index 3f2f66c..32f9110 100644
--- a/source/gameengine/SceneGraph/SG_Spatial.h
+++ b/source/gameengine/SceneGraph/SG_Spatial.h
@@ -29,8 +29,8 @@
  *  \ingroup bgesg
  */
  
-#ifndef __SG_SPATIAL_H
-#define __SG_SPATIAL_H
+#ifndef __SG_SPATIAL_H__
+#define __SG_SPATIAL_H__
 
 #include <MT_Vector3.h>
 #include <MT_Point3.h>
@@ -83,14 +83,14 @@ public:
 		m_ogldirty = false;
 	}
 	/** 
-	 * Define the realtionship this node has with it's parent
+	 * Define the relationship this node has with it's parent
 	 * node. You should pass an unshared instance of an SG_ParentRelation
 	 * allocated on the heap to this method. Ownership of this
 	 * instance is assumed by this class. 
 	 * You may call this function several times in the lifetime 
 	 * of a node to change the relationship dynamically. 
 	 * You must call this method before the first call to UpdateSpatialData().
-	 * An assertion willl be fired at run-time in debug if this is not 
+	 * An assertion will be fired at run-time in debug if this is not 
 	 * the case.
 	 * The relation is activated only if no controllers of this object
 	 * updated the coordinates of the child.
@@ -293,5 +293,5 @@ public:
 #endif
 };
 
-#endif //__SG_SPATIAL_H
+#endif //__SG_SPATIAL_H__
 
diff --git a/source/gameengine/SceneGraph/SG_Tree.cpp b/source/gameengine/SceneGraph/SG_Tree.cpp
index 87c618f..738c0fd 100644
--- a/source/gameengine/SceneGraph/SG_Tree.cpp
+++ b/source/gameengine/SceneGraph/SG_Tree.cpp
@@ -182,7 +182,7 @@ public:
 	void resize(unsigned int size)
 	{
 		m_array.resize(size);
-		for( unsigned int i = 0; i < size; i++)
+		for ( unsigned int i = 0; i < size; i++)
 		{
 			m_array[i].resize(size - i);
 		}
@@ -353,11 +353,11 @@ SG_Tree* SG_TreeFactory::MakeTreeUp()
 	
 	unsigned int x, y;
 	TreeSet::iterator xit, yit;
-	for( y = 0, yit = m_objects.begin(); y < num_objects; y++, ++yit)
+	for ( y = 0, yit = m_objects.begin(); y < num_objects; y++, ++yit)
 	{
 		sizes(y, y) = *yit;
 		xit = yit;
-		for( x = y+1, ++xit; x < num_objects; x++, ++xit)
+		for ( x = y+1, ++xit; x < num_objects; x++, ++xit)
 		{
 			sizes(x, y) = new SG_Tree(*xit, *yit);
 			
@@ -370,9 +370,9 @@ SG_Tree* SG_TreeFactory::MakeTreeUp()
 		MT_Scalar min_volume = FLT_MAX;
 		SG_Tree *min = NULL;
 		//char temp[16];
-		for( y = 0; y < num_objects; y++)
+		for ( y = 0; y < num_objects; y++)
 		{
-			for( x = y+1; x < num_objects; x++)
+			for ( x = y+1; x < num_objects; x++)
 			{
 				if (sizes(x, y)->volume() < min_volume)
 				{
@@ -387,7 +387,7 @@ SG_Tree* SG_TreeFactory::MakeTreeUp()
 		/* Remove other bboxes that contain the two bboxes */
 		sizes.delete_column(miny);
 		
-		for( x = miny + 1; x < num_objects; x++)
+		for ( x = miny + 1; x < num_objects; x++)
 		{
 			if (x == minx)
 				continue;
@@ -398,12 +398,12 @@ SG_Tree* SG_TreeFactory::MakeTreeUp()
 		num_objects--;
 		minx--;
 		sizes(minx, minx) = min;
-		for( x = minx + 1; x < num_objects; x++)
+		for ( x = minx + 1; x < num_objects; x++)
 		{
 			delete sizes(x, minx);
 			sizes(x, minx) = new SG_Tree(min, sizes(x, x));
 		}
-		for( y = 0; y < minx; y++)
+		for ( y = 0; y < minx; y++)
 		{
 			delete sizes(minx, y);
 			sizes(minx, y) = new SG_Tree(sizes(y, y), min);
diff --git a/source/gameengine/SceneGraph/SG_Tree.h b/source/gameengine/SceneGraph/SG_Tree.h
index b0d74be..b2cbb22 100644
--- a/source/gameengine/SceneGraph/SG_Tree.h
+++ b/source/gameengine/SceneGraph/SG_Tree.h
@@ -81,8 +81,8 @@ public:
 	/**
 	 * Gets the eight corners of this treenode's bounding box,
 	 * in world coordinates.
-	 * @param box: an array of 8 MT_Point3
-	 * @example MT_Point3 box[8];
+	 * \param box: an array of 8 MT_Point3
+	 * \example MT_Point3 box[8];
 	 *          treenode->get(box);
 	 */
 	void get(MT_Point3 *box) const;
@@ -126,8 +126,8 @@ public:
  *  SG_TreeFactory generates an SG_Tree from a list of SG_Nodes.
  *  It joins pairs of SG_Nodes to minimise the size of the resultant
  *  bounding box.
- *  cf building an optimised Huffman tree.
- *  @warning O(n^3)!!!
+ *  cf building an optimized Huffman tree.
+ *  \warning O(n^3)!!!
  */
 class SG_TreeFactory 
 {
diff --git a/source/gameengine/VideoTexture/BlendType.h b/source/gameengine/VideoTexture/BlendType.h
index fad23af..0131cc6 100644
--- a/source/gameengine/VideoTexture/BlendType.h
+++ b/source/gameengine/VideoTexture/BlendType.h
@@ -24,8 +24,8 @@ http://www.gnu.org/copyleft/lesser.txt.
  *  \ingroup bgevideotex
  */
  
-#if !defined BLENDTYPE_H
-#define BLENDTYPE_H
+#ifndef __BLENDTYPE_H__
+#define __BLENDTYPE_H__
 
 
 /// class allows check type of blender python object and access its contained object
diff --git a/source/gameengine/VideoTexture/Common.h b/source/gameengine/VideoTexture/Common.h
index fe9632b..e6e0ffa 100644
--- a/source/gameengine/VideoTexture/Common.h
+++ b/source/gameengine/VideoTexture/Common.h
@@ -28,31 +28,31 @@ http://www.gnu.org/copyleft/lesser.txt.
 #define WINDOWS_LEAN_AND_MEAN
 #endif
 
-#if !defined NULL
+#ifndef NULL
 #define NULL 0
 #endif
 
-#if !defined HRESULT
+#ifndef HRESULT
 #define HRESULT long
 #endif
 
-#if !defined DWORD
+#ifndef DWORD
 #define DWORD unsigned long
 #endif
 
-#if !defined S_OK
+#ifndef S_OK
 #define S_OK ((HRESULT)0L)
 #endif
 
-#if !defined BYTE
+#ifndef BYTE
 #define BYTE unsigned char
 #endif
 
-#if !defined WIN32
+#ifndef WIN32
 #define Sleep(time) sleep(time)
 #endif
 
-#if !defined FAILED
+#ifndef FAILED
 #define FAILED(Status) ((HRESULT)(Status)<0)
 #endif
 
diff --git a/source/gameengine/VideoTexture/Exception.h b/source/gameengine/VideoTexture/Exception.h
index af226fa..bc08742 100644
--- a/source/gameengine/VideoTexture/Exception.h
+++ b/source/gameengine/VideoTexture/Exception.h
@@ -25,8 +25,8 @@ http://www.gnu.org/copyleft/lesser.txt.
  *  \ingroup bgevideotex
  */
  
-#if !defined EXCEPTION_H
-#define EXCEPTION_H
+#ifndef __EXCEPTION_H__
+#define __EXCEPTION_H__
 
 #include <exception>
 #include <vector>
diff --git a/source/gameengine/VideoTexture/FilterBase.h b/source/gameengine/VideoTexture/FilterBase.h
index bdb3106..cd25a7e 100644
--- a/source/gameengine/VideoTexture/FilterBase.h
+++ b/source/gameengine/VideoTexture/FilterBase.h
@@ -24,8 +24,8 @@ http://www.gnu.org/copyleft/lesser.txt.
  *  \ingroup bgevideotex
  */
  
-#if !defined FILTERBASE_H
-#define FILTERBASE_H
+#ifndef __FILTERBASE_H__
+#define __FILTERBASE_H__
 
 #include "Common.h"
 
diff --git a/source/gameengine/VideoTexture/FilterBlueScreen.h b/source/gameengine/VideoTexture/FilterBlueScreen.h
index 381941f..28ab16d 100644
--- a/source/gameengine/VideoTexture/FilterBlueScreen.h
+++ b/source/gameengine/VideoTexture/FilterBlueScreen.h
@@ -24,8 +24,8 @@ http://www.gnu.org/copyleft/lesser.txt.
  *  \ingroup bgevideotex
  */
  
-#if !defined FILTERBLUESCREEN_H
-#define FILTERBLUESCREEN_H
+#ifndef __FILTERBLUESCREEN_H__
+#define __FILTERBLUESCREEN_H__
 
 #include "Common.h"
 
diff --git a/source/gameengine/VideoTexture/FilterColor.h b/source/gameengine/VideoTexture/FilterColor.h
index aeca4d3..9b1976c 100644
--- a/source/gameengine/VideoTexture/FilterColor.h
+++ b/source/gameengine/VideoTexture/FilterColor.h
@@ -24,8 +24,8 @@ http://www.gnu.org/copyleft/lesser.txt.
  *  \ingroup bgevideotex
  */
  
-#if !defined FILTERCOLOR_H
-#define FILTERCOLOR_H
+#ifndef __FILTERCOLOR_H__
+#define __FILTERCOLOR_H__
 
 #include "Common.h"
 
diff --git a/source/gameengine/VideoTexture/FilterNormal.h b/source/gameengine/VideoTexture/FilterNormal.h
index 0b4574d..19664e8 100644
--- a/source/gameengine/VideoTexture/FilterNormal.h
+++ b/source/gameengine/VideoTexture/FilterNormal.h
@@ -24,8 +24,8 @@ http://www.gnu.org/copyleft/lesser.txt.
  *  \ingroup bgevideotex
  */
  
-#if !defined FILTERNORMAL_H
-#define FILTERNORMAL_H
+#ifndef __FILTERNORMAL_H__
+#define __FILTERNORMAL_H__
 
 #include "Common.h"
 
diff --git a/source/gameengine/VideoTexture/FilterSource.h b/source/gameengine/VideoTexture/FilterSource.h
index 5b73fcd..a4900e8 100644
--- a/source/gameengine/VideoTexture/FilterSource.h
+++ b/source/gameengine/VideoTexture/FilterSource.h
@@ -24,8 +24,8 @@ http://www.gnu.org/copyleft/lesser.txt.
  *  \ingroup bgevideotex
  */
  
-#if !defined FILTERSOURCE_H
-#define FILTERSOURCE_H
+#ifndef __FILTERSOURCE_H__
+#define __FILTERSOURCE_H__
 
 #include "Common.h"
 
diff --git a/source/gameengine/VideoTexture/ImageBase.h b/source/gameengine/VideoTexture/ImageBase.h
index e6469f4..91c7dce 100644
--- a/source/gameengine/VideoTexture/ImageBase.h
+++ b/source/gameengine/VideoTexture/ImageBase.h
@@ -24,8 +24,8 @@ http://www.gnu.org/copyleft/lesser.txt.
  *  \ingroup bgevideotex
  */
  
-#if !defined IMAGEBASE_H
-#define IMAGEBASE_H
+#ifndef __IMAGEBASE_H__
+#define __IMAGEBASE_H__
 
 #include "Common.h"
 
@@ -166,7 +166,7 @@ protected:
 						// copy pixel
 						*dstBuff = filter.convert(srcBuff, x, y, srcSize, pixSize);
 			}
-			// else scale picture (nearest neighbour)
+			// else scale picture (nearest neighbor)
 		else
 		{
 			// interpolation accumulator
diff --git a/source/gameengine/VideoTexture/ImageBuff.cpp b/source/gameengine/VideoTexture/ImageBuff.cpp
index d9e3a59..d28babf 100644
--- a/source/gameengine/VideoTexture/ImageBuff.cpp
+++ b/source/gameengine/VideoTexture/ImageBuff.cpp
@@ -324,7 +324,7 @@ static PyObject * plot (PyImage * self, PyObject * args)
 	if (PyArg_ParseTuple(args, "s*hhhh|h:plot", &buffer, &width, &height, &x, &y, &mode))
 	{
 		// correct decoding, verify that buffer size is correct
-		// we need a continous memory buffer
+		// we need a continuous memory buffer
 		if (testPyBuffer(&buffer, width, height, 4))
 		{
 			getImageBuff(self)->plot((unsigned char*)buffer.buf, width, height, x, y, mode);
@@ -370,7 +370,7 @@ static PyGetSetDef imageBuffGetSets[] =
 	{(char*)"valid", (getter)Image_valid, NULL, (char*)"bool to tell if an image is available", NULL},
 	{(char*)"image", (getter)Image_getImage, NULL, (char*)"image data", NULL},
 	{(char*)"size", (getter)Image_getSize, NULL, (char*)"image size", NULL},
-	{(char*)"scale", (getter)Image_getScale, (setter)Image_setScale, (char*)"fast scale of image (near neighbour)", 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*)"filter", (getter)Image_getFilter, (setter)Image_setFilter, (char*)"pixel filter", NULL},
 	{NULL}
diff --git a/source/gameengine/VideoTexture/ImageBuff.h b/source/gameengine/VideoTexture/ImageBuff.h
index 1fd2d3f..b3e7386 100644
--- a/source/gameengine/VideoTexture/ImageBuff.h
+++ b/source/gameengine/VideoTexture/ImageBuff.h
@@ -24,8 +24,8 @@ http://www.gnu.org/copyleft/lesser.txt.
  *  \ingroup bgevideotex
  */
  
-#if !defined IMAGEBUFF_H
-#define IMAGEBUFF_H
+#ifndef __IMAGEBUFF_H__
+#define __IMAGEBUFF_H__
 
 
 #include "Common.h"
diff --git a/source/gameengine/VideoTexture/ImageMix.cpp b/source/gameengine/VideoTexture/ImageMix.cpp
index d06ea48..e240992 100644
--- a/source/gameengine/VideoTexture/ImageMix.cpp
+++ b/source/gameengine/VideoTexture/ImageMix.cpp
@@ -162,7 +162,7 @@ static PyGetSetDef imageMixGetSets[] =
 	{(char*)"valid", (getter)Image_valid, NULL, (char*)"bool to tell if an image is available", NULL},
 	{(char*)"image", (getter)Image_getImage, NULL, (char*)"image data", NULL},
 	{(char*)"size", (getter)Image_getSize, NULL, (char*)"image size", NULL},
-	{(char*)"scale", (getter)Image_getScale, (setter)Image_setScale, (char*)"fast scale of image (near neighbour)", 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*)"filter", (getter)Image_getFilter, (setter)Image_setFilter, (char*)"pixel filter", NULL},
 	{NULL}
diff --git a/source/gameengine/VideoTexture/ImageMix.h b/source/gameengine/VideoTexture/ImageMix.h
index d99f275..2746635 100644
--- a/source/gameengine/VideoTexture/ImageMix.h
+++ b/source/gameengine/VideoTexture/ImageMix.h
@@ -24,8 +24,8 @@ http://www.gnu.org/copyleft/lesser.txt.
  *  \ingroup bgevideotex
  */
  
-#if !defined IMAGEMIX_H
-#define IMAGEMIX_H
+#ifndef __IMAGEMIX_H__
+#define __IMAGEMIX_H__
 
 
 #include "Common.h"
diff --git a/source/gameengine/VideoTexture/ImageRender.cpp b/source/gameengine/VideoTexture/ImageRender.cpp
index a349b45..9f7d42d 100644
--- a/source/gameengine/VideoTexture/ImageRender.cpp
+++ b/source/gameengine/VideoTexture/ImageRender.cpp
@@ -359,7 +359,7 @@ static int setBackground (PyImage * self, PyObject * value, void * closure)
 	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))));
+		(unsigned char)(PyLong_AsSsize_t(PySequence_Fast_GET_ITEM(value, 3))));
 	// success
 	return 0;
 }
@@ -383,7 +383,7 @@ static PyGetSetDef imageRenderGetSets[] =
 	{(char*)"valid", (getter)Image_valid, NULL, (char*)"bool to tell if an image is available", NULL},
 	{(char*)"image", (getter)Image_getImage, NULL, (char*)"image data", NULL},
 	{(char*)"size", (getter)Image_getSize, NULL, (char*)"image size", NULL},
-	{(char*)"scale", (getter)Image_getScale, (setter)Image_setScale, (char*)"fast scale of image (near neighbour)",	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*)"filter", (getter)Image_getFilter, (setter)Image_setFilter, (char*)"pixel filter", NULL},
 	{NULL}
@@ -459,7 +459,7 @@ static int ImageMirror_init (PyObject * pySelf, PyObject * args, PyObject * kwds
 		else
 			THRWEXCP(SceneInvalid, S_OK);
 		
-		if(scenePtr==NULL) /* incase the python proxy reference is invalid */
+		if (scenePtr==NULL) /* in case the python proxy reference is invalid */
 			THRWEXCP(SceneInvalid, S_OK);
 		
 		// get observer pointer
@@ -471,7 +471,7 @@ static int ImageMirror_init (PyObject * pySelf, PyObject * args, PyObject * kwds
 		else
 			THRWEXCP(ObserverInvalid, S_OK);
 		
-		if(observerPtr==NULL) /* incase the python proxy reference is invalid */
+		if (observerPtr==NULL) /* in case the python proxy reference is invalid */
 			THRWEXCP(ObserverInvalid, S_OK);
 
 		// get mirror pointer
@@ -481,7 +481,7 @@ static int ImageMirror_init (PyObject * pySelf, PyObject * args, PyObject * kwds
 		else
 			THRWEXCP(MirrorInvalid, S_OK);
 		
-		if(mirrorPtr==NULL) /* incase the python proxy reference is invalid */
+		if (mirrorPtr==NULL) /* in case the python proxy reference is invalid */
 			THRWEXCP(MirrorInvalid, S_OK);
 
 		// locate the material in the mirror
@@ -545,7 +545,7 @@ static PyGetSetDef imageMirrorGetSets[] =
 	{(char*)"valid", (getter)Image_valid, NULL, (char*)"bool to tell if an image is available", NULL},
 	{(char*)"image", (getter)Image_getImage, NULL, (char*)"image data", NULL},
 	{(char*)"size", (getter)Image_getSize, NULL, (char*)"image size", NULL},
-	{(char*)"scale", (getter)Image_getScale, (setter)Image_setScale, (char*)"fast scale of image (near neighbour)",	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*)"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 61f4414..0062175 100644
--- a/source/gameengine/VideoTexture/ImageRender.h
+++ b/source/gameengine/VideoTexture/ImageRender.h
@@ -24,8 +24,8 @@ http://www.gnu.org/copyleft/lesser.txt.
  *  \ingroup bgevideotex
  */
  
-#if !defined IMAGERENDER_H
-#define IMAGERENDER_H
+#ifndef __IMAGERENDER_H__
+#define __IMAGERENDER_H__
 
 
 #include "Common.h"
diff --git a/source/gameengine/VideoTexture/ImageViewport.cpp b/source/gameengine/VideoTexture/ImageViewport.cpp
index a935456..12f1fa0 100644
--- a/source/gameengine/VideoTexture/ImageViewport.cpp
+++ b/source/gameengine/VideoTexture/ImageViewport.cpp
@@ -57,7 +57,7 @@ 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
@@ -308,7 +308,7 @@ static PyGetSetDef imageViewportGetSets[] =
 	{(char*)"valid", (getter)Image_valid, NULL, (char*)"bool to tell if an image is available", NULL},
 	{(char*)"image", (getter)Image_getImage, NULL, (char*)"image data", NULL},
 	{(char*)"size", (getter)Image_getSize, NULL, (char*)"image size", NULL},
-	{(char*)"scale", (getter)Image_getScale, (setter)Image_setScale, (char*)"fast scale of image (near neighbour)", 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*)"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 4195847..ccc58a4 100644
--- a/source/gameengine/VideoTexture/ImageViewport.h
+++ b/source/gameengine/VideoTexture/ImageViewport.h
@@ -24,8 +24,8 @@ http://www.gnu.org/copyleft/lesser.txt.
  *  \ingroup bgevideotex
  */
  
-#if !defined IMAGEVIEWPORT_H
-#define IMAGEVIEWPORT_H
+#ifndef __IMAGEVIEWPORT_H__
+#define __IMAGEVIEWPORT_H__
 
 
 #include "Common.h"
diff --git a/source/gameengine/VideoTexture/PyTypeList.h b/source/gameengine/VideoTexture/PyTypeList.h
index 3f15232..e0f7480 100644
--- a/source/gameengine/VideoTexture/PyTypeList.h
+++ b/source/gameengine/VideoTexture/PyTypeList.h
@@ -24,8 +24,8 @@ http://www.gnu.org/copyleft/lesser.txt.
  *  \ingroup bgevideotex
  */
  
-#if !defined PYTYPELIST_H
-#define PYTYPELIST_H
+#ifndef __PYTYPELIST_H__
+#define __PYTYPELIST_H__
 
 #include "Common.h"
 
diff --git a/source/gameengine/VideoTexture/SConscript b/source/gameengine/VideoTexture/SConscript
index b39a59e..1e3f232 100644
--- a/source/gameengine/VideoTexture/SConscript
+++ b/source/gameengine/VideoTexture/SConscript
@@ -16,7 +16,7 @@ incs += ' #intern/guardedalloc #intern/container #extern/glew/include'
 incs += ' #intern/ffmpeg'
 
 defs = [] 
-if env['OURPLATFORM'] in ('win32-vc', 'win64-vc','win32-mingw'):
+if env['OURPLATFORM'] in ('win32-vc', 'win64-vc','win32-mingw', 'win64-mingw'):
     if env['BF_DEBUG']:
         defs.append('_DEBUG')
 
diff --git a/source/gameengine/VideoTexture/Texture.h b/source/gameengine/VideoTexture/Texture.h
index 32801a2..d6e2ba0 100644
--- a/source/gameengine/VideoTexture/Texture.h
+++ b/source/gameengine/VideoTexture/Texture.h
@@ -24,8 +24,8 @@ http://www.gnu.org/copyleft/lesser.txt.
  *  \ingroup bgevideotex
  */
  
-#if !defined TEXTURE_H
-#define TEXTURE_H
+#ifndef __TEXTURE_H__
+#define __TEXTURE_H__
 
 #include <PyObjectPlus.h>
 #include <structmember.h>
diff --git a/source/gameengine/VideoTexture/VideoBase.h b/source/gameengine/VideoTexture/VideoBase.h
index a1eae96..7ad3c6a 100644
--- a/source/gameengine/VideoTexture/VideoBase.h
+++ b/source/gameengine/VideoTexture/VideoBase.h
@@ -24,8 +24,8 @@ http://www.gnu.org/copyleft/lesser.txt.
  *  \ingroup bgevideotex
  */
  
-#if !defined VIDEOBASE_H
-#define VIDEOBASE_H
+#ifndef __VIDEOBASE_H__
+#define __VIDEOBASE_H__
 
 
 #include <PyObjectPlus.h>
diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.cpp b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
index acc0993..99f2431 100644
--- a/source/gameengine/VideoTexture/VideoFFmpeg.cpp
+++ b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
@@ -39,8 +39,8 @@ http://www.gnu.org/copyleft/lesser.txt.
 
 #include <string>
 
-#include "Exception.h"
 #include "VideoFFmpeg.h"
+#include "Exception.h"
 
 
 // default framerate
@@ -169,10 +169,10 @@ int VideoFFmpeg::openStream(const char *filename, AVInputFormat *inputFormat, AV
 	AVCodec			*codec;
 	AVCodecContext	*codecCtx;
 
-	if(av_open_input_file(&formatCtx, filename, inputFormat, 0, formatParams)!=0)
+	if (av_open_input_file(&formatCtx, filename, inputFormat, 0, formatParams)!=0)
 		return -1;
 
-	if(av_find_stream_info(formatCtx)<0) 
+	if (av_find_stream_info(formatCtx)<0) 
 	{
 		av_close_input_file(formatCtx);
 		return -1;
@@ -180,9 +180,9 @@ int VideoFFmpeg::openStream(const char *filename, AVInputFormat *inputFormat, AV
 
 	/* Find the first video stream */
 	videoStream=-1;
-	for(i=0; i<formatCtx->nb_streams; i++)
+	for (i=0; i<formatCtx->nb_streams; i++)
 	{
-		if(formatCtx->streams[i] &&
+		if (formatCtx->streams[i] &&
 			get_codec_from_stream(formatCtx->streams[i]) && 
 			(get_codec_from_stream(formatCtx->streams[i])->codec_type==AVMEDIA_TYPE_VIDEO))
 		{
@@ -191,7 +191,7 @@ int VideoFFmpeg::openStream(const char *filename, AVInputFormat *inputFormat, AV
 		}
 	}
 
-	if(videoStream==-1) 
+	if (videoStream==-1) 
 	{
 		av_close_input_file(formatCtx);
 		return -1;
@@ -201,20 +201,20 @@ int VideoFFmpeg::openStream(const char *filename, AVInputFormat *inputFormat, AV
 
 	/* Find the decoder for the video stream */
 	codec=avcodec_find_decoder(codecCtx->codec_id);
-	if(codec==NULL) 
+	if (codec==NULL) 
 	{
 		av_close_input_file(formatCtx);
 		return -1;
 	}
 	codecCtx->workaround_bugs = 1;
-	if(avcodec_open(codecCtx, codec)<0) 
+	if (avcodec_open(codecCtx, codec)<0) 
 	{
 		av_close_input_file(formatCtx);
 		return -1;
 	}
 
 #ifdef FFMPEG_OLD_FRAME_RATE
-	if(codecCtx->frame_rate>1000 && codecCtx->frame_rate_base==1)
+	if (codecCtx->frame_rate>1000 && codecCtx->frame_rate_base==1)
 		codecCtx->frame_rate_base=1000;
 	m_baseFrameRate = (double)codecCtx->frame_rate / (double)codecCtx->frame_rate_base;
 #else
@@ -294,7 +294,7 @@ int VideoFFmpeg::openStream(const char *filename, AVInputFormat *inputFormat, AV
 /*
  * This thread is used to load video frame asynchronously.
  * It provides a frame caching service. 
- * The main thread is responsible for positionning the frame pointer in the
+ * The main thread is responsible for positioning the frame pointer in the
  * file correctly before calling startCache() which starts this thread.
  * The cache is organized in two layers: 1) a cache of 20-30 undecoded packets to keep
  * memory and CPU low 2) a cache of 5 decoded frames. 
@@ -373,7 +373,7 @@ void *VideoFFmpeg::cacheThread(void *data)
 				avcodec_decode_video2(video->m_codecCtx, 
 					video->m_frame, &frameFinished, 
 					&cachePacket->packet);
-				if(frameFinished) 
+				if (frameFinished) 
 				{
 					AVFrame * input = video->m_frame;
 
@@ -793,7 +793,7 @@ void VideoFFmpeg::calcImage (unsigned int texId, double ts)
 		{
 			AVFrame* frame;
 			// get image
-			if((frame = grabFrame(actFrame)) != NULL)
+			if ((frame = grabFrame(actFrame)) != NULL)
 			{
 				if (!m_isFile && !m_cacheStarted) 
 				{
@@ -844,7 +844,7 @@ void VideoFFmpeg::setPositions (void)
 		m_startTime -= double(m_lastFrame) / actFrameRate();
 	else {
 		m_startTime -= m_range[0];
-		// start from begining, stop cache just in case
+		// start from beginning, stop cache just in case
 		stopCache();
 	}
 }
@@ -959,7 +959,7 @@ AVFrame *VideoFFmpeg::grabFrame(long position)
 				// of the file.
 				if (position <= m_preseek)
 				{
-					// we can safely go the begining of the file
+					// we can safely go the beginning of the file
 					if (av_seek_frame(m_formatCtx, m_videoStream, 0, AVSEEK_FLAG_BYTE) >= 0)
 					{
 						// binary seek does not reset the timestamp, must do it now
@@ -999,7 +999,7 @@ AVFrame *VideoFFmpeg::grabFrame(long position)
 	// return the next frame. This is not quite correct, may need more work
 	while(av_read_frame(m_formatCtx, &packet)>=0) 
 	{
-		if(packet.stream_index == m_videoStream) 
+		if (packet.stream_index == m_videoStream) 
 		{
 			avcodec_decode_video2(m_codecCtx, 
 				m_frame, &frameFinished, 
@@ -1188,7 +1188,7 @@ static PyGetSetDef videoGetSets[] =
 	{(char*)"valid", (getter)Image_valid, NULL, (char*)"bool to tell if an image is available", NULL},
 	{(char*)"image", (getter)Image_getImage, NULL, (char*)"image data", NULL},
 	{(char*)"size", (getter)Image_getSize, NULL, (char*)"image size", NULL},
-	{(char*)"scale", (getter)Image_getScale, (setter)Image_setScale, (char*)"fast scale of image (near neighbour)", 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*)"filter", (getter)Image_getFilter, (setter)Image_setFilter, (char*)"pixel filter", NULL},
 	{(char*)"preseek", (getter)VideoFFmpeg_getPreseek, (setter)VideoFFmpeg_setPreseek, (char*)"nb of frames of preseek", NULL},
@@ -1309,7 +1309,7 @@ static PyGetSetDef imageGetSets[] =
 	{(char*)"valid", (getter)Image_valid, NULL, (char*)"bool to tell if an image is available", NULL},
 	{(char*)"image", (getter)Image_getImage, NULL, (char*)"image data", NULL},
 	{(char*)"size", (getter)Image_getSize, NULL, (char*)"image size", NULL},
-	{(char*)"scale", (getter)Image_getScale, (setter)Image_setScale, (char*)"fast scale of image (near neighbour)", 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*)"filter", (getter)Image_getFilter, (setter)Image_setFilter, (char*)"pixel filter", NULL},
 	{NULL}
diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.h b/source/gameengine/VideoTexture/VideoFFmpeg.h
index 2be86b6..d345821 100644
--- a/source/gameengine/VideoTexture/VideoFFmpeg.h
+++ b/source/gameengine/VideoTexture/VideoFFmpeg.h
@@ -24,30 +24,30 @@ http://www.gnu.org/copyleft/lesser.txt.
  *  \ingroup bgevideotex
  */
  
-#if !defined VIDEOFFMPEG_H
-#define VIDEOFFMPEG_H
+#ifndef __VIDEOFFMPEG_H__
+#define __VIDEOFFMPEG_H__
 
 #ifdef WITH_FFMPEG
+/* this needs to be parsed with __cplusplus defined before included through ffmpeg_compat.h */
+#if defined(__FreeBSD__)
+#  include <inttypes.h>
+#endif
 extern "C" {
-#undef __cplusplus
 #include <pthread.h>
-
 #include "ffmpeg_compat.h"
-
 #include "DNA_listBase.h"
 #include "BLI_threads.h"
 #include "BLI_blenlib.h"
-#define __cplusplus
 }
 
 #if LIBAVFORMAT_VERSION_INT < (49 << 16)
-#define FFMPEG_OLD_FRAME_RATE 1
+#  define FFMPEG_OLD_FRAME_RATE 1
 #else
-#define FFMPEG_CODEC_IS_POINTER 1
+#  define FFMPEG_CODEC_IS_POINTER 1
 #endif
 
 #if LIBAVFORMAT_VERSION_INT >= (52 << 16)
-#define FFMPEG_PB_IS_POINTER 1
+#  define FFMPEG_PB_IS_POINTER 1
 #endif
 
 #ifdef FFMPEG_CODEC_IS_POINTER
diff --git a/source/gameengine/VideoTexture/blendVideoTex.cpp b/source/gameengine/VideoTexture/blendVideoTex.cpp
index 8410e93..a82935c 100644
--- a/source/gameengine/VideoTexture/blendVideoTex.cpp
+++ b/source/gameengine/VideoTexture/blendVideoTex.cpp
@@ -189,7 +189,7 @@ PyObject* initVideoTexture(void)
 	/* Use existing module where possible
 	 * be careful not to init any runtime vars after this */
 	m = PyImport_ImportModule( "VideoTexture" );
-	if(m) {
+	if (m) {
 		Py_DECREF(m);
 		return m;
 	}
diff --git a/source/tests/bl_load_addons.py b/source/tests/bl_load_addons.py
index 5bd83ab..21a0101 100644
--- a/source/tests/bl_load_addons.py
+++ b/source/tests/bl_load_addons.py
@@ -57,7 +57,7 @@ def reload_addons(do_reload=True, do_reverse=True):
                 imp.reload(sys.modules[mod_name])
 
             if do_reverse:
-                # incase order matters when it shouldnt
+                # in case order matters when it shouldnt
                 modules.reverse()
 
 
diff --git a/source/tests/bl_mesh_modifiers.py b/source/tests/bl_mesh_modifiers.py
index 0495f5d..3906798 100644
--- a/source/tests/bl_mesh_modifiers.py
+++ b/source/tests/bl_mesh_modifiers.py
@@ -20,7 +20,7 @@
 
 # Currently this script only generates images from different modifier
 # combinations and does not validate they work correctly,
-# this is because we dont get 1:1 match with bmesh.
+# this is because we don't get 1:1 match with bmesh.
 #
 # Later, we may have a way to check the results are valid.
 
@@ -260,7 +260,7 @@ def mesh_uv_add(obj):
     if IS_BMESH:
         # XXX, odd that we need to do this. until uvs and texface
         # are separated we will need to keep it
-        uv_loops = obj.data.uv_loop_layers[-1]
+        uv_loops = obj.data.uv_layers[-1]
         uv_list = uv_loops.data[:]
         for poly in obj.data.polygons:
             poly_uvs = mesh_bmesh_poly_elems(poly, uv_list)
diff --git a/source/tests/bl_mesh_validate.py b/source/tests/bl_mesh_validate.py
new file mode 100644
index 0000000..a57a06d
--- /dev/null
+++ b/source/tests/bl_mesh_validate.py
@@ -0,0 +1,161 @@
+# ##### 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>
+
+# Simple script to check mash validate code.
+# XXX Should be extended with many more "wrong cases"!
+
+import bpy
+
+import sys
+import random
+
+
+MESHES = {
+    "test1": (
+        (
+            (  # Verts
+             (-1.0, -1.0, 0.0),
+             (-1.0, 0.0, 0.0),
+             (-1.0, 1.0, 0.0),
+             (0.0, -1.0, 0.0),
+             (0.0, 0.0, 0.0),
+             (0.0, 1.0, 0.0),
+             (1.0, -1.0, 0.0),
+             (1.0, 0.0, 0.0),
+             (1.5, 0.5, 0.0),
+             (1.0, 1.0, 0.0),
+            ),
+            (  # Edges
+            ),
+            (  # Loops
+             0, 1, 4, 3,
+             3, 4, 6,
+             1, 2, 5, 4,
+             3, 4, 6,
+             4, 7, 6,
+             4, 5, 9, 4, 8, 7,
+            ),
+            (  # Polygons
+             (0, 4),
+             (4, 3),
+             (7, 4),
+             (11, 3),
+             (14, 3),
+             (16, 6),
+            ),
+        ),
+    ),
+}
+
+
+BUILTINS = (
+            "primitive_plane_add",
+            "primitive_cube_add",
+            "primitive_circle_add",
+            "primitive_uv_sphere_add",
+            "primitive_ico_sphere_add",
+            "primitive_cylinder_add",
+            "primitive_cone_add",
+            "primitive_grid_add",
+            "primitive_monkey_add",
+            "primitive_torus_add",
+           )
+BUILTINS_NBR = 4
+BUILTINS_NBRCHANGES = 5
+
+
+def test_meshes():
+    for m in MESHES["test1"]:
+        bpy.ops.object.add(type="MESH")
+        data = bpy.context.active_object.data
+
+        # Vertices.
+        data.vertices.add(len(m[0]))
+        for idx, v in enumerate(m[0]):
+            data.vertices[idx].co = v
+        # Edges.
+        data.edges.add(len(m[1]))
+        for idx, e in enumerate(m[1]):
+            data.edges[idx].vertices = e
+        # Loops.
+        data.loops.add(len(m[2]))
+        for idx, v in enumerate(m[2]):
+            data.loops[idx].vertex_index = v
+        # Polys.
+        data.polygons.add(len(m[3]))
+        for idx, l in enumerate(m[3]):
+            data.polygons[idx].loop_start = l[0]
+            data.polygons[idx].loop_total = l[1]
+
+        while data.validate(verbose=True):
+            pass
+
+
+def test_builtins():
+    for x, func in enumerate(BUILTINS):
+        for y in range(BUILTINS_NBR):
+            getattr(bpy.ops.mesh, func)(location=(x * 2.5, y * 2.5, 0))
+            data = bpy.context.active_object.data
+            try:
+                for n in range(BUILTINS_NBRCHANGES):
+                    rnd = random.randint(1, 3)
+                    if rnd == 1:
+                        # Make fun with some edge.
+                        e = random.randrange(0, len(data.edges))
+                        data.edges[e].vertices[random.randint(0, 1)] = \
+                            random.randrange(0, len(data.vertices) * 2)
+                    elif rnd == 2:
+                        # Make fun with some loop.
+                        l = random.randrange(0, len(data.loops))
+                        if random.randint(0, 1):
+                            data.loops[l].vertex_index = \
+                                random.randrange(0, len(data.vertices) * 2)
+                        else:
+                            data.loops[l].edge_index = \
+                                random.randrange(0, len(data.edges) * 2)
+                    elif rnd == 3:
+                        # Make fun with some poly.
+                        p = random.randrange(0, len(data.polygons))
+                        if random.randint(0, 1):
+                            data.polygons[p].loop_start = \
+                                random.randrange(0, len(data.loops))
+                        else:
+                            data.polygons[p].loop_total = \
+                                random.randrange(0, 10)
+            except:
+                pass
+
+            while data.validate(verbose=True):
+                pass
+
+
+def main():
+    test_builtins()
+    test_meshes()
+
+
+if __name__ == "__main__":
+    # So a python error exits(1)
+    try:
+        main()
+    except:
+        import traceback
+        traceback.print_exc()
+        sys.exit(1)
diff --git a/source/tests/bl_run_operators.py b/source/tests/bl_run_operators.py
index 08e9d5d..53cc37b 100644
--- a/source/tests/bl_run_operators.py
+++ b/source/tests/bl_run_operators.py
@@ -42,6 +42,9 @@ op_blacklist = (
     "wm.doc_view",
     "wm.path_open",
     "help.operator_cheat_sheet",
+    "wm.keyconfig_test",     # just annoying - but harmless
+    "wm.memory_statistics",  # another annoying one
+    # "mesh.vertex_color_remove",  #crashes! fixme
     )
 
 
@@ -64,7 +67,7 @@ def run_ops(operators, setup_func=None):
     for op_id, op in operators:
         if op.poll():
             print("    operator:", op_id)
-            sys.stdout.flush()  # incase of crash
+            sys.stdout.flush()  # in case of crash
 
             # disable will get blender in a bad state and crash easy!
             bpy.ops.wm.read_factory_settings()
diff --git a/source/tests/pep8.py b/source/tests/pep8.py
index 4b957f2..d12397e 100644
--- a/source/tests/pep8.py
+++ b/source/tests/pep8.py
@@ -52,7 +52,7 @@ def is_pep8(path):
     if open(path, 'rb').read(3) == b'\xef\xbb\xbf':
         print("\nfile contains BOM, remove first 3 bytes: %r\n" % path)
 
-    # templates dont have a header but should be pep8
+    # templates don't have a header but should be pep8
     for d in ("presets", "templates", "examples"):
         if ("%s%s%s" % (os.sep, d, os.sep)) in path:
             return 1
diff --git a/source/tools/spell_check_source.py b/source/tools/spell_check_source.py
index a9111b7..40a05f2 100644
--- a/source/tools/spell_check_source.py
+++ b/source/tools/spell_check_source.py
@@ -27,6 +27,9 @@ Script for checking source code spelling.
 Currently only python source is checked.
 """
 
+ONLY_ONCE = True
+_only_once_ids = set()
+
 import enchant
 dict_spelling = enchant.Dict("en_US")
 
@@ -68,7 +71,7 @@ def words_from_text(text):
             return False
 
         # check for code in comments
-        for c in "<>{}[]():._0123456789":
+        for c in "<>{}[]():._0123456789\&*":
             if c in w:
                 return False
 
@@ -133,17 +136,150 @@ def extract_py_comments(filepath):
     return comments
 
 
-def spell_check_py_comments(filepath):
+def extract_c_comments(filepath):
+    """
+    Extracts comments like this:
+
+        /*
+         * This is a multiline comment, notice the '*'s are aligned.
+         */
+    """
+    i = 0
+    text = open(filepath, encoding='utf-8').read()
+
+    BEGIN = "/*"
+    END = "*/"
+    TABSIZE = 4
+    SINGLE_LINE = False
+    STRIP_DOXY = True
+    STRIP_DOXY_DIRECTIVES = (
+        "\section",
+        "\subsection",
+        "\subsubsection",
+        "\ingroup",
+        "\param",
+        "\page",
+        )
+    SKIP_COMMENTS = (
+        "BEGIN GPL LICENSE BLOCK",
+        )
+
+    # 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
+    PRINT_SPELLING = True
+
+    def strip_doxy_comments(block_split):
+
+        for i, l in enumerate(block_split):
+            for directive in STRIP_DOXY_DIRECTIVES:
+                if directive in l:
+                    l_split = l.split()
+                    value = l_split[l_split.index(directive) + 1]
+                    # print("remove:", value)
+                    l = l.replace(value, " ")
+            block_split[i] = l
+
+    comments = []
+
+    while i >= 0:
+        i = text.find(BEGIN, i)
+        if i != -1:
+            i_next = text.find(END, i)
+            if i_next != -1:
+
+                # not essential but seek ack to find beginning of line
+                while i > 0 and text[i - 1] in {"\t", " "}:
+                    i -= 1
+
+                block = text[i:i_next + len(END)]
+
+                # add whitespace infront of the block (for alignment test)
+                ws = []
+                j = i
+                while j > 0 and text[j - 1] != "\n":
+                    ws .append("\t" if text[j - 1] == "\t" else " ")
+                    j -= 1
+                ws.reverse()
+                block = "".join(ws) + block
+
+                ok = True
+
+                if not (SINGLE_LINE or ("\n" in block)):
+                    ok = False
+
+                if ok:
+                    for c in SKIP_COMMENTS:
+                        if c in block:
+                            ok = False
+                            break
+
+                if ok:
+                    # expand tabs
+                    block_split = [l.expandtabs(TABSIZE) for l in block.split("\n")]
+
+                    # now validate that the block is aligned
+                    align_vals = tuple(sorted(set([l.find("*") for l in block_split])))
+                    is_aligned = len(align_vals) == 1
+
+                    if is_aligned:
+                        if PRINT_SPELLING:
+                            if STRIP_DOXY:
+                                strip_doxy_comments(block_split)
+
+                            align = align_vals[0] + 1
+                            block = "\n".join([l[align:] for l in block_split])[:-len(END)]
+
+                            # now strip block and get text
+                            # print(block)
+
+                            # ugh - not nice or fast
+                            slineno = 1 + text.count("\n", 0, i)
+
+                            comments.append(Comment(filepath, block, slineno, 'COMMENT'))
+                    else:
+                        if PRINT_NON_ALIGNED:
+                            lineno = 1 + text.count("\n", 0, i)
+                            if PRINT_QTC_TASKFORMAT:
+                                print("%s\t%d\t%s\t%s" % (filepath, lineno, "comment", align_vals))
+                            else:
+                                print(filepath + ":" + str(lineno) + ":")
+
+            i = i_next
+        else:
+            pass
+
+    return comments
+
+
+def spell_check_comments(filepath):
 
-    comment_list = extract_py_comments(filepath)
+    if filepath.endswith(".py"):
+        comment_list = extract_py_comments(filepath)
+    else:
+        comment_list = extract_c_comments(filepath)
 
     for comment in comment_list:
         for w in comment.parse():
+            #if len(w) < 15:
+            #    continue
+
             w_lower = w.lower()
             if w_lower in dict_custom or w_lower in dict_ignore:
                 continue
 
             if not dict_spelling.check(w):
+
+                if ONLY_ONCE:
+                    if w_lower in _only_once_ids:
+                        continue
+                    else:
+                        _only_once_ids.add(w_lower)
+
                 print("%s:%d: %s, suggest (%s)" %
                       (comment.file,
                        comment.line,
@@ -151,9 +287,38 @@ def spell_check_py_comments(filepath):
                        " ".join(dict_spelling.suggest(w)),
                        ))
 
+
+def spell_check_comments_recursive(dirpath):
+    from os.path import join, splitext
+
+    def source_list(path, filename_check=None):
+        for dirpath, dirnames, filenames in os.walk(path):
+
+            # skip '.svn'
+            if dirpath.startswith("."):
+                continue
+
+            for filename in filenames:
+                filepath = join(dirpath, filename)
+                if filename_check is None or filename_check(filepath):
+                    yield filepath
+
+    def is_source(filename):
+        ext = splitext(filename)[1]
+        return (ext in {".c", ".inl", ".cpp", ".cxx", ".hpp", ".hxx", ".h"})
+
+    for filepath in source_list(dirpath, is_source):
+        spell_check_comments(filepath)
+
+
 import sys
+import os
 
 if __name__ == "__main__":
     for filepath in sys.argv[1:]:
-        print("\nChececking: %r" % filepath)
-        spell_check_py_comments(filepath)
+        if os.path.isdir(filepath):
+            # recursive search
+            spell_check_comments_recursive(filepath)
+        else:
+            # single file
+            spell_check_comments(filepath)
diff --git a/source/tools/spell_check_source_config.py b/source/tools/spell_check_source_config.py
index d945979..cb16f89 100644
--- a/source/tools/spell_check_source_config.py
+++ b/source/tools/spell_check_source_config.py
@@ -44,6 +44,7 @@ dict_custom = {
 
     # accepted abbreviations
     "config",
+    "recalc",
     "addon", "addons",
     "subdir",
     "struct", "structs",
@@ -76,10 +77,14 @@ dict_custom = {
     "xml",
 
     # general computer graphics terms
+    "radiosity",
     "specular",
     "nurbs",
     "compositing",
     "deinterlace",
+    "shader",
+    "shaders",
+    "centroid",
 
     # blender terms
     "bpy",
@@ -123,6 +128,9 @@ dict_ignore = {
     "node-trees",
 
     # acronyms
+    "nan",
+    "utf",
+    "rgb",
     "gzip",
     "ppc",
     "gpl",
@@ -143,6 +151,7 @@ dict_ignore = {
 
     # slang
     "hrmf",
+    "automagically",
 
     # names
     "jahka",
diff --git a/source/tools/tag_release.py b/source/tools/tag_release.py
new file mode 100644
index 0000000..e452764
--- /dev/null
+++ b/source/tools/tag_release.py
@@ -0,0 +1,76 @@
+#!/usr/bin/env python
+
+REV_BLENDER = 44136
+REV_EXTENSIONS = 2994
+REV_LOCALE = 392
+
+TAG_BLENDER = "blender-2.62-release"
+TAG_EXTENSIONS = TAG_LOCALE = "2_62_release"
+
+print("\n# Run these commands from the blender source dir:")
+
+# -----------------------------------------------------------------------------
+# Blender
+
+print('svn cp '
+      'https://svn.blender.org/svnroot/bf-blender/trunk@r%d '
+      'https://svn.blender.org/svnroot/bf-blender/tags/%s '
+      '-m "tagging blender release: %s, %d"' %
+      (REV_BLENDER, TAG_BLENDER, TAG_BLENDER, REV_BLENDER))
+
+
+# -----------------------------------------------------------------------------
+# Extensions
+
+print('svn cp '
+      'https://svn.blender.org/svnroot/bf-extensions/trunk@r%d '
+      'https://svn.blender.org/svnroot/bf-extensions/tags/%s '
+      '-m "tagging blender release: %s, %d"' %
+      (REV_EXTENSIONS, TAG_EXTENSIONS, TAG_EXTENSIONS, REV_EXTENSIONS)
+      )
+
+
+# -----------------------------------------------------------------------------
+# Translations
+
+print('svn cp '
+      'https://svn.blender.org/svnroot/bf-translations/trunk@r%d '
+      'https://svn.blender.org/svnroot/bf-translations/tags/%s '
+      '-m "tagging blender release: %s, %d"' %
+      (REV_LOCALE, TAG_LOCALE, TAG_LOCALE, REV_LOCALE),
+      )
+
+
+# -----------------------------------------------------------------------------
+# Change externals
+
+# switch a checkout of trunk into the tag o avoid a second checkout
+# windows/osx may want to switch lib too.
+print('svn sw '
+      'https://svn.blender.org/svnroot/bf-blender/tags/%s/blender' %
+      (TAG_BLENDER, )
+      )
+
+# Change the extensions location, we can ignore addons_contrib here.
+print('svn propset svn:externals '
+      '"addons https://svn.blender.org/svnroot/bf-extensions/tags/%s/py/scripts/addons" '
+      'release/scripts ' %
+      (TAG_EXTENSIONS, )
+      )
+
+print('svn propset svn:externals '
+      '"locale https://svn.blender.org/svnroot/bf-translations/tags/%s/locale" '
+      'release/datafiles' %
+      (TAG_LOCALE, )
+      )
+
+print('svn ci '
+      'release/scripts '
+      'release/datafiles '
+      '-m "tagging blender release: %s, %d"' %
+      (TAG_BLENDER, REV_BLENDER)
+      )
+
+
+# switch back to trunk
+print("svn sw https://svn.blender.org/svnroot/bf-blender/trunk/blender")
diff --git a/source/tools/uncrustify.cfg b/source/tools/uncrustify.cfg
new file mode 100644
index 0000000..8b4aae7
--- /dev/null
+++ b/source/tools/uncrustify.cfg
@@ -0,0 +1,1459 @@
+# Uncrustify 0.59
+
+#
+# General options
+#
+
+# The type of line endings
+newlines                                 = auto     # auto/lf/crlf/cr
+
+# The original size of tabs in the input
+input_tab_size                           = 4        # number
+
+# The size of tabs in the output (only used if align_with_tabs=true)
+output_tab_size                          = 4        # number
+
+# The ASCII value of the string escape char, usually 92 (\) or 94 (^). (Pawn)
+string_escape_char                       = 92       # number
+
+# Alternate string escape char for Pawn. Only works right before the quote char.
+string_escape_char2                      = 0        # number
+
+# Allow interpreting '>=' and '>>=' as part of a template in 'void f(list<list<B>>=val);'.
+# If true (default), 'assert(x<0 && y>=3)' will be broken.
+# Improvements to template detection may make this option obsolete.
+tok_split_gte                            = false    # false/true
+
+# Control what to do with the UTF-8 BOM (recommed 'remove')
+utf8_bom                                 = ignore   # ignore/add/remove/force
+
+# If the file only contains chars between 128 and 255 and is not UTF-8, then output as UTF-8
+utf8_byte                                = false    # false/true
+
+# Force the output encoding to UTF-8
+utf8_force                               = false    # false/true
+
+#
+# Indenting
+#
+
+# The number of columns to indent per level.
+# Usually 2, 3, 4, or 8.
+indent_columns                           = 4        # number
+
+# The continuation indent. If non-zero, this overrides the indent of '(' and '=' continuation indents.
+# For FreeBSD, this is set to 4.
+indent_continue                          = 0        # number
+
+# How to use tabs when indenting code
+# 0=spaces only
+# 1=indent with tabs to brace level, align with spaces
+# 2=indent and align with tabs, using spaces when not on a tabstop
+indent_with_tabs                         = 1        # number
+
+# Comments that are not a brace level are indented with tabs on a tabstop.
+# Requires indent_with_tabs=2. If false, will use spaces.
+indent_cmt_with_tabs                     = false    # false/true
+
+# Whether to indent strings broken by '\' so that they line up
+indent_align_string                      = false    # false/true
+
+# The number of spaces to indent multi-line XML strings.
+# Requires indent_align_string=True
+indent_xml_string                        = 0        # number
+
+# Spaces to indent '{' from level
+indent_brace                             = 0        # number
+
+# Whether braces are indented to the body level
+indent_braces                            = false    # false/true
+
+# Disabled indenting function braces if indent_braces is true
+indent_braces_no_func                    = false    # false/true
+
+# Disabled indenting class braces if indent_braces is true
+indent_braces_no_class                   = false    # false/true
+
+# Disabled indenting struct braces if indent_braces is true
+indent_braces_no_struct                  = false    # false/true
+
+# Indent based on the size of the brace parent, i.e. 'if' => 3 spaces, 'for' => 4 spaces, etc.
+indent_brace_parent                      = false    # false/true
+
+# Whether the 'namespace' body is indented
+indent_namespace                         = false    # false/true
+
+# The number of spaces to indent a namespace block
+indent_namespace_level                   = 0        # number
+
+# If the body of the namespace is longer than this number, it won't be indented.
+# Requires indent_namespace=true. Default=0 (no limit)
+indent_namespace_limit                   = 0        # number
+
+# Whether the 'extern "C"' body is indented
+indent_extern                            = false    # false/true
+
+# Whether the 'class' body is indented
+indent_class                             = false    # false/true
+
+# Whether to indent the stuff after a leading class colon
+indent_class_colon                       = false    # false/true
+
+# Additional indenting for constructor initializer list
+indent_ctor_init                         = 0        # number
+
+# False=treat 'else\nif' as 'else if' for indenting purposes
+# True=indent the 'if' one level
+indent_else_if                           = false    # false/true
+
+# Amount to indent variable declarations after a open brace. neg=relative, pos=absolute
+indent_var_def_blk                       = 0        # number
+
+# Indent continued variable declarations instead of aligning.
+indent_var_def_cont                      = false    # false/true
+
+# True:  indent continued function call parameters one indent level
+# False: align parameters under the open paren
+indent_func_call_param                   = false    # false/true
+
+# Same as indent_func_call_param, but for function defs
+indent_func_def_param                    = false    # false/true
+
+# Same as indent_func_call_param, but for function protos
+indent_func_proto_param                  = false    # false/true
+
+# Same as indent_func_call_param, but for class declarations
+indent_func_class_param                  = false    # false/true
+
+# Same as indent_func_call_param, but for class variable constructors
+indent_func_ctor_var_param               = false    # false/true
+
+# Same as indent_func_call_param, but for templates
+indent_template_param                    = false    # false/true
+
+# Double the indent for indent_func_xxx_param options
+indent_func_param_double                 = false    # false/true
+
+# Indentation column for standalone 'const' function decl/proto qualifier
+indent_func_const                        = 0        # number
+
+# Indentation column for standalone 'throw' function decl/proto qualifier
+indent_func_throw                        = 0        # number
+
+# The number of spaces to indent a continued '->' or '.'
+# Usually set to 0, 1, or indent_columns.
+indent_member                            = 0        # number
+
+# Spaces to indent single line ('//') comments on lines before code
+indent_sing_line_comments                = 0        # number
+
+# If set, will indent trailing single line ('//') comments relative
+# to the code instead of trying to keep the same absolute column
+indent_relative_single_line_comments     = false    # false/true
+
+# Spaces to indent 'case' from 'switch'
+# Usually 0 or indent_columns.
+indent_switch_case                       = 4        # number
+
+# Spaces to shift the 'case' line, without affecting any other lines
+# Usually 0.
+indent_case_shift                        = 0        # number
+
+# Spaces to indent '{' from 'case'.
+# By default, the brace will appear under the 'c' in case.
+# Usually set to 0 or indent_columns.
+indent_case_brace                        = 0        # number
+
+# Whether to indent comments found in first column
+indent_col1_comment                      = false    # false/true
+
+# How to indent goto labels
+#  >0 : absolute column where 1 is the leftmost column
+#  <=0 : subtract from brace indent
+indent_label                             = 1        # number
+
+# Same as indent_label, but for access specifiers that are followed by a colon
+indent_access_spec                       = 1        # number
+
+# Indent the code after an access specifier by one level.
+# If set, this option forces 'indent_access_spec=0'
+indent_access_spec_body                  = false    # false/true
+
+# If an open paren is followed by a newline, indent the next line so that it lines up after the open paren (not recommended)
+indent_paren_nl                          = false    # false/true
+
+# Controls the indent of a close paren after a newline.
+# 0: Indent to body level
+# 1: Align under the open paren
+# 2: Indent to the brace level
+indent_paren_close                       = 0        # number
+
+# Controls the indent of a comma when inside a paren.If TRUE, aligns under the open paren
+indent_comma_paren                       = false    # false/true
+
+# Controls the indent of a BOOL operator when inside a paren.If TRUE, aligns under the open paren
+indent_bool_paren                        = false    # false/true
+
+# If 'indent_bool_paren' is true, controls the indent of the first expression. If TRUE, aligns the first expression to the following ones
+indent_first_bool_expr                   = false    # false/true
+
+# If an open square is followed by a newline, indent the next line so that it lines up after the open square (not recommended)
+indent_square_nl                         = false    # false/true
+
+# Don't change the relative indent of ESQL/C 'EXEC SQL' bodies
+indent_preserve_sql                      = false    # false/true
+
+# Align continued statements at the '='. Default=True
+# If FALSE or the '=' is followed by a newline, the next line is indent one tab.
+indent_align_assign                      = true     # false/true
+
+#
+# Spacing options
+#
+
+# Add or remove space around arithmetic operator '+', '-', '/', '*', etc
+sp_arith                                 = add   # ignore/add/remove/force
+
+# Add or remove space around assignment operator '=', '+=', etc
+sp_assign                                = add   # ignore/add/remove/force
+
+# Add or remove space around assignment operator '=' in a prototype
+sp_assign_default                        = add   # ignore/add/remove/force
+
+# Add or remove space before assignment operator '=', '+=', etc. Overrides sp_assign.
+sp_before_assign                         = add   # ignore/add/remove/force
+
+# Add or remove space after assignment operator '=', '+=', etc. Overrides sp_assign.
+sp_after_assign                          = add   # ignore/add/remove/force
+
+# Add or remove space around assignment '=' in enum
+sp_enum_assign                           = add   # ignore/add/remove/force
+
+# Add or remove space before assignment '=' in enum. Overrides sp_enum_assign.
+sp_enum_before_assign                    = add   # ignore/add/remove/force
+
+# Add or remove space after assignment '=' in enum. Overrides sp_enum_assign.
+sp_enum_after_assign                     = add   # ignore/add/remove/force
+
+# Add or remove space around preprocessor '##' concatenation operator. Default=Add
+sp_pp_concat                             = ignore      # ignore/add/remove/force
+
+# Add or remove space after preprocessor '#' stringify operator. Also affects the '#@' charizing operator. Default=Add
+sp_pp_stringify                          = ignore      # ignore/add/remove/force
+
+# Add or remove space around boolean operators '&&' and '||'
+sp_bool                                  = add   # ignore/add/remove/force
+
+# Add or remove space around compare operator '<', '>', '==', etc
+sp_compare                               = add   # ignore/add/remove/force
+
+# Add or remove space inside '(' and ')'
+sp_inside_paren                          = remove   # ignore/add/remove/force
+
+# Add or remove space between nested parens
+sp_paren_paren                           = ignore   # ignore/add/remove/force
+
+# Whether to balance spaces inside nested parens
+sp_balance_nested_parens                 = false    # false/true
+
+# Add or remove space between ')' and '{'
+sp_paren_brace                           = add   # ignore/add/remove/force
+
+# Add or remove space before pointer star '*'
+sp_before_ptr_star                       = add   # ignore/add/remove/force
+
+# Add or remove space before pointer star '*' that isn't followed by a variable name
+# If set to 'ignore', sp_before_ptr_star is used instead.
+sp_before_unnamed_ptr_star               = add   # ignore/add/remove/force
+
+# Add or remove space between pointer stars '*'
+sp_between_ptr_star                      = remove   # ignore/add/remove/force
+
+# Add or remove space after pointer star '*', if followed by a word.
+sp_after_ptr_star                        = remove   # ignore/add/remove/force
+
+# Add or remove space after a pointer star '*', if followed by a func proto/def.
+sp_after_ptr_star_func                   = remove   # ignore/add/remove/force
+
+# Add or remove space before a pointer star '*', if followed by a func proto/def.
+sp_before_ptr_star_func                  = add   # ignore/add/remove/force
+
+# Add or remove space before a reference sign '&'
+sp_before_byref                          = ignore   # ignore/add/remove/force
+
+# Add or remove space before a reference sign '&' that isn't followed by a variable name
+# If set to 'ignore', sp_before_byref is used instead.
+sp_before_unnamed_byref                  = ignore   # ignore/add/remove/force
+
+# Add or remove space after reference sign '&', if followed by a word.
+sp_after_byref                           = ignore   # ignore/add/remove/force
+
+# Add or remove space after a reference sign '&', if followed by a func proto/def.
+sp_after_byref_func                      = ignore   # ignore/add/remove/force
+
+# Add or remove space before a reference sign '&', if followed by a func proto/def.
+sp_before_byref_func                     = ignore   # ignore/add/remove/force
+
+# Add or remove space between type and word. Default=Force
+sp_after_type                            = force    # ignore/add/remove/force
+
+# Add or remove space in 'template <' vs 'template<'.
+# If set to ignore, sp_before_angle is used.
+sp_template_angle                        = ignore   # ignore/add/remove/force
+
+# Add or remove space before '<>'
+sp_before_angle                          = ignore   # ignore/add/remove/force
+
+# Add or remove space inside '<' and '>'
+sp_inside_angle                          = ignore   # ignore/add/remove/force
+
+# Add or remove space after '<>'
+sp_after_angle                           = ignore   # ignore/add/remove/force
+
+# Add or remove space between '<>' and '(' as found in 'new List<byte>();'
+sp_angle_paren                           = ignore   # ignore/add/remove/force
+
+# Add or remove space between '<>' and a word as in 'List<byte> m;'
+sp_angle_word                            = ignore   # ignore/add/remove/force
+
+# Add or remove space between '>' and '>' in '>>' (template stuff C++/C# only). Default=Add
+sp_angle_shift                           = add      # ignore/add/remove/force
+
+# Add or remove space before '(' of 'if', 'for', 'switch', and 'while'
+sp_before_sparen                         = add   # ignore/add/remove/force
+
+# Add or remove space inside if-condition '(' and ')'
+sp_inside_sparen                         = remove   # ignore/add/remove/force
+
+# Add or remove space before if-condition ')'. Overrides sp_inside_sparen.
+sp_inside_sparen_close                   = ignore   # ignore/add/remove/force
+
+# Add or remove space after ')' of 'if', 'for', 'switch', and 'while'
+sp_after_sparen                          = add   # ignore/add/remove/force
+
+# Add or remove space between ')' and '{' of 'if', 'for', 'switch', and 'while'
+sp_sparen_brace                          = add   # ignore/add/remove/force
+
+# Add or remove space between 'invariant' and '(' in the D language.
+sp_invariant_paren                       = ignore   # ignore/add/remove/force
+
+# Add or remove space after the ')' in 'invariant (C) c' in the D language.
+sp_after_invariant_paren                 = ignore   # ignore/add/remove/force
+
+# Add or remove space before empty statement ';' on 'if', 'for' and 'while'
+sp_special_semi                          = ignore   # ignore/add/remove/force
+
+# Add or remove space before ';'. Default=Remove
+sp_before_semi                           = remove   # ignore/add/remove/force
+
+# Add or remove space before ';' in non-empty 'for' statements
+sp_before_semi_for                       = ignore   # ignore/add/remove/force
+
+# Add or remove space before a semicolon of an empty part of a for statement.
+sp_before_semi_for_empty                 = ignore   # ignore/add/remove/force
+
+# Add or remove space after ';', except when followed by a comment. Default=Add
+sp_after_semi                            = add      # ignore/add/remove/force
+
+# Add or remove space after ';' in non-empty 'for' statements. Default=Force
+sp_after_semi_for                        = force    # ignore/add/remove/force
+
+# Add or remove space after the final semicolon of an empty part of a for statement: for ( ; ; <here> ).
+sp_after_semi_for_empty                  = ignore   # ignore/add/remove/force
+
+# Add or remove space before '[' (except '[]')
+sp_before_square                         = remove   # ignore/add/remove/force
+
+# Add or remove space before '[]'
+sp_before_squares                        = remove   # ignore/add/remove/force
+
+# Add or remove space inside a non-empty '[' and ']'
+sp_inside_square                         = remove   # ignore/add/remove/force
+
+# Add or remove space after ','
+sp_after_comma                           = add   # ignore/add/remove/force
+
+# Add or remove space before ','
+sp_before_comma                          = remove   # ignore/add/remove/force
+
+# Add or remove space between an open paren and comma: '(,' vs '( ,'
+sp_paren_comma                           = force    # ignore/add/remove/force
+
+# Add or remove space before the variadic '...' when preceded by a non-punctuator
+sp_before_ellipsis                       = ignore   # ignore/add/remove/force
+
+# Add or remove space after class ':'
+sp_after_class_colon                     = ignore   # ignore/add/remove/force
+
+# Add or remove space before class ':'
+sp_before_class_colon                    = ignore   # ignore/add/remove/force
+
+# Add or remove space before case ':'. Default=Remove
+sp_before_case_colon                     = remove   # ignore/add/remove/force
+
+# Add or remove space between 'operator' and operator sign
+sp_after_operator                        = ignore   # ignore/add/remove/force
+
+# Add or remove space between the operator symbol and the open paren, as in 'operator ++('
+sp_after_operator_sym                    = ignore   # ignore/add/remove/force
+
+# Add or remove space after C/D cast, i.e. 'cast(int)a' vs 'cast(int) a' or '(int)a' vs '(int) a'
+sp_after_cast                            = ignore   # ignore/add/remove/force
+
+# Add or remove spaces inside cast parens
+sp_inside_paren_cast                     = ignore   # ignore/add/remove/force
+
+# Add or remove space between the type and open paren in a C++ cast, i.e. 'int(exp)' vs 'int (exp)'
+sp_cpp_cast_paren                        = ignore   # ignore/add/remove/force
+
+# Add or remove space between 'sizeof' and '('
+sp_sizeof_paren                          = ignore   # ignore/add/remove/force
+
+# Add or remove space after the tag keyword (Pawn)
+sp_after_tag                             = ignore   # ignore/add/remove/force
+
+# Add or remove space inside enum '{' and '}'
+sp_inside_braces_enum                    = ignore   # ignore/add/remove/force
+
+# Add or remove space inside struct/union '{' and '}'
+sp_inside_braces_struct                  = ignore   # ignore/add/remove/force
+
+# Add or remove space inside '{' and '}'
+sp_inside_braces                         = ignore   # ignore/add/remove/force
+
+# Add or remove space inside '{}'
+sp_inside_braces_empty                   = ignore   # ignore/add/remove/force
+
+# Add or remove space between return type and function name
+# A minimum of 1 is forced except for pointer return types.
+sp_type_func                             = ignore   # ignore/add/remove/force
+
+# Add or remove space between function name and '(' on function declaration
+sp_func_proto_paren                      = remove   # ignore/add/remove/force
+
+# Add or remove space between function name and '(' on function definition
+sp_func_def_paren                        = remove   # ignore/add/remove/force
+
+# Add or remove space inside empty function '()'
+sp_inside_fparens                        = ignore   # ignore/add/remove/force
+
+# Add or remove space inside function '(' and ')'
+sp_inside_fparen                         = remove   # ignore/add/remove/force
+
+# Add or remove space between ']' and '(' when part of a function call.
+sp_square_fparen                         = ignore   # ignore/add/remove/force
+
+# Add or remove space between ')' and '{' of function
+sp_fparen_brace                          = ignore   # ignore/add/remove/force
+
+# Add or remove space between function name and '(' on function calls
+sp_func_call_paren                       = remove   # ignore/add/remove/force
+
+# Add or remove space between function name and '()' on function calls without parameters.
+# If set to 'ignore' (the default), sp_func_call_paren is used.
+sp_func_call_paren_empty                 = ignore   # ignore/add/remove/force
+
+# Add or remove space between the user function name and '(' on function calls
+# You need to set a keyword to be a user function, like this: 'set func_call_user _' in the config file.
+sp_func_call_user_paren                  = ignore   # ignore/add/remove/force
+
+# Add or remove space between a constructor/destructor and the open paren
+sp_func_class_paren                      = ignore   # ignore/add/remove/force
+
+# Add or remove space between 'return' and '('
+sp_return_paren                          = ignore   # ignore/add/remove/force
+
+# Add or remove space between '__attribute__' and '('
+sp_attribute_paren                       = ignore   # ignore/add/remove/force
+
+# Add or remove space between 'defined' and '(' in '#if defined (FOO)'
+sp_defined_paren                         = remove   # ignore/add/remove/force
+
+# Add or remove space between 'throw' and '(' in 'throw (something)'
+sp_throw_paren                           = ignore   # ignore/add/remove/force
+
+# Add or remove space between 'catch' and '(' in 'catch (something) { }'
+# If set to ignore, sp_before_sparen is used.
+sp_catch_paren                           = ignore   # ignore/add/remove/force
+
+# Add or remove space between 'version' and '(' in 'version (something) { }' (D language)
+# If set to ignore, sp_before_sparen is used.
+sp_version_paren                         = ignore   # ignore/add/remove/force
+
+# Add or remove space between 'scope' and '(' in 'scope (something) { }' (D language)
+# If set to ignore, sp_before_sparen is used.
+sp_scope_paren                           = ignore   # ignore/add/remove/force
+
+# Add or remove space between macro and value
+sp_macro                                 = ignore   # ignore/add/remove/force
+
+# Add or remove space between macro function ')' and value
+sp_macro_func                            = ignore   # ignore/add/remove/force
+
+# Add or remove space between 'else' and '{' if on the same line
+sp_else_brace                            = add   # ignore/add/remove/force
+
+# Add or remove space between '}' and 'else' if on the same line
+sp_brace_else                            = ignore   # ignore/add/remove/force
+
+# Add or remove space between '}' and the name of a typedef on the same line
+sp_brace_typedef                         = ignore   # ignore/add/remove/force
+
+# Add or remove space between 'catch' and '{' if on the same line
+sp_catch_brace                           = ignore   # ignore/add/remove/force
+
+# Add or remove space between '}' and 'catch' if on the same line
+sp_brace_catch                           = ignore   # ignore/add/remove/force
+
+# Add or remove space between 'finally' and '{' if on the same line
+sp_finally_brace                         = ignore   # ignore/add/remove/force
+
+# Add or remove space between '}' and 'finally' if on the same line
+sp_brace_finally                         = ignore   # ignore/add/remove/force
+
+# Add or remove space between 'try' and '{' if on the same line
+sp_try_brace                             = ignore   # ignore/add/remove/force
+
+# Add or remove space between get/set and '{' if on the same line
+sp_getset_brace                          = ignore   # ignore/add/remove/force
+
+# Add or remove space before the '::' operator
+sp_before_dc                             = ignore   # ignore/add/remove/force
+
+# Add or remove space after the '::' operator
+sp_after_dc                              = ignore   # ignore/add/remove/force
+
+# Add or remove around the D named array initializer ':' operator
+sp_d_array_colon                         = ignore   # ignore/add/remove/force
+
+# Add or remove space after the '!' (not) operator. Default=Remove
+sp_not                                   = remove   # ignore/add/remove/force
+
+# Add or remove space after the '~' (invert) operator. Default=Remove
+sp_inv                                   = remove   # ignore/add/remove/force
+
+# Add or remove space after the '&' (address-of) operator. Default=Remove
+# This does not affect the spacing after a '&' that is part of a type.
+sp_addr                                  = remove   # ignore/add/remove/force
+
+# Add or remove space around the '.' or '->' operators. Default=Remove
+sp_member                                = remove   # ignore/add/remove/force
+
+# Add or remove space after the '*' (dereference) operator. Default=Remove
+# This does not affect the spacing after a '*' that is part of a type.
+sp_deref                                 = remove   # ignore/add/remove/force
+
+# Add or remove space after '+' or '-', as in 'x = -5' or 'y = +7'. Default=Remove
+sp_sign                                  = remove   # ignore/add/remove/force
+
+# Add or remove space before or after '++' and '--', as in '(--x)' or 'y++;'. Default=Remove
+sp_incdec                                = remove   # ignore/add/remove/force
+
+# Add or remove space before a backslash-newline at the end of a line. Default=Add
+sp_before_nl_cont                        = add      # ignore/add/remove/force
+
+# Add or remove space after the scope '+' or '-', as in '-(void) foo;' or '+(int) bar;'
+sp_after_oc_scope                        = ignore   # ignore/add/remove/force
+
+# Add or remove space after the colon in message specs
+# '-(int) f:(int) x;' vs '-(int) f: (int) x;'
+sp_after_oc_colon                        = ignore   # ignore/add/remove/force
+
+# Add or remove space before the colon in message specs
+# '-(int) f: (int) x;' vs '-(int) f : (int) x;'
+sp_before_oc_colon                       = ignore   # ignore/add/remove/force
+
+# Add or remove space after the colon in message specs
+# '[object setValue:1];' vs '[object setValue: 1];'
+sp_after_send_oc_colon                   = ignore   # ignore/add/remove/force
+
+# Add or remove space before the colon in message specs
+# '[object setValue:1];' vs '[object setValue :1];'
+sp_before_send_oc_colon                  = ignore   # ignore/add/remove/force
+
+# Add or remove space after the (type) in message specs
+# '-(int)f: (int) x;' vs '-(int)f: (int)x;'
+sp_after_oc_type                         = ignore   # ignore/add/remove/force
+
+# Add or remove space after the first (type) in message specs
+# '-(int) f:(int)x;' vs '-(int)f:(int)x;'
+sp_after_oc_return_type                  = ignore   # ignore/add/remove/force
+
+# Add or remove space between '@selector' and '('
+# '@selector(msgName)' vs '@selector (msgName)'
+# Also applies to @protocol() constructs
+sp_after_oc_at_sel                       = ignore   # ignore/add/remove/force
+
+# Add or remove space between '@selector(x)' and the following word
+# '@selector(foo) a:' vs '@selector(foo)a:'
+sp_after_oc_at_sel_parens                = ignore   # ignore/add/remove/force
+
+# Add or remove space inside '@selector' parens
+# '@selector(foo)' vs '@selector( foo )'
+# Also applies to @protocol() constructs
+sp_inside_oc_at_sel_parens               = ignore   # ignore/add/remove/force
+
+# Add or remove space before a block pointer caret
+# '^int (int arg){...}' vs. ' ^int (int arg){...}'
+sp_before_oc_block_caret                 = ignore   # ignore/add/remove/force
+
+# Add or remove space after a block pointer caret
+# '^int (int arg){...}' vs. '^ int (int arg){...}'
+sp_after_oc_block_caret                  = ignore   # ignore/add/remove/force
+
+# Add or remove space around the ':' in 'b ? t : f'
+sp_cond_colon                            = ignore   # ignore/add/remove/force
+
+# Add or remove space around the '?' in 'b ? t : f'
+sp_cond_question                         = ignore   # ignore/add/remove/force
+
+# Fix the spacing between 'case' and the label. Only 'ignore' and 'force' make sense here.
+sp_case_label                            = ignore   # ignore/add/remove/force
+
+# Control the space around the D '..' operator.
+sp_range                                 = ignore   # ignore/add/remove/force
+
+# Control the space after the opening of a C++ comment '// A' vs '//A'
+sp_cmt_cpp_start                         = ignore   # ignore/add/remove/force
+
+# Controls the spaces between #else or #endif and a trailing comment
+sp_endif_cmt                             = ignore   # ignore/add/remove/force
+
+# Controls the spaces after 'new', 'delete', and 'delete[]'
+sp_after_new                             = ignore   # ignore/add/remove/force
+
+# Controls the spaces before a trailing or embedded comment
+sp_before_tr_emb_cmt                     = ignore   # ignore/add/remove/force
+
+# Number of spaces before a trailing or embedded comment
+sp_num_before_tr_emb_cmt                 = 0        # number
+
+#
+# Code alignment (not left column spaces/tabs)
+#
+
+# Whether to keep non-indenting tabs
+align_keep_tabs                          = false    # false/true
+
+# Whether to use tabs for aligning
+align_with_tabs                          = false    # false/true
+
+# Whether to bump out to the next tab when aligning
+align_on_tabstop                         = false    # false/true
+
+# Whether to left-align numbers
+align_number_left                        = false    # false/true
+
+# Align variable definitions in prototypes and functions
+align_func_params                        = false    # false/true
+
+# Align parameters in single-line functions that have the same name.
+# The function names must already be aligned with each other.
+align_same_func_call_params              = false    # false/true
+
+# The span for aligning variable definitions (0=don't align)
+align_var_def_span                       = 0        # number
+
+# How to align the star in variable definitions.
+#  0=Part of the type     'void *   foo;'
+#  1=Part of the variable 'void     *foo;'
+#  2=Dangling             'void    *foo;'
+align_var_def_star_style                 = 2        # number
+
+# How to align the '&' in variable definitions.
+#  0=Part of the type
+#  1=Part of the variable
+#  2=Dangling
+align_var_def_amp_style                  = 2        # number
+
+# The threshold for aligning variable definitions (0=no limit)
+align_var_def_thresh                     = 0        # number
+
+# The gap for aligning variable definitions
+align_var_def_gap                        = 0        # number
+
+# Whether to align the colon in struct bit fields
+align_var_def_colon                      = false    # false/true
+
+# Whether to align any attribute after the variable name
+align_var_def_attribute                  = false    # false/true
+
+# Whether to align inline struct/enum/union variable definitions
+align_var_def_inline                     = false    # false/true
+
+# The span for aligning on '=' in assignments (0=don't align)
+align_assign_span                        = 0        # number
+
+# The threshold for aligning on '=' in assignments (0=no limit)
+align_assign_thresh                      = 0        # number
+
+# The span for aligning on '=' in enums (0=don't align)
+align_enum_equ_span                      = 0        # number
+
+# The threshold for aligning on '=' in enums (0=no limit)
+align_enum_equ_thresh                    = 0        # number
+
+# The span for aligning struct/union (0=don't align)
+align_var_struct_span                    = 0        # number
+
+# The threshold for aligning struct/union member definitions (0=no limit)
+align_var_struct_thresh                  = 0        # number
+
+# The gap for aligning struct/union member definitions
+align_var_struct_gap                     = 0        # number
+
+# The span for aligning struct initializer values (0=don't align)
+align_struct_init_span                   = 0        # number
+
+# The minimum space between the type and the synonym of a typedef
+align_typedef_gap                        = 0        # number
+
+# The span for aligning single-line typedefs (0=don't align)
+align_typedef_span                       = 0        # number
+
+# How to align typedef'd functions with other typedefs
+# 0: Don't mix them at all
+# 1: align the open paren with the types
+# 2: align the function type name with the other type names
+align_typedef_func                       = 0        # number
+
+# Controls the positioning of the '*' in typedefs. Just try it.
+# 0: Align on typedef type, ignore '*'
+# 1: The '*' is part of type name: typedef int  *pint;
+# 2: The '*' is part of the type, but dangling: typedef int *pint;
+align_typedef_star_style                 = 2        # number
+
+# Controls the positioning of the '&' in typedefs. Just try it.
+# 0: Align on typedef type, ignore '&'
+# 1: The '&' is part of type name: typedef int  &pint;
+# 2: The '&' is part of the type, but dangling: typedef int &pint;
+align_typedef_amp_style                  = 2        # number
+
+# The span for aligning comments that end lines (0=don't align)
+align_right_cmt_span                     = 0        # number
+
+# If aligning comments, mix with comments after '}' and #endif with less than 3 spaces before the comment
+align_right_cmt_mix                      = false    # false/true
+
+# If a trailing comment is more than this number of columns away from the text it follows,
+# it will qualify for being aligned. This has to be > 0 to do anything.
+align_right_cmt_gap                      = 0        # number
+
+# Align trailing comment at or beyond column N; 'pulls in' comments as a bonus side effect (0=ignore)
+align_right_cmt_at_col                   = 0        # number
+
+# The span for aligning function prototypes (0=don't align)
+align_func_proto_span                    = 0        # number
+
+# Minimum gap between the return type and the function name.
+align_func_proto_gap                     = 0        # number
+
+# Align function protos on the 'operator' keyword instead of what follows
+align_on_operator                        = false    # false/true
+
+# Whether to mix aligning prototype and variable declarations.
+# If true, align_var_def_XXX options are used instead of align_func_proto_XXX options.
+align_mix_var_proto                      = false    # false/true
+
+# Align single-line functions with function prototypes, uses align_func_proto_span
+align_single_line_func                   = false    # false/true
+
+# Aligning the open brace of single-line functions.
+# Requires align_single_line_func=true, uses align_func_proto_span
+align_single_line_brace                  = false    # false/true
+
+# Gap for align_single_line_brace.
+align_single_line_brace_gap              = 0        # number
+
+# The span for aligning ObjC msg spec (0=don't align)
+align_oc_msg_spec_span                   = 0        # number
+
+# Whether to align macros wrapped with a backslash and a newline.
+# This will not work right if the macro contains a multi-line comment.
+align_nl_cont                            = false    # false/true
+
+# The minimum space between label and value of a preprocessor define
+align_pp_define_gap                      = 0        # number
+
+# The span for aligning on '#define' bodies (0=don't align)
+align_pp_define_span                     = 0        # number
+
+# Align lines that start with '<<' with previous '<<'. Default=true
+align_left_shift                         = true     # false/true
+
+# Span for aligning parameters in an Obj-C message call on the ':' (0=don't align)
+align_oc_msg_colon_span                  = 0        # number
+
+# Aligning parameters in an Obj-C '+' or '-' declaration on the ':'
+align_oc_decl_colon                      = false    # false/true
+
+#
+# Newline adding and removing options
+#
+
+# Whether to collapse empty blocks between '{' and '}'
+nl_collapse_empty_body                   = false    # false/true
+
+# Don't split one-line braced assignments - 'foo_t f = { 1, 2 };'
+nl_assign_leave_one_liners               = false    # false/true
+
+# Don't split one-line braced statements inside a class xx { } body
+nl_class_leave_one_liners                = false    # false/true
+
+# Don't split one-line enums: 'enum foo { BAR = 15 };'
+nl_enum_leave_one_liners                 = false    # false/true
+
+# Don't split one-line get or set functions
+nl_getset_leave_one_liners               = false    # false/true
+
+# Don't split one-line function definitions - 'int foo() { return 0; }'
+nl_func_leave_one_liners                 = false    # false/true
+
+# Don't split one-line if/else statements - 'if(a) b++;'
+nl_if_leave_one_liners                   = false    # false/true
+
+# Add or remove newlines at the start of the file
+nl_start_of_file                         = ignore   # ignore/add/remove/force
+
+# The number of newlines at the start of the file (only used if nl_start_of_file is 'add' or 'force'
+nl_start_of_file_min                     = 0        # number
+
+# Add or remove newline at the end of the file
+nl_end_of_file                           = ignore   # ignore/add/remove/force
+
+# The number of newlines at the end of the file (only used if nl_end_of_file is 'add' or 'force')
+nl_end_of_file_min                       = 0        # number
+
+# Add or remove newline between '=' and '{'
+nl_assign_brace                          = ignore   # ignore/add/remove/force
+
+# Add or remove newline between '=' and '[' (D only)
+nl_assign_square                         = ignore   # ignore/add/remove/force
+
+# Add or remove newline after '= [' (D only). Will also affect the newline before the ']'
+nl_after_square_assign                   = ignore   # ignore/add/remove/force
+
+# The number of blank lines after a block of variable definitions at the top of a function body.
+# 0=no change (default)
+nl_func_var_def_blk                      = 0        # number
+
+# Add or remove newline between a function call's ')' and '{', as in:
+# list_for_each(item, &list) { }
+nl_fcall_brace                           = add   # ignore/add/remove/force
+
+# Add or remove newline between 'enum' and '{'
+nl_enum_brace                            = ignore   # ignore/add/remove/force
+
+# Add or remove newline between 'struct and '{'
+nl_struct_brace                          = remove   # ignore/add/remove/force
+
+# Add or remove newline between 'union' and '{'
+nl_union_brace                           = remove   # ignore/add/remove/force
+
+# Add or remove newline between 'if' and '{'
+nl_if_brace                              = ignore   # ignore/add/remove/force
+
+# Add or remove newline between '}' and 'else'
+nl_brace_else                            = add   # ignore/add/remove/force
+
+# Add or remove newline between 'else if' and '{'
+# If set to ignore, nl_if_brace is used instead
+nl_elseif_brace                          = ignore   # ignore/add/remove/force
+
+# Add or remove newline between 'else' and '{'
+nl_else_brace                            = remove   # ignore/add/remove/force
+
+# Add or remove newline between 'else' and 'if'
+nl_else_if                               = ignore   # ignore/add/remove/force
+
+# Add or remove newline between '}' and 'finally'
+nl_brace_finally                         = ignore   # ignore/add/remove/force
+
+# Add or remove newline between 'finally' and '{'
+nl_finally_brace                         = ignore   # ignore/add/remove/force
+
+# Add or remove newline between 'try' and '{'
+nl_try_brace                             = ignore   # ignore/add/remove/force
+
+# Add or remove newline between get/set and '{'
+nl_getset_brace                          = ignore   # ignore/add/remove/force
+
+# Add or remove newline between 'for' and '{'
+nl_for_brace                             = ignore   # ignore/add/remove/force
+
+# Add or remove newline between 'catch' and '{'
+nl_catch_brace                           = ignore   # ignore/add/remove/force
+
+# Add or remove newline between '}' and 'catch'
+nl_brace_catch                           = ignore   # ignore/add/remove/force
+
+# Add or remove newline between 'while' and '{'
+nl_while_brace                           = ignore   # ignore/add/remove/force
+
+# Add or remove newline between 'using' and '{'
+nl_using_brace                           = ignore   # ignore/add/remove/force
+
+# Add or remove newline between two open or close braces.
+# Due to general newline/brace handling, REMOVE may not work.
+nl_brace_brace                           = ignore   # ignore/add/remove/force
+
+# Add or remove newline between 'do' and '{'
+nl_do_brace                              = remove   # ignore/add/remove/force
+
+# Add or remove newline between '}' and 'while' of 'do' statement
+nl_brace_while                           = remove   # ignore/add/remove/force
+
+# Add or remove newline between 'switch' and '{'
+nl_switch_brace                          = ignore   # ignore/add/remove/force
+
+# Add a newline between ')' and '{' if the ')' is on a different line than the if/for/etc.
+# Overrides nl_for_brace, nl_if_brace, nl_switch_brace, nl_while_switch, and nl_catch_brace.
+nl_multi_line_cond                       = false    # false/true
+
+# Force a newline in a define after the macro name for multi-line defines.
+nl_multi_line_define                     = false    # false/true
+
+# Whether to put a newline before 'case' statement
+nl_before_case                           = false    # false/true
+
+# Add or remove newline between ')' and 'throw'
+nl_before_throw                          = ignore   # ignore/add/remove/force
+
+# Whether to put a newline after 'case' statement
+nl_after_case                            = false    # false/true
+
+# Add or remove a newline between a case ':' and '{'. Overrides nl_after_case.
+nl_case_colon_brace                      = ignore   # ignore/add/remove/force
+
+# Newline between namespace and {
+nl_namespace_brace                       = ignore   # ignore/add/remove/force
+
+# Add or remove newline between 'template<>' and whatever follows.
+nl_template_class                        = ignore   # ignore/add/remove/force
+
+# Add or remove newline between 'class' and '{'
+nl_class_brace                           = ignore   # ignore/add/remove/force
+
+# Add or remove newline after each ',' in the constructor member initialization
+nl_class_init_args                       = ignore   # ignore/add/remove/force
+
+# Add or remove newline between return type and function name in a function definition
+nl_func_type_name                        = ignore   # ignore/add/remove/force
+
+# Add or remove newline between return type and function name inside a class {}
+# Uses nl_func_type_name or nl_func_proto_type_name if set to ignore.
+nl_func_type_name_class                  = ignore   # ignore/add/remove/force
+
+# Add or remove newline between function scope and name in a definition
+# Controls the newline after '::' in 'void A::f() { }'
+nl_func_scope_name                       = ignore   # ignore/add/remove/force
+
+# Add or remove newline between return type and function name in a prototype
+nl_func_proto_type_name                  = ignore   # ignore/add/remove/force
+
+# Add or remove newline between a function name and the opening '('
+nl_func_paren                            = ignore   # ignore/add/remove/force
+
+# Add or remove newline between a function name and the opening '(' in the definition
+nl_func_def_paren                        = ignore   # ignore/add/remove/force
+
+# Add or remove newline after '(' in a function declaration
+nl_func_decl_start                       = ignore   # ignore/add/remove/force
+
+# Add or remove newline after '(' in a function definition
+nl_func_def_start                        = ignore   # ignore/add/remove/force
+
+# Overrides nl_func_decl_start when there is only one parameter.
+nl_func_decl_start_single                = ignore   # ignore/add/remove/force
+
+# Overrides nl_func_def_start when there is only one parameter.
+nl_func_def_start_single                 = ignore   # ignore/add/remove/force
+
+# Add or remove newline after each ',' in a function declaration
+nl_func_decl_args                        = ignore   # ignore/add/remove/force
+
+# Add or remove newline after each ',' in a function definition
+nl_func_def_args                         = ignore   # ignore/add/remove/force
+
+# Add or remove newline before the ')' in a function declaration
+nl_func_decl_end                         = ignore   # ignore/add/remove/force
+
+# Add or remove newline before the ')' in a function definition
+nl_func_def_end                          = ignore   # ignore/add/remove/force
+
+# Overrides nl_func_decl_end when there is only one parameter.
+nl_func_decl_end_single                  = ignore   # ignore/add/remove/force
+
+# Overrides nl_func_def_end when there is only one parameter.
+nl_func_def_end_single                   = ignore   # ignore/add/remove/force
+
+# Add or remove newline between '()' in a function declaration.
+nl_func_decl_empty                       = ignore   # ignore/add/remove/force
+
+# Add or remove newline between '()' in a function definition.
+nl_func_def_empty                        = ignore   # ignore/add/remove/force
+
+# Add or remove newline between function signature and '{'
+nl_fdef_brace                            = ignore   # ignore/add/remove/force
+
+# Whether to put a newline after 'return' statement
+nl_after_return                          = false    # false/true
+
+# Add or remove a newline between the return keyword and return expression.
+nl_return_expr                           = ignore   # ignore/add/remove/force
+
+# Whether to put a newline after semicolons, except in 'for' statements
+nl_after_semicolon                       = false    # false/true
+
+# Whether to put a newline after brace open.
+# This also adds a newline before the matching brace close.
+nl_after_brace_open                      = false    # false/true
+
+# If nl_after_brace_open and nl_after_brace_open_cmt are true, a newline is
+# placed between the open brace and a trailing single-line comment.
+nl_after_brace_open_cmt                  = false    # false/true
+
+# Whether to put a newline after a virtual brace open with a non-empty body.
+# These occur in un-braced if/while/do/for statement bodies.
+nl_after_vbrace_open                     = false    # false/true
+
+# Whether to put a newline after a virtual brace open with an empty body.
+# These occur in un-braced if/while/do/for statement bodies.
+nl_after_vbrace_open_empty               = false    # false/true
+
+# Whether to put a newline after a brace close.
+# Does not apply if followed by a necessary ';'.
+nl_after_brace_close                     = false    # false/true
+
+# Whether to put a newline after a virtual brace close.
+# Would add a newline before return in: 'if (foo) a++; return;'
+nl_after_vbrace_close                    = false    # false/true
+
+# Whether to alter newlines in '#define' macros
+nl_define_macro                          = false    # false/true
+
+# Whether to not put blanks after '#ifxx', '#elxx', or before '#endif'
+nl_squeeze_ifdef                         = false    # false/true
+
+# Add or remove blank line before 'if'
+nl_before_if                             = ignore   # ignore/add/remove/force
+
+# Add or remove blank line after 'if' statement
+nl_after_if                              = ignore   # ignore/add/remove/force
+
+# Add or remove blank line before 'for'
+nl_before_for                            = ignore   # ignore/add/remove/force
+
+# Add or remove blank line after 'for' statement
+nl_after_for                             = ignore   # ignore/add/remove/force
+
+# Add or remove blank line before 'while'
+nl_before_while                          = ignore   # ignore/add/remove/force
+
+# Add or remove blank line after 'while' statement
+nl_after_while                           = ignore   # ignore/add/remove/force
+
+# Add or remove blank line before 'switch'
+nl_before_switch                         = ignore   # ignore/add/remove/force
+
+# Add or remove blank line after 'switch' statement
+nl_after_switch                          = ignore   # ignore/add/remove/force
+
+# Add or remove blank line before 'do'
+nl_before_do                             = ignore   # ignore/add/remove/force
+
+# Add or remove blank line after 'do/while' statement
+nl_after_do                              = ignore   # ignore/add/remove/force
+
+# Whether to double-space commented-entries in struct/enum
+nl_ds_struct_enum_cmt                    = false    # false/true
+
+# Whether to double-space before the close brace of a struct/union/enum
+# (lower priority than 'eat_blanks_before_close_brace')
+nl_ds_struct_enum_close_brace            = false    # false/true
+
+# Add or remove a newline around a class colon.
+# Related to pos_class_colon, nl_class_init_args, and pos_comma.
+nl_class_colon                           = ignore   # ignore/add/remove/force
+
+# Change simple unbraced if statements into a one-liner
+# 'if(b)\n i++;' => 'if(b) i++;'
+nl_create_if_one_liner                   = false    # false/true
+
+# Change simple unbraced for statements into a one-liner
+# 'for (i=0;i<5;i++)\n foo(i);' => 'for (i=0;i<5;i++) foo(i);'
+nl_create_for_one_liner                  = false    # false/true
+
+# Change simple unbraced while statements into a one-liner
+# 'while (i<5)\n foo(i++);' => 'while (i<5) foo(i++);'
+nl_create_while_one_liner                = false    # false/true
+
+#
+# Positioning options
+#
+
+# The position of arithmetic operators in wrapped expressions
+pos_arith                                = ignore   # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force
+
+# The position of assignment in wrapped expressions.
+# Do not affect '=' followed by '{'
+pos_assign                               = ignore   # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force
+
+# The position of boolean operators in wrapped expressions
+pos_bool                                 = ignore   # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force
+
+# The position of comparison operators in wrapped expressions
+pos_compare                              = ignore   # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force
+
+# The position of conditional (b ? t : f) operators in wrapped expressions
+pos_conditional                          = ignore   # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force
+
+# The position of the comma in wrapped expressions
+pos_comma                                = ignore   # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force
+
+# The position of the comma in the constructor initialization list
+pos_class_comma                          = ignore   # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force
+
+# The position of colons between constructor and member initialization
+pos_class_colon                          = ignore   # ignore/lead/lead_break/lead_force/trail/trail_break/trail_force
+
+#
+# Line Splitting options
+#
+
+# Try to limit code width to N number of columns
+code_width                               = 0        # number
+
+# Whether to fully split long 'for' statements at semi-colons
+ls_for_split_full                        = false    # false/true
+
+# Whether to fully split long function protos/calls at commas
+ls_func_split_full                       = false    # false/true
+
+#
+# Blank line options
+#
+
+# The maximum consecutive newlines
+nl_max                                   = 0        # number
+
+# The number of newlines after a function prototype, if followed by another function prototype
+nl_after_func_proto                      = 0        # number
+
+# The number of newlines after a function prototype, if not followed by another function prototype
+nl_after_func_proto_group                = 0        # number
+
+# The number of newlines after '}' of a multi-line function body
+nl_after_func_body                       = 0        # number
+
+# The number of newlines after '}' of a multi-line function body in a class declaration
+nl_after_func_body_class                 = 0        # number
+
+# The number of newlines after '}' of a single line function body
+nl_after_func_body_one_liner             = 0        # number
+
+# The minimum number of newlines before a multi-line comment.
+# Doesn't apply if after a brace open or another multi-line comment.
+nl_before_block_comment                  = 0        # number
+
+# The minimum number of newlines before a single-line C comment.
+# Doesn't apply if after a brace open or other single-line C comments.
+nl_before_c_comment                      = 0        # number
+
+# The minimum number of newlines before a CPP comment.
+# Doesn't apply if after a brace open or other CPP comments.
+nl_before_cpp_comment                    = 0        # number
+
+# Whether to force a newline after a multi-line comment.
+nl_after_multiline_comment               = false    # false/true
+
+# The number of newlines after '}' or ';' of a struct/enum/union definition
+nl_after_struct                          = 0        # number
+
+# The number of newlines after '}' or ';' of a class definition
+nl_after_class                           = 0        # number
+
+# The number of newlines before a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label.
+# Will not change the newline count if after a brace open.
+# 0 = No change.
+nl_before_access_spec                    = 0        # number
+
+# The number of newlines after a 'private:', 'public:', 'protected:', 'signals:', or 'slots:' label.
+# 0 = No change.
+nl_after_access_spec                     = 0        # number
+
+# The number of newlines between a function def and the function comment.
+# 0 = No change.
+nl_comment_func_def                      = 0        # number
+
+# The number of newlines after a try-catch-finally block that isn't followed by a brace close.
+# 0 = No change.
+nl_after_try_catch_finally               = 0        # number
+
+# The number of newlines before and after a property, indexer or event decl.
+# 0 = No change.
+nl_around_cs_property                    = 0        # number
+
+# The number of newlines between the get/set/add/remove handlers in C#.
+# 0 = No change.
+nl_between_get_set                       = 0        # number
+
+# Add or remove newline between C# property and the '{'
+nl_property_brace                        = ignore   # ignore/add/remove/force
+
+# Whether to remove blank lines after '{'
+eat_blanks_after_open_brace              = false    # false/true
+
+# Whether to remove blank lines before '}'
+eat_blanks_before_close_brace            = false    # false/true
+
+#
+# Code modifying options (non-whitespace)
+#
+
+# Add or remove braces on single-line 'do' statement
+mod_full_brace_do                        = ignore   # ignore/add/remove/force
+
+# Add or remove braces on single-line 'for' statement
+mod_full_brace_for                       = ignore   # ignore/add/remove/force
+
+# Add or remove braces on single-line function definitions. (Pawn)
+mod_full_brace_function                  = ignore   # ignore/add/remove/force
+
+# Add or remove braces on single-line 'if' statement. Will not remove the braces if they contain an 'else'.
+mod_full_brace_if                        = ignore   # ignore/add/remove/force
+
+# Make all if/elseif/else statements in a chain be braced or not. Overrides mod_full_brace_if.
+# If any must be braced, they are all braced.  If all can be unbraced, then the braces are removed.
+mod_full_brace_if_chain                  = false    # false/true
+
+# Don't remove braces around statements that span N newlines
+mod_full_brace_nl                        = 0        # number
+
+# Add or remove braces on single-line 'while' statement
+mod_full_brace_while                     = ignore   # ignore/add/remove/force
+
+# Add or remove braces on single-line 'using ()' statement
+mod_full_brace_using                     = ignore   # ignore/add/remove/force
+
+# Add or remove unnecessary paren on 'return' statement
+mod_paren_on_return                      = ignore   # ignore/add/remove/force
+
+# Whether to change optional semicolons to real semicolons
+mod_pawn_semicolon                       = false    # false/true
+
+# Add parens on 'while' and 'if' statement around bools
+mod_full_paren_if_bool                   = false    # false/true
+
+# Whether to remove superfluous semicolons
+mod_remove_extra_semicolon               = false    # false/true
+
+# If a function body exceeds the specified number of newlines and doesn't have a comment after
+# the close brace, a comment will be added.
+mod_add_long_function_closebrace_comment = 0        # number
+
+# If a switch body exceeds the specified number of newlines and doesn't have a comment after
+# the close brace, a comment will be added.
+mod_add_long_switch_closebrace_comment   = 0        # number
+
+# If an #ifdef body exceeds the specified number of newlines and doesn't have a comment after
+# the #endif, a comment will be added.
+mod_add_long_ifdef_endif_comment         = 0        # number
+
+# If an #ifdef or #else body exceeds the specified number of newlines and doesn't have a comment after
+# the #else, a comment will be added.
+mod_add_long_ifdef_else_comment          = 0        # number
+
+# If TRUE, will sort consecutive single-line 'import' statements [Java, D]
+mod_sort_import                          = false    # false/true
+
+# If TRUE, will sort consecutive single-line 'using' statements [C#]
+mod_sort_using                           = false    # false/true
+
+# If TRUE, will sort consecutive single-line '#include' statements [C/C++] and '#import' statements [Obj-C]
+# This is generally a bad idea, as it may break your code.
+mod_sort_include                         = false    # false/true
+
+# If TRUE, it will move a 'break' that appears after a fully braced 'case' before the close brace.
+mod_move_case_break                      = false    # false/true
+
+# Will add or remove the braces around a fully braced case statement.
+# Will only remove the braces if there are no variable declarations in the block.
+mod_case_brace                           = ignore   # ignore/add/remove/force
+
+# If TRUE, it will remove a void 'return;' that appears as the last statement in a function.
+mod_remove_empty_return                  = false    # false/true
+
+#
+# Comment modifications
+#
+
+# Try to wrap comments at cmt_width columns
+cmt_width                                = 0        # number
+
+# Set the comment reflow mode (default: 0)
+# 0: no reflowing (apart from the line wrapping due to cmt_width)
+# 1: no touching at all
+# 2: full reflow
+cmt_reflow_mode                          = 0        # number
+
+# If false, disable all multi-line comment changes, including cmt_width. keyword substitution, and leading chars.
+# Default is true.
+cmt_indent_multi                         = true     # false/true
+
+# Whether to group c-comments that look like they are in a block
+cmt_c_group                              = false    # false/true
+
+# Whether to put an empty '/*' on the first line of the combined c-comment
+cmt_c_nl_start                           = false    # false/true
+
+# Whether to put a newline before the closing '*/' of the combined c-comment
+cmt_c_nl_end                             = false    # false/true
+
+# Whether to group cpp-comments that look like they are in a block
+cmt_cpp_group                            = false    # false/true
+
+# Whether to put an empty '/*' on the first line of the combined cpp-comment
+cmt_cpp_nl_start                         = false    # false/true
+
+# Whether to put a newline before the closing '*/' of the combined cpp-comment
+cmt_cpp_nl_end                           = false    # false/true
+
+# Whether to change cpp-comments into c-comments
+cmt_cpp_to_c                             = false    # false/true
+
+# Whether to put a star on subsequent comment lines
+cmt_star_cont                            = false    # false/true
+
+# The number of spaces to insert at the start of subsequent comment lines
+cmt_sp_before_star_cont                  = 0        # number
+
+# The number of spaces to insert after the star on subsequent comment lines
+cmt_sp_after_star_cont                   = 0        # number
+
+# For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of
+# the comment are the same length. Default=True
+cmt_multi_check_last                     = true     # false/true
+
+# The filename that contains text to insert at the head of a file if the file doesn't start with a C/C++ comment.
+# Will substitute $(filename) with the current file's name.
+cmt_insert_file_header                   = ""         # string
+
+# The filename that contains text to insert at the end of a file if the file doesn't end with a C/C++ comment.
+# Will substitute $(filename) with the current file's name.
+cmt_insert_file_footer                   = ""         # string
+
+# The filename that contains text to insert before a function implementation if the function isn't preceded with a C/C++ comment.
+# Will substitute $(function) with the function name and $(javaparam) with the javadoc @param and @return stuff.
+# Will also substitute $(fclass) with the class name: void CFoo::Bar() { ... }
+cmt_insert_func_header                   = ""         # string
+
+# The filename that contains text to insert before a class if the class isn't preceded with a C/C++ comment.
+# Will substitute $(class) with the class name.
+cmt_insert_class_header                  = ""         # string
+
+# The filename that contains text to insert before a Obj-C message specification if the method isn't preceeded with a C/C++ comment.
+# Will substitute $(message) with the function name and $(javaparam) with the javadoc @param and @return stuff.
+cmt_insert_oc_msg_header                 = ""         # string
+
+# If a preprocessor is encountered when stepping backwards from a function name, then
+# this option decides whether the comment should be inserted.
+# Affects cmt_insert_oc_msg_header, cmt_insert_func_header and cmt_insert_class_header.
+cmt_insert_before_preproc                = false    # false/true
+
+#
+# Preprocessor options
+#
+
+# Control indent of preprocessors inside #if blocks at brace level 0
+pp_indent                                = ignore   # ignore/add/remove/force
+
+# Whether to indent #if/#else/#endif at the brace level (true) or from column 1 (false)
+pp_indent_at_level                       = false    # false/true
+
+# If pp_indent_at_level=false, specifies the number of columns to indent per level. Default=1.
+pp_indent_count                          = 1        # number
+
+# Add or remove space after # based on pp_level of #if blocks
+pp_space                                 = ignore   # ignore/add/remove/force
+
+# Sets the number of spaces added with pp_space
+pp_space_count                           = 0        # number
+
+# The indent for #region and #endregion in C# and '#pragma region' in C/C++
+pp_indent_region                         = 0        # number
+
+# Whether to indent the code between #region and #endregion
+pp_region_indent_code                    = false    # false/true
+
+# If pp_indent_at_level=true, sets the indent for #if, #else, and #endif when not at file-level
+pp_indent_if                             = 0        # number
+
+# Control whether to indent the code between #if, #else and #endif when not at file-level
+pp_if_indent_code                        = false    # false/true
+
+# Whether to indent '#define' at the brace level (true) or from column 1 (false)
+pp_define_at_level                       = false    # false/true
+
+# You can force a token to be a type with the 'type' option.
+# Example:
+# type myfoo1 myfoo2
+#
+# You can create custom macro-based indentation using macro-open,
+# macro-else and macro-close.
+# Example:
+# macro-open  BEGIN_TEMPLATE_MESSAGE_MAP
+# macro-open  BEGIN_MESSAGE_MAP
+# macro-close END_MESSAGE_MAP
+#
+# You can assign any keyword to any type with the set option.
+# set func_call_user _ N_
+#
+# The full syntax description of all custom definition config entries
+# is shown below:
+#
+# define custom tokens as:
+# - embed whitespace in token using '' escape character, or
+#   put token in quotes
+# - these: ' " and ` are recognized as quote delimiters
+#
+# type token1 token2 token3 ...
+#             ^ optionally specify multiple tokens on a single line
+# define def_token output_token
+#                  ^ output_token is optional, then NULL is assumed
+# macro-open token
+# macro-close token
+# macro-else token
+# set id token1 token2 ...
+#               ^ optionally specify multiple tokens on a single line
+#     ^ id is one of the names in token_enum.h sans the CT_ prefix,
+#       e.g. PP_PRAGMA
+#
+# all tokens are separated by any mix of ',' commas, '=' equal signs
+# and whitespace (space, tab)
+#
+
+# Custom blender macros
+# RNA_access.h
+set FOR RNA_BEGIN
+set FOR RNA_PROP_BEGIN
+set FOR RNA_STRUCT_BEGIN
+# BKE_context.h
+set FOR CTX_DATA_BEGIN
+# BKE_sequencer.h
+set FOR SEQP_BEGIN
+set FOR SEQ_BEGIN
+# BKE_particle.h
+set FOR LOOP_PARTICLES
+set FOR LOOP_EXISTING_PARTICLES
+set FOR LOOP_SHOWN_PARTICLES
+set FOR LOOP_DYNAMIC_PARTICLES
+# bmesh_iterators.h
+set FOR BM_ITER_MESH
+set FOR BM_ITER_MESH_INDEX
+set FOR BM_ITER_ELEM
+set FOR BM_ITER_ELEM_INDEX
+# bmesh_operator_api.h
+set FOR BMO_ITER
+
+
diff --git a/source/tools/uncrustify_clean.sh b/source/tools/uncrustify_clean.sh
new file mode 100755
index 0000000..d1e3a7c
--- /dev/null
+++ b/source/tools/uncrustify_clean.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+CFG="source/tools/uncrustify.cfg"
+
+if [ ! -f $CFG ]
+then
+	echo "Run this from the blender source directory: " $CFG " not found, aborting"
+	exit 0
+fi
+
+
+for fn in "$@"
+do
+	# without this, the script simply undoes whitespace changes.
+	uncrustify -c $CFG --no-backup --replace "$fn"
+ 
+	cp "$fn" "$fn.NEW"
+	svn revert "$fn" 1> /dev/null
+ 
+	diff "$fn" "$fn.NEW" -u --ignore-trailing-space --ignore-blank-lines > "$fn.DIFF"
+ 
+	patch -p0 < "$fn.DIFF" 1> /dev/null
+ 
+	rm "$fn.NEW"
+	rm "$fn.DIFF"
+done
diff --git a/source/tools/update_themes.py b/source/tools/update_themes.py
new file mode 100644
index 0000000..99c8345
--- /dev/null
+++ b/source/tools/update_themes.py
@@ -0,0 +1,53 @@
+# ##### 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 script updates XML themes once new settings are added
+#
+#  ./blender.bin --background --python source/tools/update_themes.py
+
+import bpy
+import os
+
+
+def update(filepath):
+    import rna_xml
+    context = bpy.context
+
+    print("Updating theme: %r" % filepath)
+    preset_xml_map = (("user_preferences.themes[0]", "Theme"), )
+    rna_xml.xml_file_run(context,
+                         filepath,
+                         preset_xml_map)
+
+    rna_xml.xml_file_write(context,
+                           filepath,
+                           preset_xml_map)
+
+
+def main():
+    for path in bpy.utils.preset_paths("interface_theme"):
+        for fn in os.listdir(path):
+            if fn.endswith(".xml"):
+                fn_full = os.path.join(path, fn)
+                update(fn_full)
+
+
+if __name__ == "__main__":
+    main()

-- 
blender packaging



More information about the pkg-multimedia-commits mailing list